From 4175bfa50e8b676ba160ec2a5d8f461c9ddb8476 Mon Sep 17 00:00:00 2001 From: Andrea Bianco Date: Sat, 28 Aug 2021 11:52:29 +0200 Subject: [PATCH] Built motion from commit 13fdd181.|2.5.34 --- apidoc/api_project.js | 2 +- apidoc/api_project.json | 2 +- server/api/action/action.attributes.js | 2 +- server/api/action/action.controller.js | 2 +- server/api/action/action.model.js | 2 +- server/api/action/action.rpc.js | 2 +- server/api/action/index.js | 2 +- .../analyticCustomReport.attributes.js | 2 +- .../analyticCustomReport.controller.js | 2 +- .../analyticCustomReport.model.js | 2 +- .../analyticCustomReport.rpc.js | 2 +- server/api/analyticCustomReport/index.js | 2 +- .../analyticDefaultReport.attributes.js | 2 +- .../analyticDefaultReport.controller.js | 2 +- .../analyticDefaultReport.model.js | 2 +- .../analyticDefaultReport.rpc.js | 2 +- server/api/analyticDefaultReport/index.js | 2 +- .../analyticExtractedReport.attributes.js | 2 +- .../analyticExtractedReport.controller.js | 2 +- .../analyticExtractedReport.model.js | 2 +- .../analyticExtractedReport.rpc.js | 2 +- server/api/analyticExtractedReport/index.js | 2 +- .../analyticFieldReport.attributes.js | 2 +- .../analyticFieldReport.controller.js | 2 +- .../analyticFieldReport.model.js | 2 +- .../analyticFieldReport/analyticFieldReport.rpc.js | 2 +- server/api/analyticFieldReport/index.js | 2 +- .../analyticMetric/analyticMetric.attributes.js | 2 +- .../analyticMetric/analyticMetric.controller.js | 2 +- server/api/analyticMetric/analyticMetric.model.js | 2 +- server/api/analyticMetric/analyticMetric.rpc.js | 2 +- server/api/analyticMetric/index.js | 2 +- .../analyticTreeReport.attributes.js | 2 +- .../analyticTreeReport.controller.js | 2 +- .../analyticTreeReport/analyticTreeReport.model.js | 2 +- .../analyticTreeReport/analyticTreeReport.rpc.js | 2 +- server/api/analyticTreeReport/index.js | 2 +- server/api/attachment/attachment.attributes.js | 2 +- server/api/attachment/attachment.controller.js | 2 +- server/api/attachment/attachment.model.js | 2 +- server/api/attachment/attachment.rpc.js | 2 +- server/api/attachment/index.js | 2 +- server/api/authGoogle/authGoogle.controller.js | 2 +- server/api/authGoogle/index.js | 2 +- server/api/authLocal/authLocal.controller.js | 2 +- server/api/authLocal/index.js | 2 +- server/api/automation/automation.attributes.js | 2 +- server/api/automation/automation.controller.js | 2 +- server/api/automation/automation.model.js | 2 +- server/api/automation/automation.rpc.js | 2 +- server/api/automation/index.js | 2 +- server/api/campaign/campaign.attributes.js | 2 +- server/api/campaign/campaign.controller.js | 2 +- server/api/campaign/campaign.model.js | 2 +- server/api/campaign/campaign.rpc.js | 2 +- server/api/campaign/index.js | 2 +- server/api/cannedAnswer/cannedAnswer.attributes.js | 2 +- server/api/cannedAnswer/cannedAnswer.controller.js | 2 +- server/api/cannedAnswer/cannedAnswer.model.js | 2 +- server/api/cannedAnswer/cannedAnswer.rpc.js | 2 +- server/api/cannedAnswer/index.js | 2 +- server/api/cdr/cdr.attributes.js | 2 +- server/api/cdr/cdr.controller.js | 2 +- server/api/cdr/cdr.model.js | 2 +- server/api/cdr/cdr.rpc.js | 2 +- server/api/cdr/index.js | 2 +- .../chatApplication/chatApplication.attributes.js | 2 +- .../chatApplication/chatApplication.controller.js | 2 +- .../api/chatApplication/chatApplication.model.js | 2 +- server/api/chatApplication/chatApplication.rpc.js | 2 +- server/api/chatApplication/index.js | 2 +- server/api/chatGroup/chatGroup.attributes.js | 2 +- server/api/chatGroup/chatGroup.controller.js | 2 +- server/api/chatGroup/chatGroup.events.js | 2 +- server/api/chatGroup/chatGroup.model.js | 2 +- server/api/chatGroup/chatGroup.rpc.js | 2 +- server/api/chatGroup/chatGroup.socket.js | 2 +- server/api/chatGroup/index.js | 2 +- .../chatInteraction/chatInteraction.attributes.js | 2 +- .../chatInteraction/chatInteraction.controller.js | 2 +- .../api/chatInteraction/chatInteraction.events.js | 2 +- .../api/chatInteraction/chatInteraction.model.js | 2 +- server/api/chatInteraction/chatInteraction.rpc.js | 2 +- .../api/chatInteraction/chatInteraction.socket.js | 2 +- server/api/chatInteraction/index.js | 2 +- .../chatInternalMessage.attributes.js | 2 +- .../chatInternalMessage.controller.js | 2 +- .../chatInternalMessage.events.js | 2 +- .../chatInternalMessage.model.js | 2 +- .../chatInternalMessage/chatInternalMessage.rpc.js | 2 +- .../chatInternalMessage.socket.js | 2 +- server/api/chatInternalMessage/index.js | 2 +- server/api/chatMessage/chatMessage.attributes.js | 2 +- server/api/chatMessage/chatMessage.controller.js | 2 +- server/api/chatMessage/chatMessage.events.js | 2 +- server/api/chatMessage/chatMessage.model.js | 2 +- server/api/chatMessage/chatMessage.rpc.js | 2 +- server/api/chatMessage/chatMessage.socket.js | 2 +- server/api/chatMessage/index.js | 2 +- .../chatOfflineMessage.attributes.js | 2 +- .../chatOfflineMessage.controller.js | 2 +- .../chatOfflineMessage/chatOfflineMessage.model.js | 2 +- .../chatOfflineMessage/chatOfflineMessage.rpc.js | 2 +- server/api/chatOfflineMessage/index.js | 2 +- .../chatProactiveAction.attributes.js | 2 +- .../chatProactiveAction.controller.js | 2 +- .../chatProactiveAction.model.js | 2 +- .../chatProactiveAction/chatProactiveAction.rpc.js | 2 +- server/api/chatProactiveAction/index.js | 2 +- server/api/chatQueue/chatQueue.attributes.js | 2 +- server/api/chatQueue/chatQueue.controller.js | 2 +- server/api/chatQueue/chatQueue.events.js | 2 +- server/api/chatQueue/chatQueue.model.js | 2 +- server/api/chatQueue/chatQueue.rpc.js | 2 +- server/api/chatQueue/chatQueue.socket.js | 2 +- server/api/chatQueue/index.js | 2 +- .../chatQueueReport/chatQueueReport.attributes.js | 2 +- .../chatQueueReport/chatQueueReport.controller.js | 2 +- .../api/chatQueueReport/chatQueueReport.model.js | 2 +- server/api/chatQueueReport/chatQueueReport.rpc.js | 2 +- server/api/chatQueueReport/index.js | 2 +- .../chatTransferReport.attributes.js | 2 +- .../chatTransferReport.controller.js | 2 +- .../chatTransferReport/chatTransferReport.model.js | 2 +- .../chatTransferReport/chatTransferReport.rpc.js | 2 +- server/api/chatTransferReport/index.js | 2 +- server/api/chatWebsite/chatWebsite.attributes.js | 2 +- server/api/chatWebsite/chatWebsite.controller.js | 2 +- server/api/chatWebsite/chatWebsite.events.js | 2 +- server/api/chatWebsite/chatWebsite.model.js | 2 +- server/api/chatWebsite/chatWebsite.rpc.js | 2 +- server/api/chatWebsite/chatWebsite.socket.js | 2 +- server/api/chatWebsite/index.js | 2 +- .../api/cloudProvider/cloudProvider.attributes.js | 2 +- .../api/cloudProvider/cloudProvider.controller.js | 2 +- server/api/cloudProvider/cloudProvider.model.js | 2 +- server/api/cloudProvider/cloudProvider.rpc.js | 2 +- server/api/cloudProvider/index.js | 2 +- server/api/cmCompany/cmCompany.attributes.js | 2 +- server/api/cmCompany/cmCompany.controller.js | 2 +- server/api/cmCompany/cmCompany.model.js | 2 +- server/api/cmCompany/cmCompany.rpc.js | 2 +- server/api/cmCompany/index.js | 2 +- server/api/cmContact/cmContact.attributes.js | 2 +- server/api/cmContact/cmContact.controller.js | 2 +- server/api/cmContact/cmContact.events.js | 2 +- server/api/cmContact/cmContact.model.js | 2 +- server/api/cmContact/cmContact.rpc.js | 2 +- server/api/cmContact/cmContact.socket.js | 2 +- server/api/cmContact/index.js | 2 +- .../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 +- .../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 +- server/api/dashboard/dashboard.attributes.js | 2 +- server/api/dashboard/dashboard.controller.js | 2 +- server/api/dashboard/dashboard.events.js | 2 +- server/api/dashboard/dashboard.model.js | 2 +- server/api/dashboard/dashboard.rpc.js | 2 +- server/api/dashboard/dashboard.socket.js | 2 +- server/api/dashboard/index.js | 2 +- .../api/dashboardItem/dashboardItem.attributes.js | 2 +- .../api/dashboardItem/dashboardItem.controller.js | 2 +- server/api/dashboardItem/dashboardItem.events.js | 2 +- server/api/dashboardItem/dashboardItem.model.js | 2 +- server/api/dashboardItem/dashboardItem.rpc.js | 2 +- server/api/dashboardItem/dashboardItem.socket.js | 2 +- server/api/dashboardItem/index.js | 2 +- server/api/disposition/disposition.attributes.js | 2 +- server/api/disposition/disposition.controller.js | 2 +- server/api/disposition/disposition.model.js | 2 +- server/api/disposition/disposition.rpc.js | 2 +- server/api/disposition/index.js | 2 +- server/api/faxAccount/faxAccount.attributes.js | 2 +- server/api/faxAccount/faxAccount.controller.js | 2 +- server/api/faxAccount/faxAccount.events.js | 2 +- server/api/faxAccount/faxAccount.model.js | 2 +- server/api/faxAccount/faxAccount.rpc.js | 2 +- server/api/faxAccount/faxAccount.socket.js | 2 +- server/api/faxAccount/index.js | 2 +- .../faxApplication/faxApplication.attributes.js | 2 +- .../faxApplication/faxApplication.controller.js | 2 +- server/api/faxApplication/faxApplication.model.js | 2 +- server/api/faxApplication/faxApplication.rpc.js | 2 +- server/api/faxApplication/index.js | 2 +- .../faxInteraction/faxInteraction.attributes.js | 2 +- .../faxInteraction/faxInteraction.controller.js | 2 +- server/api/faxInteraction/faxInteraction.events.js | 2 +- server/api/faxInteraction/faxInteraction.model.js | 2 +- server/api/faxInteraction/faxInteraction.rpc.js | 2 +- server/api/faxInteraction/faxInteraction.socket.js | 2 +- server/api/faxInteraction/index.js | 2 +- server/api/faxMessage/faxMessage.attributes.js | 2 +- server/api/faxMessage/faxMessage.controller.js | 2 +- server/api/faxMessage/faxMessage.events.js | 2 +- server/api/faxMessage/faxMessage.model.js | 2 +- server/api/faxMessage/faxMessage.rpc.js | 2 +- server/api/faxMessage/faxMessage.socket.js | 2 +- server/api/faxMessage/index.js | 2 +- server/api/faxQueue/faxQueue.attributes.js | 2 +- server/api/faxQueue/faxQueue.controller.js | 2 +- server/api/faxQueue/faxQueue.events.js | 2 +- server/api/faxQueue/faxQueue.model.js | 2 +- server/api/faxQueue/faxQueue.rpc.js | 2 +- server/api/faxQueue/faxQueue.socket.js | 2 +- server/api/faxQueue/index.js | 2 +- .../faxQueueReport/faxQueueReport.attributes.js | 2 +- .../faxQueueReport/faxQueueReport.controller.js | 2 +- server/api/faxQueueReport/faxQueueReport.model.js | 2 +- server/api/faxQueueReport/faxQueueReport.rpc.js | 2 +- server/api/faxQueueReport/index.js | 2 +- .../faxTransferReport.attributes.js | 2 +- .../faxTransferReport.controller.js | 2 +- .../faxTransferReport/faxTransferReport.model.js | 2 +- .../api/faxTransferReport/faxTransferReport.rpc.js | 2 +- server/api/faxTransferReport/index.js | 2 +- server/api/intDeskAccount/index.js | 2 +- .../intDeskAccount/intDeskAccount.attributes.js | 2 +- .../intDeskAccount/intDeskAccount.controller.js | 2 +- server/api/intDeskAccount/intDeskAccount.model.js | 2 +- server/api/intDeskAccount/intDeskAccount.rpc.js | 2 +- server/api/intDeskConfiguration/index.js | 2 +- .../intDeskConfiguration.attributes.js | 2 +- .../intDeskConfiguration.controller.js | 2 +- .../intDeskConfiguration.model.js | 2 +- .../intDeskConfiguration.rpc.js | 2 +- server/api/intDeskField/index.js | 2 +- server/api/intDeskField/intDeskField.attributes.js | 2 +- server/api/intDeskField/intDeskField.controller.js | 2 +- server/api/intDeskField/intDeskField.model.js | 2 +- server/api/intDeskField/intDeskField.rpc.js | 2 +- server/api/intDynamics365Account/index.js | 2 +- .../intDynamics365Account.attributes.js | 2 +- .../intDynamics365Account.controller.js | 2 +- .../intDynamics365Account.model.js | 2 +- .../intDynamics365Account.rpc.js | 2 +- server/api/intDynamics365Configuration/index.js | 2 +- .../intDynamics365Configuration.attributes.js | 2 +- .../intDynamics365Configuration.controller.js | 2 +- .../intDynamics365Configuration.model.js | 2 +- .../intDynamics365Configuration.rpc.js | 2 +- server/api/intDynamics365Field/index.js | 2 +- .../intDynamics365Field.attributes.js | 2 +- .../intDynamics365Field.controller.js | 2 +- .../intDynamics365Field.model.js | 2 +- .../intDynamics365Field/intDynamics365Field.rpc.js | 2 +- server/api/intFreshdeskAccount/index.js | 2 +- .../intFreshdeskAccount.attributes.js | 2 +- .../intFreshdeskAccount.controller.js | 2 +- .../intFreshdeskAccount.model.js | 2 +- .../intFreshdeskAccount/intFreshdeskAccount.rpc.js | 2 +- server/api/intFreshdeskConfiguration/index.js | 2 +- .../intFreshdeskConfiguration.attributes.js | 2 +- .../intFreshdeskConfiguration.controller.js | 2 +- .../intFreshdeskConfiguration.model.js | 2 +- .../intFreshdeskConfiguration.rpc.js | 2 +- server/api/intFreshdeskField/index.js | 2 +- .../intFreshdeskField.attributes.js | 2 +- .../intFreshdeskField.controller.js | 2 +- .../intFreshdeskField/intFreshdeskField.model.js | 2 +- .../api/intFreshdeskField/intFreshdeskField.rpc.js | 2 +- server/api/intFreshsalesAccount/index.js | 2 +- .../intFreshsalesAccount.attributes.js | 2 +- .../intFreshsalesAccount.controller.js | 2 +- .../intFreshsalesAccount.model.js | 2 +- .../intFreshsalesAccount.rpc.js | 2 +- server/api/intFreshsalesConfiguration/index.js | 2 +- .../intFreshsalesConfiguration.attributes.js | 2 +- .../intFreshsalesConfiguration.controller.js | 2 +- .../intFreshsalesConfiguration.model.js | 2 +- .../intFreshsalesConfiguration.rpc.js | 2 +- server/api/intFreshsalesField/index.js | 2 +- .../intFreshsalesField.attributes.js | 2 +- .../intFreshsalesField.controller.js | 2 +- .../intFreshsalesField/intFreshsalesField.model.js | 2 +- .../intFreshsalesField/intFreshsalesField.rpc.js | 2 +- server/api/intSalesforceAccount/index.js | 2 +- .../intSalesforceAccount.attributes.js | 2 +- .../intSalesforceAccount.controller.js | 2 +- .../intSalesforceAccount.model.js | 2 +- .../intSalesforceAccount.rpc.js | 2 +- server/api/intSalesforceConfiguration/index.js | 2 +- .../intSalesforceConfiguration.attributes.js | 2 +- .../intSalesforceConfiguration.controller.js | 2 +- .../intSalesforceConfiguration.model.js | 2 +- .../intSalesforceConfiguration.rpc.js | 2 +- server/api/intSalesforceField/index.js | 2 +- .../intSalesforceField.attributes.js | 2 +- .../intSalesforceField.controller.js | 2 +- .../intSalesforceField/intSalesforceField.model.js | 2 +- .../intSalesforceField/intSalesforceField.rpc.js | 2 +- server/api/intServicenowAccount/index.js | 2 +- .../intServicenowAccount.attributes.js | 2 +- .../intServicenowAccount.controller.js | 2 +- .../intServicenowAccount.model.js | 2 +- .../intServicenowAccount.rpc.js | 2 +- server/api/intServicenowConfiguration/index.js | 2 +- .../intServicenowConfiguration.attributes.js | 2 +- .../intServicenowConfiguration.controller.js | 2 +- .../intServicenowConfiguration.model.js | 2 +- .../intServicenowConfiguration.rpc.js | 2 +- server/api/intServicenowField/index.js | 2 +- .../intServicenowField.attributes.js | 2 +- .../intServicenowField.controller.js | 2 +- .../intServicenowField/intServicenowField.model.js | 2 +- .../intServicenowField/intServicenowField.rpc.js | 2 +- server/api/intSugarcrmAccount/index.js | 2 +- .../intSugarcrmAccount.attributes.js | 2 +- .../intSugarcrmAccount.controller.js | 2 +- .../intSugarcrmAccount/intSugarcrmAccount.model.js | 2 +- .../intSugarcrmAccount/intSugarcrmAccount.rpc.js | 2 +- server/api/intSugarcrmConfiguration/index.js | 2 +- .../intSugarcrmConfiguration.attributes.js | 2 +- .../intSugarcrmConfiguration.controller.js | 2 +- .../intSugarcrmConfiguration.model.js | 2 +- .../intSugarcrmConfiguration.rpc.js | 2 +- server/api/intSugarcrmField/index.js | 2 +- .../intSugarcrmField.attributes.js | 2 +- .../intSugarcrmField.controller.js | 2 +- .../api/intSugarcrmField/intSugarcrmField.model.js | 2 +- .../api/intSugarcrmField/intSugarcrmField.rpc.js | 2 +- server/api/intVtigerAccount/index.js | 2 +- .../intVtigerAccount.attributes.js | 2 +- .../intVtigerAccount.controller.js | 2 +- .../api/intVtigerAccount/intVtigerAccount.model.js | 2 +- .../api/intVtigerAccount/intVtigerAccount.rpc.js | 2 +- server/api/intVtigerConfiguration/index.js | 2 +- .../intVtigerConfiguration.attributes.js | 2 +- .../intVtigerConfiguration.controller.js | 2 +- .../intVtigerConfiguration.model.js | 2 +- .../intVtigerConfiguration.rpc.js | 2 +- server/api/intVtigerField/index.js | 2 +- .../intVtigerField/intVtigerField.attributes.js | 2 +- .../intVtigerField/intVtigerField.controller.js | 2 +- server/api/intVtigerField/intVtigerField.model.js | 2 +- server/api/intVtigerField/intVtigerField.rpc.js | 2 +- server/api/intZendeskAccount/index.js | 2 +- .../intZendeskAccount.attributes.js | 2 +- .../intZendeskAccount.controller.js | 2 +- .../intZendeskAccount/intZendeskAccount.model.js | 2 +- .../api/intZendeskAccount/intZendeskAccount.rpc.js | 2 +- server/api/intZendeskConfiguration/index.js | 2 +- .../intZendeskConfiguration.attributes.js | 2 +- .../intZendeskConfiguration.controller.js | 2 +- .../intZendeskConfiguration.model.js | 2 +- .../intZendeskConfiguration.rpc.js | 2 +- server/api/intZendeskField/index.js | 2 +- .../intZendeskField/intZendeskField.attributes.js | 2 +- .../intZendeskField/intZendeskField.controller.js | 2 +- .../api/intZendeskField/intZendeskField.model.js | 2 +- server/api/intZendeskField/intZendeskField.rpc.js | 2 +- server/api/intZohoAccount/index.js | 2 +- .../intZohoAccount/intZohoAccount.attributes.js | 2 +- .../intZohoAccount/intZohoAccount.controller.js | 2 +- server/api/intZohoAccount/intZohoAccount.model.js | 2 +- server/api/intZohoAccount/intZohoAccount.rpc.js | 2 +- server/api/intZohoConfiguration/index.js | 2 +- .../intZohoConfiguration.attributes.js | 2 +- .../intZohoConfiguration.controller.js | 2 +- .../intZohoConfiguration.model.js | 2 +- .../intZohoConfiguration.rpc.js | 2 +- server/api/intZohoField/index.js | 2 +- server/api/intZohoField/intZohoField.attributes.js | 2 +- server/api/intZohoField/intZohoField.controller.js | 2 +- server/api/intZohoField/intZohoField.model.js | 2 +- server/api/intZohoField/intZohoField.rpc.js | 2 +- server/api/integration/index.js | 2 +- server/api/integration/integration.attributes.js | 2 +- server/api/integration/integration.controller.js | 2 +- server/api/integration/integration.model.js | 2 +- server/api/integration/integration.rpc.js | 2 +- server/api/integrationReport/index.js | 2 +- .../integrationReport.attributes.js | 2 +- .../integrationReport.controller.js | 2 +- .../integrationReport/integrationReport.model.js | 2 +- .../api/integrationReport/integrationReport.rpc.js | 2 +- server/api/interval/index.js | 2 +- server/api/interval/interval.attributes.js | 2 +- server/api/interval/interval.controller.js | 2 +- server/api/interval/interval.model.js | 2 +- server/api/interval/interval.rpc.js | 2 +- server/api/jira/index.js | 2 +- server/api/jira/jira.controller.js | 2 +- server/api/jscriptyAnswerReport/index.js | 2 +- .../jscriptyAnswerReport.attributes.js | 2 +- .../jscriptyAnswerReport.controller.js | 2 +- .../jscriptyAnswerReport.model.js | 2 +- .../jscriptyAnswerReport.rpc.js | 2 +- server/api/jscriptyProject/index.js | 2 +- .../jscriptyProject/jscriptyProject.attributes.js | 2 +- .../jscriptyProject/jscriptyProject.controller.js | 2 +- .../api/jscriptyProject/jscriptyProject.model.js | 2 +- server/api/jscriptyProject/jscriptyProject.rpc.js | 2 +- server/api/jscriptyQuestionReport/index.js | 2 +- .../jscriptyQuestionReport.attributes.js | 2 +- .../jscriptyQuestionReport.controller.js | 2 +- .../jscriptyQuestionReport.model.js | 2 +- .../jscriptyQuestionReport.rpc.js | 2 +- server/api/jscriptySessionReport/index.js | 2 +- .../jscriptySessionReport.attributes.js | 2 +- .../jscriptySessionReport.controller.js | 2 +- .../jscriptySessionReport.model.js | 2 +- .../jscriptySessionReport.rpc.js | 2 +- server/api/license/index.js | 2 +- server/api/license/license.attributes.js | 2 +- server/api/license/license.controller.js | 2 +- server/api/license/license.model.js | 2 +- server/api/license/license.rpc.js | 2 +- server/api/mailAccount/index.js | 2 +- server/api/mailAccount/mailAccount.attributes.js | 2 +- server/api/mailAccount/mailAccount.controller.js | 2 +- server/api/mailAccount/mailAccount.events.js | 2 +- server/api/mailAccount/mailAccount.model.js | 2 +- server/api/mailAccount/mailAccount.rpc.js | 2 +- server/api/mailAccount/mailAccount.socket.js | 2 +- server/api/mailApplication/index.js | 2 +- .../mailApplication/mailApplication.attributes.js | 2 +- .../mailApplication/mailApplication.controller.js | 2 +- .../api/mailApplication/mailApplication.model.js | 2 +- server/api/mailApplication/mailApplication.rpc.js | 2 +- server/api/mailInteraction/index.js | 2 +- .../mailInteraction/mailInteraction.attributes.js | 2 +- .../mailInteraction/mailInteraction.controller.js | 2 +- .../api/mailInteraction/mailInteraction.events.js | 2 +- .../api/mailInteraction/mailInteraction.model.js | 2 +- server/api/mailInteraction/mailInteraction.rpc.js | 2 +- .../api/mailInteraction/mailInteraction.socket.js | 2 +- server/api/mailMessage/index.js | 2 +- server/api/mailMessage/mailMessage.attributes.js | 2 +- server/api/mailMessage/mailMessage.controller.js | 2 +- server/api/mailMessage/mailMessage.events.js | 2 +- server/api/mailMessage/mailMessage.model.js | 2 +- server/api/mailMessage/mailMessage.rpc.js | 2 +- server/api/mailMessage/mailMessage.socket.js | 2 +- server/api/mailQueue/index.js | 2 +- server/api/mailQueue/mailQueue.attributes.js | 2 +- server/api/mailQueue/mailQueue.controller.js | 2 +- server/api/mailQueue/mailQueue.events.js | 2 +- server/api/mailQueue/mailQueue.model.js | 2 +- server/api/mailQueue/mailQueue.rpc.js | 2 +- server/api/mailQueue/mailQueue.socket.js | 2 +- server/api/mailQueueReport/index.js | 2 +- .../mailQueueReport/mailQueueReport.attributes.js | 2 +- .../mailQueueReport/mailQueueReport.controller.js | 2 +- .../api/mailQueueReport/mailQueueReport.model.js | 2 +- server/api/mailQueueReport/mailQueueReport.rpc.js | 2 +- server/api/mailServerIn/index.js | 2 +- server/api/mailServerIn/mailServerIn.attributes.js | 2 +- server/api/mailServerIn/mailServerIn.model.js | 2 +- server/api/mailServerIn/mailServerIn.rpc.js | 2 +- server/api/mailServerOut/index.js | 2 +- .../api/mailServerOut/mailServerOut.attributes.js | 2 +- .../api/mailServerOut/mailServerOut.controller.js | 2 +- server/api/mailServerOut/mailServerOut.model.js | 2 +- server/api/mailServerOut/mailServerOut.rpc.js | 2 +- server/api/mailSubstatus/index.js | 2 +- .../api/mailSubstatus/mailSubstatus.attributes.js | 2 +- .../api/mailSubstatus/mailSubstatus.controller.js | 2 +- server/api/mailSubstatus/mailSubstatus.model.js | 2 +- server/api/mailSubstatus/mailSubstatus.rpc.js | 2 +- server/api/mailTransferReport/index.js | 2 +- .../mailTransferReport.attributes.js | 2 +- .../mailTransferReport.controller.js | 2 +- .../mailTransferReport/mailTransferReport.model.js | 2 +- .../mailTransferReport/mailTransferReport.rpc.js | 2 +- server/api/memberReport/index.js | 2 +- server/api/memberReport/memberReport.attributes.js | 2 +- server/api/memberReport/memberReport.controller.js | 2 +- server/api/memberReport/memberReport.model.js | 2 +- server/api/memberReport/memberReport.rpc.js | 2 +- server/api/migration/index.js | 2 +- server/api/migration/migration.attributes.js | 2 +- server/api/migration/migration.controller.js | 2 +- server/api/migration/migration.model.js | 2 +- server/api/migration/migration.rpc.js | 2 +- server/api/network/index.js | 2 +- server/api/network/network.attributes.js | 2 +- server/api/network/network.controller.js | 2 +- server/api/network/network.model.js | 2 +- server/api/network/network.rpc.js | 2 +- server/api/openchannelAccount/index.js | 2 +- .../openchannelAccount.attributes.js | 2 +- .../openchannelAccount.controller.js | 2 +- .../openchannelAccount.events.js | 2 +- .../openchannelAccount/openchannelAccount.model.js | 2 +- .../openchannelAccount/openchannelAccount.rpc.js | 2 +- .../openchannelAccount.socket.js | 2 +- server/api/openchannelApplication/index.js | 2 +- .../openchannelApplication.attributes.js | 2 +- .../openchannelApplication.controller.js | 2 +- .../openchannelApplication.model.js | 2 +- .../openchannelApplication.rpc.js | 2 +- server/api/openchannelInteraction/index.js | 2 +- .../openchannelInteraction.attributes.js | 2 +- .../openchannelInteraction.controller.js | 2 +- .../openchannelInteraction.events.js | 2 +- .../openchannelInteraction.model.js | 2 +- .../openchannelInteraction.rpc.js | 2 +- .../openchannelInteraction.socket.js | 2 +- server/api/openchannelMessage/index.js | 2 +- .../openchannelMessage.attributes.js | 2 +- .../openchannelMessage.controller.js | 2 +- .../openchannelMessage.events.js | 2 +- .../openchannelMessage/openchannelMessage.model.js | 2 +- .../openchannelMessage/openchannelMessage.rpc.js | 2 +- .../openchannelMessage.socket.js | 2 +- server/api/openchannelQueue/index.js | 2 +- .../openchannelQueue.attributes.js | 2 +- .../openchannelQueue.controller.js | 2 +- .../openchannelQueue/openchannelQueue.events.js | 2 +- .../api/openchannelQueue/openchannelQueue.model.js | 2 +- .../api/openchannelQueue/openchannelQueue.rpc.js | 2 +- .../openchannelQueue/openchannelQueue.socket.js | 2 +- server/api/openchannelQueueReport/index.js | 2 +- .../openchannelQueueReport.attributes.js | 2 +- .../openchannelQueueReport.controller.js | 2 +- .../openchannelQueueReport.model.js | 2 +- .../openchannelQueueReport.rpc.js | 2 +- server/api/openchannelTransferReport/index.js | 2 +- .../openchannelTransferReport.attributes.js | 2 +- .../openchannelTransferReport.controller.js | 2 +- .../openchannelTransferReport.model.js | 2 +- .../openchannelTransferReport.rpc.js | 2 +- server/api/pause/index.js | 2 +- server/api/pause/pause.attributes.js | 2 +- server/api/pause/pause.controller.js | 2 +- server/api/pause/pause.model.js | 2 +- server/api/pause/pause.rpc.js | 2 +- server/api/plugin/index.js | 2 +- server/api/plugin/plugin.attributes.js | 2 +- server/api/plugin/plugin.controller.js | 2 +- server/api/plugin/plugin.events.js | 2 +- server/api/plugin/plugin.model.js | 2 +- server/api/plugin/plugin.rpc.js | 2 +- server/api/plugin/plugin.socket.js | 2 +- server/api/pm2/index.js | 2 +- server/api/pm2/pm2.controller.js | 2 +- server/api/realtime/index.js | 2 +- server/api/realtime/realtime.controller.js | 2 +- server/api/reportAgentPreview/index.js | 2 +- .../reportAgentPreview.attributes.js | 2 +- .../reportAgentPreview/reportAgentPreview.model.js | 2 +- .../reportAgentPreview/reportAgentPreview.rpc.js | 2 +- server/api/rpc/index.js | 2 +- server/api/rpc/rpc.controller.js | 2 +- server/api/schedule/index.js | 2 +- server/api/schedule/schedule.attributes.js | 2 +- server/api/schedule/schedule.controller.js | 2 +- server/api/schedule/schedule.model.js | 2 +- server/api/schedule/schedule.rpc.js | 2 +- server/api/screenRecording/index.js | 2 +- .../screenRecording/screenRecording.attributes.js | 2 +- .../screenRecording/screenRecording.controller.js | 2 +- .../api/screenRecording/screenRecording.model.js | 2 +- server/api/screenRecording/screenRecording.rpc.js | 2 +- server/api/setting/index.js | 2 +- server/api/setting/setting.attributes.js | 2 +- server/api/setting/setting.controller.js | 2 +- server/api/setting/setting.model.js | 2 +- server/api/setting/setting.rpc.js | 2 +- server/api/smsAccount/index.js | 2 +- server/api/smsAccount/smsAccount.attributes.js | 2 +- server/api/smsAccount/smsAccount.controller.js | 2 +- server/api/smsAccount/smsAccount.events.js | 2 +- server/api/smsAccount/smsAccount.model.js | 2 +- server/api/smsAccount/smsAccount.rpc.js | 2 +- server/api/smsAccount/smsAccount.socket.js | 2 +- server/api/smsApplication/index.js | 2 +- .../smsApplication/smsApplication.attributes.js | 2 +- .../smsApplication/smsApplication.controller.js | 2 +- server/api/smsApplication/smsApplication.model.js | 2 +- server/api/smsApplication/smsApplication.rpc.js | 2 +- server/api/smsInteraction/index.js | 2 +- .../smsInteraction/smsInteraction.attributes.js | 2 +- .../smsInteraction/smsInteraction.controller.js | 2 +- server/api/smsInteraction/smsInteraction.events.js | 2 +- server/api/smsInteraction/smsInteraction.model.js | 2 +- server/api/smsInteraction/smsInteraction.rpc.js | 2 +- server/api/smsInteraction/smsInteraction.socket.js | 2 +- server/api/smsMessage/index.js | 2 +- server/api/smsMessage/smsMessage.attributes.js | 2 +- server/api/smsMessage/smsMessage.controller.js | 2 +- server/api/smsMessage/smsMessage.events.js | 2 +- server/api/smsMessage/smsMessage.model.js | 2 +- server/api/smsMessage/smsMessage.rpc.js | 2 +- server/api/smsMessage/smsMessage.socket.js | 2 +- server/api/smsQueue/index.js | 2 +- server/api/smsQueue/smsQueue.attributes.js | 2 +- server/api/smsQueue/smsQueue.controller.js | 2 +- server/api/smsQueue/smsQueue.events.js | 2 +- server/api/smsQueue/smsQueue.model.js | 2 +- server/api/smsQueue/smsQueue.rpc.js | 2 +- server/api/smsQueue/smsQueue.socket.js | 2 +- server/api/smsQueueReport/index.js | 2 +- .../smsQueueReport/smsQueueReport.attributes.js | 2 +- .../smsQueueReport/smsQueueReport.controller.js | 2 +- server/api/smsQueueReport/smsQueueReport.model.js | 2 +- server/api/smsQueueReport/smsQueueReport.rpc.js | 2 +- server/api/smsTransferReport/index.js | 2 +- .../smsTransferReport.attributes.js | 2 +- .../smsTransferReport.controller.js | 2 +- .../smsTransferReport/smsTransferReport.model.js | 2 +- .../api/smsTransferReport/smsTransferReport.rpc.js | 2 +- server/api/sound/index.js | 2 +- server/api/sound/sound.attributes.js | 2 +- server/api/sound/sound.controller.js | 2 +- server/api/sound/sound.model.js | 2 +- server/api/sound/sound.rpc.js | 2 +- server/api/squareMessage/index.js | 2 +- .../api/squareMessage/squareMessage.attributes.js | 2 +- .../api/squareMessage/squareMessage.controller.js | 2 +- server/api/squareMessage/squareMessage.model.js | 2 +- server/api/squareMessage/squareMessage.rpc.js | 2 +- server/api/squareOdbc/index.js | 2 +- server/api/squareOdbc/squareOdbc.attributes.js | 2 +- server/api/squareOdbc/squareOdbc.controller.js | 2 +- server/api/squareOdbc/squareOdbc.model.js | 2 +- server/api/squareOdbc/squareOdbc.rpc.js | 2 +- server/api/squareProject/index.js | 2 +- .../api/squareProject/squareProject.attributes.js | 2 +- .../api/squareProject/squareProject.controller.js | 2 +- server/api/squareProject/squareProject.events.js | 2 +- server/api/squareProject/squareProject.model.js | 2 +- server/api/squareProject/squareProject.rpc.js | 2 +- server/api/squareProject/squareProject.socket.js | 2 +- server/api/squareRecording/index.js | 2 +- .../squareRecording/squareRecording.attributes.js | 2 +- .../squareRecording/squareRecording.controller.js | 2 +- .../api/squareRecording/squareRecording.model.js | 2 +- server/api/squareRecording/squareRecording.rpc.js | 2 +- server/api/squareReport/index.js | 2 +- server/api/squareReport/squareReport.attributes.js | 2 +- server/api/squareReport/squareReport.controller.js | 2 +- server/api/squareReport/squareReport.model.js | 2 +- server/api/squareReport/squareReport.rpc.js | 2 +- server/api/squareReportDetail/index.js | 2 +- .../squareReportDetail.attributes.js | 2 +- .../squareReportDetail.controller.js | 2 +- .../squareReportDetail/squareReportDetail.model.js | 2 +- .../squareReportDetail/squareReportDetail.rpc.js | 2 +- server/api/system/index.js | 2 +- server/api/system/system.controller.js | 2 +- server/api/tag/index.js | 2 +- server/api/tag/tag.attributes.js | 2 +- server/api/tag/tag.controller.js | 2 +- server/api/tag/tag.model.js | 2 +- server/api/tag/tag.rpc.js | 2 +- server/api/team/index.js | 2 +- server/api/team/team.attributes.js | 2 +- server/api/team/team.controller.js | 2 +- server/api/team/team.events.js | 2 +- server/api/team/team.model.js | 2 +- server/api/team/team.rpc.js | 2 +- server/api/team/team.socket.js | 2 +- server/api/teamVoiceQueue/index.js | 2 +- .../teamVoiceQueue/teamVoiceQueue.attributes.js | 2 +- server/api/teamVoiceQueue/teamVoiceQueue.model.js | 2 +- server/api/teamVoiceQueue/teamVoiceQueue.rpc.js | 2 +- server/api/template/index.js | 2 +- server/api/template/template.attributes.js | 2 +- server/api/template/template.controller.js | 2 +- server/api/template/template.model.js | 2 +- server/api/template/template.rpc.js | 2 +- server/api/trigger/index.js | 2 +- server/api/trigger/trigger.attributes.js | 2 +- server/api/trigger/trigger.controller.js | 2 +- server/api/trigger/trigger.model.js | 2 +- server/api/trigger/trigger.rpc.js | 2 +- server/api/trunk/index.js | 2 +- server/api/trunk/trunk.attributes.js | 2 +- server/api/trunk/trunk.controller.js | 2 +- server/api/trunk/trunk.model.js | 2 +- server/api/trunk/trunk.rpc.js | 2 +- server/api/user/index.js | 2 +- server/api/user/user.attributes.js | 2 +- server/api/user/user.controller.js | 2 +- server/api/user/user.events.js | 2 +- server/api/user/user.model.js | 2 +- server/api/user/user.rpc.js | 2 +- server/api/user/user.socket.js | 2 +- server/api/userChatQueue/index.js | 2 +- .../api/userChatQueue/userChatQueue.attributes.js | 2 +- server/api/userChatQueue/userChatQueue.model.js | 2 +- server/api/userChatQueue/userChatQueue.rpc.js | 2 +- server/api/userFaxQueue/index.js | 2 +- server/api/userFaxQueue/userFaxQueue.attributes.js | 2 +- server/api/userFaxQueue/userFaxQueue.model.js | 2 +- server/api/userFaxQueue/userFaxQueue.rpc.js | 2 +- server/api/userMailQueue/index.js | 2 +- .../api/userMailQueue/userMailQueue.attributes.js | 2 +- server/api/userMailQueue/userMailQueue.model.js | 2 +- server/api/userMailQueue/userMailQueue.rpc.js | 2 +- server/api/userNotification/index.js | 2 +- .../userNotification.attributes.js | 2 +- .../userNotification.controller.js | 2 +- .../userNotification/userNotification.events.js | 2 +- .../api/userNotification/userNotification.model.js | 2 +- .../api/userNotification/userNotification.rpc.js | 2 +- .../userNotification/userNotification.socket.js | 2 +- server/api/userOpenchannelQueue/index.js | 2 +- .../userOpenchannelQueue.attributes.js | 2 +- .../userOpenchannelQueue.model.js | 2 +- .../userOpenchannelQueue.rpc.js | 2 +- server/api/userProfile/index.js | 2 +- server/api/userProfile/userProfile.attributes.js | 2 +- server/api/userProfile/userProfile.controller.js | 2 +- server/api/userProfile/userProfile.events.js | 2 +- server/api/userProfile/userProfile.model.js | 2 +- server/api/userProfile/userProfile.rpc.js | 2 +- server/api/userProfile/userProfile.socket.js | 2 +- server/api/userProfileResource/index.js | 2 +- .../userProfileResource.attributes.js | 2 +- .../userProfileResource.controller.js | 2 +- .../userProfileResource.model.js | 2 +- .../userProfileResource/userProfileResource.rpc.js | 2 +- server/api/userProfileSection/index.js | 2 +- .../userProfileSection.attributes.js | 2 +- .../userProfileSection.controller.js | 2 +- .../userProfileSection/userProfileSection.model.js | 2 +- .../userProfileSection/userProfileSection.rpc.js | 2 +- server/api/userSmsQueue/index.js | 2 +- server/api/userSmsQueue/userSmsQueue.attributes.js | 2 +- server/api/userSmsQueue/userSmsQueue.model.js | 2 +- server/api/userSmsQueue/userSmsQueue.rpc.js | 2 +- server/api/userVoiceQueue/index.js | 2 +- .../userVoiceQueue/userVoiceQueue.attributes.js | 2 +- server/api/userVoiceQueue/userVoiceQueue.model.js | 2 +- server/api/userVoiceQueue/userVoiceQueue.rpc.js | 2 +- server/api/userVoiceQueueRt/index.js | 2 +- .../userVoiceQueueRt.attributes.js | 2 +- .../userVoiceQueueRt/userVoiceQueueRt.events.js | 2 +- .../api/userVoiceQueueRt/userVoiceQueueRt.model.js | 2 +- .../api/userVoiceQueueRt/userVoiceQueueRt.rpc.js | 2 +- .../userVoiceQueueRt/userVoiceQueueRt.socket.js | 2 +- server/api/userWhatsappQueue/index.js | 2 +- .../userWhatsappQueue.attributes.js | 2 +- .../userWhatsappQueue/userWhatsappQueue.model.js | 2 +- .../api/userWhatsappQueue/userWhatsappQueue.rpc.js | 2 +- server/api/variable/index.js | 2 +- server/api/variable/variable.attributes.js | 2 +- server/api/variable/variable.controller.js | 2 +- server/api/variable/variable.model.js | 2 +- server/api/variable/variable.rpc.js | 2 +- server/api/version/index.js | 2 +- server/api/version/version.controller.js | 2 +- server/api/voiceAgentReport/index.js | 2 +- .../voiceAgentReport.attributes.js | 2 +- .../voiceAgentReport.controller.js | 2 +- .../api/voiceAgentReport/voiceAgentReport.model.js | 2 +- .../api/voiceAgentReport/voiceAgentReport.rpc.js | 2 +- server/api/voiceCallReport/index.js | 2 +- .../voiceCallReport/voiceCallReport.attributes.js | 2 +- .../voiceCallReport/voiceCallReport.controller.js | 2 +- .../api/voiceCallReport/voiceCallReport.model.js | 2 +- server/api/voiceCallReport/voiceCallReport.rpc.js | 2 +- server/api/voiceChanSpy/index.js | 2 +- server/api/voiceChanSpy/voiceChanSpy.attributes.js | 2 +- server/api/voiceChanSpy/voiceChanSpy.controller.js | 2 +- server/api/voiceChanSpy/voiceChanSpy.model.js | 2 +- server/api/voiceChanSpy/voiceChanSpy.rpc.js | 2 +- server/api/voiceContext/index.js | 2 +- server/api/voiceContext/voiceContext.attributes.js | 2 +- server/api/voiceContext/voiceContext.controller.js | 2 +- server/api/voiceContext/voiceContext.model.js | 2 +- server/api/voiceContext/voiceContext.rpc.js | 2 +- server/api/voiceDialReport/index.js | 2 +- .../voiceDialReport/voiceDialReport.attributes.js | 2 +- .../voiceDialReport/voiceDialReport.controller.js | 2 +- .../api/voiceDialReport/voiceDialReport.model.js | 2 +- server/api/voiceDialReport/voiceDialReport.rpc.js | 2 +- server/api/voiceExtension/index.js | 2 +- .../voiceExtension/voiceExtension.attributes.js | 2 +- .../voiceExtension/voiceExtension.controller.js | 2 +- server/api/voiceExtension/voiceExtension.events.js | 2 +- server/api/voiceExtension/voiceExtension.model.js | 2 +- server/api/voiceExtension/voiceExtension.rpc.js | 2 +- server/api/voiceExtension/voiceExtension.socket.js | 2 +- server/api/voiceMail/index.js | 2 +- server/api/voiceMail/voiceMail.attributes.js | 2 +- server/api/voiceMail/voiceMail.controller.js | 2 +- server/api/voiceMail/voiceMail.model.js | 2 +- server/api/voiceMail/voiceMail.rpc.js | 2 +- server/api/voiceMailMessage/index.js | 2 +- .../voiceMailMessage.attributes.js | 2 +- .../voiceMailMessage.controller.js | 2 +- .../api/voiceMailMessage/voiceMailMessage.model.js | 2 +- .../api/voiceMailMessage/voiceMailMessage.rpc.js | 2 +- server/api/voiceMusicOnHold/index.js | 2 +- .../voiceMusicOnHold.attributes.js | 2 +- .../voiceMusicOnHold.controller.js | 2 +- .../api/voiceMusicOnHold/voiceMusicOnHold.model.js | 2 +- .../api/voiceMusicOnHold/voiceMusicOnHold.rpc.js | 2 +- server/api/voicePrefix/index.js | 2 +- server/api/voicePrefix/voicePrefix.attributes.js | 2 +- server/api/voicePrefix/voicePrefix.controller.js | 2 +- server/api/voicePrefix/voicePrefix.events.js | 2 +- server/api/voicePrefix/voicePrefix.model.js | 2 +- server/api/voicePrefix/voicePrefix.rpc.js | 2 +- server/api/voicePrefix/voicePrefix.socket.js | 2 +- server/api/voiceQueue/index.js | 2 +- server/api/voiceQueue/voiceQueue.attributes.js | 2 +- server/api/voiceQueue/voiceQueue.controller.js | 2 +- server/api/voiceQueue/voiceQueue.events.js | 2 +- server/api/voiceQueue/voiceQueue.model.js | 2 +- server/api/voiceQueue/voiceQueue.rpc.js | 2 +- server/api/voiceQueue/voiceQueue.socket.js | 2 +- server/api/voiceQueueReport/index.js | 2 +- .../voiceQueueReport.attributes.js | 2 +- .../voiceQueueReport.controller.js | 2 +- .../voiceQueueReport/voiceQueueReport.events.js | 2 +- .../api/voiceQueueReport/voiceQueueReport.model.js | 2 +- .../api/voiceQueueReport/voiceQueueReport.rpc.js | 2 +- .../voiceQueueReport/voiceQueueReport.socket.js | 2 +- server/api/voiceQueuesLog/index.js | 2 +- .../voiceQueuesLog/voiceQueuesLog.attributes.js | 2 +- .../voiceQueuesLog/voiceQueuesLog.controller.js | 2 +- server/api/voiceQueuesLog/voiceQueuesLog.model.js | 2 +- server/api/voiceQueuesLog/voiceQueuesLog.rpc.js | 2 +- server/api/voiceRecording/index.js | 2 +- .../voiceRecording/voiceRecording.attributes.js | 2 +- .../voiceRecording/voiceRecording.controller.js | 2 +- server/api/voiceRecording/voiceRecording.model.js | 2 +- server/api/voiceRecording/voiceRecording.rpc.js | 2 +- server/api/voiceTransferReport/index.js | 2 +- .../voiceTransferReport.attributes.js | 2 +- .../voiceTransferReport.controller.js | 2 +- .../voiceTransferReport.model.js | 2 +- .../voiceTransferReport/voiceTransferReport.rpc.js | 2 +- server/api/webbar/index.js | 2 +- server/api/webbar/webbar.controller.js | 2 +- server/api/whatsappAccount/index.js | 2 +- .../whatsappAccount/whatsappAccount.attributes.js | 2 +- .../whatsappAccount/whatsappAccount.controller.js | 2 +- .../api/whatsappAccount/whatsappAccount.events.js | 2 +- .../api/whatsappAccount/whatsappAccount.model.js | 2 +- server/api/whatsappAccount/whatsappAccount.rpc.js | 2 +- .../api/whatsappAccount/whatsappAccount.socket.js | 2 +- server/api/whatsappApplication/index.js | 2 +- .../whatsappApplication.attributes.js | 2 +- .../whatsappApplication.controller.js | 2 +- .../whatsappApplication.model.js | 2 +- .../whatsappApplication/whatsappApplication.rpc.js | 2 +- server/api/whatsappInteraction/index.js | 2 +- .../whatsappInteraction.attributes.js | 2 +- .../whatsappInteraction.controller.js | 2 +- .../whatsappInteraction.events.js | 2 +- .../whatsappInteraction.model.js | 2 +- .../whatsappInteraction/whatsappInteraction.rpc.js | 2 +- .../whatsappInteraction.socket.js | 2 +- server/api/whatsappMessage/index.js | 2 +- .../whatsappMessage/whatsappMessage.attributes.js | 2 +- .../whatsappMessage/whatsappMessage.controller.js | 2 +- .../api/whatsappMessage/whatsappMessage.events.js | 2 +- .../api/whatsappMessage/whatsappMessage.model.js | 2 +- server/api/whatsappMessage/whatsappMessage.rpc.js | 2 +- .../api/whatsappMessage/whatsappMessage.socket.js | 2 +- server/api/whatsappQueue/index.js | 2 +- .../api/whatsappQueue/whatsappQueue.attributes.js | 2 +- .../api/whatsappQueue/whatsappQueue.controller.js | 2 +- server/api/whatsappQueue/whatsappQueue.events.js | 2 +- server/api/whatsappQueue/whatsappQueue.model.js | 2 +- server/api/whatsappQueue/whatsappQueue.rpc.js | 2 +- server/api/whatsappQueue/whatsappQueue.socket.js | 2 +- server/api/whatsappQueueReport/index.js | 2 +- .../whatsappQueueReport.attributes.js | 2 +- .../whatsappQueueReport.controller.js | 2 +- .../whatsappQueueReport.model.js | 2 +- .../whatsappQueueReport/whatsappQueueReport.rpc.js | 2 +- server/api/whatsappTransferReport/index.js | 2 +- .../whatsappTransferReport.attributes.js | 2 +- .../whatsappTransferReport.controller.js | 2 +- .../whatsappTransferReport.model.js | 2 +- .../whatsappTransferReport.rpc.js | 2 +- server/app.js | 2 +- server/components/auth/service.js | 2 +- server/components/encryptor/index.js | 2 +- server/components/export/csv.js | 2 +- server/components/export/pdf.js | 2 +- server/components/export/xlsx.js | 2 +- server/components/extensions/rewrite.js | 2 +- server/components/import/cm/csv.js | 2 +- server/components/import/cm/csv2.js | 2 +- server/components/integrations/configuration.js | 2 +- server/components/interaction/service.js | 2 +- server/components/license/service.js | 2 +- server/components/parsers/advancedSearch.js | 2 +- server/components/parsers/qs.js | 2 +- server/config/express.js | 2 +- server/config/license/hardware.js | 2 +- server/config/license/index.js | 2 +- server/config/license/util.js | 2 +- server/config/local.env.js | 2 +- server/config/logger.js | 2 +- server/config/pm2/config.js | 2 +- server/config/pm2/index.js | 2 +- server/config/schedule/chat.js | 2 +- server/config/schedule/index.js | 2 +- server/config/schedule/transcribe.js | 2 +- server/config/schedule/whatsapp.js | 2 +- server/config/seedContact.js | 2 +- server/config/seedUsers.js | 2 +- server/config/socketio.js | 2 +- server/config/triggers/index.js | 2 +- server/config/utils.js | 2 +- server/errors/index.js | 2 +- server/mysqldb/index.js | 2 +- server/routes.js | 2 +- server/rpc/index.js | 2 +- server/services/agi/channel.js | 2 +- server/services/agi/error.js | 2 +- server/services/agi/graph/index.js | 2 +- server/services/agi/index.js | 2 +- server/services/agi/mailRpc/index.js | 2 +- server/services/agi/reply.js | 2 +- server/services/agi/rpc/index.js | 2 +- server/services/agi/scripts/aws/index.js | 2 +- server/services/agi/scripts/aws/lex/index.js | 2 +- server/services/agi/scripts/aws/lex/lib/api.js | 2 +- server/services/agi/scripts/aws/polly/index.js | 2 +- server/services/agi/scripts/aws/polly/lib/api.js | 2 +- server/services/agi/scripts/google/asr/index.js | 2 +- server/services/agi/scripts/google/asr/lib/api.js | 2 +- server/services/agi/scripts/google/index.js | 2 +- server/services/agi/scripts/index.js | 2 +- server/services/agi/scripts/sestek/index.js | 2 +- server/services/agi/scripts/sestek/nda/index.js | 2 +- server/services/agi/scripts/tilde/asr/index.js | 2 +- server/services/agi/scripts/tilde/asr/lib/api.js | 2 +- server/services/agi/scripts/tilde/index.js | 2 +- server/services/agi/server.js | 2 +- server/services/agi/vertices.js | 2 +- server/services/ami/acw/index.js | 2 +- server/services/ami/ami.js | 2 +- server/services/ami/client.js | 2 +- server/services/ami/dialer/action.js | 2 +- server/services/ami/dialer/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/cmHopperBlack.js | 2 +- server/services/ami/rpc/cmHopperFinal.js | 2 +- server/services/ami/rpc/cmHopperHistory.js | 2 +- server/services/ami/rpc/faxAccount.js | 2 +- server/services/ami/rpc/faxMessage.js | 2 +- server/services/ami/rpc/integrations/desk.js | 2 +- .../services/ami/rpc/integrations/dynamics365.js | 2 +- server/services/ami/rpc/integrations/freshdesk.js | 2 +- server/services/ami/rpc/integrations/freshsales.js | 2 +- server/services/ami/rpc/integrations/salesforce.js | 2 +- server/services/ami/rpc/integrations/servicenow.js | 2 +- server/services/ami/rpc/integrations/sugarcrm.js | 2 +- server/services/ami/rpc/integrations/vtiger.js | 2 +- server/services/ami/rpc/integrations/zendesk.js | 2 +- server/services/ami/rpc/integrations/zoho.js | 2 +- server/services/ami/rpc/memberReport.js | 2 +- server/services/ami/rpc/setting.js | 2 +- server/services/ami/rpc/template.js | 2 +- server/services/ami/rpc/trigger.js | 2 +- server/services/ami/rpc/trunk.js | 2 +- server/services/ami/rpc/user.js | 2 +- server/services/ami/rpc/voiceAgentReport.js | 2 +- server/services/ami/rpc/voiceCallReport.js | 2 +- server/services/ami/rpc/voiceDialReport.js | 2 +- server/services/ami/rpc/voiceExtension.js | 2 +- server/services/ami/rpc/voiceQueue.js | 2 +- server/services/ami/rpc/voiceQueueReport.js | 2 +- server/services/ami/rpc/voiceQueueRt.js | 2 +- server/services/ami/rpc/voiceRecording.js | 2 +- server/services/ami/rpc/voiceTransferReport.js | 2 +- server/services/ami/server/index.js | 2 +- server/services/ami/trigger/cmContact/index.js | 2 +- server/services/ami/trigger/index.js | 2 +- server/services/ami/trigger/integration/desk.js | 2 +- .../ami/trigger/integration/dynamics365.js | 2 +- .../services/ami/trigger/integration/freshdesk.js | 2 +- .../services/ami/trigger/integration/freshsales.js | 2 +- server/services/ami/trigger/integration/index.js | 2 +- .../services/ami/trigger/integration/salesforce.js | 2 +- .../services/ami/trigger/integration/servicenow.js | 2 +- .../services/ami/trigger/integration/sugarcrm.js | 2 +- server/services/ami/trigger/integration/util.js | 2 +- server/services/ami/trigger/integration/vtiger.js | 2 +- server/services/ami/trigger/integration/zendesk.js | 2 +- server/services/ami/trigger/integration/zoho.js | 2 +- server/services/ami/trigger/script/index.js | 2 +- server/services/ami/trigger/urlforward/index.js | 2 +- server/services/email/client.js | 2 +- server/services/email/index.js | 2 +- server/services/email/lib/email.js | 2 +- server/services/email/lib/imap.js | 2 +- server/services/email/lib/smtp.js | 2 +- server/services/email/lib/utils.js | 2 +- server/services/email/model/mailAccount.js | 2 +- server/services/email/realtime/index.js | 2 +- server/services/email/rpc/mailAccount.js | 2 +- server/services/email/rpc/setting.js | 2 +- server/services/email/server/index.js | 2 +- server/services/express/index.js | 2 +- server/services/routing/client.js | 2 +- server/services/routing/index.js | 2 +- server/services/routing/lib/rule-engine.js | 2 +- server/services/routing/mailRpc/index.js | 2 +- server/services/routing/model/agent.js | 2 +- server/services/routing/model/chatQueue.js | 2 +- server/services/routing/model/faxQueue.js | 2 +- server/services/routing/model/interval.js | 2 +- server/services/routing/model/mailQueue.js | 2 +- server/services/routing/model/openchannelQueue.js | 2 +- server/services/routing/model/smsQueue.js | 2 +- server/services/routing/model/whatsappQueue.js | 2 +- server/services/routing/realtime/index.js | 2 +- server/services/routing/rpc/chatInteraction.js | 2 +- server/services/routing/rpc/chatMessage.js | 2 +- server/services/routing/rpc/chatQueue.js | 2 +- server/services/routing/rpc/chatQueueReport.js | 2 +- server/services/routing/rpc/faxInteraction.js | 2 +- server/services/routing/rpc/faxMessage.js | 2 +- server/services/routing/rpc/faxQueue.js | 2 +- server/services/routing/rpc/faxQueueReport.js | 2 +- server/services/routing/rpc/interval.js | 2 +- server/services/routing/rpc/mailInteraction.js | 2 +- server/services/routing/rpc/mailMessage.js | 2 +- server/services/routing/rpc/mailQueue.js | 2 +- server/services/routing/rpc/mailQueueReport.js | 2 +- .../services/routing/rpc/openchannelInteraction.js | 2 +- server/services/routing/rpc/openchannelMessage.js | 2 +- server/services/routing/rpc/openchannelQueue.js | 2 +- .../services/routing/rpc/openchannelQueueReport.js | 2 +- server/services/routing/rpc/smsInteraction.js | 2 +- server/services/routing/rpc/smsMessage.js | 2 +- server/services/routing/rpc/smsQueue.js | 2 +- server/services/routing/rpc/smsQueueReport.js | 2 +- server/services/routing/rpc/user.js | 2 +- server/services/routing/rpc/whatsappInteraction.js | 2 +- server/services/routing/rpc/whatsappMessage.js | 2 +- server/services/routing/rpc/whatsappQueue.js | 2 +- server/services/routing/rpc/whatsappQueueReport.js | 2 +- .../services/routing/server/applications/agent.js | 2 +- .../routing/server/applications/amazonlex.js | 2 +- .../routing/server/applications/autoreply.js | 2 +- .../services/routing/server/applications/close.js | 2 +- .../routing/server/applications/dialogflow.js | 2 +- .../routing/server/applications/dialogflowV2.js | 2 +- .../services/routing/server/applications/gotoif.js | 2 +- .../services/routing/server/applications/gotop.js | 2 +- .../routing/server/applications/message.js | 2 +- .../services/routing/server/applications/noop.js | 2 +- .../services/routing/server/applications/queue.js | 2 +- .../routing/server/applications/strategy/agent.js | 2 +- .../server/applications/strategy/beepall.js | 2 +- .../routing/server/applications/strategy/index.js | 2 +- .../server/applications/strategy/rrmemory.js | 2 +- .../routing/server/applications/strategy/util.js | 2 +- .../services/routing/server/applications/system.js | 2 +- server/services/routing/server/applications/tag.js | 2 +- .../services/routing/server/applications/utils.js | 2 +- server/services/routing/server/index.js | 2 +- server/services/routing/server/interval.js | 2 +- server/services/xdr/agents.controller.js | 2 +- server/services/xdr/calls.controller.js | 2 +- server/services/xdr/core.controller.js | 2 +- server/services/xdr/dials.controller.js | 2 +- server/services/xdr/index.js | 2 +- server/services/xdr/members.controller.js | 2 +- server/services/xdr/queues.controller.js | 2 +- server/services/xdr/recordings.controller.js | 2 +- server/services/xdr/transfers.controller.js | 2 +- server/services/xdr/utils.js | 2 +- 1147 files changed, 1147 insertions(+), 1147 deletions(-) diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 264b85f..101dac9 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-08-28T08:13:14.590Z", + "time": "2021-08-28T09:43:58.937Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index e545d27..4d80ed5 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-08-28T08:13:14.590Z", + "time": "2021-08-28T09:43:58.937Z", "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 1ea8577..cb5335f 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 _0x1645=['integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','TEXT','sequelize','exports','VIRTUAL','action','STRING','contactManager','integration','motionbar','jscripty','urlForward','browser','bot','script'];(function(_0x502c77,_0x2863a0){var _0x2f0447=function(_0x4152bd){while(--_0x4152bd){_0x502c77['push'](_0x502c77['shift']());}};_0x2f0447(++_0x2863a0);}(_0x1645,0x113));var _0x5164=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1645[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x5164('0x0'));module[_0x5164('0x1')]={'name':{'type':Sequelize[_0x5164('0x2')],'get':function(_0x48f275){return this['getDataValue'](_0x5164('0x3'));}},'action':{'type':Sequelize[_0x5164('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x5164('0x5'),_0x5164('0x6'),_0x5164('0x7'),_0x5164('0x8'),_0x5164('0x9'),_0x5164('0xa'),_0x5164('0xb'),_0x5164('0xc')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x5164('0x4')](0x1000),'comment':'contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]'},'data2':{'type':Sequelize[_0x5164('0x4')](0x1000),'comment':_0x5164('0xd')},'data3':{'type':Sequelize[_0x5164('0x4')](0x1000),'comment':_0x5164('0xe')},'data4':{'type':Sequelize[_0x5164('0x4')](0x1000)},'data5':{'type':Sequelize[_0x5164('0x4')](0x1000)},'data6':{'type':Sequelize[_0x5164('0x4')]},'data7':{'type':Sequelize[_0x5164('0xf')]}}; \ No newline at end of file +var _0x4fb5=['getDataValue','action','contactManager','integration','jscripty','urlForward','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','TEXT','sequelize','VIRTUAL'];(function(_0x14eafa,_0x1f47c7){var _0x20cbd3=function(_0xf05716){while(--_0xf05716){_0x14eafa['push'](_0x14eafa['shift']());}};_0x20cbd3(++_0x1f47c7);}(_0x4fb5,0x139));var _0x54fb=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0x4fb5[_0x243b59];return _0x3e1676;};'use strict';var Sequelize=require(_0x54fb('0x0'));module['exports']={'name':{'type':Sequelize[_0x54fb('0x1')],'get':function(_0x578009){return this[_0x54fb('0x2')](_0x54fb('0x3'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x54fb('0x4'),_0x54fb('0x5'),'motionbar',_0x54fb('0x6'),_0x54fb('0x7'),'browser',_0x54fb('0x8'),_0x54fb('0x9')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x54fb('0xa')},'data1':{'type':Sequelize[_0x54fb('0xb')](0x1000),'comment':'contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]'},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0x54fb('0xc')},'data3':{'type':Sequelize[_0x54fb('0xb')](0x1000),'comment':_0x54fb('0xd')},'data4':{'type':Sequelize['STRING'](0x1000)},'data5':{'type':Sequelize['STRING'](0x1000)},'data6':{'type':Sequelize[_0x54fb('0xb')]},'data7':{'type':Sequelize[_0x54fb('0xe')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index a818c46..1507c8d 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 _0x360c=['to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','error','name','send','update','Action','find','params','body','catch','eml-format','rimraf','fast-json-patch','request-promise','util','sox'];(function(_0x3e91a9,_0x53c466){var _0x25c9ad=function(_0x69ee2d){while(--_0x69ee2d){_0x3e91a9['push'](_0x3e91a9['shift']());}};_0x25c9ad(++_0x53c466);}(_0x360c,0x1e9));var _0xc360=function(_0x49ef27,_0x1e89e3){_0x49ef27=_0x49ef27-0x0;var _0x151c39=_0x360c[_0x49ef27];return _0x151c39;};'use strict';var emlformat=require(_0xc360('0x0'));var rimraf=require(_0xc360('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc360('0x2'));var rp=require(_0xc360('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc360('0x4'));var path=require('path');var sox=require(_0xc360('0x5'));var csv=require(_0xc360('0x6'));var ejs=require(_0xc360('0x7'));var fs=require('fs');var fs_extra=require(_0xc360('0x8'));var _=require(_0xc360('0x9'));var squel=require(_0xc360('0xa'));var crypto=require('crypto');var jsforce=require(_0xc360('0xb'));var deskjs=require(_0xc360('0xc'));var toCsv=require(_0xc360('0x6'));var querystring=require(_0xc360('0xd'));var Papa=require(_0xc360('0xe'));var Redis=require(_0xc360('0xf'));var authService=require(_0xc360('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xc360('0x11'));var hardwareService=require(_0xc360('0x12'));var logger=require('../../config/logger')(_0xc360('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc360('0x14'))['db'];function respondWithStatusCode(_0x5dc823,_0x388b98){_0x388b98=_0x388b98||0xcc;return function(_0x134efb){if(_0x134efb){return _0x5dc823[_0xc360('0x15')](_0x388b98);}return _0x5dc823['status'](_0x388b98)[_0xc360('0x16')]();};}function respondWithResult(_0x5267a4,_0x7b4592){_0x7b4592=_0x7b4592||0xc8;return function(_0x13c552){if(_0x13c552){return _0x5267a4[_0xc360('0x17')](_0x7b4592)['json'](_0x13c552);}};}function respondWithFilteredResult(_0x272219,_0x3a60bb){return function(_0x33b539){if(_0x33b539){var _0x691bdd=typeof _0x3a60bb[_0xc360('0x18')]===_0xc360('0x19')&&typeof _0x3a60bb[_0xc360('0x1a')]==='undefined';var _0x92965b=_0x33b539[_0xc360('0x1b')];var _0x43637c=_0x691bdd?0x0:_0x3a60bb[_0xc360('0x18')];var _0xcf277=_0x691bdd?_0x33b539[_0xc360('0x1b')]:_0x3a60bb[_0xc360('0x18')]+_0x3a60bb[_0xc360('0x1a')];var _0x3bddc1;if(_0xcf277>=_0x92965b){_0xcf277=_0x92965b;_0x3bddc1=0xc8;}else{_0x3bddc1=0xce;}_0x272219['status'](_0x3bddc1);return _0x272219[_0xc360('0x1c')](_0xc360('0x1d'),_0x43637c+'-'+_0xcf277+'/'+_0x92965b)[_0xc360('0x1e')](_0x33b539);}return null;};}function patchUpdates(_0x1a34ba){return function(_0x2d4f3b){try{jsonpatch[_0xc360('0x1f')](_0x2d4f3b,_0x1a34ba,!![]);}catch(_0x2c1641){return BPromise[_0xc360('0x20')](_0x2c1641);}return _0x2d4f3b[_0xc360('0x21')]();};}function saveUpdates(_0x5f177d,_0x3956a2){return function(_0x2a57b8){if(_0x2a57b8){return _0x2a57b8['update'](_0x5f177d)[_0xc360('0x22')](function(_0x349fc2){return _0x349fc2;});}return null;};}function removeEntity(_0x291c16,_0x17284f){return function(_0x122bcc){if(_0x122bcc){return _0x122bcc[_0xc360('0x23')]()[_0xc360('0x22')](function(){_0x291c16['status'](0xcc)[_0xc360('0x16')]();});}};}function handleEntityNotFound(_0x33e569,_0x25294d){return function(_0x582652){if(!_0x582652){_0x33e569[_0xc360('0x15')](0x194);}return _0x582652;};}function handleError(_0x4f3c38,_0x225083){_0x225083=_0x225083||0x1f4;return function(_0x1b34b9){logger[_0xc360('0x24')](_0x1b34b9['stack']);if(_0x1b34b9['name']){delete _0x1b34b9[_0xc360('0x25')];}_0x4f3c38['status'](_0x225083)[_0xc360('0x26')](_0x1b34b9);};}exports[_0xc360('0x27')]=function(_0x2cb151,_0x381d66){if(_0x2cb151['body']['id']){delete _0x2cb151['body']['id'];}return db[_0xc360('0x28')][_0xc360('0x29')]({'where':{'id':_0x2cb151[_0xc360('0x2a')]['id']}})[_0xc360('0x22')](handleEntityNotFound(_0x381d66,null))[_0xc360('0x22')](saveUpdates(_0x2cb151[_0xc360('0x2b')],null))[_0xc360('0x22')](respondWithResult(_0x381d66,null))[_0xc360('0x2c')](handleError(_0x381d66,null));};exports[_0xc360('0x23')]=function(_0x33bc52,_0x3bb87d){return db[_0xc360('0x28')][_0xc360('0x29')]({'where':{'id':_0x33bc52[_0xc360('0x2a')]['id']}})['then'](handleEntityNotFound(_0x3bb87d,null))[_0xc360('0x22')](removeEntity(_0x3bb87d,null))[_0xc360('0x2c')](handleError(_0x3bb87d,null));}; \ No newline at end of file +var _0xeabe=['json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','body','Action','find','params','catch','rimraf','fast-json-patch','request-promise','moment','util','path','sox','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end'];(function(_0x4e28a3,_0x4d0f64){var _0x367cd3=function(_0x579e80){while(--_0x579e80){_0x4e28a3['push'](_0x4e28a3['shift']());}};_0x367cd3(++_0x4d0f64);}(_0xeabe,0x71));var _0xeeab=function(_0x3a96b9,_0x1c1881){_0x3a96b9=_0x3a96b9-0x0;var _0x175e80=_0xeabe[_0x3a96b9];return _0x175e80;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xeeab('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeeab('0x1'));var rp=require(_0xeeab('0x2'));var moment=require(_0xeeab('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xeeab('0x4'));var path=require(_0xeeab('0x5'));var sox=require(_0xeeab('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeeab('0x7'));var squel=require(_0xeeab('0x8'));var crypto=require(_0xeeab('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xeeab('0xa'));var toCsv=require('to-csv');var querystring=require(_0xeeab('0xb'));var Papa=require(_0xeeab('0xc'));var Redis=require(_0xeeab('0xd'));var authService=require(_0xeeab('0xe'));var qs=require(_0xeeab('0xf'));var as=require(_0xeeab('0x10'));var hardwareService=require(_0xeeab('0x11'));var logger=require('../../config/logger')(_0xeeab('0x12'));var utils=require(_0xeeab('0x13'));var config=require(_0xeeab('0x14'));var licenseUtil=require(_0xeeab('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x227066,_0x4c6037){_0x4c6037=_0x4c6037||0xcc;return function(_0x20a9ad){if(_0x20a9ad){return _0x227066[_0xeeab('0x16')](_0x4c6037);}return _0x227066[_0xeeab('0x17')](_0x4c6037)[_0xeeab('0x18')]();};}function respondWithResult(_0x41cce0,_0x1c50c2){_0x1c50c2=_0x1c50c2||0xc8;return function(_0x51af7a){if(_0x51af7a){return _0x41cce0[_0xeeab('0x17')](_0x1c50c2)[_0xeeab('0x19')](_0x51af7a);}};}function respondWithFilteredResult(_0x1d6122,_0x46c382){return function(_0x13ef70){if(_0x13ef70){var _0x965167=typeof _0x46c382[_0xeeab('0x1a')]===_0xeeab('0x1b')&&typeof _0x46c382[_0xeeab('0x1c')]===_0xeeab('0x1b');var _0x171449=_0x13ef70[_0xeeab('0x1d')];var _0x41ec98=_0x965167?0x0:_0x46c382[_0xeeab('0x1a')];var _0xacbc5b=_0x965167?_0x13ef70[_0xeeab('0x1d')]:_0x46c382[_0xeeab('0x1a')]+_0x46c382[_0xeeab('0x1c')];var _0x5cecc4;if(_0xacbc5b>=_0x171449){_0xacbc5b=_0x171449;_0x5cecc4=0xc8;}else{_0x5cecc4=0xce;}_0x1d6122[_0xeeab('0x17')](_0x5cecc4);return _0x1d6122[_0xeeab('0x1e')](_0xeeab('0x1f'),_0x41ec98+'-'+_0xacbc5b+'/'+_0x171449)[_0xeeab('0x19')](_0x13ef70);}return null;};}function patchUpdates(_0x2f1304){return function(_0x395cec){try{jsonpatch[_0xeeab('0x20')](_0x395cec,_0x2f1304,!![]);}catch(_0x1bb1e2){return BPromise[_0xeeab('0x21')](_0x1bb1e2);}return _0x395cec[_0xeeab('0x22')]();};}function saveUpdates(_0x57ef53,_0xfd7fef){return function(_0x338c22){if(_0x338c22){return _0x338c22[_0xeeab('0x23')](_0x57ef53)[_0xeeab('0x24')](function(_0x5b353e){return _0x5b353e;});}return null;};}function removeEntity(_0x4dbcd5,_0x17b057){return function(_0x8076fb){if(_0x8076fb){return _0x8076fb[_0xeeab('0x25')]()[_0xeeab('0x24')](function(){_0x4dbcd5[_0xeeab('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c4828,_0x59616e){return function(_0x4e9f0a){if(!_0x4e9f0a){_0x5c4828[_0xeeab('0x16')](0x194);}return _0x4e9f0a;};}function handleError(_0x434cfd,_0x3f73ec){_0x3f73ec=_0x3f73ec||0x1f4;return function(_0x231170){logger['error'](_0x231170[_0xeeab('0x26')]);if(_0x231170[_0xeeab('0x27')]){delete _0x231170[_0xeeab('0x27')];}_0x434cfd[_0xeeab('0x17')](_0x3f73ec)[_0xeeab('0x28')](_0x231170);};}exports[_0xeeab('0x23')]=function(_0x59c393,_0xb0c0f5){if(_0x59c393[_0xeeab('0x29')]['id']){delete _0x59c393['body']['id'];}return db[_0xeeab('0x2a')][_0xeeab('0x2b')]({'where':{'id':_0x59c393[_0xeeab('0x2c')]['id']}})[_0xeeab('0x24')](handleEntityNotFound(_0xb0c0f5,null))[_0xeeab('0x24')](saveUpdates(_0x59c393['body'],null))['then'](respondWithResult(_0xb0c0f5,null))[_0xeeab('0x2d')](handleError(_0xb0c0f5,null));};exports[_0xeeab('0x25')]=function(_0x47d810,_0x258aff){return db['Action'][_0xeeab('0x2b')]({'where':{'id':_0x47d810[_0xeeab('0x2c')]['id']}})[_0xeeab('0x24')](handleEntityNotFound(_0x258aff,null))[_0xeeab('0x24')](removeEntity(_0x258aff,null))[_0xeeab('0x2d')](handleError(_0x258aff,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 4151017..8ebcafa 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 _0xba91=['tools_actions','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./action.attributes','exports','define','Action'];(function(_0x3fd0d4,_0x4bb3d1){var _0x9e1776=function(_0x477ea8){while(--_0x477ea8){_0x3fd0d4['push'](_0x3fd0d4['shift']());}};_0x9e1776(++_0x4bb3d1);}(_0xba91,0xaa));var _0x1ba9=function(_0x4f0fbc,_0x10512b){_0x4f0fbc=_0x4f0fbc-0x0;var _0x51fecb=_0xba91[_0x4f0fbc];return _0x51fecb;};'use strict';var _=require('lodash');var util=require(_0x1ba9('0x0'));var logger=require(_0x1ba9('0x1'))(_0x1ba9('0x2'));var moment=require(_0x1ba9('0x3'));var BPromise=require('bluebird');var rp=require(_0x1ba9('0x4'));var fs=require('fs');var path=require(_0x1ba9('0x5'));var rimraf=require(_0x1ba9('0x6'));var config=require(_0x1ba9('0x7'));var attributes=require(_0x1ba9('0x8'));module[_0x1ba9('0x9')]=function(_0x3c95fd,_0x228ca7){return _0x3c95fd[_0x1ba9('0xa')](_0x1ba9('0xb'),attributes,{'tableName':_0x1ba9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xee29=['path','../../config/environment','exports','define','Action','tools_actions','lodash','util','moment','bluebird'];(function(_0x449fd9,_0xce7c3d){var _0x180251=function(_0x50041f){while(--_0x50041f){_0x449fd9['push'](_0x449fd9['shift']());}};_0x180251(++_0xce7c3d);}(_0xee29,0x150));var _0x9ee2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xee29[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9ee2('0x0'));var util=require(_0x9ee2('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9ee2('0x2'));var BPromise=require(_0x9ee2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9ee2('0x4'));var rimraf=require('rimraf');var config=require(_0x9ee2('0x5'));var attributes=require('./action.attributes');module[_0x9ee2('0x6')]=function(_0x447014,_0x2d40ea){return _0x447014[_0x9ee2('0x7')](_0x9ee2('0x8'),attributes,{'tableName':_0x9ee2('0x9'),'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 7c0130a..f41286e 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 _0x8ef6=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x18b0dd,_0x203bd2){var _0x2c802f=function(_0x1d5c70){while(--_0x1d5c70){_0x18b0dd['push'](_0x18b0dd['shift']());}};_0x2c802f(++_0x203bd2);}(_0x8ef6,0xf2));var _0x68ef=function(_0x41df60,_0x80bb3f){_0x41df60=_0x41df60-0x0;var _0x3c10c2=_0x8ef6[_0x41df60];return _0x3c10c2;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var moment=require(_0x68ef('0x2'));var BPromise=require(_0x68ef('0x3'));var rs=require(_0x68ef('0x4'));var fs=require('fs');var Redis=require(_0x68ef('0x5'));var db=require(_0x68ef('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x68ef('0x7'))(_0x68ef('0x8'));var config=require(_0x68ef('0x9'));var jayson=require(_0x68ef('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c2ff3,_0x4740e8,_0x2de776){return new BPromise(function(_0x4eb5eb,_0x228967){return client[_0x68ef('0xb')](_0x3c2ff3,_0x2de776)[_0x68ef('0xc')](function(_0x22ae26){logger[_0x68ef('0xd')](_0x68ef('0xe'),_0x4740e8,_0x68ef('0xf'));logger[_0x68ef('0x10')](_0x68ef('0x11'),_0x4740e8,_0x68ef('0xf'),JSON[_0x68ef('0x12')](_0x22ae26));if(_0x22ae26[_0x68ef('0x13')]){if(_0x22ae26['error'][_0x68ef('0x14')]===0x1f4){logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);return _0x228967(_0x22ae26[_0x68ef('0x13')]['message']);}logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')]['message']);return _0x4eb5eb(_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);}else{logger[_0x68ef('0xd')]('Action,\x20%s,\x20%s',_0x4740e8,_0x68ef('0xf'));_0x4eb5eb(_0x22ae26[_0x68ef('0x16')][_0x68ef('0x15')]);}})[_0x68ef('0x17')](function(_0x5c4456){logger[_0x68ef('0x13')]('Action,\x20%s,\x20%s',_0x4740e8,_0x5c4456);_0x228967(_0x5c4456);});});} \ No newline at end of file +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(_0x4a3b02,_0x3f5b31){var _0x40d53c=function(_0x792cc7){while(--_0x792cc7){_0x4a3b02['push'](_0x4a3b02['shift']());}};_0x40d53c(++_0x3f5b31);}(_0x5fab,0x177));var _0xb5fa=function(_0x5a6644,_0x45d612){_0x5a6644=_0x5a6644-0x0;var _0x3a2a5d=_0x5fab[_0x5a6644];return _0x3a2a5d;};'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 diff --git a/server/api/action/index.js b/server/api/action/index.js index 0a45748..d69b3f1 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 _0xf731=['destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','/:id','isAuthenticated','update','delete'];(function(_0x4f130f,_0x305446){var _0x39f00d=function(_0x59b0f6){while(--_0x59b0f6){_0x4f130f['push'](_0x4f130f['shift']());}};_0x39f00d(++_0x305446);}(_0xf731,0xfe));var _0x1f73=function(_0x50cd30,_0x5c80e4){_0x50cd30=_0x50cd30-0x0;var _0x429652=_0xf731[_0x50cd30];return _0x429652;};'use strict';var multer=require(_0x1f73('0x0'));var util=require(_0x1f73('0x1'));var path=require('path');var timeout=require(_0x1f73('0x2'));var express=require('express');var router=express[_0x1f73('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1f73('0x4'));var interaction=require(_0x1f73('0x5'));var config=require(_0x1f73('0x6'));var controller=require(_0x1f73('0x7'));router['put'](_0x1f73('0x8'),auth[_0x1f73('0x9')](),controller[_0x1f73('0xa')]);router[_0x1f73('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x1f73('0xc')]);module[_0x1f73('0xd')]=router; \ No newline at end of file +var _0x83fc=['destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','update','isAuthenticated'];(function(_0x1862f5,_0x52b69c){var _0x3e3161=function(_0x4c47d5){while(--_0x4c47d5){_0x1862f5['push'](_0x1862f5['shift']());}};_0x3e3161(++_0x52b69c);}(_0x83fc,0xb8));var _0xc83f=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x83fc[_0x4f9b18];return _0x29f20c;};'use strict';var multer=require('multer');var util=require(_0xc83f('0x0'));var path=require(_0xc83f('0x1'));var timeout=require(_0xc83f('0x2'));var express=require(_0xc83f('0x3'));var router=express['Router']();var fs_extra=require(_0xc83f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc83f('0x5'));var config=require(_0xc83f('0x6'));var controller=require(_0xc83f('0x7'));router[_0xc83f('0x8')](_0xc83f('0x9'),auth['isAuthenticated'](),controller[_0xc83f('0xa')]);router['delete']('/:id',auth[_0xc83f('0xb')](),controller[_0xc83f('0xc')]);module[_0xc83f('0xd')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index e923f54..bd08a32 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 _0x5fab=['exports','STRING','TEXT','sequelize'];(function(_0x397f04,_0x2d9ef5){var _0x249786=function(_0xcb369e){while(--_0xcb369e){_0x397f04['push'](_0x397f04['shift']());}};_0x249786(++_0x2d9ef5);}(_0x5fab,0x177));var _0xb5fa=function(_0x2fcadf,_0x401da6){_0x2fcadf=_0x2fcadf-0x0;var _0x2a2c05=_0x5fab[_0x2fcadf];return _0x2a2c05;};'use strict';var Sequelize=require(_0xb5fa('0x0'));module[_0xb5fa('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xb5fa('0x2')]},'parent':{'type':Sequelize[_0xb5fa('0x2')]},'table':{'type':Sequelize[_0xb5fa('0x2')]},'conditions':{'type':Sequelize[_0xb5fa('0x3')]},'joins':{'type':Sequelize[_0xb5fa('0x3')]}}; \ No newline at end of file +var _0xb138=['TEXT','sequelize','exports','STRING'];(function(_0x143a99,_0x34266e){var _0x202a6e=function(_0x155d66){while(--_0x155d66){_0x143a99['push'](_0x143a99['shift']());}};_0x202a6e(++_0x34266e);}(_0xb138,0x1dd));var _0x8b13=function(_0x51bf2d,_0x2f87ec){_0x51bf2d=_0x51bf2d-0x0;var _0x474e06=_0xb138[_0x51bf2d];return _0x474e06;};'use strict';var Sequelize=require(_0x8b13('0x0'));module[_0x8b13('0x1')]={'name':{'type':Sequelize[_0x8b13('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x8b13('0x2')]},'parent':{'type':Sequelize[_0x8b13('0x2')]},'table':{'type':Sequelize[_0x8b13('0x2')]},'conditions':{'type':Sequelize[_0x8b13('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 1bc3f71..cd27ed1 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 _0x6e43=['select','MetricId','metric','function','replace','format','orderBy','order','alias','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','parse','debug','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','COUNT(%s)','MIN(%s)','IS\x20NULL','from','groupBy','table','clone','output','web','randomstring','generate','csv','custom','cdr','endDate','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','countTable','COUNT(*)','runReport','right_join','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','DESC','eml-format','rimraf','request-promise','moment','bluebird','path','sox','to-csv','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','get','then','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','autoAssociation','UserProfileResource','CustomReports','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','left_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%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)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','AnalyticMetric','keyBy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6e43,0x172));var _0x36e4=function(_0x561e2c,_0x33a6cd){_0x561e2c=_0x561e2c-0x0;var _0x34972e=_0x6e43[_0x561e2c];return _0x34972e;};'use strict';var emlformat=require(_0x36e4('0x0'));var rimraf=require(_0x36e4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x36e4('0x2'));var moment=require(_0x36e4('0x3'));var BPromise=require(_0x36e4('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x36e4('0x5'));var sox=require(_0x36e4('0x6'));var csv=require(_0x36e4('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x36e4('0x8'));var squel=require(_0x36e4('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x36e4('0xa'));var toCsv=require(_0x36e4('0x7'));var querystring=require(_0x36e4('0xb'));var Papa=require(_0x36e4('0xc'));var Redis=require(_0x36e4('0xd'));var authService=require(_0x36e4('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x36e4('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x36e4('0x10'));var utils=require(_0x36e4('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var dbH=require(_0x36e4('0x12'))['dbH'];function respondWithStatusCode(_0x548a24,_0x1006cc){_0x1006cc=_0x1006cc||0xcc;return function(_0xd8693e){if(_0xd8693e){return _0x548a24[_0x36e4('0x13')](_0x1006cc);}return _0x548a24['status'](_0x1006cc)[_0x36e4('0x14')]();};}function respondWithResult(_0xd00873,_0x29674a){_0x29674a=_0x29674a||0xc8;return function(_0x3e7d20){if(_0x3e7d20){return _0xd00873[_0x36e4('0x15')](_0x29674a)[_0x36e4('0x16')](_0x3e7d20);}};}function respondWithFilteredResult(_0x4d79ab,_0x33fc9b){return function(_0x55b6c5){if(_0x55b6c5){var _0x1f0b86=typeof _0x33fc9b[_0x36e4('0x17')]===_0x36e4('0x18')&&typeof _0x33fc9b[_0x36e4('0x19')]===_0x36e4('0x18');var _0x5e925d=_0x55b6c5[_0x36e4('0x1a')];var _0x2225b7=_0x1f0b86?0x0:_0x33fc9b[_0x36e4('0x17')];var _0x1c95a5=_0x1f0b86?_0x55b6c5['count']:_0x33fc9b[_0x36e4('0x17')]+_0x33fc9b[_0x36e4('0x19')];var _0x33a68c;if(_0x1c95a5>=_0x5e925d){_0x1c95a5=_0x5e925d;_0x33a68c=0xc8;}else{_0x33a68c=0xce;}_0x4d79ab[_0x36e4('0x15')](_0x33a68c);return _0x4d79ab[_0x36e4('0x1b')](_0x36e4('0x1c'),_0x2225b7+'-'+_0x1c95a5+'/'+_0x5e925d)[_0x36e4('0x16')](_0x55b6c5);}return null;};}function patchUpdates(_0x5da534){return function(_0x523cef){try{jsonpatch[_0x36e4('0x1d')](_0x523cef,_0x5da534,!![]);}catch(_0x599eb8){return BPromise[_0x36e4('0x1e')](_0x599eb8);}return _0x523cef[_0x36e4('0x1f')]();};}function saveUpdates(_0x1d2900,_0x5e1694){return function(_0x538e2e){if(_0x538e2e){return _0x538e2e['update'](_0x1d2900)['then'](function(_0x37f838){return _0x37f838;});}return null;};}function removeEntity(_0x1db326,_0x1be3ef){return function(_0x310968){if(_0x310968){return _0x310968[_0x36e4('0x20')]()['then'](function(){var _0x1b99b5=_0x310968[_0x36e4('0x21')]({'plain':!![]});var _0x43ece9='CustomReports';return db['UserProfileResource'][_0x36e4('0x20')]({'where':{'type':_0x43ece9,'resourceId':_0x1b99b5['id']}})[_0x36e4('0x22')](function(){return _0x310968;});})['then'](function(){_0x1db326[_0x36e4('0x15')](0xcc)[_0x36e4('0x14')]();});}};}function handleEntityNotFound(_0x111be6,_0x26ebdb){return function(_0x5df1e7){if(!_0x5df1e7){_0x111be6[_0x36e4('0x13')](0x194);}return _0x5df1e7;};}function handleError(_0x1c7636,_0x2e2917){_0x2e2917=_0x2e2917||0x1f4;return function(_0x1f0821){logger['error'](_0x1f0821['stack']);if(_0x1f0821[_0x36e4('0x23')]){delete _0x1f0821[_0x36e4('0x23')];}_0x1c7636[_0x36e4('0x15')](_0x2e2917)[_0x36e4('0x24')](_0x1f0821);};}exports[_0x36e4('0x25')]=function(_0x4a3442,_0x33b4d1){var _0x244c73={},_0x1f88ab={},_0x241c14={'count':0x0,'rows':[]};var _0x3da4f6=_[_0x36e4('0x26')](db[_0x36e4('0x27')][_0x36e4('0x28')],function(_0x523539){return{'name':_0x523539[_0x36e4('0x29')],'type':_0x523539[_0x36e4('0x2a')][_0x36e4('0x2b')]};});_0x1f88ab[_0x36e4('0x2c')]=_[_0x36e4('0x26')](_0x3da4f6,_0x36e4('0x23'));_0x1f88ab['query']=_[_0x36e4('0x2d')](_0x4a3442[_0x36e4('0x2e')]);_0x1f88ab[_0x36e4('0x2f')]=_['intersection'](_0x1f88ab['model'],_0x1f88ab[_0x36e4('0x2e')]);_0x244c73[_0x36e4('0x30')]=_[_0x36e4('0x31')](_0x1f88ab[_0x36e4('0x2c')],qs['fields'](_0x4a3442[_0x36e4('0x2e')][_0x36e4('0x32')]));_0x244c73[_0x36e4('0x30')]=_0x244c73['attributes'][_0x36e4('0x33')]?_0x244c73[_0x36e4('0x30')]:_0x1f88ab[_0x36e4('0x2c')];if(!_0x4a3442['query'][_0x36e4('0x34')](_0x36e4('0x35'))){_0x244c73[_0x36e4('0x19')]=qs[_0x36e4('0x19')](_0x4a3442[_0x36e4('0x2e')][_0x36e4('0x19')]);_0x244c73[_0x36e4('0x17')]=qs[_0x36e4('0x17')](_0x4a3442['query'][_0x36e4('0x17')]);}_0x244c73['order']=qs[_0x36e4('0x36')](_0x4a3442[_0x36e4('0x2e')]['sort']);_0x244c73[_0x36e4('0x37')]=qs['filters'](_[_0x36e4('0x38')](_0x4a3442[_0x36e4('0x2e')],_0x1f88ab[_0x36e4('0x2f')]),_0x3da4f6);if(_0x4a3442['query'][_0x36e4('0x39')]){_0x244c73[_0x36e4('0x37')]=_[_0x36e4('0x3a')](_0x244c73[_0x36e4('0x37')],{'$or':_[_0x36e4('0x26')](_0x3da4f6,function(_0x36fd78){if(_0x36fd78[_0x36e4('0x2a')]!==_0x36e4('0x3b')){var _0x235111={};_0x235111[_0x36fd78[_0x36e4('0x23')]]={'$like':'%'+_0x4a3442[_0x36e4('0x2e')][_0x36e4('0x39')]+'%'};return _0x235111;}})});}_0x244c73=_[_0x36e4('0x3a')]({},_0x244c73,_0x4a3442[_0x36e4('0x3c')]);var _0x174357={'where':_0x244c73['where']};return db[_0x36e4('0x27')]['count'](_0x174357)[_0x36e4('0x22')](function(_0x22c2e3){_0x241c14[_0x36e4('0x1a')]=_0x22c2e3;if(_0x4a3442[_0x36e4('0x2e')][_0x36e4('0x3d')]){_0x244c73['include']=[{'all':!![]}];}return db['AnalyticCustomReport'][_0x36e4('0x3e')](_0x244c73);})[_0x36e4('0x22')](function(_0x5a71f2){_0x241c14[_0x36e4('0x3f')]=_0x5a71f2;return _0x241c14;})[_0x36e4('0x22')](respondWithFilteredResult(_0x33b4d1,_0x244c73))[_0x36e4('0x40')](handleError(_0x33b4d1,null));};exports['show']=function(_0x132f5d,_0x1f3b0f){var _0x9b3a73={'raw':![],'where':{'id':_0x132f5d[_0x36e4('0x41')]['id']}},_0x4c28c5={};_0x4c28c5[_0x36e4('0x2c')]=_[_0x36e4('0x2d')](db[_0x36e4('0x27')][_0x36e4('0x28')]);_0x4c28c5[_0x36e4('0x2e')]=_[_0x36e4('0x2d')](_0x132f5d['query']);_0x4c28c5[_0x36e4('0x2f')]=_[_0x36e4('0x31')](_0x4c28c5[_0x36e4('0x2c')],_0x4c28c5[_0x36e4('0x2e')]);_0x9b3a73[_0x36e4('0x30')]=_['intersection'](_0x4c28c5[_0x36e4('0x2c')],qs['fields'](_0x132f5d[_0x36e4('0x2e')][_0x36e4('0x32')]));_0x9b3a73['attributes']=_0x9b3a73[_0x36e4('0x30')][_0x36e4('0x33')]?_0x9b3a73[_0x36e4('0x30')]:_0x4c28c5[_0x36e4('0x2c')];if(_0x132f5d[_0x36e4('0x2e')][_0x36e4('0x3d')]){_0x9b3a73[_0x36e4('0x42')]=[{'all':!![]}];}_0x9b3a73=_[_0x36e4('0x3a')]({},_0x9b3a73,_0x132f5d[_0x36e4('0x3c')]);return db[_0x36e4('0x27')][_0x36e4('0x43')](_0x9b3a73)['then'](handleEntityNotFound(_0x1f3b0f,null))[_0x36e4('0x22')](respondWithResult(_0x1f3b0f,null))[_0x36e4('0x40')](handleError(_0x1f3b0f,null));};exports[_0x36e4('0x44')]=function(_0x2b0ecd,_0x5a3751){return db['AnalyticCustomReport']['create'](_0x2b0ecd[_0x36e4('0x45')],{})[_0x36e4('0x22')](function(_0x329ef0){var _0x492743=_0x2b0ecd[_0x36e4('0x46')][_0x36e4('0x21')]({'plain':!![]});if(!_0x492743)throw new Error(_0x36e4('0x47'));if(_0x492743['role']===_0x36e4('0x46')){var _0xd7a85=_0x329ef0[_0x36e4('0x21')]({'plain':!![]});var _0x351bf0=_0x36e4('0x48');return db[_0x36e4('0x49')][_0x36e4('0x43')]({'where':{'name':_0x351bf0,'userProfileId':_0x492743['userProfileId']},'raw':!![]})[_0x36e4('0x22')](function(_0x189a68){if(_0x189a68&&_0x189a68[_0x36e4('0x4a')]===0x0){return db[_0x36e4('0x4b')][_0x36e4('0x44')]({'name':_0xd7a85[_0x36e4('0x23')],'resourceId':_0xd7a85['id'],'type':_0x36e4('0x4c'),'sectionId':_0x189a68['id']},{})[_0x36e4('0x22')](function(){return _0x329ef0;});}else{return _0x329ef0;}})[_0x36e4('0x40')](function(_0x2c8f18){logger[_0x36e4('0x4d')](_0x36e4('0x4e'),_0x2c8f18);throw _0x2c8f18;});}return _0x329ef0;})[_0x36e4('0x22')](respondWithResult(_0x5a3751,0xc9))[_0x36e4('0x40')](handleError(_0x5a3751,null));};exports[_0x36e4('0x4f')]=function(_0x40068a,_0x43fc97){if(_0x40068a[_0x36e4('0x45')]['id']){delete _0x40068a[_0x36e4('0x45')]['id'];}return db[_0x36e4('0x27')][_0x36e4('0x43')]({'where':{'id':_0x40068a[_0x36e4('0x41')]['id']}})[_0x36e4('0x22')](handleEntityNotFound(_0x43fc97,null))['then'](saveUpdates(_0x40068a[_0x36e4('0x45')],null))[_0x36e4('0x22')](respondWithResult(_0x43fc97,null))[_0x36e4('0x40')](handleError(_0x43fc97,null));};exports['destroy']=function(_0x5eb433,_0x615fde){return db[_0x36e4('0x27')][_0x36e4('0x43')]({'where':{'id':_0x5eb433[_0x36e4('0x41')]['id']}})[_0x36e4('0x22')](handleEntityNotFound(_0x615fde,null))[_0x36e4('0x22')](removeEntity(_0x615fde,null))[_0x36e4('0x40')](handleError(_0x615fde,null));};exports[_0x36e4('0x50')]=function(_0x553e89,_0x220c78){var _0x39dd47=0xa;var _0x279e19=[_0x36e4('0x51'),_0x36e4('0x52'),'right_join',_0x36e4('0x53')];var _0x4f582b={'SUM':_0x36e4('0x54'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x36e4('0x55'),'MAX':_0x36e4('0x56'),'MIN':'MIN(%s)','AVG':_0x36e4('0x57'),'GROUP_CONCAT':_0x36e4('0x58'),'GROUP_CONCAT ASC':_0x36e4('0x59'),'GROUP_CONCAT DESC':_0x36e4('0x5a')};var _0x1b2594={'SEC_TO_TIME':_0x36e4('0x5b'),'DATE':_0x36e4('0x5c'),'HOUR':_0x36e4('0x5d'),'ROUND':_0x36e4('0x5e'),'UNIX_TIMESTAMP':_0x36e4('0x5f')};var _0x145e1c=function(_0x1b6859){return!_[_0x36e4('0x60')](['IS\x20NULL',_0x36e4('0x61'),_0x36e4('0x62'),_0x36e4('0x63')],_0x1b6859);};var _0x1fd3a2=function(_0x232ad3){if(!_0x232ad3||!_0x232ad3['rules']['length']){return'';}for(var _0x289861='(',_0xb1035a=0x0;_0xb1035a<_0x232ad3[_0x36e4('0x64')][_0x36e4('0x33')];_0xb1035a+=0x1){_0xb1035a>0x0&&(_0x289861+='\x20'+_0x232ad3[_0x36e4('0x65')]+'\x20');_0x289861+=_0x232ad3[_0x36e4('0x64')][_0xb1035a][_0x36e4('0x66')]?_0x1fd3a2(_0x232ad3['rules'][_0xb1035a][_0x36e4('0x66')]):_0x232ad3[_0x36e4('0x64')][_0xb1035a][_0x36e4('0x67')]+'\x20'+_0x232ad3[_0x36e4('0x64')][_0xb1035a][_0x36e4('0x68')]+(_0x145e1c(_0x232ad3['rules'][_0xb1035a][_0x36e4('0x68')])?'\x20'+_0x232ad3['rules'][_0xb1035a][_0x36e4('0x69')]:'');}return _0x289861+')';};var _0x417284={'where':{'id':_0x553e89['params']['id']}},_0x39eb65,_0x46288d,_0x42ec6a,_0x725602,_0x2145ad;_0x417284=_[_0x36e4('0x3a')]({},_0x417284,_0x553e89[_0x36e4('0x3c')]);return db[_0x36e4('0x27')][_0x36e4('0x43')](_0x417284)[_0x36e4('0x22')](function(_0x4330db){if(_0x4330db){_0x39eb65=_0x4330db;return _0x4330db[_0x36e4('0x6a')]();}return null;})[_0x36e4('0x22')](function(_0x159f39){if(_0x159f39){if(!_0x159f39[_0x36e4('0x33')]){throw new db[(_0x36e4('0x6b'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x46288d=_0x159f39;return db[_0x36e4('0x6c')]['findAll']({'raw':!![]});}return null;})[_0x36e4('0x22')](function(_0x2d359a){if(_0x2d359a){_0x42ec6a=_[_0x36e4('0x6d')](_0x2d359a,'id');var _0x313ee8;var _0x51d02d=squel[_0x36e4('0x6e')]();_0x51d02d['from'](_0x39eb65['table']);for(var _0x2088a3=0x0;_0x2088a3<_0x46288d[_0x36e4('0x33')];_0x2088a3+=0x1){_0x313ee8=_0x46288d[_0x2088a3][_0x36e4('0x6f')]?_0x42ec6a[_0x46288d[_0x2088a3][_0x36e4('0x6f')]][_0x36e4('0x70')]:_0x46288d[_0x2088a3][_0x36e4('0x67')];_0x313ee8=_0x46288d[_0x2088a3][_0x36e4('0x71')]?_[_0x36e4('0x72')](_0x4f582b[_0x46288d[_0x2088a3][_0x36e4('0x71')]],'%s',_0x313ee8):_0x313ee8;_0x313ee8=_0x46288d[_0x2088a3][_0x36e4('0x73')]?_[_0x36e4('0x72')](_0x1b2594[_0x46288d[_0x2088a3][_0x36e4('0x73')]],'%s',_0x313ee8):_0x313ee8;if(_0x46288d[_0x2088a3]['groupBy']){_0x51d02d[_0x36e4('0x66')](_0x313ee8);}_0x46288d[_0x2088a3][_0x36e4('0x74')]&&_0x51d02d[_0x36e4('0x75')](_0x313ee8,_0x46288d[_0x2088a3][_0x36e4('0x74')]==='DESC'?![]:!![]);_0x51d02d[_0x36e4('0x67')](_0x313ee8,_0x46288d[_0x2088a3][_0x36e4('0x76')]||_0x313ee8);}if(_0x39eb65[_0x36e4('0x77')]){_0x39eb65['joins']=JSON['parse'](_0x39eb65['joins']);for(var _0x59102d=0x0;_0x59102d<_0x39eb65[_0x36e4('0x77')]['length'];_0x59102d+=0x1){if(_0x39eb65['joins'][_0x59102d]['type']&&_['includes'](_0x279e19,_0x39eb65['joins'][_0x59102d][_0x36e4('0x2a')])&&_0x39eb65[_0x36e4('0x77')][_0x59102d][_0x36e4('0x78')]&&_0x39eb65[_0x36e4('0x77')][_0x59102d][_0x36e4('0x79')]&&_0x39eb65['joins'][_0x59102d][_0x36e4('0x7a')]){_0x51d02d[_0x39eb65[_0x36e4('0x77')][_0x59102d][_0x36e4('0x2a')]](_0x39eb65[_0x36e4('0x77')][_0x59102d]['foreignTable'],null,util[_0x36e4('0x73')](_0x36e4('0x7b'),_0x39eb65['table'],_0x39eb65[_0x36e4('0x77')][_0x59102d][_0x36e4('0x78')],_0x39eb65['joins'][_0x59102d][_0x36e4('0x79')],_0x39eb65[_0x36e4('0x77')][_0x59102d][_0x36e4('0x7a')]));}}}if(_0x39eb65['conditions']){_0x39eb65[_0x36e4('0x7c')]=JSON[_0x36e4('0x7d')](_0x39eb65[_0x36e4('0x7c')]);_0x51d02d[_0x36e4('0x37')](_0x1fd3a2(_0x39eb65[_0x36e4('0x7c')][_0x36e4('0x66')]));}_0x2145ad=_0x51d02d['clone']();_0x51d02d[_0x36e4('0x19')](_0x39dd47);_0x51d02d[_0x36e4('0x17')](0x0);logger[_0x36e4('0x7e')](_0x36e4('0x7f'),_0x51d02d['toString']());return dbH[_0x36e4('0x80')][_0x36e4('0x2e')](_0x51d02d[_0x36e4('0x81')](),{'type':dbH[_0x36e4('0x80')][_0x36e4('0x82')][_0x36e4('0x83')]});}})[_0x36e4('0x22')](respondWithResult(_0x220c78,null))[_0x36e4('0x40')](handleError(_0x220c78,null));};function runReport(_0x4a10c0,_0x15ed88,_0x32966d){var _0x518387=_0x15ed88[_0x36e4('0x23')];var _0x5f4cda=0xa;var _0x3ad654=[_0x36e4('0x51'),'left_join','right_join',_0x36e4('0x53')];var _0xb50ee7={'SUM':_0x36e4('0x54'),'COUNT':_0x36e4('0x84'),'COUNT DISTINCT':_0x36e4('0x55'),'MAX':_0x36e4('0x56'),'MIN':_0x36e4('0x85'),'AVG':_0x36e4('0x57'),'GROUP_CONCAT':_0x36e4('0x58'),'GROUP_CONCAT ASC':_0x36e4('0x59'),'GROUP_CONCAT DESC':_0x36e4('0x5a')};var _0x39abff={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x36e4('0x5c'),'HOUR':'HOUR(%s)','ROUND':_0x36e4('0x5e'),'UNIX_TIMESTAMP':_0x36e4('0x5f')};var _0x161fbe=function(_0x5cbb85){return!_[_0x36e4('0x60')]([_0x36e4('0x86'),_0x36e4('0x61'),_0x36e4('0x62'),'IS\x20NOT\x20EMPTY'],_0x5cbb85);};var _0x229870=function(_0x483145){if(!_0x483145||!_0x483145[_0x36e4('0x64')][_0x36e4('0x33')]){return'';}for(var _0x48e41c='(',_0x44b24c=0x0;_0x44b24c<_0x483145['rules'][_0x36e4('0x33')];_0x44b24c+=0x1){_0x44b24c>0x0&&(_0x48e41c+='\x20'+_0x483145[_0x36e4('0x65')]+'\x20');_0x48e41c+=_0x483145['rules'][_0x44b24c][_0x36e4('0x66')]?_0x229870(_0x483145[_0x36e4('0x64')][_0x44b24c][_0x36e4('0x66')]):_0x483145[_0x36e4('0x64')][_0x44b24c]['field']+'\x20'+_0x483145[_0x36e4('0x64')][_0x44b24c]['condition']+(_0x161fbe(_0x483145[_0x36e4('0x64')][_0x44b24c][_0x36e4('0x68')])?'\x20'+_0x483145[_0x36e4('0x64')][_0x44b24c][_0x36e4('0x69')]:'');}return _0x48e41c+')';};var _0x3766fd={'where':{'id':_0x4a10c0['id']}},_0x4feb61,_0x189c55,_0x1f3f26,_0x47d84d,_0x5c0933;_0x3766fd=_[_0x36e4('0x3a')]({},_0x3766fd,_0x32966d);return db[_0x36e4('0x27')][_0x36e4('0x43')](_0x3766fd)[_0x36e4('0x22')](function(_0xfb41ae){if(_0xfb41ae){_0x4feb61=_0xfb41ae;return _0xfb41ae[_0x36e4('0x6a')]();}return null;})['then'](function(_0x25f9d2){if(_0x25f9d2){if(!_0x25f9d2[_0x36e4('0x33')]){throw new db['Sequelize']['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x189c55=_0x25f9d2;return db['AnalyticMetric'][_0x36e4('0x3e')]({'raw':!![]});}return null;})[_0x36e4('0x22')](function(_0x43eb2a){if(_0x43eb2a){_0x1f3f26=_['keyBy'](_0x43eb2a,'id');var _0x735d91;var _0xffc49e=squel[_0x36e4('0x6e')]();_0xffc49e[_0x36e4('0x87')](_0x4feb61['table']);for(var _0x438972=0x0;_0x438972<_0x189c55['length'];_0x438972+=0x1){_0x735d91=_0x189c55[_0x438972][_0x36e4('0x6f')]?_0x1f3f26[_0x189c55[_0x438972]['MetricId']]['metric']:_0x189c55[_0x438972]['field'];_0x735d91=_0x189c55[_0x438972][_0x36e4('0x71')]?_[_0x36e4('0x72')](_0xb50ee7[_0x189c55[_0x438972][_0x36e4('0x71')]],'%s',_0x735d91):_0x735d91;_0x735d91=_0x189c55[_0x438972][_0x36e4('0x73')]?_['replace'](_0x39abff[_0x189c55[_0x438972][_0x36e4('0x73')]],'%s',_0x735d91):_0x735d91;if(_0x189c55[_0x438972][_0x36e4('0x88')]){_0xffc49e[_0x36e4('0x66')](_0x735d91);}_0x189c55[_0x438972][_0x36e4('0x74')]&&_0xffc49e[_0x36e4('0x75')](_0x735d91,_0x189c55[_0x438972][_0x36e4('0x74')]==='DESC'?![]:!![]);_0xffc49e[_0x36e4('0x67')](_0x735d91,_0x189c55[_0x438972][_0x36e4('0x76')]||_0x735d91);}if(_0x4feb61[_0x36e4('0x77')]){_0x4feb61[_0x36e4('0x77')]=JSON[_0x36e4('0x7d')](_0x4feb61[_0x36e4('0x77')]);for(var _0x5e71d6=0x0;_0x5e71d6<_0x4feb61[_0x36e4('0x77')][_0x36e4('0x33')];_0x5e71d6+=0x1){if(_0x4feb61[_0x36e4('0x77')][_0x5e71d6]['type']&&_[_0x36e4('0x60')](_0x3ad654,_0x4feb61[_0x36e4('0x77')][_0x5e71d6][_0x36e4('0x2a')])&&_0x4feb61[_0x36e4('0x77')][_0x5e71d6][_0x36e4('0x78')]&&_0x4feb61[_0x36e4('0x77')][_0x5e71d6][_0x36e4('0x79')]&&_0x4feb61[_0x36e4('0x77')][_0x5e71d6][_0x36e4('0x7a')]){_0xffc49e[_0x4feb61[_0x36e4('0x77')][_0x5e71d6]['type']](_0x4feb61['joins'][_0x5e71d6][_0x36e4('0x79')],null,util[_0x36e4('0x73')](_0x36e4('0x7b'),_0x4feb61[_0x36e4('0x89')],_0x4feb61[_0x36e4('0x77')][_0x5e71d6][_0x36e4('0x78')],_0x4feb61[_0x36e4('0x77')][_0x5e71d6]['foreignTable'],_0x4feb61['joins'][_0x5e71d6][_0x36e4('0x7a')]));}}}if(_0x4feb61[_0x36e4('0x7c')]){_0x4feb61[_0x36e4('0x7c')]=JSON['parse'](_0x4feb61[_0x36e4('0x7c')]);_0xffc49e['where'](_0x229870(_0x4feb61[_0x36e4('0x7c')][_0x36e4('0x66')]));}_0x5c0933=_0xffc49e[_0x36e4('0x8a')]();_0xffc49e[_0x36e4('0x19')](_0x5f4cda);_0xffc49e[_0x36e4('0x17')](0x0);return;}})[_0x36e4('0x22')](function(){if(_0x15ed88[_0x36e4('0x8b')]===_0x36e4('0x8c')){return null;}var _0x5198c8=_[_0x36e4('0x3a')](_0x15ed88,{'name':_0x15ed88['fullPath']||_0x15ed88[_0x36e4('0x23')]||_0x4feb61[_0x36e4('0x23')],'basename':_0x518387,'savename':util[_0x36e4('0x73')]('%s-%s.%s',_0x15ed88[_0x36e4('0x23')]||_0x4feb61[_0x36e4('0x23')],require(_0x36e4('0x8d'))[_0x36e4('0x8e')](0x4),_0x15ed88[_0x36e4('0x8b')]||_0x36e4('0x8f')),'reportId':_0x4feb61['id'],'reportType':_0x36e4('0x90')});return db['AnalyticExtractedReport'][_0x36e4('0x44')](_0x5198c8,{'raw':!![]});})[_0x36e4('0x22')](function(_0x17b1bc){if(_0x4feb61[_0x36e4('0x89')]===_0x36e4('0x91')){_0x5c0933[_0x36e4('0x37')](_0x4feb61[_0x36e4('0x89')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x15ed88['startDate'],_0x15ed88['endDate']);}else{_0x5c0933[_0x36e4('0x37')](_0x4feb61[_0x36e4('0x89')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x15ed88['startDate'],_0x15ed88[_0x36e4('0x92')]);}if(_0x17b1bc){logger[_0x36e4('0x93')](_0x36e4('0x94'),_0x5c0933[_0x36e4('0x81')]());require(_0x36e4('0x95'))[_0x36e4('0x96')](path[_0x36e4('0x51')](__dirname,_0x36e4('0x97'),_0x17b1bc[_0x36e4('0x8b')]),[_0x17b1bc['id'],_0x5c0933[_0x36e4('0x81')](),path[_0x36e4('0x51')](__dirname,_0x36e4('0x98'),_0x17b1bc['savename']),_0x518387]);return _0x17b1bc;}else{var _0x30ca4d=squel[_0x36e4('0x6e')]();_0x30ca4d[_0x36e4('0x87')]('('+_0x5c0933[_0x36e4('0x81')]()+')',_0x36e4('0x99'));_0x30ca4d[_0x36e4('0x67')](_0x36e4('0x9a'),'count');_0x5c0933['limit'](_0x15ed88[_0x36e4('0x19')]||_0x5f4cda);_0x5c0933['offset'](_0x15ed88[_0x36e4('0x17')]||0x0);return dbH[_0x36e4('0x80')][_0x36e4('0x2e')](_0x30ca4d[_0x36e4('0x81')](),{'type':dbH[_0x36e4('0x80')]['QueryTypes'][_0x36e4('0x83')]})[_0x36e4('0x22')](function(_0x2cb82b){if(!_0x2cb82b['length']){_0x47d84d=0x0;}else{_0x47d84d=_0x2cb82b[0x0][_0x36e4('0x1a')]||0x0;}return dbH[_0x36e4('0x80')][_0x36e4('0x2e')](_0x5c0933[_0x36e4('0x81')](),{'type':dbH[_0x36e4('0x80')][_0x36e4('0x82')][_0x36e4('0x83')]});})[_0x36e4('0x22')](function(_0x575212){return{'rows':_0x575212||[],'count':_0x47d84d};});}});}exports['run']=function(_0x34b8ce,_0x5ce12b){return runReport(_0x34b8ce[_0x36e4('0x41')],_0x34b8ce[_0x36e4('0x2e')],_0x34b8ce[_0x36e4('0x3c')])['then'](respondWithResult(_0x5ce12b,null))['catch'](handleError(_0x5ce12b,null));};exports[_0x36e4('0x9b')]=runReport;exports[_0x36e4('0x2e')]=function(_0x1f29d9,_0x1a8a7a){var _0x29925a=0xa;var _0x1c7320=[_0x36e4('0x51'),_0x36e4('0x52'),_0x36e4('0x9c'),_0x36e4('0x53')];var _0x1fa9ac={'SUM':_0x36e4('0x54'),'COUNT':_0x36e4('0x84'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x36e4('0x56'),'MIN':_0x36e4('0x85'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x36e4('0x58'),'GROUP_CONCAT ASC':_0x36e4('0x59'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x20887c={'SEC_TO_TIME':_0x36e4('0x5b'),'DATE':_0x36e4('0x5c'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x36e4('0x5f')};var _0x4daa62=function(_0x2251b7){return!_[_0x36e4('0x60')]([_0x36e4('0x86'),_0x36e4('0x61'),_0x36e4('0x62'),_0x36e4('0x63')],_0x2251b7);};var _0x17bf4b=function(_0x1c91c2){if(!_0x1c91c2||!_0x1c91c2[_0x36e4('0x64')][_0x36e4('0x33')]){return'';}for(var _0x7e74fc='(',_0x1c8df1=0x0;_0x1c8df1<_0x1c91c2[_0x36e4('0x64')][_0x36e4('0x33')];_0x1c8df1+=0x1){_0x1c8df1>0x0&&(_0x7e74fc+='\x20'+_0x1c91c2['operator']+'\x20');_0x7e74fc+=_0x1c91c2[_0x36e4('0x64')][_0x1c8df1][_0x36e4('0x66')]?_0x17bf4b(_0x1c91c2[_0x36e4('0x64')][_0x1c8df1][_0x36e4('0x66')]):_0x1c91c2['rules'][_0x1c8df1][_0x36e4('0x67')]+'\x20'+_0x1c91c2[_0x36e4('0x64')][_0x1c8df1][_0x36e4('0x68')]+(_0x4daa62(_0x1c91c2[_0x36e4('0x64')][_0x1c8df1]['condition'])?'\x20'+_0x1c91c2['rules'][_0x1c8df1]['value']:'');}return _0x7e74fc+')';};var _0x38be45={'where':{'id':_0x1f29d9['params']['id']}},_0x1a08ad,_0xe794fe,_0x469c35,_0x15c99f,_0x5e7451;_0x38be45=_[_0x36e4('0x3a')]({},_0x38be45,_0x1f29d9[_0x36e4('0x3c')]);return db[_0x36e4('0x27')]['find'](_0x38be45)['then'](function(_0x1e4861){if(_0x1e4861){_0x1a08ad=_0x1e4861;return _0x1e4861['getFields']();}return null;})[_0x36e4('0x22')](function(_0x5b1727){if(_0x5b1727){if(!_0x5b1727[_0x36e4('0x33')]){throw new db[(_0x36e4('0x6b'))][(_0x36e4('0x9d'))](_0x36e4('0x9e'),0x193);}_0xe794fe=_0x5b1727;return db[_0x36e4('0x6c')][_0x36e4('0x3e')]({'raw':!![]});}return null;})['then'](function(_0x1a3f34){if(_0x1a3f34){_0x469c35=_[_0x36e4('0x6d')](_0x1a3f34,'id');var _0x588242;var _0x56a881=squel[_0x36e4('0x6e')]();_0x56a881[_0x36e4('0x87')](_0x1a08ad[_0x36e4('0x89')]);for(var _0x3ee5f2=0x0;_0x3ee5f2<_0xe794fe['length'];_0x3ee5f2+=0x1){_0x588242=_0xe794fe[_0x3ee5f2]['MetricId']?_0x469c35[_0xe794fe[_0x3ee5f2]['MetricId']]['metric']:_0xe794fe[_0x3ee5f2][_0x36e4('0x67')];_0x588242=_0xe794fe[_0x3ee5f2]['function']?_[_0x36e4('0x72')](_0x1fa9ac[_0xe794fe[_0x3ee5f2][_0x36e4('0x71')]],'%s',_0x588242):_0x588242;_0x588242=_0xe794fe[_0x3ee5f2][_0x36e4('0x73')]?_[_0x36e4('0x72')](_0x20887c[_0xe794fe[_0x3ee5f2]['format']],'%s',_0x588242):_0x588242;if(_0xe794fe[_0x3ee5f2]['groupBy']){_0x56a881[_0x36e4('0x66')](_0x588242);}_0xe794fe[_0x3ee5f2][_0x36e4('0x74')]&&_0x56a881[_0x36e4('0x75')](_0x588242,_0xe794fe[_0x3ee5f2][_0x36e4('0x74')]===_0x36e4('0x9f')?![]:!![]);_0x56a881[_0x36e4('0x67')](_0x588242,_0xe794fe[_0x3ee5f2][_0x36e4('0x76')]||_0x588242);}if(_0x1a08ad[_0x36e4('0x77')]){_0x1a08ad[_0x36e4('0x77')]=JSON['parse'](_0x1a08ad[_0x36e4('0x77')]);for(var _0x1a6d05=0x0;_0x1a6d05<_0x1a08ad[_0x36e4('0x77')][_0x36e4('0x33')];_0x1a6d05+=0x1){if(_0x1a08ad[_0x36e4('0x77')][_0x1a6d05][_0x36e4('0x2a')]&&_['includes'](_0x1c7320,_0x1a08ad[_0x36e4('0x77')][_0x1a6d05]['type'])&&_0x1a08ad[_0x36e4('0x77')][_0x1a6d05][_0x36e4('0x78')]&&_0x1a08ad[_0x36e4('0x77')][_0x1a6d05][_0x36e4('0x79')]&&_0x1a08ad[_0x36e4('0x77')][_0x1a6d05][_0x36e4('0x7a')]){_0x56a881[_0x1a08ad['joins'][_0x1a6d05]['type']](_0x1a08ad[_0x36e4('0x77')][_0x1a6d05][_0x36e4('0x79')],null,util['format'](_0x36e4('0x7b'),_0x1a08ad['table'],_0x1a08ad[_0x36e4('0x77')][_0x1a6d05][_0x36e4('0x78')],_0x1a08ad['joins'][_0x1a6d05][_0x36e4('0x79')],_0x1a08ad[_0x36e4('0x77')][_0x1a6d05]['foreignKey']));}}}if(_0x1a08ad['conditions']){_0x1a08ad[_0x36e4('0x7c')]=JSON['parse'](_0x1a08ad[_0x36e4('0x7c')]);_0x56a881[_0x36e4('0x37')](_0x17bf4b(_0x1a08ad['conditions'][_0x36e4('0x66')]));}_0x5e7451=_0x56a881[_0x36e4('0x8a')]();_0x56a881[_0x36e4('0x19')](_0x29925a);_0x56a881[_0x36e4('0x17')](0x0);logger[_0x36e4('0x7e')](_0x36e4('0x7f'),_0x56a881[_0x36e4('0x81')]());return dbH[_0x36e4('0x80')][_0x36e4('0x2e')](_0x56a881[_0x36e4('0x81')](),{'type':dbH[_0x36e4('0x80')][_0x36e4('0x82')][_0x36e4('0x83')]});}})[_0x36e4('0x22')](function(){return{'sql':_0x5e7451[_0x36e4('0x81')]()};})[_0x36e4('0x22')](respondWithResult(_0x1a8a7a,null))[_0x36e4('0x40')](handleError(_0x1a8a7a,null));}; \ No newline at end of file +var _0x9815=['json','offset','undefined','count','limit','set','Content-Range','reject','then','get','CustomReports','UserProfileResource','destroy','error','stack','name','map','AnalyticCustomReport','fieldName','type','key','keys','intersection','query','attributes','model','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','filters','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Reports','userProfileId','autoAssociation','update','join','left_join','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','group','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','table','MetricId','metric','field','function','replace','groupBy','order','DESC','alias','joins','parentKey','foreignTable','format','%s.%s\x20=\x20%s.%s','foreignKey','conditions','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','MAX(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','ROUND(%s)','operator','Sequelize','from','orderBy','parse','clone','output','web','fullPath','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','startDate','info','Run\x20Query:','child_process','fork','savename','COUNT(*)','run','runReport','SUM(%s)','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','dbH','end','status'];(function(_0x462d4b,_0x597689){var _0x606afe=function(_0x2ca5bc){while(--_0x2ca5bc){_0x462d4b['push'](_0x462d4b['shift']());}};_0x606afe(++_0x597689);}(_0x9815,0x1cb));var _0x5981=function(_0x1a0411,_0x59a9cd){_0x1a0411=_0x1a0411-0x0;var _0x2be39e=_0x9815[_0x1a0411];return _0x2be39e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5981('0x0'));var zipdir=require(_0x5981('0x1'));var jsonpatch=require(_0x5981('0x2'));var rp=require('request-promise');var moment=require(_0x5981('0x3'));var BPromise=require(_0x5981('0x4'));var Mustache=require(_0x5981('0x5'));var util=require('util');var path=require(_0x5981('0x6'));var sox=require(_0x5981('0x7'));var csv=require(_0x5981('0x8'));var ejs=require(_0x5981('0x9'));var fs=require('fs');var fs_extra=require(_0x5981('0xa'));var _=require('lodash');var squel=require(_0x5981('0xb'));var crypto=require(_0x5981('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5981('0xd'));var toCsv=require(_0x5981('0x8'));var querystring=require(_0x5981('0xe'));var Papa=require(_0x5981('0xf'));var Redis=require('ioredis');var authService=require(_0x5981('0x10'));var qs=require(_0x5981('0x11'));var as=require(_0x5981('0x12'));var hardwareService=require(_0x5981('0x13'));var logger=require(_0x5981('0x14'))('api');var utils=require(_0x5981('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x5981('0x16'));var db=require(_0x5981('0x17'))['db'];var dbH=require(_0x5981('0x17'))[_0x5981('0x18')];function respondWithStatusCode(_0x1ea305,_0x3de040){_0x3de040=_0x3de040||0xcc;return function(_0x198a00){if(_0x198a00){return _0x1ea305['sendStatus'](_0x3de040);}return _0x1ea305['status'](_0x3de040)[_0x5981('0x19')]();};}function respondWithResult(_0x283049,_0x3363ec){_0x3363ec=_0x3363ec||0xc8;return function(_0x49eed4){if(_0x49eed4){return _0x283049[_0x5981('0x1a')](_0x3363ec)[_0x5981('0x1b')](_0x49eed4);}};}function respondWithFilteredResult(_0x2bc531,_0x5c593d){return function(_0x399e46){if(_0x399e46){var _0x412524=typeof _0x5c593d[_0x5981('0x1c')]===_0x5981('0x1d')&&typeof _0x5c593d['limit']===_0x5981('0x1d');var _0x186325=_0x399e46[_0x5981('0x1e')];var _0x5bda1d=_0x412524?0x0:_0x5c593d[_0x5981('0x1c')];var _0x7228c8=_0x412524?_0x399e46[_0x5981('0x1e')]:_0x5c593d[_0x5981('0x1c')]+_0x5c593d[_0x5981('0x1f')];var _0x44760d;if(_0x7228c8>=_0x186325){_0x7228c8=_0x186325;_0x44760d=0xc8;}else{_0x44760d=0xce;}_0x2bc531[_0x5981('0x1a')](_0x44760d);return _0x2bc531[_0x5981('0x20')](_0x5981('0x21'),_0x5bda1d+'-'+_0x7228c8+'/'+_0x186325)['json'](_0x399e46);}return null;};}function patchUpdates(_0x359ca3){return function(_0x23d2c3){try{jsonpatch['apply'](_0x23d2c3,_0x359ca3,!![]);}catch(_0x4df9e1){return BPromise[_0x5981('0x22')](_0x4df9e1);}return _0x23d2c3['save']();};}function saveUpdates(_0x362795,_0x2fdb0e){return function(_0x1fc0f2){if(_0x1fc0f2){return _0x1fc0f2['update'](_0x362795)[_0x5981('0x23')](function(_0x29ccab){return _0x29ccab;});}return null;};}function removeEntity(_0xa7bbf6,_0x37bbb4){return function(_0x3a9116){if(_0x3a9116){return _0x3a9116['destroy']()[_0x5981('0x23')](function(){var _0x1a23ed=_0x3a9116[_0x5981('0x24')]({'plain':!![]});var _0x34dac4=_0x5981('0x25');return db[_0x5981('0x26')][_0x5981('0x27')]({'where':{'type':_0x34dac4,'resourceId':_0x1a23ed['id']}})[_0x5981('0x23')](function(){return _0x3a9116;});})['then'](function(){_0xa7bbf6[_0x5981('0x1a')](0xcc)[_0x5981('0x19')]();});}};}function handleEntityNotFound(_0x3bf37f,_0x2648ec){return function(_0x1ea0b1){if(!_0x1ea0b1){_0x3bf37f['sendStatus'](0x194);}return _0x1ea0b1;};}function handleError(_0x2d826c,_0x11e8e8){_0x11e8e8=_0x11e8e8||0x1f4;return function(_0x2953a4){logger[_0x5981('0x28')](_0x2953a4[_0x5981('0x29')]);if(_0x2953a4[_0x5981('0x2a')]){delete _0x2953a4[_0x5981('0x2a')];}_0x2d826c[_0x5981('0x1a')](_0x11e8e8)['send'](_0x2953a4);};}exports['index']=function(_0x121333,_0x56ce55){var _0x20ef24={},_0x44e86f={},_0x219838={'count':0x0,'rows':[]};var _0x5d7cf0=_[_0x5981('0x2b')](db[_0x5981('0x2c')]['rawAttributes'],function(_0x235e9d){return{'name':_0x235e9d[_0x5981('0x2d')],'type':_0x235e9d[_0x5981('0x2e')][_0x5981('0x2f')]};});_0x44e86f['model']=_[_0x5981('0x2b')](_0x5d7cf0,_0x5981('0x2a'));_0x44e86f['query']=_[_0x5981('0x30')](_0x121333['query']);_0x44e86f['filters']=_[_0x5981('0x31')](_0x44e86f['model'],_0x44e86f[_0x5981('0x32')]);_0x20ef24[_0x5981('0x33')]=_[_0x5981('0x31')](_0x44e86f[_0x5981('0x34')],qs[_0x5981('0x35')](_0x121333['query'][_0x5981('0x35')]));_0x20ef24[_0x5981('0x33')]=_0x20ef24[_0x5981('0x33')][_0x5981('0x36')]?_0x20ef24[_0x5981('0x33')]:_0x44e86f[_0x5981('0x34')];if(!_0x121333['query'][_0x5981('0x37')]('nolimit')){_0x20ef24[_0x5981('0x1f')]=qs[_0x5981('0x1f')](_0x121333[_0x5981('0x32')][_0x5981('0x1f')]);_0x20ef24[_0x5981('0x1c')]=qs[_0x5981('0x1c')](_0x121333[_0x5981('0x32')][_0x5981('0x1c')]);}_0x20ef24['order']=qs[_0x5981('0x38')](_0x121333[_0x5981('0x32')]['sort']);_0x20ef24[_0x5981('0x39')]=qs['filters'](_[_0x5981('0x3a')](_0x121333[_0x5981('0x32')],_0x44e86f['filters']),_0x5d7cf0);if(_0x121333['query'][_0x5981('0x3b')]){_0x20ef24['where']=_[_0x5981('0x3c')](_0x20ef24['where'],{'$or':_['map'](_0x5d7cf0,function(_0x209097){if(_0x209097[_0x5981('0x2e')]!==_0x5981('0x3d')){var _0x5d7048={};_0x5d7048[_0x209097[_0x5981('0x2a')]]={'$like':'%'+_0x121333[_0x5981('0x32')][_0x5981('0x3b')]+'%'};return _0x5d7048;}})});}_0x20ef24=_[_0x5981('0x3c')]({},_0x20ef24,_0x121333[_0x5981('0x3e')]);var _0x217755={'where':_0x20ef24[_0x5981('0x39')]};return db[_0x5981('0x2c')][_0x5981('0x1e')](_0x217755)[_0x5981('0x23')](function(_0x405f20){_0x219838[_0x5981('0x1e')]=_0x405f20;if(_0x121333[_0x5981('0x32')][_0x5981('0x3f')]){_0x20ef24[_0x5981('0x40')]=[{'all':!![]}];}return db[_0x5981('0x2c')][_0x5981('0x41')](_0x20ef24);})['then'](function(_0x2999af){_0x219838[_0x5981('0x42')]=_0x2999af;return _0x219838;})[_0x5981('0x23')](respondWithFilteredResult(_0x56ce55,_0x20ef24))[_0x5981('0x43')](handleError(_0x56ce55,null));};exports[_0x5981('0x44')]=function(_0x62f847,_0xff5374){var _0x258685={'raw':![],'where':{'id':_0x62f847[_0x5981('0x45')]['id']}},_0x267031={};_0x267031['model']=_[_0x5981('0x30')](db['AnalyticCustomReport'][_0x5981('0x46')]);_0x267031[_0x5981('0x32')]=_[_0x5981('0x30')](_0x62f847[_0x5981('0x32')]);_0x267031[_0x5981('0x47')]=_['intersection'](_0x267031[_0x5981('0x34')],_0x267031['query']);_0x258685[_0x5981('0x33')]=_[_0x5981('0x31')](_0x267031[_0x5981('0x34')],qs[_0x5981('0x35')](_0x62f847[_0x5981('0x32')][_0x5981('0x35')]));_0x258685[_0x5981('0x33')]=_0x258685[_0x5981('0x33')]['length']?_0x258685[_0x5981('0x33')]:_0x267031['model'];if(_0x62f847[_0x5981('0x32')][_0x5981('0x3f')]){_0x258685[_0x5981('0x40')]=[{'all':!![]}];}_0x258685=_[_0x5981('0x3c')]({},_0x258685,_0x62f847[_0x5981('0x3e')]);return db[_0x5981('0x2c')][_0x5981('0x48')](_0x258685)[_0x5981('0x23')](handleEntityNotFound(_0xff5374,null))[_0x5981('0x23')](respondWithResult(_0xff5374,null))[_0x5981('0x43')](handleError(_0xff5374,null));};exports[_0x5981('0x49')]=function(_0x4633b4,_0x378724){return db[_0x5981('0x2c')][_0x5981('0x49')](_0x4633b4[_0x5981('0x4a')],{})['then'](function(_0x5459ab){var _0x15e57e=_0x4633b4['user'][_0x5981('0x24')]({'plain':!![]});if(!_0x15e57e)throw new Error(_0x5981('0x4b'));if(_0x15e57e[_0x5981('0x4c')]===_0x5981('0x4d')){var _0x5a4011=_0x5459ab[_0x5981('0x24')]({'plain':!![]});var _0x819047=_0x5981('0x4e');return db['UserProfileSection'][_0x5981('0x48')]({'where':{'name':_0x819047,'userProfileId':_0x15e57e[_0x5981('0x4f')]},'raw':!![]})['then'](function(_0x20a9a9){if(_0x20a9a9&&_0x20a9a9[_0x5981('0x50')]===0x0){return db[_0x5981('0x26')][_0x5981('0x49')]({'name':_0x5a4011[_0x5981('0x2a')],'resourceId':_0x5a4011['id'],'type':_0x5981('0x25'),'sectionId':_0x20a9a9['id']},{})[_0x5981('0x23')](function(){return _0x5459ab;});}else{return _0x5459ab;}})['catch'](function(_0xf948f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xf948f);throw _0xf948f;});}return _0x5459ab;})[_0x5981('0x23')](respondWithResult(_0x378724,0xc9))[_0x5981('0x43')](handleError(_0x378724,null));};exports[_0x5981('0x51')]=function(_0x2e8752,_0x1b8a40){if(_0x2e8752[_0x5981('0x4a')]['id']){delete _0x2e8752[_0x5981('0x4a')]['id'];}return db[_0x5981('0x2c')][_0x5981('0x48')]({'where':{'id':_0x2e8752[_0x5981('0x45')]['id']}})[_0x5981('0x23')](handleEntityNotFound(_0x1b8a40,null))['then'](saveUpdates(_0x2e8752[_0x5981('0x4a')],null))[_0x5981('0x23')](respondWithResult(_0x1b8a40,null))[_0x5981('0x43')](handleError(_0x1b8a40,null));};exports['destroy']=function(_0x383704,_0x52b677){return db[_0x5981('0x2c')][_0x5981('0x48')]({'where':{'id':_0x383704[_0x5981('0x45')]['id']}})[_0x5981('0x23')](handleEntityNotFound(_0x52b677,null))['then'](removeEntity(_0x52b677,null))[_0x5981('0x43')](handleError(_0x52b677,null));};exports['preview']=function(_0x7b9d12,_0x12abe0){var _0x1daf3a=0xa;var _0x552575=[_0x5981('0x52'),_0x5981('0x53'),_0x5981('0x54'),_0x5981('0x55')];var _0x2e0367={'SUM':'SUM(%s)','COUNT':_0x5981('0x56'),'COUNT DISTINCT':_0x5981('0x57'),'MAX':'MAX(%s)','MIN':_0x5981('0x58'),'AVG':_0x5981('0x59'),'GROUP_CONCAT':_0x5981('0x5a'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0xd5dfe8={'SEC_TO_TIME':_0x5981('0x5b'),'DATE':_0x5981('0x5c'),'HOUR':_0x5981('0x5d'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x5981('0x5e')};var _0x50b64b=function(_0x24f2f6){return!_[_0x5981('0x5f')]([_0x5981('0x60'),_0x5981('0x61'),_0x5981('0x62'),'IS\x20NOT\x20EMPTY'],_0x24f2f6);};var _0x4ed60d=function(_0x412cb6){if(!_0x412cb6||!_0x412cb6[_0x5981('0x63')][_0x5981('0x36')]){return'';}for(var _0x33849a='(',_0x3d34a6=0x0;_0x3d34a6<_0x412cb6['rules'][_0x5981('0x36')];_0x3d34a6+=0x1){_0x3d34a6>0x0&&(_0x33849a+='\x20'+_0x412cb6['operator']+'\x20');_0x33849a+=_0x412cb6[_0x5981('0x63')][_0x3d34a6][_0x5981('0x64')]?_0x4ed60d(_0x412cb6[_0x5981('0x63')][_0x3d34a6][_0x5981('0x64')]):_0x412cb6[_0x5981('0x63')][_0x3d34a6]['field']+'\x20'+_0x412cb6[_0x5981('0x63')][_0x3d34a6][_0x5981('0x65')]+(_0x50b64b(_0x412cb6[_0x5981('0x63')][_0x3d34a6][_0x5981('0x65')])?'\x20'+_0x412cb6['rules'][_0x3d34a6][_0x5981('0x66')]:'');}return _0x33849a+')';};var _0x2ae5f0={'where':{'id':_0x7b9d12[_0x5981('0x45')]['id']}},_0x9f45e2,_0x4d76a8,_0x12985f,_0x4213c2,_0x4983a2;_0x2ae5f0=_[_0x5981('0x3c')]({},_0x2ae5f0,_0x7b9d12[_0x5981('0x3e')]);return db[_0x5981('0x2c')]['find'](_0x2ae5f0)[_0x5981('0x23')](function(_0x185bce){if(_0x185bce){_0x9f45e2=_0x185bce;return _0x185bce[_0x5981('0x67')]();}return null;})[_0x5981('0x23')](function(_0x48ffc6){if(_0x48ffc6){if(!_0x48ffc6[_0x5981('0x36')]){throw new db['Sequelize'][(_0x5981('0x68'))](_0x5981('0x69'),0x193);}_0x4d76a8=_0x48ffc6;return db[_0x5981('0x6a')][_0x5981('0x41')]({'raw':!![]});}return null;})['then'](function(_0x2b744a){if(_0x2b744a){_0x12985f=_[_0x5981('0x6b')](_0x2b744a,'id');var _0x394e22;var _0x14daca=squel[_0x5981('0x6c')]();_0x14daca['from'](_0x9f45e2[_0x5981('0x6d')]);for(var _0x320a8a=0x0;_0x320a8a<_0x4d76a8[_0x5981('0x36')];_0x320a8a+=0x1){_0x394e22=_0x4d76a8[_0x320a8a][_0x5981('0x6e')]?_0x12985f[_0x4d76a8[_0x320a8a][_0x5981('0x6e')]][_0x5981('0x6f')]:_0x4d76a8[_0x320a8a][_0x5981('0x70')];_0x394e22=_0x4d76a8[_0x320a8a][_0x5981('0x71')]?_[_0x5981('0x72')](_0x2e0367[_0x4d76a8[_0x320a8a][_0x5981('0x71')]],'%s',_0x394e22):_0x394e22;_0x394e22=_0x4d76a8[_0x320a8a]['format']?_[_0x5981('0x72')](_0xd5dfe8[_0x4d76a8[_0x320a8a]['format']],'%s',_0x394e22):_0x394e22;if(_0x4d76a8[_0x320a8a][_0x5981('0x73')]){_0x14daca[_0x5981('0x64')](_0x394e22);}_0x4d76a8[_0x320a8a]['orderBy']&&_0x14daca[_0x5981('0x74')](_0x394e22,_0x4d76a8[_0x320a8a]['orderBy']===_0x5981('0x75')?![]:!![]);_0x14daca[_0x5981('0x70')](_0x394e22,_0x4d76a8[_0x320a8a][_0x5981('0x76')]||_0x394e22);}if(_0x9f45e2[_0x5981('0x77')]){_0x9f45e2[_0x5981('0x77')]=JSON['parse'](_0x9f45e2[_0x5981('0x77')]);for(var _0x4db41c=0x0;_0x4db41c<_0x9f45e2[_0x5981('0x77')][_0x5981('0x36')];_0x4db41c+=0x1){if(_0x9f45e2['joins'][_0x4db41c][_0x5981('0x2e')]&&_[_0x5981('0x5f')](_0x552575,_0x9f45e2['joins'][_0x4db41c][_0x5981('0x2e')])&&_0x9f45e2[_0x5981('0x77')][_0x4db41c][_0x5981('0x78')]&&_0x9f45e2[_0x5981('0x77')][_0x4db41c][_0x5981('0x79')]&&_0x9f45e2[_0x5981('0x77')][_0x4db41c]['foreignKey']){_0x14daca[_0x9f45e2[_0x5981('0x77')][_0x4db41c][_0x5981('0x2e')]](_0x9f45e2[_0x5981('0x77')][_0x4db41c][_0x5981('0x79')],null,util[_0x5981('0x7a')](_0x5981('0x7b'),_0x9f45e2[_0x5981('0x6d')],_0x9f45e2['joins'][_0x4db41c][_0x5981('0x78')],_0x9f45e2[_0x5981('0x77')][_0x4db41c][_0x5981('0x79')],_0x9f45e2[_0x5981('0x77')][_0x4db41c][_0x5981('0x7c')]));}}}if(_0x9f45e2['conditions']){_0x9f45e2[_0x5981('0x7d')]=JSON['parse'](_0x9f45e2[_0x5981('0x7d')]);_0x14daca[_0x5981('0x39')](_0x4ed60d(_0x9f45e2[_0x5981('0x7d')][_0x5981('0x64')]));}_0x4983a2=_0x14daca['clone']();_0x14daca[_0x5981('0x1f')](_0x1daf3a);_0x14daca[_0x5981('0x1c')](0x0);logger[_0x5981('0x7e')](_0x5981('0x7f'),_0x14daca[_0x5981('0x80')]());return dbH[_0x5981('0x81')][_0x5981('0x32')](_0x14daca[_0x5981('0x80')](),{'type':dbH[_0x5981('0x81')][_0x5981('0x82')][_0x5981('0x83')]});}})['then'](respondWithResult(_0x12abe0,null))[_0x5981('0x43')](handleError(_0x12abe0,null));};function runReport(_0x3e078f,_0x13868d,_0x49f8c4){var _0x3e14af=_0x13868d[_0x5981('0x2a')];var _0x2679fb=0xa;var _0x9af89=[_0x5981('0x52'),_0x5981('0x53'),'right_join','cross_join'];var _0x5c794e={'SUM':'SUM(%s)','COUNT':_0x5981('0x56'),'COUNT DISTINCT':_0x5981('0x57'),'MAX':_0x5981('0x84'),'MIN':_0x5981('0x58'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x5981('0x5a'),'GROUP_CONCAT ASC':_0x5981('0x85'),'GROUP_CONCAT DESC':_0x5981('0x86')};var _0x947e55={'SEC_TO_TIME':_0x5981('0x5b'),'DATE':'DATE(%s)','HOUR':_0x5981('0x5d'),'ROUND':_0x5981('0x87'),'UNIX_TIMESTAMP':_0x5981('0x5e')};var _0x2b74c9=function(_0x41a827){return!_[_0x5981('0x5f')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x5981('0x62'),'IS\x20NOT\x20EMPTY'],_0x41a827);};var _0x21bca1=function(_0x4409d6){if(!_0x4409d6||!_0x4409d6[_0x5981('0x63')]['length']){return'';}for(var _0x2fe3c4='(',_0x38c8d2=0x0;_0x38c8d2<_0x4409d6[_0x5981('0x63')]['length'];_0x38c8d2+=0x1){_0x38c8d2>0x0&&(_0x2fe3c4+='\x20'+_0x4409d6[_0x5981('0x88')]+'\x20');_0x2fe3c4+=_0x4409d6['rules'][_0x38c8d2]['group']?_0x21bca1(_0x4409d6[_0x5981('0x63')][_0x38c8d2][_0x5981('0x64')]):_0x4409d6['rules'][_0x38c8d2]['field']+'\x20'+_0x4409d6[_0x5981('0x63')][_0x38c8d2]['condition']+(_0x2b74c9(_0x4409d6[_0x5981('0x63')][_0x38c8d2]['condition'])?'\x20'+_0x4409d6[_0x5981('0x63')][_0x38c8d2][_0x5981('0x66')]:'');}return _0x2fe3c4+')';};var _0x381239={'where':{'id':_0x3e078f['id']}},_0x3c5437,_0x385560,_0x187a73,_0x1dc28a,_0x1a90e1;_0x381239=_['merge']({},_0x381239,_0x49f8c4);return db[_0x5981('0x2c')][_0x5981('0x48')](_0x381239)[_0x5981('0x23')](function(_0x3b92db){if(_0x3b92db){_0x3c5437=_0x3b92db;return _0x3b92db['getFields']();}return null;})[_0x5981('0x23')](function(_0x23b045){if(_0x23b045){if(!_0x23b045[_0x5981('0x36')]){throw new db[(_0x5981('0x89'))][(_0x5981('0x68'))](_0x5981('0x69'),0x193);}_0x385560=_0x23b045;return db['AnalyticMetric'][_0x5981('0x41')]({'raw':!![]});}return null;})[_0x5981('0x23')](function(_0x27fa1a){if(_0x27fa1a){_0x187a73=_[_0x5981('0x6b')](_0x27fa1a,'id');var _0x4fef0b;var _0x2fec4d=squel['select']();_0x2fec4d[_0x5981('0x8a')](_0x3c5437[_0x5981('0x6d')]);for(var _0x40c73b=0x0;_0x40c73b<_0x385560[_0x5981('0x36')];_0x40c73b+=0x1){_0x4fef0b=_0x385560[_0x40c73b]['MetricId']?_0x187a73[_0x385560[_0x40c73b][_0x5981('0x6e')]][_0x5981('0x6f')]:_0x385560[_0x40c73b][_0x5981('0x70')];_0x4fef0b=_0x385560[_0x40c73b][_0x5981('0x71')]?_['replace'](_0x5c794e[_0x385560[_0x40c73b][_0x5981('0x71')]],'%s',_0x4fef0b):_0x4fef0b;_0x4fef0b=_0x385560[_0x40c73b][_0x5981('0x7a')]?_[_0x5981('0x72')](_0x947e55[_0x385560[_0x40c73b]['format']],'%s',_0x4fef0b):_0x4fef0b;if(_0x385560[_0x40c73b][_0x5981('0x73')]){_0x2fec4d['group'](_0x4fef0b);}_0x385560[_0x40c73b][_0x5981('0x8b')]&&_0x2fec4d[_0x5981('0x74')](_0x4fef0b,_0x385560[_0x40c73b][_0x5981('0x8b')]===_0x5981('0x75')?![]:!![]);_0x2fec4d[_0x5981('0x70')](_0x4fef0b,_0x385560[_0x40c73b][_0x5981('0x76')]||_0x4fef0b);}if(_0x3c5437[_0x5981('0x77')]){_0x3c5437[_0x5981('0x77')]=JSON['parse'](_0x3c5437[_0x5981('0x77')]);for(var _0x2b0ee4=0x0;_0x2b0ee4<_0x3c5437[_0x5981('0x77')][_0x5981('0x36')];_0x2b0ee4+=0x1){if(_0x3c5437['joins'][_0x2b0ee4][_0x5981('0x2e')]&&_[_0x5981('0x5f')](_0x9af89,_0x3c5437[_0x5981('0x77')][_0x2b0ee4][_0x5981('0x2e')])&&_0x3c5437[_0x5981('0x77')][_0x2b0ee4][_0x5981('0x78')]&&_0x3c5437['joins'][_0x2b0ee4]['foreignTable']&&_0x3c5437['joins'][_0x2b0ee4][_0x5981('0x7c')]){_0x2fec4d[_0x3c5437[_0x5981('0x77')][_0x2b0ee4]['type']](_0x3c5437[_0x5981('0x77')][_0x2b0ee4][_0x5981('0x79')],null,util[_0x5981('0x7a')](_0x5981('0x7b'),_0x3c5437[_0x5981('0x6d')],_0x3c5437[_0x5981('0x77')][_0x2b0ee4][_0x5981('0x78')],_0x3c5437['joins'][_0x2b0ee4][_0x5981('0x79')],_0x3c5437['joins'][_0x2b0ee4][_0x5981('0x7c')]));}}}if(_0x3c5437['conditions']){_0x3c5437[_0x5981('0x7d')]=JSON[_0x5981('0x8c')](_0x3c5437['conditions']);_0x2fec4d[_0x5981('0x39')](_0x21bca1(_0x3c5437[_0x5981('0x7d')]['group']));}_0x1a90e1=_0x2fec4d[_0x5981('0x8d')]();_0x2fec4d[_0x5981('0x1f')](_0x2679fb);_0x2fec4d['offset'](0x0);return;}})[_0x5981('0x23')](function(){if(_0x13868d[_0x5981('0x8e')]===_0x5981('0x8f')){return null;}var _0x566eef=_[_0x5981('0x3c')](_0x13868d,{'name':_0x13868d[_0x5981('0x90')]||_0x13868d[_0x5981('0x2a')]||_0x3c5437[_0x5981('0x2a')],'basename':_0x3e14af,'savename':util[_0x5981('0x7a')]('%s-%s.%s',_0x13868d[_0x5981('0x2a')]||_0x3c5437[_0x5981('0x2a')],require('randomstring')[_0x5981('0x91')](0x4),_0x13868d['output']||_0x5981('0x92')),'reportId':_0x3c5437['id'],'reportType':_0x5981('0x93')});return db[_0x5981('0x94')]['create'](_0x566eef,{'raw':!![]});})['then'](function(_0x5b1754){if(_0x3c5437[_0x5981('0x6d')]===_0x5981('0x95')){_0x1a90e1[_0x5981('0x39')](_0x3c5437[_0x5981('0x6d')]+_0x5981('0x96'),_0x13868d['startDate'],_0x13868d[_0x5981('0x97')]);}else{_0x1a90e1[_0x5981('0x39')](_0x3c5437[_0x5981('0x6d')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x13868d[_0x5981('0x98')],_0x13868d[_0x5981('0x97')]);}if(_0x5b1754){logger[_0x5981('0x99')](_0x5981('0x9a'),_0x1a90e1['toString']());require(_0x5981('0x9b'))[_0x5981('0x9c')](path[_0x5981('0x52')](__dirname,'../../components/export/',_0x5b1754[_0x5981('0x8e')]),[_0x5b1754['id'],_0x1a90e1['toString'](),path['join'](__dirname,'../../files/reports',_0x5b1754[_0x5981('0x9d')]),_0x3e14af]);return _0x5b1754;}else{var _0x5b52d5=squel[_0x5981('0x6c')]();_0x5b52d5[_0x5981('0x8a')]('('+_0x1a90e1[_0x5981('0x80')]()+')','countTable');_0x5b52d5[_0x5981('0x70')](_0x5981('0x9e'),'count');_0x1a90e1[_0x5981('0x1f')](_0x13868d[_0x5981('0x1f')]||_0x2679fb);_0x1a90e1['offset'](_0x13868d['offset']||0x0);return dbH['sequelize'][_0x5981('0x32')](_0x5b52d5[_0x5981('0x80')](),{'type':dbH[_0x5981('0x81')]['QueryTypes'][_0x5981('0x83')]})[_0x5981('0x23')](function(_0x394df1){if(!_0x394df1['length']){_0x1dc28a=0x0;}else{_0x1dc28a=_0x394df1[0x0][_0x5981('0x1e')]||0x0;}return dbH[_0x5981('0x81')][_0x5981('0x32')](_0x1a90e1[_0x5981('0x80')](),{'type':dbH[_0x5981('0x81')][_0x5981('0x82')][_0x5981('0x83')]});})[_0x5981('0x23')](function(_0x6bc5aa){return{'rows':_0x6bc5aa||[],'count':_0x1dc28a};});}});}exports[_0x5981('0x9f')]=function(_0x42f864,_0x23f7cd){return runReport(_0x42f864['params'],_0x42f864[_0x5981('0x32')],_0x42f864[_0x5981('0x3e')])[_0x5981('0x23')](respondWithResult(_0x23f7cd,null))[_0x5981('0x43')](handleError(_0x23f7cd,null));};exports[_0x5981('0xa0')]=runReport;exports[_0x5981('0x32')]=function(_0x4a8ee3,_0xb182d6){var _0x912a5c=0xa;var _0x363a6b=[_0x5981('0x52'),_0x5981('0x53'),_0x5981('0x54'),_0x5981('0x55')];var _0x237889={'SUM':_0x5981('0xa1'),'COUNT':_0x5981('0x56'),'COUNT DISTINCT':_0x5981('0x57'),'MAX':_0x5981('0x84'),'MIN':_0x5981('0x58'),'AVG':_0x5981('0x59'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x5981('0x86')};var _0x34bd17={'SEC_TO_TIME':_0x5981('0x5b'),'DATE':'DATE(%s)','HOUR':_0x5981('0x5d'),'ROUND':_0x5981('0x87'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x4c8943=function(_0x5aeabd){return!_[_0x5981('0x5f')]([_0x5981('0x60'),_0x5981('0x61'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x5aeabd);};var _0x355e72=function(_0x5475c5){if(!_0x5475c5||!_0x5475c5[_0x5981('0x63')]['length']){return'';}for(var _0x401c49='(',_0x4a87f3=0x0;_0x4a87f3<_0x5475c5[_0x5981('0x63')][_0x5981('0x36')];_0x4a87f3+=0x1){_0x4a87f3>0x0&&(_0x401c49+='\x20'+_0x5475c5['operator']+'\x20');_0x401c49+=_0x5475c5[_0x5981('0x63')][_0x4a87f3][_0x5981('0x64')]?_0x355e72(_0x5475c5['rules'][_0x4a87f3][_0x5981('0x64')]):_0x5475c5[_0x5981('0x63')][_0x4a87f3][_0x5981('0x70')]+'\x20'+_0x5475c5[_0x5981('0x63')][_0x4a87f3]['condition']+(_0x4c8943(_0x5475c5[_0x5981('0x63')][_0x4a87f3][_0x5981('0x65')])?'\x20'+_0x5475c5['rules'][_0x4a87f3]['value']:'');}return _0x401c49+')';};var _0x59e3d1={'where':{'id':_0x4a8ee3[_0x5981('0x45')]['id']}},_0x5c5809,_0x47dce0,_0x19c89d,_0x58422e,_0xfeae9e;_0x59e3d1=_[_0x5981('0x3c')]({},_0x59e3d1,_0x4a8ee3['options']);return db[_0x5981('0x2c')][_0x5981('0x48')](_0x59e3d1)[_0x5981('0x23')](function(_0x244366){if(_0x244366){_0x5c5809=_0x244366;return _0x244366['getFields']();}return null;})[_0x5981('0x23')](function(_0x1382fd){if(_0x1382fd){if(!_0x1382fd[_0x5981('0x36')]){throw new db[(_0x5981('0x89'))][(_0x5981('0x68'))](_0x5981('0x69'),0x193);}_0x47dce0=_0x1382fd;return db[_0x5981('0x6a')][_0x5981('0x41')]({'raw':!![]});}return null;})[_0x5981('0x23')](function(_0x4ba069){if(_0x4ba069){_0x19c89d=_[_0x5981('0x6b')](_0x4ba069,'id');var _0x2c164c;var _0x12466e=squel['select']();_0x12466e[_0x5981('0x8a')](_0x5c5809['table']);for(var _0x2c079c=0x0;_0x2c079c<_0x47dce0[_0x5981('0x36')];_0x2c079c+=0x1){_0x2c164c=_0x47dce0[_0x2c079c][_0x5981('0x6e')]?_0x19c89d[_0x47dce0[_0x2c079c][_0x5981('0x6e')]][_0x5981('0x6f')]:_0x47dce0[_0x2c079c][_0x5981('0x70')];_0x2c164c=_0x47dce0[_0x2c079c]['function']?_['replace'](_0x237889[_0x47dce0[_0x2c079c][_0x5981('0x71')]],'%s',_0x2c164c):_0x2c164c;_0x2c164c=_0x47dce0[_0x2c079c]['format']?_[_0x5981('0x72')](_0x34bd17[_0x47dce0[_0x2c079c][_0x5981('0x7a')]],'%s',_0x2c164c):_0x2c164c;if(_0x47dce0[_0x2c079c][_0x5981('0x73')]){_0x12466e[_0x5981('0x64')](_0x2c164c);}_0x47dce0[_0x2c079c][_0x5981('0x8b')]&&_0x12466e[_0x5981('0x74')](_0x2c164c,_0x47dce0[_0x2c079c][_0x5981('0x8b')]===_0x5981('0x75')?![]:!![]);_0x12466e['field'](_0x2c164c,_0x47dce0[_0x2c079c]['alias']||_0x2c164c);}if(_0x5c5809[_0x5981('0x77')]){_0x5c5809['joins']=JSON[_0x5981('0x8c')](_0x5c5809['joins']);for(var _0x47e423=0x0;_0x47e423<_0x5c5809['joins'][_0x5981('0x36')];_0x47e423+=0x1){if(_0x5c5809[_0x5981('0x77')][_0x47e423][_0x5981('0x2e')]&&_[_0x5981('0x5f')](_0x363a6b,_0x5c5809[_0x5981('0x77')][_0x47e423][_0x5981('0x2e')])&&_0x5c5809[_0x5981('0x77')][_0x47e423][_0x5981('0x78')]&&_0x5c5809['joins'][_0x47e423][_0x5981('0x79')]&&_0x5c5809[_0x5981('0x77')][_0x47e423][_0x5981('0x7c')]){_0x12466e[_0x5c5809['joins'][_0x47e423][_0x5981('0x2e')]](_0x5c5809['joins'][_0x47e423][_0x5981('0x79')],null,util[_0x5981('0x7a')](_0x5981('0x7b'),_0x5c5809[_0x5981('0x6d')],_0x5c5809[_0x5981('0x77')][_0x47e423][_0x5981('0x78')],_0x5c5809['joins'][_0x47e423][_0x5981('0x79')],_0x5c5809['joins'][_0x47e423][_0x5981('0x7c')]));}}}if(_0x5c5809[_0x5981('0x7d')]){_0x5c5809[_0x5981('0x7d')]=JSON['parse'](_0x5c5809['conditions']);_0x12466e[_0x5981('0x39')](_0x355e72(_0x5c5809['conditions'][_0x5981('0x64')]));}_0xfeae9e=_0x12466e['clone']();_0x12466e[_0x5981('0x1f')](_0x912a5c);_0x12466e['offset'](0x0);logger['debug']('Limited\x20Query:',_0x12466e[_0x5981('0x80')]());return dbH[_0x5981('0x81')][_0x5981('0x32')](_0x12466e[_0x5981('0x80')](),{'type':dbH['sequelize'][_0x5981('0x82')]['SELECT']});}})[_0x5981('0x23')](function(){return{'sql':_0xfeae9e[_0x5981('0x80')]()};})[_0x5981('0x23')](respondWithResult(_0xb182d6,null))[_0x5981('0x43')](handleError(_0xb182d6,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index d05b6dd..8bb8ab7 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 _0x3284=['bluebird','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','api','moment'];(function(_0x29f4aa,_0x16db81){var _0x4d12ab=function(_0x346435){while(--_0x346435){_0x29f4aa['push'](_0x29f4aa['shift']());}};_0x4d12ab(++_0x16db81);}(_0x3284,0x87));var _0x4328=function(_0x4cb3ef,_0x4bcb7d){_0x4cb3ef=_0x4cb3ef-0x0;var _0x27702b=_0x3284[_0x4cb3ef];return _0x27702b;};'use strict';var _=require(_0x4328('0x0'));var util=require(_0x4328('0x1'));var logger=require(_0x4328('0x2'))(_0x4328('0x3'));var moment=require(_0x4328('0x4'));var BPromise=require(_0x4328('0x5'));var rp=require(_0x4328('0x6'));var fs=require('fs');var path=require(_0x4328('0x7'));var rimraf=require(_0x4328('0x8'));var config=require(_0x4328('0x9'));var attributes=require(_0x4328('0xa'));module['exports']=function(_0x59307e,_0x595a21){return _0x59307e[_0x4328('0xb')](_0x4328('0xc'),attributes,{'tableName':_0x4328('0xd'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x058e=['api','moment','path','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger'];(function(_0x2aaa8b,_0x164942){var _0x4c2c9c=function(_0x23e823){while(--_0x23e823){_0x2aaa8b['push'](_0x2aaa8b['shift']());}};_0x4c2c9c(++_0x164942);}(_0x058e,0x19f));var _0xe058=function(_0x2be5a4,_0x97d5a0){_0x2be5a4=_0x2be5a4-0x0;var _0x59a420=_0x058e[_0x2be5a4];return _0x59a420;};'use strict';var _=require(_0xe058('0x0'));var util=require(_0xe058('0x1'));var logger=require(_0xe058('0x2'))(_0xe058('0x3'));var moment=require(_0xe058('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe058('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe058('0x6'));module[_0xe058('0x7')]=function(_0x350bd1,_0x1d1183){return _0x350bd1[_0xe058('0x8')](_0xe058('0x9'),attributes,{'tableName':_0xe058('0xa'),'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 b683d95..0cbaa8b 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 _0x8117=['moment','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util'];(function(_0x3be02d,_0x160a99){var _0x3a6e0c=function(_0x59dd27){while(--_0x59dd27){_0x3be02d['push'](_0x3be02d['shift']());}};_0x3a6e0c(++_0x160a99);}(_0x8117,0xda));var _0x7811=function(_0xf1b51e,_0x389d79){_0xf1b51e=_0xf1b51e-0x0;var _0x3f836d=_0x8117[_0xf1b51e];return _0x3f836d;};'use strict';var _=require(_0x7811('0x0'));var util=require(_0x7811('0x1'));var moment=require(_0x7811('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7811('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7811('0x4'))(_0x7811('0x5'));var config=require(_0x7811('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x7811('0x7')][_0x7811('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x104b94,_0x3673d8,_0x57fded){return new BPromise(function(_0x59fc4c,_0x373706){return client['request'](_0x104b94,_0x57fded)[_0x7811('0x9')](function(_0x2aff0f){logger[_0x7811('0xa')](_0x7811('0xb'),_0x3673d8,_0x7811('0xc'));logger[_0x7811('0xd')](_0x7811('0xe'),_0x3673d8,'request\x20sent',JSON[_0x7811('0xf')](_0x2aff0f));if(_0x2aff0f[_0x7811('0x10')]){if(_0x2aff0f[_0x7811('0x10')][_0x7811('0x11')]===0x1f4){logger[_0x7811('0x10')]('AnalyticCustomReport,\x20%s,\x20%s',_0x3673d8,_0x2aff0f[_0x7811('0x10')]['message']);return _0x373706(_0x2aff0f['error'][_0x7811('0x12')]);}logger[_0x7811('0x10')]('AnalyticCustomReport,\x20%s,\x20%s',_0x3673d8,_0x2aff0f['error'][_0x7811('0x12')]);return _0x59fc4c(_0x2aff0f[_0x7811('0x10')][_0x7811('0x12')]);}else{logger[_0x7811('0xa')](_0x7811('0xb'),_0x3673d8,'request\x20sent');_0x59fc4c(_0x2aff0f[_0x7811('0x13')][_0x7811('0x12')]);}})['catch'](function(_0x2f0c4a){logger[_0x7811('0x10')](_0x7811('0xb'),_0x3673d8,_0x2f0c4a);_0x373706(_0x2f0c4a);});});} \ No newline at end of file +var _0xe8de=['util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash'];(function(_0x695b76,_0x551526){var _0x1dc21f=function(_0x5fdb1c){while(--_0x5fdb1c){_0x695b76['push'](_0x695b76['shift']());}};_0x1dc21f(++_0x551526);}(_0xe8de,0x107));var _0xee8d=function(_0x4d8712,_0x14a613){_0x4d8712=_0x4d8712-0x0;var _0x154fae=_0xe8de[_0x4d8712];return _0x154fae;};'use strict';var _=require(_0xee8d('0x0'));var util=require(_0xee8d('0x1'));var moment=require('moment');var BPromise=require(_0xee8d('0x2'));var rs=require(_0xee8d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xee8d('0x4'));var logger=require(_0xee8d('0x5'))(_0xee8d('0x6'));var config=require(_0xee8d('0x7'));var jayson=require(_0xee8d('0x8'));var client=jayson[_0xee8d('0x9')][_0xee8d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x226576,_0x2751ff,_0x13377b){return new BPromise(function(_0x287a73,_0x1031f9){return client[_0xee8d('0xb')](_0x226576,_0x13377b)[_0xee8d('0xc')](function(_0x4384ba){logger['info'](_0xee8d('0xd'),_0x2751ff,_0xee8d('0xe'));logger[_0xee8d('0xf')](_0xee8d('0x10'),_0x2751ff,_0xee8d('0xe'),JSON[_0xee8d('0x11')](_0x4384ba));if(_0x4384ba[_0xee8d('0x12')]){if(_0x4384ba[_0xee8d('0x12')][_0xee8d('0x13')]===0x1f4){logger[_0xee8d('0x12')]('AnalyticCustomReport,\x20%s,\x20%s',_0x2751ff,_0x4384ba['error'][_0xee8d('0x14')]);return _0x1031f9(_0x4384ba[_0xee8d('0x12')][_0xee8d('0x14')]);}logger[_0xee8d('0x12')](_0xee8d('0xd'),_0x2751ff,_0x4384ba[_0xee8d('0x12')]['message']);return _0x287a73(_0x4384ba['error'][_0xee8d('0x14')]);}else{logger[_0xee8d('0x15')]('AnalyticCustomReport,\x20%s,\x20%s',_0x2751ff,_0xee8d('0xe'));_0x287a73(_0x4384ba[_0xee8d('0x16')][_0xee8d('0x14')]);}})[_0xee8d('0x17')](function(_0x5d46fb){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x2751ff,_0x5d46fb);_0x1031f9(_0x5d46fb);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index f9d4a4e..5bdeb7b 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 _0xac1b=['isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','/:id/query','query','put','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get'];(function(_0x22d4ca,_0x3bc7af){var _0x35e2cb=function(_0x19d423){while(--_0x19d423){_0x22d4ca['push'](_0x22d4ca['shift']());}};_0x35e2cb(++_0x3bc7af);}(_0xac1b,0x146));var _0xbac1=function(_0x3042d1,_0x213e3e){_0x3042d1=_0x3042d1-0x0;var _0x3e22c5=_0xac1b[_0x3042d1];return _0x3e22c5;};'use strict';var multer=require(_0xbac1('0x0'));var util=require(_0xbac1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbac1('0x2'));var router=express[_0xbac1('0x3')]();var fs_extra=require(_0xbac1('0x4'));var auth=require(_0xbac1('0x5'));var interaction=require(_0xbac1('0x6'));var config=require(_0xbac1('0x7'));var controller=require(_0xbac1('0x8'));router[_0xbac1('0x9')]('/',auth[_0xbac1('0xa')](),controller[_0xbac1('0xb')]);router[_0xbac1('0x9')](_0xbac1('0xc'),auth[_0xbac1('0xa')](),controller[_0xbac1('0xd')]);router['get'](_0xbac1('0xe'),auth[_0xbac1('0xa')](),controller[_0xbac1('0xf')]);router[_0xbac1('0x9')](_0xbac1('0x10'),auth[_0xbac1('0xa')](),controller['run']);router['get'](_0xbac1('0x11'),auth[_0xbac1('0xa')](),controller[_0xbac1('0x12')]);router['post']('/',auth[_0xbac1('0xa')](),controller['create']);router[_0xbac1('0x13')](_0xbac1('0xc'),auth[_0xbac1('0xa')](),controller[_0xbac1('0x14')]);router[_0xbac1('0x15')]('/:id',auth[_0xbac1('0xa')](),controller[_0xbac1('0x16')]);module[_0xbac1('0x17')]=router; \ No newline at end of file +var _0xc62d=['util','path','connect-timeout','express','Router','fs-extra','./analyticCustomReport.controller','get','index','/:id','isAuthenticated','show','/:id/preview','/:id/run','/:id/query','query','create','put','update','delete','exports','multer'];(function(_0x36f37b,_0x36ea03){var _0x249634=function(_0x1cde21){while(--_0x1cde21){_0x36f37b['push'](_0x36f37b['shift']());}};_0x249634(++_0x36ea03);}(_0xc62d,0x175));var _0xdc62=function(_0x2b2c32,_0x330535){_0x2b2c32=_0x2b2c32-0x0;var _0x1e5f99=_0xc62d[_0x2b2c32];return _0x1e5f99;};'use strict';var multer=require(_0xdc62('0x0'));var util=require(_0xdc62('0x1'));var path=require(_0xdc62('0x2'));var timeout=require(_0xdc62('0x3'));var express=require(_0xdc62('0x4'));var router=express[_0xdc62('0x5')]();var fs_extra=require(_0xdc62('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xdc62('0x7'));router[_0xdc62('0x8')]('/',auth['isAuthenticated'](),controller[_0xdc62('0x9')]);router[_0xdc62('0x8')](_0xdc62('0xa'),auth[_0xdc62('0xb')](),controller[_0xdc62('0xc')]);router[_0xdc62('0x8')](_0xdc62('0xd'),auth[_0xdc62('0xb')](),controller['preview']);router[_0xdc62('0x8')](_0xdc62('0xe'),auth[_0xdc62('0xb')](),controller['run']);router[_0xdc62('0x8')](_0xdc62('0xf'),auth[_0xdc62('0xb')](),controller[_0xdc62('0x10')]);router['post']('/',auth[_0xdc62('0xb')](),controller[_0xdc62('0x11')]);router[_0xdc62('0x12')](_0xdc62('0xa'),auth[_0xdc62('0xb')](),controller[_0xdc62('0x13')]);router[_0xdc62('0x14')](_0xdc62('0xa'),auth[_0xdc62('0xb')](),controller['destroy']);module[_0xdc62('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 820783a..2a2b9ed 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 _0xabce=['exports','STRING','TEXT','sequelize'];(function(_0x102ac6,_0x54c4b5){var _0x155da=function(_0x26178a){while(--_0x26178a){_0x102ac6['push'](_0x102ac6['shift']());}};_0x155da(++_0x54c4b5);}(_0xabce,0x103));var _0xeabc=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xabce[_0x46aff0];return _0x9d78cf;};'use strict';var Sequelize=require(_0xeabc('0x0'));module[_0xeabc('0x1')]={'name':{'type':Sequelize[_0xeabc('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xeabc('0x2')]},'parent':{'type':Sequelize[_0xeabc('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xeabc('0x3')]}}; \ No newline at end of file +var _0x3f8a=['TEXT','sequelize','exports','STRING'];(function(_0x34dc84,_0x260330){var _0x574d42=function(_0xeb25eb){while(--_0xeb25eb){_0x34dc84['push'](_0x34dc84['shift']());}};_0x574d42(++_0x260330);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0xfe2e05,_0x21d317){_0xfe2e05=_0xfe2e05-0x0;var _0x322f62=_0x3f8a[_0xfe2e05];return _0x322f62;};'use strict';var Sequelize=require(_0xa3f8('0x0'));module[_0xa3f8('0x1')]={'name':{'type':Sequelize[_0xa3f8('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xa3f8('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0xa3f8('0x2')]},'conditions':{'type':Sequelize[_0xa3f8('0x3')]},'joins':{'type':Sequelize[_0xa3f8('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 6411be5..ebcb818 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 _0x7a54=['options','AnalyticDefaultReport','includeAll','include','show','keys','attributes','create','body','user','role','get','Reports','UserProfileSection','userProfileId','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','params','right_join','cross_join','SUM(%s)','COUNT(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','group','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','from','MetricId','metric','field','function','replace','format','orderBy','DESC','joins','parse','type','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','conditions','debug','toString','sequelize','QueryTypes','SELECT','join','left_join','COUNT(DISTINCT\x20%s)','MAX(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','IS\x20EMPTY','operator','groupBy','alias','output','web','fullPath','%s-%s.%s','generate','default','AnalyticExtractedReport','cdr','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','child_process','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','getFields','clone','Limited\x20Query:','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','dbH','sendStatus','status','end','json','limit','count','offset','Content-Range','apply','save','then','destroy','DefaultReports','error','stack','name','index','map','fieldName','model','query','filters','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge'];(function(_0x148b06,_0x375597){var _0x222dbf=function(_0x5e8b5d){while(--_0x5e8b5d){_0x148b06['push'](_0x148b06['shift']());}};_0x222dbf(++_0x375597);}(_0x7a54,0x106));var _0x47a5=function(_0x3d4afc,_0x389f9d){_0x3d4afc=_0x3d4afc-0x0;var _0x572d77=_0x7a54[_0x3d4afc];return _0x572d77;};'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'];var dbH=require(_0x47a5('0x15'))[_0x47a5('0x16')];function respondWithStatusCode(_0x5beb89,_0x44bd3e){_0x44bd3e=_0x44bd3e||0xcc;return function(_0x221b54){if(_0x221b54){return _0x5beb89[_0x47a5('0x17')](_0x44bd3e);}return _0x5beb89[_0x47a5('0x18')](_0x44bd3e)[_0x47a5('0x19')]();};}function respondWithResult(_0x620ee9,_0x3c6c46){_0x3c6c46=_0x3c6c46||0xc8;return function(_0x190faa){if(_0x190faa){return _0x620ee9['status'](_0x3c6c46)[_0x47a5('0x1a')](_0x190faa);}};}function respondWithFilteredResult(_0x11faf5,_0x3b001e){return function(_0x2a2cbb){if(_0x2a2cbb){var _0x1ef44c=typeof _0x3b001e['offset']==='undefined'&&typeof _0x3b001e[_0x47a5('0x1b')]==='undefined';var _0x5247fd=_0x2a2cbb[_0x47a5('0x1c')];var _0xaf70a6=_0x1ef44c?0x0:_0x3b001e[_0x47a5('0x1d')];var _0x1ef371=_0x1ef44c?_0x2a2cbb[_0x47a5('0x1c')]:_0x3b001e[_0x47a5('0x1d')]+_0x3b001e[_0x47a5('0x1b')];var _0xe3c618;if(_0x1ef371>=_0x5247fd){_0x1ef371=_0x5247fd;_0xe3c618=0xc8;}else{_0xe3c618=0xce;}_0x11faf5[_0x47a5('0x18')](_0xe3c618);return _0x11faf5['set'](_0x47a5('0x1e'),_0xaf70a6+'-'+_0x1ef371+'/'+_0x5247fd)[_0x47a5('0x1a')](_0x2a2cbb);}return null;};}function patchUpdates(_0x47cf3c){return function(_0x2b0360){try{jsonpatch[_0x47a5('0x1f')](_0x2b0360,_0x47cf3c,!![]);}catch(_0x36874d){return BPromise['reject'](_0x36874d);}return _0x2b0360[_0x47a5('0x20')]();};}function saveUpdates(_0x2f142b,_0x23db32){return function(_0x7a9f9e){if(_0x7a9f9e){return _0x7a9f9e['update'](_0x2f142b)[_0x47a5('0x21')](function(_0x385687){return _0x385687;});}return null;};}function removeEntity(_0x513981,_0x28747d){return function(_0xc4cd63){if(_0xc4cd63){return _0xc4cd63[_0x47a5('0x22')]()[_0x47a5('0x21')](function(){var _0x3abd6a=_0xc4cd63['get']({'plain':!![]});var _0x53078a=_0x47a5('0x23');return db['UserProfileResource'][_0x47a5('0x22')]({'where':{'type':_0x53078a,'resourceId':_0x3abd6a['id']}})['then'](function(){return _0xc4cd63;});})[_0x47a5('0x21')](function(){_0x513981[_0x47a5('0x18')](0xcc)[_0x47a5('0x19')]();});}};}function handleEntityNotFound(_0x1dac65,_0x21f296){return function(_0x3ba0b7){if(!_0x3ba0b7){_0x1dac65[_0x47a5('0x17')](0x194);}return _0x3ba0b7;};}function handleError(_0x136b14,_0x16631f){_0x16631f=_0x16631f||0x1f4;return function(_0x361bfa){logger[_0x47a5('0x24')](_0x361bfa[_0x47a5('0x25')]);if(_0x361bfa[_0x47a5('0x26')]){delete _0x361bfa['name'];}_0x136b14[_0x47a5('0x18')](_0x16631f)['send'](_0x361bfa);};}exports[_0x47a5('0x27')]=function(_0x9ac908,_0x16901f){var _0x4d6b57={},_0x256650={},_0x625952={'count':0x0,'rows':[]};var _0x39b50b=_[_0x47a5('0x28')](db['AnalyticDefaultReport']['rawAttributes'],function(_0x6f9a12){return{'name':_0x6f9a12[_0x47a5('0x29')],'type':_0x6f9a12['type']['key']};});_0x256650[_0x47a5('0x2a')]=_[_0x47a5('0x28')](_0x39b50b,'name');_0x256650[_0x47a5('0x2b')]=_['keys'](_0x9ac908[_0x47a5('0x2b')]);_0x256650[_0x47a5('0x2c')]=_['intersection'](_0x256650['model'],_0x256650[_0x47a5('0x2b')]);_0x4d6b57['attributes']=_[_0x47a5('0x2d')](_0x256650[_0x47a5('0x2a')],qs[_0x47a5('0x2e')](_0x9ac908['query'][_0x47a5('0x2e')]));_0x4d6b57['attributes']=_0x4d6b57['attributes'][_0x47a5('0x2f')]?_0x4d6b57['attributes']:_0x256650[_0x47a5('0x2a')];if(!_0x9ac908['query'][_0x47a5('0x30')](_0x47a5('0x31'))){_0x4d6b57[_0x47a5('0x1b')]=qs[_0x47a5('0x1b')](_0x9ac908[_0x47a5('0x2b')][_0x47a5('0x1b')]);_0x4d6b57[_0x47a5('0x1d')]=qs[_0x47a5('0x1d')](_0x9ac908[_0x47a5('0x2b')]['offset']);}_0x4d6b57[_0x47a5('0x32')]=qs[_0x47a5('0x33')](_0x9ac908['query'][_0x47a5('0x33')]);_0x4d6b57[_0x47a5('0x34')]=qs[_0x47a5('0x2c')](_['pick'](_0x9ac908[_0x47a5('0x2b')],_0x256650[_0x47a5('0x2c')]),_0x39b50b);if(_0x9ac908['query'][_0x47a5('0x35')]){_0x4d6b57[_0x47a5('0x34')]=_['merge'](_0x4d6b57['where'],{'$or':_['map'](_0x39b50b,function(_0x12d9f2){if(_0x12d9f2['type']!==_0x47a5('0x36')){var _0x1f9631={};_0x1f9631[_0x12d9f2[_0x47a5('0x26')]]={'$like':'%'+_0x9ac908[_0x47a5('0x2b')][_0x47a5('0x35')]+'%'};return _0x1f9631;}})});}_0x4d6b57=_[_0x47a5('0x37')]({},_0x4d6b57,_0x9ac908[_0x47a5('0x38')]);var _0x1f3d01={'where':_0x4d6b57[_0x47a5('0x34')]};return db[_0x47a5('0x39')][_0x47a5('0x1c')](_0x1f3d01)[_0x47a5('0x21')](function(_0x23d6d8){_0x625952['count']=_0x23d6d8;if(_0x9ac908[_0x47a5('0x2b')][_0x47a5('0x3a')]){_0x4d6b57[_0x47a5('0x3b')]=[{'all':!![]}];}return db[_0x47a5('0x39')]['findAll'](_0x4d6b57);})[_0x47a5('0x21')](function(_0x528ef3){_0x625952['rows']=_0x528ef3;return _0x625952;})['then'](respondWithFilteredResult(_0x16901f,_0x4d6b57))['catch'](handleError(_0x16901f,null));};exports[_0x47a5('0x3c')]=function(_0x5ec4e5,_0x2bb502){var _0x3a740b={'raw':!![],'where':{'id':_0x5ec4e5['params']['id']}},_0x448610={};_0x448610[_0x47a5('0x2a')]=_[_0x47a5('0x3d')](db['AnalyticDefaultReport']['rawAttributes']);_0x448610[_0x47a5('0x2b')]=_['keys'](_0x5ec4e5[_0x47a5('0x2b')]);_0x448610[_0x47a5('0x2c')]=_[_0x47a5('0x2d')](_0x448610[_0x47a5('0x2a')],_0x448610[_0x47a5('0x2b')]);_0x3a740b[_0x47a5('0x3e')]=_[_0x47a5('0x2d')](_0x448610[_0x47a5('0x2a')],qs[_0x47a5('0x2e')](_0x5ec4e5[_0x47a5('0x2b')][_0x47a5('0x2e')]));_0x3a740b[_0x47a5('0x3e')]=_0x3a740b[_0x47a5('0x3e')][_0x47a5('0x2f')]?_0x3a740b[_0x47a5('0x3e')]:_0x448610[_0x47a5('0x2a')];if(_0x5ec4e5['query'][_0x47a5('0x3a')]){_0x3a740b[_0x47a5('0x3b')]=[{'all':!![]}];}_0x3a740b=_['merge']({},_0x3a740b,_0x5ec4e5['options']);return db[_0x47a5('0x39')]['find'](_0x3a740b)[_0x47a5('0x21')](handleEntityNotFound(_0x2bb502,null))[_0x47a5('0x21')](respondWithResult(_0x2bb502,null))['catch'](handleError(_0x2bb502,null));};exports['create']=function(_0x3d85cc,_0x52d409){return db[_0x47a5('0x39')][_0x47a5('0x3f')](_0x3d85cc[_0x47a5('0x40')],{})[_0x47a5('0x21')](function(_0x44fe8a){var _0x26acd2=_0x3d85cc[_0x47a5('0x41')]['get']({'plain':!![]});if(!_0x26acd2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x26acd2[_0x47a5('0x42')]===_0x47a5('0x41')){var _0x1163e3=_0x44fe8a[_0x47a5('0x43')]({'plain':!![]});var _0x2c7020=_0x47a5('0x44');return db[_0x47a5('0x45')]['find']({'where':{'name':_0x2c7020,'userProfileId':_0x26acd2[_0x47a5('0x46')]},'raw':!![]})[_0x47a5('0x21')](function(_0x5f6a){if(_0x5f6a&&_0x5f6a['autoAssociation']===0x0){return db[_0x47a5('0x47')]['create']({'name':_0x1163e3[_0x47a5('0x26')],'resourceId':_0x1163e3['id'],'type':_0x47a5('0x23'),'sectionId':_0x5f6a['id']},{})[_0x47a5('0x21')](function(){return _0x44fe8a;});}else{return _0x44fe8a;}})[_0x47a5('0x48')](function(_0x588551){logger[_0x47a5('0x24')](_0x47a5('0x49'),_0x588551);throw _0x588551;});}return _0x44fe8a;})[_0x47a5('0x21')](respondWithResult(_0x52d409,0xc9))[_0x47a5('0x48')](handleError(_0x52d409,null));};exports[_0x47a5('0x4a')]=function(_0x6a53b3,_0x24e9f4){if(_0x6a53b3['body']['id']){delete _0x6a53b3[_0x47a5('0x40')]['id'];}return db[_0x47a5('0x39')][_0x47a5('0x4b')]({'where':{'id':_0x6a53b3[_0x47a5('0x4c')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x24e9f4,null))[_0x47a5('0x21')](saveUpdates(_0x6a53b3['body'],null))[_0x47a5('0x21')](respondWithResult(_0x24e9f4,null))[_0x47a5('0x48')](handleError(_0x24e9f4,null));};exports[_0x47a5('0x22')]=function(_0x53871e,_0x4c5ed){return db[_0x47a5('0x39')][_0x47a5('0x4b')]({'where':{'id':_0x53871e['params']['id']}})['then'](handleEntityNotFound(_0x4c5ed,null))[_0x47a5('0x21')](removeEntity(_0x4c5ed,null))[_0x47a5('0x48')](handleError(_0x4c5ed,null));};exports['preview']=function(_0x4cf792,_0x6d6b2b){var _0x4d6a82=0xa;var _0x16bb8a=['join','left_join',_0x47a5('0x4d'),_0x47a5('0x4e')];var _0x53eedf={'SUM':_0x47a5('0x4f'),'COUNT':_0x47a5('0x50'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x47a5('0x51'),'AVG':_0x47a5('0x52'),'GROUP_CONCAT':_0x47a5('0x53'),'GROUP_CONCAT ASC':_0x47a5('0x54'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x199621={'SEC_TO_TIME':_0x47a5('0x55'),'DATE':_0x47a5('0x56'),'HOUR':'HOUR(%s)','ROUND':_0x47a5('0x57'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x485e3c=function(_0x470da6){return!_[_0x47a5('0x58')]([_0x47a5('0x59'),_0x47a5('0x5a'),'IS\x20EMPTY',_0x47a5('0x5b')],_0x470da6);};var _0x5d1550=function(_0x5cbe97){if(!_0x5cbe97||!_0x5cbe97['rules']['length']){return'';}for(var _0x212d92='(',_0x6cd4ea=0x0;_0x6cd4ea<_0x5cbe97[_0x47a5('0x5c')]['length'];_0x6cd4ea+=0x1){_0x6cd4ea>0x0&&(_0x212d92+='\x20'+_0x5cbe97['operator']+'\x20');_0x212d92+=_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea][_0x47a5('0x5d')]?_0x5d1550(_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea][_0x47a5('0x5d')]):_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea]['field']+'\x20'+_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea]['condition']+(_0x485e3c(_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea][_0x47a5('0x5e')])?'\x20'+_0x5cbe97['rules'][_0x6cd4ea][_0x47a5('0x5f')]:'');}return _0x212d92+')';};var _0x345104={'where':{'id':_0x4cf792[_0x47a5('0x4c')]['id']}},_0x132854,_0x3e8274,_0x2d6494,_0x215634,_0x35cca8;_0x345104=_['merge']({},_0x345104,_0x4cf792[_0x47a5('0x38')]);return db[_0x47a5('0x39')][_0x47a5('0x4b')](_0x345104)[_0x47a5('0x21')](function(_0x396cb0){if(_0x396cb0){_0x132854=_0x396cb0;return _0x396cb0['getFields']();}return null;})[_0x47a5('0x21')](function(_0xdfcecc){if(_0xdfcecc){if(!_0xdfcecc[_0x47a5('0x2f')]){throw new db[(_0x47a5('0x60'))][(_0x47a5('0x61'))](_0x47a5('0x62'),0x193);}_0x3e8274=_0xdfcecc;return db[_0x47a5('0x63')][_0x47a5('0x64')]({'raw':!![]});}return null;})[_0x47a5('0x21')](function(_0x44cb90){if(_0x44cb90){_0x2d6494=_[_0x47a5('0x65')](_0x44cb90,'id');var _0x44fda9;var _0x3c0006=squel[_0x47a5('0x66')]();_0x3c0006[_0x47a5('0x67')](_0x132854['table']);for(var _0x42dd7d=0x0;_0x42dd7d<_0x3e8274[_0x47a5('0x2f')];_0x42dd7d+=0x1){_0x44fda9=_0x3e8274[_0x42dd7d][_0x47a5('0x68')]?_0x2d6494[_0x3e8274[_0x42dd7d]['MetricId']][_0x47a5('0x69')]:_0x3e8274[_0x42dd7d][_0x47a5('0x6a')];_0x44fda9=_0x3e8274[_0x42dd7d][_0x47a5('0x6b')]?_[_0x47a5('0x6c')](_0x53eedf[_0x3e8274[_0x42dd7d]['function']],'%s',_0x44fda9):_0x44fda9;_0x44fda9=_0x3e8274[_0x42dd7d][_0x47a5('0x6d')]?_['replace'](_0x199621[_0x3e8274[_0x42dd7d][_0x47a5('0x6d')]],'%s',_0x44fda9):_0x44fda9;if(_0x3e8274[_0x42dd7d]['groupBy']){_0x3c0006[_0x47a5('0x5d')](_0x44fda9);}_0x3e8274[_0x42dd7d]['orderBy']&&_0x3c0006[_0x47a5('0x32')](_0x44fda9,_0x3e8274[_0x42dd7d][_0x47a5('0x6e')]===_0x47a5('0x6f')?![]:!![]);_0x3c0006['field'](_0x44fda9,_0x3e8274[_0x42dd7d]['alias']||_0x44fda9);}if(_0x132854['joins']){_0x132854[_0x47a5('0x70')]=JSON[_0x47a5('0x71')](_0x132854[_0x47a5('0x70')]);for(var _0x117510=0x0;_0x117510<_0x132854['joins'][_0x47a5('0x2f')];_0x117510+=0x1){if(_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x72')]&&_[_0x47a5('0x58')](_0x16bb8a,_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x72')])&&_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x73')]&&_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x74')]&&_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x75')]){_0x3c0006[_0x132854['joins'][_0x117510][_0x47a5('0x72')]](_0x132854['joins'][_0x117510][_0x47a5('0x74')],null,util[_0x47a5('0x6d')](_0x47a5('0x76'),_0x132854[_0x47a5('0x77')],_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x73')],_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x74')],_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x75')]));}}}if(_0x132854[_0x47a5('0x78')]){_0x132854[_0x47a5('0x78')]=JSON[_0x47a5('0x71')](_0x132854[_0x47a5('0x78')]);_0x3c0006[_0x47a5('0x34')](_0x5d1550(_0x132854['conditions']['group']));}_0x35cca8=_0x3c0006['clone']();_0x3c0006['limit'](_0x4d6a82);_0x3c0006[_0x47a5('0x1d')](0x0);logger[_0x47a5('0x79')]('Limited\x20Query:',_0x3c0006[_0x47a5('0x7a')]());return dbH[_0x47a5('0x7b')][_0x47a5('0x2b')](_0x3c0006[_0x47a5('0x7a')](),{'type':dbH[_0x47a5('0x7b')][_0x47a5('0x7c')][_0x47a5('0x7d')]});}})[_0x47a5('0x21')](respondWithResult(_0x6d6b2b,null))[_0x47a5('0x48')](handleError(_0x6d6b2b,null));};function runReport(_0x1ffe3c,_0x24a6c1,_0x5e5f16){var _0x18fa31=_0x24a6c1[_0x47a5('0x26')];var _0x420671=0xa;var _0x4f35ff=[_0x47a5('0x7e'),_0x47a5('0x7f'),_0x47a5('0x4d'),'cross_join'];var _0x19dc8c={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x47a5('0x80'),'MAX':_0x47a5('0x81'),'MIN':_0x47a5('0x51'),'AVG':_0x47a5('0x52'),'GROUP_CONCAT':_0x47a5('0x53'),'GROUP_CONCAT ASC':_0x47a5('0x54'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x592322={'SEC_TO_TIME':_0x47a5('0x55'),'DATE':'DATE(%s)','HOUR':_0x47a5('0x82'),'ROUND':_0x47a5('0x57'),'UNIX_TIMESTAMP':_0x47a5('0x83')};var _0xb16bdd=function(_0x53ea2b){return!_[_0x47a5('0x58')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x47a5('0x84'),_0x47a5('0x5b')],_0x53ea2b);};var _0x5b91f7=function(_0x1926bd){if(!_0x1926bd||!_0x1926bd[_0x47a5('0x5c')][_0x47a5('0x2f')]){return'';}for(var _0x4c25ec='(',_0x280372=0x0;_0x280372<_0x1926bd['rules'][_0x47a5('0x2f')];_0x280372+=0x1){_0x280372>0x0&&(_0x4c25ec+='\x20'+_0x1926bd[_0x47a5('0x85')]+'\x20');_0x4c25ec+=_0x1926bd[_0x47a5('0x5c')][_0x280372]['group']?_0x5b91f7(_0x1926bd[_0x47a5('0x5c')][_0x280372][_0x47a5('0x5d')]):_0x1926bd[_0x47a5('0x5c')][_0x280372]['field']+'\x20'+_0x1926bd[_0x47a5('0x5c')][_0x280372]['condition']+(_0xb16bdd(_0x1926bd[_0x47a5('0x5c')][_0x280372]['condition'])?'\x20'+_0x1926bd[_0x47a5('0x5c')][_0x280372][_0x47a5('0x5f')]:'');}return _0x4c25ec+')';};var _0x20a742={'where':{'id':_0x1ffe3c['id']}},_0x211fbf,_0x51738b,_0x42fcce,_0x2ae130,_0x23c393;_0x20a742=_[_0x47a5('0x37')]({},_0x20a742,_0x5e5f16);return db[_0x47a5('0x39')]['find'](_0x20a742)['then'](function(_0x569550){if(_0x569550){_0x211fbf=_0x569550;return _0x569550['getFields']();}return null;})[_0x47a5('0x21')](function(_0xa8809a){if(_0xa8809a){if(!_0xa8809a[_0x47a5('0x2f')]){throw new db['Sequelize'][(_0x47a5('0x61'))](_0x47a5('0x62'),0x193);}_0x51738b=_0xa8809a;return db['AnalyticMetric'][_0x47a5('0x64')]({'raw':!![]});}return null;})[_0x47a5('0x21')](function(_0x19acfa){if(_0x19acfa){_0x42fcce=_[_0x47a5('0x65')](_0x19acfa,'id');var _0x58dacd;var _0x4b5353=squel[_0x47a5('0x66')]();_0x4b5353[_0x47a5('0x67')](_0x211fbf['table']);for(var _0x27d422=0x0;_0x27d422<_0x51738b[_0x47a5('0x2f')];_0x27d422+=0x1){_0x58dacd=_0x51738b[_0x27d422]['MetricId']?_0x42fcce[_0x51738b[_0x27d422][_0x47a5('0x68')]][_0x47a5('0x69')]:_0x51738b[_0x27d422][_0x47a5('0x6a')];_0x58dacd=_0x51738b[_0x27d422]['function']?_[_0x47a5('0x6c')](_0x19dc8c[_0x51738b[_0x27d422]['function']],'%s',_0x58dacd):_0x58dacd;_0x58dacd=_0x51738b[_0x27d422][_0x47a5('0x6d')]?_['replace'](_0x592322[_0x51738b[_0x27d422][_0x47a5('0x6d')]],'%s',_0x58dacd):_0x58dacd;if(_0x51738b[_0x27d422][_0x47a5('0x86')]){_0x4b5353['group'](_0x58dacd);}_0x51738b[_0x27d422][_0x47a5('0x6e')]&&_0x4b5353['order'](_0x58dacd,_0x51738b[_0x27d422][_0x47a5('0x6e')]===_0x47a5('0x6f')?![]:!![]);_0x4b5353[_0x47a5('0x6a')](_0x58dacd,_0x51738b[_0x27d422][_0x47a5('0x87')]||_0x58dacd);}if(_0x211fbf['joins']){_0x211fbf[_0x47a5('0x70')]=JSON['parse'](_0x211fbf['joins']);for(var _0x2bb2df=0x0;_0x2bb2df<_0x211fbf[_0x47a5('0x70')][_0x47a5('0x2f')];_0x2bb2df+=0x1){if(_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x72')]&&_['includes'](_0x4f35ff,_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x72')])&&_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x73')]&&_0x211fbf['joins'][_0x2bb2df][_0x47a5('0x74')]&&_0x211fbf['joins'][_0x2bb2df][_0x47a5('0x75')]){_0x4b5353[_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x72')]](_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x74')],null,util[_0x47a5('0x6d')](_0x47a5('0x76'),_0x211fbf[_0x47a5('0x77')],_0x211fbf[_0x47a5('0x70')][_0x2bb2df]['parentKey'],_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x74')],_0x211fbf['joins'][_0x2bb2df][_0x47a5('0x75')]));}}}if(_0x211fbf[_0x47a5('0x78')]){_0x211fbf[_0x47a5('0x78')]=JSON['parse'](_0x211fbf['conditions']);_0x4b5353[_0x47a5('0x34')](_0x5b91f7(_0x211fbf[_0x47a5('0x78')]['group']));}_0x23c393=_0x4b5353['clone']();_0x4b5353[_0x47a5('0x1b')](_0x420671);_0x4b5353[_0x47a5('0x1d')](0x0);return;}})['then'](function(){if(_0x24a6c1[_0x47a5('0x88')]===_0x47a5('0x89')){return null;}var _0x4c9e6a=_[_0x47a5('0x37')](_0x24a6c1,{'name':_0x24a6c1[_0x47a5('0x8a')]||_0x24a6c1[_0x47a5('0x26')]||_0x211fbf[_0x47a5('0x26')],'basename':_0x18fa31,'savename':util[_0x47a5('0x6d')](_0x47a5('0x8b'),_0x24a6c1['name']||_0x211fbf['name'],require('randomstring')[_0x47a5('0x8c')](0x4),_0x24a6c1[_0x47a5('0x88')]||'csv'),'reportId':_0x211fbf['id'],'reportType':_0x47a5('0x8d')});return db[_0x47a5('0x8e')][_0x47a5('0x3f')](_0x4c9e6a,{'raw':!![]});})[_0x47a5('0x21')](function(_0xcdbfd7){if(_0x211fbf['table']===_0x47a5('0x8f')){_0x23c393['where'](_0x211fbf['table']+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x24a6c1[_0x47a5('0x90')],_0x24a6c1['endDate']);}else{_0x23c393[_0x47a5('0x34')](_0x211fbf[_0x47a5('0x77')]+_0x47a5('0x91'),_0x24a6c1['startDate'],_0x24a6c1[_0x47a5('0x92')]);}if(_0xcdbfd7){logger[_0x47a5('0x93')](_0x47a5('0x94'),_0x23c393[_0x47a5('0x7a')]());require(_0x47a5('0x95'))['fork'](path[_0x47a5('0x7e')](__dirname,_0x47a5('0x96'),_0xcdbfd7['output']),[_0xcdbfd7['id'],_0x23c393[_0x47a5('0x7a')](),path[_0x47a5('0x7e')](__dirname,_0x47a5('0x97'),_0xcdbfd7[_0x47a5('0x98')]),_0x18fa31]);return _0xcdbfd7;}else{var _0x3c117a=squel[_0x47a5('0x66')]();_0x3c117a['from']('('+_0x23c393[_0x47a5('0x7a')]()+')',_0x47a5('0x99'));_0x3c117a['field'](_0x47a5('0x9a'),_0x47a5('0x1c'));_0x23c393[_0x47a5('0x1b')](_0x24a6c1[_0x47a5('0x1b')]||_0x420671);_0x23c393['offset'](_0x24a6c1['offset']||0x0);return dbH['sequelize']['query'](_0x3c117a[_0x47a5('0x7a')](),{'type':dbH[_0x47a5('0x7b')][_0x47a5('0x7c')][_0x47a5('0x7d')]})[_0x47a5('0x21')](function(_0x6bc37b){if(!_0x6bc37b[_0x47a5('0x2f')]){_0x2ae130=0x0;}else{_0x2ae130=_0x6bc37b[0x0][_0x47a5('0x1c')]||0x0;}return dbH['sequelize'][_0x47a5('0x2b')](_0x23c393[_0x47a5('0x7a')](),{'type':dbH[_0x47a5('0x7b')][_0x47a5('0x7c')]['SELECT']});})['then'](function(_0x3770ae){return{'rows':_0x3770ae||[],'count':_0x2ae130};});}});}exports['run']=function(_0x4cb8e4,_0x1b6a5c){return runReport(_0x4cb8e4[_0x47a5('0x4c')],_0x4cb8e4['query'],_0x4cb8e4[_0x47a5('0x38')])[_0x47a5('0x21')](respondWithResult(_0x1b6a5c,null))[_0x47a5('0x48')](handleError(_0x1b6a5c,null));};exports['runReport']=runReport;exports[_0x47a5('0x2b')]=function(_0xee23c7,_0x48a491){var _0x1172fd=0xa;var _0x280b7b=[_0x47a5('0x7e'),_0x47a5('0x7f'),_0x47a5('0x4d'),_0x47a5('0x4e')];var _0x482c87={'SUM':_0x47a5('0x4f'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x47a5('0x80'),'MAX':_0x47a5('0x81'),'MIN':_0x47a5('0x51'),'AVG':_0x47a5('0x52'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x47a5('0x54'),'GROUP_CONCAT DESC':_0x47a5('0x9b')};var _0x151540={'SEC_TO_TIME':_0x47a5('0x55'),'DATE':_0x47a5('0x56'),'HOUR':_0x47a5('0x82'),'ROUND':_0x47a5('0x57'),'UNIX_TIMESTAMP':_0x47a5('0x83')};var _0x1b3e82=function(_0xa2045c){return!_[_0x47a5('0x58')]([_0x47a5('0x59'),'IS\x20NOT\x20NULL',_0x47a5('0x84'),_0x47a5('0x5b')],_0xa2045c);};var _0x591bde=function(_0x55d955){if(!_0x55d955||!_0x55d955[_0x47a5('0x5c')][_0x47a5('0x2f')]){return'';}for(var _0x2ccf21='(',_0x2ff467=0x0;_0x2ff467<_0x55d955['rules'][_0x47a5('0x2f')];_0x2ff467+=0x1){_0x2ff467>0x0&&(_0x2ccf21+='\x20'+_0x55d955[_0x47a5('0x85')]+'\x20');_0x2ccf21+=_0x55d955[_0x47a5('0x5c')][_0x2ff467][_0x47a5('0x5d')]?_0x591bde(_0x55d955[_0x47a5('0x5c')][_0x2ff467][_0x47a5('0x5d')]):_0x55d955[_0x47a5('0x5c')][_0x2ff467]['field']+'\x20'+_0x55d955['rules'][_0x2ff467][_0x47a5('0x5e')]+(_0x1b3e82(_0x55d955['rules'][_0x2ff467][_0x47a5('0x5e')])?'\x20'+_0x55d955['rules'][_0x2ff467][_0x47a5('0x5f')]:'');}return _0x2ccf21+')';};var _0x8b4354={'where':{'id':_0xee23c7[_0x47a5('0x4c')]['id']}},_0x134c1a,_0x2bc7ae,_0x49cb8c,_0x220557,_0x11f07b;_0x8b4354=_['merge']({},_0x8b4354,_0xee23c7['options']);return db[_0x47a5('0x39')][_0x47a5('0x4b')](_0x8b4354)[_0x47a5('0x21')](function(_0xfccf9c){if(_0xfccf9c){_0x134c1a=_0xfccf9c;return _0xfccf9c[_0x47a5('0x9c')]();}return null;})[_0x47a5('0x21')](function(_0x1c0323){if(_0x1c0323){if(!_0x1c0323[_0x47a5('0x2f')]){throw new db['Sequelize'][(_0x47a5('0x61'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2bc7ae=_0x1c0323;return db[_0x47a5('0x63')][_0x47a5('0x64')]({'raw':!![]});}return null;})['then'](function(_0x48d4cf){if(_0x48d4cf){_0x49cb8c=_[_0x47a5('0x65')](_0x48d4cf,'id');var _0x41d2da;var _0x530387=squel[_0x47a5('0x66')]();_0x530387[_0x47a5('0x67')](_0x134c1a[_0x47a5('0x77')]);for(var _0x44567e=0x0;_0x44567e<_0x2bc7ae['length'];_0x44567e+=0x1){_0x41d2da=_0x2bc7ae[_0x44567e][_0x47a5('0x68')]?_0x49cb8c[_0x2bc7ae[_0x44567e]['MetricId']]['metric']:_0x2bc7ae[_0x44567e]['field'];_0x41d2da=_0x2bc7ae[_0x44567e][_0x47a5('0x6b')]?_['replace'](_0x482c87[_0x2bc7ae[_0x44567e][_0x47a5('0x6b')]],'%s',_0x41d2da):_0x41d2da;_0x41d2da=_0x2bc7ae[_0x44567e][_0x47a5('0x6d')]?_[_0x47a5('0x6c')](_0x151540[_0x2bc7ae[_0x44567e][_0x47a5('0x6d')]],'%s',_0x41d2da):_0x41d2da;if(_0x2bc7ae[_0x44567e][_0x47a5('0x86')]){_0x530387[_0x47a5('0x5d')](_0x41d2da);}_0x2bc7ae[_0x44567e][_0x47a5('0x6e')]&&_0x530387[_0x47a5('0x32')](_0x41d2da,_0x2bc7ae[_0x44567e][_0x47a5('0x6e')]===_0x47a5('0x6f')?![]:!![]);_0x530387[_0x47a5('0x6a')](_0x41d2da,_0x2bc7ae[_0x44567e][_0x47a5('0x87')]||_0x41d2da);}if(_0x134c1a[_0x47a5('0x70')]){_0x134c1a[_0x47a5('0x70')]=JSON[_0x47a5('0x71')](_0x134c1a['joins']);for(var _0xdd95c8=0x0;_0xdd95c8<_0x134c1a[_0x47a5('0x70')][_0x47a5('0x2f')];_0xdd95c8+=0x1){if(_0x134c1a[_0x47a5('0x70')][_0xdd95c8]['type']&&_[_0x47a5('0x58')](_0x280b7b,_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x72')])&&_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x73')]&&_0x134c1a[_0x47a5('0x70')][_0xdd95c8][_0x47a5('0x74')]&&_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x75')]){_0x530387[_0x134c1a[_0x47a5('0x70')][_0xdd95c8][_0x47a5('0x72')]](_0x134c1a['joins'][_0xdd95c8]['foreignTable'],null,util[_0x47a5('0x6d')](_0x47a5('0x76'),_0x134c1a[_0x47a5('0x77')],_0x134c1a[_0x47a5('0x70')][_0xdd95c8][_0x47a5('0x73')],_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x74')],_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x75')]));}}}if(_0x134c1a[_0x47a5('0x78')]){_0x134c1a[_0x47a5('0x78')]=JSON[_0x47a5('0x71')](_0x134c1a['conditions']);_0x530387['where'](_0x591bde(_0x134c1a[_0x47a5('0x78')][_0x47a5('0x5d')]));}_0x11f07b=_0x530387[_0x47a5('0x9d')]();_0x530387[_0x47a5('0x1b')](_0x1172fd);_0x530387[_0x47a5('0x1d')](0x0);logger[_0x47a5('0x79')](_0x47a5('0x9e'),_0x530387[_0x47a5('0x7a')]());return dbH[_0x47a5('0x7b')]['query'](_0x530387['toString'](),{'type':dbH[_0x47a5('0x7b')]['QueryTypes'][_0x47a5('0x7d')]});}})[_0x47a5('0x21')](function(){return{'sql':_0x11f07b[_0x47a5('0x7a')]()};})['then'](respondWithResult(_0x48a491,null))[_0x47a5('0x48')](handleError(_0x48a491,null));}; \ No newline at end of file +var _0x1cb9=['runReport','left_join','SEC_TO_TIME(%s)','IS\x20NULL','clone','debug','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','limit','undefined','count','status','set','apply','reject','then','destroy','get','UserProfileResource','stack','name','send','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','catch','body','user','role','autoAssociation','create','DefaultReports','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','orderBy','order','DESC','joins','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','COUNT(%s)','GROUP_CONCAT(%s)','HOUR(%s)','value','groupBy','alias','output','fullPath','%s-%s.%s','randomstring','generate','csv','default','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)'];(function(_0x1fb61a,_0x37dee1){var _0x429a35=function(_0x4334e5){while(--_0x4334e5){_0x1fb61a['push'](_0x1fb61a['shift']());}};_0x429a35(++_0x37dee1);}(_0x1cb9,0x14e));var _0x91cb=function(_0x26dd58,_0x5d42b2){_0x26dd58=_0x26dd58-0x0;var _0x196dc9=_0x1cb9[_0x26dd58];return _0x196dc9;};'use strict';var emlformat=require(_0x91cb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x91cb('0x1'));var jsonpatch=require(_0x91cb('0x2'));var rp=require(_0x91cb('0x3'));var moment=require(_0x91cb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x91cb('0x5'));var util=require(_0x91cb('0x6'));var path=require('path');var sox=require(_0x91cb('0x7'));var csv=require(_0x91cb('0x8'));var ejs=require(_0x91cb('0x9'));var fs=require('fs');var fs_extra=require(_0x91cb('0xa'));var _=require(_0x91cb('0xb'));var squel=require(_0x91cb('0xc'));var crypto=require('crypto');var jsforce=require(_0x91cb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x91cb('0x8'));var querystring=require('querystring');var Papa=require(_0x91cb('0xe'));var Redis=require(_0x91cb('0xf'));var authService=require(_0x91cb('0x10'));var qs=require(_0x91cb('0x11'));var as=require(_0x91cb('0x12'));var hardwareService=require(_0x91cb('0x13'));var logger=require(_0x91cb('0x14'))(_0x91cb('0x15'));var utils=require(_0x91cb('0x16'));var config=require(_0x91cb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x91cb('0x18'))['db'];var dbH=require(_0x91cb('0x18'))['dbH'];function respondWithStatusCode(_0x20e6e0,_0x3ea707){_0x3ea707=_0x3ea707||0xcc;return function(_0x44f2e9){if(_0x44f2e9){return _0x20e6e0[_0x91cb('0x19')](_0x3ea707);}return _0x20e6e0['status'](_0x3ea707)['end']();};}function respondWithResult(_0x4aae25,_0x3d22b7){_0x3d22b7=_0x3d22b7||0xc8;return function(_0x585470){if(_0x585470){return _0x4aae25['status'](_0x3d22b7)[_0x91cb('0x1a')](_0x585470);}};}function respondWithFilteredResult(_0xc3629e,_0x347980){return function(_0x5ea796){if(_0x5ea796){var _0x238f11=typeof _0x347980[_0x91cb('0x1b')]==='undefined'&&typeof _0x347980[_0x91cb('0x1c')]===_0x91cb('0x1d');var _0x1cd34b=_0x5ea796[_0x91cb('0x1e')];var _0x5cc1c3=_0x238f11?0x0:_0x347980[_0x91cb('0x1b')];var _0x7dcf60=_0x238f11?_0x5ea796['count']:_0x347980[_0x91cb('0x1b')]+_0x347980['limit'];var _0x55042a;if(_0x7dcf60>=_0x1cd34b){_0x7dcf60=_0x1cd34b;_0x55042a=0xc8;}else{_0x55042a=0xce;}_0xc3629e[_0x91cb('0x1f')](_0x55042a);return _0xc3629e[_0x91cb('0x20')]('Content-Range',_0x5cc1c3+'-'+_0x7dcf60+'/'+_0x1cd34b)['json'](_0x5ea796);}return null;};}function patchUpdates(_0x5b385a){return function(_0x438162){try{jsonpatch[_0x91cb('0x21')](_0x438162,_0x5b385a,!![]);}catch(_0x20aff5){return BPromise[_0x91cb('0x22')](_0x20aff5);}return _0x438162['save']();};}function saveUpdates(_0x45c4b3,_0x43881c){return function(_0x1fa837){if(_0x1fa837){return _0x1fa837['update'](_0x45c4b3)[_0x91cb('0x23')](function(_0x1a7a54){return _0x1a7a54;});}return null;};}function removeEntity(_0x2447e7,_0x422d14){return function(_0x3ca500){if(_0x3ca500){return _0x3ca500[_0x91cb('0x24')]()[_0x91cb('0x23')](function(){var _0x423c4f=_0x3ca500[_0x91cb('0x25')]({'plain':!![]});var _0x4c8438='DefaultReports';return db[_0x91cb('0x26')]['destroy']({'where':{'type':_0x4c8438,'resourceId':_0x423c4f['id']}})[_0x91cb('0x23')](function(){return _0x3ca500;});})[_0x91cb('0x23')](function(){_0x2447e7[_0x91cb('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9b26a6,_0x4f5a7b){return function(_0x4572f6){if(!_0x4572f6){_0x9b26a6[_0x91cb('0x19')](0x194);}return _0x4572f6;};}function handleError(_0x3b3ee6,_0x2fb473){_0x2fb473=_0x2fb473||0x1f4;return function(_0x468908){logger['error'](_0x468908[_0x91cb('0x27')]);if(_0x468908['name']){delete _0x468908[_0x91cb('0x28')];}_0x3b3ee6[_0x91cb('0x1f')](_0x2fb473)[_0x91cb('0x29')](_0x468908);};}exports['index']=function(_0x775c25,_0x146e1f){var _0x25bbf9={},_0x361e4c={},_0xf296bc={'count':0x0,'rows':[]};var _0x3dab18=_[_0x91cb('0x2a')](db[_0x91cb('0x2b')][_0x91cb('0x2c')],function(_0x5e6ed3){return{'name':_0x5e6ed3[_0x91cb('0x2d')],'type':_0x5e6ed3[_0x91cb('0x2e')][_0x91cb('0x2f')]};});_0x361e4c[_0x91cb('0x30')]=_[_0x91cb('0x2a')](_0x3dab18,'name');_0x361e4c[_0x91cb('0x31')]=_[_0x91cb('0x32')](_0x775c25[_0x91cb('0x31')]);_0x361e4c[_0x91cb('0x33')]=_[_0x91cb('0x34')](_0x361e4c['model'],_0x361e4c[_0x91cb('0x31')]);_0x25bbf9['attributes']=_['intersection'](_0x361e4c['model'],qs[_0x91cb('0x35')](_0x775c25['query'][_0x91cb('0x35')]));_0x25bbf9['attributes']=_0x25bbf9['attributes'][_0x91cb('0x36')]?_0x25bbf9[_0x91cb('0x37')]:_0x361e4c[_0x91cb('0x30')];if(!_0x775c25[_0x91cb('0x31')][_0x91cb('0x38')]('nolimit')){_0x25bbf9[_0x91cb('0x1c')]=qs[_0x91cb('0x1c')](_0x775c25[_0x91cb('0x31')][_0x91cb('0x1c')]);_0x25bbf9['offset']=qs['offset'](_0x775c25[_0x91cb('0x31')][_0x91cb('0x1b')]);}_0x25bbf9['order']=qs[_0x91cb('0x39')](_0x775c25[_0x91cb('0x31')]['sort']);_0x25bbf9[_0x91cb('0x3a')]=qs[_0x91cb('0x33')](_['pick'](_0x775c25[_0x91cb('0x31')],_0x361e4c['filters']),_0x3dab18);if(_0x775c25[_0x91cb('0x31')][_0x91cb('0x3b')]){_0x25bbf9[_0x91cb('0x3a')]=_[_0x91cb('0x3c')](_0x25bbf9[_0x91cb('0x3a')],{'$or':_[_0x91cb('0x2a')](_0x3dab18,function(_0x5d0e37){if(_0x5d0e37[_0x91cb('0x2e')]!==_0x91cb('0x3d')){var _0x4e5b4b={};_0x4e5b4b[_0x5d0e37[_0x91cb('0x28')]]={'$like':'%'+_0x775c25['query'][_0x91cb('0x3b')]+'%'};return _0x4e5b4b;}})});}_0x25bbf9=_[_0x91cb('0x3c')]({},_0x25bbf9,_0x775c25[_0x91cb('0x3e')]);var _0x174794={'where':_0x25bbf9['where']};return db[_0x91cb('0x2b')][_0x91cb('0x1e')](_0x174794)[_0x91cb('0x23')](function(_0x37e777){_0xf296bc[_0x91cb('0x1e')]=_0x37e777;if(_0x775c25[_0x91cb('0x31')][_0x91cb('0x3f')]){_0x25bbf9[_0x91cb('0x40')]=[{'all':!![]}];}return db[_0x91cb('0x2b')][_0x91cb('0x41')](_0x25bbf9);})['then'](function(_0x16993f){_0xf296bc['rows']=_0x16993f;return _0xf296bc;})[_0x91cb('0x23')](respondWithFilteredResult(_0x146e1f,_0x25bbf9))['catch'](handleError(_0x146e1f,null));};exports[_0x91cb('0x42')]=function(_0x52e82c,_0x138f48){var _0x477131={'raw':!![],'where':{'id':_0x52e82c[_0x91cb('0x43')]['id']}},_0xba99ce={};_0xba99ce['model']=_[_0x91cb('0x32')](db[_0x91cb('0x2b')]['rawAttributes']);_0xba99ce[_0x91cb('0x31')]=_[_0x91cb('0x32')](_0x52e82c[_0x91cb('0x31')]);_0xba99ce[_0x91cb('0x33')]=_[_0x91cb('0x34')](_0xba99ce[_0x91cb('0x30')],_0xba99ce[_0x91cb('0x31')]);_0x477131[_0x91cb('0x37')]=_[_0x91cb('0x34')](_0xba99ce['model'],qs[_0x91cb('0x35')](_0x52e82c[_0x91cb('0x31')][_0x91cb('0x35')]));_0x477131[_0x91cb('0x37')]=_0x477131[_0x91cb('0x37')][_0x91cb('0x36')]?_0x477131[_0x91cb('0x37')]:_0xba99ce[_0x91cb('0x30')];if(_0x52e82c['query'][_0x91cb('0x3f')]){_0x477131[_0x91cb('0x40')]=[{'all':!![]}];}_0x477131=_[_0x91cb('0x3c')]({},_0x477131,_0x52e82c[_0x91cb('0x3e')]);return db['AnalyticDefaultReport'][_0x91cb('0x44')](_0x477131)[_0x91cb('0x23')](handleEntityNotFound(_0x138f48,null))['then'](respondWithResult(_0x138f48,null))[_0x91cb('0x45')](handleError(_0x138f48,null));};exports['create']=function(_0x2c419b,_0x4c0acd){return db['AnalyticDefaultReport']['create'](_0x2c419b[_0x91cb('0x46')],{})[_0x91cb('0x23')](function(_0x3d62c4){var _0x2f8384=_0x2c419b[_0x91cb('0x47')]['get']({'plain':!![]});if(!_0x2f8384)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2f8384[_0x91cb('0x48')]===_0x91cb('0x47')){var _0x140994=_0x3d62c4[_0x91cb('0x25')]({'plain':!![]});var _0x57adff='Reports';return db['UserProfileSection'][_0x91cb('0x44')]({'where':{'name':_0x57adff,'userProfileId':_0x2f8384['userProfileId']},'raw':!![]})[_0x91cb('0x23')](function(_0x4aa670){if(_0x4aa670&&_0x4aa670[_0x91cb('0x49')]===0x0){return db[_0x91cb('0x26')][_0x91cb('0x4a')]({'name':_0x140994[_0x91cb('0x28')],'resourceId':_0x140994['id'],'type':_0x91cb('0x4b'),'sectionId':_0x4aa670['id']},{})[_0x91cb('0x23')](function(){return _0x3d62c4;});}else{return _0x3d62c4;}})[_0x91cb('0x45')](function(_0x30fd4e){logger[_0x91cb('0x4c')](_0x91cb('0x4d'),_0x30fd4e);throw _0x30fd4e;});}return _0x3d62c4;})[_0x91cb('0x23')](respondWithResult(_0x4c0acd,0xc9))['catch'](handleError(_0x4c0acd,null));};exports[_0x91cb('0x4e')]=function(_0x1fa45a,_0x4d7a34){if(_0x1fa45a[_0x91cb('0x46')]['id']){delete _0x1fa45a[_0x91cb('0x46')]['id'];}return db['AnalyticDefaultReport'][_0x91cb('0x44')]({'where':{'id':_0x1fa45a[_0x91cb('0x43')]['id']}})[_0x91cb('0x23')](handleEntityNotFound(_0x4d7a34,null))[_0x91cb('0x23')](saveUpdates(_0x1fa45a[_0x91cb('0x46')],null))[_0x91cb('0x23')](respondWithResult(_0x4d7a34,null))[_0x91cb('0x45')](handleError(_0x4d7a34,null));};exports[_0x91cb('0x24')]=function(_0x3320bd,_0x93ef52){return db[_0x91cb('0x2b')]['find']({'where':{'id':_0x3320bd[_0x91cb('0x43')]['id']}})['then'](handleEntityNotFound(_0x93ef52,null))[_0x91cb('0x23')](removeEntity(_0x93ef52,null))['catch'](handleError(_0x93ef52,null));};exports[_0x91cb('0x4f')]=function(_0x1b2fec,_0x1986d7){var _0x47a6cd=0xa;var _0xe49d42=[_0x91cb('0x50'),'left_join',_0x91cb('0x51'),_0x91cb('0x52')];var _0x365afd={'SUM':_0x91cb('0x53'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x91cb('0x54'),'MAX':_0x91cb('0x55'),'MIN':_0x91cb('0x56'),'AVG':_0x91cb('0x57'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x91cb('0x58'),'GROUP_CONCAT DESC':_0x91cb('0x59')};var _0x5c2c01={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x91cb('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x91cb('0x5b'),'UNIX_TIMESTAMP':_0x91cb('0x5c')};var _0x5ae0d2=function(_0x4f19c8){return!_[_0x91cb('0x5d')](['IS\x20NULL',_0x91cb('0x5e'),_0x91cb('0x5f'),_0x91cb('0x60')],_0x4f19c8);};var _0x551836=function(_0x22fea8){if(!_0x22fea8||!_0x22fea8['rules'][_0x91cb('0x36')]){return'';}for(var _0xe08233='(',_0xd7be15=0x0;_0xd7be15<_0x22fea8[_0x91cb('0x61')]['length'];_0xd7be15+=0x1){_0xd7be15>0x0&&(_0xe08233+='\x20'+_0x22fea8[_0x91cb('0x62')]+'\x20');_0xe08233+=_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x63')]?_0x551836(_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x63')]):_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x64')]+'\x20'+_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x65')]+(_0x5ae0d2(_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x65')])?'\x20'+_0x22fea8[_0x91cb('0x61')][_0xd7be15]['value']:'');}return _0xe08233+')';};var _0x2cf4d0={'where':{'id':_0x1b2fec[_0x91cb('0x43')]['id']}},_0x2e301a,_0x474682,_0x51ab8a,_0x21c890,_0xca33a2;_0x2cf4d0=_['merge']({},_0x2cf4d0,_0x1b2fec[_0x91cb('0x3e')]);return db['AnalyticDefaultReport'][_0x91cb('0x44')](_0x2cf4d0)[_0x91cb('0x23')](function(_0x80fcc6){if(_0x80fcc6){_0x2e301a=_0x80fcc6;return _0x80fcc6[_0x91cb('0x66')]();}return null;})['then'](function(_0x1c0b66){if(_0x1c0b66){if(!_0x1c0b66[_0x91cb('0x36')]){throw new db[(_0x91cb('0x67'))][(_0x91cb('0x68'))](_0x91cb('0x69'),0x193);}_0x474682=_0x1c0b66;return db[_0x91cb('0x6a')]['findAll']({'raw':!![]});}return null;})[_0x91cb('0x23')](function(_0x28bfe5){if(_0x28bfe5){_0x51ab8a=_[_0x91cb('0x6b')](_0x28bfe5,'id');var _0x1f0ba2;var _0x891569=squel[_0x91cb('0x6c')]();_0x891569[_0x91cb('0x6d')](_0x2e301a[_0x91cb('0x6e')]);for(var _0x43629b=0x0;_0x43629b<_0x474682[_0x91cb('0x36')];_0x43629b+=0x1){_0x1f0ba2=_0x474682[_0x43629b][_0x91cb('0x6f')]?_0x51ab8a[_0x474682[_0x43629b][_0x91cb('0x6f')]][_0x91cb('0x70')]:_0x474682[_0x43629b][_0x91cb('0x64')];_0x1f0ba2=_0x474682[_0x43629b][_0x91cb('0x71')]?_[_0x91cb('0x72')](_0x365afd[_0x474682[_0x43629b][_0x91cb('0x71')]],'%s',_0x1f0ba2):_0x1f0ba2;_0x1f0ba2=_0x474682[_0x43629b]['format']?_[_0x91cb('0x72')](_0x5c2c01[_0x474682[_0x43629b][_0x91cb('0x73')]],'%s',_0x1f0ba2):_0x1f0ba2;if(_0x474682[_0x43629b]['groupBy']){_0x891569[_0x91cb('0x63')](_0x1f0ba2);}_0x474682[_0x43629b][_0x91cb('0x74')]&&_0x891569[_0x91cb('0x75')](_0x1f0ba2,_0x474682[_0x43629b]['orderBy']===_0x91cb('0x76')?![]:!![]);_0x891569[_0x91cb('0x64')](_0x1f0ba2,_0x474682[_0x43629b]['alias']||_0x1f0ba2);}if(_0x2e301a['joins']){_0x2e301a[_0x91cb('0x77')]=JSON['parse'](_0x2e301a[_0x91cb('0x77')]);for(var _0x376f56=0x0;_0x376f56<_0x2e301a['joins'][_0x91cb('0x36')];_0x376f56+=0x1){if(_0x2e301a['joins'][_0x376f56][_0x91cb('0x2e')]&&_[_0x91cb('0x5d')](_0xe49d42,_0x2e301a['joins'][_0x376f56]['type'])&&_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x78')]&&_0x2e301a[_0x91cb('0x77')][_0x376f56]['foreignTable']&&_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x79')]){_0x891569[_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x2e')]](_0x2e301a['joins'][_0x376f56][_0x91cb('0x7a')],null,util['format'](_0x91cb('0x7b'),_0x2e301a[_0x91cb('0x6e')],_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x78')],_0x2e301a['joins'][_0x376f56]['foreignTable'],_0x2e301a[_0x91cb('0x77')][_0x376f56]['foreignKey']));}}}if(_0x2e301a[_0x91cb('0x7c')]){_0x2e301a[_0x91cb('0x7c')]=JSON[_0x91cb('0x7d')](_0x2e301a[_0x91cb('0x7c')]);_0x891569[_0x91cb('0x3a')](_0x551836(_0x2e301a[_0x91cb('0x7c')][_0x91cb('0x63')]));}_0xca33a2=_0x891569['clone']();_0x891569[_0x91cb('0x1c')](_0x47a6cd);_0x891569[_0x91cb('0x1b')](0x0);logger['debug'](_0x91cb('0x7e'),_0x891569['toString']());return dbH[_0x91cb('0x7f')][_0x91cb('0x31')](_0x891569[_0x91cb('0x80')](),{'type':dbH[_0x91cb('0x7f')][_0x91cb('0x81')][_0x91cb('0x82')]});}})[_0x91cb('0x23')](respondWithResult(_0x1986d7,null))[_0x91cb('0x45')](handleError(_0x1986d7,null));};function runReport(_0x23380a,_0x14cad8,_0x20a64f){var _0x11411d=_0x14cad8[_0x91cb('0x28')];var _0x14882d=0xa;var _0x22ba54=[_0x91cb('0x50'),'left_join',_0x91cb('0x51'),'cross_join'];var _0x1235c0={'SUM':_0x91cb('0x53'),'COUNT':_0x91cb('0x83'),'COUNT DISTINCT':_0x91cb('0x54'),'MAX':_0x91cb('0x55'),'MIN':_0x91cb('0x56'),'AVG':_0x91cb('0x57'),'GROUP_CONCAT':_0x91cb('0x84'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x91cb('0x59')};var _0xdee7f={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x91cb('0x85'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x95f2de=function(_0x4d777a){return!_[_0x91cb('0x5d')](['IS\x20NULL',_0x91cb('0x5e'),_0x91cb('0x5f'),_0x91cb('0x60')],_0x4d777a);};var _0x443c01=function(_0x4e899c){if(!_0x4e899c||!_0x4e899c[_0x91cb('0x61')][_0x91cb('0x36')]){return'';}for(var _0x42d07b='(',_0x427afd=0x0;_0x427afd<_0x4e899c[_0x91cb('0x61')][_0x91cb('0x36')];_0x427afd+=0x1){_0x427afd>0x0&&(_0x42d07b+='\x20'+_0x4e899c[_0x91cb('0x62')]+'\x20');_0x42d07b+=_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x63')]?_0x443c01(_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x63')]):_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x64')]+'\x20'+_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x65')]+(_0x95f2de(_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x65')])?'\x20'+_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x86')]:'');}return _0x42d07b+')';};var _0x39b5bd={'where':{'id':_0x23380a['id']}},_0x315518,_0x3d944d,_0x43b96c,_0xe4d946,_0x32d426;_0x39b5bd=_['merge']({},_0x39b5bd,_0x20a64f);return db[_0x91cb('0x2b')][_0x91cb('0x44')](_0x39b5bd)[_0x91cb('0x23')](function(_0x1a654b){if(_0x1a654b){_0x315518=_0x1a654b;return _0x1a654b[_0x91cb('0x66')]();}return null;})[_0x91cb('0x23')](function(_0x404457){if(_0x404457){if(!_0x404457[_0x91cb('0x36')]){throw new db[(_0x91cb('0x67'))][(_0x91cb('0x68'))](_0x91cb('0x69'),0x193);}_0x3d944d=_0x404457;return db['AnalyticMetric'][_0x91cb('0x41')]({'raw':!![]});}return null;})['then'](function(_0x5689ea){if(_0x5689ea){_0x43b96c=_[_0x91cb('0x6b')](_0x5689ea,'id');var _0x265ffb;var _0x4f66f=squel[_0x91cb('0x6c')]();_0x4f66f[_0x91cb('0x6d')](_0x315518[_0x91cb('0x6e')]);for(var _0x210b46=0x0;_0x210b46<_0x3d944d[_0x91cb('0x36')];_0x210b46+=0x1){_0x265ffb=_0x3d944d[_0x210b46][_0x91cb('0x6f')]?_0x43b96c[_0x3d944d[_0x210b46][_0x91cb('0x6f')]]['metric']:_0x3d944d[_0x210b46][_0x91cb('0x64')];_0x265ffb=_0x3d944d[_0x210b46][_0x91cb('0x71')]?_['replace'](_0x1235c0[_0x3d944d[_0x210b46][_0x91cb('0x71')]],'%s',_0x265ffb):_0x265ffb;_0x265ffb=_0x3d944d[_0x210b46][_0x91cb('0x73')]?_['replace'](_0xdee7f[_0x3d944d[_0x210b46][_0x91cb('0x73')]],'%s',_0x265ffb):_0x265ffb;if(_0x3d944d[_0x210b46][_0x91cb('0x87')]){_0x4f66f[_0x91cb('0x63')](_0x265ffb);}_0x3d944d[_0x210b46][_0x91cb('0x74')]&&_0x4f66f[_0x91cb('0x75')](_0x265ffb,_0x3d944d[_0x210b46][_0x91cb('0x74')]===_0x91cb('0x76')?![]:!![]);_0x4f66f[_0x91cb('0x64')](_0x265ffb,_0x3d944d[_0x210b46][_0x91cb('0x88')]||_0x265ffb);}if(_0x315518[_0x91cb('0x77')]){_0x315518[_0x91cb('0x77')]=JSON[_0x91cb('0x7d')](_0x315518['joins']);for(var _0x5c0725=0x0;_0x5c0725<_0x315518[_0x91cb('0x77')][_0x91cb('0x36')];_0x5c0725+=0x1){if(_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x2e')]&&_[_0x91cb('0x5d')](_0x22ba54,_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x2e')])&&_0x315518['joins'][_0x5c0725][_0x91cb('0x78')]&&_0x315518['joins'][_0x5c0725][_0x91cb('0x7a')]&&_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x79')]){_0x4f66f[_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x2e')]](_0x315518['joins'][_0x5c0725][_0x91cb('0x7a')],null,util[_0x91cb('0x73')](_0x91cb('0x7b'),_0x315518[_0x91cb('0x6e')],_0x315518[_0x91cb('0x77')][_0x5c0725]['parentKey'],_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x7a')],_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x79')]));}}}if(_0x315518['conditions']){_0x315518['conditions']=JSON['parse'](_0x315518[_0x91cb('0x7c')]);_0x4f66f[_0x91cb('0x3a')](_0x443c01(_0x315518[_0x91cb('0x7c')][_0x91cb('0x63')]));}_0x32d426=_0x4f66f['clone']();_0x4f66f[_0x91cb('0x1c')](_0x14882d);_0x4f66f[_0x91cb('0x1b')](0x0);return;}})[_0x91cb('0x23')](function(){if(_0x14cad8[_0x91cb('0x89')]==='web'){return null;}var _0x4bf7c7=_[_0x91cb('0x3c')](_0x14cad8,{'name':_0x14cad8[_0x91cb('0x8a')]||_0x14cad8[_0x91cb('0x28')]||_0x315518[_0x91cb('0x28')],'basename':_0x11411d,'savename':util[_0x91cb('0x73')](_0x91cb('0x8b'),_0x14cad8[_0x91cb('0x28')]||_0x315518[_0x91cb('0x28')],require(_0x91cb('0x8c'))[_0x91cb('0x8d')](0x4),_0x14cad8[_0x91cb('0x89')]||_0x91cb('0x8e')),'reportId':_0x315518['id'],'reportType':_0x91cb('0x8f')});return db['AnalyticExtractedReport']['create'](_0x4bf7c7,{'raw':!![]});})[_0x91cb('0x23')](function(_0x48a910){if(_0x315518[_0x91cb('0x6e')]===_0x91cb('0x90')){_0x32d426[_0x91cb('0x3a')](_0x315518[_0x91cb('0x6e')]+_0x91cb('0x91'),_0x14cad8[_0x91cb('0x92')],_0x14cad8[_0x91cb('0x93')]);}else{_0x32d426[_0x91cb('0x3a')](_0x315518['table']+_0x91cb('0x94'),_0x14cad8[_0x91cb('0x92')],_0x14cad8[_0x91cb('0x93')]);}if(_0x48a910){logger[_0x91cb('0x95')](_0x91cb('0x96'),_0x32d426['toString']());require(_0x91cb('0x97'))[_0x91cb('0x98')](path[_0x91cb('0x50')](__dirname,_0x91cb('0x99'),_0x48a910[_0x91cb('0x89')]),[_0x48a910['id'],_0x32d426['toString'](),path[_0x91cb('0x50')](__dirname,_0x91cb('0x9a'),_0x48a910[_0x91cb('0x9b')]),_0x11411d]);return _0x48a910;}else{var _0x22b6d3=squel[_0x91cb('0x6c')]();_0x22b6d3[_0x91cb('0x6d')]('('+_0x32d426[_0x91cb('0x80')]()+')',_0x91cb('0x9c'));_0x22b6d3[_0x91cb('0x64')](_0x91cb('0x9d'),_0x91cb('0x1e'));_0x32d426[_0x91cb('0x1c')](_0x14cad8[_0x91cb('0x1c')]||_0x14882d);_0x32d426[_0x91cb('0x1b')](_0x14cad8[_0x91cb('0x1b')]||0x0);return dbH[_0x91cb('0x7f')][_0x91cb('0x31')](_0x22b6d3[_0x91cb('0x80')](),{'type':dbH[_0x91cb('0x7f')][_0x91cb('0x81')][_0x91cb('0x82')]})[_0x91cb('0x23')](function(_0x275c80){if(!_0x275c80[_0x91cb('0x36')]){_0xe4d946=0x0;}else{_0xe4d946=_0x275c80[0x0][_0x91cb('0x1e')]||0x0;}return dbH[_0x91cb('0x7f')]['query'](_0x32d426[_0x91cb('0x80')](),{'type':dbH[_0x91cb('0x7f')][_0x91cb('0x81')][_0x91cb('0x82')]});})[_0x91cb('0x23')](function(_0x5ca377){return{'rows':_0x5ca377||[],'count':_0xe4d946};});}});}exports['run']=function(_0x552490,_0x5174ac){return runReport(_0x552490['params'],_0x552490[_0x91cb('0x31')],_0x552490[_0x91cb('0x3e')])[_0x91cb('0x23')](respondWithResult(_0x5174ac,null))[_0x91cb('0x45')](handleError(_0x5174ac,null));};exports[_0x91cb('0x9e')]=runReport;exports[_0x91cb('0x31')]=function(_0x3462c5,_0x146346){var _0xe3d97f=0xa;var _0x3b93c3=['join',_0x91cb('0x9f'),_0x91cb('0x51'),'cross_join'];var _0x154e6a={'SUM':_0x91cb('0x53'),'COUNT':_0x91cb('0x83'),'COUNT DISTINCT':_0x91cb('0x54'),'MAX':_0x91cb('0x55'),'MIN':_0x91cb('0x56'),'AVG':_0x91cb('0x57'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x91cb('0x58'),'GROUP_CONCAT DESC':_0x91cb('0x59')};var _0x2a05af={'SEC_TO_TIME':_0x91cb('0xa0'),'DATE':_0x91cb('0x5a'),'HOUR':_0x91cb('0x85'),'ROUND':_0x91cb('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x34c1f2=function(_0x4d82b4){return!_[_0x91cb('0x5d')]([_0x91cb('0xa1'),_0x91cb('0x5e'),_0x91cb('0x5f'),_0x91cb('0x60')],_0x4d82b4);};var _0x432099=function(_0x344c95){if(!_0x344c95||!_0x344c95[_0x91cb('0x61')][_0x91cb('0x36')]){return'';}for(var _0x570cf0='(',_0xb3a6c4=0x0;_0xb3a6c4<_0x344c95[_0x91cb('0x61')][_0x91cb('0x36')];_0xb3a6c4+=0x1){_0xb3a6c4>0x0&&(_0x570cf0+='\x20'+_0x344c95[_0x91cb('0x62')]+'\x20');_0x570cf0+=_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x63')]?_0x432099(_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x63')]):_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x64')]+'\x20'+_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x65')]+(_0x34c1f2(_0x344c95[_0x91cb('0x61')][_0xb3a6c4]['condition'])?'\x20'+_0x344c95[_0x91cb('0x61')][_0xb3a6c4]['value']:'');}return _0x570cf0+')';};var _0x39ba62={'where':{'id':_0x3462c5[_0x91cb('0x43')]['id']}},_0x2ab5a3,_0x10a9f6,_0x43ad75,_0x1382ba,_0x12da14;_0x39ba62=_[_0x91cb('0x3c')]({},_0x39ba62,_0x3462c5['options']);return db[_0x91cb('0x2b')]['find'](_0x39ba62)[_0x91cb('0x23')](function(_0x2f7387){if(_0x2f7387){_0x2ab5a3=_0x2f7387;return _0x2f7387[_0x91cb('0x66')]();}return null;})['then'](function(_0x1f2ef8){if(_0x1f2ef8){if(!_0x1f2ef8[_0x91cb('0x36')]){throw new db[(_0x91cb('0x67'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x10a9f6=_0x1f2ef8;return db['AnalyticMetric'][_0x91cb('0x41')]({'raw':!![]});}return null;})[_0x91cb('0x23')](function(_0x3ac830){if(_0x3ac830){_0x43ad75=_['keyBy'](_0x3ac830,'id');var _0x469e62;var _0x1e9441=squel[_0x91cb('0x6c')]();_0x1e9441[_0x91cb('0x6d')](_0x2ab5a3[_0x91cb('0x6e')]);for(var _0x416390=0x0;_0x416390<_0x10a9f6[_0x91cb('0x36')];_0x416390+=0x1){_0x469e62=_0x10a9f6[_0x416390][_0x91cb('0x6f')]?_0x43ad75[_0x10a9f6[_0x416390]['MetricId']][_0x91cb('0x70')]:_0x10a9f6[_0x416390][_0x91cb('0x64')];_0x469e62=_0x10a9f6[_0x416390][_0x91cb('0x71')]?_[_0x91cb('0x72')](_0x154e6a[_0x10a9f6[_0x416390]['function']],'%s',_0x469e62):_0x469e62;_0x469e62=_0x10a9f6[_0x416390][_0x91cb('0x73')]?_['replace'](_0x2a05af[_0x10a9f6[_0x416390][_0x91cb('0x73')]],'%s',_0x469e62):_0x469e62;if(_0x10a9f6[_0x416390][_0x91cb('0x87')]){_0x1e9441[_0x91cb('0x63')](_0x469e62);}_0x10a9f6[_0x416390][_0x91cb('0x74')]&&_0x1e9441[_0x91cb('0x75')](_0x469e62,_0x10a9f6[_0x416390]['orderBy']===_0x91cb('0x76')?![]:!![]);_0x1e9441['field'](_0x469e62,_0x10a9f6[_0x416390]['alias']||_0x469e62);}if(_0x2ab5a3[_0x91cb('0x77')]){_0x2ab5a3[_0x91cb('0x77')]=JSON[_0x91cb('0x7d')](_0x2ab5a3[_0x91cb('0x77')]);for(var _0x286ed7=0x0;_0x286ed7<_0x2ab5a3[_0x91cb('0x77')][_0x91cb('0x36')];_0x286ed7+=0x1){if(_0x2ab5a3[_0x91cb('0x77')][_0x286ed7]['type']&&_[_0x91cb('0x5d')](_0x3b93c3,_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x2e')])&&_0x2ab5a3['joins'][_0x286ed7]['parentKey']&&_0x2ab5a3['joins'][_0x286ed7][_0x91cb('0x7a')]&&_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x79')]){_0x1e9441[_0x2ab5a3['joins'][_0x286ed7][_0x91cb('0x2e')]](_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x7a')],null,util[_0x91cb('0x73')]('%s.%s\x20=\x20%s.%s',_0x2ab5a3[_0x91cb('0x6e')],_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x78')],_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x7a')],_0x2ab5a3[_0x91cb('0x77')][_0x286ed7]['foreignKey']));}}}if(_0x2ab5a3[_0x91cb('0x7c')]){_0x2ab5a3[_0x91cb('0x7c')]=JSON[_0x91cb('0x7d')](_0x2ab5a3[_0x91cb('0x7c')]);_0x1e9441[_0x91cb('0x3a')](_0x432099(_0x2ab5a3['conditions'][_0x91cb('0x63')]));}_0x12da14=_0x1e9441[_0x91cb('0xa2')]();_0x1e9441[_0x91cb('0x1c')](_0xe3d97f);_0x1e9441[_0x91cb('0x1b')](0x0);logger[_0x91cb('0xa3')](_0x91cb('0x7e'),_0x1e9441['toString']());return dbH[_0x91cb('0x7f')][_0x91cb('0x31')](_0x1e9441[_0x91cb('0x80')](),{'type':dbH['sequelize'][_0x91cb('0x81')]['SELECT']});}})[_0x91cb('0x23')](function(){return{'sql':_0x12da14[_0x91cb('0x80')]()};})[_0x91cb('0x23')](respondWithResult(_0x146346,null))[_0x91cb('0x45')](handleError(_0x146346,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index fa5b079..684250c 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 _0xd6f9=['bluebird','request-promise','path','rimraf','../../config/environment','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','moment'];(function(_0x3d94fc,_0x5e08e5){var _0x20d02c=function(_0x5225e3){while(--_0x5225e3){_0x3d94fc['push'](_0x3d94fc['shift']());}};_0x20d02c(++_0x5e08e5);}(_0xd6f9,0x1ca));var _0x9d6f=function(_0x43b584,_0x20a6bd){_0x43b584=_0x43b584-0x0;var _0x48f27b=_0xd6f9[_0x43b584];return _0x48f27b;};'use strict';var _=require(_0x9d6f('0x0'));var util=require(_0x9d6f('0x1'));var logger=require(_0x9d6f('0x2'))('api');var moment=require(_0x9d6f('0x3'));var BPromise=require(_0x9d6f('0x4'));var rp=require(_0x9d6f('0x5'));var fs=require('fs');var path=require(_0x9d6f('0x6'));var rimraf=require(_0x9d6f('0x7'));var config=require(_0x9d6f('0x8'));var attributes=require('./analyticDefaultReport.attributes');module['exports']=function(_0x4dc4c1,_0x2b253a){return _0x4dc4c1['define'](_0x9d6f('0x9'),attributes,{'tableName':_0x9d6f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0808=['./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x32d414,_0x4d23da){var _0x4e0bca=function(_0x15d397){while(--_0x15d397){_0x32d414['push'](_0x32d414['shift']());}};_0x4e0bca(++_0x4d23da);}(_0x0808,0x171));var _0x8080=function(_0x3f4d7d,_0x1fc5d2){_0x3f4d7d=_0x3f4d7d-0x0;var _0x2e26ba=_0x0808[_0x3f4d7d];return _0x2e26ba;};'use strict';var _=require('lodash');var util=require(_0x8080('0x0'));var logger=require(_0x8080('0x1'))(_0x8080('0x2'));var moment=require(_0x8080('0x3'));var BPromise=require(_0x8080('0x4'));var rp=require(_0x8080('0x5'));var fs=require('fs');var path=require(_0x8080('0x6'));var rimraf=require(_0x8080('0x7'));var config=require(_0x8080('0x8'));var attributes=require(_0x8080('0x9'));module[_0x8080('0xa')]=function(_0x35357d,_0x135bc3){return _0x35357d[_0x8080('0xb')](_0x8080('0xc'),attributes,{'tableName':_0x8080('0xd'),'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 9f48104..90d05dc 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 _0xddef=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','AnalyticDefaultReport,\x20%s,\x20%s','result','catch','util','bluebird','randomstring','ioredis'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xddef,0x1ac));var _0xfdde=function(_0x362ab7,_0x5d18e8){_0x362ab7=_0x362ab7-0x0;var _0x2532d1=_0xddef[_0x362ab7];return _0x2532d1;};'use strict';var _=require('lodash');var util=require(_0xfdde('0x0'));var moment=require('moment');var BPromise=require(_0xfdde('0x1'));var rs=require(_0xfdde('0x2'));var fs=require('fs');var Redis=require(_0xfdde('0x3'));var db=require(_0xfdde('0x4'))['db'];var utils=require(_0xfdde('0x5'));var logger=require(_0xfdde('0x6'))(_0xfdde('0x7'));var config=require(_0xfdde('0x8'));var jayson=require(_0xfdde('0x9'));var client=jayson[_0xfdde('0xa')][_0xfdde('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x17002c,_0x40831a,_0x26c0b2){return new BPromise(function(_0x180cd5,_0x360614){return client[_0xfdde('0xc')](_0x17002c,_0x26c0b2)[_0xfdde('0xd')](function(_0x562365){logger[_0xfdde('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x40831a,_0xfdde('0xf'));logger['debug'](_0xfdde('0x10'),_0x40831a,_0xfdde('0xf'),JSON[_0xfdde('0x11')](_0x562365));if(_0x562365[_0xfdde('0x12')]){if(_0x562365[_0xfdde('0x12')][_0xfdde('0x13')]===0x1f4){logger[_0xfdde('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x40831a,_0x562365['error']['message']);return _0x360614(_0x562365[_0xfdde('0x12')][_0xfdde('0x14')]);}logger['error'](_0xfdde('0x15'),_0x40831a,_0x562365['error']['message']);return _0x180cd5(_0x562365[_0xfdde('0x12')][_0xfdde('0x14')]);}else{logger[_0xfdde('0xe')](_0xfdde('0x15'),_0x40831a,_0xfdde('0xf'));_0x180cd5(_0x562365[_0xfdde('0x16')]['message']);}})[_0xfdde('0x17')](function(_0x3251d2){logger[_0xfdde('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x40831a,_0x3251d2);_0x360614(_0x3251d2);});});} \ No newline at end of file +var _0x1a59=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x14e780,_0x3b07c6){var _0x5f884c=function(_0x2daf57){while(--_0x2daf57){_0x14e780['push'](_0x14e780['shift']());}};_0x5f884c(++_0x3b07c6);}(_0x1a59,0xa2));var _0x91a5=function(_0x582a04,_0x1ff37e){_0x582a04=_0x582a04-0x0;var _0x546e7a=_0x1a59[_0x582a04];return _0x546e7a;};'use strict';var _=require(_0x91a5('0x0'));var util=require(_0x91a5('0x1'));var moment=require(_0x91a5('0x2'));var BPromise=require(_0x91a5('0x3'));var rs=require(_0x91a5('0x4'));var fs=require('fs');var Redis=require(_0x91a5('0x5'));var db=require(_0x91a5('0x6'))['db'];var utils=require(_0x91a5('0x7'));var logger=require('../../config/logger')(_0x91a5('0x8'));var config=require(_0x91a5('0x9'));var jayson=require(_0x91a5('0xa'));var client=jayson[_0x91a5('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xf096e2,_0x53dfa7,_0x37bc4f){return new BPromise(function(_0x17d2ef,_0x5484bd){return client[_0x91a5('0xc')](_0xf096e2,_0x37bc4f)[_0x91a5('0xd')](function(_0x2cdfae){logger[_0x91a5('0xe')](_0x91a5('0xf'),_0x53dfa7,'request\x20sent');logger[_0x91a5('0x10')](_0x91a5('0x11'),_0x53dfa7,'request\x20sent',JSON['stringify'](_0x2cdfae));if(_0x2cdfae[_0x91a5('0x12')]){if(_0x2cdfae['error'][_0x91a5('0x13')]===0x1f4){logger['error'](_0x91a5('0xf'),_0x53dfa7,_0x2cdfae['error']['message']);return _0x5484bd(_0x2cdfae['error'][_0x91a5('0x14')]);}logger[_0x91a5('0x12')](_0x91a5('0xf'),_0x53dfa7,_0x2cdfae['error'][_0x91a5('0x14')]);return _0x17d2ef(_0x2cdfae[_0x91a5('0x12')][_0x91a5('0x14')]);}else{logger[_0x91a5('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x53dfa7,_0x91a5('0x15'));_0x17d2ef(_0x2cdfae[_0x91a5('0x16')]['message']);}})[_0x91a5('0x17')](function(_0x577660){logger[_0x91a5('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x53dfa7,_0x577660);_0x5484bd(_0x577660);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index a4e8fb7..807a703 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 _0x88a1=['get','isAuthenticated','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','put','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','./analyticDefaultReport.controller'];(function(_0xef8146,_0x459c34){var _0x5a6cb0=function(_0x2f84ec){while(--_0x2f84ec){_0xef8146['push'](_0xef8146['shift']());}};_0x5a6cb0(++_0x459c34);}(_0x88a1,0x1c7));var _0x188a=function(_0xf5d71c,_0x2613a6){_0xf5d71c=_0xf5d71c-0x0;var _0x5af672=_0x88a1[_0xf5d71c];return _0x5af672;};'use strict';var multer=require(_0x188a('0x0'));var util=require('util');var path=require(_0x188a('0x1'));var timeout=require('connect-timeout');var express=require(_0x188a('0x2'));var router=express[_0x188a('0x3')]();var fs_extra=require(_0x188a('0x4'));var auth=require(_0x188a('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x188a('0x6'));router[_0x188a('0x7')]('/',auth[_0x188a('0x8')](),controller['index']);router[_0x188a('0x7')](_0x188a('0x9'),auth['isAuthenticated'](),controller[_0x188a('0xa')]);router['get'](_0x188a('0xb'),auth[_0x188a('0x8')](),controller[_0x188a('0xc')]);router[_0x188a('0x7')](_0x188a('0xd'),auth[_0x188a('0x8')](),controller[_0x188a('0xe')]);router['get'](_0x188a('0xf'),auth[_0x188a('0x8')](),controller[_0x188a('0x10')]);router[_0x188a('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x188a('0x12')](_0x188a('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x188a('0x13')](_0x188a('0x9'),auth[_0x188a('0x8')](),controller[_0x188a('0x14')]);module['exports']=router; \ No newline at end of file +var _0x4aa2=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','index','isAuthenticated','/:id/preview','preview','/:id/run','/:id/query','query','post','create','put','delete','/:id','destroy'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x4aa2,0x78));var _0x24aa=function(_0x19f161,_0x3b5999){_0x19f161=_0x19f161-0x0;var _0x17fa27=_0x4aa2[_0x19f161];return _0x17fa27;};'use strict';var multer=require(_0x24aa('0x0'));var util=require('util');var path=require(_0x24aa('0x1'));var timeout=require(_0x24aa('0x2'));var express=require(_0x24aa('0x3'));var router=express[_0x24aa('0x4')]();var fs_extra=require(_0x24aa('0x5'));var auth=require(_0x24aa('0x6'));var interaction=require(_0x24aa('0x7'));var config=require(_0x24aa('0x8'));var controller=require(_0x24aa('0x9'));router[_0x24aa('0xa')]('/',auth['isAuthenticated'](),controller[_0x24aa('0xb')]);router[_0x24aa('0xa')]('/:id',auth[_0x24aa('0xc')](),controller['show']);router[_0x24aa('0xa')](_0x24aa('0xd'),auth[_0x24aa('0xc')](),controller[_0x24aa('0xe')]);router[_0x24aa('0xa')](_0x24aa('0xf'),auth[_0x24aa('0xc')](),controller['run']);router['get'](_0x24aa('0x10'),auth[_0x24aa('0xc')](),controller[_0x24aa('0x11')]);router[_0x24aa('0x12')]('/',auth[_0x24aa('0xc')](),controller[_0x24aa('0x13')]);router[_0x24aa('0x14')]('/:id',auth[_0x24aa('0xc')](),controller['update']);router[_0x24aa('0x15')](_0x24aa('0x16'),auth[_0x24aa('0xc')](),controller[_0x24aa('0x17')]);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 c3e4901..1d22c88 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 _0x078e=['manual','INTEGER','UNSIGNED','moment','exports','STRING','ENUM','pdf','xlsx','csv','DATE','Loading'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x078e,0x93));var _0xe078=function(_0x1b9073,_0x2f3795){_0x1b9073=_0x1b9073-0x0;var _0x585eeb=_0x078e[_0x1b9073];return _0x585eeb;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xe078('0x0'));module[_0xe078('0x1')]={'name':{'type':Sequelize[_0xe078('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0xe078('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0xe078('0x3')]('csv',_0xe078('0x4'),_0xe078('0x5')),'allowNull':![],'defaultValue':_0xe078('0x6')},'savename':{'type':Sequelize[_0xe078('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0xe078('0x7')]},'endDate':{'type':Sequelize[_0xe078('0x7')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0xe078('0x8')},'type':{'type':Sequelize[_0xe078('0x3')](_0xe078('0x9'),'scheduled'),'allowNull':![],'defaultValue':_0xe078('0x9')},'reportId':{'type':Sequelize[_0xe078('0xa')](0xb)[_0xe078('0xb')]},'reportType':{'type':Sequelize[_0xe078('0x2')]}}; \ No newline at end of file +var _0xf01f=['moment','exports','STRING','csv','pdf','xlsx','DATE','Loading','ENUM','scheduled','INTEGER','sequelize'];(function(_0x16bc92,_0x1b0935){var _0x27a2d2=function(_0x334beb){while(--_0x334beb){_0x16bc92['push'](_0x16bc92['shift']());}};_0x27a2d2(++_0x1b0935);}(_0xf01f,0x137));var _0xff01=function(_0x2b61bb,_0x435222){_0x2b61bb=_0x2b61bb-0x0;var _0x55cbe6=_0xf01f[_0x2b61bb];return _0x55cbe6;};'use strict';var Sequelize=require(_0xff01('0x0'));var moment=require(_0xff01('0x1'));module[_0xff01('0x2')]={'name':{'type':Sequelize[_0xff01('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0xff01('0x3')],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0xff01('0x4'),_0xff01('0x5'),_0xff01('0x6')),'allowNull':![],'defaultValue':_0xff01('0x4')},'savename':{'type':Sequelize[_0xff01('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0xff01('0x7')]},'endDate':{'type':Sequelize[_0xff01('0x7')]},'status':{'type':Sequelize[_0xff01('0x3')],'defaultValue':_0xff01('0x8')},'type':{'type':Sequelize[_0xff01('0x9')]('manual',_0xff01('0xa')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0xff01('0xb')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0xff01('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 5280586..4065bf3 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 _0xe69e=['show','keys','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','download','basename','savename','output','existsSync','join','server/files/reports','Report\x20not\x20found\x20or\x20empty','exists','%s.%s','toLowerCase','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','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','then','destroy','get','ExtractedReports','UserProfileResource','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch'];(function(_0x105c51,_0x412d34){var _0x1f727d=function(_0x536704){while(--_0x536704){_0x105c51['push'](_0x105c51['shift']());}};_0x1f727d(++_0x412d34);}(_0xe69e,0x139));var _0xee69=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0xe69e[_0x23e7c1];return _0x1add43;};'use strict';var emlformat=require(_0xee69('0x0'));var rimraf=require(_0xee69('0x1'));var zipdir=require(_0xee69('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xee69('0x3'));var moment=require(_0xee69('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xee69('0x5'));var path=require(_0xee69('0x6'));var sox=require(_0xee69('0x7'));var csv=require(_0xee69('0x8'));var ejs=require(_0xee69('0x9'));var fs=require('fs');var fs_extra=require(_0xee69('0xa'));var _=require(_0xee69('0xb'));var squel=require('squel');var crypto=require(_0xee69('0xc'));var jsforce=require(_0xee69('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xee69('0x8'));var querystring=require('querystring');var Papa=require(_0xee69('0xe'));var Redis=require('ioredis');var authService=require(_0xee69('0xf'));var qs=require(_0xee69('0x10'));var as=require(_0xee69('0x11'));var hardwareService=require(_0xee69('0x12'));var logger=require('../../config/logger')(_0xee69('0x13'));var utils=require(_0xee69('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xee69('0x15'));var db=require(_0xee69('0x16'))['db'];function respondWithStatusCode(_0x441d6e,_0x300b1e){_0x300b1e=_0x300b1e||0xcc;return function(_0x40bb5a){if(_0x40bb5a){return _0x441d6e[_0xee69('0x17')](_0x300b1e);}return _0x441d6e[_0xee69('0x18')](_0x300b1e)[_0xee69('0x19')]();};}function respondWithResult(_0x5772a8,_0x4ba33a){_0x4ba33a=_0x4ba33a||0xc8;return function(_0x38d668){if(_0x38d668){return _0x5772a8['status'](_0x4ba33a)[_0xee69('0x1a')](_0x38d668);}};}function respondWithFilteredResult(_0x4314fc,_0x19eef4){return function(_0xdcfa07){if(_0xdcfa07){var _0x251e73=typeof _0x19eef4[_0xee69('0x1b')]===_0xee69('0x1c')&&typeof _0x19eef4[_0xee69('0x1d')]===_0xee69('0x1c');var _0x28bb57=_0xdcfa07[_0xee69('0x1e')];var _0x36cc93=_0x251e73?0x0:_0x19eef4[_0xee69('0x1b')];var _0x5bc6f6=_0x251e73?_0xdcfa07[_0xee69('0x1e')]:_0x19eef4[_0xee69('0x1b')]+_0x19eef4[_0xee69('0x1d')];var _0x4fa61a;if(_0x5bc6f6>=_0x28bb57){_0x5bc6f6=_0x28bb57;_0x4fa61a=0xc8;}else{_0x4fa61a=0xce;}_0x4314fc[_0xee69('0x18')](_0x4fa61a);return _0x4314fc[_0xee69('0x1f')](_0xee69('0x20'),_0x36cc93+'-'+_0x5bc6f6+'/'+_0x28bb57)[_0xee69('0x1a')](_0xdcfa07);}return null;};}function patchUpdates(_0x4e0009){return function(_0x15a2a1){try{jsonpatch[_0xee69('0x21')](_0x15a2a1,_0x4e0009,!![]);}catch(_0x2fdfa5){return BPromise[_0xee69('0x22')](_0x2fdfa5);}return _0x15a2a1[_0xee69('0x23')]();};}function saveUpdates(_0x542f55,_0x533f16){return function(_0x318c47){if(_0x318c47){return _0x318c47['update'](_0x542f55)[_0xee69('0x24')](function(_0x182b55){return _0x182b55;});}return null;};}function removeEntity(_0x1f6543,_0x42a85b){return function(_0x7669a2){if(_0x7669a2){return _0x7669a2[_0xee69('0x25')]()['then'](function(){var _0x19e61=_0x7669a2[_0xee69('0x26')]({'plain':!![]});var _0x632d52=_0xee69('0x27');return db[_0xee69('0x28')][_0xee69('0x25')]({'where':{'type':_0x632d52,'resourceId':_0x19e61['id']}})['then'](function(){return _0x7669a2;});})[_0xee69('0x24')](function(){_0x1f6543[_0xee69('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1fe473,_0x5516cc){return function(_0x3ad69a){if(!_0x3ad69a){_0x1fe473['sendStatus'](0x194);}return _0x3ad69a;};}function handleError(_0x652988,_0x1d5c0c){_0x1d5c0c=_0x1d5c0c||0x1f4;return function(_0x11014d){logger['error'](_0x11014d[_0xee69('0x29')]);if(_0x11014d[_0xee69('0x2a')]){delete _0x11014d[_0xee69('0x2a')];}_0x652988[_0xee69('0x18')](_0x1d5c0c)[_0xee69('0x2b')](_0x11014d);};}exports[_0xee69('0x2c')]=function(_0x44a007,_0x36c62d){var _0x37f8fd={},_0x5d2f30={},_0x217068={'count':0x0,'rows':[]};var _0x3a5e97=_[_0xee69('0x2d')](db[_0xee69('0x2e')][_0xee69('0x2f')],function(_0x5efd21){return{'name':_0x5efd21['fieldName'],'type':_0x5efd21[_0xee69('0x30')][_0xee69('0x31')]};});_0x5d2f30[_0xee69('0x32')]=_[_0xee69('0x2d')](_0x3a5e97,_0xee69('0x2a'));_0x5d2f30[_0xee69('0x33')]=_['keys'](_0x44a007[_0xee69('0x33')]);_0x5d2f30['filters']=_[_0xee69('0x34')](_0x5d2f30[_0xee69('0x32')],_0x5d2f30[_0xee69('0x33')]);_0x37f8fd[_0xee69('0x35')]=_[_0xee69('0x34')](_0x5d2f30[_0xee69('0x32')],qs['fields'](_0x44a007[_0xee69('0x33')][_0xee69('0x36')]));_0x37f8fd['attributes']=_0x37f8fd[_0xee69('0x35')][_0xee69('0x37')]?_0x37f8fd[_0xee69('0x35')]:_0x5d2f30[_0xee69('0x32')];if(!_0x44a007[_0xee69('0x33')][_0xee69('0x38')](_0xee69('0x39'))){_0x37f8fd[_0xee69('0x1d')]=qs[_0xee69('0x1d')](_0x44a007[_0xee69('0x33')][_0xee69('0x1d')]);_0x37f8fd[_0xee69('0x1b')]=qs[_0xee69('0x1b')](_0x44a007[_0xee69('0x33')]['offset']);}_0x37f8fd[_0xee69('0x3a')]=qs[_0xee69('0x3b')](_0x44a007['query']['sort']);_0x37f8fd[_0xee69('0x3c')]=qs[_0xee69('0x3d')](_[_0xee69('0x3e')](_0x44a007[_0xee69('0x33')],_0x5d2f30[_0xee69('0x3d')]),_0x3a5e97);if(_0x44a007[_0xee69('0x33')][_0xee69('0x3f')]){_0x37f8fd['where']=_[_0xee69('0x40')](_0x37f8fd[_0xee69('0x3c')],{'$or':_['map'](_0x3a5e97,function(_0x491bc1){if(_0x491bc1['type']!==_0xee69('0x41')){var _0x1e94d3={};_0x1e94d3[_0x491bc1['name']]={'$like':'%'+_0x44a007[_0xee69('0x33')][_0xee69('0x3f')]+'%'};return _0x1e94d3;}})});}_0x37f8fd=_[_0xee69('0x40')]({},_0x37f8fd,_0x44a007[_0xee69('0x42')]);var _0x4b13ad={'where':_0x37f8fd['where']};return db[_0xee69('0x2e')][_0xee69('0x1e')](_0x4b13ad)[_0xee69('0x24')](function(_0x393d69){_0x217068[_0xee69('0x1e')]=_0x393d69;if(_0x44a007[_0xee69('0x33')][_0xee69('0x43')]){_0x37f8fd['include']=[{'all':!![]}];}return db[_0xee69('0x2e')][_0xee69('0x44')](_0x37f8fd);})[_0xee69('0x24')](function(_0xefdc8f){_0x217068[_0xee69('0x45')]=_0xefdc8f;return _0x217068;})['then'](respondWithFilteredResult(_0x36c62d,_0x37f8fd))[_0xee69('0x46')](handleError(_0x36c62d,null));};exports[_0xee69('0x47')]=function(_0x53c442,_0x15313c){var _0x101edb={'raw':!![],'where':{'id':_0x53c442['params']['id']}},_0x26ec7b={};_0x26ec7b['model']=_[_0xee69('0x48')](db['AnalyticExtractedReport']['rawAttributes']);_0x26ec7b[_0xee69('0x33')]=_['keys'](_0x53c442[_0xee69('0x33')]);_0x26ec7b[_0xee69('0x3d')]=_[_0xee69('0x34')](_0x26ec7b['model'],_0x26ec7b[_0xee69('0x33')]);_0x101edb[_0xee69('0x35')]=_['intersection'](_0x26ec7b[_0xee69('0x32')],qs[_0xee69('0x36')](_0x53c442['query'][_0xee69('0x36')]));_0x101edb['attributes']=_0x101edb[_0xee69('0x35')][_0xee69('0x37')]?_0x101edb[_0xee69('0x35')]:_0x26ec7b[_0xee69('0x32')];if(_0x53c442[_0xee69('0x33')][_0xee69('0x43')]){_0x101edb['include']=[{'all':!![]}];}_0x101edb=_[_0xee69('0x40')]({},_0x101edb,_0x53c442[_0xee69('0x42')]);return db[_0xee69('0x2e')][_0xee69('0x49')](_0x101edb)[_0xee69('0x24')](handleEntityNotFound(_0x15313c,null))[_0xee69('0x24')](respondWithResult(_0x15313c,null))['catch'](handleError(_0x15313c,null));};exports[_0xee69('0x4a')]=function(_0x15cb1d,_0x50b6f7){return db[_0xee69('0x2e')][_0xee69('0x4a')](_0x15cb1d['body'],{})[_0xee69('0x24')](function(_0x3955a9){var _0x3c4ccf=_0x15cb1d[_0xee69('0x4b')][_0xee69('0x26')]({'plain':!![]});if(!_0x3c4ccf)throw new Error(_0xee69('0x4c'));if(_0x3c4ccf[_0xee69('0x4d')]==='user'){var _0x18c90d=_0x3955a9['get']({'plain':!![]});var _0x3e4bc0=_0xee69('0x27');return db[_0xee69('0x4e')][_0xee69('0x49')]({'where':{'name':_0x3e4bc0,'userProfileId':_0x3c4ccf[_0xee69('0x4f')]},'raw':!![]})[_0xee69('0x24')](function(_0x19d30c){if(_0x19d30c&&_0x19d30c['autoAssociation']===0x0){return db[_0xee69('0x28')][_0xee69('0x4a')]({'name':_0x18c90d[_0xee69('0x2a')],'resourceId':_0x18c90d['id'],'type':_0x19d30c['name'],'sectionId':_0x19d30c['id']},{})[_0xee69('0x24')](function(){return _0x3955a9;});}else{return _0x3955a9;}})[_0xee69('0x46')](function(_0x123286){logger[_0xee69('0x50')](_0xee69('0x51'),_0x123286);throw _0x123286;});}return _0x3955a9;})[_0xee69('0x24')](respondWithResult(_0x50b6f7,0xc9))[_0xee69('0x46')](handleError(_0x50b6f7,null));};exports[_0xee69('0x52')]=function(_0x17eebf,_0x44237e){if(_0x17eebf['body']['id']){delete _0x17eebf[_0xee69('0x53')]['id'];}return db['AnalyticExtractedReport'][_0xee69('0x49')]({'where':{'id':_0x17eebf['params']['id']}})['then'](handleEntityNotFound(_0x44237e,null))['then'](saveUpdates(_0x17eebf['body'],null))[_0xee69('0x24')](respondWithResult(_0x44237e,null))[_0xee69('0x46')](handleError(_0x44237e,null));};exports[_0xee69('0x25')]=function(_0x587626,_0x254b3e){return db['AnalyticExtractedReport'][_0xee69('0x49')]({'where':{'id':_0x587626[_0xee69('0x54')]['id']}})['then'](handleEntityNotFound(_0x254b3e,null))['then'](removeEntity(_0x254b3e,null))[_0xee69('0x46')](handleError(_0x254b3e,null));};exports[_0xee69('0x55')]=function(_0x344800,_0x1dbdf1,_0x9882c7){return db[_0xee69('0x2e')]['find']({'where':{'id':_0x344800[_0xee69('0x54')]['id']},'attributes':[_0xee69('0x2a'),_0xee69('0x56'),_0xee69('0x57'),_0xee69('0x58')],'raw':!![]})[_0xee69('0x24')](handleEntityNotFound(_0x1dbdf1,null))[_0xee69('0x24')](function(_0x1d6956){if(_0x1d6956){if(!fs[_0xee69('0x59')](path[_0xee69('0x5a')](config['root'],_0xee69('0x5b'),_0x1d6956['savename']))){throw new db['Sequelize']['ValidationError'](_0xee69('0x5c'));}if(_0x344800[_0xee69('0x33')][_0xee69('0x5d')]){return _0x1dbdf1[_0xee69('0x17')](0xc8);}return _0x1dbdf1['download'](path[_0xee69('0x5a')](config['root'],'server/files/reports',_0x1d6956[_0xee69('0x57')]),util['format'](_0xee69('0x5e'),_0x1d6956[_0xee69('0x56')]||_0x1d6956[_0xee69('0x2a')],_0x1d6956[_0xee69('0x58')][_0xee69('0x5f')]()));}})[_0xee69('0x46')](handleError(_0x1dbdf1,null));}; \ No newline at end of file +var _0x5651=['toLowerCase','rimraf','zip-dir','moment','mustache','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/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','offset','count','set','apply','reject','update','then','destroy','ExtractedReports','UserProfileResource','end','error','name','send','index','map','AnalyticExtractedReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','options','includeAll','findAll','rows','params','length','include','merge','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','output','existsSync','join','root','server/files/reports','savename','Sequelize','ValidationError','format'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0x5651,0x1d2));var _0x1565=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x5651[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1565('0x0'));var zipdir=require(_0x1565('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1565('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x1565('0x3'));var util=require('util');var path=require(_0x1565('0x4'));var sox=require(_0x1565('0x5'));var csv=require(_0x1565('0x6'));var ejs=require(_0x1565('0x7'));var fs=require('fs');var fs_extra=require(_0x1565('0x8'));var _=require(_0x1565('0x9'));var squel=require(_0x1565('0xa'));var crypto=require(_0x1565('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x1565('0xc'));var toCsv=require('to-csv');var querystring=require(_0x1565('0xd'));var Papa=require(_0x1565('0xe'));var Redis=require(_0x1565('0xf'));var authService=require(_0x1565('0x10'));var qs=require(_0x1565('0x11'));var as=require(_0x1565('0x12'));var hardwareService=require(_0x1565('0x13'));var logger=require(_0x1565('0x14'))(_0x1565('0x15'));var utils=require('../../config/utils');var config=require(_0x1565('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x1565('0x17'))['db'];function respondWithStatusCode(_0x2b9c99,_0x26da87){_0x26da87=_0x26da87||0xcc;return function(_0x29ec8a){if(_0x29ec8a){return _0x2b9c99[_0x1565('0x18')](_0x26da87);}return _0x2b9c99[_0x1565('0x19')](_0x26da87)['end']();};}function respondWithResult(_0x2f4383,_0x56e5e0){_0x56e5e0=_0x56e5e0||0xc8;return function(_0x5b6256){if(_0x5b6256){return _0x2f4383['status'](_0x56e5e0)[_0x1565('0x1a')](_0x5b6256);}};}function respondWithFilteredResult(_0x4c106e,_0x250e2c){return function(_0x47de24){if(_0x47de24){var _0x336737=typeof _0x250e2c['offset']===_0x1565('0x1b')&&typeof _0x250e2c[_0x1565('0x1c')]===_0x1565('0x1b');var _0x36e110=_0x47de24['count'];var _0x50bfa1=_0x336737?0x0:_0x250e2c[_0x1565('0x1d')];var _0x4a82aa=_0x336737?_0x47de24[_0x1565('0x1e')]:_0x250e2c[_0x1565('0x1d')]+_0x250e2c[_0x1565('0x1c')];var _0x23bf15;if(_0x4a82aa>=_0x36e110){_0x4a82aa=_0x36e110;_0x23bf15=0xc8;}else{_0x23bf15=0xce;}_0x4c106e[_0x1565('0x19')](_0x23bf15);return _0x4c106e[_0x1565('0x1f')]('Content-Range',_0x50bfa1+'-'+_0x4a82aa+'/'+_0x36e110)[_0x1565('0x1a')](_0x47de24);}return null;};}function patchUpdates(_0x279b2d){return function(_0x2f7797){try{jsonpatch[_0x1565('0x20')](_0x2f7797,_0x279b2d,!![]);}catch(_0x45b276){return BPromise[_0x1565('0x21')](_0x45b276);}return _0x2f7797['save']();};}function saveUpdates(_0x480ad3,_0x2da061){return function(_0x410b4c){if(_0x410b4c){return _0x410b4c[_0x1565('0x22')](_0x480ad3)[_0x1565('0x23')](function(_0x3591af){return _0x3591af;});}return null;};}function removeEntity(_0x4f5d9a,_0x302681){return function(_0x5cc509){if(_0x5cc509){return _0x5cc509[_0x1565('0x24')]()[_0x1565('0x23')](function(){var _0x3f44a1=_0x5cc509['get']({'plain':!![]});var _0x325863=_0x1565('0x25');return db[_0x1565('0x26')][_0x1565('0x24')]({'where':{'type':_0x325863,'resourceId':_0x3f44a1['id']}})['then'](function(){return _0x5cc509;});})['then'](function(){_0x4f5d9a['status'](0xcc)[_0x1565('0x27')]();});}};}function handleEntityNotFound(_0x32ebc3,_0x524c3d){return function(_0x5d2f15){if(!_0x5d2f15){_0x32ebc3[_0x1565('0x18')](0x194);}return _0x5d2f15;};}function handleError(_0x15611c,_0x3c2a46){_0x3c2a46=_0x3c2a46||0x1f4;return function(_0x30a5c2){logger[_0x1565('0x28')](_0x30a5c2['stack']);if(_0x30a5c2[_0x1565('0x29')]){delete _0x30a5c2[_0x1565('0x29')];}_0x15611c[_0x1565('0x19')](_0x3c2a46)[_0x1565('0x2a')](_0x30a5c2);};}exports[_0x1565('0x2b')]=function(_0x336835,_0x178a67){var _0x4a32f1={},_0x1ca969={},_0x2543c1={'count':0x0,'rows':[]};var _0x40ec8d=_[_0x1565('0x2c')](db[_0x1565('0x2d')][_0x1565('0x2e')],function(_0x4a69b5){return{'name':_0x4a69b5['fieldName'],'type':_0x4a69b5[_0x1565('0x2f')][_0x1565('0x30')]};});_0x1ca969[_0x1565('0x31')]=_[_0x1565('0x2c')](_0x40ec8d,'name');_0x1ca969[_0x1565('0x32')]=_[_0x1565('0x33')](_0x336835[_0x1565('0x32')]);_0x1ca969[_0x1565('0x34')]=_[_0x1565('0x35')](_0x1ca969['model'],_0x1ca969[_0x1565('0x32')]);_0x4a32f1[_0x1565('0x36')]=_[_0x1565('0x35')](_0x1ca969[_0x1565('0x31')],qs['fields'](_0x336835[_0x1565('0x32')][_0x1565('0x37')]));_0x4a32f1[_0x1565('0x36')]=_0x4a32f1[_0x1565('0x36')]['length']?_0x4a32f1[_0x1565('0x36')]:_0x1ca969[_0x1565('0x31')];if(!_0x336835[_0x1565('0x32')][_0x1565('0x38')](_0x1565('0x39'))){_0x4a32f1[_0x1565('0x1c')]=qs['limit'](_0x336835['query'][_0x1565('0x1c')]);_0x4a32f1['offset']=qs[_0x1565('0x1d')](_0x336835[_0x1565('0x32')][_0x1565('0x1d')]);}_0x4a32f1[_0x1565('0x3a')]=qs[_0x1565('0x3b')](_0x336835['query'][_0x1565('0x3b')]);_0x4a32f1['where']=qs[_0x1565('0x34')](_[_0x1565('0x3c')](_0x336835[_0x1565('0x32')],_0x1ca969[_0x1565('0x34')]),_0x40ec8d);if(_0x336835['query'][_0x1565('0x3d')]){_0x4a32f1[_0x1565('0x3e')]=_['merge'](_0x4a32f1[_0x1565('0x3e')],{'$or':_[_0x1565('0x2c')](_0x40ec8d,function(_0x2811d9){if(_0x2811d9['type']!=='VIRTUAL'){var _0xcc55c4={};_0xcc55c4[_0x2811d9[_0x1565('0x29')]]={'$like':'%'+_0x336835[_0x1565('0x32')][_0x1565('0x3d')]+'%'};return _0xcc55c4;}})});}_0x4a32f1=_['merge']({},_0x4a32f1,_0x336835[_0x1565('0x3f')]);var _0x20dda2={'where':_0x4a32f1['where']};return db['AnalyticExtractedReport'][_0x1565('0x1e')](_0x20dda2)['then'](function(_0x44c342){_0x2543c1['count']=_0x44c342;if(_0x336835[_0x1565('0x32')][_0x1565('0x40')]){_0x4a32f1['include']=[{'all':!![]}];}return db[_0x1565('0x2d')][_0x1565('0x41')](_0x4a32f1);})[_0x1565('0x23')](function(_0x3757c4){_0x2543c1[_0x1565('0x42')]=_0x3757c4;return _0x2543c1;})[_0x1565('0x23')](respondWithFilteredResult(_0x178a67,_0x4a32f1))['catch'](handleError(_0x178a67,null));};exports['show']=function(_0x4e2355,_0x13ebbb){var _0x40a5c9={'raw':!![],'where':{'id':_0x4e2355[_0x1565('0x43')]['id']}},_0x13c610={};_0x13c610[_0x1565('0x31')]=_[_0x1565('0x33')](db[_0x1565('0x2d')]['rawAttributes']);_0x13c610[_0x1565('0x32')]=_[_0x1565('0x33')](_0x4e2355[_0x1565('0x32')]);_0x13c610[_0x1565('0x34')]=_[_0x1565('0x35')](_0x13c610[_0x1565('0x31')],_0x13c610[_0x1565('0x32')]);_0x40a5c9[_0x1565('0x36')]=_[_0x1565('0x35')](_0x13c610[_0x1565('0x31')],qs[_0x1565('0x37')](_0x4e2355['query'][_0x1565('0x37')]));_0x40a5c9['attributes']=_0x40a5c9[_0x1565('0x36')][_0x1565('0x44')]?_0x40a5c9[_0x1565('0x36')]:_0x13c610['model'];if(_0x4e2355[_0x1565('0x32')][_0x1565('0x40')]){_0x40a5c9[_0x1565('0x45')]=[{'all':!![]}];}_0x40a5c9=_[_0x1565('0x46')]({},_0x40a5c9,_0x4e2355[_0x1565('0x3f')]);return db[_0x1565('0x2d')][_0x1565('0x47')](_0x40a5c9)[_0x1565('0x23')](handleEntityNotFound(_0x13ebbb,null))[_0x1565('0x23')](respondWithResult(_0x13ebbb,null))[_0x1565('0x48')](handleError(_0x13ebbb,null));};exports[_0x1565('0x49')]=function(_0x4ed937,_0x5f2e00){return db['AnalyticExtractedReport'][_0x1565('0x49')](_0x4ed937[_0x1565('0x4a')],{})[_0x1565('0x23')](function(_0x49a0f7){var _0x2b14a5=_0x4ed937[_0x1565('0x4b')][_0x1565('0x4c')]({'plain':!![]});if(!_0x2b14a5)throw new Error(_0x1565('0x4d'));if(_0x2b14a5[_0x1565('0x4e')]==='user'){var _0x1cca39=_0x49a0f7[_0x1565('0x4c')]({'plain':!![]});var _0x4e83bf=_0x1565('0x25');return db[_0x1565('0x4f')][_0x1565('0x47')]({'where':{'name':_0x4e83bf,'userProfileId':_0x2b14a5['userProfileId']},'raw':!![]})[_0x1565('0x23')](function(_0xbf9004){if(_0xbf9004&&_0xbf9004['autoAssociation']===0x0){return db[_0x1565('0x26')]['create']({'name':_0x1cca39[_0x1565('0x29')],'resourceId':_0x1cca39['id'],'type':_0xbf9004['name'],'sectionId':_0xbf9004['id']},{})[_0x1565('0x23')](function(){return _0x49a0f7;});}else{return _0x49a0f7;}})[_0x1565('0x48')](function(_0x219a50){logger[_0x1565('0x28')](_0x1565('0x50'),_0x219a50);throw _0x219a50;});}return _0x49a0f7;})[_0x1565('0x23')](respondWithResult(_0x5f2e00,0xc9))['catch'](handleError(_0x5f2e00,null));};exports[_0x1565('0x22')]=function(_0xefba65,_0x35c8c1){if(_0xefba65[_0x1565('0x4a')]['id']){delete _0xefba65[_0x1565('0x4a')]['id'];}return db[_0x1565('0x2d')]['find']({'where':{'id':_0xefba65[_0x1565('0x43')]['id']}})[_0x1565('0x23')](handleEntityNotFound(_0x35c8c1,null))[_0x1565('0x23')](saveUpdates(_0xefba65[_0x1565('0x4a')],null))['then'](respondWithResult(_0x35c8c1,null))[_0x1565('0x48')](handleError(_0x35c8c1,null));};exports['destroy']=function(_0x3ff460,_0x4e1c98){return db[_0x1565('0x2d')][_0x1565('0x47')]({'where':{'id':_0x3ff460[_0x1565('0x43')]['id']}})[_0x1565('0x23')](handleEntityNotFound(_0x4e1c98,null))[_0x1565('0x23')](removeEntity(_0x4e1c98,null))[_0x1565('0x48')](handleError(_0x4e1c98,null));};exports[_0x1565('0x51')]=function(_0x30b8c6,_0x287c3d,_0x562303){return db[_0x1565('0x2d')][_0x1565('0x47')]({'where':{'id':_0x30b8c6['params']['id']},'attributes':[_0x1565('0x29'),_0x1565('0x52'),'savename',_0x1565('0x53')],'raw':!![]})['then'](handleEntityNotFound(_0x287c3d,null))['then'](function(_0x41fe84){if(_0x41fe84){if(!fs[_0x1565('0x54')](path[_0x1565('0x55')](config[_0x1565('0x56')],_0x1565('0x57'),_0x41fe84[_0x1565('0x58')]))){throw new db[(_0x1565('0x59'))][(_0x1565('0x5a'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x30b8c6[_0x1565('0x32')]['exists']){return _0x287c3d['sendStatus'](0xc8);}return _0x287c3d['download'](path['join'](config[_0x1565('0x56')],_0x1565('0x57'),_0x41fe84[_0x1565('0x58')]),util[_0x1565('0x5b')]('%s.%s',_0x41fe84['basename']||_0x41fe84['name'],_0x41fe84[_0x1565('0x53')][_0x1565('0x5c')]()));}})[_0x1565('0x48')](handleError(_0x287c3d,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 994e2bb..8c8280e 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 _0xc2a0=['exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./analyticExtractedReport.attributes'];(function(_0x2d454f,_0x175085){var _0x37aaba=function(_0x2efe84){while(--_0x2efe84){_0x2d454f['push'](_0x2d454f['shift']());}};_0x37aaba(++_0x175085);}(_0xc2a0,0x154));var _0x0c2a=function(_0x9ffba8,_0x3f44ff){_0x9ffba8=_0x9ffba8-0x0;var _0x498ea9=_0xc2a0[_0x9ffba8];return _0x498ea9;};'use strict';var _=require(_0x0c2a('0x0'));var util=require(_0x0c2a('0x1'));var logger=require(_0x0c2a('0x2'))(_0x0c2a('0x3'));var moment=require(_0x0c2a('0x4'));var BPromise=require(_0x0c2a('0x5'));var rp=require(_0x0c2a('0x6'));var fs=require('fs');var path=require(_0x0c2a('0x7'));var rimraf=require(_0x0c2a('0x8'));var config=require('../../config/environment');var attributes=require(_0x0c2a('0x9'));module[_0x0c2a('0xa')]=function(_0x59fc6f,_0x4d0534){return _0x59fc6f[_0x0c2a('0xb')](_0x0c2a('0xc'),attributes,{'tableName':_0x0c2a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x471d=['./analyticExtractedReport.attributes','exports','define','analytics_extracted_reports','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x42ab5c,_0x31aa88){var _0xe24492=function(_0xc2815f){while(--_0xc2815f){_0x42ab5c['push'](_0x42ab5c['shift']());}};_0xe24492(++_0x31aa88);}(_0x471d,0x158));var _0xd471=function(_0x17baf6,_0x119c06){_0x17baf6=_0x17baf6-0x0;var _0x4b2cb3=_0x471d[_0x17baf6];return _0x4b2cb3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd471('0x0'))('api');var moment=require(_0xd471('0x1'));var BPromise=require(_0xd471('0x2'));var rp=require(_0xd471('0x3'));var fs=require('fs');var path=require(_0xd471('0x4'));var rimraf=require('rimraf');var config=require(_0xd471('0x5'));var attributes=require(_0xd471('0x6'));module[_0xd471('0x7')]=function(_0x39c303,_0x224906){return _0x39c303[_0xd471('0x8')]('AnalyticExtractedReport',attributes,{'tableName':_0xd471('0x9'),'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 c4517c0..1c6af19 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 _0xb067=['code','message','request\x20sent','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x34ff1f,_0x2363b2){var _0x26f1fe=function(_0x451812){while(--_0x451812){_0x34ff1f['push'](_0x34ff1f['shift']());}};_0x26f1fe(++_0x2363b2);}(_0xb067,0x13d));var _0x7b06=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb067[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7b06('0x0'));var util=require('util');var moment=require(_0x7b06('0x1'));var BPromise=require(_0x7b06('0x2'));var rs=require(_0x7b06('0x3'));var fs=require('fs');var Redis=require(_0x7b06('0x4'));var db=require(_0x7b06('0x5'))['db'];var utils=require(_0x7b06('0x6'));var logger=require(_0x7b06('0x7'))(_0x7b06('0x8'));var config=require(_0x7b06('0x9'));var jayson=require(_0x7b06('0xa'));var client=jayson[_0x7b06('0xb')][_0x7b06('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x52f91e,_0x28fcac,_0x2122c6){return new BPromise(function(_0xb1b161,_0x274003){return client[_0x7b06('0xd')](_0x52f91e,_0x2122c6)[_0x7b06('0xe')](function(_0x4e84a4){logger[_0x7b06('0xf')](_0x7b06('0x10'),_0x28fcac,'request\x20sent');logger[_0x7b06('0x11')](_0x7b06('0x12'),_0x28fcac,'request\x20sent',JSON[_0x7b06('0x13')](_0x4e84a4));if(_0x4e84a4[_0x7b06('0x14')]){if(_0x4e84a4[_0x7b06('0x14')][_0x7b06('0x15')]===0x1f4){logger[_0x7b06('0x14')](_0x7b06('0x10'),_0x28fcac,_0x4e84a4[_0x7b06('0x14')]['message']);return _0x274003(_0x4e84a4[_0x7b06('0x14')][_0x7b06('0x16')]);}logger[_0x7b06('0x14')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x28fcac,_0x4e84a4[_0x7b06('0x14')][_0x7b06('0x16')]);return _0xb1b161(_0x4e84a4[_0x7b06('0x14')][_0x7b06('0x16')]);}else{logger[_0x7b06('0xf')](_0x7b06('0x10'),_0x28fcac,_0x7b06('0x17'));_0xb1b161(_0x4e84a4[_0x7b06('0x18')][_0x7b06('0x16')]);}})[_0x7b06('0x19')](function(_0x246a58){logger[_0x7b06('0x14')](_0x7b06('0x10'),_0x28fcac,_0x246a58);_0x274003(_0x246a58);});});} \ No newline at end of file +var _0x7420=['AnalyticExtractedReport,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x596f90,_0x499ddb){var _0x1f2e8d=function(_0x551ca5){while(--_0x551ca5){_0x596f90['push'](_0x596f90['shift']());}};_0x1f2e8d(++_0x499ddb);}(_0x7420,0x122));var _0x0742=function(_0x3651d8,_0x4025b0){_0x3651d8=_0x3651d8-0x0;var _0x42aa89=_0x7420[_0x3651d8];return _0x42aa89;};'use strict';var _=require(_0x0742('0x0'));var util=require(_0x0742('0x1'));var moment=require(_0x0742('0x2'));var BPromise=require(_0x0742('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0742('0x4'));var db=require(_0x0742('0x5'))['db'];var utils=require(_0x0742('0x6'));var logger=require(_0x0742('0x7'))('rpc');var config=require(_0x0742('0x8'));var jayson=require(_0x0742('0x9'));var client=jayson[_0x0742('0xa')][_0x0742('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x30e510,_0x445acc,_0xd7900e){return new BPromise(function(_0x20ad6f,_0x529ab5){return client[_0x0742('0xc')](_0x30e510,_0xd7900e)['then'](function(_0x1c0eb8){logger['info']('AnalyticExtractedReport,\x20%s,\x20%s',_0x445acc,'request\x20sent');logger[_0x0742('0xd')](_0x0742('0xe'),_0x445acc,_0x0742('0xf'),JSON[_0x0742('0x10')](_0x1c0eb8));if(_0x1c0eb8[_0x0742('0x11')]){if(_0x1c0eb8['error']['code']===0x1f4){logger[_0x0742('0x11')](_0x0742('0x12'),_0x445acc,_0x1c0eb8['error'][_0x0742('0x13')]);return _0x529ab5(_0x1c0eb8['error']['message']);}logger[_0x0742('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x445acc,_0x1c0eb8[_0x0742('0x11')][_0x0742('0x13')]);return _0x20ad6f(_0x1c0eb8[_0x0742('0x11')]['message']);}else{logger[_0x0742('0x14')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x445acc,_0x0742('0xf'));_0x20ad6f(_0x1c0eb8[_0x0742('0x15')][_0x0742('0x13')]);}})['catch'](function(_0x22323f){logger[_0x0742('0x11')](_0x0742('0x12'),_0x445acc,_0x22323f);_0x529ab5(_0x22323f);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index a97f2d3..4dc7e04 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 _0x950e=['Router','fs-extra','../../components/auth/service','../../config/environment','./analyticExtractedReport.controller','get','index','isAuthenticated','/:id/download','post','create','/:id','update','destroy','exports','util','path','connect-timeout'];(function(_0x4a0e68,_0x45c08c){var _0x4fb274=function(_0x5f36b1){while(--_0x5f36b1){_0x4a0e68['push'](_0x4a0e68['shift']());}};_0x4fb274(++_0x45c08c);}(_0x950e,0x12f));var _0xe950=function(_0x49d931,_0x121258){_0x49d931=_0x49d931-0x0;var _0x491a2a=_0x950e[_0x49d931];return _0x491a2a;};'use strict';var multer=require('multer');var util=require(_0xe950('0x0'));var path=require(_0xe950('0x1'));var timeout=require(_0xe950('0x2'));var express=require('express');var router=express[_0xe950('0x3')]();var fs_extra=require(_0xe950('0x4'));var auth=require(_0xe950('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe950('0x6'));var controller=require(_0xe950('0x7'));router[_0xe950('0x8')]('/',auth['isAuthenticated'](),controller[_0xe950('0x9')]);router[_0xe950('0x8')]('/:id',auth[_0xe950('0xa')](),controller['show']);router[_0xe950('0x8')](_0xe950('0xb'),auth[_0xe950('0xa')](),controller['download']);router[_0xe950('0xc')]('/',auth['isAuthenticated'](),controller[_0xe950('0xd')]);router['put'](_0xe950('0xe'),auth[_0xe950('0xa')](),controller[_0xe950('0xf')]);router['delete'](_0xe950('0xe'),auth[_0xe950('0xa')](),controller[_0xe950('0x10')]);module[_0xe950('0x11')]=router; \ No newline at end of file +var _0x405f=['express','../../components/interaction/service','./analyticExtractedReport.controller','get','index','isAuthenticated','show','/:id/download','download','post','create','put','/:id','update','delete','destroy','exports','multer','util','path'];(function(_0x5e8c32,_0x1b1f3f){var _0x595f7b=function(_0x38840e){while(--_0x38840e){_0x5e8c32['push'](_0x5e8c32['shift']());}};_0x595f7b(++_0x1b1f3f);}(_0x405f,0x151));var _0xf405=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0x405f[_0x38ced4];return _0x547c07;};'use strict';var multer=require(_0xf405('0x0'));var util=require(_0xf405('0x1'));var path=require(_0xf405('0x2'));var timeout=require('connect-timeout');var express=require(_0xf405('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf405('0x4'));var config=require('../../config/environment');var controller=require(_0xf405('0x5'));router[_0xf405('0x6')]('/',auth['isAuthenticated'](),controller[_0xf405('0x7')]);router[_0xf405('0x6')]('/:id',auth[_0xf405('0x8')](),controller[_0xf405('0x9')]);router[_0xf405('0x6')](_0xf405('0xa'),auth[_0xf405('0x8')](),controller[_0xf405('0xb')]);router[_0xf405('0xc')]('/',auth[_0xf405('0x8')](),controller[_0xf405('0xd')]);router[_0xf405('0xe')](_0xf405('0xf'),auth['isAuthenticated'](),controller[_0xf405('0x10')]);router[_0xf405('0x11')](_0xf405('0xf'),auth['isAuthenticated'](),controller[_0xf405('0x12')]);module[_0xf405('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index e832162..2ba2ee5 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 _0x39fe=['STRING','BOOLEAN','exports','TEXT'];(function(_0x46cb5d,_0x21c4cd){var _0x23feaf=function(_0x218eba){while(--_0x218eba){_0x46cb5d['push'](_0x46cb5d['shift']());}};_0x23feaf(++_0x21c4cd);}(_0x39fe,0x1ea));var _0xe39f=function(_0x2a3367,_0x25913a){_0x2a3367=_0x2a3367-0x0;var _0x230264=_0x39fe[_0x2a3367];return _0x230264;};'use strict';var Sequelize=require('sequelize');module[_0xe39f('0x0')]={'field':{'type':Sequelize[_0xe39f('0x1')]},'alias':{'type':Sequelize[_0xe39f('0x2')]},'function':{'type':Sequelize[_0xe39f('0x2')]},'format':{'type':Sequelize[_0xe39f('0x2')]},'groupBy':{'type':Sequelize[_0xe39f('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0xe39f('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x933b=['exports','STRING','BOOLEAN','sequelize'];(function(_0xea33fb,_0x55d33a){var _0x4ef04a=function(_0x1ed2af){while(--_0x1ed2af){_0xea33fb['push'](_0xea33fb['shift']());}};_0x4ef04a(++_0x55d33a);}(_0x933b,0x123));var _0xb933=function(_0xe99af0,_0x192f03){_0xe99af0=_0xe99af0-0x0;var _0x3279b5=_0x933b[_0xe99af0];return _0x3279b5;};'use strict';var Sequelize=require(_0xb933('0x0'));module[_0xb933('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0xb933('0x2')]},'format':{'type':Sequelize[_0xb933('0x2')]},'groupBy':{'type':Sequelize[_0xb933('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xb933('0x2')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index f3805e8..75f1933 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 _0x5a12=['mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','create','body','bulkCreate','find','params','ids','AnalyticCustomReport','findOne','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0xe6f0ec,_0x263b0f){var _0x1beb99=function(_0x5e4bf5){while(--_0x5e4bf5){_0xe6f0ec['push'](_0xe6f0ec['shift']());}};_0x1beb99(++_0x263b0f);}(_0x5a12,0x18a));var _0x25a1=function(_0x19d683,_0x361812){_0x19d683=_0x19d683-0x0;var _0x52d1f9=_0x5a12[_0x19d683];return _0x52d1f9;};'use strict';var emlformat=require(_0x25a1('0x0'));var rimraf=require(_0x25a1('0x1'));var zipdir=require(_0x25a1('0x2'));var jsonpatch=require(_0x25a1('0x3'));var rp=require(_0x25a1('0x4'));var moment=require(_0x25a1('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x25a1('0x6'));var util=require(_0x25a1('0x7'));var path=require(_0x25a1('0x8'));var sox=require('sox');var csv=require(_0x25a1('0x9'));var ejs=require(_0x25a1('0xa'));var fs=require('fs');var fs_extra=require(_0x25a1('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x25a1('0xc'));var jsforce=require(_0x25a1('0xd'));var deskjs=require(_0x25a1('0xe'));var toCsv=require(_0x25a1('0x9'));var querystring=require(_0x25a1('0xf'));var Papa=require('papaparse');var Redis=require(_0x25a1('0x10'));var authService=require(_0x25a1('0x11'));var qs=require(_0x25a1('0x12'));var as=require(_0x25a1('0x13'));var hardwareService=require(_0x25a1('0x14'));var logger=require(_0x25a1('0x15'))('api');var utils=require(_0x25a1('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x25a1('0x17'));var db=require(_0x25a1('0x18'))['db'];function respondWithStatusCode(_0x9fe551,_0x3cdb51){_0x3cdb51=_0x3cdb51||0xcc;return function(_0xbed503){if(_0xbed503){return _0x9fe551[_0x25a1('0x19')](_0x3cdb51);}return _0x9fe551['status'](_0x3cdb51)[_0x25a1('0x1a')]();};}function respondWithResult(_0x4cda30,_0x28b081){_0x28b081=_0x28b081||0xc8;return function(_0x52c0aa){if(_0x52c0aa){return _0x4cda30[_0x25a1('0x1b')](_0x28b081)[_0x25a1('0x1c')](_0x52c0aa);}};}function respondWithFilteredResult(_0x272234,_0x4c8f8f){return function(_0xe41df5){if(_0xe41df5){var _0x127d98=typeof _0x4c8f8f['offset']===_0x25a1('0x1d')&&typeof _0x4c8f8f[_0x25a1('0x1e')]===_0x25a1('0x1d');var _0x38814e=_0xe41df5['count'];var _0xb06ff9=_0x127d98?0x0:_0x4c8f8f[_0x25a1('0x1f')];var _0x2ab84c=_0x127d98?_0xe41df5[_0x25a1('0x20')]:_0x4c8f8f[_0x25a1('0x1f')]+_0x4c8f8f[_0x25a1('0x1e')];var _0x27b133;if(_0x2ab84c>=_0x38814e){_0x2ab84c=_0x38814e;_0x27b133=0xc8;}else{_0x27b133=0xce;}_0x272234['status'](_0x27b133);return _0x272234[_0x25a1('0x21')](_0x25a1('0x22'),_0xb06ff9+'-'+_0x2ab84c+'/'+_0x38814e)[_0x25a1('0x1c')](_0xe41df5);}return null;};}function patchUpdates(_0x42b586){return function(_0x15d8c5){try{jsonpatch[_0x25a1('0x23')](_0x15d8c5,_0x42b586,!![]);}catch(_0x49318a){return BPromise[_0x25a1('0x24')](_0x49318a);}return _0x15d8c5['save']();};}function saveUpdates(_0x1fbb0a,_0x26860d){return function(_0x70e9fc){if(_0x70e9fc){return _0x70e9fc[_0x25a1('0x25')](_0x1fbb0a)['then'](function(_0x503037){return _0x503037;});}return null;};}function removeEntity(_0x49e8e5,_0x1d10aa){return function(_0x77d166){if(_0x77d166){return _0x77d166[_0x25a1('0x26')]()[_0x25a1('0x27')](function(){_0x49e8e5[_0x25a1('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58849a,_0x25ad34){return function(_0x3eddd4){if(!_0x3eddd4){_0x58849a['sendStatus'](0x194);}return _0x3eddd4;};}function handleError(_0x2c7e83,_0x2432bf){_0x2432bf=_0x2432bf||0x1f4;return function(_0x9d2b2f){logger[_0x25a1('0x28')](_0x9d2b2f[_0x25a1('0x29')]);if(_0x9d2b2f[_0x25a1('0x2a')]){delete _0x9d2b2f['name'];}_0x2c7e83[_0x25a1('0x1b')](_0x2432bf)['send'](_0x9d2b2f);};}exports[_0x25a1('0x2b')]=function(_0x149f16,_0x19448e){var _0x5c7839={},_0x56fa1b={},_0x2e1132={'count':0x0,'rows':[]};var _0x52d015=_[_0x25a1('0x2c')](db[_0x25a1('0x2d')][_0x25a1('0x2e')],function(_0xb933b5){return{'name':_0xb933b5[_0x25a1('0x2f')],'type':_0xb933b5[_0x25a1('0x30')][_0x25a1('0x31')]};});_0x56fa1b[_0x25a1('0x32')]=_[_0x25a1('0x2c')](_0x52d015,'name');_0x56fa1b['query']=_[_0x25a1('0x33')](_0x149f16[_0x25a1('0x34')]);_0x56fa1b[_0x25a1('0x35')]=_[_0x25a1('0x36')](_0x56fa1b['model'],_0x56fa1b[_0x25a1('0x34')]);_0x5c7839['attributes']=_[_0x25a1('0x36')](_0x56fa1b['model'],qs['fields'](_0x149f16[_0x25a1('0x34')][_0x25a1('0x37')]));_0x5c7839[_0x25a1('0x38')]=_0x5c7839['attributes'][_0x25a1('0x39')]?_0x5c7839[_0x25a1('0x38')]:_0x56fa1b[_0x25a1('0x32')];if(!_0x149f16['query'][_0x25a1('0x3a')](_0x25a1('0x3b'))){_0x5c7839[_0x25a1('0x1e')]=qs[_0x25a1('0x1e')](_0x149f16[_0x25a1('0x34')][_0x25a1('0x1e')]);_0x5c7839[_0x25a1('0x1f')]=qs[_0x25a1('0x1f')](_0x149f16[_0x25a1('0x34')][_0x25a1('0x1f')]);}_0x5c7839['order']=qs['sort'](_0x149f16[_0x25a1('0x34')][_0x25a1('0x3c')]);_0x5c7839[_0x25a1('0x3d')]=qs[_0x25a1('0x35')](_[_0x25a1('0x3e')](_0x149f16[_0x25a1('0x34')],_0x56fa1b[_0x25a1('0x35')]),_0x52d015);if(_0x149f16[_0x25a1('0x34')][_0x25a1('0x3f')]){_0x5c7839['where']=_['merge'](_0x5c7839[_0x25a1('0x3d')],{'$or':_[_0x25a1('0x2c')](_0x52d015,function(_0x3281c4){if(_0x3281c4['type']!==_0x25a1('0x40')){var _0x208429={};_0x208429[_0x3281c4[_0x25a1('0x2a')]]={'$like':'%'+_0x149f16[_0x25a1('0x34')]['filter']+'%'};return _0x208429;}})});}_0x5c7839=_[_0x25a1('0x41')]({},_0x5c7839,_0x149f16[_0x25a1('0x42')]);var _0x15882d={'where':_0x5c7839[_0x25a1('0x3d')]};return db[_0x25a1('0x2d')][_0x25a1('0x20')](_0x15882d)[_0x25a1('0x27')](function(_0x2647c0){_0x2e1132[_0x25a1('0x20')]=_0x2647c0;if(_0x149f16[_0x25a1('0x34')]['includeAll']){_0x5c7839[_0x25a1('0x43')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x25a1('0x44')](_0x5c7839);})[_0x25a1('0x27')](function(_0x11b4bc){_0x2e1132[_0x25a1('0x45')]=_0x11b4bc;return _0x2e1132;})['then'](respondWithFilteredResult(_0x19448e,_0x5c7839))[_0x25a1('0x46')](handleError(_0x19448e,null));};exports['show']=function(_0x3a6431,_0x4a6e46){var _0x31fee1={'raw':![],'where':{'id':_0x3a6431['params']['id']}},_0x97e1e2={};_0x97e1e2[_0x25a1('0x32')]=_[_0x25a1('0x33')](db[_0x25a1('0x2d')][_0x25a1('0x2e')]);_0x97e1e2[_0x25a1('0x34')]=_[_0x25a1('0x33')](_0x3a6431[_0x25a1('0x34')]);_0x97e1e2[_0x25a1('0x35')]=_[_0x25a1('0x36')](_0x97e1e2[_0x25a1('0x32')],_0x97e1e2['query']);_0x31fee1[_0x25a1('0x38')]=_[_0x25a1('0x36')](_0x97e1e2[_0x25a1('0x32')],qs['fields'](_0x3a6431['query'][_0x25a1('0x37')]));_0x31fee1[_0x25a1('0x38')]=_0x31fee1[_0x25a1('0x38')][_0x25a1('0x39')]?_0x31fee1[_0x25a1('0x38')]:_0x97e1e2[_0x25a1('0x32')];if(_0x3a6431[_0x25a1('0x34')]['includeAll']){_0x31fee1[_0x25a1('0x43')]=[{'all':!![]}];}_0x31fee1=_['merge']({},_0x31fee1,_0x3a6431[_0x25a1('0x42')]);return db[_0x25a1('0x2d')]['find'](_0x31fee1)[_0x25a1('0x27')](handleEntityNotFound(_0x4a6e46,null))[_0x25a1('0x27')](respondWithResult(_0x4a6e46,null))[_0x25a1('0x46')](handleError(_0x4a6e46,null));};exports[_0x25a1('0x47')]=function(_0x41b598,_0x42b4ec){return db['AnalyticFieldReport'][_0x25a1('0x47')](_0x41b598[_0x25a1('0x48')],{})['then'](respondWithResult(_0x42b4ec,0xc9))[_0x25a1('0x46')](handleError(_0x42b4ec,null));};exports[_0x25a1('0x49')]=function(_0x542fee,_0x248242){return db[_0x25a1('0x2d')]['bulkCreate'](_0x542fee['body'],{'raw':![],'individualHooks':!![]})[_0x25a1('0x27')](respondWithResult(_0x248242,0xc9))[_0x25a1('0x46')](handleError(_0x248242,null));};exports[_0x25a1('0x25')]=function(_0x17625d,_0x3ab5c5){if(_0x17625d[_0x25a1('0x48')]['id']){delete _0x17625d[_0x25a1('0x48')]['id'];}return db[_0x25a1('0x2d')][_0x25a1('0x4a')]({'where':{'id':_0x17625d[_0x25a1('0x4b')]['id']}})[_0x25a1('0x27')](handleEntityNotFound(_0x3ab5c5,null))[_0x25a1('0x27')](saveUpdates(_0x17625d[_0x25a1('0x48')],null))[_0x25a1('0x27')](respondWithResult(_0x3ab5c5,null))['catch'](handleError(_0x3ab5c5,null));};exports[_0x25a1('0x26')]=function(_0x836293,_0x4adf09){return db['AnalyticFieldReport']['find']({'where':{'id':_0x836293['params']['id']}})[_0x25a1('0x27')](handleEntityNotFound(_0x4adf09,null))[_0x25a1('0x27')](removeEntity(_0x4adf09,null))[_0x25a1('0x46')](handleError(_0x4adf09,null));};exports['bulkDestroy']=function(_0x4f160f,_0x54defe){return db[_0x25a1('0x2d')]['destroy']({'where':{'id':_0x4f160f[_0x25a1('0x34')][_0x25a1('0x4c')]||[]},'raw':![],'individualHooks':!![]})[_0x25a1('0x27')](respondWithResult(_0x54defe,0xcc))['catch'](handleError(_0x54defe,null));};exports['addFields']=function(_0x9655d4,_0x14c129,_0x496e6e){return db[_0x25a1('0x4d')][_0x25a1('0x4e')]({'where':{'id':_0x9655d4['params']['id']}})[_0x25a1('0x27')](handleEntityNotFound(_0x14c129,null))[_0x25a1('0x27')](function(_0x56c82c){if(_0x56c82c){return db['sequelize']['transaction'](function(_0x2a3c0f){return db[_0x25a1('0x2d')]['destroy']({'where':{'CustomReportId':_0x9655d4[_0x25a1('0x4b')]['id']},'transaction':_0x2a3c0f})[_0x25a1('0x27')](function(_0x146534){var _0x19048a=_['map'](_0x9655d4[_0x25a1('0x48')],function(_0x5a2b43){delete _0x5a2b43['id'];_0x5a2b43[_0x25a1('0x4f')]=_0x9655d4[_0x25a1('0x4b')]['id'];return _0x5a2b43;});return db['AnalyticFieldReport']['bulkCreate'](_0x19048a,{'transaction':_0x2a3c0f});});})[_0x25a1('0x27')](function(){return db[_0x25a1('0x2d')][_0x25a1('0x44')]({'where':{'CustomReportId':_0x9655d4[_0x25a1('0x4b')]['id']}});});}})[_0x25a1('0x27')](respondWithResult(_0x14c129,null))[_0x25a1('0x46')](handleError(_0x14c129,null));}; \ No newline at end of file +var _0xab62=['../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','index','rawAttributes','fieldName','type','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','AnalyticFieldReport','includeAll','findAll','rows','catch','show','include','find','create','body','bulkCreate','params','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','transaction','CustomReportId','eml-format','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment'];(function(_0x1f0e25,_0x1dc15d){var _0x4810e6=function(_0x193327){while(--_0x193327){_0x1f0e25['push'](_0x1f0e25['shift']());}};_0x4810e6(++_0x1dc15d);}(_0xab62,0xdf));var _0x2ab6=function(_0x22e108,_0x534a11){_0x22e108=_0x22e108-0x0;var _0x2fd054=_0xab62[_0x22e108];return _0x2fd054;};'use strict';var emlformat=require(_0x2ab6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2ab6('0x1'));var rp=require('request-promise');var moment=require(_0x2ab6('0x2'));var BPromise=require(_0x2ab6('0x3'));var Mustache=require(_0x2ab6('0x4'));var util=require(_0x2ab6('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x2ab6('0x6'));var ejs=require(_0x2ab6('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2ab6('0x8'));var crypto=require(_0x2ab6('0x9'));var jsforce=require(_0x2ab6('0xa'));var deskjs=require(_0x2ab6('0xb'));var toCsv=require(_0x2ab6('0x6'));var querystring=require(_0x2ab6('0xc'));var Papa=require('papaparse');var Redis=require(_0x2ab6('0xd'));var authService=require(_0x2ab6('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x2ab6('0xf'));var hardwareService=require(_0x2ab6('0x10'));var logger=require(_0x2ab6('0x11'))(_0x2ab6('0x12'));var utils=require('../../config/utils');var config=require(_0x2ab6('0x13'));var licenseUtil=require(_0x2ab6('0x14'));var db=require(_0x2ab6('0x15'))['db'];function respondWithStatusCode(_0x48ed90,_0x1dc417){_0x1dc417=_0x1dc417||0xcc;return function(_0x352663){if(_0x352663){return _0x48ed90[_0x2ab6('0x16')](_0x1dc417);}return _0x48ed90[_0x2ab6('0x17')](_0x1dc417)['end']();};}function respondWithResult(_0x41b432,_0x4c5210){_0x4c5210=_0x4c5210||0xc8;return function(_0x9e4c2d){if(_0x9e4c2d){return _0x41b432[_0x2ab6('0x17')](_0x4c5210)[_0x2ab6('0x18')](_0x9e4c2d);}};}function respondWithFilteredResult(_0x38a3b1,_0x14508b){return function(_0x3bf8b1){if(_0x3bf8b1){var _0x57b011=typeof _0x14508b['offset']==='undefined'&&typeof _0x14508b['limit']===_0x2ab6('0x19');var _0x6fb55=_0x3bf8b1[_0x2ab6('0x1a')];var _0x5e493f=_0x57b011?0x0:_0x14508b['offset'];var _0x30529c=_0x57b011?_0x3bf8b1[_0x2ab6('0x1a')]:_0x14508b[_0x2ab6('0x1b')]+_0x14508b['limit'];var _0x125f04;if(_0x30529c>=_0x6fb55){_0x30529c=_0x6fb55;_0x125f04=0xc8;}else{_0x125f04=0xce;}_0x38a3b1[_0x2ab6('0x17')](_0x125f04);return _0x38a3b1['set'](_0x2ab6('0x1c'),_0x5e493f+'-'+_0x30529c+'/'+_0x6fb55)[_0x2ab6('0x18')](_0x3bf8b1);}return null;};}function patchUpdates(_0x317aed){return function(_0x118069){try{jsonpatch['apply'](_0x118069,_0x317aed,!![]);}catch(_0x5a15a9){return BPromise[_0x2ab6('0x1d')](_0x5a15a9);}return _0x118069[_0x2ab6('0x1e')]();};}function saveUpdates(_0x4baecd,_0x2323e0){return function(_0x499b9e){if(_0x499b9e){return _0x499b9e[_0x2ab6('0x1f')](_0x4baecd)[_0x2ab6('0x20')](function(_0x52a7d6){return _0x52a7d6;});}return null;};}function removeEntity(_0xd28798,_0x580c68){return function(_0xa1d17c){if(_0xa1d17c){return _0xa1d17c[_0x2ab6('0x21')]()['then'](function(){_0xd28798[_0x2ab6('0x17')](0xcc)[_0x2ab6('0x22')]();});}};}function handleEntityNotFound(_0x37872d,_0x33a0d8){return function(_0x4a00a0){if(!_0x4a00a0){_0x37872d[_0x2ab6('0x16')](0x194);}return _0x4a00a0;};}function handleError(_0x108d25,_0x45d2fc){_0x45d2fc=_0x45d2fc||0x1f4;return function(_0x4cdacf){logger[_0x2ab6('0x23')](_0x4cdacf[_0x2ab6('0x24')]);if(_0x4cdacf[_0x2ab6('0x25')]){delete _0x4cdacf[_0x2ab6('0x25')];}_0x108d25[_0x2ab6('0x17')](_0x45d2fc)[_0x2ab6('0x26')](_0x4cdacf);};}exports[_0x2ab6('0x27')]=function(_0x4fb1ed,_0x48359a){var _0x2a491f={},_0x8e389c={},_0x4c7267={'count':0x0,'rows':[]};var _0x59dc14=_['map'](db['AnalyticFieldReport'][_0x2ab6('0x28')],function(_0x205460){return{'name':_0x205460[_0x2ab6('0x29')],'type':_0x205460[_0x2ab6('0x2a')]['key']};});_0x8e389c[_0x2ab6('0x2b')]=_[_0x2ab6('0x2c')](_0x59dc14,_0x2ab6('0x25'));_0x8e389c[_0x2ab6('0x2d')]=_[_0x2ab6('0x2e')](_0x4fb1ed[_0x2ab6('0x2d')]);_0x8e389c['filters']=_[_0x2ab6('0x2f')](_0x8e389c['model'],_0x8e389c['query']);_0x2a491f[_0x2ab6('0x30')]=_[_0x2ab6('0x2f')](_0x8e389c['model'],qs[_0x2ab6('0x31')](_0x4fb1ed[_0x2ab6('0x2d')][_0x2ab6('0x31')]));_0x2a491f[_0x2ab6('0x30')]=_0x2a491f[_0x2ab6('0x30')][_0x2ab6('0x32')]?_0x2a491f[_0x2ab6('0x30')]:_0x8e389c['model'];if(!_0x4fb1ed[_0x2ab6('0x2d')][_0x2ab6('0x33')]('nolimit')){_0x2a491f[_0x2ab6('0x34')]=qs['limit'](_0x4fb1ed['query'][_0x2ab6('0x34')]);_0x2a491f[_0x2ab6('0x1b')]=qs[_0x2ab6('0x1b')](_0x4fb1ed[_0x2ab6('0x2d')]['offset']);}_0x2a491f[_0x2ab6('0x35')]=qs[_0x2ab6('0x36')](_0x4fb1ed[_0x2ab6('0x2d')][_0x2ab6('0x36')]);_0x2a491f[_0x2ab6('0x37')]=qs[_0x2ab6('0x38')](_[_0x2ab6('0x39')](_0x4fb1ed[_0x2ab6('0x2d')],_0x8e389c[_0x2ab6('0x38')]),_0x59dc14);if(_0x4fb1ed['query'][_0x2ab6('0x3a')]){_0x2a491f[_0x2ab6('0x37')]=_['merge'](_0x2a491f['where'],{'$or':_[_0x2ab6('0x2c')](_0x59dc14,function(_0x38d0a2){if(_0x38d0a2[_0x2ab6('0x2a')]!==_0x2ab6('0x3b')){var _0x46cee3={};_0x46cee3[_0x38d0a2[_0x2ab6('0x25')]]={'$like':'%'+_0x4fb1ed['query'][_0x2ab6('0x3a')]+'%'};return _0x46cee3;}})});}_0x2a491f=_[_0x2ab6('0x3c')]({},_0x2a491f,_0x4fb1ed[_0x2ab6('0x3d')]);var _0x38d5e4={'where':_0x2a491f['where']};return db[_0x2ab6('0x3e')]['count'](_0x38d5e4)['then'](function(_0x3692fd){_0x4c7267['count']=_0x3692fd;if(_0x4fb1ed[_0x2ab6('0x2d')][_0x2ab6('0x3f')]){_0x2a491f['include']=[{'all':!![]}];}return db[_0x2ab6('0x3e')][_0x2ab6('0x40')](_0x2a491f);})[_0x2ab6('0x20')](function(_0x3ff220){_0x4c7267[_0x2ab6('0x41')]=_0x3ff220;return _0x4c7267;})[_0x2ab6('0x20')](respondWithFilteredResult(_0x48359a,_0x2a491f))[_0x2ab6('0x42')](handleError(_0x48359a,null));};exports[_0x2ab6('0x43')]=function(_0x3d92ff,_0x2ac5f6){var _0x3e1329={'raw':![],'where':{'id':_0x3d92ff['params']['id']}},_0x390939={};_0x390939[_0x2ab6('0x2b')]=_[_0x2ab6('0x2e')](db['AnalyticFieldReport']['rawAttributes']);_0x390939[_0x2ab6('0x2d')]=_[_0x2ab6('0x2e')](_0x3d92ff[_0x2ab6('0x2d')]);_0x390939[_0x2ab6('0x38')]=_['intersection'](_0x390939[_0x2ab6('0x2b')],_0x390939[_0x2ab6('0x2d')]);_0x3e1329[_0x2ab6('0x30')]=_[_0x2ab6('0x2f')](_0x390939[_0x2ab6('0x2b')],qs['fields'](_0x3d92ff[_0x2ab6('0x2d')][_0x2ab6('0x31')]));_0x3e1329[_0x2ab6('0x30')]=_0x3e1329['attributes'][_0x2ab6('0x32')]?_0x3e1329[_0x2ab6('0x30')]:_0x390939[_0x2ab6('0x2b')];if(_0x3d92ff['query']['includeAll']){_0x3e1329[_0x2ab6('0x44')]=[{'all':!![]}];}_0x3e1329=_[_0x2ab6('0x3c')]({},_0x3e1329,_0x3d92ff[_0x2ab6('0x3d')]);return db[_0x2ab6('0x3e')][_0x2ab6('0x45')](_0x3e1329)[_0x2ab6('0x20')](handleEntityNotFound(_0x2ac5f6,null))[_0x2ab6('0x20')](respondWithResult(_0x2ac5f6,null))['catch'](handleError(_0x2ac5f6,null));};exports['create']=function(_0x2657e5,_0x12e75c){return db[_0x2ab6('0x3e')][_0x2ab6('0x46')](_0x2657e5[_0x2ab6('0x47')],{})[_0x2ab6('0x20')](respondWithResult(_0x12e75c,0xc9))[_0x2ab6('0x42')](handleError(_0x12e75c,null));};exports['bulkCreate']=function(_0x3d0189,_0x3a22c9){return db[_0x2ab6('0x3e')][_0x2ab6('0x48')](_0x3d0189[_0x2ab6('0x47')],{'raw':![],'individualHooks':!![]})[_0x2ab6('0x20')](respondWithResult(_0x3a22c9,0xc9))[_0x2ab6('0x42')](handleError(_0x3a22c9,null));};exports[_0x2ab6('0x1f')]=function(_0x5e5f88,_0x47e96c){if(_0x5e5f88['body']['id']){delete _0x5e5f88[_0x2ab6('0x47')]['id'];}return db[_0x2ab6('0x3e')][_0x2ab6('0x45')]({'where':{'id':_0x5e5f88[_0x2ab6('0x49')]['id']}})[_0x2ab6('0x20')](handleEntityNotFound(_0x47e96c,null))[_0x2ab6('0x20')](saveUpdates(_0x5e5f88['body'],null))[_0x2ab6('0x20')](respondWithResult(_0x47e96c,null))[_0x2ab6('0x42')](handleError(_0x47e96c,null));};exports[_0x2ab6('0x21')]=function(_0x1a63ec,_0x5c60f0){return db[_0x2ab6('0x3e')][_0x2ab6('0x45')]({'where':{'id':_0x1a63ec[_0x2ab6('0x49')]['id']}})[_0x2ab6('0x20')](handleEntityNotFound(_0x5c60f0,null))[_0x2ab6('0x20')](removeEntity(_0x5c60f0,null))[_0x2ab6('0x42')](handleError(_0x5c60f0,null));};exports[_0x2ab6('0x4a')]=function(_0x315de6,_0x3e871d){return db['AnalyticFieldReport'][_0x2ab6('0x21')]({'where':{'id':_0x315de6[_0x2ab6('0x2d')][_0x2ab6('0x4b')]||[]},'raw':![],'individualHooks':!![]})[_0x2ab6('0x20')](respondWithResult(_0x3e871d,0xcc))[_0x2ab6('0x42')](handleError(_0x3e871d,null));};exports[_0x2ab6('0x4c')]=function(_0x2518d4,_0x282d1f,_0x589e28){return db[_0x2ab6('0x4d')][_0x2ab6('0x4e')]({'where':{'id':_0x2518d4[_0x2ab6('0x49')]['id']}})['then'](handleEntityNotFound(_0x282d1f,null))['then'](function(_0x2d7593){if(_0x2d7593){return db['sequelize'][_0x2ab6('0x4f')](function(_0x312f18){return db[_0x2ab6('0x3e')][_0x2ab6('0x21')]({'where':{'CustomReportId':_0x2518d4['params']['id']},'transaction':_0x312f18})['then'](function(_0x2d72e4){var _0x4ddd11=_['map'](_0x2518d4[_0x2ab6('0x47')],function(_0x1f6477){delete _0x1f6477['id'];_0x1f6477[_0x2ab6('0x50')]=_0x2518d4['params']['id'];return _0x1f6477;});return db[_0x2ab6('0x3e')][_0x2ab6('0x48')](_0x4ddd11,{'transaction':_0x312f18});});})[_0x2ab6('0x20')](function(){return db['AnalyticFieldReport']['findAll']({'where':{'CustomReportId':_0x2518d4[_0x2ab6('0x49')]['id']}});});}})[_0x2ab6('0x20')](respondWithResult(_0x282d1f,null))[_0x2ab6('0x42')](handleError(_0x282d1f,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 8064b6c..ca96e49 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 _0xd344=['lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./analyticFieldReport.attributes','exports','define','analytics_report_fields'];(function(_0x31dbed,_0x47b167){var _0x54148b=function(_0x6ac029){while(--_0x6ac029){_0x31dbed['push'](_0x31dbed['shift']());}};_0x54148b(++_0x47b167);}(_0xd344,0x8f));var _0x4d34=function(_0x53a492,_0x119555){_0x53a492=_0x53a492-0x0;var _0x91feff=_0xd344[_0x53a492];return _0x91feff;};'use strict';var _=require(_0x4d34('0x0'));var util=require('util');var logger=require(_0x4d34('0x1'))(_0x4d34('0x2'));var moment=require('moment');var BPromise=require(_0x4d34('0x3'));var rp=require(_0x4d34('0x4'));var fs=require('fs');var path=require(_0x4d34('0x5'));var rimraf=require('rimraf');var config=require(_0x4d34('0x6'));var attributes=require(_0x4d34('0x7'));module[_0x4d34('0x8')]=function(_0x4ac066,_0x5ef3e4){return _0x4ac066[_0x4d34('0x9')]('AnalyticFieldReport',attributes,{'tableName':_0x4d34('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4852=['define','../../config/logger','bluebird','path','exports'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x4852,0xce));var _0x2485=function(_0x22e8cd,_0x258ced){_0x22e8cd=_0x22e8cd-0x0;var _0x236c4d=_0x4852[_0x22e8cd];return _0x236c4d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2485('0x0'))('api');var moment=require('moment');var BPromise=require(_0x2485('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2485('0x2'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./analyticFieldReport.attributes');module[_0x2485('0x3')]=function(_0x50f5e3,_0x137983){return _0x50f5e3[_0x2485('0x4')]('AnalyticFieldReport',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 185b26f..205b765 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 _0x01bb=['message','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x557b11,_0x38f8d9){var _0x3ce335=function(_0x36ae4a){while(--_0x36ae4a){_0x557b11['push'](_0x557b11['shift']());}};_0x3ce335(++_0x38f8d9);}(_0x01bb,0xf2));var _0xb01b=function(_0x58b7ac,_0xab25f9){_0x58b7ac=_0x58b7ac-0x0;var _0x4382ee=_0x01bb[_0x58b7ac];return _0x4382ee;};'use strict';var _=require(_0xb01b('0x0'));var util=require('util');var moment=require(_0xb01b('0x1'));var BPromise=require(_0xb01b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb01b('0x3'));var db=require(_0xb01b('0x4'))['db'];var utils=require(_0xb01b('0x5'));var logger=require(_0xb01b('0x6'))(_0xb01b('0x7'));var config=require(_0xb01b('0x8'));var jayson=require(_0xb01b('0x9'));var client=jayson[_0xb01b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x400d0b,_0x213f60,_0x587d69){return new BPromise(function(_0x495c14,_0x2bf003){return client[_0xb01b('0xb')](_0x400d0b,_0x587d69)[_0xb01b('0xc')](function(_0x20ead8){logger['info'](_0xb01b('0xd'),_0x213f60,_0xb01b('0xe'));logger['debug'](_0xb01b('0xf'),_0x213f60,_0xb01b('0xe'),JSON[_0xb01b('0x10')](_0x20ead8));if(_0x20ead8['error']){if(_0x20ead8['error']['code']===0x1f4){logger[_0xb01b('0x11')](_0xb01b('0xd'),_0x213f60,_0x20ead8[_0xb01b('0x11')][_0xb01b('0x12')]);return _0x2bf003(_0x20ead8[_0xb01b('0x11')][_0xb01b('0x12')]);}logger[_0xb01b('0x11')](_0xb01b('0xd'),_0x213f60,_0x20ead8['error'][_0xb01b('0x12')]);return _0x495c14(_0x20ead8[_0xb01b('0x11')][_0xb01b('0x12')]);}else{logger['info'](_0xb01b('0xd'),_0x213f60,'request\x20sent');_0x495c14(_0x20ead8['result'][_0xb01b('0x12')]);}})[_0xb01b('0x13')](function(_0xfc83f0){logger[_0xb01b('0x11')](_0xb01b('0xd'),_0x213f60,_0xfc83f0);_0x2bf003(_0xfc83f0);});});} \ No newline at end of file +var _0xa1b3=['message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x598efc,_0x5e971c){var _0x435e4f=function(_0x3e0596){while(--_0x3e0596){_0x598efc['push'](_0x598efc['shift']());}};_0x435e4f(++_0x5e971c);}(_0xa1b3,0x6c));var _0x3a1b=function(_0x1a9586,_0x4797da){_0x1a9586=_0x1a9586-0x0;var _0x36333b=_0xa1b3[_0x1a9586];return _0x36333b;};'use strict';var _=require(_0x3a1b('0x0'));var util=require(_0x3a1b('0x1'));var moment=require(_0x3a1b('0x2'));var BPromise=require('bluebird');var rs=require(_0x3a1b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3a1b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3a1b('0x5'))('rpc');var config=require(_0x3a1b('0x6'));var jayson=require(_0x3a1b('0x7'));var client=jayson[_0x3a1b('0x8')][_0x3a1b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x416ddf,_0x1d50ac,_0x15cc73){return new BPromise(function(_0x579012,_0x47506c){return client[_0x3a1b('0xa')](_0x416ddf,_0x15cc73)[_0x3a1b('0xb')](function(_0x25b246){logger[_0x3a1b('0xc')](_0x3a1b('0xd'),_0x1d50ac,_0x3a1b('0xe'));logger[_0x3a1b('0xf')](_0x3a1b('0x10'),_0x1d50ac,'request\x20sent',JSON['stringify'](_0x25b246));if(_0x25b246['error']){if(_0x25b246[_0x3a1b('0x11')]['code']===0x1f4){logger[_0x3a1b('0x11')](_0x3a1b('0xd'),_0x1d50ac,_0x25b246[_0x3a1b('0x11')]['message']);return _0x47506c(_0x25b246['error'][_0x3a1b('0x12')]);}logger[_0x3a1b('0x11')](_0x3a1b('0xd'),_0x1d50ac,_0x25b246[_0x3a1b('0x11')][_0x3a1b('0x12')]);return _0x579012(_0x25b246[_0x3a1b('0x11')][_0x3a1b('0x12')]);}else{logger['info'](_0x3a1b('0xd'),_0x1d50ac,_0x3a1b('0xe'));_0x579012(_0x25b246[_0x3a1b('0x13')]['message']);}})[_0x3a1b('0x14')](function(_0xd35cab){logger[_0x3a1b('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0x1d50ac,_0xd35cab);_0x47506c(_0xd35cab);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 10b52ed..60fad13 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(_0xa7d350,_0x1f40ba){var _0x31008b=function(_0x5070ac){while(--_0x5070ac){_0xa7d350['push'](_0xa7d350['shift']());}};_0x31008b(++_0x1f40ba);}(_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'));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(_0x194adf,_0x220258){var _0x2242e3=function(_0x42afcd){while(--_0x42afcd){_0x194adf['push'](_0x194adf['shift']());}};_0x2242e3(++_0x220258);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'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 5e1d663..91e0bab 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 _0x8cc8=['sequelize','exports','STRING','name','TEXT'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x8cc8,0x177));var _0x88cc=function(_0x2ec413,_0x19d47f){_0x2ec413=_0x2ec413-0x0;var _0x485d5b=_0x8cc8[_0x2ec413];return _0x485d5b;};'use strict';var Sequelize=require(_0x88cc('0x0'));module[_0x88cc('0x1')]={'name':{'type':Sequelize[_0x88cc('0x2')],'allowNull':![],'unique':_0x88cc('0x3')},'table':{'type':Sequelize[_0x88cc('0x2')]},'metric':{'type':Sequelize[_0x88cc('0x4')]},'description':{'type':Sequelize[_0x88cc('0x2')]}}; \ No newline at end of file +var _0xab23=['exports','STRING','name','TEXT','sequelize'];(function(_0x591c2b,_0x234b79){var _0x354fea=function(_0x594c4f){while(--_0x594c4f){_0x591c2b['push'](_0x591c2b['shift']());}};_0x354fea(++_0x234b79);}(_0xab23,0x1bc));var _0x3ab2=function(_0x9e17a3,_0x378dd4){_0x9e17a3=_0x9e17a3-0x0;var _0x2d877a=_0xab23[_0x9e17a3];return _0x2d877a;};'use strict';var Sequelize=require(_0x3ab2('0x0'));module[_0x3ab2('0x1')]={'name':{'type':Sequelize[_0x3ab2('0x2')],'allowNull':![],'unique':_0x3ab2('0x3')},'table':{'type':Sequelize[_0x3ab2('0x2')]},'metric':{'type':Sequelize[_0x3ab2('0x4')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 5144c41..454ef96 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 _0xe14b=['papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','json','apply','save','update','then','get','Metrics','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','show','keys','length','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','params','eml-format','rimraf','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring'];(function(_0x34d5b6,_0x14c587){var _0x36a1ac=function(_0x12045c){while(--_0x12045c){_0x34d5b6['push'](_0x34d5b6['shift']());}};_0x36a1ac(++_0x14c587);}(_0xe14b,0x93));var _0xbe14=function(_0xf34e0c,_0x53751a){_0xf34e0c=_0xf34e0c-0x0;var _0x4a581d=_0xe14b[_0xf34e0c];return _0x4a581d;};'use strict';var emlformat=require(_0xbe14('0x0'));var rimraf=require(_0xbe14('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbe14('0x2'));var moment=require(_0xbe14('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xbe14('0x4'));var util=require('util');var path=require('path');var sox=require(_0xbe14('0x5'));var csv=require(_0xbe14('0x6'));var ejs=require(_0xbe14('0x7'));var fs=require('fs');var fs_extra=require(_0xbe14('0x8'));var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var Redis=require(_0xbe14('0xe'));var authService=require(_0xbe14('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe14('0x10'));var logger=require(_0xbe14('0x11'))('api');var utils=require(_0xbe14('0x12'));var config=require(_0xbe14('0x13'));var licenseUtil=require(_0xbe14('0x14'));var db=require(_0xbe14('0x15'))['db'];function respondWithStatusCode(_0x27792f,_0x3b898d){_0x3b898d=_0x3b898d||0xcc;return function(_0x23a730){if(_0x23a730){return _0x27792f[_0xbe14('0x16')](_0x3b898d);}return _0x27792f[_0xbe14('0x17')](_0x3b898d)[_0xbe14('0x18')]();};}function respondWithResult(_0x1e4826,_0x33fd54){_0x33fd54=_0x33fd54||0xc8;return function(_0x813399){if(_0x813399){return _0x1e4826['status'](_0x33fd54)['json'](_0x813399);}};}function respondWithFilteredResult(_0x3f58f5,_0x3dc4a9){return function(_0xf4ac9){if(_0xf4ac9){var _0x37ce4e=typeof _0x3dc4a9['offset']===_0xbe14('0x19')&&typeof _0x3dc4a9[_0xbe14('0x1a')]===_0xbe14('0x19');var _0x123ede=_0xf4ac9[_0xbe14('0x1b')];var _0x29ab73=_0x37ce4e?0x0:_0x3dc4a9[_0xbe14('0x1c')];var _0x5ea1f8=_0x37ce4e?_0xf4ac9[_0xbe14('0x1b')]:_0x3dc4a9[_0xbe14('0x1c')]+_0x3dc4a9[_0xbe14('0x1a')];var _0x433459;if(_0x5ea1f8>=_0x123ede){_0x5ea1f8=_0x123ede;_0x433459=0xc8;}else{_0x433459=0xce;}_0x3f58f5[_0xbe14('0x17')](_0x433459);return _0x3f58f5[_0xbe14('0x1d')]('Content-Range',_0x29ab73+'-'+_0x5ea1f8+'/'+_0x123ede)[_0xbe14('0x1e')](_0xf4ac9);}return null;};}function patchUpdates(_0x4a1bbd){return function(_0x417c8d){try{jsonpatch[_0xbe14('0x1f')](_0x417c8d,_0x4a1bbd,!![]);}catch(_0x188ec4){return BPromise['reject'](_0x188ec4);}return _0x417c8d[_0xbe14('0x20')]();};}function saveUpdates(_0x56d845,_0x3c1c85){return function(_0x56e80c){if(_0x56e80c){return _0x56e80c[_0xbe14('0x21')](_0x56d845)['then'](function(_0x274018){return _0x274018;});}return null;};}function removeEntity(_0x3d3608,_0x505dbd){return function(_0x2da350){if(_0x2da350){return _0x2da350['destroy']()[_0xbe14('0x22')](function(){var _0x4851f8=_0x2da350[_0xbe14('0x23')]({'plain':!![]});var _0x5fa043=_0xbe14('0x24');return db[_0xbe14('0x25')][_0xbe14('0x26')]({'where':{'type':_0x5fa043,'resourceId':_0x4851f8['id']}})[_0xbe14('0x22')](function(){return _0x2da350;});})['then'](function(){_0x3d3608[_0xbe14('0x17')](0xcc)[_0xbe14('0x18')]();});}};}function handleEntityNotFound(_0x391556,_0x169369){return function(_0x5dd475){if(!_0x5dd475){_0x391556[_0xbe14('0x16')](0x194);}return _0x5dd475;};}function handleError(_0x29fc64,_0x59bf34){_0x59bf34=_0x59bf34||0x1f4;return function(_0x3c3613){logger[_0xbe14('0x27')](_0x3c3613[_0xbe14('0x28')]);if(_0x3c3613[_0xbe14('0x29')]){delete _0x3c3613[_0xbe14('0x29')];}_0x29fc64[_0xbe14('0x17')](_0x59bf34)[_0xbe14('0x2a')](_0x3c3613);};}exports[_0xbe14('0x2b')]=function(_0x4168c8,_0x16a159){var _0x40538f={},_0x3bf43c={},_0x39dc0a={'count':0x0,'rows':[]};var _0x10ae36=_[_0xbe14('0x2c')](db[_0xbe14('0x2d')][_0xbe14('0x2e')],function(_0x2ff48e){return{'name':_0x2ff48e[_0xbe14('0x2f')],'type':_0x2ff48e[_0xbe14('0x30')]['key']};});_0x3bf43c[_0xbe14('0x31')]=_['map'](_0x10ae36,'name');_0x3bf43c[_0xbe14('0x32')]=_['keys'](_0x4168c8[_0xbe14('0x32')]);_0x3bf43c[_0xbe14('0x33')]=_['intersection'](_0x3bf43c['model'],_0x3bf43c['query']);_0x40538f[_0xbe14('0x34')]=_[_0xbe14('0x35')](_0x3bf43c['model'],qs[_0xbe14('0x36')](_0x4168c8[_0xbe14('0x32')][_0xbe14('0x36')]));_0x40538f[_0xbe14('0x34')]=_0x40538f[_0xbe14('0x34')]['length']?_0x40538f['attributes']:_0x3bf43c[_0xbe14('0x31')];if(!_0x4168c8['query']['hasOwnProperty']('nolimit')){_0x40538f[_0xbe14('0x1a')]=qs[_0xbe14('0x1a')](_0x4168c8[_0xbe14('0x32')][_0xbe14('0x1a')]);_0x40538f[_0xbe14('0x1c')]=qs[_0xbe14('0x1c')](_0x4168c8[_0xbe14('0x32')][_0xbe14('0x1c')]);}_0x40538f[_0xbe14('0x37')]=qs[_0xbe14('0x38')](_0x4168c8[_0xbe14('0x32')][_0xbe14('0x38')]);_0x40538f['where']=qs['filters'](_[_0xbe14('0x39')](_0x4168c8[_0xbe14('0x32')],_0x3bf43c[_0xbe14('0x33')]),_0x10ae36);if(_0x4168c8['query'][_0xbe14('0x3a')]){_0x40538f[_0xbe14('0x3b')]=_[_0xbe14('0x3c')](_0x40538f[_0xbe14('0x3b')],{'$or':_[_0xbe14('0x2c')](_0x10ae36,function(_0x25ee1f){if(_0x25ee1f[_0xbe14('0x30')]!==_0xbe14('0x3d')){var _0x1b2608={};_0x1b2608[_0x25ee1f['name']]={'$like':'%'+_0x4168c8[_0xbe14('0x32')][_0xbe14('0x3a')]+'%'};return _0x1b2608;}})});}_0x40538f=_[_0xbe14('0x3c')]({},_0x40538f,_0x4168c8[_0xbe14('0x3e')]);var _0x3287b9={'where':_0x40538f[_0xbe14('0x3b')]};return db['AnalyticMetric'][_0xbe14('0x1b')](_0x3287b9)[_0xbe14('0x22')](function(_0x1220c9){_0x39dc0a[_0xbe14('0x1b')]=_0x1220c9;if(_0x4168c8['query']['includeAll']){_0x40538f[_0xbe14('0x3f')]=[{'all':!![]}];}return db[_0xbe14('0x2d')][_0xbe14('0x40')](_0x40538f);})['then'](function(_0x5d5318){_0x39dc0a[_0xbe14('0x41')]=_0x5d5318;return _0x39dc0a;})['then'](respondWithFilteredResult(_0x16a159,_0x40538f))['catch'](handleError(_0x16a159,null));};exports[_0xbe14('0x42')]=function(_0x1f0355,_0x8216c3){var _0x5051e4={'raw':!![],'where':{'id':_0x1f0355['params']['id']}},_0x558525={};_0x558525[_0xbe14('0x31')]=_[_0xbe14('0x43')](db[_0xbe14('0x2d')]['rawAttributes']);_0x558525[_0xbe14('0x32')]=_[_0xbe14('0x43')](_0x1f0355[_0xbe14('0x32')]);_0x558525[_0xbe14('0x33')]=_['intersection'](_0x558525['model'],_0x558525[_0xbe14('0x32')]);_0x5051e4[_0xbe14('0x34')]=_[_0xbe14('0x35')](_0x558525[_0xbe14('0x31')],qs[_0xbe14('0x36')](_0x1f0355['query']['fields']));_0x5051e4[_0xbe14('0x34')]=_0x5051e4[_0xbe14('0x34')][_0xbe14('0x44')]?_0x5051e4[_0xbe14('0x34')]:_0x558525['model'];if(_0x1f0355[_0xbe14('0x32')][_0xbe14('0x45')]){_0x5051e4['include']=[{'all':!![]}];}_0x5051e4=_[_0xbe14('0x3c')]({},_0x5051e4,_0x1f0355[_0xbe14('0x3e')]);return db[_0xbe14('0x2d')][_0xbe14('0x46')](_0x5051e4)['then'](handleEntityNotFound(_0x8216c3,null))['then'](respondWithResult(_0x8216c3,null))[_0xbe14('0x47')](handleError(_0x8216c3,null));};exports[_0xbe14('0x48')]=function(_0x4a1a37,_0x5acf90){return db[_0xbe14('0x2d')][_0xbe14('0x48')](_0x4a1a37[_0xbe14('0x49')],{})[_0xbe14('0x22')](function(_0xdbc6e1){var _0xd04fd5=_0x4a1a37[_0xbe14('0x4a')]['get']({'plain':!![]});if(!_0xd04fd5)throw new Error(_0xbe14('0x4b'));if(_0xd04fd5[_0xbe14('0x4c')]===_0xbe14('0x4a')){var _0x22b1f8=_0xdbc6e1[_0xbe14('0x23')]({'plain':!![]});var _0x494c32=_0xbe14('0x24');return db[_0xbe14('0x4d')][_0xbe14('0x46')]({'where':{'name':_0x494c32,'userProfileId':_0xd04fd5[_0xbe14('0x4e')]},'raw':!![]})[_0xbe14('0x22')](function(_0x2dbeb1){if(_0x2dbeb1&&_0x2dbeb1['autoAssociation']===0x0){return db['UserProfileResource'][_0xbe14('0x48')]({'name':_0x22b1f8[_0xbe14('0x29')],'resourceId':_0x22b1f8['id'],'type':_0x2dbeb1[_0xbe14('0x29')],'sectionId':_0x2dbeb1['id']},{})['then'](function(){return _0xdbc6e1;});}else{return _0xdbc6e1;}})['catch'](function(_0x44fe0d){logger[_0xbe14('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x44fe0d);throw _0x44fe0d;});}return _0xdbc6e1;})[_0xbe14('0x22')](respondWithResult(_0x5acf90,0xc9))[_0xbe14('0x47')](handleError(_0x5acf90,null));};exports['update']=function(_0x28f995,_0x4a40d2){if(_0x28f995[_0xbe14('0x49')]['id']){delete _0x28f995[_0xbe14('0x49')]['id'];}return db[_0xbe14('0x2d')]['find']({'where':{'id':_0x28f995[_0xbe14('0x4f')]['id']}})[_0xbe14('0x22')](handleEntityNotFound(_0x4a40d2,null))['then'](saveUpdates(_0x28f995[_0xbe14('0x49')],null))[_0xbe14('0x22')](respondWithResult(_0x4a40d2,null))[_0xbe14('0x47')](handleError(_0x4a40d2,null));};exports[_0xbe14('0x26')]=function(_0x49322f,_0x4f06a3){return db[_0xbe14('0x2d')][_0xbe14('0x46')]({'where':{'id':_0x49322f[_0xbe14('0x4f')]['id']}})[_0xbe14('0x22')](handleEntityNotFound(_0x4f06a3,null))[_0xbe14('0x22')](removeEntity(_0x4f06a3,null))[_0xbe14('0x47')](handleError(_0x4f06a3,null));}; \ No newline at end of file +var _0x34e8=['keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','options','AnalyticMetric','includeAll','include','findAll','rows','catch','params','merge','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','Metrics','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query'];(function(_0x359377,_0x1a63ef){var _0x8be18a=function(_0x246390){while(--_0x246390){_0x359377['push'](_0x359377['shift']());}};_0x8be18a(++_0x1a63ef);}(_0x34e8,0x12c));var _0x834e=function(_0x54139c,_0x256d67){_0x54139c=_0x54139c-0x0;var _0x3a68fd=_0x34e8[_0x54139c];return _0x3a68fd;};'use strict';var emlformat=require(_0x834e('0x0'));var rimraf=require(_0x834e('0x1'));var zipdir=require(_0x834e('0x2'));var jsonpatch=require(_0x834e('0x3'));var rp=require('request-promise');var moment=require(_0x834e('0x4'));var BPromise=require(_0x834e('0x5'));var Mustache=require(_0x834e('0x6'));var util=require(_0x834e('0x7'));var path=require(_0x834e('0x8'));var sox=require(_0x834e('0x9'));var csv=require(_0x834e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x834e('0xb'));var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0xa'));var querystring=require(_0x834e('0x10'));var Papa=require(_0x834e('0x11'));var Redis=require(_0x834e('0x12'));var authService=require(_0x834e('0x13'));var qs=require(_0x834e('0x14'));var as=require(_0x834e('0x15'));var hardwareService=require(_0x834e('0x16'));var logger=require(_0x834e('0x17'))(_0x834e('0x18'));var utils=require(_0x834e('0x19'));var config=require(_0x834e('0x1a'));var licenseUtil=require(_0x834e('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e5b6d,_0x6cd9b9){_0x6cd9b9=_0x6cd9b9||0xcc;return function(_0x58a27e){if(_0x58a27e){return _0x5e5b6d[_0x834e('0x1c')](_0x6cd9b9);}return _0x5e5b6d[_0x834e('0x1d')](_0x6cd9b9)[_0x834e('0x1e')]();};}function respondWithResult(_0x21cc0a,_0x50e860){_0x50e860=_0x50e860||0xc8;return function(_0x43156c){if(_0x43156c){return _0x21cc0a[_0x834e('0x1d')](_0x50e860)['json'](_0x43156c);}};}function respondWithFilteredResult(_0x316205,_0x4a9cdc){return function(_0x38a8cd){if(_0x38a8cd){var _0x36d443=typeof _0x4a9cdc['offset']===_0x834e('0x1f')&&typeof _0x4a9cdc[_0x834e('0x20')]===_0x834e('0x1f');var _0x50b3f6=_0x38a8cd[_0x834e('0x21')];var _0x211e9a=_0x36d443?0x0:_0x4a9cdc[_0x834e('0x22')];var _0xb993a1=_0x36d443?_0x38a8cd[_0x834e('0x21')]:_0x4a9cdc[_0x834e('0x22')]+_0x4a9cdc[_0x834e('0x20')];var _0x595515;if(_0xb993a1>=_0x50b3f6){_0xb993a1=_0x50b3f6;_0x595515=0xc8;}else{_0x595515=0xce;}_0x316205[_0x834e('0x1d')](_0x595515);return _0x316205[_0x834e('0x23')](_0x834e('0x24'),_0x211e9a+'-'+_0xb993a1+'/'+_0x50b3f6)[_0x834e('0x25')](_0x38a8cd);}return null;};}function patchUpdates(_0x4ab05d){return function(_0x45a630){try{jsonpatch[_0x834e('0x26')](_0x45a630,_0x4ab05d,!![]);}catch(_0x5a05c0){return BPromise[_0x834e('0x27')](_0x5a05c0);}return _0x45a630[_0x834e('0x28')]();};}function saveUpdates(_0x8d406e,_0x5c55ca){return function(_0x4e3f48){if(_0x4e3f48){return _0x4e3f48[_0x834e('0x29')](_0x8d406e)[_0x834e('0x2a')](function(_0x589dde){return _0x589dde;});}return null;};}function removeEntity(_0x25ee1d,_0x1dc1e0){return function(_0x58f4fd){if(_0x58f4fd){return _0x58f4fd[_0x834e('0x2b')]()[_0x834e('0x2a')](function(){var _0x338636=_0x58f4fd['get']({'plain':!![]});var _0x24fcf7=_0x834e('0x2c');return db['UserProfileResource']['destroy']({'where':{'type':_0x24fcf7,'resourceId':_0x338636['id']}})[_0x834e('0x2a')](function(){return _0x58f4fd;});})['then'](function(){_0x25ee1d[_0x834e('0x1d')](0xcc)[_0x834e('0x1e')]();});}};}function handleEntityNotFound(_0x3db026,_0x2cc2eb){return function(_0x3cd928){if(!_0x3cd928){_0x3db026[_0x834e('0x1c')](0x194);}return _0x3cd928;};}function handleError(_0x491919,_0x510780){_0x510780=_0x510780||0x1f4;return function(_0x4dc64a){logger['error'](_0x4dc64a[_0x834e('0x2d')]);if(_0x4dc64a[_0x834e('0x2e')]){delete _0x4dc64a[_0x834e('0x2e')];}_0x491919['status'](_0x510780)[_0x834e('0x2f')](_0x4dc64a);};}exports[_0x834e('0x30')]=function(_0x1f3671,_0x1e026a){var _0x4551f5={},_0x390119={},_0x3d149d={'count':0x0,'rows':[]};var _0xfaf716=_[_0x834e('0x31')](db['AnalyticMetric'][_0x834e('0x32')],function(_0x5cad11){return{'name':_0x5cad11[_0x834e('0x33')],'type':_0x5cad11[_0x834e('0x34')][_0x834e('0x35')]};});_0x390119[_0x834e('0x36')]=_[_0x834e('0x31')](_0xfaf716,_0x834e('0x2e'));_0x390119[_0x834e('0x37')]=_[_0x834e('0x38')](_0x1f3671[_0x834e('0x37')]);_0x390119[_0x834e('0x39')]=_['intersection'](_0x390119[_0x834e('0x36')],_0x390119[_0x834e('0x37')]);_0x4551f5[_0x834e('0x3a')]=_[_0x834e('0x3b')](_0x390119['model'],qs[_0x834e('0x3c')](_0x1f3671[_0x834e('0x37')]['fields']));_0x4551f5['attributes']=_0x4551f5['attributes'][_0x834e('0x3d')]?_0x4551f5[_0x834e('0x3a')]:_0x390119[_0x834e('0x36')];if(!_0x1f3671[_0x834e('0x37')][_0x834e('0x3e')](_0x834e('0x3f'))){_0x4551f5['limit']=qs[_0x834e('0x20')](_0x1f3671['query'][_0x834e('0x20')]);_0x4551f5[_0x834e('0x22')]=qs['offset'](_0x1f3671[_0x834e('0x37')][_0x834e('0x22')]);}_0x4551f5['order']=qs['sort'](_0x1f3671[_0x834e('0x37')][_0x834e('0x40')]);_0x4551f5[_0x834e('0x41')]=qs[_0x834e('0x39')](_[_0x834e('0x42')](_0x1f3671['query'],_0x390119[_0x834e('0x39')]),_0xfaf716);if(_0x1f3671['query']['filter']){_0x4551f5[_0x834e('0x41')]=_['merge'](_0x4551f5[_0x834e('0x41')],{'$or':_[_0x834e('0x31')](_0xfaf716,function(_0x16aea6){if(_0x16aea6[_0x834e('0x34')]!==_0x834e('0x43')){var _0x574ea8={};_0x574ea8[_0x16aea6[_0x834e('0x2e')]]={'$like':'%'+_0x1f3671[_0x834e('0x37')][_0x834e('0x44')]+'%'};return _0x574ea8;}})});}_0x4551f5=_['merge']({},_0x4551f5,_0x1f3671[_0x834e('0x45')]);var _0x16ac45={'where':_0x4551f5['where']};return db[_0x834e('0x46')]['count'](_0x16ac45)[_0x834e('0x2a')](function(_0x585335){_0x3d149d['count']=_0x585335;if(_0x1f3671['query'][_0x834e('0x47')]){_0x4551f5[_0x834e('0x48')]=[{'all':!![]}];}return db[_0x834e('0x46')][_0x834e('0x49')](_0x4551f5);})[_0x834e('0x2a')](function(_0x23feea){_0x3d149d[_0x834e('0x4a')]=_0x23feea;return _0x3d149d;})['then'](respondWithFilteredResult(_0x1e026a,_0x4551f5))[_0x834e('0x4b')](handleError(_0x1e026a,null));};exports['show']=function(_0x321efa,_0x540685){var _0x1df5b0={'raw':!![],'where':{'id':_0x321efa[_0x834e('0x4c')]['id']}},_0x5a5807={};_0x5a5807[_0x834e('0x36')]=_['keys'](db[_0x834e('0x46')][_0x834e('0x32')]);_0x5a5807[_0x834e('0x37')]=_[_0x834e('0x38')](_0x321efa[_0x834e('0x37')]);_0x5a5807[_0x834e('0x39')]=_[_0x834e('0x3b')](_0x5a5807[_0x834e('0x36')],_0x5a5807[_0x834e('0x37')]);_0x1df5b0[_0x834e('0x3a')]=_['intersection'](_0x5a5807[_0x834e('0x36')],qs[_0x834e('0x3c')](_0x321efa['query'][_0x834e('0x3c')]));_0x1df5b0[_0x834e('0x3a')]=_0x1df5b0[_0x834e('0x3a')][_0x834e('0x3d')]?_0x1df5b0[_0x834e('0x3a')]:_0x5a5807[_0x834e('0x36')];if(_0x321efa['query']['includeAll']){_0x1df5b0[_0x834e('0x48')]=[{'all':!![]}];}_0x1df5b0=_[_0x834e('0x4d')]({},_0x1df5b0,_0x321efa[_0x834e('0x45')]);return db[_0x834e('0x46')][_0x834e('0x4e')](_0x1df5b0)[_0x834e('0x2a')](handleEntityNotFound(_0x540685,null))[_0x834e('0x2a')](respondWithResult(_0x540685,null))[_0x834e('0x4b')](handleError(_0x540685,null));};exports[_0x834e('0x4f')]=function(_0x390c45,_0xf02f0d){return db[_0x834e('0x46')][_0x834e('0x4f')](_0x390c45[_0x834e('0x50')],{})[_0x834e('0x2a')](function(_0x1a3855){var _0x3df078=_0x390c45[_0x834e('0x51')][_0x834e('0x52')]({'plain':!![]});if(!_0x3df078)throw new Error(_0x834e('0x53'));if(_0x3df078['role']===_0x834e('0x51')){var _0x1f08b9=_0x1a3855['get']({'plain':!![]});var _0x3c00a3=_0x834e('0x2c');return db['UserProfileSection'][_0x834e('0x4e')]({'where':{'name':_0x3c00a3,'userProfileId':_0x3df078[_0x834e('0x54')]},'raw':!![]})[_0x834e('0x2a')](function(_0x35636e){if(_0x35636e&&_0x35636e[_0x834e('0x55')]===0x0){return db[_0x834e('0x56')][_0x834e('0x4f')]({'name':_0x1f08b9['name'],'resourceId':_0x1f08b9['id'],'type':_0x35636e[_0x834e('0x2e')],'sectionId':_0x35636e['id']},{})[_0x834e('0x2a')](function(){return _0x1a3855;});}else{return _0x1a3855;}})[_0x834e('0x4b')](function(_0x363675){logger[_0x834e('0x57')](_0x834e('0x58'),_0x363675);throw _0x363675;});}return _0x1a3855;})[_0x834e('0x2a')](respondWithResult(_0xf02f0d,0xc9))[_0x834e('0x4b')](handleError(_0xf02f0d,null));};exports['update']=function(_0x11778e,_0x4dc104){if(_0x11778e[_0x834e('0x50')]['id']){delete _0x11778e['body']['id'];}return db[_0x834e('0x46')]['find']({'where':{'id':_0x11778e['params']['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0x4dc104,null))[_0x834e('0x2a')](saveUpdates(_0x11778e['body'],null))['then'](respondWithResult(_0x4dc104,null))[_0x834e('0x4b')](handleError(_0x4dc104,null));};exports[_0x834e('0x2b')]=function(_0x138ed2,_0x387365){return db[_0x834e('0x46')][_0x834e('0x4e')]({'where':{'id':_0x138ed2[_0x834e('0x4c')]['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0x387365,null))['then'](removeEntity(_0x387365,null))[_0x834e('0x4b')](handleError(_0x387365,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 5f27c7e..df0998b 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 _0xbea5=['moment','bluebird','request-promise','path','./analyticMetric.attributes','AnalyticMetric','lodash','util','api'];(function(_0x54a77b,_0x55a9f8){var _0x2e717b=function(_0x1cca54){while(--_0x1cca54){_0x54a77b['push'](_0x54a77b['shift']());}};_0x2e717b(++_0x55a9f8);}(_0xbea5,0x177));var _0x5bea=function(_0x1ee9a1,_0x5f1434){_0x1ee9a1=_0x1ee9a1-0x0;var _0x21270f=_0xbea5[_0x1ee9a1];return _0x21270f;};'use strict';var _=require(_0x5bea('0x0'));var util=require(_0x5bea('0x1'));var logger=require('../../config/logger')(_0x5bea('0x2'));var moment=require(_0x5bea('0x3'));var BPromise=require(_0x5bea('0x4'));var rp=require(_0x5bea('0x5'));var fs=require('fs');var path=require(_0x5bea('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5bea('0x7'));module['exports']=function(_0x156737,_0x51ac31){return _0x156737['define'](_0x5bea('0x8'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x39c7=['../../config/environment','./analyticMetric.attributes','define','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x3ee768,_0x11af44){var _0x26ddae=function(_0x43f17e){while(--_0x43f17e){_0x3ee768['push'](_0x3ee768['shift']());}};_0x26ddae(++_0x11af44);}(_0x39c7,0x85));var _0x739c=function(_0x58ac5b,_0x2b3fcb){_0x58ac5b=_0x58ac5b-0x0;var _0x47f26a=_0x39c7[_0x58ac5b];return _0x47f26a;};'use strict';var _=require('lodash');var util=require(_0x739c('0x0'));var logger=require(_0x739c('0x1'))(_0x739c('0x2'));var moment=require(_0x739c('0x3'));var BPromise=require(_0x739c('0x4'));var rp=require(_0x739c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x739c('0x6'));var config=require(_0x739c('0x7'));var attributes=require(_0x739c('0x8'));module['exports']=function(_0x4c5030,_0x1923d9){return _0x4c5030[_0x739c('0x9')]('AnalyticMetric',attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 4f1ced0..a7d86f6 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 _0x80e3=['jayson/promise','client','http','then','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x311724,_0x2930d9){var _0x5b9727=function(_0x558c51){while(--_0x558c51){_0x311724['push'](_0x311724['shift']());}};_0x5b9727(++_0x2930d9);}(_0x80e3,0x121));var _0x380e=function(_0x31d720,_0x21d696){_0x31d720=_0x31d720-0x0;var _0x1f361d=_0x80e3[_0x31d720];return _0x1f361d;};'use strict';var _=require(_0x380e('0x0'));var util=require('util');var moment=require(_0x380e('0x1'));var BPromise=require(_0x380e('0x2'));var rs=require(_0x380e('0x3'));var fs=require('fs');var Redis=require(_0x380e('0x4'));var db=require(_0x380e('0x5'))['db'];var utils=require(_0x380e('0x6'));var logger=require(_0x380e('0x7'))(_0x380e('0x8'));var config=require(_0x380e('0x9'));var jayson=require(_0x380e('0xa'));var client=jayson[_0x380e('0xb')][_0x380e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2b19a9,_0x474791,_0x118793){return new BPromise(function(_0x40ad64,_0x3adfc6){return client['request'](_0x2b19a9,_0x118793)[_0x380e('0xd')](function(_0x16a6c){logger['info'](_0x380e('0xe'),_0x474791,_0x380e('0xf'));logger[_0x380e('0x10')](_0x380e('0x11'),_0x474791,_0x380e('0xf'),JSON[_0x380e('0x12')](_0x16a6c));if(_0x16a6c[_0x380e('0x13')]){if(_0x16a6c[_0x380e('0x13')][_0x380e('0x14')]===0x1f4){logger[_0x380e('0x13')]('AnalyticMetric,\x20%s,\x20%s',_0x474791,_0x16a6c[_0x380e('0x13')][_0x380e('0x15')]);return _0x3adfc6(_0x16a6c[_0x380e('0x13')][_0x380e('0x15')]);}logger[_0x380e('0x13')](_0x380e('0xe'),_0x474791,_0x16a6c[_0x380e('0x13')][_0x380e('0x15')]);return _0x40ad64(_0x16a6c['error'][_0x380e('0x15')]);}else{logger['info']('AnalyticMetric,\x20%s,\x20%s',_0x474791,_0x380e('0xf'));_0x40ad64(_0x16a6c['result'][_0x380e('0x15')]);}})[_0x380e('0x16')](function(_0x3c6844){logger[_0x380e('0x13')](_0x380e('0xe'),_0x474791,_0x3c6844);_0x3adfc6(_0x3c6844);});});} \ No newline at end of file +var _0xb9e2=['code','AnalyticMetric,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','stringify','error'];(function(_0x2acffe,_0x57bc65){var _0x5734ea=function(_0x5babda){while(--_0x5babda){_0x2acffe['push'](_0x2acffe['shift']());}};_0x5734ea(++_0x57bc65);}(_0xb9e2,0x10f));var _0x2b9e=function(_0x234ae1,_0x42bdd6){_0x234ae1=_0x234ae1-0x0;var _0x227ba0=_0xb9e2[_0x234ae1];return _0x227ba0;};'use strict';var _=require(_0x2b9e('0x0'));var util=require('util');var moment=require(_0x2b9e('0x1'));var BPromise=require('bluebird');var rs=require(_0x2b9e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2b9e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x2b9e('0x4'))(_0x2b9e('0x5'));var config=require(_0x2b9e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2b9e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x483546,_0x373946,_0x53869f){return new BPromise(function(_0x2b39a5,_0xd12a73){return client['request'](_0x483546,_0x53869f)[_0x2b9e('0x8')](function(_0x298ecf){logger[_0x2b9e('0x9')]('AnalyticMetric,\x20%s,\x20%s',_0x373946,_0x2b9e('0xa'));logger[_0x2b9e('0xb')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x373946,_0x2b9e('0xa'),JSON[_0x2b9e('0xc')](_0x298ecf));if(_0x298ecf[_0x2b9e('0xd')]){if(_0x298ecf['error'][_0x2b9e('0xe')]===0x1f4){logger[_0x2b9e('0xd')](_0x2b9e('0xf'),_0x373946,_0x298ecf[_0x2b9e('0xd')][_0x2b9e('0x10')]);return _0xd12a73(_0x298ecf[_0x2b9e('0xd')][_0x2b9e('0x10')]);}logger['error'](_0x2b9e('0xf'),_0x373946,_0x298ecf['error'][_0x2b9e('0x10')]);return _0x2b39a5(_0x298ecf['error']['message']);}else{logger[_0x2b9e('0x9')]('AnalyticMetric,\x20%s,\x20%s',_0x373946,'request\x20sent');_0x2b39a5(_0x298ecf[_0x2b9e('0x11')]['message']);}})[_0x2b9e('0x12')](function(_0x30c49c){logger[_0x2b9e('0xd')](_0x2b9e('0xf'),_0x373946,_0x30c49c);_0xd12a73(_0x30c49c);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index b72c770..fe70989 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 _0x8781=['fs-extra','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x57cb4f,_0x29cd98){var _0x5852a5=function(_0x32975a){while(--_0x32975a){_0x57cb4f['push'](_0x57cb4f['shift']());}};_0x5852a5(++_0x29cd98);}(_0x8781,0x1c8));var _0x1878=function(_0x48c5f5,_0x343c88){_0x48c5f5=_0x48c5f5-0x0;var _0x24056e=_0x8781[_0x48c5f5];return _0x24056e;};'use strict';var multer=require(_0x1878('0x0'));var util=require(_0x1878('0x1'));var path=require(_0x1878('0x2'));var timeout=require(_0x1878('0x3'));var express=require(_0x1878('0x4'));var router=express[_0x1878('0x5')]();var fs_extra=require(_0x1878('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x1878('0x7'));var config=require(_0x1878('0x8'));var controller=require(_0x1878('0x9'));router[_0x1878('0xa')]('/',auth[_0x1878('0xb')](),controller[_0x1878('0xc')]);router['get'](_0x1878('0xd'),auth[_0x1878('0xb')](),controller[_0x1878('0xe')]);router[_0x1878('0xf')]('/',auth[_0x1878('0xb')](),controller[_0x1878('0x10')]);router[_0x1878('0x11')](_0x1878('0xd'),auth[_0x1878('0xb')](),controller[_0x1878('0x12')]);router[_0x1878('0x13')]('/:id',auth[_0x1878('0xb')](),controller[_0x1878('0x14')]);module[_0x1878('0x15')]=router; \ No newline at end of file +var _0xc03e=['update','delete','destroy','exports','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x4a47bf,_0x1b2dfe){var _0xec31a4=function(_0x21bb9e){while(--_0x21bb9e){_0x4a47bf['push'](_0x4a47bf['shift']());}};_0xec31a4(++_0x1b2dfe);}(_0xc03e,0x15a));var _0xec03=function(_0x317e30,_0x32ad66){_0x317e30=_0x317e30-0x0;var _0x203788=_0xc03e[_0x317e30];return _0x203788;};'use strict';var multer=require(_0xec03('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xec03('0x1'));var express=require('express');var router=express[_0xec03('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xec03('0x3'));var interaction=require(_0xec03('0x4'));var config=require(_0xec03('0x5'));var controller=require(_0xec03('0x6'));router[_0xec03('0x7')]('/',auth[_0xec03('0x8')](),controller[_0xec03('0x9')]);router[_0xec03('0x7')](_0xec03('0xa'),auth['isAuthenticated'](),controller[_0xec03('0xb')]);router[_0xec03('0xc')]('/',auth[_0xec03('0x8')](),controller[_0xec03('0xd')]);router['put'](_0xec03('0xa'),auth[_0xec03('0x8')](),controller[_0xec03('0xe')]);router[_0xec03('0xf')](_0xec03('0xa'),auth[_0xec03('0x8')](),controller[_0xec03('0x10')]);module[_0xec03('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 1493f84..d0d191c 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 _0x0b13=['sequelize','exports','TEXT'];(function(_0x52a7b5,_0x26c95c){var _0x32d6d2=function(_0xff339a){while(--_0xff339a){_0x52a7b5['push'](_0x52a7b5['shift']());}};_0x32d6d2(++_0x26c95c);}(_0x0b13,0x150));var _0x30b1=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x0b13[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require(_0x30b1('0x0'));module[_0x30b1('0x1')]={'tree':{'type':Sequelize[_0x30b1('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x0e35=['exports','TEXT','sequelize'];(function(_0x44b7c8,_0x341f8d){var _0x2471ce=function(_0x646988){while(--_0x646988){_0x44b7c8['push'](_0x44b7c8['shift']());}};_0x2471ce(++_0x341f8d);}(_0x0e35,0xc2));var _0x50e3=function(_0x11aa63,_0x4a4c16){_0x11aa63=_0x11aa63-0x0;var _0x3e5710=_0x0e35[_0x11aa63];return _0x3e5710;};'use strict';var Sequelize=require(_0x50e3('0x0'));module[_0x50e3('0x1')]={'tree':{'type':Sequelize[_0x50e3('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 7b91a87..f229f7f 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 _0xd2f8=['map','AnalyticTreeReport','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','create','body','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','offset','count','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','index'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xd2f8,0x1ee));var _0x8d2f=function(_0x2072d4,_0x29e371){_0x2072d4=_0x2072d4-0x0;var _0x3ffab1=_0xd2f8[_0x2072d4];return _0x3ffab1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8d2f('0x0'));var zipdir=require(_0x8d2f('0x1'));var jsonpatch=require(_0x8d2f('0x2'));var rp=require(_0x8d2f('0x3'));var moment=require(_0x8d2f('0x4'));var BPromise=require(_0x8d2f('0x5'));var Mustache=require(_0x8d2f('0x6'));var util=require('util');var path=require(_0x8d2f('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8d2f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8d2f('0x9'));var squel=require(_0x8d2f('0xa'));var crypto=require('crypto');var jsforce=require(_0x8d2f('0xb'));var deskjs=require(_0x8d2f('0xc'));var toCsv=require(_0x8d2f('0xd'));var querystring=require('querystring');var Papa=require(_0x8d2f('0xe'));var Redis=require(_0x8d2f('0xf'));var authService=require(_0x8d2f('0x10'));var qs=require(_0x8d2f('0x11'));var as=require(_0x8d2f('0x12'));var hardwareService=require(_0x8d2f('0x13'));var logger=require(_0x8d2f('0x14'))(_0x8d2f('0x15'));var utils=require(_0x8d2f('0x16'));var config=require(_0x8d2f('0x17'));var licenseUtil=require(_0x8d2f('0x18'));var db=require(_0x8d2f('0x19'))['db'];function respondWithStatusCode(_0x1a9499,_0x442b03){_0x442b03=_0x442b03||0xcc;return function(_0xf60098){if(_0xf60098){return _0x1a9499[_0x8d2f('0x1a')](_0x442b03);}return _0x1a9499[_0x8d2f('0x1b')](_0x442b03)[_0x8d2f('0x1c')]();};}function respondWithResult(_0x483d6e,_0x4f31cd){_0x4f31cd=_0x4f31cd||0xc8;return function(_0xce76f2){if(_0xce76f2){return _0x483d6e[_0x8d2f('0x1b')](_0x4f31cd)['json'](_0xce76f2);}};}function respondWithFilteredResult(_0x2b9dc5,_0x4d1301){return function(_0x2fa9d4){if(_0x2fa9d4){var _0x4327b3=typeof _0x4d1301['offset']===_0x8d2f('0x1d')&&typeof _0x4d1301['limit']===_0x8d2f('0x1d');var _0x138ae3=_0x2fa9d4['count'];var _0x48b08c=_0x4327b3?0x0:_0x4d1301[_0x8d2f('0x1e')];var _0x27966f=_0x4327b3?_0x2fa9d4[_0x8d2f('0x1f')]:_0x4d1301[_0x8d2f('0x1e')]+_0x4d1301['limit'];var _0x5db7a9;if(_0x27966f>=_0x138ae3){_0x27966f=_0x138ae3;_0x5db7a9=0xc8;}else{_0x5db7a9=0xce;}_0x2b9dc5['status'](_0x5db7a9);return _0x2b9dc5[_0x8d2f('0x20')](_0x8d2f('0x21'),_0x48b08c+'-'+_0x27966f+'/'+_0x138ae3)[_0x8d2f('0x22')](_0x2fa9d4);}return null;};}function patchUpdates(_0x206725){return function(_0x39f3c4){try{jsonpatch[_0x8d2f('0x23')](_0x39f3c4,_0x206725,!![]);}catch(_0xb65c8d){return BPromise[_0x8d2f('0x24')](_0xb65c8d);}return _0x39f3c4[_0x8d2f('0x25')]();};}function saveUpdates(_0x2baf65,_0x2bf9b0){return function(_0x3756bd){if(_0x3756bd){return _0x3756bd[_0x8d2f('0x26')](_0x2baf65)[_0x8d2f('0x27')](function(_0x305ac4){return _0x305ac4;});}return null;};}function removeEntity(_0x4cb12e,_0x363dec){return function(_0x19fad7){if(_0x19fad7){return _0x19fad7[_0x8d2f('0x28')]()[_0x8d2f('0x27')](function(){_0x4cb12e[_0x8d2f('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a8ccf,_0x416fc0){return function(_0x43e137){if(!_0x43e137){_0x3a8ccf['sendStatus'](0x194);}return _0x43e137;};}function handleError(_0x2042d6,_0x259ec1){_0x259ec1=_0x259ec1||0x1f4;return function(_0x305486){logger['error'](_0x305486[_0x8d2f('0x29')]);if(_0x305486[_0x8d2f('0x2a')]){delete _0x305486[_0x8d2f('0x2a')];}_0x2042d6[_0x8d2f('0x1b')](_0x259ec1)[_0x8d2f('0x2b')](_0x305486);};}exports[_0x8d2f('0x2c')]=function(_0x5afc12,_0x51f1b6){var _0x4aa5ed={},_0x55e1b0={},_0x847a94={'count':0x0,'rows':[]};var _0x3e6063=_[_0x8d2f('0x2d')](db[_0x8d2f('0x2e')][_0x8d2f('0x2f')],function(_0x34e193){return{'name':_0x34e193['fieldName'],'type':_0x34e193[_0x8d2f('0x30')]['key']};});_0x55e1b0[_0x8d2f('0x31')]=_[_0x8d2f('0x2d')](_0x3e6063,_0x8d2f('0x2a'));_0x55e1b0['query']=_['keys'](_0x5afc12[_0x8d2f('0x32')]);_0x55e1b0[_0x8d2f('0x33')]=_[_0x8d2f('0x34')](_0x55e1b0[_0x8d2f('0x31')],_0x55e1b0['query']);_0x4aa5ed[_0x8d2f('0x35')]=_[_0x8d2f('0x34')](_0x55e1b0[_0x8d2f('0x31')],qs[_0x8d2f('0x36')](_0x5afc12['query'][_0x8d2f('0x36')]));_0x4aa5ed[_0x8d2f('0x35')]=_0x4aa5ed['attributes'][_0x8d2f('0x37')]?_0x4aa5ed[_0x8d2f('0x35')]:_0x55e1b0['model'];if(!_0x5afc12[_0x8d2f('0x32')][_0x8d2f('0x38')](_0x8d2f('0x39'))){_0x4aa5ed['limit']=qs[_0x8d2f('0x3a')](_0x5afc12[_0x8d2f('0x32')][_0x8d2f('0x3a')]);_0x4aa5ed[_0x8d2f('0x1e')]=qs[_0x8d2f('0x1e')](_0x5afc12[_0x8d2f('0x32')][_0x8d2f('0x1e')]);}_0x4aa5ed['order']=qs[_0x8d2f('0x3b')](_0x5afc12[_0x8d2f('0x32')][_0x8d2f('0x3b')]);_0x4aa5ed[_0x8d2f('0x3c')]=qs[_0x8d2f('0x33')](_[_0x8d2f('0x3d')](_0x5afc12[_0x8d2f('0x32')],_0x55e1b0[_0x8d2f('0x33')]),_0x3e6063);if(_0x5afc12[_0x8d2f('0x32')][_0x8d2f('0x3e')]){_0x4aa5ed[_0x8d2f('0x3c')]=_[_0x8d2f('0x3f')](_0x4aa5ed['where'],{'$or':_['map'](_0x3e6063,function(_0x255764){if(_0x255764[_0x8d2f('0x30')]!==_0x8d2f('0x40')){var _0x48bc76={};_0x48bc76[_0x255764[_0x8d2f('0x2a')]]={'$like':'%'+_0x5afc12[_0x8d2f('0x32')][_0x8d2f('0x3e')]+'%'};return _0x48bc76;}})});}_0x4aa5ed=_[_0x8d2f('0x3f')]({},_0x4aa5ed,_0x5afc12[_0x8d2f('0x41')]);var _0x5c7876={'where':_0x4aa5ed[_0x8d2f('0x3c')]};return db[_0x8d2f('0x2e')][_0x8d2f('0x1f')](_0x5c7876)[_0x8d2f('0x27')](function(_0x3fc1d6){_0x847a94[_0x8d2f('0x1f')]=_0x3fc1d6;if(_0x5afc12['query'][_0x8d2f('0x42')]){_0x4aa5ed[_0x8d2f('0x43')]=[{'all':!![]}];}return db[_0x8d2f('0x2e')][_0x8d2f('0x44')](_0x4aa5ed);})[_0x8d2f('0x27')](function(_0x56d358){_0x847a94[_0x8d2f('0x45')]=_0x56d358;return _0x847a94;})[_0x8d2f('0x27')](respondWithFilteredResult(_0x51f1b6,_0x4aa5ed))[_0x8d2f('0x46')](handleError(_0x51f1b6,null));};exports[_0x8d2f('0x47')]=function(_0x368c3e,_0x22c7a2){var _0x1c63d4={'raw':!![],'where':{'id':_0x368c3e[_0x8d2f('0x48')]['id']}},_0x5ac958={};_0x5ac958[_0x8d2f('0x31')]=_[_0x8d2f('0x49')](db['AnalyticTreeReport'][_0x8d2f('0x2f')]);_0x5ac958[_0x8d2f('0x32')]=_['keys'](_0x368c3e[_0x8d2f('0x32')]);_0x5ac958[_0x8d2f('0x33')]=_['intersection'](_0x5ac958[_0x8d2f('0x31')],_0x5ac958[_0x8d2f('0x32')]);_0x1c63d4['attributes']=_[_0x8d2f('0x34')](_0x5ac958[_0x8d2f('0x31')],qs[_0x8d2f('0x36')](_0x368c3e[_0x8d2f('0x32')]['fields']));_0x1c63d4[_0x8d2f('0x35')]=_0x1c63d4[_0x8d2f('0x35')][_0x8d2f('0x37')]?_0x1c63d4[_0x8d2f('0x35')]:_0x5ac958[_0x8d2f('0x31')];if(_0x368c3e['query']['includeAll']){_0x1c63d4[_0x8d2f('0x43')]=[{'all':!![]}];}_0x1c63d4=_[_0x8d2f('0x3f')]({},_0x1c63d4,_0x368c3e[_0x8d2f('0x41')]);return db['AnalyticTreeReport']['find'](_0x1c63d4)[_0x8d2f('0x27')](handleEntityNotFound(_0x22c7a2,null))['then'](respondWithResult(_0x22c7a2,null))[_0x8d2f('0x46')](handleError(_0x22c7a2,null));};exports[_0x8d2f('0x4a')]=function(_0x52063f,_0x29b3e3){return db[_0x8d2f('0x2e')][_0x8d2f('0x4a')](_0x52063f[_0x8d2f('0x4b')],{})[_0x8d2f('0x27')](respondWithResult(_0x29b3e3,0xc9))['catch'](handleError(_0x29b3e3,null));};exports['update']=function(_0x532832,_0x5560ba){if(_0x532832[_0x8d2f('0x4b')]['id']){delete _0x532832[_0x8d2f('0x4b')]['id'];}return db[_0x8d2f('0x2e')][_0x8d2f('0x4c')]({'where':{'id':_0x532832['params']['id']}})['then'](handleEntityNotFound(_0x5560ba,null))[_0x8d2f('0x27')](saveUpdates(_0x532832[_0x8d2f('0x4b')],null))[_0x8d2f('0x27')](respondWithResult(_0x5560ba,null))[_0x8d2f('0x46')](handleError(_0x5560ba,null));};exports['destroy']=function(_0x22e747,_0x2ccc5f){return db[_0x8d2f('0x2e')][_0x8d2f('0x4c')]({'where':{'id':_0x22e747[_0x8d2f('0x48')]['id']}})[_0x8d2f('0x27')](handleEntityNotFound(_0x2ccc5f,null))['then'](removeEntity(_0x2ccc5f,null))['catch'](handleError(_0x2ccc5f,null));}; \ No newline at end of file +var _0x6a66=['ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','end','stack','name','send','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','VIRTUAL','merge','includeAll','include','findAll','rows','show','params','find','body','catch','fast-json-patch','request-promise','bluebird','mustache','util','path'];(function(_0x5a3450,_0x4301ce){var _0x14c155=function(_0x5ea090){while(--_0x5ea090){_0x5a3450['push'](_0x5a3450['shift']());}};_0x14c155(++_0x4301ce);}(_0x6a66,0x8a));var _0x66a6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6a66[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x66a6('0x0'));var rp=require(_0x66a6('0x1'));var moment=require('moment');var BPromise=require(_0x66a6('0x2'));var Mustache=require(_0x66a6('0x3'));var util=require(_0x66a6('0x4'));var path=require(_0x66a6('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x66a6('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x66a6('0x7'));var crypto=require(_0x66a6('0x8'));var jsforce=require(_0x66a6('0x9'));var deskjs=require(_0x66a6('0xa'));var toCsv=require('to-csv');var querystring=require(_0x66a6('0xb'));var Papa=require(_0x66a6('0xc'));var Redis=require(_0x66a6('0xd'));var authService=require(_0x66a6('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x66a6('0xf'));var hardwareService=require(_0x66a6('0x10'));var logger=require(_0x66a6('0x11'))(_0x66a6('0x12'));var utils=require(_0x66a6('0x13'));var config=require(_0x66a6('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x66a6('0x15'))['db'];function respondWithStatusCode(_0x3190b8,_0x26cc30){_0x26cc30=_0x26cc30||0xcc;return function(_0x2a4d76){if(_0x2a4d76){return _0x3190b8[_0x66a6('0x16')](_0x26cc30);}return _0x3190b8['status'](_0x26cc30)['end']();};}function respondWithResult(_0x2d4e15,_0x29f5da){_0x29f5da=_0x29f5da||0xc8;return function(_0x2bc11c){if(_0x2bc11c){return _0x2d4e15['status'](_0x29f5da)[_0x66a6('0x17')](_0x2bc11c);}};}function respondWithFilteredResult(_0x46f070,_0x4d22ab){return function(_0x3fc0eb){if(_0x3fc0eb){var _0x179a2b=typeof _0x4d22ab[_0x66a6('0x18')]===_0x66a6('0x19')&&typeof _0x4d22ab[_0x66a6('0x1a')]===_0x66a6('0x19');var _0x1fb583=_0x3fc0eb[_0x66a6('0x1b')];var _0x4cddc9=_0x179a2b?0x0:_0x4d22ab[_0x66a6('0x18')];var _0x45aa8e=_0x179a2b?_0x3fc0eb[_0x66a6('0x1b')]:_0x4d22ab[_0x66a6('0x18')]+_0x4d22ab[_0x66a6('0x1a')];var _0x2722fe;if(_0x45aa8e>=_0x1fb583){_0x45aa8e=_0x1fb583;_0x2722fe=0xc8;}else{_0x2722fe=0xce;}_0x46f070[_0x66a6('0x1c')](_0x2722fe);return _0x46f070[_0x66a6('0x1d')](_0x66a6('0x1e'),_0x4cddc9+'-'+_0x45aa8e+'/'+_0x1fb583)[_0x66a6('0x17')](_0x3fc0eb);}return null;};}function patchUpdates(_0x22a8f6){return function(_0x23a639){try{jsonpatch[_0x66a6('0x1f')](_0x23a639,_0x22a8f6,!![]);}catch(_0x522340){return BPromise[_0x66a6('0x20')](_0x522340);}return _0x23a639[_0x66a6('0x21')]();};}function saveUpdates(_0xd8f79c,_0x4b12d7){return function(_0x3d9755){if(_0x3d9755){return _0x3d9755[_0x66a6('0x22')](_0xd8f79c)['then'](function(_0xc7b71c){return _0xc7b71c;});}return null;};}function removeEntity(_0x347880,_0x1a24b2){return function(_0x45605c){if(_0x45605c){return _0x45605c['destroy']()[_0x66a6('0x23')](function(){_0x347880[_0x66a6('0x1c')](0xcc)[_0x66a6('0x24')]();});}};}function handleEntityNotFound(_0x54b840,_0x6e03f1){return function(_0x338f6e){if(!_0x338f6e){_0x54b840['sendStatus'](0x194);}return _0x338f6e;};}function handleError(_0x389238,_0x5c0e7b){_0x5c0e7b=_0x5c0e7b||0x1f4;return function(_0x5d4c4e){logger['error'](_0x5d4c4e[_0x66a6('0x25')]);if(_0x5d4c4e[_0x66a6('0x26')]){delete _0x5d4c4e[_0x66a6('0x26')];}_0x389238['status'](_0x5c0e7b)[_0x66a6('0x27')](_0x5d4c4e);};}exports['index']=function(_0x37a14e,_0x287fa8){var _0x4816d6={},_0xf3a464={},_0x17edf3={'count':0x0,'rows':[]};var _0x135c8d=_['map'](db[_0x66a6('0x28')][_0x66a6('0x29')],function(_0x37b818){return{'name':_0x37b818[_0x66a6('0x2a')],'type':_0x37b818[_0x66a6('0x2b')][_0x66a6('0x2c')]};});_0xf3a464[_0x66a6('0x2d')]=_['map'](_0x135c8d,_0x66a6('0x26'));_0xf3a464[_0x66a6('0x2e')]=_[_0x66a6('0x2f')](_0x37a14e['query']);_0xf3a464[_0x66a6('0x30')]=_[_0x66a6('0x31')](_0xf3a464[_0x66a6('0x2d')],_0xf3a464[_0x66a6('0x2e')]);_0x4816d6[_0x66a6('0x32')]=_['intersection'](_0xf3a464['model'],qs[_0x66a6('0x33')](_0x37a14e['query']['fields']));_0x4816d6[_0x66a6('0x32')]=_0x4816d6[_0x66a6('0x32')][_0x66a6('0x34')]?_0x4816d6[_0x66a6('0x32')]:_0xf3a464[_0x66a6('0x2d')];if(!_0x37a14e[_0x66a6('0x2e')][_0x66a6('0x35')](_0x66a6('0x36'))){_0x4816d6[_0x66a6('0x1a')]=qs[_0x66a6('0x1a')](_0x37a14e[_0x66a6('0x2e')][_0x66a6('0x1a')]);_0x4816d6[_0x66a6('0x18')]=qs[_0x66a6('0x18')](_0x37a14e['query'][_0x66a6('0x18')]);}_0x4816d6[_0x66a6('0x37')]=qs[_0x66a6('0x38')](_0x37a14e[_0x66a6('0x2e')][_0x66a6('0x38')]);_0x4816d6[_0x66a6('0x39')]=qs[_0x66a6('0x30')](_[_0x66a6('0x3a')](_0x37a14e[_0x66a6('0x2e')],_0xf3a464[_0x66a6('0x30')]),_0x135c8d);if(_0x37a14e[_0x66a6('0x2e')][_0x66a6('0x3b')]){_0x4816d6[_0x66a6('0x39')]=_['merge'](_0x4816d6[_0x66a6('0x39')],{'$or':_[_0x66a6('0x3c')](_0x135c8d,function(_0x58ac56){if(_0x58ac56['type']!==_0x66a6('0x3d')){var _0x24cbbc={};_0x24cbbc[_0x58ac56[_0x66a6('0x26')]]={'$like':'%'+_0x37a14e['query'][_0x66a6('0x3b')]+'%'};return _0x24cbbc;}})});}_0x4816d6=_[_0x66a6('0x3e')]({},_0x4816d6,_0x37a14e['options']);var _0x4ee385={'where':_0x4816d6[_0x66a6('0x39')]};return db['AnalyticTreeReport'][_0x66a6('0x1b')](_0x4ee385)[_0x66a6('0x23')](function(_0x1aea6b){_0x17edf3[_0x66a6('0x1b')]=_0x1aea6b;if(_0x37a14e[_0x66a6('0x2e')][_0x66a6('0x3f')]){_0x4816d6[_0x66a6('0x40')]=[{'all':!![]}];}return db[_0x66a6('0x28')][_0x66a6('0x41')](_0x4816d6);})[_0x66a6('0x23')](function(_0x5762fc){_0x17edf3[_0x66a6('0x42')]=_0x5762fc;return _0x17edf3;})['then'](respondWithFilteredResult(_0x287fa8,_0x4816d6))['catch'](handleError(_0x287fa8,null));};exports[_0x66a6('0x43')]=function(_0x234343,_0xb2ea2f){var _0x4df1d2={'raw':!![],'where':{'id':_0x234343[_0x66a6('0x44')]['id']}},_0x285e1f={};_0x285e1f['model']=_[_0x66a6('0x2f')](db['AnalyticTreeReport'][_0x66a6('0x29')]);_0x285e1f['query']=_[_0x66a6('0x2f')](_0x234343['query']);_0x285e1f[_0x66a6('0x30')]=_[_0x66a6('0x31')](_0x285e1f[_0x66a6('0x2d')],_0x285e1f['query']);_0x4df1d2['attributes']=_[_0x66a6('0x31')](_0x285e1f[_0x66a6('0x2d')],qs[_0x66a6('0x33')](_0x234343[_0x66a6('0x2e')]['fields']));_0x4df1d2[_0x66a6('0x32')]=_0x4df1d2[_0x66a6('0x32')]['length']?_0x4df1d2[_0x66a6('0x32')]:_0x285e1f[_0x66a6('0x2d')];if(_0x234343[_0x66a6('0x2e')][_0x66a6('0x3f')]){_0x4df1d2[_0x66a6('0x40')]=[{'all':!![]}];}_0x4df1d2=_[_0x66a6('0x3e')]({},_0x4df1d2,_0x234343['options']);return db[_0x66a6('0x28')][_0x66a6('0x45')](_0x4df1d2)[_0x66a6('0x23')](handleEntityNotFound(_0xb2ea2f,null))['then'](respondWithResult(_0xb2ea2f,null))['catch'](handleError(_0xb2ea2f,null));};exports['create']=function(_0x1f26d1,_0x3a646b){return db[_0x66a6('0x28')]['create'](_0x1f26d1[_0x66a6('0x46')],{})[_0x66a6('0x23')](respondWithResult(_0x3a646b,0xc9))['catch'](handleError(_0x3a646b,null));};exports[_0x66a6('0x22')]=function(_0xeae67c,_0x2cffbd){if(_0xeae67c[_0x66a6('0x46')]['id']){delete _0xeae67c[_0x66a6('0x46')]['id'];}return db[_0x66a6('0x28')][_0x66a6('0x45')]({'where':{'id':_0xeae67c[_0x66a6('0x44')]['id']}})[_0x66a6('0x23')](handleEntityNotFound(_0x2cffbd,null))[_0x66a6('0x23')](saveUpdates(_0xeae67c[_0x66a6('0x46')],null))['then'](respondWithResult(_0x2cffbd,null))[_0x66a6('0x47')](handleError(_0x2cffbd,null));};exports['destroy']=function(_0x55a108,_0x30f992){return db[_0x66a6('0x28')][_0x66a6('0x45')]({'where':{'id':_0x55a108[_0x66a6('0x44')]['id']}})[_0x66a6('0x23')](handleEntityNotFound(_0x30f992,null))['then'](removeEntity(_0x30f992,null))[_0x66a6('0x47')](handleError(_0x30f992,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 8200691..893e9c8 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 _0xfb94=['lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./analyticTreeReport.attributes','exports','AnalyticTreeReport'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfb94,0x1b8));var _0x4fb9=function(_0x9ae3d0,_0x121f9f){_0x9ae3d0=_0x9ae3d0-0x0;var _0x4e26f2=_0xfb94[_0x9ae3d0];return _0x4e26f2;};'use strict';var _=require(_0x4fb9('0x0'));var util=require(_0x4fb9('0x1'));var logger=require(_0x4fb9('0x2'))(_0x4fb9('0x3'));var moment=require('moment');var BPromise=require(_0x4fb9('0x4'));var rp=require(_0x4fb9('0x5'));var fs=require('fs');var path=require(_0x4fb9('0x6'));var rimraf=require('rimraf');var config=require(_0x4fb9('0x7'));var attributes=require(_0x4fb9('0x8'));module[_0x4fb9('0x9')]=function(_0xeab65f,_0x2a1f60){return _0xeab65f['define'](_0x4fb9('0xa'),attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x38cb=['request-promise','path','rimraf','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1327fb,_0x62b273){var _0x549624=function(_0x46b502){while(--_0x46b502){_0x1327fb['push'](_0x1327fb['shift']());}};_0x549624(++_0x62b273);}(_0x38cb,0xbe));var _0xb38c=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x38cb[_0x28947d];return _0x12d2ee;};'use strict';var _=require(_0xb38c('0x0'));var util=require(_0xb38c('0x1'));var logger=require(_0xb38c('0x2'))(_0xb38c('0x3'));var moment=require(_0xb38c('0x4'));var BPromise=require(_0xb38c('0x5'));var rp=require(_0xb38c('0x6'));var fs=require('fs');var path=require(_0xb38c('0x7'));var rimraf=require(_0xb38c('0x8'));var config=require('../../config/environment');var attributes=require(_0xb38c('0x9'));module[_0xb38c('0xa')]=function(_0x313703,_0xb7e754){return _0x313703[_0xb38c('0xb')](_0xb38c('0xc'),attributes,{'tableName':_0xb38c('0xd'),'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 0ac0db3..7dff198 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 _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x241424,_0x25eb5d){var _0x3da798=function(_0x415153){while(--_0x415153){_0x241424['push'](_0x241424['shift']());}};_0x3da798(++_0x25eb5d);}(_0xadb5,0xad));var _0x5adb=function(_0x31e65d,_0x29cf21){_0x31e65d=_0x31e65d-0x0;var _0x4e9041=_0xadb5[_0x31e65d];return _0x4e9041;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file +var _0x1261=['then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x11403a,_0x1e1aaa){var _0x2a37d7=function(_0x2d3751){while(--_0x2d3751){_0x11403a['push'](_0x11403a['shift']());}};_0x2a37d7(++_0x1e1aaa);}(_0x1261,0x144));var _0x1126=function(_0x29e0eb,_0x9acb52){_0x29e0eb=_0x29e0eb-0x0;var _0x597d2d=_0x1261[_0x29e0eb];return _0x597d2d;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 41d28f5..8318e8c 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 _0x894c=['./analyticTreeReport.controller','get','isAuthenticated','/:id','show','post','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5c23c2,_0x470751){var _0x53ed0c=function(_0x1ea5e6){while(--_0x1ea5e6){_0x5c23c2['push'](_0x5c23c2['shift']());}};_0x53ed0c(++_0x470751);}(_0x894c,0x114));var _0xc894=function(_0x56f96f,_0x361a6c){_0x56f96f=_0x56f96f-0x0;var _0x27d5fe=_0x894c[_0x56f96f];return _0x27d5fe;};'use strict';var multer=require(_0xc894('0x0'));var util=require(_0xc894('0x1'));var path=require(_0xc894('0x2'));var timeout=require(_0xc894('0x3'));var express=require(_0xc894('0x4'));var router=express[_0xc894('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc894('0x6'));var interaction=require(_0xc894('0x7'));var config=require(_0xc894('0x8'));var controller=require(_0xc894('0x9'));router[_0xc894('0xa')]('/',auth[_0xc894('0xb')](),controller['index']);router[_0xc894('0xa')](_0xc894('0xc'),auth[_0xc894('0xb')](),controller[_0xc894('0xd')]);router[_0xc894('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc894('0xf')]('/:id',auth[_0xc894('0xb')](),controller[_0xc894('0x10')]);router['delete'](_0xc894('0xc'),auth[_0xc894('0xb')](),controller[_0xc894('0x11')]);module[_0xc894('0x12')]=router; \ No newline at end of file +var _0x1553=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','/:id','post','put','update','delete','destroy','multer'];(function(_0x2ec14c,_0x45f699){var _0x578960=function(_0x5bea3e){while(--_0x5bea3e){_0x2ec14c['push'](_0x2ec14c['shift']());}};_0x578960(++_0x45f699);}(_0x1553,0x120));var _0x3155=function(_0x3ebcab,_0x482df2){_0x3ebcab=_0x3ebcab-0x0;var _0x4074d3=_0x1553[_0x3ebcab];return _0x4074d3;};'use strict';var multer=require(_0x3155('0x0'));var util=require('util');var path=require(_0x3155('0x1'));var timeout=require(_0x3155('0x2'));var express=require(_0x3155('0x3'));var router=express[_0x3155('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3155('0x5'));var interaction=require(_0x3155('0x6'));var config=require(_0x3155('0x7'));var controller=require(_0x3155('0x8'));router[_0x3155('0x9')]('/',auth[_0x3155('0xa')](),controller['index']);router[_0x3155('0x9')](_0x3155('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x3155('0xc')]('/',auth[_0x3155('0xa')](),controller['create']);router[_0x3155('0xd')](_0x3155('0xb'),auth['isAuthenticated'](),controller[_0x3155('0xe')]);router[_0x3155('0xf')](_0x3155('0xb'),auth['isAuthenticated'](),controller[_0x3155('0x10')]);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 ff2c1ee..e67a353 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 _0x3299=['exports','STRING'];(function(_0x44f411,_0x50ec93){var _0xa827d3=function(_0x425861){while(--_0x425861){_0x44f411['push'](_0x44f411['shift']());}};_0xa827d3(++_0x50ec93);}(_0x3299,0x1bc));var _0x9329=function(_0x23f581,_0x25a955){_0x23f581=_0x23f581-0x0;var _0x50e39a=_0x3299[_0x23f581];return _0x50e39a;};'use strict';var Sequelize=require('sequelize');module[_0x9329('0x0')]={'name':{'type':Sequelize[_0x9329('0x1')]},'basename':{'type':Sequelize[_0x9329('0x1')]},'type':{'type':Sequelize[_0x9329('0x1')]}}; \ No newline at end of file +var _0xcb81=['STRING','sequelize','exports'];(function(_0x4c9be7,_0x538b4d){var _0x5250a7=function(_0x4a71a0){while(--_0x4a71a0){_0x4c9be7['push'](_0x4c9be7['shift']());}};_0x5250a7(++_0x538b4d);}(_0xcb81,0x154));var _0x1cb8=function(_0x55ff79,_0x3d45e7){_0x55ff79=_0x55ff79-0x0;var _0x579067=_0xcb81[_0x55ff79];return _0x579067;};'use strict';var Sequelize=require(_0x1cb8('0x0'));module[_0x1cb8('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0x1cb8('0x2')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 2e72082..e041a7e 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 _0xe19a=['then','destroy','name','send','index','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','hasOwnProperty','limit','sort','where','map','options','Attachment','includeAll','include','findAll','rows','catch','show','params','fields','length','find','clone','omit','createdAt','updatedAt','body','create','merge','file','originalname','basename','filename','mimetype','download','findOne','ChatOfflineMessageId','root','server/files/attachments/','join','offline-chat/','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update'];(function(_0x3eb6d8,_0x5dbf7b){var _0x5e3ff2=function(_0x254a23){while(--_0x254a23){_0x3eb6d8['push'](_0x3eb6d8['shift']());}};_0x5e3ff2(++_0x5dbf7b);}(_0xe19a,0x1e5));var _0xae19=function(_0x8ae98b,_0x155f88){_0x8ae98b=_0x8ae98b-0x0;var _0xc30bd4=_0xe19a[_0x8ae98b];return _0xc30bd4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xae19('0x0'));var zipdir=require(_0xae19('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xae19('0x2'));var moment=require(_0xae19('0x3'));var BPromise=require(_0xae19('0x4'));var Mustache=require(_0xae19('0x5'));var util=require(_0xae19('0x6'));var path=require(_0xae19('0x7'));var sox=require(_0xae19('0x8'));var csv=require('to-csv');var ejs=require(_0xae19('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xae19('0xa'));var squel=require(_0xae19('0xb'));var crypto=require(_0xae19('0xc'));var jsforce=require(_0xae19('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xae19('0xe'));var querystring=require(_0xae19('0xf'));var Papa=require('papaparse');var Redis=require(_0xae19('0x10'));var authService=require(_0xae19('0x11'));var qs=require(_0xae19('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xae19('0x13'));var logger=require('../../config/logger')(_0xae19('0x14'));var utils=require(_0xae19('0x15'));var config=require(_0xae19('0x16'));var licenseUtil=require(_0xae19('0x17'));var db=require(_0xae19('0x18'))['db'];function respondWithStatusCode(_0x186518,_0x402774){_0x402774=_0x402774||0xcc;return function(_0x3a3fbe){if(_0x3a3fbe){return _0x186518[_0xae19('0x19')](_0x402774);}return _0x186518[_0xae19('0x1a')](_0x402774)[_0xae19('0x1b')]();};}function respondWithResult(_0x416171,_0x6f28a0){_0x6f28a0=_0x6f28a0||0xc8;return function(_0x18e0d9){if(_0x18e0d9){return _0x416171[_0xae19('0x1a')](_0x6f28a0)[_0xae19('0x1c')](_0x18e0d9);}};}function respondWithFilteredResult(_0xeeb3c9,_0xac8434){return function(_0x3d0e69){if(_0x3d0e69){var _0x5290c0=typeof _0xac8434[_0xae19('0x1d')]===_0xae19('0x1e')&&typeof _0xac8434['limit']===_0xae19('0x1e');var _0x3a78ba=_0x3d0e69['count'];var _0x529bc6=_0x5290c0?0x0:_0xac8434[_0xae19('0x1d')];var _0x7f045e=_0x5290c0?_0x3d0e69[_0xae19('0x1f')]:_0xac8434[_0xae19('0x1d')]+_0xac8434['limit'];var _0x4bdf74;if(_0x7f045e>=_0x3a78ba){_0x7f045e=_0x3a78ba;_0x4bdf74=0xc8;}else{_0x4bdf74=0xce;}_0xeeb3c9[_0xae19('0x1a')](_0x4bdf74);return _0xeeb3c9[_0xae19('0x20')](_0xae19('0x21'),_0x529bc6+'-'+_0x7f045e+'/'+_0x3a78ba)['json'](_0x3d0e69);}return null;};}function patchUpdates(_0x4679d5){return function(_0x59bb1a){try{jsonpatch[_0xae19('0x22')](_0x59bb1a,_0x4679d5,!![]);}catch(_0x203b93){return BPromise['reject'](_0x203b93);}return _0x59bb1a[_0xae19('0x23')]();};}function saveUpdates(_0x5656cc,_0x231853){return function(_0x22ca99){if(_0x22ca99){return _0x22ca99[_0xae19('0x24')](_0x5656cc)[_0xae19('0x25')](function(_0x4aa06c){return _0x4aa06c;});}return null;};}function removeEntity(_0x489097,_0x4c1aa9){return function(_0x40309b){if(_0x40309b){return _0x40309b[_0xae19('0x26')]()[_0xae19('0x25')](function(){_0x489097[_0xae19('0x1a')](0xcc)[_0xae19('0x1b')]();});}};}function handleEntityNotFound(_0x5b7d60,_0x2ee0e6){return function(_0x1f4a27){if(!_0x1f4a27){_0x5b7d60['sendStatus'](0x194);}return _0x1f4a27;};}function handleError(_0x4a60e4,_0x37e042){_0x37e042=_0x37e042||0x1f4;return function(_0x1803b0){logger['error'](_0x1803b0['stack']);if(_0x1803b0[_0xae19('0x27')]){delete _0x1803b0[_0xae19('0x27')];}_0x4a60e4['status'](_0x37e042)[_0xae19('0x28')](_0x1803b0);};}exports[_0xae19('0x29')]=function(_0x39a1a9,_0x3fecb6){var _0x5b3228={},_0x123306={},_0xb38c75={'count':0x0,'rows':[]};var _0x220b48=_['map'](db['Attachment'][_0xae19('0x2a')],function(_0x4e695){return{'name':_0x4e695[_0xae19('0x2b')],'type':_0x4e695[_0xae19('0x2c')]['key']};});_0x123306[_0xae19('0x2d')]=_['map'](_0x220b48,'name');_0x123306[_0xae19('0x2e')]=_[_0xae19('0x2f')](_0x39a1a9['query']);_0x123306[_0xae19('0x30')]=_[_0xae19('0x31')](_0x123306[_0xae19('0x2d')],_0x123306[_0xae19('0x2e')]);_0x5b3228[_0xae19('0x32')]=_[_0xae19('0x31')](_0x123306[_0xae19('0x2d')],qs['fields'](_0x39a1a9['query']['fields']));_0x5b3228['attributes']=_0x5b3228[_0xae19('0x32')]['length']?_0x5b3228[_0xae19('0x32')]:_0x123306[_0xae19('0x2d')];if(!_0x39a1a9['query'][_0xae19('0x33')]('nolimit')){_0x5b3228[_0xae19('0x34')]=qs['limit'](_0x39a1a9[_0xae19('0x2e')][_0xae19('0x34')]);_0x5b3228[_0xae19('0x1d')]=qs[_0xae19('0x1d')](_0x39a1a9[_0xae19('0x2e')][_0xae19('0x1d')]);}_0x5b3228['order']=qs[_0xae19('0x35')](_0x39a1a9[_0xae19('0x2e')][_0xae19('0x35')]);_0x5b3228[_0xae19('0x36')]=qs[_0xae19('0x30')](_['pick'](_0x39a1a9[_0xae19('0x2e')],_0x123306[_0xae19('0x30')]),_0x220b48);if(_0x39a1a9[_0xae19('0x2e')]['filter']){_0x5b3228[_0xae19('0x36')]=_['merge'](_0x5b3228[_0xae19('0x36')],{'$or':_[_0xae19('0x37')](_0x220b48,function(_0x190f85){if(_0x190f85[_0xae19('0x2c')]!=='VIRTUAL'){var _0x24864b={};_0x24864b[_0x190f85[_0xae19('0x27')]]={'$like':'%'+_0x39a1a9['query']['filter']+'%'};return _0x24864b;}})});}_0x5b3228=_['merge']({},_0x5b3228,_0x39a1a9[_0xae19('0x38')]);var _0x21e6c2={'where':_0x5b3228[_0xae19('0x36')]};return db[_0xae19('0x39')][_0xae19('0x1f')](_0x21e6c2)[_0xae19('0x25')](function(_0x22e883){_0xb38c75[_0xae19('0x1f')]=_0x22e883;if(_0x39a1a9[_0xae19('0x2e')][_0xae19('0x3a')]){_0x5b3228[_0xae19('0x3b')]=[{'all':!![]}];}return db[_0xae19('0x39')][_0xae19('0x3c')](_0x5b3228);})[_0xae19('0x25')](function(_0x187ebf){_0xb38c75[_0xae19('0x3d')]=_0x187ebf;return _0xb38c75;})[_0xae19('0x25')](respondWithFilteredResult(_0x3fecb6,_0x5b3228))[_0xae19('0x3e')](handleError(_0x3fecb6,null));};exports[_0xae19('0x3f')]=function(_0x3b5086,_0x4bd3d0){var _0x33940c={'raw':!![],'where':{'id':_0x3b5086[_0xae19('0x40')]['id']}},_0x516613={};_0x516613['model']=_[_0xae19('0x2f')](db[_0xae19('0x39')][_0xae19('0x2a')]);_0x516613[_0xae19('0x2e')]=_['keys'](_0x3b5086[_0xae19('0x2e')]);_0x516613['filters']=_[_0xae19('0x31')](_0x516613[_0xae19('0x2d')],_0x516613[_0xae19('0x2e')]);_0x33940c[_0xae19('0x32')]=_[_0xae19('0x31')](_0x516613[_0xae19('0x2d')],qs[_0xae19('0x41')](_0x3b5086[_0xae19('0x2e')][_0xae19('0x41')]));_0x33940c['attributes']=_0x33940c[_0xae19('0x32')][_0xae19('0x42')]?_0x33940c['attributes']:_0x516613['model'];if(_0x3b5086['query'][_0xae19('0x3a')]){_0x33940c['include']=[{'all':!![]}];}_0x33940c=_['merge']({},_0x33940c,_0x3b5086[_0xae19('0x38')]);return db[_0xae19('0x39')][_0xae19('0x43')](_0x33940c)['then'](handleEntityNotFound(_0x4bd3d0,null))['then'](respondWithResult(_0x4bd3d0,null))[_0xae19('0x3e')](handleError(_0x4bd3d0,null));};exports[_0xae19('0x44')]=function(_0x2a0331,_0x2bc6c7){var _0x55560d={'where':{'id':_0x2a0331['params']['id']}},_0x13e13e={};_0x13e13e[_0xae19('0x2d')]=_[_0xae19('0x2f')](db['Attachment'][_0xae19('0x2a')]);_0x55560d[_0xae19('0x32')]=_[_0xae19('0x31')](_0x13e13e['model'],qs[_0xae19('0x41')](_0x2a0331[_0xae19('0x2e')][_0xae19('0x41')]));_0x55560d['attributes']=_0x55560d[_0xae19('0x32')][_0xae19('0x42')]?_0x55560d[_0xae19('0x32')]:_0x13e13e[_0xae19('0x2d')];if(_0x2a0331[_0xae19('0x2e')]['includeAll']){_0x55560d['include']=[{'all':!![]}];}_0x55560d=_['merge']({},_0x55560d,_0x2a0331['options']);return db[_0xae19('0x39')][_0xae19('0x43')](_0x55560d)['then'](handleEntityNotFound(_0x2bc6c7,null))[_0xae19('0x25')](function(_0x571230){if(_0x571230){var _0x2a7e74=_0x571230['get']({'plain':!![]});_0x2a7e74=qs[_0xae19('0x45')](_0x2a7e74,['id',_0xae19('0x46'),_0xae19('0x47')]);_0x2a0331[_0xae19('0x48')]=_[_0xae19('0x45')](_0x2a0331[_0xae19('0x48')],['id',_0xae19('0x46'),_0xae19('0x47')]);return db[_0xae19('0x39')][_0xae19('0x49')](_[_0xae19('0x4a')](_0x2a7e74,_0x2a0331['body']),{'include':_0x2a0331[_0xae19('0x2e')][_0xae19('0x3a')]?[{'all':!![]}]:undefined});}})[_0xae19('0x25')](respondWithResult(_0x2bc6c7,0xc9))[_0xae19('0x3e')](handleError(_0x2bc6c7,null));};exports[_0xae19('0x24')]=function(_0x5147c9,_0x1628c3){if(_0x5147c9[_0xae19('0x48')]['id']){delete _0x5147c9['body']['id'];}return db[_0xae19('0x39')]['find']({'where':{'id':_0x5147c9['params']['id']}})[_0xae19('0x25')](handleEntityNotFound(_0x1628c3,null))[_0xae19('0x25')](saveUpdates(_0x5147c9['body'],null))[_0xae19('0x25')](respondWithResult(_0x1628c3,null))[_0xae19('0x3e')](handleError(_0x1628c3,null));};exports['destroy']=function(_0x2a8c30,_0x584ce6){return db[_0xae19('0x39')]['find']({'where':{'id':_0x2a8c30[_0xae19('0x40')]['id']}})[_0xae19('0x25')](handleEntityNotFound(_0x584ce6,null))['then'](removeEntity(_0x584ce6,null))[_0xae19('0x3e')](handleError(_0x584ce6,null));};exports[_0xae19('0x49')]=function(_0x564c5e,_0x366dd6,_0x1ba9bf){_0x564c5e[_0xae19('0x48')]['name']=_0x564c5e[_0xae19('0x4b')][_0xae19('0x4c')];_0x564c5e[_0xae19('0x48')][_0xae19('0x4d')]=_0x564c5e[_0xae19('0x4b')][_0xae19('0x4e')];_0x564c5e['body'][_0xae19('0x2c')]=_0x564c5e[_0xae19('0x4b')][_0xae19('0x4f')];return db[_0xae19('0x39')]['create'](_0x564c5e[_0xae19('0x48')])[_0xae19('0x25')](respondWithResult(_0x366dd6,0xc9))[_0xae19('0x3e')](handleError(_0x366dd6,null));};exports[_0xae19('0x50')]=function(_0x289c9d,_0x1be02f,_0x23889a){return db[_0xae19('0x39')][_0xae19('0x51')]({'where':{'id':_0x289c9d[_0xae19('0x40')]['id']},'raw':!![]})[_0xae19('0x25')](handleEntityNotFound(_0x1be02f,null))[_0xae19('0x25')](function(_0x23a2bf){if(_0x23a2bf){var _0x10bff2=_0x23a2bf[_0xae19('0x52')]!==null;var _0xff037=path['join'](config[_0xae19('0x53')],_0xae19('0x54'));if(_0x10bff2){_0xff037=path[_0xae19('0x55')](_0xff037,_0xae19('0x56'));}var _0x47e058=path[_0xae19('0x55')](_0xff037,_0x23a2bf[_0xae19('0x4d')]);return _0x1be02f[_0xae19('0x50')](_0x47e058);}})['catch'](handleError(_0x1be02f,null));}; \ No newline at end of file +var _0x2c50=['lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','name','send','index','map','Attachment','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','filter','VIRTUAL','merge','options','include','findAll','catch','show','params','rawAttributes','find','clone','includeAll','get','omit','updatedAt','body','createdAt','create','originalname','basename','file','filename','type','mimetype','download','findOne','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra'];(function(_0x3260b0,_0x5affce){var _0x1bf312=function(_0x60e569){while(--_0x60e569){_0x3260b0['push'](_0x3260b0['shift']());}};_0x1bf312(++_0x5affce);}(_0x2c50,0x1ad));var _0x02c5=function(_0x207d2f,_0x44400f){_0x207d2f=_0x207d2f-0x0;var _0x3c3498=_0x2c50[_0x207d2f];return _0x3c3498;};'use strict';var emlformat=require(_0x02c5('0x0'));var rimraf=require(_0x02c5('0x1'));var zipdir=require(_0x02c5('0x2'));var jsonpatch=require(_0x02c5('0x3'));var rp=require(_0x02c5('0x4'));var moment=require('moment');var BPromise=require(_0x02c5('0x5'));var Mustache=require(_0x02c5('0x6'));var util=require(_0x02c5('0x7'));var path=require('path');var sox=require(_0x02c5('0x8'));var csv=require(_0x02c5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x02c5('0xa'));var _=require(_0x02c5('0xb'));var squel=require(_0x02c5('0xc'));var crypto=require(_0x02c5('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x02c5('0xe'));var toCsv=require(_0x02c5('0x9'));var querystring=require(_0x02c5('0xf'));var Papa=require(_0x02c5('0x10'));var Redis=require(_0x02c5('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x02c5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x02c5('0x13'));var logger=require('../../config/logger')(_0x02c5('0x14'));var utils=require(_0x02c5('0x15'));var config=require(_0x02c5('0x16'));var licenseUtil=require(_0x02c5('0x17'));var db=require(_0x02c5('0x18'))['db'];function respondWithStatusCode(_0x1c7746,_0x5e54dd){_0x5e54dd=_0x5e54dd||0xcc;return function(_0x570328){if(_0x570328){return _0x1c7746[_0x02c5('0x19')](_0x5e54dd);}return _0x1c7746['status'](_0x5e54dd)[_0x02c5('0x1a')]();};}function respondWithResult(_0x489b71,_0x39b3f3){_0x39b3f3=_0x39b3f3||0xc8;return function(_0x2bfa00){if(_0x2bfa00){return _0x489b71[_0x02c5('0x1b')](_0x39b3f3)[_0x02c5('0x1c')](_0x2bfa00);}};}function respondWithFilteredResult(_0x4bd8ef,_0x44431e){return function(_0x1ff8a5){if(_0x1ff8a5){var _0x343b9a=typeof _0x44431e[_0x02c5('0x1d')]===_0x02c5('0x1e')&&typeof _0x44431e[_0x02c5('0x1f')]===_0x02c5('0x1e');var _0x3dc155=_0x1ff8a5[_0x02c5('0x20')];var _0x316200=_0x343b9a?0x0:_0x44431e[_0x02c5('0x1d')];var _0x3d9329=_0x343b9a?_0x1ff8a5[_0x02c5('0x20')]:_0x44431e['offset']+_0x44431e['limit'];var _0x1fea78;if(_0x3d9329>=_0x3dc155){_0x3d9329=_0x3dc155;_0x1fea78=0xc8;}else{_0x1fea78=0xce;}_0x4bd8ef[_0x02c5('0x1b')](_0x1fea78);return _0x4bd8ef['set'](_0x02c5('0x21'),_0x316200+'-'+_0x3d9329+'/'+_0x3dc155)['json'](_0x1ff8a5);}return null;};}function patchUpdates(_0x257867){return function(_0x37cfb3){try{jsonpatch[_0x02c5('0x22')](_0x37cfb3,_0x257867,!![]);}catch(_0x2f1213){return BPromise[_0x02c5('0x23')](_0x2f1213);}return _0x37cfb3['save']();};}function saveUpdates(_0x9f665c,_0x2419d3){return function(_0x3845ae){if(_0x3845ae){return _0x3845ae[_0x02c5('0x24')](_0x9f665c)[_0x02c5('0x25')](function(_0x4f4860){return _0x4f4860;});}return null;};}function removeEntity(_0x1afe23,_0x2dc5b2){return function(_0x5b1742){if(_0x5b1742){return _0x5b1742[_0x02c5('0x26')]()[_0x02c5('0x25')](function(){_0x1afe23['status'](0xcc)[_0x02c5('0x1a')]();});}};}function handleEntityNotFound(_0x22a42e,_0x146b45){return function(_0x476680){if(!_0x476680){_0x22a42e[_0x02c5('0x19')](0x194);}return _0x476680;};}function handleError(_0x1d6507,_0x583f27){_0x583f27=_0x583f27||0x1f4;return function(_0x5e40cd){logger['error'](_0x5e40cd['stack']);if(_0x5e40cd[_0x02c5('0x27')]){delete _0x5e40cd[_0x02c5('0x27')];}_0x1d6507[_0x02c5('0x1b')](_0x583f27)[_0x02c5('0x28')](_0x5e40cd);};}exports[_0x02c5('0x29')]=function(_0x520e56,_0x372621){var _0x49bc15={},_0x5384e2={},_0x478041={'count':0x0,'rows':[]};var _0x46648c=_[_0x02c5('0x2a')](db[_0x02c5('0x2b')]['rawAttributes'],function(_0x48b9a7){return{'name':_0x48b9a7[_0x02c5('0x2c')],'type':_0x48b9a7['type'][_0x02c5('0x2d')]};});_0x5384e2['model']=_[_0x02c5('0x2a')](_0x46648c,'name');_0x5384e2[_0x02c5('0x2e')]=_[_0x02c5('0x2f')](_0x520e56['query']);_0x5384e2[_0x02c5('0x30')]=_[_0x02c5('0x31')](_0x5384e2[_0x02c5('0x32')],_0x5384e2[_0x02c5('0x2e')]);_0x49bc15[_0x02c5('0x33')]=_[_0x02c5('0x31')](_0x5384e2[_0x02c5('0x32')],qs['fields'](_0x520e56[_0x02c5('0x2e')][_0x02c5('0x34')]));_0x49bc15[_0x02c5('0x33')]=_0x49bc15[_0x02c5('0x33')][_0x02c5('0x35')]?_0x49bc15[_0x02c5('0x33')]:_0x5384e2[_0x02c5('0x32')];if(!_0x520e56[_0x02c5('0x2e')][_0x02c5('0x36')]('nolimit')){_0x49bc15[_0x02c5('0x1f')]=qs['limit'](_0x520e56[_0x02c5('0x2e')][_0x02c5('0x1f')]);_0x49bc15[_0x02c5('0x1d')]=qs[_0x02c5('0x1d')](_0x520e56[_0x02c5('0x2e')][_0x02c5('0x1d')]);}_0x49bc15['order']=qs[_0x02c5('0x37')](_0x520e56[_0x02c5('0x2e')]['sort']);_0x49bc15[_0x02c5('0x38')]=qs[_0x02c5('0x30')](_['pick'](_0x520e56[_0x02c5('0x2e')],_0x5384e2['filters']),_0x46648c);if(_0x520e56[_0x02c5('0x2e')][_0x02c5('0x39')]){_0x49bc15[_0x02c5('0x38')]=_['merge'](_0x49bc15[_0x02c5('0x38')],{'$or':_[_0x02c5('0x2a')](_0x46648c,function(_0x23f9b4){if(_0x23f9b4['type']!==_0x02c5('0x3a')){var _0x4f0fe4={};_0x4f0fe4[_0x23f9b4[_0x02c5('0x27')]]={'$like':'%'+_0x520e56[_0x02c5('0x2e')][_0x02c5('0x39')]+'%'};return _0x4f0fe4;}})});}_0x49bc15=_[_0x02c5('0x3b')]({},_0x49bc15,_0x520e56[_0x02c5('0x3c')]);var _0x189379={'where':_0x49bc15['where']};return db[_0x02c5('0x2b')][_0x02c5('0x20')](_0x189379)[_0x02c5('0x25')](function(_0x571bb5){_0x478041[_0x02c5('0x20')]=_0x571bb5;if(_0x520e56[_0x02c5('0x2e')]['includeAll']){_0x49bc15[_0x02c5('0x3d')]=[{'all':!![]}];}return db[_0x02c5('0x2b')][_0x02c5('0x3e')](_0x49bc15);})[_0x02c5('0x25')](function(_0x489e41){_0x478041['rows']=_0x489e41;return _0x478041;})['then'](respondWithFilteredResult(_0x372621,_0x49bc15))[_0x02c5('0x3f')](handleError(_0x372621,null));};exports[_0x02c5('0x40')]=function(_0x244815,_0x59bd66){var _0x23c80a={'raw':!![],'where':{'id':_0x244815[_0x02c5('0x41')]['id']}},_0x2f7ae2={};_0x2f7ae2['model']=_['keys'](db[_0x02c5('0x2b')][_0x02c5('0x42')]);_0x2f7ae2['query']=_['keys'](_0x244815['query']);_0x2f7ae2[_0x02c5('0x30')]=_[_0x02c5('0x31')](_0x2f7ae2['model'],_0x2f7ae2[_0x02c5('0x2e')]);_0x23c80a[_0x02c5('0x33')]=_[_0x02c5('0x31')](_0x2f7ae2[_0x02c5('0x32')],qs[_0x02c5('0x34')](_0x244815[_0x02c5('0x2e')][_0x02c5('0x34')]));_0x23c80a[_0x02c5('0x33')]=_0x23c80a[_0x02c5('0x33')][_0x02c5('0x35')]?_0x23c80a[_0x02c5('0x33')]:_0x2f7ae2[_0x02c5('0x32')];if(_0x244815[_0x02c5('0x2e')]['includeAll']){_0x23c80a[_0x02c5('0x3d')]=[{'all':!![]}];}_0x23c80a=_[_0x02c5('0x3b')]({},_0x23c80a,_0x244815[_0x02c5('0x3c')]);return db['Attachment'][_0x02c5('0x43')](_0x23c80a)[_0x02c5('0x25')](handleEntityNotFound(_0x59bd66,null))[_0x02c5('0x25')](respondWithResult(_0x59bd66,null))['catch'](handleError(_0x59bd66,null));};exports[_0x02c5('0x44')]=function(_0x3f40e1,_0x579e86){var _0x3dde7c={'where':{'id':_0x3f40e1[_0x02c5('0x41')]['id']}},_0x21e956={};_0x21e956['model']=_[_0x02c5('0x2f')](db[_0x02c5('0x2b')]['rawAttributes']);_0x3dde7c['attributes']=_['intersection'](_0x21e956['model'],qs[_0x02c5('0x34')](_0x3f40e1[_0x02c5('0x2e')]['fields']));_0x3dde7c['attributes']=_0x3dde7c[_0x02c5('0x33')][_0x02c5('0x35')]?_0x3dde7c[_0x02c5('0x33')]:_0x21e956['model'];if(_0x3f40e1[_0x02c5('0x2e')][_0x02c5('0x45')]){_0x3dde7c[_0x02c5('0x3d')]=[{'all':!![]}];}_0x3dde7c=_[_0x02c5('0x3b')]({},_0x3dde7c,_0x3f40e1['options']);return db[_0x02c5('0x2b')][_0x02c5('0x43')](_0x3dde7c)[_0x02c5('0x25')](handleEntityNotFound(_0x579e86,null))[_0x02c5('0x25')](function(_0x48c878){if(_0x48c878){var _0x477711=_0x48c878[_0x02c5('0x46')]({'plain':!![]});_0x477711=qs[_0x02c5('0x47')](_0x477711,['id','createdAt',_0x02c5('0x48')]);_0x3f40e1[_0x02c5('0x49')]=_['omit'](_0x3f40e1[_0x02c5('0x49')],['id',_0x02c5('0x4a'),'updatedAt']);return db[_0x02c5('0x2b')][_0x02c5('0x4b')](_[_0x02c5('0x3b')](_0x477711,_0x3f40e1[_0x02c5('0x49')]),{'include':_0x3f40e1[_0x02c5('0x2e')][_0x02c5('0x45')]?[{'all':!![]}]:undefined});}})[_0x02c5('0x25')](respondWithResult(_0x579e86,0xc9))[_0x02c5('0x3f')](handleError(_0x579e86,null));};exports[_0x02c5('0x24')]=function(_0x5de1db,_0x35adcc){if(_0x5de1db['body']['id']){delete _0x5de1db[_0x02c5('0x49')]['id'];}return db[_0x02c5('0x2b')][_0x02c5('0x43')]({'where':{'id':_0x5de1db['params']['id']}})[_0x02c5('0x25')](handleEntityNotFound(_0x35adcc,null))[_0x02c5('0x25')](saveUpdates(_0x5de1db[_0x02c5('0x49')],null))[_0x02c5('0x25')](respondWithResult(_0x35adcc,null))['catch'](handleError(_0x35adcc,null));};exports[_0x02c5('0x26')]=function(_0x1997e7,_0x50d906){return db[_0x02c5('0x2b')][_0x02c5('0x43')]({'where':{'id':_0x1997e7[_0x02c5('0x41')]['id']}})[_0x02c5('0x25')](handleEntityNotFound(_0x50d906,null))[_0x02c5('0x25')](removeEntity(_0x50d906,null))[_0x02c5('0x3f')](handleError(_0x50d906,null));};exports[_0x02c5('0x4b')]=function(_0x5419cd,_0x32718f,_0x2ca295){_0x5419cd['body'][_0x02c5('0x27')]=_0x5419cd['file'][_0x02c5('0x4c')];_0x5419cd[_0x02c5('0x49')][_0x02c5('0x4d')]=_0x5419cd[_0x02c5('0x4e')][_0x02c5('0x4f')];_0x5419cd['body'][_0x02c5('0x50')]=_0x5419cd[_0x02c5('0x4e')][_0x02c5('0x51')];return db[_0x02c5('0x2b')][_0x02c5('0x4b')](_0x5419cd['body'])[_0x02c5('0x25')](respondWithResult(_0x32718f,0xc9))[_0x02c5('0x3f')](handleError(_0x32718f,null));};exports[_0x02c5('0x52')]=function(_0x441bab,_0x431fe6,_0x7fcf9c){return db[_0x02c5('0x2b')][_0x02c5('0x53')]({'where':{'id':_0x441bab[_0x02c5('0x41')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x431fe6,null))[_0x02c5('0x25')](function(_0x4869bf){if(_0x4869bf){var _0x2e57a3=_0x4869bf[_0x02c5('0x54')]!==null;var _0x3fea1e=path[_0x02c5('0x55')](config['root'],_0x02c5('0x56'));if(_0x2e57a3){_0x3fea1e=path[_0x02c5('0x55')](_0x3fea1e,_0x02c5('0x57'));}var _0xd8df08=path[_0x02c5('0x55')](_0x3fea1e,_0x4869bf['basename']);return _0x431fe6[_0x02c5('0x52')](_0xd8df08);}})['catch'](handleError(_0x431fe6,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 77573b5..2cbdb00 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 _0xf0c4=['lodash','util','bluebird','path','rimraf','./attachment.attributes','exports','define','attachments'];(function(_0x3b722d,_0x37df87){var _0xc4e19f=function(_0x2a904f){while(--_0x2a904f){_0x3b722d['push'](_0x3b722d['shift']());}};_0xc4e19f(++_0x37df87);}(_0xf0c4,0x19e));var _0x4f0c=function(_0x1cc961,_0x2c42ee){_0x1cc961=_0x1cc961-0x0;var _0x471d86=_0xf0c4[_0x1cc961];return _0x471d86;};'use strict';var _=require(_0x4f0c('0x0'));var util=require(_0x4f0c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x4f0c('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4f0c('0x3'));var rimraf=require(_0x4f0c('0x4'));var config=require('../../config/environment');var attributes=require(_0x4f0c('0x5'));module[_0x4f0c('0x6')]=function(_0x487d21,_0x57520b){return _0x487d21[_0x4f0c('0x7')]('Attachment',attributes,{'tableName':_0x4f0c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x65a2=['attachments','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./attachment.attributes','define'];(function(_0x1f0679,_0x53d43c){var _0x3dc3a4=function(_0x49ba8f){while(--_0x49ba8f){_0x1f0679['push'](_0x1f0679['shift']());}};_0x3dc3a4(++_0x53d43c);}(_0x65a2,0x175));var _0x265a=function(_0x392865,_0x587872){_0x392865=_0x392865-0x0;var _0x5dd852=_0x65a2[_0x392865];return _0x5dd852;};'use strict';var _=require('lodash');var util=require(_0x265a('0x0'));var logger=require(_0x265a('0x1'))(_0x265a('0x2'));var moment=require(_0x265a('0x3'));var BPromise=require(_0x265a('0x4'));var rp=require(_0x265a('0x5'));var fs=require('fs');var path=require(_0x265a('0x6'));var rimraf=require(_0x265a('0x7'));var config=require(_0x265a('0x8'));var attributes=require(_0x265a('0x9'));module['exports']=function(_0x55398,_0x7d14a4){return _0x55398[_0x265a('0xa')]('Attachment',attributes,{'tableName':_0x265a('0xb'),'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 fc0870b..523be5e 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 _0x94dc=['raw','CreateAttachment','stringify','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','create','body','options'];(function(_0x4e9e0d,_0xd86384){var _0x514622=function(_0xe6b57b){while(--_0xe6b57b){_0x4e9e0d['push'](_0x4e9e0d['shift']());}};_0x514622(++_0xd86384);}(_0x94dc,0xb1));var _0xc94d=function(_0x1dd6f0,_0x59e8cf){_0x1dd6f0=_0x1dd6f0-0x0;var _0x21e871=_0x94dc[_0x1dd6f0];return _0x21e871;};'use strict';var _=require(_0xc94d('0x0'));var util=require('util');var moment=require(_0xc94d('0x1'));var BPromise=require('bluebird');var rs=require(_0xc94d('0x2'));var fs=require('fs');var Redis=require(_0xc94d('0x3'));var db=require(_0xc94d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc94d('0x5'))(_0xc94d('0x6'));var config=require(_0xc94d('0x7'));var jayson=require(_0xc94d('0x8'));var client=jayson[_0xc94d('0x9')][_0xc94d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xb7275c,_0x5776ab,_0x2f9757){return new BPromise(function(_0xbe5904,_0x15265c){return client[_0xc94d('0xb')](_0xb7275c,_0x2f9757)[_0xc94d('0xc')](function(_0x579245){logger[_0xc94d('0xd')](_0xc94d('0xe'),_0x5776ab,_0xc94d('0xf'));logger[_0xc94d('0x10')](_0xc94d('0x11'),_0x5776ab,_0xc94d('0xf'),JSON['stringify'](_0x579245));if(_0x579245[_0xc94d('0x12')]){if(_0x579245[_0xc94d('0x12')][_0xc94d('0x13')]===0x1f4){logger[_0xc94d('0x12')]('Attachment,\x20%s,\x20%s',_0x5776ab,_0x579245['error']['message']);return _0x15265c(_0x579245[_0xc94d('0x12')][_0xc94d('0x14')]);}logger[_0xc94d('0x12')](_0xc94d('0xe'),_0x5776ab,_0x579245[_0xc94d('0x12')][_0xc94d('0x14')]);return _0xbe5904(_0x579245[_0xc94d('0x12')][_0xc94d('0x14')]);}else{logger[_0xc94d('0xd')](_0xc94d('0xe'),_0x5776ab,_0xc94d('0xf'));_0xbe5904(_0x579245[_0xc94d('0x15')][_0xc94d('0x14')]);}})[_0xc94d('0x16')](function(_0x19508d){logger['error']('Attachment,\x20%s,\x20%s',_0x5776ab,_0x19508d);_0x15265c(_0x19508d);});});}exports['CreateAttachment']=function(_0x48b879){var _0x345259=this;return new Promise(function(_0x4784a2,_0x4f7287){return db['Attachment'][_0xc94d('0x17')](_0x48b879[_0xc94d('0x18')],{'raw':_0x48b879['options']?_0x48b879[_0xc94d('0x19')][_0xc94d('0x1a')]===undefined?!![]:![]:!![]})[_0xc94d('0xc')](function(_0xb5c1fd){logger[_0xc94d('0xd')](_0xc94d('0x1b'),_0x48b879);logger[_0xc94d('0x10')](_0xc94d('0x1b'),_0x48b879,JSON[_0xc94d('0x1c')](_0xb5c1fd));_0x4784a2(_0xb5c1fd);})[_0xc94d('0x16')](function(_0x5f2820){logger[_0xc94d('0x12')](_0xc94d('0x1b'),_0x5f2820[_0xc94d('0x14')],_0x48b879);_0x4f7287(_0x345259[_0xc94d('0x12')](0x1f4,_0x5f2820[_0xc94d('0x14')]));});});}; \ No newline at end of file +var _0x20ce=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','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','lodash'];(function(_0xe80a76,_0x4a226b){var _0x51803b=function(_0x421fca){while(--_0x421fca){_0xe80a76['push'](_0xe80a76['shift']());}};_0x51803b(++_0x4a226b);}(_0x20ce,0x10d));var _0xe20c=function(_0xea5fd7,_0x494826){_0xea5fd7=_0xea5fd7-0x0;var _0x28fd19=_0x20ce[_0xea5fd7];return _0x28fd19;};'use strict';var _=require(_0xe20c('0x0'));var util=require(_0xe20c('0x1'));var moment=require(_0xe20c('0x2'));var BPromise=require('bluebird');var rs=require(_0xe20c('0x3'));var fs=require('fs');var Redis=require(_0xe20c('0x4'));var db=require(_0xe20c('0x5'))['db'];var utils=require(_0xe20c('0x6'));var logger=require(_0xe20c('0x7'))(_0xe20c('0x8'));var config=require(_0xe20c('0x9'));var jayson=require(_0xe20c('0xa'));var client=jayson[_0xe20c('0xb')][_0xe20c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x893e48,_0x26b9be,_0x2d88b5){return new BPromise(function(_0x8f79ad,_0x290fb5){return client[_0xe20c('0xd')](_0x893e48,_0x2d88b5)[_0xe20c('0xe')](function(_0x385d61){logger[_0xe20c('0xf')](_0xe20c('0x10'),_0x26b9be,_0xe20c('0x11'));logger[_0xe20c('0x12')](_0xe20c('0x13'),_0x26b9be,_0xe20c('0x11'),JSON['stringify'](_0x385d61));if(_0x385d61[_0xe20c('0x14')]){if(_0x385d61[_0xe20c('0x14')][_0xe20c('0x15')]===0x1f4){logger[_0xe20c('0x14')](_0xe20c('0x10'),_0x26b9be,_0x385d61['error'][_0xe20c('0x16')]);return _0x290fb5(_0x385d61[_0xe20c('0x14')]['message']);}logger[_0xe20c('0x14')](_0xe20c('0x10'),_0x26b9be,_0x385d61[_0xe20c('0x14')]['message']);return _0x8f79ad(_0x385d61[_0xe20c('0x14')][_0xe20c('0x16')]);}else{logger[_0xe20c('0xf')](_0xe20c('0x10'),_0x26b9be,'request\x20sent');_0x8f79ad(_0x385d61[_0xe20c('0x17')]['message']);}})[_0xe20c('0x18')](function(_0x4061ed){logger[_0xe20c('0x14')](_0xe20c('0x10'),_0x26b9be,_0x4061ed);_0x290fb5(_0x4061ed);});});}exports[_0xe20c('0x19')]=function(_0x2d58a7){var _0x2a4292=this;return new Promise(function(_0x3d8df5,_0x305f2f){return db[_0xe20c('0x1a')]['create'](_0x2d58a7[_0xe20c('0x1b')],{'raw':_0x2d58a7[_0xe20c('0x1c')]?_0x2d58a7[_0xe20c('0x1c')][_0xe20c('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x563070){logger[_0xe20c('0xf')](_0xe20c('0x19'),_0x2d58a7);logger[_0xe20c('0x12')]('CreateAttachment',_0x2d58a7,JSON['stringify'](_0x563070));_0x3d8df5(_0x563070);})[_0xe20c('0x18')](function(_0x281449){logger[_0xe20c('0x14')](_0xe20c('0x19'),_0x281449['message'],_0x2d58a7);_0x305f2f(_0x2a4292[_0xe20c('0x14')](0x1f4,_0x281449['message']));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 5360310..598d863 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(_0x636402,_0x2bb3ac){var _0x584106=function(_0x14a69c){while(--_0x14a69c){_0x636402['push'](_0x636402['shift']());}};_0x584106(++_0x2bb3ac);}(_0x5f2f,0x73));var _0xf5f2=function(_0x53a258,_0x5b1010){_0x53a258=_0x53a258-0x0;var _0x1d0d59=_0x5f2f[_0x53a258];return _0x1d0d59;};'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 _0xadb5=['root','format','%s-%s','originalname','replace','file','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','post','/:id/clone'];(function(_0x280d00,_0xf8a9f7){var _0x5b227f=function(_0x3643b2){while(--_0x3643b2){_0x280d00['push'](_0x280d00['shift']());}};_0x5b227f(++_0xf8a9f7);}(_0xadb5,0xad));var _0x5adb=function(_0x345a16,_0x13cfc1){_0x345a16=_0x345a16-0x0;var _0x3880d2=_0xadb5[_0x345a16];return _0x3880d2;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./attachment.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0xe')](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller['clone']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1a8f66,_0x1ea238,_0x82e67e){_0x82e67e(null,path['join'](config[_0x5adb('0x10')],'server/files/attachments/'));},'filename':function(_0x2a0b70,_0x5433bf,_0x8cfcc6){_0x8cfcc6(null,util[_0x5adb('0x11')](_0x5adb('0x12'),Date['now'](),_0x5433bf[_0x5adb('0x13')][_0x5adb('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x5adb('0xe')]('/',upload['single'](_0x5adb('0x15')),controller['create']);router[_0x5adb('0x16')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x17')]);router[_0x5adb('0x18')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x19')]);module[_0x5adb('0x1a')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 9af9fdf..e91f953 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 _0x4570=['disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/environment','../../components/auth/service','signToken','../../config/utils','login','authenticate','google','/login','profile','callback','use','clientSecret','secret','callbackURL','blockDuration','then','User','find','map','emails','value','admin','agent'];(function(_0x34cae9,_0x361b8a){var _0x3d05f0=function(_0x3f16e9){while(--_0x3f16e9){_0x34cae9['push'](_0x34cae9['shift']());}};_0x3d05f0(++_0x361b8a);}(_0x4570,0x1b8));var _0x0457=function(_0x318f95,_0x568d3d){_0x318f95=_0x318f95-0x0;var _0xc79b90=_0x4570[_0x318f95];return _0xc79b90;};'use strict';var _=require(_0x0457('0x0'));var passport=require(_0x0457('0x1'));var GoogleStrategy=require(_0x0457('0x2'))['Strategy'];var moment=require(_0x0457('0x3'));var db=require(_0x0457('0x4'))['db'];var config=require(_0x0457('0x5'));var signToken=require(_0x0457('0x6'))[_0x0457('0x7')];var utils=require(_0x0457('0x8'));exports[_0x0457('0x9')]=passport[_0x0457('0xa')](_0x0457('0xb'),{'failureRedirect':_0x0457('0xc'),'scope':[_0x0457('0xd'),'email'],'session':![]});exports[_0x0457('0xe')]=passport[_0x0457('0xa')]('google',{'failureRedirect':_0x0457('0xc'),'session':![]});passport[_0x0457('0xf')](new GoogleStrategy({'clientID':config[_0x0457('0xb')]?config[_0x0457('0xb')]['clientID']:'id','clientSecret':config[_0x0457('0xb')]?config[_0x0457('0xb')][_0x0457('0x10')]:_0x0457('0x11'),'callbackURL':config[_0x0457('0xb')]?config[_0x0457('0xb')][_0x0457('0x12')]:''},function(_0x47b8da,_0x214eec,_0x2fd67e,_0x5c7278){var _0x515215,_0x5359cc;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x0457('0x13')],'raw':!![]})[_0x0457('0x14')](function(_0x51e770){_0x515215=_0x51e770;return db[_0x0457('0x15')][_0x0457('0x16')]({'where':{'email':_[_0x0457('0x17')](_0x2fd67e[_0x0457('0x18')],_0x0457('0x19')),'role':{'$or':[_0x0457('0x1a'),'user',_0x0457('0x1b')]}}});})[_0x0457('0x14')](function(_0x1dec1b){_0x5359cc=_0x1dec1b;if(_0x5359cc){if(_0x5359cc[_0x0457('0x1c')]){return _0x5c7278(_0x0457('0x1d'));}else if(_0x515215['blockDuration']>0x0){if(_0x5359cc[_0x0457('0x1e')]){if(moment(_0x5359cc[_0x0457('0x1f')])['add'](_0x515215[_0x0457('0x13')],_0x0457('0x20'))>moment()){return _0x5c7278(_0x0457('0x1d'));}else{return utils[_0x0457('0x21')](_0x5359cc,0x0,![],null)[_0x0457('0x14')](function(){return utils[_0x0457('0x22')](_0x5359cc);})[_0x0457('0x14')](function(){return _0x5c7278(null,_0x5359cc);});}}else{return utils[_0x0457('0x22')](_0x5359cc)[_0x0457('0x14')](function(){return _0x5c7278(null,_0x5359cc);});}}else{return utils[_0x0457('0x22')](_0x5359cc)[_0x0457('0x14')](function(){return _0x5c7278(null,_0x5359cc);});}}return _0x5c7278(_0x0457('0x1d'));})[_0x0457('0x23')](function(_0x23b64b){_0x5c7278(_0x23b64b);});})); \ No newline at end of file +var _0x7b76=['find','map','emails','value','admin','user','agent','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blockedAt','minutes','clearBlockUser','getLicense','passport-google-oauth20','Strategy','moment','../../config/environment','signToken','login','authenticate','google','/login','email','callback','clientID','clientSecret','secret','Setting','findOne','User'];(function(_0x183355,_0x4c15fc){var _0x3a7bd1=function(_0x58005e){while(--_0x58005e){_0x183355['push'](_0x183355['shift']());}};_0x3a7bd1(++_0x4c15fc);}(_0x7b76,0x1cf));var _0x67b7=function(_0x156da9,_0x15a41b){_0x156da9=_0x156da9-0x0;var _0x4759ca=_0x7b76[_0x156da9];return _0x4759ca;};'use strict';var _=require('lodash');var passport=require('passport');var GoogleStrategy=require(_0x67b7('0x0'))[_0x67b7('0x1')];var moment=require(_0x67b7('0x2'));var db=require('../../mysqldb')['db'];var config=require(_0x67b7('0x3'));var signToken=require('../../components/auth/service')[_0x67b7('0x4')];var utils=require('../../config/utils');exports[_0x67b7('0x5')]=passport[_0x67b7('0x6')](_0x67b7('0x7'),{'failureRedirect':_0x67b7('0x8'),'scope':['profile',_0x67b7('0x9')],'session':![]});exports[_0x67b7('0xa')]=passport[_0x67b7('0x6')](_0x67b7('0x7'),{'failureRedirect':_0x67b7('0x8'),'session':![]});passport['use'](new GoogleStrategy({'clientID':config[_0x67b7('0x7')]?config['google'][_0x67b7('0xb')]:'id','clientSecret':config[_0x67b7('0x7')]?config[_0x67b7('0x7')][_0x67b7('0xc')]:_0x67b7('0xd'),'callbackURL':config['google']?config['google']['callbackURL']:''},function(_0x3f9fcc,_0x3a86c3,_0x9cc50,_0xe43c81){var _0x7009df,_0x40209b;return db[_0x67b7('0xe')][_0x67b7('0xf')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})['then'](function(_0x224f46){_0x7009df=_0x224f46;return db[_0x67b7('0x10')][_0x67b7('0x11')]({'where':{'email':_[_0x67b7('0x12')](_0x9cc50[_0x67b7('0x13')],_0x67b7('0x14')),'role':{'$or':[_0x67b7('0x15'),_0x67b7('0x16'),_0x67b7('0x17')]}}});})[_0x67b7('0x18')](function(_0xfca5df){_0x40209b=_0xfca5df;if(_0x40209b){if(_0x40209b[_0x67b7('0x19')]){return _0xe43c81(_0x67b7('0x1a'));}else if(_0x7009df[_0x67b7('0x1b')]>0x0){if(_0x40209b['blocked']){if(moment(_0x40209b[_0x67b7('0x1c')])['add'](_0x7009df[_0x67b7('0x1b')],_0x67b7('0x1d'))>moment()){return _0xe43c81(_0x67b7('0x1a'));}else{return utils[_0x67b7('0x1e')](_0x40209b,0x0,![],null)[_0x67b7('0x18')](function(){return utils[_0x67b7('0x1f')](_0x40209b);})[_0x67b7('0x18')](function(){return _0xe43c81(null,_0x40209b);});}}else{return utils[_0x67b7('0x1f')](_0x40209b)[_0x67b7('0x18')](function(){return _0xe43c81(null,_0x40209b);});}}else{return utils[_0x67b7('0x1f')](_0x40209b)['then'](function(){return _0xe43c81(null,_0x40209b);});}}return _0xe43c81(_0x67b7('0x1a'));})['catch'](function(_0x207a51){_0xe43c81(_0x207a51);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 7bac039..48908b9 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 _0xaf50=['passport','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','/callback','callback','isMiddleware','setTokenCookie'];(function(_0x1bfab8,_0x3cfaec){var _0x423f85=function(_0x2108c2){while(--_0x2108c2){_0x1bfab8['push'](_0x1bfab8['shift']());}};_0x423f85(++_0x3cfaec);}(_0xaf50,0x186));var _0x0af5=function(_0x2a86b1,_0x101e45){_0x2a86b1=_0x2a86b1-0x0;var _0x207fe8=_0xaf50[_0x2a86b1];return _0x207fe8;};'use strict';var express=require('express');var passport=require(_0x0af5('0x0'));var router=express['Router']();var controller=require(_0x0af5('0x1'));var userController=require(_0x0af5('0x2'));var authService=require(_0x0af5('0x3'));router[_0x0af5('0x4')]('/',controller[_0x0af5('0x5')]);router[_0x0af5('0x4')](_0x0af5('0x6'),controller[_0x0af5('0x7')],authService[_0x0af5('0x8')],userController['login'],authService[_0x0af5('0x9')]);module['exports']=router; \ No newline at end of file +var _0xd4ca=['../../components/auth/service','get','login','/callback','callback','isMiddleware','setTokenCookie','exports'];(function(_0x523403,_0x5c9446){var _0x664e80=function(_0x873dc0){while(--_0x873dc0){_0x523403['push'](_0x523403['shift']());}};_0x664e80(++_0x5c9446);}(_0xd4ca,0x1c0));var _0xad4c=function(_0x52d8cd,_0x170f4c){_0x52d8cd=_0x52d8cd-0x0;var _0x475d12=_0xd4ca[_0x52d8cd];return _0x475d12;};'use strict';var express=require('express');var passport=require('passport');var router=express['Router']();var controller=require('./authGoogle.controller');var userController=require('../user/user.controller.js');var authService=require(_0xad4c('0x0'));router[_0xad4c('0x1')]('/',controller[_0xad4c('0x2')]);router[_0xad4c('0x1')](_0xad4c('0x3'),controller[_0xad4c('0x4')],authService[_0xad4c('0x5')],userController[_0xad4c('0x2')],authService[_0xad4c('0x6')]);module[_0xad4c('0x7')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 32192d0..5734e15 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 _0x3299=['now','save','xCally\x20Motion\x20Password\x20Reset','https://','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','reset','User','params','token','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','password','previousPasswords','validatePasswordHistory','Password\x20reset!','use','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','disabled','blocked','blockedAt','loginAttempts','admin','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','add','clearBlockUser','getLicense','catch','find','email','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','authentication','user','pass','merge','format','\x22%s\x22\x20<%s>','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','status','send','message','authenticate','local','role','signToken','json','forgot','body','Email\x20parameter\x20is\x20missing','trim','toLowerCase','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','minutes','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x3299,0x1bc));var _0x9329=function(_0x424a08,_0x56197c){_0x424a08=_0x424a08-0x0;var _0x23914c=_0x3299[_0x424a08];return _0x23914c;};'use strict';var util=require('util');var passport=require(_0x9329('0x0'));var LocalStrategy=require(_0x9329('0x1'))[_0x9329('0x2')];var jayson=require(_0x9329('0x3'));var _=require(_0x9329('0x4'));var rs=require(_0x9329('0x5'));var moment=require(_0x9329('0x6'));var db=require(_0x9329('0x7'))['db'];var authService=require(_0x9329('0x8'));var utils=require(_0x9329('0x9'));var client=jayson[_0x9329('0xa')][_0x9329('0xb')]({'port':0x232b});function localAuthenticate(_0x2238fc,_0x14bc45,_0x1fa6c4,_0x218cf3){var _0x182d15,_0x531cf1;return db[_0x9329('0xc')][_0x9329('0xd')]({'where':{'id':0x1},'attributes':[_0x9329('0xe'),_0x9329('0xf')],'raw':!![]})[_0x9329('0x10')](function(_0x53d176){_0x182d15=_0x53d176;return _0x2238fc[_0x9329('0xd')]({'attributes':['id',_0x9329('0x11'),'password','salt','role',_0x9329('0x12'),_0x9329('0x13'),_0x9329('0x14'),_0x9329('0x15')],'where':{'name':_0x14bc45,'role':{'$or':[_0x9329('0x16'),'user',_0x9329('0x17')]}}});})[_0x9329('0x10')](function(_0x10658d){if(!_0x10658d||_0x10658d&&_0x10658d['name']!==_0x14bc45){throw new Error(_0x9329('0x18'));}else{_0x531cf1=_0x10658d;return _0x531cf1;}})[_0x9329('0x10')](function(){_0x531cf1['authenticate'](_0x1fa6c4,function(_0x342e47,_0x1b2b98){var _0x4adc7e=_0x531cf1[_0x9329('0x15')]+0x1;if(_0x342e47){return _0x218cf3(_0x342e47);}else if(!_0x1b2b98){if(_0x531cf1[_0x9329('0x12')]){return _0x218cf3(null,![],{'message':_0x9329('0x18')});}else if(_0x182d15[_0x9329('0xe')]>0x0){if(_0x531cf1['blocked']){if(_0x182d15[_0x9329('0xf')]>0x0){if(moment(_0x531cf1['blockedAt'])[_0x9329('0x19')](_0x182d15[_0x9329('0xf')],'minutes')>moment()){return _0x218cf3(null,![],{'message':_0x9329('0x18')});}else{return utils[_0x9329('0x1a')](_0x531cf1,_0x4adc7e,![],null)['then'](function(){return _0x218cf3(null,![],{'message':_0x9329('0x18')});});}}else{return _0x218cf3(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x4adc7e>=_0x182d15[_0x9329('0xe')]){return utils['clearBlockUser'](_0x531cf1,0x0,!![],moment())[_0x9329('0x10')](function(){return _0x218cf3(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0x9329('0x1a')](_0x531cf1,_0x4adc7e,![],null)[_0x9329('0x10')](function(){return _0x218cf3(null,![],{'message':_0x9329('0x18')});});}}}else{return _0x218cf3(null,![],{'message':_0x9329('0x18')});}}else{if(_0x531cf1[_0x9329('0x12')]){return _0x218cf3(null,![],{'message':_0x9329('0x18')});}else if(_0x182d15['allowedLoginAttempts']>0x0){if(_0x531cf1[_0x9329('0x13')]){if(_0x182d15[_0x9329('0xf')]>0x0){if(moment(_0x531cf1[_0x9329('0x14')])[_0x9329('0x19')](_0x182d15[_0x9329('0xf')],'minutes')>moment()){return _0x218cf3(null,![],{'message':_0x9329('0x18')});}else{return utils[_0x9329('0x1a')](_0x531cf1,0x0,![],null)['then'](function(){return utils[_0x9329('0x1b')](_0x531cf1);})[_0x9329('0x10')](function(){return _0x218cf3(null,_0x531cf1);});}}else{return _0x218cf3(null,![],{'message':_0x9329('0x18')});}}else{return utils[_0x9329('0x1a')](_0x531cf1,0x0,![],null)['then'](function(){return utils['getLicense'](_0x531cf1);})[_0x9329('0x10')](function(){return _0x218cf3(null,_0x531cf1);})[_0x9329('0x1c')](function(_0x4419fc){return _0x218cf3(null,![],_0x4419fc);});}}else{if(_0x531cf1['blocked']){return _0x218cf3(null,![],{'message':_0x9329('0x18')});}else{return utils['getLicense'](_0x531cf1)[_0x9329('0x10')](function(){return _0x218cf3(null,_0x531cf1);});}}}});})[_0x9329('0x1c')](function(_0x40a0ce){return _0x218cf3(null,![],_0x40a0ce);});}function sendServiceMail(_0x573209){return db['MailAccount'][_0x9329('0x1d')]({'where':{'service':!![]},'attributes':['id','name',_0x9329('0x1e')],'include':[{'model':db['MailServerOut'],'as':_0x9329('0x1f')}]})['then'](function(_0x46fb80){if(!_0x46fb80){throw new Error(_0x9329('0x20'));}var _0x5cd7db={'tls':{'rejectUnauthorized':![]}};if(_0x46fb80[_0x9329('0x1f')][_0x9329('0x21')]){_0x5cd7db['service']=_0x46fb80[_0x9329('0x1f')][_0x9329('0x21')];}else{_0x5cd7db[_0x9329('0x22')]=_0x46fb80[_0x9329('0x1f')]['host'];_0x5cd7db['port']=_0x46fb80['Smtp'][_0x9329('0x23')];_0x5cd7db['secure']=_0x46fb80[_0x9329('0x1f')]['secure'];}if(_0x46fb80[_0x9329('0x1f')][_0x9329('0x24')]){_0x5cd7db['auth']={'user':_0x46fb80[_0x9329('0x1f')][_0x9329('0x25')],'pass':_0x46fb80[_0x9329('0x1f')][_0x9329('0x26')]};}var _0x5da06a={'account':_0x5cd7db,'message':_[_0x9329('0x27')]({'from':util[_0x9329('0x28')](_0x9329('0x29'),_0x46fb80[_0x9329('0x11')],_0x46fb80[_0x9329('0x1e')]||_0x46fb80[_0x9329('0x1f')]['user'])},_0x573209)};return client[_0x9329('0x2a')](_0x9329('0x2b'),_0x5da06a);})[_0x9329('0x10')](function(_0x3ae0a5){if(_0x3ae0a5[_0x9329('0x2c')]){throw new Error(util[_0x9329('0x28')](_0x9329('0x2d'),_0x3ae0a5[_0x9329('0x2c')]['message']||JSON[_0x9329('0x2e')](_0x3ae0a5['error'])));}return!![];});}function handleError(_0x11dc44,_0x22086e,_0x37475b){return _0x11dc44[_0x9329('0x2f')](_0x22086e||0x1f4)[_0x9329('0x30')]({'message':_0x37475b?_0x37475b[_0x9329('0x31')]||_0x37475b:''});}exports['login']=function(_0x5e8cb3,_0xec9ed4,_0x14afc8){passport[_0x9329('0x32')](_0x9329('0x33'),function(_0x45ed79,_0x329f95,_0x3a9e91){var _0x428287=_0x45ed79||_0x3a9e91;if(_0x428287){return handleError(_0xec9ed4,0x191,_0x428287);}if(!_0x329f95){return handleError(_0xec9ed4,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x397941={'payload':{'id':_0x329f95['id'],'role':_0x329f95[_0x9329('0x34')]},'options':{'expiresIn':0x15180}};return authService[_0x9329('0x35')](_0x397941)[_0x9329('0x10')](function(_0x5e459c){_0xec9ed4[_0x9329('0x36')]({'id':_0x329f95['id'],'token':_0x5e459c,'statusCall':'','isAlreadyLogged':_0x329f95['online']});});}})(_0x5e8cb3,_0xec9ed4,_0x14afc8);};exports[_0x9329('0x37')]=function(_0x52bdeb,_0x1a6009,_0x5d6e72){if(!_0x52bdeb[_0x9329('0x38')][_0x9329('0x1e')]){return handleError(_0x1a6009,0x1f4,{'message':_0x9329('0x39')});}var _0x222e33=rs['generate']();_0x52bdeb[_0x9329('0x38')][_0x9329('0x1e')]=_0x52bdeb[_0x9329('0x38')][_0x9329('0x1e')][_0x9329('0x3a')]()[_0x9329('0x3b')]();var _0x44aa65;return db['Setting'][_0x9329('0xd')]({'where':{'id':0x1},'attributes':[_0x9329('0xe'),_0x9329('0xf')],'raw':!![]})[_0x9329('0x10')](function(_0x5de63){_0x44aa65=_0x5de63;return db['User'][_0x9329('0x1d')]({'where':{'email':_0x52bdeb[_0x9329('0x38')][_0x9329('0x1e')]}});})[_0x9329('0x10')](function(_0x44303c){if(!_0x44303c){throw new Error(_0x9329('0x3c'));}if(_0x44303c[_0x9329('0x12')]){throw new Error(_0x9329('0x3d'));}if(_0x44303c['blocked']){if(moment(_0x44303c['blockedAt'])[_0x9329('0x19')](_0x44aa65['blockDuration'],_0x9329('0x3e'))>moment()){throw new Error(_0x9329('0x3f'));}else{_0x44303c[_0x9329('0x13')]=![];_0x44303c[_0x9329('0x14')]=null;}}_0x44303c[_0x9329('0x40')]=_0x222e33;_0x44303c[_0x9329('0x41')]=Date[_0x9329('0x42')]()+0x36ee80;return _0x44303c[_0x9329('0x43')]();})[_0x9329('0x10')](function(){return sendServiceMail({'to':_0x52bdeb[_0x9329('0x38')][_0x9329('0x1e')],'subject':_0x9329('0x44'),'text':'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'+_0x9329('0x45')+_0x52bdeb['headers'][_0x9329('0x22')]+_0x9329('0x46')+_0x222e33+'\x0a\x0a'+_0x9329('0x47')});})[_0x9329('0x10')](function(){_0x1a6009[_0x9329('0x2f')](0xc8)[_0x9329('0x30')]({'message':'Reset\x20Email\x20sent!'});})[_0x9329('0x1c')](function(_0x281d9b){return handleError(_0x1a6009,0x1f4,_0x281d9b);});};exports[_0x9329('0x48')]=function(_0x5a4adb,_0x45237e,_0x30f04a){return db[_0x9329('0x49')]['find']({'where':{'resetPasswordToken':_0x5a4adb[_0x9329('0x4a')][_0x9329('0x4b')],'resetPasswordExpires':{'$gt':Date[_0x9329('0x42')]()}}})[_0x9329('0x10')](function(_0xc8de8){if(!_0xc8de8){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0x9329('0xc')][_0x9329('0xd')]({'attributes':['id',_0x9329('0x4c'),_0x9329('0x4d'),_0x9329('0x4e')]})[_0x9329('0x10')](function(_0x312e4b){if(_0x312e4b[_0x9329('0x4c')])authService[_0x9329('0x4f')](_0x5a4adb['body'][_0x9329('0x50')]);if(!_0x312e4b[_0x9329('0x4d')]||!_0xc8de8[_0x9329('0x51')])return _0xc8de8;authService[_0x9329('0x52')](_0x5a4adb[_0x9329('0x38')][_0x9329('0x50')],_0xc8de8[_0x9329('0x51')],_0x312e4b['passwordHistoryLimit']);return _0xc8de8;})[_0x9329('0x10')](function(){_0xc8de8[_0x9329('0x50')]=_0x5a4adb[_0x9329('0x38')][_0x9329('0x50')];_0xc8de8[_0x9329('0x40')]=null;_0xc8de8[_0x9329('0x41')]=null;return _0xc8de8[_0x9329('0x43')]();});})[_0x9329('0x10')](function(){_0x45237e[_0x9329('0x2f')](0xc8)[_0x9329('0x30')]({'message':_0x9329('0x53')});})[_0x9329('0x1c')](function(_0x416baf){return handleError(_0x45237e,0x1f4,_0x416baf);});};passport[_0x9329('0x54')](new LocalStrategy({'usernameField':_0x9329('0x11'),'passwordField':_0x9329('0x50')},function(_0x4ac39c,_0x4ec675,_0x3d0c07){return localAuthenticate(db[_0x9329('0x49')],_0x4ac39c,_0x4ec675,_0x3d0c07);})); \ No newline at end of file +var _0x552c=['email','MailServerOut','Smtp','service','host','port','secure','authentication','user','pass','format','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','reset','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','Password\x20reset!','use','util','passport','passport-local','Strategy','randomstring','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','role','disabled','blockedAt','loginAttempts','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blocked','minutes','clearBlockUser','add','getLicense','catch','MailAccount','find'];(function(_0x3e7cbd,_0x5a4a69){var _0x1c69b4=function(_0x115c6e){while(--_0x115c6e){_0x3e7cbd['push'](_0x3e7cbd['shift']());}};_0x1c69b4(++_0x5a4a69);}(_0x552c,0xd2));var _0xc552=function(_0x332740,_0x267c85){_0x332740=_0x332740-0x0;var _0x2681ed=_0x552c[_0x332740];return _0x2681ed;};'use strict';var util=require(_0xc552('0x0'));var passport=require(_0xc552('0x1'));var LocalStrategy=require(_0xc552('0x2'))[_0xc552('0x3')];var jayson=require('jayson/promise');var _=require('lodash');var rs=require(_0xc552('0x4'));var moment=require('moment');var db=require(_0xc552('0x5'))['db'];var authService=require(_0xc552('0x6'));var utils=require(_0xc552('0x7'));var client=jayson[_0xc552('0x8')][_0xc552('0x9')]({'port':0x232b});function localAuthenticate(_0x5067ff,_0x1196c5,_0x3c96ac,_0xccf6ba){var _0x3e2a13,_0x2d92a8;return db[_0xc552('0xa')][_0xc552('0xb')]({'where':{'id':0x1},'attributes':[_0xc552('0xc'),_0xc552('0xd')],'raw':!![]})[_0xc552('0xe')](function(_0xcee291){_0x3e2a13=_0xcee291;return _0x5067ff[_0xc552('0xb')]({'attributes':['id',_0xc552('0xf'),_0xc552('0x10'),_0xc552('0x11'),_0xc552('0x12'),_0xc552('0x13'),'blocked',_0xc552('0x14'),_0xc552('0x15')],'where':{'name':_0x1196c5,'role':{'$or':['admin','user',_0xc552('0x16')]}}});})[_0xc552('0xe')](function(_0x3a5cfd){if(!_0x3a5cfd||_0x3a5cfd&&_0x3a5cfd[_0xc552('0xf')]!==_0x1196c5){throw new Error(_0xc552('0x17'));}else{_0x2d92a8=_0x3a5cfd;return _0x2d92a8;}})[_0xc552('0xe')](function(){_0x2d92a8[_0xc552('0x18')](_0x3c96ac,function(_0x13f781,_0x10c19a){var _0xa4f006=_0x2d92a8[_0xc552('0x15')]+0x1;if(_0x13f781){return _0xccf6ba(_0x13f781);}else if(!_0x10c19a){if(_0x2d92a8[_0xc552('0x13')]){return _0xccf6ba(null,![],{'message':_0xc552('0x17')});}else if(_0x3e2a13[_0xc552('0xc')]>0x0){if(_0x2d92a8[_0xc552('0x19')]){if(_0x3e2a13[_0xc552('0xd')]>0x0){if(moment(_0x2d92a8['blockedAt'])['add'](_0x3e2a13[_0xc552('0xd')],_0xc552('0x1a'))>moment()){return _0xccf6ba(null,![],{'message':_0xc552('0x17')});}else{return utils[_0xc552('0x1b')](_0x2d92a8,_0xa4f006,![],null)[_0xc552('0xe')](function(){return _0xccf6ba(null,![],{'message':_0xc552('0x17')});});}}else{return _0xccf6ba(null,![],{'message':_0xc552('0x17')});}}else{if(_0xa4f006>=_0x3e2a13[_0xc552('0xc')]){return utils['clearBlockUser'](_0x2d92a8,0x0,!![],moment())[_0xc552('0xe')](function(){return _0xccf6ba(null,![],{'message':_0xc552('0x17')});});}else{return utils[_0xc552('0x1b')](_0x2d92a8,_0xa4f006,![],null)[_0xc552('0xe')](function(){return _0xccf6ba(null,![],{'message':_0xc552('0x17')});});}}}else{return _0xccf6ba(null,![],{'message':_0xc552('0x17')});}}else{if(_0x2d92a8[_0xc552('0x13')]){return _0xccf6ba(null,![],{'message':_0xc552('0x17')});}else if(_0x3e2a13[_0xc552('0xc')]>0x0){if(_0x2d92a8[_0xc552('0x19')]){if(_0x3e2a13[_0xc552('0xd')]>0x0){if(moment(_0x2d92a8[_0xc552('0x14')])[_0xc552('0x1c')](_0x3e2a13[_0xc552('0xd')],_0xc552('0x1a'))>moment()){return _0xccf6ba(null,![],{'message':_0xc552('0x17')});}else{return utils[_0xc552('0x1b')](_0x2d92a8,0x0,![],null)[_0xc552('0xe')](function(){return utils['getLicense'](_0x2d92a8);})[_0xc552('0xe')](function(){return _0xccf6ba(null,_0x2d92a8);});}}else{return _0xccf6ba(null,![],{'message':_0xc552('0x17')});}}else{return utils['clearBlockUser'](_0x2d92a8,0x0,![],null)[_0xc552('0xe')](function(){return utils[_0xc552('0x1d')](_0x2d92a8);})[_0xc552('0xe')](function(){return _0xccf6ba(null,_0x2d92a8);})[_0xc552('0x1e')](function(_0x27533e){return _0xccf6ba(null,![],_0x27533e);});}}else{if(_0x2d92a8[_0xc552('0x19')]){return _0xccf6ba(null,![],{'message':_0xc552('0x17')});}else{return utils[_0xc552('0x1d')](_0x2d92a8)[_0xc552('0xe')](function(){return _0xccf6ba(null,_0x2d92a8);});}}}});})[_0xc552('0x1e')](function(_0x2e47ff){return _0xccf6ba(null,![],_0x2e47ff);});}function sendServiceMail(_0xbe9b2){return db[_0xc552('0x1f')][_0xc552('0x20')]({'where':{'service':!![]},'attributes':['id',_0xc552('0xf'),_0xc552('0x21')],'include':[{'model':db[_0xc552('0x22')],'as':_0xc552('0x23')}]})[_0xc552('0xe')](function(_0x2f8a1b){if(!_0x2f8a1b){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x3f421f={'tls':{'rejectUnauthorized':![]}};if(_0x2f8a1b['Smtp'][_0xc552('0x24')]){_0x3f421f[_0xc552('0x24')]=_0x2f8a1b[_0xc552('0x23')][_0xc552('0x24')];}else{_0x3f421f[_0xc552('0x25')]=_0x2f8a1b[_0xc552('0x23')][_0xc552('0x25')];_0x3f421f[_0xc552('0x26')]=_0x2f8a1b[_0xc552('0x23')][_0xc552('0x26')];_0x3f421f['secure']=_0x2f8a1b[_0xc552('0x23')][_0xc552('0x27')];}if(_0x2f8a1b[_0xc552('0x23')][_0xc552('0x28')]){_0x3f421f['auth']={'user':_0x2f8a1b[_0xc552('0x23')][_0xc552('0x29')],'pass':_0x2f8a1b['Smtp'][_0xc552('0x2a')]};}var _0x3752a1={'account':_0x3f421f,'message':_['merge']({'from':util[_0xc552('0x2b')]('\x22%s\x22\x20<%s>',_0x2f8a1b[_0xc552('0xf')],_0x2f8a1b[_0xc552('0x21')]||_0x2f8a1b[_0xc552('0x23')][_0xc552('0x29')])},_0xbe9b2)};return client[_0xc552('0x2c')](_0xc552('0x2d'),_0x3752a1);})['then'](function(_0x3bb5bd){if(_0x3bb5bd[_0xc552('0x2e')]){throw new Error(util['format'](_0xc552('0x2f'),_0x3bb5bd[_0xc552('0x2e')][_0xc552('0x30')]||JSON[_0xc552('0x31')](_0x3bb5bd[_0xc552('0x2e')])));}return!![];});}function handleError(_0x793a61,_0x8796c0,_0x1fd509){return _0x793a61[_0xc552('0x32')](_0x8796c0||0x1f4)[_0xc552('0x33')]({'message':_0x1fd509?_0x1fd509[_0xc552('0x30')]||_0x1fd509:''});}exports['login']=function(_0x21f48b,_0x1b7bc8,_0x44b578){passport[_0xc552('0x18')](_0xc552('0x34'),function(_0x3a0921,_0x261a08,_0x5adfb5){var _0x3eb366=_0x3a0921||_0x5adfb5;if(_0x3eb366){return handleError(_0x1b7bc8,0x191,_0x3eb366);}if(!_0x261a08){return handleError(_0x1b7bc8,0x194,{'message':_0xc552('0x35')});}else{var _0x4fb51e={'payload':{'id':_0x261a08['id'],'role':_0x261a08[_0xc552('0x12')]},'options':{'expiresIn':0x15180}};return authService[_0xc552('0x36')](_0x4fb51e)[_0xc552('0xe')](function(_0x4d941f){_0x1b7bc8[_0xc552('0x37')]({'id':_0x261a08['id'],'token':_0x4d941f,'statusCall':'','isAlreadyLogged':_0x261a08['online']});});}})(_0x21f48b,_0x1b7bc8,_0x44b578);};exports[_0xc552('0x38')]=function(_0x40c1e9,_0x67229,_0xedd976){if(!_0x40c1e9[_0xc552('0x39')]['email']){return handleError(_0x67229,0x1f4,{'message':_0xc552('0x3a')});}var _0x220f7d=rs[_0xc552('0x3b')]();_0x40c1e9[_0xc552('0x39')][_0xc552('0x21')]=_0x40c1e9[_0xc552('0x39')]['email'][_0xc552('0x3c')]()[_0xc552('0x3d')]();var _0x262874;return db[_0xc552('0xa')][_0xc552('0xb')]({'where':{'id':0x1},'attributes':[_0xc552('0xc'),_0xc552('0xd')],'raw':!![]})[_0xc552('0xe')](function(_0x3c0d27){_0x262874=_0x3c0d27;return db[_0xc552('0x3e')][_0xc552('0x20')]({'where':{'email':_0x40c1e9[_0xc552('0x39')][_0xc552('0x21')]}});})[_0xc552('0xe')](function(_0x26872a){if(!_0x26872a){throw new Error(_0xc552('0x3f'));}if(_0x26872a[_0xc552('0x13')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x26872a['blocked']){if(moment(_0x26872a['blockedAt'])['add'](_0x262874[_0xc552('0xd')],_0xc552('0x1a'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x26872a[_0xc552('0x19')]=![];_0x26872a[_0xc552('0x14')]=null;}}_0x26872a['resetPasswordToken']=_0x220f7d;_0x26872a[_0xc552('0x40')]=Date[_0xc552('0x41')]()+0x36ee80;return _0x26872a[_0xc552('0x42')]();})['then'](function(){return sendServiceMail({'to':_0x40c1e9[_0xc552('0x39')]['email'],'subject':_0xc552('0x43'),'text':'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://'+_0x40c1e9['headers'][_0xc552('0x25')]+_0xc552('0x44')+_0x220f7d+'\x0a\x0a'+_0xc552('0x45')});})['then'](function(){_0x67229[_0xc552('0x32')](0xc8)[_0xc552('0x33')]({'message':'Reset\x20Email\x20sent!'});})[_0xc552('0x1e')](function(_0x3e0555){return handleError(_0x67229,0x1f4,_0x3e0555);});};exports[_0xc552('0x46')]=function(_0x2b67f0,_0x4440ea,_0x58c662){return db[_0xc552('0x3e')][_0xc552('0x20')]({'where':{'resetPasswordToken':_0x2b67f0['params'][_0xc552('0x47')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0xc552('0xe')](function(_0x36773a){if(!_0x36773a){throw new Error(_0xc552('0x48'));}return db['Setting'][_0xc552('0xb')]({'attributes':['id',_0xc552('0x49'),_0xc552('0x4a'),_0xc552('0x4b')]})['then'](function(_0x526228){if(_0x526228[_0xc552('0x49')])authService[_0xc552('0x4c')](_0x2b67f0[_0xc552('0x39')][_0xc552('0x10')]);if(!_0x526228['enforcePasswordHistory']||!_0x36773a[_0xc552('0x4d')])return _0x36773a;authService[_0xc552('0x4e')](_0x2b67f0[_0xc552('0x39')][_0xc552('0x10')],_0x36773a['previousPasswords'],_0x526228[_0xc552('0x4b')]);return _0x36773a;})[_0xc552('0xe')](function(){_0x36773a[_0xc552('0x10')]=_0x2b67f0[_0xc552('0x39')][_0xc552('0x10')];_0x36773a['resetPasswordToken']=null;_0x36773a[_0xc552('0x40')]=null;return _0x36773a[_0xc552('0x42')]();});})[_0xc552('0xe')](function(){_0x4440ea[_0xc552('0x32')](0xc8)['send']({'message':_0xc552('0x4f')});})['catch'](function(_0x3538c5){return handleError(_0x4440ea,0x1f4,_0x3538c5);});};passport[_0xc552('0x50')](new LocalStrategy({'usernameField':_0xc552('0xf'),'passwordField':'password'},function(_0x517831,_0x1f7151,_0x1172f3){return localAuthenticate(db['User'],_0x517831,_0x1f7151,_0x1172f3);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 3116327..a7eb934 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 _0x7b7f=['post','exports','express','./authLocal.controller','login'];(function(_0x4a9331,_0x361ba8){var _0x484b3c=function(_0x1ceed6){while(--_0x1ceed6){_0x4a9331['push'](_0x4a9331['shift']());}};_0x484b3c(++_0x361ba8);}(_0x7b7f,0x174));var _0xf7b7=function(_0x555b2f,_0x43b622){_0x555b2f=_0x555b2f-0x0;var _0x81c0a6=_0x7b7f[_0x555b2f];return _0x81c0a6;};'use strict';var express=require(_0xf7b7('0x0'));var router=express['Router']();var controller=require(_0xf7b7('0x1'));router['post']('/',controller[_0xf7b7('0x2')]);router[_0xf7b7('0x3')]('/forgot',controller['forgot']);router[_0xf7b7('0x3')]('/reset/:token',controller['reset']);module[_0xf7b7('0x4')]=router; \ No newline at end of file +var _0xbc5f=['exports','express','./authLocal.controller','post','login','/forgot','forgot','reset'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xbc5f,0x169));var _0xfbc5=function(_0x1c4929,_0xb85eeb){_0x1c4929=_0x1c4929-0x0;var _0x876963=_0xbc5f[_0x1c4929];return _0x876963;};'use strict';var express=require(_0xfbc5('0x0'));var router=express['Router']();var controller=require(_0xfbc5('0x1'));router[_0xfbc5('0x2')]('/',controller[_0xfbc5('0x3')]);router[_0xfbc5('0x2')](_0xfbc5('0x4'),controller[_0xfbc5('0x5')]);router[_0xfbc5('0x2')]('/reset/:token',controller[_0xfbc5('0x6')]);module[_0xfbc5('0x7')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 99c59d0..dd38f87 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 _0xed08=['INTEGER','sequelize','exports','STRING'];(function(_0x24e7b0,_0x23104f){var _0x1b09a1=function(_0xf17972){while(--_0xf17972){_0x24e7b0['push'](_0x24e7b0['shift']());}};_0x1b09a1(++_0x23104f);}(_0xed08,0xe1));var _0x8ed0=function(_0x11785a,_0x45a03e){_0x11785a=_0x11785a-0x0;var _0x2dec59=_0xed08[_0x11785a];return _0x2dec59;};'use strict';var Sequelize=require(_0x8ed0('0x0'));module[_0x8ed0('0x1')]={'name':{'type':Sequelize[_0x8ed0('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x8ed0('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x8ed0('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0x903f=['sequelize','STRING','BOOLEAN','INTEGER'];(function(_0x28b5ad,_0x3986c5){var _0x2c9eb3=function(_0xeaabdd){while(--_0xeaabdd){_0x28b5ad['push'](_0x28b5ad['shift']());}};_0x2c9eb3(++_0x3986c5);}(_0x903f,0x16c));var _0xf903=function(_0x1bbb45,_0x3148ae){_0x1bbb45=_0x1bbb45-0x0;var _0x4ebc57=_0x903f[_0x1bbb45];return _0x4ebc57;};'use strict';var Sequelize=require(_0xf903('0x0'));module['exports']={'name':{'type':Sequelize[_0xf903('0x1')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf903('0x1')]},'status':{'type':Sequelize[_0xf903('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xf903('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 c613370..623119e 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 _0x0643=['to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','Automation','includeAll','include','rows','catch','show','params','create','body','addConditions','find','ids','omit','Condition','hasOwnProperty','getConditions','addActions','Action','getActions','findOne','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x0643,0x19b));var _0x3064=function(_0x488ebf,_0x4ba59a){_0x488ebf=_0x488ebf-0x0;var _0x1d3276=_0x0643[_0x488ebf];return _0x1d3276;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3064('0x0'));var zipdir=require(_0x3064('0x1'));var jsonpatch=require(_0x3064('0x2'));var rp=require(_0x3064('0x3'));var moment=require(_0x3064('0x4'));var BPromise=require(_0x3064('0x5'));var Mustache=require(_0x3064('0x6'));var util=require(_0x3064('0x7'));var path=require(_0x3064('0x8'));var sox=require('sox');var csv=require(_0x3064('0x9'));var ejs=require(_0x3064('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3064('0xb'));var squel=require(_0x3064('0xc'));var crypto=require(_0x3064('0xd'));var jsforce=require(_0x3064('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3064('0x9'));var querystring=require(_0x3064('0xf'));var Papa=require('papaparse');var Redis=require(_0x3064('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3064('0x11'));var as=require(_0x3064('0x12'));var hardwareService=require(_0x3064('0x13'));var logger=require(_0x3064('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x3064('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x3064('0x16'))['db'];function respondWithStatusCode(_0x18a295,_0x328590){_0x328590=_0x328590||0xcc;return function(_0x37e3e6){if(_0x37e3e6){return _0x18a295[_0x3064('0x17')](_0x328590);}return _0x18a295[_0x3064('0x18')](_0x328590)[_0x3064('0x19')]();};}function respondWithResult(_0x49fa13,_0x56ea60){_0x56ea60=_0x56ea60||0xc8;return function(_0x1e423f){if(_0x1e423f){return _0x49fa13[_0x3064('0x18')](_0x56ea60)[_0x3064('0x1a')](_0x1e423f);}};}function respondWithFilteredResult(_0x50f262,_0x240560){return function(_0x3ac421){if(_0x3ac421){var _0x3c0c28=typeof _0x240560[_0x3064('0x1b')]===_0x3064('0x1c')&&typeof _0x240560[_0x3064('0x1d')]===_0x3064('0x1c');var _0x35a88a=_0x3ac421[_0x3064('0x1e')];var _0x181958=_0x3c0c28?0x0:_0x240560['offset'];var _0x19a1b8=_0x3c0c28?_0x3ac421['count']:_0x240560[_0x3064('0x1b')]+_0x240560[_0x3064('0x1d')];var _0x57cfc7;if(_0x19a1b8>=_0x35a88a){_0x19a1b8=_0x35a88a;_0x57cfc7=0xc8;}else{_0x57cfc7=0xce;}_0x50f262[_0x3064('0x18')](_0x57cfc7);return _0x50f262[_0x3064('0x1f')](_0x3064('0x20'),_0x181958+'-'+_0x19a1b8+'/'+_0x35a88a)['json'](_0x3ac421);}return null;};}function patchUpdates(_0x324c02){return function(_0x286c55){try{jsonpatch['apply'](_0x286c55,_0x324c02,!![]);}catch(_0x1978cf){return BPromise[_0x3064('0x21')](_0x1978cf);}return _0x286c55[_0x3064('0x22')]();};}function saveUpdates(_0x5a1acb,_0x28f68d){return function(_0x444ede){if(_0x444ede){return _0x444ede[_0x3064('0x23')](_0x5a1acb)[_0x3064('0x24')](function(_0xa27d94){return _0xa27d94;});}return null;};}function removeEntity(_0x46c587,_0x51324b){return function(_0x1849ad){if(_0x1849ad){return _0x1849ad[_0x3064('0x25')]()['then'](function(){_0x46c587['status'](0xcc)[_0x3064('0x19')]();});}};}function handleEntityNotFound(_0x36f1eb,_0x18e31a){return function(_0x507f3a){if(!_0x507f3a){_0x36f1eb[_0x3064('0x17')](0x194);}return _0x507f3a;};}function handleError(_0x4afe82,_0x4d8ab0){_0x4d8ab0=_0x4d8ab0||0x1f4;return function(_0x2048a4){logger[_0x3064('0x26')](_0x2048a4['stack']);if(_0x2048a4[_0x3064('0x27')]){delete _0x2048a4[_0x3064('0x27')];}_0x4afe82[_0x3064('0x18')](_0x4d8ab0)[_0x3064('0x28')](_0x2048a4);};}exports[_0x3064('0x29')]=function(_0x3cd7df,_0x6660f4){var _0x1c53b3={},_0x296cea={},_0x5bbd12={'count':0x0,'rows':[]};var _0x5e5a46=_[_0x3064('0x2a')](db['Automation'][_0x3064('0x2b')],function(_0x4e7253){return{'name':_0x4e7253[_0x3064('0x2c')],'type':_0x4e7253[_0x3064('0x2d')][_0x3064('0x2e')]};});_0x296cea['model']=_['map'](_0x5e5a46,_0x3064('0x27'));_0x296cea['query']=_[_0x3064('0x2f')](_0x3cd7df[_0x3064('0x30')]);_0x296cea[_0x3064('0x31')]=_[_0x3064('0x32')](_0x296cea[_0x3064('0x33')],_0x296cea[_0x3064('0x30')]);_0x1c53b3[_0x3064('0x34')]=_[_0x3064('0x32')](_0x296cea['model'],qs[_0x3064('0x35')](_0x3cd7df['query'][_0x3064('0x35')]));_0x1c53b3[_0x3064('0x34')]=_0x1c53b3[_0x3064('0x34')][_0x3064('0x36')]?_0x1c53b3[_0x3064('0x34')]:_0x296cea[_0x3064('0x33')];if(!_0x3cd7df[_0x3064('0x30')]['hasOwnProperty'](_0x3064('0x37'))){_0x1c53b3[_0x3064('0x1d')]=qs[_0x3064('0x1d')](_0x3cd7df[_0x3064('0x30')][_0x3064('0x1d')]);_0x1c53b3['offset']=qs[_0x3064('0x1b')](_0x3cd7df['query']['offset']);}_0x1c53b3[_0x3064('0x38')]=qs[_0x3064('0x39')](_0x3cd7df['query'][_0x3064('0x39')]);_0x1c53b3['where']=qs[_0x3064('0x31')](_[_0x3064('0x3a')](_0x3cd7df[_0x3064('0x30')],_0x296cea[_0x3064('0x31')]),_0x5e5a46);if(_0x3cd7df[_0x3064('0x30')]['filter']){_0x1c53b3[_0x3064('0x3b')]=_[_0x3064('0x3c')](_0x1c53b3[_0x3064('0x3b')],{'$or':_[_0x3064('0x2a')](_0x5e5a46,function(_0x4cfc95){if(_0x4cfc95[_0x3064('0x2d')]!==_0x3064('0x3d')){var _0x44ce00={};_0x44ce00[_0x4cfc95['name']]={'$like':'%'+_0x3cd7df[_0x3064('0x30')][_0x3064('0x3e')]+'%'};return _0x44ce00;}})});}_0x1c53b3=_['merge']({},_0x1c53b3,_0x3cd7df[_0x3064('0x3f')]);var _0x492e12={'where':_0x1c53b3[_0x3064('0x3b')]};return db[_0x3064('0x40')][_0x3064('0x1e')](_0x492e12)[_0x3064('0x24')](function(_0x35aeb6){_0x5bbd12['count']=_0x35aeb6;if(_0x3cd7df[_0x3064('0x30')][_0x3064('0x41')]){_0x1c53b3[_0x3064('0x42')]=[{'all':!![]}];}return db[_0x3064('0x40')]['findAll'](_0x1c53b3);})[_0x3064('0x24')](function(_0x45035e){_0x5bbd12[_0x3064('0x43')]=_0x45035e;return _0x5bbd12;})['then'](respondWithFilteredResult(_0x6660f4,_0x1c53b3))[_0x3064('0x44')](handleError(_0x6660f4,null));};exports[_0x3064('0x45')]=function(_0x48767b,_0x2bd9be){var _0x40161e={'raw':![],'where':{'id':_0x48767b[_0x3064('0x46')]['id']}},_0x5e1c3f={};_0x5e1c3f[_0x3064('0x33')]=_[_0x3064('0x2f')](db[_0x3064('0x40')][_0x3064('0x2b')]);_0x5e1c3f[_0x3064('0x30')]=_[_0x3064('0x2f')](_0x48767b[_0x3064('0x30')]);_0x5e1c3f[_0x3064('0x31')]=_[_0x3064('0x32')](_0x5e1c3f[_0x3064('0x33')],_0x5e1c3f['query']);_0x40161e['attributes']=_[_0x3064('0x32')](_0x5e1c3f['model'],qs[_0x3064('0x35')](_0x48767b[_0x3064('0x30')][_0x3064('0x35')]));_0x40161e[_0x3064('0x34')]=_0x40161e['attributes'][_0x3064('0x36')]?_0x40161e[_0x3064('0x34')]:_0x5e1c3f[_0x3064('0x33')];if(_0x48767b[_0x3064('0x30')][_0x3064('0x41')]){_0x40161e['include']=[{'all':!![]}];}_0x40161e=_['merge']({},_0x40161e,_0x48767b[_0x3064('0x3f')]);return db[_0x3064('0x40')]['find'](_0x40161e)[_0x3064('0x24')](handleEntityNotFound(_0x2bd9be,null))[_0x3064('0x24')](respondWithResult(_0x2bd9be,null))['catch'](handleError(_0x2bd9be,null));};exports[_0x3064('0x47')]=function(_0x549a48,_0x4698dd){return db[_0x3064('0x40')][_0x3064('0x47')](_0x549a48[_0x3064('0x48')],{})[_0x3064('0x24')](respondWithResult(_0x4698dd,0xc9))['catch'](handleError(_0x4698dd,null));};exports['update']=function(_0x3d238f,_0x79529d){if(_0x3d238f[_0x3064('0x48')]['id']){delete _0x3d238f[_0x3064('0x48')]['id'];}return db[_0x3064('0x40')]['find']({'where':{'id':_0x3d238f[_0x3064('0x46')]['id']}})['then'](handleEntityNotFound(_0x79529d,null))[_0x3064('0x24')](saveUpdates(_0x3d238f[_0x3064('0x48')],null))[_0x3064('0x24')](respondWithResult(_0x79529d,null))[_0x3064('0x44')](handleError(_0x79529d,null));};exports['destroy']=function(_0x3b4278,_0x493c23){return db[_0x3064('0x40')]['find']({'where':{'id':_0x3b4278[_0x3064('0x46')]['id']}})[_0x3064('0x24')](handleEntityNotFound(_0x493c23,null))[_0x3064('0x24')](removeEntity(_0x493c23,null))[_0x3064('0x44')](handleError(_0x493c23,null));};exports[_0x3064('0x49')]=function(_0x121a49,_0x1f39ef,_0x26af7d){return db['Condition'][_0x3064('0x4a')]({'where':{'id':_0x121a49[_0x3064('0x46')]['id']}})[_0x3064('0x24')](handleEntityNotFound(_0x1f39ef,null))[_0x3064('0x24')](function(_0x10f28d){if(_0x10f28d){return _0x10f28d[_0x3064('0x49')](_0x121a49['body'][_0x3064('0x4b')],_[_0x3064('0x4c')](_0x121a49[_0x3064('0x48')],[_0x3064('0x4b'),'id'])||{});}})[_0x3064('0x24')](respondWithResult(_0x1f39ef,null))[_0x3064('0x44')](handleError(_0x1f39ef,null));};exports['getConditions']=function(_0xe697c1,_0x474fb3,_0xeab094){var _0x117bd6={};var _0x1406a0={};var _0x8a893a;var _0x5d3eee;return db[_0x3064('0x40')]['findOne']({'where':{'id':_0xe697c1[_0x3064('0x46')]['id']}})[_0x3064('0x24')](handleEntityNotFound(_0x474fb3,null))[_0x3064('0x24')](function(_0x26a6a0){if(_0x26a6a0){_0x8a893a=_0x26a6a0;_0x1406a0['model']=_[_0x3064('0x2f')](db[_0x3064('0x4d')][_0x3064('0x2b')]);_0x1406a0[_0x3064('0x30')]=_[_0x3064('0x2f')](_0xe697c1['query']);_0x1406a0[_0x3064('0x31')]=_['intersection'](_0x1406a0[_0x3064('0x33')],_0x1406a0[_0x3064('0x30')]);_0x117bd6['attributes']=_[_0x3064('0x32')](_0x1406a0[_0x3064('0x33')],qs['fields'](_0xe697c1[_0x3064('0x30')]['fields']));_0x117bd6[_0x3064('0x34')]=_0x117bd6['attributes']['length']?_0x117bd6['attributes']:_0x1406a0['model'];_0x117bd6[_0x3064('0x38')]=qs[_0x3064('0x39')](_0xe697c1[_0x3064('0x30')][_0x3064('0x39')]);_0x117bd6[_0x3064('0x3b')]=qs[_0x3064('0x31')](_[_0x3064('0x3a')](_0xe697c1[_0x3064('0x30')],_0x1406a0[_0x3064('0x31')]));if(_0xe697c1['query'][_0x3064('0x3e')]){_0x117bd6[_0x3064('0x3b')]=_['merge'](_0x117bd6[_0x3064('0x3b')],{'$or':_[_0x3064('0x2a')](_0x117bd6['attributes'],function(_0x162133){var _0x16701e={};_0x16701e[_0x162133]={'$like':'%'+_0xe697c1[_0x3064('0x30')][_0x3064('0x3e')]+'%'};return _0x16701e;})});}_0x117bd6=_[_0x3064('0x3c')]({},_0x117bd6,_0xe697c1['options']);return _0x8a893a['getConditions'](_0x117bd6);}})['then'](function(_0x4d5083){if(_0x4d5083){_0x5d3eee=_0x4d5083['length'];if(!_0xe697c1['query'][_0x3064('0x4e')](_0x3064('0x37'))){_0x117bd6[_0x3064('0x1d')]=qs[_0x3064('0x1d')](_0xe697c1[_0x3064('0x30')]['limit']);_0x117bd6[_0x3064('0x1b')]=qs[_0x3064('0x1b')](_0xe697c1[_0x3064('0x30')][_0x3064('0x1b')]);}return _0x8a893a[_0x3064('0x4f')](_0x117bd6);}})[_0x3064('0x24')](function(_0x4f6737){if(_0x4f6737){return _0x4f6737?{'count':_0x5d3eee,'rows':_0x4f6737}:null;}})[_0x3064('0x24')](respondWithResult(_0x474fb3,null))[_0x3064('0x44')](handleError(_0x474fb3,null));};exports[_0x3064('0x50')]=function(_0x529e59,_0x4147ae,_0x5f0b66){return db[_0x3064('0x51')][_0x3064('0x4a')]({'where':{'id':_0x529e59['params']['id']}})[_0x3064('0x24')](handleEntityNotFound(_0x4147ae,null))[_0x3064('0x24')](function(_0x27e40a){if(_0x27e40a){return _0x27e40a[_0x3064('0x50')](_0x529e59[_0x3064('0x48')][_0x3064('0x4b')],_[_0x3064('0x4c')](_0x529e59[_0x3064('0x48')],[_0x3064('0x4b'),'id'])||{});}})[_0x3064('0x24')](respondWithResult(_0x4147ae,null))[_0x3064('0x44')](handleError(_0x4147ae,null));};exports[_0x3064('0x52')]=function(_0x24eab9,_0x36721c,_0x261b5a){var _0x2e5253={};var _0x1c6df4={};var _0x58c3af;var _0x1b16c0;return db[_0x3064('0x40')][_0x3064('0x53')]({'where':{'id':_0x24eab9[_0x3064('0x46')]['id']}})[_0x3064('0x24')](handleEntityNotFound(_0x36721c,null))[_0x3064('0x24')](function(_0x3b9729){if(_0x3b9729){_0x58c3af=_0x3b9729;_0x1c6df4[_0x3064('0x33')]=_[_0x3064('0x2f')](db[_0x3064('0x51')]['rawAttributes']);_0x1c6df4[_0x3064('0x30')]=_[_0x3064('0x2f')](_0x24eab9[_0x3064('0x30')]);_0x1c6df4[_0x3064('0x31')]=_[_0x3064('0x32')](_0x1c6df4[_0x3064('0x33')],_0x1c6df4['query']);_0x2e5253[_0x3064('0x34')]=_[_0x3064('0x32')](_0x1c6df4[_0x3064('0x33')],qs['fields'](_0x24eab9['query'][_0x3064('0x35')]));_0x2e5253[_0x3064('0x34')]=_0x2e5253[_0x3064('0x34')]['length']?_0x2e5253[_0x3064('0x34')]:_0x1c6df4[_0x3064('0x33')];_0x2e5253[_0x3064('0x38')]=qs[_0x3064('0x39')](_0x24eab9['query'][_0x3064('0x39')]);_0x2e5253[_0x3064('0x3b')]=qs[_0x3064('0x31')](_['pick'](_0x24eab9[_0x3064('0x30')],_0x1c6df4['filters']));if(_0x24eab9[_0x3064('0x30')][_0x3064('0x3e')]){_0x2e5253['where']=_['merge'](_0x2e5253[_0x3064('0x3b')],{'$or':_['map'](_0x2e5253[_0x3064('0x34')],function(_0x5d75aa){var _0x9c89a={};_0x9c89a[_0x5d75aa]={'$like':'%'+_0x24eab9['query']['filter']+'%'};return _0x9c89a;})});}_0x2e5253=_[_0x3064('0x3c')]({},_0x2e5253,_0x24eab9[_0x3064('0x3f')]);return _0x58c3af[_0x3064('0x52')](_0x2e5253);}})['then'](function(_0x4441c){if(_0x4441c){_0x1b16c0=_0x4441c['length'];if(!_0x24eab9['query'][_0x3064('0x4e')](_0x3064('0x37'))){_0x2e5253[_0x3064('0x1d')]=qs[_0x3064('0x1d')](_0x24eab9[_0x3064('0x30')]['limit']);_0x2e5253[_0x3064('0x1b')]=qs[_0x3064('0x1b')](_0x24eab9['query']['offset']);}return _0x58c3af[_0x3064('0x52')](_0x2e5253);}})[_0x3064('0x24')](function(_0x41a02d){if(_0x41a02d){return _0x41a02d?{'count':_0x1b16c0,'rows':_0x41a02d}:null;}})[_0x3064('0x24')](respondWithResult(_0x36721c,null))[_0x3064('0x44')](handleError(_0x36721c,null));}; \ No newline at end of file +var _0x294a=['filter','options','Automation','include','findAll','catch','show','params','rawAttributes','length','includeAll','find','create','body','destroy','addConditions','Condition','ids','omit','getConditions','addActions','Action','getActions','findOne','hasOwnProperty','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','end','error','name','send','map','fieldName','type','key','model','query','keys','intersection','fields','attributes','nolimit','order','sort','filters','pick','where','merge','VIRTUAL'];(function(_0x56819f,_0x2f03fa){var _0xf69016=function(_0x2e52b2){while(--_0x2e52b2){_0x56819f['push'](_0x56819f['shift']());}};_0xf69016(++_0x2f03fa);}(_0x294a,0xc3));var _0xa294=function(_0x491cbe,_0x45c8ba){_0x491cbe=_0x491cbe-0x0;var _0x59449d=_0x294a[_0x491cbe];return _0x59449d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa294('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa294('0x1'));var moment=require(_0xa294('0x2'));var BPromise=require(_0xa294('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa294('0x4'));var sox=require(_0xa294('0x5'));var csv=require(_0xa294('0x6'));var ejs=require(_0xa294('0x7'));var fs=require('fs');var fs_extra=require(_0xa294('0x8'));var _=require(_0xa294('0x9'));var squel=require(_0xa294('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa294('0xb'));var toCsv=require('to-csv');var querystring=require(_0xa294('0xc'));var Papa=require(_0xa294('0xd'));var Redis=require('ioredis');var authService=require(_0xa294('0xe'));var qs=require(_0xa294('0xf'));var as=require(_0xa294('0x10'));var hardwareService=require(_0xa294('0x11'));var logger=require(_0xa294('0x12'))(_0xa294('0x13'));var utils=require(_0xa294('0x14'));var config=require(_0xa294('0x15'));var licenseUtil=require(_0xa294('0x16'));var db=require(_0xa294('0x17'))['db'];function respondWithStatusCode(_0x34b9c9,_0x66b0ff){_0x66b0ff=_0x66b0ff||0xcc;return function(_0x505e6e){if(_0x505e6e){return _0x34b9c9[_0xa294('0x18')](_0x66b0ff);}return _0x34b9c9[_0xa294('0x19')](_0x66b0ff)['end']();};}function respondWithResult(_0x4b17d5,_0x18da16){_0x18da16=_0x18da16||0xc8;return function(_0x380749){if(_0x380749){return _0x4b17d5['status'](_0x18da16)[_0xa294('0x1a')](_0x380749);}};}function respondWithFilteredResult(_0x3e1207,_0x2980f0){return function(_0x53c57b){if(_0x53c57b){var _0x2519b7=typeof _0x2980f0[_0xa294('0x1b')]==='undefined'&&typeof _0x2980f0[_0xa294('0x1c')]===_0xa294('0x1d');var _0x4cdd5e=_0x53c57b[_0xa294('0x1e')];var _0x403f62=_0x2519b7?0x0:_0x2980f0[_0xa294('0x1b')];var _0xda0db4=_0x2519b7?_0x53c57b[_0xa294('0x1e')]:_0x2980f0[_0xa294('0x1b')]+_0x2980f0[_0xa294('0x1c')];var _0x587843;if(_0xda0db4>=_0x4cdd5e){_0xda0db4=_0x4cdd5e;_0x587843=0xc8;}else{_0x587843=0xce;}_0x3e1207['status'](_0x587843);return _0x3e1207[_0xa294('0x1f')](_0xa294('0x20'),_0x403f62+'-'+_0xda0db4+'/'+_0x4cdd5e)['json'](_0x53c57b);}return null;};}function patchUpdates(_0x61334b){return function(_0x4c41af){try{jsonpatch[_0xa294('0x21')](_0x4c41af,_0x61334b,!![]);}catch(_0x5a3f4d){return BPromise[_0xa294('0x22')](_0x5a3f4d);}return _0x4c41af[_0xa294('0x23')]();};}function saveUpdates(_0x9b6ae6,_0x4615c9){return function(_0x52b667){if(_0x52b667){return _0x52b667[_0xa294('0x24')](_0x9b6ae6)[_0xa294('0x25')](function(_0x547fde){return _0x547fde;});}return null;};}function removeEntity(_0x253be6,_0x34c4bf){return function(_0x2b29d1){if(_0x2b29d1){return _0x2b29d1['destroy']()['then'](function(){_0x253be6[_0xa294('0x19')](0xcc)[_0xa294('0x26')]();});}};}function handleEntityNotFound(_0x577795,_0x24d9f6){return function(_0x2341eb){if(!_0x2341eb){_0x577795[_0xa294('0x18')](0x194);}return _0x2341eb;};}function handleError(_0x3b7545,_0x5ba5df){_0x5ba5df=_0x5ba5df||0x1f4;return function(_0x42b0cd){logger[_0xa294('0x27')](_0x42b0cd['stack']);if(_0x42b0cd[_0xa294('0x28')]){delete _0x42b0cd['name'];}_0x3b7545[_0xa294('0x19')](_0x5ba5df)[_0xa294('0x29')](_0x42b0cd);};}exports['index']=function(_0x53d2a9,_0x4ff09a){var _0x170e22={},_0x480f0d={},_0x248df9={'count':0x0,'rows':[]};var _0x1790b3=_[_0xa294('0x2a')](db['Automation']['rawAttributes'],function(_0x1825a6){return{'name':_0x1825a6[_0xa294('0x2b')],'type':_0x1825a6[_0xa294('0x2c')][_0xa294('0x2d')]};});_0x480f0d[_0xa294('0x2e')]=_[_0xa294('0x2a')](_0x1790b3,_0xa294('0x28'));_0x480f0d[_0xa294('0x2f')]=_[_0xa294('0x30')](_0x53d2a9[_0xa294('0x2f')]);_0x480f0d['filters']=_[_0xa294('0x31')](_0x480f0d[_0xa294('0x2e')],_0x480f0d[_0xa294('0x2f')]);_0x170e22['attributes']=_[_0xa294('0x31')](_0x480f0d[_0xa294('0x2e')],qs[_0xa294('0x32')](_0x53d2a9[_0xa294('0x2f')][_0xa294('0x32')]));_0x170e22[_0xa294('0x33')]=_0x170e22['attributes']['length']?_0x170e22[_0xa294('0x33')]:_0x480f0d[_0xa294('0x2e')];if(!_0x53d2a9[_0xa294('0x2f')]['hasOwnProperty'](_0xa294('0x34'))){_0x170e22[_0xa294('0x1c')]=qs[_0xa294('0x1c')](_0x53d2a9['query'][_0xa294('0x1c')]);_0x170e22[_0xa294('0x1b')]=qs[_0xa294('0x1b')](_0x53d2a9[_0xa294('0x2f')]['offset']);}_0x170e22[_0xa294('0x35')]=qs[_0xa294('0x36')](_0x53d2a9[_0xa294('0x2f')][_0xa294('0x36')]);_0x170e22['where']=qs[_0xa294('0x37')](_[_0xa294('0x38')](_0x53d2a9['query'],_0x480f0d['filters']),_0x1790b3);if(_0x53d2a9[_0xa294('0x2f')]['filter']){_0x170e22[_0xa294('0x39')]=_[_0xa294('0x3a')](_0x170e22[_0xa294('0x39')],{'$or':_['map'](_0x1790b3,function(_0x4caa31){if(_0x4caa31[_0xa294('0x2c')]!==_0xa294('0x3b')){var _0x50155a={};_0x50155a[_0x4caa31['name']]={'$like':'%'+_0x53d2a9[_0xa294('0x2f')][_0xa294('0x3c')]+'%'};return _0x50155a;}})});}_0x170e22=_['merge']({},_0x170e22,_0x53d2a9[_0xa294('0x3d')]);var _0x17a68c={'where':_0x170e22[_0xa294('0x39')]};return db[_0xa294('0x3e')][_0xa294('0x1e')](_0x17a68c)['then'](function(_0x3ac203){_0x248df9[_0xa294('0x1e')]=_0x3ac203;if(_0x53d2a9[_0xa294('0x2f')]['includeAll']){_0x170e22[_0xa294('0x3f')]=[{'all':!![]}];}return db['Automation'][_0xa294('0x40')](_0x170e22);})[_0xa294('0x25')](function(_0x36de5f){_0x248df9['rows']=_0x36de5f;return _0x248df9;})['then'](respondWithFilteredResult(_0x4ff09a,_0x170e22))[_0xa294('0x41')](handleError(_0x4ff09a,null));};exports[_0xa294('0x42')]=function(_0x432047,_0x4a247c){var _0x17dd2c={'raw':![],'where':{'id':_0x432047[_0xa294('0x43')]['id']}},_0x5d29aa={};_0x5d29aa[_0xa294('0x2e')]=_[_0xa294('0x30')](db[_0xa294('0x3e')][_0xa294('0x44')]);_0x5d29aa['query']=_['keys'](_0x432047['query']);_0x5d29aa[_0xa294('0x37')]=_[_0xa294('0x31')](_0x5d29aa[_0xa294('0x2e')],_0x5d29aa['query']);_0x17dd2c[_0xa294('0x33')]=_[_0xa294('0x31')](_0x5d29aa[_0xa294('0x2e')],qs[_0xa294('0x32')](_0x432047['query']['fields']));_0x17dd2c[_0xa294('0x33')]=_0x17dd2c[_0xa294('0x33')][_0xa294('0x45')]?_0x17dd2c['attributes']:_0x5d29aa[_0xa294('0x2e')];if(_0x432047[_0xa294('0x2f')][_0xa294('0x46')]){_0x17dd2c['include']=[{'all':!![]}];}_0x17dd2c=_[_0xa294('0x3a')]({},_0x17dd2c,_0x432047[_0xa294('0x3d')]);return db[_0xa294('0x3e')][_0xa294('0x47')](_0x17dd2c)[_0xa294('0x25')](handleEntityNotFound(_0x4a247c,null))[_0xa294('0x25')](respondWithResult(_0x4a247c,null))[_0xa294('0x41')](handleError(_0x4a247c,null));};exports[_0xa294('0x48')]=function(_0x39fe9b,_0x5dc90c){return db['Automation']['create'](_0x39fe9b['body'],{})['then'](respondWithResult(_0x5dc90c,0xc9))[_0xa294('0x41')](handleError(_0x5dc90c,null));};exports[_0xa294('0x24')]=function(_0x406427,_0x130759){if(_0x406427[_0xa294('0x49')]['id']){delete _0x406427['body']['id'];}return db[_0xa294('0x3e')][_0xa294('0x47')]({'where':{'id':_0x406427['params']['id']}})[_0xa294('0x25')](handleEntityNotFound(_0x130759,null))[_0xa294('0x25')](saveUpdates(_0x406427[_0xa294('0x49')],null))[_0xa294('0x25')](respondWithResult(_0x130759,null))['catch'](handleError(_0x130759,null));};exports[_0xa294('0x4a')]=function(_0x1e045b,_0x69e456){return db[_0xa294('0x3e')]['find']({'where':{'id':_0x1e045b['params']['id']}})['then'](handleEntityNotFound(_0x69e456,null))[_0xa294('0x25')](removeEntity(_0x69e456,null))[_0xa294('0x41')](handleError(_0x69e456,null));};exports[_0xa294('0x4b')]=function(_0x54ea90,_0x52aeeb,_0x3189af){return db[_0xa294('0x4c')][_0xa294('0x47')]({'where':{'id':_0x54ea90[_0xa294('0x43')]['id']}})[_0xa294('0x25')](handleEntityNotFound(_0x52aeeb,null))[_0xa294('0x25')](function(_0xd50f32){if(_0xd50f32){return _0xd50f32['addConditions'](_0x54ea90[_0xa294('0x49')][_0xa294('0x4d')],_[_0xa294('0x4e')](_0x54ea90['body'],[_0xa294('0x4d'),'id'])||{});}})['then'](respondWithResult(_0x52aeeb,null))[_0xa294('0x41')](handleError(_0x52aeeb,null));};exports[_0xa294('0x4f')]=function(_0x43b0fb,_0x4518fb,_0xf05b91){var _0x3c7b43={};var _0x2a2e47={};var _0x3fba4b;var _0x19e9ac;return db[_0xa294('0x3e')]['findOne']({'where':{'id':_0x43b0fb[_0xa294('0x43')]['id']}})[_0xa294('0x25')](handleEntityNotFound(_0x4518fb,null))[_0xa294('0x25')](function(_0x1c275e){if(_0x1c275e){_0x3fba4b=_0x1c275e;_0x2a2e47[_0xa294('0x2e')]=_['keys'](db[_0xa294('0x4c')]['rawAttributes']);_0x2a2e47[_0xa294('0x2f')]=_[_0xa294('0x30')](_0x43b0fb['query']);_0x2a2e47['filters']=_[_0xa294('0x31')](_0x2a2e47['model'],_0x2a2e47[_0xa294('0x2f')]);_0x3c7b43['attributes']=_['intersection'](_0x2a2e47['model'],qs['fields'](_0x43b0fb[_0xa294('0x2f')][_0xa294('0x32')]));_0x3c7b43[_0xa294('0x33')]=_0x3c7b43[_0xa294('0x33')][_0xa294('0x45')]?_0x3c7b43['attributes']:_0x2a2e47[_0xa294('0x2e')];_0x3c7b43[_0xa294('0x35')]=qs[_0xa294('0x36')](_0x43b0fb[_0xa294('0x2f')]['sort']);_0x3c7b43['where']=qs[_0xa294('0x37')](_[_0xa294('0x38')](_0x43b0fb['query'],_0x2a2e47['filters']));if(_0x43b0fb[_0xa294('0x2f')][_0xa294('0x3c')]){_0x3c7b43[_0xa294('0x39')]=_[_0xa294('0x3a')](_0x3c7b43['where'],{'$or':_[_0xa294('0x2a')](_0x3c7b43['attributes'],function(_0x33dbd4){var _0x31a9c4={};_0x31a9c4[_0x33dbd4]={'$like':'%'+_0x43b0fb['query']['filter']+'%'};return _0x31a9c4;})});}_0x3c7b43=_[_0xa294('0x3a')]({},_0x3c7b43,_0x43b0fb[_0xa294('0x3d')]);return _0x3fba4b[_0xa294('0x4f')](_0x3c7b43);}})['then'](function(_0x5e0875){if(_0x5e0875){_0x19e9ac=_0x5e0875['length'];if(!_0x43b0fb[_0xa294('0x2f')]['hasOwnProperty'](_0xa294('0x34'))){_0x3c7b43['limit']=qs[_0xa294('0x1c')](_0x43b0fb[_0xa294('0x2f')][_0xa294('0x1c')]);_0x3c7b43[_0xa294('0x1b')]=qs[_0xa294('0x1b')](_0x43b0fb[_0xa294('0x2f')][_0xa294('0x1b')]);}return _0x3fba4b[_0xa294('0x4f')](_0x3c7b43);}})['then'](function(_0x56090b){if(_0x56090b){return _0x56090b?{'count':_0x19e9ac,'rows':_0x56090b}:null;}})[_0xa294('0x25')](respondWithResult(_0x4518fb,null))[_0xa294('0x41')](handleError(_0x4518fb,null));};exports[_0xa294('0x50')]=function(_0x14b02e,_0x4197ad,_0x581477){return db[_0xa294('0x51')][_0xa294('0x47')]({'where':{'id':_0x14b02e[_0xa294('0x43')]['id']}})[_0xa294('0x25')](handleEntityNotFound(_0x4197ad,null))[_0xa294('0x25')](function(_0x2672d4){if(_0x2672d4){return _0x2672d4[_0xa294('0x50')](_0x14b02e[_0xa294('0x49')][_0xa294('0x4d')],_['omit'](_0x14b02e[_0xa294('0x49')],[_0xa294('0x4d'),'id'])||{});}})[_0xa294('0x25')](respondWithResult(_0x4197ad,null))['catch'](handleError(_0x4197ad,null));};exports[_0xa294('0x52')]=function(_0x3dd88e,_0x3a1546,_0x281c0f){var _0x2de72c={};var _0x37f6a5={};var _0x552bef;var _0x4638a4;return db[_0xa294('0x3e')][_0xa294('0x53')]({'where':{'id':_0x3dd88e['params']['id']}})['then'](handleEntityNotFound(_0x3a1546,null))['then'](function(_0x452ab7){if(_0x452ab7){_0x552bef=_0x452ab7;_0x37f6a5['model']=_[_0xa294('0x30')](db[_0xa294('0x51')][_0xa294('0x44')]);_0x37f6a5[_0xa294('0x2f')]=_[_0xa294('0x30')](_0x3dd88e[_0xa294('0x2f')]);_0x37f6a5[_0xa294('0x37')]=_[_0xa294('0x31')](_0x37f6a5[_0xa294('0x2e')],_0x37f6a5['query']);_0x2de72c['attributes']=_[_0xa294('0x31')](_0x37f6a5[_0xa294('0x2e')],qs[_0xa294('0x32')](_0x3dd88e[_0xa294('0x2f')][_0xa294('0x32')]));_0x2de72c['attributes']=_0x2de72c['attributes'][_0xa294('0x45')]?_0x2de72c[_0xa294('0x33')]:_0x37f6a5[_0xa294('0x2e')];_0x2de72c[_0xa294('0x35')]=qs[_0xa294('0x36')](_0x3dd88e[_0xa294('0x2f')][_0xa294('0x36')]);_0x2de72c[_0xa294('0x39')]=qs['filters'](_['pick'](_0x3dd88e[_0xa294('0x2f')],_0x37f6a5[_0xa294('0x37')]));if(_0x3dd88e[_0xa294('0x2f')][_0xa294('0x3c')]){_0x2de72c[_0xa294('0x39')]=_[_0xa294('0x3a')](_0x2de72c['where'],{'$or':_['map'](_0x2de72c['attributes'],function(_0x32f736){var _0x4428c2={};_0x4428c2[_0x32f736]={'$like':'%'+_0x3dd88e[_0xa294('0x2f')][_0xa294('0x3c')]+'%'};return _0x4428c2;})});}_0x2de72c=_[_0xa294('0x3a')]({},_0x2de72c,_0x3dd88e[_0xa294('0x3d')]);return _0x552bef['getActions'](_0x2de72c);}})[_0xa294('0x25')](function(_0x2742b7){if(_0x2742b7){_0x4638a4=_0x2742b7[_0xa294('0x45')];if(!_0x3dd88e[_0xa294('0x2f')][_0xa294('0x54')]('nolimit')){_0x2de72c[_0xa294('0x1c')]=qs[_0xa294('0x1c')](_0x3dd88e[_0xa294('0x2f')][_0xa294('0x1c')]);_0x2de72c[_0xa294('0x1b')]=qs[_0xa294('0x1b')](_0x3dd88e[_0xa294('0x2f')]['offset']);}return _0x552bef[_0xa294('0x52')](_0x2de72c);}})[_0xa294('0x25')](function(_0xd22260){if(_0xd22260){return _0xd22260?{'count':_0x4638a4,'rows':_0xd22260}:null;}})['then'](respondWithResult(_0x3a1546,null))[_0xa294('0x41')](handleError(_0x3a1546,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 1bd5ad3..adb4d6f 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 _0x161d=['bluebird','request-promise','path','../../config/environment','./automation.attributes','exports','Automation','tools_automations','util','api'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x161d,0xf8));var _0xd161=function(_0x79c523,_0x472ff9){_0x79c523=_0x79c523-0x0;var _0x42a0b5=_0x161d[_0x79c523];return _0x42a0b5;};'use strict';var _=require('lodash');var util=require(_0xd161('0x0'));var logger=require('../../config/logger')(_0xd161('0x1'));var moment=require('moment');var BPromise=require(_0xd161('0x2'));var rp=require(_0xd161('0x3'));var fs=require('fs');var path=require(_0xd161('0x4'));var rimraf=require('rimraf');var config=require(_0xd161('0x5'));var attributes=require(_0xd161('0x6'));module[_0xd161('0x7')]=function(_0x1790ac,_0x1bf38b){return _0x1790ac['define'](_0xd161('0x8'),attributes,{'tableName':_0xd161('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa5dd=['../../config/environment','./automation.attributes','define','tools_automations','lodash','api','moment','path','rimraf'];(function(_0x4d0df6,_0x4634f3){var _0x4e2615=function(_0x5285e2){while(--_0x5285e2){_0x4d0df6['push'](_0x4d0df6['shift']());}};_0x4e2615(++_0x4634f3);}(_0xa5dd,0x1cf));var _0xda5d=function(_0x4a5802,_0xcd0d3d){_0x4a5802=_0x4a5802-0x0;var _0x39ca8b=_0xa5dd[_0x4a5802];return _0x39ca8b;};'use strict';var _=require(_0xda5d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xda5d('0x1'));var moment=require(_0xda5d('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xda5d('0x3'));var rimraf=require(_0xda5d('0x4'));var config=require(_0xda5d('0x5'));var attributes=require(_0xda5d('0x6'));module['exports']=function(_0x1eb57c,_0x1e68ab){return _0x1eb57c[_0xda5d('0x7')]('Automation',attributes,{'tableName':_0xda5d('0x8'),'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 b7a976b..272c0cf 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 _0xfd58=['info','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','request\x20sent','debug','stringify','error','code','Automation,\x20%s,\x20%s','message'];(function(_0x414cb9,_0x46f345){var _0x4e8abc=function(_0x8d8f13){while(--_0x8d8f13){_0x414cb9['push'](_0x414cb9['shift']());}};_0x4e8abc(++_0x46f345);}(_0xfd58,0xb3));var _0x8fd5=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xfd58[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x8fd5('0x0'));var util=require(_0x8fd5('0x1'));var moment=require('moment');var BPromise=require(_0x8fd5('0x2'));var rs=require(_0x8fd5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8fd5('0x4'))['db'];var utils=require(_0x8fd5('0x5'));var logger=require(_0x8fd5('0x6'))(_0x8fd5('0x7'));var config=require('../../config/environment');var jayson=require(_0x8fd5('0x8'));var client=jayson[_0x8fd5('0x9')][_0x8fd5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e10e4,_0x16ac3f,_0x32bad9){return new BPromise(function(_0x273344,_0x1042a1){return client[_0x8fd5('0xb')](_0x4e10e4,_0x32bad9)['then'](function(_0x462ac4){logger['info']('Automation,\x20%s,\x20%s',_0x16ac3f,_0x8fd5('0xc'));logger[_0x8fd5('0xd')]('Automation,\x20%s,\x20%s,\x20%s',_0x16ac3f,_0x8fd5('0xc'),JSON[_0x8fd5('0xe')](_0x462ac4));if(_0x462ac4['error']){if(_0x462ac4[_0x8fd5('0xf')][_0x8fd5('0x10')]===0x1f4){logger['error'](_0x8fd5('0x11'),_0x16ac3f,_0x462ac4[_0x8fd5('0xf')][_0x8fd5('0x12')]);return _0x1042a1(_0x462ac4[_0x8fd5('0xf')]['message']);}logger['error']('Automation,\x20%s,\x20%s',_0x16ac3f,_0x462ac4[_0x8fd5('0xf')][_0x8fd5('0x12')]);return _0x273344(_0x462ac4[_0x8fd5('0xf')][_0x8fd5('0x12')]);}else{logger[_0x8fd5('0x13')](_0x8fd5('0x11'),_0x16ac3f,_0x8fd5('0xc'));_0x273344(_0x462ac4[_0x8fd5('0x14')][_0x8fd5('0x12')]);}})[_0x8fd5('0x15')](function(_0x53b2dd){logger[_0x8fd5('0xf')](_0x8fd5('0x11'),_0x16ac3f,_0x53b2dd);_0x1042a1(_0x53b2dd);});});} \ No newline at end of file +var _0xc5b3=['client','request','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','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x44c5c1,_0x4d9d55){var _0x467172=function(_0x584e24){while(--_0x584e24){_0x44c5c1['push'](_0x44c5c1['shift']());}};_0x467172(++_0x4d9d55);}(_0xc5b3,0x1ee));var _0x3c5b=function(_0x2786ea,_0x16c3c3){_0x2786ea=_0x2786ea-0x0;var _0x5c38e5=_0xc5b3[_0x2786ea];return _0x5c38e5;};'use strict';var _=require(_0x3c5b('0x0'));var util=require(_0x3c5b('0x1'));var moment=require(_0x3c5b('0x2'));var BPromise=require(_0x3c5b('0x3'));var rs=require(_0x3c5b('0x4'));var fs=require('fs');var Redis=require(_0x3c5b('0x5'));var db=require(_0x3c5b('0x6'))['db'];var utils=require(_0x3c5b('0x7'));var logger=require('../../config/logger')(_0x3c5b('0x8'));var config=require(_0x3c5b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3c5b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7a363e,_0x4730e9,_0x894f97){return new BPromise(function(_0xae86a0,_0x32586d){return client[_0x3c5b('0xb')](_0x7a363e,_0x894f97)[_0x3c5b('0xc')](function(_0x5f5df9){logger[_0x3c5b('0xd')](_0x3c5b('0xe'),_0x4730e9,_0x3c5b('0xf'));logger[_0x3c5b('0x10')](_0x3c5b('0x11'),_0x4730e9,'request\x20sent',JSON[_0x3c5b('0x12')](_0x5f5df9));if(_0x5f5df9[_0x3c5b('0x13')]){if(_0x5f5df9[_0x3c5b('0x13')][_0x3c5b('0x14')]===0x1f4){logger[_0x3c5b('0x13')](_0x3c5b('0xe'),_0x4730e9,_0x5f5df9[_0x3c5b('0x13')]['message']);return _0x32586d(_0x5f5df9[_0x3c5b('0x13')][_0x3c5b('0x15')]);}logger[_0x3c5b('0x13')](_0x3c5b('0xe'),_0x4730e9,_0x5f5df9['error'][_0x3c5b('0x15')]);return _0xae86a0(_0x5f5df9['error'][_0x3c5b('0x15')]);}else{logger[_0x3c5b('0xd')]('Automation,\x20%s,\x20%s',_0x4730e9,_0x3c5b('0xf'));_0xae86a0(_0x5f5df9[_0x3c5b('0x16')]['message']);}})[_0x3c5b('0x17')](function(_0x1cbe52){logger[_0x3c5b('0x13')]('Automation,\x20%s,\x20%s',_0x4730e9,_0x1cbe52);_0x32586d(_0x1cbe52);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index cc41b4d..4868a51 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 _0xf097=['update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','./automation.controller','get','isAuthenticated','index','show','/:id/conditions','getConditions','getActions','post','create','addConditions','/:id/actions','addActions','put','/:id'];(function(_0x423d89,_0x440a2d){var _0x417221=function(_0x2eda1a){while(--_0x2eda1a){_0x423d89['push'](_0x423d89['shift']());}};_0x417221(++_0x440a2d);}(_0xf097,0x1b2));var _0x7f09=function(_0x2c7b9b,_0x418263){_0x2c7b9b=_0x2c7b9b-0x0;var _0x169383=_0xf097[_0x2c7b9b];return _0x169383;};'use strict';var multer=require(_0x7f09('0x0'));var util=require(_0x7f09('0x1'));var path=require(_0x7f09('0x2'));var timeout=require(_0x7f09('0x3'));var express=require(_0x7f09('0x4'));var router=express[_0x7f09('0x5')]();var fs_extra=require(_0x7f09('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7f09('0x7'));router[_0x7f09('0x8')]('/',auth[_0x7f09('0x9')](),controller[_0x7f09('0xa')]);router[_0x7f09('0x8')]('/:id',auth[_0x7f09('0x9')](),controller[_0x7f09('0xb')]);router['get'](_0x7f09('0xc'),auth[_0x7f09('0x9')](),controller[_0x7f09('0xd')]);router[_0x7f09('0x8')]('/:id/actions',auth[_0x7f09('0x9')](),controller[_0x7f09('0xe')]);router[_0x7f09('0xf')]('/',auth[_0x7f09('0x9')](),controller[_0x7f09('0x10')]);router[_0x7f09('0xf')](_0x7f09('0xc'),auth[_0x7f09('0x9')](),controller[_0x7f09('0x11')]);router[_0x7f09('0xf')](_0x7f09('0x12'),auth[_0x7f09('0x9')](),controller[_0x7f09('0x13')]);router[_0x7f09('0x14')](_0x7f09('0x15'),auth['isAuthenticated'](),controller[_0x7f09('0x16')]);router['delete'](_0x7f09('0x15'),auth['isAuthenticated'](),controller[_0x7f09('0x17')]);module['exports']=router; \ No newline at end of file +var _0xe18e=['/:id','show','/:id/conditions','getConditions','getActions','post','create','addConditions','addActions','put','update','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./automation.controller','get','isAuthenticated','index'];(function(_0x112076,_0x152414){var _0x5dbca4=function(_0x203bf2){while(--_0x203bf2){_0x112076['push'](_0x112076['shift']());}};_0x5dbca4(++_0x152414);}(_0xe18e,0xe5));var _0xee18=function(_0x4fcbe6,_0x2f02e7){_0x4fcbe6=_0x4fcbe6-0x0;var _0x4e1cd2=_0xe18e[_0x4fcbe6];return _0x4e1cd2;};'use strict';var multer=require(_0xee18('0x0'));var util=require(_0xee18('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xee18('0x2'));var router=express[_0xee18('0x3')]();var fs_extra=require(_0xee18('0x4'));var auth=require(_0xee18('0x5'));var interaction=require(_0xee18('0x6'));var config=require('../../config/environment');var controller=require(_0xee18('0x7'));router[_0xee18('0x8')]('/',auth[_0xee18('0x9')](),controller[_0xee18('0xa')]);router[_0xee18('0x8')](_0xee18('0xb'),auth[_0xee18('0x9')](),controller[_0xee18('0xc')]);router[_0xee18('0x8')](_0xee18('0xd'),auth['isAuthenticated'](),controller[_0xee18('0xe')]);router['get']('/:id/actions',auth[_0xee18('0x9')](),controller[_0xee18('0xf')]);router[_0xee18('0x10')]('/',auth[_0xee18('0x9')](),controller[_0xee18('0x11')]);router[_0xee18('0x10')](_0xee18('0xd'),auth[_0xee18('0x9')](),controller[_0xee18('0x12')]);router[_0xee18('0x10')]('/:id/actions',auth[_0xee18('0x9')](),controller[_0xee18('0x13')]);router[_0xee18('0x14')](_0xee18('0xb'),auth[_0xee18('0x9')](),controller[_0xee18('0x15')]);router['delete'](_0xee18('0xb'),auth['isAuthenticated'](),controller[_0xee18('0x16')]);module[_0xee18('0x17')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 5078126..a213287 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 _0x6c98=['#AMD\x20Maximum\x20Word\x20Length','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED','Max\x20200\x20calls.','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)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#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)'];(function(_0x5492ce,_0x129ad1){var _0x3082ca=function(_0x1b1d74){while(--_0x1b1d74){_0x5492ce['push'](_0x5492ce['shift']());}};_0x3082ca(++_0x129ad1);}(_0x6c98,0x7c));var _0x86c9=function(_0x271ebd,_0x25dc7b){_0x271ebd=_0x271ebd-0x0;var _0x1d11f5=_0x6c98[_0x271ebd];return _0x1d11f5;};'use strict';var Sequelize=require(_0x86c9('0x0'));module[_0x86c9('0x1')]={'name':{'type':Sequelize[_0x86c9('0x2')],'unique':_0x86c9('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x86c9('0x4')](_0x86c9('0x5')),'allowNull':![],'defaultValue':_0x86c9('0x5')},'description':{'type':Sequelize[_0x86c9('0x2')]},'active':{'type':Sequelize[_0x86c9('0x6')],'defaultValue':0x0,'comment':_0x86c9('0x7')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x86c9('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x86c9('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0x86c9('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x86c9('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x86c9('0xa')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x86c9('0xb')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x86c9('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x86c9('0xc')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x86c9('0xa')](0x5)[_0x86c9('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x86c9('0xd')},'dialBusyMaxRetry':{'type':Sequelize[_0x86c9('0xa')](0x3)[_0x86c9('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x86c9('0xe')},'dialBusyRetryFrequency':{'type':Sequelize[_0x86c9('0xa')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x86c9('0xf')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x86c9('0xa')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x86c9('0xa')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x86c9('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x86c9('0x10')},'dialTimezone':{'type':Sequelize[_0x86c9('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x86c9('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x86c9('0x4')](_0x86c9('0x11'),_0x86c9('0x12'),_0x86c9('0x13')),'defaultValue':_0x86c9('0x11')},'dialAMDActive':{'type':Sequelize[_0x86c9('0x6')],'defaultValue':0x0,'comment':_0x86c9('0x14')},'dialAMDInitialSilence':{'type':Sequelize[_0x86c9('0xa')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x86c9('0x15')},'dialAMDGreeting':{'type':Sequelize[_0x86c9('0xa')](0x9)[_0x86c9('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x86c9('0xa')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x86c9('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x86c9('0xa')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x86c9('0x17')},'dialAMDMinWordLength':{'type':Sequelize[_0x86c9('0xa')](0x9)[_0x86c9('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x86c9('0x18')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x86c9('0xa')](0x9)[_0x86c9('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x86c9('0x19')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x86c9('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x86c9('0x1a')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x86c9('0xa')](0x5)[_0x86c9('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x86c9('0x1b')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x86c9('0xa')](0x9)[_0x86c9('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x86c9('0x1c')},'dialOrderByScheduledAt':{'type':Sequelize[_0x86c9('0x4')]('DESC','ASC'),'defaultValue':_0x86c9('0x1d')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x86c9('0xa')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x86c9('0x1e')},'dialCutDigit':{'type':Sequelize[_0x86c9('0xa')](0x3)[_0x86c9('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x86c9('0x1f')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x86c9('0xa')](0x3)[_0x86c9('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x86c9('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x86c9('0x20')},'dialDropMaxRetry':{'type':Sequelize[_0x86c9('0xa')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x86c9('0x21')},'dialDropRetryFrequency':{'type':Sequelize[_0x86c9('0xa')](0x5)[_0x86c9('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x86c9('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x86c9('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x86c9('0xa')](0x5)[_0x86c9('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x86c9('0x23')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x86c9('0xa')](0x5)[_0x86c9('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x86c9('0x24')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x86c9('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x86c9('0xa')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x86c9('0x25')}}; \ No newline at end of file +var _0xe51d=['#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','sequelize','exports','name','ENUM','ivr','BOOLEAN','UNSIGNED','Max\x20200\x20calls.','STRING','INTEGER','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','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\x20Maximum\x20Number\x20Of\x20Words','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)'];(function(_0x11aee5,_0x27fa94){var _0x2e8c9d=function(_0x33ff83){while(--_0x33ff83){_0x11aee5['push'](_0x11aee5['shift']());}};_0x2e8c9d(++_0x27fa94);}(_0xe51d,0x9c));var _0xde51=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe51d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xde51('0x0'));module[_0xde51('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xde51('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xde51('0x3')](_0xde51('0x4')),'allowNull':![],'defaultValue':_0xde51('0x4')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xde51('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0xde51('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xde51('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0xde51('0x8')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xde51('0x9')](0x3)[_0xde51('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xde51('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0xde51('0x9')](0x3)[_0xde51('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xde51('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xde51('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0xde51('0x9')](0x5)[_0xde51('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xde51('0x9')](0x3)[_0xde51('0x6')],'defaultValue':0x3,'comment':_0xde51('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xde51('0x9')](0x5)[_0xde51('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xde51('0xd')},'dialGlobalMaxRetry':{'type':Sequelize[_0xde51('0x9')](0x3)[_0xde51('0x6')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xde51('0xe')},'dialTimezone':{'type':Sequelize[_0xde51('0x8')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xde51('0x8')],'defaultValue':_0xde51('0xf')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0xde51('0x10'),_0xde51('0x11'),_0xde51('0x12')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0xde51('0x5')],'defaultValue':0x0,'comment':_0xde51('0x13')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xde51('0x6')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xde51('0x14')},'dialAMDGreeting':{'type':Sequelize[_0xde51('0x9')](0x9)[_0xde51('0x6')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xde51('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xde51('0x9')](0x9)[_0xde51('0x6')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xde51('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0xde51('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xde51('0x17')},'dialAMDMinWordLength':{'type':Sequelize[_0xde51('0x9')](0x9)[_0xde51('0x6')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xde51('0x18')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xde51('0x9')](0x9)[_0xde51('0x6')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xde51('0x9')](0x9)[_0xde51('0x6')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xde51('0x19')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xde51('0x9')](0x5)[_0xde51('0x6')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0xde51('0x9')](0x9)[_0xde51('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0xde51('0x3')](_0xde51('0x1a'),_0xde51('0x1b')),'defaultValue':_0xde51('0x1a')},'dialPrefix':{'type':Sequelize[_0xde51('0x8')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xde51('0x9')](0x3)[_0xde51('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xde51('0x1c')},'dialCutDigit':{'type':Sequelize[_0xde51('0x9')](0x3)[_0xde51('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xde51('0x1d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xde51('0x9')](0x3)[_0xde51('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xde51('0x1e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xde51('0x9')](0x5)[_0xde51('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xde51('0x1f')},'dialDropMaxRetry':{'type':Sequelize[_0xde51('0x9')](0x3)[_0xde51('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xde51('0x20')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xde51('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xde51('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xde51('0x9')](0x3)[_0xde51('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xde51('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xde51('0x9')](0x5)[_0xde51('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xde51('0x23')},'dialMachineMaxRetry':{'type':Sequelize[_0xde51('0x9')](0x3)[_0xde51('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xde51('0x24')},'dialMachineRetryFrequency':{'type':Sequelize[_0xde51('0x9')](0x5)[_0xde51('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xde51('0x9')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xde51('0x25')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xde51('0x9')](0x5)[_0xde51('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 5af0a2f..a240cf8 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 _0x314b=['body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','omit','updatedAt','autoAssociation','getHoppers','findOne','CmHopper','hasOwnProperty','CampaignId','findAll','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','order','getLists','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','phone','scheduledAt','ListId','field','ContactId','CmListId','toString','NOW()','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','cm_hopper','CampaignId\x20=\x20?','onlyIfOpen','fromQuery','cm_contacts','phone\x20IS\x20NOT\x20NULL','sequelize','all','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black','push','removeBlackLists','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','json','offset','undefined','limit','count','status','set','Content-Range','save','update','then','destroy','get','IvrCampaigns','end','sendStatus','error','name','send','index','map','Campaign','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','nolimit','sort','where','pick','filter','options','includeAll','include','rows','show','params','rawAttributes','fields','merge','find','create'];(function(_0xaa5d96,_0x2854eb){var _0x33e21e=function(_0x3bc2b9){while(--_0x3bc2b9){_0xaa5d96['push'](_0xaa5d96['shift']());}};_0x33e21e(++_0x2854eb);}(_0x314b,0x154));var _0xb314=function(_0x4c8232,_0x4e0dea){_0x4c8232=_0x4c8232-0x0;var _0x3cc8e5=_0x314b[_0x4c8232];return _0x3cc8e5;};'use strict';var emlformat=require(_0xb314('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb314('0x1'));var jsonpatch=require(_0xb314('0x2'));var rp=require(_0xb314('0x3'));var moment=require(_0xb314('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb314('0x5'));var util=require(_0xb314('0x6'));var path=require(_0xb314('0x7'));var sox=require(_0xb314('0x8'));var csv=require(_0xb314('0x9'));var ejs=require(_0xb314('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb314('0xb'));var squel=require(_0xb314('0xc'));var crypto=require(_0xb314('0xd'));var jsforce=require(_0xb314('0xe'));var deskjs=require(_0xb314('0xf'));var toCsv=require(_0xb314('0x9'));var querystring=require(_0xb314('0x10'));var Papa=require(_0xb314('0x11'));var Redis=require(_0xb314('0x12'));var authService=require(_0xb314('0x13'));var qs=require(_0xb314('0x14'));var as=require(_0xb314('0x15'));var hardwareService=require(_0xb314('0x16'));var logger=require(_0xb314('0x17'))(_0xb314('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb314('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x48e4d5,_0xf17697){_0xf17697=_0xf17697||0xcc;return function(_0x264d4d){if(_0x264d4d){return _0x48e4d5['sendStatus'](_0xf17697);}return _0x48e4d5['status'](_0xf17697)['end']();};}function respondWithResult(_0x314e6c,_0x18bc13){_0x18bc13=_0x18bc13||0xc8;return function(_0x56e3c8){if(_0x56e3c8){return _0x314e6c['status'](_0x18bc13)[_0xb314('0x1a')](_0x56e3c8);}};}function respondWithFilteredResult(_0x89cc00,_0x49a69d){return function(_0x3c4e7a){if(_0x3c4e7a){var _0x47bc93=typeof _0x49a69d[_0xb314('0x1b')]===_0xb314('0x1c')&&typeof _0x49a69d[_0xb314('0x1d')]==='undefined';var _0x3961b3=_0x3c4e7a[_0xb314('0x1e')];var _0x3bbb9f=_0x47bc93?0x0:_0x49a69d[_0xb314('0x1b')];var _0x30e6b7=_0x47bc93?_0x3c4e7a['count']:_0x49a69d[_0xb314('0x1b')]+_0x49a69d['limit'];var _0xf3a125;if(_0x30e6b7>=_0x3961b3){_0x30e6b7=_0x3961b3;_0xf3a125=0xc8;}else{_0xf3a125=0xce;}_0x89cc00[_0xb314('0x1f')](_0xf3a125);return _0x89cc00[_0xb314('0x20')](_0xb314('0x21'),_0x3bbb9f+'-'+_0x30e6b7+'/'+_0x3961b3)[_0xb314('0x1a')](_0x3c4e7a);}return null;};}function patchUpdates(_0x27f614){return function(_0x273383){try{jsonpatch['apply'](_0x273383,_0x27f614,!![]);}catch(_0x40c941){return BPromise['reject'](_0x40c941);}return _0x273383[_0xb314('0x22')]();};}function saveUpdates(_0x54b463,_0x3eea7d){return function(_0x3e76fe){if(_0x3e76fe){return _0x3e76fe[_0xb314('0x23')](_0x54b463)[_0xb314('0x24')](function(_0x4f62c0){return _0x4f62c0;});}return null;};}function removeEntity(_0x412a1b,_0x5a6a96){return function(_0x2c3aa3){if(_0x2c3aa3){return _0x2c3aa3[_0xb314('0x25')]()['then'](function(){var _0x397bd5=_0x2c3aa3[_0xb314('0x26')]({'plain':!![]});var _0x4d51c6=_0xb314('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x4d51c6,'resourceId':_0x397bd5['id']}})['then'](function(){return _0x2c3aa3;});})[_0xb314('0x24')](function(){_0x412a1b['status'](0xcc)[_0xb314('0x28')]();});}};}function handleEntityNotFound(_0x1d678f,_0x67916f){return function(_0x597786){if(!_0x597786){_0x1d678f[_0xb314('0x29')](0x194);}return _0x597786;};}function handleError(_0x42af57,_0x3dec11){_0x3dec11=_0x3dec11||0x1f4;return function(_0x3f9582){logger[_0xb314('0x2a')](_0x3f9582['stack']);if(_0x3f9582['name']){delete _0x3f9582[_0xb314('0x2b')];}_0x42af57[_0xb314('0x1f')](_0x3dec11)[_0xb314('0x2c')](_0x3f9582);};}exports[_0xb314('0x2d')]=function(_0x344c4f,_0x2d688b){var _0x12a79e={},_0x5cfb5b={},_0x299d0e={'count':0x0,'rows':[]};var _0x122867=_[_0xb314('0x2e')](db[_0xb314('0x2f')]['rawAttributes'],function(_0x25e875){return{'name':_0x25e875[_0xb314('0x30')],'type':_0x25e875[_0xb314('0x31')][_0xb314('0x32')]};});_0x5cfb5b[_0xb314('0x33')]=_['map'](_0x122867,'name');_0x5cfb5b['query']=_[_0xb314('0x34')](_0x344c4f[_0xb314('0x35')]);_0x5cfb5b[_0xb314('0x36')]=_[_0xb314('0x37')](_0x5cfb5b[_0xb314('0x33')],_0x5cfb5b[_0xb314('0x35')]);_0x12a79e['attributes']=_[_0xb314('0x37')](_0x5cfb5b[_0xb314('0x33')],qs['fields'](_0x344c4f[_0xb314('0x35')]['fields']));_0x12a79e[_0xb314('0x38')]=_0x12a79e[_0xb314('0x38')][_0xb314('0x39')]?_0x12a79e[_0xb314('0x38')]:_0x5cfb5b[_0xb314('0x33')];if(!_0x344c4f[_0xb314('0x35')]['hasOwnProperty'](_0xb314('0x3a'))){_0x12a79e['limit']=qs[_0xb314('0x1d')](_0x344c4f[_0xb314('0x35')][_0xb314('0x1d')]);_0x12a79e[_0xb314('0x1b')]=qs['offset'](_0x344c4f[_0xb314('0x35')]['offset']);}_0x12a79e['order']=qs[_0xb314('0x3b')](_0x344c4f[_0xb314('0x35')][_0xb314('0x3b')]);_0x12a79e[_0xb314('0x3c')]=qs[_0xb314('0x36')](_[_0xb314('0x3d')](_0x344c4f[_0xb314('0x35')],_0x5cfb5b[_0xb314('0x36')]),_0x122867);if(_0x344c4f[_0xb314('0x35')][_0xb314('0x3e')]){_0x12a79e['where']=_['merge'](_0x12a79e[_0xb314('0x3c')],{'$or':_[_0xb314('0x2e')](_0x122867,function(_0x57249a){if(_0x57249a[_0xb314('0x31')]!=='VIRTUAL'){var _0x163c2c={};_0x163c2c[_0x57249a['name']]={'$like':'%'+_0x344c4f[_0xb314('0x35')][_0xb314('0x3e')]+'%'};return _0x163c2c;}})});}_0x12a79e=_['merge']({},_0x12a79e,_0x344c4f[_0xb314('0x3f')]);var _0x1dd52e={'where':_0x12a79e[_0xb314('0x3c')]};return db['Campaign']['count'](_0x1dd52e)[_0xb314('0x24')](function(_0x14f368){_0x299d0e[_0xb314('0x1e')]=_0x14f368;if(_0x344c4f['query'][_0xb314('0x40')]){_0x12a79e[_0xb314('0x41')]=[{'all':!![]}];}return db['Campaign']['findAll'](_0x12a79e);})[_0xb314('0x24')](function(_0x3f1504){_0x299d0e[_0xb314('0x42')]=_0x3f1504;return _0x299d0e;})[_0xb314('0x24')](respondWithFilteredResult(_0x2d688b,_0x12a79e))['catch'](handleError(_0x2d688b,null));};exports[_0xb314('0x43')]=function(_0x208ed3,_0x1a3922){var _0x501d26={'raw':![],'where':{'id':_0x208ed3[_0xb314('0x44')]['id']}},_0x2fe237={};_0x2fe237['model']=_['keys'](db['Campaign'][_0xb314('0x45')]);_0x2fe237[_0xb314('0x35')]=_[_0xb314('0x34')](_0x208ed3[_0xb314('0x35')]);_0x2fe237[_0xb314('0x36')]=_[_0xb314('0x37')](_0x2fe237[_0xb314('0x33')],_0x2fe237[_0xb314('0x35')]);_0x501d26[_0xb314('0x38')]=_[_0xb314('0x37')](_0x2fe237[_0xb314('0x33')],qs[_0xb314('0x46')](_0x208ed3[_0xb314('0x35')][_0xb314('0x46')]));_0x501d26[_0xb314('0x38')]=_0x501d26[_0xb314('0x38')]['length']?_0x501d26[_0xb314('0x38')]:_0x2fe237[_0xb314('0x33')];if(_0x208ed3[_0xb314('0x35')][_0xb314('0x40')]){_0x501d26['include']=[{'all':!![]}];}_0x501d26=_[_0xb314('0x47')]({},_0x501d26,_0x208ed3[_0xb314('0x3f')]);return db[_0xb314('0x2f')][_0xb314('0x48')](_0x501d26)[_0xb314('0x24')](handleEntityNotFound(_0x1a3922,null))['then'](respondWithResult(_0x1a3922,null))['catch'](handleError(_0x1a3922,null));};exports[_0xb314('0x49')]=function(_0xfddbe3,_0x64e230){return db[_0xb314('0x2f')]['create'](_0xfddbe3[_0xb314('0x4a')],{})[_0xb314('0x24')](function(_0x485346){var _0x59e917=_0xfddbe3['user'][_0xb314('0x26')]({'plain':!![]});if(!_0x59e917)throw new Error(_0xb314('0x4b'));if(_0x59e917['role']==='user'){var _0x380da2=_0x485346[_0xb314('0x26')]({'plain':!![]});var _0x1dc758='IvrCampaigns';return db[_0xb314('0x4c')][_0xb314('0x48')]({'where':{'name':_0x1dc758,'userProfileId':_0x59e917[_0xb314('0x4d')]},'raw':!![]})[_0xb314('0x24')](function(_0x129987){if(_0x129987&&_0x129987['autoAssociation']===0x0){return db[_0xb314('0x4e')]['create']({'name':_0x380da2[_0xb314('0x2b')],'resourceId':_0x380da2['id'],'type':_0x129987[_0xb314('0x2b')],'sectionId':_0x129987['id']},{})[_0xb314('0x24')](function(){return _0x485346;});}else{return _0x485346;}})[_0xb314('0x4f')](function(_0x226abb){logger['error'](_0xb314('0x50'),_0x226abb);throw _0x226abb;});}return _0x485346;})[_0xb314('0x24')](respondWithResult(_0x64e230,0xc9))['catch'](handleError(_0x64e230,null));};exports[_0xb314('0x51')]=function(_0x4ecdae,_0x3d6e47){var _0x4f3da9={'where':{'id':_0x4ecdae[_0xb314('0x44')]['id']}},_0x182bb0={};_0x182bb0['model']=_['keys'](db[_0xb314('0x2f')][_0xb314('0x45')]);_0x4f3da9[_0xb314('0x38')]=_[_0xb314('0x37')](_0x182bb0[_0xb314('0x33')],qs['fields'](_0x4ecdae[_0xb314('0x35')]['fields']));_0x4f3da9['attributes']=_0x4f3da9[_0xb314('0x38')]['length']?_0x4f3da9['attributes']:_0x182bb0['model'];if(_0x4ecdae[_0xb314('0x35')][_0xb314('0x40')]){_0x4f3da9[_0xb314('0x41')]=[{'all':!![]}];}_0x4f3da9=_[_0xb314('0x47')]({},_0x4f3da9,_0x4ecdae[_0xb314('0x3f')]);return db[_0xb314('0x2f')]['find'](_0x4f3da9)[_0xb314('0x24')](handleEntityNotFound(_0x3d6e47,null))[_0xb314('0x24')](function(_0x40d736){if(_0x40d736){var _0x5b406d=_0x40d736[_0xb314('0x26')]({'plain':!![]});_0x5b406d=qs['omit'](_0x5b406d,['id',_0xb314('0x52'),'updatedAt']);_0x4ecdae[_0xb314('0x4a')]=_[_0xb314('0x53')](_0x4ecdae[_0xb314('0x4a')],['id',_0xb314('0x52'),_0xb314('0x54')]);return db[_0xb314('0x2f')]['create'](_[_0xb314('0x47')](_0x5b406d,_0x4ecdae[_0xb314('0x4a')]),{'include':_0x4ecdae[_0xb314('0x35')][_0xb314('0x40')]?[{'all':!![]}]:undefined})[_0xb314('0x24')](function(_0x346030){var _0x1a272b=_0x4ecdae['user']['get']({'plain':!![]});if(!_0x1a272b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1a272b['role']==='user'){var _0x2d04cb=_0x346030['get']({'plain':!![]});var _0x14aa47='IvrCampaigns';return db['UserProfileSection'][_0xb314('0x48')]({'where':{'name':_0x14aa47,'userProfileId':_0x1a272b['userProfileId']},'raw':!![]})[_0xb314('0x24')](function(_0x367765){if(_0x367765&&_0x367765[_0xb314('0x55')]===0x0){return db['UserProfileResource']['create']({'name':_0x2d04cb[_0xb314('0x2b')],'resourceId':_0x2d04cb['id'],'type':_0x367765[_0xb314('0x2b')],'sectionId':_0x367765['id']},{})[_0xb314('0x24')](function(){return _0x346030;});}else{return _0x346030;}})['catch'](function(_0x2c69f6){logger['error'](_0xb314('0x50'),_0x2c69f6);throw _0x2c69f6;});}return _0x346030;});}})[_0xb314('0x24')](respondWithResult(_0x3d6e47,0xc9))[_0xb314('0x4f')](handleError(_0x3d6e47,null));};exports[_0xb314('0x23')]=function(_0x19683c,_0x262f43){if(_0x19683c['body']['id']){delete _0x19683c[_0xb314('0x4a')]['id'];}return db[_0xb314('0x2f')][_0xb314('0x48')]({'where':{'id':_0x19683c[_0xb314('0x44')]['id']}})['then'](handleEntityNotFound(_0x262f43,null))[_0xb314('0x24')](saveUpdates(_0x19683c[_0xb314('0x4a')],null))[_0xb314('0x24')](respondWithResult(_0x262f43,null))[_0xb314('0x4f')](handleError(_0x262f43,null));};exports[_0xb314('0x25')]=function(_0x30d854,_0x2dfc64){return db[_0xb314('0x2f')][_0xb314('0x48')]({'where':{'id':_0x30d854[_0xb314('0x44')]['id']}})[_0xb314('0x24')](handleEntityNotFound(_0x2dfc64,null))[_0xb314('0x24')](removeEntity(_0x2dfc64,null))[_0xb314('0x4f')](handleError(_0x2dfc64,null));};exports[_0xb314('0x56')]=function(_0x7e11aa,_0x2ef60b,_0x2396a4){var _0x27b3ea={'raw':!![],'where':{}};var _0x49f8ae={};var _0x503d58={'count':0x0,'rows':[]};return db[_0xb314('0x2f')][_0xb314('0x57')]({'where':{'id':_0x7e11aa[_0xb314('0x44')]['id']}})[_0xb314('0x24')](handleEntityNotFound(_0x2ef60b,null))['then'](function(_0x1c3d48){if(_0x1c3d48){_0x49f8ae[_0xb314('0x33')]=_[_0xb314('0x34')](db[_0xb314('0x58')]['rawAttributes']);_0x49f8ae[_0xb314('0x35')]=_[_0xb314('0x34')](_0x7e11aa['query']);_0x49f8ae[_0xb314('0x36')]=_[_0xb314('0x37')](_0x49f8ae['model'],_0x49f8ae[_0xb314('0x35')]);_0x27b3ea[_0xb314('0x38')]=_[_0xb314('0x37')](_0x49f8ae['model'],qs[_0xb314('0x46')](_0x7e11aa[_0xb314('0x35')][_0xb314('0x46')]));_0x27b3ea[_0xb314('0x38')]=_0x27b3ea['attributes'][_0xb314('0x39')]?_0x27b3ea['attributes']:_0x49f8ae['model'];if(!_0x7e11aa['query'][_0xb314('0x59')](_0xb314('0x3a'))){_0x27b3ea[_0xb314('0x1d')]=qs[_0xb314('0x1d')](_0x7e11aa[_0xb314('0x35')][_0xb314('0x1d')]);_0x27b3ea['offset']=qs[_0xb314('0x1b')](_0x7e11aa[_0xb314('0x35')]['offset']);}_0x27b3ea['order']=qs[_0xb314('0x3b')](_0x7e11aa[_0xb314('0x35')][_0xb314('0x3b')]);_0x27b3ea[_0xb314('0x3c')]=qs[_0xb314('0x36')](_['pick'](_0x7e11aa[_0xb314('0x35')],_0x49f8ae[_0xb314('0x36')]));_0x27b3ea[_0xb314('0x3c')][_0xb314('0x5a')]=_0x1c3d48['id'];if(_0x7e11aa[_0xb314('0x35')][_0xb314('0x3e')]){_0x27b3ea[_0xb314('0x3c')]=_['merge'](_0x27b3ea[_0xb314('0x3c')],{'$or':_[_0xb314('0x2e')](_0x27b3ea[_0xb314('0x38')],function(_0x4e2901){var _0x1d73ad={};_0x1d73ad[_0x4e2901]={'$like':'%'+_0x7e11aa[_0xb314('0x35')][_0xb314('0x3e')]+'%'};return _0x1d73ad;})});}_0x27b3ea=_['merge']({},_0x27b3ea,_0x7e11aa[_0xb314('0x3f')]);return db[_0xb314('0x58')][_0xb314('0x1e')]({'where':_0x27b3ea[_0xb314('0x3c')]})[_0xb314('0x24')](function(_0x44e104){_0x503d58['count']=_0x44e104;if(_0x7e11aa[_0xb314('0x35')]['includeAll']){_0x27b3ea[_0xb314('0x41')]=[{'all':!![]}];}return db['CmHopper'][_0xb314('0x5b')](_0x27b3ea);})['then'](function(_0x3c7802){_0x503d58[_0xb314('0x42')]=_0x3c7802;return _0x503d58;});}})[_0xb314('0x24')](respondWithFilteredResult(_0x2ef60b,_0x27b3ea))[_0xb314('0x4f')](handleError(_0x2ef60b,null));};exports[_0xb314('0x5c')]=function(_0x4e8edd,_0x106426,_0x5550e6){var _0x5baecc={'raw':!![],'where':{}};var _0x1b165b={};var _0x3962e8={'count':0x0,'rows':[]};return db['Campaign'][_0xb314('0x57')]({'where':{'id':_0x4e8edd[_0xb314('0x44')]['id']}})['then'](handleEntityNotFound(_0x106426,null))[_0xb314('0x24')](function(_0x5785a0){if(_0x5785a0){_0x1b165b[_0xb314('0x33')]=_[_0xb314('0x34')](db[_0xb314('0x5d')][_0xb314('0x45')]);_0x1b165b[_0xb314('0x35')]=_['keys'](_0x4e8edd[_0xb314('0x35')]);_0x1b165b[_0xb314('0x36')]=_['intersection'](_0x1b165b[_0xb314('0x33')],_0x1b165b[_0xb314('0x35')]);_0x5baecc[_0xb314('0x38')]=_['intersection'](_0x1b165b[_0xb314('0x33')],qs[_0xb314('0x46')](_0x4e8edd[_0xb314('0x35')][_0xb314('0x46')]));_0x5baecc['attributes']=_0x5baecc[_0xb314('0x38')][_0xb314('0x39')]?_0x5baecc['attributes']:_0x1b165b[_0xb314('0x33')];if(!_0x4e8edd[_0xb314('0x35')][_0xb314('0x59')](_0xb314('0x3a'))){_0x5baecc[_0xb314('0x1d')]=qs[_0xb314('0x1d')](_0x4e8edd['query'][_0xb314('0x1d')]);_0x5baecc[_0xb314('0x1b')]=qs['offset'](_0x4e8edd['query'][_0xb314('0x1b')]);}_0x5baecc['order']=qs[_0xb314('0x3b')](_0x4e8edd[_0xb314('0x35')]['sort']);_0x5baecc[_0xb314('0x3c')]=qs['filters'](_[_0xb314('0x3d')](_0x4e8edd[_0xb314('0x35')],_0x1b165b['filters']));_0x5baecc[_0xb314('0x3c')]['CampaignId']=_0x5785a0['id'];if(_0x4e8edd[_0xb314('0x35')][_0xb314('0x3e')]){_0x5baecc['where']=_[_0xb314('0x47')](_0x5baecc[_0xb314('0x3c')],{'$or':_[_0xb314('0x2e')](_0x5baecc[_0xb314('0x38')],function(_0x540ea3){var _0x4b139e={};_0x4b139e[_0x540ea3]={'$like':'%'+_0x4e8edd[_0xb314('0x35')][_0xb314('0x3e')]+'%'};return _0x4b139e;})});}_0x5baecc=_['merge']({},_0x5baecc,_0x4e8edd[_0xb314('0x3f')]);return db[_0xb314('0x5d')]['count']({'where':_0x5baecc[_0xb314('0x3c')]})['then'](function(_0x508402){_0x3962e8[_0xb314('0x1e')]=_0x508402;if(_0x4e8edd[_0xb314('0x35')][_0xb314('0x40')]){_0x5baecc['include']=[{'all':!![]}];}return db[_0xb314('0x5d')][_0xb314('0x5b')](_0x5baecc);})['then'](function(_0x4c7ffa){_0x3962e8[_0xb314('0x42')]=_0x4c7ffa;return _0x3962e8;});}})[_0xb314('0x24')](respondWithFilteredResult(_0x106426,_0x5baecc))['catch'](handleError(_0x106426,null));};exports[_0xb314('0x5e')]=function(_0xa49c3,_0x36bdfc,_0x36aef7){var _0x560de0={'raw':!![],'where':{}};var _0xaf6c5f={};var _0x44476d={'count':0x0,'rows':[]};return db['Campaign'][_0xb314('0x57')]({'where':{'id':_0xa49c3[_0xb314('0x44')]['id']}})[_0xb314('0x24')](handleEntityNotFound(_0x36bdfc,null))['then'](function(_0x240ff9){if(_0x240ff9){_0xaf6c5f[_0xb314('0x33')]=_[_0xb314('0x34')](db['CmHopperFinal']['rawAttributes']);_0xaf6c5f[_0xb314('0x35')]=_[_0xb314('0x34')](_0xa49c3[_0xb314('0x35')]);_0xaf6c5f['filters']=_[_0xb314('0x37')](_0xaf6c5f[_0xb314('0x33')],_0xaf6c5f[_0xb314('0x35')]);_0x560de0[_0xb314('0x38')]=_[_0xb314('0x37')](_0xaf6c5f[_0xb314('0x33')],qs['fields'](_0xa49c3[_0xb314('0x35')][_0xb314('0x46')]));_0x560de0[_0xb314('0x38')]=_0x560de0[_0xb314('0x38')]['length']?_0x560de0[_0xb314('0x38')]:_0xaf6c5f[_0xb314('0x33')];if(!_0xa49c3[_0xb314('0x35')]['hasOwnProperty'](_0xb314('0x3a'))){_0x560de0[_0xb314('0x1d')]=qs[_0xb314('0x1d')](_0xa49c3[_0xb314('0x35')]['limit']);_0x560de0[_0xb314('0x1b')]=qs[_0xb314('0x1b')](_0xa49c3['query']['offset']);}_0x560de0['order']=qs[_0xb314('0x3b')](_0xa49c3[_0xb314('0x35')][_0xb314('0x3b')]);_0x560de0[_0xb314('0x3c')]=qs[_0xb314('0x36')](_[_0xb314('0x3d')](_0xa49c3[_0xb314('0x35')],_0xaf6c5f[_0xb314('0x36')]));_0x560de0[_0xb314('0x3c')][_0xb314('0x5a')]=_0x240ff9['id'];if(_0xa49c3[_0xb314('0x35')][_0xb314('0x3e')]){_0x560de0[_0xb314('0x3c')]=_[_0xb314('0x47')](_0x560de0[_0xb314('0x3c')],{'$or':_[_0xb314('0x2e')](_0x560de0[_0xb314('0x38')],function(_0x15b775){var _0x3e7712={};_0x3e7712[_0x15b775]={'$like':'%'+_0xa49c3[_0xb314('0x35')][_0xb314('0x3e')]+'%'};return _0x3e7712;})});}_0x560de0=_[_0xb314('0x47')]({},_0x560de0,_0xa49c3[_0xb314('0x3f')]);return db[_0xb314('0x5f')][_0xb314('0x1e')]({'where':_0x560de0[_0xb314('0x3c')]})[_0xb314('0x24')](function(_0x121a67){_0x44476d[_0xb314('0x1e')]=_0x121a67;if(_0xa49c3['query']['includeAll']){_0x560de0['include']=[{'all':!![]}];}return db['CmHopperFinal'][_0xb314('0x5b')](_0x560de0);})[_0xb314('0x24')](function(_0x15e33a){_0x44476d['rows']=_0x15e33a;return _0x44476d;});}})[_0xb314('0x24')](respondWithFilteredResult(_0x36bdfc,_0x560de0))[_0xb314('0x4f')](handleError(_0x36bdfc,null));};exports[_0xb314('0x60')]=function(_0x19c764,_0x257f85,_0x2ed3cc){var _0x2e9158={'raw':!![],'where':{}};var _0x4d09e1={};var _0x19f8a7={'count':0x0,'rows':[]};return db[_0xb314('0x2f')][_0xb314('0x57')]({'where':{'id':_0x19c764['params']['id']}})[_0xb314('0x24')](handleEntityNotFound(_0x257f85,null))[_0xb314('0x24')](function(_0x2d0e8b){if(_0x2d0e8b){_0x4d09e1[_0xb314('0x33')]=_[_0xb314('0x34')](db[_0xb314('0x61')][_0xb314('0x45')]);_0x4d09e1[_0xb314('0x35')]=_['keys'](_0x19c764[_0xb314('0x35')]);_0x4d09e1[_0xb314('0x36')]=_[_0xb314('0x37')](_0x4d09e1[_0xb314('0x33')],_0x4d09e1['query']);_0x2e9158['attributes']=_[_0xb314('0x37')](_0x4d09e1['model'],qs['fields'](_0x19c764[_0xb314('0x35')]['fields']));_0x2e9158['attributes']=_0x2e9158[_0xb314('0x38')][_0xb314('0x39')]?_0x2e9158[_0xb314('0x38')]:_0x4d09e1[_0xb314('0x33')];if(!_0x19c764['query'][_0xb314('0x59')](_0xb314('0x3a'))){_0x2e9158['limit']=qs[_0xb314('0x1d')](_0x19c764[_0xb314('0x35')][_0xb314('0x1d')]);_0x2e9158['offset']=qs[_0xb314('0x1b')](_0x19c764[_0xb314('0x35')][_0xb314('0x1b')]);}_0x2e9158[_0xb314('0x62')]=qs[_0xb314('0x3b')](_0x19c764[_0xb314('0x35')]['sort']);_0x2e9158[_0xb314('0x3c')]=qs[_0xb314('0x36')](_[_0xb314('0x3d')](_0x19c764[_0xb314('0x35')],_0x4d09e1[_0xb314('0x36')]));_0x2e9158[_0xb314('0x3c')][_0xb314('0x5a')]=_0x2d0e8b['id'];if(_0x19c764[_0xb314('0x35')][_0xb314('0x3e')]){_0x2e9158[_0xb314('0x3c')]=_['merge'](_0x2e9158[_0xb314('0x3c')],{'$or':_[_0xb314('0x2e')](_0x2e9158[_0xb314('0x38')],function(_0x3266ac){var _0x3b97b5={};_0x3b97b5[_0x3266ac]={'$like':'%'+_0x19c764[_0xb314('0x35')][_0xb314('0x3e')]+'%'};return _0x3b97b5;})});}_0x2e9158=_[_0xb314('0x47')]({},_0x2e9158,_0x19c764[_0xb314('0x3f')]);return db[_0xb314('0x61')][_0xb314('0x1e')]({'where':_0x2e9158[_0xb314('0x3c')]})['then'](function(_0x1e092e){_0x19f8a7['count']=_0x1e092e;if(_0x19c764[_0xb314('0x35')][_0xb314('0x40')]){_0x2e9158['include']=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x2e9158);})[_0xb314('0x24')](function(_0x16f132){_0x19f8a7[_0xb314('0x42')]=_0x16f132;return _0x19f8a7;});}})[_0xb314('0x24')](respondWithFilteredResult(_0x257f85,_0x2e9158))[_0xb314('0x4f')](handleError(_0x257f85,null));};exports[_0xb314('0x63')]=function(_0x28a22f,_0x2b7873,_0x51f30d){var _0x5d5bcf={};var _0x54587e={};var _0x26e045;var _0x24df63;return db[_0xb314('0x2f')][_0xb314('0x57')]({'where':{'id':_0x28a22f['params']['id']}})[_0xb314('0x24')](handleEntityNotFound(_0x2b7873,null))['then'](function(_0x378122){if(_0x378122){_0x26e045=_0x378122;_0x54587e['model']=_[_0xb314('0x34')](db['CmList'][_0xb314('0x45')]);_0x54587e['query']=_[_0xb314('0x34')](_0x28a22f[_0xb314('0x35')]);_0x54587e[_0xb314('0x36')]=_[_0xb314('0x37')](_0x54587e['model'],_0x54587e['query']);_0x5d5bcf['attributes']=_[_0xb314('0x37')](_0x54587e[_0xb314('0x33')],qs[_0xb314('0x46')](_0x28a22f[_0xb314('0x35')][_0xb314('0x46')]));_0x5d5bcf[_0xb314('0x38')]=_0x5d5bcf[_0xb314('0x38')]['length']?_0x5d5bcf[_0xb314('0x38')]:_0x54587e[_0xb314('0x33')];_0x5d5bcf[_0xb314('0x62')]=qs[_0xb314('0x3b')](_0x28a22f[_0xb314('0x35')]['sort']);_0x5d5bcf[_0xb314('0x3c')]=qs['filters'](_[_0xb314('0x3d')](_0x28a22f[_0xb314('0x35')],_0x54587e[_0xb314('0x36')]));if(_0x28a22f[_0xb314('0x35')]['filter']){_0x5d5bcf[_0xb314('0x3c')]=_[_0xb314('0x47')](_0x5d5bcf[_0xb314('0x3c')],{'$or':_[_0xb314('0x2e')](_0x5d5bcf['attributes'],function(_0x3e884a){var _0x1fece0={};_0x1fece0[_0x3e884a]={'$like':'%'+_0x28a22f[_0xb314('0x35')][_0xb314('0x3e')]+'%'};return _0x1fece0;})});}_0x5d5bcf=_[_0xb314('0x47')]({},_0x5d5bcf,_0x28a22f[_0xb314('0x3f')]);return _0x26e045[_0xb314('0x63')](_0x5d5bcf);}})['then'](function(_0x1fe946){if(_0x1fe946){_0x24df63=_0x1fe946[_0xb314('0x39')];if(!_0x28a22f[_0xb314('0x35')]['hasOwnProperty'](_0xb314('0x3a'))){_0x5d5bcf[_0xb314('0x1d')]=qs[_0xb314('0x1d')](_0x28a22f[_0xb314('0x35')][_0xb314('0x1d')]);_0x5d5bcf[_0xb314('0x1b')]=qs[_0xb314('0x1b')](_0x28a22f[_0xb314('0x35')][_0xb314('0x1b')]);}return _0x26e045[_0xb314('0x63')](_0x5d5bcf);}})[_0xb314('0x24')](function(_0x265d9d){if(_0x265d9d){return _0x265d9d?{'count':_0x24df63,'rows':_0x265d9d}:null;}})[_0xb314('0x24')](respondWithResult(_0x2b7873,null))[_0xb314('0x4f')](handleError(_0x2b7873,null));};exports[_0xb314('0x64')]=function(_0x52a964,_0x5ddeb,_0x30fa8f){var _0x291a2a,_0x45bed4;return db['Campaign'][_0xb314('0x48')]({'where':{'id':_0x52a964['params']['id']}})[_0xb314('0x24')](handleEntityNotFound(_0x5ddeb,null))[_0xb314('0x24')](function(_0x5a93be){if(_0x5a93be){_0x45bed4=_0x5a93be;return _0x5a93be[_0xb314('0x64')](_0x52a964[_0xb314('0x4a')]['ids'],_[_0xb314('0x53')](_0x52a964[_0xb314('0x4a')],[_0xb314('0x65'),'id'])||{});}return null;})[_0xb314('0x66')](function(_0x3383){var _0x297b3a;_0x291a2a=_0x3383||[];var _0x21a832=[];if(_0x3383){for(var _0x2fd297=0x0;_0x2fd297<_0x3383[_0xb314('0x39')];_0x2fd297+=0x1){var _0x767d7=_0x3383[_0x2fd297][_0xb314('0x26')]({'plain':!![]});_0x45bed4[_0xb314('0x67')]=_0x52a964[_0xb314('0x4a')][_0xb314('0x67')]?_0x52a964['body'][_0xb314('0x67')]:_0x45bed4[_0xb314('0x67')];switch(_0x45bed4[_0xb314('0x67')]){case _0xb314('0x68'):_0x297b3a=squel[_0xb314('0x69')]()[_0xb314('0x6a')]('cm_hopper')['fromQuery']([_0xb314('0x6b'),_0xb314('0x6c'),'ContactId',_0xb314('0x6d'),'CampaignId',_0xb314('0x52'),'updatedAt'],squel['select']()[_0xb314('0x6e')](_0xb314('0x6b'),_0xb314('0x6b'))[_0xb314('0x6e')]('NOW()','scheduledAt')[_0xb314('0x6e')]('id',_0xb314('0x6f'))[_0xb314('0x6e')](_0x767d7[_0xb314('0x70')][_0xb314('0x71')](),_0xb314('0x6d'))[_0xb314('0x6e')](_0x52a964[_0xb314('0x44')]['id']['toString'](),_0xb314('0x5a'))[_0xb314('0x6e')](_0xb314('0x72'),_0xb314('0x52'))['field'](_0xb314('0x72'),_0xb314('0x54'))[_0xb314('0x73')]('cm_contacts')['where'](_0xb314('0x74'))['where'](_0xb314('0x75'),_0x767d7[_0xb314('0x70')][_0xb314('0x71')]())[_0xb314('0x3c')]('phone\x20IS\x20NOT\x20NULL')[_0xb314('0x3c')](_0xb314('0x76'),squel[_0xb314('0x77')]()['field'](_0xb314('0x78'))[_0xb314('0x73')](_0xb314('0x79'))[_0xb314('0x3c')]('CampaignId\x20=\x20?',_0x52a964[_0xb314('0x44')]['id'][_0xb314('0x71')]()))['where'](_0xb314('0x76'),squel['select']()['field'](_0xb314('0x7a'))[_0xb314('0x73')](_0xb314('0x7b'))[_0xb314('0x3c')](_0xb314('0x7c'),_0x52a964['params']['id']['toString']())))['toString']();break;case _0xb314('0x7d'):_0x297b3a=squel[_0xb314('0x69')]()[_0xb314('0x6a')](_0xb314('0x7b'))[_0xb314('0x7e')]([_0xb314('0x6b'),_0xb314('0x6c'),_0xb314('0x6f'),_0xb314('0x6d'),_0xb314('0x5a'),_0xb314('0x52'),'updatedAt'],squel['select']()['field']('phone','phone')[_0xb314('0x6e')](_0xb314('0x72'),_0xb314('0x6c'))[_0xb314('0x6e')]('id',_0xb314('0x6f'))[_0xb314('0x6e')](_0x767d7[_0xb314('0x70')][_0xb314('0x71')](),_0xb314('0x6d'))[_0xb314('0x6e')](_0x52a964[_0xb314('0x44')]['id'][_0xb314('0x71')](),_0xb314('0x5a'))[_0xb314('0x6e')]('NOW()',_0xb314('0x52'))[_0xb314('0x6e')](_0xb314('0x72'),_0xb314('0x54'))['from'](_0xb314('0x7f'))['where'](_0xb314('0x74'))[_0xb314('0x3c')](_0xb314('0x75'),_0x767d7[_0xb314('0x70')][_0xb314('0x71')]())[_0xb314('0x3c')](_0xb314('0x80'))[_0xb314('0x3c')](_0xb314('0x76'),squel[_0xb314('0x77')]()[_0xb314('0x6e')](_0xb314('0x7a'))[_0xb314('0x73')]('cm_hopper')[_0xb314('0x3c')](_0xb314('0x7c'),_0x52a964[_0xb314('0x44')]['id'][_0xb314('0x71')]())))[_0xb314('0x71')]();break;default:_0x297b3a=squel[_0xb314('0x69')]()['into'](_0xb314('0x7b'))['fromQuery'](['phone',_0xb314('0x6c'),_0xb314('0x6f'),_0xb314('0x6d'),_0xb314('0x5a'),'createdAt',_0xb314('0x54')],squel[_0xb314('0x77')]()['field'](_0xb314('0x6b'),_0xb314('0x6b'))['field'](_0xb314('0x72'),'scheduledAt')[_0xb314('0x6e')]('id',_0xb314('0x6f'))['field'](_0x767d7['CmListId']['toString'](),'ListId')[_0xb314('0x6e')](_0x52a964[_0xb314('0x44')]['id'][_0xb314('0x71')](),'CampaignId')[_0xb314('0x6e')]('NOW()',_0xb314('0x52'))[_0xb314('0x6e')]('NOW()',_0xb314('0x54'))[_0xb314('0x73')](_0xb314('0x7f'))[_0xb314('0x3c')]('deletedAt\x20IS\x20NULL')[_0xb314('0x3c')](_0xb314('0x75'),_0x767d7[_0xb314('0x70')][_0xb314('0x71')]())[_0xb314('0x3c')]('phone\x20IS\x20NOT\x20NULL'))[_0xb314('0x71')]();}_0x21a832['push'](db[_0xb314('0x81')][_0xb314('0x35')](_0x297b3a));}return BPromise[_0xb314('0x82')](_0x21a832);}})[_0xb314('0x24')](function(){return _0x291a2a;})['then'](respondWithResult(_0x5ddeb,null))[_0xb314('0x4f')](handleError(_0x5ddeb,null));};exports['removeLists']=function(_0x469604,_0x495288,_0x5ecb98){return db[_0xb314('0x2f')][_0xb314('0x48')]({'where':{'id':_0x469604[_0xb314('0x44')]['id']}})[_0xb314('0x24')](handleEntityNotFound(_0x495288,null))['then'](function(_0x90af6b){if(_0x90af6b){return _0x90af6b[_0xb314('0x83')](_0x469604[_0xb314('0x35')][_0xb314('0x65')]);}})[_0xb314('0x24')](function(_0x4c091d){if(_0x4c091d){return db['CmHopper'][_0xb314('0x25')]({'where':{'ListId':_0x469604['query'][_0xb314('0x65')],'CampaignId':_0x469604[_0xb314('0x44')]['id']}})['then'](function(){return _0x4c091d;});}})['then'](respondWithStatusCode(_0x495288,null))['catch'](handleError(_0x495288,null));};exports[_0xb314('0x84')]=function(_0xd07fd4,_0x2f19f3,_0x469fd6){var _0x9563bb={};var _0x45be54={};var _0x5c171f;var _0x3ee97e;return db[_0xb314('0x2f')][_0xb314('0x57')]({'where':{'id':_0xd07fd4[_0xb314('0x44')]['id']}})[_0xb314('0x24')](handleEntityNotFound(_0x2f19f3,null))[_0xb314('0x24')](function(_0xfd47ad){if(_0xfd47ad){_0x5c171f=_0xfd47ad;_0x45be54[_0xb314('0x33')]=_[_0xb314('0x34')](db[_0xb314('0x85')][_0xb314('0x45')]);_0x45be54[_0xb314('0x35')]=_[_0xb314('0x34')](_0xd07fd4[_0xb314('0x35')]);_0x45be54[_0xb314('0x36')]=_[_0xb314('0x37')](_0x45be54[_0xb314('0x33')],_0x45be54[_0xb314('0x35')]);_0x9563bb[_0xb314('0x38')]=_[_0xb314('0x37')](_0x45be54[_0xb314('0x33')],qs[_0xb314('0x46')](_0xd07fd4[_0xb314('0x35')][_0xb314('0x46')]));_0x9563bb[_0xb314('0x38')]=_0x9563bb[_0xb314('0x38')][_0xb314('0x39')]?_0x9563bb[_0xb314('0x38')]:_0x45be54[_0xb314('0x33')];_0x9563bb['order']=qs[_0xb314('0x3b')](_0xd07fd4[_0xb314('0x35')][_0xb314('0x3b')]);_0x9563bb[_0xb314('0x3c')]=qs['filters'](_[_0xb314('0x3d')](_0xd07fd4[_0xb314('0x35')],_0x45be54[_0xb314('0x36')]));if(_0xd07fd4[_0xb314('0x35')][_0xb314('0x3e')]){_0x9563bb[_0xb314('0x3c')]=_[_0xb314('0x47')](_0x9563bb['where'],{'$or':_[_0xb314('0x2e')](_0x9563bb['attributes'],function(_0x1b24d7){var _0x4be784={};_0x4be784[_0x1b24d7]={'$like':'%'+_0xd07fd4[_0xb314('0x35')][_0xb314('0x3e')]+'%'};return _0x4be784;})});}_0x9563bb=_['merge']({},_0x9563bb,_0xd07fd4['options']);return _0x5c171f['getBlackLists'](_0x9563bb);}})['then'](function(_0x24e298){if(_0x24e298){_0x3ee97e=_0x24e298['length'];if(!_0xd07fd4[_0xb314('0x35')][_0xb314('0x59')](_0xb314('0x3a'))){_0x9563bb[_0xb314('0x1d')]=qs[_0xb314('0x1d')](_0xd07fd4[_0xb314('0x35')]['limit']);_0x9563bb['offset']=qs[_0xb314('0x1b')](_0xd07fd4['query'][_0xb314('0x1b')]);}return _0x5c171f['getBlackLists'](_0x9563bb);}})['then'](function(_0x248226){if(_0x248226){return _0x248226?{'count':_0x3ee97e,'rows':_0x248226}:null;}})[_0xb314('0x24')](respondWithResult(_0x2f19f3,null))['catch'](handleError(_0x2f19f3,null));};exports[_0xb314('0x86')]=function(_0x44c85e,_0xf476ce,_0x5f4646){var _0x158b42,_0x3cd32e;return db[_0xb314('0x2f')][_0xb314('0x48')]({'where':{'id':_0x44c85e[_0xb314('0x44')]['id']}})[_0xb314('0x24')](handleEntityNotFound(_0xf476ce,null))[_0xb314('0x24')](function(_0x2e2fca){if(_0x2e2fca){_0x3cd32e=_0x2e2fca;return _0x2e2fca[_0xb314('0x86')](_0x44c85e[_0xb314('0x4a')][_0xb314('0x65')],_[_0xb314('0x53')](_0x44c85e[_0xb314('0x4a')],['ids','id'])||{});}return null;})[_0xb314('0x66')](function(_0x1b9e61){var _0x520d84;_0x158b42=_0x1b9e61||[];var _0x341c96=[];if(_0x1b9e61){for(var _0x5da7a3=0x0;_0x5da7a3<_0x1b9e61[_0xb314('0x39')];_0x5da7a3+=0x1){var _0x3e021a=_0x1b9e61[_0x5da7a3][_0xb314('0x26')]({'plain':!![]});_0x520d84=squel[_0xb314('0x69')]()[_0xb314('0x6a')](_0xb314('0x87'))[_0xb314('0x7e')]([_0xb314('0x6b'),_0xb314('0x6f'),'ListId',_0xb314('0x5a'),'createdAt',_0xb314('0x54')],squel['select']()[_0xb314('0x6e')]('phone',_0xb314('0x6b'))[_0xb314('0x6e')]('id','ContactId')[_0xb314('0x6e')](_0x3e021a[_0xb314('0x70')][_0xb314('0x71')](),_0xb314('0x6d'))['field'](_0x44c85e[_0xb314('0x44')]['id'][_0xb314('0x71')](),_0xb314('0x5a'))[_0xb314('0x6e')]('NOW()','createdAt')[_0xb314('0x6e')](_0xb314('0x72'),'updatedAt')[_0xb314('0x73')]('cm_contacts')['where'](_0xb314('0x74'))[_0xb314('0x3c')](_0xb314('0x75'),_0x3e021a['CmListId'][_0xb314('0x71')]())['where'](_0xb314('0x80')))[_0xb314('0x71')]();_0x341c96[_0xb314('0x88')](db['sequelize']['query'](_0x520d84));}return BPromise[_0xb314('0x82')](_0x341c96);}})[_0xb314('0x24')](function(){return _0x158b42;})[_0xb314('0x24')](respondWithResult(_0xf476ce,null))[_0xb314('0x4f')](handleError(_0xf476ce,null));};exports[_0xb314('0x89')]=function(_0x5d4421,_0x411e5e,_0x24f186){return db[_0xb314('0x2f')][_0xb314('0x48')]({'where':{'id':_0x5d4421[_0xb314('0x44')]['id']}})[_0xb314('0x24')](handleEntityNotFound(_0x411e5e,null))[_0xb314('0x24')](function(_0x20ca3b){if(_0x20ca3b){return _0x20ca3b['removeBlackLists'](_0x5d4421[_0xb314('0x35')]['ids']);}})[_0xb314('0x24')](function(_0x817002){if(_0x817002){return db[_0xb314('0x61')]['destroy']({'where':{'ListId':_0x5d4421['query'][_0xb314('0x65')],'CampaignId':_0x5d4421[_0xb314('0x44')]['id']}})[_0xb314('0x24')](function(){return _0x817002;});}})[_0xb314('0x24')](respondWithStatusCode(_0x411e5e,null))['catch'](handleError(_0x411e5e,null));}; \ No newline at end of file +var _0x43b3=['merge','includeAll','include','findAll','rows','show','params','intersection','options','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','body','createdAt','getHoppers','findOne','hasOwnProperty','CampaignId','CmHopper','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperBlack','getLists','addLists','ids','spread','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','from','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','push','sequelize','all','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','offset','limit','undefined','count','status','set','apply','reject','update','then','destroy','get','IvrCampaigns','UserProfileResource','error','stack','name','send','index','map','Campaign','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL'];(function(_0x194808,_0x2bf290){var _0x3998e1=function(_0x5e13d9){while(--_0x5e13d9){_0x194808['push'](_0x194808['shift']());}};_0x3998e1(++_0x2bf290);}(_0x43b3,0xce));var _0x343b=function(_0x8a1e69,_0x50a21d){_0x8a1e69=_0x8a1e69-0x0;var _0x1b789f=_0x43b3[_0x8a1e69];return _0x1b789f;};'use strict';var emlformat=require(_0x343b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x343b('0x1'));var jsonpatch=require(_0x343b('0x2'));var rp=require(_0x343b('0x3'));var moment=require(_0x343b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x343b('0x5'));var util=require(_0x343b('0x6'));var path=require(_0x343b('0x7'));var sox=require(_0x343b('0x8'));var csv=require('to-csv');var ejs=require(_0x343b('0x9'));var fs=require('fs');var fs_extra=require(_0x343b('0xa'));var _=require(_0x343b('0xb'));var squel=require(_0x343b('0xc'));var crypto=require(_0x343b('0xd'));var jsforce=require(_0x343b('0xe'));var deskjs=require(_0x343b('0xf'));var toCsv=require(_0x343b('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x343b('0x11'));var as=require(_0x343b('0x12'));var hardwareService=require(_0x343b('0x13'));var logger=require('../../config/logger')(_0x343b('0x14'));var utils=require(_0x343b('0x15'));var config=require(_0x343b('0x16'));var licenseUtil=require(_0x343b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d452b,_0x5bad24){_0x5bad24=_0x5bad24||0xcc;return function(_0x1aab74){if(_0x1aab74){return _0x3d452b[_0x343b('0x18')](_0x5bad24);}return _0x3d452b['status'](_0x5bad24)[_0x343b('0x19')]();};}function respondWithResult(_0x499bc5,_0x5afe48){_0x5afe48=_0x5afe48||0xc8;return function(_0x422052){if(_0x422052){return _0x499bc5['status'](_0x5afe48)[_0x343b('0x1a')](_0x422052);}};}function respondWithFilteredResult(_0x160a6d,_0x48ef83){return function(_0x4ad59e){if(_0x4ad59e){var _0x3d06ce=typeof _0x48ef83[_0x343b('0x1b')]==='undefined'&&typeof _0x48ef83[_0x343b('0x1c')]===_0x343b('0x1d');var _0x2f6efe=_0x4ad59e[_0x343b('0x1e')];var _0x275260=_0x3d06ce?0x0:_0x48ef83[_0x343b('0x1b')];var _0x161c60=_0x3d06ce?_0x4ad59e[_0x343b('0x1e')]:_0x48ef83['offset']+_0x48ef83[_0x343b('0x1c')];var _0x4aba69;if(_0x161c60>=_0x2f6efe){_0x161c60=_0x2f6efe;_0x4aba69=0xc8;}else{_0x4aba69=0xce;}_0x160a6d[_0x343b('0x1f')](_0x4aba69);return _0x160a6d[_0x343b('0x20')]('Content-Range',_0x275260+'-'+_0x161c60+'/'+_0x2f6efe)[_0x343b('0x1a')](_0x4ad59e);}return null;};}function patchUpdates(_0x31bd60){return function(_0x536dbe){try{jsonpatch[_0x343b('0x21')](_0x536dbe,_0x31bd60,!![]);}catch(_0x421411){return BPromise[_0x343b('0x22')](_0x421411);}return _0x536dbe['save']();};}function saveUpdates(_0x767a5a,_0x5a39a0){return function(_0x50a18f){if(_0x50a18f){return _0x50a18f[_0x343b('0x23')](_0x767a5a)[_0x343b('0x24')](function(_0x3a176a){return _0x3a176a;});}return null;};}function removeEntity(_0x2e50e2,_0x2f4d31){return function(_0x479d98){if(_0x479d98){return _0x479d98[_0x343b('0x25')]()[_0x343b('0x24')](function(){var _0x348d15=_0x479d98[_0x343b('0x26')]({'plain':!![]});var _0x512d38=_0x343b('0x27');return db[_0x343b('0x28')][_0x343b('0x25')]({'where':{'type':_0x512d38,'resourceId':_0x348d15['id']}})[_0x343b('0x24')](function(){return _0x479d98;});})['then'](function(){_0x2e50e2[_0x343b('0x1f')](0xcc)[_0x343b('0x19')]();});}};}function handleEntityNotFound(_0x48cfa5,_0x191cd5){return function(_0x1f134c){if(!_0x1f134c){_0x48cfa5[_0x343b('0x18')](0x194);}return _0x1f134c;};}function handleError(_0x469285,_0x15bc7f){_0x15bc7f=_0x15bc7f||0x1f4;return function(_0x5b76d6){logger[_0x343b('0x29')](_0x5b76d6[_0x343b('0x2a')]);if(_0x5b76d6[_0x343b('0x2b')]){delete _0x5b76d6[_0x343b('0x2b')];}_0x469285[_0x343b('0x1f')](_0x15bc7f)[_0x343b('0x2c')](_0x5b76d6);};}exports[_0x343b('0x2d')]=function(_0x4282a8,_0x177e71){var _0x101f26={},_0x104006={},_0x3e5e32={'count':0x0,'rows':[]};var _0x1105ba=_[_0x343b('0x2e')](db[_0x343b('0x2f')][_0x343b('0x30')],function(_0x299cc3){return{'name':_0x299cc3[_0x343b('0x31')],'type':_0x299cc3[_0x343b('0x32')][_0x343b('0x33')]};});_0x104006[_0x343b('0x34')]=_['map'](_0x1105ba,_0x343b('0x2b'));_0x104006[_0x343b('0x35')]=_[_0x343b('0x36')](_0x4282a8[_0x343b('0x35')]);_0x104006[_0x343b('0x37')]=_['intersection'](_0x104006[_0x343b('0x34')],_0x104006[_0x343b('0x35')]);_0x101f26[_0x343b('0x38')]=_['intersection'](_0x104006[_0x343b('0x34')],qs[_0x343b('0x39')](_0x4282a8['query'][_0x343b('0x39')]));_0x101f26['attributes']=_0x101f26['attributes'][_0x343b('0x3a')]?_0x101f26['attributes']:_0x104006[_0x343b('0x34')];if(!_0x4282a8[_0x343b('0x35')]['hasOwnProperty'](_0x343b('0x3b'))){_0x101f26[_0x343b('0x1c')]=qs['limit'](_0x4282a8[_0x343b('0x35')][_0x343b('0x1c')]);_0x101f26[_0x343b('0x1b')]=qs[_0x343b('0x1b')](_0x4282a8[_0x343b('0x35')][_0x343b('0x1b')]);}_0x101f26[_0x343b('0x3c')]=qs[_0x343b('0x3d')](_0x4282a8[_0x343b('0x35')]['sort']);_0x101f26[_0x343b('0x3e')]=qs[_0x343b('0x37')](_[_0x343b('0x3f')](_0x4282a8[_0x343b('0x35')],_0x104006[_0x343b('0x37')]),_0x1105ba);if(_0x4282a8['query'][_0x343b('0x40')]){_0x101f26['where']=_['merge'](_0x101f26[_0x343b('0x3e')],{'$or':_[_0x343b('0x2e')](_0x1105ba,function(_0x4f7489){if(_0x4f7489[_0x343b('0x32')]!==_0x343b('0x41')){var _0x4f275f={};_0x4f275f[_0x4f7489[_0x343b('0x2b')]]={'$like':'%'+_0x4282a8[_0x343b('0x35')][_0x343b('0x40')]+'%'};return _0x4f275f;}})});}_0x101f26=_[_0x343b('0x42')]({},_0x101f26,_0x4282a8['options']);var _0xd6f55e={'where':_0x101f26[_0x343b('0x3e')]};return db['Campaign']['count'](_0xd6f55e)['then'](function(_0x18777a){_0x3e5e32[_0x343b('0x1e')]=_0x18777a;if(_0x4282a8[_0x343b('0x35')][_0x343b('0x43')]){_0x101f26[_0x343b('0x44')]=[{'all':!![]}];}return db[_0x343b('0x2f')][_0x343b('0x45')](_0x101f26);})['then'](function(_0x5b79f8){_0x3e5e32[_0x343b('0x46')]=_0x5b79f8;return _0x3e5e32;})['then'](respondWithFilteredResult(_0x177e71,_0x101f26))['catch'](handleError(_0x177e71,null));};exports[_0x343b('0x47')]=function(_0x6c8611,_0x55fcbc){var _0x53f576={'raw':![],'where':{'id':_0x6c8611[_0x343b('0x48')]['id']}},_0x5f5186={};_0x5f5186[_0x343b('0x34')]=_[_0x343b('0x36')](db[_0x343b('0x2f')][_0x343b('0x30')]);_0x5f5186[_0x343b('0x35')]=_[_0x343b('0x36')](_0x6c8611[_0x343b('0x35')]);_0x5f5186[_0x343b('0x37')]=_[_0x343b('0x49')](_0x5f5186[_0x343b('0x34')],_0x5f5186[_0x343b('0x35')]);_0x53f576[_0x343b('0x38')]=_['intersection'](_0x5f5186[_0x343b('0x34')],qs[_0x343b('0x39')](_0x6c8611[_0x343b('0x35')]['fields']));_0x53f576[_0x343b('0x38')]=_0x53f576[_0x343b('0x38')][_0x343b('0x3a')]?_0x53f576[_0x343b('0x38')]:_0x5f5186[_0x343b('0x34')];if(_0x6c8611[_0x343b('0x35')]['includeAll']){_0x53f576[_0x343b('0x44')]=[{'all':!![]}];}_0x53f576=_['merge']({},_0x53f576,_0x6c8611[_0x343b('0x4a')]);return db[_0x343b('0x2f')]['find'](_0x53f576)['then'](handleEntityNotFound(_0x55fcbc,null))[_0x343b('0x24')](respondWithResult(_0x55fcbc,null))[_0x343b('0x4b')](handleError(_0x55fcbc,null));};exports[_0x343b('0x4c')]=function(_0x3cbf48,_0xa8814e){return db[_0x343b('0x2f')][_0x343b('0x4c')](_0x3cbf48['body'],{})[_0x343b('0x24')](function(_0x2646e8){var _0x1d6ee3=_0x3cbf48[_0x343b('0x4d')][_0x343b('0x26')]({'plain':!![]});if(!_0x1d6ee3)throw new Error(_0x343b('0x4e'));if(_0x1d6ee3[_0x343b('0x4f')]===_0x343b('0x4d')){var _0x4ac884=_0x2646e8[_0x343b('0x26')]({'plain':!![]});var _0x576b0a=_0x343b('0x27');return db[_0x343b('0x50')][_0x343b('0x51')]({'where':{'name':_0x576b0a,'userProfileId':_0x1d6ee3[_0x343b('0x52')]},'raw':!![]})[_0x343b('0x24')](function(_0x362247){if(_0x362247&&_0x362247[_0x343b('0x53')]===0x0){return db[_0x343b('0x28')][_0x343b('0x4c')]({'name':_0x4ac884[_0x343b('0x2b')],'resourceId':_0x4ac884['id'],'type':_0x362247[_0x343b('0x2b')],'sectionId':_0x362247['id']},{})[_0x343b('0x24')](function(){return _0x2646e8;});}else{return _0x2646e8;}})['catch'](function(_0x5a19e4){logger[_0x343b('0x29')](_0x343b('0x54'),_0x5a19e4);throw _0x5a19e4;});}return _0x2646e8;})[_0x343b('0x24')](respondWithResult(_0xa8814e,0xc9))[_0x343b('0x4b')](handleError(_0xa8814e,null));};exports[_0x343b('0x55')]=function(_0x3905bb,_0x1c138c){var _0x22a4c6={'where':{'id':_0x3905bb[_0x343b('0x48')]['id']}},_0x8b5bb6={};_0x8b5bb6[_0x343b('0x34')]=_[_0x343b('0x36')](db[_0x343b('0x2f')][_0x343b('0x30')]);_0x22a4c6['attributes']=_[_0x343b('0x49')](_0x8b5bb6['model'],qs[_0x343b('0x39')](_0x3905bb[_0x343b('0x35')][_0x343b('0x39')]));_0x22a4c6[_0x343b('0x38')]=_0x22a4c6[_0x343b('0x38')][_0x343b('0x3a')]?_0x22a4c6['attributes']:_0x8b5bb6[_0x343b('0x34')];if(_0x3905bb['query']['includeAll']){_0x22a4c6[_0x343b('0x44')]=[{'all':!![]}];}_0x22a4c6=_[_0x343b('0x42')]({},_0x22a4c6,_0x3905bb['options']);return db[_0x343b('0x2f')][_0x343b('0x51')](_0x22a4c6)[_0x343b('0x24')](handleEntityNotFound(_0x1c138c,null))[_0x343b('0x24')](function(_0x471db7){if(_0x471db7){var _0x5a918e=_0x471db7[_0x343b('0x26')]({'plain':!![]});_0x5a918e=qs[_0x343b('0x56')](_0x5a918e,['id','createdAt',_0x343b('0x57')]);_0x3905bb[_0x343b('0x58')]=_[_0x343b('0x56')](_0x3905bb[_0x343b('0x58')],['id',_0x343b('0x59'),_0x343b('0x57')]);return db[_0x343b('0x2f')][_0x343b('0x4c')](_[_0x343b('0x42')](_0x5a918e,_0x3905bb['body']),{'include':_0x3905bb[_0x343b('0x35')][_0x343b('0x43')]?[{'all':!![]}]:undefined})[_0x343b('0x24')](function(_0x2aeb00){var _0x50066a=_0x3905bb[_0x343b('0x4d')][_0x343b('0x26')]({'plain':!![]});if(!_0x50066a)throw new Error(_0x343b('0x4e'));if(_0x50066a[_0x343b('0x4f')]==='user'){var _0x172052=_0x2aeb00[_0x343b('0x26')]({'plain':!![]});var _0x243e5e=_0x343b('0x27');return db[_0x343b('0x50')][_0x343b('0x51')]({'where':{'name':_0x243e5e,'userProfileId':_0x50066a[_0x343b('0x52')]},'raw':!![]})['then'](function(_0x2372fc){if(_0x2372fc&&_0x2372fc[_0x343b('0x53')]===0x0){return db[_0x343b('0x28')][_0x343b('0x4c')]({'name':_0x172052[_0x343b('0x2b')],'resourceId':_0x172052['id'],'type':_0x2372fc['name'],'sectionId':_0x2372fc['id']},{})[_0x343b('0x24')](function(){return _0x2aeb00;});}else{return _0x2aeb00;}})[_0x343b('0x4b')](function(_0x184fa9){logger[_0x343b('0x29')](_0x343b('0x54'),_0x184fa9);throw _0x184fa9;});}return _0x2aeb00;});}})[_0x343b('0x24')](respondWithResult(_0x1c138c,0xc9))[_0x343b('0x4b')](handleError(_0x1c138c,null));};exports[_0x343b('0x23')]=function(_0x1873ed,_0x29fcd4){if(_0x1873ed[_0x343b('0x58')]['id']){delete _0x1873ed[_0x343b('0x58')]['id'];}return db[_0x343b('0x2f')][_0x343b('0x51')]({'where':{'id':_0x1873ed[_0x343b('0x48')]['id']}})[_0x343b('0x24')](handleEntityNotFound(_0x29fcd4,null))[_0x343b('0x24')](saveUpdates(_0x1873ed[_0x343b('0x58')],null))[_0x343b('0x24')](respondWithResult(_0x29fcd4,null))[_0x343b('0x4b')](handleError(_0x29fcd4,null));};exports[_0x343b('0x25')]=function(_0x3d4d35,_0x18d701){return db['Campaign'][_0x343b('0x51')]({'where':{'id':_0x3d4d35['params']['id']}})[_0x343b('0x24')](handleEntityNotFound(_0x18d701,null))[_0x343b('0x24')](removeEntity(_0x18d701,null))[_0x343b('0x4b')](handleError(_0x18d701,null));};exports[_0x343b('0x5a')]=function(_0x135ee2,_0x442e96,_0x264784){var _0x242404={'raw':!![],'where':{}};var _0x4b8882={};var _0x3dabf8={'count':0x0,'rows':[]};return db['Campaign'][_0x343b('0x5b')]({'where':{'id':_0x135ee2[_0x343b('0x48')]['id']}})['then'](handleEntityNotFound(_0x442e96,null))[_0x343b('0x24')](function(_0x5b13b8){if(_0x5b13b8){_0x4b8882[_0x343b('0x34')]=_[_0x343b('0x36')](db['CmHopper']['rawAttributes']);_0x4b8882[_0x343b('0x35')]=_['keys'](_0x135ee2[_0x343b('0x35')]);_0x4b8882['filters']=_[_0x343b('0x49')](_0x4b8882[_0x343b('0x34')],_0x4b8882[_0x343b('0x35')]);_0x242404[_0x343b('0x38')]=_['intersection'](_0x4b8882[_0x343b('0x34')],qs['fields'](_0x135ee2[_0x343b('0x35')]['fields']));_0x242404['attributes']=_0x242404['attributes'][_0x343b('0x3a')]?_0x242404[_0x343b('0x38')]:_0x4b8882[_0x343b('0x34')];if(!_0x135ee2[_0x343b('0x35')][_0x343b('0x5c')](_0x343b('0x3b'))){_0x242404[_0x343b('0x1c')]=qs['limit'](_0x135ee2['query'][_0x343b('0x1c')]);_0x242404[_0x343b('0x1b')]=qs[_0x343b('0x1b')](_0x135ee2[_0x343b('0x35')][_0x343b('0x1b')]);}_0x242404[_0x343b('0x3c')]=qs[_0x343b('0x3d')](_0x135ee2[_0x343b('0x35')]['sort']);_0x242404[_0x343b('0x3e')]=qs['filters'](_[_0x343b('0x3f')](_0x135ee2[_0x343b('0x35')],_0x4b8882[_0x343b('0x37')]));_0x242404[_0x343b('0x3e')][_0x343b('0x5d')]=_0x5b13b8['id'];if(_0x135ee2[_0x343b('0x35')][_0x343b('0x40')]){_0x242404[_0x343b('0x3e')]=_['merge'](_0x242404['where'],{'$or':_[_0x343b('0x2e')](_0x242404[_0x343b('0x38')],function(_0x2329b0){var _0x48cbca={};_0x48cbca[_0x2329b0]={'$like':'%'+_0x135ee2[_0x343b('0x35')][_0x343b('0x40')]+'%'};return _0x48cbca;})});}_0x242404=_['merge']({},_0x242404,_0x135ee2['options']);return db['CmHopper']['count']({'where':_0x242404[_0x343b('0x3e')]})['then'](function(_0x1cb2ca){_0x3dabf8[_0x343b('0x1e')]=_0x1cb2ca;if(_0x135ee2[_0x343b('0x35')]['includeAll']){_0x242404['include']=[{'all':!![]}];}return db[_0x343b('0x5e')][_0x343b('0x45')](_0x242404);})[_0x343b('0x24')](function(_0xf5f6){_0x3dabf8['rows']=_0xf5f6;return _0x3dabf8;});}})['then'](respondWithFilteredResult(_0x442e96,_0x242404))['catch'](handleError(_0x442e96,null));};exports[_0x343b('0x5f')]=function(_0x4a084f,_0x385aa2,_0x57122e){var _0x13abe8={'raw':!![],'where':{}};var _0x18db8e={};var _0x4113f7={'count':0x0,'rows':[]};return db[_0x343b('0x2f')][_0x343b('0x5b')]({'where':{'id':_0x4a084f[_0x343b('0x48')]['id']}})['then'](handleEntityNotFound(_0x385aa2,null))[_0x343b('0x24')](function(_0x536126){if(_0x536126){_0x18db8e[_0x343b('0x34')]=_['keys'](db['CmHopperHistory'][_0x343b('0x30')]);_0x18db8e[_0x343b('0x35')]=_[_0x343b('0x36')](_0x4a084f[_0x343b('0x35')]);_0x18db8e[_0x343b('0x37')]=_['intersection'](_0x18db8e[_0x343b('0x34')],_0x18db8e[_0x343b('0x35')]);_0x13abe8[_0x343b('0x38')]=_[_0x343b('0x49')](_0x18db8e[_0x343b('0x34')],qs['fields'](_0x4a084f[_0x343b('0x35')][_0x343b('0x39')]));_0x13abe8[_0x343b('0x38')]=_0x13abe8['attributes'][_0x343b('0x3a')]?_0x13abe8[_0x343b('0x38')]:_0x18db8e[_0x343b('0x34')];if(!_0x4a084f[_0x343b('0x35')]['hasOwnProperty'](_0x343b('0x3b'))){_0x13abe8[_0x343b('0x1c')]=qs['limit'](_0x4a084f[_0x343b('0x35')][_0x343b('0x1c')]);_0x13abe8[_0x343b('0x1b')]=qs[_0x343b('0x1b')](_0x4a084f['query'][_0x343b('0x1b')]);}_0x13abe8[_0x343b('0x3c')]=qs[_0x343b('0x3d')](_0x4a084f[_0x343b('0x35')]['sort']);_0x13abe8[_0x343b('0x3e')]=qs[_0x343b('0x37')](_[_0x343b('0x3f')](_0x4a084f[_0x343b('0x35')],_0x18db8e[_0x343b('0x37')]));_0x13abe8[_0x343b('0x3e')]['CampaignId']=_0x536126['id'];if(_0x4a084f[_0x343b('0x35')]['filter']){_0x13abe8[_0x343b('0x3e')]=_[_0x343b('0x42')](_0x13abe8[_0x343b('0x3e')],{'$or':_[_0x343b('0x2e')](_0x13abe8[_0x343b('0x38')],function(_0x12250f){var _0x48dab4={};_0x48dab4[_0x12250f]={'$like':'%'+_0x4a084f['query'][_0x343b('0x40')]+'%'};return _0x48dab4;})});}_0x13abe8=_[_0x343b('0x42')]({},_0x13abe8,_0x4a084f[_0x343b('0x4a')]);return db[_0x343b('0x60')][_0x343b('0x1e')]({'where':_0x13abe8[_0x343b('0x3e')]})[_0x343b('0x24')](function(_0x3455bc){_0x4113f7['count']=_0x3455bc;if(_0x4a084f['query'][_0x343b('0x43')]){_0x13abe8[_0x343b('0x44')]=[{'all':!![]}];}return db[_0x343b('0x60')]['findAll'](_0x13abe8);})[_0x343b('0x24')](function(_0x2583a8){_0x4113f7[_0x343b('0x46')]=_0x2583a8;return _0x4113f7;});}})[_0x343b('0x24')](respondWithFilteredResult(_0x385aa2,_0x13abe8))[_0x343b('0x4b')](handleError(_0x385aa2,null));};exports[_0x343b('0x61')]=function(_0x355a78,_0x1cb0f3,_0x45a7f9){var _0x13e299={'raw':!![],'where':{}};var _0x1c4e19={};var _0x7ac74b={'count':0x0,'rows':[]};return db['Campaign'][_0x343b('0x5b')]({'where':{'id':_0x355a78['params']['id']}})[_0x343b('0x24')](handleEntityNotFound(_0x1cb0f3,null))['then'](function(_0x20354e){if(_0x20354e){_0x1c4e19[_0x343b('0x34')]=_[_0x343b('0x36')](db['CmHopperFinal'][_0x343b('0x30')]);_0x1c4e19[_0x343b('0x35')]=_[_0x343b('0x36')](_0x355a78[_0x343b('0x35')]);_0x1c4e19[_0x343b('0x37')]=_[_0x343b('0x49')](_0x1c4e19[_0x343b('0x34')],_0x1c4e19['query']);_0x13e299[_0x343b('0x38')]=_[_0x343b('0x49')](_0x1c4e19['model'],qs[_0x343b('0x39')](_0x355a78[_0x343b('0x35')][_0x343b('0x39')]));_0x13e299['attributes']=_0x13e299[_0x343b('0x38')][_0x343b('0x3a')]?_0x13e299['attributes']:_0x1c4e19[_0x343b('0x34')];if(!_0x355a78[_0x343b('0x35')][_0x343b('0x5c')](_0x343b('0x3b'))){_0x13e299[_0x343b('0x1c')]=qs[_0x343b('0x1c')](_0x355a78[_0x343b('0x35')][_0x343b('0x1c')]);_0x13e299[_0x343b('0x1b')]=qs[_0x343b('0x1b')](_0x355a78[_0x343b('0x35')][_0x343b('0x1b')]);}_0x13e299[_0x343b('0x3c')]=qs['sort'](_0x355a78[_0x343b('0x35')][_0x343b('0x3d')]);_0x13e299[_0x343b('0x3e')]=qs[_0x343b('0x37')](_[_0x343b('0x3f')](_0x355a78[_0x343b('0x35')],_0x1c4e19[_0x343b('0x37')]));_0x13e299[_0x343b('0x3e')][_0x343b('0x5d')]=_0x20354e['id'];if(_0x355a78[_0x343b('0x35')][_0x343b('0x40')]){_0x13e299[_0x343b('0x3e')]=_[_0x343b('0x42')](_0x13e299[_0x343b('0x3e')],{'$or':_[_0x343b('0x2e')](_0x13e299[_0x343b('0x38')],function(_0x46f7d6){var _0x283400={};_0x283400[_0x46f7d6]={'$like':'%'+_0x355a78[_0x343b('0x35')]['filter']+'%'};return _0x283400;})});}_0x13e299=_[_0x343b('0x42')]({},_0x13e299,_0x355a78[_0x343b('0x4a')]);return db['CmHopperFinal'][_0x343b('0x1e')]({'where':_0x13e299[_0x343b('0x3e')]})[_0x343b('0x24')](function(_0x1220a7){_0x7ac74b[_0x343b('0x1e')]=_0x1220a7;if(_0x355a78['query'][_0x343b('0x43')]){_0x13e299['include']=[{'all':!![]}];}return db['CmHopperFinal'][_0x343b('0x45')](_0x13e299);})[_0x343b('0x24')](function(_0x45ce46){_0x7ac74b[_0x343b('0x46')]=_0x45ce46;return _0x7ac74b;});}})[_0x343b('0x24')](respondWithFilteredResult(_0x1cb0f3,_0x13e299))['catch'](handleError(_0x1cb0f3,null));};exports['getHopperBlacks']=function(_0x31a9c8,_0x5b5c79,_0x18e8ac){var _0x2d7366={'raw':!![],'where':{}};var _0x156ce8={};var _0x38f43b={'count':0x0,'rows':[]};return db[_0x343b('0x2f')][_0x343b('0x5b')]({'where':{'id':_0x31a9c8[_0x343b('0x48')]['id']}})[_0x343b('0x24')](handleEntityNotFound(_0x5b5c79,null))['then'](function(_0x2d20f2){if(_0x2d20f2){_0x156ce8[_0x343b('0x34')]=_[_0x343b('0x36')](db[_0x343b('0x62')]['rawAttributes']);_0x156ce8['query']=_[_0x343b('0x36')](_0x31a9c8[_0x343b('0x35')]);_0x156ce8[_0x343b('0x37')]=_[_0x343b('0x49')](_0x156ce8[_0x343b('0x34')],_0x156ce8[_0x343b('0x35')]);_0x2d7366[_0x343b('0x38')]=_[_0x343b('0x49')](_0x156ce8[_0x343b('0x34')],qs[_0x343b('0x39')](_0x31a9c8['query']['fields']));_0x2d7366[_0x343b('0x38')]=_0x2d7366[_0x343b('0x38')]['length']?_0x2d7366[_0x343b('0x38')]:_0x156ce8[_0x343b('0x34')];if(!_0x31a9c8[_0x343b('0x35')][_0x343b('0x5c')]('nolimit')){_0x2d7366[_0x343b('0x1c')]=qs[_0x343b('0x1c')](_0x31a9c8[_0x343b('0x35')][_0x343b('0x1c')]);_0x2d7366['offset']=qs[_0x343b('0x1b')](_0x31a9c8[_0x343b('0x35')][_0x343b('0x1b')]);}_0x2d7366[_0x343b('0x3c')]=qs['sort'](_0x31a9c8['query']['sort']);_0x2d7366['where']=qs['filters'](_[_0x343b('0x3f')](_0x31a9c8[_0x343b('0x35')],_0x156ce8[_0x343b('0x37')]));_0x2d7366[_0x343b('0x3e')][_0x343b('0x5d')]=_0x2d20f2['id'];if(_0x31a9c8[_0x343b('0x35')][_0x343b('0x40')]){_0x2d7366[_0x343b('0x3e')]=_[_0x343b('0x42')](_0x2d7366[_0x343b('0x3e')],{'$or':_[_0x343b('0x2e')](_0x2d7366[_0x343b('0x38')],function(_0x58765c){var _0x1e5dc7={};_0x1e5dc7[_0x58765c]={'$like':'%'+_0x31a9c8[_0x343b('0x35')][_0x343b('0x40')]+'%'};return _0x1e5dc7;})});}_0x2d7366=_[_0x343b('0x42')]({},_0x2d7366,_0x31a9c8[_0x343b('0x4a')]);return db['CmHopperBlack'][_0x343b('0x1e')]({'where':_0x2d7366['where']})[_0x343b('0x24')](function(_0x42bc28){_0x38f43b[_0x343b('0x1e')]=_0x42bc28;if(_0x31a9c8['query'][_0x343b('0x43')]){_0x2d7366['include']=[{'all':!![]}];}return db[_0x343b('0x62')]['findAll'](_0x2d7366);})[_0x343b('0x24')](function(_0x4ff6ab){_0x38f43b[_0x343b('0x46')]=_0x4ff6ab;return _0x38f43b;});}})[_0x343b('0x24')](respondWithFilteredResult(_0x5b5c79,_0x2d7366))[_0x343b('0x4b')](handleError(_0x5b5c79,null));};exports['getLists']=function(_0x21c764,_0x499350,_0x920002){var _0x3fc527={};var _0x319f2d={};var _0xdd64f6;var _0x4bf9ef;return db[_0x343b('0x2f')][_0x343b('0x5b')]({'where':{'id':_0x21c764['params']['id']}})[_0x343b('0x24')](handleEntityNotFound(_0x499350,null))[_0x343b('0x24')](function(_0x16fb83){if(_0x16fb83){_0xdd64f6=_0x16fb83;_0x319f2d[_0x343b('0x34')]=_[_0x343b('0x36')](db['CmList']['rawAttributes']);_0x319f2d[_0x343b('0x35')]=_[_0x343b('0x36')](_0x21c764[_0x343b('0x35')]);_0x319f2d[_0x343b('0x37')]=_[_0x343b('0x49')](_0x319f2d[_0x343b('0x34')],_0x319f2d[_0x343b('0x35')]);_0x3fc527[_0x343b('0x38')]=_['intersection'](_0x319f2d[_0x343b('0x34')],qs[_0x343b('0x39')](_0x21c764[_0x343b('0x35')][_0x343b('0x39')]));_0x3fc527[_0x343b('0x38')]=_0x3fc527[_0x343b('0x38')][_0x343b('0x3a')]?_0x3fc527['attributes']:_0x319f2d['model'];_0x3fc527[_0x343b('0x3c')]=qs['sort'](_0x21c764[_0x343b('0x35')][_0x343b('0x3d')]);_0x3fc527[_0x343b('0x3e')]=qs[_0x343b('0x37')](_['pick'](_0x21c764['query'],_0x319f2d[_0x343b('0x37')]));if(_0x21c764[_0x343b('0x35')][_0x343b('0x40')]){_0x3fc527[_0x343b('0x3e')]=_[_0x343b('0x42')](_0x3fc527[_0x343b('0x3e')],{'$or':_['map'](_0x3fc527[_0x343b('0x38')],function(_0x653944){var _0x24de6e={};_0x24de6e[_0x653944]={'$like':'%'+_0x21c764[_0x343b('0x35')]['filter']+'%'};return _0x24de6e;})});}_0x3fc527=_['merge']({},_0x3fc527,_0x21c764[_0x343b('0x4a')]);return _0xdd64f6[_0x343b('0x63')](_0x3fc527);}})[_0x343b('0x24')](function(_0x425c20){if(_0x425c20){_0x4bf9ef=_0x425c20[_0x343b('0x3a')];if(!_0x21c764[_0x343b('0x35')][_0x343b('0x5c')](_0x343b('0x3b'))){_0x3fc527[_0x343b('0x1c')]=qs[_0x343b('0x1c')](_0x21c764[_0x343b('0x35')]['limit']);_0x3fc527['offset']=qs['offset'](_0x21c764[_0x343b('0x35')]['offset']);}return _0xdd64f6[_0x343b('0x63')](_0x3fc527);}})[_0x343b('0x24')](function(_0x3d504c){if(_0x3d504c){return _0x3d504c?{'count':_0x4bf9ef,'rows':_0x3d504c}:null;}})[_0x343b('0x24')](respondWithResult(_0x499350,null))[_0x343b('0x4b')](handleError(_0x499350,null));};exports['addLists']=function(_0x5c0e01,_0x47823d,_0x16a196){var _0x18688b,_0xfb1e67;return db[_0x343b('0x2f')][_0x343b('0x51')]({'where':{'id':_0x5c0e01['params']['id']}})[_0x343b('0x24')](handleEntityNotFound(_0x47823d,null))['then'](function(_0x23b91b){if(_0x23b91b){_0xfb1e67=_0x23b91b;return _0x23b91b[_0x343b('0x64')](_0x5c0e01[_0x343b('0x58')][_0x343b('0x65')],_['omit'](_0x5c0e01[_0x343b('0x58')],[_0x343b('0x65'),'id'])||{});}return null;})[_0x343b('0x66')](function(_0x1ddf61){var _0x2cfc95;_0x18688b=_0x1ddf61||[];var _0x48dfd5=[];if(_0x1ddf61){for(var _0x5db459=0x0;_0x5db459<_0x1ddf61[_0x343b('0x3a')];_0x5db459+=0x1){var _0x27fcb1=_0x1ddf61[_0x5db459][_0x343b('0x26')]({'plain':!![]});_0xfb1e67[_0x343b('0x67')]=_0x5c0e01[_0x343b('0x58')][_0x343b('0x67')]?_0x5c0e01[_0x343b('0x58')][_0x343b('0x67')]:_0xfb1e67[_0x343b('0x67')];switch(_0xfb1e67[_0x343b('0x67')]){case'always':_0x2cfc95=squel[_0x343b('0x68')]()[_0x343b('0x69')](_0x343b('0x6a'))[_0x343b('0x6b')]([_0x343b('0x6c'),_0x343b('0x6d'),_0x343b('0x6e'),_0x343b('0x6f'),_0x343b('0x5d'),'createdAt',_0x343b('0x57')],squel[_0x343b('0x70')]()[_0x343b('0x71')](_0x343b('0x6c'),'phone')[_0x343b('0x71')](_0x343b('0x72'),_0x343b('0x6d'))['field']('id',_0x343b('0x6e'))['field'](_0x27fcb1[_0x343b('0x73')]['toString'](),_0x343b('0x6f'))[_0x343b('0x71')](_0x5c0e01[_0x343b('0x48')]['id'][_0x343b('0x74')](),'CampaignId')['field']('NOW()','createdAt')[_0x343b('0x71')]('NOW()','updatedAt')['from'](_0x343b('0x75'))[_0x343b('0x3e')](_0x343b('0x76'))[_0x343b('0x3e')](_0x343b('0x77'),_0x27fcb1[_0x343b('0x73')][_0x343b('0x74')]())[_0x343b('0x3e')](_0x343b('0x78'))[_0x343b('0x3e')](_0x343b('0x79'),squel[_0x343b('0x70')]()[_0x343b('0x71')]('COALESCE(calleridnum,\x27\x27)')[_0x343b('0x7a')](_0x343b('0x7b'))['where'](_0x343b('0x7c'),_0x5c0e01[_0x343b('0x48')]['id'][_0x343b('0x74')]()))[_0x343b('0x3e')]('phone\x20NOT\x20IN\x20(?)',squel[_0x343b('0x70')]()['field'](_0x343b('0x7d'))['from'](_0x343b('0x6a'))[_0x343b('0x3e')](_0x343b('0x7c'),_0x5c0e01[_0x343b('0x48')]['id'][_0x343b('0x74')]())))[_0x343b('0x74')]();break;case _0x343b('0x7e'):_0x2cfc95=squel[_0x343b('0x68')]()[_0x343b('0x69')](_0x343b('0x6a'))['fromQuery']([_0x343b('0x6c'),_0x343b('0x6d'),_0x343b('0x6e'),_0x343b('0x6f'),'CampaignId',_0x343b('0x59'),_0x343b('0x57')],squel[_0x343b('0x70')]()[_0x343b('0x71')](_0x343b('0x6c'),_0x343b('0x6c'))[_0x343b('0x71')](_0x343b('0x72'),'scheduledAt')[_0x343b('0x71')]('id','ContactId')['field'](_0x27fcb1[_0x343b('0x73')][_0x343b('0x74')](),_0x343b('0x6f'))[_0x343b('0x71')](_0x5c0e01[_0x343b('0x48')]['id'][_0x343b('0x74')](),_0x343b('0x5d'))[_0x343b('0x71')](_0x343b('0x72'),_0x343b('0x59'))[_0x343b('0x71')]('NOW()',_0x343b('0x57'))[_0x343b('0x7a')](_0x343b('0x75'))[_0x343b('0x3e')]('deletedAt\x20IS\x20NULL')[_0x343b('0x3e')](_0x343b('0x77'),_0x27fcb1[_0x343b('0x73')][_0x343b('0x74')]())[_0x343b('0x3e')](_0x343b('0x78'))[_0x343b('0x3e')](_0x343b('0x79'),squel[_0x343b('0x70')]()['field'](_0x343b('0x7d'))[_0x343b('0x7a')](_0x343b('0x6a'))['where']('CampaignId\x20=\x20?',_0x5c0e01[_0x343b('0x48')]['id'][_0x343b('0x74')]())))[_0x343b('0x74')]();break;default:_0x2cfc95=squel['insert']()[_0x343b('0x69')](_0x343b('0x6a'))['fromQuery']([_0x343b('0x6c'),_0x343b('0x6d'),_0x343b('0x6e'),'ListId',_0x343b('0x5d'),_0x343b('0x59'),_0x343b('0x57')],squel[_0x343b('0x70')]()['field'](_0x343b('0x6c'),_0x343b('0x6c'))[_0x343b('0x71')]('NOW()','scheduledAt')[_0x343b('0x71')]('id',_0x343b('0x6e'))['field'](_0x27fcb1['CmListId'][_0x343b('0x74')](),_0x343b('0x6f'))[_0x343b('0x71')](_0x5c0e01[_0x343b('0x48')]['id'][_0x343b('0x74')](),_0x343b('0x5d'))['field']('NOW()','createdAt')[_0x343b('0x71')](_0x343b('0x72'),_0x343b('0x57'))[_0x343b('0x7a')](_0x343b('0x75'))[_0x343b('0x3e')](_0x343b('0x76'))[_0x343b('0x3e')](_0x343b('0x77'),_0x27fcb1[_0x343b('0x73')]['toString']())['where'](_0x343b('0x78')))['toString']();}_0x48dfd5[_0x343b('0x7f')](db[_0x343b('0x80')][_0x343b('0x35')](_0x2cfc95));}return BPromise[_0x343b('0x81')](_0x48dfd5);}})[_0x343b('0x24')](function(){return _0x18688b;})[_0x343b('0x24')](respondWithResult(_0x47823d,null))[_0x343b('0x4b')](handleError(_0x47823d,null));};exports['removeLists']=function(_0x3304cf,_0x3c9dee,_0x897688){return db['Campaign'][_0x343b('0x51')]({'where':{'id':_0x3304cf[_0x343b('0x48')]['id']}})['then'](handleEntityNotFound(_0x3c9dee,null))[_0x343b('0x24')](function(_0x5cee79){if(_0x5cee79){return _0x5cee79[_0x343b('0x82')](_0x3304cf['query'][_0x343b('0x65')]);}})[_0x343b('0x24')](function(_0x4de468){if(_0x4de468){return db[_0x343b('0x5e')]['destroy']({'where':{'ListId':_0x3304cf['query']['ids'],'CampaignId':_0x3304cf[_0x343b('0x48')]['id']}})[_0x343b('0x24')](function(){return _0x4de468;});}})['then'](respondWithStatusCode(_0x3c9dee,null))['catch'](handleError(_0x3c9dee,null));};exports[_0x343b('0x83')]=function(_0x1bfaa7,_0x42b22e,_0x4e643e){var _0x513c98={};var _0x95768c={};var _0x2a010d;var _0x2b06c5;return db[_0x343b('0x2f')]['findOne']({'where':{'id':_0x1bfaa7[_0x343b('0x48')]['id']}})[_0x343b('0x24')](handleEntityNotFound(_0x42b22e,null))[_0x343b('0x24')](function(_0x1d551f){if(_0x1d551f){_0x2a010d=_0x1d551f;_0x95768c[_0x343b('0x34')]=_['keys'](db[_0x343b('0x84')][_0x343b('0x30')]);_0x95768c['query']=_[_0x343b('0x36')](_0x1bfaa7[_0x343b('0x35')]);_0x95768c[_0x343b('0x37')]=_[_0x343b('0x49')](_0x95768c[_0x343b('0x34')],_0x95768c[_0x343b('0x35')]);_0x513c98['attributes']=_[_0x343b('0x49')](_0x95768c[_0x343b('0x34')],qs[_0x343b('0x39')](_0x1bfaa7[_0x343b('0x35')]['fields']));_0x513c98[_0x343b('0x38')]=_0x513c98[_0x343b('0x38')][_0x343b('0x3a')]?_0x513c98['attributes']:_0x95768c['model'];_0x513c98[_0x343b('0x3c')]=qs[_0x343b('0x3d')](_0x1bfaa7[_0x343b('0x35')]['sort']);_0x513c98[_0x343b('0x3e')]=qs[_0x343b('0x37')](_[_0x343b('0x3f')](_0x1bfaa7[_0x343b('0x35')],_0x95768c[_0x343b('0x37')]));if(_0x1bfaa7[_0x343b('0x35')][_0x343b('0x40')]){_0x513c98[_0x343b('0x3e')]=_['merge'](_0x513c98[_0x343b('0x3e')],{'$or':_[_0x343b('0x2e')](_0x513c98[_0x343b('0x38')],function(_0x350d1e){var _0x3c7fc0={};_0x3c7fc0[_0x350d1e]={'$like':'%'+_0x1bfaa7[_0x343b('0x35')][_0x343b('0x40')]+'%'};return _0x3c7fc0;})});}_0x513c98=_[_0x343b('0x42')]({},_0x513c98,_0x1bfaa7['options']);return _0x2a010d[_0x343b('0x83')](_0x513c98);}})['then'](function(_0xdfe2d3){if(_0xdfe2d3){_0x2b06c5=_0xdfe2d3[_0x343b('0x3a')];if(!_0x1bfaa7[_0x343b('0x35')]['hasOwnProperty'](_0x343b('0x3b'))){_0x513c98[_0x343b('0x1c')]=qs[_0x343b('0x1c')](_0x1bfaa7[_0x343b('0x35')][_0x343b('0x1c')]);_0x513c98['offset']=qs[_0x343b('0x1b')](_0x1bfaa7[_0x343b('0x35')][_0x343b('0x1b')]);}return _0x2a010d[_0x343b('0x83')](_0x513c98);}})[_0x343b('0x24')](function(_0x5283e4){if(_0x5283e4){return _0x5283e4?{'count':_0x2b06c5,'rows':_0x5283e4}:null;}})[_0x343b('0x24')](respondWithResult(_0x42b22e,null))[_0x343b('0x4b')](handleError(_0x42b22e,null));};exports[_0x343b('0x85')]=function(_0x55d64f,_0x5cdd2f,_0x14a74f){var _0x54b5d1,_0x1f61df;return db[_0x343b('0x2f')][_0x343b('0x51')]({'where':{'id':_0x55d64f['params']['id']}})[_0x343b('0x24')](handleEntityNotFound(_0x5cdd2f,null))['then'](function(_0x2b7f8d){if(_0x2b7f8d){_0x1f61df=_0x2b7f8d;return _0x2b7f8d['addBlackLists'](_0x55d64f[_0x343b('0x58')]['ids'],_['omit'](_0x55d64f[_0x343b('0x58')],[_0x343b('0x65'),'id'])||{});}return null;})[_0x343b('0x66')](function(_0x30d505){var _0x2a6779;_0x54b5d1=_0x30d505||[];var _0x3be0c2=[];if(_0x30d505){for(var _0xc807ed=0x0;_0xc807ed<_0x30d505[_0x343b('0x3a')];_0xc807ed+=0x1){var _0x6b2f=_0x30d505[_0xc807ed]['get']({'plain':!![]});_0x2a6779=squel[_0x343b('0x68')]()[_0x343b('0x69')](_0x343b('0x86'))[_0x343b('0x6b')]([_0x343b('0x6c'),_0x343b('0x6e'),'ListId','CampaignId',_0x343b('0x59'),_0x343b('0x57')],squel[_0x343b('0x70')]()[_0x343b('0x71')](_0x343b('0x6c'),'phone')['field']('id',_0x343b('0x6e'))[_0x343b('0x71')](_0x6b2f[_0x343b('0x73')][_0x343b('0x74')](),_0x343b('0x6f'))['field'](_0x55d64f['params']['id'][_0x343b('0x74')](),_0x343b('0x5d'))[_0x343b('0x71')](_0x343b('0x72'),_0x343b('0x59'))[_0x343b('0x71')]('NOW()',_0x343b('0x57'))['from'](_0x343b('0x75'))['where'](_0x343b('0x76'))[_0x343b('0x3e')]('ListId\x20=\x20?',_0x6b2f[_0x343b('0x73')][_0x343b('0x74')]())[_0x343b('0x3e')](_0x343b('0x78')))[_0x343b('0x74')]();_0x3be0c2[_0x343b('0x7f')](db['sequelize'][_0x343b('0x35')](_0x2a6779));}return BPromise[_0x343b('0x81')](_0x3be0c2);}})[_0x343b('0x24')](function(){return _0x54b5d1;})[_0x343b('0x24')](respondWithResult(_0x5cdd2f,null))['catch'](handleError(_0x5cdd2f,null));};exports[_0x343b('0x87')]=function(_0x4c5217,_0x1b3f46,_0x3122b0){return db[_0x343b('0x2f')][_0x343b('0x51')]({'where':{'id':_0x4c5217[_0x343b('0x48')]['id']}})[_0x343b('0x24')](handleEntityNotFound(_0x1b3f46,null))[_0x343b('0x24')](function(_0x3daba2){if(_0x3daba2){return _0x3daba2[_0x343b('0x87')](_0x4c5217[_0x343b('0x35')][_0x343b('0x65')]);}})[_0x343b('0x24')](function(_0x2ae488){if(_0x2ae488){return db[_0x343b('0x62')][_0x343b('0x25')]({'where':{'ListId':_0x4c5217['query'][_0x343b('0x65')],'CampaignId':_0x4c5217[_0x343b('0x48')]['id']}})[_0x343b('0x24')](function(){return _0x2ae488;});}})[_0x343b('0x24')](respondWithStatusCode(_0x1b3f46,null))[_0x343b('0x4b')](handleError(_0x1b3f46,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index feb1cf2..90d83ff 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(_0x469ac7,_0x38e416){var _0x22f3b0=function(_0x1a1447){while(--_0x1a1447){_0x469ac7['push'](_0x469ac7['shift']());}};_0x22f3b0(++_0x38e416);}(_0x7a54,0x106));var _0x47a5=function(_0x45a4cf,_0x447b68){_0x45a4cf=_0x45a4cf-0x0;var _0x17c90a=_0x7a54[_0x45a4cf];return _0x17c90a;};'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(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_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 1ae9b4e..d26813e 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 _0xb32d=['result','options','where','limit','include','model','attributes','GetCampaign','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0xb32d,0x1da));var _0xdb32=function(_0x3d4e74,_0x21b4e5){_0x3d4e74=_0x3d4e74-0x0;var _0x57613d=_0xb32d[_0x3d4e74];return _0x57613d;};'use strict';var _=require(_0xdb32('0x0'));var util=require(_0xdb32('0x1'));var moment=require(_0xdb32('0x2'));var BPromise=require(_0xdb32('0x3'));var rs=require(_0xdb32('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdb32('0x5'));var logger=require(_0xdb32('0x6'))('rpc');var config=require(_0xdb32('0x7'));var jayson=require(_0xdb32('0x8'));var client=jayson[_0xdb32('0x9')][_0xdb32('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x6f4af0,_0x386309,_0x5bb076){return new BPromise(function(_0x3b0995,_0x2686db){return client[_0xdb32('0xb')](_0x6f4af0,_0x5bb076)[_0xdb32('0xc')](function(_0x30e03d){logger[_0xdb32('0xd')](_0xdb32('0xe'),_0x386309,_0xdb32('0xf'));logger[_0xdb32('0x10')](_0xdb32('0x11'),_0x386309,_0xdb32('0xf'),JSON[_0xdb32('0x12')](_0x30e03d));if(_0x30e03d[_0xdb32('0x13')]){if(_0x30e03d[_0xdb32('0x13')][_0xdb32('0x14')]===0x1f4){logger[_0xdb32('0x13')](_0xdb32('0xe'),_0x386309,_0x30e03d[_0xdb32('0x13')][_0xdb32('0x15')]);return _0x2686db(_0x30e03d[_0xdb32('0x13')][_0xdb32('0x15')]);}logger['error'](_0xdb32('0xe'),_0x386309,_0x30e03d[_0xdb32('0x13')][_0xdb32('0x15')]);return _0x3b0995(_0x30e03d[_0xdb32('0x13')][_0xdb32('0x15')]);}else{logger['info'](_0xdb32('0xe'),_0x386309,_0xdb32('0xf'));_0x3b0995(_0x30e03d[_0xdb32('0x16')]['message']);}})['catch'](function(_0x59a5f8){logger['error'](_0xdb32('0xe'),_0x386309,_0x59a5f8);_0x2686db(_0x59a5f8);});});}exports['GetCampaign']=function(_0x1fd22b){var _0xfab49a=this;return new Promise(function(_0x1ba5f4,_0x301cc3){return db['Campaign']['findAll']({'raw':_0x1fd22b['options']?_0x1fd22b[_0xdb32('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x1fd22b[_0xdb32('0x17')]?_0x1fd22b[_0xdb32('0x17')][_0xdb32('0x18')]||null:null,'attributes':_0x1fd22b[_0xdb32('0x17')]?_0x1fd22b[_0xdb32('0x17')]['attributes']||null:null,'limit':_0x1fd22b[_0xdb32('0x17')]?_0x1fd22b[_0xdb32('0x17')][_0xdb32('0x19')]||null:null,'include':_0x1fd22b['options']?_0x1fd22b['options'][_0xdb32('0x1a')]?_['map'](_0x1fd22b['options'][_0xdb32('0x1a')],function(_0x14b5fd){return{'model':db[_0x14b5fd[_0xdb32('0x1b')]],'as':_0x14b5fd['as'],'attributes':_0x14b5fd[_0xdb32('0x1c')],'include':_0x14b5fd['include']?_['map'](_0x14b5fd[_0xdb32('0x1a')],function(_0x2168d9){return{'model':db[_0x2168d9[_0xdb32('0x1b')]],'as':_0x2168d9['as'],'attributes':_0x2168d9['attributes'],'include':_0x2168d9[_0xdb32('0x1a')]?_['map'](_0x2168d9[_0xdb32('0x1a')],function(_0x17f627){return{'model':db[_0x17f627[_0xdb32('0x1b')]],'as':_0x17f627['as'],'attributes':_0x17f627[_0xdb32('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xdb32('0xc')](function(_0x5d29da){logger['info'](_0xdb32('0x1d'),_0x1fd22b);logger['debug'](_0xdb32('0x1d'),_0x1fd22b,JSON[_0xdb32('0x12')](_0x5d29da));_0x1ba5f4(_0x5d29da);})[_0xdb32('0x1e')](function(_0x5a6109){logger['error'](_0xdb32('0x1d'),_0x5a6109[_0xdb32('0x15')],_0x1fd22b);_0x301cc3(_0xfab49a[_0xdb32('0x13')](0x1f4,_0x5a6109['message']));});});}; \ No newline at end of file +var _0x8cfd=['catch','Campaign','findAll','options','raw','where','limit','map','model','include','attributes','GetCampaign','lodash','util','moment','bluebird','randomstring','ioredis','../../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','stringify','error','code','message','result'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0x8cfd,0xe4));var _0xd8cf=function(_0x4f8f3b,_0x43281b){_0x4f8f3b=_0x4f8f3b-0x0;var _0x4c250c=_0x8cfd[_0x4f8f3b];return _0x4c250c;};'use strict';var _=require(_0xd8cf('0x0'));var util=require(_0xd8cf('0x1'));var moment=require(_0xd8cf('0x2'));var BPromise=require(_0xd8cf('0x3'));var rs=require(_0xd8cf('0x4'));var fs=require('fs');var Redis=require(_0xd8cf('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd8cf('0x6'));var logger=require(_0xd8cf('0x7'))(_0xd8cf('0x8'));var config=require(_0xd8cf('0x9'));var jayson=require(_0xd8cf('0xa'));var client=jayson[_0xd8cf('0xb')][_0xd8cf('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4b41b7,_0x5cfd20,_0x3fe2d2){return new BPromise(function(_0xa5b446,_0x37b91b){return client[_0xd8cf('0xd')](_0x4b41b7,_0x3fe2d2)[_0xd8cf('0xe')](function(_0x668d6c){logger['info'](_0xd8cf('0xf'),_0x5cfd20,_0xd8cf('0x10'));logger[_0xd8cf('0x11')](_0xd8cf('0x12'),_0x5cfd20,_0xd8cf('0x10'),JSON[_0xd8cf('0x13')](_0x668d6c));if(_0x668d6c[_0xd8cf('0x14')]){if(_0x668d6c[_0xd8cf('0x14')][_0xd8cf('0x15')]===0x1f4){logger[_0xd8cf('0x14')](_0xd8cf('0xf'),_0x5cfd20,_0x668d6c[_0xd8cf('0x14')]['message']);return _0x37b91b(_0x668d6c[_0xd8cf('0x14')]['message']);}logger[_0xd8cf('0x14')](_0xd8cf('0xf'),_0x5cfd20,_0x668d6c['error'][_0xd8cf('0x16')]);return _0xa5b446(_0x668d6c[_0xd8cf('0x14')][_0xd8cf('0x16')]);}else{logger['info'](_0xd8cf('0xf'),_0x5cfd20,'request\x20sent');_0xa5b446(_0x668d6c[_0xd8cf('0x17')][_0xd8cf('0x16')]);}})[_0xd8cf('0x18')](function(_0x55018c){logger[_0xd8cf('0x14')](_0xd8cf('0xf'),_0x5cfd20,_0x55018c);_0x37b91b(_0x55018c);});});}exports['GetCampaign']=function(_0xecd444){var _0x73e7c3=this;return new Promise(function(_0x3bee85,_0xf8732e){return db[_0xd8cf('0x19')][_0xd8cf('0x1a')]({'raw':_0xecd444[_0xd8cf('0x1b')]?_0xecd444[_0xd8cf('0x1b')][_0xd8cf('0x1c')]===undefined?!![]:![]:!![],'where':_0xecd444[_0xd8cf('0x1b')]?_0xecd444[_0xd8cf('0x1b')][_0xd8cf('0x1d')]||null:null,'attributes':_0xecd444[_0xd8cf('0x1b')]?_0xecd444[_0xd8cf('0x1b')]['attributes']||null:null,'limit':_0xecd444[_0xd8cf('0x1b')]?_0xecd444[_0xd8cf('0x1b')][_0xd8cf('0x1e')]||null:null,'include':_0xecd444[_0xd8cf('0x1b')]?_0xecd444[_0xd8cf('0x1b')]['include']?_[_0xd8cf('0x1f')](_0xecd444['options']['include'],function(_0x4e7d83){return{'model':db[_0x4e7d83[_0xd8cf('0x20')]],'as':_0x4e7d83['as'],'attributes':_0x4e7d83['attributes'],'include':_0x4e7d83[_0xd8cf('0x21')]?_[_0xd8cf('0x1f')](_0x4e7d83[_0xd8cf('0x21')],function(_0x667f44){return{'model':db[_0x667f44['model']],'as':_0x667f44['as'],'attributes':_0x667f44[_0xd8cf('0x22')],'include':_0x667f44[_0xd8cf('0x21')]?_[_0xd8cf('0x1f')](_0x667f44[_0xd8cf('0x21')],function(_0x2f97b1){return{'model':db[_0x2f97b1[_0xd8cf('0x20')]],'as':_0x2f97b1['as'],'attributes':_0x2f97b1['attributes']};}):[]};}):[]};}):[]:[]})[_0xd8cf('0xe')](function(_0x1453d3){logger['info'](_0xd8cf('0x23'),_0xecd444);logger[_0xd8cf('0x11')](_0xd8cf('0x23'),_0xecd444,JSON[_0xd8cf('0x13')](_0x1453d3));_0x3bee85(_0x1453d3);})[_0xd8cf('0x18')](function(_0x48013b){logger[_0xd8cf('0x14')](_0xd8cf('0x23'),_0x48013b[_0xd8cf('0x16')],_0xecd444);_0xf8732e(_0x73e7c3[_0xd8cf('0x14')](0x1f4,_0x48013b[_0xd8cf('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 6837d41..16489c1 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 _0x55da=['../../config/environment','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','getBlackLists','create','/:id/clone','clone','post','addLists','addBlackLists','delete','destroy','removeLists','/:id/blacklists','removeBlackLists','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x4e0a5e,_0x1108ec){var _0x3def35=function(_0x137a03){while(--_0x137a03){_0x4e0a5e['push'](_0x4e0a5e['shift']());}};_0x3def35(++_0x1108ec);}(_0x55da,0x16f));var _0xa55d=function(_0x102654,_0x71d14){_0x102654=_0x102654-0x0;var _0xeb449=_0x55da[_0x102654];return _0xeb449;};'use strict';var multer=require('multer');var util=require(_0xa55d('0x0'));var path=require(_0xa55d('0x1'));var timeout=require(_0xa55d('0x2'));var express=require(_0xa55d('0x3'));var router=express[_0xa55d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa55d('0x5'));var interaction=require(_0xa55d('0x6'));var config=require(_0xa55d('0x7'));var controller=require('./campaign.controller');router[_0xa55d('0x8')]('/',auth[_0xa55d('0x9')](),controller[_0xa55d('0xa')]);router[_0xa55d('0x8')](_0xa55d('0xb'),auth[_0xa55d('0x9')](),controller[_0xa55d('0xc')]);router[_0xa55d('0x8')](_0xa55d('0xd'),auth['isAuthenticated'](),controller[_0xa55d('0xe')]);router[_0xa55d('0x8')](_0xa55d('0xf'),auth[_0xa55d('0x9')](),controller['getHopperHistories']);router[_0xa55d('0x8')](_0xa55d('0x10'),auth[_0xa55d('0x9')](),controller[_0xa55d('0x11')]);router[_0xa55d('0x8')](_0xa55d('0x12'),auth['isAuthenticated'](),controller[_0xa55d('0x13')]);router[_0xa55d('0x8')](_0xa55d('0x14'),auth[_0xa55d('0x9')](),controller[_0xa55d('0x15')]);router[_0xa55d('0x8')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0xa55d('0x16')]);router['post']('/',auth[_0xa55d('0x9')](),controller[_0xa55d('0x17')]);router['post'](_0xa55d('0x18'),auth[_0xa55d('0x9')](),controller[_0xa55d('0x19')]);router[_0xa55d('0x1a')]('/:id/lists',auth[_0xa55d('0x9')](),controller[_0xa55d('0x1b')]);router['post']('/:id/blacklists',auth[_0xa55d('0x9')](),controller[_0xa55d('0x1c')]);router['put'](_0xa55d('0xb'),auth[_0xa55d('0x9')](),controller['update']);router[_0xa55d('0x1d')](_0xa55d('0xb'),auth[_0xa55d('0x9')](),controller[_0xa55d('0x1e')]);router[_0xa55d('0x1d')](_0xa55d('0x14'),auth[_0xa55d('0x9')](),controller[_0xa55d('0x1f')]);router[_0xa55d('0x1d')](_0xa55d('0x20'),auth[_0xa55d('0x9')](),controller[_0xa55d('0x21')]);module['exports']=router; \ No newline at end of file +var _0x32f6=['addLists','/:id/blacklists','put','destroy','delete','removeBlackLists','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','/:id/hoppers','getHoppers','getHopperHistories','getHopperBlacks','post','/:id/clone','clone','/:id/lists'];(function(_0x264eb4,_0x4f072e){var _0x4c73ad=function(_0x45ec1f){while(--_0x45ec1f){_0x264eb4['push'](_0x264eb4['shift']());}};_0x4c73ad(++_0x4f072e);}(_0x32f6,0xbd));var _0x632f=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x32f6[_0x4d613c];return _0x301fe3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x632f('0x0'));var timeout=require(_0x632f('0x1'));var express=require('express');var router=express[_0x632f('0x2')]();var fs_extra=require(_0x632f('0x3'));var auth=require(_0x632f('0x4'));var interaction=require(_0x632f('0x5'));var config=require(_0x632f('0x6'));var controller=require('./campaign.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x632f('0x7')](_0x632f('0x8'),auth[_0x632f('0x9')](),controller[_0x632f('0xa')]);router[_0x632f('0x7')](_0x632f('0xb'),auth[_0x632f('0x9')](),controller[_0x632f('0xc')]);router[_0x632f('0x7')]('/:id/hopper_histories',auth[_0x632f('0x9')](),controller[_0x632f('0xd')]);router['get']('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router[_0x632f('0x7')]('/:id/hopper_black',auth[_0x632f('0x9')](),controller[_0x632f('0xe')]);router[_0x632f('0x7')]('/:id/lists',auth['isAuthenticated'](),controller['getLists']);router['get']('/:id/blacklists',auth['isAuthenticated'](),controller['getBlackLists']);router[_0x632f('0xf')]('/',auth[_0x632f('0x9')](),controller['create']);router[_0x632f('0xf')](_0x632f('0x10'),auth[_0x632f('0x9')](),controller[_0x632f('0x11')]);router['post'](_0x632f('0x12'),auth[_0x632f('0x9')](),controller[_0x632f('0x13')]);router[_0x632f('0xf')](_0x632f('0x14'),auth[_0x632f('0x9')](),controller['addBlackLists']);router[_0x632f('0x15')](_0x632f('0x8'),auth[_0x632f('0x9')](),controller['update']);router['delete']('/:id',auth[_0x632f('0x9')](),controller[_0x632f('0x16')]);router[_0x632f('0x17')](_0x632f('0x12'),auth[_0x632f('0x9')](),controller['removeLists']);router[_0x632f('0x17')]('/:id/blacklists',auth[_0x632f('0x9')](),controller[_0x632f('0x18')]);module[_0x632f('0x19')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 58d493a..bee5800 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 _0x1273=['STRING','VIRTUAL','getDataValue','exports'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x1273,0x7b));var _0x3127=function(_0xd2c8f3,_0x3cfb97){_0xd2c8f3=_0xd2c8f3-0x0;var _0x34efcf=_0x1273[_0xd2c8f3];return _0x34efcf;};'use strict';var Sequelize=require('sequelize');module[_0x3127('0x0')]={'key':{'type':Sequelize[_0x3127('0x1')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x3127('0x1')]},'name':{'type':Sequelize[_0x3127('0x2')],'get':function(){return this[_0x3127('0x3')]('key');}}}; \ No newline at end of file +var _0x9917=['getDataValue','exports','TEXT','STRING','VIRTUAL'];(function(_0x2cde0a,_0x1f9695){var _0x260610=function(_0x179089){while(--_0x179089){_0x2cde0a['push'](_0x2cde0a['shift']());}};_0x260610(++_0x1f9695);}(_0x9917,0xfb));var _0x7991=function(_0x43a2a1,_0x54430d){_0x43a2a1=_0x43a2a1-0x0;var _0x110d92=_0x9917[_0x43a2a1];return _0x110d92;};'use strict';var Sequelize=require('sequelize');module[_0x7991('0x0')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x7991('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x7991('0x2')]},'name':{'type':Sequelize[_0x7991('0x3')],'get':function(){return this[_0x7991('0x4')]('key');}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index bd9b059..68dcb7c 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 _0x8fb4=['keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','findAll','rows','catch','show','params','options','find','body','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','CannedAnswers','UserProfileResource','error','stack','name','send','index','map','CannedAnswer','rawAttributes','fieldName','type','key','model','query'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0x8fb4,0x7f));var _0x48fb=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x8fb4[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require(_0x48fb('0x0'));var rimraf=require(_0x48fb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x48fb('0x2'));var rp=require(_0x48fb('0x3'));var moment=require(_0x48fb('0x4'));var BPromise=require(_0x48fb('0x5'));var Mustache=require(_0x48fb('0x6'));var util=require(_0x48fb('0x7'));var path=require(_0x48fb('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x48fb('0x9'));var _=require(_0x48fb('0xa'));var squel=require(_0x48fb('0xb'));var crypto=require(_0x48fb('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x48fb('0xd'));var toCsv=require(_0x48fb('0xe'));var querystring=require(_0x48fb('0xf'));var Papa=require(_0x48fb('0x10'));var Redis=require(_0x48fb('0x11'));var authService=require(_0x48fb('0x12'));var qs=require(_0x48fb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x48fb('0x14'));var utils=require('../../config/utils');var config=require(_0x48fb('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x48fb('0x16'))['db'];function respondWithStatusCode(_0x597202,_0x175774){_0x175774=_0x175774||0xcc;return function(_0x48f5b3){if(_0x48f5b3){return _0x597202[_0x48fb('0x17')](_0x175774);}return _0x597202[_0x48fb('0x18')](_0x175774)[_0x48fb('0x19')]();};}function respondWithResult(_0x6a3533,_0x21f6ab){_0x21f6ab=_0x21f6ab||0xc8;return function(_0x7f9a6b){if(_0x7f9a6b){return _0x6a3533[_0x48fb('0x18')](_0x21f6ab)[_0x48fb('0x1a')](_0x7f9a6b);}};}function respondWithFilteredResult(_0x47eb86,_0x511237){return function(_0x2c419a){if(_0x2c419a){var _0x14c09a=typeof _0x511237[_0x48fb('0x1b')]===_0x48fb('0x1c')&&typeof _0x511237['limit']===_0x48fb('0x1c');var _0x2ca758=_0x2c419a[_0x48fb('0x1d')];var _0x52c607=_0x14c09a?0x0:_0x511237['offset'];var _0x1d126b=_0x14c09a?_0x2c419a['count']:_0x511237['offset']+_0x511237[_0x48fb('0x1e')];var _0x6ad8dd;if(_0x1d126b>=_0x2ca758){_0x1d126b=_0x2ca758;_0x6ad8dd=0xc8;}else{_0x6ad8dd=0xce;}_0x47eb86[_0x48fb('0x18')](_0x6ad8dd);return _0x47eb86[_0x48fb('0x1f')](_0x48fb('0x20'),_0x52c607+'-'+_0x1d126b+'/'+_0x2ca758)[_0x48fb('0x1a')](_0x2c419a);}return null;};}function patchUpdates(_0x4358f2){return function(_0x4c7aa6){try{jsonpatch[_0x48fb('0x21')](_0x4c7aa6,_0x4358f2,!![]);}catch(_0x96a55d){return BPromise[_0x48fb('0x22')](_0x96a55d);}return _0x4c7aa6[_0x48fb('0x23')]();};}function saveUpdates(_0x4397e6,_0x504068){return function(_0x31b61e){if(_0x31b61e){return _0x31b61e[_0x48fb('0x24')](_0x4397e6)[_0x48fb('0x25')](function(_0x269c3f){return _0x269c3f;});}return null;};}function removeEntity(_0x24b5f0,_0x2facb1){return function(_0x242f9f){if(_0x242f9f){return _0x242f9f[_0x48fb('0x26')]()[_0x48fb('0x25')](function(){var _0x137f7d=_0x242f9f[_0x48fb('0x27')]({'plain':!![]});var _0xab101c=_0x48fb('0x28');return db[_0x48fb('0x29')]['destroy']({'where':{'type':_0xab101c,'resourceId':_0x137f7d['id']}})[_0x48fb('0x25')](function(){return _0x242f9f;});})[_0x48fb('0x25')](function(){_0x24b5f0[_0x48fb('0x18')](0xcc)[_0x48fb('0x19')]();});}};}function handleEntityNotFound(_0x95ab88,_0x248bfe){return function(_0x3854d7){if(!_0x3854d7){_0x95ab88[_0x48fb('0x17')](0x194);}return _0x3854d7;};}function handleError(_0x5eef32,_0x357ab9){_0x357ab9=_0x357ab9||0x1f4;return function(_0x48f3db){logger[_0x48fb('0x2a')](_0x48f3db[_0x48fb('0x2b')]);if(_0x48f3db[_0x48fb('0x2c')]){delete _0x48f3db[_0x48fb('0x2c')];}_0x5eef32[_0x48fb('0x18')](_0x357ab9)[_0x48fb('0x2d')](_0x48f3db);};}exports[_0x48fb('0x2e')]=function(_0x46f78f,_0x4037f0){var _0x3e907a={},_0x366a1c={},_0x3f1ee8={'count':0x0,'rows':[]};var _0x56f217=_[_0x48fb('0x2f')](db[_0x48fb('0x30')][_0x48fb('0x31')],function(_0x584999){return{'name':_0x584999[_0x48fb('0x32')],'type':_0x584999[_0x48fb('0x33')][_0x48fb('0x34')]};});_0x366a1c[_0x48fb('0x35')]=_[_0x48fb('0x2f')](_0x56f217,_0x48fb('0x2c'));_0x366a1c[_0x48fb('0x36')]=_[_0x48fb('0x37')](_0x46f78f[_0x48fb('0x36')]);_0x366a1c[_0x48fb('0x38')]=_[_0x48fb('0x39')](_0x366a1c[_0x48fb('0x35')],_0x366a1c[_0x48fb('0x36')]);_0x3e907a['attributes']=_['intersection'](_0x366a1c[_0x48fb('0x35')],qs['fields'](_0x46f78f['query'][_0x48fb('0x3a')]));_0x3e907a[_0x48fb('0x3b')]=_0x3e907a[_0x48fb('0x3b')][_0x48fb('0x3c')]?_0x3e907a[_0x48fb('0x3b')]:_0x366a1c['model'];if(!_0x46f78f[_0x48fb('0x36')][_0x48fb('0x3d')](_0x48fb('0x3e'))){_0x3e907a[_0x48fb('0x1e')]=qs['limit'](_0x46f78f['query']['limit']);_0x3e907a[_0x48fb('0x1b')]=qs[_0x48fb('0x1b')](_0x46f78f[_0x48fb('0x36')][_0x48fb('0x1b')]);}_0x3e907a[_0x48fb('0x3f')]=qs[_0x48fb('0x40')](_0x46f78f[_0x48fb('0x36')][_0x48fb('0x40')]);_0x3e907a[_0x48fb('0x41')]=qs[_0x48fb('0x38')](_[_0x48fb('0x42')](_0x46f78f[_0x48fb('0x36')],_0x366a1c[_0x48fb('0x38')]),_0x56f217);if(_0x46f78f[_0x48fb('0x36')]['filter']){_0x3e907a[_0x48fb('0x41')]=_['merge'](_0x3e907a[_0x48fb('0x41')],{'$or':[{'key':{'$like':'%'+_0x46f78f[_0x48fb('0x36')][_0x48fb('0x43')]+'%'}},{'value':{'$like':'%'+_0x46f78f[_0x48fb('0x36')][_0x48fb('0x43')]+'%'}}]});}_0x3e907a=_[_0x48fb('0x44')]({},_0x3e907a,_0x46f78f['options']);var _0x3e591f={'where':_0x3e907a[_0x48fb('0x41')]};return db[_0x48fb('0x30')][_0x48fb('0x1d')](_0x3e591f)[_0x48fb('0x25')](function(_0x3ffe59){_0x3f1ee8[_0x48fb('0x1d')]=_0x3ffe59;if(_0x46f78f[_0x48fb('0x36')][_0x48fb('0x45')]){_0x3e907a['include']=[{'all':!![]}];}return db[_0x48fb('0x30')][_0x48fb('0x46')](_0x3e907a);})[_0x48fb('0x25')](function(_0x245c10){_0x3f1ee8[_0x48fb('0x47')]=_0x245c10;return _0x3f1ee8;})[_0x48fb('0x25')](respondWithFilteredResult(_0x4037f0,_0x3e907a))[_0x48fb('0x48')](handleError(_0x4037f0,null));};exports[_0x48fb('0x49')]=function(_0x251fb2,_0xbbbe0a){var _0x59c86e={'raw':!![],'where':{'id':_0x251fb2[_0x48fb('0x4a')]['id']}},_0x3a4213={};_0x3a4213[_0x48fb('0x35')]=_[_0x48fb('0x37')](db['CannedAnswer'][_0x48fb('0x31')]);_0x3a4213[_0x48fb('0x36')]=_[_0x48fb('0x37')](_0x251fb2['query']);_0x3a4213[_0x48fb('0x38')]=_[_0x48fb('0x39')](_0x3a4213[_0x48fb('0x35')],_0x3a4213['query']);_0x59c86e['attributes']=_['intersection'](_0x3a4213['model'],qs[_0x48fb('0x3a')](_0x251fb2['query'][_0x48fb('0x3a')]));_0x59c86e[_0x48fb('0x3b')]=_0x59c86e['attributes'][_0x48fb('0x3c')]?_0x59c86e['attributes']:_0x3a4213['model'];if(_0x251fb2['query']['includeAll']){_0x59c86e['include']=[{'all':!![]}];}_0x59c86e=_[_0x48fb('0x44')]({},_0x59c86e,_0x251fb2[_0x48fb('0x4b')]);return db[_0x48fb('0x30')][_0x48fb('0x4c')](_0x59c86e)[_0x48fb('0x25')](handleEntityNotFound(_0xbbbe0a,null))[_0x48fb('0x25')](respondWithResult(_0xbbbe0a,null))['catch'](handleError(_0xbbbe0a,null));};exports[_0x48fb('0x24')]=function(_0x48b435,_0x3c67c4){if(_0x48b435[_0x48fb('0x4d')]['id']){delete _0x48b435[_0x48fb('0x4d')]['id'];}return db[_0x48fb('0x30')][_0x48fb('0x4c')]({'where':{'id':_0x48b435['params']['id']}})[_0x48fb('0x25')](handleEntityNotFound(_0x3c67c4,null))[_0x48fb('0x25')](saveUpdates(_0x48b435[_0x48fb('0x4d')],null))[_0x48fb('0x25')](respondWithResult(_0x3c67c4,null))[_0x48fb('0x48')](handleError(_0x3c67c4,null));};exports['destroy']=function(_0x7477ef,_0x4a67c8){return db['CannedAnswer'][_0x48fb('0x4c')]({'where':{'id':_0x7477ef[_0x48fb('0x4a')]['id']}})[_0x48fb('0x25')](handleEntityNotFound(_0x4a67c8,null))[_0x48fb('0x25')](removeEntity(_0x4a67c8,null))[_0x48fb('0x48')](handleError(_0x4a67c8,null));};exports['create']=function(_0x559f20,_0x510dd2){var _0x1678dc={'key':_0x559f20[_0x48fb('0x4d')][_0x48fb('0x34')]};if(_0x559f20[_0x48fb('0x4d')][_0x48fb('0x4e')]){_0x1678dc[_0x48fb('0x4e')]=_0x559f20[_0x48fb('0x4d')][_0x48fb('0x4e')];}else if(_0x559f20[_0x48fb('0x4d')][_0x48fb('0x4f')]){_0x1678dc['SmsAccountId']=_0x559f20['body'][_0x48fb('0x4f')];}else if(_0x559f20['body'][_0x48fb('0x50')]){_0x1678dc['OpenchannelAccountId']=_0x559f20['body'][_0x48fb('0x50')];}else if(_0x559f20[_0x48fb('0x4d')][_0x48fb('0x51')]){_0x1678dc['ChatWebsiteId']=_0x559f20['body'][_0x48fb('0x51')];}return db['CannedAnswer'][_0x48fb('0x4c')]({'where':_0x1678dc})[_0x48fb('0x25')](function(_0x4e8c58){if(_0x4e8c58){throw new db['Sequelize'][(_0x48fb('0x52'))](_0x48fb('0x53'));}return db[_0x48fb('0x30')][_0x48fb('0x54')](_0x559f20[_0x48fb('0x4d')]);})['then'](function(_0x2c4a3a){var _0x3b3d94=_0x559f20[_0x48fb('0x55')][_0x48fb('0x27')]({'plain':!![]});if(!_0x3b3d94)throw new Error(_0x48fb('0x56'));if(_0x3b3d94[_0x48fb('0x57')]===_0x48fb('0x55')){var _0x4edfdb=_0x2c4a3a['get']({'plain':!![]});return db[_0x48fb('0x58')][_0x48fb('0x4c')]({'where':{'name':_0x48fb('0x28'),'userProfileId':_0x3b3d94[_0x48fb('0x59')]},'raw':!![]})[_0x48fb('0x25')](function(_0x5db2b4){if(_0x5db2b4&&_0x5db2b4['autoAssociation']===0x0){return db[_0x48fb('0x29')][_0x48fb('0x54')]({'name':_0x4edfdb[_0x48fb('0x2c')],'resourceId':_0x4edfdb['id'],'type':_0x5db2b4['name'],'sectionId':_0x5db2b4['id']},{})['then'](function(){return _0x2c4a3a;});}else{return _0x2c4a3a;}})[_0x48fb('0x48')](function(_0xa5530){logger[_0x48fb('0x2a')](_0x48fb('0x5a'),_0xa5530);throw _0xa5530;});}return _0x2c4a3a;})[_0x48fb('0x25')](respondWithResult(_0x510dd2,0xc9))[_0x48fb('0x48')](handleError(_0x510dd2,null));}; \ No newline at end of file +var _0x1c56=['include','rows','params','keys','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','CannedAnswers','UserProfileResource','error','name','send','index','map','CannedAnswer','rawAttributes','fieldName','type','key','query','intersection','model','fields','attributes','hasOwnProperty','order','sort','where','filters','merge','filter','options','includeAll'];(function(_0x284240,_0x555b56){var _0x390667=function(_0x409454){while(--_0x409454){_0x284240['push'](_0x284240['shift']());}};_0x390667(++_0x555b56);}(_0x1c56,0x16c));var _0x61c5=function(_0x3e2489,_0x41d9dd){_0x3e2489=_0x3e2489-0x0;var _0x2254ce=_0x1c56[_0x3e2489];return _0x2254ce;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x61c5('0x0'));var rp=require(_0x61c5('0x1'));var moment=require(_0x61c5('0x2'));var BPromise=require(_0x61c5('0x3'));var Mustache=require(_0x61c5('0x4'));var util=require(_0x61c5('0x5'));var path=require('path');var sox=require(_0x61c5('0x6'));var csv=require(_0x61c5('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x61c5('0x8'));var _=require(_0x61c5('0x9'));var squel=require('squel');var crypto=require(_0x61c5('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x61c5('0xb'));var toCsv=require(_0x61c5('0x7'));var querystring=require(_0x61c5('0xc'));var Papa=require(_0x61c5('0xd'));var Redis=require(_0x61c5('0xe'));var authService=require(_0x61c5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x61c5('0x10'));var hardwareService=require(_0x61c5('0x11'));var logger=require(_0x61c5('0x12'))(_0x61c5('0x13'));var utils=require(_0x61c5('0x14'));var config=require(_0x61c5('0x15'));var licenseUtil=require(_0x61c5('0x16'));var db=require(_0x61c5('0x17'))['db'];function respondWithStatusCode(_0x876bdb,_0x401f6d){_0x401f6d=_0x401f6d||0xcc;return function(_0xd97963){if(_0xd97963){return _0x876bdb[_0x61c5('0x18')](_0x401f6d);}return _0x876bdb['status'](_0x401f6d)[_0x61c5('0x19')]();};}function respondWithResult(_0x47cf37,_0x268a9f){_0x268a9f=_0x268a9f||0xc8;return function(_0x476a33){if(_0x476a33){return _0x47cf37[_0x61c5('0x1a')](_0x268a9f)[_0x61c5('0x1b')](_0x476a33);}};}function respondWithFilteredResult(_0x3e60ca,_0x517947){return function(_0x3935d8){if(_0x3935d8){var _0x27e6b5=typeof _0x517947[_0x61c5('0x1c')]===_0x61c5('0x1d')&&typeof _0x517947[_0x61c5('0x1e')]===_0x61c5('0x1d');var _0x2d2243=_0x3935d8[_0x61c5('0x1f')];var _0x3f79b5=_0x27e6b5?0x0:_0x517947[_0x61c5('0x1c')];var _0x151e50=_0x27e6b5?_0x3935d8[_0x61c5('0x1f')]:_0x517947['offset']+_0x517947[_0x61c5('0x1e')];var _0x32a9d;if(_0x151e50>=_0x2d2243){_0x151e50=_0x2d2243;_0x32a9d=0xc8;}else{_0x32a9d=0xce;}_0x3e60ca[_0x61c5('0x1a')](_0x32a9d);return _0x3e60ca[_0x61c5('0x20')]('Content-Range',_0x3f79b5+'-'+_0x151e50+'/'+_0x2d2243)['json'](_0x3935d8);}return null;};}function patchUpdates(_0x42348e){return function(_0x5170df){try{jsonpatch[_0x61c5('0x21')](_0x5170df,_0x42348e,!![]);}catch(_0xadb7a4){return BPromise[_0x61c5('0x22')](_0xadb7a4);}return _0x5170df[_0x61c5('0x23')]();};}function saveUpdates(_0x427e64,_0x1b49b9){return function(_0x2b7550){if(_0x2b7550){return _0x2b7550[_0x61c5('0x24')](_0x427e64)[_0x61c5('0x25')](function(_0x4af34e){return _0x4af34e;});}return null;};}function removeEntity(_0x1dc31c,_0x2ce7c6){return function(_0x26660b){if(_0x26660b){return _0x26660b[_0x61c5('0x26')]()['then'](function(){var _0x524696=_0x26660b[_0x61c5('0x27')]({'plain':!![]});var _0x1cae64=_0x61c5('0x28');return db[_0x61c5('0x29')][_0x61c5('0x26')]({'where':{'type':_0x1cae64,'resourceId':_0x524696['id']}})[_0x61c5('0x25')](function(){return _0x26660b;});})[_0x61c5('0x25')](function(){_0x1dc31c[_0x61c5('0x1a')](0xcc)[_0x61c5('0x19')]();});}};}function handleEntityNotFound(_0x426da1,_0x29c44f){return function(_0x395738){if(!_0x395738){_0x426da1[_0x61c5('0x18')](0x194);}return _0x395738;};}function handleError(_0x42f23d,_0xfd44ef){_0xfd44ef=_0xfd44ef||0x1f4;return function(_0x1e0a89){logger[_0x61c5('0x2a')](_0x1e0a89['stack']);if(_0x1e0a89['name']){delete _0x1e0a89[_0x61c5('0x2b')];}_0x42f23d[_0x61c5('0x1a')](_0xfd44ef)[_0x61c5('0x2c')](_0x1e0a89);};}exports[_0x61c5('0x2d')]=function(_0x198946,_0x2778a1){var _0x3a4e14={},_0x1f2a39={},_0x1b056e={'count':0x0,'rows':[]};var _0x26fe77=_[_0x61c5('0x2e')](db[_0x61c5('0x2f')][_0x61c5('0x30')],function(_0x540f50){return{'name':_0x540f50[_0x61c5('0x31')],'type':_0x540f50[_0x61c5('0x32')][_0x61c5('0x33')]};});_0x1f2a39['model']=_['map'](_0x26fe77,_0x61c5('0x2b'));_0x1f2a39[_0x61c5('0x34')]=_['keys'](_0x198946[_0x61c5('0x34')]);_0x1f2a39['filters']=_[_0x61c5('0x35')](_0x1f2a39[_0x61c5('0x36')],_0x1f2a39[_0x61c5('0x34')]);_0x3a4e14['attributes']=_[_0x61c5('0x35')](_0x1f2a39['model'],qs[_0x61c5('0x37')](_0x198946['query'][_0x61c5('0x37')]));_0x3a4e14['attributes']=_0x3a4e14[_0x61c5('0x38')]['length']?_0x3a4e14[_0x61c5('0x38')]:_0x1f2a39[_0x61c5('0x36')];if(!_0x198946[_0x61c5('0x34')][_0x61c5('0x39')]('nolimit')){_0x3a4e14['limit']=qs[_0x61c5('0x1e')](_0x198946[_0x61c5('0x34')]['limit']);_0x3a4e14[_0x61c5('0x1c')]=qs['offset'](_0x198946[_0x61c5('0x34')][_0x61c5('0x1c')]);}_0x3a4e14[_0x61c5('0x3a')]=qs['sort'](_0x198946['query'][_0x61c5('0x3b')]);_0x3a4e14[_0x61c5('0x3c')]=qs[_0x61c5('0x3d')](_['pick'](_0x198946[_0x61c5('0x34')],_0x1f2a39[_0x61c5('0x3d')]),_0x26fe77);if(_0x198946['query']['filter']){_0x3a4e14[_0x61c5('0x3c')]=_[_0x61c5('0x3e')](_0x3a4e14[_0x61c5('0x3c')],{'$or':[{'key':{'$like':'%'+_0x198946[_0x61c5('0x34')][_0x61c5('0x3f')]+'%'}},{'value':{'$like':'%'+_0x198946[_0x61c5('0x34')]['filter']+'%'}}]});}_0x3a4e14=_[_0x61c5('0x3e')]({},_0x3a4e14,_0x198946[_0x61c5('0x40')]);var _0x4186df={'where':_0x3a4e14[_0x61c5('0x3c')]};return db['CannedAnswer'][_0x61c5('0x1f')](_0x4186df)['then'](function(_0x44de16){_0x1b056e['count']=_0x44de16;if(_0x198946['query'][_0x61c5('0x41')]){_0x3a4e14[_0x61c5('0x42')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x3a4e14);})[_0x61c5('0x25')](function(_0x392220){_0x1b056e[_0x61c5('0x43')]=_0x392220;return _0x1b056e;})[_0x61c5('0x25')](respondWithFilteredResult(_0x2778a1,_0x3a4e14))['catch'](handleError(_0x2778a1,null));};exports['show']=function(_0x2430f8,_0x43e3d5){var _0x3129e8={'raw':!![],'where':{'id':_0x2430f8[_0x61c5('0x44')]['id']}},_0xb7b0c2={};_0xb7b0c2[_0x61c5('0x36')]=_[_0x61c5('0x45')](db['CannedAnswer']['rawAttributes']);_0xb7b0c2[_0x61c5('0x34')]=_['keys'](_0x2430f8['query']);_0xb7b0c2[_0x61c5('0x3d')]=_[_0x61c5('0x35')](_0xb7b0c2[_0x61c5('0x36')],_0xb7b0c2[_0x61c5('0x34')]);_0x3129e8[_0x61c5('0x38')]=_['intersection'](_0xb7b0c2[_0x61c5('0x36')],qs[_0x61c5('0x37')](_0x2430f8[_0x61c5('0x34')][_0x61c5('0x37')]));_0x3129e8[_0x61c5('0x38')]=_0x3129e8['attributes']['length']?_0x3129e8[_0x61c5('0x38')]:_0xb7b0c2['model'];if(_0x2430f8[_0x61c5('0x34')][_0x61c5('0x41')]){_0x3129e8['include']=[{'all':!![]}];}_0x3129e8=_[_0x61c5('0x3e')]({},_0x3129e8,_0x2430f8[_0x61c5('0x40')]);return db['CannedAnswer'][_0x61c5('0x46')](_0x3129e8)[_0x61c5('0x25')](handleEntityNotFound(_0x43e3d5,null))['then'](respondWithResult(_0x43e3d5,null))['catch'](handleError(_0x43e3d5,null));};exports['update']=function(_0x5446db,_0x4b1ae5){if(_0x5446db[_0x61c5('0x47')]['id']){delete _0x5446db[_0x61c5('0x47')]['id'];}return db['CannedAnswer'][_0x61c5('0x46')]({'where':{'id':_0x5446db[_0x61c5('0x44')]['id']}})[_0x61c5('0x25')](handleEntityNotFound(_0x4b1ae5,null))[_0x61c5('0x25')](saveUpdates(_0x5446db['body'],null))[_0x61c5('0x25')](respondWithResult(_0x4b1ae5,null))['catch'](handleError(_0x4b1ae5,null));};exports[_0x61c5('0x26')]=function(_0x5ecf66,_0x3efa82){return db[_0x61c5('0x2f')][_0x61c5('0x46')]({'where':{'id':_0x5ecf66[_0x61c5('0x44')]['id']}})[_0x61c5('0x25')](handleEntityNotFound(_0x3efa82,null))[_0x61c5('0x25')](removeEntity(_0x3efa82,null))['catch'](handleError(_0x3efa82,null));};exports[_0x61c5('0x48')]=function(_0x20810c,_0xfdd584){var _0x3ff992={'key':_0x20810c['body'][_0x61c5('0x33')]};if(_0x20810c['body'][_0x61c5('0x49')]){_0x3ff992['MailAccountId']=_0x20810c['body'][_0x61c5('0x49')];}else if(_0x20810c[_0x61c5('0x47')][_0x61c5('0x4a')]){_0x3ff992[_0x61c5('0x4a')]=_0x20810c[_0x61c5('0x47')][_0x61c5('0x4a')];}else if(_0x20810c[_0x61c5('0x47')][_0x61c5('0x4b')]){_0x3ff992[_0x61c5('0x4b')]=_0x20810c[_0x61c5('0x47')][_0x61c5('0x4b')];}else if(_0x20810c[_0x61c5('0x47')]['ChatWebsiteId']){_0x3ff992['ChatWebsiteId']=_0x20810c[_0x61c5('0x47')][_0x61c5('0x4c')];}return db[_0x61c5('0x2f')][_0x61c5('0x46')]({'where':_0x3ff992})['then'](function(_0x31f109){if(_0x31f109){throw new db[(_0x61c5('0x4d'))][(_0x61c5('0x4e'))]('The\x20inserted\x20key\x20already\x20exists.');}return db[_0x61c5('0x2f')][_0x61c5('0x48')](_0x20810c[_0x61c5('0x47')]);})[_0x61c5('0x25')](function(_0x59ba8a){var _0x450c3e=_0x20810c['user']['get']({'plain':!![]});if(!_0x450c3e)throw new Error(_0x61c5('0x4f'));if(_0x450c3e[_0x61c5('0x50')]==='user'){var _0x29be1f=_0x59ba8a[_0x61c5('0x27')]({'plain':!![]});return db[_0x61c5('0x51')][_0x61c5('0x46')]({'where':{'name':_0x61c5('0x28'),'userProfileId':_0x450c3e[_0x61c5('0x52')]},'raw':!![]})[_0x61c5('0x25')](function(_0x6dda7e){if(_0x6dda7e&&_0x6dda7e[_0x61c5('0x53')]===0x0){return db[_0x61c5('0x29')][_0x61c5('0x48')]({'name':_0x29be1f[_0x61c5('0x2b')],'resourceId':_0x29be1f['id'],'type':_0x6dda7e['name'],'sectionId':_0x6dda7e['id']},{})['then'](function(){return _0x59ba8a;});}else{return _0x59ba8a;}})[_0x61c5('0x54')](function(_0x40a42d){logger['error'](_0x61c5('0x55'),_0x40a42d);throw _0x40a42d;});}return _0x59ba8a;})[_0x61c5('0x25')](respondWithResult(_0xfdd584,0xc9))[_0x61c5('0x54')](handleError(_0xfdd584,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 93885b7..d7b755b 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 _0x5eff=['./cannedAnswer.attributes','exports','define','tools_canned_answers','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x122d9f,_0x2c9e5b){var _0x41a09e=function(_0x3d9564){while(--_0x3d9564){_0x122d9f['push'](_0x122d9f['shift']());}};_0x41a09e(++_0x2c9e5b);}(_0x5eff,0xc8));var _0xf5ef=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x5eff[_0x1969a7];return _0x3d665f;};'use strict';var _=require(_0xf5ef('0x0'));var util=require(_0xf5ef('0x1'));var logger=require(_0xf5ef('0x2'))(_0xf5ef('0x3'));var moment=require(_0xf5ef('0x4'));var BPromise=require(_0xf5ef('0x5'));var rp=require(_0xf5ef('0x6'));var fs=require('fs');var path=require(_0xf5ef('0x7'));var rimraf=require(_0xf5ef('0x8'));var config=require(_0xf5ef('0x9'));var attributes=require(_0xf5ef('0xa'));module[_0xf5ef('0xb')]=function(_0x4c887e,_0x5ce02d){return _0x4c887e[_0xf5ef('0xc')]('CannedAnswer',attributes,{'tableName':_0xf5ef('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xf5ef('0xe')});}; \ No newline at end of file +var _0x3258=['moment','bluebird','request-promise','path','rimraf','../../config/environment','define','CannedAnswer','tools_canned_answers','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3258,0x88));var _0x8325=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3258[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8325('0x0'));var util=require(_0x8325('0x1'));var logger=require(_0x8325('0x2'))(_0x8325('0x3'));var moment=require(_0x8325('0x4'));var BPromise=require(_0x8325('0x5'));var rp=require(_0x8325('0x6'));var fs=require('fs');var path=require(_0x8325('0x7'));var rimraf=require(_0x8325('0x8'));var config=require(_0x8325('0x9'));var attributes=require('./cannedAnswer.attributes');module['exports']=function(_0x34f7ed,_0x1842bf){return _0x34f7ed[_0x8325('0xa')](_0x8325('0xb'),attributes,{'tableName':_0x8325('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x8325('0xd')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 91af1b7..7228f74 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(_0x5d4904,_0x20f026){var _0x53b6ee=function(_0x586f6b){while(--_0x586f6b){_0x5d4904['push'](_0x5d4904['shift']());}};_0x53b6ee(++_0x20f026);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'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(_0x540958,_0x208159){var _0x553b1b=function(_0x346cd7){while(--_0x346cd7){_0x540958['push'](_0x540958['shift']());}};_0x553b1b(++_0x208159);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'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 9390c03..78b105b 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 _0xc149=['exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','/:id','show','post','create','put','update','destroy'];(function(_0x371e61,_0x46d926){var _0x1af1dd=function(_0x4516cd){while(--_0x4516cd){_0x371e61['push'](_0x371e61['shift']());}};_0x1af1dd(++_0x46d926);}(_0xc149,0x190));var _0x9c14=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xc149[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x9c14('0x0'));var util=require('util');var path=require(_0x9c14('0x1'));var timeout=require(_0x9c14('0x2'));var express=require(_0x9c14('0x3'));var router=express[_0x9c14('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9c14('0x5'));var interaction=require(_0x9c14('0x6'));var config=require(_0x9c14('0x7'));var controller=require(_0x9c14('0x8'));router[_0x9c14('0x9')]('/',auth[_0x9c14('0xa')](),controller['index']);router[_0x9c14('0x9')](_0x9c14('0xb'),auth[_0x9c14('0xa')](),controller[_0x9c14('0xc')]);router[_0x9c14('0xd')]('/',auth[_0x9c14('0xa')](),controller[_0x9c14('0xe')]);router[_0x9c14('0xf')](_0x9c14('0xb'),auth['isAuthenticated'](),controller[_0x9c14('0x10')]);router['delete'](_0x9c14('0xb'),auth[_0x9c14('0xa')](),controller[_0x9c14('0x11')]);module[_0x9c14('0x12')]=router; \ No newline at end of file +var _0x9889=['create','update','delete','exports','multer','connect-timeout','express','Router','../../config/environment','get','index','/:id','isAuthenticated','show','post'];(function(_0x8a878f,_0xece4ef){var _0x3e61fb=function(_0x366fb){while(--_0x366fb){_0x8a878f['push'](_0x8a878f['shift']());}};_0x3e61fb(++_0xece4ef);}(_0x9889,0x17b));var _0x9988=function(_0x59820d,_0xc8e6ba){_0x59820d=_0x59820d-0x0;var _0x3c72b1=_0x9889[_0x59820d];return _0x3c72b1;};'use strict';var multer=require(_0x9988('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9988('0x1'));var express=require(_0x9988('0x2'));var router=express[_0x9988('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9988('0x4'));var controller=require('./cannedAnswer.controller');router[_0x9988('0x5')]('/',auth['isAuthenticated'](),controller[_0x9988('0x6')]);router[_0x9988('0x5')](_0x9988('0x7'),auth[_0x9988('0x8')](),controller[_0x9988('0x9')]);router[_0x9988('0xa')]('/',auth[_0x9988('0x8')](),controller[_0x9988('0xb')]);router['put'](_0x9988('0x7'),auth[_0x9988('0x8')](),controller[_0x9988('0xc')]);router[_0x9988('0xd')](_0x9988('0x7'),auth[_0x9988('0x8')](),controller['destroy']);module[_0x9988('0xe')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index c53f9e0..b82de01 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 _0x1978=['STRING','INTEGER','exports','DATE','1970-01-01\x2000:00:01'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x1978,0x174));var _0x8197=function(_0x1a4176,_0x21a635){_0x1a4176=_0x1a4176-0x0;var _0x3df9c0=_0x1978[_0x1a4176];return _0x3df9c0;};'use strict';var Sequelize=require('sequelize');module[_0x8197('0x0')]={'calldate':{'type':Sequelize[_0x8197('0x1')],'allowNull':![],'defaultValue':_0x8197('0x2')},'clid':{'type':Sequelize[_0x8197('0x3')]},'src':{'type':Sequelize[_0x8197('0x3')]},'dst':{'type':Sequelize[_0x8197('0x3')]},'dcontext':{'type':Sequelize[_0x8197('0x3')]},'channel':{'type':Sequelize[_0x8197('0x3')]},'dstchannel':{'type':Sequelize[_0x8197('0x3')]},'lastapp':{'type':Sequelize[_0x8197('0x3')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x8197('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x8197('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x8197('0x3')]},'amaflags':{'type':Sequelize[_0x8197('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x8197('0x3')]},'userfield':{'type':Sequelize[_0x8197('0x3')]},'uniqueid':{'type':Sequelize[_0x8197('0x3')]},'linkedid':{'type':Sequelize[_0x8197('0x3')]},'sequence':{'type':Sequelize[_0x8197('0x3')]},'peeraccount':{'type':Sequelize[_0x8197('0x3')]},'type':{'type':Sequelize[_0x8197('0x3')]},'tag':{'type':Sequelize[_0x8197('0x3')]}}; \ No newline at end of file +var _0xf00e=['1970-01-01\x2000:00:01','STRING','INTEGER','sequelize','exports','DATE'];(function(_0x41604c,_0x3fb07c){var _0x1ea71a=function(_0x2c3ec2){while(--_0x2c3ec2){_0x41604c['push'](_0x41604c['shift']());}};_0x1ea71a(++_0x3fb07c);}(_0xf00e,0x12f));var _0xef00=function(_0x5d4fc6,_0x52f8c3){_0x5d4fc6=_0x5d4fc6-0x0;var _0x4d5b86=_0xf00e[_0x5d4fc6];return _0x4d5b86;};'use strict';var Sequelize=require(_0xef00('0x0'));module[_0xef00('0x1')]={'calldate':{'type':Sequelize[_0xef00('0x2')],'allowNull':![],'defaultValue':_0xef00('0x3')},'clid':{'type':Sequelize[_0xef00('0x4')]},'src':{'type':Sequelize[_0xef00('0x4')]},'dst':{'type':Sequelize[_0xef00('0x4')]},'dcontext':{'type':Sequelize[_0xef00('0x4')]},'channel':{'type':Sequelize[_0xef00('0x4')]},'dstchannel':{'type':Sequelize[_0xef00('0x4')]},'lastapp':{'type':Sequelize[_0xef00('0x4')]},'lastdata':{'type':Sequelize[_0xef00('0x4')]},'duration':{'type':Sequelize[_0xef00('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xef00('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xef00('0x4')]},'amaflags':{'type':Sequelize[_0xef00('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xef00('0x4')]},'userfield':{'type':Sequelize[_0xef00('0x4')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xef00('0x4')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xef00('0x4')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 266c28f..aa3bf63 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 _0x1dcc=['then','destroy','error','stack','name','send','map','Cdr','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','type','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','to-csv','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','undefined','limit','offset','set','Content-Range','reject','save','update'];(function(_0x24cd43,_0x5e3408){var _0x3bc3ac=function(_0x528fc1){while(--_0x528fc1){_0x24cd43['push'](_0x24cd43['shift']());}};_0x3bc3ac(++_0x5e3408);}(_0x1dcc,0x1ea));var _0xc1dc=function(_0x24ed1c,_0x6993c3){_0x24ed1c=_0x24ed1c-0x0;var _0x1516a9=_0x1dcc[_0x24ed1c];return _0x1516a9;};'use strict';var emlformat=require(_0xc1dc('0x0'));var rimraf=require(_0xc1dc('0x1'));var zipdir=require(_0xc1dc('0x2'));var jsonpatch=require(_0xc1dc('0x3'));var rp=require('request-promise');var moment=require(_0xc1dc('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc1dc('0x5'));var util=require(_0xc1dc('0x6'));var path=require(_0xc1dc('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc1dc('0x8'));var fs=require('fs');var fs_extra=require(_0xc1dc('0x9'));var _=require(_0xc1dc('0xa'));var squel=require('squel');var crypto=require(_0xc1dc('0xb'));var jsforce=require(_0xc1dc('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xc1dc('0xd'));var querystring=require('querystring');var Papa=require(_0xc1dc('0xe'));var Redis=require('ioredis');var authService=require(_0xc1dc('0xf'));var qs=require(_0xc1dc('0x10'));var as=require(_0xc1dc('0x11'));var hardwareService=require(_0xc1dc('0x12'));var logger=require(_0xc1dc('0x13'))(_0xc1dc('0x14'));var utils=require(_0xc1dc('0x15'));var config=require(_0xc1dc('0x16'));var licenseUtil=require(_0xc1dc('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x226ba3,_0x2c5f41){_0x2c5f41=_0x2c5f41||0xcc;return function(_0xb7e667){if(_0xb7e667){return _0x226ba3['sendStatus'](_0x2c5f41);}return _0x226ba3[_0xc1dc('0x18')](_0x2c5f41)[_0xc1dc('0x19')]();};}function respondWithResult(_0x299520,_0xd51b1e){_0xd51b1e=_0xd51b1e||0xc8;return function(_0x145708){if(_0x145708){return _0x299520[_0xc1dc('0x18')](_0xd51b1e)[_0xc1dc('0x1a')](_0x145708);}};}function respondWithFilteredResult(_0x21aed1,_0x265929){return function(_0x37b23a){if(_0x37b23a){var _0x1cbbfe=typeof _0x265929['offset']===_0xc1dc('0x1b')&&typeof _0x265929[_0xc1dc('0x1c')]===_0xc1dc('0x1b');var _0x3d3315=_0x37b23a['count'];var _0x332400=_0x1cbbfe?0x0:_0x265929[_0xc1dc('0x1d')];var _0x499a42=_0x1cbbfe?_0x37b23a['count']:_0x265929[_0xc1dc('0x1d')]+_0x265929[_0xc1dc('0x1c')];var _0x197941;if(_0x499a42>=_0x3d3315){_0x499a42=_0x3d3315;_0x197941=0xc8;}else{_0x197941=0xce;}_0x21aed1[_0xc1dc('0x18')](_0x197941);return _0x21aed1[_0xc1dc('0x1e')](_0xc1dc('0x1f'),_0x332400+'-'+_0x499a42+'/'+_0x3d3315)[_0xc1dc('0x1a')](_0x37b23a);}return null;};}function patchUpdates(_0xd5a2e){return function(_0x5762e5){try{jsonpatch['apply'](_0x5762e5,_0xd5a2e,!![]);}catch(_0x4efe0d){return BPromise[_0xc1dc('0x20')](_0x4efe0d);}return _0x5762e5[_0xc1dc('0x21')]();};}function saveUpdates(_0x47af1e,_0x367965){return function(_0x19325f){if(_0x19325f){return _0x19325f[_0xc1dc('0x22')](_0x47af1e)[_0xc1dc('0x23')](function(_0x22b80d){return _0x22b80d;});}return null;};}function removeEntity(_0x2944a2,_0x353bf3){return function(_0x18ba56){if(_0x18ba56){return _0x18ba56[_0xc1dc('0x24')]()[_0xc1dc('0x23')](function(){_0x2944a2['status'](0xcc)[_0xc1dc('0x19')]();});}};}function handleEntityNotFound(_0xfeb0b1,_0x17ce2b){return function(_0x52b0b9){if(!_0x52b0b9){_0xfeb0b1['sendStatus'](0x194);}return _0x52b0b9;};}function handleError(_0x296523,_0x109e88){_0x109e88=_0x109e88||0x1f4;return function(_0xfd3f88){logger[_0xc1dc('0x25')](_0xfd3f88[_0xc1dc('0x26')]);if(_0xfd3f88[_0xc1dc('0x27')]){delete _0xfd3f88[_0xc1dc('0x27')];}_0x296523[_0xc1dc('0x18')](_0x109e88)[_0xc1dc('0x28')](_0xfd3f88);};}exports['index']=function(_0x2d5a57,_0x25b7bf){var _0xd77537={},_0x27e54d={},_0x52b0ff={'count':0x0,'rows':[]};var _0x4750a9=_[_0xc1dc('0x29')](db[_0xc1dc('0x2a')][_0xc1dc('0x2b')],function(_0x1182a4){return{'name':_0x1182a4[_0xc1dc('0x2c')],'type':_0x1182a4['type'][_0xc1dc('0x2d')]};});_0x27e54d[_0xc1dc('0x2e')]=_[_0xc1dc('0x29')](_0x4750a9,_0xc1dc('0x27'));_0x27e54d[_0xc1dc('0x2f')]=_[_0xc1dc('0x30')](_0x2d5a57[_0xc1dc('0x2f')]);_0x27e54d[_0xc1dc('0x31')]=_[_0xc1dc('0x32')](_0x27e54d['model'],_0x27e54d['query']);_0xd77537[_0xc1dc('0x33')]=_[_0xc1dc('0x32')](_0x27e54d[_0xc1dc('0x2e')],qs[_0xc1dc('0x34')](_0x2d5a57[_0xc1dc('0x2f')][_0xc1dc('0x34')]));_0xd77537['attributes']=_0xd77537[_0xc1dc('0x33')][_0xc1dc('0x35')]?_0xd77537['attributes']:_0x27e54d[_0xc1dc('0x2e')];if(!_0x2d5a57[_0xc1dc('0x2f')]['hasOwnProperty'](_0xc1dc('0x36'))){_0xd77537[_0xc1dc('0x1c')]=qs[_0xc1dc('0x1c')](_0x2d5a57['query'][_0xc1dc('0x1c')]);_0xd77537[_0xc1dc('0x1d')]=qs[_0xc1dc('0x1d')](_0x2d5a57[_0xc1dc('0x2f')][_0xc1dc('0x1d')]);}_0xd77537[_0xc1dc('0x37')]=qs[_0xc1dc('0x38')](_0x2d5a57[_0xc1dc('0x2f')][_0xc1dc('0x38')]);_0xd77537['where']=qs[_0xc1dc('0x31')](_[_0xc1dc('0x39')](_0x2d5a57[_0xc1dc('0x2f')],_0x27e54d['filters']),_0x4750a9);if(_0x2d5a57[_0xc1dc('0x2f')][_0xc1dc('0x3a')]){_0xd77537[_0xc1dc('0x3b')]=_[_0xc1dc('0x3c')](_0xd77537[_0xc1dc('0x3b')],{'$or':_[_0xc1dc('0x29')](_0x4750a9,function(_0x2e8d34){if(_0x2e8d34[_0xc1dc('0x3d')]!=='VIRTUAL'){var _0x16356d={};_0x16356d[_0x2e8d34[_0xc1dc('0x27')]]={'$like':'%'+_0x2d5a57[_0xc1dc('0x2f')][_0xc1dc('0x3a')]+'%'};return _0x16356d;}})});}_0xd77537=_[_0xc1dc('0x3c')]({},_0xd77537,_0x2d5a57[_0xc1dc('0x3e')]);var _0x503ec8={'where':_0xd77537[_0xc1dc('0x3b')]};return db[_0xc1dc('0x2a')][_0xc1dc('0x3f')](_0x503ec8)[_0xc1dc('0x23')](function(_0x1bcf3d){_0x52b0ff['count']=_0x1bcf3d;if(_0x2d5a57['query'][_0xc1dc('0x40')]){_0xd77537[_0xc1dc('0x41')]=[{'all':!![]}];}return db[_0xc1dc('0x2a')][_0xc1dc('0x42')](_0xd77537);})[_0xc1dc('0x23')](function(_0x2b4190){_0x52b0ff[_0xc1dc('0x43')]=_0x2b4190;return _0x52b0ff;})['then'](respondWithFilteredResult(_0x25b7bf,_0xd77537))[_0xc1dc('0x44')](handleError(_0x25b7bf,null));};exports[_0xc1dc('0x45')]=function(_0xe5c170,_0x4f99ea){var _0x402d3a={'raw':!![],'where':{'id':_0xe5c170[_0xc1dc('0x46')]['id']}},_0x2f52f7={};_0x2f52f7[_0xc1dc('0x2e')]=_['keys'](db['Cdr'][_0xc1dc('0x2b')]);_0x2f52f7[_0xc1dc('0x2f')]=_['keys'](_0xe5c170[_0xc1dc('0x2f')]);_0x2f52f7[_0xc1dc('0x31')]=_[_0xc1dc('0x32')](_0x2f52f7[_0xc1dc('0x2e')],_0x2f52f7[_0xc1dc('0x2f')]);_0x402d3a[_0xc1dc('0x33')]=_[_0xc1dc('0x32')](_0x2f52f7['model'],qs['fields'](_0xe5c170[_0xc1dc('0x2f')]['fields']));_0x402d3a[_0xc1dc('0x33')]=_0x402d3a[_0xc1dc('0x33')][_0xc1dc('0x35')]?_0x402d3a[_0xc1dc('0x33')]:_0x2f52f7[_0xc1dc('0x2e')];if(_0xe5c170[_0xc1dc('0x2f')][_0xc1dc('0x40')]){_0x402d3a[_0xc1dc('0x41')]=[{'all':!![]}];}_0x402d3a=_['merge']({},_0x402d3a,_0xe5c170[_0xc1dc('0x3e')]);return db[_0xc1dc('0x2a')][_0xc1dc('0x47')](_0x402d3a)[_0xc1dc('0x23')](handleEntityNotFound(_0x4f99ea,null))[_0xc1dc('0x23')](respondWithResult(_0x4f99ea,null))[_0xc1dc('0x44')](handleError(_0x4f99ea,null));};exports[_0xc1dc('0x48')]=function(_0x9a48b7,_0x2ca7f1){return db[_0xc1dc('0x2a')]['create'](_0x9a48b7['body'],{})['then'](respondWithResult(_0x2ca7f1,0xc9))[_0xc1dc('0x44')](handleError(_0x2ca7f1,null));};exports[_0xc1dc('0x22')]=function(_0x57b792,_0x129e23){if(_0x57b792[_0xc1dc('0x49')]['id']){delete _0x57b792['body']['id'];}return db[_0xc1dc('0x2a')]['find']({'where':{'id':_0x57b792[_0xc1dc('0x46')]['id']}})[_0xc1dc('0x23')](handleEntityNotFound(_0x129e23,null))[_0xc1dc('0x23')](saveUpdates(_0x57b792[_0xc1dc('0x49')],null))[_0xc1dc('0x23')](respondWithResult(_0x129e23,null))[_0xc1dc('0x44')](handleError(_0x129e23,null));};exports[_0xc1dc('0x24')]=function(_0x34667b,_0x4d4240){return db[_0xc1dc('0x2a')][_0xc1dc('0x47')]({'where':{'id':_0x34667b[_0xc1dc('0x46')]['id']}})[_0xc1dc('0x23')](handleEntityNotFound(_0x4d4240,null))['then'](removeEntity(_0x4d4240,null))[_0xc1dc('0x44')](handleError(_0x4d4240,null));};exports[_0xc1dc('0x4a')]=function(_0x3e3e6c,_0x1755cb){return db[_0xc1dc('0x2a')][_0xc1dc('0x4a')]()[_0xc1dc('0x23')](respondWithResult(_0x1755cb,null))[_0xc1dc('0x44')](handleError(_0x1755cb,null));}; \ No newline at end of file +var _0x6596=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','destroy','then','error','name','index','map','Cdr','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','filter','merge','options','findAll','rows','show','params','length','includeAll','find','catch','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse'];(function(_0x3b8e1d,_0x297f8f){var _0x10bd1e=function(_0x3ed062){while(--_0x3ed062){_0x3b8e1d['push'](_0x3b8e1d['shift']());}};_0x10bd1e(++_0x297f8f);}(_0x6596,0x1d3));var _0x6659=function(_0x2f398e,_0x3cc0f9){_0x2f398e=_0x2f398e-0x0;var _0x5ae0eb=_0x6596[_0x2f398e];return _0x5ae0eb;};'use strict';var emlformat=require(_0x6659('0x0'));var rimraf=require(_0x6659('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6659('0x2'));var rp=require(_0x6659('0x3'));var moment=require(_0x6659('0x4'));var BPromise=require(_0x6659('0x5'));var Mustache=require(_0x6659('0x6'));var util=require(_0x6659('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x6659('0x8'));var ejs=require(_0x6659('0x9'));var fs=require('fs');var fs_extra=require(_0x6659('0xa'));var _=require(_0x6659('0xb'));var squel=require(_0x6659('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6659('0xd'));var toCsv=require(_0x6659('0x8'));var querystring=require(_0x6659('0xe'));var Papa=require(_0x6659('0xf'));var Redis=require(_0x6659('0x10'));var authService=require(_0x6659('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x6659('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6659('0x13'));var utils=require('../../config/utils');var config=require(_0x6659('0x14'));var licenseUtil=require(_0x6659('0x15'));var db=require(_0x6659('0x16'))['db'];function respondWithStatusCode(_0x438f95,_0x581baa){_0x581baa=_0x581baa||0xcc;return function(_0x3d68c5){if(_0x3d68c5){return _0x438f95[_0x6659('0x17')](_0x581baa);}return _0x438f95['status'](_0x581baa)[_0x6659('0x18')]();};}function respondWithResult(_0x2fd7da,_0x4238a7){_0x4238a7=_0x4238a7||0xc8;return function(_0x346cb6){if(_0x346cb6){return _0x2fd7da[_0x6659('0x19')](_0x4238a7)[_0x6659('0x1a')](_0x346cb6);}};}function respondWithFilteredResult(_0x5b5c16,_0x3246f1){return function(_0x36707c){if(_0x36707c){var _0x1ddce3=typeof _0x3246f1[_0x6659('0x1b')]===_0x6659('0x1c')&&typeof _0x3246f1[_0x6659('0x1d')]==='undefined';var _0x5b7658=_0x36707c[_0x6659('0x1e')];var _0x5e89f1=_0x1ddce3?0x0:_0x3246f1[_0x6659('0x1b')];var _0x38e4d6=_0x1ddce3?_0x36707c['count']:_0x3246f1[_0x6659('0x1b')]+_0x3246f1['limit'];var _0xa5e094;if(_0x38e4d6>=_0x5b7658){_0x38e4d6=_0x5b7658;_0xa5e094=0xc8;}else{_0xa5e094=0xce;}_0x5b5c16[_0x6659('0x19')](_0xa5e094);return _0x5b5c16['set'](_0x6659('0x1f'),_0x5e89f1+'-'+_0x38e4d6+'/'+_0x5b7658)[_0x6659('0x1a')](_0x36707c);}return null;};}function patchUpdates(_0x332d2c){return function(_0x3e139a){try{jsonpatch[_0x6659('0x20')](_0x3e139a,_0x332d2c,!![]);}catch(_0x3e1f83){return BPromise[_0x6659('0x21')](_0x3e1f83);}return _0x3e139a['save']();};}function saveUpdates(_0x2b4cce,_0x3506fd){return function(_0x314e40){if(_0x314e40){return _0x314e40[_0x6659('0x22')](_0x2b4cce)['then'](function(_0x4ce553){return _0x4ce553;});}return null;};}function removeEntity(_0x5a5e04,_0x564357){return function(_0xbad53f){if(_0xbad53f){return _0xbad53f[_0x6659('0x23')]()[_0x6659('0x24')](function(){_0x5a5e04[_0x6659('0x19')](0xcc)[_0x6659('0x18')]();});}};}function handleEntityNotFound(_0x12b218,_0x436691){return function(_0x3cb0dc){if(!_0x3cb0dc){_0x12b218[_0x6659('0x17')](0x194);}return _0x3cb0dc;};}function handleError(_0x5f48d6,_0x187571){_0x187571=_0x187571||0x1f4;return function(_0x373a3d){logger[_0x6659('0x25')](_0x373a3d['stack']);if(_0x373a3d['name']){delete _0x373a3d[_0x6659('0x26')];}_0x5f48d6[_0x6659('0x19')](_0x187571)['send'](_0x373a3d);};}exports[_0x6659('0x27')]=function(_0x2f5a16,_0x36dab5){var _0xcb5a33={},_0x1b721d={},_0x525b57={'count':0x0,'rows':[]};var _0x23ee05=_[_0x6659('0x28')](db[_0x6659('0x29')][_0x6659('0x2a')],function(_0xc9bd6a){return{'name':_0xc9bd6a['fieldName'],'type':_0xc9bd6a[_0x6659('0x2b')][_0x6659('0x2c')]};});_0x1b721d[_0x6659('0x2d')]=_[_0x6659('0x28')](_0x23ee05,_0x6659('0x26'));_0x1b721d[_0x6659('0x2e')]=_[_0x6659('0x2f')](_0x2f5a16['query']);_0x1b721d[_0x6659('0x30')]=_[_0x6659('0x31')](_0x1b721d['model'],_0x1b721d[_0x6659('0x2e')]);_0xcb5a33['attributes']=_[_0x6659('0x31')](_0x1b721d['model'],qs[_0x6659('0x32')](_0x2f5a16[_0x6659('0x2e')]['fields']));_0xcb5a33['attributes']=_0xcb5a33[_0x6659('0x33')]['length']?_0xcb5a33[_0x6659('0x33')]:_0x1b721d['model'];if(!_0x2f5a16[_0x6659('0x2e')]['hasOwnProperty'](_0x6659('0x34'))){_0xcb5a33[_0x6659('0x1d')]=qs['limit'](_0x2f5a16[_0x6659('0x2e')][_0x6659('0x1d')]);_0xcb5a33[_0x6659('0x1b')]=qs[_0x6659('0x1b')](_0x2f5a16[_0x6659('0x2e')]['offset']);}_0xcb5a33[_0x6659('0x35')]=qs['sort'](_0x2f5a16['query'][_0x6659('0x36')]);_0xcb5a33[_0x6659('0x37')]=qs[_0x6659('0x30')](_['pick'](_0x2f5a16[_0x6659('0x2e')],_0x1b721d['filters']),_0x23ee05);if(_0x2f5a16['query'][_0x6659('0x38')]){_0xcb5a33[_0x6659('0x37')]=_[_0x6659('0x39')](_0xcb5a33[_0x6659('0x37')],{'$or':_[_0x6659('0x28')](_0x23ee05,function(_0x90b64e){if(_0x90b64e[_0x6659('0x2b')]!=='VIRTUAL'){var _0x531a19={};_0x531a19[_0x90b64e[_0x6659('0x26')]]={'$like':'%'+_0x2f5a16[_0x6659('0x2e')][_0x6659('0x38')]+'%'};return _0x531a19;}})});}_0xcb5a33=_['merge']({},_0xcb5a33,_0x2f5a16[_0x6659('0x3a')]);var _0x3e4a93={'where':_0xcb5a33['where']};return db[_0x6659('0x29')][_0x6659('0x1e')](_0x3e4a93)[_0x6659('0x24')](function(_0x2924f4){_0x525b57[_0x6659('0x1e')]=_0x2924f4;if(_0x2f5a16['query']['includeAll']){_0xcb5a33['include']=[{'all':!![]}];}return db['Cdr'][_0x6659('0x3b')](_0xcb5a33);})['then'](function(_0x552282){_0x525b57[_0x6659('0x3c')]=_0x552282;return _0x525b57;})[_0x6659('0x24')](respondWithFilteredResult(_0x36dab5,_0xcb5a33))['catch'](handleError(_0x36dab5,null));};exports[_0x6659('0x3d')]=function(_0x4230cf,_0x55cd09){var _0x176516={'raw':!![],'where':{'id':_0x4230cf[_0x6659('0x3e')]['id']}},_0x3551d4={};_0x3551d4[_0x6659('0x2d')]=_['keys'](db[_0x6659('0x29')]['rawAttributes']);_0x3551d4[_0x6659('0x2e')]=_[_0x6659('0x2f')](_0x4230cf[_0x6659('0x2e')]);_0x3551d4[_0x6659('0x30')]=_[_0x6659('0x31')](_0x3551d4[_0x6659('0x2d')],_0x3551d4['query']);_0x176516['attributes']=_[_0x6659('0x31')](_0x3551d4[_0x6659('0x2d')],qs[_0x6659('0x32')](_0x4230cf[_0x6659('0x2e')][_0x6659('0x32')]));_0x176516[_0x6659('0x33')]=_0x176516[_0x6659('0x33')][_0x6659('0x3f')]?_0x176516[_0x6659('0x33')]:_0x3551d4[_0x6659('0x2d')];if(_0x4230cf['query'][_0x6659('0x40')]){_0x176516['include']=[{'all':!![]}];}_0x176516=_[_0x6659('0x39')]({},_0x176516,_0x4230cf[_0x6659('0x3a')]);return db['Cdr'][_0x6659('0x41')](_0x176516)[_0x6659('0x24')](handleEntityNotFound(_0x55cd09,null))['then'](respondWithResult(_0x55cd09,null))[_0x6659('0x42')](handleError(_0x55cd09,null));};exports[_0x6659('0x43')]=function(_0x6e0e41,_0x304733){return db['Cdr']['create'](_0x6e0e41[_0x6659('0x44')],{})[_0x6659('0x24')](respondWithResult(_0x304733,0xc9))[_0x6659('0x42')](handleError(_0x304733,null));};exports[_0x6659('0x22')]=function(_0x442355,_0x3afc78){if(_0x442355['body']['id']){delete _0x442355[_0x6659('0x44')]['id'];}return db[_0x6659('0x29')]['find']({'where':{'id':_0x442355[_0x6659('0x3e')]['id']}})[_0x6659('0x24')](handleEntityNotFound(_0x3afc78,null))['then'](saveUpdates(_0x442355[_0x6659('0x44')],null))[_0x6659('0x24')](respondWithResult(_0x3afc78,null))[_0x6659('0x42')](handleError(_0x3afc78,null));};exports[_0x6659('0x23')]=function(_0x78c901,_0x1bdf74){return db[_0x6659('0x29')][_0x6659('0x41')]({'where':{'id':_0x78c901[_0x6659('0x3e')]['id']}})[_0x6659('0x24')](handleEntityNotFound(_0x1bdf74,null))[_0x6659('0x24')](removeEntity(_0x1bdf74,null))[_0x6659('0x42')](handleError(_0x1bdf74,null));};exports['describe']=function(_0x4c338b,_0x5fe9bd){return db[_0x6659('0x29')]['describe']()[_0x6659('0x24')](respondWithResult(_0x5fe9bd,null))[_0x6659('0x42')](handleError(_0x5fe9bd,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 3902e3e..b145ee2 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x410f90,_0x1645a7){var _0x28f315=function(_0x1910e5){while(--_0x1910e5){_0x410f90['push'](_0x410f90['shift']());}};_0x28f315(++_0x1645a7);}(_0x7a54,0x106));var _0x47a5=function(_0x4a9f10,_0x33ab41){_0x4a9f10=_0x4a9f10-0x0;var _0x509f78=_0x7a54[_0x4a9f10];return _0x509f78;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x58d94c,_0x5d5109){var _0x278522=function(_0x3260eb){while(--_0x3260eb){_0x58d94c['push'](_0x58d94c['shift']());}};_0x278522(++_0x5d5109);}(_0x7a54,0x106));var _0x47a5=function(_0x558b22,_0x26e91e){_0x558b22=_0x558b22-0x0;var _0x2f119d=_0x7a54[_0x558b22];return _0x2f119d;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 69abc9a..0b7f8b3 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 _0x4266=['stringify','error','code','Cdr,\x20%s,\x20%s','message','info','result','catch','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','debug','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x16bd94,_0x3792be){var _0x47fac4=function(_0x9ee632){while(--_0x9ee632){_0x16bd94['push'](_0x16bd94['shift']());}};_0x47fac4(++_0x3792be);}(_0x4266,0x1eb));var _0x6426=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x4266[_0xd1d19a];return _0x52a79d;};'use strict';var _=require('lodash');var util=require(_0x6426('0x0'));var moment=require(_0x6426('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6426('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x6426('0x3'));var logger=require(_0x6426('0x4'))(_0x6426('0x5'));var config=require(_0x6426('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x6426('0x7')][_0x6426('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x14f63c,_0x3e32d3,_0x3d946a){return new BPromise(function(_0x41283a,_0x392aa6){return client[_0x6426('0x9')](_0x14f63c,_0x3d946a)['then'](function(_0x3391a5){logger['info']('Cdr,\x20%s,\x20%s',_0x3e32d3,'request\x20sent');logger[_0x6426('0xa')](_0x6426('0xb'),_0x3e32d3,_0x6426('0xc'),JSON[_0x6426('0xd')](_0x3391a5));if(_0x3391a5[_0x6426('0xe')]){if(_0x3391a5[_0x6426('0xe')][_0x6426('0xf')]===0x1f4){logger[_0x6426('0xe')](_0x6426('0x10'),_0x3e32d3,_0x3391a5['error']['message']);return _0x392aa6(_0x3391a5['error'][_0x6426('0x11')]);}logger[_0x6426('0xe')](_0x6426('0x10'),_0x3e32d3,_0x3391a5[_0x6426('0xe')][_0x6426('0x11')]);return _0x41283a(_0x3391a5[_0x6426('0xe')][_0x6426('0x11')]);}else{logger[_0x6426('0x12')](_0x6426('0x10'),_0x3e32d3,_0x6426('0xc'));_0x41283a(_0x3391a5[_0x6426('0x13')][_0x6426('0x11')]);}})[_0x6426('0x14')](function(_0x32ae77){logger[_0x6426('0xe')](_0x6426('0x10'),_0x3e32d3,_0x32ae77);_0x392aa6(_0x32ae77);});});} \ No newline at end of file +var _0x3f29=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','Cdr,\x20%s,\x20%s','message','result','catch','lodash','moment'];(function(_0x37e886,_0x17d0ad){var _0x57c5cd=function(_0x2692a3){while(--_0x2692a3){_0x37e886['push'](_0x37e886['shift']());}};_0x57c5cd(++_0x17d0ad);}(_0x3f29,0x106));var _0x93f2=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x3f29[_0x2b5eae];return _0x5f3ac9;};'use strict';var _=require(_0x93f2('0x0'));var util=require('util');var moment=require(_0x93f2('0x1'));var BPromise=require(_0x93f2('0x2'));var rs=require(_0x93f2('0x3'));var fs=require('fs');var Redis=require(_0x93f2('0x4'));var db=require(_0x93f2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x93f2('0x6'))('rpc');var config=require(_0x93f2('0x7'));var jayson=require(_0x93f2('0x8'));var client=jayson[_0x93f2('0x9')][_0x93f2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x51c338,_0x36d248,_0x2b0aac){return new BPromise(function(_0x5dd15b,_0xe4a07d){return client[_0x93f2('0xb')](_0x51c338,_0x2b0aac)[_0x93f2('0xc')](function(_0x3a909c){logger[_0x93f2('0xd')]('Cdr,\x20%s,\x20%s',_0x36d248,_0x93f2('0xe'));logger[_0x93f2('0xf')](_0x93f2('0x10'),_0x36d248,'request\x20sent',JSON[_0x93f2('0x11')](_0x3a909c));if(_0x3a909c['error']){if(_0x3a909c[_0x93f2('0x12')][_0x93f2('0x13')]===0x1f4){logger[_0x93f2('0x12')](_0x93f2('0x14'),_0x36d248,_0x3a909c[_0x93f2('0x12')][_0x93f2('0x15')]);return _0xe4a07d(_0x3a909c['error'][_0x93f2('0x15')]);}logger[_0x93f2('0x12')](_0x93f2('0x14'),_0x36d248,_0x3a909c[_0x93f2('0x12')]['message']);return _0x5dd15b(_0x3a909c[_0x93f2('0x12')][_0x93f2('0x15')]);}else{logger[_0x93f2('0xd')]('Cdr,\x20%s,\x20%s',_0x36d248,_0x93f2('0xe'));_0x5dd15b(_0x3a909c[_0x93f2('0x16')]['message']);}})[_0x93f2('0x17')](function(_0x4cf5a4){logger[_0x93f2('0x12')](_0x93f2('0x14'),_0x36d248,_0x4cf5a4);_0xe4a07d(_0x4cf5a4);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 0a60680..1d0ddf1 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(_0x5e1248,_0x42b862){var _0x1b4201=function(_0x534a23){while(--_0x534a23){_0x5e1248['push'](_0x5e1248['shift']());}};_0x1b4201(++_0x42b862);}(_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(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'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 b945458..ac08f98 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 _0x72e3=['STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x72e3,0x1a8));var _0x372e=function(_0x16aca8,_0x566c87){_0x16aca8=_0x16aca8-0x0;var _0x26c9f9=_0x72e3[_0x16aca8];return _0x26c9f9;};'use strict';var Sequelize=require(_0x372e('0x0'));module[_0x372e('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x372e('0x2')],'allowNull':![],'defaultValue':_0x372e('0x3')},'appdata':{'type':Sequelize[_0x372e('0x4')]()},'description':{'type':Sequelize[_0x372e('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x372e('0x5')}}; \ No newline at end of file +var _0x0e06=['INTEGER','noop','TEXT','sequelize','exports'];(function(_0x12e90d,_0x3a73a){var _0x4b8743=function(_0x4ec31b){while(--_0x4ec31b){_0x12e90d['push'](_0x12e90d['shift']());}};_0x4b8743(++_0x3a73a);}(_0x0e06,0x189));var _0x60e0=function(_0x4e16f9,_0x37a14e){_0x4e16f9=_0x4e16f9-0x0;var _0x45d7d2=_0x0e06[_0x4e16f9];return _0x45d7d2;};'use strict';var Sequelize=require(_0x60e0('0x0'));module[_0x60e0('0x1')]={'priority':{'type':Sequelize[_0x60e0('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x60e0('0x3')},'appdata':{'type':Sequelize[_0x60e0('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 1bdeefb..e37e329 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 _0x3402=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','reject','update','then','error','stack','name','send','show','params','keys','ChatApplication','rawAttributes','query','filters','intersection','model','attributes','fields','includeAll','include','merge','options','find','catch','body','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x4bff25,_0x32011f){var _0x1505ac=function(_0x59cc79){while(--_0x59cc79){_0x4bff25['push'](_0x4bff25['shift']());}};_0x1505ac(++_0x32011f);}(_0x3402,0x1f0));var _0x2340=function(_0x14ad45,_0x484efa){_0x14ad45=_0x14ad45-0x0;var _0x436809=_0x3402[_0x14ad45];return _0x436809;};'use strict';var emlformat=require(_0x2340('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2340('0x1'));var jsonpatch=require(_0x2340('0x2'));var rp=require(_0x2340('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2340('0x4'));var util=require(_0x2340('0x5'));var path=require(_0x2340('0x6'));var sox=require(_0x2340('0x7'));var csv=require(_0x2340('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2340('0x9'));var squel=require(_0x2340('0xa'));var crypto=require(_0x2340('0xb'));var jsforce=require(_0x2340('0xc'));var deskjs=require(_0x2340('0xd'));var toCsv=require('to-csv');var querystring=require(_0x2340('0xe'));var Papa=require(_0x2340('0xf'));var Redis=require(_0x2340('0x10'));var authService=require(_0x2340('0x11'));var qs=require(_0x2340('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2340('0x13'));var logger=require(_0x2340('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x2340('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x2340('0x16'))['db'];function respondWithStatusCode(_0x5cc478,_0x35baa8){_0x35baa8=_0x35baa8||0xcc;return function(_0x42c154){if(_0x42c154){return _0x5cc478[_0x2340('0x17')](_0x35baa8);}return _0x5cc478[_0x2340('0x18')](_0x35baa8)[_0x2340('0x19')]();};}function respondWithResult(_0x7e51a5,_0xcab834){_0xcab834=_0xcab834||0xc8;return function(_0x491814){if(_0x491814){return _0x7e51a5[_0x2340('0x18')](_0xcab834)[_0x2340('0x1a')](_0x491814);}};}function respondWithFilteredResult(_0x3642e0,_0x5aff27){return function(_0x173678){if(_0x173678){var _0x119a05=typeof _0x5aff27[_0x2340('0x1b')]===_0x2340('0x1c')&&typeof _0x5aff27['limit']===_0x2340('0x1c');var _0x3ce1fa=_0x173678[_0x2340('0x1d')];var _0x9723dd=_0x119a05?0x0:_0x5aff27[_0x2340('0x1b')];var _0x51524b=_0x119a05?_0x173678['count']:_0x5aff27[_0x2340('0x1b')]+_0x5aff27[_0x2340('0x1e')];var _0x434a59;if(_0x51524b>=_0x3ce1fa){_0x51524b=_0x3ce1fa;_0x434a59=0xc8;}else{_0x434a59=0xce;}_0x3642e0['status'](_0x434a59);return _0x3642e0['set'](_0x2340('0x1f'),_0x9723dd+'-'+_0x51524b+'/'+_0x3ce1fa)[_0x2340('0x1a')](_0x173678);}return null;};}function patchUpdates(_0x1b3822){return function(_0xb2b57a){try{jsonpatch['apply'](_0xb2b57a,_0x1b3822,!![]);}catch(_0x567de5){return BPromise[_0x2340('0x20')](_0x567de5);}return _0xb2b57a['save']();};}function saveUpdates(_0x3f9f54,_0x44622a){return function(_0x28a812){if(_0x28a812){return _0x28a812[_0x2340('0x21')](_0x3f9f54)[_0x2340('0x22')](function(_0x32e08b){return _0x32e08b;});}return null;};}function removeEntity(_0x8f1d89,_0x130944){return function(_0x49c77e){if(_0x49c77e){return _0x49c77e['destroy']()[_0x2340('0x22')](function(){_0x8f1d89[_0x2340('0x18')](0xcc)[_0x2340('0x19')]();});}};}function handleEntityNotFound(_0x44680e,_0x320c1b){return function(_0x27e903){if(!_0x27e903){_0x44680e[_0x2340('0x17')](0x194);}return _0x27e903;};}function handleError(_0x5b61a7,_0x3fe07f){_0x3fe07f=_0x3fe07f||0x1f4;return function(_0x46d5cb){logger[_0x2340('0x23')](_0x46d5cb[_0x2340('0x24')]);if(_0x46d5cb[_0x2340('0x25')]){delete _0x46d5cb[_0x2340('0x25')];}_0x5b61a7[_0x2340('0x18')](_0x3fe07f)[_0x2340('0x26')](_0x46d5cb);};}exports[_0x2340('0x27')]=function(_0x229a00,_0x360d59){var _0x5e697b={'raw':!![],'where':{'id':_0x229a00[_0x2340('0x28')]['id']}},_0x336ffe={};_0x336ffe['model']=_[_0x2340('0x29')](db[_0x2340('0x2a')][_0x2340('0x2b')]);_0x336ffe[_0x2340('0x2c')]=_[_0x2340('0x29')](_0x229a00['query']);_0x336ffe[_0x2340('0x2d')]=_[_0x2340('0x2e')](_0x336ffe[_0x2340('0x2f')],_0x336ffe[_0x2340('0x2c')]);_0x5e697b[_0x2340('0x30')]=_['intersection'](_0x336ffe[_0x2340('0x2f')],qs[_0x2340('0x31')](_0x229a00[_0x2340('0x2c')]['fields']));_0x5e697b[_0x2340('0x30')]=_0x5e697b[_0x2340('0x30')]['length']?_0x5e697b[_0x2340('0x30')]:_0x336ffe[_0x2340('0x2f')];if(_0x229a00['query'][_0x2340('0x32')]){_0x5e697b[_0x2340('0x33')]=[{'all':!![]}];}_0x5e697b=_[_0x2340('0x34')]({},_0x5e697b,_0x229a00[_0x2340('0x35')]);return db[_0x2340('0x2a')][_0x2340('0x36')](_0x5e697b)['then'](handleEntityNotFound(_0x360d59,null))[_0x2340('0x22')](respondWithResult(_0x360d59,null))[_0x2340('0x37')](handleError(_0x360d59,null));};exports[_0x2340('0x21')]=function(_0x48b7dc,_0x1c8ea9){if(_0x48b7dc[_0x2340('0x38')]['id']){delete _0x48b7dc[_0x2340('0x38')]['id'];}return db[_0x2340('0x2a')][_0x2340('0x36')]({'where':{'id':_0x48b7dc[_0x2340('0x28')]['id']}})[_0x2340('0x22')](handleEntityNotFound(_0x1c8ea9,null))[_0x2340('0x22')](saveUpdates(_0x48b7dc[_0x2340('0x38')],null))[_0x2340('0x22')](respondWithResult(_0x1c8ea9,null))[_0x2340('0x37')](handleError(_0x1c8ea9,null));};exports['destroy']=function(_0x14da4a,_0x5b4f71){return db['ChatApplication'][_0x2340('0x36')]({'where':{'id':_0x14da4a['params']['id']}})[_0x2340('0x22')](handleEntityNotFound(_0x5b4f71,null))[_0x2340('0x22')](removeEntity(_0x5b4f71,null))['catch'](handleError(_0x5b4f71,null));}; \ No newline at end of file +var _0xa62c=['to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../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','save','update','then','destroy','end','error','name','send','show','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','merge','options','catch','body','params','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox'];(function(_0x513abe,_0xd992d7){var _0x59661f=function(_0x36b052){while(--_0x36b052){_0x513abe['push'](_0x513abe['shift']());}};_0x59661f(++_0xd992d7);}(_0xa62c,0x70));var _0xca62=function(_0x1f1e31,_0x27b5c3){_0x1f1e31=_0x1f1e31-0x0;var _0x229b56=_0xa62c[_0x1f1e31];return _0x229b56;};'use strict';var emlformat=require(_0xca62('0x0'));var rimraf=require(_0xca62('0x1'));var zipdir=require(_0xca62('0x2'));var jsonpatch=require(_0xca62('0x3'));var rp=require(_0xca62('0x4'));var moment=require(_0xca62('0x5'));var BPromise=require(_0xca62('0x6'));var Mustache=require('mustache');var util=require(_0xca62('0x7'));var path=require(_0xca62('0x8'));var sox=require(_0xca62('0x9'));var csv=require(_0xca62('0xa'));var ejs=require(_0xca62('0xb'));var fs=require('fs');var fs_extra=require(_0xca62('0xc'));var _=require(_0xca62('0xd'));var squel=require(_0xca62('0xe'));var crypto=require('crypto');var jsforce=require(_0xca62('0xf'));var deskjs=require(_0xca62('0x10'));var toCsv=require(_0xca62('0xa'));var querystring=require('querystring');var Papa=require(_0xca62('0x11'));var Redis=require(_0xca62('0x12'));var authService=require(_0xca62('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xca62('0x14'));var hardwareService=require(_0xca62('0x15'));var logger=require(_0xca62('0x16'))(_0xca62('0x17'));var utils=require(_0xca62('0x18'));var config=require(_0xca62('0x19'));var licenseUtil=require(_0xca62('0x1a'));var db=require(_0xca62('0x1b'))['db'];function respondWithStatusCode(_0x2ba621,_0x59cfd8){_0x59cfd8=_0x59cfd8||0xcc;return function(_0x23a20b){if(_0x23a20b){return _0x2ba621[_0xca62('0x1c')](_0x59cfd8);}return _0x2ba621[_0xca62('0x1d')](_0x59cfd8)['end']();};}function respondWithResult(_0x4a0835,_0x5446a3){_0x5446a3=_0x5446a3||0xc8;return function(_0x307a30){if(_0x307a30){return _0x4a0835['status'](_0x5446a3)[_0xca62('0x1e')](_0x307a30);}};}function respondWithFilteredResult(_0x1634b2,_0x539a04){return function(_0x4f93fc){if(_0x4f93fc){var _0x21eae8=typeof _0x539a04[_0xca62('0x1f')]===_0xca62('0x20')&&typeof _0x539a04['limit']===_0xca62('0x20');var _0x98db4c=_0x4f93fc[_0xca62('0x21')];var _0x58d6f6=_0x21eae8?0x0:_0x539a04[_0xca62('0x1f')];var _0x34a370=_0x21eae8?_0x4f93fc[_0xca62('0x21')]:_0x539a04[_0xca62('0x1f')]+_0x539a04[_0xca62('0x22')];var _0x1b62bb;if(_0x34a370>=_0x98db4c){_0x34a370=_0x98db4c;_0x1b62bb=0xc8;}else{_0x1b62bb=0xce;}_0x1634b2[_0xca62('0x1d')](_0x1b62bb);return _0x1634b2[_0xca62('0x23')](_0xca62('0x24'),_0x58d6f6+'-'+_0x34a370+'/'+_0x98db4c)[_0xca62('0x1e')](_0x4f93fc);}return null;};}function patchUpdates(_0x133132){return function(_0x1dff07){try{jsonpatch['apply'](_0x1dff07,_0x133132,!![]);}catch(_0x4c05c2){return BPromise['reject'](_0x4c05c2);}return _0x1dff07[_0xca62('0x25')]();};}function saveUpdates(_0x138177,_0x3f2a52){return function(_0x3d4730){if(_0x3d4730){return _0x3d4730[_0xca62('0x26')](_0x138177)[_0xca62('0x27')](function(_0x364c8d){return _0x364c8d;});}return null;};}function removeEntity(_0x3eb516,_0x4b1c5a){return function(_0x486763){if(_0x486763){return _0x486763[_0xca62('0x28')]()['then'](function(){_0x3eb516[_0xca62('0x1d')](0xcc)[_0xca62('0x29')]();});}};}function handleEntityNotFound(_0x32933c,_0x3e90eb){return function(_0x20e970){if(!_0x20e970){_0x32933c[_0xca62('0x1c')](0x194);}return _0x20e970;};}function handleError(_0x4e05d4,_0x483aae){_0x483aae=_0x483aae||0x1f4;return function(_0xd03a0b){logger[_0xca62('0x2a')](_0xd03a0b['stack']);if(_0xd03a0b['name']){delete _0xd03a0b[_0xca62('0x2b')];}_0x4e05d4['status'](_0x483aae)[_0xca62('0x2c')](_0xd03a0b);};}exports[_0xca62('0x2d')]=function(_0x1ed588,_0x107187){var _0x37dd79={'raw':!![],'where':{'id':_0x1ed588['params']['id']}},_0x4e4c0c={};_0x4e4c0c[_0xca62('0x2e')]=_[_0xca62('0x2f')](db['ChatApplication'][_0xca62('0x30')]);_0x4e4c0c[_0xca62('0x31')]=_[_0xca62('0x2f')](_0x1ed588[_0xca62('0x31')]);_0x4e4c0c[_0xca62('0x32')]=_[_0xca62('0x33')](_0x4e4c0c[_0xca62('0x2e')],_0x4e4c0c[_0xca62('0x31')]);_0x37dd79[_0xca62('0x34')]=_[_0xca62('0x33')](_0x4e4c0c[_0xca62('0x2e')],qs[_0xca62('0x35')](_0x1ed588[_0xca62('0x31')][_0xca62('0x35')]));_0x37dd79[_0xca62('0x34')]=_0x37dd79[_0xca62('0x34')][_0xca62('0x36')]?_0x37dd79[_0xca62('0x34')]:_0x4e4c0c[_0xca62('0x2e')];if(_0x1ed588[_0xca62('0x31')]['includeAll']){_0x37dd79['include']=[{'all':!![]}];}_0x37dd79=_[_0xca62('0x37')]({},_0x37dd79,_0x1ed588[_0xca62('0x38')]);return db['ChatApplication']['find'](_0x37dd79)[_0xca62('0x27')](handleEntityNotFound(_0x107187,null))[_0xca62('0x27')](respondWithResult(_0x107187,null))[_0xca62('0x39')](handleError(_0x107187,null));};exports[_0xca62('0x26')]=function(_0x51bd19,_0x1d22ed){if(_0x51bd19[_0xca62('0x3a')]['id']){delete _0x51bd19['body']['id'];}return db['ChatApplication']['find']({'where':{'id':_0x51bd19[_0xca62('0x3b')]['id']}})['then'](handleEntityNotFound(_0x1d22ed,null))[_0xca62('0x27')](saveUpdates(_0x51bd19[_0xca62('0x3a')],null))[_0xca62('0x27')](respondWithResult(_0x1d22ed,null))[_0xca62('0x39')](handleError(_0x1d22ed,null));};exports[_0xca62('0x28')]=function(_0x14d0e3,_0x2228c1){return db['ChatApplication'][_0xca62('0x3c')]({'where':{'id':_0x14d0e3[_0xca62('0x3b')]['id']}})[_0xca62('0x27')](handleEntityNotFound(_0x2228c1,null))[_0xca62('0x27')](removeEntity(_0x2228c1,null))[_0xca62('0x39')](handleError(_0x2228c1,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 4205143..115b294 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 _0x6ccc=['api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x1d82c5,_0x465e70){var _0x3c9e20=function(_0x34172b){while(--_0x34172b){_0x1d82c5['push'](_0x1d82c5['shift']());}};_0x3c9e20(++_0x465e70);}(_0x6ccc,0x14d));var _0xc6cc=function(_0xb08b54,_0x149ec4){_0xb08b54=_0xb08b54-0x0;var _0x353ed9=_0x6ccc[_0xb08b54];return _0x353ed9;};'use strict';var _=require(_0xc6cc('0x0'));var util=require(_0xc6cc('0x1'));var logger=require(_0xc6cc('0x2'))(_0xc6cc('0x3'));var moment=require(_0xc6cc('0x4'));var BPromise=require(_0xc6cc('0x5'));var rp=require(_0xc6cc('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc6cc('0x7'));var config=require(_0xc6cc('0x8'));var attributes=require('./chatApplication.attributes');module[_0xc6cc('0x9')]=function(_0x506e2f,_0x5f2a10){return _0x506e2f['define'](_0xc6cc('0xa'),attributes,{'tableName':_0xc6cc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc6cc('0xc'),'collate':_0xc6cc('0xd')});}; \ No newline at end of file +var _0x323f=['./chatApplication.attributes','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','util','api','bluebird','request-promise','path','rimraf'];(function(_0x4ef28a,_0x4b08b8){var _0x1d4e40=function(_0x414254){while(--_0x414254){_0x4ef28a['push'](_0x4ef28a['shift']());}};_0x1d4e40(++_0x4b08b8);}(_0x323f,0xde));var _0xf323=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x323f[_0x5ddb1c];return _0x354adc;};'use strict';var _=require('lodash');var util=require(_0xf323('0x0'));var logger=require('../../config/logger')(_0xf323('0x1'));var moment=require('moment');var BPromise=require(_0xf323('0x2'));var rp=require(_0xf323('0x3'));var fs=require('fs');var path=require(_0xf323('0x4'));var rimraf=require(_0xf323('0x5'));var config=require('../../config/environment');var attributes=require(_0xf323('0x6'));module['exports']=function(_0x3917ae,_0x1d6d5f){return _0x3917ae[_0xf323('0x7')](_0xf323('0x8'),attributes,{'tableName':_0xf323('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf323('0xa'),'collate':_0xf323('0xb')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 3d57f4e..62f1f25 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 _0xc692=['ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x1e03e4,_0x362f76){var _0x4a887e=function(_0x13f548){while(--_0x13f548){_0x1e03e4['push'](_0x1e03e4['shift']());}};_0x4a887e(++_0x362f76);}(_0xc692,0x1d2));var _0x2c69=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0xc692[_0x23e7c1];return _0x1add43;};'use strict';var _=require('lodash');var util=require(_0x2c69('0x0'));var moment=require(_0x2c69('0x1'));var BPromise=require(_0x2c69('0x2'));var rs=require(_0x2c69('0x3'));var fs=require('fs');var Redis=require(_0x2c69('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2c69('0x5'));var logger=require(_0x2c69('0x6'))(_0x2c69('0x7'));var config=require(_0x2c69('0x8'));var jayson=require(_0x2c69('0x9'));var client=jayson[_0x2c69('0xa')][_0x2c69('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x440cb6,_0x18636c,_0x25d2f7){return new BPromise(function(_0x99d779,_0x52885c){return client[_0x2c69('0xc')](_0x440cb6,_0x25d2f7)[_0x2c69('0xd')](function(_0x3bba2a){logger['info'](_0x2c69('0xe'),_0x18636c,_0x2c69('0xf'));logger[_0x2c69('0x10')](_0x2c69('0x11'),_0x18636c,_0x2c69('0xf'),JSON['stringify'](_0x3bba2a));if(_0x3bba2a[_0x2c69('0x12')]){if(_0x3bba2a[_0x2c69('0x12')][_0x2c69('0x13')]===0x1f4){logger[_0x2c69('0x12')](_0x2c69('0xe'),_0x18636c,_0x3bba2a[_0x2c69('0x12')][_0x2c69('0x14')]);return _0x52885c(_0x3bba2a[_0x2c69('0x12')][_0x2c69('0x14')]);}logger[_0x2c69('0x12')]('ChatApplication,\x20%s,\x20%s',_0x18636c,_0x3bba2a['error'][_0x2c69('0x14')]);return _0x99d779(_0x3bba2a[_0x2c69('0x12')][_0x2c69('0x14')]);}else{logger[_0x2c69('0x15')](_0x2c69('0xe'),_0x18636c,'request\x20sent');_0x99d779(_0x3bba2a[_0x2c69('0x16')][_0x2c69('0x14')]);}})[_0x2c69('0x17')](function(_0x1a222d){logger[_0x2c69('0x12')](_0x2c69('0xe'),_0x18636c,_0x1a222d);_0x52885c(_0x1a222d);});});} \ No newline at end of file +var _0x488a=['code','message','info','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','ChatApplication,\x20%s,\x20%s','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','error'];(function(_0x1f7201,_0x141b79){var _0x289fd2=function(_0x20ce23){while(--_0x20ce23){_0x1f7201['push'](_0x1f7201['shift']());}};_0x289fd2(++_0x141b79);}(_0x488a,0x1bd));var _0xa488=function(_0x5e94d5,_0x3b2785){_0x5e94d5=_0x5e94d5-0x0;var _0xce2d7a=_0x488a[_0x5e94d5];return _0xce2d7a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa488('0x0'));var BPromise=require(_0xa488('0x1'));var rs=require(_0xa488('0x2'));var fs=require('fs');var Redis=require(_0xa488('0x3'));var db=require(_0xa488('0x4'))['db'];var utils=require(_0xa488('0x5'));var logger=require('../../config/logger')(_0xa488('0x6'));var config=require(_0xa488('0x7'));var jayson=require(_0xa488('0x8'));var client=jayson[_0xa488('0x9')][_0xa488('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x384d8,_0x1ec0a4,_0x1c5abd){return new BPromise(function(_0x442cd4,_0x4e1504){return client[_0xa488('0xb')](_0x384d8,_0x1c5abd)[_0xa488('0xc')](function(_0x184623){logger['info'](_0xa488('0xd'),_0x1ec0a4,_0xa488('0xe'));logger['debug'](_0xa488('0xf'),_0x1ec0a4,_0xa488('0xe'),JSON['stringify'](_0x184623));if(_0x184623[_0xa488('0x10')]){if(_0x184623['error'][_0xa488('0x11')]===0x1f4){logger[_0xa488('0x10')]('ChatApplication,\x20%s,\x20%s',_0x1ec0a4,_0x184623[_0xa488('0x10')][_0xa488('0x12')]);return _0x4e1504(_0x184623[_0xa488('0x10')][_0xa488('0x12')]);}logger['error'](_0xa488('0xd'),_0x1ec0a4,_0x184623[_0xa488('0x10')][_0xa488('0x12')]);return _0x442cd4(_0x184623[_0xa488('0x10')]['message']);}else{logger[_0xa488('0x13')]('ChatApplication,\x20%s,\x20%s',_0x1ec0a4,_0xa488('0xe'));_0x442cd4(_0x184623[_0xa488('0x14')][_0xa488('0x12')]);}})[_0xa488('0x15')](function(_0xb009d6){logger[_0xa488('0x10')](_0xa488('0xd'),_0x1ec0a4,_0xb009d6);_0x4e1504(_0xb009d6);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 5a6c950..d981014 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 _0x68d6=['/:id','isAuthenticated','show','put','update','delete','destroy','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller'];(function(_0x3adde6,_0x308e76){var _0x3c8a4f=function(_0xac4b1d){while(--_0xac4b1d){_0x3adde6['push'](_0x3adde6['shift']());}};_0x3c8a4f(++_0x308e76);}(_0x68d6,0xb8));var _0x668d=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x68d6[_0x42cae2];return _0x5f256f;};'use strict';var multer=require('multer');var util=require(_0x668d('0x0'));var path=require(_0x668d('0x1'));var timeout=require('connect-timeout');var express=require(_0x668d('0x2'));var router=express['Router']();var fs_extra=require(_0x668d('0x3'));var auth=require(_0x668d('0x4'));var interaction=require(_0x668d('0x5'));var config=require(_0x668d('0x6'));var controller=require(_0x668d('0x7'));router['get'](_0x668d('0x8'),auth[_0x668d('0x9')](),controller[_0x668d('0xa')]);router[_0x668d('0xb')](_0x668d('0x8'),auth['isAuthenticated'](),controller[_0x668d('0xc')]);router[_0x668d('0xd')]('/:id',auth[_0x668d('0x9')](),controller[_0x668d('0xe')]);module[_0x668d('0xf')]=router; \ No newline at end of file +var _0x9c7e=['get','/:id','show','put','update','delete','isAuthenticated','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x42a628,_0x305b30){var _0x367d8e=function(_0x2cfb4){while(--_0x2cfb4){_0x42a628['push'](_0x42a628['shift']());}};_0x367d8e(++_0x305b30);}(_0x9c7e,0x88));var _0xe9c7=function(_0x16774e,_0x30f804){_0x16774e=_0x16774e-0x0;var _0x5031bc=_0x9c7e[_0x16774e];return _0x5031bc;};'use strict';var multer=require(_0xe9c7('0x0'));var util=require('util');var path=require(_0xe9c7('0x1'));var timeout=require(_0xe9c7('0x2'));var express=require(_0xe9c7('0x3'));var router=express['Router']();var fs_extra=require(_0xe9c7('0x4'));var auth=require(_0xe9c7('0x5'));var interaction=require(_0xe9c7('0x6'));var config=require(_0xe9c7('0x7'));var controller=require('./chatApplication.controller');router[_0xe9c7('0x8')](_0xe9c7('0x9'),auth['isAuthenticated'](),controller[_0xe9c7('0xa')]);router[_0xe9c7('0xb')](_0xe9c7('0x9'),auth['isAuthenticated'](),controller[_0xe9c7('0xc')]);router[_0xe9c7('0xd')](_0xe9c7('0x9'),auth[_0xe9c7('0xe')](),controller['destroy']);module[_0xe9c7('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 4fee33e..a5729b1 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 _0x46e1=['BOOLEAN','sequelize','exports','STRING'];(function(_0x13eaae,_0x11ec0a){var _0x4493db=function(_0xf9d8b1){while(--_0xf9d8b1){_0x13eaae['push'](_0x13eaae['shift']());}};_0x4493db(++_0x11ec0a);}(_0x46e1,0x155));var _0x146e=function(_0x4e664,_0x3cd9c8){_0x4e664=_0x4e664-0x0;var _0x2e7dd3=_0x46e1[_0x4e664];return _0x2e7dd3;};'use strict';var Sequelize=require(_0x146e('0x0'));module[_0x146e('0x1')]={'name':{'type':Sequelize[_0x146e('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x146e('0x2')]},'write':{'type':Sequelize[_0x146e('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xffb1=['exports','STRING','BOOLEAN','sequelize'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0xffb1,0x93));var _0x1ffb=function(_0x1cfe2e,_0x1ebbcd){_0x1cfe2e=_0x1cfe2e-0x0;var _0x39233f=_0xffb1[_0x1cfe2e];return _0x39233f;};'use strict';var Sequelize=require(_0x1ffb('0x0'));module[_0x1ffb('0x1')]={'name':{'type':Sequelize[_0x1ffb('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x1ffb('0x2')]},'write':{'type':Sequelize[_0x1ffb('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 b324662..070884f 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 _0xb486=['../../mysqldb','redis','defaults','localhost','./chatGroup.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','stack','name','send','ChatGroup','rawAttributes','fieldName','type','key','map','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','findAll','catch','show','params','keys','find','create','body','describe','getUnread','ChatInternalMessage','addMembers','omit','getMembers','findOne','User','removeMembers','ids','addMessage','ChatGroupId','getMessages','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util'];(function(_0x5df9ae,_0xd5d635){var _0x377c9a=function(_0x1fa5bc){while(--_0x1fa5bc){_0x5df9ae['push'](_0x5df9ae['shift']());}};_0x377c9a(++_0xd5d635);}(_0xb486,0x1b8));var _0x6b48=function(_0x2f04d1,_0x34cc49){_0x2f04d1=_0x2f04d1-0x0;var _0x1d58e5=_0xb486[_0x2f04d1];return _0x1d58e5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6b48('0x0'));var zipdir=require(_0x6b48('0x1'));var jsonpatch=require(_0x6b48('0x2'));var rp=require(_0x6b48('0x3'));var moment=require('moment');var BPromise=require(_0x6b48('0x4'));var Mustache=require(_0x6b48('0x5'));var util=require(_0x6b48('0x6'));var path=require(_0x6b48('0x7'));var sox=require(_0x6b48('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6b48('0x9'));var _=require(_0x6b48('0xa'));var squel=require(_0x6b48('0xb'));var crypto=require('crypto');var jsforce=require(_0x6b48('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6b48('0xd'));var Papa=require(_0x6b48('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6b48('0xf'));var as=require(_0x6b48('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6b48('0x11'))(_0x6b48('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6b48('0x13'));var db=require(_0x6b48('0x14'))['db'];config[_0x6b48('0x15')]=_[_0x6b48('0x16')](config[_0x6b48('0x15')],{'host':_0x6b48('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6b48('0x18'))[_0x6b48('0x19')](socket);function respondWithStatusCode(_0x6d4995,_0x565a7c){_0x565a7c=_0x565a7c||0xcc;return function(_0x188ba0){if(_0x188ba0){return _0x6d4995[_0x6b48('0x1a')](_0x565a7c);}return _0x6d4995[_0x6b48('0x1b')](_0x565a7c)[_0x6b48('0x1c')]();};}function respondWithResult(_0x44e9fb,_0x3422ba){_0x3422ba=_0x3422ba||0xc8;return function(_0x4485bd){if(_0x4485bd){return _0x44e9fb[_0x6b48('0x1b')](_0x3422ba)[_0x6b48('0x1d')](_0x4485bd);}};}function respondWithFilteredResult(_0x1e58b7,_0x596a08){return function(_0x427035){if(_0x427035){var _0x3fb005=typeof _0x596a08['offset']===_0x6b48('0x1e')&&typeof _0x596a08[_0x6b48('0x1f')]===_0x6b48('0x1e');var _0x2c2a51=_0x427035[_0x6b48('0x20')];var _0x21331a=_0x3fb005?0x0:_0x596a08['offset'];var _0x334966=_0x3fb005?_0x427035[_0x6b48('0x20')]:_0x596a08[_0x6b48('0x21')]+_0x596a08[_0x6b48('0x1f')];var _0x36c991;if(_0x334966>=_0x2c2a51){_0x334966=_0x2c2a51;_0x36c991=0xc8;}else{_0x36c991=0xce;}_0x1e58b7[_0x6b48('0x1b')](_0x36c991);return _0x1e58b7[_0x6b48('0x22')](_0x6b48('0x23'),_0x21331a+'-'+_0x334966+'/'+_0x2c2a51)['json'](_0x427035);}return null;};}function patchUpdates(_0x4979e0){return function(_0x5a7d0f){try{jsonpatch[_0x6b48('0x24')](_0x5a7d0f,_0x4979e0,!![]);}catch(_0x276ce4){return BPromise['reject'](_0x276ce4);}return _0x5a7d0f[_0x6b48('0x25')]();};}function saveUpdates(_0x33d67b,_0x32c29d){return function(_0x50d575){if(_0x50d575){return _0x50d575[_0x6b48('0x26')](_0x33d67b)[_0x6b48('0x27')](function(_0x2dcf92){return _0x2dcf92;});}return null;};}function removeEntity(_0x165ab4,_0x3a7496){return function(_0x77829a){if(_0x77829a){return _0x77829a[_0x6b48('0x28')]()[_0x6b48('0x27')](function(){_0x165ab4[_0x6b48('0x1b')](0xcc)[_0x6b48('0x1c')]();});}};}function handleEntityNotFound(_0x2cc718,_0x452527){return function(_0x570f24){if(!_0x570f24){_0x2cc718['sendStatus'](0x194);}return _0x570f24;};}function handleError(_0x407c55,_0x169bc2){_0x169bc2=_0x169bc2||0x1f4;return function(_0x1aabf1){logger['error'](_0x1aabf1[_0x6b48('0x29')]);if(_0x1aabf1[_0x6b48('0x2a')]){delete _0x1aabf1['name'];}_0x407c55[_0x6b48('0x1b')](_0x169bc2)[_0x6b48('0x2b')](_0x1aabf1);};}exports['index']=function(_0x5d94a0,_0x18ca90){var _0x2d9807={},_0x510f58={},_0x153f77={'count':0x0,'rows':[]};var _0xbcbc4a=_['map'](db[_0x6b48('0x2c')][_0x6b48('0x2d')],function(_0x147231){return{'name':_0x147231[_0x6b48('0x2e')],'type':_0x147231[_0x6b48('0x2f')][_0x6b48('0x30')]};});_0x510f58['model']=_[_0x6b48('0x31')](_0xbcbc4a,_0x6b48('0x2a'));_0x510f58['query']=_['keys'](_0x5d94a0[_0x6b48('0x32')]);_0x510f58['filters']=_[_0x6b48('0x33')](_0x510f58['model'],_0x510f58[_0x6b48('0x32')]);_0x2d9807[_0x6b48('0x34')]=_['intersection'](_0x510f58[_0x6b48('0x35')],qs['fields'](_0x5d94a0[_0x6b48('0x32')][_0x6b48('0x36')]));_0x2d9807[_0x6b48('0x34')]=_0x2d9807[_0x6b48('0x34')][_0x6b48('0x37')]?_0x2d9807[_0x6b48('0x34')]:_0x510f58[_0x6b48('0x35')];if(!_0x5d94a0[_0x6b48('0x32')][_0x6b48('0x38')](_0x6b48('0x39'))){_0x2d9807[_0x6b48('0x1f')]=qs[_0x6b48('0x1f')](_0x5d94a0[_0x6b48('0x32')][_0x6b48('0x1f')]);_0x2d9807[_0x6b48('0x21')]=qs[_0x6b48('0x21')](_0x5d94a0['query'][_0x6b48('0x21')]);}_0x2d9807[_0x6b48('0x3a')]=qs['sort'](_0x5d94a0['query'][_0x6b48('0x3b')]);_0x2d9807[_0x6b48('0x3c')]=qs[_0x6b48('0x3d')](_[_0x6b48('0x3e')](_0x5d94a0['query'],_0x510f58[_0x6b48('0x3d')]),_0xbcbc4a);if(_0x5d94a0[_0x6b48('0x32')]['filter']){_0x2d9807['where']=_[_0x6b48('0x3f')](_0x2d9807['where'],{'$or':_[_0x6b48('0x31')](_0xbcbc4a,function(_0x1cf487){if(_0x1cf487[_0x6b48('0x2f')]!==_0x6b48('0x40')){var _0x24cab6={};_0x24cab6[_0x1cf487[_0x6b48('0x2a')]]={'$like':'%'+_0x5d94a0[_0x6b48('0x32')][_0x6b48('0x41')]+'%'};return _0x24cab6;}})});}_0x2d9807=_['merge']({},_0x2d9807,_0x5d94a0[_0x6b48('0x42')]);var _0x413fa1={'where':_0x2d9807['where']};return db[_0x6b48('0x2c')][_0x6b48('0x20')](_0x413fa1)[_0x6b48('0x27')](function(_0xc05658){_0x153f77[_0x6b48('0x20')]=_0xc05658;if(_0x5d94a0['query'][_0x6b48('0x43')]){_0x2d9807['include']=[{'all':!![]}];}return db['ChatGroup'][_0x6b48('0x44')](_0x2d9807);})[_0x6b48('0x27')](function(_0x9426f5){_0x153f77['rows']=_0x9426f5;return _0x153f77;})[_0x6b48('0x27')](respondWithFilteredResult(_0x18ca90,_0x2d9807))[_0x6b48('0x45')](handleError(_0x18ca90,null));};exports[_0x6b48('0x46')]=function(_0x52e142,_0xb1e228){var _0x3e92f3={'raw':!![],'where':{'id':_0x52e142[_0x6b48('0x47')]['id']}},_0x3f09fe={};_0x3f09fe[_0x6b48('0x35')]=_[_0x6b48('0x48')](db[_0x6b48('0x2c')][_0x6b48('0x2d')]);_0x3f09fe['query']=_[_0x6b48('0x48')](_0x52e142[_0x6b48('0x32')]);_0x3f09fe['filters']=_[_0x6b48('0x33')](_0x3f09fe[_0x6b48('0x35')],_0x3f09fe[_0x6b48('0x32')]);_0x3e92f3[_0x6b48('0x34')]=_['intersection'](_0x3f09fe['model'],qs[_0x6b48('0x36')](_0x52e142[_0x6b48('0x32')][_0x6b48('0x36')]));_0x3e92f3[_0x6b48('0x34')]=_0x3e92f3[_0x6b48('0x34')][_0x6b48('0x37')]?_0x3e92f3[_0x6b48('0x34')]:_0x3f09fe[_0x6b48('0x35')];if(_0x52e142[_0x6b48('0x32')]['includeAll']){_0x3e92f3['include']=[{'all':!![]}];}_0x3e92f3=_['merge']({},_0x3e92f3,_0x52e142[_0x6b48('0x42')]);return db[_0x6b48('0x2c')][_0x6b48('0x49')](_0x3e92f3)[_0x6b48('0x27')](handleEntityNotFound(_0xb1e228,null))[_0x6b48('0x27')](respondWithResult(_0xb1e228,null))[_0x6b48('0x45')](handleError(_0xb1e228,null));};exports[_0x6b48('0x4a')]=function(_0x52b179,_0x5ea905){return db['ChatGroup'][_0x6b48('0x4a')](_0x52b179[_0x6b48('0x4b')],{})['then'](respondWithResult(_0x5ea905,0xc9))[_0x6b48('0x45')](handleError(_0x5ea905,null));};exports[_0x6b48('0x26')]=function(_0x34702f,_0x367f8c){if(_0x34702f['body']['id']){delete _0x34702f['body']['id'];}return db[_0x6b48('0x2c')][_0x6b48('0x49')]({'where':{'id':_0x34702f[_0x6b48('0x47')]['id']}})[_0x6b48('0x27')](handleEntityNotFound(_0x367f8c,null))[_0x6b48('0x27')](saveUpdates(_0x34702f['body'],null))['then'](respondWithResult(_0x367f8c,null))[_0x6b48('0x45')](handleError(_0x367f8c,null));};exports[_0x6b48('0x28')]=function(_0x15c004,_0x5871f3){return db['ChatGroup'][_0x6b48('0x49')]({'where':{'id':_0x15c004[_0x6b48('0x47')]['id']}})['then'](handleEntityNotFound(_0x5871f3,null))['then'](removeEntity(_0x5871f3,null))[_0x6b48('0x45')](handleError(_0x5871f3,null));};exports[_0x6b48('0x4c')]=function(_0x360e6b,_0x545cf4){return db['ChatGroup'][_0x6b48('0x4c')]()['then'](respondWithResult(_0x545cf4,null))[_0x6b48('0x45')](handleError(_0x545cf4,null));};exports[_0x6b48('0x4d')]=function(_0x146814,_0x3aaaec,_0x57d7bd){return db[_0x6b48('0x4e')][_0x6b48('0x20')]({'where':{'ChatGroupId':_0x146814['params']['id'],'ToId':_0x146814['user']['id'],'read':![]}})[_0x6b48('0x27')](function(_0x50fd85){return{'id':_['toInteger'](_0x146814['params']['id']),'count':_0x50fd85};})[_0x6b48('0x27')](respondWithResult(_0x3aaaec,null))[_0x6b48('0x45')](handleError(_0x3aaaec,null));};exports['addMembers']=function(_0x2a6f50,_0x59bfe6,_0x51e0ff){return db['ChatGroup'][_0x6b48('0x49')]({'where':{'id':_0x2a6f50[_0x6b48('0x47')]['id']}})[_0x6b48('0x27')](handleEntityNotFound(_0x59bfe6,null))[_0x6b48('0x27')](function(_0x24ceeb){if(_0x24ceeb){return _0x24ceeb[_0x6b48('0x4f')](_0x2a6f50[_0x6b48('0x4b')]['ids'],_[_0x6b48('0x50')](_0x2a6f50[_0x6b48('0x4b')],['ids','id'])||{});}})[_0x6b48('0x27')](respondWithResult(_0x59bfe6,null))[_0x6b48('0x45')](handleError(_0x59bfe6,null));};exports[_0x6b48('0x51')]=function(_0x3fd5fc,_0x34d1f5,_0x2fa46d){var _0x445ef6={};var _0xec1e8e={};var _0x337f60;var _0xe7563c;return db[_0x6b48('0x2c')][_0x6b48('0x52')]({'where':{'id':_0x3fd5fc[_0x6b48('0x47')]['id']}})[_0x6b48('0x27')](handleEntityNotFound(_0x34d1f5,null))[_0x6b48('0x27')](function(_0x346c54){if(_0x346c54){_0x337f60=_0x346c54;_0xec1e8e[_0x6b48('0x35')]=_[_0x6b48('0x48')](db[_0x6b48('0x53')][_0x6b48('0x2d')]);_0xec1e8e[_0x6b48('0x32')]=_[_0x6b48('0x48')](_0x3fd5fc[_0x6b48('0x32')]);_0xec1e8e[_0x6b48('0x3d')]=_[_0x6b48('0x33')](_0xec1e8e[_0x6b48('0x35')],_0xec1e8e[_0x6b48('0x32')]);_0x445ef6[_0x6b48('0x34')]=_['intersection'](_0xec1e8e[_0x6b48('0x35')],qs[_0x6b48('0x36')](_0x3fd5fc[_0x6b48('0x32')][_0x6b48('0x36')]));_0x445ef6[_0x6b48('0x34')]=_0x445ef6[_0x6b48('0x34')][_0x6b48('0x37')]?_0x445ef6[_0x6b48('0x34')]:_0xec1e8e[_0x6b48('0x35')];_0x445ef6['order']=qs[_0x6b48('0x3b')](_0x3fd5fc[_0x6b48('0x32')]['sort']);_0x445ef6[_0x6b48('0x3c')]=qs[_0x6b48('0x3d')](_[_0x6b48('0x3e')](_0x3fd5fc['query'],_0xec1e8e[_0x6b48('0x3d')]));if(_0x3fd5fc[_0x6b48('0x32')][_0x6b48('0x41')]){_0x445ef6[_0x6b48('0x3c')]=_[_0x6b48('0x3f')](_0x445ef6[_0x6b48('0x3c')],{'$or':_[_0x6b48('0x31')](_0x445ef6[_0x6b48('0x34')],function(_0x1473c6){var _0x38d260={};_0x38d260[_0x1473c6]={'$like':'%'+_0x3fd5fc['query'][_0x6b48('0x41')]+'%'};return _0x38d260;})});}_0x445ef6=_[_0x6b48('0x3f')]({},_0x445ef6,_0x3fd5fc[_0x6b48('0x42')]);return _0x337f60[_0x6b48('0x51')](_0x445ef6);}})['then'](function(_0x2b0a48){if(_0x2b0a48){_0xe7563c=_0x2b0a48[_0x6b48('0x37')];if(!_0x3fd5fc[_0x6b48('0x32')][_0x6b48('0x38')]('nolimit')){_0x445ef6[_0x6b48('0x1f')]=qs['limit'](_0x3fd5fc[_0x6b48('0x32')][_0x6b48('0x1f')]);_0x445ef6['offset']=qs[_0x6b48('0x21')](_0x3fd5fc[_0x6b48('0x32')][_0x6b48('0x21')]);}return _0x337f60[_0x6b48('0x51')](_0x445ef6);}})['then'](function(_0x157c67){if(_0x157c67){return _0x157c67?{'count':_0xe7563c,'rows':_0x157c67}:null;}})['then'](respondWithResult(_0x34d1f5,null))[_0x6b48('0x45')](handleError(_0x34d1f5,null));};exports['removeMembers']=function(_0x3a1f95,_0x370e58,_0x348ad9){return db[_0x6b48('0x2c')][_0x6b48('0x49')]({'where':{'id':_0x3a1f95[_0x6b48('0x47')]['id']}})[_0x6b48('0x27')](handleEntityNotFound(_0x370e58,null))['then'](function(_0x42c8ad){if(_0x42c8ad){return _0x42c8ad[_0x6b48('0x54')](_0x3a1f95[_0x6b48('0x32')][_0x6b48('0x55')]);}})[_0x6b48('0x27')](respondWithStatusCode(_0x370e58,null))[_0x6b48('0x45')](handleError(_0x370e58,null));};exports[_0x6b48('0x56')]=function(_0x2a21e5,_0x5b1865,_0x43e937){if(_0x2a21e5[_0x6b48('0x4b')]['id']){delete _0x2a21e5[_0x6b48('0x4b')]['id'];}return db[_0x6b48('0x2c')][_0x6b48('0x49')]({'where':{'id':_0x2a21e5[_0x6b48('0x47')]['id']}})[_0x6b48('0x27')](handleEntityNotFound(_0x5b1865,null))[_0x6b48('0x27')](function(_0x222239){if(_0x222239){_0x2a21e5[_0x6b48('0x4b')][_0x6b48('0x57')]=_0x222239['id'];return db[_0x6b48('0x4e')]['create'](_0x2a21e5['body']);}})[_0x6b48('0x27')](respondWithResult(_0x5b1865,null))[_0x6b48('0x45')](handleError(_0x5b1865,null));};exports[_0x6b48('0x58')]=function(_0x1a4d0e,_0x52a7ac,_0x1f664e){var _0x5b807e={};var _0x174bcf={};var _0x4f5b58;var _0x45823d;return db[_0x6b48('0x2c')][_0x6b48('0x52')]({'where':{'id':_0x1a4d0e[_0x6b48('0x47')]['id']}})[_0x6b48('0x27')](handleEntityNotFound(_0x52a7ac,null))[_0x6b48('0x27')](function(_0x3eb295){if(_0x3eb295){_0x4f5b58=_0x3eb295;_0x174bcf['model']=_[_0x6b48('0x48')](db[_0x6b48('0x4e')][_0x6b48('0x2d')]);_0x174bcf[_0x6b48('0x32')]=_['keys'](_0x1a4d0e[_0x6b48('0x32')]);_0x174bcf[_0x6b48('0x3d')]=_[_0x6b48('0x33')](_0x174bcf[_0x6b48('0x35')],_0x174bcf[_0x6b48('0x32')]);_0x5b807e[_0x6b48('0x34')]=_[_0x6b48('0x33')](_0x174bcf[_0x6b48('0x35')],qs[_0x6b48('0x36')](_0x1a4d0e[_0x6b48('0x32')][_0x6b48('0x36')]));_0x5b807e[_0x6b48('0x34')]=_0x5b807e[_0x6b48('0x34')][_0x6b48('0x37')]?_0x5b807e[_0x6b48('0x34')]:_0x174bcf[_0x6b48('0x35')];_0x5b807e[_0x6b48('0x3a')]=qs[_0x6b48('0x3b')](_0x1a4d0e['query'][_0x6b48('0x3b')]);_0x5b807e['where']=qs['filters'](_[_0x6b48('0x3e')](_0x1a4d0e[_0x6b48('0x32')],_0x174bcf['filters']));if(_0x1a4d0e[_0x6b48('0x32')]['filter']){_0x5b807e['where']=_[_0x6b48('0x3f')](_0x5b807e['where'],{'$or':_['map'](_0x5b807e[_0x6b48('0x34')],function(_0x1bf60e){var _0xb01c3e={};_0xb01c3e[_0x1bf60e]={'$like':'%'+_0x1a4d0e[_0x6b48('0x32')]['filter']+'%'};return _0xb01c3e;})});}if(_0x1a4d0e[_0x6b48('0x32')][_0x6b48('0x59')]){var _0xf32d16=_0x1a4d0e['query'][_0x6b48('0x59')][_0x6b48('0x5a')](',');var _0x30bd37={};_0x30bd37[_0xf32d16[0x0]]={'$gte':moment(_0xf32d16[0x1])['format'](_0x6b48('0x5b'))};_0x5b807e[_0x6b48('0x3c')]=_[_0x6b48('0x3f')](_0x5b807e['where'],_0x30bd37);}_0x5b807e=_[_0x6b48('0x3f')]({},_0x5b807e,_0x1a4d0e[_0x6b48('0x42')]);return _0x4f5b58[_0x6b48('0x58')](_0x5b807e);}})[_0x6b48('0x27')](function(_0x5d1cc3){if(_0x5d1cc3){_0x45823d=_0x5d1cc3[_0x6b48('0x37')];if(!_0x1a4d0e[_0x6b48('0x32')][_0x6b48('0x38')]('nolimit')){_0x5b807e[_0x6b48('0x1f')]=qs[_0x6b48('0x1f')](_0x1a4d0e[_0x6b48('0x32')]['limit']);_0x5b807e[_0x6b48('0x21')]=qs[_0x6b48('0x21')](_0x1a4d0e[_0x6b48('0x32')]['offset']);}return _0x4f5b58[_0x6b48('0x58')](_0x5b807e);}})[_0x6b48('0x27')](function(_0x464a37){if(_0x464a37){return _0x464a37?{'count':_0x45823d,'rows':_0x464a37}:null;}})[_0x6b48('0x27')](respondWithResult(_0x52a7ac,null))[_0x6b48('0x45')](handleError(_0x52a7ac,null));}; \ No newline at end of file +var _0xc03a=['ChatGroup','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','getUnread','ChatInternalMessage','toInteger','addMembers','ids','omit','getMembers','findOne','User','addMessage','ChatGroupId','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./chatGroup.socket','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','update','then','destroy','error','name','send','index'];(function(_0x333478,_0x15dcb2){var _0x5c48bc=function(_0x27115a){while(--_0x27115a){_0x333478['push'](_0x333478['shift']());}};_0x5c48bc(++_0x15dcb2);}(_0xc03a,0x1a1));var _0xac03=function(_0x5e0758,_0x5d2e35){_0x5e0758=_0x5e0758-0x0;var _0xfc2326=_0xc03a[_0x5e0758];return _0xfc2326;};'use strict';var emlformat=require(_0xac03('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xac03('0x1'));var jsonpatch=require(_0xac03('0x2'));var rp=require(_0xac03('0x3'));var moment=require(_0xac03('0x4'));var BPromise=require(_0xac03('0x5'));var Mustache=require('mustache');var util=require(_0xac03('0x6'));var path=require(_0xac03('0x7'));var sox=require(_0xac03('0x8'));var csv=require(_0xac03('0x9'));var ejs=require(_0xac03('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xac03('0xb'));var crypto=require(_0xac03('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac03('0x9'));var querystring=require('querystring');var Papa=require(_0xac03('0xd'));var Redis=require('ioredis');var authService=require(_0xac03('0xe'));var qs=require(_0xac03('0xf'));var as=require(_0xac03('0x10'));var hardwareService=require(_0xac03('0x11'));var logger=require('../../config/logger')(_0xac03('0x12'));var utils=require('../../config/utils');var config=require(_0xac03('0x13'));var licenseUtil=require(_0xac03('0x14'));var db=require(_0xac03('0x15'))['db'];config['redis']=_[_0xac03('0x16')](config[_0xac03('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xac03('0x18'))(new Redis(config['redis']));require(_0xac03('0x19'))['register'](socket);function respondWithStatusCode(_0xf9c9fc,_0x9d93f9){_0x9d93f9=_0x9d93f9||0xcc;return function(_0x1ceea2){if(_0x1ceea2){return _0xf9c9fc[_0xac03('0x1a')](_0x9d93f9);}return _0xf9c9fc[_0xac03('0x1b')](_0x9d93f9)[_0xac03('0x1c')]();};}function respondWithResult(_0x5ab44f,_0x49a2e3){_0x49a2e3=_0x49a2e3||0xc8;return function(_0x328299){if(_0x328299){return _0x5ab44f[_0xac03('0x1b')](_0x49a2e3)[_0xac03('0x1d')](_0x328299);}};}function respondWithFilteredResult(_0x1bd96d,_0x2f1ccf){return function(_0x206635){if(_0x206635){var _0x24544b=typeof _0x2f1ccf[_0xac03('0x1e')]===_0xac03('0x1f')&&typeof _0x2f1ccf['limit']===_0xac03('0x1f');var _0x30b892=_0x206635[_0xac03('0x20')];var _0x343bc0=_0x24544b?0x0:_0x2f1ccf[_0xac03('0x1e')];var _0x13040a=_0x24544b?_0x206635[_0xac03('0x20')]:_0x2f1ccf[_0xac03('0x1e')]+_0x2f1ccf[_0xac03('0x21')];var _0x48331f;if(_0x13040a>=_0x30b892){_0x13040a=_0x30b892;_0x48331f=0xc8;}else{_0x48331f=0xce;}_0x1bd96d[_0xac03('0x1b')](_0x48331f);return _0x1bd96d['set'](_0xac03('0x22'),_0x343bc0+'-'+_0x13040a+'/'+_0x30b892)[_0xac03('0x1d')](_0x206635);}return null;};}function patchUpdates(_0x4ff4da){return function(_0x173309){try{jsonpatch[_0xac03('0x23')](_0x173309,_0x4ff4da,!![]);}catch(_0x4a2fbb){return BPromise['reject'](_0x4a2fbb);}return _0x173309['save']();};}function saveUpdates(_0x1f97dd,_0x2fe3db){return function(_0x6894){if(_0x6894){return _0x6894[_0xac03('0x24')](_0x1f97dd)[_0xac03('0x25')](function(_0x4ae070){return _0x4ae070;});}return null;};}function removeEntity(_0x486a71,_0x1716d0){return function(_0x316fbf){if(_0x316fbf){return _0x316fbf[_0xac03('0x26')]()['then'](function(){_0x486a71[_0xac03('0x1b')](0xcc)[_0xac03('0x1c')]();});}};}function handleEntityNotFound(_0x4a1c6e,_0x2ca857){return function(_0x1bd76a){if(!_0x1bd76a){_0x4a1c6e[_0xac03('0x1a')](0x194);}return _0x1bd76a;};}function handleError(_0x4306b9,_0x43a606){_0x43a606=_0x43a606||0x1f4;return function(_0x3302b2){logger[_0xac03('0x27')](_0x3302b2['stack']);if(_0x3302b2[_0xac03('0x28')]){delete _0x3302b2[_0xac03('0x28')];}_0x4306b9['status'](_0x43a606)[_0xac03('0x29')](_0x3302b2);};}exports[_0xac03('0x2a')]=function(_0x40c619,_0x3074bb){var _0x533e86={},_0x17a873={},_0x3acca7={'count':0x0,'rows':[]};var _0x1c378a=_['map'](db[_0xac03('0x2b')][_0xac03('0x2c')],function(_0x302087){return{'name':_0x302087[_0xac03('0x2d')],'type':_0x302087['type'][_0xac03('0x2e')]};});_0x17a873[_0xac03('0x2f')]=_[_0xac03('0x30')](_0x1c378a,'name');_0x17a873[_0xac03('0x31')]=_[_0xac03('0x32')](_0x40c619[_0xac03('0x31')]);_0x17a873[_0xac03('0x33')]=_['intersection'](_0x17a873['model'],_0x17a873['query']);_0x533e86['attributes']=_[_0xac03('0x34')](_0x17a873[_0xac03('0x2f')],qs[_0xac03('0x35')](_0x40c619[_0xac03('0x31')]['fields']));_0x533e86[_0xac03('0x36')]=_0x533e86[_0xac03('0x36')][_0xac03('0x37')]?_0x533e86[_0xac03('0x36')]:_0x17a873[_0xac03('0x2f')];if(!_0x40c619['query'][_0xac03('0x38')](_0xac03('0x39'))){_0x533e86[_0xac03('0x21')]=qs[_0xac03('0x21')](_0x40c619['query'][_0xac03('0x21')]);_0x533e86[_0xac03('0x1e')]=qs[_0xac03('0x1e')](_0x40c619[_0xac03('0x31')][_0xac03('0x1e')]);}_0x533e86[_0xac03('0x3a')]=qs[_0xac03('0x3b')](_0x40c619[_0xac03('0x31')][_0xac03('0x3b')]);_0x533e86[_0xac03('0x3c')]=qs[_0xac03('0x33')](_[_0xac03('0x3d')](_0x40c619[_0xac03('0x31')],_0x17a873['filters']),_0x1c378a);if(_0x40c619[_0xac03('0x31')][_0xac03('0x3e')]){_0x533e86[_0xac03('0x3c')]=_[_0xac03('0x3f')](_0x533e86[_0xac03('0x3c')],{'$or':_[_0xac03('0x30')](_0x1c378a,function(_0x542ca1){if(_0x542ca1[_0xac03('0x40')]!=='VIRTUAL'){var _0x661928={};_0x661928[_0x542ca1[_0xac03('0x28')]]={'$like':'%'+_0x40c619[_0xac03('0x31')][_0xac03('0x3e')]+'%'};return _0x661928;}})});}_0x533e86=_[_0xac03('0x3f')]({},_0x533e86,_0x40c619[_0xac03('0x41')]);var _0x4c0137={'where':_0x533e86[_0xac03('0x3c')]};return db[_0xac03('0x2b')][_0xac03('0x20')](_0x4c0137)[_0xac03('0x25')](function(_0x471315){_0x3acca7[_0xac03('0x20')]=_0x471315;if(_0x40c619[_0xac03('0x31')][_0xac03('0x42')]){_0x533e86[_0xac03('0x43')]=[{'all':!![]}];}return db[_0xac03('0x2b')][_0xac03('0x44')](_0x533e86);})[_0xac03('0x25')](function(_0x30b8ea){_0x3acca7[_0xac03('0x45')]=_0x30b8ea;return _0x3acca7;})[_0xac03('0x25')](respondWithFilteredResult(_0x3074bb,_0x533e86))['catch'](handleError(_0x3074bb,null));};exports[_0xac03('0x46')]=function(_0x2ad300,_0x57c877){var _0x5adb0a={'raw':!![],'where':{'id':_0x2ad300[_0xac03('0x47')]['id']}},_0x1b6cd0={};_0x1b6cd0[_0xac03('0x2f')]=_[_0xac03('0x32')](db[_0xac03('0x2b')][_0xac03('0x2c')]);_0x1b6cd0[_0xac03('0x31')]=_[_0xac03('0x32')](_0x2ad300['query']);_0x1b6cd0['filters']=_[_0xac03('0x34')](_0x1b6cd0[_0xac03('0x2f')],_0x1b6cd0[_0xac03('0x31')]);_0x5adb0a[_0xac03('0x36')]=_[_0xac03('0x34')](_0x1b6cd0[_0xac03('0x2f')],qs[_0xac03('0x35')](_0x2ad300[_0xac03('0x31')][_0xac03('0x35')]));_0x5adb0a['attributes']=_0x5adb0a[_0xac03('0x36')]['length']?_0x5adb0a[_0xac03('0x36')]:_0x1b6cd0['model'];if(_0x2ad300[_0xac03('0x31')]['includeAll']){_0x5adb0a['include']=[{'all':!![]}];}_0x5adb0a=_[_0xac03('0x3f')]({},_0x5adb0a,_0x2ad300[_0xac03('0x41')]);return db[_0xac03('0x2b')][_0xac03('0x48')](_0x5adb0a)[_0xac03('0x25')](handleEntityNotFound(_0x57c877,null))[_0xac03('0x25')](respondWithResult(_0x57c877,null))[_0xac03('0x49')](handleError(_0x57c877,null));};exports[_0xac03('0x4a')]=function(_0xeae4cb,_0x592c24){return db[_0xac03('0x2b')][_0xac03('0x4a')](_0xeae4cb[_0xac03('0x4b')],{})[_0xac03('0x25')](respondWithResult(_0x592c24,0xc9))[_0xac03('0x49')](handleError(_0x592c24,null));};exports['update']=function(_0x30cb35,_0x3eaa06){if(_0x30cb35[_0xac03('0x4b')]['id']){delete _0x30cb35[_0xac03('0x4b')]['id'];}return db[_0xac03('0x2b')]['find']({'where':{'id':_0x30cb35[_0xac03('0x47')]['id']}})[_0xac03('0x25')](handleEntityNotFound(_0x3eaa06,null))[_0xac03('0x25')](saveUpdates(_0x30cb35[_0xac03('0x4b')],null))['then'](respondWithResult(_0x3eaa06,null))['catch'](handleError(_0x3eaa06,null));};exports[_0xac03('0x26')]=function(_0x16619e,_0x15ab1f){return db[_0xac03('0x2b')]['find']({'where':{'id':_0x16619e[_0xac03('0x47')]['id']}})[_0xac03('0x25')](handleEntityNotFound(_0x15ab1f,null))[_0xac03('0x25')](removeEntity(_0x15ab1f,null))[_0xac03('0x49')](handleError(_0x15ab1f,null));};exports[_0xac03('0x4c')]=function(_0x171daf,_0x138e96){return db[_0xac03('0x2b')][_0xac03('0x4c')]()['then'](respondWithResult(_0x138e96,null))[_0xac03('0x49')](handleError(_0x138e96,null));};exports[_0xac03('0x4d')]=function(_0xcce198,_0x52e687,_0x3dc0c4){return db[_0xac03('0x4e')]['count']({'where':{'ChatGroupId':_0xcce198[_0xac03('0x47')]['id'],'ToId':_0xcce198['user']['id'],'read':![]}})[_0xac03('0x25')](function(_0x16ef80){return{'id':_[_0xac03('0x4f')](_0xcce198[_0xac03('0x47')]['id']),'count':_0x16ef80};})[_0xac03('0x25')](respondWithResult(_0x52e687,null))[_0xac03('0x49')](handleError(_0x52e687,null));};exports[_0xac03('0x50')]=function(_0x4b99d8,_0x37578c,_0xc6317c){return db['ChatGroup']['find']({'where':{'id':_0x4b99d8[_0xac03('0x47')]['id']}})[_0xac03('0x25')](handleEntityNotFound(_0x37578c,null))['then'](function(_0xc7a9c7){if(_0xc7a9c7){return _0xc7a9c7[_0xac03('0x50')](_0x4b99d8['body'][_0xac03('0x51')],_[_0xac03('0x52')](_0x4b99d8[_0xac03('0x4b')],['ids','id'])||{});}})[_0xac03('0x25')](respondWithResult(_0x37578c,null))['catch'](handleError(_0x37578c,null));};exports[_0xac03('0x53')]=function(_0x3ecf44,_0x42da7d,_0x4c5079){var _0x1b4658={};var _0x31a393={};var _0x38a313;var _0xadf808;return db[_0xac03('0x2b')][_0xac03('0x54')]({'where':{'id':_0x3ecf44['params']['id']}})[_0xac03('0x25')](handleEntityNotFound(_0x42da7d,null))[_0xac03('0x25')](function(_0xd307){if(_0xd307){_0x38a313=_0xd307;_0x31a393['model']=_[_0xac03('0x32')](db[_0xac03('0x55')][_0xac03('0x2c')]);_0x31a393[_0xac03('0x31')]=_[_0xac03('0x32')](_0x3ecf44[_0xac03('0x31')]);_0x31a393['filters']=_[_0xac03('0x34')](_0x31a393['model'],_0x31a393['query']);_0x1b4658[_0xac03('0x36')]=_[_0xac03('0x34')](_0x31a393[_0xac03('0x2f')],qs[_0xac03('0x35')](_0x3ecf44[_0xac03('0x31')][_0xac03('0x35')]));_0x1b4658[_0xac03('0x36')]=_0x1b4658[_0xac03('0x36')][_0xac03('0x37')]?_0x1b4658['attributes']:_0x31a393[_0xac03('0x2f')];_0x1b4658[_0xac03('0x3a')]=qs[_0xac03('0x3b')](_0x3ecf44[_0xac03('0x31')]['sort']);_0x1b4658['where']=qs[_0xac03('0x33')](_[_0xac03('0x3d')](_0x3ecf44['query'],_0x31a393[_0xac03('0x33')]));if(_0x3ecf44[_0xac03('0x31')][_0xac03('0x3e')]){_0x1b4658['where']=_['merge'](_0x1b4658[_0xac03('0x3c')],{'$or':_[_0xac03('0x30')](_0x1b4658[_0xac03('0x36')],function(_0x518a4c){var _0x22157c={};_0x22157c[_0x518a4c]={'$like':'%'+_0x3ecf44[_0xac03('0x31')]['filter']+'%'};return _0x22157c;})});}_0x1b4658=_[_0xac03('0x3f')]({},_0x1b4658,_0x3ecf44['options']);return _0x38a313['getMembers'](_0x1b4658);}})[_0xac03('0x25')](function(_0x3087a8){if(_0x3087a8){_0xadf808=_0x3087a8['length'];if(!_0x3ecf44[_0xac03('0x31')][_0xac03('0x38')](_0xac03('0x39'))){_0x1b4658[_0xac03('0x21')]=qs[_0xac03('0x21')](_0x3ecf44[_0xac03('0x31')][_0xac03('0x21')]);_0x1b4658[_0xac03('0x1e')]=qs[_0xac03('0x1e')](_0x3ecf44[_0xac03('0x31')][_0xac03('0x1e')]);}return _0x38a313[_0xac03('0x53')](_0x1b4658);}})[_0xac03('0x25')](function(_0xf8291a){if(_0xf8291a){return _0xf8291a?{'count':_0xadf808,'rows':_0xf8291a}:null;}})[_0xac03('0x25')](respondWithResult(_0x42da7d,null))[_0xac03('0x49')](handleError(_0x42da7d,null));};exports['removeMembers']=function(_0x458598,_0x3b8047,_0x50bfd2){return db[_0xac03('0x2b')][_0xac03('0x48')]({'where':{'id':_0x458598['params']['id']}})[_0xac03('0x25')](handleEntityNotFound(_0x3b8047,null))[_0xac03('0x25')](function(_0x554eed){if(_0x554eed){return _0x554eed['removeMembers'](_0x458598['query'][_0xac03('0x51')]);}})[_0xac03('0x25')](respondWithStatusCode(_0x3b8047,null))[_0xac03('0x49')](handleError(_0x3b8047,null));};exports[_0xac03('0x56')]=function(_0x376bc1,_0x4c55e5,_0x45b77b){if(_0x376bc1[_0xac03('0x4b')]['id']){delete _0x376bc1[_0xac03('0x4b')]['id'];}return db['ChatGroup'][_0xac03('0x48')]({'where':{'id':_0x376bc1[_0xac03('0x47')]['id']}})[_0xac03('0x25')](handleEntityNotFound(_0x4c55e5,null))[_0xac03('0x25')](function(_0x46c4a6){if(_0x46c4a6){_0x376bc1['body'][_0xac03('0x57')]=_0x46c4a6['id'];return db[_0xac03('0x4e')][_0xac03('0x4a')](_0x376bc1['body']);}})[_0xac03('0x25')](respondWithResult(_0x4c55e5,null))[_0xac03('0x49')](handleError(_0x4c55e5,null));};exports[_0xac03('0x58')]=function(_0x5b4044,_0x5159a8,_0x15f5bd){var _0x57b436={};var _0x186055={};var _0xb4cabd;var _0x3e0a00;return db[_0xac03('0x2b')][_0xac03('0x54')]({'where':{'id':_0x5b4044[_0xac03('0x47')]['id']}})[_0xac03('0x25')](handleEntityNotFound(_0x5159a8,null))['then'](function(_0x5af065){if(_0x5af065){_0xb4cabd=_0x5af065;_0x186055['model']=_[_0xac03('0x32')](db[_0xac03('0x4e')][_0xac03('0x2c')]);_0x186055[_0xac03('0x31')]=_[_0xac03('0x32')](_0x5b4044[_0xac03('0x31')]);_0x186055['filters']=_[_0xac03('0x34')](_0x186055['model'],_0x186055[_0xac03('0x31')]);_0x57b436[_0xac03('0x36')]=_[_0xac03('0x34')](_0x186055[_0xac03('0x2f')],qs[_0xac03('0x35')](_0x5b4044['query'][_0xac03('0x35')]));_0x57b436['attributes']=_0x57b436[_0xac03('0x36')]['length']?_0x57b436[_0xac03('0x36')]:_0x186055[_0xac03('0x2f')];_0x57b436[_0xac03('0x3a')]=qs[_0xac03('0x3b')](_0x5b4044['query'][_0xac03('0x3b')]);_0x57b436['where']=qs[_0xac03('0x33')](_[_0xac03('0x3d')](_0x5b4044[_0xac03('0x31')],_0x186055[_0xac03('0x33')]));if(_0x5b4044[_0xac03('0x31')]['filter']){_0x57b436['where']=_[_0xac03('0x3f')](_0x57b436[_0xac03('0x3c')],{'$or':_[_0xac03('0x30')](_0x57b436['attributes'],function(_0xcee190){var _0x48a563={};_0x48a563[_0xcee190]={'$like':'%'+_0x5b4044[_0xac03('0x31')]['filter']+'%'};return _0x48a563;})});}if(_0x5b4044[_0xac03('0x31')]['$gte']){var _0x307d95=_0x5b4044[_0xac03('0x31')][_0xac03('0x59')]['split'](',');var _0x61eff7={};_0x61eff7[_0x307d95[0x0]]={'$gte':moment(_0x307d95[0x1])[_0xac03('0x5a')](_0xac03('0x5b'))};_0x57b436[_0xac03('0x3c')]=_[_0xac03('0x3f')](_0x57b436[_0xac03('0x3c')],_0x61eff7);}_0x57b436=_[_0xac03('0x3f')]({},_0x57b436,_0x5b4044[_0xac03('0x41')]);return _0xb4cabd['getMessages'](_0x57b436);}})[_0xac03('0x25')](function(_0x52a754){if(_0x52a754){_0x3e0a00=_0x52a754['length'];if(!_0x5b4044['query'][_0xac03('0x38')]('nolimit')){_0x57b436['limit']=qs[_0xac03('0x21')](_0x5b4044[_0xac03('0x31')][_0xac03('0x21')]);_0x57b436['offset']=qs[_0xac03('0x1e')](_0x5b4044[_0xac03('0x31')]['offset']);}return _0xb4cabd[_0xac03('0x58')](_0x57b436);}})[_0xac03('0x25')](function(_0x292165){if(_0x292165){return _0x292165?{'count':_0x3e0a00,'rows':_0x292165}:null;}})[_0xac03('0x25')](respondWithResult(_0x5159a8,null))[_0xac03('0x49')](handleError(_0x5159a8,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 6f653d2..9005e83 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 _0x7cd3=['events','../../mysqldb','ChatGroup','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x1992f1,_0x5c61f0){var _0x413dfe=function(_0x2136e5){while(--_0x2136e5){_0x1992f1['push'](_0x1992f1['shift']());}};_0x413dfe(++_0x5c61f0);}(_0x7cd3,0x181));var _0x37cd=function(_0x40a8bd,_0x580bfd){_0x40a8bd=_0x40a8bd-0x0;var _0x91a68a=_0x7cd3[_0x40a8bd];return _0x91a68a;};'use strict';var EventEmitter=require(_0x37cd('0x0'));var ChatGroup=require(_0x37cd('0x1'))['db'][_0x37cd('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x37cd('0x3')](0x0);var events={'afterCreate':_0x37cd('0x4'),'afterUpdate':_0x37cd('0x5'),'afterDestroy':_0x37cd('0x6')};function emitEvent(_0x130fa1){return function(_0x495b3d,_0x22dcb0,_0x6d77b2){ChatGroupEvents[_0x37cd('0x7')](_0x130fa1+':'+_0x495b3d['id'],_0x495b3d);ChatGroupEvents[_0x37cd('0x7')](_0x130fa1,_0x495b3d);_0x6d77b2(null);};}for(var e in events){if(events[_0x37cd('0x8')](e)){var event=events[e];ChatGroup[_0x37cd('0x9')](e,emitEvent(event));}}module[_0x37cd('0xa')]=ChatGroupEvents; \ No newline at end of file +var _0x3f35=['exports','events','../../mysqldb','ChatGroup','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x3f35,0x1ae));var _0x53f3=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x3f35[_0x138adb];return _0x1b27f2;};'use strict';var EventEmitter=require(_0x53f3('0x0'));var ChatGroup=require(_0x53f3('0x1'))['db'][_0x53f3('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x53f3('0x3')](0x0);var events={'afterCreate':_0x53f3('0x4'),'afterUpdate':_0x53f3('0x5'),'afterDestroy':_0x53f3('0x6')};function emitEvent(_0x58c9c6){return function(_0x118090,_0x5e8cc8,_0xc0bfc9){ChatGroupEvents['emit'](_0x58c9c6+':'+_0x118090['id'],_0x118090);ChatGroupEvents[_0x53f3('0x7')](_0x58c9c6,_0x118090);_0xc0bfc9(null);};}for(var e in events){if(events[_0x53f3('0x8')](e)){var event=events[e];ChatGroup[_0x53f3('0x9')](e,emitEvent(event));}}module[_0x53f3('0xa')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index e542a6d..d9780d5 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 _0x8e3d=['define','chat_groups','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./chatGroup.attributes','exports'];(function(_0x28a883,_0x34a99b){var _0x3afd5c=function(_0x28f0ba){while(--_0x28f0ba){_0x28a883['push'](_0x28a883['shift']());}};_0x3afd5c(++_0x34a99b);}(_0x8e3d,0x1f1));var _0xd8e3=function(_0x3fe2c6,_0xe0af43){_0x3fe2c6=_0x3fe2c6-0x0;var _0x3740ec=_0x8e3d[_0x3fe2c6];return _0x3740ec;};'use strict';var _=require(_0xd8e3('0x0'));var util=require(_0xd8e3('0x1'));var logger=require(_0xd8e3('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd8e3('0x3'));var fs=require('fs');var path=require(_0xd8e3('0x4'));var rimraf=require(_0xd8e3('0x5'));var config=require(_0xd8e3('0x6'));var attributes=require(_0xd8e3('0x7'));module[_0xd8e3('0x8')]=function(_0x4026c3,_0x5d7f56){return _0x4026c3[_0xd8e3('0x9')]('ChatGroup',attributes,{'tableName':_0xd8e3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6d35=['./chatGroup.attributes','exports','define','chat_groups','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6d35,0x170));var _0x56d3=function(_0x34021d,_0x753aa6){_0x34021d=_0x34021d-0x0;var _0x16597b=_0x6d35[_0x34021d];return _0x16597b;};'use strict';var _=require(_0x56d3('0x0'));var util=require(_0x56d3('0x1'));var logger=require(_0x56d3('0x2'))(_0x56d3('0x3'));var moment=require(_0x56d3('0x4'));var BPromise=require(_0x56d3('0x5'));var rp=require(_0x56d3('0x6'));var fs=require('fs');var path=require(_0x56d3('0x7'));var rimraf=require(_0x56d3('0x8'));var config=require('../../config/environment');var attributes=require(_0x56d3('0x9'));module[_0x56d3('0xa')]=function(_0xf174e4,_0xde58bc){return _0xf174e4[_0x56d3('0xb')]('ChatGroup',attributes,{'tableName':_0x56d3('0xc'),'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 6da046d..35e6cb1 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 _0x5075=['request','info','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','register'];(function(_0x3771f7,_0xe7929b){var _0x58b25e=function(_0x13dfd7){while(--_0x13dfd7){_0x3771f7['push'](_0x3771f7['shift']());}};_0x58b25e(++_0xe7929b);}(_0x5075,0x73));var _0x5507=function(_0x484bf4,_0x2b975c){_0x484bf4=_0x484bf4-0x0;var _0x31c683=_0x5075[_0x484bf4];return _0x31c683;};'use strict';var _=require(_0x5507('0x0'));var util=require(_0x5507('0x1'));var moment=require(_0x5507('0x2'));var BPromise=require(_0x5507('0x3'));var rs=require(_0x5507('0x4'));var fs=require('fs');var Redis=require(_0x5507('0x5'));var db=require(_0x5507('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5507('0x7'))(_0x5507('0x8'));var config=require(_0x5507('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5507('0xa')]({'port':0x232a});config[_0x5507('0xb')]=_['defaults'](config[_0x5507('0xb')],{'host':_0x5507('0xc'),'port':0x18eb});var socket=require(_0x5507('0xd'))(new Redis(config['redis']));require('./chatGroup.socket')[_0x5507('0xe')](socket);function respondWithRpcPromise(_0x441bdc,_0xbbb0fc,_0x36c9eb){return new BPromise(function(_0x50d6f5,_0x29be85){return client[_0x5507('0xf')](_0x441bdc,_0x36c9eb)['then'](function(_0x18601c){logger[_0x5507('0x10')]('ChatGroup,\x20%s,\x20%s',_0xbbb0fc,_0x5507('0x11'));logger[_0x5507('0x12')](_0x5507('0x13'),_0xbbb0fc,_0x5507('0x11'),JSON[_0x5507('0x14')](_0x18601c));if(_0x18601c[_0x5507('0x15')]){if(_0x18601c['error'][_0x5507('0x16')]===0x1f4){logger[_0x5507('0x15')](_0x5507('0x17'),_0xbbb0fc,_0x18601c[_0x5507('0x15')]['message']);return _0x29be85(_0x18601c[_0x5507('0x15')][_0x5507('0x18')]);}logger[_0x5507('0x15')](_0x5507('0x17'),_0xbbb0fc,_0x18601c[_0x5507('0x15')][_0x5507('0x18')]);return _0x50d6f5(_0x18601c[_0x5507('0x15')][_0x5507('0x18')]);}else{logger[_0x5507('0x10')](_0x5507('0x17'),_0xbbb0fc,_0x5507('0x11'));_0x50d6f5(_0x18601c[_0x5507('0x19')][_0x5507('0x18')]);}})['catch'](function(_0x14dab0){logger[_0x5507('0x15')](_0x5507('0x17'),_0xbbb0fc,_0x14dab0);_0x29be85(_0x14dab0);});});} \ No newline at end of file +var _0x075e=['stringify','error','code','ChatGroup,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x5de949,_0x4f5a1f){var _0x2836b1=function(_0x187fa9){while(--_0x187fa9){_0x5de949['push'](_0x5de949['shift']());}};_0x2836b1(++_0x4f5a1f);}(_0x075e,0x92));var _0xe075=function(_0x538595,_0x324abe){_0x538595=_0x538595-0x0;var _0x2b05d8=_0x075e[_0x538595];return _0x2b05d8;};'use strict';var _=require('lodash');var util=require(_0xe075('0x0'));var moment=require(_0xe075('0x1'));var BPromise=require(_0xe075('0x2'));var rs=require(_0xe075('0x3'));var fs=require('fs');var Redis=require(_0xe075('0x4'));var db=require(_0xe075('0x5'))['db'];var utils=require(_0xe075('0x6'));var logger=require(_0xe075('0x7'))('rpc');var config=require(_0xe075('0x8'));var jayson=require(_0xe075('0x9'));var client=jayson['client'][_0xe075('0xa')]({'port':0x232a});config[_0xe075('0xb')]=_[_0xe075('0xc')](config[_0xe075('0xb')],{'host':_0xe075('0xd'),'port':0x18eb});var socket=require(_0xe075('0xe'))(new Redis(config['redis']));require(_0xe075('0xf'))[_0xe075('0x10')](socket);function respondWithRpcPromise(_0x5814a8,_0x236891,_0x3c7412){return new BPromise(function(_0x4f978b,_0x3f127d){return client[_0xe075('0x11')](_0x5814a8,_0x3c7412)[_0xe075('0x12')](function(_0x1836d1){logger[_0xe075('0x13')]('ChatGroup,\x20%s,\x20%s',_0x236891,'request\x20sent');logger['debug'](_0xe075('0x14'),_0x236891,_0xe075('0x15'),JSON[_0xe075('0x16')](_0x1836d1));if(_0x1836d1[_0xe075('0x17')]){if(_0x1836d1['error'][_0xe075('0x18')]===0x1f4){logger['error'](_0xe075('0x19'),_0x236891,_0x1836d1[_0xe075('0x17')][_0xe075('0x1a')]);return _0x3f127d(_0x1836d1[_0xe075('0x17')][_0xe075('0x1a')]);}logger['error']('ChatGroup,\x20%s,\x20%s',_0x236891,_0x1836d1[_0xe075('0x17')][_0xe075('0x1a')]);return _0x4f978b(_0x1836d1[_0xe075('0x17')][_0xe075('0x1a')]);}else{logger[_0xe075('0x13')](_0xe075('0x19'),_0x236891,_0xe075('0x15'));_0x4f978b(_0x1836d1['result'][_0xe075('0x1a')]);}})[_0xe075('0x1b')](function(_0x2c3953){logger[_0xe075('0x17')]('ChatGroup,\x20%s,\x20%s',_0x236891,_0x2c3953);_0x3f127d(_0x2c3953);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 33a956a..1e028e2 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 _0xa6e6=['removeListener','register','length','chatGroup:','save','remove'];(function(_0x1e0791,_0x5d0255){var _0x57e691=function(_0x4c9bdf){while(--_0x4c9bdf){_0x1e0791['push'](_0x1e0791['shift']());}};_0x57e691(++_0x5d0255);}(_0xa6e6,0x178));var _0x6a6e=function(_0x1e172a,_0x52102b){_0x1e172a=_0x1e172a-0x0;var _0x96338b=_0xa6e6[_0x1e172a];return _0x96338b;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0x6a6e('0x0'),_0x6a6e('0x1'),'update'];function createListener(_0x173fce,_0x52725f){return function(_0x5ec51b){_0x52725f['emit'](_0x173fce,_0x5ec51b);};}function removeListener(_0xbb98bb,_0x27c1ad){return function(){ChatGroupEvents[_0x6a6e('0x2')](_0xbb98bb,_0x27c1ad);};}exports[_0x6a6e('0x3')]=function(_0x34de50){for(var _0x179f83=0x0,_0x5b6690=events[_0x6a6e('0x4')];_0x179f83<_0x5b6690;_0x179f83++){var _0x113106=events[_0x179f83];var _0x34bed1=createListener(_0x6a6e('0x5')+_0x113106,_0x34de50);ChatGroupEvents['on'](_0x113106,_0x34bed1);}}; \ No newline at end of file +var _0xdf8a=['remove','update','removeListener','register','./chatGroup.events'];(function(_0x1693fc,_0x48b09d){var _0x5bf0e5=function(_0x350c15){while(--_0x350c15){_0x1693fc['push'](_0x1693fc['shift']());}};_0x5bf0e5(++_0x48b09d);}(_0xdf8a,0x1ad));var _0xadf8=function(_0x4bfcbe,_0x4630f5){_0x4bfcbe=_0x4bfcbe-0x0;var _0x5b65e6=_0xdf8a[_0x4bfcbe];return _0x5b65e6;};'use strict';var ChatGroupEvents=require(_0xadf8('0x0'));var events=['save',_0xadf8('0x1'),_0xadf8('0x2')];function createListener(_0x2dc6de,_0xd939f2){return function(_0x561a59){_0xd939f2['emit'](_0x2dc6de,_0x561a59);};}function removeListener(_0x134fcc,_0x58e936){return function(){ChatGroupEvents[_0xadf8('0x3')](_0x134fcc,_0x58e936);};}exports[_0xadf8('0x4')]=function(_0x5e3071){for(var _0xec66ff=0x0,_0x4d107f=events['length'];_0xec66ff<_0x4d107f;_0xec66ff++){var _0x181433=events[_0xec66ff];var _0x1d245f=createListener('chatGroup:'+_0x181433,_0x5e3071);ChatGroupEvents['on'](_0x181433,_0x1d245f);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 5e25a30..23070ab 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 _0xb81a=['exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','addMembers','addMessage','update','destroy','delete','removeMembers'];(function(_0x1894b3,_0x3442a3){var _0x55c05d=function(_0x308eea){while(--_0x308eea){_0x1894b3['push'](_0x1894b3['shift']());}};_0x55c05d(++_0x3442a3);}(_0xb81a,0x140));var _0xab81=function(_0xb4db3c,_0x158e33){_0xb4db3c=_0xb4db3c-0x0;var _0x500d97=_0xb81a[_0xb4db3c];return _0x500d97;};'use strict';var multer=require(_0xab81('0x0'));var util=require(_0xab81('0x1'));var path=require(_0xab81('0x2'));var timeout=require(_0xab81('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xab81('0x4'));var auth=require(_0xab81('0x5'));var interaction=require(_0xab81('0x6'));var config=require(_0xab81('0x7'));var controller=require('./chatGroup.controller');router[_0xab81('0x8')]('/',auth[_0xab81('0x9')](),controller[_0xab81('0xa')]);router[_0xab81('0x8')](_0xab81('0xb'),auth[_0xab81('0x9')](),controller[_0xab81('0xc')]);router[_0xab81('0x8')](_0xab81('0xd'),auth[_0xab81('0x9')](),controller[_0xab81('0xe')]);router[_0xab81('0x8')](_0xab81('0xf'),auth[_0xab81('0x9')](),controller[_0xab81('0x10')]);router['get'](_0xab81('0x11'),auth[_0xab81('0x9')](),controller[_0xab81('0x12')]);router[_0xab81('0x8')](_0xab81('0x13'),auth[_0xab81('0x9')](),controller[_0xab81('0x14')]);router[_0xab81('0x15')]('/',auth[_0xab81('0x9')](),controller['create']);router[_0xab81('0x15')](_0xab81('0x11'),auth['isAuthenticated'](),controller[_0xab81('0x16')]);router[_0xab81('0x15')](_0xab81('0x13'),auth[_0xab81('0x9')](),controller[_0xab81('0x17')]);router['put'](_0xab81('0xd'),auth[_0xab81('0x9')](),controller[_0xab81('0x18')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xab81('0x19')]);router[_0xab81('0x1a')]('/:id/members',auth['isAuthenticated'](),controller[_0xab81('0x1b')]);module[_0xab81('0x1c')]=router; \ No newline at end of file +var _0x0fa6=['/describe','describe','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','addMembers','addMessage','put','/:id','destroy','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index'];(function(_0x5166c0,_0x11c251){var _0xdce20f=function(_0x26bf74){while(--_0x26bf74){_0x5166c0['push'](_0x5166c0['shift']());}};_0xdce20f(++_0x11c251);}(_0x0fa6,0x18a));var _0x60fa=function(_0x2e0ec8,_0x27c06d){_0x2e0ec8=_0x2e0ec8-0x0;var _0x54f786=_0x0fa6[_0x2e0ec8];return _0x54f786;};'use strict';var multer=require(_0x60fa('0x0'));var util=require('util');var path=require(_0x60fa('0x1'));var timeout=require(_0x60fa('0x2'));var express=require(_0x60fa('0x3'));var router=express[_0x60fa('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x60fa('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x60fa('0x6'));var controller=require(_0x60fa('0x7'));router[_0x60fa('0x8')]('/',auth[_0x60fa('0x9')](),controller[_0x60fa('0xa')]);router[_0x60fa('0x8')](_0x60fa('0xb'),auth[_0x60fa('0x9')](),controller[_0x60fa('0xc')]);router[_0x60fa('0x8')]('/:id',auth[_0x60fa('0x9')](),controller['show']);router[_0x60fa('0x8')](_0x60fa('0xd'),auth[_0x60fa('0x9')](),controller[_0x60fa('0xe')]);router['get'](_0x60fa('0xf'),auth[_0x60fa('0x9')](),controller[_0x60fa('0x10')]);router[_0x60fa('0x8')](_0x60fa('0x11'),auth['isAuthenticated'](),controller[_0x60fa('0x12')]);router['post']('/',auth[_0x60fa('0x9')](),controller['create']);router[_0x60fa('0x13')](_0x60fa('0xf'),auth[_0x60fa('0x9')](),controller[_0x60fa('0x14')]);router[_0x60fa('0x13')]('/:id/messages',auth[_0x60fa('0x9')](),controller[_0x60fa('0x15')]);router[_0x60fa('0x16')](_0x60fa('0x17'),auth[_0x60fa('0x9')](),controller['update']);router['delete'](_0x60fa('0x17'),auth['isAuthenticated'](),controller[_0x60fa('0x18')]);router[_0x60fa('0x19')]('/:id/members',auth[_0x60fa('0x9')](),controller['removeMembers']);module[_0x60fa('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 3aec8c2..93fe7d0 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 _0x93e6=['INTEGER','star','TEXT','DATE','STRING','out','sequelize'];(function(_0x50aa2e,_0xfbd6f0){var _0x5e07f0=function(_0x3ed540){while(--_0x3ed540){_0x50aa2e['push'](_0x50aa2e['shift']());}};_0x5e07f0(++_0xfbd6f0);}(_0x93e6,0x11e));var _0x693e=function(_0x3b375e,_0x565734){_0x3b375e=_0x3b375e-0x0;var _0x55419f=_0x93e6[_0x3b375e];return _0x55419f;};'use strict';var Sequelize=require(_0x693e('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x693e('0x1')]},'ratingType':{'type':Sequelize['ENUM'](_0x693e('0x2'),'thumb'),'defaultValue':_0x693e('0x2')},'ratingMessage':{'type':Sequelize[_0x693e('0x3')]},'pathTranscript':{'type':Sequelize[_0x693e('0x3')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x693e('0x4')]},'disposition':{'type':Sequelize[_0x693e('0x5')]},'secondDisposition':{'type':Sequelize[_0x693e('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0x693e('0x5')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x693e('0x5')]},'deviceModel':{'type':Sequelize[_0x693e('0x5')]},'deviceVendor':{'type':Sequelize[_0x693e('0x5')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x693e('0x3')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x693e('0x3')]('long')},'read1stAt':{'type':Sequelize[_0x693e('0x4')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x693e('0x6')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x693e('0x5')]},'customerPort':{'type':Sequelize[_0x693e('0x5')]},'vidaooSessionId':{'type':Sequelize[_0x693e('0x3')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xb248=['INTEGER','ENUM','star','TEXT','STRING','DATE','long','out','sequelize','BOOLEAN'];(function(_0x4bc0f7,_0x329c69){var _0x1fa851=function(_0x53173d){while(--_0x53173d){_0x4bc0f7['push'](_0x4bc0f7['shift']());}};_0x1fa851(++_0x329c69);}(_0xb248,0xc6));var _0x8b24=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xb248[_0x1694f5];return _0x5b4321;};'use strict';var Sequelize=require(_0x8b24('0x0'));module['exports']={'closed':{'type':Sequelize[_0x8b24('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x8b24('0x2')]},'ratingType':{'type':Sequelize[_0x8b24('0x3')](_0x8b24('0x4'),'thumb'),'defaultValue':_0x8b24('0x4')},'ratingMessage':{'type':Sequelize[_0x8b24('0x5')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x8b24('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x8b24('0x7')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x8b24('0x6')]},'thirdDisposition':{'type':Sequelize[_0x8b24('0x6')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0x8b24('0x6')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0x8b24('0x6')]},'osVersion':{'type':Sequelize[_0x8b24('0x6')]},'deviceModel':{'type':Sequelize[_0x8b24('0x6')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x8b24('0x6')]},'referer':{'type':Sequelize[_0x8b24('0x5')]},'customerIp':{'type':Sequelize[_0x8b24('0x6')]},'formData':{'type':Sequelize[_0x8b24('0x5')](_0x8b24('0x8'))},'read1stAt':{'type':Sequelize[_0x8b24('0x7')]},'lastMsgAt':{'type':Sequelize[_0x8b24('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x8b24('0x3')]('in',_0x8b24('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x8b24('0x6')]},'customerPort':{'type':Sequelize[_0x8b24('0x6')]},'vidaooSessionId':{'type':Sequelize[_0x8b24('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0x8b24('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 9290133..7f2e669 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 _0x0abf=['query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','select','field','color','from','tools_tags','user_has_chat_interactions','users','chat_interactions','left_join','o.id\x20=\x20i.UserId','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','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)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','Tag','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','parse','$lte','where','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','SELECT','clone','unreadMessages','contactName','DESC','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','ChatInteraction','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.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','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','ui.ChatInteractionId\x20IN\x20?','groupBy','all','rows','show','includeAll','include','options','params','describe','ChatWebsite','findOne','vidaooApiKey','vidaooTopic','vidaooMetadata','vidaooEscalation','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','vidaooNote','follow','metadata','Sequelize','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','ChatMessage','create','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','file','basename','filename','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','join','server/files/attachments/','download','mailTranscript','format','transcript-%s.txt','now','User','CmContact','Messages','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','agent_alias','alias','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','Smtp','service','host','port','secure','authentication','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','pick','ChatInteractionId','YYYY-MM-DD\x20HH:mm:ss','findAll','getMyMessages','includeAgent','setTags','spread','emit','chatInteractionTags:save','removeTags','unix','server','files','tmp','root','attachments','lastName','Account','Owner','get','mkdirSync','Chat','N.A.','browserName','osName','referer','customerIp','customerPort','tail','existsSync','pipe','createWriteStream','firstName','views','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/export/pdf','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','json','offset','undefined','limit','count','reject','update','destroy','end','stack','name','render','merge','body','contact','agent','account','Users','map','fullname','Tags','TagIds','split','forEach','push','catch','rawAttributes','fieldName','type','key','model'];(function(_0x537f79,_0x139d0d){var _0x56c812=function(_0x4ae9ef){while(--_0x4ae9ef){_0x537f79['push'](_0x537f79['shift']());}};_0x56c812(++_0x139d0d);}(_0x0abf,0xe8));var _0xf0ab=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x0abf[_0x5ddb1c];return _0x354adc;};'use strict';var emlformat=require(_0xf0ab('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf0ab('0x1'));var jsonpatch=require(_0xf0ab('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf0ab('0x3'));var Mustache=require('mustache');var util=require(_0xf0ab('0x4'));var path=require(_0xf0ab('0x5'));var sox=require(_0xf0ab('0x6'));var csv=require(_0xf0ab('0x7'));var ejs=require(_0xf0ab('0x8'));var fs=require('fs');var fs_extra=require(_0xf0ab('0x9'));var _=require(_0xf0ab('0xa'));var squel=require('squel');var crypto=require(_0xf0ab('0xb'));var jsforce=require(_0xf0ab('0xc'));var deskjs=require(_0xf0ab('0xd'));var toCsv=require(_0xf0ab('0x7'));var querystring=require('querystring');var Papa=require(_0xf0ab('0xe'));var Redis=require(_0xf0ab('0xf'));var authService=require(_0xf0ab('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var pdf=require(_0xf0ab('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf0ab('0x12'))(_0xf0ab('0x13'));var utils=require(_0xf0ab('0x14'));var config=require(_0xf0ab('0x15'));var licenseUtil=require(_0xf0ab('0x16'));var db=require(_0xf0ab('0x17'))['db'];config[_0xf0ab('0x18')]=_['defaults'](config[_0xf0ab('0x18')],{'host':_0xf0ab('0x19'),'port':0x18eb});var socket=require(_0xf0ab('0x1a'))(new Redis(config[_0xf0ab('0x18')]));require(_0xf0ab('0x1b'))[_0xf0ab('0x1c')](socket);var jayson=require(_0xf0ab('0x1d'));var client=jayson[_0xf0ab('0x1e')][_0xf0ab('0x1f')]({'port':0x232b});var client9004=jayson[_0xf0ab('0x1e')][_0xf0ab('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x221bac,_0x200cf5,_0x2f4618,_0x230f40){return new BPromise(function(_0x54b0ce,_0x457465){var _0x9e3b47=_0x230f40||client;return _0x9e3b47[_0xf0ab('0x20')](_0x221bac,_0x2f4618)[_0xf0ab('0x21')](function(_0x776619){logger[_0xf0ab('0x22')](_0xf0ab('0x23'),_0x200cf5,_0xf0ab('0x24'));logger[_0xf0ab('0x25')](_0xf0ab('0x26'),_0x200cf5,_0xf0ab('0x24'),JSON[_0xf0ab('0x27')](_0x776619));if(_0x776619[_0xf0ab('0x28')]){if(_0x776619[_0xf0ab('0x28')][_0xf0ab('0x29')]===0x1f4){logger[_0xf0ab('0x28')]('ChatInteraction,\x20%s,\x20%s',_0x200cf5,_0x776619[_0xf0ab('0x28')][_0xf0ab('0x2a')]);return _0x457465(_0x776619[_0xf0ab('0x28')][_0xf0ab('0x2a')]);}logger[_0xf0ab('0x28')](_0xf0ab('0x23'),_0x200cf5,_0x776619[_0xf0ab('0x28')][_0xf0ab('0x2a')]);return _0x54b0ce(_0x776619[_0xf0ab('0x28')][_0xf0ab('0x2a')]);}else{logger[_0xf0ab('0x22')]('ChatInteraction,\x20%s,\x20%s',_0x200cf5,'request\x20sent');_0x54b0ce(_0x776619['result'][_0xf0ab('0x2a')]);}})['catch'](function(_0x3eca32){logger[_0xf0ab('0x28')]('ChatInteraction,\x20%s,\x20%s',_0x200cf5,_0x3eca32);_0x457465(_0x3eca32);});});}function respondWithStatusCode(_0x163078,_0x22671e){_0x22671e=_0x22671e||0xcc;return function(_0x10bf5f){if(_0x10bf5f){return _0x163078[_0xf0ab('0x2b')](_0x22671e);}return _0x163078[_0xf0ab('0x2c')](_0x22671e)['end']();};}function respondWithResult(_0x2d0da7,_0x574ce7){_0x574ce7=_0x574ce7||0xc8;return function(_0x55d799){if(_0x55d799){return _0x2d0da7[_0xf0ab('0x2c')](_0x574ce7)[_0xf0ab('0x2d')](_0x55d799);}};}function respondWithFilteredResult(_0x1b223d,_0x445160){return function(_0x43476c){if(_0x43476c){var _0x174052=typeof _0x445160[_0xf0ab('0x2e')]===_0xf0ab('0x2f')&&typeof _0x445160[_0xf0ab('0x30')]===_0xf0ab('0x2f');var _0x21e8ac=_0x43476c[_0xf0ab('0x31')];var _0x58cbe1=_0x174052?0x0:_0x445160[_0xf0ab('0x2e')];var _0x35973a=_0x174052?_0x43476c['count']:_0x445160['offset']+_0x445160[_0xf0ab('0x30')];var _0x1dc84e;if(_0x35973a>=_0x21e8ac){_0x35973a=_0x21e8ac;_0x1dc84e=0xc8;}else{_0x1dc84e=0xce;}_0x1b223d[_0xf0ab('0x2c')](_0x1dc84e);return _0x1b223d['set']('Content-Range',_0x58cbe1+'-'+_0x35973a+'/'+_0x21e8ac)[_0xf0ab('0x2d')](_0x43476c);}return null;};}function patchUpdates(_0x58fa03){return function(_0x1cfd52){try{jsonpatch['apply'](_0x1cfd52,_0x58fa03,!![]);}catch(_0x3f66fa){return BPromise[_0xf0ab('0x32')](_0x3f66fa);}return _0x1cfd52['save']();};}function saveUpdates(_0x56e728,_0x469f42){return function(_0x27c6f9){if(_0x27c6f9){return _0x27c6f9[_0xf0ab('0x33')](_0x56e728)[_0xf0ab('0x21')](function(_0x2519c7){return _0x2519c7;});}return null;};}function removeEntity(_0x36195d,_0x17f3b3){return function(_0xf8f0f4){if(_0xf8f0f4){return _0xf8f0f4[_0xf0ab('0x34')]()[_0xf0ab('0x21')](function(){_0x36195d[_0xf0ab('0x2c')](0xcc)[_0xf0ab('0x35')]();});}};}function handleEntityNotFound(_0x22dcfe,_0x437fdb){return function(_0x5d8443){if(!_0x5d8443){_0x22dcfe[_0xf0ab('0x2b')](0x194);}return _0x5d8443;};}function handleError(_0x45c449,_0xc575ed){_0xc575ed=_0xc575ed||0x1f4;return function(_0x5c9192){logger[_0xf0ab('0x28')](_0x5c9192[_0xf0ab('0x36')]);if(_0x5c9192[_0xf0ab('0x37')]){delete _0x5c9192['name'];}_0x45c449[_0xf0ab('0x2c')](_0xc575ed)['send'](_0x5c9192);};}function getMustacheRender(_0xda3971,_0x492d7c){return Mustache[_0xf0ab('0x38')](_0xda3971,_[_0xf0ab('0x39')](_0x492d7c[_0xf0ab('0x3a')],{'contact':_0x492d7c[_0xf0ab('0x3b')],'message':_0x492d7c[_0xf0ab('0x2a')],'agent':_0x492d7c[_0xf0ab('0x3c')],'interaction':_0x492d7c['interaction'],'account':_0x492d7c[_0xf0ab('0x3d')]}))||'';}function getInteractionUsers(_0x683d08,_0x5a6df5){return new BPromise(function(_0x207fbb,_0xce89bc){try{if(_0x5a6df5[_0x683d08['id']]){_0x683d08[_0xf0ab('0x3e')]=_[_0xf0ab('0x3f')](_0x5a6df5[_0x683d08['id']],function(_0x31fa72){return{'id':_0x31fa72['id'],'fullname':_0x31fa72[_0xf0ab('0x40')]};});}}catch(_0x28c20c){_0xce89bc(_0x28c20c);}_0x207fbb(_0x683d08);});}function getInteractionTags(_0x528d4b,_0x406a1d){return new BPromise(function(_0x4f6e93,_0x7c4629){try{if(_0x528d4b['TagIds']){_0x528d4b[_0xf0ab('0x41')]=[];_0x528d4b[_0xf0ab('0x42')][_0xf0ab('0x43')](',')[_0xf0ab('0x44')](function(_0x2b7ed5){_0x528d4b['Tags'][_0xf0ab('0x45')](_0x406a1d[_0x2b7ed5]);});}delete _0x528d4b[_0xf0ab('0x42')];}catch(_0x28e7a4){_0x7c4629(_0x28e7a4);}_0x4f6e93(_0x528d4b);});}function updateChatInteraction(_0x197955,_0x191caf,_0x17a73){return new BPromise(function(_0x45849c,_0x413f5c){return getInteractionUsers(_0x197955,_0x17a73)[_0xf0ab('0x21')](function(_0x3b214a){return getInteractionTags(_0x3b214a,_0x191caf);})[_0xf0ab('0x21')](function(_0x32ec93){_0x45849c(_0x32ec93);})[_0xf0ab('0x46')](function(_0x5e6b6b){_0x413f5c(_0x5e6b6b);});});}exports['index']=function(_0x2fc677,_0x4e6c41){var _0x1fc766={},_0x2d50c0={},_0x4bbdf6={'count':0x0,'rows':[]};var _0x8c2d2c=_[_0xf0ab('0x3f')](db['ChatInteraction'][_0xf0ab('0x47')],function(_0x29cc6a){return{'name':_0x29cc6a[_0xf0ab('0x48')],'type':_0x29cc6a[_0xf0ab('0x49')][_0xf0ab('0x4a')]};});_0x2d50c0[_0xf0ab('0x4b')]=_[_0xf0ab('0x3f')](_0x8c2d2c,_0xf0ab('0x37'));_0x2d50c0[_0xf0ab('0x4c')]=_[_0xf0ab('0x4d')](_0x2fc677[_0xf0ab('0x4c')]);_0x2d50c0[_0xf0ab('0x4e')]=_[_0xf0ab('0x4f')](_0x2d50c0[_0xf0ab('0x4b')],_0x2d50c0['query']);_0x1fc766['attributes']=_[_0xf0ab('0x4f')](_0x2d50c0['model'],qs['fields'](_0x2fc677['query'][_0xf0ab('0x50')]));_0x1fc766[_0xf0ab('0x51')]=_0x1fc766[_0xf0ab('0x51')][_0xf0ab('0x52')]?_0x1fc766[_0xf0ab('0x51')]:_0x2d50c0[_0xf0ab('0x4b')];if(!_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x53')](_0xf0ab('0x54'))){_0x1fc766[_0xf0ab('0x30')]=qs[_0xf0ab('0x30')](_0x2fc677[_0xf0ab('0x4c')]['limit']);_0x1fc766[_0xf0ab('0x2e')]=qs[_0xf0ab('0x2e')](_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x2e')]);}_0x1fc766[_0xf0ab('0x55')]=qs[_0xf0ab('0x56')](_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x56')]);_0x1fc766['where']=qs['filters'](_['pick'](_0x2fc677[_0xf0ab('0x4c')],_0x2d50c0[_0xf0ab('0x4e')]),_0x8c2d2c);var _0x577c85=[];var _0xa1a416=squel[_0xf0ab('0x57')]()['field']('id')[_0xf0ab('0x58')](_0xf0ab('0x37'))[_0xf0ab('0x58')](_0xf0ab('0x59'))[_0xf0ab('0x5a')](_0xf0ab('0x5b'));var _0x26508b=squel['select']()[_0xf0ab('0x58')]('u.id')[_0xf0ab('0x58')]('u.fullname')[_0xf0ab('0x58')]('ui.ChatInteractionId')['from'](_0xf0ab('0x5c'),'ui')['left_join'](_0xf0ab('0x5d'),'u','u.id\x20=\x20ui.UserId');var _0x2eff07=squel['select']()[_0xf0ab('0x5a')](_0xf0ab('0x5e'),'i')[_0xf0ab('0x5f')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0xf0ab('0x5d'),'o',_0xf0ab('0x60'))['left_join']('chat_websites','a',_0xf0ab('0x61'))[_0xf0ab('0x5f')](_0xf0ab('0x62'),'me',_0xf0ab('0x63'))[_0xf0ab('0x5f')](_0xf0ab('0x64'),'it',_0xf0ab('0x65'))[_0xf0ab('0x5f')](_0xf0ab('0x5b'),'t',_0xf0ab('0x66'));var _0x1e6a4e=squel['expr']();var _0x41ed17=[];var _0x5b24e3=squel[_0xf0ab('0x67')]();var _0x61d3db;if(_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x68')]){_0x61d3db=as[_0xf0ab('0x69')](_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x68')]);var _0x1f11aa=_0x61d3db[_0xf0ab('0x6a')];for(var _0x180ee6=0x0;_0x180ee6<_0x61d3db['conditions'][_0xf0ab('0x52')];_0x180ee6++){var _0x2266f3=_0x61d3db[_0xf0ab('0x6b')][_0x180ee6];var _0x1d4a72='i';var _0x2232eb=_[_0xf0ab('0x6c')](_0x8c2d2c,[_0xf0ab('0x37'),_0x2266f3[_0xf0ab('0x58')]]);if(!_0x2232eb){switch(_0x2266f3[_0xf0ab('0x58')]){case'unreadMessages':if(_0x2266f3['value']==0x1){_0x2eff07[_0xf0ab('0x6d')]('`'+_0x2266f3[_0xf0ab('0x58')]+_0xf0ab('0x6e'));}else{_0x2eff07['having']('`'+_0x2266f3[_0xf0ab('0x58')]+_0xf0ab('0x6f'));}break;case _0xf0ab('0x70'):if(_0x2266f3['operator']===_0xf0ab('0x71')){if(_0x2266f3[_0xf0ab('0x72')][_0xf0ab('0x43')]('\x20')[_0xf0ab('0x52')]>0x1){_0x1e6a4e[_0x1f11aa](_0xf0ab('0x73'),qs['getFullTextValue'](_0x2266f3[_0xf0ab('0x72')]),null);}else{var _0x70b02d='%'+_0x2266f3[_0xf0ab('0x72')]+'%';_0x1e6a4e[_0x1f11aa](_0xf0ab('0x74'),_0x70b02d,_0x70b02d,_0x70b02d);}}else{_0x2232eb=_[_0xf0ab('0x6c')](_0x8c2d2c,[_0xf0ab('0x37'),_0xf0ab('0x75')]);_0x2266f3[_0xf0ab('0x58')]=_0xf0ab('0x75');_0x5154f5=as[_0xf0ab('0x76')](_0x1d4a72,_0x2232eb[_0xf0ab('0x49')],_0x2266f3);_0x1e6a4e[_0x1f11aa](_0x5154f5[_0xf0ab('0x77')],_0x5154f5[_0xf0ab('0x72')]['start'],_0x5154f5['value'][_0xf0ab('0x35')]);}break;case _0xf0ab('0x78'):var _0x325ad6=_0x2266f3['value'][_0xf0ab('0x43')](',')['map'](function(_0x1a32dc){return Number(_0x1a32dc);});_0x325ad6[_0xf0ab('0x44')](function(_0x1787e2){_0x5b24e3['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1787e2+',%');});_0x41ed17=_[_0xf0ab('0x79')](_0x41ed17,_0x325ad6);break;case'User':if(_0x2266f3['operator']===_0xf0ab('0x71')){_0x1e6a4e[_0x1f11aa](_0xf0ab('0x7a'),'%'+_0x2266f3[_0xf0ab('0x72')]+'%',null);}else{_0x2232eb=_['find'](_0x8c2d2c,[_0xf0ab('0x37'),_0xf0ab('0x7b')]);_0x2266f3[_0xf0ab('0x58')]=_0xf0ab('0x7b');_0x5154f5=as['buildExpression'](_0x1d4a72,_0x2232eb['type'],_0x2266f3);_0x1e6a4e[_0x1f11aa](_0x5154f5['text'],_0x5154f5[_0xf0ab('0x72')][_0xf0ab('0x7c')],_0x5154f5[_0xf0ab('0x72')][_0xf0ab('0x35')]);}break;case _0xf0ab('0x3a'):_0x5154f5=as[_0xf0ab('0x76')]('me',null,_0x2266f3);_0x1e6a4e[_0x1f11aa](_0x5154f5[_0xf0ab('0x77')],_0x5154f5[_0xf0ab('0x72')][_0xf0ab('0x7c')],_0x5154f5[_0xf0ab('0x72')][_0xf0ab('0x35')]);break;}}else{var _0x5154f5=as[_0xf0ab('0x76')](_0x1d4a72,_0x2232eb[_0xf0ab('0x49')],_0x2266f3);_0x1e6a4e[_0x1f11aa](_0x5154f5[_0xf0ab('0x77')],_0x5154f5[_0xf0ab('0x72')][_0xf0ab('0x7c')],_0x5154f5[_0xf0ab('0x72')][_0xf0ab('0x35')]);}}}else{var _0x42f067=_(_0x2fc677['query'])[_0xf0ab('0x4d')]()[_0xf0ab('0x3f')](function(_0x4c8e95){return _['some'](_0x8c2d2c,['name',_0x4c8e95])?_0x4c8e95:undefined;})[_0xf0ab('0x7d')]()[_0xf0ab('0x72')]();if(!_[_0xf0ab('0x7e')](_0x42f067)){_0x42f067[_0xf0ab('0x44')](function(_0x15aa78){if(_0x15aa78===_0xf0ab('0x7f')){_0x2eff07['where'](_0xf0ab('0x80'),[]['concat'](_0x2fc677[_0xf0ab('0x4c')][_0x15aa78]));}else if(_0x15aa78==='createdAt'){var _0x2978a9=JSON['parse'](_0x2fc677[_0xf0ab('0x4c')][_0x15aa78])['$gte'];var _0x58ca28=JSON[_0xf0ab('0x81')](_0x2fc677[_0xf0ab('0x4c')][_0x15aa78])[_0xf0ab('0x82')];_0x2eff07[_0xf0ab('0x83')](_0xf0ab('0x84'),_0x2978a9,_0x58ca28);}else{if(_0x2fc677[_0xf0ab('0x4c')][_0x15aa78]===_0xf0ab('0x85')){_0x2eff07[_0xf0ab('0x83')]('i.'+_0x15aa78+_0xf0ab('0x86'));}else{_0x2eff07[_0xf0ab('0x83')]('i.'+_0x15aa78+_0xf0ab('0x87'),_0x2fc677[_0xf0ab('0x4c')][_0x15aa78]);}}});}if(_0x2fc677[_0xf0ab('0x4c')]['read']){if(_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x88')]==0x1){_0x2eff07[_0xf0ab('0x6d')](_0xf0ab('0x89'));}else{_0x2eff07[_0xf0ab('0x6d')](_0xf0ab('0x8a'));}}if(_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x8b')]){_0x41ed17=_[_0xf0ab('0x8c')](_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x8b')])?_0x2fc677[_0xf0ab('0x4c')]['tag']:new Array(_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x8b')]);_0x41ed17[_0xf0ab('0x44')](function(_0x2196a7){_0x5b24e3['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2196a7+',%');});}if(_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x8d')]){var _0x4463cc=_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x8d')]['replace']('\x5c','\x5c\x5c')[_0xf0ab('0x8e')](/'/g,'\x27\x27');if(qs[_0xf0ab('0x8f')](_0x4463cc)){_0x1e6a4e['or']('i.id\x20LIKE\x20?',_0x4463cc+'%');}else{_0x1e6a4e['or'](_0xf0ab('0x90'),qs['getFullTextValue'](_0x4463cc))['or'](_0xf0ab('0x91'),_0x4463cc+'%');}}}_0x2eff07[_0xf0ab('0x83')](_0x1e6a4e);_0x2eff07['group'](_0xf0ab('0x92'));var _0x148a72={'type':db['Sequelize']['QueryTypes'][_0xf0ab('0x93')],'raw':!![]};var _0x58140c=_0x2eff07[_0xf0ab('0x94')]();_0x58140c[_0xf0ab('0x58')]('i.id');_0x58140c['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xf0ab('0x95'));if(_0x1fc766[_0xf0ab('0x55')]){_0x1fc766[_0xf0ab('0x55')][_0xf0ab('0x44')](function(_0x49c89f){var _0x272f9c=_0x49c89f[0x0]===_0xf0ab('0x96')?_0x49c89f[0x0]:'i.'+_0x49c89f[0x0];_0x2eff07[_0xf0ab('0x55')](_0x272f9c,_0x49c89f[0x1]===_0xf0ab('0x97')?![]:!![]);});}if(!_[_0xf0ab('0x7e')](_0x41ed17)){_0x2eff07['having'](_0x5b24e3);_0x58140c['where'](_0xf0ab('0x98'),_0x41ed17);}BPromise[_0xf0ab('0x99')]()['then'](function(){if(!_0x61d3db){if(_0x2fc677['query'][_0xf0ab('0x7f')])return;_0x58140c[_0xf0ab('0x83')](_0xf0ab('0x9a'));_0x2eff07[_0xf0ab('0x83')](_0xf0ab('0x9a'));return;}if(_0x2fc677[_0xf0ab('0x9b')][_0xf0ab('0x9c')]!==_0xf0ab('0x3c'))return;return _0x2fc677[_0xf0ab('0x9b')][_0xf0ab('0x9d')]({'attributes':['id'],'raw':!![]})[_0xf0ab('0x21')](function(_0x52eca9){if(_['isEmpty'](_0x52eca9)){_0x58140c[_0xf0ab('0x83')]('i.ChatWebsiteId\x20IS\x20NULL');_0x2eff07[_0xf0ab('0x83')](_0xf0ab('0x9e'));}else{_0x58140c[_0xf0ab('0x83')](_0xf0ab('0x80'),_['map'](_0x52eca9,'id'));_0x2eff07[_0xf0ab('0x83')](_0xf0ab('0x80'),_[_0xf0ab('0x3f')](_0x52eca9,'id'));}});})[_0xf0ab('0x21')](function(){if(_0x2fc677[_0xf0ab('0x9b')][_0xf0ab('0x9c')]===_0xf0ab('0x3c')&&!_0x61d3db&&!_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x7f')])return[];return db[_0xf0ab('0x9f')][_0xf0ab('0x4c')](_0x58140c[_0xf0ab('0xa0')](),_0x148a72);})[_0xf0ab('0x21')](function(_0x4211a1){_0x4bbdf6['count']=_0x4211a1[_0xf0ab('0x52')];if(_0x4bbdf6[_0xf0ab('0x31')]===0x0)return[];return db[_0xf0ab('0x9f')][_0xf0ab('0x4c')](_0xa1a416[_0xf0ab('0xa0')](),_0x148a72)[_0xf0ab('0x21')](function(_0x611cf7){_0x577c85=_['keyBy'](_0x611cf7,'id');_0x148a72=_['merge'](_0x148a72,{'model':db[_0xf0ab('0xa1')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x50')]){_0x1fc766['attributes'][_0xf0ab('0x44')](function(_0x405b34){_0x2eff07[_0xf0ab('0x58')]('i.'+_0x405b34);});}else{_0x2eff07[_0xf0ab('0x58')](_0xf0ab('0xa2'),'unreadMessages');_0x2eff07['field'](_0xf0ab('0xa3'),'Account.key');_0x2eff07[_0xf0ab('0x58')](_0xf0ab('0xa4'),'Account.mandatoryDisposition');_0x2eff07[_0xf0ab('0x58')](_0xf0ab('0xa5'),_0xf0ab('0x96'));_0x2eff07[_0xf0ab('0x58')](_0xf0ab('0xa6'));_0x2eff07['field'](_0xf0ab('0xa7'),_0xf0ab('0xa8'));_0x2eff07[_0xf0ab('0x58')](_0xf0ab('0xa9'),_0xf0ab('0xaa'));_0x2eff07['field'](_0xf0ab('0xab'),_0xf0ab('0xac'));_0x2eff07[_0xf0ab('0x58')](_0xf0ab('0xad'),_0xf0ab('0xae'));_0x2eff07['field'](_0xf0ab('0xaf'),_0xf0ab('0xb0'));_0x2eff07[_0xf0ab('0x58')]('c.fax',_0xf0ab('0xb1'));_0x2eff07['field'](_0xf0ab('0xb2'),_0xf0ab('0xb3'));_0x2eff07[_0xf0ab('0x58')](_0xf0ab('0xb4'),'Owner.internal');_0x2eff07[_0xf0ab('0x58')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x1fc766[_0xf0ab('0x30')])_0x2eff07['limit'](_0x1fc766['limit']);if(_0x1fc766[_0xf0ab('0x2e')])_0x2eff07[_0xf0ab('0x2e')](_0x1fc766['offset']);return db['sequelize']['query'](_0x2eff07['toString'](),_0x148a72);})[_0xf0ab('0x21')](function(_0x12d9b6){if(_0x12d9b6[_0xf0ab('0x52')]>0x0)_0x26508b[_0xf0ab('0x83')](_0xf0ab('0xb5'),_['map'](_0x12d9b6,'id'));return db[_0xf0ab('0x9f')][_0xf0ab('0x4c')](_0x26508b[_0xf0ab('0xa0')](),_0x148a72)[_0xf0ab('0x21')](function(_0x84eab9){var _0x27cd98=_[_0xf0ab('0xb6')](_0x84eab9,'ChatInteractionId');var _0x16dca7=[];_0x12d9b6[_0xf0ab('0x44')](function(_0x39633a){_0x16dca7[_0xf0ab('0x45')](updateChatInteraction(_0x39633a,_0x577c85,_0x27cd98));});return BPromise[_0xf0ab('0xb7')](_0x16dca7);});});})[_0xf0ab('0x21')](function(_0x527a4b){_0x4bbdf6[_0xf0ab('0xb8')]=_0x527a4b;return _0x4bbdf6;})[_0xf0ab('0x21')](respondWithFilteredResult(_0x4e6c41,_0x1fc766))[_0xf0ab('0x46')](handleError(_0x4e6c41,null));};exports[_0xf0ab('0xb9')]=function(_0x4ca7a3,_0x426419){var _0x395bf6={'raw':![],'where':{'id':_0x4ca7a3['params']['id']}},_0x5b7744={};_0x5b7744[_0xf0ab('0x4b')]=_[_0xf0ab('0x4d')](db[_0xf0ab('0xa1')][_0xf0ab('0x47')]);_0x5b7744[_0xf0ab('0x4c')]=_[_0xf0ab('0x4d')](_0x4ca7a3[_0xf0ab('0x4c')]);_0x5b7744[_0xf0ab('0x4e')]=_['intersection'](_0x5b7744[_0xf0ab('0x4b')],_0x5b7744['query']);_0x395bf6['attributes']=_[_0xf0ab('0x4f')](_0x5b7744[_0xf0ab('0x4b')],qs[_0xf0ab('0x50')](_0x4ca7a3[_0xf0ab('0x4c')][_0xf0ab('0x50')]));_0x395bf6[_0xf0ab('0x51')]=_0x395bf6[_0xf0ab('0x51')][_0xf0ab('0x52')]?_0x395bf6['attributes']:_0x5b7744[_0xf0ab('0x4b')];if(_0x4ca7a3[_0xf0ab('0x4c')][_0xf0ab('0xba')]){_0x395bf6[_0xf0ab('0xbb')]=[{'all':!![]}];}_0x395bf6=_[_0xf0ab('0x39')]({},_0x395bf6,_0x4ca7a3[_0xf0ab('0xbc')]);return db[_0xf0ab('0xa1')][_0xf0ab('0x6c')](_0x395bf6)[_0xf0ab('0x21')](handleEntityNotFound(_0x426419,null))[_0xf0ab('0x21')](respondWithResult(_0x426419,null))['catch'](handleError(_0x426419,null));};exports['create']=function(_0x58946c,_0x2f339d){return db['ChatInteraction']['create'](_0x58946c[_0xf0ab('0x3a')],{})[_0xf0ab('0x21')](respondWithResult(_0x2f339d,0xc9))[_0xf0ab('0x46')](handleError(_0x2f339d,null));};exports[_0xf0ab('0x33')]=function(_0xdf495,_0x55a296){if(_0xdf495[_0xf0ab('0x3a')]['id']){delete _0xdf495[_0xf0ab('0x3a')]['id'];}return db[_0xf0ab('0xa1')][_0xf0ab('0x6c')]({'where':{'id':_0xdf495[_0xf0ab('0xbd')]['id']}})[_0xf0ab('0x21')](handleEntityNotFound(_0x55a296,null))[_0xf0ab('0x21')](saveUpdates(_0xdf495[_0xf0ab('0x3a')],null))['then'](respondWithResult(_0x55a296,null))[_0xf0ab('0x46')](handleError(_0x55a296,null));};exports['destroy']=function(_0x3c1a2c,_0x17a3b6){return db['ChatInteraction'][_0xf0ab('0x6c')]({'where':{'id':_0x3c1a2c[_0xf0ab('0xbd')]['id']}})[_0xf0ab('0x21')](handleEntityNotFound(_0x17a3b6,null))[_0xf0ab('0x21')](removeEntity(_0x17a3b6,null))[_0xf0ab('0x46')](handleError(_0x17a3b6,null));};exports[_0xf0ab('0xbe')]=function(_0x1f2efa,_0x1d12fb){return db[_0xf0ab('0xa1')]['describe']()[_0xf0ab('0x21')](respondWithResult(_0x1d12fb,null))[_0xf0ab('0x46')](handleError(_0x1d12fb,null));};exports['createVidaooSession']=function(_0x35486d,_0x3f5ade){var _0x135a10=_0x35486d[_0xf0ab('0xbd')]['id'];var _0x48fc7e;var _0x5f55d2;var _0x7c7c3b;return db[_0xf0ab('0xa1')]['findOne']({'where':{'id':_0x135a10}})[_0xf0ab('0x21')](function(_0x2beaaa){_0x48fc7e=_0x2beaaa;return db[_0xf0ab('0xbf')][_0xf0ab('0xc0')]({'where':{'id':_0x2beaaa[_0xf0ab('0x7f')]},'attributes':['id',_0xf0ab('0xc1'),'vidaooEscalation',_0xf0ab('0xc2'),'vidaooNote',_0xf0ab('0xc3')],'raw':!![]});})[_0xf0ab('0x21')](function(_0x354e18){if(_0x354e18&&_0x354e18['vidaooApiKey']&&_0x354e18[_0xf0ab('0xc4')]){_0x5f55d2=_0x354e18;var _0x2068d6={'interaction':{'id':_0x135a10},'agent':{'id':_0x35486d[_0xf0ab('0x9b')]['id'],'name':_0x35486d[_0xf0ab('0x9b')][_0xf0ab('0x37')],'fullname':_0x35486d[_0xf0ab('0x9b')][_0xf0ab('0x40')],'email':_0x35486d[_0xf0ab('0x9b')][_0xf0ab('0xc5')]},'contact':_0x35486d['body']['contact'],'account':_0x35486d[_0xf0ab('0x3a')][_0xf0ab('0x3d')]};var _0x35b480={'rejectUnauthorized':![],'method':_0xf0ab('0xc6'),'url':_0xf0ab('0xc7'),'headers':{'X-APIKEY':_0x354e18[_0xf0ab('0xc1')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x35486d[_0xf0ab('0x9b')][_0xf0ab('0xc5')]],'buttons':null,'topic':_0x5f55d2[_0xf0ab('0xc2')],'note':_[_0xf0ab('0xc8')](_0x5f55d2['vidaooNote'])?null:getMustacheRender(_0x5f55d2[_0xf0ab('0xc9')],_0x2068d6),'metadata':null},'redirect':_0xf0ab('0xca'),'json':!![]};try{if(!_[_0xf0ab('0xc8')](_0x5f55d2[_0xf0ab('0xc3')])){var _0x41e2d8=getMustacheRender(_0x5f55d2[_0xf0ab('0xc3')],_0x2068d6);var _0x57f44d=JSON[_0xf0ab('0x81')](_0x41e2d8);_0x35b480[_0xf0ab('0x3a')][_0xf0ab('0xcb')]=_0x57f44d;}}catch(_0x533b37){throw new db[(_0xf0ab('0xcc'))]['ValidationError']('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x35b480);}else{throw new db[(_0xf0ab('0xcc'))][(_0xf0ab('0xcd'))](_0xf0ab('0xce'));}})['then'](function(_0x1697ca){_0x7c7c3b=_0x1697ca;if(_0x7c7c3b['id']){var _0x15da8a={'body':_0x7c7c3b[_0xf0ab('0xcf')],'ChatWebsiteId':_0x5f55d2['id'],'ChatInteractionId':_0x48fc7e['id'],'direction':'out','UserId':_0x35486d[_0xf0ab('0x9b')]['id']};return db[_0xf0ab('0xd0')][_0xf0ab('0xd1')](_0x15da8a,{});}else{throw new db['Sequelize'][(_0xf0ab('0xcd'))](_0xf0ab('0xd2'));}})[_0xf0ab('0x21')](function(){return _0x48fc7e[_0xf0ab('0xd3')]({'vidaooSessionId':_0x7c7c3b['id']});})[_0xf0ab('0x21')](respondWithResult(_0x3f5ade,null))[_0xf0ab('0x46')](handleError(_0x3f5ade,null));};exports[_0xf0ab('0xd4')]=function(_0x115e3d,_0x2d0f9c){if(_0x115e3d[_0xf0ab('0x3a')]['id']){delete _0x115e3d[_0xf0ab('0x3a')]['id'];}return db[_0xf0ab('0xa1')][_0xf0ab('0x6c')]({'where':{'id':_0x115e3d[_0xf0ab('0xbd')]['id']},'include':[{'model':db['CmContact'],'as':'Contact'}]})[_0xf0ab('0x21')](handleEntityNotFound(_0x2d0f9c,null))[_0xf0ab('0x21')](saveUpdates(_0x115e3d['body'],null))[_0xf0ab('0x21')](respondWithResult(_0x2d0f9c,null))['catch'](handleError(_0x2d0f9c,null));};exports[_0xf0ab('0xd5')]=function(_0x1e9768,_0x4398a3,_0x4195d9){if(_0x1e9768[_0xf0ab('0x3a')]['id']){delete _0x1e9768[_0xf0ab('0x3a')]['id'];}return db[_0xf0ab('0xa1')][_0xf0ab('0x6c')]({'where':{'id':_0x1e9768[_0xf0ab('0xbd')]['id']}})[_0xf0ab('0x21')](function(_0x5f10a5){if(!_0x5f10a5){logger[_0xf0ab('0x28')](_0xf0ab('0xd6'),_0xf0ab('0xd5'),0x194,_0xf0ab('0xd7'));_0x4398a3[_0xf0ab('0x2b')](0x194);}else{if(_0x5f10a5[_0xf0ab('0x7b')]){throw new db['Sequelize']['ValidationError'](_0xf0ab('0xd8'));}}return _0x5f10a5;})[_0xf0ab('0x21')](function(_0x564124){if(_0x564124){return _0x564124[_0xf0ab('0x33')]({'closed':_0x1e9768[_0xf0ab('0x3a')][_0xf0ab('0xd9')],'disposition':_0x1e9768['body'][_0xf0ab('0xda')]})[_0xf0ab('0x21')](function(_0x2d9046){return _0x2d9046;});}})[_0xf0ab('0x21')](function(_0x4e5f1e){return respondWithRpcPromise(_0xf0ab('0xdb'),_0xf0ab('0xd5'),_0x1e9768[_0xf0ab('0x3a')],client9004);})['then'](respondWithResult(_0x4398a3,null))['catch'](handleError(_0x4398a3,null));};exports['attachmentUpload']=function(_0x581cb1,_0x22251d,_0x2b5993){_0x581cb1[_0xf0ab('0x3a')]['name']=_0x581cb1[_0xf0ab('0xdc')]['originalname'];_0x581cb1[_0xf0ab('0x3a')][_0xf0ab('0xdd')]=_0x581cb1[_0xf0ab('0xdc')][_0xf0ab('0xde')];_0x581cb1[_0xf0ab('0x3a')][_0xf0ab('0x49')]=_0x581cb1[_0xf0ab('0xdc')][_0xf0ab('0xdf')];return db[_0xf0ab('0xe0')][_0xf0ab('0xd1')](_0x581cb1[_0xf0ab('0x3a')])[_0xf0ab('0x21')](respondWithResult(_0x22251d,0xc9))[_0xf0ab('0x46')](handleError(_0x22251d,null));};exports[_0xf0ab('0xe1')]=function(_0x4d09bf,_0x415b9d,_0x11ed58){return db[_0xf0ab('0xa1')]['findOne']({'where':{'id':_0x4d09bf[_0xf0ab('0xbd')]['id']},'raw':!![]})[_0xf0ab('0x21')](handleEntityNotFound(_0x415b9d,null))[_0xf0ab('0x21')](function(_0x278e32){if(_0x278e32){if(_0x278e32['closed']){return _0x415b9d[_0xf0ab('0x2c')](0x193)[_0xf0ab('0x2d')]({'status':0x193,'message':_0xf0ab('0xe2')});}return db[_0xf0ab('0xe0')][_0xf0ab('0xc0')]({'where':{'id':_0x4d09bf[_0xf0ab('0x4c')][_0xf0ab('0xe3')]},'raw':!![]})[_0xf0ab('0x21')](handleEntityNotFound(_0x415b9d,null));}})['then'](function(_0xadae03){if(_0xadae03){var _0x550b00=_0xadae03[_0xf0ab('0xe4')]!==null;var _0x2bfb6a=path[_0xf0ab('0xe5')](config['root'],_0xf0ab('0xe6'));if(_0x550b00){_0x2bfb6a=path[_0xf0ab('0xe5')](_0x2bfb6a,'offline-chat/');}var _0x5d62e4=path['join'](_0x2bfb6a,_0xadae03['basename']);return _0x415b9d[_0xf0ab('0xe7')](_0x5d62e4);}})['catch'](handleError(_0x415b9d,null));};exports['close']=function(_0x3b8bbe,_0x7e24c4){var _0x2d0ea3=null;var _0x4a18ad=null;var _0x57aaae=null;var _0x2ab0be=null;if(_0x3b8bbe[_0xf0ab('0x3a')]['id']){delete _0x3b8bbe['body']['id'];}if(_0x3b8bbe[_0xf0ab('0x3a')][_0xf0ab('0xe8')]){_0x2ab0be=path['join'](config['root'],'server/files/chat/upload/',util[_0xf0ab('0xe9')](_0xf0ab('0xea'),Date[_0xf0ab('0xeb')]()));_0x3b8bbe[_0xf0ab('0x3a')]['pathTranscript']=_0x2ab0be;}return db[_0xf0ab('0xa1')][_0xf0ab('0x6c')]({'where':{'id':_0x3b8bbe['params']['id']},'include':[{'model':db['ChatMessage'],'as':'Messages','include':[{'model':db[_0xf0ab('0xec')],'as':'User'}]}]})[_0xf0ab('0x21')](handleEntityNotFound(_0x7e24c4,null))[_0xf0ab('0x21')](saveUpdates(_0x3b8bbe[_0xf0ab('0x3a')],null))[_0xf0ab('0x21')](function(_0x116c84){if(_0x116c84){_0x2d0ea3=_0x116c84;return db[_0xf0ab('0xbf')][_0xf0ab('0x6c')]({'where':{'id':_0x2d0ea3[_0xf0ab('0x7f')]}});}})[_0xf0ab('0x21')](function(_0x1d6e15){if(_0x1d6e15){_0x57aaae=_0x1d6e15;return db[_0xf0ab('0xed')][_0xf0ab('0x6c')]({'where':{'id':_0x2d0ea3['ContactId']}});}})[_0xf0ab('0x21')](function(_0x29427c){if(_0x29427c){_0x4a18ad=_0x29427c;if(_0x2ab0be){var _0x29d4a1=null;for(var _0x50e996=0x1;_0x50e996<_0x2d0ea3['Messages'][_0xf0ab('0x52')];++_0x50e996){_0x29d4a1=_0x2d0ea3[_0xf0ab('0xee')][_0x50e996];var _0x8e04bb=_0x29d4a1[_0xf0ab('0x7b')]?util[_0xf0ab('0xe9')](_0xf0ab('0xef'),_0x57aaae[_0xf0ab('0xf0')],_0x29d4a1[_0xf0ab('0x7b')]):_0xf0ab('0xf1');var _0xc1537e=_0x3b8bbe[_0xf0ab('0x3a')][_0xf0ab('0xf2')]||util[_0xf0ab('0xe9')](_0xf0ab('0xef'),_0xf0ab('0xf3'),_0x29d4a1[_0xf0ab('0x75')]);switch(_0x57aaae[_0xf0ab('0xf4')]){case _0xf0ab('0xf5'):_0x8e04bb=_0x29d4a1[_0xf0ab('0x7b')]?util[_0xf0ab('0xe9')](_0xf0ab('0xef'),_0x57aaae['agentAlias'],_0x29d4a1[_0xf0ab('0x7b')]):'System';break;case _0xf0ab('0xf6'):_0x8e04bb=_0x29d4a1[_0xf0ab('0x7b')]?_0x29d4a1[_0xf0ab('0xec')][_0xf0ab('0xf7')]||_0x29d4a1['User'][_0xf0ab('0x40')]:'System';break;case'agent_fullname':_0x8e04bb=_0x29d4a1['UserId']?_0x29d4a1[_0xf0ab('0xec')][_0xf0ab('0x40')]:_0xf0ab('0xf1');break;default:_0x8e04bb=_0x29d4a1['UserId']?util[_0xf0ab('0xe9')](_0xf0ab('0xef'),_0x57aaae[_0xf0ab('0xf0')],_0x29d4a1[_0xf0ab('0x7b')]):_0xf0ab('0xf1');}var _0x2c39f0=util[_0xf0ab('0xe9')](_0xf0ab('0xf8'),moment(_0x29d4a1[_0xf0ab('0xf9')])[_0xf0ab('0xe9')](_0xf0ab('0xfa')),_0x29d4a1[_0xf0ab('0xfb')]==='in'?_0xc1537e:_0x8e04bb,_0x29d4a1['body']);if(!_0x29d4a1[_0xf0ab('0xfc')]){fs[_0xf0ab('0xfd')](_0x2ab0be,_0x2c39f0);}}return db[_0xf0ab('0xfe')][_0xf0ab('0xc0')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xf0ab('0xff'),'raw':!![]}]});}}})['then'](function(_0x21eb2b){if(_0x21eb2b&&_0x21eb2b['Smtp']&&_0x3b8bbe[_0xf0ab('0x3a')]){var _0x262659={'tls':{'rejectUnauthorized':![]}};if(_0x21eb2b['Smtp'][_0xf0ab('0x100')]){_0x262659[_0xf0ab('0x100')]=_0x21eb2b[_0xf0ab('0xff')][_0xf0ab('0x100')];}else{_0x262659[_0xf0ab('0x101')]=_0x21eb2b['Smtp'][_0xf0ab('0x101')];_0x262659[_0xf0ab('0x102')]=_0x21eb2b[_0xf0ab('0xff')]['port'];_0x262659['secure']=_0x21eb2b[_0xf0ab('0xff')][_0xf0ab('0x103')];}if(_0x21eb2b[_0xf0ab('0xff')][_0xf0ab('0x104')]){_0x262659['auth']={'user':_0x21eb2b['Smtp'][_0xf0ab('0x9b')],'pass':_0x21eb2b[_0xf0ab('0xff')]['pass']};}return respondWithRpcPromise('SendMail',_0xf0ab('0x105'),{'account':_0x262659,'message':{'from':util['format'](_0xf0ab('0x106'),_0x21eb2b['name'],_0x21eb2b[_0xf0ab('0xc5')]||_0x21eb2b[_0xf0ab('0xff')][_0xf0ab('0x9b')]),'to':_0x3b8bbe[_0xf0ab('0x3a')][_0xf0ab('0xe8')],'subject':_0xf0ab('0x107'),'text':util[_0xf0ab('0xe9')](_0xf0ab('0x108'),_0x3b8bbe['body'][_0xf0ab('0xe8')]),'attachments':[{'path':_0x2ab0be}]}})[_0xf0ab('0x21')](function(){return _0x2d0ea3;})[_0xf0ab('0x46')](function(_0x15f041){console[_0xf0ab('0x28')](_0x15f041);});}else{return _0x2d0ea3;}})['then'](respondWithStatusCode(_0x7e24c4,0xc8))[_0xf0ab('0x46')](handleError(_0x7e24c4,null));};exports[_0xf0ab('0x109')]=function(_0x5eda4b,_0x57a8ab,_0x3cee1d){return db[_0xf0ab('0xd0')][_0xf0ab('0x6c')]({'where':{'id':_0x5eda4b[_0xf0ab('0xbd')]['id']}})[_0xf0ab('0x21')](handleEntityNotFound(_0x57a8ab,null))[_0xf0ab('0x21')](function(_0x4dff6e){if(_0x4dff6e){return _0x4dff6e[_0xf0ab('0x109')](_0x5eda4b[_0xf0ab('0x3a')][_0xf0ab('0x10a')],_[_0xf0ab('0x10b')](_0x5eda4b[_0xf0ab('0x3a')],[_0xf0ab('0x10a'),'id'])||{});}})['then'](respondWithResult(_0x57a8ab,null))[_0xf0ab('0x46')](handleError(_0x57a8ab,null));};exports['getMessages']=function(_0x283bf5,_0x1afcea,_0x22a9f8){var _0x33dbfc={'raw':![],'where':{}};var _0x487318={};var _0x546e13={'count':0x0,'rows':[]};return db[_0xf0ab('0xa1')]['findOne']({'where':{'id':_0x283bf5[_0xf0ab('0xbd')]['id']}})[_0xf0ab('0x21')](handleEntityNotFound(_0x1afcea,null))[_0xf0ab('0x21')](function(_0xa3b903){if(_0xa3b903){_0x487318['model']=_[_0xf0ab('0x4d')](db[_0xf0ab('0xd0')][_0xf0ab('0x47')]);_0x487318[_0xf0ab('0x4c')]=_['keys'](_0x283bf5[_0xf0ab('0x4c')]);_0x487318[_0xf0ab('0x4e')]=_['intersection'](_0x487318[_0xf0ab('0x4b')],_0x487318[_0xf0ab('0x4c')]);_0x33dbfc[_0xf0ab('0x51')]=_[_0xf0ab('0x4f')](_0x487318[_0xf0ab('0x4b')],qs['fields'](_0x283bf5[_0xf0ab('0x4c')][_0xf0ab('0x50')]));_0x33dbfc[_0xf0ab('0x51')]=_0x33dbfc['attributes'][_0xf0ab('0x52')]?_0x33dbfc[_0xf0ab('0x51')]:_0x487318[_0xf0ab('0x4b')];if(!_0x283bf5[_0xf0ab('0x4c')][_0xf0ab('0x53')](_0xf0ab('0x54'))){_0x33dbfc[_0xf0ab('0x30')]=qs[_0xf0ab('0x30')](_0x283bf5[_0xf0ab('0x4c')][_0xf0ab('0x30')]);_0x33dbfc['offset']=qs['offset'](_0x283bf5[_0xf0ab('0x4c')]['offset']);}_0x33dbfc['order']=qs[_0xf0ab('0x56')](_0x283bf5[_0xf0ab('0x4c')]['sort']);_0x33dbfc[_0xf0ab('0x83')]=qs[_0xf0ab('0x4e')](_[_0xf0ab('0x10c')](_0x283bf5['query'],_0x487318[_0xf0ab('0x4e')]));_0x33dbfc['where'][_0xf0ab('0x10d')]=_0xa3b903['id'];if(_0x283bf5['query'][_0xf0ab('0x8d')]){_0x33dbfc[_0xf0ab('0x83')]=_[_0xf0ab('0x39')](_0x33dbfc['where'],{'$or':_[_0xf0ab('0x3f')](_0x33dbfc[_0xf0ab('0x51')],function(_0x2ddc1d){var _0x3cef14={};_0x3cef14[_0x2ddc1d]={'$like':'%'+_0x283bf5['query'][_0xf0ab('0x8d')]+'%'};return _0x3cef14;})});}if(_0x283bf5[_0xf0ab('0x4c')]['$gte']){var _0x38ea18=_0x283bf5[_0xf0ab('0x4c')]['$gte']['split'](',');var _0x7ee6b3={};_0x7ee6b3[_0x38ea18[0x0]]={'$gte':moment(_0x38ea18[0x1])[_0xf0ab('0xe9')](_0xf0ab('0x10e'))};_0x33dbfc['where']=_[_0xf0ab('0x39')](_0x33dbfc['where'],_0x7ee6b3);}_0x33dbfc=_[_0xf0ab('0x39')]({},_0x33dbfc,_0x283bf5['options']);return db[_0xf0ab('0xd0')]['count']({'where':_0x33dbfc['where']})['then'](function(_0x1d1451){_0x546e13['count']=_0x1d1451;if(_0x283bf5[_0xf0ab('0x4c')][_0xf0ab('0xba')]){_0x33dbfc[_0xf0ab('0xbb')]=[{'all':!![]}];}return db[_0xf0ab('0xd0')][_0xf0ab('0x10f')](_0x33dbfc);})['then'](function(_0x16a1d2){_0x546e13[_0xf0ab('0xb8')]=_0x16a1d2;return _0x546e13;});}})[_0xf0ab('0x21')](respondWithFilteredResult(_0x1afcea,_0x33dbfc))[_0xf0ab('0x46')](handleError(_0x1afcea,null));};exports[_0xf0ab('0x110')]=function(_0x4b91de,_0x3a602f,_0x47788a){var _0x3592f1={'where':{}},_0x577f13={},_0x2f99c2={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xf0ab('0xc0')]({'where':{'id':_0x4b91de[_0xf0ab('0xbd')]['id']}})['then'](handleEntityNotFound(_0x3a602f,null))['then'](function(_0x43c6b8){if(_0x43c6b8){_0x577f13['model']=_[_0xf0ab('0x4d')](db[_0xf0ab('0xd0')][_0xf0ab('0x47')]);_0x577f13[_0xf0ab('0x4c')]=_[_0xf0ab('0x4d')](_0x4b91de[_0xf0ab('0x4c')]);_0x577f13['filters']=_[_0xf0ab('0x4f')](_0x577f13[_0xf0ab('0x4b')],_0x577f13[_0xf0ab('0x4c')]);_0x3592f1[_0xf0ab('0x51')]=_[_0xf0ab('0x4f')](_0x577f13[_0xf0ab('0x4b')],qs[_0xf0ab('0x50')](_0x4b91de['query'][_0xf0ab('0x50')]));_0x3592f1[_0xf0ab('0x51')]=_0x3592f1['attributes'][_0xf0ab('0x52')]?_0x3592f1['attributes']:_0x577f13[_0xf0ab('0x4b')];if(!_0x4b91de['query']['hasOwnProperty']('nolimit')){_0x3592f1[_0xf0ab('0x30')]=qs[_0xf0ab('0x30')](_0x4b91de[_0xf0ab('0x4c')][_0xf0ab('0x30')]);_0x3592f1[_0xf0ab('0x2e')]=qs[_0xf0ab('0x2e')](_0x4b91de[_0xf0ab('0x4c')][_0xf0ab('0x2e')]);}_0x3592f1[_0xf0ab('0x55')]=qs[_0xf0ab('0x56')](_0x4b91de[_0xf0ab('0x4c')][_0xf0ab('0x56')]);_0x3592f1[_0xf0ab('0x83')]=qs[_0xf0ab('0x4e')](_[_0xf0ab('0x10c')](_0x4b91de[_0xf0ab('0x4c')],_0x577f13[_0xf0ab('0x4e')]));_0x3592f1['where'][_0xf0ab('0x10d')]=_0x43c6b8['id'];if(_0x4b91de['query'][_0xf0ab('0x8d')]){_0x3592f1['where']=_[_0xf0ab('0x39')](_0x3592f1[_0xf0ab('0x83')],{'$or':_[_0xf0ab('0x3f')](_0x3592f1['attributes'],function(_0x58f64c){var _0x5dc7d4={};_0x5dc7d4[_0x58f64c]={'$like':'%'+_0x4b91de[_0xf0ab('0x4c')][_0xf0ab('0x8d')]+'%'};return _0x5dc7d4;})});}_0x3592f1['where'][_0xf0ab('0xfc')]=![];if(_0x4b91de[_0xf0ab('0x4c')]['id']){_0x3592f1[_0xf0ab('0x83')]['id']={'$gt':_0x4b91de[_0xf0ab('0x4c')]['id']};}_0x3592f1=_['merge']({},_0x3592f1,_0x4b91de['options']);return db[_0xf0ab('0xd0')][_0xf0ab('0x31')]({'where':_0x3592f1[_0xf0ab('0x83')]})[_0xf0ab('0x21')](function(_0x2ab983){_0x2f99c2['count']=_0x2ab983;_0x3592f1[_0xf0ab('0xbb')]=[];if(_0x4b91de['query'][_0xf0ab('0x111')]){_0x3592f1[_0xf0ab('0xbb')][_0xf0ab('0x45')]({'model':db['User'],'as':_0xf0ab('0xec'),'attributes':['id',_0xf0ab('0x40'),_0xf0ab('0xf7')]});}if(_0x4b91de[_0xf0ab('0x4c')]['includeAll']){_0x3592f1[_0xf0ab('0xbb')]=[{'all':!![]}];}return db[_0xf0ab('0xd0')][_0xf0ab('0x10f')](_0x3592f1);})[_0xf0ab('0x21')](function(_0x3d70c0){_0x2f99c2[_0xf0ab('0xb8')]=_0x3d70c0;return _0x2f99c2;});}})[_0xf0ab('0x21')](respondWithFilteredResult(_0x3a602f,_0x3592f1))[_0xf0ab('0x46')](handleError(_0x3a602f,null));};exports['addTags']=function(_0x4d10af,_0x5cf4bd,_0x368523){return db['ChatInteraction'][_0xf0ab('0x6c')]({'where':{'id':_0x4d10af['params']['id']}})[_0xf0ab('0x21')](handleEntityNotFound(_0x5cf4bd,null))[_0xf0ab('0x21')](function(_0x46a38a){if(_0x46a38a){return _0x46a38a[_0xf0ab('0x112')](_0x4d10af[_0xf0ab('0x3a')][_0xf0ab('0x10a')],_['omit'](_0x4d10af[_0xf0ab('0x3a')],[_0xf0ab('0x10a'),'id'])||{})[_0xf0ab('0x113')](function(){return db['Tag'][_0xf0ab('0x10f')]({'attributes':['id',_0xf0ab('0x37'),_0xf0ab('0x59')],'where':{'id':_0x4d10af[_0xf0ab('0x3a')][_0xf0ab('0x10a')]}});})[_0xf0ab('0x21')](function(_0x1df97b){socket[_0xf0ab('0x114')](_0xf0ab('0x115'),{'id':Number(_0x4d10af[_0xf0ab('0xbd')]['id']),'tags':_0x1df97b||[]});return{'id':Number(_0x4d10af[_0xf0ab('0xbd')]['id']),'tags':_0x1df97b||[]};});}})[_0xf0ab('0x21')](respondWithResult(_0x5cf4bd,null))['catch'](handleError(_0x5cf4bd,null));};exports[_0xf0ab('0x116')]=function(_0x3ca465,_0x4e379d,_0x122e66){return db['ChatInteraction'][_0xf0ab('0x6c')]({'where':{'id':_0x3ca465[_0xf0ab('0xbd')]['id']}})[_0xf0ab('0x21')](handleEntityNotFound(_0x4e379d,null))[_0xf0ab('0x21')](function(_0x5c56e0){if(_0x5c56e0){return _0x5c56e0[_0xf0ab('0x116')](_0x3ca465[_0xf0ab('0x4c')][_0xf0ab('0x10a')]);}})['then'](respondWithStatusCode(_0x4e379d,null))[_0xf0ab('0x46')](handleError(_0x4e379d,null));};exports[_0xf0ab('0xe7')]=function(_0x2baa40,_0x4ff52d){var _0x2a2fea=moment()[_0xf0ab('0x117')]()[_0xf0ab('0xa0')]();var _0x4eccbd=path['join'](config['root'],_0xf0ab('0x118'),_0xf0ab('0x119'),_0xf0ab('0x11a'));var _0x5b6475=path[_0xf0ab('0xe5')](config[_0xf0ab('0x11b')],'server',_0xf0ab('0x119'),_0xf0ab('0x11c'));var _0x595bda=path[_0xf0ab('0xe5')](_0x4eccbd,_0x2a2fea);var _0x2bd3e3=util['format']('transcript-%d-%s.zip',_0x2baa40[_0xf0ab('0xbd')]['id'],_0x2a2fea);var _0x25242e=path[_0xf0ab('0xe5')](_0x4eccbd,_0x2bd3e3);var _0x3d8794=[];_0x3d8794[_0xf0ab('0x45')]({'model':db['User'],'as':_0xf0ab('0xec'),'attributes':['id','fullname'],'raw':!![]});_0x3d8794[_0xf0ab('0x45')]({'model':db[_0xf0ab('0xed')],'as':_0xf0ab('0x70'),'attributes':['id','firstName',_0xf0ab('0x11d')],'raw':!![]});if(_0x2baa40[_0xf0ab('0x4c')][_0xf0ab('0x11c')]){_0x3d8794[_0xf0ab('0x45')]({'model':db[_0xf0ab('0xe0')],'as':'Attachment','raw':!![]});}var _0x243763=[{'model':db[_0xf0ab('0xd0')],'as':_0xf0ab('0xee'),'attributes':['id',_0xf0ab('0x3a'),'createdAt',_0xf0ab('0xfb'),_0xf0ab('0xfc'),_0xf0ab('0x88')],'include':_0x3d8794}];_0x243763['push']({'model':db[_0xf0ab('0xbf')],'as':_0xf0ab('0x11e'),'attributes':['id',_0xf0ab('0x37')]});_0x243763['push']({'model':db[_0xf0ab('0xec')],'as':_0xf0ab('0x11f'),'attributes':['id',_0xf0ab('0x40')]});return db[_0xf0ab('0xa1')]['find']({'where':{'id':_0x2baa40[_0xf0ab('0xbd')]['id']},'include':_0x243763})[_0xf0ab('0x21')](handleEntityNotFound(_0x4ff52d,null))[_0xf0ab('0x21')](function(_0x2c2e20){if(_0x2c2e20){var _0x57bd77=_0x2c2e20[_0xf0ab('0x120')]({'plain':!![]});fs[_0xf0ab('0x121')](_0x595bda);var _0x169b02={'channel':_0xf0ab('0x122'),'account':_0x57bd77[_0xf0ab('0x11e')]['name'],'agent':_0x57bd77[_0xf0ab('0x11f')]?_0x57bd77['Owner'][_0xf0ab('0x40')]:_0xf0ab('0x123'),'createdAt':moment(_0x57bd77[_0xf0ab('0xf9')])['format'](_0xf0ab('0x10e'))['toString'](),'closedAt':_0x57bd77['closed']?moment(_0x57bd77['closedAt'])[_0xf0ab('0xe9')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x57bd77[_0xf0ab('0xda')],'chatInfo':{'browser':_0x57bd77[_0xf0ab('0x124')],'os':_0x57bd77[_0xf0ab('0x125')],'referer':_0x57bd77[_0xf0ab('0x126')],'customerIp':_0x57bd77[_0xf0ab('0x127')],'customerPort':_0x57bd77['customerPort']?_0x57bd77[_0xf0ab('0x128')]:_0xf0ab('0x123')},'messages':_(_0x57bd77['Messages'])[_0xf0ab('0x129')]()[_0xf0ab('0x8d')]({'secret':![]})[_0xf0ab('0x3f')](function(_0x2aa512){if(_0x2aa512['Attachment']){var _0x26009e=path[_0xf0ab('0xe5')](_0x5b6475,_0x2aa512['Attachment'][_0xf0ab('0xdd')]);if(fs[_0xf0ab('0x12a')](_0x26009e)){fs['createReadStream'](_0x26009e)[_0xf0ab('0x12b')](fs[_0xf0ab('0x12c')](path['join'](_0x595bda,_0x2aa512[_0xf0ab('0xe0')][_0xf0ab('0xdd')])));}}return{'date':moment(_0x2aa512[_0xf0ab('0xf9')])[_0xf0ab('0xe9')](_0xf0ab('0x10e'))['toString'](),'sender':_0x2aa512[_0xf0ab('0xfb')]==='out'?_0x2aa512[_0xf0ab('0xec')]?_0x2aa512['User'][_0xf0ab('0x40')]:_0xf0ab('0xf1'):_0x2aa512[_0xf0ab('0x70')][_0xf0ab('0x12d')]+(_0x2aa512[_0xf0ab('0x70')][_0xf0ab('0x11d')]?'\x20'+_0x2aa512[_0xf0ab('0x70')]['lastName']:''),'body':_0x2aa512[_0xf0ab('0xe0')]?_0x2aa512[_0xf0ab('0xe0')][_0xf0ab('0xdd')]:_0x2aa512[_0xf0ab('0x3a')],'direction':_0x2aa512[_0xf0ab('0xfb')]==='out'?'A':'C','secret':_0x2aa512[_0xf0ab('0xfc')],'read':_0x2aa512[_0xf0ab('0x88')],'attachment':_0x2aa512[_0xf0ab('0xe0')]};})[_0xf0ab('0x72')]()};return ejs['renderFile'](path[_0xf0ab('0xe5')](config[_0xf0ab('0x11b')],_0xf0ab('0x118'),_0xf0ab('0x12e'),'downloadInteraction.ejs'),{'interaction':_0x169b02})['then'](function(_0x3ad886){var _0x3df4a2=path['join'](_0x595bda,'transcript-'+_0x57bd77['id']+'-'+_0x2a2fea+_0xf0ab('0x12f'));var _0x378d44={'path':_0x3df4a2,'channel':_0xf0ab('0x122'),'interactionId':_0x57bd77['id']};return pdf[_0xf0ab('0x130')](_0x3ad886,_0x378d44);})[_0xf0ab('0x21')](function(){return new BPromise(function(_0x1e4acb,_0x25a1eb){zipdir(_0x595bda,{'saveTo':_0x25242e},function(_0x406090,_0x414d09){if(_0x406090)return _0x25a1eb(_0x406090);return _0x1e4acb(_0x414d09);});})[_0xf0ab('0x21')](function(){return new BPromise(function(_0x235528,_0x581c80){rimraf(_0x595bda,function(_0x14332a){if(_0x14332a)_0x581c80(_0x14332a);return _0x235528();});});})[_0xf0ab('0x21')](function(){return _0x4ff52d[_0xf0ab('0xe7')](_0x25242e,_0x2bd3e3,function(_0x4f9211){if(_0x4f9211){console[_0xf0ab('0x131')](_0xf0ab('0x132'),_0x4f9211);}else{fs[_0xf0ab('0x133')](_0x25242e);}});});});}else{return _0x4ff52d['sendStatus'](0xc8);}})[_0xf0ab('0x46')](handleError(_0x4ff52d,null));}; \ No newline at end of file +var _0x087b=['jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','ChatInteraction,\x20%s,\x20%s','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','name','render','body','contact','agent','interaction','Users','map','fullname','TagIds','Tags','split','forEach','index','ChatInteraction','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filters','select','field','color','from','u.id','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','keys','compact','isEmpty','ChatWebsiteId','concat','createdAt','parse','$gte','null','where','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','i.ChatWebsiteId\x20IN\x20?','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','Contact.firstName','c.lastName','c.email','Contact.email','Contact.phone','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','push','all','show','params','rawAttributes','include','options','catch','create','describe','ChatWebsite','findOne','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','vidaooApiKey','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','ChatMessage','updateAttributes','CmContact','Contact','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','entity\x20not\x20found','disposition','file','filename','attachmentDownload','closed','Unauthorized','Attachment','attachId','ChatOfflineMessageId','join','root','offline-chat/','basename','download','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','%s%d','agentAlias','System','customer','Visitor','website_alias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','auth','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','omit','ids','getMessages','nolimit','filter','findAll','rows','getMyMessages','includeAll','addTags','setTags','chatInteractionTags:save','removeTags','unix','files','server','attachments','transcript-%d-%s.zip','firstName','Account','Owner','YYYY-MM-DD\x20HH:mm:ss','referer','customerIp','customerPort','N.A.','tail','existsSync','pipe','createWriteStream','out','lastName','downloadInteraction.ejs','transcript-','.pdf','log','err','unlinkSync','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatInteraction.socket','register'];(function(_0x568b93,_0xbc5a8e){var _0x4c859b=function(_0x388e32){while(--_0x388e32){_0x568b93['push'](_0x568b93['shift']());}};_0x4c859b(++_0xbc5a8e);}(_0x087b,0x11a));var _0xb087=function(_0x2f45ea,_0x15c656){_0x2f45ea=_0x2f45ea-0x0;var _0x485a84=_0x087b[_0x2f45ea];return _0x485a84;};'use strict';var emlformat=require(_0xb087('0x0'));var rimraf=require(_0xb087('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb087('0x2'));var moment=require('moment');var BPromise=require(_0xb087('0x3'));var Mustache=require(_0xb087('0x4'));var util=require(_0xb087('0x5'));var path=require(_0xb087('0x6'));var sox=require(_0xb087('0x7'));var csv=require(_0xb087('0x8'));var ejs=require(_0xb087('0x9'));var fs=require('fs');var fs_extra=require(_0xb087('0xa'));var _=require(_0xb087('0xb'));var squel=require(_0xb087('0xc'));var crypto=require(_0xb087('0xd'));var jsforce=require(_0xb087('0xe'));var deskjs=require(_0xb087('0xf'));var toCsv=require(_0xb087('0x8'));var querystring=require(_0xb087('0x10'));var Papa=require(_0xb087('0x11'));var Redis=require(_0xb087('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb087('0x13'));var as=require(_0xb087('0x14'));var pdf=require(_0xb087('0x15'));var hardwareService=require(_0xb087('0x16'));var logger=require(_0xb087('0x17'))(_0xb087('0x18'));var utils=require(_0xb087('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xb087('0x1a'));var db=require(_0xb087('0x1b'))['db'];config[_0xb087('0x1c')]=_['defaults'](config[_0xb087('0x1c')],{'host':_0xb087('0x1d'),'port':0x18eb});var socket=require(_0xb087('0x1e'))(new Redis(config[_0xb087('0x1c')]));require(_0xb087('0x1f'))[_0xb087('0x20')](socket);var jayson=require(_0xb087('0x21'));var client=jayson[_0xb087('0x22')][_0xb087('0x23')]({'port':0x232b});var client9004=jayson[_0xb087('0x22')]['http']({'port':0x232c});function respondWithRpcPromise(_0x43e576,_0x412b48,_0x597478,_0xcc4426){return new BPromise(function(_0x2b83b7,_0x2e9e74){var _0x5bb80b=_0xcc4426||client;return _0x5bb80b[_0xb087('0x24')](_0x43e576,_0x597478)[_0xb087('0x25')](function(_0x17200d){logger[_0xb087('0x26')]('ChatInteraction,\x20%s,\x20%s',_0x412b48,_0xb087('0x27'));logger[_0xb087('0x28')](_0xb087('0x29'),_0x412b48,_0xb087('0x27'),JSON['stringify'](_0x17200d));if(_0x17200d['error']){if(_0x17200d['error']['code']===0x1f4){logger[_0xb087('0x2a')](_0xb087('0x2b'),_0x412b48,_0x17200d[_0xb087('0x2a')][_0xb087('0x2c')]);return _0x2e9e74(_0x17200d[_0xb087('0x2a')][_0xb087('0x2c')]);}logger[_0xb087('0x2a')]('ChatInteraction,\x20%s,\x20%s',_0x412b48,_0x17200d[_0xb087('0x2a')][_0xb087('0x2c')]);return _0x2b83b7(_0x17200d[_0xb087('0x2a')][_0xb087('0x2c')]);}else{logger[_0xb087('0x26')]('ChatInteraction,\x20%s,\x20%s',_0x412b48,_0xb087('0x27'));_0x2b83b7(_0x17200d[_0xb087('0x2d')]['message']);}})['catch'](function(_0x50745a){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x412b48,_0x50745a);_0x2e9e74(_0x50745a);});});}function respondWithStatusCode(_0x304840,_0x45685d){_0x45685d=_0x45685d||0xcc;return function(_0x1d124f){if(_0x1d124f){return _0x304840[_0xb087('0x2e')](_0x45685d);}return _0x304840[_0xb087('0x2f')](_0x45685d)[_0xb087('0x30')]();};}function respondWithResult(_0xf3f41f,_0x35a52c){_0x35a52c=_0x35a52c||0xc8;return function(_0x6cfb22){if(_0x6cfb22){return _0xf3f41f[_0xb087('0x2f')](_0x35a52c)[_0xb087('0x31')](_0x6cfb22);}};}function respondWithFilteredResult(_0x31e3e6,_0xb0baf6){return function(_0x263259){if(_0x263259){var _0x593b78=typeof _0xb0baf6[_0xb087('0x32')]===_0xb087('0x33')&&typeof _0xb0baf6[_0xb087('0x34')]===_0xb087('0x33');var _0x22d441=_0x263259[_0xb087('0x35')];var _0x2e1c57=_0x593b78?0x0:_0xb0baf6[_0xb087('0x32')];var _0x53a535=_0x593b78?_0x263259['count']:_0xb0baf6[_0xb087('0x32')]+_0xb0baf6[_0xb087('0x34')];var _0x4cb5a8;if(_0x53a535>=_0x22d441){_0x53a535=_0x22d441;_0x4cb5a8=0xc8;}else{_0x4cb5a8=0xce;}_0x31e3e6[_0xb087('0x2f')](_0x4cb5a8);return _0x31e3e6[_0xb087('0x36')](_0xb087('0x37'),_0x2e1c57+'-'+_0x53a535+'/'+_0x22d441)[_0xb087('0x31')](_0x263259);}return null;};}function patchUpdates(_0x3c61c4){return function(_0x427905){try{jsonpatch[_0xb087('0x38')](_0x427905,_0x3c61c4,!![]);}catch(_0x3b7ace){return BPromise[_0xb087('0x39')](_0x3b7ace);}return _0x427905[_0xb087('0x3a')]();};}function saveUpdates(_0x442a5e,_0x3069b5){return function(_0x57ae94){if(_0x57ae94){return _0x57ae94[_0xb087('0x3b')](_0x442a5e)['then'](function(_0x906987){return _0x906987;});}return null;};}function removeEntity(_0x296e9b,_0x738e68){return function(_0xd0659e){if(_0xd0659e){return _0xd0659e[_0xb087('0x3c')]()[_0xb087('0x25')](function(){_0x296e9b[_0xb087('0x2f')](0xcc)[_0xb087('0x30')]();});}};}function handleEntityNotFound(_0x8a4c3c,_0x521c3f){return function(_0x5814c2){if(!_0x5814c2){_0x8a4c3c[_0xb087('0x2e')](0x194);}return _0x5814c2;};}function handleError(_0x3c4f33,_0x1ce1ef){_0x1ce1ef=_0x1ce1ef||0x1f4;return function(_0x2d2902){logger[_0xb087('0x2a')](_0x2d2902['stack']);if(_0x2d2902[_0xb087('0x3d')]){delete _0x2d2902[_0xb087('0x3d')];}_0x3c4f33['status'](_0x1ce1ef)['send'](_0x2d2902);};}function getMustacheRender(_0x1726c2,_0x1c7d90){return Mustache[_0xb087('0x3e')](_0x1726c2,_['merge'](_0x1c7d90[_0xb087('0x3f')],{'contact':_0x1c7d90[_0xb087('0x40')],'message':_0x1c7d90[_0xb087('0x2c')],'agent':_0x1c7d90[_0xb087('0x41')],'interaction':_0x1c7d90[_0xb087('0x42')],'account':_0x1c7d90['account']}))||'';}function getInteractionUsers(_0x7e1315,_0x5bb6bc){return new BPromise(function(_0x18e23f,_0x5a582d){try{if(_0x5bb6bc[_0x7e1315['id']]){_0x7e1315[_0xb087('0x43')]=_[_0xb087('0x44')](_0x5bb6bc[_0x7e1315['id']],function(_0x513332){return{'id':_0x513332['id'],'fullname':_0x513332[_0xb087('0x45')]};});}}catch(_0x5aa11d){_0x5a582d(_0x5aa11d);}_0x18e23f(_0x7e1315);});}function getInteractionTags(_0x46d12a,_0x4a360c){return new BPromise(function(_0x2d2c74,_0x326934){try{if(_0x46d12a[_0xb087('0x46')]){_0x46d12a[_0xb087('0x47')]=[];_0x46d12a[_0xb087('0x46')][_0xb087('0x48')](',')[_0xb087('0x49')](function(_0x5e7690){_0x46d12a[_0xb087('0x47')]['push'](_0x4a360c[_0x5e7690]);});}delete _0x46d12a[_0xb087('0x46')];}catch(_0x2d71c2){_0x326934(_0x2d71c2);}_0x2d2c74(_0x46d12a);});}function updateChatInteraction(_0x5b6924,_0xb662bf,_0x45dc6f){return new BPromise(function(_0x7650c5,_0x4c33cc){return getInteractionUsers(_0x5b6924,_0x45dc6f)[_0xb087('0x25')](function(_0x4a9ccb){return getInteractionTags(_0x4a9ccb,_0xb662bf);})[_0xb087('0x25')](function(_0x32b9d3){_0x7650c5(_0x32b9d3);})['catch'](function(_0x38cb9d){_0x4c33cc(_0x38cb9d);});});}exports[_0xb087('0x4a')]=function(_0x4addbd,_0x2b969a){var _0x171778={},_0x54eb11={},_0x93ada7={'count':0x0,'rows':[]};var _0x46c713=_[_0xb087('0x44')](db[_0xb087('0x4b')]['rawAttributes'],function(_0x47902e){return{'name':_0x47902e[_0xb087('0x4c')],'type':_0x47902e[_0xb087('0x4d')][_0xb087('0x4e')]};});_0x54eb11[_0xb087('0x4f')]=_[_0xb087('0x44')](_0x46c713,_0xb087('0x3d'));_0x54eb11['query']=_['keys'](_0x4addbd[_0xb087('0x50')]);_0x54eb11['filters']=_[_0xb087('0x51')](_0x54eb11[_0xb087('0x4f')],_0x54eb11[_0xb087('0x50')]);_0x171778[_0xb087('0x52')]=_['intersection'](_0x54eb11[_0xb087('0x4f')],qs['fields'](_0x4addbd[_0xb087('0x50')][_0xb087('0x53')]));_0x171778[_0xb087('0x52')]=_0x171778[_0xb087('0x52')][_0xb087('0x54')]?_0x171778['attributes']:_0x54eb11[_0xb087('0x4f')];if(!_0x4addbd[_0xb087('0x50')][_0xb087('0x55')]('nolimit')){_0x171778[_0xb087('0x34')]=qs['limit'](_0x4addbd['query'][_0xb087('0x34')]);_0x171778[_0xb087('0x32')]=qs['offset'](_0x4addbd[_0xb087('0x50')][_0xb087('0x32')]);}_0x171778[_0xb087('0x56')]=qs['sort'](_0x4addbd['query'][_0xb087('0x57')]);_0x171778['where']=qs['filters'](_[_0xb087('0x58')](_0x4addbd[_0xb087('0x50')],_0x54eb11[_0xb087('0x59')]),_0x46c713);var _0x4067cf=[];var _0x2bf92f=squel[_0xb087('0x5a')]()[_0xb087('0x5b')]('id')[_0xb087('0x5b')](_0xb087('0x3d'))[_0xb087('0x5b')](_0xb087('0x5c'))[_0xb087('0x5d')]('tools_tags');var _0x46d570=squel[_0xb087('0x5a')]()['field'](_0xb087('0x5e'))[_0xb087('0x5b')](_0xb087('0x5f'))[_0xb087('0x5b')](_0xb087('0x60'))[_0xb087('0x5d')](_0xb087('0x61'),'ui')[_0xb087('0x62')](_0xb087('0x63'),'u',_0xb087('0x64'));var _0x17c6d0=squel['select']()[_0xb087('0x5d')]('chat_interactions','i')[_0xb087('0x62')]('cm_contacts','c',_0xb087('0x65'))[_0xb087('0x62')](_0xb087('0x63'),'o',_0xb087('0x66'))[_0xb087('0x62')](_0xb087('0x67'),'a',_0xb087('0x68'))[_0xb087('0x62')](_0xb087('0x69'),'me',_0xb087('0x6a'))[_0xb087('0x62')](_0xb087('0x6b'),'it',_0xb087('0x6c'))[_0xb087('0x62')](_0xb087('0x6d'),'t',_0xb087('0x6e'));var _0x217f26=squel[_0xb087('0x6f')]();var _0x40ff74=[];var _0xe3cb2=squel[_0xb087('0x6f')]();var _0x459c5b;if(_0x4addbd['query'][_0xb087('0x70')]){_0x459c5b=as[_0xb087('0x71')](_0x4addbd[_0xb087('0x50')]['search']);var _0x4099cc=_0x459c5b[_0xb087('0x72')];for(var _0x5685b1=0x0;_0x5685b1<_0x459c5b[_0xb087('0x73')][_0xb087('0x54')];_0x5685b1++){var _0x2e3a14=_0x459c5b['conditions'][_0x5685b1];var _0x133c58='i';var _0x257894=_[_0xb087('0x74')](_0x46c713,[_0xb087('0x3d'),_0x2e3a14[_0xb087('0x5b')]]);if(!_0x257894){switch(_0x2e3a14[_0xb087('0x5b')]){case _0xb087('0x75'):if(_0x2e3a14[_0xb087('0x76')]==0x1){_0x17c6d0['having']('`'+_0x2e3a14[_0xb087('0x5b')]+_0xb087('0x77'));}else{_0x17c6d0[_0xb087('0x78')]('`'+_0x2e3a14['field']+_0xb087('0x79'));}break;case'Contact':if(_0x2e3a14['operator']===_0xb087('0x7a')){if(_0x2e3a14[_0xb087('0x76')]['split']('\x20')[_0xb087('0x54')]>0x1){_0x217f26[_0x4099cc]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xb087('0x7b')](_0x2e3a14[_0xb087('0x76')]),null);}else{var _0x5938ad='%'+_0x2e3a14['value']+'%';_0x217f26[_0x4099cc](_0xb087('0x7c'),_0x5938ad,_0x5938ad,_0x5938ad);}}else{_0x257894=_['find'](_0x46c713,['name',_0xb087('0x7d')]);_0x2e3a14['field']=_0xb087('0x7d');_0x390309=as['buildExpression'](_0x133c58,_0x257894[_0xb087('0x4d')],_0x2e3a14);_0x217f26[_0x4099cc](_0x390309[_0xb087('0x7e')],_0x390309[_0xb087('0x76')][_0xb087('0x7f')],_0x390309[_0xb087('0x76')][_0xb087('0x30')]);}break;case'Tag':var _0x200869=_0x2e3a14['value'][_0xb087('0x48')](',')[_0xb087('0x44')](function(_0x1060e1){return Number(_0x1060e1);});_0x200869['forEach'](function(_0x298bbb){_0xe3cb2['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x298bbb+',%');});_0x40ff74=_[_0xb087('0x80')](_0x40ff74,_0x200869);break;case _0xb087('0x81'):if(_0x2e3a14[_0xb087('0x82')]===_0xb087('0x7a')){_0x217f26[_0x4099cc](_0xb087('0x83'),'%'+_0x2e3a14[_0xb087('0x76')]+'%',null);}else{_0x257894=_['find'](_0x46c713,[_0xb087('0x3d'),_0xb087('0x84')]);_0x2e3a14['field']=_0xb087('0x84');_0x390309=as['buildExpression'](_0x133c58,_0x257894[_0xb087('0x4d')],_0x2e3a14);_0x217f26[_0x4099cc](_0x390309[_0xb087('0x7e')],_0x390309[_0xb087('0x76')][_0xb087('0x7f')],_0x390309[_0xb087('0x76')][_0xb087('0x30')]);}break;case _0xb087('0x3f'):_0x390309=as[_0xb087('0x85')]('me',null,_0x2e3a14);_0x217f26[_0x4099cc](_0x390309['text'],_0x390309['value']['start'],_0x390309[_0xb087('0x76')]['end']);break;}}else{var _0x390309=as['buildExpression'](_0x133c58,_0x257894[_0xb087('0x4d')],_0x2e3a14);_0x217f26[_0x4099cc](_0x390309[_0xb087('0x7e')],_0x390309[_0xb087('0x76')][_0xb087('0x7f')],_0x390309['value'][_0xb087('0x30')]);}}}else{var _0x53f04a=_(_0x4addbd[_0xb087('0x50')])[_0xb087('0x86')]()[_0xb087('0x44')](function(_0x42f4a3){return _['some'](_0x46c713,['name',_0x42f4a3])?_0x42f4a3:undefined;})[_0xb087('0x87')]()['value']();if(!_[_0xb087('0x88')](_0x53f04a)){_0x53f04a[_0xb087('0x49')](function(_0x2ca987){if(_0x2ca987===_0xb087('0x89')){_0x17c6d0['where']('i.ChatWebsiteId\x20IN\x20?',[][_0xb087('0x8a')](_0x4addbd['query'][_0x2ca987]));}else if(_0x2ca987===_0xb087('0x8b')){var _0x1c7cd7=JSON[_0xb087('0x8c')](_0x4addbd[_0xb087('0x50')][_0x2ca987])[_0xb087('0x8d')];var _0x581ad4=JSON[_0xb087('0x8c')](_0x4addbd[_0xb087('0x50')][_0x2ca987])['$lte'];_0x17c6d0['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x1c7cd7,_0x581ad4);}else{if(_0x4addbd[_0xb087('0x50')][_0x2ca987]===_0xb087('0x8e')){_0x17c6d0[_0xb087('0x8f')]('i.'+_0x2ca987+_0xb087('0x90'));}else{_0x17c6d0[_0xb087('0x8f')]('i.'+_0x2ca987+_0xb087('0x91'),_0x4addbd['query'][_0x2ca987]);}}});}if(_0x4addbd[_0xb087('0x50')][_0xb087('0x92')]){if(_0x4addbd[_0xb087('0x50')][_0xb087('0x92')]==0x1){_0x17c6d0[_0xb087('0x78')](_0xb087('0x93'));}else{_0x17c6d0[_0xb087('0x78')]('`unreadMessages`\x20>\x200');}}if(_0x4addbd[_0xb087('0x50')][_0xb087('0x94')]){_0x40ff74=_[_0xb087('0x95')](_0x4addbd['query'][_0xb087('0x94')])?_0x4addbd['query'][_0xb087('0x94')]:new Array(_0x4addbd[_0xb087('0x50')][_0xb087('0x94')]);_0x40ff74[_0xb087('0x49')](function(_0x463791){_0xe3cb2['or'](_0xb087('0x96'),'%,'+_0x463791+',%');});}if(_0x4addbd['query']['filter']){var _0x1e7a22=_0x4addbd[_0xb087('0x50')]['filter'][_0xb087('0x97')]('\x5c','\x5c\x5c')[_0xb087('0x97')](/'/g,'\x27\x27');if(qs[_0xb087('0x98')](_0x1e7a22)){_0x217f26['or'](_0xb087('0x99'),_0x1e7a22+'%');}else{_0x217f26['or'](_0xb087('0x9a'),qs[_0xb087('0x7b')](_0x1e7a22))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x1e7a22+'%');}}}_0x17c6d0[_0xb087('0x8f')](_0x217f26);_0x17c6d0[_0xb087('0x9b')](_0xb087('0x9c'));var _0x3114ce={'type':db[_0xb087('0x9d')][_0xb087('0x9e')][_0xb087('0x9f')],'raw':!![]};var _0x1fc613=_0x17c6d0[_0xb087('0xa0')]();_0x1fc613['field'](_0xb087('0x9c'));_0x1fc613['field'](_0xb087('0xa1'),_0xb087('0x75'));if(_0x171778['order']){_0x171778[_0xb087('0x56')][_0xb087('0x49')](function(_0x8b1a5b){var _0x2a076b=_0x8b1a5b[0x0]===_0xb087('0xa2')?_0x8b1a5b[0x0]:'i.'+_0x8b1a5b[0x0];_0x17c6d0[_0xb087('0x56')](_0x2a076b,_0x8b1a5b[0x1]==='DESC'?![]:!![]);});}if(!_[_0xb087('0x88')](_0x40ff74)){_0x17c6d0[_0xb087('0x78')](_0xe3cb2);_0x1fc613[_0xb087('0x8f')](_0xb087('0xa3'),_0x40ff74);}BPromise[_0xb087('0xa4')]()['then'](function(){if(!_0x459c5b){if(_0x4addbd[_0xb087('0x50')][_0xb087('0x89')])return;_0x1fc613[_0xb087('0x8f')](_0xb087('0xa5'));_0x17c6d0[_0xb087('0x8f')](_0xb087('0xa5'));return;}if(_0x4addbd[_0xb087('0xa6')][_0xb087('0xa7')]!==_0xb087('0x41'))return;return _0x4addbd[_0xb087('0xa6')][_0xb087('0xa8')]({'attributes':['id'],'raw':!![]})['then'](function(_0x59121a){if(_[_0xb087('0x88')](_0x59121a)){_0x1fc613[_0xb087('0x8f')](_0xb087('0xa9'));_0x17c6d0[_0xb087('0x8f')](_0xb087('0xa9'));}else{_0x1fc613['where'](_0xb087('0xaa'),_[_0xb087('0x44')](_0x59121a,'id'));_0x17c6d0[_0xb087('0x8f')](_0xb087('0xaa'),_[_0xb087('0x44')](_0x59121a,'id'));}});})[_0xb087('0x25')](function(){if(_0x4addbd['user'][_0xb087('0xa7')]==='agent'&&!_0x459c5b&&!_0x4addbd['query'][_0xb087('0x89')])return[];return db[_0xb087('0xab')][_0xb087('0x50')](_0x1fc613[_0xb087('0xac')](),_0x3114ce);})['then'](function(_0x313c9b){_0x93ada7[_0xb087('0x35')]=_0x313c9b['length'];if(_0x93ada7[_0xb087('0x35')]===0x0)return[];return db['sequelize']['query'](_0x2bf92f[_0xb087('0xac')](),_0x3114ce)[_0xb087('0x25')](function(_0x414cb4){_0x4067cf=_[_0xb087('0xad')](_0x414cb4,'id');_0x3114ce=_[_0xb087('0xae')](_0x3114ce,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4addbd[_0xb087('0x50')][_0xb087('0x53')]){_0x171778[_0xb087('0x52')][_0xb087('0x49')](function(_0x48e2c6){_0x17c6d0['field']('i.'+_0x48e2c6);});}else{_0x17c6d0['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xb087('0x75'));_0x17c6d0[_0xb087('0x5b')](_0xb087('0xaf'),_0xb087('0xb0'));_0x17c6d0[_0xb087('0x5b')](_0xb087('0xb1'),_0xb087('0xb2'));_0x17c6d0['field']('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0xb087('0xa2'));_0x17c6d0[_0xb087('0x5b')](_0xb087('0xb3'));_0x17c6d0[_0xb087('0x5b')]('c.firstName',_0xb087('0xb4'));_0x17c6d0['field'](_0xb087('0xb5'),'Contact.lastName');_0x17c6d0[_0xb087('0x5b')](_0xb087('0xb6'),_0xb087('0xb7'));_0x17c6d0[_0xb087('0x5b')]('c.phone',_0xb087('0xb8'));_0x17c6d0['field']('c.mobile','Contact.mobile');_0x17c6d0[_0xb087('0x5b')]('c.fax',_0xb087('0xb9'));_0x17c6d0[_0xb087('0x5b')](_0xb087('0xba'),_0xb087('0xbb'));_0x17c6d0[_0xb087('0x5b')](_0xb087('0xbc'),_0xb087('0xbd'));_0x17c6d0[_0xb087('0x5b')](_0xb087('0xbe'),_0xb087('0x46'));}if(_0x171778[_0xb087('0x34')])_0x17c6d0[_0xb087('0x34')](_0x171778[_0xb087('0x34')]);if(_0x171778[_0xb087('0x32')])_0x17c6d0[_0xb087('0x32')](_0x171778[_0xb087('0x32')]);return db[_0xb087('0xab')][_0xb087('0x50')](_0x17c6d0['toString'](),_0x3114ce);})[_0xb087('0x25')](function(_0x5c2a14){if(_0x5c2a14[_0xb087('0x54')]>0x0)_0x46d570[_0xb087('0x8f')](_0xb087('0xbf'),_[_0xb087('0x44')](_0x5c2a14,'id'));return db[_0xb087('0xab')][_0xb087('0x50')](_0x46d570[_0xb087('0xac')](),_0x3114ce)['then'](function(_0x5103ab){var _0x5194f2=_[_0xb087('0xc0')](_0x5103ab,_0xb087('0xc1'));var _0x3a403f=[];_0x5c2a14[_0xb087('0x49')](function(_0x18b90b){_0x3a403f[_0xb087('0xc2')](updateChatInteraction(_0x18b90b,_0x4067cf,_0x5194f2));});return BPromise[_0xb087('0xc3')](_0x3a403f);});});})[_0xb087('0x25')](function(_0x181c56){_0x93ada7['rows']=_0x181c56;return _0x93ada7;})[_0xb087('0x25')](respondWithFilteredResult(_0x2b969a,_0x171778))['catch'](handleError(_0x2b969a,null));};exports[_0xb087('0xc4')]=function(_0x25910a,_0x597d80){var _0x4c3aef={'raw':![],'where':{'id':_0x25910a[_0xb087('0xc5')]['id']}},_0x2f2597={};_0x2f2597[_0xb087('0x4f')]=_[_0xb087('0x86')](db['ChatInteraction'][_0xb087('0xc6')]);_0x2f2597[_0xb087('0x50')]=_['keys'](_0x25910a['query']);_0x2f2597[_0xb087('0x59')]=_['intersection'](_0x2f2597['model'],_0x2f2597[_0xb087('0x50')]);_0x4c3aef['attributes']=_[_0xb087('0x51')](_0x2f2597[_0xb087('0x4f')],qs[_0xb087('0x53')](_0x25910a[_0xb087('0x50')][_0xb087('0x53')]));_0x4c3aef[_0xb087('0x52')]=_0x4c3aef[_0xb087('0x52')][_0xb087('0x54')]?_0x4c3aef['attributes']:_0x2f2597[_0xb087('0x4f')];if(_0x25910a['query']['includeAll']){_0x4c3aef[_0xb087('0xc7')]=[{'all':!![]}];}_0x4c3aef=_[_0xb087('0xae')]({},_0x4c3aef,_0x25910a[_0xb087('0xc8')]);return db['ChatInteraction'][_0xb087('0x74')](_0x4c3aef)[_0xb087('0x25')](handleEntityNotFound(_0x597d80,null))[_0xb087('0x25')](respondWithResult(_0x597d80,null))[_0xb087('0xc9')](handleError(_0x597d80,null));};exports['create']=function(_0x1f3ecb,_0x3e865d){return db[_0xb087('0x4b')][_0xb087('0xca')](_0x1f3ecb[_0xb087('0x3f')],{})[_0xb087('0x25')](respondWithResult(_0x3e865d,0xc9))[_0xb087('0xc9')](handleError(_0x3e865d,null));};exports['update']=function(_0x1de68b,_0xfc3490){if(_0x1de68b[_0xb087('0x3f')]['id']){delete _0x1de68b[_0xb087('0x3f')]['id'];}return db[_0xb087('0x4b')][_0xb087('0x74')]({'where':{'id':_0x1de68b['params']['id']}})[_0xb087('0x25')](handleEntityNotFound(_0xfc3490,null))[_0xb087('0x25')](saveUpdates(_0x1de68b[_0xb087('0x3f')],null))['then'](respondWithResult(_0xfc3490,null))['catch'](handleError(_0xfc3490,null));};exports[_0xb087('0x3c')]=function(_0x12c676,_0xee09f5){return db[_0xb087('0x4b')][_0xb087('0x74')]({'where':{'id':_0x12c676[_0xb087('0xc5')]['id']}})[_0xb087('0x25')](handleEntityNotFound(_0xee09f5,null))[_0xb087('0x25')](removeEntity(_0xee09f5,null))[_0xb087('0xc9')](handleError(_0xee09f5,null));};exports[_0xb087('0xcb')]=function(_0x5ef263,_0x1a7486){return db[_0xb087('0x4b')][_0xb087('0xcb')]()[_0xb087('0x25')](respondWithResult(_0x1a7486,null))[_0xb087('0xc9')](handleError(_0x1a7486,null));};exports['createVidaooSession']=function(_0x33756c,_0x2e8eb1){var _0x189e0a=_0x33756c[_0xb087('0xc5')]['id'];var _0x52268a;var _0x259ac0;var _0x547968;return db[_0xb087('0x4b')]['findOne']({'where':{'id':_0x189e0a}})['then'](function(_0x321da9){_0x52268a=_0x321da9;return db[_0xb087('0xcc')][_0xb087('0xcd')]({'where':{'id':_0x321da9['ChatWebsiteId']},'attributes':['id','vidaooApiKey',_0xb087('0xce'),_0xb087('0xcf'),_0xb087('0xd0'),_0xb087('0xd1')],'raw':!![]});})[_0xb087('0x25')](function(_0x48a94f){if(_0x48a94f&&_0x48a94f[_0xb087('0xd2')]&&_0x48a94f[_0xb087('0xce')]){_0x259ac0=_0x48a94f;var _0x290338={'interaction':{'id':_0x189e0a},'agent':{'id':_0x33756c[_0xb087('0xa6')]['id'],'name':_0x33756c[_0xb087('0xa6')][_0xb087('0x3d')],'fullname':_0x33756c['user']['fullname'],'email':_0x33756c[_0xb087('0xa6')][_0xb087('0xd3')]},'contact':_0x33756c['body'][_0xb087('0x40')],'account':_0x33756c['body']['account']};var _0x471c54={'rejectUnauthorized':![],'method':_0xb087('0xd4'),'url':_0xb087('0xd5'),'headers':{'X-APIKEY':_0x48a94f[_0xb087('0xd2')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x33756c[_0xb087('0xa6')][_0xb087('0xd3')]],'buttons':null,'topic':_0x259ac0[_0xb087('0xcf')],'note':_[_0xb087('0xd6')](_0x259ac0[_0xb087('0xd0')])?null:getMustacheRender(_0x259ac0[_0xb087('0xd0')],_0x290338),'metadata':null},'redirect':'follow','json':!![]};try{if(!_['isNull'](_0x259ac0['vidaooMetadata'])){var _0x2ebe58=getMustacheRender(_0x259ac0['vidaooMetadata'],_0x290338);var _0x173a1b=JSON['parse'](_0x2ebe58);_0x471c54['body'][_0xb087('0xd7')]=_0x173a1b;}}catch(_0x2e3036){throw new db[(_0xb087('0x9d'))][(_0xb087('0xd8'))](_0xb087('0xd9'));}return rp(_0x471c54);}else{throw new db[(_0xb087('0x9d'))][(_0xb087('0xd8'))](_0xb087('0xda'));}})[_0xb087('0x25')](function(_0x2fdcee){_0x547968=_0x2fdcee;if(_0x547968['id']){var _0x5ae13d={'body':_0x547968[_0xb087('0xdb')],'ChatWebsiteId':_0x259ac0['id'],'ChatInteractionId':_0x52268a['id'],'direction':'out','UserId':_0x33756c[_0xb087('0xa6')]['id']};return db[_0xb087('0xdc')]['create'](_0x5ae13d,{});}else{throw new db[(_0xb087('0x9d'))][(_0xb087('0xd8'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})['then'](function(){return _0x52268a[_0xb087('0xdd')]({'vidaooSessionId':_0x547968['id']});})['then'](respondWithResult(_0x2e8eb1,null))[_0xb087('0xc9')](handleError(_0x2e8eb1,null));};exports['customUpdate']=function(_0x1e04ff,_0x1a99a3){if(_0x1e04ff[_0xb087('0x3f')]['id']){delete _0x1e04ff['body']['id'];}return db[_0xb087('0x4b')][_0xb087('0x74')]({'where':{'id':_0x1e04ff[_0xb087('0xc5')]['id']},'include':[{'model':db[_0xb087('0xde')],'as':_0xb087('0xdf')}]})[_0xb087('0x25')](handleEntityNotFound(_0x1a99a3,null))[_0xb087('0x25')](saveUpdates(_0x1e04ff[_0xb087('0x3f')],null))[_0xb087('0x25')](respondWithResult(_0x1a99a3,null))[_0xb087('0xc9')](handleError(_0x1a99a3,null));};exports['abandon']=function(_0x3a5432,_0x520aa9,_0x31d03d){if(_0x3a5432[_0xb087('0x3f')]['id']){delete _0x3a5432[_0xb087('0x3f')]['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x3a5432['params']['id']}})[_0xb087('0x25')](function(_0xfaa17f){if(!_0xfaa17f){logger[_0xb087('0x2a')](_0xb087('0xe0'),_0xb087('0xe1'),0x194,_0xb087('0xe2'));_0x520aa9[_0xb087('0x2e')](0x194);}else{if(_0xfaa17f['UserId']){throw new db[(_0xb087('0x9d'))]['ValidationError']('Interaction\x20already\x20assigned');}}return _0xfaa17f;})['then'](function(_0x4cde01){if(_0x4cde01){return _0x4cde01[_0xb087('0x3b')]({'closed':_0x3a5432[_0xb087('0x3f')]['closed'],'disposition':_0x3a5432[_0xb087('0x3f')][_0xb087('0xe3')]})[_0xb087('0x25')](function(_0x500a2b){return _0x500a2b;});}})[_0xb087('0x25')](function(_0x11a1a5){return respondWithRpcPromise('AbandonInteraction',_0xb087('0xe1'),_0x3a5432[_0xb087('0x3f')],client9004);})[_0xb087('0x25')](respondWithResult(_0x520aa9,null))[_0xb087('0xc9')](handleError(_0x520aa9,null));};exports['attachmentUpload']=function(_0x270e65,_0x10c680,_0x164371){_0x270e65[_0xb087('0x3f')][_0xb087('0x3d')]=_0x270e65[_0xb087('0xe4')]['originalname'];_0x270e65[_0xb087('0x3f')]['basename']=_0x270e65[_0xb087('0xe4')][_0xb087('0xe5')];_0x270e65['body'][_0xb087('0x4d')]=_0x270e65['file']['mimetype'];return db['Attachment'][_0xb087('0xca')](_0x270e65[_0xb087('0x3f')])[_0xb087('0x25')](respondWithResult(_0x10c680,0xc9))[_0xb087('0xc9')](handleError(_0x10c680,null));};exports[_0xb087('0xe6')]=function(_0x1e0751,_0x2831b4,_0x218fe3){return db['ChatInteraction'][_0xb087('0xcd')]({'where':{'id':_0x1e0751['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x2831b4,null))[_0xb087('0x25')](function(_0x1babd3){if(_0x1babd3){if(_0x1babd3[_0xb087('0xe7')]){return _0x2831b4['status'](0x193)['json']({'status':0x193,'message':_0xb087('0xe8')});}return db[_0xb087('0xe9')][_0xb087('0xcd')]({'where':{'id':_0x1e0751[_0xb087('0x50')][_0xb087('0xea')]},'raw':!![]})[_0xb087('0x25')](handleEntityNotFound(_0x2831b4,null));}})['then'](function(_0x52341e){if(_0x52341e){var _0x54eed6=_0x52341e[_0xb087('0xeb')]!==null;var _0x12d277=path[_0xb087('0xec')](config[_0xb087('0xed')],'server/files/attachments/');if(_0x54eed6){_0x12d277=path[_0xb087('0xec')](_0x12d277,_0xb087('0xee'));}var _0x1b5422=path[_0xb087('0xec')](_0x12d277,_0x52341e[_0xb087('0xef')]);return _0x2831b4[_0xb087('0xf0')](_0x1b5422);}})[_0xb087('0xc9')](handleError(_0x2831b4,null));};exports[_0xb087('0xf1')]=function(_0x120012,_0x385065){var _0x56e768=null;var _0x5a2142=null;var _0x24171a=null;var _0x39577d=null;if(_0x120012[_0xb087('0x3f')]['id']){delete _0x120012[_0xb087('0x3f')]['id'];}if(_0x120012[_0xb087('0x3f')][_0xb087('0xf2')]){_0x39577d=path[_0xb087('0xec')](config[_0xb087('0xed')],_0xb087('0xf3'),util[_0xb087('0xf4')](_0xb087('0xf5'),Date[_0xb087('0xf6')]()));_0x120012[_0xb087('0x3f')][_0xb087('0xf7')]=_0x39577d;}return db[_0xb087('0x4b')][_0xb087('0x74')]({'where':{'id':_0x120012[_0xb087('0xc5')]['id']},'include':[{'model':db[_0xb087('0xdc')],'as':_0xb087('0xf8'),'include':[{'model':db[_0xb087('0x81')],'as':_0xb087('0x81')}]}]})[_0xb087('0x25')](handleEntityNotFound(_0x385065,null))[_0xb087('0x25')](saveUpdates(_0x120012[_0xb087('0x3f')],null))[_0xb087('0x25')](function(_0x365d41){if(_0x365d41){_0x56e768=_0x365d41;return db[_0xb087('0xcc')][_0xb087('0x74')]({'where':{'id':_0x56e768[_0xb087('0x89')]}});}})[_0xb087('0x25')](function(_0x159082){if(_0x159082){_0x24171a=_0x159082;return db[_0xb087('0xde')][_0xb087('0x74')]({'where':{'id':_0x56e768[_0xb087('0x7d')]}});}})[_0xb087('0x25')](function(_0x2d8c34){if(_0x2d8c34){_0x5a2142=_0x2d8c34;if(_0x39577d){var _0x5a50a1=null;for(var _0x57186a=0x1;_0x57186a<_0x56e768['Messages'][_0xb087('0x54')];++_0x57186a){_0x5a50a1=_0x56e768[_0xb087('0xf8')][_0x57186a];var _0x4cbc90=_0x5a50a1[_0xb087('0x84')]?util['format'](_0xb087('0xf9'),_0x24171a[_0xb087('0xfa')],_0x5a50a1[_0xb087('0x84')]):_0xb087('0xfb');var _0x39f701=_0x120012[_0xb087('0x3f')][_0xb087('0xfc')]||util[_0xb087('0xf4')](_0xb087('0xf9'),_0xb087('0xfd'),_0x5a50a1[_0xb087('0x7d')]);switch(_0x24171a['agentIdentifier']){case _0xb087('0xfe'):_0x4cbc90=_0x5a50a1[_0xb087('0x84')]?util[_0xb087('0xf4')](_0xb087('0xf9'),_0x24171a['agentAlias'],_0x5a50a1[_0xb087('0x84')]):_0xb087('0xfb');break;case _0xb087('0xff'):_0x4cbc90=_0x5a50a1[_0xb087('0x84')]?_0x5a50a1[_0xb087('0x81')][_0xb087('0x100')]||_0x5a50a1[_0xb087('0x81')][_0xb087('0x45')]:_0xb087('0xfb');break;case _0xb087('0x101'):_0x4cbc90=_0x5a50a1[_0xb087('0x84')]?_0x5a50a1[_0xb087('0x81')][_0xb087('0x45')]:_0xb087('0xfb');break;default:_0x4cbc90=_0x5a50a1[_0xb087('0x84')]?util[_0xb087('0xf4')](_0xb087('0xf9'),_0x24171a[_0xb087('0xfa')],_0x5a50a1['UserId']):_0xb087('0xfb');}var _0x2c85ed=util[_0xb087('0xf4')](_0xb087('0x102'),moment(_0x5a50a1['createdAt'])[_0xb087('0xf4')](_0xb087('0x103')),_0x5a50a1[_0xb087('0x104')]==='in'?_0x39f701:_0x4cbc90,_0x5a50a1[_0xb087('0x3f')]);if(!_0x5a50a1[_0xb087('0x105')]){fs['appendFileSync'](_0x39577d,_0x2c85ed);}}return db[_0xb087('0x106')][_0xb087('0xcd')]({'where':{'service':!![]},'include':[{'model':db[_0xb087('0x107')],'as':_0xb087('0x108'),'raw':!![]}]});}}})[_0xb087('0x25')](function(_0x17ad89){if(_0x17ad89&&_0x17ad89[_0xb087('0x108')]&&_0x120012[_0xb087('0x3f')]){var _0x58a76b={'tls':{'rejectUnauthorized':![]}};if(_0x17ad89[_0xb087('0x108')][_0xb087('0x109')]){_0x58a76b['service']=_0x17ad89[_0xb087('0x108')][_0xb087('0x109')];}else{_0x58a76b['host']=_0x17ad89[_0xb087('0x108')][_0xb087('0x10a')];_0x58a76b[_0xb087('0x10b')]=_0x17ad89[_0xb087('0x108')][_0xb087('0x10b')];_0x58a76b[_0xb087('0x10c')]=_0x17ad89[_0xb087('0x108')]['secure'];}if(_0x17ad89[_0xb087('0x108')][_0xb087('0x10d')]){_0x58a76b[_0xb087('0x10e')]={'user':_0x17ad89[_0xb087('0x108')][_0xb087('0xa6')],'pass':_0x17ad89[_0xb087('0x108')]['pass']};}return respondWithRpcPromise(_0xb087('0x10f'),_0xb087('0x110'),{'account':_0x58a76b,'message':{'from':util[_0xb087('0xf4')](_0xb087('0x111'),_0x17ad89[_0xb087('0x3d')],_0x17ad89['email']||_0x17ad89[_0xb087('0x108')][_0xb087('0xa6')]),'to':_0x120012[_0xb087('0x3f')]['mailTranscript'],'subject':_0xb087('0x112'),'text':util['format'](_0xb087('0x113'),_0x120012['body'][_0xb087('0xf2')]),'attachments':[{'path':_0x39577d}]}})['then'](function(){return _0x56e768;})[_0xb087('0xc9')](function(_0x3d916e){console['error'](_0x3d916e);});}else{return _0x56e768;}})[_0xb087('0x25')](respondWithStatusCode(_0x385065,0xc8))['catch'](handleError(_0x385065,null));};exports['addMessage']=function(_0x5180ad,_0x396660,_0x4b2169){return db[_0xb087('0xdc')]['find']({'where':{'id':_0x5180ad['params']['id']}})[_0xb087('0x25')](handleEntityNotFound(_0x396660,null))[_0xb087('0x25')](function(_0x371655){if(_0x371655){return _0x371655[_0xb087('0x114')](_0x5180ad[_0xb087('0x3f')]['ids'],_[_0xb087('0x115')](_0x5180ad[_0xb087('0x3f')],[_0xb087('0x116'),'id'])||{});}})[_0xb087('0x25')](respondWithResult(_0x396660,null))[_0xb087('0xc9')](handleError(_0x396660,null));};exports[_0xb087('0x117')]=function(_0x1ca818,_0x2ec638,_0x57d42a){var _0x451c8a={'raw':![],'where':{}};var _0x3768db={};var _0x1db8ba={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xb087('0xcd')]({'where':{'id':_0x1ca818[_0xb087('0xc5')]['id']}})[_0xb087('0x25')](handleEntityNotFound(_0x2ec638,null))['then'](function(_0x4904ea){if(_0x4904ea){_0x3768db[_0xb087('0x4f')]=_[_0xb087('0x86')](db[_0xb087('0xdc')][_0xb087('0xc6')]);_0x3768db['query']=_[_0xb087('0x86')](_0x1ca818[_0xb087('0x50')]);_0x3768db[_0xb087('0x59')]=_[_0xb087('0x51')](_0x3768db[_0xb087('0x4f')],_0x3768db['query']);_0x451c8a['attributes']=_[_0xb087('0x51')](_0x3768db[_0xb087('0x4f')],qs['fields'](_0x1ca818[_0xb087('0x50')][_0xb087('0x53')]));_0x451c8a[_0xb087('0x52')]=_0x451c8a[_0xb087('0x52')][_0xb087('0x54')]?_0x451c8a[_0xb087('0x52')]:_0x3768db[_0xb087('0x4f')];if(!_0x1ca818['query'][_0xb087('0x55')](_0xb087('0x118'))){_0x451c8a[_0xb087('0x34')]=qs['limit'](_0x1ca818['query'][_0xb087('0x34')]);_0x451c8a[_0xb087('0x32')]=qs[_0xb087('0x32')](_0x1ca818[_0xb087('0x50')]['offset']);}_0x451c8a[_0xb087('0x56')]=qs[_0xb087('0x57')](_0x1ca818[_0xb087('0x50')]['sort']);_0x451c8a['where']=qs[_0xb087('0x59')](_['pick'](_0x1ca818[_0xb087('0x50')],_0x3768db[_0xb087('0x59')]));_0x451c8a['where']['ChatInteractionId']=_0x4904ea['id'];if(_0x1ca818[_0xb087('0x50')][_0xb087('0x119')]){_0x451c8a[_0xb087('0x8f')]=_[_0xb087('0xae')](_0x451c8a['where'],{'$or':_[_0xb087('0x44')](_0x451c8a['attributes'],function(_0x52cc1a){var _0x117552={};_0x117552[_0x52cc1a]={'$like':'%'+_0x1ca818[_0xb087('0x50')][_0xb087('0x119')]+'%'};return _0x117552;})});}if(_0x1ca818[_0xb087('0x50')][_0xb087('0x8d')]){var _0x484bb5=_0x1ca818[_0xb087('0x50')]['$gte']['split'](',');var _0x46f8cf={};_0x46f8cf[_0x484bb5[0x0]]={'$gte':moment(_0x484bb5[0x1])[_0xb087('0xf4')]('YYYY-MM-DD\x20HH:mm:ss')};_0x451c8a[_0xb087('0x8f')]=_[_0xb087('0xae')](_0x451c8a[_0xb087('0x8f')],_0x46f8cf);}_0x451c8a=_[_0xb087('0xae')]({},_0x451c8a,_0x1ca818['options']);return db[_0xb087('0xdc')][_0xb087('0x35')]({'where':_0x451c8a[_0xb087('0x8f')]})[_0xb087('0x25')](function(_0x2c3d1b){_0x1db8ba['count']=_0x2c3d1b;if(_0x1ca818['query']['includeAll']){_0x451c8a[_0xb087('0xc7')]=[{'all':!![]}];}return db['ChatMessage'][_0xb087('0x11a')](_0x451c8a);})[_0xb087('0x25')](function(_0x4c1577){_0x1db8ba[_0xb087('0x11b')]=_0x4c1577;return _0x1db8ba;});}})[_0xb087('0x25')](respondWithFilteredResult(_0x2ec638,_0x451c8a))[_0xb087('0xc9')](handleError(_0x2ec638,null));};exports[_0xb087('0x11c')]=function(_0xad3eae,_0xb6682a,_0x1dbeb1){var _0x2caa79={'where':{}},_0x521e0c={},_0x1ffbd9={'count':0x0,'rows':[]};return db[_0xb087('0x4b')][_0xb087('0xcd')]({'where':{'id':_0xad3eae['params']['id']}})[_0xb087('0x25')](handleEntityNotFound(_0xb6682a,null))[_0xb087('0x25')](function(_0x3fd51b){if(_0x3fd51b){_0x521e0c[_0xb087('0x4f')]=_['keys'](db['ChatMessage'][_0xb087('0xc6')]);_0x521e0c[_0xb087('0x50')]=_[_0xb087('0x86')](_0xad3eae[_0xb087('0x50')]);_0x521e0c[_0xb087('0x59')]=_[_0xb087('0x51')](_0x521e0c['model'],_0x521e0c['query']);_0x2caa79[_0xb087('0x52')]=_[_0xb087('0x51')](_0x521e0c[_0xb087('0x4f')],qs[_0xb087('0x53')](_0xad3eae['query'][_0xb087('0x53')]));_0x2caa79[_0xb087('0x52')]=_0x2caa79[_0xb087('0x52')][_0xb087('0x54')]?_0x2caa79[_0xb087('0x52')]:_0x521e0c[_0xb087('0x4f')];if(!_0xad3eae[_0xb087('0x50')][_0xb087('0x55')](_0xb087('0x118'))){_0x2caa79[_0xb087('0x34')]=qs[_0xb087('0x34')](_0xad3eae[_0xb087('0x50')][_0xb087('0x34')]);_0x2caa79[_0xb087('0x32')]=qs[_0xb087('0x32')](_0xad3eae[_0xb087('0x50')][_0xb087('0x32')]);}_0x2caa79[_0xb087('0x56')]=qs[_0xb087('0x57')](_0xad3eae[_0xb087('0x50')]['sort']);_0x2caa79[_0xb087('0x8f')]=qs[_0xb087('0x59')](_['pick'](_0xad3eae[_0xb087('0x50')],_0x521e0c[_0xb087('0x59')]));_0x2caa79[_0xb087('0x8f')]['ChatInteractionId']=_0x3fd51b['id'];if(_0xad3eae[_0xb087('0x50')]['filter']){_0x2caa79['where']=_[_0xb087('0xae')](_0x2caa79[_0xb087('0x8f')],{'$or':_[_0xb087('0x44')](_0x2caa79[_0xb087('0x52')],function(_0x4a1749){var _0x300e08={};_0x300e08[_0x4a1749]={'$like':'%'+_0xad3eae['query'][_0xb087('0x119')]+'%'};return _0x300e08;})});}_0x2caa79[_0xb087('0x8f')][_0xb087('0x105')]=![];if(_0xad3eae['query']['id']){_0x2caa79['where']['id']={'$gt':_0xad3eae[_0xb087('0x50')]['id']};}_0x2caa79=_['merge']({},_0x2caa79,_0xad3eae['options']);return db[_0xb087('0xdc')][_0xb087('0x35')]({'where':_0x2caa79['where']})[_0xb087('0x25')](function(_0x241c68){_0x1ffbd9[_0xb087('0x35')]=_0x241c68;_0x2caa79[_0xb087('0xc7')]=[];if(_0xad3eae['query']['includeAgent']){_0x2caa79[_0xb087('0xc7')][_0xb087('0xc2')]({'model':db[_0xb087('0x81')],'as':_0xb087('0x81'),'attributes':['id','fullname',_0xb087('0x100')]});}if(_0xad3eae[_0xb087('0x50')][_0xb087('0x11d')]){_0x2caa79[_0xb087('0xc7')]=[{'all':!![]}];}return db[_0xb087('0xdc')][_0xb087('0x11a')](_0x2caa79);})[_0xb087('0x25')](function(_0x3b5740){_0x1ffbd9['rows']=_0x3b5740;return _0x1ffbd9;});}})[_0xb087('0x25')](respondWithFilteredResult(_0xb6682a,_0x2caa79))[_0xb087('0xc9')](handleError(_0xb6682a,null));};exports[_0xb087('0x11e')]=function(_0x594ddc,_0x30521e,_0x13acd8){return db[_0xb087('0x4b')][_0xb087('0x74')]({'where':{'id':_0x594ddc[_0xb087('0xc5')]['id']}})[_0xb087('0x25')](handleEntityNotFound(_0x30521e,null))['then'](function(_0x528edd){if(_0x528edd){return _0x528edd[_0xb087('0x11f')](_0x594ddc[_0xb087('0x3f')][_0xb087('0x116')],_[_0xb087('0x115')](_0x594ddc[_0xb087('0x3f')],[_0xb087('0x116'),'id'])||{})['spread'](function(){return db['Tag'][_0xb087('0x11a')]({'attributes':['id',_0xb087('0x3d'),'color'],'where':{'id':_0x594ddc['body'][_0xb087('0x116')]}});})[_0xb087('0x25')](function(_0x24ae87){socket['emit'](_0xb087('0x120'),{'id':Number(_0x594ddc[_0xb087('0xc5')]['id']),'tags':_0x24ae87||[]});return{'id':Number(_0x594ddc['params']['id']),'tags':_0x24ae87||[]};});}})[_0xb087('0x25')](respondWithResult(_0x30521e,null))['catch'](handleError(_0x30521e,null));};exports['removeTags']=function(_0x592d18,_0x5cbda4,_0x5a182e){return db[_0xb087('0x4b')]['find']({'where':{'id':_0x592d18[_0xb087('0xc5')]['id']}})[_0xb087('0x25')](handleEntityNotFound(_0x5cbda4,null))['then'](function(_0x12f2b2){if(_0x12f2b2){return _0x12f2b2[_0xb087('0x121')](_0x592d18[_0xb087('0x50')][_0xb087('0x116')]);}})['then'](respondWithStatusCode(_0x5cbda4,null))[_0xb087('0xc9')](handleError(_0x5cbda4,null));};exports[_0xb087('0xf0')]=function(_0x17d60b,_0x5df18d){var _0x538812=moment()[_0xb087('0x122')]()[_0xb087('0xac')]();var _0x39732b=path[_0xb087('0xec')](config[_0xb087('0xed')],'server',_0xb087('0x123'),'tmp');var _0x1d8582=path[_0xb087('0xec')](config['root'],_0xb087('0x124'),'files',_0xb087('0x125'));var _0x3f2e19=path[_0xb087('0xec')](_0x39732b,_0x538812);var _0x2d500c=util[_0xb087('0xf4')](_0xb087('0x126'),_0x17d60b[_0xb087('0xc5')]['id'],_0x538812);var _0x407837=path['join'](_0x39732b,_0x2d500c);var _0x220896=[];_0x220896[_0xb087('0xc2')]({'model':db[_0xb087('0x81')],'as':_0xb087('0x81'),'attributes':['id',_0xb087('0x45')],'raw':!![]});_0x220896[_0xb087('0xc2')]({'model':db[_0xb087('0xde')],'as':_0xb087('0xdf'),'attributes':['id',_0xb087('0x127'),'lastName'],'raw':!![]});if(_0x17d60b[_0xb087('0x50')][_0xb087('0x125')]){_0x220896[_0xb087('0xc2')]({'model':db[_0xb087('0xe9')],'as':_0xb087('0xe9'),'raw':!![]});}var _0x6fa760=[{'model':db['ChatMessage'],'as':_0xb087('0xf8'),'attributes':['id',_0xb087('0x3f'),_0xb087('0x8b'),'direction',_0xb087('0x105'),_0xb087('0x92')],'include':_0x220896}];_0x6fa760[_0xb087('0xc2')]({'model':db['ChatWebsite'],'as':_0xb087('0x128'),'attributes':['id',_0xb087('0x3d')]});_0x6fa760['push']({'model':db[_0xb087('0x81')],'as':_0xb087('0x129'),'attributes':['id',_0xb087('0x45')]});return db[_0xb087('0x4b')][_0xb087('0x74')]({'where':{'id':_0x17d60b['params']['id']},'include':_0x6fa760})[_0xb087('0x25')](handleEntityNotFound(_0x5df18d,null))[_0xb087('0x25')](function(_0x196111){if(_0x196111){var _0x2711ed=_0x196111['get']({'plain':!![]});fs['mkdirSync'](_0x3f2e19);var _0x2aa136={'channel':'Chat','account':_0x2711ed[_0xb087('0x128')][_0xb087('0x3d')],'agent':_0x2711ed['Owner']?_0x2711ed[_0xb087('0x129')][_0xb087('0x45')]:'N.A.','createdAt':moment(_0x2711ed['createdAt'])[_0xb087('0xf4')](_0xb087('0x12a'))[_0xb087('0xac')](),'closedAt':_0x2711ed['closed']?moment(_0x2711ed['closedAt'])['format'](_0xb087('0x12a'))[_0xb087('0xac')]():'','disposition':_0x2711ed[_0xb087('0xe3')],'chatInfo':{'browser':_0x2711ed['browserName'],'os':_0x2711ed['osName'],'referer':_0x2711ed[_0xb087('0x12b')],'customerIp':_0x2711ed[_0xb087('0x12c')],'customerPort':_0x2711ed[_0xb087('0x12d')]?_0x2711ed[_0xb087('0x12d')]:_0xb087('0x12e')},'messages':_(_0x2711ed[_0xb087('0xf8')])[_0xb087('0x12f')]()[_0xb087('0x119')]({'secret':![]})[_0xb087('0x44')](function(_0x4392f7){if(_0x4392f7[_0xb087('0xe9')]){var _0x2ce41b=path[_0xb087('0xec')](_0x1d8582,_0x4392f7[_0xb087('0xe9')][_0xb087('0xef')]);if(fs[_0xb087('0x130')](_0x2ce41b)){fs['createReadStream'](_0x2ce41b)[_0xb087('0x131')](fs[_0xb087('0x132')](path['join'](_0x3f2e19,_0x4392f7['Attachment'][_0xb087('0xef')])));}}return{'date':moment(_0x4392f7[_0xb087('0x8b')])[_0xb087('0xf4')](_0xb087('0x12a'))['toString'](),'sender':_0x4392f7[_0xb087('0x104')]===_0xb087('0x133')?_0x4392f7['User']?_0x4392f7['User'][_0xb087('0x45')]:_0xb087('0xfb'):_0x4392f7[_0xb087('0xdf')]['firstName']+(_0x4392f7[_0xb087('0xdf')][_0xb087('0x134')]?'\x20'+_0x4392f7[_0xb087('0xdf')][_0xb087('0x134')]:''),'body':_0x4392f7[_0xb087('0xe9')]?_0x4392f7[_0xb087('0xe9')][_0xb087('0xef')]:_0x4392f7['body'],'direction':_0x4392f7[_0xb087('0x104')]===_0xb087('0x133')?'A':'C','secret':_0x4392f7[_0xb087('0x105')],'read':_0x4392f7[_0xb087('0x92')],'attachment':_0x4392f7[_0xb087('0xe9')]};})['value']()};return ejs['renderFile'](path[_0xb087('0xec')](config[_0xb087('0xed')],_0xb087('0x124'),'views',_0xb087('0x135')),{'interaction':_0x2aa136})[_0xb087('0x25')](function(_0x3e4bec){var _0x52b038=path[_0xb087('0xec')](_0x3f2e19,_0xb087('0x136')+_0x2711ed['id']+'-'+_0x538812+_0xb087('0x137'));var _0x4e6b9f={'path':_0x52b038,'channel':'Chat','interactionId':_0x2711ed['id']};return pdf['createPdfFromHTML'](_0x3e4bec,_0x4e6b9f);})[_0xb087('0x25')](function(){return new BPromise(function(_0x22dea9,_0x1c9337){zipdir(_0x3f2e19,{'saveTo':_0x407837},function(_0x3d0278,_0x1c8982){if(_0x3d0278)return _0x1c9337(_0x3d0278);return _0x22dea9(_0x1c8982);});})[_0xb087('0x25')](function(){return new BPromise(function(_0x31b3e7,_0x6b8337){rimraf(_0x3f2e19,function(_0x348c92){if(_0x348c92)_0x6b8337(_0x348c92);return _0x31b3e7();});});})[_0xb087('0x25')](function(){return _0x5df18d[_0xb087('0xf0')](_0x407837,_0x2d500c,function(_0x218e1c){if(_0x218e1c){console[_0xb087('0x138')](_0xb087('0x139'),_0x218e1c);}else{fs[_0xb087('0x13a')](_0x407837);}});});});}else{return _0x5df18d[_0xb087('0x2e')](0xc8);}})[_0xb087('0xc9')](handleError(_0x5df18d,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index d14cab6..1424377 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 _0xe47b=['setMaxListeners','save','remove','getUsers','setDataValue','Users','findAll','then','unreadMessages','length','emit','exports','events','ChatInteraction','../../mysqldb','ChatMessage'];(function(_0x1376e1,_0x2b7901){var _0x4c9efe=function(_0x2c7f61){while(--_0x2c7f61){_0x1376e1['push'](_0x1376e1['shift']());}};_0x4c9efe(++_0x2b7901);}(_0xe47b,0x12c));var _0xbe47=function(_0x4d4d64,_0x1984e8){_0x4d4d64=_0x4d4d64-0x0;var _0x25cbd8=_0xe47b[_0x4d4d64];return _0x25cbd8;};'use strict';var EventEmitter=require(_0xbe47('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0xbe47('0x1')];var ChatMessage=require(_0xbe47('0x2'))['db'][_0xbe47('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xbe47('0x4')](0x0);var events={'afterCreate':_0xbe47('0x5'),'afterUpdate':'update','afterDestroy':_0xbe47('0x6')};function emitEvent(_0xb58b0a){return function(_0x885c1,_0x280cb3,_0x9d8f61){_0x885c1[_0xbe47('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x37f405){_0x885c1[_0xbe47('0x8')](_0xbe47('0x9'),_0x37f405['map'](function(_0x58c841){return{'id':_0x58c841['id']};}));return ChatMessage[_0xbe47('0xa')]({'where':{'ChatInteractionId':_0x885c1['id'],'direction':'in','read':![]},'raw':!![]});})[_0xbe47('0xb')](function(_0x28f971){_0x885c1['setDataValue'](_0xbe47('0xc'),_0x28f971[_0xbe47('0xd')]);ChatInteractionEvents['emit'](_0xb58b0a+':'+_0x885c1['id'],_0x885c1);ChatInteractionEvents[_0xbe47('0xe')](_0xb58b0a,_0x885c1);_0x9d8f61(null);})['catch'](_0x9d8f61(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0xbe47('0xf')]=ChatInteractionEvents; \ No newline at end of file +var _0x9c30=['../../mysqldb','ChatInteraction','ChatMessage','save','update','remove','then','map','unreadMessages','length','emit','catch','hook','exports','events'];(function(_0x1ab740,_0x480e96){var _0x9016a5=function(_0x8b2a9c){while(--_0x8b2a9c){_0x1ab740['push'](_0x1ab740['shift']());}};_0x9016a5(++_0x480e96);}(_0x9c30,0x12b));var _0x09c3=function(_0x1d9731,_0x317bf2){_0x1d9731=_0x1d9731-0x0;var _0x3fbaf3=_0x9c30[_0x1d9731];return _0x3fbaf3;};'use strict';var EventEmitter=require(_0x09c3('0x0'));var ChatInteraction=require(_0x09c3('0x1'))['db'][_0x09c3('0x2')];var ChatMessage=require(_0x09c3('0x1'))['db'][_0x09c3('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x09c3('0x4'),'afterUpdate':_0x09c3('0x5'),'afterDestroy':_0x09c3('0x6')};function emitEvent(_0x394b69){return function(_0x38f201,_0x196309,_0x550a1c){_0x38f201['getUsers']({'attributes':['id'],'raw':!![]})[_0x09c3('0x7')](function(_0x19bb3e){_0x38f201['setDataValue']('Users',_0x19bb3e[_0x09c3('0x8')](function(_0x5a33f9){return{'id':_0x5a33f9['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x38f201['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x34ebca){_0x38f201['setDataValue'](_0x09c3('0x9'),_0x34ebca[_0x09c3('0xa')]);ChatInteractionEvents[_0x09c3('0xb')](_0x394b69+':'+_0x38f201['id'],_0x38f201);ChatInteractionEvents[_0x09c3('0xb')](_0x394b69,_0x38f201);_0x550a1c(null);})[_0x09c3('0xc')](_0x550a1c(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0x09c3('0xd')](e,emitEvent(event));}}module[_0x09c3('0xe')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 94853ea..adc1b51 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 _0xdc5d=['closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closed'];(function(_0x4a8bad,_0x4bfb2f){var _0x30cf32=function(_0x557b3a){while(--_0x557b3a){_0x4a8bad['push'](_0x4a8bad['shift']());}};_0x30cf32(++_0x4bfb2f);}(_0xdc5d,0x16e));var _0xddc5=function(_0x4f0e62,_0x28e44f){_0x4f0e62=_0x4f0e62-0x0;var _0x117ab8=_0xdc5d[_0x4f0e62];return _0x117ab8;};'use strict';var _=require('lodash');var util=require(_0xddc5('0x0'));var logger=require(_0xddc5('0x1'))(_0xddc5('0x2'));var moment=require(_0xddc5('0x3'));var BPromise=require('bluebird');var rp=require(_0xddc5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xddc5('0x5'));var config=require(_0xddc5('0x6'));var attributes=require(_0xddc5('0x7'));module[_0xddc5('0x8')]=function(_0x37ecf7,_0x37d174){return _0x37ecf7[_0xddc5('0x9')](_0xddc5('0xa'),attributes,{'tableName':_0xddc5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xc72038,_0x482938,_0x5a2644){if(_0xc72038[_0xddc5('0xc')](_0xddc5('0xd'))){_0xc72038[_0xddc5('0xe')]=moment()[_0xddc5('0xf')](_0xddc5('0x10'));}_0x5a2644(null,_0xc72038);}},'charset':_0xddc5('0x11'),'collate':_0xddc5('0x12')});}; \ No newline at end of file +var _0x2468=['ChatInteraction','chat_interactions','changed','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./chatInteraction.attributes','exports','define'];(function(_0x831541,_0x2c79fe){var _0x4ea2b4=function(_0x2f881b){while(--_0x2f881b){_0x831541['push'](_0x831541['shift']());}};_0x4ea2b4(++_0x2c79fe);}(_0x2468,0xb2));var _0x8246=function(_0x43b584,_0x20a6bd){_0x43b584=_0x43b584-0x0;var _0x48f27b=_0x2468[_0x43b584];return _0x48f27b;};'use strict';var _=require(_0x8246('0x0'));var util=require(_0x8246('0x1'));var logger=require(_0x8246('0x2'))(_0x8246('0x3'));var moment=require(_0x8246('0x4'));var BPromise=require(_0x8246('0x5'));var rp=require(_0x8246('0x6'));var fs=require('fs');var path=require(_0x8246('0x7'));var rimraf=require('rimraf');var config=require(_0x8246('0x8'));var attributes=require(_0x8246('0x9'));module[_0x8246('0xa')]=function(_0xb86a62,_0xe65630){return _0xb86a62[_0x8246('0xb')](_0x8246('0xc'),attributes,{'tableName':_0x8246('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x47f614,_0x174289,_0xd9b5b3){if(_0x47f614[_0x8246('0xe')]('closed')){_0x47f614['closedAt']=moment()[_0x8246('0xf')](_0x8246('0x10'));}_0xd9b5b3(null,_0x47f614);}},'charset':_0x8246('0x11'),'collate':_0x8246('0x12')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 67a379e..dfd62d5 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 _0x184b=['message','result','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','attributes','limit','catch','AddTagsToChatInteraction','find','ids','omit','spread','debug','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0xc70154,_0x18ca26){var _0x487c81=function(_0x467414){while(--_0x467414){_0xc70154['push'](_0xc70154['shift']());}};_0x487c81(++_0x18ca26);}(_0x184b,0x147));var _0xb184=function(_0x3c7310,_0x151024){_0x3c7310=_0x3c7310-0x0;var _0x577187=_0x184b[_0x3c7310];return _0x577187;};'use strict';var _=require(_0xb184('0x0'));var util=require(_0xb184('0x1'));var moment=require(_0xb184('0x2'));var BPromise=require(_0xb184('0x3'));var rs=require(_0xb184('0x4'));var fs=require('fs');var Redis=require(_0xb184('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb184('0x6'));var config=require('../../config/environment');var jayson=require(_0xb184('0x7'));var client=jayson[_0xb184('0x8')][_0xb184('0x9')]({'port':0x232a});config[_0xb184('0xa')]=_[_0xb184('0xb')](config[_0xb184('0xa')],{'host':_0xb184('0xc'),'port':0x18eb});var socket=require(_0xb184('0xd'))(new Redis(config[_0xb184('0xa')]));require(_0xb184('0xe'))[_0xb184('0xf')](socket);function respondWithRpcPromise(_0x28cc96,_0x33dc31,_0x298a74){return new BPromise(function(_0x24e9a1,_0x2b692e){return client[_0xb184('0x10')](_0x28cc96,_0x298a74)[_0xb184('0x11')](function(_0x43f806){logger[_0xb184('0x12')](_0xb184('0x13'),_0x33dc31,_0xb184('0x14'));logger['debug'](_0xb184('0x15'),_0x33dc31,'request\x20sent',JSON[_0xb184('0x16')](_0x43f806));if(_0x43f806[_0xb184('0x17')]){if(_0x43f806[_0xb184('0x17')][_0xb184('0x18')]===0x1f4){logger[_0xb184('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x33dc31,_0x43f806[_0xb184('0x17')][_0xb184('0x19')]);return _0x2b692e(_0x43f806[_0xb184('0x17')]['message']);}logger[_0xb184('0x17')](_0xb184('0x13'),_0x33dc31,_0x43f806['error'][_0xb184('0x19')]);return _0x24e9a1(_0x43f806['error']['message']);}else{logger[_0xb184('0x12')](_0xb184('0x13'),_0x33dc31,_0xb184('0x14'));_0x24e9a1(_0x43f806[_0xb184('0x1a')][_0xb184('0x19')]);}})['catch'](function(_0x59799b){logger[_0xb184('0x17')](_0xb184('0x13'),_0x33dc31,_0x59799b);_0x2b692e(_0x59799b);});});}exports[_0xb184('0x1b')]=function(_0x17a87b){var _0x37b2a8=this;return new Promise(function(_0x161c8a,_0x25a475){return db[_0xb184('0x1c')][_0xb184('0x1d')](_0x17a87b[_0xb184('0x1e')],{'raw':_0x17a87b[_0xb184('0x1f')]?_0x17a87b[_0xb184('0x1f')][_0xb184('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17a87b[_0xb184('0x1f')]?_0x17a87b['options'][_0xb184('0x21')]||null:null,'attributes':_0x17a87b[_0xb184('0x1f')]?_0x17a87b[_0xb184('0x1f')][_0xb184('0x22')]||null:null,'limit':_0x17a87b[_0xb184('0x1f')]?_0x17a87b[_0xb184('0x1f')][_0xb184('0x23')]||null:null})['then'](function(_0x18c8ab){logger[_0xb184('0x12')](_0xb184('0x1b'),_0x17a87b);logger['debug'](_0xb184('0x1b'),_0x17a87b,JSON[_0xb184('0x16')](_0x18c8ab));_0x161c8a(_0x18c8ab);})[_0xb184('0x24')](function(_0x2ac8ba){logger[_0xb184('0x17')](_0xb184('0x1b'),_0x2ac8ba[_0xb184('0x19')],_0x17a87b);_0x25a475(_0x37b2a8['error'](0x1f4,_0x2ac8ba[_0xb184('0x19')]));});});};exports[_0xb184('0x25')]=function(_0x12b7d7){return new Promise(function(_0x364891,_0x593b0b){return db[_0xb184('0x1c')][_0xb184('0x26')]({'where':_0x12b7d7[_0xb184('0x1f')]?_0x12b7d7['options'][_0xb184('0x21')]||null:null})['then'](function(_0x56cc7a){if(_0x56cc7a){return _0x56cc7a['addTags'](_0x12b7d7[_0xb184('0x1e')][_0xb184('0x27')],_[_0xb184('0x28')](_0x12b7d7[_0xb184('0x1e')],[_0xb184('0x27'),'id'])||{});}})[_0xb184('0x29')](function(_0x3cb08){logger[_0xb184('0x12')]('AddTags',_0x12b7d7);logger[_0xb184('0x2a')](_0xb184('0x2b'),_0x12b7d7,JSON['stringify'](_0x3cb08));_0x364891(_0x3cb08);})[_0xb184('0x24')](function(_0x95292d){logger[_0xb184('0x17')](_0xb184('0x2b'),_0x95292d[_0xb184('0x19')],_0x12b7d7);_0x593b0b(_this[_0xb184('0x17')](0x1f4,_0x95292d['message']));});});}; \ No newline at end of file +var _0x1c4e=['stringify','error','code','message','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','attributes','find','where','addTags','ids','omit','AddTags','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','register','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x4908cd,_0x36ca82){var _0x4b92ee=function(_0x926f5f){while(--_0x926f5f){_0x4908cd['push'](_0x4908cd['shift']());}};_0x4b92ee(++_0x36ca82);}(_0x1c4e,0x132));var _0xe1c4=function(_0x590455,_0x338a42){_0x590455=_0x590455-0x0;var _0x1b5a98=_0x1c4e[_0x590455];return _0x1b5a98;};'use strict';var _=require('lodash');var util=require(_0xe1c4('0x0'));var moment=require(_0xe1c4('0x1'));var BPromise=require(_0xe1c4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe1c4('0x3'));var db=require(_0xe1c4('0x4'))['db'];var utils=require(_0xe1c4('0x5'));var logger=require(_0xe1c4('0x6'))(_0xe1c4('0x7'));var config=require(_0xe1c4('0x8'));var jayson=require(_0xe1c4('0x9'));var client=jayson[_0xe1c4('0xa')][_0xe1c4('0xb')]({'port':0x232a});config[_0xe1c4('0xc')]=_[_0xe1c4('0xd')](config[_0xe1c4('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe1c4('0xc')]));require('./chatInteraction.socket')[_0xe1c4('0xe')](socket);function respondWithRpcPromise(_0x3b5dbf,_0x4934ef,_0x57cd2b){return new BPromise(function(_0x5ee724,_0x13ac33){return client[_0xe1c4('0xf')](_0x3b5dbf,_0x57cd2b)[_0xe1c4('0x10')](function(_0xc46d2){logger[_0xe1c4('0x11')](_0xe1c4('0x12'),_0x4934ef,_0xe1c4('0x13'));logger[_0xe1c4('0x14')](_0xe1c4('0x15'),_0x4934ef,_0xe1c4('0x13'),JSON[_0xe1c4('0x16')](_0xc46d2));if(_0xc46d2['error']){if(_0xc46d2[_0xe1c4('0x17')][_0xe1c4('0x18')]===0x1f4){logger['error'](_0xe1c4('0x12'),_0x4934ef,_0xc46d2[_0xe1c4('0x17')][_0xe1c4('0x19')]);return _0x13ac33(_0xc46d2['error'][_0xe1c4('0x19')]);}logger[_0xe1c4('0x17')](_0xe1c4('0x12'),_0x4934ef,_0xc46d2[_0xe1c4('0x17')][_0xe1c4('0x19')]);return _0x5ee724(_0xc46d2[_0xe1c4('0x17')][_0xe1c4('0x19')]);}else{logger[_0xe1c4('0x11')]('ChatInteraction,\x20%s,\x20%s',_0x4934ef,_0xe1c4('0x13'));_0x5ee724(_0xc46d2[_0xe1c4('0x1a')]['message']);}})[_0xe1c4('0x1b')](function(_0x48b5da){logger[_0xe1c4('0x17')](_0xe1c4('0x12'),_0x4934ef,_0x48b5da);_0x13ac33(_0x48b5da);});});}exports[_0xe1c4('0x1c')]=function(_0x45b9c9){var _0x137384=this;return new Promise(function(_0x598152,_0x34a3c9){return db[_0xe1c4('0x1d')][_0xe1c4('0x1e')](_0x45b9c9[_0xe1c4('0x1f')],{'raw':_0x45b9c9[_0xe1c4('0x20')]?_0x45b9c9[_0xe1c4('0x20')][_0xe1c4('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45b9c9[_0xe1c4('0x20')]?_0x45b9c9[_0xe1c4('0x20')]['where']||null:null,'attributes':_0x45b9c9[_0xe1c4('0x20')]?_0x45b9c9['options'][_0xe1c4('0x22')]||null:null,'limit':_0x45b9c9['options']?_0x45b9c9[_0xe1c4('0x20')]['limit']||null:null})['then'](function(_0x29b4d3){logger['info'](_0xe1c4('0x1c'),_0x45b9c9);logger[_0xe1c4('0x14')](_0xe1c4('0x1c'),_0x45b9c9,JSON[_0xe1c4('0x16')](_0x29b4d3));_0x598152(_0x29b4d3);})[_0xe1c4('0x1b')](function(_0x5af203){logger[_0xe1c4('0x17')](_0xe1c4('0x1c'),_0x5af203[_0xe1c4('0x19')],_0x45b9c9);_0x34a3c9(_0x137384[_0xe1c4('0x17')](0x1f4,_0x5af203[_0xe1c4('0x19')]));});});};exports['AddTagsToChatInteraction']=function(_0x1ef8a8){return new Promise(function(_0x3123d7,_0x595018){return db['ChatInteraction'][_0xe1c4('0x23')]({'where':_0x1ef8a8[_0xe1c4('0x20')]?_0x1ef8a8['options'][_0xe1c4('0x24')]||null:null})[_0xe1c4('0x10')](function(_0x43f6be){if(_0x43f6be){return _0x43f6be[_0xe1c4('0x25')](_0x1ef8a8[_0xe1c4('0x1f')][_0xe1c4('0x26')],_[_0xe1c4('0x27')](_0x1ef8a8['body'],[_0xe1c4('0x26'),'id'])||{});}})['spread'](function(_0x5d584d){logger['info']('AddTags',_0x1ef8a8);logger[_0xe1c4('0x14')](_0xe1c4('0x28'),_0x1ef8a8,JSON[_0xe1c4('0x16')](_0x5d584d));_0x3123d7(_0x5d584d);})[_0xe1c4('0x1b')](function(_0x101197){logger[_0xe1c4('0x17')](_0xe1c4('0x28'),_0x101197[_0xe1c4('0x19')],_0x1ef8a8);_0x595018(_this['error'](0x1f4,_0x101197['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index ec59dc2..f0b5aa6 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 _0x0a24=['./chatInteraction.events','save','update','emit','removeListener','register','length','chatInteraction:'];(function(_0x3733eb,_0x2d9450){var _0x4c80e3=function(_0x365bce){while(--_0x365bce){_0x3733eb['push'](_0x3733eb['shift']());}};_0x4c80e3(++_0x2d9450);}(_0x0a24,0xd0));var _0x40a2=function(_0x4b1eda,_0x1ca265){_0x4b1eda=_0x4b1eda-0x0;var _0x520e6b=_0x0a24[_0x4b1eda];return _0x520e6b;};'use strict';var ChatInteractionEvents=require(_0x40a2('0x0'));var events=[_0x40a2('0x1'),'remove',_0x40a2('0x2')];function createListener(_0x557f8b,_0x3665fb){return function(_0x1e56c7){_0x3665fb[_0x40a2('0x3')](_0x557f8b,_0x1e56c7);};}function removeListener(_0x513c2a,_0x465069){return function(){ChatInteractionEvents[_0x40a2('0x4')](_0x513c2a,_0x465069);};}exports[_0x40a2('0x5')]=function(_0x1abd02){for(var _0x535cca=0x0,_0x518597=events[_0x40a2('0x6')];_0x535cca<_0x518597;_0x535cca++){var _0x136c67=events[_0x535cca];var _0x5e62ef=createListener(_0x40a2('0x7')+_0x136c67,_0x1abd02);ChatInteractionEvents['on'](_0x136c67,_0x5e62ef);}}; \ No newline at end of file +var _0x0821=['update','emit','removeListener','register','chatInteraction:','./chatInteraction.events','remove'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x0821,0x186));var _0x1082=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x0821[_0x543084];return _0x306a57;};'use strict';var ChatInteractionEvents=require(_0x1082('0x0'));var events=['save',_0x1082('0x1'),_0x1082('0x2')];function createListener(_0x2ee75a,_0x163c0d){return function(_0x5bcf8e){_0x163c0d[_0x1082('0x3')](_0x2ee75a,_0x5bcf8e);};}function removeListener(_0x5ca6a7,_0x92e293){return function(){ChatInteractionEvents[_0x1082('0x4')](_0x5ca6a7,_0x92e293);};}exports[_0x1082('0x5')]=function(_0x56eada){for(var _0x580b5b=0x0,_0x16c816=events['length'];_0x580b5b<_0x16c816;_0x580b5b++){var _0x2ae0f7=events[_0x580b5b];var _0x348b88=createListener(_0x1082('0x6')+_0x2ae0f7,_0x56eada);ChatInteractionEvents['on'](_0x2ae0f7,_0x348b88);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index ef9e36d..f108fe8 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 _0x6f1e=['index','get','/describe','isAuthenticated','describe','/:id','show','isChatInteractionAuthorized','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','create','post','/:id/vidaoo','diskStorage','join','server/files/attachments/','format','%s-%s','now','replace','/:id/attachment_upload','single','file','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','put','chatinteraction:update','/:id/custom_update','customUpdate','/:id/close','chatinteraction:destroy','destroy','delete','removeTags','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatInteraction.controller'];(function(_0xf51c06,_0x388e5b){var _0x1d5420=function(_0x5e077b){while(--_0x5e077b){_0xf51c06['push'](_0xf51c06['shift']());}};_0x1d5420(++_0x388e5b);}(_0x6f1e,0x190));var _0xe6f1=function(_0x2549b9,_0x5a5e71){_0x2549b9=_0x2549b9-0x0;var _0x36bd12=_0x6f1e[_0x2549b9];return _0x36bd12;};'use strict';var multer=require('multer');var util=require(_0xe6f1('0x0'));var path=require(_0xe6f1('0x1'));var timeout=require('connect-timeout');var express=require(_0xe6f1('0x2'));var router=express[_0xe6f1('0x3')]();var fs_extra=require(_0xe6f1('0x4'));var auth=require(_0xe6f1('0x5'));var interaction=require(_0xe6f1('0x6'));var config=require('../../config/environment');var controller=require(_0xe6f1('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xe6f1('0x8')]);router[_0xe6f1('0x9')](_0xe6f1('0xa'),auth[_0xe6f1('0xb')](),controller[_0xe6f1('0xc')]);router['get'](_0xe6f1('0xd'),auth['isChatInteractionAuthorized'](),controller[_0xe6f1('0xe')]);router[_0xe6f1('0x9')]('/:id/attachment_download',auth[_0xe6f1('0xf')](),controller[_0xe6f1('0x10')]);router[_0xe6f1('0x9')](_0xe6f1('0x11'),auth[_0xe6f1('0xb')](),controller[_0xe6f1('0x12')]);router[_0xe6f1('0x9')](_0xe6f1('0x13'),auth[_0xe6f1('0xf')](),controller[_0xe6f1('0x14')]);router[_0xe6f1('0x9')](_0xe6f1('0x15'),auth[_0xe6f1('0xb')](),controller[_0xe6f1('0x16')]);router['post']('/',auth[_0xe6f1('0xb')](),controller[_0xe6f1('0x17')]);router[_0xe6f1('0x18')](_0xe6f1('0x19'),auth[_0xe6f1('0xb')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0xe6f1('0x1a')]({'destination':function(_0x110ee6,_0x44a2e5,_0x3c8d7f){_0x3c8d7f(null,path[_0xe6f1('0x1b')](config['root'],_0xe6f1('0x1c')));},'filename':function(_0x35d503,_0x4492d8,_0x209c2c){_0x209c2c(null,util[_0xe6f1('0x1d')](_0xe6f1('0x1e'),Date[_0xe6f1('0x1f')](),_0x4492d8['originalname'][_0xe6f1('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe6f1('0x18')](_0xe6f1('0x21'),upload[_0xe6f1('0x22')](_0xe6f1('0x23')),controller['attachmentUpload']);router['post'](_0xe6f1('0x11'),auth['isChatInteractionAuthorized'](),controller[_0xe6f1('0x24')]);router['post'](_0xe6f1('0x25'),auth[_0xe6f1('0xb')](),interaction[_0xe6f1('0x26')](_0xe6f1('0x27'),_0xe6f1('0x28')),controller['addTags']);router[_0xe6f1('0x29')]('/:id',auth[_0xe6f1('0xb')](),interaction[_0xe6f1('0x26')](_0xe6f1('0x27'),_0xe6f1('0x2a')),controller['update']);router['put'](_0xe6f1('0x2b'),controller[_0xe6f1('0x2c')]);router['put']('/:id/abandon',auth['isChatInteractionAuthorized'](),controller['abandon']);router[_0xe6f1('0x29')](_0xe6f1('0x2d'),controller['close']);router['delete']('/:id',auth[_0xe6f1('0xb')](),interaction[_0xe6f1('0x26')](_0xe6f1('0x27'),_0xe6f1('0x2e')),controller[_0xe6f1('0x2f')]);router[_0xe6f1('0x30')](_0xe6f1('0x25'),auth[_0xe6f1('0xb')](),controller[_0xe6f1('0x31')]);module[_0xe6f1('0x32')]=router; \ No newline at end of file +var _0x603c=['destroy','exports','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','index','get','isAuthenticated','describe','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','/:id/download','download','post','create','createVidaooSession','join','root','server/files/attachments/','format','now','originalname','replace','/:id/attachment_upload','addMessage','/:id/tags','tracked','chatinteraction:addtags','addTags','/:id','chat','chatinteraction:update','/:id/custom_update','put','/:id/abandon','/:id/close','close','delete','chatinteraction:destroy'];(function(_0x33154d,_0x854047){var _0x3b2f03=function(_0x35f7a6){while(--_0x35f7a6){_0x33154d['push'](_0x33154d['shift']());}};_0x3b2f03(++_0x854047);}(_0x603c,0x18a));var _0xc603=function(_0x5aaadb,_0xeeab51){_0x5aaadb=_0x5aaadb-0x0;var _0x379c74=_0x603c[_0x5aaadb];return _0x379c74;};'use strict';var multer=require(_0xc603('0x0'));var util=require(_0xc603('0x1'));var path=require(_0xc603('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xc603('0x3'));var auth=require(_0xc603('0x4'));var interaction=require(_0xc603('0x5'));var config=require(_0xc603('0x6'));var controller=require(_0xc603('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xc603('0x8')]);router[_0xc603('0x9')]('/describe',auth[_0xc603('0xa')](),controller[_0xc603('0xb')]);router[_0xc603('0x9')]('/:id',auth[_0xc603('0xc')](),controller[_0xc603('0xd')]);router[_0xc603('0x9')](_0xc603('0xe'),auth['isChatInteractionAuthorized'](),controller[_0xc603('0xf')]);router[_0xc603('0x9')](_0xc603('0x10'),auth['isAuthenticated'](),controller[_0xc603('0x11')]);router[_0xc603('0x9')](_0xc603('0x12'),auth[_0xc603('0xc')](),controller['getMyMessages']);router['get'](_0xc603('0x13'),auth[_0xc603('0xa')](),controller[_0xc603('0x14')]);router[_0xc603('0x15')]('/',auth['isAuthenticated'](),controller[_0xc603('0x16')]);router['post']('/:id/vidaoo',auth[_0xc603('0xa')](),controller[_0xc603('0x17')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x31e540,_0x49ab7b,_0x2b659e){_0x2b659e(null,path[_0xc603('0x18')](config[_0xc603('0x19')],_0xc603('0x1a')));},'filename':function(_0x504df3,_0x301b85,_0x3f08fb){_0x3f08fb(null,util[_0xc603('0x1b')]('%s-%s',Date[_0xc603('0x1c')](),_0x301b85[_0xc603('0x1d')][_0xc603('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xc603('0x15')](_0xc603('0x1f'),upload['single']('file'),controller['attachmentUpload']);router[_0xc603('0x15')](_0xc603('0x10'),auth[_0xc603('0xc')](),controller[_0xc603('0x20')]);router['post'](_0xc603('0x21'),auth[_0xc603('0xa')](),interaction[_0xc603('0x22')]('chat',_0xc603('0x23')),controller[_0xc603('0x24')]);router['put'](_0xc603('0x25'),auth[_0xc603('0xa')](),interaction[_0xc603('0x22')](_0xc603('0x26'),_0xc603('0x27')),controller['update']);router['put'](_0xc603('0x28'),controller['customUpdate']);router[_0xc603('0x29')](_0xc603('0x2a'),auth['isChatInteractionAuthorized'](),controller['abandon']);router[_0xc603('0x29')](_0xc603('0x2b'),controller[_0xc603('0x2c')]);router[_0xc603('0x2d')](_0xc603('0x25'),auth['isAuthenticated'](),interaction['tracked'](_0xc603('0x26'),_0xc603('0x2e')),controller[_0xc603('0x2f')]);router[_0xc603('0x2d')](_0xc603('0x21'),auth[_0xc603('0xa')](),controller['removeTags']);module[_0xc603('0x30')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index bfa0890..24798fb 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 _0x88e4=['medium','INTEGER','sequelize','TEXT'];(function(_0x233bd7,_0x1abbe6){var _0xd1cda1=function(_0x54885e){while(--_0x54885e){_0x233bd7['push'](_0x233bd7['shift']());}};_0xd1cda1(++_0x1abbe6);}(_0x88e4,0x6e));var _0x488e=function(_0x3d4ef1,_0x5a957c){_0x3d4ef1=_0x3d4ef1-0x0;var _0x409423=_0x88e4[_0x3d4ef1];return _0x409423;};'use strict';var Sequelize=require(_0x488e('0x0'));module['exports']={'body':{'type':Sequelize[_0x488e('0x1')](_0x488e('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x488e('0x3')]}}; \ No newline at end of file +var _0xc36d=['medium','sequelize','exports','TEXT'];(function(_0x34ad5a,_0x3842dc){var _0x215768=function(_0x3d1946){while(--_0x3d1946){_0x34ad5a['push'](_0x34ad5a['shift']());}};_0x215768(++_0x3842dc);}(_0xc36d,0x17d));var _0xdc36=function(_0x26ed29,_0x2288f1){_0x26ed29=_0x26ed29-0x0;var _0x26182c=_0xc36d[_0x26ed29];return _0x26182c;};'use strict';var Sequelize=require(_0xdc36('0x0'));module[_0xdc36('0x1')]={'body':{'type':Sequelize[_0xdc36('0x2')](_0xdc36('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index b9bca13..ac09ede 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 _0x2744=['pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','intersection','find','body','destroy','describe','get','messages','lastMessageAt','getUsers','User','admin','fullname','role','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','isEmpty','agent','push','createdAt','FromId','ToId','-createdAt','all','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','sendStatus','error','stack','name','send','ChatInternalMessage','rawAttributes','fieldName','type','map','keys','filters','model','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where'];(function(_0x69560,_0x237e9f){var _0x481461=function(_0x6125f4){while(--_0x6125f4){_0x69560['push'](_0x69560['shift']());}};_0x481461(++_0x237e9f);}(_0x2744,0x170));var _0x4274=function(_0x37125c,_0x3f2dc2){_0x37125c=_0x37125c-0x0;var _0x249a4c=_0x2744[_0x37125c];return _0x249a4c;};'use strict';var emlformat=require(_0x4274('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4274('0x1'));var jsonpatch=require(_0x4274('0x2'));var rp=require(_0x4274('0x3'));var moment=require(_0x4274('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4274('0x5'));var util=require(_0x4274('0x6'));var path=require(_0x4274('0x7'));var sox=require(_0x4274('0x8'));var csv=require('to-csv');var ejs=require(_0x4274('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4274('0xa'));var squel=require(_0x4274('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4274('0xc'));var toCsv=require(_0x4274('0xd'));var querystring=require(_0x4274('0xe'));var Papa=require(_0x4274('0xf'));var Redis=require(_0x4274('0x10'));var authService=require(_0x4274('0x11'));var qs=require(_0x4274('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4274('0x13'));var logger=require('../../config/logger')(_0x4274('0x14'));var utils=require(_0x4274('0x15'));var config=require(_0x4274('0x16'));var licenseUtil=require(_0x4274('0x17'));var db=require(_0x4274('0x18'))['db'];config[_0x4274('0x19')]=_[_0x4274('0x1a')](config[_0x4274('0x19')],{'host':_0x4274('0x1b'),'port':0x18eb});var socket=require(_0x4274('0x1c'))(new Redis(config['redis']));require(_0x4274('0x1d'))[_0x4274('0x1e')](socket);function respondWithStatusCode(_0x2a7fb9,_0x499c2a){_0x499c2a=_0x499c2a||0xcc;return function(_0x56efb7){if(_0x56efb7){return _0x2a7fb9['sendStatus'](_0x499c2a);}return _0x2a7fb9[_0x4274('0x1f')](_0x499c2a)[_0x4274('0x20')]();};}function respondWithResult(_0x60e3e9,_0x11fb0b){_0x11fb0b=_0x11fb0b||0xc8;return function(_0x5b4ae0){if(_0x5b4ae0){return _0x60e3e9[_0x4274('0x1f')](_0x11fb0b)[_0x4274('0x21')](_0x5b4ae0);}};}function respondWithFilteredResult(_0x5a383b,_0x3906fd){return function(_0x57f4f9){if(_0x57f4f9){var _0x488f21=typeof _0x3906fd[_0x4274('0x22')]===_0x4274('0x23')&&typeof _0x3906fd['limit']==='undefined';var _0xb6d5db=_0x57f4f9[_0x4274('0x24')];var _0x209a5f=_0x488f21?0x0:_0x3906fd['offset'];var _0x7b597c=_0x488f21?_0x57f4f9[_0x4274('0x24')]:_0x3906fd[_0x4274('0x22')]+_0x3906fd[_0x4274('0x25')];var _0x1f5b2;if(_0x7b597c>=_0xb6d5db){_0x7b597c=_0xb6d5db;_0x1f5b2=0xc8;}else{_0x1f5b2=0xce;}_0x5a383b[_0x4274('0x1f')](_0x1f5b2);return _0x5a383b[_0x4274('0x26')](_0x4274('0x27'),_0x209a5f+'-'+_0x7b597c+'/'+_0xb6d5db)['json'](_0x57f4f9);}return null;};}function patchUpdates(_0x3e98ab){return function(_0x36082a){try{jsonpatch[_0x4274('0x28')](_0x36082a,_0x3e98ab,!![]);}catch(_0x1abe20){return BPromise['reject'](_0x1abe20);}return _0x36082a['save']();};}function saveUpdates(_0x1fb972,_0x5b4665){return function(_0x46d29a){if(_0x46d29a){return _0x46d29a[_0x4274('0x29')](_0x1fb972)['then'](function(_0x3a05d5){return _0x3a05d5;});}return null;};}function removeEntity(_0x464d6d,_0x23e7d2){return function(_0x1d2037){if(_0x1d2037){return _0x1d2037['destroy']()[_0x4274('0x2a')](function(){_0x464d6d[_0x4274('0x1f')](0xcc)[_0x4274('0x20')]();});}};}function handleEntityNotFound(_0x2496d4,_0x891db0){return function(_0x365a67){if(!_0x365a67){_0x2496d4[_0x4274('0x2b')](0x194);}return _0x365a67;};}function handleError(_0x537c8d,_0x2913ee){_0x2913ee=_0x2913ee||0x1f4;return function(_0xda3fb7){logger[_0x4274('0x2c')](_0xda3fb7[_0x4274('0x2d')]);if(_0xda3fb7[_0x4274('0x2e')]){delete _0xda3fb7['name'];}_0x537c8d['status'](_0x2913ee)[_0x4274('0x2f')](_0xda3fb7);};}exports['index']=function(_0x42bf20,_0x4bb1a4){var _0x3c3368={},_0xdf75de={},_0x590091={'count':0x0,'rows':[]};var _0x73f394=_['map'](db[_0x4274('0x30')][_0x4274('0x31')],function(_0x3a598a){return{'name':_0x3a598a[_0x4274('0x32')],'type':_0x3a598a[_0x4274('0x33')]['key']};});_0xdf75de['model']=_[_0x4274('0x34')](_0x73f394,'name');_0xdf75de['query']=_[_0x4274('0x35')](_0x42bf20['query']);_0xdf75de[_0x4274('0x36')]=_['intersection'](_0xdf75de[_0x4274('0x37')],_0xdf75de[_0x4274('0x38')]);_0x3c3368[_0x4274('0x39')]=_['intersection'](_0xdf75de[_0x4274('0x37')],qs[_0x4274('0x3a')](_0x42bf20[_0x4274('0x38')][_0x4274('0x3a')]));_0x3c3368[_0x4274('0x39')]=_0x3c3368['attributes'][_0x4274('0x3b')]?_0x3c3368[_0x4274('0x39')]:_0xdf75de[_0x4274('0x37')];if(!_0x42bf20['query'][_0x4274('0x3c')](_0x4274('0x3d'))){_0x3c3368[_0x4274('0x25')]=qs[_0x4274('0x25')](_0x42bf20['query']['limit']);_0x3c3368[_0x4274('0x22')]=qs['offset'](_0x42bf20[_0x4274('0x38')]['offset']);}_0x3c3368['order']=qs[_0x4274('0x3e')](_0x42bf20[_0x4274('0x38')]['sort']);_0x3c3368[_0x4274('0x3f')]=qs[_0x4274('0x36')](_[_0x4274('0x40')](_0x42bf20['query'],_0xdf75de[_0x4274('0x36')]),_0x73f394);if(_0x42bf20[_0x4274('0x38')]['filter']){_0x3c3368[_0x4274('0x3f')]=_[_0x4274('0x41')](_0x3c3368[_0x4274('0x3f')],{'$or':_[_0x4274('0x34')](_0x73f394,function(_0xeaeba2){if(_0xeaeba2['type']!==_0x4274('0x42')){var _0x32dc8a={};_0x32dc8a[_0xeaeba2[_0x4274('0x2e')]]={'$like':'%'+_0x42bf20[_0x4274('0x38')][_0x4274('0x43')]+'%'};return _0x32dc8a;}})});}_0x3c3368=_[_0x4274('0x41')]({},_0x3c3368,_0x42bf20[_0x4274('0x44')]);var _0x3fa4df={'where':_0x3c3368[_0x4274('0x3f')]};return db['ChatInternalMessage'][_0x4274('0x24')](_0x3fa4df)[_0x4274('0x2a')](function(_0x810b1f){_0x590091[_0x4274('0x24')]=_0x810b1f;if(_0x42bf20['query'][_0x4274('0x45')]){_0x3c3368[_0x4274('0x46')]=[{'all':!![]}];}return db[_0x4274('0x30')][_0x4274('0x47')](_0x3c3368);})[_0x4274('0x2a')](function(_0x8a3301){_0x590091[_0x4274('0x48')]=_0x8a3301;return _0x590091;})[_0x4274('0x2a')](respondWithFilteredResult(_0x4bb1a4,_0x3c3368))[_0x4274('0x49')](handleError(_0x4bb1a4,null));};exports['show']=function(_0x390ebf,_0x5543b1){var _0x2167a1={'raw':!![],'where':{'id':_0x390ebf[_0x4274('0x4a')]['id']}},_0x3c6a99={};_0x3c6a99['model']=_[_0x4274('0x35')](db[_0x4274('0x30')][_0x4274('0x31')]);_0x3c6a99[_0x4274('0x38')]=_[_0x4274('0x35')](_0x390ebf['query']);_0x3c6a99[_0x4274('0x36')]=_['intersection'](_0x3c6a99['model'],_0x3c6a99[_0x4274('0x38')]);_0x2167a1[_0x4274('0x39')]=_[_0x4274('0x4b')](_0x3c6a99[_0x4274('0x37')],qs['fields'](_0x390ebf[_0x4274('0x38')][_0x4274('0x3a')]));_0x2167a1[_0x4274('0x39')]=_0x2167a1[_0x4274('0x39')][_0x4274('0x3b')]?_0x2167a1[_0x4274('0x39')]:_0x3c6a99[_0x4274('0x37')];if(_0x390ebf[_0x4274('0x38')][_0x4274('0x45')]){_0x2167a1[_0x4274('0x46')]=[{'all':!![]}];}_0x2167a1=_[_0x4274('0x41')]({},_0x2167a1,_0x390ebf[_0x4274('0x44')]);return db[_0x4274('0x30')][_0x4274('0x4c')](_0x2167a1)['then'](handleEntityNotFound(_0x5543b1,null))[_0x4274('0x2a')](respondWithResult(_0x5543b1,null))['catch'](handleError(_0x5543b1,null));};exports['create']=function(_0x203382,_0x1b40b3){return db[_0x4274('0x30')]['create'](_0x203382[_0x4274('0x4d')],{})[_0x4274('0x2a')](respondWithResult(_0x1b40b3,0xc9))[_0x4274('0x49')](handleError(_0x1b40b3,null));};exports['update']=function(_0x36861e,_0x5f5bea){if(_0x36861e['body']['id']){delete _0x36861e['body']['id'];}return db[_0x4274('0x30')][_0x4274('0x4c')]({'where':{'id':_0x36861e[_0x4274('0x4a')]['id']}})[_0x4274('0x2a')](handleEntityNotFound(_0x5f5bea,null))[_0x4274('0x2a')](saveUpdates(_0x36861e['body'],null))['then'](respondWithResult(_0x5f5bea,null))['catch'](handleError(_0x5f5bea,null));};exports[_0x4274('0x4e')]=function(_0x10bb23,_0x150a76){return db[_0x4274('0x30')][_0x4274('0x4c')]({'where':{'id':_0x10bb23[_0x4274('0x4a')]['id']}})[_0x4274('0x2a')](handleEntityNotFound(_0x150a76,null))['then'](removeEntity(_0x150a76,null))[_0x4274('0x49')](handleError(_0x150a76,null));};exports[_0x4274('0x4f')]=function(_0x1c0f20,_0x37ea82){return db[_0x4274('0x30')][_0x4274('0x4f')]()['then'](respondWithResult(_0x37ea82,null))[_0x4274('0x49')](handleError(_0x37ea82,null));};function wrapUser(_0x50a982){return function(_0x333613){var _0x35e9bf=_0x50a982[_0x4274('0x50')]({'plain':!![]});_0x35e9bf[_0x4274('0x51')]=[];if(_0x333613){_0x35e9bf['lastMessageAt']=_0x333613['createdAt'];_0x35e9bf['lastMessage']=_0x333613;}else{_0x35e9bf[_0x4274('0x52')]=moment(0x0)['format']('YYYY-MM-DD\x20HH:mm:ss');_0x35e9bf['lastMessage']={};}return _0x35e9bf;};}exports[_0x4274('0x53')]=function(_0x3d739e,_0x5c5fc9,_0x3753d9){var _0x5311e7=[];return db[_0x4274('0x54')]['findAll']({'where':{'role':['agent',_0x4274('0x55'),'user']},'attributes':['id',_0x4274('0x56'),_0x4274('0x2e'),_0x4274('0x57'),'userpic',_0x4274('0x58'),_0x4274('0x59'),_0x4274('0x5a'),_0x4274('0x5b'),_0x4274('0x5c')],'order':qs[_0x4274('0x3e')](_0x4274('0x5d')),'include':[{'model':db[_0x4274('0x5e')],'as':'VoiceQueues','attributes':['id','name',_0x4274('0x33')],'through':{'attributes':[]}}]})['then'](function(_0xd7032f){if(_0xd7032f){var _0x11dd60=_0x3d739e[_0x4274('0x5f')][_0x4274('0x50')]({'plain':!![]});if(!_0x11dd60)throw new Error(_0x4274('0x60'));if(_0x11dd60[_0x4274('0x57')]===_0x4274('0x5f')){return db[_0x4274('0x61')][_0x4274('0x4c')]({'where':{'name':'Agents','userProfileId':_0x11dd60[_0x4274('0x62')]},'raw':!![]})['then'](function(_0x547206){if(_0x547206){if(_0x547206[_0x4274('0x63')]===0x0){return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x547206['id']},'raw':!![]})[_0x4274('0x2a')](function(_0x34a137){var _0x255c47=[];if(_[_0x4274('0x64')](_0x34a137)){_0x255c47=_[_0x4274('0x43')](_0xd7032f,function(_0x3e267e){if(_0x3e267e[_0x4274('0x57')]!==_0x4274('0x65')){return _0x3e267e;}});return _0x255c47;}else{for(var _0x362377=0x0;_0x362377<_0xd7032f[_0x4274('0x3b')];_0x362377++){var _0x11b456=_0xd7032f[_0x362377];if(_0x11b456[_0x4274('0x57')]==='agent'){var _0x14209e=_[_0x4274('0x4c')](_0x34a137,function(_0x1952f8){return _0x1952f8['resourceId']===_0x11b456['id'];});if(_0x14209e)_0x255c47[_0x4274('0x66')](_0x11b456);}else{_0x255c47[_0x4274('0x66')](_0x11b456);}}return _0x255c47;}});}else{return _0xd7032f;}}else{var _0x72c4c8=_['filter'](_0xd7032f,function(_0x96e7b5){if(_0x96e7b5['role']!=='agent'){return _0x96e7b5;}});return _0x72c4c8;}});}else{return _0xd7032f;}}})[_0x4274('0x2a')](function(_0x1cdeca){var _0x3a76c8=[];if(_0x1cdeca){_0x5311e7=_0x1cdeca;for(var _0x17bcb9=0x0;_0x17bcb9<_0x1cdeca[_0x4274('0x3b')];_0x17bcb9+=0x1){_0x5311e7[_0x17bcb9][_0x4274('0x51')]=[];_0x3a76c8[_0x4274('0x66')](db[_0x4274('0x30')][_0x4274('0x4c')]({'where':{'FromId':[_0x3d739e['user']['id'],_0x1cdeca[_0x17bcb9]['id']],'ToId':[_0x3d739e[_0x4274('0x5f')]['id'],_0x1cdeca[_0x17bcb9]['id']],'ChatGroupId':null},'attributes':['id',_0x4274('0x67'),_0x4274('0x68'),_0x4274('0x69'),'read',_0x4274('0x4d')],'order':qs['sort'](_0x4274('0x6a')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x4274('0x2a')](wrapUser(_0x1cdeca[_0x17bcb9])));}return BPromise[_0x4274('0x6b')](_0x3a76c8);}return[];})['then'](function(_0x58001b){return{'rows':_0x58001b,'count':_0x58001b[_0x4274('0x3b')]};})[_0x4274('0x2a')](respondWithResult(_0x5c5fc9,null))[_0x4274('0x49')](handleError(_0x5c5fc9,null));}; \ No newline at end of file +var _0x7802=['UserProfileSection','userProfileId','autoAssociation','UserProfileResource','isEmpty','push','FromId','read','-createdAt','all','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','fs-extra','crypto','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','destroy','then','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','count','include','findAll','rows','catch','show','params','includeAll','find','create','body','update','get','messages','createdAt','lastMessage','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','agent','admin','fullname','role','userpic','online','allowmessenger','VoiceQueue','VoiceQueues','user'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0x7802,0x13c));var _0x2780=function(_0x51f5c8,_0x2aa90d){_0x51f5c8=_0x51f5c8-0x0;var _0x30789e=_0x7802[_0x51f5c8];return _0x30789e;};'use strict';var emlformat=require(_0x2780('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2780('0x1'));var jsonpatch=require(_0x2780('0x2'));var rp=require('request-promise');var moment=require(_0x2780('0x3'));var BPromise=require(_0x2780('0x4'));var Mustache=require(_0x2780('0x5'));var util=require('util');var path=require('path');var sox=require(_0x2780('0x6'));var csv=require(_0x2780('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2780('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2780('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2780('0xa'));var Papa=require(_0x2780('0xb'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2780('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2780('0xd'));var logger=require(_0x2780('0xe'))(_0x2780('0xf'));var utils=require(_0x2780('0x10'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2780('0x11'))['db'];config['redis']=_[_0x2780('0x12')](config[_0x2780('0x13')],{'host':_0x2780('0x14'),'port':0x18eb});var socket=require(_0x2780('0x15'))(new Redis(config[_0x2780('0x13')]));require(_0x2780('0x16'))[_0x2780('0x17')](socket);function respondWithStatusCode(_0x30aa5f,_0x17875f){_0x17875f=_0x17875f||0xcc;return function(_0x47d632){if(_0x47d632){return _0x30aa5f[_0x2780('0x18')](_0x17875f);}return _0x30aa5f[_0x2780('0x19')](_0x17875f)[_0x2780('0x1a')]();};}function respondWithResult(_0x1a37ab,_0x5b96ab){_0x5b96ab=_0x5b96ab||0xc8;return function(_0x41aff2){if(_0x41aff2){return _0x1a37ab[_0x2780('0x19')](_0x5b96ab)[_0x2780('0x1b')](_0x41aff2);}};}function respondWithFilteredResult(_0x94ff6b,_0x3148ba){return function(_0xd3300){if(_0xd3300){var _0x1a738c=typeof _0x3148ba[_0x2780('0x1c')]===_0x2780('0x1d')&&typeof _0x3148ba[_0x2780('0x1e')]===_0x2780('0x1d');var _0x4f8380=_0xd3300['count'];var _0x1acafa=_0x1a738c?0x0:_0x3148ba['offset'];var _0x3b1c61=_0x1a738c?_0xd3300['count']:_0x3148ba['offset']+_0x3148ba[_0x2780('0x1e')];var _0x52c85c;if(_0x3b1c61>=_0x4f8380){_0x3b1c61=_0x4f8380;_0x52c85c=0xc8;}else{_0x52c85c=0xce;}_0x94ff6b[_0x2780('0x19')](_0x52c85c);return _0x94ff6b[_0x2780('0x1f')](_0x2780('0x20'),_0x1acafa+'-'+_0x3b1c61+'/'+_0x4f8380)[_0x2780('0x1b')](_0xd3300);}return null;};}function patchUpdates(_0x574cf2){return function(_0x5cb388){try{jsonpatch[_0x2780('0x21')](_0x5cb388,_0x574cf2,!![]);}catch(_0x5a340f){return BPromise['reject'](_0x5a340f);}return _0x5cb388['save']();};}function saveUpdates(_0x4f6a2d,_0x11b498){return function(_0x5e32b5){if(_0x5e32b5){return _0x5e32b5['update'](_0x4f6a2d)['then'](function(_0x15fb1a){return _0x15fb1a;});}return null;};}function removeEntity(_0x13cb78,_0x48d999){return function(_0x4e0410){if(_0x4e0410){return _0x4e0410[_0x2780('0x22')]()[_0x2780('0x23')](function(){_0x13cb78['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4536c1,_0x4a80b6){return function(_0x1e54ec){if(!_0x1e54ec){_0x4536c1['sendStatus'](0x194);}return _0x1e54ec;};}function handleError(_0x2254fa,_0x231050){_0x231050=_0x231050||0x1f4;return function(_0x3a6104){logger[_0x2780('0x24')](_0x3a6104[_0x2780('0x25')]);if(_0x3a6104[_0x2780('0x26')]){delete _0x3a6104[_0x2780('0x26')];}_0x2254fa[_0x2780('0x19')](_0x231050)[_0x2780('0x27')](_0x3a6104);};}exports[_0x2780('0x28')]=function(_0x416236,_0x277104){var _0x3628eb={},_0x52cb91={},_0xf00619={'count':0x0,'rows':[]};var _0x318a57=_[_0x2780('0x29')](db[_0x2780('0x2a')][_0x2780('0x2b')],function(_0x31e5ba){return{'name':_0x31e5ba['fieldName'],'type':_0x31e5ba[_0x2780('0x2c')]['key']};});_0x52cb91[_0x2780('0x2d')]=_[_0x2780('0x29')](_0x318a57,_0x2780('0x26'));_0x52cb91[_0x2780('0x2e')]=_[_0x2780('0x2f')](_0x416236[_0x2780('0x2e')]);_0x52cb91[_0x2780('0x30')]=_[_0x2780('0x31')](_0x52cb91[_0x2780('0x2d')],_0x52cb91['query']);_0x3628eb['attributes']=_[_0x2780('0x31')](_0x52cb91[_0x2780('0x2d')],qs['fields'](_0x416236[_0x2780('0x2e')][_0x2780('0x32')]));_0x3628eb[_0x2780('0x33')]=_0x3628eb[_0x2780('0x33')][_0x2780('0x34')]?_0x3628eb[_0x2780('0x33')]:_0x52cb91['model'];if(!_0x416236[_0x2780('0x2e')][_0x2780('0x35')](_0x2780('0x36'))){_0x3628eb[_0x2780('0x1e')]=qs[_0x2780('0x1e')](_0x416236['query']['limit']);_0x3628eb[_0x2780('0x1c')]=qs['offset'](_0x416236[_0x2780('0x2e')]['offset']);}_0x3628eb[_0x2780('0x37')]=qs['sort'](_0x416236[_0x2780('0x2e')][_0x2780('0x38')]);_0x3628eb['where']=qs[_0x2780('0x30')](_[_0x2780('0x39')](_0x416236[_0x2780('0x2e')],_0x52cb91[_0x2780('0x30')]),_0x318a57);if(_0x416236[_0x2780('0x2e')][_0x2780('0x3a')]){_0x3628eb['where']=_[_0x2780('0x3b')](_0x3628eb[_0x2780('0x3c')],{'$or':_[_0x2780('0x29')](_0x318a57,function(_0x45ed60){if(_0x45ed60[_0x2780('0x2c')]!==_0x2780('0x3d')){var _0x1d9274={};_0x1d9274[_0x45ed60['name']]={'$like':'%'+_0x416236[_0x2780('0x2e')][_0x2780('0x3a')]+'%'};return _0x1d9274;}})});}_0x3628eb=_[_0x2780('0x3b')]({},_0x3628eb,_0x416236['options']);var _0x4bd386={'where':_0x3628eb['where']};return db[_0x2780('0x2a')]['count'](_0x4bd386)['then'](function(_0x30a637){_0xf00619[_0x2780('0x3e')]=_0x30a637;if(_0x416236[_0x2780('0x2e')]['includeAll']){_0x3628eb[_0x2780('0x3f')]=[{'all':!![]}];}return db[_0x2780('0x2a')][_0x2780('0x40')](_0x3628eb);})[_0x2780('0x23')](function(_0x14f4b1){_0xf00619[_0x2780('0x41')]=_0x14f4b1;return _0xf00619;})[_0x2780('0x23')](respondWithFilteredResult(_0x277104,_0x3628eb))[_0x2780('0x42')](handleError(_0x277104,null));};exports[_0x2780('0x43')]=function(_0x24742c,_0x3a8112){var _0x4fe980={'raw':!![],'where':{'id':_0x24742c[_0x2780('0x44')]['id']}},_0x2f91b3={};_0x2f91b3[_0x2780('0x2d')]=_[_0x2780('0x2f')](db[_0x2780('0x2a')]['rawAttributes']);_0x2f91b3['query']=_[_0x2780('0x2f')](_0x24742c['query']);_0x2f91b3[_0x2780('0x30')]=_[_0x2780('0x31')](_0x2f91b3[_0x2780('0x2d')],_0x2f91b3[_0x2780('0x2e')]);_0x4fe980[_0x2780('0x33')]=_['intersection'](_0x2f91b3[_0x2780('0x2d')],qs[_0x2780('0x32')](_0x24742c[_0x2780('0x2e')][_0x2780('0x32')]));_0x4fe980[_0x2780('0x33')]=_0x4fe980['attributes'][_0x2780('0x34')]?_0x4fe980[_0x2780('0x33')]:_0x2f91b3[_0x2780('0x2d')];if(_0x24742c[_0x2780('0x2e')][_0x2780('0x45')]){_0x4fe980[_0x2780('0x3f')]=[{'all':!![]}];}_0x4fe980=_[_0x2780('0x3b')]({},_0x4fe980,_0x24742c['options']);return db[_0x2780('0x2a')][_0x2780('0x46')](_0x4fe980)[_0x2780('0x23')](handleEntityNotFound(_0x3a8112,null))[_0x2780('0x23')](respondWithResult(_0x3a8112,null))['catch'](handleError(_0x3a8112,null));};exports[_0x2780('0x47')]=function(_0x57e035,_0x283b0c){return db[_0x2780('0x2a')][_0x2780('0x47')](_0x57e035[_0x2780('0x48')],{})[_0x2780('0x23')](respondWithResult(_0x283b0c,0xc9))[_0x2780('0x42')](handleError(_0x283b0c,null));};exports[_0x2780('0x49')]=function(_0x407b15,_0x9437b){if(_0x407b15[_0x2780('0x48')]['id']){delete _0x407b15[_0x2780('0x48')]['id'];}return db['ChatInternalMessage'][_0x2780('0x46')]({'where':{'id':_0x407b15[_0x2780('0x44')]['id']}})[_0x2780('0x23')](handleEntityNotFound(_0x9437b,null))['then'](saveUpdates(_0x407b15['body'],null))[_0x2780('0x23')](respondWithResult(_0x9437b,null))[_0x2780('0x42')](handleError(_0x9437b,null));};exports[_0x2780('0x22')]=function(_0x4c3f60,_0x53d1f1){return db[_0x2780('0x2a')][_0x2780('0x46')]({'where':{'id':_0x4c3f60[_0x2780('0x44')]['id']}})[_0x2780('0x23')](handleEntityNotFound(_0x53d1f1,null))[_0x2780('0x23')](removeEntity(_0x53d1f1,null))[_0x2780('0x42')](handleError(_0x53d1f1,null));};exports['describe']=function(_0x2775e0,_0x481b04){return db[_0x2780('0x2a')]['describe']()[_0x2780('0x23')](respondWithResult(_0x481b04,null))[_0x2780('0x42')](handleError(_0x481b04,null));};function wrapUser(_0x329415){return function(_0x2b6c32){var _0x1e4088=_0x329415[_0x2780('0x4a')]({'plain':!![]});_0x1e4088[_0x2780('0x4b')]=[];if(_0x2b6c32){_0x1e4088['lastMessageAt']=_0x2b6c32[_0x2780('0x4c')];_0x1e4088[_0x2780('0x4d')]=_0x2b6c32;}else{_0x1e4088[_0x2780('0x4e')]=moment(0x0)[_0x2780('0x4f')](_0x2780('0x50'));_0x1e4088['lastMessage']={};}return _0x1e4088;};}exports[_0x2780('0x51')]=function(_0xd29856,_0x395b92,_0x4087d7){var _0x3a6940=[];return db['User']['findAll']({'where':{'role':[_0x2780('0x52'),_0x2780('0x53'),'user']},'attributes':['id',_0x2780('0x54'),'name',_0x2780('0x55'),_0x2780('0x56'),'internal',_0x2780('0x57'),'lastLoginAt',_0x2780('0x58'),'showWebBar'],'order':qs['sort']('-online'),'include':[{'model':db[_0x2780('0x59')],'as':_0x2780('0x5a'),'attributes':['id',_0x2780('0x26'),'type'],'through':{'attributes':[]}}]})[_0x2780('0x23')](function(_0x3947ba){if(_0x3947ba){var _0x4344c2=_0xd29856[_0x2780('0x5b')][_0x2780('0x4a')]({'plain':!![]});if(!_0x4344c2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4344c2[_0x2780('0x55')]===_0x2780('0x5b')){return db[_0x2780('0x5c')][_0x2780('0x46')]({'where':{'name':'Agents','userProfileId':_0x4344c2[_0x2780('0x5d')]},'raw':!![]})[_0x2780('0x23')](function(_0xd9a192){if(_0xd9a192){if(_0xd9a192[_0x2780('0x5e')]===0x0){return db[_0x2780('0x5f')][_0x2780('0x40')]({'where':{'sectionId':_0xd9a192['id']},'raw':!![]})['then'](function(_0x6f7a28){var _0x57a42b=[];if(_[_0x2780('0x60')](_0x6f7a28)){_0x57a42b=_['filter'](_0x3947ba,function(_0x244fd8){if(_0x244fd8[_0x2780('0x55')]!==_0x2780('0x52')){return _0x244fd8;}});return _0x57a42b;}else{for(var _0x724b22=0x0;_0x724b22<_0x3947ba[_0x2780('0x34')];_0x724b22++){var _0x300037=_0x3947ba[_0x724b22];if(_0x300037[_0x2780('0x55')]===_0x2780('0x52')){var _0xc6f88d=_[_0x2780('0x46')](_0x6f7a28,function(_0x1b1ec1){return _0x1b1ec1['resourceId']===_0x300037['id'];});if(_0xc6f88d)_0x57a42b['push'](_0x300037);}else{_0x57a42b[_0x2780('0x61')](_0x300037);}}return _0x57a42b;}});}else{return _0x3947ba;}}else{var _0xad1754=_['filter'](_0x3947ba,function(_0x678fff){if(_0x678fff[_0x2780('0x55')]!=='agent'){return _0x678fff;}});return _0xad1754;}});}else{return _0x3947ba;}}})[_0x2780('0x23')](function(_0x1cff80){var _0x4b2b6a=[];if(_0x1cff80){_0x3a6940=_0x1cff80;for(var _0x5e20d2=0x0;_0x5e20d2<_0x1cff80[_0x2780('0x34')];_0x5e20d2+=0x1){_0x3a6940[_0x5e20d2][_0x2780('0x4b')]=[];_0x4b2b6a[_0x2780('0x61')](db[_0x2780('0x2a')][_0x2780('0x46')]({'where':{'FromId':[_0xd29856['user']['id'],_0x1cff80[_0x5e20d2]['id']],'ToId':[_0xd29856['user']['id'],_0x1cff80[_0x5e20d2]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0x2780('0x62'),'ToId',_0x2780('0x63'),_0x2780('0x48')],'order':qs[_0x2780('0x38')](_0x2780('0x64')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x2780('0x23')](wrapUser(_0x1cff80[_0x5e20d2])));}return BPromise[_0x2780('0x65')](_0x4b2b6a);}return[];})['then'](function(_0x33aa23){return{'rows':_0x33aa23,'count':_0x33aa23[_0x2780('0x34')]};})[_0x2780('0x23')](respondWithResult(_0x395b92,null))[_0x2780('0x42')](handleError(_0x395b92,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 129ee31..1194aa5 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 _0xc1a2=['events','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xc1a2,0x148));var _0x2c1a=function(_0x3f4fcb,_0x1f826e){_0x3f4fcb=_0x3f4fcb-0x0;var _0x230db5=_0xc1a2[_0x3f4fcb];return _0x230db5;};'use strict';var EventEmitter=require(_0x2c1a('0x0'));var ChatInternalMessage=require('../../mysqldb')['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x2c1a('0x1')](0x0);var events={'afterCreate':_0x2c1a('0x2'),'afterUpdate':_0x2c1a('0x3'),'afterDestroy':_0x2c1a('0x4')};function emitEvent(_0x469ca6){return function(_0x18f1fa,_0x478d42,_0xd80381){ChatInternalMessageEvents[_0x2c1a('0x5')](_0x469ca6+':'+_0x18f1fa['id'],_0x18f1fa);ChatInternalMessageEvents[_0x2c1a('0x5')](_0x469ca6,_0x18f1fa);_0xd80381(null);};}for(var e in events){if(events[_0x2c1a('0x6')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0x2c1a('0x7')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xabc1=['ChatInternalMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0xb09d74,_0x4b11ac){var _0x1f5e21=function(_0x40c6b4){while(--_0x40c6b4){_0xb09d74['push'](_0xb09d74['shift']());}};_0x1f5e21(++_0x4b11ac);}(_0xabc1,0x13e));var _0x1abc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xabc1[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x1abc('0x0'));var ChatInternalMessage=require(_0x1abc('0x1'))['db'][_0x1abc('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x1abc('0x3')](0x0);var events={'afterCreate':_0x1abc('0x4'),'afterUpdate':_0x1abc('0x5'),'afterDestroy':_0x1abc('0x6')};function emitEvent(_0xc41737){return function(_0x3fb332,_0x5376c6,_0x71e111){ChatInternalMessageEvents[_0x1abc('0x7')](_0xc41737+':'+_0x3fb332['id'],_0x3fb332);ChatInternalMessageEvents['emit'](_0xc41737,_0x3fb332);_0x71e111(null);};}for(var e in events){if(events[_0x1abc('0x8')](e)){var event=events[e];ChatInternalMessage[_0x1abc('0x9')](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 a21d4aa..a3f6f7b 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 _0x309a=['util','../../config/logger','api','moment','bluebird','path','./chatInternalMessage.attributes','define','ChatInternalMessage','utf8mb4_unicode_ci','lodash'];(function(_0x141665,_0x793f1a){var _0x40f97b=function(_0x4e3ed3){while(--_0x4e3ed3){_0x141665['push'](_0x141665['shift']());}};_0x40f97b(++_0x793f1a);}(_0x309a,0x1c2));var _0xa309=function(_0x471e8e,_0x2faf44){_0x471e8e=_0x471e8e-0x0;var _0x4eef08=_0x309a[_0x471e8e];return _0x4eef08;};'use strict';var _=require(_0xa309('0x0'));var util=require(_0xa309('0x1'));var logger=require(_0xa309('0x2'))(_0xa309('0x3'));var moment=require(_0xa309('0x4'));var BPromise=require(_0xa309('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa309('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa309('0x7'));module['exports']=function(_0x31912f,_0x5f24f6){return _0x31912f[_0xa309('0x8')](_0xa309('0x9'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xa309('0xa')});}; \ No newline at end of file +var _0x9bc2=['bluebird','path','rimraf','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment'];(function(_0x35c5a8,_0x8ecb48){var _0x34782c=function(_0x1b23ec){while(--_0x1b23ec){_0x35c5a8['push'](_0x35c5a8['shift']());}};_0x34782c(++_0x8ecb48);}(_0x9bc2,0x114));var _0x29bc=function(_0x5c12cc,_0xef2a88){_0x5c12cc=_0x5c12cc-0x0;var _0x2ab4d2=_0x9bc2[_0x5c12cc];return _0x2ab4d2;};'use strict';var _=require(_0x29bc('0x0'));var util=require('util');var logger=require(_0x29bc('0x1'))(_0x29bc('0x2'));var moment=require(_0x29bc('0x3'));var BPromise=require(_0x29bc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x29bc('0x5'));var rimraf=require(_0x29bc('0x6'));var config=require('../../config/environment');var attributes=require(_0x29bc('0x7'));module[_0x29bc('0x8')]=function(_0x4e5ce6,_0x44697d){return _0x4e5ce6[_0x29bc('0x9')](_0x29bc('0xa'),attributes,{'tableName':_0x29bc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x29bc('0xc'),'collate':_0x29bc('0xd')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index e67dee2..67f4117 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 _0xcbe5=['localhost','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x49ebfd,_0x1f9990){var _0x5ca53e=function(_0x3c3467){while(--_0x3c3467){_0x49ebfd['push'](_0x49ebfd['shift']());}};_0x5ca53e(++_0x1f9990);}(_0xcbe5,0xee));var _0x5cbe=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xcbe5[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x5cbe('0x0'));var util=require(_0x5cbe('0x1'));var moment=require(_0x5cbe('0x2'));var BPromise=require('bluebird');var rs=require(_0x5cbe('0x3'));var fs=require('fs');var Redis=require(_0x5cbe('0x4'));var db=require(_0x5cbe('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5cbe('0x6'))(_0x5cbe('0x7'));var config=require(_0x5cbe('0x8'));var jayson=require(_0x5cbe('0x9'));var client=jayson[_0x5cbe('0xa')][_0x5cbe('0xb')]({'port':0x232a});config[_0x5cbe('0xc')]=_[_0x5cbe('0xd')](config[_0x5cbe('0xc')],{'host':_0x5cbe('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5cbe('0xf'))[_0x5cbe('0x10')](socket);function respondWithRpcPromise(_0x56778b,_0x7546b2,_0x1f86ce){return new BPromise(function(_0x498637,_0x2a14c9){return client[_0x5cbe('0x11')](_0x56778b,_0x1f86ce)[_0x5cbe('0x12')](function(_0x4155e3){logger[_0x5cbe('0x13')](_0x5cbe('0x14'),_0x7546b2,'request\x20sent');logger[_0x5cbe('0x15')](_0x5cbe('0x16'),_0x7546b2,'request\x20sent',JSON[_0x5cbe('0x17')](_0x4155e3));if(_0x4155e3[_0x5cbe('0x18')]){if(_0x4155e3[_0x5cbe('0x18')]['code']===0x1f4){logger[_0x5cbe('0x18')](_0x5cbe('0x14'),_0x7546b2,_0x4155e3[_0x5cbe('0x18')][_0x5cbe('0x19')]);return _0x2a14c9(_0x4155e3[_0x5cbe('0x18')][_0x5cbe('0x19')]);}logger[_0x5cbe('0x18')]('ChatInternalMessage,\x20%s,\x20%s',_0x7546b2,_0x4155e3[_0x5cbe('0x18')][_0x5cbe('0x19')]);return _0x498637(_0x4155e3[_0x5cbe('0x18')][_0x5cbe('0x19')]);}else{logger[_0x5cbe('0x13')](_0x5cbe('0x14'),_0x7546b2,_0x5cbe('0x1a'));_0x498637(_0x4155e3['result'][_0x5cbe('0x19')]);}})[_0x5cbe('0x1b')](function(_0x1290c0){logger[_0x5cbe('0x18')](_0x5cbe('0x14'),_0x7546b2,_0x1290c0);_0x2a14c9(_0x1290c0);});});} \ No newline at end of file +var _0xa9dd=['result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x3c1cb6,_0x7636f7){var _0x3a9fff=function(_0x168742){while(--_0x168742){_0x3c1cb6['push'](_0x3c1cb6['shift']());}};_0x3a9fff(++_0x7636f7);}(_0xa9dd,0x1c2));var _0xda9d=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9dd[_0x220dbb];return _0x2b77de;};'use strict';var _=require('lodash');var util=require(_0xda9d('0x0'));var moment=require(_0xda9d('0x1'));var BPromise=require('bluebird');var rs=require(_0xda9d('0x2'));var fs=require('fs');var Redis=require(_0xda9d('0x3'));var db=require(_0xda9d('0x4'))['db'];var utils=require(_0xda9d('0x5'));var logger=require('../../config/logger')(_0xda9d('0x6'));var config=require(_0xda9d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xda9d('0x8')][_0xda9d('0x9')]({'port':0x232a});config[_0xda9d('0xa')]=_['defaults'](config[_0xda9d('0xa')],{'host':_0xda9d('0xb'),'port':0x18eb});var socket=require(_0xda9d('0xc'))(new Redis(config[_0xda9d('0xa')]));require(_0xda9d('0xd'))[_0xda9d('0xe')](socket);function respondWithRpcPromise(_0x122ddc,_0x4c298b,_0x4c9f61){return new BPromise(function(_0x344fcd,_0x2d3d5c){return client[_0xda9d('0xf')](_0x122ddc,_0x4c9f61)[_0xda9d('0x10')](function(_0x40c031){logger[_0xda9d('0x11')](_0xda9d('0x12'),_0x4c298b,'request\x20sent');logger[_0xda9d('0x13')](_0xda9d('0x14'),_0x4c298b,_0xda9d('0x15'),JSON[_0xda9d('0x16')](_0x40c031));if(_0x40c031[_0xda9d('0x17')]){if(_0x40c031['error'][_0xda9d('0x18')]===0x1f4){logger[_0xda9d('0x17')](_0xda9d('0x12'),_0x4c298b,_0x40c031[_0xda9d('0x17')][_0xda9d('0x19')]);return _0x2d3d5c(_0x40c031[_0xda9d('0x17')][_0xda9d('0x19')]);}logger[_0xda9d('0x17')](_0xda9d('0x12'),_0x4c298b,_0x40c031[_0xda9d('0x17')][_0xda9d('0x19')]);return _0x344fcd(_0x40c031[_0xda9d('0x17')][_0xda9d('0x19')]);}else{logger[_0xda9d('0x11')](_0xda9d('0x12'),_0x4c298b,_0xda9d('0x15'));_0x344fcd(_0x40c031[_0xda9d('0x1a')]['message']);}})[_0xda9d('0x1b')](function(_0x159a6f){logger[_0xda9d('0x17')]('ChatInternalMessage,\x20%s,\x20%s',_0x4c298b,_0x159a6f);_0x2d3d5c(_0x159a6f);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index f7b00a9..4507640 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 _0x4b6f=['chatInternalMessage:','./chatInternalMessage.events','save','remove','update','removeListener','register'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4b6f,0xb0));var _0xf4b6=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x4b6f[_0x3ff085];return _0x2b68c3;};'use strict';var ChatInternalMessageEvents=require(_0xf4b6('0x0'));var events=[_0xf4b6('0x1'),_0xf4b6('0x2'),_0xf4b6('0x3')];function createListener(_0x1bb09f,_0x169d93){return function(_0x16baed){_0x169d93['emit'](_0x1bb09f,_0x16baed);};}function removeListener(_0x39292e,_0xaf1d8){return function(){ChatInternalMessageEvents[_0xf4b6('0x4')](_0x39292e,_0xaf1d8);};}exports[_0xf4b6('0x5')]=function(_0x40c4ce){for(var _0xfdcd1e=0x0,_0x30390a=events['length'];_0xfdcd1e<_0x30390a;_0xfdcd1e++){var _0x41e30f=events[_0xfdcd1e];var _0xa8d630=createListener(_0xf4b6('0x6')+_0x41e30f,_0x40c4ce);ChatInternalMessageEvents['on'](_0x41e30f,_0xa8d630);}}; \ No newline at end of file +var _0x5384=['save','remove','update','emit','register','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5384,0x13e));var _0x4538=function(_0x2a70e7,_0x3c78ff){_0x2a70e7=_0x2a70e7-0x0;var _0x3d06e9=_0x5384[_0x2a70e7];return _0x3d06e9;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x4538('0x0'),_0x4538('0x1'),_0x4538('0x2')];function createListener(_0x153c54,_0x29c7fd){return function(_0x489ebf){_0x29c7fd[_0x4538('0x3')](_0x153c54,_0x489ebf);};}function removeListener(_0x3a1c1b,_0x33df22){return function(){ChatInternalMessageEvents['removeListener'](_0x3a1c1b,_0x33df22);};}exports[_0x4538('0x4')]=function(_0x27507d){for(var _0xed25f2=0x0,_0x7ad8a1=events[_0x4538('0x5')];_0xed25f2<_0x7ad8a1;_0xed25f2++){var _0x32c3bb=events[_0xed25f2];var _0x5b397e=createListener('chatInternalMessage:'+_0x32c3bb,_0x27507d);ChatInternalMessageEvents['on'](_0x32c3bb,_0x5b397e);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 2dec95c..d66e2b4 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 _0x19a1=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','getUsers','show','create','put','/:id','destroy'];(function(_0x191c4c,_0x3b7c2b){var _0x2fd037=function(_0x26026a){while(--_0x26026a){_0x191c4c['push'](_0x191c4c['shift']());}};_0x2fd037(++_0x3b7c2b);}(_0x19a1,0x11d));var _0x119a=function(_0x16a496,_0x2380e2){_0x16a496=_0x16a496-0x0;var _0x5d2c35=_0x19a1[_0x16a496];return _0x5d2c35;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x119a('0x0'));var timeout=require(_0x119a('0x1'));var express=require(_0x119a('0x2'));var router=express[_0x119a('0x3')]();var fs_extra=require(_0x119a('0x4'));var auth=require(_0x119a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x119a('0x6'));var controller=require(_0x119a('0x7'));router[_0x119a('0x8')]('/',auth[_0x119a('0x9')](),controller[_0x119a('0xa')]);router[_0x119a('0x8')](_0x119a('0xb'),auth[_0x119a('0x9')](),controller[_0x119a('0xc')]);router[_0x119a('0x8')]('/users',auth[_0x119a('0x9')](),controller[_0x119a('0xd')]);router[_0x119a('0x8')]('/:id',auth[_0x119a('0x9')](),controller[_0x119a('0xe')]);router['post']('/',auth[_0x119a('0x9')](),controller[_0x119a('0xf')]);router[_0x119a('0x10')]('/:id',controller['update']);router['delete'](_0x119a('0x11'),auth[_0x119a('0x9')](),controller[_0x119a('0x12')]);module['exports']=router; \ No newline at end of file +var _0xda3f=['connect-timeout','express','Router','fs-extra','../../components/auth/service','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','/users','getUsers','/:id','show','post','put','delete','destroy','exports','multer','util','path'];(function(_0x3e18bf,_0x387f5e){var _0x1022e5=function(_0x242ec4){while(--_0x242ec4){_0x3e18bf['push'](_0x3e18bf['shift']());}};_0x1022e5(++_0x387f5e);}(_0xda3f,0x173));var _0xfda3=function(_0x488622,_0x46b90e){_0x488622=_0x488622-0x0;var _0x445246=_0xda3f[_0x488622];return _0x445246;};'use strict';var multer=require(_0xfda3('0x0'));var util=require(_0xfda3('0x1'));var path=require(_0xfda3('0x2'));var timeout=require(_0xfda3('0x3'));var express=require(_0xfda3('0x4'));var router=express[_0xfda3('0x5')]();var fs_extra=require(_0xfda3('0x6'));var auth=require(_0xfda3('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xfda3('0x8'));router[_0xfda3('0x9')]('/',auth[_0xfda3('0xa')](),controller[_0xfda3('0xb')]);router['get'](_0xfda3('0xc'),auth[_0xfda3('0xa')](),controller['describe']);router['get'](_0xfda3('0xd'),auth['isAuthenticated'](),controller[_0xfda3('0xe')]);router[_0xfda3('0x9')](_0xfda3('0xf'),auth[_0xfda3('0xa')](),controller[_0xfda3('0x10')]);router[_0xfda3('0x11')]('/',auth[_0xfda3('0xa')](),controller['create']);router[_0xfda3('0x12')](_0xfda3('0xf'),controller['update']);router[_0xfda3('0x13')](_0xfda3('0xf'),auth[_0xfda3('0xa')](),controller[_0xfda3('0x14')]);module[_0xfda3('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index aff7cf5..9d7ab5f 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 _0x71f4=['ENUM','out','STRING','TEXT','medium','BOOLEAN'];(function(_0x5e03f7,_0x5dc1d9){var _0xdf3b64=function(_0x43742f){while(--_0x43742f){_0x5e03f7['push'](_0x5e03f7['shift']());}};_0xdf3b64(++_0x5dc1d9);}(_0x71f4,0xf9));var _0x471f=function(_0x2569e9,_0x283072){_0x2569e9=_0x2569e9-0x0;var _0x1a19d6=_0x71f4[_0x2569e9];return _0x1a19d6;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x471f('0x0')](_0x471f('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x471f('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0x471f('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x471f('0x3')]('in','out'),'defaultValue':_0x471f('0x4'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x471f('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x6cb4=['exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','sequelize'];(function(_0x2e78e9,_0x42957c){var _0x35aad4=function(_0x360fa1){while(--_0x360fa1){_0x2e78e9['push'](_0x2e78e9['shift']());}};_0x35aad4(++_0x42957c);}(_0x6cb4,0xff));var _0x46cb=function(_0x22619f,_0x17c7ac){_0x22619f=_0x22619f-0x0;var _0x42b23a=_0x6cb4[_0x22619f];return _0x42b23a;};'use strict';var Sequelize=require(_0x46cb('0x0'));module[_0x46cb('0x1')]={'body':{'type':Sequelize[_0x46cb('0x2')](_0x46cb('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x46cb('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x46cb('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x46cb('0x5')]('in',_0x46cb('0x6')),'defaultValue':_0x46cb('0x6'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x46cb('0x7')]},'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 78326a0..b26fee1 100644 --- a/server/api/chatMessage/chatMessage.controller.js +++ b/server/api/chatMessage/chatMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','contact','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','parse','formData','chat-interactions','chat','ChatInteraction','RejectMessage','rejectMessage','Sequelize','QueryTypes','SELECT','fullname','rejectmessage','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatMessage.socket','register','jayson/promise','client','http','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','stack','name','send','map','ChatMessage','fieldName','type','keys','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','body','find','describe','../../config/logger','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','ChatInteractionId','isNil','read1stAt','format'];(function(_0x1c52ab,_0x640d11){var _0x2bb28d=function(_0x5ec210){while(--_0x5ec210){_0x1c52ab['push'](_0x1c52ab['shift']());}};_0x2bb28d(++_0x640d11);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);var jayson=require(_0x0a9e('0x1a'));var client=jayson[_0x0a9e('0x1b')][_0x0a9e('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0x0a9e('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x5d0880,_0x1985b6,_0x519dfd,_0x16033c){return new BPromise(function(_0x12066b,_0x48f32d){var _0x225616=_0x16033c||client;return _0x225616['request'](_0x5d0880,_0x519dfd)[_0x0a9e('0x1d')](function(_0x478723){logger[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x1985b6,_0x0a9e('0x20'));logger[_0x0a9e('0x21')](_0x0a9e('0x22'),_0x1985b6,_0x0a9e('0x20'),JSON[_0x0a9e('0x23')](_0x478723));if(_0x478723[_0x0a9e('0x24')]){if(_0x478723[_0x0a9e('0x24')][_0x0a9e('0x25')]===0x1f4){logger['error'](_0x0a9e('0x1f'),_0x1985b6,_0x478723[_0x0a9e('0x24')]['message']);return _0x48f32d(_0x478723[_0x0a9e('0x24')]['message']);}logger['error'](_0x0a9e('0x1f'),_0x1985b6,_0x478723[_0x0a9e('0x24')][_0x0a9e('0x26')]);return _0x12066b(_0x478723[_0x0a9e('0x24')]['message']);}else{logger[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x1985b6,_0x0a9e('0x20'));_0x12066b(_0x478723[_0x0a9e('0x27')][_0x0a9e('0x26')]);}})[_0x0a9e('0x28')](function(_0x16b1ca){logger['error']('ChatMessage,\x20%s,\x20%s',_0x1985b6,_0x16b1ca);_0x48f32d(_0x16b1ca);});});}function respondWithStatusCode(_0x197ec0,_0x3a8e58){_0x3a8e58=_0x3a8e58||0xcc;return function(_0x40c424){if(_0x40c424){return _0x197ec0[_0x0a9e('0x29')](_0x3a8e58);}return _0x197ec0['status'](_0x3a8e58)[_0x0a9e('0x2a')]();};}function respondWithResult(_0x479bc4,_0x45a1e7){_0x45a1e7=_0x45a1e7||0xc8;return function(_0x5bfb33){if(_0x5bfb33){return _0x479bc4[_0x0a9e('0x2b')](_0x45a1e7)[_0x0a9e('0x2c')](_0x5bfb33);}};}function respondWithFilteredResult(_0x25fba9,_0x14433c){return function(_0x140511){if(_0x140511){var _0x1538a4=typeof _0x14433c[_0x0a9e('0x2d')]===_0x0a9e('0x2e')&&typeof _0x14433c['limit']===_0x0a9e('0x2e');var _0x468813=_0x140511[_0x0a9e('0x2f')];var _0x2ec755=_0x1538a4?0x0:_0x14433c['offset'];var _0x15b200=_0x1538a4?_0x140511[_0x0a9e('0x2f')]:_0x14433c[_0x0a9e('0x2d')]+_0x14433c[_0x0a9e('0x30')];var _0x58b06f;if(_0x15b200>=_0x468813){_0x15b200=_0x468813;_0x58b06f=0xc8;}else{_0x58b06f=0xce;}_0x25fba9[_0x0a9e('0x2b')](_0x58b06f);return _0x25fba9[_0x0a9e('0x31')](_0x0a9e('0x32'),_0x2ec755+'-'+_0x15b200+'/'+_0x468813)[_0x0a9e('0x2c')](_0x140511);}return null;};}function patchUpdates(_0x540530){return function(_0x426950){try{jsonpatch['apply'](_0x426950,_0x540530,!![]);}catch(_0x2407f9){return BPromise[_0x0a9e('0x33')](_0x2407f9);}return _0x426950[_0x0a9e('0x34')]();};}function saveUpdates(_0x33bdb7,_0x25ce3a){return function(_0x5180f1){if(_0x5180f1){return _0x5180f1[_0x0a9e('0x35')](_0x33bdb7)[_0x0a9e('0x1d')](function(_0x40cb85){return _0x40cb85;});}return null;};}function removeEntity(_0x2da5c0,_0x2b45ea){return function(_0x409319){if(_0x409319){return _0x409319[_0x0a9e('0x36')]()[_0x0a9e('0x1d')](function(){_0x2da5c0['status'](0xcc)[_0x0a9e('0x2a')]();});}};}function handleEntityNotFound(_0x5e7238,_0x2cc7a0){return function(_0x14b13f){if(!_0x14b13f){_0x5e7238[_0x0a9e('0x29')](0x194);}return _0x14b13f;};}function handleError(_0x3f3d41,_0x567193){_0x567193=_0x567193||0x1f4;return function(_0x191e91){logger[_0x0a9e('0x24')](_0x191e91[_0x0a9e('0x37')]);if(_0x191e91[_0x0a9e('0x38')]){delete _0x191e91['name'];}_0x3f3d41['status'](_0x567193)[_0x0a9e('0x39')](_0x191e91);};}exports['index']=function(_0x24936a,_0x3d9717){var _0x381c37={},_0x1ef87a={},_0x4f41ae={'count':0x0,'rows':[]};var _0x31916f=_[_0x0a9e('0x3a')](db[_0x0a9e('0x3b')]['rawAttributes'],function(_0x1dbf74){return{'name':_0x1dbf74[_0x0a9e('0x3c')],'type':_0x1dbf74[_0x0a9e('0x3d')]['key']};});_0x1ef87a['model']=_[_0x0a9e('0x3a')](_0x31916f,_0x0a9e('0x38'));_0x1ef87a['query']=_[_0x0a9e('0x3e')](_0x24936a[_0x0a9e('0x3f')]);_0x1ef87a[_0x0a9e('0x40')]=_[_0x0a9e('0x41')](_0x1ef87a['model'],_0x1ef87a['query']);_0x381c37[_0x0a9e('0x42')]=_[_0x0a9e('0x41')](_0x1ef87a['model'],qs[_0x0a9e('0x43')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x43')]));_0x381c37['attributes']=_0x381c37[_0x0a9e('0x42')][_0x0a9e('0x44')]?_0x381c37[_0x0a9e('0x42')]:_0x1ef87a[_0x0a9e('0x45')];if(!_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x46')](_0x0a9e('0x47'))){_0x381c37[_0x0a9e('0x30')]=qs[_0x0a9e('0x30')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x30')]);_0x381c37[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2d')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x2d')]);}_0x381c37['order']=qs['sort'](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x48')]);_0x381c37[_0x0a9e('0x49')]=qs[_0x0a9e('0x40')](_[_0x0a9e('0x4a')](_0x24936a[_0x0a9e('0x3f')],_0x1ef87a[_0x0a9e('0x40')]),_0x31916f);if(_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4b')]){_0x381c37[_0x0a9e('0x49')]=_[_0x0a9e('0x4c')](_0x381c37[_0x0a9e('0x49')],{'$or':_['map'](_0x31916f,function(_0x117c99){if(_0x117c99[_0x0a9e('0x3d')]!==_0x0a9e('0x4d')){var _0xfbd5ad={};_0xfbd5ad[_0x117c99[_0x0a9e('0x38')]]={'$like':'%'+_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4b')]+'%'};return _0xfbd5ad;}})});}_0x381c37=_[_0x0a9e('0x4c')]({},_0x381c37,_0x24936a['options']);var _0x2e9d90={'where':_0x381c37['where']};return db[_0x0a9e('0x3b')][_0x0a9e('0x2f')](_0x2e9d90)[_0x0a9e('0x1d')](function(_0x562fb4){_0x4f41ae[_0x0a9e('0x2f')]=_0x562fb4;if(_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4e')]){_0x381c37[_0x0a9e('0x4f')]=[{'all':!![]}];}return db[_0x0a9e('0x3b')][_0x0a9e('0x50')](_0x381c37);})[_0x0a9e('0x1d')](function(_0x5bbcde){_0x4f41ae[_0x0a9e('0x51')]=_0x5bbcde;return _0x4f41ae;})[_0x0a9e('0x1d')](respondWithFilteredResult(_0x3d9717,_0x381c37))[_0x0a9e('0x28')](handleError(_0x3d9717,null));};exports[_0x0a9e('0x52')]=function(_0x409789,_0x992c77){var _0x6054ee={'raw':!![],'where':{'id':_0x409789[_0x0a9e('0x53')]['id']}},_0x19383e={};_0x19383e['model']=_[_0x0a9e('0x3e')](db[_0x0a9e('0x3b')]['rawAttributes']);_0x19383e['query']=_['keys'](_0x409789[_0x0a9e('0x3f')]);_0x19383e[_0x0a9e('0x40')]=_[_0x0a9e('0x41')](_0x19383e[_0x0a9e('0x45')],_0x19383e[_0x0a9e('0x3f')]);_0x6054ee[_0x0a9e('0x42')]=_[_0x0a9e('0x41')](_0x19383e[_0x0a9e('0x45')],qs['fields'](_0x409789['query']['fields']));_0x6054ee[_0x0a9e('0x42')]=_0x6054ee[_0x0a9e('0x42')][_0x0a9e('0x44')]?_0x6054ee['attributes']:_0x19383e[_0x0a9e('0x45')];if(_0x409789[_0x0a9e('0x3f')]['includeAll']){_0x6054ee['include']=[{'all':!![]}];}_0x6054ee=_[_0x0a9e('0x4c')]({},_0x6054ee,_0x409789['options']);return db[_0x0a9e('0x3b')]['find'](_0x6054ee)[_0x0a9e('0x1d')](handleEntityNotFound(_0x992c77,null))[_0x0a9e('0x1d')](respondWithResult(_0x992c77,null))[_0x0a9e('0x28')](handleError(_0x992c77,null));};exports['create']=function(_0x2f82da,_0x1bf38a){return db['ChatMessage']['create'](_0x2f82da[_0x0a9e('0x54')],{})[_0x0a9e('0x1d')](respondWithResult(_0x1bf38a,0xc9))['catch'](handleError(_0x1bf38a,null));};exports[_0x0a9e('0x35')]=function(_0x5ce9ac,_0x211ef9){if(_0x5ce9ac['body']['id']){delete _0x5ce9ac[_0x0a9e('0x54')]['id'];}return db['ChatMessage']['find']({'where':{'id':_0x5ce9ac['params']['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x211ef9,null))['then'](saveUpdates(_0x5ce9ac[_0x0a9e('0x54')],null))[_0x0a9e('0x1d')](respondWithResult(_0x211ef9,null))[_0x0a9e('0x28')](handleError(_0x211ef9,null));};exports[_0x0a9e('0x36')]=function(_0x232830,_0x272738){return db[_0x0a9e('0x3b')][_0x0a9e('0x55')]({'where':{'id':_0x232830['params']['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x272738,null))[_0x0a9e('0x1d')](removeEntity(_0x272738,null))[_0x0a9e('0x28')](handleError(_0x272738,null));};exports[_0x0a9e('0x56')]=function(_0xb83dfd,_0x156662){return db['ChatMessage'][_0x0a9e('0x56')]()[_0x0a9e('0x1d')](respondWithResult(_0x156662,null))['catch'](handleError(_0x156662,null));};var interaction_log=require(_0x0a9e('0x57'))('chat-interactions');exports[_0x0a9e('0x58')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee){var _0x273cb5={'agent':{},'channel':'chat'};if(_0x5ba1f9[_0x0a9e('0x54')]['id']){delete _0x5ba1f9[_0x0a9e('0x54')]['id'];}_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x59')]=!![];_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5a')]=moment()['format'](_0x0a9e('0x5b'));_0x5ba1f9['body'][_0x0a9e('0x5c')]=_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')]||_0x5ba1f9['user']['id'];_0x273cb5[_0x0a9e('0x5d')]['id']=_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')];return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x5ba1f9[_0x0a9e('0x53')]['id'],'UserId':null}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x4b3c1a,null))['then'](saveUpdates(_0x5ba1f9[_0x0a9e('0x54')],null))[_0x0a9e('0x1d')](function(_0x88dcbf){if(_0x88dcbf){_0x273cb5[_0x0a9e('0x26')]=_0x88dcbf[_0x0a9e('0x5e')]({'plain':!![]});return db['ChatInteraction'][_0x0a9e('0x55')]({'where':{'id':_0x88dcbf[_0x0a9e('0x5f')]}});}return null;})[_0x0a9e('0x1d')](handleEntityNotFound(_0x4b3c1a,null))['then'](function(_0x3528b7){if(_0x3528b7){return _0x3528b7['update']({'UserId':_0x5ba1f9['body'][_0x0a9e('0x5c')],'read1stAt':_[_0x0a9e('0x60')](_0x3528b7[_0x0a9e('0x61')])?moment()[_0x0a9e('0x62')](_0x0a9e('0x5b')):undefined});}return null;})[_0x0a9e('0x1d')](function(_0x387489){if(_0x387489){_0x273cb5[_0x0a9e('0x63')]=_0x387489[_0x0a9e('0x5e')]({'plain':!![]});interaction_log[_0x0a9e('0x1e')](_0x0a9e('0x64'),_0x5ba1f9[_0x0a9e('0x65')]['id'],_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x38')],_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x66')],_0x273cb5[_0x0a9e('0x63')]['id'],_0x5ba1f9[_0x0a9e('0x54')]?JSON['stringify'](_0x5ba1f9[_0x0a9e('0x54')]):_0x0a9e('0x67'));return respondWithRpcPromise(_0x0a9e('0x68'),'acceptMessage',_0x273cb5);}return null;})[_0x0a9e('0x1d')](function(_0x30944e){var _0x4b341d=_0x0a9e('0x69')+_0x30944e[_0x0a9e('0x26')][_0x0a9e('0x6a')];return db[_0x0a9e('0x6b')][_0x0a9e('0x3f')](_0x4b341d,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0x0a9e('0x1d')](function(_0x18bf5d){return _0x18bf5d;});})[_0x0a9e('0x1d')](function(_0x23a7d3){if(_0x23a7d3){_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x6c')]=_0x23a7d3[0x0];if(!_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')])return;return db['User'][_0x0a9e('0x55')]({'where':{'id':_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')],'role':'agent'},'attributes':['id',_0x0a9e('0x38'),'fullname',_0x0a9e('0x6d'),_0x0a9e('0x6e')],'raw':!![]});}return null;})['then'](function(_0x2ed01e){if(!_0x2ed01e)return null;_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x5d')]=_0x2ed01e;return _0x273cb5;})[_0x0a9e('0x1d')](function(_0x542ece){if(_0x542ece){if(_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x6f')]){_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x70')]=util['format'](_0x0a9e('0x71'),_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x38')]);_0x273cb5[_0x0a9e('0x26')]['channel']=_0x273cb5[_0x0a9e('0x72')];_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x73')]=_0x0a9e('0x58');return respondWithRpcPromise(_0x0a9e('0x74'),_0x0a9e('0x74'),{'event':_0x0a9e('0x75'),'message':_[_0x0a9e('0x4c')](_0x273cb5[_0x0a9e('0x26')],JSON[_0x0a9e('0x76')](_0x273cb5[_0x0a9e('0x63')][_0x0a9e('0x77')]))},client9002)[_0x0a9e('0x1d')](function(){return _0x273cb5;});}return _0x273cb5;}return null;})[_0x0a9e('0x1d')](respondWithResult(_0x4b3c1a,null))['catch'](handleError(_0x4b3c1a,null));};var interaction_log=require(_0x0a9e('0x57'))(_0x0a9e('0x78'));exports[_0x0a9e('0x33')]=function(_0x563627,_0x3736e0,_0x33dda0){var _0x8cea96={'agent':{},'channel':_0x0a9e('0x79')};if(_0x563627['body']['id']){delete _0x563627['body']['id'];}_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')]=_0x563627['body'][_0x0a9e('0x5c')]||_0x563627['user']['id'];_0x8cea96[_0x0a9e('0x5d')]['id']=_0x563627[_0x0a9e('0x54')]['UserId'];return db[_0x0a9e('0x3b')][_0x0a9e('0x55')]({'where':{'id':_0x563627[_0x0a9e('0x53')]['id'],'UserId':null}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x3736e0,null))[_0x0a9e('0x1d')](function(_0x1f42a0){if(_0x1f42a0){_0x8cea96[_0x0a9e('0x26')]=_0x1f42a0['get']({'plain':!![]});return db[_0x0a9e('0x7a')][_0x0a9e('0x55')]({'where':{'id':_0x1f42a0[_0x0a9e('0x5f')]}});}return null;})[_0x0a9e('0x1d')](handleEntityNotFound(_0x3736e0,null))['then'](function(_0xf51744){if(_0xf51744){_0x8cea96[_0x0a9e('0x63')]=_0xf51744['get']({'plain':!![]});interaction_log[_0x0a9e('0x1e')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x563627[_0x0a9e('0x65')]['id'],_0x563627[_0x0a9e('0x65')][_0x0a9e('0x38')],_0x563627[_0x0a9e('0x65')]['role'],_0x8cea96['interaction']['id'],_0x563627[_0x0a9e('0x54')]?JSON[_0x0a9e('0x23')](_0x563627[_0x0a9e('0x54')]):'null');return respondWithRpcPromise(_0x0a9e('0x7b'),_0x0a9e('0x7c'),_0x8cea96);}return null;})['then'](function(_0x4e46b2){var _0xf0a802='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4e46b2['message']['ContactId'];return db[_0x0a9e('0x6b')][_0x0a9e('0x3f')](_0xf0a802,{'type':db[_0x0a9e('0x7d')][_0x0a9e('0x7e')][_0x0a9e('0x7f')],'raw':!![]})[_0x0a9e('0x1d')](function(_0x5a8854){return _0x5a8854;});})[_0x0a9e('0x1d')](function(_0x5955f1){if(_0x5955f1){_0x8cea96[_0x0a9e('0x26')][_0x0a9e('0x6c')]=_0x5955f1[0x0];if(!_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')])return;return db['User'][_0x0a9e('0x55')]({'where':{'id':_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')],'role':'agent'},'attributes':['id',_0x0a9e('0x38'),_0x0a9e('0x80'),_0x0a9e('0x6d'),_0x0a9e('0x6e')],'raw':!![]});}return null;})[_0x0a9e('0x1d')](function(_0x1910bf){if(!_0x1910bf)return null;_0x8cea96[_0x0a9e('0x26')][_0x0a9e('0x5d')]=_0x1910bf;return _0x8cea96;})['then'](function(_0x2645d6){if(_0x2645d6){_0x2645d6[_0x0a9e('0x26')]['interface']=util[_0x0a9e('0x62')](_0x0a9e('0x71'),_0x563627[_0x0a9e('0x65')]['name']);_0x2645d6[_0x0a9e('0x26')]['channel']=_0x8cea96[_0x0a9e('0x72')];_0x2645d6[_0x0a9e('0x26')][_0x0a9e('0x73')]=_0x0a9e('0x33');respondWithRpcPromise(_0x0a9e('0x74'),_0x0a9e('0x74'),{'event':_0x0a9e('0x81'),'message':_[_0x0a9e('0x4c')](_0x8cea96['message'],JSON[_0x0a9e('0x76')](_0x8cea96[_0x0a9e('0x63')][_0x0a9e('0x77')]))},client9002);return _0x8cea96;}return null;})[_0x0a9e('0x1d')](respondWithResult(_0x3736e0,null))[_0x0a9e('0x28')](handleError(_0x3736e0,null));}; \ No newline at end of file +var _0xa9e0=['interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','contact','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','parse','formData','chat-interactions','chat','ChatInteraction','RejectMessage','rejectMessage','Sequelize','QueryTypes','SELECT','fullname','rejectmessage','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatMessage.socket','register','jayson/promise','client','http','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','stack','name','send','map','ChatMessage','fieldName','type','keys','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','body','find','describe','../../config/logger','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','ChatInteractionId','isNil','read1stAt','format'];(function(_0x19105d,_0xefa103){var _0x556483=function(_0x40b840){while(--_0x40b840){_0x19105d['push'](_0x19105d['shift']());}};_0x556483(++_0xefa103);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);var jayson=require(_0x0a9e('0x1a'));var client=jayson[_0x0a9e('0x1b')][_0x0a9e('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0x0a9e('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x5d0880,_0x1985b6,_0x519dfd,_0x16033c){return new BPromise(function(_0x12066b,_0x48f32d){var _0x225616=_0x16033c||client;return _0x225616['request'](_0x5d0880,_0x519dfd)[_0x0a9e('0x1d')](function(_0x478723){logger[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x1985b6,_0x0a9e('0x20'));logger[_0x0a9e('0x21')](_0x0a9e('0x22'),_0x1985b6,_0x0a9e('0x20'),JSON[_0x0a9e('0x23')](_0x478723));if(_0x478723[_0x0a9e('0x24')]){if(_0x478723[_0x0a9e('0x24')][_0x0a9e('0x25')]===0x1f4){logger['error'](_0x0a9e('0x1f'),_0x1985b6,_0x478723[_0x0a9e('0x24')]['message']);return _0x48f32d(_0x478723[_0x0a9e('0x24')]['message']);}logger['error'](_0x0a9e('0x1f'),_0x1985b6,_0x478723[_0x0a9e('0x24')][_0x0a9e('0x26')]);return _0x12066b(_0x478723[_0x0a9e('0x24')]['message']);}else{logger[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x1985b6,_0x0a9e('0x20'));_0x12066b(_0x478723[_0x0a9e('0x27')][_0x0a9e('0x26')]);}})[_0x0a9e('0x28')](function(_0x16b1ca){logger['error']('ChatMessage,\x20%s,\x20%s',_0x1985b6,_0x16b1ca);_0x48f32d(_0x16b1ca);});});}function respondWithStatusCode(_0x197ec0,_0x3a8e58){_0x3a8e58=_0x3a8e58||0xcc;return function(_0x40c424){if(_0x40c424){return _0x197ec0[_0x0a9e('0x29')](_0x3a8e58);}return _0x197ec0['status'](_0x3a8e58)[_0x0a9e('0x2a')]();};}function respondWithResult(_0x479bc4,_0x45a1e7){_0x45a1e7=_0x45a1e7||0xc8;return function(_0x5bfb33){if(_0x5bfb33){return _0x479bc4[_0x0a9e('0x2b')](_0x45a1e7)[_0x0a9e('0x2c')](_0x5bfb33);}};}function respondWithFilteredResult(_0x25fba9,_0x14433c){return function(_0x140511){if(_0x140511){var _0x1538a4=typeof _0x14433c[_0x0a9e('0x2d')]===_0x0a9e('0x2e')&&typeof _0x14433c['limit']===_0x0a9e('0x2e');var _0x468813=_0x140511[_0x0a9e('0x2f')];var _0x2ec755=_0x1538a4?0x0:_0x14433c['offset'];var _0x15b200=_0x1538a4?_0x140511[_0x0a9e('0x2f')]:_0x14433c[_0x0a9e('0x2d')]+_0x14433c[_0x0a9e('0x30')];var _0x58b06f;if(_0x15b200>=_0x468813){_0x15b200=_0x468813;_0x58b06f=0xc8;}else{_0x58b06f=0xce;}_0x25fba9[_0x0a9e('0x2b')](_0x58b06f);return _0x25fba9[_0x0a9e('0x31')](_0x0a9e('0x32'),_0x2ec755+'-'+_0x15b200+'/'+_0x468813)[_0x0a9e('0x2c')](_0x140511);}return null;};}function patchUpdates(_0x540530){return function(_0x426950){try{jsonpatch['apply'](_0x426950,_0x540530,!![]);}catch(_0x2407f9){return BPromise[_0x0a9e('0x33')](_0x2407f9);}return _0x426950[_0x0a9e('0x34')]();};}function saveUpdates(_0x33bdb7,_0x25ce3a){return function(_0x5180f1){if(_0x5180f1){return _0x5180f1[_0x0a9e('0x35')](_0x33bdb7)[_0x0a9e('0x1d')](function(_0x40cb85){return _0x40cb85;});}return null;};}function removeEntity(_0x2da5c0,_0x2b45ea){return function(_0x409319){if(_0x409319){return _0x409319[_0x0a9e('0x36')]()[_0x0a9e('0x1d')](function(){_0x2da5c0['status'](0xcc)[_0x0a9e('0x2a')]();});}};}function handleEntityNotFound(_0x5e7238,_0x2cc7a0){return function(_0x14b13f){if(!_0x14b13f){_0x5e7238[_0x0a9e('0x29')](0x194);}return _0x14b13f;};}function handleError(_0x3f3d41,_0x567193){_0x567193=_0x567193||0x1f4;return function(_0x191e91){logger[_0x0a9e('0x24')](_0x191e91[_0x0a9e('0x37')]);if(_0x191e91[_0x0a9e('0x38')]){delete _0x191e91['name'];}_0x3f3d41['status'](_0x567193)[_0x0a9e('0x39')](_0x191e91);};}exports['index']=function(_0x24936a,_0x3d9717){var _0x381c37={},_0x1ef87a={},_0x4f41ae={'count':0x0,'rows':[]};var _0x31916f=_[_0x0a9e('0x3a')](db[_0x0a9e('0x3b')]['rawAttributes'],function(_0x1dbf74){return{'name':_0x1dbf74[_0x0a9e('0x3c')],'type':_0x1dbf74[_0x0a9e('0x3d')]['key']};});_0x1ef87a['model']=_[_0x0a9e('0x3a')](_0x31916f,_0x0a9e('0x38'));_0x1ef87a['query']=_[_0x0a9e('0x3e')](_0x24936a[_0x0a9e('0x3f')]);_0x1ef87a[_0x0a9e('0x40')]=_[_0x0a9e('0x41')](_0x1ef87a['model'],_0x1ef87a['query']);_0x381c37[_0x0a9e('0x42')]=_[_0x0a9e('0x41')](_0x1ef87a['model'],qs[_0x0a9e('0x43')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x43')]));_0x381c37['attributes']=_0x381c37[_0x0a9e('0x42')][_0x0a9e('0x44')]?_0x381c37[_0x0a9e('0x42')]:_0x1ef87a[_0x0a9e('0x45')];if(!_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x46')](_0x0a9e('0x47'))){_0x381c37[_0x0a9e('0x30')]=qs[_0x0a9e('0x30')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x30')]);_0x381c37[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2d')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x2d')]);}_0x381c37['order']=qs['sort'](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x48')]);_0x381c37[_0x0a9e('0x49')]=qs[_0x0a9e('0x40')](_[_0x0a9e('0x4a')](_0x24936a[_0x0a9e('0x3f')],_0x1ef87a[_0x0a9e('0x40')]),_0x31916f);if(_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4b')]){_0x381c37[_0x0a9e('0x49')]=_[_0x0a9e('0x4c')](_0x381c37[_0x0a9e('0x49')],{'$or':_['map'](_0x31916f,function(_0x117c99){if(_0x117c99[_0x0a9e('0x3d')]!==_0x0a9e('0x4d')){var _0xfbd5ad={};_0xfbd5ad[_0x117c99[_0x0a9e('0x38')]]={'$like':'%'+_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4b')]+'%'};return _0xfbd5ad;}})});}_0x381c37=_[_0x0a9e('0x4c')]({},_0x381c37,_0x24936a['options']);var _0x2e9d90={'where':_0x381c37['where']};return db[_0x0a9e('0x3b')][_0x0a9e('0x2f')](_0x2e9d90)[_0x0a9e('0x1d')](function(_0x562fb4){_0x4f41ae[_0x0a9e('0x2f')]=_0x562fb4;if(_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4e')]){_0x381c37[_0x0a9e('0x4f')]=[{'all':!![]}];}return db[_0x0a9e('0x3b')][_0x0a9e('0x50')](_0x381c37);})[_0x0a9e('0x1d')](function(_0x5bbcde){_0x4f41ae[_0x0a9e('0x51')]=_0x5bbcde;return _0x4f41ae;})[_0x0a9e('0x1d')](respondWithFilteredResult(_0x3d9717,_0x381c37))[_0x0a9e('0x28')](handleError(_0x3d9717,null));};exports[_0x0a9e('0x52')]=function(_0x409789,_0x992c77){var _0x6054ee={'raw':!![],'where':{'id':_0x409789[_0x0a9e('0x53')]['id']}},_0x19383e={};_0x19383e['model']=_[_0x0a9e('0x3e')](db[_0x0a9e('0x3b')]['rawAttributes']);_0x19383e['query']=_['keys'](_0x409789[_0x0a9e('0x3f')]);_0x19383e[_0x0a9e('0x40')]=_[_0x0a9e('0x41')](_0x19383e[_0x0a9e('0x45')],_0x19383e[_0x0a9e('0x3f')]);_0x6054ee[_0x0a9e('0x42')]=_[_0x0a9e('0x41')](_0x19383e[_0x0a9e('0x45')],qs['fields'](_0x409789['query']['fields']));_0x6054ee[_0x0a9e('0x42')]=_0x6054ee[_0x0a9e('0x42')][_0x0a9e('0x44')]?_0x6054ee['attributes']:_0x19383e[_0x0a9e('0x45')];if(_0x409789[_0x0a9e('0x3f')]['includeAll']){_0x6054ee['include']=[{'all':!![]}];}_0x6054ee=_[_0x0a9e('0x4c')]({},_0x6054ee,_0x409789['options']);return db[_0x0a9e('0x3b')]['find'](_0x6054ee)[_0x0a9e('0x1d')](handleEntityNotFound(_0x992c77,null))[_0x0a9e('0x1d')](respondWithResult(_0x992c77,null))[_0x0a9e('0x28')](handleError(_0x992c77,null));};exports['create']=function(_0x2f82da,_0x1bf38a){return db['ChatMessage']['create'](_0x2f82da[_0x0a9e('0x54')],{})[_0x0a9e('0x1d')](respondWithResult(_0x1bf38a,0xc9))['catch'](handleError(_0x1bf38a,null));};exports[_0x0a9e('0x35')]=function(_0x5ce9ac,_0x211ef9){if(_0x5ce9ac['body']['id']){delete _0x5ce9ac[_0x0a9e('0x54')]['id'];}return db['ChatMessage']['find']({'where':{'id':_0x5ce9ac['params']['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x211ef9,null))['then'](saveUpdates(_0x5ce9ac[_0x0a9e('0x54')],null))[_0x0a9e('0x1d')](respondWithResult(_0x211ef9,null))[_0x0a9e('0x28')](handleError(_0x211ef9,null));};exports[_0x0a9e('0x36')]=function(_0x232830,_0x272738){return db[_0x0a9e('0x3b')][_0x0a9e('0x55')]({'where':{'id':_0x232830['params']['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x272738,null))[_0x0a9e('0x1d')](removeEntity(_0x272738,null))[_0x0a9e('0x28')](handleError(_0x272738,null));};exports[_0x0a9e('0x56')]=function(_0xb83dfd,_0x156662){return db['ChatMessage'][_0x0a9e('0x56')]()[_0x0a9e('0x1d')](respondWithResult(_0x156662,null))['catch'](handleError(_0x156662,null));};var interaction_log=require(_0x0a9e('0x57'))('chat-interactions');exports[_0x0a9e('0x58')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee){var _0x273cb5={'agent':{},'channel':'chat'};if(_0x5ba1f9[_0x0a9e('0x54')]['id']){delete _0x5ba1f9[_0x0a9e('0x54')]['id'];}_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x59')]=!![];_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5a')]=moment()['format'](_0x0a9e('0x5b'));_0x5ba1f9['body'][_0x0a9e('0x5c')]=_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')]||_0x5ba1f9['user']['id'];_0x273cb5[_0x0a9e('0x5d')]['id']=_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')];return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x5ba1f9[_0x0a9e('0x53')]['id'],'UserId':null}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x4b3c1a,null))['then'](saveUpdates(_0x5ba1f9[_0x0a9e('0x54')],null))[_0x0a9e('0x1d')](function(_0x88dcbf){if(_0x88dcbf){_0x273cb5[_0x0a9e('0x26')]=_0x88dcbf[_0x0a9e('0x5e')]({'plain':!![]});return db['ChatInteraction'][_0x0a9e('0x55')]({'where':{'id':_0x88dcbf[_0x0a9e('0x5f')]}});}return null;})[_0x0a9e('0x1d')](handleEntityNotFound(_0x4b3c1a,null))['then'](function(_0x3528b7){if(_0x3528b7){return _0x3528b7['update']({'UserId':_0x5ba1f9['body'][_0x0a9e('0x5c')],'read1stAt':_[_0x0a9e('0x60')](_0x3528b7[_0x0a9e('0x61')])?moment()[_0x0a9e('0x62')](_0x0a9e('0x5b')):undefined});}return null;})[_0x0a9e('0x1d')](function(_0x387489){if(_0x387489){_0x273cb5[_0x0a9e('0x63')]=_0x387489[_0x0a9e('0x5e')]({'plain':!![]});interaction_log[_0x0a9e('0x1e')](_0x0a9e('0x64'),_0x5ba1f9[_0x0a9e('0x65')]['id'],_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x38')],_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x66')],_0x273cb5[_0x0a9e('0x63')]['id'],_0x5ba1f9[_0x0a9e('0x54')]?JSON['stringify'](_0x5ba1f9[_0x0a9e('0x54')]):_0x0a9e('0x67'));return respondWithRpcPromise(_0x0a9e('0x68'),'acceptMessage',_0x273cb5);}return null;})[_0x0a9e('0x1d')](function(_0x30944e){var _0x4b341d=_0x0a9e('0x69')+_0x30944e[_0x0a9e('0x26')][_0x0a9e('0x6a')];return db[_0x0a9e('0x6b')][_0x0a9e('0x3f')](_0x4b341d,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0x0a9e('0x1d')](function(_0x18bf5d){return _0x18bf5d;});})[_0x0a9e('0x1d')](function(_0x23a7d3){if(_0x23a7d3){_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x6c')]=_0x23a7d3[0x0];if(!_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')])return;return db['User'][_0x0a9e('0x55')]({'where':{'id':_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')],'role':'agent'},'attributes':['id',_0x0a9e('0x38'),'fullname',_0x0a9e('0x6d'),_0x0a9e('0x6e')],'raw':!![]});}return null;})['then'](function(_0x2ed01e){if(!_0x2ed01e)return null;_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x5d')]=_0x2ed01e;return _0x273cb5;})[_0x0a9e('0x1d')](function(_0x542ece){if(_0x542ece){if(_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x6f')]){_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x70')]=util['format'](_0x0a9e('0x71'),_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x38')]);_0x273cb5[_0x0a9e('0x26')]['channel']=_0x273cb5[_0x0a9e('0x72')];_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x73')]=_0x0a9e('0x58');return respondWithRpcPromise(_0x0a9e('0x74'),_0x0a9e('0x74'),{'event':_0x0a9e('0x75'),'message':_[_0x0a9e('0x4c')](_0x273cb5[_0x0a9e('0x26')],JSON[_0x0a9e('0x76')](_0x273cb5[_0x0a9e('0x63')][_0x0a9e('0x77')]))},client9002)[_0x0a9e('0x1d')](function(){return _0x273cb5;});}return _0x273cb5;}return null;})[_0x0a9e('0x1d')](respondWithResult(_0x4b3c1a,null))['catch'](handleError(_0x4b3c1a,null));};var interaction_log=require(_0x0a9e('0x57'))(_0x0a9e('0x78'));exports[_0x0a9e('0x33')]=function(_0x563627,_0x3736e0,_0x33dda0){var _0x8cea96={'agent':{},'channel':_0x0a9e('0x79')};if(_0x563627['body']['id']){delete _0x563627['body']['id'];}_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')]=_0x563627['body'][_0x0a9e('0x5c')]||_0x563627['user']['id'];_0x8cea96[_0x0a9e('0x5d')]['id']=_0x563627[_0x0a9e('0x54')]['UserId'];return db[_0x0a9e('0x3b')][_0x0a9e('0x55')]({'where':{'id':_0x563627[_0x0a9e('0x53')]['id'],'UserId':null}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x3736e0,null))[_0x0a9e('0x1d')](function(_0x1f42a0){if(_0x1f42a0){_0x8cea96[_0x0a9e('0x26')]=_0x1f42a0['get']({'plain':!![]});return db[_0x0a9e('0x7a')][_0x0a9e('0x55')]({'where':{'id':_0x1f42a0[_0x0a9e('0x5f')]}});}return null;})[_0x0a9e('0x1d')](handleEntityNotFound(_0x3736e0,null))['then'](function(_0xf51744){if(_0xf51744){_0x8cea96[_0x0a9e('0x63')]=_0xf51744['get']({'plain':!![]});interaction_log[_0x0a9e('0x1e')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x563627[_0x0a9e('0x65')]['id'],_0x563627[_0x0a9e('0x65')][_0x0a9e('0x38')],_0x563627[_0x0a9e('0x65')]['role'],_0x8cea96['interaction']['id'],_0x563627[_0x0a9e('0x54')]?JSON[_0x0a9e('0x23')](_0x563627[_0x0a9e('0x54')]):'null');return respondWithRpcPromise(_0x0a9e('0x7b'),_0x0a9e('0x7c'),_0x8cea96);}return null;})['then'](function(_0x4e46b2){var _0xf0a802='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4e46b2['message']['ContactId'];return db[_0x0a9e('0x6b')][_0x0a9e('0x3f')](_0xf0a802,{'type':db[_0x0a9e('0x7d')][_0x0a9e('0x7e')][_0x0a9e('0x7f')],'raw':!![]})[_0x0a9e('0x1d')](function(_0x5a8854){return _0x5a8854;});})[_0x0a9e('0x1d')](function(_0x5955f1){if(_0x5955f1){_0x8cea96[_0x0a9e('0x26')][_0x0a9e('0x6c')]=_0x5955f1[0x0];if(!_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')])return;return db['User'][_0x0a9e('0x55')]({'where':{'id':_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')],'role':'agent'},'attributes':['id',_0x0a9e('0x38'),_0x0a9e('0x80'),_0x0a9e('0x6d'),_0x0a9e('0x6e')],'raw':!![]});}return null;})[_0x0a9e('0x1d')](function(_0x1910bf){if(!_0x1910bf)return null;_0x8cea96[_0x0a9e('0x26')][_0x0a9e('0x5d')]=_0x1910bf;return _0x8cea96;})['then'](function(_0x2645d6){if(_0x2645d6){_0x2645d6[_0x0a9e('0x26')]['interface']=util[_0x0a9e('0x62')](_0x0a9e('0x71'),_0x563627[_0x0a9e('0x65')]['name']);_0x2645d6[_0x0a9e('0x26')]['channel']=_0x8cea96[_0x0a9e('0x72')];_0x2645d6[_0x0a9e('0x26')][_0x0a9e('0x73')]=_0x0a9e('0x33');respondWithRpcPromise(_0x0a9e('0x74'),_0x0a9e('0x74'),{'event':_0x0a9e('0x81'),'message':_[_0x0a9e('0x4c')](_0x8cea96['message'],JSON[_0x0a9e('0x76')](_0x8cea96[_0x0a9e('0x63')][_0x0a9e('0x77')]))},client9002);return _0x8cea96;}return null;})[_0x0a9e('0x1d')](respondWithResult(_0x3736e0,null))[_0x0a9e('0x28')](handleError(_0x3736e0,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 69e1335..e249345 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 _0x4fe8=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','ChatMessage','setMaxListeners','save','update'];(function(_0x1a7e2e,_0x304892){var _0x194472=function(_0x26fd24){while(--_0x26fd24){_0x1a7e2e['push'](_0x1a7e2e['shift']());}};_0x194472(++_0x304892);}(_0x4fe8,0x14f));var _0x84fe=function(_0x11c573,_0x1507b5){_0x11c573=_0x11c573-0x0;var _0x320ace=_0x4fe8[_0x11c573];return _0x320ace;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x84fe('0x0'))['db'][_0x84fe('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x84fe('0x2')](0x0);var events={'afterCreate':_0x84fe('0x3'),'afterUpdate':_0x84fe('0x4'),'afterDestroy':_0x84fe('0x5')};function emitEvent(_0x3da56f){return function(_0x2411e8,_0x39f486,_0x32c225){ChatMessageEvents[_0x84fe('0x6')](_0x3da56f+':'+_0x2411e8['id'],_0x2411e8);ChatMessageEvents[_0x84fe('0x6')](_0x3da56f,_0x2411e8);_0x32c225(null);};}for(var e in events){if(events[_0x84fe('0x7')](e)){var event=events[e];ChatMessage[_0x84fe('0x8')](e,emitEvent(event));}}module[_0x84fe('0x9')]=ChatMessageEvents; \ No newline at end of file +var _0xc03a=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xc03a,0x1ee));var _0xac03=function(_0x212f66,_0x15f43d){_0x212f66=_0x212f66-0x0;var _0x54938e=_0xc03a[_0x212f66];return _0x54938e;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0xac03('0x0'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xac03('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xac03('0x2'),'afterDestroy':_0xac03('0x3')};function emitEvent(_0x5680a3){return function(_0x2e9d57,_0x3c3168,_0x245f8a){ChatMessageEvents[_0xac03('0x4')](_0x5680a3+':'+_0x2e9d57['id'],_0x2e9d57);ChatMessageEvents[_0xac03('0x4')](_0x5680a3,_0x2e9d57);_0x245f8a(null);};}for(var e in events){if(events[_0xac03('0x5')](e)){var event=events[e];ChatMessage[_0xac03('0x6')](e,emitEvent(event));}}module[_0xac03('0x7')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 33c8bfc..48f54c2 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 _0x945f=['rimraf','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','UserId','ChatInteraction','createdAt','error','utf8mb4','lodash','api','moment','path'];(function(_0x55d8aa,_0x3403c5){var _0x3ad990=function(_0xf19585){while(--_0xf19585){_0x55d8aa['push'](_0x55d8aa['shift']());}};_0x3ad990(++_0x3403c5);}(_0x945f,0x6f));var _0xf945=function(_0x55e7f9,_0x239568){_0x55e7f9=_0x55e7f9-0x0;var _0x48143c=_0x945f[_0x55e7f9];return _0x48143c;};'use strict';var _=require(_0xf945('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf945('0x1'));var moment=require(_0xf945('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf945('0x3'));var rimraf=require(_0xf945('0x4'));var config=require('../../config/environment');var attributes=require(_0xf945('0x5'));module[_0xf945('0x6')]=function(_0x4bcb2d,_0x254708){return _0x4bcb2d[_0xf945('0x7')](_0xf945('0x8'),attributes,{'tableName':_0xf945('0x9'),'paranoid':![],'indexes':[{'name':_0xf945('0xa'),'fields':[_0xf945('0xb')],'type':_0xf945('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1264aa,_0x46145a,_0x10c800){var _0xf1be1f=_0x4bcb2d['models'];var _0x3de729=_0x1264aa[_0xf945('0xd')]({'plain':!![]});if(_0x3de729[_0xf945('0xe')]['toLowerCase']()==='in'||_0x3de729[_0xf945('0xe')][_0xf945('0xf')]()===_0xf945('0x10')&&!_0x3de729[_0xf945('0x11')]&&!_['isNil'](_0x3de729[_0xf945('0x12')])){_0xf1be1f[_0xf945('0x13')]['findOne']({'where':{'id':_0x3de729['ChatInteractionId']}})['then'](function(_0x2e045d){if(_0x2e045d){_0x2e045d['update']({'lastMsgAt':_0x3de729[_0xf945('0x14')],'lastMsgDirection':_0x3de729['direction'][_0xf945('0xf')]()});}})['catch'](function(_0x20bf00){console[_0xf945('0x15')](_0x20bf00);});}_0x10c800();}},'charset':_0xf945('0x16'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xab90=['chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','update','catch','error','utf8mb4','util','../../config/logger','moment','bluebird','path','../../config/environment','exports','ChatMessage'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0xab90,0xb5));var _0x0ab9=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xab90[_0x2d2c16];return _0x53f2fb;};'use strict';var _=require('lodash');var util=require(_0x0ab9('0x0'));var logger=require(_0x0ab9('0x1'))('api');var moment=require(_0x0ab9('0x2'));var BPromise=require(_0x0ab9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0ab9('0x4'));var rimraf=require('rimraf');var config=require(_0x0ab9('0x5'));var attributes=require('./chatMessage.attributes');module[_0x0ab9('0x6')]=function(_0x5cfec7,_0x91b7d4){return _0x5cfec7['define'](_0x0ab9('0x7'),attributes,{'tableName':_0x0ab9('0x8'),'paranoid':![],'indexes':[{'name':_0x0ab9('0x9'),'fields':[_0x0ab9('0xa')],'type':_0x0ab9('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x465097,_0x1988ee,_0x3b520c){var _0x6a71a2=_0x5cfec7[_0x0ab9('0xc')];var _0x4528cf=_0x465097[_0x0ab9('0xd')]({'plain':!![]});if(_0x4528cf[_0x0ab9('0xe')][_0x0ab9('0xf')]()==='in'||_0x4528cf[_0x0ab9('0xe')]['toLowerCase']()===_0x0ab9('0x10')&&!_0x4528cf[_0x0ab9('0x11')]&&!_[_0x0ab9('0x12')](_0x4528cf[_0x0ab9('0x13')])){_0x6a71a2[_0x0ab9('0x14')][_0x0ab9('0x15')]({'where':{'id':_0x4528cf[_0x0ab9('0x16')]}})['then'](function(_0xaae4d9){if(_0xaae4d9){_0xaae4d9[_0x0ab9('0x17')]({'lastMsgAt':_0x4528cf['createdAt'],'lastMsgDirection':_0x4528cf[_0x0ab9('0xe')][_0x0ab9('0xf')]()});}})[_0x0ab9('0x18')](function(_0x4231e0){console[_0x0ab9('0x19')](_0x4231e0);});}_0x3b520c();}},'charset':_0x0ab9('0x1a'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 446607d..ab9290b 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 _0x8feb=['request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','CreateChatMessage','ChatMessage','create','body','options','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','register','request','then','ChatMessage,\x20%s,\x20%s'];(function(_0x43b22b,_0xea722c){var _0xd4e124=function(_0x271814){while(--_0x271814){_0x43b22b['push'](_0x43b22b['shift']());}};_0xd4e124(++_0xea722c);}(_0x8feb,0xa9));var _0xb8fe=function(_0x4b2b43,_0x2fb809){_0x4b2b43=_0x4b2b43-0x0;var _0x4602cc=_0x8feb[_0x4b2b43];return _0x4602cc;};'use strict';var _=require(_0xb8fe('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb8fe('0x1'));var rs=require(_0xb8fe('0x2'));var fs=require('fs');var Redis=require(_0xb8fe('0x3'));var db=require(_0xb8fe('0x4'))['db'];var utils=require(_0xb8fe('0x5'));var logger=require(_0xb8fe('0x6'))(_0xb8fe('0x7'));var config=require('../../config/environment');var jayson=require(_0xb8fe('0x8'));var client=jayson[_0xb8fe('0x9')][_0xb8fe('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0xb8fe('0xb')],{'host':_0xb8fe('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatMessage.socket')[_0xb8fe('0xd')](socket);function respondWithRpcPromise(_0x1142cf,_0x566d80,_0x2c08f4){return new BPromise(function(_0x5df424,_0x4b9260){return client[_0xb8fe('0xe')](_0x1142cf,_0x2c08f4)[_0xb8fe('0xf')](function(_0x4fcf0a){logger['info'](_0xb8fe('0x10'),_0x566d80,_0xb8fe('0x11'));logger[_0xb8fe('0x12')](_0xb8fe('0x13'),_0x566d80,_0xb8fe('0x11'),JSON[_0xb8fe('0x14')](_0x4fcf0a));if(_0x4fcf0a[_0xb8fe('0x15')]){if(_0x4fcf0a[_0xb8fe('0x15')]['code']===0x1f4){logger['error'](_0xb8fe('0x10'),_0x566d80,_0x4fcf0a['error']['message']);return _0x4b9260(_0x4fcf0a[_0xb8fe('0x15')]['message']);}logger[_0xb8fe('0x15')](_0xb8fe('0x10'),_0x566d80,_0x4fcf0a[_0xb8fe('0x15')][_0xb8fe('0x16')]);return _0x5df424(_0x4fcf0a[_0xb8fe('0x15')][_0xb8fe('0x16')]);}else{logger[_0xb8fe('0x17')](_0xb8fe('0x10'),_0x566d80,'request\x20sent');_0x5df424(_0x4fcf0a[_0xb8fe('0x18')]['message']);}})['catch'](function(_0x42fbc5){logger[_0xb8fe('0x15')](_0xb8fe('0x10'),_0x566d80,_0x42fbc5);_0x4b9260(_0x42fbc5);});});}exports[_0xb8fe('0x19')]=function(_0x220360){var _0x252355=this;return new Promise(function(_0x329601,_0x208db1){return db[_0xb8fe('0x1a')][_0xb8fe('0x1b')](_0x220360[_0xb8fe('0x1c')],{'raw':_0x220360[_0xb8fe('0x1d')]?_0x220360[_0xb8fe('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0xb8fe('0xf')](function(_0x580bdc){logger[_0xb8fe('0x17')]('CreateChatMessage',_0x220360);logger[_0xb8fe('0x12')](_0xb8fe('0x19'),_0x220360,JSON['stringify'](_0x580bdc));_0x329601(_0x580bdc);})[_0xb8fe('0x1e')](function(_0x258057){logger[_0xb8fe('0x15')](_0xb8fe('0x19'),_0x258057[_0xb8fe('0x16')],_0x220360);_0x208db1(_0x252355['error'](0x1f4,_0x258057[_0xb8fe('0x16')]));});});}; \ No newline at end of file +var _0x78c6=['request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateChatMessage','ChatMessage','create','body','options','raw','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./chatMessage.socket'];(function(_0x29f548,_0x267713){var _0x5c394f=function(_0x297d7d){while(--_0x297d7d){_0x29f548['push'](_0x29f548['shift']());}};_0x5c394f(++_0x267713);}(_0x78c6,0x168));var _0x678c=function(_0x265d48,_0x207343){_0x265d48=_0x265d48-0x0;var _0x94361d=_0x78c6[_0x265d48];return _0x94361d;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x678c('0x0'));var rs=require(_0x678c('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x678c('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x678c('0x3'))(_0x678c('0x4'));var config=require(_0x678c('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x678c('0x6')][_0x678c('0x7')]({'port':0x232a});config[_0x678c('0x8')]=_[_0x678c('0x9')](config[_0x678c('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x678c('0xa'))(new Redis(config[_0x678c('0x8')]));require(_0x678c('0xb'))['register'](socket);function respondWithRpcPromise(_0x520e76,_0x3f1555,_0x58d555){return new BPromise(function(_0x217eda,_0x26f247){return client[_0x678c('0xc')](_0x520e76,_0x58d555)[_0x678c('0xd')](function(_0x30c0ec){logger['info'](_0x678c('0xe'),_0x3f1555,_0x678c('0xf'));logger[_0x678c('0x10')](_0x678c('0x11'),_0x3f1555,_0x678c('0xf'),JSON[_0x678c('0x12')](_0x30c0ec));if(_0x30c0ec[_0x678c('0x13')]){if(_0x30c0ec[_0x678c('0x13')][_0x678c('0x14')]===0x1f4){logger['error'](_0x678c('0xe'),_0x3f1555,_0x30c0ec[_0x678c('0x13')][_0x678c('0x15')]);return _0x26f247(_0x30c0ec[_0x678c('0x13')][_0x678c('0x15')]);}logger[_0x678c('0x13')](_0x678c('0xe'),_0x3f1555,_0x30c0ec[_0x678c('0x13')][_0x678c('0x15')]);return _0x217eda(_0x30c0ec[_0x678c('0x13')]['message']);}else{logger[_0x678c('0x16')](_0x678c('0xe'),_0x3f1555,_0x678c('0xf'));_0x217eda(_0x30c0ec[_0x678c('0x17')][_0x678c('0x15')]);}})[_0x678c('0x18')](function(_0x42e93b){logger[_0x678c('0x13')]('ChatMessage,\x20%s,\x20%s',_0x3f1555,_0x42e93b);_0x26f247(_0x42e93b);});});}exports[_0x678c('0x19')]=function(_0x698244){var _0xeb152c=this;return new Promise(function(_0x23c6ba,_0x1407be){return db[_0x678c('0x1a')][_0x678c('0x1b')](_0x698244[_0x678c('0x1c')],{'raw':_0x698244[_0x678c('0x1d')]?_0x698244[_0x678c('0x1d')][_0x678c('0x1e')]===undefined?!![]:![]:!![]})[_0x678c('0xd')](function(_0x5c3f9b){logger[_0x678c('0x16')](_0x678c('0x19'),_0x698244);logger[_0x678c('0x10')]('CreateChatMessage',_0x698244,JSON[_0x678c('0x12')](_0x5c3f9b));_0x23c6ba(_0x5c3f9b);})[_0x678c('0x18')](function(_0x18225f){logger[_0x678c('0x13')](_0x678c('0x19'),_0x18225f[_0x678c('0x15')],_0x698244);_0x1407be(_0xeb152c['error'](0x1f4,_0x18225f[_0x678c('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index fc58913..08e665c 100644 --- a/server/api/chatMessage/chatMessage.socket.js +++ b/server/api/chatMessage/chatMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x78d3=['removeListener','register','chatMessage:','./chatMessage.events','save','remove','update','emit'];(function(_0x2d7a93,_0x248393){var _0x326d7b=function(_0x5128a4){while(--_0x5128a4){_0x2d7a93['push'](_0x2d7a93['shift']());}};_0x326d7b(++_0x248393);}(_0x78d3,0x73));var _0x378d=function(_0x405cf1,_0x3a34cf){_0x405cf1=_0x405cf1-0x0;var _0x34184c=_0x78d3[_0x405cf1];return _0x34184c;};'use strict';var ChatMessageEvents=require(_0x378d('0x0'));var events=[_0x378d('0x1'),_0x378d('0x2'),_0x378d('0x3')];function createListener(_0x40323e,_0x1d87b8){return function(_0x367f93){_0x1d87b8[_0x378d('0x4')](_0x40323e,_0x367f93);};}function removeListener(_0x52f934,_0x32a62f){return function(){ChatMessageEvents[_0x378d('0x5')](_0x52f934,_0x32a62f);};}exports[_0x378d('0x6')]=function(_0xc18c0b){for(var _0x59117c=0x0,_0x47a99f=events['length'];_0x59117c<_0x47a99f;_0x59117c++){var _0x1c880e=events[_0x59117c];var _0x4b3ef5=createListener(_0x378d('0x7')+_0x1c880e,_0xc18c0b);ChatMessageEvents['on'](_0x1c880e,_0x4b3ef5);}}; \ No newline at end of file +var _0x3248=['save','emit','register','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3248,0x1bc));var _0x8324=function(_0x4056fc,_0x4cb52c){_0x4056fc=_0x4056fc-0x0;var _0x38a488=_0x3248[_0x4056fc];return _0x38a488;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0x8324('0x0'),'remove','update'];function createListener(_0x1daa25,_0xf7c3f5){return function(_0x257d13){_0xf7c3f5[_0x8324('0x1')](_0x1daa25,_0x257d13);};}function removeListener(_0x2cfce9,_0x334505){return function(){ChatMessageEvents['removeListener'](_0x2cfce9,_0x334505);};}exports[_0x8324('0x2')]=function(_0x1c5c2a){for(var _0x5157f4=0x0,_0x25ee7a=events[_0x8324('0x3')];_0x5157f4<_0x25ee7a;_0x5157f4++){var _0x4302c5=events[_0x5157f4];var _0x1514c0=createListener('chatMessage:'+_0x4302c5,_0x1c5c2a);ChatMessageEvents['on'](_0x4302c5,_0x1514c0);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index bbc676b..e6abdbb 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 _0x9eb6=['post','chat','create','put','/:id','update','accept','/:id/reject','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/describe','describe','show'];(function(_0x52c528,_0x46698f){var _0x5ba344=function(_0x4104ef){while(--_0x4104ef){_0x52c528['push'](_0x52c528['shift']());}};_0x5ba344(++_0x46698f);}(_0x9eb6,0x17a));var _0x69eb=function(_0x4c6d6f,_0x291557){_0x4c6d6f=_0x4c6d6f-0x0;var _0x2d4478=_0x9eb6[_0x4c6d6f];return _0x2d4478;};'use strict';var multer=require(_0x69eb('0x0'));var util=require(_0x69eb('0x1'));var path=require(_0x69eb('0x2'));var timeout=require('connect-timeout');var express=require(_0x69eb('0x3'));var router=express[_0x69eb('0x4')]();var fs_extra=require(_0x69eb('0x5'));var auth=require(_0x69eb('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatMessage.controller');router[_0x69eb('0x7')]('/',auth[_0x69eb('0x8')](),controller[_0x69eb('0x9')]);router[_0x69eb('0x7')](_0x69eb('0xa'),auth['isAuthenticated'](),controller[_0x69eb('0xb')]);router[_0x69eb('0x7')]('/:id',auth[_0x69eb('0x8')](),controller[_0x69eb('0xc')]);router[_0x69eb('0xd')]('/',auth[_0x69eb('0x8')](),interaction['tracked'](_0x69eb('0xe'),'chatmessage:create'),controller[_0x69eb('0xf')]);router[_0x69eb('0x10')](_0x69eb('0x11'),controller[_0x69eb('0x12')]);router[_0x69eb('0x10')]('/:id/accept',auth[_0x69eb('0x8')](),controller[_0x69eb('0x13')]);router['put'](_0x69eb('0x14'),auth[_0x69eb('0x8')](),controller['reject']);router[_0x69eb('0x15')](_0x69eb('0x11'),auth[_0x69eb('0x8')](),controller[_0x69eb('0x16')]);module['exports']=router; \ No newline at end of file +var _0xb51f=['/:id/accept','put','reject','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','tracked','chat','chatmessage:create','create','update'];(function(_0xfc406a,_0x4479e1){var _0x395473=function(_0x1fe8b6){while(--_0x1fe8b6){_0xfc406a['push'](_0xfc406a['shift']());}};_0x395473(++_0x4479e1);}(_0xb51f,0x155));var _0xfb51=function(_0x277fa3,_0x3b2dde){_0x277fa3=_0x277fa3-0x0;var _0x2e4520=_0xb51f[_0x277fa3];return _0x2e4520;};'use strict';var multer=require(_0xfb51('0x0'));var util=require(_0xfb51('0x1'));var path=require(_0xfb51('0x2'));var timeout=require(_0xfb51('0x3'));var express=require('express');var router=express[_0xfb51('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xfb51('0x5'));var interaction=require(_0xfb51('0x6'));var config=require(_0xfb51('0x7'));var controller=require('./chatMessage.controller');router[_0xfb51('0x8')]('/',auth[_0xfb51('0x9')](),controller[_0xfb51('0xa')]);router[_0xfb51('0x8')](_0xfb51('0xb'),auth[_0xfb51('0x9')](),controller[_0xfb51('0xc')]);router[_0xfb51('0x8')](_0xfb51('0xd'),auth[_0xfb51('0x9')](),controller['show']);router['post']('/',auth[_0xfb51('0x9')](),interaction[_0xfb51('0xe')](_0xfb51('0xf'),_0xfb51('0x10')),controller[_0xfb51('0x11')]);router['put'](_0xfb51('0xd'),controller[_0xfb51('0x12')]);router['put'](_0xfb51('0x13'),auth[_0xfb51('0x9')](),controller['accept']);router[_0xfb51('0x14')]('/:id/reject',auth[_0xfb51('0x9')](),controller[_0xfb51('0x15')]);router[_0xfb51('0x16')](_0xfb51('0xd'),auth[_0xfb51('0x9')](),controller['destroy']);module[_0xfb51('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 60ff73f..cd50878 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 _0xb497=['medium','sequelize'];(function(_0x341f55,_0x50862f){var _0x4057f3=function(_0x180545){while(--_0x180545){_0x341f55['push'](_0x341f55['shift']());}};_0x4057f3(++_0x50862f);}(_0xb497,0x9f));var _0x7b49=function(_0x245cf0,_0x4a36cf){_0x245cf0=_0x245cf0-0x0;var _0x4046ff=_0xb497[_0x245cf0];return _0x4046ff;};'use strict';var Sequelize=require(_0x7b49('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x7b49('0x1')),'allowNull':![]}}; \ No newline at end of file +var _0xc94f=['medium','sequelize','TEXT'];(function(_0x307d86,_0x9264f2){var _0x361745=function(_0x1b64e1){while(--_0x1b64e1){_0x307d86['push'](_0x307d86['shift']());}};_0x361745(++_0x9264f2);}(_0xc94f,0xcd));var _0xfc94=function(_0xd7d92b,_0x162a88){_0xd7d92b=_0xd7d92b-0x0;var _0x42856d=_0xc94f[_0xd7d92b];return _0x42856d;};'use strict';var Sequelize=require(_0xfc94('0x0'));module['exports']={'body':{'type':Sequelize[_0xfc94('0x1')](_0xfc94('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 ae3331c..33f9343 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 _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x33e1e4,_0x2a13d7){var _0x3b5eb3=function(_0x494df2){while(--_0x494df2){_0x33e1e4['push'](_0x33e1e4['shift']());}};_0x3b5eb3(++_0x2a13d7);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file +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(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0x7a54,0x106));var _0x47a5=function(_0x18532a,_0x11386d){_0x18532a=_0x18532a-0x0;var _0x365abb=_0x7a54[_0x18532a];return _0x365abb;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index d2bd96d..a3caaa6 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 _0xff3e=['./chatOfflineMessage.attributes','exports','define','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x3f0fc2,_0x58cd80){var _0x2bd742=function(_0x4d18ed){while(--_0x4d18ed){_0x3f0fc2['push'](_0x3f0fc2['shift']());}};_0x2bd742(++_0x58cd80);}(_0xff3e,0xf5));var _0xeff3=function(_0x376d19,_0xeaa649){_0x376d19=_0x376d19-0x0;var _0x1a2624=_0xff3e[_0x376d19];return _0x1a2624;};'use strict';var _=require('lodash');var util=require(_0xeff3('0x0'));var logger=require(_0xeff3('0x1'))('api');var moment=require(_0xeff3('0x2'));var BPromise=require(_0xeff3('0x3'));var rp=require(_0xeff3('0x4'));var fs=require('fs');var path=require(_0xeff3('0x5'));var rimraf=require('rimraf');var config=require(_0xeff3('0x6'));var attributes=require(_0xeff3('0x7'));module[_0xeff3('0x8')]=function(_0x40560d,_0x4691d7){return _0x40560d[_0xeff3('0x9')]('ChatOfflineMessage',attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xeff3('0xa'),'collate':_0xeff3('0xb')});}; \ No newline at end of file +var _0xf9b9=['moment','path','rimraf','../../config/environment','define','ChatOfflineMessage','chat_offline_messages','lodash','util','../../config/logger','api'];(function(_0x5f1c91,_0x34436a){var _0x585310=function(_0x5ec6c4){while(--_0x5ec6c4){_0x5f1c91['push'](_0x5f1c91['shift']());}};_0x585310(++_0x34436a);}(_0xf9b9,0x1d5));var _0x9f9b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf9b9[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x9f9b('0x0'));var util=require(_0x9f9b('0x1'));var logger=require(_0x9f9b('0x2'))(_0x9f9b('0x3'));var moment=require(_0x9f9b('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9f9b('0x5'));var rimraf=require(_0x9f9b('0x6'));var config=require(_0x9f9b('0x7'));var attributes=require('./chatOfflineMessage.attributes');module['exports']=function(_0x22efd3,_0x5d827f){return _0x22efd3[_0x9f9b('0x8')](_0x9f9b('0x9'),attributes,{'tableName':_0x9f9b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 8747822..a0142ae 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 _0x1bfb=['error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x1bfb,0x190));var _0xb1bf=function(_0x10d34b,_0x4fef76){_0x10d34b=_0x10d34b-0x0;var _0x92b0bf=_0x1bfb[_0x10d34b];return _0x92b0bf;};'use strict';var _=require(_0xb1bf('0x0'));var util=require(_0xb1bf('0x1'));var moment=require(_0xb1bf('0x2'));var BPromise=require(_0xb1bf('0x3'));var rs=require(_0xb1bf('0x4'));var fs=require('fs');var Redis=require(_0xb1bf('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb1bf('0x6'));var logger=require(_0xb1bf('0x7'))(_0xb1bf('0x8'));var config=require('../../config/environment');var jayson=require(_0xb1bf('0x9'));var client=jayson['client'][_0xb1bf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x377b04,_0x2df49a,_0x46eae){return new BPromise(function(_0x4b5195,_0x1af548){return client['request'](_0x377b04,_0x46eae)[_0xb1bf('0xb')](function(_0x723470){logger[_0xb1bf('0xc')](_0xb1bf('0xd'),_0x2df49a,_0xb1bf('0xe'));logger[_0xb1bf('0xf')](_0xb1bf('0x10'),_0x2df49a,_0xb1bf('0xe'),JSON[_0xb1bf('0x11')](_0x723470));if(_0x723470[_0xb1bf('0x12')]){if(_0x723470[_0xb1bf('0x12')][_0xb1bf('0x13')]===0x1f4){logger[_0xb1bf('0x12')]('ChatOfflineMessage,\x20%s,\x20%s',_0x2df49a,_0x723470[_0xb1bf('0x12')]['message']);return _0x1af548(_0x723470['error'][_0xb1bf('0x14')]);}logger[_0xb1bf('0x12')](_0xb1bf('0xd'),_0x2df49a,_0x723470['error'][_0xb1bf('0x14')]);return _0x4b5195(_0x723470[_0xb1bf('0x12')][_0xb1bf('0x14')]);}else{logger[_0xb1bf('0xc')](_0xb1bf('0xd'),_0x2df49a,'request\x20sent');_0x4b5195(_0x723470[_0xb1bf('0x15')][_0xb1bf('0x14')]);}})['catch'](function(_0x3ff36f){logger[_0xb1bf('0x12')](_0xb1bf('0xd'),_0x2df49a,_0x3ff36f);_0x1af548(_0x3ff36f);});});} \ No newline at end of file +var _0x45c9=['message','info','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','ChatOfflineMessage,\x20%s,\x20%s','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0xd69ddd,_0x4ee97d){var _0x4e5410=function(_0x58dd1b){while(--_0x58dd1b){_0xd69ddd['push'](_0xd69ddd['shift']());}};_0x4e5410(++_0x4ee97d);}(_0x45c9,0x96));var _0x945c=function(_0x158059,_0x1474c9){_0x158059=_0x158059-0x0;var _0x992c76=_0x45c9[_0x158059];return _0x992c76;};'use strict';var _=require('lodash');var util=require(_0x945c('0x0'));var moment=require('moment');var BPromise=require(_0x945c('0x1'));var rs=require(_0x945c('0x2'));var fs=require('fs');var Redis=require(_0x945c('0x3'));var db=require(_0x945c('0x4'))['db'];var utils=require(_0x945c('0x5'));var logger=require('../../config/logger')(_0x945c('0x6'));var config=require('../../config/environment');var jayson=require(_0x945c('0x7'));var client=jayson[_0x945c('0x8')][_0x945c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c5c07,_0x265b02,_0x9a988b){return new BPromise(function(_0x4253bf,_0x56c700){return client[_0x945c('0xa')](_0x3c5c07,_0x9a988b)['then'](function(_0x439b59){logger['info'](_0x945c('0xb'),_0x265b02,'request\x20sent');logger[_0x945c('0xc')](_0x945c('0xd'),_0x265b02,_0x945c('0xe'),JSON[_0x945c('0xf')](_0x439b59));if(_0x439b59[_0x945c('0x10')]){if(_0x439b59[_0x945c('0x10')][_0x945c('0x11')]===0x1f4){logger[_0x945c('0x10')](_0x945c('0xb'),_0x265b02,_0x439b59[_0x945c('0x10')][_0x945c('0x12')]);return _0x56c700(_0x439b59[_0x945c('0x10')][_0x945c('0x12')]);}logger[_0x945c('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0x265b02,_0x439b59[_0x945c('0x10')][_0x945c('0x12')]);return _0x4253bf(_0x439b59[_0x945c('0x10')][_0x945c('0x12')]);}else{logger[_0x945c('0x13')](_0x945c('0xb'),_0x265b02,_0x945c('0xe'));_0x4253bf(_0x439b59['result'][_0x945c('0x12')]);}})[_0x945c('0x14')](function(_0x3bfb01){logger['error'](_0x945c('0xb'),_0x265b02,_0x3bfb01);_0x56c700(_0x3bfb01);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 7ea8b50..412652a 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 _0x54d2=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','/describe','describe','show','post','isAuthenticated','create','put','/:id','update','delete','destroy','exports','multer','util','path'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x54d2,0xe3));var _0x254d=function(_0x367905,_0x325a4d){_0x367905=_0x367905-0x0;var _0xa2a385=_0x54d2[_0x367905];return _0xa2a385;};'use strict';var multer=require(_0x254d('0x0'));var util=require(_0x254d('0x1'));var path=require(_0x254d('0x2'));var timeout=require(_0x254d('0x3'));var express=require(_0x254d('0x4'));var router=express['Router']();var fs_extra=require(_0x254d('0x5'));var auth=require(_0x254d('0x6'));var interaction=require(_0x254d('0x7'));var config=require(_0x254d('0x8'));var controller=require(_0x254d('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x254d('0xa')](_0x254d('0xb'),auth['isAuthenticated'](),controller[_0x254d('0xc')]);router[_0x254d('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x254d('0xd')]);router[_0x254d('0xe')]('/',auth[_0x254d('0xf')](),controller[_0x254d('0x10')]);router[_0x254d('0x11')](_0x254d('0x12'),auth[_0x254d('0xf')](),controller[_0x254d('0x13')]);router[_0x254d('0x14')](_0x254d('0x12'),auth['isAuthenticated'](),controller[_0x254d('0x15')]);module[_0x254d('0x16')]=router; \ No newline at end of file +var _0x43d5=['/:id','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','index','get','/describe','isAuthenticated','describe','post','create','put','update','delete'];(function(_0x276d03,_0x2b8ece){var _0x578e0b=function(_0x48fb8a){while(--_0x48fb8a){_0x276d03['push'](_0x276d03['shift']());}};_0x578e0b(++_0x2b8ece);}(_0x43d5,0xdf));var _0x543d=function(_0x50c527,_0x2d4458){_0x50c527=_0x50c527-0x0;var _0x2c7c15=_0x43d5[_0x50c527];return _0x2c7c15;};'use strict';var multer=require(_0x543d('0x0'));var util=require(_0x543d('0x1'));var path=require('path');var timeout=require(_0x543d('0x2'));var express=require(_0x543d('0x3'));var router=express[_0x543d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x543d('0x5'));var interaction=require(_0x543d('0x6'));var config=require(_0x543d('0x7'));var controller=require(_0x543d('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x543d('0x9')]);router[_0x543d('0xa')](_0x543d('0xb'),auth[_0x543d('0xc')](),controller[_0x543d('0xd')]);router[_0x543d('0xa')]('/:id',auth[_0x543d('0xc')](),controller['show']);router[_0x543d('0xe')]('/',auth[_0x543d('0xc')](),controller[_0x543d('0xf')]);router[_0x543d('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x543d('0x11')]);router[_0x543d('0x12')](_0x543d('0x13'),auth['isAuthenticated'](),controller[_0x543d('0x14')]);module[_0x543d('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index ea8b8cd..b473cb7 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 _0x6101=['STRING','ENUM','mouseOver','INTEGER','exports'];(function(_0x31c7fc,_0x11de6a){var _0x3c568e=function(_0xb9c0ed){while(--_0xb9c0ed){_0x31c7fc['push'](_0x31c7fc['shift']());}};_0x3c568e(++_0x11de6a);}(_0x6101,0x7c));var _0x1610=function(_0x27ecb2,_0x55c9b5){_0x27ecb2=_0x27ecb2-0x0;var _0x347f58=_0x6101[_0x27ecb2];return _0x347f58;};'use strict';var Sequelize=require('sequelize');module[_0x1610('0x0')]={'name':{'type':Sequelize[_0x1610('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1610('0x2')](_0x1610('0x3'),'timeout'),'defaultValue':_0x1610('0x3')},'selector':{'type':Sequelize[_0x1610('0x1')]},'timeout':{'type':Sequelize[_0x1610('0x4')]}}; \ No newline at end of file +var _0x9b70=['STRING','ENUM','timeout','mouseOver','INTEGER','sequelize','exports'];(function(_0x1183a9,_0x1c1b0b){var _0x5e6983=function(_0x2ee5a5){while(--_0x2ee5a5){_0x1183a9['push'](_0x1183a9['shift']());}};_0x5e6983(++_0x1c1b0b);}(_0x9b70,0x16a));var _0x09b7=function(_0x2a0527,_0x2fc13f){_0x2a0527=_0x2a0527-0x0;var _0x1f4163=_0x9b70[_0x2a0527];return _0x1f4163;};'use strict';var Sequelize=require(_0x09b7('0x0'));module[_0x09b7('0x1')]={'name':{'type':Sequelize[_0x09b7('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x09b7('0x3')]('mouseOver',_0x09b7('0x4')),'defaultValue':_0x09b7('0x5')},'selector':{'type':Sequelize[_0x09b7('0x2')]},'timeout':{'type':Sequelize[_0x09b7('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 220aa91..a03cbfb 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 _0x0c02=['sendStatus','name','show','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','fields','includeAll','include','options','catch','create','body','find','params','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x126321,_0x263992){var _0x3febf7=function(_0x92cb00){while(--_0x92cb00){_0x126321['push'](_0x126321['shift']());}};_0x3febf7(++_0x263992);}(_0x0c02,0x84));var _0x20c0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c02[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x20c0('0x0'));var zipdir=require(_0x20c0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x20c0('0x2'));var moment=require(_0x20c0('0x3'));var BPromise=require(_0x20c0('0x4'));var Mustache=require(_0x20c0('0x5'));var util=require(_0x20c0('0x6'));var path=require(_0x20c0('0x7'));var sox=require(_0x20c0('0x8'));var csv=require(_0x20c0('0x9'));var ejs=require(_0x20c0('0xa'));var fs=require('fs');var fs_extra=require(_0x20c0('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x20c0('0xc'));var toCsv=require(_0x20c0('0x9'));var querystring=require(_0x20c0('0xd'));var Papa=require(_0x20c0('0xe'));var Redis=require(_0x20c0('0xf'));var authService=require(_0x20c0('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x20c0('0x11'));var config=require(_0x20c0('0x12'));var licenseUtil=require(_0x20c0('0x13'));var db=require(_0x20c0('0x14'))['db'];function respondWithStatusCode(_0x4ed79e,_0x56fa09){_0x56fa09=_0x56fa09||0xcc;return function(_0x55854e){if(_0x55854e){return _0x4ed79e['sendStatus'](_0x56fa09);}return _0x4ed79e[_0x20c0('0x15')](_0x56fa09)[_0x20c0('0x16')]();};}function respondWithResult(_0x42161f,_0x3b2bba){_0x3b2bba=_0x3b2bba||0xc8;return function(_0x37f4e0){if(_0x37f4e0){return _0x42161f[_0x20c0('0x15')](_0x3b2bba)[_0x20c0('0x17')](_0x37f4e0);}};}function respondWithFilteredResult(_0x105839,_0x280aff){return function(_0x5a5e25){if(_0x5a5e25){var _0xd80b64=typeof _0x280aff[_0x20c0('0x18')]===_0x20c0('0x19')&&typeof _0x280aff[_0x20c0('0x1a')]===_0x20c0('0x19');var _0xeff5b9=_0x5a5e25['count'];var _0x55de3b=_0xd80b64?0x0:_0x280aff['offset'];var _0x10a921=_0xd80b64?_0x5a5e25[_0x20c0('0x1b')]:_0x280aff[_0x20c0('0x18')]+_0x280aff[_0x20c0('0x1a')];var _0x5b3725;if(_0x10a921>=_0xeff5b9){_0x10a921=_0xeff5b9;_0x5b3725=0xc8;}else{_0x5b3725=0xce;}_0x105839[_0x20c0('0x15')](_0x5b3725);return _0x105839[_0x20c0('0x1c')](_0x20c0('0x1d'),_0x55de3b+'-'+_0x10a921+'/'+_0xeff5b9)['json'](_0x5a5e25);}return null;};}function patchUpdates(_0x54bd1e){return function(_0x343db7){try{jsonpatch[_0x20c0('0x1e')](_0x343db7,_0x54bd1e,!![]);}catch(_0x1407d3){return BPromise[_0x20c0('0x1f')](_0x1407d3);}return _0x343db7[_0x20c0('0x20')]();};}function saveUpdates(_0x53d8e8,_0x2213f5){return function(_0x28959a){if(_0x28959a){return _0x28959a[_0x20c0('0x21')](_0x53d8e8)[_0x20c0('0x22')](function(_0x52b8b8){return _0x52b8b8;});}return null;};}function removeEntity(_0xfea1eb,_0x3e545c){return function(_0x2447e6){if(_0x2447e6){return _0x2447e6[_0x20c0('0x23')]()[_0x20c0('0x22')](function(){_0xfea1eb[_0x20c0('0x15')](0xcc)[_0x20c0('0x16')]();});}};}function handleEntityNotFound(_0x55b129,_0x45c08c){return function(_0x595d94){if(!_0x595d94){_0x55b129[_0x20c0('0x24')](0x194);}return _0x595d94;};}function handleError(_0x31565b,_0x11da5a){_0x11da5a=_0x11da5a||0x1f4;return function(_0x14dac3){logger['error'](_0x14dac3['stack']);if(_0x14dac3[_0x20c0('0x25')]){delete _0x14dac3[_0x20c0('0x25')];}_0x31565b[_0x20c0('0x15')](_0x11da5a)['send'](_0x14dac3);};}exports[_0x20c0('0x26')]=function(_0x25592b,_0x1bcfaf){var _0x41c743={'raw':!![],'where':{'id':_0x25592b['params']['id']}},_0x4baaed={};_0x4baaed[_0x20c0('0x27')]=_[_0x20c0('0x28')](db[_0x20c0('0x29')][_0x20c0('0x2a')]);_0x4baaed[_0x20c0('0x2b')]=_[_0x20c0('0x28')](_0x25592b[_0x20c0('0x2b')]);_0x4baaed[_0x20c0('0x2c')]=_[_0x20c0('0x2d')](_0x4baaed[_0x20c0('0x27')],_0x4baaed[_0x20c0('0x2b')]);_0x41c743[_0x20c0('0x2e')]=_[_0x20c0('0x2d')](_0x4baaed[_0x20c0('0x27')],qs['fields'](_0x25592b[_0x20c0('0x2b')][_0x20c0('0x2f')]));_0x41c743[_0x20c0('0x2e')]=_0x41c743[_0x20c0('0x2e')]['length']?_0x41c743[_0x20c0('0x2e')]:_0x4baaed[_0x20c0('0x27')];if(_0x25592b[_0x20c0('0x2b')][_0x20c0('0x30')]){_0x41c743[_0x20c0('0x31')]=[{'all':!![]}];}_0x41c743=_['merge']({},_0x41c743,_0x25592b[_0x20c0('0x32')]);return db['ChatProactiveAction']['find'](_0x41c743)[_0x20c0('0x22')](handleEntityNotFound(_0x1bcfaf,null))[_0x20c0('0x22')](respondWithResult(_0x1bcfaf,null))[_0x20c0('0x33')](handleError(_0x1bcfaf,null));};exports[_0x20c0('0x34')]=function(_0x1a4aeb,_0x39fd84){return db[_0x20c0('0x29')]['create'](_0x1a4aeb['body'],{})['then'](respondWithResult(_0x39fd84,0xc9))[_0x20c0('0x33')](handleError(_0x39fd84,null));};exports[_0x20c0('0x21')]=function(_0x545b39,_0x346a04){if(_0x545b39[_0x20c0('0x35')]['id']){delete _0x545b39['body']['id'];}return db['ChatProactiveAction'][_0x20c0('0x36')]({'where':{'id':_0x545b39[_0x20c0('0x37')]['id']}})['then'](handleEntityNotFound(_0x346a04,null))[_0x20c0('0x22')](saveUpdates(_0x545b39['body'],null))[_0x20c0('0x22')](respondWithResult(_0x346a04,null))[_0x20c0('0x33')](handleError(_0x346a04,null));};exports[_0x20c0('0x23')]=function(_0x291e66,_0x5997f5){return db[_0x20c0('0x29')][_0x20c0('0x36')]({'where':{'id':_0x291e66[_0x20c0('0x37')]['id']}})[_0x20c0('0x22')](handleEntityNotFound(_0x5997f5,null))[_0x20c0('0x22')](removeEntity(_0x5997f5,null))[_0x20c0('0x33')](handleError(_0x5997f5,null));}; \ No newline at end of file +var _0x2975=['squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','json','reject','update','then','end','error','stack','name','send','show','params','keys','ChatProactiveAction','rawAttributes','query','intersection','model','attributes','fields','length','include','merge','options','catch','create','body','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash'];(function(_0xea1e6a,_0x5a1bf4){var _0xed4e08=function(_0x20e49a){while(--_0x20e49a){_0xea1e6a['push'](_0xea1e6a['shift']());}};_0xed4e08(++_0x5a1bf4);}(_0x2975,0x1c5));var _0x5297=function(_0x3f8543,_0x4bb213){_0x3f8543=_0x3f8543-0x0;var _0x5bdd19=_0x2975[_0x3f8543];return _0x5bdd19;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5297('0x0'));var zipdir=require(_0x5297('0x1'));var jsonpatch=require(_0x5297('0x2'));var rp=require(_0x5297('0x3'));var moment=require(_0x5297('0x4'));var BPromise=require(_0x5297('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x5297('0x6'));var csv=require(_0x5297('0x7'));var ejs=require(_0x5297('0x8'));var fs=require('fs');var fs_extra=require(_0x5297('0x9'));var _=require(_0x5297('0xa'));var squel=require(_0x5297('0xb'));var crypto=require(_0x5297('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5297('0xd'));var toCsv=require(_0x5297('0x7'));var querystring=require(_0x5297('0xe'));var Papa=require(_0x5297('0xf'));var Redis=require(_0x5297('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5297('0x11'));var as=require(_0x5297('0x12'));var hardwareService=require(_0x5297('0x13'));var logger=require('../../config/logger')(_0x5297('0x14'));var utils=require(_0x5297('0x15'));var config=require(_0x5297('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5297('0x17'))['db'];function respondWithStatusCode(_0x21bef8,_0x491fec){_0x491fec=_0x491fec||0xcc;return function(_0x594191){if(_0x594191){return _0x21bef8[_0x5297('0x18')](_0x491fec);}return _0x21bef8[_0x5297('0x19')](_0x491fec)['end']();};}function respondWithResult(_0x7e3417,_0x5b1a97){_0x5b1a97=_0x5b1a97||0xc8;return function(_0x253b83){if(_0x253b83){return _0x7e3417[_0x5297('0x19')](_0x5b1a97)['json'](_0x253b83);}};}function respondWithFilteredResult(_0x96304b,_0x1e5499){return function(_0x15e2e1){if(_0x15e2e1){var _0x40afca=typeof _0x1e5499[_0x5297('0x1a')]===_0x5297('0x1b')&&typeof _0x1e5499[_0x5297('0x1c')]===_0x5297('0x1b');var _0x4ae2fe=_0x15e2e1[_0x5297('0x1d')];var _0x136461=_0x40afca?0x0:_0x1e5499[_0x5297('0x1a')];var _0x38f106=_0x40afca?_0x15e2e1['count']:_0x1e5499[_0x5297('0x1a')]+_0x1e5499[_0x5297('0x1c')];var _0x52286c;if(_0x38f106>=_0x4ae2fe){_0x38f106=_0x4ae2fe;_0x52286c=0xc8;}else{_0x52286c=0xce;}_0x96304b[_0x5297('0x19')](_0x52286c);return _0x96304b['set'](_0x5297('0x1e'),_0x136461+'-'+_0x38f106+'/'+_0x4ae2fe)[_0x5297('0x1f')](_0x15e2e1);}return null;};}function patchUpdates(_0x39b675){return function(_0xc33c){try{jsonpatch['apply'](_0xc33c,_0x39b675,!![]);}catch(_0x43e00e){return BPromise[_0x5297('0x20')](_0x43e00e);}return _0xc33c['save']();};}function saveUpdates(_0x38408e,_0x3ebbc5){return function(_0x56fffa){if(_0x56fffa){return _0x56fffa[_0x5297('0x21')](_0x38408e)[_0x5297('0x22')](function(_0x574899){return _0x574899;});}return null;};}function removeEntity(_0x28df2d,_0x31ffc4){return function(_0x2c0f01){if(_0x2c0f01){return _0x2c0f01['destroy']()['then'](function(){_0x28df2d[_0x5297('0x19')](0xcc)[_0x5297('0x23')]();});}};}function handleEntityNotFound(_0x18fe2a,_0x4e1300){return function(_0x2ca4cc){if(!_0x2ca4cc){_0x18fe2a['sendStatus'](0x194);}return _0x2ca4cc;};}function handleError(_0x515a51,_0x28819d){_0x28819d=_0x28819d||0x1f4;return function(_0x373414){logger[_0x5297('0x24')](_0x373414[_0x5297('0x25')]);if(_0x373414['name']){delete _0x373414[_0x5297('0x26')];}_0x515a51[_0x5297('0x19')](_0x28819d)[_0x5297('0x27')](_0x373414);};}exports[_0x5297('0x28')]=function(_0x3826d2,_0x201181){var _0x248348={'raw':!![],'where':{'id':_0x3826d2[_0x5297('0x29')]['id']}},_0x1dee33={};_0x1dee33['model']=_[_0x5297('0x2a')](db[_0x5297('0x2b')][_0x5297('0x2c')]);_0x1dee33['query']=_[_0x5297('0x2a')](_0x3826d2[_0x5297('0x2d')]);_0x1dee33['filters']=_[_0x5297('0x2e')](_0x1dee33[_0x5297('0x2f')],_0x1dee33[_0x5297('0x2d')]);_0x248348[_0x5297('0x30')]=_[_0x5297('0x2e')](_0x1dee33['model'],qs[_0x5297('0x31')](_0x3826d2[_0x5297('0x2d')][_0x5297('0x31')]));_0x248348[_0x5297('0x30')]=_0x248348['attributes'][_0x5297('0x32')]?_0x248348['attributes']:_0x1dee33[_0x5297('0x2f')];if(_0x3826d2[_0x5297('0x2d')]['includeAll']){_0x248348[_0x5297('0x33')]=[{'all':!![]}];}_0x248348=_[_0x5297('0x34')]({},_0x248348,_0x3826d2[_0x5297('0x35')]);return db[_0x5297('0x2b')]['find'](_0x248348)[_0x5297('0x22')](handleEntityNotFound(_0x201181,null))[_0x5297('0x22')](respondWithResult(_0x201181,null))[_0x5297('0x36')](handleError(_0x201181,null));};exports[_0x5297('0x37')]=function(_0x5d546a,_0x276c25){return db[_0x5297('0x2b')][_0x5297('0x37')](_0x5d546a[_0x5297('0x38')],{})[_0x5297('0x22')](respondWithResult(_0x276c25,0xc9))[_0x5297('0x36')](handleError(_0x276c25,null));};exports[_0x5297('0x21')]=function(_0x171ffb,_0x209c21){if(_0x171ffb[_0x5297('0x38')]['id']){delete _0x171ffb['body']['id'];}return db[_0x5297('0x2b')][_0x5297('0x39')]({'where':{'id':_0x171ffb[_0x5297('0x29')]['id']}})[_0x5297('0x22')](handleEntityNotFound(_0x209c21,null))[_0x5297('0x22')](saveUpdates(_0x171ffb[_0x5297('0x38')],null))['then'](respondWithResult(_0x209c21,null))[_0x5297('0x36')](handleError(_0x209c21,null));};exports['destroy']=function(_0x380ba1,_0x3588f0){return db[_0x5297('0x2b')]['find']({'where':{'id':_0x380ba1['params']['id']}})[_0x5297('0x22')](handleEntityNotFound(_0x3588f0,null))[_0x5297('0x22')](removeEntity(_0x3588f0,null))[_0x5297('0x36')](handleError(_0x3588f0,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index f1e48f8..6c968aa 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 _0x7216=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','ChatProactiveAction'];(function(_0x40cd61,_0x36162c){var _0x120ce8=function(_0x59c7cc){while(--_0x59c7cc){_0x40cd61['push'](_0x40cd61['shift']());}};_0x120ce8(++_0x36162c);}(_0x7216,0x11e));var _0x6721=function(_0x47e7c1,_0x290f15){_0x47e7c1=_0x47e7c1-0x0;var _0x4244f7=_0x7216[_0x47e7c1];return _0x4244f7;};'use strict';var _=require(_0x6721('0x0'));var util=require(_0x6721('0x1'));var logger=require(_0x6721('0x2'))(_0x6721('0x3'));var moment=require(_0x6721('0x4'));var BPromise=require('bluebird');var rp=require(_0x6721('0x5'));var fs=require('fs');var path=require(_0x6721('0x6'));var rimraf=require(_0x6721('0x7'));var config=require(_0x6721('0x8'));var attributes=require('./chatProactiveAction.attributes');module[_0x6721('0x9')]=function(_0x2f595d,_0x120202){return _0x2f595d['define'](_0x6721('0xa'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa345=['define','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports'];(function(_0x5d6250,_0xba4c48){var _0x52a098=function(_0x5cda48){while(--_0x5cda48){_0x5d6250['push'](_0x5d6250['shift']());}};_0x52a098(++_0xba4c48);}(_0xa345,0x6c));var _0x5a34=function(_0xb857bd,_0x4c546c){_0xb857bd=_0xb857bd-0x0;var _0x1a8503=_0xa345[_0xb857bd];return _0x1a8503;};'use strict';var _=require(_0x5a34('0x0'));var util=require(_0x5a34('0x1'));var logger=require(_0x5a34('0x2'))(_0x5a34('0x3'));var moment=require(_0x5a34('0x4'));var BPromise=require(_0x5a34('0x5'));var rp=require(_0x5a34('0x6'));var fs=require('fs');var path=require(_0x5a34('0x7'));var rimraf=require(_0x5a34('0x8'));var config=require(_0x5a34('0x9'));var attributes=require(_0x5a34('0xa'));module[_0x5a34('0xb')]=function(_0x19df50,_0x27a173){return _0x19df50[_0x5a34('0xc')](_0x5a34('0xd'),attributes,{'tableName':_0x5a34('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 1439b9e..4dd5eff 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 _0x6a3b=['debug','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent'];(function(_0x4e310c,_0x161a51){var _0x247cf7=function(_0x2e9ad7){while(--_0x2e9ad7){_0x4e310c['push'](_0x4e310c['shift']());}};_0x247cf7(++_0x161a51);}(_0x6a3b,0x1a9));var _0xb6a3=function(_0x49eec3,_0x4c0bdb){_0x49eec3=_0x49eec3-0x0;var _0x44b4c0=_0x6a3b[_0x49eec3];return _0x44b4c0;};'use strict';var _=require(_0xb6a3('0x0'));var util=require(_0xb6a3('0x1'));var moment=require(_0xb6a3('0x2'));var BPromise=require('bluebird');var rs=require(_0xb6a3('0x3'));var fs=require('fs');var Redis=require(_0xb6a3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb6a3('0x5'));var logger=require(_0xb6a3('0x6'))(_0xb6a3('0x7'));var config=require(_0xb6a3('0x8'));var jayson=require(_0xb6a3('0x9'));var client=jayson[_0xb6a3('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11f76d,_0x3e96bf,_0x5128e6){return new BPromise(function(_0x24c372,_0x3f07ba){return client['request'](_0x11f76d,_0x5128e6)[_0xb6a3('0xb')](function(_0x2729cd){logger[_0xb6a3('0xc')](_0xb6a3('0xd'),_0x3e96bf,_0xb6a3('0xe'));logger[_0xb6a3('0xf')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x3e96bf,_0xb6a3('0xe'),JSON[_0xb6a3('0x10')](_0x2729cd));if(_0x2729cd[_0xb6a3('0x11')]){if(_0x2729cd[_0xb6a3('0x11')][_0xb6a3('0x12')]===0x1f4){logger[_0xb6a3('0x11')]('ChatProactiveAction,\x20%s,\x20%s',_0x3e96bf,_0x2729cd['error'][_0xb6a3('0x13')]);return _0x3f07ba(_0x2729cd[_0xb6a3('0x11')][_0xb6a3('0x13')]);}logger[_0xb6a3('0x11')](_0xb6a3('0xd'),_0x3e96bf,_0x2729cd[_0xb6a3('0x11')][_0xb6a3('0x13')]);return _0x24c372(_0x2729cd[_0xb6a3('0x11')][_0xb6a3('0x13')]);}else{logger[_0xb6a3('0xc')](_0xb6a3('0xd'),_0x3e96bf,_0xb6a3('0xe'));_0x24c372(_0x2729cd[_0xb6a3('0x14')][_0xb6a3('0x13')]);}})[_0xb6a3('0x15')](function(_0x520059){logger['error'](_0xb6a3('0xd'),_0x3e96bf,_0x520059);_0x3f07ba(_0x520059);});});} \ No newline at end of file +var _0x53d0=['debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent'];(function(_0x5a46ef,_0x539480){var _0x5b232f=function(_0x2f8b74){while(--_0x2f8b74){_0x5a46ef['push'](_0x5a46ef['shift']());}};_0x5b232f(++_0x539480);}(_0x53d0,0x6c));var _0x053d=function(_0xb03acb,_0x2e9075){_0xb03acb=_0xb03acb-0x0;var _0x2e3fff=_0x53d0[_0xb03acb];return _0x2e3fff;};'use strict';var _=require('lodash');var util=require(_0x053d('0x0'));var moment=require(_0x053d('0x1'));var BPromise=require('bluebird');var rs=require(_0x053d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x053d('0x3'))['db'];var utils=require(_0x053d('0x4'));var logger=require(_0x053d('0x5'))(_0x053d('0x6'));var config=require(_0x053d('0x7'));var jayson=require(_0x053d('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2b15f3,_0x5d32e0,_0x4f5728){return new BPromise(function(_0x4484be,_0x236113){return client['request'](_0x2b15f3,_0x4f5728)['then'](function(_0x60994c){logger[_0x053d('0x9')](_0x053d('0xa'),_0x5d32e0,_0x053d('0xb'));logger[_0x053d('0xc')](_0x053d('0xd'),_0x5d32e0,_0x053d('0xb'),JSON[_0x053d('0xe')](_0x60994c));if(_0x60994c[_0x053d('0xf')]){if(_0x60994c[_0x053d('0xf')][_0x053d('0x10')]===0x1f4){logger[_0x053d('0xf')](_0x053d('0xa'),_0x5d32e0,_0x60994c[_0x053d('0xf')][_0x053d('0x11')]);return _0x236113(_0x60994c['error'][_0x053d('0x11')]);}logger[_0x053d('0xf')](_0x053d('0xa'),_0x5d32e0,_0x60994c['error'][_0x053d('0x11')]);return _0x4484be(_0x60994c[_0x053d('0xf')][_0x053d('0x11')]);}else{logger[_0x053d('0x9')]('ChatProactiveAction,\x20%s,\x20%s',_0x5d32e0,_0x053d('0xb'));_0x4484be(_0x60994c[_0x053d('0x12')][_0x053d('0x11')]);}})[_0x053d('0x13')](function(_0x5af375){logger[_0x053d('0xf')](_0x053d('0xa'),_0x5d32e0,_0x5af375);_0x236113(_0x5af375);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 0163069..7007e24 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 _0xabce=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','/:id','show','isAuthenticated','create','put'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xabce,0x103));var _0xeabc=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0xabce[_0x550d12];return _0x12103d;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var timeout=require(_0xeabc('0x3'));var express=require(_0xeabc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeabc('0x5'));var interaction=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var controller=require('./chatProactiveAction.controller');router['get'](_0xeabc('0x8'),auth['isAuthenticated'](),controller[_0xeabc('0x9')]);router['post']('/',auth[_0xeabc('0xa')](),controller[_0xeabc('0xb')]);router[_0xeabc('0xc')]('/:id',auth[_0xeabc('0xa')](),controller[_0xeabc('0xd')]);router[_0xeabc('0xe')](_0xeabc('0x8'),auth[_0xeabc('0xa')](),controller[_0xeabc('0xf')]);module[_0xeabc('0x10')]=router; \ No newline at end of file +var _0x71ab=['get','/:id','isAuthenticated','show','post','create','put','update','delete','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x71ab,0x64));var _0xb71a=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x71ab[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require('multer');var util=require(_0xb71a('0x0'));var path=require('path');var timeout=require(_0xb71a('0x1'));var express=require('express');var router=express[_0xb71a('0x2')]();var fs_extra=require(_0xb71a('0x3'));var auth=require(_0xb71a('0x4'));var interaction=require(_0xb71a('0x5'));var config=require(_0xb71a('0x6'));var controller=require(_0xb71a('0x7'));router[_0xb71a('0x8')](_0xb71a('0x9'),auth[_0xb71a('0xa')](),controller[_0xb71a('0xb')]);router[_0xb71a('0xc')]('/',auth[_0xb71a('0xa')](),controller[_0xb71a('0xd')]);router[_0xb71a('0xe')](_0xb71a('0x9'),auth[_0xb71a('0xa')](),controller[_0xb71a('0xf')]);router[_0xb71a('0x10')]('/:id',auth[_0xb71a('0xa')](),controller['destroy']);module[_0xb71a('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 29d51aa..b7b1cda 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 _0x8281=['exports','name','STRING','ENUM','rrmemory','beepall','sequelize'];(function(_0x23dd0c,_0x83f73c){var _0x576742=function(_0x1cc94a){while(--_0x1cc94a){_0x23dd0c['push'](_0x23dd0c['shift']());}};_0x576742(++_0x83f73c);}(_0x8281,0x8b));var _0x1828=function(_0x4f381d,_0x2d8287){_0x4f381d=_0x4f381d-0x0;var _0x3ac952=_0x8281[_0x4f381d];return _0x3ac952;};'use strict';var Sequelize=require(_0x1828('0x0'));module[_0x1828('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x1828('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1828('0x3')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1828('0x4')](_0x1828('0x5'),_0x1828('0x6'),'roundrobin')}}; \ No newline at end of file +var _0x4ab3=['sequelize','name','STRING','INTEGER','rrmemory','beepall','roundrobin'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x4ab3,0x85));var _0x34ab=function(_0x3b231a,_0x53a00d){_0x3b231a=_0x3b231a-0x0;var _0x18d67a=_0x4ab3[_0x3b231a];return _0x18d67a;};'use strict';var Sequelize=require(_0x34ab('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x34ab('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x34ab('0x2')]},'timeout':{'type':Sequelize[_0x34ab('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x34ab('0x4'),_0x34ab('0x5'),_0x34ab('0x6'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 6707357..8517229 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 _0xcbb0=['where','filter','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','ChatQueues','UserProfileSection','autoAssociation','describe','getMembers','findOne','length','order','pick','ChatQueueId','UserId','agent','chatPause','createdAt','%s/%s','SIP','Team','getTeams','addTeams','User','Agents','online','voicePause','sequelize','transaction','each','UserChatQueue','findOrCreate','forEach','emit','userChatQueue:save','ids','select','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','toString','QueryTypes','every','TeamId','all','union','compact','value','removeTeams','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','getAgents','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','request','then','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','offset','limit','count','set','Content-Range','apply','save','update','destroy','UserProfileResource','stack','name','index','map','ChatQueue','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort'];(function(_0xb4e0c3,_0x3782ca){var _0x3c7a14=function(_0xedf1f5){while(--_0xedf1f5){_0xb4e0c3['push'](_0xb4e0c3['shift']());}};_0x3c7a14(++_0x3782ca);}(_0xcbb0,0xdf));var _0x0cbb=function(_0x1fb5fb,_0x15ed17){_0x1fb5fb=_0x1fb5fb-0x0;var _0x2c36ef=_0xcbb0[_0x1fb5fb];return _0x2c36ef;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0cbb('0x0'));var jsonpatch=require(_0x0cbb('0x1'));var rp=require('request-promise');var moment=require(_0x0cbb('0x2'));var BPromise=require(_0x0cbb('0x3'));var Mustache=require(_0x0cbb('0x4'));var util=require('util');var path=require(_0x0cbb('0x5'));var sox=require(_0x0cbb('0x6'));var csv=require(_0x0cbb('0x7'));var ejs=require(_0x0cbb('0x8'));var fs=require('fs');var fs_extra=require(_0x0cbb('0x9'));var _=require(_0x0cbb('0xa'));var squel=require(_0x0cbb('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0cbb('0xc'));var toCsv=require(_0x0cbb('0x7'));var querystring=require('querystring');var Papa=require(_0x0cbb('0xd'));var Redis=require(_0x0cbb('0xe'));var authService=require(_0x0cbb('0xf'));var qs=require(_0x0cbb('0x10'));var as=require(_0x0cbb('0x11'));var hardwareService=require(_0x0cbb('0x12'));var logger=require('../../config/logger')(_0x0cbb('0x13'));var utils=require(_0x0cbb('0x14'));var config=require(_0x0cbb('0x15'));var licenseUtil=require(_0x0cbb('0x16'));var db=require(_0x0cbb('0x17'))['db'];config['redis']=_[_0x0cbb('0x18')](config[_0x0cbb('0x19')],{'host':_0x0cbb('0x1a'),'port':0x18eb});var socket=require(_0x0cbb('0x1b'))(new Redis(config[_0x0cbb('0x19')]));require(_0x0cbb('0x1c'))[_0x0cbb('0x1d')](socket);var jayson=require(_0x0cbb('0x1e'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4b43c1,_0x2ecb9e,_0x5ed7e6,_0x3f2da4){return new BPromise(function(_0x3855d9,_0x14176a){var _0x57ebe6=_0x3f2da4||client;return _0x57ebe6[_0x0cbb('0x1f')](_0x4b43c1,_0x5ed7e6)[_0x0cbb('0x20')](function(_0x5ede69){logger[_0x0cbb('0x21')]('ChatQueue,\x20%s,\x20%s',_0x2ecb9e,_0x0cbb('0x22'));logger[_0x0cbb('0x23')](_0x0cbb('0x24'),_0x2ecb9e,_0x0cbb('0x22'),JSON[_0x0cbb('0x25')](_0x5ede69));if(_0x5ede69[_0x0cbb('0x26')]){if(_0x5ede69['error'][_0x0cbb('0x27')]===0x1f4){logger[_0x0cbb('0x26')](_0x0cbb('0x28'),_0x2ecb9e,_0x5ede69[_0x0cbb('0x26')][_0x0cbb('0x29')]);return _0x14176a(_0x5ede69['error'][_0x0cbb('0x29')]);}logger['error']('ChatQueue,\x20%s,\x20%s',_0x2ecb9e,_0x5ede69[_0x0cbb('0x26')][_0x0cbb('0x29')]);return _0x3855d9(_0x5ede69[_0x0cbb('0x26')][_0x0cbb('0x29')]);}else{logger['info'](_0x0cbb('0x28'),_0x2ecb9e,_0x0cbb('0x22'));_0x3855d9(_0x5ede69[_0x0cbb('0x2a')][_0x0cbb('0x29')]);}})[_0x0cbb('0x2b')](function(_0x38baaa){logger[_0x0cbb('0x26')](_0x0cbb('0x28'),_0x2ecb9e,_0x38baaa);_0x14176a(_0x38baaa);});});}function respondWithStatusCode(_0x191562,_0x57cc6d){_0x57cc6d=_0x57cc6d||0xcc;return function(_0x20b163){if(_0x20b163){return _0x191562[_0x0cbb('0x2c')](_0x57cc6d);}return _0x191562['status'](_0x57cc6d)[_0x0cbb('0x2d')]();};}function respondWithResult(_0x5cda57,_0x3539f4){_0x3539f4=_0x3539f4||0xc8;return function(_0x56f9df){if(_0x56f9df){return _0x5cda57[_0x0cbb('0x2e')](_0x3539f4)[_0x0cbb('0x2f')](_0x56f9df);}};}function respondWithFilteredResult(_0xefdaa5,_0x330827){return function(_0xcbf747){if(_0xcbf747){var _0xd32b35=typeof _0x330827[_0x0cbb('0x30')]==='undefined'&&typeof _0x330827[_0x0cbb('0x31')]==='undefined';var _0x3cc60b=_0xcbf747[_0x0cbb('0x32')];var _0xf6603b=_0xd32b35?0x0:_0x330827[_0x0cbb('0x30')];var _0x34ad41=_0xd32b35?_0xcbf747['count']:_0x330827[_0x0cbb('0x30')]+_0x330827['limit'];var _0x4b28d9;if(_0x34ad41>=_0x3cc60b){_0x34ad41=_0x3cc60b;_0x4b28d9=0xc8;}else{_0x4b28d9=0xce;}_0xefdaa5[_0x0cbb('0x2e')](_0x4b28d9);return _0xefdaa5[_0x0cbb('0x33')](_0x0cbb('0x34'),_0xf6603b+'-'+_0x34ad41+'/'+_0x3cc60b)[_0x0cbb('0x2f')](_0xcbf747);}return null;};}function patchUpdates(_0x285a89){return function(_0xdc11d2){try{jsonpatch[_0x0cbb('0x35')](_0xdc11d2,_0x285a89,!![]);}catch(_0x56491f){return BPromise['reject'](_0x56491f);}return _0xdc11d2[_0x0cbb('0x36')]();};}function saveUpdates(_0x5cbd3f,_0x38dbd6){return function(_0x306a17){if(_0x306a17){return _0x306a17[_0x0cbb('0x37')](_0x5cbd3f)[_0x0cbb('0x20')](function(_0x306338){return _0x306338;});}return null;};}function removeEntity(_0x430d09,_0x62be05){return function(_0x2bacbe){if(_0x2bacbe){return _0x2bacbe[_0x0cbb('0x38')]()[_0x0cbb('0x20')](function(){var _0xf9d8b8=_0x2bacbe['get']({'plain':!![]});var _0x2788bb='ChatQueues';return db[_0x0cbb('0x39')][_0x0cbb('0x38')]({'where':{'type':_0x2788bb,'resourceId':_0xf9d8b8['id']}})[_0x0cbb('0x20')](function(){return _0x2bacbe;});})[_0x0cbb('0x20')](function(){_0x430d09[_0x0cbb('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13c786,_0x1187cd){return function(_0x44b2ba){if(!_0x44b2ba){_0x13c786[_0x0cbb('0x2c')](0x194);}return _0x44b2ba;};}function handleError(_0x102530,_0x55aefc){_0x55aefc=_0x55aefc||0x1f4;return function(_0x436e78){logger[_0x0cbb('0x26')](_0x436e78[_0x0cbb('0x3a')]);if(_0x436e78[_0x0cbb('0x3b')]){delete _0x436e78[_0x0cbb('0x3b')];}_0x102530[_0x0cbb('0x2e')](_0x55aefc)['send'](_0x436e78);};}exports[_0x0cbb('0x3c')]=function(_0x56c719,_0x186914){var _0x46e16b={},_0x1da443={},_0x152226={'count':0x0,'rows':[]};var _0x228947=_[_0x0cbb('0x3d')](db[_0x0cbb('0x3e')][_0x0cbb('0x3f')],function(_0x48c684){return{'name':_0x48c684[_0x0cbb('0x40')],'type':_0x48c684[_0x0cbb('0x41')][_0x0cbb('0x42')]};});_0x1da443[_0x0cbb('0x43')]=_[_0x0cbb('0x3d')](_0x228947,'name');_0x1da443['query']=_[_0x0cbb('0x44')](_0x56c719[_0x0cbb('0x45')]);_0x1da443[_0x0cbb('0x46')]=_[_0x0cbb('0x47')](_0x1da443[_0x0cbb('0x43')],_0x1da443[_0x0cbb('0x45')]);_0x46e16b['attributes']=_[_0x0cbb('0x47')](_0x1da443['model'],qs[_0x0cbb('0x48')](_0x56c719[_0x0cbb('0x45')]['fields']));_0x46e16b[_0x0cbb('0x49')]=_0x46e16b[_0x0cbb('0x49')]['length']?_0x46e16b[_0x0cbb('0x49')]:_0x1da443['model'];if(!_0x56c719[_0x0cbb('0x45')][_0x0cbb('0x4a')](_0x0cbb('0x4b'))){_0x46e16b['limit']=qs[_0x0cbb('0x31')](_0x56c719[_0x0cbb('0x45')]['limit']);_0x46e16b[_0x0cbb('0x30')]=qs[_0x0cbb('0x30')](_0x56c719[_0x0cbb('0x45')]['offset']);}_0x46e16b['order']=qs[_0x0cbb('0x4c')](_0x56c719[_0x0cbb('0x45')][_0x0cbb('0x4c')]);_0x46e16b[_0x0cbb('0x4d')]=qs[_0x0cbb('0x46')](_['pick'](_0x56c719['query'],_0x1da443['filters']),_0x228947);if(_0x56c719[_0x0cbb('0x45')][_0x0cbb('0x4e')]){_0x46e16b[_0x0cbb('0x4d')]=_[_0x0cbb('0x4f')](_0x46e16b['where'],{'$or':_[_0x0cbb('0x3d')](_0x228947,function(_0x2f6084){if(_0x2f6084['type']!=='VIRTUAL'){var _0x335ff2={};_0x335ff2[_0x2f6084[_0x0cbb('0x3b')]]={'$like':'%'+_0x56c719['query'][_0x0cbb('0x4e')]+'%'};return _0x335ff2;}})});}_0x46e16b=_['merge']({},_0x46e16b,_0x56c719[_0x0cbb('0x50')]);var _0x258887={'where':_0x46e16b['where']};return db[_0x0cbb('0x3e')][_0x0cbb('0x32')](_0x258887)[_0x0cbb('0x20')](function(_0x53fede){_0x152226['count']=_0x53fede;if(_0x56c719[_0x0cbb('0x45')][_0x0cbb('0x51')]){_0x46e16b[_0x0cbb('0x52')]=[{'all':!![]}];}return db['ChatQueue'][_0x0cbb('0x53')](_0x46e16b);})[_0x0cbb('0x20')](function(_0x5e63f9){_0x152226[_0x0cbb('0x54')]=_0x5e63f9;return _0x152226;})[_0x0cbb('0x20')](respondWithFilteredResult(_0x186914,_0x46e16b))[_0x0cbb('0x2b')](handleError(_0x186914,null));};exports[_0x0cbb('0x55')]=function(_0x74d2eb,_0x4e9cd6){var _0x48f28a={'raw':!![],'where':{'id':_0x74d2eb[_0x0cbb('0x56')]['id']}},_0x46f5bb={};_0x46f5bb[_0x0cbb('0x43')]=_[_0x0cbb('0x44')](db[_0x0cbb('0x3e')][_0x0cbb('0x3f')]);_0x46f5bb['query']=_[_0x0cbb('0x44')](_0x74d2eb[_0x0cbb('0x45')]);_0x46f5bb[_0x0cbb('0x46')]=_[_0x0cbb('0x47')](_0x46f5bb[_0x0cbb('0x43')],_0x46f5bb[_0x0cbb('0x45')]);_0x48f28a['attributes']=_['intersection'](_0x46f5bb['model'],qs[_0x0cbb('0x48')](_0x74d2eb[_0x0cbb('0x45')][_0x0cbb('0x48')]));_0x48f28a[_0x0cbb('0x49')]=_0x48f28a[_0x0cbb('0x49')]['length']?_0x48f28a[_0x0cbb('0x49')]:_0x46f5bb[_0x0cbb('0x43')];if(_0x74d2eb[_0x0cbb('0x45')][_0x0cbb('0x51')]){_0x48f28a['include']=[{'all':!![]}];}_0x48f28a=_[_0x0cbb('0x4f')]({},_0x48f28a,_0x74d2eb[_0x0cbb('0x50')]);return db['ChatQueue'][_0x0cbb('0x57')](_0x48f28a)['then'](handleEntityNotFound(_0x4e9cd6,null))[_0x0cbb('0x20')](respondWithResult(_0x4e9cd6,null))[_0x0cbb('0x2b')](handleError(_0x4e9cd6,null));};exports[_0x0cbb('0x58')]=function(_0x54a701,_0x5a4a42){return db[_0x0cbb('0x3e')][_0x0cbb('0x58')](_0x54a701[_0x0cbb('0x59')],{})['then'](function(_0x675d63){var _0xf17185=_0x54a701['user']['get']({'plain':!![]});if(!_0xf17185)throw new Error(_0x0cbb('0x5a'));if(_0xf17185[_0x0cbb('0x5b')]===_0x0cbb('0x5c')){var _0x473280=_0x675d63[_0x0cbb('0x5d')]({'plain':!![]});var _0x2dc3ac=_0x0cbb('0x5e');return db[_0x0cbb('0x5f')][_0x0cbb('0x57')]({'where':{'name':_0x2dc3ac,'userProfileId':_0xf17185['userProfileId']},'raw':!![]})[_0x0cbb('0x20')](function(_0x4908e9){if(_0x4908e9&&_0x4908e9[_0x0cbb('0x60')]===0x0){return db[_0x0cbb('0x39')][_0x0cbb('0x58')]({'name':_0x473280['name'],'resourceId':_0x473280['id'],'type':_0x4908e9[_0x0cbb('0x3b')],'sectionId':_0x4908e9['id']},{})[_0x0cbb('0x20')](function(){return _0x675d63;});}else{return _0x675d63;}})[_0x0cbb('0x2b')](function(_0x10a8ed){logger[_0x0cbb('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x10a8ed);throw _0x10a8ed;});}return _0x675d63;})['then'](respondWithResult(_0x5a4a42,0xc9))[_0x0cbb('0x2b')](handleError(_0x5a4a42,null));};exports[_0x0cbb('0x37')]=function(_0x4c594c,_0x2364b8){if(_0x4c594c[_0x0cbb('0x59')]['id']){delete _0x4c594c[_0x0cbb('0x59')]['id'];}return db[_0x0cbb('0x3e')][_0x0cbb('0x57')]({'where':{'id':_0x4c594c[_0x0cbb('0x56')]['id']}})[_0x0cbb('0x20')](handleEntityNotFound(_0x2364b8,null))[_0x0cbb('0x20')](saveUpdates(_0x4c594c['body'],null))[_0x0cbb('0x20')](respondWithResult(_0x2364b8,null))['catch'](handleError(_0x2364b8,null));};exports['destroy']=function(_0x1d0392,_0x329eb2){return db[_0x0cbb('0x3e')]['find']({'where':{'id':_0x1d0392[_0x0cbb('0x56')]['id']}})['then'](handleEntityNotFound(_0x329eb2,null))[_0x0cbb('0x20')](removeEntity(_0x329eb2,null))['catch'](handleError(_0x329eb2,null));};exports[_0x0cbb('0x61')]=function(_0xd0df88,_0x1ae52f){return db[_0x0cbb('0x3e')][_0x0cbb('0x61')]()['then'](respondWithResult(_0x1ae52f,null))[_0x0cbb('0x2b')](handleError(_0x1ae52f,null));};exports[_0x0cbb('0x62')]=function(_0x574231,_0x59c664,_0x42829f){var _0x1f0eb0={'raw':!![],'where':{}},_0x1d29c8={},_0x39cda7;return db[_0x0cbb('0x3e')][_0x0cbb('0x63')]({'where':{'id':_0x574231[_0x0cbb('0x56')]['id']}})[_0x0cbb('0x20')](handleEntityNotFound(_0x59c664,null))[_0x0cbb('0x20')](function(_0x3ac6a3){if(_0x3ac6a3){_0x39cda7=_0x3ac6a3[_0x0cbb('0x5d')]({'plain':!![]});_0x1d29c8[_0x0cbb('0x43')]=_['keys'](db['UserChatQueue'][_0x0cbb('0x3f')]);_0x1d29c8['query']=_[_0x0cbb('0x44')](_0x574231[_0x0cbb('0x45')]);_0x1d29c8[_0x0cbb('0x46')]=_[_0x0cbb('0x47')](_0x1d29c8[_0x0cbb('0x43')],_0x1d29c8[_0x0cbb('0x45')]);_0x1f0eb0[_0x0cbb('0x49')]=_[_0x0cbb('0x47')](_0x1d29c8['model'],qs[_0x0cbb('0x48')](_0x574231[_0x0cbb('0x45')][_0x0cbb('0x48')]));_0x1f0eb0[_0x0cbb('0x49')]=_0x1f0eb0[_0x0cbb('0x49')][_0x0cbb('0x64')]?_0x1f0eb0[_0x0cbb('0x49')]:_0x1d29c8[_0x0cbb('0x43')];if(!_0x574231[_0x0cbb('0x45')]['hasOwnProperty']('nolimit')){_0x1f0eb0[_0x0cbb('0x31')]=qs[_0x0cbb('0x31')](_0x574231[_0x0cbb('0x45')][_0x0cbb('0x31')]);_0x1f0eb0['offset']=qs[_0x0cbb('0x30')](_0x574231[_0x0cbb('0x45')][_0x0cbb('0x30')]);}_0x1f0eb0[_0x0cbb('0x65')]=qs[_0x0cbb('0x4c')](_0x574231[_0x0cbb('0x45')][_0x0cbb('0x4c')]);_0x1f0eb0['where']=qs[_0x0cbb('0x46')](_[_0x0cbb('0x66')](_0x574231[_0x0cbb('0x45')],_0x1d29c8[_0x0cbb('0x46')]));_0x1f0eb0[_0x0cbb('0x4d')][_0x0cbb('0x67')]=_0x3ac6a3['id'];if(_0x574231['query']['filter']){_0x1f0eb0['where']=_[_0x0cbb('0x4f')](_0x1f0eb0['where'],{'$or':_[_0x0cbb('0x3d')](_0x1f0eb0[_0x0cbb('0x49')],function(_0x4ddefc){var _0x4ba73b={};_0x4ba73b[_0x4ddefc]={'$like':'%'+_0x574231[_0x0cbb('0x45')][_0x0cbb('0x4e')]+'%'};return _0x4ba73b;})});}_0x1f0eb0=_[_0x0cbb('0x4f')]({},_0x1f0eb0,_0x574231[_0x0cbb('0x50')]);return db['UserChatQueue'][_0x0cbb('0x53')](_0x1f0eb0);}})[_0x0cbb('0x20')](function(_0x177497){if(_0x177497){return db['User']['findAndCountAll']({'where':{'id':_[_0x0cbb('0x3d')](_0x177497,_0x0cbb('0x68')),'role':_0x0cbb('0x69')},'attributes':['id',_0x0cbb('0x3b'),_0x0cbb('0x6a'),'updatedAt',_0x0cbb('0x6b')]});}})[_0x0cbb('0x20')](function(_0x38ac50){if(_0x38ac50){return{'count':_0x38ac50[_0x0cbb('0x32')],'rows':_['map'](_0x38ac50[_0x0cbb('0x54')],function(_0x2d09d2){return{'membername':_0x2d09d2['name'],'UserId':_0x2d09d2['id'],'queue_name':_0x39cda7[_0x0cbb('0x3b')],'ChatQueueId':_0x39cda7['id'],'interface':util['format'](_0x0cbb('0x6c'),_0x0cbb('0x6d'),_0x2d09d2[_0x0cbb('0x3b')]),'penalty':0x0,'paused':_0x2d09d2[_0x0cbb('0x6a')],'createdAt':_0x2d09d2[_0x0cbb('0x6b')],'updatedAt':_0x2d09d2['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x0cbb('0x20')](respondWithFilteredResult(_0x59c664,_0x1f0eb0))[_0x0cbb('0x2b')](handleError(_0x59c664,null));};exports['getTeams']=function(_0x1f3b47,_0x325f96,_0x4f0c47){var _0x4fb1c6={};var _0x1e1d41={};var _0x159e8c;var _0x4409cc;return db['ChatQueue'][_0x0cbb('0x63')]({'where':{'id':_0x1f3b47[_0x0cbb('0x56')]['id']}})[_0x0cbb('0x20')](handleEntityNotFound(_0x325f96,null))[_0x0cbb('0x20')](function(_0x5b5f19){if(_0x5b5f19){_0x159e8c=_0x5b5f19;_0x1e1d41[_0x0cbb('0x43')]=_[_0x0cbb('0x44')](db[_0x0cbb('0x6e')][_0x0cbb('0x3f')]);_0x1e1d41[_0x0cbb('0x45')]=_[_0x0cbb('0x44')](_0x1f3b47[_0x0cbb('0x45')]);_0x1e1d41[_0x0cbb('0x46')]=_[_0x0cbb('0x47')](_0x1e1d41[_0x0cbb('0x43')],_0x1e1d41[_0x0cbb('0x45')]);_0x4fb1c6['attributes']=_[_0x0cbb('0x47')](_0x1e1d41[_0x0cbb('0x43')],qs[_0x0cbb('0x48')](_0x1f3b47[_0x0cbb('0x45')][_0x0cbb('0x48')]));_0x4fb1c6['attributes']=_0x4fb1c6['attributes'][_0x0cbb('0x64')]?_0x4fb1c6['attributes']:_0x1e1d41[_0x0cbb('0x43')];_0x4fb1c6[_0x0cbb('0x65')]=qs[_0x0cbb('0x4c')](_0x1f3b47[_0x0cbb('0x45')][_0x0cbb('0x4c')]);_0x4fb1c6[_0x0cbb('0x4d')]=qs[_0x0cbb('0x46')](_[_0x0cbb('0x66')](_0x1f3b47[_0x0cbb('0x45')],_0x1e1d41[_0x0cbb('0x46')]));if(_0x1f3b47['query'][_0x0cbb('0x4e')]){_0x4fb1c6[_0x0cbb('0x4d')]=_[_0x0cbb('0x4f')](_0x4fb1c6['where'],{'$or':_[_0x0cbb('0x3d')](_0x4fb1c6['attributes'],function(_0x52a542){var _0xd33b3a={};_0xd33b3a[_0x52a542]={'$like':'%'+_0x1f3b47[_0x0cbb('0x45')]['filter']+'%'};return _0xd33b3a;})});}_0x4fb1c6=_[_0x0cbb('0x4f')]({},_0x4fb1c6,_0x1f3b47[_0x0cbb('0x50')]);return _0x159e8c[_0x0cbb('0x6f')](_0x4fb1c6);}})['then'](function(_0xc69a92){if(_0xc69a92){_0x4409cc=_0xc69a92[_0x0cbb('0x64')];if(!_0x1f3b47[_0x0cbb('0x45')][_0x0cbb('0x4a')](_0x0cbb('0x4b'))){_0x4fb1c6[_0x0cbb('0x31')]=qs['limit'](_0x1f3b47['query'][_0x0cbb('0x31')]);_0x4fb1c6[_0x0cbb('0x30')]=qs[_0x0cbb('0x30')](_0x1f3b47[_0x0cbb('0x45')]['offset']);}return _0x159e8c[_0x0cbb('0x6f')](_0x4fb1c6);}})[_0x0cbb('0x20')](function(_0x3b32f4){if(_0x3b32f4){return _0x3b32f4?{'count':_0x4409cc,'rows':_0x3b32f4}:null;}})[_0x0cbb('0x20')](respondWithResult(_0x325f96,null))[_0x0cbb('0x2b')](handleError(_0x325f96,null));};exports[_0x0cbb('0x70')]=function(_0x25f906,_0x49caee,_0x3f2947){var _0x237910=_0x25f906[_0x0cbb('0x59')]['ids'];return db[_0x0cbb('0x6e')][_0x0cbb('0x53')]({'where':{'id':_0x237910},'attributes':['id'],'include':[{'model':db[_0x0cbb('0x71')],'as':_0x0cbb('0x72'),'attributes':['id','name',_0x0cbb('0x73'),_0x0cbb('0x74'),'interface'],'raw':!![]}]})['then'](function(_0xd11977){if(_0xd11977){var _0x2bfe6b=_['flatMap'](_0xd11977,function(_0xea3961){var _0x14e673=_0xea3961[_0x0cbb('0x5d')]({'plain':!![]});return _0x14e673[_0x0cbb('0x72')];});return db[_0x0cbb('0x3e')]['find']({'where':{'id':_0x25f906['params']['id']}})['then'](function(_0x34b15f){return db[_0x0cbb('0x75')][_0x0cbb('0x76')](function(_0x15c178){return _0x34b15f[_0x0cbb('0x70')](_0x237910,{'transaction':_0x15c178})[_0x0cbb('0x20')](function(){return BPromise[_0x0cbb('0x77')](_0x2bfe6b,function(_0x754d5f){return db[_0x0cbb('0x78')][_0x0cbb('0x79')]({'where':{'UserId':_0x754d5f['id'],'ChatQueueId':_0x25f906[_0x0cbb('0x56')]['id']},'transaction':_0x15c178});});})[_0x0cbb('0x20')](function(){_0x2bfe6b[_0x0cbb('0x7a')](function(_0x3ee93a){socket[_0x0cbb('0x7b')](_0x0cbb('0x7c'),{'UserId':_0x3ee93a['id'],'ChatQueueId':_0x34b15f['id']});});});});});}})['then'](respondWithStatusCode(_0x49caee,null))[_0x0cbb('0x2b')](handleError(_0x49caee,null));};exports['removeTeams']=function(_0x1cf87a,_0x570485,_0x3fc93a){return db[_0x0cbb('0x6e')][_0x0cbb('0x53')]({'where':{'id':_0x1cf87a['query'][_0x0cbb('0x7d')]},'attributes':['id'],'include':[{'model':db[_0x0cbb('0x71')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x0cbb('0x20')](handleEntityNotFound(_0x570485,null))[_0x0cbb('0x20')](function(_0x578dc5){var _0x16091b=_[_0x0cbb('0x3d')](_0x578dc5,'id');var _0x2f2d91=[];var _0x12e093=[];var _0x10244a=squel[_0x0cbb('0x7e')]();_0x10244a[_0x0cbb('0x7f')]('tq.TeamId')[_0x0cbb('0x80')]('team_has_chat_queues','tq')[_0x0cbb('0x81')](_0x0cbb('0x82'),'ut',_0x0cbb('0x83'))[_0x0cbb('0x4d')]('ChatQueueId\x20=\x20?',_0x1cf87a[_0x0cbb('0x56')]['id']);for(var _0x1de2a1=0x0;_0x1de2a1<_0x578dc5[_0x0cbb('0x64')];_0x1de2a1+=0x1){let _0x285835=_0x578dc5[_0x1de2a1];for(var _0x192883=0x0;_0x192883<_0x285835['Agents'][_0x0cbb('0x64')];_0x192883+=0x1){let _0x1031e1=_0x285835[_0x0cbb('0x72')][_0x192883];var _0x3fc151=_0x10244a[_0x0cbb('0x84')]();_0x3fc151[_0x0cbb('0x4d')]('ut.UserId\x20=\x20?',_0x1031e1['id']);_0x12e093[_0x0cbb('0x85')](db['sequelize'][_0x0cbb('0x45')](_0x3fc151[_0x0cbb('0x86')](),{'type':db[_0x0cbb('0x75')][_0x0cbb('0x87')]['SELECT']})[_0x0cbb('0x20')](function(_0x5bf402){if(_0x5bf402['length']===0x1){return _0x1031e1['id'];}else{var _0x4363b4=_[_0x0cbb('0x88')](_[_0x0cbb('0x3d')](_0x5bf402,_0x0cbb('0x89')),function(_0xb07cb0){return _['includes'](_0x16091b,_0xb07cb0);});if(_0x4363b4){return _0x1031e1['id'];}}}));}}return BPromise[_0x0cbb('0x8a')](_0x12e093)[_0x0cbb('0x20')](function(_0x430cdc){_0x2f2d91=_(_0x2f2d91)[_0x0cbb('0x8b')](_0x430cdc)[_0x0cbb('0x8c')]()[_0x0cbb('0x8d')]();return db[_0x0cbb('0x3e')][_0x0cbb('0x57')]({'where':{'id':_0x1cf87a[_0x0cbb('0x56')]['id']}})[_0x0cbb('0x20')](function(_0x454c98){return db['sequelize']['transaction'](function(_0x5c7933){return _0x454c98[_0x0cbb('0x8e')](_0x1cf87a[_0x0cbb('0x45')]['ids'],{'transaction':_0x5c7933})[_0x0cbb('0x20')](function(){if(!_[_0x0cbb('0x8f')](_0x2f2d91)){return _0x454c98[_0x0cbb('0x90')](_0x2f2d91,{'transaction':_0x5c7933});}})['then'](function(){_0x2f2d91['forEach'](function(_0x4015c8){socket[_0x0cbb('0x7b')](_0x0cbb('0x91'),{'UserId':_0x4015c8,'ChatQueueId':_0x454c98['id']});});});});});});})[_0x0cbb('0x20')](respondWithStatusCode(_0x570485,null))[_0x0cbb('0x2b')](handleError(_0x570485,null));};exports['addAgents']=function(_0x90c12c,_0x5363a7,_0x133d26){return db['ChatQueue'][_0x0cbb('0x57')]({'where':{'id':_0x90c12c['params']['id']}})[_0x0cbb('0x20')](handleEntityNotFound(_0x5363a7,null))[_0x0cbb('0x20')](function(_0x44f004){if(_0x44f004){return _0x44f004[_0x0cbb('0x92')](_0x90c12c[_0x0cbb('0x59')]['ids'],_[_0x0cbb('0x93')](_0x90c12c[_0x0cbb('0x59')],[_0x0cbb('0x7d'),'id'])||{})[_0x0cbb('0x94')](function(_0x385e46){for(var _0x193d48=0x0;_0x193d48<_0x90c12c['body'][_0x0cbb('0x7d')][_0x0cbb('0x64')];_0x193d48+=0x1){socket[_0x0cbb('0x7b')]('userChatQueue:save',{'UserId':Number(_0x90c12c['body'][_0x0cbb('0x7d')][_0x193d48]),'ChatQueueId':Number(_0x90c12c[_0x0cbb('0x56')]['id'])});}return _0x385e46;});}})[_0x0cbb('0x20')](respondWithResult(_0x5363a7,null))[_0x0cbb('0x2b')](handleError(_0x5363a7,null));};exports[_0x0cbb('0x90')]=function(_0xc116ea,_0x509fd4,_0x2145f7){return db['ChatQueue'][_0x0cbb('0x57')]({'where':{'id':_0xc116ea['params']['id']}})[_0x0cbb('0x20')](handleEntityNotFound(_0x509fd4,null))[_0x0cbb('0x20')](function(_0x1e86cb){if(_0x1e86cb){return _0x1e86cb[_0x0cbb('0x90')](_0xc116ea[_0x0cbb('0x45')]['ids'])[_0x0cbb('0x20')](function(){if(_['isArray'](_0xc116ea[_0x0cbb('0x45')][_0x0cbb('0x7d')])){for(var _0x50d917=0x0;_0x50d917<_0xc116ea[_0x0cbb('0x45')][_0x0cbb('0x7d')][_0x0cbb('0x64')];_0x50d917+=0x1){socket[_0x0cbb('0x7b')]('userChatQueue:remove',{'UserId':Number(_0xc116ea['query'][_0x0cbb('0x7d')][_0x50d917]),'ChatQueueId':Number(_0xc116ea['params']['id'])});}}else{socket['emit'](_0x0cbb('0x91'),{'UserId':Number(_0xc116ea[_0x0cbb('0x45')][_0x0cbb('0x7d')]),'ChatQueueId':Number(_0xc116ea[_0x0cbb('0x56')]['id'])});}});}})[_0x0cbb('0x20')](respondWithStatusCode(_0x509fd4,null))[_0x0cbb('0x2b')](handleError(_0x509fd4,null));};exports[_0x0cbb('0x95')]=function(_0x287346,_0x53609c,_0x45660b){var _0x4b8f02={};var _0x1b4c02={};var _0x4649eb;var _0x259a95;return db['ChatQueue'][_0x0cbb('0x63')]({'where':{'id':_0x287346[_0x0cbb('0x56')]['id']}})[_0x0cbb('0x20')](handleEntityNotFound(_0x53609c,null))[_0x0cbb('0x20')](function(_0x2a1633){if(_0x2a1633){_0x4649eb=_0x2a1633;_0x1b4c02['model']=_[_0x0cbb('0x44')](db[_0x0cbb('0x71')][_0x0cbb('0x3f')]);_0x1b4c02[_0x0cbb('0x45')]=_['keys'](_0x287346['query']);_0x1b4c02['filters']=_[_0x0cbb('0x47')](_0x1b4c02[_0x0cbb('0x43')],_0x1b4c02['query']);_0x4b8f02[_0x0cbb('0x49')]=_[_0x0cbb('0x47')](_0x1b4c02[_0x0cbb('0x43')],qs[_0x0cbb('0x48')](_0x287346['query'][_0x0cbb('0x48')]));_0x4b8f02[_0x0cbb('0x49')]=_0x4b8f02['attributes'][_0x0cbb('0x64')]?_0x4b8f02[_0x0cbb('0x49')]:_0x1b4c02[_0x0cbb('0x43')];_0x4b8f02[_0x0cbb('0x65')]=qs[_0x0cbb('0x4c')](_0x287346[_0x0cbb('0x45')][_0x0cbb('0x4c')]);_0x4b8f02[_0x0cbb('0x4d')]=qs[_0x0cbb('0x46')](_[_0x0cbb('0x66')](_0x287346['query'],_0x1b4c02[_0x0cbb('0x46')]));if(_0x287346[_0x0cbb('0x45')][_0x0cbb('0x4e')]){_0x4b8f02[_0x0cbb('0x4d')]=_['merge'](_0x4b8f02[_0x0cbb('0x4d')],{'$or':_[_0x0cbb('0x3d')](_0x4b8f02['attributes'],function(_0x456b91){var _0x5e8441={};_0x5e8441[_0x456b91]={'$like':'%'+_0x287346[_0x0cbb('0x45')][_0x0cbb('0x4e')]+'%'};return _0x5e8441;})});}_0x4b8f02=_[_0x0cbb('0x4f')]({},_0x4b8f02,_0x287346[_0x0cbb('0x50')]);return _0x4649eb[_0x0cbb('0x95')](_0x4b8f02);}})[_0x0cbb('0x20')](function(_0x2b719a){if(_0x2b719a){_0x259a95=_0x2b719a[_0x0cbb('0x64')];if(!_0x287346[_0x0cbb('0x45')][_0x0cbb('0x4a')](_0x0cbb('0x4b'))){_0x4b8f02['limit']=qs['limit'](_0x287346[_0x0cbb('0x45')][_0x0cbb('0x31')]);_0x4b8f02[_0x0cbb('0x30')]=qs[_0x0cbb('0x30')](_0x287346[_0x0cbb('0x45')][_0x0cbb('0x30')]);}return _0x4649eb[_0x0cbb('0x95')](_0x4b8f02);}})[_0x0cbb('0x20')](function(_0x28ae0e){if(_0x28ae0e){return _0x28ae0e?{'count':_0x259a95,'rows':_0x28ae0e}:null;}})[_0x0cbb('0x20')](respondWithResult(_0x53609c,null))[_0x0cbb('0x2b')](handleError(_0x53609c,null));}; \ No newline at end of file +var _0xafb7=['QueryTypes','SELECT','every','TeamId','includes','all','union','compact','removeTeams','removeAgents','emit','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','request-promise','bluebird','path','to-csv','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/license/util','../../mysqldb','redis','defaults','localhost','./chatQueue.socket','jayson/promise','http','request','then','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','get','ChatQueues','UserProfileResource','stack','name','send','index','map','ChatQueue','rawAttributes','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','rows','show','params','keys','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','describe','getMembers','findOne','UserChatQueue','order','ChatQueueId','findAll','UserId','agent','chatPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','forEach','userChatQueue:save','select','field','tq.TeamId','join','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','push','toString'];(function(_0x2f04a1,_0x36b976){var _0xddc4b6=function(_0x2e6645){while(--_0x2e6645){_0x2f04a1['push'](_0x2f04a1['shift']());}};_0xddc4b6(++_0x36b976);}(_0xafb7,0x1dc));var _0x7afb=function(_0x5e192d,_0x548bdf){_0x5e192d=_0x5e192d-0x0;var _0x109da7=_0xafb7[_0x5e192d];return _0x109da7;};'use strict';var emlformat=require(_0x7afb('0x0'));var rimraf=require(_0x7afb('0x1'));var zipdir=require(_0x7afb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7afb('0x3'));var moment=require('moment');var BPromise=require(_0x7afb('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7afb('0x5'));var sox=require('sox');var csv=require(_0x7afb('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7afb('0x7'));var _=require('lodash');var squel=require(_0x7afb('0x8'));var crypto=require(_0x7afb('0x9'));var jsforce=require(_0x7afb('0xa'));var deskjs=require(_0x7afb('0xb'));var toCsv=require(_0x7afb('0x6'));var querystring=require(_0x7afb('0xc'));var Papa=require(_0x7afb('0xd'));var Redis=require('ioredis');var authService=require(_0x7afb('0xe'));var qs=require(_0x7afb('0xf'));var as=require(_0x7afb('0x10'));var hardwareService=require(_0x7afb('0x11'));var logger=require(_0x7afb('0x12'))(_0x7afb('0x13'));var utils=require(_0x7afb('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x7afb('0x15'));var db=require(_0x7afb('0x16'))['db'];config[_0x7afb('0x17')]=_[_0x7afb('0x18')](config[_0x7afb('0x17')],{'host':_0x7afb('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7afb('0x17')]));require(_0x7afb('0x1a'))['register'](socket);var jayson=require(_0x7afb('0x1b'));var client=jayson['client'][_0x7afb('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x28cbdd,_0x25eb8f,_0x2b5f4f,_0x13ed56){return new BPromise(function(_0x28d60b,_0x4c060e){var _0x334fd2=_0x13ed56||client;return _0x334fd2[_0x7afb('0x1d')](_0x28cbdd,_0x2b5f4f)[_0x7afb('0x1e')](function(_0x2187bb){logger['info'](_0x7afb('0x1f'),_0x25eb8f,_0x7afb('0x20'));logger[_0x7afb('0x21')](_0x7afb('0x22'),_0x25eb8f,'request\x20sent',JSON[_0x7afb('0x23')](_0x2187bb));if(_0x2187bb[_0x7afb('0x24')]){if(_0x2187bb['error'][_0x7afb('0x25')]===0x1f4){logger['error']('ChatQueue,\x20%s,\x20%s',_0x25eb8f,_0x2187bb[_0x7afb('0x24')][_0x7afb('0x26')]);return _0x4c060e(_0x2187bb[_0x7afb('0x24')][_0x7afb('0x26')]);}logger[_0x7afb('0x24')](_0x7afb('0x1f'),_0x25eb8f,_0x2187bb[_0x7afb('0x24')][_0x7afb('0x26')]);return _0x28d60b(_0x2187bb[_0x7afb('0x24')]['message']);}else{logger[_0x7afb('0x27')](_0x7afb('0x1f'),_0x25eb8f,_0x7afb('0x20'));_0x28d60b(_0x2187bb['result'][_0x7afb('0x26')]);}})[_0x7afb('0x28')](function(_0x216adf){logger[_0x7afb('0x24')](_0x7afb('0x1f'),_0x25eb8f,_0x216adf);_0x4c060e(_0x216adf);});});}function respondWithStatusCode(_0x4da190,_0xc5afa){_0xc5afa=_0xc5afa||0xcc;return function(_0x593c1f){if(_0x593c1f){return _0x4da190[_0x7afb('0x29')](_0xc5afa);}return _0x4da190[_0x7afb('0x2a')](_0xc5afa)[_0x7afb('0x2b')]();};}function respondWithResult(_0x581d06,_0x86471a){_0x86471a=_0x86471a||0xc8;return function(_0x2f6d56){if(_0x2f6d56){return _0x581d06['status'](_0x86471a)[_0x7afb('0x2c')](_0x2f6d56);}};}function respondWithFilteredResult(_0x3f6a70,_0xed7686){return function(_0x3d52d8){if(_0x3d52d8){var _0x2255c8=typeof _0xed7686[_0x7afb('0x2d')]==='undefined'&&typeof _0xed7686[_0x7afb('0x2e')]===_0x7afb('0x2f');var _0x331e87=_0x3d52d8[_0x7afb('0x30')];var _0x5aeccc=_0x2255c8?0x0:_0xed7686['offset'];var _0x31efce=_0x2255c8?_0x3d52d8[_0x7afb('0x30')]:_0xed7686[_0x7afb('0x2d')]+_0xed7686[_0x7afb('0x2e')];var _0x493be3;if(_0x31efce>=_0x331e87){_0x31efce=_0x331e87;_0x493be3=0xc8;}else{_0x493be3=0xce;}_0x3f6a70[_0x7afb('0x2a')](_0x493be3);return _0x3f6a70[_0x7afb('0x31')](_0x7afb('0x32'),_0x5aeccc+'-'+_0x31efce+'/'+_0x331e87)[_0x7afb('0x2c')](_0x3d52d8);}return null;};}function patchUpdates(_0x9dfe2b){return function(_0x24b639){try{jsonpatch[_0x7afb('0x33')](_0x24b639,_0x9dfe2b,!![]);}catch(_0x1025dd){return BPromise[_0x7afb('0x34')](_0x1025dd);}return _0x24b639[_0x7afb('0x35')]();};}function saveUpdates(_0x549725,_0x35350f){return function(_0x1c30d2){if(_0x1c30d2){return _0x1c30d2[_0x7afb('0x36')](_0x549725)[_0x7afb('0x1e')](function(_0x588ff4){return _0x588ff4;});}return null;};}function removeEntity(_0xf2fc21,_0x39d7fa){return function(_0x22814c){if(_0x22814c){return _0x22814c[_0x7afb('0x37')]()[_0x7afb('0x1e')](function(){var _0x3bc819=_0x22814c[_0x7afb('0x38')]({'plain':!![]});var _0x1c69f0=_0x7afb('0x39');return db[_0x7afb('0x3a')][_0x7afb('0x37')]({'where':{'type':_0x1c69f0,'resourceId':_0x3bc819['id']}})['then'](function(){return _0x22814c;});})[_0x7afb('0x1e')](function(){_0xf2fc21[_0x7afb('0x2a')](0xcc)[_0x7afb('0x2b')]();});}};}function handleEntityNotFound(_0xeb7fd6,_0x40388f){return function(_0x53b500){if(!_0x53b500){_0xeb7fd6[_0x7afb('0x29')](0x194);}return _0x53b500;};}function handleError(_0x26d220,_0x5b3431){_0x5b3431=_0x5b3431||0x1f4;return function(_0x19f17b){logger['error'](_0x19f17b[_0x7afb('0x3b')]);if(_0x19f17b['name']){delete _0x19f17b[_0x7afb('0x3c')];}_0x26d220['status'](_0x5b3431)[_0x7afb('0x3d')](_0x19f17b);};}exports[_0x7afb('0x3e')]=function(_0x8321ae,_0x1ef33a){var _0x164eff={},_0xbc528a={},_0x21485d={'count':0x0,'rows':[]};var _0x35b56a=_[_0x7afb('0x3f')](db[_0x7afb('0x40')][_0x7afb('0x41')],function(_0x583cdb){return{'name':_0x583cdb['fieldName'],'type':_0x583cdb['type'][_0x7afb('0x42')]};});_0xbc528a['model']=_[_0x7afb('0x3f')](_0x35b56a,_0x7afb('0x3c'));_0xbc528a[_0x7afb('0x43')]=_['keys'](_0x8321ae[_0x7afb('0x43')]);_0xbc528a[_0x7afb('0x44')]=_[_0x7afb('0x45')](_0xbc528a[_0x7afb('0x46')],_0xbc528a[_0x7afb('0x43')]);_0x164eff[_0x7afb('0x47')]=_[_0x7afb('0x45')](_0xbc528a['model'],qs[_0x7afb('0x48')](_0x8321ae['query'][_0x7afb('0x48')]));_0x164eff[_0x7afb('0x47')]=_0x164eff['attributes'][_0x7afb('0x49')]?_0x164eff['attributes']:_0xbc528a['model'];if(!_0x8321ae[_0x7afb('0x43')][_0x7afb('0x4a')](_0x7afb('0x4b'))){_0x164eff[_0x7afb('0x2e')]=qs[_0x7afb('0x2e')](_0x8321ae[_0x7afb('0x43')]['limit']);_0x164eff[_0x7afb('0x2d')]=qs['offset'](_0x8321ae['query'][_0x7afb('0x2d')]);}_0x164eff['order']=qs[_0x7afb('0x4c')](_0x8321ae[_0x7afb('0x43')][_0x7afb('0x4c')]);_0x164eff[_0x7afb('0x4d')]=qs[_0x7afb('0x44')](_[_0x7afb('0x4e')](_0x8321ae['query'],_0xbc528a[_0x7afb('0x44')]),_0x35b56a);if(_0x8321ae[_0x7afb('0x43')][_0x7afb('0x4f')]){_0x164eff['where']=_[_0x7afb('0x50')](_0x164eff['where'],{'$or':_[_0x7afb('0x3f')](_0x35b56a,function(_0x71f102){if(_0x71f102[_0x7afb('0x51')]!==_0x7afb('0x52')){var _0x45195a={};_0x45195a[_0x71f102[_0x7afb('0x3c')]]={'$like':'%'+_0x8321ae[_0x7afb('0x43')][_0x7afb('0x4f')]+'%'};return _0x45195a;}})});}_0x164eff=_['merge']({},_0x164eff,_0x8321ae['options']);var _0x4c0193={'where':_0x164eff['where']};return db[_0x7afb('0x40')][_0x7afb('0x30')](_0x4c0193)['then'](function(_0x7b6000){_0x21485d[_0x7afb('0x30')]=_0x7b6000;if(_0x8321ae[_0x7afb('0x43')][_0x7afb('0x53')]){_0x164eff[_0x7afb('0x54')]=[{'all':!![]}];}return db['ChatQueue']['findAll'](_0x164eff);})[_0x7afb('0x1e')](function(_0x4edc1e){_0x21485d[_0x7afb('0x55')]=_0x4edc1e;return _0x21485d;})[_0x7afb('0x1e')](respondWithFilteredResult(_0x1ef33a,_0x164eff))[_0x7afb('0x28')](handleError(_0x1ef33a,null));};exports[_0x7afb('0x56')]=function(_0x4a7c6d,_0x3ed04c){var _0x57878a={'raw':!![],'where':{'id':_0x4a7c6d[_0x7afb('0x57')]['id']}},_0x85e1b6={};_0x85e1b6[_0x7afb('0x46')]=_[_0x7afb('0x58')](db[_0x7afb('0x40')][_0x7afb('0x41')]);_0x85e1b6[_0x7afb('0x43')]=_[_0x7afb('0x58')](_0x4a7c6d[_0x7afb('0x43')]);_0x85e1b6[_0x7afb('0x44')]=_[_0x7afb('0x45')](_0x85e1b6[_0x7afb('0x46')],_0x85e1b6[_0x7afb('0x43')]);_0x57878a[_0x7afb('0x47')]=_[_0x7afb('0x45')](_0x85e1b6['model'],qs[_0x7afb('0x48')](_0x4a7c6d[_0x7afb('0x43')][_0x7afb('0x48')]));_0x57878a[_0x7afb('0x47')]=_0x57878a['attributes'][_0x7afb('0x49')]?_0x57878a[_0x7afb('0x47')]:_0x85e1b6[_0x7afb('0x46')];if(_0x4a7c6d[_0x7afb('0x43')][_0x7afb('0x53')]){_0x57878a[_0x7afb('0x54')]=[{'all':!![]}];}_0x57878a=_[_0x7afb('0x50')]({},_0x57878a,_0x4a7c6d[_0x7afb('0x59')]);return db['ChatQueue']['find'](_0x57878a)[_0x7afb('0x1e')](handleEntityNotFound(_0x3ed04c,null))['then'](respondWithResult(_0x3ed04c,null))['catch'](handleError(_0x3ed04c,null));};exports[_0x7afb('0x5a')]=function(_0x329221,_0x58c612){return db[_0x7afb('0x40')][_0x7afb('0x5a')](_0x329221[_0x7afb('0x5b')],{})[_0x7afb('0x1e')](function(_0xd162a3){var _0x3f32b8=_0x329221[_0x7afb('0x5c')][_0x7afb('0x38')]({'plain':!![]});if(!_0x3f32b8)throw new Error(_0x7afb('0x5d'));if(_0x3f32b8[_0x7afb('0x5e')]===_0x7afb('0x5c')){var _0x2c3eff=_0xd162a3[_0x7afb('0x38')]({'plain':!![]});var _0x5080b0='ChatQueues';return db['UserProfileSection'][_0x7afb('0x5f')]({'where':{'name':_0x5080b0,'userProfileId':_0x3f32b8[_0x7afb('0x60')]},'raw':!![]})[_0x7afb('0x1e')](function(_0x3917d9){if(_0x3917d9&&_0x3917d9[_0x7afb('0x61')]===0x0){return db[_0x7afb('0x3a')][_0x7afb('0x5a')]({'name':_0x2c3eff[_0x7afb('0x3c')],'resourceId':_0x2c3eff['id'],'type':_0x3917d9[_0x7afb('0x3c')],'sectionId':_0x3917d9['id']},{})['then'](function(){return _0xd162a3;});}else{return _0xd162a3;}})[_0x7afb('0x28')](function(_0x13bc8c){logger[_0x7afb('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x13bc8c);throw _0x13bc8c;});}return _0xd162a3;})['then'](respondWithResult(_0x58c612,0xc9))[_0x7afb('0x28')](handleError(_0x58c612,null));};exports[_0x7afb('0x36')]=function(_0x359ed5,_0x3925ce){if(_0x359ed5[_0x7afb('0x5b')]['id']){delete _0x359ed5[_0x7afb('0x5b')]['id'];}return db[_0x7afb('0x40')][_0x7afb('0x5f')]({'where':{'id':_0x359ed5[_0x7afb('0x57')]['id']}})[_0x7afb('0x1e')](handleEntityNotFound(_0x3925ce,null))[_0x7afb('0x1e')](saveUpdates(_0x359ed5['body'],null))['then'](respondWithResult(_0x3925ce,null))[_0x7afb('0x28')](handleError(_0x3925ce,null));};exports[_0x7afb('0x37')]=function(_0x19ca70,_0x208df6){return db[_0x7afb('0x40')][_0x7afb('0x5f')]({'where':{'id':_0x19ca70[_0x7afb('0x57')]['id']}})[_0x7afb('0x1e')](handleEntityNotFound(_0x208df6,null))[_0x7afb('0x1e')](removeEntity(_0x208df6,null))[_0x7afb('0x28')](handleError(_0x208df6,null));};exports[_0x7afb('0x62')]=function(_0xdd5c03,_0x4020c5){return db[_0x7afb('0x40')][_0x7afb('0x62')]()[_0x7afb('0x1e')](respondWithResult(_0x4020c5,null))[_0x7afb('0x28')](handleError(_0x4020c5,null));};exports[_0x7afb('0x63')]=function(_0x1dc212,_0x38ee2f,_0x17ce87){var _0x542aa4={'raw':!![],'where':{}},_0x3b2fcc={},_0x5634c4;return db['ChatQueue'][_0x7afb('0x64')]({'where':{'id':_0x1dc212['params']['id']}})[_0x7afb('0x1e')](handleEntityNotFound(_0x38ee2f,null))[_0x7afb('0x1e')](function(_0x5800a1){if(_0x5800a1){_0x5634c4=_0x5800a1['get']({'plain':!![]});_0x3b2fcc['model']=_[_0x7afb('0x58')](db[_0x7afb('0x65')][_0x7afb('0x41')]);_0x3b2fcc['query']=_[_0x7afb('0x58')](_0x1dc212['query']);_0x3b2fcc[_0x7afb('0x44')]=_[_0x7afb('0x45')](_0x3b2fcc[_0x7afb('0x46')],_0x3b2fcc[_0x7afb('0x43')]);_0x542aa4['attributes']=_[_0x7afb('0x45')](_0x3b2fcc[_0x7afb('0x46')],qs[_0x7afb('0x48')](_0x1dc212[_0x7afb('0x43')][_0x7afb('0x48')]));_0x542aa4['attributes']=_0x542aa4[_0x7afb('0x47')]['length']?_0x542aa4[_0x7afb('0x47')]:_0x3b2fcc[_0x7afb('0x46')];if(!_0x1dc212[_0x7afb('0x43')][_0x7afb('0x4a')](_0x7afb('0x4b'))){_0x542aa4['limit']=qs['limit'](_0x1dc212[_0x7afb('0x43')][_0x7afb('0x2e')]);_0x542aa4[_0x7afb('0x2d')]=qs[_0x7afb('0x2d')](_0x1dc212[_0x7afb('0x43')]['offset']);}_0x542aa4[_0x7afb('0x66')]=qs[_0x7afb('0x4c')](_0x1dc212['query'][_0x7afb('0x4c')]);_0x542aa4[_0x7afb('0x4d')]=qs[_0x7afb('0x44')](_['pick'](_0x1dc212[_0x7afb('0x43')],_0x3b2fcc[_0x7afb('0x44')]));_0x542aa4[_0x7afb('0x4d')][_0x7afb('0x67')]=_0x5800a1['id'];if(_0x1dc212[_0x7afb('0x43')]['filter']){_0x542aa4['where']=_['merge'](_0x542aa4[_0x7afb('0x4d')],{'$or':_[_0x7afb('0x3f')](_0x542aa4[_0x7afb('0x47')],function(_0x168c1c){var _0x25da09={};_0x25da09[_0x168c1c]={'$like':'%'+_0x1dc212[_0x7afb('0x43')][_0x7afb('0x4f')]+'%'};return _0x25da09;})});}_0x542aa4=_[_0x7afb('0x50')]({},_0x542aa4,_0x1dc212[_0x7afb('0x59')]);return db['UserChatQueue'][_0x7afb('0x68')](_0x542aa4);}})[_0x7afb('0x1e')](function(_0x4338ab){if(_0x4338ab){return db['User']['findAndCountAll']({'where':{'id':_[_0x7afb('0x3f')](_0x4338ab,_0x7afb('0x69')),'role':_0x7afb('0x6a')},'attributes':['id',_0x7afb('0x3c'),_0x7afb('0x6b'),_0x7afb('0x6c'),_0x7afb('0x6d')]});}})[_0x7afb('0x1e')](function(_0x584cc0){if(_0x584cc0){return{'count':_0x584cc0[_0x7afb('0x30')],'rows':_[_0x7afb('0x3f')](_0x584cc0['rows'],function(_0x1587fe){return{'membername':_0x1587fe[_0x7afb('0x3c')],'UserId':_0x1587fe['id'],'queue_name':_0x5634c4[_0x7afb('0x3c')],'ChatQueueId':_0x5634c4['id'],'interface':util[_0x7afb('0x6e')](_0x7afb('0x6f'),_0x7afb('0x70'),_0x1587fe['name']),'penalty':0x0,'paused':_0x1587fe[_0x7afb('0x6b')],'createdAt':_0x1587fe[_0x7afb('0x6d')],'updatedAt':_0x1587fe['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x7afb('0x1e')](respondWithFilteredResult(_0x38ee2f,_0x542aa4))[_0x7afb('0x28')](handleError(_0x38ee2f,null));};exports[_0x7afb('0x71')]=function(_0x599e3a,_0x3386f6,_0x20974f){var _0x52d1bd={};var _0x3c563d={};var _0x7642a8;var _0x45ec2c;return db['ChatQueue']['findOne']({'where':{'id':_0x599e3a[_0x7afb('0x57')]['id']}})[_0x7afb('0x1e')](handleEntityNotFound(_0x3386f6,null))['then'](function(_0x2eaec6){if(_0x2eaec6){_0x7642a8=_0x2eaec6;_0x3c563d['model']=_[_0x7afb('0x58')](db[_0x7afb('0x72')][_0x7afb('0x41')]);_0x3c563d[_0x7afb('0x43')]=_[_0x7afb('0x58')](_0x599e3a[_0x7afb('0x43')]);_0x3c563d[_0x7afb('0x44')]=_[_0x7afb('0x45')](_0x3c563d[_0x7afb('0x46')],_0x3c563d[_0x7afb('0x43')]);_0x52d1bd[_0x7afb('0x47')]=_[_0x7afb('0x45')](_0x3c563d['model'],qs[_0x7afb('0x48')](_0x599e3a[_0x7afb('0x43')]['fields']));_0x52d1bd[_0x7afb('0x47')]=_0x52d1bd[_0x7afb('0x47')][_0x7afb('0x49')]?_0x52d1bd['attributes']:_0x3c563d[_0x7afb('0x46')];_0x52d1bd[_0x7afb('0x66')]=qs[_0x7afb('0x4c')](_0x599e3a['query']['sort']);_0x52d1bd[_0x7afb('0x4d')]=qs[_0x7afb('0x44')](_[_0x7afb('0x4e')](_0x599e3a[_0x7afb('0x43')],_0x3c563d['filters']));if(_0x599e3a[_0x7afb('0x43')]['filter']){_0x52d1bd['where']=_['merge'](_0x52d1bd[_0x7afb('0x4d')],{'$or':_[_0x7afb('0x3f')](_0x52d1bd[_0x7afb('0x47')],function(_0x2bc4ec){var _0x5a1dad={};_0x5a1dad[_0x2bc4ec]={'$like':'%'+_0x599e3a[_0x7afb('0x43')][_0x7afb('0x4f')]+'%'};return _0x5a1dad;})});}_0x52d1bd=_[_0x7afb('0x50')]({},_0x52d1bd,_0x599e3a['options']);return _0x7642a8[_0x7afb('0x71')](_0x52d1bd);}})[_0x7afb('0x1e')](function(_0x582fab){if(_0x582fab){_0x45ec2c=_0x582fab[_0x7afb('0x49')];if(!_0x599e3a[_0x7afb('0x43')]['hasOwnProperty']('nolimit')){_0x52d1bd[_0x7afb('0x2e')]=qs[_0x7afb('0x2e')](_0x599e3a[_0x7afb('0x43')][_0x7afb('0x2e')]);_0x52d1bd[_0x7afb('0x2d')]=qs[_0x7afb('0x2d')](_0x599e3a['query'][_0x7afb('0x2d')]);}return _0x7642a8[_0x7afb('0x71')](_0x52d1bd);}})[_0x7afb('0x1e')](function(_0x227429){if(_0x227429){return _0x227429?{'count':_0x45ec2c,'rows':_0x227429}:null;}})[_0x7afb('0x1e')](respondWithResult(_0x3386f6,null))[_0x7afb('0x28')](handleError(_0x3386f6,null));};exports[_0x7afb('0x73')]=function(_0x12ba75,_0x3b4674,_0x413523){var _0x149e9a=_0x12ba75[_0x7afb('0x5b')][_0x7afb('0x74')];return db[_0x7afb('0x72')][_0x7afb('0x68')]({'where':{'id':_0x149e9a},'attributes':['id'],'include':[{'model':db[_0x7afb('0x75')],'as':_0x7afb('0x76'),'attributes':['id',_0x7afb('0x3c'),_0x7afb('0x77'),_0x7afb('0x78'),_0x7afb('0x79')],'raw':!![]}]})[_0x7afb('0x1e')](function(_0x4f10d6){if(_0x4f10d6){var _0x1820aa=_[_0x7afb('0x7a')](_0x4f10d6,function(_0xc9e107){var _0x57980c=_0xc9e107[_0x7afb('0x38')]({'plain':!![]});return _0x57980c[_0x7afb('0x76')];});return db[_0x7afb('0x40')][_0x7afb('0x5f')]({'where':{'id':_0x12ba75[_0x7afb('0x57')]['id']}})['then'](function(_0x832855){return db[_0x7afb('0x7b')][_0x7afb('0x7c')](function(_0x5cd815){return _0x832855['addTeams'](_0x149e9a,{'transaction':_0x5cd815})[_0x7afb('0x1e')](function(){return BPromise[_0x7afb('0x7d')](_0x1820aa,function(_0x5e782b){return db[_0x7afb('0x65')]['findOrCreate']({'where':{'UserId':_0x5e782b['id'],'ChatQueueId':_0x12ba75[_0x7afb('0x57')]['id']},'transaction':_0x5cd815});});})['then'](function(){_0x1820aa[_0x7afb('0x7e')](function(_0x96bdcf){socket['emit'](_0x7afb('0x7f'),{'UserId':_0x96bdcf['id'],'ChatQueueId':_0x832855['id']});});});});});}})[_0x7afb('0x1e')](respondWithStatusCode(_0x3b4674,null))[_0x7afb('0x28')](handleError(_0x3b4674,null));};exports['removeTeams']=function(_0x491550,_0x2ebe7e,_0x32262c){return db[_0x7afb('0x72')]['findAll']({'where':{'id':_0x491550[_0x7afb('0x43')][_0x7afb('0x74')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7afb('0x76'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2ebe7e,null))[_0x7afb('0x1e')](function(_0x165de4){var _0x52e4d5=_[_0x7afb('0x3f')](_0x165de4,'id');var _0x30162d=[];var _0x1f6795=[];var _0x4827e4=squel[_0x7afb('0x80')]();_0x4827e4[_0x7afb('0x81')](_0x7afb('0x82'))['from']('team_has_chat_queues','tq')[_0x7afb('0x83')]('user_has_teams','ut',_0x7afb('0x84'))[_0x7afb('0x4d')](_0x7afb('0x85'),_0x491550[_0x7afb('0x57')]['id']);for(var _0x17021c=0x0;_0x17021c<_0x165de4[_0x7afb('0x49')];_0x17021c+=0x1){let _0x1d6a38=_0x165de4[_0x17021c];for(var _0x35badd=0x0;_0x35badd<_0x1d6a38[_0x7afb('0x76')][_0x7afb('0x49')];_0x35badd+=0x1){let _0xf14fb6=_0x1d6a38[_0x7afb('0x76')][_0x35badd];var _0x2dd7ef=_0x4827e4['clone']();_0x2dd7ef[_0x7afb('0x4d')]('ut.UserId\x20=\x20?',_0xf14fb6['id']);_0x1f6795[_0x7afb('0x86')](db[_0x7afb('0x7b')][_0x7afb('0x43')](_0x2dd7ef[_0x7afb('0x87')](),{'type':db[_0x7afb('0x7b')][_0x7afb('0x88')][_0x7afb('0x89')]})['then'](function(_0x18ca71){if(_0x18ca71[_0x7afb('0x49')]===0x1){return _0xf14fb6['id'];}else{var _0x1a8a2a=_[_0x7afb('0x8a')](_[_0x7afb('0x3f')](_0x18ca71,_0x7afb('0x8b')),function(_0x3587c6){return _[_0x7afb('0x8c')](_0x52e4d5,_0x3587c6);});if(_0x1a8a2a){return _0xf14fb6['id'];}}}));}}return BPromise[_0x7afb('0x8d')](_0x1f6795)[_0x7afb('0x1e')](function(_0x31f3f6){_0x30162d=_(_0x30162d)[_0x7afb('0x8e')](_0x31f3f6)[_0x7afb('0x8f')]()['value']();return db[_0x7afb('0x40')][_0x7afb('0x5f')]({'where':{'id':_0x491550[_0x7afb('0x57')]['id']}})[_0x7afb('0x1e')](function(_0x17e20f){return db[_0x7afb('0x7b')]['transaction'](function(_0x11cd9c){return _0x17e20f[_0x7afb('0x90')](_0x491550[_0x7afb('0x43')][_0x7afb('0x74')],{'transaction':_0x11cd9c})[_0x7afb('0x1e')](function(){if(!_['isEmpty'](_0x30162d)){return _0x17e20f[_0x7afb('0x91')](_0x30162d,{'transaction':_0x11cd9c});}})[_0x7afb('0x1e')](function(){_0x30162d[_0x7afb('0x7e')](function(_0x55d322){socket[_0x7afb('0x92')](_0x7afb('0x93'),{'UserId':_0x55d322,'ChatQueueId':_0x17e20f['id']});});});});});});})['then'](respondWithStatusCode(_0x2ebe7e,null))[_0x7afb('0x28')](handleError(_0x2ebe7e,null));};exports[_0x7afb('0x94')]=function(_0x135c34,_0x2a82f6,_0x4edbda){return db[_0x7afb('0x40')][_0x7afb('0x5f')]({'where':{'id':_0x135c34['params']['id']}})[_0x7afb('0x1e')](handleEntityNotFound(_0x2a82f6,null))[_0x7afb('0x1e')](function(_0x129b4e){if(_0x129b4e){return _0x129b4e[_0x7afb('0x94')](_0x135c34[_0x7afb('0x5b')][_0x7afb('0x74')],_[_0x7afb('0x95')](_0x135c34['body'],['ids','id'])||{})[_0x7afb('0x96')](function(_0x3fc206){for(var _0x43aecb=0x0;_0x43aecb<_0x135c34[_0x7afb('0x5b')][_0x7afb('0x74')]['length'];_0x43aecb+=0x1){socket['emit'](_0x7afb('0x7f'),{'UserId':Number(_0x135c34[_0x7afb('0x5b')][_0x7afb('0x74')][_0x43aecb]),'ChatQueueId':Number(_0x135c34[_0x7afb('0x57')]['id'])});}return _0x3fc206;});}})['then'](respondWithResult(_0x2a82f6,null))[_0x7afb('0x28')](handleError(_0x2a82f6,null));};exports['removeAgents']=function(_0x3a11c6,_0x4ff674,_0x405718){return db[_0x7afb('0x40')]['find']({'where':{'id':_0x3a11c6[_0x7afb('0x57')]['id']}})['then'](handleEntityNotFound(_0x4ff674,null))[_0x7afb('0x1e')](function(_0x4b3c42){if(_0x4b3c42){return _0x4b3c42[_0x7afb('0x91')](_0x3a11c6['query'][_0x7afb('0x74')])['then'](function(){if(_[_0x7afb('0x97')](_0x3a11c6[_0x7afb('0x43')]['ids'])){for(var _0x3b3fc9=0x0;_0x3b3fc9<_0x3a11c6[_0x7afb('0x43')][_0x7afb('0x74')][_0x7afb('0x49')];_0x3b3fc9+=0x1){socket['emit'](_0x7afb('0x93'),{'UserId':Number(_0x3a11c6['query'][_0x7afb('0x74')][_0x3b3fc9]),'ChatQueueId':Number(_0x3a11c6[_0x7afb('0x57')]['id'])});}}else{socket['emit'](_0x7afb('0x93'),{'UserId':Number(_0x3a11c6[_0x7afb('0x43')][_0x7afb('0x74')]),'ChatQueueId':Number(_0x3a11c6['params']['id'])});}});}})[_0x7afb('0x1e')](respondWithStatusCode(_0x4ff674,null))[_0x7afb('0x28')](handleError(_0x4ff674,null));};exports[_0x7afb('0x98')]=function(_0xbfe7bb,_0x1bebb1,_0x24db4d){var _0x24da6e={};var _0x21077d={};var _0x4de3bf;var _0x4fc021;return db[_0x7afb('0x40')]['findOne']({'where':{'id':_0xbfe7bb['params']['id']}})[_0x7afb('0x1e')](handleEntityNotFound(_0x1bebb1,null))[_0x7afb('0x1e')](function(_0x2a989f){if(_0x2a989f){_0x4de3bf=_0x2a989f;_0x21077d['model']=_[_0x7afb('0x58')](db[_0x7afb('0x75')][_0x7afb('0x41')]);_0x21077d['query']=_['keys'](_0xbfe7bb[_0x7afb('0x43')]);_0x21077d[_0x7afb('0x44')]=_[_0x7afb('0x45')](_0x21077d[_0x7afb('0x46')],_0x21077d['query']);_0x24da6e[_0x7afb('0x47')]=_['intersection'](_0x21077d[_0x7afb('0x46')],qs['fields'](_0xbfe7bb[_0x7afb('0x43')][_0x7afb('0x48')]));_0x24da6e[_0x7afb('0x47')]=_0x24da6e[_0x7afb('0x47')][_0x7afb('0x49')]?_0x24da6e[_0x7afb('0x47')]:_0x21077d[_0x7afb('0x46')];_0x24da6e['order']=qs[_0x7afb('0x4c')](_0xbfe7bb[_0x7afb('0x43')][_0x7afb('0x4c')]);_0x24da6e[_0x7afb('0x4d')]=qs[_0x7afb('0x44')](_[_0x7afb('0x4e')](_0xbfe7bb[_0x7afb('0x43')],_0x21077d[_0x7afb('0x44')]));if(_0xbfe7bb[_0x7afb('0x43')][_0x7afb('0x4f')]){_0x24da6e[_0x7afb('0x4d')]=_[_0x7afb('0x50')](_0x24da6e['where'],{'$or':_[_0x7afb('0x3f')](_0x24da6e[_0x7afb('0x47')],function(_0x45e008){var _0x1cca03={};_0x1cca03[_0x45e008]={'$like':'%'+_0xbfe7bb[_0x7afb('0x43')][_0x7afb('0x4f')]+'%'};return _0x1cca03;})});}_0x24da6e=_[_0x7afb('0x50')]({},_0x24da6e,_0xbfe7bb['options']);return _0x4de3bf[_0x7afb('0x98')](_0x24da6e);}})[_0x7afb('0x1e')](function(_0x12c126){if(_0x12c126){_0x4fc021=_0x12c126[_0x7afb('0x49')];if(!_0xbfe7bb[_0x7afb('0x43')]['hasOwnProperty'](_0x7afb('0x4b'))){_0x24da6e[_0x7afb('0x2e')]=qs['limit'](_0xbfe7bb['query']['limit']);_0x24da6e[_0x7afb('0x2d')]=qs['offset'](_0xbfe7bb[_0x7afb('0x43')]['offset']);}return _0x4de3bf[_0x7afb('0x98')](_0x24da6e);}})[_0x7afb('0x1e')](function(_0x3b2697){if(_0x3b2697){return _0x3b2697?{'count':_0x4fc021,'rows':_0x3b2697}:null;}})['then'](respondWithResult(_0x1bebb1,null))[_0x7afb('0x28')](handleError(_0x1bebb1,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 3ab74ba..6fbd00e 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 _0xaf76=['save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners'];(function(_0x5eac87,_0x152105){var _0x3de3e1=function(_0x488e5d){while(--_0x488e5d){_0x5eac87['push'](_0x5eac87['shift']());}};_0x3de3e1(++_0x152105);}(_0xaf76,0x1b6));var _0x6af7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaf76[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x6af7('0x0'));var ChatQueue=require(_0x6af7('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x6af7('0x2')](0x0);var events={'afterCreate':_0x6af7('0x3'),'afterUpdate':_0x6af7('0x4'),'afterDestroy':_0x6af7('0x5')};function emitEvent(_0x57d1e3){return function(_0x560e59,_0x4a9726,_0x53c745){ChatQueueEvents[_0x6af7('0x6')](_0x57d1e3+':'+_0x560e59['id'],_0x560e59);ChatQueueEvents['emit'](_0x57d1e3,_0x560e59);_0x53c745(null);};}for(var e in events){if(events[_0x6af7('0x7')](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0x6af7('0x8')]=ChatQueueEvents; \ No newline at end of file +var _0x321e=['../../mysqldb','ChatQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x46f81c,_0x220ad7){var _0x1e0f99=function(_0x2bd6cf){while(--_0x2bd6cf){_0x46f81c['push'](_0x46f81c['shift']());}};_0x1e0f99(++_0x220ad7);}(_0x321e,0xba));var _0xe321=function(_0x246c77,_0x568234){_0x246c77=_0x246c77-0x0;var _0x2d5192=_0x321e[_0x246c77];return _0x2d5192;};'use strict';var EventEmitter=require(_0xe321('0x0'));var ChatQueue=require(_0xe321('0x1'))['db'][_0xe321('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xe321('0x3')](0x0);var events={'afterCreate':_0xe321('0x4'),'afterUpdate':_0xe321('0x5'),'afterDestroy':_0xe321('0x6')};function emitEvent(_0x5bbfb1){return function(_0x105035,_0x488c2b,_0x403d07){ChatQueueEvents[_0xe321('0x7')](_0x5bbfb1+':'+_0x105035['id'],_0x105035);ChatQueueEvents[_0xe321('0x7')](_0x5bbfb1,_0x105035);_0x403d07(null);};}for(var e in events){if(events[_0xe321('0x8')](e)){var event=events[e];ChatQueue[_0xe321('0x9')](e,emitEvent(event));}}module[_0xe321('0xa')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index f0e2d81..23254df 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 _0x4dde=['./chatQueue.attributes','ChatQueue','chat_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x4ba785,_0xad6b18){var _0x158750=function(_0x5dff8b){while(--_0x5dff8b){_0x4ba785['push'](_0x4ba785['shift']());}};_0x158750(++_0xad6b18);}(_0x4dde,0x6f));var _0xe4dd=function(_0x135800,_0x2f6fdc){_0x135800=_0x135800-0x0;var _0x3ae888=_0x4dde[_0x135800];return _0x3ae888;};'use strict';var _=require(_0xe4dd('0x0'));var util=require(_0xe4dd('0x1'));var logger=require(_0xe4dd('0x2'))(_0xe4dd('0x3'));var moment=require(_0xe4dd('0x4'));var BPromise=require(_0xe4dd('0x5'));var rp=require(_0xe4dd('0x6'));var fs=require('fs');var path=require(_0xe4dd('0x7'));var rimraf=require('rimraf');var config=require(_0xe4dd('0x8'));var attributes=require(_0xe4dd('0x9'));module['exports']=function(_0x2eb251,_0x2b571b){return _0x2eb251['define'](_0xe4dd('0xa'),attributes,{'tableName':_0xe4dd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x817b=['bluebird','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports','define','chat_queues','lodash','util','../../config/logger','api'];(function(_0x3a6c08,_0x3ee204){var _0x54957a=function(_0x2668a9){while(--_0x2668a9){_0x3a6c08['push'](_0x3a6c08['shift']());}};_0x54957a(++_0x3ee204);}(_0x817b,0x100));var _0xb817=function(_0x518eda,_0x26d575){_0x518eda=_0x518eda-0x0;var _0x163c1d=_0x817b[_0x518eda];return _0x163c1d;};'use strict';var _=require(_0xb817('0x0'));var util=require(_0xb817('0x1'));var logger=require(_0xb817('0x2'))(_0xb817('0x3'));var moment=require('moment');var BPromise=require(_0xb817('0x4'));var rp=require(_0xb817('0x5'));var fs=require('fs');var path=require(_0xb817('0x6'));var rimraf=require(_0xb817('0x7'));var config=require(_0xb817('0x8'));var attributes=require(_0xb817('0x9'));module[_0xb817('0xa')]=function(_0x54f5fb,_0x14e85c){return _0x54f5fb[_0xb817('0xb')]('ChatQueue',attributes,{'tableName':_0xb817('0xc'),'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 7ad845a..a06baf3 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 _0x56a4=['where','map','include','model','attributes','then','catch','find','raw','ShowChatQueue','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','register','request','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetChatQueue','options'];(function(_0x11c6b8,_0x5b2d7b){var _0x38b38f=function(_0x641ad0){while(--_0x641ad0){_0x11c6b8['push'](_0x11c6b8['shift']());}};_0x38b38f(++_0x5b2d7b);}(_0x56a4,0x73));var _0x456a=function(_0x599d7f,_0xc586e8){_0x599d7f=_0x599d7f-0x0;var _0x3346d3=_0x56a4[_0x599d7f];return _0x3346d3;};'use strict';var _=require('lodash');var util=require(_0x456a('0x0'));var moment=require(_0x456a('0x1'));var BPromise=require(_0x456a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x456a('0x3'))['db'];var utils=require(_0x456a('0x4'));var logger=require(_0x456a('0x5'))(_0x456a('0x6'));var config=require(_0x456a('0x7'));var jayson=require(_0x456a('0x8'));var client=jayson[_0x456a('0x9')][_0x456a('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x456a('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x456a('0xb')]));require('./chatQueue.socket')[_0x456a('0xc')](socket);function respondWithRpcPromise(_0x86bcda,_0x177988,_0x2e5f10){return new BPromise(function(_0x12f945,_0x56f14c){return client[_0x456a('0xd')](_0x86bcda,_0x2e5f10)['then'](function(_0x59f11c){logger[_0x456a('0xe')](_0x456a('0xf'),_0x177988,_0x456a('0x10'));logger[_0x456a('0x11')](_0x456a('0x12'),_0x177988,_0x456a('0x10'),JSON[_0x456a('0x13')](_0x59f11c));if(_0x59f11c['error']){if(_0x59f11c[_0x456a('0x14')]['code']===0x1f4){logger[_0x456a('0x14')]('ChatQueue,\x20%s,\x20%s',_0x177988,_0x59f11c[_0x456a('0x14')]['message']);return _0x56f14c(_0x59f11c[_0x456a('0x14')]['message']);}logger[_0x456a('0x14')]('ChatQueue,\x20%s,\x20%s',_0x177988,_0x59f11c[_0x456a('0x14')][_0x456a('0x15')]);return _0x12f945(_0x59f11c[_0x456a('0x14')][_0x456a('0x15')]);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x177988,_0x456a('0x10'));_0x12f945(_0x59f11c[_0x456a('0x16')][_0x456a('0x15')]);}})['catch'](function(_0x5aaf40){logger[_0x456a('0x14')](_0x456a('0xf'),_0x177988,_0x5aaf40);_0x56f14c(_0x5aaf40);});});}exports[_0x456a('0x17')]=function(_0x5aff8b){var _0x202877=this;return new Promise(function(_0x2db147,_0x1378ae){return db['ChatQueue']['findAll']({'raw':_0x5aff8b['options']?_0x5aff8b[_0x456a('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5aff8b[_0x456a('0x18')]?_0x5aff8b['options'][_0x456a('0x19')]||null:null,'attributes':_0x5aff8b[_0x456a('0x18')]?_0x5aff8b[_0x456a('0x18')]['attributes']||null:null,'limit':_0x5aff8b['options']?_0x5aff8b[_0x456a('0x18')]['limit']||null:null,'include':_0x5aff8b[_0x456a('0x18')]?_0x5aff8b[_0x456a('0x18')]['include']?_[_0x456a('0x1a')](_0x5aff8b[_0x456a('0x18')][_0x456a('0x1b')],function(_0x3f8967){return{'model':db[_0x3f8967[_0x456a('0x1c')]],'as':_0x3f8967['as'],'attributes':_0x3f8967[_0x456a('0x1d')],'include':_0x3f8967['include']?_[_0x456a('0x1a')](_0x3f8967['include'],function(_0x2f7e93){return{'model':db[_0x2f7e93[_0x456a('0x1c')]],'as':_0x2f7e93['as'],'attributes':_0x2f7e93['attributes'],'include':_0x2f7e93[_0x456a('0x1b')]?_['map'](_0x2f7e93[_0x456a('0x1b')],function(_0x3097fb){return{'model':db[_0x3097fb[_0x456a('0x1c')]],'as':_0x3097fb['as'],'attributes':_0x3097fb['attributes']};}):[]};}):[]};}):[]:[]})[_0x456a('0x1e')](function(_0x25287a){logger[_0x456a('0xe')](_0x456a('0x17'),_0x5aff8b);logger[_0x456a('0x11')](_0x456a('0x17'),_0x5aff8b,JSON[_0x456a('0x13')](_0x25287a));_0x2db147(_0x25287a);})[_0x456a('0x1f')](function(_0x1b9af6){logger[_0x456a('0x14')]('GetChatQueue',_0x1b9af6[_0x456a('0x15')],_0x5aff8b);_0x1378ae(_0x202877[_0x456a('0x14')](0x1f4,_0x1b9af6[_0x456a('0x15')]));});});};exports['ShowChatQueue']=function(_0x1ef547){var _0x6d6e3c=this;return new Promise(function(_0x40445d,_0x21f232){return db['ChatQueue'][_0x456a('0x20')]({'raw':_0x1ef547[_0x456a('0x18')]?_0x1ef547[_0x456a('0x18')][_0x456a('0x21')]===undefined?!![]:![]:!![],'where':_0x1ef547['options']?_0x1ef547[_0x456a('0x18')]['where']||null:null,'attributes':_0x1ef547[_0x456a('0x18')]?_0x1ef547[_0x456a('0x18')][_0x456a('0x1d')]||null:null,'include':_0x1ef547['options']?_0x1ef547['options'][_0x456a('0x1b')]?_[_0x456a('0x1a')](_0x1ef547['options']['include'],function(_0x3c308b){return{'model':db[_0x3c308b['model']],'as':_0x3c308b['as'],'attributes':_0x3c308b[_0x456a('0x1d')],'include':_0x3c308b['include']?_[_0x456a('0x1a')](_0x3c308b[_0x456a('0x1b')],function(_0x1b234d){return{'model':db[_0x1b234d[_0x456a('0x1c')]],'as':_0x1b234d['as'],'attributes':_0x1b234d[_0x456a('0x1d')],'include':_0x1b234d[_0x456a('0x1b')]?_[_0x456a('0x1a')](_0x1b234d[_0x456a('0x1b')],function(_0x307440){return{'model':db[_0x307440['model']],'as':_0x307440['as'],'attributes':_0x307440['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5886ed){logger['info'](_0x456a('0x22'),_0x1ef547);logger[_0x456a('0x11')](_0x456a('0x22'),_0x1ef547,JSON[_0x456a('0x13')](_0x5886ed));_0x40445d(_0x5886ed);})[_0x456a('0x1f')](function(_0x2a8527){logger[_0x456a('0x14')](_0x456a('0x22'),_0x2a8527['message'],_0x1ef547);_0x21f232(_0x6d6e3c[_0x456a('0x14')](0x1f4,_0x2a8527[_0x456a('0x15')]));});});}; \ No newline at end of file +var _0x173d=['map','model','ShowChatQueue','ChatQueue','find','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','socket.io-emitter','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetChatQueue','findAll','options','raw','where','attributes','limit','include'];(function(_0x2c7879,_0x164f1b){var _0x2dc765=function(_0x52a6f3){while(--_0x52a6f3){_0x2c7879['push'](_0x2c7879['shift']());}};_0x2dc765(++_0x164f1b);}(_0x173d,0x108));var _0xd173=function(_0x239996,_0x20b354){_0x239996=_0x239996-0x0;var _0x1ef000=_0x173d[_0x239996];return _0x1ef000;};'use strict';var _=require('lodash');var util=require(_0xd173('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd173('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd173('0x2'))['db'];var utils=require(_0xd173('0x3'));var logger=require(_0xd173('0x4'))(_0xd173('0x5'));var config=require(_0xd173('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xd173('0x7')][_0xd173('0x8')]({'port':0x232a});config[_0xd173('0x9')]=_['defaults'](config[_0xd173('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xd173('0xa'))(new Redis(config['redis']));require('./chatQueue.socket')[_0xd173('0xb')](socket);function respondWithRpcPromise(_0x40aece,_0x4f37ea,_0x2ac519){return new BPromise(function(_0x1e1bd5,_0x4b0ac9){return client[_0xd173('0xc')](_0x40aece,_0x2ac519)[_0xd173('0xd')](function(_0x1b4bd1){logger[_0xd173('0xe')](_0xd173('0xf'),_0x4f37ea,_0xd173('0x10'));logger[_0xd173('0x11')](_0xd173('0x12'),_0x4f37ea,_0xd173('0x10'),JSON[_0xd173('0x13')](_0x1b4bd1));if(_0x1b4bd1[_0xd173('0x14')]){if(_0x1b4bd1[_0xd173('0x14')]['code']===0x1f4){logger[_0xd173('0x14')]('ChatQueue,\x20%s,\x20%s',_0x4f37ea,_0x1b4bd1[_0xd173('0x14')][_0xd173('0x15')]);return _0x4b0ac9(_0x1b4bd1['error'][_0xd173('0x15')]);}logger[_0xd173('0x14')](_0xd173('0xf'),_0x4f37ea,_0x1b4bd1[_0xd173('0x14')]['message']);return _0x1e1bd5(_0x1b4bd1['error'][_0xd173('0x15')]);}else{logger[_0xd173('0xe')](_0xd173('0xf'),_0x4f37ea,'request\x20sent');_0x1e1bd5(_0x1b4bd1[_0xd173('0x16')][_0xd173('0x15')]);}})[_0xd173('0x17')](function(_0x262eac){logger['error']('ChatQueue,\x20%s,\x20%s',_0x4f37ea,_0x262eac);_0x4b0ac9(_0x262eac);});});}exports[_0xd173('0x18')]=function(_0xec34f9){var _0x38be1d=this;return new Promise(function(_0x35c2d8,_0x58e9ff){return db['ChatQueue'][_0xd173('0x19')]({'raw':_0xec34f9[_0xd173('0x1a')]?_0xec34f9['options'][_0xd173('0x1b')]===undefined?!![]:![]:!![],'where':_0xec34f9[_0xd173('0x1a')]?_0xec34f9['options'][_0xd173('0x1c')]||null:null,'attributes':_0xec34f9[_0xd173('0x1a')]?_0xec34f9['options'][_0xd173('0x1d')]||null:null,'limit':_0xec34f9[_0xd173('0x1a')]?_0xec34f9['options'][_0xd173('0x1e')]||null:null,'include':_0xec34f9[_0xd173('0x1a')]?_0xec34f9[_0xd173('0x1a')][_0xd173('0x1f')]?_[_0xd173('0x20')](_0xec34f9[_0xd173('0x1a')]['include'],function(_0x57f971){return{'model':db[_0x57f971[_0xd173('0x21')]],'as':_0x57f971['as'],'attributes':_0x57f971[_0xd173('0x1d')],'include':_0x57f971[_0xd173('0x1f')]?_[_0xd173('0x20')](_0x57f971[_0xd173('0x1f')],function(_0x378a07){return{'model':db[_0x378a07[_0xd173('0x21')]],'as':_0x378a07['as'],'attributes':_0x378a07[_0xd173('0x1d')],'include':_0x378a07['include']?_['map'](_0x378a07[_0xd173('0x1f')],function(_0x15035c){return{'model':db[_0x15035c['model']],'as':_0x15035c['as'],'attributes':_0x15035c['attributes']};}):[]};}):[]};}):[]:[]})[_0xd173('0xd')](function(_0x38a389){logger[_0xd173('0xe')](_0xd173('0x18'),_0xec34f9);logger[_0xd173('0x11')](_0xd173('0x18'),_0xec34f9,JSON['stringify'](_0x38a389));_0x35c2d8(_0x38a389);})['catch'](function(_0x142273){logger[_0xd173('0x14')]('GetChatQueue',_0x142273[_0xd173('0x15')],_0xec34f9);_0x58e9ff(_0x38be1d[_0xd173('0x14')](0x1f4,_0x142273[_0xd173('0x15')]));});});};exports[_0xd173('0x22')]=function(_0x1def05){var _0x4dfcd8=this;return new Promise(function(_0x4957d4,_0x5f4ea4){return db[_0xd173('0x23')][_0xd173('0x24')]({'raw':_0x1def05['options']?_0x1def05[_0xd173('0x1a')][_0xd173('0x1b')]===undefined?!![]:![]:!![],'where':_0x1def05[_0xd173('0x1a')]?_0x1def05[_0xd173('0x1a')][_0xd173('0x1c')]||null:null,'attributes':_0x1def05['options']?_0x1def05[_0xd173('0x1a')][_0xd173('0x1d')]||null:null,'include':_0x1def05[_0xd173('0x1a')]?_0x1def05[_0xd173('0x1a')][_0xd173('0x1f')]?_[_0xd173('0x20')](_0x1def05['options'][_0xd173('0x1f')],function(_0x3b0855){return{'model':db[_0x3b0855[_0xd173('0x21')]],'as':_0x3b0855['as'],'attributes':_0x3b0855['attributes'],'include':_0x3b0855['include']?_[_0xd173('0x20')](_0x3b0855[_0xd173('0x1f')],function(_0x37ef2d){return{'model':db[_0x37ef2d['model']],'as':_0x37ef2d['as'],'attributes':_0x37ef2d[_0xd173('0x1d')],'include':_0x37ef2d[_0xd173('0x1f')]?_[_0xd173('0x20')](_0x37ef2d[_0xd173('0x1f')],function(_0x2ceec8){return{'model':db[_0x2ceec8['model']],'as':_0x2ceec8['as'],'attributes':_0x2ceec8[_0xd173('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x19a966){logger[_0xd173('0xe')](_0xd173('0x22'),_0x1def05);logger['debug']('ShowChatQueue',_0x1def05,JSON[_0xd173('0x13')](_0x19a966));_0x4957d4(_0x19a966);})['catch'](function(_0x22808d){logger[_0xd173('0x14')]('ShowChatQueue',_0x22808d['message'],_0x1def05);_0x5f4ea4(_0x4dfcd8[_0xd173('0x14')](0x1f4,_0x22808d[_0xd173('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index cc415b9..dbe9649 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 _0xc368=['removeListener','register','length','chatQueue:','save','update','emit'];(function(_0x1d14a4,_0x3d0375){var _0x5cae92=function(_0x332f16){while(--_0x332f16){_0x1d14a4['push'](_0x1d14a4['shift']());}};_0x5cae92(++_0x3d0375);}(_0xc368,0x7b));var _0x8c36=function(_0x5717e6,_0x2428d5){_0x5717e6=_0x5717e6-0x0;var _0x19aeb2=_0xc368[_0x5717e6];return _0x19aeb2;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0x8c36('0x0'),'remove',_0x8c36('0x1')];function createListener(_0x17fa33,_0x20e697){return function(_0x2640c5){_0x20e697[_0x8c36('0x2')](_0x17fa33,_0x2640c5);};}function removeListener(_0x5d3b27,_0x3e9034){return function(){ChatQueueEvents[_0x8c36('0x3')](_0x5d3b27,_0x3e9034);};}exports[_0x8c36('0x4')]=function(_0x1d3660){for(var _0x5ebfc1=0x0,_0x554022=events[_0x8c36('0x5')];_0x5ebfc1<_0x554022;_0x5ebfc1++){var _0x384867=events[_0x5ebfc1];var _0x3e76be=createListener(_0x8c36('0x6')+_0x384867,_0x1d3660);ChatQueueEvents['on'](_0x384867,_0x3e76be);}}; \ No newline at end of file +var _0xc3b5=['length','remove','update','emit','register'];(function(_0x462285,_0xf42831){var _0x891594=function(_0x2b525e){while(--_0x2b525e){_0x462285['push'](_0x462285['shift']());}};_0x891594(++_0xf42831);}(_0xc3b5,0x6f));var _0x5c3b=function(_0x46afc4,_0x1d874f){_0x46afc4=_0x46afc4-0x0;var _0x295829=_0xc3b5[_0x46afc4];return _0x295829;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=['save',_0x5c3b('0x0'),_0x5c3b('0x1')];function createListener(_0xbe95d4,_0x3acf12){return function(_0x2f9a72){_0x3acf12[_0x5c3b('0x2')](_0xbe95d4,_0x2f9a72);};}function removeListener(_0x237a61,_0x48f8a1){return function(){ChatQueueEvents['removeListener'](_0x237a61,_0x48f8a1);};}exports[_0x5c3b('0x3')]=function(_0x6b8a1e){for(var _0x56345e=0x0,_0x568a28=events[_0x5c3b('0x4')];_0x56345e<_0x568a28;_0x56345e++){var _0x420839=events[_0x56345e];var _0x3892ad=createListener('chatQueue:'+_0x420839,_0x6b8a1e);ChatQueueEvents['on'](_0x420839,_0x3892ad);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 0e02e88..6e0e42b 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 _0x55ca=['post','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','index','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','addTeams'];(function(_0x11f6a1,_0x4b3ec7){var _0x3df8a2=function(_0xdd0d48){while(--_0xdd0d48){_0x11f6a1['push'](_0x11f6a1['shift']());}};_0x3df8a2(++_0x4b3ec7);}(_0x55ca,0x126));var _0xa55c=function(_0x52e9e3,_0xe465a7){_0x52e9e3=_0x52e9e3-0x0;var _0x960a8d=_0x55ca[_0x52e9e3];return _0x960a8d;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/describe',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['show']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getAgents']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/teams',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x13')]);router['put'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router[_0xa55c('0x15')](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x16')]);router[_0xa55c('0x15')](_0xa55c('0xe'),auth['isAuthenticated'](),controller[_0xa55c('0x17')]);router[_0xa55c('0x15')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x18')]);module[_0xa55c('0x19')]=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(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x5fc3,0xa8));var _0x35fc=function(_0x237da8,_0x37b77a){_0x237da8=_0x237da8-0x0;var _0x558825=_0x5fc3[_0x237da8];return _0x558825;};'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 7494f32..4429b84 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 _0x2c79=['STRING','DATE','moment','sequelize'];(function(_0x2e5a67,_0x37dadb){var _0x1f37b9=function(_0x47a076){while(--_0x47a076){_0x2e5a67['push'](_0x2e5a67['shift']());}};_0x1f37b9(++_0x37dadb);}(_0x2c79,0x102));var _0x92c7=function(_0x5bfef4,_0x57e1aa){_0x5bfef4=_0x5bfef4-0x0;var _0x363045=_0x2c79[_0x5bfef4];return _0x363045;};'use strict';var moment=require(_0x92c7('0x0'));var Sequelize=require(_0x92c7('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x92c7('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x92c7('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x92c7('0x3')]},'acceptAt':{'type':Sequelize[_0x92c7('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x92c7('0x2')]}}; \ No newline at end of file +var _0xb8ec=['STRING','DATE','moment'];(function(_0xd9e62f,_0x3e3c86){var _0x287092=function(_0x56de56){while(--_0x56de56){_0xd9e62f['push'](_0xd9e62f['shift']());}};_0x287092(++_0x3e3c86);}(_0xb8ec,0x98));var _0xcb8e=function(_0x1e0b6b,_0xf1071d){_0x1e0b6b=_0x1e0b6b-0x0;var _0x358b32=_0xb8ec[_0x1e0b6b];return _0x358b32;};'use strict';var moment=require(_0xcb8e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xcb8e('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xcb8e('0x1')]},'joinAt':{'type':Sequelize[_0xcb8e('0x2')]},'leaveAt':{'type':Sequelize[_0xcb8e('0x2')]},'acceptAt':{'type':Sequelize[_0xcb8e('0x2')]},'exitAt':{'type':Sequelize[_0xcb8e('0x2')]},'reason':{'type':Sequelize[_0xcb8e('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 275f311..56b5a28 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 _0xfc91=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','rows','catch','show','params','intersection','include','find','create','body','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','set','Content-Range','reject','save','update','destroy','then','sendStatus','stack','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','model','query','keys','filters'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xfc91,0xb5));var _0x1fc9=function(_0x3e7703,_0x4ead9a){_0x3e7703=_0x3e7703-0x0;var _0xf8c99a=_0xfc91[_0x3e7703];return _0xf8c99a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1fc9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1fc9('0x1'));var rp=require(_0x1fc9('0x2'));var moment=require(_0x1fc9('0x3'));var BPromise=require(_0x1fc9('0x4'));var Mustache=require(_0x1fc9('0x5'));var util=require(_0x1fc9('0x6'));var path=require(_0x1fc9('0x7'));var sox=require(_0x1fc9('0x8'));var csv=require(_0x1fc9('0x9'));var ejs=require(_0x1fc9('0xa'));var fs=require('fs');var fs_extra=require(_0x1fc9('0xb'));var _=require(_0x1fc9('0xc'));var squel=require('squel');var crypto=require(_0x1fc9('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1fc9('0x9'));var querystring=require(_0x1fc9('0xe'));var Papa=require(_0x1fc9('0xf'));var Redis=require(_0x1fc9('0x10'));var authService=require(_0x1fc9('0x11'));var qs=require(_0x1fc9('0x12'));var as=require(_0x1fc9('0x13'));var hardwareService=require(_0x1fc9('0x14'));var logger=require(_0x1fc9('0x15'))(_0x1fc9('0x16'));var utils=require(_0x1fc9('0x17'));var config=require(_0x1fc9('0x18'));var licenseUtil=require(_0x1fc9('0x19'));var db=require(_0x1fc9('0x1a'))['db'];function respondWithStatusCode(_0x2ef956,_0x37629a){_0x37629a=_0x37629a||0xcc;return function(_0x32d8ab){if(_0x32d8ab){return _0x2ef956['sendStatus'](_0x37629a);}return _0x2ef956[_0x1fc9('0x1b')](_0x37629a)[_0x1fc9('0x1c')]();};}function respondWithResult(_0x47f51b,_0x47670a){_0x47670a=_0x47670a||0xc8;return function(_0x39fe61){if(_0x39fe61){return _0x47f51b[_0x1fc9('0x1b')](_0x47670a)[_0x1fc9('0x1d')](_0x39fe61);}};}function respondWithFilteredResult(_0x3e0c75,_0x373e71){return function(_0x5e4787){if(_0x5e4787){var _0x4e46b7=typeof _0x373e71[_0x1fc9('0x1e')]==='undefined'&&typeof _0x373e71[_0x1fc9('0x1f')]==='undefined';var _0x533635=_0x5e4787[_0x1fc9('0x20')];var _0x1d05ab=_0x4e46b7?0x0:_0x373e71[_0x1fc9('0x1e')];var _0x40efef=_0x4e46b7?_0x5e4787[_0x1fc9('0x20')]:_0x373e71[_0x1fc9('0x1e')]+_0x373e71[_0x1fc9('0x1f')];var _0x1392fa;if(_0x40efef>=_0x533635){_0x40efef=_0x533635;_0x1392fa=0xc8;}else{_0x1392fa=0xce;}_0x3e0c75[_0x1fc9('0x1b')](_0x1392fa);return _0x3e0c75[_0x1fc9('0x21')](_0x1fc9('0x22'),_0x1d05ab+'-'+_0x40efef+'/'+_0x533635)[_0x1fc9('0x1d')](_0x5e4787);}return null;};}function patchUpdates(_0x1ddde2){return function(_0x19d9bd){try{jsonpatch['apply'](_0x19d9bd,_0x1ddde2,!![]);}catch(_0x56a867){return BPromise[_0x1fc9('0x23')](_0x56a867);}return _0x19d9bd[_0x1fc9('0x24')]();};}function saveUpdates(_0x36123d,_0x56a342){return function(_0x524e1a){if(_0x524e1a){return _0x524e1a[_0x1fc9('0x25')](_0x36123d)['then'](function(_0x528aa5){return _0x528aa5;});}return null;};}function removeEntity(_0x5a73fd,_0x14c02c){return function(_0x58f4ec){if(_0x58f4ec){return _0x58f4ec[_0x1fc9('0x26')]()[_0x1fc9('0x27')](function(){_0x5a73fd['status'](0xcc)[_0x1fc9('0x1c')]();});}};}function handleEntityNotFound(_0x4f1598,_0x59c293){return function(_0x24cb50){if(!_0x24cb50){_0x4f1598[_0x1fc9('0x28')](0x194);}return _0x24cb50;};}function handleError(_0x2ae7e2,_0x29bf4){_0x29bf4=_0x29bf4||0x1f4;return function(_0x1dfbbc){logger['error'](_0x1dfbbc[_0x1fc9('0x29')]);if(_0x1dfbbc[_0x1fc9('0x2a')]){delete _0x1dfbbc['name'];}_0x2ae7e2[_0x1fc9('0x1b')](_0x29bf4)[_0x1fc9('0x2b')](_0x1dfbbc);};}exports[_0x1fc9('0x2c')]=function(_0x538d5f,_0x19a8e1){var _0x2aa669={},_0x19e270={},_0x31ba25={'count':0x0,'rows':[]};var _0x16f3a4=_[_0x1fc9('0x2d')](db[_0x1fc9('0x2e')][_0x1fc9('0x2f')],function(_0x5dfb6b){return{'name':_0x5dfb6b[_0x1fc9('0x30')],'type':_0x5dfb6b['type']['key']};});_0x19e270[_0x1fc9('0x31')]=_[_0x1fc9('0x2d')](_0x16f3a4,_0x1fc9('0x2a'));_0x19e270[_0x1fc9('0x32')]=_[_0x1fc9('0x33')](_0x538d5f[_0x1fc9('0x32')]);_0x19e270[_0x1fc9('0x34')]=_['intersection'](_0x19e270['model'],_0x19e270[_0x1fc9('0x32')]);_0x2aa669[_0x1fc9('0x35')]=_['intersection'](_0x19e270['model'],qs[_0x1fc9('0x36')](_0x538d5f['query'][_0x1fc9('0x36')]));_0x2aa669[_0x1fc9('0x35')]=_0x2aa669[_0x1fc9('0x35')][_0x1fc9('0x37')]?_0x2aa669[_0x1fc9('0x35')]:_0x19e270[_0x1fc9('0x31')];if(!_0x538d5f[_0x1fc9('0x32')][_0x1fc9('0x38')](_0x1fc9('0x39'))){_0x2aa669[_0x1fc9('0x1f')]=qs[_0x1fc9('0x1f')](_0x538d5f[_0x1fc9('0x32')][_0x1fc9('0x1f')]);_0x2aa669[_0x1fc9('0x1e')]=qs[_0x1fc9('0x1e')](_0x538d5f[_0x1fc9('0x32')][_0x1fc9('0x1e')]);}_0x2aa669[_0x1fc9('0x3a')]=qs['sort'](_0x538d5f[_0x1fc9('0x32')][_0x1fc9('0x3b')]);_0x2aa669[_0x1fc9('0x3c')]=qs[_0x1fc9('0x34')](_[_0x1fc9('0x3d')](_0x538d5f['query'],_0x19e270[_0x1fc9('0x34')]),_0x16f3a4);if(_0x538d5f[_0x1fc9('0x32')][_0x1fc9('0x3e')]){_0x2aa669[_0x1fc9('0x3c')]=_[_0x1fc9('0x3f')](_0x2aa669[_0x1fc9('0x3c')],{'$or':_[_0x1fc9('0x2d')](_0x16f3a4,function(_0x5886be){if(_0x5886be[_0x1fc9('0x40')]!==_0x1fc9('0x41')){var _0x43d7b9={};_0x43d7b9[_0x5886be['name']]={'$like':'%'+_0x538d5f[_0x1fc9('0x32')][_0x1fc9('0x3e')]+'%'};return _0x43d7b9;}})});}_0x2aa669=_[_0x1fc9('0x3f')]({},_0x2aa669,_0x538d5f[_0x1fc9('0x42')]);var _0x2fa2b0={'where':_0x2aa669[_0x1fc9('0x3c')]};return db[_0x1fc9('0x2e')][_0x1fc9('0x20')](_0x2fa2b0)[_0x1fc9('0x27')](function(_0x5623fb){_0x31ba25[_0x1fc9('0x20')]=_0x5623fb;if(_0x538d5f[_0x1fc9('0x32')][_0x1fc9('0x43')]){_0x2aa669['include']=[{'all':!![]}];}return db[_0x1fc9('0x2e')]['findAll'](_0x2aa669);})[_0x1fc9('0x27')](function(_0x4ee54b){_0x31ba25[_0x1fc9('0x44')]=_0x4ee54b;return _0x31ba25;})[_0x1fc9('0x27')](respondWithFilteredResult(_0x19a8e1,_0x2aa669))[_0x1fc9('0x45')](handleError(_0x19a8e1,null));};exports[_0x1fc9('0x46')]=function(_0x12e808,_0x153e62){var _0x366a91={'raw':!![],'where':{'id':_0x12e808[_0x1fc9('0x47')]['id']}},_0x54799d={};_0x54799d[_0x1fc9('0x31')]=_[_0x1fc9('0x33')](db[_0x1fc9('0x2e')][_0x1fc9('0x2f')]);_0x54799d[_0x1fc9('0x32')]=_[_0x1fc9('0x33')](_0x12e808[_0x1fc9('0x32')]);_0x54799d[_0x1fc9('0x34')]=_[_0x1fc9('0x48')](_0x54799d[_0x1fc9('0x31')],_0x54799d[_0x1fc9('0x32')]);_0x366a91[_0x1fc9('0x35')]=_[_0x1fc9('0x48')](_0x54799d[_0x1fc9('0x31')],qs[_0x1fc9('0x36')](_0x12e808[_0x1fc9('0x32')][_0x1fc9('0x36')]));_0x366a91[_0x1fc9('0x35')]=_0x366a91[_0x1fc9('0x35')][_0x1fc9('0x37')]?_0x366a91[_0x1fc9('0x35')]:_0x54799d[_0x1fc9('0x31')];if(_0x12e808[_0x1fc9('0x32')][_0x1fc9('0x43')]){_0x366a91[_0x1fc9('0x49')]=[{'all':!![]}];}_0x366a91=_['merge']({},_0x366a91,_0x12e808['options']);return db[_0x1fc9('0x2e')][_0x1fc9('0x4a')](_0x366a91)[_0x1fc9('0x27')](handleEntityNotFound(_0x153e62,null))[_0x1fc9('0x27')](respondWithResult(_0x153e62,null))[_0x1fc9('0x45')](handleError(_0x153e62,null));};exports[_0x1fc9('0x4b')]=function(_0x16835d,_0x3eeac5){return db[_0x1fc9('0x2e')][_0x1fc9('0x4b')](_0x16835d['body'],{})[_0x1fc9('0x27')](respondWithResult(_0x3eeac5,0xc9))['catch'](handleError(_0x3eeac5,null));};exports[_0x1fc9('0x25')]=function(_0x3cb02a,_0x14a8f0){if(_0x3cb02a[_0x1fc9('0x4c')]['id']){delete _0x3cb02a[_0x1fc9('0x4c')]['id'];}return db[_0x1fc9('0x2e')][_0x1fc9('0x4a')]({'where':{'id':_0x3cb02a[_0x1fc9('0x47')]['id']}})['then'](handleEntityNotFound(_0x14a8f0,null))[_0x1fc9('0x27')](saveUpdates(_0x3cb02a['body'],null))[_0x1fc9('0x27')](respondWithResult(_0x14a8f0,null))['catch'](handleError(_0x14a8f0,null));};exports[_0x1fc9('0x26')]=function(_0x106ce2,_0x22fe09){return db['ChatQueueReport'][_0x1fc9('0x4a')]({'where':{'id':_0x106ce2['params']['id']}})[_0x1fc9('0x27')](handleEntityNotFound(_0x22fe09,null))['then'](removeEntity(_0x22fe09,null))[_0x1fc9('0x45')](handleError(_0x22fe09,null));};exports[_0x1fc9('0x4d')]=function(_0x218a09,_0x4e65af){return db['ChatQueueReport'][_0x1fc9('0x4d')]()[_0x1fc9('0x27')](respondWithResult(_0x4e65af,null))[_0x1fc9('0x45')](handleError(_0x4e65af,null));}; \ No newline at end of file +var _0x15ef=['util','sox','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','apply','save','then','destroy','end','error','name','send','index','map','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','ChatQueueReport','include','findAll','catch','show','params','length','includeAll','options','find','create','body','update','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache'];(function(_0x4fc1f2,_0x5c2053){var _0x5e8663=function(_0x5b10ac){while(--_0x5b10ac){_0x4fc1f2['push'](_0x4fc1f2['shift']());}};_0x5e8663(++_0x5c2053);}(_0x15ef,0x80));var _0xf15e=function(_0x6f9f0f,_0xd54430){_0x6f9f0f=_0x6f9f0f-0x0;var _0x3cfc63=_0x15ef[_0x6f9f0f];return _0x3cfc63;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf15e('0x0'));var zipdir=require(_0xf15e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf15e('0x2'));var moment=require(_0xf15e('0x3'));var BPromise=require(_0xf15e('0x4'));var Mustache=require(_0xf15e('0x5'));var util=require(_0xf15e('0x6'));var path=require('path');var sox=require(_0xf15e('0x7'));var csv=require(_0xf15e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf15e('0x9'));var squel=require(_0xf15e('0xa'));var crypto=require('crypto');var jsforce=require(_0xf15e('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xf15e('0x8'));var querystring=require(_0xf15e('0xc'));var Papa=require(_0xf15e('0xd'));var Redis=require(_0xf15e('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf15e('0xf'));var logger=require(_0xf15e('0x10'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf15e('0x11'));var db=require(_0xf15e('0x12'))['db'];function respondWithStatusCode(_0x8551e2,_0x5809f7){_0x5809f7=_0x5809f7||0xcc;return function(_0x442d51){if(_0x442d51){return _0x8551e2[_0xf15e('0x13')](_0x5809f7);}return _0x8551e2[_0xf15e('0x14')](_0x5809f7)['end']();};}function respondWithResult(_0x1ec4ad,_0x1d76e9){_0x1d76e9=_0x1d76e9||0xc8;return function(_0x3e1b34){if(_0x3e1b34){return _0x1ec4ad[_0xf15e('0x14')](_0x1d76e9)[_0xf15e('0x15')](_0x3e1b34);}};}function respondWithFilteredResult(_0x1cbcc3,_0x17c241){return function(_0x2d6bd7){if(_0x2d6bd7){var _0x54b94c=typeof _0x17c241[_0xf15e('0x16')]===_0xf15e('0x17')&&typeof _0x17c241['limit']===_0xf15e('0x17');var _0x4356ca=_0x2d6bd7[_0xf15e('0x18')];var _0x487018=_0x54b94c?0x0:_0x17c241['offset'];var _0x3ad067=_0x54b94c?_0x2d6bd7[_0xf15e('0x18')]:_0x17c241['offset']+_0x17c241[_0xf15e('0x19')];var _0x1f1f33;if(_0x3ad067>=_0x4356ca){_0x3ad067=_0x4356ca;_0x1f1f33=0xc8;}else{_0x1f1f33=0xce;}_0x1cbcc3[_0xf15e('0x14')](_0x1f1f33);return _0x1cbcc3['set']('Content-Range',_0x487018+'-'+_0x3ad067+'/'+_0x4356ca)[_0xf15e('0x15')](_0x2d6bd7);}return null;};}function patchUpdates(_0x3fa737){return function(_0x499658){try{jsonpatch[_0xf15e('0x1a')](_0x499658,_0x3fa737,!![]);}catch(_0x56e8c9){return BPromise['reject'](_0x56e8c9);}return _0x499658[_0xf15e('0x1b')]();};}function saveUpdates(_0x239d41,_0x389489){return function(_0x9ece34){if(_0x9ece34){return _0x9ece34['update'](_0x239d41)[_0xf15e('0x1c')](function(_0xa09c0c){return _0xa09c0c;});}return null;};}function removeEntity(_0x302b70,_0x51c06a){return function(_0x248c4b){if(_0x248c4b){return _0x248c4b[_0xf15e('0x1d')]()['then'](function(){_0x302b70['status'](0xcc)[_0xf15e('0x1e')]();});}};}function handleEntityNotFound(_0xb36af,_0x1fd237){return function(_0x471079){if(!_0x471079){_0xb36af[_0xf15e('0x13')](0x194);}return _0x471079;};}function handleError(_0x58877f,_0x48764e){_0x48764e=_0x48764e||0x1f4;return function(_0x3f9d64){logger[_0xf15e('0x1f')](_0x3f9d64['stack']);if(_0x3f9d64[_0xf15e('0x20')]){delete _0x3f9d64[_0xf15e('0x20')];}_0x58877f[_0xf15e('0x14')](_0x48764e)[_0xf15e('0x21')](_0x3f9d64);};}exports[_0xf15e('0x22')]=function(_0xff4c07,_0x1e6a63){var _0x40321a={},_0x5dd9cf={},_0x3567d5={'count':0x0,'rows':[]};var _0x17f112=_[_0xf15e('0x23')](db['ChatQueueReport'][_0xf15e('0x24')],function(_0x203711){return{'name':_0x203711['fieldName'],'type':_0x203711[_0xf15e('0x25')][_0xf15e('0x26')]};});_0x5dd9cf[_0xf15e('0x27')]=_['map'](_0x17f112,_0xf15e('0x20'));_0x5dd9cf[_0xf15e('0x28')]=_[_0xf15e('0x29')](_0xff4c07[_0xf15e('0x28')]);_0x5dd9cf['filters']=_[_0xf15e('0x2a')](_0x5dd9cf[_0xf15e('0x27')],_0x5dd9cf['query']);_0x40321a[_0xf15e('0x2b')]=_[_0xf15e('0x2a')](_0x5dd9cf[_0xf15e('0x27')],qs['fields'](_0xff4c07[_0xf15e('0x28')][_0xf15e('0x2c')]));_0x40321a['attributes']=_0x40321a[_0xf15e('0x2b')]['length']?_0x40321a[_0xf15e('0x2b')]:_0x5dd9cf[_0xf15e('0x27')];if(!_0xff4c07['query']['hasOwnProperty'](_0xf15e('0x2d'))){_0x40321a[_0xf15e('0x19')]=qs['limit'](_0xff4c07[_0xf15e('0x28')][_0xf15e('0x19')]);_0x40321a[_0xf15e('0x16')]=qs[_0xf15e('0x16')](_0xff4c07[_0xf15e('0x28')][_0xf15e('0x16')]);}_0x40321a['order']=qs[_0xf15e('0x2e')](_0xff4c07[_0xf15e('0x28')][_0xf15e('0x2e')]);_0x40321a[_0xf15e('0x2f')]=qs[_0xf15e('0x30')](_[_0xf15e('0x31')](_0xff4c07[_0xf15e('0x28')],_0x5dd9cf[_0xf15e('0x30')]),_0x17f112);if(_0xff4c07['query'][_0xf15e('0x32')]){_0x40321a['where']=_[_0xf15e('0x33')](_0x40321a[_0xf15e('0x2f')],{'$or':_[_0xf15e('0x23')](_0x17f112,function(_0x40e707){if(_0x40e707[_0xf15e('0x25')]!==_0xf15e('0x34')){var _0x4d411f={};_0x4d411f[_0x40e707[_0xf15e('0x20')]]={'$like':'%'+_0xff4c07[_0xf15e('0x28')][_0xf15e('0x32')]+'%'};return _0x4d411f;}})});}_0x40321a=_[_0xf15e('0x33')]({},_0x40321a,_0xff4c07['options']);var _0x52ebab={'where':_0x40321a[_0xf15e('0x2f')]};return db[_0xf15e('0x35')][_0xf15e('0x18')](_0x52ebab)['then'](function(_0x514c68){_0x3567d5['count']=_0x514c68;if(_0xff4c07['query']['includeAll']){_0x40321a[_0xf15e('0x36')]=[{'all':!![]}];}return db[_0xf15e('0x35')][_0xf15e('0x37')](_0x40321a);})['then'](function(_0x3a56bd){_0x3567d5['rows']=_0x3a56bd;return _0x3567d5;})[_0xf15e('0x1c')](respondWithFilteredResult(_0x1e6a63,_0x40321a))[_0xf15e('0x38')](handleError(_0x1e6a63,null));};exports[_0xf15e('0x39')]=function(_0x180d7a,_0x52bbc4){var _0xf32fc5={'raw':!![],'where':{'id':_0x180d7a[_0xf15e('0x3a')]['id']}},_0x37f0a6={};_0x37f0a6[_0xf15e('0x27')]=_[_0xf15e('0x29')](db['ChatQueueReport'][_0xf15e('0x24')]);_0x37f0a6[_0xf15e('0x28')]=_[_0xf15e('0x29')](_0x180d7a[_0xf15e('0x28')]);_0x37f0a6[_0xf15e('0x30')]=_[_0xf15e('0x2a')](_0x37f0a6[_0xf15e('0x27')],_0x37f0a6['query']);_0xf32fc5[_0xf15e('0x2b')]=_[_0xf15e('0x2a')](_0x37f0a6['model'],qs['fields'](_0x180d7a[_0xf15e('0x28')]['fields']));_0xf32fc5['attributes']=_0xf32fc5[_0xf15e('0x2b')][_0xf15e('0x3b')]?_0xf32fc5['attributes']:_0x37f0a6[_0xf15e('0x27')];if(_0x180d7a[_0xf15e('0x28')][_0xf15e('0x3c')]){_0xf32fc5[_0xf15e('0x36')]=[{'all':!![]}];}_0xf32fc5=_[_0xf15e('0x33')]({},_0xf32fc5,_0x180d7a[_0xf15e('0x3d')]);return db[_0xf15e('0x35')][_0xf15e('0x3e')](_0xf32fc5)[_0xf15e('0x1c')](handleEntityNotFound(_0x52bbc4,null))['then'](respondWithResult(_0x52bbc4,null))[_0xf15e('0x38')](handleError(_0x52bbc4,null));};exports[_0xf15e('0x3f')]=function(_0x3b79a8,_0x5b31c9){return db['ChatQueueReport'][_0xf15e('0x3f')](_0x3b79a8[_0xf15e('0x40')],{})[_0xf15e('0x1c')](respondWithResult(_0x5b31c9,0xc9))[_0xf15e('0x38')](handleError(_0x5b31c9,null));};exports[_0xf15e('0x41')]=function(_0xac7515,_0x3b5c7b){if(_0xac7515[_0xf15e('0x40')]['id']){delete _0xac7515['body']['id'];}return db[_0xf15e('0x35')][_0xf15e('0x3e')]({'where':{'id':_0xac7515['params']['id']}})[_0xf15e('0x1c')](handleEntityNotFound(_0x3b5c7b,null))['then'](saveUpdates(_0xac7515[_0xf15e('0x40')],null))[_0xf15e('0x1c')](respondWithResult(_0x3b5c7b,null))[_0xf15e('0x38')](handleError(_0x3b5c7b,null));};exports['destroy']=function(_0x46e6e9,_0x3e2fd6){return db[_0xf15e('0x35')][_0xf15e('0x3e')]({'where':{'id':_0x46e6e9[_0xf15e('0x3a')]['id']}})[_0xf15e('0x1c')](handleEntityNotFound(_0x3e2fd6,null))[_0xf15e('0x1c')](removeEntity(_0x3e2fd6,null))[_0xf15e('0x38')](handleError(_0x3e2fd6,null));};exports[_0xf15e('0x42')]=function(_0x4fd54b,_0x5471d8){return db[_0xf15e('0x35')][_0xf15e('0x42')]()[_0xf15e('0x1c')](respondWithResult(_0x5471d8,null))[_0xf15e('0x38')](handleError(_0x5471d8,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index d3d4d90..07b7635 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid'];(function(_0xfbdff6,_0x2af690){var _0x4cb9be=function(_0x4022d8){while(--_0x4022d8){_0xfbdff6['push'](_0xfbdff6['shift']());}};_0x4cb9be(++_0x2af690);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcb91=['path','rimraf','./chatQueueReport.attributes','exports','define','report_chat_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x2368ee,_0x598759){var _0x17cbc1=function(_0x187bfc){while(--_0x187bfc){_0x2368ee['push'](_0x2368ee['shift']());}};_0x17cbc1(++_0x598759);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3792e6,_0x32bd91){_0x3792e6=_0x3792e6-0x0;var _0x441e44=_0xcb91[_0x3792e6];return _0x441e44;};'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')]('ChatQueueReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'name':_0x1cb9('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index e3ab7d2..00d51a2 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 _0x3ef0=['create','options','raw','then','CreateChatQueueReport','stringify','UpdateChatQueueReport','body','where','attributes','limit','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ChatQueueReport'];(function(_0x5dc03e,_0x54e60c){var _0x466a07=function(_0x2ce0cd){while(--_0x2ce0cd){_0x5dc03e['push'](_0x5dc03e['shift']());}};_0x466a07(++_0x54e60c);}(_0x3ef0,0x141));var _0x03ef=function(_0x2a64b2,_0x4d447a){_0x2a64b2=_0x2a64b2-0x0;var _0x2db167=_0x3ef0[_0x2a64b2];return _0x2db167;};'use strict';var _=require(_0x03ef('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x03ef('0x1'));var fs=require('fs');var Redis=require(_0x03ef('0x2'));var db=require(_0x03ef('0x3'))['db'];var utils=require(_0x03ef('0x4'));var logger=require(_0x03ef('0x5'))(_0x03ef('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x03ef('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xe25a18,_0x5bcb91,_0x2fdb92){return new BPromise(function(_0x59ea1e,_0x1c328f){return client[_0x03ef('0x8')](_0xe25a18,_0x2fdb92)['then'](function(_0x579304){logger[_0x03ef('0x9')](_0x03ef('0xa'),_0x5bcb91,_0x03ef('0xb'));logger[_0x03ef('0xc')](_0x03ef('0xd'),_0x5bcb91,_0x03ef('0xb'),JSON['stringify'](_0x579304));if(_0x579304[_0x03ef('0xe')]){if(_0x579304['error'][_0x03ef('0xf')]===0x1f4){logger[_0x03ef('0xe')](_0x03ef('0xa'),_0x5bcb91,_0x579304[_0x03ef('0xe')][_0x03ef('0x10')]);return _0x1c328f(_0x579304[_0x03ef('0xe')][_0x03ef('0x10')]);}logger[_0x03ef('0xe')](_0x03ef('0xa'),_0x5bcb91,_0x579304['error'][_0x03ef('0x10')]);return _0x59ea1e(_0x579304[_0x03ef('0xe')][_0x03ef('0x10')]);}else{logger[_0x03ef('0x9')](_0x03ef('0xa'),_0x5bcb91,_0x03ef('0xb'));_0x59ea1e(_0x579304[_0x03ef('0x11')][_0x03ef('0x10')]);}})[_0x03ef('0x12')](function(_0x311bb1){logger[_0x03ef('0xe')](_0x03ef('0xa'),_0x5bcb91,_0x311bb1);_0x1c328f(_0x311bb1);});});}exports['CreateChatQueueReport']=function(_0x120317){var _0x51fd1b=this;return new Promise(function(_0x4d4d70,_0x4cb597){return db[_0x03ef('0x13')][_0x03ef('0x14')](_0x120317['body'],{'raw':_0x120317['options']?_0x120317[_0x03ef('0x15')][_0x03ef('0x16')]===undefined?!![]:![]:!![]})[_0x03ef('0x17')](function(_0x2efdf7){logger[_0x03ef('0x9')](_0x03ef('0x18'),_0x120317);logger[_0x03ef('0xc')](_0x03ef('0x18'),_0x120317,JSON[_0x03ef('0x19')](_0x2efdf7));_0x4d4d70(_0x2efdf7);})[_0x03ef('0x12')](function(_0x121768){logger[_0x03ef('0xe')](_0x03ef('0x18'),_0x121768[_0x03ef('0x10')],_0x120317);_0x4cb597(_0x51fd1b[_0x03ef('0xe')](0x1f4,_0x121768[_0x03ef('0x10')]));});});};exports[_0x03ef('0x1a')]=function(_0x5796c8){var _0x5e85c6=this;return new Promise(function(_0x1f72c4,_0xb5d2f){return db[_0x03ef('0x13')]['update'](_0x5796c8[_0x03ef('0x1b')],{'raw':_0x5796c8['options']?_0x5796c8[_0x03ef('0x15')][_0x03ef('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5796c8['options']?_0x5796c8[_0x03ef('0x15')][_0x03ef('0x1c')]||null:null,'attributes':_0x5796c8['options']?_0x5796c8[_0x03ef('0x15')][_0x03ef('0x1d')]||null:null,'limit':_0x5796c8[_0x03ef('0x15')]?_0x5796c8[_0x03ef('0x15')][_0x03ef('0x1e')]||null:null})[_0x03ef('0x17')](function(_0x559b5b){logger['info'](_0x03ef('0x1a'),_0x5796c8);logger[_0x03ef('0xc')](_0x03ef('0x1a'),_0x5796c8,JSON[_0x03ef('0x19')](_0x559b5b));_0x1f72c4(_0x559b5b);})['catch'](function(_0xe77790){logger['error'](_0x03ef('0x1a'),_0xe77790[_0x03ef('0x10')],_0x5796c8);_0xb5d2f(_0x5e85c6[_0x03ef('0xe')](0x1f4,_0xe77790['message']));});});}; \ No newline at end of file +var _0xd501=['request\x20sent','result','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','catch','UpdateChatQueueReport','update','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','then','info','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatQueueReport,\x20%s,\x20%s'];(function(_0x286726,_0x20a337){var _0xcd4fe9=function(_0x4d7da6){while(--_0x4d7da6){_0x286726['push'](_0x286726['shift']());}};_0xcd4fe9(++_0x20a337);}(_0xd501,0x135));var _0x1d50=function(_0xd6204,_0x5c578c){_0xd6204=_0xd6204-0x0;var _0x205fe9=_0xd501[_0xd6204];return _0x205fe9;};'use strict';var _=require(_0x1d50('0x0'));var util=require(_0x1d50('0x1'));var moment=require(_0x1d50('0x2'));var BPromise=require(_0x1d50('0x3'));var rs=require(_0x1d50('0x4'));var fs=require('fs');var Redis=require(_0x1d50('0x5'));var db=require(_0x1d50('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1d50('0x7'))(_0x1d50('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1d50('0x9')][_0x1d50('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x472295,_0x4e31be,_0x34ba42){return new BPromise(function(_0x34cfc7,_0x447527){return client[_0x1d50('0xb')](_0x472295,_0x34ba42)[_0x1d50('0xc')](function(_0x52e8a4){logger[_0x1d50('0xd')]('ChatQueueReport,\x20%s,\x20%s',_0x4e31be,'request\x20sent');logger[_0x1d50('0xe')](_0x1d50('0xf'),_0x4e31be,'request\x20sent',JSON[_0x1d50('0x10')](_0x52e8a4));if(_0x52e8a4[_0x1d50('0x11')]){if(_0x52e8a4[_0x1d50('0x11')][_0x1d50('0x12')]===0x1f4){logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x4e31be,_0x52e8a4[_0x1d50('0x11')][_0x1d50('0x13')]);return _0x447527(_0x52e8a4[_0x1d50('0x11')][_0x1d50('0x13')]);}logger[_0x1d50('0x11')](_0x1d50('0x14'),_0x4e31be,_0x52e8a4[_0x1d50('0x11')][_0x1d50('0x13')]);return _0x34cfc7(_0x52e8a4[_0x1d50('0x11')]['message']);}else{logger[_0x1d50('0xd')](_0x1d50('0x14'),_0x4e31be,_0x1d50('0x15'));_0x34cfc7(_0x52e8a4[_0x1d50('0x16')]['message']);}})['catch'](function(_0x3ed906){logger[_0x1d50('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x4e31be,_0x3ed906);_0x447527(_0x3ed906);});});}exports[_0x1d50('0x17')]=function(_0x4bd9ea){var _0x35f3a1=this;return new Promise(function(_0x1f3328,_0x202b9f){return db[_0x1d50('0x18')][_0x1d50('0x19')](_0x4bd9ea[_0x1d50('0x1a')],{'raw':_0x4bd9ea[_0x1d50('0x1b')]?_0x4bd9ea[_0x1d50('0x1b')][_0x1d50('0x1c')]===undefined?!![]:![]:!![]})[_0x1d50('0xc')](function(_0x509d7f){logger[_0x1d50('0xd')](_0x1d50('0x17'),_0x4bd9ea);logger[_0x1d50('0xe')](_0x1d50('0x17'),_0x4bd9ea,JSON['stringify'](_0x509d7f));_0x1f3328(_0x509d7f);})[_0x1d50('0x1d')](function(_0x4f879f){logger[_0x1d50('0x11')]('CreateChatQueueReport',_0x4f879f[_0x1d50('0x13')],_0x4bd9ea);_0x202b9f(_0x35f3a1[_0x1d50('0x11')](0x1f4,_0x4f879f[_0x1d50('0x13')]));});});};exports[_0x1d50('0x1e')]=function(_0x4b50e1){var _0x439975=this;return new Promise(function(_0x2f57f0,_0xec26ab){return db[_0x1d50('0x18')][_0x1d50('0x1f')](_0x4b50e1[_0x1d50('0x1a')],{'raw':_0x4b50e1[_0x1d50('0x1b')]?_0x4b50e1[_0x1d50('0x1b')][_0x1d50('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b50e1['options']?_0x4b50e1[_0x1d50('0x1b')][_0x1d50('0x20')]||null:null,'attributes':_0x4b50e1['options']?_0x4b50e1[_0x1d50('0x1b')]['attributes']||null:null,'limit':_0x4b50e1[_0x1d50('0x1b')]?_0x4b50e1['options']['limit']||null:null})[_0x1d50('0xc')](function(_0x4ad732){logger[_0x1d50('0xd')]('UpdateChatQueueReport',_0x4b50e1);logger[_0x1d50('0xe')](_0x1d50('0x1e'),_0x4b50e1,JSON[_0x1d50('0x10')](_0x4ad732));_0x2f57f0(_0x4ad732);})[_0x1d50('0x1d')](function(_0x5e2e3f){logger['error'](_0x1d50('0x1e'),_0x5e2e3f['message'],_0x4b50e1);_0xec26ab(_0x439975[_0x1d50('0x11')](0x1f4,_0x5e2e3f['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 0f889e1..aac9d7a 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 _0x3595=['show','post','create','put','/:id','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','describe'];(function(_0x2ca2d0,_0x3ea8e4){var _0x521c23=function(_0x5b0731){while(--_0x5b0731){_0x2ca2d0['push'](_0x2ca2d0['shift']());}};_0x521c23(++_0x3ea8e4);}(_0x3595,0x1d7));var _0x5359=function(_0x4a0e57,_0x54c11e){_0x4a0e57=_0x4a0e57-0x0;var _0x4d8fc1=_0x3595[_0x4a0e57];return _0x4d8fc1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5359('0x0'));var timeout=require(_0x5359('0x1'));var express=require(_0x5359('0x2'));var router=express[_0x5359('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5359('0x4'));var interaction=require(_0x5359('0x5'));var config=require(_0x5359('0x6'));var controller=require(_0x5359('0x7'));router[_0x5359('0x8')]('/',auth[_0x5359('0x9')](),controller[_0x5359('0xa')]);router['get']('/describe',auth[_0x5359('0x9')](),controller[_0x5359('0xb')]);router['get']('/:id',auth[_0x5359('0x9')](),controller[_0x5359('0xc')]);router[_0x5359('0xd')]('/',auth[_0x5359('0x9')](),controller[_0x5359('0xe')]);router[_0x5359('0xf')](_0x5359('0x10'),auth[_0x5359('0x9')](),controller[_0x5359('0x11')]);router[_0x5359('0x12')](_0x5359('0x10'),auth['isAuthenticated'](),controller[_0x5359('0x13')]);module[_0x5359('0x14')]=router; \ No newline at end of file +var _0x6206=['get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','destroy','multer','util','path','express','fs-extra','../../components/auth/service','./chatQueueReport.controller'];(function(_0x2c0544,_0x122cad){var _0x158533=function(_0x1ce473){while(--_0x1ce473){_0x2c0544['push'](_0x2c0544['shift']());}};_0x158533(++_0x122cad);}(_0x6206,0x129));var _0x6620=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0x6206[_0x26462c];return _0x509a42;};'use strict';var multer=require(_0x6620('0x0'));var util=require(_0x6620('0x1'));var path=require(_0x6620('0x2'));var timeout=require('connect-timeout');var express=require(_0x6620('0x3'));var router=express['Router']();var fs_extra=require(_0x6620('0x4'));var auth=require(_0x6620('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6620('0x6'));router[_0x6620('0x7')]('/',auth[_0x6620('0x8')](),controller[_0x6620('0x9')]);router[_0x6620('0x7')]('/describe',auth[_0x6620('0x8')](),controller[_0x6620('0xa')]);router[_0x6620('0x7')](_0x6620('0xb'),auth['isAuthenticated'](),controller[_0x6620('0xc')]);router[_0x6620('0xd')]('/',auth[_0x6620('0x8')](),controller[_0x6620('0xe')]);router[_0x6620('0xf')](_0x6620('0xb'),auth['isAuthenticated'](),controller[_0x6620('0x10')]);router[_0x6620('0x11')](_0x6620('0xb'),auth[_0x6620('0x8')](),controller[_0x6620('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index ce1bb66..0b74648 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 _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x544e7f,_0x4afcfe){var _0x4b23a0=function(_0x174c4c){while(--_0x174c4c){_0x544e7f['push'](_0x544e7f['shift']());}};_0x4b23a0(++_0x4afcfe);}(_0xedd9,0xfc));var _0x9edd=function(_0x547741,_0x41a203){_0x547741=_0x547741-0x0;var _0x50cd44=_0xedd9[_0x547741];return _0x50cd44;};'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 _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x4da9f1,_0x32ba93){var _0x501038=function(_0x4bb076){while(--_0x4bb076){_0x4da9f1['push'](_0x4da9f1['shift']());}};_0x501038(++_0x32ba93);}(_0xaa88,0x137));var _0x8aa8=function(_0x58d5ac,_0x11c4bc){_0x58d5ac=_0x58d5ac-0x0;var _0x37985c=_0xaa88[_0x58d5ac];return _0x37985c;};'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 diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 7f42610..8a48815 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 _0xf8de=['key','model','keys','query','filters','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','findAll','rows','catch','params','rawAttributes','intersection','fields','include','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','sendStatus','error','stack','name','send','index','map','ChatTransferReport','fieldName'];(function(_0x543242,_0xeac9fd){var _0x4c99b6=function(_0x47d087){while(--_0x47d087){_0x543242['push'](_0x543242['shift']());}};_0x4c99b6(++_0xeac9fd);}(_0xf8de,0x199));var _0xef8d=function(_0x282700,_0x147045){_0x282700=_0x282700-0x0;var _0x326e2a=_0xf8de[_0x282700];return _0x326e2a;};'use strict';var emlformat=require(_0xef8d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xef8d('0x1'));var jsonpatch=require(_0xef8d('0x2'));var rp=require(_0xef8d('0x3'));var moment=require(_0xef8d('0x4'));var BPromise=require(_0xef8d('0x5'));var Mustache=require(_0xef8d('0x6'));var util=require(_0xef8d('0x7'));var path=require(_0xef8d('0x8'));var sox=require(_0xef8d('0x9'));var csv=require(_0xef8d('0xa'));var ejs=require(_0xef8d('0xb'));var fs=require('fs');var fs_extra=require(_0xef8d('0xc'));var _=require(_0xef8d('0xd'));var squel=require(_0xef8d('0xe'));var crypto=require('crypto');var jsforce=require(_0xef8d('0xf'));var deskjs=require(_0xef8d('0x10'));var toCsv=require('to-csv');var querystring=require(_0xef8d('0x11'));var Papa=require(_0xef8d('0x12'));var Redis=require(_0xef8d('0x13'));var authService=require(_0xef8d('0x14'));var qs=require(_0xef8d('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xef8d('0x16'));var utils=require(_0xef8d('0x17'));var config=require(_0xef8d('0x18'));var licenseUtil=require(_0xef8d('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x197ea1,_0x3278f0){_0x3278f0=_0x3278f0||0xcc;return function(_0x209347){if(_0x209347){return _0x197ea1['sendStatus'](_0x3278f0);}return _0x197ea1[_0xef8d('0x1a')](_0x3278f0)[_0xef8d('0x1b')]();};}function respondWithResult(_0x1fa744,_0x2f5e84){_0x2f5e84=_0x2f5e84||0xc8;return function(_0x133c70){if(_0x133c70){return _0x1fa744[_0xef8d('0x1a')](_0x2f5e84)[_0xef8d('0x1c')](_0x133c70);}};}function respondWithFilteredResult(_0x34246a,_0x3b8e99){return function(_0x2501f7){if(_0x2501f7){var _0x263471=typeof _0x3b8e99[_0xef8d('0x1d')]===_0xef8d('0x1e')&&typeof _0x3b8e99[_0xef8d('0x1f')]===_0xef8d('0x1e');var _0x1d2eac=_0x2501f7[_0xef8d('0x20')];var _0xa785ad=_0x263471?0x0:_0x3b8e99[_0xef8d('0x1d')];var _0x107a0c=_0x263471?_0x2501f7[_0xef8d('0x20')]:_0x3b8e99[_0xef8d('0x1d')]+_0x3b8e99[_0xef8d('0x1f')];var _0xdcf696;if(_0x107a0c>=_0x1d2eac){_0x107a0c=_0x1d2eac;_0xdcf696=0xc8;}else{_0xdcf696=0xce;}_0x34246a['status'](_0xdcf696);return _0x34246a[_0xef8d('0x21')](_0xef8d('0x22'),_0xa785ad+'-'+_0x107a0c+'/'+_0x1d2eac)[_0xef8d('0x1c')](_0x2501f7);}return null;};}function patchUpdates(_0x40968f){return function(_0x4fa9f4){try{jsonpatch['apply'](_0x4fa9f4,_0x40968f,!![]);}catch(_0x413d7f){return BPromise[_0xef8d('0x23')](_0x413d7f);}return _0x4fa9f4['save']();};}function saveUpdates(_0x5eba5e,_0x4f80de){return function(_0x57b721){if(_0x57b721){return _0x57b721[_0xef8d('0x24')](_0x5eba5e)[_0xef8d('0x25')](function(_0x442ef3){return _0x442ef3;});}return null;};}function removeEntity(_0x319d63,_0x5b3755){return function(_0x23ee4b){if(_0x23ee4b){return _0x23ee4b['destroy']()['then'](function(){_0x319d63['status'](0xcc)[_0xef8d('0x1b')]();});}};}function handleEntityNotFound(_0x5511cc,_0x1d388c){return function(_0x4411c5){if(!_0x4411c5){_0x5511cc[_0xef8d('0x26')](0x194);}return _0x4411c5;};}function handleError(_0x1680f7,_0x9b93f1){_0x9b93f1=_0x9b93f1||0x1f4;return function(_0x533998){logger[_0xef8d('0x27')](_0x533998[_0xef8d('0x28')]);if(_0x533998[_0xef8d('0x29')]){delete _0x533998[_0xef8d('0x29')];}_0x1680f7[_0xef8d('0x1a')](_0x9b93f1)[_0xef8d('0x2a')](_0x533998);};}exports[_0xef8d('0x2b')]=function(_0x2c1854,_0x46d7b3){var _0x5e8804={},_0x3f9b01={},_0x2c8ba5={'count':0x0,'rows':[]};var _0x28c5df=_[_0xef8d('0x2c')](db[_0xef8d('0x2d')]['rawAttributes'],function(_0x2bfefe){return{'name':_0x2bfefe[_0xef8d('0x2e')],'type':_0x2bfefe['type'][_0xef8d('0x2f')]};});_0x3f9b01[_0xef8d('0x30')]=_[_0xef8d('0x2c')](_0x28c5df,_0xef8d('0x29'));_0x3f9b01['query']=_[_0xef8d('0x31')](_0x2c1854[_0xef8d('0x32')]);_0x3f9b01[_0xef8d('0x33')]=_['intersection'](_0x3f9b01[_0xef8d('0x30')],_0x3f9b01['query']);_0x5e8804['attributes']=_['intersection'](_0x3f9b01[_0xef8d('0x30')],qs['fields'](_0x2c1854['query']['fields']));_0x5e8804['attributes']=_0x5e8804['attributes']['length']?_0x5e8804[_0xef8d('0x34')]:_0x3f9b01[_0xef8d('0x30')];if(!_0x2c1854[_0xef8d('0x32')][_0xef8d('0x35')](_0xef8d('0x36'))){_0x5e8804[_0xef8d('0x1f')]=qs[_0xef8d('0x1f')](_0x2c1854[_0xef8d('0x32')][_0xef8d('0x1f')]);_0x5e8804['offset']=qs[_0xef8d('0x1d')](_0x2c1854[_0xef8d('0x32')][_0xef8d('0x1d')]);}_0x5e8804[_0xef8d('0x37')]=qs[_0xef8d('0x38')](_0x2c1854[_0xef8d('0x32')][_0xef8d('0x38')]);_0x5e8804[_0xef8d('0x39')]=qs[_0xef8d('0x33')](_[_0xef8d('0x3a')](_0x2c1854[_0xef8d('0x32')],_0x3f9b01['filters']),_0x28c5df);if(_0x2c1854[_0xef8d('0x32')][_0xef8d('0x3b')]){_0x5e8804['where']=_[_0xef8d('0x3c')](_0x5e8804[_0xef8d('0x39')],{'$or':_[_0xef8d('0x2c')](_0x28c5df,function(_0x1dd7ed){if(_0x1dd7ed[_0xef8d('0x3d')]!=='VIRTUAL'){var _0x5b06f0={};_0x5b06f0[_0x1dd7ed[_0xef8d('0x29')]]={'$like':'%'+_0x2c1854['query'][_0xef8d('0x3b')]+'%'};return _0x5b06f0;}})});}_0x5e8804=_[_0xef8d('0x3c')]({},_0x5e8804,_0x2c1854[_0xef8d('0x3e')]);var _0x2fa95b={'where':_0x5e8804[_0xef8d('0x39')]};return db[_0xef8d('0x2d')][_0xef8d('0x20')](_0x2fa95b)['then'](function(_0x4a71f0){_0x2c8ba5[_0xef8d('0x20')]=_0x4a71f0;if(_0x2c1854[_0xef8d('0x32')][_0xef8d('0x3f')]){_0x5e8804['include']=[{'all':!![]}];}return db[_0xef8d('0x2d')][_0xef8d('0x40')](_0x5e8804);})[_0xef8d('0x25')](function(_0x562d30){_0x2c8ba5[_0xef8d('0x41')]=_0x562d30;return _0x2c8ba5;})['then'](respondWithFilteredResult(_0x46d7b3,_0x5e8804))[_0xef8d('0x42')](handleError(_0x46d7b3,null));};exports['show']=function(_0x1f6572,_0x2398f9){var _0x26a0b5={'raw':!![],'where':{'id':_0x1f6572[_0xef8d('0x43')]['id']}},_0x2ccd78={};_0x2ccd78[_0xef8d('0x30')]=_['keys'](db[_0xef8d('0x2d')][_0xef8d('0x44')]);_0x2ccd78[_0xef8d('0x32')]=_[_0xef8d('0x31')](_0x1f6572[_0xef8d('0x32')]);_0x2ccd78[_0xef8d('0x33')]=_[_0xef8d('0x45')](_0x2ccd78[_0xef8d('0x30')],_0x2ccd78[_0xef8d('0x32')]);_0x26a0b5['attributes']=_[_0xef8d('0x45')](_0x2ccd78[_0xef8d('0x30')],qs[_0xef8d('0x46')](_0x1f6572[_0xef8d('0x32')][_0xef8d('0x46')]));_0x26a0b5[_0xef8d('0x34')]=_0x26a0b5[_0xef8d('0x34')]['length']?_0x26a0b5['attributes']:_0x2ccd78[_0xef8d('0x30')];if(_0x1f6572[_0xef8d('0x32')]['includeAll']){_0x26a0b5[_0xef8d('0x47')]=[{'all':!![]}];}_0x26a0b5=_[_0xef8d('0x3c')]({},_0x26a0b5,_0x1f6572[_0xef8d('0x3e')]);return db['ChatTransferReport'][_0xef8d('0x48')](_0x26a0b5)[_0xef8d('0x25')](handleEntityNotFound(_0x2398f9,null))['then'](respondWithResult(_0x2398f9,null))[_0xef8d('0x42')](handleError(_0x2398f9,null));};exports['create']=function(_0x4f9985,_0x4ac873){return db[_0xef8d('0x2d')][_0xef8d('0x49')](_0x4f9985[_0xef8d('0x4a')],{})[_0xef8d('0x25')](respondWithResult(_0x4ac873,0xc9))[_0xef8d('0x42')](handleError(_0x4ac873,null));};exports[_0xef8d('0x24')]=function(_0x15251d,_0xbc394e){if(_0x15251d[_0xef8d('0x4a')]['id']){delete _0x15251d[_0xef8d('0x4a')]['id'];}return db[_0xef8d('0x2d')][_0xef8d('0x48')]({'where':{'id':_0x15251d[_0xef8d('0x43')]['id']}})[_0xef8d('0x25')](handleEntityNotFound(_0xbc394e,null))[_0xef8d('0x25')](saveUpdates(_0x15251d[_0xef8d('0x4a')],null))['then'](respondWithResult(_0xbc394e,null))['catch'](handleError(_0xbc394e,null));};exports['destroy']=function(_0x247395,_0x69851c){return db['ChatTransferReport'][_0xef8d('0x48')]({'where':{'id':_0x247395[_0xef8d('0x43')]['id']}})[_0xef8d('0x25')](handleEntityNotFound(_0x69851c,null))[_0xef8d('0x25')](removeEntity(_0x69851c,null))[_0xef8d('0x42')](handleError(_0x69851c,null));};exports[_0xef8d('0x4b')]=function(_0x24339c,_0x5aa865){return db['ChatTransferReport'][_0xef8d('0x4b')]()[_0xef8d('0x25')](respondWithResult(_0x5aa865,null))[_0xef8d('0x42')](handleError(_0x5aa865,null));}; \ No newline at end of file +var _0x8c54=['create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','stack','name','index','map','ChatTransferReport','rawAttributes','fieldName','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','merge','options','find'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x8c54,0xe1));var _0x48c5=function(_0x3982da,_0x2b143c){_0x3982da=_0x3982da-0x0;var _0xa88562=_0x8c54[_0x3982da];return _0xa88562;};'use strict';var emlformat=require(_0x48c5('0x0'));var rimraf=require(_0x48c5('0x1'));var zipdir=require(_0x48c5('0x2'));var jsonpatch=require(_0x48c5('0x3'));var rp=require(_0x48c5('0x4'));var moment=require('moment');var BPromise=require(_0x48c5('0x5'));var Mustache=require(_0x48c5('0x6'));var util=require(_0x48c5('0x7'));var path=require(_0x48c5('0x8'));var sox=require(_0x48c5('0x9'));var csv=require(_0x48c5('0xa'));var ejs=require(_0x48c5('0xb'));var fs=require('fs');var fs_extra=require(_0x48c5('0xc'));var _=require(_0x48c5('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x48c5('0xa'));var querystring=require(_0x48c5('0xe'));var Papa=require('papaparse');var Redis=require(_0x48c5('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x48c5('0x10'));var as=require(_0x48c5('0x11'));var hardwareService=require(_0x48c5('0x12'));var logger=require(_0x48c5('0x13'))(_0x48c5('0x14'));var utils=require('../../config/utils');var config=require(_0x48c5('0x15'));var licenseUtil=require(_0x48c5('0x16'));var db=require(_0x48c5('0x17'))['db'];function respondWithStatusCode(_0x3d04b2,_0x1c4d7c){_0x1c4d7c=_0x1c4d7c||0xcc;return function(_0x561214){if(_0x561214){return _0x3d04b2[_0x48c5('0x18')](_0x1c4d7c);}return _0x3d04b2[_0x48c5('0x19')](_0x1c4d7c)[_0x48c5('0x1a')]();};}function respondWithResult(_0x38e9bb,_0x1ac224){_0x1ac224=_0x1ac224||0xc8;return function(_0x17751a){if(_0x17751a){return _0x38e9bb[_0x48c5('0x19')](_0x1ac224)[_0x48c5('0x1b')](_0x17751a);}};}function respondWithFilteredResult(_0x5789bf,_0x1d8d58){return function(_0x14fe13){if(_0x14fe13){var _0x26a0d2=typeof _0x1d8d58[_0x48c5('0x1c')]===_0x48c5('0x1d')&&typeof _0x1d8d58[_0x48c5('0x1e')]===_0x48c5('0x1d');var _0x35648f=_0x14fe13[_0x48c5('0x1f')];var _0x6c1846=_0x26a0d2?0x0:_0x1d8d58[_0x48c5('0x1c')];var _0x1616a1=_0x26a0d2?_0x14fe13[_0x48c5('0x1f')]:_0x1d8d58['offset']+_0x1d8d58[_0x48c5('0x1e')];var _0x327782;if(_0x1616a1>=_0x35648f){_0x1616a1=_0x35648f;_0x327782=0xc8;}else{_0x327782=0xce;}_0x5789bf['status'](_0x327782);return _0x5789bf[_0x48c5('0x20')](_0x48c5('0x21'),_0x6c1846+'-'+_0x1616a1+'/'+_0x35648f)[_0x48c5('0x1b')](_0x14fe13);}return null;};}function patchUpdates(_0xcc4b7a){return function(_0x2a5d2e){try{jsonpatch['apply'](_0x2a5d2e,_0xcc4b7a,!![]);}catch(_0x53e02c){return BPromise['reject'](_0x53e02c);}return _0x2a5d2e[_0x48c5('0x22')]();};}function saveUpdates(_0x5b6cc3,_0x34398b){return function(_0x52a9eb){if(_0x52a9eb){return _0x52a9eb[_0x48c5('0x23')](_0x5b6cc3)[_0x48c5('0x24')](function(_0x31ba52){return _0x31ba52;});}return null;};}function removeEntity(_0x4477dc,_0x1cd741){return function(_0x525041){if(_0x525041){return _0x525041[_0x48c5('0x25')]()['then'](function(){_0x4477dc[_0x48c5('0x19')](0xcc)[_0x48c5('0x1a')]();});}};}function handleEntityNotFound(_0x1b59ae,_0x168fdd){return function(_0x224cda){if(!_0x224cda){_0x1b59ae[_0x48c5('0x18')](0x194);}return _0x224cda;};}function handleError(_0x35e7da,_0x8b1a41){_0x8b1a41=_0x8b1a41||0x1f4;return function(_0x3b1906){logger['error'](_0x3b1906[_0x48c5('0x26')]);if(_0x3b1906[_0x48c5('0x27')]){delete _0x3b1906[_0x48c5('0x27')];}_0x35e7da[_0x48c5('0x19')](_0x8b1a41)['send'](_0x3b1906);};}exports[_0x48c5('0x28')]=function(_0x165846,_0x1e511d){var _0x46298c={},_0x1b1580={},_0x16463f={'count':0x0,'rows':[]};var _0xebbcf9=_[_0x48c5('0x29')](db[_0x48c5('0x2a')][_0x48c5('0x2b')],function(_0x1c2e05){return{'name':_0x1c2e05[_0x48c5('0x2c')],'type':_0x1c2e05['type']['key']};});_0x1b1580['model']=_[_0x48c5('0x29')](_0xebbcf9,_0x48c5('0x27'));_0x1b1580[_0x48c5('0x2d')]=_[_0x48c5('0x2e')](_0x165846[_0x48c5('0x2d')]);_0x1b1580[_0x48c5('0x2f')]=_['intersection'](_0x1b1580[_0x48c5('0x30')],_0x1b1580[_0x48c5('0x2d')]);_0x46298c[_0x48c5('0x31')]=_[_0x48c5('0x32')](_0x1b1580['model'],qs[_0x48c5('0x33')](_0x165846[_0x48c5('0x2d')][_0x48c5('0x33')]));_0x46298c['attributes']=_0x46298c[_0x48c5('0x31')][_0x48c5('0x34')]?_0x46298c[_0x48c5('0x31')]:_0x1b1580[_0x48c5('0x30')];if(!_0x165846[_0x48c5('0x2d')][_0x48c5('0x35')](_0x48c5('0x36'))){_0x46298c['limit']=qs[_0x48c5('0x1e')](_0x165846[_0x48c5('0x2d')]['limit']);_0x46298c[_0x48c5('0x1c')]=qs['offset'](_0x165846[_0x48c5('0x2d')]['offset']);}_0x46298c[_0x48c5('0x37')]=qs[_0x48c5('0x38')](_0x165846[_0x48c5('0x2d')][_0x48c5('0x38')]);_0x46298c['where']=qs[_0x48c5('0x2f')](_[_0x48c5('0x39')](_0x165846['query'],_0x1b1580[_0x48c5('0x2f')]),_0xebbcf9);if(_0x165846[_0x48c5('0x2d')][_0x48c5('0x3a')]){_0x46298c[_0x48c5('0x3b')]=_['merge'](_0x46298c[_0x48c5('0x3b')],{'$or':_[_0x48c5('0x29')](_0xebbcf9,function(_0x336319){if(_0x336319['type']!==_0x48c5('0x3c')){var _0x33155a={};_0x33155a[_0x336319[_0x48c5('0x27')]]={'$like':'%'+_0x165846['query'][_0x48c5('0x3a')]+'%'};return _0x33155a;}})});}_0x46298c=_['merge']({},_0x46298c,_0x165846['options']);var _0x120557={'where':_0x46298c[_0x48c5('0x3b')]};return db[_0x48c5('0x2a')]['count'](_0x120557)[_0x48c5('0x24')](function(_0x37d727){_0x16463f['count']=_0x37d727;if(_0x165846[_0x48c5('0x2d')]['includeAll']){_0x46298c[_0x48c5('0x3d')]=[{'all':!![]}];}return db[_0x48c5('0x2a')][_0x48c5('0x3e')](_0x46298c);})[_0x48c5('0x24')](function(_0x4dfc64){_0x16463f[_0x48c5('0x3f')]=_0x4dfc64;return _0x16463f;})['then'](respondWithFilteredResult(_0x1e511d,_0x46298c))[_0x48c5('0x40')](handleError(_0x1e511d,null));};exports[_0x48c5('0x41')]=function(_0xa18670,_0x5b8e99){var _0x4cf358={'raw':!![],'where':{'id':_0xa18670[_0x48c5('0x42')]['id']}},_0x37b30b={};_0x37b30b[_0x48c5('0x30')]=_[_0x48c5('0x2e')](db['ChatTransferReport']['rawAttributes']);_0x37b30b['query']=_['keys'](_0xa18670[_0x48c5('0x2d')]);_0x37b30b['filters']=_[_0x48c5('0x32')](_0x37b30b[_0x48c5('0x30')],_0x37b30b[_0x48c5('0x2d')]);_0x4cf358[_0x48c5('0x31')]=_[_0x48c5('0x32')](_0x37b30b[_0x48c5('0x30')],qs['fields'](_0xa18670[_0x48c5('0x2d')][_0x48c5('0x33')]));_0x4cf358[_0x48c5('0x31')]=_0x4cf358['attributes'][_0x48c5('0x34')]?_0x4cf358[_0x48c5('0x31')]:_0x37b30b[_0x48c5('0x30')];if(_0xa18670[_0x48c5('0x2d')][_0x48c5('0x43')]){_0x4cf358[_0x48c5('0x3d')]=[{'all':!![]}];}_0x4cf358=_[_0x48c5('0x44')]({},_0x4cf358,_0xa18670[_0x48c5('0x45')]);return db[_0x48c5('0x2a')][_0x48c5('0x46')](_0x4cf358)[_0x48c5('0x24')](handleEntityNotFound(_0x5b8e99,null))[_0x48c5('0x24')](respondWithResult(_0x5b8e99,null))[_0x48c5('0x40')](handleError(_0x5b8e99,null));};exports[_0x48c5('0x47')]=function(_0x4c99cd,_0x5a64cf){return db[_0x48c5('0x2a')][_0x48c5('0x47')](_0x4c99cd[_0x48c5('0x48')],{})[_0x48c5('0x24')](respondWithResult(_0x5a64cf,0xc9))[_0x48c5('0x40')](handleError(_0x5a64cf,null));};exports[_0x48c5('0x23')]=function(_0x1a2174,_0x478628){if(_0x1a2174[_0x48c5('0x48')]['id']){delete _0x1a2174[_0x48c5('0x48')]['id'];}return db[_0x48c5('0x2a')][_0x48c5('0x46')]({'where':{'id':_0x1a2174[_0x48c5('0x42')]['id']}})[_0x48c5('0x24')](handleEntityNotFound(_0x478628,null))[_0x48c5('0x24')](saveUpdates(_0x1a2174[_0x48c5('0x48')],null))[_0x48c5('0x24')](respondWithResult(_0x478628,null))[_0x48c5('0x40')](handleError(_0x478628,null));};exports['destroy']=function(_0x1f3c43,_0x3bce8a){return db[_0x48c5('0x2a')][_0x48c5('0x46')]({'where':{'id':_0x1f3c43[_0x48c5('0x42')]['id']}})[_0x48c5('0x24')](handleEntityNotFound(_0x3bce8a,null))[_0x48c5('0x24')](removeEntity(_0x3bce8a,null))['catch'](handleError(_0x3bce8a,null));};exports['describe']=function(_0x345d95,_0x1bac86){return db[_0x48c5('0x2a')][_0x48c5('0x49')]()[_0x48c5('0x24')](respondWithResult(_0x1bac86,null))[_0x48c5('0x40')](handleError(_0x1bac86,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index c9d9a53..f140c82 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 _0x368c=['report_chat_transfer','uniqueid','lodash','util','api','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','define','ChatTransferReport'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x368c,0x18e));var _0xc368=function(_0x2c0ffd,_0x42f26b){_0x2c0ffd=_0x2c0ffd-0x0;var _0x4247e8=_0x368c[_0x2c0ffd];return _0x4247e8;};'use strict';var _=require(_0xc368('0x0'));var util=require(_0xc368('0x1'));var logger=require('../../config/logger')(_0xc368('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc368('0x3'));var fs=require('fs');var path=require(_0xc368('0x4'));var rimraf=require(_0xc368('0x5'));var config=require(_0xc368('0x6'));var attributes=require(_0xc368('0x7'));module['exports']=function(_0x5c9400,_0x4cec2b){return _0x5c9400[_0xc368('0x8')](_0xc368('0x9'),attributes,{'tableName':_0xc368('0xa'),'paranoid':![],'indexes':[{'name':_0xc368('0xb'),'fields':[_0xc368('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x19ba=['../../config/environment','./chatTransferReport.attributes','exports','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x112fe3,_0x16b642){var _0x1ec903=function(_0x1539eb){while(--_0x1539eb){_0x112fe3['push'](_0x112fe3['shift']());}};_0x1ec903(++_0x16b642);}(_0x19ba,0x172));var _0xa19b=function(_0x54a6e7,_0xe3895c){_0x54a6e7=_0x54a6e7-0x0;var _0x8b5cce=_0x19ba[_0x54a6e7];return _0x8b5cce;};'use strict';var _=require(_0xa19b('0x0'));var util=require(_0xa19b('0x1'));var logger=require(_0xa19b('0x2'))(_0xa19b('0x3'));var moment=require(_0xa19b('0x4'));var BPromise=require('bluebird');var rp=require(_0xa19b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa19b('0x6'));var config=require(_0xa19b('0x7'));var attributes=require(_0xa19b('0x8'));module[_0xa19b('0x9')]=function(_0x278331,_0x18842d){return _0x278331['define'](_0xa19b('0xa'),attributes,{'tableName':_0xa19b('0xb'),'paranoid':![],'indexes':[{'name':_0xa19b('0xc'),'fields':[_0xa19b('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index ace4e06..9327d32 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 _0xb7a0=['debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x5057b6,_0x48fd8b){var _0x2d7dba=function(_0x3197b4){while(--_0x3197b4){_0x5057b6['push'](_0x5057b6['shift']());}};_0x2d7dba(++_0x48fd8b);}(_0xb7a0,0x7a));var _0x0b7a=function(_0x371fb3,_0x2c3bcd){_0x371fb3=_0x371fb3-0x0;var _0x4304b4=_0xb7a0[_0x371fb3];return _0x4304b4;};'use strict';var _=require('lodash');var util=require(_0x0b7a('0x0'));var moment=require(_0x0b7a('0x1'));var BPromise=require(_0x0b7a('0x2'));var rs=require(_0x0b7a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0b7a('0x4'))['db'];var utils=require(_0x0b7a('0x5'));var logger=require(_0x0b7a('0x6'))('rpc');var config=require(_0x0b7a('0x7'));var jayson=require(_0x0b7a('0x8'));var client=jayson[_0x0b7a('0x9')][_0x0b7a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x456cd8,_0x204933,_0x11ec13){return new BPromise(function(_0x81124a,_0x50b153){return client[_0x0b7a('0xb')](_0x456cd8,_0x11ec13)[_0x0b7a('0xc')](function(_0x59fe81){logger[_0x0b7a('0xd')](_0x0b7a('0xe'),_0x204933,_0x0b7a('0xf'));logger[_0x0b7a('0x10')](_0x0b7a('0x11'),_0x204933,_0x0b7a('0xf'),JSON[_0x0b7a('0x12')](_0x59fe81));if(_0x59fe81[_0x0b7a('0x13')]){if(_0x59fe81[_0x0b7a('0x13')][_0x0b7a('0x14')]===0x1f4){logger[_0x0b7a('0x13')](_0x0b7a('0xe'),_0x204933,_0x59fe81[_0x0b7a('0x13')][_0x0b7a('0x15')]);return _0x50b153(_0x59fe81[_0x0b7a('0x13')]['message']);}logger[_0x0b7a('0x13')](_0x0b7a('0xe'),_0x204933,_0x59fe81[_0x0b7a('0x13')][_0x0b7a('0x15')]);return _0x81124a(_0x59fe81['error']['message']);}else{logger[_0x0b7a('0xd')](_0x0b7a('0xe'),_0x204933,_0x0b7a('0xf'));_0x81124a(_0x59fe81['result'][_0x0b7a('0x15')]);}})[_0x0b7a('0x16')](function(_0x24b4a1){logger[_0x0b7a('0x13')](_0x0b7a('0xe'),_0x204933,_0x24b4a1);_0x50b153(_0x24b4a1);});});} \ No newline at end of file +var _0xebf2=['rpc','../../config/environment','client','http','request','then','info','debug','error','code','ChatTransferReport,\x20%s,\x20%s','message','request\x20sent','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x21354a,_0x3c4926){var _0x128fb6=function(_0x274772){while(--_0x274772){_0x21354a['push'](_0x21354a['shift']());}};_0x128fb6(++_0x3c4926);}(_0xebf2,0x8b));var _0x2ebf=function(_0x204e08,_0x11f5dc){_0x204e08=_0x204e08-0x0;var _0x4dfe3a=_0xebf2[_0x204e08];return _0x4dfe3a;};'use strict';var _=require(_0x2ebf('0x0'));var util=require(_0x2ebf('0x1'));var moment=require(_0x2ebf('0x2'));var BPromise=require(_0x2ebf('0x3'));var rs=require(_0x2ebf('0x4'));var fs=require('fs');var Redis=require(_0x2ebf('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2ebf('0x6'));var logger=require(_0x2ebf('0x7'))(_0x2ebf('0x8'));var config=require(_0x2ebf('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2ebf('0xa')][_0x2ebf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3daca7,_0xc455ea,_0x1ba725){return new BPromise(function(_0x5e06a8,_0x398944){return client[_0x2ebf('0xc')](_0x3daca7,_0x1ba725)[_0x2ebf('0xd')](function(_0x535878){logger[_0x2ebf('0xe')]('ChatTransferReport,\x20%s,\x20%s',_0xc455ea,'request\x20sent');logger[_0x2ebf('0xf')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0xc455ea,'request\x20sent',JSON['stringify'](_0x535878));if(_0x535878['error']){if(_0x535878[_0x2ebf('0x10')][_0x2ebf('0x11')]===0x1f4){logger[_0x2ebf('0x10')](_0x2ebf('0x12'),_0xc455ea,_0x535878[_0x2ebf('0x10')][_0x2ebf('0x13')]);return _0x398944(_0x535878[_0x2ebf('0x10')][_0x2ebf('0x13')]);}logger['error']('ChatTransferReport,\x20%s,\x20%s',_0xc455ea,_0x535878[_0x2ebf('0x10')][_0x2ebf('0x13')]);return _0x5e06a8(_0x535878[_0x2ebf('0x10')][_0x2ebf('0x13')]);}else{logger['info']('ChatTransferReport,\x20%s,\x20%s',_0xc455ea,_0x2ebf('0x14'));_0x5e06a8(_0x535878['result']['message']);}})['catch'](function(_0x57aa72){logger[_0x2ebf('0x10')](_0x2ebf('0x12'),_0xc455ea,_0x57aa72);_0x398944(_0x57aa72);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 15bc801..dfc3ec9 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 _0x47a4=['delete','destroy','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','put'];(function(_0x4a7c02,_0x15b41c){var _0x21e305=function(_0x4647fe){while(--_0x4647fe){_0x4a7c02['push'](_0x4a7c02['shift']());}};_0x21e305(++_0x15b41c);}(_0x47a4,0xe6));var _0x447a=function(_0x7a4cca,_0x4165d2){_0x7a4cca=_0x7a4cca-0x0;var _0x48d98f=_0x47a4[_0x7a4cca];return _0x48d98f;};'use strict';var multer=require('multer');var util=require(_0x447a('0x0'));var path=require('path');var timeout=require(_0x447a('0x1'));var express=require(_0x447a('0x2'));var router=express[_0x447a('0x3')]();var fs_extra=require(_0x447a('0x4'));var auth=require(_0x447a('0x5'));var interaction=require(_0x447a('0x6'));var config=require(_0x447a('0x7'));var controller=require(_0x447a('0x8'));router[_0x447a('0x9')]('/',auth[_0x447a('0xa')](),controller[_0x447a('0xb')]);router[_0x447a('0x9')](_0x447a('0xc'),auth[_0x447a('0xa')](),controller['describe']);router['get'](_0x447a('0xd'),auth[_0x447a('0xa')](),controller[_0x447a('0xe')]);router[_0x447a('0xf')]('/',auth[_0x447a('0xa')](),controller['create']);router[_0x447a('0x10')](_0x447a('0xd'),auth[_0x447a('0xa')](),controller['update']);router[_0x447a('0x11')]('/:id',auth[_0x447a('0xa')](),controller[_0x447a('0x12')]);module['exports']=router; \ No newline at end of file +var _0x23a7=['/:id','show','create','put','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./chatTransferReport.controller','get','index','/describe','isAuthenticated','describe'];(function(_0x5dc778,_0x20192d){var _0x1977ee=function(_0x1496d2){while(--_0x1496d2){_0x5dc778['push'](_0x5dc778['shift']());}};_0x1977ee(++_0x20192d);}(_0x23a7,0xc3));var _0x723a=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x23a7[_0x618414];return _0x21c19a;};'use strict';var multer=require(_0x723a('0x0'));var util=require(_0x723a('0x1'));var path=require(_0x723a('0x2'));var timeout=require(_0x723a('0x3'));var express=require(_0x723a('0x4'));var router=express['Router']();var fs_extra=require(_0x723a('0x5'));var auth=require(_0x723a('0x6'));var interaction=require(_0x723a('0x7'));var config=require('../../config/environment');var controller=require(_0x723a('0x8'));router[_0x723a('0x9')]('/',auth['isAuthenticated'](),controller[_0x723a('0xa')]);router[_0x723a('0x9')](_0x723a('0xb'),auth[_0x723a('0xc')](),controller[_0x723a('0xd')]);router[_0x723a('0x9')](_0x723a('0xe'),auth[_0x723a('0xc')](),controller[_0x723a('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x723a('0x10')]);router[_0x723a('0x11')](_0x723a('0xe'),auth[_0x723a('0xc')](),controller['update']);router['delete'](_0x723a('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x723a('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 0c94832..8a3974d 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 _0x1d25=['#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','squared','rounded','We\x20are\x20here!','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','stringify','name','onlineForm','parse','getDataValue','setDataValue','input','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','bottom_right','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','randomstring','exports','STRING','address','email','Agent'];(function(_0x5016c9,_0x57cdf0){var _0x5371ee=function(_0x494af9){while(--_0x494af9){_0x5016c9['push'](_0x5016c9['shift']());}};_0x5371ee(++_0x57cdf0);}(_0x1d25,0x96));var _0x51d2=function(_0x45313f,_0x46caf4){_0x45313f=_0x45313f-0x0;var _0x402910=_0x1d25[_0x45313f];return _0x402910;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x51d2('0x0'));module[_0x51d2('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0x51d2('0x2')],'allowNull':![],'unique':_0x51d2('0x3')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x51d2('0x2')],'defaultValue':_0x51d2('0x4')},'mapKeyOffline':{'type':Sequelize[_0x51d2('0x2')],'defaultValue':_0x51d2('0x4')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x51d2('0x2')],'defaultValue':_0x51d2('0x5')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0x51d2('0x2')],'allowNull':![],'defaultValue':_0x51d2('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x51d2('0x2')],'allowNull':![],'defaultValue':_0x51d2('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x51d2('0x2')],'allowNull':![],'defaultValue':_0x51d2('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x51d2('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x51d2('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x51d2('0xa')]('rounded',_0x51d2('0xb')),'defaultValue':_0x51d2('0xc')},'header_online':{'type':Sequelize[_0x51d2('0x2')],'defaultValue':_0x51d2('0xd')},'start_chat_button':{'type':Sequelize[_0x51d2('0x2')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x51d2('0xe')},'header_offline':{'type':Sequelize[_0x51d2('0x2')],'defaultValue':_0x51d2('0xf')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x51d2('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x51d2('0x2')],'defaultValue':_0x51d2('0x10')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x51d2('0x11')]},'closingQuestion':{'type':Sequelize[_0x51d2('0x2')],'defaultValue':_0x51d2('0x12')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0x51d2('0x13')},'formSubmitFailureMessage':{'type':Sequelize[_0x51d2('0x2')],'defaultValue':_0x51d2('0x14')},'noteTitle':{'type':Sequelize[_0x51d2('0x2')],'defaultValue':_0x51d2('0x15')},'placeholderMessage':{'type':Sequelize[_0x51d2('0x2')],'defaultValue':_0x51d2('0x16')},'closingMessage':{'type':Sequelize[_0x51d2('0x2')],'defaultValue':_0x51d2('0x17')},'closingMessageButton':{'type':Sequelize[_0x51d2('0x2')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x51d2('0x18')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x51d2('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x51d2('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x51d2('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x51d2('0x2')],'defaultValue':_0x51d2('0x19')},'ratingType':{'type':Sequelize[_0x51d2('0xa')](_0x51d2('0x1a'),'thumb'),'defaultValue':_0x51d2('0x1a')},'ratingStarsNumber':{'type':Sequelize[_0x51d2('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x51d2('0x11')],'defaultValue':function(){return JSON[_0x51d2('0x1b')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x51d2('0x1c'),'type':'text','required':!![]},'props':{'title':_0x51d2('0x1c'),'helpText':''}},{'type':'input','props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x51d2('0x4'),'type':_0x51d2('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x51d2('0x1d'))?JSON[_0x51d2('0x1e')](this[_0x51d2('0x1f')](_0x51d2('0x1d'))):{};},'set':function(_0x1ffc8f){return this[_0x51d2('0x20')]('onlineForm',JSON[_0x51d2('0x1b')](_0x1ffc8f));}},'offlineForm':{'type':Sequelize[_0x51d2('0x11')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x51d2('0x21'),'props':{'title':_0x51d2('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x51d2('0x4')},'variable':null},{'type':_0x51d2('0x22'),'config':{'placeholder':_0x51d2('0x23')},'props':{'title':'Comments','helpText':_0x51d2('0x24')}}],'fromKey':0x0});},'get':function(){return this[_0x51d2('0x1f')](_0x51d2('0x25'))?JSON[_0x51d2('0x1e')](this['getDataValue'](_0x51d2('0x25'))):{};},'set':function(_0x5a368a){return this[_0x51d2('0x20')](_0x51d2('0x25'),JSON[_0x51d2('0x1b')](_0x5a368a));}},'token':{'type':Sequelize[_0x51d2('0x2')],'defaultValue':function(){return rs[_0x51d2('0x26')]();}},'autoclose':{'type':Sequelize[_0x51d2('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x51d2('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x51d2('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x51d2('0x2')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x51d2('0x2')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x51d2('0x27')},'offlineMessageSubject':{'type':Sequelize[_0x51d2('0x2')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x51d2('0x2')],'defaultValue':_0x51d2('0x28')},'enableUnmanagedNote':{'type':Sequelize[_0x51d2('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x51d2('0x2')],'defaultValue':_0x51d2('0x29')},'skipUnmanaged':{'type':Sequelize[_0x51d2('0x2')],'defaultValue':_0x51d2('0x18')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x51d2('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x51d2('0x11')]},'showAgentAvatar':{'type':Sequelize[_0x51d2('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x51d2('0x2')]},'notificationTemplate':{'type':Sequelize[_0x51d2('0x11')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x51d2('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x51d2('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x51d2('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x51d2('0x2')],'defaultValue':_0x51d2('0x2a')},'verticalAlignment':{'type':Sequelize[_0x51d2('0x8')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x51d2('0x2')],'defaultValue':_0x51d2('0x2b')},'defaultTitle':{'type':Sequelize[_0x51d2('0x2')]},'customerAvatar':{'type':Sequelize[_0x51d2('0x11')]},'showCustomerAvatar':{'type':Sequelize[_0x51d2('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x51d2('0x2')],'allowNull':![],'defaultValue':_0x51d2('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x51d2('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x51d2('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x51d2('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x51d2('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0x51d2('0x2d')},'systemAvatar':{'type':Sequelize[_0x51d2('0x11')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x51d2('0x8')],'comment':_0x51d2('0x2e')},'mandatoryDisposition':{'type':Sequelize[_0x51d2('0x9')],'defaultValue':![],'comment':_0x51d2('0x2f'),'set':function(_0x998564){if(!_0x998564)this[_0x51d2('0x20')](_0x51d2('0x30'),null);this['setDataValue'](_0x51d2('0x31'),_0x998564);}},'vidaooEscalation':{'type':Sequelize[_0x51d2('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0x51d2('0x2')],'allowNull':![],'defaultValue':_0x51d2('0x32')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0x51d2('0x33');}},'vidaooMetadata':{'type':Sequelize[_0x51d2('0x11')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x51d2('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x51d2('0x11')]}}; \ No newline at end of file +var _0xc185=['getDataValue','onlineForm','setDataValue','textarea','Comments','offlineForm','parse','generate','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','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','exports','STRING','email','Agent','#011F6A','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Skip','Feedback','stringify','name','text','input'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xc185,0x1b2));var _0x5c18=function(_0xe2ad18,_0x195d01){_0xe2ad18=_0xe2ad18-0x0;var _0x3e9b9f=_0xc185[_0xe2ad18];return _0x3e9b9f;};'use strict';var Sequelize=require(_0x5c18('0x0'));var rs=require('randomstring');module[_0x5c18('0x1')]={'name':{'type':Sequelize[_0x5c18('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x5c18('0x2')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0x5c18('0x2')]},'mapKey':{'type':Sequelize[_0x5c18('0x2')],'defaultValue':_0x5c18('0x3')},'mapKeyOffline':{'type':Sequelize[_0x5c18('0x2')],'defaultValue':_0x5c18('0x3')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x5c18('0x2')],'defaultValue':_0x5c18('0x4')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0x5c18('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x5c18('0x2')],'allowNull':![],'defaultValue':_0x5c18('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x5c18('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x5c18('0x6')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x5c18('0x2')]},'animation':{'type':Sequelize[_0x5c18('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x5c18('0x8')](_0x5c18('0x9'),_0x5c18('0xa')),'defaultValue':_0x5c18('0x9')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0x5c18('0xb')},'start_chat_button':{'type':Sequelize[_0x5c18('0x2')],'defaultValue':_0x5c18('0xc')},'offline_chat_button':{'type':Sequelize[_0x5c18('0x2')],'defaultValue':_0x5c18('0xd')},'header_offline':{'type':Sequelize[_0x5c18('0x2')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0x5c18('0x7')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x5c18('0x6')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x5c18('0x2')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0x5c18('0x7')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x5c18('0xe')]},'closingQuestion':{'type':Sequelize[_0x5c18('0x2')],'defaultValue':_0x5c18('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0x5c18('0x2')],'defaultValue':_0x5c18('0x10')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0x5c18('0x11')},'noteTitle':{'type':Sequelize[_0x5c18('0x2')],'defaultValue':_0x5c18('0x12')},'placeholderMessage':{'type':Sequelize[_0x5c18('0x2')],'defaultValue':_0x5c18('0x13')},'closingMessage':{'type':Sequelize[_0x5c18('0x2')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x5c18('0x2')],'defaultValue':_0x5c18('0xd')},'skipMessageButton':{'type':Sequelize[_0x5c18('0x2')],'defaultValue':_0x5c18('0x14')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x5c18('0x7')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x5c18('0x7')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x5c18('0x2')],'defaultValue':_0x5c18('0x15')},'ratingType':{'type':Sequelize['ENUM']('star','thumb'),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x5c18('0xe')],'defaultValue':function(){return JSON[_0x5c18('0x16')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x5c18('0x17'),'type':_0x5c18('0x18'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x5c18('0x19'),'props':{'title':_0x5c18('0x3'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x5c18('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x5c18('0x1a')](_0x5c18('0x1b'))?JSON['parse'](this[_0x5c18('0x1a')](_0x5c18('0x1b'))):{};},'set':function(_0x289df1){return this[_0x5c18('0x1c')]('onlineForm',JSON[_0x5c18('0x16')](_0x289df1));}},'offlineForm':{'type':Sequelize[_0x5c18('0xe')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x5c18('0x19'),'props':{'title':_0x5c18('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x5c18('0x3'),'type':_0x5c18('0x3')},'variable':null},{'type':_0x5c18('0x1d'),'config':{'placeholder':_0x5c18('0x1e')},'props':{'title':_0x5c18('0x1e'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x5c18('0x1a')](_0x5c18('0x1f'))?JSON[_0x5c18('0x20')](this['getDataValue'](_0x5c18('0x1f'))):{};},'set':function(_0x55fe3a){return this[_0x5c18('0x1c')]('offlineForm',JSON[_0x5c18('0x16')](_0x55fe3a));}},'token':{'type':Sequelize[_0x5c18('0x2')],'defaultValue':function(){return rs[_0x5c18('0x21')]();}},'autoclose':{'type':Sequelize[_0x5c18('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x5c18('0x7')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x5c18('0x7')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x5c18('0x2')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x5c18('0x2')]},'waitingTitle':{'type':Sequelize[_0x5c18('0x2')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x5c18('0x2')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x5c18('0x2')],'defaultValue':_0x5c18('0x22')},'offlineMessageBody':{'type':Sequelize[_0x5c18('0x2')],'defaultValue':_0x5c18('0x23')},'enableUnmanagedNote':{'type':Sequelize[_0x5c18('0x7')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x5c18('0x2')],'defaultValue':_0x5c18('0x24')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x5c18('0x14')},'sendUnmanaged':{'type':Sequelize[_0x5c18('0x2')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x5c18('0x7')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x5c18('0x7')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x5c18('0xe')]},'showAgentAvatar':{'type':Sequelize[_0x5c18('0x7')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x5c18('0xe')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x5c18('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x5c18('0x7')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x5c18('0x2')],'defaultValue':_0x5c18('0x25')},'waitForTheAssignedAgent':{'type':Sequelize[_0x5c18('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x5c18('0x2')],'defaultValue':_0x5c18('0x26')},'verticalAlignment':{'type':Sequelize[_0x5c18('0x6')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x5c18('0x27')},'defaultTitle':{'type':Sequelize[_0x5c18('0x2')]},'customerAvatar':{'type':Sequelize[_0x5c18('0xe')]},'showCustomerAvatar':{'type':Sequelize[_0x5c18('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x5c18('0x6')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x5c18('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5c18('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5c18('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5c18('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x5c18('0x2')],'defaultValue':_0x5c18('0x28')},'systemAvatar':{'type':Sequelize[_0x5c18('0xe')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x5c18('0x29')},'mandatoryDisposition':{'type':Sequelize[_0x5c18('0x7')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1d34ba){if(!_0x1d34ba)this[_0x5c18('0x1c')](_0x5c18('0x2a'),null);this[_0x5c18('0x1c')](_0x5c18('0x2b'),_0x1d34ba);}},'vidaooEscalation':{'type':Sequelize[_0x5c18('0x7')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x5c18('0x2')]},'vidaooTopic':{'type':Sequelize[_0x5c18('0x2')],'allowNull':![],'defaultValue':_0x5c18('0x2c')},'vidaooNote':{'type':Sequelize[_0x5c18('0x2')],'defaultValue':function(){return _0x5c18('0x2d');}},'vidaooMetadata':{'type':Sequelize[_0x5c18('0xe')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x5c18('0x7')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x5c18('0xe')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 1c064fb..2541964 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 _0x5608=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','destroy','ChatWebsites','stack','name','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','find','create','body','user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','nolimit','pick','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','addLogo','sitepic','filename','agentAvatar','file','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','root','server/files/images/logos/default_logo.svg','custom','isNil','join','server/files/images/logos/','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','existsSync','download','getSystemAvatar','server/files/images/avatars/system_avatar.png','user-agent-parser','user-agent','chat','CmContact','Sequelize','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','ValidationError','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','from','CmList','Contacts','DESC','List','account','Applications','list','applications','orderBy','priority','contact','headers','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','stringify','threadId','externalUrl','ChatInteraction','interaction','spread','messageId','get','created','autoclose','push','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','files','send','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','MailAccount','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','originalname','mimetype','server','attachments','offline-chat','openNewInteraction','sequelize','transaction','Smtp','forwardOffline','forwardOfflineAddress','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','MailAccountId','subjectOffline','mapValues','offlineMessageSubject','NotifyMailAccount','notifyMail','Could\x20not\x20remove\x20attachment\x20file','addInteraction','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','Command','getSnippet','iftime\x20%s,%s','interval','timezone','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','Interval','Intervals','../../config/license/util','getLicense','virtual','License','increment','all','server/files/chat/iframe.ejs','remote','x-real-ip','remoteAddress','replace','alignment','textColor','color_button','addApplications','ChatApplication','bulkCreate','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','omit','getProactiveActions','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','Attachment','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','eml-format','zip-dir','fast-json-patch','bluebird','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x5608,0x124));var _0x8560=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x5608[_0x29b609];return _0x54c952;};'use strict';var emlformat=require(_0x8560('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8560('0x1'));var jsonpatch=require(_0x8560('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8560('0x3'));var Mustache=require('mustache');var util=require(_0x8560('0x4'));var path=require(_0x8560('0x5'));var sox=require(_0x8560('0x6'));var csv=require('to-csv');var ejs=require(_0x8560('0x7'));var fs=require('fs');var fs_extra=require(_0x8560('0x8'));var _=require(_0x8560('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8560('0xa'));var deskjs=require(_0x8560('0xb'));var toCsv=require(_0x8560('0xc'));var querystring=require(_0x8560('0xd'));var Papa=require(_0x8560('0xe'));var Redis=require(_0x8560('0xf'));var authService=require(_0x8560('0x10'));var qs=require(_0x8560('0x11'));var as=require(_0x8560('0x12'));var hardwareService=require(_0x8560('0x13'));var logger=require(_0x8560('0x14'))(_0x8560('0x15'));var utils=require(_0x8560('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8560('0x17'))['db'];config[_0x8560('0x18')]=_[_0x8560('0x19')](config[_0x8560('0x18')],{'host':_0x8560('0x1a'),'port':0x18eb});var socket=require(_0x8560('0x1b'))(new Redis(config['redis']));require('./chatWebsite.socket')[_0x8560('0x1c')](socket);var jayson=require(_0x8560('0x1d'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x8560('0x1e')]['http']({'port':0x232a});var client9003=jayson[_0x8560('0x1e')][_0x8560('0x1f')]({'port':0x232b});var client9001=jayson[_0x8560('0x1e')]['http']({'port':0x2329});function respondWithRpcPromise(_0x1bed53,_0x560a0f,_0x7ebb1f,_0x161c0a){return new BPromise(function(_0x3c41dc,_0x247681){var _0x3cbc23=_0x161c0a||client;return _0x3cbc23['request'](_0x1bed53,_0x7ebb1f)[_0x8560('0x20')](function(_0x1f266b){logger['info'](_0x8560('0x21'),_0x560a0f,_0x8560('0x22'));logger[_0x8560('0x23')](_0x8560('0x24'),_0x560a0f,_0x8560('0x22'),JSON['stringify'](_0x1f266b));if(_0x1f266b['error']){if(_0x1f266b[_0x8560('0x25')]['code']===0x1f4){logger[_0x8560('0x25')](_0x8560('0x21'),_0x560a0f,_0x1f266b[_0x8560('0x25')]['message']);return _0x247681(_0x1f266b[_0x8560('0x25')]['message']);}logger[_0x8560('0x25')](_0x8560('0x21'),_0x560a0f,_0x1f266b[_0x8560('0x25')][_0x8560('0x26')]);return _0x3c41dc(_0x1f266b[_0x8560('0x25')][_0x8560('0x26')]);}else{logger[_0x8560('0x27')](_0x8560('0x21'),_0x560a0f,_0x8560('0x22'));_0x3c41dc(_0x1f266b[_0x8560('0x28')][_0x8560('0x26')]);}})[_0x8560('0x29')](function(_0x5d1854){logger[_0x8560('0x25')](_0x8560('0x21'),_0x560a0f,_0x5d1854);_0x247681(_0x5d1854);});});}function respondWithStatusCode(_0x2a4db9,_0x34cedd){_0x34cedd=_0x34cedd||0xcc;return function(_0x517bfa){if(_0x517bfa){return _0x2a4db9[_0x8560('0x2a')](_0x34cedd);}return _0x2a4db9[_0x8560('0x2b')](_0x34cedd)[_0x8560('0x2c')]();};}function respondWithResult(_0x2c0be9,_0x12bbce){_0x12bbce=_0x12bbce||0xc8;return function(_0x471693){if(_0x471693){return _0x2c0be9[_0x8560('0x2b')](_0x12bbce)['json'](_0x471693);}};}function respondWithFilteredResult(_0x1fa668,_0xfc0595){return function(_0x4c835d){if(_0x4c835d){var _0x58179e=typeof _0xfc0595[_0x8560('0x2d')]===_0x8560('0x2e')&&typeof _0xfc0595[_0x8560('0x2f')]==='undefined';var _0x4c5b2e=_0x4c835d['count'];var _0x414d45=_0x58179e?0x0:_0xfc0595[_0x8560('0x2d')];var _0x9ce5c6=_0x58179e?_0x4c835d[_0x8560('0x30')]:_0xfc0595[_0x8560('0x2d')]+_0xfc0595[_0x8560('0x2f')];var _0x404a5b;if(_0x9ce5c6>=_0x4c5b2e){_0x9ce5c6=_0x4c5b2e;_0x404a5b=0xc8;}else{_0x404a5b=0xce;}_0x1fa668[_0x8560('0x2b')](_0x404a5b);return _0x1fa668['set'](_0x8560('0x31'),_0x414d45+'-'+_0x9ce5c6+'/'+_0x4c5b2e)[_0x8560('0x32')](_0x4c835d);}return null;};}function patchUpdates(_0xdd9a7d){return function(_0x5d04eb){try{jsonpatch[_0x8560('0x33')](_0x5d04eb,_0xdd9a7d,!![]);}catch(_0x17b541){return BPromise[_0x8560('0x34')](_0x17b541);}return _0x5d04eb['save']();};}function saveUpdates(_0x1d1e06,_0x50acfe){return function(_0x34cc7c){if(_0x34cc7c){return _0x34cc7c[_0x8560('0x35')](_0x1d1e06)['then'](function(_0x137491){return _0x137491;});}return null;};}function removeEntity(_0x51e2c6,_0x244adb){return function(_0x3f8a46){if(_0x3f8a46){return _0x3f8a46[_0x8560('0x36')]()[_0x8560('0x20')](function(){var _0x2aa5df=_0x3f8a46['get']({'plain':!![]});var _0x35e193=_0x8560('0x37');return db['UserProfileResource'][_0x8560('0x36')]({'where':{'type':_0x35e193,'resourceId':_0x2aa5df['id']}})[_0x8560('0x20')](function(){return _0x3f8a46;});})[_0x8560('0x20')](function(){_0x51e2c6[_0x8560('0x2b')](0xcc)[_0x8560('0x2c')]();});}};}function handleEntityNotFound(_0x5d7282,_0x113ebc){return function(_0x54b6e4){if(!_0x54b6e4){_0x5d7282[_0x8560('0x2a')](0x194);}return _0x54b6e4;};}function handleError(_0x3d030a,_0xc50569){_0xc50569=_0xc50569||0x1f4;return function(_0x25d667){logger[_0x8560('0x25')](_0x25d667[_0x8560('0x38')]);if(_0x25d667[_0x8560('0x39')]){delete _0x25d667[_0x8560('0x39')];}_0x3d030a[_0x8560('0x2b')](_0xc50569)['send'](_0x25d667);};}exports[_0x8560('0x3a')]=function(_0x4cd815,_0x1fa76e){var _0x162c35={'include':[{'model':db[_0x8560('0x3b')],'as':_0x8560('0x3c')}]},_0x3e54d6={},_0x3243d5={'count':0x0,'rows':[]};var _0x5e8cdd=_[_0x8560('0x3d')](db[_0x8560('0x3e')][_0x8560('0x3f')],function(_0x40774f){return{'name':_0x40774f[_0x8560('0x40')],'type':_0x40774f[_0x8560('0x41')][_0x8560('0x42')]};});_0x3e54d6[_0x8560('0x43')]=_[_0x8560('0x3d')](_0x5e8cdd,'name');_0x3e54d6['query']=_[_0x8560('0x44')](_0x4cd815[_0x8560('0x45')]);_0x3e54d6['filters']=_[_0x8560('0x46')](_0x3e54d6['model'],_0x3e54d6[_0x8560('0x45')]);_0x162c35[_0x8560('0x47')]=_[_0x8560('0x46')](_0x3e54d6[_0x8560('0x43')],qs[_0x8560('0x48')](_0x4cd815['query'][_0x8560('0x48')]));_0x162c35[_0x8560('0x47')]=_0x162c35['attributes'][_0x8560('0x49')]?_0x162c35[_0x8560('0x47')]:_0x3e54d6['model'];if(!_0x4cd815['query'][_0x8560('0x4a')]('nolimit')){_0x162c35[_0x8560('0x2f')]=qs['limit'](_0x4cd815['query'][_0x8560('0x2f')]);_0x162c35[_0x8560('0x2d')]=qs['offset'](_0x4cd815[_0x8560('0x45')][_0x8560('0x2d')]);}_0x162c35[_0x8560('0x4b')]=qs[_0x8560('0x4c')](_0x4cd815[_0x8560('0x45')][_0x8560('0x4c')]);_0x162c35[_0x8560('0x4d')]=qs[_0x8560('0x4e')](_['pick'](_0x4cd815['query'],_0x3e54d6[_0x8560('0x4e')]),_0x5e8cdd);if(_0x4cd815[_0x8560('0x45')][_0x8560('0x4f')]){_0x162c35[_0x8560('0x4d')]=_[_0x8560('0x50')](_0x162c35['where'],{'$or':_[_0x8560('0x3d')](_0x5e8cdd,function(_0x1cd54a){if(_0x1cd54a[_0x8560('0x41')]!==_0x8560('0x51')){var _0x2ec25d={};_0x2ec25d[_0x1cd54a['name']]={'$like':'%'+_0x4cd815[_0x8560('0x45')][_0x8560('0x4f')]+'%'};return _0x2ec25d;}})});}_0x162c35=_[_0x8560('0x50')]({},_0x162c35,_0x4cd815[_0x8560('0x52')]);var _0xa7fbad={'where':_0x162c35[_0x8560('0x4d')]};return db[_0x8560('0x3e')][_0x8560('0x30')](_0xa7fbad)[_0x8560('0x20')](function(_0x18f1f8){_0x3243d5[_0x8560('0x30')]=_0x18f1f8;if(_0x4cd815[_0x8560('0x45')][_0x8560('0x53')]){_0x162c35[_0x8560('0x54')]=[{'all':!![]}];}return db['ChatWebsite'][_0x8560('0x55')](_0x162c35);})[_0x8560('0x20')](function(_0x23676b){_0x3243d5[_0x8560('0x56')]=_0x23676b;return _0x3243d5;})[_0x8560('0x20')](respondWithFilteredResult(_0x1fa76e,_0x162c35))[_0x8560('0x29')](handleError(_0x1fa76e,null));};exports['show']=function(_0x5acbf6,_0x1a0d3f){var _0x4a44c7={'raw':![],'where':{'id':_0x5acbf6['params']['id']},'include':[{'model':db[_0x8560('0x3b')],'as':'mandatoryDispositionPause'}]},_0xbc2c44={};_0xbc2c44[_0x8560('0x43')]=_[_0x8560('0x44')](db[_0x8560('0x3e')]['rawAttributes']);_0xbc2c44[_0x8560('0x45')]=_[_0x8560('0x44')](_0x5acbf6['query']);_0xbc2c44[_0x8560('0x4e')]=_[_0x8560('0x46')](_0xbc2c44[_0x8560('0x43')],_0xbc2c44[_0x8560('0x45')]);_0x4a44c7[_0x8560('0x47')]=_[_0x8560('0x46')](_0xbc2c44[_0x8560('0x43')],qs['fields'](_0x5acbf6['query']['fields']));_0x4a44c7['attributes']=_0x4a44c7['attributes']['length']?_0x4a44c7[_0x8560('0x47')]:_0xbc2c44['model'];if(_0x5acbf6[_0x8560('0x45')][_0x8560('0x53')]){_0x4a44c7[_0x8560('0x54')]=[{'all':!![]}];}_0x4a44c7=_[_0x8560('0x50')]({},_0x4a44c7,_0x5acbf6['options']);return db[_0x8560('0x3e')][_0x8560('0x57')](_0x4a44c7)[_0x8560('0x20')](handleEntityNotFound(_0x1a0d3f,null))[_0x8560('0x20')](respondWithResult(_0x1a0d3f,null))['catch'](handleError(_0x1a0d3f,null));};exports[_0x8560('0x58')]=function(_0x3ec0b4,_0x4a6487){return db[_0x8560('0x3e')]['create'](_0x3ec0b4[_0x8560('0x59')],{})[_0x8560('0x20')](function(_0x23f64e){var _0x34bf8d=_0x3ec0b4['user']['get']({'plain':!![]});if(!_0x34bf8d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x34bf8d['role']===_0x8560('0x5a')){var _0x18e18e=_0x23f64e['get']({'plain':!![]});var _0x346f8f=_0x8560('0x37');return db[_0x8560('0x5b')][_0x8560('0x57')]({'where':{'name':_0x346f8f,'userProfileId':_0x34bf8d[_0x8560('0x5c')]},'raw':!![]})[_0x8560('0x20')](function(_0x5af334){if(_0x5af334&&_0x5af334['autoAssociation']===0x0){return db[_0x8560('0x5d')][_0x8560('0x58')]({'name':_0x18e18e['name'],'resourceId':_0x18e18e['id'],'type':_0x5af334[_0x8560('0x39')],'sectionId':_0x5af334['id']},{})[_0x8560('0x20')](function(){return _0x23f64e;});}else{return _0x23f64e;}})[_0x8560('0x29')](function(_0x34b49e){logger[_0x8560('0x25')](_0x8560('0x5e'),_0x34b49e);throw _0x34b49e;});}return _0x23f64e;})[_0x8560('0x20')](respondWithResult(_0x4a6487,0xc9))[_0x8560('0x29')](handleError(_0x4a6487,null));};exports[_0x8560('0x35')]=function(_0x4b336d,_0x1c3459){if(_0x4b336d[_0x8560('0x59')]['id']){delete _0x4b336d[_0x8560('0x59')]['id'];}return db[_0x8560('0x3e')]['find']({'where':{'id':_0x4b336d['params']['id']},'include':[{'model':db[_0x8560('0x3b')],'as':_0x8560('0x3c')}]})[_0x8560('0x20')](handleEntityNotFound(_0x1c3459,null))[_0x8560('0x20')](saveUpdates(_0x4b336d[_0x8560('0x59')],null))['then'](respondWithResult(_0x1c3459,null))[_0x8560('0x29')](handleError(_0x1c3459,null));};exports[_0x8560('0x36')]=function(_0x4cfd22,_0x970ea6){return db[_0x8560('0x3e')][_0x8560('0x57')]({'where':{'id':_0x4cfd22[_0x8560('0x5f')]['id']}})[_0x8560('0x20')](handleEntityNotFound(_0x970ea6,null))[_0x8560('0x20')](removeEntity(_0x970ea6,null))[_0x8560('0x29')](handleError(_0x970ea6,null));};exports[_0x8560('0x60')]=function(_0xecc63e,_0x4ce1a9){return db[_0x8560('0x3e')]['describe']()['then'](respondWithResult(_0x4ce1a9,null))[_0x8560('0x29')](handleError(_0x4ce1a9,null));};exports[_0x8560('0x61')]=function(_0x104830,_0x10dd0e,_0x576d46){if(_0x104830[_0x8560('0x59')]['id']){delete _0x104830[_0x8560('0x59')]['id'];}return db[_0x8560('0x3e')][_0x8560('0x57')]({'where':{'id':_0x104830['params']['id']}})['then'](handleEntityNotFound(_0x10dd0e,null))[_0x8560('0x20')](function(_0x55b44d){if(_0x55b44d){_0x104830[_0x8560('0x59')][_0x8560('0x62')]=_0x55b44d['id'];return db[_0x8560('0x63')]['create'](_0x104830['body']);}})[_0x8560('0x20')](respondWithResult(_0x10dd0e,null))[_0x8560('0x29')](handleError(_0x10dd0e,null));};exports[_0x8560('0x64')]=function(_0xb4e407,_0x41c588,_0x48f457){var _0x33932f={'raw':![],'where':{}};var _0x4cca93={};var _0x576071={'count':0x0,'rows':[]};return db[_0x8560('0x3e')]['findOne']({'where':{'id':_0xb4e407['params']['id']}})[_0x8560('0x20')](handleEntityNotFound(_0x41c588,null))[_0x8560('0x20')](function(_0x5c69c8){if(_0x5c69c8){_0x4cca93['model']=_[_0x8560('0x44')](db[_0x8560('0x63')]['rawAttributes']);_0x4cca93[_0x8560('0x45')]=_[_0x8560('0x44')](_0xb4e407['query']);_0x4cca93[_0x8560('0x4e')]=_['intersection'](_0x4cca93[_0x8560('0x43')],_0x4cca93[_0x8560('0x45')]);_0x33932f[_0x8560('0x47')]=_[_0x8560('0x46')](_0x4cca93['model'],qs['fields'](_0xb4e407[_0x8560('0x45')]['fields']));_0x33932f[_0x8560('0x47')]=_0x33932f[_0x8560('0x47')][_0x8560('0x49')]?_0x33932f['attributes']:_0x4cca93[_0x8560('0x43')];if(!_0xb4e407[_0x8560('0x45')][_0x8560('0x4a')](_0x8560('0x65'))){_0x33932f[_0x8560('0x2f')]=qs[_0x8560('0x2f')](_0xb4e407['query'][_0x8560('0x2f')]);_0x33932f[_0x8560('0x2d')]=qs[_0x8560('0x2d')](_0xb4e407[_0x8560('0x45')][_0x8560('0x2d')]);}_0x33932f[_0x8560('0x4b')]=qs[_0x8560('0x4c')](_0xb4e407[_0x8560('0x45')][_0x8560('0x4c')]);_0x33932f['where']=qs[_0x8560('0x4e')](_[_0x8560('0x66')](_0xb4e407[_0x8560('0x45')],_0x4cca93[_0x8560('0x4e')]));_0x33932f[_0x8560('0x4d')]['ChatWebsiteId']=_0x5c69c8['id'];if(_0xb4e407['query'][_0x8560('0x4f')]){_0x33932f[_0x8560('0x4d')]=_[_0x8560('0x50')](_0x33932f[_0x8560('0x4d')],{'$or':_[_0x8560('0x3d')](_0x33932f['attributes'],function(_0x408b93){var _0x48cab6={};_0x48cab6[_0x408b93]={'$like':'%'+_0xb4e407[_0x8560('0x45')]['filter']+'%'};return _0x48cab6;})});}_0x33932f=_[_0x8560('0x50')]({},_0x33932f,_0xb4e407[_0x8560('0x52')]);return db[_0x8560('0x63')]['count']({'where':_0x33932f[_0x8560('0x4d')]})['then'](function(_0x17127d){_0x576071[_0x8560('0x30')]=_0x17127d;if(_0xb4e407[_0x8560('0x45')][_0x8560('0x53')]){_0x33932f[_0x8560('0x54')]=[{'all':!![]}];}return db[_0x8560('0x63')][_0x8560('0x55')](_0x33932f);})[_0x8560('0x20')](function(_0x35b928){_0x576071[_0x8560('0x56')]=_0x35b928;return _0x576071;});}})[_0x8560('0x20')](respondWithFilteredResult(_0x41c588,_0x33932f))[_0x8560('0x29')](handleError(_0x41c588,null));};exports['removeDispositions']=function(_0x403559,_0x125d73,_0xf9b82d){return db[_0x8560('0x3e')]['find']({'where':{'id':_0x403559[_0x8560('0x5f')]['id']}})[_0x8560('0x20')](handleEntityNotFound(_0x125d73,null))['then'](function(_0x14d345){if(_0x14d345){return _0x14d345[_0x8560('0x67')](_0x403559['query'][_0x8560('0x68')]);}})['then'](respondWithStatusCode(_0x125d73,null))[_0x8560('0x29')](handleError(_0x125d73,null));};exports[_0x8560('0x69')]=function(_0x3a815c,_0x3d56b3,_0x1eb93c){if(_0x3a815c[_0x8560('0x59')]['id']){delete _0x3a815c[_0x8560('0x59')]['id'];}return db[_0x8560('0x3e')]['find']({'where':{'id':_0x3a815c['params']['id']}})[_0x8560('0x20')](handleEntityNotFound(_0x3d56b3,null))['then'](function(_0x5004c0){if(_0x5004c0){_0x3a815c[_0x8560('0x59')]['ChatWebsiteId']=_0x5004c0['id'];return db[_0x8560('0x6a')][_0x8560('0x58')](_0x3a815c[_0x8560('0x59')]);}})[_0x8560('0x20')](respondWithResult(_0x3d56b3,null))['catch'](handleError(_0x3d56b3,null));};exports[_0x8560('0x6b')]=function(_0x553895,_0x24483b,_0x21c688){var _0x301483={'raw':![],'where':{}};var _0x4ceac5={};var _0xae720c={'count':0x0,'rows':[]};return db[_0x8560('0x3e')][_0x8560('0x6c')]({'where':{'id':_0x553895[_0x8560('0x5f')]['id']}})[_0x8560('0x20')](handleEntityNotFound(_0x24483b,null))['then'](function(_0x4d2de0){if(_0x4d2de0){_0x4ceac5[_0x8560('0x43')]=_[_0x8560('0x44')](db['CannedAnswer']['rawAttributes']);_0x4ceac5['query']=_['keys'](_0x553895[_0x8560('0x45')]);_0x4ceac5[_0x8560('0x4e')]=_[_0x8560('0x46')](_0x4ceac5[_0x8560('0x43')],_0x4ceac5[_0x8560('0x45')]);_0x301483[_0x8560('0x47')]=_[_0x8560('0x46')](_0x4ceac5[_0x8560('0x43')],qs[_0x8560('0x48')](_0x553895['query'][_0x8560('0x48')]));_0x301483[_0x8560('0x47')]=_0x301483[_0x8560('0x47')][_0x8560('0x49')]?_0x301483[_0x8560('0x47')]:_0x4ceac5['model'];if(!_0x553895['query']['hasOwnProperty'](_0x8560('0x65'))){_0x301483['limit']=qs[_0x8560('0x2f')](_0x553895[_0x8560('0x45')]['limit']);_0x301483['offset']=qs['offset'](_0x553895[_0x8560('0x45')][_0x8560('0x2d')]);}_0x301483[_0x8560('0x4b')]=qs['sort'](_0x553895['query'][_0x8560('0x4c')]);_0x301483[_0x8560('0x4d')]=qs[_0x8560('0x4e')](_[_0x8560('0x66')](_0x553895[_0x8560('0x45')],_0x4ceac5[_0x8560('0x4e')]));_0x301483[_0x8560('0x4d')][_0x8560('0x62')]=_0x4d2de0['id'];if(_0x553895[_0x8560('0x45')][_0x8560('0x4f')]){_0x301483[_0x8560('0x4d')]=_['merge'](_0x301483[_0x8560('0x4d')],{'$or':_[_0x8560('0x3d')](_0x301483[_0x8560('0x47')],function(_0x2c69d6){var _0x540db8={};_0x540db8[_0x2c69d6]={'$like':'%'+_0x553895[_0x8560('0x45')][_0x8560('0x4f')]+'%'};return _0x540db8;})});}_0x301483=_[_0x8560('0x50')]({},_0x301483,_0x553895[_0x8560('0x52')]);return db[_0x8560('0x6a')][_0x8560('0x30')]({'where':_0x301483[_0x8560('0x4d')]})[_0x8560('0x20')](function(_0x23bf6c){_0xae720c[_0x8560('0x30')]=_0x23bf6c;if(_0x553895[_0x8560('0x45')][_0x8560('0x53')]){_0x301483['include']=[{'all':!![]}];}return db[_0x8560('0x6a')][_0x8560('0x55')](_0x301483);})[_0x8560('0x20')](function(_0x5c7923){_0xae720c[_0x8560('0x56')]=_0x5c7923;return _0xae720c;});}})[_0x8560('0x20')](respondWithFilteredResult(_0x24483b,_0x301483))[_0x8560('0x29')](handleError(_0x24483b,null));};exports[_0x8560('0x6d')]=function(_0x25d55a,_0x2ac0a5,_0x5b6fd3){return db[_0x8560('0x3e')]['find']({'where':{'id':_0x25d55a[_0x8560('0x5f')]['id']}})[_0x8560('0x20')](handleEntityNotFound(_0x2ac0a5,null))[_0x8560('0x20')](function(_0x3761b3){if(_0x3761b3){return _0x3761b3[_0x8560('0x6d')](_0x25d55a[_0x8560('0x45')][_0x8560('0x68')]);}})[_0x8560('0x20')](respondWithStatusCode(_0x2ac0a5,null))[_0x8560('0x29')](handleError(_0x2ac0a5,null));};exports[_0x8560('0x6e')]=function(_0x453f86,_0x245b3a,_0x3b3978){_0x453f86[_0x8560('0x59')][_0x8560('0x6f')]=_0x453f86['file'][_0x8560('0x70')];return db['ChatWebsite'][_0x8560('0x57')]({'where':{'id':_0x453f86[_0x8560('0x5f')]['id']}})[_0x8560('0x20')](handleEntityNotFound(_0x245b3a,null))['then'](saveUpdates(_0x453f86['body'],null))[_0x8560('0x20')](respondWithResult(_0x245b3a,null))[_0x8560('0x29')](handleError(_0x245b3a,null));};exports['addAvatar']=function(_0xffc128,_0x3fbcb3,_0x4ec786){_0xffc128[_0x8560('0x59')][_0x8560('0x71')]=_0xffc128[_0x8560('0x72')][_0x8560('0x70')];return db[_0x8560('0x3e')][_0x8560('0x57')]({'where':{'id':_0xffc128['params']['id']}})['then'](handleEntityNotFound(_0x3fbcb3,null))[_0x8560('0x20')](saveUpdates(_0xffc128[_0x8560('0x59')],null))['then'](respondWithResult(_0x3fbcb3,null))[_0x8560('0x29')](handleError(_0x3fbcb3,null));};exports[_0x8560('0x73')]=function(_0x17aa95,_0x5bbb9c,_0x3ae735){_0x17aa95['body'][_0x8560('0x74')]=_0x17aa95['file'][_0x8560('0x70')];return db[_0x8560('0x3e')][_0x8560('0x57')]({'where':{'id':_0x17aa95['params']['id']}})[_0x8560('0x20')](handleEntityNotFound(_0x5bbb9c,null))[_0x8560('0x20')](saveUpdates(_0x17aa95[_0x8560('0x59')],null))[_0x8560('0x20')](respondWithResult(_0x5bbb9c,null))[_0x8560('0x29')](handleError(_0x5bbb9c,null));};exports[_0x8560('0x75')]=function(_0xabdb72,_0x5ef74a,_0x263afa){_0xabdb72[_0x8560('0x59')][_0x8560('0x76')]=_0xabdb72[_0x8560('0x72')][_0x8560('0x70')];return db[_0x8560('0x3e')]['find']({'where':{'id':_0xabdb72[_0x8560('0x5f')]['id']}})['then'](handleEntityNotFound(_0x5ef74a,null))[_0x8560('0x20')](saveUpdates(_0xabdb72[_0x8560('0x59')],null))[_0x8560('0x20')](respondWithResult(_0x5ef74a,null))['catch'](handleError(_0x5ef74a,null));};exports[_0x8560('0x77')]=function(_0x3e2654,_0x34a622,_0x5965ec){var _0x481743=path['join'](config[_0x8560('0x78')],_0x8560('0x79'));var _0xf95084={'where':{'id':_0x3e2654[_0x8560('0x5f')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x56a0b0=![];return require('../../config/license/util')['getLicense']()['then'](function(_0xae8d61){if(_0xae8d61){_0x56a0b0=_0xae8d61[_0x8560('0x7a')];}})[_0x8560('0x20')](function(){return db['ChatWebsite'][_0x8560('0x57')](_0xf95084);})[_0x8560('0x20')](handleEntityNotFound(_0x34a622,null))[_0x8560('0x20')](function(_0x55cc6f){if(_0x55cc6f){if(!_[_0x8560('0x7b')](_0x55cc6f[_0x8560('0x6f')])){if(fs['existsSync'](path[_0x8560('0x7c')](config[_0x8560('0x78')],_0x8560('0x7d'),_0x55cc6f[_0x8560('0x6f')]))&&_0x56a0b0){_0x481743=path[_0x8560('0x7c')](config['root'],_0x8560('0x7d'),_0x55cc6f[_0x8560('0x6f')]);}}return _0x34a622['download'](_0x481743);}})[_0x8560('0x29')](handleError(_0x34a622,null));};exports[_0x8560('0x7e')]=function(_0x18a781,_0x25c479,_0x53a0a6){var _0x1b328c=path[_0x8560('0x7c')](config['root'],_0x8560('0x7f'));var _0xf9f989={'where':{'id':_0x18a781[_0x8560('0x5f')]['id']},'attributes':['id',_0x8560('0x71')],'raw':!![]};return db[_0x8560('0x3e')][_0x8560('0x57')](_0xf9f989)[_0x8560('0x20')](handleEntityNotFound(_0x25c479,null))['then'](function(_0x312583){if(_0x312583){if(!_[_0x8560('0x7b')](_0x312583[_0x8560('0x71')])){if(fs['existsSync'](path[_0x8560('0x7c')](config[_0x8560('0x78')],_0x8560('0x80'),_0x312583[_0x8560('0x71')]))){_0x1b328c=path[_0x8560('0x7c')](config[_0x8560('0x78')],_0x8560('0x80'),_0x312583[_0x8560('0x71')]);}}return _0x25c479['download'](_0x1b328c);}})[_0x8560('0x29')](handleError(_0x25c479,null));};exports[_0x8560('0x81')]=function(_0xad4743,_0x552ff6,_0xb96a8d){var _0x39ca48=path['join'](config['root'],'server/files/images/avatars/customer_avatar.png');var _0x51fc5c={'where':{'id':_0xad4743[_0x8560('0x5f')]['id']},'attributes':['id','customerAvatar','showCustomerAvatar'],'raw':!![]};return db[_0x8560('0x3e')]['find'](_0x51fc5c)[_0x8560('0x20')](handleEntityNotFound(_0x552ff6,null))[_0x8560('0x20')](function(_0x528a78){if(_0x528a78){if(!_['isNil'](_0x528a78[_0x8560('0x74')])){if(fs[_0x8560('0x82')](path[_0x8560('0x7c')](config['root'],'server/files/images/avatars/',_0x528a78[_0x8560('0x74')]))&&_0x528a78['showCustomerAvatar']){_0x39ca48=path[_0x8560('0x7c')](config[_0x8560('0x78')],_0x8560('0x80'),_0x528a78[_0x8560('0x74')]);}}return _0x552ff6[_0x8560('0x83')](_0x39ca48);}})['catch'](handleError(_0x552ff6,null));};exports[_0x8560('0x84')]=function(_0x574a03,_0x10276f,_0x2082df){var _0x4756d4=path[_0x8560('0x7c')](config[_0x8560('0x78')],_0x8560('0x85'));var _0x1c34dc={'where':{'id':_0x574a03[_0x8560('0x5f')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0x8560('0x3e')]['find'](_0x1c34dc)[_0x8560('0x20')](handleEntityNotFound(_0x10276f,null))[_0x8560('0x20')](function(_0x16bffc){if(_0x16bffc){if(!_[_0x8560('0x7b')](_0x16bffc[_0x8560('0x76')])){if(fs[_0x8560('0x82')](path['join'](config[_0x8560('0x78')],'server/files/images/avatars/',_0x16bffc[_0x8560('0x76')]))){_0x4756d4=path[_0x8560('0x7c')](config[_0x8560('0x78')],'server/files/images/avatars/',_0x16bffc[_0x8560('0x76')]);}}return _0x10276f[_0x8560('0x83')](_0x4756d4);}})[_0x8560('0x29')](handleError(_0x10276f,null));};exports['notify']=function(_0x2cdc45,_0x340050,_0xe8073e){var _0x22b70d=require(_0x8560('0x86'));var _0x3dc593=new _0x22b70d();var _0x38f7e9=_0x3dc593['setUA'](_0x2cdc45['headers'][_0x8560('0x87')])['getResult']();var _0x49a573={'body':_0x2cdc45['body'],'channel':_0x8560('0x88')};var _0x2cbd6d=[];var _0x2d5279=[];var _0x2460df={};var _0x466eef=![];return db[_0x8560('0x89')][_0x8560('0x60')]()['then'](function(_0x3da66d){if(!_0x3da66d){throw new db[(_0x8560('0x8a'))]['ValidationError'](_0x8560('0x8b'));}_0x2cbd6d=_[_0x8560('0x8c')](_[_0x8560('0x44')](_0x3da66d),['createdAt',_0x8560('0x8d')]);_0x2d5279=_[_0x8560('0x8c')](_[_0x8560('0x44')](_0x3da66d),[_0x8560('0x8e'),_0x8560('0x8d'),_0x8560('0x8f'),_0x8560('0x90')]);if(_0x2cdc45[_0x8560('0x59')]['id']){delete _0x2cdc45[_0x8560('0x59')]['id'];}if(_[_0x8560('0x7b')](_0x2cdc45[_0x8560('0x59')]['from'])){throw new db[(_0x8560('0x8a'))][(_0x8560('0x91'))]('from\x20is\x20mandatory');}if(_[_0x8560('0x7b')](_0x2cdc45[_0x8560('0x59')][_0x8560('0x59')])||_0x2cdc45[_0x8560('0x59')][_0x8560('0x59')]===''){throw new db[(_0x8560('0x8a'))][(_0x8560('0x91'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x8560('0x7b')](_0x2cdc45[_0x8560('0x59')]['mapKey'])){throw new db[(_0x8560('0x8a'))][(_0x8560('0x91'))](_0x8560('0x92')+_0x2d5279);}if(!_['includes'](_0x2d5279,_0x2cdc45[_0x8560('0x59')]['mapKey'])){throw new db[(_0x8560('0x8a'))][(_0x8560('0x91'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2d5279);}_0x2460df[_0x2cdc45[_0x8560('0x59')][_0x8560('0x93')]]=_0x2cdc45[_0x8560('0x59')][_0x8560('0x94')];})[_0x8560('0x20')](function(){return db[_0x8560('0x3e')]['find']({'where':{'id':_0x2cdc45[_0x8560('0x5f')]['id']},'include':[{'model':db[_0x8560('0x95')],'as':'List','include':[{'model':db[_0x8560('0x89')],'as':_0x8560('0x96'),'where':_0x2460df,'limit':0x1,'order':[['updatedAt',_0x8560('0x97')]]}]},{'model':db['ChatApplication'],'as':'Applications'}]});})[_0x8560('0x20')](handleEntityNotFound(_0x340050,null))[_0x8560('0x20')](function(_0x9ce799){if(_0x9ce799&&_0x9ce799[_0x8560('0x98')]){_0x49a573[_0x8560('0x99')]=_0x9ce799;_0x49a573['applications']=_0x9ce799[_0x8560('0x9a')];_0x49a573[_0x8560('0x9b')]=_0x9ce799['List'];_0x49a573[_0x8560('0x9c')]=_[_0x8560('0x9d')](_0x49a573[_0x8560('0x9c')],[_0x8560('0x9e')],['asc']);if(_0x49a573[_0x8560('0x99')][_0x8560('0x9a')]){delete _0x49a573[_0x8560('0x99')][_0x8560('0x9a')];}if(_0x49a573[_0x8560('0x99')][_0x8560('0x98')]&&_0x49a573[_0x8560('0x99')]['List'][_0x8560('0x96')][_0x8560('0x49')]){return _0x49a573['account'][_0x8560('0x98')][_0x8560('0x96')][0x0];}var _0x2fa213=_[_0x8560('0x19')](_0x2cdc45[_0x8560('0x59')],{'firstName':_0x2cdc45[_0x8560('0x59')][_0x8560('0x94')],'ListId':_0x9ce799[_0x8560('0x90')]});_0x2fa213[_0x2cdc45[_0x8560('0x59')][_0x8560('0x93')]]=_0x2cdc45['body'][_0x8560('0x94')];return db[_0x8560('0x89')]['create'](_0x2fa213,{'fields':_0x2cbd6d,'raw':!![]});}})['then'](handleEntityNotFound(_0x340050,null))[_0x8560('0x20')](function(_0x2f1212){_0x49a573[_0x8560('0x9f')]=_0x2f1212;var _0x5c6458=_0x2cdc45[_0x8560('0x59')]['customerIp'];if(_0x2cdc45[_0x8560('0xa0')]['cf-connecting-ip']){_0x5c6458=_0x2cdc45['headers'][_0x8560('0xa1')];}else if(_0x2cdc45['headers'][_0x8560('0xa2')]){_0x5c6458=_[_0x8560('0xa3')](_0x2cdc45[_0x8560('0xa0')]['x-forwarded-for'][_0x8560('0xa4')](','));}if(_0x2f1212){var _0xb90bdc={'ContactId':_0x2f1212['id'],'ChatWebsiteId':_0x2cdc45[_0x8560('0x5f')]['id'],'from':(_0x2f1212[_0x8560('0xa5')]||'')+'\x20'+(_0x2f1212[_0x8560('0xa6')]||''),'customerIp':_0x5c6458,'customerPort':_0x2cdc45['headers'][_0x8560('0xa7')]?_0x2cdc45[_0x8560('0xa0')][_0x8560('0xa7')]:null,'referer':_0x2cdc45['body'][_0x8560('0xa8')],'browserName':_0x38f7e9['browser']['name']&&_0x38f7e9[_0x8560('0xa9')][_0x8560('0xaa')]?util[_0x8560('0xab')](_0x8560('0xac'),_0x38f7e9[_0x8560('0xa9')]['name'],_0x38f7e9[_0x8560('0xa9')][_0x8560('0xaa')]):_0x8560('0xad'),'browserVersion':_0x38f7e9[_0x8560('0xa9')][_0x8560('0xaa')]||_0x8560('0xad'),'osName':util[_0x8560('0xab')](_0x8560('0xac'),_0x38f7e9['os'][_0x8560('0x39')],_0x38f7e9['os'][_0x8560('0xaa')]),'osVersion':_0x38f7e9['os'][_0x8560('0xaa')],'deviceModel':_0x38f7e9[_0x8560('0xae')][_0x8560('0x43')]&&_0x38f7e9['device'][_0x8560('0xaf')]?util['format'](_0x8560('0xb0'),_0x38f7e9[_0x8560('0xae')][_0x8560('0x43')],_0x38f7e9['device'][_0x8560('0xaf')],_0x38f7e9[_0x8560('0xae')][_0x8560('0x41')]):null,'deviceVendor':_0x38f7e9[_0x8560('0xae')][_0x8560('0xaf')],'deviceType':_0x38f7e9[_0x8560('0xae')][_0x8560('0x41')],'formData':JSON[_0x8560('0xb1')](_0x2cdc45[_0x8560('0x59')])};var _0x34449b={'ChatWebsiteId':_0x2cdc45['params']['id'],'closed':![]};if(_0x2cdc45['body'][_0x8560('0xb2')]){_0x34449b[_0x8560('0xb2')]=_0x2cdc45[_0x8560('0x59')][_0x8560('0xb2')];return db['ChatInteraction'][_0x8560('0x57')]({'where':_0x34449b})[_0x8560('0x20')](function(_0x1ed389){if(_0x1ed389){return[_0x1ed389,![]];}_0xb90bdc['threadId']=_0x2cdc45[_0x8560('0x59')][_0x8560('0xb2')];_0xb90bdc[_0x8560('0xb3')]=_0x2cdc45[_0x8560('0x59')]['externalUrl'];return db[_0x8560('0xb4')][_0x8560('0x58')](_0xb90bdc)['then'](function(_0x40bf33){return[_0x40bf33,!![]];});});}_0x34449b['ContactId']=_0x2f1212['id'];if(_0x2cdc45[_0x8560('0x59')]['interaction']&&_0x2cdc45[_0x8560('0x59')][_0x8560('0xb5')]['id']){_0x34449b['id']=_0x2cdc45[_0x8560('0x59')][_0x8560('0xb5')]['id'];return db[_0x8560('0xb4')][_0x8560('0x57')]({'where':_0x34449b})[_0x8560('0x20')](function(_0x564fd5){if(_0x564fd5){return[_0x564fd5,![]];}return db[_0x8560('0xb4')]['create'](_0xb90bdc)['then'](function(_0x38d822){return[_0x38d822,!![]];});});}return db[_0x8560('0xb4')][_0x8560('0x58')](_0xb90bdc)[_0x8560('0x20')](function(_0x3e3766){return[_0x3e3766,!![]];});}})[_0x8560('0xb6')](function(_0x2a7840,_0x4f0fd5){if(_0x2a7840){_0x466eef=_0x4f0fd5;if(!_0x4f0fd5){var _0xda054c={'from':(_0x49a573['contact'][_0x8560('0xa5')]||'')+'\x20'+(_0x49a573[_0x8560('0x9f')][_0x8560('0xa6')]||'')};if(_0x2cdc45[_0x8560('0x59')][_0x8560('0xb2')]&&_0x2cdc45['body']['messageId']&&_0x2cdc45[_0x8560('0x59')][_0x8560('0xb2')]!=_0x2cdc45[_0x8560('0x59')][_0x8560('0xb7')]){_0xda054c['threadId']=_0x2cdc45[_0x8560('0x59')][_0x8560('0xb7')];}return _0x2a7840[_0x8560('0x35')](_0xda054c);}else{return _0x2a7840;}}})['then'](function(_0x10cd9b){_0x49a573[_0x8560('0xb5')]=_0x10cd9b[_0x8560('0xb8')]({'plain':!![]});_0x49a573[_0x8560('0xb5')][_0x8560('0xb9')]=_0x466eef;if(_0x49a573['interaction'][_0x8560('0xb9')]){if(_0x49a573[_0x8560('0x99')][_0x8560('0xba')]){_0x49a573[_0x8560('0x9c')][_0x8560('0xbb')]({'id':0x0,'priority':_0x49a573[_0x8560('0x9c')][_0x8560('0x49')]+0x1,'app':'close','appdata':_0x8560('0xbc'),'interval':_0x8560('0xbd')});}}return db[_0x8560('0xbe')][_0x8560('0x58')]({'body':_0x2cdc45[_0x8560('0x59')][_0x8560('0x59')],'ChatWebsiteId':_0x2cdc45['params']['id'],'ChatInteractionId':_0x10cd9b['id'],'direction':'in','ContactId':_0x49a573[_0x8560('0x9f')]['id'],'AttachmentId':_0x2cdc45[_0x8560('0x59')][_0x8560('0xbf')]});})[_0x8560('0x20')](function(_0x532a91){_0x49a573['message']=_0x532a91;if(_0x49a573[_0x8560('0xb5')][_0x8560('0xc0')]){return db[_0x8560('0xc1')][_0x8560('0x57')]({'attributes':['id',_0x8560('0x39')],'where':{'id':_0x49a573[_0x8560('0xb5')][_0x8560('0xc0')]}})[_0x8560('0x20')](function(_0x4d06d1){if(_0x4d06d1){_0x49a573[_0x8560('0x9c')][_0x8560('0xc2')]({'id':0x0,'priority':0x0,'app':_0x8560('0xc3'),'appdata':_0x4d06d1[_0x8560('0x39')]+','+(_0x49a573['account'][_0x8560('0xc4')]||0xa),'interval':_0x8560('0xbd')});_0x49a573[_0x8560('0xc5')]=!![];}return respondWithRpcPromise(_0x8560('0xc6'),_0x8560('0xc7'),_0x49a573);});}return respondWithRpcPromise(_0x8560('0xc6'),_0x8560('0xc7'),_0x49a573);})[_0x8560('0x20')](function(_0x417ba2){respondWithRpcPromise(_0x8560('0xc8'),_0x8560('0xc8'),{'event':'notify','message':_0x417ba2},client9002);return _0x417ba2;})[_0x8560('0x20')](respondWithResult(_0x340050,null))[_0x8560('0x29')](handleError(_0x340050,null));};exports[_0x8560('0xc9')]=function(_0x127574,_0x4646f3,_0x30b54d){var _0x99b86b,_0x15ab28,_0x3cda30;var _0x5e72f6=[];var _0x46a36a=[];var _0x5ae119={};var _0x5efda9=_0x127574[_0x8560('0xca')]||[];var _0x35e8f8=[];var _0x434877;return db[_0x8560('0x89')][_0x8560('0x60')]()['then'](function(_0xc2462d){if(!_0xc2462d){throw new db['Sequelize'][(_0x8560('0x91'))](_0x8560('0x8b'));}_0x46a36a=_[_0x8560('0x8c')](_['keys'](_0xc2462d),[_0x8560('0x8e'),'updatedAt']);_0x5e72f6=_['difference'](_[_0x8560('0x44')](_0xc2462d),[_0x8560('0x8e'),'updatedAt',_0x8560('0x8f'),'ListId']);if(_0x127574[_0x8560('0x59')]['id']){delete _0x127574[_0x8560('0x59')]['id'];}if(_[_0x8560('0x7b')](_0x127574[_0x8560('0x59')][_0x8560('0x94')])){throw _0x4646f3[_0x8560('0x2b')](0x1f4)[_0x8560('0xcb')](new db[(_0x8560('0x8a'))][(_0x8560('0x91'))](_0x8560('0xcc')));}if(_[_0x8560('0x7b')](_0x127574[_0x8560('0x59')][_0x8560('0x59')])||_0x127574[_0x8560('0x59')]['body']===''){throw _0x4646f3['status'](0x1f4)[_0x8560('0xcb')](new db[(_0x8560('0x8a'))][(_0x8560('0x91'))](_0x8560('0xcd')));}if(_[_0x8560('0x7b')](_0x127574[_0x8560('0x59')][_0x8560('0xce')])){throw _0x4646f3['status'](0x1f4)[_0x8560('0xcb')](new db[(_0x8560('0x8a'))][(_0x8560('0x91'))](_0x8560('0xcf')+_0x5e72f6));}if(!_[_0x8560('0xd0')](_0x5e72f6,_0x127574[_0x8560('0x59')][_0x8560('0xce')])){throw _0x4646f3['status'](0x1f4)[_0x8560('0xcb')](new db[(_0x8560('0x8a'))][(_0x8560('0x91'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5e72f6));}_0x5ae119[_0x127574['body']['mapKeyOffline']]=_0x127574[_0x8560('0x59')][_0x8560('0x94')];})[_0x8560('0x20')](function(){return db[_0x8560('0x3e')][_0x8560('0x57')]({'where':{'id':_0x127574[_0x8560('0x5f')]['id']},'include':[{'model':db[_0x8560('0x95')],'as':_0x8560('0x98')},{'model':db[_0x8560('0xd1')],'as':_0x8560('0xd1')}]});})[_0x8560('0x20')](handleEntityNotFound(_0x4646f3,null))[_0x8560('0x20')](function(_0x4103e7){if(_0x4103e7&&_0x4103e7['List']){_0x15ab28=_0x4103e7;var _0x4ed7e4=_[_0x8560('0x19')](_0x127574[_0x8560('0x59')],{'firstName':_0x127574['body']['from'],'phone':_0x127574[_0x8560('0x59')]['from'],'ListId':_0x4103e7['ListId']});_0x4ed7e4[_0x127574[_0x8560('0x59')][_0x8560('0xce')]]=_0x127574['body'][_0x8560('0x94')];return db['CmContact']['findOrCreate']({'where':_0x5ae119,'defaults':_0x4ed7e4});}})[_0x8560('0xb6')](function(_0x4e0562){if(_0x4e0562){_0x3cda30=_0x4e0562;var _0x4f4936=fs[_0x8560('0xd2')](path[_0x8560('0x7c')](config[_0x8560('0x78')],_0x8560('0xd3')),_0x8560('0xd4'));var _0x51fbce=ejs[_0x8560('0xd5')](_0x4f4936,{'body':_[_0x8560('0xd6')](_0x127574['body'][_0x8560('0x59')]),'bodyTitle':_0x15ab28[_0x8560('0xd7')]});return db[_0x8560('0xd8')]['create']({'body':_0x51fbce,'ContactId':_0x4e0562['id'],'ChatWebsiteId':_0x15ab28['id']});}})[_0x8560('0x20')](function(_0x1a73d7){_0x434877=_0x1a73d7;if(_0x5efda9[_0x8560('0x49')]){var _0x52261b=_0x5efda9[_0x8560('0x3d')](function(_0x524f70){return{'name':_0x524f70[_0x8560('0xd9')],'basename':_0x524f70[_0x8560('0x70')],'type':_0x524f70[_0x8560('0xda')],'ChatOfflineMessageId':_0x1a73d7['id']};});_0x35e8f8=_0x52261b[_0x8560('0x3d')](_0x3ea7d6=>{var _0xd801a={'filename':_0x3ea7d6['name'],'path':path[_0x8560('0x7c')](config[_0x8560('0x78')],_0x8560('0xdb'),_0x8560('0xca'),_0x8560('0xdc'),_0x8560('0xdd'),_0x3ea7d6['basename'])};return _0xd801a;});if(!_0x15ab28[_0x8560('0xde')]){return db[_0x8560('0xdf')][_0x8560('0xe0')](function(_0x19059d){return db['Attachment']['bulkCreate'](_0x52261b,{'transaction':_0x19059d});});}}})[_0x8560('0x20')](function(){if(_0x434877){_0x99b86b=_0x434877;return db['MailAccount'][_0x8560('0x6c')]({'where':{'active':!![]},'include':[{'model':db['MailServerOut'],'as':_0x8560('0xe1'),'raw':!![]}]});}})['then'](function(_0x5df022){if(_0x5df022&&_0x5df022[_0x8560('0xe1')]&&_0x15ab28[_0x8560('0xe2')]&&_0x15ab28[_0x8560('0xe3')]){var _0x849c41={'tls':{'rejectUnauthorized':![]}};if(_0x5df022[_0x8560('0xe1')][_0x8560('0xe4')]){_0x849c41[_0x8560('0xe4')]=_0x5df022[_0x8560('0xe1')][_0x8560('0xe4')];}else{_0x849c41[_0x8560('0xe5')]=_0x5df022['Smtp'][_0x8560('0xe5')];_0x849c41[_0x8560('0xe6')]=_0x5df022['Smtp'][_0x8560('0xe6')];_0x849c41[_0x8560('0xe7')]=_0x5df022[_0x8560('0xe1')][_0x8560('0xe7')];}if(_0x5df022[_0x8560('0xe1')][_0x8560('0xe8')]){_0x849c41[_0x8560('0xe9')]={'user':_0x5df022['Smtp'][_0x8560('0x5a')],'pass':_0x5df022[_0x8560('0xe1')][_0x8560('0xea')]};}return respondWithRpcPromise(_0x8560('0xeb'),_0x8560('0xec'),{'account':_0x849c41,'message':{'from':util[_0x8560('0xab')](_0x8560('0xed'),_0x5df022[_0x8560('0x39')],_0x5df022[_0x8560('0xee')]||_0x5df022[_0x8560('0xe1')][_0x8560('0x5a')]),'to':_0x15ab28[_0x8560('0xe3')],'subject':_0x15ab28['offlineMessageSubject'],'html':_0x99b86b[_0x8560('0x59')],'attachments':_0x35e8f8}},client9003)['then'](function(){return _0x99b86b;})['catch'](function(_0x3c093a){console[_0x8560('0x25')](_0x3c093a);});}})[_0x8560('0x20')](function(){if(_0x15ab28&&_0x15ab28[_0x8560('0xde')]&&_0x15ab28[_0x8560('0xef')]){var _0x492023=[];if(_0x5efda9[_0x8560('0x49')]){_0x492023=_0x5efda9[_0x8560('0x3d')](function(_0x12c8a0){return{'name':_0x12c8a0[_0x8560('0xd9')],'basename':_0x12c8a0['filename'],'type':_0x12c8a0[_0x8560('0xda')],'ChatOfflineMessageId':_0x434877['id']};});}var _0xf2cea3;if(!_[_0x8560('0x7b')](_0x15ab28[_0x8560('0xf0')])){var _0x33501b=_[_0x8560('0x3d')](_0x127574[_0x8560('0x59')],function(_0x4c1c73){return _0x4c1c73;});var _0x2147e8=_['toPairsIn'](_0x33501b)[0x0];var _0x2603f8=_[_0x8560('0xf1')](_0x2147e8,function(_0x3f63cd){return _0x3f63cd;});_0xf2cea3=_0x2603f8[0x1][_0x15ab28[_0x8560('0xf0')]];}var _0x1652fd={'from':_0x3cda30[_0x8560('0xee')],'firstName':_0x3cda30['firstName'],'lastName':_0x3cda30[_0x8560('0xa6')],'mapKey':_0x8560('0xee'),'message':{'from':_0x3cda30[_0x8560('0xee')],'to':_0x15ab28[_0x8560('0xd1')][_0x8560('0xee')],'cc':'','subject':_[_0x8560('0x7b')](_0xf2cea3)?_0x15ab28[_0x8560('0xf2')]:_0xf2cea3,'messageId':'','sentAt':new Date(),'attach':_0x492023[_0x8560('0x49')],'attachments':_0x492023,'originChannel':'Chat','ChatWebsiteId':_0x15ab28['id'],'ChatOfflineMessageId':_0x99b86b['id'],'originTo':_0x15ab28['MailAccount'][_0x8560('0xee')]},'body':_0x99b86b[_0x8560('0x59')]};var _0x29e5d2={'account':{'id':_0x15ab28[_0x8560('0xef')]},'body':_0x1652fd,'log':_0x8560('0xf3')};return respondWithRpcPromise(_0x8560('0xf3'),_0x8560('0xf4'),_0x29e5d2,client9001)[_0x8560('0x20')](function(){return _0x99b86b;})['catch'](function(_0x4cc1e2){console['error'](_0x4cc1e2);});}return;})[_0x8560('0x20')](function(){if(_0x99b86b){return _0x99b86b;}})[_0x8560('0x20')](respondWithResult(_0x4646f3,null))['catch'](function(_0x59a3c9){console[_0x8560('0x25')](_0x8560('0x29'),_0x59a3c9);for(var _0x394b17 of _0x5efda9){var _0x141d9a=path[_0x8560('0x7c')](config[_0x8560('0x78')],_0x8560('0xdb'),'files',_0x8560('0xdc'),_0x8560('0xdd'),_0x394b17[_0x8560('0x70')]);fs_extra['remove'](_0x141d9a)[_0x8560('0x29')](function(_0x2df487){console[_0x8560('0x25')](_0x8560('0xf5'),_0x141d9a,_0x2df487);});}});};exports[_0x8560('0xf6')]=function(_0x2cbdce,_0x1a6c51,_0x4e5d12){return db[_0x8560('0xb4')][_0x8560('0x57')]({'where':{'id':_0x2cbdce['params']['id']}})[_0x8560('0x20')](handleEntityNotFound(_0x1a6c51,null))[_0x8560('0x20')](function(_0x3d93fc){if(_0x3d93fc){return _0x3d93fc[_0x8560('0xf6')](_0x2cbdce[_0x8560('0x59')][_0x8560('0x68')],_['omit'](_0x2cbdce[_0x8560('0x59')],[_0x8560('0x68'),'id'])||{});}})['then'](respondWithResult(_0x1a6c51,null))['catch'](handleError(_0x1a6c51,null));};exports[_0x8560('0xf7')]=function(_0x427fe3,_0x41ac6b,_0x477d27){var _0x383038={'raw':![],'where':{}};var _0x32fcfa={};var _0x58cfc9={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x8560('0x6c')]({'where':{'id':_0x427fe3[_0x8560('0x5f')]['id']}})[_0x8560('0x20')](handleEntityNotFound(_0x41ac6b,null))[_0x8560('0x20')](function(_0xe15eb){if(_0xe15eb){_0x32fcfa['model']=_[_0x8560('0x44')](db[_0x8560('0xb4')][_0x8560('0x3f')]);_0x32fcfa[_0x8560('0x45')]=_[_0x8560('0x44')](_0x427fe3[_0x8560('0x45')]);_0x32fcfa[_0x8560('0x4e')]=_[_0x8560('0x46')](_0x32fcfa[_0x8560('0x43')],_0x32fcfa['query']);_0x383038[_0x8560('0x47')]=_['intersection'](_0x32fcfa[_0x8560('0x43')],qs[_0x8560('0x48')](_0x427fe3[_0x8560('0x45')]['fields']));_0x383038['attributes']=_0x383038[_0x8560('0x47')][_0x8560('0x49')]?_0x383038[_0x8560('0x47')]:_0x32fcfa[_0x8560('0x43')];if(!_0x427fe3[_0x8560('0x45')][_0x8560('0x4a')](_0x8560('0x65'))){_0x383038[_0x8560('0x2f')]=qs['limit'](_0x427fe3['query']['limit']);_0x383038[_0x8560('0x2d')]=qs[_0x8560('0x2d')](_0x427fe3[_0x8560('0x45')][_0x8560('0x2d')]);}_0x383038['order']=qs[_0x8560('0x4c')](_0x427fe3[_0x8560('0x45')][_0x8560('0x4c')]);_0x383038['where']=qs['filters'](_[_0x8560('0x66')](_0x427fe3[_0x8560('0x45')],_0x32fcfa['filters']));_0x383038[_0x8560('0x4d')][_0x8560('0x62')]=_0xe15eb['id'];if(_0x427fe3[_0x8560('0x45')][_0x8560('0x4f')]){_0x383038[_0x8560('0x4d')]=_[_0x8560('0x50')](_0x383038[_0x8560('0x4d')],{'$or':_[_0x8560('0x3d')](_0x383038[_0x8560('0x47')],function(_0x5b3645){var _0x2ab474={};_0x2ab474[_0x5b3645]={'$like':'%'+_0x427fe3[_0x8560('0x45')][_0x8560('0x4f')]+'%'};return _0x2ab474;})});}_0x383038=_[_0x8560('0x50')]({},_0x383038,_0x427fe3['options']);return db[_0x8560('0xb4')]['count']({'where':_0x383038[_0x8560('0x4d')]})[_0x8560('0x20')](function(_0x593511){_0x58cfc9[_0x8560('0x30')]=_0x593511;if(_0x427fe3[_0x8560('0x45')][_0x8560('0x53')]){_0x383038[_0x8560('0x54')]=[{'model':db[_0x8560('0x89')],'as':_0x8560('0xf8'),'required':![]},{'model':db[_0x8560('0xc1')],'as':_0x8560('0xf9'),'attributes':['name',_0x8560('0xfa'),_0x8560('0xfb')],'required':![]},{'model':db[_0x8560('0xfc')],'as':_0x8560('0xfd'),'attributes':['id',_0x8560('0x39'),_0x8560('0xfe')],'where':_0x427fe3[_0x8560('0x45')]['tag']?{'id':_0x427fe3['query'][_0x8560('0xff')]}:undefined,'required':_0x427fe3['query']['tag']?!![]:![]}];}return db[_0x8560('0xb4')][_0x8560('0x55')](_0x383038);})['then'](function(_0x3852ac){_0x58cfc9[_0x8560('0x56')]=_0x3852ac;return _0x58cfc9;});}})[_0x8560('0x20')](respondWithFilteredResult(_0x41ac6b,_0x383038))['catch'](handleError(_0x41ac6b,null));};function iftimePromise(_0x5967f2,_0x583860){return respondWithRpcPromise(_0x8560('0x100'),_0x8560('0x101'),{'command':_0x583860['timezone']?util[_0x8560('0xab')](_0x8560('0x102'),_0x5967f2[_0x8560('0x103')],_0x583860[_0x8560('0x104')]):util[_0x8560('0xab')]('iftime\x20%s',_0x5967f2[_0x8560('0x103')])},client9002)['then'](function(_0x4f118f){var _0x1ea28f=_0x4f118f&&_0x4f118f[_0x8560('0x105')](_0x8560('0x106'))>=0x0?!![]:![];logger[_0x8560('0x27')](_0x8560('0x107'),_0x583860['id'],_0x5967f2['id'],_0x5967f2[_0x8560('0x103')],_0x1ea28f?_0x8560('0x108'):_0x8560('0x109'),_0x583860[_0x8560('0x104')]?_0x583860[_0x8560('0x104')]:_0x8560('0x10a'));return _0x1ea28f;})[_0x8560('0x29')](function(_0x1a2a3f){logger[_0x8560('0x25')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x583860['id'],_0x5967f2['id'],_0x5967f2['interval'],util[_0x8560('0x10b')](_0x1a2a3f,{'showHidden':![],'depth':null}),_0x583860[_0x8560('0x104')]?_0x583860['timezone']:_0x8560('0x10a'));return![];});}exports[_0x8560('0x101')]=function(_0x4d907e,_0x3bed23,_0x1dd971){var _0x1bed67=0x0;var _0x1cbe3e=0x0;var _0x137d49=![];var _0x234ce7;var _0x33256c;return db[_0x8560('0x3e')]['find']({'where':{'id':_0x4d907e['params']['id']},'include':[{'model':db[_0x8560('0x10c')],'as':'Interval','include':[{'model':db[_0x8560('0x10c')],'as':_0x8560('0x10d'),'attributes':['id','interval'],'raw':!![]}]}]})[_0x8560('0x20')](handleEntityNotFound(_0x3bed23,null))[_0x8560('0x20')](function(_0xb3191b){if(_0xb3191b){_0x234ce7=_0xb3191b;return _0xb3191b['getProactiveActions']({'raw':!![]});}})['then'](function(_0x1f0981){if(_0x234ce7){if(_0x1f0981){_0x33256c=_0x1f0981;}}return require(_0x8560('0x10e'))[_0x8560('0x10f')]();})['then'](function(_0x1e2f13){if(_0x1e2f13){_0x1cbe3e=_0x1e2f13[_0x8560('0x110')];_0x137d49=_0x1e2f13[_0x8560('0x7a')];}})[_0x8560('0x20')](function(){return db[_0x8560('0xb4')][_0x8560('0x30')]({'where':{'closed':![]}});})[_0x8560('0x20')](function(_0x38a17a){_0x1bed67=_0x38a17a;if(_0x1cbe3e&&_0x38a17a>_0x1cbe3e){return db[_0x8560('0x111')][_0x8560('0x6c')]({'where':{'id':0x1}})[_0x8560('0x20')](function(_0x3a6f48){if(_0x3a6f48){_0x3a6f48[_0x8560('0x112')]('chatLicenseExceeded');}});}})[_0x8560('0x20')](function(){if(_0x234ce7[_0x8560('0x10c')]&&_0x234ce7[_0x8560('0x10c')][_0x8560('0x10d')]){var _0x142eef=[];for(var _0x2d9802=0x0;_0x2d9802<_0x234ce7[_0x8560('0x10c')]['Intervals']['length'];_0x2d9802++){var _0xe7570=_0x234ce7[_0x8560('0x10c')][_0x8560('0x10d')][_0x2d9802]['get']({'plain':!![]});_0x142eef['push'](iftimePromise(_0xe7570,_0x234ce7));}return BPromise[_0x8560('0x113')](_0x142eef)[_0x8560('0x20')](function(_0x52f878){return _['some'](_0x52f878);});}else{return!![];}})[_0x8560('0x20')](function(_0x3a5231){var _0x519335=fs['readFileSync'](path[_0x8560('0x7c')](config[_0x8560('0x78')],_0x8560('0x114')),_0x8560('0xd4'));var _0x31fe79={'remote':_0x234ce7[_0x8560('0x115')],'query':querystring[_0x8560('0xb1')](_[_0x8560('0x50')](_0x234ce7[_0x8560('0xb8')]({'plain':!![]}),{'customerIp':_0x4d907e[_0x8560('0xa0')][_0x8560('0xa2')]||_0x4d907e[_0x8560('0xa0')][_0x8560('0x116')]||_0x4d907e['connection'][_0x8560('0x117')]||_0x4d907e['ip'],'referer':_0x4d907e[_0x8560('0xa0')]['referer'],'openedInteractions':_0x1bed67,'maxInteractions':_0x1cbe3e,'virtual':_0x137d49[_0x8560('0x110')],'online':_0x3a5231,'custom':_0x137d49}))[_0x8560('0x118')](/'/g,'\x5c\x27')};_0x3bed23[_0x8560('0xcb')](ejs['render'](Mustache['render'](_0x519335,_0x31fe79),{'proactiveActions':_0x33256c,'alignment':_0x234ce7[_0x8560('0x119')],'verticalAlignment':_0x234ce7['verticalAlignment'],'div_color':_0x234ce7[_0x8560('0xfe')],'text_color':_0x234ce7[_0x8560('0x11a')],'button_color':_0x234ce7[_0x8560('0x11b')],'background_color':_0x234ce7['backgroundColor']}));})[_0x8560('0x29')](handleError(_0x3bed23,null));};exports[_0x8560('0x11c')]=function(_0x535e20,_0x4c0a7e,_0x5a6058){return db['ChatWebsite'][_0x8560('0x6c')]({'where':{'id':_0x535e20[_0x8560('0x5f')]['id']}})[_0x8560('0x20')](handleEntityNotFound(_0x4c0a7e,null))[_0x8560('0x20')](function(_0x2b5ef1){if(_0x2b5ef1){return db[_0x8560('0xdf')][_0x8560('0xe0')](function(_0x332684){return db[_0x8560('0x11d')]['destroy']({'where':{'ChatWebsiteId':_0x535e20['params']['id']},'transaction':_0x332684})['then'](function(_0x5ec5c0){var _0x5dc3fd=_[_0x8560('0x3d')](_0x535e20[_0x8560('0x59')],function(_0x2aa156){_0x2aa156['ChatWebsiteId']=_0x535e20[_0x8560('0x5f')]['id'];return _0x2aa156;});return db[_0x8560('0x11d')][_0x8560('0x11e')](_0x5dc3fd,{'transaction':_0x332684});});})['then'](function(){return db[_0x8560('0x11d')][_0x8560('0x11f')]({'where':{'ChatWebsiteId':_0x535e20['params']['id']},'order':_0x8560('0x9e')});});}})[_0x8560('0x20')](respondWithResult(_0x4c0a7e,null))['catch'](handleError(_0x4c0a7e,null));};exports[_0x8560('0x120')]=function(_0x230379,_0x2fcef4,_0x108c3b){var _0x97b65d={};var _0x3aa14c={};var _0x3a73ed;var _0x167902;return db[_0x8560('0x3e')][_0x8560('0x6c')]({'where':{'id':_0x230379[_0x8560('0x5f')]['id']}})[_0x8560('0x20')](handleEntityNotFound(_0x2fcef4,null))[_0x8560('0x20')](function(_0x3023fe){if(_0x3023fe){_0x3a73ed=_0x3023fe;_0x3aa14c[_0x8560('0x43')]=_[_0x8560('0x44')](db[_0x8560('0x11d')][_0x8560('0x3f')]);_0x3aa14c[_0x8560('0x45')]=_[_0x8560('0x44')](_0x230379['query']);_0x3aa14c[_0x8560('0x4e')]=_['intersection'](_0x3aa14c[_0x8560('0x43')],_0x3aa14c[_0x8560('0x45')]);_0x97b65d[_0x8560('0x47')]=_['intersection'](_0x3aa14c[_0x8560('0x43')],qs[_0x8560('0x48')](_0x230379[_0x8560('0x45')]['fields']));_0x97b65d[_0x8560('0x47')]=_0x97b65d['attributes'][_0x8560('0x49')]?_0x97b65d[_0x8560('0x47')]:_0x3aa14c['model'];_0x97b65d[_0x8560('0x4b')]=qs[_0x8560('0x4c')](_0x230379[_0x8560('0x45')][_0x8560('0x4c')]);_0x97b65d[_0x8560('0x4d')]=qs[_0x8560('0x4e')](_[_0x8560('0x66')](_0x230379[_0x8560('0x45')],_0x3aa14c[_0x8560('0x4e')]));if(_0x230379[_0x8560('0x45')][_0x8560('0x4f')]){_0x97b65d[_0x8560('0x4d')]=_[_0x8560('0x50')](_0x97b65d[_0x8560('0x4d')],{'$or':_['map'](_0x97b65d['attributes'],function(_0x3b1409){var _0x3261cd={};_0x3261cd[_0x3b1409]={'$like':'%'+_0x230379[_0x8560('0x45')][_0x8560('0x4f')]+'%'};return _0x3261cd;})});}_0x97b65d=_[_0x8560('0x50')]({},_0x97b65d,_0x230379[_0x8560('0x52')]);return _0x3a73ed[_0x8560('0x120')](_0x97b65d);}})[_0x8560('0x20')](function(_0x4dc65a){if(_0x4dc65a){_0x167902=_0x4dc65a[_0x8560('0x49')];if(!_0x230379[_0x8560('0x45')][_0x8560('0x4a')](_0x8560('0x65'))){_0x97b65d[_0x8560('0x2f')]=qs[_0x8560('0x2f')](_0x230379[_0x8560('0x45')][_0x8560('0x2f')]);_0x97b65d[_0x8560('0x2d')]=qs[_0x8560('0x2d')](_0x230379[_0x8560('0x45')][_0x8560('0x2d')]);}return _0x3a73ed[_0x8560('0x120')](_0x97b65d);}})[_0x8560('0x20')](function(_0x1f0529){if(_0x1f0529){return _0x1f0529?{'count':_0x167902,'rows':_0x1f0529}:null;}})[_0x8560('0x20')](respondWithResult(_0x2fcef4,null))[_0x8560('0x29')](handleError(_0x2fcef4,null));};exports[_0x8560('0x121')]=function(_0x40b156,_0x17070f,_0xb2b69e){return db[_0x8560('0x122')][_0x8560('0x57')]({'where':{'id':_0x40b156['params']['id']}})[_0x8560('0x20')](handleEntityNotFound(_0x17070f,null))[_0x8560('0x20')](function(_0x567233){if(_0x567233){return _0x567233[_0x8560('0x121')](_0x40b156[_0x8560('0x59')][_0x8560('0x68')],_[_0x8560('0x123')](_0x40b156[_0x8560('0x59')],[_0x8560('0x68'),'id'])||{});}})[_0x8560('0x20')](respondWithResult(_0x17070f,null))[_0x8560('0x29')](handleError(_0x17070f,null));};exports[_0x8560('0x124')]=function(_0x1f4bb8,_0x101c76,_0x3279d4){var _0x3730b2={};var _0x113507={};var _0x1d8c77;var _0x545dcd;return db[_0x8560('0x3e')][_0x8560('0x6c')]({'where':{'id':_0x1f4bb8[_0x8560('0x5f')]['id']}})[_0x8560('0x20')](handleEntityNotFound(_0x101c76,null))[_0x8560('0x20')](function(_0x1c3f13){if(_0x1c3f13){_0x1d8c77=_0x1c3f13;_0x113507['model']=_[_0x8560('0x44')](db[_0x8560('0x125')][_0x8560('0x3f')]);_0x113507['query']=_[_0x8560('0x44')](_0x1f4bb8[_0x8560('0x45')]);_0x113507[_0x8560('0x4e')]=_[_0x8560('0x46')](_0x113507['model'],_0x113507['query']);_0x3730b2[_0x8560('0x47')]=_['intersection'](_0x113507[_0x8560('0x43')],qs['fields'](_0x1f4bb8[_0x8560('0x45')][_0x8560('0x48')]));_0x3730b2[_0x8560('0x47')]=_0x3730b2[_0x8560('0x47')][_0x8560('0x49')]?_0x3730b2['attributes']:_0x113507[_0x8560('0x43')];_0x3730b2[_0x8560('0x4b')]=qs[_0x8560('0x4c')](_0x1f4bb8[_0x8560('0x45')]['sort']);_0x3730b2[_0x8560('0x4d')]=qs['filters'](_['pick'](_0x1f4bb8['query'],_0x113507[_0x8560('0x4e')]));if(_0x1f4bb8['query'][_0x8560('0x4f')]){_0x3730b2[_0x8560('0x4d')]=_[_0x8560('0x50')](_0x3730b2['where'],{'$or':_['map'](_0x3730b2[_0x8560('0x47')],function(_0x29c203){var _0x545b08={};_0x545b08[_0x29c203]={'$like':'%'+_0x1f4bb8[_0x8560('0x45')][_0x8560('0x4f')]+'%'};return _0x545b08;})});}_0x3730b2=_['merge']({},_0x3730b2,_0x1f4bb8[_0x8560('0x52')]);return _0x1d8c77[_0x8560('0x124')](_0x3730b2);}})[_0x8560('0x20')](function(_0x5dba){if(_0x5dba){_0x545dcd=_0x5dba[_0x8560('0x49')];if(!_0x1f4bb8[_0x8560('0x45')]['hasOwnProperty'](_0x8560('0x65'))){_0x3730b2[_0x8560('0x2f')]=qs[_0x8560('0x2f')](_0x1f4bb8[_0x8560('0x45')][_0x8560('0x2f')]);_0x3730b2[_0x8560('0x2d')]=qs[_0x8560('0x2d')](_0x1f4bb8[_0x8560('0x45')][_0x8560('0x2d')]);}return _0x1d8c77['getProactiveActions'](_0x3730b2);}})[_0x8560('0x20')](function(_0x658dc7){if(_0x658dc7){return _0x658dc7?{'count':_0x545dcd,'rows':_0x658dc7}:null;}})['then'](respondWithResult(_0x101c76,null))[_0x8560('0x29')](handleError(_0x101c76,null));};exports[_0x8560('0x126')]=function(_0x58d354,_0x5dc2a0,_0x3425d1){var _0x2ae939=_0x58d354[_0x8560('0x45')][_0x8560('0x127')]===_0x8560('0x128')?_0x8560('0x129'):_0x8560('0x12a');return db[_0x8560('0x3e')]['find']({'attributes':['id',_0x2ae939],'where':{'id':_0x58d354[_0x8560('0x5f')]['id']}})[_0x8560('0x20')](handleEntityNotFound(_0x5dc2a0,null))[_0x8560('0x20')](function(_0x34e963){if(_0x34e963){var _0x557b24=_0x34e963[_0x2ae939];var _0x3da65c=_0x557b24&&_0x557b24[_0x8560('0x12b')]?_0x557b24[_0x8560('0x12b')]:[];_0x5dc2a0['send']({'fromKey':_['isNil'](_0x557b24[_0x8560('0x12c')])?undefined:_0x557b24['fromKey'],'count':_0x3da65c[_0x8560('0x49')],'rows':_0x3da65c});}})[_0x8560('0x29')](handleError(_0x5dc2a0,null));};exports['getOfflineMessages']=function(_0x4843b9,_0x2980a6,_0x65ff36){var _0x11c5a3={'raw':![],'where':{}};var _0x25710c={};var _0x1becc7={'count':0x0,'rows':[]};return db[_0x8560('0x3e')][_0x8560('0x6c')]({'where':{'id':_0x4843b9[_0x8560('0x5f')]['id']}})['then'](handleEntityNotFound(_0x2980a6,null))[_0x8560('0x20')](function(_0x2d33fb){if(_0x2d33fb){_0x25710c['model']=_[_0x8560('0x44')](db['ChatOfflineMessage'][_0x8560('0x3f')]);_0x25710c[_0x8560('0x45')]=_[_0x8560('0x44')](_0x4843b9['query']);_0x25710c[_0x8560('0x4e')]=_[_0x8560('0x46')](_0x25710c['model'],_0x25710c[_0x8560('0x45')]);_0x11c5a3[_0x8560('0x47')]=_[_0x8560('0x46')](_0x25710c[_0x8560('0x43')],qs[_0x8560('0x48')](_0x4843b9[_0x8560('0x45')][_0x8560('0x48')]));_0x11c5a3[_0x8560('0x47')]=_0x11c5a3[_0x8560('0x47')][_0x8560('0x49')]?_0x11c5a3['attributes']:_0x25710c['model'];if(!_0x4843b9['query'][_0x8560('0x4a')]('nolimit')){_0x11c5a3[_0x8560('0x2f')]=qs['limit'](_0x4843b9['query'][_0x8560('0x2f')]);_0x11c5a3[_0x8560('0x2d')]=qs['offset'](_0x4843b9[_0x8560('0x45')][_0x8560('0x2d')]);}_0x11c5a3['order']=qs[_0x8560('0x4c')](_0x4843b9[_0x8560('0x45')]['sort']);_0x11c5a3[_0x8560('0x4d')]=qs[_0x8560('0x4e')](_[_0x8560('0x66')](_0x4843b9[_0x8560('0x45')],_0x25710c['filters']));_0x11c5a3[_0x8560('0x4d')][_0x8560('0x62')]=_0x2d33fb['id'];if(_0x4843b9[_0x8560('0x45')]['filter']){_0x11c5a3[_0x8560('0x4d')]=_[_0x8560('0x50')](_0x11c5a3[_0x8560('0x4d')],{'$or':_[_0x8560('0x3d')](_0x11c5a3[_0x8560('0x47')],function(_0x24d192){var _0x312c6e={};_0x312c6e[_0x24d192]={'$like':'%'+_0x4843b9['query']['filter']+'%'};return _0x312c6e;})});}_0x11c5a3=_['merge']({},_0x11c5a3,_0x4843b9['options']);return db[_0x8560('0xd8')][_0x8560('0x30')]({'where':_0x11c5a3[_0x8560('0x4d')]})['then'](function(_0x560f02){_0x1becc7['count']=_0x560f02;if(_0x4843b9[_0x8560('0x45')][_0x8560('0x53')]){_0x11c5a3[_0x8560('0x54')]=[{'all':!![]}];}else{_0x11c5a3['include']=[{'model':db[_0x8560('0x89')],'as':'Contact','required':![]},{'model':db[_0x8560('0x12d')],'as':_0x8560('0x12e'),'required':![]}];}return db[_0x8560('0xd8')]['findAll'](_0x11c5a3);})[_0x8560('0x20')](function(_0x37f23f){_0x1becc7[_0x8560('0x56')]=_0x37f23f;return _0x1becc7;});}})['then'](respondWithFilteredResult(_0x2980a6,_0x11c5a3))['catch'](handleError(_0x2980a6,null));};exports['addAgents']=function(_0x1e869f,_0x3e6642,_0x214fcd){return db[_0x8560('0x3e')][_0x8560('0x57')]({'where':{'id':_0x1e869f[_0x8560('0x5f')]['id']}})['then'](handleEntityNotFound(_0x3e6642,null))[_0x8560('0x20')](function(_0x4c4a29){if(_0x4c4a29){return _0x4c4a29[_0x8560('0x12f')](_0x1e869f[_0x8560('0x59')][_0x8560('0x68')],_['omit'](_0x1e869f[_0x8560('0x59')],[_0x8560('0x68'),'id'])||{})[_0x8560('0xb6')](function(_0x52b696){for(var _0x484a65=0x0;_0x484a65<_0x1e869f[_0x8560('0x59')]['ids'][_0x8560('0x49')];_0x484a65+=0x1){socket[_0x8560('0x130')](_0x8560('0x131'),{'UserId':Number(_0x1e869f[_0x8560('0x59')][_0x8560('0x68')][_0x484a65]),'ChatWebsiteId':Number(_0x1e869f[_0x8560('0x5f')]['id'])});}return _0x52b696;});}})[_0x8560('0x20')](respondWithResult(_0x3e6642,null))[_0x8560('0x29')](handleError(_0x3e6642,null));};exports[_0x8560('0x132')]=function(_0x4efe94,_0x2f309e,_0x493e2b){return db[_0x8560('0x3e')]['find']({'where':{'id':_0x4efe94[_0x8560('0x5f')]['id']}})[_0x8560('0x20')](handleEntityNotFound(_0x2f309e,null))['then'](function(_0x2369e8){if(_0x2369e8){return _0x2369e8['removeAgents'](_0x4efe94[_0x8560('0x45')]['ids'])['then'](function(){if(_[_0x8560('0x133')](_0x4efe94['query'][_0x8560('0x68')])){for(var _0x7d7c9d=0x0;_0x7d7c9d<_0x4efe94[_0x8560('0x45')][_0x8560('0x68')]['length'];_0x7d7c9d+=0x1){socket[_0x8560('0x130')](_0x8560('0x134'),{'UserId':Number(_0x4efe94[_0x8560('0x45')][_0x8560('0x68')][_0x7d7c9d]),'ChatWebsiteId':Number(_0x4efe94[_0x8560('0x5f')]['id'])});}}else{socket[_0x8560('0x130')](_0x8560('0x134'),{'UserId':Number(_0x4efe94[_0x8560('0x45')][_0x8560('0x68')]),'ChatWebsiteId':Number(_0x4efe94['params']['id'])});}});}})['then'](respondWithStatusCode(_0x2f309e,null))[_0x8560('0x29')](handleError(_0x2f309e,null));};exports[_0x8560('0x135')]=function(_0xc17d88,_0x2e3d03,_0x4e330e){var _0x29e457={};var _0x5760b3={};var _0x23f1e8;var _0x31c4ff;return db[_0x8560('0x3e')][_0x8560('0x6c')]({'where':{'id':_0xc17d88[_0x8560('0x5f')]['id']}})[_0x8560('0x20')](handleEntityNotFound(_0x2e3d03,null))[_0x8560('0x20')](function(_0x46e8c9){if(_0x46e8c9){_0x23f1e8=_0x46e8c9;_0x5760b3['model']=_['keys'](db[_0x8560('0xc1')][_0x8560('0x3f')]);_0x5760b3[_0x8560('0x45')]=_['keys'](_0xc17d88[_0x8560('0x45')]);_0x5760b3[_0x8560('0x4e')]=_['intersection'](_0x5760b3['model'],_0x5760b3['query']);_0x29e457['attributes']=_[_0x8560('0x46')](_0x5760b3[_0x8560('0x43')],qs['fields'](_0xc17d88[_0x8560('0x45')]['fields']));_0x29e457[_0x8560('0x47')]=_0x29e457[_0x8560('0x47')][_0x8560('0x49')]?_0x29e457['attributes']:_0x5760b3[_0x8560('0x43')];_0x29e457[_0x8560('0x4b')]=qs[_0x8560('0x4c')](_0xc17d88[_0x8560('0x45')][_0x8560('0x4c')]);_0x29e457[_0x8560('0x4d')]=qs[_0x8560('0x4e')](_[_0x8560('0x66')](_0xc17d88[_0x8560('0x45')],_0x5760b3[_0x8560('0x4e')]));if(_0xc17d88[_0x8560('0x45')]['filter']){_0x29e457['where']=_[_0x8560('0x50')](_0x29e457[_0x8560('0x4d')],{'$or':_[_0x8560('0x3d')](_0x29e457[_0x8560('0x47')],function(_0x398672){var _0x46e759={};_0x46e759[_0x398672]={'$like':'%'+_0xc17d88['query'][_0x8560('0x4f')]+'%'};return _0x46e759;})});}_0x29e457=_[_0x8560('0x50')]({},_0x29e457,_0xc17d88[_0x8560('0x52')]);return _0x23f1e8[_0x8560('0x135')](_0x29e457);}})[_0x8560('0x20')](function(_0x4ce9ad){if(_0x4ce9ad){_0x31c4ff=_0x4ce9ad[_0x8560('0x49')];if(!_0xc17d88[_0x8560('0x45')][_0x8560('0x4a')]('nolimit')){_0x29e457[_0x8560('0x2f')]=qs['limit'](_0xc17d88[_0x8560('0x45')][_0x8560('0x2f')]);_0x29e457[_0x8560('0x2d')]=qs[_0x8560('0x2d')](_0xc17d88[_0x8560('0x45')][_0x8560('0x2d')]);}return _0x23f1e8[_0x8560('0x135')](_0x29e457);}})[_0x8560('0x20')](function(_0x52c095){if(_0x52c095){return _0x52c095?{'count':_0x31c4ff,'rows':_0x52c095}:null;}})['then'](respondWithResult(_0x2e3d03,null))[_0x8560('0x29')](handleError(_0x2e3d03,null));}; \ No newline at end of file +var _0xa2b2=['attachments','offline-chat','openNewInteraction','sequelize','transaction','bulkCreate','findOne','Smtp','forwardOffline','forwardOfflineAddress','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','subjectOffline','toPairsIn','mapValues','Chat','NotifyMailAccount','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','User','Owner','internal','Tags','color','tag','getSnippet','timezone','iftime\x20%s','interval','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','Interval','Intervals','getProactiveActions','../../config/license/util','virtual','License','chatLicenseExceeded','push','all','some','server/files/chat/iframe.ejs','utf8','remote','connection','remoteAddress','replace','alignment','verticalAlignment','textColor','color_button','backgroundColor','addApplications','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','Attachment','Attachments','addAgents','removeAgents','isArray','emit','userChatWebsite:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','squel','crypto','desk.js','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','./chatWebsite.socket','http','client','ChatWebsite,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','get','ChatWebsites','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','type','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','options','find','create','body','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','ChatWebsiteId','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','getLicense','isNil','existsSync','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','customerAvatar','server/files/images/avatars/system_avatar.png','user-agent-parser','setUA','user-agent','getResult','chat','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','List','ChatApplication','Applications','account','applications','list','priority','asc','Contacts','contact','customerIp','headers','x-forwarded-for','first','split','x-real-port','referer','browser','version','format','unknown','%s\x20%s','device','vendor','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','firstName','messageId','update','created','autoclose','close','unmanaged','*,*,*,*','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','notify','offline','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','render','toPairs','mimetype','server','files'];(function(_0x124bd1,_0x124a1a){var _0x488899=function(_0x1f7208){while(--_0x1f7208){_0x124bd1['push'](_0x124bd1['shift']());}};_0x488899(++_0x124a1a);}(_0xa2b2,0x189));var _0x2a2b=function(_0x333749,_0x5807c4){_0x333749=_0x333749-0x0;var _0x57be8c=_0xa2b2[_0x333749];return _0x57be8c;};'use strict';var emlformat=require(_0x2a2b('0x0'));var rimraf=require(_0x2a2b('0x1'));var zipdir=require(_0x2a2b('0x2'));var jsonpatch=require(_0x2a2b('0x3'));var rp=require('request-promise');var moment=require(_0x2a2b('0x4'));var BPromise=require(_0x2a2b('0x5'));var Mustache=require('mustache');var util=require(_0x2a2b('0x6'));var path=require(_0x2a2b('0x7'));var sox=require('sox');var csv=require(_0x2a2b('0x8'));var ejs=require(_0x2a2b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2a2b('0xa'));var crypto=require(_0x2a2b('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x2a2b('0xc'));var toCsv=require(_0x2a2b('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2a2b('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2a2b('0xe'))(_0x2a2b('0xf'));var utils=require(_0x2a2b('0x10'));var config=require(_0x2a2b('0x11'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x2a2b('0x12')]=_[_0x2a2b('0x13')](config[_0x2a2b('0x12')],{'host':_0x2a2b('0x14'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2a2b('0x12')]));require(_0x2a2b('0x15'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x2a2b('0x16')]({'port':0x232c});var client9002=jayson[_0x2a2b('0x17')]['http']({'port':0x232a});var client9003=jayson[_0x2a2b('0x17')][_0x2a2b('0x16')]({'port':0x232b});var client9001=jayson[_0x2a2b('0x17')]['http']({'port':0x2329});function respondWithRpcPromise(_0x24dbb8,_0x87f1e4,_0x2af41c,_0xaf4be4){return new BPromise(function(_0x37790d,_0x4f60b5){var _0x35c539=_0xaf4be4||client;return _0x35c539['request'](_0x24dbb8,_0x2af41c)['then'](function(_0x4eaeca){logger['info'](_0x2a2b('0x18'),_0x87f1e4,_0x2a2b('0x19'));logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x87f1e4,_0x2a2b('0x19'),JSON[_0x2a2b('0x1a')](_0x4eaeca));if(_0x4eaeca[_0x2a2b('0x1b')]){if(_0x4eaeca[_0x2a2b('0x1b')][_0x2a2b('0x1c')]===0x1f4){logger[_0x2a2b('0x1b')]('ChatWebsite,\x20%s,\x20%s',_0x87f1e4,_0x4eaeca[_0x2a2b('0x1b')][_0x2a2b('0x1d')]);return _0x4f60b5(_0x4eaeca[_0x2a2b('0x1b')]['message']);}logger[_0x2a2b('0x1b')](_0x2a2b('0x18'),_0x87f1e4,_0x4eaeca[_0x2a2b('0x1b')]['message']);return _0x37790d(_0x4eaeca['error'][_0x2a2b('0x1d')]);}else{logger[_0x2a2b('0x1e')](_0x2a2b('0x18'),_0x87f1e4,'request\x20sent');_0x37790d(_0x4eaeca[_0x2a2b('0x1f')][_0x2a2b('0x1d')]);}})[_0x2a2b('0x20')](function(_0x33eaa3){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x87f1e4,_0x33eaa3);_0x4f60b5(_0x33eaa3);});});}function respondWithStatusCode(_0x5a0a5c,_0x3bd305){_0x3bd305=_0x3bd305||0xcc;return function(_0x56240e){if(_0x56240e){return _0x5a0a5c[_0x2a2b('0x21')](_0x3bd305);}return _0x5a0a5c['status'](_0x3bd305)[_0x2a2b('0x22')]();};}function respondWithResult(_0x15cd26,_0x3851a7){_0x3851a7=_0x3851a7||0xc8;return function(_0x2562d1){if(_0x2562d1){return _0x15cd26[_0x2a2b('0x23')](_0x3851a7)[_0x2a2b('0x24')](_0x2562d1);}};}function respondWithFilteredResult(_0x5bc867,_0x165b5a){return function(_0x419990){if(_0x419990){var _0x131f8a=typeof _0x165b5a[_0x2a2b('0x25')]==='undefined'&&typeof _0x165b5a[_0x2a2b('0x26')]===_0x2a2b('0x27');var _0x1bdedd=_0x419990['count'];var _0x30e973=_0x131f8a?0x0:_0x165b5a[_0x2a2b('0x25')];var _0x5e48e4=_0x131f8a?_0x419990[_0x2a2b('0x28')]:_0x165b5a[_0x2a2b('0x25')]+_0x165b5a['limit'];var _0x3e1cc5;if(_0x5e48e4>=_0x1bdedd){_0x5e48e4=_0x1bdedd;_0x3e1cc5=0xc8;}else{_0x3e1cc5=0xce;}_0x5bc867[_0x2a2b('0x23')](_0x3e1cc5);return _0x5bc867[_0x2a2b('0x29')](_0x2a2b('0x2a'),_0x30e973+'-'+_0x5e48e4+'/'+_0x1bdedd)[_0x2a2b('0x24')](_0x419990);}return null;};}function patchUpdates(_0x884bcd){return function(_0x7a13be){try{jsonpatch[_0x2a2b('0x2b')](_0x7a13be,_0x884bcd,!![]);}catch(_0x182d1d){return BPromise[_0x2a2b('0x2c')](_0x182d1d);}return _0x7a13be[_0x2a2b('0x2d')]();};}function saveUpdates(_0x40c4fd,_0x21cd08){return function(_0x5a50a4){if(_0x5a50a4){return _0x5a50a4['update'](_0x40c4fd)[_0x2a2b('0x2e')](function(_0x2c474a){return _0x2c474a;});}return null;};}function removeEntity(_0x1de301,_0x1394f6){return function(_0x3b5ada){if(_0x3b5ada){return _0x3b5ada['destroy']()['then'](function(){var _0xbbc5f5=_0x3b5ada[_0x2a2b('0x2f')]({'plain':!![]});var _0x12cfae=_0x2a2b('0x30');return db['UserProfileResource'][_0x2a2b('0x31')]({'where':{'type':_0x12cfae,'resourceId':_0xbbc5f5['id']}})[_0x2a2b('0x2e')](function(){return _0x3b5ada;});})[_0x2a2b('0x2e')](function(){_0x1de301[_0x2a2b('0x23')](0xcc)[_0x2a2b('0x22')]();});}};}function handleEntityNotFound(_0x35286b,_0x140c6b){return function(_0x35f3c4){if(!_0x35f3c4){_0x35286b[_0x2a2b('0x21')](0x194);}return _0x35f3c4;};}function handleError(_0x151066,_0x56087b){_0x56087b=_0x56087b||0x1f4;return function(_0x41f01f){logger[_0x2a2b('0x1b')](_0x41f01f[_0x2a2b('0x32')]);if(_0x41f01f[_0x2a2b('0x33')]){delete _0x41f01f[_0x2a2b('0x33')];}_0x151066[_0x2a2b('0x23')](_0x56087b)[_0x2a2b('0x34')](_0x41f01f);};}exports[_0x2a2b('0x35')]=function(_0x1bf506,_0x1833ea){var _0xf53ab9={'include':[{'model':db[_0x2a2b('0x36')],'as':_0x2a2b('0x37')}]},_0x2eb1f0={},_0x232d5e={'count':0x0,'rows':[]};var _0x5b4c1b=_[_0x2a2b('0x38')](db[_0x2a2b('0x39')][_0x2a2b('0x3a')],function(_0x5ca92b){return{'name':_0x5ca92b[_0x2a2b('0x3b')],'type':_0x5ca92b[_0x2a2b('0x3c')]['key']};});_0x2eb1f0[_0x2a2b('0x3d')]=_[_0x2a2b('0x38')](_0x5b4c1b,_0x2a2b('0x33'));_0x2eb1f0['query']=_[_0x2a2b('0x3e')](_0x1bf506['query']);_0x2eb1f0[_0x2a2b('0x3f')]=_[_0x2a2b('0x40')](_0x2eb1f0[_0x2a2b('0x3d')],_0x2eb1f0[_0x2a2b('0x41')]);_0xf53ab9['attributes']=_['intersection'](_0x2eb1f0[_0x2a2b('0x3d')],qs[_0x2a2b('0x42')](_0x1bf506[_0x2a2b('0x41')][_0x2a2b('0x42')]));_0xf53ab9[_0x2a2b('0x43')]=_0xf53ab9[_0x2a2b('0x43')][_0x2a2b('0x44')]?_0xf53ab9[_0x2a2b('0x43')]:_0x2eb1f0['model'];if(!_0x1bf506[_0x2a2b('0x41')][_0x2a2b('0x45')](_0x2a2b('0x46'))){_0xf53ab9[_0x2a2b('0x26')]=qs[_0x2a2b('0x26')](_0x1bf506[_0x2a2b('0x41')]['limit']);_0xf53ab9[_0x2a2b('0x25')]=qs[_0x2a2b('0x25')](_0x1bf506[_0x2a2b('0x41')][_0x2a2b('0x25')]);}_0xf53ab9[_0x2a2b('0x47')]=qs[_0x2a2b('0x48')](_0x1bf506[_0x2a2b('0x41')][_0x2a2b('0x48')]);_0xf53ab9[_0x2a2b('0x49')]=qs['filters'](_[_0x2a2b('0x4a')](_0x1bf506[_0x2a2b('0x41')],_0x2eb1f0['filters']),_0x5b4c1b);if(_0x1bf506[_0x2a2b('0x41')][_0x2a2b('0x4b')]){_0xf53ab9[_0x2a2b('0x49')]=_['merge'](_0xf53ab9[_0x2a2b('0x49')],{'$or':_[_0x2a2b('0x38')](_0x5b4c1b,function(_0x3c0ce6){if(_0x3c0ce6[_0x2a2b('0x3c')]!==_0x2a2b('0x4c')){var _0x4a4a56={};_0x4a4a56[_0x3c0ce6[_0x2a2b('0x33')]]={'$like':'%'+_0x1bf506['query']['filter']+'%'};return _0x4a4a56;}})});}_0xf53ab9=_[_0x2a2b('0x4d')]({},_0xf53ab9,_0x1bf506['options']);var _0x10ccf8={'where':_0xf53ab9[_0x2a2b('0x49')]};return db[_0x2a2b('0x39')]['count'](_0x10ccf8)[_0x2a2b('0x2e')](function(_0x56fe9a){_0x232d5e['count']=_0x56fe9a;if(_0x1bf506[_0x2a2b('0x41')][_0x2a2b('0x4e')]){_0xf53ab9[_0x2a2b('0x4f')]=[{'all':!![]}];}return db[_0x2a2b('0x39')][_0x2a2b('0x50')](_0xf53ab9);})[_0x2a2b('0x2e')](function(_0x2a2f56){_0x232d5e[_0x2a2b('0x51')]=_0x2a2f56;return _0x232d5e;})[_0x2a2b('0x2e')](respondWithFilteredResult(_0x1833ea,_0xf53ab9))['catch'](handleError(_0x1833ea,null));};exports['show']=function(_0x4fae46,_0x12f9b7){var _0x5c38ff={'raw':![],'where':{'id':_0x4fae46['params']['id']},'include':[{'model':db[_0x2a2b('0x36')],'as':'mandatoryDispositionPause'}]},_0x4cceb2={};_0x4cceb2[_0x2a2b('0x3d')]=_['keys'](db[_0x2a2b('0x39')]['rawAttributes']);_0x4cceb2[_0x2a2b('0x41')]=_[_0x2a2b('0x3e')](_0x4fae46['query']);_0x4cceb2[_0x2a2b('0x3f')]=_[_0x2a2b('0x40')](_0x4cceb2['model'],_0x4cceb2[_0x2a2b('0x41')]);_0x5c38ff[_0x2a2b('0x43')]=_[_0x2a2b('0x40')](_0x4cceb2[_0x2a2b('0x3d')],qs[_0x2a2b('0x42')](_0x4fae46[_0x2a2b('0x41')][_0x2a2b('0x42')]));_0x5c38ff['attributes']=_0x5c38ff[_0x2a2b('0x43')][_0x2a2b('0x44')]?_0x5c38ff[_0x2a2b('0x43')]:_0x4cceb2[_0x2a2b('0x3d')];if(_0x4fae46[_0x2a2b('0x41')]['includeAll']){_0x5c38ff[_0x2a2b('0x4f')]=[{'all':!![]}];}_0x5c38ff=_[_0x2a2b('0x4d')]({},_0x5c38ff,_0x4fae46[_0x2a2b('0x52')]);return db['ChatWebsite'][_0x2a2b('0x53')](_0x5c38ff)['then'](handleEntityNotFound(_0x12f9b7,null))['then'](respondWithResult(_0x12f9b7,null))[_0x2a2b('0x20')](handleError(_0x12f9b7,null));};exports[_0x2a2b('0x54')]=function(_0x39775c,_0x40c74f){return db[_0x2a2b('0x39')][_0x2a2b('0x54')](_0x39775c[_0x2a2b('0x55')],{})[_0x2a2b('0x2e')](function(_0x2e181b){var _0xc9aee7=_0x39775c[_0x2a2b('0x56')][_0x2a2b('0x2f')]({'plain':!![]});if(!_0xc9aee7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xc9aee7['role']===_0x2a2b('0x56')){var _0x4bda8b=_0x2e181b[_0x2a2b('0x2f')]({'plain':!![]});var _0x2dff55=_0x2a2b('0x30');return db['UserProfileSection'][_0x2a2b('0x53')]({'where':{'name':_0x2dff55,'userProfileId':_0xc9aee7[_0x2a2b('0x57')]},'raw':!![]})[_0x2a2b('0x2e')](function(_0x3b2643){if(_0x3b2643&&_0x3b2643[_0x2a2b('0x58')]===0x0){return db['UserProfileResource']['create']({'name':_0x4bda8b['name'],'resourceId':_0x4bda8b['id'],'type':_0x3b2643[_0x2a2b('0x33')],'sectionId':_0x3b2643['id']},{})[_0x2a2b('0x2e')](function(){return _0x2e181b;});}else{return _0x2e181b;}})[_0x2a2b('0x20')](function(_0x5fb175){logger[_0x2a2b('0x1b')](_0x2a2b('0x59'),_0x5fb175);throw _0x5fb175;});}return _0x2e181b;})[_0x2a2b('0x2e')](respondWithResult(_0x40c74f,0xc9))[_0x2a2b('0x20')](handleError(_0x40c74f,null));};exports['update']=function(_0x313a53,_0x414f6b){if(_0x313a53['body']['id']){delete _0x313a53[_0x2a2b('0x55')]['id'];}return db[_0x2a2b('0x39')][_0x2a2b('0x53')]({'where':{'id':_0x313a53[_0x2a2b('0x5a')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x2a2b('0x2e')](handleEntityNotFound(_0x414f6b,null))[_0x2a2b('0x2e')](saveUpdates(_0x313a53['body'],null))[_0x2a2b('0x2e')](respondWithResult(_0x414f6b,null))[_0x2a2b('0x20')](handleError(_0x414f6b,null));};exports[_0x2a2b('0x31')]=function(_0xf4bd66,_0x5c2080){return db[_0x2a2b('0x39')][_0x2a2b('0x53')]({'where':{'id':_0xf4bd66[_0x2a2b('0x5a')]['id']}})[_0x2a2b('0x2e')](handleEntityNotFound(_0x5c2080,null))[_0x2a2b('0x2e')](removeEntity(_0x5c2080,null))[_0x2a2b('0x20')](handleError(_0x5c2080,null));};exports[_0x2a2b('0x5b')]=function(_0x4e36e0,_0x34193e){return db['ChatWebsite']['describe']()[_0x2a2b('0x2e')](respondWithResult(_0x34193e,null))[_0x2a2b('0x20')](handleError(_0x34193e,null));};exports['addDisposition']=function(_0x1a5495,_0x47656c,_0x25e0f3){if(_0x1a5495['body']['id']){delete _0x1a5495[_0x2a2b('0x55')]['id'];}return db[_0x2a2b('0x39')]['find']({'where':{'id':_0x1a5495[_0x2a2b('0x5a')]['id']}})[_0x2a2b('0x2e')](handleEntityNotFound(_0x47656c,null))[_0x2a2b('0x2e')](function(_0x3e2315){if(_0x3e2315){_0x1a5495[_0x2a2b('0x55')][_0x2a2b('0x5c')]=_0x3e2315['id'];return db['Disposition']['create'](_0x1a5495['body']);}})[_0x2a2b('0x2e')](respondWithResult(_0x47656c,null))['catch'](handleError(_0x47656c,null));};exports['getDispositions']=function(_0x180a5f,_0x4c4e13,_0x390769){var _0xba3dab={'raw':![],'where':{}};var _0xfcca48={};var _0x3ecf51={'count':0x0,'rows':[]};return db[_0x2a2b('0x39')]['findOne']({'where':{'id':_0x180a5f['params']['id']}})[_0x2a2b('0x2e')](handleEntityNotFound(_0x4c4e13,null))[_0x2a2b('0x2e')](function(_0x4fe65d){if(_0x4fe65d){_0xfcca48[_0x2a2b('0x3d')]=_[_0x2a2b('0x3e')](db[_0x2a2b('0x5d')][_0x2a2b('0x3a')]);_0xfcca48[_0x2a2b('0x41')]=_[_0x2a2b('0x3e')](_0x180a5f[_0x2a2b('0x41')]);_0xfcca48[_0x2a2b('0x3f')]=_[_0x2a2b('0x40')](_0xfcca48[_0x2a2b('0x3d')],_0xfcca48[_0x2a2b('0x41')]);_0xba3dab[_0x2a2b('0x43')]=_['intersection'](_0xfcca48[_0x2a2b('0x3d')],qs[_0x2a2b('0x42')](_0x180a5f[_0x2a2b('0x41')][_0x2a2b('0x42')]));_0xba3dab[_0x2a2b('0x43')]=_0xba3dab['attributes']['length']?_0xba3dab['attributes']:_0xfcca48['model'];if(!_0x180a5f['query'][_0x2a2b('0x45')](_0x2a2b('0x46'))){_0xba3dab[_0x2a2b('0x26')]=qs[_0x2a2b('0x26')](_0x180a5f[_0x2a2b('0x41')][_0x2a2b('0x26')]);_0xba3dab['offset']=qs[_0x2a2b('0x25')](_0x180a5f[_0x2a2b('0x41')][_0x2a2b('0x25')]);}_0xba3dab[_0x2a2b('0x47')]=qs[_0x2a2b('0x48')](_0x180a5f[_0x2a2b('0x41')][_0x2a2b('0x48')]);_0xba3dab[_0x2a2b('0x49')]=qs[_0x2a2b('0x3f')](_[_0x2a2b('0x4a')](_0x180a5f[_0x2a2b('0x41')],_0xfcca48[_0x2a2b('0x3f')]));_0xba3dab['where'][_0x2a2b('0x5c')]=_0x4fe65d['id'];if(_0x180a5f[_0x2a2b('0x41')]['filter']){_0xba3dab[_0x2a2b('0x49')]=_['merge'](_0xba3dab['where'],{'$or':_['map'](_0xba3dab[_0x2a2b('0x43')],function(_0x9a136c){var _0x427d15={};_0x427d15[_0x9a136c]={'$like':'%'+_0x180a5f[_0x2a2b('0x41')]['filter']+'%'};return _0x427d15;})});}_0xba3dab=_[_0x2a2b('0x4d')]({},_0xba3dab,_0x180a5f['options']);return db['Disposition']['count']({'where':_0xba3dab['where']})['then'](function(_0x13c280){_0x3ecf51[_0x2a2b('0x28')]=_0x13c280;if(_0x180a5f[_0x2a2b('0x41')][_0x2a2b('0x4e')]){_0xba3dab['include']=[{'all':!![]}];}return db[_0x2a2b('0x5d')][_0x2a2b('0x50')](_0xba3dab);})['then'](function(_0x40fb65){_0x3ecf51['rows']=_0x40fb65;return _0x3ecf51;});}})[_0x2a2b('0x2e')](respondWithFilteredResult(_0x4c4e13,_0xba3dab))['catch'](handleError(_0x4c4e13,null));};exports['removeDispositions']=function(_0x39fb40,_0xa2e245,_0x883e10){return db[_0x2a2b('0x39')][_0x2a2b('0x53')]({'where':{'id':_0x39fb40[_0x2a2b('0x5a')]['id']}})[_0x2a2b('0x2e')](handleEntityNotFound(_0xa2e245,null))[_0x2a2b('0x2e')](function(_0x44dee1){if(_0x44dee1){return _0x44dee1[_0x2a2b('0x5e')](_0x39fb40[_0x2a2b('0x41')][_0x2a2b('0x5f')]);}})['then'](respondWithStatusCode(_0xa2e245,null))[_0x2a2b('0x20')](handleError(_0xa2e245,null));};exports[_0x2a2b('0x60')]=function(_0x45ad97,_0xc1b5dc,_0x161b2c){if(_0x45ad97[_0x2a2b('0x55')]['id']){delete _0x45ad97[_0x2a2b('0x55')]['id'];}return db[_0x2a2b('0x39')]['find']({'where':{'id':_0x45ad97['params']['id']}})[_0x2a2b('0x2e')](handleEntityNotFound(_0xc1b5dc,null))[_0x2a2b('0x2e')](function(_0x146dc6){if(_0x146dc6){_0x45ad97['body']['ChatWebsiteId']=_0x146dc6['id'];return db[_0x2a2b('0x61')][_0x2a2b('0x54')](_0x45ad97[_0x2a2b('0x55')]);}})[_0x2a2b('0x2e')](respondWithResult(_0xc1b5dc,null))[_0x2a2b('0x20')](handleError(_0xc1b5dc,null));};exports[_0x2a2b('0x62')]=function(_0x330934,_0x4239a4,_0x495cd9){var _0x579d67={'raw':![],'where':{}};var _0x5d668b={};var _0x7f0f57={'count':0x0,'rows':[]};return db[_0x2a2b('0x39')]['findOne']({'where':{'id':_0x330934[_0x2a2b('0x5a')]['id']}})[_0x2a2b('0x2e')](handleEntityNotFound(_0x4239a4,null))[_0x2a2b('0x2e')](function(_0x52af4d){if(_0x52af4d){_0x5d668b[_0x2a2b('0x3d')]=_['keys'](db[_0x2a2b('0x61')]['rawAttributes']);_0x5d668b[_0x2a2b('0x41')]=_[_0x2a2b('0x3e')](_0x330934['query']);_0x5d668b[_0x2a2b('0x3f')]=_[_0x2a2b('0x40')](_0x5d668b['model'],_0x5d668b[_0x2a2b('0x41')]);_0x579d67[_0x2a2b('0x43')]=_[_0x2a2b('0x40')](_0x5d668b[_0x2a2b('0x3d')],qs['fields'](_0x330934[_0x2a2b('0x41')]['fields']));_0x579d67['attributes']=_0x579d67['attributes'][_0x2a2b('0x44')]?_0x579d67[_0x2a2b('0x43')]:_0x5d668b['model'];if(!_0x330934[_0x2a2b('0x41')][_0x2a2b('0x45')](_0x2a2b('0x46'))){_0x579d67[_0x2a2b('0x26')]=qs['limit'](_0x330934[_0x2a2b('0x41')][_0x2a2b('0x26')]);_0x579d67['offset']=qs[_0x2a2b('0x25')](_0x330934[_0x2a2b('0x41')][_0x2a2b('0x25')]);}_0x579d67['order']=qs['sort'](_0x330934[_0x2a2b('0x41')][_0x2a2b('0x48')]);_0x579d67['where']=qs[_0x2a2b('0x3f')](_[_0x2a2b('0x4a')](_0x330934['query'],_0x5d668b[_0x2a2b('0x3f')]));_0x579d67[_0x2a2b('0x49')][_0x2a2b('0x5c')]=_0x52af4d['id'];if(_0x330934['query'][_0x2a2b('0x4b')]){_0x579d67['where']=_[_0x2a2b('0x4d')](_0x579d67['where'],{'$or':_[_0x2a2b('0x38')](_0x579d67[_0x2a2b('0x43')],function(_0x47a4b4){var _0x340a5a={};_0x340a5a[_0x47a4b4]={'$like':'%'+_0x330934[_0x2a2b('0x41')][_0x2a2b('0x4b')]+'%'};return _0x340a5a;})});}_0x579d67=_[_0x2a2b('0x4d')]({},_0x579d67,_0x330934['options']);return db[_0x2a2b('0x61')][_0x2a2b('0x28')]({'where':_0x579d67[_0x2a2b('0x49')]})['then'](function(_0xa73ea3){_0x7f0f57[_0x2a2b('0x28')]=_0xa73ea3;if(_0x330934['query'][_0x2a2b('0x4e')]){_0x579d67['include']=[{'all':!![]}];}return db[_0x2a2b('0x61')][_0x2a2b('0x50')](_0x579d67);})['then'](function(_0x54faad){_0x7f0f57[_0x2a2b('0x51')]=_0x54faad;return _0x7f0f57;});}})[_0x2a2b('0x2e')](respondWithFilteredResult(_0x4239a4,_0x579d67))[_0x2a2b('0x20')](handleError(_0x4239a4,null));};exports[_0x2a2b('0x63')]=function(_0x2b3e77,_0x8667a5,_0x2f7552){return db[_0x2a2b('0x39')][_0x2a2b('0x53')]({'where':{'id':_0x2b3e77[_0x2a2b('0x5a')]['id']}})[_0x2a2b('0x2e')](handleEntityNotFound(_0x8667a5,null))[_0x2a2b('0x2e')](function(_0x34f4ea){if(_0x34f4ea){return _0x34f4ea[_0x2a2b('0x63')](_0x2b3e77[_0x2a2b('0x41')][_0x2a2b('0x5f')]);}})[_0x2a2b('0x2e')](respondWithStatusCode(_0x8667a5,null))[_0x2a2b('0x20')](handleError(_0x8667a5,null));};exports[_0x2a2b('0x64')]=function(_0x3034dd,_0x3b5d1a,_0x46794c){_0x3034dd[_0x2a2b('0x55')][_0x2a2b('0x65')]=_0x3034dd[_0x2a2b('0x66')][_0x2a2b('0x67')];return db[_0x2a2b('0x39')][_0x2a2b('0x53')]({'where':{'id':_0x3034dd[_0x2a2b('0x5a')]['id']}})['then'](handleEntityNotFound(_0x3b5d1a,null))[_0x2a2b('0x2e')](saveUpdates(_0x3034dd[_0x2a2b('0x55')],null))[_0x2a2b('0x2e')](respondWithResult(_0x3b5d1a,null))[_0x2a2b('0x20')](handleError(_0x3b5d1a,null));};exports[_0x2a2b('0x68')]=function(_0x1b437f,_0x58950b,_0x430fe8){_0x1b437f[_0x2a2b('0x55')][_0x2a2b('0x69')]=_0x1b437f[_0x2a2b('0x66')][_0x2a2b('0x67')];return db['ChatWebsite'][_0x2a2b('0x53')]({'where':{'id':_0x1b437f[_0x2a2b('0x5a')]['id']}})[_0x2a2b('0x2e')](handleEntityNotFound(_0x58950b,null))['then'](saveUpdates(_0x1b437f['body'],null))[_0x2a2b('0x2e')](respondWithResult(_0x58950b,null))[_0x2a2b('0x20')](handleError(_0x58950b,null));};exports[_0x2a2b('0x6a')]=function(_0x4e076c,_0x4883cb,_0x27aae6){_0x4e076c[_0x2a2b('0x55')]['customerAvatar']=_0x4e076c['file'][_0x2a2b('0x67')];return db[_0x2a2b('0x39')]['find']({'where':{'id':_0x4e076c[_0x2a2b('0x5a')]['id']}})[_0x2a2b('0x2e')](handleEntityNotFound(_0x4883cb,null))[_0x2a2b('0x2e')](saveUpdates(_0x4e076c[_0x2a2b('0x55')],null))[_0x2a2b('0x2e')](respondWithResult(_0x4883cb,null))[_0x2a2b('0x20')](handleError(_0x4883cb,null));};exports['addSystemAvatar']=function(_0x4b88f5,_0x538fb5,_0x5c95ab){_0x4b88f5[_0x2a2b('0x55')][_0x2a2b('0x6b')]=_0x4b88f5['file'][_0x2a2b('0x67')];return db['ChatWebsite']['find']({'where':{'id':_0x4b88f5[_0x2a2b('0x5a')]['id']}})[_0x2a2b('0x2e')](handleEntityNotFound(_0x538fb5,null))[_0x2a2b('0x2e')](saveUpdates(_0x4b88f5[_0x2a2b('0x55')],null))['then'](respondWithResult(_0x538fb5,null))[_0x2a2b('0x20')](handleError(_0x538fb5,null));};exports[_0x2a2b('0x6c')]=function(_0x5e5c47,_0x523bcb,_0x5e20a1){var _0x24a97f=path[_0x2a2b('0x6d')](config[_0x2a2b('0x6e')],_0x2a2b('0x6f'));var _0x20a636={'where':{'id':_0x5e5c47[_0x2a2b('0x5a')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x264091=![];return require('../../config/license/util')[_0x2a2b('0x70')]()['then'](function(_0x22713e){if(_0x22713e){_0x264091=_0x22713e['custom'];}})[_0x2a2b('0x2e')](function(){return db['ChatWebsite'][_0x2a2b('0x53')](_0x20a636);})['then'](handleEntityNotFound(_0x523bcb,null))[_0x2a2b('0x2e')](function(_0x36f27d){if(_0x36f27d){if(!_[_0x2a2b('0x71')](_0x36f27d[_0x2a2b('0x65')])){if(fs[_0x2a2b('0x72')](path[_0x2a2b('0x6d')](config[_0x2a2b('0x6e')],_0x2a2b('0x73'),_0x36f27d[_0x2a2b('0x65')]))&&_0x264091){_0x24a97f=path[_0x2a2b('0x6d')](config[_0x2a2b('0x6e')],'server/files/images/logos/',_0x36f27d[_0x2a2b('0x65')]);}}return _0x523bcb[_0x2a2b('0x74')](_0x24a97f);}})[_0x2a2b('0x20')](handleError(_0x523bcb,null));};exports['getAvatar']=function(_0x4dad27,_0x4b5106,_0x3e150e){var _0x16bed7=path[_0x2a2b('0x6d')](config['root'],_0x2a2b('0x75'));var _0x21c628={'where':{'id':_0x4dad27[_0x2a2b('0x5a')]['id']},'attributes':['id',_0x2a2b('0x69')],'raw':!![]};return db[_0x2a2b('0x39')]['find'](_0x21c628)[_0x2a2b('0x2e')](handleEntityNotFound(_0x4b5106,null))['then'](function(_0x2cf031){if(_0x2cf031){if(!_['isNil'](_0x2cf031[_0x2a2b('0x69')])){if(fs[_0x2a2b('0x72')](path['join'](config[_0x2a2b('0x6e')],'server/files/images/avatars/',_0x2cf031['agentAvatar']))){_0x16bed7=path['join'](config['root'],_0x2a2b('0x76'),_0x2cf031['agentAvatar']);}}return _0x4b5106['download'](_0x16bed7);}})[_0x2a2b('0x20')](handleError(_0x4b5106,null));};exports[_0x2a2b('0x77')]=function(_0x50b571,_0x5144b8,_0x154e7e){var _0x231610=path[_0x2a2b('0x6d')](config['root'],_0x2a2b('0x78'));var _0x17ef3f={'where':{'id':_0x50b571[_0x2a2b('0x5a')]['id']},'attributes':['id','customerAvatar',_0x2a2b('0x79')],'raw':!![]};return db['ChatWebsite'][_0x2a2b('0x53')](_0x17ef3f)['then'](handleEntityNotFound(_0x5144b8,null))['then'](function(_0x177923){if(_0x177923){if(!_[_0x2a2b('0x71')](_0x177923[_0x2a2b('0x7a')])){if(fs[_0x2a2b('0x72')](path[_0x2a2b('0x6d')](config['root'],_0x2a2b('0x76'),_0x177923[_0x2a2b('0x7a')]))&&_0x177923[_0x2a2b('0x79')]){_0x231610=path[_0x2a2b('0x6d')](config[_0x2a2b('0x6e')],_0x2a2b('0x76'),_0x177923['customerAvatar']);}}return _0x5144b8['download'](_0x231610);}})[_0x2a2b('0x20')](handleError(_0x5144b8,null));};exports['getSystemAvatar']=function(_0x364c00,_0x3ec0ff,_0x1704ce){var _0x157654=path[_0x2a2b('0x6d')](config[_0x2a2b('0x6e')],_0x2a2b('0x7b'));var _0x98c4d7={'where':{'id':_0x364c00[_0x2a2b('0x5a')]['id']},'attributes':['id',_0x2a2b('0x6b')],'raw':!![]};return db[_0x2a2b('0x39')][_0x2a2b('0x53')](_0x98c4d7)[_0x2a2b('0x2e')](handleEntityNotFound(_0x3ec0ff,null))[_0x2a2b('0x2e')](function(_0x41ac1f){if(_0x41ac1f){if(!_[_0x2a2b('0x71')](_0x41ac1f[_0x2a2b('0x6b')])){if(fs[_0x2a2b('0x72')](path[_0x2a2b('0x6d')](config[_0x2a2b('0x6e')],_0x2a2b('0x76'),_0x41ac1f['systemAvatar']))){_0x157654=path['join'](config[_0x2a2b('0x6e')],_0x2a2b('0x76'),_0x41ac1f[_0x2a2b('0x6b')]);}}return _0x3ec0ff['download'](_0x157654);}})[_0x2a2b('0x20')](handleError(_0x3ec0ff,null));};exports['notify']=function(_0x151814,_0x4918b1,_0x5204c3){var _0x1c0fbb=require(_0x2a2b('0x7c'));var _0x34c85a=new _0x1c0fbb();var _0x303a45=_0x34c85a[_0x2a2b('0x7d')](_0x151814['headers'][_0x2a2b('0x7e')])[_0x2a2b('0x7f')]();var _0x47132e={'body':_0x151814['body'],'channel':_0x2a2b('0x80')};var _0x38f0fa=[];var _0x10fea7=[];var _0x5ac9d2={};var _0x3f8985=![];return db[_0x2a2b('0x81')][_0x2a2b('0x5b')]()['then'](function(_0x53db2f){if(!_0x53db2f){throw new db[(_0x2a2b('0x82'))]['ValidationError'](_0x2a2b('0x83'));}_0x38f0fa=_[_0x2a2b('0x84')](_[_0x2a2b('0x3e')](_0x53db2f),[_0x2a2b('0x85'),_0x2a2b('0x86')]);_0x10fea7=_[_0x2a2b('0x84')](_[_0x2a2b('0x3e')](_0x53db2f),[_0x2a2b('0x85'),_0x2a2b('0x86'),'CompanyId',_0x2a2b('0x87')]);if(_0x151814[_0x2a2b('0x55')]['id']){delete _0x151814['body']['id'];}if(_['isNil'](_0x151814[_0x2a2b('0x55')]['from'])){throw new db[(_0x2a2b('0x82'))][(_0x2a2b('0x88'))](_0x2a2b('0x89'));}if(_['isNil'](_0x151814[_0x2a2b('0x55')][_0x2a2b('0x55')])||_0x151814[_0x2a2b('0x55')]['body']===''){throw new db['Sequelize'][(_0x2a2b('0x88'))](_0x2a2b('0x8a'));}if(_[_0x2a2b('0x71')](_0x151814[_0x2a2b('0x55')]['mapKey'])){throw new db[(_0x2a2b('0x82'))][(_0x2a2b('0x88'))](_0x2a2b('0x8b')+_0x10fea7);}if(!_[_0x2a2b('0x8c')](_0x10fea7,_0x151814[_0x2a2b('0x55')][_0x2a2b('0x8d')])){throw new db[(_0x2a2b('0x82'))]['ValidationError'](_0x2a2b('0x8e')+_0x10fea7);}_0x5ac9d2[_0x151814['body'][_0x2a2b('0x8d')]]=_0x151814['body'][_0x2a2b('0x8f')];})[_0x2a2b('0x2e')](function(){return db[_0x2a2b('0x39')][_0x2a2b('0x53')]({'where':{'id':_0x151814[_0x2a2b('0x5a')]['id']},'include':[{'model':db[_0x2a2b('0x90')],'as':_0x2a2b('0x91'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x5ac9d2,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x2a2b('0x92')],'as':_0x2a2b('0x93')}]});})[_0x2a2b('0x2e')](handleEntityNotFound(_0x4918b1,null))['then'](function(_0x2641fc){if(_0x2641fc&&_0x2641fc[_0x2a2b('0x91')]){_0x47132e[_0x2a2b('0x94')]=_0x2641fc;_0x47132e[_0x2a2b('0x95')]=_0x2641fc[_0x2a2b('0x93')];_0x47132e[_0x2a2b('0x96')]=_0x2641fc[_0x2a2b('0x91')];_0x47132e['applications']=_['orderBy'](_0x47132e[_0x2a2b('0x95')],[_0x2a2b('0x97')],[_0x2a2b('0x98')]);if(_0x47132e[_0x2a2b('0x94')][_0x2a2b('0x93')]){delete _0x47132e[_0x2a2b('0x94')]['Applications'];}if(_0x47132e['account'][_0x2a2b('0x91')]&&_0x47132e[_0x2a2b('0x94')][_0x2a2b('0x91')][_0x2a2b('0x99')]['length']){return _0x47132e[_0x2a2b('0x94')][_0x2a2b('0x91')][_0x2a2b('0x99')][0x0];}var _0x3ecc63=_[_0x2a2b('0x13')](_0x151814['body'],{'firstName':_0x151814[_0x2a2b('0x55')][_0x2a2b('0x8f')],'ListId':_0x2641fc[_0x2a2b('0x87')]});_0x3ecc63[_0x151814[_0x2a2b('0x55')][_0x2a2b('0x8d')]]=_0x151814[_0x2a2b('0x55')][_0x2a2b('0x8f')];return db[_0x2a2b('0x81')]['create'](_0x3ecc63,{'fields':_0x38f0fa,'raw':!![]});}})[_0x2a2b('0x2e')](handleEntityNotFound(_0x4918b1,null))[_0x2a2b('0x2e')](function(_0x11cd60){_0x47132e[_0x2a2b('0x9a')]=_0x11cd60;var _0xca1300=_0x151814['body'][_0x2a2b('0x9b')];if(_0x151814[_0x2a2b('0x9c')]['cf-connecting-ip']){_0xca1300=_0x151814[_0x2a2b('0x9c')]['cf-connecting-ip'];}else if(_0x151814['headers'][_0x2a2b('0x9d')]){_0xca1300=_[_0x2a2b('0x9e')](_0x151814['headers'][_0x2a2b('0x9d')][_0x2a2b('0x9f')](','));}if(_0x11cd60){var _0x57780e={'ContactId':_0x11cd60['id'],'ChatWebsiteId':_0x151814['params']['id'],'from':(_0x11cd60['firstName']||'')+'\x20'+(_0x11cd60['lastName']||''),'customerIp':_0xca1300,'customerPort':_0x151814[_0x2a2b('0x9c')]['x-real-port']?_0x151814[_0x2a2b('0x9c')][_0x2a2b('0xa0')]:null,'referer':_0x151814[_0x2a2b('0x55')][_0x2a2b('0xa1')],'browserName':_0x303a45['browser'][_0x2a2b('0x33')]&&_0x303a45[_0x2a2b('0xa2')][_0x2a2b('0xa3')]?util[_0x2a2b('0xa4')]('%s\x20%s',_0x303a45[_0x2a2b('0xa2')][_0x2a2b('0x33')],_0x303a45['browser'][_0x2a2b('0xa3')]):'unknown','browserVersion':_0x303a45[_0x2a2b('0xa2')][_0x2a2b('0xa3')]||_0x2a2b('0xa5'),'osName':util[_0x2a2b('0xa4')](_0x2a2b('0xa6'),_0x303a45['os']['name'],_0x303a45['os']['version']),'osVersion':_0x303a45['os'][_0x2a2b('0xa3')],'deviceModel':_0x303a45[_0x2a2b('0xa7')][_0x2a2b('0x3d')]&&_0x303a45[_0x2a2b('0xa7')][_0x2a2b('0xa8')]?util[_0x2a2b('0xa4')]('%s\x20%s\x20%s',_0x303a45[_0x2a2b('0xa7')]['model'],_0x303a45[_0x2a2b('0xa7')][_0x2a2b('0xa8')],_0x303a45['device'][_0x2a2b('0x3c')]):null,'deviceVendor':_0x303a45[_0x2a2b('0xa7')][_0x2a2b('0xa8')],'deviceType':_0x303a45[_0x2a2b('0xa7')][_0x2a2b('0x3c')],'formData':JSON[_0x2a2b('0x1a')](_0x151814['body'])};var _0x46dd81={'ChatWebsiteId':_0x151814[_0x2a2b('0x5a')]['id'],'closed':![]};if(_0x151814['body'][_0x2a2b('0xa9')]){_0x46dd81[_0x2a2b('0xa9')]=_0x151814[_0x2a2b('0x55')]['threadId'];return db[_0x2a2b('0xaa')][_0x2a2b('0x53')]({'where':_0x46dd81})[_0x2a2b('0x2e')](function(_0x5d72be){if(_0x5d72be){return[_0x5d72be,![]];}_0x57780e[_0x2a2b('0xa9')]=_0x151814[_0x2a2b('0x55')][_0x2a2b('0xa9')];_0x57780e[_0x2a2b('0xab')]=_0x151814[_0x2a2b('0x55')]['externalUrl'];return db[_0x2a2b('0xaa')][_0x2a2b('0x54')](_0x57780e)[_0x2a2b('0x2e')](function(_0x366c9f){return[_0x366c9f,!![]];});});}_0x46dd81[_0x2a2b('0xac')]=_0x11cd60['id'];if(_0x151814[_0x2a2b('0x55')][_0x2a2b('0xad')]&&_0x151814[_0x2a2b('0x55')]['interaction']['id']){_0x46dd81['id']=_0x151814['body'][_0x2a2b('0xad')]['id'];return db[_0x2a2b('0xaa')][_0x2a2b('0x53')]({'where':_0x46dd81})[_0x2a2b('0x2e')](function(_0x52de78){if(_0x52de78){return[_0x52de78,![]];}return db[_0x2a2b('0xaa')]['create'](_0x57780e)[_0x2a2b('0x2e')](function(_0x66f5f6){return[_0x66f5f6,!![]];});});}return db[_0x2a2b('0xaa')][_0x2a2b('0x54')](_0x57780e)[_0x2a2b('0x2e')](function(_0x450d3f){return[_0x450d3f,!![]];});}})[_0x2a2b('0xae')](function(_0x18d895,_0x54b459){if(_0x18d895){_0x3f8985=_0x54b459;if(!_0x54b459){var _0xaf91c0={'from':(_0x47132e[_0x2a2b('0x9a')][_0x2a2b('0xaf')]||'')+'\x20'+(_0x47132e[_0x2a2b('0x9a')]['lastName']||'')};if(_0x151814[_0x2a2b('0x55')][_0x2a2b('0xa9')]&&_0x151814[_0x2a2b('0x55')][_0x2a2b('0xb0')]&&_0x151814[_0x2a2b('0x55')][_0x2a2b('0xa9')]!=_0x151814['body'][_0x2a2b('0xb0')]){_0xaf91c0['threadId']=_0x151814[_0x2a2b('0x55')][_0x2a2b('0xb0')];}return _0x18d895[_0x2a2b('0xb1')](_0xaf91c0);}else{return _0x18d895;}}})[_0x2a2b('0x2e')](function(_0x2c17f1){_0x47132e['interaction']=_0x2c17f1[_0x2a2b('0x2f')]({'plain':!![]});_0x47132e[_0x2a2b('0xad')][_0x2a2b('0xb2')]=_0x3f8985;if(_0x47132e[_0x2a2b('0xad')][_0x2a2b('0xb2')]){if(_0x47132e[_0x2a2b('0x94')][_0x2a2b('0xb3')]){_0x47132e[_0x2a2b('0x95')]['push']({'id':0x0,'priority':_0x47132e['applications'][_0x2a2b('0x44')]+0x1,'app':_0x2a2b('0xb4'),'appdata':_0x2a2b('0xb5'),'interval':_0x2a2b('0xb6')});}}return db['ChatMessage'][_0x2a2b('0x54')]({'body':_0x151814[_0x2a2b('0x55')][_0x2a2b('0x55')],'ChatWebsiteId':_0x151814[_0x2a2b('0x5a')]['id'],'ChatInteractionId':_0x2c17f1['id'],'direction':'in','ContactId':_0x47132e[_0x2a2b('0x9a')]['id'],'AttachmentId':_0x151814[_0x2a2b('0x55')][_0x2a2b('0xb7')]});})[_0x2a2b('0x2e')](function(_0x479f89){_0x47132e[_0x2a2b('0x1d')]=_0x479f89;if(_0x47132e[_0x2a2b('0xad')]['UserId']){return db['User'][_0x2a2b('0x53')]({'attributes':['id',_0x2a2b('0x33')],'where':{'id':_0x47132e[_0x2a2b('0xad')][_0x2a2b('0xb8')]}})[_0x2a2b('0x2e')](function(_0x21eed2){if(_0x21eed2){_0x47132e[_0x2a2b('0x95')][_0x2a2b('0xb9')]({'id':0x0,'priority':0x0,'app':_0x2a2b('0xba'),'appdata':_0x21eed2[_0x2a2b('0x33')]+','+(_0x47132e[_0x2a2b('0x94')][_0x2a2b('0xbb')]||0xa),'interval':_0x2a2b('0xb6')});_0x47132e[_0x2a2b('0xbc')]=!![];}return respondWithRpcPromise(_0x2a2b('0xbd'),_0x2a2b('0xbe'),_0x47132e);});}return respondWithRpcPromise('Start',_0x2a2b('0xbe'),_0x47132e);})[_0x2a2b('0x2e')](function(_0x3044c8){respondWithRpcPromise(_0x2a2b('0xbf'),'EventManager',{'event':_0x2a2b('0xc0'),'message':_0x3044c8},client9002);return _0x3044c8;})[_0x2a2b('0x2e')](respondWithResult(_0x4918b1,null))[_0x2a2b('0x20')](handleError(_0x4918b1,null));};exports[_0x2a2b('0xc1')]=function(_0x53ee98,_0x20b515,_0x4411e6){var _0x3ef0f7,_0x13b3ba,_0x42af49;var _0x4fca8a=[];var _0x2753b1=[];var _0x46b028={};var _0x5e3b63=_0x53ee98['files']||[];var _0x35faec=[];var _0x5a7347;return db[_0x2a2b('0x81')][_0x2a2b('0x5b')]()['then'](function(_0x56001a){if(!_0x56001a){throw new db['Sequelize'][(_0x2a2b('0x88'))](_0x2a2b('0x83'));}_0x2753b1=_[_0x2a2b('0x84')](_[_0x2a2b('0x3e')](_0x56001a),['createdAt',_0x2a2b('0x86')]);_0x4fca8a=_[_0x2a2b('0x84')](_[_0x2a2b('0x3e')](_0x56001a),[_0x2a2b('0x85'),'updatedAt','CompanyId',_0x2a2b('0x87')]);if(_0x53ee98[_0x2a2b('0x55')]['id']){delete _0x53ee98[_0x2a2b('0x55')]['id'];}if(_[_0x2a2b('0x71')](_0x53ee98['body'][_0x2a2b('0x8f')])){throw _0x20b515['status'](0x1f4)[_0x2a2b('0x34')](new db['Sequelize']['ValidationError'](_0x2a2b('0x89')));}if(_[_0x2a2b('0x71')](_0x53ee98['body'][_0x2a2b('0x55')])||_0x53ee98['body'][_0x2a2b('0x55')]===''){throw _0x20b515[_0x2a2b('0x23')](0x1f4)[_0x2a2b('0x34')](new db[(_0x2a2b('0x82'))][(_0x2a2b('0x88'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_['isNil'](_0x53ee98[_0x2a2b('0x55')][_0x2a2b('0xc2')])){throw _0x20b515[_0x2a2b('0x23')](0x1f4)['send'](new db[(_0x2a2b('0x82'))][(_0x2a2b('0x88'))](_0x2a2b('0xc3')+_0x4fca8a));}if(!_[_0x2a2b('0x8c')](_0x4fca8a,_0x53ee98['body'][_0x2a2b('0xc2')])){throw _0x20b515['status'](0x1f4)[_0x2a2b('0x34')](new db[(_0x2a2b('0x82'))][(_0x2a2b('0x88'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4fca8a));}_0x46b028[_0x53ee98[_0x2a2b('0x55')]['mapKeyOffline']]=_0x53ee98[_0x2a2b('0x55')][_0x2a2b('0x8f')];})[_0x2a2b('0x2e')](function(){return db[_0x2a2b('0x39')][_0x2a2b('0x53')]({'where':{'id':_0x53ee98[_0x2a2b('0x5a')]['id']},'include':[{'model':db['CmList'],'as':'List'},{'model':db['MailAccount'],'as':_0x2a2b('0xc4')}]});})[_0x2a2b('0x2e')](handleEntityNotFound(_0x20b515,null))['then'](function(_0x3f26d6){if(_0x3f26d6&&_0x3f26d6[_0x2a2b('0x91')]){_0x13b3ba=_0x3f26d6;var _0x2dabfe=_[_0x2a2b('0x13')](_0x53ee98['body'],{'firstName':_0x53ee98[_0x2a2b('0x55')]['from'],'phone':_0x53ee98[_0x2a2b('0x55')]['from'],'ListId':_0x3f26d6['ListId']});_0x2dabfe[_0x53ee98[_0x2a2b('0x55')]['mapKeyOffline']]=_0x53ee98[_0x2a2b('0x55')][_0x2a2b('0x8f')];return db[_0x2a2b('0x81')][_0x2a2b('0xc5')]({'where':_0x46b028,'defaults':_0x2dabfe});}})[_0x2a2b('0xae')](function(_0x5e7915){if(_0x5e7915){_0x42af49=_0x5e7915;var _0x597d65=fs[_0x2a2b('0xc6')](path['join'](config[_0x2a2b('0x6e')],_0x2a2b('0xc7')),'utf8');var _0x3c5767=ejs[_0x2a2b('0xc8')](_0x597d65,{'body':_[_0x2a2b('0xc9')](_0x53ee98[_0x2a2b('0x55')][_0x2a2b('0x55')]),'bodyTitle':_0x13b3ba['offlineMessageBody']});return db['ChatOfflineMessage'][_0x2a2b('0x54')]({'body':_0x3c5767,'ContactId':_0x5e7915['id'],'ChatWebsiteId':_0x13b3ba['id']});}})[_0x2a2b('0x2e')](function(_0x5a7022){_0x5a7347=_0x5a7022;if(_0x5e3b63[_0x2a2b('0x44')]){var _0x227e27=_0x5e3b63[_0x2a2b('0x38')](function(_0x391edb){return{'name':_0x391edb['originalname'],'basename':_0x391edb[_0x2a2b('0x67')],'type':_0x391edb[_0x2a2b('0xca')],'ChatOfflineMessageId':_0x5a7022['id']};});_0x35faec=_0x227e27[_0x2a2b('0x38')](_0x56ee69=>{var _0x861ff4={'filename':_0x56ee69['name'],'path':path[_0x2a2b('0x6d')](config['root'],_0x2a2b('0xcb'),_0x2a2b('0xcc'),_0x2a2b('0xcd'),_0x2a2b('0xce'),_0x56ee69['basename'])};return _0x861ff4;});if(!_0x13b3ba[_0x2a2b('0xcf')]){return db[_0x2a2b('0xd0')][_0x2a2b('0xd1')](function(_0xdda2d2){return db['Attachment'][_0x2a2b('0xd2')](_0x227e27,{'transaction':_0xdda2d2});});}}})['then'](function(){if(_0x5a7347){_0x3ef0f7=_0x5a7347;return db[_0x2a2b('0xc4')][_0x2a2b('0xd3')]({'where':{'active':!![]},'include':[{'model':db['MailServerOut'],'as':_0x2a2b('0xd4'),'raw':!![]}]});}})[_0x2a2b('0x2e')](function(_0x419cba){if(_0x419cba&&_0x419cba['Smtp']&&_0x13b3ba[_0x2a2b('0xd5')]&&_0x13b3ba[_0x2a2b('0xd6')]){var _0x4707f9={'tls':{'rejectUnauthorized':![]}};if(_0x419cba[_0x2a2b('0xd4')][_0x2a2b('0xd7')]){_0x4707f9['service']=_0x419cba[_0x2a2b('0xd4')][_0x2a2b('0xd7')];}else{_0x4707f9[_0x2a2b('0xd8')]=_0x419cba[_0x2a2b('0xd4')]['host'];_0x4707f9[_0x2a2b('0xd9')]=_0x419cba['Smtp'][_0x2a2b('0xd9')];_0x4707f9[_0x2a2b('0xda')]=_0x419cba[_0x2a2b('0xd4')][_0x2a2b('0xda')];}if(_0x419cba['Smtp'][_0x2a2b('0xdb')]){_0x4707f9[_0x2a2b('0xdc')]={'user':_0x419cba[_0x2a2b('0xd4')][_0x2a2b('0x56')],'pass':_0x419cba['Smtp'][_0x2a2b('0xdd')]};}return respondWithRpcPromise(_0x2a2b('0xde'),_0x2a2b('0xdf'),{'account':_0x4707f9,'message':{'from':util['format'](_0x2a2b('0xe0'),_0x419cba[_0x2a2b('0x33')],_0x419cba[_0x2a2b('0xe1')]||_0x419cba['Smtp'][_0x2a2b('0x56')]),'to':_0x13b3ba['forwardOfflineAddress'],'subject':_0x13b3ba[_0x2a2b('0xe2')],'html':_0x3ef0f7[_0x2a2b('0x55')],'attachments':_0x35faec}},client9003)[_0x2a2b('0x2e')](function(){return _0x3ef0f7;})['catch'](function(_0x45cd42){console[_0x2a2b('0x1b')](_0x45cd42);});}})[_0x2a2b('0x2e')](function(){if(_0x13b3ba&&_0x13b3ba['openNewInteraction']&&_0x13b3ba[_0x2a2b('0xe3')]){var _0x11eacb=[];if(_0x5e3b63[_0x2a2b('0x44')]){_0x11eacb=_0x5e3b63[_0x2a2b('0x38')](function(_0x5e5191){return{'name':_0x5e5191['originalname'],'basename':_0x5e5191[_0x2a2b('0x67')],'type':_0x5e5191['mimetype'],'ChatOfflineMessageId':_0x5a7347['id']};});}var _0x58ff16;if(!_['isNil'](_0x13b3ba[_0x2a2b('0xe4')])){var _0x1f5ff7=_[_0x2a2b('0x38')](_0x53ee98[_0x2a2b('0x55')],function(_0x266131){return _0x266131;});var _0x2a6e18=_[_0x2a2b('0xe5')](_0x1f5ff7)[0x0];var _0x4a6dee=_[_0x2a2b('0xe6')](_0x2a6e18,function(_0x33d4fc){return _0x33d4fc;});_0x58ff16=_0x4a6dee[0x1][_0x13b3ba[_0x2a2b('0xe4')]];}var _0x336b97={'from':_0x42af49[_0x2a2b('0xe1')],'firstName':_0x42af49['firstName'],'lastName':_0x42af49['lastName'],'mapKey':_0x2a2b('0xe1'),'message':{'from':_0x42af49['email'],'to':_0x13b3ba['MailAccount'][_0x2a2b('0xe1')],'cc':'','subject':_[_0x2a2b('0x71')](_0x58ff16)?_0x13b3ba['offlineMessageSubject']:_0x58ff16,'messageId':'','sentAt':new Date(),'attach':_0x11eacb[_0x2a2b('0x44')],'attachments':_0x11eacb,'originChannel':_0x2a2b('0xe7'),'ChatWebsiteId':_0x13b3ba['id'],'ChatOfflineMessageId':_0x3ef0f7['id'],'originTo':_0x13b3ba[_0x2a2b('0xc4')]['email']},'body':_0x3ef0f7['body']};var _0x39171c={'account':{'id':_0x13b3ba[_0x2a2b('0xe3')]},'body':_0x336b97,'log':_0x2a2b('0xe8')};return respondWithRpcPromise(_0x2a2b('0xe8'),'notifyMail',_0x39171c,client9001)['then'](function(){return _0x3ef0f7;})[_0x2a2b('0x20')](function(_0x24aa8d){console[_0x2a2b('0x1b')](_0x24aa8d);});}return;})[_0x2a2b('0x2e')](function(){if(_0x3ef0f7){return _0x3ef0f7;}})[_0x2a2b('0x2e')](respondWithResult(_0x20b515,null))['catch'](function(_0x5b1ff2){console[_0x2a2b('0x1b')](_0x2a2b('0x20'),_0x5b1ff2);for(var _0x3dba15 of _0x5e3b63){var _0x5aad59=path[_0x2a2b('0x6d')](config[_0x2a2b('0x6e')],_0x2a2b('0xcb'),_0x2a2b('0xcc'),_0x2a2b('0xcd'),_0x2a2b('0xce'),_0x3dba15[_0x2a2b('0x67')]);fs_extra[_0x2a2b('0xe9')](_0x5aad59)[_0x2a2b('0x20')](function(_0x4c1202){console[_0x2a2b('0x1b')](_0x2a2b('0xea'),_0x5aad59,_0x4c1202);});}});};exports[_0x2a2b('0xeb')]=function(_0x3fc9f1,_0x8ae55e,_0x40329b){return db[_0x2a2b('0xaa')]['find']({'where':{'id':_0x3fc9f1['params']['id']}})[_0x2a2b('0x2e')](handleEntityNotFound(_0x8ae55e,null))[_0x2a2b('0x2e')](function(_0x5f5351){if(_0x5f5351){return _0x5f5351[_0x2a2b('0xeb')](_0x3fc9f1[_0x2a2b('0x55')][_0x2a2b('0x5f')],_[_0x2a2b('0xec')](_0x3fc9f1[_0x2a2b('0x55')],['ids','id'])||{});}})[_0x2a2b('0x2e')](respondWithResult(_0x8ae55e,null))['catch'](handleError(_0x8ae55e,null));};exports[_0x2a2b('0xed')]=function(_0x11e6cc,_0x2caf32,_0x5635f6){var _0x18c9b8={'raw':![],'where':{}};var _0x1ab5b4={};var _0x21ce9f={'count':0x0,'rows':[]};return db[_0x2a2b('0x39')][_0x2a2b('0xd3')]({'where':{'id':_0x11e6cc[_0x2a2b('0x5a')]['id']}})[_0x2a2b('0x2e')](handleEntityNotFound(_0x2caf32,null))[_0x2a2b('0x2e')](function(_0xda7dfb){if(_0xda7dfb){_0x1ab5b4[_0x2a2b('0x3d')]=_[_0x2a2b('0x3e')](db[_0x2a2b('0xaa')][_0x2a2b('0x3a')]);_0x1ab5b4[_0x2a2b('0x41')]=_[_0x2a2b('0x3e')](_0x11e6cc[_0x2a2b('0x41')]);_0x1ab5b4['filters']=_[_0x2a2b('0x40')](_0x1ab5b4['model'],_0x1ab5b4[_0x2a2b('0x41')]);_0x18c9b8[_0x2a2b('0x43')]=_['intersection'](_0x1ab5b4[_0x2a2b('0x3d')],qs[_0x2a2b('0x42')](_0x11e6cc[_0x2a2b('0x41')][_0x2a2b('0x42')]));_0x18c9b8[_0x2a2b('0x43')]=_0x18c9b8['attributes'][_0x2a2b('0x44')]?_0x18c9b8[_0x2a2b('0x43')]:_0x1ab5b4['model'];if(!_0x11e6cc[_0x2a2b('0x41')][_0x2a2b('0x45')](_0x2a2b('0x46'))){_0x18c9b8[_0x2a2b('0x26')]=qs[_0x2a2b('0x26')](_0x11e6cc[_0x2a2b('0x41')]['limit']);_0x18c9b8[_0x2a2b('0x25')]=qs[_0x2a2b('0x25')](_0x11e6cc[_0x2a2b('0x41')][_0x2a2b('0x25')]);}_0x18c9b8[_0x2a2b('0x47')]=qs['sort'](_0x11e6cc[_0x2a2b('0x41')][_0x2a2b('0x48')]);_0x18c9b8[_0x2a2b('0x49')]=qs['filters'](_[_0x2a2b('0x4a')](_0x11e6cc[_0x2a2b('0x41')],_0x1ab5b4[_0x2a2b('0x3f')]));_0x18c9b8[_0x2a2b('0x49')][_0x2a2b('0x5c')]=_0xda7dfb['id'];if(_0x11e6cc[_0x2a2b('0x41')][_0x2a2b('0x4b')]){_0x18c9b8[_0x2a2b('0x49')]=_['merge'](_0x18c9b8[_0x2a2b('0x49')],{'$or':_[_0x2a2b('0x38')](_0x18c9b8[_0x2a2b('0x43')],function(_0x1bd6b8){var _0x23a120={};_0x23a120[_0x1bd6b8]={'$like':'%'+_0x11e6cc[_0x2a2b('0x41')][_0x2a2b('0x4b')]+'%'};return _0x23a120;})});}_0x18c9b8=_[_0x2a2b('0x4d')]({},_0x18c9b8,_0x11e6cc[_0x2a2b('0x52')]);return db[_0x2a2b('0xaa')]['count']({'where':_0x18c9b8[_0x2a2b('0x49')]})[_0x2a2b('0x2e')](function(_0xa97694){_0x21ce9f[_0x2a2b('0x28')]=_0xa97694;if(_0x11e6cc[_0x2a2b('0x41')]['includeAll']){_0x18c9b8['include']=[{'model':db[_0x2a2b('0x81')],'as':_0x2a2b('0xee'),'required':![]},{'model':db[_0x2a2b('0xef')],'as':_0x2a2b('0xf0'),'attributes':[_0x2a2b('0x33'),'fullname',_0x2a2b('0xf1')],'required':![]},{'model':db['Tag'],'as':_0x2a2b('0xf2'),'attributes':['id','name',_0x2a2b('0xf3')],'where':_0x11e6cc[_0x2a2b('0x41')][_0x2a2b('0xf4')]?{'id':_0x11e6cc['query'][_0x2a2b('0xf4')]}:undefined,'required':_0x11e6cc[_0x2a2b('0x41')][_0x2a2b('0xf4')]?!![]:![]}];}return db[_0x2a2b('0xaa')]['findAll'](_0x18c9b8);})[_0x2a2b('0x2e')](function(_0x382813){_0x21ce9f['rows']=_0x382813;return _0x21ce9f;});}})[_0x2a2b('0x2e')](respondWithFilteredResult(_0x2caf32,_0x18c9b8))[_0x2a2b('0x20')](handleError(_0x2caf32,null));};function iftimePromise(_0x919dd2,_0x282874){return respondWithRpcPromise('Command',_0x2a2b('0xf5'),{'command':_0x282874[_0x2a2b('0xf6')]?util['format']('iftime\x20%s,%s',_0x919dd2['interval'],_0x282874[_0x2a2b('0xf6')]):util['format'](_0x2a2b('0xf7'),_0x919dd2[_0x2a2b('0xf8')])},client9002)[_0x2a2b('0x2e')](function(_0x3623ec){var _0x370260=_0x3623ec&&_0x3623ec[_0x2a2b('0xf9')](_0x2a2b('0xfa'))>=0x0?!![]:![];logger[_0x2a2b('0x1e')](_0x2a2b('0xfb'),_0x282874['id'],_0x919dd2['id'],_0x919dd2[_0x2a2b('0xf8')],_0x370260?_0x2a2b('0xfc'):_0x2a2b('0xfd'),_0x282874['timezone']?_0x282874[_0x2a2b('0xf6')]:_0x2a2b('0xfe'));return _0x370260;})[_0x2a2b('0x20')](function(_0x470740){logger[_0x2a2b('0x1b')](_0x2a2b('0xfb'),_0x282874['id'],_0x919dd2['id'],_0x919dd2[_0x2a2b('0xf8')],util[_0x2a2b('0xff')](_0x470740,{'showHidden':![],'depth':null}),_0x282874[_0x2a2b('0xf6')]?_0x282874[_0x2a2b('0xf6')]:'No\x20timezone');return![];});}exports['getSnippet']=function(_0x49d98e,_0x2f53be,_0x6d5702){var _0x3f382d=0x0;var _0xb66fca=0x0;var _0x3cf4f6=![];var _0x57706d;var _0x1857d0;return db[_0x2a2b('0x39')][_0x2a2b('0x53')]({'where':{'id':_0x49d98e[_0x2a2b('0x5a')]['id']},'include':[{'model':db[_0x2a2b('0x100')],'as':_0x2a2b('0x100'),'include':[{'model':db['Interval'],'as':_0x2a2b('0x101'),'attributes':['id',_0x2a2b('0xf8')],'raw':!![]}]}]})[_0x2a2b('0x2e')](handleEntityNotFound(_0x2f53be,null))[_0x2a2b('0x2e')](function(_0x731b40){if(_0x731b40){_0x57706d=_0x731b40;return _0x731b40[_0x2a2b('0x102')]({'raw':!![]});}})[_0x2a2b('0x2e')](function(_0x5dd090){if(_0x57706d){if(_0x5dd090){_0x1857d0=_0x5dd090;}}return require(_0x2a2b('0x103'))[_0x2a2b('0x70')]();})[_0x2a2b('0x2e')](function(_0xcfaf98){if(_0xcfaf98){_0xb66fca=_0xcfaf98[_0x2a2b('0x104')];_0x3cf4f6=_0xcfaf98['custom'];}})[_0x2a2b('0x2e')](function(){return db[_0x2a2b('0xaa')][_0x2a2b('0x28')]({'where':{'closed':![]}});})['then'](function(_0x97a860){_0x3f382d=_0x97a860;if(_0xb66fca&&_0x97a860>_0xb66fca){return db[_0x2a2b('0x105')][_0x2a2b('0xd3')]({'where':{'id':0x1}})['then'](function(_0x42687e){if(_0x42687e){_0x42687e['increment'](_0x2a2b('0x106'));}});}})[_0x2a2b('0x2e')](function(){if(_0x57706d[_0x2a2b('0x100')]&&_0x57706d[_0x2a2b('0x100')][_0x2a2b('0x101')]){var _0x4d68cf=[];for(var _0x56cdac=0x0;_0x56cdac<_0x57706d['Interval']['Intervals'][_0x2a2b('0x44')];_0x56cdac++){var _0x4aa229=_0x57706d[_0x2a2b('0x100')][_0x2a2b('0x101')][_0x56cdac]['get']({'plain':!![]});_0x4d68cf[_0x2a2b('0x107')](iftimePromise(_0x4aa229,_0x57706d));}return BPromise[_0x2a2b('0x108')](_0x4d68cf)[_0x2a2b('0x2e')](function(_0x3d4306){return _[_0x2a2b('0x109')](_0x3d4306);});}else{return!![];}})[_0x2a2b('0x2e')](function(_0x4294e8){var _0x29496a=fs['readFileSync'](path[_0x2a2b('0x6d')](config[_0x2a2b('0x6e')],_0x2a2b('0x10a')),_0x2a2b('0x10b'));var _0xc6731={'remote':_0x57706d[_0x2a2b('0x10c')],'query':querystring[_0x2a2b('0x1a')](_[_0x2a2b('0x4d')](_0x57706d['get']({'plain':!![]}),{'customerIp':_0x49d98e['headers'][_0x2a2b('0x9d')]||_0x49d98e['headers']['x-real-ip']||_0x49d98e[_0x2a2b('0x10d')][_0x2a2b('0x10e')]||_0x49d98e['ip'],'referer':_0x49d98e['headers'][_0x2a2b('0xa1')],'openedInteractions':_0x3f382d,'maxInteractions':_0xb66fca,'virtual':_0x3cf4f6[_0x2a2b('0x104')],'online':_0x4294e8,'custom':_0x3cf4f6}))[_0x2a2b('0x10f')](/'/g,'\x5c\x27')};_0x2f53be[_0x2a2b('0x34')](ejs[_0x2a2b('0xc8')](Mustache[_0x2a2b('0xc8')](_0x29496a,_0xc6731),{'proactiveActions':_0x1857d0,'alignment':_0x57706d[_0x2a2b('0x110')],'verticalAlignment':_0x57706d[_0x2a2b('0x111')],'div_color':_0x57706d['color'],'text_color':_0x57706d[_0x2a2b('0x112')],'button_color':_0x57706d[_0x2a2b('0x113')],'background_color':_0x57706d[_0x2a2b('0x114')]}));})['catch'](handleError(_0x2f53be,null));};exports[_0x2a2b('0x115')]=function(_0x3f3580,_0xe4bd04,_0xef3775){return db[_0x2a2b('0x39')][_0x2a2b('0xd3')]({'where':{'id':_0x3f3580[_0x2a2b('0x5a')]['id']}})['then'](handleEntityNotFound(_0xe4bd04,null))[_0x2a2b('0x2e')](function(_0x590cc1){if(_0x590cc1){return db['sequelize']['transaction'](function(_0x588c24){return db[_0x2a2b('0x92')]['destroy']({'where':{'ChatWebsiteId':_0x3f3580[_0x2a2b('0x5a')]['id']},'transaction':_0x588c24})[_0x2a2b('0x2e')](function(_0x2d67e8){var _0x1708d3=_[_0x2a2b('0x38')](_0x3f3580[_0x2a2b('0x55')],function(_0x5405ae){_0x5405ae[_0x2a2b('0x5c')]=_0x3f3580[_0x2a2b('0x5a')]['id'];return _0x5405ae;});return db[_0x2a2b('0x92')]['bulkCreate'](_0x1708d3,{'transaction':_0x588c24});});})[_0x2a2b('0x2e')](function(){return db[_0x2a2b('0x92')][_0x2a2b('0x116')]({'where':{'ChatWebsiteId':_0x3f3580[_0x2a2b('0x5a')]['id']},'order':_0x2a2b('0x97')});});}})[_0x2a2b('0x2e')](respondWithResult(_0xe4bd04,null))['catch'](handleError(_0xe4bd04,null));};exports['getApplications']=function(_0xa1ac18,_0x30b06c,_0x2d2de3){var _0x3961d8={};var _0x2b44fb={};var _0x53b1fb;var _0x3e2b06;return db[_0x2a2b('0x39')][_0x2a2b('0xd3')]({'where':{'id':_0xa1ac18['params']['id']}})[_0x2a2b('0x2e')](handleEntityNotFound(_0x30b06c,null))[_0x2a2b('0x2e')](function(_0x3f2fcc){if(_0x3f2fcc){_0x53b1fb=_0x3f2fcc;_0x2b44fb['model']=_[_0x2a2b('0x3e')](db[_0x2a2b('0x92')][_0x2a2b('0x3a')]);_0x2b44fb[_0x2a2b('0x41')]=_['keys'](_0xa1ac18[_0x2a2b('0x41')]);_0x2b44fb[_0x2a2b('0x3f')]=_[_0x2a2b('0x40')](_0x2b44fb[_0x2a2b('0x3d')],_0x2b44fb['query']);_0x3961d8[_0x2a2b('0x43')]=_[_0x2a2b('0x40')](_0x2b44fb[_0x2a2b('0x3d')],qs[_0x2a2b('0x42')](_0xa1ac18['query']['fields']));_0x3961d8['attributes']=_0x3961d8['attributes'][_0x2a2b('0x44')]?_0x3961d8[_0x2a2b('0x43')]:_0x2b44fb[_0x2a2b('0x3d')];_0x3961d8[_0x2a2b('0x47')]=qs[_0x2a2b('0x48')](_0xa1ac18[_0x2a2b('0x41')][_0x2a2b('0x48')]);_0x3961d8['where']=qs[_0x2a2b('0x3f')](_[_0x2a2b('0x4a')](_0xa1ac18[_0x2a2b('0x41')],_0x2b44fb['filters']));if(_0xa1ac18[_0x2a2b('0x41')][_0x2a2b('0x4b')]){_0x3961d8[_0x2a2b('0x49')]=_[_0x2a2b('0x4d')](_0x3961d8[_0x2a2b('0x49')],{'$or':_[_0x2a2b('0x38')](_0x3961d8['attributes'],function(_0x4aae0f){var _0x1d701b={};_0x1d701b[_0x4aae0f]={'$like':'%'+_0xa1ac18[_0x2a2b('0x41')][_0x2a2b('0x4b')]+'%'};return _0x1d701b;})});}_0x3961d8=_[_0x2a2b('0x4d')]({},_0x3961d8,_0xa1ac18[_0x2a2b('0x52')]);return _0x53b1fb[_0x2a2b('0x117')](_0x3961d8);}})[_0x2a2b('0x2e')](function(_0x58df73){if(_0x58df73){_0x3e2b06=_0x58df73['length'];if(!_0xa1ac18[_0x2a2b('0x41')][_0x2a2b('0x45')]('nolimit')){_0x3961d8[_0x2a2b('0x26')]=qs[_0x2a2b('0x26')](_0xa1ac18[_0x2a2b('0x41')][_0x2a2b('0x26')]);_0x3961d8[_0x2a2b('0x25')]=qs[_0x2a2b('0x25')](_0xa1ac18[_0x2a2b('0x41')][_0x2a2b('0x25')]);}return _0x53b1fb['getApplications'](_0x3961d8);}})[_0x2a2b('0x2e')](function(_0x44f15b){if(_0x44f15b){return _0x44f15b?{'count':_0x3e2b06,'rows':_0x44f15b}:null;}})[_0x2a2b('0x2e')](respondWithResult(_0x30b06c,null))[_0x2a2b('0x20')](handleError(_0x30b06c,null));};exports[_0x2a2b('0x118')]=function(_0x5193e2,_0x12af67,_0x5f30bc){return db[_0x2a2b('0x119')][_0x2a2b('0x53')]({'where':{'id':_0x5193e2[_0x2a2b('0x5a')]['id']}})[_0x2a2b('0x2e')](handleEntityNotFound(_0x12af67,null))[_0x2a2b('0x2e')](function(_0x1ef37e){if(_0x1ef37e){return _0x1ef37e[_0x2a2b('0x118')](_0x5193e2[_0x2a2b('0x55')][_0x2a2b('0x5f')],_[_0x2a2b('0xec')](_0x5193e2['body'],[_0x2a2b('0x5f'),'id'])||{});}})[_0x2a2b('0x2e')](respondWithResult(_0x12af67,null))[_0x2a2b('0x20')](handleError(_0x12af67,null));};exports[_0x2a2b('0x102')]=function(_0xa1489e,_0x5d3ef3,_0x5ad188){var _0x40eaec={};var _0x3ac8ef={};var _0x33b689;var _0x1f7f91;return db['ChatWebsite'][_0x2a2b('0xd3')]({'where':{'id':_0xa1489e['params']['id']}})[_0x2a2b('0x2e')](handleEntityNotFound(_0x5d3ef3,null))[_0x2a2b('0x2e')](function(_0x4640fa){if(_0x4640fa){_0x33b689=_0x4640fa;_0x3ac8ef[_0x2a2b('0x3d')]=_[_0x2a2b('0x3e')](db['ChatProactiveAction']['rawAttributes']);_0x3ac8ef[_0x2a2b('0x41')]=_[_0x2a2b('0x3e')](_0xa1489e[_0x2a2b('0x41')]);_0x3ac8ef['filters']=_[_0x2a2b('0x40')](_0x3ac8ef['model'],_0x3ac8ef[_0x2a2b('0x41')]);_0x40eaec[_0x2a2b('0x43')]=_[_0x2a2b('0x40')](_0x3ac8ef[_0x2a2b('0x3d')],qs[_0x2a2b('0x42')](_0xa1489e[_0x2a2b('0x41')][_0x2a2b('0x42')]));_0x40eaec[_0x2a2b('0x43')]=_0x40eaec[_0x2a2b('0x43')][_0x2a2b('0x44')]?_0x40eaec[_0x2a2b('0x43')]:_0x3ac8ef[_0x2a2b('0x3d')];_0x40eaec[_0x2a2b('0x47')]=qs['sort'](_0xa1489e[_0x2a2b('0x41')][_0x2a2b('0x48')]);_0x40eaec[_0x2a2b('0x49')]=qs['filters'](_[_0x2a2b('0x4a')](_0xa1489e['query'],_0x3ac8ef[_0x2a2b('0x3f')]));if(_0xa1489e[_0x2a2b('0x41')][_0x2a2b('0x4b')]){_0x40eaec[_0x2a2b('0x49')]=_[_0x2a2b('0x4d')](_0x40eaec[_0x2a2b('0x49')],{'$or':_[_0x2a2b('0x38')](_0x40eaec['attributes'],function(_0x1853b6){var _0x5651ea={};_0x5651ea[_0x1853b6]={'$like':'%'+_0xa1489e[_0x2a2b('0x41')][_0x2a2b('0x4b')]+'%'};return _0x5651ea;})});}_0x40eaec=_[_0x2a2b('0x4d')]({},_0x40eaec,_0xa1489e[_0x2a2b('0x52')]);return _0x33b689[_0x2a2b('0x102')](_0x40eaec);}})['then'](function(_0x38c650){if(_0x38c650){_0x1f7f91=_0x38c650[_0x2a2b('0x44')];if(!_0xa1489e[_0x2a2b('0x41')][_0x2a2b('0x45')](_0x2a2b('0x46'))){_0x40eaec[_0x2a2b('0x26')]=qs[_0x2a2b('0x26')](_0xa1489e[_0x2a2b('0x41')]['limit']);_0x40eaec['offset']=qs['offset'](_0xa1489e['query'][_0x2a2b('0x25')]);}return _0x33b689[_0x2a2b('0x102')](_0x40eaec);}})[_0x2a2b('0x2e')](function(_0x21467d){if(_0x21467d){return _0x21467d?{'count':_0x1f7f91,'rows':_0x21467d}:null;}})[_0x2a2b('0x2e')](respondWithResult(_0x5d3ef3,null))[_0x2a2b('0x20')](handleError(_0x5d3ef3,null));};exports[_0x2a2b('0x11a')]=function(_0x1acbe4,_0x58907a,_0x5365c6){var _0x3b8fc7=_0x1acbe4[_0x2a2b('0x41')][_0x2a2b('0x11b')]===_0x2a2b('0x11c')?_0x2a2b('0x11d'):_0x2a2b('0x11e');return db[_0x2a2b('0x39')][_0x2a2b('0x53')]({'attributes':['id',_0x3b8fc7],'where':{'id':_0x1acbe4[_0x2a2b('0x5a')]['id']}})[_0x2a2b('0x2e')](handleEntityNotFound(_0x58907a,null))[_0x2a2b('0x2e')](function(_0x49fdf8){if(_0x49fdf8){var _0x1dec38=_0x49fdf8[_0x3b8fc7];var _0x1b0c48=_0x1dec38&&_0x1dec38[_0x2a2b('0x11f')]?_0x1dec38[_0x2a2b('0x11f')]:[];_0x58907a['send']({'fromKey':_[_0x2a2b('0x71')](_0x1dec38[_0x2a2b('0x120')])?undefined:_0x1dec38[_0x2a2b('0x120')],'count':_0x1b0c48['length'],'rows':_0x1b0c48});}})[_0x2a2b('0x20')](handleError(_0x58907a,null));};exports[_0x2a2b('0x121')]=function(_0x497966,_0x5df0ad,_0x8e3c0e){var _0x50143b={'raw':![],'where':{}};var _0x3e724f={};var _0x33dda2={'count':0x0,'rows':[]};return db[_0x2a2b('0x39')][_0x2a2b('0xd3')]({'where':{'id':_0x497966['params']['id']}})[_0x2a2b('0x2e')](handleEntityNotFound(_0x5df0ad,null))[_0x2a2b('0x2e')](function(_0x2a99b2){if(_0x2a99b2){_0x3e724f[_0x2a2b('0x3d')]=_[_0x2a2b('0x3e')](db[_0x2a2b('0x122')][_0x2a2b('0x3a')]);_0x3e724f['query']=_[_0x2a2b('0x3e')](_0x497966[_0x2a2b('0x41')]);_0x3e724f[_0x2a2b('0x3f')]=_[_0x2a2b('0x40')](_0x3e724f[_0x2a2b('0x3d')],_0x3e724f[_0x2a2b('0x41')]);_0x50143b['attributes']=_[_0x2a2b('0x40')](_0x3e724f[_0x2a2b('0x3d')],qs[_0x2a2b('0x42')](_0x497966[_0x2a2b('0x41')][_0x2a2b('0x42')]));_0x50143b[_0x2a2b('0x43')]=_0x50143b[_0x2a2b('0x43')]['length']?_0x50143b[_0x2a2b('0x43')]:_0x3e724f[_0x2a2b('0x3d')];if(!_0x497966[_0x2a2b('0x41')][_0x2a2b('0x45')](_0x2a2b('0x46'))){_0x50143b[_0x2a2b('0x26')]=qs[_0x2a2b('0x26')](_0x497966[_0x2a2b('0x41')]['limit']);_0x50143b[_0x2a2b('0x25')]=qs['offset'](_0x497966[_0x2a2b('0x41')][_0x2a2b('0x25')]);}_0x50143b[_0x2a2b('0x47')]=qs[_0x2a2b('0x48')](_0x497966[_0x2a2b('0x41')]['sort']);_0x50143b['where']=qs[_0x2a2b('0x3f')](_[_0x2a2b('0x4a')](_0x497966[_0x2a2b('0x41')],_0x3e724f[_0x2a2b('0x3f')]));_0x50143b['where'][_0x2a2b('0x5c')]=_0x2a99b2['id'];if(_0x497966[_0x2a2b('0x41')][_0x2a2b('0x4b')]){_0x50143b[_0x2a2b('0x49')]=_[_0x2a2b('0x4d')](_0x50143b[_0x2a2b('0x49')],{'$or':_[_0x2a2b('0x38')](_0x50143b['attributes'],function(_0x8646b2){var _0x17b125={};_0x17b125[_0x8646b2]={'$like':'%'+_0x497966[_0x2a2b('0x41')][_0x2a2b('0x4b')]+'%'};return _0x17b125;})});}_0x50143b=_[_0x2a2b('0x4d')]({},_0x50143b,_0x497966[_0x2a2b('0x52')]);return db[_0x2a2b('0x122')]['count']({'where':_0x50143b[_0x2a2b('0x49')]})['then'](function(_0xb7e66c){_0x33dda2[_0x2a2b('0x28')]=_0xb7e66c;if(_0x497966[_0x2a2b('0x41')][_0x2a2b('0x4e')]){_0x50143b[_0x2a2b('0x4f')]=[{'all':!![]}];}else{_0x50143b[_0x2a2b('0x4f')]=[{'model':db[_0x2a2b('0x81')],'as':_0x2a2b('0xee'),'required':![]},{'model':db[_0x2a2b('0x123')],'as':_0x2a2b('0x124'),'required':![]}];}return db['ChatOfflineMessage'][_0x2a2b('0x50')](_0x50143b);})[_0x2a2b('0x2e')](function(_0x39a48a){_0x33dda2[_0x2a2b('0x51')]=_0x39a48a;return _0x33dda2;});}})[_0x2a2b('0x2e')](respondWithFilteredResult(_0x5df0ad,_0x50143b))[_0x2a2b('0x20')](handleError(_0x5df0ad,null));};exports[_0x2a2b('0x125')]=function(_0x54cbde,_0x49ad15,_0x115632){return db['ChatWebsite'][_0x2a2b('0x53')]({'where':{'id':_0x54cbde['params']['id']}})[_0x2a2b('0x2e')](handleEntityNotFound(_0x49ad15,null))['then'](function(_0x5593b0){if(_0x5593b0){return _0x5593b0[_0x2a2b('0x125')](_0x54cbde[_0x2a2b('0x55')]['ids'],_[_0x2a2b('0xec')](_0x54cbde[_0x2a2b('0x55')],['ids','id'])||{})['spread'](function(_0x3e925e){for(var _0xb30e92=0x0;_0xb30e92<_0x54cbde['body']['ids']['length'];_0xb30e92+=0x1){socket['emit']('userChatWebsite:save',{'UserId':Number(_0x54cbde[_0x2a2b('0x55')][_0x2a2b('0x5f')][_0xb30e92]),'ChatWebsiteId':Number(_0x54cbde[_0x2a2b('0x5a')]['id'])});}return _0x3e925e;});}})[_0x2a2b('0x2e')](respondWithResult(_0x49ad15,null))[_0x2a2b('0x20')](handleError(_0x49ad15,null));};exports[_0x2a2b('0x126')]=function(_0x3c9d09,_0x311ced,_0x4a83c5){return db[_0x2a2b('0x39')][_0x2a2b('0x53')]({'where':{'id':_0x3c9d09[_0x2a2b('0x5a')]['id']}})[_0x2a2b('0x2e')](handleEntityNotFound(_0x311ced,null))[_0x2a2b('0x2e')](function(_0x48647a){if(_0x48647a){return _0x48647a[_0x2a2b('0x126')](_0x3c9d09['query'][_0x2a2b('0x5f')])['then'](function(){if(_[_0x2a2b('0x127')](_0x3c9d09[_0x2a2b('0x41')]['ids'])){for(var _0x52a771=0x0;_0x52a771<_0x3c9d09[_0x2a2b('0x41')][_0x2a2b('0x5f')][_0x2a2b('0x44')];_0x52a771+=0x1){socket[_0x2a2b('0x128')](_0x2a2b('0x129'),{'UserId':Number(_0x3c9d09[_0x2a2b('0x41')][_0x2a2b('0x5f')][_0x52a771]),'ChatWebsiteId':Number(_0x3c9d09[_0x2a2b('0x5a')]['id'])});}}else{socket[_0x2a2b('0x128')](_0x2a2b('0x129'),{'UserId':Number(_0x3c9d09[_0x2a2b('0x41')][_0x2a2b('0x5f')]),'ChatWebsiteId':Number(_0x3c9d09[_0x2a2b('0x5a')]['id'])});}});}})[_0x2a2b('0x2e')](respondWithStatusCode(_0x311ced,null))[_0x2a2b('0x20')](handleError(_0x311ced,null));};exports[_0x2a2b('0x12a')]=function(_0x1c1fcf,_0x17f545,_0x49ca11){var _0x2a5067={};var _0x52a4e5={};var _0x2e2ff4;var _0x5cad70;return db[_0x2a2b('0x39')][_0x2a2b('0xd3')]({'where':{'id':_0x1c1fcf[_0x2a2b('0x5a')]['id']}})['then'](handleEntityNotFound(_0x17f545,null))[_0x2a2b('0x2e')](function(_0x2339b3){if(_0x2339b3){_0x2e2ff4=_0x2339b3;_0x52a4e5[_0x2a2b('0x3d')]=_[_0x2a2b('0x3e')](db[_0x2a2b('0xef')][_0x2a2b('0x3a')]);_0x52a4e5[_0x2a2b('0x41')]=_[_0x2a2b('0x3e')](_0x1c1fcf[_0x2a2b('0x41')]);_0x52a4e5[_0x2a2b('0x3f')]=_[_0x2a2b('0x40')](_0x52a4e5[_0x2a2b('0x3d')],_0x52a4e5[_0x2a2b('0x41')]);_0x2a5067[_0x2a2b('0x43')]=_[_0x2a2b('0x40')](_0x52a4e5[_0x2a2b('0x3d')],qs['fields'](_0x1c1fcf[_0x2a2b('0x41')]['fields']));_0x2a5067['attributes']=_0x2a5067[_0x2a2b('0x43')]['length']?_0x2a5067[_0x2a2b('0x43')]:_0x52a4e5[_0x2a2b('0x3d')];_0x2a5067['order']=qs['sort'](_0x1c1fcf[_0x2a2b('0x41')][_0x2a2b('0x48')]);_0x2a5067[_0x2a2b('0x49')]=qs[_0x2a2b('0x3f')](_[_0x2a2b('0x4a')](_0x1c1fcf[_0x2a2b('0x41')],_0x52a4e5['filters']));if(_0x1c1fcf[_0x2a2b('0x41')][_0x2a2b('0x4b')]){_0x2a5067['where']=_[_0x2a2b('0x4d')](_0x2a5067[_0x2a2b('0x49')],{'$or':_['map'](_0x2a5067[_0x2a2b('0x43')],function(_0x4bf89f){var _0x39b6bc={};_0x39b6bc[_0x4bf89f]={'$like':'%'+_0x1c1fcf[_0x2a2b('0x41')][_0x2a2b('0x4b')]+'%'};return _0x39b6bc;})});}_0x2a5067=_['merge']({},_0x2a5067,_0x1c1fcf[_0x2a2b('0x52')]);return _0x2e2ff4[_0x2a2b('0x12a')](_0x2a5067);}})[_0x2a2b('0x2e')](function(_0x310b4b){if(_0x310b4b){_0x5cad70=_0x310b4b[_0x2a2b('0x44')];if(!_0x1c1fcf['query'][_0x2a2b('0x45')]('nolimit')){_0x2a5067[_0x2a2b('0x26')]=qs[_0x2a2b('0x26')](_0x1c1fcf[_0x2a2b('0x41')]['limit']);_0x2a5067[_0x2a2b('0x25')]=qs[_0x2a2b('0x25')](_0x1c1fcf[_0x2a2b('0x41')][_0x2a2b('0x25')]);}return _0x2e2ff4[_0x2a2b('0x12a')](_0x2a5067);}})[_0x2a2b('0x2e')](function(_0x4768e3){if(_0x4768e3){return _0x4768e3?{'count':_0x5cad70,'rows':_0x4768e3}:null;}})[_0x2a2b('0x2e')](respondWithResult(_0x17f545,null))[_0x2a2b('0x20')](handleError(_0x17f545,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 8318e3d..6f4fbd3 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 _0x3379=['ChatWebsite','setMaxListeners','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x5c2311,_0x24ae77){var _0x2f0ab2=function(_0x4769aa){while(--_0x4769aa){_0x5c2311['push'](_0x5c2311['shift']());}};_0x2f0ab2(++_0x24ae77);}(_0x3379,0x115));var _0x9337=function(_0x4c8543,_0x393cd4){_0x4c8543=_0x4c8543-0x0;var _0x580d91=_0x3379[_0x4c8543];return _0x580d91;};'use strict';var EventEmitter=require(_0x9337('0x0'));var ChatWebsite=require(_0x9337('0x1'))['db'][_0x9337('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x9337('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9337('0x4'),'afterDestroy':_0x9337('0x5')};function emitEvent(_0x144317){return function(_0x30dcfe,_0x49ce9a,_0x45eb99){ChatWebsiteEvents[_0x9337('0x6')](_0x144317+':'+_0x30dcfe['id'],_0x30dcfe);ChatWebsiteEvents[_0x9337('0x6')](_0x144317,_0x30dcfe);_0x45eb99(null);};}for(var e in events){if(events[_0x9337('0x7')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0x9337('0x8')]=ChatWebsiteEvents; \ No newline at end of file +var _0x4453=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','remove','emit'];(function(_0x31a528,_0xa1707f){var _0x4deca8=function(_0x34227e){while(--_0x34227e){_0x31a528['push'](_0x31a528['shift']());}};_0x4deca8(++_0xa1707f);}(_0x4453,0x9c));var _0x3445=function(_0x57f7ea,_0x54da6b){_0x57f7ea=_0x57f7ea-0x0;var _0x54a7e4=_0x4453[_0x57f7ea];return _0x54a7e4;};'use strict';var EventEmitter=require(_0x3445('0x0'));var ChatWebsite=require(_0x3445('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x3445('0x2')](0x0);var events={'afterCreate':_0x3445('0x3'),'afterUpdate':'update','afterDestroy':_0x3445('0x4')};function emitEvent(_0x1419a5){return function(_0xfff5,_0x22c15c,_0x461d8a){ChatWebsiteEvents[_0x3445('0x5')](_0x1419a5+':'+_0xfff5['id'],_0xfff5);ChatWebsiteEvents[_0x3445('0x5')](_0x1419a5,_0xfff5);_0x461d8a(null);};}for(var e in events){if(events[_0x3445('0x6')](e)){var event=events[e];ChatWebsite[_0x3445('0x7')](e,emitEvent(event));}}module[_0x3445('0x8')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index abccb60..9205875 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 _0xf68c=['define','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./chatWebsite.attributes','exports'];(function(_0x403168,_0x5e3ee8){var _0x1f0a82=function(_0x2da0d2){while(--_0x2da0d2){_0x403168['push'](_0x403168['shift']());}};_0x1f0a82(++_0x5e3ee8);}(_0xf68c,0x140));var _0xcf68=function(_0x4fc79e,_0x22c7de){_0x4fc79e=_0x4fc79e-0x0;var _0x9c12f8=_0xf68c[_0x4fc79e];return _0x9c12f8;};'use strict';var _=require(_0xcf68('0x0'));var util=require(_0xcf68('0x1'));var logger=require(_0xcf68('0x2'))(_0xcf68('0x3'));var moment=require('moment');var BPromise=require(_0xcf68('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcf68('0x5'));var rimraf=require(_0xcf68('0x6'));var config=require(_0xcf68('0x7'));var attributes=require(_0xcf68('0x8'));module[_0xcf68('0x9')]=function(_0x3c799c,_0x1de0f3){return _0x3c799c[_0xcf68('0xa')]('ChatWebsite',attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1466=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','chat_websites','lodash','util','../../config/logger'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x1466,0x11b));var _0x6146=function(_0x416ada,_0x4be4ef){_0x416ada=_0x416ada-0x0;var _0x23d1dc=_0x1466[_0x416ada];return _0x23d1dc;};'use strict';var _=require(_0x6146('0x0'));var util=require(_0x6146('0x1'));var logger=require(_0x6146('0x2'))(_0x6146('0x3'));var moment=require(_0x6146('0x4'));var BPromise=require(_0x6146('0x5'));var rp=require(_0x6146('0x6'));var fs=require('fs');var path=require(_0x6146('0x7'));var rimraf=require(_0x6146('0x8'));var config=require(_0x6146('0x9'));var attributes=require('./chatWebsite.attributes');module[_0x6146('0xa')]=function(_0x165c02,_0x50c386){return _0x165c02[_0x6146('0xb')]('ChatWebsite',attributes,{'tableName':_0x6146('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 abb071f..e4f6594 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 _0xb6cc=['register','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','ChatWebsite,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','defaults','redis','localhost','./chatWebsite.socket'];(function(_0x61ef0f,_0x2cfd20){var _0x21ad28=function(_0x36414d){while(--_0x36414d){_0x61ef0f['push'](_0x61ef0f['shift']());}};_0x21ad28(++_0x2cfd20);}(_0xb6cc,0xc9));var _0xcb6c=function(_0x57d4f7,_0x4b6dc7){_0x57d4f7=_0x57d4f7-0x0;var _0x1f0668=_0xb6cc[_0x57d4f7];return _0x1f0668;};'use strict';var _=require(_0xcb6c('0x0'));var util=require(_0xcb6c('0x1'));var moment=require(_0xcb6c('0x2'));var BPromise=require(_0xcb6c('0x3'));var rs=require(_0xcb6c('0x4'));var fs=require('fs');var Redis=require(_0xcb6c('0x5'));var db=require(_0xcb6c('0x6'))['db'];var utils=require(_0xcb6c('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xcb6c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xcb6c('0x9')][_0xcb6c('0xa')]({'port':0x232a});config['redis']=_[_0xcb6c('0xb')](config[_0xcb6c('0xc')],{'host':_0xcb6c('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xcb6c('0xe'))[_0xcb6c('0xf')](socket);function respondWithRpcPromise(_0x3b4d1a,_0x197586,_0x3b92b9){return new BPromise(function(_0x4b3865,_0x409abe){return client['request'](_0x3b4d1a,_0x3b92b9)[_0xcb6c('0x10')](function(_0x3657f2){logger[_0xcb6c('0x11')]('ChatWebsite,\x20%s,\x20%s',_0x197586,_0xcb6c('0x12'));logger[_0xcb6c('0x13')](_0xcb6c('0x14'),_0x197586,_0xcb6c('0x12'),JSON[_0xcb6c('0x15')](_0x3657f2));if(_0x3657f2['error']){if(_0x3657f2['error']['code']===0x1f4){logger[_0xcb6c('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x197586,_0x3657f2[_0xcb6c('0x16')][_0xcb6c('0x17')]);return _0x409abe(_0x3657f2[_0xcb6c('0x16')][_0xcb6c('0x17')]);}logger[_0xcb6c('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x197586,_0x3657f2[_0xcb6c('0x16')]['message']);return _0x4b3865(_0x3657f2[_0xcb6c('0x16')][_0xcb6c('0x17')]);}else{logger['info'](_0xcb6c('0x18'),_0x197586,_0xcb6c('0x12'));_0x4b3865(_0x3657f2[_0xcb6c('0x19')][_0xcb6c('0x17')]);}})[_0xcb6c('0x1a')](function(_0x2293bd){logger[_0xcb6c('0x16')](_0xcb6c('0x18'),_0x197586,_0x2293bd);_0x409abe(_0x2293bd);});});} \ No newline at end of file +var _0x480d=['message','ChatWebsite,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./chatWebsite.socket','request','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x52dc38,_0x2a4db0){var _0x52e132=function(_0x39acbf){while(--_0x39acbf){_0x52dc38['push'](_0x52dc38['shift']());}};_0x52e132(++_0x2a4db0);}(_0x480d,0x18c));var _0xd480=function(_0x2a7d0c,_0x1ce709){_0x2a7d0c=_0x2a7d0c-0x0;var _0x37ccc0=_0x480d[_0x2a7d0c];return _0x37ccc0;};'use strict';var _=require(_0xd480('0x0'));var util=require('util');var moment=require(_0xd480('0x1'));var BPromise=require(_0xd480('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd480('0x3'));var db=require(_0xd480('0x4'))['db'];var utils=require(_0xd480('0x5'));var logger=require(_0xd480('0x6'))(_0xd480('0x7'));var config=require(_0xd480('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd480('0x9')][_0xd480('0xa')]({'port':0x232a});config[_0xd480('0xb')]=_[_0xd480('0xc')](config[_0xd480('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xd480('0xd'))(new Redis(config[_0xd480('0xb')]));require(_0xd480('0xe'))['register'](socket);function respondWithRpcPromise(_0x1152fa,_0x2ec784,_0x53de33){return new BPromise(function(_0x4ee5e9,_0x4a1c41){return client[_0xd480('0xf')](_0x1152fa,_0x53de33)[_0xd480('0x10')](function(_0x38efe2){logger[_0xd480('0x11')]('ChatWebsite,\x20%s,\x20%s',_0x2ec784,_0xd480('0x12'));logger[_0xd480('0x13')](_0xd480('0x14'),_0x2ec784,_0xd480('0x12'),JSON[_0xd480('0x15')](_0x38efe2));if(_0x38efe2[_0xd480('0x16')]){if(_0x38efe2['error'][_0xd480('0x17')]===0x1f4){logger[_0xd480('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x2ec784,_0x38efe2[_0xd480('0x16')][_0xd480('0x18')]);return _0x4a1c41(_0x38efe2[_0xd480('0x16')][_0xd480('0x18')]);}logger[_0xd480('0x16')](_0xd480('0x19'),_0x2ec784,_0x38efe2[_0xd480('0x16')]['message']);return _0x4ee5e9(_0x38efe2['error'][_0xd480('0x18')]);}else{logger[_0xd480('0x11')](_0xd480('0x19'),_0x2ec784,'request\x20sent');_0x4ee5e9(_0x38efe2[_0xd480('0x1a')][_0xd480('0x18')]);}})[_0xd480('0x1b')](function(_0x4f47dc){logger['error'](_0xd480('0x19'),_0x2ec784,_0x4f47dc);_0x4a1c41(_0x4f47dc);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 519208a..1a1a435 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 _0x3cd0=['update','removeListener','register','length','chatWebsite:','./chatWebsite.events','save','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3cd0,0xfd));var _0x03cd=function(_0x255ac0,_0x3f6645){_0x255ac0=_0x255ac0-0x0;var _0x437bf1=_0x3cd0[_0x255ac0];return _0x437bf1;};'use strict';var ChatWebsiteEvents=require(_0x03cd('0x0'));var events=[_0x03cd('0x1'),_0x03cd('0x2'),_0x03cd('0x3')];function createListener(_0x16dbb2,_0x3f38d9){return function(_0x5b3d8a){_0x3f38d9['emit'](_0x16dbb2,_0x5b3d8a);};}function removeListener(_0x5abc8e,_0x4bc885){return function(){ChatWebsiteEvents[_0x03cd('0x4')](_0x5abc8e,_0x4bc885);};}exports[_0x03cd('0x5')]=function(_0x41878c){for(var _0x53ac33=0x0,_0x3800da=events[_0x03cd('0x6')];_0x53ac33<_0x3800da;_0x53ac33++){var _0x596e48=events[_0x53ac33];var _0x41743c=createListener(_0x03cd('0x7')+_0x596e48,_0x41878c);ChatWebsiteEvents['on'](_0x596e48,_0x41743c);}}; \ No newline at end of file +var _0x8cf2=['emit','register','length','./chatWebsite.events','save'];(function(_0x2dc5e,_0x5376dd){var _0x384e3a=function(_0x136429){while(--_0x136429){_0x2dc5e['push'](_0x2dc5e['shift']());}};_0x384e3a(++_0x5376dd);}(_0x8cf2,0x1e3));var _0x28cf=function(_0x2d42e7,_0x4420e5){_0x2d42e7=_0x2d42e7-0x0;var _0x5205a9=_0x8cf2[_0x2d42e7];return _0x5205a9;};'use strict';var ChatWebsiteEvents=require(_0x28cf('0x0'));var events=[_0x28cf('0x1'),'remove','update'];function createListener(_0x4d28a9,_0x5a82fa){return function(_0x496fa6){_0x5a82fa[_0x28cf('0x2')](_0x4d28a9,_0x496fa6);};}function removeListener(_0x5dd77d,_0x36efa4){return function(){ChatWebsiteEvents['removeListener'](_0x5dd77d,_0x36efa4);};}exports[_0x28cf('0x3')]=function(_0x4d8d14){for(var _0x40a5c8=0x0,_0xe2181f=events[_0x28cf('0x4')];_0x40a5c8<_0xe2181f;_0x40a5c8++){var _0x1c18a5=events[_0x40a5c8];var _0x3f985b=createListener('chatWebsite:'+_0x1c18a5,_0x4d8d14);ChatWebsiteEvents['on'](_0x1c18a5,_0x3f985b);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index a409227..2bb7a55 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 _0x0e03=['file','addLogo','join','now','single','addAvatar','server/files/images/avatars/','server/files','attachments','offline-chat','replace','extname','/:id/offline','any','offline','/:id/interactions','addInteraction','/:id/proactive_actions','addProactiveActions','addAgents','put','update','delete','destroy','removeAnswers','removeAgents','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./chatWebsite.controller','index','get','/describe','describe','/:id','isAuthenticated','show','/:id/dispositions','getAnswers','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','/:id/system_avatar','/:id/snippet','getSnippet','/:id/applications','getApplications','getProactiveActions','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','addDisposition','addAnswer','diskStorage','root','server/files/images/logos/','format','%s-%s','originalname','/:id/logo'];(function(_0x46a8ff,_0x8ecc7c){var _0xaa4c09=function(_0x2ad188){while(--_0x2ad188){_0x46a8ff['push'](_0x46a8ff['shift']());}};_0xaa4c09(++_0x8ecc7c);}(_0x0e03,0x169));var _0x30e0=function(_0xb6e2ea,_0x3b26e9){_0xb6e2ea=_0xb6e2ea-0x0;var _0x2a57bb=_0x0e03[_0xb6e2ea];return _0x2a57bb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x30e0('0x0'));var timeout=require(_0x30e0('0x1'));var express=require(_0x30e0('0x2'));var router=express[_0x30e0('0x3')]();var fs_extra=require(_0x30e0('0x4'));var auth=require(_0x30e0('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x30e0('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x30e0('0x7')]);router[_0x30e0('0x8')](_0x30e0('0x9'),auth['isAuthenticated'](),controller[_0x30e0('0xa')]);router[_0x30e0('0x8')](_0x30e0('0xb'),auth[_0x30e0('0xc')](),controller[_0x30e0('0xd')]);router['get'](_0x30e0('0xe'),auth[_0x30e0('0xc')](),controller['getDispositions']);router['get']('/:id/canned_answers',auth[_0x30e0('0xc')](),controller[_0x30e0('0xf')]);router[_0x30e0('0x8')]('/:id/logo',controller[_0x30e0('0x10')]);router['get'](_0x30e0('0x11'),controller[_0x30e0('0x12')]);router['get'](_0x30e0('0x13'),controller['getCustomerAvatar']);router[_0x30e0('0x8')](_0x30e0('0x14'),controller['getSystemAvatar']);router['get']('/:id/interactions',auth[_0x30e0('0xc')](),controller['getInteractions']);router[_0x30e0('0x8')](_0x30e0('0x15'),controller[_0x30e0('0x16')]);router[_0x30e0('0x8')](_0x30e0('0x17'),auth[_0x30e0('0xc')](),controller[_0x30e0('0x18')]);router[_0x30e0('0x8')]('/:id/proactive_actions',auth[_0x30e0('0xc')](),controller[_0x30e0('0x19')]);router[_0x30e0('0x8')]('/:id/fields',controller[_0x30e0('0x1a')]);router[_0x30e0('0x8')](_0x30e0('0x1b'),auth[_0x30e0('0xc')](),controller[_0x30e0('0x1c')]);router['get'](_0x30e0('0x1d'),auth[_0x30e0('0xc')](),controller[_0x30e0('0x1e')]);router['post']('/',auth[_0x30e0('0xc')](),controller['create']);router[_0x30e0('0x1f')](_0x30e0('0xe'),auth[_0x30e0('0xc')](),controller[_0x30e0('0x20')]);router[_0x30e0('0x1f')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x30e0('0x21')]);var upload=multer({'storage':multer[_0x30e0('0x22')]({'destination':function(_0x1cde27,_0x25047e,_0x485076){_0x485076(null,path['join'](config[_0x30e0('0x23')],_0x30e0('0x24')));},'filename':function(_0x17036b,_0x4a7d9c,_0x1f69d9){_0x1f69d9(null,util[_0x30e0('0x25')](_0x30e0('0x26'),Date['now'](),_0x4a7d9c[_0x30e0('0x27')]));}})});router[_0x30e0('0x1f')](_0x30e0('0x28'),upload['single'](_0x30e0('0x29')),controller[_0x30e0('0x2a')]);var upload=multer({'storage':multer[_0x30e0('0x22')]({'destination':function(_0x17fb8a,_0xddb94b,_0x2d57f6){_0x2d57f6(null,path[_0x30e0('0x2b')](config['root'],'server/files/images/avatars/'));},'filename':function(_0x17f68b,_0x3d7916,_0x4db686){_0x4db686(null,util[_0x30e0('0x25')]('%s-%s',Date[_0x30e0('0x2c')](),_0x3d7916[_0x30e0('0x27')]));}})});router[_0x30e0('0x1f')](_0x30e0('0x11'),upload[_0x30e0('0x2d')](_0x30e0('0x29')),controller[_0x30e0('0x2e')]);var upload=multer({'storage':multer[_0x30e0('0x22')]({'destination':function(_0x4af403,_0x43b002,_0x150efd){_0x150efd(null,path['join'](config['root'],_0x30e0('0x2f')));},'filename':function(_0x386ff5,_0x5a7dd2,_0x3b097d){_0x3b097d(null,util['format'](_0x30e0('0x26'),Date[_0x30e0('0x2c')](),_0x5a7dd2[_0x30e0('0x27')]));}})});router[_0x30e0('0x1f')](_0x30e0('0x13'),upload['single'](_0x30e0('0x29')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0x30e0('0x22')]({'destination':function(_0xeebd30,_0x24ba74,_0x2daddd){_0x2daddd(null,path[_0x30e0('0x2b')](config[_0x30e0('0x23')],_0x30e0('0x2f')));},'filename':function(_0x15d7f3,_0x1ad163,_0x1801d9){_0x1801d9(null,util[_0x30e0('0x25')](_0x30e0('0x26'),Date[_0x30e0('0x2c')](),_0x1ad163['originalname']));}})});router[_0x30e0('0x1f')](_0x30e0('0x14'),upload[_0x30e0('0x2d')](_0x30e0('0x29')),controller['addSystemAvatar']);router['post']('/:id/notify',controller['notify']);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x1e405c,_0x68058c,_0x5506b0){const _0x4790c6=path['join'](config['root'],_0x30e0('0x30'),_0x30e0('0x31'),_0x30e0('0x32'));fs_extra['ensureDir'](_0x4790c6,function(){_0x5506b0(null,_0x4790c6);});},'filename':function(_0x2a51b5,_0x4267ac,_0x484302){const _0x5c91ae=_0x4267ac['originalname'][_0x30e0('0x33')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x498af7=path[_0x30e0('0x34')](_0x5c91ae);const _0x20539a=Date[_0x30e0('0x2c')]()+'-'+_0x5c91ae[_0x30e0('0x33')](_0x498af7,'')+_0x498af7;_0x484302(null,_0x20539a);}})});router[_0x30e0('0x1f')](_0x30e0('0x35'),offlineUploadMulter[_0x30e0('0x36')](),controller[_0x30e0('0x37')]);router[_0x30e0('0x1f')](_0x30e0('0x38'),auth[_0x30e0('0xc')](),controller[_0x30e0('0x39')]);router['post'](_0x30e0('0x17'),auth['isAuthenticated'](),controller['addApplications']);router[_0x30e0('0x1f')](_0x30e0('0x3a'),auth['isAuthenticated'](),controller[_0x30e0('0x3b')]);router[_0x30e0('0x1f')](_0x30e0('0x1d'),auth['isAuthenticated'](),controller[_0x30e0('0x3c')]);router[_0x30e0('0x3d')](_0x30e0('0xb'),auth['isAuthenticated'](),controller[_0x30e0('0x3e')]);router[_0x30e0('0x3f')](_0x30e0('0xb'),auth[_0x30e0('0xc')](),controller[_0x30e0('0x40')]);router[_0x30e0('0x3f')](_0x30e0('0xe'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x30e0('0x3f')]('/:id/canned_answers',auth[_0x30e0('0xc')](),controller[_0x30e0('0x41')]);router['delete'](_0x30e0('0x1d'),auth['isAuthenticated'](),controller[_0x30e0('0x42')]);module['exports']=router; \ No newline at end of file +var _0xdaf4=['/:id/system_avatar','/:id/interactions','getInteractions','/:id/snippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','post','/:id/canned_answers','addAnswer','root','%s-%s','now','originalname','/:id/logo','single','file','join','format','addAvatar','addCustomerAvatar','server/files/images/avatars/','notify','diskStorage','attachments','offline-chat','extname','replace','/:id/offline','any','offline','addInteraction','addApplications','addProactiveActions','/:id/users','put','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/avatar','getAvatar','/:id/customer_avatar'];(function(_0x1ac120,_0x3e7e45){var _0x19b703=function(_0x5f32cb){while(--_0x5f32cb){_0x1ac120['push'](_0x1ac120['shift']());}};_0x19b703(++_0x3e7e45);}(_0xdaf4,0xf8));var _0x4daf=function(_0x5a2285,_0x3212d1){_0x5a2285=_0x5a2285-0x0;var _0x48f6ed=_0xdaf4[_0x5a2285];return _0x48f6ed;};'use strict';var multer=require(_0x4daf('0x0'));var util=require('util');var path=require(_0x4daf('0x1'));var timeout=require(_0x4daf('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x4daf('0x3'));var auth=require(_0x4daf('0x4'));var interaction=require(_0x4daf('0x5'));var config=require(_0x4daf('0x6'));var controller=require(_0x4daf('0x7'));router[_0x4daf('0x8')]('/',auth[_0x4daf('0x9')](),controller[_0x4daf('0xa')]);router[_0x4daf('0x8')](_0x4daf('0xb'),auth[_0x4daf('0x9')](),controller[_0x4daf('0xc')]);router['get']('/:id',auth[_0x4daf('0x9')](),controller[_0x4daf('0xd')]);router['get'](_0x4daf('0xe'),auth[_0x4daf('0x9')](),controller[_0x4daf('0xf')]);router[_0x4daf('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x4daf('0x10')]);router[_0x4daf('0x8')]('/:id/logo',controller['getLogo']);router[_0x4daf('0x8')](_0x4daf('0x11'),controller[_0x4daf('0x12')]);router[_0x4daf('0x8')](_0x4daf('0x13'),controller['getCustomerAvatar']);router['get'](_0x4daf('0x14'),controller['getSystemAvatar']);router[_0x4daf('0x8')](_0x4daf('0x15'),auth[_0x4daf('0x9')](),controller[_0x4daf('0x16')]);router['get'](_0x4daf('0x17'),controller['getSnippet']);router['get'](_0x4daf('0x18'),auth['isAuthenticated'](),controller[_0x4daf('0x19')]);router[_0x4daf('0x8')](_0x4daf('0x1a'),auth[_0x4daf('0x9')](),controller[_0x4daf('0x1b')]);router[_0x4daf('0x8')](_0x4daf('0x1c'),controller[_0x4daf('0x1d')]);router[_0x4daf('0x8')](_0x4daf('0x1e'),auth[_0x4daf('0x9')](),controller['getOfflineMessages']);router[_0x4daf('0x8')]('/:id/users',auth[_0x4daf('0x9')](),controller['getAgents']);router[_0x4daf('0x1f')]('/',auth[_0x4daf('0x9')](),controller['create']);router['post'](_0x4daf('0xe'),auth[_0x4daf('0x9')](),controller['addDisposition']);router[_0x4daf('0x1f')](_0x4daf('0x20'),auth['isAuthenticated'](),controller[_0x4daf('0x21')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x32f9bc,_0x5d2b14,_0x3cc468){_0x3cc468(null,path['join'](config[_0x4daf('0x22')],'server/files/images/logos/'));},'filename':function(_0x28a352,_0x25df04,_0x265a29){_0x265a29(null,util['format'](_0x4daf('0x23'),Date[_0x4daf('0x24')](),_0x25df04[_0x4daf('0x25')]));}})});router[_0x4daf('0x1f')](_0x4daf('0x26'),upload[_0x4daf('0x27')](_0x4daf('0x28')),controller['addLogo']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x24ab87,_0xb57ed0,_0x2ba3fb){_0x2ba3fb(null,path[_0x4daf('0x29')](config[_0x4daf('0x22')],'server/files/images/avatars/'));},'filename':function(_0xc28c86,_0x63d87c,_0x8da64e){_0x8da64e(null,util[_0x4daf('0x2a')](_0x4daf('0x23'),Date[_0x4daf('0x24')](),_0x63d87c['originalname']));}})});router[_0x4daf('0x1f')](_0x4daf('0x11'),upload[_0x4daf('0x27')](_0x4daf('0x28')),controller[_0x4daf('0x2b')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5e80dc,_0x100af8,_0x17647f){_0x17647f(null,path[_0x4daf('0x29')](config[_0x4daf('0x22')],'server/files/images/avatars/'));},'filename':function(_0x5554c7,_0x5655f8,_0x249170){_0x249170(null,util[_0x4daf('0x2a')]('%s-%s',Date[_0x4daf('0x24')](),_0x5655f8[_0x4daf('0x25')]));}})});router['post']('/:id/customer_avatar',upload[_0x4daf('0x27')](_0x4daf('0x28')),controller[_0x4daf('0x2c')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5dffc3,_0x11a0a7,_0x17e027){_0x17e027(null,path[_0x4daf('0x29')](config['root'],_0x4daf('0x2d')));},'filename':function(_0x4fead3,_0x18e7b7,_0x17437f){_0x17437f(null,util[_0x4daf('0x2a')](_0x4daf('0x23'),Date[_0x4daf('0x24')](),_0x18e7b7[_0x4daf('0x25')]));}})});router[_0x4daf('0x1f')](_0x4daf('0x14'),upload['single'](_0x4daf('0x28')),controller['addSystemAvatar']);router[_0x4daf('0x1f')]('/:id/notify',controller[_0x4daf('0x2e')]);const offlineUploadMulter=multer({'storage':multer[_0x4daf('0x2f')]({'destination':function(_0x2880de,_0x3a1ccb,_0x13e541){const _0x2d3555=path['join'](config['root'],'server/files',_0x4daf('0x30'),_0x4daf('0x31'));fs_extra['ensureDir'](_0x2d3555,function(){_0x13e541(null,_0x2d3555);});},'filename':function(_0x1f78ca,_0x1384e4,_0xac8f06){const _0x86728e=_0x1384e4[_0x4daf('0x25')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x1411e9=path[_0x4daf('0x32')](_0x86728e);const _0x10b347=Date['now']()+'-'+_0x86728e[_0x4daf('0x33')](_0x1411e9,'')+_0x1411e9;_0xac8f06(null,_0x10b347);}})});router[_0x4daf('0x1f')](_0x4daf('0x34'),offlineUploadMulter[_0x4daf('0x35')](),controller[_0x4daf('0x36')]);router[_0x4daf('0x1f')](_0x4daf('0x15'),auth['isAuthenticated'](),controller[_0x4daf('0x37')]);router[_0x4daf('0x1f')](_0x4daf('0x18'),auth[_0x4daf('0x9')](),controller[_0x4daf('0x38')]);router[_0x4daf('0x1f')](_0x4daf('0x1a'),auth['isAuthenticated'](),controller[_0x4daf('0x39')]);router['post'](_0x4daf('0x3a'),auth[_0x4daf('0x9')](),controller['addAgents']);router[_0x4daf('0x3b')](_0x4daf('0x3c'),auth[_0x4daf('0x9')](),controller[_0x4daf('0x3d')]);router[_0x4daf('0x3e')]('/:id',auth[_0x4daf('0x9')](),controller[_0x4daf('0x3f')]);router[_0x4daf('0x3e')](_0x4daf('0xe'),auth['isAuthenticated'](),controller[_0x4daf('0x40')]);router[_0x4daf('0x3e')]('/:id/canned_answers',auth[_0x4daf('0x9')](),controller[_0x4daf('0x41')]);router[_0x4daf('0x3e')](_0x4daf('0x3a'),auth[_0x4daf('0x9')](),controller[_0x4daf('0x42')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 59a43cf..46a2d11 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 _0xfc17=['Google','sequelize','exports','STRING','ENUM'];(function(_0x36abfd,_0x32068a){var _0x14ab00=function(_0x79ee87){while(--_0x79ee87){_0x36abfd['push'](_0x36abfd['shift']());}};_0x14ab00(++_0x32068a);}(_0xfc17,0x1b4));var _0x7fc1=function(_0x5e5b9a,_0x26e6c1){_0x5e5b9a=_0x5e5b9a-0x0;var _0x38231a=_0xfc17[_0x5e5b9a];return _0x38231a;};'use strict';var Sequelize=require(_0x7fc1('0x0'));module[_0x7fc1('0x1')]={'name':{'type':Sequelize[_0x7fc1('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x7fc1('0x3')]('AmazonAWS',_0x7fc1('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x7fc1('0x2')]},'data2':{'type':Sequelize[_0x7fc1('0x2')]}}; \ No newline at end of file +var _0x0960=['Google','STRING','sequelize','exports','ENUM','AmazonAWS'];(function(_0x250c78,_0x25b838){var _0x44f07a=function(_0x599b41){while(--_0x599b41){_0x250c78['push'](_0x250c78['shift']());}};_0x44f07a(++_0x25b838);}(_0x0960,0xc2));var _0x0096=function(_0x55c3df,_0xa52b7){_0x55c3df=_0x55c3df-0x0;var _0x3b95c5=_0x0960[_0x55c3df];return _0x3b95c5;};'use strict';var Sequelize=require(_0x0096('0x0'));module[_0x0096('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x0096('0x2')](_0x0096('0x3'),_0x0096('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x0096('0x5')]},'data2':{'type':Sequelize[_0x0096('0x5')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index e6d43cf..b87dd50 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 _0x5f66=['update','catch','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','destroy','then','error','name','send','index','map','CloudProvider','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','find','create','body'];(function(_0x5e3898,_0x39f21a){var _0xd775f6=function(_0x4c6831){while(--_0x4c6831){_0x5e3898['push'](_0x5e3898['shift']());}};_0xd775f6(++_0x39f21a);}(_0x5f66,0x1a0));var _0x65f6=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x5f66[_0x2b4411];return _0x8e41ef;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x65f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65f6('0x1'));var rp=require(_0x65f6('0x2'));var moment=require(_0x65f6('0x3'));var BPromise=require(_0x65f6('0x4'));var Mustache=require(_0x65f6('0x5'));var util=require('util');var path=require(_0x65f6('0x6'));var sox=require('sox');var csv=require(_0x65f6('0x7'));var ejs=require(_0x65f6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x7'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var hardwareService=require(_0x65f6('0x11'));var logger=require('../../config/logger')(_0x65f6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x65f6('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x419819,_0x4862a5){_0x4862a5=_0x4862a5||0xcc;return function(_0x2f964a){if(_0x2f964a){return _0x419819[_0x65f6('0x14')](_0x4862a5);}return _0x419819[_0x65f6('0x15')](_0x4862a5)[_0x65f6('0x16')]();};}function respondWithResult(_0x369f96,_0x1d29fd){_0x1d29fd=_0x1d29fd||0xc8;return function(_0x44144b){if(_0x44144b){return _0x369f96[_0x65f6('0x15')](_0x1d29fd)[_0x65f6('0x17')](_0x44144b);}};}function respondWithFilteredResult(_0x3440af,_0x59154e){return function(_0x19b9ff){if(_0x19b9ff){var _0x49a913=typeof _0x59154e['offset']===_0x65f6('0x18')&&typeof _0x59154e[_0x65f6('0x19')]===_0x65f6('0x18');var _0x1c955c=_0x19b9ff[_0x65f6('0x1a')];var _0x1f974c=_0x49a913?0x0:_0x59154e[_0x65f6('0x1b')];var _0x18380e=_0x49a913?_0x19b9ff['count']:_0x59154e['offset']+_0x59154e[_0x65f6('0x19')];var _0x5b4055;if(_0x18380e>=_0x1c955c){_0x18380e=_0x1c955c;_0x5b4055=0xc8;}else{_0x5b4055=0xce;}_0x3440af['status'](_0x5b4055);return _0x3440af['set'](_0x65f6('0x1c'),_0x1f974c+'-'+_0x18380e+'/'+_0x1c955c)[_0x65f6('0x17')](_0x19b9ff);}return null;};}function patchUpdates(_0x5114a4){return function(_0x39e19f){try{jsonpatch[_0x65f6('0x1d')](_0x39e19f,_0x5114a4,!![]);}catch(_0xbee6a4){return BPromise[_0x65f6('0x1e')](_0xbee6a4);}return _0x39e19f[_0x65f6('0x1f')]();};}function saveUpdates(_0xc139c2,_0x581374){return function(_0x197a49){if(_0x197a49){return _0x197a49['update'](_0xc139c2)['then'](function(_0x212247){return _0x212247;});}return null;};}function removeEntity(_0xd173f4,_0x524e42){return function(_0x1eeaaa){if(_0x1eeaaa){return _0x1eeaaa[_0x65f6('0x20')]()[_0x65f6('0x21')](function(){_0xd173f4[_0x65f6('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9d7bb0,_0x59ea32){return function(_0x20a161){if(!_0x20a161){_0x9d7bb0['sendStatus'](0x194);}return _0x20a161;};}function handleError(_0x5cb131,_0x4fde2f){_0x4fde2f=_0x4fde2f||0x1f4;return function(_0x29abdb){logger[_0x65f6('0x22')](_0x29abdb['stack']);if(_0x29abdb[_0x65f6('0x23')]){delete _0x29abdb[_0x65f6('0x23')];}_0x5cb131['status'](_0x4fde2f)[_0x65f6('0x24')](_0x29abdb);};}exports[_0x65f6('0x25')]=function(_0x28d0df,_0x559330){var _0x4ac04b={},_0x488d36={},_0x266cfe={'count':0x0,'rows':[]};var _0x3c032f=_[_0x65f6('0x26')](db[_0x65f6('0x27')][_0x65f6('0x28')],function(_0x14a387){return{'name':_0x14a387[_0x65f6('0x29')],'type':_0x14a387['type']['key']};});_0x488d36[_0x65f6('0x2a')]=_[_0x65f6('0x26')](_0x3c032f,'name');_0x488d36['query']=_[_0x65f6('0x2b')](_0x28d0df[_0x65f6('0x2c')]);_0x488d36[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],_0x488d36[_0x65f6('0x2c')]);_0x4ac04b['attributes']=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],qs[_0x65f6('0x2f')](_0x28d0df['query'][_0x65f6('0x2f')]));_0x4ac04b[_0x65f6('0x30')]=_0x4ac04b[_0x65f6('0x30')][_0x65f6('0x31')]?_0x4ac04b[_0x65f6('0x30')]:_0x488d36[_0x65f6('0x2a')];if(!_0x28d0df['query'][_0x65f6('0x32')](_0x65f6('0x33'))){_0x4ac04b['limit']=qs[_0x65f6('0x19')](_0x28d0df['query'][_0x65f6('0x19')]);_0x4ac04b['offset']=qs[_0x65f6('0x1b')](_0x28d0df[_0x65f6('0x2c')]['offset']);}_0x4ac04b[_0x65f6('0x34')]=qs[_0x65f6('0x35')](_0x28d0df[_0x65f6('0x2c')]['sort']);_0x4ac04b['where']=qs[_0x65f6('0x2d')](_['pick'](_0x28d0df[_0x65f6('0x2c')],_0x488d36['filters']),_0x3c032f);if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]){_0x4ac04b['where']=_[_0x65f6('0x37')](_0x4ac04b['where'],{'$or':_['map'](_0x3c032f,function(_0x71b16b){if(_0x71b16b[_0x65f6('0x38')]!==_0x65f6('0x39')){var _0x313be5={};_0x313be5[_0x71b16b[_0x65f6('0x23')]]={'$like':'%'+_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]+'%'};return _0x313be5;}})});}_0x4ac04b=_[_0x65f6('0x37')]({},_0x4ac04b,_0x28d0df['options']);var _0x3aa254={'where':_0x4ac04b['where']};return db[_0x65f6('0x27')][_0x65f6('0x1a')](_0x3aa254)[_0x65f6('0x21')](function(_0x2ea7f7){_0x266cfe['count']=_0x2ea7f7;if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x4ac04b[_0x65f6('0x3b')]=[{'all':!![]}];}return db[_0x65f6('0x27')][_0x65f6('0x3c')](_0x4ac04b);})[_0x65f6('0x21')](function(_0xed4c96){_0x266cfe[_0x65f6('0x3d')]=_0xed4c96;return _0x266cfe;})[_0x65f6('0x21')](respondWithFilteredResult(_0x559330,_0x4ac04b))['catch'](handleError(_0x559330,null));};exports[_0x65f6('0x3e')]=function(_0x400ed2,_0x377ae5){var _0x181798={'raw':!![],'where':{'id':_0x400ed2[_0x65f6('0x3f')]['id']}},_0x83e2d9={};_0x83e2d9[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](db[_0x65f6('0x27')][_0x65f6('0x28')]);_0x83e2d9[_0x65f6('0x2c')]=_[_0x65f6('0x2b')](_0x400ed2[_0x65f6('0x2c')]);_0x83e2d9[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x83e2d9[_0x65f6('0x2a')],_0x83e2d9['query']);_0x181798[_0x65f6('0x30')]=_[_0x65f6('0x2e')](_0x83e2d9[_0x65f6('0x2a')],qs[_0x65f6('0x2f')](_0x400ed2['query'][_0x65f6('0x2f')]));_0x181798[_0x65f6('0x30')]=_0x181798[_0x65f6('0x30')]['length']?_0x181798[_0x65f6('0x30')]:_0x83e2d9[_0x65f6('0x2a')];if(_0x400ed2[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x181798['include']=[{'all':!![]}];}_0x181798=_[_0x65f6('0x37')]({},_0x181798,_0x400ed2['options']);return db[_0x65f6('0x27')][_0x65f6('0x40')](_0x181798)['then'](handleEntityNotFound(_0x377ae5,null))[_0x65f6('0x21')](respondWithResult(_0x377ae5,null))['catch'](handleError(_0x377ae5,null));};exports[_0x65f6('0x41')]=function(_0x4d9b76,_0x2d1706){return db[_0x65f6('0x27')][_0x65f6('0x41')](_0x4d9b76[_0x65f6('0x42')],{})['then'](respondWithResult(_0x2d1706,0xc9))['catch'](handleError(_0x2d1706,null));};exports[_0x65f6('0x43')]=function(_0x15d3ba,_0x3b647a){if(_0x15d3ba[_0x65f6('0x42')]['id']){delete _0x15d3ba[_0x65f6('0x42')]['id'];}return db[_0x65f6('0x27')][_0x65f6('0x40')]({'where':{'id':_0x15d3ba[_0x65f6('0x3f')]['id']}})[_0x65f6('0x21')](handleEntityNotFound(_0x3b647a,null))['then'](saveUpdates(_0x15d3ba[_0x65f6('0x42')],null))[_0x65f6('0x21')](respondWithResult(_0x3b647a,null))[_0x65f6('0x44')](handleError(_0x3b647a,null));};exports['destroy']=function(_0x47e749,_0x42d453){return db['CloudProvider'][_0x65f6('0x40')]({'where':{'id':_0x47e749[_0x65f6('0x3f')]['id']}})['then'](handleEntityNotFound(_0x42d453,null))[_0x65f6('0x21')](removeEntity(_0x42d453,null))['catch'](handleError(_0x42d453,null));}; \ No newline at end of file +var _0x7a54=['offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','CloudProvider','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','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'];(function(_0x55cfc1,_0x3c5de5){var _0x4b6119=function(_0x2654c0){while(--_0x2654c0){_0x55cfc1['push'](_0x55cfc1['shift']());}};_0x4b6119(++_0x3c5de5);}(_0x7a54,0x106));var _0x47a5=function(_0x1d90a2,_0x4021ca){_0x1d90a2=_0x1d90a2-0x0;var _0x35bba2=_0x7a54[_0x1d90a2];return _0x35bba2;};'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['CloudProvider'][_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['CloudProvider']['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['CloudProvider']['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('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 94d1138..ae48640 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 _0xb179=['path','../../config/environment','exports','cloud_providers','util','../../config/logger','api','bluebird','request-promise'];(function(_0x2f6d94,_0x43f3f7){var _0x9e4c3b=function(_0x40737e){while(--_0x40737e){_0x2f6d94['push'](_0x2f6d94['shift']());}};_0x9e4c3b(++_0x43f3f7);}(_0xb179,0x148));var _0x9b17=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xb179[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var util=require(_0x9b17('0x0'));var logger=require(_0x9b17('0x1'))(_0x9b17('0x2'));var moment=require('moment');var BPromise=require(_0x9b17('0x3'));var rp=require(_0x9b17('0x4'));var fs=require('fs');var path=require(_0x9b17('0x5'));var rimraf=require('rimraf');var config=require(_0x9b17('0x6'));var attributes=require('./cloudProvider.attributes');module[_0x9b17('0x7')]=function(_0x51e093,_0x558150){return _0x51e093['define']('CloudProvider',attributes,{'tableName':_0x9b17('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5ae3=['../../config/logger','api','bluebird','request-promise','path','rimraf','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5ae3,0x11e));var _0x35ae=function(_0x497ecd,_0x7115ab){_0x497ecd=_0x497ecd-0x0;var _0x2bed21=_0x5ae3[_0x497ecd];return _0x2bed21;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x35ae('0x0'))(_0x35ae('0x1'));var moment=require('moment');var BPromise=require(_0x35ae('0x2'));var rp=require(_0x35ae('0x3'));var fs=require('fs');var path=require(_0x35ae('0x4'));var rimraf=require(_0x35ae('0x5'));var config=require('../../config/environment');var attributes=require(_0x35ae('0x6'));module[_0x35ae('0x7')]=function(_0xe36b7b,_0x3abea4){return _0xe36b7b[_0x35ae('0x8')](_0x35ae('0x9'),attributes,{'tableName':_0x35ae('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index ed54c4f..68f1d03 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 _0xbb35=['CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','CloudProvider,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x5d8212,_0x34cf7f){var _0x4f8055=function(_0x1bfee4){while(--_0x1bfee4){_0x5d8212['push'](_0x5d8212['shift']());}};_0x4f8055(++_0x34cf7f);}(_0xbb35,0x1d3));var _0x5bb3=function(_0x1a7358,_0x3ec9dd){_0x1a7358=_0x1a7358-0x0;var _0x199718=_0xbb35[_0x1a7358];return _0x199718;};'use strict';var _=require('lodash');var util=require(_0x5bb3('0x0'));var moment=require(_0x5bb3('0x1'));var BPromise=require(_0x5bb3('0x2'));var rs=require(_0x5bb3('0x3'));var fs=require('fs');var Redis=require(_0x5bb3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5bb3('0x5'));var logger=require(_0x5bb3('0x6'))(_0x5bb3('0x7'));var config=require(_0x5bb3('0x8'));var jayson=require(_0x5bb3('0x9'));var client=jayson[_0x5bb3('0xa')][_0x5bb3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbd7a90,_0xe7fb91,_0x4f59cb){return new BPromise(function(_0x14986f,_0x11d7df){return client[_0x5bb3('0xc')](_0xbd7a90,_0x4f59cb)[_0x5bb3('0xd')](function(_0x534872){logger[_0x5bb3('0xe')]('CloudProvider,\x20%s,\x20%s',_0xe7fb91,_0x5bb3('0xf'));logger['debug'](_0x5bb3('0x10'),_0xe7fb91,_0x5bb3('0xf'),JSON[_0x5bb3('0x11')](_0x534872));if(_0x534872[_0x5bb3('0x12')]){if(_0x534872[_0x5bb3('0x12')]['code']===0x1f4){logger[_0x5bb3('0x12')](_0x5bb3('0x13'),_0xe7fb91,_0x534872[_0x5bb3('0x12')]['message']);return _0x11d7df(_0x534872[_0x5bb3('0x12')][_0x5bb3('0x14')]);}logger[_0x5bb3('0x12')](_0x5bb3('0x13'),_0xe7fb91,_0x534872[_0x5bb3('0x12')][_0x5bb3('0x14')]);return _0x14986f(_0x534872[_0x5bb3('0x12')][_0x5bb3('0x14')]);}else{logger['info']('CloudProvider,\x20%s,\x20%s',_0xe7fb91,'request\x20sent');_0x14986f(_0x534872[_0x5bb3('0x15')][_0x5bb3('0x14')]);}})[_0x5bb3('0x16')](function(_0x1092df){logger[_0x5bb3('0x12')](_0x5bb3('0x13'),_0xe7fb91,_0x1092df);_0x11d7df(_0x1092df);});});} \ No newline at end of file +var _0xe8e8=['lodash','util','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','debug','CloudProvider,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xe8e8,0xc6));var _0x8e8e=function(_0xad4f90,_0xa40747){_0xad4f90=_0xad4f90-0x0;var _0x32b0f9=_0xe8e8[_0xad4f90];return _0x32b0f9;};'use strict';var _=require(_0x8e8e('0x0'));var util=require(_0x8e8e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8e8e('0x2'));var fs=require('fs');var Redis=require(_0x8e8e('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8e8e('0x4'))('rpc');var config=require(_0x8e8e('0x5'));var jayson=require(_0x8e8e('0x6'));var client=jayson[_0x8e8e('0x7')][_0x8e8e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x559147,_0x2d5ad4,_0x4edd6c){return new BPromise(function(_0x21703a,_0x35e125){return client[_0x8e8e('0x9')](_0x559147,_0x4edd6c)[_0x8e8e('0xa')](function(_0x40be2d){logger[_0x8e8e('0xb')](_0x8e8e('0xc'),_0x2d5ad4,'request\x20sent');logger[_0x8e8e('0xd')](_0x8e8e('0xe'),_0x2d5ad4,_0x8e8e('0xf'),JSON[_0x8e8e('0x10')](_0x40be2d));if(_0x40be2d['error']){if(_0x40be2d[_0x8e8e('0x11')][_0x8e8e('0x12')]===0x1f4){logger[_0x8e8e('0x11')](_0x8e8e('0xc'),_0x2d5ad4,_0x40be2d[_0x8e8e('0x11')][_0x8e8e('0x13')]);return _0x35e125(_0x40be2d[_0x8e8e('0x11')][_0x8e8e('0x13')]);}logger[_0x8e8e('0x11')](_0x8e8e('0xc'),_0x2d5ad4,_0x40be2d['error'][_0x8e8e('0x13')]);return _0x21703a(_0x40be2d[_0x8e8e('0x11')]['message']);}else{logger[_0x8e8e('0xb')](_0x8e8e('0xc'),_0x2d5ad4,'request\x20sent');_0x21703a(_0x40be2d[_0x8e8e('0x14')][_0x8e8e('0x13')]);}})[_0x8e8e('0x15')](function(_0x3b958a){logger[_0x8e8e('0x11')](_0x8e8e('0xc'),_0x2d5ad4,_0x3b958a);_0x35e125(_0x3b958a);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 8d9ba08..fbd65ba 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 _0x86a8=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cloudProvider.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x2a8f04,_0x11bf25){var _0x50af8b=function(_0x2366c6){while(--_0x2366c6){_0x2a8f04['push'](_0x2a8f04['shift']());}};_0x50af8b(++_0x11bf25);}(_0x86a8,0xc0));var _0x886a=function(_0x24334e,_0x1bfca5){_0x24334e=_0x24334e-0x0;var _0x4eb691=_0x86a8[_0x24334e];return _0x4eb691;};'use strict';var multer=require(_0x886a('0x0'));var util=require(_0x886a('0x1'));var path=require(_0x886a('0x2'));var timeout=require(_0x886a('0x3'));var express=require(_0x886a('0x4'));var router=express[_0x886a('0x5')]();var fs_extra=require(_0x886a('0x6'));var auth=require(_0x886a('0x7'));var interaction=require(_0x886a('0x8'));var config=require(_0x886a('0x9'));var controller=require(_0x886a('0xa'));router[_0x886a('0xb')]('/',auth[_0x886a('0xc')](),controller[_0x886a('0xd')]);router[_0x886a('0xb')](_0x886a('0xe'),auth[_0x886a('0xc')](),controller[_0x886a('0xf')]);router[_0x886a('0x10')]('/',auth[_0x886a('0xc')](),controller[_0x886a('0x11')]);router[_0x886a('0x12')](_0x886a('0xe'),auth[_0x886a('0xc')](),controller[_0x886a('0x13')]);router[_0x886a('0x14')](_0x886a('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x886a('0x15')]=router; \ No newline at end of file +var _0xe9f0=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0xd4e53c,_0x116395){var _0x2f1381=function(_0xe299b7){while(--_0xe299b7){_0xd4e53c['push'](_0xd4e53c['shift']());}};_0x2f1381(++_0x116395);}(_0xe9f0,0x1ea));var _0x0e9f=function(_0x232456,_0x1ff422){_0x232456=_0x232456-0x0;var _0x5c0763=_0xe9f0[_0x232456];return _0x5c0763;};'use strict';var multer=require(_0x0e9f('0x0'));var util=require(_0x0e9f('0x1'));var path=require(_0x0e9f('0x2'));var timeout=require(_0x0e9f('0x3'));var express=require(_0x0e9f('0x4'));var router=express[_0x0e9f('0x5')]();var fs_extra=require(_0x0e9f('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x0e9f('0x7'));var config=require(_0x0e9f('0x8'));var controller=require('./cloudProvider.controller');router[_0x0e9f('0x9')]('/',auth[_0x0e9f('0xa')](),controller['index']);router[_0x0e9f('0x9')](_0x0e9f('0xb'),auth[_0x0e9f('0xa')](),controller[_0x0e9f('0xc')]);router[_0x0e9f('0xd')]('/',auth['isAuthenticated'](),controller[_0x0e9f('0xe')]);router[_0x0e9f('0xf')](_0x0e9f('0xb'),auth['isAuthenticated'](),controller[_0x0e9f('0x10')]);router['delete'](_0x0e9f('0xb'),auth[_0x0e9f('0xa')](),controller[_0x0e9f('0x11')]);module[_0x0e9f('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 9623993..6b5cdc8 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 _0x1629=['sequelize','exports','STRING','name'];(function(_0x4e0e9d,_0x248845){var _0x3b4f3a=function(_0x45fdf7){while(--_0x45fdf7){_0x4e0e9d['push'](_0x4e0e9d['shift']());}};_0x3b4f3a(++_0x248845);}(_0x1629,0x1d8));var _0x9162=function(_0x2841e1,_0x55d931){_0x2841e1=_0x2841e1-0x0;var _0x3d6eff=_0x1629[_0x2841e1];return _0x3d6eff;};'use strict';var Sequelize=require(_0x9162('0x0'));module[_0x9162('0x1')]={'name':{'type':Sequelize[_0x9162('0x2')],'unique':_0x9162('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0x9162('0x2')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x9162('0x2')]},'type':{'type':Sequelize[_0x9162('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x9162('0x2')]},'country':{'type':Sequelize[_0x9162('0x2')]},'email':{'type':Sequelize[_0x9162('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x9162('0x2')]},'sStreet':{'type':Sequelize[_0x9162('0x2')]},'sPostalCode':{'type':Sequelize[_0x9162('0x2')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5aa7=['STRING','sequelize','exports','name'];(function(_0x3c4f1f,_0x20d3ec){var _0x19cb69=function(_0x2e04bc){while(--_0x2e04bc){_0x3c4f1f['push'](_0x3c4f1f['shift']());}};_0x19cb69(++_0x20d3ec);}(_0x5aa7,0x131));var _0x75aa=function(_0x549c5d,_0x25628c){_0x549c5d=_0x549c5d-0x0;var _0x4707d0=_0x5aa7[_0x549c5d];return _0x4707d0;};'use strict';var Sequelize=require(_0x75aa('0x0'));module[_0x75aa('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x75aa('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x75aa('0x3')]},'companyId':{'type':Sequelize[_0x75aa('0x3')]},'website':{'type':Sequelize[_0x75aa('0x3')]},'phone':{'type':Sequelize[_0x75aa('0x3')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x75aa('0x3')]},'street':{'type':Sequelize[_0x75aa('0x3')]},'postalCode':{'type':Sequelize[_0x75aa('0x3')]},'city':{'type':Sequelize[_0x75aa('0x3')]},'country':{'type':Sequelize[_0x75aa('0x3')]},'email':{'type':Sequelize[_0x75aa('0x3')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x75aa('0x3')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x75aa('0x3')]},'sCity':{'type':Sequelize[_0x75aa('0x3')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x75aa('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index f09cb17..1ea9cda 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 _0xab5b=['save','destroy','get','Companies','then','error','stack','name','send','index','CmCompany','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','merge','map','filter','options','include','rows','catch','show','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','CmContact','ids','omit','getContacts','findOne','sort','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','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','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','reject'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xab5b,0x190));var _0xbab5=function(_0x3243fb,_0x11222c){_0x3243fb=_0x3243fb-0x0;var _0x551362=_0xab5b[_0x3243fb];return _0x551362;};'use strict';var emlformat=require(_0xbab5('0x0'));var rimraf=require(_0xbab5('0x1'));var zipdir=require(_0xbab5('0x2'));var jsonpatch=require(_0xbab5('0x3'));var rp=require(_0xbab5('0x4'));var moment=require(_0xbab5('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbab5('0x6'));var path=require(_0xbab5('0x7'));var sox=require(_0xbab5('0x8'));var csv=require('to-csv');var ejs=require(_0xbab5('0x9'));var fs=require('fs');var fs_extra=require(_0xbab5('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xbab5('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xbab5('0xc'));var querystring=require(_0xbab5('0xd'));var Papa=require(_0xbab5('0xe'));var Redis=require('ioredis');var authService=require(_0xbab5('0xf'));var qs=require(_0xbab5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbab5('0x11'));var logger=require(_0xbab5('0x12'))(_0xbab5('0x13'));var utils=require(_0xbab5('0x14'));var config=require(_0xbab5('0x15'));var licenseUtil=require(_0xbab5('0x16'));var db=require(_0xbab5('0x17'))['db'];function respondWithStatusCode(_0x3cae1a,_0x183c9a){_0x183c9a=_0x183c9a||0xcc;return function(_0x7a1d66){if(_0x7a1d66){return _0x3cae1a[_0xbab5('0x18')](_0x183c9a);}return _0x3cae1a[_0xbab5('0x19')](_0x183c9a)[_0xbab5('0x1a')]();};}function respondWithResult(_0x1967f1,_0x4a09ea){_0x4a09ea=_0x4a09ea||0xc8;return function(_0x3d35a7){if(_0x3d35a7){return _0x1967f1['status'](_0x4a09ea)[_0xbab5('0x1b')](_0x3d35a7);}};}function respondWithFilteredResult(_0x2d17c4,_0xe34d67){return function(_0x165005){if(_0x165005){var _0x239306=typeof _0xe34d67['offset']===_0xbab5('0x1c')&&typeof _0xe34d67['limit']===_0xbab5('0x1c');var _0x3ace05=_0x165005[_0xbab5('0x1d')];var _0x227514=_0x239306?0x0:_0xe34d67[_0xbab5('0x1e')];var _0x137d59=_0x239306?_0x165005[_0xbab5('0x1d')]:_0xe34d67['offset']+_0xe34d67[_0xbab5('0x1f')];var _0x2fce37;if(_0x137d59>=_0x3ace05){_0x137d59=_0x3ace05;_0x2fce37=0xc8;}else{_0x2fce37=0xce;}_0x2d17c4[_0xbab5('0x19')](_0x2fce37);return _0x2d17c4[_0xbab5('0x20')](_0xbab5('0x21'),_0x227514+'-'+_0x137d59+'/'+_0x3ace05)[_0xbab5('0x1b')](_0x165005);}return null;};}function patchUpdates(_0x2b5a74){return function(_0x33d0ab){try{jsonpatch['apply'](_0x33d0ab,_0x2b5a74,!![]);}catch(_0x5b3450){return BPromise[_0xbab5('0x22')](_0x5b3450);}return _0x33d0ab[_0xbab5('0x23')]();};}function saveUpdates(_0xaf07ce,_0x4934b2){return function(_0x2453f6){if(_0x2453f6){return _0x2453f6['update'](_0xaf07ce)['then'](function(_0x242a44){return _0x242a44;});}return null;};}function removeEntity(_0x1b1102,_0x3b5354){return function(_0x4088e1){if(_0x4088e1){return _0x4088e1[_0xbab5('0x24')]()['then'](function(){var _0x6dbd94=_0x4088e1[_0xbab5('0x25')]({'plain':!![]});var _0xc3f1f4=_0xbab5('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0xc3f1f4,'resourceId':_0x6dbd94['id']}})[_0xbab5('0x27')](function(){return _0x4088e1;});})[_0xbab5('0x27')](function(){_0x1b1102[_0xbab5('0x19')](0xcc)[_0xbab5('0x1a')]();});}};}function handleEntityNotFound(_0x5c9021,_0x268101){return function(_0x39aaeb){if(!_0x39aaeb){_0x5c9021[_0xbab5('0x18')](0x194);}return _0x39aaeb;};}function handleError(_0x1c0163,_0x2ebbf1){_0x2ebbf1=_0x2ebbf1||0x1f4;return function(_0x4f1278){logger[_0xbab5('0x28')](_0x4f1278[_0xbab5('0x29')]);if(_0x4f1278[_0xbab5('0x2a')]){delete _0x4f1278[_0xbab5('0x2a')];}_0x1c0163[_0xbab5('0x19')](_0x2ebbf1)[_0xbab5('0x2b')](_0x4f1278);};}exports[_0xbab5('0x2c')]=function(_0x2c8256,_0x1aaac9){var _0x5a8e4e={},_0xbec9a6={},_0x1e5442={'count':0x0,'rows':[]};return db[_0xbab5('0x2d')]['describe']()['then'](function(_0x1ecd8d){_0xbec9a6[_0xbab5('0x2e')]=_[_0xbab5('0x2f')](_0x1ecd8d);_0xbec9a6['query']=_[_0xbab5('0x2f')](_0x2c8256['query']);_0xbec9a6[_0xbab5('0x30')]=_[_0xbab5('0x31')](_0xbec9a6[_0xbab5('0x2e')],_0xbec9a6[_0xbab5('0x32')]);_0x5a8e4e['attributes']=_['intersection'](_0xbec9a6[_0xbab5('0x2e')],qs[_0xbab5('0x33')](_0x2c8256['query']['fields']));_0x5a8e4e[_0xbab5('0x34')]=_0x5a8e4e[_0xbab5('0x34')][_0xbab5('0x35')]?_0x5a8e4e[_0xbab5('0x34')]:_0xbec9a6[_0xbab5('0x2e')];if(!_0x2c8256[_0xbab5('0x32')][_0xbab5('0x36')](_0xbab5('0x37'))){_0x5a8e4e[_0xbab5('0x1f')]=qs[_0xbab5('0x1f')](_0x2c8256['query'][_0xbab5('0x1f')]);_0x5a8e4e[_0xbab5('0x1e')]=qs[_0xbab5('0x1e')](_0x2c8256[_0xbab5('0x32')][_0xbab5('0x1e')]);}_0x5a8e4e[_0xbab5('0x38')]=qs['sort'](_0x2c8256['query']['sort']);_0x5a8e4e[_0xbab5('0x39')]=qs['filters'](_[_0xbab5('0x3a')](_0x2c8256[_0xbab5('0x32')],_0xbec9a6['filters']),_0x1ecd8d);if(_0x2c8256['query']['filter']){_0x5a8e4e[_0xbab5('0x39')]=_[_0xbab5('0x3b')](_0x5a8e4e[_0xbab5('0x39')],{'$or':_[_0xbab5('0x3c')](_0x5a8e4e[_0xbab5('0x34')],function(_0x2c188f){var _0x39e550={};_0x39e550[_0x2c188f]={'$like':'%'+_0x2c8256[_0xbab5('0x32')][_0xbab5('0x3d')]+'%'};return _0x39e550;})});}_0x5a8e4e=_[_0xbab5('0x3b')]({},_0x5a8e4e,_0x2c8256[_0xbab5('0x3e')]);var _0x4bf511={'where':_0x5a8e4e[_0xbab5('0x39')]};return db['CmCompany'][_0xbab5('0x1d')](_0x4bf511)[_0xbab5('0x27')](function(_0x4c1a2c){_0x1e5442[_0xbab5('0x1d')]=_0x4c1a2c;if(_0x2c8256['query']['includeAll']){_0x5a8e4e[_0xbab5('0x3f')]=[{'all':!![]}];}return db['CmCompany']['findAll'](_0x5a8e4e);})[_0xbab5('0x27')](function(_0x369154){_0x1e5442[_0xbab5('0x40')]=_0x369154;return _0x1e5442;})[_0xbab5('0x27')](respondWithFilteredResult(_0x1aaac9,_0x5a8e4e))[_0xbab5('0x41')](handleError(_0x1aaac9,null));})['catch'](handleError(_0x1aaac9,null));};exports[_0xbab5('0x42')]=function(_0x38aec9,_0x5205b8){var _0x1febbf={'raw':![],'where':{'id':_0x38aec9['params']['id']}},_0x8c2f39={};_0x8c2f39[_0xbab5('0x2e')]=_[_0xbab5('0x2f')](db[_0xbab5('0x2d')][_0xbab5('0x43')]);_0x8c2f39[_0xbab5('0x32')]=_[_0xbab5('0x2f')](_0x38aec9[_0xbab5('0x32')]);_0x8c2f39[_0xbab5('0x30')]=_[_0xbab5('0x31')](_0x8c2f39[_0xbab5('0x2e')],_0x8c2f39['query']);_0x1febbf[_0xbab5('0x34')]=_[_0xbab5('0x31')](_0x8c2f39['model'],qs[_0xbab5('0x33')](_0x38aec9['query'][_0xbab5('0x33')]));_0x1febbf[_0xbab5('0x34')]=_0x1febbf[_0xbab5('0x34')]['length']?_0x1febbf[_0xbab5('0x34')]:_0x8c2f39['model'];if(_0x38aec9[_0xbab5('0x32')]['includeAll']){_0x1febbf[_0xbab5('0x3f')]=[{'all':!![]}];}_0x1febbf=_[_0xbab5('0x3b')]({},_0x1febbf,_0x38aec9[_0xbab5('0x3e')]);return db[_0xbab5('0x2d')]['find'](_0x1febbf)[_0xbab5('0x27')](handleEntityNotFound(_0x5205b8,null))[_0xbab5('0x27')](respondWithResult(_0x5205b8,null))[_0xbab5('0x41')](handleError(_0x5205b8,null));};exports[_0xbab5('0x44')]=function(_0x200337,_0x256db6){return db['CmCompany'][_0xbab5('0x44')](_0x200337[_0xbab5('0x45')],{})[_0xbab5('0x27')](function(_0x113b63){var _0x5878a6=_0x200337[_0xbab5('0x46')][_0xbab5('0x25')]({'plain':!![]});if(!_0x5878a6)throw new Error(_0xbab5('0x47'));if(_0x5878a6[_0xbab5('0x48')]==='user'){var _0x4def63=_0x113b63[_0xbab5('0x25')]({'plain':!![]});var _0x26bb4f=_0xbab5('0x26');return db[_0xbab5('0x49')][_0xbab5('0x4a')]({'where':{'name':_0x26bb4f,'userProfileId':_0x5878a6[_0xbab5('0x4b')]},'raw':!![]})[_0xbab5('0x27')](function(_0x4b3552){if(_0x4b3552&&_0x4b3552[_0xbab5('0x4c')]===0x0){return db[_0xbab5('0x4d')][_0xbab5('0x44')]({'name':_0x4def63['name'],'resourceId':_0x4def63['id'],'type':_0x4b3552[_0xbab5('0x2a')],'sectionId':_0x4b3552['id']},{})[_0xbab5('0x27')](function(){return _0x113b63;});}else{return _0x113b63;}})[_0xbab5('0x41')](function(_0x14b654){logger[_0xbab5('0x28')](_0xbab5('0x4e'),_0x14b654);throw _0x14b654;});}return _0x113b63;})['then'](respondWithResult(_0x256db6,0xc9))[_0xbab5('0x41')](handleError(_0x256db6,null));};exports[_0xbab5('0x4f')]=function(_0x4633b8,_0x13b739){if(_0x4633b8[_0xbab5('0x45')]['id']){delete _0x4633b8['body']['id'];}return db[_0xbab5('0x2d')]['find']({'where':{'id':_0x4633b8[_0xbab5('0x50')]['id']}})[_0xbab5('0x27')](handleEntityNotFound(_0x13b739,null))['then'](saveUpdates(_0x4633b8[_0xbab5('0x45')],null))['then'](respondWithResult(_0x13b739,null))[_0xbab5('0x41')](handleError(_0x13b739,null));};exports[_0xbab5('0x24')]=function(_0x174329,_0x5fd4e5){return db['CmCompany']['find']({'where':{'id':_0x174329[_0xbab5('0x50')]['id']}})['then'](handleEntityNotFound(_0x5fd4e5,null))[_0xbab5('0x27')](removeEntity(_0x5fd4e5,null))[_0xbab5('0x41')](handleError(_0x5fd4e5,null));};exports['describe']=function(_0x443eeb,_0x49fd38){return db[_0xbab5('0x2d')]['describe']()[_0xbab5('0x27')](respondWithResult(_0x49fd38,null))['catch'](handleError(_0x49fd38,null));};exports['addContacts']=function(_0x5f18bf,_0x1dd640,_0x3dab15){return db[_0xbab5('0x51')]['find']({'where':{'id':_0x5f18bf[_0xbab5('0x50')]['id']}})['then'](handleEntityNotFound(_0x1dd640,null))[_0xbab5('0x27')](function(_0xf138){if(_0xf138){return _0xf138['addContacts'](_0x5f18bf[_0xbab5('0x45')][_0xbab5('0x52')],_[_0xbab5('0x53')](_0x5f18bf[_0xbab5('0x45')],[_0xbab5('0x52'),'id'])||{});}})[_0xbab5('0x27')](respondWithResult(_0x1dd640,null))[_0xbab5('0x41')](handleError(_0x1dd640,null));};exports[_0xbab5('0x54')]=function(_0x4a2184,_0xa47a32,_0x346273){var _0x258496={};var _0x1b3944={};var _0x111211;var _0x345273;return db[_0xbab5('0x2d')][_0xbab5('0x55')]({'where':{'id':_0x4a2184['params']['id']}})['then'](handleEntityNotFound(_0xa47a32,null))[_0xbab5('0x27')](function(_0x515611){if(_0x515611){_0x111211=_0x515611;_0x1b3944[_0xbab5('0x2e')]=_[_0xbab5('0x2f')](db[_0xbab5('0x51')]['rawAttributes']);_0x1b3944[_0xbab5('0x32')]=_['keys'](_0x4a2184['query']);_0x1b3944[_0xbab5('0x30')]=_[_0xbab5('0x31')](_0x1b3944[_0xbab5('0x2e')],_0x1b3944[_0xbab5('0x32')]);_0x258496['attributes']=_['intersection'](_0x1b3944[_0xbab5('0x2e')],qs[_0xbab5('0x33')](_0x4a2184[_0xbab5('0x32')]['fields']));_0x258496[_0xbab5('0x34')]=_0x258496['attributes'][_0xbab5('0x35')]?_0x258496[_0xbab5('0x34')]:_0x1b3944[_0xbab5('0x2e')];_0x258496[_0xbab5('0x38')]=qs[_0xbab5('0x56')](_0x4a2184['query'][_0xbab5('0x56')]);_0x258496[_0xbab5('0x39')]=qs[_0xbab5('0x30')](_['pick'](_0x4a2184[_0xbab5('0x32')],_0x1b3944['filters']));if(_0x4a2184['query'][_0xbab5('0x3d')]){_0x258496[_0xbab5('0x39')]=_[_0xbab5('0x3b')](_0x258496[_0xbab5('0x39')],{'$or':_['map'](_0x258496['attributes'],function(_0x5511df){var _0x4e0343={};_0x4e0343[_0x5511df]={'$like':'%'+_0x4a2184[_0xbab5('0x32')][_0xbab5('0x3d')]+'%'};return _0x4e0343;})});}_0x258496=_[_0xbab5('0x3b')]({},_0x258496,_0x4a2184[_0xbab5('0x3e')]);return _0x111211[_0xbab5('0x54')](_0x258496);}})[_0xbab5('0x27')](function(_0x2bef76){if(_0x2bef76){_0x345273=_0x2bef76[_0xbab5('0x35')];if(!_0x4a2184['query']['hasOwnProperty'](_0xbab5('0x37'))){_0x258496[_0xbab5('0x1f')]=qs[_0xbab5('0x1f')](_0x4a2184[_0xbab5('0x32')][_0xbab5('0x1f')]);_0x258496[_0xbab5('0x1e')]=qs[_0xbab5('0x1e')](_0x4a2184[_0xbab5('0x32')][_0xbab5('0x1e')]);}return _0x111211[_0xbab5('0x54')](_0x258496);}})[_0xbab5('0x27')](function(_0x46c5bd){if(_0x46c5bd){return _0x46c5bd?{'count':_0x345273,'rows':_0x46c5bd}:null;}})[_0xbab5('0x27')](respondWithResult(_0xa47a32,null))[_0xbab5('0x41')](handleError(_0xa47a32,null));}; \ No newline at end of file +var _0x601c=['getContacts','eml-format','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','Content-Range','apply','update','then','get','Companies','UserProfileResource','destroy','sendStatus','error','name','send','index','CmCompany','describe','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','map','options','includeAll','findAll','catch','show','params','rawAttributes','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addContacts','CmContact','omit','ids'];(function(_0x587137,_0x2c22f6){var _0x59985e=function(_0x5ea780){while(--_0x5ea780){_0x587137['push'](_0x587137['shift']());}};_0x59985e(++_0x2c22f6);}(_0x601c,0x1f3));var _0xc601=function(_0x21d673,_0x4b2b4c){_0x21d673=_0x21d673-0x0;var _0xd1caad=_0x601c[_0x21d673];return _0xd1caad;};'use strict';var emlformat=require(_0xc601('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc601('0x1'));var jsonpatch=require(_0xc601('0x2'));var rp=require('request-promise');var moment=require(_0xc601('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc601('0x4'));var util=require(_0xc601('0x5'));var path=require('path');var sox=require(_0xc601('0x6'));var csv=require(_0xc601('0x7'));var ejs=require(_0xc601('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc601('0x9'));var squel=require(_0xc601('0xa'));var crypto=require(_0xc601('0xb'));var jsforce=require(_0xc601('0xc'));var deskjs=require(_0xc601('0xd'));var toCsv=require(_0xc601('0x7'));var querystring=require(_0xc601('0xe'));var Papa=require(_0xc601('0xf'));var Redis=require('ioredis');var authService=require(_0xc601('0x10'));var qs=require(_0xc601('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc601('0x12'));var logger=require(_0xc601('0x13'))(_0xc601('0x14'));var utils=require('../../config/utils');var config=require(_0xc601('0x15'));var licenseUtil=require(_0xc601('0x16'));var db=require(_0xc601('0x17'))['db'];function respondWithStatusCode(_0x1f5bbb,_0x128048){_0x128048=_0x128048||0xcc;return function(_0x366da0){if(_0x366da0){return _0x1f5bbb['sendStatus'](_0x128048);}return _0x1f5bbb[_0xc601('0x18')](_0x128048)[_0xc601('0x19')]();};}function respondWithResult(_0x290254,_0x25bbab){_0x25bbab=_0x25bbab||0xc8;return function(_0x5aeefb){if(_0x5aeefb){return _0x290254[_0xc601('0x18')](_0x25bbab)[_0xc601('0x1a')](_0x5aeefb);}};}function respondWithFilteredResult(_0x25cf80,_0x4d1b66){return function(_0x118789){if(_0x118789){var _0x46300b=typeof _0x4d1b66[_0xc601('0x1b')]===_0xc601('0x1c')&&typeof _0x4d1b66['limit']==='undefined';var _0x159cc8=_0x118789[_0xc601('0x1d')];var _0x3f6822=_0x46300b?0x0:_0x4d1b66[_0xc601('0x1b')];var _0x3138f1=_0x46300b?_0x118789['count']:_0x4d1b66[_0xc601('0x1b')]+_0x4d1b66['limit'];var _0x533b8d;if(_0x3138f1>=_0x159cc8){_0x3138f1=_0x159cc8;_0x533b8d=0xc8;}else{_0x533b8d=0xce;}_0x25cf80['status'](_0x533b8d);return _0x25cf80['set'](_0xc601('0x1e'),_0x3f6822+'-'+_0x3138f1+'/'+_0x159cc8)[_0xc601('0x1a')](_0x118789);}return null;};}function patchUpdates(_0x5c392d){return function(_0x1092ce){try{jsonpatch[_0xc601('0x1f')](_0x1092ce,_0x5c392d,!![]);}catch(_0x4491d4){return BPromise['reject'](_0x4491d4);}return _0x1092ce['save']();};}function saveUpdates(_0x58e951,_0x137c83){return function(_0x2fcabb){if(_0x2fcabb){return _0x2fcabb[_0xc601('0x20')](_0x58e951)[_0xc601('0x21')](function(_0x1a70c7){return _0x1a70c7;});}return null;};}function removeEntity(_0x497715,_0x3e602d){return function(_0x417163){if(_0x417163){return _0x417163['destroy']()[_0xc601('0x21')](function(){var _0x4e4dff=_0x417163[_0xc601('0x22')]({'plain':!![]});var _0x273acf=_0xc601('0x23');return db[_0xc601('0x24')][_0xc601('0x25')]({'where':{'type':_0x273acf,'resourceId':_0x4e4dff['id']}})[_0xc601('0x21')](function(){return _0x417163;});})[_0xc601('0x21')](function(){_0x497715[_0xc601('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23e4d3,_0x2bbd4f){return function(_0x5af523){if(!_0x5af523){_0x23e4d3[_0xc601('0x26')](0x194);}return _0x5af523;};}function handleError(_0x310d84,_0x237b1d){_0x237b1d=_0x237b1d||0x1f4;return function(_0x123107){logger[_0xc601('0x27')](_0x123107['stack']);if(_0x123107[_0xc601('0x28')]){delete _0x123107[_0xc601('0x28')];}_0x310d84[_0xc601('0x18')](_0x237b1d)[_0xc601('0x29')](_0x123107);};}exports[_0xc601('0x2a')]=function(_0x2a28d4,_0x3c9af3){var _0xfdfa7={},_0x28e3ed={},_0x17c9b={'count':0x0,'rows':[]};return db[_0xc601('0x2b')][_0xc601('0x2c')]()[_0xc601('0x21')](function(_0x2dc8d9){_0x28e3ed[_0xc601('0x2d')]=_[_0xc601('0x2e')](_0x2dc8d9);_0x28e3ed[_0xc601('0x2f')]=_[_0xc601('0x2e')](_0x2a28d4[_0xc601('0x2f')]);_0x28e3ed[_0xc601('0x30')]=_[_0xc601('0x31')](_0x28e3ed[_0xc601('0x2d')],_0x28e3ed['query']);_0xfdfa7['attributes']=_['intersection'](_0x28e3ed[_0xc601('0x2d')],qs[_0xc601('0x32')](_0x2a28d4['query']['fields']));_0xfdfa7[_0xc601('0x33')]=_0xfdfa7[_0xc601('0x33')][_0xc601('0x34')]?_0xfdfa7[_0xc601('0x33')]:_0x28e3ed[_0xc601('0x2d')];if(!_0x2a28d4[_0xc601('0x2f')][_0xc601('0x35')](_0xc601('0x36'))){_0xfdfa7['limit']=qs['limit'](_0x2a28d4[_0xc601('0x2f')][_0xc601('0x37')]);_0xfdfa7[_0xc601('0x1b')]=qs[_0xc601('0x1b')](_0x2a28d4['query']['offset']);}_0xfdfa7[_0xc601('0x38')]=qs[_0xc601('0x39')](_0x2a28d4[_0xc601('0x2f')]['sort']);_0xfdfa7[_0xc601('0x3a')]=qs[_0xc601('0x30')](_['pick'](_0x2a28d4[_0xc601('0x2f')],_0x28e3ed[_0xc601('0x30')]),_0x2dc8d9);if(_0x2a28d4[_0xc601('0x2f')][_0xc601('0x3b')]){_0xfdfa7[_0xc601('0x3a')]=_[_0xc601('0x3c')](_0xfdfa7['where'],{'$or':_[_0xc601('0x3d')](_0xfdfa7[_0xc601('0x33')],function(_0x50b6b5){var _0x5996d3={};_0x5996d3[_0x50b6b5]={'$like':'%'+_0x2a28d4[_0xc601('0x2f')][_0xc601('0x3b')]+'%'};return _0x5996d3;})});}_0xfdfa7=_[_0xc601('0x3c')]({},_0xfdfa7,_0x2a28d4[_0xc601('0x3e')]);var _0x999416={'where':_0xfdfa7['where']};return db['CmCompany'][_0xc601('0x1d')](_0x999416)['then'](function(_0x39f453){_0x17c9b[_0xc601('0x1d')]=_0x39f453;if(_0x2a28d4['query'][_0xc601('0x3f')]){_0xfdfa7['include']=[{'all':!![]}];}return db[_0xc601('0x2b')][_0xc601('0x40')](_0xfdfa7);})['then'](function(_0x2bdee5){_0x17c9b['rows']=_0x2bdee5;return _0x17c9b;})[_0xc601('0x21')](respondWithFilteredResult(_0x3c9af3,_0xfdfa7))[_0xc601('0x41')](handleError(_0x3c9af3,null));})[_0xc601('0x41')](handleError(_0x3c9af3,null));};exports[_0xc601('0x42')]=function(_0x428a64,_0x17b998){var _0x40ae22={'raw':![],'where':{'id':_0x428a64[_0xc601('0x43')]['id']}},_0x2ee79b={};_0x2ee79b['model']=_[_0xc601('0x2e')](db['CmCompany'][_0xc601('0x44')]);_0x2ee79b['query']=_['keys'](_0x428a64[_0xc601('0x2f')]);_0x2ee79b[_0xc601('0x30')]=_['intersection'](_0x2ee79b['model'],_0x2ee79b[_0xc601('0x2f')]);_0x40ae22['attributes']=_[_0xc601('0x31')](_0x2ee79b[_0xc601('0x2d')],qs[_0xc601('0x32')](_0x428a64[_0xc601('0x2f')][_0xc601('0x32')]));_0x40ae22[_0xc601('0x33')]=_0x40ae22[_0xc601('0x33')][_0xc601('0x34')]?_0x40ae22[_0xc601('0x33')]:_0x2ee79b[_0xc601('0x2d')];if(_0x428a64[_0xc601('0x2f')][_0xc601('0x3f')]){_0x40ae22['include']=[{'all':!![]}];}_0x40ae22=_[_0xc601('0x3c')]({},_0x40ae22,_0x428a64[_0xc601('0x3e')]);return db[_0xc601('0x2b')][_0xc601('0x45')](_0x40ae22)[_0xc601('0x21')](handleEntityNotFound(_0x17b998,null))[_0xc601('0x21')](respondWithResult(_0x17b998,null))[_0xc601('0x41')](handleError(_0x17b998,null));};exports[_0xc601('0x46')]=function(_0x39d759,_0x54d35a){return db[_0xc601('0x2b')][_0xc601('0x46')](_0x39d759['body'],{})[_0xc601('0x21')](function(_0x55fc94){var _0x2804f1=_0x39d759['user'][_0xc601('0x22')]({'plain':!![]});if(!_0x2804f1)throw new Error(_0xc601('0x47'));if(_0x2804f1[_0xc601('0x48')]===_0xc601('0x49')){var _0x4b9ddf=_0x55fc94['get']({'plain':!![]});var _0x1a0a14=_0xc601('0x23');return db[_0xc601('0x4a')][_0xc601('0x45')]({'where':{'name':_0x1a0a14,'userProfileId':_0x2804f1['userProfileId']},'raw':!![]})[_0xc601('0x21')](function(_0x301e82){if(_0x301e82&&_0x301e82[_0xc601('0x4b')]===0x0){return db[_0xc601('0x24')][_0xc601('0x46')]({'name':_0x4b9ddf['name'],'resourceId':_0x4b9ddf['id'],'type':_0x301e82['name'],'sectionId':_0x301e82['id']},{})[_0xc601('0x21')](function(){return _0x55fc94;});}else{return _0x55fc94;}})[_0xc601('0x41')](function(_0xd99ae2){logger[_0xc601('0x27')](_0xc601('0x4c'),_0xd99ae2);throw _0xd99ae2;});}return _0x55fc94;})['then'](respondWithResult(_0x54d35a,0xc9))[_0xc601('0x41')](handleError(_0x54d35a,null));};exports[_0xc601('0x20')]=function(_0x38ed40,_0x26ea6f){if(_0x38ed40[_0xc601('0x4d')]['id']){delete _0x38ed40[_0xc601('0x4d')]['id'];}return db['CmCompany'][_0xc601('0x45')]({'where':{'id':_0x38ed40[_0xc601('0x43')]['id']}})[_0xc601('0x21')](handleEntityNotFound(_0x26ea6f,null))['then'](saveUpdates(_0x38ed40[_0xc601('0x4d')],null))[_0xc601('0x21')](respondWithResult(_0x26ea6f,null))[_0xc601('0x41')](handleError(_0x26ea6f,null));};exports[_0xc601('0x25')]=function(_0x5878a2,_0x78a293){return db[_0xc601('0x2b')][_0xc601('0x45')]({'where':{'id':_0x5878a2[_0xc601('0x43')]['id']}})[_0xc601('0x21')](handleEntityNotFound(_0x78a293,null))['then'](removeEntity(_0x78a293,null))[_0xc601('0x41')](handleError(_0x78a293,null));};exports[_0xc601('0x2c')]=function(_0xbfaa14,_0x98c937){return db[_0xc601('0x2b')][_0xc601('0x2c')]()[_0xc601('0x21')](respondWithResult(_0x98c937,null))['catch'](handleError(_0x98c937,null));};exports[_0xc601('0x4e')]=function(_0x28a1c5,_0x4eb100,_0xb283d4){return db[_0xc601('0x4f')]['find']({'where':{'id':_0x28a1c5[_0xc601('0x43')]['id']}})[_0xc601('0x21')](handleEntityNotFound(_0x4eb100,null))['then'](function(_0x2b8bad){if(_0x2b8bad){return _0x2b8bad[_0xc601('0x4e')](_0x28a1c5[_0xc601('0x4d')]['ids'],_[_0xc601('0x50')](_0x28a1c5[_0xc601('0x4d')],[_0xc601('0x51'),'id'])||{});}})['then'](respondWithResult(_0x4eb100,null))[_0xc601('0x41')](handleError(_0x4eb100,null));};exports[_0xc601('0x52')]=function(_0x4087e4,_0x500ce7,_0x5b41b8){var _0x78af63={};var _0x45cb28={};var _0x538459;var _0x38288c;return db[_0xc601('0x2b')]['findOne']({'where':{'id':_0x4087e4[_0xc601('0x43')]['id']}})['then'](handleEntityNotFound(_0x500ce7,null))[_0xc601('0x21')](function(_0x1dba32){if(_0x1dba32){_0x538459=_0x1dba32;_0x45cb28[_0xc601('0x2d')]=_['keys'](db['CmContact'][_0xc601('0x44')]);_0x45cb28[_0xc601('0x2f')]=_[_0xc601('0x2e')](_0x4087e4['query']);_0x45cb28[_0xc601('0x30')]=_['intersection'](_0x45cb28[_0xc601('0x2d')],_0x45cb28[_0xc601('0x2f')]);_0x78af63['attributes']=_['intersection'](_0x45cb28['model'],qs['fields'](_0x4087e4['query'][_0xc601('0x32')]));_0x78af63['attributes']=_0x78af63[_0xc601('0x33')][_0xc601('0x34')]?_0x78af63[_0xc601('0x33')]:_0x45cb28[_0xc601('0x2d')];_0x78af63[_0xc601('0x38')]=qs[_0xc601('0x39')](_0x4087e4['query'][_0xc601('0x39')]);_0x78af63[_0xc601('0x3a')]=qs['filters'](_['pick'](_0x4087e4[_0xc601('0x2f')],_0x45cb28[_0xc601('0x30')]));if(_0x4087e4[_0xc601('0x2f')][_0xc601('0x3b')]){_0x78af63[_0xc601('0x3a')]=_['merge'](_0x78af63[_0xc601('0x3a')],{'$or':_[_0xc601('0x3d')](_0x78af63[_0xc601('0x33')],function(_0x30ded4){var _0x12b860={};_0x12b860[_0x30ded4]={'$like':'%'+_0x4087e4[_0xc601('0x2f')][_0xc601('0x3b')]+'%'};return _0x12b860;})});}_0x78af63=_[_0xc601('0x3c')]({},_0x78af63,_0x4087e4[_0xc601('0x3e')]);return _0x538459[_0xc601('0x52')](_0x78af63);}})[_0xc601('0x21')](function(_0x1f8dfc){if(_0x1f8dfc){_0x38288c=_0x1f8dfc[_0xc601('0x34')];if(!_0x4087e4[_0xc601('0x2f')][_0xc601('0x35')](_0xc601('0x36'))){_0x78af63[_0xc601('0x37')]=qs[_0xc601('0x37')](_0x4087e4[_0xc601('0x2f')][_0xc601('0x37')]);_0x78af63[_0xc601('0x1b')]=qs[_0xc601('0x1b')](_0x4087e4[_0xc601('0x2f')]['offset']);}return _0x538459[_0xc601('0x52')](_0x78af63);}})[_0xc601('0x21')](function(_0x44107e){if(_0x44107e){return _0x44107e?{'count':_0x38288c,'rows':_0x44107e}:null;}})[_0xc601('0x21')](respondWithResult(_0x500ce7,null))[_0xc601('0x41')](handleError(_0x500ce7,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 7700463..82671f5 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 _0xe1cd=['./cmCompany.attributes','exports','define','CmCompany','cm_companies','../../config/logger','api','moment','rimraf','../../config/environment'];(function(_0x3c22fe,_0x1b4c55){var _0x53df50=function(_0x105ea7){while(--_0x105ea7){_0x3c22fe['push'](_0x3c22fe['shift']());}};_0x53df50(++_0x1b4c55);}(_0xe1cd,0x9b));var _0xde1c=function(_0x43c963,_0x28b4b1){_0x43c963=_0x43c963-0x0;var _0x1e06b5=_0xe1cd[_0x43c963];return _0x1e06b5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xde1c('0x0'))(_0xde1c('0x1'));var moment=require(_0xde1c('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xde1c('0x3'));var config=require(_0xde1c('0x4'));var attributes=require(_0xde1c('0x5'));module[_0xde1c('0x6')]=function(_0x2e689d,_0x1f03a6){return _0x2e689d[_0xde1c('0x7')](_0xde1c('0x8'),attributes,{'tableName':_0xde1c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5114=['CmCompany','cm_companies','../../config/logger','moment','request-promise','path','../../config/environment'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x5114,0x1d0));var _0x4511=function(_0x22dc41,_0x590632){_0x22dc41=_0x22dc41-0x0;var _0x34b23e=_0x5114[_0x22dc41];return _0x34b23e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4511('0x0'))('api');var moment=require(_0x4511('0x1'));var BPromise=require('bluebird');var rp=require(_0x4511('0x2'));var fs=require('fs');var path=require(_0x4511('0x3'));var rimraf=require('rimraf');var config=require(_0x4511('0x4'));var attributes=require('./cmCompany.attributes');module['exports']=function(_0x42408d,_0x2b2cc0){return _0x42408d['define'](_0x4511('0x5'),attributes,{'tableName':_0x4511('0x6'),'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 41b1cf3..ac255be 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 _0x1e42=['code','CmCompany,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','stringify','error'];(function(_0x19ebdc,_0x11b44b){var _0x2436e6=function(_0xa03308){while(--_0xa03308){_0x19ebdc['push'](_0x19ebdc['shift']());}};_0x2436e6(++_0x11b44b);}(_0x1e42,0x66));var _0x21e4=function(_0x44512b,_0x199f03){_0x44512b=_0x44512b-0x0;var _0x30e108=_0x1e42[_0x44512b];return _0x30e108;};'use strict';var _=require(_0x21e4('0x0'));var util=require(_0x21e4('0x1'));var moment=require(_0x21e4('0x2'));var BPromise=require(_0x21e4('0x3'));var rs=require(_0x21e4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x21e4('0x5'))['db'];var utils=require(_0x21e4('0x6'));var logger=require(_0x21e4('0x7'))(_0x21e4('0x8'));var config=require(_0x21e4('0x9'));var jayson=require(_0x21e4('0xa'));var client=jayson['client'][_0x21e4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xd0e891,_0x4b8293,_0x4e3457){return new BPromise(function(_0x196392,_0x3f743){return client[_0x21e4('0xc')](_0xd0e891,_0x4e3457)[_0x21e4('0xd')](function(_0x54334c){logger['info']('CmCompany,\x20%s,\x20%s',_0x4b8293,_0x21e4('0xe'));logger[_0x21e4('0xf')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x4b8293,_0x21e4('0xe'),JSON[_0x21e4('0x10')](_0x54334c));if(_0x54334c[_0x21e4('0x11')]){if(_0x54334c[_0x21e4('0x11')][_0x21e4('0x12')]===0x1f4){logger[_0x21e4('0x11')](_0x21e4('0x13'),_0x4b8293,_0x54334c[_0x21e4('0x11')][_0x21e4('0x14')]);return _0x3f743(_0x54334c[_0x21e4('0x11')][_0x21e4('0x14')]);}logger['error'](_0x21e4('0x13'),_0x4b8293,_0x54334c['error'][_0x21e4('0x14')]);return _0x196392(_0x54334c[_0x21e4('0x11')][_0x21e4('0x14')]);}else{logger[_0x21e4('0x15')](_0x21e4('0x13'),_0x4b8293,_0x21e4('0xe'));_0x196392(_0x54334c[_0x21e4('0x16')][_0x21e4('0x14')]);}})[_0x21e4('0x17')](function(_0x2360b7){logger[_0x21e4('0x11')]('CmCompany,\x20%s,\x20%s',_0x4b8293,_0x2360b7);_0x3f743(_0x2360b7);});});} \ No newline at end of file +var _0x8cb1=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','CmCompany,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x426b61,_0x585c1e){var _0x2cb12b=function(_0x45539d){while(--_0x45539d){_0x426b61['push'](_0x426b61['shift']());}};_0x2cb12b(++_0x585c1e);}(_0x8cb1,0x176));var _0x18cb=function(_0x4f217f,_0x313163){_0x4f217f=_0x4f217f-0x0;var _0x3b583a=_0x8cb1[_0x4f217f];return _0x3b583a;};'use strict';var _=require(_0x18cb('0x0'));var util=require(_0x18cb('0x1'));var moment=require(_0x18cb('0x2'));var BPromise=require(_0x18cb('0x3'));var rs=require(_0x18cb('0x4'));var fs=require('fs');var Redis=require(_0x18cb('0x5'));var db=require(_0x18cb('0x6'))['db'];var utils=require(_0x18cb('0x7'));var logger=require(_0x18cb('0x8'))(_0x18cb('0x9'));var config=require(_0x18cb('0xa'));var jayson=require(_0x18cb('0xb'));var client=jayson[_0x18cb('0xc')][_0x18cb('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x57be07,_0x211a45,_0x39dd65){return new BPromise(function(_0x5f4b57,_0x5a0223){return client[_0x18cb('0xe')](_0x57be07,_0x39dd65)[_0x18cb('0xf')](function(_0x1633d2){logger[_0x18cb('0x10')]('CmCompany,\x20%s,\x20%s',_0x211a45,_0x18cb('0x11'));logger[_0x18cb('0x12')](_0x18cb('0x13'),_0x211a45,_0x18cb('0x11'),JSON[_0x18cb('0x14')](_0x1633d2));if(_0x1633d2[_0x18cb('0x15')]){if(_0x1633d2[_0x18cb('0x15')][_0x18cb('0x16')]===0x1f4){logger['error'](_0x18cb('0x17'),_0x211a45,_0x1633d2[_0x18cb('0x15')][_0x18cb('0x18')]);return _0x5a0223(_0x1633d2[_0x18cb('0x15')][_0x18cb('0x18')]);}logger[_0x18cb('0x15')](_0x18cb('0x17'),_0x211a45,_0x1633d2[_0x18cb('0x15')][_0x18cb('0x18')]);return _0x5f4b57(_0x1633d2[_0x18cb('0x15')][_0x18cb('0x18')]);}else{logger['info'](_0x18cb('0x17'),_0x211a45,_0x18cb('0x11'));_0x5f4b57(_0x1633d2[_0x18cb('0x19')][_0x18cb('0x18')]);}})[_0x18cb('0x1a')](function(_0x1c60b6){logger[_0x18cb('0x15')](_0x18cb('0x17'),_0x211a45,_0x1c60b6);_0x5a0223(_0x1c60b6);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 8a5d1c9..1252701 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 _0xc6b9=['isAuthenticated','show','/:id/contacts','post','create','addContacts','/:id','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmCompany.controller','get','index','/describe','describe'];(function(_0xcf225,_0x3c74d9){var _0x1b8af5=function(_0x29883e){while(--_0x29883e){_0xcf225['push'](_0xcf225['shift']());}};_0x1b8af5(++_0x3c74d9);}(_0xc6b9,0x1bb));var _0x9c6b=function(_0x3b5049,_0x495a94){_0x3b5049=_0x3b5049-0x0;var _0x12454e=_0xc6b9[_0x3b5049];return _0x12454e;};'use strict';var multer=require(_0x9c6b('0x0'));var util=require(_0x9c6b('0x1'));var path=require(_0x9c6b('0x2'));var timeout=require('connect-timeout');var express=require(_0x9c6b('0x3'));var router=express[_0x9c6b('0x4')]();var fs_extra=require(_0x9c6b('0x5'));var auth=require(_0x9c6b('0x6'));var interaction=require(_0x9c6b('0x7'));var config=require('../../config/environment');var controller=require(_0x9c6b('0x8'));router[_0x9c6b('0x9')]('/',auth['isAuthenticated'](),controller[_0x9c6b('0xa')]);router[_0x9c6b('0x9')](_0x9c6b('0xb'),auth['isAuthenticated'](),controller[_0x9c6b('0xc')]);router[_0x9c6b('0x9')]('/:id',auth[_0x9c6b('0xd')](),controller[_0x9c6b('0xe')]);router['get'](_0x9c6b('0xf'),auth[_0x9c6b('0xd')](),controller['getContacts']);router[_0x9c6b('0x10')]('/',auth['isAuthenticated'](),controller[_0x9c6b('0x11')]);router[_0x9c6b('0x10')](_0x9c6b('0xf'),auth[_0x9c6b('0xd')](),controller[_0x9c6b('0x12')]);router['put'](_0x9c6b('0x13'),auth[_0x9c6b('0xd')](),controller[_0x9c6b('0x14')]);router[_0x9c6b('0x15')](_0x9c6b('0x13'),auth['isAuthenticated'](),controller[_0x9c6b('0x16')]);module[_0x9c6b('0x17')]=router; \ No newline at end of file +var _0x6267=['path','connect-timeout','express','Router','fs-extra','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','/:id/contacts','put','update','destroy','exports','multer','util'];(function(_0x329274,_0x286a29){var _0x42af70=function(_0x2d7518){while(--_0x2d7518){_0x329274['push'](_0x329274['shift']());}};_0x42af70(++_0x286a29);}(_0x6267,0x71));var _0x7626=function(_0x41d4f4,_0x3503b7){_0x41d4f4=_0x41d4f4-0x0;var _0x7f9f90=_0x6267[_0x41d4f4];return _0x7f9f90;};'use strict';var multer=require(_0x7626('0x0'));var util=require(_0x7626('0x1'));var path=require(_0x7626('0x2'));var timeout=require(_0x7626('0x3'));var express=require(_0x7626('0x4'));var router=express[_0x7626('0x5')]();var fs_extra=require(_0x7626('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7626('0x7'));var controller=require(_0x7626('0x8'));router[_0x7626('0x9')]('/',auth[_0x7626('0xa')](),controller[_0x7626('0xb')]);router[_0x7626('0x9')](_0x7626('0xc'),auth[_0x7626('0xa')](),controller[_0x7626('0xd')]);router['get'](_0x7626('0xe'),auth[_0x7626('0xa')](),controller[_0x7626('0xf')]);router[_0x7626('0x9')]('/:id/contacts',auth[_0x7626('0xa')](),controller['getContacts']);router[_0x7626('0x10')]('/',auth[_0x7626('0xa')](),controller[_0x7626('0x11')]);router['post'](_0x7626('0x12'),auth['isAuthenticated'](),controller['addContacts']);router[_0x7626('0x13')]('/:id',auth[_0x7626('0xa')](),controller[_0x7626('0x14')]);router['delete'](_0x7626('0xe'),auth[_0x7626('0xa')](),controller[_0x7626('0x15')]);module[_0x7626('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 c48e697..699df8d 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 _0x171d=['DATE','NOW','lodash','sequelize','exports','STRING','TEXT','INTEGER','UNSIGNED'];(function(_0x134e0c,_0x1e5d9c){var _0x4997e3=function(_0x3b8c60){while(--_0x3b8c60){_0x134e0c['push'](_0x134e0c['shift']());}};_0x4997e3(++_0x1e5d9c);}(_0x171d,0x9b));var _0xd171=function(_0x500c0,_0xdb6a03){_0x500c0=_0x500c0-0x0;var _0xdd146f=_0x171d[_0x500c0];return _0xdd146f;};'use strict';var _=require(_0xd171('0x0'));var Sequelize=require(_0xd171('0x1'));module[_0xd171('0x2')]={'firstName':{'type':Sequelize[_0xd171('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0xd171('0x3')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xd171('0x3')]},'city':{'type':Sequelize[_0xd171('0x3')]},'country':{'type':Sequelize[_0xd171('0x3')]},'dateOfBirth':{'type':Sequelize[_0xd171('0x3')]},'description':{'type':Sequelize[_0xd171('0x4')]},'phone':{'type':Sequelize[_0xd171('0x3')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0xd171('0x3')]},'facebook':{'type':Sequelize[_0xd171('0x3')]},'fb_data':{'type':Sequelize[_0xd171('0x3')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0xd171('0x3')]},'viber':{'type':Sequelize[_0xd171('0x3')]},'line':{'type':Sequelize[_0xd171('0x3')]},'wechat':{'type':Sequelize[_0xd171('0x3')]},'telegram':{'type':Sequelize[_0xd171('0x3')]},'UserId':{'type':Sequelize[_0xd171('0x5')]},'priority':{'type':Sequelize[_0xd171('0x5')](0x2)[_0xd171('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xd171('0x7')],'defaultValue':Sequelize[_0xd171('0x8')]}}; \ No newline at end of file +var _0x85b3=['sequelize','STRING','TEXT','INTEGER','DATE','NOW','lodash'];(function(_0x56e9ab,_0x53ef52){var _0x1d5ac6=function(_0x3c7d9f){while(--_0x3c7d9f){_0x56e9ab['push'](_0x56e9ab['shift']());}};_0x1d5ac6(++_0x53ef52);}(_0x85b3,0xfb));var _0x385b=function(_0xca4fbf,_0xc78f88){_0xca4fbf=_0xca4fbf-0x0;var _0xbf6d9a=_0x85b3[_0xca4fbf];return _0xbf6d9a;};'use strict';var _=require(_0x385b('0x0'));var Sequelize=require(_0x385b('0x1'));module['exports']={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0x385b('0x2')]},'street':{'type':Sequelize[_0x385b('0x2')]},'postalCode':{'type':Sequelize[_0x385b('0x2')]},'city':{'type':Sequelize[_0x385b('0x2')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0x385b('0x2')]},'description':{'type':Sequelize[_0x385b('0x3')]},'phone':{'type':Sequelize[_0x385b('0x2')]},'mobile':{'type':Sequelize[_0x385b('0x2')]},'fax':{'type':Sequelize[_0x385b('0x2')]},'email':{'type':Sequelize[_0x385b('0x2')]},'url':{'type':Sequelize[_0x385b('0x2')]},'facebook':{'type':Sequelize[_0x385b('0x2')]},'fb_data':{'type':Sequelize[_0x385b('0x2')]},'twitter':{'type':Sequelize[_0x385b('0x2')]},'skype':{'type':Sequelize[_0x385b('0x2')]},'teams':{'type':Sequelize[_0x385b('0x2')]},'viber':{'type':Sequelize[_0x385b('0x2')]},'line':{'type':Sequelize[_0x385b('0x2')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0x385b('0x2')]},'UserId':{'type':Sequelize['INTEGER']},'priority':{'type':Sequelize[_0x385b('0x4')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x385b('0x5')],'defaultValue':Sequelize[_0x385b('0x6')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 05c9306..018df5a 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 _0x62fc=['sortBy','reverse','slice','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','error','stack','name','send','index','CmContact','length','keys','startsWith','cf_','push','CmCustomField','all','fieldType','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','select','field','color','tools_tags','from','left_join','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','where','c.deletedAt\x20IS\x20NULL','expr','parseSearch','search','find','Tag','value','split','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','uc.UserId\x20=\x20?','dateOfBirth','datetime','castTo','DATE','buildExpression','start','filter','isNil','Contact','isEmpty','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)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','group','Sequelize','QueryTypes','clone','c.id','t.id\x20IN\x20?','resolve','user','conditions','User','getLists','c.ListId\x20IS\x20NULL','role','agent','ListId','sequelize','toString','keyBy','merge','c.firstName','c.lastName','c.phone','c.mobile','c.fax','c.email','c.ListId','c.createdAt','c.deletedAt','TagIds','Tags','rows','catch','destroy','params','describe','tags','columnName','displayName','alias','custom','values','body','get','join','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','info','ChatInteraction','update','MailInteraction','MailMessage','SmsMessage','FaxInteraction','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','VoiceCallReport','ChatQueueReport','MailQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','create','bulkCreate','each','duplicates','findOrCreate','spread','findAll','omit','cf_%d','$and','pickBy','map','format','table','cm_contacts','setFields','id\x20=\x20?','toParam','text','phone','getTags','findOne','rawAttributes','setTags','ids','getHoppers','ContactId','options','includeAll','include','getHopperHistories','getHopperFinals','getJscriptySessions','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Incorrect\x20binding\x20parameters\x20passed!','No\x20phone\x20column\x20specified','firstName','root','server/files/tmp','filename','chmodSync','child_process','pid','upload','createReadStream','file','path','parse','meta','import','binding','No\x20firstName\x20column\x20specified','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','fork','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','getJourney','mail','chat','openchannel','whatsapp','voice','-createdAt','includes','channel','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','destination','callerid','starttime','endtime','duration','note','userSecondDisposition','userThirdDisposition','fullname','createdAt','DESC','startCase','Website','Account','closed','closedAt','disposition','thirdDisposition','UserId','Owner','browserName','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingType','referer','substatus','externalUrl','findAndCountAll'];(function(_0x1df7b8,_0x2fe5e5){var _0x29d911=function(_0x340121){while(--_0x340121){_0x1df7b8['push'](_0x1df7b8['shift']());}};_0x29d911(++_0x2fe5e5);}(_0x62fc,0x131));var _0xc62f=function(_0x32cc5c,_0x4a2d81){_0x32cc5c=_0x32cc5c-0x0;var _0x422d7e=_0x62fc[_0x32cc5c];return _0x422d7e;};'use strict';var emlformat=require(_0xc62f('0x0'));var rimraf=require(_0xc62f('0x1'));var zipdir=require(_0xc62f('0x2'));var jsonpatch=require(_0xc62f('0x3'));var rp=require(_0xc62f('0x4'));var moment=require('moment');var BPromise=require(_0xc62f('0x5'));var Mustache=require('mustache');var util=require(_0xc62f('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xc62f('0x7'));var ejs=require(_0xc62f('0x8'));var fs=require('fs');var fs_extra=require(_0xc62f('0x9'));var _=require(_0xc62f('0xa'));var squel=require(_0xc62f('0xb'));var crypto=require(_0xc62f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc62f('0xd'));var toCsv=require(_0xc62f('0x7'));var querystring=require(_0xc62f('0xe'));var Papa=require(_0xc62f('0xf'));var Redis=require(_0xc62f('0x10'));var authService=require(_0xc62f('0x11'));var qs=require(_0xc62f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc62f('0x13'));var logger=require(_0xc62f('0x14'))(_0xc62f('0x15'));var utils=require(_0xc62f('0x16'));var config=require(_0xc62f('0x17'));var licenseUtil=require(_0xc62f('0x18'));var db=require('../../mysqldb')['db'];config[_0xc62f('0x19')]=_[_0xc62f('0x1a')](config[_0xc62f('0x19')],{'host':_0xc62f('0x1b'),'port':0x18eb});var socket=require(_0xc62f('0x1c'))(new Redis(config[_0xc62f('0x19')]));require(_0xc62f('0x1d'))[_0xc62f('0x1e')](socket);function respondWithStatusCode(_0x575fa9,_0x2ea588){_0x2ea588=_0x2ea588||0xcc;return function(_0x43e648){if(_0x43e648){return _0x575fa9[_0xc62f('0x1f')](_0x2ea588);}return _0x575fa9[_0xc62f('0x20')](_0x2ea588)[_0xc62f('0x21')]();};}function respondWithResult(_0x4408e2,_0x197741){_0x197741=_0x197741||0xc8;return function(_0x1ac161){if(_0x1ac161){return _0x4408e2[_0xc62f('0x20')](_0x197741)[_0xc62f('0x22')](_0x1ac161);}};}function respondWithFilteredResult(_0x3feada,_0x5e12b8){return function(_0x47af10){if(_0x47af10){var _0x50863e=typeof _0x5e12b8[_0xc62f('0x23')]==='undefined'&&typeof _0x5e12b8[_0xc62f('0x24')]===_0xc62f('0x25');var _0x499e4d=_0x47af10[_0xc62f('0x26')];var _0x2e1a8a=_0x50863e?0x0:_0x5e12b8[_0xc62f('0x23')];var _0x4d7163=_0x50863e?_0x47af10['count']:_0x5e12b8['offset']+_0x5e12b8[_0xc62f('0x24')];var _0x1546f2;if(_0x4d7163>=_0x499e4d){_0x4d7163=_0x499e4d;_0x1546f2=0xc8;}else{_0x1546f2=0xce;}_0x3feada[_0xc62f('0x20')](_0x1546f2);return _0x3feada[_0xc62f('0x27')](_0xc62f('0x28'),_0x2e1a8a+'-'+_0x4d7163+'/'+_0x499e4d)[_0xc62f('0x22')](_0x47af10);}return null;};}function patchUpdates(_0x2dc43a){return function(_0x20178a){try{jsonpatch[_0xc62f('0x29')](_0x20178a,_0x2dc43a,!![]);}catch(_0x57248a){return BPromise[_0xc62f('0x2a')](_0x57248a);}return _0x20178a[_0xc62f('0x2b')]();};}function saveUpdates(_0x21ddea,_0xbaf8fa){return function(_0x3b7721){if(_0x3b7721){return _0x3b7721['update'](_0x21ddea)[_0xc62f('0x2c')](function(_0x55fd33){return _0x55fd33;});}return null;};}function removeEntity(_0x2dc1b9,_0x1d359c){return function(_0x1310f3){if(_0x1310f3){return _0x1310f3['destroy']()['then'](function(){_0x2dc1b9[_0xc62f('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e04e2,_0x10043a){return function(_0x388b8e){if(!_0x388b8e){_0x1e04e2[_0xc62f('0x1f')](0x194);}return _0x388b8e;};}function handleError(_0x3d439a,_0x27144d){_0x27144d=_0x27144d||0x1f4;return function(_0x1af45f){logger[_0xc62f('0x2d')](_0x1af45f[_0xc62f('0x2e')]);if(_0x1af45f['name']){delete _0x1af45f[_0xc62f('0x2f')];}_0x3d439a[_0xc62f('0x20')](_0x27144d)[_0xc62f('0x30')](_0x1af45f);};}exports[_0xc62f('0x31')]=function(_0x40af6b,_0x364f4d){var _0x1ea2a1={},_0x488158={},_0x11dfa7={'count':0x0,'rows':[]};return db[_0xc62f('0x32')]['describe']()['then'](function(_0x3effec){var _0x3fee6a=[];for(var _0x3557a6=0x0;_0x3557a60x1){_0x12f776['or'](_0xc62f('0x6e'),qs[_0xc62f('0x6f')](_0x335930),null);}else{if(qs[_0xc62f('0x70')](_0x335930)){_0x12f776['or'](_0xc62f('0x71'),_0x335930+'%');_0x12f776['or'](_0xc62f('0x72'),_0x335930+'%');_0x12f776['or'](_0xc62f('0x73'),_0x335930+'%');_0x12f776['or'](_0xc62f('0x74'),_0x335930+'%');}else if(qs[_0xc62f('0x75')](_0x335930)){_0x12f776['or'](_0xc62f('0x76'),_0x335930+'%');}else{_0x12f776['or'](_0xc62f('0x77'),'%'+_0x335930+'%');_0x12f776['or']('c.lastName\x20LIKE\x20?','%'+_0x335930+'%');_0x12f776['or'](_0xc62f('0x76'),'%'+_0x335930+'%');}}}}_0x52dc97[_0xc62f('0x50')](_0x12f776);_0x52dc97[_0xc62f('0x78')]('c.id');var _0x10a23c={'type':db[_0xc62f('0x79')][_0xc62f('0x7a')]['SELECT'],'raw':!![]};var _0x10e406=_0x52dc97[_0xc62f('0x7b')]()[_0xc62f('0x48')](_0xc62f('0x7c'));if(_0x1ea2a1[_0xc62f('0x44')]){_0x1ea2a1[_0xc62f('0x44')]['forEach'](function(_0x40f617){_0x52dc97[_0xc62f('0x44')]('c.'+_0x40f617[0x0],_0x40f617[0x1]==='DESC'?![]:!![]);});}if(!_[_0xc62f('0x66')](_0x3c2eed)){_0x52dc97['having'](_0x3576b3);_0x10e406['where'](_0xc62f('0x7d'),_0x3c2eed);}BPromise[_0xc62f('0x7e')]()['then'](function(){if(!_0x4b87de)return;if(_0x40af6b[_0xc62f('0x7f')]['role']!=='agent')return;if(!_['some'](_0x4b87de[_0xc62f('0x80')],['field',_0xc62f('0x81')])){return _0x40af6b[_0xc62f('0x7f')][_0xc62f('0x82')]({'attributes':['id'],'raw':!![]})[_0xc62f('0x2c')](function(_0x19c9e8){if(_[_0xc62f('0x66')](_0x19c9e8)){_0x10e406[_0xc62f('0x50')](_0xc62f('0x83'));_0x52dc97['where'](_0xc62f('0x83'));}else{_0x10e406[_0xc62f('0x50')]('c.ListId\x20IN\x20?',_['map'](_0x19c9e8,'id'));_0x52dc97[_0xc62f('0x50')]('c.ListId\x20IN\x20?',_['map'](_0x19c9e8,'id'));}});}})[_0xc62f('0x2c')](function(){if(_0x40af6b[_0xc62f('0x7f')][_0xc62f('0x84')]===_0xc62f('0x85')&&!_0x4b87de&&!_0x40af6b['query'][_0xc62f('0x86')])return[];return db[_0xc62f('0x87')][_0xc62f('0x3d')](_0x10e406[_0xc62f('0x88')](),_0x10a23c);})[_0xc62f('0x2c')](function(_0x34212d){_0x11dfa7['count']=_0x34212d[_0xc62f('0x33')];if(_0x11dfa7[_0xc62f('0x26')]===0x0)return[];return db[_0xc62f('0x87')][_0xc62f('0x3d')](_0x1c786d['toString'](),_0x10a23c)[_0xc62f('0x2c')](function(_0xca3add){_0x4f5de3=_[_0xc62f('0x89')](_0xca3add,'id');_0x10a23c=_[_0xc62f('0x8a')](_0x10a23c,{'model':db[_0xc62f('0x32')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x40af6b[_0xc62f('0x3d')][_0xc62f('0x41')]){_0x1ea2a1[_0xc62f('0x40')][_0xc62f('0x59')](function(_0x3523fd){_0x52dc97['field']('c.'+_0x3523fd);});}else{_0x52dc97[_0xc62f('0x48')](_0xc62f('0x7c'));_0x52dc97[_0xc62f('0x48')](_0xc62f('0x8b'));_0x52dc97[_0xc62f('0x48')](_0xc62f('0x8c'));_0x52dc97[_0xc62f('0x48')](_0xc62f('0x8d'));_0x52dc97[_0xc62f('0x48')](_0xc62f('0x8e'));_0x52dc97[_0xc62f('0x48')](_0xc62f('0x8f'));_0x52dc97[_0xc62f('0x48')](_0xc62f('0x90'));_0x52dc97['field'](_0xc62f('0x91'));_0x52dc97[_0xc62f('0x48')](_0xc62f('0x92'));_0x52dc97[_0xc62f('0x48')](_0xc62f('0x93'));_0x52dc97[_0xc62f('0x48')]('c.CompanyId');_0x52dc97[_0xc62f('0x48')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xc62f('0x94'));}if(_0x1ea2a1['limit'])_0x52dc97[_0xc62f('0x24')](_0x1ea2a1[_0xc62f('0x24')]);if(_0x1ea2a1[_0xc62f('0x23')])_0x52dc97[_0xc62f('0x23')](_0x1ea2a1[_0xc62f('0x23')]);return db['sequelize'][_0xc62f('0x3d')](_0x52dc97[_0xc62f('0x88')](),_0x10a23c);});})[_0xc62f('0x2c')](function(_0x5a83e5){_0x5a83e5[_0xc62f('0x59')](function(_0x28f14d){if(_0x28f14d[_0xc62f('0x94')]){_0x28f14d[_0xc62f('0x95')]=[];_0x28f14d[_0xc62f('0x94')][_0xc62f('0x58')](',')[_0xc62f('0x59')](function(_0x4e3894){_0x28f14d[_0xc62f('0x95')]['push'](_0x4f5de3[_0x4e3894]);});}delete _0x28f14d['TagIds'];});_0x11dfa7[_0xc62f('0x96')]=_0x5a83e5;return _0x11dfa7;})[_0xc62f('0x2c')](respondWithFilteredResult(_0x364f4d,_0x1ea2a1));})[_0xc62f('0x97')](handleError(_0x364f4d,null));};exports[_0xc62f('0x98')]=function(_0x255db7,_0x4ef4aa){return db[_0xc62f('0x32')][_0xc62f('0x55')]({'where':{'id':_0x255db7[_0xc62f('0x99')]['id']}})[_0xc62f('0x2c')](handleEntityNotFound(_0x4ef4aa,null))[_0xc62f('0x2c')](removeEntity(_0x4ef4aa,null))[_0xc62f('0x97')](handleError(_0x4ef4aa,null));};exports[_0xc62f('0x9a')]=function(_0x318b96,_0x447caf){return db[_0xc62f('0x32')]['describe']()[_0xc62f('0x2c')](function(_0x34b541){delete _0x34b541[_0xc62f('0x9b')];for(var _0x46576e=0x0;_0x46576e=_0x4a2ce0){_0x3a003e=_0x4a2ce0;_0x294c4a=0xc8;}else{_0x294c4a=0xce;}_0x308c34[_0xbf1c('0x1b')](_0x294c4a);return _0x308c34['set'](_0xbf1c('0x22'),_0x591697+'-'+_0x3a003e+'/'+_0x4a2ce0)['json'](_0x479d13);}return null;};}function patchUpdates(_0x4cc5b2){return function(_0x422095){try{jsonpatch['apply'](_0x422095,_0x4cc5b2,!![]);}catch(_0x417a0a){return BPromise[_0xbf1c('0x23')](_0x417a0a);}return _0x422095[_0xbf1c('0x24')]();};}function saveUpdates(_0x15cfbf,_0x32e3f5){return function(_0x285e0a){if(_0x285e0a){return _0x285e0a[_0xbf1c('0x25')](_0x15cfbf)[_0xbf1c('0x26')](function(_0x1f2e67){return _0x1f2e67;});}return null;};}function removeEntity(_0x570105,_0x199a69){return function(_0xaed75f){if(_0xaed75f){return _0xaed75f[_0xbf1c('0x27')]()[_0xbf1c('0x26')](function(){_0x570105[_0xbf1c('0x1b')](0xcc)[_0xbf1c('0x1c')]();});}};}function handleEntityNotFound(_0x2d0314,_0x3dfc51){return function(_0x1be925){if(!_0x1be925){_0x2d0314['sendStatus'](0x194);}return _0x1be925;};}function handleError(_0x156328,_0x1e3b97){_0x1e3b97=_0x1e3b97||0x1f4;return function(_0x1fdb6f){logger['error'](_0x1fdb6f[_0xbf1c('0x28')]);if(_0x1fdb6f[_0xbf1c('0x29')]){delete _0x1fdb6f[_0xbf1c('0x29')];}_0x156328['status'](_0x1e3b97)[_0xbf1c('0x2a')](_0x1fdb6f);};}exports['index']=function(_0x203e33,_0x57939b){var _0x5b3d77={},_0x249d60={},_0x199c0e={'count':0x0,'rows':[]};return db[_0xbf1c('0x2b')][_0xbf1c('0x2c')]()[_0xbf1c('0x26')](function(_0x37fe3d){var _0x49f387=[];for(var _0xfcce32=0x0;_0xfcce320x1){_0x50ba7d['or'](_0xbf1c('0x69'),qs[_0xbf1c('0x6a')](_0x17c3ec),null);}else{if(qs[_0xbf1c('0x6b')](_0x17c3ec)){_0x50ba7d['or'](_0xbf1c('0x6c'),_0x17c3ec+'%');_0x50ba7d['or'](_0xbf1c('0x6d'),_0x17c3ec+'%');_0x50ba7d['or'](_0xbf1c('0x6e'),_0x17c3ec+'%');_0x50ba7d['or'](_0xbf1c('0x6f'),_0x17c3ec+'%');}else if(qs[_0xbf1c('0x70')](_0x17c3ec)){_0x50ba7d['or'](_0xbf1c('0x71'),_0x17c3ec+'%');}else{_0x50ba7d['or']('c.firstName\x20LIKE\x20?','%'+_0x17c3ec+'%');_0x50ba7d['or']('c.lastName\x20LIKE\x20?','%'+_0x17c3ec+'%');_0x50ba7d['or'](_0xbf1c('0x71'),'%'+_0x17c3ec+'%');}}}}_0x350e07[_0xbf1c('0x3d')](_0x50ba7d);_0x350e07[_0xbf1c('0x72')](_0xbf1c('0x73'));var _0xa62efb={'type':db[_0xbf1c('0x74')][_0xbf1c('0x75')]['SELECT'],'raw':!![]};var _0x485d7c=_0x350e07[_0xbf1c('0x76')]()[_0xbf1c('0x40')](_0xbf1c('0x73'));if(_0x5b3d77['order']){_0x5b3d77[_0xbf1c('0x3b')][_0xbf1c('0x52')](function(_0x1f0370){_0x350e07[_0xbf1c('0x3b')]('c.'+_0x1f0370[0x0],_0x1f0370[0x1]===_0xbf1c('0x77')?![]:!![]);});}if(!_[_0xbf1c('0x61')](_0x2eacb9)){_0x350e07[_0xbf1c('0x78')](_0x35fa37);_0x485d7c['where'](_0xbf1c('0x79'),_0x2eacb9);}BPromise[_0xbf1c('0x7a')]()[_0xbf1c('0x26')](function(){if(!_0x5a21f5)return;if(_0x203e33['user']['role']!==_0xbf1c('0x7b'))return;if(!_[_0xbf1c('0x7c')](_0x5a21f5['conditions'],[_0xbf1c('0x40'),_0xbf1c('0x7d')])){return _0x203e33['user']['getLists']({'attributes':['id'],'raw':!![]})[_0xbf1c('0x26')](function(_0x493e0f){if(_[_0xbf1c('0x61')](_0x493e0f)){_0x485d7c[_0xbf1c('0x3d')](_0xbf1c('0x7e'));_0x350e07[_0xbf1c('0x3d')](_0xbf1c('0x7e'));}else{_0x485d7c[_0xbf1c('0x3d')](_0xbf1c('0x7f'),_[_0xbf1c('0x5c')](_0x493e0f,'id'));_0x350e07['where']('c.ListId\x20IN\x20?',_[_0xbf1c('0x5c')](_0x493e0f,'id'));}});}})[_0xbf1c('0x26')](function(){if(_0x203e33[_0xbf1c('0x80')][_0xbf1c('0x81')]===_0xbf1c('0x7b')&&!_0x5a21f5&&!_0x203e33[_0xbf1c('0x35')][_0xbf1c('0x62')])return[];return db[_0xbf1c('0x82')][_0xbf1c('0x35')](_0x485d7c[_0xbf1c('0x83')](),_0xa62efb);})['then'](function(_0x3aba76){_0x199c0e[_0xbf1c('0x20')]=_0x3aba76[_0xbf1c('0x2e')];if(_0x199c0e['count']===0x0)return[];return db['sequelize']['query'](_0x5183bf[_0xbf1c('0x83')](),_0xa62efb)['then'](function(_0x2f1dd8){_0x58d68e=_[_0xbf1c('0x84')](_0x2f1dd8,'id');_0xa62efb=_[_0xbf1c('0x85')](_0xa62efb,{'model':db[_0xbf1c('0x2b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x203e33['query']['fields']){_0x5b3d77[_0xbf1c('0x37')][_0xbf1c('0x52')](function(_0x54bf67){_0x350e07[_0xbf1c('0x40')]('c.'+_0x54bf67);});}else{_0x350e07[_0xbf1c('0x40')](_0xbf1c('0x73'));_0x350e07[_0xbf1c('0x40')](_0xbf1c('0x86'));_0x350e07['field'](_0xbf1c('0x87'));_0x350e07[_0xbf1c('0x40')](_0xbf1c('0x88'));_0x350e07[_0xbf1c('0x40')](_0xbf1c('0x89'));_0x350e07[_0xbf1c('0x40')](_0xbf1c('0x8a'));_0x350e07['field'](_0xbf1c('0x8b'));_0x350e07[_0xbf1c('0x40')](_0xbf1c('0x8c'));_0x350e07[_0xbf1c('0x40')](_0xbf1c('0x8d'));_0x350e07[_0xbf1c('0x40')](_0xbf1c('0x8e'));_0x350e07['field'](_0xbf1c('0x8f'));_0x350e07[_0xbf1c('0x40')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xbf1c('0x90'));}if(_0x5b3d77[_0xbf1c('0x1f')])_0x350e07[_0xbf1c('0x1f')](_0x5b3d77[_0xbf1c('0x1f')]);if(_0x5b3d77[_0xbf1c('0x21')])_0x350e07[_0xbf1c('0x21')](_0x5b3d77['offset']);return db[_0xbf1c('0x82')]['query'](_0x350e07[_0xbf1c('0x83')](),_0xa62efb);});})[_0xbf1c('0x26')](function(_0x26a6a3){_0x26a6a3[_0xbf1c('0x52')](function(_0x1c9ce6){if(_0x1c9ce6['TagIds']){_0x1c9ce6[_0xbf1c('0x91')]=[];_0x1c9ce6[_0xbf1c('0x90')]['split'](',')[_0xbf1c('0x52')](function(_0x33fd8f){_0x1c9ce6['Tags']['push'](_0x58d68e[_0x33fd8f]);});}delete _0x1c9ce6[_0xbf1c('0x90')];});_0x199c0e[_0xbf1c('0x92')]=_0x26a6a3;return _0x199c0e;})['then'](respondWithFilteredResult(_0x57939b,_0x5b3d77));})[_0xbf1c('0x93')](handleError(_0x57939b,null));};exports[_0xbf1c('0x27')]=function(_0x5aad7d,_0x31032c){return db[_0xbf1c('0x2b')]['find']({'where':{'id':_0x5aad7d['params']['id']}})['then'](handleEntityNotFound(_0x31032c,null))[_0xbf1c('0x26')](removeEntity(_0x31032c,null))[_0xbf1c('0x93')](handleError(_0x31032c,null));};exports['describe']=function(_0x133056,_0x16c539){return db[_0xbf1c('0x2b')]['describe']()[_0xbf1c('0x26')](function(_0x37dc95){delete _0x37dc95[_0xbf1c('0x94')];for(var _0x25bc55=0x0;_0x25bc55{}\s\\|]/g,'-');_0x2d9194(null,util['format'](_0x2e5f('0x1d'),path[_0x2e5f('0x1e')](_0xf72d73[_0x2e5f('0x1b')],path[_0x2e5f('0x1f')](_0xf72d73[_0x2e5f('0x1b')])),Date[_0x2e5f('0x20')](),path[_0x2e5f('0x1f')](_0xf72d73[_0x2e5f('0x1b')])));}})});router[_0x2e5f('0x16')](_0x2e5f('0x21'),upload[_0x2e5f('0x22')](_0x2e5f('0x23')),controller['uploadCsv']);var upload=multer({'storage':multer[_0x2e5f('0x19')]({'destination':function(_0x57125f,_0x556126,_0x93fe78){_0x93fe78(null,path[_0x2e5f('0x24')](config[_0x2e5f('0x25')],_0x2e5f('0x1a')));},'filename':function(_0x53931a,_0x500f72,_0x23ed11){_0x500f72['originalname']=_0x500f72[_0x2e5f('0x1b')][_0x2e5f('0x1c')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x23ed11(null,util['format'](_0x2e5f('0x1d'),path[_0x2e5f('0x1e')](_0x500f72[_0x2e5f('0x1b')],path[_0x2e5f('0x1f')](_0x500f72[_0x2e5f('0x1b')])),Date[_0x2e5f('0x20')](),path['extname'](_0x500f72['originalname'])));}})});router['post'](_0x2e5f('0x26'),upload['single']('file'),controller[_0x2e5f('0x27')]);router['post'](_0x2e5f('0x28'),auth['isAuthenticated'](),controller[_0x2e5f('0x29')]);router[_0x2e5f('0x2a')]('/:id',auth[_0x2e5f('0x8')](),controller[_0x2e5f('0x2b')]);router[_0x2e5f('0x2c')](_0x2e5f('0xa'),auth[_0x2e5f('0x8')](),controller[_0x2e5f('0x2d')]);module[_0x2e5f('0x2e')]=router; \ No newline at end of file +var _0x739f=['getJscriptySessions','/:id/journey','/merge','merge','create','post','/create_many','bulkCreate','/:id/tags','setTags','join','root','server/files/tmp','originalname','replace','format','basename','now','extname','single','file','uploadCsv','%s-%s%s','/upload','upload','import','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions'];(function(_0x1f7af5,_0x5902ba){var _0x576a87=function(_0x52bec1){while(--_0x52bec1){_0x1f7af5['push'](_0x1f7af5['shift']());}};_0x576a87(++_0x5902ba);}(_0x739f,0x89));var _0xf739=function(_0xdfd75a,_0x272163){_0xdfd75a=_0xdfd75a-0x0;var _0x441a56=_0x739f[_0xdfd75a];return _0x441a56;};'use strict';var multer=require(_0xf739('0x0'));var util=require(_0xf739('0x1'));var path=require(_0xf739('0x2'));var timeout=require(_0xf739('0x3'));var express=require(_0xf739('0x4'));var router=express[_0xf739('0x5')]();var fs_extra=require(_0xf739('0x6'));var auth=require(_0xf739('0x7'));var interaction=require(_0xf739('0x8'));var config=require('../../config/environment');var controller=require('./cmContact.controller');router[_0xf739('0x9')]('/',auth[_0xf739('0xa')](),controller[_0xf739('0xb')]);router['get'](_0xf739('0xc'),auth[_0xf739('0xa')](),controller[_0xf739('0xd')]);router[_0xf739('0x9')](_0xf739('0xe'),auth['isAuthenticated'](),controller[_0xf739('0xf')]);router[_0xf739('0x9')]('/:id/tags',auth[_0xf739('0xa')](),controller['getTags']);router[_0xf739('0x9')](_0xf739('0x10'),auth[_0xf739('0xa')](),controller[_0xf739('0x11')]);router[_0xf739('0x9')](_0xf739('0x12'),auth[_0xf739('0xa')](),controller['getHopperHistories']);router[_0xf739('0x9')](_0xf739('0x13'),auth[_0xf739('0xa')](),controller[_0xf739('0x14')]);router['get'](_0xf739('0x15'),auth[_0xf739('0xa')](),controller[_0xf739('0x16')]);router['get'](_0xf739('0x17'),auth[_0xf739('0xa')](),controller['getJourney']);router['post'](_0xf739('0x18'),auth[_0xf739('0xa')](),controller[_0xf739('0x19')]);router['post']('/',auth[_0xf739('0xa')](),controller[_0xf739('0x1a')]);router[_0xf739('0x1b')](_0xf739('0x1c'),auth[_0xf739('0xa')](),controller[_0xf739('0x1d')]);router[_0xf739('0x1b')](_0xf739('0x1e'),auth['isAuthenticated'](),controller[_0xf739('0x1f')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x573e3b,_0xfd532f,_0x5dfba0){_0x5dfba0(null,path[_0xf739('0x20')](config[_0xf739('0x21')],_0xf739('0x22')));},'filename':function(_0x214d9c,_0xcae31,_0x4bb531){_0xcae31[_0xf739('0x23')]=_0xcae31['originalname'][_0xf739('0x24')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4bb531(null,util[_0xf739('0x25')]('%s-%s%s',path[_0xf739('0x26')](_0xcae31['originalname'],path['extname'](_0xcae31['originalname'])),Date[_0xf739('0x27')](),path[_0xf739('0x28')](_0xcae31[_0xf739('0x23')])));}})});router[_0xf739('0x1b')]('/csv',upload[_0xf739('0x29')](_0xf739('0x2a')),controller[_0xf739('0x2b')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x85eddc,_0x50e3a9,_0x288413){_0x288413(null,path['join'](config['root'],'server/files/tmp'));},'filename':function(_0x28b04b,_0xaa3981,_0x2755ef){_0xaa3981[_0xf739('0x23')]=_0xaa3981[_0xf739('0x23')][_0xf739('0x24')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2755ef(null,util['format'](_0xf739('0x2c'),path[_0xf739('0x26')](_0xaa3981['originalname'],path[_0xf739('0x28')](_0xaa3981['originalname'])),Date[_0xf739('0x27')](),path[_0xf739('0x28')](_0xaa3981[_0xf739('0x23')])));}})});router[_0xf739('0x1b')](_0xf739('0x2d'),upload['single'](_0xf739('0x2a')),controller[_0xf739('0x2e')]);router[_0xf739('0x1b')]('/upload/:id',auth['isAuthenticated'](),controller[_0xf739('0x2f')]);router[_0xf739('0x30')]('/:id',auth[_0xf739('0xa')](),controller[_0xf739('0x31')]);router[_0xf739('0x32')](_0xf739('0xe'),auth['isAuthenticated'](),controller[_0xf739('0x33')]);module[_0xf739('0x34')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 4e0a609..c5d5cf4 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 _0x1c21=['ENUM','voice','lodash','VIRTUAL','STRING','getDataValue','name','TEXT','type','select','parse','values','setDataValue','stringify','BOOLEAN'];(function(_0x320486,_0x5a32bc){var _0xce8126=function(_0xe8bda8){while(--_0xe8bda8){_0x320486['push'](_0x320486['shift']());}};_0xce8126(++_0x5a32bc);}(_0x1c21,0x1c4));var _0x11c2=function(_0x10b56f,_0x322bb2){_0x10b56f=_0x10b56f-0x0;var _0x263442=_0x1c21[_0x10b56f];return _0x263442;};'use strict';var Sequelize=require('sequelize');var _=require(_0x11c2('0x0'));module['exports']={'name':{'type':Sequelize[_0x11c2('0x1')],'get':function(_0x41532a){return this['getDataValue']('alias');}},'alias':{'type':Sequelize[_0x11c2('0x2')],'allowNull':![],'set':function(_0x54be4a){this['setDataValue']('alias',_0x54be4a?_0x54be4a:this[_0x11c2('0x3')](_0x11c2('0x4')));}},'type':{'type':Sequelize[_0x11c2('0x2')],'allowNull':![]},'values':{'type':Sequelize[_0x11c2('0x5')]('long'),'get':function(){if(this['getDataValue'](_0x11c2('0x6'))===_0x11c2('0x7')){return JSON[_0x11c2('0x8')](this['getDataValue']('values'));}else{return this[_0x11c2('0x3')](_0x11c2('0x9'));}},'set':function(_0x5d70cb){if(Array['isArray'](_0x5d70cb)){this[_0x11c2('0xa')](_0x11c2('0x9'),JSON[_0x11c2('0xb')](_0x5d70cb));}else{this[_0x11c2('0xa')]('values',_0x5d70cb);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x11c2('0xc')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x11c2('0xd')](_0x11c2('0xe'))}}; \ No newline at end of file +var _0x6e34=['isArray','BOOLEAN','voice','sequelize','exports','alias','STRING','setDataValue','name','TEXT','select','parse','getDataValue','values'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x6e34,0x81));var _0x46e3=function(_0x1d59bf,_0x153840){_0x1d59bf=_0x1d59bf-0x0;var _0x14f71e=_0x6e34[_0x1d59bf];return _0x14f71e;};'use strict';var Sequelize=require(_0x46e3('0x0'));var _=require('lodash');module[_0x46e3('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x437f3f){return this['getDataValue'](_0x46e3('0x2'));}},'alias':{'type':Sequelize[_0x46e3('0x3')],'allowNull':![],'set':function(_0x3cf239){this[_0x46e3('0x4')](_0x46e3('0x2'),_0x3cf239?_0x3cf239:this['getDataValue'](_0x46e3('0x5')));}},'type':{'type':Sequelize[_0x46e3('0x3')],'allowNull':![]},'values':{'type':Sequelize[_0x46e3('0x6')]('long'),'get':function(){if(this['getDataValue']('type')===_0x46e3('0x7')){return JSON[_0x46e3('0x8')](this[_0x46e3('0x9')](_0x46e3('0xa')));}else{return this[_0x46e3('0x9')](_0x46e3('0xa'));}},'set':function(_0x89f178){if(Array[_0x46e3('0xb')](_0x89f178)){this[_0x46e3('0x4')](_0x46e3('0xa'),JSON['stringify'](_0x89f178));}else{this['setDataValue'](_0x46e3('0xa'),_0x89f178);}}},'required':{'type':Sequelize[_0x46e3('0xc')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x46e3('0xc')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0x46e3('0xd'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 7584ad8..d588b1c 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 _0xea3f=['stack','name','send','index','map','CmCustomField','rawAttributes','type','key','model','differenceBy','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','body','sequelize','transaction','Sequelize','TEXT','number','INTEGER','BOOLEAN','queryInterface','addColumn','cm_contacts','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','save','update','then','destroy','end'];(function(_0x44f280,_0x4a1dad){var _0x4ee19d=function(_0xc02f51){while(--_0xc02f51){_0x44f280['push'](_0x44f280['shift']());}};_0x4ee19d(++_0x4a1dad);}(_0xea3f,0x199));var _0xfea3=function(_0x56d1ed,_0x237e84){_0x56d1ed=_0x56d1ed-0x0;var _0x1b282b=_0xea3f[_0x56d1ed];return _0x1b282b;};'use strict';var emlformat=require(_0xfea3('0x0'));var rimraf=require(_0xfea3('0x1'));var zipdir=require(_0xfea3('0x2'));var jsonpatch=require(_0xfea3('0x3'));var rp=require(_0xfea3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xfea3('0x5'));var util=require(_0xfea3('0x6'));var path=require(_0xfea3('0x7'));var sox=require(_0xfea3('0x8'));var csv=require(_0xfea3('0x9'));var ejs=require(_0xfea3('0xa'));var fs=require('fs');var fs_extra=require(_0xfea3('0xb'));var _=require(_0xfea3('0xc'));var squel=require(_0xfea3('0xd'));var crypto=require(_0xfea3('0xe'));var jsforce=require(_0xfea3('0xf'));var deskjs=require(_0xfea3('0x10'));var toCsv=require('to-csv');var querystring=require(_0xfea3('0x11'));var Papa=require(_0xfea3('0x12'));var Redis=require(_0xfea3('0x13'));var authService=require(_0xfea3('0x14'));var qs=require(_0xfea3('0x15'));var as=require(_0xfea3('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfea3('0x17'))('api');var utils=require(_0xfea3('0x18'));var config=require(_0xfea3('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xfea3('0x1a'))['db'];function respondWithStatusCode(_0x2bfcb3,_0x56a6c5){_0x56a6c5=_0x56a6c5||0xcc;return function(_0x5edb51){if(_0x5edb51){return _0x2bfcb3[_0xfea3('0x1b')](_0x56a6c5);}return _0x2bfcb3['status'](_0x56a6c5)['end']();};}function respondWithResult(_0x4b7c87,_0xb38dfd){_0xb38dfd=_0xb38dfd||0xc8;return function(_0x16d5d9){if(_0x16d5d9){return _0x4b7c87[_0xfea3('0x1c')](_0xb38dfd)[_0xfea3('0x1d')](_0x16d5d9);}};}function respondWithFilteredResult(_0x3fcf0d,_0x3e7d41){return function(_0x571f87){if(_0x571f87){var _0xf3b5de=typeof _0x3e7d41[_0xfea3('0x1e')]==='undefined'&&typeof _0x3e7d41[_0xfea3('0x1f')]==='undefined';var _0x4b86a5=_0x571f87[_0xfea3('0x20')];var _0x438998=_0xf3b5de?0x0:_0x3e7d41[_0xfea3('0x1e')];var _0x5030b0=_0xf3b5de?_0x571f87['count']:_0x3e7d41[_0xfea3('0x1e')]+_0x3e7d41[_0xfea3('0x1f')];var _0x549b98;if(_0x5030b0>=_0x4b86a5){_0x5030b0=_0x4b86a5;_0x549b98=0xc8;}else{_0x549b98=0xce;}_0x3fcf0d[_0xfea3('0x1c')](_0x549b98);return _0x3fcf0d[_0xfea3('0x21')](_0xfea3('0x22'),_0x438998+'-'+_0x5030b0+'/'+_0x4b86a5)[_0xfea3('0x1d')](_0x571f87);}return null;};}function patchUpdates(_0x5e9b2f){return function(_0x4998fc){try{jsonpatch[_0xfea3('0x23')](_0x4998fc,_0x5e9b2f,!![]);}catch(_0x286d41){return BPromise['reject'](_0x286d41);}return _0x4998fc[_0xfea3('0x24')]();};}function saveUpdates(_0xc7f7d9,_0x5b2e66){return function(_0x3fc4ea){if(_0x3fc4ea){return _0x3fc4ea[_0xfea3('0x25')](_0xc7f7d9)[_0xfea3('0x26')](function(_0x8a3688){return _0x8a3688;});}return null;};}function removeEntity(_0x8e2b06,_0x110490){return function(_0x3358ef){if(_0x3358ef){return _0x3358ef[_0xfea3('0x27')]()[_0xfea3('0x26')](function(){_0x8e2b06[_0xfea3('0x1c')](0xcc)[_0xfea3('0x28')]();});}};}function handleEntityNotFound(_0x3a57cc,_0x5be5aa){return function(_0x51d336){if(!_0x51d336){_0x3a57cc[_0xfea3('0x1b')](0x194);}return _0x51d336;};}function handleError(_0x3c5db1,_0x2a171d){_0x2a171d=_0x2a171d||0x1f4;return function(_0x4b5c49){logger['error'](_0x4b5c49[_0xfea3('0x29')]);if(_0x4b5c49[_0xfea3('0x2a')]){delete _0x4b5c49[_0xfea3('0x2a')];}_0x3c5db1['status'](_0x2a171d)[_0xfea3('0x2b')](_0x4b5c49);};}exports[_0xfea3('0x2c')]=function(_0x32aada,_0x425b73){var _0x1a79eb={},_0x470197={},_0x521719={'count':0x0,'rows':[]};var _0x2afd63=_[_0xfea3('0x2d')](db[_0xfea3('0x2e')][_0xfea3('0x2f')],function(_0xaea857){return{'name':_0xaea857['fieldName'],'type':_0xaea857[_0xfea3('0x30')][_0xfea3('0x31')]};});_0x470197[_0xfea3('0x32')]=_[_0xfea3('0x33')](_[_0xfea3('0x2d')](_0x2afd63,_0xfea3('0x2a')),[_0xfea3('0x2a')]);_0x470197['query']=_[_0xfea3('0x34')](_0x32aada[_0xfea3('0x35')]);_0x470197[_0xfea3('0x36')]=_['intersection'](_0x470197[_0xfea3('0x32')],_0x470197[_0xfea3('0x35')]);_0x1a79eb[_0xfea3('0x37')]=_[_0xfea3('0x38')](_0x470197[_0xfea3('0x32')],qs[_0xfea3('0x39')](_0x32aada[_0xfea3('0x35')]['fields']));_0x1a79eb[_0xfea3('0x37')]=_0x1a79eb[_0xfea3('0x37')]['length']?_0x1a79eb[_0xfea3('0x37')]:_0x470197[_0xfea3('0x32')];if(!_0x32aada['query'][_0xfea3('0x3a')](_0xfea3('0x3b'))){_0x1a79eb[_0xfea3('0x1f')]=qs['limit'](_0x32aada[_0xfea3('0x35')][_0xfea3('0x1f')]);_0x1a79eb['offset']=qs[_0xfea3('0x1e')](_0x32aada[_0xfea3('0x35')][_0xfea3('0x1e')]);}_0x1a79eb[_0xfea3('0x3c')]=qs[_0xfea3('0x3d')](_0x32aada[_0xfea3('0x35')][_0xfea3('0x3d')]);_0x1a79eb['where']=qs[_0xfea3('0x36')](_[_0xfea3('0x3e')](_0x32aada['query'],_0x470197[_0xfea3('0x36')]),_0x2afd63);if(_0x32aada[_0xfea3('0x35')][_0xfea3('0x3f')]){_0x1a79eb[_0xfea3('0x40')]=_['merge'](_0x1a79eb[_0xfea3('0x40')],{'$or':_[_0xfea3('0x2d')](_0x2afd63,function(_0x558e97){if(_0x558e97[_0xfea3('0x30')]!==_0xfea3('0x41')){var _0x403f4b={};_0x403f4b[_0x558e97['name']]={'$like':'%'+_0x32aada['query'][_0xfea3('0x3f')]+'%'};return _0x403f4b;}})});}_0x1a79eb=_[_0xfea3('0x42')]({},_0x1a79eb,_0x32aada[_0xfea3('0x43')]);var _0x35f1a8={'where':_0x1a79eb['where']};return db[_0xfea3('0x2e')][_0xfea3('0x20')](_0x35f1a8)[_0xfea3('0x26')](function(_0x38583f){_0x521719[_0xfea3('0x20')]=_0x38583f;if(_0x32aada['query'][_0xfea3('0x44')]){_0x1a79eb[_0xfea3('0x45')]=[{'all':!![]}];}return db[_0xfea3('0x2e')][_0xfea3('0x46')](_0x1a79eb);})[_0xfea3('0x26')](function(_0x36b650){_0x521719[_0xfea3('0x47')]=_0x36b650;return _0x521719;})['then'](respondWithFilteredResult(_0x425b73,_0x1a79eb))[_0xfea3('0x48')](handleError(_0x425b73,null));};exports[_0xfea3('0x49')]=function(_0x683c22,_0x574b8a){var _0x512728={'raw':!![],'where':{'id':_0x683c22[_0xfea3('0x4a')]['id']}},_0x486fdb={};_0x486fdb['model']=_['keys'](db[_0xfea3('0x2e')]['rawAttributes']);_0x486fdb[_0xfea3('0x35')]=_[_0xfea3('0x34')](_0x683c22[_0xfea3('0x35')]);_0x486fdb[_0xfea3('0x36')]=_[_0xfea3('0x38')](_0x486fdb['model'],_0x486fdb[_0xfea3('0x35')]);_0x512728[_0xfea3('0x37')]=_[_0xfea3('0x38')](_0x486fdb[_0xfea3('0x32')],qs[_0xfea3('0x39')](_0x683c22[_0xfea3('0x35')][_0xfea3('0x39')]));_0x512728['attributes']=_0x512728[_0xfea3('0x37')][_0xfea3('0x4b')]?_0x512728['attributes']:_0x486fdb[_0xfea3('0x32')];if(_0x683c22[_0xfea3('0x35')]['includeAll']){_0x512728[_0xfea3('0x45')]=[{'all':!![]}];}_0x512728=_[_0xfea3('0x42')]({},_0x512728,_0x683c22['options']);return db[_0xfea3('0x2e')][_0xfea3('0x4c')](_0x512728)[_0xfea3('0x26')](handleEntityNotFound(_0x574b8a,null))[_0xfea3('0x26')](respondWithResult(_0x574b8a,null))[_0xfea3('0x48')](handleError(_0x574b8a,null));};exports[_0xfea3('0x25')]=function(_0x4a19a0,_0x46dc20){if(_0x4a19a0[_0xfea3('0x4d')]['id']){delete _0x4a19a0[_0xfea3('0x4d')]['id'];}return db[_0xfea3('0x2e')]['find']({'where':{'id':_0x4a19a0[_0xfea3('0x4a')]['id']}})['then'](handleEntityNotFound(_0x46dc20,null))[_0xfea3('0x26')](saveUpdates(_0x4a19a0[_0xfea3('0x4d')],null))['then'](respondWithResult(_0x46dc20,null))[_0xfea3('0x48')](handleError(_0x46dc20,null));};exports[_0xfea3('0x27')]=function(_0x1aad80,_0x1af352){return db[_0xfea3('0x2e')][_0xfea3('0x4c')]({'where':{'id':_0x1aad80['params']['id']}})['then'](handleEntityNotFound(_0x1af352,null))[_0xfea3('0x26')](removeEntity(_0x1af352,null))[_0xfea3('0x48')](handleError(_0x1af352,null));};exports['create']=function(_0x514e68,_0x3c6e50){var _0x379dc5;return db[_0xfea3('0x4e')][_0xfea3('0x4f')](function(_0x2c065b){return db[_0xfea3('0x2e')]['create'](_0x514e68[_0xfea3('0x4d')],{'transaction':_0x2c065b})[_0xfea3('0x26')](function(_0x1ab83f){_0x379dc5=_0x1ab83f;var _0xd33e07={'type':db[_0xfea3('0x50')]['TEXT'],'transaction':_0x2c065b};switch(_0x514e68['body']['type']){case'text':_0xd33e07[_0xfea3('0x30')]=db[_0xfea3('0x50')][_0xfea3('0x51')];break;case _0xfea3('0x52'):_0xd33e07[_0xfea3('0x30')]=db[_0xfea3('0x50')][_0xfea3('0x53')];break;case'switch':_0xd33e07[_0xfea3('0x30')]=db[_0xfea3('0x50')][_0xfea3('0x54')];_0xd33e07['defaultValue']=![];break;default:}return db[_0xfea3('0x4e')][_0xfea3('0x55')][_0xfea3('0x56')](_0xfea3('0x57'),util[_0xfea3('0x58')](_0xfea3('0x59'),_0x379dc5['id']),_0xd33e07);})[_0xfea3('0x26')](function(){return _0x379dc5;});})[_0xfea3('0x26')](respondWithResult(_0x3c6e50,0xc9))[_0xfea3('0x48')](handleError(_0x3c6e50,null));}; \ No newline at end of file +var _0xbbf3=['text','number','switch','defaultValue','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','name','send','CmCustomField','rawAttributes','fieldName','type','model','differenceBy','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filters','filter','merge','map','options','where','includeAll','include','findAll','rows','catch','show','params','find','body','create','sequelize','transaction','TEXT'];(function(_0x2c1114,_0x2a5c50){var _0x2b877c=function(_0x4f356d){while(--_0x4f356d){_0x2c1114['push'](_0x2c1114['shift']());}};_0x2b877c(++_0x2a5c50);}(_0xbbf3,0x1a5));var _0x3bbf=function(_0x519b67,_0x358d89){_0x519b67=_0x519b67-0x0;var _0x2be719=_0xbbf3[_0x519b67];return _0x2be719;};'use strict';var emlformat=require(_0x3bbf('0x0'));var rimraf=require(_0x3bbf('0x1'));var zipdir=require(_0x3bbf('0x2'));var jsonpatch=require(_0x3bbf('0x3'));var rp=require('request-promise');var moment=require(_0x3bbf('0x4'));var BPromise=require(_0x3bbf('0x5'));var Mustache=require(_0x3bbf('0x6'));var util=require(_0x3bbf('0x7'));var path=require(_0x3bbf('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3bbf('0x9'));var fs=require('fs');var fs_extra=require(_0x3bbf('0xa'));var _=require(_0x3bbf('0xb'));var squel=require(_0x3bbf('0xc'));var crypto=require(_0x3bbf('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3bbf('0xe'));var toCsv=require(_0x3bbf('0xf'));var querystring=require(_0x3bbf('0x10'));var Papa=require(_0x3bbf('0x11'));var Redis=require(_0x3bbf('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x3bbf('0x13'));var as=require(_0x3bbf('0x14'));var hardwareService=require(_0x3bbf('0x15'));var logger=require('../../config/logger')(_0x3bbf('0x16'));var utils=require(_0x3bbf('0x17'));var config=require(_0x3bbf('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x3bbf('0x19'))['db'];function respondWithStatusCode(_0x1883cc,_0x32aeb7){_0x32aeb7=_0x32aeb7||0xcc;return function(_0x40e0ca){if(_0x40e0ca){return _0x1883cc[_0x3bbf('0x1a')](_0x32aeb7);}return _0x1883cc[_0x3bbf('0x1b')](_0x32aeb7)[_0x3bbf('0x1c')]();};}function respondWithResult(_0x18a760,_0x5b189e){_0x5b189e=_0x5b189e||0xc8;return function(_0x4c94a4){if(_0x4c94a4){return _0x18a760[_0x3bbf('0x1b')](_0x5b189e)['json'](_0x4c94a4);}};}function respondWithFilteredResult(_0x396b19,_0x5354c8){return function(_0x14bbb7){if(_0x14bbb7){var _0x2629d6=typeof _0x5354c8[_0x3bbf('0x1d')]===_0x3bbf('0x1e')&&typeof _0x5354c8[_0x3bbf('0x1f')]===_0x3bbf('0x1e');var _0x57c6bd=_0x14bbb7[_0x3bbf('0x20')];var _0x2ab8ff=_0x2629d6?0x0:_0x5354c8[_0x3bbf('0x1d')];var _0x2f64d6=_0x2629d6?_0x14bbb7['count']:_0x5354c8[_0x3bbf('0x1d')]+_0x5354c8[_0x3bbf('0x1f')];var _0x5c1379;if(_0x2f64d6>=_0x57c6bd){_0x2f64d6=_0x57c6bd;_0x5c1379=0xc8;}else{_0x5c1379=0xce;}_0x396b19[_0x3bbf('0x1b')](_0x5c1379);return _0x396b19[_0x3bbf('0x21')](_0x3bbf('0x22'),_0x2ab8ff+'-'+_0x2f64d6+'/'+_0x57c6bd)['json'](_0x14bbb7);}return null;};}function patchUpdates(_0x271e3b){return function(_0x6cca44){try{jsonpatch[_0x3bbf('0x23')](_0x6cca44,_0x271e3b,!![]);}catch(_0x11f826){return BPromise['reject'](_0x11f826);}return _0x6cca44[_0x3bbf('0x24')]();};}function saveUpdates(_0x315c0c,_0x339bc1){return function(_0x58792f){if(_0x58792f){return _0x58792f['update'](_0x315c0c)[_0x3bbf('0x25')](function(_0x36c446){return _0x36c446;});}return null;};}function removeEntity(_0x2caab1,_0x2f50e0){return function(_0x385d12){if(_0x385d12){return _0x385d12[_0x3bbf('0x26')]()[_0x3bbf('0x25')](function(){_0x2caab1[_0x3bbf('0x1b')](0xcc)[_0x3bbf('0x1c')]();});}};}function handleEntityNotFound(_0x598b80,_0x112627){return function(_0x965c5a){if(!_0x965c5a){_0x598b80[_0x3bbf('0x1a')](0x194);}return _0x965c5a;};}function handleError(_0x3a07d4,_0x370158){_0x370158=_0x370158||0x1f4;return function(_0x568d1a){logger[_0x3bbf('0x27')](_0x568d1a['stack']);if(_0x568d1a[_0x3bbf('0x28')]){delete _0x568d1a[_0x3bbf('0x28')];}_0x3a07d4['status'](_0x370158)[_0x3bbf('0x29')](_0x568d1a);};}exports['index']=function(_0xa17922,_0x4fa872){var _0x43ebc1={},_0x11077a={},_0x1f6c10={'count':0x0,'rows':[]};var _0x202d87=_['map'](db[_0x3bbf('0x2a')][_0x3bbf('0x2b')],function(_0x194467){return{'name':_0x194467[_0x3bbf('0x2c')],'type':_0x194467[_0x3bbf('0x2d')]['key']};});_0x11077a[_0x3bbf('0x2e')]=_[_0x3bbf('0x2f')](_['map'](_0x202d87,_0x3bbf('0x28')),[_0x3bbf('0x28')]);_0x11077a[_0x3bbf('0x30')]=_[_0x3bbf('0x31')](_0xa17922[_0x3bbf('0x30')]);_0x11077a['filters']=_['intersection'](_0x11077a[_0x3bbf('0x2e')],_0x11077a[_0x3bbf('0x30')]);_0x43ebc1['attributes']=_[_0x3bbf('0x32')](_0x11077a[_0x3bbf('0x2e')],qs[_0x3bbf('0x33')](_0xa17922[_0x3bbf('0x30')][_0x3bbf('0x33')]));_0x43ebc1[_0x3bbf('0x34')]=_0x43ebc1[_0x3bbf('0x34')]['length']?_0x43ebc1['attributes']:_0x11077a[_0x3bbf('0x2e')];if(!_0xa17922[_0x3bbf('0x30')][_0x3bbf('0x35')](_0x3bbf('0x36'))){_0x43ebc1[_0x3bbf('0x1f')]=qs[_0x3bbf('0x1f')](_0xa17922[_0x3bbf('0x30')][_0x3bbf('0x1f')]);_0x43ebc1[_0x3bbf('0x1d')]=qs[_0x3bbf('0x1d')](_0xa17922[_0x3bbf('0x30')][_0x3bbf('0x1d')]);}_0x43ebc1[_0x3bbf('0x37')]=qs[_0x3bbf('0x38')](_0xa17922[_0x3bbf('0x30')][_0x3bbf('0x38')]);_0x43ebc1['where']=qs['filters'](_[_0x3bbf('0x39')](_0xa17922['query'],_0x11077a[_0x3bbf('0x3a')]),_0x202d87);if(_0xa17922[_0x3bbf('0x30')][_0x3bbf('0x3b')]){_0x43ebc1['where']=_[_0x3bbf('0x3c')](_0x43ebc1['where'],{'$or':_[_0x3bbf('0x3d')](_0x202d87,function(_0x268c76){if(_0x268c76[_0x3bbf('0x2d')]!=='VIRTUAL'){var _0x19f2f6={};_0x19f2f6[_0x268c76[_0x3bbf('0x28')]]={'$like':'%'+_0xa17922[_0x3bbf('0x30')][_0x3bbf('0x3b')]+'%'};return _0x19f2f6;}})});}_0x43ebc1=_[_0x3bbf('0x3c')]({},_0x43ebc1,_0xa17922[_0x3bbf('0x3e')]);var _0x3236d5={'where':_0x43ebc1[_0x3bbf('0x3f')]};return db[_0x3bbf('0x2a')][_0x3bbf('0x20')](_0x3236d5)[_0x3bbf('0x25')](function(_0x8cd266){_0x1f6c10[_0x3bbf('0x20')]=_0x8cd266;if(_0xa17922['query'][_0x3bbf('0x40')]){_0x43ebc1[_0x3bbf('0x41')]=[{'all':!![]}];}return db[_0x3bbf('0x2a')][_0x3bbf('0x42')](_0x43ebc1);})[_0x3bbf('0x25')](function(_0x44d608){_0x1f6c10[_0x3bbf('0x43')]=_0x44d608;return _0x1f6c10;})[_0x3bbf('0x25')](respondWithFilteredResult(_0x4fa872,_0x43ebc1))[_0x3bbf('0x44')](handleError(_0x4fa872,null));};exports[_0x3bbf('0x45')]=function(_0x37e127,_0x1d0572){var _0x2d21aa={'raw':!![],'where':{'id':_0x37e127[_0x3bbf('0x46')]['id']}},_0x388206={};_0x388206[_0x3bbf('0x2e')]=_['keys'](db['CmCustomField'][_0x3bbf('0x2b')]);_0x388206['query']=_[_0x3bbf('0x31')](_0x37e127['query']);_0x388206[_0x3bbf('0x3a')]=_[_0x3bbf('0x32')](_0x388206['model'],_0x388206[_0x3bbf('0x30')]);_0x2d21aa['attributes']=_[_0x3bbf('0x32')](_0x388206['model'],qs[_0x3bbf('0x33')](_0x37e127[_0x3bbf('0x30')][_0x3bbf('0x33')]));_0x2d21aa['attributes']=_0x2d21aa[_0x3bbf('0x34')]['length']?_0x2d21aa[_0x3bbf('0x34')]:_0x388206[_0x3bbf('0x2e')];if(_0x37e127[_0x3bbf('0x30')][_0x3bbf('0x40')]){_0x2d21aa[_0x3bbf('0x41')]=[{'all':!![]}];}_0x2d21aa=_[_0x3bbf('0x3c')]({},_0x2d21aa,_0x37e127[_0x3bbf('0x3e')]);return db[_0x3bbf('0x2a')][_0x3bbf('0x47')](_0x2d21aa)[_0x3bbf('0x25')](handleEntityNotFound(_0x1d0572,null))['then'](respondWithResult(_0x1d0572,null))[_0x3bbf('0x44')](handleError(_0x1d0572,null));};exports['update']=function(_0x541357,_0x381366){if(_0x541357['body']['id']){delete _0x541357[_0x3bbf('0x48')]['id'];}return db[_0x3bbf('0x2a')][_0x3bbf('0x47')]({'where':{'id':_0x541357['params']['id']}})[_0x3bbf('0x25')](handleEntityNotFound(_0x381366,null))[_0x3bbf('0x25')](saveUpdates(_0x541357[_0x3bbf('0x48')],null))[_0x3bbf('0x25')](respondWithResult(_0x381366,null))[_0x3bbf('0x44')](handleError(_0x381366,null));};exports[_0x3bbf('0x26')]=function(_0x5b7659,_0x2503a6){return db['CmCustomField'][_0x3bbf('0x47')]({'where':{'id':_0x5b7659[_0x3bbf('0x46')]['id']}})['then'](handleEntityNotFound(_0x2503a6,null))[_0x3bbf('0x25')](removeEntity(_0x2503a6,null))[_0x3bbf('0x44')](handleError(_0x2503a6,null));};exports[_0x3bbf('0x49')]=function(_0x27ea54,_0x5b4667){var _0x219754;return db[_0x3bbf('0x4a')][_0x3bbf('0x4b')](function(_0x317cba){return db[_0x3bbf('0x2a')][_0x3bbf('0x49')](_0x27ea54[_0x3bbf('0x48')],{'transaction':_0x317cba})[_0x3bbf('0x25')](function(_0x36e312){_0x219754=_0x36e312;var _0x2fb5b2={'type':db['Sequelize'][_0x3bbf('0x4c')],'transaction':_0x317cba};switch(_0x27ea54['body'][_0x3bbf('0x2d')]){case _0x3bbf('0x4d'):_0x2fb5b2[_0x3bbf('0x2d')]=db['Sequelize'][_0x3bbf('0x4c')];break;case _0x3bbf('0x4e'):_0x2fb5b2[_0x3bbf('0x2d')]=db['Sequelize']['INTEGER'];break;case _0x3bbf('0x4f'):_0x2fb5b2[_0x3bbf('0x2d')]=db['Sequelize']['BOOLEAN'];_0x2fb5b2[_0x3bbf('0x50')]=![];break;default:}return db[_0x3bbf('0x4a')]['queryInterface']['addColumn']('cm_contacts',util[_0x3bbf('0x51')](_0x3bbf('0x52'),_0x219754['id']),_0x2fb5b2);})['then'](function(){return _0x219754;});})['then'](respondWithResult(_0x5b4667,0xc9))[_0x3bbf('0x44')](handleError(_0x5b4667,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 71532aa..7eab1c6 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 _0x375b=['cm_custom_fields','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField'];(function(_0x1021cf,_0x5245b4){var _0x4fab21=function(_0x5b2ba6){while(--_0x5b2ba6){_0x1021cf['push'](_0x1021cf['shift']());}};_0x4fab21(++_0x5245b4);}(_0x375b,0x17a));var _0xb375=function(_0x383efa,_0x501eca){_0x383efa=_0x383efa-0x0;var _0x1e742b=_0x375b[_0x383efa];return _0x1e742b;};'use strict';var _=require(_0xb375('0x0'));var util=require(_0xb375('0x1'));var logger=require(_0xb375('0x2'))(_0xb375('0x3'));var moment=require(_0xb375('0x4'));var BPromise=require(_0xb375('0x5'));var rp=require(_0xb375('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb375('0x7'));var attributes=require(_0xb375('0x8'));module[_0xb375('0x9')]=function(_0x2e1ddf,_0x3acd8f){return _0x2e1ddf[_0xb375('0xa')](_0xb375('0xb'),attributes,{'tableName':_0xb375('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4833=['cm_custom_fields','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','define','CmCustomField'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0x4833,0xaa));var _0x3483=function(_0x37b0e1,_0x5f3934){_0x37b0e1=_0x37b0e1-0x0;var _0x24e3b2=_0x4833[_0x37b0e1];return _0x24e3b2;};'use strict';var _=require(_0x3483('0x0'));var util=require('util');var logger=require(_0x3483('0x1'))(_0x3483('0x2'));var moment=require(_0x3483('0x3'));var BPromise=require(_0x3483('0x4'));var rp=require(_0x3483('0x5'));var fs=require('fs');var path=require(_0x3483('0x6'));var rimraf=require(_0x3483('0x7'));var config=require(_0x3483('0x8'));var attributes=require(_0x3483('0x9'));module['exports']=function(_0x12876c,_0x21d194){return _0x12876c[_0x3483('0xa')](_0x3483('0xb'),attributes,{'tableName':_0x3483('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 23cdf70..7c22e67 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 _0xde08=['client','http','request','info','request\x20sent','debug','stringify','error','CmCustomField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3546eb,_0x440f3f){var _0xe660bf=function(_0x282566){while(--_0x282566){_0x3546eb['push'](_0x3546eb['shift']());}};_0xe660bf(++_0x440f3f);}(_0xde08,0x132));var _0x8de0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xde08[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8de0('0x0'));var util=require(_0x8de0('0x1'));var moment=require(_0x8de0('0x2'));var BPromise=require('bluebird');var rs=require(_0x8de0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8de0('0x4'))['db'];var utils=require(_0x8de0('0x5'));var logger=require(_0x8de0('0x6'))(_0x8de0('0x7'));var config=require(_0x8de0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8de0('0x9')][_0x8de0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2fcd6f,_0x5459eb,_0x3b3c73){return new BPromise(function(_0x2ad4c0,_0x468fb8){return client[_0x8de0('0xb')](_0x2fcd6f,_0x3b3c73)['then'](function(_0x33b5d4){logger[_0x8de0('0xc')]('CmCustomField,\x20%s,\x20%s',_0x5459eb,_0x8de0('0xd'));logger[_0x8de0('0xe')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x5459eb,_0x8de0('0xd'),JSON[_0x8de0('0xf')](_0x33b5d4));if(_0x33b5d4[_0x8de0('0x10')]){if(_0x33b5d4[_0x8de0('0x10')]['code']===0x1f4){logger[_0x8de0('0x10')](_0x8de0('0x11'),_0x5459eb,_0x33b5d4[_0x8de0('0x10')]['message']);return _0x468fb8(_0x33b5d4[_0x8de0('0x10')]['message']);}logger['error']('CmCustomField,\x20%s,\x20%s',_0x5459eb,_0x33b5d4[_0x8de0('0x10')][_0x8de0('0x12')]);return _0x2ad4c0(_0x33b5d4[_0x8de0('0x10')]['message']);}else{logger['info'](_0x8de0('0x11'),_0x5459eb,_0x8de0('0xd'));_0x2ad4c0(_0x33b5d4[_0x8de0('0x13')]['message']);}})[_0x8de0('0x14')](function(_0x186e35){logger['error'](_0x8de0('0x11'),_0x5459eb,_0x186e35);_0x468fb8(_0x186e35);});});} \ No newline at end of file +var _0x8f56=['request\x20sent','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','info','CmCustomField,\x20%s,\x20%s'];(function(_0x12b732,_0xfa4108){var _0x5011a4=function(_0x4fe2b2){while(--_0x4fe2b2){_0x12b732['push'](_0x12b732['shift']());}};_0x5011a4(++_0xfa4108);}(_0x8f56,0x1e2));var _0x68f5=function(_0x1337a7,_0x108adc){_0x1337a7=_0x1337a7-0x0;var _0x3542f1=_0x8f56[_0x1337a7];return _0x3542f1;};'use strict';var _=require(_0x68f5('0x0'));var util=require('util');var moment=require(_0x68f5('0x1'));var BPromise=require('bluebird');var rs=require(_0x68f5('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x68f5('0x3'))['db'];var utils=require(_0x68f5('0x4'));var logger=require(_0x68f5('0x5'))(_0x68f5('0x6'));var config=require('../../config/environment');var jayson=require(_0x68f5('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x214702,_0x1bb4f7,_0x10285f){return new BPromise(function(_0x670688,_0x424c48){return client[_0x68f5('0x8')](_0x214702,_0x10285f)['then'](function(_0x46c39e){logger[_0x68f5('0x9')](_0x68f5('0xa'),_0x1bb4f7,_0x68f5('0xb'));logger['debug'](_0x68f5('0xc'),_0x1bb4f7,_0x68f5('0xb'),JSON[_0x68f5('0xd')](_0x46c39e));if(_0x46c39e[_0x68f5('0xe')]){if(_0x46c39e[_0x68f5('0xe')]['code']===0x1f4){logger[_0x68f5('0xe')](_0x68f5('0xa'),_0x1bb4f7,_0x46c39e['error'][_0x68f5('0xf')]);return _0x424c48(_0x46c39e[_0x68f5('0xe')]['message']);}logger[_0x68f5('0xe')](_0x68f5('0xa'),_0x1bb4f7,_0x46c39e[_0x68f5('0xe')][_0x68f5('0xf')]);return _0x670688(_0x46c39e[_0x68f5('0xe')][_0x68f5('0xf')]);}else{logger[_0x68f5('0x9')](_0x68f5('0xa'),_0x1bb4f7,_0x68f5('0xb'));_0x670688(_0x46c39e[_0x68f5('0x10')]['message']);}})['catch'](function(_0x17c10b){logger[_0x68f5('0xe')](_0x68f5('0xa'),_0x1bb4f7,_0x17c10b);_0x424c48(_0x17c10b);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 65a4345..6fd0d5f 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 _0xd9a8=['update','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','/:id','post','create'];(function(_0x512c83,_0x42a67a){var _0x1f7f25=function(_0x1e656c){while(--_0x1e656c){_0x512c83['push'](_0x512c83['shift']());}};_0x1f7f25(++_0x42a67a);}(_0xd9a8,0xc3));var _0x8d9a=function(_0x19584e,_0x528482){_0x19584e=_0x19584e-0x0;var _0x5725b0=_0xd9a8[_0x19584e];return _0x5725b0;};'use strict';var multer=require(_0x8d9a('0x0'));var util=require(_0x8d9a('0x1'));var path=require(_0x8d9a('0x2'));var timeout=require('connect-timeout');var express=require(_0x8d9a('0x3'));var router=express[_0x8d9a('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8d9a('0x5'));var config=require(_0x8d9a('0x6'));var controller=require(_0x8d9a('0x7'));router[_0x8d9a('0x8')]('/',auth[_0x8d9a('0x9')](),controller['index']);router[_0x8d9a('0x8')](_0x8d9a('0xa'),auth[_0x8d9a('0x9')](),controller['show']);router[_0x8d9a('0xb')]('/',auth[_0x8d9a('0x9')](),controller[_0x8d9a('0xc')]);router['put'](_0x8d9a('0xa'),auth[_0x8d9a('0x9')](),controller[_0x8d9a('0xd')]);router['delete'](_0x8d9a('0xa'),auth['isAuthenticated'](),controller[_0x8d9a('0xe')]);module[_0x8d9a('0xf')]=router; \ No newline at end of file +var _0x85d8=['isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xb5fc12,_0x52af9e){var _0x41063c=function(_0x425ef1){while(--_0x425ef1){_0xb5fc12['push'](_0xb5fc12['shift']());}};_0x41063c(++_0x52af9e);}(_0x85d8,0x1b0));var _0x885d=function(_0x45e2e3,_0x4bae24){_0x45e2e3=_0x45e2e3-0x0;var _0x1fb43b=_0x85d8[_0x45e2e3];return _0x1fb43b;};'use strict';var multer=require(_0x885d('0x0'));var util=require(_0x885d('0x1'));var path=require(_0x885d('0x2'));var timeout=require(_0x885d('0x3'));var express=require(_0x885d('0x4'));var router=express['Router']();var fs_extra=require(_0x885d('0x5'));var auth=require(_0x885d('0x6'));var interaction=require(_0x885d('0x7'));var config=require(_0x885d('0x8'));var controller=require('./cmCustomField.controller');router['get']('/',auth[_0x885d('0x9')](),controller[_0x885d('0xa')]);router[_0x885d('0xb')](_0x885d('0xc'),auth[_0x885d('0x9')](),controller[_0x885d('0xd')]);router[_0x885d('0xe')]('/',auth[_0x885d('0x9')](),controller[_0x885d('0xf')]);router[_0x885d('0x10')](_0x885d('0xc'),auth[_0x885d('0x9')](),controller[_0x885d('0x11')]);router[_0x885d('0x12')](_0x885d('0xc'),auth[_0x885d('0x9')](),controller[_0x885d('0x13')]);module[_0x885d('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 889dcbd..0be7e0c 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 _0x7ae0=['INTEGER','BOOLEAN','UNSIGNED','contactListQueue','moment','sequelize','exports','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x113e32,_0x5339f0){var _0x4ff939=function(_0x2be9ca){while(--_0x2be9ca){_0x113e32['push'](_0x113e32['shift']());}};_0x4ff939(++_0x5339f0);}(_0x7ae0,0x10c));var _0x07ae=function(_0x502764,_0x1b5205){_0x502764=_0x502764-0x0;var _0xdf680e=_0x7ae0[_0x502764];return _0xdf680e;};'use strict';var moment=require(_0x07ae('0x0'));var Sequelize=require(_0x07ae('0x1'));module[_0x07ae('0x2')]={'phone':{'type':Sequelize[_0x07ae('0x3')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x07ae('0x4')],'defaultValue':moment()[_0x07ae('0x5')](_0x07ae('0x6'))},'countbusyretry':{'type':Sequelize[_0x07ae('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x07ae('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x07ae('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x07ae('0x8')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x07ae('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x07ae('0x4')]},'priority':{'type':Sequelize[_0x07ae('0x7')](0x2)[_0x07ae('0x9')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x07ae('0x8')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x07ae('0x7')],'unique':'contactListQueue'},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x07ae('0xa')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0x07ae('0x7')],'unique':_0x07ae('0xa')},'CampaignId':{'type':Sequelize[_0x07ae('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0x07ae('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x07ae('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x07ae('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x07ae('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x1bdb=['YYYY-MM-DD\x20HH:mm:ss','INTEGER','STRING','DATE','UNSIGNED','contactListQueue','sequelize','exports','BOOLEAN','format'];(function(_0x53ba51,_0x2f2321){var _0x2e776e=function(_0x16b5cf){while(--_0x16b5cf){_0x53ba51['push'](_0x53ba51['shift']());}};_0x2e776e(++_0x2f2321);}(_0x1bdb,0x11e));var _0xb1bd=function(_0x86f100,_0x5614c5){_0x86f100=_0x86f100-0x0;var _0x5a2093=_0x1bdb[_0x86f100];return _0x5a2093;};'use strict';var moment=require('moment');var Sequelize=require(_0xb1bd('0x0'));module[_0xb1bd('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0xb1bd('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0xb1bd('0x3')](_0xb1bd('0x4'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xb1bd('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xb1bd('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xb1bd('0x6')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xb1bd('0x7')]},'priority':{'type':Sequelize[_0xb1bd('0x5')](0x2)[_0xb1bd('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xb1bd('0x5')],'unique':_0xb1bd('0x9')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0xb1bd('0x9')},'UserId':{'type':Sequelize[_0xb1bd('0x5')]},'VoiceQueueId':{'type':Sequelize[_0xb1bd('0x5')],'unique':_0xb1bd('0x9')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xb1bd('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xb1bd('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xb1bd('0x5')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index e0a1ca0..2af07a3 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 _0x93b7=['findAll','rows','keys','length','find','catch','create','body','params','describe','VoiceQueueId','VoiceQueue','Campaign','CampaignId','omit','dataValues','state','deleted','campaign','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','sequelize','transaction','prev','isEmpty','hopperIds','priority','ASC','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','literal','findOne','scheduledat','LOCK','UPDATE','Contact','CmCompany','Company','CmList','List','Queue','dialActive','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','Content-Range','json','reject','save','update','then','destroy','end','error','stack','name','map','CmHopper','fieldName','type','key','query','intersection','model','filters','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$any','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','filter','merge','VIRTUAL','options','includeAll','include'];(function(_0x40a14a,_0x5d0526){var _0x3e5182=function(_0x58f560){while(--_0x58f560){_0x40a14a['push'](_0x40a14a['shift']());}};_0x3e5182(++_0x5d0526);}(_0x93b7,0x163));var _0x793b=function(_0x3c327d,_0x1c6652){_0x3c327d=_0x3c327d-0x0;var _0x15bdbe=_0x93b7[_0x3c327d];return _0x15bdbe;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x793b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x793b('0x1'));var rp=require(_0x793b('0x2'));var moment=require(_0x793b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x793b('0x4'));var util=require(_0x793b('0x5'));var path=require('path');var sox=require(_0x793b('0x6'));var csv=require(_0x793b('0x7'));var ejs=require(_0x793b('0x8'));var fs=require('fs');var fs_extra=require(_0x793b('0x9'));var _=require(_0x793b('0xa'));var squel=require(_0x793b('0xb'));var crypto=require('crypto');var jsforce=require(_0x793b('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x793b('0xd'));var Papa=require('papaparse');var Redis=require(_0x793b('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x793b('0xf'));var as=require(_0x793b('0x10'));var hardwareService=require(_0x793b('0x11'));var logger=require(_0x793b('0x12'))(_0x793b('0x13'));var utils=require('../../config/utils');var config=require(_0x793b('0x14'));var licenseUtil=require(_0x793b('0x15'));var db=require(_0x793b('0x16'))['db'];function respondWithStatusCode(_0x3d1ff0,_0x4ae443){_0x4ae443=_0x4ae443||0xcc;return function(_0x19da2c){if(_0x19da2c){return _0x3d1ff0[_0x793b('0x17')](_0x4ae443);}return _0x3d1ff0['status'](_0x4ae443)['end']();};}function respondWithResult(_0x53cfa4,_0x2a9545){_0x2a9545=_0x2a9545||0xc8;return function(_0x4ce27a){if(_0x4ce27a){return _0x53cfa4[_0x793b('0x18')](_0x2a9545)['json'](_0x4ce27a);}};}function respondWithFilteredResult(_0x1fc40e,_0x662d46){return function(_0x5b34b3){if(_0x5b34b3){var _0x59ae95=typeof _0x662d46[_0x793b('0x19')]===_0x793b('0x1a')&&typeof _0x662d46['limit']===_0x793b('0x1a');var _0x54ee75=_0x5b34b3['count'];var _0x1fade0=_0x59ae95?0x0:_0x662d46['offset'];var _0x4a4cc9=_0x59ae95?_0x5b34b3[_0x793b('0x1b')]:_0x662d46[_0x793b('0x19')]+_0x662d46['limit'];var _0x393ad6;if(_0x4a4cc9>=_0x54ee75){_0x4a4cc9=_0x54ee75;_0x393ad6=0xc8;}else{_0x393ad6=0xce;}_0x1fc40e['status'](_0x393ad6);return _0x1fc40e['set'](_0x793b('0x1c'),_0x1fade0+'-'+_0x4a4cc9+'/'+_0x54ee75)[_0x793b('0x1d')](_0x5b34b3);}return null;};}function patchUpdates(_0x2cac18){return function(_0x5a43da){try{jsonpatch['apply'](_0x5a43da,_0x2cac18,!![]);}catch(_0x2c01da){return BPromise[_0x793b('0x1e')](_0x2c01da);}return _0x5a43da[_0x793b('0x1f')]();};}function saveUpdates(_0x14478b,_0x3bd197){return function(_0x299c42){if(_0x299c42){return _0x299c42[_0x793b('0x20')](_0x14478b)[_0x793b('0x21')](function(_0x3e0beb){return _0x3e0beb;});}return null;};}function removeEntity(_0x4cad0e,_0xba8067){return function(_0x299bce){if(_0x299bce){return _0x299bce[_0x793b('0x22')]()['then'](function(){_0x4cad0e[_0x793b('0x18')](0xcc)[_0x793b('0x23')]();});}};}function handleEntityNotFound(_0x6854c3,_0x4dcd7d){return function(_0x36c1e1){if(!_0x36c1e1){_0x6854c3['sendStatus'](0x194);}return _0x36c1e1;};}function handleError(_0x1038e6,_0xc6d4a2){_0xc6d4a2=_0xc6d4a2||0x1f4;return function(_0x480705){logger[_0x793b('0x24')](_0x480705[_0x793b('0x25')]);if(_0x480705[_0x793b('0x26')]){delete _0x480705[_0x793b('0x26')];}_0x1038e6[_0x793b('0x18')](_0xc6d4a2)['send'](_0x480705);};}exports['index']=function(_0x509f1c,_0x55763a){var _0x165890={},_0x54948f={},_0x467c68={'count':0x0,'rows':[]};var _0x303b7f=_[_0x793b('0x27')](db[_0x793b('0x28')]['rawAttributes'],function(_0x18b45b){return{'name':_0x18b45b[_0x793b('0x29')],'type':_0x18b45b[_0x793b('0x2a')][_0x793b('0x2b')]};});_0x54948f['model']=_['map'](_0x303b7f,_0x793b('0x26'));_0x54948f[_0x793b('0x2c')]=_['keys'](_0x509f1c[_0x793b('0x2c')]);_0x54948f['filters']=_[_0x793b('0x2d')](_0x54948f[_0x793b('0x2e')],_0x54948f[_0x793b('0x2c')]);_0x54948f['filters']=_['concat'](_0x54948f[_0x793b('0x2f')],[_0x793b('0x30'),_0x793b('0x31'),_0x793b('0x32'),_0x793b('0x33'),_0x793b('0x34'),_0x793b('0x35'),_0x793b('0x36'),_0x793b('0x37'),_0x793b('0x38'),_0x793b('0x39'),'$notBetween',_0x793b('0x3a'),_0x793b('0x3b'),_0x793b('0x3c'),_0x793b('0x3d'),_0x793b('0x3e'),_0x793b('0x3f'),_0x793b('0x3c'),_0x793b('0x40'),_0x793b('0x41'),'$contained',_0x793b('0x42')]);_0x165890[_0x793b('0x43')]=_[_0x793b('0x2d')](_0x54948f[_0x793b('0x2e')],qs[_0x793b('0x44')](_0x509f1c['query'][_0x793b('0x44')]));_0x165890[_0x793b('0x43')]=_0x165890[_0x793b('0x43')]['length']?_0x165890[_0x793b('0x43')]:_0x54948f[_0x793b('0x2e')];if(!_0x509f1c['query'][_0x793b('0x45')](_0x793b('0x46'))){_0x165890[_0x793b('0x47')]=qs[_0x793b('0x47')](_0x509f1c[_0x793b('0x2c')]['limit']);_0x165890[_0x793b('0x19')]=qs[_0x793b('0x19')](_0x509f1c[_0x793b('0x2c')][_0x793b('0x19')]);}_0x165890['order']=qs[_0x793b('0x48')](_0x509f1c['query'][_0x793b('0x48')]);_0x165890[_0x793b('0x49')]=qs[_0x793b('0x2f')](_['pick'](_0x509f1c[_0x793b('0x2c')],_0x54948f['filters']),_0x303b7f);if(_0x509f1c['query'][_0x793b('0x4a')]){_0x165890['where']=_[_0x793b('0x4b')](_0x165890[_0x793b('0x49')],{'$or':_['map'](_0x303b7f,function(_0x594f7c){if(_0x594f7c['type']!==_0x793b('0x4c')){var _0x5e5004={};_0x5e5004[_0x594f7c[_0x793b('0x26')]]={'$like':'%'+_0x509f1c['query']['filter']+'%'};return _0x5e5004;}})});}_0x165890=_[_0x793b('0x4b')]({},_0x165890,_0x509f1c[_0x793b('0x4d')]);var _0x264353={'where':_0x165890[_0x793b('0x49')]};return db[_0x793b('0x28')][_0x793b('0x1b')](_0x264353)[_0x793b('0x21')](function(_0x230aeb){_0x467c68[_0x793b('0x1b')]=_0x230aeb;if(_0x509f1c[_0x793b('0x2c')][_0x793b('0x4e')]){_0x165890[_0x793b('0x4f')]=[{'all':!![]}];}return db[_0x793b('0x28')][_0x793b('0x50')](_0x165890);})[_0x793b('0x21')](function(_0x31c248){_0x467c68[_0x793b('0x51')]=_0x31c248;return _0x467c68;})[_0x793b('0x21')](respondWithFilteredResult(_0x55763a,_0x165890))['catch'](handleError(_0x55763a,null));};exports['show']=function(_0x1df349,_0x5d7695){var _0x49d093={'raw':!![],'where':{'id':_0x1df349['params']['id']}},_0x1f0d1d={};_0x1f0d1d[_0x793b('0x2e')]=_[_0x793b('0x52')](db[_0x793b('0x28')]['rawAttributes']);_0x1f0d1d[_0x793b('0x2c')]=_[_0x793b('0x52')](_0x1df349[_0x793b('0x2c')]);_0x1f0d1d[_0x793b('0x2f')]=_[_0x793b('0x2d')](_0x1f0d1d[_0x793b('0x2e')],_0x1f0d1d[_0x793b('0x2c')]);_0x49d093[_0x793b('0x43')]=_[_0x793b('0x2d')](_0x1f0d1d['model'],qs[_0x793b('0x44')](_0x1df349[_0x793b('0x2c')][_0x793b('0x44')]));_0x49d093[_0x793b('0x43')]=_0x49d093[_0x793b('0x43')][_0x793b('0x53')]?_0x49d093[_0x793b('0x43')]:_0x1f0d1d[_0x793b('0x2e')];if(_0x1df349[_0x793b('0x2c')]['includeAll']){_0x49d093[_0x793b('0x4f')]=[{'all':!![]}];}_0x49d093=_[_0x793b('0x4b')]({},_0x49d093,_0x1df349[_0x793b('0x4d')]);return db[_0x793b('0x28')][_0x793b('0x54')](_0x49d093)[_0x793b('0x21')](handleEntityNotFound(_0x5d7695,null))[_0x793b('0x21')](respondWithResult(_0x5d7695,null))[_0x793b('0x55')](handleError(_0x5d7695,null));};exports[_0x793b('0x56')]=function(_0x40711b,_0xa27ab7){return db[_0x793b('0x28')][_0x793b('0x56')](_0x40711b[_0x793b('0x57')],{})[_0x793b('0x21')](respondWithResult(_0xa27ab7,0xc9))[_0x793b('0x55')](handleError(_0xa27ab7,null));};exports['update']=function(_0x4afc88,_0x577fa6){if(_0x4afc88[_0x793b('0x57')]['id']){delete _0x4afc88[_0x793b('0x57')]['id'];}return db[_0x793b('0x28')]['find']({'where':{'id':_0x4afc88[_0x793b('0x58')]['id']}})[_0x793b('0x21')](handleEntityNotFound(_0x577fa6,null))[_0x793b('0x21')](saveUpdates(_0x4afc88['body'],null))[_0x793b('0x21')](respondWithResult(_0x577fa6,null))[_0x793b('0x55')](handleError(_0x577fa6,null));};exports[_0x793b('0x59')]=function(_0x1452f6,_0x510d7c){return db['CmHopper'][_0x793b('0x59')]()[_0x793b('0x21')](respondWithResult(_0x510d7c,null))['catch'](handleError(_0x510d7c,null));};exports[_0x793b('0x22')]=function(_0x14a9e7,_0x37b8c0){var _0xed51bf;return db[_0x793b('0x28')][_0x793b('0x54')]({'where':{'id':_0x14a9e7[_0x793b('0x58')]['id']}})['then'](handleEntityNotFound(_0x37b8c0,null))[_0x793b('0x21')](function(_0x486aaa){if(_0x486aaa){return _0x486aaa[_0x793b('0x22')]()[_0x793b('0x21')](function(_0x85d7fe){return _0x85d7fe;});}})[_0x793b('0x21')](function(_0x2443a5){_0xed51bf=_0x2443a5;if(_0x2443a5){if(_0x2443a5[_0x793b('0x5a')]||_0x2443a5['CampaignId']){return db[_0x2443a5[_0x793b('0x5a')]?_0x793b('0x5b'):_0x793b('0x5c')]['find']({'where':{'id':_0x2443a5[_0x793b('0x5a')]?_0x2443a5[_0x793b('0x5a')]:_0x2443a5[_0x793b('0x5d')]},'attributes':['id',_0x793b('0x26')],'raw':!![]});}}})['then'](function(_0x33e07d){var _0x25ad6b={};if(_0x33e07d){_['merge'](_0x25ad6b,_[_0x793b('0x5e')](_0xed51bf[_0x793b('0x5f')],['createdAt','updatedAt','id']));_0x25ad6b[_0x793b('0x60')]=0x15;_0x25ad6b['statedesc']=_0x793b('0x61');_0x25ad6b[_0x793b('0x62')]=_0x33e07d[_0x793b('0x26')];_0x25ad6b[_0x793b('0x63')]=_0x14a9e7[_0x793b('0x64')]['name'];_0x25ad6b[_0x793b('0x65')]=_0x14a9e7[_0x793b('0x64')]['id'];_0x25ad6b[_0x793b('0x61')]=!![];_0x25ad6b[_0x793b('0x66')]=moment()[_0x793b('0x67')](_0x793b('0x68'));_0x25ad6b[_0x793b('0x69')]=_0xed51bf[_0x793b('0x6a')];_0x25ad6b['campaigntype']=_0xed51bf[_0x793b('0x5a')]?_0x793b('0x6b'):_0x793b('0x6c');return db[_0x793b('0x6d')][_0x793b('0x54')]({'where':{'id':_0x25ad6b[_0x793b('0x6e')]},'attributes':[_0x793b('0x6f'),_0x793b('0x70')]})[_0x793b('0x21')](function(_0x410e6b){if(!_[_0x793b('0x71')](_0x37b8c0)&&!_['isNil'](_0x410e6b[_0x793b('0x6f')])){_0x25ad6b[_0x793b('0x72')]=_0x410e6b[_0x793b('0x6f')];if(!_[_0x793b('0x71')](_0x410e6b[_0x793b('0x70')])){_0x25ad6b[_0x793b('0x72')]+='\x20'+_0x410e6b[_0x793b('0x70')];}}})[_0x793b('0x73')](function(){return db[_0x793b('0x74')][_0x793b('0x56')](_0x25ad6b);});}})[_0x793b('0x21')](function(){return _0x37b8c0['status'](0xcc)[_0x793b('0x23')]();})[_0x793b('0x55')](handleError(_0x37b8c0,null));};exports['getPreview']=function(_0x4e8e31,_0x248c11,_0x50d721){var _0x986c5=[];return db[_0x793b('0x6d')][_0x793b('0x59')]()['then'](function(_0x37888d){_0x986c5=_[_0x793b('0x52')](_0x37888d);return _0x4e8e31[_0x793b('0x64')][_0x793b('0x75')]({'where':{'type':_0x793b('0x76'),'dialActive':!![],'dialMethod':_0x793b('0x77')},'attributes':['id',_0x793b('0x78')],'raw':!![]});})['then'](function(_0x3c9b05){if(_0x3c9b05&&_0x3c9b05[_0x793b('0x53')]){return db[_0x793b('0x79')][_0x793b('0x7a')](function(_0xec877a){var _0x7f3fe4={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x793b('0x67')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x793b('0x27')](_0x3c9b05,'id')},'$or':[{'UserId':null},{'UserId':_0x4e8e31[_0x793b('0x64')]['id']}]};var _0x309093=[];if(_0x4e8e31['body']['direction']&&_0x4e8e31['body']['direction']===_0x793b('0x7b')){if(!_[_0x793b('0x7c')](_0x4e8e31[_0x793b('0x57')][_0x793b('0x7d')])){_0x7f3fe4['id']={'$in':_0x4e8e31['body'][_0x793b('0x7d')]};}_0x309093=[[_0x793b('0x7e'),_0x793b('0x7f')],['scheduledAt',_0x3c9b05[0x0]['dialOrderByScheduledAt']===_0x793b('0x7f')?'DESC':_0x793b('0x7f')],db[_0x793b('0x79')]['literal'](_0x793b('0x80')),['id',_0x793b('0x81')]];}else{if(!_[_0x793b('0x7c')](_0x4e8e31[_0x793b('0x57')][_0x793b('0x7d')])){_0x7f3fe4['id']={'$notIn':_0x4e8e31[_0x793b('0x57')][_0x793b('0x7d')]};}_0x309093=[[_0x793b('0x7e'),_0x793b('0x81')],['scheduledAt',_0x3c9b05[0x0][_0x793b('0x78')]],db['sequelize'][_0x793b('0x82')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x793b('0x7f')]];}return db['CmHopper'][_0x793b('0x83')]({'attributes':['id',_0x793b('0x84')],'where':_0x7f3fe4,'order':_0x309093,'transaction':_0xec877a,'lock':_0xec877a[_0x793b('0x85')][_0x793b('0x86')],'include':[{'model':db['CmContact'],'as':_0x793b('0x87'),'attributes':_0x986c5,'include':[{'model':db[_0x793b('0x88')],'as':_0x793b('0x89'),'attributes':['id',_0x793b('0x26')]}]},{'model':db[_0x793b('0x8a')],'as':_0x793b('0x8b'),'attributes':['id',_0x793b('0x26')]},{'model':db[_0x793b('0x5b')],'as':_0x793b('0x8c'),'attributes':['id','name',_0x793b('0x8d')]}]})[_0x793b('0x21')](function(_0x48e589){if(_0x48e589){return _0x48e589[_0x793b('0x20')]({'UserId':_0x4e8e31['user']['id']},{'transaction':_0xec877a});}});});}})[_0x793b('0x21')](handleEntityNotFound(_0x248c11,null))['then'](respondWithResult(_0x248c11,null))['catch'](handleError(_0x248c11,null));};exports[_0x793b('0x8e')]=function(_0x7b7e17,_0xd6788,_0x2c2a21){return _0x7b7e17['user'][_0x793b('0x75')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x793b('0x77')},'attributes':['id'],'raw':!![]})[_0x793b('0x21')](function(_0x6696d6){if(_0x6696d6&&_0x6696d6['length']){return db['CmHopper'][_0x793b('0x1b')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x793b('0x67')](_0x793b('0x68'))},'VoiceQueueId':{'$in':_[_0x793b('0x27')](_0x6696d6,'id')},'$or':[{'UserId':null},{'UserId':_0x7b7e17[_0x793b('0x64')]['id']}]}});}return 0x0;})[_0x793b('0x21')](function(_0x273338){if(!_[_0x793b('0x71')](_0x273338)&&_[_0x793b('0x8f')](_0x273338)){return _0xd6788[_0x793b('0x18')](0xc8)[_0x793b('0x1d')]({'contacts':_0x273338});}else{logger[_0x793b('0x24')](_0x793b('0x90'),_0x793b('0x8e'),0x194,'entity\x20not\x20found');_0xd6788[_0x793b('0x17')](0x194);}})['catch'](handleError(_0xd6788,null));}; \ No newline at end of file +var _0x164f=['priority','scheduledAt','DESC','ASC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','LOCK','UPDATE','CmList','List','dialActive','getOpenContacts','isNumber','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','squel','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','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','CmHopper','type','model','query','keys','filters','concat','$or','$gte','$lt','$lte','$eq','$between','$in','$like','$iLike','$notILike','$overlap','$contains','$contained','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','length','find','catch','create','body','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','state','deleted','campaign','membername','user','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','sequelize','transaction','direction','prev','isEmpty','hopperIds'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0x164f,0x124));var _0xf164=function(_0x33b20e,_0x5580f1){_0x33b20e=_0x33b20e-0x0;var _0x47080e=_0x164f[_0x33b20e];return _0x47080e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf164('0x0'));var zipdir=require(_0xf164('0x1'));var jsonpatch=require(_0xf164('0x2'));var rp=require(_0xf164('0x3'));var moment=require('moment');var BPromise=require(_0xf164('0x4'));var Mustache=require('mustache');var util=require(_0xf164('0x5'));var path=require(_0xf164('0x6'));var sox=require(_0xf164('0x7'));var csv=require(_0xf164('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf164('0x9'));var _=require('lodash');var squel=require(_0xf164('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf164('0xb'));var toCsv=require('to-csv');var querystring=require(_0xf164('0xc'));var Papa=require('papaparse');var Redis=require(_0xf164('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xf164('0xe'));var as=require(_0xf164('0xf'));var hardwareService=require(_0xf164('0x10'));var logger=require(_0xf164('0x11'))(_0xf164('0x12'));var utils=require(_0xf164('0x13'));var config=require(_0xf164('0x14'));var licenseUtil=require(_0xf164('0x15'));var db=require(_0xf164('0x16'))['db'];function respondWithStatusCode(_0x2ffd7a,_0x151495){_0x151495=_0x151495||0xcc;return function(_0x33e8ed){if(_0x33e8ed){return _0x2ffd7a[_0xf164('0x17')](_0x151495);}return _0x2ffd7a[_0xf164('0x18')](_0x151495)['end']();};}function respondWithResult(_0x140780,_0x4d9688){_0x4d9688=_0x4d9688||0xc8;return function(_0x1553fd){if(_0x1553fd){return _0x140780[_0xf164('0x18')](_0x4d9688)[_0xf164('0x19')](_0x1553fd);}};}function respondWithFilteredResult(_0x4287b,_0x66325a){return function(_0x554edd){if(_0x554edd){var _0x1a3e53=typeof _0x66325a[_0xf164('0x1a')]===_0xf164('0x1b')&&typeof _0x66325a[_0xf164('0x1c')]===_0xf164('0x1b');var _0x43d9f9=_0x554edd[_0xf164('0x1d')];var _0x21b703=_0x1a3e53?0x0:_0x66325a['offset'];var _0x58f868=_0x1a3e53?_0x554edd[_0xf164('0x1d')]:_0x66325a['offset']+_0x66325a[_0xf164('0x1c')];var _0x2d5a46;if(_0x58f868>=_0x43d9f9){_0x58f868=_0x43d9f9;_0x2d5a46=0xc8;}else{_0x2d5a46=0xce;}_0x4287b[_0xf164('0x18')](_0x2d5a46);return _0x4287b[_0xf164('0x1e')](_0xf164('0x1f'),_0x21b703+'-'+_0x58f868+'/'+_0x43d9f9)[_0xf164('0x19')](_0x554edd);}return null;};}function patchUpdates(_0x1a81fa){return function(_0x11ade2){try{jsonpatch[_0xf164('0x20')](_0x11ade2,_0x1a81fa,!![]);}catch(_0x17645){return BPromise[_0xf164('0x21')](_0x17645);}return _0x11ade2[_0xf164('0x22')]();};}function saveUpdates(_0x658602,_0x18209e){return function(_0x1e3cf2){if(_0x1e3cf2){return _0x1e3cf2[_0xf164('0x23')](_0x658602)[_0xf164('0x24')](function(_0xe09ea6){return _0xe09ea6;});}return null;};}function removeEntity(_0x1c5b31,_0x5acf87){return function(_0x149327){if(_0x149327){return _0x149327[_0xf164('0x25')]()['then'](function(){_0x1c5b31[_0xf164('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21b4de,_0xd8b51a){return function(_0x2dfcea){if(!_0x2dfcea){_0x21b4de['sendStatus'](0x194);}return _0x2dfcea;};}function handleError(_0x437e2b,_0x38a596){_0x38a596=_0x38a596||0x1f4;return function(_0x14e8a1){logger[_0xf164('0x26')](_0x14e8a1[_0xf164('0x27')]);if(_0x14e8a1[_0xf164('0x28')]){delete _0x14e8a1['name'];}_0x437e2b['status'](_0x38a596)['send'](_0x14e8a1);};}exports[_0xf164('0x29')]=function(_0x414443,_0x6d9d4f){var _0x5b1b72={},_0xd2478f={},_0x57e1f8={'count':0x0,'rows':[]};var _0x281239=_[_0xf164('0x2a')](db[_0xf164('0x2b')]['rawAttributes'],function(_0x3dcc48){return{'name':_0x3dcc48['fieldName'],'type':_0x3dcc48[_0xf164('0x2c')]['key']};});_0xd2478f[_0xf164('0x2d')]=_[_0xf164('0x2a')](_0x281239,_0xf164('0x28'));_0xd2478f[_0xf164('0x2e')]=_[_0xf164('0x2f')](_0x414443[_0xf164('0x2e')]);_0xd2478f[_0xf164('0x30')]=_['intersection'](_0xd2478f[_0xf164('0x2d')],_0xd2478f[_0xf164('0x2e')]);_0xd2478f[_0xf164('0x30')]=_[_0xf164('0x31')](_0xd2478f[_0xf164('0x30')],['$and',_0xf164('0x32'),'$gt',_0xf164('0x33'),_0xf164('0x34'),_0xf164('0x35'),'$ne',_0xf164('0x36'),'$not',_0xf164('0x37'),'$notBetween',_0xf164('0x38'),'$notIn',_0xf164('0x39'),'$notLike',_0xf164('0x3a'),_0xf164('0x3b'),_0xf164('0x39'),_0xf164('0x3c'),_0xf164('0x3d'),_0xf164('0x3e'),'$any']);_0x5b1b72['attributes']=_[_0xf164('0x3f')](_0xd2478f[_0xf164('0x2d')],qs[_0xf164('0x40')](_0x414443[_0xf164('0x2e')][_0xf164('0x40')]));_0x5b1b72['attributes']=_0x5b1b72[_0xf164('0x41')]['length']?_0x5b1b72['attributes']:_0xd2478f['model'];if(!_0x414443[_0xf164('0x2e')]['hasOwnProperty'](_0xf164('0x42'))){_0x5b1b72['limit']=qs['limit'](_0x414443[_0xf164('0x2e')][_0xf164('0x1c')]);_0x5b1b72[_0xf164('0x1a')]=qs[_0xf164('0x1a')](_0x414443[_0xf164('0x2e')][_0xf164('0x1a')]);}_0x5b1b72[_0xf164('0x43')]=qs['sort'](_0x414443[_0xf164('0x2e')][_0xf164('0x44')]);_0x5b1b72[_0xf164('0x45')]=qs['filters'](_[_0xf164('0x46')](_0x414443['query'],_0xd2478f[_0xf164('0x30')]),_0x281239);if(_0x414443['query'][_0xf164('0x47')]){_0x5b1b72[_0xf164('0x45')]=_['merge'](_0x5b1b72['where'],{'$or':_[_0xf164('0x2a')](_0x281239,function(_0x431742){if(_0x431742[_0xf164('0x2c')]!==_0xf164('0x48')){var _0x473dfb={};_0x473dfb[_0x431742[_0xf164('0x28')]]={'$like':'%'+_0x414443[_0xf164('0x2e')][_0xf164('0x47')]+'%'};return _0x473dfb;}})});}_0x5b1b72=_[_0xf164('0x49')]({},_0x5b1b72,_0x414443[_0xf164('0x4a')]);var _0x237a73={'where':_0x5b1b72[_0xf164('0x45')]};return db[_0xf164('0x2b')][_0xf164('0x1d')](_0x237a73)[_0xf164('0x24')](function(_0x295732){_0x57e1f8[_0xf164('0x1d')]=_0x295732;if(_0x414443[_0xf164('0x2e')][_0xf164('0x4b')]){_0x5b1b72[_0xf164('0x4c')]=[{'all':!![]}];}return db[_0xf164('0x2b')][_0xf164('0x4d')](_0x5b1b72);})[_0xf164('0x24')](function(_0x39f2fc){_0x57e1f8[_0xf164('0x4e')]=_0x39f2fc;return _0x57e1f8;})[_0xf164('0x24')](respondWithFilteredResult(_0x6d9d4f,_0x5b1b72))['catch'](handleError(_0x6d9d4f,null));};exports[_0xf164('0x4f')]=function(_0x253995,_0x54fc4a){var _0x52bc22={'raw':!![],'where':{'id':_0x253995[_0xf164('0x50')]['id']}},_0xad3719={};_0xad3719[_0xf164('0x2d')]=_[_0xf164('0x2f')](db['CmHopper']['rawAttributes']);_0xad3719[_0xf164('0x2e')]=_[_0xf164('0x2f')](_0x253995['query']);_0xad3719[_0xf164('0x30')]=_[_0xf164('0x3f')](_0xad3719[_0xf164('0x2d')],_0xad3719[_0xf164('0x2e')]);_0x52bc22[_0xf164('0x41')]=_[_0xf164('0x3f')](_0xad3719['model'],qs['fields'](_0x253995[_0xf164('0x2e')][_0xf164('0x40')]));_0x52bc22[_0xf164('0x41')]=_0x52bc22[_0xf164('0x41')][_0xf164('0x51')]?_0x52bc22[_0xf164('0x41')]:_0xad3719[_0xf164('0x2d')];if(_0x253995[_0xf164('0x2e')][_0xf164('0x4b')]){_0x52bc22[_0xf164('0x4c')]=[{'all':!![]}];}_0x52bc22=_['merge']({},_0x52bc22,_0x253995[_0xf164('0x4a')]);return db[_0xf164('0x2b')][_0xf164('0x52')](_0x52bc22)[_0xf164('0x24')](handleEntityNotFound(_0x54fc4a,null))['then'](respondWithResult(_0x54fc4a,null))[_0xf164('0x53')](handleError(_0x54fc4a,null));};exports[_0xf164('0x54')]=function(_0x768aef,_0x3c31b8){return db[_0xf164('0x2b')][_0xf164('0x54')](_0x768aef['body'],{})[_0xf164('0x24')](respondWithResult(_0x3c31b8,0xc9))[_0xf164('0x53')](handleError(_0x3c31b8,null));};exports['update']=function(_0x3c3564,_0xbcb21d){if(_0x3c3564[_0xf164('0x55')]['id']){delete _0x3c3564[_0xf164('0x55')]['id'];}return db['CmHopper'][_0xf164('0x52')]({'where':{'id':_0x3c3564[_0xf164('0x50')]['id']}})[_0xf164('0x24')](handleEntityNotFound(_0xbcb21d,null))[_0xf164('0x24')](saveUpdates(_0x3c3564[_0xf164('0x55')],null))[_0xf164('0x24')](respondWithResult(_0xbcb21d,null))[_0xf164('0x53')](handleError(_0xbcb21d,null));};exports['describe']=function(_0xb46142,_0x3f7436){return db[_0xf164('0x2b')][_0xf164('0x56')]()[_0xf164('0x24')](respondWithResult(_0x3f7436,null))[_0xf164('0x53')](handleError(_0x3f7436,null));};exports[_0xf164('0x25')]=function(_0x39d9a8,_0x5048df){var _0x3a9767;return db['CmHopper'][_0xf164('0x52')]({'where':{'id':_0x39d9a8[_0xf164('0x50')]['id']}})[_0xf164('0x24')](handleEntityNotFound(_0x5048df,null))['then'](function(_0xe4f4be){if(_0xe4f4be){return _0xe4f4be[_0xf164('0x25')]()['then'](function(_0x296438){return _0x296438;});}})[_0xf164('0x24')](function(_0x364542){_0x3a9767=_0x364542;if(_0x364542){if(_0x364542[_0xf164('0x57')]||_0x364542[_0xf164('0x58')]){return db[_0x364542[_0xf164('0x57')]?_0xf164('0x59'):_0xf164('0x5a')][_0xf164('0x52')]({'where':{'id':_0x364542[_0xf164('0x57')]?_0x364542[_0xf164('0x57')]:_0x364542[_0xf164('0x58')]},'attributes':['id',_0xf164('0x28')],'raw':!![]});}}})[_0xf164('0x24')](function(_0x43eb28){var _0x3bdded={};if(_0x43eb28){_[_0xf164('0x49')](_0x3bdded,_[_0xf164('0x5b')](_0x3a9767[_0xf164('0x5c')],[_0xf164('0x5d'),'updatedAt','id']));_0x3bdded[_0xf164('0x5e')]=0x15;_0x3bdded['statedesc']=_0xf164('0x5f');_0x3bdded[_0xf164('0x60')]=_0x43eb28['name'];_0x3bdded[_0xf164('0x61')]=_0x39d9a8['user'][_0xf164('0x28')];_0x3bdded['UserId']=_0x39d9a8[_0xf164('0x62')]['id'];_0x3bdded[_0xf164('0x5f')]=!![];_0x3bdded['deletedat']=moment()[_0xf164('0x63')](_0xf164('0x64'));_0x3bdded[_0xf164('0x65')]=_0x3a9767[_0xf164('0x66')];_0x3bdded[_0xf164('0x67')]=_0x3a9767[_0xf164('0x57')]?_0xf164('0x68'):_0xf164('0x69');return db[_0xf164('0x6a')][_0xf164('0x52')]({'where':{'id':_0x3bdded[_0xf164('0x6b')]},'attributes':[_0xf164('0x6c'),_0xf164('0x6d')]})[_0xf164('0x24')](function(_0x2421f4){if(!_[_0xf164('0x6e')](_0x5048df)&&!_['isNil'](_0x2421f4[_0xf164('0x6c')])){_0x3bdded['calleridname']=_0x2421f4[_0xf164('0x6c')];if(!_[_0xf164('0x6e')](_0x2421f4[_0xf164('0x6d')])){_0x3bdded[_0xf164('0x6f')]+='\x20'+_0x2421f4[_0xf164('0x6d')];}}})[_0xf164('0x70')](function(){return db[_0xf164('0x71')][_0xf164('0x54')](_0x3bdded);});}})[_0xf164('0x24')](function(){return _0x5048df['status'](0xcc)['end']();})['catch'](handleError(_0x5048df,null));};exports[_0xf164('0x72')]=function(_0x1fae4c,_0x541da9,_0x24a178){var _0x3cbc40=[];return db[_0xf164('0x6a')][_0xf164('0x56')]()[_0xf164('0x24')](function(_0x35ae7e){_0x3cbc40=_[_0xf164('0x2f')](_0x35ae7e);return _0x1fae4c[_0xf164('0x62')][_0xf164('0x73')]({'where':{'type':_0xf164('0x74'),'dialActive':!![],'dialMethod':_0xf164('0x75')},'attributes':['id',_0xf164('0x76')],'raw':!![]});})[_0xf164('0x24')](function(_0x507f01){if(_0x507f01&&_0x507f01[_0xf164('0x51')]){return db[_0xf164('0x77')][_0xf164('0x78')](function(_0x20779f){var _0x5cfc90={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xf164('0x63')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0xf164('0x2a')](_0x507f01,'id')},'$or':[{'UserId':null},{'UserId':_0x1fae4c[_0xf164('0x62')]['id']}]};var _0x5c4a0c=[];if(_0x1fae4c[_0xf164('0x55')][_0xf164('0x79')]&&_0x1fae4c['body'][_0xf164('0x79')]===_0xf164('0x7a')){if(!_[_0xf164('0x7b')](_0x1fae4c['body'][_0xf164('0x7c')])){_0x5cfc90['id']={'$in':_0x1fae4c[_0xf164('0x55')][_0xf164('0x7c')]};}_0x5c4a0c=[[_0xf164('0x7d'),'ASC'],[_0xf164('0x7e'),_0x507f01[0x0]['dialOrderByScheduledAt']==='ASC'?_0xf164('0x7f'):_0xf164('0x80')],db[_0xf164('0x77')][_0xf164('0x81')](_0xf164('0x82')),['id',_0xf164('0x7f')]];}else{if(!_['isEmpty'](_0x1fae4c[_0xf164('0x55')][_0xf164('0x7c')])){_0x5cfc90['id']={'$notIn':_0x1fae4c[_0xf164('0x55')]['hopperIds']};}_0x5c4a0c=[[_0xf164('0x7d'),_0xf164('0x7f')],[_0xf164('0x7e'),_0x507f01[0x0]['dialOrderByScheduledAt']],db[_0xf164('0x77')][_0xf164('0x81')](_0xf164('0x83')),['id',_0xf164('0x80')]];}return db[_0xf164('0x2b')]['findOne']({'attributes':['id','scheduledat'],'where':_0x5cfc90,'order':_0x5c4a0c,'transaction':_0x20779f,'lock':_0x20779f[_0xf164('0x84')][_0xf164('0x85')],'include':[{'model':db[_0xf164('0x6a')],'as':'Contact','attributes':_0x3cbc40,'include':[{'model':db['CmCompany'],'as':'Company','attributes':['id',_0xf164('0x28')]}]},{'model':db[_0xf164('0x86')],'as':_0xf164('0x87'),'attributes':['id',_0xf164('0x28')]},{'model':db['VoiceQueue'],'as':'Queue','attributes':['id',_0xf164('0x28'),_0xf164('0x88')]}]})[_0xf164('0x24')](function(_0xbf8647){if(_0xbf8647){return _0xbf8647[_0xf164('0x23')]({'UserId':_0x1fae4c[_0xf164('0x62')]['id']},{'transaction':_0x20779f});}});});}})[_0xf164('0x24')](handleEntityNotFound(_0x541da9,null))['then'](respondWithResult(_0x541da9,null))[_0xf164('0x53')](handleError(_0x541da9,null));};exports[_0xf164('0x89')]=function(_0xb74ad5,_0x703baf,_0x665224){return _0xb74ad5[_0xf164('0x62')]['getVoiceQueues']({'where':{'type':_0xf164('0x74'),'dialActive':!![],'dialMethod':_0xf164('0x75')},'attributes':['id'],'raw':!![]})['then'](function(_0x287883){if(_0x287883&&_0x287883[_0xf164('0x51')]){return db['CmHopper']['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xf164('0x64'))},'VoiceQueueId':{'$in':_[_0xf164('0x2a')](_0x287883,'id')},'$or':[{'UserId':null},{'UserId':_0xb74ad5['user']['id']}]}});}return 0x0;})[_0xf164('0x24')](function(_0x1e5bfb){if(!_[_0xf164('0x6e')](_0x1e5bfb)&&_[_0xf164('0x8a')](_0x1e5bfb)){return _0x703baf[_0xf164('0x18')](0xc8)['json']({'contacts':_0x1e5bfb});}else{logger[_0xf164('0x26')]('CmHopper,\x20%s,\x20%s,\x20%s',_0xf164('0x89'),0x194,'entity\x20not\x20found');_0x703baf[_0xf164('0x17')](0x194);}})[_0xf164('0x53')](handleError(_0x703baf,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 73db090..2ad43c8 100644 --- a/server/api/cmHopper/cmHopper.model.js +++ b/server/api/cmHopper/cmHopper.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfdbd=['path','rimraf','./cmHopper.attributes','scheduledat','phone','priority','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x52c6ec,_0x4d0a18){var _0x1172ca=function(_0x1de6b8){while(--_0x1de6b8){_0x52c6ec['push'](_0x52c6ec['shift']());}};_0x1172ca(++_0x4d0a18);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x3f59b1,_0x25cdbe){_0x3f59b1=_0x3f59b1-0x0;var _0x11d2e8=_0xfdbd[_0x3f59b1];return _0x11d2e8;};'use strict';var _=require(_0xdfdb('0x0'));var util=require(_0xdfdb('0x1'));var logger=require(_0xdfdb('0x2'))(_0xdfdb('0x3'));var moment=require(_0xdfdb('0x4'));var BPromise=require(_0xdfdb('0x5'));var rp=require(_0xdfdb('0x6'));var fs=require('fs');var path=require(_0xdfdb('0x7'));var rimraf=require(_0xdfdb('0x8'));var config=require('../../config/environment');var attributes=require(_0xdfdb('0x9'));module['exports']=function(_0x453ef6,_0x41bd5e){return _0x453ef6['define']('CmHopper',attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0xdfdb('0xa'),'fields':[_0xdfdb('0xa')]},{'name':'phone','fields':[_0xdfdb('0xb')]},{'name':_0xdfdb('0xc'),'fields':[_0xdfdb('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x33af=['request-promise','path','rimraf','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','util','api','moment','bluebird'];(function(_0xc87a7e,_0x271178){var _0x528ec9=function(_0x5f2855){while(--_0x5f2855){_0xc87a7e['push'](_0xc87a7e['shift']());}};_0x528ec9(++_0x271178);}(_0x33af,0xec));var _0xf33a=function(_0x17b1c0,_0x5f48f5){_0x17b1c0=_0x17b1c0-0x0;var _0x5b0ff5=_0x33af[_0x17b1c0];return _0x5b0ff5;};'use strict';var _=require('lodash');var util=require(_0xf33a('0x0'));var logger=require('../../config/logger')(_0xf33a('0x1'));var moment=require(_0xf33a('0x2'));var BPromise=require(_0xf33a('0x3'));var rp=require(_0xf33a('0x4'));var fs=require('fs');var path=require(_0xf33a('0x5'));var rimraf=require(_0xf33a('0x6'));var config=require('../../config/environment');var attributes=require(_0xf33a('0x7'));module[_0xf33a('0x8')]=function(_0x583e54,_0xc0dd13){return _0x583e54[_0xf33a('0x9')](_0xf33a('0xa'),attributes,{'tableName':_0xf33a('0xb'),'paranoid':![],'indexes':[{'name':_0xf33a('0xc'),'fields':[_0xf33a('0xc')]},{'name':'phone','fields':[_0xf33a('0xd')]},{'name':_0xf33a('0xe'),'fields':[_0xf33a('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 1300f0e..52f27d7 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 _0x3239=['util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetCmHopper','CmHopper','findAll','options','raw','where','limit','include','model','attributes','map','ShowCmHopper','find','CreateCmHopper','create','body','debug','update','UpdateCmHopper','DestroyCmHopper','describe','sequelize','transaction','order','LOCK','CmContact','Contact','keys','Agent','name','voicePause','UserId','includes','push','GetContactDialer','MoveContactManagedDialer','destroy','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','UPDATE','length','GetCmHopperPreview','lodash'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x3239,0x167));var _0x9323=function(_0x499e35,_0x14e270){_0x499e35=_0x499e35-0x0;var _0x35ec0a=_0x3239[_0x499e35];return _0x35ec0a;};'use strict';var _=require(_0x9323('0x0'));var util=require(_0x9323('0x1'));var moment=require(_0x9323('0x2'));var BPromise=require(_0x9323('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9323('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9323('0x5'));var logger=require(_0x9323('0x6'))(_0x9323('0x7'));var config=require(_0x9323('0x8'));var jayson=require(_0x9323('0x9'));var client=jayson[_0x9323('0xa')][_0x9323('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x210427,_0x5a9f3a,_0xad956e){return new BPromise(function(_0x336172,_0x3a3e0a){return client['request'](_0x210427,_0xad956e)[_0x9323('0xc')](function(_0x445a93){logger[_0x9323('0xd')](_0x9323('0xe'),_0x5a9f3a,_0x9323('0xf'));logger['debug'](_0x9323('0x10'),_0x5a9f3a,_0x9323('0xf'),JSON[_0x9323('0x11')](_0x445a93));if(_0x445a93[_0x9323('0x12')]){if(_0x445a93[_0x9323('0x12')][_0x9323('0x13')]===0x1f4){logger['error'](_0x9323('0xe'),_0x5a9f3a,_0x445a93[_0x9323('0x12')][_0x9323('0x14')]);return _0x3a3e0a(_0x445a93[_0x9323('0x12')][_0x9323('0x14')]);}logger['error']('CmHopper,\x20%s,\x20%s',_0x5a9f3a,_0x445a93[_0x9323('0x12')]['message']);return _0x336172(_0x445a93[_0x9323('0x12')]['message']);}else{logger[_0x9323('0xd')](_0x9323('0xe'),_0x5a9f3a,_0x9323('0xf'));_0x336172(_0x445a93[_0x9323('0x15')][_0x9323('0x14')]);}})[_0x9323('0x16')](function(_0x1fab81){logger['error'](_0x9323('0xe'),_0x5a9f3a,_0x1fab81);_0x3a3e0a(_0x1fab81);});});}exports[_0x9323('0x17')]=function(_0x24d704){var _0x1170d5=this;return new Promise(function(_0x4033ef,_0x3d545a){return db[_0x9323('0x18')][_0x9323('0x19')]({'raw':_0x24d704['options']?_0x24d704[_0x9323('0x1a')][_0x9323('0x1b')]===undefined?!![]:![]:!![],'where':_0x24d704[_0x9323('0x1a')]?_0x24d704[_0x9323('0x1a')][_0x9323('0x1c')]||null:null,'attributes':_0x24d704[_0x9323('0x1a')]?_0x24d704[_0x9323('0x1a')]['attributes']||null:null,'limit':_0x24d704[_0x9323('0x1a')]?_0x24d704[_0x9323('0x1a')][_0x9323('0x1d')]||null:null,'include':_0x24d704[_0x9323('0x1a')]?_0x24d704['options'][_0x9323('0x1e')]?_['map'](_0x24d704['options'][_0x9323('0x1e')],function(_0x33e725){return{'model':db[_0x33e725[_0x9323('0x1f')]],'as':_0x33e725['as'],'attributes':_0x33e725[_0x9323('0x20')],'include':_0x33e725[_0x9323('0x1e')]?_['map'](_0x33e725[_0x9323('0x1e')],function(_0x449e3f){return{'model':db[_0x449e3f['model']],'as':_0x449e3f['as'],'attributes':_0x449e3f['attributes'],'include':_0x449e3f['include']?_[_0x9323('0x21')](_0x449e3f[_0x9323('0x1e')],function(_0x22d1db){return{'model':db[_0x22d1db[_0x9323('0x1f')]],'as':_0x22d1db['as'],'attributes':_0x22d1db[_0x9323('0x20')]};}):[]};}):[]};}):[]:[]})[_0x9323('0xc')](function(_0x24a9e4){logger[_0x9323('0xd')](_0x9323('0x17'),_0x24d704);logger['debug'](_0x9323('0x17'),_0x24d704,JSON[_0x9323('0x11')](_0x24a9e4));_0x4033ef(_0x24a9e4);})[_0x9323('0x16')](function(_0x3a9401){logger[_0x9323('0x12')](_0x9323('0x17'),_0x3a9401['message'],_0x24d704);_0x3d545a(_0x1170d5['error'](0x1f4,_0x3a9401[_0x9323('0x14')]));});});};exports[_0x9323('0x22')]=function(_0x59c20c){var _0x371980=this;return new Promise(function(_0x30814f,_0xe599ae){return db['CmHopper'][_0x9323('0x23')]({'raw':_0x59c20c['options']?_0x59c20c[_0x9323('0x1a')][_0x9323('0x1b')]===undefined?!![]:![]:!![],'where':_0x59c20c[_0x9323('0x1a')]?_0x59c20c[_0x9323('0x1a')][_0x9323('0x1c')]||null:null,'attributes':_0x59c20c['options']?_0x59c20c[_0x9323('0x1a')]['attributes']||null:null,'include':_0x59c20c[_0x9323('0x1a')]?_0x59c20c[_0x9323('0x1a')][_0x9323('0x1e')]?_['map'](_0x59c20c['options']['include'],function(_0x14b55f){return{'model':db[_0x14b55f[_0x9323('0x1f')]],'as':_0x14b55f['as'],'attributes':_0x14b55f['attributes'],'include':_0x14b55f[_0x9323('0x1e')]?_['map'](_0x14b55f[_0x9323('0x1e')],function(_0x467700){return{'model':db[_0x467700[_0x9323('0x1f')]],'as':_0x467700['as'],'attributes':_0x467700[_0x9323('0x20')],'include':_0x467700['include']?_[_0x9323('0x21')](_0x467700[_0x9323('0x1e')],function(_0x1ae7c0){return{'model':db[_0x1ae7c0[_0x9323('0x1f')]],'as':_0x1ae7c0['as'],'attributes':_0x1ae7c0[_0x9323('0x20')]};}):[]};}):[]};}):[]:[]})[_0x9323('0xc')](function(_0x500ff3){logger[_0x9323('0xd')](_0x9323('0x22'),_0x59c20c);logger['debug'](_0x9323('0x22'),_0x59c20c,JSON[_0x9323('0x11')](_0x500ff3));_0x30814f(_0x500ff3);})[_0x9323('0x16')](function(_0x3e741e){logger[_0x9323('0x12')](_0x9323('0x22'),_0x3e741e[_0x9323('0x14')],_0x59c20c);_0xe599ae(_0x371980[_0x9323('0x12')](0x1f4,_0x3e741e[_0x9323('0x14')]));});});};exports[_0x9323('0x24')]=function(_0x153961){var _0x20d087=this;return new Promise(function(_0x5708b4,_0x8c9c92){return db[_0x9323('0x18')][_0x9323('0x25')](_0x153961[_0x9323('0x26')],{'raw':_0x153961['options']?_0x153961['options'][_0x9323('0x1b')]===undefined?!![]:![]:!![]})[_0x9323('0xc')](function(_0x25f155){logger[_0x9323('0xd')](_0x9323('0x24'),_0x153961);logger[_0x9323('0x27')](_0x9323('0x24'),_0x153961,JSON[_0x9323('0x11')](_0x25f155));_0x5708b4(_0x25f155);})[_0x9323('0x16')](function(_0x458231){logger[_0x9323('0x12')](_0x9323('0x24'),_0x458231['message'],_0x153961);_0x8c9c92(_0x20d087[_0x9323('0x12')](0x1f4,_0x458231['message']));});});};exports['UpdateCmHopper']=function(_0x45f016){var _0x388e7c=this;return new Promise(function(_0x3d08b3,_0x2132bb){return db['CmHopper'][_0x9323('0x28')](_0x45f016['body'],{'raw':_0x45f016['options']?_0x45f016['options'][_0x9323('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45f016[_0x9323('0x1a')]?_0x45f016[_0x9323('0x1a')]['where']||null:null,'attributes':_0x45f016[_0x9323('0x1a')]?_0x45f016['options'][_0x9323('0x20')]||null:null,'limit':_0x45f016[_0x9323('0x1a')]?_0x45f016[_0x9323('0x1a')][_0x9323('0x1d')]||null:null})[_0x9323('0xc')](function(_0x4f66d2){logger[_0x9323('0xd')](_0x9323('0x29'),_0x45f016);logger['debug'](_0x9323('0x29'),_0x45f016,JSON[_0x9323('0x11')](_0x4f66d2));_0x3d08b3(_0x4f66d2);})[_0x9323('0x16')](function(_0x3bf006){logger[_0x9323('0x12')]('UpdateCmHopper',_0x3bf006[_0x9323('0x14')],_0x45f016);_0x2132bb(_0x388e7c[_0x9323('0x12')](0x1f4,_0x3bf006[_0x9323('0x14')]));});});};exports['DestroyCmHopper']=function(_0x28030a){var _0x28c9a2=this;return new Promise(function(_0x2707f8,_0x51bab3){return db[_0x9323('0x18')]['destroy']({'where':_0x28030a[_0x9323('0x1a')]?_0x28030a[_0x9323('0x1a')]['where']||null:null})[_0x9323('0xc')](function(_0x5ea872){logger[_0x9323('0xd')](_0x9323('0x2a'),_0x28030a);logger['debug']('DestroyCmHopper',_0x28030a,JSON[_0x9323('0x11')](_0x5ea872));_0x2707f8(_0x5ea872);})[_0x9323('0x16')](function(_0x5588b6){logger['error'](_0x9323('0x2a'),_0x5588b6[_0x9323('0x14')],_0x28030a);_0x51bab3(_0x28c9a2[_0x9323('0x12')](0x1f4,_0x5588b6['message']));});});};exports['GetContactDialer']=function(_0xa25d94){var _0x437758=this;return new Promise(function(_0x991cc3,_0xe806b6){return db['CmContact'][_0x9323('0x2b')]()['then'](function(_0x5b75e9){return db[_0x9323('0x2c')][_0x9323('0x2d')](function(_0x3a5e63){return db[_0x9323('0x18')][_0x9323('0x19')]({'where':_0xa25d94[_0x9323('0x1a')]?_0xa25d94[_0x9323('0x1a')][_0x9323('0x1c')]||null:null,'attributes':_0xa25d94[_0x9323('0x1a')]?_0xa25d94[_0x9323('0x1a')][_0x9323('0x20')]||null:null,'limit':_0xa25d94[_0x9323('0x1a')]?_0xa25d94[_0x9323('0x1a')][_0x9323('0x1d')]||null:null,'order':_0xa25d94[_0x9323('0x1a')]?_0xa25d94['options'][_0x9323('0x2e')]||null:null,'transaction':_0x3a5e63,'lock':_0x3a5e63[_0x9323('0x2f')]['UPDATE'],'include':[{'model':db[_0x9323('0x30')],'as':_0x9323('0x31'),'attributes':_[_0x9323('0x32')](_0x5b75e9)},{'model':db['User'],'as':_0x9323('0x33'),'attributes':['id',_0x9323('0x34'),_0x9323('0x35')]}]})['then'](function(_0x43f897){var _0x109479=[];var _0x36404c=[];for(var _0x1ac0fb=0x0;_0x1ac0fb<_0x43f897['length'];_0x1ac0fb+=0x1){var _0x33900b=_0x43f897[_0x1ac0fb][_0x9323('0x36')];if(_0x33900b===null){_0x109479['push'](_0x43f897[_0x1ac0fb]['update'](_0xa25d94[_0x9323('0x26')],{'transaction':_0x3a5e63}));}else if(!_0x36404c[_0x9323('0x37')](_0x33900b)){_0x36404c[_0x9323('0x38')](_0x33900b);_0x109479['push'](_0x43f897[_0x1ac0fb][_0x9323('0x28')](_0xa25d94[_0x9323('0x26')],{'transaction':_0x3a5e63}));}}return BPromise['all'](_0x109479);});})[_0x9323('0xc')](function(_0x3cdf2f){logger[_0x9323('0xd')]('GetContactDialer',_0xa25d94);logger[_0x9323('0x27')](_0x9323('0x39'),_0xa25d94,JSON[_0x9323('0x11')](_0x3cdf2f));_0x991cc3(_0x3cdf2f);})['catch'](function(_0x50e340){logger[_0x9323('0x12')]('GetContactDialer',_0x50e340['message'],_0xa25d94);_0xe806b6(_0x437758[_0x9323('0x12')](0x1f4,_0x50e340[_0x9323('0x14')]));});});});};exports[_0x9323('0x3a')]=function(_0x5c1a5d){var _0x2edd2f=this;return new Promise(function(_0x15ea11,_0x2596b0){return db[_0x9323('0x2c')][_0x9323('0x2d')](function(_0x404dfe){return db['CmHopperFinal'][_0x9323('0x25')](_0x5c1a5d[_0x9323('0x26')],{'raw':_0x5c1a5d[_0x9323('0x1a')]?_0x5c1a5d[_0x9323('0x1a')]['raw']===undefined?!![]:![]:!![],'transaction':_0x404dfe})[_0x9323('0xc')](function(){return db[_0x9323('0x18')][_0x9323('0x3b')]({'where':_0x5c1a5d['options']?_0x5c1a5d[_0x9323('0x1a')][_0x9323('0x1c')]||null:null,'transaction':_0x404dfe});});})[_0x9323('0xc')](function(_0x2ffd40){logger[_0x9323('0xd')](_0x9323('0x3a'),_0x5c1a5d);logger[_0x9323('0x27')]('MoveContactManagedDialer',_0x5c1a5d,JSON[_0x9323('0x11')](_0x2ffd40));_0x15ea11(_0x2ffd40);})['catch'](function(_0x4aadc4){logger[_0x9323('0x12')](_0x9323('0x3a'),_0x4aadc4[_0x9323('0x14')],_0x5c1a5d);_0x2596b0(_0x2edd2f[_0x9323('0x12')](0x1f4,_0x4aadc4[_0x9323('0x14')]));});});};exports[_0x9323('0x3c')]=function(_0x54c6b9){var _0x20b584=this;return new Promise(function(_0x573013,_0x62fa74){return db[_0x9323('0x18')][_0x9323('0x19')]({'raw':_0x54c6b9['options']?_0x54c6b9[_0x9323('0x1a')][_0x9323('0x1b')]===undefined?!![]:![]:!![],'where':_0x54c6b9[_0x9323('0x1a')]?_0x54c6b9[_0x9323('0x1a')]['where']||null:null,'attributes':[[db[_0x9323('0x2c')]['fn'](_0x9323('0x3d'),db['sequelize']['fn']('IF',db[_0x9323('0x2c')][_0x9323('0x3e')](_0x9323('0x3f')+util[_0x9323('0x40')](_0x9323('0x41'),moment()[_0x9323('0x40')]('YYYY-MM-DD\x20HH:mm:ss'))+_0x9323('0x42')))),_0x9323('0x43')]]})['then'](function(_0x35e399){logger['info'](_0x9323('0x3c'),_0x54c6b9);logger[_0x9323('0x27')](_0x9323('0x3c'),_0x54c6b9,JSON[_0x9323('0x11')](_0x35e399));_0x573013(_0x35e399);})[_0x9323('0x16')](function(_0x34c5a6){logger[_0x9323('0x12')]('CountReScheduled',_0x34c5a6[_0x9323('0x14')],_0x54c6b9);_0x62fa74(_0x20b584[_0x9323('0x12')](0x1f4,_0x34c5a6[_0x9323('0x14')]));});});};exports[_0x9323('0x44')]=function(_0x58f071){var _0x4c5b21=this;return new Promise(function(_0x4785f7,_0x18119f){return db[_0x9323('0x30')]['describe']()[_0x9323('0xc')](function(_0x154a49){return db[_0x9323('0x2c')][_0x9323('0x2d')](function(_0x422ea2){return db[_0x9323('0x18')][_0x9323('0x19')]({'where':_0x58f071[_0x9323('0x1a')]?_0x58f071[_0x9323('0x1a')][_0x9323('0x1c')]||null:null,'attributes':_0x58f071[_0x9323('0x1a')]?_0x58f071['options'][_0x9323('0x20')]||null:null,'limit':0x1,'order':_0x58f071[_0x9323('0x1a')]?_0x58f071[_0x9323('0x1a')][_0x9323('0x2e')]||null:null,'group':db[_0x9323('0x18')]['UserId'],'transaction':_0x422ea2,'lock':_0x422ea2['LOCK'][_0x9323('0x45')],'include':_0x58f071[_0x9323('0x1a')]?_0x58f071[_0x9323('0x1a')][_0x9323('0x1e')]?_[_0x9323('0x21')](_0x58f071['options'][_0x9323('0x1e')],function(_0x4a7bd2){return{'model':db[_0x4a7bd2['model']],'as':_0x4a7bd2['as'],'attributes':_0x4a7bd2[_0x9323('0x20')],'include':_0x4a7bd2[_0x9323('0x1e')]?_['map'](_0x4a7bd2[_0x9323('0x1e')],function(_0x2302aa){return{'model':db[_0x2302aa[_0x9323('0x1f')]],'as':_0x2302aa['as'],'attributes':_0x2302aa['attributes'],'include':_0x2302aa[_0x9323('0x1e')]?_[_0x9323('0x21')](_0x2302aa['include'],function(_0x19ec51){return{'model':db[_0x19ec51[_0x9323('0x1f')]],'as':_0x19ec51['as'],'attributes':_0x19ec51['attributes']};}):[]};}):[]};}):[]:[]})[_0x9323('0xc')](function(_0xb1f002){var _0x15b459=[];for(var _0x28b8fe=0x0;_0x28b8fe<_0xb1f002[_0x9323('0x46')];_0x28b8fe+=0x1){_0x15b459[_0x9323('0x38')](_0xb1f002[_0x28b8fe][_0x9323('0x28')](_0x58f071['body'],{'transaction':_0x422ea2}));}return BPromise['all'](_0x15b459);});})[_0x9323('0xc')](function(_0x32a103){logger[_0x9323('0xd')]('GetContactRecallMe',_0x58f071);logger[_0x9323('0x27')](_0x9323('0x44'),_0x58f071,JSON[_0x9323('0x11')](_0x32a103));_0x4785f7(_0x32a103);})[_0x9323('0x16')](function(_0xc3dd23){logger[_0x9323('0x12')](_0x9323('0x44'),_0xc3dd23[_0x9323('0x14')],_0x58f071);_0x18119f(_0x4c5b21['error'](0x1f4,_0xc3dd23[_0x9323('0x14')]));});});});};exports[_0x9323('0x47')]=function(_0x200e14){var _0x1e7729=this;return new Promise(function(_0x5aeb9e,_0x46e8fe){db[_0x9323('0x30')][_0x9323('0x2b')]()[_0x9323('0xc')](function(_0x100d13){return db['CmHopper'][_0x9323('0x19')]({'raw':_0x200e14[_0x9323('0x1a')]?_0x200e14['options'][_0x9323('0x1b')]===undefined?!![]:![]:!![],'where':_0x200e14[_0x9323('0x1a')]?_0x200e14[_0x9323('0x1a')][_0x9323('0x1c')]||null:null,'attributes':_0x200e14[_0x9323('0x1a')]?_0x200e14[_0x9323('0x1a')]['attributes']||null:null,'limit':_0x200e14['options']?_0x200e14[_0x9323('0x1a')]['limit']||null:null,'include':_0x200e14['options']?_0x200e14['options']['include']?_['map'](_0x200e14[_0x9323('0x1a')][_0x9323('0x1e')],function(_0x4944f9){return{'model':db[_0x4944f9[_0x9323('0x1f')]],'as':_0x4944f9['as'],'attributes':_0x4944f9['as']==='Contact'?_[_0x9323('0x32')](_0x100d13):_0x4944f9['attributes'],'include':_0x4944f9[_0x9323('0x1e')]?_[_0x9323('0x21')](_0x4944f9[_0x9323('0x1e')],function(_0x169ef5){return{'model':db[_0x169ef5[_0x9323('0x1f')]],'as':_0x169ef5['as'],'attributes':_0x169ef5[_0x9323('0x20')],'include':_0x169ef5['include']?_[_0x9323('0x21')](_0x169ef5[_0x9323('0x1e')],function(_0x54f1b5){return{'model':db[_0x54f1b5[_0x9323('0x1f')]],'as':_0x54f1b5['as'],'attributes':_0x54f1b5[_0x9323('0x20')]};}):[]};}):[]};}):[]:[]})[_0x9323('0xc')](function(_0x1fc53f){logger[_0x9323('0xd')](_0x9323('0x17'),_0x200e14);logger[_0x9323('0x27')](_0x9323('0x17'),_0x200e14,JSON[_0x9323('0x11')](_0x1fc53f));_0x5aeb9e(_0x1fc53f);})['catch'](function(_0x50012a){logger[_0x9323('0x12')]('GetCmHopper',_0x50012a[_0x9323('0x14')],_0x200e14);_0x46e8fe(_0x1e7729[_0x9323('0x12')](0x1f4,_0x50012a[_0x9323('0x14')]));});});});}; \ No newline at end of file +var _0xc3f5=['model','attributes','GetCmHopper','stringify','catch','ShowCmHopper','find','raw','CreateCmHopper','create','body','UpdateCmHopper','update','DestroyCmHopper','destroy','CmContact','describe','sequelize','transaction','order','UPDATE','Contact','keys','User','Agent','voicePause','UserId','push','includes','all','GetContactDialer','MoveContactManagedDialer','CmHopperFinal','CountReScheduled','COUNT','`scheduledat`\x20>=\x20','format','\x20,\x201,\x20null','LOCK','length','GetContactRecallMe','GetCmHopperPreview','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','error','code','message','info','CmHopper','findAll','options','where','limit','include','map'];(function(_0x4fce16,_0x3877f0){var _0x2c3540=function(_0x5ac709){while(--_0x5ac709){_0x4fce16['push'](_0x4fce16['shift']());}};_0x2c3540(++_0x3877f0);}(_0xc3f5,0x1da));var _0x5c3f=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xc3f5[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x5c3f('0x0'));var util=require(_0x5c3f('0x1'));var moment=require(_0x5c3f('0x2'));var BPromise=require(_0x5c3f('0x3'));var rs=require(_0x5c3f('0x4'));var fs=require('fs');var Redis=require(_0x5c3f('0x5'));var db=require(_0x5c3f('0x6'))['db'];var utils=require(_0x5c3f('0x7'));var logger=require(_0x5c3f('0x8'))(_0x5c3f('0x9'));var config=require(_0x5c3f('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x5c3f('0xb')][_0x5c3f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x50b22c,_0x304602,_0x20856d){return new BPromise(function(_0x5e28da,_0xe7a4ca){return client[_0x5c3f('0xd')](_0x50b22c,_0x20856d)[_0x5c3f('0xe')](function(_0x3ff346){logger['info'](_0x5c3f('0xf'),_0x304602,_0x5c3f('0x10'));logger[_0x5c3f('0x11')](_0x5c3f('0x12'),_0x304602,_0x5c3f('0x10'),JSON['stringify'](_0x3ff346));if(_0x3ff346[_0x5c3f('0x13')]){if(_0x3ff346[_0x5c3f('0x13')][_0x5c3f('0x14')]===0x1f4){logger[_0x5c3f('0x13')](_0x5c3f('0xf'),_0x304602,_0x3ff346[_0x5c3f('0x13')][_0x5c3f('0x15')]);return _0xe7a4ca(_0x3ff346['error'][_0x5c3f('0x15')]);}logger['error'](_0x5c3f('0xf'),_0x304602,_0x3ff346[_0x5c3f('0x13')][_0x5c3f('0x15')]);return _0x5e28da(_0x3ff346[_0x5c3f('0x13')]['message']);}else{logger[_0x5c3f('0x16')](_0x5c3f('0xf'),_0x304602,_0x5c3f('0x10'));_0x5e28da(_0x3ff346['result'][_0x5c3f('0x15')]);}})['catch'](function(_0x33b4e5){logger[_0x5c3f('0x13')](_0x5c3f('0xf'),_0x304602,_0x33b4e5);_0xe7a4ca(_0x33b4e5);});});}exports['GetCmHopper']=function(_0x4438b6){var _0x334188=this;return new Promise(function(_0x424bdf,_0x59d120){return db[_0x5c3f('0x17')][_0x5c3f('0x18')]({'raw':_0x4438b6['options']?_0x4438b6[_0x5c3f('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x4438b6[_0x5c3f('0x19')]?_0x4438b6[_0x5c3f('0x19')][_0x5c3f('0x1a')]||null:null,'attributes':_0x4438b6[_0x5c3f('0x19')]?_0x4438b6['options']['attributes']||null:null,'limit':_0x4438b6['options']?_0x4438b6[_0x5c3f('0x19')][_0x5c3f('0x1b')]||null:null,'include':_0x4438b6[_0x5c3f('0x19')]?_0x4438b6[_0x5c3f('0x19')][_0x5c3f('0x1c')]?_[_0x5c3f('0x1d')](_0x4438b6[_0x5c3f('0x19')][_0x5c3f('0x1c')],function(_0x58c056){return{'model':db[_0x58c056[_0x5c3f('0x1e')]],'as':_0x58c056['as'],'attributes':_0x58c056['attributes'],'include':_0x58c056['include']?_[_0x5c3f('0x1d')](_0x58c056['include'],function(_0x361369){return{'model':db[_0x361369['model']],'as':_0x361369['as'],'attributes':_0x361369[_0x5c3f('0x1f')],'include':_0x361369['include']?_[_0x5c3f('0x1d')](_0x361369[_0x5c3f('0x1c')],function(_0x9fdfc6){return{'model':db[_0x9fdfc6[_0x5c3f('0x1e')]],'as':_0x9fdfc6['as'],'attributes':_0x9fdfc6['attributes']};}):[]};}):[]};}):[]:[]})[_0x5c3f('0xe')](function(_0x1757c0){logger[_0x5c3f('0x16')](_0x5c3f('0x20'),_0x4438b6);logger[_0x5c3f('0x11')]('GetCmHopper',_0x4438b6,JSON[_0x5c3f('0x21')](_0x1757c0));_0x424bdf(_0x1757c0);})[_0x5c3f('0x22')](function(_0x236728){logger[_0x5c3f('0x13')](_0x5c3f('0x20'),_0x236728[_0x5c3f('0x15')],_0x4438b6);_0x59d120(_0x334188[_0x5c3f('0x13')](0x1f4,_0x236728[_0x5c3f('0x15')]));});});};exports[_0x5c3f('0x23')]=function(_0x26507f){var _0x389fda=this;return new Promise(function(_0x4e10a3,_0x548806){return db[_0x5c3f('0x17')][_0x5c3f('0x24')]({'raw':_0x26507f['options']?_0x26507f[_0x5c3f('0x19')][_0x5c3f('0x25')]===undefined?!![]:![]:!![],'where':_0x26507f[_0x5c3f('0x19')]?_0x26507f['options']['where']||null:null,'attributes':_0x26507f[_0x5c3f('0x19')]?_0x26507f['options'][_0x5c3f('0x1f')]||null:null,'include':_0x26507f[_0x5c3f('0x19')]?_0x26507f[_0x5c3f('0x19')]['include']?_[_0x5c3f('0x1d')](_0x26507f['options'][_0x5c3f('0x1c')],function(_0x288f62){return{'model':db[_0x288f62['model']],'as':_0x288f62['as'],'attributes':_0x288f62[_0x5c3f('0x1f')],'include':_0x288f62[_0x5c3f('0x1c')]?_[_0x5c3f('0x1d')](_0x288f62[_0x5c3f('0x1c')],function(_0x3232cf){return{'model':db[_0x3232cf[_0x5c3f('0x1e')]],'as':_0x3232cf['as'],'attributes':_0x3232cf[_0x5c3f('0x1f')],'include':_0x3232cf['include']?_[_0x5c3f('0x1d')](_0x3232cf[_0x5c3f('0x1c')],function(_0x3c9289){return{'model':db[_0x3c9289['model']],'as':_0x3c9289['as'],'attributes':_0x3c9289['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2f64fb){logger[_0x5c3f('0x16')]('ShowCmHopper',_0x26507f);logger[_0x5c3f('0x11')](_0x5c3f('0x23'),_0x26507f,JSON['stringify'](_0x2f64fb));_0x4e10a3(_0x2f64fb);})[_0x5c3f('0x22')](function(_0x1ee907){logger['error'](_0x5c3f('0x23'),_0x1ee907['message'],_0x26507f);_0x548806(_0x389fda[_0x5c3f('0x13')](0x1f4,_0x1ee907[_0x5c3f('0x15')]));});});};exports[_0x5c3f('0x26')]=function(_0x336cd5){var _0x563f9c=this;return new Promise(function(_0x129f11,_0x49d2fc){return db['CmHopper'][_0x5c3f('0x27')](_0x336cd5[_0x5c3f('0x28')],{'raw':_0x336cd5[_0x5c3f('0x19')]?_0x336cd5[_0x5c3f('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x5c3f('0xe')](function(_0x10b383){logger[_0x5c3f('0x16')](_0x5c3f('0x26'),_0x336cd5);logger[_0x5c3f('0x11')](_0x5c3f('0x26'),_0x336cd5,JSON[_0x5c3f('0x21')](_0x10b383));_0x129f11(_0x10b383);})[_0x5c3f('0x22')](function(_0x143221){logger[_0x5c3f('0x13')]('CreateCmHopper',_0x143221[_0x5c3f('0x15')],_0x336cd5);_0x49d2fc(_0x563f9c[_0x5c3f('0x13')](0x1f4,_0x143221[_0x5c3f('0x15')]));});});};exports[_0x5c3f('0x29')]=function(_0x4ef55c){var _0x392162=this;return new Promise(function(_0x4b7815,_0x58ce12){return db['CmHopper'][_0x5c3f('0x2a')](_0x4ef55c[_0x5c3f('0x28')],{'raw':_0x4ef55c['options']?_0x4ef55c[_0x5c3f('0x19')][_0x5c3f('0x25')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ef55c[_0x5c3f('0x19')]?_0x4ef55c[_0x5c3f('0x19')][_0x5c3f('0x1a')]||null:null,'attributes':_0x4ef55c['options']?_0x4ef55c[_0x5c3f('0x19')][_0x5c3f('0x1f')]||null:null,'limit':_0x4ef55c[_0x5c3f('0x19')]?_0x4ef55c['options'][_0x5c3f('0x1b')]||null:null})[_0x5c3f('0xe')](function(_0x464f62){logger[_0x5c3f('0x16')]('UpdateCmHopper',_0x4ef55c);logger['debug'](_0x5c3f('0x29'),_0x4ef55c,JSON[_0x5c3f('0x21')](_0x464f62));_0x4b7815(_0x464f62);})[_0x5c3f('0x22')](function(_0x4e54c2){logger['error'](_0x5c3f('0x29'),_0x4e54c2[_0x5c3f('0x15')],_0x4ef55c);_0x58ce12(_0x392162[_0x5c3f('0x13')](0x1f4,_0x4e54c2[_0x5c3f('0x15')]));});});};exports[_0x5c3f('0x2b')]=function(_0x1ba15a){var _0x52d97a=this;return new Promise(function(_0x916cef,_0x410a7f){return db[_0x5c3f('0x17')][_0x5c3f('0x2c')]({'where':_0x1ba15a[_0x5c3f('0x19')]?_0x1ba15a['options'][_0x5c3f('0x1a')]||null:null})['then'](function(_0x1a4c41){logger[_0x5c3f('0x16')](_0x5c3f('0x2b'),_0x1ba15a);logger['debug']('DestroyCmHopper',_0x1ba15a,JSON[_0x5c3f('0x21')](_0x1a4c41));_0x916cef(_0x1a4c41);})[_0x5c3f('0x22')](function(_0x432ee4){logger[_0x5c3f('0x13')]('DestroyCmHopper',_0x432ee4[_0x5c3f('0x15')],_0x1ba15a);_0x410a7f(_0x52d97a[_0x5c3f('0x13')](0x1f4,_0x432ee4[_0x5c3f('0x15')]));});});};exports['GetContactDialer']=function(_0x582877){var _0x3c1391=this;return new Promise(function(_0x1459a6,_0x13f5c){return db[_0x5c3f('0x2d')][_0x5c3f('0x2e')]()[_0x5c3f('0xe')](function(_0x211877){return db[_0x5c3f('0x2f')][_0x5c3f('0x30')](function(_0xf2f923){return db[_0x5c3f('0x17')][_0x5c3f('0x18')]({'where':_0x582877[_0x5c3f('0x19')]?_0x582877[_0x5c3f('0x19')][_0x5c3f('0x1a')]||null:null,'attributes':_0x582877['options']?_0x582877[_0x5c3f('0x19')][_0x5c3f('0x1f')]||null:null,'limit':_0x582877[_0x5c3f('0x19')]?_0x582877[_0x5c3f('0x19')]['limit']||null:null,'order':_0x582877[_0x5c3f('0x19')]?_0x582877[_0x5c3f('0x19')][_0x5c3f('0x31')]||null:null,'transaction':_0xf2f923,'lock':_0xf2f923['LOCK'][_0x5c3f('0x32')],'include':[{'model':db[_0x5c3f('0x2d')],'as':_0x5c3f('0x33'),'attributes':_[_0x5c3f('0x34')](_0x211877)},{'model':db[_0x5c3f('0x35')],'as':_0x5c3f('0x36'),'attributes':['id','name',_0x5c3f('0x37')]}]})[_0x5c3f('0xe')](function(_0x2256ec){var _0x3b3b76=[];var _0x39bb98=[];for(var _0x565ea6=0x0;_0x565ea6<_0x2256ec['length'];_0x565ea6+=0x1){var _0x378c24=_0x2256ec[_0x565ea6][_0x5c3f('0x38')];if(_0x378c24===null){_0x3b3b76[_0x5c3f('0x39')](_0x2256ec[_0x565ea6][_0x5c3f('0x2a')](_0x582877[_0x5c3f('0x28')],{'transaction':_0xf2f923}));}else if(!_0x39bb98[_0x5c3f('0x3a')](_0x378c24)){_0x39bb98[_0x5c3f('0x39')](_0x378c24);_0x3b3b76[_0x5c3f('0x39')](_0x2256ec[_0x565ea6]['update'](_0x582877['body'],{'transaction':_0xf2f923}));}}return BPromise[_0x5c3f('0x3b')](_0x3b3b76);});})['then'](function(_0x3c65a2){logger[_0x5c3f('0x16')](_0x5c3f('0x3c'),_0x582877);logger[_0x5c3f('0x11')](_0x5c3f('0x3c'),_0x582877,JSON['stringify'](_0x3c65a2));_0x1459a6(_0x3c65a2);})[_0x5c3f('0x22')](function(_0x51e473){logger[_0x5c3f('0x13')]('GetContactDialer',_0x51e473[_0x5c3f('0x15')],_0x582877);_0x13f5c(_0x3c1391[_0x5c3f('0x13')](0x1f4,_0x51e473[_0x5c3f('0x15')]));});});});};exports[_0x5c3f('0x3d')]=function(_0x4a69c9){var _0x52e871=this;return new Promise(function(_0x1bb140,_0x1089f6){return db['sequelize']['transaction'](function(_0x4e8cec){return db[_0x5c3f('0x3e')][_0x5c3f('0x27')](_0x4a69c9['body'],{'raw':_0x4a69c9[_0x5c3f('0x19')]?_0x4a69c9[_0x5c3f('0x19')]['raw']===undefined?!![]:![]:!![],'transaction':_0x4e8cec})[_0x5c3f('0xe')](function(){return db[_0x5c3f('0x17')]['destroy']({'where':_0x4a69c9[_0x5c3f('0x19')]?_0x4a69c9[_0x5c3f('0x19')][_0x5c3f('0x1a')]||null:null,'transaction':_0x4e8cec});});})[_0x5c3f('0xe')](function(_0x3ad5a9){logger['info'](_0x5c3f('0x3d'),_0x4a69c9);logger[_0x5c3f('0x11')](_0x5c3f('0x3d'),_0x4a69c9,JSON[_0x5c3f('0x21')](_0x3ad5a9));_0x1bb140(_0x3ad5a9);})['catch'](function(_0x1a94f4){logger['error']('MoveContactManagedDialer',_0x1a94f4[_0x5c3f('0x15')],_0x4a69c9);_0x1089f6(_0x52e871[_0x5c3f('0x13')](0x1f4,_0x1a94f4['message']));});});};exports[_0x5c3f('0x3f')]=function(_0x49ce70){var _0x2c9b0e=this;return new Promise(function(_0x99ae5a,_0x3affb8){return db[_0x5c3f('0x17')]['findAll']({'raw':_0x49ce70[_0x5c3f('0x19')]?_0x49ce70[_0x5c3f('0x19')][_0x5c3f('0x25')]===undefined?!![]:![]:!![],'where':_0x49ce70['options']?_0x49ce70[_0x5c3f('0x19')][_0x5c3f('0x1a')]||null:null,'attributes':[[db[_0x5c3f('0x2f')]['fn'](_0x5c3f('0x40'),db['sequelize']['fn']('IF',db[_0x5c3f('0x2f')]['literal'](_0x5c3f('0x41')+util[_0x5c3f('0x42')]('\x22%s\x22',moment()[_0x5c3f('0x42')]('YYYY-MM-DD\x20HH:mm:ss'))+_0x5c3f('0x43')))),'contactsRescheduled']]})[_0x5c3f('0xe')](function(_0xc676c0){logger['info'](_0x5c3f('0x3f'),_0x49ce70);logger[_0x5c3f('0x11')](_0x5c3f('0x3f'),_0x49ce70,JSON['stringify'](_0xc676c0));_0x99ae5a(_0xc676c0);})['catch'](function(_0x1d1699){logger[_0x5c3f('0x13')](_0x5c3f('0x3f'),_0x1d1699[_0x5c3f('0x15')],_0x49ce70);_0x3affb8(_0x2c9b0e['error'](0x1f4,_0x1d1699[_0x5c3f('0x15')]));});});};exports['GetContactRecallMe']=function(_0x520ab0){var _0x2cd02f=this;return new Promise(function(_0x54721f,_0x5a7a28){return db['CmContact'][_0x5c3f('0x2e')]()[_0x5c3f('0xe')](function(_0x29bcdf){return db[_0x5c3f('0x2f')][_0x5c3f('0x30')](function(_0x4bb215){return db['CmHopper'][_0x5c3f('0x18')]({'where':_0x520ab0[_0x5c3f('0x19')]?_0x520ab0[_0x5c3f('0x19')]['where']||null:null,'attributes':_0x520ab0[_0x5c3f('0x19')]?_0x520ab0['options']['attributes']||null:null,'limit':0x1,'order':_0x520ab0[_0x5c3f('0x19')]?_0x520ab0['options'][_0x5c3f('0x31')]||null:null,'group':db[_0x5c3f('0x17')]['UserId'],'transaction':_0x4bb215,'lock':_0x4bb215[_0x5c3f('0x44')]['UPDATE'],'include':_0x520ab0[_0x5c3f('0x19')]?_0x520ab0[_0x5c3f('0x19')][_0x5c3f('0x1c')]?_[_0x5c3f('0x1d')](_0x520ab0[_0x5c3f('0x19')]['include'],function(_0x561fe9){return{'model':db[_0x561fe9[_0x5c3f('0x1e')]],'as':_0x561fe9['as'],'attributes':_0x561fe9['attributes'],'include':_0x561fe9[_0x5c3f('0x1c')]?_['map'](_0x561fe9['include'],function(_0x2dc470){return{'model':db[_0x2dc470[_0x5c3f('0x1e')]],'as':_0x2dc470['as'],'attributes':_0x2dc470['attributes'],'include':_0x2dc470[_0x5c3f('0x1c')]?_[_0x5c3f('0x1d')](_0x2dc470[_0x5c3f('0x1c')],function(_0x3217ab){return{'model':db[_0x3217ab[_0x5c3f('0x1e')]],'as':_0x3217ab['as'],'attributes':_0x3217ab[_0x5c3f('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x5c3f('0xe')](function(_0x42ae42){var _0x4d8c61=[];for(var _0x4b708a=0x0;_0x4b708a<_0x42ae42[_0x5c3f('0x45')];_0x4b708a+=0x1){_0x4d8c61[_0x5c3f('0x39')](_0x42ae42[_0x4b708a][_0x5c3f('0x2a')](_0x520ab0[_0x5c3f('0x28')],{'transaction':_0x4bb215}));}return BPromise['all'](_0x4d8c61);});})[_0x5c3f('0xe')](function(_0x13a070){logger[_0x5c3f('0x16')](_0x5c3f('0x46'),_0x520ab0);logger[_0x5c3f('0x11')]('GetContactRecallMe',_0x520ab0,JSON[_0x5c3f('0x21')](_0x13a070));_0x54721f(_0x13a070);})[_0x5c3f('0x22')](function(_0x7b181){logger['error']('GetContactRecallMe',_0x7b181['message'],_0x520ab0);_0x5a7a28(_0x2cd02f[_0x5c3f('0x13')](0x1f4,_0x7b181['message']));});});});};exports[_0x5c3f('0x47')]=function(_0x5d20ab){var _0x410857=this;return new Promise(function(_0x34dc68,_0x58213e){db[_0x5c3f('0x2d')]['describe']()[_0x5c3f('0xe')](function(_0x3e987c){return db['CmHopper'][_0x5c3f('0x18')]({'raw':_0x5d20ab['options']?_0x5d20ab[_0x5c3f('0x19')][_0x5c3f('0x25')]===undefined?!![]:![]:!![],'where':_0x5d20ab[_0x5c3f('0x19')]?_0x5d20ab[_0x5c3f('0x19')][_0x5c3f('0x1a')]||null:null,'attributes':_0x5d20ab[_0x5c3f('0x19')]?_0x5d20ab[_0x5c3f('0x19')][_0x5c3f('0x1f')]||null:null,'limit':_0x5d20ab[_0x5c3f('0x19')]?_0x5d20ab[_0x5c3f('0x19')][_0x5c3f('0x1b')]||null:null,'include':_0x5d20ab[_0x5c3f('0x19')]?_0x5d20ab[_0x5c3f('0x19')][_0x5c3f('0x1c')]?_[_0x5c3f('0x1d')](_0x5d20ab[_0x5c3f('0x19')]['include'],function(_0x360210){return{'model':db[_0x360210[_0x5c3f('0x1e')]],'as':_0x360210['as'],'attributes':_0x360210['as']===_0x5c3f('0x33')?_[_0x5c3f('0x34')](_0x3e987c):_0x360210[_0x5c3f('0x1f')],'include':_0x360210['include']?_['map'](_0x360210[_0x5c3f('0x1c')],function(_0x3409df){return{'model':db[_0x3409df[_0x5c3f('0x1e')]],'as':_0x3409df['as'],'attributes':_0x3409df[_0x5c3f('0x1f')],'include':_0x3409df[_0x5c3f('0x1c')]?_['map'](_0x3409df[_0x5c3f('0x1c')],function(_0xcf4135){return{'model':db[_0xcf4135['model']],'as':_0xcf4135['as'],'attributes':_0xcf4135[_0x5c3f('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c22b7){logger['info'](_0x5c3f('0x20'),_0x5d20ab);logger[_0x5c3f('0x11')](_0x5c3f('0x20'),_0x5d20ab,JSON[_0x5c3f('0x21')](_0x3c22b7));_0x34dc68(_0x3c22b7);})['catch'](function(_0x26f072){logger[_0x5c3f('0x13')](_0x5c3f('0x20'),_0x26f072['message'],_0x5d20ab);_0x58213e(_0x410857[_0x5c3f('0x13')](0x1f4,_0x26f072[_0x5c3f('0x15')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 5e529aa..24bbba4 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 _0x18bc=['getOpenContacts','/:id','show','post','create','getPreview','put','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','./cmHopper.controller','get','isAuthenticated','index','describe'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x18bc,0x73));var _0xc18b=function(_0x5a47de,_0x57a87c){_0x5a47de=_0x5a47de-0x0;var _0x400ee6=_0x18bc[_0x5a47de];return _0x400ee6;};'use strict';var multer=require(_0xc18b('0x0'));var util=require(_0xc18b('0x1'));var path=require(_0xc18b('0x2'));var timeout=require(_0xc18b('0x3'));var express=require('express');var router=express[_0xc18b('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc18b('0x5'));var config=require('../../config/environment');var controller=require(_0xc18b('0x6'));router[_0xc18b('0x7')]('/',auth[_0xc18b('0x8')](),controller[_0xc18b('0x9')]);router[_0xc18b('0x7')]('/describe',auth['isAuthenticated'](),controller[_0xc18b('0xa')]);router[_0xc18b('0x7')]('/opencontacts',auth[_0xc18b('0x8')](),controller[_0xc18b('0xb')]);router[_0xc18b('0x7')](_0xc18b('0xc'),auth[_0xc18b('0x8')](),controller[_0xc18b('0xd')]);router[_0xc18b('0xe')]('/',auth[_0xc18b('0x8')](),controller[_0xc18b('0xf')]);router[_0xc18b('0xe')]('/preview',auth[_0xc18b('0x8')](),controller[_0xc18b('0x10')]);router[_0xc18b('0x11')](_0xc18b('0xc'),auth[_0xc18b('0x8')](),controller[_0xc18b('0x12')]);router['delete'](_0xc18b('0xc'),auth[_0xc18b('0x8')](),controller[_0xc18b('0x13')]);module[_0xc18b('0x14')]=router; \ No newline at end of file +var _0x6665=['update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','isAuthenticated','index','/describe','describe','/opencontacts','create','post','put'];(function(_0x3a94e1,_0x22e4fd){var _0x6a09d5=function(_0x2d6d1c){while(--_0x2d6d1c){_0x3a94e1['push'](_0x3a94e1['shift']());}};_0x6a09d5(++_0x22e4fd);}(_0x6665,0x69));var _0x5666=function(_0x480bc8,_0x1fac40){_0x480bc8=_0x480bc8-0x0;var _0x28c245=_0x6665[_0x480bc8];return _0x28c245;};'use strict';var multer=require(_0x5666('0x0'));var util=require(_0x5666('0x1'));var path=require(_0x5666('0x2'));var timeout=require(_0x5666('0x3'));var express=require(_0x5666('0x4'));var router=express[_0x5666('0x5')]();var fs_extra=require(_0x5666('0x6'));var auth=require(_0x5666('0x7'));var interaction=require(_0x5666('0x8'));var config=require(_0x5666('0x9'));var controller=require(_0x5666('0xa'));router[_0x5666('0xb')]('/',auth[_0x5666('0xc')](),controller[_0x5666('0xd')]);router[_0x5666('0xb')](_0x5666('0xe'),auth['isAuthenticated'](),controller[_0x5666('0xf')]);router[_0x5666('0xb')](_0x5666('0x10'),auth[_0x5666('0xc')](),controller['getOpenContacts']);router['get']('/:id',auth[_0x5666('0xc')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x5666('0x11')]);router[_0x5666('0x12')]('/preview',auth[_0x5666('0xc')](),controller['getPreview']);router[_0x5666('0x13')]('/:id',auth[_0x5666('0xc')](),controller[_0x5666('0x14')]);router[_0x5666('0x15')](_0x5666('0x16'),auth[_0x5666('0xc')](),controller[_0x5666('0x17')]);module[_0x5666('0x18')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 09d1eb3..089e176 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 _0x29e8=['contactListQueue','INTEGER','moment','sequelize','exports','STRING'];(function(_0x4caa97,_0x1dc557){var _0xc2dccc=function(_0x361dfd){while(--_0x361dfd){_0x4caa97['push'](_0x4caa97['shift']());}};_0xc2dccc(++_0x1dc557);}(_0x29e8,0x116));var _0x829e=function(_0x17276d,_0x4babf7){_0x17276d=_0x17276d-0x0;var _0x890f74=_0x29e8[_0x17276d];return _0x890f74;};'use strict';var moment=require(_0x829e('0x0'));var Sequelize=require(_0x829e('0x1'));module[_0x829e('0x2')]={'phone':{'type':Sequelize[_0x829e('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x829e('0x4')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x829e('0x4')},'VoiceQueueId':{'type':Sequelize[_0x829e('0x5')],'unique':_0x829e('0x4')}}; \ No newline at end of file +var _0xab33=['exports','INTEGER','contactListQueue','sequelize'];(function(_0x46d9cc,_0x4ec9ce){var _0xc70e83=function(_0x350790){while(--_0x350790){_0x46d9cc['push'](_0x46d9cc['shift']());}};_0xc70e83(++_0x4ec9ce);}(_0xab33,0x1a3));var _0x3ab3=function(_0x1693be,_0x4cf483){_0x1693be=_0x1693be-0x0;var _0x2140b6=_0xab33[_0x1693be];return _0x2140b6;};'use strict';var moment=require('moment');var Sequelize=require(_0x3ab3('0x0'));module[_0x3ab3('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0x3ab3('0x2')],'unique':'contactListQueue'},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x3ab3('0x3')},'VoiceQueueId':{'type':Sequelize[_0x3ab3('0x2')],'unique':_0x3ab3('0x3')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index f9d8c52..9092665 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 _0xbad5=['hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','CmHopperBlack','rows','catch','find','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length'];(function(_0x21a221,_0x7a9f65){var _0x4d3dd8=function(_0x2b0ca5){while(--_0x2b0ca5){_0x21a221['push'](_0x21a221['shift']());}};_0x4d3dd8(++_0x7a9f65);}(_0xbad5,0x1bc));var _0x5bad=function(_0x386376,_0x210813){_0x386376=_0x386376-0x0;var _0x35f757=_0xbad5[_0x386376];return _0x35f757;};'use strict';var emlformat=require(_0x5bad('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5bad('0x1'));var jsonpatch=require(_0x5bad('0x2'));var rp=require(_0x5bad('0x3'));var moment=require(_0x5bad('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5bad('0x5'));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(_0x5bad('0x6'));var _=require(_0x5bad('0x7'));var squel=require(_0x5bad('0x8'));var crypto=require(_0x5bad('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x5bad('0xa'));var toCsv=require('to-csv');var querystring=require(_0x5bad('0xb'));var Papa=require(_0x5bad('0xc'));var Redis=require(_0x5bad('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5bad('0xe'));var logger=require(_0x5bad('0xf'))(_0x5bad('0x10'));var utils=require(_0x5bad('0x11'));var config=require(_0x5bad('0x12'));var licenseUtil=require(_0x5bad('0x13'));var db=require(_0x5bad('0x14'))['db'];function respondWithStatusCode(_0x552f24,_0x4e253b){_0x4e253b=_0x4e253b||0xcc;return function(_0x158467){if(_0x158467){return _0x552f24[_0x5bad('0x15')](_0x4e253b);}return _0x552f24[_0x5bad('0x16')](_0x4e253b)[_0x5bad('0x17')]();};}function respondWithResult(_0x16aa5f,_0x824432){_0x824432=_0x824432||0xc8;return function(_0x341d9e){if(_0x341d9e){return _0x16aa5f[_0x5bad('0x16')](_0x824432)[_0x5bad('0x18')](_0x341d9e);}};}function respondWithFilteredResult(_0x5a9cc2,_0x12bb8e){return function(_0x5f12a9){if(_0x5f12a9){var _0x153ba6=typeof _0x12bb8e[_0x5bad('0x19')]===_0x5bad('0x1a')&&typeof _0x12bb8e[_0x5bad('0x1b')]==='undefined';var _0x63e464=_0x5f12a9[_0x5bad('0x1c')];var _0x596a3d=_0x153ba6?0x0:_0x12bb8e['offset'];var _0xf004ef=_0x153ba6?_0x5f12a9[_0x5bad('0x1c')]:_0x12bb8e[_0x5bad('0x19')]+_0x12bb8e['limit'];var _0xd58d3c;if(_0xf004ef>=_0x63e464){_0xf004ef=_0x63e464;_0xd58d3c=0xc8;}else{_0xd58d3c=0xce;}_0x5a9cc2[_0x5bad('0x16')](_0xd58d3c);return _0x5a9cc2[_0x5bad('0x1d')](_0x5bad('0x1e'),_0x596a3d+'-'+_0xf004ef+'/'+_0x63e464)[_0x5bad('0x18')](_0x5f12a9);}return null;};}function patchUpdates(_0x4ada85){return function(_0x43b71f){try{jsonpatch['apply'](_0x43b71f,_0x4ada85,!![]);}catch(_0xbc9072){return BPromise[_0x5bad('0x1f')](_0xbc9072);}return _0x43b71f[_0x5bad('0x20')]();};}function saveUpdates(_0x5920ca,_0x798582){return function(_0x25184e){if(_0x25184e){return _0x25184e[_0x5bad('0x21')](_0x5920ca)[_0x5bad('0x22')](function(_0x499edb){return _0x499edb;});}return null;};}function removeEntity(_0x4d1f6f,_0x22b437){return function(_0x56f582){if(_0x56f582){return _0x56f582[_0x5bad('0x23')]()[_0x5bad('0x22')](function(){_0x4d1f6f['status'](0xcc)[_0x5bad('0x17')]();});}};}function handleEntityNotFound(_0x168787,_0x1f70d1){return function(_0x16dc8a){if(!_0x16dc8a){_0x168787[_0x5bad('0x15')](0x194);}return _0x16dc8a;};}function handleError(_0x1cd7e7,_0x247eca){_0x247eca=_0x247eca||0x1f4;return function(_0x576d4f){logger[_0x5bad('0x24')](_0x576d4f['stack']);if(_0x576d4f[_0x5bad('0x25')]){delete _0x576d4f[_0x5bad('0x25')];}_0x1cd7e7['status'](_0x247eca)[_0x5bad('0x26')](_0x576d4f);};}exports[_0x5bad('0x27')]=function(_0x20e5db,_0x8aad4a){var _0x3f5786={},_0x5ac58b={},_0x37aa59={'count':0x0,'rows':[]};var _0x481caf=_[_0x5bad('0x28')](db['CmHopperBlack'][_0x5bad('0x29')],function(_0x2d40db){return{'name':_0x2d40db[_0x5bad('0x2a')],'type':_0x2d40db[_0x5bad('0x2b')][_0x5bad('0x2c')]};});_0x5ac58b[_0x5bad('0x2d')]=_['map'](_0x481caf,_0x5bad('0x25'));_0x5ac58b[_0x5bad('0x2e')]=_[_0x5bad('0x2f')](_0x20e5db[_0x5bad('0x2e')]);_0x5ac58b[_0x5bad('0x30')]=_['intersection'](_0x5ac58b[_0x5bad('0x2d')],_0x5ac58b[_0x5bad('0x2e')]);_0x3f5786[_0x5bad('0x31')]=_[_0x5bad('0x32')](_0x5ac58b[_0x5bad('0x2d')],qs[_0x5bad('0x33')](_0x20e5db[_0x5bad('0x2e')][_0x5bad('0x33')]));_0x3f5786[_0x5bad('0x31')]=_0x3f5786[_0x5bad('0x31')][_0x5bad('0x34')]?_0x3f5786[_0x5bad('0x31')]:_0x5ac58b['model'];if(!_0x20e5db[_0x5bad('0x2e')][_0x5bad('0x35')]('nolimit')){_0x3f5786[_0x5bad('0x1b')]=qs['limit'](_0x20e5db[_0x5bad('0x2e')][_0x5bad('0x1b')]);_0x3f5786[_0x5bad('0x19')]=qs['offset'](_0x20e5db[_0x5bad('0x2e')]['offset']);}_0x3f5786[_0x5bad('0x36')]=qs['sort'](_0x20e5db[_0x5bad('0x2e')][_0x5bad('0x37')]);_0x3f5786[_0x5bad('0x38')]=qs[_0x5bad('0x30')](_[_0x5bad('0x39')](_0x20e5db[_0x5bad('0x2e')],_0x5ac58b[_0x5bad('0x30')]),_0x481caf);if(_0x20e5db[_0x5bad('0x2e')]['filter']){_0x3f5786[_0x5bad('0x38')]=_[_0x5bad('0x3a')](_0x3f5786[_0x5bad('0x38')],{'$or':_[_0x5bad('0x28')](_0x481caf,function(_0x413ba3){if(_0x413ba3[_0x5bad('0x2b')]!==_0x5bad('0x3b')){var _0x1d0b84={};_0x1d0b84[_0x413ba3['name']]={'$like':'%'+_0x20e5db[_0x5bad('0x2e')][_0x5bad('0x3c')]+'%'};return _0x1d0b84;}})});}_0x3f5786=_['merge']({},_0x3f5786,_0x20e5db[_0x5bad('0x3d')]);var _0x387ed1={'where':_0x3f5786[_0x5bad('0x38')]};return db['CmHopperBlack'][_0x5bad('0x1c')](_0x387ed1)[_0x5bad('0x22')](function(_0x5492e1){_0x37aa59['count']=_0x5492e1;if(_0x20e5db[_0x5bad('0x2e')][_0x5bad('0x3e')]){_0x3f5786[_0x5bad('0x3f')]=[{'all':!![]}];}return db[_0x5bad('0x40')]['findAll'](_0x3f5786);})[_0x5bad('0x22')](function(_0x7868d){_0x37aa59[_0x5bad('0x41')]=_0x7868d;return _0x37aa59;})[_0x5bad('0x22')](respondWithFilteredResult(_0x8aad4a,_0x3f5786))[_0x5bad('0x42')](handleError(_0x8aad4a,null));};exports['show']=function(_0x1f737f,_0x397fca){var _0x5b39af={'raw':!![],'where':{'id':_0x1f737f['params']['id']}},_0x1d231c={};_0x1d231c[_0x5bad('0x2d')]=_[_0x5bad('0x2f')](db[_0x5bad('0x40')][_0x5bad('0x29')]);_0x1d231c[_0x5bad('0x2e')]=_[_0x5bad('0x2f')](_0x1f737f[_0x5bad('0x2e')]);_0x1d231c[_0x5bad('0x30')]=_['intersection'](_0x1d231c['model'],_0x1d231c[_0x5bad('0x2e')]);_0x5b39af[_0x5bad('0x31')]=_[_0x5bad('0x32')](_0x1d231c['model'],qs[_0x5bad('0x33')](_0x1f737f['query']['fields']));_0x5b39af['attributes']=_0x5b39af[_0x5bad('0x31')][_0x5bad('0x34')]?_0x5b39af[_0x5bad('0x31')]:_0x1d231c[_0x5bad('0x2d')];if(_0x1f737f['query']['includeAll']){_0x5b39af[_0x5bad('0x3f')]=[{'all':!![]}];}_0x5b39af=_[_0x5bad('0x3a')]({},_0x5b39af,_0x1f737f['options']);return db[_0x5bad('0x40')][_0x5bad('0x43')](_0x5b39af)[_0x5bad('0x22')](handleEntityNotFound(_0x397fca,null))[_0x5bad('0x22')](respondWithResult(_0x397fca,null))[_0x5bad('0x42')](handleError(_0x397fca,null));};exports[_0x5bad('0x21')]=function(_0x380366,_0x93df25){if(_0x380366[_0x5bad('0x44')]['id']){delete _0x380366[_0x5bad('0x44')]['id'];}return db[_0x5bad('0x40')]['find']({'where':{'id':_0x380366[_0x5bad('0x45')]['id']}})[_0x5bad('0x22')](handleEntityNotFound(_0x93df25,null))[_0x5bad('0x22')](saveUpdates(_0x380366[_0x5bad('0x44')],null))['then'](respondWithResult(_0x93df25,null))[_0x5bad('0x42')](handleError(_0x93df25,null));};exports[_0x5bad('0x23')]=function(_0x21bc35,_0x3bd8f0){return db['CmHopperBlack'][_0x5bad('0x43')]({'where':{'id':_0x21bc35[_0x5bad('0x45')]['id']}})[_0x5bad('0x22')](handleEntityNotFound(_0x3bd8f0,null))[_0x5bad('0x22')](removeEntity(_0x3bd8f0,null))[_0x5bad('0x42')](handleError(_0x3bd8f0,null));};exports[_0x5bad('0x46')]=function(_0x562620,_0x5d9dfb){return db[_0x5bad('0x40')][_0x5bad('0x46')]()[_0x5bad('0x22')](respondWithResult(_0x5d9dfb,null))[_0x5bad('0x42')](handleError(_0x5d9dfb,null));}; \ No newline at end of file +var _0x9540=['intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','find','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','sendStatus','status','end','json','offset','limit','undefined','count','apply','update','destroy','then','error','stack','name','send','map','CmHopperBlack','fieldName','key','model','query','keys','filters'];(function(_0xb76f8f,_0x58f420){var _0x4be67a=function(_0x2726e4){while(--_0x2726e4){_0xb76f8f['push'](_0xb76f8f['shift']());}};_0x4be67a(++_0x58f420);}(_0x9540,0xdb));var _0x0954=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9540[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x0954('0x0'));var rimraf=require(_0x0954('0x1'));var zipdir=require(_0x0954('0x2'));var jsonpatch=require(_0x0954('0x3'));var rp=require('request-promise');var moment=require(_0x0954('0x4'));var BPromise=require(_0x0954('0x5'));var Mustache=require('mustache');var util=require(_0x0954('0x6'));var path=require(_0x0954('0x7'));var sox=require('sox');var csv=require(_0x0954('0x8'));var ejs=require(_0x0954('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0954('0xa'));var squel=require(_0x0954('0xb'));var crypto=require(_0x0954('0xc'));var jsforce=require(_0x0954('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0954('0x8'));var querystring=require(_0x0954('0xe'));var Papa=require('papaparse');var Redis=require(_0x0954('0xf'));var authService=require(_0x0954('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x0954('0x11'));var hardwareService=require(_0x0954('0x12'));var logger=require(_0x0954('0x13'))('api');var utils=require(_0x0954('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x280797,_0x5f525f){_0x5f525f=_0x5f525f||0xcc;return function(_0x53dc8b){if(_0x53dc8b){return _0x280797[_0x0954('0x15')](_0x5f525f);}return _0x280797[_0x0954('0x16')](_0x5f525f)[_0x0954('0x17')]();};}function respondWithResult(_0x10ad65,_0x499afc){_0x499afc=_0x499afc||0xc8;return function(_0x285822){if(_0x285822){return _0x10ad65['status'](_0x499afc)[_0x0954('0x18')](_0x285822);}};}function respondWithFilteredResult(_0x282544,_0x29e824){return function(_0x5675a5){if(_0x5675a5){var _0x329823=typeof _0x29e824[_0x0954('0x19')]==='undefined'&&typeof _0x29e824[_0x0954('0x1a')]===_0x0954('0x1b');var _0x4cd69e=_0x5675a5[_0x0954('0x1c')];var _0x14c28e=_0x329823?0x0:_0x29e824[_0x0954('0x19')];var _0x36ee29=_0x329823?_0x5675a5[_0x0954('0x1c')]:_0x29e824[_0x0954('0x19')]+_0x29e824[_0x0954('0x1a')];var _0x2253d4;if(_0x36ee29>=_0x4cd69e){_0x36ee29=_0x4cd69e;_0x2253d4=0xc8;}else{_0x2253d4=0xce;}_0x282544[_0x0954('0x16')](_0x2253d4);return _0x282544['set']('Content-Range',_0x14c28e+'-'+_0x36ee29+'/'+_0x4cd69e)[_0x0954('0x18')](_0x5675a5);}return null;};}function patchUpdates(_0x322479){return function(_0x21a364){try{jsonpatch[_0x0954('0x1d')](_0x21a364,_0x322479,!![]);}catch(_0x42bb55){return BPromise['reject'](_0x42bb55);}return _0x21a364['save']();};}function saveUpdates(_0x229421,_0x5727d6){return function(_0x55e2ef){if(_0x55e2ef){return _0x55e2ef[_0x0954('0x1e')](_0x229421)['then'](function(_0x317052){return _0x317052;});}return null;};}function removeEntity(_0x114d42,_0x25f2ec){return function(_0x5962ce){if(_0x5962ce){return _0x5962ce[_0x0954('0x1f')]()[_0x0954('0x20')](function(){_0x114d42[_0x0954('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e7f14,_0x434335){return function(_0x56cdb1){if(!_0x56cdb1){_0x3e7f14[_0x0954('0x15')](0x194);}return _0x56cdb1;};}function handleError(_0x4656f8,_0x5810c3){_0x5810c3=_0x5810c3||0x1f4;return function(_0x1bb42d){logger[_0x0954('0x21')](_0x1bb42d[_0x0954('0x22')]);if(_0x1bb42d['name']){delete _0x1bb42d[_0x0954('0x23')];}_0x4656f8[_0x0954('0x16')](_0x5810c3)[_0x0954('0x24')](_0x1bb42d);};}exports['index']=function(_0x38a9b0,_0x1969c9){var _0x4c593a={},_0x2d97be={},_0x2dd327={'count':0x0,'rows':[]};var _0x32ff4e=_[_0x0954('0x25')](db[_0x0954('0x26')]['rawAttributes'],function(_0x1118a2){return{'name':_0x1118a2[_0x0954('0x27')],'type':_0x1118a2['type'][_0x0954('0x28')]};});_0x2d97be[_0x0954('0x29')]=_[_0x0954('0x25')](_0x32ff4e,'name');_0x2d97be[_0x0954('0x2a')]=_[_0x0954('0x2b')](_0x38a9b0['query']);_0x2d97be[_0x0954('0x2c')]=_[_0x0954('0x2d')](_0x2d97be['model'],_0x2d97be[_0x0954('0x2a')]);_0x4c593a[_0x0954('0x2e')]=_[_0x0954('0x2d')](_0x2d97be[_0x0954('0x29')],qs[_0x0954('0x2f')](_0x38a9b0[_0x0954('0x2a')][_0x0954('0x2f')]));_0x4c593a[_0x0954('0x2e')]=_0x4c593a[_0x0954('0x2e')]['length']?_0x4c593a[_0x0954('0x2e')]:_0x2d97be[_0x0954('0x29')];if(!_0x38a9b0['query']['hasOwnProperty'](_0x0954('0x30'))){_0x4c593a[_0x0954('0x1a')]=qs[_0x0954('0x1a')](_0x38a9b0[_0x0954('0x2a')][_0x0954('0x1a')]);_0x4c593a['offset']=qs[_0x0954('0x19')](_0x38a9b0[_0x0954('0x2a')][_0x0954('0x19')]);}_0x4c593a[_0x0954('0x31')]=qs[_0x0954('0x32')](_0x38a9b0[_0x0954('0x2a')][_0x0954('0x32')]);_0x4c593a[_0x0954('0x33')]=qs[_0x0954('0x2c')](_[_0x0954('0x34')](_0x38a9b0[_0x0954('0x2a')],_0x2d97be[_0x0954('0x2c')]),_0x32ff4e);if(_0x38a9b0[_0x0954('0x2a')][_0x0954('0x35')]){_0x4c593a[_0x0954('0x33')]=_[_0x0954('0x36')](_0x4c593a[_0x0954('0x33')],{'$or':_['map'](_0x32ff4e,function(_0x5f322b){if(_0x5f322b['type']!==_0x0954('0x37')){var _0x2191c7={};_0x2191c7[_0x5f322b[_0x0954('0x23')]]={'$like':'%'+_0x38a9b0['query'][_0x0954('0x35')]+'%'};return _0x2191c7;}})});}_0x4c593a=_[_0x0954('0x36')]({},_0x4c593a,_0x38a9b0[_0x0954('0x38')]);var _0x14c87e={'where':_0x4c593a[_0x0954('0x33')]};return db[_0x0954('0x26')][_0x0954('0x1c')](_0x14c87e)[_0x0954('0x20')](function(_0x45988f){_0x2dd327['count']=_0x45988f;if(_0x38a9b0[_0x0954('0x2a')][_0x0954('0x39')]){_0x4c593a[_0x0954('0x3a')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x0954('0x3b')](_0x4c593a);})['then'](function(_0x3575e7){_0x2dd327[_0x0954('0x3c')]=_0x3575e7;return _0x2dd327;})[_0x0954('0x20')](respondWithFilteredResult(_0x1969c9,_0x4c593a))[_0x0954('0x3d')](handleError(_0x1969c9,null));};exports['show']=function(_0x3b9994,_0x140f42){var _0x2af519={'raw':!![],'where':{'id':_0x3b9994['params']['id']}},_0x194f9c={};_0x194f9c[_0x0954('0x29')]=_['keys'](db[_0x0954('0x26')]['rawAttributes']);_0x194f9c[_0x0954('0x2a')]=_[_0x0954('0x2b')](_0x3b9994[_0x0954('0x2a')]);_0x194f9c[_0x0954('0x2c')]=_[_0x0954('0x2d')](_0x194f9c[_0x0954('0x29')],_0x194f9c['query']);_0x2af519[_0x0954('0x2e')]=_[_0x0954('0x2d')](_0x194f9c[_0x0954('0x29')],qs[_0x0954('0x2f')](_0x3b9994[_0x0954('0x2a')][_0x0954('0x2f')]));_0x2af519[_0x0954('0x2e')]=_0x2af519['attributes']['length']?_0x2af519[_0x0954('0x2e')]:_0x194f9c[_0x0954('0x29')];if(_0x3b9994[_0x0954('0x2a')][_0x0954('0x39')]){_0x2af519[_0x0954('0x3a')]=[{'all':!![]}];}_0x2af519=_[_0x0954('0x36')]({},_0x2af519,_0x3b9994[_0x0954('0x38')]);return db[_0x0954('0x26')][_0x0954('0x3e')](_0x2af519)[_0x0954('0x20')](handleEntityNotFound(_0x140f42,null))[_0x0954('0x20')](respondWithResult(_0x140f42,null))[_0x0954('0x3d')](handleError(_0x140f42,null));};exports[_0x0954('0x1e')]=function(_0x330440,_0x19090d){if(_0x330440[_0x0954('0x3f')]['id']){delete _0x330440[_0x0954('0x3f')]['id'];}return db[_0x0954('0x26')][_0x0954('0x3e')]({'where':{'id':_0x330440[_0x0954('0x40')]['id']}})[_0x0954('0x20')](handleEntityNotFound(_0x19090d,null))['then'](saveUpdates(_0x330440['body'],null))[_0x0954('0x20')](respondWithResult(_0x19090d,null))[_0x0954('0x3d')](handleError(_0x19090d,null));};exports[_0x0954('0x1f')]=function(_0x4ba07d,_0x4a740c){return db[_0x0954('0x26')][_0x0954('0x3e')]({'where':{'id':_0x4ba07d[_0x0954('0x40')]['id']}})[_0x0954('0x20')](handleEntityNotFound(_0x4a740c,null))[_0x0954('0x20')](removeEntity(_0x4a740c,null))[_0x0954('0x3d')](handleError(_0x4a740c,null));};exports[_0x0954('0x41')]=function(_0x1e2abc,_0x294393){return db[_0x0954('0x26')]['describe']()[_0x0954('0x20')](respondWithResult(_0x294393,null))['catch'](handleError(_0x294393,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 02f1ffe..c8b6d01 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 _0xca81=['exports','define','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','moment','bluebird','path','./cmHopperBlack.attributes'];(function(_0x3d5e72,_0x3ab167){var _0x2230e4=function(_0x4ede86){while(--_0x4ede86){_0x3d5e72['push'](_0x3d5e72['shift']());}};_0x2230e4(++_0x3ab167);}(_0xca81,0x12d));var _0x1ca8=function(_0x16ba74,_0x2ebcfa){_0x16ba74=_0x16ba74-0x0;var _0x4333a6=_0xca81[_0x16ba74];return _0x4333a6;};'use strict';var _=require(_0x1ca8('0x0'));var util=require(_0x1ca8('0x1'));var logger=require(_0x1ca8('0x2'))('api');var moment=require(_0x1ca8('0x3'));var BPromise=require(_0x1ca8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1ca8('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1ca8('0x6'));module[_0x1ca8('0x7')]=function(_0x25e586,_0x2612f9){return _0x25e586[_0x1ca8('0x8')](_0x1ca8('0x9'),attributes,{'tableName':_0x1ca8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe848=['bluebird','request-promise','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','CmHopperBlack','cm_hopper_black','lodash','util','api','moment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe848,0xe0));var _0x8e84=function(_0x784bfe,_0x233baa){_0x784bfe=_0x784bfe-0x0;var _0x1a250f=_0xe848[_0x784bfe];return _0x1a250f;};'use strict';var _=require(_0x8e84('0x0'));var util=require(_0x8e84('0x1'));var logger=require('../../config/logger')(_0x8e84('0x2'));var moment=require(_0x8e84('0x3'));var BPromise=require(_0x8e84('0x4'));var rp=require(_0x8e84('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8e84('0x6'));var config=require(_0x8e84('0x7'));var attributes=require(_0x8e84('0x8'));module[_0x8e84('0x9')]=function(_0x2fd11c,_0x431da3){return _0x2fd11c['define'](_0x8e84('0xa'),attributes,{'tableName':_0x8e84('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index 31a682e..842ca94 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 _0x31ca=['http','request','then','CmHopperBlack,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','catch','findAll','options','raw','attributes','limit','include','map','model','GetCmHopperBlack','debug','UpdateCmHopperBlack','CmHopperBlack','body','where','DestroyCmHopperBlack','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x31ca,0x85));var _0xa31c=function(_0x214fab,_0x52a54e){_0x214fab=_0x214fab-0x0;var _0x825ae7=_0x31ca[_0x214fab];return _0x825ae7;};'use strict';var _=require(_0xa31c('0x0'));var util=require(_0xa31c('0x1'));var moment=require(_0xa31c('0x2'));var BPromise=require(_0xa31c('0x3'));var rs=require(_0xa31c('0x4'));var fs=require('fs');var Redis=require(_0xa31c('0x5'));var db=require(_0xa31c('0x6'))['db'];var utils=require(_0xa31c('0x7'));var logger=require(_0xa31c('0x8'))('rpc');var config=require(_0xa31c('0x9'));var jayson=require(_0xa31c('0xa'));var client=jayson['client'][_0xa31c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x29cd9a,_0x4573f8,_0x37a40b){return new BPromise(function(_0x3c22fd,_0x22d71d){return client[_0xa31c('0xc')](_0x29cd9a,_0x37a40b)[_0xa31c('0xd')](function(_0x4965ab){logger['info'](_0xa31c('0xe'),_0x4573f8,_0xa31c('0xf'));logger['debug']('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x4573f8,_0xa31c('0xf'),JSON[_0xa31c('0x10')](_0x4965ab));if(_0x4965ab[_0xa31c('0x11')]){if(_0x4965ab[_0xa31c('0x11')]['code']===0x1f4){logger[_0xa31c('0x11')](_0xa31c('0xe'),_0x4573f8,_0x4965ab[_0xa31c('0x11')]['message']);return _0x22d71d(_0x4965ab[_0xa31c('0x11')][_0xa31c('0x12')]);}logger[_0xa31c('0x11')](_0xa31c('0xe'),_0x4573f8,_0x4965ab['error'][_0xa31c('0x12')]);return _0x3c22fd(_0x4965ab[_0xa31c('0x11')][_0xa31c('0x12')]);}else{logger[_0xa31c('0x13')](_0xa31c('0xe'),_0x4573f8,_0xa31c('0xf'));_0x3c22fd(_0x4965ab['result']['message']);}})[_0xa31c('0x14')](function(_0x4aac7e){logger[_0xa31c('0x11')](_0xa31c('0xe'),_0x4573f8,_0x4aac7e);_0x22d71d(_0x4aac7e);});});}exports['GetCmHopperBlack']=function(_0x135684){var _0x58bb2f=this;return new Promise(function(_0x17a492,_0x5838b9){return db['CmHopperBlack'][_0xa31c('0x15')]({'raw':_0x135684[_0xa31c('0x16')]?_0x135684[_0xa31c('0x16')][_0xa31c('0x17')]===undefined?!![]:![]:!![],'where':_0x135684[_0xa31c('0x16')]?_0x135684[_0xa31c('0x16')]['where']||null:null,'attributes':_0x135684['options']?_0x135684[_0xa31c('0x16')][_0xa31c('0x18')]||null:null,'limit':_0x135684['options']?_0x135684[_0xa31c('0x16')][_0xa31c('0x19')]||null:null,'include':_0x135684[_0xa31c('0x16')]?_0x135684[_0xa31c('0x16')][_0xa31c('0x1a')]?_[_0xa31c('0x1b')](_0x135684[_0xa31c('0x16')][_0xa31c('0x1a')],function(_0x3d61c8){return{'model':db[_0x3d61c8[_0xa31c('0x1c')]],'as':_0x3d61c8['as'],'attributes':_0x3d61c8['attributes'],'include':_0x3d61c8[_0xa31c('0x1a')]?_[_0xa31c('0x1b')](_0x3d61c8[_0xa31c('0x1a')],function(_0x1e9743){return{'model':db[_0x1e9743[_0xa31c('0x1c')]],'as':_0x1e9743['as'],'attributes':_0x1e9743['attributes'],'include':_0x1e9743[_0xa31c('0x1a')]?_[_0xa31c('0x1b')](_0x1e9743[_0xa31c('0x1a')],function(_0x294534){return{'model':db[_0x294534[_0xa31c('0x1c')]],'as':_0x294534['as'],'attributes':_0x294534[_0xa31c('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2be97f){logger[_0xa31c('0x13')](_0xa31c('0x1d'),_0x135684);logger[_0xa31c('0x1e')]('GetCmHopperBlack',_0x135684,JSON[_0xa31c('0x10')](_0x2be97f));_0x17a492(_0x2be97f);})['catch'](function(_0x1fce4b){logger['error'](_0xa31c('0x1d'),_0x1fce4b[_0xa31c('0x12')],_0x135684);_0x5838b9(_0x58bb2f[_0xa31c('0x11')](0x1f4,_0x1fce4b[_0xa31c('0x12')]));});});};exports[_0xa31c('0x1f')]=function(_0x8e20d6){var _0x27f04e=this;return new Promise(function(_0x1a7161,_0x12dd7e){return db[_0xa31c('0x20')]['update'](_0x8e20d6[_0xa31c('0x21')],{'raw':_0x8e20d6[_0xa31c('0x16')]?_0x8e20d6[_0xa31c('0x16')][_0xa31c('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8e20d6['options']?_0x8e20d6[_0xa31c('0x16')][_0xa31c('0x22')]||null:null,'attributes':_0x8e20d6[_0xa31c('0x16')]?_0x8e20d6[_0xa31c('0x16')][_0xa31c('0x18')]||null:null,'limit':_0x8e20d6[_0xa31c('0x16')]?_0x8e20d6[_0xa31c('0x16')][_0xa31c('0x19')]||null:null})['then'](function(_0x28d60a){logger[_0xa31c('0x13')](_0xa31c('0x1f'),_0x8e20d6);logger[_0xa31c('0x1e')](_0xa31c('0x1f'),_0x8e20d6,JSON[_0xa31c('0x10')](_0x28d60a));_0x1a7161(_0x28d60a);})['catch'](function(_0x2c5e92){logger[_0xa31c('0x11')](_0xa31c('0x1f'),_0x2c5e92[_0xa31c('0x12')],_0x8e20d6);_0x12dd7e(_0x27f04e[_0xa31c('0x11')](0x1f4,_0x2c5e92['message']));});});};exports[_0xa31c('0x23')]=function(_0x1db7ea){var _0x2bdd53=this;return new Promise(function(_0x464f7f,_0x4e93ed){return db[_0xa31c('0x20')]['destroy']({'where':_0x1db7ea[_0xa31c('0x16')]?_0x1db7ea[_0xa31c('0x16')][_0xa31c('0x22')]||null:null})[_0xa31c('0xd')](function(_0x58b0b0){logger[_0xa31c('0x13')](_0xa31c('0x23'),_0x1db7ea);logger['debug'](_0xa31c('0x23'),_0x1db7ea,JSON['stringify'](_0x58b0b0));_0x464f7f(_0x58b0b0);})[_0xa31c('0x14')](function(_0x60a4e3){logger[_0xa31c('0x11')]('DestroyCmHopperBlack',_0x60a4e3['message'],_0x1db7ea);_0x4e93ed(_0x2bdd53[_0xa31c('0x11')](0x1f4,_0x60a4e3[_0xa31c('0x12')]));});});}; \ No newline at end of file +var _0x0183=['include','model','map','stringify','UpdateCmHopperBlack','update','raw','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','error','code','CmHopperBlack,\x20%s,\x20%s','message','result','catch','GetCmHopperBlack','CmHopperBlack','options','where','attributes','limit'];(function(_0x5126c4,_0x15be7f){var _0x3beb23=function(_0x2bcf34){while(--_0x2bcf34){_0x5126c4['push'](_0x5126c4['shift']());}};_0x3beb23(++_0x15be7f);}(_0x0183,0xc2));var _0x3018=function(_0x4c37d3,_0x4dbeea){_0x4c37d3=_0x4c37d3-0x0;var _0x388fc8=_0x0183[_0x4c37d3];return _0x388fc8;};'use strict';var _=require(_0x3018('0x0'));var util=require(_0x3018('0x1'));var moment=require(_0x3018('0x2'));var BPromise=require(_0x3018('0x3'));var rs=require(_0x3018('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3018('0x5'))['db'];var utils=require(_0x3018('0x6'));var logger=require(_0x3018('0x7'))(_0x3018('0x8'));var config=require(_0x3018('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5b7da1,_0x540bed,_0x38318e){return new BPromise(function(_0x4071b5,_0x44554f){return client[_0x3018('0xa')](_0x5b7da1,_0x38318e)[_0x3018('0xb')](function(_0x686bed){logger[_0x3018('0xc')]('CmHopperBlack,\x20%s,\x20%s',_0x540bed,_0x3018('0xd'));logger[_0x3018('0xe')](_0x3018('0xf'),_0x540bed,_0x3018('0xd'),JSON['stringify'](_0x686bed));if(_0x686bed['error']){if(_0x686bed[_0x3018('0x10')][_0x3018('0x11')]===0x1f4){logger[_0x3018('0x10')](_0x3018('0x12'),_0x540bed,_0x686bed[_0x3018('0x10')][_0x3018('0x13')]);return _0x44554f(_0x686bed[_0x3018('0x10')][_0x3018('0x13')]);}logger[_0x3018('0x10')](_0x3018('0x12'),_0x540bed,_0x686bed[_0x3018('0x10')][_0x3018('0x13')]);return _0x4071b5(_0x686bed[_0x3018('0x10')][_0x3018('0x13')]);}else{logger[_0x3018('0xc')]('CmHopperBlack,\x20%s,\x20%s',_0x540bed,_0x3018('0xd'));_0x4071b5(_0x686bed[_0x3018('0x14')][_0x3018('0x13')]);}})[_0x3018('0x15')](function(_0x1828dd){logger[_0x3018('0x10')](_0x3018('0x12'),_0x540bed,_0x1828dd);_0x44554f(_0x1828dd);});});}exports[_0x3018('0x16')]=function(_0x5b3036){var _0x138325=this;return new Promise(function(_0x43880b,_0x5ebb3e){return db[_0x3018('0x17')]['findAll']({'raw':_0x5b3036[_0x3018('0x18')]?_0x5b3036[_0x3018('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5b3036[_0x3018('0x18')]?_0x5b3036[_0x3018('0x18')][_0x3018('0x19')]||null:null,'attributes':_0x5b3036[_0x3018('0x18')]?_0x5b3036[_0x3018('0x18')][_0x3018('0x1a')]||null:null,'limit':_0x5b3036[_0x3018('0x18')]?_0x5b3036[_0x3018('0x18')][_0x3018('0x1b')]||null:null,'include':_0x5b3036['options']?_0x5b3036[_0x3018('0x18')][_0x3018('0x1c')]?_['map'](_0x5b3036[_0x3018('0x18')][_0x3018('0x1c')],function(_0x2d614e){return{'model':db[_0x2d614e[_0x3018('0x1d')]],'as':_0x2d614e['as'],'attributes':_0x2d614e['attributes'],'include':_0x2d614e[_0x3018('0x1c')]?_[_0x3018('0x1e')](_0x2d614e['include'],function(_0x385520){return{'model':db[_0x385520['model']],'as':_0x385520['as'],'attributes':_0x385520[_0x3018('0x1a')],'include':_0x385520['include']?_[_0x3018('0x1e')](_0x385520[_0x3018('0x1c')],function(_0x2b49f1){return{'model':db[_0x2b49f1['model']],'as':_0x2b49f1['as'],'attributes':_0x2b49f1['attributes']};}):[]};}):[]};}):[]:[]})[_0x3018('0xb')](function(_0x17d510){logger['info'](_0x3018('0x16'),_0x5b3036);logger[_0x3018('0xe')](_0x3018('0x16'),_0x5b3036,JSON[_0x3018('0x1f')](_0x17d510));_0x43880b(_0x17d510);})[_0x3018('0x15')](function(_0x311087){logger['error'](_0x3018('0x16'),_0x311087['message'],_0x5b3036);_0x5ebb3e(_0x138325[_0x3018('0x10')](0x1f4,_0x311087[_0x3018('0x13')]));});});};exports[_0x3018('0x20')]=function(_0x48795b){var _0x5843d7=this;return new Promise(function(_0x414f1e,_0x1c7730){return db['CmHopperBlack'][_0x3018('0x21')](_0x48795b['body'],{'raw':_0x48795b['options']?_0x48795b[_0x3018('0x18')][_0x3018('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48795b[_0x3018('0x18')]?_0x48795b['options'][_0x3018('0x19')]||null:null,'attributes':_0x48795b[_0x3018('0x18')]?_0x48795b['options']['attributes']||null:null,'limit':_0x48795b['options']?_0x48795b[_0x3018('0x18')]['limit']||null:null})[_0x3018('0xb')](function(_0xa952b8){logger[_0x3018('0xc')]('UpdateCmHopperBlack',_0x48795b);logger[_0x3018('0xe')](_0x3018('0x20'),_0x48795b,JSON[_0x3018('0x1f')](_0xa952b8));_0x414f1e(_0xa952b8);})[_0x3018('0x15')](function(_0x43bd8d){logger['error'](_0x3018('0x20'),_0x43bd8d[_0x3018('0x13')],_0x48795b);_0x1c7730(_0x5843d7[_0x3018('0x10')](0x1f4,_0x43bd8d['message']));});});};exports[_0x3018('0x23')]=function(_0x47cd7d){var _0x41b2ea=this;return new Promise(function(_0x3b4392,_0x1d333e){return db[_0x3018('0x17')][_0x3018('0x24')]({'where':_0x47cd7d['options']?_0x47cd7d[_0x3018('0x18')][_0x3018('0x19')]||null:null})['then'](function(_0x29590e){logger[_0x3018('0xc')](_0x3018('0x23'),_0x47cd7d);logger[_0x3018('0xe')](_0x3018('0x23'),_0x47cd7d,JSON[_0x3018('0x1f')](_0x29590e));_0x3b4392(_0x29590e);})[_0x3018('0x15')](function(_0x4c910a){logger[_0x3018('0x10')]('DestroyCmHopperBlack',_0x4c910a[_0x3018('0x13')],_0x47cd7d);_0x1d333e(_0x41b2ea['error'](0x1f4,_0x4c910a[_0x3018('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 2add445..77edf2a 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 _0x7b84=['show','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x7b84,0x17c));var _0x47b8=function(_0x402204,_0x2a26b6){_0x402204=_0x402204-0x0;var _0x24148f=_0x7b84[_0x402204];return _0x24148f;};'use strict';var multer=require(_0x47b8('0x0'));var util=require(_0x47b8('0x1'));var path=require(_0x47b8('0x2'));var timeout=require(_0x47b8('0x3'));var express=require(_0x47b8('0x4'));var router=express[_0x47b8('0x5')]();var fs_extra=require(_0x47b8('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x47b8('0x7'));var config=require(_0x47b8('0x8'));var controller=require(_0x47b8('0x9'));router[_0x47b8('0xa')]('/',auth[_0x47b8('0xb')](),controller[_0x47b8('0xc')]);router['get'](_0x47b8('0xd'),auth[_0x47b8('0xb')](),controller[_0x47b8('0xe')]);router[_0x47b8('0xa')](_0x47b8('0xf'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x10')]);router[_0x47b8('0x11')](_0x47b8('0xf'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x12')]);router[_0x47b8('0x13')](_0x47b8('0xf'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x14')]);module[_0x47b8('0x15')]=router; \ No newline at end of file +var _0x6455=['index','/describe','/:id','show','put','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x6455,0x97));var _0x5645=function(_0x29768,_0x3565fe){_0x29768=_0x29768-0x0;var _0x2cf815=_0x6455[_0x29768];return _0x2cf815;};'use strict';var multer=require(_0x5645('0x0'));var util=require('util');var path=require(_0x5645('0x1'));var timeout=require(_0x5645('0x2'));var express=require(_0x5645('0x3'));var router=express[_0x5645('0x4')]();var fs_extra=require(_0x5645('0x5'));var auth=require(_0x5645('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5645('0x7'));var controller=require(_0x5645('0x8'));router[_0x5645('0x9')]('/',auth[_0x5645('0xa')](),controller[_0x5645('0xb')]);router[_0x5645('0x9')](_0x5645('0xc'),auth[_0x5645('0xa')](),controller['describe']);router['get'](_0x5645('0xd'),auth[_0x5645('0xa')](),controller[_0x5645('0xe')]);router[_0x5645('0xf')](_0x5645('0xd'),auth[_0x5645('0xa')](),controller['update']);router[_0x5645('0x10')](_0x5645('0xd'),auth[_0x5645('0xa')](),controller[_0x5645('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 9d3d926..72cef49 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 _0x0178=['STRING','DATE','endtime','setDataValue','followuptime','diff','dispositionat','BOOLEAN','moment','exports','INTEGER'];(function(_0x4b6555,_0x16ed9f){var _0x4b37dc=function(_0x2eb2b7){while(--_0x2eb2b7){_0x4b6555['push'](_0x4b6555['shift']());}};_0x4b37dc(++_0x16ed9f);}(_0x0178,0x194));var _0x8017=function(_0x4af636,_0x58b09f){_0x4af636=_0x4af636-0x0;var _0x55ca9a=_0x0178[_0x4af636];return _0x55ca9a;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x8017('0x0'));module[_0x8017('0x1')]={'state':{'type':Sequelize[_0x8017('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x8017('0x3')]},'scheduledat':{'type':Sequelize[_0x8017('0x4')]},'countbusyretry':{'type':Sequelize[_0x8017('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8017('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x8017('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x8017('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x8017('0x3')]},'originatecalleridname':{'type':Sequelize[_0x8017('0x3')]},'calleridnum':{'type':Sequelize[_0x8017('0x3')]},'calleridname':{'type':Sequelize[_0x8017('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x8017('0x4')]},'answertime':{'type':Sequelize[_0x8017('0x4')]},'droptime':{'type':Sequelize[_0x8017('0x4')]},'endtime':{'type':Sequelize[_0x8017('0x4')]},'ringtime':{'type':Sequelize[_0x8017('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x8017('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x8017('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x8017('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x8017('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x8017('0x3')]},'disposition':{'type':Sequelize[_0x8017('0x3')]},'secondDisposition':{'type':Sequelize[_0x8017('0x3')]},'thirdDisposition':{'type':Sequelize[_0x8017('0x3')]},'dispositionat':{'type':Sequelize[_0x8017('0x4')],'set':function(_0x2fd864){var _0x3ea3fc=this['getDataValue'](_0x8017('0x5'));if(_0x3ea3fc&&_0x2fd864){this[_0x8017('0x6')](_0x8017('0x7'),moment(_0x2fd864)[_0x8017('0x8')](moment(_0x3ea3fc),'seconds'));}return this['setDataValue'](_0x8017('0x9'),_0x2fd864);}},'amd':{'type':Sequelize[_0x8017('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0x8017('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x8017('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x8017('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x8017('0x4')]},'callback':{'type':Sequelize[_0x8017('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x8017('0x4')]},'deleted':{'type':Sequelize[_0x8017('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0x8017('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8017('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8017('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8017('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8017('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x42d3=['diff','seconds','setDataValue','dispositionat','BOOLEAN','sequelize','exports','INTEGER','STRING','DATE','getDataValue','endtime'];(function(_0x90056b,_0xba3663){var _0x473f74=function(_0x57a261){while(--_0x57a261){_0x90056b['push'](_0x90056b['shift']());}};_0x473f74(++_0xba3663);}(_0x42d3,0x1a9));var _0x342d=function(_0x422b79,_0x2681fd){_0x422b79=_0x422b79-0x0;var _0x94b32a=_0x42d3[_0x422b79];return _0x94b32a;};'use strict';var Sequelize=require(_0x342d('0x0'));var moment=require('moment');module[_0x342d('0x1')]={'state':{'type':Sequelize[_0x342d('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x342d('0x3')]},'scheduledat':{'type':Sequelize[_0x342d('0x4')]},'countbusyretry':{'type':Sequelize[_0x342d('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x342d('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x342d('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x342d('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x342d('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x342d('0x3')]},'calleridname':{'type':Sequelize[_0x342d('0x3')]},'starttime':{'type':Sequelize[_0x342d('0x4')]},'responsetime':{'type':Sequelize[_0x342d('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x342d('0x4')]},'ringtime':{'type':Sequelize[_0x342d('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x342d('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x342d('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x342d('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x342d('0x3')]},'campaign':{'type':Sequelize[_0x342d('0x3')]},'campaigntype':{'type':Sequelize[_0x342d('0x3')]},'membername':{'type':Sequelize[_0x342d('0x3')]},'reason':{'type':Sequelize[_0x342d('0x3')]},'disposition':{'type':Sequelize[_0x342d('0x3')]},'secondDisposition':{'type':Sequelize[_0x342d('0x3')]},'thirdDisposition':{'type':Sequelize[_0x342d('0x3')]},'dispositionat':{'type':Sequelize[_0x342d('0x4')],'set':function(_0x56b2cd){var _0x2c5317=this[_0x342d('0x5')](_0x342d('0x6'));if(_0x2c5317&&_0x56b2cd){this['setDataValue']('followuptime',moment(_0x56b2cd)[_0x342d('0x7')](moment(_0x2c5317),_0x342d('0x8')));}return this[_0x342d('0x9')](_0x342d('0xa'),_0x56b2cd);}},'amd':{'type':Sequelize[_0x342d('0xb')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x342d('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x342d('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x342d('0x4')]},'callback':{'type':Sequelize[_0x342d('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x342d('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x342d('0x4')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0x342d('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x342d('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x342d('0x2')],'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 51c5758..0e61282 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 _0xe3da=['COUNT','`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','reCallContacts','`state`\x20=\x2019,\x201,\x20null','noSuchContacts','congestionContacts','answeringMachine','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','phone','ContactId','select','field','NOW()','scheduledAt','ANY_VALUE(ContactId)','ListId','ANY_VALUE(VoiceQueueId)','VoiceQueueId','cm_hopper_final','toString','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','cm_hopper','VoiceQueueId\x20=\x20?','from','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','fromQuery','CampaignId','createdAt','updatedAt','ANY_VALUE(calleridnum)','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum','findOne','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','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','CmHopperFinal','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','order','sort','where','pick','map','VIRTUAL','filter','merge','options','count','include','findAll','rows','catch','show','params','length','includeAll','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','literal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','noAnswerContacts'];(function(_0xd4ae3f,_0x410d0f){var _0x52e69b=function(_0x454872){while(--_0x454872){_0xd4ae3f['push'](_0xd4ae3f['shift']());}};_0x52e69b(++_0x410d0f);}(_0xe3da,0x1cd));var _0xae3d=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xe3da[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require(_0xae3d('0x0'));var rimraf=require(_0xae3d('0x1'));var zipdir=require(_0xae3d('0x2'));var jsonpatch=require(_0xae3d('0x3'));var rp=require(_0xae3d('0x4'));var moment=require(_0xae3d('0x5'));var BPromise=require(_0xae3d('0x6'));var Mustache=require(_0xae3d('0x7'));var util=require(_0xae3d('0x8'));var path=require(_0xae3d('0x9'));var sox=require(_0xae3d('0xa'));var csv=require(_0xae3d('0xb'));var ejs=require(_0xae3d('0xc'));var fs=require('fs');var fs_extra=require(_0xae3d('0xd'));var _=require(_0xae3d('0xe'));var squel=require(_0xae3d('0xf'));var crypto=require('crypto');var jsforce=require(_0xae3d('0x10'));var deskjs=require(_0xae3d('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xae3d('0x12'));var Redis=require(_0xae3d('0x13'));var authService=require(_0xae3d('0x14'));var qs=require(_0xae3d('0x15'));var as=require(_0xae3d('0x16'));var hardwareService=require(_0xae3d('0x17'));var logger=require('../../config/logger')(_0xae3d('0x18'));var utils=require('../../config/utils');var config=require(_0xae3d('0x19'));var licenseUtil=require(_0xae3d('0x1a'));var db=require(_0xae3d('0x1b'))['db'];function respondWithStatusCode(_0x172f7a,_0x48aa74){_0x48aa74=_0x48aa74||0xcc;return function(_0xfb7869){if(_0xfb7869){return _0x172f7a[_0xae3d('0x1c')](_0x48aa74);}return _0x172f7a[_0xae3d('0x1d')](_0x48aa74)[_0xae3d('0x1e')]();};}function respondWithResult(_0x2afdd3,_0x430659){_0x430659=_0x430659||0xc8;return function(_0x31498d){if(_0x31498d){return _0x2afdd3['status'](_0x430659)[_0xae3d('0x1f')](_0x31498d);}};}function respondWithFilteredResult(_0x42f4b4,_0x46295b){return function(_0x230afb){if(_0x230afb){var _0x192c13=typeof _0x46295b[_0xae3d('0x20')]==='undefined'&&typeof _0x46295b[_0xae3d('0x21')]===_0xae3d('0x22');var _0x2e31f1=_0x230afb['count'];var _0x3f8cf9=_0x192c13?0x0:_0x46295b[_0xae3d('0x20')];var _0x558e42=_0x192c13?_0x230afb['count']:_0x46295b[_0xae3d('0x20')]+_0x46295b[_0xae3d('0x21')];var _0x19c44d;if(_0x558e42>=_0x2e31f1){_0x558e42=_0x2e31f1;_0x19c44d=0xc8;}else{_0x19c44d=0xce;}_0x42f4b4[_0xae3d('0x1d')](_0x19c44d);return _0x42f4b4[_0xae3d('0x23')]('Content-Range',_0x3f8cf9+'-'+_0x558e42+'/'+_0x2e31f1)[_0xae3d('0x1f')](_0x230afb);}return null;};}function patchUpdates(_0x48f00e){return function(_0x4a09c2){try{jsonpatch[_0xae3d('0x24')](_0x4a09c2,_0x48f00e,!![]);}catch(_0x1415e8){return BPromise[_0xae3d('0x25')](_0x1415e8);}return _0x4a09c2[_0xae3d('0x26')]();};}function saveUpdates(_0x3e7afc,_0x26c419){return function(_0x155099){if(_0x155099){return _0x155099[_0xae3d('0x27')](_0x3e7afc)[_0xae3d('0x28')](function(_0x300be8){return _0x300be8;});}return null;};}function removeEntity(_0x9bf34a,_0x37f5ff){return function(_0x1b2acb){if(_0x1b2acb){return _0x1b2acb[_0xae3d('0x29')]()[_0xae3d('0x28')](function(){_0x9bf34a[_0xae3d('0x1d')](0xcc)[_0xae3d('0x1e')]();});}};}function handleEntityNotFound(_0x2131e9,_0x1b1217){return function(_0x5d45db){if(!_0x5d45db){_0x2131e9[_0xae3d('0x1c')](0x194);}return _0x5d45db;};}function handleError(_0x185e71,_0xb5940){_0xb5940=_0xb5940||0x1f4;return function(_0x52df0f){logger[_0xae3d('0x2a')](_0x52df0f[_0xae3d('0x2b')]);if(_0x52df0f[_0xae3d('0x2c')]){delete _0x52df0f['name'];}_0x185e71['status'](_0xb5940)[_0xae3d('0x2d')](_0x52df0f);};}exports[_0xae3d('0x2e')]=function(_0x3a5840,_0x3114f9){var _0xb69ec9={},_0x561371={},_0x1d1483={'count':0x0,'rows':[]};var _0x3a2434=_['map'](db[_0xae3d('0x2f')][_0xae3d('0x30')],function(_0x2cf750){return{'name':_0x2cf750[_0xae3d('0x31')],'type':_0x2cf750[_0xae3d('0x32')][_0xae3d('0x33')]};});_0x561371['model']=_['map'](_0x3a2434,'name');_0x561371[_0xae3d('0x34')]=_[_0xae3d('0x35')](_0x3a5840[_0xae3d('0x34')]);_0x561371[_0xae3d('0x36')]=_['intersection'](_0x561371[_0xae3d('0x37')],_0x561371[_0xae3d('0x34')]);_0xb69ec9[_0xae3d('0x38')]=_[_0xae3d('0x39')](_0x561371[_0xae3d('0x37')],qs[_0xae3d('0x3a')](_0x3a5840[_0xae3d('0x34')]['fields']));_0xb69ec9[_0xae3d('0x38')]=_0xb69ec9['attributes']['length']?_0xb69ec9[_0xae3d('0x38')]:_0x561371['model'];if(!_0x3a5840[_0xae3d('0x34')]['hasOwnProperty']('nolimit')){_0xb69ec9[_0xae3d('0x21')]=qs[_0xae3d('0x21')](_0x3a5840[_0xae3d('0x34')]['limit']);_0xb69ec9[_0xae3d('0x20')]=qs['offset'](_0x3a5840[_0xae3d('0x34')][_0xae3d('0x20')]);}_0xb69ec9[_0xae3d('0x3b')]=qs[_0xae3d('0x3c')](_0x3a5840[_0xae3d('0x34')][_0xae3d('0x3c')]);_0xb69ec9[_0xae3d('0x3d')]=qs[_0xae3d('0x36')](_[_0xae3d('0x3e')](_0x3a5840[_0xae3d('0x34')],_0x561371[_0xae3d('0x36')]),_0x3a2434);if(_0x3a5840['query']['filter']){_0xb69ec9[_0xae3d('0x3d')]=_['merge'](_0xb69ec9[_0xae3d('0x3d')],{'$or':_[_0xae3d('0x3f')](_0x3a2434,function(_0x1db3c1){if(_0x1db3c1[_0xae3d('0x32')]!==_0xae3d('0x40')){var _0x35db44={};_0x35db44[_0x1db3c1[_0xae3d('0x2c')]]={'$like':'%'+_0x3a5840[_0xae3d('0x34')][_0xae3d('0x41')]+'%'};return _0x35db44;}})});}_0xb69ec9=_[_0xae3d('0x42')]({},_0xb69ec9,_0x3a5840[_0xae3d('0x43')]);var _0x549db8={'where':_0xb69ec9[_0xae3d('0x3d')]};return db[_0xae3d('0x2f')][_0xae3d('0x44')](_0x549db8)['then'](function(_0x4df102){_0x1d1483[_0xae3d('0x44')]=_0x4df102;if(_0x3a5840[_0xae3d('0x34')]['includeAll']){_0xb69ec9[_0xae3d('0x45')]=[{'all':!![]}];}return db[_0xae3d('0x2f')][_0xae3d('0x46')](_0xb69ec9);})[_0xae3d('0x28')](function(_0x436a04){_0x1d1483[_0xae3d('0x47')]=_0x436a04;return _0x1d1483;})['then'](respondWithFilteredResult(_0x3114f9,_0xb69ec9))[_0xae3d('0x48')](handleError(_0x3114f9,null));};exports[_0xae3d('0x49')]=function(_0xce7f34,_0x938811){var _0x1fef90={'raw':!![],'where':{'id':_0xce7f34[_0xae3d('0x4a')]['id']}},_0x515220={};_0x515220['model']=_[_0xae3d('0x35')](db[_0xae3d('0x2f')][_0xae3d('0x30')]);_0x515220[_0xae3d('0x34')]=_['keys'](_0xce7f34['query']);_0x515220['filters']=_[_0xae3d('0x39')](_0x515220[_0xae3d('0x37')],_0x515220['query']);_0x1fef90['attributes']=_['intersection'](_0x515220[_0xae3d('0x37')],qs[_0xae3d('0x3a')](_0xce7f34[_0xae3d('0x34')][_0xae3d('0x3a')]));_0x1fef90[_0xae3d('0x38')]=_0x1fef90[_0xae3d('0x38')][_0xae3d('0x4b')]?_0x1fef90['attributes']:_0x515220['model'];if(_0xce7f34['query'][_0xae3d('0x4c')]){_0x1fef90['include']=[{'all':!![]}];}_0x1fef90=_[_0xae3d('0x42')]({},_0x1fef90,_0xce7f34[_0xae3d('0x43')]);return db[_0xae3d('0x2f')][_0xae3d('0x4d')](_0x1fef90)[_0xae3d('0x28')](handleEntityNotFound(_0x938811,null))[_0xae3d('0x28')](respondWithResult(_0x938811,null))[_0xae3d('0x48')](handleError(_0x938811,null));};exports[_0xae3d('0x4e')]=function(_0x38f92d,_0x4ed0f9){return db[_0xae3d('0x2f')]['describe']()['then'](respondWithResult(_0x4ed0f9,null))['catch'](handleError(_0x4ed0f9,null));};exports[_0xae3d('0x27')]=function(_0xc8f551,_0x39f213){if(_0xc8f551[_0xae3d('0x4f')]['uniqueid']){delete _0xc8f551['body'][_0xae3d('0x50')];}return db[_0xae3d('0x2f')][_0xae3d('0x4d')]({'where':{'uniqueid':_0xc8f551[_0xae3d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x39f213,null))[_0xae3d('0x28')](saveUpdates(_0xc8f551[_0xae3d('0x4f')],null))[_0xae3d('0x28')](respondWithResult(_0x39f213,null))[_0xae3d('0x48')](handleError(_0x39f213,null));};exports[_0xae3d('0x51')]=function(_0x38ccf1,_0x3e30ea,_0x291c7d){return db[_0xae3d('0x2f')][_0xae3d('0x46')]({'raw':![],'where':{'VoiceQueueId':_0x38ccf1[_0xae3d('0x4a')]['id']},'attributes':[[db[_0xae3d('0x52')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xae3d('0x53')](_0xae3d('0x54')))),'noSuchContacts'],[db[_0xae3d('0x52')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xae3d('0x52')][_0xae3d('0x53')](_0xae3d('0x55')))),_0xae3d('0x56')],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db[_0xae3d('0x52')]['fn']('IF',db['sequelize'][_0xae3d('0x53')](_0xae3d('0x58')))),_0xae3d('0x59')],[db[_0xae3d('0x52')]['fn']('COUNT',db[_0xae3d('0x52')]['fn']('IF',db[_0xae3d('0x52')][_0xae3d('0x53')](_0xae3d('0x5a')))),'congestionContacts'],[db['sequelize']['fn']('COUNT',db[_0xae3d('0x52')]['fn']('IF',db['sequelize']['literal'](_0xae3d('0x5b')))),_0xae3d('0x5c')],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db[_0xae3d('0x52')]['fn']('IF',db[_0xae3d('0x52')]['literal'](_0xae3d('0x5d')))),_0xae3d('0x5e')],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db[_0xae3d('0x52')]['fn']('IF',db[_0xae3d('0x52')]['literal'](_0xae3d('0x5f')))),_0xae3d('0x60')],[db[_0xae3d('0x52')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xae3d('0x53')](_0xae3d('0x61')))),'answeringMachine']]})[_0xae3d('0x28')](handleEntityNotFound(_0x3e30ea,null))[_0xae3d('0x28')](respondWithResult(_0x3e30ea,null))[_0xae3d('0x48')](handleError(_0x3e30ea,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x3a39ed,_0x31b362,_0x253ee4){return db[_0xae3d('0x2f')][_0xae3d('0x46')]({'raw':![],'where':{'CampaignId':_0x3a39ed[_0xae3d('0x4a')]['id']},'attributes':[[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db['sequelize']['fn']('IF',db['sequelize'][_0xae3d('0x53')](_0xae3d('0x54')))),_0xae3d('0x62')],[db['sequelize']['fn']('COUNT',db[_0xae3d('0x52')]['fn']('IF',db[_0xae3d('0x52')][_0xae3d('0x53')](_0xae3d('0x55')))),'noAnswerContacts'],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db['sequelize']['fn']('IF',db[_0xae3d('0x52')][_0xae3d('0x53')](_0xae3d('0x58')))),_0xae3d('0x59')],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db[_0xae3d('0x52')]['fn']('IF',db['sequelize'][_0xae3d('0x53')](_0xae3d('0x5a')))),_0xae3d('0x63')],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db['sequelize']['fn']('IF',db[_0xae3d('0x52')][_0xae3d('0x53')](_0xae3d('0x5b')))),_0xae3d('0x5c')],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db['sequelize']['fn']('IF',db[_0xae3d('0x52')][_0xae3d('0x53')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xae3d('0x5e')],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db['sequelize']['fn']('IF',db['sequelize'][_0xae3d('0x53')](_0xae3d('0x5f')))),_0xae3d('0x60')],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db[_0xae3d('0x52')]['fn']('IF',db[_0xae3d('0x52')]['literal'](_0xae3d('0x61')))),_0xae3d('0x64')]]})['then'](handleEntityNotFound(_0x31b362,null))[_0xae3d('0x28')](respondWithResult(_0x31b362,null))['catch'](handleError(_0x31b362,null));};exports[_0xae3d('0x65')]=function(_0x115e99,_0x26c409,_0x4709ea){return db[_0xae3d('0x66')]['find']({'where':{'id':_0x115e99[_0xae3d('0x4a')]['id']}})[_0xae3d('0x28')](handleEntityNotFound(_0x26c409,null))[_0xae3d('0x28')](function(_0x5f1e9c){var _0x546991;if(_0x5f1e9c){_0x546991=squel[_0xae3d('0x67')]()[_0xae3d('0x68')]('cm_hopper')['fromQuery']([_0xae3d('0x69'),'scheduledAt',_0xae3d('0x6a'),'ListId','VoiceQueueId','createdAt','updatedAt'],squel[_0xae3d('0x6b')]()[_0xae3d('0x6c')]('ANY_VALUE(calleridnum)','phone')[_0xae3d('0x6c')](_0xae3d('0x6d'),_0xae3d('0x6e'))[_0xae3d('0x6c')](_0xae3d('0x6f'),_0xae3d('0x6a'))[_0xae3d('0x6c')]('ANY_VALUE(ListId)',_0xae3d('0x70'))[_0xae3d('0x6c')](_0xae3d('0x71'),_0xae3d('0x72'))[_0xae3d('0x6c')](_0xae3d('0x6d'),'createdAt')[_0xae3d('0x6c')](_0xae3d('0x6d'),'updatedAt')['from'](_0xae3d('0x73'))[_0xae3d('0x3d')]('VoiceQueueId\x20=\x20?',_0x115e99[_0xae3d('0x4a')]['id'][_0xae3d('0x74')]())[_0xae3d('0x3d')]('state\x20=\x20?',_0x115e99[_0xae3d('0x4f')][_0xae3d('0x75')]['toString']())['where'](_0xae3d('0x76'))[_0xae3d('0x3d')](_0xae3d('0x77'),squel['select']()[_0xae3d('0x6c')](_0xae3d('0x69'))['from'](_0xae3d('0x78'))[_0xae3d('0x3d')](_0xae3d('0x79'),_0x115e99['params']['id'][_0xae3d('0x74')]()))[_0xae3d('0x3d')](_0xae3d('0x77'),squel['select']()[_0xae3d('0x6c')]('calleridnum')[_0xae3d('0x7a')]('cm_hopper_final')['where'](_0xae3d('0x79'),_0x115e99['params']['id'][_0xae3d('0x74')]())[_0xae3d('0x3d')](_0xae3d('0x7b')))[_0xae3d('0x7c')]('ContactId'))[_0xae3d('0x74')]();return db[_0xae3d('0x52')][_0xae3d('0x34')](_0x546991);}return[];})[_0xae3d('0x28')](respondWithResult(_0x26c409,null))[_0xae3d('0x48')](handleError(_0x26c409,null));};exports[_0xae3d('0x7d')]=function(_0x1c5f67,_0xa083d0,_0x26e422){return db[_0xae3d('0x7e')][_0xae3d('0x4d')]({'where':{'id':_0x1c5f67[_0xae3d('0x4a')]['id']}})[_0xae3d('0x28')](handleEntityNotFound(_0xa083d0,null))[_0xae3d('0x28')](function(_0xf281f5){var _0x3261e5;if(_0xf281f5){_0x3261e5=squel[_0xae3d('0x67')]()['into'](_0xae3d('0x78'))[_0xae3d('0x7f')]([_0xae3d('0x69'),_0xae3d('0x6e'),_0xae3d('0x6a'),'ListId',_0xae3d('0x80'),_0xae3d('0x81'),_0xae3d('0x82')],squel[_0xae3d('0x6b')]()[_0xae3d('0x6c')](_0xae3d('0x83'),_0xae3d('0x69'))[_0xae3d('0x6c')]('NOW()',_0xae3d('0x6e'))[_0xae3d('0x6c')](_0xae3d('0x6f'),'ContactId')[_0xae3d('0x6c')](_0xae3d('0x84'),_0xae3d('0x70'))['field'](_0xae3d('0x85'),_0xae3d('0x80'))['field'](_0xae3d('0x6d'),'createdAt')[_0xae3d('0x6c')]('NOW()',_0xae3d('0x82'))[_0xae3d('0x7a')](_0xae3d('0x73'))[_0xae3d('0x3d')](_0xae3d('0x86'),_0x1c5f67['params']['id'][_0xae3d('0x74')]())[_0xae3d('0x3d')]('state\x20=\x20?',_0x1c5f67['body'][_0xae3d('0x75')][_0xae3d('0x74')]())[_0xae3d('0x3d')](_0xae3d('0x76'))['where'](_0xae3d('0x77'),squel[_0xae3d('0x6b')]()[_0xae3d('0x6c')]('phone')['from'](_0xae3d('0x78'))['where'](_0xae3d('0x86'),_0x1c5f67['params']['id'][_0xae3d('0x74')]()))[_0xae3d('0x3d')](_0xae3d('0x77'),squel[_0xae3d('0x6b')]()['field'](_0xae3d('0x87'))[_0xae3d('0x7a')](_0xae3d('0x73'))['where'](_0xae3d('0x86'),_0x1c5f67['params']['id'][_0xae3d('0x74')]())[_0xae3d('0x3d')]('state\x20=\x204'))['group'](_0xae3d('0x6a')))['toString']();return db['sequelize'][_0xae3d('0x34')](_0x3261e5);}return[];})['then'](respondWithResult(_0xa083d0,null))[_0xae3d('0x48')](handleError(_0xa083d0,null));};exports['checkContactHopper']=function(_0x31f606,_0x47aa7a,_0x27c0ff){return db['CmHopper'][_0xae3d('0x88')]({'where':{'VoiceQueueId':_0x31f606['body'][_0xae3d('0x72')],'CampaignId':_0x31f606[_0xae3d('0x4f')][_0xae3d('0x80')],'ContactId':_0x31f606[_0xae3d('0x4f')][_0xae3d('0x6a')]}})[_0xae3d('0x28')](handleEntityNotFound(_0x47aa7a,null))[_0xae3d('0x28')](function(_0x95c4ce){if(_0x95c4ce){return _0x95c4ce;}return null;})[_0xae3d('0x28')](respondWithResult(_0x47aa7a,null))['catch'](handleError(_0x47aa7a,null));}; \ No newline at end of file +var _0xeda8=['calleridnum','state\x20=\x204','group','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','checkContactHopper','findOne','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','then','stack','name','send','index','map','CmHopperFinal','rawAttributes','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','includeAll','include','rows','catch','show','params','keys','options','find','body','uniqueid','countContactsQueueCampaignHopperFinal','findAll','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','congestionContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','VoiceQueue','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','field','ANY_VALUE(calleridnum)','phone','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20NOT\x20IN\x20(?)','select'];(function(_0x310504,_0x26ad95){var _0x5b36d0=function(_0x253f28){while(--_0x253f28){_0x310504['push'](_0x310504['shift']());}};_0x5b36d0(++_0x26ad95);}(_0xeda8,0x104));var _0x8eda=function(_0x3103c1,_0x4833ad){_0x3103c1=_0x3103c1-0x0;var _0x32c31c=_0xeda8[_0x3103c1];return _0x32c31c;};'use strict';var emlformat=require(_0x8eda('0x0'));var rimraf=require(_0x8eda('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8eda('0x2'));var rp=require(_0x8eda('0x3'));var moment=require(_0x8eda('0x4'));var BPromise=require(_0x8eda('0x5'));var Mustache=require(_0x8eda('0x6'));var util=require(_0x8eda('0x7'));var path=require(_0x8eda('0x8'));var sox=require(_0x8eda('0x9'));var csv=require(_0x8eda('0xa'));var ejs=require(_0x8eda('0xb'));var fs=require('fs');var fs_extra=require(_0x8eda('0xc'));var _=require(_0x8eda('0xd'));var squel=require('squel');var crypto=require(_0x8eda('0xe'));var jsforce=require(_0x8eda('0xf'));var deskjs=require(_0x8eda('0x10'));var toCsv=require(_0x8eda('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8eda('0x11'));var as=require(_0x8eda('0x12'));var hardwareService=require(_0x8eda('0x13'));var logger=require('../../config/logger')(_0x8eda('0x14'));var utils=require('../../config/utils');var config=require(_0x8eda('0x15'));var licenseUtil=require(_0x8eda('0x16'));var db=require(_0x8eda('0x17'))['db'];function respondWithStatusCode(_0x1ad3df,_0x337573){_0x337573=_0x337573||0xcc;return function(_0x3af00c){if(_0x3af00c){return _0x1ad3df[_0x8eda('0x18')](_0x337573);}return _0x1ad3df[_0x8eda('0x19')](_0x337573)['end']();};}function respondWithResult(_0x500bd4,_0xe04d90){_0xe04d90=_0xe04d90||0xc8;return function(_0x223dcf){if(_0x223dcf){return _0x500bd4['status'](_0xe04d90)[_0x8eda('0x1a')](_0x223dcf);}};}function respondWithFilteredResult(_0x34b1ee,_0x123905){return function(_0x56ff8a){if(_0x56ff8a){var _0x3f2925=typeof _0x123905['offset']===_0x8eda('0x1b')&&typeof _0x123905['limit']===_0x8eda('0x1b');var _0x58023b=_0x56ff8a[_0x8eda('0x1c')];var _0x2a4d2b=_0x3f2925?0x0:_0x123905['offset'];var _0x5e44b7=_0x3f2925?_0x56ff8a[_0x8eda('0x1c')]:_0x123905[_0x8eda('0x1d')]+_0x123905[_0x8eda('0x1e')];var _0x41abfa;if(_0x5e44b7>=_0x58023b){_0x5e44b7=_0x58023b;_0x41abfa=0xc8;}else{_0x41abfa=0xce;}_0x34b1ee[_0x8eda('0x19')](_0x41abfa);return _0x34b1ee[_0x8eda('0x1f')](_0x8eda('0x20'),_0x2a4d2b+'-'+_0x5e44b7+'/'+_0x58023b)[_0x8eda('0x1a')](_0x56ff8a);}return null;};}function patchUpdates(_0x850cce){return function(_0x232786){try{jsonpatch[_0x8eda('0x21')](_0x232786,_0x850cce,!![]);}catch(_0x57f336){return BPromise[_0x8eda('0x22')](_0x57f336);}return _0x232786['save']();};}function saveUpdates(_0x45517e,_0x5183bc){return function(_0x1033d6){if(_0x1033d6){return _0x1033d6[_0x8eda('0x23')](_0x45517e)['then'](function(_0x58e54b){return _0x58e54b;});}return null;};}function removeEntity(_0x56dba4,_0x2a4c99){return function(_0x17cae8){if(_0x17cae8){return _0x17cae8['destroy']()[_0x8eda('0x24')](function(){_0x56dba4[_0x8eda('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25e955,_0xfa57ca){return function(_0x24b1e1){if(!_0x24b1e1){_0x25e955[_0x8eda('0x18')](0x194);}return _0x24b1e1;};}function handleError(_0x2e42e4,_0x5c8488){_0x5c8488=_0x5c8488||0x1f4;return function(_0x41b5a9){logger['error'](_0x41b5a9[_0x8eda('0x25')]);if(_0x41b5a9[_0x8eda('0x26')]){delete _0x41b5a9[_0x8eda('0x26')];}_0x2e42e4['status'](_0x5c8488)[_0x8eda('0x27')](_0x41b5a9);};}exports[_0x8eda('0x28')]=function(_0x1dd12,_0x4cdd2e){var _0x1616ea={},_0x11a999={},_0x5dd315={'count':0x0,'rows':[]};var _0x27d2ce=_[_0x8eda('0x29')](db[_0x8eda('0x2a')][_0x8eda('0x2b')],function(_0x53274e){return{'name':_0x53274e['fieldName'],'type':_0x53274e['type'][_0x8eda('0x2c')]};});_0x11a999[_0x8eda('0x2d')]=_[_0x8eda('0x29')](_0x27d2ce,'name');_0x11a999['query']=_['keys'](_0x1dd12[_0x8eda('0x2e')]);_0x11a999[_0x8eda('0x2f')]=_[_0x8eda('0x30')](_0x11a999['model'],_0x11a999['query']);_0x1616ea['attributes']=_[_0x8eda('0x30')](_0x11a999[_0x8eda('0x2d')],qs[_0x8eda('0x31')](_0x1dd12[_0x8eda('0x2e')][_0x8eda('0x31')]));_0x1616ea[_0x8eda('0x32')]=_0x1616ea[_0x8eda('0x32')][_0x8eda('0x33')]?_0x1616ea[_0x8eda('0x32')]:_0x11a999[_0x8eda('0x2d')];if(!_0x1dd12[_0x8eda('0x2e')][_0x8eda('0x34')](_0x8eda('0x35'))){_0x1616ea[_0x8eda('0x1e')]=qs['limit'](_0x1dd12[_0x8eda('0x2e')][_0x8eda('0x1e')]);_0x1616ea[_0x8eda('0x1d')]=qs['offset'](_0x1dd12['query'][_0x8eda('0x1d')]);}_0x1616ea[_0x8eda('0x36')]=qs[_0x8eda('0x37')](_0x1dd12[_0x8eda('0x2e')]['sort']);_0x1616ea[_0x8eda('0x38')]=qs[_0x8eda('0x2f')](_[_0x8eda('0x39')](_0x1dd12[_0x8eda('0x2e')],_0x11a999[_0x8eda('0x2f')]),_0x27d2ce);if(_0x1dd12[_0x8eda('0x2e')]['filter']){_0x1616ea[_0x8eda('0x38')]=_[_0x8eda('0x3a')](_0x1616ea[_0x8eda('0x38')],{'$or':_[_0x8eda('0x29')](_0x27d2ce,function(_0x261e12){if(_0x261e12[_0x8eda('0x3b')]!=='VIRTUAL'){var _0x1067eb={};_0x1067eb[_0x261e12[_0x8eda('0x26')]]={'$like':'%'+_0x1dd12[_0x8eda('0x2e')][_0x8eda('0x3c')]+'%'};return _0x1067eb;}})});}_0x1616ea=_[_0x8eda('0x3a')]({},_0x1616ea,_0x1dd12['options']);var _0x17ee80={'where':_0x1616ea[_0x8eda('0x38')]};return db[_0x8eda('0x2a')]['count'](_0x17ee80)[_0x8eda('0x24')](function(_0x5d361e){_0x5dd315[_0x8eda('0x1c')]=_0x5d361e;if(_0x1dd12[_0x8eda('0x2e')][_0x8eda('0x3d')]){_0x1616ea[_0x8eda('0x3e')]=[{'all':!![]}];}return db[_0x8eda('0x2a')]['findAll'](_0x1616ea);})['then'](function(_0xbf14a1){_0x5dd315[_0x8eda('0x3f')]=_0xbf14a1;return _0x5dd315;})[_0x8eda('0x24')](respondWithFilteredResult(_0x4cdd2e,_0x1616ea))[_0x8eda('0x40')](handleError(_0x4cdd2e,null));};exports[_0x8eda('0x41')]=function(_0x13b3bc,_0x18b043){var _0xcb6164={'raw':!![],'where':{'id':_0x13b3bc[_0x8eda('0x42')]['id']}},_0x184590={};_0x184590[_0x8eda('0x2d')]=_[_0x8eda('0x43')](db[_0x8eda('0x2a')][_0x8eda('0x2b')]);_0x184590[_0x8eda('0x2e')]=_[_0x8eda('0x43')](_0x13b3bc[_0x8eda('0x2e')]);_0x184590[_0x8eda('0x2f')]=_[_0x8eda('0x30')](_0x184590['model'],_0x184590[_0x8eda('0x2e')]);_0xcb6164[_0x8eda('0x32')]=_['intersection'](_0x184590[_0x8eda('0x2d')],qs[_0x8eda('0x31')](_0x13b3bc['query'][_0x8eda('0x31')]));_0xcb6164[_0x8eda('0x32')]=_0xcb6164['attributes'][_0x8eda('0x33')]?_0xcb6164[_0x8eda('0x32')]:_0x184590[_0x8eda('0x2d')];if(_0x13b3bc['query'][_0x8eda('0x3d')]){_0xcb6164[_0x8eda('0x3e')]=[{'all':!![]}];}_0xcb6164=_[_0x8eda('0x3a')]({},_0xcb6164,_0x13b3bc[_0x8eda('0x44')]);return db[_0x8eda('0x2a')][_0x8eda('0x45')](_0xcb6164)[_0x8eda('0x24')](handleEntityNotFound(_0x18b043,null))['then'](respondWithResult(_0x18b043,null))[_0x8eda('0x40')](handleError(_0x18b043,null));};exports['describe']=function(_0xcde3e,_0x52b026){return db[_0x8eda('0x2a')]['describe']()[_0x8eda('0x24')](respondWithResult(_0x52b026,null))['catch'](handleError(_0x52b026,null));};exports[_0x8eda('0x23')]=function(_0x3aca19,_0xf445){if(_0x3aca19[_0x8eda('0x46')][_0x8eda('0x47')]){delete _0x3aca19[_0x8eda('0x46')][_0x8eda('0x47')];}return db[_0x8eda('0x2a')][_0x8eda('0x45')]({'where':{'uniqueid':_0x3aca19[_0x8eda('0x42')]['id']}})[_0x8eda('0x24')](handleEntityNotFound(_0xf445,null))[_0x8eda('0x24')](saveUpdates(_0x3aca19['body'],null))[_0x8eda('0x24')](respondWithResult(_0xf445,null))[_0x8eda('0x40')](handleError(_0xf445,null));};exports[_0x8eda('0x48')]=function(_0x3259de,_0x33ba39,_0x389399){return db[_0x8eda('0x2a')][_0x8eda('0x49')]({'raw':![],'where':{'VoiceQueueId':_0x3259de[_0x8eda('0x42')]['id']},'attributes':[[db[_0x8eda('0x4a')]['fn'](_0x8eda('0x4b'),db[_0x8eda('0x4a')]['fn']('IF',db[_0x8eda('0x4a')][_0x8eda('0x4c')](_0x8eda('0x4d')))),'noSuchContacts'],[db[_0x8eda('0x4a')]['fn'](_0x8eda('0x4b'),db[_0x8eda('0x4a')]['fn']('IF',db[_0x8eda('0x4a')][_0x8eda('0x4c')](_0x8eda('0x4e')))),'noAnswerContacts'],[db[_0x8eda('0x4a')]['fn'](_0x8eda('0x4b'),db[_0x8eda('0x4a')]['fn']('IF',db['sequelize'][_0x8eda('0x4c')]('`state`\x20=\x205,\x201,\x20null'))),_0x8eda('0x4f')],[db[_0x8eda('0x4a')]['fn'](_0x8eda('0x4b'),db['sequelize']['fn']('IF',db[_0x8eda('0x4a')][_0x8eda('0x4c')](_0x8eda('0x50')))),'congestionContacts'],[db[_0x8eda('0x4a')]['fn'](_0x8eda('0x4b'),db[_0x8eda('0x4a')]['fn']('IF',db[_0x8eda('0x4a')][_0x8eda('0x4c')](_0x8eda('0x51')))),_0x8eda('0x52')],[db[_0x8eda('0x4a')]['fn'](_0x8eda('0x4b'),db[_0x8eda('0x4a')]['fn']('IF',db['sequelize'][_0x8eda('0x4c')](_0x8eda('0x53')))),'abandonedContacts'],[db[_0x8eda('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2022,\x201,\x20null'))),_0x8eda('0x54')],[db['sequelize']['fn'](_0x8eda('0x4b'),db[_0x8eda('0x4a')]['fn']('IF',db[_0x8eda('0x4a')][_0x8eda('0x4c')](_0x8eda('0x55')))),_0x8eda('0x56')]]})[_0x8eda('0x24')](handleEntityNotFound(_0x33ba39,null))['then'](respondWithResult(_0x33ba39,null))[_0x8eda('0x40')](handleError(_0x33ba39,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0xdd71ce,_0x4ba827,_0xfb98bf){return db['CmHopperFinal'][_0x8eda('0x49')]({'raw':![],'where':{'CampaignId':_0xdd71ce[_0x8eda('0x42')]['id']},'attributes':[[db[_0x8eda('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x8eda('0x4c')](_0x8eda('0x4d')))),'noSuchContacts'],[db[_0x8eda('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x8eda('0x4a')][_0x8eda('0x4c')](_0x8eda('0x4e')))),_0x8eda('0x57')],[db['sequelize']['fn']('COUNT',db[_0x8eda('0x4a')]['fn']('IF',db[_0x8eda('0x4a')][_0x8eda('0x4c')](_0x8eda('0x58')))),'busyContacts'],[db[_0x8eda('0x4a')]['fn']('COUNT',db[_0x8eda('0x4a')]['fn']('IF',db['sequelize'][_0x8eda('0x4c')]('`state`\x20=\x208,\x201,\x20null'))),_0x8eda('0x59')],[db[_0x8eda('0x4a')]['fn'](_0x8eda('0x4b'),db[_0x8eda('0x4a')]['fn']('IF',db[_0x8eda('0x4a')][_0x8eda('0x4c')](_0x8eda('0x51')))),_0x8eda('0x52')],[db[_0x8eda('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x8eda('0x4a')]['literal'](_0x8eda('0x53')))),_0x8eda('0x5a')],[db[_0x8eda('0x4a')]['fn'](_0x8eda('0x4b'),db[_0x8eda('0x4a')]['fn']('IF',db['sequelize']['literal'](_0x8eda('0x5b')))),_0x8eda('0x54')],[db[_0x8eda('0x4a')]['fn'](_0x8eda('0x4b'),db[_0x8eda('0x4a')]['fn']('IF',db[_0x8eda('0x4a')][_0x8eda('0x4c')]('`state`\x20=\x2019,\x201,\x20null'))),_0x8eda('0x56')]]})[_0x8eda('0x24')](handleEntityNotFound(_0x4ba827,null))['then'](respondWithResult(_0x4ba827,null))[_0x8eda('0x40')](handleError(_0x4ba827,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x47f57c,_0x49d1a1,_0x5e66cd){return db[_0x8eda('0x5c')][_0x8eda('0x45')]({'where':{'id':_0x47f57c[_0x8eda('0x42')]['id']}})[_0x8eda('0x24')](handleEntityNotFound(_0x49d1a1,null))[_0x8eda('0x24')](function(_0xe5d324){var _0x589c2f;if(_0xe5d324){_0x589c2f=squel[_0x8eda('0x5d')]()[_0x8eda('0x5e')](_0x8eda('0x5f'))[_0x8eda('0x60')](['phone',_0x8eda('0x61'),_0x8eda('0x62'),_0x8eda('0x63'),_0x8eda('0x64'),_0x8eda('0x65'),_0x8eda('0x66')],squel['select']()[_0x8eda('0x67')](_0x8eda('0x68'),_0x8eda('0x69'))[_0x8eda('0x67')](_0x8eda('0x6a'),_0x8eda('0x61'))[_0x8eda('0x67')](_0x8eda('0x6b'),_0x8eda('0x62'))[_0x8eda('0x67')](_0x8eda('0x6c'),_0x8eda('0x63'))[_0x8eda('0x67')](_0x8eda('0x6d'),'VoiceQueueId')['field'](_0x8eda('0x6a'),_0x8eda('0x65'))[_0x8eda('0x67')](_0x8eda('0x6a'),'updatedAt')[_0x8eda('0x6e')](_0x8eda('0x6f'))['where'](_0x8eda('0x70'),_0x47f57c['params']['id'][_0x8eda('0x71')]())[_0x8eda('0x38')](_0x8eda('0x72'),_0x47f57c['body'][_0x8eda('0x73')][_0x8eda('0x71')]())[_0x8eda('0x38')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x8eda('0x38')](_0x8eda('0x74'),squel[_0x8eda('0x75')]()[_0x8eda('0x67')]('phone')['from'](_0x8eda('0x5f'))[_0x8eda('0x38')](_0x8eda('0x70'),_0x47f57c[_0x8eda('0x42')]['id']['toString']()))[_0x8eda('0x38')](_0x8eda('0x74'),squel[_0x8eda('0x75')]()[_0x8eda('0x67')](_0x8eda('0x76'))['from'](_0x8eda('0x6f'))[_0x8eda('0x38')](_0x8eda('0x70'),_0x47f57c['params']['id']['toString']())['where'](_0x8eda('0x77')))[_0x8eda('0x78')](_0x8eda('0x62')))[_0x8eda('0x71')]();return db[_0x8eda('0x4a')][_0x8eda('0x2e')](_0x589c2f);}return[];})[_0x8eda('0x24')](respondWithResult(_0x49d1a1,null))[_0x8eda('0x40')](handleError(_0x49d1a1,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x1bbe8b,_0x437c6f,_0x1006b1){return db['Campaign'][_0x8eda('0x45')]({'where':{'id':_0x1bbe8b[_0x8eda('0x42')]['id']}})[_0x8eda('0x24')](handleEntityNotFound(_0x437c6f,null))[_0x8eda('0x24')](function(_0x33350e){var _0x3e245f;if(_0x33350e){_0x3e245f=squel[_0x8eda('0x5d')]()[_0x8eda('0x5e')](_0x8eda('0x5f'))[_0x8eda('0x60')]([_0x8eda('0x69'),'scheduledAt',_0x8eda('0x62'),_0x8eda('0x63'),_0x8eda('0x79'),_0x8eda('0x65'),_0x8eda('0x66')],squel[_0x8eda('0x75')]()[_0x8eda('0x67')](_0x8eda('0x68'),_0x8eda('0x69'))[_0x8eda('0x67')](_0x8eda('0x6a'),'scheduledAt')['field']('ANY_VALUE(ContactId)',_0x8eda('0x62'))[_0x8eda('0x67')]('ANY_VALUE(ListId)',_0x8eda('0x63'))[_0x8eda('0x67')](_0x8eda('0x7a'),'CampaignId')[_0x8eda('0x67')]('NOW()',_0x8eda('0x65'))['field'](_0x8eda('0x6a'),_0x8eda('0x66'))['from'](_0x8eda('0x6f'))[_0x8eda('0x38')](_0x8eda('0x7b'),_0x1bbe8b[_0x8eda('0x42')]['id'][_0x8eda('0x71')]())[_0x8eda('0x38')](_0x8eda('0x72'),_0x1bbe8b[_0x8eda('0x46')][_0x8eda('0x73')][_0x8eda('0x71')]())['where']('calleridnum\x20IS\x20NOT\x20NULL')['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x8eda('0x75')]()[_0x8eda('0x67')](_0x8eda('0x69'))['from'](_0x8eda('0x5f'))[_0x8eda('0x38')](_0x8eda('0x7b'),_0x1bbe8b[_0x8eda('0x42')]['id'][_0x8eda('0x71')]()))[_0x8eda('0x38')](_0x8eda('0x74'),squel[_0x8eda('0x75')]()['field']('calleridnum')[_0x8eda('0x6e')](_0x8eda('0x6f'))['where'](_0x8eda('0x7b'),_0x1bbe8b[_0x8eda('0x42')]['id'][_0x8eda('0x71')]())['where'](_0x8eda('0x77')))[_0x8eda('0x78')](_0x8eda('0x62')))[_0x8eda('0x71')]();return db[_0x8eda('0x4a')][_0x8eda('0x2e')](_0x3e245f);}return[];})[_0x8eda('0x24')](respondWithResult(_0x437c6f,null))['catch'](handleError(_0x437c6f,null));};exports[_0x8eda('0x7c')]=function(_0x11f734,_0x4cb4e6,_0x5d8512){return db['CmHopper'][_0x8eda('0x7d')]({'where':{'VoiceQueueId':_0x11f734[_0x8eda('0x46')][_0x8eda('0x64')],'CampaignId':_0x11f734[_0x8eda('0x46')][_0x8eda('0x79')],'ContactId':_0x11f734[_0x8eda('0x46')][_0x8eda('0x62')]}})[_0x8eda('0x24')](handleEntityNotFound(_0x4cb4e6,null))[_0x8eda('0x24')](function(_0x1a3993){if(_0x1a3993){return _0x1a3993;}return null;})[_0x8eda('0x24')](respondWithResult(_0x4cb4e6,null))[_0x8eda('0x40')](handleError(_0x4cb4e6,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 187363f..08e6707 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 _0x37ee=['api','moment','path','rimraf','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','../../config/logger'];(function(_0x26aa38,_0x34d077){var _0xd1c8e=function(_0x5876c4){while(--_0x5876c4){_0x26aa38['push'](_0x26aa38['shift']());}};_0xd1c8e(++_0x34d077);}(_0x37ee,0xe8));var _0xe37e=function(_0xbc8ec2,_0x42daa3){_0xbc8ec2=_0xbc8ec2-0x0;var _0x5ab51f=_0x37ee[_0xbc8ec2];return _0x5ab51f;};'use strict';var _=require(_0xe37e('0x0'));var util=require('util');var logger=require(_0xe37e('0x1'))(_0xe37e('0x2'));var moment=require(_0xe37e('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe37e('0x4'));var rimraf=require(_0xe37e('0x5'));var config=require('../../config/environment');var attributes=require(_0xe37e('0x6'));module[_0xe37e('0x7')]=function(_0x3ace7d,_0x36db45){return _0x3ace7d[_0xe37e('0x8')](_0xe37e('0x9'),attributes,{'tableName':_0xe37e('0xa'),'paranoid':![],'indexes':[{'name':_0xe37e('0xb'),'fields':['calleridnum']},{'name':_0xe37e('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x9a82=['calleridnum','uniqueid','lodash','util','../../config/logger','api','request-promise','../../config/environment','define'];(function(_0xcba3d5,_0x4826e5){var _0x10c8df=function(_0x28726b){while(--_0x28726b){_0xcba3d5['push'](_0xcba3d5['shift']());}};_0x10c8df(++_0x4826e5);}(_0x9a82,0x17c));var _0x29a8=function(_0x5750f3,_0x4df013){_0x5750f3=_0x5750f3-0x0;var _0x548573=_0x9a82[_0x5750f3];return _0x548573;};'use strict';var _=require(_0x29a8('0x0'));var util=require(_0x29a8('0x1'));var logger=require(_0x29a8('0x2'))(_0x29a8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x29a8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x29a8('0x5'));var attributes=require('./cmHopperFinal.attributes');module['exports']=function(_0x33d4db,_0x1411d7){return _0x33d4db[_0x29a8('0x6')]('CmHopperFinal',attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0x29a8('0x7'),'fields':['calleridnum']},{'name':_0x29a8('0x8'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 474c029..01a8861 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(_0x38460c,_0x205284){var _0x168643=function(_0x402a47){while(--_0x402a47){_0x38460c['push'](_0x38460c['shift']());}};_0x168643(++_0x205284);}(_0x7a54,0x106));var _0x47a5=function(_0x1ff6bc,_0x5230ce){_0x1ff6bc=_0x1ff6bc-0x0;var _0x2039e6=_0x7a54[_0x1ff6bc];return _0x2039e6;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x2fff13,_0x98632c){var _0x28b59a=function(_0xdfb603){while(--_0xdfb603){_0x2fff13['push'](_0x2fff13['shift']());}};_0x28b59a(++_0x98632c);}(_0x7a54,0x106));var _0x47a5=function(_0x3b25e4,_0xe0453d){_0x3b25e4=_0x3b25e4-0x0;var _0x2d0665=_0x7a54[_0x3b25e4];return _0x2d0665;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index e57603e..f0f1a5b 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 _0xcb1a=['/describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','post','/voice/queue/moveContacts/:id','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','update','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x2f1a38,_0x33169a){var _0x440afc=function(_0x3e3ceb){while(--_0x3e3ceb){_0x2f1a38['push'](_0x2f1a38['shift']());}};_0x440afc(++_0x33169a);}(_0xcb1a,0xb6));var _0xacb1=function(_0x55701b,_0xf27776){_0x55701b=_0x55701b-0x0;var _0x56c18b=_0xcb1a[_0x55701b];return _0x56c18b;};'use strict';var multer=require(_0xacb1('0x0'));var util=require(_0xacb1('0x1'));var path=require(_0xacb1('0x2'));var timeout=require(_0xacb1('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xacb1('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xacb1('0x5'));var config=require(_0xacb1('0x6'));var controller=require('./cmHopperFinal.controller');router[_0xacb1('0x7')]('/',auth[_0xacb1('0x8')](),controller[_0xacb1('0x9')]);router[_0xacb1('0x7')](_0xacb1('0xa'),auth[_0xacb1('0x8')](),controller['describe']);router[_0xacb1('0x7')](_0xacb1('0xb'),auth[_0xacb1('0x8')](),controller[_0xacb1('0xc')]);router[_0xacb1('0x7')](_0xacb1('0xd'),auth[_0xacb1('0x8')](),controller[_0xacb1('0xe')]);router[_0xacb1('0x7')](_0xacb1('0xf'),auth[_0xacb1('0x8')](),controller['countContactsIvrCampaignHopperFinal']);router[_0xacb1('0x10')](_0xacb1('0x11'),auth['isAuthenticated'](),controller['moveContactsQueueCampaignHopperFinal']);router[_0xacb1('0x10')](_0xacb1('0x12'),auth[_0xacb1('0x8')](),controller[_0xacb1('0x13')]);router[_0xacb1('0x10')](_0xacb1('0x14'),auth['isAuthenticated'](),controller[_0xacb1('0x15')]);router['put'](_0xacb1('0xb'),auth[_0xacb1('0x8')](),controller[_0xacb1('0x16')]);module[_0xacb1('0x17')]=router; \ No newline at end of file +var _0x0776=['/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','post','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe'];(function(_0x197df3,_0x57d366){var _0xafdaf7=function(_0x5489b5){while(--_0x5489b5){_0x197df3['push'](_0x197df3['shift']());}};_0xafdaf7(++_0x57d366);}(_0x0776,0x128));var _0x6077=function(_0x3ce2a3,_0x250389){_0x3ce2a3=_0x3ce2a3-0x0;var _0x3305fd=_0x0776[_0x3ce2a3];return _0x3305fd;};'use strict';var multer=require(_0x6077('0x0'));var util=require(_0x6077('0x1'));var path=require(_0x6077('0x2'));var timeout=require(_0x6077('0x3'));var express=require(_0x6077('0x4'));var router=express[_0x6077('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x6077('0x6'));var interaction=require(_0x6077('0x7'));var config=require(_0x6077('0x8'));var controller=require('./cmHopperFinal.controller');router[_0x6077('0x9')]('/',auth[_0x6077('0xa')](),controller['index']);router[_0x6077('0x9')]('/describe',auth[_0x6077('0xa')](),controller[_0x6077('0xb')]);router[_0x6077('0x9')](_0x6077('0xc'),auth['isAuthenticated'](),controller[_0x6077('0xd')]);router[_0x6077('0x9')](_0x6077('0xe'),auth[_0x6077('0xa')](),controller[_0x6077('0xf')]);router['get']('/campaign/countAttributes/:id',auth['isAuthenticated'](),controller['countContactsIvrCampaignHopperFinal']);router['post']('/voice/queue/moveContacts/:id',auth[_0x6077('0xa')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0x6077('0x10')]('/voice/campaign/moveContacts/:id',auth[_0x6077('0xa')](),controller[_0x6077('0x11')]);router[_0x6077('0x10')](_0x6077('0x12'),auth[_0x6077('0xa')](),controller[_0x6077('0x13')]);router['put'](_0x6077('0xc'),auth[_0x6077('0xa')](),controller[_0x6077('0x14')]);module[_0x6077('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 71bfe79..e7e81e9 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 _0x4210=['sequelize','INTEGER','STRING','DATE','BOOLEAN'];(function(_0x65c0bb,_0x82e7b8){var _0x320bd5=function(_0x6e1675){while(--_0x6e1675){_0x65c0bb['push'](_0x65c0bb['shift']());}};_0x320bd5(++_0x82e7b8);}(_0x4210,0xdc));var _0x0421=function(_0x4e3d77,_0x3f65c7){_0x4e3d77=_0x4e3d77-0x0;var _0x26322f=_0x4210[_0x4e3d77];return _0x26322f;};'use strict';var Sequelize=require(_0x0421('0x0'));module['exports']={'state':{'type':Sequelize[_0x0421('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x0421('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x0421('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x0421('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x0421('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x0421('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x0421('0x2')]},'originatecalleridname':{'type':Sequelize[_0x0421('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x0421('0x3')]},'droptime':{'type':Sequelize[_0x0421('0x3')]},'endtime':{'type':Sequelize[_0x0421('0x3')]},'ringtime':{'type':Sequelize[_0x0421('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x0421('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x0421('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x0421('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x0421('0x2')]},'membername':{'type':Sequelize[_0x0421('0x2')]},'reason':{'type':Sequelize[_0x0421('0x2')]},'amd':{'type':Sequelize[_0x0421('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x0421('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x0421('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x0421('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x0421('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x0421('0x3')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x0421('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0421('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0421('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x0421('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x0421('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa86f=['INTEGER','STRING','DATE','BOOLEAN','sequelize'];(function(_0x44e239,_0x35c138){var _0x2df409=function(_0x3eb320){while(--_0x3eb320){_0x44e239['push'](_0x44e239['shift']());}};_0x2df409(++_0x35c138);}(_0xa86f,0x16c));var _0xfa86=function(_0x19ecd0,_0x5e2a2d){_0x19ecd0=_0x19ecd0-0x0;var _0x212fbb=_0xa86f[_0x19ecd0];return _0x212fbb;};'use strict';var Sequelize=require(_0xfa86('0x0'));module['exports']={'state':{'type':Sequelize[_0xfa86('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xfa86('0x2')]},'scheduledat':{'type':Sequelize[_0xfa86('0x3')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xfa86('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xfa86('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xfa86('0x2')]},'originatecalleridname':{'type':Sequelize[_0xfa86('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xfa86('0x3')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xfa86('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xfa86('0x3')]},'ringtime':{'type':Sequelize[_0xfa86('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xfa86('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xfa86('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xfa86('0x2')]},'campaign':{'type':Sequelize[_0xfa86('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xfa86('0x2')]},'amd':{'type':Sequelize[_0xfa86('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0xfa86('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0xfa86('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xfa86('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xfa86('0x3')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0xfa86('0x3')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xfa86('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xfa86('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xfa86('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xfa86('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xfa86('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 12dfa85..a105abf 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 _0xb3bd=['index','map','CmHopperHistory','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','show','find','catch','create','describe','body','uniqueid','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','apply','reject','save','update','then','end','error','name','send'];(function(_0x4afa24,_0x5a3713){var _0x3fcdf1=function(_0x19720a){while(--_0x19720a){_0x4afa24['push'](_0x4afa24['shift']());}};_0x3fcdf1(++_0x5a3713);}(_0xb3bd,0x1cd));var _0xdb3b=function(_0x421cf8,_0x23152c){_0x421cf8=_0x421cf8-0x0;var _0x145c48=_0xb3bd[_0x421cf8];return _0x145c48;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xdb3b('0x0'));var jsonpatch=require(_0xdb3b('0x1'));var rp=require(_0xdb3b('0x2'));var moment=require(_0xdb3b('0x3'));var BPromise=require(_0xdb3b('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xdb3b('0x5'));var sox=require(_0xdb3b('0x6'));var csv=require(_0xdb3b('0x7'));var ejs=require(_0xdb3b('0x8'));var fs=require('fs');var fs_extra=require(_0xdb3b('0x9'));var _=require(_0xdb3b('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdb3b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xdb3b('0x7'));var querystring=require(_0xdb3b('0xc'));var Papa=require(_0xdb3b('0xd'));var Redis=require(_0xdb3b('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xdb3b('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdb3b('0x10'));var logger=require(_0xdb3b('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xdb3b('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xdb3b('0x13'))['db'];function respondWithStatusCode(_0x1413a7,_0x50895a){_0x50895a=_0x50895a||0xcc;return function(_0x26ff43){if(_0x26ff43){return _0x1413a7[_0xdb3b('0x14')](_0x50895a);}return _0x1413a7[_0xdb3b('0x15')](_0x50895a)['end']();};}function respondWithResult(_0x2fdb42,_0x235c87){_0x235c87=_0x235c87||0xc8;return function(_0x444440){if(_0x444440){return _0x2fdb42[_0xdb3b('0x15')](_0x235c87)[_0xdb3b('0x16')](_0x444440);}};}function respondWithFilteredResult(_0x5d38d9,_0x28eee3){return function(_0x2619d0){if(_0x2619d0){var _0x506e80=typeof _0x28eee3[_0xdb3b('0x17')]===_0xdb3b('0x18')&&typeof _0x28eee3[_0xdb3b('0x19')]===_0xdb3b('0x18');var _0x41cc60=_0x2619d0['count'];var _0x31ab99=_0x506e80?0x0:_0x28eee3[_0xdb3b('0x17')];var _0x15d4ef=_0x506e80?_0x2619d0['count']:_0x28eee3[_0xdb3b('0x17')]+_0x28eee3['limit'];var _0x2bfa50;if(_0x15d4ef>=_0x41cc60){_0x15d4ef=_0x41cc60;_0x2bfa50=0xc8;}else{_0x2bfa50=0xce;}_0x5d38d9['status'](_0x2bfa50);return _0x5d38d9[_0xdb3b('0x1a')]('Content-Range',_0x31ab99+'-'+_0x15d4ef+'/'+_0x41cc60)[_0xdb3b('0x16')](_0x2619d0);}return null;};}function patchUpdates(_0x12634e){return function(_0x3b3387){try{jsonpatch[_0xdb3b('0x1b')](_0x3b3387,_0x12634e,!![]);}catch(_0x51749f){return BPromise[_0xdb3b('0x1c')](_0x51749f);}return _0x3b3387[_0xdb3b('0x1d')]();};}function saveUpdates(_0x33a048,_0x1a10eb){return function(_0x4dcbda){if(_0x4dcbda){return _0x4dcbda[_0xdb3b('0x1e')](_0x33a048)[_0xdb3b('0x1f')](function(_0xc91747){return _0xc91747;});}return null;};}function removeEntity(_0x5635af,_0x3aafbe){return function(_0xd4b222){if(_0xd4b222){return _0xd4b222['destroy']()['then'](function(){_0x5635af[_0xdb3b('0x15')](0xcc)[_0xdb3b('0x20')]();});}};}function handleEntityNotFound(_0x532c42,_0x5382f0){return function(_0x2a3c9f){if(!_0x2a3c9f){_0x532c42[_0xdb3b('0x14')](0x194);}return _0x2a3c9f;};}function handleError(_0x44f36b,_0x3248b1){_0x3248b1=_0x3248b1||0x1f4;return function(_0x397a05){logger[_0xdb3b('0x21')](_0x397a05['stack']);if(_0x397a05['name']){delete _0x397a05[_0xdb3b('0x22')];}_0x44f36b[_0xdb3b('0x15')](_0x3248b1)[_0xdb3b('0x23')](_0x397a05);};}exports[_0xdb3b('0x24')]=function(_0x21ff73,_0x36b7c1){var _0x502944={},_0x36938b={},_0x5cea5d={'count':0x0,'rows':[]};var _0x1ee826=_[_0xdb3b('0x25')](db[_0xdb3b('0x26')]['rawAttributes'],function(_0x4b7f3e){return{'name':_0x4b7f3e[_0xdb3b('0x27')],'type':_0x4b7f3e[_0xdb3b('0x28')][_0xdb3b('0x29')]};});_0x36938b[_0xdb3b('0x2a')]=_[_0xdb3b('0x25')](_0x1ee826,_0xdb3b('0x22'));_0x36938b[_0xdb3b('0x2b')]=_[_0xdb3b('0x2c')](_0x21ff73['query']);_0x36938b[_0xdb3b('0x2d')]=_[_0xdb3b('0x2e')](_0x36938b[_0xdb3b('0x2a')],_0x36938b[_0xdb3b('0x2b')]);_0x502944['attributes']=_[_0xdb3b('0x2e')](_0x36938b['model'],qs['fields'](_0x21ff73[_0xdb3b('0x2b')][_0xdb3b('0x2f')]));_0x502944['attributes']=_0x502944[_0xdb3b('0x30')][_0xdb3b('0x31')]?_0x502944[_0xdb3b('0x30')]:_0x36938b[_0xdb3b('0x2a')];if(!_0x21ff73[_0xdb3b('0x2b')][_0xdb3b('0x32')](_0xdb3b('0x33'))){_0x502944[_0xdb3b('0x19')]=qs['limit'](_0x21ff73[_0xdb3b('0x2b')][_0xdb3b('0x19')]);_0x502944[_0xdb3b('0x17')]=qs['offset'](_0x21ff73[_0xdb3b('0x2b')][_0xdb3b('0x17')]);}_0x502944[_0xdb3b('0x34')]=qs['sort'](_0x21ff73[_0xdb3b('0x2b')][_0xdb3b('0x35')]);_0x502944[_0xdb3b('0x36')]=qs[_0xdb3b('0x2d')](_[_0xdb3b('0x37')](_0x21ff73['query'],_0x36938b[_0xdb3b('0x2d')]),_0x1ee826);if(_0x21ff73[_0xdb3b('0x2b')][_0xdb3b('0x38')]){_0x502944[_0xdb3b('0x36')]=_['merge'](_0x502944[_0xdb3b('0x36')],{'$or':_[_0xdb3b('0x25')](_0x1ee826,function(_0x222d6e){if(_0x222d6e[_0xdb3b('0x28')]!==_0xdb3b('0x39')){var _0x5ba5ca={};_0x5ba5ca[_0x222d6e[_0xdb3b('0x22')]]={'$like':'%'+_0x21ff73[_0xdb3b('0x2b')][_0xdb3b('0x38')]+'%'};return _0x5ba5ca;}})});}_0x502944=_[_0xdb3b('0x3a')]({},_0x502944,_0x21ff73[_0xdb3b('0x3b')]);var _0xbb4f4a={'where':_0x502944[_0xdb3b('0x36')]};return db[_0xdb3b('0x26')]['count'](_0xbb4f4a)[_0xdb3b('0x1f')](function(_0x157aff){_0x5cea5d[_0xdb3b('0x3c')]=_0x157aff;if(_0x21ff73['query'][_0xdb3b('0x3d')]){_0x502944[_0xdb3b('0x3e')]=[{'all':!![]}];}return db[_0xdb3b('0x26')][_0xdb3b('0x3f')](_0x502944);})[_0xdb3b('0x1f')](function(_0x47fd2b){_0x5cea5d['rows']=_0x47fd2b;return _0x5cea5d;})['then'](respondWithFilteredResult(_0x36b7c1,_0x502944))['catch'](handleError(_0x36b7c1,null));};exports[_0xdb3b('0x40')]=function(_0x141775,_0x214afe){var _0x209ca1={'raw':!![],'where':{'id':_0x141775['params']['id']}},_0x3518b8={};_0x3518b8[_0xdb3b('0x2a')]=_[_0xdb3b('0x2c')](db[_0xdb3b('0x26')]['rawAttributes']);_0x3518b8['query']=_['keys'](_0x141775[_0xdb3b('0x2b')]);_0x3518b8[_0xdb3b('0x2d')]=_[_0xdb3b('0x2e')](_0x3518b8[_0xdb3b('0x2a')],_0x3518b8['query']);_0x209ca1[_0xdb3b('0x30')]=_['intersection'](_0x3518b8['model'],qs[_0xdb3b('0x2f')](_0x141775[_0xdb3b('0x2b')][_0xdb3b('0x2f')]));_0x209ca1[_0xdb3b('0x30')]=_0x209ca1['attributes'][_0xdb3b('0x31')]?_0x209ca1[_0xdb3b('0x30')]:_0x3518b8[_0xdb3b('0x2a')];if(_0x141775[_0xdb3b('0x2b')][_0xdb3b('0x3d')]){_0x209ca1[_0xdb3b('0x3e')]=[{'all':!![]}];}_0x209ca1=_['merge']({},_0x209ca1,_0x141775[_0xdb3b('0x3b')]);return db[_0xdb3b('0x26')][_0xdb3b('0x41')](_0x209ca1)['then'](handleEntityNotFound(_0x214afe,null))['then'](respondWithResult(_0x214afe,null))[_0xdb3b('0x42')](handleError(_0x214afe,null));};exports[_0xdb3b('0x43')]=function(_0x50b45c,_0x52c048){return db['CmHopperHistory'][_0xdb3b('0x43')](_0x50b45c['body'],{})[_0xdb3b('0x1f')](respondWithResult(_0x52c048,0xc9))[_0xdb3b('0x42')](handleError(_0x52c048,null));};exports['describe']=function(_0x500d3b,_0x49659b){return db[_0xdb3b('0x26')][_0xdb3b('0x44')]()[_0xdb3b('0x1f')](respondWithResult(_0x49659b,null))[_0xdb3b('0x42')](handleError(_0x49659b,null));};exports[_0xdb3b('0x1e')]=function(_0x2c2a5d,_0x448617){if(_0x2c2a5d[_0xdb3b('0x45')][_0xdb3b('0x46')]){delete _0x2c2a5d[_0xdb3b('0x45')][_0xdb3b('0x46')];}return db[_0xdb3b('0x26')][_0xdb3b('0x41')]({'where':{'uniqueid':_0x2c2a5d['params']['id']}})[_0xdb3b('0x1f')](handleEntityNotFound(_0x448617,null))[_0xdb3b('0x1f')](saveUpdates(_0x2c2a5d[_0xdb3b('0x45')],null))[_0xdb3b('0x1f')](respondWithResult(_0x448617,null))[_0xdb3b('0x42')](handleError(_0x448617,null));}; \ No newline at end of file +var _0xae98=['filter','merge','options','includeAll','include','rows','show','params','find','catch','create','describe','body','uniqueid','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','error','stack','send','map','CmHopperHistory','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick'];(function(_0x3340b2,_0x5525df){var _0x399b07=function(_0x52050f){while(--_0x52050f){_0x3340b2['push'](_0x3340b2['shift']());}};_0x399b07(++_0x5525df);}(_0xae98,0x12a));var _0x8ae9=function(_0x51f77f,_0x123764){_0x51f77f=_0x51f77f-0x0;var _0x5a4ac5=_0xae98[_0x51f77f];return _0x5a4ac5;};'use strict';var emlformat=require(_0x8ae9('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8ae9('0x1'));var rp=require(_0x8ae9('0x2'));var moment=require(_0x8ae9('0x3'));var BPromise=require(_0x8ae9('0x4'));var Mustache=require(_0x8ae9('0x5'));var util=require(_0x8ae9('0x6'));var path=require('path');var sox=require(_0x8ae9('0x7'));var csv=require(_0x8ae9('0x8'));var ejs=require(_0x8ae9('0x9'));var fs=require('fs');var fs_extra=require(_0x8ae9('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8ae9('0xb'));var toCsv=require(_0x8ae9('0x8'));var querystring=require(_0x8ae9('0xc'));var Papa=require(_0x8ae9('0xd'));var Redis=require(_0x8ae9('0xe'));var authService=require(_0x8ae9('0xf'));var qs=require(_0x8ae9('0x10'));var as=require(_0x8ae9('0x11'));var hardwareService=require(_0x8ae9('0x12'));var logger=require('../../config/logger')(_0x8ae9('0x13'));var utils=require(_0x8ae9('0x14'));var config=require(_0x8ae9('0x15'));var licenseUtil=require(_0x8ae9('0x16'));var db=require(_0x8ae9('0x17'))['db'];function respondWithStatusCode(_0xebda06,_0x590d36){_0x590d36=_0x590d36||0xcc;return function(_0x58d2a2){if(_0x58d2a2){return _0xebda06[_0x8ae9('0x18')](_0x590d36);}return _0xebda06[_0x8ae9('0x19')](_0x590d36)['end']();};}function respondWithResult(_0x305d1f,_0x2573f9){_0x2573f9=_0x2573f9||0xc8;return function(_0x273757){if(_0x273757){return _0x305d1f['status'](_0x2573f9)[_0x8ae9('0x1a')](_0x273757);}};}function respondWithFilteredResult(_0xef9859,_0x5288f7){return function(_0x49fcd9){if(_0x49fcd9){var _0x45a5dd=typeof _0x5288f7[_0x8ae9('0x1b')]===_0x8ae9('0x1c')&&typeof _0x5288f7[_0x8ae9('0x1d')]===_0x8ae9('0x1c');var _0x39c3a0=_0x49fcd9[_0x8ae9('0x1e')];var _0x2c02db=_0x45a5dd?0x0:_0x5288f7[_0x8ae9('0x1b')];var _0x3246cd=_0x45a5dd?_0x49fcd9[_0x8ae9('0x1e')]:_0x5288f7[_0x8ae9('0x1b')]+_0x5288f7[_0x8ae9('0x1d')];var _0x571163;if(_0x3246cd>=_0x39c3a0){_0x3246cd=_0x39c3a0;_0x571163=0xc8;}else{_0x571163=0xce;}_0xef9859[_0x8ae9('0x19')](_0x571163);return _0xef9859[_0x8ae9('0x1f')](_0x8ae9('0x20'),_0x2c02db+'-'+_0x3246cd+'/'+_0x39c3a0)[_0x8ae9('0x1a')](_0x49fcd9);}return null;};}function patchUpdates(_0x122e9f){return function(_0x1f965b){try{jsonpatch['apply'](_0x1f965b,_0x122e9f,!![]);}catch(_0x2f8974){return BPromise[_0x8ae9('0x21')](_0x2f8974);}return _0x1f965b['save']();};}function saveUpdates(_0x531e3e,_0x3e1e99){return function(_0x25a212){if(_0x25a212){return _0x25a212[_0x8ae9('0x22')](_0x531e3e)[_0x8ae9('0x23')](function(_0x133f11){return _0x133f11;});}return null;};}function removeEntity(_0xc6bc5b,_0x11f0fd){return function(_0x2856f5){if(_0x2856f5){return _0x2856f5[_0x8ae9('0x24')]()[_0x8ae9('0x23')](function(){_0xc6bc5b[_0x8ae9('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e242b,_0x1b4395){return function(_0x4e3b1a){if(!_0x4e3b1a){_0x2e242b['sendStatus'](0x194);}return _0x4e3b1a;};}function handleError(_0x3f69c0,_0x41fa40){_0x41fa40=_0x41fa40||0x1f4;return function(_0x3b30a2){logger[_0x8ae9('0x25')](_0x3b30a2[_0x8ae9('0x26')]);if(_0x3b30a2['name']){delete _0x3b30a2['name'];}_0x3f69c0[_0x8ae9('0x19')](_0x41fa40)[_0x8ae9('0x27')](_0x3b30a2);};}exports['index']=function(_0x245730,_0x202cad){var _0x15f4f8={},_0x3c1de3={},_0x4f1f73={'count':0x0,'rows':[]};var _0x1dbee2=_[_0x8ae9('0x28')](db[_0x8ae9('0x29')][_0x8ae9('0x2a')],function(_0x851709){return{'name':_0x851709['fieldName'],'type':_0x851709[_0x8ae9('0x2b')][_0x8ae9('0x2c')]};});_0x3c1de3[_0x8ae9('0x2d')]=_['map'](_0x1dbee2,'name');_0x3c1de3[_0x8ae9('0x2e')]=_[_0x8ae9('0x2f')](_0x245730[_0x8ae9('0x2e')]);_0x3c1de3['filters']=_[_0x8ae9('0x30')](_0x3c1de3[_0x8ae9('0x2d')],_0x3c1de3['query']);_0x15f4f8[_0x8ae9('0x31')]=_[_0x8ae9('0x30')](_0x3c1de3['model'],qs[_0x8ae9('0x32')](_0x245730['query']['fields']));_0x15f4f8[_0x8ae9('0x31')]=_0x15f4f8[_0x8ae9('0x31')]['length']?_0x15f4f8[_0x8ae9('0x31')]:_0x3c1de3[_0x8ae9('0x2d')];if(!_0x245730['query'][_0x8ae9('0x33')](_0x8ae9('0x34'))){_0x15f4f8['limit']=qs[_0x8ae9('0x1d')](_0x245730[_0x8ae9('0x2e')][_0x8ae9('0x1d')]);_0x15f4f8[_0x8ae9('0x1b')]=qs[_0x8ae9('0x1b')](_0x245730[_0x8ae9('0x2e')][_0x8ae9('0x1b')]);}_0x15f4f8['order']=qs[_0x8ae9('0x35')](_0x245730[_0x8ae9('0x2e')]['sort']);_0x15f4f8[_0x8ae9('0x36')]=qs[_0x8ae9('0x37')](_[_0x8ae9('0x38')](_0x245730['query'],_0x3c1de3['filters']),_0x1dbee2);if(_0x245730[_0x8ae9('0x2e')][_0x8ae9('0x39')]){_0x15f4f8[_0x8ae9('0x36')]=_[_0x8ae9('0x3a')](_0x15f4f8[_0x8ae9('0x36')],{'$or':_['map'](_0x1dbee2,function(_0x1e7984){if(_0x1e7984['type']!=='VIRTUAL'){var _0x5f3d80={};_0x5f3d80[_0x1e7984['name']]={'$like':'%'+_0x245730[_0x8ae9('0x2e')][_0x8ae9('0x39')]+'%'};return _0x5f3d80;}})});}_0x15f4f8=_[_0x8ae9('0x3a')]({},_0x15f4f8,_0x245730[_0x8ae9('0x3b')]);var _0x434969={'where':_0x15f4f8['where']};return db[_0x8ae9('0x29')]['count'](_0x434969)[_0x8ae9('0x23')](function(_0x2d188b){_0x4f1f73[_0x8ae9('0x1e')]=_0x2d188b;if(_0x245730['query'][_0x8ae9('0x3c')]){_0x15f4f8[_0x8ae9('0x3d')]=[{'all':!![]}];}return db[_0x8ae9('0x29')]['findAll'](_0x15f4f8);})[_0x8ae9('0x23')](function(_0x5d15aa){_0x4f1f73[_0x8ae9('0x3e')]=_0x5d15aa;return _0x4f1f73;})[_0x8ae9('0x23')](respondWithFilteredResult(_0x202cad,_0x15f4f8))['catch'](handleError(_0x202cad,null));};exports[_0x8ae9('0x3f')]=function(_0x8da9a1,_0x1654a0){var _0x280643={'raw':!![],'where':{'id':_0x8da9a1[_0x8ae9('0x40')]['id']}},_0x23b8a7={};_0x23b8a7[_0x8ae9('0x2d')]=_[_0x8ae9('0x2f')](db[_0x8ae9('0x29')][_0x8ae9('0x2a')]);_0x23b8a7[_0x8ae9('0x2e')]=_[_0x8ae9('0x2f')](_0x8da9a1[_0x8ae9('0x2e')]);_0x23b8a7[_0x8ae9('0x37')]=_[_0x8ae9('0x30')](_0x23b8a7[_0x8ae9('0x2d')],_0x23b8a7[_0x8ae9('0x2e')]);_0x280643['attributes']=_['intersection'](_0x23b8a7[_0x8ae9('0x2d')],qs[_0x8ae9('0x32')](_0x8da9a1[_0x8ae9('0x2e')][_0x8ae9('0x32')]));_0x280643[_0x8ae9('0x31')]=_0x280643[_0x8ae9('0x31')]['length']?_0x280643['attributes']:_0x23b8a7['model'];if(_0x8da9a1[_0x8ae9('0x2e')][_0x8ae9('0x3c')]){_0x280643[_0x8ae9('0x3d')]=[{'all':!![]}];}_0x280643=_['merge']({},_0x280643,_0x8da9a1[_0x8ae9('0x3b')]);return db[_0x8ae9('0x29')][_0x8ae9('0x41')](_0x280643)[_0x8ae9('0x23')](handleEntityNotFound(_0x1654a0,null))[_0x8ae9('0x23')](respondWithResult(_0x1654a0,null))[_0x8ae9('0x42')](handleError(_0x1654a0,null));};exports[_0x8ae9('0x43')]=function(_0x4651a6,_0x5b2ada){return db['CmHopperHistory'][_0x8ae9('0x43')](_0x4651a6['body'],{})[_0x8ae9('0x23')](respondWithResult(_0x5b2ada,0xc9))['catch'](handleError(_0x5b2ada,null));};exports[_0x8ae9('0x44')]=function(_0x33f91f,_0x49f317){return db[_0x8ae9('0x29')][_0x8ae9('0x44')]()[_0x8ae9('0x23')](respondWithResult(_0x49f317,null))[_0x8ae9('0x42')](handleError(_0x49f317,null));};exports[_0x8ae9('0x22')]=function(_0x5a0f84,_0x4e88e8){if(_0x5a0f84[_0x8ae9('0x45')][_0x8ae9('0x46')]){delete _0x5a0f84[_0x8ae9('0x45')]['uniqueid'];}return db['CmHopperHistory'][_0x8ae9('0x41')]({'where':{'uniqueid':_0x5a0f84[_0x8ae9('0x40')]['id']}})[_0x8ae9('0x23')](handleEntityNotFound(_0x4e88e8,null))[_0x8ae9('0x23')](saveUpdates(_0x5a0f84[_0x8ae9('0x45')],null))[_0x8ae9('0x23')](respondWithResult(_0x4e88e8,null))[_0x8ae9('0x42')](handleError(_0x4e88e8,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 9d8935d..f5d7983 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 _0x15ef=['moment','bluebird','request-promise','path','rimraf','./cmHopperHistory.attributes','exports','define','CmHopperHistory','endtime','uniqueid','util','../../config/logger'];(function(_0x186e0a,_0x1b9756){var _0x22c3a1=function(_0x47b6b1){while(--_0x47b6b1){_0x186e0a['push'](_0x186e0a['shift']());}};_0x22c3a1(++_0x1b9756);}(_0x15ef,0x80));var _0xf15e=function(_0x584c85,_0x5c9c9a){_0x584c85=_0x584c85-0x0;var _0x603397=_0x15ef[_0x584c85];return _0x603397;};'use strict';var _=require('lodash');var util=require(_0xf15e('0x0'));var logger=require(_0xf15e('0x1'))('api');var moment=require(_0xf15e('0x2'));var BPromise=require(_0xf15e('0x3'));var rp=require(_0xf15e('0x4'));var fs=require('fs');var path=require(_0xf15e('0x5'));var rimraf=require(_0xf15e('0x6'));var config=require('../../config/environment');var attributes=require(_0xf15e('0x7'));module[_0xf15e('0x8')]=function(_0x5e96b4,_0x5ba863){return _0x5e96b4[_0xf15e('0x9')](_0xf15e('0xa'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0xf15e('0xb'),'fields':['endtime']},{'name':_0xf15e('0xc'),'fields':[_0xf15e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0137=['../../config/environment','./cmHopperHistory.attributes','exports','define','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x42b8f5,_0x4b9730){var _0x31ca50=function(_0x2060a){while(--_0x2060a){_0x42b8f5['push'](_0x42b8f5['shift']());}};_0x31ca50(++_0x4b9730);}(_0x0137,0x1d8));var _0x7013=function(_0x3f787e,_0x951303){_0x3f787e=_0x3f787e-0x0;var _0x26242d=_0x0137[_0x3f787e];return _0x26242d;};'use strict';var _=require(_0x7013('0x0'));var util=require(_0x7013('0x1'));var logger=require(_0x7013('0x2'))(_0x7013('0x3'));var moment=require(_0x7013('0x4'));var BPromise=require('bluebird');var rp=require(_0x7013('0x5'));var fs=require('fs');var path=require(_0x7013('0x6'));var rimraf=require(_0x7013('0x7'));var config=require(_0x7013('0x8'));var attributes=require(_0x7013('0x9'));module[_0x7013('0xa')]=function(_0x50b822,_0x24cb85){return _0x50b822[_0x7013('0xb')]('CmHopperHistory',attributes,{'tableName':_0x7013('0xc'),'paranoid':![],'indexes':[{'name':_0x7013('0xd'),'fields':[_0x7013('0xd')]},{'name':'uniqueid','fields':[_0x7013('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 09fbbd3..d2b3e4e 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 _0x1306=['`state`\x20=\x2020,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','GetVoiceQueueHopperHistory','campaign','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','options','raw','where','sequelize','col','predictiveIntervalTotalCalls','COUNT','literal','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','AvgHandleTime','findAll','name','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x1306,0x17a));var _0x6130=function(_0x53025d,_0x38935c){_0x53025d=_0x53025d-0x0;var _0x4bfbd2=_0x1306[_0x53025d];return _0x4bfbd2;};'use strict';var _=require(_0x6130('0x0'));var util=require(_0x6130('0x1'));var moment=require(_0x6130('0x2'));var BPromise=require(_0x6130('0x3'));var rs=require(_0x6130('0x4'));var fs=require('fs');var Redis=require(_0x6130('0x5'));var db=require(_0x6130('0x6'))['db'];var utils=require(_0x6130('0x7'));var logger=require(_0x6130('0x8'))(_0x6130('0x9'));var config=require(_0x6130('0xa'));var jayson=require(_0x6130('0xb'));var client=jayson[_0x6130('0xc')][_0x6130('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1db089,_0x25469a,_0x354501){return new BPromise(function(_0x288b1d,_0x13163f){return client[_0x6130('0xe')](_0x1db089,_0x354501)[_0x6130('0xf')](function(_0x33b116){logger[_0x6130('0x10')](_0x6130('0x11'),_0x25469a,_0x6130('0x12'));logger[_0x6130('0x13')](_0x6130('0x14'),_0x25469a,_0x6130('0x12'),JSON[_0x6130('0x15')](_0x33b116));if(_0x33b116['error']){if(_0x33b116[_0x6130('0x16')]['code']===0x1f4){logger[_0x6130('0x16')](_0x6130('0x11'),_0x25469a,_0x33b116['error'][_0x6130('0x17')]);return _0x13163f(_0x33b116[_0x6130('0x16')][_0x6130('0x17')]);}logger[_0x6130('0x16')](_0x6130('0x11'),_0x25469a,_0x33b116[_0x6130('0x16')][_0x6130('0x17')]);return _0x288b1d(_0x33b116[_0x6130('0x16')][_0x6130('0x17')]);}else{logger[_0x6130('0x10')](_0x6130('0x11'),_0x25469a,_0x6130('0x12'));_0x288b1d(_0x33b116[_0x6130('0x18')][_0x6130('0x17')]);}})[_0x6130('0x19')](function(_0x46c2e3){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x25469a,_0x46c2e3);_0x13163f(_0x46c2e3);});});}exports[_0x6130('0x1a')]=function(_0x49803e){var _0x1cd785=this;return new Promise(function(_0xb6575d,_0x42d630){return db[_0x6130('0x1b')][_0x6130('0x1c')](_0x49803e['body'],{'raw':_0x49803e[_0x6130('0x1d')]?_0x49803e['options'][_0x6130('0x1e')]===undefined?!![]:![]:!![]})[_0x6130('0xf')](function(_0x18bb78){logger[_0x6130('0x10')](_0x6130('0x1a'),_0x49803e);logger['debug']('CreateCmHopperHistory',_0x49803e,JSON[_0x6130('0x15')](_0x18bb78));_0xb6575d(_0x18bb78);})['catch'](function(_0x30b4f2){logger[_0x6130('0x16')]('CreateCmHopperHistory',_0x30b4f2['message'],_0x49803e);_0x42d630(_0x1cd785['error'](0x1f4,_0x30b4f2[_0x6130('0x17')]));});});};exports['AvgHandleTime']=function(_0x371b84){var _0x574f80=this;return new Promise(function(_0x4ce080,_0x4be8ff){return db['CmHopperHistory']['findAll']({'raw':_0x371b84[_0x6130('0x1d')]?_0x371b84[_0x6130('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x371b84[_0x6130('0x1d')]?_0x371b84['options'][_0x6130('0x1f')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0x6130('0x20')][_0x6130('0x21')]('id')),_0x6130('0x22')],[db[_0x6130('0x20')]['fn'](_0x6130('0x23'),db[_0x6130('0x20')]['fn']('IF',db[_0x6130('0x20')][_0x6130('0x24')](_0x6130('0x25')))),'predictiveIntervalAnsweredCalls'],[db['sequelize']['fn'](_0x6130('0x23'),db[_0x6130('0x20')]['fn']('IF',db[_0x6130('0x20')][_0x6130('0x24')](_0x6130('0x26')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x6130('0x20')]['fn'](_0x6130('0x23'),db[_0x6130('0x20')]['fn']('IF',db[_0x6130('0x20')][_0x6130('0x24')]('`state`\x20=\x2011,\x201,\x20null'))),_0x6130('0x27')],[db[_0x6130('0x20')]['fn'](_0x6130('0x28'),db['sequelize']['fn']('IF',db[_0x6130('0x20')][_0x6130('0x24')](_0x6130('0x29')))),_0x6130('0x2a')],[db[_0x6130('0x20')]['fn'](_0x6130('0x28'),db[_0x6130('0x20')]['fn']('IF',db[_0x6130('0x20')][_0x6130('0x24')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0x6130('0x2b')]]})['then'](function(_0x5102df){logger['info'](_0x6130('0x2c'),_0x371b84);logger[_0x6130('0x13')](_0x6130('0x2c'),_0x371b84,JSON[_0x6130('0x15')](_0x5102df));_0x4ce080(_0x5102df);})[_0x6130('0x19')](function(_0x3dd737){logger[_0x6130('0x16')](_0x6130('0x2c'),_0x3dd737['message'],_0x371b84);_0x4be8ff(_0x574f80[_0x6130('0x16')](0x1f4,_0x3dd737[_0x6130('0x17')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x46a0e9){var _0x45be47=this;return new Promise(function(_0x61778d,_0x5874cd){return db[_0x6130('0x1b')][_0x6130('0x2d')]({'raw':_0x46a0e9['options']?_0x46a0e9['options'][_0x6130('0x1e')]===undefined?!![]:![]:!![],'where':_0x46a0e9[_0x6130('0x1d')]?_0x46a0e9[_0x6130('0x1d')]['where']||null:null,'attributes':[['campaign',_0x6130('0x2e')],[db[_0x6130('0x20')]['fn'](_0x6130('0x23'),db[_0x6130('0x20')]['fn']('IF',db[_0x6130('0x20')][_0x6130('0x24')](_0x6130('0x2f')))),'outboundNoSuchCallsDay'],[db[_0x6130('0x20')]['fn'](_0x6130('0x23'),db[_0x6130('0x20')]['fn']('IF',db[_0x6130('0x20')][_0x6130('0x24')](_0x6130('0x30')))),_0x6130('0x31')],[db['sequelize']['fn'](_0x6130('0x23'),db[_0x6130('0x20')]['fn']('IF',db[_0x6130('0x20')][_0x6130('0x24')](_0x6130('0x25')))),_0x6130('0x32')],[db[_0x6130('0x20')]['fn'](_0x6130('0x23'),db['sequelize']['fn']('IF',db[_0x6130('0x20')][_0x6130('0x24')](_0x6130('0x33')))),'outboundBusyCallsDay'],[db[_0x6130('0x20')]['fn'](_0x6130('0x23'),db[_0x6130('0x20')]['fn']('IF',db['sequelize']['literal'](_0x6130('0x34')))),_0x6130('0x35')],[db[_0x6130('0x20')]['fn'](_0x6130('0x23'),db[_0x6130('0x20')]['fn']('IF',db['sequelize'][_0x6130('0x24')](_0x6130('0x36')))),'outboundDropCallsDayTimeout'],[db[_0x6130('0x20')]['fn'](_0x6130('0x23'),db[_0x6130('0x20')]['fn']('IF',db[_0x6130('0x20')][_0x6130('0x24')](_0x6130('0x37')))),_0x6130('0x38')],[db[_0x6130('0x20')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6130('0x20')]['literal'](_0x6130('0x39')))),_0x6130('0x3a')],[db[_0x6130('0x20')]['fn'](_0x6130('0x23'),db[_0x6130('0x20')]['fn']('IF',db[_0x6130('0x20')][_0x6130('0x24')](_0x6130('0x3b')))),_0x6130('0x3c')],[db[_0x6130('0x20')]['fn'](_0x6130('0x23'),db['sequelize']['fn']('IF',db[_0x6130('0x20')][_0x6130('0x24')](_0x6130('0x3d')))),_0x6130('0x3e')],[db[_0x6130('0x20')]['fn'](_0x6130('0x23'),db[_0x6130('0x20')]['fn']('IF',db[_0x6130('0x20')][_0x6130('0x24')](_0x6130('0x3f')))),'outboundRejectCallsDay'],[db[_0x6130('0x20')]['fn'](_0x6130('0x23'),db[_0x6130('0x20')]['fn']('IF',db[_0x6130('0x20')][_0x6130('0x24')](_0x6130('0x40')))),_0x6130('0x41')],[db[_0x6130('0x20')]['fn'](_0x6130('0x23'),db['sequelize']['fn']('IF',db[_0x6130('0x20')][_0x6130('0x24')](_0x6130('0x42')))),_0x6130('0x43')],[db[_0x6130('0x20')]['fn'](_0x6130('0x23'),db['sequelize']['fn']('IF',db[_0x6130('0x20')][_0x6130('0x24')](_0x6130('0x44')))),'outboundReCallsDay']],'group':['campaign']})['then'](function(_0x529977){logger[_0x6130('0x10')](_0x6130('0x45'),_0x46a0e9);logger[_0x6130('0x13')]('GetVoiceQueueHopperHistory',_0x46a0e9,JSON['stringify'](_0x529977));_0x61778d(_0x529977);})['catch'](function(_0x5c8e26){logger[_0x6130('0x16')](_0x6130('0x45'),_0x5c8e26[_0x6130('0x17')],_0x46a0e9);_0x5874cd(_0x45be47[_0x6130('0x16')](0x1f4,_0x5c8e26[_0x6130('0x17')]));});});};exports['GetCampaignHopperHistory']=function(_0x2bc69c){var _0x305d99=this;return new Promise(function(_0x49e3cf,_0x418c88){return db[_0x6130('0x1b')][_0x6130('0x2d')]({'raw':_0x2bc69c[_0x6130('0x1d')]?_0x2bc69c[_0x6130('0x1d')][_0x6130('0x1e')]===undefined?!![]:![]:!![],'where':_0x2bc69c[_0x6130('0x1d')]?_0x2bc69c[_0x6130('0x1d')]['where']||null:null,'attributes':[[_0x6130('0x46'),_0x6130('0x2e')],[db[_0x6130('0x20')]['fn']('COUNT',db['sequelize'][_0x6130('0x21')]('id')),_0x6130('0x47')],[db[_0x6130('0x20')]['fn'](_0x6130('0x23'),db[_0x6130('0x20')]['fn']('IF',db['sequelize'][_0x6130('0x24')](_0x6130('0x25')))),_0x6130('0x48')]],'group':[_0x6130('0x46')]})[_0x6130('0xf')](function(_0x2af363){logger['info']('GetCampaignHopperHistory',_0x2bc69c);logger[_0x6130('0x13')](_0x6130('0x49'),_0x2bc69c,JSON['stringify'](_0x2af363));_0x49e3cf(_0x2af363);})[_0x6130('0x19')](function(_0x22d585){logger[_0x6130('0x16')](_0x6130('0x49'),_0x22d585['message'],_0x2bc69c);_0x418c88(_0x305d99[_0x6130('0x16')](0x1f4,_0x22d585[_0x6130('0x17')]));});});}; \ No newline at end of file +var _0x9c2c=['sequelize','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','AVG','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','findAll','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','ioredis','../../config/utils','../../config/logger','jayson/promise','http','request','then','CmHopperHistory,\x20%s,\x20%s','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','result','catch','CreateCmHopperHistory','CmHopperHistory','create','options','AvgHandleTime','raw','where','COUNT'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9c2c,0x1c0));var _0xc9c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c2c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc9c2('0x0'));var util=require(_0xc9c2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc9c2('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xc9c2('0x3'));var logger=require(_0xc9c2('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc9c2('0x5'));var client=jayson['client'][_0xc9c2('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x17b5e8,_0x711f3d,_0x18a815){return new BPromise(function(_0x270572,_0xd7fb27){return client[_0xc9c2('0x7')](_0x17b5e8,_0x18a815)[_0xc9c2('0x8')](function(_0x8614c4){logger['info'](_0xc9c2('0x9'),_0x711f3d,'request\x20sent');logger[_0xc9c2('0xa')](_0xc9c2('0xb'),_0x711f3d,_0xc9c2('0xc'),JSON[_0xc9c2('0xd')](_0x8614c4));if(_0x8614c4['error']){if(_0x8614c4['error'][_0xc9c2('0xe')]===0x1f4){logger[_0xc9c2('0xf')]('CmHopperHistory,\x20%s,\x20%s',_0x711f3d,_0x8614c4[_0xc9c2('0xf')][_0xc9c2('0x10')]);return _0xd7fb27(_0x8614c4[_0xc9c2('0xf')][_0xc9c2('0x10')]);}logger[_0xc9c2('0xf')](_0xc9c2('0x9'),_0x711f3d,_0x8614c4[_0xc9c2('0xf')][_0xc9c2('0x10')]);return _0x270572(_0x8614c4[_0xc9c2('0xf')][_0xc9c2('0x10')]);}else{logger[_0xc9c2('0x11')](_0xc9c2('0x9'),_0x711f3d,'request\x20sent');_0x270572(_0x8614c4[_0xc9c2('0x12')][_0xc9c2('0x10')]);}})[_0xc9c2('0x13')](function(_0x240099){logger[_0xc9c2('0xf')]('CmHopperHistory,\x20%s,\x20%s',_0x711f3d,_0x240099);_0xd7fb27(_0x240099);});});}exports[_0xc9c2('0x14')]=function(_0x37c027){var _0x273c08=this;return new Promise(function(_0x4e4ded,_0x1c3b09){return db[_0xc9c2('0x15')][_0xc9c2('0x16')](_0x37c027['body'],{'raw':_0x37c027[_0xc9c2('0x17')]?_0x37c027[_0xc9c2('0x17')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x37e3){logger['info'](_0xc9c2('0x14'),_0x37c027);logger[_0xc9c2('0xa')](_0xc9c2('0x14'),_0x37c027,JSON[_0xc9c2('0xd')](_0x37e3));_0x4e4ded(_0x37e3);})[_0xc9c2('0x13')](function(_0x53c460){logger[_0xc9c2('0xf')](_0xc9c2('0x14'),_0x53c460[_0xc9c2('0x10')],_0x37c027);_0x1c3b09(_0x273c08[_0xc9c2('0xf')](0x1f4,_0x53c460[_0xc9c2('0x10')]));});});};exports[_0xc9c2('0x18')]=function(_0x56e515){var _0x38c957=this;return new Promise(function(_0x20ca3b,_0x5e47c2){return db[_0xc9c2('0x15')]['findAll']({'raw':_0x56e515[_0xc9c2('0x17')]?_0x56e515[_0xc9c2('0x17')][_0xc9c2('0x19')]===undefined?!![]:![]:!![],'where':_0x56e515[_0xc9c2('0x17')]?_0x56e515['options'][_0xc9c2('0x1a')]||null:null,'attributes':[[db['sequelize']['fn'](_0xc9c2('0x1b'),db[_0xc9c2('0x1c')][_0xc9c2('0x1d')]('id')),_0xc9c2('0x1e')],[db[_0xc9c2('0x1c')]['fn']('COUNT',db[_0xc9c2('0x1c')]['fn']('IF',db[_0xc9c2('0x1c')][_0xc9c2('0x1f')](_0xc9c2('0x20')))),_0xc9c2('0x21')],[db[_0xc9c2('0x1c')]['fn'](_0xc9c2('0x1b'),db['sequelize']['fn']('IF',db[_0xc9c2('0x1c')]['literal'](_0xc9c2('0x22')))),_0xc9c2('0x23')],[db['sequelize']['fn'](_0xc9c2('0x1b'),db[_0xc9c2('0x1c')]['fn']('IF',db[_0xc9c2('0x1c')][_0xc9c2('0x1f')]('`state`\x20=\x2011,\x201,\x20null'))),_0xc9c2('0x24')],[db[_0xc9c2('0x1c')]['fn']('AVG',db['sequelize']['fn']('IF',db[_0xc9c2('0x1c')][_0xc9c2('0x1f')](_0xc9c2('0x25')))),'predictiveIntervalAvgHoldtime'],[db['sequelize']['fn'](_0xc9c2('0x26'),db[_0xc9c2('0x1c')]['fn']('IF',db['sequelize'][_0xc9c2('0x1f')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0xc9c2('0x27')]]})[_0xc9c2('0x8')](function(_0x27e255){logger[_0xc9c2('0x11')](_0xc9c2('0x18'),_0x56e515);logger[_0xc9c2('0xa')](_0xc9c2('0x18'),_0x56e515,JSON[_0xc9c2('0xd')](_0x27e255));_0x20ca3b(_0x27e255);})[_0xc9c2('0x13')](function(_0x52fbb8){logger[_0xc9c2('0xf')]('AvgHandleTime',_0x52fbb8[_0xc9c2('0x10')],_0x56e515);_0x5e47c2(_0x38c957[_0xc9c2('0xf')](0x1f4,_0x52fbb8['message']));});});};exports[_0xc9c2('0x28')]=function(_0x9d8e40){var _0x4eac60=this;return new Promise(function(_0x449658,_0x22a935){return db[_0xc9c2('0x15')]['findAll']({'raw':_0x9d8e40[_0xc9c2('0x17')]?_0x9d8e40['options'][_0xc9c2('0x19')]===undefined?!![]:![]:!![],'where':_0x9d8e40[_0xc9c2('0x17')]?_0x9d8e40['options'][_0xc9c2('0x1a')]||null:null,'attributes':[[_0xc9c2('0x29'),_0xc9c2('0x2a')],[db[_0xc9c2('0x1c')]['fn'](_0xc9c2('0x1b'),db[_0xc9c2('0x1c')]['fn']('IF',db[_0xc9c2('0x1c')][_0xc9c2('0x1f')](_0xc9c2('0x2b')))),_0xc9c2('0x2c')],[db[_0xc9c2('0x1c')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xc9c2('0x1c')][_0xc9c2('0x1f')](_0xc9c2('0x2d')))),_0xc9c2('0x2e')],[db[_0xc9c2('0x1c')]['fn'](_0xc9c2('0x1b'),db['sequelize']['fn']('IF',db[_0xc9c2('0x1c')][_0xc9c2('0x1f')](_0xc9c2('0x20')))),_0xc9c2('0x2f')],[db[_0xc9c2('0x1c')]['fn']('COUNT',db[_0xc9c2('0x1c')]['fn']('IF',db[_0xc9c2('0x1c')][_0xc9c2('0x1f')]('`state`\x20=\x205,\x201,\x20null'))),_0xc9c2('0x30')],[db[_0xc9c2('0x1c')]['fn'](_0xc9c2('0x1b'),db[_0xc9c2('0x1c')]['fn']('IF',db[_0xc9c2('0x1c')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0xc9c2('0x31')],[db[_0xc9c2('0x1c')]['fn']('COUNT',db[_0xc9c2('0x1c')]['fn']('IF',db[_0xc9c2('0x1c')][_0xc9c2('0x1f')](_0xc9c2('0x32')))),_0xc9c2('0x33')],[db[_0xc9c2('0x1c')]['fn'](_0xc9c2('0x1b'),db['sequelize']['fn']('IF',db[_0xc9c2('0x1c')]['literal'](_0xc9c2('0x34')))),'outboundDropCallsDayCallersExit'],[db[_0xc9c2('0x1c')]['fn']('COUNT',db[_0xc9c2('0x1c')]['fn']('IF',db['sequelize'][_0xc9c2('0x1f')](_0xc9c2('0x35')))),_0xc9c2('0x36')],[db[_0xc9c2('0x1c')]['fn'](_0xc9c2('0x1b'),db[_0xc9c2('0x1c')]['fn']('IF',db[_0xc9c2('0x1c')]['literal'](_0xc9c2('0x37')))),_0xc9c2('0x38')],[db[_0xc9c2('0x1c')]['fn'](_0xc9c2('0x1b'),db[_0xc9c2('0x1c')]['fn']('IF',db[_0xc9c2('0x1c')]['literal'](_0xc9c2('0x39')))),_0xc9c2('0x3a')],[db[_0xc9c2('0x1c')]['fn'](_0xc9c2('0x1b'),db[_0xc9c2('0x1c')]['fn']('IF',db[_0xc9c2('0x1c')][_0xc9c2('0x1f')](_0xc9c2('0x3b')))),'outboundRejectCallsDay'],[db[_0xc9c2('0x1c')]['fn'](_0xc9c2('0x1b'),db[_0xc9c2('0x1c')]['fn']('IF',db[_0xc9c2('0x1c')][_0xc9c2('0x1f')]('`state`\x20=\x2016,\x201,\x20null'))),_0xc9c2('0x3c')],[db[_0xc9c2('0x1c')]['fn'](_0xc9c2('0x1b'),db['sequelize']['fn']('IF',db[_0xc9c2('0x1c')]['literal'](_0xc9c2('0x3d')))),'outboundRejectCallsDay'],[db['sequelize']['fn'](_0xc9c2('0x1b'),db[_0xc9c2('0x1c')]['fn']('IF',db[_0xc9c2('0x1c')][_0xc9c2('0x1f')](_0xc9c2('0x3e')))),_0xc9c2('0x3f')]],'group':[_0xc9c2('0x29')]})[_0xc9c2('0x8')](function(_0x3f8fce){logger[_0xc9c2('0x11')](_0xc9c2('0x28'),_0x9d8e40);logger['debug'](_0xc9c2('0x28'),_0x9d8e40,JSON[_0xc9c2('0xd')](_0x3f8fce));_0x449658(_0x3f8fce);})['catch'](function(_0x8a840){logger[_0xc9c2('0xf')](_0xc9c2('0x28'),_0x8a840['message'],_0x9d8e40);_0x22a935(_0x4eac60['error'](0x1f4,_0x8a840[_0xc9c2('0x10')]));});});};exports[_0xc9c2('0x40')]=function(_0x5cb984){var _0x45ef76=this;return new Promise(function(_0x2bc1a0,_0x41633e){return db[_0xc9c2('0x15')][_0xc9c2('0x41')]({'raw':_0x5cb984[_0xc9c2('0x17')]?_0x5cb984[_0xc9c2('0x17')][_0xc9c2('0x19')]===undefined?!![]:![]:!![],'where':_0x5cb984[_0xc9c2('0x17')]?_0x5cb984[_0xc9c2('0x17')][_0xc9c2('0x1a')]||null:null,'attributes':[[_0xc9c2('0x29'),'name'],[db[_0xc9c2('0x1c')]['fn'](_0xc9c2('0x1b'),db[_0xc9c2('0x1c')]['col']('id')),_0xc9c2('0x42')],[db[_0xc9c2('0x1c')]['fn'](_0xc9c2('0x1b'),db['sequelize']['fn']('IF',db['sequelize'][_0xc9c2('0x1f')](_0xc9c2('0x20')))),_0xc9c2('0x43')]],'group':[_0xc9c2('0x29')]})[_0xc9c2('0x8')](function(_0x281fbe){logger[_0xc9c2('0x11')](_0xc9c2('0x40'),_0x5cb984);logger['debug'](_0xc9c2('0x40'),_0x5cb984,JSON[_0xc9c2('0xd')](_0x281fbe));_0x2bc1a0(_0x281fbe);})[_0xc9c2('0x13')](function(_0x1df09c){logger[_0xc9c2('0xf')](_0xc9c2('0x40'),_0x1df09c[_0xc9c2('0x10')],_0x5cb984);_0x41633e(_0x45ef76[_0xc9c2('0xf')](0x1f4,_0x1df09c[_0xc9c2('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 7bc4e65..7f1efb1 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 _0x5b7e=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','describe','post','create','update','exports','multer','connect-timeout','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5b7e,0x96));var _0xe5b7=function(_0x323fff,_0x38f93e){_0x323fff=_0x323fff-0x0;var _0x326de5=_0x5b7e[_0x323fff];return _0x326de5;};'use strict';var multer=require(_0xe5b7('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe5b7('0x1'));var express=require(_0xe5b7('0x2'));var router=express[_0xe5b7('0x3')]();var fs_extra=require(_0xe5b7('0x4'));var auth=require(_0xe5b7('0x5'));var interaction=require(_0xe5b7('0x6'));var config=require(_0xe5b7('0x7'));var controller=require(_0xe5b7('0x8'));router[_0xe5b7('0x9')]('/',auth[_0xe5b7('0xa')](),controller[_0xe5b7('0xb')]);router[_0xe5b7('0x9')]('/describe',auth[_0xe5b7('0xa')](),controller[_0xe5b7('0xc')]);router[_0xe5b7('0x9')]('/:id',auth[_0xe5b7('0xa')](),controller['show']);router[_0xe5b7('0xd')]('/',auth[_0xe5b7('0xa')](),controller[_0xe5b7('0xe')]);router['put']('/:id',auth[_0xe5b7('0xa')](),controller[_0xe5b7('0xf')]);module[_0xe5b7('0x10')]=router; \ No newline at end of file +var _0xce1e=['get','isAuthenticated','/describe','/:id','show','put','update','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller'];(function(_0x3bfb9d,_0x5bf34a){var _0xfcc9a4=function(_0x45d391){while(--_0x45d391){_0x3bfb9d['push'](_0x3bfb9d['shift']());}};_0xfcc9a4(++_0x5bf34a);}(_0xce1e,0x128));var _0xece1=function(_0x6a7ccc,_0xf0c6dd){_0x6a7ccc=_0x6a7ccc-0x0;var _0x1a2993=_0xce1e[_0x6a7ccc];return _0x1a2993;};'use strict';var multer=require('multer');var util=require(_0xece1('0x0'));var path=require(_0xece1('0x1'));var timeout=require(_0xece1('0x2'));var express=require('express');var router=express[_0xece1('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xece1('0x4'));var interaction=require(_0xece1('0x5'));var config=require(_0xece1('0x6'));var controller=require(_0xece1('0x7'));router[_0xece1('0x8')]('/',auth[_0xece1('0x9')](),controller['index']);router[_0xece1('0x8')](_0xece1('0xa'),auth[_0xece1('0x9')](),controller['describe']);router['get'](_0xece1('0xb'),auth[_0xece1('0x9')](),controller[_0xece1('0xc')]);router['post']('/',auth[_0xece1('0x9')](),controller['create']);router[_0xece1('0xd')](_0xece1('0xb'),auth[_0xece1('0x9')](),controller[_0xece1('0xe')]);module[_0xece1('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 6f3c1fd..14ba2b0 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 _0x5075=['exports','STRING','name','sequelize'];(function(_0x9b56de,_0x5a93d4){var _0x1df08e=function(_0x290b5d){while(--_0x290b5d){_0x9b56de['push'](_0x9b56de['shift']());}};_0x1df08e(++_0x5a93d4);}(_0x5075,0x73));var _0x5507=function(_0x1ebce2,_0x10e903){_0x1ebce2=_0x1ebce2-0x0;var _0x4a330c=_0x5075[_0x1ebce2];return _0x4a330c;};'use strict';var Sequelize=require(_0x5507('0x0'));module[_0x5507('0x1')]={'name':{'type':Sequelize[_0x5507('0x2')],'unique':_0x5507('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x5507('0x2')]},'dialPrefix':{'type':Sequelize[_0x5507('0x2')]}}; \ No newline at end of file +var _0x1af5=['sequelize','STRING','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1af5,0x17d));var _0x51af=function(_0x535616,_0x405888){_0x535616=_0x535616-0x0;var _0x24191d=_0x1af5[_0x535616];return _0x24191d;};'use strict';var Sequelize=require(_0x51af('0x0'));module['exports']={'name':{'type':Sequelize[_0x51af('0x1')],'unique':_0x51af('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x51af('0x1')]},'dialPrefix':{'type':Sequelize[_0x51af('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index a455ca9..1cca8fc 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 _0x4385=['removeDispositions','ids','addContacts','CmContact','tags','isArray','join','push','each','omit','success','dataValues','message','Malformed\x20request\x20syntax','getContacts','CustomFields','concat','format','cf_%d','hasOwnProperty','raw','CmCustomField','isEmpty','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','number','switch','BOOLEAN','defaultValue','queryInterface','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents','spread','userCmList:save','removeAgents','emit','userCmList:remove','getAgents','User','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../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','./cmList.socket','register','sendStatus','status','offset','undefined','limit','count','set','json','save','then','destroy','Lists','UserProfileResource','end','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','type','key','model','query','intersection','attributes','length','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','rows','catch','params','include','find','create','get','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','addDisposition','ListId','Disposition','findOne','keys','fields','findAll'];(function(_0x1df6c0,_0x132faa){var _0x3c0ccb=function(_0x439cdc){while(--_0x439cdc){_0x1df6c0['push'](_0x1df6c0['shift']());}};_0x3c0ccb(++_0x132faa);}(_0x4385,0x168));var _0x5438=function(_0xe4e1cd,_0x3ab00c){_0xe4e1cd=_0xe4e1cd-0x0;var _0x2ab3d0=_0x4385[_0xe4e1cd];return _0x2ab3d0;};'use strict';var emlformat=require(_0x5438('0x0'));var rimraf=require(_0x5438('0x1'));var zipdir=require(_0x5438('0x2'));var jsonpatch=require(_0x5438('0x3'));var rp=require('request-promise');var moment=require(_0x5438('0x4'));var BPromise=require(_0x5438('0x5'));var Mustache=require(_0x5438('0x6'));var util=require(_0x5438('0x7'));var path=require(_0x5438('0x8'));var sox=require(_0x5438('0x9'));var csv=require(_0x5438('0xa'));var ejs=require(_0x5438('0xb'));var fs=require('fs');var fs_extra=require(_0x5438('0xc'));var _=require(_0x5438('0xd'));var squel=require(_0x5438('0xe'));var crypto=require(_0x5438('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x5438('0x10'));var toCsv=require(_0x5438('0xa'));var querystring=require(_0x5438('0x11'));var Papa=require(_0x5438('0x12'));var Redis=require('ioredis');var authService=require(_0x5438('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x5438('0x14'));var hardwareService=require(_0x5438('0x15'));var logger=require(_0x5438('0x16'))('api');var utils=require(_0x5438('0x17'));var config=require(_0x5438('0x18'));var licenseUtil=require(_0x5438('0x19'));var db=require(_0x5438('0x1a'))['db'];config[_0x5438('0x1b')]=_[_0x5438('0x1c')](config[_0x5438('0x1b')],{'host':_0x5438('0x1d'),'port':0x18eb});var socket=require(_0x5438('0x1e'))(new Redis(config[_0x5438('0x1b')]));require(_0x5438('0x1f'))[_0x5438('0x20')](socket);function respondWithStatusCode(_0x535b94,_0x3010a3){_0x3010a3=_0x3010a3||0xcc;return function(_0x52ee74){if(_0x52ee74){return _0x535b94[_0x5438('0x21')](_0x3010a3);}return _0x535b94[_0x5438('0x22')](_0x3010a3)['end']();};}function respondWithResult(_0x55919d,_0x1483d5){_0x1483d5=_0x1483d5||0xc8;return function(_0x54db4d){if(_0x54db4d){return _0x55919d[_0x5438('0x22')](_0x1483d5)['json'](_0x54db4d);}};}function respondWithFilteredResult(_0x16c9ed,_0x4647a8){return function(_0x491ce0){if(_0x491ce0){var _0x1c73b4=typeof _0x4647a8[_0x5438('0x23')]===_0x5438('0x24')&&typeof _0x4647a8[_0x5438('0x25')]===_0x5438('0x24');var _0x391e8f=_0x491ce0[_0x5438('0x26')];var _0x4bb5f4=_0x1c73b4?0x0:_0x4647a8[_0x5438('0x23')];var _0xe6845c=_0x1c73b4?_0x491ce0[_0x5438('0x26')]:_0x4647a8[_0x5438('0x23')]+_0x4647a8[_0x5438('0x25')];var _0x4f13fa;if(_0xe6845c>=_0x391e8f){_0xe6845c=_0x391e8f;_0x4f13fa=0xc8;}else{_0x4f13fa=0xce;}_0x16c9ed[_0x5438('0x22')](_0x4f13fa);return _0x16c9ed[_0x5438('0x27')]('Content-Range',_0x4bb5f4+'-'+_0xe6845c+'/'+_0x391e8f)[_0x5438('0x28')](_0x491ce0);}return null;};}function patchUpdates(_0x2bf7dd){return function(_0x43bcd5){try{jsonpatch['apply'](_0x43bcd5,_0x2bf7dd,!![]);}catch(_0xbbf322){return BPromise['reject'](_0xbbf322);}return _0x43bcd5[_0x5438('0x29')]();};}function saveUpdates(_0x3a93fc,_0xe8a3dd){return function(_0x3d3372){if(_0x3d3372){return _0x3d3372['update'](_0x3a93fc)[_0x5438('0x2a')](function(_0x2a4a82){return _0x2a4a82;});}return null;};}function removeEntity(_0x90706d,_0x2b58be){return function(_0x20062d){if(_0x20062d){return _0x20062d[_0x5438('0x2b')]()[_0x5438('0x2a')](function(){var _0x51fb84=_0x20062d['get']({'plain':!![]});var _0x225c19=_0x5438('0x2c');return db[_0x5438('0x2d')]['destroy']({'where':{'type':_0x225c19,'resourceId':_0x51fb84['id']}})[_0x5438('0x2a')](function(){return _0x20062d;});})[_0x5438('0x2a')](function(){_0x90706d[_0x5438('0x22')](0xcc)[_0x5438('0x2e')]();});}};}function handleEntityNotFound(_0xea2744,_0x1837fd){return function(_0x3b4881){if(!_0x3b4881){_0xea2744['sendStatus'](0x194);}return _0x3b4881;};}function handleError(_0x37953e,_0x2a67e9){_0x2a67e9=_0x2a67e9||0x1f4;return function(_0x43a3a1){logger[_0x5438('0x2f')](_0x43a3a1[_0x5438('0x30')]);if(_0x43a3a1[_0x5438('0x31')]){delete _0x43a3a1[_0x5438('0x31')];}_0x37953e['status'](_0x2a67e9)[_0x5438('0x32')](_0x43a3a1);};}exports[_0x5438('0x33')]=function(_0x4b88ad,_0x24e729){var _0x106c7b={},_0x54c638={},_0x34c2e3={'count':0x0,'rows':[]};var _0x2c3a84=_[_0x5438('0x34')](db[_0x5438('0x35')][_0x5438('0x36')],function(_0x39d456){return{'name':_0x39d456[_0x5438('0x37')],'type':_0x39d456[_0x5438('0x38')][_0x5438('0x39')]};});_0x54c638[_0x5438('0x3a')]=_['map'](_0x2c3a84,_0x5438('0x31'));_0x54c638[_0x5438('0x3b')]=_['keys'](_0x4b88ad[_0x5438('0x3b')]);_0x54c638['filters']=_[_0x5438('0x3c')](_0x54c638[_0x5438('0x3a')],_0x54c638[_0x5438('0x3b')]);_0x106c7b[_0x5438('0x3d')]=_[_0x5438('0x3c')](_0x54c638[_0x5438('0x3a')],qs['fields'](_0x4b88ad[_0x5438('0x3b')]['fields']));_0x106c7b[_0x5438('0x3d')]=_0x106c7b[_0x5438('0x3d')][_0x5438('0x3e')]?_0x106c7b[_0x5438('0x3d')]:_0x54c638['model'];if(!_0x4b88ad[_0x5438('0x3b')]['hasOwnProperty'](_0x5438('0x3f'))){_0x106c7b[_0x5438('0x25')]=qs[_0x5438('0x25')](_0x4b88ad[_0x5438('0x3b')][_0x5438('0x25')]);_0x106c7b[_0x5438('0x23')]=qs['offset'](_0x4b88ad['query'][_0x5438('0x23')]);}_0x106c7b[_0x5438('0x40')]=qs['sort'](_0x4b88ad[_0x5438('0x3b')][_0x5438('0x41')]);_0x106c7b['where']=qs[_0x5438('0x42')](_[_0x5438('0x43')](_0x4b88ad[_0x5438('0x3b')],_0x54c638['filters']),_0x2c3a84);if(_0x4b88ad[_0x5438('0x3b')][_0x5438('0x44')]){_0x106c7b[_0x5438('0x45')]=_[_0x5438('0x46')](_0x106c7b[_0x5438('0x45')],{'$or':_[_0x5438('0x34')](_0x2c3a84,function(_0xd4e522){if(_0xd4e522[_0x5438('0x38')]!==_0x5438('0x47')){var _0x3d426b={};_0x3d426b[_0xd4e522[_0x5438('0x31')]]={'$like':'%'+_0x4b88ad[_0x5438('0x3b')][_0x5438('0x44')]+'%'};return _0x3d426b;}})});}_0x106c7b=_[_0x5438('0x46')]({},_0x106c7b,_0x4b88ad[_0x5438('0x48')]);var _0x2b3ef7={'where':_0x106c7b['where']};return db['CmList'][_0x5438('0x26')](_0x2b3ef7)[_0x5438('0x2a')](function(_0x57b745){_0x34c2e3['count']=_0x57b745;if(_0x4b88ad[_0x5438('0x3b')][_0x5438('0x49')]){_0x106c7b['include']=[{'all':!![]}];}return db[_0x5438('0x35')]['findAll'](_0x106c7b);})[_0x5438('0x2a')](function(_0x79d300){_0x34c2e3[_0x5438('0x4a')]=_0x79d300;return _0x34c2e3;})[_0x5438('0x2a')](respondWithFilteredResult(_0x24e729,_0x106c7b))[_0x5438('0x4b')](handleError(_0x24e729,null));};exports['show']=function(_0x2ba931,_0xb1f71c){var _0x3f1380={'raw':![],'where':{'id':_0x2ba931[_0x5438('0x4c')]['id']}},_0x522b91={};_0x522b91[_0x5438('0x3a')]=_['keys'](db[_0x5438('0x35')][_0x5438('0x36')]);_0x522b91[_0x5438('0x3b')]=_['keys'](_0x2ba931[_0x5438('0x3b')]);_0x522b91[_0x5438('0x42')]=_[_0x5438('0x3c')](_0x522b91['model'],_0x522b91[_0x5438('0x3b')]);_0x3f1380[_0x5438('0x3d')]=_[_0x5438('0x3c')](_0x522b91[_0x5438('0x3a')],qs['fields'](_0x2ba931['query']['fields']));_0x3f1380[_0x5438('0x3d')]=_0x3f1380['attributes'][_0x5438('0x3e')]?_0x3f1380[_0x5438('0x3d')]:_0x522b91[_0x5438('0x3a')];if(_0x2ba931[_0x5438('0x3b')]['includeAll']){_0x3f1380[_0x5438('0x4d')]=[{'all':!![]}];}_0x3f1380=_[_0x5438('0x46')]({},_0x3f1380,_0x2ba931[_0x5438('0x48')]);return db[_0x5438('0x35')][_0x5438('0x4e')](_0x3f1380)[_0x5438('0x2a')](handleEntityNotFound(_0xb1f71c,null))[_0x5438('0x2a')](respondWithResult(_0xb1f71c,null))['catch'](handleError(_0xb1f71c,null));};exports[_0x5438('0x4f')]=function(_0x3a5833,_0x162b35){return db['CmList']['create'](_0x3a5833['body'],{})[_0x5438('0x2a')](function(_0x7617bf){var _0x3f538c=_0x3a5833['user'][_0x5438('0x50')]({'plain':!![]});if(!_0x3f538c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3f538c[_0x5438('0x51')]===_0x5438('0x52')){var _0x3d2f12=_0x7617bf[_0x5438('0x50')]({'plain':!![]});var _0x29459b='Lists';return db[_0x5438('0x53')]['find']({'where':{'name':_0x29459b,'userProfileId':_0x3f538c['userProfileId']},'raw':!![]})[_0x5438('0x2a')](function(_0x4ce551){if(_0x4ce551&&_0x4ce551[_0x5438('0x54')]===0x0){return db[_0x5438('0x2d')][_0x5438('0x4f')]({'name':_0x3d2f12[_0x5438('0x31')],'resourceId':_0x3d2f12['id'],'type':_0x4ce551[_0x5438('0x31')],'sectionId':_0x4ce551['id']},{})[_0x5438('0x2a')](function(){return _0x7617bf;});}else{return _0x7617bf;}})[_0x5438('0x4b')](function(_0xc28427){logger[_0x5438('0x2f')](_0x5438('0x55'),_0xc28427);throw _0xc28427;});}return _0x7617bf;})[_0x5438('0x2a')](respondWithResult(_0x162b35,0xc9))['catch'](handleError(_0x162b35,null));};exports[_0x5438('0x56')]=function(_0x1cbcc4,_0x359a99){if(_0x1cbcc4[_0x5438('0x57')]['id']){delete _0x1cbcc4[_0x5438('0x57')]['id'];}return db['CmList'][_0x5438('0x4e')]({'where':{'id':_0x1cbcc4['params']['id']}})[_0x5438('0x2a')](handleEntityNotFound(_0x359a99,null))[_0x5438('0x2a')](saveUpdates(_0x1cbcc4[_0x5438('0x57')],null))[_0x5438('0x2a')](respondWithResult(_0x359a99,null))[_0x5438('0x4b')](handleError(_0x359a99,null));};exports[_0x5438('0x2b')]=function(_0x207050,_0x1b6c12){return db[_0x5438('0x35')]['find']({'where':{'id':_0x207050[_0x5438('0x4c')]['id']}})[_0x5438('0x2a')](handleEntityNotFound(_0x1b6c12,null))[_0x5438('0x2a')](removeEntity(_0x1b6c12,null))[_0x5438('0x4b')](handleError(_0x1b6c12,null));};exports[_0x5438('0x58')]=function(_0x128b56,_0x375f10){return db[_0x5438('0x35')][_0x5438('0x58')]()[_0x5438('0x2a')](respondWithResult(_0x375f10,null))[_0x5438('0x4b')](handleError(_0x375f10,null));};exports[_0x5438('0x59')]=function(_0x278508,_0x15792d,_0x3e6c57){if(_0x278508[_0x5438('0x57')]['id']){delete _0x278508[_0x5438('0x57')]['id'];}return db[_0x5438('0x35')]['find']({'where':{'id':_0x278508[_0x5438('0x4c')]['id']}})[_0x5438('0x2a')](handleEntityNotFound(_0x15792d,null))[_0x5438('0x2a')](function(_0x3a2d36){if(_0x3a2d36){_0x278508[_0x5438('0x57')][_0x5438('0x5a')]=_0x3a2d36['id'];return db[_0x5438('0x5b')][_0x5438('0x4f')](_0x278508[_0x5438('0x57')]);}})[_0x5438('0x2a')](respondWithResult(_0x15792d,null))[_0x5438('0x4b')](handleError(_0x15792d,null));};exports['getDispositions']=function(_0x2c5e4b,_0x22fb35,_0x1c4023){var _0x5ef0f3={'raw':![],'where':{}};var _0x253b56={};var _0x1e802f={'count':0x0,'rows':[]};return db[_0x5438('0x35')][_0x5438('0x5c')]({'where':{'id':_0x2c5e4b[_0x5438('0x4c')]['id']}})[_0x5438('0x2a')](handleEntityNotFound(_0x22fb35,null))[_0x5438('0x2a')](function(_0x1afab7){if(_0x1afab7){_0x253b56[_0x5438('0x3a')]=_[_0x5438('0x5d')](db[_0x5438('0x5b')][_0x5438('0x36')]);_0x253b56[_0x5438('0x3b')]=_[_0x5438('0x5d')](_0x2c5e4b[_0x5438('0x3b')]);_0x253b56[_0x5438('0x42')]=_['intersection'](_0x253b56[_0x5438('0x3a')],_0x253b56['query']);_0x5ef0f3['attributes']=_[_0x5438('0x3c')](_0x253b56[_0x5438('0x3a')],qs[_0x5438('0x5e')](_0x2c5e4b[_0x5438('0x3b')][_0x5438('0x5e')]));_0x5ef0f3[_0x5438('0x3d')]=_0x5ef0f3[_0x5438('0x3d')][_0x5438('0x3e')]?_0x5ef0f3['attributes']:_0x253b56['model'];if(!_0x2c5e4b[_0x5438('0x3b')]['hasOwnProperty']('nolimit')){_0x5ef0f3[_0x5438('0x25')]=qs['limit'](_0x2c5e4b[_0x5438('0x3b')][_0x5438('0x25')]);_0x5ef0f3[_0x5438('0x23')]=qs[_0x5438('0x23')](_0x2c5e4b[_0x5438('0x3b')][_0x5438('0x23')]);}_0x5ef0f3[_0x5438('0x40')]=qs[_0x5438('0x41')](_0x2c5e4b['query']['sort']);_0x5ef0f3[_0x5438('0x45')]=qs['filters'](_[_0x5438('0x43')](_0x2c5e4b['query'],_0x253b56[_0x5438('0x42')]));_0x5ef0f3[_0x5438('0x45')][_0x5438('0x5a')]=_0x1afab7['id'];if(_0x2c5e4b[_0x5438('0x3b')][_0x5438('0x44')]){_0x5ef0f3[_0x5438('0x45')]=_[_0x5438('0x46')](_0x5ef0f3[_0x5438('0x45')],{'$or':_['map'](_0x5ef0f3[_0x5438('0x3d')],function(_0x51eb02){var _0xac6122={};_0xac6122[_0x51eb02]={'$like':'%'+_0x2c5e4b[_0x5438('0x3b')][_0x5438('0x44')]+'%'};return _0xac6122;})});}_0x5ef0f3=_[_0x5438('0x46')]({},_0x5ef0f3,_0x2c5e4b[_0x5438('0x48')]);return db[_0x5438('0x5b')][_0x5438('0x26')]({'where':_0x5ef0f3[_0x5438('0x45')]})[_0x5438('0x2a')](function(_0x5a47b4){_0x1e802f['count']=_0x5a47b4;if(_0x2c5e4b['query'][_0x5438('0x49')]){_0x5ef0f3[_0x5438('0x4d')]=[{'all':!![]}];}return db[_0x5438('0x5b')][_0x5438('0x5f')](_0x5ef0f3);})[_0x5438('0x2a')](function(_0x6abe33){_0x1e802f[_0x5438('0x4a')]=_0x6abe33;return _0x1e802f;});}})[_0x5438('0x2a')](respondWithFilteredResult(_0x22fb35,_0x5ef0f3))['catch'](handleError(_0x22fb35,null));};exports[_0x5438('0x60')]=function(_0x3678d4,_0x2d72ea,_0x1a8e10){return db[_0x5438('0x35')][_0x5438('0x4e')]({'where':{'id':_0x3678d4[_0x5438('0x4c')]['id']}})[_0x5438('0x2a')](handleEntityNotFound(_0x2d72ea,null))[_0x5438('0x2a')](function(_0x4689d6){if(_0x4689d6){return _0x4689d6['removeDispositions'](_0x3678d4['query'][_0x5438('0x61')]);}})[_0x5438('0x2a')](respondWithStatusCode(_0x2d72ea,null))[_0x5438('0x4b')](handleError(_0x2d72ea,null));};exports[_0x5438('0x62')]=function(_0x5435ba,_0x3b62fb,_0x4b07a9){return db[_0x5438('0x35')]['find']({'where':{'id':_0x5435ba[_0x5438('0x4c')]['id']}})[_0x5438('0x2a')](handleEntityNotFound(_0x3b62fb,null))[_0x5438('0x2a')](function(_0x134be1){if(_0x134be1){var _0x54b084=[];var _0x2872a9={'success':[],'errors':[]};return db[_0x5438('0x63')][_0x5438('0x58')]()[_0x5438('0x2a')](function(_0x196743){if(_0x5435ba[_0x5438('0x57')][_0x5438('0x64')]&&_[_0x5438('0x65')](_0x5435ba['body'][_0x5438('0x64')])){if(_0x5435ba[_0x5438('0x57')][_0x5438('0x64')][_0x5438('0x3e')]){_0x5435ba['body'][_0x5438('0x64')]=_0x5435ba[_0x5438('0x57')][_0x5438('0x64')][_0x5438('0x66')](';')+';';}else{_0x5435ba[_0x5438('0x57')][_0x5438('0x64')]=null;}}else{_0x5435ba[_0x5438('0x57')]['tags']=null;}if(_0x5435ba[_0x5438('0x57')]&&_[_0x5438('0x65')](_0x5435ba['body'])){for(var _0x90d9b7=0x0;_0x90d9b7<_0x5435ba[_0x5438('0x57')][_0x5438('0x3e')];_0x90d9b7+=0x1){_0x5435ba['body'][_0x90d9b7][_0x5438('0x5a')]=_0x5435ba[_0x5438('0x4c')]['id'];_0x54b084[_0x5438('0x67')](_0x5435ba[_0x5438('0x57')][_0x90d9b7]);}return BPromise[_0x5438('0x68')](_0x54b084,function(_0xd8364c){return db[_0x5438('0x63')][_0x5438('0x4f')](_[_0x5438('0x69')](_0xd8364c,['ids','id'])||{},{'fields':_[_0x5438('0x5d')](_0x196743),'raw':!![]})[_0x5438('0x2a')](function(_0x4835a1){_0x2872a9[_0x5438('0x6a')][_0x5438('0x67')](_0x4835a1[_0x5438('0x6b')]);})[_0x5438('0x4b')](function(_0x20fb80){_0x2872a9['errors']['push']({'data':_0xd8364c,'error':_0x20fb80[_0x5438('0x6c')]});});})[_0x5438('0x2a')](function(_0x57dcc7){return _0x2872a9;})['catch'](function(_0x1c63da){return _0x1c63da;});}else{_0x3b62fb['status'](0x190)[_0x5438('0x28')]({'message':_0x5438('0x6d')});}});}})[_0x5438('0x2a')](respondWithResult(_0x3b62fb,null))[_0x5438('0x4b')](handleError(_0x3b62fb,null));};exports[_0x5438('0x6e')]=function(_0xa524a,_0x6cb120,_0xd56f5c){var _0x42bfec;return db[_0x5438('0x35')][_0x5438('0x4e')]({'where':{'id':_0xa524a[_0x5438('0x4c')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x5438('0x6f')}]})[_0x5438('0x2a')](handleEntityNotFound(_0x6cb120,null))[_0x5438('0x2a')](function(_0x1dfdc0){if(_0x1dfdc0){_0x42bfec=_0x1dfdc0;return db['CmContact'][_0x5438('0x36')];}})[_0x5438('0x2a')](function(_0x36bb98){if(_0x36bb98){var _0x1c9f10={};var _0x1e5a13={};_0x1e5a13[_0x5438('0x3a')]=_[_0x5438('0x70')](_[_0x5438('0x5d')](_0x36bb98),_[_0x5438('0x34')](_0x42bfec[_0x5438('0x6f')],function(_0x4a27f5){return util[_0x5438('0x71')](_0x5438('0x72'),_0x4a27f5['id']);}));_0x1e5a13[_0x5438('0x3b')]=_[_0x5438('0x5d')](_0xa524a[_0x5438('0x3b')]);_0x1e5a13['filters']=_[_0x5438('0x3c')](_0x1e5a13['model'],_0x1e5a13[_0x5438('0x3b')]);_0x1c9f10[_0x5438('0x3d')]=_[_0x5438('0x3c')](_0x1e5a13['model'],qs['fields'](_0xa524a[_0x5438('0x3b')]['fields']));_0x1c9f10[_0x5438('0x3d')]=_0x1c9f10[_0x5438('0x3d')]['length']?_0x1c9f10[_0x5438('0x3d')]:_0x1e5a13[_0x5438('0x3a')];if(!_0xa524a[_0x5438('0x3b')][_0x5438('0x73')](_0x5438('0x3f'))){_0x1c9f10[_0x5438('0x25')]=qs[_0x5438('0x25')](_0xa524a[_0x5438('0x3b')][_0x5438('0x25')]);_0x1c9f10[_0x5438('0x23')]=qs[_0x5438('0x23')](_0xa524a[_0x5438('0x3b')][_0x5438('0x23')]);}_0x1c9f10[_0x5438('0x40')]=qs[_0x5438('0x41')](_0xa524a[_0x5438('0x3b')][_0x5438('0x41')]);_0x1c9f10['where']=qs[_0x5438('0x42')](_['pick'](_0xa524a[_0x5438('0x3b')],_0x1e5a13['filters']));_0x1c9f10[_0x5438('0x74')]=!![];if(_0xa524a[_0x5438('0x3b')][_0x5438('0x44')]){_0x1c9f10['where']=_[_0x5438('0x46')](_0x1c9f10[_0x5438('0x45')],{'$or':_[_0x5438('0x34')](_0x1c9f10[_0x5438('0x3d')],function(_0x482fc1){var _0x5287fc={};_0x5287fc[_0x482fc1]={'$like':'%'+_0xa524a[_0x5438('0x3b')][_0x5438('0x44')]+'%'};return _0x5287fc;})});}_0x1c9f10=_['merge']({},_0x1c9f10,_0xa524a['options']);return _0x42bfec['getContacts'](_0x1c9f10);}})[_0x5438('0x2a')](respondWithResult(_0x6cb120,null))[_0x5438('0x4b')](handleError(_0x6cb120,null));};exports['getContactsCsv']=function(_0xf95706,_0x44fac4,_0x22fe2f){var _0x2ea512;return db[_0x5438('0x35')][_0x5438('0x4e')]({'where':{'id':_0xf95706['params']['id']},'include':[{'model':db[_0x5438('0x75')],'as':_0x5438('0x6f')}]})[_0x5438('0x2a')](handleEntityNotFound(_0x44fac4,null))[_0x5438('0x2a')](function(_0x23be9a){if(_0x23be9a){_0x2ea512=_0x23be9a;return db[_0x5438('0x63')][_0x5438('0x36')];}})[_0x5438('0x2a')](function(_0x129785){if(_0x129785){var _0x58c546={};var _0x1405e7={};_0x1405e7[_0x5438('0x3a')]=_[_0x5438('0x70')](_[_0x5438('0x5d')](_0x129785),_[_0x5438('0x34')](_0x2ea512['CustomFields'],function(_0x48a668){return util['format'](_0x5438('0x72'),_0x48a668['id']);}));_0x1405e7['query']=_[_0x5438('0x5d')](_0xf95706['query']);_0x1405e7['filters']=_[_0x5438('0x3c')](_0x1405e7[_0x5438('0x3a')],_0x1405e7[_0x5438('0x3b')]);_0x58c546[_0x5438('0x3d')]=_['intersection'](_0x1405e7[_0x5438('0x3a')],qs['fields'](_0xf95706[_0x5438('0x3b')][_0x5438('0x5e')]));_0x58c546[_0x5438('0x3d')]=_0x58c546['attributes']['length']?_0x58c546['attributes']:_0x1405e7['model'];if(!_0xf95706[_0x5438('0x3b')][_0x5438('0x73')](_0x5438('0x3f'))){_0x58c546[_0x5438('0x25')]=qs['limit'](_0xf95706[_0x5438('0x3b')][_0x5438('0x25')]);_0x58c546[_0x5438('0x23')]=qs['offset'](_0xf95706[_0x5438('0x3b')]['offset']);}_0x58c546[_0x5438('0x40')]=qs['sort'](_0xf95706['query'][_0x5438('0x41')]);_0x58c546[_0x5438('0x45')]=qs[_0x5438('0x42')](_[_0x5438('0x43')](_0xf95706[_0x5438('0x3b')],_0x1405e7[_0x5438('0x42')]));_0x58c546['raw']=!![];if(_0xf95706[_0x5438('0x3b')]['filter']){_0x58c546[_0x5438('0x45')]=_['merge'](_0x58c546['where'],{'$or':_[_0x5438('0x34')](_0x58c546[_0x5438('0x3d')],function(_0x36d30a){var _0x5840b2={};_0x5840b2[_0x36d30a]={'$like':'%'+_0xf95706[_0x5438('0x3b')][_0x5438('0x44')]+'%'};return _0x5840b2;})});}_0x58c546=_[_0x5438('0x46')]({},_0x58c546,_0xf95706[_0x5438('0x48')]);return _0x2ea512[_0x5438('0x6e')](_0x58c546);}})[_0x5438('0x2a')](function(_0x49ef1a){if(!_[_0x5438('0x76')](_0x49ef1a)){var _0x4ad0bd=toCsv(_0x49ef1a);var _0x5992e5=Date['now']();fs[_0x5438('0x77')](util[_0x5438('0x71')](_0x5438('0x78'),_0x2ea512['id'],_0x5992e5),_0x4ad0bd);_0x44fac4[_0x5438('0x79')](_0x5438('0x7a'),_0x5438('0x7b')+util['format'](_0x5438('0x7c'),_0x2ea512['id'],_0x5992e5));_0x44fac4[_0x5438('0x79')](_0x5438('0x7d'),_0x5438('0x7e'));return _0x44fac4[_0x5438('0x7f')](util[_0x5438('0x71')](_0x5438('0x78'),_0x2ea512['id'],_0x5992e5));}else{return _0x44fac4[_0x5438('0x21')](0xcc);}})[_0x5438('0x4b')](handleError(_0x44fac4,null));};exports[_0x5438('0x80')]=function(_0x56f59d,_0x404fb4,_0x49a1ad){var _0x3a361a;delete _0x56f59d[_0x5438('0x57')]['id'];return db[_0x5438('0x35')][_0x5438('0x5c')]({'where':{'id':_0x56f59d[_0x5438('0x4c')]['id']}})[_0x5438('0x2a')](handleEntityNotFound(_0x404fb4,null))[_0x5438('0x2a')](function(_0x5cb019){if(_0x5cb019){return db[_0x5438('0x81')][_0x5438('0x82')](function(_0x4ac7d4){return db[_0x5438('0x75')][_0x5438('0x4f')](_0x56f59d[_0x5438('0x57')],{'transaction':_0x4ac7d4})[_0x5438('0x2a')](function(_0x2894cc){_0x3a361a=_0x2894cc;return _0x5cb019[_0x5438('0x83')](_0x2894cc,{'transaction':_0x4ac7d4});})[_0x5438('0x2a')](function(){var _0x4a3f90={'type':db[_0x5438('0x84')][_0x5438('0x85')],'transaction':_0x4ac7d4};switch(_0x56f59d[_0x5438('0x57')][_0x5438('0x38')]){case _0x5438('0x86'):_0x4a3f90['type']=db[_0x5438('0x84')]['TEXT'];break;case _0x5438('0x87'):_0x4a3f90['type']=db[_0x5438('0x84')]['INTEGER'];break;case _0x5438('0x88'):_0x4a3f90['type']=db[_0x5438('0x84')][_0x5438('0x89')];_0x4a3f90[_0x5438('0x8a')]=![];break;default:}return db[_0x5438('0x81')][_0x5438('0x8b')]['addColumn'](_0x5438('0x8c'),util['format'](_0x5438('0x8d'),_0x3a361a['id']),_0x4a3f90);})['then'](function(){return _0x3a361a;});});}})['then'](respondWithResult(_0x404fb4,null))[_0x5438('0x4b')](handleError(_0x404fb4,null));};exports[_0x5438('0x8e')]=function(_0x1768c8,_0xd53ec2,_0x2ee69a){var _0x3bad7b={};var _0x35e032={};var _0x3c032e;var _0x214fc2;return db[_0x5438('0x35')][_0x5438('0x5c')]({'where':{'id':_0x1768c8[_0x5438('0x4c')]['id']}})[_0x5438('0x2a')](handleEntityNotFound(_0xd53ec2,null))[_0x5438('0x2a')](function(_0x147e49){if(_0x147e49){_0x3c032e=_0x147e49;_0x35e032[_0x5438('0x3a')]=_['keys'](db['CmCustomField']['rawAttributes']);_0x35e032[_0x5438('0x3b')]=_['keys'](_0x1768c8['query']);_0x35e032[_0x5438('0x42')]=_[_0x5438('0x3c')](_0x35e032[_0x5438('0x3a')],_0x35e032['query']);_0x3bad7b[_0x5438('0x3d')]=_[_0x5438('0x3c')](_0x35e032[_0x5438('0x3a')],qs[_0x5438('0x5e')](_0x1768c8['query']['fields']));_0x3bad7b[_0x5438('0x3d')]=_0x3bad7b[_0x5438('0x3d')][_0x5438('0x3e')]?_0x3bad7b[_0x5438('0x3d')]:_0x35e032[_0x5438('0x3a')];_0x3bad7b['order']=qs[_0x5438('0x41')](_0x1768c8[_0x5438('0x3b')]['sort']);_0x3bad7b[_0x5438('0x45')]=qs[_0x5438('0x42')](_[_0x5438('0x43')](_0x1768c8[_0x5438('0x3b')],_0x35e032[_0x5438('0x42')]));_0x3bad7b[_0x5438('0x45')]=_[_0x5438('0x46')](_0x3bad7b[_0x5438('0x45')],{'$or':[{'ListId':_0x147e49['id']},{'ListId':null}]});if(_0x1768c8[_0x5438('0x3b')][_0x5438('0x44')]){_0x3bad7b[_0x5438('0x45')]=_[_0x5438('0x46')](_0x3bad7b[_0x5438('0x45')],{'$or':_[_0x5438('0x34')](_0x3bad7b['attributes'],function(_0x5b18cb){var _0x3893b1={};_0x3893b1[_0x5b18cb]={'$like':'%'+_0x1768c8[_0x5438('0x3b')]['filter']+'%'};return _0x3893b1;})});}_0x3bad7b=_[_0x5438('0x46')]({},_0x3bad7b,_0x1768c8[_0x5438('0x48')]);return db['CmCustomField'][_0x5438('0x8f')](_0x3bad7b);}})[_0x5438('0x2a')](respondWithResult(_0xd53ec2,null))[_0x5438('0x4b')](handleError(_0xd53ec2,null));};exports[_0x5438('0x90')]=function(_0x3a6d2f,_0x53d136,_0x312c27){return db[_0x5438('0x35')][_0x5438('0x4e')]({'where':{'id':_0x3a6d2f[_0x5438('0x4c')]['id']}})['then'](handleEntityNotFound(_0x53d136,null))[_0x5438('0x2a')](function(_0x4047dc){if(_0x4047dc){return _0x4047dc[_0x5438('0x90')](_0x3a6d2f['body']['ids'],_[_0x5438('0x69')](_0x3a6d2f[_0x5438('0x57')],[_0x5438('0x61'),'id'])||{})[_0x5438('0x91')](function(_0xe3298f){for(var _0x5b10b8=0x0;_0x5b10b8<_0x3a6d2f[_0x5438('0x57')]['ids'][_0x5438('0x3e')];_0x5b10b8+=0x1){socket['emit'](_0x5438('0x92'),{'UserId':Number(_0x3a6d2f[_0x5438('0x57')][_0x5438('0x61')][_0x5b10b8]),'CmListId':Number(_0x3a6d2f['params']['id'])});}return _0xe3298f;});}})['then'](respondWithResult(_0x53d136,null))[_0x5438('0x4b')](handleError(_0x53d136,null));};exports[_0x5438('0x93')]=function(_0x52c4c2,_0x12d02e,_0x486205){return db[_0x5438('0x35')]['find']({'where':{'id':_0x52c4c2[_0x5438('0x4c')]['id']}})[_0x5438('0x2a')](handleEntityNotFound(_0x12d02e,null))[_0x5438('0x2a')](function(_0x5e1ebe){if(_0x5e1ebe){return _0x5e1ebe[_0x5438('0x93')](_0x52c4c2[_0x5438('0x3b')]['ids'])['then'](function(){if(_[_0x5438('0x65')](_0x52c4c2[_0x5438('0x3b')]['ids'])){for(var _0x2f3568=0x0;_0x2f3568<_0x52c4c2[_0x5438('0x3b')]['ids']['length'];_0x2f3568+=0x1){socket[_0x5438('0x94')](_0x5438('0x95'),{'UserId':Number(_0x52c4c2[_0x5438('0x3b')][_0x5438('0x61')][_0x2f3568]),'CmListId':Number(_0x52c4c2[_0x5438('0x4c')]['id'])});}}else{socket[_0x5438('0x94')](_0x5438('0x95'),{'UserId':Number(_0x52c4c2[_0x5438('0x3b')][_0x5438('0x61')]),'CmListId':Number(_0x52c4c2[_0x5438('0x4c')]['id'])});}});}})['then'](respondWithStatusCode(_0x12d02e,null))[_0x5438('0x4b')](handleError(_0x12d02e,null));};exports[_0x5438('0x96')]=function(_0x3526a2,_0x5e35a9,_0x580ec7){var _0x31e1ee={};var _0x5177a3={};var _0x295504;var _0x556aa8;return db[_0x5438('0x35')][_0x5438('0x5c')]({'where':{'id':_0x3526a2['params']['id']}})['then'](handleEntityNotFound(_0x5e35a9,null))['then'](function(_0x388b47){if(_0x388b47){_0x295504=_0x388b47;_0x5177a3[_0x5438('0x3a')]=_[_0x5438('0x5d')](db[_0x5438('0x97')]['rawAttributes']);_0x5177a3['query']=_['keys'](_0x3526a2[_0x5438('0x3b')]);_0x5177a3['filters']=_[_0x5438('0x3c')](_0x5177a3[_0x5438('0x3a')],_0x5177a3[_0x5438('0x3b')]);_0x31e1ee[_0x5438('0x3d')]=_[_0x5438('0x3c')](_0x5177a3['model'],qs[_0x5438('0x5e')](_0x3526a2[_0x5438('0x3b')]['fields']));_0x31e1ee[_0x5438('0x3d')]=_0x31e1ee[_0x5438('0x3d')][_0x5438('0x3e')]?_0x31e1ee['attributes']:_0x5177a3['model'];_0x31e1ee[_0x5438('0x40')]=qs[_0x5438('0x41')](_0x3526a2[_0x5438('0x3b')][_0x5438('0x41')]);_0x31e1ee[_0x5438('0x45')]=qs[_0x5438('0x42')](_[_0x5438('0x43')](_0x3526a2[_0x5438('0x3b')],_0x5177a3[_0x5438('0x42')]));if(_0x3526a2[_0x5438('0x3b')][_0x5438('0x44')]){_0x31e1ee[_0x5438('0x45')]=_['merge'](_0x31e1ee[_0x5438('0x45')],{'$or':_[_0x5438('0x34')](_0x31e1ee[_0x5438('0x3d')],function(_0x3fb233){var _0x309a6c={};_0x309a6c[_0x3fb233]={'$like':'%'+_0x3526a2['query'][_0x5438('0x44')]+'%'};return _0x309a6c;})});}_0x31e1ee=_['merge']({},_0x31e1ee,_0x3526a2['options']);return _0x295504[_0x5438('0x96')](_0x31e1ee);}})['then'](function(_0x2246b1){if(_0x2246b1){_0x556aa8=_0x2246b1[_0x5438('0x3e')];if(!_0x3526a2['query'][_0x5438('0x73')]('nolimit')){_0x31e1ee[_0x5438('0x25')]=qs[_0x5438('0x25')](_0x3526a2['query'][_0x5438('0x25')]);_0x31e1ee[_0x5438('0x23')]=qs['offset'](_0x3526a2[_0x5438('0x3b')][_0x5438('0x23')]);}return _0x295504[_0x5438('0x96')](_0x31e1ee);}})[_0x5438('0x2a')](function(_0x3e2147){if(_0x3e2147){return _0x3e2147?{'count':_0x556aa8,'rows':_0x3e2147}:null;}})[_0x5438('0x2a')](respondWithResult(_0x5e35a9,null))['catch'](handleError(_0x5e35a9,null));}; \ No newline at end of file +var _0x8c10=['userCmList:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./cmList.socket','sendStatus','status','end','offset','limit','undefined','count','Content-Range','json','apply','reject','save','then','get','destroy','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','type','key','model','query','keys','filters','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','include','findAll','rows','catch','show','params','length','includeAll','options','find','create','body','user','role','Lists','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','ListId','Disposition','getDispositions','findOne','intersection','removeDispositions','addContacts','CmContact','tags','join','isArray','push','each','omit','ids','success','dataValues','errors','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','format','cf_%d','raw','getContactsCsv','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','setHeader','Content-type','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','queryInterface','addColumn','cm_contacts','findAndCountAll','addAgents','userCmList:save','removeAgents','emit'];(function(_0x3db83a,_0x1fc6e7){var _0x1f774d=function(_0x3d8e22){while(--_0x3d8e22){_0x3db83a['push'](_0x3db83a['shift']());}};_0x1f774d(++_0x1fc6e7);}(_0x8c10,0x12e));var _0x08c1=function(_0x1bd00a,_0x6cf97e){_0x1bd00a=_0x1bd00a-0x0;var _0x4973fa=_0x8c10[_0x1bd00a];return _0x4973fa;};'use strict';var emlformat=require(_0x08c1('0x0'));var rimraf=require(_0x08c1('0x1'));var zipdir=require(_0x08c1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x08c1('0x3'));var moment=require(_0x08c1('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x08c1('0x5'));var path=require(_0x08c1('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x08c1('0x7'));var fs=require('fs');var fs_extra=require(_0x08c1('0x8'));var _=require(_0x08c1('0x9'));var squel=require(_0x08c1('0xa'));var crypto=require(_0x08c1('0xb'));var jsforce=require(_0x08c1('0xc'));var deskjs=require(_0x08c1('0xd'));var toCsv=require(_0x08c1('0xe'));var querystring=require(_0x08c1('0xf'));var Papa=require(_0x08c1('0x10'));var Redis=require(_0x08c1('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x08c1('0x12'));var as=require(_0x08c1('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x08c1('0x14'))(_0x08c1('0x15'));var utils=require(_0x08c1('0x16'));var config=require(_0x08c1('0x17'));var licenseUtil=require(_0x08c1('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x08c1('0x19')](config[_0x08c1('0x1a')],{'host':_0x08c1('0x1b'),'port':0x18eb});var socket=require(_0x08c1('0x1c'))(new Redis(config[_0x08c1('0x1a')]));require(_0x08c1('0x1d'))['register'](socket);function respondWithStatusCode(_0x470d28,_0x5d1637){_0x5d1637=_0x5d1637||0xcc;return function(_0x24b970){if(_0x24b970){return _0x470d28[_0x08c1('0x1e')](_0x5d1637);}return _0x470d28[_0x08c1('0x1f')](_0x5d1637)[_0x08c1('0x20')]();};}function respondWithResult(_0xd26ae4,_0x337d29){_0x337d29=_0x337d29||0xc8;return function(_0x239bad){if(_0x239bad){return _0xd26ae4[_0x08c1('0x1f')](_0x337d29)['json'](_0x239bad);}};}function respondWithFilteredResult(_0x107e89,_0x5f3bc0){return function(_0x49a5fa){if(_0x49a5fa){var _0xacc5f8=typeof _0x5f3bc0[_0x08c1('0x21')]==='undefined'&&typeof _0x5f3bc0[_0x08c1('0x22')]===_0x08c1('0x23');var _0x3fd687=_0x49a5fa['count'];var _0x5cf5c6=_0xacc5f8?0x0:_0x5f3bc0[_0x08c1('0x21')];var _0x5b9bc7=_0xacc5f8?_0x49a5fa[_0x08c1('0x24')]:_0x5f3bc0[_0x08c1('0x21')]+_0x5f3bc0['limit'];var _0x321198;if(_0x5b9bc7>=_0x3fd687){_0x5b9bc7=_0x3fd687;_0x321198=0xc8;}else{_0x321198=0xce;}_0x107e89[_0x08c1('0x1f')](_0x321198);return _0x107e89['set'](_0x08c1('0x25'),_0x5cf5c6+'-'+_0x5b9bc7+'/'+_0x3fd687)[_0x08c1('0x26')](_0x49a5fa);}return null;};}function patchUpdates(_0x2e7c2d){return function(_0x7fe9e6){try{jsonpatch[_0x08c1('0x27')](_0x7fe9e6,_0x2e7c2d,!![]);}catch(_0xa3a798){return BPromise[_0x08c1('0x28')](_0xa3a798);}return _0x7fe9e6[_0x08c1('0x29')]();};}function saveUpdates(_0x46a408,_0x3dbff0){return function(_0x120803){if(_0x120803){return _0x120803['update'](_0x46a408)[_0x08c1('0x2a')](function(_0x488e5b){return _0x488e5b;});}return null;};}function removeEntity(_0x4253cb,_0x89a96a){return function(_0x10302f){if(_0x10302f){return _0x10302f['destroy']()[_0x08c1('0x2a')](function(){var _0xc0349a=_0x10302f[_0x08c1('0x2b')]({'plain':!![]});var _0x14713e='Lists';return db['UserProfileResource'][_0x08c1('0x2c')]({'where':{'type':_0x14713e,'resourceId':_0xc0349a['id']}})[_0x08c1('0x2a')](function(){return _0x10302f;});})[_0x08c1('0x2a')](function(){_0x4253cb[_0x08c1('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x502e52,_0x569286){return function(_0x26f997){if(!_0x26f997){_0x502e52['sendStatus'](0x194);}return _0x26f997;};}function handleError(_0x379c86,_0x4a8a93){_0x4a8a93=_0x4a8a93||0x1f4;return function(_0x9285df){logger[_0x08c1('0x2d')](_0x9285df[_0x08c1('0x2e')]);if(_0x9285df[_0x08c1('0x2f')]){delete _0x9285df[_0x08c1('0x2f')];}_0x379c86[_0x08c1('0x1f')](_0x4a8a93)[_0x08c1('0x30')](_0x9285df);};}exports[_0x08c1('0x31')]=function(_0x21034b,_0x3575ed){var _0x544875={},_0x3412f5={},_0x283996={'count':0x0,'rows':[]};var _0x3e3f32=_[_0x08c1('0x32')](db[_0x08c1('0x33')][_0x08c1('0x34')],function(_0x7e4ba6){return{'name':_0x7e4ba6[_0x08c1('0x35')],'type':_0x7e4ba6[_0x08c1('0x36')][_0x08c1('0x37')]};});_0x3412f5[_0x08c1('0x38')]=_[_0x08c1('0x32')](_0x3e3f32,_0x08c1('0x2f'));_0x3412f5[_0x08c1('0x39')]=_[_0x08c1('0x3a')](_0x21034b['query']);_0x3412f5[_0x08c1('0x3b')]=_['intersection'](_0x3412f5[_0x08c1('0x38')],_0x3412f5[_0x08c1('0x39')]);_0x544875['attributes']=_['intersection'](_0x3412f5[_0x08c1('0x38')],qs[_0x08c1('0x3c')](_0x21034b[_0x08c1('0x39')]['fields']));_0x544875[_0x08c1('0x3d')]=_0x544875[_0x08c1('0x3d')]['length']?_0x544875[_0x08c1('0x3d')]:_0x3412f5[_0x08c1('0x38')];if(!_0x21034b[_0x08c1('0x39')][_0x08c1('0x3e')](_0x08c1('0x3f'))){_0x544875[_0x08c1('0x22')]=qs['limit'](_0x21034b[_0x08c1('0x39')][_0x08c1('0x22')]);_0x544875[_0x08c1('0x21')]=qs['offset'](_0x21034b[_0x08c1('0x39')][_0x08c1('0x21')]);}_0x544875[_0x08c1('0x40')]=qs[_0x08c1('0x41')](_0x21034b[_0x08c1('0x39')][_0x08c1('0x41')]);_0x544875['where']=qs[_0x08c1('0x3b')](_[_0x08c1('0x42')](_0x21034b[_0x08c1('0x39')],_0x3412f5[_0x08c1('0x3b')]),_0x3e3f32);if(_0x21034b[_0x08c1('0x39')][_0x08c1('0x43')]){_0x544875['where']=_[_0x08c1('0x44')](_0x544875[_0x08c1('0x45')],{'$or':_['map'](_0x3e3f32,function(_0x563f23){if(_0x563f23[_0x08c1('0x36')]!=='VIRTUAL'){var _0x5d3cff={};_0x5d3cff[_0x563f23[_0x08c1('0x2f')]]={'$like':'%'+_0x21034b['query'][_0x08c1('0x43')]+'%'};return _0x5d3cff;}})});}_0x544875=_['merge']({},_0x544875,_0x21034b['options']);var _0x12b26a={'where':_0x544875[_0x08c1('0x45')]};return db[_0x08c1('0x33')][_0x08c1('0x24')](_0x12b26a)[_0x08c1('0x2a')](function(_0x2d4ef1){_0x283996[_0x08c1('0x24')]=_0x2d4ef1;if(_0x21034b[_0x08c1('0x39')]['includeAll']){_0x544875[_0x08c1('0x46')]=[{'all':!![]}];}return db[_0x08c1('0x33')][_0x08c1('0x47')](_0x544875);})['then'](function(_0x4c6d26){_0x283996[_0x08c1('0x48')]=_0x4c6d26;return _0x283996;})[_0x08c1('0x2a')](respondWithFilteredResult(_0x3575ed,_0x544875))[_0x08c1('0x49')](handleError(_0x3575ed,null));};exports[_0x08c1('0x4a')]=function(_0x9df773,_0x45f54d){var _0x7971be={'raw':![],'where':{'id':_0x9df773[_0x08c1('0x4b')]['id']}},_0x24ac2b={};_0x24ac2b[_0x08c1('0x38')]=_[_0x08c1('0x3a')](db['CmList']['rawAttributes']);_0x24ac2b['query']=_[_0x08c1('0x3a')](_0x9df773[_0x08c1('0x39')]);_0x24ac2b[_0x08c1('0x3b')]=_['intersection'](_0x24ac2b[_0x08c1('0x38')],_0x24ac2b['query']);_0x7971be['attributes']=_['intersection'](_0x24ac2b[_0x08c1('0x38')],qs['fields'](_0x9df773[_0x08c1('0x39')][_0x08c1('0x3c')]));_0x7971be['attributes']=_0x7971be[_0x08c1('0x3d')][_0x08c1('0x4c')]?_0x7971be['attributes']:_0x24ac2b['model'];if(_0x9df773[_0x08c1('0x39')][_0x08c1('0x4d')]){_0x7971be['include']=[{'all':!![]}];}_0x7971be=_[_0x08c1('0x44')]({},_0x7971be,_0x9df773[_0x08c1('0x4e')]);return db[_0x08c1('0x33')][_0x08c1('0x4f')](_0x7971be)[_0x08c1('0x2a')](handleEntityNotFound(_0x45f54d,null))[_0x08c1('0x2a')](respondWithResult(_0x45f54d,null))[_0x08c1('0x49')](handleError(_0x45f54d,null));};exports[_0x08c1('0x50')]=function(_0x350f8e,_0x5a2bf1){return db[_0x08c1('0x33')][_0x08c1('0x50')](_0x350f8e[_0x08c1('0x51')],{})['then'](function(_0x573e4f){var _0xffe6e1=_0x350f8e[_0x08c1('0x52')]['get']({'plain':!![]});if(!_0xffe6e1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xffe6e1[_0x08c1('0x53')]==='user'){var _0x3b66f0=_0x573e4f['get']({'plain':!![]});var _0x4fb92b=_0x08c1('0x54');return db[_0x08c1('0x55')][_0x08c1('0x4f')]({'where':{'name':_0x4fb92b,'userProfileId':_0xffe6e1[_0x08c1('0x56')]},'raw':!![]})[_0x08c1('0x2a')](function(_0x4c513e){if(_0x4c513e&&_0x4c513e[_0x08c1('0x57')]===0x0){return db[_0x08c1('0x58')][_0x08c1('0x50')]({'name':_0x3b66f0[_0x08c1('0x2f')],'resourceId':_0x3b66f0['id'],'type':_0x4c513e[_0x08c1('0x2f')],'sectionId':_0x4c513e['id']},{})[_0x08c1('0x2a')](function(){return _0x573e4f;});}else{return _0x573e4f;}})[_0x08c1('0x49')](function(_0x40ca96){logger[_0x08c1('0x2d')](_0x08c1('0x59'),_0x40ca96);throw _0x40ca96;});}return _0x573e4f;})[_0x08c1('0x2a')](respondWithResult(_0x5a2bf1,0xc9))[_0x08c1('0x49')](handleError(_0x5a2bf1,null));};exports[_0x08c1('0x5a')]=function(_0xda2e9a,_0x3ece61){if(_0xda2e9a[_0x08c1('0x51')]['id']){delete _0xda2e9a[_0x08c1('0x51')]['id'];}return db[_0x08c1('0x33')][_0x08c1('0x4f')]({'where':{'id':_0xda2e9a[_0x08c1('0x4b')]['id']}})[_0x08c1('0x2a')](handleEntityNotFound(_0x3ece61,null))[_0x08c1('0x2a')](saveUpdates(_0xda2e9a[_0x08c1('0x51')],null))[_0x08c1('0x2a')](respondWithResult(_0x3ece61,null))[_0x08c1('0x49')](handleError(_0x3ece61,null));};exports['destroy']=function(_0x5214a1,_0x3d68c1){return db['CmList'][_0x08c1('0x4f')]({'where':{'id':_0x5214a1[_0x08c1('0x4b')]['id']}})[_0x08c1('0x2a')](handleEntityNotFound(_0x3d68c1,null))[_0x08c1('0x2a')](removeEntity(_0x3d68c1,null))[_0x08c1('0x49')](handleError(_0x3d68c1,null));};exports[_0x08c1('0x5b')]=function(_0xbdcc31,_0x54e55b){return db[_0x08c1('0x33')][_0x08c1('0x5b')]()['then'](respondWithResult(_0x54e55b,null))[_0x08c1('0x49')](handleError(_0x54e55b,null));};exports[_0x08c1('0x5c')]=function(_0x53f9fc,_0x2b8da4,_0x293e11){if(_0x53f9fc[_0x08c1('0x51')]['id']){delete _0x53f9fc[_0x08c1('0x51')]['id'];}return db[_0x08c1('0x33')][_0x08c1('0x4f')]({'where':{'id':_0x53f9fc[_0x08c1('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2b8da4,null))['then'](function(_0x433fdc){if(_0x433fdc){_0x53f9fc[_0x08c1('0x51')][_0x08c1('0x5d')]=_0x433fdc['id'];return db[_0x08c1('0x5e')][_0x08c1('0x50')](_0x53f9fc[_0x08c1('0x51')]);}})[_0x08c1('0x2a')](respondWithResult(_0x2b8da4,null))[_0x08c1('0x49')](handleError(_0x2b8da4,null));};exports[_0x08c1('0x5f')]=function(_0x5ebbc7,_0x4a15bf,_0x394945){var _0x1248cb={'raw':![],'where':{}};var _0x583b14={};var _0x4ef46a={'count':0x0,'rows':[]};return db[_0x08c1('0x33')][_0x08c1('0x60')]({'where':{'id':_0x5ebbc7[_0x08c1('0x4b')]['id']}})[_0x08c1('0x2a')](handleEntityNotFound(_0x4a15bf,null))[_0x08c1('0x2a')](function(_0x9e21af){if(_0x9e21af){_0x583b14[_0x08c1('0x38')]=_[_0x08c1('0x3a')](db[_0x08c1('0x5e')][_0x08c1('0x34')]);_0x583b14['query']=_[_0x08c1('0x3a')](_0x5ebbc7[_0x08c1('0x39')]);_0x583b14[_0x08c1('0x3b')]=_[_0x08c1('0x61')](_0x583b14[_0x08c1('0x38')],_0x583b14['query']);_0x1248cb[_0x08c1('0x3d')]=_[_0x08c1('0x61')](_0x583b14['model'],qs[_0x08c1('0x3c')](_0x5ebbc7['query'][_0x08c1('0x3c')]));_0x1248cb['attributes']=_0x1248cb['attributes'][_0x08c1('0x4c')]?_0x1248cb[_0x08c1('0x3d')]:_0x583b14[_0x08c1('0x38')];if(!_0x5ebbc7[_0x08c1('0x39')][_0x08c1('0x3e')](_0x08c1('0x3f'))){_0x1248cb[_0x08c1('0x22')]=qs[_0x08c1('0x22')](_0x5ebbc7[_0x08c1('0x39')][_0x08c1('0x22')]);_0x1248cb['offset']=qs[_0x08c1('0x21')](_0x5ebbc7[_0x08c1('0x39')][_0x08c1('0x21')]);}_0x1248cb['order']=qs[_0x08c1('0x41')](_0x5ebbc7[_0x08c1('0x39')][_0x08c1('0x41')]);_0x1248cb[_0x08c1('0x45')]=qs['filters'](_[_0x08c1('0x42')](_0x5ebbc7[_0x08c1('0x39')],_0x583b14[_0x08c1('0x3b')]));_0x1248cb[_0x08c1('0x45')][_0x08c1('0x5d')]=_0x9e21af['id'];if(_0x5ebbc7[_0x08c1('0x39')]['filter']){_0x1248cb['where']=_['merge'](_0x1248cb['where'],{'$or':_[_0x08c1('0x32')](_0x1248cb[_0x08c1('0x3d')],function(_0x4c86b5){var _0x495c84={};_0x495c84[_0x4c86b5]={'$like':'%'+_0x5ebbc7['query']['filter']+'%'};return _0x495c84;})});}_0x1248cb=_['merge']({},_0x1248cb,_0x5ebbc7[_0x08c1('0x4e')]);return db[_0x08c1('0x5e')]['count']({'where':_0x1248cb[_0x08c1('0x45')]})[_0x08c1('0x2a')](function(_0x3bbcb0){_0x4ef46a[_0x08c1('0x24')]=_0x3bbcb0;if(_0x5ebbc7['query'][_0x08c1('0x4d')]){_0x1248cb[_0x08c1('0x46')]=[{'all':!![]}];}return db['Disposition'][_0x08c1('0x47')](_0x1248cb);})['then'](function(_0x95bd38){_0x4ef46a[_0x08c1('0x48')]=_0x95bd38;return _0x4ef46a;});}})[_0x08c1('0x2a')](respondWithFilteredResult(_0x4a15bf,_0x1248cb))['catch'](handleError(_0x4a15bf,null));};exports['removeDispositions']=function(_0x9ec6a4,_0xa0cdab,_0x76dbb9){return db[_0x08c1('0x33')][_0x08c1('0x4f')]({'where':{'id':_0x9ec6a4[_0x08c1('0x4b')]['id']}})['then'](handleEntityNotFound(_0xa0cdab,null))[_0x08c1('0x2a')](function(_0x45d614){if(_0x45d614){return _0x45d614[_0x08c1('0x62')](_0x9ec6a4[_0x08c1('0x39')]['ids']);}})[_0x08c1('0x2a')](respondWithStatusCode(_0xa0cdab,null))[_0x08c1('0x49')](handleError(_0xa0cdab,null));};exports[_0x08c1('0x63')]=function(_0x43c11d,_0x3a1e1c,_0x4598dc){return db[_0x08c1('0x33')][_0x08c1('0x4f')]({'where':{'id':_0x43c11d['params']['id']}})[_0x08c1('0x2a')](handleEntityNotFound(_0x3a1e1c,null))['then'](function(_0x249799){if(_0x249799){var _0x424465=[];var _0x4a8fb0={'success':[],'errors':[]};return db[_0x08c1('0x64')][_0x08c1('0x5b')]()['then'](function(_0x1a7ac4){if(_0x43c11d[_0x08c1('0x51')][_0x08c1('0x65')]&&_['isArray'](_0x43c11d[_0x08c1('0x51')][_0x08c1('0x65')])){if(_0x43c11d[_0x08c1('0x51')][_0x08c1('0x65')][_0x08c1('0x4c')]){_0x43c11d[_0x08c1('0x51')][_0x08c1('0x65')]=_0x43c11d[_0x08c1('0x51')][_0x08c1('0x65')][_0x08c1('0x66')](';')+';';}else{_0x43c11d[_0x08c1('0x51')][_0x08c1('0x65')]=null;}}else{_0x43c11d[_0x08c1('0x51')][_0x08c1('0x65')]=null;}if(_0x43c11d[_0x08c1('0x51')]&&_[_0x08c1('0x67')](_0x43c11d['body'])){for(var _0x34aa7c=0x0;_0x34aa7c<_0x43c11d['body'][_0x08c1('0x4c')];_0x34aa7c+=0x1){_0x43c11d['body'][_0x34aa7c][_0x08c1('0x5d')]=_0x43c11d['params']['id'];_0x424465[_0x08c1('0x68')](_0x43c11d[_0x08c1('0x51')][_0x34aa7c]);}return BPromise[_0x08c1('0x69')](_0x424465,function(_0xe09c46){return db['CmContact']['create'](_[_0x08c1('0x6a')](_0xe09c46,[_0x08c1('0x6b'),'id'])||{},{'fields':_[_0x08c1('0x3a')](_0x1a7ac4),'raw':!![]})[_0x08c1('0x2a')](function(_0x237365){_0x4a8fb0[_0x08c1('0x6c')]['push'](_0x237365[_0x08c1('0x6d')]);})[_0x08c1('0x49')](function(_0x56efd6){_0x4a8fb0[_0x08c1('0x6e')][_0x08c1('0x68')]({'data':_0xe09c46,'error':_0x56efd6['message']});});})[_0x08c1('0x2a')](function(_0x262e8d){return _0x4a8fb0;})[_0x08c1('0x49')](function(_0x5df917){return _0x5df917;});}else{_0x3a1e1c[_0x08c1('0x1f')](0x190)[_0x08c1('0x26')]({'message':_0x08c1('0x6f')});}});}})['then'](respondWithResult(_0x3a1e1c,null))[_0x08c1('0x49')](handleError(_0x3a1e1c,null));};exports[_0x08c1('0x70')]=function(_0x1e80b8,_0x23f0c6,_0xaa291f){var _0x8b936c;return db[_0x08c1('0x33')][_0x08c1('0x4f')]({'where':{'id':_0x1e80b8[_0x08c1('0x4b')]['id']},'include':[{'model':db[_0x08c1('0x71')],'as':_0x08c1('0x72')}]})[_0x08c1('0x2a')](handleEntityNotFound(_0x23f0c6,null))[_0x08c1('0x2a')](function(_0x5b4c05){if(_0x5b4c05){_0x8b936c=_0x5b4c05;return db[_0x08c1('0x64')][_0x08c1('0x34')];}})[_0x08c1('0x2a')](function(_0x5966a5){if(_0x5966a5){var _0x470d3f={};var _0x1c7740={};_0x1c7740[_0x08c1('0x38')]=_['concat'](_[_0x08c1('0x3a')](_0x5966a5),_[_0x08c1('0x32')](_0x8b936c[_0x08c1('0x72')],function(_0x13e235){return util[_0x08c1('0x73')](_0x08c1('0x74'),_0x13e235['id']);}));_0x1c7740[_0x08c1('0x39')]=_['keys'](_0x1e80b8[_0x08c1('0x39')]);_0x1c7740[_0x08c1('0x3b')]=_[_0x08c1('0x61')](_0x1c7740[_0x08c1('0x38')],_0x1c7740[_0x08c1('0x39')]);_0x470d3f['attributes']=_['intersection'](_0x1c7740[_0x08c1('0x38')],qs[_0x08c1('0x3c')](_0x1e80b8['query']['fields']));_0x470d3f['attributes']=_0x470d3f[_0x08c1('0x3d')][_0x08c1('0x4c')]?_0x470d3f[_0x08c1('0x3d')]:_0x1c7740['model'];if(!_0x1e80b8[_0x08c1('0x39')][_0x08c1('0x3e')](_0x08c1('0x3f'))){_0x470d3f[_0x08c1('0x22')]=qs[_0x08c1('0x22')](_0x1e80b8['query'][_0x08c1('0x22')]);_0x470d3f[_0x08c1('0x21')]=qs['offset'](_0x1e80b8['query']['offset']);}_0x470d3f['order']=qs[_0x08c1('0x41')](_0x1e80b8[_0x08c1('0x39')][_0x08c1('0x41')]);_0x470d3f[_0x08c1('0x45')]=qs[_0x08c1('0x3b')](_[_0x08c1('0x42')](_0x1e80b8[_0x08c1('0x39')],_0x1c7740['filters']));_0x470d3f[_0x08c1('0x75')]=!![];if(_0x1e80b8[_0x08c1('0x39')][_0x08c1('0x43')]){_0x470d3f[_0x08c1('0x45')]=_[_0x08c1('0x44')](_0x470d3f[_0x08c1('0x45')],{'$or':_[_0x08c1('0x32')](_0x470d3f[_0x08c1('0x3d')],function(_0x2933a9){var _0x497d7a={};_0x497d7a[_0x2933a9]={'$like':'%'+_0x1e80b8[_0x08c1('0x39')][_0x08c1('0x43')]+'%'};return _0x497d7a;})});}_0x470d3f=_[_0x08c1('0x44')]({},_0x470d3f,_0x1e80b8[_0x08c1('0x4e')]);return _0x8b936c['getContacts'](_0x470d3f);}})[_0x08c1('0x2a')](respondWithResult(_0x23f0c6,null))[_0x08c1('0x49')](handleError(_0x23f0c6,null));};exports[_0x08c1('0x76')]=function(_0x5f4a82,_0x2a3ea7,_0x56473b){var _0xc630be;return db[_0x08c1('0x33')][_0x08c1('0x4f')]({'where':{'id':_0x5f4a82[_0x08c1('0x4b')]['id']},'include':[{'model':db[_0x08c1('0x71')],'as':'CustomFields'}]})['then'](handleEntityNotFound(_0x2a3ea7,null))[_0x08c1('0x2a')](function(_0x28c740){if(_0x28c740){_0xc630be=_0x28c740;return db[_0x08c1('0x64')]['rawAttributes'];}})['then'](function(_0x47667d){if(_0x47667d){var _0x27c026={};var _0x1b0008={};_0x1b0008[_0x08c1('0x38')]=_['concat'](_[_0x08c1('0x3a')](_0x47667d),_[_0x08c1('0x32')](_0xc630be[_0x08c1('0x72')],function(_0x92d0f2){return util['format']('cf_%d',_0x92d0f2['id']);}));_0x1b0008['query']=_[_0x08c1('0x3a')](_0x5f4a82[_0x08c1('0x39')]);_0x1b0008[_0x08c1('0x3b')]=_[_0x08c1('0x61')](_0x1b0008[_0x08c1('0x38')],_0x1b0008[_0x08c1('0x39')]);_0x27c026[_0x08c1('0x3d')]=_['intersection'](_0x1b0008[_0x08c1('0x38')],qs[_0x08c1('0x3c')](_0x5f4a82[_0x08c1('0x39')][_0x08c1('0x3c')]));_0x27c026[_0x08c1('0x3d')]=_0x27c026['attributes']['length']?_0x27c026[_0x08c1('0x3d')]:_0x1b0008[_0x08c1('0x38')];if(!_0x5f4a82[_0x08c1('0x39')][_0x08c1('0x3e')](_0x08c1('0x3f'))){_0x27c026[_0x08c1('0x22')]=qs[_0x08c1('0x22')](_0x5f4a82[_0x08c1('0x39')]['limit']);_0x27c026[_0x08c1('0x21')]=qs[_0x08c1('0x21')](_0x5f4a82[_0x08c1('0x39')]['offset']);}_0x27c026['order']=qs[_0x08c1('0x41')](_0x5f4a82[_0x08c1('0x39')]['sort']);_0x27c026[_0x08c1('0x45')]=qs[_0x08c1('0x3b')](_['pick'](_0x5f4a82['query'],_0x1b0008[_0x08c1('0x3b')]));_0x27c026[_0x08c1('0x75')]=!![];if(_0x5f4a82['query'][_0x08c1('0x43')]){_0x27c026[_0x08c1('0x45')]=_[_0x08c1('0x44')](_0x27c026[_0x08c1('0x45')],{'$or':_['map'](_0x27c026[_0x08c1('0x3d')],function(_0xa55427){var _0x405347={};_0x405347[_0xa55427]={'$like':'%'+_0x5f4a82[_0x08c1('0x39')][_0x08c1('0x43')]+'%'};return _0x405347;})});}_0x27c026=_[_0x08c1('0x44')]({},_0x27c026,_0x5f4a82[_0x08c1('0x4e')]);return _0xc630be[_0x08c1('0x70')](_0x27c026);}})[_0x08c1('0x2a')](function(_0x2b4311){if(!_[_0x08c1('0x77')](_0x2b4311)){var _0x2c6c6c=toCsv(_0x2b4311);var _0x36c413=Date[_0x08c1('0x78')]();fs[_0x08c1('0x79')](util[_0x08c1('0x73')](_0x08c1('0x7a'),_0xc630be['id'],_0x36c413),_0x2c6c6c);_0x2a3ea7['setHeader'](_0x08c1('0x7b'),_0x08c1('0x7c')+util[_0x08c1('0x73')](_0x08c1('0x7d'),_0xc630be['id'],_0x36c413));_0x2a3ea7[_0x08c1('0x7e')](_0x08c1('0x7f'),'text/csv');return _0x2a3ea7[_0x08c1('0x80')](util[_0x08c1('0x73')](_0x08c1('0x7a'),_0xc630be['id'],_0x36c413));}else{return _0x2a3ea7['sendStatus'](0xcc);}})[_0x08c1('0x49')](handleError(_0x2a3ea7,null));};exports[_0x08c1('0x81')]=function(_0x241eb9,_0x8666f5,_0x50e92d){var _0x57fc5c;delete _0x241eb9[_0x08c1('0x51')]['id'];return db['CmList'][_0x08c1('0x60')]({'where':{'id':_0x241eb9[_0x08c1('0x4b')]['id']}})[_0x08c1('0x2a')](handleEntityNotFound(_0x8666f5,null))[_0x08c1('0x2a')](function(_0x6e960a){if(_0x6e960a){return db[_0x08c1('0x82')][_0x08c1('0x83')](function(_0x5185e5){return db[_0x08c1('0x71')]['create'](_0x241eb9[_0x08c1('0x51')],{'transaction':_0x5185e5})[_0x08c1('0x2a')](function(_0xec1317){_0x57fc5c=_0xec1317;return _0x6e960a[_0x08c1('0x84')](_0xec1317,{'transaction':_0x5185e5});})[_0x08c1('0x2a')](function(){var _0x1995ea={'type':db[_0x08c1('0x85')][_0x08c1('0x86')],'transaction':_0x5185e5};switch(_0x241eb9[_0x08c1('0x51')][_0x08c1('0x36')]){case _0x08c1('0x87'):_0x1995ea[_0x08c1('0x36')]=db[_0x08c1('0x85')][_0x08c1('0x86')];break;case _0x08c1('0x88'):_0x1995ea['type']=db[_0x08c1('0x85')][_0x08c1('0x89')];break;case _0x08c1('0x8a'):_0x1995ea['type']=db['Sequelize'][_0x08c1('0x8b')];_0x1995ea['defaultValue']=![];break;default:}return db[_0x08c1('0x82')][_0x08c1('0x8c')][_0x08c1('0x8d')](_0x08c1('0x8e'),util['format']('cf_%s',_0x57fc5c['id']),_0x1995ea);})[_0x08c1('0x2a')](function(){return _0x57fc5c;});});}})[_0x08c1('0x2a')](respondWithResult(_0x8666f5,null))['catch'](handleError(_0x8666f5,null));};exports['getCustomFields']=function(_0x3f14f3,_0x211543,_0x51d017){var _0x4e0029={};var _0x581732={};var _0x495446;var _0x250244;return db['CmList'][_0x08c1('0x60')]({'where':{'id':_0x3f14f3['params']['id']}})[_0x08c1('0x2a')](handleEntityNotFound(_0x211543,null))[_0x08c1('0x2a')](function(_0x14608f){if(_0x14608f){_0x495446=_0x14608f;_0x581732[_0x08c1('0x38')]=_[_0x08c1('0x3a')](db[_0x08c1('0x71')][_0x08c1('0x34')]);_0x581732[_0x08c1('0x39')]=_[_0x08c1('0x3a')](_0x3f14f3[_0x08c1('0x39')]);_0x581732[_0x08c1('0x3b')]=_[_0x08c1('0x61')](_0x581732[_0x08c1('0x38')],_0x581732['query']);_0x4e0029[_0x08c1('0x3d')]=_[_0x08c1('0x61')](_0x581732[_0x08c1('0x38')],qs[_0x08c1('0x3c')](_0x3f14f3[_0x08c1('0x39')][_0x08c1('0x3c')]));_0x4e0029[_0x08c1('0x3d')]=_0x4e0029[_0x08c1('0x3d')][_0x08c1('0x4c')]?_0x4e0029[_0x08c1('0x3d')]:_0x581732[_0x08c1('0x38')];_0x4e0029['order']=qs[_0x08c1('0x41')](_0x3f14f3['query']['sort']);_0x4e0029['where']=qs[_0x08c1('0x3b')](_[_0x08c1('0x42')](_0x3f14f3[_0x08c1('0x39')],_0x581732[_0x08c1('0x3b')]));_0x4e0029[_0x08c1('0x45')]=_[_0x08c1('0x44')](_0x4e0029[_0x08c1('0x45')],{'$or':[{'ListId':_0x14608f['id']},{'ListId':null}]});if(_0x3f14f3[_0x08c1('0x39')][_0x08c1('0x43')]){_0x4e0029[_0x08c1('0x45')]=_[_0x08c1('0x44')](_0x4e0029[_0x08c1('0x45')],{'$or':_[_0x08c1('0x32')](_0x4e0029[_0x08c1('0x3d')],function(_0x15040f){var _0x235951={};_0x235951[_0x15040f]={'$like':'%'+_0x3f14f3[_0x08c1('0x39')][_0x08c1('0x43')]+'%'};return _0x235951;})});}_0x4e0029=_[_0x08c1('0x44')]({},_0x4e0029,_0x3f14f3[_0x08c1('0x4e')]);return db[_0x08c1('0x71')][_0x08c1('0x8f')](_0x4e0029);}})[_0x08c1('0x2a')](respondWithResult(_0x211543,null))[_0x08c1('0x49')](handleError(_0x211543,null));};exports[_0x08c1('0x90')]=function(_0x7f5ebb,_0x31df97,_0x16adb2){return db['CmList'][_0x08c1('0x4f')]({'where':{'id':_0x7f5ebb[_0x08c1('0x4b')]['id']}})[_0x08c1('0x2a')](handleEntityNotFound(_0x31df97,null))['then'](function(_0xe7f518){if(_0xe7f518){return _0xe7f518[_0x08c1('0x90')](_0x7f5ebb[_0x08c1('0x51')][_0x08c1('0x6b')],_['omit'](_0x7f5ebb['body'],[_0x08c1('0x6b'),'id'])||{})['spread'](function(_0x5e3c43){for(var _0x5ed4d8=0x0;_0x5ed4d8<_0x7f5ebb[_0x08c1('0x51')][_0x08c1('0x6b')][_0x08c1('0x4c')];_0x5ed4d8+=0x1){socket['emit'](_0x08c1('0x91'),{'UserId':Number(_0x7f5ebb[_0x08c1('0x51')][_0x08c1('0x6b')][_0x5ed4d8]),'CmListId':Number(_0x7f5ebb[_0x08c1('0x4b')]['id'])});}return _0x5e3c43;});}})['then'](respondWithResult(_0x31df97,null))[_0x08c1('0x49')](handleError(_0x31df97,null));};exports[_0x08c1('0x92')]=function(_0xbdcfcc,_0x132156,_0x4200f4){return db[_0x08c1('0x33')][_0x08c1('0x4f')]({'where':{'id':_0xbdcfcc[_0x08c1('0x4b')]['id']}})[_0x08c1('0x2a')](handleEntityNotFound(_0x132156,null))[_0x08c1('0x2a')](function(_0x288cc8){if(_0x288cc8){return _0x288cc8['removeAgents'](_0xbdcfcc[_0x08c1('0x39')][_0x08c1('0x6b')])[_0x08c1('0x2a')](function(){if(_[_0x08c1('0x67')](_0xbdcfcc[_0x08c1('0x39')][_0x08c1('0x6b')])){for(var _0xd61db0=0x0;_0xd61db0<_0xbdcfcc[_0x08c1('0x39')][_0x08c1('0x6b')]['length'];_0xd61db0+=0x1){socket[_0x08c1('0x93')](_0x08c1('0x94'),{'UserId':Number(_0xbdcfcc[_0x08c1('0x39')]['ids'][_0xd61db0]),'CmListId':Number(_0xbdcfcc[_0x08c1('0x4b')]['id'])});}}else{socket[_0x08c1('0x93')](_0x08c1('0x94'),{'UserId':Number(_0xbdcfcc['query'][_0x08c1('0x6b')]),'CmListId':Number(_0xbdcfcc[_0x08c1('0x4b')]['id'])});}});}})[_0x08c1('0x2a')](respondWithStatusCode(_0x132156,null))['catch'](handleError(_0x132156,null));};exports['getAgents']=function(_0x5782ec,_0x43cf34,_0x36b994){var _0x26a308={};var _0x2246d5={};var _0x2826fd;var _0xa071c0;return db[_0x08c1('0x33')]['findOne']({'where':{'id':_0x5782ec[_0x08c1('0x4b')]['id']}})[_0x08c1('0x2a')](handleEntityNotFound(_0x43cf34,null))[_0x08c1('0x2a')](function(_0xb8f856){if(_0xb8f856){_0x2826fd=_0xb8f856;_0x2246d5[_0x08c1('0x38')]=_[_0x08c1('0x3a')](db['User'][_0x08c1('0x34')]);_0x2246d5[_0x08c1('0x39')]=_['keys'](_0x5782ec[_0x08c1('0x39')]);_0x2246d5[_0x08c1('0x3b')]=_[_0x08c1('0x61')](_0x2246d5['model'],_0x2246d5[_0x08c1('0x39')]);_0x26a308[_0x08c1('0x3d')]=_['intersection'](_0x2246d5[_0x08c1('0x38')],qs[_0x08c1('0x3c')](_0x5782ec[_0x08c1('0x39')][_0x08c1('0x3c')]));_0x26a308[_0x08c1('0x3d')]=_0x26a308[_0x08c1('0x3d')][_0x08c1('0x4c')]?_0x26a308['attributes']:_0x2246d5[_0x08c1('0x38')];_0x26a308[_0x08c1('0x40')]=qs[_0x08c1('0x41')](_0x5782ec[_0x08c1('0x39')][_0x08c1('0x41')]);_0x26a308[_0x08c1('0x45')]=qs[_0x08c1('0x3b')](_[_0x08c1('0x42')](_0x5782ec['query'],_0x2246d5['filters']));if(_0x5782ec[_0x08c1('0x39')][_0x08c1('0x43')]){_0x26a308[_0x08c1('0x45')]=_[_0x08c1('0x44')](_0x26a308[_0x08c1('0x45')],{'$or':_[_0x08c1('0x32')](_0x26a308[_0x08c1('0x3d')],function(_0x10afe2){var _0x3d7a94={};_0x3d7a94[_0x10afe2]={'$like':'%'+_0x5782ec[_0x08c1('0x39')]['filter']+'%'};return _0x3d7a94;})});}_0x26a308=_[_0x08c1('0x44')]({},_0x26a308,_0x5782ec['options']);return _0x2826fd[_0x08c1('0x95')](_0x26a308);}})[_0x08c1('0x2a')](function(_0x4a40af){if(_0x4a40af){_0xa071c0=_0x4a40af[_0x08c1('0x4c')];if(!_0x5782ec[_0x08c1('0x39')]['hasOwnProperty'](_0x08c1('0x3f'))){_0x26a308[_0x08c1('0x22')]=qs[_0x08c1('0x22')](_0x5782ec['query'][_0x08c1('0x22')]);_0x26a308[_0x08c1('0x21')]=qs['offset'](_0x5782ec[_0x08c1('0x39')][_0x08c1('0x21')]);}return _0x2826fd[_0x08c1('0x95')](_0x26a308);}})[_0x08c1('0x2a')](function(_0x3faf58){if(_0x3faf58){return _0x3faf58?{'count':_0xa071c0,'rows':_0x3faf58}:null;}})[_0x08c1('0x2a')](respondWithResult(_0x43cf34,null))[_0x08c1('0x49')](handleError(_0x43cf34,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index b1f806f..bf87393 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 _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xe14b,0x93));var _0xbe14=function(_0x4e961c,_0x3a88c5){_0x4e961c=_0x4e961c-0x0;var _0xe1b347=_0xe14b[_0x4e961c];return _0xe1b347;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var CmList=require(_0xbe14('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){CmListEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);CmListEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];CmList[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('0x7')]=CmListEvents; \ No newline at end of file +var _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmList'];(function(_0x1e62c4,_0x4ece85){var _0x860429=function(_0x522a66){while(--_0x522a66){_0x1e62c4['push'](_0x1e62c4['shift']());}};_0x860429(++_0x4ece85);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var EventEmitter=require(_0x7995('0x0'));var CmList=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){CmListEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);CmListEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];CmList[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index f847b3b..a4b46d8 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 _0xaa88=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmList.attributes','CmList','cm_lists','lodash'];(function(_0x574f3b,_0x31f052){var _0x1a1b1f=function(_0x5b83c5){while(--_0x5b83c5){_0x574f3b['push'](_0x574f3b['shift']());}};_0x1a1b1f(++_0x31f052);}(_0xaa88,0x137));var _0x8aa8=function(_0x37e886,_0x17d0ad){_0x37e886=_0x37e886-0x0;var _0x57c5cd=_0xaa88[_0x37e886];return _0x57c5cd;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var logger=require(_0x8aa8('0x2'))(_0x8aa8('0x3'));var moment=require('moment');var BPromise=require(_0x8aa8('0x4'));var rp=require(_0x8aa8('0x5'));var fs=require('fs');var path=require(_0x8aa8('0x6'));var rimraf=require(_0x8aa8('0x7'));var config=require(_0x8aa8('0x8'));var attributes=require(_0x8aa8('0x9'));module['exports']=function(_0x5bda0d,_0x460042){return _0x5bda0d['define'](_0x8aa8('0xa'),attributes,{'tableName':_0x8aa8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd64b=['define','CmList','cm_lists','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x26bfb0,_0x5b0ffc){var _0x4454b3=function(_0x2e7c5f){while(--_0x2e7c5f){_0x26bfb0['push'](_0x26bfb0['shift']());}};_0x4454b3(++_0x5b0ffc);}(_0xd64b,0xc1));var _0xbd64=function(_0x53b6ae,_0x3cb9f4){_0x53b6ae=_0x53b6ae-0x0;var _0x34f4b2=_0xd64b[_0x53b6ae];return _0x34f4b2;};'use strict';var _=require(_0xbd64('0x0'));var util=require('util');var logger=require(_0xbd64('0x1'))('api');var moment=require(_0xbd64('0x2'));var BPromise=require(_0xbd64('0x3'));var rp=require(_0xbd64('0x4'));var fs=require('fs');var path=require(_0xbd64('0x5'));var rimraf=require(_0xbd64('0x6'));var config=require('../../config/environment');var attributes=require('./cmList.attributes');module['exports']=function(_0x51e87d,_0x58e9e7){return _0x51e87d[_0xbd64('0x7')](_0xbd64('0x8'),attributes,{'tableName':_0xbd64('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index b73dd36..6e118ed 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 _0x5b4a=['client','http','defaults','redis','localhost','./cmList.socket','register','then','CmList,\x20%s,\x20%s','debug','CmList,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','moment','ioredis','rpc','../../config/environment','jayson/promise'];(function(_0x5a056e,_0x382a98){var _0x5e1dab=function(_0x1059a4){while(--_0x1059a4){_0x5a056e['push'](_0x5a056e['shift']());}};_0x5e1dab(++_0x382a98);}(_0x5b4a,0x10f));var _0xa5b4=function(_0x104666,_0x5482d4){_0x104666=_0x104666-0x0;var _0x5d305a=_0x5b4a[_0x104666];return _0x5d305a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa5b4('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa5b4('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa5b4('0x2'));var config=require(_0xa5b4('0x3'));var jayson=require(_0xa5b4('0x4'));var client=jayson[_0xa5b4('0x5')][_0xa5b4('0x6')]({'port':0x232a});config['redis']=_[_0xa5b4('0x7')](config[_0xa5b4('0x8')],{'host':_0xa5b4('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa5b4('0x8')]));require(_0xa5b4('0xa'))[_0xa5b4('0xb')](socket);function respondWithRpcPromise(_0x568fea,_0x377aa6,_0x529511){return new BPromise(function(_0x37f45a,_0xaee1de){return client['request'](_0x568fea,_0x529511)[_0xa5b4('0xc')](function(_0x10bfb4){logger['info'](_0xa5b4('0xd'),_0x377aa6,'request\x20sent');logger[_0xa5b4('0xe')](_0xa5b4('0xf'),_0x377aa6,_0xa5b4('0x10'),JSON[_0xa5b4('0x11')](_0x10bfb4));if(_0x10bfb4[_0xa5b4('0x12')]){if(_0x10bfb4[_0xa5b4('0x12')][_0xa5b4('0x13')]===0x1f4){logger[_0xa5b4('0x12')]('CmList,\x20%s,\x20%s',_0x377aa6,_0x10bfb4['error'][_0xa5b4('0x14')]);return _0xaee1de(_0x10bfb4[_0xa5b4('0x12')][_0xa5b4('0x14')]);}logger['error'](_0xa5b4('0xd'),_0x377aa6,_0x10bfb4[_0xa5b4('0x12')][_0xa5b4('0x14')]);return _0x37f45a(_0x10bfb4[_0xa5b4('0x12')]['message']);}else{logger[_0xa5b4('0x15')](_0xa5b4('0xd'),_0x377aa6,_0xa5b4('0x10'));_0x37f45a(_0x10bfb4['result'][_0xa5b4('0x14')]);}})[_0xa5b4('0x16')](function(_0x15f45a){logger[_0xa5b4('0x12')]('CmList,\x20%s,\x20%s',_0x377aa6,_0x15f45a);_0xaee1de(_0x15f45a);});});} \ No newline at end of file +var _0xca72=['stringify','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xca72,0xff));var _0x2ca7=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xca72[_0x37bd26];return _0xe83dc4;};'use strict';var _=require(_0x2ca7('0x0'));var util=require(_0x2ca7('0x1'));var moment=require(_0x2ca7('0x2'));var BPromise=require(_0x2ca7('0x3'));var rs=require(_0x2ca7('0x4'));var fs=require('fs');var Redis=require(_0x2ca7('0x5'));var db=require(_0x2ca7('0x6'))['db'];var utils=require(_0x2ca7('0x7'));var logger=require(_0x2ca7('0x8'))(_0x2ca7('0x9'));var config=require('../../config/environment');var jayson=require(_0x2ca7('0xa'));var client=jayson['client'][_0x2ca7('0xb')]({'port':0x232a});config[_0x2ca7('0xc')]=_[_0x2ca7('0xd')](config[_0x2ca7('0xc')],{'host':_0x2ca7('0xe'),'port':0x18eb});var socket=require(_0x2ca7('0xf'))(new Redis(config[_0x2ca7('0xc')]));require(_0x2ca7('0x10'))[_0x2ca7('0x11')](socket);function respondWithRpcPromise(_0x4c290a,_0x202f66,_0x245973){return new BPromise(function(_0xb70d57,_0x87d0e2){return client[_0x2ca7('0x12')](_0x4c290a,_0x245973)[_0x2ca7('0x13')](function(_0x4fe552){logger[_0x2ca7('0x14')](_0x2ca7('0x15'),_0x202f66,_0x2ca7('0x16'));logger[_0x2ca7('0x17')](_0x2ca7('0x18'),_0x202f66,_0x2ca7('0x16'),JSON[_0x2ca7('0x19')](_0x4fe552));if(_0x4fe552['error']){if(_0x4fe552['error']['code']===0x1f4){logger['error'](_0x2ca7('0x15'),_0x202f66,_0x4fe552[_0x2ca7('0x1a')]['message']);return _0x87d0e2(_0x4fe552['error'][_0x2ca7('0x1b')]);}logger[_0x2ca7('0x1a')]('CmList,\x20%s,\x20%s',_0x202f66,_0x4fe552[_0x2ca7('0x1a')][_0x2ca7('0x1b')]);return _0xb70d57(_0x4fe552[_0x2ca7('0x1a')][_0x2ca7('0x1b')]);}else{logger[_0x2ca7('0x14')]('CmList,\x20%s,\x20%s',_0x202f66,_0x2ca7('0x16'));_0xb70d57(_0x4fe552['result'][_0x2ca7('0x1b')]);}})['catch'](function(_0x4c221a){logger[_0x2ca7('0x1a')](_0x2ca7('0x15'),_0x202f66,_0x4c221a);_0x87d0e2(_0x4c221a);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 93c29f0..5f7512f 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 _0x7191=['remove','removeListener','length','cmList:','save'];(function(_0x371b25,_0x224870){var _0x5588e8=function(_0x4e10b1){while(--_0x4e10b1){_0x371b25['push'](_0x371b25['shift']());}};_0x5588e8(++_0x224870);}(_0x7191,0x77));var _0x1719=function(_0xa7efcc,_0x5600bf){_0xa7efcc=_0xa7efcc-0x0;var _0x2e6497=_0x7191[_0xa7efcc];return _0x2e6497;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0x1719('0x0'),_0x1719('0x1'),'update'];function createListener(_0x40c941,_0x5b6926){return function(_0x44aceb){_0x5b6926['emit'](_0x40c941,_0x44aceb);};}function removeListener(_0x57461,_0x5ee7a0){return function(){CmListEvents[_0x1719('0x2')](_0x57461,_0x5ee7a0);};}exports['register']=function(_0x2dbe4a){for(var _0x4ee20c=0x0,_0x3a2520=events[_0x1719('0x3')];_0x4ee20c<_0x3a2520;_0x4ee20c++){var _0x32e5be=events[_0x4ee20c];var _0x14f39d=createListener(_0x1719('0x4')+_0x32e5be,_0x2dbe4a);CmListEvents['on'](_0x32e5be,_0x14f39d);}}; \ No newline at end of file +var _0x1ec2=['remove','update','emit','removeListener','length','cmList:'];(function(_0x49beea,_0x47add1){var _0x27693a=function(_0x192ed8){while(--_0x192ed8){_0x49beea['push'](_0x49beea['shift']());}};_0x27693a(++_0x47add1);}(_0x1ec2,0x84));var _0x21ec=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x1ec2[_0x46aff0];return _0x9d78cf;};'use strict';var CmListEvents=require('./cmList.events');var events=['save',_0x21ec('0x0'),_0x21ec('0x1')];function createListener(_0x5d90d3,_0x2106b1){return function(_0x20e20e){_0x2106b1[_0x21ec('0x2')](_0x5d90d3,_0x20e20e);};}function removeListener(_0x1777ea,_0x2e5260){return function(){CmListEvents[_0x21ec('0x3')](_0x1777ea,_0x2e5260);};}exports['register']=function(_0x66d2e0){for(var _0x1719d0=0x0,_0x5cacd5=events[_0x21ec('0x4')];_0x1719d0<_0x5cacd5;_0x1719d0++){var _0x48cc19=events[_0x1719d0];var _0x2b7d1e=createListener(_0x21ec('0x5')+_0x48cc19,_0x66d2e0);CmListEvents['on'](_0x48cc19,_0x2b7d1e);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index a7cff39..d45e688 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 _0xeca1=['addCustomField','/:id/users','addAgents','put','/:id','update','delete','destroy','removeDispositions','removeAgents','exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','show','/:id/dispositions','getDispositions','/:id/contacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','post','create','addDisposition','addContacts'];(function(_0x1b9cfb,_0x2c5a2b){var _0x38a552=function(_0x4b6bdc){while(--_0x4b6bdc){_0x1b9cfb['push'](_0x1b9cfb['shift']());}};_0x38a552(++_0x2c5a2b);}(_0xeca1,0xf9));var _0x1eca=function(_0x2dc961,_0x41c35e){_0x2dc961=_0x2dc961-0x0;var _0x3a194b=_0xeca1[_0x2dc961];return _0x3a194b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1eca('0x0'));var timeout=require(_0x1eca('0x1'));var express=require('express');var router=express[_0x1eca('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x1eca('0x3'));var interaction=require(_0x1eca('0x4'));var config=require(_0x1eca('0x5'));var controller=require('./cmList.controller');router['get']('/',auth[_0x1eca('0x6')](),controller[_0x1eca('0x7')]);router[_0x1eca('0x8')](_0x1eca('0x9'),auth[_0x1eca('0x6')](),controller[_0x1eca('0xa')]);router[_0x1eca('0x8')]('/:id',auth[_0x1eca('0x6')](),controller[_0x1eca('0xb')]);router[_0x1eca('0x8')](_0x1eca('0xc'),auth[_0x1eca('0x6')](),controller[_0x1eca('0xd')]);router[_0x1eca('0x8')](_0x1eca('0xe'),auth[_0x1eca('0x6')](),controller['getContacts']);router['get'](_0x1eca('0xf'),auth['isAuthenticated'](),controller[_0x1eca('0x10')]);router[_0x1eca('0x8')](_0x1eca('0x11'),auth[_0x1eca('0x6')](),controller[_0x1eca('0x12')]);router[_0x1eca('0x8')]('/:id/users',auth[_0x1eca('0x6')](),controller['getAgents']);router[_0x1eca('0x13')]('/',auth[_0x1eca('0x6')](),controller[_0x1eca('0x14')]);router['post'](_0x1eca('0xc'),auth[_0x1eca('0x6')](),controller[_0x1eca('0x15')]);router[_0x1eca('0x13')](_0x1eca('0xe'),auth[_0x1eca('0x6')](),controller[_0x1eca('0x16')]);router[_0x1eca('0x13')](_0x1eca('0x11'),auth[_0x1eca('0x6')](),controller[_0x1eca('0x17')]);router[_0x1eca('0x13')](_0x1eca('0x18'),auth['isAuthenticated'](),controller[_0x1eca('0x19')]);router[_0x1eca('0x1a')](_0x1eca('0x1b'),auth[_0x1eca('0x6')](),controller[_0x1eca('0x1c')]);router[_0x1eca('0x1d')](_0x1eca('0x1b'),auth[_0x1eca('0x6')](),controller[_0x1eca('0x1e')]);router[_0x1eca('0x1d')](_0x1eca('0xc'),auth[_0x1eca('0x6')](),controller[_0x1eca('0x1f')]);router[_0x1eca('0x1d')](_0x1eca('0x18'),auth['isAuthenticated'](),controller[_0x1eca('0x20')]);module[_0x1eca('0x21')]=router; \ No newline at end of file +var _0xa25a=['addContacts','addCustomField','addAgents','put','update','delete','removeDispositions','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/dispositions','getDispositions','/:id/contacts','getContactsCsv','/:id/fields','/:id/users','getAgents','post','addDisposition'];(function(_0x3523ff,_0x4b8413){var _0xee01c1=function(_0x4c4724){while(--_0x4c4724){_0x3523ff['push'](_0x3523ff['shift']());}};_0xee01c1(++_0x4b8413);}(_0xa25a,0x167));var _0xaa25=function(_0xc567f8,_0x5808b1){_0xc567f8=_0xc567f8-0x0;var _0x1fd906=_0xa25a[_0xc567f8];return _0x1fd906;};'use strict';var multer=require(_0xaa25('0x0'));var util=require(_0xaa25('0x1'));var path=require(_0xaa25('0x2'));var timeout=require(_0xaa25('0x3'));var express=require(_0xaa25('0x4'));var router=express[_0xaa25('0x5')]();var fs_extra=require(_0xaa25('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xaa25('0x7'));var config=require(_0xaa25('0x8'));var controller=require('./cmList.controller');router[_0xaa25('0x9')]('/',auth['isAuthenticated'](),controller[_0xaa25('0xa')]);router['get'](_0xaa25('0xb'),auth['isAuthenticated'](),controller[_0xaa25('0xc')]);router[_0xaa25('0x9')](_0xaa25('0xd'),auth[_0xaa25('0xe')](),controller[_0xaa25('0xf')]);router[_0xaa25('0x9')](_0xaa25('0x10'),auth[_0xaa25('0xe')](),controller[_0xaa25('0x11')]);router[_0xaa25('0x9')](_0xaa25('0x12'),auth[_0xaa25('0xe')](),controller['getContacts']);router['get']('/:id/contacts/csv',auth[_0xaa25('0xe')](),controller[_0xaa25('0x13')]);router[_0xaa25('0x9')](_0xaa25('0x14'),auth[_0xaa25('0xe')](),controller['getCustomFields']);router[_0xaa25('0x9')](_0xaa25('0x15'),auth[_0xaa25('0xe')](),controller[_0xaa25('0x16')]);router['post']('/',auth[_0xaa25('0xe')](),controller['create']);router[_0xaa25('0x17')]('/:id/dispositions',auth[_0xaa25('0xe')](),controller[_0xaa25('0x18')]);router['post']('/:id/contacts',auth[_0xaa25('0xe')](),controller[_0xaa25('0x19')]);router[_0xaa25('0x17')](_0xaa25('0x14'),auth[_0xaa25('0xe')](),controller[_0xaa25('0x1a')]);router['post']('/:id/users',auth[_0xaa25('0xe')](),controller[_0xaa25('0x1b')]);router[_0xaa25('0x1c')]('/:id',auth['isAuthenticated'](),controller[_0xaa25('0x1d')]);router[_0xaa25('0x1e')](_0xaa25('0xd'),auth['isAuthenticated'](),controller['destroy']);router['delete'](_0xaa25('0x10'),auth[_0xaa25('0xe')](),controller[_0xaa25('0x1f')]);router[_0xaa25('0x1e')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 5c25b09..339d9ef 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 _0x6ca0=['STRING','getDataValue','field'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x6ca0,0x118));var _0x06ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6ca0[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x12ae6c){return this[_0x06ca('0x0')](_0x06ca('0x1'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x06ca('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x06ca('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x0b92=['sequelize','STRING'];(function(_0x43d5c5,_0x26bf79){var _0x1cefb7=function(_0x404673){while(--_0x404673){_0x43d5c5['push'](_0x43d5c5['shift']());}};_0x1cefb7(++_0x26bf79);}(_0x0b92,0x144));var _0x20b9=function(_0x2e1d4d,_0x60c536){_0x2e1d4d=_0x2e1d4d-0x0;var _0x3377cc=_0x0b92[_0x2e1d4d];return _0x3377cc;};'use strict';var Sequelize=require(_0x20b9('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x3f3c71){return this['getDataValue']('field');}},'field':{'type':Sequelize[_0x20b9('0x1')],'allowNull':![]},'operator':{'type':Sequelize[_0x20b9('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x20b9('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 0ad12e8..bb7a5b8 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(_0x4b1340,_0x17159a){var _0x5c5ddf=function(_0x557bca){while(--_0x557bca){_0x4b1340['push'](_0x4b1340['shift']());}};_0x5c5ddf(++_0x17159a);}(_0x7a54,0x106));var _0x47a5=function(_0x414cbe,_0x5d1bcb){_0x414cbe=_0x414cbe-0x0;var _0x9fe6b1=_0x7a54[_0x414cbe];return _0x9fe6b1;};'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(_0x4a8f80,_0x41a45){var _0x43b68d=function(_0xf92e67){while(--_0xf92e67){_0x4a8f80['push'](_0x4a8f80['shift']());}};_0x43b68d(++_0x41a45);}(_0x7a54,0x106));var _0x47a5=function(_0x5765a0,_0x3beeb1){_0x5765a0=_0x5765a0-0x0;var _0x924188=_0x7a54[_0x5765a0];return _0x924188;};'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 3ca8293..25282c1 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 _0xfde9=['rimraf','../../config/environment','./condition.attributes','define','Condition','tools_conditions','api','moment','bluebird','request-promise'];(function(_0x5333ba,_0x22e1bb){var _0x20f9dc=function(_0x1956af){while(--_0x1956af){_0x5333ba['push'](_0x5333ba['shift']());}};_0x20f9dc(++_0x22e1bb);}(_0xfde9,0x6a));var _0x9fde=function(_0x4a9beb,_0x159482){_0x4a9beb=_0x4a9beb-0x0;var _0x2d4c58=_0xfde9[_0x4a9beb];return _0x2d4c58;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x9fde('0x0'));var moment=require(_0x9fde('0x1'));var BPromise=require(_0x9fde('0x2'));var rp=require(_0x9fde('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9fde('0x4'));var config=require(_0x9fde('0x5'));var attributes=require(_0x9fde('0x6'));module['exports']=function(_0x155500,_0x224122){return _0x155500[_0x9fde('0x7')](_0x9fde('0x8'),attributes,{'tableName':_0x9fde('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x69d0=['api','bluebird','request-promise','path','rimraf','../../config/environment','./condition.attributes','exports','Condition','tools_conditions','lodash','../../config/logger'];(function(_0x828619,_0x5ff8ce){var _0x317b46=function(_0x1a0077){while(--_0x1a0077){_0x828619['push'](_0x828619['shift']());}};_0x317b46(++_0x5ff8ce);}(_0x69d0,0x1c6));var _0x069d=function(_0x42812c,_0x483d03){_0x42812c=_0x42812c-0x0;var _0x2085d9=_0x69d0[_0x42812c];return _0x2085d9;};'use strict';var _=require(_0x069d('0x0'));var util=require('util');var logger=require(_0x069d('0x1'))(_0x069d('0x2'));var moment=require('moment');var BPromise=require(_0x069d('0x3'));var rp=require(_0x069d('0x4'));var fs=require('fs');var path=require(_0x069d('0x5'));var rimraf=require(_0x069d('0x6'));var config=require(_0x069d('0x7'));var attributes=require(_0x069d('0x8'));module[_0x069d('0x9')]=function(_0x509b74,_0x1dd65c){return _0x509b74['define'](_0x069d('0xa'),attributes,{'tableName':_0x069d('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 535b053..0507c9b 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 _0x94e0=['rpc','../../config/environment','jayson/promise','client','http','request','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x5ad771,_0x34186f){var _0x5b5dce=function(_0x5ad0fb){while(--_0x5ad0fb){_0x5ad771['push'](_0x5ad771['shift']());}};_0x5b5dce(++_0x34186f);}(_0x94e0,0x1b1));var _0x094e=function(_0x582f72,_0x886d8){_0x582f72=_0x582f72-0x0;var _0x4cd5fe=_0x94e0[_0x582f72];return _0x4cd5fe;};'use strict';var _=require(_0x094e('0x0'));var util=require(_0x094e('0x1'));var moment=require(_0x094e('0x2'));var BPromise=require(_0x094e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x094e('0x4'));var db=require(_0x094e('0x5'))['db'];var utils=require(_0x094e('0x6'));var logger=require('../../config/logger')(_0x094e('0x7'));var config=require(_0x094e('0x8'));var jayson=require(_0x094e('0x9'));var client=jayson[_0x094e('0xa')][_0x094e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f2c4d,_0x333070,_0x5d0c7b){return new BPromise(function(_0x408bb3,_0x50eabb){return client[_0x094e('0xc')](_0x4f2c4d,_0x5d0c7b)['then'](function(_0x1e38ae){logger[_0x094e('0xd')](_0x094e('0xe'),_0x333070,_0x094e('0xf'));logger[_0x094e('0x10')](_0x094e('0x11'),_0x333070,'request\x20sent',JSON[_0x094e('0x12')](_0x1e38ae));if(_0x1e38ae[_0x094e('0x13')]){if(_0x1e38ae[_0x094e('0x13')]['code']===0x1f4){logger['error'](_0x094e('0xe'),_0x333070,_0x1e38ae[_0x094e('0x13')][_0x094e('0x14')]);return _0x50eabb(_0x1e38ae[_0x094e('0x13')][_0x094e('0x14')]);}logger[_0x094e('0x13')](_0x094e('0xe'),_0x333070,_0x1e38ae[_0x094e('0x13')][_0x094e('0x14')]);return _0x408bb3(_0x1e38ae[_0x094e('0x13')][_0x094e('0x14')]);}else{logger[_0x094e('0xd')](_0x094e('0xe'),_0x333070,_0x094e('0xf'));_0x408bb3(_0x1e38ae['result']['message']);}})[_0x094e('0x15')](function(_0x5d7718){logger[_0x094e('0x13')](_0x094e('0xe'),_0x333070,_0x5d7718);_0x50eabb(_0x5d7718);});});} \ No newline at end of file +var _0x730b=['stringify','error','code','Condition,\x20%s,\x20%s','message','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','request\x20sent','debug'];(function(_0x1bd0c4,_0x2405e0){var _0x13a3af=function(_0xe18df9){while(--_0xe18df9){_0x1bd0c4['push'](_0x1bd0c4['shift']());}};_0x13a3af(++_0x2405e0);}(_0x730b,0x141));var _0xb730=function(_0x4c651e,_0x794ccd){_0x4c651e=_0x4c651e-0x0;var _0x56b51d=_0x730b[_0x4c651e];return _0x56b51d;};'use strict';var _=require(_0xb730('0x0'));var util=require(_0xb730('0x1'));var moment=require(_0xb730('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb730('0x3'));var db=require(_0xb730('0x4'))['db'];var utils=require(_0xb730('0x5'));var logger=require(_0xb730('0x6'))(_0xb730('0x7'));var config=require('../../config/environment');var jayson=require(_0xb730('0x8'));var client=jayson[_0xb730('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5ef248,_0x4e839f,_0x53dfe5){return new BPromise(function(_0x126025,_0x200e70){return client[_0xb730('0xa')](_0x5ef248,_0x53dfe5)[_0xb730('0xb')](function(_0x5affac){logger[_0xb730('0xc')]('Condition,\x20%s,\x20%s',_0x4e839f,_0xb730('0xd'));logger[_0xb730('0xe')]('Condition,\x20%s,\x20%s,\x20%s',_0x4e839f,'request\x20sent',JSON[_0xb730('0xf')](_0x5affac));if(_0x5affac['error']){if(_0x5affac[_0xb730('0x10')][_0xb730('0x11')]===0x1f4){logger[_0xb730('0x10')](_0xb730('0x12'),_0x4e839f,_0x5affac[_0xb730('0x10')][_0xb730('0x13')]);return _0x200e70(_0x5affac[_0xb730('0x10')][_0xb730('0x13')]);}logger['error'](_0xb730('0x12'),_0x4e839f,_0x5affac[_0xb730('0x10')][_0xb730('0x13')]);return _0x126025(_0x5affac[_0xb730('0x10')][_0xb730('0x13')]);}else{logger[_0xb730('0xc')](_0xb730('0x12'),_0x4e839f,_0xb730('0xd'));_0x126025(_0x5affac[_0xb730('0x14')][_0xb730('0x13')]);}})['catch'](function(_0x2259e6){logger[_0xb730('0x10')](_0xb730('0x12'),_0x4e839f,_0x2259e6);_0x200e70(_0x2259e6);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 729a289..25f2ea5 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 _0x07c5=['/:id','isAuthenticated','delete','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./condition.controller','put'];(function(_0x35850c,_0x21a2c4){var _0x1d9249=function(_0x245e05){while(--_0x245e05){_0x35850c['push'](_0x35850c['shift']());}};_0x1d9249(++_0x21a2c4);}(_0x07c5,0x154));var _0x507c=function(_0x280bec,_0x3af2cd){_0x280bec=_0x280bec-0x0;var _0x2db8e6=_0x07c5[_0x280bec];return _0x2db8e6;};'use strict';var multer=require('multer');var util=require(_0x507c('0x0'));var path=require('path');var timeout=require(_0x507c('0x1'));var express=require(_0x507c('0x2'));var router=express['Router']();var fs_extra=require(_0x507c('0x3'));var auth=require(_0x507c('0x4'));var interaction=require(_0x507c('0x5'));var config=require('../../config/environment');var controller=require(_0x507c('0x6'));router[_0x507c('0x7')](_0x507c('0x8'),auth[_0x507c('0x9')](),controller['update']);router[_0x507c('0xa')](_0x507c('0x8'),auth[_0x507c('0x9')](),controller['destroy']);module[_0x507c('0xb')]=router; \ No newline at end of file +var _0xc222=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','isAuthenticated','delete','destroy','multer','util','path'];(function(_0xcc26d2,_0x20c921){var _0x3841e2=function(_0x1ba4ea){while(--_0x1ba4ea){_0xcc26d2['push'](_0xcc26d2['shift']());}};_0x3841e2(++_0x20c921);}(_0xc222,0xed));var _0x2c22=function(_0x249bd5,_0xb7b053){_0x249bd5=_0x249bd5-0x0;var _0x36d12f=_0xc222[_0x249bd5];return _0x36d12f;};'use strict';var multer=require(_0x2c22('0x0'));var util=require(_0x2c22('0x1'));var path=require(_0x2c22('0x2'));var timeout=require(_0x2c22('0x3'));var express=require(_0x2c22('0x4'));var router=express[_0x2c22('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x2c22('0x6'));var interaction=require(_0x2c22('0x7'));var config=require(_0x2c22('0x8'));var controller=require(_0x2c22('0x9'));router[_0x2c22('0xa')](_0x2c22('0xb'),auth[_0x2c22('0xc')](),controller['update']);router[_0x2c22('0xd')](_0x2c22('0xb'),auth[_0x2c22('0xc')](),controller[_0x2c22('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index a77e9f8..6f911fc 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 _0x757a=['exports','STRING'];(function(_0x4c3739,_0x20c75f){var _0xec073b=function(_0x2b3a3d){while(--_0x2b3a3d){_0x4c3739['push'](_0x4c3739['shift']());}};_0xec073b(++_0x20c75f);}(_0x757a,0xde));var _0xa757=function(_0x831915,_0x1b4c5f){_0x831915=_0x831915-0x0;var _0x16cb05=_0x757a[_0x831915];return _0x16cb05;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe706=['STRING','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe706,0xa3));var _0x6e70=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xe706[_0x173d7e];return _0x2220d6;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'name':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x6e70('0x2')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 7dafde6..1183265 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 _0x34c7=['web-report','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','order','getItems','eml-format','rimraf','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./dashboard.socket','register','sendStatus','status','json','limit','undefined','count','offset','reject','update','then','destroy','get','CustomDashboards','UserProfileResource','end','stack','name','send','index','map','Dashboard','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','sort','where','filters','pick','filter','type','options','include','findAll','catch','show','params','length','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','clone','includeAll','updatedAt','createdAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrMetric','attrVoiceQueues','attrFontSize','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3'];(function(_0x5324a0,_0x44cdc2){var _0x413e16=function(_0x19840b){while(--_0x19840b){_0x5324a0['push'](_0x5324a0['shift']());}};_0x413e16(++_0x44cdc2);}(_0x34c7,0xf8));var _0x734c=function(_0x33651d,_0x93a579){_0x33651d=_0x33651d-0x0;var _0x355d78=_0x34c7[_0x33651d];return _0x355d78;};'use strict';var emlformat=require(_0x734c('0x0'));var rimraf=require(_0x734c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x734c('0x2'));var rp=require('request-promise');var moment=require(_0x734c('0x3'));var BPromise=require(_0x734c('0x4'));var Mustache=require('mustache');var util=require(_0x734c('0x5'));var path=require('path');var sox=require(_0x734c('0x6'));var csv=require(_0x734c('0x7'));var ejs=require(_0x734c('0x8'));var fs=require('fs');var fs_extra=require(_0x734c('0x9'));var _=require('lodash');var squel=require(_0x734c('0xa'));var crypto=require(_0x734c('0xb'));var jsforce=require(_0x734c('0xc'));var deskjs=require(_0x734c('0xd'));var toCsv=require(_0x734c('0x7'));var querystring=require(_0x734c('0xe'));var Papa=require(_0x734c('0xf'));var Redis=require(_0x734c('0x10'));var authService=require(_0x734c('0x11'));var qs=require(_0x734c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x734c('0x13'));var logger=require(_0x734c('0x14'))('api');var utils=require(_0x734c('0x15'));var config=require(_0x734c('0x16'));var licenseUtil=require(_0x734c('0x17'));var db=require(_0x734c('0x18'))['db'];config['redis']=_[_0x734c('0x19')](config[_0x734c('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x734c('0x1b'))(new Redis(config[_0x734c('0x1a')]));require(_0x734c('0x1c'))[_0x734c('0x1d')](socket);function respondWithStatusCode(_0x37eb69,_0x2f9d04){_0x2f9d04=_0x2f9d04||0xcc;return function(_0x594267){if(_0x594267){return _0x37eb69[_0x734c('0x1e')](_0x2f9d04);}return _0x37eb69[_0x734c('0x1f')](_0x2f9d04)['end']();};}function respondWithResult(_0x271428,_0x4ba727){_0x4ba727=_0x4ba727||0xc8;return function(_0x16da0a){if(_0x16da0a){return _0x271428[_0x734c('0x1f')](_0x4ba727)[_0x734c('0x20')](_0x16da0a);}};}function respondWithFilteredResult(_0x329d71,_0x2bbf9f){return function(_0x13551d){if(_0x13551d){var _0x158c56=typeof _0x2bbf9f['offset']==='undefined'&&typeof _0x2bbf9f[_0x734c('0x21')]===_0x734c('0x22');var _0x2e06d2=_0x13551d[_0x734c('0x23')];var _0x608e26=_0x158c56?0x0:_0x2bbf9f['offset'];var _0x510ae1=_0x158c56?_0x13551d['count']:_0x2bbf9f[_0x734c('0x24')]+_0x2bbf9f['limit'];var _0x537f11;if(_0x510ae1>=_0x2e06d2){_0x510ae1=_0x2e06d2;_0x537f11=0xc8;}else{_0x537f11=0xce;}_0x329d71['status'](_0x537f11);return _0x329d71['set']('Content-Range',_0x608e26+'-'+_0x510ae1+'/'+_0x2e06d2)[_0x734c('0x20')](_0x13551d);}return null;};}function patchUpdates(_0x35db4e){return function(_0x30e6cb){try{jsonpatch['apply'](_0x30e6cb,_0x35db4e,!![]);}catch(_0x465e9c){return BPromise[_0x734c('0x25')](_0x465e9c);}return _0x30e6cb['save']();};}function saveUpdates(_0x44c4d5,_0x14855e){return function(_0x389f54){if(_0x389f54){return _0x389f54[_0x734c('0x26')](_0x44c4d5)[_0x734c('0x27')](function(_0x535acd){return _0x535acd;});}return null;};}function removeEntity(_0x1df8b2,_0x3a9450){return function(_0x203833){if(_0x203833){return _0x203833[_0x734c('0x28')]()[_0x734c('0x27')](function(){var _0x56c83f=_0x203833[_0x734c('0x29')]({'plain':!![]});var _0x9c9e08=_0x734c('0x2a');return db[_0x734c('0x2b')]['destroy']({'where':{'type':_0x9c9e08,'resourceId':_0x56c83f['id']}})[_0x734c('0x27')](function(){return _0x203833;});})[_0x734c('0x27')](function(){_0x1df8b2[_0x734c('0x1f')](0xcc)[_0x734c('0x2c')]();});}};}function handleEntityNotFound(_0x461978,_0x44ca8b){return function(_0x467b1a){if(!_0x467b1a){_0x461978[_0x734c('0x1e')](0x194);}return _0x467b1a;};}function handleError(_0x47c50b,_0x241ee0){_0x241ee0=_0x241ee0||0x1f4;return function(_0x16b08d){logger['error'](_0x16b08d[_0x734c('0x2d')]);if(_0x16b08d['name']){delete _0x16b08d[_0x734c('0x2e')];}_0x47c50b[_0x734c('0x1f')](_0x241ee0)[_0x734c('0x2f')](_0x16b08d);};}exports[_0x734c('0x30')]=function(_0x9a2530,_0x39bcac){var _0x5dc62f={},_0x3a264c={},_0x385308={'count':0x0,'rows':[]};var _0x518c05=_[_0x734c('0x31')](db[_0x734c('0x32')][_0x734c('0x33')],function(_0x20dda4){return{'name':_0x20dda4[_0x734c('0x34')],'type':_0x20dda4['type'][_0x734c('0x35')]};});_0x3a264c[_0x734c('0x36')]=_[_0x734c('0x31')](_0x518c05,'name');_0x3a264c[_0x734c('0x37')]=_[_0x734c('0x38')](_0x9a2530[_0x734c('0x37')]);_0x3a264c['filters']=_['intersection'](_0x3a264c[_0x734c('0x36')],_0x3a264c[_0x734c('0x37')]);_0x5dc62f['attributes']=_[_0x734c('0x39')](_0x3a264c[_0x734c('0x36')],qs[_0x734c('0x3a')](_0x9a2530['query'][_0x734c('0x3a')]));_0x5dc62f[_0x734c('0x3b')]=_0x5dc62f['attributes']['length']?_0x5dc62f[_0x734c('0x3b')]:_0x3a264c[_0x734c('0x36')];if(!_0x9a2530[_0x734c('0x37')][_0x734c('0x3c')]('nolimit')){_0x5dc62f[_0x734c('0x21')]=qs['limit'](_0x9a2530[_0x734c('0x37')]['limit']);_0x5dc62f[_0x734c('0x24')]=qs[_0x734c('0x24')](_0x9a2530['query'][_0x734c('0x24')]);}_0x5dc62f['order']=qs['sort'](_0x9a2530[_0x734c('0x37')][_0x734c('0x3d')]);_0x5dc62f[_0x734c('0x3e')]=qs[_0x734c('0x3f')](_[_0x734c('0x40')](_0x9a2530[_0x734c('0x37')],_0x3a264c[_0x734c('0x3f')]),_0x518c05);if(_0x9a2530[_0x734c('0x37')][_0x734c('0x41')]){_0x5dc62f['where']=_['merge'](_0x5dc62f['where'],{'$or':_[_0x734c('0x31')](_0x518c05,function(_0x46d1f4){if(_0x46d1f4[_0x734c('0x42')]!=='VIRTUAL'){var _0x1bc6a6={};_0x1bc6a6[_0x46d1f4[_0x734c('0x2e')]]={'$like':'%'+_0x9a2530['query'][_0x734c('0x41')]+'%'};return _0x1bc6a6;}})});}_0x5dc62f=_['merge']({},_0x5dc62f,_0x9a2530[_0x734c('0x43')]);var _0x3521cb={'where':_0x5dc62f['where']};return db[_0x734c('0x32')]['count'](_0x3521cb)['then'](function(_0x33432f){_0x385308['count']=_0x33432f;if(_0x9a2530[_0x734c('0x37')]['includeAll']){_0x5dc62f[_0x734c('0x44')]=[{'all':!![]}];}return db[_0x734c('0x32')][_0x734c('0x45')](_0x5dc62f);})['then'](function(_0x1add8e){_0x385308['rows']=_0x1add8e;return _0x385308;})[_0x734c('0x27')](respondWithFilteredResult(_0x39bcac,_0x5dc62f))[_0x734c('0x46')](handleError(_0x39bcac,null));};exports[_0x734c('0x47')]=function(_0x4696eb,_0x2465c3){var _0x290d27={'raw':![],'where':{'id':_0x4696eb[_0x734c('0x48')]['id']}},_0xf95702={};_0xf95702[_0x734c('0x36')]=_[_0x734c('0x38')](db['Dashboard'][_0x734c('0x33')]);_0xf95702[_0x734c('0x37')]=_[_0x734c('0x38')](_0x4696eb[_0x734c('0x37')]);_0xf95702['filters']=_[_0x734c('0x39')](_0xf95702[_0x734c('0x36')],_0xf95702[_0x734c('0x37')]);_0x290d27['attributes']=_[_0x734c('0x39')](_0xf95702['model'],qs['fields'](_0x4696eb['query'][_0x734c('0x3a')]));_0x290d27['attributes']=_0x290d27['attributes'][_0x734c('0x49')]?_0x290d27[_0x734c('0x3b')]:_0xf95702[_0x734c('0x36')];if(_0x4696eb[_0x734c('0x37')]['includeAll']){_0x290d27['include']=[{'all':!![]}];}_0x290d27=_[_0x734c('0x4a')]({},_0x290d27,_0x4696eb[_0x734c('0x43')]);return db[_0x734c('0x32')][_0x734c('0x4b')](_0x290d27)['then'](handleEntityNotFound(_0x2465c3,null))[_0x734c('0x27')](respondWithResult(_0x2465c3,null))['catch'](handleError(_0x2465c3,null));};exports[_0x734c('0x4c')]=function(_0x22bc13,_0x237d3e){return db['Dashboard'][_0x734c('0x4c')](_0x22bc13[_0x734c('0x4d')],{})['then'](function(_0x1d0e7e){var _0x3ca1bf=_0x22bc13[_0x734c('0x4e')][_0x734c('0x29')]({'plain':!![]});if(!_0x3ca1bf)throw new Error(_0x734c('0x4f'));if(_0x3ca1bf[_0x734c('0x50')]==='user'){var _0x190746=_0x1d0e7e['get']({'plain':!![]});var _0x589309='CustomDashboards';return db[_0x734c('0x51')][_0x734c('0x4b')]({'where':{'name':_0x589309,'userProfileId':_0x3ca1bf[_0x734c('0x52')]},'raw':!![]})[_0x734c('0x27')](function(_0xdb8ca2){if(_0xdb8ca2&&_0xdb8ca2[_0x734c('0x53')]===0x0){return db[_0x734c('0x2b')][_0x734c('0x4c')]({'name':_0x190746[_0x734c('0x2e')],'resourceId':_0x190746['id'],'type':_0xdb8ca2[_0x734c('0x2e')],'sectionId':_0xdb8ca2['id']},{})[_0x734c('0x27')](function(){return _0x1d0e7e;});}else{return _0x1d0e7e;}})[_0x734c('0x46')](function(_0xc07ee8){logger[_0x734c('0x54')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xc07ee8);throw _0xc07ee8;});}return _0x1d0e7e;})['then'](respondWithResult(_0x237d3e,0xc9))[_0x734c('0x46')](handleError(_0x237d3e,null));};exports[_0x734c('0x55')]=function(_0x16cdb6,_0x252511){var _0x2eb00f={'where':{'id':_0x16cdb6[_0x734c('0x48')]['id']}},_0x351c37={};_0x351c37[_0x734c('0x36')]=_[_0x734c('0x38')](db['Dashboard'][_0x734c('0x33')]);_0x2eb00f[_0x734c('0x3b')]=_['intersection'](_0x351c37[_0x734c('0x36')],qs[_0x734c('0x3a')](_0x16cdb6[_0x734c('0x37')]['fields']));_0x2eb00f[_0x734c('0x3b')]=_0x2eb00f[_0x734c('0x3b')]['length']?_0x2eb00f['attributes']:_0x351c37[_0x734c('0x36')];if(_0x16cdb6[_0x734c('0x37')][_0x734c('0x56')]){_0x2eb00f['include']=[{'all':!![]}];}_0x2eb00f=_[_0x734c('0x4a')]({},_0x2eb00f,_0x16cdb6[_0x734c('0x43')]);return db[_0x734c('0x32')][_0x734c('0x4b')](_0x2eb00f)[_0x734c('0x27')](handleEntityNotFound(_0x252511,null))[_0x734c('0x27')](function(_0x1e6286){if(_0x1e6286){var _0x3a637a=_0x1e6286['get']({'plain':!![]});_0x3a637a=qs['omit'](_0x3a637a,['id','createdAt',_0x734c('0x57')]);_0x16cdb6[_0x734c('0x4d')]=_['omit'](_0x16cdb6['body'],['id',_0x734c('0x58'),_0x734c('0x57')]);return db[_0x734c('0x32')][_0x734c('0x4c')](_[_0x734c('0x4a')](_0x3a637a,_0x16cdb6[_0x734c('0x4d')]),{'include':_0x16cdb6['query'][_0x734c('0x56')]?[{'all':!![]}]:undefined})[_0x734c('0x27')](function(_0xc53ac8){var _0x5c7a8d=_0x16cdb6[_0x734c('0x4e')][_0x734c('0x29')]({'plain':!![]});if(!_0x5c7a8d)throw new Error(_0x734c('0x4f'));if(_0x5c7a8d['role']===_0x734c('0x4e')){var _0x54dc52=_0xc53ac8['get']({'plain':!![]});var _0x1bd466=_0x734c('0x2a');return db['UserProfileSection'][_0x734c('0x4b')]({'where':{'name':_0x1bd466,'userProfileId':_0x5c7a8d[_0x734c('0x52')]},'raw':!![]})[_0x734c('0x27')](function(_0x264a18){if(_0x264a18&&_0x264a18[_0x734c('0x53')]===0x0){return db[_0x734c('0x2b')][_0x734c('0x4c')]({'name':_0x54dc52[_0x734c('0x2e')],'resourceId':_0x54dc52['id'],'type':_0x264a18[_0x734c('0x2e')],'sectionId':_0x264a18['id']},{})[_0x734c('0x27')](function(){return _0xc53ac8;});}else{return _0xc53ac8;}})[_0x734c('0x46')](function(_0x24069f){logger['error'](_0x734c('0x59'),_0x24069f);throw _0x24069f;});}return _0xc53ac8;});}})['then'](respondWithResult(_0x252511,0xc9))[_0x734c('0x46')](handleError(_0x252511,null));};exports[_0x734c('0x26')]=function(_0x476078,_0x82bb81){if(_0x476078[_0x734c('0x4d')]['id']){delete _0x476078[_0x734c('0x4d')]['id'];}return db['Dashboard'][_0x734c('0x4b')]({'where':{'id':_0x476078['params']['id']}})['then'](handleEntityNotFound(_0x82bb81,null))[_0x734c('0x27')](saveUpdates(_0x476078[_0x734c('0x4d')],null))['then'](respondWithResult(_0x82bb81,null))[_0x734c('0x46')](handleError(_0x82bb81,null));};exports['destroy']=function(_0x142ece,_0x161b03){return db[_0x734c('0x32')]['find']({'where':{'id':_0x142ece['params']['id']}})[_0x734c('0x27')](handleEntityNotFound(_0x161b03,null))[_0x734c('0x27')](removeEntity(_0x161b03,null))[_0x734c('0x46')](handleError(_0x161b03,null));};function widgetAttributes(_0x47bc60){try{switch(_0x47bc60['type']){case _0x734c('0x5a'):return[{'name':_0x734c('0x5b'),'value':_0x47bc60['attrUrl']||(_0x47bc60[_0x734c('0x5c')]&&_0x47bc60[_0x734c('0x5c')][0x0]?_0x47bc60[_0x734c('0x5c')][0x0][_0x734c('0x5d')]:undefined)||'https://'}];case _0x734c('0x5e'):return[{'name':_0x734c('0x5f'),'value':_0x47bc60[_0x734c('0x5f')]||(_0x47bc60['attrs']&&_0x47bc60[_0x734c('0x5c')][0x0]?_0x47bc60[_0x734c('0x5c')][0x0][_0x734c('0x5d')]:undefined)||''}];case _0x734c('0x60'):return[{'name':'attrHourFormat','value':_0x47bc60[_0x734c('0x61')]||(_0x47bc60['attrs']&&_0x47bc60[_0x734c('0x5c')][0x0]?_0x47bc60[_0x734c('0x5c')][0x0][_0x734c('0x5d')]:undefined)||'HH:mm:ss'},{'name':_0x734c('0x62'),'value':_0x47bc60[_0x734c('0x62')]||(_0x47bc60[_0x734c('0x5c')]&&_0x47bc60[_0x734c('0x5c')][0x1]?_0x47bc60[_0x734c('0x5c')][0x1][_0x734c('0x5d')]:undefined)||_0x734c('0x63')},{'name':'attrFontSize','value':_0x47bc60['attrFontSize']||(_0x47bc60[_0x734c('0x5c')]&&_0x47bc60[_0x734c('0x5c')][0x2]?_0x47bc60[_0x734c('0x5c')][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0x734c('0x64'),'value':_0x47bc60[_0x734c('0x64')]||(_0x47bc60[_0x734c('0x5c')]&&_0x47bc60[_0x734c('0x5c')][0x0]?_0x47bc60[_0x734c('0x5c')][0x0]['value']:undefined)||'total'},{'name':_0x734c('0x65'),'value':_0x47bc60[_0x734c('0x65')]||(_0x47bc60[_0x734c('0x5c')]&&_0x47bc60[_0x734c('0x5c')][0x1]?_0x47bc60[_0x734c('0x5c')][0x1][_0x734c('0x5d')]:undefined)||[]},{'name':_0x734c('0x66'),'value':_0x47bc60[_0x734c('0x66')]||(_0x47bc60[_0x734c('0x5c')]&&_0x47bc60[_0x734c('0x5c')][0x2]?_0x47bc60[_0x734c('0x5c')][0x2][_0x734c('0x5d')]:undefined)||0x14}];case _0x734c('0x67'):case _0x734c('0x68'):return[{'name':'attrSerie1','value':_0x47bc60[_0x734c('0x69')]||(_0x47bc60[_0x734c('0x5c')]&&_0x47bc60[_0x734c('0x5c')][0x0]?_0x47bc60[_0x734c('0x5c')][0x0][_0x734c('0x5d')]:undefined)||_0x734c('0x6a')},{'name':_0x734c('0x6b'),'value':_0x47bc60['attrSerie2']||(_0x47bc60[_0x734c('0x5c')]&&_0x47bc60['attrs'][0x1]?_0x47bc60[_0x734c('0x5c')][0x1][_0x734c('0x5d')]:undefined)||null},{'name':_0x734c('0x6c'),'value':_0x47bc60[_0x734c('0x6c')]||(_0x47bc60[_0x734c('0x5c')]&&_0x47bc60['attrs'][0x2]?_0x47bc60['attrs'][0x2]['value']:undefined)||null},{'name':_0x734c('0x65'),'value':_0x47bc60['attrVoiceQueues']||(_0x47bc60[_0x734c('0x5c')]&&_0x47bc60[_0x734c('0x5c')][0x3]?_0x47bc60[_0x734c('0x5c')][0x3][_0x734c('0x5d')]:undefined)||[]}];case _0x734c('0x6d'):return[{'name':'attrReport','type':_0x47bc60[_0x734c('0x6e')]||(_0x47bc60['attrs']&&_0x47bc60[_0x734c('0x5c')][0x0]?_0x47bc60['attrs'][0x0][_0x734c('0x42')]:undefined)||null,'value':_0x47bc60['attrReport']||(_0x47bc60['attrs']&&_0x47bc60[_0x734c('0x5c')][0x0]?_0x47bc60[_0x734c('0x5c')][0x0][_0x734c('0x5d')]:undefined)||null},{'name':_0x734c('0x6f'),'value':_0x47bc60[_0x734c('0x6f')]||(_0x47bc60[_0x734c('0x5c')]&&_0x47bc60['attrs'][0x1]?_0x47bc60[_0x734c('0x5c')][0x1][_0x734c('0x5d')]:undefined)||0x0}];default:return[];}}catch(_0x2403a2){logger[_0x734c('0x54')](_0x734c('0x70'),JSON[_0x734c('0x71')](_0x2403a2));return[];}}exports[_0x734c('0x72')]=function(_0x26732c,_0xd6ff5c,_0xb14696){if(_0x26732c[_0x734c('0x4d')]['id']){delete _0x26732c[_0x734c('0x4d')]['id'];}return db[_0x734c('0x32')]['find']({'where':{'id':_0x26732c[_0x734c('0x48')]['id']}})[_0x734c('0x27')](handleEntityNotFound(_0xd6ff5c,null))[_0x734c('0x27')](function(_0xf0d77e){if(_0xf0d77e){_0x26732c[_0x734c('0x4d')][_0x734c('0x73')]=_0xf0d77e['id'];_0x26732c[_0x734c('0x4d')][_0x734c('0x5c')]=widgetAttributes(_0x26732c[_0x734c('0x4d')]);return db['DashboardItem'][_0x734c('0x4c')](_0x26732c[_0x734c('0x4d')]);}})[_0x734c('0x27')](respondWithResult(_0xd6ff5c,null))['catch'](handleError(_0xd6ff5c,null));};exports['getItems']=function(_0x3ce13d,_0x2aee52,_0x1012a0){var _0xdd4243={};var _0x3c0538={};var _0x3867ce;var _0x71e4d7;return db[_0x734c('0x32')]['findOne']({'where':{'id':_0x3ce13d[_0x734c('0x48')]['id']}})[_0x734c('0x27')](handleEntityNotFound(_0x2aee52,null))[_0x734c('0x27')](function(_0x11ee1a){if(_0x11ee1a){_0x3867ce=_0x11ee1a;_0x3c0538[_0x734c('0x36')]=_['keys'](db[_0x734c('0x74')][_0x734c('0x33')]);_0x3c0538[_0x734c('0x37')]=_[_0x734c('0x38')](_0x3ce13d[_0x734c('0x37')]);_0x3c0538[_0x734c('0x3f')]=_['intersection'](_0x3c0538[_0x734c('0x36')],_0x3c0538[_0x734c('0x37')]);_0xdd4243['attributes']=_[_0x734c('0x39')](_0x3c0538[_0x734c('0x36')],qs[_0x734c('0x3a')](_0x3ce13d[_0x734c('0x37')][_0x734c('0x3a')]));_0xdd4243[_0x734c('0x3b')]=_0xdd4243[_0x734c('0x3b')][_0x734c('0x49')]?_0xdd4243['attributes']:_0x3c0538[_0x734c('0x36')];_0xdd4243[_0x734c('0x75')]=qs[_0x734c('0x3d')](_0x3ce13d[_0x734c('0x37')][_0x734c('0x3d')]);_0xdd4243['where']=qs[_0x734c('0x3f')](_[_0x734c('0x40')](_0x3ce13d[_0x734c('0x37')],_0x3c0538['filters']));if(_0x3ce13d[_0x734c('0x37')][_0x734c('0x41')]){_0xdd4243[_0x734c('0x3e')]=_[_0x734c('0x4a')](_0xdd4243[_0x734c('0x3e')],{'$or':_[_0x734c('0x31')](_0xdd4243[_0x734c('0x3b')],function(_0x505cee){var _0x105a15={};_0x105a15[_0x505cee]={'$like':'%'+_0x3ce13d[_0x734c('0x37')][_0x734c('0x41')]+'%'};return _0x105a15;})});}_0xdd4243=_[_0x734c('0x4a')]({},_0xdd4243,_0x3ce13d['options']);return _0x3867ce['getItems'](_0xdd4243);}})[_0x734c('0x27')](function(_0x52e4f4){if(_0x52e4f4){_0x71e4d7=_0x52e4f4[_0x734c('0x49')];if(!_0x3ce13d[_0x734c('0x37')][_0x734c('0x3c')]('nolimit')){_0xdd4243[_0x734c('0x21')]=qs[_0x734c('0x21')](_0x3ce13d[_0x734c('0x37')]['limit']);_0xdd4243['offset']=qs[_0x734c('0x24')](_0x3ce13d['query'][_0x734c('0x24')]);}return _0x3867ce[_0x734c('0x76')](_0xdd4243);}})[_0x734c('0x27')](function(_0xb5a7d0){if(_0xb5a7d0){return _0xb5a7d0?{'count':_0x71e4d7,'rows':_0xb5a7d0}:null;}})['then'](respondWithResult(_0x2aee52,null))[_0x734c('0x46')](handleError(_0x2aee52,null));}; \ No newline at end of file +var _0xeccc=['nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','keys','fields','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','body','omit','createdAt','updatedAt','attrUrl','attrs','https://','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','map','hasOwnProperty','rimraf','zip-dir','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/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','limit','undefined','offset','set','Content-Range','apply','reject','save','update','then','destroy','CustomDashboards','UserProfileResource','stack','name','send','index','Dashboard','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','length'];(function(_0x1c2ea4,_0x16ac04){var _0x575866=function(_0x47272b){while(--_0x47272b){_0x1c2ea4['push'](_0x1c2ea4['shift']());}};_0x575866(++_0x16ac04);}(_0xeccc,0x147));var _0xcecc=function(_0x3ea4ce,_0x6bf6f1){_0x3ea4ce=_0x3ea4ce-0x0;var _0x36cf6e=_0xeccc[_0x3ea4ce];return _0x36cf6e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcecc('0x0'));var zipdir=require(_0xcecc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xcecc('0x2'));var BPromise=require(_0xcecc('0x3'));var Mustache=require(_0xcecc('0x4'));var util=require(_0xcecc('0x5'));var path=require(_0xcecc('0x6'));var sox=require(_0xcecc('0x7'));var csv=require(_0xcecc('0x8'));var ejs=require(_0xcecc('0x9'));var fs=require('fs');var fs_extra=require(_0xcecc('0xa'));var _=require('lodash');var squel=require(_0xcecc('0xb'));var crypto=require(_0xcecc('0xc'));var jsforce=require(_0xcecc('0xd'));var deskjs=require(_0xcecc('0xe'));var toCsv=require(_0xcecc('0x8'));var querystring=require(_0xcecc('0xf'));var Papa=require(_0xcecc('0x10'));var Redis=require(_0xcecc('0x11'));var authService=require(_0xcecc('0x12'));var qs=require(_0xcecc('0x13'));var as=require(_0xcecc('0x14'));var hardwareService=require(_0xcecc('0x15'));var logger=require(_0xcecc('0x16'))(_0xcecc('0x17'));var utils=require(_0xcecc('0x18'));var config=require(_0xcecc('0x19'));var licenseUtil=require(_0xcecc('0x1a'));var db=require('../../mysqldb')['db'];config[_0xcecc('0x1b')]=_[_0xcecc('0x1c')](config['redis'],{'host':_0xcecc('0x1d'),'port':0x18eb});var socket=require(_0xcecc('0x1e'))(new Redis(config[_0xcecc('0x1b')]));require('./dashboard.socket')[_0xcecc('0x1f')](socket);function respondWithStatusCode(_0x4e322e,_0x1b579b){_0x1b579b=_0x1b579b||0xcc;return function(_0x5c04de){if(_0x5c04de){return _0x4e322e[_0xcecc('0x20')](_0x1b579b);}return _0x4e322e[_0xcecc('0x21')](_0x1b579b)[_0xcecc('0x22')]();};}function respondWithResult(_0x336b8b,_0x38c716){_0x38c716=_0x38c716||0xc8;return function(_0x42c17a){if(_0x42c17a){return _0x336b8b[_0xcecc('0x21')](_0x38c716)[_0xcecc('0x23')](_0x42c17a);}};}function respondWithFilteredResult(_0x323044,_0x2f7f5c){return function(_0x124443){if(_0x124443){var _0x543c6a=typeof _0x2f7f5c['offset']==='undefined'&&typeof _0x2f7f5c[_0xcecc('0x24')]===_0xcecc('0x25');var _0x49884c=_0x124443['count'];var _0x6522a2=_0x543c6a?0x0:_0x2f7f5c[_0xcecc('0x26')];var _0x1464b2=_0x543c6a?_0x124443['count']:_0x2f7f5c[_0xcecc('0x26')]+_0x2f7f5c[_0xcecc('0x24')];var _0x3c6d31;if(_0x1464b2>=_0x49884c){_0x1464b2=_0x49884c;_0x3c6d31=0xc8;}else{_0x3c6d31=0xce;}_0x323044[_0xcecc('0x21')](_0x3c6d31);return _0x323044[_0xcecc('0x27')](_0xcecc('0x28'),_0x6522a2+'-'+_0x1464b2+'/'+_0x49884c)[_0xcecc('0x23')](_0x124443);}return null;};}function patchUpdates(_0x8af1f1){return function(_0x1f45fe){try{jsonpatch[_0xcecc('0x29')](_0x1f45fe,_0x8af1f1,!![]);}catch(_0x4287da){return BPromise[_0xcecc('0x2a')](_0x4287da);}return _0x1f45fe[_0xcecc('0x2b')]();};}function saveUpdates(_0x22ab34,_0x394083){return function(_0x54788b){if(_0x54788b){return _0x54788b[_0xcecc('0x2c')](_0x22ab34)[_0xcecc('0x2d')](function(_0x5c7b79){return _0x5c7b79;});}return null;};}function removeEntity(_0x4a6289,_0x3f8ec4){return function(_0x2bb749){if(_0x2bb749){return _0x2bb749[_0xcecc('0x2e')]()[_0xcecc('0x2d')](function(){var _0x5113ab=_0x2bb749['get']({'plain':!![]});var _0xd79520=_0xcecc('0x2f');return db[_0xcecc('0x30')][_0xcecc('0x2e')]({'where':{'type':_0xd79520,'resourceId':_0x5113ab['id']}})[_0xcecc('0x2d')](function(){return _0x2bb749;});})['then'](function(){_0x4a6289['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x162be8,_0x3a4ef2){return function(_0x199e7c){if(!_0x199e7c){_0x162be8[_0xcecc('0x20')](0x194);}return _0x199e7c;};}function handleError(_0x4f1ce3,_0x5e0b03){_0x5e0b03=_0x5e0b03||0x1f4;return function(_0x4d21a9){logger['error'](_0x4d21a9[_0xcecc('0x31')]);if(_0x4d21a9[_0xcecc('0x32')]){delete _0x4d21a9[_0xcecc('0x32')];}_0x4f1ce3[_0xcecc('0x21')](_0x5e0b03)[_0xcecc('0x33')](_0x4d21a9);};}exports[_0xcecc('0x34')]=function(_0x490ad3,_0x221f00){var _0x1304dd={},_0x358313={},_0x4f6f30={'count':0x0,'rows':[]};var _0x452627=_['map'](db[_0xcecc('0x35')][_0xcecc('0x36')],function(_0x1b10a3){return{'name':_0x1b10a3[_0xcecc('0x37')],'type':_0x1b10a3[_0xcecc('0x38')]['key']};});_0x358313[_0xcecc('0x39')]=_['map'](_0x452627,_0xcecc('0x32'));_0x358313[_0xcecc('0x3a')]=_['keys'](_0x490ad3['query']);_0x358313[_0xcecc('0x3b')]=_[_0xcecc('0x3c')](_0x358313['model'],_0x358313['query']);_0x1304dd[_0xcecc('0x3d')]=_['intersection'](_0x358313[_0xcecc('0x39')],qs['fields'](_0x490ad3[_0xcecc('0x3a')]['fields']));_0x1304dd[_0xcecc('0x3d')]=_0x1304dd[_0xcecc('0x3d')][_0xcecc('0x3e')]?_0x1304dd[_0xcecc('0x3d')]:_0x358313[_0xcecc('0x39')];if(!_0x490ad3['query']['hasOwnProperty'](_0xcecc('0x3f'))){_0x1304dd[_0xcecc('0x24')]=qs['limit'](_0x490ad3[_0xcecc('0x3a')]['limit']);_0x1304dd[_0xcecc('0x26')]=qs[_0xcecc('0x26')](_0x490ad3[_0xcecc('0x3a')][_0xcecc('0x26')]);}_0x1304dd[_0xcecc('0x40')]=qs[_0xcecc('0x41')](_0x490ad3['query'][_0xcecc('0x41')]);_0x1304dd[_0xcecc('0x42')]=qs[_0xcecc('0x3b')](_[_0xcecc('0x43')](_0x490ad3[_0xcecc('0x3a')],_0x358313[_0xcecc('0x3b')]),_0x452627);if(_0x490ad3['query'][_0xcecc('0x44')]){_0x1304dd[_0xcecc('0x42')]=_[_0xcecc('0x45')](_0x1304dd[_0xcecc('0x42')],{'$or':_['map'](_0x452627,function(_0x36975e){if(_0x36975e[_0xcecc('0x38')]!==_0xcecc('0x46')){var _0x4c6150={};_0x4c6150[_0x36975e[_0xcecc('0x32')]]={'$like':'%'+_0x490ad3[_0xcecc('0x3a')]['filter']+'%'};return _0x4c6150;}})});}_0x1304dd=_[_0xcecc('0x45')]({},_0x1304dd,_0x490ad3[_0xcecc('0x47')]);var _0x91a8ad={'where':_0x1304dd[_0xcecc('0x42')]};return db[_0xcecc('0x35')][_0xcecc('0x48')](_0x91a8ad)[_0xcecc('0x2d')](function(_0x464fcc){_0x4f6f30['count']=_0x464fcc;if(_0x490ad3['query'][_0xcecc('0x49')]){_0x1304dd[_0xcecc('0x4a')]=[{'all':!![]}];}return db[_0xcecc('0x35')][_0xcecc('0x4b')](_0x1304dd);})[_0xcecc('0x2d')](function(_0x344c1e){_0x4f6f30[_0xcecc('0x4c')]=_0x344c1e;return _0x4f6f30;})[_0xcecc('0x2d')](respondWithFilteredResult(_0x221f00,_0x1304dd))[_0xcecc('0x4d')](handleError(_0x221f00,null));};exports[_0xcecc('0x4e')]=function(_0x3e51e3,_0x3e2811){var _0x390468={'raw':![],'where':{'id':_0x3e51e3[_0xcecc('0x4f')]['id']}},_0x5404a4={};_0x5404a4[_0xcecc('0x39')]=_[_0xcecc('0x50')](db[_0xcecc('0x35')][_0xcecc('0x36')]);_0x5404a4['query']=_[_0xcecc('0x50')](_0x3e51e3['query']);_0x5404a4[_0xcecc('0x3b')]=_[_0xcecc('0x3c')](_0x5404a4['model'],_0x5404a4[_0xcecc('0x3a')]);_0x390468[_0xcecc('0x3d')]=_['intersection'](_0x5404a4[_0xcecc('0x39')],qs[_0xcecc('0x51')](_0x3e51e3[_0xcecc('0x3a')][_0xcecc('0x51')]));_0x390468[_0xcecc('0x3d')]=_0x390468[_0xcecc('0x3d')][_0xcecc('0x3e')]?_0x390468[_0xcecc('0x3d')]:_0x5404a4[_0xcecc('0x39')];if(_0x3e51e3[_0xcecc('0x3a')][_0xcecc('0x49')]){_0x390468['include']=[{'all':!![]}];}_0x390468=_[_0xcecc('0x45')]({},_0x390468,_0x3e51e3[_0xcecc('0x47')]);return db[_0xcecc('0x35')]['find'](_0x390468)['then'](handleEntityNotFound(_0x3e2811,null))[_0xcecc('0x2d')](respondWithResult(_0x3e2811,null))[_0xcecc('0x4d')](handleError(_0x3e2811,null));};exports[_0xcecc('0x52')]=function(_0x21338e,_0x3ace1b){return db[_0xcecc('0x35')]['create'](_0x21338e['body'],{})[_0xcecc('0x2d')](function(_0x7863b){var _0xc2123c=_0x21338e['user'][_0xcecc('0x53')]({'plain':!![]});if(!_0xc2123c)throw new Error(_0xcecc('0x54'));if(_0xc2123c[_0xcecc('0x55')]===_0xcecc('0x56')){var _0x226880=_0x7863b[_0xcecc('0x53')]({'plain':!![]});var _0x39aae2=_0xcecc('0x2f');return db[_0xcecc('0x57')][_0xcecc('0x58')]({'where':{'name':_0x39aae2,'userProfileId':_0xc2123c[_0xcecc('0x59')]},'raw':!![]})[_0xcecc('0x2d')](function(_0x41461d){if(_0x41461d&&_0x41461d[_0xcecc('0x5a')]===0x0){return db['UserProfileResource'][_0xcecc('0x52')]({'name':_0x226880['name'],'resourceId':_0x226880['id'],'type':_0x41461d['name'],'sectionId':_0x41461d['id']},{})[_0xcecc('0x2d')](function(){return _0x7863b;});}else{return _0x7863b;}})[_0xcecc('0x4d')](function(_0x32f650){logger[_0xcecc('0x5b')](_0xcecc('0x5c'),_0x32f650);throw _0x32f650;});}return _0x7863b;})[_0xcecc('0x2d')](respondWithResult(_0x3ace1b,0xc9))['catch'](handleError(_0x3ace1b,null));};exports[_0xcecc('0x5d')]=function(_0x29c3ee,_0x4eb291){var _0x1247e7={'where':{'id':_0x29c3ee[_0xcecc('0x4f')]['id']}},_0x301441={};_0x301441['model']=_[_0xcecc('0x50')](db[_0xcecc('0x35')][_0xcecc('0x36')]);_0x1247e7[_0xcecc('0x3d')]=_[_0xcecc('0x3c')](_0x301441[_0xcecc('0x39')],qs['fields'](_0x29c3ee[_0xcecc('0x3a')][_0xcecc('0x51')]));_0x1247e7[_0xcecc('0x3d')]=_0x1247e7[_0xcecc('0x3d')][_0xcecc('0x3e')]?_0x1247e7['attributes']:_0x301441[_0xcecc('0x39')];if(_0x29c3ee[_0xcecc('0x3a')][_0xcecc('0x49')]){_0x1247e7[_0xcecc('0x4a')]=[{'all':!![]}];}_0x1247e7=_[_0xcecc('0x45')]({},_0x1247e7,_0x29c3ee[_0xcecc('0x47')]);return db[_0xcecc('0x35')][_0xcecc('0x58')](_0x1247e7)[_0xcecc('0x2d')](handleEntityNotFound(_0x4eb291,null))[_0xcecc('0x2d')](function(_0x53b0af){if(_0x53b0af){var _0x45b0a8=_0x53b0af[_0xcecc('0x53')]({'plain':!![]});_0x45b0a8=qs['omit'](_0x45b0a8,['id','createdAt','updatedAt']);_0x29c3ee[_0xcecc('0x5e')]=_[_0xcecc('0x5f')](_0x29c3ee[_0xcecc('0x5e')],['id',_0xcecc('0x60'),_0xcecc('0x61')]);return db[_0xcecc('0x35')][_0xcecc('0x52')](_[_0xcecc('0x45')](_0x45b0a8,_0x29c3ee['body']),{'include':_0x29c3ee['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x2ffbcd){var _0x46fb0e=_0x29c3ee[_0xcecc('0x56')]['get']({'plain':!![]});if(!_0x46fb0e)throw new Error(_0xcecc('0x54'));if(_0x46fb0e[_0xcecc('0x55')]===_0xcecc('0x56')){var _0x177909=_0x2ffbcd['get']({'plain':!![]});var _0x23c68f='CustomDashboards';return db[_0xcecc('0x57')][_0xcecc('0x58')]({'where':{'name':_0x23c68f,'userProfileId':_0x46fb0e[_0xcecc('0x59')]},'raw':!![]})[_0xcecc('0x2d')](function(_0x5eba14){if(_0x5eba14&&_0x5eba14[_0xcecc('0x5a')]===0x0){return db['UserProfileResource']['create']({'name':_0x177909[_0xcecc('0x32')],'resourceId':_0x177909['id'],'type':_0x5eba14['name'],'sectionId':_0x5eba14['id']},{})[_0xcecc('0x2d')](function(){return _0x2ffbcd;});}else{return _0x2ffbcd;}})['catch'](function(_0x42d09c){logger['error'](_0xcecc('0x5c'),_0x42d09c);throw _0x42d09c;});}return _0x2ffbcd;});}})[_0xcecc('0x2d')](respondWithResult(_0x4eb291,0xc9))[_0xcecc('0x4d')](handleError(_0x4eb291,null));};exports['update']=function(_0x4a9576,_0x51064c){if(_0x4a9576['body']['id']){delete _0x4a9576[_0xcecc('0x5e')]['id'];}return db[_0xcecc('0x35')]['find']({'where':{'id':_0x4a9576[_0xcecc('0x4f')]['id']}})['then'](handleEntityNotFound(_0x51064c,null))['then'](saveUpdates(_0x4a9576[_0xcecc('0x5e')],null))[_0xcecc('0x2d')](respondWithResult(_0x51064c,null))[_0xcecc('0x4d')](handleError(_0x51064c,null));};exports['destroy']=function(_0x4cfdcd,_0x1df5f4){return db[_0xcecc('0x35')]['find']({'where':{'id':_0x4cfdcd[_0xcecc('0x4f')]['id']}})[_0xcecc('0x2d')](handleEntityNotFound(_0x1df5f4,null))['then'](removeEntity(_0x1df5f4,null))[_0xcecc('0x4d')](handleError(_0x1df5f4,null));};function widgetAttributes(_0x2ba44){try{switch(_0x2ba44[_0xcecc('0x38')]){case'iframe':return[{'name':'attrUrl','value':_0x2ba44[_0xcecc('0x62')]||(_0x2ba44['attrs']&&_0x2ba44[_0xcecc('0x63')][0x0]?_0x2ba44[_0xcecc('0x63')][0x0]['value']:undefined)||_0xcecc('0x64')}];case'custom':return[{'name':_0xcecc('0x65'),'value':_0x2ba44[_0xcecc('0x65')]||(_0x2ba44[_0xcecc('0x63')]&&_0x2ba44[_0xcecc('0x63')][0x0]?_0x2ba44['attrs'][0x0][_0xcecc('0x66')]:undefined)||''}];case _0xcecc('0x67'):return[{'name':_0xcecc('0x68'),'value':_0x2ba44[_0xcecc('0x68')]||(_0x2ba44[_0xcecc('0x63')]&&_0x2ba44[_0xcecc('0x63')][0x0]?_0x2ba44[_0xcecc('0x63')][0x0][_0xcecc('0x66')]:undefined)||_0xcecc('0x69')},{'name':_0xcecc('0x6a'),'value':_0x2ba44[_0xcecc('0x6a')]||(_0x2ba44[_0xcecc('0x63')]&&_0x2ba44[_0xcecc('0x63')][0x1]?_0x2ba44[_0xcecc('0x63')][0x1]['value']:undefined)||_0xcecc('0x6b')},{'name':_0xcecc('0x6c'),'value':_0x2ba44['attrFontSize']||(_0x2ba44[_0xcecc('0x63')]&&_0x2ba44[_0xcecc('0x63')][0x2]?_0x2ba44[_0xcecc('0x63')][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0xcecc('0x6d'),'value':_0x2ba44[_0xcecc('0x6d')]||(_0x2ba44[_0xcecc('0x63')]&&_0x2ba44['attrs'][0x0]?_0x2ba44[_0xcecc('0x63')][0x0][_0xcecc('0x66')]:undefined)||_0xcecc('0x6e')},{'name':_0xcecc('0x6f'),'value':_0x2ba44[_0xcecc('0x6f')]||(_0x2ba44['attrs']&&_0x2ba44[_0xcecc('0x63')][0x1]?_0x2ba44[_0xcecc('0x63')][0x1][_0xcecc('0x66')]:undefined)||[]},{'name':_0xcecc('0x6c'),'value':_0x2ba44[_0xcecc('0x6c')]||(_0x2ba44['attrs']&&_0x2ba44['attrs'][0x2]?_0x2ba44['attrs'][0x2][_0xcecc('0x66')]:undefined)||0x14}];case _0xcecc('0x70'):case _0xcecc('0x71'):return[{'name':_0xcecc('0x72'),'value':_0x2ba44[_0xcecc('0x72')]||(_0x2ba44[_0xcecc('0x63')]&&_0x2ba44['attrs'][0x0]?_0x2ba44[_0xcecc('0x63')][0x0]['value']:undefined)||_0xcecc('0x6e')},{'name':_0xcecc('0x73'),'value':_0x2ba44['attrSerie2']||(_0x2ba44[_0xcecc('0x63')]&&_0x2ba44[_0xcecc('0x63')][0x1]?_0x2ba44[_0xcecc('0x63')][0x1]['value']:undefined)||null},{'name':_0xcecc('0x74'),'value':_0x2ba44[_0xcecc('0x74')]||(_0x2ba44[_0xcecc('0x63')]&&_0x2ba44[_0xcecc('0x63')][0x2]?_0x2ba44[_0xcecc('0x63')][0x2][_0xcecc('0x66')]:undefined)||null},{'name':_0xcecc('0x6f'),'value':_0x2ba44['attrVoiceQueues']||(_0x2ba44[_0xcecc('0x63')]&&_0x2ba44[_0xcecc('0x63')][0x3]?_0x2ba44[_0xcecc('0x63')][0x3][_0xcecc('0x66')]:undefined)||[]}];case _0xcecc('0x75'):return[{'name':_0xcecc('0x76'),'type':_0x2ba44[_0xcecc('0x77')]||(_0x2ba44[_0xcecc('0x63')]&&_0x2ba44[_0xcecc('0x63')][0x0]?_0x2ba44['attrs'][0x0][_0xcecc('0x38')]:undefined)||null,'value':_0x2ba44[_0xcecc('0x76')]||(_0x2ba44[_0xcecc('0x63')]&&_0x2ba44['attrs'][0x0]?_0x2ba44[_0xcecc('0x63')][0x0]['value']:undefined)||null},{'name':_0xcecc('0x78'),'value':_0x2ba44[_0xcecc('0x78')]||(_0x2ba44['attrs']&&_0x2ba44[_0xcecc('0x63')][0x1]?_0x2ba44[_0xcecc('0x63')][0x1][_0xcecc('0x66')]:undefined)||0x0}];default:return[];}}catch(_0x5b487d){logger[_0xcecc('0x5b')](_0xcecc('0x79'),JSON[_0xcecc('0x7a')](_0x5b487d));return[];}}exports[_0xcecc('0x7b')]=function(_0x704b3e,_0x1fac14,_0xf9fa83){if(_0x704b3e[_0xcecc('0x5e')]['id']){delete _0x704b3e['body']['id'];}return db['Dashboard']['find']({'where':{'id':_0x704b3e[_0xcecc('0x4f')]['id']}})[_0xcecc('0x2d')](handleEntityNotFound(_0x1fac14,null))[_0xcecc('0x2d')](function(_0x586cc0){if(_0x586cc0){_0x704b3e[_0xcecc('0x5e')][_0xcecc('0x7c')]=_0x586cc0['id'];_0x704b3e['body'][_0xcecc('0x63')]=widgetAttributes(_0x704b3e[_0xcecc('0x5e')]);return db[_0xcecc('0x7d')][_0xcecc('0x52')](_0x704b3e[_0xcecc('0x5e')]);}})[_0xcecc('0x2d')](respondWithResult(_0x1fac14,null))[_0xcecc('0x4d')](handleError(_0x1fac14,null));};exports[_0xcecc('0x7e')]=function(_0x586364,_0x38a7b0,_0x3ed696){var _0x5da98d={};var _0x5d15b3={};var _0x138cab;var _0x11288e;return db[_0xcecc('0x35')][_0xcecc('0x7f')]({'where':{'id':_0x586364[_0xcecc('0x4f')]['id']}})[_0xcecc('0x2d')](handleEntityNotFound(_0x38a7b0,null))['then'](function(_0x3de0b7){if(_0x3de0b7){_0x138cab=_0x3de0b7;_0x5d15b3[_0xcecc('0x39')]=_['keys'](db[_0xcecc('0x7d')][_0xcecc('0x36')]);_0x5d15b3['query']=_[_0xcecc('0x50')](_0x586364[_0xcecc('0x3a')]);_0x5d15b3[_0xcecc('0x3b')]=_['intersection'](_0x5d15b3['model'],_0x5d15b3[_0xcecc('0x3a')]);_0x5da98d[_0xcecc('0x3d')]=_[_0xcecc('0x3c')](_0x5d15b3[_0xcecc('0x39')],qs[_0xcecc('0x51')](_0x586364[_0xcecc('0x3a')]['fields']));_0x5da98d[_0xcecc('0x3d')]=_0x5da98d[_0xcecc('0x3d')][_0xcecc('0x3e')]?_0x5da98d['attributes']:_0x5d15b3[_0xcecc('0x39')];_0x5da98d[_0xcecc('0x40')]=qs['sort'](_0x586364[_0xcecc('0x3a')][_0xcecc('0x41')]);_0x5da98d[_0xcecc('0x42')]=qs[_0xcecc('0x3b')](_[_0xcecc('0x43')](_0x586364['query'],_0x5d15b3[_0xcecc('0x3b')]));if(_0x586364[_0xcecc('0x3a')][_0xcecc('0x44')]){_0x5da98d[_0xcecc('0x42')]=_['merge'](_0x5da98d[_0xcecc('0x42')],{'$or':_[_0xcecc('0x80')](_0x5da98d['attributes'],function(_0x34a6f5){var _0x2f8f65={};_0x2f8f65[_0x34a6f5]={'$like':'%'+_0x586364['query']['filter']+'%'};return _0x2f8f65;})});}_0x5da98d=_[_0xcecc('0x45')]({},_0x5da98d,_0x586364[_0xcecc('0x47')]);return _0x138cab[_0xcecc('0x7e')](_0x5da98d);}})[_0xcecc('0x2d')](function(_0x39f0f0){if(_0x39f0f0){_0x11288e=_0x39f0f0[_0xcecc('0x3e')];if(!_0x586364[_0xcecc('0x3a')][_0xcecc('0x81')](_0xcecc('0x3f'))){_0x5da98d[_0xcecc('0x24')]=qs['limit'](_0x586364[_0xcecc('0x3a')]['limit']);_0x5da98d['offset']=qs[_0xcecc('0x26')](_0x586364[_0xcecc('0x3a')][_0xcecc('0x26')]);}return _0x138cab[_0xcecc('0x7e')](_0x5da98d);}})[_0xcecc('0x2d')](function(_0x1a52e7){if(_0x1a52e7){return _0x1a52e7?{'count':_0x11288e,'rows':_0x1a52e7}:null;}})[_0xcecc('0x2d')](respondWithResult(_0x38a7b0,null))[_0xcecc('0x4d')](handleError(_0x38a7b0,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index b381412..8ad8fa7 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 _0xb2ad=['hasOwnProperty','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x2c61a2,_0x40fe37){var _0x28bf7c=function(_0x4afffe){while(--_0x4afffe){_0x2c61a2['push'](_0x2c61a2['shift']());}};_0x28bf7c(++_0x40fe37);}(_0xb2ad,0x16d));var _0xdb2a=function(_0x40c0dd,_0x4da13a){_0x40c0dd=_0x40c0dd-0x0;var _0x568042=_0xb2ad[_0x40c0dd];return _0x568042;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0xdb2a('0x0'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0xdb2a('0x1')](0x0);var events={'afterCreate':_0xdb2a('0x2'),'afterUpdate':_0xdb2a('0x3'),'afterDestroy':_0xdb2a('0x4')};function emitEvent(_0xf8768){return function(_0x505753,_0x244b13,_0x23ada5){DashboardEvents[_0xdb2a('0x5')](_0xf8768+':'+_0x505753['id'],_0x505753);DashboardEvents[_0xdb2a('0x5')](_0xf8768,_0x505753);_0x23ada5(null);};}for(var e in events){if(events[_0xdb2a('0x6')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file +var _0xcb04=['events','../../mysqldb','Dashboard','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x4662fc,_0x2787f7){var _0x2026cb=function(_0xd60ea5){while(--_0xd60ea5){_0x4662fc['push'](_0x4662fc['shift']());}};_0x2026cb(++_0x2787f7);}(_0xcb04,0x9a));var _0x4cb0=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xcb04[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0x4cb0('0x0'));var Dashboard=require(_0x4cb0('0x1'))['db'][_0x4cb0('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x4cb0('0x3')](0x0);var events={'afterCreate':_0x4cb0('0x4'),'afterUpdate':_0x4cb0('0x5'),'afterDestroy':_0x4cb0('0x6')};function emitEvent(_0x2f1690){return function(_0x392bd7,_0x3939b4,_0x47aae7){DashboardEvents[_0x4cb0('0x7')](_0x2f1690+':'+_0x392bd7['id'],_0x392bd7);DashboardEvents[_0x4cb0('0x7')](_0x2f1690,_0x392bd7);_0x47aae7(null);};}for(var e in events){if(events[_0x4cb0('0x8')](e)){var event=events[e];Dashboard[_0x4cb0('0x9')](e,emitEvent(event));}}module[_0x4cb0('0xa')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 7b4cf70..43a6cde 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 _0xae55=['moment','bluebird','request-promise','path','../../config/environment','./dashboard.attributes','exports','define','Dashboard','lodash','util','../../config/logger','api'];(function(_0x3a9cf2,_0x224ec3){var _0x1d161e=function(_0x7ad80e){while(--_0x7ad80e){_0x3a9cf2['push'](_0x3a9cf2['shift']());}};_0x1d161e(++_0x224ec3);}(_0xae55,0xbf));var _0x5ae5=function(_0x395a03,_0x5be88a){_0x395a03=_0x395a03-0x0;var _0x526a4a=_0xae55[_0x395a03];return _0x526a4a;};'use strict';var _=require(_0x5ae5('0x0'));var util=require(_0x5ae5('0x1'));var logger=require(_0x5ae5('0x2'))(_0x5ae5('0x3'));var moment=require(_0x5ae5('0x4'));var BPromise=require(_0x5ae5('0x5'));var rp=require(_0x5ae5('0x6'));var fs=require('fs');var path=require(_0x5ae5('0x7'));var rimraf=require('rimraf');var config=require(_0x5ae5('0x8'));var attributes=require(_0x5ae5('0x9'));module[_0x5ae5('0xa')]=function(_0x1ab4f9,_0x2623bc){return _0x1ab4f9[_0x5ae5('0xb')](_0x5ae5('0xc'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa82b=['./dashboard.attributes','exports','Dashboard','dashboards','lodash','util','api','moment','request-promise','../../config/environment'];(function(_0x4c0fef,_0x1d44d5){var _0x39a640=function(_0x397791){while(--_0x397791){_0x4c0fef['push'](_0x4c0fef['shift']());}};_0x39a640(++_0x1d44d5);}(_0xa82b,0x1b2));var _0xba82=function(_0x48d7aa,_0x52349c){_0x48d7aa=_0x48d7aa-0x0;var _0x138fc6=_0xa82b[_0x48d7aa];return _0x138fc6;};'use strict';var _=require(_0xba82('0x0'));var util=require(_0xba82('0x1'));var logger=require('../../config/logger')(_0xba82('0x2'));var moment=require(_0xba82('0x3'));var BPromise=require('bluebird');var rp=require(_0xba82('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xba82('0x5'));var attributes=require(_0xba82('0x6'));module[_0xba82('0x7')]=function(_0x24b4df,_0x552a3e){return _0x24b4df['define'](_0xba82('0x8'),attributes,{'tableName':_0xba82('0x9'),'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 06ef590..96417eb 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 _0xfb33=['request\x20sent','stringify','code','error','Dashboard,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./dashboard.socket','register','request','then','info'];(function(_0x30351f,_0x3f8bd1){var _0xae0f84=function(_0xf7224){while(--_0xf7224){_0x30351f['push'](_0x30351f['shift']());}};_0xae0f84(++_0x3f8bd1);}(_0xfb33,0x19d));var _0x3fb3=function(_0x101802,_0x11f913){_0x101802=_0x101802-0x0;var _0x5d61ce=_0xfb33[_0x101802];return _0x5d61ce;};'use strict';var _=require(_0x3fb3('0x0'));var util=require(_0x3fb3('0x1'));var moment=require(_0x3fb3('0x2'));var BPromise=require(_0x3fb3('0x3'));var rs=require(_0x3fb3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3fb3('0x5'))['db'];var utils=require(_0x3fb3('0x6'));var logger=require(_0x3fb3('0x7'))(_0x3fb3('0x8'));var config=require(_0x3fb3('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3fb3('0xa')]({'port':0x232a});config[_0x3fb3('0xb')]=_['defaults'](config[_0x3fb3('0xb')],{'host':_0x3fb3('0xc'),'port':0x18eb});var socket=require(_0x3fb3('0xd'))(new Redis(config['redis']));require(_0x3fb3('0xe'))[_0x3fb3('0xf')](socket);function respondWithRpcPromise(_0x4519dc,_0x521211,_0xadc788){return new BPromise(function(_0x39d5d4,_0x22409f){return client[_0x3fb3('0x10')](_0x4519dc,_0xadc788)[_0x3fb3('0x11')](function(_0x795ee3){logger[_0x3fb3('0x12')]('Dashboard,\x20%s,\x20%s',_0x521211,'request\x20sent');logger['debug']('Dashboard,\x20%s,\x20%s,\x20%s',_0x521211,_0x3fb3('0x13'),JSON[_0x3fb3('0x14')](_0x795ee3));if(_0x795ee3['error']){if(_0x795ee3['error'][_0x3fb3('0x15')]===0x1f4){logger[_0x3fb3('0x16')](_0x3fb3('0x17'),_0x521211,_0x795ee3[_0x3fb3('0x16')][_0x3fb3('0x18')]);return _0x22409f(_0x795ee3[_0x3fb3('0x16')][_0x3fb3('0x18')]);}logger['error']('Dashboard,\x20%s,\x20%s',_0x521211,_0x795ee3[_0x3fb3('0x16')]['message']);return _0x39d5d4(_0x795ee3['error']['message']);}else{logger['info'](_0x3fb3('0x17'),_0x521211,_0x3fb3('0x13'));_0x39d5d4(_0x795ee3[_0x3fb3('0x19')]['message']);}})[_0x3fb3('0x1a')](function(_0x1ecbb5){logger['error'](_0x3fb3('0x17'),_0x521211,_0x1ecbb5);_0x22409f(_0x1ecbb5);});});} \ No newline at end of file +var _0xb360=['error','code','Dashboard,\x20%s,\x20%s','message','info','result','lodash','util','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','request','then','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x66dd20,_0x114f60){var _0x1316f4=function(_0x2cbf12){while(--_0x2cbf12){_0x66dd20['push'](_0x66dd20['shift']());}};_0x1316f4(++_0x114f60);}(_0xb360,0x83));var _0x0b36=function(_0x1293bc,_0x2faab1){_0x1293bc=_0x1293bc-0x0;var _0x5925c8=_0xb360[_0x1293bc];return _0x5925c8;};'use strict';var _=require(_0x0b36('0x0'));var util=require(_0x0b36('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0b36('0x2'));var fs=require('fs');var Redis=require(_0x0b36('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0b36('0x4'))(_0x0b36('0x5'));var config=require(_0x0b36('0x6'));var jayson=require(_0x0b36('0x7'));var client=jayson[_0x0b36('0x8')][_0x0b36('0x9')]({'port':0x232a});config[_0x0b36('0xa')]=_['defaults'](config[_0x0b36('0xa')],{'host':_0x0b36('0xb'),'port':0x18eb});var socket=require(_0x0b36('0xc'))(new Redis(config[_0x0b36('0xa')]));require('./dashboard.socket')['register'](socket);function respondWithRpcPromise(_0x5dc761,_0xefb1f5,_0xf29a68){return new BPromise(function(_0x27597b,_0x25176d){return client[_0x0b36('0xd')](_0x5dc761,_0xf29a68)[_0x0b36('0xe')](function(_0x2d6d12){logger['info']('Dashboard,\x20%s,\x20%s',_0xefb1f5,_0x0b36('0xf'));logger[_0x0b36('0x10')](_0x0b36('0x11'),_0xefb1f5,'request\x20sent',JSON[_0x0b36('0x12')](_0x2d6d12));if(_0x2d6d12[_0x0b36('0x13')]){if(_0x2d6d12[_0x0b36('0x13')][_0x0b36('0x14')]===0x1f4){logger[_0x0b36('0x13')](_0x0b36('0x15'),_0xefb1f5,_0x2d6d12[_0x0b36('0x13')][_0x0b36('0x16')]);return _0x25176d(_0x2d6d12['error'][_0x0b36('0x16')]);}logger[_0x0b36('0x13')]('Dashboard,\x20%s,\x20%s',_0xefb1f5,_0x2d6d12[_0x0b36('0x13')]['message']);return _0x27597b(_0x2d6d12[_0x0b36('0x13')][_0x0b36('0x16')]);}else{logger[_0x0b36('0x17')]('Dashboard,\x20%s,\x20%s',_0xefb1f5,_0x0b36('0xf'));_0x27597b(_0x2d6d12[_0x0b36('0x18')]['message']);}})['catch'](function(_0x5bec9d){logger['error'](_0x0b36('0x15'),_0xefb1f5,_0x5bec9d);_0x25176d(_0x5bec9d);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index c661873..656e0df 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 _0x88b9=['emit','removeListener','register','save','remove','update'];(function(_0x407538,_0x3867c3){var _0x106535=function(_0x529bd0){while(--_0x529bd0){_0x407538['push'](_0x407538['shift']());}};_0x106535(++_0x3867c3);}(_0x88b9,0x9f));var _0x988b=function(_0x34a320,_0x1a1b2b){_0x34a320=_0x34a320-0x0;var _0x5c71eb=_0x88b9[_0x34a320];return _0x5c71eb;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0x988b('0x0'),_0x988b('0x1'),_0x988b('0x2')];function createListener(_0x4536d8,_0x183394){return function(_0x59741c){_0x183394[_0x988b('0x3')](_0x4536d8,_0x59741c);};}function removeListener(_0x11a1fb,_0x5dc9fd){return function(){DashboardEvents[_0x988b('0x4')](_0x11a1fb,_0x5dc9fd);};}exports[_0x988b('0x5')]=function(_0x5164c8){for(var _0x12e551=0x0,_0x27bd51=events['length'];_0x12e551<_0x27bd51;_0x12e551++){var _0x148055=events[_0x12e551];var _0x596265=createListener('dashboard:'+_0x148055,_0x5164c8);DashboardEvents['on'](_0x148055,_0x596265);}}; \ No newline at end of file +var _0xa963=['remove','emit','removeListener','register','length','./dashboard.events','save'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa963,0x14e));var _0x3a96=function(_0x88d57f,_0x3fe5d9){_0x88d57f=_0x88d57f-0x0;var _0x42fd82=_0xa963[_0x88d57f];return _0x42fd82;};'use strict';var DashboardEvents=require(_0x3a96('0x0'));var events=[_0x3a96('0x1'),_0x3a96('0x2'),'update'];function createListener(_0x42c67a,_0x16f157){return function(_0x43f7ce){_0x16f157[_0x3a96('0x3')](_0x42c67a,_0x43f7ce);};}function removeListener(_0x5cc346,_0x400003){return function(){DashboardEvents[_0x3a96('0x4')](_0x5cc346,_0x400003);};}exports[_0x3a96('0x5')]=function(_0x270147){for(var _0x5e5081=0x0,_0x1644bc=events[_0x3a96('0x6')];_0x5e5081<_0x1644bc;_0x5e5081++){var _0x18ec0e=events[_0x5e5081];var _0x4edefc=createListener('dashboard:'+_0x18ec0e,_0x270147);DashboardEvents['on'](_0x18ec0e,_0x4edefc);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 446a2c6..7f1a051 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 _0xe736=['get','/:id','show','getItems','/:id/clone','clone','post','update','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./dashboard.controller','isAuthenticated','index'];(function(_0x57645b,_0x25f73a){var _0xe82f00=function(_0x526b4){while(--_0x526b4){_0x57645b['push'](_0x57645b['shift']());}};_0xe82f00(++_0x25f73a);}(_0xe736,0x14c));var _0x6e73=function(_0x4a8bad,_0x4aabdb){_0x4a8bad=_0x4a8bad-0x0;var _0x5e8ee7=_0xe736[_0x4a8bad];return _0x5e8ee7;};'use strict';var multer=require(_0x6e73('0x0'));var util=require(_0x6e73('0x1'));var path=require(_0x6e73('0x2'));var timeout=require(_0x6e73('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x6e73('0x4'));var auth=require(_0x6e73('0x5'));var interaction=require(_0x6e73('0x6'));var config=require('../../config/environment');var controller=require(_0x6e73('0x7'));router['get']('/',auth[_0x6e73('0x8')](),controller[_0x6e73('0x9')]);router[_0x6e73('0xa')](_0x6e73('0xb'),auth[_0x6e73('0x8')](),controller[_0x6e73('0xc')]);router[_0x6e73('0xa')]('/:id/items',auth[_0x6e73('0x8')](),controller[_0x6e73('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x6e73('0xe'),auth[_0x6e73('0x8')](),controller[_0x6e73('0xf')]);router[_0x6e73('0x10')]('/:id/items',auth[_0x6e73('0x8')](),controller['addItem']);router['put'](_0x6e73('0xb'),auth[_0x6e73('0x8')](),controller[_0x6e73('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x6e73('0x12')]=router; \ No newline at end of file +var _0x1666=['addItem','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','isAuthenticated','index','get','/:id','/:id/items','getItems','create','/:id/clone','clone','post'];(function(_0x5bc75a,_0x38ce5c){var _0x51abb3=function(_0x2622c0){while(--_0x2622c0){_0x5bc75a['push'](_0x5bc75a['shift']());}};_0x51abb3(++_0x38ce5c);}(_0x1666,0x130));var _0x6166=function(_0x3dc674,_0x345d1b){_0x3dc674=_0x3dc674-0x0;var _0x2a3c58=_0x1666[_0x3dc674];return _0x2a3c58;};'use strict';var multer=require(_0x6166('0x0'));var util=require(_0x6166('0x1'));var path=require(_0x6166('0x2'));var timeout=require(_0x6166('0x3'));var express=require(_0x6166('0x4'));var router=express[_0x6166('0x5')]();var fs_extra=require(_0x6166('0x6'));var auth=require(_0x6166('0x7'));var interaction=require(_0x6166('0x8'));var config=require(_0x6166('0x9'));var controller=require(_0x6166('0xa'));router['get']('/',auth[_0x6166('0xb')](),controller[_0x6166('0xc')]);router[_0x6166('0xd')](_0x6166('0xe'),auth[_0x6166('0xb')](),controller['show']);router[_0x6166('0xd')](_0x6166('0xf'),auth[_0x6166('0xb')](),controller[_0x6166('0x10')]);router['post']('/',auth[_0x6166('0xb')](),controller[_0x6166('0x11')]);router['post'](_0x6166('0x12'),auth['isAuthenticated'](),controller[_0x6166('0x13')]);router[_0x6166('0x14')](_0x6166('0xf'),auth[_0x6166('0xb')](),controller[_0x6166('0x15')]);router[_0x6166('0x16')](_0x6166('0xe'),auth[_0x6166('0xb')](),controller[_0x6166('0x17')]);router['delete']('/:id',auth[_0x6166('0xb')](),controller['destroy']);module[_0x6166('0x18')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index f9b2cd6..33c7c0d 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 _0xb4c7=['TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','sequelize','squel','lodash','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x402209,_0x3a9a92){_0x402209=_0x402209-0x0;var _0x2323ea=_0xb4c7[_0x402209];return _0x2323ea;};'use strict';var Sequelize=require(_0x7b4c('0x0'));var squel=require(_0x7b4c('0x1'));var _=require(_0x7b4c('0x2'));module[_0x7b4c('0x3')]={'title':{'type':Sequelize[_0x7b4c('0x4')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x7b4c('0x5')](_0x7b4c('0x6')),'get':function(){try{return JSON[_0x7b4c('0x7')](this[_0x7b4c('0x8')](_0x7b4c('0x9')));}catch(_0x5adec9){return[];}},'set':function(_0x1b0f57){try{this[_0x7b4c('0xa')](_0x7b4c('0x9'),JSON['stringify'](_0x1b0f57));}catch(_0x2d7b7e){this[_0x7b4c('0xa')]('attrs',JSON[_0x7b4c('0xb')]([]));}}},'sizeX':{'type':Sequelize[_0x7b4c('0xc')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x7b4c('0xc')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x7b4c('0xc')]},'col':{'type':Sequelize[_0x7b4c('0xc')]},'background':{'type':Sequelize[_0x7b4c('0x4')],'allowNull':![],'defaultValue':_0x7b4c('0xd'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x7b4c('0x4')],'allowNull':![],'defaultValue':_0x7b4c('0xe'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x7b4c('0x4')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0x2bd8=['TEXT','long','parse','attrs','stringify','setDataValue','INTEGER','sequelize','lodash','exports','STRING'];(function(_0x52db09,_0x47354a){var _0x4206f5=function(_0xf14f6c){while(--_0xf14f6c){_0x52db09['push'](_0x52db09['shift']());}};_0x4206f5(++_0x47354a);}(_0x2bd8,0x130));var _0x82bd=function(_0x3fdbc1,_0x99fd51){_0x3fdbc1=_0x3fdbc1-0x0;var _0x4cd2e7=_0x2bd8[_0x3fdbc1];return _0x4cd2e7;};'use strict';var Sequelize=require(_0x82bd('0x0'));var squel=require('squel');var _=require(_0x82bd('0x1'));module[_0x82bd('0x2')]={'title':{'type':Sequelize[_0x82bd('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x82bd('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x82bd('0x4')](_0x82bd('0x5')),'get':function(){try{return JSON[_0x82bd('0x6')](this['getDataValue'](_0x82bd('0x7')));}catch(_0x2e1a98){return[];}},'set':function(_0x3bf810){try{this['setDataValue'](_0x82bd('0x7'),JSON[_0x82bd('0x8')](_0x3bf810));}catch(_0x226f60){this[_0x82bd('0x9')]('attrs',JSON[_0x82bd('0x8')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0x82bd('0xa')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x82bd('0x3')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0x82bd('0xa')],'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 54b9d62..31fdb62 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 _0xeb15=['attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','create','body','update','eml-format','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','defaults','redis','./dashboardItem.socket','register','status','end','json','offset','undefined','limit','count','set','reject','save','then','destroy','stack','name','send','show','params','model','keys','rawAttributes','query','intersection','attributes','fields','length','includeAll','include','DashboardItem','find','catch','type','attrUrl'];(function(_0x5030df,_0x2a765b){var _0x138323=function(_0x2d5dc9){while(--_0x2d5dc9){_0x5030df['push'](_0x5030df['shift']());}};_0x138323(++_0x2a765b);}(_0xeb15,0x6f));var _0x5eb1=function(_0x4f5108,_0x46a54b){_0x4f5108=_0x4f5108-0x0;var _0x2d56ca=_0xeb15[_0x4f5108];return _0x2d56ca;};'use strict';var emlformat=require(_0x5eb1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5eb1('0x1'));var jsonpatch=require(_0x5eb1('0x2'));var rp=require('request-promise');var moment=require(_0x5eb1('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5eb1('0x4'));var path=require(_0x5eb1('0x5'));var sox=require(_0x5eb1('0x6'));var csv=require(_0x5eb1('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5eb1('0x8'));var _=require(_0x5eb1('0x9'));var squel=require(_0x5eb1('0xa'));var crypto=require(_0x5eb1('0xb'));var jsforce=require(_0x5eb1('0xc'));var deskjs=require(_0x5eb1('0xd'));var toCsv=require(_0x5eb1('0x7'));var querystring=require(_0x5eb1('0xe'));var Papa=require(_0x5eb1('0xf'));var Redis=require(_0x5eb1('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5eb1('0x11'));var as=require(_0x5eb1('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5eb1('0x13'))(_0x5eb1('0x14'));var utils=require(_0x5eb1('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x5eb1('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x5eb1('0x17')](config[_0x5eb1('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5eb1('0x18')]));require(_0x5eb1('0x19'))[_0x5eb1('0x1a')](socket);function respondWithStatusCode(_0x56203e,_0x1b4aca){_0x1b4aca=_0x1b4aca||0xcc;return function(_0x1a57a6){if(_0x1a57a6){return _0x56203e['sendStatus'](_0x1b4aca);}return _0x56203e[_0x5eb1('0x1b')](_0x1b4aca)[_0x5eb1('0x1c')]();};}function respondWithResult(_0x398145,_0x433b30){_0x433b30=_0x433b30||0xc8;return function(_0x38cdc){if(_0x38cdc){return _0x398145[_0x5eb1('0x1b')](_0x433b30)[_0x5eb1('0x1d')](_0x38cdc);}};}function respondWithFilteredResult(_0x3287f7,_0x3c58be){return function(_0xfd9b7a){if(_0xfd9b7a){var _0x5245f2=typeof _0x3c58be[_0x5eb1('0x1e')]===_0x5eb1('0x1f')&&typeof _0x3c58be[_0x5eb1('0x20')]==='undefined';var _0xd26deb=_0xfd9b7a[_0x5eb1('0x21')];var _0x23fdf7=_0x5245f2?0x0:_0x3c58be[_0x5eb1('0x1e')];var _0x3f06a5=_0x5245f2?_0xfd9b7a[_0x5eb1('0x21')]:_0x3c58be['offset']+_0x3c58be['limit'];var _0x1b0a4b;if(_0x3f06a5>=_0xd26deb){_0x3f06a5=_0xd26deb;_0x1b0a4b=0xc8;}else{_0x1b0a4b=0xce;}_0x3287f7[_0x5eb1('0x1b')](_0x1b0a4b);return _0x3287f7[_0x5eb1('0x22')]('Content-Range',_0x23fdf7+'-'+_0x3f06a5+'/'+_0xd26deb)[_0x5eb1('0x1d')](_0xfd9b7a);}return null;};}function patchUpdates(_0x7b33df){return function(_0x25169b){try{jsonpatch['apply'](_0x25169b,_0x7b33df,!![]);}catch(_0x56d409){return BPromise[_0x5eb1('0x23')](_0x56d409);}return _0x25169b[_0x5eb1('0x24')]();};}function saveUpdates(_0x390df0,_0x5e83d6){return function(_0x586260){if(_0x586260){return _0x586260['update'](_0x390df0)[_0x5eb1('0x25')](function(_0x4d2e0a){return _0x4d2e0a;});}return null;};}function removeEntity(_0x4a3e44,_0x18f40b){return function(_0x560668){if(_0x560668){return _0x560668[_0x5eb1('0x26')]()['then'](function(){_0x4a3e44[_0x5eb1('0x1b')](0xcc)[_0x5eb1('0x1c')]();});}};}function handleEntityNotFound(_0x1a8296,_0x15281c){return function(_0x7951a1){if(!_0x7951a1){_0x1a8296['sendStatus'](0x194);}return _0x7951a1;};}function handleError(_0x5e15d2,_0x3cc248){_0x3cc248=_0x3cc248||0x1f4;return function(_0x3b9b43){logger['error'](_0x3b9b43[_0x5eb1('0x27')]);if(_0x3b9b43[_0x5eb1('0x28')]){delete _0x3b9b43['name'];}_0x5e15d2[_0x5eb1('0x1b')](_0x3cc248)[_0x5eb1('0x29')](_0x3b9b43);};}exports[_0x5eb1('0x2a')]=function(_0xfe7563,_0x1fb2ac){var _0x466bb2={'raw':![],'where':{'id':_0xfe7563[_0x5eb1('0x2b')]['id']}},_0x1d3710={};_0x1d3710[_0x5eb1('0x2c')]=_[_0x5eb1('0x2d')](db['DashboardItem'][_0x5eb1('0x2e')]);_0x1d3710[_0x5eb1('0x2f')]=_[_0x5eb1('0x2d')](_0xfe7563['query']);_0x1d3710['filters']=_[_0x5eb1('0x30')](_0x1d3710[_0x5eb1('0x2c')],_0x1d3710['query']);_0x466bb2[_0x5eb1('0x31')]=_[_0x5eb1('0x30')](_0x1d3710['model'],qs['fields'](_0xfe7563[_0x5eb1('0x2f')][_0x5eb1('0x32')]));_0x466bb2[_0x5eb1('0x31')]=_0x466bb2[_0x5eb1('0x31')][_0x5eb1('0x33')]?_0x466bb2[_0x5eb1('0x31')]:_0x1d3710['model'];if(_0xfe7563[_0x5eb1('0x2f')][_0x5eb1('0x34')]){_0x466bb2[_0x5eb1('0x35')]=[{'all':!![]}];}_0x466bb2=_['merge']({},_0x466bb2,_0xfe7563['options']);return db[_0x5eb1('0x36')][_0x5eb1('0x37')](_0x466bb2)[_0x5eb1('0x25')](handleEntityNotFound(_0x1fb2ac,null))[_0x5eb1('0x25')](respondWithResult(_0x1fb2ac,null))[_0x5eb1('0x38')](handleError(_0x1fb2ac,null));};exports['destroy']=function(_0x5859df,_0x49c8e3){return db[_0x5eb1('0x36')]['find']({'where':{'id':_0x5859df['params']['id']}})[_0x5eb1('0x25')](handleEntityNotFound(_0x49c8e3,null))[_0x5eb1('0x25')](removeEntity(_0x49c8e3,null))[_0x5eb1('0x38')](handleError(_0x49c8e3,null));};function widgetAttributes(_0x3a6ebc){try{switch(_0x3a6ebc[_0x5eb1('0x39')]){case'iframe':return[{'name':_0x5eb1('0x3a'),'value':_0x3a6ebc[_0x5eb1('0x3a')]||(_0x3a6ebc[_0x5eb1('0x3b')]&&_0x3a6ebc[_0x5eb1('0x3b')][0x0]?_0x3a6ebc['attrs'][0x0][_0x5eb1('0x3c')]:undefined)||'https://'}];case _0x5eb1('0x3d'):return[{'name':_0x5eb1('0x3e'),'value':_0x3a6ebc['attrPath']||(_0x3a6ebc[_0x5eb1('0x3b')]&&_0x3a6ebc[_0x5eb1('0x3b')][0x0]?_0x3a6ebc['attrs'][0x0][_0x5eb1('0x3c')]:undefined)||''}];case _0x5eb1('0x3f'):return[{'name':'attrHourFormat','value':_0x3a6ebc[_0x5eb1('0x40')]||(_0x3a6ebc[_0x5eb1('0x3b')]&&_0x3a6ebc['attrs'][0x0]?_0x3a6ebc['attrs'][0x0][_0x5eb1('0x3c')]:undefined)||_0x5eb1('0x41')},{'name':_0x5eb1('0x42'),'value':_0x3a6ebc[_0x5eb1('0x42')]||(_0x3a6ebc[_0x5eb1('0x3b')]&&_0x3a6ebc[_0x5eb1('0x3b')][0x1]?_0x3a6ebc[_0x5eb1('0x3b')][0x1][_0x5eb1('0x3c')]:undefined)||_0x5eb1('0x43')},{'name':_0x5eb1('0x44'),'value':_0x3a6ebc[_0x5eb1('0x44')]||(_0x3a6ebc[_0x5eb1('0x3b')]&&_0x3a6ebc[_0x5eb1('0x3b')][0x2]?_0x3a6ebc[_0x5eb1('0x3b')][0x2]['value']:undefined)||0xc}];case _0x5eb1('0x45'):return[{'name':_0x5eb1('0x46'),'value':_0x3a6ebc[_0x5eb1('0x46')]||(_0x3a6ebc['attrs']&&_0x3a6ebc[_0x5eb1('0x3b')][0x0]?_0x3a6ebc[_0x5eb1('0x3b')][0x0][_0x5eb1('0x3c')]:undefined)||_0x5eb1('0x47')},{'name':_0x5eb1('0x48'),'value':_0x3a6ebc['attrVoiceQueues']||(_0x3a6ebc[_0x5eb1('0x3b')]&&_0x3a6ebc[_0x5eb1('0x3b')][0x1]?_0x3a6ebc[_0x5eb1('0x3b')][0x1][_0x5eb1('0x3c')]:undefined)||[]},{'name':_0x5eb1('0x44'),'value':_0x3a6ebc['attrFontSize']||(_0x3a6ebc[_0x5eb1('0x3b')]&&_0x3a6ebc['attrs'][0x2]?_0x3a6ebc[_0x5eb1('0x3b')][0x2]['value']:undefined)||0x14}];case _0x5eb1('0x49'):case _0x5eb1('0x4a'):return[{'name':_0x5eb1('0x4b'),'value':_0x3a6ebc[_0x5eb1('0x4b')]||(_0x3a6ebc[_0x5eb1('0x3b')]&&_0x3a6ebc[_0x5eb1('0x3b')][0x0]?_0x3a6ebc[_0x5eb1('0x3b')][0x0]['value']:undefined)||_0x5eb1('0x47')},{'name':'attrSerie2','value':_0x3a6ebc[_0x5eb1('0x4c')]||(_0x3a6ebc[_0x5eb1('0x3b')]&&_0x3a6ebc[_0x5eb1('0x3b')][0x1]?_0x3a6ebc[_0x5eb1('0x3b')][0x1][_0x5eb1('0x3c')]:undefined)||null},{'name':_0x5eb1('0x4d'),'value':_0x3a6ebc[_0x5eb1('0x4d')]||(_0x3a6ebc[_0x5eb1('0x3b')]&&_0x3a6ebc['attrs'][0x2]?_0x3a6ebc[_0x5eb1('0x3b')][0x2][_0x5eb1('0x3c')]:undefined)||null},{'name':_0x5eb1('0x48'),'value':_0x3a6ebc[_0x5eb1('0x48')]||(_0x3a6ebc[_0x5eb1('0x3b')]&&_0x3a6ebc[_0x5eb1('0x3b')][0x3]?_0x3a6ebc[_0x5eb1('0x3b')][0x3][_0x5eb1('0x3c')]:undefined)||[]}];case _0x5eb1('0x4e'):return[{'name':_0x5eb1('0x4f'),'type':_0x3a6ebc['reportType']||(_0x3a6ebc[_0x5eb1('0x3b')]&&_0x3a6ebc[_0x5eb1('0x3b')][0x0]?_0x3a6ebc[_0x5eb1('0x3b')][0x0]['type']:undefined)||null,'value':_0x3a6ebc[_0x5eb1('0x4f')]||(_0x3a6ebc['attrs']&&_0x3a6ebc['attrs'][0x0]?_0x3a6ebc[_0x5eb1('0x3b')][0x0][_0x5eb1('0x3c')]:undefined)||null},{'name':_0x5eb1('0x50'),'value':_0x3a6ebc[_0x5eb1('0x50')]||(_0x3a6ebc[_0x5eb1('0x3b')]&&_0x3a6ebc[_0x5eb1('0x3b')][0x1]?_0x3a6ebc[_0x5eb1('0x3b')][0x1][_0x5eb1('0x3c')]:undefined)||0x0}];default:return[];}}catch(_0x424a5e){logger['error'](_0x5eb1('0x51'),JSON['stringify'](_0x424a5e));return[];}}exports[_0x5eb1('0x52')]=function(_0x51eab9,_0x1a5f4b){if(_0x51eab9[_0x5eb1('0x53')]){_0x51eab9[_0x5eb1('0x53')][_0x5eb1('0x3b')]=widgetAttributes(_0x51eab9[_0x5eb1('0x53')]);}return db[_0x5eb1('0x36')][_0x5eb1('0x52')](_0x51eab9[_0x5eb1('0x53')],{})[_0x5eb1('0x25')](respondWithResult(_0x1a5f4b,0xc9))[_0x5eb1('0x38')](handleError(_0x1a5f4b,null));};exports[_0x5eb1('0x54')]=function(_0x236476,_0x47c36b){if(_0x236476[_0x5eb1('0x53')]['id']){delete _0x236476['body']['id'];}_0x236476[_0x5eb1('0x53')][_0x5eb1('0x3b')]=widgetAttributes(_0x236476[_0x5eb1('0x53')]);return db[_0x5eb1('0x36')][_0x5eb1('0x37')]({'where':{'id':_0x236476[_0x5eb1('0x2b')]['id']}})['then'](handleEntityNotFound(_0x47c36b,null))['then'](saveUpdates(_0x236476['body'],null))[_0x5eb1('0x25')](respondWithResult(_0x47c36b,null))[_0x5eb1('0x38')](handleError(_0x47c36b,null));}; \ No newline at end of file +var _0x24d9=['send','model','keys','rawAttributes','query','filters','intersection','fields','attributes','length','include','merge','DashboardItem','find','then','catch','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','body','create','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../config/license/util','redis','defaults','localhost','./dashboardItem.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','reject','save','update','destroy','end','error','name'];(function(_0x195a84,_0x37a11b){var _0x35fa94=function(_0x2e50e1){while(--_0x2e50e1){_0x195a84['push'](_0x195a84['shift']());}};_0x35fa94(++_0x37a11b);}(_0x24d9,0x131));var _0x924d=function(_0x33f7e0,_0x340852){_0x33f7e0=_0x33f7e0-0x0;var _0x2c7a14=_0x24d9[_0x33f7e0];return _0x2c7a14;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x924d('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x924d('0x1'));var moment=require(_0x924d('0x2'));var BPromise=require(_0x924d('0x3'));var Mustache=require(_0x924d('0x4'));var util=require(_0x924d('0x5'));var path=require(_0x924d('0x6'));var sox=require(_0x924d('0x7'));var csv=require(_0x924d('0x8'));var ejs=require(_0x924d('0x9'));var fs=require('fs');var fs_extra=require(_0x924d('0xa'));var _=require(_0x924d('0xb'));var squel=require(_0x924d('0xc'));var crypto=require('crypto');var jsforce=require(_0x924d('0xd'));var deskjs=require(_0x924d('0xe'));var toCsv=require(_0x924d('0x8'));var querystring=require(_0x924d('0xf'));var Papa=require(_0x924d('0x10'));var Redis=require(_0x924d('0x11'));var authService=require(_0x924d('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x924d('0x13'));var logger=require('../../config/logger')(_0x924d('0x14'));var utils=require('../../config/utils');var config=require(_0x924d('0x15'));var licenseUtil=require(_0x924d('0x16'));var db=require('../../mysqldb')['db'];config[_0x924d('0x17')]=_[_0x924d('0x18')](config[_0x924d('0x17')],{'host':_0x924d('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x924d('0x17')]));require(_0x924d('0x1a'))[_0x924d('0x1b')](socket);function respondWithStatusCode(_0x39191a,_0x40164a){_0x40164a=_0x40164a||0xcc;return function(_0x5ae9c8){if(_0x5ae9c8){return _0x39191a[_0x924d('0x1c')](_0x40164a);}return _0x39191a[_0x924d('0x1d')](_0x40164a)['end']();};}function respondWithResult(_0x2b638c,_0x42a78a){_0x42a78a=_0x42a78a||0xc8;return function(_0x543465){if(_0x543465){return _0x2b638c[_0x924d('0x1d')](_0x42a78a)[_0x924d('0x1e')](_0x543465);}};}function respondWithFilteredResult(_0x4337ea,_0x238cce){return function(_0x49ae40){if(_0x49ae40){var _0x7bd4f0=typeof _0x238cce[_0x924d('0x1f')]===_0x924d('0x20')&&typeof _0x238cce[_0x924d('0x21')]===_0x924d('0x20');var _0x36627e=_0x49ae40[_0x924d('0x22')];var _0x5c1f1d=_0x7bd4f0?0x0:_0x238cce[_0x924d('0x1f')];var _0x5812cd=_0x7bd4f0?_0x49ae40[_0x924d('0x22')]:_0x238cce[_0x924d('0x1f')]+_0x238cce[_0x924d('0x21')];var _0x33c657;if(_0x5812cd>=_0x36627e){_0x5812cd=_0x36627e;_0x33c657=0xc8;}else{_0x33c657=0xce;}_0x4337ea[_0x924d('0x1d')](_0x33c657);return _0x4337ea[_0x924d('0x23')]('Content-Range',_0x5c1f1d+'-'+_0x5812cd+'/'+_0x36627e)['json'](_0x49ae40);}return null;};}function patchUpdates(_0xe38d11){return function(_0x46fff4){try{jsonpatch['apply'](_0x46fff4,_0xe38d11,!![]);}catch(_0x3e83e){return BPromise[_0x924d('0x24')](_0x3e83e);}return _0x46fff4[_0x924d('0x25')]();};}function saveUpdates(_0x98169c,_0x4eeba7){return function(_0x5341c1){if(_0x5341c1){return _0x5341c1[_0x924d('0x26')](_0x98169c)['then'](function(_0x39a503){return _0x39a503;});}return null;};}function removeEntity(_0x4dd103,_0x18cdda){return function(_0x1e079e){if(_0x1e079e){return _0x1e079e[_0x924d('0x27')]()['then'](function(){_0x4dd103['status'](0xcc)[_0x924d('0x28')]();});}};}function handleEntityNotFound(_0xe16257,_0x4cf54e){return function(_0x4b7d20){if(!_0x4b7d20){_0xe16257['sendStatus'](0x194);}return _0x4b7d20;};}function handleError(_0x781f7a,_0x12745f){_0x12745f=_0x12745f||0x1f4;return function(_0x30f2ee){logger[_0x924d('0x29')](_0x30f2ee['stack']);if(_0x30f2ee[_0x924d('0x2a')]){delete _0x30f2ee[_0x924d('0x2a')];}_0x781f7a[_0x924d('0x1d')](_0x12745f)[_0x924d('0x2b')](_0x30f2ee);};}exports['show']=function(_0x5d73bd,_0x1eecd8){var _0x19eae9={'raw':![],'where':{'id':_0x5d73bd['params']['id']}},_0xc03915={};_0xc03915[_0x924d('0x2c')]=_[_0x924d('0x2d')](db['DashboardItem'][_0x924d('0x2e')]);_0xc03915[_0x924d('0x2f')]=_[_0x924d('0x2d')](_0x5d73bd[_0x924d('0x2f')]);_0xc03915[_0x924d('0x30')]=_['intersection'](_0xc03915[_0x924d('0x2c')],_0xc03915[_0x924d('0x2f')]);_0x19eae9['attributes']=_[_0x924d('0x31')](_0xc03915[_0x924d('0x2c')],qs[_0x924d('0x32')](_0x5d73bd[_0x924d('0x2f')][_0x924d('0x32')]));_0x19eae9['attributes']=_0x19eae9[_0x924d('0x33')][_0x924d('0x34')]?_0x19eae9[_0x924d('0x33')]:_0xc03915[_0x924d('0x2c')];if(_0x5d73bd[_0x924d('0x2f')]['includeAll']){_0x19eae9[_0x924d('0x35')]=[{'all':!![]}];}_0x19eae9=_[_0x924d('0x36')]({},_0x19eae9,_0x5d73bd['options']);return db[_0x924d('0x37')][_0x924d('0x38')](_0x19eae9)[_0x924d('0x39')](handleEntityNotFound(_0x1eecd8,null))[_0x924d('0x39')](respondWithResult(_0x1eecd8,null))[_0x924d('0x3a')](handleError(_0x1eecd8,null));};exports[_0x924d('0x27')]=function(_0x76aee0,_0x1ed72b){return db[_0x924d('0x37')][_0x924d('0x38')]({'where':{'id':_0x76aee0['params']['id']}})['then'](handleEntityNotFound(_0x1ed72b,null))[_0x924d('0x39')](removeEntity(_0x1ed72b,null))[_0x924d('0x3a')](handleError(_0x1ed72b,null));};function widgetAttributes(_0x5d808){try{switch(_0x5d808[_0x924d('0x3b')]){case _0x924d('0x3c'):return[{'name':'attrUrl','value':_0x5d808[_0x924d('0x3d')]||(_0x5d808[_0x924d('0x3e')]&&_0x5d808[_0x924d('0x3e')][0x0]?_0x5d808['attrs'][0x0][_0x924d('0x3f')]:undefined)||_0x924d('0x40')}];case _0x924d('0x41'):return[{'name':_0x924d('0x42'),'value':_0x5d808[_0x924d('0x42')]||(_0x5d808[_0x924d('0x3e')]&&_0x5d808[_0x924d('0x3e')][0x0]?_0x5d808[_0x924d('0x3e')][0x0][_0x924d('0x3f')]:undefined)||''}];case'clock':return[{'name':_0x924d('0x43'),'value':_0x5d808[_0x924d('0x43')]||(_0x5d808['attrs']&&_0x5d808[_0x924d('0x3e')][0x0]?_0x5d808[_0x924d('0x3e')][0x0][_0x924d('0x3f')]:undefined)||_0x924d('0x44')},{'name':_0x924d('0x45'),'value':_0x5d808[_0x924d('0x45')]||(_0x5d808['attrs']&&_0x5d808[_0x924d('0x3e')][0x1]?_0x5d808[_0x924d('0x3e')][0x1][_0x924d('0x3f')]:undefined)||_0x924d('0x46')},{'name':'attrFontSize','value':_0x5d808[_0x924d('0x47')]||(_0x5d808['attrs']&&_0x5d808['attrs'][0x2]?_0x5d808[_0x924d('0x3e')][0x2]['value']:undefined)||0xc}];case _0x924d('0x48'):return[{'name':_0x924d('0x49'),'value':_0x5d808[_0x924d('0x49')]||(_0x5d808['attrs']&&_0x5d808[_0x924d('0x3e')][0x0]?_0x5d808[_0x924d('0x3e')][0x0][_0x924d('0x3f')]:undefined)||_0x924d('0x4a')},{'name':_0x924d('0x4b'),'value':_0x5d808[_0x924d('0x4b')]||(_0x5d808[_0x924d('0x3e')]&&_0x5d808[_0x924d('0x3e')][0x1]?_0x5d808['attrs'][0x1][_0x924d('0x3f')]:undefined)||[]},{'name':_0x924d('0x47'),'value':_0x5d808[_0x924d('0x47')]||(_0x5d808[_0x924d('0x3e')]&&_0x5d808[_0x924d('0x3e')][0x2]?_0x5d808['attrs'][0x2][_0x924d('0x3f')]:undefined)||0x14}];case'multibar-chart':case _0x924d('0x4c'):return[{'name':_0x924d('0x4d'),'value':_0x5d808[_0x924d('0x4d')]||(_0x5d808[_0x924d('0x3e')]&&_0x5d808[_0x924d('0x3e')][0x0]?_0x5d808[_0x924d('0x3e')][0x0][_0x924d('0x3f')]:undefined)||'total'},{'name':_0x924d('0x4e'),'value':_0x5d808[_0x924d('0x4e')]||(_0x5d808[_0x924d('0x3e')]&&_0x5d808[_0x924d('0x3e')][0x1]?_0x5d808[_0x924d('0x3e')][0x1][_0x924d('0x3f')]:undefined)||null},{'name':_0x924d('0x4f'),'value':_0x5d808[_0x924d('0x4f')]||(_0x5d808[_0x924d('0x3e')]&&_0x5d808['attrs'][0x2]?_0x5d808[_0x924d('0x3e')][0x2][_0x924d('0x3f')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x5d808[_0x924d('0x4b')]||(_0x5d808[_0x924d('0x3e')]&&_0x5d808[_0x924d('0x3e')][0x3]?_0x5d808['attrs'][0x3][_0x924d('0x3f')]:undefined)||[]}];case _0x924d('0x50'):return[{'name':_0x924d('0x51'),'type':_0x5d808['reportType']||(_0x5d808[_0x924d('0x3e')]&&_0x5d808[_0x924d('0x3e')][0x0]?_0x5d808[_0x924d('0x3e')][0x0][_0x924d('0x3b')]:undefined)||null,'value':_0x5d808[_0x924d('0x51')]||(_0x5d808[_0x924d('0x3e')]&&_0x5d808[_0x924d('0x3e')][0x0]?_0x5d808[_0x924d('0x3e')][0x0][_0x924d('0x3f')]:undefined)||null},{'name':_0x924d('0x52'),'value':_0x5d808[_0x924d('0x52')]||(_0x5d808[_0x924d('0x3e')]&&_0x5d808['attrs'][0x1]?_0x5d808[_0x924d('0x3e')][0x1][_0x924d('0x3f')]:undefined)||0x0}];default:return[];}}catch(_0x18f271){logger[_0x924d('0x29')](_0x924d('0x53'),JSON[_0x924d('0x54')](_0x18f271));return[];}}exports['create']=function(_0x5c87cb,_0x10888d){if(_0x5c87cb[_0x924d('0x55')]){_0x5c87cb[_0x924d('0x55')][_0x924d('0x3e')]=widgetAttributes(_0x5c87cb[_0x924d('0x55')]);}return db[_0x924d('0x37')][_0x924d('0x56')](_0x5c87cb[_0x924d('0x55')],{})[_0x924d('0x39')](respondWithResult(_0x10888d,0xc9))[_0x924d('0x3a')](handleError(_0x10888d,null));};exports['update']=function(_0x46631c,_0x26380e){if(_0x46631c[_0x924d('0x55')]['id']){delete _0x46631c[_0x924d('0x55')]['id'];}_0x46631c[_0x924d('0x55')][_0x924d('0x3e')]=widgetAttributes(_0x46631c[_0x924d('0x55')]);return db[_0x924d('0x37')][_0x924d('0x38')]({'where':{'id':_0x46631c['params']['id']}})['then'](handleEntityNotFound(_0x26380e,null))['then'](saveUpdates(_0x46631c[_0x924d('0x55')],null))['then'](respondWithResult(_0x26380e,null))[_0x924d('0x3a')](handleError(_0x26380e,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 20f51e3..9dcc7b3 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 _0x08b7=['DashboardItem','save','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x53afe9,_0x2c9f40){var _0x396396=function(_0x1f574d){while(--_0x1f574d){_0x53afe9['push'](_0x53afe9['shift']());}};_0x396396(++_0x2c9f40);}(_0x08b7,0xce));var _0x708b=function(_0x3a4489,_0x5e04a6){_0x3a4489=_0x3a4489-0x0;var _0x5c6b51=_0x08b7[_0x3a4489];return _0x5c6b51;};'use strict';var EventEmitter=require(_0x708b('0x0'));var DashboardItem=require(_0x708b('0x1'))['db'][_0x708b('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x708b('0x3'),'afterUpdate':'update','afterDestroy':_0x708b('0x4')};function emitEvent(_0x563db7){return function(_0x533931,_0xebeb7d,_0x5cca13){DashboardItemEvents[_0x708b('0x5')](_0x563db7+':'+_0x533931['id'],_0x533931);DashboardItemEvents[_0x708b('0x5')](_0x563db7,_0x533931);_0x5cca13(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x708b('0x6')](e,emitEvent(event));}}module[_0x708b('0x7')]=DashboardItemEvents; \ No newline at end of file +var _0x02df=['hook','exports','events','../../mysqldb','DashboardItem','save','update','emit','hasOwnProperty'];(function(_0x4618bd,_0x489933){var _0x4f98eb=function(_0x31f84b){while(--_0x31f84b){_0x4618bd['push'](_0x4618bd['shift']());}};_0x4f98eb(++_0x489933);}(_0x02df,0x6e));var _0xf02d=function(_0x3cc6fb,_0x4b9fa3){_0x3cc6fb=_0x3cc6fb-0x0;var _0x14c29f=_0x02df[_0x3cc6fb];return _0x14c29f;};'use strict';var EventEmitter=require(_0xf02d('0x0'));var DashboardItem=require(_0xf02d('0x1'))['db'][_0xf02d('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf02d('0x3'),'afterUpdate':_0xf02d('0x4'),'afterDestroy':'remove'};function emitEvent(_0x363dbc){return function(_0x888d15,_0x513e09,_0x221f62){DashboardItemEvents[_0xf02d('0x5')](_0x363dbc+':'+_0x888d15['id'],_0x888d15);DashboardItemEvents['emit'](_0x363dbc,_0x888d15);_0x221f62(null);};}for(var e in events){if(events[_0xf02d('0x6')](e)){var event=events[e];DashboardItem[_0xf02d('0x7')](e,emitEvent(event));}}module[_0xf02d('0x8')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index fc0e6b9..74ea9d3 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 _0xbf18=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','DashboardItem'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0xbf18,0xfa));var _0x8bf1=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbf18[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8bf1('0x0'))(_0x8bf1('0x1'));var moment=require(_0x8bf1('0x2'));var BPromise=require(_0x8bf1('0x3'));var rp=require(_0x8bf1('0x4'));var fs=require('fs');var path=require(_0x8bf1('0x5'));var rimraf=require(_0x8bf1('0x6'));var config=require(_0x8bf1('0x7'));var attributes=require('./dashboardItem.attributes');module['exports']=function(_0x39a737,_0x420f67){return _0x39a737[_0x8bf1('0x8')](_0x8bf1('0x9'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeb4f=['util','../../config/logger','api','moment','request-promise','./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items','lodash'];(function(_0x48ec41,_0x2dd2c2){var _0x2d5cdc=function(_0x4d3c1c){while(--_0x4d3c1c){_0x48ec41['push'](_0x48ec41['shift']());}};_0x2d5cdc(++_0x2dd2c2);}(_0xeb4f,0x133));var _0xfeb4=function(_0x6f78e,_0x5362b0){_0x6f78e=_0x6f78e-0x0;var _0x347826=_0xeb4f[_0x6f78e];return _0x347826;};'use strict';var _=require(_0xfeb4('0x0'));var util=require(_0xfeb4('0x1'));var logger=require(_0xfeb4('0x2'))(_0xfeb4('0x3'));var moment=require(_0xfeb4('0x4'));var BPromise=require('bluebird');var rp=require(_0xfeb4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfeb4('0x6'));module[_0xfeb4('0x7')]=function(_0x5c4933,_0x5c55c0){return _0x5c4933[_0xfeb4('0x8')](_0xfeb4('0x9'),attributes,{'tableName':_0xfeb4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index fd288a5..e856168 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 _0x0cc9=['error','message','result','catch','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','defaults','socket.io-emitter','./dashboardItem.socket','register','info','DashboardItem,\x20%s,\x20%s','request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x41985f,_0xf75926){var _0x27d655=function(_0x33bad1){while(--_0x33bad1){_0x41985f['push'](_0x41985f['shift']());}};_0x27d655(++_0xf75926);}(_0x0cc9,0x115));var _0x90cc=function(_0x4b2494,_0x494d41){_0x4b2494=_0x4b2494-0x0;var _0x2c1436=_0x0cc9[_0x4b2494];return _0x2c1436;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x90cc('0x0'));var BPromise=require('bluebird');var rs=require(_0x90cc('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x90cc('0x2'))['db'];var utils=require(_0x90cc('0x3'));var logger=require(_0x90cc('0x4'))(_0x90cc('0x5'));var config=require(_0x90cc('0x6'));var jayson=require(_0x90cc('0x7'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x90cc('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x90cc('0x9'))(new Redis(config['redis']));require(_0x90cc('0xa'))[_0x90cc('0xb')](socket);function respondWithRpcPromise(_0x326eb7,_0x5e229f,_0x3abc5d){return new BPromise(function(_0x4be64c,_0x22f45c){return client['request'](_0x326eb7,_0x3abc5d)['then'](function(_0x2c2c2c){logger[_0x90cc('0xc')](_0x90cc('0xd'),_0x5e229f,_0x90cc('0xe'));logger['debug'](_0x90cc('0xf'),_0x5e229f,_0x90cc('0xe'),JSON[_0x90cc('0x10')](_0x2c2c2c));if(_0x2c2c2c[_0x90cc('0x11')]){if(_0x2c2c2c['error']['code']===0x1f4){logger[_0x90cc('0x11')]('DashboardItem,\x20%s,\x20%s',_0x5e229f,_0x2c2c2c[_0x90cc('0x11')][_0x90cc('0x12')]);return _0x22f45c(_0x2c2c2c[_0x90cc('0x11')]['message']);}logger[_0x90cc('0x11')](_0x90cc('0xd'),_0x5e229f,_0x2c2c2c[_0x90cc('0x11')][_0x90cc('0x12')]);return _0x4be64c(_0x2c2c2c[_0x90cc('0x11')]['message']);}else{logger[_0x90cc('0xc')](_0x90cc('0xd'),_0x5e229f,_0x90cc('0xe'));_0x4be64c(_0x2c2c2c[_0x90cc('0x13')][_0x90cc('0x12')]);}})[_0x90cc('0x14')](function(_0x1be246){logger[_0x90cc('0x11')]('DashboardItem,\x20%s,\x20%s',_0x5e229f,_0x1be246);_0x22f45c(_0x1be246);});});} \ No newline at end of file +var _0x4fb5=['debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent'];(function(_0x2c851c,_0x625231){var _0x5fa917=function(_0x4f663c){while(--_0x4f663c){_0x2c851c['push'](_0x2c851c['shift']());}};_0x5fa917(++_0x625231);}(_0x4fb5,0x1c7));var _0x54fb=function(_0x2f1762,_0xab43df){_0x2f1762=_0x2f1762-0x0;var _0x8ab21=_0x4fb5[_0x2f1762];return _0x8ab21;};'use strict';var _=require('lodash');var util=require(_0x54fb('0x0'));var moment=require('moment');var BPromise=require(_0x54fb('0x1'));var rs=require(_0x54fb('0x2'));var fs=require('fs');var Redis=require(_0x54fb('0x3'));var db=require(_0x54fb('0x4'))['db'];var utils=require(_0x54fb('0x5'));var logger=require(_0x54fb('0x6'))(_0x54fb('0x7'));var config=require(_0x54fb('0x8'));var jayson=require(_0x54fb('0x9'));var client=jayson[_0x54fb('0xa')]['http']({'port':0x232a});config[_0x54fb('0xb')]=_[_0x54fb('0xc')](config[_0x54fb('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x54fb('0xd'))(new Redis(config[_0x54fb('0xb')]));require(_0x54fb('0xe'))[_0x54fb('0xf')](socket);function respondWithRpcPromise(_0x89c1b6,_0x4146b6,_0x36f065){return new BPromise(function(_0x521098,_0x250985){return client[_0x54fb('0x10')](_0x89c1b6,_0x36f065)[_0x54fb('0x11')](function(_0xa92bd){logger[_0x54fb('0x12')](_0x54fb('0x13'),_0x4146b6,_0x54fb('0x14'));logger[_0x54fb('0x15')](_0x54fb('0x16'),_0x4146b6,_0x54fb('0x14'),JSON[_0x54fb('0x17')](_0xa92bd));if(_0xa92bd[_0x54fb('0x18')]){if(_0xa92bd[_0x54fb('0x18')][_0x54fb('0x19')]===0x1f4){logger[_0x54fb('0x18')]('DashboardItem,\x20%s,\x20%s',_0x4146b6,_0xa92bd[_0x54fb('0x18')][_0x54fb('0x1a')]);return _0x250985(_0xa92bd[_0x54fb('0x18')][_0x54fb('0x1a')]);}logger['error'](_0x54fb('0x13'),_0x4146b6,_0xa92bd['error'][_0x54fb('0x1a')]);return _0x521098(_0xa92bd[_0x54fb('0x18')][_0x54fb('0x1a')]);}else{logger[_0x54fb('0x12')](_0x54fb('0x13'),_0x4146b6,_0x54fb('0x14'));_0x521098(_0xa92bd['result'][_0x54fb('0x1a')]);}})[_0x54fb('0x1b')](function(_0x10fb8c){logger[_0x54fb('0x18')](_0x54fb('0x13'),_0x4146b6,_0x10fb8c);_0x250985(_0x10fb8c);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index b0a5bac..225a972 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 _0xb14b=['length','dashboardItem:','./dashboardItem.events','remove','update','emit','removeListener','register'];(function(_0x825179,_0xc9870d){var _0x87f77d=function(_0x186eb6){while(--_0x186eb6){_0x825179['push'](_0x825179['shift']());}};_0x87f77d(++_0xc9870d);}(_0xb14b,0x16a));var _0xbb14=function(_0x5d2d3b,_0x173170){_0x5d2d3b=_0x5d2d3b-0x0;var _0x11afcd=_0xb14b[_0x5d2d3b];return _0x11afcd;};'use strict';var DashboardItemEvents=require(_0xbb14('0x0'));var events=['save',_0xbb14('0x1'),_0xbb14('0x2')];function createListener(_0x9c8096,_0x27d910){return function(_0x235911){_0x27d910[_0xbb14('0x3')](_0x9c8096,_0x235911);};}function removeListener(_0x5d1327,_0x387aa2){return function(){DashboardItemEvents[_0xbb14('0x4')](_0x5d1327,_0x387aa2);};}exports[_0xbb14('0x5')]=function(_0x1ccaf8){for(var _0x551d46=0x0,_0x406fa2=events[_0xbb14('0x6')];_0x551d46<_0x406fa2;_0x551d46++){var _0x48e725=events[_0x551d46];var _0x3d43ee=createListener(_0xbb14('0x7')+_0x48e725,_0x1ccaf8);DashboardItemEvents['on'](_0x48e725,_0x3d43ee);}}; \ No newline at end of file +var _0x4c09=['removeListener','register','length','dashboardItem:','update','emit'];(function(_0xc4dbb9,_0x51bb9b){var _0x37aa76=function(_0x2b1c70){while(--_0x2b1c70){_0xc4dbb9['push'](_0xc4dbb9['shift']());}};_0x37aa76(++_0x51bb9b);}(_0x4c09,0x184));var _0x94c0=function(_0x819ce,_0xf25f51){_0x819ce=_0x819ce-0x0;var _0x1edcf0=_0x4c09[_0x819ce];return _0x1edcf0;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=['save','remove',_0x94c0('0x0')];function createListener(_0x596e68,_0x112715){return function(_0x35c7d7){_0x112715[_0x94c0('0x1')](_0x596e68,_0x35c7d7);};}function removeListener(_0x13cf02,_0xcc1763){return function(){DashboardItemEvents[_0x94c0('0x2')](_0x13cf02,_0xcc1763);};}exports[_0x94c0('0x3')]=function(_0x14d09a){for(var _0x3632c8=0x0,_0x21173b=events[_0x94c0('0x4')];_0x3632c8<_0x21173b;_0x3632c8++){var _0x36a973=events[_0x3632c8];var _0x4d93fe=createListener(_0x94c0('0x5')+_0x36a973,_0x14d09a);DashboardItemEvents['on'](_0x36a973,_0x4d93fe);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index ca0883e..1133063 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 _0x17d2=['multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./dashboardItem.controller','/:id','show','post','create','isAuthenticated','update','delete','destroy','exports'];(function(_0x6dbba,_0x587edf){var _0x46bb01=function(_0x516bfb){while(--_0x516bfb){_0x6dbba['push'](_0x6dbba['shift']());}};_0x46bb01(++_0x587edf);}(_0x17d2,0x66));var _0x217d=function(_0x17b6b4,_0x42ab53){_0x17b6b4=_0x17b6b4-0x0;var _0xcd5aa3=_0x17d2[_0x17b6b4];return _0xcd5aa3;};'use strict';var multer=require(_0x217d('0x0'));var util=require(_0x217d('0x1'));var path=require('path');var timeout=require(_0x217d('0x2'));var express=require(_0x217d('0x3'));var router=express[_0x217d('0x4')]();var fs_extra=require(_0x217d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x217d('0x6'));var config=require('../../config/environment');var controller=require(_0x217d('0x7'));router['get'](_0x217d('0x8'),auth['isAuthenticated'](),controller[_0x217d('0x9')]);router[_0x217d('0xa')]('/',auth['isAuthenticated'](),controller[_0x217d('0xb')]);router['put'](_0x217d('0x8'),auth[_0x217d('0xc')](),controller[_0x217d('0xd')]);router[_0x217d('0xe')](_0x217d('0x8'),auth[_0x217d('0xc')](),controller[_0x217d('0xf')]);module[_0x217d('0x10')]=router; \ No newline at end of file +var _0xe910=['path','fs-extra','../../components/interaction/service','../../config/environment','./dashboardItem.controller','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','multer','util'];(function(_0x2904ad,_0x25177c){var _0x1e15eb=function(_0x4a7ce1){while(--_0x4a7ce1){_0x2904ad['push'](_0x2904ad['shift']());}};_0x1e15eb(++_0x25177c);}(_0xe910,0x7e));var _0x0e91=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xe910[_0x173441];return _0x2423a8;};'use strict';var multer=require(_0x0e91('0x0'));var util=require(_0x0e91('0x1'));var path=require(_0x0e91('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x0e91('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x0e91('0x4'));var config=require(_0x0e91('0x5'));var controller=require(_0x0e91('0x6'));router['get'](_0x0e91('0x7'),auth[_0x0e91('0x8')](),controller[_0x0e91('0x9')]);router[_0x0e91('0xa')]('/',auth[_0x0e91('0x8')](),controller[_0x0e91('0xb')]);router[_0x0e91('0xc')]('/:id',auth[_0x0e91('0x8')](),controller[_0x0e91('0xd')]);router[_0x0e91('0xe')](_0x0e91('0x7'),auth['isAuthenticated'](),controller[_0x0e91('0xf')]);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 3a2ff01..02042f9 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 _0x89ea=['third','STRING','first','second'];(function(_0xda464c,_0x26e47d){var _0x19e222=function(_0x1ec605){while(--_0x1ec605){_0xda464c['push'](_0xda464c['shift']());}};_0x19e222(++_0x26e47d);}(_0x89ea,0xd1));var _0xa89e=function(_0x127187,_0x4f7f5c){_0x127187=_0x127187-0x0;var _0xcb9e8e=_0x89ea[_0x127187];return _0xcb9e8e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xa89e('0x0')],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0xa89e('0x1'),_0xa89e('0x2'),_0xa89e('0x3')),'allowNull':![],'defaultValue':_0xa89e('0x1')},'description':{'type':Sequelize[_0xa89e('0x0')]}}; \ No newline at end of file +var _0xd268=['STRING','ENUM','second','third','first','exports'];(function(_0x1452ea,_0x101594){var _0x145f59=function(_0x300441){while(--_0x300441){_0x1452ea['push'](_0x1452ea['shift']());}};_0x145f59(++_0x101594);}(_0xd268,0x89));var _0x8d26=function(_0x550c80,_0x244067){_0x550c80=_0x550c80-0x0;var _0x46348e=_0xd268[_0x550c80];return _0x46348e;};'use strict';var Sequelize=require('sequelize');module[_0x8d26('0x0')]={'name':{'type':Sequelize[_0x8d26('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0x8d26('0x2')]('first',_0x8d26('0x3'),_0x8d26('0x4')),'allowNull':![],'defaultValue':_0x8d26('0x5')},'description':{'type':Sequelize[_0x8d26('0x1')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 198ade2..e31fdbb 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 _0x563e=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','get','end','error','name','send','index','map','Disposition','rawAttributes','type','key','keys','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','catch','create','body','user','role','Dispositions','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','querystring','papaparse'];(function(_0x5c69e9,_0x31ed88){var _0x5135ee=function(_0x27084f){while(--_0x27084f){_0x5c69e9['push'](_0x5c69e9['shift']());}};_0x5135ee(++_0x31ed88);}(_0x563e,0x1cb));var _0xe563=function(_0x1fc122,_0x5e2c17){_0x1fc122=_0x1fc122-0x0;var _0xa2cb13=_0x563e[_0x1fc122];return _0xa2cb13;};'use strict';var emlformat=require(_0xe563('0x0'));var rimraf=require(_0xe563('0x1'));var zipdir=require(_0xe563('0x2'));var jsonpatch=require(_0xe563('0x3'));var rp=require('request-promise');var moment=require(_0xe563('0x4'));var BPromise=require(_0xe563('0x5'));var Mustache=require(_0xe563('0x6'));var util=require('util');var path=require(_0xe563('0x7'));var sox=require(_0xe563('0x8'));var csv=require(_0xe563('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe563('0xa'));var _=require(_0xe563('0xb'));var squel=require('squel');var crypto=require(_0xe563('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe563('0x9'));var querystring=require(_0xe563('0xd'));var Papa=require(_0xe563('0xe'));var Redis=require('ioredis');var authService=require(_0xe563('0xf'));var qs=require(_0xe563('0x10'));var as=require(_0xe563('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe563('0x12'))(_0xe563('0x13'));var utils=require('../../config/utils');var config=require(_0xe563('0x14'));var licenseUtil=require(_0xe563('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x7bac66,_0x1e12cd){_0x1e12cd=_0x1e12cd||0xcc;return function(_0x3c4405){if(_0x3c4405){return _0x7bac66[_0xe563('0x16')](_0x1e12cd);}return _0x7bac66[_0xe563('0x17')](_0x1e12cd)['end']();};}function respondWithResult(_0x19dc27,_0x2fe460){_0x2fe460=_0x2fe460||0xc8;return function(_0x18fcb1){if(_0x18fcb1){return _0x19dc27[_0xe563('0x17')](_0x2fe460)[_0xe563('0x18')](_0x18fcb1);}};}function respondWithFilteredResult(_0x11de16,_0x127535){return function(_0x5e46f9){if(_0x5e46f9){var _0x23d8f4=typeof _0x127535[_0xe563('0x19')]===_0xe563('0x1a')&&typeof _0x127535[_0xe563('0x1b')]===_0xe563('0x1a');var _0x592006=_0x5e46f9[_0xe563('0x1c')];var _0x46907a=_0x23d8f4?0x0:_0x127535[_0xe563('0x19')];var _0x259617=_0x23d8f4?_0x5e46f9[_0xe563('0x1c')]:_0x127535[_0xe563('0x19')]+_0x127535[_0xe563('0x1b')];var _0x1e414e;if(_0x259617>=_0x592006){_0x259617=_0x592006;_0x1e414e=0xc8;}else{_0x1e414e=0xce;}_0x11de16[_0xe563('0x17')](_0x1e414e);return _0x11de16[_0xe563('0x1d')](_0xe563('0x1e'),_0x46907a+'-'+_0x259617+'/'+_0x592006)[_0xe563('0x18')](_0x5e46f9);}return null;};}function patchUpdates(_0x348e33){return function(_0x29ac77){try{jsonpatch['apply'](_0x29ac77,_0x348e33,!![]);}catch(_0x55df73){return BPromise['reject'](_0x55df73);}return _0x29ac77[_0xe563('0x1f')]();};}function saveUpdates(_0x42320c,_0x3ec92d){return function(_0x1c8e78){if(_0x1c8e78){return _0x1c8e78[_0xe563('0x20')](_0x42320c)[_0xe563('0x21')](function(_0x3989c6){return _0x3989c6;});}return null;};}function removeEntity(_0x32f92b,_0x1fbd02){return function(_0x5b2440){if(_0x5b2440){return _0x5b2440[_0xe563('0x22')]()[_0xe563('0x21')](function(){var _0x489346=_0x5b2440[_0xe563('0x23')]({'plain':!![]});var _0x1ec6a6='Dispositions';return db['UserProfileResource'][_0xe563('0x22')]({'where':{'type':_0x1ec6a6,'resourceId':_0x489346['id']}})[_0xe563('0x21')](function(){return _0x5b2440;});})['then'](function(){_0x32f92b['status'](0xcc)[_0xe563('0x24')]();});}};}function handleEntityNotFound(_0x8d1001,_0x99688e){return function(_0x539ee9){if(!_0x539ee9){_0x8d1001['sendStatus'](0x194);}return _0x539ee9;};}function handleError(_0x2d1291,_0x1df770){_0x1df770=_0x1df770||0x1f4;return function(_0x500f22){logger[_0xe563('0x25')](_0x500f22['stack']);if(_0x500f22['name']){delete _0x500f22[_0xe563('0x26')];}_0x2d1291[_0xe563('0x17')](_0x1df770)[_0xe563('0x27')](_0x500f22);};}exports[_0xe563('0x28')]=function(_0x33a9eb,_0x2b3afe){var _0x34d661={},_0x3c37a6={},_0x158b60={'count':0x0,'rows':[]};var _0x3bbdb3=_[_0xe563('0x29')](db[_0xe563('0x2a')][_0xe563('0x2b')],function(_0xb2e70){return{'name':_0xb2e70['fieldName'],'type':_0xb2e70[_0xe563('0x2c')][_0xe563('0x2d')]};});_0x3c37a6['model']=_[_0xe563('0x29')](_0x3bbdb3,_0xe563('0x26'));_0x3c37a6['query']=_[_0xe563('0x2e')](_0x33a9eb[_0xe563('0x2f')]);_0x3c37a6['filters']=_[_0xe563('0x30')](_0x3c37a6['model'],_0x3c37a6[_0xe563('0x2f')]);_0x34d661[_0xe563('0x31')]=_[_0xe563('0x30')](_0x3c37a6[_0xe563('0x32')],qs['fields'](_0x33a9eb[_0xe563('0x2f')][_0xe563('0x33')]));_0x34d661[_0xe563('0x31')]=_0x34d661['attributes'][_0xe563('0x34')]?_0x34d661[_0xe563('0x31')]:_0x3c37a6['model'];if(!_0x33a9eb[_0xe563('0x2f')][_0xe563('0x35')](_0xe563('0x36'))){_0x34d661[_0xe563('0x1b')]=qs[_0xe563('0x1b')](_0x33a9eb[_0xe563('0x2f')][_0xe563('0x1b')]);_0x34d661[_0xe563('0x19')]=qs[_0xe563('0x19')](_0x33a9eb[_0xe563('0x2f')][_0xe563('0x19')]);}_0x34d661[_0xe563('0x37')]=qs[_0xe563('0x38')](_0x33a9eb['query'][_0xe563('0x38')]);_0x34d661[_0xe563('0x39')]=qs[_0xe563('0x3a')](_[_0xe563('0x3b')](_0x33a9eb[_0xe563('0x2f')],_0x3c37a6[_0xe563('0x3a')]),_0x3bbdb3);if(_0x33a9eb[_0xe563('0x2f')][_0xe563('0x3c')]){_0x34d661[_0xe563('0x39')]=_[_0xe563('0x3d')](_0x34d661[_0xe563('0x39')],{'$or':_[_0xe563('0x29')](_0x3bbdb3,function(_0x30d1b8){if(_0x30d1b8['type']!==_0xe563('0x3e')){var _0x459213={};_0x459213[_0x30d1b8['name']]={'$like':'%'+_0x33a9eb['query'][_0xe563('0x3c')]+'%'};return _0x459213;}})});}_0x34d661=_['merge']({},_0x34d661,_0x33a9eb[_0xe563('0x3f')]);var _0x17a541={'where':_0x34d661['where']};return db[_0xe563('0x2a')][_0xe563('0x1c')](_0x17a541)[_0xe563('0x21')](function(_0x2c4e3d){_0x158b60[_0xe563('0x1c')]=_0x2c4e3d;if(_0x33a9eb[_0xe563('0x2f')][_0xe563('0x40')]){_0x34d661[_0xe563('0x41')]=[{'all':!![]}];}return db[_0xe563('0x2a')][_0xe563('0x42')](_0x34d661);})[_0xe563('0x21')](function(_0x34f660){_0x158b60['rows']=_0x34f660;return _0x158b60;})[_0xe563('0x21')](respondWithFilteredResult(_0x2b3afe,_0x34d661))['catch'](handleError(_0x2b3afe,null));};exports[_0xe563('0x43')]=function(_0x36d621,_0xb1b114){var _0x113edb={'raw':!![],'where':{'id':_0x36d621[_0xe563('0x44')]['id']}},_0x198cca={};_0x198cca[_0xe563('0x32')]=_[_0xe563('0x2e')](db[_0xe563('0x2a')][_0xe563('0x2b')]);_0x198cca[_0xe563('0x2f')]=_[_0xe563('0x2e')](_0x36d621[_0xe563('0x2f')]);_0x198cca[_0xe563('0x3a')]=_[_0xe563('0x30')](_0x198cca[_0xe563('0x32')],_0x198cca[_0xe563('0x2f')]);_0x113edb[_0xe563('0x31')]=_[_0xe563('0x30')](_0x198cca[_0xe563('0x32')],qs[_0xe563('0x33')](_0x36d621['query']['fields']));_0x113edb[_0xe563('0x31')]=_0x113edb[_0xe563('0x31')][_0xe563('0x34')]?_0x113edb['attributes']:_0x198cca[_0xe563('0x32')];if(_0x36d621[_0xe563('0x2f')][_0xe563('0x40')]){_0x113edb[_0xe563('0x41')]=[{'all':!![]}];}_0x113edb=_[_0xe563('0x3d')]({},_0x113edb,_0x36d621[_0xe563('0x3f')]);return db[_0xe563('0x2a')]['find'](_0x113edb)['then'](handleEntityNotFound(_0xb1b114,null))[_0xe563('0x21')](respondWithResult(_0xb1b114,null))[_0xe563('0x45')](handleError(_0xb1b114,null));};exports[_0xe563('0x46')]=function(_0x361dd8,_0x44e380){return db[_0xe563('0x2a')][_0xe563('0x46')](_0x361dd8[_0xe563('0x47')],{})[_0xe563('0x21')](function(_0x5b4e5d){var _0x8c570f=_0x361dd8[_0xe563('0x48')][_0xe563('0x23')]({'plain':!![]});if(!_0x8c570f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x8c570f[_0xe563('0x49')]==='user'){var _0xd4536d=_0x5b4e5d[_0xe563('0x23')]({'plain':!![]});var _0x11c497=_0xe563('0x4a');return db['UserProfileSection'][_0xe563('0x4b')]({'where':{'name':_0x11c497,'userProfileId':_0x8c570f[_0xe563('0x4c')]},'raw':!![]})[_0xe563('0x21')](function(_0xaced62){if(_0xaced62&&_0xaced62[_0xe563('0x4d')]===0x0){return db['UserProfileResource'][_0xe563('0x46')]({'name':_0xd4536d['name'],'resourceId':_0xd4536d['id'],'type':_0xaced62[_0xe563('0x26')],'sectionId':_0xaced62['id']},{})[_0xe563('0x21')](function(){return _0x5b4e5d;});}else{return _0x5b4e5d;}})['catch'](function(_0x517ae5){logger['error'](_0xe563('0x4e'),_0x517ae5);throw _0x517ae5;});}return _0x5b4e5d;})['then'](respondWithResult(_0x44e380,0xc9))[_0xe563('0x45')](handleError(_0x44e380,null));};exports[_0xe563('0x20')]=function(_0x6453f8,_0x2d0c19){if(_0x6453f8[_0xe563('0x47')]['id']){delete _0x6453f8[_0xe563('0x47')]['id'];}return db[_0xe563('0x2a')]['find']({'where':{'id':_0x6453f8[_0xe563('0x44')]['id']}})[_0xe563('0x21')](handleEntityNotFound(_0x2d0c19,null))[_0xe563('0x21')](saveUpdates(_0x6453f8[_0xe563('0x47')],null))[_0xe563('0x21')](respondWithResult(_0x2d0c19,null))[_0xe563('0x45')](handleError(_0x2d0c19,null));};exports[_0xe563('0x22')]=function(_0x2bff52,_0x361c9f){return db[_0xe563('0x2a')]['find']({'where':{'id':_0x2bff52[_0xe563('0x44')]['id']}})[_0xe563('0x21')](handleEntityNotFound(_0x361c9f,null))[_0xe563('0x21')](removeEntity(_0x361c9f,null))[_0xe563('0x45')](handleError(_0x361c9f,null));}; \ No newline at end of file +var _0x2c8f=['error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','UserProfileResource','stack','index','Disposition','rawAttributes','fieldName','type','key','map','query','filters','intersection','model','fields','attributes','length','sort','filter','merge','name','options','where','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Dispositions','UserProfileSection','autoAssociation'];(function(_0x2b60f6,_0x22664b){var _0x212ce6=function(_0x386cb6){while(--_0x386cb6){_0x2b60f6['push'](_0x2b60f6['shift']());}};_0x212ce6(++_0x22664b);}(_0x2c8f,0x192));var _0xf2c8=function(_0x324653,_0xa425d){_0x324653=_0x324653-0x0;var _0x1116a9=_0x2c8f[_0x324653];return _0x1116a9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf2c8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf2c8('0x1'));var BPromise=require(_0xf2c8('0x2'));var Mustache=require(_0xf2c8('0x3'));var util=require('util');var path=require('path');var sox=require(_0xf2c8('0x4'));var csv=require(_0xf2c8('0x5'));var ejs=require(_0xf2c8('0x6'));var fs=require('fs');var fs_extra=require(_0xf2c8('0x7'));var _=require(_0xf2c8('0x8'));var squel=require('squel');var crypto=require(_0xf2c8('0x9'));var jsforce=require(_0xf2c8('0xa'));var deskjs=require(_0xf2c8('0xb'));var toCsv=require(_0xf2c8('0x5'));var querystring=require(_0xf2c8('0xc'));var Papa=require(_0xf2c8('0xd'));var Redis=require('ioredis');var authService=require(_0xf2c8('0xe'));var qs=require(_0xf2c8('0xf'));var as=require(_0xf2c8('0x10'));var hardwareService=require(_0xf2c8('0x11'));var logger=require(_0xf2c8('0x12'))(_0xf2c8('0x13'));var utils=require(_0xf2c8('0x14'));var config=require(_0xf2c8('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xf2c8('0x16'))['db'];function respondWithStatusCode(_0x5ce572,_0x10bc2c){_0x10bc2c=_0x10bc2c||0xcc;return function(_0x16b7a4){if(_0x16b7a4){return _0x5ce572[_0xf2c8('0x17')](_0x10bc2c);}return _0x5ce572[_0xf2c8('0x18')](_0x10bc2c)[_0xf2c8('0x19')]();};}function respondWithResult(_0x40849c,_0x54dd36){_0x54dd36=_0x54dd36||0xc8;return function(_0x3b86f0){if(_0x3b86f0){return _0x40849c[_0xf2c8('0x18')](_0x54dd36)[_0xf2c8('0x1a')](_0x3b86f0);}};}function respondWithFilteredResult(_0x34f9b1,_0x3ed09e){return function(_0x383af2){if(_0x383af2){var _0x1b8c5b=typeof _0x3ed09e['offset']===_0xf2c8('0x1b')&&typeof _0x3ed09e[_0xf2c8('0x1c')]===_0xf2c8('0x1b');var _0x31b8e0=_0x383af2[_0xf2c8('0x1d')];var _0x52e9d0=_0x1b8c5b?0x0:_0x3ed09e['offset'];var _0x104d9d=_0x1b8c5b?_0x383af2[_0xf2c8('0x1d')]:_0x3ed09e[_0xf2c8('0x1e')]+_0x3ed09e[_0xf2c8('0x1c')];var _0x516d99;if(_0x104d9d>=_0x31b8e0){_0x104d9d=_0x31b8e0;_0x516d99=0xc8;}else{_0x516d99=0xce;}_0x34f9b1[_0xf2c8('0x18')](_0x516d99);return _0x34f9b1[_0xf2c8('0x1f')](_0xf2c8('0x20'),_0x52e9d0+'-'+_0x104d9d+'/'+_0x31b8e0)['json'](_0x383af2);}return null;};}function patchUpdates(_0x4442f9){return function(_0x31008e){try{jsonpatch['apply'](_0x31008e,_0x4442f9,!![]);}catch(_0x5b1e44){return BPromise[_0xf2c8('0x21')](_0x5b1e44);}return _0x31008e[_0xf2c8('0x22')]();};}function saveUpdates(_0x98f9cb,_0x57affa){return function(_0xd2e728){if(_0xd2e728){return _0xd2e728[_0xf2c8('0x23')](_0x98f9cb)[_0xf2c8('0x24')](function(_0x239350){return _0x239350;});}return null;};}function removeEntity(_0x4ba1e0,_0x17956f){return function(_0xe5ff6c){if(_0xe5ff6c){return _0xe5ff6c[_0xf2c8('0x25')]()[_0xf2c8('0x24')](function(){var _0x16938e=_0xe5ff6c['get']({'plain':!![]});var _0x93707c='Dispositions';return db[_0xf2c8('0x26')][_0xf2c8('0x25')]({'where':{'type':_0x93707c,'resourceId':_0x16938e['id']}})[_0xf2c8('0x24')](function(){return _0xe5ff6c;});})[_0xf2c8('0x24')](function(){_0x4ba1e0[_0xf2c8('0x18')](0xcc)[_0xf2c8('0x19')]();});}};}function handleEntityNotFound(_0x3ffd20,_0x132343){return function(_0x33f1b0){if(!_0x33f1b0){_0x3ffd20[_0xf2c8('0x17')](0x194);}return _0x33f1b0;};}function handleError(_0xf17065,_0x20af1e){_0x20af1e=_0x20af1e||0x1f4;return function(_0x311349){logger['error'](_0x311349[_0xf2c8('0x27')]);if(_0x311349['name']){delete _0x311349['name'];}_0xf17065[_0xf2c8('0x18')](_0x20af1e)['send'](_0x311349);};}exports[_0xf2c8('0x28')]=function(_0x3b7e23,_0x23de17){var _0x10c825={},_0x123b45={},_0x12a547={'count':0x0,'rows':[]};var _0x27a7dc=_['map'](db[_0xf2c8('0x29')][_0xf2c8('0x2a')],function(_0x262f7f){return{'name':_0x262f7f[_0xf2c8('0x2b')],'type':_0x262f7f[_0xf2c8('0x2c')][_0xf2c8('0x2d')]};});_0x123b45['model']=_[_0xf2c8('0x2e')](_0x27a7dc,'name');_0x123b45[_0xf2c8('0x2f')]=_['keys'](_0x3b7e23[_0xf2c8('0x2f')]);_0x123b45[_0xf2c8('0x30')]=_[_0xf2c8('0x31')](_0x123b45[_0xf2c8('0x32')],_0x123b45[_0xf2c8('0x2f')]);_0x10c825['attributes']=_[_0xf2c8('0x31')](_0x123b45[_0xf2c8('0x32')],qs['fields'](_0x3b7e23[_0xf2c8('0x2f')][_0xf2c8('0x33')]));_0x10c825['attributes']=_0x10c825[_0xf2c8('0x34')][_0xf2c8('0x35')]?_0x10c825[_0xf2c8('0x34')]:_0x123b45[_0xf2c8('0x32')];if(!_0x3b7e23[_0xf2c8('0x2f')]['hasOwnProperty']('nolimit')){_0x10c825[_0xf2c8('0x1c')]=qs[_0xf2c8('0x1c')](_0x3b7e23[_0xf2c8('0x2f')][_0xf2c8('0x1c')]);_0x10c825[_0xf2c8('0x1e')]=qs[_0xf2c8('0x1e')](_0x3b7e23[_0xf2c8('0x2f')][_0xf2c8('0x1e')]);}_0x10c825['order']=qs[_0xf2c8('0x36')](_0x3b7e23[_0xf2c8('0x2f')][_0xf2c8('0x36')]);_0x10c825['where']=qs['filters'](_['pick'](_0x3b7e23['query'],_0x123b45[_0xf2c8('0x30')]),_0x27a7dc);if(_0x3b7e23['query'][_0xf2c8('0x37')]){_0x10c825['where']=_[_0xf2c8('0x38')](_0x10c825['where'],{'$or':_['map'](_0x27a7dc,function(_0x5cff24){if(_0x5cff24[_0xf2c8('0x2c')]!=='VIRTUAL'){var _0x4fb2c={};_0x4fb2c[_0x5cff24[_0xf2c8('0x39')]]={'$like':'%'+_0x3b7e23['query'][_0xf2c8('0x37')]+'%'};return _0x4fb2c;}})});}_0x10c825=_[_0xf2c8('0x38')]({},_0x10c825,_0x3b7e23[_0xf2c8('0x3a')]);var _0x30b9bc={'where':_0x10c825[_0xf2c8('0x3b')]};return db[_0xf2c8('0x29')]['count'](_0x30b9bc)['then'](function(_0x200920){_0x12a547['count']=_0x200920;if(_0x3b7e23[_0xf2c8('0x2f')]['includeAll']){_0x10c825[_0xf2c8('0x3c')]=[{'all':!![]}];}return db['Disposition'][_0xf2c8('0x3d')](_0x10c825);})[_0xf2c8('0x24')](function(_0x251e4c){_0x12a547[_0xf2c8('0x3e')]=_0x251e4c;return _0x12a547;})['then'](respondWithFilteredResult(_0x23de17,_0x10c825))[_0xf2c8('0x3f')](handleError(_0x23de17,null));};exports[_0xf2c8('0x40')]=function(_0x511916,_0xb8441d){var _0xa68854={'raw':!![],'where':{'id':_0x511916[_0xf2c8('0x41')]['id']}},_0x262a83={};_0x262a83[_0xf2c8('0x32')]=_[_0xf2c8('0x42')](db[_0xf2c8('0x29')]['rawAttributes']);_0x262a83[_0xf2c8('0x2f')]=_[_0xf2c8('0x42')](_0x511916[_0xf2c8('0x2f')]);_0x262a83[_0xf2c8('0x30')]=_['intersection'](_0x262a83['model'],_0x262a83[_0xf2c8('0x2f')]);_0xa68854[_0xf2c8('0x34')]=_[_0xf2c8('0x31')](_0x262a83['model'],qs[_0xf2c8('0x33')](_0x511916[_0xf2c8('0x2f')]['fields']));_0xa68854['attributes']=_0xa68854[_0xf2c8('0x34')][_0xf2c8('0x35')]?_0xa68854[_0xf2c8('0x34')]:_0x262a83[_0xf2c8('0x32')];if(_0x511916['query'][_0xf2c8('0x43')]){_0xa68854[_0xf2c8('0x3c')]=[{'all':!![]}];}_0xa68854=_[_0xf2c8('0x38')]({},_0xa68854,_0x511916['options']);return db[_0xf2c8('0x29')][_0xf2c8('0x44')](_0xa68854)[_0xf2c8('0x24')](handleEntityNotFound(_0xb8441d,null))['then'](respondWithResult(_0xb8441d,null))[_0xf2c8('0x3f')](handleError(_0xb8441d,null));};exports[_0xf2c8('0x45')]=function(_0x24d4a2,_0x3d90f5){return db[_0xf2c8('0x29')]['create'](_0x24d4a2[_0xf2c8('0x46')],{})['then'](function(_0x495cfb){var _0x168acb=_0x24d4a2[_0xf2c8('0x47')][_0xf2c8('0x48')]({'plain':!![]});if(!_0x168acb)throw new Error(_0xf2c8('0x49'));if(_0x168acb[_0xf2c8('0x4a')]==='user'){var _0x1c7fa5=_0x495cfb[_0xf2c8('0x48')]({'plain':!![]});var _0x34bd47=_0xf2c8('0x4b');return db[_0xf2c8('0x4c')][_0xf2c8('0x44')]({'where':{'name':_0x34bd47,'userProfileId':_0x168acb['userProfileId']},'raw':!![]})['then'](function(_0x2ac7ac){if(_0x2ac7ac&&_0x2ac7ac[_0xf2c8('0x4d')]===0x0){return db[_0xf2c8('0x26')][_0xf2c8('0x45')]({'name':_0x1c7fa5[_0xf2c8('0x39')],'resourceId':_0x1c7fa5['id'],'type':_0x2ac7ac[_0xf2c8('0x39')],'sectionId':_0x2ac7ac['id']},{})[_0xf2c8('0x24')](function(){return _0x495cfb;});}else{return _0x495cfb;}})[_0xf2c8('0x3f')](function(_0x585cd3){logger[_0xf2c8('0x4e')](_0xf2c8('0x4f'),_0x585cd3);throw _0x585cd3;});}return _0x495cfb;})['then'](respondWithResult(_0x3d90f5,0xc9))['catch'](handleError(_0x3d90f5,null));};exports[_0xf2c8('0x23')]=function(_0x36261b,_0x5ac17d){if(_0x36261b[_0xf2c8('0x46')]['id']){delete _0x36261b[_0xf2c8('0x46')]['id'];}return db[_0xf2c8('0x29')]['find']({'where':{'id':_0x36261b[_0xf2c8('0x41')]['id']}})[_0xf2c8('0x24')](handleEntityNotFound(_0x5ac17d,null))[_0xf2c8('0x24')](saveUpdates(_0x36261b[_0xf2c8('0x46')],null))[_0xf2c8('0x24')](respondWithResult(_0x5ac17d,null))[_0xf2c8('0x3f')](handleError(_0x5ac17d,null));};exports[_0xf2c8('0x25')]=function(_0x1b74e2,_0x48709b){return db[_0xf2c8('0x29')][_0xf2c8('0x44')]({'where':{'id':_0x1b74e2[_0xf2c8('0x41')]['id']}})['then'](handleEntityNotFound(_0x48709b,null))['then'](removeEntity(_0x48709b,null))[_0xf2c8('0x3f')](handleError(_0x48709b,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index b6d89b5..d8fa64a 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 _0x6772=['name','ListId','ChatWebsiteId','name_mail','MailAccountId','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','define','tools_dispositions','name_voice'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x6772,0xdb));var _0x2677=function(_0xbcdd9a,_0x29c233){_0xbcdd9a=_0xbcdd9a-0x0;var _0x4f9ca6=_0x6772[_0xbcdd9a];return _0x4f9ca6;};'use strict';var _=require(_0x2677('0x0'));var util=require(_0x2677('0x1'));var logger=require(_0x2677('0x2'))(_0x2677('0x3'));var moment=require(_0x2677('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2677('0x5'));var rimraf=require(_0x2677('0x6'));var config=require(_0x2677('0x7'));var attributes=require('./disposition.attributes');module['exports']=function(_0x565c37,_0x34be33){return _0x565c37[_0x2677('0x8')]('Disposition',attributes,{'tableName':_0x2677('0x9'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x2677('0xa'),'fields':[_0x2677('0xb'),_0x2677('0xc')]},{'unique':!![],'name':'name_chat','fields':[_0x2677('0xb'),_0x2677('0xd')]},{'unique':!![],'name':_0x2677('0xe'),'fields':[_0x2677('0xb'),_0x2677('0xf')]},{'unique':!![],'name':'name_sms','fields':[_0x2677('0xb'),_0x2677('0x10')]},{'unique':!![],'name':_0x2677('0x11'),'fields':[_0x2677('0xb'),_0x2677('0x12')]},{'unique':!![],'name':_0x2677('0x13'),'fields':[_0x2677('0xb'),_0x2677('0x14')]},{'unique':!![],'name':_0x2677('0x15'),'fields':[_0x2677('0xb'),_0x2677('0x16')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb7d5=['../../config/logger','api','moment','bluebird','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name','ListId','name_chat','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','WhatsappAccountId','lodash','util'];(function(_0x5e7f03,_0x30a081){var _0x2cf348=function(_0x549643){while(--_0x549643){_0x5e7f03['push'](_0x5e7f03['shift']());}};_0x2cf348(++_0x30a081);}(_0xb7d5,0xd6));var _0x5b7d=function(_0x36393e,_0x25e3fa){_0x36393e=_0x36393e-0x0;var _0x34e0ca=_0xb7d5[_0x36393e];return _0x34e0ca;};'use strict';var _=require(_0x5b7d('0x0'));var util=require(_0x5b7d('0x1'));var logger=require(_0x5b7d('0x2'))(_0x5b7d('0x3'));var moment=require(_0x5b7d('0x4'));var BPromise=require(_0x5b7d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5b7d('0x6'));var attributes=require(_0x5b7d('0x7'));module[_0x5b7d('0x8')]=function(_0x2dfca9,_0x1a4b79){return _0x2dfca9[_0x5b7d('0x9')](_0x5b7d('0xa'),attributes,{'tableName':_0x5b7d('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x5b7d('0xc'),_0x5b7d('0xd')]},{'unique':!![],'name':_0x5b7d('0xe'),'fields':[_0x5b7d('0xc'),'ChatWebsiteId']},{'unique':!![],'name':_0x5b7d('0xf'),'fields':[_0x5b7d('0xc'),_0x5b7d('0x10')]},{'unique':!![],'name':_0x5b7d('0x11'),'fields':[_0x5b7d('0xc'),_0x5b7d('0x12')]},{'unique':!![],'name':_0x5b7d('0x13'),'fields':[_0x5b7d('0xc'),_0x5b7d('0x14')]},{'unique':!![],'name':_0x5b7d('0x15'),'fields':['name',_0x5b7d('0x16')]},{'unique':!![],'name':'name_whatsapp','fields':[_0x5b7d('0xc'),_0x5b7d('0x17')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 285cc5f..eaba1fa 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(_0x1844e1,_0x4bcbfa){var _0x592a98=function(_0x8e6989){while(--_0x8e6989){_0x1844e1['push'](_0x1844e1['shift']());}};_0x592a98(++_0x4bcbfa);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'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(_0x3f3ee3,_0x624b69){var _0x1e19bf=function(_0x58b8d8){while(--_0x58b8d8){_0x3f3ee3['push'](_0x3f3ee3['shift']());}};_0x1e19bf(++_0x624b69);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 2a55a32..8fd38b5 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 _0xddcc=['../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','post','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0xa2f6cc,_0x25ea74){var _0x25154c=function(_0x29984b){while(--_0x29984b){_0xa2f6cc['push'](_0xa2f6cc['shift']());}};_0x25154c(++_0x25ea74);}(_0xddcc,0x111));var _0xcddc=function(_0x324deb,_0x2c16ad){_0x324deb=_0x324deb-0x0;var _0x1688a8=_0xddcc[_0x324deb];return _0x1688a8;};'use strict';var multer=require(_0xcddc('0x0'));var util=require(_0xcddc('0x1'));var path=require(_0xcddc('0x2'));var timeout=require('connect-timeout');var express=require(_0xcddc('0x3'));var router=express[_0xcddc('0x4')]();var fs_extra=require(_0xcddc('0x5'));var auth=require(_0xcddc('0x6'));var interaction=require(_0xcddc('0x7'));var config=require(_0xcddc('0x8'));var controller=require(_0xcddc('0x9'));router[_0xcddc('0xa')]('/',auth[_0xcddc('0xb')](),controller[_0xcddc('0xc')]);router[_0xcddc('0xa')](_0xcddc('0xd'),auth[_0xcddc('0xb')](),controller['show']);router[_0xcddc('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xcddc('0xf')](_0xcddc('0xd'),auth[_0xcddc('0xb')](),controller[_0xcddc('0x10')]);router[_0xcddc('0x11')](_0xcddc('0xd'),auth['isAuthenticated'](),controller[_0xcddc('0x12')]);module[_0xcddc('0x13')]=router; \ No newline at end of file +var _0xe457=['/:id','isAuthenticated','post','create','put','update','delete','multer','util','path','express','fs-extra','./disposition.controller','get'];(function(_0x4798cb,_0x2e8d7d){var _0x5913de=function(_0x490c85){while(--_0x490c85){_0x4798cb['push'](_0x4798cb['shift']());}};_0x5913de(++_0x2e8d7d);}(_0xe457,0x93));var _0x7e45=function(_0x32971d,_0x519023){_0x32971d=_0x32971d-0x0;var _0x2ba828=_0xe457[_0x32971d];return _0x2ba828;};'use strict';var multer=require(_0x7e45('0x0'));var util=require(_0x7e45('0x1'));var path=require(_0x7e45('0x2'));var timeout=require('connect-timeout');var express=require(_0x7e45('0x3'));var router=express['Router']();var fs_extra=require(_0x7e45('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7e45('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x7e45('0x6')](_0x7e45('0x7'),auth[_0x7e45('0x8')](),controller['show']);router[_0x7e45('0x9')]('/',auth[_0x7e45('0x8')](),controller[_0x7e45('0xa')]);router[_0x7e45('0xb')](_0x7e45('0x7'),auth[_0x7e45('0x8')](),controller[_0x7e45('0xc')]);router[_0x7e45('0xd')](_0x7e45('0x7'),auth[_0x7e45('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index cd6f067..3de0890 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 _0x7f00=['9600','14400','4800','12000','SIP','IAX','DADHI','KHOMP','TEXT','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','localstationid','2400','7200'];(function(_0x2d604b,_0x4f1748){var _0x504857=function(_0x3c4990){while(--_0x3c4990){_0x2d604b['push'](_0x2d604b['shift']());}};_0x504857(++_0x4f1748);}(_0x7f00,0xa8));var _0x07f0=function(_0x21383b,_0x5158af){_0x21383b=_0x21383b-0x0;var _0x1e55ed=_0x7f00[_0x21383b];return _0x1e55ed;};'use strict';var Sequelize=require(_0x07f0('0x0'));module[_0x07f0('0x1')]={'name':{'type':Sequelize[_0x07f0('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x07f0('0x2')]},'ecm':{'type':Sequelize[_0x07f0('0x3')](_0x07f0('0x4'),'no'),'defaultValue':_0x07f0('0x4')},'headerinfo':{'type':Sequelize[_0x07f0('0x2')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize['STRING'],'unique':_0x07f0('0x5')},'minrate':{'type':Sequelize[_0x07f0('0x3')](_0x07f0('0x6'),'4800',_0x07f0('0x7'),_0x07f0('0x8'),'12000',_0x07f0('0x9')),'defaultValue':_0x07f0('0xa')},'maxrate':{'type':Sequelize['ENUM'](_0x07f0('0x6'),'4800','7200','9600',_0x07f0('0xb'),'14400'),'defaultValue':_0x07f0('0x9')},'modem':{'type':Sequelize[_0x07f0('0x2')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x07f0('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0x07f0('0xc'),_0x07f0('0xd'),_0x07f0('0xe'),_0x07f0('0xf')),'defaultValue':_0x07f0('0xc')},'key':{'type':Sequelize[_0x07f0('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x07f0('0x10')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x07f0('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x07f0('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x07f0('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x07f0('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x07f0('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x07f0('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x07f0('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x07f0('0x12')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x07f0('0x11')],'defaultValue':![],'comment':_0x07f0('0x13'),'set':function(_0x16aa43){if(!_0x16aa43)this[_0x07f0('0x14')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0x07f0('0x15'),_0x16aa43);}}}; \ No newline at end of file +var _0xa232=['7200','14400','INTEGER','SIP','IAX','DADHI','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','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','9600','12000','4800'];(function(_0x30e5e9,_0x2849a9){var _0x4ae8ca=function(_0x4abbc0){while(--_0x4abbc0){_0x30e5e9['push'](_0x30e5e9['shift']());}};_0x4ae8ca(++_0x2849a9);}(_0xa232,0x141));var _0x2a23=function(_0x1f0c57,_0x4cbbf3){_0x1f0c57=_0x1f0c57-0x0;var _0x531414=_0xa232[_0x1f0c57];return _0x531414;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x2a23('0x0')]},'ecm':{'type':Sequelize[_0x2a23('0x1')](_0x2a23('0x2'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x2a23('0x0')],'defaultValue':_0x2a23('0x3')},'localstationid':{'type':Sequelize['STRING'],'unique':_0x2a23('0x4')},'minrate':{'type':Sequelize[_0x2a23('0x1')](_0x2a23('0x5'),'4800','7200',_0x2a23('0x6'),_0x2a23('0x7'),'14400'),'defaultValue':'4800'},'maxrate':{'type':Sequelize['ENUM'](_0x2a23('0x5'),_0x2a23('0x8'),_0x2a23('0x9'),_0x2a23('0x6'),_0x2a23('0x7'),'14400'),'defaultValue':_0x2a23('0xa')},'modem':{'type':Sequelize[_0x2a23('0x0')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x2a23('0x0')],'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[_0x2a23('0xb')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x2a23('0x1')](_0x2a23('0xc'),_0x2a23('0xd'),_0x2a23('0xe'),'KHOMP'),'defaultValue':_0x2a23('0xc')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x2a23('0xf');}},'notificationSound':{'type':Sequelize[_0x2a23('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x2a23('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2a23('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2a23('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2a23('0xb')],'allowNull':!![],'defaultValue':null,'comment':_0x2a23('0x11')},'mandatoryDisposition':{'type':Sequelize[_0x2a23('0x10')],'defaultValue':![],'comment':_0x2a23('0x12'),'set':function(_0x328dd1){if(!_0x328dd1)this['setDataValue'](_0x2a23('0x13'),null);this[_0x2a23('0x14')](_0x2a23('0x15'),_0x328dd1);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index cce1e2a..1006641 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 _0xe278=['removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','Contact','Owner','internal','Tag','color','tag','addApplications','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','context','from-voip-provider','exten','localstationid','app','system','Fax\x20Extension','appdata','push','CDR(type)=inbound-fax','Set','ecm','gateway','headerinfo','maxrate','modem','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','sequelize','update','createdAt','updatedAt','TrunkId','findById','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','List','CmContact','Contacts','DESC','attachments','root','server/files/attachments','basename','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','userFaxAccount:save','removeAgents','isArray','emit','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxAccount.socket','register','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','sendStatus','status','end','json','offset','count','limit','Content-Range','reject','UserProfileResource','destroy','stack','name','send','index','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','rows','show','params','Pause','model','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','describe','addDisposition','FaxAccountId','Disposition','findOne','filter','findAll','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer'];(function(_0x2c0d34,_0x5abdc3){var _0x2d67a3=function(_0x3bb8fe){while(--_0x3bb8fe){_0x2c0d34['push'](_0x2c0d34['shift']());}};_0x2d67a3(++_0x5abdc3);}(_0xe278,0x11e));var _0x8e27=function(_0x4fac91,_0x58f2dd){_0x4fac91=_0x4fac91-0x0;var _0x207fc8=_0xe278[_0x4fac91];return _0x207fc8;};'use strict';var emlformat=require(_0x8e27('0x0'));var rimraf=require(_0x8e27('0x1'));var zipdir=require(_0x8e27('0x2'));var jsonpatch=require(_0x8e27('0x3'));var rp=require(_0x8e27('0x4'));var moment=require(_0x8e27('0x5'));var BPromise=require(_0x8e27('0x6'));var Mustache=require(_0x8e27('0x7'));var util=require('util');var path=require('path');var sox=require(_0x8e27('0x8'));var csv=require(_0x8e27('0x9'));var ejs=require(_0x8e27('0xa'));var fs=require('fs');var fs_extra=require(_0x8e27('0xb'));var _=require(_0x8e27('0xc'));var squel=require('squel');var crypto=require(_0x8e27('0xd'));var jsforce=require(_0x8e27('0xe'));var deskjs=require(_0x8e27('0xf'));var toCsv=require(_0x8e27('0x9'));var querystring=require(_0x8e27('0x10'));var Papa=require('papaparse');var Redis=require(_0x8e27('0x11'));var authService=require(_0x8e27('0x12'));var qs=require(_0x8e27('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8e27('0x14'))(_0x8e27('0x15'));var utils=require(_0x8e27('0x16'));var config=require(_0x8e27('0x17'));var licenseUtil=require(_0x8e27('0x18'));var db=require(_0x8e27('0x19'))['db'];config['redis']=_[_0x8e27('0x1a')](config[_0x8e27('0x1b')],{'host':_0x8e27('0x1c'),'port':0x18eb});var socket=require(_0x8e27('0x1d'))(new Redis(config['redis']));require(_0x8e27('0x1e'))[_0x8e27('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson[_0x8e27('0x20')][_0x8e27('0x21')]({'port':0x232c});var client9002=jayson['client'][_0x8e27('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x25584c,_0xadc91f,_0x1b93a1,_0x45013c){return new BPromise(function(_0x232a9a,_0x1b1df0){var _0x58914a=_0x45013c||client;return _0x58914a[_0x8e27('0x22')](_0x25584c,_0x1b93a1)[_0x8e27('0x23')](function(_0x3db0ab){logger[_0x8e27('0x24')](_0x8e27('0x25'),_0xadc91f,'request\x20sent');logger[_0x8e27('0x26')](_0x8e27('0x27'),_0xadc91f,'request\x20sent',JSON['stringify'](_0x3db0ab));if(_0x3db0ab['error']){if(_0x3db0ab[_0x8e27('0x28')][_0x8e27('0x29')]===0x1f4){logger[_0x8e27('0x28')](_0x8e27('0x25'),_0xadc91f,_0x3db0ab[_0x8e27('0x28')]['message']);return _0x1b1df0(_0x3db0ab['error'][_0x8e27('0x2a')]);}logger[_0x8e27('0x28')]('FaxAccount,\x20%s,\x20%s',_0xadc91f,_0x3db0ab[_0x8e27('0x28')][_0x8e27('0x2a')]);return _0x232a9a(_0x3db0ab[_0x8e27('0x28')][_0x8e27('0x2a')]);}else{logger['info'](_0x8e27('0x25'),_0xadc91f,_0x8e27('0x2b'));_0x232a9a(_0x3db0ab[_0x8e27('0x2c')]['message']);}})[_0x8e27('0x2d')](function(_0x2d289f){logger['error'](_0x8e27('0x25'),_0xadc91f,_0x2d289f);_0x1b1df0(_0x2d289f);});});}function respondWithStatusCode(_0x258b15,_0x160b6a){_0x160b6a=_0x160b6a||0xcc;return function(_0x267a4e){if(_0x267a4e){return _0x258b15[_0x8e27('0x2e')](_0x160b6a);}return _0x258b15[_0x8e27('0x2f')](_0x160b6a)[_0x8e27('0x30')]();};}function respondWithResult(_0x5b4846,_0x293266){_0x293266=_0x293266||0xc8;return function(_0x12a8d8){if(_0x12a8d8){return _0x5b4846[_0x8e27('0x2f')](_0x293266)[_0x8e27('0x31')](_0x12a8d8);}};}function respondWithFilteredResult(_0x524a71,_0x118082){return function(_0x139b06){if(_0x139b06){var _0x5310ae=typeof _0x118082[_0x8e27('0x32')]==='undefined'&&typeof _0x118082['limit']==='undefined';var _0x14f6d9=_0x139b06[_0x8e27('0x33')];var _0x27b0c7=_0x5310ae?0x0:_0x118082['offset'];var _0x5581ab=_0x5310ae?_0x139b06[_0x8e27('0x33')]:_0x118082[_0x8e27('0x32')]+_0x118082[_0x8e27('0x34')];var _0x3ba577;if(_0x5581ab>=_0x14f6d9){_0x5581ab=_0x14f6d9;_0x3ba577=0xc8;}else{_0x3ba577=0xce;}_0x524a71[_0x8e27('0x2f')](_0x3ba577);return _0x524a71['set'](_0x8e27('0x35'),_0x27b0c7+'-'+_0x5581ab+'/'+_0x14f6d9)['json'](_0x139b06);}return null;};}function patchUpdates(_0x4088f5){return function(_0x5454eb){try{jsonpatch['apply'](_0x5454eb,_0x4088f5,!![]);}catch(_0x2a1ee7){return BPromise[_0x8e27('0x36')](_0x2a1ee7);}return _0x5454eb['save']();};}function saveUpdates(_0x118fd3,_0x576e8c){return function(_0x1bdf55){if(_0x1bdf55){return _0x1bdf55['update'](_0x118fd3)[_0x8e27('0x23')](function(_0x1580d5){return _0x1580d5;});}return null;};}function removeEntity(_0x369c84,_0x1abc44){return function(_0x3be64e){if(_0x3be64e){return _0x3be64e['destroy']()[_0x8e27('0x23')](function(){var _0xc48fcd=_0x3be64e['get']({'plain':!![]});var _0x137a1c='FaxAccounts';return db[_0x8e27('0x37')][_0x8e27('0x38')]({'where':{'type':_0x137a1c,'resourceId':_0xc48fcd['id']}})['then'](function(){return _0x3be64e;});})[_0x8e27('0x23')](function(){_0x369c84['status'](0xcc)[_0x8e27('0x30')]();});}};}function handleEntityNotFound(_0x333a20,_0x372090){return function(_0x106865){if(!_0x106865){_0x333a20[_0x8e27('0x2e')](0x194);}return _0x106865;};}function handleError(_0x237005,_0x30ec20){_0x30ec20=_0x30ec20||0x1f4;return function(_0x391e6a){logger[_0x8e27('0x28')](_0x391e6a[_0x8e27('0x39')]);if(_0x391e6a['name']){delete _0x391e6a[_0x8e27('0x3a')];}_0x237005[_0x8e27('0x2f')](_0x30ec20)[_0x8e27('0x3b')](_0x391e6a);};}exports[_0x8e27('0x3c')]=function(_0x19aaae,_0x4f97b8){var _0x3876bf={'include':[{'model':db['Pause'],'as':_0x8e27('0x3d')}]},_0x1c38a3={},_0x583774={'count':0x0,'rows':[]};var _0x28496c=_[_0x8e27('0x3e')](db[_0x8e27('0x3f')][_0x8e27('0x40')],function(_0xd182a8){return{'name':_0xd182a8[_0x8e27('0x41')],'type':_0xd182a8[_0x8e27('0x42')][_0x8e27('0x43')]};});_0x1c38a3['model']=_[_0x8e27('0x3e')](_0x28496c,'name');_0x1c38a3[_0x8e27('0x44')]=_[_0x8e27('0x45')](_0x19aaae[_0x8e27('0x44')]);_0x1c38a3[_0x8e27('0x46')]=_[_0x8e27('0x47')](_0x1c38a3['model'],_0x1c38a3[_0x8e27('0x44')]);_0x3876bf[_0x8e27('0x48')]=_[_0x8e27('0x47')](_0x1c38a3['model'],qs[_0x8e27('0x49')](_0x19aaae[_0x8e27('0x44')]['fields']));_0x3876bf[_0x8e27('0x48')]=_0x3876bf['attributes'][_0x8e27('0x4a')]?_0x3876bf['attributes']:_0x1c38a3['model'];if(!_0x19aaae[_0x8e27('0x44')][_0x8e27('0x4b')](_0x8e27('0x4c'))){_0x3876bf['limit']=qs[_0x8e27('0x34')](_0x19aaae[_0x8e27('0x44')]['limit']);_0x3876bf[_0x8e27('0x32')]=qs[_0x8e27('0x32')](_0x19aaae[_0x8e27('0x44')][_0x8e27('0x32')]);}_0x3876bf[_0x8e27('0x4d')]=qs[_0x8e27('0x4e')](_0x19aaae[_0x8e27('0x44')][_0x8e27('0x4e')]);_0x3876bf[_0x8e27('0x4f')]=qs[_0x8e27('0x46')](_[_0x8e27('0x50')](_0x19aaae[_0x8e27('0x44')],_0x1c38a3['filters']),_0x28496c);if(_0x19aaae[_0x8e27('0x44')]['filter']){_0x3876bf[_0x8e27('0x4f')]=_[_0x8e27('0x51')](_0x3876bf[_0x8e27('0x4f')],{'$or':_['map'](_0x28496c,function(_0x4fe36c){if(_0x4fe36c[_0x8e27('0x42')]!==_0x8e27('0x52')){var _0x2ee5de={};_0x2ee5de[_0x4fe36c[_0x8e27('0x3a')]]={'$like':'%'+_0x19aaae[_0x8e27('0x44')]['filter']+'%'};return _0x2ee5de;}})});}_0x3876bf=_['merge']({},_0x3876bf,_0x19aaae[_0x8e27('0x53')]);var _0x3e1dc2={'where':_0x3876bf[_0x8e27('0x4f')]};return db[_0x8e27('0x3f')][_0x8e27('0x33')](_0x3e1dc2)[_0x8e27('0x23')](function(_0x2eacbd){_0x583774[_0x8e27('0x33')]=_0x2eacbd;if(_0x19aaae[_0x8e27('0x44')][_0x8e27('0x54')]){_0x3876bf[_0x8e27('0x55')]=[{'all':!![]}];}return db['FaxAccount']['findAll'](_0x3876bf);})[_0x8e27('0x23')](function(_0x61a80b){_0x583774[_0x8e27('0x56')]=_0x61a80b;return _0x583774;})[_0x8e27('0x23')](respondWithFilteredResult(_0x4f97b8,_0x3876bf))[_0x8e27('0x2d')](handleError(_0x4f97b8,null));};exports[_0x8e27('0x57')]=function(_0x2c4042,_0x103c66){var _0x965fa4={'raw':![],'where':{'id':_0x2c4042[_0x8e27('0x58')]['id']},'include':[{'model':db[_0x8e27('0x59')],'as':_0x8e27('0x3d')}]},_0x43bb2d={};_0x43bb2d[_0x8e27('0x5a')]=_[_0x8e27('0x45')](db[_0x8e27('0x3f')]['rawAttributes']);_0x43bb2d[_0x8e27('0x44')]=_[_0x8e27('0x45')](_0x2c4042[_0x8e27('0x44')]);_0x43bb2d['filters']=_[_0x8e27('0x47')](_0x43bb2d['model'],_0x43bb2d['query']);_0x965fa4[_0x8e27('0x48')]=_[_0x8e27('0x47')](_0x43bb2d[_0x8e27('0x5a')],qs[_0x8e27('0x49')](_0x2c4042['query']['fields']));_0x965fa4[_0x8e27('0x48')]=_0x965fa4[_0x8e27('0x48')]['length']?_0x965fa4[_0x8e27('0x48')]:_0x43bb2d[_0x8e27('0x5a')];if(_0x2c4042[_0x8e27('0x44')][_0x8e27('0x54')]){_0x965fa4['include']=[{'all':!![]}];}_0x965fa4=_['merge']({},_0x965fa4,_0x2c4042[_0x8e27('0x53')]);return db[_0x8e27('0x3f')][_0x8e27('0x5b')](_0x965fa4)[_0x8e27('0x23')](handleEntityNotFound(_0x103c66,null))[_0x8e27('0x23')](respondWithResult(_0x103c66,null))[_0x8e27('0x2d')](handleError(_0x103c66,null));};exports[_0x8e27('0x5c')]=function(_0x108af2,_0x433ee6){return db[_0x8e27('0x3f')]['create'](_0x108af2[_0x8e27('0x5d')],{})['then'](function(_0x479949){var _0x359071=_0x108af2[_0x8e27('0x5e')][_0x8e27('0x5f')]({'plain':!![]});if(!_0x359071)throw new Error(_0x8e27('0x60'));if(_0x359071[_0x8e27('0x61')]===_0x8e27('0x5e')){var _0x42a6d1=_0x479949[_0x8e27('0x5f')]({'plain':!![]});var _0xed097a='FaxAccounts';return db[_0x8e27('0x62')][_0x8e27('0x5b')]({'where':{'name':_0xed097a,'userProfileId':_0x359071[_0x8e27('0x63')]},'raw':!![]})[_0x8e27('0x23')](function(_0x24c2c6){if(_0x24c2c6&&_0x24c2c6[_0x8e27('0x64')]===0x0){return db[_0x8e27('0x37')][_0x8e27('0x5c')]({'name':_0x42a6d1[_0x8e27('0x3a')],'resourceId':_0x42a6d1['id'],'type':_0x24c2c6[_0x8e27('0x3a')],'sectionId':_0x24c2c6['id']},{})[_0x8e27('0x23')](function(){return _0x479949;});}else{return _0x479949;}})[_0x8e27('0x2d')](function(_0x1f8132){logger[_0x8e27('0x28')](_0x8e27('0x65'),_0x1f8132);throw _0x1f8132;});}return _0x479949;})[_0x8e27('0x23')](respondWithResult(_0x433ee6,0xc9))[_0x8e27('0x2d')](handleError(_0x433ee6,null));};exports['update']=function(_0x3d0cdd,_0x1fd36e){if(_0x3d0cdd[_0x8e27('0x5d')]['id']){delete _0x3d0cdd[_0x8e27('0x5d')]['id'];}return db['FaxAccount'][_0x8e27('0x5b')]({'where':{'id':_0x3d0cdd['params']['id']},'include':[{'model':db['Pause'],'as':_0x8e27('0x3d')}]})[_0x8e27('0x23')](handleEntityNotFound(_0x1fd36e,null))[_0x8e27('0x23')](saveUpdates(_0x3d0cdd[_0x8e27('0x5d')],null))['then'](respondWithResult(_0x1fd36e,null))[_0x8e27('0x2d')](handleError(_0x1fd36e,null));};exports[_0x8e27('0x38')]=function(_0x7e9920,_0x122d8d){return db['FaxAccount'][_0x8e27('0x5b')]({'where':{'id':_0x7e9920['params']['id']}})[_0x8e27('0x23')](handleEntityNotFound(_0x122d8d,null))[_0x8e27('0x23')](removeEntity(_0x122d8d,null))[_0x8e27('0x2d')](handleError(_0x122d8d,null));};exports[_0x8e27('0x66')]=function(_0x39c10f,_0x1f47f0){return db[_0x8e27('0x3f')][_0x8e27('0x66')]()[_0x8e27('0x23')](respondWithResult(_0x1f47f0,null))[_0x8e27('0x2d')](handleError(_0x1f47f0,null));};exports[_0x8e27('0x67')]=function(_0x2fe17d,_0x500889,_0x5b8982){if(_0x2fe17d['body']['id']){delete _0x2fe17d[_0x8e27('0x5d')]['id'];}return db[_0x8e27('0x3f')][_0x8e27('0x5b')]({'where':{'id':_0x2fe17d[_0x8e27('0x58')]['id']}})['then'](handleEntityNotFound(_0x500889,null))[_0x8e27('0x23')](function(_0x4ab49c){if(_0x4ab49c){_0x2fe17d[_0x8e27('0x5d')][_0x8e27('0x68')]=_0x4ab49c['id'];return db[_0x8e27('0x69')][_0x8e27('0x5c')](_0x2fe17d[_0x8e27('0x5d')]);}})['then'](respondWithResult(_0x500889,null))[_0x8e27('0x2d')](handleError(_0x500889,null));};exports['getDispositions']=function(_0x427679,_0x4fc63f,_0x32ba6c){var _0x1c3247={'raw':![],'where':{}};var _0x3904a2={};var _0x1f9d1e={'count':0x0,'rows':[]};return db[_0x8e27('0x3f')][_0x8e27('0x6a')]({'where':{'id':_0x427679[_0x8e27('0x58')]['id']}})[_0x8e27('0x23')](handleEntityNotFound(_0x4fc63f,null))['then'](function(_0x44c144){if(_0x44c144){_0x3904a2[_0x8e27('0x5a')]=_[_0x8e27('0x45')](db[_0x8e27('0x69')][_0x8e27('0x40')]);_0x3904a2[_0x8e27('0x44')]=_[_0x8e27('0x45')](_0x427679[_0x8e27('0x44')]);_0x3904a2['filters']=_[_0x8e27('0x47')](_0x3904a2[_0x8e27('0x5a')],_0x3904a2['query']);_0x1c3247[_0x8e27('0x48')]=_[_0x8e27('0x47')](_0x3904a2[_0x8e27('0x5a')],qs[_0x8e27('0x49')](_0x427679['query'][_0x8e27('0x49')]));_0x1c3247[_0x8e27('0x48')]=_0x1c3247[_0x8e27('0x48')][_0x8e27('0x4a')]?_0x1c3247[_0x8e27('0x48')]:_0x3904a2[_0x8e27('0x5a')];if(!_0x427679[_0x8e27('0x44')][_0x8e27('0x4b')](_0x8e27('0x4c'))){_0x1c3247['limit']=qs['limit'](_0x427679['query'][_0x8e27('0x34')]);_0x1c3247[_0x8e27('0x32')]=qs['offset'](_0x427679[_0x8e27('0x44')]['offset']);}_0x1c3247['order']=qs['sort'](_0x427679[_0x8e27('0x44')][_0x8e27('0x4e')]);_0x1c3247[_0x8e27('0x4f')]=qs[_0x8e27('0x46')](_[_0x8e27('0x50')](_0x427679[_0x8e27('0x44')],_0x3904a2[_0x8e27('0x46')]));_0x1c3247[_0x8e27('0x4f')]['FaxAccountId']=_0x44c144['id'];if(_0x427679[_0x8e27('0x44')]['filter']){_0x1c3247[_0x8e27('0x4f')]=_[_0x8e27('0x51')](_0x1c3247[_0x8e27('0x4f')],{'$or':_['map'](_0x1c3247['attributes'],function(_0x1df5f6){var _0x3261d7={};_0x3261d7[_0x1df5f6]={'$like':'%'+_0x427679[_0x8e27('0x44')][_0x8e27('0x6b')]+'%'};return _0x3261d7;})});}_0x1c3247=_[_0x8e27('0x51')]({},_0x1c3247,_0x427679['options']);return db[_0x8e27('0x69')][_0x8e27('0x33')]({'where':_0x1c3247['where']})[_0x8e27('0x23')](function(_0x1816b7){_0x1f9d1e[_0x8e27('0x33')]=_0x1816b7;if(_0x427679[_0x8e27('0x44')][_0x8e27('0x54')]){_0x1c3247[_0x8e27('0x55')]=[{'all':!![]}];}return db[_0x8e27('0x69')][_0x8e27('0x6c')](_0x1c3247);})['then'](function(_0x2c6fdf){_0x1f9d1e[_0x8e27('0x56')]=_0x2c6fdf;return _0x1f9d1e;});}})['then'](respondWithFilteredResult(_0x4fc63f,_0x1c3247))[_0x8e27('0x2d')](handleError(_0x4fc63f,null));};exports[_0x8e27('0x6d')]=function(_0x580efe,_0x285448,_0x4ec6b4){return db[_0x8e27('0x3f')][_0x8e27('0x5b')]({'where':{'id':_0x580efe[_0x8e27('0x58')]['id']}})['then'](handleEntityNotFound(_0x285448,null))['then'](function(_0x25df19){if(_0x25df19){return _0x25df19[_0x8e27('0x6d')](_0x580efe[_0x8e27('0x44')][_0x8e27('0x6e')]);}})['then'](respondWithStatusCode(_0x285448,null))[_0x8e27('0x2d')](handleError(_0x285448,null));};exports[_0x8e27('0x6f')]=function(_0x36c537,_0x1e81c7,_0x92d925){if(_0x36c537['body']['id']){delete _0x36c537['body']['id'];}return db[_0x8e27('0x3f')][_0x8e27('0x5b')]({'where':{'id':_0x36c537[_0x8e27('0x58')]['id']}})['then'](handleEntityNotFound(_0x1e81c7,null))['then'](function(_0x211ef9){if(_0x211ef9){_0x36c537[_0x8e27('0x5d')][_0x8e27('0x68')]=_0x211ef9['id'];return db['CannedAnswer'][_0x8e27('0x5c')](_0x36c537['body']);}})[_0x8e27('0x23')](respondWithResult(_0x1e81c7,null))['catch'](handleError(_0x1e81c7,null));};exports[_0x8e27('0x70')]=function(_0x54c7d7,_0x1c9249,_0x34e8ec){var _0x2a41f4={'raw':![],'where':{}};var _0x466dd2={};var _0x1ae13e={'count':0x0,'rows':[]};return db[_0x8e27('0x3f')][_0x8e27('0x6a')]({'where':{'id':_0x54c7d7['params']['id']}})[_0x8e27('0x23')](handleEntityNotFound(_0x1c9249,null))['then'](function(_0x52bfd9){if(_0x52bfd9){_0x466dd2['model']=_['keys'](db[_0x8e27('0x71')][_0x8e27('0x40')]);_0x466dd2[_0x8e27('0x44')]=_[_0x8e27('0x45')](_0x54c7d7['query']);_0x466dd2[_0x8e27('0x46')]=_['intersection'](_0x466dd2[_0x8e27('0x5a')],_0x466dd2[_0x8e27('0x44')]);_0x2a41f4[_0x8e27('0x48')]=_[_0x8e27('0x47')](_0x466dd2['model'],qs['fields'](_0x54c7d7[_0x8e27('0x44')]['fields']));_0x2a41f4[_0x8e27('0x48')]=_0x2a41f4[_0x8e27('0x48')][_0x8e27('0x4a')]?_0x2a41f4['attributes']:_0x466dd2[_0x8e27('0x5a')];if(!_0x54c7d7[_0x8e27('0x44')]['hasOwnProperty'](_0x8e27('0x4c'))){_0x2a41f4['limit']=qs[_0x8e27('0x34')](_0x54c7d7[_0x8e27('0x44')][_0x8e27('0x34')]);_0x2a41f4[_0x8e27('0x32')]=qs[_0x8e27('0x32')](_0x54c7d7[_0x8e27('0x44')][_0x8e27('0x32')]);}_0x2a41f4[_0x8e27('0x4d')]=qs[_0x8e27('0x4e')](_0x54c7d7[_0x8e27('0x44')]['sort']);_0x2a41f4[_0x8e27('0x4f')]=qs['filters'](_[_0x8e27('0x50')](_0x54c7d7['query'],_0x466dd2[_0x8e27('0x46')]));_0x2a41f4['where'][_0x8e27('0x68')]=_0x52bfd9['id'];if(_0x54c7d7[_0x8e27('0x44')][_0x8e27('0x6b')]){_0x2a41f4['where']=_[_0x8e27('0x51')](_0x2a41f4[_0x8e27('0x4f')],{'$or':_[_0x8e27('0x3e')](_0x2a41f4['attributes'],function(_0x51154b){var _0x21eb6f={};_0x21eb6f[_0x51154b]={'$like':'%'+_0x54c7d7[_0x8e27('0x44')]['filter']+'%'};return _0x21eb6f;})});}_0x2a41f4=_['merge']({},_0x2a41f4,_0x54c7d7[_0x8e27('0x53')]);return db[_0x8e27('0x71')][_0x8e27('0x33')]({'where':_0x2a41f4[_0x8e27('0x4f')]})[_0x8e27('0x23')](function(_0x47e38e){_0x1ae13e[_0x8e27('0x33')]=_0x47e38e;if(_0x54c7d7[_0x8e27('0x44')]['includeAll']){_0x2a41f4[_0x8e27('0x55')]=[{'all':!![]}];}return db[_0x8e27('0x71')]['findAll'](_0x2a41f4);})[_0x8e27('0x23')](function(_0xb0e52f){_0x1ae13e[_0x8e27('0x56')]=_0xb0e52f;return _0x1ae13e;});}})[_0x8e27('0x23')](respondWithFilteredResult(_0x1c9249,_0x2a41f4))['catch'](handleError(_0x1c9249,null));};exports[_0x8e27('0x72')]=function(_0xb70bb7,_0x1734a5,_0x324b59){return db[_0x8e27('0x3f')]['find']({'where':{'id':_0xb70bb7[_0x8e27('0x58')]['id']}})[_0x8e27('0x23')](handleEntityNotFound(_0x1734a5,null))[_0x8e27('0x23')](function(_0x59f204){if(_0x59f204){return _0x59f204[_0x8e27('0x72')](_0xb70bb7[_0x8e27('0x44')][_0x8e27('0x6e')]);}})[_0x8e27('0x23')](respondWithStatusCode(_0x1734a5,null))[_0x8e27('0x2d')](handleError(_0x1734a5,null));};exports[_0x8e27('0x73')]=function(_0xb9b4f,_0x4f5d0d,_0x301757){return db[_0x8e27('0x74')][_0x8e27('0x5b')]({'where':{'id':_0xb9b4f[_0x8e27('0x58')]['id']}})[_0x8e27('0x23')](handleEntityNotFound(_0x4f5d0d,null))[_0x8e27('0x23')](function(_0x5f3bd1){if(_0x5f3bd1){return _0x5f3bd1[_0x8e27('0x73')](_0xb9b4f[_0x8e27('0x5d')]['ids'],_[_0x8e27('0x75')](_0xb9b4f[_0x8e27('0x5d')],['ids','id'])||{});}})[_0x8e27('0x23')](respondWithResult(_0x4f5d0d,null))[_0x8e27('0x2d')](handleError(_0x4f5d0d,null));};exports[_0x8e27('0x76')]=function(_0x300589,_0x4c5ad8,_0x11e751){var _0x470a55={'raw':![],'where':{}};var _0x5a05df={};var _0x10b73d={'count':0x0,'rows':[]};return db[_0x8e27('0x3f')]['findOne']({'where':{'id':_0x300589['params']['id']}})['then'](handleEntityNotFound(_0x4c5ad8,null))[_0x8e27('0x23')](function(_0x4139d6){if(_0x4139d6){_0x5a05df[_0x8e27('0x5a')]=_[_0x8e27('0x45')](db[_0x8e27('0x74')]['rawAttributes']);_0x5a05df['query']=_[_0x8e27('0x45')](_0x300589['query']);_0x5a05df[_0x8e27('0x46')]=_[_0x8e27('0x47')](_0x5a05df[_0x8e27('0x5a')],_0x5a05df[_0x8e27('0x44')]);_0x470a55[_0x8e27('0x48')]=_[_0x8e27('0x47')](_0x5a05df[_0x8e27('0x5a')],qs[_0x8e27('0x49')](_0x300589[_0x8e27('0x44')]['fields']));_0x470a55['attributes']=_0x470a55[_0x8e27('0x48')][_0x8e27('0x4a')]?_0x470a55[_0x8e27('0x48')]:_0x5a05df[_0x8e27('0x5a')];if(!_0x300589[_0x8e27('0x44')]['hasOwnProperty']('nolimit')){_0x470a55[_0x8e27('0x34')]=qs['limit'](_0x300589[_0x8e27('0x44')][_0x8e27('0x34')]);_0x470a55['offset']=qs['offset'](_0x300589[_0x8e27('0x44')][_0x8e27('0x32')]);}_0x470a55[_0x8e27('0x4d')]=qs[_0x8e27('0x4e')](_0x300589['query'][_0x8e27('0x4e')]);_0x470a55[_0x8e27('0x4f')]=qs[_0x8e27('0x46')](_[_0x8e27('0x50')](_0x300589['query'],_0x5a05df[_0x8e27('0x46')]));_0x470a55['where']['FaxAccountId']=_0x4139d6['id'];if(_0x300589[_0x8e27('0x44')]['filter']){_0x470a55['where']=_['merge'](_0x470a55['where'],{'$or':_['map'](_0x470a55[_0x8e27('0x48')],function(_0x52d236){var _0x2fc4f0={};_0x2fc4f0[_0x52d236]={'$like':'%'+_0x300589[_0x8e27('0x44')][_0x8e27('0x6b')]+'%'};return _0x2fc4f0;})});}_0x470a55=_[_0x8e27('0x51')]({},_0x470a55,_0x300589['options']);return db[_0x8e27('0x74')][_0x8e27('0x33')]({'where':_0x470a55['where']})['then'](function(_0x5e1f43){_0x10b73d['count']=_0x5e1f43;if(_0x300589['query']['includeAll']){_0x470a55[_0x8e27('0x55')]=[{'model':db['CmContact'],'as':_0x8e27('0x77'),'required':![]},{'model':db['User'],'as':_0x8e27('0x78'),'attributes':[_0x8e27('0x3a'),'fullname',_0x8e27('0x79')],'required':![]},{'model':db[_0x8e27('0x7a')],'as':'Tags','attributes':['id',_0x8e27('0x3a'),_0x8e27('0x7b')],'where':_0x300589[_0x8e27('0x44')]['tag']?{'id':_0x300589[_0x8e27('0x44')][_0x8e27('0x7c')]}:undefined,'required':_0x300589[_0x8e27('0x44')][_0x8e27('0x7c')]?!![]:![]}];}return db[_0x8e27('0x74')][_0x8e27('0x6c')](_0x470a55);})['then'](function(_0x2b10ce){_0x10b73d[_0x8e27('0x56')]=_0x2b10ce;return _0x10b73d;});}})['then'](respondWithFilteredResult(_0x4c5ad8,_0x470a55))['catch'](handleError(_0x4c5ad8,null));};exports[_0x8e27('0x7d')]=function(_0x39f086,_0x34fbec,_0x1ddf7d){return db[_0x8e27('0x3f')][_0x8e27('0x6a')]({'where':{'id':_0x39f086['params']['id']}})['then'](handleEntityNotFound(_0x34fbec,null))[_0x8e27('0x23')](function(_0x23b8c5){if(_0x23b8c5){return db['sequelize'][_0x8e27('0x7e')](function(_0x8dcf98){return db[_0x8e27('0x7f')][_0x8e27('0x38')]({'where':{'FaxAccountId':_0x39f086[_0x8e27('0x58')]['id']},'transaction':_0x8dcf98})[_0x8e27('0x23')](function(_0x49a475){var _0x167207=_[_0x8e27('0x3e')](_0x39f086[_0x8e27('0x5d')],function(_0x432619){_0x432619[_0x8e27('0x68')]=_0x39f086[_0x8e27('0x58')]['id'];return _0x432619;});return db[_0x8e27('0x7f')][_0x8e27('0x80')](_0x167207,{'transaction':_0x8dcf98});});})['then'](function(){return db['FaxApplication'][_0x8e27('0x81')]({'where':{'FaxAccountId':_0x39f086[_0x8e27('0x58')]['id']},'order':_0x8e27('0x82')});});}})[_0x8e27('0x23')](respondWithResult(_0x34fbec,null))[_0x8e27('0x2d')](handleError(_0x34fbec,null));};exports[_0x8e27('0x83')]=function(_0x70f6f7,_0xb8b913,_0x6bb608){var _0x5292c8={};var _0x2caddb={};var _0x59d138;var _0x5a1df3;return db[_0x8e27('0x3f')]['findOne']({'where':{'id':_0x70f6f7[_0x8e27('0x58')]['id']}})[_0x8e27('0x23')](handleEntityNotFound(_0xb8b913,null))[_0x8e27('0x23')](function(_0x2b2edd){if(_0x2b2edd){_0x59d138=_0x2b2edd;_0x2caddb[_0x8e27('0x5a')]=_[_0x8e27('0x45')](db['FaxApplication'][_0x8e27('0x40')]);_0x2caddb['query']=_[_0x8e27('0x45')](_0x70f6f7['query']);_0x2caddb['filters']=_[_0x8e27('0x47')](_0x2caddb[_0x8e27('0x5a')],_0x2caddb[_0x8e27('0x44')]);_0x5292c8['attributes']=_[_0x8e27('0x47')](_0x2caddb[_0x8e27('0x5a')],qs[_0x8e27('0x49')](_0x70f6f7['query'][_0x8e27('0x49')]));_0x5292c8[_0x8e27('0x48')]=_0x5292c8['attributes']['length']?_0x5292c8['attributes']:_0x2caddb[_0x8e27('0x5a')];_0x5292c8['order']=qs[_0x8e27('0x4e')](_0x70f6f7[_0x8e27('0x44')][_0x8e27('0x4e')]);_0x5292c8[_0x8e27('0x4f')]=qs[_0x8e27('0x46')](_['pick'](_0x70f6f7[_0x8e27('0x44')],_0x2caddb[_0x8e27('0x46')]));if(_0x70f6f7[_0x8e27('0x44')][_0x8e27('0x6b')]){_0x5292c8[_0x8e27('0x4f')]=_[_0x8e27('0x51')](_0x5292c8['where'],{'$or':_[_0x8e27('0x3e')](_0x5292c8[_0x8e27('0x48')],function(_0x1c6cb8){var _0x3a9dfa={};_0x3a9dfa[_0x1c6cb8]={'$like':'%'+_0x70f6f7[_0x8e27('0x44')][_0x8e27('0x6b')]+'%'};return _0x3a9dfa;})});}_0x5292c8=_[_0x8e27('0x51')]({},_0x5292c8,_0x70f6f7['options']);return _0x59d138['getApplications'](_0x5292c8);}})[_0x8e27('0x23')](function(_0x1b22fe){if(_0x1b22fe){_0x5a1df3=_0x1b22fe['length'];if(!_0x70f6f7['query'][_0x8e27('0x4b')](_0x8e27('0x4c'))){_0x5292c8['limit']=qs[_0x8e27('0x34')](_0x70f6f7['query'][_0x8e27('0x34')]);_0x5292c8[_0x8e27('0x32')]=qs[_0x8e27('0x32')](_0x70f6f7[_0x8e27('0x44')][_0x8e27('0x32')]);}return _0x59d138[_0x8e27('0x83')](_0x5292c8);}})[_0x8e27('0x23')](function(_0x574af2){if(_0x574af2){return _0x574af2?{'count':_0x5a1df3,'rows':_0x574af2}:null;}})[_0x8e27('0x23')](respondWithResult(_0xb8b913,null))['catch'](handleError(_0xb8b913,null));};function Extension(_0xcef8ab,_0xb36d2f,_0x1b7c16,_0x4baf7a){this[_0x8e27('0x84')]=_0x8e27('0x85');this[_0x8e27('0x86')]=_0xcef8ab[_0x8e27('0x87')];this[_0x8e27('0x88')]=_0x4baf7a;this[_0x8e27('0x42')]=_0x8e27('0x89');this['description']=_0x8e27('0x8a');this[_0x8e27('0x68')]=_0xcef8ab['id'];this[_0x8e27('0x82')]=_0xb36d2f;this[_0x8e27('0x8b')]=_0x1b7c16;}function createExtensionsReciveFax(_0x52afe5){var _0x31b614=0x1;var _0x342a35=[];_0x342a35['push'](new Extension(_0x52afe5,_0x31b614,'','Answer'));_0x31b614+=0x1;_0x342a35[_0x8e27('0x8c')](new Extension(_0x52afe5,_0x31b614,_0x8e27('0x8d'),_0x8e27('0x8e')));_0x31b614+=0x1;for(var _0x5a175c in _0x52afe5){if(_0x52afe5['hasOwnProperty'](_0x5a175c)&&(_0x5a175c===_0x8e27('0x8f')||_0x5a175c===_0x8e27('0x87')||_0x5a175c===_0x8e27('0x90')||_0x5a175c==='faxdetect'||_0x5a175c===_0x8e27('0x91')||_0x5a175c===_0x8e27('0x92')||_0x5a175c==='minrate'||_0x5a175c===_0x8e27('0x93')||_0x5a175c===_0x8e27('0x94'))){_0x342a35['push'](new Extension(_0x52afe5,_0x31b614,_0x8e27('0x95')+_0x5a175c+')='+_0x52afe5[_0x5a175c],'Set'));_0x31b614+=0x1;}}_0x342a35[_0x8e27('0x8c')](new Extension(_0x52afe5,_0x31b614,'6',_0x8e27('0x96')));_0x31b614+=0x1;_0x342a35[_0x8e27('0x8c')](new Extension(_0x52afe5,_0x31b614,_0x8e27('0x97'),_0x8e27('0x98')));_0x31b614=0x0;return _0x342a35;}exports[_0x8e27('0x99')]=function(_0x51ae2b,_0x22f2b5,_0x41317b){var _0x32a349;return db['sequelize']['transaction'](function(_0x2e2736){return db[_0x8e27('0x3f')]['create'](_0x51ae2b['body'],{'transaction':_0x2e2736})[_0x8e27('0x23')](function(_0x42a20d){_0x32a349=_0x42a20d[_0x8e27('0x5f')]({'plain':!![]});return db[_0x8e27('0x9a')][_0x8e27('0x80')](createExtensionsReciveFax(_0x32a349),{'transaction':_0x2e2736});});})[_0x8e27('0x23')](function(){return _0x32a349;})['then'](respondWithResult(_0x22f2b5,null))[_0x8e27('0x2d')](handleError(_0x22f2b5,null));};exports['updateAccountApplications']=function(_0x501af5,_0x5401de,_0x29d4b6){var _0x45bc11;return db[_0x8e27('0x9b')]['transaction'](function(_0x553d3b){return db['FaxAccount'][_0x8e27('0x9c')](_0x501af5[_0x8e27('0x5d')],{'where':{'id':_0x501af5[_0x8e27('0x5d')]['id']},'transaction':_0x553d3b})[_0x8e27('0x23')](function(_0xa307bd){return db['VoiceExtension'][_0x8e27('0x38')]({'where':{'FaxAccountId':_0x501af5['body']['id']},'transaction':_0x553d3b})['then'](function(_0x59b7a4){return db[_0x8e27('0x9a')][_0x8e27('0x80')](createExtensionsReciveFax(_[_0x8e27('0x75')](_0x501af5[_0x8e27('0x5d')],['tech',_0x8e27('0x43'),_0x8e27('0x9d'),_0x8e27('0x9e'),_0x8e27('0x9f'),'ListId'])),{'transaction':_0x553d3b});});});})[_0x8e27('0x23')](function(){return db[_0x8e27('0x3f')][_0x8e27('0xa0')](_0x501af5['body']['id']);})[_0x8e27('0x23')](respondWithResult(_0x5401de,null))[_0x8e27('0x2d')](handleError(_0x5401de,null));};exports[_0x8e27('0xa1')]=function(_0x49c735,_0x42dced,_0x262685){var _0xaadf98={'raw':!![],'where':{}};var _0x5ea6eb={};var _0x4e25db={'count':0x0,'rows':[]};return db[_0x8e27('0x3f')]['findOne']({'where':{'id':_0x49c735[_0x8e27('0x58')]['id']}})[_0x8e27('0x23')](handleEntityNotFound(_0x42dced,null))[_0x8e27('0x23')](function(_0x507995){if(_0x507995){_0x5ea6eb['model']=_[_0x8e27('0x45')](db['FaxMessage'][_0x8e27('0x40')]);_0x5ea6eb[_0x8e27('0x44')]=_[_0x8e27('0x45')](_0x49c735[_0x8e27('0x44')]);_0x5ea6eb[_0x8e27('0x46')]=_[_0x8e27('0x47')](_0x5ea6eb[_0x8e27('0x5a')],_0x5ea6eb[_0x8e27('0x44')]);_0xaadf98[_0x8e27('0x48')]=_[_0x8e27('0x47')](_0x5ea6eb['model'],qs[_0x8e27('0x49')](_0x49c735['query'][_0x8e27('0x49')]));_0xaadf98[_0x8e27('0x48')]=_0xaadf98[_0x8e27('0x48')][_0x8e27('0x4a')]?_0xaadf98['attributes']:_0x5ea6eb[_0x8e27('0x5a')];if(!_0x49c735[_0x8e27('0x44')][_0x8e27('0x4b')]('nolimit')){_0xaadf98[_0x8e27('0x34')]=qs[_0x8e27('0x34')](_0x49c735[_0x8e27('0x44')]['limit']);_0xaadf98[_0x8e27('0x32')]=qs[_0x8e27('0x32')](_0x49c735[_0x8e27('0x44')][_0x8e27('0x32')]);}_0xaadf98[_0x8e27('0x4d')]=qs['sort'](_0x49c735['query'][_0x8e27('0x4e')]);_0xaadf98[_0x8e27('0x4f')]=qs[_0x8e27('0x46')](_[_0x8e27('0x50')](_0x49c735[_0x8e27('0x44')],_0x5ea6eb[_0x8e27('0x46')]));_0xaadf98[_0x8e27('0x4f')][_0x8e27('0x68')]=_0x507995['id'];if(_0x49c735['query']['filter']){_0xaadf98['where']=_['merge'](_0xaadf98[_0x8e27('0x4f')],{'$or':_[_0x8e27('0x3e')](_0xaadf98[_0x8e27('0x48')],function(_0x42914c){var _0x4c7faf={};_0x4c7faf[_0x42914c]={'$like':'%'+_0x49c735['query']['filter']+'%'};return _0x4c7faf;})});}if(_0x49c735['query'][_0x8e27('0xa2')]){var _0x994f60=_0x49c735[_0x8e27('0x44')][_0x8e27('0xa2')][_0x8e27('0xa3')](',');var _0x5e9a8c={};_0x5e9a8c[_0x994f60[0x0]]={'$gte':moment(_0x994f60[0x1])[_0x8e27('0xa4')](_0x8e27('0xa5'))};_0xaadf98[_0x8e27('0x4f')]=_['merge'](_0xaadf98[_0x8e27('0x4f')],_0x5e9a8c);}_0xaadf98=_['merge']({},_0xaadf98,_0x49c735[_0x8e27('0x53')]);return db[_0x8e27('0xa6')]['count']({'where':_0xaadf98[_0x8e27('0x4f')]})[_0x8e27('0x23')](function(_0x5bf918){_0x4e25db[_0x8e27('0x33')]=_0x5bf918;if(_0x49c735[_0x8e27('0x44')]['includeAll']){_0xaadf98[_0x8e27('0x55')]=[{'all':!![]}];}return db[_0x8e27('0xa6')][_0x8e27('0x6c')](_0xaadf98);})['then'](function(_0x235780){_0x4e25db[_0x8e27('0x56')]=_0x235780;return _0x4e25db;});}})[_0x8e27('0x23')](respondWithFilteredResult(_0x42dced,_0xaadf98))[_0x8e27('0x2d')](handleError(_0x42dced,null));};exports[_0x8e27('0x3b')]=function(_0xe94745,_0x8ff4b1,_0x36e101){var _0x3e7036,_0x2b92d8={},_0x2c9434;if(_0xe94745['body']['to']){_0x2c9434=_0xe94745['body']['to'][0x0];}return db[_0x8e27('0x3f')][_0x8e27('0x5b')]({'where':{'id':_0xe94745[_0x8e27('0x58')]['id']},'include':[{'model':db[_0x8e27('0xa7')],'as':_0x8e27('0xa8'),'include':[{'model':db[_0x8e27('0xa9')],'as':_0x8e27('0xaa'),'where':{'fax':_0x2c9434},'limit':0x1,'order':[[_0x8e27('0x9e'),_0x8e27('0xab')]]}]}]})[_0x8e27('0x23')](handleEntityNotFound(_0x8ff4b1,null))[_0x8e27('0x23')](function(_0xbd2ef6){_0x3e7036=_0xbd2ef6;if(_0xe94745[_0x8e27('0x5d')][_0x8e27('0xac')]&&_0xe94745[_0x8e27('0x5d')][_0x8e27('0xac')][_0x8e27('0x4a')]){for(var _0x18d5c4=0x0;_0x18d5c4<_0xe94745['body'][_0x8e27('0xac')][_0x8e27('0x4a')];_0x18d5c4+=0x1){_0xe94745[_0x8e27('0x5d')][_0x8e27('0xac')][_0x18d5c4]={'filename':_0xe94745[_0x8e27('0x5d')][_0x8e27('0xac')][_0x18d5c4][_0x8e27('0x3a')],'id':_0xe94745[_0x8e27('0x5d')][_0x8e27('0xac')][_0x18d5c4]['id'],'path':path['join'](config[_0x8e27('0xad')],_0x8e27('0xae'),_0xe94745[_0x8e27('0x5d')][_0x8e27('0xac')][_0x18d5c4][_0x8e27('0xaf')])};}}return respondWithRpcPromise(_0x8e27('0xb0'),_0x8e27('0xb0'),{'FaxAccountId':_[_0x8e27('0xb1')](_0xe94745[_0x8e27('0x58')]['id'])?undefined:_0xe94745['params']['id'],'path':_['isNil'](_0xe94745[_0x8e27('0x5d')]['attachments'][0x0][_0x8e27('0xb2')])?undefined:_0xe94745[_0x8e27('0x5d')][_0x8e27('0xac')][0x0]['path'],'fax':_[_0x8e27('0xb1')](_0xe94745[_0x8e27('0x5d')]['to'][0x0])?undefined:_0xe94745['body']['to'][0x0]},client9002);})[_0x8e27('0x23')](function(){if(_0x3e7036){if(_[_0x8e27('0xb1')](_0xe94745['body'][_0x8e27('0xb3')])){_0xe94745[_0x8e27('0x5d')][_0x8e27('0xb3')]=util[_0x8e27('0xa4')](_0x8e27('0xb4'),_0x3e7036['name'],_0x3e7036[_0x8e27('0xb5')]);}if(_0x3e7036['List']){if(_0x3e7036[_0x8e27('0xa8')][_0x8e27('0xaa')][_0x8e27('0x4a')]){return _0x3e7036['List'][_0x8e27('0xaa')][0x0];}else{return db[_0x8e27('0xa9')][_0x8e27('0x5c')](_[_0x8e27('0x1a')](_0xe94745[_0x8e27('0x5d')],{'firstName':_0xe94745['body']['to'][0x0],'phone':_0xe94745[_0x8e27('0x5d')]['to'][0x0],'fax':_0xe94745[_0x8e27('0x5d')]['to'][0x0],'ListId':_0x3e7036['ListId']}));}}else{throw new Error(_0x8e27('0xb6'));}}else{throw new Error(_0x8e27('0xb7'));}})[_0x8e27('0x23')](function(_0x123866){if(_0x123866){return db[_0x8e27('0x74')][_0x8e27('0x5b')]({'where':{'ContactId':_0x123866['id'],'closed':![],'FaxAccountId':_0x3e7036['id']}})['then'](function(_0x938034){if(_0x938034){return[_0x938034,![]];}return db['FaxInteraction'][_0x8e27('0x5c')]({'UserId':_0xe94745[_0x8e27('0x5e')]['id'],'ContactId':_0x123866['id'],'FaxAccountId':_0x3e7036['id'],'fax':_0xe94745[_0x8e27('0x5d')]['to'][0x0],'firstMsgDirection':_0x8e27('0xb8'),'Messages':[_['merge'](_0xe94745[_0x8e27('0x5d')],{'read':![],'body':_0xe94745[_0x8e27('0x5d')][_0x8e27('0xac')][0x0][_0x8e27('0xb9')],'FaxAccountId':_0x3e7036['id'],'UserId':_0xe94745[_0x8e27('0x5e')]['id'],'ContactId':_0x123866['id'],'AttachmentId':_0xe94745[_0x8e27('0x5d')][_0x8e27('0xac')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x8e27('0xba')}]})['then'](function(_0x36b74d){return[_0x36b74d,!![]];});});}else{throw new Error(_0x8e27('0xbb'));}})[_0x8e27('0xbc')](function(_0x1b4702,_0xea7e7f){if(_0xea7e7f){return _0x1b4702;}return db['FaxMessage'][_0x8e27('0x5c')]({'direction':_0x8e27('0xb8'),'read':![],'body':_0xe94745[_0x8e27('0x5d')][_0x8e27('0xac')][0x0]['filename'],'FaxAccountId':_0x3e7036['id'],'FaxInteractionId':_0x1b4702['id'],'UserId':_0xe94745[_0x8e27('0x5e')]['id'],'ContactId':_0x1b4702[_0x8e27('0xbd')],'AttachmentId':_0xe94745['body'][_0x8e27('0xac')][0x0]['id']})[_0x8e27('0x23')](function(_0x213d87){_0x1b4702['dataValues']['Messages']=[];_0x1b4702[_0x8e27('0xbe')][_0x8e27('0xba')][_0x8e27('0x8c')](_0x213d87['dataValues']);return _0x1b4702;});})['then'](function(_0x4fd7c4){respondWithRpcPromise(_0x8e27('0xbf'),_0x8e27('0xbf'),{'FaxAccountId':_[_0x8e27('0xb1')](_0xe94745[_0x8e27('0x58')]['id'])?undefined:_0xe94745[_0x8e27('0x58')]['id'],'path':_[_0x8e27('0xb1')](_0xe94745[_0x8e27('0x5d')]['attachments'][0x0]['path'])?undefined:_0xe94745[_0x8e27('0x5d')][_0x8e27('0xac')][0x0][_0x8e27('0xb2')],'fax':_['isNil'](_0xe94745[_0x8e27('0x5d')]['to'][0x0])?undefined:_0xe94745[_0x8e27('0x5d')]['to'][0x0],'AttachmentId':_0xe94745[_0x8e27('0x5d')][_0x8e27('0xac')][0x0]['id']},client9002)['then'](function(_0x145b67){logger[_0x8e27('0x24')](_0x8e27('0xc0'),_0x145b67);})[_0x8e27('0x2d')](function(_0x1c5e2b){logger['info']('SendFaxRpc,\x20%s',_0x1c5e2b);});return _0x4fd7c4;})['then'](respondWithResult(_0x8ff4b1,null))['catch'](handleError(_0x8ff4b1,null));};exports[_0x8e27('0xc1')]=function(_0x127909,_0x18fa19,_0x429798){return db['FaxAccount'][_0x8e27('0x5b')]({'where':{'id':_0x127909[_0x8e27('0x58')]['id']}})['then'](handleEntityNotFound(_0x18fa19,null))[_0x8e27('0x23')](function(_0x562ae8){if(_0x562ae8){return _0x562ae8[_0x8e27('0xc1')](_0x127909[_0x8e27('0x5d')][_0x8e27('0x6e')],_['omit'](_0x127909[_0x8e27('0x5d')],[_0x8e27('0x6e'),'id'])||{})[_0x8e27('0xbc')](function(_0x48e8f8){for(var _0x1d9699=0x0;_0x1d9699<_0x127909[_0x8e27('0x5d')][_0x8e27('0x6e')][_0x8e27('0x4a')];_0x1d9699+=0x1){socket['emit'](_0x8e27('0xc2'),{'UserId':Number(_0x127909[_0x8e27('0x5d')][_0x8e27('0x6e')][_0x1d9699]),'FaxAccountId':Number(_0x127909[_0x8e27('0x58')]['id'])});}return _0x48e8f8;});}})[_0x8e27('0x23')](respondWithResult(_0x18fa19,null))[_0x8e27('0x2d')](handleError(_0x18fa19,null));};exports[_0x8e27('0xc3')]=function(_0x50e20e,_0x3521d6,_0x13fbd7){return db[_0x8e27('0x3f')][_0x8e27('0x5b')]({'where':{'id':_0x50e20e[_0x8e27('0x58')]['id']}})['then'](handleEntityNotFound(_0x3521d6,null))[_0x8e27('0x23')](function(_0x516d84){if(_0x516d84){return _0x516d84[_0x8e27('0xc3')](_0x50e20e['query'][_0x8e27('0x6e')])[_0x8e27('0x23')](function(){if(_[_0x8e27('0xc4')](_0x50e20e['query'][_0x8e27('0x6e')])){for(var _0x1c4bb8=0x0;_0x1c4bb8<_0x50e20e[_0x8e27('0x44')][_0x8e27('0x6e')]['length'];_0x1c4bb8+=0x1){socket[_0x8e27('0xc5')]('userFaxAccount:remove',{'UserId':Number(_0x50e20e[_0x8e27('0x44')][_0x8e27('0x6e')][_0x1c4bb8]),'FaxAccountId':Number(_0x50e20e['params']['id'])});}}else{socket[_0x8e27('0xc5')](_0x8e27('0xc6'),{'UserId':Number(_0x50e20e[_0x8e27('0x44')]['ids']),'FaxAccountId':Number(_0x50e20e['params']['id'])});}});}})[_0x8e27('0x23')](respondWithStatusCode(_0x3521d6,null))[_0x8e27('0x2d')](handleError(_0x3521d6,null));};exports['getAgents']=function(_0x3bd1ad,_0x45908c,_0x2134bc){var _0x43b557={};var _0x55ed77={};var _0x18ff5b;var _0x5b1749;return db[_0x8e27('0x3f')][_0x8e27('0x6a')]({'where':{'id':_0x3bd1ad[_0x8e27('0x58')]['id']}})[_0x8e27('0x23')](handleEntityNotFound(_0x45908c,null))[_0x8e27('0x23')](function(_0x212bbf){if(_0x212bbf){_0x18ff5b=_0x212bbf;_0x55ed77[_0x8e27('0x5a')]=_[_0x8e27('0x45')](db['User'][_0x8e27('0x40')]);_0x55ed77[_0x8e27('0x44')]=_[_0x8e27('0x45')](_0x3bd1ad[_0x8e27('0x44')]);_0x55ed77[_0x8e27('0x46')]=_[_0x8e27('0x47')](_0x55ed77['model'],_0x55ed77[_0x8e27('0x44')]);_0x43b557[_0x8e27('0x48')]=_[_0x8e27('0x47')](_0x55ed77[_0x8e27('0x5a')],qs[_0x8e27('0x49')](_0x3bd1ad['query'][_0x8e27('0x49')]));_0x43b557[_0x8e27('0x48')]=_0x43b557['attributes'][_0x8e27('0x4a')]?_0x43b557[_0x8e27('0x48')]:_0x55ed77[_0x8e27('0x5a')];_0x43b557[_0x8e27('0x4d')]=qs[_0x8e27('0x4e')](_0x3bd1ad[_0x8e27('0x44')][_0x8e27('0x4e')]);_0x43b557[_0x8e27('0x4f')]=qs[_0x8e27('0x46')](_[_0x8e27('0x50')](_0x3bd1ad[_0x8e27('0x44')],_0x55ed77['filters']));if(_0x3bd1ad['query'][_0x8e27('0x6b')]){_0x43b557[_0x8e27('0x4f')]=_['merge'](_0x43b557[_0x8e27('0x4f')],{'$or':_[_0x8e27('0x3e')](_0x43b557[_0x8e27('0x48')],function(_0x3b1775){var _0x4c121b={};_0x4c121b[_0x3b1775]={'$like':'%'+_0x3bd1ad[_0x8e27('0x44')]['filter']+'%'};return _0x4c121b;})});}_0x43b557=_[_0x8e27('0x51')]({},_0x43b557,_0x3bd1ad[_0x8e27('0x53')]);return _0x18ff5b[_0x8e27('0xc7')](_0x43b557);}})[_0x8e27('0x23')](function(_0x24ab97){if(_0x24ab97){_0x5b1749=_0x24ab97[_0x8e27('0x4a')];if(!_0x3bd1ad[_0x8e27('0x44')]['hasOwnProperty'](_0x8e27('0x4c'))){_0x43b557[_0x8e27('0x34')]=qs['limit'](_0x3bd1ad['query'][_0x8e27('0x34')]);_0x43b557[_0x8e27('0x32')]=qs[_0x8e27('0x32')](_0x3bd1ad[_0x8e27('0x44')][_0x8e27('0x32')]);}return _0x18ff5b[_0x8e27('0xc7')](_0x43b557);}})[_0x8e27('0x23')](function(_0x397d1f){if(_0x397d1f){return _0x397d1f?{'count':_0x5b1749,'rows':_0x397d1f}:null;}})['then'](respondWithResult(_0x45908c,null))[_0x8e27('0x2d')](handleError(_0x45908c,null));}; \ No newline at end of file +var _0x1663=['ecm','gateway','faxdetect','headerinfo','maxrate','minrate','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','addAccountApplications','sequelize','VoiceExtension','bulkCreate','tech','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','List','Contacts','DESC','attachments','join','root','server/files/attachments','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFaxRpc,\x20%s','addAgents','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','get','FaxAccounts','UserProfileResource','destroy','end','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','fieldName','type','key','model','query','keys','filters','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','rows','intersection','length','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','FaxAccountId','Disposition','getDispositions','includeAll','include','findAll','removeDispositions','ids','CannedAnswer','getAnswers','findOne','rawAttributes','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','User','Owner','fullname','Tag','Tags','color','tag','transaction','FaxApplication','findAndCountAll','priority','getApplications','context','from-voip-provider','exten','localstationid','description','Fax\x20Extension','appdata','Answer','push','Set'];(function(_0x3a634f,_0x24eb11){var _0x3ef9f2=function(_0x14f496){while(--_0x14f496){_0x3a634f['push'](_0x3a634f['shift']());}};_0x3ef9f2(++_0x24eb11);}(_0x1663,0x1be));var _0x3166=function(_0x5503b9,_0x5437c5){_0x5503b9=_0x5503b9-0x0;var _0x451c16=_0x1663[_0x5503b9];return _0x451c16;};'use strict';var emlformat=require(_0x3166('0x0'));var rimraf=require(_0x3166('0x1'));var zipdir=require(_0x3166('0x2'));var jsonpatch=require(_0x3166('0x3'));var rp=require(_0x3166('0x4'));var moment=require('moment');var BPromise=require(_0x3166('0x5'));var Mustache=require(_0x3166('0x6'));var util=require(_0x3166('0x7'));var path=require(_0x3166('0x8'));var sox=require(_0x3166('0x9'));var csv=require(_0x3166('0xa'));var ejs=require(_0x3166('0xb'));var fs=require('fs');var fs_extra=require(_0x3166('0xc'));var _=require(_0x3166('0xd'));var squel=require(_0x3166('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3166('0xa'));var querystring=require(_0x3166('0xf'));var Papa=require(_0x3166('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3166('0x11'));var as=require(_0x3166('0x12'));var hardwareService=require(_0x3166('0x13'));var logger=require(_0x3166('0x14'))(_0x3166('0x15'));var utils=require(_0x3166('0x16'));var config=require(_0x3166('0x17'));var licenseUtil=require(_0x3166('0x18'));var db=require('../../mysqldb')['db'];config[_0x3166('0x19')]=_['defaults'](config[_0x3166('0x19')],{'host':_0x3166('0x1a'),'port':0x18eb});var socket=require(_0x3166('0x1b'))(new Redis(config[_0x3166('0x19')]));require(_0x3166('0x1c'))[_0x3166('0x1d')](socket);var jayson=require(_0x3166('0x1e'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x3166('0x1f')][_0x3166('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x54f39c,_0x356b25,_0x40df2a,_0x3db77a){return new BPromise(function(_0x420108,_0x6c8d61){var _0x1664c2=_0x3db77a||client;return _0x1664c2[_0x3166('0x21')](_0x54f39c,_0x40df2a)[_0x3166('0x22')](function(_0x4b5334){logger[_0x3166('0x23')](_0x3166('0x24'),_0x356b25,_0x3166('0x25'));logger[_0x3166('0x26')](_0x3166('0x27'),_0x356b25,_0x3166('0x25'),JSON[_0x3166('0x28')](_0x4b5334));if(_0x4b5334[_0x3166('0x29')]){if(_0x4b5334[_0x3166('0x29')]['code']===0x1f4){logger['error'](_0x3166('0x24'),_0x356b25,_0x4b5334[_0x3166('0x29')][_0x3166('0x2a')]);return _0x6c8d61(_0x4b5334[_0x3166('0x29')][_0x3166('0x2a')]);}logger[_0x3166('0x29')](_0x3166('0x24'),_0x356b25,_0x4b5334[_0x3166('0x29')][_0x3166('0x2a')]);return _0x420108(_0x4b5334[_0x3166('0x29')][_0x3166('0x2a')]);}else{logger[_0x3166('0x23')](_0x3166('0x24'),_0x356b25,'request\x20sent');_0x420108(_0x4b5334[_0x3166('0x2b')]['message']);}})[_0x3166('0x2c')](function(_0x2c2de1){logger[_0x3166('0x29')](_0x3166('0x24'),_0x356b25,_0x2c2de1);_0x6c8d61(_0x2c2de1);});});}function respondWithStatusCode(_0x52f3a2,_0x157d13){_0x157d13=_0x157d13||0xcc;return function(_0x1e7ac0){if(_0x1e7ac0){return _0x52f3a2[_0x3166('0x2d')](_0x157d13);}return _0x52f3a2[_0x3166('0x2e')](_0x157d13)['end']();};}function respondWithResult(_0x342d1f,_0x3cdda1){_0x3cdda1=_0x3cdda1||0xc8;return function(_0x4b9752){if(_0x4b9752){return _0x342d1f[_0x3166('0x2e')](_0x3cdda1)[_0x3166('0x2f')](_0x4b9752);}};}function respondWithFilteredResult(_0x3b3775,_0x366c36){return function(_0x229017){if(_0x229017){var _0x316c39=typeof _0x366c36[_0x3166('0x30')]===_0x3166('0x31')&&typeof _0x366c36[_0x3166('0x32')]===_0x3166('0x31');var _0x363a89=_0x229017[_0x3166('0x33')];var _0x487821=_0x316c39?0x0:_0x366c36[_0x3166('0x30')];var _0x3c9aa9=_0x316c39?_0x229017[_0x3166('0x33')]:_0x366c36[_0x3166('0x30')]+_0x366c36[_0x3166('0x32')];var _0xbd7491;if(_0x3c9aa9>=_0x363a89){_0x3c9aa9=_0x363a89;_0xbd7491=0xc8;}else{_0xbd7491=0xce;}_0x3b3775['status'](_0xbd7491);return _0x3b3775[_0x3166('0x34')](_0x3166('0x35'),_0x487821+'-'+_0x3c9aa9+'/'+_0x363a89)[_0x3166('0x2f')](_0x229017);}return null;};}function patchUpdates(_0x3b70f0){return function(_0x1bd078){try{jsonpatch[_0x3166('0x36')](_0x1bd078,_0x3b70f0,!![]);}catch(_0x5c8f59){return BPromise[_0x3166('0x37')](_0x5c8f59);}return _0x1bd078[_0x3166('0x38')]();};}function saveUpdates(_0x2469e7,_0xd634a4){return function(_0x2c5745){if(_0x2c5745){return _0x2c5745[_0x3166('0x39')](_0x2469e7)['then'](function(_0xa73df9){return _0xa73df9;});}return null;};}function removeEntity(_0x104184,_0x3f4714){return function(_0x55ec53){if(_0x55ec53){return _0x55ec53['destroy']()['then'](function(){var _0x3fe8c9=_0x55ec53[_0x3166('0x3a')]({'plain':!![]});var _0x1deefc=_0x3166('0x3b');return db[_0x3166('0x3c')][_0x3166('0x3d')]({'where':{'type':_0x1deefc,'resourceId':_0x3fe8c9['id']}})[_0x3166('0x22')](function(){return _0x55ec53;});})['then'](function(){_0x104184[_0x3166('0x2e')](0xcc)[_0x3166('0x3e')]();});}};}function handleEntityNotFound(_0x4b793b,_0x19095b){return function(_0x2a3365){if(!_0x2a3365){_0x4b793b[_0x3166('0x2d')](0x194);}return _0x2a3365;};}function handleError(_0x547e28,_0x1f7c7f){_0x1f7c7f=_0x1f7c7f||0x1f4;return function(_0x5677b2){logger[_0x3166('0x29')](_0x5677b2[_0x3166('0x3f')]);if(_0x5677b2['name']){delete _0x5677b2[_0x3166('0x40')];}_0x547e28['status'](_0x1f7c7f)[_0x3166('0x41')](_0x5677b2);};}exports[_0x3166('0x42')]=function(_0x455bdd,_0x3f6f97){var _0x420b7c={'include':[{'model':db[_0x3166('0x43')],'as':_0x3166('0x44')}]},_0x203d60={},_0x26e07b={'count':0x0,'rows':[]};var _0x2989cc=_[_0x3166('0x45')](db[_0x3166('0x46')]['rawAttributes'],function(_0x138c21){return{'name':_0x138c21[_0x3166('0x47')],'type':_0x138c21[_0x3166('0x48')][_0x3166('0x49')]};});_0x203d60[_0x3166('0x4a')]=_[_0x3166('0x45')](_0x2989cc,_0x3166('0x40'));_0x203d60[_0x3166('0x4b')]=_[_0x3166('0x4c')](_0x455bdd['query']);_0x203d60[_0x3166('0x4d')]=_['intersection'](_0x203d60[_0x3166('0x4a')],_0x203d60['query']);_0x420b7c['attributes']=_['intersection'](_0x203d60[_0x3166('0x4a')],qs[_0x3166('0x4e')](_0x455bdd[_0x3166('0x4b')][_0x3166('0x4e')]));_0x420b7c[_0x3166('0x4f')]=_0x420b7c[_0x3166('0x4f')]['length']?_0x420b7c['attributes']:_0x203d60['model'];if(!_0x455bdd[_0x3166('0x4b')][_0x3166('0x50')](_0x3166('0x51'))){_0x420b7c[_0x3166('0x32')]=qs[_0x3166('0x32')](_0x455bdd[_0x3166('0x4b')][_0x3166('0x32')]);_0x420b7c['offset']=qs[_0x3166('0x30')](_0x455bdd['query'][_0x3166('0x30')]);}_0x420b7c[_0x3166('0x52')]=qs['sort'](_0x455bdd['query'][_0x3166('0x53')]);_0x420b7c['where']=qs['filters'](_[_0x3166('0x54')](_0x455bdd[_0x3166('0x4b')],_0x203d60[_0x3166('0x4d')]),_0x2989cc);if(_0x455bdd['query'][_0x3166('0x55')]){_0x420b7c['where']=_[_0x3166('0x56')](_0x420b7c[_0x3166('0x57')],{'$or':_[_0x3166('0x45')](_0x2989cc,function(_0x3c42e1){if(_0x3c42e1[_0x3166('0x48')]!==_0x3166('0x58')){var _0x11d4e3={};_0x11d4e3[_0x3c42e1[_0x3166('0x40')]]={'$like':'%'+_0x455bdd[_0x3166('0x4b')][_0x3166('0x55')]+'%'};return _0x11d4e3;}})});}_0x420b7c=_[_0x3166('0x56')]({},_0x420b7c,_0x455bdd[_0x3166('0x59')]);var _0x316478={'where':_0x420b7c[_0x3166('0x57')]};return db['FaxAccount'][_0x3166('0x33')](_0x316478)[_0x3166('0x22')](function(_0x2df9a3){_0x26e07b['count']=_0x2df9a3;if(_0x455bdd[_0x3166('0x4b')]['includeAll']){_0x420b7c['include']=[{'all':!![]}];}return db[_0x3166('0x46')]['findAll'](_0x420b7c);})[_0x3166('0x22')](function(_0x5565ef){_0x26e07b[_0x3166('0x5a')]=_0x5565ef;return _0x26e07b;})[_0x3166('0x22')](respondWithFilteredResult(_0x3f6f97,_0x420b7c))[_0x3166('0x2c')](handleError(_0x3f6f97,null));};exports['show']=function(_0x250a11,_0x36d1d){var _0x5d2727={'raw':![],'where':{'id':_0x250a11['params']['id']},'include':[{'model':db[_0x3166('0x43')],'as':'mandatoryDispositionPause'}]},_0x19fd5d={};_0x19fd5d['model']=_['keys'](db[_0x3166('0x46')]['rawAttributes']);_0x19fd5d[_0x3166('0x4b')]=_['keys'](_0x250a11[_0x3166('0x4b')]);_0x19fd5d[_0x3166('0x4d')]=_[_0x3166('0x5b')](_0x19fd5d[_0x3166('0x4a')],_0x19fd5d[_0x3166('0x4b')]);_0x5d2727[_0x3166('0x4f')]=_['intersection'](_0x19fd5d['model'],qs[_0x3166('0x4e')](_0x250a11[_0x3166('0x4b')][_0x3166('0x4e')]));_0x5d2727[_0x3166('0x4f')]=_0x5d2727['attributes'][_0x3166('0x5c')]?_0x5d2727[_0x3166('0x4f')]:_0x19fd5d[_0x3166('0x4a')];if(_0x250a11[_0x3166('0x4b')]['includeAll']){_0x5d2727['include']=[{'all':!![]}];}_0x5d2727=_['merge']({},_0x5d2727,_0x250a11['options']);return db['FaxAccount'][_0x3166('0x5d')](_0x5d2727)[_0x3166('0x22')](handleEntityNotFound(_0x36d1d,null))[_0x3166('0x22')](respondWithResult(_0x36d1d,null))[_0x3166('0x2c')](handleError(_0x36d1d,null));};exports[_0x3166('0x5e')]=function(_0xd78e4b,_0x551ba9){return db[_0x3166('0x46')]['create'](_0xd78e4b[_0x3166('0x5f')],{})[_0x3166('0x22')](function(_0x556b1f){var _0x1f992d=_0xd78e4b[_0x3166('0x60')]['get']({'plain':!![]});if(!_0x1f992d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1f992d[_0x3166('0x61')]===_0x3166('0x60')){var _0x8991bf=_0x556b1f[_0x3166('0x3a')]({'plain':!![]});var _0x1620f6=_0x3166('0x3b');return db[_0x3166('0x62')][_0x3166('0x5d')]({'where':{'name':_0x1620f6,'userProfileId':_0x1f992d[_0x3166('0x63')]},'raw':!![]})[_0x3166('0x22')](function(_0x583721){if(_0x583721&&_0x583721[_0x3166('0x64')]===0x0){return db['UserProfileResource'][_0x3166('0x5e')]({'name':_0x8991bf[_0x3166('0x40')],'resourceId':_0x8991bf['id'],'type':_0x583721[_0x3166('0x40')],'sectionId':_0x583721['id']},{})['then'](function(){return _0x556b1f;});}else{return _0x556b1f;}})[_0x3166('0x2c')](function(_0x36c2de){logger[_0x3166('0x29')](_0x3166('0x65'),_0x36c2de);throw _0x36c2de;});}return _0x556b1f;})[_0x3166('0x22')](respondWithResult(_0x551ba9,0xc9))[_0x3166('0x2c')](handleError(_0x551ba9,null));};exports[_0x3166('0x39')]=function(_0x4bcc61,_0x1d3e6a){if(_0x4bcc61['body']['id']){delete _0x4bcc61['body']['id'];}return db[_0x3166('0x46')][_0x3166('0x5d')]({'where':{'id':_0x4bcc61[_0x3166('0x66')]['id']},'include':[{'model':db[_0x3166('0x43')],'as':_0x3166('0x44')}]})[_0x3166('0x22')](handleEntityNotFound(_0x1d3e6a,null))[_0x3166('0x22')](saveUpdates(_0x4bcc61['body'],null))[_0x3166('0x22')](respondWithResult(_0x1d3e6a,null))[_0x3166('0x2c')](handleError(_0x1d3e6a,null));};exports[_0x3166('0x3d')]=function(_0x3c20b2,_0x36e987){return db[_0x3166('0x46')]['find']({'where':{'id':_0x3c20b2[_0x3166('0x66')]['id']}})['then'](handleEntityNotFound(_0x36e987,null))[_0x3166('0x22')](removeEntity(_0x36e987,null))[_0x3166('0x2c')](handleError(_0x36e987,null));};exports[_0x3166('0x67')]=function(_0x172ec7,_0x71688a){return db[_0x3166('0x46')]['describe']()[_0x3166('0x22')](respondWithResult(_0x71688a,null))['catch'](handleError(_0x71688a,null));};exports[_0x3166('0x68')]=function(_0x18b5f2,_0x31cd35,_0x1696eb){if(_0x18b5f2[_0x3166('0x5f')]['id']){delete _0x18b5f2['body']['id'];}return db[_0x3166('0x46')][_0x3166('0x5d')]({'where':{'id':_0x18b5f2[_0x3166('0x66')]['id']}})['then'](handleEntityNotFound(_0x31cd35,null))[_0x3166('0x22')](function(_0x2db73e){if(_0x2db73e){_0x18b5f2[_0x3166('0x5f')][_0x3166('0x69')]=_0x2db73e['id'];return db[_0x3166('0x6a')][_0x3166('0x5e')](_0x18b5f2[_0x3166('0x5f')]);}})[_0x3166('0x22')](respondWithResult(_0x31cd35,null))[_0x3166('0x2c')](handleError(_0x31cd35,null));};exports[_0x3166('0x6b')]=function(_0x525777,_0x420b8a,_0x390d71){var _0x4435aa={'raw':![],'where':{}};var _0x2c8acd={};var _0x11a8e9={'count':0x0,'rows':[]};return db[_0x3166('0x46')]['findOne']({'where':{'id':_0x525777[_0x3166('0x66')]['id']}})[_0x3166('0x22')](handleEntityNotFound(_0x420b8a,null))[_0x3166('0x22')](function(_0x15464d){if(_0x15464d){_0x2c8acd['model']=_[_0x3166('0x4c')](db[_0x3166('0x6a')]['rawAttributes']);_0x2c8acd[_0x3166('0x4b')]=_[_0x3166('0x4c')](_0x525777[_0x3166('0x4b')]);_0x2c8acd['filters']=_[_0x3166('0x5b')](_0x2c8acd[_0x3166('0x4a')],_0x2c8acd[_0x3166('0x4b')]);_0x4435aa[_0x3166('0x4f')]=_[_0x3166('0x5b')](_0x2c8acd[_0x3166('0x4a')],qs[_0x3166('0x4e')](_0x525777[_0x3166('0x4b')][_0x3166('0x4e')]));_0x4435aa[_0x3166('0x4f')]=_0x4435aa['attributes']['length']?_0x4435aa[_0x3166('0x4f')]:_0x2c8acd['model'];if(!_0x525777['query'][_0x3166('0x50')](_0x3166('0x51'))){_0x4435aa[_0x3166('0x32')]=qs[_0x3166('0x32')](_0x525777[_0x3166('0x4b')]['limit']);_0x4435aa['offset']=qs[_0x3166('0x30')](_0x525777[_0x3166('0x4b')][_0x3166('0x30')]);}_0x4435aa[_0x3166('0x52')]=qs[_0x3166('0x53')](_0x525777[_0x3166('0x4b')][_0x3166('0x53')]);_0x4435aa[_0x3166('0x57')]=qs[_0x3166('0x4d')](_[_0x3166('0x54')](_0x525777['query'],_0x2c8acd[_0x3166('0x4d')]));_0x4435aa[_0x3166('0x57')][_0x3166('0x69')]=_0x15464d['id'];if(_0x525777[_0x3166('0x4b')][_0x3166('0x55')]){_0x4435aa[_0x3166('0x57')]=_[_0x3166('0x56')](_0x4435aa[_0x3166('0x57')],{'$or':_[_0x3166('0x45')](_0x4435aa[_0x3166('0x4f')],function(_0x45fe80){var _0x20cfb2={};_0x20cfb2[_0x45fe80]={'$like':'%'+_0x525777[_0x3166('0x4b')][_0x3166('0x55')]+'%'};return _0x20cfb2;})});}_0x4435aa=_[_0x3166('0x56')]({},_0x4435aa,_0x525777['options']);return db[_0x3166('0x6a')][_0x3166('0x33')]({'where':_0x4435aa[_0x3166('0x57')]})['then'](function(_0x518061){_0x11a8e9[_0x3166('0x33')]=_0x518061;if(_0x525777[_0x3166('0x4b')][_0x3166('0x6c')]){_0x4435aa[_0x3166('0x6d')]=[{'all':!![]}];}return db[_0x3166('0x6a')][_0x3166('0x6e')](_0x4435aa);})[_0x3166('0x22')](function(_0x298dd4){_0x11a8e9['rows']=_0x298dd4;return _0x11a8e9;});}})[_0x3166('0x22')](respondWithFilteredResult(_0x420b8a,_0x4435aa))['catch'](handleError(_0x420b8a,null));};exports[_0x3166('0x6f')]=function(_0x58453f,_0x3cb664,_0x32c451){return db[_0x3166('0x46')][_0x3166('0x5d')]({'where':{'id':_0x58453f['params']['id']}})[_0x3166('0x22')](handleEntityNotFound(_0x3cb664,null))['then'](function(_0x3c0fef){if(_0x3c0fef){return _0x3c0fef['removeDispositions'](_0x58453f[_0x3166('0x4b')][_0x3166('0x70')]);}})[_0x3166('0x22')](respondWithStatusCode(_0x3cb664,null))[_0x3166('0x2c')](handleError(_0x3cb664,null));};exports['addAnswer']=function(_0x1628b3,_0x1a84dd,_0x372c57){if(_0x1628b3['body']['id']){delete _0x1628b3[_0x3166('0x5f')]['id'];}return db[_0x3166('0x46')][_0x3166('0x5d')]({'where':{'id':_0x1628b3[_0x3166('0x66')]['id']}})[_0x3166('0x22')](handleEntityNotFound(_0x1a84dd,null))['then'](function(_0xd0dc53){if(_0xd0dc53){_0x1628b3['body'][_0x3166('0x69')]=_0xd0dc53['id'];return db[_0x3166('0x71')]['create'](_0x1628b3[_0x3166('0x5f')]);}})[_0x3166('0x22')](respondWithResult(_0x1a84dd,null))[_0x3166('0x2c')](handleError(_0x1a84dd,null));};exports[_0x3166('0x72')]=function(_0x3de21b,_0x38c87e,_0x52d955){var _0x3ec382={'raw':![],'where':{}};var _0x48cc3e={};var _0x9acb16={'count':0x0,'rows':[]};return db[_0x3166('0x46')][_0x3166('0x73')]({'where':{'id':_0x3de21b[_0x3166('0x66')]['id']}})[_0x3166('0x22')](handleEntityNotFound(_0x38c87e,null))[_0x3166('0x22')](function(_0x544af2){if(_0x544af2){_0x48cc3e['model']=_['keys'](db['CannedAnswer'][_0x3166('0x74')]);_0x48cc3e[_0x3166('0x4b')]=_[_0x3166('0x4c')](_0x3de21b[_0x3166('0x4b')]);_0x48cc3e[_0x3166('0x4d')]=_['intersection'](_0x48cc3e[_0x3166('0x4a')],_0x48cc3e['query']);_0x3ec382[_0x3166('0x4f')]=_[_0x3166('0x5b')](_0x48cc3e[_0x3166('0x4a')],qs[_0x3166('0x4e')](_0x3de21b[_0x3166('0x4b')][_0x3166('0x4e')]));_0x3ec382[_0x3166('0x4f')]=_0x3ec382[_0x3166('0x4f')]['length']?_0x3ec382[_0x3166('0x4f')]:_0x48cc3e['model'];if(!_0x3de21b[_0x3166('0x4b')][_0x3166('0x50')](_0x3166('0x51'))){_0x3ec382[_0x3166('0x32')]=qs[_0x3166('0x32')](_0x3de21b[_0x3166('0x4b')][_0x3166('0x32')]);_0x3ec382[_0x3166('0x30')]=qs[_0x3166('0x30')](_0x3de21b[_0x3166('0x4b')][_0x3166('0x30')]);}_0x3ec382[_0x3166('0x52')]=qs[_0x3166('0x53')](_0x3de21b['query'][_0x3166('0x53')]);_0x3ec382[_0x3166('0x57')]=qs[_0x3166('0x4d')](_[_0x3166('0x54')](_0x3de21b[_0x3166('0x4b')],_0x48cc3e['filters']));_0x3ec382[_0x3166('0x57')][_0x3166('0x69')]=_0x544af2['id'];if(_0x3de21b[_0x3166('0x4b')]['filter']){_0x3ec382[_0x3166('0x57')]=_[_0x3166('0x56')](_0x3ec382[_0x3166('0x57')],{'$or':_[_0x3166('0x45')](_0x3ec382[_0x3166('0x4f')],function(_0x24b966){var _0xdfe245={};_0xdfe245[_0x24b966]={'$like':'%'+_0x3de21b[_0x3166('0x4b')][_0x3166('0x55')]+'%'};return _0xdfe245;})});}_0x3ec382=_['merge']({},_0x3ec382,_0x3de21b[_0x3166('0x59')]);return db[_0x3166('0x71')]['count']({'where':_0x3ec382[_0x3166('0x57')]})['then'](function(_0x2b12a3){_0x9acb16['count']=_0x2b12a3;if(_0x3de21b[_0x3166('0x4b')][_0x3166('0x6c')]){_0x3ec382['include']=[{'all':!![]}];}return db[_0x3166('0x71')]['findAll'](_0x3ec382);})[_0x3166('0x22')](function(_0x4f443b){_0x9acb16[_0x3166('0x5a')]=_0x4f443b;return _0x9acb16;});}})[_0x3166('0x22')](respondWithFilteredResult(_0x38c87e,_0x3ec382))[_0x3166('0x2c')](handleError(_0x38c87e,null));};exports[_0x3166('0x75')]=function(_0x3f6e26,_0x562444,_0x45db81){return db[_0x3166('0x46')][_0x3166('0x5d')]({'where':{'id':_0x3f6e26[_0x3166('0x66')]['id']}})[_0x3166('0x22')](handleEntityNotFound(_0x562444,null))[_0x3166('0x22')](function(_0x478f6e){if(_0x478f6e){return _0x478f6e['removeAnswers'](_0x3f6e26['query'][_0x3166('0x70')]);}})[_0x3166('0x22')](respondWithStatusCode(_0x562444,null))[_0x3166('0x2c')](handleError(_0x562444,null));};exports[_0x3166('0x76')]=function(_0xc561ea,_0x36bc2d,_0x35110e){return db[_0x3166('0x77')]['find']({'where':{'id':_0xc561ea[_0x3166('0x66')]['id']}})[_0x3166('0x22')](handleEntityNotFound(_0x36bc2d,null))[_0x3166('0x22')](function(_0x1c1f4){if(_0x1c1f4){return _0x1c1f4[_0x3166('0x76')](_0xc561ea[_0x3166('0x5f')][_0x3166('0x70')],_[_0x3166('0x78')](_0xc561ea[_0x3166('0x5f')],[_0x3166('0x70'),'id'])||{});}})[_0x3166('0x22')](respondWithResult(_0x36bc2d,null))['catch'](handleError(_0x36bc2d,null));};exports[_0x3166('0x79')]=function(_0x59b82c,_0x54b32c,_0x184225){var _0x1b37d1={'raw':![],'where':{}};var _0x12d14f={};var _0x3fba91={'count':0x0,'rows':[]};return db[_0x3166('0x46')][_0x3166('0x73')]({'where':{'id':_0x59b82c[_0x3166('0x66')]['id']}})[_0x3166('0x22')](handleEntityNotFound(_0x54b32c,null))[_0x3166('0x22')](function(_0x55ff4f){if(_0x55ff4f){_0x12d14f[_0x3166('0x4a')]=_[_0x3166('0x4c')](db[_0x3166('0x77')]['rawAttributes']);_0x12d14f[_0x3166('0x4b')]=_[_0x3166('0x4c')](_0x59b82c[_0x3166('0x4b')]);_0x12d14f[_0x3166('0x4d')]=_['intersection'](_0x12d14f[_0x3166('0x4a')],_0x12d14f[_0x3166('0x4b')]);_0x1b37d1[_0x3166('0x4f')]=_['intersection'](_0x12d14f['model'],qs[_0x3166('0x4e')](_0x59b82c['query']['fields']));_0x1b37d1['attributes']=_0x1b37d1[_0x3166('0x4f')][_0x3166('0x5c')]?_0x1b37d1['attributes']:_0x12d14f[_0x3166('0x4a')];if(!_0x59b82c[_0x3166('0x4b')][_0x3166('0x50')](_0x3166('0x51'))){_0x1b37d1[_0x3166('0x32')]=qs[_0x3166('0x32')](_0x59b82c[_0x3166('0x4b')][_0x3166('0x32')]);_0x1b37d1[_0x3166('0x30')]=qs[_0x3166('0x30')](_0x59b82c['query'][_0x3166('0x30')]);}_0x1b37d1[_0x3166('0x52')]=qs[_0x3166('0x53')](_0x59b82c[_0x3166('0x4b')]['sort']);_0x1b37d1[_0x3166('0x57')]=qs[_0x3166('0x4d')](_['pick'](_0x59b82c[_0x3166('0x4b')],_0x12d14f[_0x3166('0x4d')]));_0x1b37d1[_0x3166('0x57')]['FaxAccountId']=_0x55ff4f['id'];if(_0x59b82c[_0x3166('0x4b')][_0x3166('0x55')]){_0x1b37d1[_0x3166('0x57')]=_[_0x3166('0x56')](_0x1b37d1[_0x3166('0x57')],{'$or':_[_0x3166('0x45')](_0x1b37d1[_0x3166('0x4f')],function(_0x437968){var _0x42b612={};_0x42b612[_0x437968]={'$like':'%'+_0x59b82c[_0x3166('0x4b')][_0x3166('0x55')]+'%'};return _0x42b612;})});}_0x1b37d1=_[_0x3166('0x56')]({},_0x1b37d1,_0x59b82c['options']);return db['FaxInteraction'][_0x3166('0x33')]({'where':_0x1b37d1[_0x3166('0x57')]})[_0x3166('0x22')](function(_0x9c6b96){_0x3fba91['count']=_0x9c6b96;if(_0x59b82c[_0x3166('0x4b')][_0x3166('0x6c')]){_0x1b37d1[_0x3166('0x6d')]=[{'model':db[_0x3166('0x7a')],'as':'Contact','required':![]},{'model':db[_0x3166('0x7b')],'as':_0x3166('0x7c'),'attributes':['name',_0x3166('0x7d'),'internal'],'required':![]},{'model':db[_0x3166('0x7e')],'as':_0x3166('0x7f'),'attributes':['id',_0x3166('0x40'),_0x3166('0x80')],'where':_0x59b82c['query'][_0x3166('0x81')]?{'id':_0x59b82c[_0x3166('0x4b')][_0x3166('0x81')]}:undefined,'required':_0x59b82c['query']['tag']?!![]:![]}];}return db[_0x3166('0x77')][_0x3166('0x6e')](_0x1b37d1);})[_0x3166('0x22')](function(_0x4fdb96){_0x3fba91[_0x3166('0x5a')]=_0x4fdb96;return _0x3fba91;});}})[_0x3166('0x22')](respondWithFilteredResult(_0x54b32c,_0x1b37d1))[_0x3166('0x2c')](handleError(_0x54b32c,null));};exports['addApplications']=function(_0x238bad,_0x12c612,_0x285f55){return db[_0x3166('0x46')][_0x3166('0x73')]({'where':{'id':_0x238bad[_0x3166('0x66')]['id']}})[_0x3166('0x22')](handleEntityNotFound(_0x12c612,null))['then'](function(_0x5cf789){if(_0x5cf789){return db['sequelize'][_0x3166('0x82')](function(_0x32143f){return db['FaxApplication'][_0x3166('0x3d')]({'where':{'FaxAccountId':_0x238bad[_0x3166('0x66')]['id']},'transaction':_0x32143f})[_0x3166('0x22')](function(_0x4527f2){var _0x134960=_[_0x3166('0x45')](_0x238bad['body'],function(_0x549cfc){_0x549cfc[_0x3166('0x69')]=_0x238bad[_0x3166('0x66')]['id'];return _0x549cfc;});return db[_0x3166('0x83')]['bulkCreate'](_0x134960,{'transaction':_0x32143f});});})[_0x3166('0x22')](function(){return db['FaxApplication'][_0x3166('0x84')]({'where':{'FaxAccountId':_0x238bad[_0x3166('0x66')]['id']},'order':_0x3166('0x85')});});}})[_0x3166('0x22')](respondWithResult(_0x12c612,null))[_0x3166('0x2c')](handleError(_0x12c612,null));};exports[_0x3166('0x86')]=function(_0x3c3072,_0x24b586,_0x3423e1){var _0x4638a4={};var _0x2b2004={};var _0x81de46;var _0x4413b7;return db[_0x3166('0x46')][_0x3166('0x73')]({'where':{'id':_0x3c3072[_0x3166('0x66')]['id']}})['then'](handleEntityNotFound(_0x24b586,null))[_0x3166('0x22')](function(_0x2ff25f){if(_0x2ff25f){_0x81de46=_0x2ff25f;_0x2b2004[_0x3166('0x4a')]=_['keys'](db['FaxApplication']['rawAttributes']);_0x2b2004['query']=_[_0x3166('0x4c')](_0x3c3072[_0x3166('0x4b')]);_0x2b2004['filters']=_[_0x3166('0x5b')](_0x2b2004[_0x3166('0x4a')],_0x2b2004[_0x3166('0x4b')]);_0x4638a4['attributes']=_['intersection'](_0x2b2004[_0x3166('0x4a')],qs[_0x3166('0x4e')](_0x3c3072['query']['fields']));_0x4638a4[_0x3166('0x4f')]=_0x4638a4[_0x3166('0x4f')]['length']?_0x4638a4[_0x3166('0x4f')]:_0x2b2004[_0x3166('0x4a')];_0x4638a4['order']=qs[_0x3166('0x53')](_0x3c3072[_0x3166('0x4b')]['sort']);_0x4638a4['where']=qs['filters'](_['pick'](_0x3c3072['query'],_0x2b2004[_0x3166('0x4d')]));if(_0x3c3072[_0x3166('0x4b')][_0x3166('0x55')]){_0x4638a4['where']=_[_0x3166('0x56')](_0x4638a4[_0x3166('0x57')],{'$or':_[_0x3166('0x45')](_0x4638a4[_0x3166('0x4f')],function(_0x177951){var _0x2785cc={};_0x2785cc[_0x177951]={'$like':'%'+_0x3c3072[_0x3166('0x4b')][_0x3166('0x55')]+'%'};return _0x2785cc;})});}_0x4638a4=_[_0x3166('0x56')]({},_0x4638a4,_0x3c3072[_0x3166('0x59')]);return _0x81de46[_0x3166('0x86')](_0x4638a4);}})['then'](function(_0x277705){if(_0x277705){_0x4413b7=_0x277705[_0x3166('0x5c')];if(!_0x3c3072[_0x3166('0x4b')][_0x3166('0x50')](_0x3166('0x51'))){_0x4638a4['limit']=qs[_0x3166('0x32')](_0x3c3072[_0x3166('0x4b')][_0x3166('0x32')]);_0x4638a4[_0x3166('0x30')]=qs[_0x3166('0x30')](_0x3c3072[_0x3166('0x4b')]['offset']);}return _0x81de46[_0x3166('0x86')](_0x4638a4);}})[_0x3166('0x22')](function(_0x226ec1){if(_0x226ec1){return _0x226ec1?{'count':_0x4413b7,'rows':_0x226ec1}:null;}})['then'](respondWithResult(_0x24b586,null))[_0x3166('0x2c')](handleError(_0x24b586,null));};function Extension(_0x2d2857,_0x19df83,_0x2885d4,_0x57e7a9){this[_0x3166('0x87')]=_0x3166('0x88');this[_0x3166('0x89')]=_0x2d2857[_0x3166('0x8a')];this['app']=_0x57e7a9;this[_0x3166('0x48')]='system';this[_0x3166('0x8b')]=_0x3166('0x8c');this['FaxAccountId']=_0x2d2857['id'];this[_0x3166('0x85')]=_0x19df83;this[_0x3166('0x8d')]=_0x2885d4;}function createExtensionsReciveFax(_0x4b9c3c){var _0x1e2107=0x1;var _0x545ac5=[];_0x545ac5['push'](new Extension(_0x4b9c3c,_0x1e2107,'',_0x3166('0x8e')));_0x1e2107+=0x1;_0x545ac5[_0x3166('0x8f')](new Extension(_0x4b9c3c,_0x1e2107,'CDR(type)=inbound-fax',_0x3166('0x90')));_0x1e2107+=0x1;for(var _0x201fc8 in _0x4b9c3c){if(_0x4b9c3c[_0x3166('0x50')](_0x201fc8)&&(_0x201fc8===_0x3166('0x91')||_0x201fc8===_0x3166('0x8a')||_0x201fc8===_0x3166('0x92')||_0x201fc8===_0x3166('0x93')||_0x201fc8===_0x3166('0x94')||_0x201fc8===_0x3166('0x95')||_0x201fc8===_0x3166('0x96')||_0x201fc8==='modem'||_0x201fc8===_0x3166('0x97'))){_0x545ac5[_0x3166('0x8f')](new Extension(_0x4b9c3c,_0x1e2107,_0x3166('0x98')+_0x201fc8+')='+_0x4b9c3c[_0x201fc8],_0x3166('0x90')));_0x1e2107+=0x1;}}_0x545ac5['push'](new Extension(_0x4b9c3c,_0x1e2107,'6',_0x3166('0x99')));_0x1e2107+=0x1;_0x545ac5['push'](new Extension(_0x4b9c3c,_0x1e2107,_0x3166('0x9a'),'ReceiveFax'));_0x1e2107=0x0;return _0x545ac5;}exports[_0x3166('0x9b')]=function(_0xbaac46,_0x286a1a,_0x4aca6f){var _0x3efda3;return db[_0x3166('0x9c')]['transaction'](function(_0x5a9958){return db[_0x3166('0x46')][_0x3166('0x5e')](_0xbaac46['body'],{'transaction':_0x5a9958})[_0x3166('0x22')](function(_0xa3a174){_0x3efda3=_0xa3a174['get']({'plain':!![]});return db[_0x3166('0x9d')][_0x3166('0x9e')](createExtensionsReciveFax(_0x3efda3),{'transaction':_0x5a9958});});})['then'](function(){return _0x3efda3;})[_0x3166('0x22')](respondWithResult(_0x286a1a,null))[_0x3166('0x2c')](handleError(_0x286a1a,null));};exports['updateAccountApplications']=function(_0x3f9cba,_0x49324b,_0x2b8f50){var _0x1628fd;return db['sequelize'][_0x3166('0x82')](function(_0x5b3530){return db[_0x3166('0x46')][_0x3166('0x39')](_0x3f9cba['body'],{'where':{'id':_0x3f9cba['body']['id']},'transaction':_0x5b3530})['then'](function(_0x186a7f){return db[_0x3166('0x9d')]['destroy']({'where':{'FaxAccountId':_0x3f9cba['body']['id']},'transaction':_0x5b3530})[_0x3166('0x22')](function(_0xadcc44){return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_[_0x3166('0x78')](_0x3f9cba[_0x3166('0x5f')],[_0x3166('0x9f'),'key',_0x3166('0xa0'),_0x3166('0xa1'),_0x3166('0xa2'),_0x3166('0xa3')])),{'transaction':_0x5b3530});});});})[_0x3166('0x22')](function(){return db[_0x3166('0x46')][_0x3166('0xa4')](_0x3f9cba['body']['id']);})[_0x3166('0x22')](respondWithResult(_0x49324b,null))[_0x3166('0x2c')](handleError(_0x49324b,null));};exports[_0x3166('0xa5')]=function(_0x5f0778,_0x5be6d1,_0x352526){var _0x2e3f03={'raw':!![],'where':{}};var _0x3a101c={};var _0x5aa2aa={'count':0x0,'rows':[]};return db[_0x3166('0x46')][_0x3166('0x73')]({'where':{'id':_0x5f0778[_0x3166('0x66')]['id']}})[_0x3166('0x22')](handleEntityNotFound(_0x5be6d1,null))[_0x3166('0x22')](function(_0x437108){if(_0x437108){_0x3a101c[_0x3166('0x4a')]=_['keys'](db[_0x3166('0xa6')][_0x3166('0x74')]);_0x3a101c[_0x3166('0x4b')]=_[_0x3166('0x4c')](_0x5f0778['query']);_0x3a101c[_0x3166('0x4d')]=_[_0x3166('0x5b')](_0x3a101c['model'],_0x3a101c[_0x3166('0x4b')]);_0x2e3f03[_0x3166('0x4f')]=_[_0x3166('0x5b')](_0x3a101c[_0x3166('0x4a')],qs[_0x3166('0x4e')](_0x5f0778[_0x3166('0x4b')]['fields']));_0x2e3f03[_0x3166('0x4f')]=_0x2e3f03[_0x3166('0x4f')]['length']?_0x2e3f03[_0x3166('0x4f')]:_0x3a101c['model'];if(!_0x5f0778['query'][_0x3166('0x50')](_0x3166('0x51'))){_0x2e3f03[_0x3166('0x32')]=qs['limit'](_0x5f0778[_0x3166('0x4b')][_0x3166('0x32')]);_0x2e3f03[_0x3166('0x30')]=qs[_0x3166('0x30')](_0x5f0778[_0x3166('0x4b')][_0x3166('0x30')]);}_0x2e3f03[_0x3166('0x52')]=qs['sort'](_0x5f0778['query'][_0x3166('0x53')]);_0x2e3f03['where']=qs[_0x3166('0x4d')](_[_0x3166('0x54')](_0x5f0778['query'],_0x3a101c[_0x3166('0x4d')]));_0x2e3f03['where']['FaxAccountId']=_0x437108['id'];if(_0x5f0778[_0x3166('0x4b')]['filter']){_0x2e3f03['where']=_[_0x3166('0x56')](_0x2e3f03['where'],{'$or':_[_0x3166('0x45')](_0x2e3f03['attributes'],function(_0xc733b9){var _0x39df28={};_0x39df28[_0xc733b9]={'$like':'%'+_0x5f0778['query'][_0x3166('0x55')]+'%'};return _0x39df28;})});}if(_0x5f0778['query'][_0x3166('0xa7')]){var _0x49ba92=_0x5f0778[_0x3166('0x4b')]['$gte'][_0x3166('0xa8')](',');var _0x14d552={};_0x14d552[_0x49ba92[0x0]]={'$gte':moment(_0x49ba92[0x1])[_0x3166('0xa9')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2e3f03[_0x3166('0x57')]=_[_0x3166('0x56')](_0x2e3f03[_0x3166('0x57')],_0x14d552);}_0x2e3f03=_['merge']({},_0x2e3f03,_0x5f0778[_0x3166('0x59')]);return db[_0x3166('0xa6')]['count']({'where':_0x2e3f03[_0x3166('0x57')]})['then'](function(_0x51d6db){_0x5aa2aa['count']=_0x51d6db;if(_0x5f0778[_0x3166('0x4b')][_0x3166('0x6c')]){_0x2e3f03[_0x3166('0x6d')]=[{'all':!![]}];}return db[_0x3166('0xa6')][_0x3166('0x6e')](_0x2e3f03);})[_0x3166('0x22')](function(_0x43f619){_0x5aa2aa['rows']=_0x43f619;return _0x5aa2aa;});}})['then'](respondWithFilteredResult(_0x5be6d1,_0x2e3f03))[_0x3166('0x2c')](handleError(_0x5be6d1,null));};exports[_0x3166('0x41')]=function(_0x4f1bf2,_0x63067d,_0x45f543){var _0x486d36,_0x1737df={},_0xcd981a;if(_0x4f1bf2[_0x3166('0x5f')]['to']){_0xcd981a=_0x4f1bf2['body']['to'][0x0];}return db[_0x3166('0x46')][_0x3166('0x5d')]({'where':{'id':_0x4f1bf2[_0x3166('0x66')]['id']},'include':[{'model':db['CmList'],'as':_0x3166('0xaa'),'include':[{'model':db[_0x3166('0x7a')],'as':_0x3166('0xab'),'where':{'fax':_0xcd981a},'limit':0x1,'order':[[_0x3166('0xa1'),_0x3166('0xac')]]}]}]})[_0x3166('0x22')](handleEntityNotFound(_0x63067d,null))[_0x3166('0x22')](function(_0x55006a){_0x486d36=_0x55006a;if(_0x4f1bf2[_0x3166('0x5f')][_0x3166('0xad')]&&_0x4f1bf2[_0x3166('0x5f')]['attachments']['length']){for(var _0x4b1e2f=0x0;_0x4b1e2f<_0x4f1bf2['body'][_0x3166('0xad')][_0x3166('0x5c')];_0x4b1e2f+=0x1){_0x4f1bf2[_0x3166('0x5f')]['attachments'][_0x4b1e2f]={'filename':_0x4f1bf2[_0x3166('0x5f')]['attachments'][_0x4b1e2f][_0x3166('0x40')],'id':_0x4f1bf2[_0x3166('0x5f')][_0x3166('0xad')][_0x4b1e2f]['id'],'path':path[_0x3166('0xae')](config[_0x3166('0xaf')],_0x3166('0xb0'),_0x4f1bf2[_0x3166('0x5f')][_0x3166('0xad')][_0x4b1e2f]['basename'])};}}return respondWithRpcPromise(_0x3166('0xb1'),_0x3166('0xb1'),{'FaxAccountId':_[_0x3166('0xb2')](_0x4f1bf2[_0x3166('0x66')]['id'])?undefined:_0x4f1bf2[_0x3166('0x66')]['id'],'path':_['isNil'](_0x4f1bf2['body']['attachments'][0x0]['path'])?undefined:_0x4f1bf2['body'][_0x3166('0xad')][0x0][_0x3166('0x8')],'fax':_[_0x3166('0xb2')](_0x4f1bf2[_0x3166('0x5f')]['to'][0x0])?undefined:_0x4f1bf2[_0x3166('0x5f')]['to'][0x0]},client9002);})[_0x3166('0x22')](function(){if(_0x486d36){if(_[_0x3166('0xb2')](_0x4f1bf2['body'][_0x3166('0xb3')])){_0x4f1bf2['body']['from']=util[_0x3166('0xa9')](_0x3166('0xb4'),_0x486d36['name'],_0x486d36['fax']);}if(_0x486d36[_0x3166('0xaa')]){if(_0x486d36['List'][_0x3166('0xab')][_0x3166('0x5c')]){return _0x486d36[_0x3166('0xaa')][_0x3166('0xab')][0x0];}else{return db['CmContact']['create'](_['defaults'](_0x4f1bf2[_0x3166('0x5f')],{'firstName':_0x4f1bf2[_0x3166('0x5f')]['to'][0x0],'phone':_0x4f1bf2[_0x3166('0x5f')]['to'][0x0],'fax':_0x4f1bf2['body']['to'][0x0],'ListId':_0x486d36[_0x3166('0xa3')]}));}}else{throw new Error(_0x3166('0xb5'));}}else{throw new Error(_0x3166('0xb6'));}})[_0x3166('0x22')](function(_0x45c42f){if(_0x45c42f){return db[_0x3166('0x77')][_0x3166('0x5d')]({'where':{'ContactId':_0x45c42f['id'],'closed':![],'FaxAccountId':_0x486d36['id']}})[_0x3166('0x22')](function(_0x3c1033){if(_0x3c1033){return[_0x3c1033,![]];}return db[_0x3166('0x77')][_0x3166('0x5e')]({'UserId':_0x4f1bf2[_0x3166('0x60')]['id'],'ContactId':_0x45c42f['id'],'FaxAccountId':_0x486d36['id'],'fax':_0x4f1bf2[_0x3166('0x5f')]['to'][0x0],'firstMsgDirection':_0x3166('0xb7'),'Messages':[_[_0x3166('0x56')](_0x4f1bf2['body'],{'read':![],'body':_0x4f1bf2[_0x3166('0x5f')][_0x3166('0xad')][0x0][_0x3166('0xb8')],'FaxAccountId':_0x486d36['id'],'UserId':_0x4f1bf2[_0x3166('0x60')]['id'],'ContactId':_0x45c42f['id'],'AttachmentId':_0x4f1bf2[_0x3166('0x5f')][_0x3166('0xad')][0x0]['id']})]},{'include':[{'model':db[_0x3166('0xa6')],'as':_0x3166('0xb9')}]})[_0x3166('0x22')](function(_0x23d53b){return[_0x23d53b,!![]];});});}else{throw new Error(_0x3166('0xba'));}})[_0x3166('0xbb')](function(_0x15d018,_0x2085a8){if(_0x2085a8){return _0x15d018;}return db[_0x3166('0xa6')][_0x3166('0x5e')]({'direction':_0x3166('0xb7'),'read':![],'body':_0x4f1bf2[_0x3166('0x5f')][_0x3166('0xad')][0x0][_0x3166('0xb8')],'FaxAccountId':_0x486d36['id'],'FaxInteractionId':_0x15d018['id'],'UserId':_0x4f1bf2[_0x3166('0x60')]['id'],'ContactId':_0x15d018[_0x3166('0xbc')],'AttachmentId':_0x4f1bf2[_0x3166('0x5f')][_0x3166('0xad')][0x0]['id']})[_0x3166('0x22')](function(_0x5ad6d6){_0x15d018[_0x3166('0xbd')]['Messages']=[];_0x15d018[_0x3166('0xbd')][_0x3166('0xb9')][_0x3166('0x8f')](_0x5ad6d6[_0x3166('0xbd')]);return _0x15d018;});})[_0x3166('0x22')](function(_0x263138){respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_['isNil'](_0x4f1bf2[_0x3166('0x66')]['id'])?undefined:_0x4f1bf2[_0x3166('0x66')]['id'],'path':_[_0x3166('0xb2')](_0x4f1bf2['body'][_0x3166('0xad')][0x0][_0x3166('0x8')])?undefined:_0x4f1bf2['body'][_0x3166('0xad')][0x0][_0x3166('0x8')],'fax':_['isNil'](_0x4f1bf2[_0x3166('0x5f')]['to'][0x0])?undefined:_0x4f1bf2['body']['to'][0x0],'AttachmentId':_0x4f1bf2['body'][_0x3166('0xad')][0x0]['id']},client9002)['then'](function(_0xe07cbb){logger['info'](_0x3166('0xbe'),_0xe07cbb);})[_0x3166('0x2c')](function(_0x40a7f7){logger[_0x3166('0x23')](_0x3166('0xbe'),_0x40a7f7);});return _0x263138;})[_0x3166('0x22')](respondWithResult(_0x63067d,null))['catch'](handleError(_0x63067d,null));};exports[_0x3166('0xbf')]=function(_0x29e735,_0xf8f8fc,_0x194ea1){return db['FaxAccount']['find']({'where':{'id':_0x29e735[_0x3166('0x66')]['id']}})[_0x3166('0x22')](handleEntityNotFound(_0xf8f8fc,null))[_0x3166('0x22')](function(_0x5e2ce2){if(_0x5e2ce2){return _0x5e2ce2[_0x3166('0xbf')](_0x29e735[_0x3166('0x5f')][_0x3166('0x70')],_[_0x3166('0x78')](_0x29e735['body'],['ids','id'])||{})['spread'](function(_0x49b075){for(var _0x32a749=0x0;_0x32a749<_0x29e735[_0x3166('0x5f')][_0x3166('0x70')]['length'];_0x32a749+=0x1){socket['emit'](_0x3166('0xc0'),{'UserId':Number(_0x29e735[_0x3166('0x5f')][_0x3166('0x70')][_0x32a749]),'FaxAccountId':Number(_0x29e735['params']['id'])});}return _0x49b075;});}})[_0x3166('0x22')](respondWithResult(_0xf8f8fc,null))[_0x3166('0x2c')](handleError(_0xf8f8fc,null));};exports[_0x3166('0xc1')]=function(_0x13dfa0,_0x2c9d7a,_0x102d05){return db[_0x3166('0x46')]['find']({'where':{'id':_0x13dfa0[_0x3166('0x66')]['id']}})[_0x3166('0x22')](handleEntityNotFound(_0x2c9d7a,null))[_0x3166('0x22')](function(_0x54100a){if(_0x54100a){return _0x54100a[_0x3166('0xc1')](_0x13dfa0[_0x3166('0x4b')][_0x3166('0x70')])[_0x3166('0x22')](function(){if(_[_0x3166('0xc2')](_0x13dfa0['query'][_0x3166('0x70')])){for(var _0x417355=0x0;_0x417355<_0x13dfa0['query'][_0x3166('0x70')][_0x3166('0x5c')];_0x417355+=0x1){socket['emit'](_0x3166('0xc3'),{'UserId':Number(_0x13dfa0['query']['ids'][_0x417355]),'FaxAccountId':Number(_0x13dfa0[_0x3166('0x66')]['id'])});}}else{socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x13dfa0[_0x3166('0x4b')]['ids']),'FaxAccountId':Number(_0x13dfa0[_0x3166('0x66')]['id'])});}});}})[_0x3166('0x22')](respondWithStatusCode(_0x2c9d7a,null))['catch'](handleError(_0x2c9d7a,null));};exports['getAgents']=function(_0xb38fec,_0x56a092,_0x16407c){var _0x21ed03={};var _0x306643={};var _0x41a11f;var _0x557226;return db['FaxAccount'][_0x3166('0x73')]({'where':{'id':_0xb38fec[_0x3166('0x66')]['id']}})[_0x3166('0x22')](handleEntityNotFound(_0x56a092,null))['then'](function(_0xdb53d8){if(_0xdb53d8){_0x41a11f=_0xdb53d8;_0x306643[_0x3166('0x4a')]=_[_0x3166('0x4c')](db['User'][_0x3166('0x74')]);_0x306643[_0x3166('0x4b')]=_['keys'](_0xb38fec[_0x3166('0x4b')]);_0x306643[_0x3166('0x4d')]=_['intersection'](_0x306643[_0x3166('0x4a')],_0x306643[_0x3166('0x4b')]);_0x21ed03['attributes']=_[_0x3166('0x5b')](_0x306643['model'],qs['fields'](_0xb38fec[_0x3166('0x4b')][_0x3166('0x4e')]));_0x21ed03['attributes']=_0x21ed03[_0x3166('0x4f')][_0x3166('0x5c')]?_0x21ed03[_0x3166('0x4f')]:_0x306643['model'];_0x21ed03[_0x3166('0x52')]=qs[_0x3166('0x53')](_0xb38fec[_0x3166('0x4b')][_0x3166('0x53')]);_0x21ed03[_0x3166('0x57')]=qs[_0x3166('0x4d')](_[_0x3166('0x54')](_0xb38fec[_0x3166('0x4b')],_0x306643[_0x3166('0x4d')]));if(_0xb38fec[_0x3166('0x4b')]['filter']){_0x21ed03[_0x3166('0x57')]=_[_0x3166('0x56')](_0x21ed03[_0x3166('0x57')],{'$or':_[_0x3166('0x45')](_0x21ed03[_0x3166('0x4f')],function(_0x3719f7){var _0x31120e={};_0x31120e[_0x3719f7]={'$like':'%'+_0xb38fec[_0x3166('0x4b')][_0x3166('0x55')]+'%'};return _0x31120e;})});}_0x21ed03=_['merge']({},_0x21ed03,_0xb38fec[_0x3166('0x59')]);return _0x41a11f['getAgents'](_0x21ed03);}})[_0x3166('0x22')](function(_0x3a6e86){if(_0x3a6e86){_0x557226=_0x3a6e86[_0x3166('0x5c')];if(!_0xb38fec[_0x3166('0x4b')]['hasOwnProperty'](_0x3166('0x51'))){_0x21ed03[_0x3166('0x32')]=qs[_0x3166('0x32')](_0xb38fec['query'][_0x3166('0x32')]);_0x21ed03[_0x3166('0x30')]=qs[_0x3166('0x30')](_0xb38fec['query'][_0x3166('0x30')]);}return _0x41a11f[_0x3166('0xc4')](_0x21ed03);}})[_0x3166('0x22')](function(_0x1ccc97){if(_0x1ccc97){return _0x1ccc97?{'count':_0x557226,'rows':_0x1ccc97}:null;}})[_0x3166('0x22')](respondWithResult(_0x56a092,null))[_0x3166('0x2c')](handleError(_0x56a092,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 58a5188..51a7454 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 _0x2b07=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x307ed8,_0x2486b1){var _0x14bafc=function(_0x2ff17b){while(--_0x2ff17b){_0x307ed8['push'](_0x307ed8['shift']());}};_0x14bafc(++_0x2486b1);}(_0x2b07,0x7c));var _0x72b0=function(_0x3522c8,_0x1e7c82){_0x3522c8=_0x3522c8-0x0;var _0x22f498=_0x2b07[_0x3522c8];return _0x22f498;};'use strict';var EventEmitter=require(_0x72b0('0x0'));var FaxAccount=require(_0x72b0('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x72b0('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x72b0('0x3'),'afterDestroy':_0x72b0('0x4')};function emitEvent(_0x1cbdbf){return function(_0x1bbbc2,_0x3f185f,_0x119fa7){FaxAccountEvents[_0x72b0('0x5')](_0x1cbdbf+':'+_0x1bbbc2['id'],_0x1bbbc2);FaxAccountEvents[_0x72b0('0x5')](_0x1cbdbf,_0x1bbbc2);_0x119fa7(null);};}for(var e in events){if(events[_0x72b0('0x6')](e)){var event=events[e];FaxAccount[_0x72b0('0x7')](e,emitEvent(event));}}module[_0x72b0('0x8')]=FaxAccountEvents; \ No newline at end of file +var _0xe21a=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxAccount','setMaxListeners','save','update','remove'];(function(_0x4ce637,_0x463346){var _0x2e9cba=function(_0x11f3d1){while(--_0x11f3d1){_0x4ce637['push'](_0x4ce637['shift']());}};_0x2e9cba(++_0x463346);}(_0xe21a,0xf6));var _0xae21=function(_0x4d3cfd,_0x1af63d){_0x4d3cfd=_0x4d3cfd-0x0;var _0x1693b5=_0xe21a[_0x4d3cfd];return _0x1693b5;};'use strict';var EventEmitter=require(_0xae21('0x0'));var FaxAccount=require(_0xae21('0x1'))['db'][_0xae21('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xae21('0x3')](0x0);var events={'afterCreate':_0xae21('0x4'),'afterUpdate':_0xae21('0x5'),'afterDestroy':_0xae21('0x6')};function emitEvent(_0x4af56e){return function(_0x5c3352,_0x37c444,_0x52c336){FaxAccountEvents['emit'](_0x4af56e+':'+_0x5c3352['id'],_0x5c3352);FaxAccountEvents[_0xae21('0x7')](_0x4af56e,_0x5c3352);_0x52c336(null);};}for(var e in events){if(events[_0xae21('0x8')](e)){var event=events[e];FaxAccount[_0xae21('0x9')](e,emitEvent(event));}}module[_0xae21('0xa')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 3d4e121..5fd63bf 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 _0xd75b=['moment','request-promise','rimraf','./faxAccount.attributes','FaxAccount','fax_accounts','lodash','util'];(function(_0x45390a,_0x5baac6){var _0x7a1401=function(_0x34be49){while(--_0x34be49){_0x45390a['push'](_0x45390a['shift']());}};_0x7a1401(++_0x5baac6);}(_0xd75b,0xf6));var _0xbd75=function(_0x4cc1fd,_0x1ef451){_0x4cc1fd=_0x4cc1fd-0x0;var _0x546e30=_0xd75b[_0x4cc1fd];return _0x546e30;};'use strict';var _=require(_0xbd75('0x0'));var util=require(_0xbd75('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbd75('0x2'));var BPromise=require('bluebird');var rp=require(_0xbd75('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbd75('0x4'));var config=require('../../config/environment');var attributes=require(_0xbd75('0x5'));module['exports']=function(_0x2889a5,_0x589165){return _0x2889a5['define'](_0xbd75('0x6'),attributes,{'tableName':_0xbd75('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xea0e=['FaxAccount','util','api','moment','bluebird','request-promise','path','../../config/environment','./faxAccount.attributes','exports','define'];(function(_0x1b38a2,_0x54833a){var _0x515341=function(_0x286e19){while(--_0x286e19){_0x1b38a2['push'](_0x1b38a2['shift']());}};_0x515341(++_0x54833a);}(_0xea0e,0x7a));var _0xeea0=function(_0x279951,_0x3a74ba){_0x279951=_0x279951-0x0;var _0x20dd62=_0xea0e[_0x279951];return _0x20dd62;};'use strict';var _=require('lodash');var util=require(_0xeea0('0x0'));var logger=require('../../config/logger')(_0xeea0('0x1'));var moment=require(_0xeea0('0x2'));var BPromise=require(_0xeea0('0x3'));var rp=require(_0xeea0('0x4'));var fs=require('fs');var path=require(_0xeea0('0x5'));var rimraf=require('rimraf');var config=require(_0xeea0('0x6'));var attributes=require(_0xeea0('0x7'));module[_0xeea0('0x8')]=function(_0x268a4f,_0x1a317b){return _0x268a4f[_0xeea0('0x9')](_0xeea0('0xa'),attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 574743a..563fcfb 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 _0xa77a=['from\x20is\x20mandatory','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','Contacts','DESC','FaxApplication','Applications','applications','orderBy','priority','asc','length','create','contact','FaxInteraction','Contact\x20not\x20found','spread','push','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','AttachmentId','UserId','User','name','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./faxAccount.socket','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetFaxAccount','FaxAccount','raw','options','include','map','model','attributes','catch','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','no\x20available\x20attributes','createdAt','updatedAt','difference','keys','CompanyId','ListId','from','ValidationError'];(function(_0x3a053f,_0x50b708){var _0x1b22d9=function(_0x517bce){while(--_0x517bce){_0x3a053f['push'](_0x3a053f['shift']());}};_0x1b22d9(++_0x50b708);}(_0xa77a,0x133));var _0xaa77=function(_0x141e03,_0x18340e){_0x141e03=_0x141e03-0x0;var _0x2074e3=_0xa77a[_0x141e03];return _0x2074e3;};'use strict';var _=require(_0xaa77('0x0'));var util=require(_0xaa77('0x1'));var moment=require(_0xaa77('0x2'));var BPromise=require(_0xaa77('0x3'));var rs=require(_0xaa77('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaa77('0x5'))['db'];var utils=require(_0xaa77('0x6'));var logger=require(_0xaa77('0x7'))(_0xaa77('0x8'));var config=require(_0xaa77('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa77('0xa')][_0xaa77('0xb')]({'port':0x232c});config['redis']=_[_0xaa77('0xc')](config[_0xaa77('0xd')],{'host':_0xaa77('0xe'),'port':0x18eb});var socket=require(_0xaa77('0xf'))(new Redis(config[_0xaa77('0xd')]));require(_0xaa77('0x10'))['register'](socket);function respondWithRpcPromise(_0xd4a619,_0x11af7c,_0x425b8e){return new BPromise(function(_0x4b6cc9,_0x398600){return client[_0xaa77('0x11')](_0xd4a619,_0x425b8e)[_0xaa77('0x12')](function(_0x38bfea){logger[_0xaa77('0x13')](_0xaa77('0x14'),_0x11af7c,_0xaa77('0x15'));logger[_0xaa77('0x16')](_0xaa77('0x17'),_0x11af7c,'request\x20sent',JSON[_0xaa77('0x18')](_0x38bfea));if(_0x38bfea[_0xaa77('0x19')]){if(_0x38bfea['error'][_0xaa77('0x1a')]===0x1f4){logger[_0xaa77('0x19')](_0xaa77('0x14'),_0x11af7c,_0x38bfea[_0xaa77('0x19')][_0xaa77('0x1b')]);return _0x398600(_0x38bfea[_0xaa77('0x19')]['message']);}logger[_0xaa77('0x19')]('FaxAccount,\x20%s,\x20%s',_0x11af7c,_0x38bfea[_0xaa77('0x19')][_0xaa77('0x1b')]);return _0x4b6cc9(_0x38bfea[_0xaa77('0x19')][_0xaa77('0x1b')]);}else{logger[_0xaa77('0x13')]('FaxAccount,\x20%s,\x20%s',_0x11af7c,'request\x20sent');_0x4b6cc9(_0x38bfea[_0xaa77('0x1c')][_0xaa77('0x1b')]);}})['catch'](function(_0x413ca9){logger[_0xaa77('0x19')](_0xaa77('0x14'),_0x11af7c,_0x413ca9);_0x398600(_0x413ca9);});});}exports[_0xaa77('0x1d')]=function(_0x28c8d3){var _0x56f13c=this;return new Promise(function(_0x533935,_0x12bfa8){return db[_0xaa77('0x1e')]['findAll']({'raw':_0x28c8d3['options']?_0x28c8d3['options'][_0xaa77('0x1f')]===undefined?!![]:![]:!![],'where':_0x28c8d3[_0xaa77('0x20')]?_0x28c8d3[_0xaa77('0x20')]['where']||null:null,'attributes':_0x28c8d3[_0xaa77('0x20')]?_0x28c8d3[_0xaa77('0x20')]['attributes']||null:null,'limit':_0x28c8d3['options']?_0x28c8d3[_0xaa77('0x20')]['limit']||null:null,'include':_0x28c8d3['options']?_0x28c8d3[_0xaa77('0x20')][_0xaa77('0x21')]?_[_0xaa77('0x22')](_0x28c8d3['options'][_0xaa77('0x21')],function(_0x3ffdb3){return{'model':db[_0x3ffdb3[_0xaa77('0x23')]],'as':_0x3ffdb3['as'],'attributes':_0x3ffdb3[_0xaa77('0x24')],'include':_0x3ffdb3[_0xaa77('0x21')]?_[_0xaa77('0x22')](_0x3ffdb3[_0xaa77('0x21')],function(_0x4b1e57){return{'model':db[_0x4b1e57['model']],'as':_0x4b1e57['as'],'attributes':_0x4b1e57['attributes'],'include':_0x4b1e57[_0xaa77('0x21')]?_['map'](_0x4b1e57[_0xaa77('0x21')],function(_0x56559d){return{'model':db[_0x56559d['model']],'as':_0x56559d['as'],'attributes':_0x56559d[_0xaa77('0x24')]};}):[]};}):[]};}):[]:[]})[_0xaa77('0x12')](function(_0x13a8d5){logger[_0xaa77('0x13')](_0xaa77('0x1d'),_0x28c8d3);logger['debug']('GetFaxAccount',_0x28c8d3,JSON[_0xaa77('0x18')](_0x13a8d5));_0x533935(_0x13a8d5);})[_0xaa77('0x25')](function(_0x29056c){logger[_0xaa77('0x19')](_0xaa77('0x1d'),_0x29056c[_0xaa77('0x1b')],_0x28c8d3);_0x12bfa8(_0x56f13c[_0xaa77('0x19')](0x1f4,_0x29056c[_0xaa77('0x1b')]));});});};exports[_0xaa77('0x26')]=function(_0x21e981,_0x194cbe,_0x1e0570){var _0x277685=this;return new Promise(function(_0x4833fe,_0x68dfb8){var _0x344d9d={'body':_0x21e981[_0xaa77('0x27')],'channel':_0xaa77('0x28')};var _0x4dfb9c=[];var _0x103844=[];var _0x2a0707={};return db[_0xaa77('0x29')][_0xaa77('0x2a')]()['then'](function(_0x59edef){if(!_0x59edef){throw new db[(_0xaa77('0x2b'))]['ValidationError'](_0xaa77('0x2c'));}_0x4dfb9c=_['difference'](_['keys'](_0x59edef),[_0xaa77('0x2d'),_0xaa77('0x2e')]);_0x103844=_[_0xaa77('0x2f')](_[_0xaa77('0x30')](_0x59edef),[_0xaa77('0x2d'),_0xaa77('0x2e'),_0xaa77('0x31'),_0xaa77('0x32')]);if(_0x21e981['body']['id']){delete _0x21e981[_0xaa77('0x27')]['id'];}if(_['isNil'](_0x21e981[_0xaa77('0x27')][_0xaa77('0x33')])){throw new db[(_0xaa77('0x2b'))][(_0xaa77('0x34'))](_0xaa77('0x35'));}if(_[_0xaa77('0x36')](_0x21e981[_0xaa77('0x27')][_0xaa77('0x27')])||_0x21e981['body'][_0xaa77('0x27')]===''){throw new db[(_0xaa77('0x2b'))][(_0xaa77('0x34'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xaa77('0x36')](_0x21e981[_0xaa77('0x27')][_0xaa77('0x37')])){throw new db[(_0xaa77('0x2b'))][(_0xaa77('0x34'))](_0xaa77('0x38')+_0x103844);}if(!_['includes'](_0x103844,_0x21e981['body'][_0xaa77('0x37')])){throw new db[(_0xaa77('0x2b'))]['ValidationError'](_0xaa77('0x39')+_0x103844);}_0x2a0707[_0x21e981[_0xaa77('0x27')][_0xaa77('0x37')]]=_0x21e981['body'][_0xaa77('0x33')];})[_0xaa77('0x12')](function(){return db[_0xaa77('0x1e')][_0xaa77('0x3a')]({'where':{'id':_0x21e981[_0xaa77('0x3b')]['id']},'include':[{'model':db[_0xaa77('0x3c')],'as':_0xaa77('0x3d'),'include':[{'model':db[_0xaa77('0x29')],'as':_0xaa77('0x3e'),'where':_0x2a0707,'limit':0x1,'order':[[_0xaa77('0x2e'),_0xaa77('0x3f')]]}]},{'model':db[_0xaa77('0x40')],'as':_0xaa77('0x41')}]});})[_0xaa77('0x12')](function(_0x29bd0f){if(_0x29bd0f&&_0x29bd0f['List']){var _0x3bda06=_0x29bd0f['get']({'plain':!![]});_0x344d9d[_0xaa77('0x3b')]=_0x3bda06;_0x344d9d[_0xaa77('0x42')]=_0x3bda06[_0xaa77('0x41')];_0x344d9d['list']=_0x3bda06[_0xaa77('0x3d')];_0x344d9d[_0xaa77('0x42')]=_[_0xaa77('0x43')](_0x344d9d[_0xaa77('0x42')],[_0xaa77('0x44')],[_0xaa77('0x45')]);if(_0x344d9d[_0xaa77('0x3b')][_0xaa77('0x41')]){delete _0x344d9d[_0xaa77('0x3b')][_0xaa77('0x41')];}if(_0x344d9d[_0xaa77('0x3b')][_0xaa77('0x3d')]&&_0x344d9d['account'][_0xaa77('0x3d')][_0xaa77('0x3e')][_0xaa77('0x46')]){return _0x344d9d[_0xaa77('0x3b')][_0xaa77('0x3d')][_0xaa77('0x3e')][0x0];}var _0x5e915a=_[_0xaa77('0xc')](_0x21e981[_0xaa77('0x27')],{'firstName':_0x21e981[_0xaa77('0x27')][_0xaa77('0x33')],'ListId':_0x3bda06[_0xaa77('0x32')]});_0x5e915a[_0x21e981['body'][_0xaa77('0x37')]]=_0x21e981['body'][_0xaa77('0x33')];return db[_0xaa77('0x29')][_0xaa77('0x47')](_0x5e915a,{'fields':_0x4dfb9c,'raw':!![]});}})[_0xaa77('0x12')](function(_0x2a36d3){_0x344d9d[_0xaa77('0x48')]=_0x2a36d3;if(_0x2a36d3){var _0x42b0f4={'ContactId':_0x2a36d3['id'],'FaxAccountId':_0x21e981[_0xaa77('0x3b')]['id'],'fax':_0x2a36d3[_0xaa77('0x28')]};return db[_0xaa77('0x49')][_0xaa77('0x3a')]({'where':{'ContactId':_0x2a36d3['id'],'closed':![],'FaxAccountId':_0x21e981[_0xaa77('0x3b')]['id']}})[_0xaa77('0x12')](function(_0x320898){if(_0x320898){return[_0x320898,![]];}return db[_0xaa77('0x49')][_0xaa77('0x47')](_0x42b0f4)[_0xaa77('0x12')](function(_0xa99186){return[_0xa99186,!![]];});});}else{throw new Error(_0xaa77('0x4a'));}})[_0xaa77('0x4b')](function(_0x41b0f1,_0x396d16){var _0x22e752=_0x41b0f1['get']({'plain':!![]});if(_0x396d16){if(_0x344d9d['account']['autoclose']){_0x344d9d['applications'][_0xaa77('0x4c')]({'id':0x0,'priority':_0x344d9d[_0xaa77('0x42')][_0xaa77('0x46')]+0x1,'app':_0xaa77('0x4d'),'appdata':_0xaa77('0x4e'),'interval':_0xaa77('0x4f')});}_0x22e752[_0xaa77('0x50')]=!![];}else{_0x22e752[_0xaa77('0x50')]=![];}_0x344d9d[_0xaa77('0x51')]=_0x22e752;return db[_0xaa77('0x52')]['create']({'body':_0x21e981['body'][_0xaa77('0x27')],'FaxAccountId':_0x21e981[_0xaa77('0x3b')]['id'],'FaxInteractionId':_0x41b0f1['id'],'direction':'in','ContactId':_0x41b0f1['ContactId'],'AttachmentId':_0x21e981[_0xaa77('0x27')][_0xaa77('0x53')]});})[_0xaa77('0x12')](function(_0x37f154){_0x344d9d[_0xaa77('0x1b')]=_0x37f154;if(_0x344d9d['interaction'][_0xaa77('0x54')]){return db[_0xaa77('0x55')][_0xaa77('0x3a')]({'attributes':['id',_0xaa77('0x56')],'where':{'id':_0x344d9d[_0xaa77('0x51')][_0xaa77('0x54')]}})[_0xaa77('0x12')](function(_0x8e43c8){if(_0x8e43c8){_0x344d9d[_0xaa77('0x42')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x8e43c8[_0xaa77('0x56')]+','+(_0x344d9d['account'][_0xaa77('0x57')]||0xa),'interval':_0xaa77('0x4f')});}return respondWithRpcPromise(_0xaa77('0x58'),_0xaa77('0x59'),_0x344d9d);});}return respondWithRpcPromise(_0xaa77('0x58'),'startRouting',_0x344d9d);})[_0xaa77('0x12')](function(_0x543e94){_0x4833fe(_0x543e94);})[_0xaa77('0x25')](function(_0x26f52e){_0x68dfb8(_0x277685[_0xaa77('0x19')](0x1f4,_0x26f52e[_0xaa77('0x1b')]));});});}; \ No newline at end of file +var _0x8ee9=['name','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','lodash','moment','randomstring','ioredis','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','./faxAccount.socket','register','request','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','limit','include','model','map','then','catch','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','updatedAt','createdAt','ListId','body','isNil','from','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','account','List','Contacts','DESC','Applications','applications','list','orderBy','priority','asc','length','create','FaxInteraction','find','Contact\x20not\x20found','spread','get','autoclose','push','close','unmanaged','created','interaction','ContactId','AttachmentId','UserId','User'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8ee9,0x1c3));var _0x98ee=function(_0x342853,_0x3d21da){_0x342853=_0x342853-0x0;var _0x402087=_0x8ee9[_0x342853];return _0x402087;};'use strict';var _=require(_0x98ee('0x0'));var util=require('util');var moment=require(_0x98ee('0x1'));var BPromise=require('bluebird');var rs=require(_0x98ee('0x2'));var fs=require('fs');var Redis=require(_0x98ee('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x98ee('0x4'))(_0x98ee('0x5'));var config=require('../../config/environment');var jayson=require(_0x98ee('0x6'));var client=jayson['client'][_0x98ee('0x7')]({'port':0x232c});config[_0x98ee('0x8')]=_[_0x98ee('0x9')](config[_0x98ee('0x8')],{'host':_0x98ee('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x98ee('0x8')]));require(_0x98ee('0xb'))[_0x98ee('0xc')](socket);function respondWithRpcPromise(_0x42d5ca,_0x491e36,_0x458e3e){return new BPromise(function(_0x111cf6,_0x316bed){return client[_0x98ee('0xd')](_0x42d5ca,_0x458e3e)['then'](function(_0x2d4a88){logger[_0x98ee('0xe')]('FaxAccount,\x20%s,\x20%s',_0x491e36,_0x98ee('0xf'));logger[_0x98ee('0x10')](_0x98ee('0x11'),_0x491e36,'request\x20sent',JSON[_0x98ee('0x12')](_0x2d4a88));if(_0x2d4a88[_0x98ee('0x13')]){if(_0x2d4a88[_0x98ee('0x13')][_0x98ee('0x14')]===0x1f4){logger['error'](_0x98ee('0x15'),_0x491e36,_0x2d4a88[_0x98ee('0x13')][_0x98ee('0x16')]);return _0x316bed(_0x2d4a88[_0x98ee('0x13')][_0x98ee('0x16')]);}logger['error'](_0x98ee('0x15'),_0x491e36,_0x2d4a88[_0x98ee('0x13')][_0x98ee('0x16')]);return _0x111cf6(_0x2d4a88[_0x98ee('0x13')][_0x98ee('0x16')]);}else{logger['info'](_0x98ee('0x15'),_0x491e36,_0x98ee('0xf'));_0x111cf6(_0x2d4a88[_0x98ee('0x17')][_0x98ee('0x16')]);}})['catch'](function(_0x57260f){logger[_0x98ee('0x13')](_0x98ee('0x15'),_0x491e36,_0x57260f);_0x316bed(_0x57260f);});});}exports[_0x98ee('0x18')]=function(_0x13842a){var _0x342edb=this;return new Promise(function(_0x571b6f,_0x21b5d5){return db[_0x98ee('0x19')][_0x98ee('0x1a')]({'raw':_0x13842a[_0x98ee('0x1b')]?_0x13842a[_0x98ee('0x1b')][_0x98ee('0x1c')]===undefined?!![]:![]:!![],'where':_0x13842a[_0x98ee('0x1b')]?_0x13842a[_0x98ee('0x1b')][_0x98ee('0x1d')]||null:null,'attributes':_0x13842a['options']?_0x13842a[_0x98ee('0x1b')][_0x98ee('0x1e')]||null:null,'limit':_0x13842a[_0x98ee('0x1b')]?_0x13842a[_0x98ee('0x1b')][_0x98ee('0x1f')]||null:null,'include':_0x13842a[_0x98ee('0x1b')]?_0x13842a[_0x98ee('0x1b')][_0x98ee('0x20')]?_['map'](_0x13842a['options'][_0x98ee('0x20')],function(_0x56e096){return{'model':db[_0x56e096[_0x98ee('0x21')]],'as':_0x56e096['as'],'attributes':_0x56e096[_0x98ee('0x1e')],'include':_0x56e096[_0x98ee('0x20')]?_['map'](_0x56e096[_0x98ee('0x20')],function(_0xa6fecb){return{'model':db[_0xa6fecb[_0x98ee('0x21')]],'as':_0xa6fecb['as'],'attributes':_0xa6fecb[_0x98ee('0x1e')],'include':_0xa6fecb[_0x98ee('0x20')]?_[_0x98ee('0x22')](_0xa6fecb[_0x98ee('0x20')],function(_0x47b185){return{'model':db[_0x47b185['model']],'as':_0x47b185['as'],'attributes':_0x47b185[_0x98ee('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x98ee('0x23')](function(_0x4cdd0c){logger[_0x98ee('0xe')]('GetFaxAccount',_0x13842a);logger[_0x98ee('0x10')](_0x98ee('0x18'),_0x13842a,JSON[_0x98ee('0x12')](_0x4cdd0c));_0x571b6f(_0x4cdd0c);})[_0x98ee('0x24')](function(_0x29c6cf){logger[_0x98ee('0x13')](_0x98ee('0x18'),_0x29c6cf['message'],_0x13842a);_0x21b5d5(_0x342edb[_0x98ee('0x13')](0x1f4,_0x29c6cf[_0x98ee('0x16')]));});});};exports['NotifyFaxAccount']=function(_0x312fcf,_0xc4f0fe,_0x4b886c){var _0x32a2d3=this;return new Promise(function(_0x27f654,_0x3a48bf){var _0x249801={'body':_0x312fcf['body'],'channel':_0x98ee('0x25')};var _0x5071cc=[];var _0x3c9781=[];var _0x4f5d9a={};return db[_0x98ee('0x26')][_0x98ee('0x27')]()['then'](function(_0xd3f023){if(!_0xd3f023){throw new db[(_0x98ee('0x28'))][(_0x98ee('0x29'))](_0x98ee('0x2a'));}_0x5071cc=_[_0x98ee('0x2b')](_[_0x98ee('0x2c')](_0xd3f023),['createdAt',_0x98ee('0x2d')]);_0x3c9781=_[_0x98ee('0x2b')](_['keys'](_0xd3f023),[_0x98ee('0x2e'),_0x98ee('0x2d'),'CompanyId',_0x98ee('0x2f')]);if(_0x312fcf[_0x98ee('0x30')]['id']){delete _0x312fcf[_0x98ee('0x30')]['id'];}if(_[_0x98ee('0x31')](_0x312fcf[_0x98ee('0x30')][_0x98ee('0x32')])){throw new db[(_0x98ee('0x28'))][(_0x98ee('0x29'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x312fcf[_0x98ee('0x30')][_0x98ee('0x30')])||_0x312fcf[_0x98ee('0x30')][_0x98ee('0x30')]===''){throw new db[(_0x98ee('0x28'))]['ValidationError'](_0x98ee('0x33'));}if(_[_0x98ee('0x31')](_0x312fcf[_0x98ee('0x30')][_0x98ee('0x34')])){throw new db[(_0x98ee('0x28'))][(_0x98ee('0x29'))](_0x98ee('0x35')+_0x3c9781);}if(!_[_0x98ee('0x36')](_0x3c9781,_0x312fcf['body'][_0x98ee('0x34')])){throw new db[(_0x98ee('0x28'))]['ValidationError'](_0x98ee('0x37')+_0x3c9781);}_0x4f5d9a[_0x312fcf[_0x98ee('0x30')][_0x98ee('0x34')]]=_0x312fcf['body']['from'];})['then'](function(){return db[_0x98ee('0x19')]['find']({'where':{'id':_0x312fcf[_0x98ee('0x38')]['id']},'include':[{'model':db['CmList'],'as':_0x98ee('0x39'),'include':[{'model':db[_0x98ee('0x26')],'as':_0x98ee('0x3a'),'where':_0x4f5d9a,'limit':0x1,'order':[[_0x98ee('0x2d'),_0x98ee('0x3b')]]}]},{'model':db['FaxApplication'],'as':_0x98ee('0x3c')}]});})[_0x98ee('0x23')](function(_0x4fcaaa){if(_0x4fcaaa&&_0x4fcaaa[_0x98ee('0x39')]){var _0x3a30e2=_0x4fcaaa['get']({'plain':!![]});_0x249801[_0x98ee('0x38')]=_0x3a30e2;_0x249801[_0x98ee('0x3d')]=_0x3a30e2[_0x98ee('0x3c')];_0x249801[_0x98ee('0x3e')]=_0x3a30e2[_0x98ee('0x39')];_0x249801[_0x98ee('0x3d')]=_[_0x98ee('0x3f')](_0x249801[_0x98ee('0x3d')],[_0x98ee('0x40')],[_0x98ee('0x41')]);if(_0x249801[_0x98ee('0x38')][_0x98ee('0x3c')]){delete _0x249801[_0x98ee('0x38')][_0x98ee('0x3c')];}if(_0x249801[_0x98ee('0x38')][_0x98ee('0x39')]&&_0x249801[_0x98ee('0x38')][_0x98ee('0x39')][_0x98ee('0x3a')][_0x98ee('0x42')]){return _0x249801[_0x98ee('0x38')][_0x98ee('0x39')][_0x98ee('0x3a')][0x0];}var _0x198ce1=_[_0x98ee('0x9')](_0x312fcf[_0x98ee('0x30')],{'firstName':_0x312fcf[_0x98ee('0x30')][_0x98ee('0x32')],'ListId':_0x3a30e2[_0x98ee('0x2f')]});_0x198ce1[_0x312fcf[_0x98ee('0x30')][_0x98ee('0x34')]]=_0x312fcf[_0x98ee('0x30')][_0x98ee('0x32')];return db[_0x98ee('0x26')][_0x98ee('0x43')](_0x198ce1,{'fields':_0x5071cc,'raw':!![]});}})[_0x98ee('0x23')](function(_0x586e3b){_0x249801['contact']=_0x586e3b;if(_0x586e3b){var _0x3eaaa5={'ContactId':_0x586e3b['id'],'FaxAccountId':_0x312fcf[_0x98ee('0x38')]['id'],'fax':_0x586e3b['fax']};return db[_0x98ee('0x44')][_0x98ee('0x45')]({'where':{'ContactId':_0x586e3b['id'],'closed':![],'FaxAccountId':_0x312fcf[_0x98ee('0x38')]['id']}})[_0x98ee('0x23')](function(_0x3b5de3){if(_0x3b5de3){return[_0x3b5de3,![]];}return db['FaxInteraction'][_0x98ee('0x43')](_0x3eaaa5)[_0x98ee('0x23')](function(_0x1da7ab){return[_0x1da7ab,!![]];});});}else{throw new Error(_0x98ee('0x46'));}})[_0x98ee('0x47')](function(_0xa08a52,_0x547602){var _0x541b30=_0xa08a52[_0x98ee('0x48')]({'plain':!![]});if(_0x547602){if(_0x249801[_0x98ee('0x38')][_0x98ee('0x49')]){_0x249801[_0x98ee('0x3d')][_0x98ee('0x4a')]({'id':0x0,'priority':_0x249801[_0x98ee('0x3d')]['length']+0x1,'app':_0x98ee('0x4b'),'appdata':_0x98ee('0x4c'),'interval':'*,*,*,*'});}_0x541b30['created']=!![];}else{_0x541b30[_0x98ee('0x4d')]=![];}_0x249801[_0x98ee('0x4e')]=_0x541b30;return db['FaxMessage'][_0x98ee('0x43')]({'body':_0x312fcf['body'][_0x98ee('0x30')],'FaxAccountId':_0x312fcf[_0x98ee('0x38')]['id'],'FaxInteractionId':_0xa08a52['id'],'direction':'in','ContactId':_0xa08a52[_0x98ee('0x4f')],'AttachmentId':_0x312fcf[_0x98ee('0x30')][_0x98ee('0x50')]});})[_0x98ee('0x23')](function(_0x203660){_0x249801[_0x98ee('0x16')]=_0x203660;if(_0x249801['interaction'][_0x98ee('0x51')]){return db[_0x98ee('0x52')][_0x98ee('0x45')]({'attributes':['id',_0x98ee('0x53')],'where':{'id':_0x249801['interaction'][_0x98ee('0x51')]}})[_0x98ee('0x23')](function(_0xba0bf){if(_0xba0bf){_0x249801['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x98ee('0x54'),'appdata':_0xba0bf['name']+','+(_0x249801[_0x98ee('0x38')][_0x98ee('0x55')]||0xa),'interval':_0x98ee('0x56')});}return respondWithRpcPromise(_0x98ee('0x57'),_0x98ee('0x58'),_0x249801);});}return respondWithRpcPromise('Start',_0x98ee('0x58'),_0x249801);})[_0x98ee('0x23')](function(_0x3b3430){_0x27f654(_0x3b3430);})['catch'](function(_0x1f6366){_0x3a48bf(_0x32a2d3[_0x98ee('0x13')](0x1f4,_0x1f6366['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 35ed5d5..f368001 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 _0x783d=['update','emit','length','faxAccount:','./faxAccount.events','save','remove'];(function(_0x33de79,_0x51888f){var _0x1932fa=function(_0x3824c3){while(--_0x3824c3){_0x33de79['push'](_0x33de79['shift']());}};_0x1932fa(++_0x51888f);}(_0x783d,0x7b));var _0xd783=function(_0xe29aa9,_0x410bd2){_0xe29aa9=_0xe29aa9-0x0;var _0x1ab4dc=_0x783d[_0xe29aa9];return _0x1ab4dc;};'use strict';var FaxAccountEvents=require(_0xd783('0x0'));var events=[_0xd783('0x1'),_0xd783('0x2'),_0xd783('0x3')];function createListener(_0x90debd,_0x5e2f){return function(_0x5c8280){_0x5e2f[_0xd783('0x4')](_0x90debd,_0x5c8280);};}function removeListener(_0x103ece,_0x5597a3){return function(){FaxAccountEvents['removeListener'](_0x103ece,_0x5597a3);};}exports['register']=function(_0x5047bd){for(var _0x2abcc5=0x0,_0x7d56b8=events[_0xd783('0x5')];_0x2abcc5<_0x7d56b8;_0x2abcc5++){var _0x316f40=events[_0x2abcc5];var _0xbf3b47=createListener(_0xd783('0x6')+_0x316f40,_0x5047bd);FaxAccountEvents['on'](_0x316f40,_0xbf3b47);}}; \ No newline at end of file +var _0xf63d=['update','register','length','faxAccount:','./faxAccount.events','remove'];(function(_0x2013cf,_0x46b2b0){var _0x21f90e=function(_0x7e9c54){while(--_0x7e9c54){_0x2013cf['push'](_0x2013cf['shift']());}};_0x21f90e(++_0x46b2b0);}(_0xf63d,0x1b4));var _0xdf63=function(_0x7c2035,_0x13334){_0x7c2035=_0x7c2035-0x0;var _0x50f5c1=_0xf63d[_0x7c2035];return _0x50f5c1;};'use strict';var FaxAccountEvents=require(_0xdf63('0x0'));var events=['save',_0xdf63('0x1'),_0xdf63('0x2')];function createListener(_0x22b5fa,_0x1b531a){return function(_0x6973fe){_0x1b531a['emit'](_0x22b5fa,_0x6973fe);};}function removeListener(_0x161619,_0x2c06c1){return function(){FaxAccountEvents['removeListener'](_0x161619,_0x2c06c1);};}exports[_0xdf63('0x3')]=function(_0x43190d){for(var _0x333209=0x0,_0x269dbe=events[_0xdf63('0x4')];_0x333209<_0x269dbe;_0x333209++){var _0x502b45=events[_0x333209];var _0x3b1fd7=createListener(_0xdf63('0x5')+_0x502b45,_0x43190d);FaxAccountEvents['on'](_0x502b45,_0x3b1fd7);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index f78383d..e9e79a7 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(_0x29fbb7,_0x9a8ad){var _0x3153fe=function(_0x4fab0c){while(--_0x4fab0c){_0x29fbb7['push'](_0x29fbb7['shift']());}};_0x3153fe(++_0x9a8ad);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'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(_0x3efd16,_0x93f6e3){var _0x22c92b=function(_0x82589d){while(--_0x82589d){_0x3efd16['push'](_0x3efd16['shift']());}};_0x22c92b(++_0x93f6e3);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 30ab9ef..10de096 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 _0x67b7=['STRING','noop','TEXT','sequelize','exports','INTEGER'];(function(_0x5e4bb7,_0x28d5d7){var _0x26730e=function(_0x92a498){while(--_0x92a498){_0x5e4bb7['push'](_0x5e4bb7['shift']());}};_0x26730e(++_0x28d5d7);}(_0x67b7,0x93));var _0x767b=function(_0xd63b18,_0x49e978){_0xd63b18=_0xd63b18-0x0;var _0x2c64f5=_0x67b7[_0xd63b18];return _0x2c64f5;};'use strict';var Sequelize=require(_0x767b('0x0'));module[_0x767b('0x1')]={'priority':{'type':Sequelize[_0x767b('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x767b('0x3')],'allowNull':![],'defaultValue':_0x767b('0x4')},'appdata':{'type':Sequelize[_0x767b('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x767b('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x17cc=['exports','noop','STRING','*,*,*,*','sequelize'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0x17cc,0xbd));var _0xc17c=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0x17cc[_0x35da42];return _0x370035;};'use strict';var Sequelize=require(_0xc17c('0x0'));module[_0xc17c('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xc17c('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xc17c('0x3')]},'interval':{'type':Sequelize[_0xc17c('0x3')],'defaultValue':_0xc17c('0x4')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 977f8af..8a52620 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 _0x50b5=['update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','attributes','intersection','fields','length','order','sort','where','filters','pick','merge','filter','options','FaxApplication','includeAll','include','findAll','rows','catch','show','params','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../mysqldb','sendStatus','status','end','offset','limit','count','set','apply','reject','save'];(function(_0x12a554,_0x3d7ef8){var _0x244ba0=function(_0x5eb5ff){while(--_0x5eb5ff){_0x12a554['push'](_0x12a554['shift']());}};_0x244ba0(++_0x3d7ef8);}(_0x50b5,0x142));var _0x550b=function(_0x4ae625,_0xf396d0){_0x4ae625=_0x4ae625-0x0;var _0x31accf=_0x50b5[_0x4ae625];return _0x31accf;};'use strict';var emlformat=require(_0x550b('0x0'));var rimraf=require(_0x550b('0x1'));var zipdir=require(_0x550b('0x2'));var jsonpatch=require(_0x550b('0x3'));var rp=require(_0x550b('0x4'));var moment=require(_0x550b('0x5'));var BPromise=require(_0x550b('0x6'));var Mustache=require(_0x550b('0x7'));var util=require(_0x550b('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x550b('0x9'));var ejs=require(_0x550b('0xa'));var fs=require('fs');var fs_extra=require(_0x550b('0xb'));var _=require(_0x550b('0xc'));var squel=require(_0x550b('0xd'));var crypto=require('crypto');var jsforce=require(_0x550b('0xe'));var deskjs=require(_0x550b('0xf'));var toCsv=require(_0x550b('0x9'));var querystring=require(_0x550b('0x10'));var Papa=require('papaparse');var Redis=require(_0x550b('0x11'));var authService=require(_0x550b('0x12'));var qs=require(_0x550b('0x13'));var as=require(_0x550b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x550b('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x550b('0x16'))['db'];function respondWithStatusCode(_0x31030c,_0x22e632){_0x22e632=_0x22e632||0xcc;return function(_0xfdfdba){if(_0xfdfdba){return _0x31030c[_0x550b('0x17')](_0x22e632);}return _0x31030c[_0x550b('0x18')](_0x22e632)[_0x550b('0x19')]();};}function respondWithResult(_0x797ca0,_0x5522b6){_0x5522b6=_0x5522b6||0xc8;return function(_0x2d6518){if(_0x2d6518){return _0x797ca0[_0x550b('0x18')](_0x5522b6)['json'](_0x2d6518);}};}function respondWithFilteredResult(_0x1e8996,_0x3fadb5){return function(_0x32d461){if(_0x32d461){var _0x468400=typeof _0x3fadb5[_0x550b('0x1a')]==='undefined'&&typeof _0x3fadb5[_0x550b('0x1b')]==='undefined';var _0x136ffb=_0x32d461[_0x550b('0x1c')];var _0x40abd5=_0x468400?0x0:_0x3fadb5[_0x550b('0x1a')];var _0xd4f55b=_0x468400?_0x32d461[_0x550b('0x1c')]:_0x3fadb5[_0x550b('0x1a')]+_0x3fadb5[_0x550b('0x1b')];var _0xbc344;if(_0xd4f55b>=_0x136ffb){_0xd4f55b=_0x136ffb;_0xbc344=0xc8;}else{_0xbc344=0xce;}_0x1e8996['status'](_0xbc344);return _0x1e8996[_0x550b('0x1d')]('Content-Range',_0x40abd5+'-'+_0xd4f55b+'/'+_0x136ffb)['json'](_0x32d461);}return null;};}function patchUpdates(_0x4350b5){return function(_0x30987a){try{jsonpatch[_0x550b('0x1e')](_0x30987a,_0x4350b5,!![]);}catch(_0x2716d6){return BPromise[_0x550b('0x1f')](_0x2716d6);}return _0x30987a[_0x550b('0x20')]();};}function saveUpdates(_0x219a46,_0x2cde1a){return function(_0x1992a2){if(_0x1992a2){return _0x1992a2[_0x550b('0x21')](_0x219a46)[_0x550b('0x22')](function(_0x33f94e){return _0x33f94e;});}return null;};}function removeEntity(_0x5146c3,_0x4df758){return function(_0x46a799){if(_0x46a799){return _0x46a799['destroy']()[_0x550b('0x22')](function(){_0x5146c3[_0x550b('0x18')](0xcc)[_0x550b('0x19')]();});}};}function handleEntityNotFound(_0x111e0c,_0x5a076f){return function(_0x4331dc){if(!_0x4331dc){_0x111e0c['sendStatus'](0x194);}return _0x4331dc;};}function handleError(_0x28dcb4,_0x47bb35){_0x47bb35=_0x47bb35||0x1f4;return function(_0x39dd63){logger[_0x550b('0x23')](_0x39dd63[_0x550b('0x24')]);if(_0x39dd63[_0x550b('0x25')]){delete _0x39dd63[_0x550b('0x25')];}_0x28dcb4[_0x550b('0x18')](_0x47bb35)[_0x550b('0x26')](_0x39dd63);};}exports[_0x550b('0x27')]=function(_0x35dd57,_0x2048d4){var _0x5580b2={},_0x347897={},_0x4aba12={'count':0x0,'rows':[]};var _0x22935e=_[_0x550b('0x28')](db['FaxApplication'][_0x550b('0x29')],function(_0x43d4c6){return{'name':_0x43d4c6[_0x550b('0x2a')],'type':_0x43d4c6[_0x550b('0x2b')][_0x550b('0x2c')]};});_0x347897[_0x550b('0x2d')]=_[_0x550b('0x28')](_0x22935e,_0x550b('0x25'));_0x347897['query']=_[_0x550b('0x2e')](_0x35dd57[_0x550b('0x2f')]);_0x347897['filters']=_['intersection'](_0x347897[_0x550b('0x2d')],_0x347897[_0x550b('0x2f')]);_0x5580b2[_0x550b('0x30')]=_[_0x550b('0x31')](_0x347897[_0x550b('0x2d')],qs[_0x550b('0x32')](_0x35dd57['query']['fields']));_0x5580b2[_0x550b('0x30')]=_0x5580b2[_0x550b('0x30')][_0x550b('0x33')]?_0x5580b2[_0x550b('0x30')]:_0x347897[_0x550b('0x2d')];if(!_0x35dd57[_0x550b('0x2f')]['hasOwnProperty']('nolimit')){_0x5580b2[_0x550b('0x1b')]=qs['limit'](_0x35dd57[_0x550b('0x2f')][_0x550b('0x1b')]);_0x5580b2[_0x550b('0x1a')]=qs[_0x550b('0x1a')](_0x35dd57[_0x550b('0x2f')][_0x550b('0x1a')]);}_0x5580b2[_0x550b('0x34')]=qs['sort'](_0x35dd57[_0x550b('0x2f')][_0x550b('0x35')]);_0x5580b2[_0x550b('0x36')]=qs[_0x550b('0x37')](_[_0x550b('0x38')](_0x35dd57[_0x550b('0x2f')],_0x347897[_0x550b('0x37')]),_0x22935e);if(_0x35dd57[_0x550b('0x2f')]['filter']){_0x5580b2[_0x550b('0x36')]=_[_0x550b('0x39')](_0x5580b2[_0x550b('0x36')],{'$or':_['map'](_0x22935e,function(_0x15da4e){if(_0x15da4e[_0x550b('0x2b')]!=='VIRTUAL'){var _0x54d718={};_0x54d718[_0x15da4e[_0x550b('0x25')]]={'$like':'%'+_0x35dd57[_0x550b('0x2f')][_0x550b('0x3a')]+'%'};return _0x54d718;}})});}_0x5580b2=_[_0x550b('0x39')]({},_0x5580b2,_0x35dd57[_0x550b('0x3b')]);var _0x5d496e={'where':_0x5580b2['where']};return db[_0x550b('0x3c')][_0x550b('0x1c')](_0x5d496e)[_0x550b('0x22')](function(_0x441be4){_0x4aba12[_0x550b('0x1c')]=_0x441be4;if(_0x35dd57[_0x550b('0x2f')][_0x550b('0x3d')]){_0x5580b2[_0x550b('0x3e')]=[{'all':!![]}];}return db['FaxApplication'][_0x550b('0x3f')](_0x5580b2);})[_0x550b('0x22')](function(_0x2b0217){_0x4aba12[_0x550b('0x40')]=_0x2b0217;return _0x4aba12;})[_0x550b('0x22')](respondWithFilteredResult(_0x2048d4,_0x5580b2))[_0x550b('0x41')](handleError(_0x2048d4,null));};exports[_0x550b('0x42')]=function(_0x26d166,_0x55f5dc){var _0x15940b={'raw':!![],'where':{'id':_0x26d166[_0x550b('0x43')]['id']}},_0x1b0bc2={};_0x1b0bc2[_0x550b('0x2d')]=_[_0x550b('0x2e')](db[_0x550b('0x3c')][_0x550b('0x29')]);_0x1b0bc2[_0x550b('0x2f')]=_[_0x550b('0x2e')](_0x26d166['query']);_0x1b0bc2[_0x550b('0x37')]=_[_0x550b('0x31')](_0x1b0bc2[_0x550b('0x2d')],_0x1b0bc2['query']);_0x15940b[_0x550b('0x30')]=_['intersection'](_0x1b0bc2[_0x550b('0x2d')],qs['fields'](_0x26d166[_0x550b('0x2f')]['fields']));_0x15940b['attributes']=_0x15940b[_0x550b('0x30')][_0x550b('0x33')]?_0x15940b[_0x550b('0x30')]:_0x1b0bc2[_0x550b('0x2d')];if(_0x26d166[_0x550b('0x2f')][_0x550b('0x3d')]){_0x15940b[_0x550b('0x3e')]=[{'all':!![]}];}_0x15940b=_['merge']({},_0x15940b,_0x26d166[_0x550b('0x3b')]);return db[_0x550b('0x3c')]['find'](_0x15940b)[_0x550b('0x22')](handleEntityNotFound(_0x55f5dc,null))['then'](respondWithResult(_0x55f5dc,null))[_0x550b('0x41')](handleError(_0x55f5dc,null));};exports[_0x550b('0x44')]=function(_0x48577a,_0x1d389b){return db[_0x550b('0x3c')][_0x550b('0x44')](_0x48577a['body'],{})[_0x550b('0x22')](respondWithResult(_0x1d389b,0xc9))[_0x550b('0x41')](handleError(_0x1d389b,null));};exports[_0x550b('0x21')]=function(_0x3f3ea0,_0xbc071b){if(_0x3f3ea0['body']['id']){delete _0x3f3ea0[_0x550b('0x45')]['id'];}return db[_0x550b('0x3c')]['find']({'where':{'id':_0x3f3ea0[_0x550b('0x43')]['id']}})['then'](handleEntityNotFound(_0xbc071b,null))['then'](saveUpdates(_0x3f3ea0[_0x550b('0x45')],null))[_0x550b('0x22')](respondWithResult(_0xbc071b,null))[_0x550b('0x41')](handleError(_0xbc071b,null));};exports['destroy']=function(_0x43b16a,_0x328f9b){return db[_0x550b('0x3c')][_0x550b('0x46')]({'where':{'id':_0x43b16a[_0x550b('0x43')]['id']}})[_0x550b('0x22')](handleEntityNotFound(_0x328f9b,null))[_0x550b('0x22')](removeEntity(_0x328f9b,null))[_0x550b('0x41')](handleError(_0x328f9b,null));}; \ No newline at end of file +var _0x5d2c=['api','../../config/environment','sendStatus','status','end','json','offset','limit','count','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','FaxApplication','fieldName','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','update','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x314397,_0x550526){var _0x1ec45e=function(_0x111722){while(--_0x111722){_0x314397['push'](_0x314397['shift']());}};_0x1ec45e(++_0x550526);}(_0x5d2c,0x1ae));var _0xc5d2=function(_0x4163f6,_0x463190){_0x4163f6=_0x4163f6-0x0;var _0x20940d=_0x5d2c[_0x4163f6];return _0x20940d;};'use strict';var emlformat=require(_0xc5d2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc5d2('0x1'));var jsonpatch=require(_0xc5d2('0x2'));var rp=require(_0xc5d2('0x3'));var moment=require(_0xc5d2('0x4'));var BPromise=require(_0xc5d2('0x5'));var Mustache=require('mustache');var util=require(_0xc5d2('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc5d2('0x7'));var fs=require('fs');var fs_extra=require(_0xc5d2('0x8'));var _=require(_0xc5d2('0x9'));var squel=require('squel');var crypto=require(_0xc5d2('0xa'));var jsforce=require(_0xc5d2('0xb'));var deskjs=require(_0xc5d2('0xc'));var toCsv=require(_0xc5d2('0xd'));var querystring=require(_0xc5d2('0xe'));var Papa=require(_0xc5d2('0xf'));var Redis=require(_0xc5d2('0x10'));var authService=require(_0xc5d2('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc5d2('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc5d2('0x13'))(_0xc5d2('0x14'));var utils=require('../../config/utils');var config=require(_0xc5d2('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x287501,_0x57206f){_0x57206f=_0x57206f||0xcc;return function(_0x37f27c){if(_0x37f27c){return _0x287501[_0xc5d2('0x16')](_0x57206f);}return _0x287501[_0xc5d2('0x17')](_0x57206f)[_0xc5d2('0x18')]();};}function respondWithResult(_0x187bb6,_0x304f1e){_0x304f1e=_0x304f1e||0xc8;return function(_0x1716fe){if(_0x1716fe){return _0x187bb6[_0xc5d2('0x17')](_0x304f1e)[_0xc5d2('0x19')](_0x1716fe);}};}function respondWithFilteredResult(_0x1cc1ad,_0x21faa2){return function(_0x575b1d){if(_0x575b1d){var _0x1f5544=typeof _0x21faa2[_0xc5d2('0x1a')]==='undefined'&&typeof _0x21faa2[_0xc5d2('0x1b')]==='undefined';var _0x1befe8=_0x575b1d['count'];var _0x1d1a29=_0x1f5544?0x0:_0x21faa2[_0xc5d2('0x1a')];var _0x112620=_0x1f5544?_0x575b1d[_0xc5d2('0x1c')]:_0x21faa2['offset']+_0x21faa2[_0xc5d2('0x1b')];var _0x4f90f2;if(_0x112620>=_0x1befe8){_0x112620=_0x1befe8;_0x4f90f2=0xc8;}else{_0x4f90f2=0xce;}_0x1cc1ad[_0xc5d2('0x17')](_0x4f90f2);return _0x1cc1ad['set'](_0xc5d2('0x1d'),_0x1d1a29+'-'+_0x112620+'/'+_0x1befe8)[_0xc5d2('0x19')](_0x575b1d);}return null;};}function patchUpdates(_0x49c5d9){return function(_0x30c36c){try{jsonpatch[_0xc5d2('0x1e')](_0x30c36c,_0x49c5d9,!![]);}catch(_0x2673e0){return BPromise[_0xc5d2('0x1f')](_0x2673e0);}return _0x30c36c[_0xc5d2('0x20')]();};}function saveUpdates(_0x120181,_0x20095d){return function(_0x4ed39f){if(_0x4ed39f){return _0x4ed39f['update'](_0x120181)[_0xc5d2('0x21')](function(_0x34d28d){return _0x34d28d;});}return null;};}function removeEntity(_0x4f1ba7,_0x1f88f7){return function(_0x3aee1a){if(_0x3aee1a){return _0x3aee1a[_0xc5d2('0x22')]()['then'](function(){_0x4f1ba7[_0xc5d2('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53e0c7,_0x57ace3){return function(_0x203624){if(!_0x203624){_0x53e0c7[_0xc5d2('0x16')](0x194);}return _0x203624;};}function handleError(_0x24822b,_0x3888d0){_0x3888d0=_0x3888d0||0x1f4;return function(_0x48d979){logger[_0xc5d2('0x23')](_0x48d979[_0xc5d2('0x24')]);if(_0x48d979['name']){delete _0x48d979[_0xc5d2('0x25')];}_0x24822b['status'](_0x3888d0)[_0xc5d2('0x26')](_0x48d979);};}exports[_0xc5d2('0x27')]=function(_0xea147e,_0x209d41){var _0x1d361d={},_0x3cb2ae={},_0x592ee5={'count':0x0,'rows':[]};var _0x477737=_['map'](db[_0xc5d2('0x28')]['rawAttributes'],function(_0x48c39e){return{'name':_0x48c39e[_0xc5d2('0x29')],'type':_0x48c39e['type'][_0xc5d2('0x2a')]};});_0x3cb2ae['model']=_[_0xc5d2('0x2b')](_0x477737,_0xc5d2('0x25'));_0x3cb2ae[_0xc5d2('0x2c')]=_[_0xc5d2('0x2d')](_0xea147e[_0xc5d2('0x2c')]);_0x3cb2ae[_0xc5d2('0x2e')]=_[_0xc5d2('0x2f')](_0x3cb2ae[_0xc5d2('0x30')],_0x3cb2ae[_0xc5d2('0x2c')]);_0x1d361d[_0xc5d2('0x31')]=_[_0xc5d2('0x2f')](_0x3cb2ae[_0xc5d2('0x30')],qs[_0xc5d2('0x32')](_0xea147e[_0xc5d2('0x2c')]['fields']));_0x1d361d['attributes']=_0x1d361d['attributes'][_0xc5d2('0x33')]?_0x1d361d[_0xc5d2('0x31')]:_0x3cb2ae[_0xc5d2('0x30')];if(!_0xea147e[_0xc5d2('0x2c')][_0xc5d2('0x34')](_0xc5d2('0x35'))){_0x1d361d[_0xc5d2('0x1b')]=qs[_0xc5d2('0x1b')](_0xea147e[_0xc5d2('0x2c')][_0xc5d2('0x1b')]);_0x1d361d['offset']=qs[_0xc5d2('0x1a')](_0xea147e[_0xc5d2('0x2c')][_0xc5d2('0x1a')]);}_0x1d361d[_0xc5d2('0x36')]=qs[_0xc5d2('0x37')](_0xea147e[_0xc5d2('0x2c')][_0xc5d2('0x37')]);_0x1d361d[_0xc5d2('0x38')]=qs[_0xc5d2('0x2e')](_[_0xc5d2('0x39')](_0xea147e['query'],_0x3cb2ae[_0xc5d2('0x2e')]),_0x477737);if(_0xea147e[_0xc5d2('0x2c')][_0xc5d2('0x3a')]){_0x1d361d[_0xc5d2('0x38')]=_['merge'](_0x1d361d['where'],{'$or':_[_0xc5d2('0x2b')](_0x477737,function(_0x5f0562){if(_0x5f0562[_0xc5d2('0x3b')]!==_0xc5d2('0x3c')){var _0x12cab1={};_0x12cab1[_0x5f0562[_0xc5d2('0x25')]]={'$like':'%'+_0xea147e[_0xc5d2('0x2c')][_0xc5d2('0x3a')]+'%'};return _0x12cab1;}})});}_0x1d361d=_[_0xc5d2('0x3d')]({},_0x1d361d,_0xea147e[_0xc5d2('0x3e')]);var _0xcba1b1={'where':_0x1d361d[_0xc5d2('0x38')]};return db[_0xc5d2('0x28')][_0xc5d2('0x1c')](_0xcba1b1)[_0xc5d2('0x21')](function(_0x4efed6){_0x592ee5[_0xc5d2('0x1c')]=_0x4efed6;if(_0xea147e['query']['includeAll']){_0x1d361d[_0xc5d2('0x3f')]=[{'all':!![]}];}return db[_0xc5d2('0x28')][_0xc5d2('0x40')](_0x1d361d);})[_0xc5d2('0x21')](function(_0x33a7af){_0x592ee5[_0xc5d2('0x41')]=_0x33a7af;return _0x592ee5;})[_0xc5d2('0x21')](respondWithFilteredResult(_0x209d41,_0x1d361d))[_0xc5d2('0x42')](handleError(_0x209d41,null));};exports[_0xc5d2('0x43')]=function(_0x4c39cc,_0x1acc51){var _0x510de6={'raw':!![],'where':{'id':_0x4c39cc[_0xc5d2('0x44')]['id']}},_0x132cc9={};_0x132cc9['model']=_[_0xc5d2('0x2d')](db[_0xc5d2('0x28')][_0xc5d2('0x45')]);_0x132cc9[_0xc5d2('0x2c')]=_[_0xc5d2('0x2d')](_0x4c39cc[_0xc5d2('0x2c')]);_0x132cc9[_0xc5d2('0x2e')]=_[_0xc5d2('0x2f')](_0x132cc9[_0xc5d2('0x30')],_0x132cc9[_0xc5d2('0x2c')]);_0x510de6['attributes']=_[_0xc5d2('0x2f')](_0x132cc9['model'],qs[_0xc5d2('0x32')](_0x4c39cc[_0xc5d2('0x2c')][_0xc5d2('0x32')]));_0x510de6['attributes']=_0x510de6[_0xc5d2('0x31')][_0xc5d2('0x33')]?_0x510de6[_0xc5d2('0x31')]:_0x132cc9[_0xc5d2('0x30')];if(_0x4c39cc[_0xc5d2('0x2c')][_0xc5d2('0x46')]){_0x510de6['include']=[{'all':!![]}];}_0x510de6=_[_0xc5d2('0x3d')]({},_0x510de6,_0x4c39cc[_0xc5d2('0x3e')]);return db[_0xc5d2('0x28')][_0xc5d2('0x47')](_0x510de6)[_0xc5d2('0x21')](handleEntityNotFound(_0x1acc51,null))[_0xc5d2('0x21')](respondWithResult(_0x1acc51,null))[_0xc5d2('0x42')](handleError(_0x1acc51,null));};exports[_0xc5d2('0x48')]=function(_0x15e110,_0x2d583d){return db['FaxApplication'][_0xc5d2('0x48')](_0x15e110[_0xc5d2('0x49')],{})[_0xc5d2('0x21')](respondWithResult(_0x2d583d,0xc9))['catch'](handleError(_0x2d583d,null));};exports[_0xc5d2('0x4a')]=function(_0x386cb9,_0x4dc3af){if(_0x386cb9[_0xc5d2('0x49')]['id']){delete _0x386cb9[_0xc5d2('0x49')]['id'];}return db[_0xc5d2('0x28')][_0xc5d2('0x47')]({'where':{'id':_0x386cb9[_0xc5d2('0x44')]['id']}})[_0xc5d2('0x21')](handleEntityNotFound(_0x4dc3af,null))[_0xc5d2('0x21')](saveUpdates(_0x386cb9[_0xc5d2('0x49')],null))['then'](respondWithResult(_0x4dc3af,null))[_0xc5d2('0x42')](handleError(_0x4dc3af,null));};exports[_0xc5d2('0x22')]=function(_0x554ed1,_0x5a80c7){return db[_0xc5d2('0x28')]['find']({'where':{'id':_0x554ed1[_0xc5d2('0x44')]['id']}})[_0xc5d2('0x21')](handleEntityNotFound(_0x5a80c7,null))[_0xc5d2('0x21')](removeEntity(_0x5a80c7,null))[_0xc5d2('0x42')](handleError(_0x5a80c7,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 42c4a52..192a555 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 _0x4534=['../../config/environment','./faxApplication.attributes','exports','define','fax_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x4534,0x92));var _0x4453=function(_0xde15c5,_0x273bcf){_0xde15c5=_0xde15c5-0x0;var _0x2a7b0c=_0x4534[_0xde15c5];return _0x2a7b0c;};'use strict';var _=require(_0x4453('0x0'));var util=require(_0x4453('0x1'));var logger=require(_0x4453('0x2'))(_0x4453('0x3'));var moment=require('moment');var BPromise=require(_0x4453('0x4'));var rp=require(_0x4453('0x5'));var fs=require('fs');var path=require(_0x4453('0x6'));var rimraf=require(_0x4453('0x7'));var config=require(_0x4453('0x8'));var attributes=require(_0x4453('0x9'));module[_0x4453('0xa')]=function(_0x2313dc,_0xdfd41a){return _0x2313dc[_0x4453('0xb')]('FaxApplication',attributes,{'tableName':_0x4453('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x4453('0xd')});}; \ No newline at end of file +var _0x5e96=['../../config/logger','bluebird','request-promise','path','../../config/environment','exports','define','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x243ab7,_0x5828e2){var _0x31fed7=function(_0x3d02c2){while(--_0x3d02c2){_0x243ab7['push'](_0x243ab7['shift']());}};_0x31fed7(++_0x5828e2);}(_0x5e96,0xf0));var _0x65e9=function(_0x1c57a6,_0xaba035){_0x1c57a6=_0x1c57a6-0x0;var _0x8eb55d=_0x5e96[_0x1c57a6];return _0x8eb55d;};'use strict';var _=require(_0x65e9('0x0'));var util=require(_0x65e9('0x1'));var logger=require(_0x65e9('0x2'))('api');var moment=require('moment');var BPromise=require(_0x65e9('0x3'));var rp=require(_0x65e9('0x4'));var fs=require('fs');var path=require(_0x65e9('0x5'));var rimraf=require('rimraf');var config=require(_0x65e9('0x6'));var attributes=require('./faxApplication.attributes');module[_0x65e9('0x7')]=function(_0x1a89e2,_0x5c2683){return _0x1a89e2[_0x65e9('0x8')]('FaxApplication',attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x65e9('0x9'),'collate':_0x65e9('0xa')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 04433d4..2e0af5b 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 _0x2d44=['raw','attributes','limit','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','UpdateFaxApplication','update','body','options'];(function(_0x255987,_0x27c0dd){var _0x42fb16=function(_0x355254){while(--_0x355254){_0x255987['push'](_0x255987['shift']());}};_0x42fb16(++_0x27c0dd);}(_0x2d44,0x1c4));var _0x42d4=function(_0x287c5,_0x2d0942){_0x287c5=_0x287c5-0x0;var _0x422a7b=_0x2d44[_0x287c5];return _0x422a7b;};'use strict';var _=require(_0x42d4('0x0'));var util=require(_0x42d4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x42d4('0x2'));var fs=require('fs');var Redis=require(_0x42d4('0x3'));var db=require(_0x42d4('0x4'))['db'];var utils=require(_0x42d4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x42d4('0x6'));var jayson=require(_0x42d4('0x7'));var client=jayson[_0x42d4('0x8')][_0x42d4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x27c491,_0x46c666,_0x4cdc07){return new BPromise(function(_0x10ef05,_0x2fd7f9){return client[_0x42d4('0xa')](_0x27c491,_0x4cdc07)[_0x42d4('0xb')](function(_0x5ad318){logger[_0x42d4('0xc')](_0x42d4('0xd'),_0x46c666,_0x42d4('0xe'));logger[_0x42d4('0xf')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x46c666,_0x42d4('0xe'),JSON[_0x42d4('0x10')](_0x5ad318));if(_0x5ad318['error']){if(_0x5ad318[_0x42d4('0x11')]['code']===0x1f4){logger[_0x42d4('0x11')](_0x42d4('0xd'),_0x46c666,_0x5ad318['error']['message']);return _0x2fd7f9(_0x5ad318[_0x42d4('0x11')]['message']);}logger['error'](_0x42d4('0xd'),_0x46c666,_0x5ad318['error'][_0x42d4('0x12')]);return _0x10ef05(_0x5ad318['error']['message']);}else{logger['info']('FaxApplication,\x20%s,\x20%s',_0x46c666,_0x42d4('0xe'));_0x10ef05(_0x5ad318[_0x42d4('0x13')][_0x42d4('0x12')]);}})['catch'](function(_0x44d255){logger[_0x42d4('0x11')](_0x42d4('0xd'),_0x46c666,_0x44d255);_0x2fd7f9(_0x44d255);});});}exports[_0x42d4('0x14')]=function(_0x3ad0d7){var _0x2ed30f=this;return new Promise(function(_0x2259ac,_0x15eba0){return db['FaxApplication'][_0x42d4('0x15')](_0x3ad0d7[_0x42d4('0x16')],{'raw':_0x3ad0d7[_0x42d4('0x17')]?_0x3ad0d7[_0x42d4('0x17')][_0x42d4('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ad0d7[_0x42d4('0x17')]?_0x3ad0d7[_0x42d4('0x17')]['where']||null:null,'attributes':_0x3ad0d7[_0x42d4('0x17')]?_0x3ad0d7[_0x42d4('0x17')][_0x42d4('0x19')]||null:null,'limit':_0x3ad0d7['options']?_0x3ad0d7[_0x42d4('0x17')][_0x42d4('0x1a')]||null:null})[_0x42d4('0xb')](function(_0x5a8790){logger['info'](_0x42d4('0x14'),_0x3ad0d7);logger[_0x42d4('0xf')](_0x42d4('0x14'),_0x3ad0d7,JSON[_0x42d4('0x10')](_0x5a8790));_0x2259ac(_0x5a8790);})[_0x42d4('0x1b')](function(_0x161f90){logger[_0x42d4('0x11')](_0x42d4('0x14'),_0x161f90[_0x42d4('0x12')],_0x3ad0d7);_0x15eba0(_0x2ed30f[_0x42d4('0x11')](0x1f4,_0x161f90[_0x42d4('0x12')]));});});}; \ No newline at end of file +var _0xe5a2=['options','where','attributes','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','then','info','request\x20sent','debug','error','code','FaxApplication,\x20%s,\x20%s','message','result','catch','UpdateFaxApplication','body','raw'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0xe5a2,0xdb));var _0x2e5a=function(_0x4c4be4,_0x5aaba6){_0x4c4be4=_0x4c4be4-0x0;var _0x1ba559=_0xe5a2[_0x4c4be4];return _0x1ba559;};'use strict';var _=require('lodash');var util=require(_0x2e5a('0x0'));var moment=require(_0x2e5a('0x1'));var BPromise=require(_0x2e5a('0x2'));var rs=require(_0x2e5a('0x3'));var fs=require('fs');var Redis=require(_0x2e5a('0x4'));var db=require(_0x2e5a('0x5'))['db'];var utils=require(_0x2e5a('0x6'));var logger=require('../../config/logger')(_0x2e5a('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2e5a('0x8')][_0x2e5a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x20c3b9,_0x4325aa,_0x2be6ea){return new BPromise(function(_0x549314,_0x41ca4c){return client[_0x2e5a('0xa')](_0x20c3b9,_0x2be6ea)[_0x2e5a('0xb')](function(_0x55879f){logger[_0x2e5a('0xc')]('FaxApplication,\x20%s,\x20%s',_0x4325aa,_0x2e5a('0xd'));logger[_0x2e5a('0xe')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x4325aa,_0x2e5a('0xd'),JSON['stringify'](_0x55879f));if(_0x55879f[_0x2e5a('0xf')]){if(_0x55879f[_0x2e5a('0xf')][_0x2e5a('0x10')]===0x1f4){logger[_0x2e5a('0xf')](_0x2e5a('0x11'),_0x4325aa,_0x55879f[_0x2e5a('0xf')][_0x2e5a('0x12')]);return _0x41ca4c(_0x55879f['error'][_0x2e5a('0x12')]);}logger['error'](_0x2e5a('0x11'),_0x4325aa,_0x55879f[_0x2e5a('0xf')][_0x2e5a('0x12')]);return _0x549314(_0x55879f['error'][_0x2e5a('0x12')]);}else{logger['info'](_0x2e5a('0x11'),_0x4325aa,_0x2e5a('0xd'));_0x549314(_0x55879f[_0x2e5a('0x13')]['message']);}})[_0x2e5a('0x14')](function(_0x5ec936){logger['error']('FaxApplication,\x20%s,\x20%s',_0x4325aa,_0x5ec936);_0x41ca4c(_0x5ec936);});});}exports[_0x2e5a('0x15')]=function(_0x4578bf){var _0x55c986=this;return new Promise(function(_0xf5e10b,_0x40d8fa){return db['FaxApplication']['update'](_0x4578bf[_0x2e5a('0x16')],{'raw':_0x4578bf['options']?_0x4578bf['options'][_0x2e5a('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4578bf[_0x2e5a('0x18')]?_0x4578bf[_0x2e5a('0x18')][_0x2e5a('0x19')]||null:null,'attributes':_0x4578bf['options']?_0x4578bf[_0x2e5a('0x18')][_0x2e5a('0x1a')]||null:null,'limit':_0x4578bf['options']?_0x4578bf[_0x2e5a('0x18')]['limit']||null:null})[_0x2e5a('0xb')](function(_0x565d72){logger[_0x2e5a('0xc')]('UpdateFaxApplication',_0x4578bf);logger[_0x2e5a('0xe')](_0x2e5a('0x15'),_0x4578bf,JSON['stringify'](_0x565d72));_0xf5e10b(_0x565d72);})[_0x2e5a('0x14')](function(_0x4dc7fa){logger['error']('UpdateFaxApplication',_0x4dc7fa[_0x2e5a('0x12')],_0x4578bf);_0x40d8fa(_0x55c986['error'](0x1f4,_0x4dc7fa[_0x2e5a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 7425a8b..02a791f 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 _0x3423=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post','create','destroy','exports','path','connect-timeout','express','Router'];(function(_0x3a486c,_0x429ebc){var _0x24abe6=function(_0x2ceb00){while(--_0x2ceb00){_0x3a486c['push'](_0x3a486c['shift']());}};_0x24abe6(++_0x429ebc);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3342('0x0'));var timeout=require(_0x3342('0x1'));var express=require(_0x3342('0x2'));var router=express[_0x3342('0x3')]();var fs_extra=require(_0x3342('0x4'));var auth=require(_0x3342('0x5'));var interaction=require(_0x3342('0x6'));var config=require(_0x3342('0x7'));var controller=require(_0x3342('0x8'));router[_0x3342('0x9')]('/',auth[_0x3342('0xa')](),controller[_0x3342('0xb')]);router[_0x3342('0x9')](_0x3342('0xc'),auth[_0x3342('0xa')](),controller[_0x3342('0xd')]);router[_0x3342('0xe')]('/',auth[_0x3342('0xa')](),controller[_0x3342('0xf')]);router['put']('/:id',auth[_0x3342('0xa')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x3342('0x10')]);module[_0x3342('0x11')]=router; \ No newline at end of file +var _0xe605=['../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','create','put','/:id','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x3fee51,_0x1f5a3d){var _0x465957=function(_0x5a3ac8){while(--_0x5a3ac8){_0x3fee51['push'](_0x3fee51['shift']());}};_0x465957(++_0x1f5a3d);}(_0xe605,0x92));var _0x5e60=function(_0x26441b,_0x19a2d3){_0x26441b=_0x26441b-0x0;var _0xb0d151=_0xe605[_0x26441b];return _0xb0d151;};'use strict';var multer=require(_0x5e60('0x0'));var util=require(_0x5e60('0x1'));var path=require('path');var timeout=require(_0x5e60('0x2'));var express=require(_0x5e60('0x3'));var router=express[_0x5e60('0x4')]();var fs_extra=require(_0x5e60('0x5'));var auth=require(_0x5e60('0x6'));var interaction=require(_0x5e60('0x7'));var config=require(_0x5e60('0x8'));var controller=require(_0x5e60('0x9'));router[_0x5e60('0xa')]('/',auth[_0x5e60('0xb')](),controller[_0x5e60('0xc')]);router[_0x5e60('0xa')]('/:id',auth[_0x5e60('0xb')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x5e60('0xd')]);router[_0x5e60('0xe')](_0x5e60('0xf'),auth[_0x5e60('0xb')](),controller[_0x5e60('0x10')]);router[_0x5e60('0x11')]('/:id',auth[_0x5e60('0xb')](),controller['destroy']);module[_0x5e60('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index d33a466..287b9b8 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 _0xc14b=['STRING','DATE','ENUM','out','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc14b,0x12b));var _0xbc14=function(_0x5ef7b8,_0x15cc07){_0x5ef7b8=_0x5ef7b8-0x0;var _0x2c7148=_0xc14b[_0x5ef7b8];return _0x2c7148;};'use strict';var Sequelize=require('sequelize');module[_0xbc14('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xbc14('0x1')]},'secondDisposition':{'type':Sequelize[_0xbc14('0x1')]},'thirdDisposition':{'type':Sequelize[_0xbc14('0x1')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xbc14('0x2')]},'fax':{'type':Sequelize[_0xbc14('0x1')]},'firstMsgDirection':{'type':Sequelize[_0xbc14('0x3')]('in',_0xbc14('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xbc14('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xbc14('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x4678=['STRING','DATE','out','ENUM','exports'];(function(_0x43dc17,_0x367cd9){var _0x55082a=function(_0xb45947){while(--_0xb45947){_0x43dc17['push'](_0x43dc17['shift']());}};_0x55082a(++_0x367cd9);}(_0x4678,0x6d));var _0x8467=function(_0x5e2426,_0x2da5a0){_0x5e2426=_0x5e2426-0x0;var _0x305696=_0x4678[_0x5e2426];return _0x305696;};'use strict';var Sequelize=require('sequelize');module[_0x8467('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x8467('0x1')]},'secondDisposition':{'type':Sequelize[_0x8467('0x1')]},'thirdDisposition':{'type':Sequelize[_0x8467('0x1')]},'note':{'type':Sequelize[_0x8467('0x1')]},'read1stAt':{'type':Sequelize[_0x8467('0x2')]},'fax':{'type':Sequelize[_0x8467('0x1')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x8467('0x3')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8467('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x8467('0x4')]('in',_0x8467('0x3')),'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 463d786..abbf4eb 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 _0x1ff4=['update','describe','FaxMessage','omit','ids','getMessages','findOne','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','emit','faxInteractionTags:save','download','unix','join','server','tmp','root','files','attachments','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','existsSync','createReadStream','pipe','createWriteStream','basename','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','desk.js','querystring','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','save','then','error','name','send','Users','fullname','TagIds','Tags','split','forEach','push','catch','map','FaxInteraction','rawAttributes','fieldName','type','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','select','field','color','tools_tags','u.id','u.fullname','ui.FaxInteractionId','from','user_has_fax_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','a.id\x20=\x20i.FaxAccountId','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','operator','UserId','body','some','createdAt','parse','$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.fax\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','contactName','DESC','t.id\x20IN\x20?','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getFaxAccounts','isEmpty','i.FaxAccountId\x20IS\x20NULL','i.FaxAccountId\x20IN\x20?','FaxAccountId','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.fax','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','FaxInteractionId','all','rows','params','includeAll','include','options','create'];(function(_0x132913,_0x1895b3){var _0x30506f=function(_0x5ce740){while(--_0x5ce740){_0x132913['push'](_0x132913['shift']());}};_0x30506f(++_0x1895b3);}(_0x1ff4,0xf9));var _0x41ff=function(_0x4604da,_0x2791bb){_0x4604da=_0x4604da-0x0;var _0x26e5da=_0x1ff4[_0x4604da];return _0x26e5da;};'use strict';var emlformat=require(_0x41ff('0x0'));var rimraf=require(_0x41ff('0x1'));var zipdir=require(_0x41ff('0x2'));var jsonpatch=require(_0x41ff('0x3'));var rp=require(_0x41ff('0x4'));var moment=require('moment');var BPromise=require(_0x41ff('0x5'));var Mustache=require(_0x41ff('0x6'));var util=require(_0x41ff('0x7'));var path=require(_0x41ff('0x8'));var sox=require(_0x41ff('0x9'));var csv=require(_0x41ff('0xa'));var ejs=require(_0x41ff('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x41ff('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x41ff('0xd'));var toCsv=require(_0x41ff('0xa'));var querystring=require(_0x41ff('0xe'));var Papa=require('papaparse');var Redis=require(_0x41ff('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x41ff('0x10'));var logger=require(_0x41ff('0x11'))(_0x41ff('0x12'));var utils=require(_0x41ff('0x13'));var config=require(_0x41ff('0x14'));var licenseUtil=require(_0x41ff('0x15'));var db=require(_0x41ff('0x16'))['db'];config[_0x41ff('0x17')]=_[_0x41ff('0x18')](config[_0x41ff('0x17')],{'host':_0x41ff('0x19'),'port':0x18eb});var socket=require(_0x41ff('0x1a'))(new Redis(config[_0x41ff('0x17')]));require(_0x41ff('0x1b'))[_0x41ff('0x1c')](socket);function respondWithStatusCode(_0x2198b5,_0xa8f219){_0xa8f219=_0xa8f219||0xcc;return function(_0x51ff2){if(_0x51ff2){return _0x2198b5[_0x41ff('0x1d')](_0xa8f219);}return _0x2198b5[_0x41ff('0x1e')](_0xa8f219)[_0x41ff('0x1f')]();};}function respondWithResult(_0x8e7403,_0x34ba6b){_0x34ba6b=_0x34ba6b||0xc8;return function(_0x29b45c){if(_0x29b45c){return _0x8e7403[_0x41ff('0x1e')](_0x34ba6b)['json'](_0x29b45c);}};}function respondWithFilteredResult(_0x20e887,_0x29026c){return function(_0xad30e1){if(_0xad30e1){var _0xd08a0=typeof _0x29026c[_0x41ff('0x20')]==='undefined'&&typeof _0x29026c[_0x41ff('0x21')]===_0x41ff('0x22');var _0x571a0d=_0xad30e1[_0x41ff('0x23')];var _0x184f4e=_0xd08a0?0x0:_0x29026c['offset'];var _0x47e69b=_0xd08a0?_0xad30e1[_0x41ff('0x23')]:_0x29026c['offset']+_0x29026c['limit'];var _0x53254b;if(_0x47e69b>=_0x571a0d){_0x47e69b=_0x571a0d;_0x53254b=0xc8;}else{_0x53254b=0xce;}_0x20e887[_0x41ff('0x1e')](_0x53254b);return _0x20e887[_0x41ff('0x24')](_0x41ff('0x25'),_0x184f4e+'-'+_0x47e69b+'/'+_0x571a0d)[_0x41ff('0x26')](_0xad30e1);}return null;};}function patchUpdates(_0x629531){return function(_0x5bf09e){try{jsonpatch[_0x41ff('0x27')](_0x5bf09e,_0x629531,!![]);}catch(_0x19331a){return BPromise['reject'](_0x19331a);}return _0x5bf09e[_0x41ff('0x28')]();};}function saveUpdates(_0x307127,_0xccdb7){return function(_0x1815bd){if(_0x1815bd){return _0x1815bd['update'](_0x307127)['then'](function(_0x3d092f){return _0x3d092f;});}return null;};}function removeEntity(_0x1488ee,_0x562b48){return function(_0x570904){if(_0x570904){return _0x570904['destroy']()[_0x41ff('0x29')](function(){_0x1488ee[_0x41ff('0x1e')](0xcc)[_0x41ff('0x1f')]();});}};}function handleEntityNotFound(_0x1a0c8e,_0x4de575){return function(_0x66c96a){if(!_0x66c96a){_0x1a0c8e['sendStatus'](0x194);}return _0x66c96a;};}function handleError(_0x4c583d,_0x2ce4dc){_0x2ce4dc=_0x2ce4dc||0x1f4;return function(_0x2f571d){logger[_0x41ff('0x2a')](_0x2f571d['stack']);if(_0x2f571d[_0x41ff('0x2b')]){delete _0x2f571d[_0x41ff('0x2b')];}_0x4c583d[_0x41ff('0x1e')](_0x2ce4dc)[_0x41ff('0x2c')](_0x2f571d);};}function getInteractionUsers(_0x38c9c2,_0x7e3777){return new BPromise(function(_0x37847a,_0x14bff4){try{if(_0x7e3777[_0x38c9c2['id']]){_0x38c9c2[_0x41ff('0x2d')]=_['map'](_0x7e3777[_0x38c9c2['id']],function(_0x1c6a0f){return{'id':_0x1c6a0f['id'],'fullname':_0x1c6a0f[_0x41ff('0x2e')]};});}}catch(_0x5c18a6){_0x14bff4(_0x5c18a6);}_0x37847a(_0x38c9c2);});}function getInteractionTags(_0x38e705,_0x286366){return new BPromise(function(_0x11c316,_0x13a41a){try{if(_0x38e705[_0x41ff('0x2f')]){_0x38e705[_0x41ff('0x30')]=[];_0x38e705['TagIds'][_0x41ff('0x31')](',')[_0x41ff('0x32')](function(_0x546e98){_0x38e705[_0x41ff('0x30')][_0x41ff('0x33')](_0x286366[_0x546e98]);});}delete _0x38e705[_0x41ff('0x2f')];}catch(_0x89e3d6){_0x13a41a(_0x89e3d6);}_0x11c316(_0x38e705);});}function updateFaxInteraction(_0x111eb7,_0x35070c,_0x226d5e){return new BPromise(function(_0x1980e3,_0x1529ec){return getInteractionUsers(_0x111eb7,_0x226d5e)[_0x41ff('0x29')](function(_0x150afd){return getInteractionTags(_0x150afd,_0x35070c);})['then'](function(_0x21a891){_0x1980e3(_0x21a891);})[_0x41ff('0x34')](function(_0x4061cd){_0x1529ec(_0x4061cd);});});}exports['index']=function(_0x5256d7,_0x15bf83){var _0x44581a={},_0x302965={},_0x4eb15b={'count':0x0,'rows':[]};var _0x327502=_[_0x41ff('0x35')](db[_0x41ff('0x36')][_0x41ff('0x37')],function(_0x180cb5){return{'name':_0x180cb5[_0x41ff('0x38')],'type':_0x180cb5[_0x41ff('0x39')]['key']};});_0x302965['model']=_[_0x41ff('0x35')](_0x327502,_0x41ff('0x2b'));_0x302965[_0x41ff('0x3a')]=_[_0x41ff('0x3b')](_0x5256d7[_0x41ff('0x3a')]);_0x302965['filters']=_[_0x41ff('0x3c')](_0x302965['model'],_0x302965[_0x41ff('0x3a')]);_0x44581a[_0x41ff('0x3d')]=_[_0x41ff('0x3c')](_0x302965[_0x41ff('0x3e')],qs[_0x41ff('0x3f')](_0x5256d7[_0x41ff('0x3a')][_0x41ff('0x3f')]));_0x44581a['attributes']=_0x44581a[_0x41ff('0x3d')][_0x41ff('0x40')]?_0x44581a['attributes']:_0x302965['model'];if(!_0x5256d7[_0x41ff('0x3a')][_0x41ff('0x41')](_0x41ff('0x42'))){_0x44581a[_0x41ff('0x21')]=qs[_0x41ff('0x21')](_0x5256d7[_0x41ff('0x3a')][_0x41ff('0x21')]);_0x44581a[_0x41ff('0x20')]=qs[_0x41ff('0x20')](_0x5256d7['query'][_0x41ff('0x20')]);}_0x44581a[_0x41ff('0x43')]=qs[_0x41ff('0x44')](_0x5256d7[_0x41ff('0x3a')][_0x41ff('0x44')]);_0x44581a[_0x41ff('0x45')]=qs[_0x41ff('0x46')](_[_0x41ff('0x47')](_0x5256d7[_0x41ff('0x3a')],_0x302965[_0x41ff('0x46')]),_0x327502);var _0x5a6231=[];var _0x4bdc2b=squel[_0x41ff('0x48')]()[_0x41ff('0x49')]('id')['field'](_0x41ff('0x2b'))[_0x41ff('0x49')](_0x41ff('0x4a'))['from'](_0x41ff('0x4b'));var _0x5f1aa6=squel[_0x41ff('0x48')]()[_0x41ff('0x49')](_0x41ff('0x4c'))['field'](_0x41ff('0x4d'))[_0x41ff('0x49')](_0x41ff('0x4e'))[_0x41ff('0x4f')](_0x41ff('0x50'),'ui')[_0x41ff('0x51')](_0x41ff('0x52'),'u',_0x41ff('0x53'));var _0x4e633f=squel[_0x41ff('0x48')]()[_0x41ff('0x4f')]('fax_interactions','i')[_0x41ff('0x51')](_0x41ff('0x54'),'c',_0x41ff('0x55'))[_0x41ff('0x51')](_0x41ff('0x52'),'o',_0x41ff('0x56'))['left_join']('fax_accounts','a',_0x41ff('0x57'))[_0x41ff('0x51')]('fax_messages','me','me.FaxInteractionId\x20=\x20i.id')[_0x41ff('0x51')](_0x41ff('0x58'),'it',_0x41ff('0x59'))['left_join'](_0x41ff('0x4b'),'t',_0x41ff('0x5a'));var _0x55de99=squel[_0x41ff('0x5b')]();var _0x5953f5=[];var _0x200ea6=squel[_0x41ff('0x5b')]();var _0x1eded6;if(_0x5256d7[_0x41ff('0x3a')]['search']){_0x1eded6=as[_0x41ff('0x5c')](_0x5256d7['query'][_0x41ff('0x5d')]);var _0x515bdd=_0x1eded6['sqlOperator'];for(var _0x2c2988=0x0;_0x2c2988<_0x1eded6[_0x41ff('0x5e')][_0x41ff('0x40')];_0x2c2988++){var _0x3e8ed8=_0x1eded6[_0x41ff('0x5e')][_0x2c2988];var _0x5c8b2a='i';var _0x15daa9=_[_0x41ff('0x5f')](_0x327502,[_0x41ff('0x2b'),_0x3e8ed8[_0x41ff('0x49')]]);if(!_0x15daa9){switch(_0x3e8ed8[_0x41ff('0x49')]){case _0x41ff('0x60'):if(_0x3e8ed8[_0x41ff('0x61')]==0x1){_0x4e633f[_0x41ff('0x62')]('`'+_0x3e8ed8[_0x41ff('0x49')]+_0x41ff('0x63'));}else{_0x4e633f['having']('`'+_0x3e8ed8[_0x41ff('0x49')]+_0x41ff('0x64'));}break;case _0x41ff('0x65'):if(_0x3e8ed8['operator']===_0x41ff('0x66')){if(_0x3e8ed8[_0x41ff('0x61')][_0x41ff('0x31')]('\x20')['length']>0x1){_0x55de99[_0x515bdd](_0x41ff('0x67'),qs[_0x41ff('0x68')](_0x3e8ed8[_0x41ff('0x61')]),null);}else{var _0x2ddc09='%'+_0x3e8ed8[_0x41ff('0x61')]+'%';_0x55de99[_0x515bdd]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x2ddc09,_0x2ddc09,_0x2ddc09);}}else{_0x15daa9=_[_0x41ff('0x5f')](_0x327502,[_0x41ff('0x2b'),_0x41ff('0x69')]);_0x3e8ed8[_0x41ff('0x49')]=_0x41ff('0x69');_0x5eb789=as[_0x41ff('0x6a')](_0x5c8b2a,_0x15daa9[_0x41ff('0x39')],_0x3e8ed8);_0x55de99[_0x515bdd](_0x5eb789[_0x41ff('0x6b')],_0x5eb789['value'][_0x41ff('0x6c')],_0x5eb789[_0x41ff('0x61')][_0x41ff('0x1f')]);}break;case _0x41ff('0x6d'):var _0xf1bdc5=_0x3e8ed8[_0x41ff('0x61')][_0x41ff('0x31')](',')[_0x41ff('0x35')](function(_0x49ce9b){return Number(_0x49ce9b);});_0xf1bdc5[_0x41ff('0x32')](function(_0xf81dda){_0x200ea6['or'](_0x41ff('0x6e'),'%,'+_0xf81dda+',%');});_0x5953f5=_[_0x41ff('0x6f')](_0x5953f5,_0xf1bdc5);break;case'User':if(_0x3e8ed8[_0x41ff('0x70')]===_0x41ff('0x66')){_0x55de99[_0x515bdd]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x3e8ed8[_0x41ff('0x61')]+'%',null);}else{_0x15daa9=_[_0x41ff('0x5f')](_0x327502,[_0x41ff('0x2b'),_0x41ff('0x71')]);_0x3e8ed8[_0x41ff('0x49')]=_0x41ff('0x71');_0x5eb789=as['buildExpression'](_0x5c8b2a,_0x15daa9['type'],_0x3e8ed8);_0x55de99[_0x515bdd](_0x5eb789['text'],_0x5eb789[_0x41ff('0x61')][_0x41ff('0x6c')],_0x5eb789['value']['end']);}break;case _0x41ff('0x72'):_0x5eb789=as['buildExpression']('me',null,_0x3e8ed8);_0x55de99[_0x515bdd](_0x5eb789[_0x41ff('0x6b')],_0x5eb789[_0x41ff('0x61')][_0x41ff('0x6c')],_0x5eb789['value'][_0x41ff('0x1f')]);break;}}else{var _0x5eb789=as[_0x41ff('0x6a')](_0x5c8b2a,_0x15daa9[_0x41ff('0x39')],_0x3e8ed8);_0x55de99[_0x515bdd](_0x5eb789[_0x41ff('0x6b')],_0x5eb789[_0x41ff('0x61')][_0x41ff('0x6c')],_0x5eb789[_0x41ff('0x61')][_0x41ff('0x1f')]);}}}else{var _0x3ac2dd=_(_0x5256d7['query'])['keys']()[_0x41ff('0x35')](function(_0x5ced28){return _[_0x41ff('0x73')](_0x327502,['name',_0x5ced28])?_0x5ced28:undefined;})['compact']()[_0x41ff('0x61')]();if(!_['isEmpty'](_0x3ac2dd)){_0x3ac2dd[_0x41ff('0x32')](function(_0x30a436){if(_0x30a436==='FaxAccountId'){_0x4e633f[_0x41ff('0x45')]('i.FaxAccountId\x20IN\x20?',[]['concat'](_0x5256d7[_0x41ff('0x3a')][_0x30a436]));}else if(_0x30a436===_0x41ff('0x74')){var _0x2855bf=JSON[_0x41ff('0x75')](_0x5256d7[_0x41ff('0x3a')][_0x30a436])['$gte'];var _0x40b806=JSON[_0x41ff('0x75')](_0x5256d7[_0x41ff('0x3a')][_0x30a436])[_0x41ff('0x76')];_0x4e633f[_0x41ff('0x45')](_0x41ff('0x77'),_0x2855bf,_0x40b806);}else{if(_0x5256d7[_0x41ff('0x3a')][_0x30a436]==='null'){_0x4e633f[_0x41ff('0x45')]('i.'+_0x30a436+_0x41ff('0x78'));}else{_0x4e633f['where']('i.'+_0x30a436+_0x41ff('0x79'),_0x5256d7[_0x41ff('0x3a')][_0x30a436]);}}});}if(_0x5256d7[_0x41ff('0x3a')][_0x41ff('0x7a')]){if(_0x5256d7['query'][_0x41ff('0x7a')]==0x1){_0x4e633f[_0x41ff('0x62')](_0x41ff('0x7b'));}else{_0x4e633f[_0x41ff('0x62')]('`unreadMessages`\x20>\x200');}}if(_0x5256d7[_0x41ff('0x3a')][_0x41ff('0x7c')]){_0x5953f5=_[_0x41ff('0x7d')](_0x5256d7[_0x41ff('0x3a')]['tag'])?_0x5256d7[_0x41ff('0x3a')]['tag']:new Array(_0x5256d7['query'][_0x41ff('0x7c')]);_0x5953f5[_0x41ff('0x32')](function(_0x5db08f){_0x200ea6['or'](_0x41ff('0x6e'),'%,'+_0x5db08f+',%');});}if(_0x5256d7[_0x41ff('0x3a')][_0x41ff('0x7e')]){var _0x25d397=_0x5256d7[_0x41ff('0x3a')][_0x41ff('0x7e')][_0x41ff('0x7f')]('\x5c','\x5c\x5c')[_0x41ff('0x7f')](/'/g,'\x27\x27');if(qs[_0x41ff('0x80')](_0x25d397)){_0x55de99['or'](_0x41ff('0x81'),_0x25d397+'%')['or'](_0x41ff('0x82'),_0x25d397+'%');}_0x55de99['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x25d397+'%');}}_0x4e633f[_0x41ff('0x45')](_0x55de99);_0x4e633f[_0x41ff('0x83')](_0x41ff('0x84'));var _0x1252fd={'type':db[_0x41ff('0x85')][_0x41ff('0x86')][_0x41ff('0x87')],'raw':!![]};var _0x271e39=_0x4e633f['clone']();_0x271e39['field'](_0x41ff('0x84'));_0x271e39[_0x41ff('0x49')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x44581a['order']){_0x44581a['order'][_0x41ff('0x32')](function(_0x38ba04){var _0x230024=_0x38ba04[0x0]===_0x41ff('0x88')?_0x38ba04[0x0]:'i.'+_0x38ba04[0x0];_0x4e633f[_0x41ff('0x43')](_0x230024,_0x38ba04[0x1]===_0x41ff('0x89')?![]:!![]);});}if(!_['isEmpty'](_0x5953f5)){_0x4e633f['having'](_0x200ea6);_0x271e39[_0x41ff('0x45')](_0x41ff('0x8a'),_0x5953f5);}BPromise['resolve']()[_0x41ff('0x29')](function(){if(!_0x1eded6){if(_0x5256d7[_0x41ff('0x3a')]['FaxAccountId'])return;_0x271e39[_0x41ff('0x45')](_0x41ff('0x8b'));_0x4e633f['where'](_0x41ff('0x8b'));return;}if(_0x5256d7[_0x41ff('0x8c')][_0x41ff('0x8d')]!==_0x41ff('0x8e'))return;return _0x5256d7[_0x41ff('0x8c')][_0x41ff('0x8f')]({'attributes':['id'],'raw':!![]})[_0x41ff('0x29')](function(_0x46aa0a){if(_[_0x41ff('0x90')](_0x46aa0a)){_0x271e39[_0x41ff('0x45')](_0x41ff('0x91'));_0x4e633f['where'](_0x41ff('0x91'));}else{_0x271e39[_0x41ff('0x45')]('i.FaxAccountId\x20IN\x20?',_[_0x41ff('0x35')](_0x46aa0a,'id'));_0x4e633f[_0x41ff('0x45')](_0x41ff('0x92'),_[_0x41ff('0x35')](_0x46aa0a,'id'));}});})[_0x41ff('0x29')](function(){if(_0x5256d7[_0x41ff('0x8c')][_0x41ff('0x8d')]==='agent'&&!_0x1eded6&&!_0x5256d7['query'][_0x41ff('0x93')])return[];return db[_0x41ff('0x94')][_0x41ff('0x3a')](_0x271e39['toString'](),_0x1252fd);})['then'](function(_0x471261){_0x4eb15b['count']=_0x471261[_0x41ff('0x40')];if(_0x4eb15b['count']===0x0)return[];return db['sequelize'][_0x41ff('0x3a')](_0x4bdc2b[_0x41ff('0x95')](),_0x1252fd)[_0x41ff('0x29')](function(_0x174551){_0x5a6231=_[_0x41ff('0x96')](_0x174551,'id');_0x1252fd=_[_0x41ff('0x97')](_0x1252fd,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5256d7['query'][_0x41ff('0x3f')]){_0x44581a[_0x41ff('0x3d')][_0x41ff('0x32')](function(_0x290758){_0x4e633f[_0x41ff('0x49')]('i.'+_0x290758);});}else{_0x4e633f['field'](_0x41ff('0x98'),'unreadMessages');_0x4e633f[_0x41ff('0x49')](_0x41ff('0x99'),_0x41ff('0x9a'));_0x4e633f[_0x41ff('0x49')](_0x41ff('0x9b'),_0x41ff('0x9c'));_0x4e633f[_0x41ff('0x49')](_0x41ff('0x9d'),_0x41ff('0x88'));_0x4e633f[_0x41ff('0x49')](_0x41ff('0x9e'));_0x4e633f[_0x41ff('0x49')](_0x41ff('0x9f'),_0x41ff('0xa0'));_0x4e633f[_0x41ff('0x49')]('c.lastName',_0x41ff('0xa1'));_0x4e633f['field']('c.email',_0x41ff('0xa2'));_0x4e633f['field'](_0x41ff('0xa3'),_0x41ff('0xa4'));_0x4e633f['field']('c.mobile','Contact.mobile');_0x4e633f[_0x41ff('0x49')](_0x41ff('0xa5'),'Contact.fax');_0x4e633f[_0x41ff('0x49')]('o.fullname','Owner.fullname');_0x4e633f['field'](_0x41ff('0xa6'),'Owner.internal');_0x4e633f['field'](_0x41ff('0xa7'),'TagIds');}if(_0x44581a[_0x41ff('0x21')])_0x4e633f[_0x41ff('0x21')](_0x44581a['limit']);if(_0x44581a['offset'])_0x4e633f[_0x41ff('0x20')](_0x44581a[_0x41ff('0x20')]);return db[_0x41ff('0x94')][_0x41ff('0x3a')](_0x4e633f[_0x41ff('0x95')](),_0x1252fd);})[_0x41ff('0x29')](function(_0x3dc29e){if(_0x3dc29e[_0x41ff('0x40')]>0x0)_0x5f1aa6[_0x41ff('0x45')]('ui.FaxInteractionId\x20IN\x20?',_[_0x41ff('0x35')](_0x3dc29e,'id'));return db[_0x41ff('0x94')][_0x41ff('0x3a')](_0x5f1aa6[_0x41ff('0x95')](),_0x1252fd)['then'](function(_0x46d421){var _0x5e7d30=_[_0x41ff('0xa8')](_0x46d421,_0x41ff('0xa9'));var _0x7c6638=[];_0x3dc29e[_0x41ff('0x32')](function(_0x6231a5){_0x7c6638[_0x41ff('0x33')](updateFaxInteraction(_0x6231a5,_0x5a6231,_0x5e7d30));});return BPromise[_0x41ff('0xaa')](_0x7c6638);});});})[_0x41ff('0x29')](function(_0x1ada42){_0x4eb15b[_0x41ff('0xab')]=_0x1ada42;return _0x4eb15b;})[_0x41ff('0x29')](respondWithFilteredResult(_0x15bf83,_0x44581a))[_0x41ff('0x34')](handleError(_0x15bf83,null));};exports['show']=function(_0x25f051,_0xbf3ae2){var _0x3f0a2d={'raw':![],'where':{'id':_0x25f051[_0x41ff('0xac')]['id']}},_0x3a87b0={};_0x3a87b0[_0x41ff('0x3e')]=_[_0x41ff('0x3b')](db[_0x41ff('0x36')]['rawAttributes']);_0x3a87b0[_0x41ff('0x3a')]=_[_0x41ff('0x3b')](_0x25f051[_0x41ff('0x3a')]);_0x3a87b0[_0x41ff('0x46')]=_[_0x41ff('0x3c')](_0x3a87b0[_0x41ff('0x3e')],_0x3a87b0[_0x41ff('0x3a')]);_0x3f0a2d[_0x41ff('0x3d')]=_[_0x41ff('0x3c')](_0x3a87b0['model'],qs['fields'](_0x25f051['query']['fields']));_0x3f0a2d['attributes']=_0x3f0a2d[_0x41ff('0x3d')][_0x41ff('0x40')]?_0x3f0a2d[_0x41ff('0x3d')]:_0x3a87b0['model'];if(_0x25f051[_0x41ff('0x3a')][_0x41ff('0xad')]){_0x3f0a2d[_0x41ff('0xae')]=[{'all':!![]}];}_0x3f0a2d=_[_0x41ff('0x97')]({},_0x3f0a2d,_0x25f051[_0x41ff('0xaf')]);return db[_0x41ff('0x36')][_0x41ff('0x5f')](_0x3f0a2d)[_0x41ff('0x29')](handleEntityNotFound(_0xbf3ae2,null))['then'](respondWithResult(_0xbf3ae2,null))[_0x41ff('0x34')](handleError(_0xbf3ae2,null));};exports[_0x41ff('0xb0')]=function(_0x47a030,_0x565b58){return db[_0x41ff('0x36')][_0x41ff('0xb0')](_0x47a030['body'],{})[_0x41ff('0x29')](respondWithResult(_0x565b58,0xc9))[_0x41ff('0x34')](handleError(_0x565b58,null));};exports[_0x41ff('0xb1')]=function(_0x4187a5,_0x27f80b){if(_0x4187a5['body']['id']){delete _0x4187a5[_0x41ff('0x72')]['id'];}return db[_0x41ff('0x36')][_0x41ff('0x5f')]({'where':{'id':_0x4187a5[_0x41ff('0xac')]['id']}})['then'](handleEntityNotFound(_0x27f80b,null))[_0x41ff('0x29')](saveUpdates(_0x4187a5[_0x41ff('0x72')],null))[_0x41ff('0x29')](respondWithResult(_0x27f80b,null))['catch'](handleError(_0x27f80b,null));};exports['destroy']=function(_0xd2619f,_0x301db1){return db[_0x41ff('0x36')]['find']({'where':{'id':_0xd2619f[_0x41ff('0xac')]['id']}})[_0x41ff('0x29')](handleEntityNotFound(_0x301db1,null))['then'](removeEntity(_0x301db1,null))['catch'](handleError(_0x301db1,null));};exports[_0x41ff('0xb2')]=function(_0xf692b3,_0x3e3441){return db[_0x41ff('0x36')][_0x41ff('0xb2')]()[_0x41ff('0x29')](respondWithResult(_0x3e3441,null))[_0x41ff('0x34')](handleError(_0x3e3441,null));};exports['addMessage']=function(_0x5c5b6a,_0x260481,_0x44212d){return db[_0x41ff('0xb3')][_0x41ff('0x5f')]({'where':{'id':_0x5c5b6a[_0x41ff('0xac')]['id']}})[_0x41ff('0x29')](handleEntityNotFound(_0x260481,null))[_0x41ff('0x29')](function(_0x34214e){if(_0x34214e){return _0x34214e['addMessage'](_0x5c5b6a['body']['ids'],_[_0x41ff('0xb4')](_0x5c5b6a[_0x41ff('0x72')],[_0x41ff('0xb5'),'id'])||{});}})[_0x41ff('0x29')](respondWithResult(_0x260481,null))['catch'](handleError(_0x260481,null));};exports[_0x41ff('0xb6')]=function(_0x37be64,_0x4a14b9,_0xb44ef2){var _0x21e4bf={'raw':![],'where':{}};var _0x212be9={};var _0x11fd66={'count':0x0,'rows':[]};return db[_0x41ff('0x36')][_0x41ff('0xb7')]({'where':{'id':_0x37be64[_0x41ff('0xac')]['id']}})[_0x41ff('0x29')](handleEntityNotFound(_0x4a14b9,null))['then'](function(_0x27cd34){if(_0x27cd34){_0x212be9[_0x41ff('0x3e')]=_['keys'](db[_0x41ff('0xb3')][_0x41ff('0x37')]);_0x212be9['query']=_[_0x41ff('0x3b')](_0x37be64[_0x41ff('0x3a')]);_0x212be9['filters']=_[_0x41ff('0x3c')](_0x212be9[_0x41ff('0x3e')],_0x212be9[_0x41ff('0x3a')]);_0x21e4bf[_0x41ff('0x3d')]=_['intersection'](_0x212be9[_0x41ff('0x3e')],qs[_0x41ff('0x3f')](_0x37be64['query']['fields']));_0x21e4bf[_0x41ff('0x3d')]=_0x21e4bf[_0x41ff('0x3d')]['length']?_0x21e4bf[_0x41ff('0x3d')]:_0x212be9[_0x41ff('0x3e')];if(!_0x37be64[_0x41ff('0x3a')]['hasOwnProperty'](_0x41ff('0x42'))){_0x21e4bf[_0x41ff('0x21')]=qs[_0x41ff('0x21')](_0x37be64[_0x41ff('0x3a')]['limit']);_0x21e4bf[_0x41ff('0x20')]=qs[_0x41ff('0x20')](_0x37be64[_0x41ff('0x3a')][_0x41ff('0x20')]);}_0x21e4bf[_0x41ff('0x43')]=qs[_0x41ff('0x44')](_0x37be64['query'][_0x41ff('0x44')]);_0x21e4bf['where']=qs[_0x41ff('0x46')](_['pick'](_0x37be64['query'],_0x212be9[_0x41ff('0x46')]));_0x21e4bf[_0x41ff('0x45')][_0x41ff('0xa9')]=_0x27cd34['id'];if(_0x37be64[_0x41ff('0x3a')]['filter']){_0x21e4bf['where']=_[_0x41ff('0x97')](_0x21e4bf[_0x41ff('0x45')],{'$or':_[_0x41ff('0x35')](_0x21e4bf['attributes'],function(_0x840ac4){var _0x4c77cc={};_0x4c77cc[_0x840ac4]={'$like':'%'+_0x37be64['query']['filter']+'%'};return _0x4c77cc;})});}if(_0x37be64[_0x41ff('0x3a')]['$gte']){var _0x5cf462=_0x37be64[_0x41ff('0x3a')]['$gte'][_0x41ff('0x31')](',');var _0x5ce63d={};_0x5ce63d[_0x5cf462[0x0]]={'$gte':moment(_0x5cf462[0x1])[_0x41ff('0xb8')](_0x41ff('0xb9'))};_0x21e4bf[_0x41ff('0x45')]=_['merge'](_0x21e4bf[_0x41ff('0x45')],_0x5ce63d);}_0x21e4bf=_[_0x41ff('0x97')]({},_0x21e4bf,_0x37be64['options']);return db[_0x41ff('0xb3')]['count']({'where':_0x21e4bf[_0x41ff('0x45')]})['then'](function(_0x2df409){_0x11fd66[_0x41ff('0x23')]=_0x2df409;if(_0x37be64[_0x41ff('0x3a')][_0x41ff('0xad')]){_0x21e4bf[_0x41ff('0xae')]=[{'all':!![]}];}return db[_0x41ff('0xb3')][_0x41ff('0xba')](_0x21e4bf);})['then'](function(_0x332343){_0x11fd66[_0x41ff('0xab')]=_0x332343;return _0x11fd66;});}})[_0x41ff('0x29')](respondWithFilteredResult(_0x4a14b9,_0x21e4bf))[_0x41ff('0x34')](handleError(_0x4a14b9,null));};exports[_0x41ff('0xbb')]=function(_0x46af2a,_0x53ac98,_0xc8e316){return db['FaxInteraction'][_0x41ff('0x5f')]({'where':{'id':_0x46af2a[_0x41ff('0xac')]['id']}})[_0x41ff('0x29')](handleEntityNotFound(_0x53ac98,null))['then'](function(_0x5488c1){if(_0x5488c1){return _0x5488c1[_0x41ff('0xbc')](_0x46af2a[_0x41ff('0x72')]['ids'],_['omit'](_0x46af2a[_0x41ff('0x72')],[_0x41ff('0xb5'),'id'])||{})[_0x41ff('0xbd')](function(){return db[_0x41ff('0x6d')][_0x41ff('0xba')]({'attributes':['id','name','color'],'where':{'id':_0x46af2a[_0x41ff('0x72')]['ids']}});})[_0x41ff('0x29')](function(_0x33aff3){socket[_0x41ff('0xbe')](_0x41ff('0xbf'),{'id':Number(_0x46af2a['params']['id']),'tags':_0x33aff3||[]});return{'id':Number(_0x46af2a[_0x41ff('0xac')]['id']),'tags':_0x33aff3||[]};});}})['then'](respondWithResult(_0x53ac98,null))[_0x41ff('0x34')](handleError(_0x53ac98,null));};exports['removeTags']=function(_0x1d634a,_0x1e9c96,_0x4f48e7){return db[_0x41ff('0x36')][_0x41ff('0x5f')]({'where':{'id':_0x1d634a['params']['id']}})[_0x41ff('0x29')](handleEntityNotFound(_0x1e9c96,null))['then'](function(_0x1ab4a1){if(_0x1ab4a1){return _0x1ab4a1['removeTags'](_0x1d634a[_0x41ff('0x3a')][_0x41ff('0xb5')]);}})['then'](respondWithStatusCode(_0x1e9c96,null))[_0x41ff('0x34')](handleError(_0x1e9c96,null));};exports[_0x41ff('0xc0')]=function(_0xd043c,_0x1ad516){var _0x4db1aa=moment()[_0x41ff('0xc1')]()['toString']();var _0x7f1f55=path[_0x41ff('0xc2')](config['root'],_0x41ff('0xc3'),'files',_0x41ff('0xc4'));var _0x54f895=path[_0x41ff('0xc2')](config[_0x41ff('0xc5')],_0x41ff('0xc3'),_0x41ff('0xc6'),_0x41ff('0xc7'));var _0xf24dc1=path[_0x41ff('0xc2')](_0x7f1f55,_0x4db1aa);var _0x81a7f6=util[_0x41ff('0xb8')](_0x41ff('0xc8'),_0xd043c[_0x41ff('0xac')]['id'],_0x4db1aa);var _0x38c213=path[_0x41ff('0xc2')](_0x7f1f55,_0x81a7f6);var _0x2868b7=[];_0x2868b7[_0x41ff('0x33')]({'model':db[_0x41ff('0xc9')],'as':'Attachment','raw':!![]});var _0x4ebd0a=[{'model':db[_0x41ff('0xb3')],'as':_0x41ff('0xca'),'attributes':['id','body',_0x41ff('0x74')],'include':_0x2868b7}];return db['FaxInteraction'][_0x41ff('0x5f')]({'where':{'id':_0xd043c[_0x41ff('0xac')]['id']},'include':_0x4ebd0a})[_0x41ff('0x29')](handleEntityNotFound(_0x1ad516,null))[_0x41ff('0x29')](function(_0xfe9b6a){if(_0xfe9b6a&&_0xfe9b6a[_0x41ff('0xca')]){var _0xd7f697=_0xfe9b6a[_0x41ff('0xcb')]({'plain':!![]});fs[_0x41ff('0xcc')](_0xf24dc1);for(var _0x2ab4d4=0x0;_0x2ab4d4<_0xd7f697[_0x41ff('0xca')][_0x41ff('0x40')];_0x2ab4d4++){var _0x50d2fa=_0xd7f697['Messages'][_0x2ab4d4][_0x41ff('0xc9')];if(_0x50d2fa){var _0x594435=path[_0x41ff('0xc2')](_0x54f895,_0x50d2fa['basename']);if(fs[_0x41ff('0xcd')](_0x594435)){fs[_0x41ff('0xce')](_0x594435)[_0x41ff('0xcf')](fs[_0x41ff('0xd0')](path[_0x41ff('0xc2')](_0xf24dc1,_0x50d2fa[_0x41ff('0xd1')])));}}}return BPromise['resolve']()[_0x41ff('0x29')](function(){return new BPromise(function(_0x5349fd,_0x30ae8c){zipdir(_0xf24dc1,{'saveTo':_0x38c213},function(_0xcaceec,_0x3d4cda){if(_0xcaceec)return _0x30ae8c(_0xcaceec);return _0x5349fd(_0x3d4cda);});})[_0x41ff('0x29')](function(){return new BPromise(function(_0x4c7a5b,_0x29f864){rimraf(_0xf24dc1,function(_0x168f35){if(_0x168f35)_0x29f864(_0x168f35);return _0x4c7a5b();});});})[_0x41ff('0x29')](function(){return _0x1ad516[_0x41ff('0xc0')](_0x38c213,_0x81a7f6,function(_0x301259){if(_0x301259){console[_0x41ff('0xd2')](_0x41ff('0xd3'),_0x301259);}else{fs[_0x41ff('0xd4')](_0x38c213);}});});});}else{return _0x1ad516[_0x41ff('0x1d')](0xc8);}})[_0x41ff('0x34')](handleError(_0x1ad516,null));}; \ No newline at end of file +var _0x3400=['destroy','stack','name','map','TagIds','Tags','forEach','push','index','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','sort','where','filters','pick','select','field','from','tools_tags','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','fax_accounts','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','operator','$substring','split','length','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','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','text','type','some','compact','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','clone','order','contactName','DESC','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','agent','getFaxAccounts','role','sequelize','toString','merge','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','Contact.firstName','c.lastName','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','rows','catch','show','FaxInteraction','includeAll','include','create','params','addMessage','FaxMessage','ids','omit','findOne','FaxInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','options','findAll','addTags','setTags','spread','color','emit','removeTags','download','unix','root','server','files','tmp','join','attachments','Attachment','createdAt','Messages','basename','existsSync','createReadStream','createWriteStream','log','err','unlinkSync','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','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./faxInteraction.socket','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','save','update','then'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3400,0x17b));var _0x0340=function(_0x587fb5,_0x59cb3b){_0x587fb5=_0x587fb5-0x0;var _0x551105=_0x3400[_0x587fb5];return _0x551105;};'use strict';var emlformat=require(_0x0340('0x0'));var rimraf=require(_0x0340('0x1'));var zipdir=require(_0x0340('0x2'));var jsonpatch=require(_0x0340('0x3'));var rp=require(_0x0340('0x4'));var moment=require('moment');var BPromise=require(_0x0340('0x5'));var Mustache=require(_0x0340('0x6'));var util=require(_0x0340('0x7'));var path=require(_0x0340('0x8'));var sox=require('sox');var csv=require(_0x0340('0x9'));var ejs=require(_0x0340('0xa'));var fs=require('fs');var fs_extra=require(_0x0340('0xb'));var _=require(_0x0340('0xc'));var squel=require(_0x0340('0xd'));var crypto=require(_0x0340('0xe'));var jsforce=require(_0x0340('0xf'));var deskjs=require(_0x0340('0x10'));var toCsv=require(_0x0340('0x9'));var querystring=require('querystring');var Papa=require(_0x0340('0x11'));var Redis=require('ioredis');var authService=require(_0x0340('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0340('0x13'));var hardwareService=require(_0x0340('0x14'));var logger=require(_0x0340('0x15'))(_0x0340('0x16'));var utils=require(_0x0340('0x17'));var config=require(_0x0340('0x18'));var licenseUtil=require(_0x0340('0x19'));var db=require(_0x0340('0x1a'))['db'];config[_0x0340('0x1b')]=_['defaults'](config[_0x0340('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x0340('0x1c'))(new Redis(config['redis']));require(_0x0340('0x1d'))['register'](socket);function respondWithStatusCode(_0x57007a,_0x175571){_0x175571=_0x175571||0xcc;return function(_0x3090c0){if(_0x3090c0){return _0x57007a[_0x0340('0x1e')](_0x175571);}return _0x57007a[_0x0340('0x1f')](_0x175571)[_0x0340('0x20')]();};}function respondWithResult(_0x1977e6,_0x54c5ff){_0x54c5ff=_0x54c5ff||0xc8;return function(_0x579536){if(_0x579536){return _0x1977e6[_0x0340('0x1f')](_0x54c5ff)['json'](_0x579536);}};}function respondWithFilteredResult(_0x4811bf,_0x2f303b){return function(_0x2940a1){if(_0x2940a1){var _0x533e78=typeof _0x2f303b[_0x0340('0x21')]===_0x0340('0x22')&&typeof _0x2f303b[_0x0340('0x23')]===_0x0340('0x22');var _0x41579f=_0x2940a1[_0x0340('0x24')];var _0x47c45a=_0x533e78?0x0:_0x2f303b[_0x0340('0x21')];var _0x32a71d=_0x533e78?_0x2940a1[_0x0340('0x24')]:_0x2f303b[_0x0340('0x21')]+_0x2f303b[_0x0340('0x23')];var _0x244ae7;if(_0x32a71d>=_0x41579f){_0x32a71d=_0x41579f;_0x244ae7=0xc8;}else{_0x244ae7=0xce;}_0x4811bf[_0x0340('0x1f')](_0x244ae7);return _0x4811bf[_0x0340('0x25')]('Content-Range',_0x47c45a+'-'+_0x32a71d+'/'+_0x41579f)[_0x0340('0x26')](_0x2940a1);}return null;};}function patchUpdates(_0x40df23){return function(_0x476a4d){try{jsonpatch[_0x0340('0x27')](_0x476a4d,_0x40df23,!![]);}catch(_0x453ead){return BPromise['reject'](_0x453ead);}return _0x476a4d[_0x0340('0x28')]();};}function saveUpdates(_0x336bac,_0x410ad0){return function(_0x54e924){if(_0x54e924){return _0x54e924[_0x0340('0x29')](_0x336bac)[_0x0340('0x2a')](function(_0x2e0dd2){return _0x2e0dd2;});}return null;};}function removeEntity(_0x46252a,_0x3cef60){return function(_0x3141e2){if(_0x3141e2){return _0x3141e2[_0x0340('0x2b')]()['then'](function(){_0x46252a['status'](0xcc)[_0x0340('0x20')]();});}};}function handleEntityNotFound(_0x4acd4c,_0x53e1ae){return function(_0x542a37){if(!_0x542a37){_0x4acd4c[_0x0340('0x1e')](0x194);}return _0x542a37;};}function handleError(_0x2c22a8,_0x4b0216){_0x4b0216=_0x4b0216||0x1f4;return function(_0x1b6532){logger['error'](_0x1b6532[_0x0340('0x2c')]);if(_0x1b6532[_0x0340('0x2d')]){delete _0x1b6532[_0x0340('0x2d')];}_0x2c22a8[_0x0340('0x1f')](_0x4b0216)['send'](_0x1b6532);};}function getInteractionUsers(_0x5eeca7,_0x39e12d){return new BPromise(function(_0x162f81,_0x265b53){try{if(_0x39e12d[_0x5eeca7['id']]){_0x5eeca7['Users']=_[_0x0340('0x2e')](_0x39e12d[_0x5eeca7['id']],function(_0x4cad8d){return{'id':_0x4cad8d['id'],'fullname':_0x4cad8d['fullname']};});}}catch(_0x2b5164){_0x265b53(_0x2b5164);}_0x162f81(_0x5eeca7);});}function getInteractionTags(_0x4146eb,_0x449632){return new BPromise(function(_0x313d6,_0x39d271){try{if(_0x4146eb[_0x0340('0x2f')]){_0x4146eb[_0x0340('0x30')]=[];_0x4146eb[_0x0340('0x2f')]['split'](',')[_0x0340('0x31')](function(_0x5930cc){_0x4146eb['Tags'][_0x0340('0x32')](_0x449632[_0x5930cc]);});}delete _0x4146eb[_0x0340('0x2f')];}catch(_0x3c2981){_0x39d271(_0x3c2981);}_0x313d6(_0x4146eb);});}function updateFaxInteraction(_0x5f0550,_0x2742fa,_0x6c0ff2){return new BPromise(function(_0x4c966f,_0xfe655e){return getInteractionUsers(_0x5f0550,_0x6c0ff2)[_0x0340('0x2a')](function(_0x29b4c7){return getInteractionTags(_0x29b4c7,_0x2742fa);})['then'](function(_0x1518b5){_0x4c966f(_0x1518b5);})['catch'](function(_0x93861b){_0xfe655e(_0x93861b);});});}exports[_0x0340('0x33')]=function(_0x41699c,_0x57aeb7){var _0x58d3b9={},_0xd3cdff={},_0x2d63e0={'count':0x0,'rows':[]};var _0x29775e=_['map'](db['FaxInteraction'][_0x0340('0x34')],function(_0x17a732){return{'name':_0x17a732[_0x0340('0x35')],'type':_0x17a732['type'][_0x0340('0x36')]};});_0xd3cdff[_0x0340('0x37')]=_[_0x0340('0x2e')](_0x29775e,_0x0340('0x2d'));_0xd3cdff[_0x0340('0x38')]=_[_0x0340('0x39')](_0x41699c['query']);_0xd3cdff['filters']=_[_0x0340('0x3a')](_0xd3cdff[_0x0340('0x37')],_0xd3cdff[_0x0340('0x38')]);_0x58d3b9[_0x0340('0x3b')]=_['intersection'](_0xd3cdff['model'],qs[_0x0340('0x3c')](_0x41699c[_0x0340('0x38')][_0x0340('0x3c')]));_0x58d3b9[_0x0340('0x3b')]=_0x58d3b9[_0x0340('0x3b')]['length']?_0x58d3b9[_0x0340('0x3b')]:_0xd3cdff[_0x0340('0x37')];if(!_0x41699c[_0x0340('0x38')][_0x0340('0x3d')]('nolimit')){_0x58d3b9[_0x0340('0x23')]=qs[_0x0340('0x23')](_0x41699c[_0x0340('0x38')]['limit']);_0x58d3b9[_0x0340('0x21')]=qs[_0x0340('0x21')](_0x41699c['query'][_0x0340('0x21')]);}_0x58d3b9['order']=qs[_0x0340('0x3e')](_0x41699c[_0x0340('0x38')][_0x0340('0x3e')]);_0x58d3b9[_0x0340('0x3f')]=qs[_0x0340('0x40')](_[_0x0340('0x41')](_0x41699c[_0x0340('0x38')],_0xd3cdff[_0x0340('0x40')]),_0x29775e);var _0x332f3b=[];var _0x5c6496=squel[_0x0340('0x42')]()[_0x0340('0x43')]('id')['field'](_0x0340('0x2d'))[_0x0340('0x43')]('color')[_0x0340('0x44')](_0x0340('0x45'));var _0x395beb=squel[_0x0340('0x42')]()[_0x0340('0x43')](_0x0340('0x46'))['field'](_0x0340('0x47'))[_0x0340('0x43')](_0x0340('0x48'))[_0x0340('0x44')](_0x0340('0x49'),'ui')[_0x0340('0x4a')](_0x0340('0x4b'),'u',_0x0340('0x4c'));var _0x4560ed=squel[_0x0340('0x42')]()[_0x0340('0x44')](_0x0340('0x4d'),'i')[_0x0340('0x4a')](_0x0340('0x4e'),'c',_0x0340('0x4f'))['left_join'](_0x0340('0x4b'),'o','o.id\x20=\x20i.UserId')['left_join'](_0x0340('0x50'),'a','a.id\x20=\x20i.FaxAccountId')[_0x0340('0x4a')]('fax_messages','me',_0x0340('0x51'))['left_join'](_0x0340('0x52'),'it',_0x0340('0x53'))[_0x0340('0x4a')]('tools_tags','t',_0x0340('0x54'));var _0x307242=squel[_0x0340('0x55')]();var _0x1f9d07=[];var _0x10b43e=squel[_0x0340('0x55')]();var _0x4179e3;if(_0x41699c[_0x0340('0x38')][_0x0340('0x56')]){_0x4179e3=as[_0x0340('0x57')](_0x41699c[_0x0340('0x38')][_0x0340('0x56')]);var _0x3f77ec=_0x4179e3[_0x0340('0x58')];for(var _0x3d7757=0x0;_0x3d7757<_0x4179e3[_0x0340('0x59')]['length'];_0x3d7757++){var _0x5e6f03=_0x4179e3[_0x0340('0x59')][_0x3d7757];var _0x2d711a='i';var _0x376ff2=_[_0x0340('0x5a')](_0x29775e,['name',_0x5e6f03[_0x0340('0x43')]]);if(!_0x376ff2){switch(_0x5e6f03[_0x0340('0x43')]){case _0x0340('0x5b'):if(_0x5e6f03[_0x0340('0x5c')]==0x1){_0x4560ed['having']('`'+_0x5e6f03[_0x0340('0x43')]+_0x0340('0x5d'));}else{_0x4560ed[_0x0340('0x5e')]('`'+_0x5e6f03[_0x0340('0x43')]+_0x0340('0x5f'));}break;case'Contact':if(_0x5e6f03[_0x0340('0x60')]===_0x0340('0x61')){if(_0x5e6f03[_0x0340('0x5c')][_0x0340('0x62')]('\x20')[_0x0340('0x63')]>0x1){_0x307242[_0x3f77ec](_0x0340('0x64'),qs[_0x0340('0x65')](_0x5e6f03[_0x0340('0x5c')]),null);}else{var _0x5c03e1='%'+_0x5e6f03['value']+'%';_0x307242[_0x3f77ec](_0x0340('0x66'),_0x5c03e1,_0x5c03e1,_0x5c03e1);}}else{_0x376ff2=_[_0x0340('0x5a')](_0x29775e,[_0x0340('0x2d'),'ContactId']);_0x5e6f03['field']=_0x0340('0x67');_0x406788=as[_0x0340('0x68')](_0x2d711a,_0x376ff2['type'],_0x5e6f03);_0x307242[_0x3f77ec](_0x406788['text'],_0x406788[_0x0340('0x5c')][_0x0340('0x69')],_0x406788[_0x0340('0x5c')][_0x0340('0x20')]);}break;case _0x0340('0x6a'):var _0x24b243=_0x5e6f03[_0x0340('0x5c')]['split'](',')[_0x0340('0x2e')](function(_0x1f6422){return Number(_0x1f6422);});_0x24b243[_0x0340('0x31')](function(_0x4a6283){_0x10b43e['or'](_0x0340('0x6b'),'%,'+_0x4a6283+',%');});_0x1f9d07=_['union'](_0x1f9d07,_0x24b243);break;case _0x0340('0x6c'):if(_0x5e6f03['operator']===_0x0340('0x61')){_0x307242[_0x3f77ec](_0x0340('0x6d'),'%'+_0x5e6f03[_0x0340('0x5c')]+'%',null);}else{_0x376ff2=_[_0x0340('0x5a')](_0x29775e,[_0x0340('0x2d'),_0x0340('0x6e')]);_0x5e6f03[_0x0340('0x43')]=_0x0340('0x6e');_0x406788=as[_0x0340('0x68')](_0x2d711a,_0x376ff2['type'],_0x5e6f03);_0x307242[_0x3f77ec](_0x406788['text'],_0x406788[_0x0340('0x5c')]['start'],_0x406788[_0x0340('0x5c')][_0x0340('0x20')]);}break;case _0x0340('0x6f'):_0x406788=as[_0x0340('0x68')]('me',null,_0x5e6f03);_0x307242[_0x3f77ec](_0x406788[_0x0340('0x70')],_0x406788[_0x0340('0x5c')][_0x0340('0x69')],_0x406788[_0x0340('0x5c')][_0x0340('0x20')]);break;}}else{var _0x406788=as[_0x0340('0x68')](_0x2d711a,_0x376ff2[_0x0340('0x71')],_0x5e6f03);_0x307242[_0x3f77ec](_0x406788['text'],_0x406788['value']['start'],_0x406788[_0x0340('0x5c')][_0x0340('0x20')]);}}}else{var _0x5d845e=_(_0x41699c[_0x0340('0x38')])[_0x0340('0x39')]()[_0x0340('0x2e')](function(_0x4396ce){return _[_0x0340('0x72')](_0x29775e,['name',_0x4396ce])?_0x4396ce:undefined;})[_0x0340('0x73')]()[_0x0340('0x5c')]();if(!_[_0x0340('0x74')](_0x5d845e)){_0x5d845e[_0x0340('0x31')](function(_0xbdfe3f){if(_0xbdfe3f===_0x0340('0x75')){_0x4560ed['where'](_0x0340('0x76'),[][_0x0340('0x77')](_0x41699c['query'][_0xbdfe3f]));}else if(_0xbdfe3f==='createdAt'){var _0x481922=JSON[_0x0340('0x78')](_0x41699c[_0x0340('0x38')][_0xbdfe3f])['$gte'];var _0x227dd7=JSON[_0x0340('0x78')](_0x41699c[_0x0340('0x38')][_0xbdfe3f])[_0x0340('0x79')];_0x4560ed[_0x0340('0x3f')](_0x0340('0x7a'),_0x481922,_0x227dd7);}else{if(_0x41699c[_0x0340('0x38')][_0xbdfe3f]===_0x0340('0x7b')){_0x4560ed[_0x0340('0x3f')]('i.'+_0xbdfe3f+_0x0340('0x7c'));}else{_0x4560ed[_0x0340('0x3f')]('i.'+_0xbdfe3f+'\x20=\x20?',_0x41699c[_0x0340('0x38')][_0xbdfe3f]);}}});}if(_0x41699c[_0x0340('0x38')][_0x0340('0x7d')]){if(_0x41699c[_0x0340('0x38')]['read']==0x1){_0x4560ed[_0x0340('0x5e')](_0x0340('0x7e'));}else{_0x4560ed[_0x0340('0x5e')](_0x0340('0x7f'));}}if(_0x41699c[_0x0340('0x38')][_0x0340('0x80')]){_0x1f9d07=_['isArray'](_0x41699c[_0x0340('0x38')][_0x0340('0x80')])?_0x41699c[_0x0340('0x38')]['tag']:new Array(_0x41699c[_0x0340('0x38')][_0x0340('0x80')]);_0x1f9d07[_0x0340('0x31')](function(_0x4bc446){_0x10b43e['or'](_0x0340('0x6b'),'%,'+_0x4bc446+',%');});}if(_0x41699c[_0x0340('0x38')]['filter']){var _0x4c3084=_0x41699c[_0x0340('0x38')]['filter'][_0x0340('0x81')]('\x5c','\x5c\x5c')[_0x0340('0x81')](/'/g,'\x27\x27');if(qs[_0x0340('0x82')](_0x4c3084)){_0x307242['or'](_0x0340('0x83'),_0x4c3084+'%')['or'](_0x0340('0x84'),_0x4c3084+'%');}_0x307242['or'](_0x0340('0x85'),_0x4c3084+'%');}}_0x4560ed[_0x0340('0x3f')](_0x307242);_0x4560ed[_0x0340('0x86')](_0x0340('0x87'));var _0x2a9a2c={'type':db[_0x0340('0x88')][_0x0340('0x89')]['SELECT'],'raw':!![]};var _0x1abd61=_0x4560ed[_0x0340('0x8a')]();_0x1abd61[_0x0340('0x43')]('i.id');_0x1abd61['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x58d3b9[_0x0340('0x8b')]){_0x58d3b9[_0x0340('0x8b')][_0x0340('0x31')](function(_0x1f8ae9){var _0x255922=_0x1f8ae9[0x0]===_0x0340('0x8c')?_0x1f8ae9[0x0]:'i.'+_0x1f8ae9[0x0];_0x4560ed['order'](_0x255922,_0x1f8ae9[0x1]===_0x0340('0x8d')?![]:!![]);});}if(!_[_0x0340('0x74')](_0x1f9d07)){_0x4560ed[_0x0340('0x5e')](_0x10b43e);_0x1abd61[_0x0340('0x3f')](_0x0340('0x8e'),_0x1f9d07);}BPromise[_0x0340('0x8f')]()[_0x0340('0x2a')](function(){if(!_0x4179e3){if(_0x41699c[_0x0340('0x38')][_0x0340('0x75')])return;_0x1abd61[_0x0340('0x3f')](_0x0340('0x90'));_0x4560ed[_0x0340('0x3f')](_0x0340('0x90'));return;}if(_0x41699c[_0x0340('0x91')]['role']!==_0x0340('0x92'))return;return _0x41699c[_0x0340('0x91')][_0x0340('0x93')]({'attributes':['id'],'raw':!![]})[_0x0340('0x2a')](function(_0xb59476){if(_[_0x0340('0x74')](_0xb59476)){_0x1abd61[_0x0340('0x3f')]('i.FaxAccountId\x20IS\x20NULL');_0x4560ed['where']('i.FaxAccountId\x20IS\x20NULL');}else{_0x1abd61[_0x0340('0x3f')](_0x0340('0x76'),_[_0x0340('0x2e')](_0xb59476,'id'));_0x4560ed[_0x0340('0x3f')](_0x0340('0x76'),_[_0x0340('0x2e')](_0xb59476,'id'));}});})[_0x0340('0x2a')](function(){if(_0x41699c[_0x0340('0x91')][_0x0340('0x94')]===_0x0340('0x92')&&!_0x4179e3&&!_0x41699c[_0x0340('0x38')][_0x0340('0x75')])return[];return db[_0x0340('0x95')][_0x0340('0x38')](_0x1abd61[_0x0340('0x96')](),_0x2a9a2c);})[_0x0340('0x2a')](function(_0x437c88){_0x2d63e0[_0x0340('0x24')]=_0x437c88['length'];if(_0x2d63e0[_0x0340('0x24')]===0x0)return[];return db[_0x0340('0x95')][_0x0340('0x38')](_0x5c6496[_0x0340('0x96')](),_0x2a9a2c)['then'](function(_0xb3625c){_0x332f3b=_['keyBy'](_0xb3625c,'id');_0x2a9a2c=_[_0x0340('0x97')](_0x2a9a2c,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x41699c[_0x0340('0x38')]['fields']){_0x58d3b9[_0x0340('0x3b')]['forEach'](function(_0x4a66a6){_0x4560ed['field']('i.'+_0x4a66a6);});}else{_0x4560ed['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0340('0x5b'));_0x4560ed[_0x0340('0x43')]('a.key','Account.key');_0x4560ed[_0x0340('0x43')](_0x0340('0x98'),_0x0340('0x99'));_0x4560ed['field'](_0x0340('0x9a'),_0x0340('0x8c'));_0x4560ed['field']('i.*');_0x4560ed[_0x0340('0x43')]('c.firstName',_0x0340('0x9b'));_0x4560ed[_0x0340('0x43')](_0x0340('0x9c'),'Contact.lastName');_0x4560ed[_0x0340('0x43')]('c.email','Contact.email');_0x4560ed[_0x0340('0x43')](_0x0340('0x9d'),_0x0340('0x9e'));_0x4560ed[_0x0340('0x43')](_0x0340('0x9f'),_0x0340('0xa0'));_0x4560ed[_0x0340('0x43')](_0x0340('0xa1'),_0x0340('0xa2'));_0x4560ed[_0x0340('0x43')]('o.fullname',_0x0340('0xa3'));_0x4560ed[_0x0340('0x43')]('o.internal','Owner.internal');_0x4560ed['field'](_0x0340('0xa4'),'TagIds');}if(_0x58d3b9[_0x0340('0x23')])_0x4560ed['limit'](_0x58d3b9[_0x0340('0x23')]);if(_0x58d3b9[_0x0340('0x21')])_0x4560ed[_0x0340('0x21')](_0x58d3b9[_0x0340('0x21')]);return db[_0x0340('0x95')][_0x0340('0x38')](_0x4560ed[_0x0340('0x96')](),_0x2a9a2c);})[_0x0340('0x2a')](function(_0x8093c5){if(_0x8093c5[_0x0340('0x63')]>0x0)_0x395beb[_0x0340('0x3f')](_0x0340('0xa5'),_[_0x0340('0x2e')](_0x8093c5,'id'));return db[_0x0340('0x95')][_0x0340('0x38')](_0x395beb[_0x0340('0x96')](),_0x2a9a2c)[_0x0340('0x2a')](function(_0x5c1c8c){var _0x128196=_[_0x0340('0xa6')](_0x5c1c8c,'FaxInteractionId');var _0x93b8a3=[];_0x8093c5[_0x0340('0x31')](function(_0x563e97){_0x93b8a3[_0x0340('0x32')](updateFaxInteraction(_0x563e97,_0x332f3b,_0x128196));});return BPromise['all'](_0x93b8a3);});});})[_0x0340('0x2a')](function(_0xc54a5a){_0x2d63e0[_0x0340('0xa7')]=_0xc54a5a;return _0x2d63e0;})['then'](respondWithFilteredResult(_0x57aeb7,_0x58d3b9))[_0x0340('0xa8')](handleError(_0x57aeb7,null));};exports[_0x0340('0xa9')]=function(_0x57e63e,_0x35e250){var _0x5514e9={'raw':![],'where':{'id':_0x57e63e['params']['id']}},_0x417903={};_0x417903[_0x0340('0x37')]=_['keys'](db[_0x0340('0xaa')][_0x0340('0x34')]);_0x417903[_0x0340('0x38')]=_['keys'](_0x57e63e[_0x0340('0x38')]);_0x417903[_0x0340('0x40')]=_[_0x0340('0x3a')](_0x417903[_0x0340('0x37')],_0x417903['query']);_0x5514e9[_0x0340('0x3b')]=_['intersection'](_0x417903[_0x0340('0x37')],qs[_0x0340('0x3c')](_0x57e63e[_0x0340('0x38')][_0x0340('0x3c')]));_0x5514e9[_0x0340('0x3b')]=_0x5514e9[_0x0340('0x3b')][_0x0340('0x63')]?_0x5514e9[_0x0340('0x3b')]:_0x417903[_0x0340('0x37')];if(_0x57e63e['query'][_0x0340('0xab')]){_0x5514e9[_0x0340('0xac')]=[{'all':!![]}];}_0x5514e9=_[_0x0340('0x97')]({},_0x5514e9,_0x57e63e['options']);return db['FaxInteraction'][_0x0340('0x5a')](_0x5514e9)['then'](handleEntityNotFound(_0x35e250,null))[_0x0340('0x2a')](respondWithResult(_0x35e250,null))['catch'](handleError(_0x35e250,null));};exports[_0x0340('0xad')]=function(_0x5eb440,_0x3f2459){return db[_0x0340('0xaa')]['create'](_0x5eb440[_0x0340('0x6f')],{})[_0x0340('0x2a')](respondWithResult(_0x3f2459,0xc9))[_0x0340('0xa8')](handleError(_0x3f2459,null));};exports['update']=function(_0xbcedd4,_0x53c3c5){if(_0xbcedd4[_0x0340('0x6f')]['id']){delete _0xbcedd4[_0x0340('0x6f')]['id'];}return db[_0x0340('0xaa')][_0x0340('0x5a')]({'where':{'id':_0xbcedd4[_0x0340('0xae')]['id']}})[_0x0340('0x2a')](handleEntityNotFound(_0x53c3c5,null))['then'](saveUpdates(_0xbcedd4[_0x0340('0x6f')],null))[_0x0340('0x2a')](respondWithResult(_0x53c3c5,null))[_0x0340('0xa8')](handleError(_0x53c3c5,null));};exports[_0x0340('0x2b')]=function(_0x388d7e,_0x164694){return db['FaxInteraction'][_0x0340('0x5a')]({'where':{'id':_0x388d7e['params']['id']}})[_0x0340('0x2a')](handleEntityNotFound(_0x164694,null))[_0x0340('0x2a')](removeEntity(_0x164694,null))[_0x0340('0xa8')](handleError(_0x164694,null));};exports['describe']=function(_0x4e0733,_0x1220a7){return db['FaxInteraction']['describe']()[_0x0340('0x2a')](respondWithResult(_0x1220a7,null))[_0x0340('0xa8')](handleError(_0x1220a7,null));};exports[_0x0340('0xaf')]=function(_0x41c995,_0x2fae9b,_0x2a29aa){return db[_0x0340('0xb0')]['find']({'where':{'id':_0x41c995[_0x0340('0xae')]['id']}})[_0x0340('0x2a')](handleEntityNotFound(_0x2fae9b,null))[_0x0340('0x2a')](function(_0x4ee15d){if(_0x4ee15d){return _0x4ee15d[_0x0340('0xaf')](_0x41c995[_0x0340('0x6f')][_0x0340('0xb1')],_[_0x0340('0xb2')](_0x41c995[_0x0340('0x6f')],[_0x0340('0xb1'),'id'])||{});}})[_0x0340('0x2a')](respondWithResult(_0x2fae9b,null))['catch'](handleError(_0x2fae9b,null));};exports['getMessages']=function(_0xb6c099,_0x4f9b6e,_0x380650){var _0x3ca709={'raw':![],'where':{}};var _0x321ed2={};var _0x49a8d2={'count':0x0,'rows':[]};return db[_0x0340('0xaa')][_0x0340('0xb3')]({'where':{'id':_0xb6c099[_0x0340('0xae')]['id']}})['then'](handleEntityNotFound(_0x4f9b6e,null))['then'](function(_0x3bb029){if(_0x3bb029){_0x321ed2[_0x0340('0x37')]=_['keys'](db[_0x0340('0xb0')][_0x0340('0x34')]);_0x321ed2['query']=_[_0x0340('0x39')](_0xb6c099[_0x0340('0x38')]);_0x321ed2[_0x0340('0x40')]=_[_0x0340('0x3a')](_0x321ed2['model'],_0x321ed2['query']);_0x3ca709['attributes']=_[_0x0340('0x3a')](_0x321ed2[_0x0340('0x37')],qs[_0x0340('0x3c')](_0xb6c099[_0x0340('0x38')][_0x0340('0x3c')]));_0x3ca709[_0x0340('0x3b')]=_0x3ca709[_0x0340('0x3b')]['length']?_0x3ca709['attributes']:_0x321ed2[_0x0340('0x37')];if(!_0xb6c099['query'][_0x0340('0x3d')]('nolimit')){_0x3ca709['limit']=qs[_0x0340('0x23')](_0xb6c099[_0x0340('0x38')][_0x0340('0x23')]);_0x3ca709[_0x0340('0x21')]=qs[_0x0340('0x21')](_0xb6c099[_0x0340('0x38')]['offset']);}_0x3ca709[_0x0340('0x8b')]=qs[_0x0340('0x3e')](_0xb6c099[_0x0340('0x38')]['sort']);_0x3ca709[_0x0340('0x3f')]=qs['filters'](_['pick'](_0xb6c099[_0x0340('0x38')],_0x321ed2['filters']));_0x3ca709[_0x0340('0x3f')][_0x0340('0xb4')]=_0x3bb029['id'];if(_0xb6c099[_0x0340('0x38')][_0x0340('0xb5')]){_0x3ca709[_0x0340('0x3f')]=_['merge'](_0x3ca709['where'],{'$or':_[_0x0340('0x2e')](_0x3ca709[_0x0340('0x3b')],function(_0x245a2a){var _0x267230={};_0x267230[_0x245a2a]={'$like':'%'+_0xb6c099[_0x0340('0x38')]['filter']+'%'};return _0x267230;})});}if(_0xb6c099[_0x0340('0x38')][_0x0340('0xb6')]){var _0x5f507c=_0xb6c099[_0x0340('0x38')][_0x0340('0xb6')]['split'](',');var _0x1d33ff={};_0x1d33ff[_0x5f507c[0x0]]={'$gte':moment(_0x5f507c[0x1])[_0x0340('0xb7')](_0x0340('0xb8'))};_0x3ca709[_0x0340('0x3f')]=_[_0x0340('0x97')](_0x3ca709[_0x0340('0x3f')],_0x1d33ff);}_0x3ca709=_[_0x0340('0x97')]({},_0x3ca709,_0xb6c099[_0x0340('0xb9')]);return db['FaxMessage']['count']({'where':_0x3ca709[_0x0340('0x3f')]})[_0x0340('0x2a')](function(_0x3e92d0){_0x49a8d2['count']=_0x3e92d0;if(_0xb6c099[_0x0340('0x38')][_0x0340('0xab')]){_0x3ca709['include']=[{'all':!![]}];}return db['FaxMessage'][_0x0340('0xba')](_0x3ca709);})[_0x0340('0x2a')](function(_0x3bfbfd){_0x49a8d2[_0x0340('0xa7')]=_0x3bfbfd;return _0x49a8d2;});}})['then'](respondWithFilteredResult(_0x4f9b6e,_0x3ca709))[_0x0340('0xa8')](handleError(_0x4f9b6e,null));};exports[_0x0340('0xbb')]=function(_0x44fd28,_0x26a961,_0x35bda5){return db[_0x0340('0xaa')][_0x0340('0x5a')]({'where':{'id':_0x44fd28[_0x0340('0xae')]['id']}})[_0x0340('0x2a')](handleEntityNotFound(_0x26a961,null))['then'](function(_0xa31ca2){if(_0xa31ca2){return _0xa31ca2[_0x0340('0xbc')](_0x44fd28[_0x0340('0x6f')][_0x0340('0xb1')],_[_0x0340('0xb2')](_0x44fd28[_0x0340('0x6f')],[_0x0340('0xb1'),'id'])||{})[_0x0340('0xbd')](function(){return db[_0x0340('0x6a')]['findAll']({'attributes':['id','name',_0x0340('0xbe')],'where':{'id':_0x44fd28[_0x0340('0x6f')][_0x0340('0xb1')]}});})[_0x0340('0x2a')](function(_0x3020a8){socket[_0x0340('0xbf')]('faxInteractionTags:save',{'id':Number(_0x44fd28[_0x0340('0xae')]['id']),'tags':_0x3020a8||[]});return{'id':Number(_0x44fd28[_0x0340('0xae')]['id']),'tags':_0x3020a8||[]};});}})['then'](respondWithResult(_0x26a961,null))[_0x0340('0xa8')](handleError(_0x26a961,null));};exports[_0x0340('0xc0')]=function(_0x51e231,_0x207020,_0xe1bb0a){return db[_0x0340('0xaa')][_0x0340('0x5a')]({'where':{'id':_0x51e231[_0x0340('0xae')]['id']}})['then'](handleEntityNotFound(_0x207020,null))[_0x0340('0x2a')](function(_0x306676){if(_0x306676){return _0x306676[_0x0340('0xc0')](_0x51e231[_0x0340('0x38')][_0x0340('0xb1')]);}})[_0x0340('0x2a')](respondWithStatusCode(_0x207020,null))['catch'](handleError(_0x207020,null));};exports[_0x0340('0xc1')]=function(_0x579fe3,_0x5bb834){var _0x341a0a=moment()[_0x0340('0xc2')]()[_0x0340('0x96')]();var _0x5cf5c9=path['join'](config[_0x0340('0xc3')],_0x0340('0xc4'),_0x0340('0xc5'),_0x0340('0xc6'));var _0x399130=path[_0x0340('0xc7')](config[_0x0340('0xc3')],'server','files',_0x0340('0xc8'));var _0x432c70=path[_0x0340('0xc7')](_0x5cf5c9,_0x341a0a);var _0x2552d9=util[_0x0340('0xb7')]('transcript-%d-%s.zip',_0x579fe3[_0x0340('0xae')]['id'],_0x341a0a);var _0x3bfe34=path[_0x0340('0xc7')](_0x5cf5c9,_0x2552d9);var _0x461cd0=[];_0x461cd0[_0x0340('0x32')]({'model':db[_0x0340('0xc9')],'as':_0x0340('0xc9'),'raw':!![]});var _0x4aa951=[{'model':db[_0x0340('0xb0')],'as':'Messages','attributes':['id','body',_0x0340('0xca')],'include':_0x461cd0}];return db[_0x0340('0xaa')][_0x0340('0x5a')]({'where':{'id':_0x579fe3[_0x0340('0xae')]['id']},'include':_0x4aa951})['then'](handleEntityNotFound(_0x5bb834,null))['then'](function(_0x3a8f75){if(_0x3a8f75&&_0x3a8f75[_0x0340('0xcb')]){var _0x584f8b=_0x3a8f75['get']({'plain':!![]});fs['mkdirSync'](_0x432c70);for(var _0x1a7588=0x0;_0x1a7588<_0x584f8b[_0x0340('0xcb')]['length'];_0x1a7588++){var _0x783bf2=_0x584f8b['Messages'][_0x1a7588][_0x0340('0xc9')];if(_0x783bf2){var _0x289733=path[_0x0340('0xc7')](_0x399130,_0x783bf2[_0x0340('0xcc')]);if(fs[_0x0340('0xcd')](_0x289733)){fs[_0x0340('0xce')](_0x289733)['pipe'](fs[_0x0340('0xcf')](path[_0x0340('0xc7')](_0x432c70,_0x783bf2[_0x0340('0xcc')])));}}}return BPromise[_0x0340('0x8f')]()['then'](function(){return new BPromise(function(_0x45e271,_0x2db7f7){zipdir(_0x432c70,{'saveTo':_0x3bfe34},function(_0x372899,_0x40f14f){if(_0x372899)return _0x2db7f7(_0x372899);return _0x45e271(_0x40f14f);});})['then'](function(){return new BPromise(function(_0x35733a,_0x2d9e9e){rimraf(_0x432c70,function(_0x1cfc63){if(_0x1cfc63)_0x2d9e9e(_0x1cfc63);return _0x35733a();});});})[_0x0340('0x2a')](function(){return _0x5bb834[_0x0340('0xc1')](_0x3bfe34,_0x2552d9,function(_0x8c589){if(_0x8c589){console[_0x0340('0xd0')](_0x0340('0xd1'),_0x8c589);}else{fs[_0x0340('0xd2')](_0x3bfe34);}});});});}else{return _0x5bb834[_0x0340('0x1e')](0xc8);}})[_0x0340('0xa8')](handleError(_0x5bb834,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 9803b6b..7f26b34 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 _0x5f59=['emit','catch','exports','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update','getUsers','setDataValue','Users','findAll','then','length'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5f59,0x9d));var _0x95f5=function(_0x4a5d5f,_0x3b92ff){_0x4a5d5f=_0x4a5d5f-0x0;var _0x3e24bf=_0x5f59[_0x4a5d5f];return _0x3e24bf;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x95f5('0x0'))['db'][_0x95f5('0x1')];var FaxMessage=require(_0x95f5('0x0'))['db'][_0x95f5('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x95f5('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x95f5('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5e618d){return function(_0x4b9440,_0x2fb8b9,_0x5db96a){_0x4b9440[_0x95f5('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x6fc4c){_0x4b9440[_0x95f5('0x6')](_0x95f5('0x7'),_0x6fc4c['map'](function(_0x4159c5){return{'id':_0x4159c5['id']};}));return FaxMessage[_0x95f5('0x8')]({'where':{'FaxInteractionId':_0x4b9440['id'],'direction':'in','read':![]},'raw':!![]});})[_0x95f5('0x9')](function(_0x4231ce){_0x4b9440['setDataValue']('unreadMessages',_0x4231ce[_0x95f5('0xa')]);FaxInteractionEvents[_0x95f5('0xb')](_0x5e618d+':'+_0x4b9440['id'],_0x4b9440);FaxInteractionEvents[_0x95f5('0xb')](_0x5e618d,_0x4b9440);_0x5db96a(null);})[_0x95f5('0xc')](_0x5db96a(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x95f5('0xd')]=FaxInteractionEvents; \ No newline at end of file +var _0xefc0=['Users','map','findAll','setDataValue','unreadMessages','emit','catch','hook','exports','events','../../mysqldb','FaxInteraction','update','then'];(function(_0xa8b370,_0x2b77db){var _0x643e37=function(_0x1486eb){while(--_0x1486eb){_0xa8b370['push'](_0xa8b370['shift']());}};_0x643e37(++_0x2b77db);}(_0xefc0,0xf7));var _0x0efc=function(_0x58bede,_0x5d068a){_0x58bede=_0x58bede-0x0;var _0x1527f4=_0xefc0[_0x58bede];return _0x1527f4;};'use strict';var EventEmitter=require(_0x0efc('0x0'));var FaxInteraction=require(_0x0efc('0x1'))['db'][_0x0efc('0x2')];var FaxMessage=require(_0x0efc('0x1'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x0efc('0x3'),'afterDestroy':'remove'};function emitEvent(_0x71f9a4){return function(_0x2ef0fc,_0x1ca605,_0x43169f){_0x2ef0fc['getUsers']({'attributes':['id'],'raw':!![]})[_0x0efc('0x4')](function(_0x4e5397){_0x2ef0fc['setDataValue'](_0x0efc('0x5'),_0x4e5397[_0x0efc('0x6')](function(_0x10c076){return{'id':_0x10c076['id']};}));return FaxMessage[_0x0efc('0x7')]({'where':{'FaxInteractionId':_0x2ef0fc['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0efc('0x4')](function(_0x5b8fb4){_0x2ef0fc[_0x0efc('0x8')](_0x0efc('0x9'),_0x5b8fb4['length']);FaxInteractionEvents[_0x0efc('0xa')](_0x71f9a4+':'+_0x2ef0fc['id'],_0x2ef0fc);FaxInteractionEvents[_0x0efc('0xa')](_0x71f9a4,_0x2ef0fc);_0x43169f(null);})[_0x0efc('0xb')](_0x43169f(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0x0efc('0xc')](e,emitEvent(event));}}module[_0x0efc('0xd')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 554d93b..b1e4ba7 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 _0xda15=['exports','define','FaxInteraction','fax_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./faxInteraction.attributes'];(function(_0x5558a6,_0x4f8e14){var _0x26f2a8=function(_0x5499ca){while(--_0x5499ca){_0x5558a6['push'](_0x5558a6['shift']());}};_0x26f2a8(++_0x4f8e14);}(_0xda15,0xf8));var _0x5da1=function(_0x5c2914,_0x491a2a){_0x5c2914=_0x5c2914-0x0;var _0x4e9f85=_0xda15[_0x5c2914];return _0x4e9f85;};'use strict';var _=require(_0x5da1('0x0'));var util=require('util');var logger=require(_0x5da1('0x1'))(_0x5da1('0x2'));var moment=require('moment');var BPromise=require(_0x5da1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5da1('0x4'));var rimraf=require(_0x5da1('0x5'));var config=require(_0x5da1('0x6'));var attributes=require(_0x5da1('0x7'));module[_0x5da1('0x8')]=function(_0x42f0cd,_0x3ac798){return _0x42f0cd[_0x5da1('0x9')](_0x5da1('0xa'),attributes,{'tableName':_0x5da1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x40e9e1,_0x889b67,_0x43ef54){if(_0x40e9e1[_0x5da1('0xc')](_0x5da1('0xd'))){_0x40e9e1[_0x5da1('0xe')]=moment()['format'](_0x5da1('0xf'));}_0x43ef54(null,_0x40e9e1);}}});}; \ No newline at end of file +var _0xb8d1=['closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions'];(function(_0x58a2eb,_0x43fc84){var _0x256a96=function(_0x275de6){while(--_0x275de6){_0x58a2eb['push'](_0x58a2eb['shift']());}};_0x256a96(++_0x43fc84);}(_0xb8d1,0xdb));var _0x1b8d=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0xb8d1[_0x2112d4];return _0x434972;};'use strict';var _=require(_0x1b8d('0x0'));var util=require(_0x1b8d('0x1'));var logger=require(_0x1b8d('0x2'))(_0x1b8d('0x3'));var moment=require(_0x1b8d('0x4'));var BPromise=require(_0x1b8d('0x5'));var rp=require(_0x1b8d('0x6'));var fs=require('fs');var path=require(_0x1b8d('0x7'));var rimraf=require(_0x1b8d('0x8'));var config=require(_0x1b8d('0x9'));var attributes=require(_0x1b8d('0xa'));module[_0x1b8d('0xb')]=function(_0x5e6b68,_0x5a149b){return _0x5e6b68[_0x1b8d('0xc')](_0x1b8d('0xd'),attributes,{'tableName':_0x1b8d('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x12c984,_0x394767,_0xb475d4){if(_0x12c984['changed']('closed')){_0x12c984[_0x1b8d('0xf')]=moment()[_0x1b8d('0x10')](_0x1b8d('0x11'));}_0xb475d4(null,_0x12c984);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 715f1a0..98d620a 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 _0x7baa=['options','raw','where','attributes','limit','catch','FaxInteraction','ids','omit','AddTags','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','code','error','message','result','UpdateFaxInteraction','update','body'];(function(_0x5ddeed,_0x33ce70){var _0x27b4b5=function(_0x145e99){while(--_0x145e99){_0x5ddeed['push'](_0x5ddeed['shift']());}};_0x27b4b5(++_0x33ce70);}(_0x7baa,0x14b));var _0xa7ba=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x7baa[_0x47e7cb];return _0x2a8874;};'use strict';var _=require(_0xa7ba('0x0'));var util=require(_0xa7ba('0x1'));var moment=require(_0xa7ba('0x2'));var BPromise=require(_0xa7ba('0x3'));var rs=require(_0xa7ba('0x4'));var fs=require('fs');var Redis=require(_0xa7ba('0x5'));var db=require(_0xa7ba('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xa7ba('0x7'))('rpc');var config=require(_0xa7ba('0x8'));var jayson=require(_0xa7ba('0x9'));var client=jayson[_0xa7ba('0xa')][_0xa7ba('0xb')]({'port':0x232a});config[_0xa7ba('0xc')]=_['defaults'](config[_0xa7ba('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xa7ba('0xd'))(new Redis(config['redis']));require(_0xa7ba('0xe'))[_0xa7ba('0xf')](socket);function respondWithRpcPromise(_0x3efd72,_0x1b54d6,_0x3bcf53){return new BPromise(function(_0xb75e78,_0x4cf1d9){return client[_0xa7ba('0x10')](_0x3efd72,_0x3bcf53)[_0xa7ba('0x11')](function(_0xf27bd1){logger[_0xa7ba('0x12')](_0xa7ba('0x13'),_0x1b54d6,_0xa7ba('0x14'));logger[_0xa7ba('0x15')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x1b54d6,'request\x20sent',JSON['stringify'](_0xf27bd1));if(_0xf27bd1['error']){if(_0xf27bd1['error'][_0xa7ba('0x16')]===0x1f4){logger['error'](_0xa7ba('0x13'),_0x1b54d6,_0xf27bd1[_0xa7ba('0x17')][_0xa7ba('0x18')]);return _0x4cf1d9(_0xf27bd1[_0xa7ba('0x17')][_0xa7ba('0x18')]);}logger[_0xa7ba('0x17')](_0xa7ba('0x13'),_0x1b54d6,_0xf27bd1['error'][_0xa7ba('0x18')]);return _0xb75e78(_0xf27bd1[_0xa7ba('0x17')][_0xa7ba('0x18')]);}else{logger['info'](_0xa7ba('0x13'),_0x1b54d6,_0xa7ba('0x14'));_0xb75e78(_0xf27bd1[_0xa7ba('0x19')][_0xa7ba('0x18')]);}})['catch'](function(_0x258d39){logger[_0xa7ba('0x17')](_0xa7ba('0x13'),_0x1b54d6,_0x258d39);_0x4cf1d9(_0x258d39);});});}exports[_0xa7ba('0x1a')]=function(_0x4b977b){var _0x2885bc=this;return new Promise(function(_0x177c7c,_0x2560d1){return db['FaxInteraction'][_0xa7ba('0x1b')](_0x4b977b[_0xa7ba('0x1c')],{'raw':_0x4b977b[_0xa7ba('0x1d')]?_0x4b977b['options'][_0xa7ba('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b977b['options']?_0x4b977b[_0xa7ba('0x1d')][_0xa7ba('0x1f')]||null:null,'attributes':_0x4b977b[_0xa7ba('0x1d')]?_0x4b977b[_0xa7ba('0x1d')][_0xa7ba('0x20')]||null:null,'limit':_0x4b977b['options']?_0x4b977b['options'][_0xa7ba('0x21')]||null:null})['then'](function(_0x364ab9){logger[_0xa7ba('0x12')](_0xa7ba('0x1a'),_0x4b977b);logger['debug']('UpdateFaxInteraction',_0x4b977b,JSON['stringify'](_0x364ab9));_0x177c7c(_0x364ab9);})[_0xa7ba('0x22')](function(_0x57bb11){logger[_0xa7ba('0x17')](_0xa7ba('0x1a'),_0x57bb11['message'],_0x4b977b);_0x2560d1(_0x2885bc[_0xa7ba('0x17')](0x1f4,_0x57bb11['message']));});});};exports['AddTagsToFaxInteraction']=function(_0x5a1e60){return new Promise(function(_0x3ed5e7,_0x1be3f9){return db[_0xa7ba('0x23')]['find']({'where':_0x5a1e60[_0xa7ba('0x1d')]?_0x5a1e60[_0xa7ba('0x1d')]['where']||null:null})[_0xa7ba('0x11')](function(_0x537012){if(_0x537012){return _0x537012['addTags'](_0x5a1e60[_0xa7ba('0x1c')][_0xa7ba('0x24')],_[_0xa7ba('0x25')](_0x5a1e60[_0xa7ba('0x1c')],['ids','id'])||{});}})['spread'](function(_0x25fb60){logger['info'](_0xa7ba('0x26'),_0x5a1e60);logger[_0xa7ba('0x15')](_0xa7ba('0x26'),_0x5a1e60,JSON[_0xa7ba('0x27')](_0x25fb60));_0x3ed5e7(_0x25fb60);})[_0xa7ba('0x22')](function(_0xf74f13){logger[_0xa7ba('0x17')](_0xa7ba('0x26'),_0xf74f13[_0xa7ba('0x18')],_0x5a1e60);_0x1be3f9(_this[_0xa7ba('0x17')](0x1f4,_0xf74f13[_0xa7ba('0x18')]));});});}; \ No newline at end of file +var _0xf74e=['AddTagsToFaxInteraction','FaxInteraction','addTags','ids','omit','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','redis','defaults','localhost','./faxInteraction.socket','register','info','FaxInteraction,\x20%s,\x20%s','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','update','body','options','raw','where','attributes','limit','UpdateFaxInteraction'];(function(_0x34f616,_0x12276f){var _0x110ed0=function(_0x3d25e9){while(--_0x3d25e9){_0x34f616['push'](_0x34f616['shift']());}};_0x110ed0(++_0x12276f);}(_0xf74e,0x11f));var _0xef74=function(_0x2735b2,_0x46aeed){_0x2735b2=_0x2735b2-0x0;var _0x3b62a9=_0xf74e[_0x2735b2];return _0x3b62a9;};'use strict';var _=require('lodash');var util=require(_0xef74('0x0'));var moment=require(_0xef74('0x1'));var BPromise=require(_0xef74('0x2'));var rs=require(_0xef74('0x3'));var fs=require('fs');var Redis=require(_0xef74('0x4'));var db=require(_0xef74('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xef74('0x6'));var config=require('../../config/environment');var jayson=require(_0xef74('0x7'));var client=jayson[_0xef74('0x8')][_0xef74('0x9')]({'port':0x232a});config[_0xef74('0xa')]=_[_0xef74('0xb')](config[_0xef74('0xa')],{'host':_0xef74('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xef74('0xa')]));require(_0xef74('0xd'))[_0xef74('0xe')](socket);function respondWithRpcPromise(_0x494e36,_0x3433d6,_0x4aa8ae){return new BPromise(function(_0x33d1fb,_0x5580f9){return client['request'](_0x494e36,_0x4aa8ae)['then'](function(_0x1b6167){logger[_0xef74('0xf')](_0xef74('0x10'),_0x3433d6,'request\x20sent');logger[_0xef74('0x11')](_0xef74('0x12'),_0x3433d6,_0xef74('0x13'),JSON[_0xef74('0x14')](_0x1b6167));if(_0x1b6167[_0xef74('0x15')]){if(_0x1b6167['error'][_0xef74('0x16')]===0x1f4){logger[_0xef74('0x15')](_0xef74('0x10'),_0x3433d6,_0x1b6167[_0xef74('0x15')][_0xef74('0x17')]);return _0x5580f9(_0x1b6167['error'][_0xef74('0x17')]);}logger[_0xef74('0x15')](_0xef74('0x10'),_0x3433d6,_0x1b6167[_0xef74('0x15')]['message']);return _0x33d1fb(_0x1b6167[_0xef74('0x15')]['message']);}else{logger['info'](_0xef74('0x10'),_0x3433d6,_0xef74('0x13'));_0x33d1fb(_0x1b6167['result'][_0xef74('0x17')]);}})[_0xef74('0x18')](function(_0x574a7d){logger['error'](_0xef74('0x10'),_0x3433d6,_0x574a7d);_0x5580f9(_0x574a7d);});});}exports['UpdateFaxInteraction']=function(_0x50a7ff){var _0x714961=this;return new Promise(function(_0x1b79cc,_0xf1386b){return db['FaxInteraction'][_0xef74('0x19')](_0x50a7ff[_0xef74('0x1a')],{'raw':_0x50a7ff[_0xef74('0x1b')]?_0x50a7ff[_0xef74('0x1b')][_0xef74('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50a7ff[_0xef74('0x1b')]?_0x50a7ff[_0xef74('0x1b')][_0xef74('0x1d')]||null:null,'attributes':_0x50a7ff[_0xef74('0x1b')]?_0x50a7ff[_0xef74('0x1b')][_0xef74('0x1e')]||null:null,'limit':_0x50a7ff[_0xef74('0x1b')]?_0x50a7ff[_0xef74('0x1b')][_0xef74('0x1f')]||null:null})['then'](function(_0x268700){logger['info']('UpdateFaxInteraction',_0x50a7ff);logger[_0xef74('0x11')]('UpdateFaxInteraction',_0x50a7ff,JSON['stringify'](_0x268700));_0x1b79cc(_0x268700);})['catch'](function(_0x37fe2c){logger['error'](_0xef74('0x20'),_0x37fe2c[_0xef74('0x17')],_0x50a7ff);_0xf1386b(_0x714961[_0xef74('0x15')](0x1f4,_0x37fe2c[_0xef74('0x17')]));});});};exports[_0xef74('0x21')]=function(_0x53a5a1){return new Promise(function(_0x27bc98,_0x235fb3){return db[_0xef74('0x22')]['find']({'where':_0x53a5a1[_0xef74('0x1b')]?_0x53a5a1[_0xef74('0x1b')][_0xef74('0x1d')]||null:null})['then'](function(_0x5f343f){if(_0x5f343f){return _0x5f343f[_0xef74('0x23')](_0x53a5a1['body'][_0xef74('0x24')],_[_0xef74('0x25')](_0x53a5a1['body'],['ids','id'])||{});}})[_0xef74('0x26')](function(_0x54cc8d){logger[_0xef74('0xf')](_0xef74('0x27'),_0x53a5a1);logger[_0xef74('0x11')](_0xef74('0x27'),_0x53a5a1,JSON[_0xef74('0x14')](_0x54cc8d));_0x27bc98(_0x54cc8d);})[_0xef74('0x18')](function(_0x3fae21){logger[_0xef74('0x15')]('AddTags',_0x3fae21[_0xef74('0x17')],_0x53a5a1);_0x235fb3(_this[_0xef74('0x15')](0x1f4,_0x3fae21['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 0ee29cf..f67ba16 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 _0x1ff7=['length','faxInteraction:','./faxInteraction.events','save','update','emit','removeListener'];(function(_0x4370c7,_0x5dbfb0){var _0xce78a9=function(_0x157b2c){while(--_0x157b2c){_0x4370c7['push'](_0x4370c7['shift']());}};_0xce78a9(++_0x5dbfb0);}(_0x1ff7,0x175));var _0x71ff=function(_0x573c8c,_0x2ef34d){_0x573c8c=_0x573c8c-0x0;var _0x4200a2=_0x1ff7[_0x573c8c];return _0x4200a2;};'use strict';var FaxInteractionEvents=require(_0x71ff('0x0'));var events=[_0x71ff('0x1'),'remove',_0x71ff('0x2')];function createListener(_0x1bfbe9,_0x7f3a27){return function(_0x81669e){_0x7f3a27[_0x71ff('0x3')](_0x1bfbe9,_0x81669e);};}function removeListener(_0x179c68,_0x5baf8c){return function(){FaxInteractionEvents[_0x71ff('0x4')](_0x179c68,_0x5baf8c);};}exports['register']=function(_0x3a8cc9){for(var _0x5d6ef8=0x0,_0x3aa06f=events[_0x71ff('0x5')];_0x5d6ef8<_0x3aa06f;_0x5d6ef8++){var _0x3fa9e5=events[_0x5d6ef8];var _0x5ed4a8=createListener(_0x71ff('0x6')+_0x3fa9e5,_0x3a8cc9);FaxInteractionEvents['on'](_0x3fa9e5,_0x5ed4a8);}}; \ No newline at end of file +var _0xd24f=['register','faxInteraction:','save','remove','emit','removeListener'];(function(_0x132fb6,_0x7a257b){var _0x2ca9d5=function(_0x490d53){while(--_0x490d53){_0x132fb6['push'](_0x132fb6['shift']());}};_0x2ca9d5(++_0x7a257b);}(_0xd24f,0x164));var _0xfd24=function(_0x113876,_0x2d243d){_0x113876=_0x113876-0x0;var _0x3da554=_0xd24f[_0x113876];return _0x3da554;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0xfd24('0x0'),_0xfd24('0x1'),'update'];function createListener(_0x281911,_0x2ada3a){return function(_0x3db815){_0x2ada3a[_0xfd24('0x2')](_0x281911,_0x3db815);};}function removeListener(_0x488208,_0x2cca22){return function(){FaxInteractionEvents[_0xfd24('0x3')](_0x488208,_0x2cca22);};}exports[_0xfd24('0x4')]=function(_0x1a43aa){for(var _0x327460=0x0,_0x293123=events['length'];_0x327460<_0x293123;_0x327460++){var _0x1fa26f=events[_0x327460];var _0x6dad6=createListener(_0xfd24('0x5')+_0x1fa26f,_0x1a43aa);FaxInteractionEvents['on'](_0x1fa26f,_0x6dad6);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 26e601a..cc7e82e 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 _0xc290=['Router','fs-extra','../../components/interaction/service','./faxInteraction.controller','isAuthenticated','get','/describe','describe','show','/:id/messages','/:id/download','download','post','addMessage','tracked','fax','faxinteraction:addtags','put','/:id','faxinteraction:update','delete','faxinteraction:destroy','destroy','removeTags','exports','multer','util','connect-timeout'];(function(_0x299c44,_0x498795){var _0x228fda=function(_0x2f87be){while(--_0x2f87be){_0x299c44['push'](_0x299c44['shift']());}};_0x228fda(++_0x498795);}(_0xc290,0x185));var _0x0c29=function(_0x12954a,_0x304691){_0x12954a=_0x12954a-0x0;var _0x5ccde2=_0xc290[_0x12954a];return _0x5ccde2;};'use strict';var multer=require(_0x0c29('0x0'));var util=require(_0x0c29('0x1'));var path=require('path');var timeout=require(_0x0c29('0x2'));var express=require('express');var router=express[_0x0c29('0x3')]();var fs_extra=require(_0x0c29('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0c29('0x5'));var config=require('../../config/environment');var controller=require(_0x0c29('0x6'));router['get']('/',auth[_0x0c29('0x7')](),controller['index']);router[_0x0c29('0x8')](_0x0c29('0x9'),auth[_0x0c29('0x7')](),controller[_0x0c29('0xa')]);router[_0x0c29('0x8')]('/:id',auth[_0x0c29('0x7')](),controller[_0x0c29('0xb')]);router[_0x0c29('0x8')](_0x0c29('0xc'),auth[_0x0c29('0x7')](),controller['getMessages']);router['get'](_0x0c29('0xd'),auth[_0x0c29('0x7')](),controller[_0x0c29('0xe')]);router[_0x0c29('0xf')]('/',auth[_0x0c29('0x7')](),controller['create']);router['post']('/:id/messages',auth[_0x0c29('0x7')](),controller[_0x0c29('0x10')]);router[_0x0c29('0xf')]('/:id/tags',auth['isAuthenticated'](),interaction[_0x0c29('0x11')](_0x0c29('0x12'),_0x0c29('0x13')),controller['addTags']);router[_0x0c29('0x14')](_0x0c29('0x15'),auth[_0x0c29('0x7')](),interaction[_0x0c29('0x11')]('fax',_0x0c29('0x16')),controller['update']);router[_0x0c29('0x17')](_0x0c29('0x15'),auth[_0x0c29('0x7')](),interaction[_0x0c29('0x11')](_0x0c29('0x12'),_0x0c29('0x18')),controller[_0x0c29('0x19')]);router[_0x0c29('0x17')]('/:id/tags',auth[_0x0c29('0x7')](),controller[_0x0c29('0x1a')]);module[_0x0c29('0x1b')]=router; \ No newline at end of file +var _0xced2=['getMessages','/:id/download','download','create','post','tracked','fax','faxinteraction:addtags','addTags','put','update','delete','faxinteraction:destroy','destroy','removeTags','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','isAuthenticated','get','/describe','/:id','show','/:id/messages'];(function(_0x252264,_0x507a1a){var _0x14cce4=function(_0x25380e){while(--_0x25380e){_0x252264['push'](_0x252264['shift']());}};_0x14cce4(++_0x507a1a);}(_0xced2,0x1d0));var _0x2ced=function(_0x1de455,_0x3ba726){_0x1de455=_0x1de455-0x0;var _0x3c952b=_0xced2[_0x1de455];return _0x3c952b;};'use strict';var multer=require(_0x2ced('0x0'));var util=require(_0x2ced('0x1'));var path=require('path');var timeout=require(_0x2ced('0x2'));var express=require(_0x2ced('0x3'));var router=express[_0x2ced('0x4')]();var fs_extra=require(_0x2ced('0x5'));var auth=require(_0x2ced('0x6'));var interaction=require(_0x2ced('0x7'));var config=require(_0x2ced('0x8'));var controller=require(_0x2ced('0x9'));router['get']('/',auth[_0x2ced('0xa')](),controller['index']);router[_0x2ced('0xb')](_0x2ced('0xc'),auth[_0x2ced('0xa')](),controller['describe']);router[_0x2ced('0xb')](_0x2ced('0xd'),auth['isAuthenticated'](),controller[_0x2ced('0xe')]);router[_0x2ced('0xb')](_0x2ced('0xf'),auth['isAuthenticated'](),controller[_0x2ced('0x10')]);router['get'](_0x2ced('0x11'),auth[_0x2ced('0xa')](),controller[_0x2ced('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2ced('0x13')]);router['post'](_0x2ced('0xf'),auth[_0x2ced('0xa')](),controller['addMessage']);router[_0x2ced('0x14')]('/:id/tags',auth[_0x2ced('0xa')](),interaction[_0x2ced('0x15')](_0x2ced('0x16'),_0x2ced('0x17')),controller[_0x2ced('0x18')]);router[_0x2ced('0x19')]('/:id',auth[_0x2ced('0xa')](),interaction[_0x2ced('0x15')](_0x2ced('0x16'),'faxinteraction:update'),controller[_0x2ced('0x1a')]);router[_0x2ced('0x1b')]('/:id',auth[_0x2ced('0xa')](),interaction[_0x2ced('0x15')]('fax',_0x2ced('0x1c')),controller[_0x2ced('0x1d')]);router[_0x2ced('0x1b')]('/:id/tags',auth['isAuthenticated'](),controller[_0x2ced('0x1e')]);module[_0x2ced('0x1f')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index a81ac58..fe5ae91 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 _0x1ddc=['out','DATE','exports','TEXT','medium','ENUM'];(function(_0x12fcaa,_0x54a756){var _0x1e4346=function(_0x31a502){while(--_0x31a502){_0x12fcaa['push'](_0x12fcaa['shift']());}};_0x1e4346(++_0x54a756);}(_0x1ddc,0x6e));var _0xc1dd=function(_0x29acbd,_0x56ebf4){_0x29acbd=_0x29acbd-0x0;var _0x253ca5=_0x1ddc[_0x29acbd];return _0x253ca5;};'use strict';var Sequelize=require('sequelize');module[_0xc1dd('0x0')]={'body':{'type':Sequelize[_0xc1dd('0x1')](_0xc1dd('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xc1dd('0x3')]('in',_0xc1dd('0x4')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0xc1dd('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0xc1dd('0x5')]}}; \ No newline at end of file +var _0x0ba7=['DATE','sequelize','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x26a10d,_0xe5c001){var _0xf90201=function(_0x48535b){while(--_0x48535b){_0x26a10d['push'](_0x26a10d['shift']());}};_0xf90201(++_0xe5c001);}(_0x0ba7,0x16d));var _0x70ba=function(_0x180760,_0x518683){_0x180760=_0x180760-0x0;var _0x1795ed=_0x0ba7[_0x180760];return _0x1795ed;};'use strict';var Sequelize=require(_0x70ba('0x0'));module['exports']={'body':{'type':Sequelize[_0x70ba('0x1')](_0x70ba('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x70ba('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x70ba('0x4')]('in','out'),'defaultValue':_0x70ba('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x70ba('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0x70ba('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index df69d0d..26db413 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 _0xf28b=['save','update','then','destroy','sendStatus','stack','send','FaxMessage','rawAttributes','fieldName','key','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','name','options','includeAll','include','findAll','params','find','body','describe','fax-interactions','accept','fax','read','YYYY-MM-DD\x20HH:mm:ss','UserId','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','format','info','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','stringify','null','AcceptMessage','acceptMessage','ContactId','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','internal','manual','interface','SIP/%s','channel','EventManager','reject','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','sequelize','email','event','rejectmessage','create','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','download','join','root','attachments','basename','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','code','FaxMessage,\x20%s,\x20%s','error','message','result','catch','end','status','json','offset','limit','undefined','count','set','Content-Range'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xf28b,0xee));var _0xbf28=function(_0x4d1761,_0x3f6e59){_0x4d1761=_0x4d1761-0x0;var _0x7781e9=_0xf28b[_0x4d1761];return _0x7781e9;};'use strict';var emlformat=require(_0xbf28('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbf28('0x1'));var rp=require(_0xbf28('0x2'));var moment=require(_0xbf28('0x3'));var BPromise=require(_0xbf28('0x4'));var Mustache=require(_0xbf28('0x5'));var util=require(_0xbf28('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbf28('0x7'));var fs=require('fs');var fs_extra=require(_0xbf28('0x8'));var _=require(_0xbf28('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xbf28('0xa'));var deskjs=require(_0xbf28('0xb'));var toCsv=require(_0xbf28('0xc'));var querystring=require(_0xbf28('0xd'));var Papa=require(_0xbf28('0xe'));var Redis=require(_0xbf28('0xf'));var authService=require(_0xbf28('0x10'));var qs=require(_0xbf28('0x11'));var as=require(_0xbf28('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbf28('0x13'))(_0xbf28('0x14'));var utils=require('../../config/utils');var config=require(_0xbf28('0x15'));var licenseUtil=require(_0xbf28('0x16'));var db=require(_0xbf28('0x17'))['db'];config[_0xbf28('0x18')]=_[_0xbf28('0x19')](config[_0xbf28('0x18')],{'host':_0xbf28('0x1a'),'port':0x18eb});var socket=require(_0xbf28('0x1b'))(new Redis(config[_0xbf28('0x18')]));require(_0xbf28('0x1c'))[_0xbf28('0x1d')](socket);var jayson=require(_0xbf28('0x1e'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xbf28('0x1f')][_0xbf28('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x595d83,_0x290aa5,_0x344574,_0x2e223f){return new BPromise(function(_0x5e6e9d,_0x50609b){var _0x5675e2=_0x2e223f||client;return _0x5675e2[_0xbf28('0x21')](_0x595d83,_0x344574)['then'](function(_0x331a2f){logger['info']('FaxMessage,\x20%s,\x20%s',_0x290aa5,_0xbf28('0x22'));logger[_0xbf28('0x23')](_0xbf28('0x24'),_0x290aa5,_0xbf28('0x22'),JSON['stringify'](_0x331a2f));if(_0x331a2f['error']){if(_0x331a2f['error'][_0xbf28('0x25')]===0x1f4){logger['error'](_0xbf28('0x26'),_0x290aa5,_0x331a2f[_0xbf28('0x27')][_0xbf28('0x28')]);return _0x50609b(_0x331a2f[_0xbf28('0x27')][_0xbf28('0x28')]);}logger[_0xbf28('0x27')]('FaxMessage,\x20%s,\x20%s',_0x290aa5,_0x331a2f[_0xbf28('0x27')][_0xbf28('0x28')]);return _0x5e6e9d(_0x331a2f[_0xbf28('0x27')][_0xbf28('0x28')]);}else{logger['info'](_0xbf28('0x26'),_0x290aa5,'request\x20sent');_0x5e6e9d(_0x331a2f[_0xbf28('0x29')][_0xbf28('0x28')]);}})[_0xbf28('0x2a')](function(_0x50b137){logger[_0xbf28('0x27')](_0xbf28('0x26'),_0x290aa5,_0x50b137);_0x50609b(_0x50b137);});});}function respondWithStatusCode(_0x34dcc0,_0x424f2a){_0x424f2a=_0x424f2a||0xcc;return function(_0x4522da){if(_0x4522da){return _0x34dcc0['sendStatus'](_0x424f2a);}return _0x34dcc0['status'](_0x424f2a)[_0xbf28('0x2b')]();};}function respondWithResult(_0x4b8e46,_0x3b8161){_0x3b8161=_0x3b8161||0xc8;return function(_0xcd3bcd){if(_0xcd3bcd){return _0x4b8e46[_0xbf28('0x2c')](_0x3b8161)[_0xbf28('0x2d')](_0xcd3bcd);}};}function respondWithFilteredResult(_0x3b960a,_0x448e9d){return function(_0x4e4684){if(_0x4e4684){var _0x23ef3a=typeof _0x448e9d[_0xbf28('0x2e')]==='undefined'&&typeof _0x448e9d[_0xbf28('0x2f')]===_0xbf28('0x30');var _0x4244c6=_0x4e4684['count'];var _0x4651b3=_0x23ef3a?0x0:_0x448e9d[_0xbf28('0x2e')];var _0x10581b=_0x23ef3a?_0x4e4684[_0xbf28('0x31')]:_0x448e9d[_0xbf28('0x2e')]+_0x448e9d[_0xbf28('0x2f')];var _0x5be4a0;if(_0x10581b>=_0x4244c6){_0x10581b=_0x4244c6;_0x5be4a0=0xc8;}else{_0x5be4a0=0xce;}_0x3b960a[_0xbf28('0x2c')](_0x5be4a0);return _0x3b960a[_0xbf28('0x32')](_0xbf28('0x33'),_0x4651b3+'-'+_0x10581b+'/'+_0x4244c6)[_0xbf28('0x2d')](_0x4e4684);}return null;};}function patchUpdates(_0x1cbd9d){return function(_0x52bf09){try{jsonpatch['apply'](_0x52bf09,_0x1cbd9d,!![]);}catch(_0x515886){return BPromise['reject'](_0x515886);}return _0x52bf09[_0xbf28('0x34')]();};}function saveUpdates(_0x2bc51e,_0x216c4f){return function(_0x582bef){if(_0x582bef){return _0x582bef[_0xbf28('0x35')](_0x2bc51e)[_0xbf28('0x36')](function(_0x58379a){return _0x58379a;});}return null;};}function removeEntity(_0x550168,_0x188740){return function(_0x1b9172){if(_0x1b9172){return _0x1b9172[_0xbf28('0x37')]()[_0xbf28('0x36')](function(){_0x550168[_0xbf28('0x2c')](0xcc)[_0xbf28('0x2b')]();});}};}function handleEntityNotFound(_0x20292e,_0x537eef){return function(_0x28d295){if(!_0x28d295){_0x20292e[_0xbf28('0x38')](0x194);}return _0x28d295;};}function handleError(_0x3f6fe8,_0x29710b){_0x29710b=_0x29710b||0x1f4;return function(_0x300436){logger[_0xbf28('0x27')](_0x300436[_0xbf28('0x39')]);if(_0x300436['name']){delete _0x300436['name'];}_0x3f6fe8['status'](_0x29710b)[_0xbf28('0x3a')](_0x300436);};}exports['index']=function(_0x24a0d5,_0x580644){var _0xf2d09e={},_0x302fd8={},_0x2d19b2={'count':0x0,'rows':[]};var _0x47f516=_['map'](db[_0xbf28('0x3b')][_0xbf28('0x3c')],function(_0x59f9e2){return{'name':_0x59f9e2[_0xbf28('0x3d')],'type':_0x59f9e2['type'][_0xbf28('0x3e')]};});_0x302fd8['model']=_[_0xbf28('0x3f')](_0x47f516,'name');_0x302fd8['query']=_[_0xbf28('0x40')](_0x24a0d5[_0xbf28('0x41')]);_0x302fd8[_0xbf28('0x42')]=_[_0xbf28('0x43')](_0x302fd8[_0xbf28('0x44')],_0x302fd8[_0xbf28('0x41')]);_0xf2d09e[_0xbf28('0x45')]=_[_0xbf28('0x43')](_0x302fd8[_0xbf28('0x44')],qs[_0xbf28('0x46')](_0x24a0d5[_0xbf28('0x41')]['fields']));_0xf2d09e[_0xbf28('0x45')]=_0xf2d09e[_0xbf28('0x45')][_0xbf28('0x47')]?_0xf2d09e[_0xbf28('0x45')]:_0x302fd8[_0xbf28('0x44')];if(!_0x24a0d5['query'][_0xbf28('0x48')](_0xbf28('0x49'))){_0xf2d09e[_0xbf28('0x2f')]=qs[_0xbf28('0x2f')](_0x24a0d5['query'][_0xbf28('0x2f')]);_0xf2d09e[_0xbf28('0x2e')]=qs['offset'](_0x24a0d5['query'][_0xbf28('0x2e')]);}_0xf2d09e[_0xbf28('0x4a')]=qs[_0xbf28('0x4b')](_0x24a0d5[_0xbf28('0x41')][_0xbf28('0x4b')]);_0xf2d09e[_0xbf28('0x4c')]=qs[_0xbf28('0x42')](_[_0xbf28('0x4d')](_0x24a0d5[_0xbf28('0x41')],_0x302fd8[_0xbf28('0x42')]),_0x47f516);if(_0x24a0d5['query'][_0xbf28('0x4e')]){_0xf2d09e['where']=_[_0xbf28('0x4f')](_0xf2d09e['where'],{'$or':_['map'](_0x47f516,function(_0x101da0){if(_0x101da0[_0xbf28('0x50')]!==_0xbf28('0x51')){var _0x5a857f={};_0x5a857f[_0x101da0[_0xbf28('0x52')]]={'$like':'%'+_0x24a0d5['query']['filter']+'%'};return _0x5a857f;}})});}_0xf2d09e=_[_0xbf28('0x4f')]({},_0xf2d09e,_0x24a0d5[_0xbf28('0x53')]);var _0x29516d={'where':_0xf2d09e['where']};return db['FaxMessage'][_0xbf28('0x31')](_0x29516d)[_0xbf28('0x36')](function(_0xc12cc8){_0x2d19b2[_0xbf28('0x31')]=_0xc12cc8;if(_0x24a0d5['query'][_0xbf28('0x54')]){_0xf2d09e[_0xbf28('0x55')]=[{'all':!![]}];}return db[_0xbf28('0x3b')][_0xbf28('0x56')](_0xf2d09e);})[_0xbf28('0x36')](function(_0x192bfb){_0x2d19b2['rows']=_0x192bfb;return _0x2d19b2;})[_0xbf28('0x36')](respondWithFilteredResult(_0x580644,_0xf2d09e))[_0xbf28('0x2a')](handleError(_0x580644,null));};exports['show']=function(_0x31da3f,_0x5828b7){var _0x1769ae={'raw':!![],'where':{'id':_0x31da3f[_0xbf28('0x57')]['id']}},_0x17faa1={};_0x17faa1[_0xbf28('0x44')]=_['keys'](db['FaxMessage'][_0xbf28('0x3c')]);_0x17faa1['query']=_['keys'](_0x31da3f[_0xbf28('0x41')]);_0x17faa1[_0xbf28('0x42')]=_[_0xbf28('0x43')](_0x17faa1['model'],_0x17faa1[_0xbf28('0x41')]);_0x1769ae['attributes']=_[_0xbf28('0x43')](_0x17faa1[_0xbf28('0x44')],qs[_0xbf28('0x46')](_0x31da3f[_0xbf28('0x41')]['fields']));_0x1769ae[_0xbf28('0x45')]=_0x1769ae[_0xbf28('0x45')][_0xbf28('0x47')]?_0x1769ae['attributes']:_0x17faa1[_0xbf28('0x44')];if(_0x31da3f[_0xbf28('0x41')][_0xbf28('0x54')]){_0x1769ae['include']=[{'all':!![]}];}_0x1769ae=_[_0xbf28('0x4f')]({},_0x1769ae,_0x31da3f[_0xbf28('0x53')]);return db[_0xbf28('0x3b')][_0xbf28('0x58')](_0x1769ae)[_0xbf28('0x36')](handleEntityNotFound(_0x5828b7,null))[_0xbf28('0x36')](respondWithResult(_0x5828b7,null))['catch'](handleError(_0x5828b7,null));};exports[_0xbf28('0x35')]=function(_0x25bc06,_0x13db79){if(_0x25bc06['body']['id']){delete _0x25bc06[_0xbf28('0x59')]['id'];}return db[_0xbf28('0x3b')]['find']({'where':{'id':_0x25bc06['params']['id']}})[_0xbf28('0x36')](handleEntityNotFound(_0x13db79,null))[_0xbf28('0x36')](saveUpdates(_0x25bc06[_0xbf28('0x59')],null))[_0xbf28('0x36')](respondWithResult(_0x13db79,null))[_0xbf28('0x2a')](handleError(_0x13db79,null));};exports['destroy']=function(_0x574182,_0x1394f9){return db[_0xbf28('0x3b')][_0xbf28('0x58')]({'where':{'id':_0x574182['params']['id']}})[_0xbf28('0x36')](handleEntityNotFound(_0x1394f9,null))[_0xbf28('0x36')](removeEntity(_0x1394f9,null))['catch'](handleError(_0x1394f9,null));};exports[_0xbf28('0x5a')]=function(_0x51e5d6,_0x4eac99){return db[_0xbf28('0x3b')][_0xbf28('0x5a')]()['then'](respondWithResult(_0x4eac99,null))[_0xbf28('0x2a')](handleError(_0x4eac99,null));};var interaction_log=require(_0xbf28('0x13'))(_0xbf28('0x5b'));exports[_0xbf28('0x5c')]=function(_0xeb0214,_0x4a379a,_0x19a84e){var _0xacc9a9={'agent':{},'channel':_0xbf28('0x5d')};if(_0xeb0214[_0xbf28('0x59')]['id']){delete _0xeb0214['body']['id'];}_0xeb0214[_0xbf28('0x59')][_0xbf28('0x5e')]=!![];_0xeb0214[_0xbf28('0x59')]['readAt']=moment()['format'](_0xbf28('0x5f'));_0xeb0214[_0xbf28('0x59')][_0xbf28('0x60')]=_0xeb0214[_0xbf28('0x59')][_0xbf28('0x60')]||_0xeb0214['user']['id'];_0xacc9a9['agent']['id']=_0xeb0214['body'][_0xbf28('0x60')];return db['FaxMessage'][_0xbf28('0x58')]({'where':{'id':_0xeb0214[_0xbf28('0x57')]['id'],'UserId':null}})[_0xbf28('0x36')](handleEntityNotFound(_0x4a379a,null))['then'](saveUpdates(_0xeb0214[_0xbf28('0x59')],null))['then'](function(_0x2c88a4){if(_0x2c88a4){_0xacc9a9['message']=_0x2c88a4[_0xbf28('0x61')]({'plain':!![]});return db[_0xbf28('0x62')][_0xbf28('0x58')]({'where':{'id':_0x2c88a4[_0xbf28('0x63')]}});}return null;})[_0xbf28('0x36')](handleEntityNotFound(_0x4a379a,null))[_0xbf28('0x36')](function(_0x12f5d2){if(_0x12f5d2){return _0x12f5d2[_0xbf28('0x35')]({'UserId':_0xeb0214[_0xbf28('0x59')]['UserId'],'read1stAt':_[_0xbf28('0x64')](_0x12f5d2[_0xbf28('0x65')])?moment()[_0xbf28('0x66')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xbf28('0x36')](function(_0x35eb49){if(_0x35eb49){_0xacc9a9['interaction']=_0x35eb49[_0xbf28('0x61')]({'plain':!![]});interaction_log[_0xbf28('0x67')](_0xbf28('0x68'),_0xeb0214[_0xbf28('0x69')]['id'],_0xeb0214[_0xbf28('0x69')][_0xbf28('0x52')],_0xeb0214[_0xbf28('0x69')][_0xbf28('0x6a')],_0xacc9a9[_0xbf28('0x6b')]['id'],_0xeb0214[_0xbf28('0x59')]?JSON[_0xbf28('0x6c')](_0xeb0214['body']):_0xbf28('0x6d'));return respondWithRpcPromise(_0xbf28('0x6e'),_0xbf28('0x6f'),_0xacc9a9);}return null;})[_0xbf28('0x36')](function(_0x4d17ff){var _0x34b8ad='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4d17ff['message'][_0xbf28('0x70')];return db['sequelize']['query'](_0x34b8ad,{'type':db[_0xbf28('0x71')][_0xbf28('0x72')][_0xbf28('0x73')],'raw':!![]})[_0xbf28('0x36')](function(_0x4d89b0){return _0x4d89b0;});})[_0xbf28('0x36')](function(_0x35d9ff){if(_0x35d9ff){_0xacc9a9['message'][_0xbf28('0x74')]=_0x35d9ff[0x0];if(!_0xeb0214[_0xbf28('0x59')][_0xbf28('0x60')])return;return db[_0xbf28('0x75')]['find']({'where':{'id':_0xeb0214[_0xbf28('0x59')][_0xbf28('0x60')],'role':_0xbf28('0x76')},'attributes':['id',_0xbf28('0x52'),_0xbf28('0x77'),'email',_0xbf28('0x78')],'raw':!![]});}return null;})[_0xbf28('0x36')](function(_0x56dbb9){if(!_0x56dbb9)return null;_0xacc9a9['message'][_0xbf28('0x76')]=_0x56dbb9;return _0xacc9a9;})['then'](function(_0x4cc9ab){if(_0x4cc9ab){if(_0xeb0214[_0xbf28('0x59')][_0xbf28('0x79')]){_0xacc9a9[_0xbf28('0x28')][_0xbf28('0x7a')]=util[_0xbf28('0x66')](_0xbf28('0x7b'),_0xeb0214[_0xbf28('0x69')][_0xbf28('0x52')]);_0xacc9a9['message'][_0xbf28('0x7c')]=_0xacc9a9[_0xbf28('0x7c')];_0xacc9a9[_0xbf28('0x28')]['event']=_0xbf28('0x5c');return respondWithRpcPromise(_0xbf28('0x7d'),'EventManager',{'event':'acceptmessage','message':_0xacc9a9[_0xbf28('0x28')]},client9002)[_0xbf28('0x36')](function(){return _0xacc9a9;});}return _0xacc9a9;}return null;})[_0xbf28('0x36')](respondWithResult(_0x4a379a,null))[_0xbf28('0x2a')](handleError(_0x4a379a,null));};var interaction_log=require('../../config/logger')('fax-interactions');exports[_0xbf28('0x7e')]=function(_0x246203,_0x12bbf3,_0x7e4e7){var _0x218ad2={'agent':{},'channel':_0xbf28('0x5d')};if(_0x246203['body']['id']){delete _0x246203['body']['id'];}_0x246203[_0xbf28('0x59')][_0xbf28('0x60')]=_0x246203['body'][_0xbf28('0x60')]||_0x246203[_0xbf28('0x69')]['id'];_0x218ad2[_0xbf28('0x76')]['id']=_0x246203[_0xbf28('0x59')][_0xbf28('0x60')];return db[_0xbf28('0x3b')][_0xbf28('0x58')]({'where':{'id':_0x246203['params']['id'],'UserId':null}})[_0xbf28('0x36')](handleEntityNotFound(_0x12bbf3,null))[_0xbf28('0x36')](function(_0x436cb6){if(_0x436cb6){_0x218ad2['message']=_0x436cb6['get']({'plain':!![]});return db[_0xbf28('0x62')][_0xbf28('0x58')]({'where':{'id':_0x436cb6['FaxInteractionId']}});}return null;})[_0xbf28('0x36')](handleEntityNotFound(_0x12bbf3,null))[_0xbf28('0x36')](function(_0x14cf49){if(_0x14cf49){_0x218ad2[_0xbf28('0x6b')]=_0x14cf49[_0xbf28('0x61')]({'plain':!![]});interaction_log['info'](_0xbf28('0x7f'),_0x246203[_0xbf28('0x69')]['id'],_0x246203[_0xbf28('0x69')][_0xbf28('0x52')],_0x246203[_0xbf28('0x69')]['role'],_0x218ad2[_0xbf28('0x6b')]['id'],_0x246203['body']?JSON[_0xbf28('0x6c')](_0x246203[_0xbf28('0x59')]):'null');return respondWithRpcPromise('RejectMessage',_0xbf28('0x80'),_0x218ad2);}return null;})[_0xbf28('0x36')](function(_0x554ff5){var _0x5ab328='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x554ff5['message']['ContactId'];return db[_0xbf28('0x81')]['query'](_0x5ab328,{'type':db[_0xbf28('0x71')]['QueryTypes'][_0xbf28('0x73')],'raw':!![]})[_0xbf28('0x36')](function(_0x16bd7e){return _0x16bd7e;});})[_0xbf28('0x36')](function(_0x1c6871){if(_0x1c6871){_0x218ad2['message'][_0xbf28('0x74')]=_0x1c6871[0x0];if(!_0x246203['body'][_0xbf28('0x60')])return;return db[_0xbf28('0x75')][_0xbf28('0x58')]({'where':{'id':_0x246203['body'][_0xbf28('0x60')],'role':_0xbf28('0x76')},'attributes':['id','name',_0xbf28('0x77'),_0xbf28('0x82'),_0xbf28('0x78')],'raw':!![]});}return null;})[_0xbf28('0x36')](function(_0x1dc30e){if(!_0x1dc30e)return null;_0x218ad2[_0xbf28('0x28')][_0xbf28('0x76')]=_0x1dc30e;return _0x218ad2;})[_0xbf28('0x36')](function(_0x5d2e9c){if(_0x5d2e9c){_0x5d2e9c['message']['interface']=util[_0xbf28('0x66')](_0xbf28('0x7b'),_0x246203['user'][_0xbf28('0x52')]);_0x5d2e9c[_0xbf28('0x28')][_0xbf28('0x7c')]=_0x218ad2[_0xbf28('0x7c')];_0x5d2e9c[_0xbf28('0x28')][_0xbf28('0x83')]='reject';respondWithRpcPromise(_0xbf28('0x7d'),_0xbf28('0x7d'),{'event':_0xbf28('0x84'),'message':_0x5d2e9c[_0xbf28('0x28')]},client9002);return _0x218ad2;}return null;})[_0xbf28('0x36')](respondWithResult(_0x12bbf3,null))['catch'](handleError(_0x12bbf3,null));};exports['create']=function(_0x3fd437,_0x1a69bd){var _0x345eef;return db[_0xbf28('0x3b')][_0xbf28('0x85')](_0x3fd437['body'],{})[_0xbf28('0x36')](function(_0x6586e8){_0x345eef=_0x6586e8;return db['CmContact'][_0xbf28('0x86')]({'where':{'id':_0x345eef[_0xbf28('0x70')]}});})[_0xbf28('0x36')](function(_0x2615be){if(_['isNil'](_0x2615be)){return;}else{_0x345eef['fax']=_0x2615be[_0xbf28('0x5d')];return db[_0xbf28('0x87')]['findOne']({'where':{'id':_0x345eef[_0xbf28('0x88')]}});}})[_0xbf28('0x36')](function(_0x10596e){return respondWithRpcPromise(_0xbf28('0x89'),_0xbf28('0x89'),{'FaxAccountId':_['isNil'](_0x3fd437[_0xbf28('0x59')])?undefined:_0x3fd437['body'][_0xbf28('0x8a')],'path':_[_0xbf28('0x64')](_0x10596e)?undefined:util['format'](_0xbf28('0x8b'),_0x10596e['basename']),'fax':_[_0xbf28('0x64')](_0x345eef['fax'])?undefined:_0x345eef[_0xbf28('0x5d')],'AttachmentId':_0x345eef['AttachmentId']},client9002);})[_0xbf28('0x36')](respondWithResult(_0x1a69bd,0xc9))[_0xbf28('0x2a')](handleError(_0x1a69bd,null));};exports[_0xbf28('0x8c')]=function(_0x567101,_0x186c69){var _0x10d11e=path[_0xbf28('0x8d')](config[_0xbf28('0x8e')],'server','files',_0xbf28('0x8f'));return db['FaxMessage'][_0xbf28('0x58')]({'where':{'id':_0x567101[_0xbf28('0x57')]['id']},'include':[{'model':db[_0xbf28('0x87')],'as':'Attachment'}]})['then'](handleEntityNotFound(_0x186c69,null))[_0xbf28('0x36')](function(_0x1852fa){if(_0x1852fa){return _0x186c69['download'](path[_0xbf28('0x8d')](_0x10d11e,_0x1852fa['Attachment'][_0xbf28('0x90')]));}})[_0xbf28('0x2a')](handleError(_0x186c69,null));}; \ No newline at end of file +var _0x3afb=['mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','http','request','then','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','catch','status','offset','limit','undefined','count','set','json','reject','update','destroy','sendStatus','name','index','FaxMessage','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','VIRTUAL','includeAll','findAll','rows','show','params','include','body','find','describe','fax-interactions','fax','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','FaxInteraction','FaxInteractionId','isNil','read1stAt','get','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','format','SIP/%s','channel','EventManager','interaction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','interface','event','rejectmessage','create','findOne','ContactId','SendFax','FaxAccountId','AttachmentId','download','join','server','attachments','Attachment','basename','eml-format','rimraf','fast-json-patch','moment','bluebird'];(function(_0x3c2166,_0x41fc16){var _0x30ccc3=function(_0x689bc3){while(--_0x689bc3){_0x3c2166['push'](_0x3c2166['shift']());}};_0x30ccc3(++_0x41fc16);}(_0x3afb,0x196));var _0xb3af=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0x3afb[_0x231e16];return _0x570a7c;};'use strict';var emlformat=require(_0xb3af('0x0'));var rimraf=require(_0xb3af('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb3af('0x2'));var rp=require('request-promise');var moment=require(_0xb3af('0x3'));var BPromise=require(_0xb3af('0x4'));var Mustache=require(_0xb3af('0x5'));var util=require('util');var path=require(_0xb3af('0x6'));var sox=require(_0xb3af('0x7'));var csv=require(_0xb3af('0x8'));var ejs=require(_0xb3af('0x9'));var fs=require('fs');var fs_extra=require(_0xb3af('0xa'));var _=require(_0xb3af('0xb'));var squel=require(_0xb3af('0xc'));var crypto=require(_0xb3af('0xd'));var jsforce=require(_0xb3af('0xe'));var deskjs=require(_0xb3af('0xf'));var toCsv=require(_0xb3af('0x8'));var querystring=require(_0xb3af('0x10'));var Papa=require('papaparse');var Redis=require(_0xb3af('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb3af('0x12'));var as=require(_0xb3af('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb3af('0x14'))('api');var utils=require(_0xb3af('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xb3af('0x16'));var db=require(_0xb3af('0x17'))['db'];config[_0xb3af('0x18')]=_[_0xb3af('0x19')](config[_0xb3af('0x18')],{'host':_0xb3af('0x1a'),'port':0x18eb});var socket=require(_0xb3af('0x1b'))(new Redis(config['redis']));require(_0xb3af('0x1c'))[_0xb3af('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xb3af('0x1e')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1aaccf,_0x11ee5d,_0x4d1d09,_0x59090f){return new BPromise(function(_0x32ba68,_0x50a0d9){var _0x1d7420=_0x59090f||client;return _0x1d7420[_0xb3af('0x1f')](_0x1aaccf,_0x4d1d09)[_0xb3af('0x20')](function(_0x103f30){logger[_0xb3af('0x21')]('FaxMessage,\x20%s,\x20%s',_0x11ee5d,_0xb3af('0x22'));logger[_0xb3af('0x23')](_0xb3af('0x24'),_0x11ee5d,_0xb3af('0x22'),JSON[_0xb3af('0x25')](_0x103f30));if(_0x103f30[_0xb3af('0x26')]){if(_0x103f30[_0xb3af('0x26')][_0xb3af('0x27')]===0x1f4){logger[_0xb3af('0x26')](_0xb3af('0x28'),_0x11ee5d,_0x103f30[_0xb3af('0x26')]['message']);return _0x50a0d9(_0x103f30[_0xb3af('0x26')][_0xb3af('0x29')]);}logger[_0xb3af('0x26')](_0xb3af('0x28'),_0x11ee5d,_0x103f30[_0xb3af('0x26')][_0xb3af('0x29')]);return _0x32ba68(_0x103f30[_0xb3af('0x26')][_0xb3af('0x29')]);}else{logger[_0xb3af('0x21')](_0xb3af('0x28'),_0x11ee5d,'request\x20sent');_0x32ba68(_0x103f30['result'][_0xb3af('0x29')]);}})[_0xb3af('0x2a')](function(_0x33e7ed){logger[_0xb3af('0x26')](_0xb3af('0x28'),_0x11ee5d,_0x33e7ed);_0x50a0d9(_0x33e7ed);});});}function respondWithStatusCode(_0x3cefc6,_0x9af127){_0x9af127=_0x9af127||0xcc;return function(_0x58276c){if(_0x58276c){return _0x3cefc6['sendStatus'](_0x9af127);}return _0x3cefc6['status'](_0x9af127)['end']();};}function respondWithResult(_0x46b701,_0x1edd6e){_0x1edd6e=_0x1edd6e||0xc8;return function(_0x4a0a6e){if(_0x4a0a6e){return _0x46b701[_0xb3af('0x2b')](_0x1edd6e)['json'](_0x4a0a6e);}};}function respondWithFilteredResult(_0x23c407,_0x3a797b){return function(_0x28fb5b){if(_0x28fb5b){var _0xa7ac91=typeof _0x3a797b[_0xb3af('0x2c')]==='undefined'&&typeof _0x3a797b[_0xb3af('0x2d')]===_0xb3af('0x2e');var _0x13491a=_0x28fb5b[_0xb3af('0x2f')];var _0x481a08=_0xa7ac91?0x0:_0x3a797b[_0xb3af('0x2c')];var _0x305591=_0xa7ac91?_0x28fb5b[_0xb3af('0x2f')]:_0x3a797b[_0xb3af('0x2c')]+_0x3a797b[_0xb3af('0x2d')];var _0x647bd6;if(_0x305591>=_0x13491a){_0x305591=_0x13491a;_0x647bd6=0xc8;}else{_0x647bd6=0xce;}_0x23c407[_0xb3af('0x2b')](_0x647bd6);return _0x23c407[_0xb3af('0x30')]('Content-Range',_0x481a08+'-'+_0x305591+'/'+_0x13491a)[_0xb3af('0x31')](_0x28fb5b);}return null;};}function patchUpdates(_0x43420b){return function(_0x325d43){try{jsonpatch['apply'](_0x325d43,_0x43420b,!![]);}catch(_0x23f06c){return BPromise[_0xb3af('0x32')](_0x23f06c);}return _0x325d43['save']();};}function saveUpdates(_0x4ef2db,_0xed097f){return function(_0x2da986){if(_0x2da986){return _0x2da986[_0xb3af('0x33')](_0x4ef2db)[_0xb3af('0x20')](function(_0x374b78){return _0x374b78;});}return null;};}function removeEntity(_0xd04600,_0x195f90){return function(_0x2769e5){if(_0x2769e5){return _0x2769e5[_0xb3af('0x34')]()[_0xb3af('0x20')](function(){_0xd04600['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d77a6,_0x37afe2){return function(_0x55eab1){if(!_0x55eab1){_0x1d77a6[_0xb3af('0x35')](0x194);}return _0x55eab1;};}function handleError(_0x53fdd3,_0x5156ef){_0x5156ef=_0x5156ef||0x1f4;return function(_0x27258b){logger['error'](_0x27258b['stack']);if(_0x27258b[_0xb3af('0x36')]){delete _0x27258b['name'];}_0x53fdd3['status'](_0x5156ef)['send'](_0x27258b);};}exports[_0xb3af('0x37')]=function(_0x38e860,_0x132342){var _0x186993={},_0x54df20={},_0x7be33e={'count':0x0,'rows':[]};var _0x381bcf=_['map'](db[_0xb3af('0x38')][_0xb3af('0x39')],function(_0x183ef1){return{'name':_0x183ef1[_0xb3af('0x3a')],'type':_0x183ef1[_0xb3af('0x3b')]['key']};});_0x54df20[_0xb3af('0x3c')]=_['map'](_0x381bcf,_0xb3af('0x36'));_0x54df20[_0xb3af('0x3d')]=_[_0xb3af('0x3e')](_0x38e860[_0xb3af('0x3d')]);_0x54df20[_0xb3af('0x3f')]=_[_0xb3af('0x40')](_0x54df20['model'],_0x54df20['query']);_0x186993[_0xb3af('0x41')]=_[_0xb3af('0x40')](_0x54df20[_0xb3af('0x3c')],qs[_0xb3af('0x42')](_0x38e860[_0xb3af('0x3d')][_0xb3af('0x42')]));_0x186993[_0xb3af('0x41')]=_0x186993[_0xb3af('0x41')][_0xb3af('0x43')]?_0x186993[_0xb3af('0x41')]:_0x54df20[_0xb3af('0x3c')];if(!_0x38e860[_0xb3af('0x3d')][_0xb3af('0x44')]('nolimit')){_0x186993[_0xb3af('0x2d')]=qs[_0xb3af('0x2d')](_0x38e860['query'][_0xb3af('0x2d')]);_0x186993[_0xb3af('0x2c')]=qs[_0xb3af('0x2c')](_0x38e860[_0xb3af('0x3d')]['offset']);}_0x186993[_0xb3af('0x45')]=qs[_0xb3af('0x46')](_0x38e860[_0xb3af('0x3d')][_0xb3af('0x46')]);_0x186993[_0xb3af('0x47')]=qs[_0xb3af('0x3f')](_[_0xb3af('0x48')](_0x38e860[_0xb3af('0x3d')],_0x54df20['filters']),_0x381bcf);if(_0x38e860['query'][_0xb3af('0x49')]){_0x186993[_0xb3af('0x47')]=_[_0xb3af('0x4a')](_0x186993[_0xb3af('0x47')],{'$or':_[_0xb3af('0x4b')](_0x381bcf,function(_0x180150){if(_0x180150['type']!==_0xb3af('0x4c')){var _0x2f792d={};_0x2f792d[_0x180150['name']]={'$like':'%'+_0x38e860['query'][_0xb3af('0x49')]+'%'};return _0x2f792d;}})});}_0x186993=_[_0xb3af('0x4a')]({},_0x186993,_0x38e860['options']);var _0x3307a0={'where':_0x186993[_0xb3af('0x47')]};return db[_0xb3af('0x38')][_0xb3af('0x2f')](_0x3307a0)[_0xb3af('0x20')](function(_0x3ad048){_0x7be33e[_0xb3af('0x2f')]=_0x3ad048;if(_0x38e860[_0xb3af('0x3d')][_0xb3af('0x4d')]){_0x186993['include']=[{'all':!![]}];}return db[_0xb3af('0x38')][_0xb3af('0x4e')](_0x186993);})['then'](function(_0x25363){_0x7be33e[_0xb3af('0x4f')]=_0x25363;return _0x7be33e;})['then'](respondWithFilteredResult(_0x132342,_0x186993))[_0xb3af('0x2a')](handleError(_0x132342,null));};exports[_0xb3af('0x50')]=function(_0x53407e,_0x3258c4){var _0x113eb4={'raw':!![],'where':{'id':_0x53407e[_0xb3af('0x51')]['id']}},_0xfbdb65={};_0xfbdb65['model']=_['keys'](db[_0xb3af('0x38')][_0xb3af('0x39')]);_0xfbdb65[_0xb3af('0x3d')]=_[_0xb3af('0x3e')](_0x53407e[_0xb3af('0x3d')]);_0xfbdb65[_0xb3af('0x3f')]=_[_0xb3af('0x40')](_0xfbdb65[_0xb3af('0x3c')],_0xfbdb65[_0xb3af('0x3d')]);_0x113eb4[_0xb3af('0x41')]=_[_0xb3af('0x40')](_0xfbdb65[_0xb3af('0x3c')],qs[_0xb3af('0x42')](_0x53407e[_0xb3af('0x3d')][_0xb3af('0x42')]));_0x113eb4[_0xb3af('0x41')]=_0x113eb4[_0xb3af('0x41')][_0xb3af('0x43')]?_0x113eb4[_0xb3af('0x41')]:_0xfbdb65[_0xb3af('0x3c')];if(_0x53407e[_0xb3af('0x3d')]['includeAll']){_0x113eb4[_0xb3af('0x52')]=[{'all':!![]}];}_0x113eb4=_['merge']({},_0x113eb4,_0x53407e['options']);return db[_0xb3af('0x38')]['find'](_0x113eb4)['then'](handleEntityNotFound(_0x3258c4,null))[_0xb3af('0x20')](respondWithResult(_0x3258c4,null))[_0xb3af('0x2a')](handleError(_0x3258c4,null));};exports[_0xb3af('0x33')]=function(_0x2ecf71,_0x54518d){if(_0x2ecf71['body']['id']){delete _0x2ecf71[_0xb3af('0x53')]['id'];}return db[_0xb3af('0x38')]['find']({'where':{'id':_0x2ecf71[_0xb3af('0x51')]['id']}})[_0xb3af('0x20')](handleEntityNotFound(_0x54518d,null))[_0xb3af('0x20')](saveUpdates(_0x2ecf71[_0xb3af('0x53')],null))[_0xb3af('0x20')](respondWithResult(_0x54518d,null))[_0xb3af('0x2a')](handleError(_0x54518d,null));};exports[_0xb3af('0x34')]=function(_0x94c93b,_0x2c363a){return db[_0xb3af('0x38')][_0xb3af('0x54')]({'where':{'id':_0x94c93b['params']['id']}})[_0xb3af('0x20')](handleEntityNotFound(_0x2c363a,null))[_0xb3af('0x20')](removeEntity(_0x2c363a,null))['catch'](handleError(_0x2c363a,null));};exports['describe']=function(_0x1c4c14,_0x4157f9){return db[_0xb3af('0x38')][_0xb3af('0x55')]()[_0xb3af('0x20')](respondWithResult(_0x4157f9,null))[_0xb3af('0x2a')](handleError(_0x4157f9,null));};var interaction_log=require(_0xb3af('0x14'))(_0xb3af('0x56'));exports['accept']=function(_0x5c54a2,_0x131285,_0x5ab76d){var _0x85686e={'agent':{},'channel':_0xb3af('0x57')};if(_0x5c54a2['body']['id']){delete _0x5c54a2['body']['id'];}_0x5c54a2[_0xb3af('0x53')][_0xb3af('0x58')]=!![];_0x5c54a2[_0xb3af('0x53')][_0xb3af('0x59')]=moment()['format'](_0xb3af('0x5a'));_0x5c54a2['body']['UserId']=_0x5c54a2[_0xb3af('0x53')][_0xb3af('0x5b')]||_0x5c54a2[_0xb3af('0x5c')]['id'];_0x85686e[_0xb3af('0x5d')]['id']=_0x5c54a2[_0xb3af('0x53')][_0xb3af('0x5b')];return db[_0xb3af('0x38')]['find']({'where':{'id':_0x5c54a2[_0xb3af('0x51')]['id'],'UserId':null}})[_0xb3af('0x20')](handleEntityNotFound(_0x131285,null))[_0xb3af('0x20')](saveUpdates(_0x5c54a2[_0xb3af('0x53')],null))[_0xb3af('0x20')](function(_0x2516dc){if(_0x2516dc){_0x85686e[_0xb3af('0x29')]=_0x2516dc['get']({'plain':!![]});return db[_0xb3af('0x5e')][_0xb3af('0x54')]({'where':{'id':_0x2516dc[_0xb3af('0x5f')]}});}return null;})[_0xb3af('0x20')](handleEntityNotFound(_0x131285,null))[_0xb3af('0x20')](function(_0x461f7a){if(_0x461f7a){return _0x461f7a[_0xb3af('0x33')]({'UserId':_0x5c54a2[_0xb3af('0x53')]['UserId'],'read1stAt':_[_0xb3af('0x60')](_0x461f7a[_0xb3af('0x61')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xb3af('0x20')](function(_0x4298a0){if(_0x4298a0){_0x85686e['interaction']=_0x4298a0[_0xb3af('0x62')]({'plain':!![]});interaction_log[_0xb3af('0x21')](_0xb3af('0x63'),_0x5c54a2[_0xb3af('0x5c')]['id'],_0x5c54a2[_0xb3af('0x5c')][_0xb3af('0x36')],_0x5c54a2[_0xb3af('0x5c')][_0xb3af('0x64')],_0x85686e['interaction']['id'],_0x5c54a2[_0xb3af('0x53')]?JSON[_0xb3af('0x25')](_0x5c54a2[_0xb3af('0x53')]):_0xb3af('0x65'));return respondWithRpcPromise(_0xb3af('0x66'),_0xb3af('0x67'),_0x85686e);}return null;})[_0xb3af('0x20')](function(_0x4e4b06){var _0x2ba13a='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4e4b06[_0xb3af('0x29')]['ContactId'];return db[_0xb3af('0x68')][_0xb3af('0x3d')](_0x2ba13a,{'type':db[_0xb3af('0x69')][_0xb3af('0x6a')][_0xb3af('0x6b')],'raw':!![]})[_0xb3af('0x20')](function(_0xdf8697){return _0xdf8697;});})[_0xb3af('0x20')](function(_0x4a9beb){if(_0x4a9beb){_0x85686e[_0xb3af('0x29')][_0xb3af('0x6c')]=_0x4a9beb[0x0];if(!_0x5c54a2[_0xb3af('0x53')][_0xb3af('0x5b')])return;return db[_0xb3af('0x6d')][_0xb3af('0x54')]({'where':{'id':_0x5c54a2[_0xb3af('0x53')][_0xb3af('0x5b')],'role':_0xb3af('0x5d')},'attributes':['id',_0xb3af('0x36'),_0xb3af('0x6e'),_0xb3af('0x6f'),_0xb3af('0x70')],'raw':!![]});}return null;})[_0xb3af('0x20')](function(_0x5994b6){if(!_0x5994b6)return null;_0x85686e[_0xb3af('0x29')][_0xb3af('0x5d')]=_0x5994b6;return _0x85686e;})[_0xb3af('0x20')](function(_0x689e49){if(_0x689e49){if(_0x5c54a2[_0xb3af('0x53')][_0xb3af('0x71')]){_0x85686e[_0xb3af('0x29')]['interface']=util[_0xb3af('0x72')](_0xb3af('0x73'),_0x5c54a2[_0xb3af('0x5c')][_0xb3af('0x36')]);_0x85686e[_0xb3af('0x29')][_0xb3af('0x74')]=_0x85686e[_0xb3af('0x74')];_0x85686e['message']['event']='accept';return respondWithRpcPromise(_0xb3af('0x75'),'EventManager',{'event':'acceptmessage','message':_0x85686e['message']},client9002)[_0xb3af('0x20')](function(){return _0x85686e;});}return _0x85686e;}return null;})['then'](respondWithResult(_0x131285,null))['catch'](handleError(_0x131285,null));};var interaction_log=require(_0xb3af('0x14'))(_0xb3af('0x56'));exports[_0xb3af('0x32')]=function(_0x49b662,_0x3cda5e,_0x5e632c){var _0x5d81ad={'agent':{},'channel':_0xb3af('0x57')};if(_0x49b662['body']['id']){delete _0x49b662[_0xb3af('0x53')]['id'];}_0x49b662[_0xb3af('0x53')][_0xb3af('0x5b')]=_0x49b662['body'][_0xb3af('0x5b')]||_0x49b662[_0xb3af('0x5c')]['id'];_0x5d81ad[_0xb3af('0x5d')]['id']=_0x49b662[_0xb3af('0x53')][_0xb3af('0x5b')];return db[_0xb3af('0x38')][_0xb3af('0x54')]({'where':{'id':_0x49b662[_0xb3af('0x51')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3cda5e,null))[_0xb3af('0x20')](function(_0x445082){if(_0x445082){_0x5d81ad[_0xb3af('0x29')]=_0x445082['get']({'plain':!![]});return db[_0xb3af('0x5e')][_0xb3af('0x54')]({'where':{'id':_0x445082[_0xb3af('0x5f')]}});}return null;})[_0xb3af('0x20')](handleEntityNotFound(_0x3cda5e,null))[_0xb3af('0x20')](function(_0x13178e){if(_0x13178e){_0x5d81ad[_0xb3af('0x76')]=_0x13178e[_0xb3af('0x62')]({'plain':!![]});interaction_log[_0xb3af('0x21')](_0xb3af('0x77'),_0x49b662['user']['id'],_0x49b662[_0xb3af('0x5c')][_0xb3af('0x36')],_0x49b662[_0xb3af('0x5c')][_0xb3af('0x64')],_0x5d81ad[_0xb3af('0x76')]['id'],_0x49b662[_0xb3af('0x53')]?JSON[_0xb3af('0x25')](_0x49b662[_0xb3af('0x53')]):_0xb3af('0x65'));return respondWithRpcPromise(_0xb3af('0x78'),'rejectMessage',_0x5d81ad);}return null;})[_0xb3af('0x20')](function(_0xf8223b){var _0x1b33b5=_0xb3af('0x79')+_0xf8223b[_0xb3af('0x29')]['ContactId'];return db[_0xb3af('0x68')]['query'](_0x1b33b5,{'type':db[_0xb3af('0x69')][_0xb3af('0x6a')][_0xb3af('0x6b')],'raw':!![]})['then'](function(_0x5c2812){return _0x5c2812;});})[_0xb3af('0x20')](function(_0x6eaec9){if(_0x6eaec9){_0x5d81ad[_0xb3af('0x29')][_0xb3af('0x6c')]=_0x6eaec9[0x0];if(!_0x49b662[_0xb3af('0x53')][_0xb3af('0x5b')])return;return db[_0xb3af('0x6d')]['find']({'where':{'id':_0x49b662['body'][_0xb3af('0x5b')],'role':_0xb3af('0x5d')},'attributes':['id',_0xb3af('0x36'),_0xb3af('0x6e'),_0xb3af('0x6f'),_0xb3af('0x70')],'raw':!![]});}return null;})['then'](function(_0x3dcf8e){if(!_0x3dcf8e)return null;_0x5d81ad[_0xb3af('0x29')]['agent']=_0x3dcf8e;return _0x5d81ad;})['then'](function(_0xbb2577){if(_0xbb2577){_0xbb2577[_0xb3af('0x29')][_0xb3af('0x7a')]=util['format'](_0xb3af('0x73'),_0x49b662['user'][_0xb3af('0x36')]);_0xbb2577[_0xb3af('0x29')][_0xb3af('0x74')]=_0x5d81ad['channel'];_0xbb2577[_0xb3af('0x29')][_0xb3af('0x7b')]=_0xb3af('0x32');respondWithRpcPromise(_0xb3af('0x75'),_0xb3af('0x75'),{'event':_0xb3af('0x7c'),'message':_0xbb2577['message']},client9002);return _0x5d81ad;}return null;})['then'](respondWithResult(_0x3cda5e,null))['catch'](handleError(_0x3cda5e,null));};exports['create']=function(_0x4b55a1,_0x38ee09){var _0x2bed9a;return db[_0xb3af('0x38')][_0xb3af('0x7d')](_0x4b55a1[_0xb3af('0x53')],{})['then'](function(_0x29ca9c){_0x2bed9a=_0x29ca9c;return db['CmContact'][_0xb3af('0x7e')]({'where':{'id':_0x2bed9a[_0xb3af('0x7f')]}});})['then'](function(_0x3696e0){if(_[_0xb3af('0x60')](_0x3696e0)){return;}else{_0x2bed9a['fax']=_0x3696e0['fax'];return db['Attachment']['findOne']({'where':{'id':_0x2bed9a['AttachmentId']}});}})[_0xb3af('0x20')](function(_0x3c84ed){return respondWithRpcPromise(_0xb3af('0x80'),_0xb3af('0x80'),{'FaxAccountId':_['isNil'](_0x4b55a1[_0xb3af('0x53')])?undefined:_0x4b55a1[_0xb3af('0x53')][_0xb3af('0x81')],'path':_[_0xb3af('0x60')](_0x3c84ed)?undefined:util['format']('/var/opt/motion2/server/files/attachments/%s',_0x3c84ed['basename']),'fax':_['isNil'](_0x2bed9a[_0xb3af('0x57')])?undefined:_0x2bed9a[_0xb3af('0x57')],'AttachmentId':_0x2bed9a[_0xb3af('0x82')]},client9002);})[_0xb3af('0x20')](respondWithResult(_0x38ee09,0xc9))['catch'](handleError(_0x38ee09,null));};exports[_0xb3af('0x83')]=function(_0x3b1b7e,_0x1b9a5d){var _0x4883ca=path[_0xb3af('0x84')](config['root'],_0xb3af('0x85'),'files',_0xb3af('0x86'));return db['FaxMessage'][_0xb3af('0x54')]({'where':{'id':_0x3b1b7e[_0xb3af('0x51')]['id']},'include':[{'model':db[_0xb3af('0x87')],'as':'Attachment'}]})[_0xb3af('0x20')](handleEntityNotFound(_0x1b9a5d,null))['then'](function(_0x113ede){if(_0x113ede){return _0x1b9a5d[_0xb3af('0x83')](path[_0xb3af('0x84')](_0x4883ca,_0x113ede[_0xb3af('0x87')][_0xb3af('0x88')]));}})[_0xb3af('0x2a')](handleError(_0x1b9a5d,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 422c0c8..1b52a7e 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 _0x3641=['../../mysqldb','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x4d5b5e,_0x279432){var _0x244882=function(_0x4cb892){while(--_0x4cb892){_0x4d5b5e['push'](_0x4d5b5e['shift']());}};_0x244882(++_0x279432);}(_0x3641,0x173));var _0x1364=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3641[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0x1364('0x0'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1364('0x1'),'afterUpdate':_0x1364('0x2'),'afterDestroy':'remove'};function emitEvent(_0x435684){return function(_0x4a9034,_0x3d14e0,_0x4e41b7){FaxMessageEvents[_0x1364('0x3')](_0x435684+':'+_0x4a9034['id'],_0x4a9034);FaxMessageEvents['emit'](_0x435684,_0x4a9034);_0x4e41b7(null);};}for(var e in events){if(events[_0x1364('0x4')](e)){var event=events[e];FaxMessage[_0x1364('0x5')](e,emitEvent(event));}}module[_0x1364('0x6')]=FaxMessageEvents; \ No newline at end of file +var _0x4317=['remove','hasOwnProperty','hook','exports','../../mysqldb','FaxMessage','setMaxListeners','update'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x4317,0x7c));var _0x7431=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x4317[_0x4cf98e];return _0x1623ac;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0x7431('0x0'))['db'][_0x7431('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x7431('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7431('0x3'),'afterDestroy':_0x7431('0x4')};function emitEvent(_0x290b11){return function(_0xa4197b,_0x12c492,_0x201287){FaxMessageEvents['emit'](_0x290b11+':'+_0xa4197b['id'],_0xa4197b);FaxMessageEvents['emit'](_0x290b11,_0xa4197b);_0x201287(null);};}for(var e in events){if(events[_0x7431('0x5')](e)){var event=events[e];FaxMessage[_0x7431('0x6')](e,emitEvent(event));}}module[_0x7431('0x7')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 5a96995..184a1df 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 _0x48f9=['FULLTEXT','models','get','direction','toLowerCase','out','isNil','FaxInteraction','findOne','FaxInteractionId','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./faxMessage.attributes','exports','define','fax_messages','fti_fax_messages','body'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x48f9,0x196));var _0x948f=function(_0x540615,_0x44757d){_0x540615=_0x540615-0x0;var _0x5818e3=_0x48f9[_0x540615];return _0x5818e3;};'use strict';var _=require(_0x948f('0x0'));var util=require(_0x948f('0x1'));var logger=require(_0x948f('0x2'))(_0x948f('0x3'));var moment=require('moment');var BPromise=require(_0x948f('0x4'));var rp=require(_0x948f('0x5'));var fs=require('fs');var path=require(_0x948f('0x6'));var rimraf=require(_0x948f('0x7'));var config=require('../../config/environment');var attributes=require(_0x948f('0x8'));module[_0x948f('0x9')]=function(_0x8f6457,_0x1cf7ea){return _0x8f6457[_0x948f('0xa')]('FaxMessage',attributes,{'tableName':_0x948f('0xb'),'paranoid':![],'indexes':[{'name':_0x948f('0xc'),'fields':[_0x948f('0xd')],'type':_0x948f('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5fe412,_0x57be39,_0x6627bf){var _0x4d81f4=_0x8f6457[_0x948f('0xf')];var _0x5e907b=_0x5fe412[_0x948f('0x10')]({'plain':!![]});if(_0x5e907b[_0x948f('0x11')][_0x948f('0x12')]()==='in'||_0x5e907b[_0x948f('0x11')][_0x948f('0x12')]()===_0x948f('0x13')&&!_0x5e907b['secret']&&!_[_0x948f('0x14')](_0x5e907b['UserId'])){_0x4d81f4[_0x948f('0x15')][_0x948f('0x16')]({'where':{'id':_0x5e907b[_0x948f('0x17')]}})['then'](function(_0x42dfa3){if(_0x42dfa3){_0x42dfa3[_0x948f('0x18')]({'lastMsgAt':_0x5e907b[_0x948f('0x19')],'lastMsgDirection':_0x5e907b[_0x948f('0x11')][_0x948f('0x12')]()});}})[_0x948f('0x1a')](function(_0x29c253){console[_0x948f('0x1b')](_0x29c253);});}_0x6627bf();}},'charset':_0x948f('0x1c'),'collate':_0x948f('0x1d')});}; \ No newline at end of file +var _0xcf2a=['update','createdAt','catch','error','utf8mb4_unicode_ci','util','moment','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then'];(function(_0x20d400,_0x417891){var _0x3a99ab=function(_0x576274){while(--_0x576274){_0x20d400['push'](_0x20d400['shift']());}};_0x3a99ab(++_0x417891);}(_0xcf2a,0x1a9));var _0xacf2=function(_0x2fee96,_0x2f735d){_0x2fee96=_0x2fee96-0x0;var _0x2e6ad1=_0xcf2a[_0x2fee96];return _0x2e6ad1;};'use strict';var _=require('lodash');var util=require(_0xacf2('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xacf2('0x1'));var BPromise=require('bluebird');var rp=require(_0xacf2('0x2'));var fs=require('fs');var path=require(_0xacf2('0x3'));var rimraf=require(_0xacf2('0x4'));var config=require(_0xacf2('0x5'));var attributes=require(_0xacf2('0x6'));module[_0xacf2('0x7')]=function(_0x18c7d2,_0x1fd5f6){return _0x18c7d2[_0xacf2('0x8')](_0xacf2('0x9'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0xacf2('0xa'),'fields':[_0xacf2('0xb')],'type':_0xacf2('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1c5e25,_0x23721b,_0xb4158){var _0x3285bf=_0x18c7d2[_0xacf2('0xd')];var _0x533378=_0x1c5e25[_0xacf2('0xe')]({'plain':!![]});if(_0x533378[_0xacf2('0xf')][_0xacf2('0x10')]()==='in'||_0x533378['direction']['toLowerCase']()==='out'&&!_0x533378['secret']&&!_[_0xacf2('0x11')](_0x533378[_0xacf2('0x12')])){_0x3285bf[_0xacf2('0x13')][_0xacf2('0x14')]({'where':{'id':_0x533378[_0xacf2('0x15')]}})[_0xacf2('0x16')](function(_0x15012e){if(_0x15012e){_0x15012e[_0xacf2('0x17')]({'lastMsgAt':_0x533378[_0xacf2('0x18')],'lastMsgDirection':_0x533378[_0xacf2('0xf')][_0xacf2('0x10')]()});}})[_0xacf2('0x19')](function(_0x45419b){console[_0xacf2('0x1a')](_0x45419b);});}_0xb4158();}},'charset':'utf8mb4','collate':_0xacf2('0x1b')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 48e24e4..623c9fc 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 _0xe5b3=['FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateFaxMessage','FaxMessage','create','body','options','raw','catch','UpdateFaxMessage','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','then','info'];(function(_0x9ba343,_0x5ea719){var _0x40e5bb=function(_0x4808df){while(--_0x4808df){_0x9ba343['push'](_0x9ba343['shift']());}};_0x40e5bb(++_0x5ea719);}(_0xe5b3,0x133));var _0x3e5b=function(_0x343b78,_0x42394d){_0x343b78=_0x343b78-0x0;var _0x5869c5=_0xe5b3[_0x343b78];return _0x5869c5;};'use strict';var _=require('lodash');var util=require(_0x3e5b('0x0'));var moment=require(_0x3e5b('0x1'));var BPromise=require(_0x3e5b('0x2'));var rs=require(_0x3e5b('0x3'));var fs=require('fs');var Redis=require(_0x3e5b('0x4'));var db=require(_0x3e5b('0x5'))['db'];var utils=require(_0x3e5b('0x6'));var logger=require(_0x3e5b('0x7'))(_0x3e5b('0x8'));var config=require(_0x3e5b('0x9'));var jayson=require(_0x3e5b('0xa'));var client=jayson['client'][_0x3e5b('0xb')]({'port':0x232a});config[_0x3e5b('0xc')]=_['defaults'](config[_0x3e5b('0xc')],{'host':_0x3e5b('0xd'),'port':0x18eb});var socket=require(_0x3e5b('0xe'))(new Redis(config[_0x3e5b('0xc')]));require('./faxMessage.socket')['register'](socket);function respondWithRpcPromise(_0x1fef54,_0x3d3b6e,_0x22fc1a){return new BPromise(function(_0x17dee7,_0xeeaabc){return client['request'](_0x1fef54,_0x22fc1a)[_0x3e5b('0xf')](function(_0x52efbd){logger[_0x3e5b('0x10')](_0x3e5b('0x11'),_0x3d3b6e,_0x3e5b('0x12'));logger[_0x3e5b('0x13')](_0x3e5b('0x14'),_0x3d3b6e,_0x3e5b('0x12'),JSON[_0x3e5b('0x15')](_0x52efbd));if(_0x52efbd['error']){if(_0x52efbd[_0x3e5b('0x16')]['code']===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x3d3b6e,_0x52efbd[_0x3e5b('0x16')][_0x3e5b('0x17')]);return _0xeeaabc(_0x52efbd[_0x3e5b('0x16')]['message']);}logger[_0x3e5b('0x16')]('FaxMessage,\x20%s,\x20%s',_0x3d3b6e,_0x52efbd['error'][_0x3e5b('0x17')]);return _0x17dee7(_0x52efbd[_0x3e5b('0x16')]['message']);}else{logger[_0x3e5b('0x10')](_0x3e5b('0x11'),_0x3d3b6e,'request\x20sent');_0x17dee7(_0x52efbd[_0x3e5b('0x18')][_0x3e5b('0x17')]);}})['catch'](function(_0x4b189d){logger[_0x3e5b('0x16')](_0x3e5b('0x11'),_0x3d3b6e,_0x4b189d);_0xeeaabc(_0x4b189d);});});}exports[_0x3e5b('0x19')]=function(_0xff4aba){var _0x24de5b=this;return new Promise(function(_0x1564b5,_0x447d36){return db[_0x3e5b('0x1a')][_0x3e5b('0x1b')](_0xff4aba[_0x3e5b('0x1c')],{'raw':_0xff4aba[_0x3e5b('0x1d')]?_0xff4aba[_0x3e5b('0x1d')][_0x3e5b('0x1e')]===undefined?!![]:![]:!![]})[_0x3e5b('0xf')](function(_0x5b46d4){logger[_0x3e5b('0x10')](_0x3e5b('0x19'),_0xff4aba);logger[_0x3e5b('0x13')](_0x3e5b('0x19'),_0xff4aba,JSON['stringify'](_0x5b46d4));_0x1564b5(_0x5b46d4);})[_0x3e5b('0x1f')](function(_0x5b33bb){logger[_0x3e5b('0x16')](_0x3e5b('0x19'),_0x5b33bb['message'],_0xff4aba);_0x447d36(_0x24de5b[_0x3e5b('0x16')](0x1f4,_0x5b33bb[_0x3e5b('0x17')]));});});};exports[_0x3e5b('0x20')]=function(_0x3c8965){var _0x3bb749=this;return new Promise(function(_0x26c7f2,_0x160e87){return db[_0x3e5b('0x1a')]['update'](_0x3c8965[_0x3e5b('0x1c')],{'raw':_0x3c8965['options']?_0x3c8965[_0x3e5b('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c8965[_0x3e5b('0x1d')]?_0x3c8965[_0x3e5b('0x1d')][_0x3e5b('0x21')]||null:null,'attributes':_0x3c8965[_0x3e5b('0x1d')]?_0x3c8965[_0x3e5b('0x1d')][_0x3e5b('0x22')]||null:null,'limit':_0x3c8965[_0x3e5b('0x1d')]?_0x3c8965[_0x3e5b('0x1d')][_0x3e5b('0x23')]||null:null})[_0x3e5b('0xf')](function(_0x1e1565){logger['info'](_0x3e5b('0x20'),_0x3c8965);logger[_0x3e5b('0x13')](_0x3e5b('0x20'),_0x3c8965,JSON[_0x3e5b('0x15')](_0x1e1565));_0x26c7f2(_0x1e1565);})[_0x3e5b('0x1f')](function(_0x31e9f9){logger[_0x3e5b('0x16')]('UpdateFaxMessage',_0x31e9f9[_0x3e5b('0x17')],_0x3c8965);_0x160e87(_0x3bb749['error'](0x1f4,_0x31e9f9['message']));});});}; \ No newline at end of file +var _0xac31=['attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','redis','defaults','socket.io-emitter','./faxMessage.socket','register','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateFaxMessage','FaxMessage','create','body','options','raw','UpdateFaxMessage','update','where'];(function(_0x112632,_0x5763c1){var _0x4137a0=function(_0x17563c){while(--_0x17563c){_0x112632['push'](_0x112632['shift']());}};_0x4137a0(++_0x5763c1);}(_0xac31,0xca));var _0x1ac3=function(_0x4e2ed8,_0x4e7bb2){_0x4e2ed8=_0x4e2ed8-0x0;var _0x15de1d=_0xac31[_0x4e2ed8];return _0x15de1d;};'use strict';var _=require(_0x1ac3('0x0'));var util=require(_0x1ac3('0x1'));var moment=require(_0x1ac3('0x2'));var BPromise=require(_0x1ac3('0x3'));var rs=require(_0x1ac3('0x4'));var fs=require('fs');var Redis=require(_0x1ac3('0x5'));var db=require(_0x1ac3('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1ac3('0x7'))(_0x1ac3('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1ac3('0x9')][_0x1ac3('0xa')]({'port':0x232a});config[_0x1ac3('0xb')]=_[_0x1ac3('0xc')](config[_0x1ac3('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x1ac3('0xd'))(new Redis(config['redis']));require(_0x1ac3('0xe'))[_0x1ac3('0xf')](socket);function respondWithRpcPromise(_0x344674,_0x53500b,_0xa26c88){return new BPromise(function(_0x1e2642,_0x3e835b){return client[_0x1ac3('0x10')](_0x344674,_0xa26c88)[_0x1ac3('0x11')](function(_0x422d19){logger['info'](_0x1ac3('0x12'),_0x53500b,_0x1ac3('0x13'));logger[_0x1ac3('0x14')](_0x1ac3('0x15'),_0x53500b,'request\x20sent',JSON[_0x1ac3('0x16')](_0x422d19));if(_0x422d19[_0x1ac3('0x17')]){if(_0x422d19[_0x1ac3('0x17')][_0x1ac3('0x18')]===0x1f4){logger['error'](_0x1ac3('0x12'),_0x53500b,_0x422d19[_0x1ac3('0x17')]['message']);return _0x3e835b(_0x422d19[_0x1ac3('0x17')][_0x1ac3('0x19')]);}logger[_0x1ac3('0x17')]('FaxMessage,\x20%s,\x20%s',_0x53500b,_0x422d19[_0x1ac3('0x17')][_0x1ac3('0x19')]);return _0x1e2642(_0x422d19[_0x1ac3('0x17')]['message']);}else{logger[_0x1ac3('0x1a')]('FaxMessage,\x20%s,\x20%s',_0x53500b,_0x1ac3('0x13'));_0x1e2642(_0x422d19[_0x1ac3('0x1b')][_0x1ac3('0x19')]);}})[_0x1ac3('0x1c')](function(_0x18b985){logger['error'](_0x1ac3('0x12'),_0x53500b,_0x18b985);_0x3e835b(_0x18b985);});});}exports[_0x1ac3('0x1d')]=function(_0x296abf){var _0x257f60=this;return new Promise(function(_0x5f1918,_0x48d18a){return db[_0x1ac3('0x1e')][_0x1ac3('0x1f')](_0x296abf[_0x1ac3('0x20')],{'raw':_0x296abf[_0x1ac3('0x21')]?_0x296abf[_0x1ac3('0x21')][_0x1ac3('0x22')]===undefined?!![]:![]:!![]})[_0x1ac3('0x11')](function(_0x10912a){logger[_0x1ac3('0x1a')]('CreateFaxMessage',_0x296abf);logger[_0x1ac3('0x14')](_0x1ac3('0x1d'),_0x296abf,JSON['stringify'](_0x10912a));_0x5f1918(_0x10912a);})[_0x1ac3('0x1c')](function(_0x10f30c){logger['error'](_0x1ac3('0x1d'),_0x10f30c[_0x1ac3('0x19')],_0x296abf);_0x48d18a(_0x257f60[_0x1ac3('0x17')](0x1f4,_0x10f30c[_0x1ac3('0x19')]));});});};exports[_0x1ac3('0x23')]=function(_0x565a0f){var _0x5a2ab2=this;return new Promise(function(_0x503a64,_0x528807){return db['FaxMessage'][_0x1ac3('0x24')](_0x565a0f['body'],{'raw':_0x565a0f[_0x1ac3('0x21')]?_0x565a0f[_0x1ac3('0x21')][_0x1ac3('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x565a0f[_0x1ac3('0x21')]?_0x565a0f['options'][_0x1ac3('0x25')]||null:null,'attributes':_0x565a0f['options']?_0x565a0f[_0x1ac3('0x21')][_0x1ac3('0x26')]||null:null,'limit':_0x565a0f[_0x1ac3('0x21')]?_0x565a0f[_0x1ac3('0x21')][_0x1ac3('0x27')]||null:null})[_0x1ac3('0x11')](function(_0x9c17c2){logger['info'](_0x1ac3('0x23'),_0x565a0f);logger[_0x1ac3('0x14')](_0x1ac3('0x23'),_0x565a0f,JSON[_0x1ac3('0x16')](_0x9c17c2));_0x503a64(_0x9c17c2);})['catch'](function(_0x3591a9){logger[_0x1ac3('0x17')](_0x1ac3('0x23'),_0x3591a9[_0x1ac3('0x19')],_0x565a0f);_0x528807(_0x5a2ab2[_0x1ac3('0x17')](0x1f4,_0x3591a9['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 22d68c1..a1e3c4b 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 _0x7dcc=['./faxMessage.events','save','remove','update','removeListener','length','faxMessage:'];(function(_0x283b97,_0x2dd687){var _0xe5cbb9=function(_0xaf9f4a){while(--_0xaf9f4a){_0x283b97['push'](_0x283b97['shift']());}};_0xe5cbb9(++_0x2dd687);}(_0x7dcc,0xbd));var _0xc7dc=function(_0x304bd5,_0xea943d){_0x304bd5=_0x304bd5-0x0;var _0x2bcd87=_0x7dcc[_0x304bd5];return _0x2bcd87;};'use strict';var FaxMessageEvents=require(_0xc7dc('0x0'));var events=[_0xc7dc('0x1'),_0xc7dc('0x2'),_0xc7dc('0x3')];function createListener(_0x1bf633,_0x53b1b1){return function(_0x277483){_0x53b1b1['emit'](_0x1bf633,_0x277483);};}function removeListener(_0x58c9c1,_0x5aa471){return function(){FaxMessageEvents[_0xc7dc('0x4')](_0x58c9c1,_0x5aa471);};}exports['register']=function(_0x53ef19){for(var _0x4c4c9d=0x0,_0x1211af=events[_0xc7dc('0x5')];_0x4c4c9d<_0x1211af;_0x4c4c9d++){var _0x138ea7=events[_0x4c4c9d];var _0x421938=createListener(_0xc7dc('0x6')+_0x138ea7,_0x53ef19);FaxMessageEvents['on'](_0x138ea7,_0x421938);}}; \ No newline at end of file +var _0xe657=['remove','update','emit','register','length','faxMessage:','./faxMessage.events'];(function(_0x3f2d02,_0x2c7deb){var _0x54092b=function(_0x427ff8){while(--_0x427ff8){_0x3f2d02['push'](_0x3f2d02['shift']());}};_0x54092b(++_0x2c7deb);}(_0xe657,0x7d));var _0x7e65=function(_0xa70c8a,_0x5f1334){_0xa70c8a=_0xa70c8a-0x0;var _0x3ad556=_0xe657[_0xa70c8a];return _0x3ad556;};'use strict';var FaxMessageEvents=require(_0x7e65('0x0'));var events=['save',_0x7e65('0x1'),_0x7e65('0x2')];function createListener(_0x2f29a0,_0xafcaae){return function(_0x365743){_0xafcaae[_0x7e65('0x3')](_0x2f29a0,_0x365743);};}function removeListener(_0x2b3da8,_0x3b5278){return function(){FaxMessageEvents['removeListener'](_0x2b3da8,_0x3b5278);};}exports[_0x7e65('0x4')]=function(_0x2c3c8a){for(var _0x589914=0x0,_0x1612db=events[_0x7e65('0x5')];_0x589914<_0x1612db;_0x589914++){var _0x495ab0=events[_0x589914];var _0x51b517=createListener(_0x7e65('0x6')+_0x495ab0,_0x2c3c8a);FaxMessageEvents['on'](_0x495ab0,_0x51b517);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index cfdd05f..3bd8fdf 100644 --- a/server/api/faxMessage/index.js +++ b/server/api/faxMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x593e=['../../components/auth/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','show','download','post','fax','faxmessage:create','create','put','/:id','update','/:id/accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x54ed00,_0x253ac2){var _0x2f9a44=function(_0x38bfb4){while(--_0x38bfb4){_0x54ed00['push'](_0x54ed00['shift']());}};_0x2f9a44(++_0x253ac2);}(_0x593e,0xcb));var _0xe593=function(_0x3f03f0,_0x40ceaa){_0x3f03f0=_0x3f03f0-0x0;var _0x76066b=_0x593e[_0x3f03f0];return _0x76066b;};'use strict';var multer=require(_0xe593('0x0'));var util=require(_0xe593('0x1'));var path=require(_0xe593('0x2'));var timeout=require(_0xe593('0x3'));var express=require(_0xe593('0x4'));var router=express[_0xe593('0x5')]();var fs_extra=require(_0xe593('0x6'));var auth=require(_0xe593('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xe593('0x8'));var controller=require(_0xe593('0x9'));router[_0xe593('0xa')]('/',auth[_0xe593('0xb')](),controller[_0xe593('0xc')]);router[_0xe593('0xa')](_0xe593('0xd'),auth[_0xe593('0xb')](),controller[_0xe593('0xe')]);router[_0xe593('0xa')]('/:id',auth[_0xe593('0xb')](),controller[_0xe593('0xf')]);router[_0xe593('0xa')]('/:id/download',auth['isAuthenticated'](),controller[_0xe593('0x10')]);router[_0xe593('0x11')]('/',auth[_0xe593('0xb')](),interaction['tracked'](_0xe593('0x12'),_0xe593('0x13')),controller[_0xe593('0x14')]);router[_0xe593('0x15')](_0xe593('0x16'),auth[_0xe593('0xb')](),controller[_0xe593('0x17')]);router[_0xe593('0x15')](_0xe593('0x18'),auth[_0xe593('0xb')](),controller['accept']);router[_0xe593('0x15')](_0xe593('0x19'),auth['isAuthenticated'](),controller[_0xe593('0x1a')]);router[_0xe593('0x1b')]('/:id',auth[_0xe593('0xb')](),controller[_0xe593('0x1c')]);module[_0xe593('0x1d')]=router; \ No newline at end of file +var _0xa75b=['get','isAuthenticated','index','/describe','show','/:id/download','download','post','tracked','fax','faxmessage:create','create','put','/:id','/:id/accept','accept','/:id/reject','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller'];(function(_0x487b4a,_0xcfec84){var _0x36e2ce=function(_0x3f64e7){while(--_0x3f64e7){_0x487b4a['push'](_0x487b4a['shift']());}};_0x36e2ce(++_0xcfec84);}(_0xa75b,0x170));var _0xba75=function(_0x2472cd,_0x7fc036){_0x2472cd=_0x2472cd-0x0;var _0x10bdb4=_0xa75b[_0x2472cd];return _0x10bdb4;};'use strict';var multer=require(_0xba75('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xba75('0x1'));var express=require(_0xba75('0x2'));var router=express[_0xba75('0x3')]();var fs_extra=require(_0xba75('0x4'));var auth=require(_0xba75('0x5'));var interaction=require(_0xba75('0x6'));var config=require(_0xba75('0x7'));var controller=require(_0xba75('0x8'));router[_0xba75('0x9')]('/',auth[_0xba75('0xa')](),controller[_0xba75('0xb')]);router[_0xba75('0x9')](_0xba75('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xba75('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xba75('0xd')]);router['get'](_0xba75('0xe'),auth[_0xba75('0xa')](),controller[_0xba75('0xf')]);router[_0xba75('0x10')]('/',auth[_0xba75('0xa')](),interaction[_0xba75('0x11')](_0xba75('0x12'),_0xba75('0x13')),controller[_0xba75('0x14')]);router[_0xba75('0x15')](_0xba75('0x16'),auth[_0xba75('0xa')](),controller['update']);router['put'](_0xba75('0x17'),auth['isAuthenticated'](),controller[_0xba75('0x18')]);router[_0xba75('0x15')](_0xba75('0x19'),auth[_0xba75('0xa')](),controller['reject']);router[_0xba75('0x1a')](_0xba75('0x16'),auth[_0xba75('0xa')](),controller[_0xba75('0x1b')]);module[_0xba75('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index eb5dc59..2fa9404 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 _0x121d=['sequelize','exports','name','STRING','INTEGER','ENUM','rrmemory','beepall'];(function(_0x5466ab,_0x227b13){var _0x40751a=function(_0x477f9e){while(--_0x477f9e){_0x5466ab['push'](_0x5466ab['shift']());}};_0x40751a(++_0x227b13);}(_0x121d,0xf0));var _0xd121=function(_0x4a1b83,_0x489314){_0x4a1b83=_0x4a1b83-0x0;var _0x3233e4=_0x121d[_0x4a1b83];return _0x3233e4;};'use strict';var Sequelize=require(_0xd121('0x0'));module[_0xd121('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xd121('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd121('0x3')]},'timeout':{'type':Sequelize[_0xd121('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd121('0x5')](_0xd121('0x6'),_0xd121('0x7'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xd121('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9632=['exports','STRING','name','INTEGER','ENUM','roundrobin','sequelize'];(function(_0x906f8a,_0x452fbd){var _0x2d29ef=function(_0x27b8ef){while(--_0x27b8ef){_0x906f8a['push'](_0x906f8a['shift']());}};_0x2d29ef(++_0x452fbd);}(_0x9632,0x109));var _0x2963=function(_0x55736c,_0x59ca0b){_0x55736c=_0x55736c-0x0;var _0x3581e7=_0x9632[_0x55736c];return _0x3581e7;};'use strict';var Sequelize=require(_0x2963('0x0'));module[_0x2963('0x1')]={'name':{'type':Sequelize[_0x2963('0x2')],'unique':_0x2963('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2963('0x2')]},'timeout':{'type':Sequelize[_0x2963('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2963('0x5')]('rrmemory','beepall',_0x2963('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x2963('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index c0ef663..a3a1a49 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 _0x938d=['clone','ut.UserId\x20=\x20?','push','SELECT','every','TeamId','all','compact','value','removeTeams','isEmpty','removeAgents','forEach','userFaxQueue:remove','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','stack','name','send','index','map','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','type','VIRTUAL','merge','FaxQueue','includeAll','include','findAll','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','FaxQueues','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','findOne','UserFaxQueue','nolimit','order','FaxQueueId','options','User','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','rows','SIP','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','emit','userFaxQueue:save','select','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId'];(function(_0xb9622e,_0x91225d){var _0x12969e=function(_0x5e8b52){while(--_0x5e8b52){_0xb9622e['push'](_0xb9622e['shift']());}};_0x12969e(++_0x91225d);}(_0x938d,0x1b6));var _0xd938=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x938d[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xd938('0x0'));var rimraf=require(_0xd938('0x1'));var zipdir=require(_0xd938('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd938('0x3'));var moment=require(_0xd938('0x4'));var BPromise=require(_0xd938('0x5'));var Mustache=require(_0xd938('0x6'));var util=require(_0xd938('0x7'));var path=require('path');var sox=require(_0xd938('0x8'));var csv=require(_0xd938('0x9'));var ejs=require(_0xd938('0xa'));var fs=require('fs');var fs_extra=require(_0xd938('0xb'));var _=require('lodash');var squel=require(_0xd938('0xc'));var crypto=require(_0xd938('0xd'));var jsforce=require(_0xd938('0xe'));var deskjs=require(_0xd938('0xf'));var toCsv=require(_0xd938('0x9'));var querystring=require('querystring');var Papa=require(_0xd938('0x10'));var Redis=require(_0xd938('0x11'));var authService=require(_0xd938('0x12'));var qs=require(_0xd938('0x13'));var as=require(_0xd938('0x14'));var hardwareService=require(_0xd938('0x15'));var logger=require(_0xd938('0x16'))(_0xd938('0x17'));var utils=require(_0xd938('0x18'));var config=require(_0xd938('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xd938('0x1a'))['db'];config[_0xd938('0x1b')]=_['defaults'](config['redis'],{'host':_0xd938('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd938('0x1b')]));require('./faxQueue.socket')[_0xd938('0x1d')](socket);function respondWithStatusCode(_0x13e5e6,_0x45bdd1){_0x45bdd1=_0x45bdd1||0xcc;return function(_0x3ad9e3){if(_0x3ad9e3){return _0x13e5e6[_0xd938('0x1e')](_0x45bdd1);}return _0x13e5e6[_0xd938('0x1f')](_0x45bdd1)[_0xd938('0x20')]();};}function respondWithResult(_0x2a0a54,_0x58af04){_0x58af04=_0x58af04||0xc8;return function(_0x5be4ea){if(_0x5be4ea){return _0x2a0a54[_0xd938('0x1f')](_0x58af04)[_0xd938('0x21')](_0x5be4ea);}};}function respondWithFilteredResult(_0xc78e39,_0x40e3de){return function(_0xd7e41f){if(_0xd7e41f){var _0x3a4abd=typeof _0x40e3de[_0xd938('0x22')]===_0xd938('0x23')&&typeof _0x40e3de[_0xd938('0x24')]===_0xd938('0x23');var _0xeeb1ba=_0xd7e41f[_0xd938('0x25')];var _0x4f1b05=_0x3a4abd?0x0:_0x40e3de['offset'];var _0x37e0de=_0x3a4abd?_0xd7e41f[_0xd938('0x25')]:_0x40e3de[_0xd938('0x22')]+_0x40e3de[_0xd938('0x24')];var _0x220add;if(_0x37e0de>=_0xeeb1ba){_0x37e0de=_0xeeb1ba;_0x220add=0xc8;}else{_0x220add=0xce;}_0xc78e39[_0xd938('0x1f')](_0x220add);return _0xc78e39['set'](_0xd938('0x26'),_0x4f1b05+'-'+_0x37e0de+'/'+_0xeeb1ba)[_0xd938('0x21')](_0xd7e41f);}return null;};}function patchUpdates(_0x2c8183){return function(_0x14e270){try{jsonpatch[_0xd938('0x27')](_0x14e270,_0x2c8183,!![]);}catch(_0x620ad0){return BPromise[_0xd938('0x28')](_0x620ad0);}return _0x14e270[_0xd938('0x29')]();};}function saveUpdates(_0x9d4c44,_0x3a31bf){return function(_0x39684c){if(_0x39684c){return _0x39684c['update'](_0x9d4c44)[_0xd938('0x2a')](function(_0x4a320){return _0x4a320;});}return null;};}function removeEntity(_0x39a74e,_0x505a9c){return function(_0x2d6859){if(_0x2d6859){return _0x2d6859[_0xd938('0x2b')]()['then'](function(){var _0xc280f3=_0x2d6859[_0xd938('0x2c')]({'plain':!![]});var _0x146147='FaxQueues';return db[_0xd938('0x2d')][_0xd938('0x2b')]({'where':{'type':_0x146147,'resourceId':_0xc280f3['id']}})[_0xd938('0x2a')](function(){return _0x2d6859;});})[_0xd938('0x2a')](function(){_0x39a74e['status'](0xcc)[_0xd938('0x20')]();});}};}function handleEntityNotFound(_0x4fac3a,_0x9ce759){return function(_0x3ff34a){if(!_0x3ff34a){_0x4fac3a[_0xd938('0x1e')](0x194);}return _0x3ff34a;};}function handleError(_0x36e0a3,_0x2650d4){_0x2650d4=_0x2650d4||0x1f4;return function(_0x3cfd58){logger['error'](_0x3cfd58[_0xd938('0x2e')]);if(_0x3cfd58[_0xd938('0x2f')]){delete _0x3cfd58[_0xd938('0x2f')];}_0x36e0a3['status'](_0x2650d4)[_0xd938('0x30')](_0x3cfd58);};}exports[_0xd938('0x31')]=function(_0x2129a0,_0x56fc7a){var _0x5e9ed4={},_0x5a3c62={},_0xe6bfa2={'count':0x0,'rows':[]};var _0x189a17=_[_0xd938('0x32')](db['FaxQueue'][_0xd938('0x33')],function(_0x5edbac){return{'name':_0x5edbac['fieldName'],'type':_0x5edbac['type'][_0xd938('0x34')]};});_0x5a3c62[_0xd938('0x35')]=_['map'](_0x189a17,_0xd938('0x2f'));_0x5a3c62[_0xd938('0x36')]=_[_0xd938('0x37')](_0x2129a0[_0xd938('0x36')]);_0x5a3c62[_0xd938('0x38')]=_[_0xd938('0x39')](_0x5a3c62[_0xd938('0x35')],_0x5a3c62['query']);_0x5e9ed4['attributes']=_[_0xd938('0x39')](_0x5a3c62[_0xd938('0x35')],qs[_0xd938('0x3a')](_0x2129a0[_0xd938('0x36')]['fields']));_0x5e9ed4[_0xd938('0x3b')]=_0x5e9ed4[_0xd938('0x3b')][_0xd938('0x3c')]?_0x5e9ed4['attributes']:_0x5a3c62[_0xd938('0x35')];if(!_0x2129a0[_0xd938('0x36')][_0xd938('0x3d')]('nolimit')){_0x5e9ed4[_0xd938('0x24')]=qs[_0xd938('0x24')](_0x2129a0['query'][_0xd938('0x24')]);_0x5e9ed4['offset']=qs[_0xd938('0x22')](_0x2129a0['query'][_0xd938('0x22')]);}_0x5e9ed4['order']=qs[_0xd938('0x3e')](_0x2129a0['query'][_0xd938('0x3e')]);_0x5e9ed4[_0xd938('0x3f')]=qs[_0xd938('0x38')](_[_0xd938('0x40')](_0x2129a0['query'],_0x5a3c62[_0xd938('0x38')]),_0x189a17);if(_0x2129a0[_0xd938('0x36')][_0xd938('0x41')]){_0x5e9ed4[_0xd938('0x3f')]=_['merge'](_0x5e9ed4[_0xd938('0x3f')],{'$or':_[_0xd938('0x32')](_0x189a17,function(_0xfb7168){if(_0xfb7168[_0xd938('0x42')]!==_0xd938('0x43')){var _0x244d74={};_0x244d74[_0xfb7168['name']]={'$like':'%'+_0x2129a0[_0xd938('0x36')][_0xd938('0x41')]+'%'};return _0x244d74;}})});}_0x5e9ed4=_[_0xd938('0x44')]({},_0x5e9ed4,_0x2129a0['options']);var _0x431a95={'where':_0x5e9ed4[_0xd938('0x3f')]};return db[_0xd938('0x45')][_0xd938('0x25')](_0x431a95)[_0xd938('0x2a')](function(_0x256764){_0xe6bfa2[_0xd938('0x25')]=_0x256764;if(_0x2129a0[_0xd938('0x36')][_0xd938('0x46')]){_0x5e9ed4[_0xd938('0x47')]=[{'all':!![]}];}return db[_0xd938('0x45')][_0xd938('0x48')](_0x5e9ed4);})[_0xd938('0x2a')](function(_0x27e188){_0xe6bfa2['rows']=_0x27e188;return _0xe6bfa2;})[_0xd938('0x2a')](respondWithFilteredResult(_0x56fc7a,_0x5e9ed4))[_0xd938('0x49')](handleError(_0x56fc7a,null));};exports[_0xd938('0x4a')]=function(_0x17d5f3,_0x4cce90){var _0x141e08={'raw':!![],'where':{'id':_0x17d5f3[_0xd938('0x4b')]['id']}},_0x2c4dd4={};_0x2c4dd4['model']=_[_0xd938('0x37')](db[_0xd938('0x45')][_0xd938('0x33')]);_0x2c4dd4['query']=_[_0xd938('0x37')](_0x17d5f3[_0xd938('0x36')]);_0x2c4dd4[_0xd938('0x38')]=_[_0xd938('0x39')](_0x2c4dd4[_0xd938('0x35')],_0x2c4dd4[_0xd938('0x36')]);_0x141e08[_0xd938('0x3b')]=_[_0xd938('0x39')](_0x2c4dd4[_0xd938('0x35')],qs[_0xd938('0x3a')](_0x17d5f3[_0xd938('0x36')][_0xd938('0x3a')]));_0x141e08['attributes']=_0x141e08[_0xd938('0x3b')]['length']?_0x141e08[_0xd938('0x3b')]:_0x2c4dd4[_0xd938('0x35')];if(_0x17d5f3[_0xd938('0x36')][_0xd938('0x46')]){_0x141e08[_0xd938('0x47')]=[{'all':!![]}];}_0x141e08=_[_0xd938('0x44')]({},_0x141e08,_0x17d5f3['options']);return db[_0xd938('0x45')]['find'](_0x141e08)['then'](handleEntityNotFound(_0x4cce90,null))['then'](respondWithResult(_0x4cce90,null))['catch'](handleError(_0x4cce90,null));};exports[_0xd938('0x4c')]=function(_0x3c0e53,_0x13500f){return db['FaxQueue'][_0xd938('0x4c')](_0x3c0e53[_0xd938('0x4d')],{})[_0xd938('0x2a')](function(_0x32a054){var _0x4b1a81=_0x3c0e53[_0xd938('0x4e')]['get']({'plain':!![]});if(!_0x4b1a81)throw new Error(_0xd938('0x4f'));if(_0x4b1a81['role']==='user'){var _0x2b44c1=_0x32a054[_0xd938('0x2c')]({'plain':!![]});var _0x25ed72=_0xd938('0x50');return db['UserProfileSection'][_0xd938('0x51')]({'where':{'name':_0x25ed72,'userProfileId':_0x4b1a81[_0xd938('0x52')]},'raw':!![]})[_0xd938('0x2a')](function(_0x1f5c34){if(_0x1f5c34&&_0x1f5c34[_0xd938('0x53')]===0x0){return db['UserProfileResource'][_0xd938('0x4c')]({'name':_0x2b44c1[_0xd938('0x2f')],'resourceId':_0x2b44c1['id'],'type':_0x1f5c34[_0xd938('0x2f')],'sectionId':_0x1f5c34['id']},{})[_0xd938('0x2a')](function(){return _0x32a054;});}else{return _0x32a054;}})[_0xd938('0x49')](function(_0x22584c){logger[_0xd938('0x54')](_0xd938('0x55'),_0x22584c);throw _0x22584c;});}return _0x32a054;})[_0xd938('0x2a')](respondWithResult(_0x13500f,0xc9))['catch'](handleError(_0x13500f,null));};exports[_0xd938('0x56')]=function(_0x5e7762,_0x50d36c){if(_0x5e7762[_0xd938('0x4d')]['id']){delete _0x5e7762[_0xd938('0x4d')]['id'];}return db['FaxQueue'][_0xd938('0x51')]({'where':{'id':_0x5e7762[_0xd938('0x4b')]['id']}})['then'](handleEntityNotFound(_0x50d36c,null))['then'](saveUpdates(_0x5e7762[_0xd938('0x4d')],null))[_0xd938('0x2a')](respondWithResult(_0x50d36c,null))[_0xd938('0x49')](handleError(_0x50d36c,null));};exports[_0xd938('0x2b')]=function(_0x1a3558,_0x59cd53){return db[_0xd938('0x45')][_0xd938('0x51')]({'where':{'id':_0x1a3558[_0xd938('0x4b')]['id']}})[_0xd938('0x2a')](handleEntityNotFound(_0x59cd53,null))[_0xd938('0x2a')](removeEntity(_0x59cd53,null))[_0xd938('0x49')](handleError(_0x59cd53,null));};exports[_0xd938('0x57')]=function(_0x1185c0,_0x2fb08a){return db['FaxQueue'][_0xd938('0x57')]()[_0xd938('0x2a')](respondWithResult(_0x2fb08a,null))[_0xd938('0x49')](handleError(_0x2fb08a,null));};exports['getMembers']=function(_0xee17ef,_0x3a5bdb,_0x1ecceb){var _0x1630f6={'raw':!![],'where':{}},_0x330c5d={},_0xcca3e8;return db['FaxQueue'][_0xd938('0x58')]({'where':{'id':_0xee17ef['params']['id']}})[_0xd938('0x2a')](handleEntityNotFound(_0x3a5bdb,null))[_0xd938('0x2a')](function(_0x5b901e){if(_0x5b901e){_0xcca3e8=_0x5b901e['get']({'plain':!![]});_0x330c5d[_0xd938('0x35')]=_[_0xd938('0x37')](db[_0xd938('0x59')][_0xd938('0x33')]);_0x330c5d['query']=_[_0xd938('0x37')](_0xee17ef['query']);_0x330c5d[_0xd938('0x38')]=_[_0xd938('0x39')](_0x330c5d[_0xd938('0x35')],_0x330c5d[_0xd938('0x36')]);_0x1630f6[_0xd938('0x3b')]=_[_0xd938('0x39')](_0x330c5d[_0xd938('0x35')],qs[_0xd938('0x3a')](_0xee17ef[_0xd938('0x36')]['fields']));_0x1630f6[_0xd938('0x3b')]=_0x1630f6[_0xd938('0x3b')][_0xd938('0x3c')]?_0x1630f6['attributes']:_0x330c5d[_0xd938('0x35')];if(!_0xee17ef[_0xd938('0x36')][_0xd938('0x3d')](_0xd938('0x5a'))){_0x1630f6['limit']=qs[_0xd938('0x24')](_0xee17ef[_0xd938('0x36')][_0xd938('0x24')]);_0x1630f6['offset']=qs[_0xd938('0x22')](_0xee17ef['query'][_0xd938('0x22')]);}_0x1630f6[_0xd938('0x5b')]=qs['sort'](_0xee17ef[_0xd938('0x36')][_0xd938('0x3e')]);_0x1630f6['where']=qs[_0xd938('0x38')](_[_0xd938('0x40')](_0xee17ef['query'],_0x330c5d['filters']));_0x1630f6[_0xd938('0x3f')][_0xd938('0x5c')]=_0x5b901e['id'];if(_0xee17ef[_0xd938('0x36')][_0xd938('0x41')]){_0x1630f6[_0xd938('0x3f')]=_[_0xd938('0x44')](_0x1630f6[_0xd938('0x3f')],{'$or':_[_0xd938('0x32')](_0x1630f6['attributes'],function(_0x41666a){var _0x3f19dd={};_0x3f19dd[_0x41666a]={'$like':'%'+_0xee17ef['query'][_0xd938('0x41')]+'%'};return _0x3f19dd;})});}_0x1630f6=_[_0xd938('0x44')]({},_0x1630f6,_0xee17ef[_0xd938('0x5d')]);return db[_0xd938('0x59')]['findAll'](_0x1630f6);}})[_0xd938('0x2a')](function(_0x37dfa8){if(_0x37dfa8){return db[_0xd938('0x5e')][_0xd938('0x5f')]({'where':{'id':_[_0xd938('0x32')](_0x37dfa8,_0xd938('0x60')),'role':_0xd938('0x61')},'attributes':['id','name',_0xd938('0x62'),_0xd938('0x63'),_0xd938('0x64')]});}})[_0xd938('0x2a')](function(_0x495fff){if(_0x495fff){return{'count':_0x495fff['count'],'rows':_[_0xd938('0x32')](_0x495fff[_0xd938('0x65')],function(_0x2be6c1){return{'membername':_0x2be6c1[_0xd938('0x2f')],'UserId':_0x2be6c1['id'],'queue_name':_0xcca3e8[_0xd938('0x2f')],'FaxQueueId':_0xcca3e8['id'],'interface':util['format']('%s/%s',_0xd938('0x66'),_0x2be6c1[_0xd938('0x2f')]),'penalty':0x0,'paused':_0x2be6c1['faxPause'],'createdAt':_0x2be6c1[_0xd938('0x64')],'updatedAt':_0x2be6c1['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xd938('0x2a')](respondWithFilteredResult(_0x3a5bdb,_0x1630f6))[_0xd938('0x49')](handleError(_0x3a5bdb,null));};exports[_0xd938('0x67')]=function(_0x2e7610,_0x2ef701,_0xe14594){var _0x43cf7b={};var _0x1178be={};var _0x432a51;var _0x2ea1ed;return db['FaxQueue'][_0xd938('0x58')]({'where':{'id':_0x2e7610[_0xd938('0x4b')]['id']}})[_0xd938('0x2a')](handleEntityNotFound(_0x2ef701,null))[_0xd938('0x2a')](function(_0x2f6884){if(_0x2f6884){_0x432a51=_0x2f6884;_0x1178be['model']=_[_0xd938('0x37')](db[_0xd938('0x68')][_0xd938('0x33')]);_0x1178be['query']=_[_0xd938('0x37')](_0x2e7610[_0xd938('0x36')]);_0x1178be[_0xd938('0x38')]=_['intersection'](_0x1178be['model'],_0x1178be[_0xd938('0x36')]);_0x43cf7b[_0xd938('0x3b')]=_[_0xd938('0x39')](_0x1178be['model'],qs[_0xd938('0x3a')](_0x2e7610[_0xd938('0x36')][_0xd938('0x3a')]));_0x43cf7b['attributes']=_0x43cf7b[_0xd938('0x3b')][_0xd938('0x3c')]?_0x43cf7b[_0xd938('0x3b')]:_0x1178be['model'];_0x43cf7b[_0xd938('0x5b')]=qs[_0xd938('0x3e')](_0x2e7610[_0xd938('0x36')][_0xd938('0x3e')]);_0x43cf7b[_0xd938('0x3f')]=qs[_0xd938('0x38')](_[_0xd938('0x40')](_0x2e7610[_0xd938('0x36')],_0x1178be['filters']));if(_0x2e7610[_0xd938('0x36')]['filter']){_0x43cf7b[_0xd938('0x3f')]=_[_0xd938('0x44')](_0x43cf7b[_0xd938('0x3f')],{'$or':_[_0xd938('0x32')](_0x43cf7b['attributes'],function(_0x23beb6){var _0x660071={};_0x660071[_0x23beb6]={'$like':'%'+_0x2e7610[_0xd938('0x36')]['filter']+'%'};return _0x660071;})});}_0x43cf7b=_[_0xd938('0x44')]({},_0x43cf7b,_0x2e7610['options']);return _0x432a51[_0xd938('0x67')](_0x43cf7b);}})[_0xd938('0x2a')](function(_0x3f01f2){if(_0x3f01f2){_0x2ea1ed=_0x3f01f2[_0xd938('0x3c')];if(!_0x2e7610['query']['hasOwnProperty'](_0xd938('0x5a'))){_0x43cf7b[_0xd938('0x24')]=qs['limit'](_0x2e7610[_0xd938('0x36')][_0xd938('0x24')]);_0x43cf7b[_0xd938('0x22')]=qs[_0xd938('0x22')](_0x2e7610['query']['offset']);}return _0x432a51[_0xd938('0x67')](_0x43cf7b);}})[_0xd938('0x2a')](function(_0x13afa4){if(_0x13afa4){return _0x13afa4?{'count':_0x2ea1ed,'rows':_0x13afa4}:null;}})[_0xd938('0x2a')](respondWithResult(_0x2ef701,null))[_0xd938('0x49')](handleError(_0x2ef701,null));};exports[_0xd938('0x69')]=function(_0x20c661,_0x55699c,_0x1fd7a8){var _0x1db95b=_0x20c661[_0xd938('0x4d')][_0xd938('0x6a')];return db['Team'][_0xd938('0x48')]({'where':{'id':_0x1db95b},'attributes':['id'],'include':[{'model':db[_0xd938('0x5e')],'as':_0xd938('0x6b'),'attributes':['id',_0xd938('0x2f'),_0xd938('0x6c'),_0xd938('0x6d'),_0xd938('0x6e')],'raw':!![]}]})[_0xd938('0x2a')](function(_0x5b68f6){if(_0x5b68f6){var _0x267c97=_[_0xd938('0x6f')](_0x5b68f6,function(_0x26196b){var _0x41113e=_0x26196b['get']({'plain':!![]});return _0x41113e[_0xd938('0x6b')];});return db[_0xd938('0x45')][_0xd938('0x51')]({'where':{'id':_0x20c661[_0xd938('0x4b')]['id']}})[_0xd938('0x2a')](function(_0x3404ee){return db[_0xd938('0x70')][_0xd938('0x71')](function(_0x40527d){return _0x3404ee['addTeams'](_0x1db95b,{'transaction':_0x40527d})['then'](function(){return BPromise['each'](_0x267c97,function(_0x388482){return db[_0xd938('0x59')][_0xd938('0x72')]({'where':{'UserId':_0x388482['id'],'FaxQueueId':_0x20c661['params']['id']},'transaction':_0x40527d});});})[_0xd938('0x2a')](function(){_0x267c97['forEach'](function(_0x55521d){socket[_0xd938('0x73')](_0xd938('0x74'),{'UserId':_0x55521d['id'],'FaxQueueId':_0x3404ee['id']});});});});});}})[_0xd938('0x2a')](respondWithStatusCode(_0x55699c,null))[_0xd938('0x49')](handleError(_0x55699c,null));};exports['removeTeams']=function(_0x369ea6,_0x38c7da,_0x352ccd){return db[_0xd938('0x68')][_0xd938('0x48')]({'where':{'id':_0x369ea6[_0xd938('0x36')][_0xd938('0x6a')]},'attributes':['id'],'include':[{'model':db[_0xd938('0x5e')],'as':_0xd938('0x6b'),'attributes':['id'],'raw':!![]}]})[_0xd938('0x2a')](handleEntityNotFound(_0x38c7da,null))[_0xd938('0x2a')](function(_0x254277){var _0x24387c=_['map'](_0x254277,'id');var _0x3ce9c4=[];var _0x4b581e=[];var _0x127017=squel[_0xd938('0x75')]();_0x127017['field']('tq.TeamId')['from'](_0xd938('0x76'),'tq')[_0xd938('0x77')](_0xd938('0x78'),'ut',_0xd938('0x79'))[_0xd938('0x3f')]('FaxQueueId\x20=\x20?',_0x369ea6[_0xd938('0x4b')]['id']);for(var _0x340857=0x0;_0x340857<_0x254277[_0xd938('0x3c')];_0x340857+=0x1){let _0x308311=_0x254277[_0x340857];for(var _0xc93aaa=0x0;_0xc93aaa<_0x308311[_0xd938('0x6b')][_0xd938('0x3c')];_0xc93aaa+=0x1){let _0x606a45=_0x308311[_0xd938('0x6b')][_0xc93aaa];var _0x1af622=_0x127017[_0xd938('0x7a')]();_0x1af622[_0xd938('0x3f')](_0xd938('0x7b'),_0x606a45['id']);_0x4b581e[_0xd938('0x7c')](db[_0xd938('0x70')]['query'](_0x1af622['toString'](),{'type':db[_0xd938('0x70')]['QueryTypes'][_0xd938('0x7d')]})['then'](function(_0x120f33){if(_0x120f33[_0xd938('0x3c')]===0x1){return _0x606a45['id'];}else{var _0x36bd4a=_[_0xd938('0x7e')](_[_0xd938('0x32')](_0x120f33,_0xd938('0x7f')),function(_0x2bd505){return _['includes'](_0x24387c,_0x2bd505);});if(_0x36bd4a){return _0x606a45['id'];}}}));}}return BPromise[_0xd938('0x80')](_0x4b581e)['then'](function(_0x43053e){_0x3ce9c4=_(_0x3ce9c4)['union'](_0x43053e)[_0xd938('0x81')]()[_0xd938('0x82')]();return db[_0xd938('0x45')][_0xd938('0x51')]({'where':{'id':_0x369ea6['params']['id']}})['then'](function(_0x39a4c1){return db[_0xd938('0x70')][_0xd938('0x71')](function(_0x39de9b){return _0x39a4c1[_0xd938('0x83')](_0x369ea6['query'][_0xd938('0x6a')],{'transaction':_0x39de9b})[_0xd938('0x2a')](function(){if(!_[_0xd938('0x84')](_0x3ce9c4)){return _0x39a4c1[_0xd938('0x85')](_0x3ce9c4,{'transaction':_0x39de9b});}})[_0xd938('0x2a')](function(){_0x3ce9c4[_0xd938('0x86')](function(_0x1f9414){socket['emit'](_0xd938('0x87'),{'UserId':_0x1f9414,'FaxQueueId':_0x39a4c1['id']});});});});});});})['then'](respondWithStatusCode(_0x38c7da,null))[_0xd938('0x49')](handleError(_0x38c7da,null));};exports['addAgents']=function(_0x4927cd,_0x396708,_0x5d9274){return db[_0xd938('0x45')]['find']({'where':{'id':_0x4927cd[_0xd938('0x4b')]['id']}})[_0xd938('0x2a')](handleEntityNotFound(_0x396708,null))['then'](function(_0x3c1512){if(_0x3c1512){return _0x3c1512['addAgents'](_0x4927cd[_0xd938('0x4d')][_0xd938('0x6a')],_[_0xd938('0x88')](_0x4927cd['body'],['ids','id'])||{})[_0xd938('0x89')](function(_0x1237cc){for(var _0x20fb9e=0x0;_0x20fb9e<_0x4927cd[_0xd938('0x4d')]['ids'][_0xd938('0x3c')];_0x20fb9e+=0x1){socket[_0xd938('0x73')]('userFaxQueue:save',{'UserId':Number(_0x4927cd[_0xd938('0x4d')][_0xd938('0x6a')][_0x20fb9e]),'FaxQueueId':Number(_0x4927cd['params']['id'])});}return _0x1237cc;});}})[_0xd938('0x2a')](respondWithResult(_0x396708,null))[_0xd938('0x49')](handleError(_0x396708,null));};exports['removeAgents']=function(_0x39cd3a,_0x3f44c7,_0x16f926){return db[_0xd938('0x45')][_0xd938('0x51')]({'where':{'id':_0x39cd3a[_0xd938('0x4b')]['id']}})[_0xd938('0x2a')](handleEntityNotFound(_0x3f44c7,null))[_0xd938('0x2a')](function(_0x32300a){if(_0x32300a){return _0x32300a[_0xd938('0x85')](_0x39cd3a[_0xd938('0x36')][_0xd938('0x6a')])[_0xd938('0x2a')](function(){if(_[_0xd938('0x8a')](_0x39cd3a[_0xd938('0x36')][_0xd938('0x6a')])){for(var _0x529fd=0x0;_0x529fd<_0x39cd3a[_0xd938('0x36')][_0xd938('0x6a')]['length'];_0x529fd+=0x1){socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x39cd3a[_0xd938('0x36')][_0xd938('0x6a')][_0x529fd]),'FaxQueueId':Number(_0x39cd3a['params']['id'])});}}else{socket[_0xd938('0x73')](_0xd938('0x87'),{'UserId':Number(_0x39cd3a['query'][_0xd938('0x6a')]),'FaxQueueId':Number(_0x39cd3a['params']['id'])});}});}})[_0xd938('0x2a')](respondWithStatusCode(_0x3f44c7,null))['catch'](handleError(_0x3f44c7,null));};exports[_0xd938('0x8b')]=function(_0x142a46,_0x36a33b,_0x5970fe){var _0x34d308={};var _0x34cf8b={};var _0x44ea38;var _0x13cbf9;return db[_0xd938('0x45')][_0xd938('0x58')]({'where':{'id':_0x142a46[_0xd938('0x4b')]['id']}})['then'](handleEntityNotFound(_0x36a33b,null))[_0xd938('0x2a')](function(_0x87e6dc){if(_0x87e6dc){_0x44ea38=_0x87e6dc;_0x34cf8b[_0xd938('0x35')]=_[_0xd938('0x37')](db[_0xd938('0x5e')]['rawAttributes']);_0x34cf8b[_0xd938('0x36')]=_[_0xd938('0x37')](_0x142a46[_0xd938('0x36')]);_0x34cf8b[_0xd938('0x38')]=_['intersection'](_0x34cf8b[_0xd938('0x35')],_0x34cf8b[_0xd938('0x36')]);_0x34d308[_0xd938('0x3b')]=_[_0xd938('0x39')](_0x34cf8b[_0xd938('0x35')],qs[_0xd938('0x3a')](_0x142a46[_0xd938('0x36')][_0xd938('0x3a')]));_0x34d308[_0xd938('0x3b')]=_0x34d308[_0xd938('0x3b')][_0xd938('0x3c')]?_0x34d308[_0xd938('0x3b')]:_0x34cf8b[_0xd938('0x35')];_0x34d308['order']=qs[_0xd938('0x3e')](_0x142a46[_0xd938('0x36')][_0xd938('0x3e')]);_0x34d308[_0xd938('0x3f')]=qs['filters'](_[_0xd938('0x40')](_0x142a46[_0xd938('0x36')],_0x34cf8b[_0xd938('0x38')]));if(_0x142a46[_0xd938('0x36')][_0xd938('0x41')]){_0x34d308[_0xd938('0x3f')]=_['merge'](_0x34d308[_0xd938('0x3f')],{'$or':_[_0xd938('0x32')](_0x34d308[_0xd938('0x3b')],function(_0x3a4ddd){var _0x49dc4c={};_0x49dc4c[_0x3a4ddd]={'$like':'%'+_0x142a46[_0xd938('0x36')]['filter']+'%'};return _0x49dc4c;})});}_0x34d308=_[_0xd938('0x44')]({},_0x34d308,_0x142a46[_0xd938('0x5d')]);return _0x44ea38['getAgents'](_0x34d308);}})[_0xd938('0x2a')](function(_0x3b9902){if(_0x3b9902){_0x13cbf9=_0x3b9902[_0xd938('0x3c')];if(!_0x142a46['query'][_0xd938('0x3d')](_0xd938('0x5a'))){_0x34d308[_0xd938('0x24')]=qs[_0xd938('0x24')](_0x142a46[_0xd938('0x36')][_0xd938('0x24')]);_0x34d308[_0xd938('0x22')]=qs['offset'](_0x142a46['query'][_0xd938('0x22')]);}return _0x44ea38[_0xd938('0x8b')](_0x34d308);}})['then'](function(_0x1956aa){if(_0x1956aa){return _0x1956aa?{'count':_0x13cbf9,'rows':_0x1956aa}:null;}})[_0xd938('0x2a')](respondWithResult(_0x36a33b,null))[_0xd938('0x49')](handleError(_0x36a33b,null));}; \ No newline at end of file +var _0x9684=['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','redis','defaults','./faxQueue.socket','register','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','get','FaxQueues','UserProfileResource','error','stack','name','send','FaxQueue','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','nolimit','order','where','pick','filter','merge','map','VIRTUAL','includeAll','include','findAll','rows','length','options','catch','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','find','params','describe','getMembers','findOne','UserFaxQueue','hasOwnProperty','sort','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','format','SIP','getTeams','addTeams','ids','Team','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','emit','removeTeams','User','tq.TeamId','from','team_has_fax_queues','join','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','isEmpty','removeAgents','forEach','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x23ae84,_0x38f91c){var _0x398937=function(_0x34e447){while(--_0x34e447){_0x23ae84['push'](_0x23ae84['shift']());}};_0x398937(++_0x38f91c);}(_0x9684,0x80));var _0x4968=function(_0xa7529f,_0xb14674){_0xa7529f=_0xa7529f-0x0;var _0x5ef3b5=_0x9684[_0xa7529f];return _0x5ef3b5;};'use strict';var emlformat=require(_0x4968('0x0'));var rimraf=require(_0x4968('0x1'));var zipdir=require(_0x4968('0x2'));var jsonpatch=require(_0x4968('0x3'));var rp=require(_0x4968('0x4'));var moment=require(_0x4968('0x5'));var BPromise=require(_0x4968('0x6'));var Mustache=require(_0x4968('0x7'));var util=require(_0x4968('0x8'));var path=require(_0x4968('0x9'));var sox=require(_0x4968('0xa'));var csv=require(_0x4968('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4968('0xc'));var _=require(_0x4968('0xd'));var squel=require(_0x4968('0xe'));var crypto=require(_0x4968('0xf'));var jsforce=require(_0x4968('0x10'));var deskjs=require(_0x4968('0x11'));var toCsv=require(_0x4968('0xb'));var querystring=require(_0x4968('0x12'));var Papa=require(_0x4968('0x13'));var Redis=require(_0x4968('0x14'));var authService=require(_0x4968('0x15'));var qs=require(_0x4968('0x16'));var as=require(_0x4968('0x17'));var hardwareService=require(_0x4968('0x18'));var logger=require(_0x4968('0x19'))(_0x4968('0x1a'));var utils=require(_0x4968('0x1b'));var config=require('../../config/environment');var licenseUtil=require(_0x4968('0x1c'));var db=require('../../mysqldb')['db'];config[_0x4968('0x1d')]=_[_0x4968('0x1e')](config[_0x4968('0x1d')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4968('0x1d')]));require(_0x4968('0x1f'))[_0x4968('0x20')](socket);function respondWithStatusCode(_0x50f0ec,_0x42d772){_0x42d772=_0x42d772||0xcc;return function(_0x3dde5f){if(_0x3dde5f){return _0x50f0ec['sendStatus'](_0x42d772);}return _0x50f0ec['status'](_0x42d772)['end']();};}function respondWithResult(_0x111555,_0x1a2d21){_0x1a2d21=_0x1a2d21||0xc8;return function(_0x4f3e72){if(_0x4f3e72){return _0x111555[_0x4968('0x21')](_0x1a2d21)[_0x4968('0x22')](_0x4f3e72);}};}function respondWithFilteredResult(_0xfc7ba1,_0x2ec545){return function(_0x16d493){if(_0x16d493){var _0x1f4f38=typeof _0x2ec545[_0x4968('0x23')]==='undefined'&&typeof _0x2ec545[_0x4968('0x24')]===_0x4968('0x25');var _0x257c98=_0x16d493['count'];var _0x449ffa=_0x1f4f38?0x0:_0x2ec545[_0x4968('0x23')];var _0x1ad2ce=_0x1f4f38?_0x16d493[_0x4968('0x26')]:_0x2ec545[_0x4968('0x23')]+_0x2ec545[_0x4968('0x24')];var _0x3ba959;if(_0x1ad2ce>=_0x257c98){_0x1ad2ce=_0x257c98;_0x3ba959=0xc8;}else{_0x3ba959=0xce;}_0xfc7ba1[_0x4968('0x21')](_0x3ba959);return _0xfc7ba1[_0x4968('0x27')](_0x4968('0x28'),_0x449ffa+'-'+_0x1ad2ce+'/'+_0x257c98)[_0x4968('0x22')](_0x16d493);}return null;};}function patchUpdates(_0x48f33a){return function(_0x4841a2){try{jsonpatch[_0x4968('0x29')](_0x4841a2,_0x48f33a,!![]);}catch(_0x532d82){return BPromise[_0x4968('0x2a')](_0x532d82);}return _0x4841a2[_0x4968('0x2b')]();};}function saveUpdates(_0x5f2a74,_0x673ba5){return function(_0x5b074a){if(_0x5b074a){return _0x5b074a['update'](_0x5f2a74)[_0x4968('0x2c')](function(_0x3ce51f){return _0x3ce51f;});}return null;};}function removeEntity(_0x564184,_0x5cbbce){return function(_0x55837a){if(_0x55837a){return _0x55837a[_0x4968('0x2d')]()[_0x4968('0x2c')](function(){var _0x14b28a=_0x55837a[_0x4968('0x2e')]({'plain':!![]});var _0x3bc51d=_0x4968('0x2f');return db[_0x4968('0x30')][_0x4968('0x2d')]({'where':{'type':_0x3bc51d,'resourceId':_0x14b28a['id']}})[_0x4968('0x2c')](function(){return _0x55837a;});})[_0x4968('0x2c')](function(){_0x564184[_0x4968('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19bb5f,_0x17ac9c){return function(_0x24c5b2){if(!_0x24c5b2){_0x19bb5f['sendStatus'](0x194);}return _0x24c5b2;};}function handleError(_0x51e232,_0xf95b0e){_0xf95b0e=_0xf95b0e||0x1f4;return function(_0x69c9cf){logger[_0x4968('0x31')](_0x69c9cf[_0x4968('0x32')]);if(_0x69c9cf[_0x4968('0x33')]){delete _0x69c9cf[_0x4968('0x33')];}_0x51e232[_0x4968('0x21')](_0xf95b0e)[_0x4968('0x34')](_0x69c9cf);};}exports['index']=function(_0x37718c,_0x190bd0){var _0x336ddc={},_0x1dfd7d={},_0x1653ba={'count':0x0,'rows':[]};var _0x3c6534=_['map'](db[_0x4968('0x35')][_0x4968('0x36')],function(_0x3fc227){return{'name':_0x3fc227[_0x4968('0x37')],'type':_0x3fc227[_0x4968('0x38')][_0x4968('0x39')]};});_0x1dfd7d['model']=_['map'](_0x3c6534,_0x4968('0x33'));_0x1dfd7d[_0x4968('0x3a')]=_[_0x4968('0x3b')](_0x37718c[_0x4968('0x3a')]);_0x1dfd7d[_0x4968('0x3c')]=_[_0x4968('0x3d')](_0x1dfd7d[_0x4968('0x3e')],_0x1dfd7d[_0x4968('0x3a')]);_0x336ddc[_0x4968('0x3f')]=_[_0x4968('0x3d')](_0x1dfd7d[_0x4968('0x3e')],qs['fields'](_0x37718c[_0x4968('0x3a')][_0x4968('0x40')]));_0x336ddc['attributes']=_0x336ddc['attributes']['length']?_0x336ddc[_0x4968('0x3f')]:_0x1dfd7d[_0x4968('0x3e')];if(!_0x37718c[_0x4968('0x3a')]['hasOwnProperty'](_0x4968('0x41'))){_0x336ddc[_0x4968('0x24')]=qs[_0x4968('0x24')](_0x37718c[_0x4968('0x3a')][_0x4968('0x24')]);_0x336ddc[_0x4968('0x23')]=qs['offset'](_0x37718c['query'][_0x4968('0x23')]);}_0x336ddc[_0x4968('0x42')]=qs['sort'](_0x37718c[_0x4968('0x3a')]['sort']);_0x336ddc[_0x4968('0x43')]=qs[_0x4968('0x3c')](_[_0x4968('0x44')](_0x37718c['query'],_0x1dfd7d[_0x4968('0x3c')]),_0x3c6534);if(_0x37718c[_0x4968('0x3a')][_0x4968('0x45')]){_0x336ddc['where']=_[_0x4968('0x46')](_0x336ddc['where'],{'$or':_[_0x4968('0x47')](_0x3c6534,function(_0x446037){if(_0x446037['type']!==_0x4968('0x48')){var _0x46146a={};_0x46146a[_0x446037[_0x4968('0x33')]]={'$like':'%'+_0x37718c[_0x4968('0x3a')]['filter']+'%'};return _0x46146a;}})});}_0x336ddc=_[_0x4968('0x46')]({},_0x336ddc,_0x37718c['options']);var _0x24354a={'where':_0x336ddc[_0x4968('0x43')]};return db['FaxQueue'][_0x4968('0x26')](_0x24354a)[_0x4968('0x2c')](function(_0xc635ab){_0x1653ba['count']=_0xc635ab;if(_0x37718c['query'][_0x4968('0x49')]){_0x336ddc[_0x4968('0x4a')]=[{'all':!![]}];}return db[_0x4968('0x35')][_0x4968('0x4b')](_0x336ddc);})[_0x4968('0x2c')](function(_0x27df7e){_0x1653ba[_0x4968('0x4c')]=_0x27df7e;return _0x1653ba;})['then'](respondWithFilteredResult(_0x190bd0,_0x336ddc))['catch'](handleError(_0x190bd0,null));};exports['show']=function(_0x31d096,_0x193da8){var _0x2f1e62={'raw':!![],'where':{'id':_0x31d096['params']['id']}},_0x47426d={};_0x47426d['model']=_[_0x4968('0x3b')](db['FaxQueue'][_0x4968('0x36')]);_0x47426d['query']=_[_0x4968('0x3b')](_0x31d096[_0x4968('0x3a')]);_0x47426d[_0x4968('0x3c')]=_[_0x4968('0x3d')](_0x47426d['model'],_0x47426d[_0x4968('0x3a')]);_0x2f1e62[_0x4968('0x3f')]=_[_0x4968('0x3d')](_0x47426d[_0x4968('0x3e')],qs[_0x4968('0x40')](_0x31d096[_0x4968('0x3a')][_0x4968('0x40')]));_0x2f1e62[_0x4968('0x3f')]=_0x2f1e62[_0x4968('0x3f')][_0x4968('0x4d')]?_0x2f1e62['attributes']:_0x47426d[_0x4968('0x3e')];if(_0x31d096['query'][_0x4968('0x49')]){_0x2f1e62[_0x4968('0x4a')]=[{'all':!![]}];}_0x2f1e62=_[_0x4968('0x46')]({},_0x2f1e62,_0x31d096[_0x4968('0x4e')]);return db[_0x4968('0x35')]['find'](_0x2f1e62)[_0x4968('0x2c')](handleEntityNotFound(_0x193da8,null))[_0x4968('0x2c')](respondWithResult(_0x193da8,null))[_0x4968('0x4f')](handleError(_0x193da8,null));};exports[_0x4968('0x50')]=function(_0x2eab5f,_0x4dc3ae){return db[_0x4968('0x35')][_0x4968('0x50')](_0x2eab5f['body'],{})[_0x4968('0x2c')](function(_0x243809){var _0x455449=_0x2eab5f[_0x4968('0x51')][_0x4968('0x2e')]({'plain':!![]});if(!_0x455449)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x455449[_0x4968('0x52')]==='user'){var _0x43e57b=_0x243809[_0x4968('0x2e')]({'plain':!![]});var _0x2df9c0=_0x4968('0x2f');return db[_0x4968('0x53')]['find']({'where':{'name':_0x2df9c0,'userProfileId':_0x455449[_0x4968('0x54')]},'raw':!![]})[_0x4968('0x2c')](function(_0x7a5c9a){if(_0x7a5c9a&&_0x7a5c9a[_0x4968('0x55')]===0x0){return db[_0x4968('0x30')][_0x4968('0x50')]({'name':_0x43e57b[_0x4968('0x33')],'resourceId':_0x43e57b['id'],'type':_0x7a5c9a[_0x4968('0x33')],'sectionId':_0x7a5c9a['id']},{})['then'](function(){return _0x243809;});}else{return _0x243809;}})[_0x4968('0x4f')](function(_0x324700){logger['error'](_0x4968('0x56'),_0x324700);throw _0x324700;});}return _0x243809;})[_0x4968('0x2c')](respondWithResult(_0x4dc3ae,0xc9))[_0x4968('0x4f')](handleError(_0x4dc3ae,null));};exports[_0x4968('0x57')]=function(_0x183c8a,_0xe2ecc4){if(_0x183c8a[_0x4968('0x58')]['id']){delete _0x183c8a['body']['id'];}return db['FaxQueue'][_0x4968('0x59')]({'where':{'id':_0x183c8a[_0x4968('0x5a')]['id']}})[_0x4968('0x2c')](handleEntityNotFound(_0xe2ecc4,null))[_0x4968('0x2c')](saveUpdates(_0x183c8a[_0x4968('0x58')],null))[_0x4968('0x2c')](respondWithResult(_0xe2ecc4,null))[_0x4968('0x4f')](handleError(_0xe2ecc4,null));};exports[_0x4968('0x2d')]=function(_0x462bdd,_0x34008c){return db[_0x4968('0x35')][_0x4968('0x59')]({'where':{'id':_0x462bdd[_0x4968('0x5a')]['id']}})['then'](handleEntityNotFound(_0x34008c,null))[_0x4968('0x2c')](removeEntity(_0x34008c,null))['catch'](handleError(_0x34008c,null));};exports[_0x4968('0x5b')]=function(_0x6ed09d,_0x1bb011){return db['FaxQueue'][_0x4968('0x5b')]()['then'](respondWithResult(_0x1bb011,null))[_0x4968('0x4f')](handleError(_0x1bb011,null));};exports[_0x4968('0x5c')]=function(_0x32185c,_0x5b0b9c,_0x19367f){var _0x3f5b26={'raw':!![],'where':{}},_0x5a857a={},_0x56a85e;return db['FaxQueue'][_0x4968('0x5d')]({'where':{'id':_0x32185c[_0x4968('0x5a')]['id']}})[_0x4968('0x2c')](handleEntityNotFound(_0x5b0b9c,null))['then'](function(_0x3824c7){if(_0x3824c7){_0x56a85e=_0x3824c7[_0x4968('0x2e')]({'plain':!![]});_0x5a857a['model']=_['keys'](db[_0x4968('0x5e')]['rawAttributes']);_0x5a857a[_0x4968('0x3a')]=_['keys'](_0x32185c[_0x4968('0x3a')]);_0x5a857a[_0x4968('0x3c')]=_[_0x4968('0x3d')](_0x5a857a[_0x4968('0x3e')],_0x5a857a[_0x4968('0x3a')]);_0x3f5b26['attributes']=_['intersection'](_0x5a857a['model'],qs['fields'](_0x32185c[_0x4968('0x3a')][_0x4968('0x40')]));_0x3f5b26['attributes']=_0x3f5b26[_0x4968('0x3f')][_0x4968('0x4d')]?_0x3f5b26[_0x4968('0x3f')]:_0x5a857a[_0x4968('0x3e')];if(!_0x32185c[_0x4968('0x3a')][_0x4968('0x5f')](_0x4968('0x41'))){_0x3f5b26['limit']=qs['limit'](_0x32185c[_0x4968('0x3a')]['limit']);_0x3f5b26[_0x4968('0x23')]=qs[_0x4968('0x23')](_0x32185c[_0x4968('0x3a')][_0x4968('0x23')]);}_0x3f5b26[_0x4968('0x42')]=qs[_0x4968('0x60')](_0x32185c['query'][_0x4968('0x60')]);_0x3f5b26[_0x4968('0x43')]=qs['filters'](_[_0x4968('0x44')](_0x32185c[_0x4968('0x3a')],_0x5a857a['filters']));_0x3f5b26[_0x4968('0x43')]['FaxQueueId']=_0x3824c7['id'];if(_0x32185c['query'][_0x4968('0x45')]){_0x3f5b26[_0x4968('0x43')]=_[_0x4968('0x46')](_0x3f5b26[_0x4968('0x43')],{'$or':_['map'](_0x3f5b26[_0x4968('0x3f')],function(_0x56eadb){var _0x30ad44={};_0x30ad44[_0x56eadb]={'$like':'%'+_0x32185c[_0x4968('0x3a')][_0x4968('0x45')]+'%'};return _0x30ad44;})});}_0x3f5b26=_[_0x4968('0x46')]({},_0x3f5b26,_0x32185c[_0x4968('0x4e')]);return db[_0x4968('0x5e')][_0x4968('0x4b')](_0x3f5b26);}})['then'](function(_0x2beb65){if(_0x2beb65){return db['User'][_0x4968('0x61')]({'where':{'id':_[_0x4968('0x47')](_0x2beb65,_0x4968('0x62')),'role':_0x4968('0x63')},'attributes':['id',_0x4968('0x33'),_0x4968('0x64'),_0x4968('0x65'),_0x4968('0x66')]});}})['then'](function(_0xa4d7e4){if(_0xa4d7e4){return{'count':_0xa4d7e4[_0x4968('0x26')],'rows':_[_0x4968('0x47')](_0xa4d7e4[_0x4968('0x4c')],function(_0x2304b0){return{'membername':_0x2304b0['name'],'UserId':_0x2304b0['id'],'queue_name':_0x56a85e[_0x4968('0x33')],'FaxQueueId':_0x56a85e['id'],'interface':util[_0x4968('0x67')]('%s/%s',_0x4968('0x68'),_0x2304b0[_0x4968('0x33')]),'penalty':0x0,'paused':_0x2304b0[_0x4968('0x64')],'createdAt':_0x2304b0['createdAt'],'updatedAt':_0x2304b0['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x4968('0x2c')](respondWithFilteredResult(_0x5b0b9c,_0x3f5b26))[_0x4968('0x4f')](handleError(_0x5b0b9c,null));};exports[_0x4968('0x69')]=function(_0x29cda9,_0x225be7,_0x26c8b8){var _0x812292={};var _0x28de4f={};var _0xa1036d;var _0x17ff3c;return db[_0x4968('0x35')]['findOne']({'where':{'id':_0x29cda9[_0x4968('0x5a')]['id']}})[_0x4968('0x2c')](handleEntityNotFound(_0x225be7,null))[_0x4968('0x2c')](function(_0x3ea7ba){if(_0x3ea7ba){_0xa1036d=_0x3ea7ba;_0x28de4f['model']=_[_0x4968('0x3b')](db['Team'][_0x4968('0x36')]);_0x28de4f[_0x4968('0x3a')]=_[_0x4968('0x3b')](_0x29cda9[_0x4968('0x3a')]);_0x28de4f[_0x4968('0x3c')]=_[_0x4968('0x3d')](_0x28de4f['model'],_0x28de4f[_0x4968('0x3a')]);_0x812292[_0x4968('0x3f')]=_[_0x4968('0x3d')](_0x28de4f[_0x4968('0x3e')],qs[_0x4968('0x40')](_0x29cda9[_0x4968('0x3a')]['fields']));_0x812292[_0x4968('0x3f')]=_0x812292['attributes'][_0x4968('0x4d')]?_0x812292[_0x4968('0x3f')]:_0x28de4f[_0x4968('0x3e')];_0x812292['order']=qs[_0x4968('0x60')](_0x29cda9['query'][_0x4968('0x60')]);_0x812292[_0x4968('0x43')]=qs[_0x4968('0x3c')](_['pick'](_0x29cda9[_0x4968('0x3a')],_0x28de4f[_0x4968('0x3c')]));if(_0x29cda9[_0x4968('0x3a')][_0x4968('0x45')]){_0x812292[_0x4968('0x43')]=_[_0x4968('0x46')](_0x812292['where'],{'$or':_[_0x4968('0x47')](_0x812292[_0x4968('0x3f')],function(_0xdd2e95){var _0x312dec={};_0x312dec[_0xdd2e95]={'$like':'%'+_0x29cda9[_0x4968('0x3a')]['filter']+'%'};return _0x312dec;})});}_0x812292=_[_0x4968('0x46')]({},_0x812292,_0x29cda9[_0x4968('0x4e')]);return _0xa1036d['getTeams'](_0x812292);}})['then'](function(_0x2d9345){if(_0x2d9345){_0x17ff3c=_0x2d9345[_0x4968('0x4d')];if(!_0x29cda9['query']['hasOwnProperty'](_0x4968('0x41'))){_0x812292[_0x4968('0x24')]=qs[_0x4968('0x24')](_0x29cda9[_0x4968('0x3a')]['limit']);_0x812292['offset']=qs['offset'](_0x29cda9['query'][_0x4968('0x23')]);}return _0xa1036d[_0x4968('0x69')](_0x812292);}})['then'](function(_0x54fce6){if(_0x54fce6){return _0x54fce6?{'count':_0x17ff3c,'rows':_0x54fce6}:null;}})[_0x4968('0x2c')](respondWithResult(_0x225be7,null))[_0x4968('0x4f')](handleError(_0x225be7,null));};exports[_0x4968('0x6a')]=function(_0x2047df,_0xa65379,_0x167702){var _0x2ec8e0=_0x2047df[_0x4968('0x58')][_0x4968('0x6b')];return db[_0x4968('0x6c')][_0x4968('0x4b')]({'where':{'id':_0x2ec8e0},'attributes':['id'],'include':[{'model':db['User'],'as':_0x4968('0x6d'),'attributes':['id',_0x4968('0x33'),_0x4968('0x6e'),'voicePause',_0x4968('0x6f')],'raw':!![]}]})['then'](function(_0x4b0d34){if(_0x4b0d34){var _0x458add=_[_0x4968('0x70')](_0x4b0d34,function(_0x5793eb){var _0x2f5729=_0x5793eb['get']({'plain':!![]});return _0x2f5729[_0x4968('0x6d')];});return db[_0x4968('0x35')][_0x4968('0x59')]({'where':{'id':_0x2047df[_0x4968('0x5a')]['id']}})[_0x4968('0x2c')](function(_0xff99b1){return db[_0x4968('0x71')][_0x4968('0x72')](function(_0x17c6d4){return _0xff99b1[_0x4968('0x6a')](_0x2ec8e0,{'transaction':_0x17c6d4})[_0x4968('0x2c')](function(){return BPromise[_0x4968('0x73')](_0x458add,function(_0x2eca8d){return db['UserFaxQueue'][_0x4968('0x74')]({'where':{'UserId':_0x2eca8d['id'],'FaxQueueId':_0x2047df['params']['id']},'transaction':_0x17c6d4});});})[_0x4968('0x2c')](function(){_0x458add['forEach'](function(_0x26da29){socket[_0x4968('0x75')]('userFaxQueue:save',{'UserId':_0x26da29['id'],'FaxQueueId':_0xff99b1['id']});});});});});}})[_0x4968('0x2c')](respondWithStatusCode(_0xa65379,null))[_0x4968('0x4f')](handleError(_0xa65379,null));};exports[_0x4968('0x76')]=function(_0x42101d,_0x567e5b,_0x5b18ab){return db[_0x4968('0x6c')][_0x4968('0x4b')]({'where':{'id':_0x42101d['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x4968('0x77')],'as':_0x4968('0x6d'),'attributes':['id'],'raw':!![]}]})[_0x4968('0x2c')](handleEntityNotFound(_0x567e5b,null))['then'](function(_0x441985){var _0x3cc1a3=_[_0x4968('0x47')](_0x441985,'id');var _0x5a4979=[];var _0xf021a2=[];var _0x22c7a8=squel['select']();_0x22c7a8['field'](_0x4968('0x78'))[_0x4968('0x79')](_0x4968('0x7a'),'tq')[_0x4968('0x7b')]('user_has_teams','ut',_0x4968('0x7c'))['where'](_0x4968('0x7d'),_0x42101d[_0x4968('0x5a')]['id']);for(var _0x46ba04=0x0;_0x46ba04<_0x441985[_0x4968('0x4d')];_0x46ba04+=0x1){let _0x35c0b5=_0x441985[_0x46ba04];for(var _0x5945a8=0x0;_0x5945a8<_0x35c0b5[_0x4968('0x6d')][_0x4968('0x4d')];_0x5945a8+=0x1){let _0x7e444c=_0x35c0b5['Agents'][_0x5945a8];var _0x1f554d=_0x22c7a8['clone']();_0x1f554d[_0x4968('0x43')](_0x4968('0x7e'),_0x7e444c['id']);_0xf021a2['push'](db[_0x4968('0x71')][_0x4968('0x3a')](_0x1f554d[_0x4968('0x7f')](),{'type':db['sequelize'][_0x4968('0x80')][_0x4968('0x81')]})[_0x4968('0x2c')](function(_0x5aa75d){if(_0x5aa75d[_0x4968('0x4d')]===0x1){return _0x7e444c['id'];}else{var _0x1e9182=_[_0x4968('0x82')](_[_0x4968('0x47')](_0x5aa75d,_0x4968('0x83')),function(_0xcd089b){return _['includes'](_0x3cc1a3,_0xcd089b);});if(_0x1e9182){return _0x7e444c['id'];}}}));}}return BPromise[_0x4968('0x84')](_0xf021a2)[_0x4968('0x2c')](function(_0x1bfd52){_0x5a4979=_(_0x5a4979)[_0x4968('0x85')](_0x1bfd52)[_0x4968('0x86')]()[_0x4968('0x87')]();return db[_0x4968('0x35')][_0x4968('0x59')]({'where':{'id':_0x42101d['params']['id']}})['then'](function(_0x3cb166){return db['sequelize'][_0x4968('0x72')](function(_0x1e4981){return _0x3cb166[_0x4968('0x76')](_0x42101d[_0x4968('0x3a')][_0x4968('0x6b')],{'transaction':_0x1e4981})['then'](function(){if(!_[_0x4968('0x88')](_0x5a4979)){return _0x3cb166[_0x4968('0x89')](_0x5a4979,{'transaction':_0x1e4981});}})['then'](function(){_0x5a4979[_0x4968('0x8a')](function(_0x5ee66e){socket[_0x4968('0x75')](_0x4968('0x8b'),{'UserId':_0x5ee66e,'FaxQueueId':_0x3cb166['id']});});});});});});})[_0x4968('0x2c')](respondWithStatusCode(_0x567e5b,null))[_0x4968('0x4f')](handleError(_0x567e5b,null));};exports['addAgents']=function(_0x1d8e0a,_0x310c34,_0x4aff7e){return db[_0x4968('0x35')][_0x4968('0x59')]({'where':{'id':_0x1d8e0a[_0x4968('0x5a')]['id']}})['then'](handleEntityNotFound(_0x310c34,null))[_0x4968('0x2c')](function(_0x51bb46){if(_0x51bb46){return _0x51bb46[_0x4968('0x8c')](_0x1d8e0a[_0x4968('0x58')]['ids'],_[_0x4968('0x8d')](_0x1d8e0a[_0x4968('0x58')],[_0x4968('0x6b'),'id'])||{})[_0x4968('0x8e')](function(_0x3d98a2){for(var _0x516d15=0x0;_0x516d15<_0x1d8e0a[_0x4968('0x58')][_0x4968('0x6b')][_0x4968('0x4d')];_0x516d15+=0x1){socket[_0x4968('0x75')]('userFaxQueue:save',{'UserId':Number(_0x1d8e0a[_0x4968('0x58')][_0x4968('0x6b')][_0x516d15]),'FaxQueueId':Number(_0x1d8e0a[_0x4968('0x5a')]['id'])});}return _0x3d98a2;});}})[_0x4968('0x2c')](respondWithResult(_0x310c34,null))[_0x4968('0x4f')](handleError(_0x310c34,null));};exports[_0x4968('0x89')]=function(_0x1d3e0a,_0x263659,_0x5debb9){return db[_0x4968('0x35')][_0x4968('0x59')]({'where':{'id':_0x1d3e0a['params']['id']}})[_0x4968('0x2c')](handleEntityNotFound(_0x263659,null))[_0x4968('0x2c')](function(_0x42495c){if(_0x42495c){return _0x42495c[_0x4968('0x89')](_0x1d3e0a['query'][_0x4968('0x6b')])['then'](function(){if(_[_0x4968('0x8f')](_0x1d3e0a['query'][_0x4968('0x6b')])){for(var _0x52f647=0x0;_0x52f647<_0x1d3e0a[_0x4968('0x3a')][_0x4968('0x6b')]['length'];_0x52f647+=0x1){socket[_0x4968('0x75')](_0x4968('0x8b'),{'UserId':Number(_0x1d3e0a[_0x4968('0x3a')]['ids'][_0x52f647]),'FaxQueueId':Number(_0x1d3e0a[_0x4968('0x5a')]['id'])});}}else{socket[_0x4968('0x75')]('userFaxQueue:remove',{'UserId':Number(_0x1d3e0a[_0x4968('0x3a')][_0x4968('0x6b')]),'FaxQueueId':Number(_0x1d3e0a['params']['id'])});}});}})[_0x4968('0x2c')](respondWithStatusCode(_0x263659,null))[_0x4968('0x4f')](handleError(_0x263659,null));};exports['getAgents']=function(_0x4938f2,_0x511264,_0x14bdbd){var _0x3b9fd9={};var _0x312f01={};var _0x3d1283;var _0x3c8723;return db[_0x4968('0x35')]['findOne']({'where':{'id':_0x4938f2[_0x4968('0x5a')]['id']}})[_0x4968('0x2c')](handleEntityNotFound(_0x511264,null))[_0x4968('0x2c')](function(_0x130f0d){if(_0x130f0d){_0x3d1283=_0x130f0d;_0x312f01[_0x4968('0x3e')]=_[_0x4968('0x3b')](db['User'][_0x4968('0x36')]);_0x312f01['query']=_[_0x4968('0x3b')](_0x4938f2[_0x4968('0x3a')]);_0x312f01[_0x4968('0x3c')]=_['intersection'](_0x312f01['model'],_0x312f01[_0x4968('0x3a')]);_0x3b9fd9[_0x4968('0x3f')]=_[_0x4968('0x3d')](_0x312f01[_0x4968('0x3e')],qs[_0x4968('0x40')](_0x4938f2[_0x4968('0x3a')][_0x4968('0x40')]));_0x3b9fd9[_0x4968('0x3f')]=_0x3b9fd9[_0x4968('0x3f')][_0x4968('0x4d')]?_0x3b9fd9[_0x4968('0x3f')]:_0x312f01[_0x4968('0x3e')];_0x3b9fd9[_0x4968('0x42')]=qs[_0x4968('0x60')](_0x4938f2['query'][_0x4968('0x60')]);_0x3b9fd9[_0x4968('0x43')]=qs[_0x4968('0x3c')](_[_0x4968('0x44')](_0x4938f2['query'],_0x312f01[_0x4968('0x3c')]));if(_0x4938f2[_0x4968('0x3a')][_0x4968('0x45')]){_0x3b9fd9[_0x4968('0x43')]=_[_0x4968('0x46')](_0x3b9fd9['where'],{'$or':_[_0x4968('0x47')](_0x3b9fd9['attributes'],function(_0x21b45c){var _0x51f9a1={};_0x51f9a1[_0x21b45c]={'$like':'%'+_0x4938f2['query'][_0x4968('0x45')]+'%'};return _0x51f9a1;})});}_0x3b9fd9=_['merge']({},_0x3b9fd9,_0x4938f2[_0x4968('0x4e')]);return _0x3d1283[_0x4968('0x90')](_0x3b9fd9);}})[_0x4968('0x2c')](function(_0x1eb626){if(_0x1eb626){_0x3c8723=_0x1eb626[_0x4968('0x4d')];if(!_0x4938f2['query']['hasOwnProperty'](_0x4968('0x41'))){_0x3b9fd9[_0x4968('0x24')]=qs[_0x4968('0x24')](_0x4938f2[_0x4968('0x3a')][_0x4968('0x24')]);_0x3b9fd9[_0x4968('0x23')]=qs[_0x4968('0x23')](_0x4938f2['query'][_0x4968('0x23')]);}return _0x3d1283[_0x4968('0x90')](_0x3b9fd9);}})[_0x4968('0x2c')](function(_0x1a6bde){if(_0x1a6bde){return _0x1a6bde?{'count':_0x3c8723,'rows':_0x1a6bde}:null;}})[_0x4968('0x2c')](respondWithResult(_0x511264,null))[_0x4968('0x4f')](handleError(_0x511264,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 21f4ba8..fed0a6d 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 _0x8c80=['remove','emit','hasOwnProperty','hook','events','FaxQueue','setMaxListeners','save'];(function(_0x4480b9,_0x5c2949){var _0x3f0f02=function(_0x43502f){while(--_0x43502f){_0x4480b9['push'](_0x4480b9['shift']());}};_0x3f0f02(++_0x5c2949);}(_0x8c80,0x1ac));var _0x08c8=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0x8c80[_0x101e7b];return _0x4995c0;};'use strict';var EventEmitter=require(_0x08c8('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0x08c8('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x08c8('0x2')](0x0);var events={'afterCreate':_0x08c8('0x3'),'afterUpdate':'update','afterDestroy':_0x08c8('0x4')};function emitEvent(_0x4adcc5){return function(_0x4adda6,_0x2cbc15,_0x350a7a){FaxQueueEvents['emit'](_0x4adcc5+':'+_0x4adda6['id'],_0x4adda6);FaxQueueEvents[_0x08c8('0x5')](_0x4adcc5,_0x4adda6);_0x350a7a(null);};}for(var e in events){if(events[_0x08c8('0x6')](e)){var event=events[e];FaxQueue[_0x08c8('0x7')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file +var _0x86ba=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','FaxQueue'];(function(_0x2354f6,_0x59daf8){var _0x109e6b=function(_0x2f20f1){while(--_0x2f20f1){_0x2354f6['push'](_0x2354f6['shift']());}};_0x109e6b(++_0x59daf8);}(_0x86ba,0xee));var _0xa86b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x86ba[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0xa86b('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0xa86b('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xa86b('0x2')](0x0);var events={'afterCreate':_0xa86b('0x3'),'afterUpdate':_0xa86b('0x4'),'afterDestroy':_0xa86b('0x5')};function emitEvent(_0x319b5f){return function(_0x1ebcd2,_0x2cac01,_0x51903f){FaxQueueEvents[_0xa86b('0x6')](_0x319b5f+':'+_0x1ebcd2['id'],_0x1ebcd2);FaxQueueEvents[_0xa86b('0x6')](_0x319b5f,_0x1ebcd2);_0x51903f(null);};}for(var e in events){if(events[_0xa86b('0x7')](e)){var event=events[e];FaxQueue[_0xa86b('0x8')](e,emitEvent(event));}}module[_0xa86b('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 6e9eb24..b4fed83 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 _0x56c7=['./faxQueue.attributes','exports','lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment'];(function(_0x2038ea,_0x649417){var _0x285a07=function(_0x4a5766){while(--_0x4a5766){_0x2038ea['push'](_0x2038ea['shift']());}};_0x285a07(++_0x649417);}(_0x56c7,0xbf));var _0x756c=function(_0x22d7e6,_0xa620e7){_0x22d7e6=_0x22d7e6-0x0;var _0x72bc58=_0x56c7[_0x22d7e6];return _0x72bc58;};'use strict';var _=require(_0x756c('0x0'));var util=require(_0x756c('0x1'));var logger=require(_0x756c('0x2'))('api');var moment=require(_0x756c('0x3'));var BPromise=require(_0x756c('0x4'));var rp=require(_0x756c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x756c('0x6'));var attributes=require(_0x756c('0x7'));module[_0x756c('0x8')]=function(_0x2318de,_0x32c71e){return _0x2318de['define']('FaxQueue',attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb1c3=['rimraf','../../config/environment','./faxQueue.attributes','exports','define','FaxQueue','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x5453fc,_0x32f4be){var _0xe1807f=function(_0x4ce440){while(--_0x4ce440){_0x5453fc['push'](_0x5453fc['shift']());}};_0xe1807f(++_0x32f4be);}(_0xb1c3,0x7b));var _0x3b1c=function(_0x761477,_0x52b753){_0x761477=_0x761477-0x0;var _0x3176a0=_0xb1c3[_0x761477];return _0x3176a0;};'use strict';var _=require('lodash');var util=require(_0x3b1c('0x0'));var logger=require(_0x3b1c('0x1'))(_0x3b1c('0x2'));var moment=require(_0x3b1c('0x3'));var BPromise=require(_0x3b1c('0x4'));var rp=require(_0x3b1c('0x5'));var fs=require('fs');var path=require(_0x3b1c('0x6'));var rimraf=require(_0x3b1c('0x7'));var config=require(_0x3b1c('0x8'));var attributes=require(_0x3b1c('0x9'));module[_0x3b1c('0xa')]=function(_0xa363a2,_0x1bbbfc){return _0xa363a2[_0x3b1c('0xb')](_0x3b1c('0xc'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index 5d8c7e5..eef4fce 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 _0x523c=['where','attributes','include','map','model','stringify','ShowFaxQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','info','debug','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','FaxQueue,\x20%s,\x20%s','message','catch','GetFaxQueue','FaxQueue','findAll','options','raw'];(function(_0x3ff311,_0x2bce1b){var _0x49637e=function(_0x18e002){while(--_0x18e002){_0x3ff311['push'](_0x3ff311['shift']());}};_0x49637e(++_0x2bce1b);}(_0x523c,0x1bf));var _0xc523=function(_0x41ca3e,_0x14ab10){_0x41ca3e=_0x41ca3e-0x0;var _0x4bede9=_0x523c[_0x41ca3e];return _0x4bede9;};'use strict';var _=require(_0xc523('0x0'));var util=require(_0xc523('0x1'));var moment=require(_0xc523('0x2'));var BPromise=require(_0xc523('0x3'));var rs=require(_0xc523('0x4'));var fs=require('fs');var Redis=require(_0xc523('0x5'));var db=require(_0xc523('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc523('0x7'));var config=require(_0xc523('0x8'));var jayson=require(_0xc523('0x9'));var client=jayson[_0xc523('0xa')][_0xc523('0xb')]({'port':0x232a});config[_0xc523('0xc')]=_[_0xc523('0xd')](config['redis'],{'host':_0xc523('0xe'),'port':0x18eb});var socket=require(_0xc523('0xf'))(new Redis(config[_0xc523('0xc')]));require(_0xc523('0x10'))[_0xc523('0x11')](socket);function respondWithRpcPromise(_0x56a5c1,_0x4719c3,_0x21dfa3){return new BPromise(function(_0x22fe08,_0x419476){return client[_0xc523('0x12')](_0x56a5c1,_0x21dfa3)[_0xc523('0x13')](function(_0x4449d4){logger[_0xc523('0x14')]('FaxQueue,\x20%s,\x20%s',_0x4719c3,'request\x20sent');logger[_0xc523('0x15')](_0xc523('0x16'),_0x4719c3,_0xc523('0x17'),JSON['stringify'](_0x4449d4));if(_0x4449d4[_0xc523('0x18')]){if(_0x4449d4['error']['code']===0x1f4){logger['error'](_0xc523('0x19'),_0x4719c3,_0x4449d4['error'][_0xc523('0x1a')]);return _0x419476(_0x4449d4[_0xc523('0x18')][_0xc523('0x1a')]);}logger['error'](_0xc523('0x19'),_0x4719c3,_0x4449d4['error']['message']);return _0x22fe08(_0x4449d4[_0xc523('0x18')][_0xc523('0x1a')]);}else{logger['info'](_0xc523('0x19'),_0x4719c3,_0xc523('0x17'));_0x22fe08(_0x4449d4['result']['message']);}})[_0xc523('0x1b')](function(_0x84cbae){logger['error'](_0xc523('0x19'),_0x4719c3,_0x84cbae);_0x419476(_0x84cbae);});});}exports[_0xc523('0x1c')]=function(_0xb9743a){var _0x2f6471=this;return new Promise(function(_0x493c31,_0x1e71d8){return db[_0xc523('0x1d')][_0xc523('0x1e')]({'raw':_0xb9743a[_0xc523('0x1f')]?_0xb9743a[_0xc523('0x1f')][_0xc523('0x20')]===undefined?!![]:![]:!![],'where':_0xb9743a['options']?_0xb9743a[_0xc523('0x1f')][_0xc523('0x21')]||null:null,'attributes':_0xb9743a[_0xc523('0x1f')]?_0xb9743a[_0xc523('0x1f')][_0xc523('0x22')]||null:null,'limit':_0xb9743a[_0xc523('0x1f')]?_0xb9743a[_0xc523('0x1f')]['limit']||null:null,'include':_0xb9743a[_0xc523('0x1f')]?_0xb9743a[_0xc523('0x1f')][_0xc523('0x23')]?_[_0xc523('0x24')](_0xb9743a[_0xc523('0x1f')][_0xc523('0x23')],function(_0x9d2825){return{'model':db[_0x9d2825[_0xc523('0x25')]],'as':_0x9d2825['as'],'attributes':_0x9d2825['attributes'],'include':_0x9d2825['include']?_['map'](_0x9d2825[_0xc523('0x23')],function(_0x295cec){return{'model':db[_0x295cec[_0xc523('0x25')]],'as':_0x295cec['as'],'attributes':_0x295cec[_0xc523('0x22')],'include':_0x295cec[_0xc523('0x23')]?_['map'](_0x295cec[_0xc523('0x23')],function(_0x116f66){return{'model':db[_0x116f66[_0xc523('0x25')]],'as':_0x116f66['as'],'attributes':_0x116f66['attributes']};}):[]};}):[]};}):[]:[]})[_0xc523('0x13')](function(_0x2cbde6){logger[_0xc523('0x14')](_0xc523('0x1c'),_0xb9743a);logger[_0xc523('0x15')](_0xc523('0x1c'),_0xb9743a,JSON[_0xc523('0x26')](_0x2cbde6));_0x493c31(_0x2cbde6);})[_0xc523('0x1b')](function(_0x39f8f2){logger[_0xc523('0x18')]('GetFaxQueue',_0x39f8f2[_0xc523('0x1a')],_0xb9743a);_0x1e71d8(_0x2f6471['error'](0x1f4,_0x39f8f2[_0xc523('0x1a')]));});});};exports['ShowFaxQueue']=function(_0x27fc5c){var _0x5df80e=this;return new Promise(function(_0x569916,_0x281ba4){return db[_0xc523('0x1d')]['find']({'raw':_0x27fc5c[_0xc523('0x1f')]?_0x27fc5c[_0xc523('0x1f')][_0xc523('0x20')]===undefined?!![]:![]:!![],'where':_0x27fc5c[_0xc523('0x1f')]?_0x27fc5c[_0xc523('0x1f')][_0xc523('0x21')]||null:null,'attributes':_0x27fc5c[_0xc523('0x1f')]?_0x27fc5c['options'][_0xc523('0x22')]||null:null,'include':_0x27fc5c[_0xc523('0x1f')]?_0x27fc5c[_0xc523('0x1f')][_0xc523('0x23')]?_[_0xc523('0x24')](_0x27fc5c['options']['include'],function(_0x590ced){return{'model':db[_0x590ced[_0xc523('0x25')]],'as':_0x590ced['as'],'attributes':_0x590ced[_0xc523('0x22')],'include':_0x590ced['include']?_[_0xc523('0x24')](_0x590ced[_0xc523('0x23')],function(_0x5211cc){return{'model':db[_0x5211cc[_0xc523('0x25')]],'as':_0x5211cc['as'],'attributes':_0x5211cc[_0xc523('0x22')],'include':_0x5211cc[_0xc523('0x23')]?_[_0xc523('0x24')](_0x5211cc[_0xc523('0x23')],function(_0x1d1ec2){return{'model':db[_0x1d1ec2[_0xc523('0x25')]],'as':_0x1d1ec2['as'],'attributes':_0x1d1ec2[_0xc523('0x22')]};}):[]};}):[]};}):[]:[]})[_0xc523('0x13')](function(_0x325a62){logger[_0xc523('0x14')](_0xc523('0x27'),_0x27fc5c);logger['debug'](_0xc523('0x27'),_0x27fc5c,JSON['stringify'](_0x325a62));_0x569916(_0x325a62);})[_0xc523('0x1b')](function(_0x5639cb){logger['error'](_0xc523('0x27'),_0x5639cb[_0xc523('0x1a')],_0x27fc5c);_0x281ba4(_0x5df80e['error'](0x1f4,_0x5639cb[_0xc523('0x1a')]));});});}; \ No newline at end of file +var _0x440a=['result','catch','GetFaxQueue','FaxQueue','options','where','attributes','limit','include','map','model','info','ShowFaxQueue','find','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./faxQueue.socket','register','request','request\x20sent','debug','stringify','error','FaxQueue,\x20%s,\x20%s','message'];(function(_0x48f038,_0x2bde84){var _0x2edc62=function(_0x1e6cc8){while(--_0x1e6cc8){_0x48f038['push'](_0x48f038['shift']());}};_0x2edc62(++_0x2bde84);}(_0x440a,0xa3));var _0xa440=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x440a[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xa440('0x0'));var util=require(_0xa440('0x1'));var moment=require(_0xa440('0x2'));var BPromise=require(_0xa440('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa440('0x4'));var db=require(_0xa440('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa440('0x6'));var config=require(_0xa440('0x7'));var jayson=require(_0xa440('0x8'));var client=jayson[_0xa440('0x9')][_0xa440('0xa')]({'port':0x232a});config[_0xa440('0xb')]=_[_0xa440('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa440('0xd'))[_0xa440('0xe')](socket);function respondWithRpcPromise(_0x297cbf,_0x52df32,_0x29470d){return new BPromise(function(_0x298f83,_0x99c488){return client[_0xa440('0xf')](_0x297cbf,_0x29470d)['then'](function(_0x374d30){logger['info']('FaxQueue,\x20%s,\x20%s',_0x52df32,_0xa440('0x10'));logger[_0xa440('0x11')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x52df32,_0xa440('0x10'),JSON[_0xa440('0x12')](_0x374d30));if(_0x374d30[_0xa440('0x13')]){if(_0x374d30[_0xa440('0x13')]['code']===0x1f4){logger[_0xa440('0x13')](_0xa440('0x14'),_0x52df32,_0x374d30[_0xa440('0x13')][_0xa440('0x15')]);return _0x99c488(_0x374d30[_0xa440('0x13')][_0xa440('0x15')]);}logger[_0xa440('0x13')](_0xa440('0x14'),_0x52df32,_0x374d30[_0xa440('0x13')]['message']);return _0x298f83(_0x374d30[_0xa440('0x13')][_0xa440('0x15')]);}else{logger['info'](_0xa440('0x14'),_0x52df32,_0xa440('0x10'));_0x298f83(_0x374d30[_0xa440('0x16')][_0xa440('0x15')]);}})[_0xa440('0x17')](function(_0x3e580b){logger['error'](_0xa440('0x14'),_0x52df32,_0x3e580b);_0x99c488(_0x3e580b);});});}exports[_0xa440('0x18')]=function(_0x1a0d35){var _0x32c39d=this;return new Promise(function(_0x5ecd70,_0x357169){return db[_0xa440('0x19')]['findAll']({'raw':_0x1a0d35[_0xa440('0x1a')]?_0x1a0d35[_0xa440('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1a0d35[_0xa440('0x1a')]?_0x1a0d35[_0xa440('0x1a')][_0xa440('0x1b')]||null:null,'attributes':_0x1a0d35[_0xa440('0x1a')]?_0x1a0d35[_0xa440('0x1a')][_0xa440('0x1c')]||null:null,'limit':_0x1a0d35['options']?_0x1a0d35[_0xa440('0x1a')][_0xa440('0x1d')]||null:null,'include':_0x1a0d35['options']?_0x1a0d35[_0xa440('0x1a')][_0xa440('0x1e')]?_[_0xa440('0x1f')](_0x1a0d35[_0xa440('0x1a')]['include'],function(_0x27da98){return{'model':db[_0x27da98[_0xa440('0x20')]],'as':_0x27da98['as'],'attributes':_0x27da98[_0xa440('0x1c')],'include':_0x27da98['include']?_[_0xa440('0x1f')](_0x27da98['include'],function(_0x24aa6b){return{'model':db[_0x24aa6b[_0xa440('0x20')]],'as':_0x24aa6b['as'],'attributes':_0x24aa6b[_0xa440('0x1c')],'include':_0x24aa6b[_0xa440('0x1e')]?_[_0xa440('0x1f')](_0x24aa6b[_0xa440('0x1e')],function(_0x4db1ad){return{'model':db[_0x4db1ad['model']],'as':_0x4db1ad['as'],'attributes':_0x4db1ad[_0xa440('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5203ee){logger[_0xa440('0x21')]('GetFaxQueue',_0x1a0d35);logger[_0xa440('0x11')]('GetFaxQueue',_0x1a0d35,JSON['stringify'](_0x5203ee));_0x5ecd70(_0x5203ee);})[_0xa440('0x17')](function(_0x443f26){logger[_0xa440('0x13')](_0xa440('0x18'),_0x443f26[_0xa440('0x15')],_0x1a0d35);_0x357169(_0x32c39d[_0xa440('0x13')](0x1f4,_0x443f26[_0xa440('0x15')]));});});};exports[_0xa440('0x22')]=function(_0x583f69){var _0x5b406c=this;return new Promise(function(_0x42ae6b,_0x1da734){return db[_0xa440('0x19')][_0xa440('0x23')]({'raw':_0x583f69[_0xa440('0x1a')]?_0x583f69[_0xa440('0x1a')][_0xa440('0x24')]===undefined?!![]:![]:!![],'where':_0x583f69[_0xa440('0x1a')]?_0x583f69[_0xa440('0x1a')]['where']||null:null,'attributes':_0x583f69[_0xa440('0x1a')]?_0x583f69[_0xa440('0x1a')][_0xa440('0x1c')]||null:null,'include':_0x583f69['options']?_0x583f69['options'][_0xa440('0x1e')]?_[_0xa440('0x1f')](_0x583f69[_0xa440('0x1a')][_0xa440('0x1e')],function(_0x404ee2){return{'model':db[_0x404ee2[_0xa440('0x20')]],'as':_0x404ee2['as'],'attributes':_0x404ee2[_0xa440('0x1c')],'include':_0x404ee2[_0xa440('0x1e')]?_[_0xa440('0x1f')](_0x404ee2[_0xa440('0x1e')],function(_0x597730){return{'model':db[_0x597730[_0xa440('0x20')]],'as':_0x597730['as'],'attributes':_0x597730[_0xa440('0x1c')],'include':_0x597730[_0xa440('0x1e')]?_[_0xa440('0x1f')](_0x597730[_0xa440('0x1e')],function(_0x1ec234){return{'model':db[_0x1ec234[_0xa440('0x20')]],'as':_0x1ec234['as'],'attributes':_0x1ec234[_0xa440('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x314fd7){logger[_0xa440('0x21')]('ShowFaxQueue',_0x583f69);logger['debug']('ShowFaxQueue',_0x583f69,JSON[_0xa440('0x12')](_0x314fd7));_0x42ae6b(_0x314fd7);})[_0xa440('0x17')](function(_0x1c1519){logger[_0xa440('0x13')](_0xa440('0x22'),_0x1c1519['message'],_0x583f69);_0x1da734(_0x5b406c[_0xa440('0x13')](0x1f4,_0x1c1519['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index c550b2f..d5bd4e3 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 _0xeb00=['save','emit','removeListener','register','length','./faxQueue.events'];(function(_0x3e2896,_0x2a4e68){var _0x53150a=function(_0x468214){while(--_0x468214){_0x3e2896['push'](_0x3e2896['shift']());}};_0x53150a(++_0x2a4e68);}(_0xeb00,0x1bb));var _0x0eb0=function(_0x3237ae,_0x3403fb){_0x3237ae=_0x3237ae-0x0;var _0x197d54=_0xeb00[_0x3237ae];return _0x197d54;};'use strict';var FaxQueueEvents=require(_0x0eb0('0x0'));var events=[_0x0eb0('0x1'),'remove','update'];function createListener(_0x3e7f5a,_0x391133){return function(_0xea1050){_0x391133[_0x0eb0('0x2')](_0x3e7f5a,_0xea1050);};}function removeListener(_0x430067,_0x512f1c){return function(){FaxQueueEvents[_0x0eb0('0x3')](_0x430067,_0x512f1c);};}exports[_0x0eb0('0x4')]=function(_0x223a2b){for(var _0x42e36a=0x0,_0x22c5dd=events[_0x0eb0('0x5')];_0x42e36a<_0x22c5dd;_0x42e36a++){var _0xf5ba43=events[_0x42e36a];var _0x270ead=createListener('faxQueue:'+_0xf5ba43,_0x223a2b);FaxQueueEvents['on'](_0xf5ba43,_0x270ead);}}; \ No newline at end of file +var _0x9bf9=['./faxQueue.events','save','emit','removeListener','register'];(function(_0x1d2589,_0x23195e){var _0x9e3890=function(_0x5386bb){while(--_0x5386bb){_0x1d2589['push'](_0x1d2589['shift']());}};_0x9e3890(++_0x23195e);}(_0x9bf9,0x168));var _0x99bf=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x9bf9[_0x3ff085];return _0x2b68c3;};'use strict';var FaxQueueEvents=require(_0x99bf('0x0'));var events=[_0x99bf('0x1'),'remove','update'];function createListener(_0x4fa48a,_0x3622d7){return function(_0x57b97b){_0x3622d7[_0x99bf('0x2')](_0x4fa48a,_0x57b97b);};}function removeListener(_0x9cbfb6,_0x4d34b1){return function(){FaxQueueEvents[_0x99bf('0x3')](_0x9cbfb6,_0x4d34b1);};}exports[_0x99bf('0x4')]=function(_0x61ecac){for(var _0x50d641=0x0,_0x1d4d33=events['length'];_0x50d641<_0x1d4d33;_0x50d641++){var _0x57c830=events[_0x50d641];var _0x4ad829=createListener('faxQueue:'+_0x57c830,_0x61ecac);FaxQueueEvents['on'](_0x57c830,_0x4ad829);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 4c42b36..1282781 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 _0xf0f4=['../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','put','update','delete','destroy','removeTeams','removeAgents','exports','util','express','Router','../../components/auth/service'];(function(_0x3c6835,_0x952d5c){var _0x1adeb9=function(_0xfefab3){while(--_0xfefab3){_0x3c6835['push'](_0x3c6835['shift']());}};_0x1adeb9(++_0x952d5c);}(_0xf0f4,0x182));var _0x4f0f=function(_0x589e56,_0x5e56ec){_0x589e56=_0x589e56-0x0;var _0x4a94b3=_0xf0f4[_0x589e56];return _0x4a94b3;};'use strict';var multer=require('multer');var util=require(_0x4f0f('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4f0f('0x1'));var router=express[_0x4f0f('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x4f0f('0x3'));var interaction=require(_0x4f0f('0x4'));var config=require(_0x4f0f('0x5'));var controller=require(_0x4f0f('0x6'));router[_0x4f0f('0x7')]('/',auth[_0x4f0f('0x8')](),controller[_0x4f0f('0x9')]);router['get'](_0x4f0f('0xa'),auth[_0x4f0f('0x8')](),controller[_0x4f0f('0xb')]);router['get'](_0x4f0f('0xc'),auth[_0x4f0f('0x8')](),controller[_0x4f0f('0xd')]);router[_0x4f0f('0x7')](_0x4f0f('0xe'),auth[_0x4f0f('0x8')](),controller[_0x4f0f('0xf')]);router[_0x4f0f('0x7')]('/:id/teams',auth[_0x4f0f('0x8')](),controller[_0x4f0f('0x10')]);router[_0x4f0f('0x7')](_0x4f0f('0x11'),auth[_0x4f0f('0x8')](),controller[_0x4f0f('0x12')]);router[_0x4f0f('0x13')]('/',auth[_0x4f0f('0x8')](),controller[_0x4f0f('0x14')]);router[_0x4f0f('0x13')](_0x4f0f('0x15'),auth['isAuthenticated'](),controller[_0x4f0f('0x16')]);router[_0x4f0f('0x13')](_0x4f0f('0x11'),auth[_0x4f0f('0x8')](),controller['addAgents']);router[_0x4f0f('0x17')](_0x4f0f('0xc'),auth[_0x4f0f('0x8')](),controller[_0x4f0f('0x18')]);router[_0x4f0f('0x19')]('/:id',auth[_0x4f0f('0x8')](),controller[_0x4f0f('0x1a')]);router[_0x4f0f('0x19')]('/:id/teams',auth[_0x4f0f('0x8')](),controller[_0x4f0f('0x1b')]);router[_0x4f0f('0x19')]('/:id/users',auth[_0x4f0f('0x8')](),controller[_0x4f0f('0x1c')]);module[_0x4f0f('0x1d')]=router; \ No newline at end of file +var _0x5fab=['/:id/teams','getTeams','/:id/users','post','addTeams','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','getMembers'];(function(_0x87727f,_0x5ad379){var _0x459352=function(_0x3c5245){while(--_0x3c5245){_0x87727f['push'](_0x87727f['shift']());}};_0x459352(++_0x5ad379);}(_0x5fab,0x177));var _0xb5fa=function(_0x46af7e,_0x3e32c7){_0x46af7e=_0x46af7e-0x0;var _0x4c0447=_0x5fab[_0x46af7e];return _0x4c0447;};'use strict';var multer=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var path=require('path');var timeout=require(_0xb5fa('0x2'));var express=require(_0xb5fa('0x3'));var router=express[_0xb5fa('0x4')]();var fs_extra=require(_0xb5fa('0x5'));var auth=require(_0xb5fa('0x6'));var interaction=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var controller=require(_0xb5fa('0x9'));router[_0xb5fa('0xa')]('/',auth[_0xb5fa('0xb')](),controller['index']);router['get'](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xd')]);router['get'](_0xb5fa('0xe'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xf')]);router['get']('/:id/members',auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x10')]);router[_0xb5fa('0xa')](_0xb5fa('0x11'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x12')]);router[_0xb5fa('0xa')](_0xb5fa('0x13'),auth[_0xb5fa('0xb')](),controller['getAgents']);router[_0xb5fa('0x14')]('/',auth[_0xb5fa('0xb')](),controller['create']);router[_0xb5fa('0x14')]('/:id/teams',auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x15')]);router[_0xb5fa('0x14')](_0xb5fa('0x13'),auth[_0xb5fa('0xb')](),controller['addAgents']);router['put'](_0xb5fa('0xe'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x16')]);router[_0xb5fa('0x17')]('/:id',auth['isAuthenticated'](),controller[_0xb5fa('0x18')]);router[_0xb5fa('0x17')](_0xb5fa('0x11'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x19')]);router[_0xb5fa('0x17')](_0xb5fa('0x13'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x1a')]);module[_0xb5fa('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index b14d8d1..b5e893b 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 _0x6b9d=['STRING','DATE','moment','sequelize','exports'];(function(_0x1de868,_0x276f1c){var _0x85119e=function(_0x1740b6){while(--_0x1740b6){_0x1de868['push'](_0x1de868['shift']());}};_0x85119e(++_0x276f1c);}(_0x6b9d,0xed));var _0xd6b9=function(_0x41d432,_0x20e878){_0x41d432=_0x41d432-0x0;var _0x1650f9=_0x6b9d[_0x41d432];return _0x1650f9;};'use strict';var moment=require(_0xd6b9('0x0'));var Sequelize=require(_0xd6b9('0x1'));module[_0xd6b9('0x2')]={'uniqueid':{'type':Sequelize[_0xd6b9('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xd6b9('0x3')]},'joinAt':{'type':Sequelize[_0xd6b9('0x4')]},'leaveAt':{'type':Sequelize[_0xd6b9('0x4')]},'acceptAt':{'type':Sequelize[_0xd6b9('0x4')]},'exitAt':{'type':Sequelize[_0xd6b9('0x4')]},'reason':{'type':Sequelize[_0xd6b9('0x3')]}}; \ No newline at end of file +var _0xd4d4=['DATE','STRING','moment','sequelize','exports'];(function(_0x3e7260,_0x3ac823){var _0x3e21be=function(_0x12306d){while(--_0x12306d){_0x3e7260['push'](_0x3e7260['shift']());}};_0x3e21be(++_0x3ac823);}(_0xd4d4,0x7a));var _0x4d4d=function(_0x1e9b75,_0x3b715f){_0x1e9b75=_0x1e9b75-0x0;var _0x53ef5f=_0xd4d4[_0x1e9b75];return _0x53ef5f;};'use strict';var moment=require(_0x4d4d('0x0'));var Sequelize=require(_0x4d4d('0x1'));module[_0x4d4d('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x4d4d('0x3')]},'leaveAt':{'type':Sequelize[_0x4d4d('0x3')]},'acceptAt':{'type':Sequelize[_0x4d4d('0x3')]},'exitAt':{'type':Sequelize[_0x4d4d('0x3')]},'reason':{'type':Sequelize[_0x4d4d('0x4')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 5f5c0e4..8be1828 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 _0x579c=['path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','model','fields','length','order','sort','where','filters','pick','filter','include','findAll','rows','catch','params','includeAll','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x579c,0xda));var _0xc579=function(_0x43a08a,_0x446a12){_0x43a08a=_0x43a08a-0x0;var _0x783bec=_0x579c[_0x43a08a];return _0x783bec;};'use strict';var emlformat=require(_0xc579('0x0'));var rimraf=require(_0xc579('0x1'));var zipdir=require(_0xc579('0x2'));var jsonpatch=require(_0xc579('0x3'));var rp=require(_0xc579('0x4'));var moment=require('moment');var BPromise=require(_0xc579('0x5'));var Mustache=require('mustache');var util=require(_0xc579('0x6'));var path=require(_0xc579('0x7'));var sox=require(_0xc579('0x8'));var csv=require(_0xc579('0x9'));var ejs=require(_0xc579('0xa'));var fs=require('fs');var fs_extra=require(_0xc579('0xb'));var _=require(_0xc579('0xc'));var squel=require('squel');var crypto=require(_0xc579('0xd'));var jsforce=require(_0xc579('0xe'));var deskjs=require(_0xc579('0xf'));var toCsv=require(_0xc579('0x9'));var querystring=require(_0xc579('0x10'));var Papa=require(_0xc579('0x11'));var Redis=require(_0xc579('0x12'));var authService=require(_0xc579('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xc579('0x14'));var hardwareService=require(_0xc579('0x15'));var logger=require(_0xc579('0x16'))(_0xc579('0x17'));var utils=require(_0xc579('0x18'));var config=require(_0xc579('0x19'));var licenseUtil=require(_0xc579('0x1a'));var db=require(_0xc579('0x1b'))['db'];function respondWithStatusCode(_0x421812,_0x441028){_0x441028=_0x441028||0xcc;return function(_0x448d51){if(_0x448d51){return _0x421812['sendStatus'](_0x441028);}return _0x421812[_0xc579('0x1c')](_0x441028)['end']();};}function respondWithResult(_0xf5400e,_0x59243e){_0x59243e=_0x59243e||0xc8;return function(_0x424e15){if(_0x424e15){return _0xf5400e['status'](_0x59243e)[_0xc579('0x1d')](_0x424e15);}};}function respondWithFilteredResult(_0x4b3635,_0x349e82){return function(_0x115276){if(_0x115276){var _0x567de5=typeof _0x349e82['offset']===_0xc579('0x1e')&&typeof _0x349e82[_0xc579('0x1f')]===_0xc579('0x1e');var _0x414ee7=_0x115276[_0xc579('0x20')];var _0x33d341=_0x567de5?0x0:_0x349e82[_0xc579('0x21')];var _0x3da8a1=_0x567de5?_0x115276[_0xc579('0x20')]:_0x349e82[_0xc579('0x21')]+_0x349e82['limit'];var _0x463f5e;if(_0x3da8a1>=_0x414ee7){_0x3da8a1=_0x414ee7;_0x463f5e=0xc8;}else{_0x463f5e=0xce;}_0x4b3635[_0xc579('0x1c')](_0x463f5e);return _0x4b3635['set'](_0xc579('0x22'),_0x33d341+'-'+_0x3da8a1+'/'+_0x414ee7)[_0xc579('0x1d')](_0x115276);}return null;};}function patchUpdates(_0x14fcdd){return function(_0x6501bc){try{jsonpatch[_0xc579('0x23')](_0x6501bc,_0x14fcdd,!![]);}catch(_0x4417e1){return BPromise[_0xc579('0x24')](_0x4417e1);}return _0x6501bc[_0xc579('0x25')]();};}function saveUpdates(_0x55781e,_0x92657f){return function(_0xad4889){if(_0xad4889){return _0xad4889[_0xc579('0x26')](_0x55781e)[_0xc579('0x27')](function(_0x1da86e){return _0x1da86e;});}return null;};}function removeEntity(_0x565a1b,_0x3634f2){return function(_0x3cf83f){if(_0x3cf83f){return _0x3cf83f[_0xc579('0x28')]()['then'](function(){_0x565a1b[_0xc579('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4610c2,_0x21a4db){return function(_0x4d758a){if(!_0x4d758a){_0x4610c2['sendStatus'](0x194);}return _0x4d758a;};}function handleError(_0x1f8e4b,_0x5b5f4e){_0x5b5f4e=_0x5b5f4e||0x1f4;return function(_0x532b33){logger['error'](_0x532b33[_0xc579('0x29')]);if(_0x532b33[_0xc579('0x2a')]){delete _0x532b33[_0xc579('0x2a')];}_0x1f8e4b[_0xc579('0x1c')](_0x5b5f4e)[_0xc579('0x2b')](_0x532b33);};}exports[_0xc579('0x2c')]=function(_0x45fef4,_0x5c272f){var _0x4d78bc={},_0x4a5f6={},_0x4897a1={'count':0x0,'rows':[]};var _0x314daa=_[_0xc579('0x2d')](db[_0xc579('0x2e')][_0xc579('0x2f')],function(_0x1ad8f7){return{'name':_0x1ad8f7[_0xc579('0x30')],'type':_0x1ad8f7[_0xc579('0x31')][_0xc579('0x32')]};});_0x4a5f6['model']=_[_0xc579('0x2d')](_0x314daa,_0xc579('0x2a'));_0x4a5f6[_0xc579('0x33')]=_[_0xc579('0x34')](_0x45fef4['query']);_0x4a5f6['filters']=_[_0xc579('0x35')](_0x4a5f6['model'],_0x4a5f6[_0xc579('0x33')]);_0x4d78bc[_0xc579('0x36')]=_[_0xc579('0x35')](_0x4a5f6[_0xc579('0x37')],qs[_0xc579('0x38')](_0x45fef4['query'][_0xc579('0x38')]));_0x4d78bc['attributes']=_0x4d78bc[_0xc579('0x36')][_0xc579('0x39')]?_0x4d78bc['attributes']:_0x4a5f6[_0xc579('0x37')];if(!_0x45fef4[_0xc579('0x33')]['hasOwnProperty']('nolimit')){_0x4d78bc[_0xc579('0x1f')]=qs[_0xc579('0x1f')](_0x45fef4['query'][_0xc579('0x1f')]);_0x4d78bc[_0xc579('0x21')]=qs['offset'](_0x45fef4[_0xc579('0x33')]['offset']);}_0x4d78bc[_0xc579('0x3a')]=qs[_0xc579('0x3b')](_0x45fef4['query'][_0xc579('0x3b')]);_0x4d78bc[_0xc579('0x3c')]=qs[_0xc579('0x3d')](_[_0xc579('0x3e')](_0x45fef4[_0xc579('0x33')],_0x4a5f6[_0xc579('0x3d')]),_0x314daa);if(_0x45fef4['query'][_0xc579('0x3f')]){_0x4d78bc[_0xc579('0x3c')]=_['merge'](_0x4d78bc[_0xc579('0x3c')],{'$or':_[_0xc579('0x2d')](_0x314daa,function(_0x3f9bee){if(_0x3f9bee[_0xc579('0x31')]!=='VIRTUAL'){var _0x3f744f={};_0x3f744f[_0x3f9bee[_0xc579('0x2a')]]={'$like':'%'+_0x45fef4[_0xc579('0x33')]['filter']+'%'};return _0x3f744f;}})});}_0x4d78bc=_['merge']({},_0x4d78bc,_0x45fef4['options']);var _0x1ef28f={'where':_0x4d78bc[_0xc579('0x3c')]};return db[_0xc579('0x2e')][_0xc579('0x20')](_0x1ef28f)[_0xc579('0x27')](function(_0x2b60eb){_0x4897a1['count']=_0x2b60eb;if(_0x45fef4[_0xc579('0x33')]['includeAll']){_0x4d78bc[_0xc579('0x40')]=[{'all':!![]}];}return db[_0xc579('0x2e')][_0xc579('0x41')](_0x4d78bc);})[_0xc579('0x27')](function(_0x3d8f24){_0x4897a1[_0xc579('0x42')]=_0x3d8f24;return _0x4897a1;})[_0xc579('0x27')](respondWithFilteredResult(_0x5c272f,_0x4d78bc))[_0xc579('0x43')](handleError(_0x5c272f,null));};exports['show']=function(_0x2a2248,_0x2532a5){var _0x74b63d={'raw':!![],'where':{'id':_0x2a2248[_0xc579('0x44')]['id']}},_0x2449e6={};_0x2449e6[_0xc579('0x37')]=_['keys'](db[_0xc579('0x2e')][_0xc579('0x2f')]);_0x2449e6[_0xc579('0x33')]=_['keys'](_0x2a2248[_0xc579('0x33')]);_0x2449e6[_0xc579('0x3d')]=_[_0xc579('0x35')](_0x2449e6['model'],_0x2449e6[_0xc579('0x33')]);_0x74b63d['attributes']=_[_0xc579('0x35')](_0x2449e6[_0xc579('0x37')],qs[_0xc579('0x38')](_0x2a2248['query'][_0xc579('0x38')]));_0x74b63d[_0xc579('0x36')]=_0x74b63d['attributes']['length']?_0x74b63d[_0xc579('0x36')]:_0x2449e6[_0xc579('0x37')];if(_0x2a2248[_0xc579('0x33')][_0xc579('0x45')]){_0x74b63d['include']=[{'all':!![]}];}_0x74b63d=_['merge']({},_0x74b63d,_0x2a2248[_0xc579('0x46')]);return db[_0xc579('0x2e')][_0xc579('0x47')](_0x74b63d)[_0xc579('0x27')](handleEntityNotFound(_0x2532a5,null))['then'](respondWithResult(_0x2532a5,null))[_0xc579('0x43')](handleError(_0x2532a5,null));};exports[_0xc579('0x48')]=function(_0x53eb6f,_0x40d790){return db['FaxQueueReport']['create'](_0x53eb6f['body'],{})[_0xc579('0x27')](respondWithResult(_0x40d790,0xc9))[_0xc579('0x43')](handleError(_0x40d790,null));};exports[_0xc579('0x26')]=function(_0x90a0d3,_0x1f9d15){if(_0x90a0d3['body']['id']){delete _0x90a0d3[_0xc579('0x49')]['id'];}return db[_0xc579('0x2e')][_0xc579('0x47')]({'where':{'id':_0x90a0d3['params']['id']}})['then'](handleEntityNotFound(_0x1f9d15,null))[_0xc579('0x27')](saveUpdates(_0x90a0d3[_0xc579('0x49')],null))[_0xc579('0x27')](respondWithResult(_0x1f9d15,null))[_0xc579('0x43')](handleError(_0x1f9d15,null));};exports[_0xc579('0x28')]=function(_0xe1a1d7,_0x138ab2){return db['FaxQueueReport']['find']({'where':{'id':_0xe1a1d7[_0xc579('0x44')]['id']}})[_0xc579('0x27')](handleEntityNotFound(_0x138ab2,null))['then'](removeEntity(_0x138ab2,null))[_0xc579('0x43')](handleError(_0x138ab2,null));};exports['describe']=function(_0x1e4872,_0x40017a){return db[_0xc579('0x2e')][_0xc579('0x4a')]()[_0xc579('0x27')](respondWithResult(_0x40017a,null))[_0xc579('0x43')](handleError(_0x40017a,null));}; \ No newline at end of file +var _0xd820=['merge','includeAll','include','rows','params','keys','options','find','catch','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','map','FaxQueueReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x2356e6,_0x130b1f){var _0x31094e=function(_0x5d8d91){while(--_0x5d8d91){_0x2356e6['push'](_0x2356e6['shift']());}};_0x31094e(++_0x130b1f);}(_0xd820,0x16f));var _0x0d82=function(_0x16fb3e,_0x47811c){_0x16fb3e=_0x16fb3e-0x0;var _0x46c1fe=_0xd820[_0x16fb3e];return _0x46c1fe;};'use strict';var emlformat=require(_0x0d82('0x0'));var rimraf=require(_0x0d82('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0d82('0x2'));var rp=require(_0x0d82('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0d82('0x4'));var util=require(_0x0d82('0x5'));var path=require(_0x0d82('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0d82('0x7'));var fs=require('fs');var fs_extra=require(_0x0d82('0x8'));var _=require(_0x0d82('0x9'));var squel=require(_0x0d82('0xa'));var crypto=require('crypto');var jsforce=require(_0x0d82('0xb'));var deskjs=require(_0x0d82('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0d82('0xd'));var Redis=require(_0x0d82('0xe'));var authService=require(_0x0d82('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0d82('0x10'));var logger=require(_0x0d82('0x11'))(_0x0d82('0x12'));var utils=require(_0x0d82('0x13'));var config=require(_0x0d82('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x851dbc,_0x7fdd7a){_0x7fdd7a=_0x7fdd7a||0xcc;return function(_0x103e1d){if(_0x103e1d){return _0x851dbc['sendStatus'](_0x7fdd7a);}return _0x851dbc[_0x0d82('0x15')](_0x7fdd7a)[_0x0d82('0x16')]();};}function respondWithResult(_0x8fe5e1,_0x3ad9dd){_0x3ad9dd=_0x3ad9dd||0xc8;return function(_0x288020){if(_0x288020){return _0x8fe5e1[_0x0d82('0x15')](_0x3ad9dd)[_0x0d82('0x17')](_0x288020);}};}function respondWithFilteredResult(_0x39c982,_0x2b2d47){return function(_0x55415f){if(_0x55415f){var _0x1e9024=typeof _0x2b2d47['offset']===_0x0d82('0x18')&&typeof _0x2b2d47['limit']===_0x0d82('0x18');var _0x31397a=_0x55415f[_0x0d82('0x19')];var _0x3383d8=_0x1e9024?0x0:_0x2b2d47[_0x0d82('0x1a')];var _0x16f941=_0x1e9024?_0x55415f[_0x0d82('0x19')]:_0x2b2d47[_0x0d82('0x1a')]+_0x2b2d47[_0x0d82('0x1b')];var _0x1007be;if(_0x16f941>=_0x31397a){_0x16f941=_0x31397a;_0x1007be=0xc8;}else{_0x1007be=0xce;}_0x39c982[_0x0d82('0x15')](_0x1007be);return _0x39c982[_0x0d82('0x1c')](_0x0d82('0x1d'),_0x3383d8+'-'+_0x16f941+'/'+_0x31397a)[_0x0d82('0x17')](_0x55415f);}return null;};}function patchUpdates(_0x5a0e1c){return function(_0x517997){try{jsonpatch[_0x0d82('0x1e')](_0x517997,_0x5a0e1c,!![]);}catch(_0x365404){return BPromise[_0x0d82('0x1f')](_0x365404);}return _0x517997['save']();};}function saveUpdates(_0x5def00,_0x2e332d){return function(_0x20d5eb){if(_0x20d5eb){return _0x20d5eb[_0x0d82('0x20')](_0x5def00)[_0x0d82('0x21')](function(_0x1f99ba){return _0x1f99ba;});}return null;};}function removeEntity(_0x18c248,_0x4a2d4d){return function(_0xb04794){if(_0xb04794){return _0xb04794[_0x0d82('0x22')]()[_0x0d82('0x21')](function(){_0x18c248['status'](0xcc)[_0x0d82('0x16')]();});}};}function handleEntityNotFound(_0x105c9a,_0x35a614){return function(_0x51b5a1){if(!_0x51b5a1){_0x105c9a[_0x0d82('0x23')](0x194);}return _0x51b5a1;};}function handleError(_0x10737d,_0xa636f0){_0xa636f0=_0xa636f0||0x1f4;return function(_0x5b3307){logger[_0x0d82('0x24')](_0x5b3307[_0x0d82('0x25')]);if(_0x5b3307[_0x0d82('0x26')]){delete _0x5b3307[_0x0d82('0x26')];}_0x10737d[_0x0d82('0x15')](_0xa636f0)[_0x0d82('0x27')](_0x5b3307);};}exports['index']=function(_0x5fd0dd,_0x15bc2b){var _0x43f679={},_0xf08815={},_0x548f33={'count':0x0,'rows':[]};var _0x465cd6=_[_0x0d82('0x28')](db[_0x0d82('0x29')][_0x0d82('0x2a')],function(_0x30477f){return{'name':_0x30477f[_0x0d82('0x2b')],'type':_0x30477f[_0x0d82('0x2c')]['key']};});_0xf08815[_0x0d82('0x2d')]=_[_0x0d82('0x28')](_0x465cd6,'name');_0xf08815[_0x0d82('0x2e')]=_['keys'](_0x5fd0dd[_0x0d82('0x2e')]);_0xf08815[_0x0d82('0x2f')]=_[_0x0d82('0x30')](_0xf08815['model'],_0xf08815[_0x0d82('0x2e')]);_0x43f679[_0x0d82('0x31')]=_[_0x0d82('0x30')](_0xf08815['model'],qs[_0x0d82('0x32')](_0x5fd0dd[_0x0d82('0x2e')][_0x0d82('0x32')]));_0x43f679['attributes']=_0x43f679[_0x0d82('0x31')][_0x0d82('0x33')]?_0x43f679['attributes']:_0xf08815[_0x0d82('0x2d')];if(!_0x5fd0dd['query'][_0x0d82('0x34')](_0x0d82('0x35'))){_0x43f679[_0x0d82('0x1b')]=qs[_0x0d82('0x1b')](_0x5fd0dd[_0x0d82('0x2e')][_0x0d82('0x1b')]);_0x43f679[_0x0d82('0x1a')]=qs[_0x0d82('0x1a')](_0x5fd0dd[_0x0d82('0x2e')][_0x0d82('0x1a')]);}_0x43f679[_0x0d82('0x36')]=qs[_0x0d82('0x37')](_0x5fd0dd[_0x0d82('0x2e')][_0x0d82('0x37')]);_0x43f679[_0x0d82('0x38')]=qs[_0x0d82('0x2f')](_[_0x0d82('0x39')](_0x5fd0dd[_0x0d82('0x2e')],_0xf08815[_0x0d82('0x2f')]),_0x465cd6);if(_0x5fd0dd[_0x0d82('0x2e')][_0x0d82('0x3a')]){_0x43f679['where']=_[_0x0d82('0x3b')](_0x43f679['where'],{'$or':_[_0x0d82('0x28')](_0x465cd6,function(_0x200f21){if(_0x200f21[_0x0d82('0x2c')]!=='VIRTUAL'){var _0x5467ce={};_0x5467ce[_0x200f21[_0x0d82('0x26')]]={'$like':'%'+_0x5fd0dd[_0x0d82('0x2e')][_0x0d82('0x3a')]+'%'};return _0x5467ce;}})});}_0x43f679=_[_0x0d82('0x3b')]({},_0x43f679,_0x5fd0dd['options']);var _0x417640={'where':_0x43f679['where']};return db[_0x0d82('0x29')][_0x0d82('0x19')](_0x417640)[_0x0d82('0x21')](function(_0x482702){_0x548f33[_0x0d82('0x19')]=_0x482702;if(_0x5fd0dd[_0x0d82('0x2e')][_0x0d82('0x3c')]){_0x43f679[_0x0d82('0x3d')]=[{'all':!![]}];}return db[_0x0d82('0x29')]['findAll'](_0x43f679);})[_0x0d82('0x21')](function(_0x244db0){_0x548f33[_0x0d82('0x3e')]=_0x244db0;return _0x548f33;})[_0x0d82('0x21')](respondWithFilteredResult(_0x15bc2b,_0x43f679))['catch'](handleError(_0x15bc2b,null));};exports['show']=function(_0x23a069,_0x11a462){var _0x5d4b63={'raw':!![],'where':{'id':_0x23a069[_0x0d82('0x3f')]['id']}},_0x45e109={};_0x45e109['model']=_[_0x0d82('0x40')](db[_0x0d82('0x29')]['rawAttributes']);_0x45e109[_0x0d82('0x2e')]=_[_0x0d82('0x40')](_0x23a069[_0x0d82('0x2e')]);_0x45e109[_0x0d82('0x2f')]=_['intersection'](_0x45e109['model'],_0x45e109['query']);_0x5d4b63[_0x0d82('0x31')]=_[_0x0d82('0x30')](_0x45e109['model'],qs['fields'](_0x23a069[_0x0d82('0x2e')]['fields']));_0x5d4b63[_0x0d82('0x31')]=_0x5d4b63['attributes'][_0x0d82('0x33')]?_0x5d4b63[_0x0d82('0x31')]:_0x45e109[_0x0d82('0x2d')];if(_0x23a069['query'][_0x0d82('0x3c')]){_0x5d4b63[_0x0d82('0x3d')]=[{'all':!![]}];}_0x5d4b63=_[_0x0d82('0x3b')]({},_0x5d4b63,_0x23a069[_0x0d82('0x41')]);return db['FaxQueueReport'][_0x0d82('0x42')](_0x5d4b63)[_0x0d82('0x21')](handleEntityNotFound(_0x11a462,null))[_0x0d82('0x21')](respondWithResult(_0x11a462,null))[_0x0d82('0x43')](handleError(_0x11a462,null));};exports[_0x0d82('0x44')]=function(_0x5e855c,_0x3978f5){return db[_0x0d82('0x29')][_0x0d82('0x44')](_0x5e855c['body'],{})[_0x0d82('0x21')](respondWithResult(_0x3978f5,0xc9))[_0x0d82('0x43')](handleError(_0x3978f5,null));};exports[_0x0d82('0x20')]=function(_0x7dff5a,_0x55461e){if(_0x7dff5a[_0x0d82('0x45')]['id']){delete _0x7dff5a['body']['id'];}return db[_0x0d82('0x29')]['find']({'where':{'id':_0x7dff5a[_0x0d82('0x3f')]['id']}})[_0x0d82('0x21')](handleEntityNotFound(_0x55461e,null))['then'](saveUpdates(_0x7dff5a['body'],null))['then'](respondWithResult(_0x55461e,null))[_0x0d82('0x43')](handleError(_0x55461e,null));};exports['destroy']=function(_0x2475b1,_0x2370d8){return db[_0x0d82('0x29')]['find']({'where':{'id':_0x2475b1[_0x0d82('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2370d8,null))[_0x0d82('0x21')](removeEntity(_0x2370d8,null))[_0x0d82('0x43')](handleError(_0x2370d8,null));};exports[_0x0d82('0x46')]=function(_0x474f55,_0xc4d1bc){return db[_0x0d82('0x29')]['describe']()['then'](respondWithResult(_0xc4d1bc,null))['catch'](handleError(_0xc4d1bc,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index d85f676..aaada3a 100644 --- a/server/api/faxQueueReport/faxQueueReport.model.js +++ b/server/api/faxQueueReport/faxQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf494=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','uniqueid','lodash'];(function(_0x233136,_0x290a87){var _0x3f9034=function(_0x3e0bbe){while(--_0x3e0bbe){_0x233136['push'](_0x233136['shift']());}};_0x3f9034(++_0x290a87);}(_0xf494,0x1c6));var _0x4f49=function(_0x2e24a8,_0x11b81e){_0x2e24a8=_0x2e24a8-0x0;var _0x1a337e=_0xf494[_0x2e24a8];return _0x1a337e;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var logger=require(_0x4f49('0x2'))('api');var moment=require(_0x4f49('0x3'));var BPromise=require(_0x4f49('0x4'));var rp=require(_0x4f49('0x5'));var fs=require('fs');var path=require(_0x4f49('0x6'));var rimraf=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var attributes=require(_0x4f49('0x9'));module[_0x4f49('0xa')]=function(_0xc5e778,_0x413530){return _0xc5e778[_0x4f49('0xb')]('FaxQueueReport',attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0x4f49('0xc'),'fields':[_0x4f49('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','uniqueid','lodash'];(function(_0x3072d1,_0x1a7317){var _0x1d4517=function(_0x445270){while(--_0x445270){_0x3072d1['push'](_0x3072d1['shift']());}};_0x1d4517(++_0x1a7317);}(_0x326f,0xd1));var _0xf326=function(_0x2375c3,_0x1141fe){_0x2375c3=_0x2375c3-0x0;var _0x4b945f=_0x326f[_0x2375c3];return _0x4b945f;};'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/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index b89c146..da7e6c3 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 _0xf545=['jayson/promise','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','FaxQueueReport','create','body','options','raw','CreateFaxQueueReport','debug','catch','UpdateFaxQueueReport','where','attributes','limit','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x513d80,_0x1649db){var _0x174463=function(_0x3b3dcd){while(--_0x3b3dcd){_0x513d80['push'](_0x513d80['shift']());}};_0x174463(++_0x1649db);}(_0xf545,0x184));var _0x5f54=function(_0x288478,_0x23303e){_0x288478=_0x288478-0x0;var _0x234c05=_0xf545[_0x288478];return _0x234c05;};'use strict';var _=require(_0x5f54('0x0'));var util=require(_0x5f54('0x1'));var moment=require(_0x5f54('0x2'));var BPromise=require('bluebird');var rs=require(_0x5f54('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5f54('0x4'))['db'];var utils=require(_0x5f54('0x5'));var logger=require(_0x5f54('0x6'))(_0x5f54('0x7'));var config=require('../../config/environment');var jayson=require(_0x5f54('0x8'));var client=jayson[_0x5f54('0x9')][_0x5f54('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9f89b5,_0x2d7a9d,_0x3664b7){return new BPromise(function(_0x2f9d4e,_0x4b1a44){return client[_0x5f54('0xb')](_0x9f89b5,_0x3664b7)[_0x5f54('0xc')](function(_0x4bf76e){logger[_0x5f54('0xd')](_0x5f54('0xe'),_0x2d7a9d,_0x5f54('0xf'));logger['debug'](_0x5f54('0x10'),_0x2d7a9d,_0x5f54('0xf'),JSON[_0x5f54('0x11')](_0x4bf76e));if(_0x4bf76e[_0x5f54('0x12')]){if(_0x4bf76e['error']['code']===0x1f4){logger[_0x5f54('0x12')](_0x5f54('0xe'),_0x2d7a9d,_0x4bf76e[_0x5f54('0x12')]['message']);return _0x4b1a44(_0x4bf76e[_0x5f54('0x12')][_0x5f54('0x13')]);}logger[_0x5f54('0x12')](_0x5f54('0xe'),_0x2d7a9d,_0x4bf76e[_0x5f54('0x12')][_0x5f54('0x13')]);return _0x2f9d4e(_0x4bf76e['error']['message']);}else{logger[_0x5f54('0xd')](_0x5f54('0xe'),_0x2d7a9d,_0x5f54('0xf'));_0x2f9d4e(_0x4bf76e[_0x5f54('0x14')]['message']);}})['catch'](function(_0x1cb60f){logger[_0x5f54('0x12')](_0x5f54('0xe'),_0x2d7a9d,_0x1cb60f);_0x4b1a44(_0x1cb60f);});});}exports['CreateFaxQueueReport']=function(_0x5d2acf){var _0x3a0860=this;return new Promise(function(_0x465b32,_0x1f0fae){return db[_0x5f54('0x15')][_0x5f54('0x16')](_0x5d2acf[_0x5f54('0x17')],{'raw':_0x5d2acf[_0x5f54('0x18')]?_0x5d2acf['options'][_0x5f54('0x19')]===undefined?!![]:![]:!![]})[_0x5f54('0xc')](function(_0x4832c1){logger[_0x5f54('0xd')](_0x5f54('0x1a'),_0x5d2acf);logger[_0x5f54('0x1b')](_0x5f54('0x1a'),_0x5d2acf,JSON[_0x5f54('0x11')](_0x4832c1));_0x465b32(_0x4832c1);})[_0x5f54('0x1c')](function(_0x181f48){logger['error']('CreateFaxQueueReport',_0x181f48[_0x5f54('0x13')],_0x5d2acf);_0x1f0fae(_0x3a0860['error'](0x1f4,_0x181f48['message']));});});};exports[_0x5f54('0x1d')]=function(_0xe7eb27){var _0x7ef31a=this;return new Promise(function(_0xb320c,_0x13e09e){return db['FaxQueueReport']['update'](_0xe7eb27[_0x5f54('0x17')],{'raw':_0xe7eb27['options']?_0xe7eb27[_0x5f54('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe7eb27[_0x5f54('0x18')]?_0xe7eb27[_0x5f54('0x18')][_0x5f54('0x1e')]||null:null,'attributes':_0xe7eb27[_0x5f54('0x18')]?_0xe7eb27['options'][_0x5f54('0x1f')]||null:null,'limit':_0xe7eb27[_0x5f54('0x18')]?_0xe7eb27['options'][_0x5f54('0x20')]||null:null})[_0x5f54('0xc')](function(_0x49e8c4){logger['info'](_0x5f54('0x1d'),_0xe7eb27);logger[_0x5f54('0x1b')](_0x5f54('0x1d'),_0xe7eb27,JSON['stringify'](_0x49e8c4));_0xb320c(_0x49e8c4);})[_0x5f54('0x1c')](function(_0x4a6568){logger[_0x5f54('0x12')](_0x5f54('0x1d'),_0x4a6568[_0x5f54('0x13')],_0xe7eb27);_0x13e09e(_0x7ef31a['error'](0x1f4,_0x4a6568[_0x5f54('0x13')]));});});}; \ No newline at end of file +var _0x8053=['FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateFaxQueueReport','create','body','options','UpdateFaxQueueReport','FaxQueueReport','update','raw','attributes','limit','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x481471,_0x26356b){var _0x1e92e0=function(_0xa8068){while(--_0xa8068){_0x481471['push'](_0x481471['shift']());}};_0x1e92e0(++_0x26356b);}(_0x8053,0xb0));var _0x3805=function(_0x466bc5,_0x3a0f2a){_0x466bc5=_0x466bc5-0x0;var _0x138952=_0x8053[_0x466bc5];return _0x138952;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3805('0x0'));var BPromise=require(_0x3805('0x1'));var rs=require(_0x3805('0x2'));var fs=require('fs');var Redis=require(_0x3805('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3805('0x4'));var logger=require('../../config/logger')(_0x3805('0x5'));var config=require(_0x3805('0x6'));var jayson=require(_0x3805('0x7'));var client=jayson[_0x3805('0x8')][_0x3805('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6b105f,_0x5c7447,_0x1961d1){return new BPromise(function(_0x2345a6,_0x54c5d3){return client[_0x3805('0xa')](_0x6b105f,_0x1961d1)[_0x3805('0xb')](function(_0x2122e1){logger[_0x3805('0xc')](_0x3805('0xd'),_0x5c7447,_0x3805('0xe'));logger[_0x3805('0xf')](_0x3805('0x10'),_0x5c7447,_0x3805('0xe'),JSON[_0x3805('0x11')](_0x2122e1));if(_0x2122e1[_0x3805('0x12')]){if(_0x2122e1[_0x3805('0x12')][_0x3805('0x13')]===0x1f4){logger[_0x3805('0x12')](_0x3805('0xd'),_0x5c7447,_0x2122e1['error'][_0x3805('0x14')]);return _0x54c5d3(_0x2122e1['error'][_0x3805('0x14')]);}logger[_0x3805('0x12')](_0x3805('0xd'),_0x5c7447,_0x2122e1[_0x3805('0x12')][_0x3805('0x14')]);return _0x2345a6(_0x2122e1[_0x3805('0x12')][_0x3805('0x14')]);}else{logger[_0x3805('0xc')](_0x3805('0xd'),_0x5c7447,_0x3805('0xe'));_0x2345a6(_0x2122e1['result']['message']);}})[_0x3805('0x15')](function(_0xdee749){logger[_0x3805('0x12')](_0x3805('0xd'),_0x5c7447,_0xdee749);_0x54c5d3(_0xdee749);});});}exports[_0x3805('0x16')]=function(_0x22b81a){var _0xd42dea=this;return new Promise(function(_0x4db012,_0x25d8b3){return db['FaxQueueReport'][_0x3805('0x17')](_0x22b81a[_0x3805('0x18')],{'raw':_0x22b81a[_0x3805('0x19')]?_0x22b81a[_0x3805('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x3805('0xb')](function(_0x19ec6a){logger[_0x3805('0xc')]('CreateFaxQueueReport',_0x22b81a);logger['debug'](_0x3805('0x16'),_0x22b81a,JSON['stringify'](_0x19ec6a));_0x4db012(_0x19ec6a);})['catch'](function(_0x23d038){logger[_0x3805('0x12')](_0x3805('0x16'),_0x23d038[_0x3805('0x14')],_0x22b81a);_0x25d8b3(_0xd42dea[_0x3805('0x12')](0x1f4,_0x23d038[_0x3805('0x14')]));});});};exports[_0x3805('0x1a')]=function(_0x27ee35){var _0x4b3f40=this;return new Promise(function(_0x4be117,_0x1c25f5){return db[_0x3805('0x1b')][_0x3805('0x1c')](_0x27ee35['body'],{'raw':_0x27ee35['options']?_0x27ee35[_0x3805('0x19')][_0x3805('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x27ee35[_0x3805('0x19')]?_0x27ee35[_0x3805('0x19')]['where']||null:null,'attributes':_0x27ee35[_0x3805('0x19')]?_0x27ee35[_0x3805('0x19')][_0x3805('0x1e')]||null:null,'limit':_0x27ee35[_0x3805('0x19')]?_0x27ee35[_0x3805('0x19')][_0x3805('0x1f')]||null:null})[_0x3805('0xb')](function(_0x49699a){logger[_0x3805('0xc')]('UpdateFaxQueueReport',_0x27ee35);logger['debug'](_0x3805('0x1a'),_0x27ee35,JSON[_0x3805('0x11')](_0x49699a));_0x4be117(_0x49699a);})[_0x3805('0x15')](function(_0x4f0b68){logger['error']('UpdateFaxQueueReport',_0x4f0b68['message'],_0x27ee35);_0x1c25f5(_0x4b3f40[_0x3805('0x12')](0x1f4,_0x4f0b68['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index cc4ddc2..f04d663 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 _0x9698=['put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','isAuthenticated','get','/describe','post','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9698,0x156));var _0x8969=function(_0x5e3b6b,_0x2ff7d9){_0x5e3b6b=_0x5e3b6b-0x0;var _0x5414a7=_0x9698[_0x5e3b6b];return _0x5414a7;};'use strict';var multer=require(_0x8969('0x0'));var util=require(_0x8969('0x1'));var path=require(_0x8969('0x2'));var timeout=require(_0x8969('0x3'));var express=require(_0x8969('0x4'));var router=express[_0x8969('0x5')]();var fs_extra=require(_0x8969('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x8969('0x7'));var config=require(_0x8969('0x8'));var controller=require(_0x8969('0x9'));router['get']('/',auth[_0x8969('0xa')](),controller['index']);router[_0x8969('0xb')](_0x8969('0xc'),auth[_0x8969('0xa')](),controller['describe']);router[_0x8969('0xb')]('/:id',auth[_0x8969('0xa')](),controller['show']);router[_0x8969('0xd')]('/',auth[_0x8969('0xa')](),controller[_0x8969('0xe')]);router[_0x8969('0xf')]('/:id',auth[_0x8969('0xa')](),controller[_0x8969('0x10')]);router[_0x8969('0x11')](_0x8969('0x12'),auth['isAuthenticated'](),controller[_0x8969('0x13')]);module[_0x8969('0x14')]=router; \ No newline at end of file +var _0xda90=['isAuthenticated','index','/describe','show','post','put','/:id','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./faxQueueReport.controller','get'];(function(_0x2779ba,_0x29dfd3){var _0x5952ff=function(_0x9d0459){while(--_0x9d0459){_0x2779ba['push'](_0x2779ba['shift']());}};_0x5952ff(++_0x29dfd3);}(_0xda90,0x173));var _0x0da9=function(_0x1ec4b8,_0x72d433){_0x1ec4b8=_0x1ec4b8-0x0;var _0x27ff41=_0xda90[_0x1ec4b8];return _0x27ff41;};'use strict';var multer=require(_0x0da9('0x0'));var util=require(_0x0da9('0x1'));var path=require('path');var timeout=require(_0x0da9('0x2'));var express=require(_0x0da9('0x3'));var router=express['Router']();var fs_extra=require(_0x0da9('0x4'));var auth=require(_0x0da9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0da9('0x6'));var controller=require(_0x0da9('0x7'));router[_0x0da9('0x8')]('/',auth[_0x0da9('0x9')](),controller[_0x0da9('0xa')]);router[_0x0da9('0x8')](_0x0da9('0xb'),auth[_0x0da9('0x9')](),controller['describe']);router[_0x0da9('0x8')]('/:id',auth[_0x0da9('0x9')](),controller[_0x0da9('0xc')]);router[_0x0da9('0xd')]('/',auth[_0x0da9('0x9')](),controller['create']);router[_0x0da9('0xe')](_0x0da9('0xf'),auth[_0x0da9('0x9')](),controller['update']);router[_0x0da9('0x10')]('/:id',auth[_0x0da9('0x9')](),controller[_0x0da9('0x11')]);module[_0x0da9('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 c33f2ba..be532a4 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(_0xb3506d,_0x538bb5){var _0xa39f18=function(_0x5c3200){while(--_0x5c3200){_0xb3506d['push'](_0xb3506d['shift']());}};_0xa39f18(++_0x538bb5);}(_0xedd9,0xfc));var _0x9edd=function(_0x20d536,_0x467185){_0x20d536=_0x20d536-0x0;var _0x37c3a6=_0xedd9[_0x20d536];return _0x37c3a6;};'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 _0xe706=['NOW','moment','sequelize','exports','ENUM','account','agent','queue','DATE'];(function(_0x23180f,_0x17f567){var _0x582a43=function(_0x22cbbb){while(--_0x22cbbb){_0x23180f['push'](_0x23180f['shift']());}};_0x582a43(++_0x17f567);}(_0xe706,0xa3));var _0x6e70=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xe706[_0x173d7e];return _0x2220d6;};'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/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index d00f300..72be0c7 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 _0xdaf3=['fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','sendStatus','error','stack','name','index','rawAttributes','fieldName','type','map','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','filter','where','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','options','FaxTransferReport','find','create','body','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0xdaf3,0x169));var _0x3daf=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xdaf3[_0x433a86];return _0x23000c;};'use strict';var emlformat=require(_0x3daf('0x0'));var rimraf=require(_0x3daf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3daf('0x2'));var rp=require(_0x3daf('0x3'));var moment=require(_0x3daf('0x4'));var BPromise=require(_0x3daf('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x3daf('0x6'));var csv=require(_0x3daf('0x7'));var ejs=require(_0x3daf('0x8'));var fs=require('fs');var fs_extra=require(_0x3daf('0x9'));var _=require(_0x3daf('0xa'));var squel=require(_0x3daf('0xb'));var crypto=require('crypto');var jsforce=require(_0x3daf('0xc'));var deskjs=require(_0x3daf('0xd'));var toCsv=require(_0x3daf('0x7'));var querystring=require(_0x3daf('0xe'));var Papa=require(_0x3daf('0xf'));var Redis=require(_0x3daf('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3daf('0x11'));var as=require(_0x3daf('0x12'));var hardwareService=require(_0x3daf('0x13'));var logger=require(_0x3daf('0x14'))(_0x3daf('0x15'));var utils=require(_0x3daf('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x3daf('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x39e584,_0x182557){_0x182557=_0x182557||0xcc;return function(_0x19343b){if(_0x19343b){return _0x39e584['sendStatus'](_0x182557);}return _0x39e584[_0x3daf('0x18')](_0x182557)[_0x3daf('0x19')]();};}function respondWithResult(_0x55a167,_0x363d9e){_0x363d9e=_0x363d9e||0xc8;return function(_0x3593eb){if(_0x3593eb){return _0x55a167[_0x3daf('0x18')](_0x363d9e)['json'](_0x3593eb);}};}function respondWithFilteredResult(_0x1cf973,_0x5d2928){return function(_0x4edfe7){if(_0x4edfe7){var _0x25e8f7=typeof _0x5d2928[_0x3daf('0x1a')]===_0x3daf('0x1b')&&typeof _0x5d2928['limit']===_0x3daf('0x1b');var _0x228cc8=_0x4edfe7[_0x3daf('0x1c')];var _0x2a1809=_0x25e8f7?0x0:_0x5d2928['offset'];var _0x292716=_0x25e8f7?_0x4edfe7[_0x3daf('0x1c')]:_0x5d2928[_0x3daf('0x1a')]+_0x5d2928[_0x3daf('0x1d')];var _0x3a2fac;if(_0x292716>=_0x228cc8){_0x292716=_0x228cc8;_0x3a2fac=0xc8;}else{_0x3a2fac=0xce;}_0x1cf973[_0x3daf('0x18')](_0x3a2fac);return _0x1cf973[_0x3daf('0x1e')](_0x3daf('0x1f'),_0x2a1809+'-'+_0x292716+'/'+_0x228cc8)[_0x3daf('0x20')](_0x4edfe7);}return null;};}function patchUpdates(_0x31a186){return function(_0x4a6efa){try{jsonpatch[_0x3daf('0x21')](_0x4a6efa,_0x31a186,!![]);}catch(_0xdc7812){return BPromise[_0x3daf('0x22')](_0xdc7812);}return _0x4a6efa[_0x3daf('0x23')]();};}function saveUpdates(_0x45dd67,_0x5e470f){return function(_0x290469){if(_0x290469){return _0x290469[_0x3daf('0x24')](_0x45dd67)['then'](function(_0x2c87f1){return _0x2c87f1;});}return null;};}function removeEntity(_0x41da95,_0x40afe3){return function(_0x2f4d5e){if(_0x2f4d5e){return _0x2f4d5e['destroy']()[_0x3daf('0x25')](function(){_0x41da95[_0x3daf('0x18')](0xcc)[_0x3daf('0x19')]();});}};}function handleEntityNotFound(_0x5a3d85,_0xff9a76){return function(_0x5c3a49){if(!_0x5c3a49){_0x5a3d85[_0x3daf('0x26')](0x194);}return _0x5c3a49;};}function handleError(_0x57b1a7,_0x3e8d81){_0x3e8d81=_0x3e8d81||0x1f4;return function(_0x3a61c4){logger[_0x3daf('0x27')](_0x3a61c4[_0x3daf('0x28')]);if(_0x3a61c4[_0x3daf('0x29')]){delete _0x3a61c4[_0x3daf('0x29')];}_0x57b1a7[_0x3daf('0x18')](_0x3e8d81)['send'](_0x3a61c4);};}exports[_0x3daf('0x2a')]=function(_0x28b3ec,_0x5235cb){var _0x5f39ea={},_0x9334ae={},_0x4035b1={'count':0x0,'rows':[]};var _0x407d3b=_['map'](db['FaxTransferReport'][_0x3daf('0x2b')],function(_0x57168c){return{'name':_0x57168c[_0x3daf('0x2c')],'type':_0x57168c[_0x3daf('0x2d')]['key']};});_0x9334ae['model']=_[_0x3daf('0x2e')](_0x407d3b,'name');_0x9334ae[_0x3daf('0x2f')]=_[_0x3daf('0x30')](_0x28b3ec['query']);_0x9334ae[_0x3daf('0x31')]=_['intersection'](_0x9334ae[_0x3daf('0x32')],_0x9334ae[_0x3daf('0x2f')]);_0x5f39ea['attributes']=_[_0x3daf('0x33')](_0x9334ae[_0x3daf('0x32')],qs[_0x3daf('0x34')](_0x28b3ec[_0x3daf('0x2f')][_0x3daf('0x34')]));_0x5f39ea[_0x3daf('0x35')]=_0x5f39ea['attributes'][_0x3daf('0x36')]?_0x5f39ea[_0x3daf('0x35')]:_0x9334ae['model'];if(!_0x28b3ec[_0x3daf('0x2f')][_0x3daf('0x37')]('nolimit')){_0x5f39ea['limit']=qs[_0x3daf('0x1d')](_0x28b3ec[_0x3daf('0x2f')][_0x3daf('0x1d')]);_0x5f39ea[_0x3daf('0x1a')]=qs[_0x3daf('0x1a')](_0x28b3ec['query'][_0x3daf('0x1a')]);}_0x5f39ea['order']=qs['sort'](_0x28b3ec['query']['sort']);_0x5f39ea['where']=qs[_0x3daf('0x31')](_['pick'](_0x28b3ec['query'],_0x9334ae['filters']),_0x407d3b);if(_0x28b3ec['query'][_0x3daf('0x38')]){_0x5f39ea[_0x3daf('0x39')]=_['merge'](_0x5f39ea[_0x3daf('0x39')],{'$or':_[_0x3daf('0x2e')](_0x407d3b,function(_0x2b0e0e){if(_0x2b0e0e[_0x3daf('0x2d')]!==_0x3daf('0x3a')){var _0x182169={};_0x182169[_0x2b0e0e['name']]={'$like':'%'+_0x28b3ec[_0x3daf('0x2f')][_0x3daf('0x38')]+'%'};return _0x182169;}})});}_0x5f39ea=_[_0x3daf('0x3b')]({},_0x5f39ea,_0x28b3ec['options']);var _0x489591={'where':_0x5f39ea[_0x3daf('0x39')]};return db['FaxTransferReport'][_0x3daf('0x1c')](_0x489591)[_0x3daf('0x25')](function(_0x4b7bbd){_0x4035b1[_0x3daf('0x1c')]=_0x4b7bbd;if(_0x28b3ec['query'][_0x3daf('0x3c')]){_0x5f39ea[_0x3daf('0x3d')]=[{'all':!![]}];}return db['FaxTransferReport'][_0x3daf('0x3e')](_0x5f39ea);})[_0x3daf('0x25')](function(_0x5b7ea3){_0x4035b1[_0x3daf('0x3f')]=_0x5b7ea3;return _0x4035b1;})[_0x3daf('0x25')](respondWithFilteredResult(_0x5235cb,_0x5f39ea))[_0x3daf('0x40')](handleError(_0x5235cb,null));};exports[_0x3daf('0x41')]=function(_0x144f88,_0x2768d2){var _0x4e1827={'raw':!![],'where':{'id':_0x144f88[_0x3daf('0x42')]['id']}},_0x50d471={};_0x50d471[_0x3daf('0x32')]=_[_0x3daf('0x30')](db['FaxTransferReport'][_0x3daf('0x2b')]);_0x50d471[_0x3daf('0x2f')]=_[_0x3daf('0x30')](_0x144f88[_0x3daf('0x2f')]);_0x50d471['filters']=_[_0x3daf('0x33')](_0x50d471[_0x3daf('0x32')],_0x50d471['query']);_0x4e1827[_0x3daf('0x35')]=_[_0x3daf('0x33')](_0x50d471[_0x3daf('0x32')],qs[_0x3daf('0x34')](_0x144f88[_0x3daf('0x2f')][_0x3daf('0x34')]));_0x4e1827[_0x3daf('0x35')]=_0x4e1827['attributes'][_0x3daf('0x36')]?_0x4e1827['attributes']:_0x50d471[_0x3daf('0x32')];if(_0x144f88[_0x3daf('0x2f')][_0x3daf('0x3c')]){_0x4e1827[_0x3daf('0x3d')]=[{'all':!![]}];}_0x4e1827=_[_0x3daf('0x3b')]({},_0x4e1827,_0x144f88[_0x3daf('0x43')]);return db[_0x3daf('0x44')][_0x3daf('0x45')](_0x4e1827)['then'](handleEntityNotFound(_0x2768d2,null))['then'](respondWithResult(_0x2768d2,null))['catch'](handleError(_0x2768d2,null));};exports[_0x3daf('0x46')]=function(_0x30bf7b,_0x8a88d4){return db[_0x3daf('0x44')][_0x3daf('0x46')](_0x30bf7b[_0x3daf('0x47')],{})['then'](respondWithResult(_0x8a88d4,0xc9))[_0x3daf('0x40')](handleError(_0x8a88d4,null));};exports[_0x3daf('0x24')]=function(_0x1b682a,_0x2a547c){if(_0x1b682a['body']['id']){delete _0x1b682a[_0x3daf('0x47')]['id'];}return db[_0x3daf('0x44')][_0x3daf('0x45')]({'where':{'id':_0x1b682a[_0x3daf('0x42')]['id']}})[_0x3daf('0x25')](handleEntityNotFound(_0x2a547c,null))[_0x3daf('0x25')](saveUpdates(_0x1b682a[_0x3daf('0x47')],null))[_0x3daf('0x25')](respondWithResult(_0x2a547c,null))[_0x3daf('0x40')](handleError(_0x2a547c,null));};exports[_0x3daf('0x48')]=function(_0x30a84a,_0x178bb0){return db['FaxTransferReport']['find']({'where':{'id':_0x30a84a[_0x3daf('0x42')]['id']}})[_0x3daf('0x25')](handleEntityNotFound(_0x178bb0,null))['then'](removeEntity(_0x178bb0,null))[_0x3daf('0x40')](handleError(_0x178bb0,null));};exports[_0x3daf('0x49')]=function(_0xb253df,_0x379d14){return db['FaxTransferReport'][_0x3daf('0x49')]()[_0x3daf('0x25')](respondWithResult(_0x379d14,null))[_0x3daf('0x40')](handleError(_0x379d14,null));}; \ No newline at end of file +var _0xf4f9=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','name','send','index','FaxTransferReport','fieldName','type','key','query','keys','intersection','model','attributes','length','nolimit','order','sort','where','filters','map','VIRTUAL','merge','options','includeAll','rows','catch','params','fields','include','find','create','body','destroy','describe','eml-format','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','ioredis','../../components/auth/service'];(function(_0x33d0a2,_0x13ad95){var _0x21c805=function(_0x17c198){while(--_0x17c198){_0x33d0a2['push'](_0x33d0a2['shift']());}};_0x21c805(++_0x13ad95);}(_0xf4f9,0x1a2));var _0x9f4f=function(_0x135636,_0x103811){_0x135636=_0x135636-0x0;var _0x2f1410=_0xf4f9[_0x135636];return _0x2f1410;};'use strict';var emlformat=require(_0x9f4f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9f4f('0x1'));var rp=require(_0x9f4f('0x2'));var moment=require('moment');var BPromise=require(_0x9f4f('0x3'));var Mustache=require('mustache');var util=require(_0x9f4f('0x4'));var path=require('path');var sox=require(_0x9f4f('0x5'));var csv=require(_0x9f4f('0x6'));var ejs=require(_0x9f4f('0x7'));var fs=require('fs');var fs_extra=require(_0x9f4f('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9f4f('0x9'));var jsforce=require(_0x9f4f('0xa'));var deskjs=require(_0x9f4f('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9f4f('0xc'));var authService=require(_0x9f4f('0xd'));var qs=require(_0x9f4f('0xe'));var as=require(_0x9f4f('0xf'));var hardwareService=require(_0x9f4f('0x10'));var logger=require(_0x9f4f('0x11'))(_0x9f4f('0x12'));var utils=require(_0x9f4f('0x13'));var config=require(_0x9f4f('0x14'));var licenseUtil=require(_0x9f4f('0x15'));var db=require(_0x9f4f('0x16'))['db'];function respondWithStatusCode(_0xa32c59,_0x2e4b0a){_0x2e4b0a=_0x2e4b0a||0xcc;return function(_0x53d9ec){if(_0x53d9ec){return _0xa32c59[_0x9f4f('0x17')](_0x2e4b0a);}return _0xa32c59[_0x9f4f('0x18')](_0x2e4b0a)[_0x9f4f('0x19')]();};}function respondWithResult(_0x373fba,_0x42c655){_0x42c655=_0x42c655||0xc8;return function(_0x1d9c71){if(_0x1d9c71){return _0x373fba[_0x9f4f('0x18')](_0x42c655)[_0x9f4f('0x1a')](_0x1d9c71);}};}function respondWithFilteredResult(_0x20a3ca,_0xf2e2fd){return function(_0x278e2b){if(_0x278e2b){var _0xb0165=typeof _0xf2e2fd[_0x9f4f('0x1b')]===_0x9f4f('0x1c')&&typeof _0xf2e2fd[_0x9f4f('0x1d')]===_0x9f4f('0x1c');var _0x334749=_0x278e2b['count'];var _0x16580d=_0xb0165?0x0:_0xf2e2fd[_0x9f4f('0x1b')];var _0x474734=_0xb0165?_0x278e2b[_0x9f4f('0x1e')]:_0xf2e2fd[_0x9f4f('0x1b')]+_0xf2e2fd['limit'];var _0xfa6ba3;if(_0x474734>=_0x334749){_0x474734=_0x334749;_0xfa6ba3=0xc8;}else{_0xfa6ba3=0xce;}_0x20a3ca[_0x9f4f('0x18')](_0xfa6ba3);return _0x20a3ca[_0x9f4f('0x1f')](_0x9f4f('0x20'),_0x16580d+'-'+_0x474734+'/'+_0x334749)[_0x9f4f('0x1a')](_0x278e2b);}return null;};}function patchUpdates(_0x33133e){return function(_0x53bb00){try{jsonpatch[_0x9f4f('0x21')](_0x53bb00,_0x33133e,!![]);}catch(_0x304d70){return BPromise[_0x9f4f('0x22')](_0x304d70);}return _0x53bb00[_0x9f4f('0x23')]();};}function saveUpdates(_0x5b02f1,_0x414d35){return function(_0x1dc12b){if(_0x1dc12b){return _0x1dc12b[_0x9f4f('0x24')](_0x5b02f1)[_0x9f4f('0x25')](function(_0x241a15){return _0x241a15;});}return null;};}function removeEntity(_0x566f4b,_0x4f94da){return function(_0x326632){if(_0x326632){return _0x326632['destroy']()['then'](function(){_0x566f4b[_0x9f4f('0x18')](0xcc)[_0x9f4f('0x19')]();});}};}function handleEntityNotFound(_0x284f21,_0x12608c){return function(_0x63fb6c){if(!_0x63fb6c){_0x284f21[_0x9f4f('0x17')](0x194);}return _0x63fb6c;};}function handleError(_0x1b6330,_0x44e6f0){_0x44e6f0=_0x44e6f0||0x1f4;return function(_0x114f59){logger[_0x9f4f('0x26')](_0x114f59['stack']);if(_0x114f59[_0x9f4f('0x27')]){delete _0x114f59[_0x9f4f('0x27')];}_0x1b6330['status'](_0x44e6f0)[_0x9f4f('0x28')](_0x114f59);};}exports[_0x9f4f('0x29')]=function(_0x2da5a7,_0x2c0d9a){var _0x263df4={},_0x9f5e93={},_0x21a85b={'count':0x0,'rows':[]};var _0xa305ef=_['map'](db[_0x9f4f('0x2a')]['rawAttributes'],function(_0x1dd61e){return{'name':_0x1dd61e[_0x9f4f('0x2b')],'type':_0x1dd61e[_0x9f4f('0x2c')][_0x9f4f('0x2d')]};});_0x9f5e93['model']=_['map'](_0xa305ef,_0x9f4f('0x27'));_0x9f5e93[_0x9f4f('0x2e')]=_[_0x9f4f('0x2f')](_0x2da5a7['query']);_0x9f5e93['filters']=_[_0x9f4f('0x30')](_0x9f5e93[_0x9f4f('0x31')],_0x9f5e93[_0x9f4f('0x2e')]);_0x263df4[_0x9f4f('0x32')]=_['intersection'](_0x9f5e93[_0x9f4f('0x31')],qs['fields'](_0x2da5a7['query']['fields']));_0x263df4['attributes']=_0x263df4[_0x9f4f('0x32')][_0x9f4f('0x33')]?_0x263df4[_0x9f4f('0x32')]:_0x9f5e93[_0x9f4f('0x31')];if(!_0x2da5a7[_0x9f4f('0x2e')]['hasOwnProperty'](_0x9f4f('0x34'))){_0x263df4['limit']=qs[_0x9f4f('0x1d')](_0x2da5a7['query'][_0x9f4f('0x1d')]);_0x263df4[_0x9f4f('0x1b')]=qs[_0x9f4f('0x1b')](_0x2da5a7[_0x9f4f('0x2e')][_0x9f4f('0x1b')]);}_0x263df4[_0x9f4f('0x35')]=qs[_0x9f4f('0x36')](_0x2da5a7['query'][_0x9f4f('0x36')]);_0x263df4[_0x9f4f('0x37')]=qs['filters'](_['pick'](_0x2da5a7[_0x9f4f('0x2e')],_0x9f5e93[_0x9f4f('0x38')]),_0xa305ef);if(_0x2da5a7[_0x9f4f('0x2e')]['filter']){_0x263df4['where']=_['merge'](_0x263df4[_0x9f4f('0x37')],{'$or':_[_0x9f4f('0x39')](_0xa305ef,function(_0x2f6fc5){if(_0x2f6fc5[_0x9f4f('0x2c')]!==_0x9f4f('0x3a')){var _0x4ee8e6={};_0x4ee8e6[_0x2f6fc5[_0x9f4f('0x27')]]={'$like':'%'+_0x2da5a7[_0x9f4f('0x2e')]['filter']+'%'};return _0x4ee8e6;}})});}_0x263df4=_[_0x9f4f('0x3b')]({},_0x263df4,_0x2da5a7[_0x9f4f('0x3c')]);var _0x3a0dd8={'where':_0x263df4[_0x9f4f('0x37')]};return db['FaxTransferReport'][_0x9f4f('0x1e')](_0x3a0dd8)[_0x9f4f('0x25')](function(_0xaea567){_0x21a85b[_0x9f4f('0x1e')]=_0xaea567;if(_0x2da5a7[_0x9f4f('0x2e')][_0x9f4f('0x3d')]){_0x263df4['include']=[{'all':!![]}];}return db['FaxTransferReport']['findAll'](_0x263df4);})[_0x9f4f('0x25')](function(_0x5d14c5){_0x21a85b[_0x9f4f('0x3e')]=_0x5d14c5;return _0x21a85b;})[_0x9f4f('0x25')](respondWithFilteredResult(_0x2c0d9a,_0x263df4))[_0x9f4f('0x3f')](handleError(_0x2c0d9a,null));};exports['show']=function(_0x3d9ca2,_0x4c6b3b){var _0x543db8={'raw':!![],'where':{'id':_0x3d9ca2[_0x9f4f('0x40')]['id']}},_0x2184c5={};_0x2184c5[_0x9f4f('0x31')]=_['keys'](db[_0x9f4f('0x2a')]['rawAttributes']);_0x2184c5[_0x9f4f('0x2e')]=_[_0x9f4f('0x2f')](_0x3d9ca2[_0x9f4f('0x2e')]);_0x2184c5['filters']=_[_0x9f4f('0x30')](_0x2184c5['model'],_0x2184c5[_0x9f4f('0x2e')]);_0x543db8[_0x9f4f('0x32')]=_[_0x9f4f('0x30')](_0x2184c5['model'],qs['fields'](_0x3d9ca2[_0x9f4f('0x2e')][_0x9f4f('0x41')]));_0x543db8[_0x9f4f('0x32')]=_0x543db8[_0x9f4f('0x32')][_0x9f4f('0x33')]?_0x543db8[_0x9f4f('0x32')]:_0x2184c5['model'];if(_0x3d9ca2[_0x9f4f('0x2e')][_0x9f4f('0x3d')]){_0x543db8[_0x9f4f('0x42')]=[{'all':!![]}];}_0x543db8=_[_0x9f4f('0x3b')]({},_0x543db8,_0x3d9ca2[_0x9f4f('0x3c')]);return db[_0x9f4f('0x2a')][_0x9f4f('0x43')](_0x543db8)[_0x9f4f('0x25')](handleEntityNotFound(_0x4c6b3b,null))['then'](respondWithResult(_0x4c6b3b,null))[_0x9f4f('0x3f')](handleError(_0x4c6b3b,null));};exports[_0x9f4f('0x44')]=function(_0x544c59,_0x29a9c3){return db[_0x9f4f('0x2a')][_0x9f4f('0x44')](_0x544c59[_0x9f4f('0x45')],{})[_0x9f4f('0x25')](respondWithResult(_0x29a9c3,0xc9))[_0x9f4f('0x3f')](handleError(_0x29a9c3,null));};exports[_0x9f4f('0x24')]=function(_0x219152,_0x4a8ada){if(_0x219152['body']['id']){delete _0x219152[_0x9f4f('0x45')]['id'];}return db[_0x9f4f('0x2a')][_0x9f4f('0x43')]({'where':{'id':_0x219152[_0x9f4f('0x40')]['id']}})[_0x9f4f('0x25')](handleEntityNotFound(_0x4a8ada,null))[_0x9f4f('0x25')](saveUpdates(_0x219152[_0x9f4f('0x45')],null))[_0x9f4f('0x25')](respondWithResult(_0x4a8ada,null))[_0x9f4f('0x3f')](handleError(_0x4a8ada,null));};exports[_0x9f4f('0x46')]=function(_0x2b4a9a,_0x3ca82a){return db[_0x9f4f('0x2a')]['find']({'where':{'id':_0x2b4a9a[_0x9f4f('0x40')]['id']}})[_0x9f4f('0x25')](handleEntityNotFound(_0x3ca82a,null))['then'](removeEntity(_0x3ca82a,null))[_0x9f4f('0x3f')](handleError(_0x3ca82a,null));};exports['describe']=function(_0xd2232b,_0x32a513){return db[_0x9f4f('0x2a')][_0x9f4f('0x47')]()[_0x9f4f('0x25')](respondWithResult(_0x32a513,null))[_0x9f4f('0x3f')](handleError(_0x32a513,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index ad6a6d8..02cea83 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 _0x762c=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','report_fax_transfer','uniqueid','lodash','util'];(function(_0x447cc2,_0x276966){var _0x17c0ee=function(_0x162ac9){while(--_0x162ac9){_0x447cc2['push'](_0x447cc2['shift']());}};_0x17c0ee(++_0x276966);}(_0x762c,0x1d2));var _0xc762=function(_0x19a7be,_0x49f923){_0x19a7be=_0x19a7be-0x0;var _0x177c30=_0x762c[_0x19a7be];return _0x177c30;};'use strict';var _=require(_0xc762('0x0'));var util=require(_0xc762('0x1'));var logger=require(_0xc762('0x2'))(_0xc762('0x3'));var moment=require('moment');var BPromise=require(_0xc762('0x4'));var rp=require(_0xc762('0x5'));var fs=require('fs');var path=require(_0xc762('0x6'));var rimraf=require(_0xc762('0x7'));var config=require(_0xc762('0x8'));var attributes=require('./faxTransferReport.attributes');module[_0xc762('0x9')]=function(_0x4e4f83,_0x1c8c1b){return _0x4e4f83['define']('FaxTransferReport',attributes,{'tableName':_0xc762('0xa'),'paranoid':![],'indexes':[{'name':_0xc762('0xb'),'fields':[_0xc762('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x81cb=['uniqueid','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','FaxTransferReport','report_fax_transfer'];(function(_0x487c61,_0x12f258){var _0x174649=function(_0x2d96e0){while(--_0x2d96e0){_0x487c61['push'](_0x487c61['shift']());}};_0x174649(++_0x12f258);}(_0x81cb,0xaa));var _0xb81c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x81cb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb81c('0x0'));var util=require(_0xb81c('0x1'));var logger=require('../../config/logger')(_0xb81c('0x2'));var moment=require(_0xb81c('0x3'));var BPromise=require('bluebird');var rp=require(_0xb81c('0x4'));var fs=require('fs');var path=require(_0xb81c('0x5'));var rimraf=require(_0xb81c('0x6'));var config=require(_0xb81c('0x7'));var attributes=require('./faxTransferReport.attributes');module[_0xb81c('0x8')]=function(_0x50d323,_0x4e7d10){return _0x50d323[_0xb81c('0x9')](_0xb81c('0xa'),attributes,{'tableName':_0xb81c('0xb'),'paranoid':![],'indexes':[{'name':_0xb81c('0xc'),'fields':[_0xb81c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 86372a5..83a8180 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 _0xf109=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','FaxTransferReport,\x20%s,\x20%s','message','result','lodash','util','moment','randomstring','../../mysqldb'];(function(_0x36c671,_0x35323f){var _0x15b833=function(_0x5d04fc){while(--_0x5d04fc){_0x36c671['push'](_0x36c671['shift']());}};_0x15b833(++_0x35323f);}(_0xf109,0x119));var _0x9f10=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xf109[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x9f10('0x0'));var util=require(_0x9f10('0x1'));var moment=require(_0x9f10('0x2'));var BPromise=require('bluebird');var rs=require(_0x9f10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9f10('0x4'))['db'];var utils=require(_0x9f10('0x5'));var logger=require(_0x9f10('0x6'))(_0x9f10('0x7'));var config=require(_0x9f10('0x8'));var jayson=require(_0x9f10('0x9'));var client=jayson[_0x9f10('0xa')][_0x9f10('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4793ed,_0x13dde0,_0x4ef636){return new BPromise(function(_0x2d89dd,_0xab5229){return client['request'](_0x4793ed,_0x4ef636)[_0x9f10('0xc')](function(_0x435fdc){logger[_0x9f10('0xd')]('FaxTransferReport,\x20%s,\x20%s',_0x13dde0,_0x9f10('0xe'));logger[_0x9f10('0xf')](_0x9f10('0x10'),_0x13dde0,_0x9f10('0xe'),JSON[_0x9f10('0x11')](_0x435fdc));if(_0x435fdc[_0x9f10('0x12')]){if(_0x435fdc[_0x9f10('0x12')]['code']===0x1f4){logger['error'](_0x9f10('0x13'),_0x13dde0,_0x435fdc[_0x9f10('0x12')][_0x9f10('0x14')]);return _0xab5229(_0x435fdc[_0x9f10('0x12')][_0x9f10('0x14')]);}logger['error'](_0x9f10('0x13'),_0x13dde0,_0x435fdc[_0x9f10('0x12')]['message']);return _0x2d89dd(_0x435fdc[_0x9f10('0x12')][_0x9f10('0x14')]);}else{logger['info'](_0x9f10('0x13'),_0x13dde0,_0x9f10('0xe'));_0x2d89dd(_0x435fdc[_0x9f10('0x15')][_0x9f10('0x14')]);}})['catch'](function(_0x4fbbe2){logger['error'](_0x9f10('0x13'),_0x13dde0,_0x4fbbe2);_0xab5229(_0x4fbbe2);});});} \ No newline at end of file +var _0x950a=['request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s'];(function(_0x4d4b4e,_0x4f9195){var _0x17e10c=function(_0x4333c3){while(--_0x4333c3){_0x4d4b4e['push'](_0x4d4b4e['shift']());}};_0x17e10c(++_0x4f9195);}(_0x950a,0xdf));var _0xa950=function(_0x184df0,_0x1d8a31){_0x184df0=_0x184df0-0x0;var _0x4dbcc8=_0x950a[_0x184df0];return _0x4dbcc8;};'use strict';var _=require(_0xa950('0x0'));var util=require(_0xa950('0x1'));var moment=require(_0xa950('0x2'));var BPromise=require(_0xa950('0x3'));var rs=require(_0xa950('0x4'));var fs=require('fs');var Redis=require(_0xa950('0x5'));var db=require(_0xa950('0x6'))['db'];var utils=require(_0xa950('0x7'));var logger=require(_0xa950('0x8'))(_0xa950('0x9'));var config=require('../../config/environment');var jayson=require(_0xa950('0xa'));var client=jayson[_0xa950('0xb')][_0xa950('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x512fd1,_0xdb6262,_0x1c36f4){return new BPromise(function(_0x28f333,_0x1961a1){return client[_0xa950('0xd')](_0x512fd1,_0x1c36f4)[_0xa950('0xe')](function(_0x54ca4e){logger[_0xa950('0xf')](_0xa950('0x10'),_0xdb6262,_0xa950('0x11'));logger[_0xa950('0x12')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0xdb6262,_0xa950('0x11'),JSON[_0xa950('0x13')](_0x54ca4e));if(_0x54ca4e[_0xa950('0x14')]){if(_0x54ca4e[_0xa950('0x14')][_0xa950('0x15')]===0x1f4){logger['error'](_0xa950('0x10'),_0xdb6262,_0x54ca4e[_0xa950('0x14')][_0xa950('0x16')]);return _0x1961a1(_0x54ca4e[_0xa950('0x14')][_0xa950('0x16')]);}logger[_0xa950('0x14')]('FaxTransferReport,\x20%s,\x20%s',_0xdb6262,_0x54ca4e['error']['message']);return _0x28f333(_0x54ca4e['error'][_0xa950('0x16')]);}else{logger[_0xa950('0xf')](_0xa950('0x10'),_0xdb6262,_0xa950('0x11'));_0x28f333(_0x54ca4e['result'][_0xa950('0x16')]);}})[_0xa950('0x17')](function(_0x5b6cb4){logger[_0xa950('0x14')]('FaxTransferReport,\x20%s,\x20%s',_0xdb6262,_0x5b6cb4);_0x1961a1(_0x5b6cb4);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 521fbca..cfadae6 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 _0xeec5=['update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./faxTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0xeec5,0x142));var _0x5eec=function(_0x5565d9,_0x56edac){_0x5565d9=_0x5565d9-0x0;var _0x2b4e90=_0xeec5[_0x5565d9];return _0x2b4e90;};'use strict';var multer=require(_0x5eec('0x0'));var util=require(_0x5eec('0x1'));var path=require(_0x5eec('0x2'));var timeout=require(_0x5eec('0x3'));var express=require(_0x5eec('0x4'));var router=express[_0x5eec('0x5')]();var fs_extra=require(_0x5eec('0x6'));var auth=require(_0x5eec('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5eec('0x8'));router[_0x5eec('0x9')]('/',auth[_0x5eec('0xa')](),controller[_0x5eec('0xb')]);router[_0x5eec('0x9')](_0x5eec('0xc'),auth[_0x5eec('0xa')](),controller[_0x5eec('0xd')]);router[_0x5eec('0x9')](_0x5eec('0xe'),auth[_0x5eec('0xa')](),controller[_0x5eec('0xf')]);router[_0x5eec('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5eec('0x11')](_0x5eec('0xe'),auth[_0x5eec('0xa')](),controller[_0x5eec('0x12')]);router[_0x5eec('0x13')](_0x5eec('0xe'),auth[_0x5eec('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe115=['describe','show','post','create','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated'];(function(_0x3d966a,_0xf95671){var _0x360fdf=function(_0xceb0d0){while(--_0xceb0d0){_0x3d966a['push'](_0x3d966a['shift']());}};_0x360fdf(++_0xf95671);}(_0xe115,0x66));var _0x5e11=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xe115[_0x110c3d];return _0x226d67;};'use strict';var multer=require(_0x5e11('0x0'));var util=require(_0x5e11('0x1'));var path=require(_0x5e11('0x2'));var timeout=require(_0x5e11('0x3'));var express=require(_0x5e11('0x4'));var router=express[_0x5e11('0x5')]();var fs_extra=require(_0x5e11('0x6'));var auth=require(_0x5e11('0x7'));var interaction=require(_0x5e11('0x8'));var config=require(_0x5e11('0x9'));var controller=require(_0x5e11('0xa'));router[_0x5e11('0xb')]('/',auth[_0x5e11('0xc')](),controller['index']);router[_0x5e11('0xb')]('/describe',auth[_0x5e11('0xc')](),controller[_0x5e11('0xd')]);router[_0x5e11('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x5e11('0xe')]);router[_0x5e11('0xf')]('/',auth[_0x5e11('0xc')](),controller[_0x5e11('0x10')]);router[_0x5e11('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x5e11('0x12')]);router[_0x5e11('0x13')](_0x5e11('0x14'),auth['isAuthenticated'](),controller[_0x5e11('0x15')]);module[_0x5e11('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 7a3f0d3..2f45277 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 _0x5434=['isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','create','post','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get'];(function(_0xa30766,_0x6f613e){var _0x24e780=function(_0x3d58fb){while(--_0x3d58fb){_0xa30766['push'](_0xa30766['shift']());}};_0x24e780(++_0x6f613e);}(_0x5434,0x90));var _0x4543=function(_0x5ab46c,_0x47f156){_0x5ab46c=_0x5ab46c-0x0;var _0x24867f=_0x5434[_0x5ab46c];return _0x24867f;};'use strict';var multer=require(_0x4543('0x0'));var util=require(_0x4543('0x1'));var path=require(_0x4543('0x2'));var timeout=require(_0x4543('0x3'));var express=require(_0x4543('0x4'));var router=express[_0x4543('0x5')]();var fs_extra=require(_0x4543('0x6'));var auth=require(_0x4543('0x7'));var interaction=require(_0x4543('0x8'));var config=require(_0x4543('0x9'));var controller=require(_0x4543('0xa'));router[_0x4543('0xb')]('/',auth[_0x4543('0xc')](),controller[_0x4543('0xd')]);router['get'](_0x4543('0xe'),auth['isAuthenticated'](),controller[_0x4543('0xf')]);router[_0x4543('0xb')](_0x4543('0x10'),auth[_0x4543('0xc')](),controller['getConfigurations']);router[_0x4543('0xb')](_0x4543('0x11'),auth[_0x4543('0xc')](),controller['getFields']);router['post']('/',auth[_0x4543('0xc')](),controller[_0x4543('0x12')]);router[_0x4543('0x13')](_0x4543('0x10'),auth[_0x4543('0xc')](),controller[_0x4543('0x14')]);router[_0x4543('0x15')]('/:id',auth[_0x4543('0xc')](),controller[_0x4543('0x16')]);router[_0x4543('0x17')](_0x4543('0xe'),auth[_0x4543('0xc')](),controller[_0x4543('0x18')]);module[_0x4543('0x19')]=router; \ No newline at end of file +var _0x5312=['get','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','delete','destroy','multer','path','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id','show'];(function(_0x8fb6c8,_0x34cdba){var _0x1f760d=function(_0x34d278){while(--_0x34d278){_0x8fb6c8['push'](_0x8fb6c8['shift']());}};_0x1f760d(++_0x34cdba);}(_0x5312,0x68));var _0x2531=function(_0x3b9f66,_0x59d6f3){_0x3b9f66=_0x3b9f66-0x0;var _0x24c2dd=_0x5312[_0x3b9f66];return _0x24c2dd;};'use strict';var multer=require(_0x2531('0x0'));var util=require('util');var path=require(_0x2531('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2531('0x2')]();var fs_extra=require(_0x2531('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x2531('0x4'));var config=require(_0x2531('0x5'));var controller=require('./intDeskAccount.controller');router['get']('/',auth[_0x2531('0x6')](),controller[_0x2531('0x7')]);router['get'](_0x2531('0x8'),auth['isAuthenticated'](),controller[_0x2531('0x9')]);router[_0x2531('0xa')](_0x2531('0xb'),auth[_0x2531('0x6')](),controller[_0x2531('0xc')]);router[_0x2531('0xa')](_0x2531('0xd'),auth[_0x2531('0x6')](),controller[_0x2531('0xe')]);router['post']('/',auth[_0x2531('0x6')](),controller[_0x2531('0xf')]);router[_0x2531('0x10')](_0x2531('0xb'),auth[_0x2531('0x6')](),controller['addConfiguration']);router['put'](_0x2531('0x8'),auth[_0x2531('0x6')](),controller['update']);router[_0x2531('0x11')](_0x2531('0x8'),auth[_0x2531('0x6')](),controller[_0x2531('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 1123c00..d882911 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 _0x671e=['integrationTab','STRING','ENUM','newTab'];(function(_0x42bd13,_0x2057a8){var _0x38cc96=function(_0x5d0035){while(--_0x5d0035){_0x42bd13['push'](_0x42bd13['shift']());}};_0x38cc96(++_0x2057a8);}(_0x671e,0x11d));var _0xe671=function(_0x1f03ea,_0x31633d){_0x1f03ea=_0x1f03ea-0x0;var _0x59c3e9=_0x671e[_0x1f03ea];return _0x59c3e9;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe671('0x0')]},'description':{'type':Sequelize[_0xe671('0x0')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0xe671('0x1')]('basic'),'defaultValue':'basic'},'password':{'type':Sequelize[_0xe671('0x0')]},'consumerKey':{'type':Sequelize[_0xe671('0x0')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xe671('0x0')]},'tokenSecret':{'type':Sequelize[_0xe671('0x0')]},'serverUrl':{'type':Sequelize[_0xe671('0x0')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab',_0xe671('0x2')),'defaultValue':_0xe671('0x3')}}; \ No newline at end of file +var _0xbc9f=['basic','integrationTab','sequelize','STRING','ENUM'];(function(_0x390556,_0x5b64bd){var _0x11868e=function(_0x51bf69){while(--_0x51bf69){_0x390556['push'](_0x390556['shift']());}};_0x11868e(++_0x5b64bd);}(_0xbc9f,0x16a));var _0xfbc9=function(_0x5e77db,_0x356d1c){_0x5e77db=_0x5e77db-0x0;var _0x34b675=_0xbc9f[_0x5e77db];return _0x34b675;};'use strict';var Sequelize=require(_0xfbc9('0x0'));module['exports']={'name':{'type':Sequelize[_0xfbc9('0x1')]},'description':{'type':Sequelize[_0xfbc9('0x1')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xfbc9('0x1')]},'authType':{'type':Sequelize[_0xfbc9('0x2')](_0xfbc9('0x3')),'defaultValue':_0xfbc9('0x3')},'password':{'type':Sequelize[_0xfbc9('0x1')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0xfbc9('0x1')]},'token':{'type':Sequelize[_0xfbc9('0x1')]},'tokenSecret':{'type':Sequelize[_0xfbc9('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xfbc9('0x2')]('integrationTab','newTab'),'defaultValue':_0xfbc9('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 47d169f..d85371c 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 _0x9ee4=['keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','DeskAccount','includeAll','include','rows','catch','show','params','find','create','body','getConfigurations','DeskConfiguration','order','findOne','AccountId','getSubjects','channel','Descriptions','getDescriptions','DeskField','Subjects','getFields','priority','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','slice','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s','username','toString','base64','concat','_embedded','entries','label','test','statusCode','error','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','model','query'];(function(_0x194fb4,_0x21be20){var _0x2b04b8=function(_0x4bd404){while(--_0x4bd404){_0x194fb4['push'](_0x194fb4['shift']());}};_0x2b04b8(++_0x21be20);}(_0x9ee4,0x197));var _0x49ee=function(_0x163272,_0x25e0e3){_0x163272=_0x163272-0x0;var _0x761bdd=_0x9ee4[_0x163272];return _0x761bdd;};'use strict';var emlformat=require(_0x49ee('0x0'));var rimraf=require(_0x49ee('0x1'));var zipdir=require(_0x49ee('0x2'));var jsonpatch=require(_0x49ee('0x3'));var rp=require(_0x49ee('0x4'));var moment=require(_0x49ee('0x5'));var BPromise=require(_0x49ee('0x6'));var Mustache=require(_0x49ee('0x7'));var util=require(_0x49ee('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x49ee('0x9'));var ejs=require(_0x49ee('0xa'));var fs=require('fs');var fs_extra=require(_0x49ee('0xb'));var _=require(_0x49ee('0xc'));var squel=require(_0x49ee('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x49ee('0x9'));var querystring=require(_0x49ee('0xe'));var Papa=require(_0x49ee('0xf'));var Redis=require(_0x49ee('0x10'));var authService=require(_0x49ee('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x49ee('0x12'));var hardwareService=require(_0x49ee('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x49ee('0x14'));var config=require(_0x49ee('0x15'));var licenseUtil=require(_0x49ee('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0x49ee('0x17'));function respondWithStatusCode(_0xccef0d,_0x3552a9){_0x3552a9=_0x3552a9||0xcc;return function(_0x1924b5){if(_0x1924b5){return _0xccef0d[_0x49ee('0x18')](_0x3552a9);}return _0xccef0d['status'](_0x3552a9)[_0x49ee('0x19')]();};}function respondWithResult(_0x3bff47,_0x4cd1d4){_0x4cd1d4=_0x4cd1d4||0xc8;return function(_0x2ecacf){if(_0x2ecacf){return _0x3bff47['status'](_0x4cd1d4)['json'](_0x2ecacf);}};}function respondWithFilteredResult(_0x344e26,_0x2eba23){return function(_0x32ffd7){if(_0x32ffd7){var _0x5d957d=typeof _0x2eba23[_0x49ee('0x1a')]===_0x49ee('0x1b')&&typeof _0x2eba23[_0x49ee('0x1c')]===_0x49ee('0x1b');var _0x4b5ca7=_0x32ffd7[_0x49ee('0x1d')];var _0x102c45=_0x5d957d?0x0:_0x2eba23[_0x49ee('0x1a')];var _0x34906e=_0x5d957d?_0x32ffd7['count']:_0x2eba23[_0x49ee('0x1a')]+_0x2eba23[_0x49ee('0x1c')];var _0x7d5b97;if(_0x34906e>=_0x4b5ca7){_0x34906e=_0x4b5ca7;_0x7d5b97=0xc8;}else{_0x7d5b97=0xce;}_0x344e26[_0x49ee('0x1e')](_0x7d5b97);return _0x344e26[_0x49ee('0x1f')](_0x49ee('0x20'),_0x102c45+'-'+_0x34906e+'/'+_0x4b5ca7)['json'](_0x32ffd7);}return null;};}function patchUpdates(_0xfe55af){return function(_0x232ac3){try{jsonpatch[_0x49ee('0x21')](_0x232ac3,_0xfe55af,!![]);}catch(_0x350bf9){return BPromise[_0x49ee('0x22')](_0x350bf9);}return _0x232ac3[_0x49ee('0x23')]();};}function saveUpdates(_0x408e26,_0xe7d401){return function(_0x2a100f){if(_0x2a100f){return _0x2a100f[_0x49ee('0x24')](_0x408e26)[_0x49ee('0x25')](function(_0x5cb2ba){return _0x5cb2ba;});}return null;};}function removeEntity(_0x315ee9,_0x9f1846){return function(_0x5a2e14){if(_0x5a2e14){return _0x5a2e14[_0x49ee('0x26')]()[_0x49ee('0x25')](function(){_0x315ee9[_0x49ee('0x1e')](0xcc)[_0x49ee('0x19')]();});}};}function handleEntityNotFound(_0x41781d,_0x58012f){return function(_0x24808d){if(!_0x24808d){_0x41781d['sendStatus'](0x194);}return _0x24808d;};}function handleError(_0x470c11,_0x22c504){_0x22c504=_0x22c504||0x1f4;return function(_0x32ef24){logger['error'](_0x32ef24[_0x49ee('0x27')]);if(_0x32ef24[_0x49ee('0x28')]){delete _0x32ef24[_0x49ee('0x28')];}_0x470c11['status'](_0x22c504)[_0x49ee('0x29')](_0x32ef24);};}exports[_0x49ee('0x2a')]=function(_0x19bf4b,_0x2c261e){var _0x377ef5={},_0xf7fd8d={},_0x52ca1b={'count':0x0,'rows':[]};var _0x3fb95a=_[_0x49ee('0x2b')](db['DeskAccount'][_0x49ee('0x2c')],function(_0x1696f9){return{'name':_0x1696f9[_0x49ee('0x2d')],'type':_0x1696f9[_0x49ee('0x2e')]['key']};});_0xf7fd8d[_0x49ee('0x2f')]=_[_0x49ee('0x2b')](_0x3fb95a,'name');_0xf7fd8d[_0x49ee('0x30')]=_[_0x49ee('0x31')](_0x19bf4b[_0x49ee('0x30')]);_0xf7fd8d[_0x49ee('0x32')]=_['intersection'](_0xf7fd8d[_0x49ee('0x2f')],_0xf7fd8d[_0x49ee('0x30')]);_0x377ef5['attributes']=_[_0x49ee('0x33')](_0xf7fd8d[_0x49ee('0x2f')],qs['fields'](_0x19bf4b[_0x49ee('0x30')][_0x49ee('0x34')]));_0x377ef5[_0x49ee('0x35')]=_0x377ef5[_0x49ee('0x35')][_0x49ee('0x36')]?_0x377ef5[_0x49ee('0x35')]:_0xf7fd8d['model'];if(!_0x19bf4b[_0x49ee('0x30')][_0x49ee('0x37')](_0x49ee('0x38'))){_0x377ef5['limit']=qs[_0x49ee('0x1c')](_0x19bf4b[_0x49ee('0x30')][_0x49ee('0x1c')]);_0x377ef5[_0x49ee('0x1a')]=qs['offset'](_0x19bf4b['query'][_0x49ee('0x1a')]);}_0x377ef5['order']=qs[_0x49ee('0x39')](_0x19bf4b['query'][_0x49ee('0x39')]);_0x377ef5[_0x49ee('0x3a')]=qs['filters'](_[_0x49ee('0x3b')](_0x19bf4b[_0x49ee('0x30')],_0xf7fd8d[_0x49ee('0x32')]),_0x3fb95a);if(_0x19bf4b[_0x49ee('0x30')][_0x49ee('0x3c')]){_0x377ef5[_0x49ee('0x3a')]=_[_0x49ee('0x3d')](_0x377ef5[_0x49ee('0x3a')],{'$or':_[_0x49ee('0x2b')](_0x3fb95a,function(_0x509575){if(_0x509575[_0x49ee('0x2e')]!==_0x49ee('0x3e')){var _0x395dd5={};_0x395dd5[_0x509575['name']]={'$like':'%'+_0x19bf4b[_0x49ee('0x30')][_0x49ee('0x3c')]+'%'};return _0x395dd5;}})});}_0x377ef5=_[_0x49ee('0x3d')]({},_0x377ef5,_0x19bf4b[_0x49ee('0x3f')]);var _0x25ea8d={'where':_0x377ef5['where']};return db[_0x49ee('0x40')]['count'](_0x25ea8d)[_0x49ee('0x25')](function(_0x54e514){_0x52ca1b[_0x49ee('0x1d')]=_0x54e514;if(_0x19bf4b[_0x49ee('0x30')][_0x49ee('0x41')]){_0x377ef5[_0x49ee('0x42')]=[{'all':!![]}];}return db[_0x49ee('0x40')]['findAll'](_0x377ef5);})[_0x49ee('0x25')](function(_0x58f81c){_0x52ca1b[_0x49ee('0x43')]=_0x58f81c;return _0x52ca1b;})[_0x49ee('0x25')](respondWithFilteredResult(_0x2c261e,_0x377ef5))[_0x49ee('0x44')](handleError(_0x2c261e,null));};exports[_0x49ee('0x45')]=function(_0x1f5de3,_0x153dfb){var _0x4e9497={'raw':![],'where':{'id':_0x1f5de3[_0x49ee('0x46')]['id']}},_0x559a84={};_0x559a84[_0x49ee('0x2f')]=_['keys'](db[_0x49ee('0x40')]['rawAttributes']);_0x559a84[_0x49ee('0x30')]=_['keys'](_0x1f5de3['query']);_0x559a84[_0x49ee('0x32')]=_[_0x49ee('0x33')](_0x559a84[_0x49ee('0x2f')],_0x559a84[_0x49ee('0x30')]);_0x4e9497[_0x49ee('0x35')]=_[_0x49ee('0x33')](_0x559a84[_0x49ee('0x2f')],qs[_0x49ee('0x34')](_0x1f5de3[_0x49ee('0x30')][_0x49ee('0x34')]));_0x4e9497[_0x49ee('0x35')]=_0x4e9497[_0x49ee('0x35')][_0x49ee('0x36')]?_0x4e9497[_0x49ee('0x35')]:_0x559a84[_0x49ee('0x2f')];if(_0x1f5de3[_0x49ee('0x30')]['includeAll']){_0x4e9497[_0x49ee('0x42')]=[{'all':!![]}];}_0x4e9497=_[_0x49ee('0x3d')]({},_0x4e9497,_0x1f5de3[_0x49ee('0x3f')]);return db[_0x49ee('0x40')][_0x49ee('0x47')](_0x4e9497)[_0x49ee('0x25')](handleEntityNotFound(_0x153dfb,null))[_0x49ee('0x25')](respondWithResult(_0x153dfb,null))[_0x49ee('0x44')](handleError(_0x153dfb,null));};exports['create']=function(_0x1faf06,_0x34758e){return db['DeskAccount'][_0x49ee('0x48')](_0x1faf06[_0x49ee('0x49')],{})[_0x49ee('0x25')](respondWithResult(_0x34758e,0xc9))[_0x49ee('0x44')](handleError(_0x34758e,null));};exports[_0x49ee('0x24')]=function(_0x49bf37,_0x36adb8){if(_0x49bf37[_0x49ee('0x49')]['id']){delete _0x49bf37['body']['id'];}return db['DeskAccount'][_0x49ee('0x47')]({'where':{'id':_0x49bf37[_0x49ee('0x46')]['id']}})[_0x49ee('0x25')](handleEntityNotFound(_0x36adb8,null))['then'](saveUpdates(_0x49bf37[_0x49ee('0x49')],null))['then'](respondWithResult(_0x36adb8,null))[_0x49ee('0x44')](handleError(_0x36adb8,null));};exports[_0x49ee('0x26')]=function(_0x2d7d75,_0x8faedd){return db[_0x49ee('0x40')][_0x49ee('0x47')]({'where':{'id':_0x2d7d75[_0x49ee('0x46')]['id']}})[_0x49ee('0x25')](handleEntityNotFound(_0x8faedd,null))['then'](removeEntity(_0x8faedd,null))['catch'](handleError(_0x8faedd,null));};exports[_0x49ee('0x4a')]=function(_0x504d73,_0x431236,_0x22344b){var _0x1adf14={};var _0x2501e6={};var _0xc54bfd;var _0x544f4c;return db['DeskAccount']['findOne']({'where':{'id':_0x504d73[_0x49ee('0x46')]['id']}})[_0x49ee('0x25')](handleEntityNotFound(_0x431236,null))[_0x49ee('0x25')](function(_0x43e4ea){if(_0x43e4ea){_0xc54bfd=_0x43e4ea;_0x2501e6[_0x49ee('0x2f')]=_[_0x49ee('0x31')](db[_0x49ee('0x4b')][_0x49ee('0x2c')]);_0x2501e6[_0x49ee('0x30')]=_[_0x49ee('0x31')](_0x504d73[_0x49ee('0x30')]);_0x2501e6['filters']=_[_0x49ee('0x33')](_0x2501e6[_0x49ee('0x2f')],_0x2501e6[_0x49ee('0x30')]);_0x1adf14['attributes']=_[_0x49ee('0x33')](_0x2501e6['model'],qs[_0x49ee('0x34')](_0x504d73[_0x49ee('0x30')]['fields']));_0x1adf14['attributes']=_0x1adf14[_0x49ee('0x35')]['length']?_0x1adf14[_0x49ee('0x35')]:_0x2501e6[_0x49ee('0x2f')];_0x1adf14[_0x49ee('0x4c')]=qs[_0x49ee('0x39')](_0x504d73[_0x49ee('0x30')][_0x49ee('0x39')]);_0x1adf14['where']=qs[_0x49ee('0x32')](_[_0x49ee('0x3b')](_0x504d73[_0x49ee('0x30')],_0x2501e6[_0x49ee('0x32')]));if(_0x504d73[_0x49ee('0x30')][_0x49ee('0x3c')]){_0x1adf14[_0x49ee('0x3a')]=_[_0x49ee('0x3d')](_0x1adf14[_0x49ee('0x3a')],{'$or':_[_0x49ee('0x2b')](_0x1adf14['attributes'],function(_0x4a81c4){var _0x87ce15={};_0x87ce15[_0x4a81c4]={'$like':'%'+_0x504d73[_0x49ee('0x30')][_0x49ee('0x3c')]+'%'};return _0x87ce15;})});}_0x1adf14=_[_0x49ee('0x3d')]({},_0x1adf14,_0x504d73[_0x49ee('0x3f')]);return _0xc54bfd[_0x49ee('0x4a')](_0x1adf14);}})[_0x49ee('0x25')](function(_0x2b236a){if(_0x2b236a){_0x544f4c=_0x2b236a['length'];if(!_0x504d73['query'][_0x49ee('0x37')](_0x49ee('0x38'))){_0x1adf14[_0x49ee('0x1c')]=qs[_0x49ee('0x1c')](_0x504d73[_0x49ee('0x30')][_0x49ee('0x1c')]);_0x1adf14['offset']=qs[_0x49ee('0x1a')](_0x504d73['query'][_0x49ee('0x1a')]);}return _0xc54bfd[_0x49ee('0x4a')](_0x1adf14);}})['then'](function(_0x340600){if(_0x340600){return _0x340600?{'count':_0x544f4c,'rows':_0x340600}:null;}})[_0x49ee('0x25')](respondWithResult(_0x431236,null))[_0x49ee('0x44')](handleError(_0x431236,null));};exports['addConfiguration']=function(_0x433fd0,_0x5395db,_0x529bfa){if(_0x433fd0['body']['id']){delete _0x433fd0[_0x49ee('0x49')]['id'];}return db['DeskAccount'][_0x49ee('0x4d')]({'where':{'id':_0x433fd0['params']['id']}})[_0x49ee('0x25')](handleEntityNotFound(_0x5395db,null))[_0x49ee('0x25')](function(_0x576555){if(_0x576555){_0x433fd0[_0x49ee('0x49')][_0x49ee('0x4e')]=_0x576555['id'];_0x433fd0['body']['Subjects']=integrations[_0x49ee('0x4f')](_0x433fd0[_0x49ee('0x49')][_0x49ee('0x50')],_0x433fd0['body'][_0x49ee('0x2e')]);_0x433fd0['body'][_0x49ee('0x51')]=integrations[_0x49ee('0x52')](_0x433fd0[_0x49ee('0x49')][_0x49ee('0x50')],_0x433fd0[_0x49ee('0x49')]['type']);return db[_0x49ee('0x4b')][_0x49ee('0x48')](_0x433fd0[_0x49ee('0x49')],{'include':[{'model':db[_0x49ee('0x53')],'as':_0x49ee('0x54')},{'model':db[_0x49ee('0x53')],'as':'Descriptions'}]});}return null;})[_0x49ee('0x25')](respondWithResult(_0x5395db,null))['catch'](handleError(_0x5395db,null));};exports[_0x49ee('0x55')]=function(_0x3f6d1a,_0x688662,_0x284c84){var _0x561218=[{'name':_0x49ee('0x56'),'label':_0x49ee('0x56'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x489cd9='';return db[_0x49ee('0x40')][_0x49ee('0x4d')]({'where':{'id':_0x3f6d1a['params']['id']},'attributes':['id',_0x49ee('0x57'),_0x49ee('0x58'),'username',_0x49ee('0x59'),_0x49ee('0x5a'),_0x49ee('0x5b'),_0x49ee('0x5c'),_0x49ee('0x5d')]})[_0x49ee('0x25')](handleEntityNotFound(_0x688662,null))[_0x49ee('0x25')](function(_0x3addc3){if(_0x3addc3){_0x489cd9=_0x3addc3[_0x49ee('0x57')];var _0x41a0c7=_0x489cd9[_0x49ee('0x5e')](-0x1);if(_0x41a0c7==='/'){_0x489cd9=_0x489cd9['substring'](0x0,_0x489cd9['lastIndexOf'](_0x41a0c7));}var _0x9be1ee={'method':_0x49ee('0x5f'),'uri':util[_0x49ee('0x60')](_0x49ee('0x61'),_0x489cd9),'headers':{'Content-Type':_0x49ee('0x62'),'Accept':_0x49ee('0x62')},'json':!![]};if(_0x3addc3[_0x49ee('0x58')]===_0x49ee('0x63')){_0x9be1ee[_0x49ee('0x64')][_0x49ee('0x65')]=util['format'](_0x49ee('0x66'),new Buffer(util['format'](_0x49ee('0x67'),_0x3addc3[_0x49ee('0x68')],_0x3addc3[_0x49ee('0x59')]))[_0x49ee('0x69')](_0x49ee('0x6a')));}return rp(_0x9be1ee)[_0x49ee('0x25')](function(_0x1589b5){return _0x561218[_0x49ee('0x6b')](_[_0x49ee('0x2b')](_0x1589b5[_0x49ee('0x6c')][_0x49ee('0x6d')],function(_0x26f226){return{'id':_0x26f226[_0x49ee('0x28')],'name':_0x26f226[_0x49ee('0x28')],'type':_0x26f226[_0x49ee('0x2e')],'active':_0x26f226['active'],'label':_0x26f226[_0x49ee('0x6e')],'custom':!![]};}));});}})[_0x49ee('0x25')](function(_0x1820e5){return{'count':_0x1820e5[_0x49ee('0x36')],'rows':_0x1820e5};})['then'](respondWithResult(_0x688662,null))[_0x49ee('0x44')](function(_0x1a7541){var _0x4ebbae=_0x3f6d1a[_0x49ee('0x30')][_0x49ee('0x6f')]?0x1f4:_0x1a7541[_0x49ee('0x70')]||0x1f4;logger[_0x49ee('0x71')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x4ebbae,JSON['stringify'](_0x1a7541));delete _0x1a7541[_0x49ee('0x28')];if(_0x4ebbae===0x191){_0x4ebbae=0x190;}_0x688662[_0x49ee('0x1e')](_0x4ebbae)[_0x49ee('0x29')](_0x3f6d1a[_0x49ee('0x30')][_0x49ee('0x6f')]?{'message':'Wrong\x20credentials','statusCode':_0x1a7541[_0x49ee('0x70')]}:_0x1a7541);});}; \ No newline at end of file +var _0x0442=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range','apply','reject','then','destroy','stack','name','send','index','map','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','DeskAccount','includeAll','findAll','catch','show','params','length','options','find','create','body','update','getConfigurations','findOne','DeskConfiguration','rawAttributes','filter','addConfiguration','AccountId','Subjects','getSubjects','getDescriptions','channel','DeskField','Descriptions','priority','remoteUri','authType','username','password','consumerSecret','token','tokenSecret','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','toString','base64','concat','_embedded','entries','active','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse'];(function(_0x50fe4a,_0x34d65a){var _0x37ce07=function(_0x18e87a){while(--_0x18e87a){_0x50fe4a['push'](_0x50fe4a['shift']());}};_0x37ce07(++_0x34d65a);}(_0x0442,0x1bc));var _0x2044=function(_0x3239f5,_0x50e77c){_0x3239f5=_0x3239f5-0x0;var _0x3559c8=_0x0442[_0x3239f5];return _0x3559c8;};'use strict';var emlformat=require(_0x2044('0x0'));var rimraf=require(_0x2044('0x1'));var zipdir=require(_0x2044('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2044('0x3'));var moment=require(_0x2044('0x4'));var BPromise=require(_0x2044('0x5'));var Mustache=require(_0x2044('0x6'));var util=require('util');var path=require('path');var sox=require(_0x2044('0x7'));var csv=require(_0x2044('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2044('0x9'));var _=require(_0x2044('0xa'));var squel=require(_0x2044('0xb'));var crypto=require('crypto');var jsforce=require(_0x2044('0xc'));var deskjs=require(_0x2044('0xd'));var toCsv=require(_0x2044('0x8'));var querystring=require(_0x2044('0xe'));var Papa=require(_0x2044('0xf'));var Redis=require(_0x2044('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x2044('0x11'));var as=require(_0x2044('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2044('0x13'))(_0x2044('0x14'));var utils=require('../../config/utils');var config=require(_0x2044('0x15'));var licenseUtil=require(_0x2044('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0x2044('0x17'));function respondWithStatusCode(_0x30ab12,_0x1a23bd){_0x1a23bd=_0x1a23bd||0xcc;return function(_0x3052ac){if(_0x3052ac){return _0x30ab12[_0x2044('0x18')](_0x1a23bd);}return _0x30ab12['status'](_0x1a23bd)[_0x2044('0x19')]();};}function respondWithResult(_0xea14c7,_0x4afbf4){_0x4afbf4=_0x4afbf4||0xc8;return function(_0x2588cc){if(_0x2588cc){return _0xea14c7[_0x2044('0x1a')](_0x4afbf4)[_0x2044('0x1b')](_0x2588cc);}};}function respondWithFilteredResult(_0x5612b4,_0x532d7e){return function(_0x24d80c){if(_0x24d80c){var _0x1f23ae=typeof _0x532d7e[_0x2044('0x1c')]==='undefined'&&typeof _0x532d7e[_0x2044('0x1d')]===_0x2044('0x1e');var _0x2f26f9=_0x24d80c['count'];var _0x342157=_0x1f23ae?0x0:_0x532d7e[_0x2044('0x1c')];var _0x44e1ac=_0x1f23ae?_0x24d80c[_0x2044('0x1f')]:_0x532d7e['offset']+_0x532d7e[_0x2044('0x1d')];var _0x5caec9;if(_0x44e1ac>=_0x2f26f9){_0x44e1ac=_0x2f26f9;_0x5caec9=0xc8;}else{_0x5caec9=0xce;}_0x5612b4['status'](_0x5caec9);return _0x5612b4['set'](_0x2044('0x20'),_0x342157+'-'+_0x44e1ac+'/'+_0x2f26f9)['json'](_0x24d80c);}return null;};}function patchUpdates(_0x34ca64){return function(_0x43ceaa){try{jsonpatch[_0x2044('0x21')](_0x43ceaa,_0x34ca64,!![]);}catch(_0x2bb30d){return BPromise[_0x2044('0x22')](_0x2bb30d);}return _0x43ceaa['save']();};}function saveUpdates(_0x26d111,_0x1fd8c7){return function(_0x1c24a9){if(_0x1c24a9){return _0x1c24a9['update'](_0x26d111)[_0x2044('0x23')](function(_0x512f7f){return _0x512f7f;});}return null;};}function removeEntity(_0x3fe957,_0x13ff50){return function(_0x55e920){if(_0x55e920){return _0x55e920[_0x2044('0x24')]()[_0x2044('0x23')](function(){_0x3fe957[_0x2044('0x1a')](0xcc)[_0x2044('0x19')]();});}};}function handleEntityNotFound(_0x107be0,_0x5d94ab){return function(_0x3829cd){if(!_0x3829cd){_0x107be0[_0x2044('0x18')](0x194);}return _0x3829cd;};}function handleError(_0x48b05b,_0xfc18a9){_0xfc18a9=_0xfc18a9||0x1f4;return function(_0x1bc932){logger['error'](_0x1bc932[_0x2044('0x25')]);if(_0x1bc932[_0x2044('0x26')]){delete _0x1bc932[_0x2044('0x26')];}_0x48b05b[_0x2044('0x1a')](_0xfc18a9)[_0x2044('0x27')](_0x1bc932);};}exports[_0x2044('0x28')]=function(_0x3bd1b1,_0x1a5e91){var _0x43c85c={},_0x3c4efc={},_0x48e2e0={'count':0x0,'rows':[]};var _0x222ef5=_[_0x2044('0x29')](db['DeskAccount']['rawAttributes'],function(_0x5cf86f){return{'name':_0x5cf86f[_0x2044('0x2a')],'type':_0x5cf86f[_0x2044('0x2b')]['key']};});_0x3c4efc[_0x2044('0x2c')]=_['map'](_0x222ef5,'name');_0x3c4efc[_0x2044('0x2d')]=_[_0x2044('0x2e')](_0x3bd1b1[_0x2044('0x2d')]);_0x3c4efc[_0x2044('0x2f')]=_[_0x2044('0x30')](_0x3c4efc[_0x2044('0x2c')],_0x3c4efc[_0x2044('0x2d')]);_0x43c85c[_0x2044('0x31')]=_[_0x2044('0x30')](_0x3c4efc[_0x2044('0x2c')],qs[_0x2044('0x32')](_0x3bd1b1[_0x2044('0x2d')][_0x2044('0x32')]));_0x43c85c['attributes']=_0x43c85c['attributes']['length']?_0x43c85c['attributes']:_0x3c4efc[_0x2044('0x2c')];if(!_0x3bd1b1[_0x2044('0x2d')][_0x2044('0x33')](_0x2044('0x34'))){_0x43c85c[_0x2044('0x1d')]=qs[_0x2044('0x1d')](_0x3bd1b1[_0x2044('0x2d')][_0x2044('0x1d')]);_0x43c85c[_0x2044('0x1c')]=qs[_0x2044('0x1c')](_0x3bd1b1[_0x2044('0x2d')][_0x2044('0x1c')]);}_0x43c85c[_0x2044('0x35')]=qs[_0x2044('0x36')](_0x3bd1b1[_0x2044('0x2d')][_0x2044('0x36')]);_0x43c85c[_0x2044('0x37')]=qs['filters'](_[_0x2044('0x38')](_0x3bd1b1['query'],_0x3c4efc['filters']),_0x222ef5);if(_0x3bd1b1[_0x2044('0x2d')]['filter']){_0x43c85c[_0x2044('0x37')]=_[_0x2044('0x39')](_0x43c85c[_0x2044('0x37')],{'$or':_[_0x2044('0x29')](_0x222ef5,function(_0x17659d){if(_0x17659d['type']!==_0x2044('0x3a')){var _0x23cbd3={};_0x23cbd3[_0x17659d[_0x2044('0x26')]]={'$like':'%'+_0x3bd1b1[_0x2044('0x2d')]['filter']+'%'};return _0x23cbd3;}})});}_0x43c85c=_['merge']({},_0x43c85c,_0x3bd1b1['options']);var _0xff4807={'where':_0x43c85c[_0x2044('0x37')]};return db[_0x2044('0x3b')][_0x2044('0x1f')](_0xff4807)[_0x2044('0x23')](function(_0x7f090d){_0x48e2e0[_0x2044('0x1f')]=_0x7f090d;if(_0x3bd1b1[_0x2044('0x2d')][_0x2044('0x3c')]){_0x43c85c['include']=[{'all':!![]}];}return db[_0x2044('0x3b')][_0x2044('0x3d')](_0x43c85c);})['then'](function(_0x5717a2){_0x48e2e0['rows']=_0x5717a2;return _0x48e2e0;})['then'](respondWithFilteredResult(_0x1a5e91,_0x43c85c))[_0x2044('0x3e')](handleError(_0x1a5e91,null));};exports[_0x2044('0x3f')]=function(_0x1e1076,_0x10140d){var _0xd56ecc={'raw':![],'where':{'id':_0x1e1076[_0x2044('0x40')]['id']}},_0x482d7a={};_0x482d7a[_0x2044('0x2c')]=_[_0x2044('0x2e')](db[_0x2044('0x3b')]['rawAttributes']);_0x482d7a['query']=_['keys'](_0x1e1076[_0x2044('0x2d')]);_0x482d7a['filters']=_['intersection'](_0x482d7a[_0x2044('0x2c')],_0x482d7a[_0x2044('0x2d')]);_0xd56ecc[_0x2044('0x31')]=_[_0x2044('0x30')](_0x482d7a[_0x2044('0x2c')],qs[_0x2044('0x32')](_0x1e1076['query'][_0x2044('0x32')]));_0xd56ecc[_0x2044('0x31')]=_0xd56ecc[_0x2044('0x31')][_0x2044('0x41')]?_0xd56ecc[_0x2044('0x31')]:_0x482d7a[_0x2044('0x2c')];if(_0x1e1076[_0x2044('0x2d')][_0x2044('0x3c')]){_0xd56ecc['include']=[{'all':!![]}];}_0xd56ecc=_[_0x2044('0x39')]({},_0xd56ecc,_0x1e1076[_0x2044('0x42')]);return db['DeskAccount'][_0x2044('0x43')](_0xd56ecc)[_0x2044('0x23')](handleEntityNotFound(_0x10140d,null))[_0x2044('0x23')](respondWithResult(_0x10140d,null))['catch'](handleError(_0x10140d,null));};exports[_0x2044('0x44')]=function(_0x7656b9,_0x1f8319){return db[_0x2044('0x3b')][_0x2044('0x44')](_0x7656b9[_0x2044('0x45')],{})[_0x2044('0x23')](respondWithResult(_0x1f8319,0xc9))[_0x2044('0x3e')](handleError(_0x1f8319,null));};exports[_0x2044('0x46')]=function(_0x267f7e,_0xaa545){if(_0x267f7e[_0x2044('0x45')]['id']){delete _0x267f7e[_0x2044('0x45')]['id'];}return db[_0x2044('0x3b')][_0x2044('0x43')]({'where':{'id':_0x267f7e[_0x2044('0x40')]['id']}})['then'](handleEntityNotFound(_0xaa545,null))[_0x2044('0x23')](saveUpdates(_0x267f7e[_0x2044('0x45')],null))[_0x2044('0x23')](respondWithResult(_0xaa545,null))[_0x2044('0x3e')](handleError(_0xaa545,null));};exports[_0x2044('0x24')]=function(_0x58ffe7,_0x371a0b){return db[_0x2044('0x3b')][_0x2044('0x43')]({'where':{'id':_0x58ffe7[_0x2044('0x40')]['id']}})['then'](handleEntityNotFound(_0x371a0b,null))['then'](removeEntity(_0x371a0b,null))[_0x2044('0x3e')](handleError(_0x371a0b,null));};exports[_0x2044('0x47')]=function(_0x4ed5de,_0x3d3761,_0x4b739f){var _0x1c59c3={};var _0x586c8f={};var _0x45f569;var _0x35ae73;return db['DeskAccount'][_0x2044('0x48')]({'where':{'id':_0x4ed5de[_0x2044('0x40')]['id']}})[_0x2044('0x23')](handleEntityNotFound(_0x3d3761,null))[_0x2044('0x23')](function(_0x3cd198){if(_0x3cd198){_0x45f569=_0x3cd198;_0x586c8f[_0x2044('0x2c')]=_['keys'](db[_0x2044('0x49')][_0x2044('0x4a')]);_0x586c8f[_0x2044('0x2d')]=_[_0x2044('0x2e')](_0x4ed5de[_0x2044('0x2d')]);_0x586c8f[_0x2044('0x2f')]=_['intersection'](_0x586c8f[_0x2044('0x2c')],_0x586c8f[_0x2044('0x2d')]);_0x1c59c3['attributes']=_[_0x2044('0x30')](_0x586c8f['model'],qs['fields'](_0x4ed5de[_0x2044('0x2d')]['fields']));_0x1c59c3[_0x2044('0x31')]=_0x1c59c3[_0x2044('0x31')][_0x2044('0x41')]?_0x1c59c3['attributes']:_0x586c8f['model'];_0x1c59c3[_0x2044('0x35')]=qs[_0x2044('0x36')](_0x4ed5de[_0x2044('0x2d')][_0x2044('0x36')]);_0x1c59c3['where']=qs[_0x2044('0x2f')](_['pick'](_0x4ed5de['query'],_0x586c8f['filters']));if(_0x4ed5de[_0x2044('0x2d')]['filter']){_0x1c59c3[_0x2044('0x37')]=_[_0x2044('0x39')](_0x1c59c3['where'],{'$or':_['map'](_0x1c59c3[_0x2044('0x31')],function(_0x26cb07){var _0x459415={};_0x459415[_0x26cb07]={'$like':'%'+_0x4ed5de['query'][_0x2044('0x4b')]+'%'};return _0x459415;})});}_0x1c59c3=_[_0x2044('0x39')]({},_0x1c59c3,_0x4ed5de[_0x2044('0x42')]);return _0x45f569[_0x2044('0x47')](_0x1c59c3);}})[_0x2044('0x23')](function(_0x48d18d){if(_0x48d18d){_0x35ae73=_0x48d18d[_0x2044('0x41')];if(!_0x4ed5de[_0x2044('0x2d')][_0x2044('0x33')](_0x2044('0x34'))){_0x1c59c3[_0x2044('0x1d')]=qs[_0x2044('0x1d')](_0x4ed5de[_0x2044('0x2d')][_0x2044('0x1d')]);_0x1c59c3['offset']=qs[_0x2044('0x1c')](_0x4ed5de[_0x2044('0x2d')][_0x2044('0x1c')]);}return _0x45f569[_0x2044('0x47')](_0x1c59c3);}})[_0x2044('0x23')](function(_0x493fc3){if(_0x493fc3){return _0x493fc3?{'count':_0x35ae73,'rows':_0x493fc3}:null;}})[_0x2044('0x23')](respondWithResult(_0x3d3761,null))[_0x2044('0x3e')](handleError(_0x3d3761,null));};exports[_0x2044('0x4c')]=function(_0x210ba3,_0x573e46,_0x4a4c3d){if(_0x210ba3[_0x2044('0x45')]['id']){delete _0x210ba3['body']['id'];}return db[_0x2044('0x3b')]['findOne']({'where':{'id':_0x210ba3['params']['id']}})[_0x2044('0x23')](handleEntityNotFound(_0x573e46,null))['then'](function(_0x3e5192){if(_0x3e5192){_0x210ba3['body'][_0x2044('0x4d')]=_0x3e5192['id'];_0x210ba3['body'][_0x2044('0x4e')]=integrations[_0x2044('0x4f')](_0x210ba3[_0x2044('0x45')]['channel'],_0x210ba3[_0x2044('0x45')][_0x2044('0x2b')]);_0x210ba3['body']['Descriptions']=integrations[_0x2044('0x50')](_0x210ba3[_0x2044('0x45')][_0x2044('0x51')],_0x210ba3[_0x2044('0x45')][_0x2044('0x2b')]);return db[_0x2044('0x49')]['create'](_0x210ba3['body'],{'include':[{'model':db[_0x2044('0x52')],'as':_0x2044('0x4e')},{'model':db[_0x2044('0x52')],'as':_0x2044('0x53')}]});}return null;})[_0x2044('0x23')](respondWithResult(_0x573e46,null))['catch'](handleError(_0x573e46,null));};exports['getFields']=function(_0x1ee7c1,_0x2e510a,_0x445f0f){var _0x3cab6c=[{'name':_0x2044('0x54'),'label':_0x2044('0x54'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x1e21d6='';return db['DeskAccount'][_0x2044('0x48')]({'where':{'id':_0x1ee7c1[_0x2044('0x40')]['id']},'attributes':['id',_0x2044('0x55'),_0x2044('0x56'),_0x2044('0x57'),_0x2044('0x58'),'consumerKey',_0x2044('0x59'),_0x2044('0x5a'),_0x2044('0x5b')]})['then'](handleEntityNotFound(_0x2e510a,null))[_0x2044('0x23')](function(_0x403888){if(_0x403888){_0x1e21d6=_0x403888[_0x2044('0x55')];var _0x4870be=_0x1e21d6[_0x2044('0x5c')](-0x1);if(_0x4870be==='/'){_0x1e21d6=_0x1e21d6[_0x2044('0x5d')](0x0,_0x1e21d6[_0x2044('0x5e')](_0x4870be));}var _0x5095f9={'method':_0x2044('0x5f'),'uri':util[_0x2044('0x60')](_0x2044('0x61'),_0x1e21d6),'headers':{'Content-Type':_0x2044('0x62'),'Accept':_0x2044('0x62')},'json':!![]};if(_0x403888[_0x2044('0x56')]===_0x2044('0x63')){_0x5095f9[_0x2044('0x64')][_0x2044('0x65')]=util[_0x2044('0x60')](_0x2044('0x66'),new Buffer(util[_0x2044('0x60')]('%s:%s',_0x403888[_0x2044('0x57')],_0x403888[_0x2044('0x58')]))[_0x2044('0x67')](_0x2044('0x68')));}return rp(_0x5095f9)['then'](function(_0x582545){return _0x3cab6c[_0x2044('0x69')](_['map'](_0x582545[_0x2044('0x6a')][_0x2044('0x6b')],function(_0x1508bf){return{'id':_0x1508bf[_0x2044('0x26')],'name':_0x1508bf[_0x2044('0x26')],'type':_0x1508bf['type'],'active':_0x1508bf[_0x2044('0x6c')],'label':_0x1508bf['label'],'custom':!![]};}));});}})['then'](function(_0x200f9e){return{'count':_0x200f9e['length'],'rows':_0x200f9e};})['then'](respondWithResult(_0x2e510a,null))[_0x2044('0x3e')](function(_0x234323){var _0x36f9af=_0x1ee7c1['query'][_0x2044('0x6d')]?0x1f4:_0x234323[_0x2044('0x6e')]||0x1f4;logger[_0x2044('0x6f')](_0x2044('0x70'),'getFields',_0x36f9af,JSON[_0x2044('0x71')](_0x234323));delete _0x234323[_0x2044('0x26')];if(_0x36f9af===0x191){_0x36f9af=0x190;}_0x2e510a[_0x2044('0x1a')](_0x36f9af)[_0x2044('0x27')](_0x1ee7c1[_0x2044('0x2d')][_0x2044('0x6d')]?{'message':_0x2044('0x72'),'statusCode':_0x234323[_0x2044('0x6e')]}:_0x234323);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 0c75a72..de88bb5 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 _0xde07=['./intDeskAccount.attributes','exports','DeskAccount','int_desk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x42182d,_0x125b1a){var _0x26459b=function(_0x1b88ab){while(--_0x1b88ab){_0x42182d['push'](_0x42182d['shift']());}};_0x26459b(++_0x125b1a);}(_0xde07,0x1be));var _0x7de0=function(_0x2285f4,_0x19c2f8){_0x2285f4=_0x2285f4-0x0;var _0x3db903=_0xde07[_0x2285f4];return _0x3db903;};'use strict';var _=require(_0x7de0('0x0'));var util=require(_0x7de0('0x1'));var logger=require(_0x7de0('0x2'))(_0x7de0('0x3'));var moment=require(_0x7de0('0x4'));var BPromise=require(_0x7de0('0x5'));var rp=require(_0x7de0('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7de0('0x7'));var config=require(_0x7de0('0x8'));var attributes=require(_0x7de0('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x7de0('0xa')]=function(_0x167bb9,_0x47113f){return _0x167bb9['define'](_0x7de0('0xb'),attributes,{'tableName':_0x7de0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9036=['define','DeskAccount','int_desk_accounts','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration'];(function(_0x12c575,_0xc9542f){var _0x37cb62=function(_0x4d2edf){while(--_0x4d2edf){_0x12c575['push'](_0x12c575['shift']());}};_0x37cb62(++_0xc9542f);}(_0x9036,0xc6));var _0x6903=function(_0x53c82e,_0x5c92e2){_0x53c82e=_0x53c82e-0x0;var _0x525cf7=_0x9036[_0x53c82e];return _0x525cf7;};'use strict';var _=require('lodash');var util=require(_0x6903('0x0'));var logger=require('../../config/logger')(_0x6903('0x1'));var moment=require(_0x6903('0x2'));var BPromise=require(_0x6903('0x3'));var rp=require(_0x6903('0x4'));var fs=require('fs');var path=require(_0x6903('0x5'));var rimraf=require(_0x6903('0x6'));var config=require(_0x6903('0x7'));var attributes=require(_0x6903('0x8'));var integrations=require(_0x6903('0x9'));module['exports']=function(_0x21e67d,_0x43e9ea){return _0x21e67d[_0x6903('0xa')](_0x6903('0xb'),attributes,{'tableName':_0x6903('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 9638f0a..9396dcc 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 _0x28a2=['limit','map','include','model','catch','ShowDeskAccount','DeskAccount','find','raw','where','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetDeskAccount','findAll','options','attributes'];(function(_0x556ffd,_0x288cba){var _0x1cbddc=function(_0x395cc4){while(--_0x395cc4){_0x556ffd['push'](_0x556ffd['shift']());}};_0x1cbddc(++_0x288cba);}(_0x28a2,0x1de));var _0x228a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28a2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x228a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x228a('0x1'));var rs=require(_0x228a('0x2'));var fs=require('fs');var Redis=require(_0x228a('0x3'));var db=require(_0x228a('0x4'))['db'];var utils=require(_0x228a('0x5'));var logger=require(_0x228a('0x6'))(_0x228a('0x7'));var config=require(_0x228a('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x228a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4973e8,_0x247275,_0x42aeb2){return new BPromise(function(_0x6097cb,_0x5e95ce){return client[_0x228a('0xa')](_0x4973e8,_0x42aeb2)[_0x228a('0xb')](function(_0x3d3940){logger[_0x228a('0xc')](_0x228a('0xd'),_0x247275,_0x228a('0xe'));logger[_0x228a('0xf')](_0x228a('0x10'),_0x247275,_0x228a('0xe'),JSON[_0x228a('0x11')](_0x3d3940));if(_0x3d3940[_0x228a('0x12')]){if(_0x3d3940[_0x228a('0x12')][_0x228a('0x13')]===0x1f4){logger[_0x228a('0x12')](_0x228a('0xd'),_0x247275,_0x3d3940['error'][_0x228a('0x14')]);return _0x5e95ce(_0x3d3940[_0x228a('0x12')][_0x228a('0x14')]);}logger['error'](_0x228a('0xd'),_0x247275,_0x3d3940['error']['message']);return _0x6097cb(_0x3d3940[_0x228a('0x12')]['message']);}else{logger[_0x228a('0xc')](_0x228a('0xd'),_0x247275,_0x228a('0xe'));_0x6097cb(_0x3d3940[_0x228a('0x15')]['message']);}})['catch'](function(_0x40230b){logger['error'](_0x228a('0xd'),_0x247275,_0x40230b);_0x5e95ce(_0x40230b);});});}exports[_0x228a('0x16')]=function(_0x203025){var _0x50fa95=this;return new Promise(function(_0x2d2a16,_0x4bcc0d){return db['DeskAccount'][_0x228a('0x17')]({'raw':_0x203025[_0x228a('0x18')]?_0x203025[_0x228a('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x203025[_0x228a('0x18')]?_0x203025['options']['where']||null:null,'attributes':_0x203025['options']?_0x203025[_0x228a('0x18')][_0x228a('0x19')]||null:null,'limit':_0x203025[_0x228a('0x18')]?_0x203025[_0x228a('0x18')][_0x228a('0x1a')]||null:null,'include':_0x203025[_0x228a('0x18')]?_0x203025['options']['include']?_[_0x228a('0x1b')](_0x203025['options'][_0x228a('0x1c')],function(_0x4104de){return{'model':db[_0x4104de[_0x228a('0x1d')]],'as':_0x4104de['as'],'attributes':_0x4104de[_0x228a('0x19')],'include':_0x4104de['include']?_[_0x228a('0x1b')](_0x4104de['include'],function(_0x3481d3){return{'model':db[_0x3481d3[_0x228a('0x1d')]],'as':_0x3481d3['as'],'attributes':_0x3481d3[_0x228a('0x19')],'include':_0x3481d3['include']?_[_0x228a('0x1b')](_0x3481d3['include'],function(_0x12b4eb){return{'model':db[_0x12b4eb['model']],'as':_0x12b4eb['as'],'attributes':_0x12b4eb[_0x228a('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1d4f1f){logger[_0x228a('0xc')]('GetDeskAccount',_0x203025);logger[_0x228a('0xf')](_0x228a('0x16'),_0x203025,JSON[_0x228a('0x11')](_0x1d4f1f));_0x2d2a16(_0x1d4f1f);})[_0x228a('0x1e')](function(_0x2b9aa2){logger['error']('GetDeskAccount',_0x2b9aa2[_0x228a('0x14')],_0x203025);_0x4bcc0d(_0x50fa95[_0x228a('0x12')](0x1f4,_0x2b9aa2[_0x228a('0x14')]));});});};exports[_0x228a('0x1f')]=function(_0x5c3d77){var _0x12c4b9=this;return new Promise(function(_0x2b66c5,_0x63421a){return db[_0x228a('0x20')][_0x228a('0x21')]({'raw':_0x5c3d77['options']?_0x5c3d77['options'][_0x228a('0x22')]===undefined?!![]:![]:!![],'where':_0x5c3d77[_0x228a('0x18')]?_0x5c3d77[_0x228a('0x18')][_0x228a('0x23')]||null:null,'attributes':_0x5c3d77[_0x228a('0x18')]?_0x5c3d77[_0x228a('0x18')][_0x228a('0x19')]||null:null,'include':_0x5c3d77[_0x228a('0x18')]?_0x5c3d77[_0x228a('0x18')][_0x228a('0x1c')]?_['map'](_0x5c3d77['options'][_0x228a('0x1c')],function(_0x2943d1){return{'model':db[_0x2943d1[_0x228a('0x1d')]],'as':_0x2943d1['as'],'attributes':_0x2943d1[_0x228a('0x19')],'include':_0x2943d1['include']?_[_0x228a('0x1b')](_0x2943d1['include'],function(_0x4054e){return{'model':db[_0x4054e[_0x228a('0x1d')]],'as':_0x4054e['as'],'attributes':_0x4054e[_0x228a('0x19')],'include':_0x4054e[_0x228a('0x1c')]?_[_0x228a('0x1b')](_0x4054e[_0x228a('0x1c')],function(_0x51e7e2){return{'model':db[_0x51e7e2[_0x228a('0x1d')]],'as':_0x51e7e2['as'],'attributes':_0x51e7e2[_0x228a('0x19')]};}):[]};}):[]};}):[]:[]})[_0x228a('0xb')](function(_0x13c9b0){logger[_0x228a('0xc')]('ShowDeskAccount',_0x5c3d77);logger['debug'](_0x228a('0x1f'),_0x5c3d77,JSON['stringify'](_0x13c9b0));_0x2b66c5(_0x13c9b0);})['catch'](function(_0x2c5a79){logger[_0x228a('0x12')](_0x228a('0x1f'),_0x2c5a79['message'],_0x5c3d77);_0x63421a(_0x12c4b9[_0x228a('0x12')](0x1f4,_0x2c5a79[_0x228a('0x14')]));});});}; \ No newline at end of file +var _0x1ab6=['raw','where','attributes','limit','include','map','model','GetDeskAccount','stringify','ShowDeskAccount','find','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','message','info','DeskAccount','findAll','options'];(function(_0x5d33bf,_0x16c314){var _0xe31f38=function(_0x16a62e){while(--_0x16a62e){_0x5d33bf['push'](_0x5d33bf['shift']());}};_0xe31f38(++_0x16c314);}(_0x1ab6,0x160));var _0x61ab=function(_0x168774,_0x2f07f8){_0x168774=_0x168774-0x0;var _0x586b8e=_0x1ab6[_0x168774];return _0x586b8e;};'use strict';var _=require(_0x61ab('0x0'));var util=require(_0x61ab('0x1'));var moment=require(_0x61ab('0x2'));var BPromise=require('bluebird');var rs=require(_0x61ab('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x61ab('0x4'))['db'];var utils=require(_0x61ab('0x5'));var logger=require(_0x61ab('0x6'))('rpc');var config=require(_0x61ab('0x7'));var jayson=require(_0x61ab('0x8'));var client=jayson[_0x61ab('0x9')][_0x61ab('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x114836,_0x56ef8e,_0x24c8d2){return new BPromise(function(_0x4663b9,_0xdd5111){return client['request'](_0x114836,_0x24c8d2)[_0x61ab('0xb')](function(_0x265790){logger['info'](_0x61ab('0xc'),_0x56ef8e,_0x61ab('0xd'));logger[_0x61ab('0xe')](_0x61ab('0xf'),_0x56ef8e,_0x61ab('0xd'),JSON['stringify'](_0x265790));if(_0x265790['error']){if(_0x265790[_0x61ab('0x10')]['code']===0x1f4){logger['error'](_0x61ab('0xc'),_0x56ef8e,_0x265790[_0x61ab('0x10')][_0x61ab('0x11')]);return _0xdd5111(_0x265790['error'][_0x61ab('0x11')]);}logger[_0x61ab('0x10')]('DeskAccount,\x20%s,\x20%s',_0x56ef8e,_0x265790[_0x61ab('0x10')]['message']);return _0x4663b9(_0x265790[_0x61ab('0x10')][_0x61ab('0x11')]);}else{logger[_0x61ab('0x12')](_0x61ab('0xc'),_0x56ef8e,_0x61ab('0xd'));_0x4663b9(_0x265790['result'][_0x61ab('0x11')]);}})['catch'](function(_0x474165){logger['error'](_0x61ab('0xc'),_0x56ef8e,_0x474165);_0xdd5111(_0x474165);});});}exports['GetDeskAccount']=function(_0x2cfa89){var _0x33d9f2=this;return new Promise(function(_0x8f2e28,_0x127231){return db[_0x61ab('0x13')][_0x61ab('0x14')]({'raw':_0x2cfa89[_0x61ab('0x15')]?_0x2cfa89[_0x61ab('0x15')][_0x61ab('0x16')]===undefined?!![]:![]:!![],'where':_0x2cfa89['options']?_0x2cfa89[_0x61ab('0x15')][_0x61ab('0x17')]||null:null,'attributes':_0x2cfa89[_0x61ab('0x15')]?_0x2cfa89[_0x61ab('0x15')][_0x61ab('0x18')]||null:null,'limit':_0x2cfa89[_0x61ab('0x15')]?_0x2cfa89[_0x61ab('0x15')][_0x61ab('0x19')]||null:null,'include':_0x2cfa89[_0x61ab('0x15')]?_0x2cfa89['options'][_0x61ab('0x1a')]?_[_0x61ab('0x1b')](_0x2cfa89[_0x61ab('0x15')][_0x61ab('0x1a')],function(_0x3b9e53){return{'model':db[_0x3b9e53[_0x61ab('0x1c')]],'as':_0x3b9e53['as'],'attributes':_0x3b9e53[_0x61ab('0x18')],'include':_0x3b9e53[_0x61ab('0x1a')]?_['map'](_0x3b9e53[_0x61ab('0x1a')],function(_0x88993a){return{'model':db[_0x88993a['model']],'as':_0x88993a['as'],'attributes':_0x88993a[_0x61ab('0x18')],'include':_0x88993a[_0x61ab('0x1a')]?_[_0x61ab('0x1b')](_0x88993a['include'],function(_0x34fae4){return{'model':db[_0x34fae4[_0x61ab('0x1c')]],'as':_0x34fae4['as'],'attributes':_0x34fae4['attributes']};}):[]};}):[]};}):[]:[]})[_0x61ab('0xb')](function(_0x4f6071){logger[_0x61ab('0x12')](_0x61ab('0x1d'),_0x2cfa89);logger[_0x61ab('0xe')]('GetDeskAccount',_0x2cfa89,JSON[_0x61ab('0x1e')](_0x4f6071));_0x8f2e28(_0x4f6071);})['catch'](function(_0x3ce0b2){logger[_0x61ab('0x10')](_0x61ab('0x1d'),_0x3ce0b2['message'],_0x2cfa89);_0x127231(_0x33d9f2[_0x61ab('0x10')](0x1f4,_0x3ce0b2[_0x61ab('0x11')]));});});};exports[_0x61ab('0x1f')]=function(_0x4cf49f){var _0x2cf8da=this;return new Promise(function(_0x28812b,_0x37bac0){return db[_0x61ab('0x13')][_0x61ab('0x20')]({'raw':_0x4cf49f['options']?_0x4cf49f[_0x61ab('0x15')][_0x61ab('0x16')]===undefined?!![]:![]:!![],'where':_0x4cf49f[_0x61ab('0x15')]?_0x4cf49f[_0x61ab('0x15')][_0x61ab('0x17')]||null:null,'attributes':_0x4cf49f[_0x61ab('0x15')]?_0x4cf49f[_0x61ab('0x15')][_0x61ab('0x18')]||null:null,'include':_0x4cf49f[_0x61ab('0x15')]?_0x4cf49f['options'][_0x61ab('0x1a')]?_['map'](_0x4cf49f[_0x61ab('0x15')][_0x61ab('0x1a')],function(_0x4c4c26){return{'model':db[_0x4c4c26[_0x61ab('0x1c')]],'as':_0x4c4c26['as'],'attributes':_0x4c4c26[_0x61ab('0x18')],'include':_0x4c4c26[_0x61ab('0x1a')]?_[_0x61ab('0x1b')](_0x4c4c26[_0x61ab('0x1a')],function(_0x4fc803){return{'model':db[_0x4fc803[_0x61ab('0x1c')]],'as':_0x4fc803['as'],'attributes':_0x4fc803[_0x61ab('0x18')],'include':_0x4fc803[_0x61ab('0x1a')]?_[_0x61ab('0x1b')](_0x4fc803['include'],function(_0x579c07){return{'model':db[_0x579c07[_0x61ab('0x1c')]],'as':_0x579c07['as'],'attributes':_0x579c07['attributes']};}):[]};}):[]};}):[]:[]})[_0x61ab('0xb')](function(_0x5eb22a){logger[_0x61ab('0x12')](_0x61ab('0x1f'),_0x4cf49f);logger[_0x61ab('0xe')]('ShowDeskAccount',_0x4cf49f,JSON[_0x61ab('0x1e')](_0x5eb22a));_0x28812b(_0x5eb22a);})[_0x61ab('0x21')](function(_0x206437){logger[_0x61ab('0x10')]('ShowDeskAccount',_0x206437['message'],_0x4cf49f);_0x37bac0(_0x2cf8da[_0x61ab('0x10')](0x1f4,_0x206437[_0x61ab('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 74a71db..aff464d 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 _0x9957=['/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields'];(function(_0x40e0ac,_0x3d0d29){var _0x3e12d0=function(_0x18f5de){while(--_0x18f5de){_0x40e0ac['push'](_0x40e0ac['shift']());}};_0x3e12d0(++_0x3d0d29);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/fields',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/descriptions',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x14')]('/:id/tags',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x17')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller['destroy']);module[_0x7995('0x1a')]=router; \ No newline at end of file +var _0xedd9=['getTags','post','create','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getSubjects','/:id/descriptions','/:id/tags'];(function(_0x1cbdee,_0x48abc8){var _0x162187=function(_0x4ee0b7){while(--_0x4ee0b7){_0x1cbdee['push'](_0x1cbdee['shift']());}};_0x162187(++_0x48abc8);}(_0xedd9,0xfc));var _0x9edd=function(_0x1faf54,_0x3fde22){_0x1faf54=_0x1faf54-0x0;var _0x17de47=_0xedd9[_0x1faf54];return _0x17de47;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['getFields']);router[_0x9edd('0x9')]('/:id/subjects',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['get'](_0x9edd('0x10'),auth[_0x9edd('0xa')](),controller['getDescriptions']);router[_0x9edd('0x9')](_0x9edd('0x11'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')]('/:id/tags',auth[_0x9edd('0xa')](),controller[_0x9edd('0x15')]);router[_0x9edd('0x16')](_0x9edd('0xc'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x17')]);router[_0x9edd('0x18')](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x19')]);module[_0x9edd('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 3e65c36..02c0118 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 _0xc252=['STRING','sequelize','exports'];(function(_0x45aa72,_0x8af642){var _0x75adaa=function(_0x1f6809){while(--_0x1f6809){_0x45aa72['push'](_0x45aa72['shift']());}};_0x75adaa(++_0x8af642);}(_0xc252,0xa0));var _0x2c25=function(_0x427cf1,_0x32d384){_0x427cf1=_0x427cf1-0x0;var _0x704fe3=_0xc252[_0x427cf1];return _0x704fe3;};'use strict';var Sequelize=require(_0x2c25('0x0'));module[_0x2c25('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2c25('0x2')]}}; \ No newline at end of file +var _0x60d2=['STRING','exports'];(function(_0x21c601,_0x26f456){var _0xd423f=function(_0x52bc27){while(--_0x52bc27){_0x21c601['push'](_0x21c601['shift']());}};_0xd423f(++_0x26f456);}(_0x60d2,0x109));var _0x260d=function(_0x35af23,_0x9190f6){_0x35af23=_0x35af23-0x0;var _0x340506=_0x60d2[_0x35af23];return _0x340506;};'use strict';var Sequelize=require('sequelize');module[_0x260d('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x260d('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 2cb2b62..dd04089 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 _0xf2d0=['sendStatus','status','end','json','offset','undefined','count','set','apply','reject','save','update','then','destroy','stack','name','send','map','DeskConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','filter','VIRTUAL','options','includeAll','include','findAll','catch','params','merge','create','body','getFields','findOne','DeskField','order','pick','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','moment','sox','to-csv','fs-extra','lodash','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x515a2a,_0x50413b){var _0x28afb2=function(_0x3b5480){while(--_0x3b5480){_0x515a2a['push'](_0x515a2a['shift']());}};_0x28afb2(++_0x50413b);}(_0xf2d0,0x124));var _0x0f2d=function(_0x1151d1,_0x48e4ba){_0x1151d1=_0x1151d1-0x0;var _0x1a70a9=_0xf2d0[_0x1151d1];return _0x1a70a9;};'use strict';var emlformat=require(_0x0f2d('0x0'));var rimraf=require(_0x0f2d('0x1'));var zipdir=require(_0x0f2d('0x2'));var jsonpatch=require(_0x0f2d('0x3'));var rp=require('request-promise');var moment=require(_0x0f2d('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x0f2d('0x5'));var csv=require(_0x0f2d('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0f2d('0x7'));var _=require(_0x0f2d('0x8'));var squel=require('squel');var crypto=require(_0x0f2d('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0f2d('0x6'));var querystring=require(_0x0f2d('0xa'));var Papa=require(_0x0f2d('0xb'));var Redis=require('ioredis');var authService=require(_0x0f2d('0xc'));var qs=require(_0x0f2d('0xd'));var as=require(_0x0f2d('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0f2d('0xf'));var utils=require(_0x0f2d('0x10'));var config=require(_0x0f2d('0x11'));var licenseUtil=require(_0x0f2d('0x12'));var db=require(_0x0f2d('0x13'))['db'];function respondWithStatusCode(_0x3e0cac,_0x415609){_0x415609=_0x415609||0xcc;return function(_0x439b40){if(_0x439b40){return _0x3e0cac[_0x0f2d('0x14')](_0x415609);}return _0x3e0cac[_0x0f2d('0x15')](_0x415609)[_0x0f2d('0x16')]();};}function respondWithResult(_0x29bf1f,_0x4ed4eb){_0x4ed4eb=_0x4ed4eb||0xc8;return function(_0x3de660){if(_0x3de660){return _0x29bf1f[_0x0f2d('0x15')](_0x4ed4eb)[_0x0f2d('0x17')](_0x3de660);}};}function respondWithFilteredResult(_0x23ca21,_0x4a9185){return function(_0x1c16d0){if(_0x1c16d0){var _0x5d24f9=typeof _0x4a9185[_0x0f2d('0x18')]===_0x0f2d('0x19')&&typeof _0x4a9185['limit']===_0x0f2d('0x19');var _0x24aab5=_0x1c16d0[_0x0f2d('0x1a')];var _0x37682a=_0x5d24f9?0x0:_0x4a9185[_0x0f2d('0x18')];var _0x1e5444=_0x5d24f9?_0x1c16d0['count']:_0x4a9185[_0x0f2d('0x18')]+_0x4a9185['limit'];var _0x3f5366;if(_0x1e5444>=_0x24aab5){_0x1e5444=_0x24aab5;_0x3f5366=0xc8;}else{_0x3f5366=0xce;}_0x23ca21[_0x0f2d('0x15')](_0x3f5366);return _0x23ca21[_0x0f2d('0x1b')]('Content-Range',_0x37682a+'-'+_0x1e5444+'/'+_0x24aab5)[_0x0f2d('0x17')](_0x1c16d0);}return null;};}function patchUpdates(_0x58b6fb){return function(_0x43d6e8){try{jsonpatch[_0x0f2d('0x1c')](_0x43d6e8,_0x58b6fb,!![]);}catch(_0x3297cf){return BPromise[_0x0f2d('0x1d')](_0x3297cf);}return _0x43d6e8[_0x0f2d('0x1e')]();};}function saveUpdates(_0x19dda2,_0x17a345){return function(_0x326384){if(_0x326384){return _0x326384[_0x0f2d('0x1f')](_0x19dda2)[_0x0f2d('0x20')](function(_0x4dd024){return _0x4dd024;});}return null;};}function removeEntity(_0x294ea4,_0x148fa9){return function(_0x238b81){if(_0x238b81){return _0x238b81[_0x0f2d('0x21')]()[_0x0f2d('0x20')](function(){_0x294ea4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e47e0,_0x407400){return function(_0x90abf7){if(!_0x90abf7){_0x5e47e0['sendStatus'](0x194);}return _0x90abf7;};}function handleError(_0x24a763,_0x8dbeaa){_0x8dbeaa=_0x8dbeaa||0x1f4;return function(_0x3a81d2){logger['error'](_0x3a81d2[_0x0f2d('0x22')]);if(_0x3a81d2[_0x0f2d('0x23')]){delete _0x3a81d2[_0x0f2d('0x23')];}_0x24a763['status'](_0x8dbeaa)[_0x0f2d('0x24')](_0x3a81d2);};}exports['index']=function(_0x4449e1,_0xe7f6ac){var _0x682870={},_0x57f162={},_0x5bfe30={'count':0x0,'rows':[]};var _0x1a6585=_[_0x0f2d('0x25')](db[_0x0f2d('0x26')][_0x0f2d('0x27')],function(_0x2ccd44){return{'name':_0x2ccd44[_0x0f2d('0x28')],'type':_0x2ccd44[_0x0f2d('0x29')][_0x0f2d('0x2a')]};});_0x57f162['model']=_[_0x0f2d('0x25')](_0x1a6585,_0x0f2d('0x23'));_0x57f162[_0x0f2d('0x2b')]=_[_0x0f2d('0x2c')](_0x4449e1['query']);_0x57f162[_0x0f2d('0x2d')]=_[_0x0f2d('0x2e')](_0x57f162[_0x0f2d('0x2f')],_0x57f162[_0x0f2d('0x2b')]);_0x682870['attributes']=_[_0x0f2d('0x2e')](_0x57f162['model'],qs[_0x0f2d('0x30')](_0x4449e1[_0x0f2d('0x2b')]['fields']));_0x682870[_0x0f2d('0x31')]=_0x682870[_0x0f2d('0x31')][_0x0f2d('0x32')]?_0x682870['attributes']:_0x57f162[_0x0f2d('0x2f')];if(!_0x4449e1[_0x0f2d('0x2b')][_0x0f2d('0x33')](_0x0f2d('0x34'))){_0x682870[_0x0f2d('0x35')]=qs[_0x0f2d('0x35')](_0x4449e1[_0x0f2d('0x2b')][_0x0f2d('0x35')]);_0x682870[_0x0f2d('0x18')]=qs[_0x0f2d('0x18')](_0x4449e1[_0x0f2d('0x2b')][_0x0f2d('0x18')]);}_0x682870['order']=qs[_0x0f2d('0x36')](_0x4449e1[_0x0f2d('0x2b')][_0x0f2d('0x36')]);_0x682870[_0x0f2d('0x37')]=qs[_0x0f2d('0x2d')](_['pick'](_0x4449e1[_0x0f2d('0x2b')],_0x57f162[_0x0f2d('0x2d')]),_0x1a6585);if(_0x4449e1[_0x0f2d('0x2b')][_0x0f2d('0x38')]){_0x682870[_0x0f2d('0x37')]=_['merge'](_0x682870[_0x0f2d('0x37')],{'$or':_['map'](_0x1a6585,function(_0x21cdd3){if(_0x21cdd3['type']!==_0x0f2d('0x39')){var _0x34c488={};_0x34c488[_0x21cdd3[_0x0f2d('0x23')]]={'$like':'%'+_0x4449e1[_0x0f2d('0x2b')][_0x0f2d('0x38')]+'%'};return _0x34c488;}})});}_0x682870=_['merge']({},_0x682870,_0x4449e1[_0x0f2d('0x3a')]);var _0x406b2d={'where':_0x682870['where']};return db[_0x0f2d('0x26')][_0x0f2d('0x1a')](_0x406b2d)[_0x0f2d('0x20')](function(_0x366154){_0x5bfe30[_0x0f2d('0x1a')]=_0x366154;if(_0x4449e1[_0x0f2d('0x2b')][_0x0f2d('0x3b')]){_0x682870[_0x0f2d('0x3c')]=[{'all':!![]}];}return db[_0x0f2d('0x26')][_0x0f2d('0x3d')](_0x682870);})[_0x0f2d('0x20')](function(_0x194df1){_0x5bfe30['rows']=_0x194df1;return _0x5bfe30;})[_0x0f2d('0x20')](respondWithFilteredResult(_0xe7f6ac,_0x682870))[_0x0f2d('0x3e')](handleError(_0xe7f6ac,null));};exports['show']=function(_0xdb0969,_0x15fa24){var _0x2064ed={'raw':![],'where':{'id':_0xdb0969[_0x0f2d('0x3f')]['id']}},_0x298222={};_0x298222[_0x0f2d('0x2f')]=_[_0x0f2d('0x2c')](db['DeskConfiguration'][_0x0f2d('0x27')]);_0x298222['query']=_['keys'](_0xdb0969['query']);_0x298222[_0x0f2d('0x2d')]=_['intersection'](_0x298222[_0x0f2d('0x2f')],_0x298222['query']);_0x2064ed[_0x0f2d('0x31')]=_[_0x0f2d('0x2e')](_0x298222['model'],qs['fields'](_0xdb0969[_0x0f2d('0x2b')]['fields']));_0x2064ed['attributes']=_0x2064ed['attributes'][_0x0f2d('0x32')]?_0x2064ed[_0x0f2d('0x31')]:_0x298222[_0x0f2d('0x2f')];if(_0xdb0969[_0x0f2d('0x2b')][_0x0f2d('0x3b')]){_0x2064ed[_0x0f2d('0x3c')]=[{'all':!![]}];}_0x2064ed=_[_0x0f2d('0x40')]({},_0x2064ed,_0xdb0969[_0x0f2d('0x3a')]);return db[_0x0f2d('0x26')]['find'](_0x2064ed)['then'](handleEntityNotFound(_0x15fa24,null))[_0x0f2d('0x20')](respondWithResult(_0x15fa24,null))['catch'](handleError(_0x15fa24,null));};exports[_0x0f2d('0x41')]=function(_0x3367e1,_0x57b61e){return db['DeskConfiguration'][_0x0f2d('0x41')](_0x3367e1[_0x0f2d('0x42')],{})['then'](respondWithResult(_0x57b61e,0xc9))['catch'](handleError(_0x57b61e,null));};exports[_0x0f2d('0x1f')]=function(_0x58e9ca,_0x21f620){if(_0x58e9ca[_0x0f2d('0x42')]['id']){delete _0x58e9ca['body']['id'];}return db[_0x0f2d('0x26')]['find']({'where':{'id':_0x58e9ca[_0x0f2d('0x3f')]['id']}})[_0x0f2d('0x20')](handleEntityNotFound(_0x21f620,null))[_0x0f2d('0x20')](saveUpdates(_0x58e9ca[_0x0f2d('0x42')],null))[_0x0f2d('0x20')](respondWithResult(_0x21f620,null))[_0x0f2d('0x3e')](handleError(_0x21f620,null));};exports['destroy']=function(_0x2f9fdd,_0x16c8f6){return db[_0x0f2d('0x26')]['find']({'where':{'id':_0x2f9fdd['params']['id']}})[_0x0f2d('0x20')](handleEntityNotFound(_0x16c8f6,null))['then'](removeEntity(_0x16c8f6,null))['catch'](handleError(_0x16c8f6,null));};exports[_0x0f2d('0x43')]=function(_0x435ac3,_0x3d1429,_0x40420e){var _0x54a97e={};var _0x559c36={};var _0x3eb06f;var _0x243e7d;return db[_0x0f2d('0x26')][_0x0f2d('0x44')]({'where':{'id':_0x435ac3['params']['id']}})['then'](handleEntityNotFound(_0x3d1429,null))[_0x0f2d('0x20')](function(_0x38ec39){if(_0x38ec39){_0x3eb06f=_0x38ec39;_0x559c36[_0x0f2d('0x2f')]=_[_0x0f2d('0x2c')](db[_0x0f2d('0x45')][_0x0f2d('0x27')]);_0x559c36[_0x0f2d('0x2b')]=_['keys'](_0x435ac3[_0x0f2d('0x2b')]);_0x559c36[_0x0f2d('0x2d')]=_[_0x0f2d('0x2e')](_0x559c36[_0x0f2d('0x2f')],_0x559c36[_0x0f2d('0x2b')]);_0x54a97e[_0x0f2d('0x31')]=_[_0x0f2d('0x2e')](_0x559c36['model'],qs[_0x0f2d('0x30')](_0x435ac3['query'][_0x0f2d('0x30')]));_0x54a97e[_0x0f2d('0x31')]=_0x54a97e[_0x0f2d('0x31')]['length']?_0x54a97e['attributes']:_0x559c36[_0x0f2d('0x2f')];_0x54a97e[_0x0f2d('0x46')]=qs[_0x0f2d('0x36')](_0x435ac3[_0x0f2d('0x2b')]['sort']);_0x54a97e[_0x0f2d('0x37')]=qs[_0x0f2d('0x2d')](_[_0x0f2d('0x47')](_0x435ac3[_0x0f2d('0x2b')],_0x559c36[_0x0f2d('0x2d')]));if(_0x435ac3[_0x0f2d('0x2b')][_0x0f2d('0x38')]){_0x54a97e['where']=_[_0x0f2d('0x40')](_0x54a97e['where'],{'$or':_[_0x0f2d('0x25')](_0x54a97e['attributes'],function(_0x2f427f){var _0x285b05={};_0x285b05[_0x2f427f]={'$like':'%'+_0x435ac3[_0x0f2d('0x2b')]['filter']+'%'};return _0x285b05;})});}_0x54a97e=_[_0x0f2d('0x40')]({},_0x54a97e,_0x435ac3[_0x0f2d('0x3a')]);return _0x3eb06f[_0x0f2d('0x43')](_0x54a97e);}})['then'](function(_0xd62a5c){if(_0xd62a5c){_0x243e7d=_0xd62a5c[_0x0f2d('0x32')];if(!_0x435ac3['query'][_0x0f2d('0x33')](_0x0f2d('0x34'))){_0x54a97e['limit']=qs[_0x0f2d('0x35')](_0x435ac3[_0x0f2d('0x2b')][_0x0f2d('0x35')]);_0x54a97e[_0x0f2d('0x18')]=qs['offset'](_0x435ac3['query'][_0x0f2d('0x18')]);}return _0x3eb06f[_0x0f2d('0x43')](_0x54a97e);}})['then'](function(_0x1d587b){if(_0x1d587b){return _0x1d587b?{'count':_0x243e7d,'rows':_0x1d587b}:null;}})[_0x0f2d('0x20')](respondWithResult(_0x3d1429,null))[_0x0f2d('0x3e')](handleError(_0x3d1429,null));};exports[_0x0f2d('0x48')]=function(_0x2807a5,_0xcc88df,_0x3a2941){var _0x3bcb34={};var _0x5ef79b={};var _0x36f052;var _0xe20b0;return db[_0x0f2d('0x26')][_0x0f2d('0x44')]({'where':{'id':_0x2807a5['params']['id']}})[_0x0f2d('0x20')](handleEntityNotFound(_0xcc88df,null))[_0x0f2d('0x20')](function(_0x3279ef){if(_0x3279ef){_0x36f052=_0x3279ef;_0x5ef79b['model']=_[_0x0f2d('0x2c')](db['DeskField']['rawAttributes']);_0x5ef79b[_0x0f2d('0x2b')]=_[_0x0f2d('0x2c')](_0x2807a5[_0x0f2d('0x2b')]);_0x5ef79b[_0x0f2d('0x2d')]=_[_0x0f2d('0x2e')](_0x5ef79b[_0x0f2d('0x2f')],_0x5ef79b[_0x0f2d('0x2b')]);_0x3bcb34[_0x0f2d('0x31')]=_['intersection'](_0x5ef79b[_0x0f2d('0x2f')],qs['fields'](_0x2807a5['query'][_0x0f2d('0x30')]));_0x3bcb34['attributes']=_0x3bcb34[_0x0f2d('0x31')]['length']?_0x3bcb34[_0x0f2d('0x31')]:_0x5ef79b[_0x0f2d('0x2f')];_0x3bcb34['order']=qs['sort'](_0x2807a5[_0x0f2d('0x2b')][_0x0f2d('0x36')]);_0x3bcb34[_0x0f2d('0x37')]=qs[_0x0f2d('0x2d')](_[_0x0f2d('0x47')](_0x2807a5[_0x0f2d('0x2b')],_0x5ef79b['filters']));if(_0x2807a5['query'][_0x0f2d('0x38')]){_0x3bcb34[_0x0f2d('0x37')]=_[_0x0f2d('0x40')](_0x3bcb34[_0x0f2d('0x37')],{'$or':_[_0x0f2d('0x25')](_0x3bcb34['attributes'],function(_0x32584a){var _0x15dd9e={};_0x15dd9e[_0x32584a]={'$like':'%'+_0x2807a5['query']['filter']+'%'};return _0x15dd9e;})});}_0x3bcb34=_[_0x0f2d('0x40')]({},_0x3bcb34,_0x2807a5[_0x0f2d('0x3a')]);return _0x36f052[_0x0f2d('0x48')](_0x3bcb34);}})['then'](function(_0x26f8b1){if(_0x26f8b1){_0xe20b0=_0x26f8b1[_0x0f2d('0x32')];if(!_0x2807a5['query']['hasOwnProperty'](_0x0f2d('0x34'))){_0x3bcb34[_0x0f2d('0x35')]=qs[_0x0f2d('0x35')](_0x2807a5[_0x0f2d('0x2b')][_0x0f2d('0x35')]);_0x3bcb34['offset']=qs[_0x0f2d('0x18')](_0x2807a5[_0x0f2d('0x2b')][_0x0f2d('0x18')]);}return _0x36f052[_0x0f2d('0x48')](_0x3bcb34);}})[_0x0f2d('0x20')](function(_0x600739){if(_0x600739){return _0x600739?{'count':_0xe20b0,'rows':_0x600739}:null;}})['then'](respondWithResult(_0xcc88df,null))[_0x0f2d('0x3e')](handleError(_0xcc88df,null));};exports[_0x0f2d('0x49')]=function(_0x4e0dcd,_0x2b82ca,_0x21b1a4){var _0x25e331={};var _0x87d1b4={};var _0x183696;var _0x567402;return db[_0x0f2d('0x26')][_0x0f2d('0x44')]({'where':{'id':_0x4e0dcd[_0x0f2d('0x3f')]['id']}})[_0x0f2d('0x20')](handleEntityNotFound(_0x2b82ca,null))[_0x0f2d('0x20')](function(_0x56467f){if(_0x56467f){_0x183696=_0x56467f;_0x87d1b4[_0x0f2d('0x2f')]=_['keys'](db['DeskField'][_0x0f2d('0x27')]);_0x87d1b4[_0x0f2d('0x2b')]=_[_0x0f2d('0x2c')](_0x4e0dcd[_0x0f2d('0x2b')]);_0x87d1b4[_0x0f2d('0x2d')]=_[_0x0f2d('0x2e')](_0x87d1b4[_0x0f2d('0x2f')],_0x87d1b4['query']);_0x25e331[_0x0f2d('0x31')]=_['intersection'](_0x87d1b4[_0x0f2d('0x2f')],qs[_0x0f2d('0x30')](_0x4e0dcd[_0x0f2d('0x2b')][_0x0f2d('0x30')]));_0x25e331[_0x0f2d('0x31')]=_0x25e331[_0x0f2d('0x31')][_0x0f2d('0x32')]?_0x25e331['attributes']:_0x87d1b4[_0x0f2d('0x2f')];_0x25e331[_0x0f2d('0x46')]=qs[_0x0f2d('0x36')](_0x4e0dcd['query'][_0x0f2d('0x36')]);_0x25e331[_0x0f2d('0x37')]=qs[_0x0f2d('0x2d')](_[_0x0f2d('0x47')](_0x4e0dcd[_0x0f2d('0x2b')],_0x87d1b4[_0x0f2d('0x2d')]));if(_0x4e0dcd['query'][_0x0f2d('0x38')]){_0x25e331['where']=_[_0x0f2d('0x40')](_0x25e331[_0x0f2d('0x37')],{'$or':_[_0x0f2d('0x25')](_0x25e331['attributes'],function(_0x23f4d7){var _0x53c3e7={};_0x53c3e7[_0x23f4d7]={'$like':'%'+_0x4e0dcd[_0x0f2d('0x2b')][_0x0f2d('0x38')]+'%'};return _0x53c3e7;})});}_0x25e331=_[_0x0f2d('0x40')]({},_0x25e331,_0x4e0dcd[_0x0f2d('0x3a')]);return _0x183696[_0x0f2d('0x49')](_0x25e331);}})['then'](function(_0xe5b926){if(_0xe5b926){_0x567402=_0xe5b926[_0x0f2d('0x32')];if(!_0x4e0dcd[_0x0f2d('0x2b')][_0x0f2d('0x33')]('nolimit')){_0x25e331['limit']=qs[_0x0f2d('0x35')](_0x4e0dcd[_0x0f2d('0x2b')][_0x0f2d('0x35')]);_0x25e331[_0x0f2d('0x18')]=qs['offset'](_0x4e0dcd['query'][_0x0f2d('0x18')]);}return _0x183696[_0x0f2d('0x49')](_0x25e331);}})['then'](function(_0x346efc){if(_0x346efc){return _0x346efc?{'count':_0x567402,'rows':_0x346efc}:null;}})[_0x0f2d('0x20')](respondWithResult(_0x2b82ca,null))[_0x0f2d('0x3e')](handleError(_0x2b82ca,null));};exports[_0x0f2d('0x4a')]=function(_0x3296d0,_0x1e6ff6,_0xeddf6a){var _0x4c0737={};var _0x4366da={};var _0x24e5d8;var _0x1b5c55;return db[_0x0f2d('0x26')][_0x0f2d('0x44')]({'where':{'id':_0x3296d0['params']['id']}})['then'](handleEntityNotFound(_0x1e6ff6,null))[_0x0f2d('0x20')](function(_0x278c90){if(_0x278c90){_0x24e5d8=_0x278c90;_0x4366da[_0x0f2d('0x2f')]=_[_0x0f2d('0x2c')](db[_0x0f2d('0x4b')][_0x0f2d('0x27')]);_0x4366da[_0x0f2d('0x2b')]=_[_0x0f2d('0x2c')](_0x3296d0[_0x0f2d('0x2b')]);_0x4366da[_0x0f2d('0x2d')]=_['intersection'](_0x4366da[_0x0f2d('0x2f')],_0x4366da['query']);_0x4c0737[_0x0f2d('0x31')]=_[_0x0f2d('0x2e')](_0x4366da[_0x0f2d('0x2f')],qs[_0x0f2d('0x30')](_0x3296d0[_0x0f2d('0x2b')][_0x0f2d('0x30')]));_0x4c0737[_0x0f2d('0x31')]=_0x4c0737[_0x0f2d('0x31')]['length']?_0x4c0737[_0x0f2d('0x31')]:_0x4366da[_0x0f2d('0x2f')];_0x4c0737['order']=qs[_0x0f2d('0x36')](_0x3296d0['query']['sort']);_0x4c0737[_0x0f2d('0x37')]=qs[_0x0f2d('0x2d')](_[_0x0f2d('0x47')](_0x3296d0[_0x0f2d('0x2b')],_0x4366da[_0x0f2d('0x2d')]));if(_0x3296d0[_0x0f2d('0x2b')][_0x0f2d('0x38')]){_0x4c0737[_0x0f2d('0x37')]=_[_0x0f2d('0x40')](_0x4c0737[_0x0f2d('0x37')],{'$or':_['map'](_0x4c0737[_0x0f2d('0x31')],function(_0x4fdad2){var _0x5b29ae={};_0x5b29ae[_0x4fdad2]={'$like':'%'+_0x3296d0[_0x0f2d('0x2b')][_0x0f2d('0x38')]+'%'};return _0x5b29ae;})});}_0x4c0737=_[_0x0f2d('0x40')]({},_0x4c0737,_0x3296d0[_0x0f2d('0x3a')]);return _0x24e5d8[_0x0f2d('0x4a')](_0x4c0737);}})[_0x0f2d('0x20')](function(_0x19443e){if(_0x19443e){_0x1b5c55=_0x19443e[_0x0f2d('0x32')];if(!_0x3296d0[_0x0f2d('0x2b')][_0x0f2d('0x33')](_0x0f2d('0x34'))){_0x4c0737[_0x0f2d('0x35')]=qs[_0x0f2d('0x35')](_0x3296d0[_0x0f2d('0x2b')][_0x0f2d('0x35')]);_0x4c0737[_0x0f2d('0x18')]=qs[_0x0f2d('0x18')](_0x3296d0[_0x0f2d('0x2b')][_0x0f2d('0x18')]);}return _0x24e5d8[_0x0f2d('0x4a')](_0x4c0737);}})['then'](function(_0x5c03b1){if(_0x5c03b1){return _0x5c03b1?{'count':_0x1b5c55,'rows':_0x5c03b1}:null;}})['then'](respondWithResult(_0x1e6ff6,null))[_0x0f2d('0x3e')](handleError(_0x1e6ff6,null));};exports[_0x0f2d('0x4c')]=function(_0x3a8109,_0x3b46e5,_0x14a691){if(_0x3a8109[_0x0f2d('0x42')]['id']){delete _0x3a8109[_0x0f2d('0x42')]['id'];}return db[_0x0f2d('0x26')][_0x0f2d('0x44')]({'where':{'id':_0x3a8109[_0x0f2d('0x3f')]['id']}})[_0x0f2d('0x20')](handleEntityNotFound(_0x3b46e5,null))['then'](function(_0x17632f){if(_0x17632f){return _0x17632f['setTags'](_0x3a8109[_0x0f2d('0x42')][_0x0f2d('0x4d')]||[]);}return null;})[_0x0f2d('0x20')](respondWithResult(_0x3b46e5,null))[_0x0f2d('0x3e')](handleError(_0x3b46e5,null));}; \ No newline at end of file +var _0xd597=['findOne','DeskField','getSubjects','order','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','then','destroy','error','name','index','rawAttributes','fieldName','type','map','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','show','params','DeskConfiguration','length','options','find','catch','create','update','body','getFields'];(function(_0xd04fc8,_0x1ce3f9){var _0x31e64f=function(_0x493e41){while(--_0x493e41){_0xd04fc8['push'](_0xd04fc8['shift']());}};_0x31e64f(++_0x1ce3f9);}(_0xd597,0x104));var _0x7d59=function(_0x505660,_0x158936){_0x505660=_0x505660-0x0;var _0x1238c9=_0xd597[_0x505660];return _0x1238c9;};'use strict';var emlformat=require(_0x7d59('0x0'));var rimraf=require(_0x7d59('0x1'));var zipdir=require(_0x7d59('0x2'));var jsonpatch=require(_0x7d59('0x3'));var rp=require(_0x7d59('0x4'));var moment=require(_0x7d59('0x5'));var BPromise=require(_0x7d59('0x6'));var Mustache=require(_0x7d59('0x7'));var util=require('util');var path=require(_0x7d59('0x8'));var sox=require(_0x7d59('0x9'));var csv=require(_0x7d59('0xa'));var ejs=require(_0x7d59('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7d59('0xc'));var squel=require(_0x7d59('0xd'));var crypto=require(_0x7d59('0xe'));var jsforce=require(_0x7d59('0xf'));var deskjs=require(_0x7d59('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7d59('0x11'));var Redis=require(_0x7d59('0x12'));var authService=require(_0x7d59('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7d59('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7d59('0x15'))(_0x7d59('0x16'));var utils=require(_0x7d59('0x17'));var config=require(_0x7d59('0x18'));var licenseUtil=require(_0x7d59('0x19'));var db=require(_0x7d59('0x1a'))['db'];function respondWithStatusCode(_0x157a09,_0x2ce3e0){_0x2ce3e0=_0x2ce3e0||0xcc;return function(_0x1794a6){if(_0x1794a6){return _0x157a09[_0x7d59('0x1b')](_0x2ce3e0);}return _0x157a09[_0x7d59('0x1c')](_0x2ce3e0)[_0x7d59('0x1d')]();};}function respondWithResult(_0x24a4e4,_0x24ff8a){_0x24ff8a=_0x24ff8a||0xc8;return function(_0x5d79b0){if(_0x5d79b0){return _0x24a4e4[_0x7d59('0x1c')](_0x24ff8a)[_0x7d59('0x1e')](_0x5d79b0);}};}function respondWithFilteredResult(_0x2b2a19,_0x38d476){return function(_0x4ebfe9){if(_0x4ebfe9){var _0x4ded43=typeof _0x38d476[_0x7d59('0x1f')]===_0x7d59('0x20')&&typeof _0x38d476[_0x7d59('0x21')]===_0x7d59('0x20');var _0x5ab199=_0x4ebfe9['count'];var _0x118634=_0x4ded43?0x0:_0x38d476[_0x7d59('0x1f')];var _0xbd35d=_0x4ded43?_0x4ebfe9[_0x7d59('0x22')]:_0x38d476[_0x7d59('0x1f')]+_0x38d476['limit'];var _0x2cdf7a;if(_0xbd35d>=_0x5ab199){_0xbd35d=_0x5ab199;_0x2cdf7a=0xc8;}else{_0x2cdf7a=0xce;}_0x2b2a19[_0x7d59('0x1c')](_0x2cdf7a);return _0x2b2a19['set'](_0x7d59('0x23'),_0x118634+'-'+_0xbd35d+'/'+_0x5ab199)[_0x7d59('0x1e')](_0x4ebfe9);}return null;};}function patchUpdates(_0x17f9d1){return function(_0x1dbae0){try{jsonpatch['apply'](_0x1dbae0,_0x17f9d1,!![]);}catch(_0x4ab790){return BPromise[_0x7d59('0x24')](_0x4ab790);}return _0x1dbae0[_0x7d59('0x25')]();};}function saveUpdates(_0x5554cb,_0x3e7a6b){return function(_0x42fcb0){if(_0x42fcb0){return _0x42fcb0['update'](_0x5554cb)[_0x7d59('0x26')](function(_0x20c7c3){return _0x20c7c3;});}return null;};}function removeEntity(_0x501aea,_0x5b1d0b){return function(_0x2c188b){if(_0x2c188b){return _0x2c188b[_0x7d59('0x27')]()['then'](function(){_0x501aea[_0x7d59('0x1c')](0xcc)[_0x7d59('0x1d')]();});}};}function handleEntityNotFound(_0x2551df,_0x5af38e){return function(_0x15159b){if(!_0x15159b){_0x2551df[_0x7d59('0x1b')](0x194);}return _0x15159b;};}function handleError(_0x1ff543,_0x4e7e05){_0x4e7e05=_0x4e7e05||0x1f4;return function(_0x79f71c){logger[_0x7d59('0x28')](_0x79f71c['stack']);if(_0x79f71c[_0x7d59('0x29')]){delete _0x79f71c[_0x7d59('0x29')];}_0x1ff543[_0x7d59('0x1c')](_0x4e7e05)['send'](_0x79f71c);};}exports[_0x7d59('0x2a')]=function(_0x2f8b32,_0x4ac27a){var _0x6ccc={},_0x1e26f6={},_0x5e15f0={'count':0x0,'rows':[]};var _0x5e7814=_['map'](db['DeskConfiguration'][_0x7d59('0x2b')],function(_0x5c644a){return{'name':_0x5c644a[_0x7d59('0x2c')],'type':_0x5c644a[_0x7d59('0x2d')]['key']};});_0x1e26f6['model']=_[_0x7d59('0x2e')](_0x5e7814,_0x7d59('0x29'));_0x1e26f6[_0x7d59('0x2f')]=_[_0x7d59('0x30')](_0x2f8b32[_0x7d59('0x2f')]);_0x1e26f6[_0x7d59('0x31')]=_['intersection'](_0x1e26f6[_0x7d59('0x32')],_0x1e26f6['query']);_0x6ccc[_0x7d59('0x33')]=_[_0x7d59('0x34')](_0x1e26f6[_0x7d59('0x32')],qs[_0x7d59('0x35')](_0x2f8b32[_0x7d59('0x2f')]['fields']));_0x6ccc[_0x7d59('0x33')]=_0x6ccc['attributes']['length']?_0x6ccc[_0x7d59('0x33')]:_0x1e26f6[_0x7d59('0x32')];if(!_0x2f8b32['query'][_0x7d59('0x36')](_0x7d59('0x37'))){_0x6ccc[_0x7d59('0x21')]=qs[_0x7d59('0x21')](_0x2f8b32['query']['limit']);_0x6ccc['offset']=qs[_0x7d59('0x1f')](_0x2f8b32[_0x7d59('0x2f')]['offset']);}_0x6ccc['order']=qs[_0x7d59('0x38')](_0x2f8b32[_0x7d59('0x2f')][_0x7d59('0x38')]);_0x6ccc[_0x7d59('0x39')]=qs[_0x7d59('0x31')](_[_0x7d59('0x3a')](_0x2f8b32['query'],_0x1e26f6[_0x7d59('0x31')]),_0x5e7814);if(_0x2f8b32[_0x7d59('0x2f')][_0x7d59('0x3b')]){_0x6ccc[_0x7d59('0x39')]=_[_0x7d59('0x3c')](_0x6ccc[_0x7d59('0x39')],{'$or':_['map'](_0x5e7814,function(_0x24011f){if(_0x24011f[_0x7d59('0x2d')]!==_0x7d59('0x3d')){var _0x410091={};_0x410091[_0x24011f[_0x7d59('0x29')]]={'$like':'%'+_0x2f8b32[_0x7d59('0x2f')][_0x7d59('0x3b')]+'%'};return _0x410091;}})});}_0x6ccc=_['merge']({},_0x6ccc,_0x2f8b32['options']);var _0x191527={'where':_0x6ccc[_0x7d59('0x39')]};return db['DeskConfiguration'][_0x7d59('0x22')](_0x191527)['then'](function(_0x466481){_0x5e15f0[_0x7d59('0x22')]=_0x466481;if(_0x2f8b32[_0x7d59('0x2f')][_0x7d59('0x3e')]){_0x6ccc[_0x7d59('0x3f')]=[{'all':!![]}];}return db['DeskConfiguration'][_0x7d59('0x40')](_0x6ccc);})[_0x7d59('0x26')](function(_0x907fd5){_0x5e15f0['rows']=_0x907fd5;return _0x5e15f0;})[_0x7d59('0x26')](respondWithFilteredResult(_0x4ac27a,_0x6ccc))['catch'](handleError(_0x4ac27a,null));};exports[_0x7d59('0x41')]=function(_0x3460cc,_0x3a056b){var _0x22a53f={'raw':![],'where':{'id':_0x3460cc[_0x7d59('0x42')]['id']}},_0x3d4534={};_0x3d4534[_0x7d59('0x32')]=_[_0x7d59('0x30')](db[_0x7d59('0x43')][_0x7d59('0x2b')]);_0x3d4534[_0x7d59('0x2f')]=_[_0x7d59('0x30')](_0x3460cc[_0x7d59('0x2f')]);_0x3d4534[_0x7d59('0x31')]=_[_0x7d59('0x34')](_0x3d4534[_0x7d59('0x32')],_0x3d4534[_0x7d59('0x2f')]);_0x22a53f[_0x7d59('0x33')]=_['intersection'](_0x3d4534['model'],qs[_0x7d59('0x35')](_0x3460cc[_0x7d59('0x2f')][_0x7d59('0x35')]));_0x22a53f[_0x7d59('0x33')]=_0x22a53f['attributes'][_0x7d59('0x44')]?_0x22a53f[_0x7d59('0x33')]:_0x3d4534[_0x7d59('0x32')];if(_0x3460cc[_0x7d59('0x2f')]['includeAll']){_0x22a53f['include']=[{'all':!![]}];}_0x22a53f=_[_0x7d59('0x3c')]({},_0x22a53f,_0x3460cc[_0x7d59('0x45')]);return db['DeskConfiguration'][_0x7d59('0x46')](_0x22a53f)['then'](handleEntityNotFound(_0x3a056b,null))[_0x7d59('0x26')](respondWithResult(_0x3a056b,null))[_0x7d59('0x47')](handleError(_0x3a056b,null));};exports[_0x7d59('0x48')]=function(_0x5090d7,_0x28c080){return db['DeskConfiguration']['create'](_0x5090d7['body'],{})[_0x7d59('0x26')](respondWithResult(_0x28c080,0xc9))[_0x7d59('0x47')](handleError(_0x28c080,null));};exports[_0x7d59('0x49')]=function(_0x5a671b,_0xae91e3){if(_0x5a671b[_0x7d59('0x4a')]['id']){delete _0x5a671b[_0x7d59('0x4a')]['id'];}return db[_0x7d59('0x43')][_0x7d59('0x46')]({'where':{'id':_0x5a671b[_0x7d59('0x42')]['id']}})[_0x7d59('0x26')](handleEntityNotFound(_0xae91e3,null))[_0x7d59('0x26')](saveUpdates(_0x5a671b[_0x7d59('0x4a')],null))[_0x7d59('0x26')](respondWithResult(_0xae91e3,null))[_0x7d59('0x47')](handleError(_0xae91e3,null));};exports[_0x7d59('0x27')]=function(_0x53b087,_0x203266){return db[_0x7d59('0x43')][_0x7d59('0x46')]({'where':{'id':_0x53b087[_0x7d59('0x42')]['id']}})['then'](handleEntityNotFound(_0x203266,null))[_0x7d59('0x26')](removeEntity(_0x203266,null))['catch'](handleError(_0x203266,null));};exports[_0x7d59('0x4b')]=function(_0x1e1b74,_0x3e0de6,_0x55a7e9){var _0x199114={};var _0xa9a0a8={};var _0x4fa2cd;var _0x251d2a;return db[_0x7d59('0x43')][_0x7d59('0x4c')]({'where':{'id':_0x1e1b74[_0x7d59('0x42')]['id']}})['then'](handleEntityNotFound(_0x3e0de6,null))[_0x7d59('0x26')](function(_0x1fa9a0){if(_0x1fa9a0){_0x4fa2cd=_0x1fa9a0;_0xa9a0a8[_0x7d59('0x32')]=_[_0x7d59('0x30')](db[_0x7d59('0x4d')][_0x7d59('0x2b')]);_0xa9a0a8[_0x7d59('0x2f')]=_[_0x7d59('0x30')](_0x1e1b74[_0x7d59('0x2f')]);_0xa9a0a8[_0x7d59('0x31')]=_['intersection'](_0xa9a0a8['model'],_0xa9a0a8[_0x7d59('0x2f')]);_0x199114[_0x7d59('0x33')]=_[_0x7d59('0x34')](_0xa9a0a8[_0x7d59('0x32')],qs['fields'](_0x1e1b74[_0x7d59('0x2f')]['fields']));_0x199114[_0x7d59('0x33')]=_0x199114[_0x7d59('0x33')]['length']?_0x199114[_0x7d59('0x33')]:_0xa9a0a8[_0x7d59('0x32')];_0x199114['order']=qs[_0x7d59('0x38')](_0x1e1b74[_0x7d59('0x2f')][_0x7d59('0x38')]);_0x199114['where']=qs[_0x7d59('0x31')](_[_0x7d59('0x3a')](_0x1e1b74[_0x7d59('0x2f')],_0xa9a0a8[_0x7d59('0x31')]));if(_0x1e1b74['query']['filter']){_0x199114[_0x7d59('0x39')]=_['merge'](_0x199114[_0x7d59('0x39')],{'$or':_[_0x7d59('0x2e')](_0x199114[_0x7d59('0x33')],function(_0x234f85){var _0x6de66e={};_0x6de66e[_0x234f85]={'$like':'%'+_0x1e1b74[_0x7d59('0x2f')][_0x7d59('0x3b')]+'%'};return _0x6de66e;})});}_0x199114=_['merge']({},_0x199114,_0x1e1b74['options']);return _0x4fa2cd[_0x7d59('0x4b')](_0x199114);}})[_0x7d59('0x26')](function(_0x108496){if(_0x108496){_0x251d2a=_0x108496[_0x7d59('0x44')];if(!_0x1e1b74[_0x7d59('0x2f')][_0x7d59('0x36')](_0x7d59('0x37'))){_0x199114[_0x7d59('0x21')]=qs['limit'](_0x1e1b74[_0x7d59('0x2f')][_0x7d59('0x21')]);_0x199114['offset']=qs['offset'](_0x1e1b74[_0x7d59('0x2f')][_0x7d59('0x1f')]);}return _0x4fa2cd[_0x7d59('0x4b')](_0x199114);}})[_0x7d59('0x26')](function(_0x133188){if(_0x133188){return _0x133188?{'count':_0x251d2a,'rows':_0x133188}:null;}})[_0x7d59('0x26')](respondWithResult(_0x3e0de6,null))['catch'](handleError(_0x3e0de6,null));};exports[_0x7d59('0x4e')]=function(_0x253d03,_0x5d66f2,_0x1e9972){var _0x15f43f={};var _0x443e1b={};var _0x1f7c8b;var _0x588353;return db[_0x7d59('0x43')][_0x7d59('0x4c')]({'where':{'id':_0x253d03[_0x7d59('0x42')]['id']}})[_0x7d59('0x26')](handleEntityNotFound(_0x5d66f2,null))['then'](function(_0x5f560e){if(_0x5f560e){_0x1f7c8b=_0x5f560e;_0x443e1b['model']=_['keys'](db['DeskField']['rawAttributes']);_0x443e1b[_0x7d59('0x2f')]=_[_0x7d59('0x30')](_0x253d03[_0x7d59('0x2f')]);_0x443e1b[_0x7d59('0x31')]=_[_0x7d59('0x34')](_0x443e1b[_0x7d59('0x32')],_0x443e1b[_0x7d59('0x2f')]);_0x15f43f[_0x7d59('0x33')]=_['intersection'](_0x443e1b['model'],qs['fields'](_0x253d03['query'][_0x7d59('0x35')]));_0x15f43f[_0x7d59('0x33')]=_0x15f43f[_0x7d59('0x33')][_0x7d59('0x44')]?_0x15f43f[_0x7d59('0x33')]:_0x443e1b['model'];_0x15f43f[_0x7d59('0x4f')]=qs[_0x7d59('0x38')](_0x253d03['query'][_0x7d59('0x38')]);_0x15f43f[_0x7d59('0x39')]=qs[_0x7d59('0x31')](_[_0x7d59('0x3a')](_0x253d03[_0x7d59('0x2f')],_0x443e1b['filters']));if(_0x253d03[_0x7d59('0x2f')][_0x7d59('0x3b')]){_0x15f43f[_0x7d59('0x39')]=_['merge'](_0x15f43f[_0x7d59('0x39')],{'$or':_['map'](_0x15f43f['attributes'],function(_0x1228a8){var _0x1bbf46={};_0x1bbf46[_0x1228a8]={'$like':'%'+_0x253d03['query'][_0x7d59('0x3b')]+'%'};return _0x1bbf46;})});}_0x15f43f=_[_0x7d59('0x3c')]({},_0x15f43f,_0x253d03[_0x7d59('0x45')]);return _0x1f7c8b['getSubjects'](_0x15f43f);}})['then'](function(_0x1e1708){if(_0x1e1708){_0x588353=_0x1e1708[_0x7d59('0x44')];if(!_0x253d03['query'][_0x7d59('0x36')](_0x7d59('0x37'))){_0x15f43f['limit']=qs['limit'](_0x253d03[_0x7d59('0x2f')][_0x7d59('0x21')]);_0x15f43f[_0x7d59('0x1f')]=qs['offset'](_0x253d03[_0x7d59('0x2f')][_0x7d59('0x1f')]);}return _0x1f7c8b['getSubjects'](_0x15f43f);}})[_0x7d59('0x26')](function(_0x1cae6c){if(_0x1cae6c){return _0x1cae6c?{'count':_0x588353,'rows':_0x1cae6c}:null;}})[_0x7d59('0x26')](respondWithResult(_0x5d66f2,null))[_0x7d59('0x47')](handleError(_0x5d66f2,null));};exports[_0x7d59('0x50')]=function(_0x55d9df,_0x4d2869,_0x96c149){var _0x243308={};var _0x1c814a={};var _0x462714;var _0x1a1e56;return db['DeskConfiguration'][_0x7d59('0x4c')]({'where':{'id':_0x55d9df[_0x7d59('0x42')]['id']}})['then'](handleEntityNotFound(_0x4d2869,null))[_0x7d59('0x26')](function(_0x19b03f){if(_0x19b03f){_0x462714=_0x19b03f;_0x1c814a[_0x7d59('0x32')]=_[_0x7d59('0x30')](db[_0x7d59('0x4d')][_0x7d59('0x2b')]);_0x1c814a[_0x7d59('0x2f')]=_[_0x7d59('0x30')](_0x55d9df[_0x7d59('0x2f')]);_0x1c814a[_0x7d59('0x31')]=_['intersection'](_0x1c814a[_0x7d59('0x32')],_0x1c814a[_0x7d59('0x2f')]);_0x243308[_0x7d59('0x33')]=_[_0x7d59('0x34')](_0x1c814a[_0x7d59('0x32')],qs['fields'](_0x55d9df[_0x7d59('0x2f')]['fields']));_0x243308['attributes']=_0x243308['attributes'][_0x7d59('0x44')]?_0x243308[_0x7d59('0x33')]:_0x1c814a[_0x7d59('0x32')];_0x243308[_0x7d59('0x4f')]=qs[_0x7d59('0x38')](_0x55d9df['query'][_0x7d59('0x38')]);_0x243308[_0x7d59('0x39')]=qs[_0x7d59('0x31')](_[_0x7d59('0x3a')](_0x55d9df['query'],_0x1c814a[_0x7d59('0x31')]));if(_0x55d9df[_0x7d59('0x2f')]['filter']){_0x243308['where']=_[_0x7d59('0x3c')](_0x243308[_0x7d59('0x39')],{'$or':_[_0x7d59('0x2e')](_0x243308[_0x7d59('0x33')],function(_0x17f454){var _0x59d161={};_0x59d161[_0x17f454]={'$like':'%'+_0x55d9df[_0x7d59('0x2f')]['filter']+'%'};return _0x59d161;})});}_0x243308=_[_0x7d59('0x3c')]({},_0x243308,_0x55d9df[_0x7d59('0x45')]);return _0x462714['getDescriptions'](_0x243308);}})['then'](function(_0x4a75e4){if(_0x4a75e4){_0x1a1e56=_0x4a75e4[_0x7d59('0x44')];if(!_0x55d9df[_0x7d59('0x2f')][_0x7d59('0x36')](_0x7d59('0x37'))){_0x243308[_0x7d59('0x21')]=qs[_0x7d59('0x21')](_0x55d9df['query'][_0x7d59('0x21')]);_0x243308['offset']=qs['offset'](_0x55d9df[_0x7d59('0x2f')][_0x7d59('0x1f')]);}return _0x462714['getDescriptions'](_0x243308);}})[_0x7d59('0x26')](function(_0x1abda0){if(_0x1abda0){return _0x1abda0?{'count':_0x1a1e56,'rows':_0x1abda0}:null;}})[_0x7d59('0x26')](respondWithResult(_0x4d2869,null))['catch'](handleError(_0x4d2869,null));};exports[_0x7d59('0x51')]=function(_0x4c012a,_0x22dc7c,_0x5af19b){var _0x3987d1={};var _0x1bc371={};var _0x2daca4;var _0x5eab32;return db['DeskConfiguration'][_0x7d59('0x4c')]({'where':{'id':_0x4c012a[_0x7d59('0x42')]['id']}})[_0x7d59('0x26')](handleEntityNotFound(_0x22dc7c,null))['then'](function(_0x378567){if(_0x378567){_0x2daca4=_0x378567;_0x1bc371[_0x7d59('0x32')]=_[_0x7d59('0x30')](db[_0x7d59('0x52')][_0x7d59('0x2b')]);_0x1bc371['query']=_['keys'](_0x4c012a[_0x7d59('0x2f')]);_0x1bc371[_0x7d59('0x31')]=_[_0x7d59('0x34')](_0x1bc371[_0x7d59('0x32')],_0x1bc371['query']);_0x3987d1['attributes']=_[_0x7d59('0x34')](_0x1bc371['model'],qs[_0x7d59('0x35')](_0x4c012a[_0x7d59('0x2f')]['fields']));_0x3987d1['attributes']=_0x3987d1[_0x7d59('0x33')]['length']?_0x3987d1[_0x7d59('0x33')]:_0x1bc371[_0x7d59('0x32')];_0x3987d1[_0x7d59('0x4f')]=qs['sort'](_0x4c012a[_0x7d59('0x2f')][_0x7d59('0x38')]);_0x3987d1[_0x7d59('0x39')]=qs[_0x7d59('0x31')](_['pick'](_0x4c012a[_0x7d59('0x2f')],_0x1bc371[_0x7d59('0x31')]));if(_0x4c012a[_0x7d59('0x2f')]['filter']){_0x3987d1[_0x7d59('0x39')]=_[_0x7d59('0x3c')](_0x3987d1[_0x7d59('0x39')],{'$or':_[_0x7d59('0x2e')](_0x3987d1[_0x7d59('0x33')],function(_0x2fa442){var _0x219423={};_0x219423[_0x2fa442]={'$like':'%'+_0x4c012a[_0x7d59('0x2f')][_0x7d59('0x3b')]+'%'};return _0x219423;})});}_0x3987d1=_[_0x7d59('0x3c')]({},_0x3987d1,_0x4c012a[_0x7d59('0x45')]);return _0x2daca4[_0x7d59('0x51')](_0x3987d1);}})[_0x7d59('0x26')](function(_0x295af1){if(_0x295af1){_0x5eab32=_0x295af1[_0x7d59('0x44')];if(!_0x4c012a[_0x7d59('0x2f')][_0x7d59('0x36')](_0x7d59('0x37'))){_0x3987d1['limit']=qs[_0x7d59('0x21')](_0x4c012a[_0x7d59('0x2f')][_0x7d59('0x21')]);_0x3987d1['offset']=qs['offset'](_0x4c012a['query'][_0x7d59('0x1f')]);}return _0x2daca4[_0x7d59('0x51')](_0x3987d1);}})[_0x7d59('0x26')](function(_0x59aa7d){if(_0x59aa7d){return _0x59aa7d?{'count':_0x5eab32,'rows':_0x59aa7d}:null;}})['then'](respondWithResult(_0x22dc7c,null))[_0x7d59('0x47')](handleError(_0x22dc7c,null));};exports[_0x7d59('0x53')]=function(_0x3846e7,_0x45b5f1,_0x3e6ef1){if(_0x3846e7[_0x7d59('0x4a')]['id']){delete _0x3846e7['body']['id'];}return db['DeskConfiguration']['findOne']({'where':{'id':_0x3846e7[_0x7d59('0x42')]['id']}})[_0x7d59('0x26')](handleEntityNotFound(_0x45b5f1,null))[_0x7d59('0x26')](function(_0x3abc44){if(_0x3abc44){return _0x3abc44[_0x7d59('0x53')](_0x3846e7[_0x7d59('0x4a')]['ids']||[]);}return null;})[_0x7d59('0x26')](respondWithResult(_0x45b5f1,null))['catch'](handleError(_0x45b5f1,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index fcdfd8d..38648f0 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 _0x364e=['util','../../config/logger','api','moment','request-promise','path','../../config/environment','./intDeskConfiguration.attributes','exports','define','lodash'];(function(_0x1ecee6,_0x291f7a){var _0x2e2382=function(_0x533be3){while(--_0x533be3){_0x1ecee6['push'](_0x1ecee6['shift']());}};_0x2e2382(++_0x291f7a);}(_0x364e,0x99));var _0xe364=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x364e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe364('0x0'));var util=require(_0xe364('0x1'));var logger=require(_0xe364('0x2'))(_0xe364('0x3'));var moment=require(_0xe364('0x4'));var BPromise=require('bluebird');var rp=require(_0xe364('0x5'));var fs=require('fs');var path=require(_0xe364('0x6'));var rimraf=require('rimraf');var config=require(_0xe364('0x7'));var attributes=require(_0xe364('0x8'));module[_0xe364('0x9')]=function(_0x2c08fb,_0x1f39e8){return _0x2c08fb[_0xe364('0xa')]('DeskConfiguration',attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x351d=['path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5bd7fe,_0x2c17b4){var _0x227922=function(_0x4edfce){while(--_0x4edfce){_0x5bd7fe['push'](_0x5bd7fe['shift']());}};_0x227922(++_0x2c17b4);}(_0x351d,0x16e));var _0xd351=function(_0x50508b,_0x41e24e){_0x50508b=_0x50508b-0x0;var _0x27559c=_0x351d[_0x50508b];return _0x27559c;};'use strict';var _=require(_0xd351('0x0'));var util=require(_0xd351('0x1'));var logger=require(_0xd351('0x2'))(_0xd351('0x3'));var moment=require(_0xd351('0x4'));var BPromise=require(_0xd351('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd351('0x6'));var rimraf=require(_0xd351('0x7'));var config=require(_0xd351('0x8'));var attributes=require(_0xd351('0x9'));module[_0xd351('0xa')]=function(_0x2f78ca,_0x30f12e){return _0x2f78ca[_0xd351('0xb')]('DeskConfiguration',attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 9818885..3dbb53f 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 _0x4325=['http','request','then','DeskConfiguration,\x20%s,\x20%s','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client'];(function(_0x19e28c,_0x5853bf){var _0x1d6fc7=function(_0x256c7c){while(--_0x256c7c){_0x19e28c['push'](_0x19e28c['shift']());}};_0x1d6fc7(++_0x5853bf);}(_0x4325,0x1da));var _0x5432=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x4325[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x5432('0x0'));var util=require(_0x5432('0x1'));var moment=require('moment');var BPromise=require(_0x5432('0x2'));var rs=require(_0x5432('0x3'));var fs=require('fs');var Redis=require(_0x5432('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5432('0x5'))(_0x5432('0x6'));var config=require(_0x5432('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5432('0x8')][_0x5432('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a6e76,_0x106ec9,_0x50394d){return new BPromise(function(_0xc8252e,_0x1c9762){return client[_0x5432('0xa')](_0x4a6e76,_0x50394d)[_0x5432('0xb')](function(_0x263a0c){logger['info'](_0x5432('0xc'),_0x106ec9,'request\x20sent');logger[_0x5432('0xd')](_0x5432('0xe'),_0x106ec9,_0x5432('0xf'),JSON[_0x5432('0x10')](_0x263a0c));if(_0x263a0c['error']){if(_0x263a0c['error'][_0x5432('0x11')]===0x1f4){logger[_0x5432('0x12')]('DeskConfiguration,\x20%s,\x20%s',_0x106ec9,_0x263a0c[_0x5432('0x12')][_0x5432('0x13')]);return _0x1c9762(_0x263a0c[_0x5432('0x12')][_0x5432('0x13')]);}logger[_0x5432('0x12')](_0x5432('0xc'),_0x106ec9,_0x263a0c['error']['message']);return _0xc8252e(_0x263a0c[_0x5432('0x12')][_0x5432('0x13')]);}else{logger[_0x5432('0x14')](_0x5432('0xc'),_0x106ec9,_0x5432('0xf'));_0xc8252e(_0x263a0c[_0x5432('0x15')]['message']);}})[_0x5432('0x16')](function(_0x49e8fd){logger[_0x5432('0x12')](_0x5432('0xc'),_0x106ec9,_0x49e8fd);_0x1c9762(_0x49e8fd);});});} \ No newline at end of file +var _0xb2af=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xb2af,0xd2));var _0xfb2a=function(_0x43950e,_0x3985b0){_0x43950e=_0x43950e-0x0;var _0x5c5739=_0xb2af[_0x43950e];return _0x5c5739;};'use strict';var _=require(_0xfb2a('0x0'));var util=require(_0xfb2a('0x1'));var moment=require(_0xfb2a('0x2'));var BPromise=require(_0xfb2a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfb2a('0x4'));var db=require(_0xfb2a('0x5'))['db'];var utils=require(_0xfb2a('0x6'));var logger=require(_0xfb2a('0x7'))(_0xfb2a('0x8'));var config=require('../../config/environment');var jayson=require(_0xfb2a('0x9'));var client=jayson[_0xfb2a('0xa')][_0xfb2a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x55cf25,_0x715404,_0x3e20de){return new BPromise(function(_0x1f3315,_0x55bb4e){return client[_0xfb2a('0xc')](_0x55cf25,_0x3e20de)[_0xfb2a('0xd')](function(_0x3d3333){logger[_0xfb2a('0xe')](_0xfb2a('0xf'),_0x715404,_0xfb2a('0x10'));logger[_0xfb2a('0x11')](_0xfb2a('0x12'),_0x715404,_0xfb2a('0x10'),JSON[_0xfb2a('0x13')](_0x3d3333));if(_0x3d3333[_0xfb2a('0x14')]){if(_0x3d3333[_0xfb2a('0x14')]['code']===0x1f4){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x715404,_0x3d3333[_0xfb2a('0x14')][_0xfb2a('0x15')]);return _0x55bb4e(_0x3d3333[_0xfb2a('0x14')][_0xfb2a('0x15')]);}logger['error'](_0xfb2a('0xf'),_0x715404,_0x3d3333['error']['message']);return _0x1f3315(_0x3d3333[_0xfb2a('0x14')]['message']);}else{logger['info'](_0xfb2a('0xf'),_0x715404,_0xfb2a('0x10'));_0x1f3315(_0x3d3333[_0xfb2a('0x16')][_0xfb2a('0x15')]);}})[_0xfb2a('0x17')](function(_0xc85abf){logger[_0xfb2a('0x14')](_0xfb2a('0xf'),_0x715404,_0xc85abf);_0x55bb4e(_0xc85abf);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 4fcdc23..659ab7d 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 _0x6bae=['index','/:id','isAuthenticated','show','put','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x6bae,0x84));var _0xe6ba=function(_0x4ef2e6,_0x2f4a69){_0x4ef2e6=_0x4ef2e6-0x0;var _0x43ae02=_0x6bae[_0x4ef2e6];return _0x43ae02;};'use strict';var multer=require(_0xe6ba('0x0'));var util=require(_0xe6ba('0x1'));var path=require(_0xe6ba('0x2'));var timeout=require(_0xe6ba('0x3'));var express=require(_0xe6ba('0x4'));var router=express[_0xe6ba('0x5')]();var fs_extra=require(_0xe6ba('0x6'));var auth=require(_0xe6ba('0x7'));var interaction=require(_0xe6ba('0x8'));var config=require(_0xe6ba('0x9'));var controller=require(_0xe6ba('0xa'));router[_0xe6ba('0xb')]('/',auth['isAuthenticated'](),controller[_0xe6ba('0xc')]);router[_0xe6ba('0xb')](_0xe6ba('0xd'),auth[_0xe6ba('0xe')](),controller[_0xe6ba('0xf')]);router['post']('/',auth[_0xe6ba('0xe')](),controller['create']);router[_0xe6ba('0x10')](_0xe6ba('0xd'),auth[_0xe6ba('0xe')](),controller['update']);router['delete'](_0xe6ba('0xd'),auth[_0xe6ba('0xe')](),controller['destroy']);module[_0xe6ba('0x11')]=router; \ No newline at end of file +var _0x85a6=['../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','/:id','show','create','put','delete','destroy','path','Router','fs-extra','../../components/auth/service'];(function(_0x30c2ae,_0x4c98a2){var _0x1ee1cc=function(_0x165922){while(--_0x165922){_0x30c2ae['push'](_0x30c2ae['shift']());}};_0x1ee1cc(++_0x4c98a2);}(_0x85a6,0x1cd));var _0x685a=function(_0x532fee,_0x304dd6){_0x532fee=_0x532fee-0x0;var _0x5dee3f=_0x85a6[_0x532fee];return _0x5dee3f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x685a('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x685a('0x1')]();var fs_extra=require(_0x685a('0x2'));var auth=require(_0x685a('0x3'));var interaction=require(_0x685a('0x4'));var config=require(_0x685a('0x5'));var controller=require(_0x685a('0x6'));router[_0x685a('0x7')]('/',auth[_0x685a('0x8')](),controller['index']);router[_0x685a('0x7')](_0x685a('0x9'),auth['isAuthenticated'](),controller[_0x685a('0xa')]);router['post']('/',auth[_0x685a('0x8')](),controller[_0x685a('0xb')]);router[_0x685a('0xc')]('/:id',auth[_0x685a('0x8')](),controller['update']);router[_0x685a('0xd')](_0x685a('0x9'),auth[_0x685a('0x8')](),controller[_0x685a('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 91448b5..935b8e8 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 _0x6754=['variable','customVariable','keyValue','STRING','BOOLEAN','exports','ENUM','string'];(function(_0x17406a,_0x1e2320){var _0x1501ff=function(_0x4b075a){while(--_0x4b075a){_0x17406a['push'](_0x17406a['shift']());}};_0x1501ff(++_0x1e2320);}(_0x6754,0x135));var _0x4675=function(_0x5da73f,_0x592980){_0x5da73f=_0x5da73f-0x0;var _0x1b3d73=_0x6754[_0x5da73f];return _0x1b3d73;};'use strict';var Sequelize=require('sequelize');module[_0x4675('0x0')]={'type':{'type':Sequelize[_0x4675('0x1')](_0x4675('0x2'),_0x4675('0x3'),_0x4675('0x4'),_0x4675('0x5'),'picklist'),'defaultValue':_0x4675('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x4675('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x4675('0x2'),_0x4675('0x3'),_0x4675('0x4'))},'keyContent':{'type':Sequelize[_0x4675('0x6')]},'idField':{'type':Sequelize[_0x4675('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x4675('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4675('0x6')]}}; \ No newline at end of file +var _0x7169=['STRING','ENUM','BOOLEAN','exports','string','variable','customVariable','keyValue','picklist'];(function(_0x4b84ea,_0x466324){var _0xfe0d24=function(_0x5f3355){while(--_0x5f3355){_0x4b84ea['push'](_0x4b84ea['shift']());}};_0xfe0d24(++_0x466324);}(_0x7169,0x198));var _0x9716=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x7169[_0x15bc81];return _0x59440e;};'use strict';var Sequelize=require('sequelize');module[_0x9716('0x0')]={'type':{'type':Sequelize['ENUM'](_0x9716('0x1'),_0x9716('0x2'),_0x9716('0x3'),_0x9716('0x4'),_0x9716('0x5')),'defaultValue':_0x9716('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x9716('0x6')]},'keyType':{'type':Sequelize[_0x9716('0x7')]('string',_0x9716('0x2'),_0x9716('0x3'))},'keyContent':{'type':Sequelize[_0x9716('0x6')]},'idField':{'type':Sequelize[_0x9716('0x6')]},'nameField':{'type':Sequelize[_0x9716('0x6')]},'customField':{'type':Sequelize[_0x9716('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9716('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 296d402..6313b65 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 _0xa786=['destroy','end','stack','name','send','index','DeskField','rawAttributes','type','key','map','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','params','length','find','create','body','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','apply','update','then'];(function(_0x15b721,_0x2da3ab){var _0x275ace=function(_0x403c5d){while(--_0x403c5d){_0x15b721['push'](_0x15b721['shift']());}};_0x275ace(++_0x2da3ab);}(_0xa786,0x71));var _0x6a78=function(_0x4d5078,_0x4d00a3){_0x4d5078=_0x4d5078-0x0;var _0x3fb1a5=_0xa786[_0x4d5078];return _0x3fb1a5;};'use strict';var emlformat=require(_0x6a78('0x0'));var rimraf=require(_0x6a78('0x1'));var zipdir=require(_0x6a78('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6a78('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6a78('0x4'));var util=require(_0x6a78('0x5'));var path=require(_0x6a78('0x6'));var sox=require(_0x6a78('0x7'));var csv=require(_0x6a78('0x8'));var ejs=require(_0x6a78('0x9'));var fs=require('fs');var fs_extra=require(_0x6a78('0xa'));var _=require('lodash');var squel=require(_0x6a78('0xb'));var crypto=require(_0x6a78('0xc'));var jsforce=require(_0x6a78('0xd'));var deskjs=require(_0x6a78('0xe'));var toCsv=require(_0x6a78('0x8'));var querystring=require(_0x6a78('0xf'));var Papa=require(_0x6a78('0x10'));var Redis=require(_0x6a78('0x11'));var authService=require(_0x6a78('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6a78('0x13'));var hardwareService=require(_0x6a78('0x14'));var logger=require(_0x6a78('0x15'))('api');var utils=require(_0x6a78('0x16'));var config=require(_0x6a78('0x17'));var licenseUtil=require(_0x6a78('0x18'));var db=require(_0x6a78('0x19'))['db'];function respondWithStatusCode(_0x1fd1be,_0x5b633c){_0x5b633c=_0x5b633c||0xcc;return function(_0x24a60a){if(_0x24a60a){return _0x1fd1be[_0x6a78('0x1a')](_0x5b633c);}return _0x1fd1be[_0x6a78('0x1b')](_0x5b633c)['end']();};}function respondWithResult(_0x44c863,_0xecf980){_0xecf980=_0xecf980||0xc8;return function(_0x4c5351){if(_0x4c5351){return _0x44c863[_0x6a78('0x1b')](_0xecf980)[_0x6a78('0x1c')](_0x4c5351);}};}function respondWithFilteredResult(_0xe27467,_0x40ef48){return function(_0x3deede){if(_0x3deede){var _0x36e824=typeof _0x40ef48['offset']===_0x6a78('0x1d')&&typeof _0x40ef48[_0x6a78('0x1e')]===_0x6a78('0x1d');var _0x265f90=_0x3deede['count'];var _0x5e3616=_0x36e824?0x0:_0x40ef48[_0x6a78('0x1f')];var _0x585917=_0x36e824?_0x3deede['count']:_0x40ef48['offset']+_0x40ef48[_0x6a78('0x1e')];var _0xed3863;if(_0x585917>=_0x265f90){_0x585917=_0x265f90;_0xed3863=0xc8;}else{_0xed3863=0xce;}_0xe27467[_0x6a78('0x1b')](_0xed3863);return _0xe27467['set']('Content-Range',_0x5e3616+'-'+_0x585917+'/'+_0x265f90)[_0x6a78('0x1c')](_0x3deede);}return null;};}function patchUpdates(_0x29dec5){return function(_0x356b93){try{jsonpatch[_0x6a78('0x20')](_0x356b93,_0x29dec5,!![]);}catch(_0x5dc3fa){return BPromise['reject'](_0x5dc3fa);}return _0x356b93['save']();};}function saveUpdates(_0xd57884,_0x5869fd){return function(_0xd938cd){if(_0xd938cd){return _0xd938cd[_0x6a78('0x21')](_0xd57884)[_0x6a78('0x22')](function(_0x4b47b6){return _0x4b47b6;});}return null;};}function removeEntity(_0x49f711,_0xa5f42f){return function(_0x89fd2b){if(_0x89fd2b){return _0x89fd2b[_0x6a78('0x23')]()[_0x6a78('0x22')](function(){_0x49f711[_0x6a78('0x1b')](0xcc)[_0x6a78('0x24')]();});}};}function handleEntityNotFound(_0xefaa55,_0x4ea33e){return function(_0x28cbbf){if(!_0x28cbbf){_0xefaa55[_0x6a78('0x1a')](0x194);}return _0x28cbbf;};}function handleError(_0x1e91ad,_0x57a859){_0x57a859=_0x57a859||0x1f4;return function(_0x19860c){logger['error'](_0x19860c[_0x6a78('0x25')]);if(_0x19860c[_0x6a78('0x26')]){delete _0x19860c['name'];}_0x1e91ad[_0x6a78('0x1b')](_0x57a859)[_0x6a78('0x27')](_0x19860c);};}exports[_0x6a78('0x28')]=function(_0x149105,_0x5942c0){var _0x8bc302={},_0x125ca2={},_0x273a73={'count':0x0,'rows':[]};var _0x12e0c5=_['map'](db[_0x6a78('0x29')][_0x6a78('0x2a')],function(_0x3299c2){return{'name':_0x3299c2['fieldName'],'type':_0x3299c2[_0x6a78('0x2b')][_0x6a78('0x2c')]};});_0x125ca2['model']=_[_0x6a78('0x2d')](_0x12e0c5,_0x6a78('0x26'));_0x125ca2[_0x6a78('0x2e')]=_[_0x6a78('0x2f')](_0x149105[_0x6a78('0x2e')]);_0x125ca2['filters']=_[_0x6a78('0x30')](_0x125ca2[_0x6a78('0x31')],_0x125ca2['query']);_0x8bc302[_0x6a78('0x32')]=_[_0x6a78('0x30')](_0x125ca2[_0x6a78('0x31')],qs[_0x6a78('0x33')](_0x149105[_0x6a78('0x2e')][_0x6a78('0x33')]));_0x8bc302['attributes']=_0x8bc302[_0x6a78('0x32')]['length']?_0x8bc302[_0x6a78('0x32')]:_0x125ca2[_0x6a78('0x31')];if(!_0x149105[_0x6a78('0x2e')][_0x6a78('0x34')](_0x6a78('0x35'))){_0x8bc302[_0x6a78('0x1e')]=qs[_0x6a78('0x1e')](_0x149105[_0x6a78('0x2e')][_0x6a78('0x1e')]);_0x8bc302['offset']=qs['offset'](_0x149105[_0x6a78('0x2e')]['offset']);}_0x8bc302[_0x6a78('0x36')]=qs[_0x6a78('0x37')](_0x149105[_0x6a78('0x2e')][_0x6a78('0x37')]);_0x8bc302[_0x6a78('0x38')]=qs[_0x6a78('0x39')](_[_0x6a78('0x3a')](_0x149105[_0x6a78('0x2e')],_0x125ca2['filters']),_0x12e0c5);if(_0x149105[_0x6a78('0x2e')][_0x6a78('0x3b')]){_0x8bc302[_0x6a78('0x38')]=_['merge'](_0x8bc302[_0x6a78('0x38')],{'$or':_['map'](_0x12e0c5,function(_0x310ab2){if(_0x310ab2[_0x6a78('0x2b')]!==_0x6a78('0x3c')){var _0xe180fb={};_0xe180fb[_0x310ab2['name']]={'$like':'%'+_0x149105['query']['filter']+'%'};return _0xe180fb;}})});}_0x8bc302=_[_0x6a78('0x3d')]({},_0x8bc302,_0x149105[_0x6a78('0x3e')]);var _0x48eafa={'where':_0x8bc302[_0x6a78('0x38')]};return db[_0x6a78('0x29')][_0x6a78('0x3f')](_0x48eafa)[_0x6a78('0x22')](function(_0x44d5f7){_0x273a73[_0x6a78('0x3f')]=_0x44d5f7;if(_0x149105['query'][_0x6a78('0x40')]){_0x8bc302[_0x6a78('0x41')]=[{'all':!![]}];}return db[_0x6a78('0x29')][_0x6a78('0x42')](_0x8bc302);})[_0x6a78('0x22')](function(_0x23dcce){_0x273a73[_0x6a78('0x43')]=_0x23dcce;return _0x273a73;})['then'](respondWithFilteredResult(_0x5942c0,_0x8bc302))[_0x6a78('0x44')](handleError(_0x5942c0,null));};exports['show']=function(_0xeddf03,_0x4d3aec){var _0x526f09={'raw':!![],'where':{'id':_0xeddf03[_0x6a78('0x45')]['id']}},_0xc8f3e8={};_0xc8f3e8['model']=_[_0x6a78('0x2f')](db[_0x6a78('0x29')][_0x6a78('0x2a')]);_0xc8f3e8[_0x6a78('0x2e')]=_[_0x6a78('0x2f')](_0xeddf03['query']);_0xc8f3e8['filters']=_[_0x6a78('0x30')](_0xc8f3e8[_0x6a78('0x31')],_0xc8f3e8[_0x6a78('0x2e')]);_0x526f09[_0x6a78('0x32')]=_[_0x6a78('0x30')](_0xc8f3e8[_0x6a78('0x31')],qs[_0x6a78('0x33')](_0xeddf03['query'][_0x6a78('0x33')]));_0x526f09[_0x6a78('0x32')]=_0x526f09['attributes'][_0x6a78('0x46')]?_0x526f09[_0x6a78('0x32')]:_0xc8f3e8[_0x6a78('0x31')];if(_0xeddf03[_0x6a78('0x2e')][_0x6a78('0x40')]){_0x526f09[_0x6a78('0x41')]=[{'all':!![]}];}_0x526f09=_['merge']({},_0x526f09,_0xeddf03[_0x6a78('0x3e')]);return db[_0x6a78('0x29')][_0x6a78('0x47')](_0x526f09)[_0x6a78('0x22')](handleEntityNotFound(_0x4d3aec,null))[_0x6a78('0x22')](respondWithResult(_0x4d3aec,null))['catch'](handleError(_0x4d3aec,null));};exports[_0x6a78('0x48')]=function(_0x59a4c1,_0x1bdd6b){return db[_0x6a78('0x29')]['create'](_0x59a4c1[_0x6a78('0x49')],{})['then'](respondWithResult(_0x1bdd6b,0xc9))[_0x6a78('0x44')](handleError(_0x1bdd6b,null));};exports[_0x6a78('0x21')]=function(_0xe40d18,_0x46c94e){if(_0xe40d18[_0x6a78('0x49')]['id']){delete _0xe40d18['body']['id'];}return db['DeskField'][_0x6a78('0x47')]({'where':{'id':_0xe40d18[_0x6a78('0x45')]['id']}})[_0x6a78('0x22')](handleEntityNotFound(_0x46c94e,null))[_0x6a78('0x22')](saveUpdates(_0xe40d18['body'],null))[_0x6a78('0x22')](respondWithResult(_0x46c94e,null))[_0x6a78('0x44')](handleError(_0x46c94e,null));};exports[_0x6a78('0x23')]=function(_0x57c0c4,_0x57bd8a){return db[_0x6a78('0x29')]['find']({'where':{'id':_0x57c0c4['params']['id']}})[_0x6a78('0x22')](handleEntityNotFound(_0x57bd8a,null))[_0x6a78('0x22')](removeEntity(_0x57bd8a,null))[_0x6a78('0x44')](handleError(_0x57bd8a,null));}; \ No newline at end of file +var _0x3dc2=['VIRTUAL','options','DeskField','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','apply','save','update','destroy','then','end','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge'];(function(_0x2637b9,_0x2c1bf4){var _0x3439aa=function(_0x5d6836){while(--_0x5d6836){_0x2637b9['push'](_0x2637b9['shift']());}};_0x3439aa(++_0x2c1bf4);}(_0x3dc2,0xa9));var _0x23dc=function(_0x7154ae,_0x420f19){_0x7154ae=_0x7154ae-0x0;var _0x3dbaee=_0x3dc2[_0x7154ae];return _0x3dbaee;};'use strict';var emlformat=require(_0x23dc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x23dc('0x1'));var jsonpatch=require(_0x23dc('0x2'));var rp=require(_0x23dc('0x3'));var moment=require(_0x23dc('0x4'));var BPromise=require(_0x23dc('0x5'));var Mustache=require(_0x23dc('0x6'));var util=require(_0x23dc('0x7'));var path=require(_0x23dc('0x8'));var sox=require('sox');var csv=require(_0x23dc('0x9'));var ejs=require(_0x23dc('0xa'));var fs=require('fs');var fs_extra=require(_0x23dc('0xb'));var _=require(_0x23dc('0xc'));var squel=require(_0x23dc('0xd'));var crypto=require(_0x23dc('0xe'));var jsforce=require(_0x23dc('0xf'));var deskjs=require(_0x23dc('0x10'));var toCsv=require(_0x23dc('0x9'));var querystring=require(_0x23dc('0x11'));var Papa=require(_0x23dc('0x12'));var Redis=require(_0x23dc('0x13'));var authService=require(_0x23dc('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x23dc('0x15'));var hardwareService=require(_0x23dc('0x16'));var logger=require(_0x23dc('0x17'))(_0x23dc('0x18'));var utils=require(_0x23dc('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x23dc('0x1a'));var db=require(_0x23dc('0x1b'))['db'];function respondWithStatusCode(_0x3ce54a,_0x5f88bb){_0x5f88bb=_0x5f88bb||0xcc;return function(_0xda8489){if(_0xda8489){return _0x3ce54a[_0x23dc('0x1c')](_0x5f88bb);}return _0x3ce54a[_0x23dc('0x1d')](_0x5f88bb)['end']();};}function respondWithResult(_0xce0b8c,_0x7f2f29){_0x7f2f29=_0x7f2f29||0xc8;return function(_0x1ccab5){if(_0x1ccab5){return _0xce0b8c[_0x23dc('0x1d')](_0x7f2f29)[_0x23dc('0x1e')](_0x1ccab5);}};}function respondWithFilteredResult(_0x17a392,_0x27e324){return function(_0x1a6d7c){if(_0x1a6d7c){var _0x2204e2=typeof _0x27e324['offset']==='undefined'&&typeof _0x27e324['limit']===_0x23dc('0x1f');var _0x5ab2ba=_0x1a6d7c[_0x23dc('0x20')];var _0x47c0ed=_0x2204e2?0x0:_0x27e324[_0x23dc('0x21')];var _0x1f6653=_0x2204e2?_0x1a6d7c[_0x23dc('0x20')]:_0x27e324[_0x23dc('0x21')]+_0x27e324[_0x23dc('0x22')];var _0x26d580;if(_0x1f6653>=_0x5ab2ba){_0x1f6653=_0x5ab2ba;_0x26d580=0xc8;}else{_0x26d580=0xce;}_0x17a392['status'](_0x26d580);return _0x17a392['set']('Content-Range',_0x47c0ed+'-'+_0x1f6653+'/'+_0x5ab2ba)[_0x23dc('0x1e')](_0x1a6d7c);}return null;};}function patchUpdates(_0x3f6a12){return function(_0x17b748){try{jsonpatch[_0x23dc('0x23')](_0x17b748,_0x3f6a12,!![]);}catch(_0x440c20){return BPromise['reject'](_0x440c20);}return _0x17b748[_0x23dc('0x24')]();};}function saveUpdates(_0x1b8863,_0x3e89ff){return function(_0x4fd101){if(_0x4fd101){return _0x4fd101[_0x23dc('0x25')](_0x1b8863)['then'](function(_0xaa4b72){return _0xaa4b72;});}return null;};}function removeEntity(_0x55028b,_0x3dd360){return function(_0x55ca4c){if(_0x55ca4c){return _0x55ca4c[_0x23dc('0x26')]()[_0x23dc('0x27')](function(){_0x55028b[_0x23dc('0x1d')](0xcc)[_0x23dc('0x28')]();});}};}function handleEntityNotFound(_0x30412f,_0x28695e){return function(_0x375be6){if(!_0x375be6){_0x30412f['sendStatus'](0x194);}return _0x375be6;};}function handleError(_0x517265,_0x39656f){_0x39656f=_0x39656f||0x1f4;return function(_0xce419b){logger['error'](_0xce419b['stack']);if(_0xce419b[_0x23dc('0x29')]){delete _0xce419b[_0x23dc('0x29')];}_0x517265[_0x23dc('0x1d')](_0x39656f)[_0x23dc('0x2a')](_0xce419b);};}exports[_0x23dc('0x2b')]=function(_0x33b442,_0xd0483d){var _0x2a5a18={},_0x58f190={},_0xb44ced={'count':0x0,'rows':[]};var _0x437d34=_[_0x23dc('0x2c')](db['DeskField'][_0x23dc('0x2d')],function(_0x3e1c63){return{'name':_0x3e1c63[_0x23dc('0x2e')],'type':_0x3e1c63[_0x23dc('0x2f')][_0x23dc('0x30')]};});_0x58f190[_0x23dc('0x31')]=_[_0x23dc('0x2c')](_0x437d34,_0x23dc('0x29'));_0x58f190[_0x23dc('0x32')]=_[_0x23dc('0x33')](_0x33b442['query']);_0x58f190['filters']=_[_0x23dc('0x34')](_0x58f190[_0x23dc('0x31')],_0x58f190['query']);_0x2a5a18[_0x23dc('0x35')]=_[_0x23dc('0x34')](_0x58f190[_0x23dc('0x31')],qs[_0x23dc('0x36')](_0x33b442['query'][_0x23dc('0x36')]));_0x2a5a18['attributes']=_0x2a5a18['attributes'][_0x23dc('0x37')]?_0x2a5a18['attributes']:_0x58f190[_0x23dc('0x31')];if(!_0x33b442[_0x23dc('0x32')][_0x23dc('0x38')](_0x23dc('0x39'))){_0x2a5a18[_0x23dc('0x22')]=qs[_0x23dc('0x22')](_0x33b442[_0x23dc('0x32')]['limit']);_0x2a5a18[_0x23dc('0x21')]=qs[_0x23dc('0x21')](_0x33b442['query'][_0x23dc('0x21')]);}_0x2a5a18[_0x23dc('0x3a')]=qs['sort'](_0x33b442[_0x23dc('0x32')][_0x23dc('0x3b')]);_0x2a5a18[_0x23dc('0x3c')]=qs[_0x23dc('0x3d')](_[_0x23dc('0x3e')](_0x33b442['query'],_0x58f190[_0x23dc('0x3d')]),_0x437d34);if(_0x33b442[_0x23dc('0x32')][_0x23dc('0x3f')]){_0x2a5a18[_0x23dc('0x3c')]=_[_0x23dc('0x40')](_0x2a5a18[_0x23dc('0x3c')],{'$or':_[_0x23dc('0x2c')](_0x437d34,function(_0x28a30d){if(_0x28a30d[_0x23dc('0x2f')]!==_0x23dc('0x41')){var _0xfea4bd={};_0xfea4bd[_0x28a30d[_0x23dc('0x29')]]={'$like':'%'+_0x33b442[_0x23dc('0x32')][_0x23dc('0x3f')]+'%'};return _0xfea4bd;}})});}_0x2a5a18=_[_0x23dc('0x40')]({},_0x2a5a18,_0x33b442[_0x23dc('0x42')]);var _0x24c427={'where':_0x2a5a18[_0x23dc('0x3c')]};return db[_0x23dc('0x43')][_0x23dc('0x20')](_0x24c427)[_0x23dc('0x27')](function(_0x2f3100){_0xb44ced[_0x23dc('0x20')]=_0x2f3100;if(_0x33b442[_0x23dc('0x32')][_0x23dc('0x44')]){_0x2a5a18[_0x23dc('0x45')]=[{'all':!![]}];}return db[_0x23dc('0x43')][_0x23dc('0x46')](_0x2a5a18);})[_0x23dc('0x27')](function(_0x4545bd){_0xb44ced[_0x23dc('0x47')]=_0x4545bd;return _0xb44ced;})[_0x23dc('0x27')](respondWithFilteredResult(_0xd0483d,_0x2a5a18))[_0x23dc('0x48')](handleError(_0xd0483d,null));};exports[_0x23dc('0x49')]=function(_0xe0fed2,_0x1e6dd3){var _0x3a5a9f={'raw':!![],'where':{'id':_0xe0fed2[_0x23dc('0x4a')]['id']}},_0x30af67={};_0x30af67[_0x23dc('0x31')]=_[_0x23dc('0x33')](db[_0x23dc('0x43')][_0x23dc('0x2d')]);_0x30af67['query']=_[_0x23dc('0x33')](_0xe0fed2['query']);_0x30af67[_0x23dc('0x3d')]=_[_0x23dc('0x34')](_0x30af67[_0x23dc('0x31')],_0x30af67[_0x23dc('0x32')]);_0x3a5a9f['attributes']=_[_0x23dc('0x34')](_0x30af67['model'],qs[_0x23dc('0x36')](_0xe0fed2['query'][_0x23dc('0x36')]));_0x3a5a9f[_0x23dc('0x35')]=_0x3a5a9f['attributes'][_0x23dc('0x37')]?_0x3a5a9f[_0x23dc('0x35')]:_0x30af67[_0x23dc('0x31')];if(_0xe0fed2['query'][_0x23dc('0x44')]){_0x3a5a9f['include']=[{'all':!![]}];}_0x3a5a9f=_[_0x23dc('0x40')]({},_0x3a5a9f,_0xe0fed2[_0x23dc('0x42')]);return db[_0x23dc('0x43')][_0x23dc('0x4b')](_0x3a5a9f)[_0x23dc('0x27')](handleEntityNotFound(_0x1e6dd3,null))[_0x23dc('0x27')](respondWithResult(_0x1e6dd3,null))[_0x23dc('0x48')](handleError(_0x1e6dd3,null));};exports[_0x23dc('0x4c')]=function(_0xf13004,_0x437e30){return db[_0x23dc('0x43')][_0x23dc('0x4c')](_0xf13004['body'],{})[_0x23dc('0x27')](respondWithResult(_0x437e30,0xc9))[_0x23dc('0x48')](handleError(_0x437e30,null));};exports[_0x23dc('0x25')]=function(_0x2fa3c7,_0x3bcce5){if(_0x2fa3c7['body']['id']){delete _0x2fa3c7[_0x23dc('0x4d')]['id'];}return db[_0x23dc('0x43')][_0x23dc('0x4b')]({'where':{'id':_0x2fa3c7[_0x23dc('0x4a')]['id']}})[_0x23dc('0x27')](handleEntityNotFound(_0x3bcce5,null))[_0x23dc('0x27')](saveUpdates(_0x2fa3c7['body'],null))[_0x23dc('0x27')](respondWithResult(_0x3bcce5,null))['catch'](handleError(_0x3bcce5,null));};exports[_0x23dc('0x26')]=function(_0x4bda4e,_0x49d618){return db['DeskField'][_0x23dc('0x4b')]({'where':{'id':_0x4bda4e[_0x23dc('0x4a')]['id']}})[_0x23dc('0x27')](handleEntityNotFound(_0x49d618,null))[_0x23dc('0x27')](removeEntity(_0x49d618,null))[_0x23dc('0x48')](handleError(_0x49d618,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 1dd7db8..84f4f75 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 _0x70e3=['bluebird','path','rimraf','../../config/environment','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','lodash','../../config/logger','api','moment'];(function(_0xfcfc24,_0x48ca53){var _0x58f773=function(_0x263b5f){while(--_0x263b5f){_0xfcfc24['push'](_0xfcfc24['shift']());}};_0x58f773(++_0x48ca53);}(_0x70e3,0x6c));var _0x370e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x70e3[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x370e('0x0'));var util=require('util');var logger=require(_0x370e('0x1'))(_0x370e('0x2'));var moment=require(_0x370e('0x3'));var BPromise=require(_0x370e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x370e('0x5'));var rimraf=require(_0x370e('0x6'));var config=require(_0x370e('0x7'));var attributes=require(_0x370e('0x8'));module[_0x370e('0x9')]=function(_0x4cbd9a,_0x1099d7){return _0x4cbd9a[_0x370e('0xa')](_0x370e('0xb'),attributes,{'tableName':_0x370e('0xc'),'paranoid':![],'indexes':[{'name':_0x370e('0xd'),'fields':[_0x370e('0xe'),_0x370e('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3c5d=['rimraf','./intDeskField.attributes','exports','define','DeskField','idField','FieldId','lodash','../../config/logger','api','bluebird','request-promise','path'];(function(_0x43fdf8,_0x8426b3){var _0x1160c6=function(_0x281fb6){while(--_0x281fb6){_0x43fdf8['push'](_0x43fdf8['shift']());}};_0x1160c6(++_0x8426b3);}(_0x3c5d,0x180));var _0xd3c5=function(_0x1eb7f3,_0x540872){_0x1eb7f3=_0x1eb7f3-0x0;var _0x570dcd=_0x3c5d[_0x1eb7f3];return _0x570dcd;};'use strict';var _=require(_0xd3c5('0x0'));var util=require('util');var logger=require(_0xd3c5('0x1'))(_0xd3c5('0x2'));var moment=require('moment');var BPromise=require(_0xd3c5('0x3'));var rp=require(_0xd3c5('0x4'));var fs=require('fs');var path=require(_0xd3c5('0x5'));var rimraf=require(_0xd3c5('0x6'));var config=require('../../config/environment');var attributes=require(_0xd3c5('0x7'));module[_0xd3c5('0x8')]=function(_0x3ed257,_0x2e16b6){return _0x3ed257[_0xd3c5('0x9')](_0xd3c5('0xa'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0xd3c5('0xb'),_0xd3c5('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 1f051ae..8e77e46 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 _0xa17f=['../../config/environment','jayson/promise','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa17f,0x15e));var _0xfa17=function(_0x25fc41,_0x250864){_0x25fc41=_0x25fc41-0x0;var _0x1371d1=_0xa17f[_0x25fc41];return _0x1371d1;};'use strict';var _=require('lodash');var util=require(_0xfa17('0x0'));var moment=require(_0xfa17('0x1'));var BPromise=require(_0xfa17('0x2'));var rs=require(_0xfa17('0x3'));var fs=require('fs');var Redis=require(_0xfa17('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfa17('0x5'))(_0xfa17('0x6'));var config=require(_0xfa17('0x7'));var jayson=require(_0xfa17('0x8'));var client=jayson['client'][_0xfa17('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6908e6,_0x5dac2d,_0x42f9d3){return new BPromise(function(_0x8037f9,_0x176f53){return client[_0xfa17('0xa')](_0x6908e6,_0x42f9d3)[_0xfa17('0xb')](function(_0x3e47f5){logger[_0xfa17('0xc')](_0xfa17('0xd'),_0x5dac2d,_0xfa17('0xe'));logger['debug']('DeskField,\x20%s,\x20%s,\x20%s',_0x5dac2d,'request\x20sent',JSON[_0xfa17('0xf')](_0x3e47f5));if(_0x3e47f5['error']){if(_0x3e47f5[_0xfa17('0x10')][_0xfa17('0x11')]===0x1f4){logger[_0xfa17('0x10')]('DeskField,\x20%s,\x20%s',_0x5dac2d,_0x3e47f5[_0xfa17('0x10')][_0xfa17('0x12')]);return _0x176f53(_0x3e47f5[_0xfa17('0x10')][_0xfa17('0x12')]);}logger['error'](_0xfa17('0xd'),_0x5dac2d,_0x3e47f5[_0xfa17('0x10')]['message']);return _0x8037f9(_0x3e47f5[_0xfa17('0x10')][_0xfa17('0x12')]);}else{logger[_0xfa17('0xc')](_0xfa17('0xd'),_0x5dac2d,_0xfa17('0xe'));_0x8037f9(_0x3e47f5[_0xfa17('0x13')]['message']);}})[_0xfa17('0x14')](function(_0x4b8cc5){logger[_0xfa17('0x10')](_0xfa17('0xd'),_0x5dac2d,_0x4b8cc5);_0x176f53(_0x4b8cc5);});});} \ No newline at end of file +var _0x8319=['debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','DeskField,\x20%s,\x20%s','result','catch','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','then','info','request\x20sent'];(function(_0xa9238a,_0x506f9b){var _0x121017=function(_0x28e710){while(--_0x28e710){_0xa9238a['push'](_0xa9238a['shift']());}};_0x121017(++_0x506f9b);}(_0x8319,0x75));var _0x9831=function(_0x1fadc0,_0x18d807){_0x1fadc0=_0x1fadc0-0x0;var _0x354f6a=_0x8319[_0x1fadc0];return _0x354f6a;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9831('0x0'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9831('0x1'))['db'];var utils=require(_0x9831('0x2'));var logger=require(_0x9831('0x3'))(_0x9831('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9831('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53ba1b,_0x23c0cd,_0x33e8d4){return new BPromise(function(_0x2208e4,_0x22919d){return client['request'](_0x53ba1b,_0x33e8d4)[_0x9831('0x6')](function(_0xd10c47){logger[_0x9831('0x7')]('DeskField,\x20%s,\x20%s',_0x23c0cd,_0x9831('0x8'));logger[_0x9831('0x9')](_0x9831('0xa'),_0x23c0cd,'request\x20sent',JSON[_0x9831('0xb')](_0xd10c47));if(_0xd10c47[_0x9831('0xc')]){if(_0xd10c47[_0x9831('0xc')][_0x9831('0xd')]===0x1f4){logger[_0x9831('0xc')]('DeskField,\x20%s,\x20%s',_0x23c0cd,_0xd10c47[_0x9831('0xc')]['message']);return _0x22919d(_0xd10c47[_0x9831('0xc')][_0x9831('0xe')]);}logger[_0x9831('0xc')](_0x9831('0xf'),_0x23c0cd,_0xd10c47[_0x9831('0xc')]['message']);return _0x2208e4(_0xd10c47[_0x9831('0xc')][_0x9831('0xe')]);}else{logger[_0x9831('0x7')](_0x9831('0xf'),_0x23c0cd,_0x9831('0x8'));_0x2208e4(_0xd10c47[_0x9831('0x10')][_0x9831('0xe')]);}})[_0x9831('0x11')](function(_0x587a70){logger['error'](_0x9831('0xf'),_0x23c0cd,_0x587a70);_0x22919d(_0x587a70);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 69b2cba..cb86162 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 _0x410c=['isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','post','create','put','update','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x3ff01e,_0x37205f){var _0x20b9cd=function(_0x7ec5d1){while(--_0x7ec5d1){_0x3ff01e['push'](_0x3ff01e['shift']());}};_0x20b9cd(++_0x37205f);}(_0x410c,0x1ee));var _0xc410=function(_0x388e41,_0x10cf99){_0x388e41=_0x388e41-0x0;var _0x2549cf=_0x410c[_0x388e41];return _0x2549cf;};'use strict';var multer=require('multer');var util=require(_0xc410('0x0'));var path=require(_0xc410('0x1'));var timeout=require(_0xc410('0x2'));var express=require(_0xc410('0x3'));var router=express[_0xc410('0x4')]();var fs_extra=require(_0xc410('0x5'));var auth=require(_0xc410('0x6'));var interaction=require(_0xc410('0x7'));var config=require(_0xc410('0x8'));var controller=require('./intDynamics365Account.controller');router[_0xc410('0x9')]('/',auth[_0xc410('0xa')](),controller[_0xc410('0xb')]);router[_0xc410('0x9')](_0xc410('0xc'),auth[_0xc410('0xa')](),controller[_0xc410('0xd')]);router[_0xc410('0x9')](_0xc410('0xe'),auth['isAuthenticated'](),controller[_0xc410('0xf')]);router[_0xc410('0x9')]('/:id/fields',auth[_0xc410('0xa')](),controller['getFields']);router[_0xc410('0x10')]('/',auth[_0xc410('0xa')](),controller[_0xc410('0x11')]);router[_0xc410('0x10')]('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router[_0xc410('0x12')]('/:id',auth[_0xc410('0xa')](),controller[_0xc410('0x13')]);router['delete'](_0xc410('0xc'),auth['isAuthenticated'](),controller[_0xc410('0x14')]);module['exports']=router; \ No newline at end of file +var _0x89cb=['getConfigurations','getFields','post','create','addConfiguration','put','delete','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id/configurations'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0x89cb,0x13a));var _0xb89c=function(_0x5f1709,_0x3316a2){_0x5f1709=_0x5f1709-0x0;var _0x3e297a=_0x89cb[_0x5f1709];return _0x3e297a;};'use strict';var multer=require('multer');var util=require(_0xb89c('0x0'));var path=require(_0xb89c('0x1'));var timeout=require('connect-timeout');var express=require(_0xb89c('0x2'));var router=express[_0xb89c('0x3')]();var fs_extra=require(_0xb89c('0x4'));var auth=require(_0xb89c('0x5'));var interaction=require(_0xb89c('0x6'));var config=require('../../config/environment');var controller=require('./intDynamics365Account.controller');router[_0xb89c('0x7')]('/',auth[_0xb89c('0x8')](),controller['index']);router[_0xb89c('0x7')]('/:id',auth[_0xb89c('0x8')](),controller['show']);router['get'](_0xb89c('0x9'),auth['isAuthenticated'](),controller[_0xb89c('0xa')]);router[_0xb89c('0x7')]('/:id/fields',auth[_0xb89c('0x8')](),controller[_0xb89c('0xb')]);router[_0xb89c('0xc')]('/',auth[_0xb89c('0x8')](),controller[_0xb89c('0xd')]);router['post'](_0xb89c('0x9'),auth[_0xb89c('0x8')](),controller[_0xb89c('0xe')]);router[_0xb89c('0xf')]('/:id',auth[_0xb89c('0x8')](),controller['update']);router[_0xb89c('0x10')]('/:id',auth[_0xb89c('0x8')](),controller['destroy']);module[_0xb89c('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 1e7204e..a0886c4 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 _0x34a7=['sequelize','exports','STRING'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x34a7,0x7b));var _0x734a=function(_0x1b8778,_0x39aa93){_0x1b8778=_0x1b8778-0x0;var _0x37bd28=_0x34a7[_0x1b8778];return _0x37bd28;};'use strict';var Sequelize=require(_0x734a('0x0'));module[_0x734a('0x1')]={'name':{'type':Sequelize[_0x734a('0x2')]},'username':{'type':Sequelize[_0x734a('0x2')]},'password':{'type':Sequelize[_0x734a('0x2')]},'remoteUri':{'type':Sequelize[_0x734a('0x2')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x734a('0x2')]},'clientSecret':{'type':Sequelize[_0x734a('0x2')]},'serverUrl':{'type':Sequelize[_0x734a('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x734a('0x2')]}}; \ No newline at end of file +var _0x6960=['sequelize','exports','STRING'];(function(_0x3186cd,_0x5f12b3){var _0x168c19=function(_0x234023){while(--_0x234023){_0x3186cd['push'](_0x3186cd['shift']());}};_0x168c19(++_0x5f12b3);}(_0x6960,0xae));var _0x0696=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x6960[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0x0696('0x0'));module[_0x0696('0x1')]={'name':{'type':Sequelize[_0x0696('0x2')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x0696('0x2')]},'remoteUri':{'type':Sequelize[_0x0696('0x2')]},'tenantId':{'type':Sequelize[_0x0696('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x0696('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 8aec390..f27d8db 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 _0x4fdb=['intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','options','includeAll','Dynamics365Account','findAll','rows','catch','show','keys','find','create','body','params','getConfigurations','findOne','Dynamics365Configuration','filter','getSubjects','channel','getDescriptions','Subjects','Dynamics365Field','Descriptions','getFields','ticketType','incident','Incident','PhoneCall','title','customerid','caseorigincode','directioncode','accountidname','billedserviceunits','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdon','createdonbehalfbyname','customeridname','customeridtype','customeridyominame','emailaddress','entityimage_timestamp','entityimage_url','escalatedon','firstresponsebykpiidname','followupby','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','msdyn_incidenttypename','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidname','sentimentvalue','slaname','statecode','subjectidname','ticketnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','remoteUri','tenantId','clientId','clientSecret','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','password','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','Attributes','remove','includes','LogicalName','@odata.type','lastIndexOf','push','all','forEach','isNil','substring','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','test','stack','Wrong\x20credentials','statusCode',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','error','name','send','map','rawAttributes','fieldName','key','model','filters'];(function(_0x295a41,_0x377031){var _0x1ef7c5=function(_0x3679b6){while(--_0x3679b6){_0x295a41['push'](_0x295a41['shift']());}};_0x1ef7c5(++_0x377031);}(_0x4fdb,0x9c));var _0xb4fd=function(_0x47fa6c,_0x58297b){_0x47fa6c=_0x47fa6c-0x0;var _0x1cb803=_0x4fdb[_0x47fa6c];return _0x1cb803;};'use strict';var emlformat=require(_0xb4fd('0x0'));var rimraf=require(_0xb4fd('0x1'));var zipdir=require(_0xb4fd('0x2'));var jsonpatch=require(_0xb4fd('0x3'));var rp=require(_0xb4fd('0x4'));var moment=require(_0xb4fd('0x5'));var BPromise=require(_0xb4fd('0x6'));var Mustache=require(_0xb4fd('0x7'));var util=require(_0xb4fd('0x8'));var path=require('path');var sox=require(_0xb4fd('0x9'));var csv=require('to-csv');var ejs=require(_0xb4fd('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb4fd('0xb'));var crypto=require(_0xb4fd('0xc'));var jsforce=require(_0xb4fd('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb4fd('0xe'));var Papa=require(_0xb4fd('0xf'));var Redis=require(_0xb4fd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xb4fd('0x11'));var as=require(_0xb4fd('0x12'));var hardwareService=require(_0xb4fd('0x13'));var logger=require(_0xb4fd('0x14'))(_0xb4fd('0x15'));var utils=require('../../config/utils');var config=require(_0xb4fd('0x16'));var licenseUtil=require(_0xb4fd('0x17'));var db=require(_0xb4fd('0x18'))['db'];var integrations=require(_0xb4fd('0x19'));function respondWithStatusCode(_0x5ba7e1,_0x38173d){_0x38173d=_0x38173d||0xcc;return function(_0x65f08a){if(_0x65f08a){return _0x5ba7e1[_0xb4fd('0x1a')](_0x38173d);}return _0x5ba7e1['status'](_0x38173d)[_0xb4fd('0x1b')]();};}function respondWithResult(_0x1234d7,_0xc35d8d){_0xc35d8d=_0xc35d8d||0xc8;return function(_0x41e21a){if(_0x41e21a){return _0x1234d7[_0xb4fd('0x1c')](_0xc35d8d)[_0xb4fd('0x1d')](_0x41e21a);}};}function respondWithFilteredResult(_0x3a0872,_0x47e288){return function(_0x2076d5){if(_0x2076d5){var _0x12401d=typeof _0x47e288[_0xb4fd('0x1e')]===_0xb4fd('0x1f')&&typeof _0x47e288[_0xb4fd('0x20')]===_0xb4fd('0x1f');var _0x1d0812=_0x2076d5[_0xb4fd('0x21')];var _0x28ecef=_0x12401d?0x0:_0x47e288[_0xb4fd('0x1e')];var _0x19f7b0=_0x12401d?_0x2076d5['count']:_0x47e288['offset']+_0x47e288['limit'];var _0x5c14c0;if(_0x19f7b0>=_0x1d0812){_0x19f7b0=_0x1d0812;_0x5c14c0=0xc8;}else{_0x5c14c0=0xce;}_0x3a0872[_0xb4fd('0x1c')](_0x5c14c0);return _0x3a0872[_0xb4fd('0x22')](_0xb4fd('0x23'),_0x28ecef+'-'+_0x19f7b0+'/'+_0x1d0812)[_0xb4fd('0x1d')](_0x2076d5);}return null;};}function patchUpdates(_0x458133){return function(_0x2adfbd){try{jsonpatch[_0xb4fd('0x24')](_0x2adfbd,_0x458133,!![]);}catch(_0x4ffaf1){return BPromise['reject'](_0x4ffaf1);}return _0x2adfbd[_0xb4fd('0x25')]();};}function saveUpdates(_0x25bb7d,_0x157fc2){return function(_0x4a1d88){if(_0x4a1d88){return _0x4a1d88[_0xb4fd('0x26')](_0x25bb7d)['then'](function(_0x46cba4){return _0x46cba4;});}return null;};}function removeEntity(_0x4f5032,_0x2a9c8c){return function(_0x2c2d8d){if(_0x2c2d8d){return _0x2c2d8d[_0xb4fd('0x27')]()[_0xb4fd('0x28')](function(){_0x4f5032[_0xb4fd('0x1c')](0xcc)[_0xb4fd('0x1b')]();});}};}function handleEntityNotFound(_0x4f5971,_0x3498ad){return function(_0x526fb2){if(!_0x526fb2){_0x4f5971['sendStatus'](0x194);}return _0x526fb2;};}function handleError(_0x4baf02,_0x453982){_0x453982=_0x453982||0x1f4;return function(_0x4bad85){logger[_0xb4fd('0x29')](_0x4bad85['stack']);if(_0x4bad85['name']){delete _0x4bad85[_0xb4fd('0x2a')];}_0x4baf02[_0xb4fd('0x1c')](_0x453982)[_0xb4fd('0x2b')](_0x4bad85);};}exports['index']=function(_0x11ed43,_0x477a53){var _0x68776={},_0x1a653b={},_0x5d5606={'count':0x0,'rows':[]};var _0xd72bc3=_[_0xb4fd('0x2c')](db['Dynamics365Account'][_0xb4fd('0x2d')],function(_0x421c89){return{'name':_0x421c89[_0xb4fd('0x2e')],'type':_0x421c89['type'][_0xb4fd('0x2f')]};});_0x1a653b[_0xb4fd('0x30')]=_[_0xb4fd('0x2c')](_0xd72bc3,'name');_0x1a653b['query']=_['keys'](_0x11ed43['query']);_0x1a653b[_0xb4fd('0x31')]=_[_0xb4fd('0x32')](_0x1a653b[_0xb4fd('0x30')],_0x1a653b[_0xb4fd('0x33')]);_0x68776[_0xb4fd('0x34')]=_[_0xb4fd('0x32')](_0x1a653b[_0xb4fd('0x30')],qs[_0xb4fd('0x35')](_0x11ed43[_0xb4fd('0x33')][_0xb4fd('0x35')]));_0x68776[_0xb4fd('0x34')]=_0x68776[_0xb4fd('0x34')][_0xb4fd('0x36')]?_0x68776[_0xb4fd('0x34')]:_0x1a653b[_0xb4fd('0x30')];if(!_0x11ed43[_0xb4fd('0x33')][_0xb4fd('0x37')](_0xb4fd('0x38'))){_0x68776['limit']=qs['limit'](_0x11ed43[_0xb4fd('0x33')][_0xb4fd('0x20')]);_0x68776[_0xb4fd('0x1e')]=qs[_0xb4fd('0x1e')](_0x11ed43[_0xb4fd('0x33')]['offset']);}_0x68776[_0xb4fd('0x39')]=qs[_0xb4fd('0x3a')](_0x11ed43[_0xb4fd('0x33')][_0xb4fd('0x3a')]);_0x68776[_0xb4fd('0x3b')]=qs['filters'](_[_0xb4fd('0x3c')](_0x11ed43['query'],_0x1a653b[_0xb4fd('0x31')]),_0xd72bc3);if(_0x11ed43[_0xb4fd('0x33')]['filter']){_0x68776['where']=_[_0xb4fd('0x3d')](_0x68776[_0xb4fd('0x3b')],{'$or':_[_0xb4fd('0x2c')](_0xd72bc3,function(_0x357cf5){if(_0x357cf5[_0xb4fd('0x3e')]!==_0xb4fd('0x3f')){var _0x478cf3={};_0x478cf3[_0x357cf5[_0xb4fd('0x2a')]]={'$like':'%'+_0x11ed43[_0xb4fd('0x33')]['filter']+'%'};return _0x478cf3;}})});}_0x68776=_[_0xb4fd('0x3d')]({},_0x68776,_0x11ed43[_0xb4fd('0x40')]);var _0x17e024={'where':_0x68776[_0xb4fd('0x3b')]};return db['Dynamics365Account'][_0xb4fd('0x21')](_0x17e024)[_0xb4fd('0x28')](function(_0xdd0e59){_0x5d5606[_0xb4fd('0x21')]=_0xdd0e59;if(_0x11ed43[_0xb4fd('0x33')][_0xb4fd('0x41')]){_0x68776['include']=[{'all':!![]}];}return db[_0xb4fd('0x42')][_0xb4fd('0x43')](_0x68776);})['then'](function(_0x2120fa){_0x5d5606[_0xb4fd('0x44')]=_0x2120fa;return _0x5d5606;})[_0xb4fd('0x28')](respondWithFilteredResult(_0x477a53,_0x68776))[_0xb4fd('0x45')](handleError(_0x477a53,null));};exports[_0xb4fd('0x46')]=function(_0x5e24ff,_0x244e9d){var _0x661f32={'raw':![],'where':{'id':_0x5e24ff['params']['id']}},_0xdaac5a={};_0xdaac5a[_0xb4fd('0x30')]=_['keys'](db[_0xb4fd('0x42')][_0xb4fd('0x2d')]);_0xdaac5a['query']=_[_0xb4fd('0x47')](_0x5e24ff['query']);_0xdaac5a[_0xb4fd('0x31')]=_[_0xb4fd('0x32')](_0xdaac5a[_0xb4fd('0x30')],_0xdaac5a['query']);_0x661f32[_0xb4fd('0x34')]=_[_0xb4fd('0x32')](_0xdaac5a[_0xb4fd('0x30')],qs[_0xb4fd('0x35')](_0x5e24ff[_0xb4fd('0x33')][_0xb4fd('0x35')]));_0x661f32[_0xb4fd('0x34')]=_0x661f32['attributes']['length']?_0x661f32[_0xb4fd('0x34')]:_0xdaac5a[_0xb4fd('0x30')];if(_0x5e24ff[_0xb4fd('0x33')][_0xb4fd('0x41')]){_0x661f32['include']=[{'all':!![]}];}_0x661f32=_[_0xb4fd('0x3d')]({},_0x661f32,_0x5e24ff['options']);return db['Dynamics365Account'][_0xb4fd('0x48')](_0x661f32)[_0xb4fd('0x28')](handleEntityNotFound(_0x244e9d,null))['then'](respondWithResult(_0x244e9d,null))[_0xb4fd('0x45')](handleError(_0x244e9d,null));};exports[_0xb4fd('0x49')]=function(_0x4b7fa0,_0xea231f){return db[_0xb4fd('0x42')][_0xb4fd('0x49')](_0x4b7fa0['body'],{})['then'](respondWithResult(_0xea231f,0xc9))[_0xb4fd('0x45')](handleError(_0xea231f,null));};exports[_0xb4fd('0x26')]=function(_0x17fbc7,_0x339990){if(_0x17fbc7['body']['id']){delete _0x17fbc7[_0xb4fd('0x4a')]['id'];}return db[_0xb4fd('0x42')]['find']({'where':{'id':_0x17fbc7[_0xb4fd('0x4b')]['id']}})[_0xb4fd('0x28')](handleEntityNotFound(_0x339990,null))[_0xb4fd('0x28')](saveUpdates(_0x17fbc7['body'],null))[_0xb4fd('0x28')](respondWithResult(_0x339990,null))[_0xb4fd('0x45')](handleError(_0x339990,null));};exports['destroy']=function(_0x47054f,_0x4de371){return db['Dynamics365Account'][_0xb4fd('0x48')]({'where':{'id':_0x47054f[_0xb4fd('0x4b')]['id']}})[_0xb4fd('0x28')](handleEntityNotFound(_0x4de371,null))[_0xb4fd('0x28')](removeEntity(_0x4de371,null))[_0xb4fd('0x45')](handleError(_0x4de371,null));};exports[_0xb4fd('0x4c')]=function(_0x372cb4,_0x315524,_0x44d43d){var _0x3c8a88={};var _0x77625b={};var _0x3063d0;var _0x106196;return db[_0xb4fd('0x42')][_0xb4fd('0x4d')]({'where':{'id':_0x372cb4['params']['id']}})['then'](handleEntityNotFound(_0x315524,null))[_0xb4fd('0x28')](function(_0x7c85e8){if(_0x7c85e8){_0x3063d0=_0x7c85e8;_0x77625b[_0xb4fd('0x30')]=_[_0xb4fd('0x47')](db[_0xb4fd('0x4e')]['rawAttributes']);_0x77625b['query']=_[_0xb4fd('0x47')](_0x372cb4[_0xb4fd('0x33')]);_0x77625b['filters']=_['intersection'](_0x77625b['model'],_0x77625b[_0xb4fd('0x33')]);_0x3c8a88[_0xb4fd('0x34')]=_[_0xb4fd('0x32')](_0x77625b[_0xb4fd('0x30')],qs['fields'](_0x372cb4['query'][_0xb4fd('0x35')]));_0x3c8a88[_0xb4fd('0x34')]=_0x3c8a88[_0xb4fd('0x34')]['length']?_0x3c8a88[_0xb4fd('0x34')]:_0x77625b[_0xb4fd('0x30')];_0x3c8a88[_0xb4fd('0x39')]=qs[_0xb4fd('0x3a')](_0x372cb4['query'][_0xb4fd('0x3a')]);_0x3c8a88[_0xb4fd('0x3b')]=qs['filters'](_[_0xb4fd('0x3c')](_0x372cb4['query'],_0x77625b[_0xb4fd('0x31')]));if(_0x372cb4['query'][_0xb4fd('0x4f')]){_0x3c8a88[_0xb4fd('0x3b')]=_[_0xb4fd('0x3d')](_0x3c8a88[_0xb4fd('0x3b')],{'$or':_[_0xb4fd('0x2c')](_0x3c8a88[_0xb4fd('0x34')],function(_0x2cef70){var _0x303148={};_0x303148[_0x2cef70]={'$like':'%'+_0x372cb4[_0xb4fd('0x33')][_0xb4fd('0x4f')]+'%'};return _0x303148;})});}_0x3c8a88=_[_0xb4fd('0x3d')]({},_0x3c8a88,_0x372cb4[_0xb4fd('0x40')]);return _0x3063d0[_0xb4fd('0x4c')](_0x3c8a88);}})[_0xb4fd('0x28')](function(_0x5d5d2e){if(_0x5d5d2e){_0x106196=_0x5d5d2e[_0xb4fd('0x36')];if(!_0x372cb4['query'][_0xb4fd('0x37')]('nolimit')){_0x3c8a88[_0xb4fd('0x20')]=qs[_0xb4fd('0x20')](_0x372cb4[_0xb4fd('0x33')][_0xb4fd('0x20')]);_0x3c8a88['offset']=qs['offset'](_0x372cb4[_0xb4fd('0x33')]['offset']);}return _0x3063d0[_0xb4fd('0x4c')](_0x3c8a88);}})[_0xb4fd('0x28')](function(_0x2c1c38){if(_0x2c1c38){return _0x2c1c38?{'count':_0x106196,'rows':_0x2c1c38}:null;}})['then'](respondWithResult(_0x315524,null))[_0xb4fd('0x45')](handleError(_0x315524,null));};exports['addConfiguration']=function(_0x2f2ff3,_0xa5c9fc,_0x3b8c19){if(_0x2f2ff3[_0xb4fd('0x4a')]['id']){delete _0x2f2ff3['body']['id'];}return db[_0xb4fd('0x42')]['findOne']({'where':{'id':_0x2f2ff3[_0xb4fd('0x4b')]['id']}})[_0xb4fd('0x28')](handleEntityNotFound(_0xa5c9fc,null))[_0xb4fd('0x28')](function(_0x4f832d){if(_0x4f832d){_0x2f2ff3['body']['AccountId']=_0x4f832d['id'];_0x2f2ff3[_0xb4fd('0x4a')]['Subjects']=integrations[_0xb4fd('0x50')](_0x2f2ff3['body'][_0xb4fd('0x51')],_0x2f2ff3[_0xb4fd('0x4a')][_0xb4fd('0x3e')]);_0x2f2ff3[_0xb4fd('0x4a')]['Descriptions']=integrations[_0xb4fd('0x52')](_0x2f2ff3[_0xb4fd('0x4a')][_0xb4fd('0x51')],_0x2f2ff3[_0xb4fd('0x4a')][_0xb4fd('0x3e')]);return db['Dynamics365Configuration'][_0xb4fd('0x49')](_0x2f2ff3[_0xb4fd('0x4a')],{'include':[{'model':db['Dynamics365Field'],'as':_0xb4fd('0x53')},{'model':db[_0xb4fd('0x54')],'as':_0xb4fd('0x55')}]});}return null;})[_0xb4fd('0x28')](respondWithResult(_0xa5c9fc,null))[_0xb4fd('0x45')](handleError(_0xa5c9fc,null));};exports[_0xb4fd('0x56')]=function(_0x5d763d,_0x256ca5,_0x2dc0f0){var _0x2b93e3=_0x5d763d[_0xb4fd('0x33')][_0xb4fd('0x57')];var _0x14315e=_0x2b93e3===_0xb4fd('0x58')?_0xb4fd('0x59'):_0xb4fd('0x5a');var _0xce491e='';var _0x3f9380='';var _0x3ab2ed='';var _0x88fb33='';var _0x5975c1='';var _0xb4fc00='';var _0x5d8756='';var _0xf779ab='';var _0x444ca6=[_0xb4fd('0x5b'),'description',_0xb4fd('0x5c'),'ownerid',_0xb4fd('0x5d'),'subject','phonenumber','regardingobjectid',_0xb4fd('0x5e'),'phonecall_activity_parties'];var _0x538baf=[_0xb4fd('0x5f'),'accountidyominame','actualserviceunits',_0xb4fd('0x60'),'contactidname',_0xb4fd('0x61'),_0xb4fd('0x62'),_0xb4fd('0x63'),_0xb4fd('0x64'),_0xb4fd('0x65'),'createdbyname','createdbyyominame',_0xb4fd('0x66'),_0xb4fd('0x67'),'createdonbehalfbyyominame',_0xb4fd('0x68'),_0xb4fd('0x69'),_0xb4fd('0x6a'),_0xb4fd('0x6b'),'entitlementidname',_0xb4fd('0x6c'),_0xb4fd('0x6d'),_0xb4fd('0x6e'),'exchangerate',_0xb4fd('0x6f'),_0xb4fd('0x70'),'importsequencenumber',_0xb4fd('0x71'),_0xb4fd('0x72'),_0xb4fd('0x73'),_0xb4fd('0x74'),_0xb4fd('0x75'),_0xb4fd('0x76'),_0xb4fd('0x77'),_0xb4fd('0x78'),_0xb4fd('0x79'),_0xb4fd('0x7a'),'modifiedonbehalfbyyominame',_0xb4fd('0x7b'),'msdyn_iotalertname',_0xb4fd('0x7c'),_0xb4fd('0x7d'),_0xb4fd('0x7e'),_0xb4fd('0x7f'),_0xb4fd('0x80'),_0xb4fd('0x81'),_0xb4fd('0x82'),_0xb4fd('0x83'),_0xb4fd('0x84'),_0xb4fd('0x85'),_0xb4fd('0x86'),_0xb4fd('0x87'),_0xb4fd('0x88'),_0xb4fd('0x89'),'responseby',_0xb4fd('0x8a'),'responsiblecontactidyominame',_0xb4fd('0x8b'),'slainvokedidname',_0xb4fd('0x8c'),'socialprofileidname',_0xb4fd('0x8d'),'statuscode',_0xb4fd('0x8e'),_0xb4fd('0x8f'),'timezoneruleversionnumber',_0xb4fd('0x90'),_0xb4fd('0x91'),_0xb4fd('0x92'),_0xb4fd('0x93')];var _0xdeaf57=_0x444ca6[_0xb4fd('0x94')](_0x538baf);return db[_0xb4fd('0x42')][_0xb4fd('0x4d')]({'where':{'id':_0x5d763d[_0xb4fd('0x4b')]['id']},'attributes':['id',_0xb4fd('0x95'),'password',_0xb4fd('0x96'),_0xb4fd('0x97'),_0xb4fd('0x98'),_0xb4fd('0x99')]})['then'](handleEntityNotFound(_0x256ca5,null))[_0xb4fd('0x28')](function(_0x2aa6bd){if(_0x2aa6bd){_0xf779ab=_0x2aa6bd[_0xb4fd('0x96')];var _0x57ce81=_0xf779ab['slice'](-0x1);if(_0x57ce81==='/'){_0xf779ab=_0xf779ab['substring'](0x0,_0xf779ab['lastIndexOf'](_0x57ce81));}_0x5d8756=util[_0xb4fd('0x9a')](_0xb4fd('0x9b'),_0xf779ab);var _0x5119dc={'method':_0xb4fd('0x9c'),'uri':_0xb4fd('0x9d')+_0x2aa6bd[_0xb4fd('0x97')]+'/oauth2/token','form':{'client_id':_0x2aa6bd[_0xb4fd('0x98')],'resource':_0xf779ab,'username':_0x2aa6bd[_0xb4fd('0x95')],'password':_0x2aa6bd[_0xb4fd('0x9e')],'grant_type':_0xb4fd('0x9e'),'client_secret':_0x2aa6bd[_0xb4fd('0x99')]},'json':!![]};return rp(_0x5119dc);}})[_0xb4fd('0x28')](function(_0x4d2dcb){_0xb4fc00=_0x4d2dcb[_0xb4fd('0x9f')];var _0x160cfc={'method':_0xb4fd('0xa0'),'uri':encodeURI(_0x5d8756+_0xb4fd('0xa1')+_0x14315e+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0xb4fc00,'If-None-Match':null,'OData-Version':_0xb4fd('0xa2')},'json':!![]};return rp(_0x160cfc);})[_0xb4fd('0x28')](function(_0x35696c){var _0x9bc2ed=_0x35696c[_0xb4fd('0xa3')][0x0];var _0x166741=_0x9bc2ed[_0xb4fd('0xa4')];var _0x4910fc={'method':_0xb4fd('0xa0'),'uri':_0x5d8756+_0xb4fd('0xa5')+_0x166741+_0xb4fd('0xa6'),'headers':{'Authorization':_0xb4fd('0xa7')+_0xb4fc00,'If-None-Match':null,'OData-Version':_0xb4fd('0xa2')},'json':!![]};return rp(_0x4910fc);})[_0xb4fd('0x28')](function(_0x193058){_0xce491e=_0x193058;_0x3f9380=_0xce491e[_0xb4fd('0xa8')];_0x3f9380=_[_0xb4fd('0xa9')](_0x3f9380,function(_0x55e3d9){return!_0xdeaf57[_0xb4fd('0xaa')](_0x55e3d9[_0xb4fd('0xab')]);});var _0x4fdb29=[];var _0xdea929=[];_0x3f9380['forEach'](function(_0x573a3){if(_0x573a3[_0xb4fd('0xac')]){var _0x48a138=_0x573a3[_0xb4fd('0xac')]['substring'](_0x573a3['@odata.type'][_0xb4fd('0xad')]('.')+0x1);if(_0x48a138==='PicklistAttributeMetadata'){_0x4fdb29[_0xb4fd('0xae')](getSelectList(_0x5d8756,_0x2b93e3,_0xdea929,_0xce491e[_0xb4fd('0xa4')],_0x573a3[_0xb4fd('0xa4')],_0xb4fc00));}}});return Promise[_0xb4fd('0xaf')](_0x4fdb29);})[_0xb4fd('0x28')](function(_0x1398af){_0x3ab2ed=_0x1398af[0x0];var _0x31fcad=[];var _0x540d10=[];_0x3f9380[_0xb4fd('0xb0')](function(_0x3a452d){if(!_[_0xb4fd('0xb1')](_0x3a452d['@odata.type'])){var _0x1b7d62=_0x3a452d[_0xb4fd('0xac')][_0xb4fd('0xb2')](_0x3a452d[_0xb4fd('0xac')]['lastIndexOf']('.')+0x1);if(_0x1b7d62==='BooleanAttributeMetadata'){_0x31fcad[_0xb4fd('0xae')](getBooleanList(_0x5d8756,_0x2b93e3,_0x540d10,_0xce491e['MetadataId'],_0x3a452d[_0xb4fd('0xa4')],_0xb4fc00));}}});return Promise[_0xb4fd('0xaf')](_0x31fcad);})['then'](function(_0x9adc43){_0x88fb33=_0x9adc43[0x0];var _0x3d8034=[];var _0x135418=[];_0x3f9380[_0xb4fd('0xb0')](function(_0x5df3d9){if(_0x5df3d9[_0xb4fd('0xac')]){var _0x149f5a=_0x5df3d9['@odata.type'][_0xb4fd('0xb2')](_0x5df3d9[_0xb4fd('0xac')][_0xb4fd('0xad')]('.')+0x1);if(_0x149f5a===_0xb4fd('0xb3')||_0x149f5a===_0xb4fd('0xb4')||_0x149f5a===_0xb4fd('0xb5')||_0x149f5a===_0xb4fd('0xb6')||_0x149f5a===_0xb4fd('0xb7')||_0x149f5a==='DateTimeAttributeMetadata'||_0x149f5a===_0xb4fd('0xb8')||_0x149f5a===_0xb4fd('0xb9')||_0x149f5a===_0xb4fd('0xba')||_0x149f5a==='DecimalAttributeMetadata'){_0x3d8034[_0xb4fd('0xae')](getInputList(_0x5d8756,_0x2b93e3,_0x149f5a,_0x135418,_0xce491e[_0xb4fd('0xa4')],_0x5df3d9[_0xb4fd('0xa4')],_0xb4fc00));}}});return Promise[_0xb4fd('0xaf')](_0x3d8034);})[_0xb4fd('0x28')](function(_0x14cacf){_0x5975c1=_0x14cacf[0x0];var _0xe30085=_0x3ab2ed[_0xb4fd('0x94')](_0x88fb33)[_0xb4fd('0x94')](_0x5975c1);var _0x529eea={'count':_0xe30085['length'],'rows':_0xe30085};return _0x529eea;})[_0xb4fd('0x28')](respondWithResult(_0x256ca5,null))[_0xb4fd('0x45')](function(_0x4ca1e2){var _0x57fc0c=_0x5d763d['query'][_0xb4fd('0xbb')]?0x1f4:_0x4ca1e2['statusCode']||0x1f4;logger[_0xb4fd('0x29')](_0x4ca1e2[_0xb4fd('0xbc')]);delete _0x4ca1e2[_0xb4fd('0x2a')];if(_0x57fc0c===0x191){_0x57fc0c=0x190;}_0x256ca5[_0xb4fd('0x1c')](_0x57fc0c)[_0xb4fd('0x2b')](_0x5d763d[_0xb4fd('0x33')][_0xb4fd('0xbb')]?{'message':_0xb4fd('0xbd'),'statusCode':_0x4ca1e2[_0xb4fd('0xbe')]}:_0x4ca1e2);});};function getSelectList(_0x1c9f09,_0x520fd3,_0x128007,_0xb06c72,_0xa2ce3a,_0x5a81fe){var _0x26861e={'method':_0xb4fd('0xa0'),'uri':_0x1c9f09+'EntityDefinitions('+_0xb06c72+_0xb4fd('0xbf')+_0xa2ce3a+_0xb4fd('0xc0')+_0xb4fd('0xc1'),'headers':{'Authorization':_0xb4fd('0xa7')+_0x5a81fe,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x26861e)[_0xb4fd('0x28')](function(_0x40d210){var _0x3d5078=[];var _0x44d9e1=_0x40d210[_0xb4fd('0xc2')][_0xb4fd('0xc3')];_0x44d9e1[_0xb4fd('0xb0')](function(_0x1c8c04){_0x3d5078[_0xb4fd('0xae')]({'name':_0x1c8c04[_0xb4fd('0xc4')][_0xb4fd('0xc5')][_0xb4fd('0xc4')],'value':String(_0x1c8c04[_0xb4fd('0xc6')])});});var _0x2e74c3={'id':_0x520fd3+'_'+_0x40d210[_0xb4fd('0xab')],'name':_0x40d210[_0xb4fd('0xc7')]['UserLocalizedLabel']['Label'],'custom':![],'options':_0x3d5078};_0x128007[_0xb4fd('0xae')](_0x2e74c3);return _0x128007;});}function getBooleanList(_0x45e1d3,_0x1417bb,_0x36e676,_0x48e0d8,_0x38e447,_0x5a6582){var _0x36067a={'method':'GET','uri':_0x45e1d3+'EntityDefinitions('+_0x48e0d8+')/Attributes('+_0x38e447+_0xb4fd('0xc8'),'headers':{'Authorization':_0xb4fd('0xa7')+_0x5a6582,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x36067a)['then'](function(_0x4388c8){var _0xfc30f6=[];_0xfc30f6[_0xb4fd('0xae')]({'name':_0x4388c8['OptionSet'][_0xb4fd('0xc9')][_0xb4fd('0xc4')][_0xb4fd('0xc5')][_0xb4fd('0xc4')],'value':'true'},{'name':_0x4388c8[_0xb4fd('0xc2')][_0xb4fd('0xca')][_0xb4fd('0xc4')][_0xb4fd('0xc5')][_0xb4fd('0xc4')],'value':_0xb4fd('0xcb')});var _0x40a93e={'id':_0x1417bb+'_'+_0x4388c8[_0xb4fd('0xab')],'name':_0x4388c8['DisplayName'][_0xb4fd('0xc5')][_0xb4fd('0xc4')],'custom':![],'options':_0xfc30f6};_0x36e676[_0xb4fd('0xae')](_0x40a93e);return _0x36e676;});}function getInputList(_0x58d01e,_0xec3e4d,_0x581876,_0x232312,_0x582e59,_0x4c6951,_0x2cddf1){var _0x59bf94={'method':'GET','uri':_0x58d01e+_0xb4fd('0xa5')+_0x582e59+_0xb4fd('0xbf')+_0x4c6951+_0xb4fd('0xcc')+_0x581876+_0xb4fd('0xcd'),'headers':{'Authorization':'Bearer\x20'+_0x2cddf1,'If-None-Match':null,'OData-Version':_0xb4fd('0xa2')},'json':!![]};return rp(_0x59bf94)[_0xb4fd('0x28')](function(_0x57a8da){var _0x150b65={'id':_0xec3e4d+'_'+_0x57a8da[_0xb4fd('0xab')],'name':_0x57a8da[_0xb4fd('0xc7')][_0xb4fd('0xc5')]?_0x57a8da[_0xb4fd('0xc7')][_0xb4fd('0xc5')][_0xb4fd('0xc4')]:_0x57a8da[_0xb4fd('0xab')],'custom':![],'options':[]};_0x232312[_0xb4fd('0xae')](_0x150b65);return _0x232312;});} \ No newline at end of file +var _0x0207=['type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','include','findAll','catch','show','params','rawAttributes','includeAll','find','create','body','destroy','getConfigurations','findOne','Dynamics365Configuration','pick','addConfiguration','AccountId','channel','Descriptions','getDescriptions','Dynamics365Field','ticketType','PhoneCall','title','description','ownerid','subject','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','createdbyexternalpartyname','createdbyname','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_iotalertname','numberofchildincidents','overriddencreatedon','owneridname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','slainvokedidname','slaname','socialprofileidname','statuscode','subjectidname','traversedpath','utcconversiontimezonecode','concat','password','remoteUri','tenantId','clientId','clientSecret','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','POST','/oauth2/token','username','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','MetadataId','EntityDefinitions(','Attributes','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','all','isNil','StringAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','test','Wrong\x20credentials','statusCode',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','OptionSet','Options','Label','UserLocalizedLabel','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','error','name','send','index','map','Dynamics365Account','fieldName'];(function(_0x138ce8,_0x367538){var _0x372500=function(_0x2dff20){while(--_0x2dff20){_0x138ce8['push'](_0x138ce8['shift']());}};_0x372500(++_0x367538);}(_0x0207,0x162));var _0x7020=function(_0x33cece,_0x54b9da){_0x33cece=_0x33cece-0x0;var _0x1a2efd=_0x0207[_0x33cece];return _0x1a2efd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7020('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7020('0x1'));var moment=require(_0x7020('0x2'));var BPromise=require(_0x7020('0x3'));var Mustache=require(_0x7020('0x4'));var util=require(_0x7020('0x5'));var path=require(_0x7020('0x6'));var sox=require(_0x7020('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7020('0x8'));var _=require(_0x7020('0x9'));var squel=require(_0x7020('0xa'));var crypto=require(_0x7020('0xb'));var jsforce=require(_0x7020('0xc'));var deskjs=require(_0x7020('0xd'));var toCsv=require(_0x7020('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7020('0xf'));var authService=require(_0x7020('0x10'));var qs=require(_0x7020('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7020('0x12'));var logger=require(_0x7020('0x13'))('api');var utils=require(_0x7020('0x14'));var config=require(_0x7020('0x15'));var licenseUtil=require(_0x7020('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0x7020('0x17'));function respondWithStatusCode(_0x598198,_0xd41aed){_0xd41aed=_0xd41aed||0xcc;return function(_0x1bedde){if(_0x1bedde){return _0x598198[_0x7020('0x18')](_0xd41aed);}return _0x598198['status'](_0xd41aed)[_0x7020('0x19')]();};}function respondWithResult(_0x5f5872,_0x3b8d60){_0x3b8d60=_0x3b8d60||0xc8;return function(_0x17b971){if(_0x17b971){return _0x5f5872[_0x7020('0x1a')](_0x3b8d60)[_0x7020('0x1b')](_0x17b971);}};}function respondWithFilteredResult(_0x17260e,_0x308324){return function(_0x55c8b9){if(_0x55c8b9){var _0x36f895=typeof _0x308324['offset']===_0x7020('0x1c')&&typeof _0x308324[_0x7020('0x1d')]===_0x7020('0x1c');var _0x1e3a06=_0x55c8b9['count'];var _0x3d5d25=_0x36f895?0x0:_0x308324[_0x7020('0x1e')];var _0x33daae=_0x36f895?_0x55c8b9[_0x7020('0x1f')]:_0x308324[_0x7020('0x1e')]+_0x308324[_0x7020('0x1d')];var _0x59b5d2;if(_0x33daae>=_0x1e3a06){_0x33daae=_0x1e3a06;_0x59b5d2=0xc8;}else{_0x59b5d2=0xce;}_0x17260e['status'](_0x59b5d2);return _0x17260e[_0x7020('0x20')](_0x7020('0x21'),_0x3d5d25+'-'+_0x33daae+'/'+_0x1e3a06)[_0x7020('0x1b')](_0x55c8b9);}return null;};}function patchUpdates(_0xb96d30){return function(_0x5623fc){try{jsonpatch[_0x7020('0x22')](_0x5623fc,_0xb96d30,!![]);}catch(_0x4e263e){return BPromise[_0x7020('0x23')](_0x4e263e);}return _0x5623fc[_0x7020('0x24')]();};}function saveUpdates(_0x493cc7,_0xcc48f){return function(_0x371b3f){if(_0x371b3f){return _0x371b3f[_0x7020('0x25')](_0x493cc7)[_0x7020('0x26')](function(_0x384fe9){return _0x384fe9;});}return null;};}function removeEntity(_0xe3f4d2,_0x147986){return function(_0x3f54c2){if(_0x3f54c2){return _0x3f54c2['destroy']()[_0x7020('0x26')](function(){_0xe3f4d2[_0x7020('0x1a')](0xcc)[_0x7020('0x19')]();});}};}function handleEntityNotFound(_0x5586f8,_0x28f9f0){return function(_0x4ad761){if(!_0x4ad761){_0x5586f8['sendStatus'](0x194);}return _0x4ad761;};}function handleError(_0x50aecb,_0x178cbd){_0x178cbd=_0x178cbd||0x1f4;return function(_0x55957e){logger[_0x7020('0x27')](_0x55957e['stack']);if(_0x55957e[_0x7020('0x28')]){delete _0x55957e[_0x7020('0x28')];}_0x50aecb[_0x7020('0x1a')](_0x178cbd)[_0x7020('0x29')](_0x55957e);};}exports[_0x7020('0x2a')]=function(_0x1dff20,_0x2ba734){var _0x15a1cc={},_0xc51979={},_0x2c9c86={'count':0x0,'rows':[]};var _0x44ce28=_[_0x7020('0x2b')](db[_0x7020('0x2c')]['rawAttributes'],function(_0x18815e){return{'name':_0x18815e[_0x7020('0x2d')],'type':_0x18815e[_0x7020('0x2e')][_0x7020('0x2f')]};});_0xc51979[_0x7020('0x30')]=_[_0x7020('0x2b')](_0x44ce28,_0x7020('0x28'));_0xc51979[_0x7020('0x31')]=_[_0x7020('0x32')](_0x1dff20[_0x7020('0x31')]);_0xc51979[_0x7020('0x33')]=_[_0x7020('0x34')](_0xc51979[_0x7020('0x30')],_0xc51979[_0x7020('0x31')]);_0x15a1cc['attributes']=_[_0x7020('0x34')](_0xc51979[_0x7020('0x30')],qs[_0x7020('0x35')](_0x1dff20[_0x7020('0x31')][_0x7020('0x35')]));_0x15a1cc[_0x7020('0x36')]=_0x15a1cc[_0x7020('0x36')][_0x7020('0x37')]?_0x15a1cc[_0x7020('0x36')]:_0xc51979[_0x7020('0x30')];if(!_0x1dff20[_0x7020('0x31')][_0x7020('0x38')](_0x7020('0x39'))){_0x15a1cc[_0x7020('0x1d')]=qs['limit'](_0x1dff20[_0x7020('0x31')][_0x7020('0x1d')]);_0x15a1cc[_0x7020('0x1e')]=qs['offset'](_0x1dff20[_0x7020('0x31')][_0x7020('0x1e')]);}_0x15a1cc[_0x7020('0x3a')]=qs[_0x7020('0x3b')](_0x1dff20[_0x7020('0x31')][_0x7020('0x3b')]);_0x15a1cc['where']=qs[_0x7020('0x33')](_['pick'](_0x1dff20['query'],_0xc51979['filters']),_0x44ce28);if(_0x1dff20[_0x7020('0x31')][_0x7020('0x3c')]){_0x15a1cc[_0x7020('0x3d')]=_[_0x7020('0x3e')](_0x15a1cc[_0x7020('0x3d')],{'$or':_['map'](_0x44ce28,function(_0x5da8e9){if(_0x5da8e9[_0x7020('0x2e')]!==_0x7020('0x3f')){var _0x3bc14e={};_0x3bc14e[_0x5da8e9[_0x7020('0x28')]]={'$like':'%'+_0x1dff20['query'][_0x7020('0x3c')]+'%'};return _0x3bc14e;}})});}_0x15a1cc=_['merge']({},_0x15a1cc,_0x1dff20[_0x7020('0x40')]);var _0x1aaa5e={'where':_0x15a1cc[_0x7020('0x3d')]};return db['Dynamics365Account']['count'](_0x1aaa5e)[_0x7020('0x26')](function(_0x553022){_0x2c9c86[_0x7020('0x1f')]=_0x553022;if(_0x1dff20[_0x7020('0x31')]['includeAll']){_0x15a1cc[_0x7020('0x41')]=[{'all':!![]}];}return db[_0x7020('0x2c')][_0x7020('0x42')](_0x15a1cc);})['then'](function(_0x35d64e){_0x2c9c86['rows']=_0x35d64e;return _0x2c9c86;})[_0x7020('0x26')](respondWithFilteredResult(_0x2ba734,_0x15a1cc))[_0x7020('0x43')](handleError(_0x2ba734,null));};exports[_0x7020('0x44')]=function(_0x4d7dae,_0x31ba95){var _0xa389b0={'raw':![],'where':{'id':_0x4d7dae[_0x7020('0x45')]['id']}},_0x3a6636={};_0x3a6636[_0x7020('0x30')]=_['keys'](db[_0x7020('0x2c')][_0x7020('0x46')]);_0x3a6636[_0x7020('0x31')]=_[_0x7020('0x32')](_0x4d7dae['query']);_0x3a6636[_0x7020('0x33')]=_['intersection'](_0x3a6636['model'],_0x3a6636['query']);_0xa389b0[_0x7020('0x36')]=_['intersection'](_0x3a6636[_0x7020('0x30')],qs[_0x7020('0x35')](_0x4d7dae[_0x7020('0x31')]['fields']));_0xa389b0[_0x7020('0x36')]=_0xa389b0['attributes'][_0x7020('0x37')]?_0xa389b0[_0x7020('0x36')]:_0x3a6636[_0x7020('0x30')];if(_0x4d7dae[_0x7020('0x31')][_0x7020('0x47')]){_0xa389b0[_0x7020('0x41')]=[{'all':!![]}];}_0xa389b0=_[_0x7020('0x3e')]({},_0xa389b0,_0x4d7dae[_0x7020('0x40')]);return db[_0x7020('0x2c')][_0x7020('0x48')](_0xa389b0)[_0x7020('0x26')](handleEntityNotFound(_0x31ba95,null))[_0x7020('0x26')](respondWithResult(_0x31ba95,null))[_0x7020('0x43')](handleError(_0x31ba95,null));};exports[_0x7020('0x49')]=function(_0x3dcf52,_0x241ff1){return db[_0x7020('0x2c')][_0x7020('0x49')](_0x3dcf52['body'],{})[_0x7020('0x26')](respondWithResult(_0x241ff1,0xc9))[_0x7020('0x43')](handleError(_0x241ff1,null));};exports[_0x7020('0x25')]=function(_0x2a3344,_0x41f642){if(_0x2a3344['body']['id']){delete _0x2a3344['body']['id'];}return db[_0x7020('0x2c')]['find']({'where':{'id':_0x2a3344[_0x7020('0x45')]['id']}})[_0x7020('0x26')](handleEntityNotFound(_0x41f642,null))[_0x7020('0x26')](saveUpdates(_0x2a3344[_0x7020('0x4a')],null))['then'](respondWithResult(_0x41f642,null))['catch'](handleError(_0x41f642,null));};exports[_0x7020('0x4b')]=function(_0x2a4656,_0x3690ee){return db[_0x7020('0x2c')][_0x7020('0x48')]({'where':{'id':_0x2a4656[_0x7020('0x45')]['id']}})[_0x7020('0x26')](handleEntityNotFound(_0x3690ee,null))[_0x7020('0x26')](removeEntity(_0x3690ee,null))[_0x7020('0x43')](handleError(_0x3690ee,null));};exports[_0x7020('0x4c')]=function(_0x3b583b,_0x1113a5,_0x58834f){var _0x4ea26d={};var _0x5a6557={};var _0x445459;var _0x482c29;return db[_0x7020('0x2c')][_0x7020('0x4d')]({'where':{'id':_0x3b583b[_0x7020('0x45')]['id']}})[_0x7020('0x26')](handleEntityNotFound(_0x1113a5,null))[_0x7020('0x26')](function(_0x2b487b){if(_0x2b487b){_0x445459=_0x2b487b;_0x5a6557[_0x7020('0x30')]=_['keys'](db[_0x7020('0x4e')]['rawAttributes']);_0x5a6557[_0x7020('0x31')]=_[_0x7020('0x32')](_0x3b583b[_0x7020('0x31')]);_0x5a6557[_0x7020('0x33')]=_[_0x7020('0x34')](_0x5a6557[_0x7020('0x30')],_0x5a6557[_0x7020('0x31')]);_0x4ea26d['attributes']=_[_0x7020('0x34')](_0x5a6557[_0x7020('0x30')],qs[_0x7020('0x35')](_0x3b583b[_0x7020('0x31')]['fields']));_0x4ea26d['attributes']=_0x4ea26d['attributes'][_0x7020('0x37')]?_0x4ea26d[_0x7020('0x36')]:_0x5a6557[_0x7020('0x30')];_0x4ea26d[_0x7020('0x3a')]=qs[_0x7020('0x3b')](_0x3b583b[_0x7020('0x31')]['sort']);_0x4ea26d[_0x7020('0x3d')]=qs[_0x7020('0x33')](_[_0x7020('0x4f')](_0x3b583b[_0x7020('0x31')],_0x5a6557[_0x7020('0x33')]));if(_0x3b583b[_0x7020('0x31')][_0x7020('0x3c')]){_0x4ea26d[_0x7020('0x3d')]=_[_0x7020('0x3e')](_0x4ea26d['where'],{'$or':_[_0x7020('0x2b')](_0x4ea26d['attributes'],function(_0x1f1053){var _0x58cb36={};_0x58cb36[_0x1f1053]={'$like':'%'+_0x3b583b['query'][_0x7020('0x3c')]+'%'};return _0x58cb36;})});}_0x4ea26d=_[_0x7020('0x3e')]({},_0x4ea26d,_0x3b583b[_0x7020('0x40')]);return _0x445459['getConfigurations'](_0x4ea26d);}})[_0x7020('0x26')](function(_0x3410f3){if(_0x3410f3){_0x482c29=_0x3410f3[_0x7020('0x37')];if(!_0x3b583b[_0x7020('0x31')][_0x7020('0x38')](_0x7020('0x39'))){_0x4ea26d[_0x7020('0x1d')]=qs[_0x7020('0x1d')](_0x3b583b[_0x7020('0x31')]['limit']);_0x4ea26d[_0x7020('0x1e')]=qs[_0x7020('0x1e')](_0x3b583b[_0x7020('0x31')][_0x7020('0x1e')]);}return _0x445459[_0x7020('0x4c')](_0x4ea26d);}})['then'](function(_0x416839){if(_0x416839){return _0x416839?{'count':_0x482c29,'rows':_0x416839}:null;}})[_0x7020('0x26')](respondWithResult(_0x1113a5,null))['catch'](handleError(_0x1113a5,null));};exports[_0x7020('0x50')]=function(_0x36bf12,_0x316233,_0x48f2be){if(_0x36bf12['body']['id']){delete _0x36bf12[_0x7020('0x4a')]['id'];}return db[_0x7020('0x2c')][_0x7020('0x4d')]({'where':{'id':_0x36bf12[_0x7020('0x45')]['id']}})[_0x7020('0x26')](handleEntityNotFound(_0x316233,null))[_0x7020('0x26')](function(_0xca8916){if(_0xca8916){_0x36bf12[_0x7020('0x4a')][_0x7020('0x51')]=_0xca8916['id'];_0x36bf12[_0x7020('0x4a')]['Subjects']=integrations['getSubjects'](_0x36bf12['body'][_0x7020('0x52')],_0x36bf12[_0x7020('0x4a')][_0x7020('0x2e')]);_0x36bf12['body'][_0x7020('0x53')]=integrations[_0x7020('0x54')](_0x36bf12[_0x7020('0x4a')][_0x7020('0x52')],_0x36bf12[_0x7020('0x4a')][_0x7020('0x2e')]);return db[_0x7020('0x4e')][_0x7020('0x49')](_0x36bf12[_0x7020('0x4a')],{'include':[{'model':db['Dynamics365Field'],'as':'Subjects'},{'model':db[_0x7020('0x55')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x316233,null))[_0x7020('0x43')](handleError(_0x316233,null));};exports['getFields']=function(_0x4a6c26,_0x1a5de4,_0x103af3){var _0x2672d2=_0x4a6c26[_0x7020('0x31')][_0x7020('0x56')];var _0x4b9223=_0x2672d2==='incident'?'Incident':_0x7020('0x57');var _0x426c50='';var _0x122c37='';var _0x77d041='';var _0x2f4aaf='';var _0x4f0f7c='';var _0x5d2057='';var _0x365fcd='';var _0x53ec86='';var _0xe3019=[_0x7020('0x58'),_0x7020('0x59'),'customerid',_0x7020('0x5a'),'caseorigincode',_0x7020('0x5b'),'phonenumber','regardingobjectid',_0x7020('0x5c'),_0x7020('0x5d')];var _0x2c4734=[_0x7020('0x5e'),_0x7020('0x5f'),_0x7020('0x60'),_0x7020('0x61'),_0x7020('0x62'),_0x7020('0x63'),'contractdetailidname','contractidname',_0x7020('0x64'),'createdbyexternalpartyyominame',_0x7020('0x65'),'createdbyyominame',_0x7020('0x66'),_0x7020('0x67'),_0x7020('0x68'),_0x7020('0x69'),_0x7020('0x6a'),_0x7020('0x6b'),_0x7020('0x6c'),_0x7020('0x6d'),'entityimage_timestamp',_0x7020('0x6e'),_0x7020('0x6f'),_0x7020('0x70'),_0x7020('0x71'),_0x7020('0x72'),_0x7020('0x73'),'influencescore',_0x7020('0x74'),_0x7020('0x75'),_0x7020('0x76'),_0x7020('0x77'),_0x7020('0x78'),'modifiedbyname',_0x7020('0x79'),_0x7020('0x7a'),_0x7020('0x7b'),_0x7020('0x7c'),'msdyn_incidenttypename',_0x7020('0x7d'),_0x7020('0x7e'),'onholdtime',_0x7020('0x7f'),_0x7020('0x80'),'owneridtype','owneridyominame','parentcaseidname',_0x7020('0x81'),_0x7020('0x82'),_0x7020('0x83'),_0x7020('0x84'),_0x7020('0x85'),_0x7020('0x86'),_0x7020('0x87'),_0x7020('0x88'),_0x7020('0x89'),'responsiblecontactidyominame','sentimentvalue',_0x7020('0x8a'),_0x7020('0x8b'),_0x7020('0x8c'),'statecode',_0x7020('0x8d'),_0x7020('0x8e'),'ticketnumber','timezoneruleversionnumber','transactioncurrencyidname',_0x7020('0x8f'),_0x7020('0x90'),'versionnumber'];var _0x4f5def=_0xe3019[_0x7020('0x91')](_0x2c4734);return db['Dynamics365Account'][_0x7020('0x4d')]({'where':{'id':_0x4a6c26['params']['id']},'attributes':['id','username',_0x7020('0x92'),_0x7020('0x93'),_0x7020('0x94'),_0x7020('0x95'),_0x7020('0x96')]})[_0x7020('0x26')](handleEntityNotFound(_0x1a5de4,null))['then'](function(_0x1ea9b2){if(_0x1ea9b2){_0x53ec86=_0x1ea9b2['remoteUri'];var _0x22fbed=_0x53ec86[_0x7020('0x97')](-0x1);if(_0x22fbed==='/'){_0x53ec86=_0x53ec86[_0x7020('0x98')](0x0,_0x53ec86[_0x7020('0x99')](_0x22fbed));}_0x365fcd=util[_0x7020('0x9a')](_0x7020('0x9b'),_0x53ec86);var _0x7e5112={'method':_0x7020('0x9c'),'uri':'https://login.microsoftonline.com/'+_0x1ea9b2[_0x7020('0x94')]+_0x7020('0x9d'),'form':{'client_id':_0x1ea9b2[_0x7020('0x95')],'resource':_0x53ec86,'username':_0x1ea9b2[_0x7020('0x9e')],'password':_0x1ea9b2[_0x7020('0x92')],'grant_type':_0x7020('0x92'),'client_secret':_0x1ea9b2[_0x7020('0x96')]},'json':!![]};return rp(_0x7e5112);}})[_0x7020('0x26')](function(_0x5e6d37){_0x5d2057=_0x5e6d37['access_token'];var _0x3bdd65={'method':_0x7020('0x9f'),'uri':encodeURI(_0x365fcd+_0x7020('0xa0')+_0x4b9223+'\x27'),'headers':{'Authorization':_0x7020('0xa1')+_0x5d2057,'If-None-Match':null,'OData-Version':_0x7020('0xa2')},'json':!![]};return rp(_0x3bdd65);})['then'](function(_0x5daf2){var _0x4d9630=_0x5daf2['value'][0x0];var _0x34a979=_0x4d9630[_0x7020('0xa3')];var _0x52267f={'method':_0x7020('0x9f'),'uri':_0x365fcd+_0x7020('0xa4')+_0x34a979+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0x7020('0xa1')+_0x5d2057,'If-None-Match':null,'OData-Version':_0x7020('0xa2')},'json':!![]};return rp(_0x52267f);})[_0x7020('0x26')](function(_0x79cb4a){_0x426c50=_0x79cb4a;_0x122c37=_0x426c50[_0x7020('0xa5')];_0x122c37=_[_0x7020('0xa6')](_0x122c37,function(_0x460979){return!_0x4f5def[_0x7020('0xa7')](_0x460979[_0x7020('0xa8')]);});var _0x244fa6=[];var _0x380038=[];_0x122c37[_0x7020('0xa9')](function(_0x249dbc){if(_0x249dbc[_0x7020('0xaa')]){var _0x26e00d=_0x249dbc[_0x7020('0xaa')]['substring'](_0x249dbc[_0x7020('0xaa')][_0x7020('0x99')]('.')+0x1);if(_0x26e00d===_0x7020('0xab')){_0x244fa6[_0x7020('0xac')](getSelectList(_0x365fcd,_0x2672d2,_0x380038,_0x426c50[_0x7020('0xa3')],_0x249dbc[_0x7020('0xa3')],_0x5d2057));}}});return Promise[_0x7020('0xad')](_0x244fa6);})['then'](function(_0x5a0661){_0x77d041=_0x5a0661[0x0];var _0x259ead=[];var _0x5a1f23=[];_0x122c37[_0x7020('0xa9')](function(_0x680afb){if(!_[_0x7020('0xae')](_0x680afb[_0x7020('0xaa')])){var _0x4d8ff1=_0x680afb[_0x7020('0xaa')][_0x7020('0x98')](_0x680afb[_0x7020('0xaa')][_0x7020('0x99')]('.')+0x1);if(_0x4d8ff1==='BooleanAttributeMetadata'){_0x259ead['push'](getBooleanList(_0x365fcd,_0x2672d2,_0x5a1f23,_0x426c50[_0x7020('0xa3')],_0x680afb[_0x7020('0xa3')],_0x5d2057));}}});return Promise[_0x7020('0xad')](_0x259ead);})[_0x7020('0x26')](function(_0x3b4174){_0x2f4aaf=_0x3b4174[0x0];var _0x46ab2d=[];var _0xaafa28=[];_0x122c37['forEach'](function(_0x5d931c){if(_0x5d931c['@odata.type']){var _0x26b419=_0x5d931c[_0x7020('0xaa')][_0x7020('0x98')](_0x5d931c[_0x7020('0xaa')]['lastIndexOf']('.')+0x1);if(_0x26b419===_0x7020('0xaf')||_0x26b419===_0x7020('0xb0')||_0x26b419==='BigIntAttributeMetadata'||_0x26b419===_0x7020('0xb1')||_0x26b419===_0x7020('0xb2')||_0x26b419===_0x7020('0xb3')||_0x26b419===_0x7020('0xb4')||_0x26b419===_0x7020('0xb5')||_0x26b419==='StateAttributeMetadata'||_0x26b419===_0x7020('0xb6')){_0x46ab2d['push'](getInputList(_0x365fcd,_0x2672d2,_0x26b419,_0xaafa28,_0x426c50[_0x7020('0xa3')],_0x5d931c[_0x7020('0xa3')],_0x5d2057));}}});return Promise[_0x7020('0xad')](_0x46ab2d);})['then'](function(_0x1731e1){_0x4f0f7c=_0x1731e1[0x0];var _0x260ef8=_0x77d041['concat'](_0x2f4aaf)[_0x7020('0x91')](_0x4f0f7c);var _0x510738={'count':_0x260ef8[_0x7020('0x37')],'rows':_0x260ef8};return _0x510738;})[_0x7020('0x26')](respondWithResult(_0x1a5de4,null))[_0x7020('0x43')](function(_0x1ad6d6){var _0x233260=_0x4a6c26['query']['test']?0x1f4:_0x1ad6d6['statusCode']||0x1f4;logger[_0x7020('0x27')](_0x1ad6d6['stack']);delete _0x1ad6d6[_0x7020('0x28')];if(_0x233260===0x191){_0x233260=0x190;}_0x1a5de4[_0x7020('0x1a')](_0x233260)[_0x7020('0x29')](_0x4a6c26[_0x7020('0x31')][_0x7020('0xb7')]?{'message':_0x7020('0xb8'),'statusCode':_0x1ad6d6[_0x7020('0xb9')]}:_0x1ad6d6);});};function getSelectList(_0x192cc,_0x2507e8,_0x12e63c,_0x370460,_0x14f69c,_0x410bed){var _0x412efd={'method':'GET','uri':_0x192cc+_0x7020('0xa4')+_0x370460+_0x7020('0xba')+_0x14f69c+_0x7020('0xbb')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0x7020('0xa1')+_0x410bed,'If-None-Match':null,'OData-Version':_0x7020('0xa2')},'json':!![]};return rp(_0x412efd)['then'](function(_0x5cf64d){var _0x56bea3=[];var _0x24663b=_0x5cf64d[_0x7020('0xbc')][_0x7020('0xbd')];_0x24663b[_0x7020('0xa9')](function(_0x5578d7){_0x56bea3['push']({'name':_0x5578d7[_0x7020('0xbe')][_0x7020('0xbf')][_0x7020('0xbe')],'value':String(_0x5578d7['Value'])});});var _0xe121b1={'id':_0x2507e8+'_'+_0x5cf64d[_0x7020('0xa8')],'name':_0x5cf64d[_0x7020('0xc0')][_0x7020('0xbf')][_0x7020('0xbe')],'custom':![],'options':_0x56bea3};_0x12e63c[_0x7020('0xac')](_0xe121b1);return _0x12e63c;});}function getBooleanList(_0x150ead,_0x3adf12,_0x3cdcdb,_0x28d4e7,_0x5e925b,_0x3f33d7){var _0x3d33ee={'method':_0x7020('0x9f'),'uri':_0x150ead+_0x7020('0xa4')+_0x28d4e7+_0x7020('0xba')+_0x5e925b+_0x7020('0xc1'),'headers':{'Authorization':_0x7020('0xa1')+_0x3f33d7,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3d33ee)[_0x7020('0x26')](function(_0x3aa858){var _0x5bbf2b=[];_0x5bbf2b['push']({'name':_0x3aa858[_0x7020('0xbc')][_0x7020('0xc2')][_0x7020('0xbe')]['UserLocalizedLabel'][_0x7020('0xbe')],'value':_0x7020('0xc3')},{'name':_0x3aa858[_0x7020('0xbc')][_0x7020('0xc4')][_0x7020('0xbe')]['UserLocalizedLabel'][_0x7020('0xbe')],'value':_0x7020('0xc5')});var _0x32629c={'id':_0x3adf12+'_'+_0x3aa858['LogicalName'],'name':_0x3aa858[_0x7020('0xc0')][_0x7020('0xbf')][_0x7020('0xbe')],'custom':![],'options':_0x5bbf2b};_0x3cdcdb[_0x7020('0xac')](_0x32629c);return _0x3cdcdb;});}function getInputList(_0x3124d3,_0x5a9e0f,_0x50dcc2,_0x1d0e7f,_0x210c61,_0x4581ba,_0x3bba40){var _0x62c72={'method':_0x7020('0x9f'),'uri':_0x3124d3+_0x7020('0xa4')+_0x210c61+_0x7020('0xba')+_0x4581ba+_0x7020('0xc6')+_0x50dcc2+_0x7020('0xc7'),'headers':{'Authorization':'Bearer\x20'+_0x3bba40,'If-None-Match':null,'OData-Version':_0x7020('0xa2')},'json':!![]};return rp(_0x62c72)[_0x7020('0x26')](function(_0x3047e2){var _0x5731bd={'id':_0x5a9e0f+'_'+_0x3047e2[_0x7020('0xa8')],'name':_0x3047e2[_0x7020('0xc0')][_0x7020('0xbf')]?_0x3047e2[_0x7020('0xc0')][_0x7020('0xbf')][_0x7020('0xbe')]:_0x3047e2[_0x7020('0xa8')],'custom':![],'options':[]};_0x1d0e7f[_0x7020('0xac')](_0x5731bd);return _0x1d0e7f;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 2c97c4d..25b889a 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 _0xa9e0=['define','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x335ca4,_0x463431){var _0x2669a0=function(_0x2608e5){while(--_0x2608e5){_0x335ca4['push'](_0x335ca4['shift']());}};_0x2669a0(++_0x463431);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'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'));var integrations=require(_0x0a9e('0x8'));module['exports']=function(_0x219af0,_0x441e3a){return _0x219af0[_0x0a9e('0x9')]('Dynamics365Account',attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['exports','Dynamics365Account','int_dynamics365_accounts','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x18b796,_0x13c92f){var _0x4697e1=function(_0x433442){while(--_0x433442){_0x18b796['push'](_0x18b796['shift']());}};_0x4697e1(++_0x13c92f);}(_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 diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index a947120..86a30d1 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 _0x7d99=['moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','limit','include','attributes','map','model','ShowDynamics365Account','find','lodash','util'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7d99,0x11e));var _0x97d9=function(_0x4a7c04,_0x234bed){_0x4a7c04=_0x4a7c04-0x0;var _0x29492c=_0x7d99[_0x4a7c04];return _0x29492c;};'use strict';var _=require(_0x97d9('0x0'));var util=require(_0x97d9('0x1'));var moment=require(_0x97d9('0x2'));var BPromise=require('bluebird');var rs=require(_0x97d9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x97d9('0x4'))['db'];var utils=require(_0x97d9('0x5'));var logger=require('../../config/logger')(_0x97d9('0x6'));var config=require(_0x97d9('0x7'));var jayson=require(_0x97d9('0x8'));var client=jayson[_0x97d9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa3d3f1,_0x5c024a,_0x2e9d86){return new BPromise(function(_0x1ae881,_0x202979){return client[_0x97d9('0xa')](_0xa3d3f1,_0x2e9d86)[_0x97d9('0xb')](function(_0x1b0c21){logger[_0x97d9('0xc')](_0x97d9('0xd'),_0x5c024a,_0x97d9('0xe'));logger[_0x97d9('0xf')](_0x97d9('0x10'),_0x5c024a,'request\x20sent',JSON[_0x97d9('0x11')](_0x1b0c21));if(_0x1b0c21[_0x97d9('0x12')]){if(_0x1b0c21[_0x97d9('0x12')][_0x97d9('0x13')]===0x1f4){logger['error'](_0x97d9('0xd'),_0x5c024a,_0x1b0c21[_0x97d9('0x12')][_0x97d9('0x14')]);return _0x202979(_0x1b0c21[_0x97d9('0x12')][_0x97d9('0x14')]);}logger['error'](_0x97d9('0xd'),_0x5c024a,_0x1b0c21[_0x97d9('0x12')][_0x97d9('0x14')]);return _0x1ae881(_0x1b0c21[_0x97d9('0x12')][_0x97d9('0x14')]);}else{logger[_0x97d9('0xc')]('Dynamics365Account,\x20%s,\x20%s',_0x5c024a,_0x97d9('0xe'));_0x1ae881(_0x1b0c21[_0x97d9('0x15')][_0x97d9('0x14')]);}})[_0x97d9('0x16')](function(_0x4cfb4b){logger[_0x97d9('0x12')](_0x97d9('0xd'),_0x5c024a,_0x4cfb4b);_0x202979(_0x4cfb4b);});});}exports[_0x97d9('0x17')]=function(_0x381408){var _0x3876ce=this;return new Promise(function(_0x1513f7,_0x21cf88){return db[_0x97d9('0x18')][_0x97d9('0x19')]({'raw':_0x381408[_0x97d9('0x1a')]?_0x381408[_0x97d9('0x1a')][_0x97d9('0x1b')]===undefined?!![]:![]:!![],'where':_0x381408[_0x97d9('0x1a')]?_0x381408[_0x97d9('0x1a')][_0x97d9('0x1c')]||null:null,'attributes':_0x381408[_0x97d9('0x1a')]?_0x381408['options']['attributes']||null:null,'limit':_0x381408[_0x97d9('0x1a')]?_0x381408[_0x97d9('0x1a')][_0x97d9('0x1d')]||null:null,'include':_0x381408[_0x97d9('0x1a')]?_0x381408[_0x97d9('0x1a')]['include']?_['map'](_0x381408[_0x97d9('0x1a')][_0x97d9('0x1e')],function(_0x5e9c3e){return{'model':db[_0x5e9c3e['model']],'as':_0x5e9c3e['as'],'attributes':_0x5e9c3e[_0x97d9('0x1f')],'include':_0x5e9c3e[_0x97d9('0x1e')]?_[_0x97d9('0x20')](_0x5e9c3e[_0x97d9('0x1e')],function(_0x243a5a){return{'model':db[_0x243a5a[_0x97d9('0x21')]],'as':_0x243a5a['as'],'attributes':_0x243a5a[_0x97d9('0x1f')],'include':_0x243a5a[_0x97d9('0x1e')]?_[_0x97d9('0x20')](_0x243a5a['include'],function(_0x3930a1){return{'model':db[_0x3930a1[_0x97d9('0x21')]],'as':_0x3930a1['as'],'attributes':_0x3930a1[_0x97d9('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x51b669){logger[_0x97d9('0xc')]('GetDynamics365Account',_0x381408);logger[_0x97d9('0xf')](_0x97d9('0x17'),_0x381408,JSON['stringify'](_0x51b669));_0x1513f7(_0x51b669);})['catch'](function(_0x3ca33a){logger[_0x97d9('0x12')](_0x97d9('0x17'),_0x3ca33a['message'],_0x381408);_0x21cf88(_0x3876ce[_0x97d9('0x12')](0x1f4,_0x3ca33a[_0x97d9('0x14')]));});});};exports[_0x97d9('0x22')]=function(_0x2535b5){var _0x5d5be3=this;return new Promise(function(_0x28c1bd,_0x59f3aa){return db[_0x97d9('0x18')][_0x97d9('0x23')]({'raw':_0x2535b5[_0x97d9('0x1a')]?_0x2535b5[_0x97d9('0x1a')][_0x97d9('0x1b')]===undefined?!![]:![]:!![],'where':_0x2535b5[_0x97d9('0x1a')]?_0x2535b5['options'][_0x97d9('0x1c')]||null:null,'attributes':_0x2535b5[_0x97d9('0x1a')]?_0x2535b5['options'][_0x97d9('0x1f')]||null:null,'include':_0x2535b5['options']?_0x2535b5[_0x97d9('0x1a')]['include']?_[_0x97d9('0x20')](_0x2535b5[_0x97d9('0x1a')][_0x97d9('0x1e')],function(_0x3b3bee){return{'model':db[_0x3b3bee[_0x97d9('0x21')]],'as':_0x3b3bee['as'],'attributes':_0x3b3bee[_0x97d9('0x1f')],'include':_0x3b3bee['include']?_['map'](_0x3b3bee[_0x97d9('0x1e')],function(_0x495e05){return{'model':db[_0x495e05[_0x97d9('0x21')]],'as':_0x495e05['as'],'attributes':_0x495e05['attributes'],'include':_0x495e05[_0x97d9('0x1e')]?_[_0x97d9('0x20')](_0x495e05[_0x97d9('0x1e')],function(_0x71403f){return{'model':db[_0x71403f[_0x97d9('0x21')]],'as':_0x71403f['as'],'attributes':_0x71403f[_0x97d9('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x97d9('0xb')](function(_0x10384d){logger[_0x97d9('0xc')](_0x97d9('0x22'),_0x2535b5);logger[_0x97d9('0xf')](_0x97d9('0x22'),_0x2535b5,JSON[_0x97d9('0x11')](_0x10384d));_0x28c1bd(_0x10384d);})[_0x97d9('0x16')](function(_0x4d29ca){logger[_0x97d9('0x12')](_0x97d9('0x22'),_0x4d29ca[_0x97d9('0x14')],_0x2535b5);_0x59f3aa(_0x5d5be3[_0x97d9('0x12')](0x1f4,_0x4d29ca['message']));});});}; \ No newline at end of file +var _0xa19f=['options','where','attributes','limit','include','map','model','then','GetDynamics365Account','ShowDynamics365Account','find','raw','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','Dynamics365Account','findAll'];(function(_0x3b266d,_0x2b9222){var _0x5f3dbb=function(_0x280b8e){while(--_0x280b8e){_0x3b266d['push'](_0x3b266d['shift']());}};_0x5f3dbb(++_0x2b9222);}(_0xa19f,0x75));var _0xfa19=function(_0x5002e3,_0x1e6bfb){_0x5002e3=_0x5002e3-0x0;var _0x3ec4a4=_0xa19f[_0x5002e3];return _0x3ec4a4;};'use strict';var _=require('lodash');var util=require(_0xfa19('0x0'));var moment=require(_0xfa19('0x1'));var BPromise=require(_0xfa19('0x2'));var rs=require(_0xfa19('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xfa19('0x4'));var logger=require(_0xfa19('0x5'))(_0xfa19('0x6'));var config=require(_0xfa19('0x7'));var jayson=require(_0xfa19('0x8'));var client=jayson[_0xfa19('0x9')][_0xfa19('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x39353e,_0x216e5a,_0x46d1bb){return new BPromise(function(_0x37157b,_0x386e7d){return client[_0xfa19('0xb')](_0x39353e,_0x46d1bb)['then'](function(_0x56dea1){logger[_0xfa19('0xc')](_0xfa19('0xd'),_0x216e5a,_0xfa19('0xe'));logger[_0xfa19('0xf')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x216e5a,_0xfa19('0xe'),JSON[_0xfa19('0x10')](_0x56dea1));if(_0x56dea1[_0xfa19('0x11')]){if(_0x56dea1[_0xfa19('0x11')]['code']===0x1f4){logger[_0xfa19('0x11')]('Dynamics365Account,\x20%s,\x20%s',_0x216e5a,_0x56dea1[_0xfa19('0x11')][_0xfa19('0x12')]);return _0x386e7d(_0x56dea1[_0xfa19('0x11')][_0xfa19('0x12')]);}logger[_0xfa19('0x11')]('Dynamics365Account,\x20%s,\x20%s',_0x216e5a,_0x56dea1['error']['message']);return _0x37157b(_0x56dea1[_0xfa19('0x11')][_0xfa19('0x12')]);}else{logger['info'](_0xfa19('0xd'),_0x216e5a,_0xfa19('0xe'));_0x37157b(_0x56dea1[_0xfa19('0x13')][_0xfa19('0x12')]);}})[_0xfa19('0x14')](function(_0x5cfd57){logger[_0xfa19('0x11')](_0xfa19('0xd'),_0x216e5a,_0x5cfd57);_0x386e7d(_0x5cfd57);});});}exports['GetDynamics365Account']=function(_0x178bdc){var _0x24ef94=this;return new Promise(function(_0x2c6e3c,_0x5b4fef){return db[_0xfa19('0x15')][_0xfa19('0x16')]({'raw':_0x178bdc[_0xfa19('0x17')]?_0x178bdc[_0xfa19('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x178bdc[_0xfa19('0x17')]?_0x178bdc[_0xfa19('0x17')][_0xfa19('0x18')]||null:null,'attributes':_0x178bdc[_0xfa19('0x17')]?_0x178bdc[_0xfa19('0x17')][_0xfa19('0x19')]||null:null,'limit':_0x178bdc['options']?_0x178bdc[_0xfa19('0x17')][_0xfa19('0x1a')]||null:null,'include':_0x178bdc[_0xfa19('0x17')]?_0x178bdc[_0xfa19('0x17')][_0xfa19('0x1b')]?_[_0xfa19('0x1c')](_0x178bdc[_0xfa19('0x17')]['include'],function(_0x3d4ba6){return{'model':db[_0x3d4ba6[_0xfa19('0x1d')]],'as':_0x3d4ba6['as'],'attributes':_0x3d4ba6['attributes'],'include':_0x3d4ba6['include']?_['map'](_0x3d4ba6[_0xfa19('0x1b')],function(_0xfce23c){return{'model':db[_0xfce23c['model']],'as':_0xfce23c['as'],'attributes':_0xfce23c[_0xfa19('0x19')],'include':_0xfce23c['include']?_[_0xfa19('0x1c')](_0xfce23c[_0xfa19('0x1b')],function(_0x3de647){return{'model':db[_0x3de647['model']],'as':_0x3de647['as'],'attributes':_0x3de647[_0xfa19('0x19')]};}):[]};}):[]};}):[]:[]})[_0xfa19('0x1e')](function(_0xd5ee8e){logger[_0xfa19('0xc')](_0xfa19('0x1f'),_0x178bdc);logger[_0xfa19('0xf')](_0xfa19('0x1f'),_0x178bdc,JSON[_0xfa19('0x10')](_0xd5ee8e));_0x2c6e3c(_0xd5ee8e);})[_0xfa19('0x14')](function(_0x4f2d51){logger[_0xfa19('0x11')](_0xfa19('0x1f'),_0x4f2d51[_0xfa19('0x12')],_0x178bdc);_0x5b4fef(_0x24ef94[_0xfa19('0x11')](0x1f4,_0x4f2d51[_0xfa19('0x12')]));});});};exports[_0xfa19('0x20')]=function(_0x43646a){var _0x58a609=this;return new Promise(function(_0x25c9d6,_0x399173){return db['Dynamics365Account'][_0xfa19('0x21')]({'raw':_0x43646a[_0xfa19('0x17')]?_0x43646a[_0xfa19('0x17')][_0xfa19('0x22')]===undefined?!![]:![]:!![],'where':_0x43646a[_0xfa19('0x17')]?_0x43646a[_0xfa19('0x17')]['where']||null:null,'attributes':_0x43646a[_0xfa19('0x17')]?_0x43646a['options']['attributes']||null:null,'include':_0x43646a[_0xfa19('0x17')]?_0x43646a[_0xfa19('0x17')][_0xfa19('0x1b')]?_[_0xfa19('0x1c')](_0x43646a[_0xfa19('0x17')][_0xfa19('0x1b')],function(_0x3abebe){return{'model':db[_0x3abebe[_0xfa19('0x1d')]],'as':_0x3abebe['as'],'attributes':_0x3abebe[_0xfa19('0x19')],'include':_0x3abebe['include']?_['map'](_0x3abebe[_0xfa19('0x1b')],function(_0x2970c8){return{'model':db[_0x2970c8[_0xfa19('0x1d')]],'as':_0x2970c8['as'],'attributes':_0x2970c8['attributes'],'include':_0x2970c8[_0xfa19('0x1b')]?_[_0xfa19('0x1c')](_0x2970c8[_0xfa19('0x1b')],function(_0x3ec88f){return{'model':db[_0x3ec88f['model']],'as':_0x3ec88f['as'],'attributes':_0x3ec88f[_0xfa19('0x19')]};}):[]};}):[]};}):[]:[]})[_0xfa19('0x1e')](function(_0x4e36c2){logger[_0xfa19('0xc')](_0xfa19('0x20'),_0x43646a);logger['debug'](_0xfa19('0x20'),_0x43646a,JSON['stringify'](_0x4e36c2));_0x25c9d6(_0x4e36c2);})[_0xfa19('0x14')](function(_0x52b548){logger['error']('ShowDynamics365Account',_0x52b548[_0xfa19('0x12')],_0x43646a);_0x399173(_0x58a609[_0xfa19('0x11')](0x1f4,_0x52b548['message']));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index cd22423..9cb6299 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 _0x0419=['Router','fs-extra','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','/:id','/:id/fields','getSubjects','getDescriptions','post','put','update','delete','destroy','exports','path','connect-timeout','express'];(function(_0x11a0e0,_0x35ae97){var _0x438e51=function(_0x12b5e2){while(--_0x12b5e2){_0x11a0e0['push'](_0x11a0e0['shift']());}};_0x438e51(++_0x35ae97);}(_0x0419,0x153));var _0x9041=function(_0x1b2255,_0x3de34f){_0x1b2255=_0x1b2255-0x0;var _0x33e57d=_0x0419[_0x1b2255];return _0x33e57d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9041('0x0'));var timeout=require(_0x9041('0x1'));var express=require(_0x9041('0x2'));var router=express[_0x9041('0x3')]();var fs_extra=require(_0x9041('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9041('0x5'));var controller=require(_0x9041('0x6'));router[_0x9041('0x7')]('/',auth[_0x9041('0x8')](),controller['index']);router[_0x9041('0x7')](_0x9041('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x9041('0x7')](_0x9041('0xa'),auth[_0x9041('0x8')](),controller['getFields']);router[_0x9041('0x7')]('/:id/subjects',auth[_0x9041('0x8')](),controller[_0x9041('0xb')]);router[_0x9041('0x7')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x9041('0xc')]);router[_0x9041('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9041('0xe')](_0x9041('0x9'),auth[_0x9041('0x8')](),controller[_0x9041('0xf')]);router[_0x9041('0x10')](_0x9041('0x9'),auth[_0x9041('0x8')](),controller[_0x9041('0x11')]);module[_0x9041('0x12')]=router; \ No newline at end of file +var _0x6a19=['/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','/:id'];(function(_0x2207c3,_0x539938){var _0x35ae9a=function(_0x43bb67){while(--_0x43bb67){_0x2207c3['push'](_0x2207c3['shift']());}};_0x35ae9a(++_0x539938);}(_0x6a19,0x144));var _0x96a1=function(_0x5b9b45,_0x457eb3){_0x5b9b45=_0x5b9b45-0x0;var _0x3bdb18=_0x6a19[_0x5b9b45];return _0x3bdb18;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x96a1('0x0'));var timeout=require(_0x96a1('0x1'));var express=require(_0x96a1('0x2'));var router=express[_0x96a1('0x3')]();var fs_extra=require(_0x96a1('0x4'));var auth=require(_0x96a1('0x5'));var interaction=require(_0x96a1('0x6'));var config=require(_0x96a1('0x7'));var controller=require(_0x96a1('0x8'));router[_0x96a1('0x9')]('/',auth[_0x96a1('0xa')](),controller['index']);router['get'](_0x96a1('0xb'),auth[_0x96a1('0xa')](),controller['show']);router[_0x96a1('0x9')](_0x96a1('0xc'),auth[_0x96a1('0xa')](),controller[_0x96a1('0xd')]);router['get'](_0x96a1('0xe'),auth['isAuthenticated'](),controller[_0x96a1('0xf')]);router['get'](_0x96a1('0x10'),auth['isAuthenticated'](),controller[_0x96a1('0x11')]);router[_0x96a1('0x12')]('/',auth['isAuthenticated'](),controller[_0x96a1('0x13')]);router[_0x96a1('0x14')](_0x96a1('0xb'),auth[_0x96a1('0xa')](),controller[_0x96a1('0x15')]);router[_0x96a1('0x16')](_0x96a1('0xb'),auth[_0x96a1('0xa')](),controller['destroy']);module[_0x96a1('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 652934b..fbc32df 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 _0x257e=['exports','incident','sequelize'];(function(_0x2dcac7,_0x48f2b4){var _0x1c81d7=function(_0x16b07f){while(--_0x16b07f){_0x2dcac7['push'](_0x2dcac7['shift']());}};_0x1c81d7(++_0x48f2b4);}(_0x257e,0x16d));var _0xe257=function(_0x1b70e3,_0x3a15b1){_0x1b70e3=_0x1b70e3-0x0;var _0x1452ab=_0x257e[_0x1b70e3];return _0x1452ab;};'use strict';var Sequelize=require(_0xe257('0x0'));module[_0xe257('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0xe257('0x2'),'phonecall'),'defaultValue':_0xe257('0x2')}}; \ No newline at end of file +var _0xf8d1=['exports','STRING','ENUM','incident','phonecall'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xf8d1,0x190));var _0x1f8d=function(_0x812c88,_0x4c3ede){_0x812c88=_0x812c88-0x0;var _0x48b853=_0xf8d1[_0x812c88];return _0x48b853;};'use strict';var Sequelize=require('sequelize');module[_0x1f8d('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1f8d('0x1')]},'ticketType':{'type':Sequelize[_0x1f8d('0x2')](_0x1f8d('0x3'),_0x1f8d('0x4')),'defaultValue':'incident'}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 294aab9..850a406 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 _0x4d74=['json','apply','reject','save','update','then','destroy','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','find','body','getFields','findOne','sort','hasOwnProperty','getSubjects','Dynamics365Field','order','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x4d74,0x123));var _0x44d7=function(_0x201d73,_0x2a916b){_0x201d73=_0x201d73-0x0;var _0x5673e1=_0x4d74[_0x201d73];return _0x5673e1;};'use strict';var emlformat=require(_0x44d7('0x0'));var rimraf=require(_0x44d7('0x1'));var zipdir=require(_0x44d7('0x2'));var jsonpatch=require(_0x44d7('0x3'));var rp=require(_0x44d7('0x4'));var moment=require(_0x44d7('0x5'));var BPromise=require(_0x44d7('0x6'));var Mustache=require(_0x44d7('0x7'));var util=require(_0x44d7('0x8'));var path=require(_0x44d7('0x9'));var sox=require(_0x44d7('0xa'));var csv=require('to-csv');var ejs=require(_0x44d7('0xb'));var fs=require('fs');var fs_extra=require(_0x44d7('0xc'));var _=require('lodash');var squel=require(_0x44d7('0xd'));var crypto=require(_0x44d7('0xe'));var jsforce=require(_0x44d7('0xf'));var deskjs=require(_0x44d7('0x10'));var toCsv=require(_0x44d7('0x11'));var querystring=require(_0x44d7('0x12'));var Papa=require(_0x44d7('0x13'));var Redis=require(_0x44d7('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x44d7('0x15'));var as=require(_0x44d7('0x16'));var hardwareService=require(_0x44d7('0x17'));var logger=require(_0x44d7('0x18'))('api');var utils=require(_0x44d7('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x44d7('0x1a'));var db=require(_0x44d7('0x1b'))['db'];function respondWithStatusCode(_0x2f41d8,_0x176369){_0x176369=_0x176369||0xcc;return function(_0x779ea9){if(_0x779ea9){return _0x2f41d8[_0x44d7('0x1c')](_0x176369);}return _0x2f41d8[_0x44d7('0x1d')](_0x176369)[_0x44d7('0x1e')]();};}function respondWithResult(_0x15493c,_0x521a0e){_0x521a0e=_0x521a0e||0xc8;return function(_0x371100){if(_0x371100){return _0x15493c[_0x44d7('0x1d')](_0x521a0e)['json'](_0x371100);}};}function respondWithFilteredResult(_0x477eb3,_0x1ea4ad){return function(_0x2b527a){if(_0x2b527a){var _0x4314ba=typeof _0x1ea4ad[_0x44d7('0x1f')]===_0x44d7('0x20')&&typeof _0x1ea4ad[_0x44d7('0x21')]===_0x44d7('0x20');var _0x5740d2=_0x2b527a[_0x44d7('0x22')];var _0x51ecd8=_0x4314ba?0x0:_0x1ea4ad[_0x44d7('0x1f')];var _0x4d06c6=_0x4314ba?_0x2b527a[_0x44d7('0x22')]:_0x1ea4ad[_0x44d7('0x1f')]+_0x1ea4ad['limit'];var _0x4d08e4;if(_0x4d06c6>=_0x5740d2){_0x4d06c6=_0x5740d2;_0x4d08e4=0xc8;}else{_0x4d08e4=0xce;}_0x477eb3[_0x44d7('0x1d')](_0x4d08e4);return _0x477eb3[_0x44d7('0x23')](_0x44d7('0x24'),_0x51ecd8+'-'+_0x4d06c6+'/'+_0x5740d2)[_0x44d7('0x25')](_0x2b527a);}return null;};}function patchUpdates(_0x250645){return function(_0x4b2658){try{jsonpatch[_0x44d7('0x26')](_0x4b2658,_0x250645,!![]);}catch(_0x17caa7){return BPromise[_0x44d7('0x27')](_0x17caa7);}return _0x4b2658[_0x44d7('0x28')]();};}function saveUpdates(_0x15ba41,_0x35faa1){return function(_0xa3f676){if(_0xa3f676){return _0xa3f676[_0x44d7('0x29')](_0x15ba41)[_0x44d7('0x2a')](function(_0x264500){return _0x264500;});}return null;};}function removeEntity(_0x5de6b1,_0x1072f0){return function(_0x420708){if(_0x420708){return _0x420708[_0x44d7('0x2b')]()[_0x44d7('0x2a')](function(){_0x5de6b1[_0x44d7('0x1d')](0xcc)[_0x44d7('0x1e')]();});}};}function handleEntityNotFound(_0x4f7b20,_0x44d4b0){return function(_0x29c07d){if(!_0x29c07d){_0x4f7b20[_0x44d7('0x1c')](0x194);}return _0x29c07d;};}function handleError(_0x50c7f8,_0x3ada8f){_0x3ada8f=_0x3ada8f||0x1f4;return function(_0x465d3c){logger['error'](_0x465d3c['stack']);if(_0x465d3c[_0x44d7('0x2c')]){delete _0x465d3c[_0x44d7('0x2c')];}_0x50c7f8['status'](_0x3ada8f)[_0x44d7('0x2d')](_0x465d3c);};}exports[_0x44d7('0x2e')]=function(_0x451577,_0x21a184){var _0x1684eb={},_0x53eed0={},_0x3a8d5a={'count':0x0,'rows':[]};var _0x567e01=_[_0x44d7('0x2f')](db[_0x44d7('0x30')][_0x44d7('0x31')],function(_0x17bead){return{'name':_0x17bead[_0x44d7('0x32')],'type':_0x17bead[_0x44d7('0x33')]['key']};});_0x53eed0[_0x44d7('0x34')]=_[_0x44d7('0x2f')](_0x567e01,_0x44d7('0x2c'));_0x53eed0[_0x44d7('0x35')]=_[_0x44d7('0x36')](_0x451577['query']);_0x53eed0[_0x44d7('0x37')]=_[_0x44d7('0x38')](_0x53eed0[_0x44d7('0x34')],_0x53eed0['query']);_0x1684eb[_0x44d7('0x39')]=_[_0x44d7('0x38')](_0x53eed0['model'],qs[_0x44d7('0x3a')](_0x451577[_0x44d7('0x35')][_0x44d7('0x3a')]));_0x1684eb[_0x44d7('0x39')]=_0x1684eb['attributes'][_0x44d7('0x3b')]?_0x1684eb[_0x44d7('0x39')]:_0x53eed0[_0x44d7('0x34')];if(!_0x451577[_0x44d7('0x35')]['hasOwnProperty'](_0x44d7('0x3c'))){_0x1684eb[_0x44d7('0x21')]=qs[_0x44d7('0x21')](_0x451577['query'][_0x44d7('0x21')]);_0x1684eb[_0x44d7('0x1f')]=qs[_0x44d7('0x1f')](_0x451577['query'][_0x44d7('0x1f')]);}_0x1684eb['order']=qs['sort'](_0x451577[_0x44d7('0x35')]['sort']);_0x1684eb[_0x44d7('0x3d')]=qs[_0x44d7('0x37')](_[_0x44d7('0x3e')](_0x451577['query'],_0x53eed0['filters']),_0x567e01);if(_0x451577['query'][_0x44d7('0x3f')]){_0x1684eb[_0x44d7('0x3d')]=_[_0x44d7('0x40')](_0x1684eb[_0x44d7('0x3d')],{'$or':_[_0x44d7('0x2f')](_0x567e01,function(_0x275303){if(_0x275303[_0x44d7('0x33')]!==_0x44d7('0x41')){var _0x232b9d={};_0x232b9d[_0x275303[_0x44d7('0x2c')]]={'$like':'%'+_0x451577[_0x44d7('0x35')]['filter']+'%'};return _0x232b9d;}})});}_0x1684eb=_[_0x44d7('0x40')]({},_0x1684eb,_0x451577[_0x44d7('0x42')]);var _0x2e7135={'where':_0x1684eb[_0x44d7('0x3d')]};return db[_0x44d7('0x30')]['count'](_0x2e7135)[_0x44d7('0x2a')](function(_0x1435b6){_0x3a8d5a['count']=_0x1435b6;if(_0x451577[_0x44d7('0x35')][_0x44d7('0x43')]){_0x1684eb[_0x44d7('0x44')]=[{'all':!![]}];}return db[_0x44d7('0x30')]['findAll'](_0x1684eb);})[_0x44d7('0x2a')](function(_0x8fb38){_0x3a8d5a[_0x44d7('0x45')]=_0x8fb38;return _0x3a8d5a;})[_0x44d7('0x2a')](respondWithFilteredResult(_0x21a184,_0x1684eb))[_0x44d7('0x46')](handleError(_0x21a184,null));};exports['show']=function(_0xf10a4,_0x2a8cb7){var _0x57ea85={'raw':![],'where':{'id':_0xf10a4[_0x44d7('0x47')]['id']}},_0x54759f={};_0x54759f[_0x44d7('0x34')]=_[_0x44d7('0x36')](db['Dynamics365Configuration'][_0x44d7('0x31')]);_0x54759f[_0x44d7('0x35')]=_[_0x44d7('0x36')](_0xf10a4[_0x44d7('0x35')]);_0x54759f[_0x44d7('0x37')]=_['intersection'](_0x54759f['model'],_0x54759f[_0x44d7('0x35')]);_0x57ea85['attributes']=_[_0x44d7('0x38')](_0x54759f['model'],qs[_0x44d7('0x3a')](_0xf10a4['query']['fields']));_0x57ea85[_0x44d7('0x39')]=_0x57ea85[_0x44d7('0x39')][_0x44d7('0x3b')]?_0x57ea85[_0x44d7('0x39')]:_0x54759f[_0x44d7('0x34')];if(_0xf10a4[_0x44d7('0x35')]['includeAll']){_0x57ea85[_0x44d7('0x44')]=[{'all':!![]}];}_0x57ea85=_[_0x44d7('0x40')]({},_0x57ea85,_0xf10a4[_0x44d7('0x42')]);return db[_0x44d7('0x30')][_0x44d7('0x48')](_0x57ea85)[_0x44d7('0x2a')](handleEntityNotFound(_0x2a8cb7,null))['then'](respondWithResult(_0x2a8cb7,null))[_0x44d7('0x46')](handleError(_0x2a8cb7,null));};exports['create']=function(_0x2a20fe,_0x2498ae){return db[_0x44d7('0x30')]['create'](_0x2a20fe[_0x44d7('0x49')],{})[_0x44d7('0x2a')](respondWithResult(_0x2498ae,0xc9))[_0x44d7('0x46')](handleError(_0x2498ae,null));};exports[_0x44d7('0x29')]=function(_0x3c76f9,_0x534c49){if(_0x3c76f9['body']['id']){delete _0x3c76f9[_0x44d7('0x49')]['id'];}return db['Dynamics365Configuration'][_0x44d7('0x48')]({'where':{'id':_0x3c76f9['params']['id']}})[_0x44d7('0x2a')](handleEntityNotFound(_0x534c49,null))[_0x44d7('0x2a')](saveUpdates(_0x3c76f9[_0x44d7('0x49')],null))[_0x44d7('0x2a')](respondWithResult(_0x534c49,null))[_0x44d7('0x46')](handleError(_0x534c49,null));};exports[_0x44d7('0x2b')]=function(_0x345a97,_0x2cf384){return db[_0x44d7('0x30')][_0x44d7('0x48')]({'where':{'id':_0x345a97[_0x44d7('0x47')]['id']}})['then'](handleEntityNotFound(_0x2cf384,null))['then'](removeEntity(_0x2cf384,null))[_0x44d7('0x46')](handleError(_0x2cf384,null));};exports[_0x44d7('0x4a')]=function(_0x4d52f9,_0x16689a,_0x264f3d){var _0x1552d8={};var _0x1fab77={};var _0x1df281;var _0x3fb370;return db[_0x44d7('0x30')][_0x44d7('0x4b')]({'where':{'id':_0x4d52f9[_0x44d7('0x47')]['id']}})[_0x44d7('0x2a')](handleEntityNotFound(_0x16689a,null))[_0x44d7('0x2a')](function(_0x4844d1){if(_0x4844d1){_0x1df281=_0x4844d1;_0x1fab77[_0x44d7('0x34')]=_[_0x44d7('0x36')](db['Dynamics365Field']['rawAttributes']);_0x1fab77[_0x44d7('0x35')]=_[_0x44d7('0x36')](_0x4d52f9['query']);_0x1fab77[_0x44d7('0x37')]=_[_0x44d7('0x38')](_0x1fab77[_0x44d7('0x34')],_0x1fab77[_0x44d7('0x35')]);_0x1552d8[_0x44d7('0x39')]=_[_0x44d7('0x38')](_0x1fab77[_0x44d7('0x34')],qs[_0x44d7('0x3a')](_0x4d52f9[_0x44d7('0x35')][_0x44d7('0x3a')]));_0x1552d8[_0x44d7('0x39')]=_0x1552d8[_0x44d7('0x39')][_0x44d7('0x3b')]?_0x1552d8[_0x44d7('0x39')]:_0x1fab77[_0x44d7('0x34')];_0x1552d8['order']=qs[_0x44d7('0x4c')](_0x4d52f9['query'][_0x44d7('0x4c')]);_0x1552d8[_0x44d7('0x3d')]=qs['filters'](_[_0x44d7('0x3e')](_0x4d52f9['query'],_0x1fab77[_0x44d7('0x37')]));if(_0x4d52f9[_0x44d7('0x35')][_0x44d7('0x3f')]){_0x1552d8['where']=_[_0x44d7('0x40')](_0x1552d8[_0x44d7('0x3d')],{'$or':_[_0x44d7('0x2f')](_0x1552d8[_0x44d7('0x39')],function(_0x2089b7){var _0x547df1={};_0x547df1[_0x2089b7]={'$like':'%'+_0x4d52f9[_0x44d7('0x35')][_0x44d7('0x3f')]+'%'};return _0x547df1;})});}_0x1552d8=_[_0x44d7('0x40')]({},_0x1552d8,_0x4d52f9[_0x44d7('0x42')]);return _0x1df281[_0x44d7('0x4a')](_0x1552d8);}})[_0x44d7('0x2a')](function(_0xaf7938){if(_0xaf7938){_0x3fb370=_0xaf7938['length'];if(!_0x4d52f9[_0x44d7('0x35')][_0x44d7('0x4d')](_0x44d7('0x3c'))){_0x1552d8[_0x44d7('0x21')]=qs[_0x44d7('0x21')](_0x4d52f9['query']['limit']);_0x1552d8[_0x44d7('0x1f')]=qs['offset'](_0x4d52f9[_0x44d7('0x35')][_0x44d7('0x1f')]);}return _0x1df281[_0x44d7('0x4a')](_0x1552d8);}})[_0x44d7('0x2a')](function(_0x20df7){if(_0x20df7){return _0x20df7?{'count':_0x3fb370,'rows':_0x20df7}:null;}})[_0x44d7('0x2a')](respondWithResult(_0x16689a,null))['catch'](handleError(_0x16689a,null));};exports[_0x44d7('0x4e')]=function(_0x161abb,_0x82c457,_0x256b66){var _0x4f0798={};var _0x5135cc={};var _0x2b5caf;var _0x31e72b;return db['Dynamics365Configuration'][_0x44d7('0x4b')]({'where':{'id':_0x161abb['params']['id']}})[_0x44d7('0x2a')](handleEntityNotFound(_0x82c457,null))[_0x44d7('0x2a')](function(_0x2b9374){if(_0x2b9374){_0x2b5caf=_0x2b9374;_0x5135cc[_0x44d7('0x34')]=_[_0x44d7('0x36')](db[_0x44d7('0x4f')][_0x44d7('0x31')]);_0x5135cc['query']=_[_0x44d7('0x36')](_0x161abb[_0x44d7('0x35')]);_0x5135cc['filters']=_[_0x44d7('0x38')](_0x5135cc['model'],_0x5135cc['query']);_0x4f0798['attributes']=_[_0x44d7('0x38')](_0x5135cc[_0x44d7('0x34')],qs[_0x44d7('0x3a')](_0x161abb[_0x44d7('0x35')][_0x44d7('0x3a')]));_0x4f0798[_0x44d7('0x39')]=_0x4f0798[_0x44d7('0x39')]['length']?_0x4f0798[_0x44d7('0x39')]:_0x5135cc[_0x44d7('0x34')];_0x4f0798[_0x44d7('0x50')]=qs[_0x44d7('0x4c')](_0x161abb[_0x44d7('0x35')][_0x44d7('0x4c')]);_0x4f0798['where']=qs[_0x44d7('0x37')](_[_0x44d7('0x3e')](_0x161abb[_0x44d7('0x35')],_0x5135cc[_0x44d7('0x37')]));if(_0x161abb[_0x44d7('0x35')]['filter']){_0x4f0798['where']=_[_0x44d7('0x40')](_0x4f0798[_0x44d7('0x3d')],{'$or':_[_0x44d7('0x2f')](_0x4f0798['attributes'],function(_0x46f197){var _0x251934={};_0x251934[_0x46f197]={'$like':'%'+_0x161abb[_0x44d7('0x35')]['filter']+'%'};return _0x251934;})});}_0x4f0798=_['merge']({},_0x4f0798,_0x161abb[_0x44d7('0x42')]);return _0x2b5caf['getSubjects'](_0x4f0798);}})[_0x44d7('0x2a')](function(_0x5aee6c){if(_0x5aee6c){_0x31e72b=_0x5aee6c[_0x44d7('0x3b')];if(!_0x161abb[_0x44d7('0x35')][_0x44d7('0x4d')](_0x44d7('0x3c'))){_0x4f0798['limit']=qs[_0x44d7('0x21')](_0x161abb['query'][_0x44d7('0x21')]);_0x4f0798[_0x44d7('0x1f')]=qs['offset'](_0x161abb[_0x44d7('0x35')]['offset']);}return _0x2b5caf[_0x44d7('0x4e')](_0x4f0798);}})[_0x44d7('0x2a')](function(_0x42c39e){if(_0x42c39e){return _0x42c39e?{'count':_0x31e72b,'rows':_0x42c39e}:null;}})[_0x44d7('0x2a')](respondWithResult(_0x82c457,null))[_0x44d7('0x46')](handleError(_0x82c457,null));};exports[_0x44d7('0x51')]=function(_0x25a7c0,_0x41cc21,_0x343f67){var _0x1c5bd2={};var _0x1b8efd={};var _0x3f4141;var _0x2e0f0b;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x25a7c0[_0x44d7('0x47')]['id']}})['then'](handleEntityNotFound(_0x41cc21,null))[_0x44d7('0x2a')](function(_0x1b3802){if(_0x1b3802){_0x3f4141=_0x1b3802;_0x1b8efd[_0x44d7('0x34')]=_['keys'](db[_0x44d7('0x4f')][_0x44d7('0x31')]);_0x1b8efd['query']=_['keys'](_0x25a7c0['query']);_0x1b8efd[_0x44d7('0x37')]=_[_0x44d7('0x38')](_0x1b8efd['model'],_0x1b8efd[_0x44d7('0x35')]);_0x1c5bd2['attributes']=_[_0x44d7('0x38')](_0x1b8efd[_0x44d7('0x34')],qs[_0x44d7('0x3a')](_0x25a7c0[_0x44d7('0x35')][_0x44d7('0x3a')]));_0x1c5bd2[_0x44d7('0x39')]=_0x1c5bd2[_0x44d7('0x39')][_0x44d7('0x3b')]?_0x1c5bd2[_0x44d7('0x39')]:_0x1b8efd['model'];_0x1c5bd2[_0x44d7('0x50')]=qs[_0x44d7('0x4c')](_0x25a7c0[_0x44d7('0x35')]['sort']);_0x1c5bd2[_0x44d7('0x3d')]=qs[_0x44d7('0x37')](_[_0x44d7('0x3e')](_0x25a7c0['query'],_0x1b8efd['filters']));if(_0x25a7c0['query'][_0x44d7('0x3f')]){_0x1c5bd2[_0x44d7('0x3d')]=_[_0x44d7('0x40')](_0x1c5bd2[_0x44d7('0x3d')],{'$or':_[_0x44d7('0x2f')](_0x1c5bd2['attributes'],function(_0x508f96){var _0x258add={};_0x258add[_0x508f96]={'$like':'%'+_0x25a7c0[_0x44d7('0x35')][_0x44d7('0x3f')]+'%'};return _0x258add;})});}_0x1c5bd2=_['merge']({},_0x1c5bd2,_0x25a7c0[_0x44d7('0x42')]);return _0x3f4141[_0x44d7('0x51')](_0x1c5bd2);}})[_0x44d7('0x2a')](function(_0x22fee5){if(_0x22fee5){_0x2e0f0b=_0x22fee5['length'];if(!_0x25a7c0['query']['hasOwnProperty'](_0x44d7('0x3c'))){_0x1c5bd2[_0x44d7('0x21')]=qs[_0x44d7('0x21')](_0x25a7c0[_0x44d7('0x35')][_0x44d7('0x21')]);_0x1c5bd2[_0x44d7('0x1f')]=qs[_0x44d7('0x1f')](_0x25a7c0[_0x44d7('0x35')][_0x44d7('0x1f')]);}return _0x3f4141[_0x44d7('0x51')](_0x1c5bd2);}})[_0x44d7('0x2a')](function(_0x3dd4bc){if(_0x3dd4bc){return _0x3dd4bc?{'count':_0x2e0f0b,'rows':_0x3dd4bc}:null;}})[_0x44d7('0x2a')](respondWithResult(_0x41cc21,null))[_0x44d7('0x46')](handleError(_0x41cc21,null));}; \ No newline at end of file +var _0x6e0a=['crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','update','destroy','then','error','stack','name','index','map','Dynamics365Configuration','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','include','catch','show','params','rawAttributes','find','create','body','getFields','findOne','order','pick','Dynamics365Field','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel'];(function(_0x143274,_0x3cdcb0){var _0x281aa5=function(_0x194e90){while(--_0x194e90){_0x143274['push'](_0x143274['shift']());}};_0x281aa5(++_0x3cdcb0);}(_0x6e0a,0x175));var _0xa6e0=function(_0x206453,_0x46c9ec){_0x206453=_0x206453-0x0;var _0xcde5a9=_0x6e0a[_0x206453];return _0xcde5a9;};'use strict';var emlformat=require(_0xa6e0('0x0'));var rimraf=require(_0xa6e0('0x1'));var zipdir=require(_0xa6e0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa6e0('0x3'));var moment=require('moment');var BPromise=require(_0xa6e0('0x4'));var Mustache=require('mustache');var util=require(_0xa6e0('0x5'));var path=require(_0xa6e0('0x6'));var sox=require(_0xa6e0('0x7'));var csv=require(_0xa6e0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa6e0('0x9'));var _=require(_0xa6e0('0xa'));var squel=require(_0xa6e0('0xb'));var crypto=require(_0xa6e0('0xc'));var jsforce=require(_0xa6e0('0xd'));var deskjs=require(_0xa6e0('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa6e0('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa6e0('0x10'));var qs=require(_0xa6e0('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa6e0('0x12'));var logger=require(_0xa6e0('0x13'))(_0xa6e0('0x14'));var utils=require(_0xa6e0('0x15'));var config=require(_0xa6e0('0x16'));var licenseUtil=require(_0xa6e0('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ff918,_0x337cf6){_0x337cf6=_0x337cf6||0xcc;return function(_0x1e3911){if(_0x1e3911){return _0x1ff918[_0xa6e0('0x18')](_0x337cf6);}return _0x1ff918[_0xa6e0('0x19')](_0x337cf6)[_0xa6e0('0x1a')]();};}function respondWithResult(_0x26e8eb,_0x576359){_0x576359=_0x576359||0xc8;return function(_0x19bfd2){if(_0x19bfd2){return _0x26e8eb['status'](_0x576359)['json'](_0x19bfd2);}};}function respondWithFilteredResult(_0x2fcb9e,_0x323530){return function(_0x349252){if(_0x349252){var _0x470a34=typeof _0x323530[_0xa6e0('0x1b')]===_0xa6e0('0x1c')&&typeof _0x323530[_0xa6e0('0x1d')]===_0xa6e0('0x1c');var _0x2675bd=_0x349252[_0xa6e0('0x1e')];var _0x4368a2=_0x470a34?0x0:_0x323530[_0xa6e0('0x1b')];var _0x6e4d30=_0x470a34?_0x349252['count']:_0x323530[_0xa6e0('0x1b')]+_0x323530['limit'];var _0x216b22;if(_0x6e4d30>=_0x2675bd){_0x6e4d30=_0x2675bd;_0x216b22=0xc8;}else{_0x216b22=0xce;}_0x2fcb9e[_0xa6e0('0x19')](_0x216b22);return _0x2fcb9e['set'](_0xa6e0('0x1f'),_0x4368a2+'-'+_0x6e4d30+'/'+_0x2675bd)['json'](_0x349252);}return null;};}function patchUpdates(_0x46b3fc){return function(_0x520e19){try{jsonpatch[_0xa6e0('0x20')](_0x520e19,_0x46b3fc,!![]);}catch(_0x57b80){return BPromise['reject'](_0x57b80);}return _0x520e19['save']();};}function saveUpdates(_0x123505,_0x1119ca){return function(_0x17ee0b){if(_0x17ee0b){return _0x17ee0b[_0xa6e0('0x21')](_0x123505)['then'](function(_0x95c169){return _0x95c169;});}return null;};}function removeEntity(_0x45bbf3,_0x472e78){return function(_0x126002){if(_0x126002){return _0x126002[_0xa6e0('0x22')]()[_0xa6e0('0x23')](function(){_0x45bbf3[_0xa6e0('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49307a,_0x7e702b){return function(_0x22cac1){if(!_0x22cac1){_0x49307a[_0xa6e0('0x18')](0x194);}return _0x22cac1;};}function handleError(_0x1a9b63,_0x155c92){_0x155c92=_0x155c92||0x1f4;return function(_0x285ed4){logger[_0xa6e0('0x24')](_0x285ed4[_0xa6e0('0x25')]);if(_0x285ed4[_0xa6e0('0x26')]){delete _0x285ed4[_0xa6e0('0x26')];}_0x1a9b63[_0xa6e0('0x19')](_0x155c92)['send'](_0x285ed4);};}exports[_0xa6e0('0x27')]=function(_0x2aba65,_0x1a362e){var _0x7fb66b={},_0x48d66d={},_0x4ca093={'count':0x0,'rows':[]};var _0x5737d3=_[_0xa6e0('0x28')](db[_0xa6e0('0x29')]['rawAttributes'],function(_0x448d6e){return{'name':_0x448d6e[_0xa6e0('0x2a')],'type':_0x448d6e['type'][_0xa6e0('0x2b')]};});_0x48d66d[_0xa6e0('0x2c')]=_[_0xa6e0('0x28')](_0x5737d3,'name');_0x48d66d[_0xa6e0('0x2d')]=_[_0xa6e0('0x2e')](_0x2aba65['query']);_0x48d66d['filters']=_[_0xa6e0('0x2f')](_0x48d66d[_0xa6e0('0x2c')],_0x48d66d[_0xa6e0('0x2d')]);_0x7fb66b[_0xa6e0('0x30')]=_[_0xa6e0('0x2f')](_0x48d66d[_0xa6e0('0x2c')],qs[_0xa6e0('0x31')](_0x2aba65['query'][_0xa6e0('0x31')]));_0x7fb66b['attributes']=_0x7fb66b['attributes'][_0xa6e0('0x32')]?_0x7fb66b[_0xa6e0('0x30')]:_0x48d66d[_0xa6e0('0x2c')];if(!_0x2aba65[_0xa6e0('0x2d')][_0xa6e0('0x33')](_0xa6e0('0x34'))){_0x7fb66b[_0xa6e0('0x1d')]=qs[_0xa6e0('0x1d')](_0x2aba65[_0xa6e0('0x2d')][_0xa6e0('0x1d')]);_0x7fb66b['offset']=qs[_0xa6e0('0x1b')](_0x2aba65[_0xa6e0('0x2d')][_0xa6e0('0x1b')]);}_0x7fb66b['order']=qs[_0xa6e0('0x35')](_0x2aba65['query'][_0xa6e0('0x35')]);_0x7fb66b[_0xa6e0('0x36')]=qs[_0xa6e0('0x37')](_['pick'](_0x2aba65['query'],_0x48d66d['filters']),_0x5737d3);if(_0x2aba65[_0xa6e0('0x2d')][_0xa6e0('0x38')]){_0x7fb66b[_0xa6e0('0x36')]=_[_0xa6e0('0x39')](_0x7fb66b[_0xa6e0('0x36')],{'$or':_[_0xa6e0('0x28')](_0x5737d3,function(_0x5abad9){if(_0x5abad9[_0xa6e0('0x3a')]!==_0xa6e0('0x3b')){var _0x258886={};_0x258886[_0x5abad9[_0xa6e0('0x26')]]={'$like':'%'+_0x2aba65['query'][_0xa6e0('0x38')]+'%'};return _0x258886;}})});}_0x7fb66b=_[_0xa6e0('0x39')]({},_0x7fb66b,_0x2aba65[_0xa6e0('0x3c')]);var _0x465afd={'where':_0x7fb66b[_0xa6e0('0x36')]};return db[_0xa6e0('0x29')]['count'](_0x465afd)[_0xa6e0('0x23')](function(_0x54663a){_0x4ca093[_0xa6e0('0x1e')]=_0x54663a;if(_0x2aba65[_0xa6e0('0x2d')][_0xa6e0('0x3d')]){_0x7fb66b[_0xa6e0('0x3e')]=[{'all':!![]}];}return db[_0xa6e0('0x29')]['findAll'](_0x7fb66b);})[_0xa6e0('0x23')](function(_0x14c287){_0x4ca093['rows']=_0x14c287;return _0x4ca093;})['then'](respondWithFilteredResult(_0x1a362e,_0x7fb66b))[_0xa6e0('0x3f')](handleError(_0x1a362e,null));};exports[_0xa6e0('0x40')]=function(_0x1eedfc,_0x433dba){var _0x52e959={'raw':![],'where':{'id':_0x1eedfc[_0xa6e0('0x41')]['id']}},_0x335d6d={};_0x335d6d[_0xa6e0('0x2c')]=_[_0xa6e0('0x2e')](db[_0xa6e0('0x29')][_0xa6e0('0x42')]);_0x335d6d[_0xa6e0('0x2d')]=_[_0xa6e0('0x2e')](_0x1eedfc[_0xa6e0('0x2d')]);_0x335d6d[_0xa6e0('0x37')]=_[_0xa6e0('0x2f')](_0x335d6d[_0xa6e0('0x2c')],_0x335d6d['query']);_0x52e959[_0xa6e0('0x30')]=_[_0xa6e0('0x2f')](_0x335d6d[_0xa6e0('0x2c')],qs[_0xa6e0('0x31')](_0x1eedfc[_0xa6e0('0x2d')]['fields']));_0x52e959[_0xa6e0('0x30')]=_0x52e959[_0xa6e0('0x30')][_0xa6e0('0x32')]?_0x52e959[_0xa6e0('0x30')]:_0x335d6d['model'];if(_0x1eedfc[_0xa6e0('0x2d')][_0xa6e0('0x3d')]){_0x52e959['include']=[{'all':!![]}];}_0x52e959=_[_0xa6e0('0x39')]({},_0x52e959,_0x1eedfc[_0xa6e0('0x3c')]);return db[_0xa6e0('0x29')][_0xa6e0('0x43')](_0x52e959)[_0xa6e0('0x23')](handleEntityNotFound(_0x433dba,null))[_0xa6e0('0x23')](respondWithResult(_0x433dba,null))[_0xa6e0('0x3f')](handleError(_0x433dba,null));};exports[_0xa6e0('0x44')]=function(_0x46535d,_0x2ba197){return db[_0xa6e0('0x29')][_0xa6e0('0x44')](_0x46535d[_0xa6e0('0x45')],{})[_0xa6e0('0x23')](respondWithResult(_0x2ba197,0xc9))[_0xa6e0('0x3f')](handleError(_0x2ba197,null));};exports[_0xa6e0('0x21')]=function(_0x5af624,_0x413f7e){if(_0x5af624[_0xa6e0('0x45')]['id']){delete _0x5af624[_0xa6e0('0x45')]['id'];}return db[_0xa6e0('0x29')][_0xa6e0('0x43')]({'where':{'id':_0x5af624[_0xa6e0('0x41')]['id']}})[_0xa6e0('0x23')](handleEntityNotFound(_0x413f7e,null))['then'](saveUpdates(_0x5af624[_0xa6e0('0x45')],null))[_0xa6e0('0x23')](respondWithResult(_0x413f7e,null))[_0xa6e0('0x3f')](handleError(_0x413f7e,null));};exports[_0xa6e0('0x22')]=function(_0x1bca66,_0x3bf976){return db[_0xa6e0('0x29')][_0xa6e0('0x43')]({'where':{'id':_0x1bca66[_0xa6e0('0x41')]['id']}})[_0xa6e0('0x23')](handleEntityNotFound(_0x3bf976,null))[_0xa6e0('0x23')](removeEntity(_0x3bf976,null))['catch'](handleError(_0x3bf976,null));};exports[_0xa6e0('0x46')]=function(_0x41acdb,_0x17c2b8,_0x1def01){var _0xb0ad2b={};var _0x33eb34={};var _0xd802f2;var _0x16b257;return db[_0xa6e0('0x29')][_0xa6e0('0x47')]({'where':{'id':_0x41acdb['params']['id']}})[_0xa6e0('0x23')](handleEntityNotFound(_0x17c2b8,null))[_0xa6e0('0x23')](function(_0x3666da){if(_0x3666da){_0xd802f2=_0x3666da;_0x33eb34[_0xa6e0('0x2c')]=_['keys'](db['Dynamics365Field']['rawAttributes']);_0x33eb34['query']=_[_0xa6e0('0x2e')](_0x41acdb['query']);_0x33eb34['filters']=_[_0xa6e0('0x2f')](_0x33eb34[_0xa6e0('0x2c')],_0x33eb34[_0xa6e0('0x2d')]);_0xb0ad2b[_0xa6e0('0x30')]=_[_0xa6e0('0x2f')](_0x33eb34[_0xa6e0('0x2c')],qs[_0xa6e0('0x31')](_0x41acdb[_0xa6e0('0x2d')]['fields']));_0xb0ad2b[_0xa6e0('0x30')]=_0xb0ad2b['attributes'][_0xa6e0('0x32')]?_0xb0ad2b['attributes']:_0x33eb34[_0xa6e0('0x2c')];_0xb0ad2b[_0xa6e0('0x48')]=qs[_0xa6e0('0x35')](_0x41acdb[_0xa6e0('0x2d')][_0xa6e0('0x35')]);_0xb0ad2b['where']=qs[_0xa6e0('0x37')](_[_0xa6e0('0x49')](_0x41acdb[_0xa6e0('0x2d')],_0x33eb34[_0xa6e0('0x37')]));if(_0x41acdb[_0xa6e0('0x2d')][_0xa6e0('0x38')]){_0xb0ad2b['where']=_['merge'](_0xb0ad2b[_0xa6e0('0x36')],{'$or':_[_0xa6e0('0x28')](_0xb0ad2b[_0xa6e0('0x30')],function(_0x24eef1){var _0x1c6df4={};_0x1c6df4[_0x24eef1]={'$like':'%'+_0x41acdb['query']['filter']+'%'};return _0x1c6df4;})});}_0xb0ad2b=_[_0xa6e0('0x39')]({},_0xb0ad2b,_0x41acdb[_0xa6e0('0x3c')]);return _0xd802f2[_0xa6e0('0x46')](_0xb0ad2b);}})['then'](function(_0x1e79f3){if(_0x1e79f3){_0x16b257=_0x1e79f3['length'];if(!_0x41acdb[_0xa6e0('0x2d')][_0xa6e0('0x33')](_0xa6e0('0x34'))){_0xb0ad2b[_0xa6e0('0x1d')]=qs[_0xa6e0('0x1d')](_0x41acdb[_0xa6e0('0x2d')][_0xa6e0('0x1d')]);_0xb0ad2b['offset']=qs[_0xa6e0('0x1b')](_0x41acdb[_0xa6e0('0x2d')][_0xa6e0('0x1b')]);}return _0xd802f2[_0xa6e0('0x46')](_0xb0ad2b);}})[_0xa6e0('0x23')](function(_0xa0e9c9){if(_0xa0e9c9){return _0xa0e9c9?{'count':_0x16b257,'rows':_0xa0e9c9}:null;}})['then'](respondWithResult(_0x17c2b8,null))['catch'](handleError(_0x17c2b8,null));};exports['getSubjects']=function(_0x5deb27,_0x358317,_0x208ef8){var _0x2e5499={};var _0x30ad61={};var _0xa41ce4;var _0x887fbe;return db[_0xa6e0('0x29')][_0xa6e0('0x47')]({'where':{'id':_0x5deb27['params']['id']}})[_0xa6e0('0x23')](handleEntityNotFound(_0x358317,null))[_0xa6e0('0x23')](function(_0x1fc817){if(_0x1fc817){_0xa41ce4=_0x1fc817;_0x30ad61[_0xa6e0('0x2c')]=_[_0xa6e0('0x2e')](db[_0xa6e0('0x4a')][_0xa6e0('0x42')]);_0x30ad61[_0xa6e0('0x2d')]=_[_0xa6e0('0x2e')](_0x5deb27[_0xa6e0('0x2d')]);_0x30ad61['filters']=_['intersection'](_0x30ad61[_0xa6e0('0x2c')],_0x30ad61[_0xa6e0('0x2d')]);_0x2e5499[_0xa6e0('0x30')]=_[_0xa6e0('0x2f')](_0x30ad61['model'],qs[_0xa6e0('0x31')](_0x5deb27[_0xa6e0('0x2d')][_0xa6e0('0x31')]));_0x2e5499['attributes']=_0x2e5499[_0xa6e0('0x30')][_0xa6e0('0x32')]?_0x2e5499[_0xa6e0('0x30')]:_0x30ad61['model'];_0x2e5499[_0xa6e0('0x48')]=qs[_0xa6e0('0x35')](_0x5deb27[_0xa6e0('0x2d')]['sort']);_0x2e5499['where']=qs['filters'](_['pick'](_0x5deb27[_0xa6e0('0x2d')],_0x30ad61[_0xa6e0('0x37')]));if(_0x5deb27[_0xa6e0('0x2d')][_0xa6e0('0x38')]){_0x2e5499['where']=_[_0xa6e0('0x39')](_0x2e5499[_0xa6e0('0x36')],{'$or':_[_0xa6e0('0x28')](_0x2e5499[_0xa6e0('0x30')],function(_0x569bfa){var _0x2060c0={};_0x2060c0[_0x569bfa]={'$like':'%'+_0x5deb27['query'][_0xa6e0('0x38')]+'%'};return _0x2060c0;})});}_0x2e5499=_[_0xa6e0('0x39')]({},_0x2e5499,_0x5deb27[_0xa6e0('0x3c')]);return _0xa41ce4[_0xa6e0('0x4b')](_0x2e5499);}})[_0xa6e0('0x23')](function(_0x2b5f59){if(_0x2b5f59){_0x887fbe=_0x2b5f59[_0xa6e0('0x32')];if(!_0x5deb27[_0xa6e0('0x2d')]['hasOwnProperty'](_0xa6e0('0x34'))){_0x2e5499[_0xa6e0('0x1d')]=qs['limit'](_0x5deb27['query'][_0xa6e0('0x1d')]);_0x2e5499['offset']=qs[_0xa6e0('0x1b')](_0x5deb27[_0xa6e0('0x2d')][_0xa6e0('0x1b')]);}return _0xa41ce4['getSubjects'](_0x2e5499);}})[_0xa6e0('0x23')](function(_0x2d2119){if(_0x2d2119){return _0x2d2119?{'count':_0x887fbe,'rows':_0x2d2119}:null;}})[_0xa6e0('0x23')](respondWithResult(_0x358317,null))[_0xa6e0('0x3f')](handleError(_0x358317,null));};exports[_0xa6e0('0x4c')]=function(_0x2bfaf1,_0x4c8b6c,_0x2719d0){var _0x53a4d6={};var _0x5221de={};var _0x2672bb;var _0x227447;return db[_0xa6e0('0x29')]['findOne']({'where':{'id':_0x2bfaf1[_0xa6e0('0x41')]['id']}})[_0xa6e0('0x23')](handleEntityNotFound(_0x4c8b6c,null))[_0xa6e0('0x23')](function(_0x5da180){if(_0x5da180){_0x2672bb=_0x5da180;_0x5221de[_0xa6e0('0x2c')]=_[_0xa6e0('0x2e')](db[_0xa6e0('0x4a')][_0xa6e0('0x42')]);_0x5221de['query']=_[_0xa6e0('0x2e')](_0x2bfaf1['query']);_0x5221de[_0xa6e0('0x37')]=_['intersection'](_0x5221de[_0xa6e0('0x2c')],_0x5221de[_0xa6e0('0x2d')]);_0x53a4d6[_0xa6e0('0x30')]=_[_0xa6e0('0x2f')](_0x5221de[_0xa6e0('0x2c')],qs[_0xa6e0('0x31')](_0x2bfaf1[_0xa6e0('0x2d')]['fields']));_0x53a4d6[_0xa6e0('0x30')]=_0x53a4d6[_0xa6e0('0x30')]['length']?_0x53a4d6[_0xa6e0('0x30')]:_0x5221de[_0xa6e0('0x2c')];_0x53a4d6['order']=qs[_0xa6e0('0x35')](_0x2bfaf1[_0xa6e0('0x2d')][_0xa6e0('0x35')]);_0x53a4d6['where']=qs[_0xa6e0('0x37')](_['pick'](_0x2bfaf1[_0xa6e0('0x2d')],_0x5221de[_0xa6e0('0x37')]));if(_0x2bfaf1[_0xa6e0('0x2d')][_0xa6e0('0x38')]){_0x53a4d6[_0xa6e0('0x36')]=_[_0xa6e0('0x39')](_0x53a4d6[_0xa6e0('0x36')],{'$or':_[_0xa6e0('0x28')](_0x53a4d6['attributes'],function(_0x128257){var _0xb054c7={};_0xb054c7[_0x128257]={'$like':'%'+_0x2bfaf1['query']['filter']+'%'};return _0xb054c7;})});}_0x53a4d6=_[_0xa6e0('0x39')]({},_0x53a4d6,_0x2bfaf1[_0xa6e0('0x3c')]);return _0x2672bb[_0xa6e0('0x4c')](_0x53a4d6);}})['then'](function(_0x542545){if(_0x542545){_0x227447=_0x542545['length'];if(!_0x2bfaf1[_0xa6e0('0x2d')][_0xa6e0('0x33')](_0xa6e0('0x34'))){_0x53a4d6[_0xa6e0('0x1d')]=qs['limit'](_0x2bfaf1[_0xa6e0('0x2d')][_0xa6e0('0x1d')]);_0x53a4d6[_0xa6e0('0x1b')]=qs['offset'](_0x2bfaf1[_0xa6e0('0x2d')][_0xa6e0('0x1b')]);}return _0x2672bb['getDescriptions'](_0x53a4d6);}})[_0xa6e0('0x23')](function(_0x12bac3){if(_0x12bac3){return _0x12bac3?{'count':_0x227447,'rows':_0x12bac3}:null;}})[_0xa6e0('0x23')](respondWithResult(_0x4c8b6c,null))[_0xa6e0('0x3f')](handleError(_0x4c8b6c,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 537a120..08fe6a3 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 _0xb4e6=['path','rimraf','./intDynamics365Configuration.attributes','exports','define','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x537d72,_0x4577af){var _0x7e2aec=function(_0xc831b1){while(--_0xc831b1){_0x537d72['push'](_0x537d72['shift']());}};_0x7e2aec(++_0x4577af);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x333798,_0x9f6561){_0x333798=_0x333798-0x0;var _0x389f4e=_0xb4e6[_0x333798];return _0x389f4e;};'use strict';var _=require(_0x6b4e('0x0'));var util=require('util');var logger=require(_0x6b4e('0x1'))(_0x6b4e('0x2'));var moment=require(_0x6b4e('0x3'));var BPromise=require(_0x6b4e('0x4'));var rp=require(_0x6b4e('0x5'));var fs=require('fs');var path=require(_0x6b4e('0x6'));var rimraf=require(_0x6b4e('0x7'));var config=require('../../config/environment');var attributes=require(_0x6b4e('0x8'));module[_0x6b4e('0x9')]=function(_0x1f67a2,_0x49de51){return _0x1f67a2[_0x6b4e('0xa')]('Dynamics365Configuration',attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe5b3=['request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','int_dynamics365_configurations','util','../../config/logger','api','moment','bluebird'];(function(_0x53a7af,_0x1408a5){var _0x3cc7f6=function(_0x4bf101){while(--_0x4bf101){_0x53a7af['push'](_0x53a7af['shift']());}};_0x3cc7f6(++_0x1408a5);}(_0xe5b3,0x133));var _0x3e5b=function(_0x5e1855,_0x17161e){_0x5e1855=_0x5e1855-0x0;var _0x4faf68=_0xe5b3[_0x5e1855];return _0x4faf68;};'use strict';var _=require('lodash');var util=require(_0x3e5b('0x0'));var logger=require(_0x3e5b('0x1'))(_0x3e5b('0x2'));var moment=require(_0x3e5b('0x3'));var BPromise=require(_0x3e5b('0x4'));var rp=require(_0x3e5b('0x5'));var fs=require('fs');var path=require(_0x3e5b('0x6'));var rimraf=require(_0x3e5b('0x7'));var config=require(_0x3e5b('0x8'));var attributes=require(_0x3e5b('0x9'));module[_0x3e5b('0xa')]=function(_0x54e1fb,_0x174923){return _0x54e1fb[_0x3e5b('0xb')]('Dynamics365Configuration',attributes,{'tableName':_0x3e5b('0xc'),'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 c227431..fd24137 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 _0x0763=['client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x58592c,_0x18233d){var _0x4dcf36=function(_0x37e56c){while(--_0x37e56c){_0x58592c['push'](_0x58592c['shift']());}};_0x4dcf36(++_0x18233d);}(_0x0763,0x65));var _0x3076=function(_0x119cd8,_0x556b73){_0x119cd8=_0x119cd8-0x0;var _0x7072a3=_0x0763[_0x119cd8];return _0x7072a3;};'use strict';var _=require(_0x3076('0x0'));var util=require('util');var moment=require(_0x3076('0x1'));var BPromise=require(_0x3076('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3076('0x3'));var db=require(_0x3076('0x4'))['db'];var utils=require(_0x3076('0x5'));var logger=require(_0x3076('0x6'))('rpc');var config=require(_0x3076('0x7'));var jayson=require(_0x3076('0x8'));var client=jayson[_0x3076('0x9')][_0x3076('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3c154d,_0x14cdf3,_0x1ab2c1){return new BPromise(function(_0x26549b,_0x553854){return client[_0x3076('0xb')](_0x3c154d,_0x1ab2c1)[_0x3076('0xc')](function(_0xabc86b){logger[_0x3076('0xd')](_0x3076('0xe'),_0x14cdf3,_0x3076('0xf'));logger['debug'](_0x3076('0x10'),_0x14cdf3,_0x3076('0xf'),JSON[_0x3076('0x11')](_0xabc86b));if(_0xabc86b[_0x3076('0x12')]){if(_0xabc86b[_0x3076('0x12')][_0x3076('0x13')]===0x1f4){logger[_0x3076('0x12')]('Dynamics365Configuration,\x20%s,\x20%s',_0x14cdf3,_0xabc86b[_0x3076('0x12')][_0x3076('0x14')]);return _0x553854(_0xabc86b[_0x3076('0x12')][_0x3076('0x14')]);}logger[_0x3076('0x12')](_0x3076('0xe'),_0x14cdf3,_0xabc86b[_0x3076('0x12')][_0x3076('0x14')]);return _0x26549b(_0xabc86b[_0x3076('0x12')]['message']);}else{logger[_0x3076('0xd')](_0x3076('0xe'),_0x14cdf3,_0x3076('0xf'));_0x26549b(_0xabc86b[_0x3076('0x15')][_0x3076('0x14')]);}})['catch'](function(_0x5b1967){logger['error'](_0x3076('0xe'),_0x14cdf3,_0x5b1967);_0x553854(_0x5b1967);});});} \ No newline at end of file +var _0x9979=['rpc','../../config/environment','client','http','then','info','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','code','error','Dynamics365Configuration,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x396930,_0x4215ae){var _0x168477=function(_0x4e274b){while(--_0x4e274b){_0x396930['push'](_0x396930['shift']());}};_0x168477(++_0x4215ae);}(_0x9979,0x123));var _0x9997=function(_0x337a13,_0x39554e){_0x337a13=_0x337a13-0x0;var _0x21fbd8=_0x9979[_0x337a13];return _0x21fbd8;};'use strict';var _=require(_0x9997('0x0'));var util=require(_0x9997('0x1'));var moment=require('moment');var BPromise=require(_0x9997('0x2'));var rs=require(_0x9997('0x3'));var fs=require('fs');var Redis=require(_0x9997('0x4'));var db=require(_0x9997('0x5'))['db'];var utils=require(_0x9997('0x6'));var logger=require(_0x9997('0x7'))(_0x9997('0x8'));var config=require(_0x9997('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9997('0xa')][_0x9997('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1e4e7e,_0x37e850,_0x4cced7){return new BPromise(function(_0xbb066d,_0x4fb384){return client['request'](_0x1e4e7e,_0x4cced7)[_0x9997('0xc')](function(_0x3f305e){logger[_0x9997('0xd')]('Dynamics365Configuration,\x20%s,\x20%s',_0x37e850,_0x9997('0xe'));logger['debug'](_0x9997('0xf'),_0x37e850,'request\x20sent',JSON[_0x9997('0x10')](_0x3f305e));if(_0x3f305e['error']){if(_0x3f305e['error'][_0x9997('0x11')]===0x1f4){logger[_0x9997('0x12')](_0x9997('0x13'),_0x37e850,_0x3f305e['error'][_0x9997('0x14')]);return _0x4fb384(_0x3f305e[_0x9997('0x12')][_0x9997('0x14')]);}logger[_0x9997('0x12')](_0x9997('0x13'),_0x37e850,_0x3f305e[_0x9997('0x12')][_0x9997('0x14')]);return _0xbb066d(_0x3f305e['error'][_0x9997('0x14')]);}else{logger[_0x9997('0xd')]('Dynamics365Configuration,\x20%s,\x20%s',_0x37e850,_0x9997('0xe'));_0xbb066d(_0x3f305e[_0x9997('0x15')][_0x9997('0x14')]);}})[_0x9997('0x16')](function(_0x81a232){logger[_0x9997('0x12')](_0x9997('0x13'),_0x37e850,_0x81a232);_0x4fb384(_0x81a232);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 78604f0..fd6e450 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 _0x1940=['show','put','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intDynamics365Field.controller','get','isAuthenticated','index','/:id'];(function(_0x5cc8,_0x1faa02){var _0x450661=function(_0x237b05){while(--_0x237b05){_0x5cc8['push'](_0x5cc8['shift']());}};_0x450661(++_0x1faa02);}(_0x1940,0x1f2));var _0x0194=function(_0x2468b5,_0x506b9e){_0x2468b5=_0x2468b5-0x0;var _0x1056e4=_0x1940[_0x2468b5];return _0x1056e4;};'use strict';var multer=require('multer');var util=require(_0x0194('0x0'));var path=require(_0x0194('0x1'));var timeout=require(_0x0194('0x2'));var express=require(_0x0194('0x3'));var router=express[_0x0194('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0194('0x5'));var interaction=require(_0x0194('0x6'));var config=require('../../config/environment');var controller=require(_0x0194('0x7'));router[_0x0194('0x8')]('/',auth[_0x0194('0x9')](),controller[_0x0194('0xa')]);router[_0x0194('0x8')](_0x0194('0xb'),auth['isAuthenticated'](),controller[_0x0194('0xc')]);router['post']('/',auth[_0x0194('0x9')](),controller['create']);router[_0x0194('0xd')](_0x0194('0xb'),auth['isAuthenticated'](),controller[_0x0194('0xe')]);router['delete'](_0x0194('0xb'),auth[_0x0194('0x9')](),controller[_0x0194('0xf')]);module[_0x0194('0x10')]=router; \ No newline at end of file +var _0x4f4a=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','create','update','delete','destroy'];(function(_0x5ba8fe,_0x25163b){var _0x1d8200=function(_0x15a4f8){while(--_0x15a4f8){_0x5ba8fe['push'](_0x5ba8fe['shift']());}};_0x1d8200(++_0x25163b);}(_0x4f4a,0x177));var _0xa4f4=function(_0x4a1a02,_0x1d1c2e){_0x4a1a02=_0x4a1a02-0x0;var _0x1db28a=_0x4f4a[_0x4a1a02];return _0x1db28a;};'use strict';var multer=require(_0xa4f4('0x0'));var util=require(_0xa4f4('0x1'));var path=require('path');var timeout=require(_0xa4f4('0x2'));var express=require(_0xa4f4('0x3'));var router=express[_0xa4f4('0x4')]();var fs_extra=require(_0xa4f4('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa4f4('0x6'));var config=require('../../config/environment');var controller=require(_0xa4f4('0x7'));router[_0xa4f4('0x8')]('/',auth[_0xa4f4('0x9')](),controller[_0xa4f4('0xa')]);router['get'](_0xa4f4('0xb'),auth[_0xa4f4('0x9')](),controller['show']);router['post']('/',auth[_0xa4f4('0x9')](),controller[_0xa4f4('0xc')]);router['put'](_0xa4f4('0xb'),auth['isAuthenticated'](),controller[_0xa4f4('0xd')]);router[_0xa4f4('0xe')]('/:id',auth[_0xa4f4('0x9')](),controller[_0xa4f4('0xf')]);module[_0xa4f4('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index e81c3db..5f0b933 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 _0x50f9=['variable','customVariable','picklist','STRING','sequelize','exports','ENUM','string'];(function(_0x1f5315,_0x5f0fc9){var _0x52220e=function(_0x41b511){while(--_0x41b511){_0x1f5315['push'](_0x1f5315['shift']());}};_0x52220e(++_0x5f0fc9);}(_0x50f9,0xf4));var _0x950f=function(_0x22a7ef,_0x1d79aa){_0x22a7ef=_0x22a7ef-0x0;var _0x3cb7f9=_0x50f9[_0x22a7ef];return _0x3cb7f9;};'use strict';var Sequelize=require(_0x950f('0x0'));module[_0x950f('0x1')]={'type':{'type':Sequelize[_0x950f('0x2')](_0x950f('0x3'),_0x950f('0x4'),_0x950f('0x5'),'keyValue',_0x950f('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x950f('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x950f('0x2')]('string','variable',_0x950f('0x5'))},'keyContent':{'type':Sequelize[_0x950f('0x7')]},'idField':{'type':Sequelize[_0x950f('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa0cb=['ENUM','BOOLEAN','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0xc1b3da,_0x577780){var _0x424483=function(_0x290acf){while(--_0x290acf){_0xc1b3da['push'](_0xc1b3da['shift']());}};_0x424483(++_0x577780);}(_0xa0cb,0xca));var _0xba0c=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xa0cb[_0x8c43de];return _0xa6591b;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM'](_0xba0c('0x0'),_0xba0c('0x1'),_0xba0c('0x2'),_0xba0c('0x3'),_0xba0c('0x4')),'defaultValue':_0xba0c('0x0')},'content':{'type':Sequelize[_0xba0c('0x5')]},'key':{'type':Sequelize[_0xba0c('0x5')]},'keyType':{'type':Sequelize[_0xba0c('0x6')](_0xba0c('0x0'),_0xba0c('0x1'),_0xba0c('0x2'))},'keyContent':{'type':Sequelize[_0xba0c('0x5')]},'idField':{'type':Sequelize[_0xba0c('0x5')]},'nameField':{'type':Sequelize[_0xba0c('0x5')]},'customField':{'type':Sequelize[_0xba0c('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xba0c('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 7de02a7..ca71d69 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 _0xce10=['options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','Content-Range','apply','update','then','destroy','sendStatus','stack','name','send','index','map','Dynamics365Field','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','merge','type','VIRTUAL'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0xce10,0x16f));var _0x0ce1=function(_0x367e5b,_0x5721e4){_0x367e5b=_0x367e5b-0x0;var _0x4b909e=_0xce10[_0x367e5b];return _0x4b909e;};'use strict';var emlformat=require(_0x0ce1('0x0'));var rimraf=require(_0x0ce1('0x1'));var zipdir=require(_0x0ce1('0x2'));var jsonpatch=require(_0x0ce1('0x3'));var rp=require('request-promise');var moment=require(_0x0ce1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0ce1('0x5'));var util=require(_0x0ce1('0x6'));var path=require('path');var sox=require(_0x0ce1('0x7'));var csv=require(_0x0ce1('0x8'));var ejs=require(_0x0ce1('0x9'));var fs=require('fs');var fs_extra=require(_0x0ce1('0xa'));var _=require(_0x0ce1('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0ce1('0xc'));var deskjs=require(_0x0ce1('0xd'));var toCsv=require(_0x0ce1('0x8'));var querystring=require(_0x0ce1('0xe'));var Papa=require('papaparse');var Redis=require(_0x0ce1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x0ce1('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0ce1('0x11'));var logger=require(_0x0ce1('0x12'))(_0x0ce1('0x13'));var utils=require(_0x0ce1('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x0ce1('0x15'));var db=require(_0x0ce1('0x16'))['db'];function respondWithStatusCode(_0xc186f9,_0x104788){_0x104788=_0x104788||0xcc;return function(_0x298398){if(_0x298398){return _0xc186f9['sendStatus'](_0x104788);}return _0xc186f9[_0x0ce1('0x17')](_0x104788)[_0x0ce1('0x18')]();};}function respondWithResult(_0x1ff0cf,_0x476823){_0x476823=_0x476823||0xc8;return function(_0x5169c7){if(_0x5169c7){return _0x1ff0cf[_0x0ce1('0x17')](_0x476823)[_0x0ce1('0x19')](_0x5169c7);}};}function respondWithFilteredResult(_0x860364,_0x191382){return function(_0x12ed18){if(_0x12ed18){var _0x11cfae=typeof _0x191382['offset']===_0x0ce1('0x1a')&&typeof _0x191382['limit']==='undefined';var _0x105e6b=_0x12ed18[_0x0ce1('0x1b')];var _0x3370e3=_0x11cfae?0x0:_0x191382[_0x0ce1('0x1c')];var _0x66c552=_0x11cfae?_0x12ed18[_0x0ce1('0x1b')]:_0x191382[_0x0ce1('0x1c')]+_0x191382['limit'];var _0x2c9c38;if(_0x66c552>=_0x105e6b){_0x66c552=_0x105e6b;_0x2c9c38=0xc8;}else{_0x2c9c38=0xce;}_0x860364[_0x0ce1('0x17')](_0x2c9c38);return _0x860364['set'](_0x0ce1('0x1d'),_0x3370e3+'-'+_0x66c552+'/'+_0x105e6b)[_0x0ce1('0x19')](_0x12ed18);}return null;};}function patchUpdates(_0x3456dc){return function(_0x459019){try{jsonpatch[_0x0ce1('0x1e')](_0x459019,_0x3456dc,!![]);}catch(_0x52c725){return BPromise['reject'](_0x52c725);}return _0x459019['save']();};}function saveUpdates(_0xd12639,_0x26ba82){return function(_0x174dd5){if(_0x174dd5){return _0x174dd5[_0x0ce1('0x1f')](_0xd12639)[_0x0ce1('0x20')](function(_0x55aa33){return _0x55aa33;});}return null;};}function removeEntity(_0x1d8113,_0x374424){return function(_0x371e98){if(_0x371e98){return _0x371e98[_0x0ce1('0x21')]()[_0x0ce1('0x20')](function(){_0x1d8113[_0x0ce1('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59a8b0,_0x1d28eb){return function(_0x4f85c1){if(!_0x4f85c1){_0x59a8b0[_0x0ce1('0x22')](0x194);}return _0x4f85c1;};}function handleError(_0x16cc61,_0x128d63){_0x128d63=_0x128d63||0x1f4;return function(_0xa748aa){logger['error'](_0xa748aa[_0x0ce1('0x23')]);if(_0xa748aa['name']){delete _0xa748aa[_0x0ce1('0x24')];}_0x16cc61[_0x0ce1('0x17')](_0x128d63)[_0x0ce1('0x25')](_0xa748aa);};}exports[_0x0ce1('0x26')]=function(_0x4ab952,_0x4b5899){var _0x549f7e={},_0x41f47d={},_0x4f2c2d={'count':0x0,'rows':[]};var _0x3c7b3d=_[_0x0ce1('0x27')](db[_0x0ce1('0x28')]['rawAttributes'],function(_0x3ab2b6){return{'name':_0x3ab2b6['fieldName'],'type':_0x3ab2b6['type'][_0x0ce1('0x29')]};});_0x41f47d[_0x0ce1('0x2a')]=_[_0x0ce1('0x27')](_0x3c7b3d,'name');_0x41f47d[_0x0ce1('0x2b')]=_[_0x0ce1('0x2c')](_0x4ab952['query']);_0x41f47d['filters']=_[_0x0ce1('0x2d')](_0x41f47d[_0x0ce1('0x2a')],_0x41f47d[_0x0ce1('0x2b')]);_0x549f7e[_0x0ce1('0x2e')]=_['intersection'](_0x41f47d['model'],qs[_0x0ce1('0x2f')](_0x4ab952[_0x0ce1('0x2b')][_0x0ce1('0x2f')]));_0x549f7e[_0x0ce1('0x2e')]=_0x549f7e[_0x0ce1('0x2e')]['length']?_0x549f7e['attributes']:_0x41f47d[_0x0ce1('0x2a')];if(!_0x4ab952[_0x0ce1('0x2b')][_0x0ce1('0x30')](_0x0ce1('0x31'))){_0x549f7e['limit']=qs[_0x0ce1('0x32')](_0x4ab952[_0x0ce1('0x2b')][_0x0ce1('0x32')]);_0x549f7e[_0x0ce1('0x1c')]=qs['offset'](_0x4ab952['query']['offset']);}_0x549f7e[_0x0ce1('0x33')]=qs['sort'](_0x4ab952[_0x0ce1('0x2b')][_0x0ce1('0x34')]);_0x549f7e[_0x0ce1('0x35')]=qs[_0x0ce1('0x36')](_['pick'](_0x4ab952[_0x0ce1('0x2b')],_0x41f47d[_0x0ce1('0x36')]),_0x3c7b3d);if(_0x4ab952[_0x0ce1('0x2b')][_0x0ce1('0x37')]){_0x549f7e[_0x0ce1('0x35')]=_[_0x0ce1('0x38')](_0x549f7e[_0x0ce1('0x35')],{'$or':_[_0x0ce1('0x27')](_0x3c7b3d,function(_0x48feb0){if(_0x48feb0[_0x0ce1('0x39')]!==_0x0ce1('0x3a')){var _0x2d97a8={};_0x2d97a8[_0x48feb0['name']]={'$like':'%'+_0x4ab952[_0x0ce1('0x2b')]['filter']+'%'};return _0x2d97a8;}})});}_0x549f7e=_['merge']({},_0x549f7e,_0x4ab952[_0x0ce1('0x3b')]);var _0x4f5e5b={'where':_0x549f7e[_0x0ce1('0x35')]};return db[_0x0ce1('0x28')][_0x0ce1('0x1b')](_0x4f5e5b)['then'](function(_0x33a44e){_0x4f2c2d[_0x0ce1('0x1b')]=_0x33a44e;if(_0x4ab952['query'][_0x0ce1('0x3c')]){_0x549f7e['include']=[{'all':!![]}];}return db[_0x0ce1('0x28')][_0x0ce1('0x3d')](_0x549f7e);})[_0x0ce1('0x20')](function(_0x5e4632){_0x4f2c2d[_0x0ce1('0x3e')]=_0x5e4632;return _0x4f2c2d;})[_0x0ce1('0x20')](respondWithFilteredResult(_0x4b5899,_0x549f7e))[_0x0ce1('0x3f')](handleError(_0x4b5899,null));};exports[_0x0ce1('0x40')]=function(_0x578d75,_0x3bfaa7){var _0x2b99ae={'raw':!![],'where':{'id':_0x578d75[_0x0ce1('0x41')]['id']}},_0x4fe4f1={};_0x4fe4f1[_0x0ce1('0x2a')]=_[_0x0ce1('0x2c')](db[_0x0ce1('0x28')][_0x0ce1('0x42')]);_0x4fe4f1[_0x0ce1('0x2b')]=_['keys'](_0x578d75[_0x0ce1('0x2b')]);_0x4fe4f1[_0x0ce1('0x36')]=_['intersection'](_0x4fe4f1[_0x0ce1('0x2a')],_0x4fe4f1[_0x0ce1('0x2b')]);_0x2b99ae[_0x0ce1('0x2e')]=_['intersection'](_0x4fe4f1[_0x0ce1('0x2a')],qs['fields'](_0x578d75[_0x0ce1('0x2b')][_0x0ce1('0x2f')]));_0x2b99ae[_0x0ce1('0x2e')]=_0x2b99ae[_0x0ce1('0x2e')]['length']?_0x2b99ae[_0x0ce1('0x2e')]:_0x4fe4f1[_0x0ce1('0x2a')];if(_0x578d75[_0x0ce1('0x2b')][_0x0ce1('0x3c')]){_0x2b99ae[_0x0ce1('0x43')]=[{'all':!![]}];}_0x2b99ae=_[_0x0ce1('0x38')]({},_0x2b99ae,_0x578d75[_0x0ce1('0x3b')]);return db[_0x0ce1('0x28')]['find'](_0x2b99ae)[_0x0ce1('0x20')](handleEntityNotFound(_0x3bfaa7,null))['then'](respondWithResult(_0x3bfaa7,null))[_0x0ce1('0x3f')](handleError(_0x3bfaa7,null));};exports[_0x0ce1('0x44')]=function(_0x25a104,_0x5edd61){return db[_0x0ce1('0x28')][_0x0ce1('0x44')](_0x25a104[_0x0ce1('0x45')],{})['then'](respondWithResult(_0x5edd61,0xc9))[_0x0ce1('0x3f')](handleError(_0x5edd61,null));};exports[_0x0ce1('0x1f')]=function(_0x1c0760,_0xa1223){if(_0x1c0760[_0x0ce1('0x45')]['id']){delete _0x1c0760[_0x0ce1('0x45')]['id'];}return db[_0x0ce1('0x28')]['find']({'where':{'id':_0x1c0760['params']['id']}})['then'](handleEntityNotFound(_0xa1223,null))[_0x0ce1('0x20')](saveUpdates(_0x1c0760['body'],null))[_0x0ce1('0x20')](respondWithResult(_0xa1223,null))[_0x0ce1('0x3f')](handleError(_0xa1223,null));};exports['destroy']=function(_0x5d3a50,_0x522142){return db[_0x0ce1('0x28')][_0x0ce1('0x46')]({'where':{'id':_0x5d3a50['params']['id']}})[_0x0ce1('0x20')](handleEntityNotFound(_0x522142,null))[_0x0ce1('0x20')](removeEntity(_0x522142,null))[_0x0ce1('0x3f')](handleError(_0x522142,null));}; \ No newline at end of file +var _0xa136=['../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','then','error','stack','name','send','map','Dynamics365Field','rawAttributes','type','key','model','keys','filters','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','update','destroy','eml-format','rimraf','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','api','../../config/utils'];(function(_0x57ce31,_0x6430e8){var _0x39ba38=function(_0x2c9e59){while(--_0x2c9e59){_0x57ce31['push'](_0x57ce31['shift']());}};_0x39ba38(++_0x6430e8);}(_0xa136,0x1ea));var _0x6a13=function(_0x4e7b37,_0x33b1fa){_0x4e7b37=_0x4e7b37-0x0;var _0x20b707=_0xa136[_0x4e7b37];return _0x20b707;};'use strict';var emlformat=require(_0x6a13('0x0'));var rimraf=require(_0x6a13('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(_0x6a13('0x2'));var util=require(_0x6a13('0x3'));var path=require(_0x6a13('0x4'));var sox=require(_0x6a13('0x5'));var csv=require(_0x6a13('0x6'));var ejs=require(_0x6a13('0x7'));var fs=require('fs');var fs_extra=require(_0x6a13('0x8'));var _=require(_0x6a13('0x9'));var squel=require(_0x6a13('0xa'));var crypto=require(_0x6a13('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x6a13('0xc'));var toCsv=require('to-csv');var querystring=require(_0x6a13('0xd'));var Papa=require(_0x6a13('0xe'));var Redis=require(_0x6a13('0xf'));var authService=require(_0x6a13('0x10'));var qs=require(_0x6a13('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6a13('0x12'));var logger=require('../../config/logger')(_0x6a13('0x13'));var utils=require(_0x6a13('0x14'));var config=require(_0x6a13('0x15'));var licenseUtil=require(_0x6a13('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x27d401,_0x1c5ca4){_0x1c5ca4=_0x1c5ca4||0xcc;return function(_0x392981){if(_0x392981){return _0x27d401[_0x6a13('0x17')](_0x1c5ca4);}return _0x27d401[_0x6a13('0x18')](_0x1c5ca4)[_0x6a13('0x19')]();};}function respondWithResult(_0x5514af,_0x5e0a77){_0x5e0a77=_0x5e0a77||0xc8;return function(_0x291807){if(_0x291807){return _0x5514af['status'](_0x5e0a77)[_0x6a13('0x1a')](_0x291807);}};}function respondWithFilteredResult(_0xb3de1e,_0x2a7fc4){return function(_0x1cf8d1){if(_0x1cf8d1){var _0x317c40=typeof _0x2a7fc4[_0x6a13('0x1b')]===_0x6a13('0x1c')&&typeof _0x2a7fc4[_0x6a13('0x1d')]===_0x6a13('0x1c');var _0x4e6cda=_0x1cf8d1['count'];var _0xea18a0=_0x317c40?0x0:_0x2a7fc4[_0x6a13('0x1b')];var _0x3bb92c=_0x317c40?_0x1cf8d1['count']:_0x2a7fc4[_0x6a13('0x1b')]+_0x2a7fc4['limit'];var _0x4e8056;if(_0x3bb92c>=_0x4e6cda){_0x3bb92c=_0x4e6cda;_0x4e8056=0xc8;}else{_0x4e8056=0xce;}_0xb3de1e[_0x6a13('0x18')](_0x4e8056);return _0xb3de1e[_0x6a13('0x1e')](_0x6a13('0x1f'),_0xea18a0+'-'+_0x3bb92c+'/'+_0x4e6cda)['json'](_0x1cf8d1);}return null;};}function patchUpdates(_0x3364ad){return function(_0x2a59cc){try{jsonpatch[_0x6a13('0x20')](_0x2a59cc,_0x3364ad,!![]);}catch(_0x5c6271){return BPromise['reject'](_0x5c6271);}return _0x2a59cc[_0x6a13('0x21')]();};}function saveUpdates(_0x5609be,_0x4373de){return function(_0x26e7a6){if(_0x26e7a6){return _0x26e7a6['update'](_0x5609be)[_0x6a13('0x22')](function(_0x3b711a){return _0x3b711a;});}return null;};}function removeEntity(_0x251c7b,_0x2862c7){return function(_0xbeadf3){if(_0xbeadf3){return _0xbeadf3['destroy']()[_0x6a13('0x22')](function(){_0x251c7b[_0x6a13('0x18')](0xcc)[_0x6a13('0x19')]();});}};}function handleEntityNotFound(_0x4e70e7,_0x5056ad){return function(_0x356455){if(!_0x356455){_0x4e70e7['sendStatus'](0x194);}return _0x356455;};}function handleError(_0x5dfc2d,_0x5a0b6d){_0x5a0b6d=_0x5a0b6d||0x1f4;return function(_0x276b54){logger[_0x6a13('0x23')](_0x276b54[_0x6a13('0x24')]);if(_0x276b54[_0x6a13('0x25')]){delete _0x276b54['name'];}_0x5dfc2d[_0x6a13('0x18')](_0x5a0b6d)[_0x6a13('0x26')](_0x276b54);};}exports['index']=function(_0x27a893,_0x2b0645){var _0x131206={},_0x22d92f={},_0x284075={'count':0x0,'rows':[]};var _0x21aceb=_[_0x6a13('0x27')](db[_0x6a13('0x28')][_0x6a13('0x29')],function(_0x5efdb3){return{'name':_0x5efdb3['fieldName'],'type':_0x5efdb3[_0x6a13('0x2a')][_0x6a13('0x2b')]};});_0x22d92f[_0x6a13('0x2c')]=_['map'](_0x21aceb,_0x6a13('0x25'));_0x22d92f['query']=_[_0x6a13('0x2d')](_0x27a893['query']);_0x22d92f[_0x6a13('0x2e')]=_['intersection'](_0x22d92f['model'],_0x22d92f[_0x6a13('0x2f')]);_0x131206['attributes']=_[_0x6a13('0x30')](_0x22d92f['model'],qs[_0x6a13('0x31')](_0x27a893[_0x6a13('0x2f')][_0x6a13('0x31')]));_0x131206['attributes']=_0x131206[_0x6a13('0x32')][_0x6a13('0x33')]?_0x131206[_0x6a13('0x32')]:_0x22d92f['model'];if(!_0x27a893['query'][_0x6a13('0x34')]('nolimit')){_0x131206[_0x6a13('0x1d')]=qs[_0x6a13('0x1d')](_0x27a893[_0x6a13('0x2f')][_0x6a13('0x1d')]);_0x131206[_0x6a13('0x1b')]=qs['offset'](_0x27a893[_0x6a13('0x2f')][_0x6a13('0x1b')]);}_0x131206[_0x6a13('0x35')]=qs[_0x6a13('0x36')](_0x27a893[_0x6a13('0x2f')][_0x6a13('0x36')]);_0x131206[_0x6a13('0x37')]=qs[_0x6a13('0x2e')](_['pick'](_0x27a893[_0x6a13('0x2f')],_0x22d92f[_0x6a13('0x2e')]),_0x21aceb);if(_0x27a893['query'][_0x6a13('0x38')]){_0x131206['where']=_[_0x6a13('0x39')](_0x131206[_0x6a13('0x37')],{'$or':_[_0x6a13('0x27')](_0x21aceb,function(_0x6cb2d5){if(_0x6cb2d5[_0x6a13('0x2a')]!==_0x6a13('0x3a')){var _0x44bb9d={};_0x44bb9d[_0x6cb2d5[_0x6a13('0x25')]]={'$like':'%'+_0x27a893[_0x6a13('0x2f')][_0x6a13('0x38')]+'%'};return _0x44bb9d;}})});}_0x131206=_[_0x6a13('0x39')]({},_0x131206,_0x27a893['options']);var _0x3b8222={'where':_0x131206['where']};return db[_0x6a13('0x28')][_0x6a13('0x3b')](_0x3b8222)[_0x6a13('0x22')](function(_0x14aa82){_0x284075[_0x6a13('0x3b')]=_0x14aa82;if(_0x27a893['query'][_0x6a13('0x3c')]){_0x131206[_0x6a13('0x3d')]=[{'all':!![]}];}return db[_0x6a13('0x28')][_0x6a13('0x3e')](_0x131206);})['then'](function(_0xc78764){_0x284075[_0x6a13('0x3f')]=_0xc78764;return _0x284075;})[_0x6a13('0x22')](respondWithFilteredResult(_0x2b0645,_0x131206))[_0x6a13('0x40')](handleError(_0x2b0645,null));};exports[_0x6a13('0x41')]=function(_0x42f1ac,_0x488eca){var _0x300cdb={'raw':!![],'where':{'id':_0x42f1ac[_0x6a13('0x42')]['id']}},_0x11898d={};_0x11898d[_0x6a13('0x2c')]=_[_0x6a13('0x2d')](db[_0x6a13('0x28')][_0x6a13('0x29')]);_0x11898d[_0x6a13('0x2f')]=_[_0x6a13('0x2d')](_0x42f1ac[_0x6a13('0x2f')]);_0x11898d[_0x6a13('0x2e')]=_[_0x6a13('0x30')](_0x11898d[_0x6a13('0x2c')],_0x11898d['query']);_0x300cdb[_0x6a13('0x32')]=_[_0x6a13('0x30')](_0x11898d[_0x6a13('0x2c')],qs[_0x6a13('0x31')](_0x42f1ac[_0x6a13('0x2f')][_0x6a13('0x31')]));_0x300cdb[_0x6a13('0x32')]=_0x300cdb['attributes']['length']?_0x300cdb['attributes']:_0x11898d[_0x6a13('0x2c')];if(_0x42f1ac[_0x6a13('0x2f')]['includeAll']){_0x300cdb[_0x6a13('0x3d')]=[{'all':!![]}];}_0x300cdb=_[_0x6a13('0x39')]({},_0x300cdb,_0x42f1ac[_0x6a13('0x43')]);return db[_0x6a13('0x28')][_0x6a13('0x44')](_0x300cdb)['then'](handleEntityNotFound(_0x488eca,null))['then'](respondWithResult(_0x488eca,null))[_0x6a13('0x40')](handleError(_0x488eca,null));};exports[_0x6a13('0x45')]=function(_0xa86186,_0x254d1e){return db[_0x6a13('0x28')][_0x6a13('0x45')](_0xa86186[_0x6a13('0x46')],{})[_0x6a13('0x22')](respondWithResult(_0x254d1e,0xc9))['catch'](handleError(_0x254d1e,null));};exports[_0x6a13('0x47')]=function(_0x12bbe1,_0x1e6a74){if(_0x12bbe1[_0x6a13('0x46')]['id']){delete _0x12bbe1[_0x6a13('0x46')]['id'];}return db[_0x6a13('0x28')][_0x6a13('0x44')]({'where':{'id':_0x12bbe1[_0x6a13('0x42')]['id']}})[_0x6a13('0x22')](handleEntityNotFound(_0x1e6a74,null))['then'](saveUpdates(_0x12bbe1['body'],null))['then'](respondWithResult(_0x1e6a74,null))[_0x6a13('0x40')](handleError(_0x1e6a74,null));};exports[_0x6a13('0x48')]=function(_0x2f13d1,_0x19f3f9){return db[_0x6a13('0x28')]['find']({'where':{'id':_0x2f13d1[_0x6a13('0x42')]['id']}})[_0x6a13('0x22')](handleEntityNotFound(_0x19f3f9,null))[_0x6a13('0x22')](removeEntity(_0x19f3f9,null))[_0x6a13('0x40')](handleError(_0x19f3f9,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 04355de..fee4306 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 _0x832c=['define','Dynamics365Field','dynamics365_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x832c,0x91));var _0xc832=function(_0x371840,_0x3efb8d){_0x371840=_0x371840-0x0;var _0x465bde=_0x832c[_0x371840];return _0x465bde;};'use strict';var _=require(_0xc832('0x0'));var util=require(_0xc832('0x1'));var logger=require(_0xc832('0x2'))(_0xc832('0x3'));var moment=require(_0xc832('0x4'));var BPromise=require(_0xc832('0x5'));var rp=require(_0xc832('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc832('0x7'));var config=require(_0xc832('0x8'));var attributes=require('./intDynamics365Field.attributes');module['exports']=function(_0x132f3a,_0x3cf440){return _0x132f3a[_0xc832('0x9')](_0xc832('0xa'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0xc832('0xb'),'fields':[_0xc832('0xc'),_0xc832('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5041=['exports','int_dynamics365_fields','dynamics365_unique_index','../../config/logger','api','moment','request-promise','path','../../config/environment','./intDynamics365Field.attributes'];(function(_0x211fef,_0x4ab716){var _0x5447bf=function(_0x306ea3){while(--_0x306ea3){_0x211fef['push'](_0x211fef['shift']());}};_0x5447bf(++_0x4ab716);}(_0x5041,0x99));var _0x1504=function(_0x378d18,_0x17362b){_0x378d18=_0x378d18-0x0;var _0x52d233=_0x5041[_0x378d18];return _0x52d233;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1504('0x0'))(_0x1504('0x1'));var moment=require(_0x1504('0x2'));var BPromise=require('bluebird');var rp=require(_0x1504('0x3'));var fs=require('fs');var path=require(_0x1504('0x4'));var rimraf=require('rimraf');var config=require(_0x1504('0x5'));var attributes=require(_0x1504('0x6'));module[_0x1504('0x7')]=function(_0x5095ba,_0x27f96e){return _0x5095ba['define']('Dynamics365Field',attributes,{'tableName':_0x1504('0x8'),'paranoid':![],'indexes':[{'name':_0x1504('0x9'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index 944e4cd..a548224 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 _0x32df=['client','http','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x73b80e,_0x4daa4a){var _0x4c31cd=function(_0x3663a0){while(--_0x3663a0){_0x73b80e['push'](_0x73b80e['shift']());}};_0x4c31cd(++_0x4daa4a);}(_0x32df,0xe7));var _0xf32d=function(_0x547e67,_0x47df43){_0x547e67=_0x547e67-0x0;var _0xc791c5=_0x32df[_0x547e67];return _0xc791c5;};'use strict';var _=require(_0xf32d('0x0'));var util=require(_0xf32d('0x1'));var moment=require(_0xf32d('0x2'));var BPromise=require(_0xf32d('0x3'));var rs=require(_0xf32d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf32d('0x5'))['db'];var utils=require(_0xf32d('0x6'));var logger=require(_0xf32d('0x7'))(_0xf32d('0x8'));var config=require(_0xf32d('0x9'));var jayson=require(_0xf32d('0xa'));var client=jayson[_0xf32d('0xb')][_0xf32d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x17e3e5,_0x49f7cd,_0xbf0df5){return new BPromise(function(_0x51cda4,_0x381c8f){return client['request'](_0x17e3e5,_0xbf0df5)[_0xf32d('0xd')](function(_0x1cf56b){logger[_0xf32d('0xe')](_0xf32d('0xf'),_0x49f7cd,_0xf32d('0x10'));logger['debug'](_0xf32d('0x11'),_0x49f7cd,_0xf32d('0x10'),JSON[_0xf32d('0x12')](_0x1cf56b));if(_0x1cf56b[_0xf32d('0x13')]){if(_0x1cf56b[_0xf32d('0x13')][_0xf32d('0x14')]===0x1f4){logger[_0xf32d('0x13')]('Dynamics365Field,\x20%s,\x20%s',_0x49f7cd,_0x1cf56b[_0xf32d('0x13')][_0xf32d('0x15')]);return _0x381c8f(_0x1cf56b[_0xf32d('0x13')][_0xf32d('0x15')]);}logger[_0xf32d('0x13')](_0xf32d('0xf'),_0x49f7cd,_0x1cf56b[_0xf32d('0x13')][_0xf32d('0x15')]);return _0x51cda4(_0x1cf56b[_0xf32d('0x13')][_0xf32d('0x15')]);}else{logger[_0xf32d('0xe')](_0xf32d('0xf'),_0x49f7cd,_0xf32d('0x10'));_0x51cda4(_0x1cf56b['result'][_0xf32d('0x15')]);}})['catch'](function(_0x128ebe){logger[_0xf32d('0x13')](_0xf32d('0xf'),_0x49f7cd,_0x128ebe);_0x381c8f(_0x128ebe);});});} \ No newline at end of file +var _0x8912=['error','code','message','result','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x38adc4,_0x279319){var _0x20b733=function(_0x5012fd){while(--_0x5012fd){_0x38adc4['push'](_0x38adc4['shift']());}};_0x20b733(++_0x279319);}(_0x8912,0x10c));var _0x2891=function(_0x5455fd,_0x29e916){_0x5455fd=_0x5455fd-0x0;var _0xdd4f64=_0x8912[_0x5455fd];return _0xdd4f64;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2891('0x0'));var BPromise=require('bluebird');var rs=require(_0x2891('0x1'));var fs=require('fs');var Redis=require(_0x2891('0x2'));var db=require(_0x2891('0x3'))['db'];var utils=require(_0x2891('0x4'));var logger=require(_0x2891('0x5'))(_0x2891('0x6'));var config=require(_0x2891('0x7'));var jayson=require(_0x2891('0x8'));var client=jayson[_0x2891('0x9')][_0x2891('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3eda8b,_0x3cc4bb,_0x350408){return new BPromise(function(_0x40dc6a,_0x2b712a){return client[_0x2891('0xb')](_0x3eda8b,_0x350408)['then'](function(_0x152fb6){logger[_0x2891('0xc')](_0x2891('0xd'),_0x3cc4bb,_0x2891('0xe'));logger[_0x2891('0xf')](_0x2891('0x10'),_0x3cc4bb,_0x2891('0xe'),JSON[_0x2891('0x11')](_0x152fb6));if(_0x152fb6[_0x2891('0x12')]){if(_0x152fb6[_0x2891('0x12')][_0x2891('0x13')]===0x1f4){logger[_0x2891('0x12')](_0x2891('0xd'),_0x3cc4bb,_0x152fb6[_0x2891('0x12')][_0x2891('0x14')]);return _0x2b712a(_0x152fb6[_0x2891('0x12')][_0x2891('0x14')]);}logger[_0x2891('0x12')](_0x2891('0xd'),_0x3cc4bb,_0x152fb6['error'][_0x2891('0x14')]);return _0x40dc6a(_0x152fb6['error'][_0x2891('0x14')]);}else{logger[_0x2891('0xc')](_0x2891('0xd'),_0x3cc4bb,'request\x20sent');_0x40dc6a(_0x152fb6[_0x2891('0x15')][_0x2891('0x14')]);}})['catch'](function(_0x537f67){logger[_0x2891('0x12')](_0x2891('0xd'),_0x3cc4bb,_0x537f67);_0x2b712a(_0x537f67);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index aa6beec..a165aa6 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 _0x1734=['post','create','addConfiguration','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields'];(function(_0x13a704,_0x31dc21){var _0xe3e9aa=function(_0x52bb89){while(--_0x52bb89){_0x13a704['push'](_0x13a704['shift']());}};_0xe3e9aa(++_0x31dc21);}(_0x1734,0xfa));var _0x4173=function(_0x568162,_0x3df0a2){_0x568162=_0x568162-0x0;var _0x5c63bd=_0x1734[_0x568162];return _0x5c63bd;};'use strict';var multer=require('multer');var util=require(_0x4173('0x0'));var path=require(_0x4173('0x1'));var timeout=require(_0x4173('0x2'));var express=require(_0x4173('0x3'));var router=express[_0x4173('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4173('0x5'));var config=require('../../config/environment');var controller=require(_0x4173('0x6'));router[_0x4173('0x7')]('/',auth[_0x4173('0x8')](),controller[_0x4173('0x9')]);router['get'](_0x4173('0xa'),auth[_0x4173('0x8')](),controller[_0x4173('0xb')]);router[_0x4173('0x7')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x4173('0xc')]);router[_0x4173('0x7')](_0x4173('0xd'),auth[_0x4173('0x8')](),controller['getFields']);router[_0x4173('0xe')]('/',auth[_0x4173('0x8')](),controller[_0x4173('0xf')]);router['post']('/:id/configurations',auth[_0x4173('0x8')](),controller[_0x4173('0x10')]);router[_0x4173('0x11')]('/:id',auth[_0x4173('0x8')](),controller[_0x4173('0x12')]);router[_0x4173('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x4173('0x14')]);module[_0x4173('0x15')]=router; \ No newline at end of file +var _0x9209=['update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put'];(function(_0x2187f7,_0x5f7526){var _0xe6bf04=function(_0x1daa49){while(--_0x1daa49){_0x2187f7['push'](_0x2187f7['shift']());}};_0xe6bf04(++_0x5f7526);}(_0x9209,0xed));var _0x9920=function(_0x540821,_0x58149f){_0x540821=_0x540821-0x0;var _0x50869f=_0x9209[_0x540821];return _0x50869f;};'use strict';var multer=require(_0x9920('0x0'));var util=require(_0x9920('0x1'));var path=require(_0x9920('0x2'));var timeout=require(_0x9920('0x3'));var express=require(_0x9920('0x4'));var router=express['Router']();var fs_extra=require(_0x9920('0x5'));var auth=require(_0x9920('0x6'));var interaction=require(_0x9920('0x7'));var config=require(_0x9920('0x8'));var controller=require(_0x9920('0x9'));router[_0x9920('0xa')]('/',auth[_0x9920('0xb')](),controller[_0x9920('0xc')]);router[_0x9920('0xa')](_0x9920('0xd'),auth[_0x9920('0xb')](),controller[_0x9920('0xe')]);router[_0x9920('0xa')](_0x9920('0xf'),auth['isAuthenticated'](),controller[_0x9920('0x10')]);router['get'](_0x9920('0x11'),auth[_0x9920('0xb')](),controller[_0x9920('0x12')]);router[_0x9920('0x13')]('/',auth[_0x9920('0xb')](),controller[_0x9920('0x14')]);router['post'](_0x9920('0xf'),auth[_0x9920('0xb')](),controller[_0x9920('0x15')]);router[_0x9920('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x9920('0x17')]);router[_0x9920('0x18')](_0x9920('0xd'),auth[_0x9920('0xb')](),controller['destroy']);module[_0x9920('0x19')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 384a82f..28d2ce3 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 _0x7708=['sequelize','exports','STRING','remoteUri'];(function(_0xaba2a9,_0x33964e){var _0x326de2=function(_0x1279a7){while(--_0x1279a7){_0xaba2a9['push'](_0xaba2a9['shift']());}};_0x326de2(++_0x33964e);}(_0x7708,0x188));var _0x8770=function(_0x23a79e,_0x235f89){_0x23a79e=_0x23a79e-0x0;var _0x3dab57=_0x7708[_0x23a79e];return _0x3dab57;};'use strict';var Sequelize=require(_0x8770('0x0'));module[_0x8770('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8770('0x2')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x8770('0x3')},'serverUrl':{'type':Sequelize[_0x8770('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x1399=['exports','STRING','username','remoteUri','sequelize'];(function(_0x43a5c7,_0x2286bf){var _0x3b12a2=function(_0x1f8f53){while(--_0x1f8f53){_0x43a5c7['push'](_0x43a5c7['shift']());}};_0x3b12a2(++_0x2286bf);}(_0x1399,0x16c));var _0x9139=function(_0x21c0de,_0x4a9720){_0x21c0de=_0x21c0de-0x0;var _0x32229e=_0x1399[_0x21c0de];return _0x32229e;};'use strict';var Sequelize=require(_0x9139('0x0'));module[_0x9139('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9139('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x9139('0x3')},'apiKey':{'type':Sequelize[_0x9139('0x2')]},'remoteUri':{'type':Sequelize[_0x9139('0x2')],'unique':_0x9139('0x4')},'serverUrl':{'type':Sequelize[_0x9139('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 2739f0c..e5413af 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 _0x8ce8=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','include','findAll','catch','show','keys','find','create','body','params','getConfigurations','findOne','FreshdeskConfiguration','AccountId','channel','Subjects','FreshdeskField','Descriptions','getFields','remoteUri','apiKey','substring','lastIndexOf','GET','%s/%s','format','Basic\x20%s','requester','agent','description','priority','group','source','ticket_type','company','remove','includes','custom_text','custom_dropdown','label','choices','capitalize','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','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x5daa3d,_0x151f7f){var _0x4365ea=function(_0x4f573f){while(--_0x4f573f){_0x5daa3d['push'](_0x5daa3d['shift']());}};_0x4365ea(++_0x151f7f);}(_0x8ce8,0xd3));var _0x88ce=function(_0x5b7895,_0x43a21a){_0x5b7895=_0x5b7895-0x0;var _0x91fe05=_0x8ce8[_0x5b7895];return _0x91fe05;};'use strict';var emlformat=require(_0x88ce('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x88ce('0x1'));var jsonpatch=require(_0x88ce('0x2'));var rp=require(_0x88ce('0x3'));var moment=require(_0x88ce('0x4'));var BPromise=require(_0x88ce('0x5'));var Mustache=require(_0x88ce('0x6'));var util=require(_0x88ce('0x7'));var path=require(_0x88ce('0x8'));var sox=require(_0x88ce('0x9'));var csv=require(_0x88ce('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x88ce('0xb'));var squel=require(_0x88ce('0xc'));var crypto=require(_0x88ce('0xd'));var jsforce=require(_0x88ce('0xe'));var deskjs=require(_0x88ce('0xf'));var toCsv=require('to-csv');var querystring=require(_0x88ce('0x10'));var Papa=require('papaparse');var Redis=require(_0x88ce('0x11'));var authService=require(_0x88ce('0x12'));var qs=require(_0x88ce('0x13'));var as=require(_0x88ce('0x14'));var hardwareService=require(_0x88ce('0x15'));var logger=require(_0x88ce('0x16'))(_0x88ce('0x17'));var utils=require(_0x88ce('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x88ce('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0x88ce('0x1a'));function respondWithStatusCode(_0x3b67c8,_0x50b088){_0x50b088=_0x50b088||0xcc;return function(_0x4f06d1){if(_0x4f06d1){return _0x3b67c8[_0x88ce('0x1b')](_0x50b088);}return _0x3b67c8[_0x88ce('0x1c')](_0x50b088)[_0x88ce('0x1d')]();};}function respondWithResult(_0xad722b,_0x417896){_0x417896=_0x417896||0xc8;return function(_0x210e70){if(_0x210e70){return _0xad722b[_0x88ce('0x1c')](_0x417896)['json'](_0x210e70);}};}function respondWithFilteredResult(_0x3460e5,_0x5bcd5a){return function(_0x3da93e){if(_0x3da93e){var _0x58d3da=typeof _0x5bcd5a[_0x88ce('0x1e')]===_0x88ce('0x1f')&&typeof _0x5bcd5a[_0x88ce('0x20')]===_0x88ce('0x1f');var _0x509a84=_0x3da93e['count'];var _0xdb0d1f=_0x58d3da?0x0:_0x5bcd5a[_0x88ce('0x1e')];var _0x404df9=_0x58d3da?_0x3da93e[_0x88ce('0x21')]:_0x5bcd5a[_0x88ce('0x1e')]+_0x5bcd5a[_0x88ce('0x20')];var _0x461a8a;if(_0x404df9>=_0x509a84){_0x404df9=_0x509a84;_0x461a8a=0xc8;}else{_0x461a8a=0xce;}_0x3460e5[_0x88ce('0x1c')](_0x461a8a);return _0x3460e5[_0x88ce('0x22')](_0x88ce('0x23'),_0xdb0d1f+'-'+_0x404df9+'/'+_0x509a84)[_0x88ce('0x24')](_0x3da93e);}return null;};}function patchUpdates(_0x7de0ac){return function(_0xbe7eff){try{jsonpatch[_0x88ce('0x25')](_0xbe7eff,_0x7de0ac,!![]);}catch(_0x218308){return BPromise[_0x88ce('0x26')](_0x218308);}return _0xbe7eff['save']();};}function saveUpdates(_0x356d7d,_0x34fbcc){return function(_0x3bb68b){if(_0x3bb68b){return _0x3bb68b[_0x88ce('0x27')](_0x356d7d)[_0x88ce('0x28')](function(_0x4e45eb){return _0x4e45eb;});}return null;};}function removeEntity(_0x4c9133,_0x4dcdc4){return function(_0x22c911){if(_0x22c911){return _0x22c911[_0x88ce('0x29')]()[_0x88ce('0x28')](function(){_0x4c9133['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f0adc,_0x3383fa){return function(_0x1b9d39){if(!_0x1b9d39){_0x1f0adc[_0x88ce('0x1b')](0x194);}return _0x1b9d39;};}function handleError(_0x4b30db,_0x1efcea){_0x1efcea=_0x1efcea||0x1f4;return function(_0x19f00f){logger[_0x88ce('0x2a')](_0x19f00f[_0x88ce('0x2b')]);if(_0x19f00f[_0x88ce('0x2c')]){delete _0x19f00f[_0x88ce('0x2c')];}_0x4b30db[_0x88ce('0x1c')](_0x1efcea)[_0x88ce('0x2d')](_0x19f00f);};}exports[_0x88ce('0x2e')]=function(_0x12b9a1,_0x1814d1){var _0x47bbff={},_0x4f4205={},_0x5ceb03={'count':0x0,'rows':[]};var _0x157a28=_[_0x88ce('0x2f')](db[_0x88ce('0x30')][_0x88ce('0x31')],function(_0x544be7){return{'name':_0x544be7[_0x88ce('0x32')],'type':_0x544be7[_0x88ce('0x33')][_0x88ce('0x34')]};});_0x4f4205[_0x88ce('0x35')]=_[_0x88ce('0x2f')](_0x157a28,_0x88ce('0x2c'));_0x4f4205[_0x88ce('0x36')]=_['keys'](_0x12b9a1[_0x88ce('0x36')]);_0x4f4205[_0x88ce('0x37')]=_['intersection'](_0x4f4205[_0x88ce('0x35')],_0x4f4205[_0x88ce('0x36')]);_0x47bbff[_0x88ce('0x38')]=_[_0x88ce('0x39')](_0x4f4205[_0x88ce('0x35')],qs[_0x88ce('0x3a')](_0x12b9a1[_0x88ce('0x36')][_0x88ce('0x3a')]));_0x47bbff[_0x88ce('0x38')]=_0x47bbff['attributes'][_0x88ce('0x3b')]?_0x47bbff[_0x88ce('0x38')]:_0x4f4205[_0x88ce('0x35')];if(!_0x12b9a1['query'][_0x88ce('0x3c')](_0x88ce('0x3d'))){_0x47bbff['limit']=qs['limit'](_0x12b9a1[_0x88ce('0x36')][_0x88ce('0x20')]);_0x47bbff[_0x88ce('0x1e')]=qs[_0x88ce('0x1e')](_0x12b9a1[_0x88ce('0x36')][_0x88ce('0x1e')]);}_0x47bbff['order']=qs[_0x88ce('0x3e')](_0x12b9a1[_0x88ce('0x36')]['sort']);_0x47bbff[_0x88ce('0x3f')]=qs[_0x88ce('0x37')](_['pick'](_0x12b9a1[_0x88ce('0x36')],_0x4f4205['filters']),_0x157a28);if(_0x12b9a1[_0x88ce('0x36')][_0x88ce('0x40')]){_0x47bbff[_0x88ce('0x3f')]=_[_0x88ce('0x41')](_0x47bbff[_0x88ce('0x3f')],{'$or':_[_0x88ce('0x2f')](_0x157a28,function(_0x4e9b91){if(_0x4e9b91[_0x88ce('0x33')]!==_0x88ce('0x42')){var _0x24172a={};_0x24172a[_0x4e9b91[_0x88ce('0x2c')]]={'$like':'%'+_0x12b9a1['query'][_0x88ce('0x40')]+'%'};return _0x24172a;}})});}_0x47bbff=_[_0x88ce('0x41')]({},_0x47bbff,_0x12b9a1[_0x88ce('0x43')]);var _0x4cc1c2={'where':_0x47bbff['where']};return db[_0x88ce('0x30')][_0x88ce('0x21')](_0x4cc1c2)[_0x88ce('0x28')](function(_0x512e49){_0x5ceb03[_0x88ce('0x21')]=_0x512e49;if(_0x12b9a1[_0x88ce('0x36')]['includeAll']){_0x47bbff[_0x88ce('0x44')]=[{'all':!![]}];}return db[_0x88ce('0x30')][_0x88ce('0x45')](_0x47bbff);})[_0x88ce('0x28')](function(_0x3a4898){_0x5ceb03['rows']=_0x3a4898;return _0x5ceb03;})[_0x88ce('0x28')](respondWithFilteredResult(_0x1814d1,_0x47bbff))[_0x88ce('0x46')](handleError(_0x1814d1,null));};exports[_0x88ce('0x47')]=function(_0x123c83,_0x8132cc){var _0x29d440={'raw':![],'where':{'id':_0x123c83['params']['id']}},_0x39bfb8={};_0x39bfb8[_0x88ce('0x35')]=_[_0x88ce('0x48')](db['FreshdeskAccount'][_0x88ce('0x31')]);_0x39bfb8[_0x88ce('0x36')]=_['keys'](_0x123c83['query']);_0x39bfb8['filters']=_[_0x88ce('0x39')](_0x39bfb8[_0x88ce('0x35')],_0x39bfb8[_0x88ce('0x36')]);_0x29d440[_0x88ce('0x38')]=_[_0x88ce('0x39')](_0x39bfb8[_0x88ce('0x35')],qs[_0x88ce('0x3a')](_0x123c83['query'][_0x88ce('0x3a')]));_0x29d440['attributes']=_0x29d440[_0x88ce('0x38')][_0x88ce('0x3b')]?_0x29d440[_0x88ce('0x38')]:_0x39bfb8['model'];if(_0x123c83[_0x88ce('0x36')]['includeAll']){_0x29d440[_0x88ce('0x44')]=[{'all':!![]}];}_0x29d440=_[_0x88ce('0x41')]({},_0x29d440,_0x123c83[_0x88ce('0x43')]);return db[_0x88ce('0x30')][_0x88ce('0x49')](_0x29d440)[_0x88ce('0x28')](handleEntityNotFound(_0x8132cc,null))[_0x88ce('0x28')](respondWithResult(_0x8132cc,null))['catch'](handleError(_0x8132cc,null));};exports[_0x88ce('0x4a')]=function(_0x260015,_0x11f7b6){return db[_0x88ce('0x30')]['create'](_0x260015['body'],{})[_0x88ce('0x28')](respondWithResult(_0x11f7b6,0xc9))[_0x88ce('0x46')](handleError(_0x11f7b6,null));};exports[_0x88ce('0x27')]=function(_0x46d70a,_0x23967c){if(_0x46d70a[_0x88ce('0x4b')]['id']){delete _0x46d70a[_0x88ce('0x4b')]['id'];}return db['FreshdeskAccount']['find']({'where':{'id':_0x46d70a[_0x88ce('0x4c')]['id']}})['then'](handleEntityNotFound(_0x23967c,null))['then'](saveUpdates(_0x46d70a['body'],null))[_0x88ce('0x28')](respondWithResult(_0x23967c,null))['catch'](handleError(_0x23967c,null));};exports[_0x88ce('0x29')]=function(_0x23ca86,_0x2e6918){return db[_0x88ce('0x30')][_0x88ce('0x49')]({'where':{'id':_0x23ca86[_0x88ce('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2e6918,null))['then'](removeEntity(_0x2e6918,null))[_0x88ce('0x46')](handleError(_0x2e6918,null));};exports[_0x88ce('0x4d')]=function(_0x1c9e37,_0x1b961c,_0x4a8ec2){var _0x4c37c9={};var _0x464e80={};var _0x4877a3;var _0x36524e;return db[_0x88ce('0x30')][_0x88ce('0x4e')]({'where':{'id':_0x1c9e37[_0x88ce('0x4c')]['id']}})[_0x88ce('0x28')](handleEntityNotFound(_0x1b961c,null))[_0x88ce('0x28')](function(_0x3b9708){if(_0x3b9708){_0x4877a3=_0x3b9708;_0x464e80[_0x88ce('0x35')]=_[_0x88ce('0x48')](db[_0x88ce('0x4f')][_0x88ce('0x31')]);_0x464e80['query']=_[_0x88ce('0x48')](_0x1c9e37[_0x88ce('0x36')]);_0x464e80[_0x88ce('0x37')]=_[_0x88ce('0x39')](_0x464e80[_0x88ce('0x35')],_0x464e80[_0x88ce('0x36')]);_0x4c37c9['attributes']=_[_0x88ce('0x39')](_0x464e80['model'],qs[_0x88ce('0x3a')](_0x1c9e37[_0x88ce('0x36')][_0x88ce('0x3a')]));_0x4c37c9[_0x88ce('0x38')]=_0x4c37c9[_0x88ce('0x38')]['length']?_0x4c37c9[_0x88ce('0x38')]:_0x464e80[_0x88ce('0x35')];_0x4c37c9['order']=qs[_0x88ce('0x3e')](_0x1c9e37['query'][_0x88ce('0x3e')]);_0x4c37c9[_0x88ce('0x3f')]=qs[_0x88ce('0x37')](_['pick'](_0x1c9e37[_0x88ce('0x36')],_0x464e80[_0x88ce('0x37')]));if(_0x1c9e37[_0x88ce('0x36')][_0x88ce('0x40')]){_0x4c37c9[_0x88ce('0x3f')]=_[_0x88ce('0x41')](_0x4c37c9[_0x88ce('0x3f')],{'$or':_[_0x88ce('0x2f')](_0x4c37c9[_0x88ce('0x38')],function(_0x58e019){var _0x49d9fd={};_0x49d9fd[_0x58e019]={'$like':'%'+_0x1c9e37[_0x88ce('0x36')][_0x88ce('0x40')]+'%'};return _0x49d9fd;})});}_0x4c37c9=_[_0x88ce('0x41')]({},_0x4c37c9,_0x1c9e37['options']);return _0x4877a3[_0x88ce('0x4d')](_0x4c37c9);}})['then'](function(_0x4bcd10){if(_0x4bcd10){_0x36524e=_0x4bcd10['length'];if(!_0x1c9e37[_0x88ce('0x36')]['hasOwnProperty'](_0x88ce('0x3d'))){_0x4c37c9[_0x88ce('0x20')]=qs[_0x88ce('0x20')](_0x1c9e37['query'][_0x88ce('0x20')]);_0x4c37c9['offset']=qs[_0x88ce('0x1e')](_0x1c9e37[_0x88ce('0x36')][_0x88ce('0x1e')]);}return _0x4877a3[_0x88ce('0x4d')](_0x4c37c9);}})['then'](function(_0x38e936){if(_0x38e936){return _0x38e936?{'count':_0x36524e,'rows':_0x38e936}:null;}})[_0x88ce('0x28')](respondWithResult(_0x1b961c,null))[_0x88ce('0x46')](handleError(_0x1b961c,null));};exports['addConfiguration']=function(_0x590d79,_0x5cddfd,_0x3e4a6b){if(_0x590d79[_0x88ce('0x4b')]['id']){delete _0x590d79[_0x88ce('0x4b')]['id'];}return db[_0x88ce('0x30')]['findOne']({'where':{'id':_0x590d79['params']['id']}})['then'](handleEntityNotFound(_0x5cddfd,null))[_0x88ce('0x28')](function(_0x287a7d){if(_0x287a7d){_0x590d79[_0x88ce('0x4b')][_0x88ce('0x50')]=_0x287a7d['id'];_0x590d79[_0x88ce('0x4b')]['Subjects']=integrations['getSubjects'](_0x590d79[_0x88ce('0x4b')][_0x88ce('0x51')],_0x590d79[_0x88ce('0x4b')][_0x88ce('0x33')]);_0x590d79[_0x88ce('0x4b')]['Descriptions']=integrations['getDescriptions'](_0x590d79[_0x88ce('0x4b')][_0x88ce('0x51')],_0x590d79[_0x88ce('0x4b')][_0x88ce('0x33')]);return db['FreshdeskConfiguration'][_0x88ce('0x4a')](_0x590d79['body'],{'include':[{'model':db['FreshdeskField'],'as':_0x88ce('0x52')},{'model':db[_0x88ce('0x53')],'as':_0x88ce('0x54')}]});}return null;})[_0x88ce('0x28')](respondWithResult(_0x5cddfd,null))[_0x88ce('0x46')](handleError(_0x5cddfd,null));};exports[_0x88ce('0x55')]=function(_0x19d365,_0x1f34d1,_0x41fc76){var _0x26d167='';return db[_0x88ce('0x30')][_0x88ce('0x4e')]({'where':{'id':_0x19d365[_0x88ce('0x4c')]['id']},'attributes':['id',_0x88ce('0x56'),_0x88ce('0x57')]})[_0x88ce('0x28')](handleEntityNotFound(_0x1f34d1,null))[_0x88ce('0x28')](function(_0x458343){if(_0x458343){_0x26d167=_0x458343[_0x88ce('0x56')];var _0x4c182b=_0x26d167['slice'](-0x1);if(_0x4c182b==='/'){_0x26d167=_0x26d167[_0x88ce('0x58')](0x0,_0x26d167[_0x88ce('0x59')](_0x4c182b));}return rp({'method':_0x88ce('0x5a'),'uri':util['format'](_0x88ce('0x5b'),_0x26d167,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0x88ce('0x5c')](_0x88ce('0x5d'),new Buffer(util[_0x88ce('0x5c')]('%s:X',_0x458343['apiKey']))['toString']('base64'))},'json':!![]});}})['then'](function(_0x5220cc){if(_0x5220cc){var _0x3359ea=[_0x88ce('0x5e'),'subject',_0x88ce('0x5f'),_0x88ce('0x60'),_0x88ce('0x1c'),_0x88ce('0x61'),_0x88ce('0x62'),_0x88ce('0x63'),_0x88ce('0x64'),_0x88ce('0x62'),_0x88ce('0x65')];_[_0x88ce('0x66')](_0x5220cc,function(_0x168fd9){return _0x3359ea[_0x88ce('0x67')](_0x168fd9[_0x88ce('0x2c')])||!_0x168fd9['default']&&_0x168fd9['type']!==_0x88ce('0x68')&&_0x168fd9[_0x88ce('0x33')]!==_0x88ce('0x69');});return{'count':_0x5220cc[_0x88ce('0x3b')],'rows':_['map'](_0x5220cc,function(_0x2fb876){return{'id':_0x2fb876[_0x88ce('0x2c')],'name':_0x2fb876[_0x88ce('0x6a')],'custom':!_0x2fb876['default'],'options':_0x2fb876['choices']?_[_0x88ce('0x2f')](_0x2fb876[_0x88ce('0x6b')],function(_0x15ea43){return{'name':_[_0x88ce('0x6c')](_0x15ea43),'value':_0x15ea43};}):[]};})};}})['then'](respondWithResult(_0x1f34d1,null))[_0x88ce('0x46')](function(_0x12063a){var _0x2725b1=_0x19d365[_0x88ce('0x36')][_0x88ce('0x6d')]?0x1f4:_0x12063a[_0x88ce('0x6e')]||0x1f4;logger[_0x88ce('0x2a')](_0x88ce('0x6f'),_0x88ce('0x55'),_0x2725b1,JSON[_0x88ce('0x70')](_0x12063a));delete _0x12063a[_0x88ce('0x2c')];if(_0x2725b1===0x191){_0x2725b1=0x190;}_0x1f34d1['status'](_0x2725b1)[_0x88ce('0x2d')](_0x19d365[_0x88ce('0x36')][_0x88ce('0x6d')]?{'message':_0x88ce('0x71'),'statusCode':_0x12063a['statusCode']}:_0x12063a);});}; \ No newline at end of file +var _0x780f=['request-promise','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','undefined','limit','count','set','Content-Range','apply','reject','update','then','error','send','index','map','FreshdeskAccount','rawAttributes','type','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','where','pick','merge','filter','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','destroy','getConfigurations','findOne','FreshdeskConfiguration','addConfiguration','AccountId','Subjects','channel','Descriptions','FreshdeskField','getFields','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','%s:X','toString','base64','requester','agent','description','priority','group','ticket_type','company','default','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x2b1873,_0x3e9388){var _0x3008c1=function(_0x510c7f){while(--_0x510c7f){_0x2b1873['push'](_0x2b1873['shift']());}};_0x3008c1(++_0x3e9388);}(_0x780f,0x6c));var _0xf780=function(_0x4a4922,_0x82cb8f){_0x4a4922=_0x4a4922-0x0;var _0x55a8c6=_0x780f[_0x4a4922];return _0x55a8c6;};'use strict';var emlformat=require(_0xf780('0x0'));var rimraf=require(_0xf780('0x1'));var zipdir=require(_0xf780('0x2'));var jsonpatch=require(_0xf780('0x3'));var rp=require(_0xf780('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf780('0x5'));var util=require(_0xf780('0x6'));var path=require(_0xf780('0x7'));var sox=require(_0xf780('0x8'));var csv=require('to-csv');var ejs=require(_0xf780('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf780('0xa'));var squel=require(_0xf780('0xb'));var crypto=require(_0xf780('0xc'));var jsforce=require(_0xf780('0xd'));var deskjs=require(_0xf780('0xe'));var toCsv=require(_0xf780('0xf'));var querystring=require('querystring');var Papa=require(_0xf780('0x10'));var Redis=require(_0xf780('0x11'));var authService=require(_0xf780('0x12'));var qs=require(_0xf780('0x13'));var as=require(_0xf780('0x14'));var hardwareService=require(_0xf780('0x15'));var logger=require(_0xf780('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xf780('0x17'));var licenseUtil=require(_0xf780('0x18'));var db=require(_0xf780('0x19'))['db'];var integrations=require(_0xf780('0x1a'));function respondWithStatusCode(_0x5f04e1,_0x24aa4f){_0x24aa4f=_0x24aa4f||0xcc;return function(_0xcf2da6){if(_0xcf2da6){return _0x5f04e1[_0xf780('0x1b')](_0x24aa4f);}return _0x5f04e1[_0xf780('0x1c')](_0x24aa4f)['end']();};}function respondWithResult(_0x5a64bc,_0x4be599){_0x4be599=_0x4be599||0xc8;return function(_0x2a19fb){if(_0x2a19fb){return _0x5a64bc[_0xf780('0x1c')](_0x4be599)[_0xf780('0x1d')](_0x2a19fb);}};}function respondWithFilteredResult(_0x187b6d,_0x206d34){return function(_0x335ba6){if(_0x335ba6){var _0x422ef4=typeof _0x206d34['offset']===_0xf780('0x1e')&&typeof _0x206d34[_0xf780('0x1f')]===_0xf780('0x1e');var _0x113834=_0x335ba6[_0xf780('0x20')];var _0x188554=_0x422ef4?0x0:_0x206d34['offset'];var _0x3ede41=_0x422ef4?_0x335ba6[_0xf780('0x20')]:_0x206d34['offset']+_0x206d34[_0xf780('0x1f')];var _0x3fe0a7;if(_0x3ede41>=_0x113834){_0x3ede41=_0x113834;_0x3fe0a7=0xc8;}else{_0x3fe0a7=0xce;}_0x187b6d['status'](_0x3fe0a7);return _0x187b6d[_0xf780('0x21')](_0xf780('0x22'),_0x188554+'-'+_0x3ede41+'/'+_0x113834)[_0xf780('0x1d')](_0x335ba6);}return null;};}function patchUpdates(_0x4065bb){return function(_0x352cf1){try{jsonpatch[_0xf780('0x23')](_0x352cf1,_0x4065bb,!![]);}catch(_0x504f6f){return BPromise[_0xf780('0x24')](_0x504f6f);}return _0x352cf1['save']();};}function saveUpdates(_0x5853ea,_0x45d80e){return function(_0x51b921){if(_0x51b921){return _0x51b921[_0xf780('0x25')](_0x5853ea)['then'](function(_0x2fcb2d){return _0x2fcb2d;});}return null;};}function removeEntity(_0x373dce,_0x4f59b1){return function(_0x3a8327){if(_0x3a8327){return _0x3a8327['destroy']()[_0xf780('0x26')](function(){_0x373dce[_0xf780('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x589208,_0x3710bb){return function(_0x1ef4f1){if(!_0x1ef4f1){_0x589208[_0xf780('0x1b')](0x194);}return _0x1ef4f1;};}function handleError(_0x40d9c9,_0x458c76){_0x458c76=_0x458c76||0x1f4;return function(_0x2bd6cf){logger[_0xf780('0x27')](_0x2bd6cf['stack']);if(_0x2bd6cf['name']){delete _0x2bd6cf['name'];}_0x40d9c9[_0xf780('0x1c')](_0x458c76)[_0xf780('0x28')](_0x2bd6cf);};}exports[_0xf780('0x29')]=function(_0x4ef8c3,_0x4ed256){var _0x36bc63={},_0x149190={},_0x2b832d={'count':0x0,'rows':[]};var _0x5e6b25=_[_0xf780('0x2a')](db[_0xf780('0x2b')][_0xf780('0x2c')],function(_0x302594){return{'name':_0x302594['fieldName'],'type':_0x302594[_0xf780('0x2d')]['key']};});_0x149190[_0xf780('0x2e')]=_[_0xf780('0x2a')](_0x5e6b25,_0xf780('0x2f'));_0x149190[_0xf780('0x30')]=_[_0xf780('0x31')](_0x4ef8c3[_0xf780('0x30')]);_0x149190[_0xf780('0x32')]=_[_0xf780('0x33')](_0x149190['model'],_0x149190[_0xf780('0x30')]);_0x36bc63[_0xf780('0x34')]=_[_0xf780('0x33')](_0x149190[_0xf780('0x2e')],qs[_0xf780('0x35')](_0x4ef8c3['query'][_0xf780('0x35')]));_0x36bc63['attributes']=_0x36bc63[_0xf780('0x34')][_0xf780('0x36')]?_0x36bc63[_0xf780('0x34')]:_0x149190['model'];if(!_0x4ef8c3[_0xf780('0x30')][_0xf780('0x37')](_0xf780('0x38'))){_0x36bc63[_0xf780('0x1f')]=qs['limit'](_0x4ef8c3[_0xf780('0x30')]['limit']);_0x36bc63[_0xf780('0x39')]=qs['offset'](_0x4ef8c3['query'][_0xf780('0x39')]);}_0x36bc63['order']=qs[_0xf780('0x3a')](_0x4ef8c3[_0xf780('0x30')][_0xf780('0x3a')]);_0x36bc63[_0xf780('0x3b')]=qs['filters'](_[_0xf780('0x3c')](_0x4ef8c3[_0xf780('0x30')],_0x149190[_0xf780('0x32')]),_0x5e6b25);if(_0x4ef8c3[_0xf780('0x30')]['filter']){_0x36bc63[_0xf780('0x3b')]=_[_0xf780('0x3d')](_0x36bc63[_0xf780('0x3b')],{'$or':_[_0xf780('0x2a')](_0x5e6b25,function(_0x1a5ebf){if(_0x1a5ebf['type']!=='VIRTUAL'){var _0x3297c9={};_0x3297c9[_0x1a5ebf[_0xf780('0x2f')]]={'$like':'%'+_0x4ef8c3[_0xf780('0x30')][_0xf780('0x3e')]+'%'};return _0x3297c9;}})});}_0x36bc63=_[_0xf780('0x3d')]({},_0x36bc63,_0x4ef8c3['options']);var _0x1c8eb3={'where':_0x36bc63['where']};return db[_0xf780('0x2b')][_0xf780('0x20')](_0x1c8eb3)[_0xf780('0x26')](function(_0x120465){_0x2b832d['count']=_0x120465;if(_0x4ef8c3[_0xf780('0x30')][_0xf780('0x3f')]){_0x36bc63[_0xf780('0x40')]=[{'all':!![]}];}return db[_0xf780('0x2b')][_0xf780('0x41')](_0x36bc63);})[_0xf780('0x26')](function(_0x2109dc){_0x2b832d[_0xf780('0x42')]=_0x2109dc;return _0x2b832d;})[_0xf780('0x26')](respondWithFilteredResult(_0x4ed256,_0x36bc63))[_0xf780('0x43')](handleError(_0x4ed256,null));};exports[_0xf780('0x44')]=function(_0x30a036,_0x406a9e){var _0x42a710={'raw':![],'where':{'id':_0x30a036[_0xf780('0x45')]['id']}},_0x558b9a={};_0x558b9a['model']=_[_0xf780('0x31')](db[_0xf780('0x2b')]['rawAttributes']);_0x558b9a['query']=_['keys'](_0x30a036['query']);_0x558b9a[_0xf780('0x32')]=_['intersection'](_0x558b9a[_0xf780('0x2e')],_0x558b9a[_0xf780('0x30')]);_0x42a710[_0xf780('0x34')]=_[_0xf780('0x33')](_0x558b9a[_0xf780('0x2e')],qs['fields'](_0x30a036['query']['fields']));_0x42a710['attributes']=_0x42a710[_0xf780('0x34')][_0xf780('0x36')]?_0x42a710[_0xf780('0x34')]:_0x558b9a[_0xf780('0x2e')];if(_0x30a036[_0xf780('0x30')][_0xf780('0x3f')]){_0x42a710['include']=[{'all':!![]}];}_0x42a710=_[_0xf780('0x3d')]({},_0x42a710,_0x30a036[_0xf780('0x46')]);return db[_0xf780('0x2b')][_0xf780('0x47')](_0x42a710)[_0xf780('0x26')](handleEntityNotFound(_0x406a9e,null))[_0xf780('0x26')](respondWithResult(_0x406a9e,null))['catch'](handleError(_0x406a9e,null));};exports[_0xf780('0x48')]=function(_0x5c4170,_0x2f08f3){return db['FreshdeskAccount'][_0xf780('0x48')](_0x5c4170['body'],{})['then'](respondWithResult(_0x2f08f3,0xc9))[_0xf780('0x43')](handleError(_0x2f08f3,null));};exports[_0xf780('0x25')]=function(_0x189717,_0x2946a1){if(_0x189717['body']['id']){delete _0x189717[_0xf780('0x49')]['id'];}return db[_0xf780('0x2b')][_0xf780('0x47')]({'where':{'id':_0x189717[_0xf780('0x45')]['id']}})[_0xf780('0x26')](handleEntityNotFound(_0x2946a1,null))['then'](saveUpdates(_0x189717[_0xf780('0x49')],null))['then'](respondWithResult(_0x2946a1,null))[_0xf780('0x43')](handleError(_0x2946a1,null));};exports[_0xf780('0x4a')]=function(_0x22c52d,_0x45ae96){return db[_0xf780('0x2b')]['find']({'where':{'id':_0x22c52d['params']['id']}})[_0xf780('0x26')](handleEntityNotFound(_0x45ae96,null))[_0xf780('0x26')](removeEntity(_0x45ae96,null))[_0xf780('0x43')](handleError(_0x45ae96,null));};exports[_0xf780('0x4b')]=function(_0x4eebe5,_0x4094d5,_0x476354){var _0x180507={};var _0x3f71d2={};var _0x42bcc6;var _0x3b98c7;return db['FreshdeskAccount'][_0xf780('0x4c')]({'where':{'id':_0x4eebe5[_0xf780('0x45')]['id']}})['then'](handleEntityNotFound(_0x4094d5,null))[_0xf780('0x26')](function(_0x1f1907){if(_0x1f1907){_0x42bcc6=_0x1f1907;_0x3f71d2[_0xf780('0x2e')]=_[_0xf780('0x31')](db[_0xf780('0x4d')][_0xf780('0x2c')]);_0x3f71d2[_0xf780('0x30')]=_[_0xf780('0x31')](_0x4eebe5[_0xf780('0x30')]);_0x3f71d2[_0xf780('0x32')]=_[_0xf780('0x33')](_0x3f71d2[_0xf780('0x2e')],_0x3f71d2['query']);_0x180507[_0xf780('0x34')]=_['intersection'](_0x3f71d2[_0xf780('0x2e')],qs[_0xf780('0x35')](_0x4eebe5['query']['fields']));_0x180507['attributes']=_0x180507[_0xf780('0x34')][_0xf780('0x36')]?_0x180507[_0xf780('0x34')]:_0x3f71d2['model'];_0x180507['order']=qs['sort'](_0x4eebe5[_0xf780('0x30')]['sort']);_0x180507[_0xf780('0x3b')]=qs[_0xf780('0x32')](_[_0xf780('0x3c')](_0x4eebe5['query'],_0x3f71d2[_0xf780('0x32')]));if(_0x4eebe5['query'][_0xf780('0x3e')]){_0x180507[_0xf780('0x3b')]=_['merge'](_0x180507[_0xf780('0x3b')],{'$or':_[_0xf780('0x2a')](_0x180507[_0xf780('0x34')],function(_0x1c6799){var _0x2abf0e={};_0x2abf0e[_0x1c6799]={'$like':'%'+_0x4eebe5[_0xf780('0x30')][_0xf780('0x3e')]+'%'};return _0x2abf0e;})});}_0x180507=_['merge']({},_0x180507,_0x4eebe5['options']);return _0x42bcc6[_0xf780('0x4b')](_0x180507);}})[_0xf780('0x26')](function(_0x586545){if(_0x586545){_0x3b98c7=_0x586545[_0xf780('0x36')];if(!_0x4eebe5[_0xf780('0x30')][_0xf780('0x37')](_0xf780('0x38'))){_0x180507[_0xf780('0x1f')]=qs['limit'](_0x4eebe5['query'][_0xf780('0x1f')]);_0x180507['offset']=qs[_0xf780('0x39')](_0x4eebe5['query'][_0xf780('0x39')]);}return _0x42bcc6[_0xf780('0x4b')](_0x180507);}})[_0xf780('0x26')](function(_0x42ec59){if(_0x42ec59){return _0x42ec59?{'count':_0x3b98c7,'rows':_0x42ec59}:null;}})[_0xf780('0x26')](respondWithResult(_0x4094d5,null))['catch'](handleError(_0x4094d5,null));};exports[_0xf780('0x4e')]=function(_0x20dc15,_0x2a9180,_0x4a420f){if(_0x20dc15['body']['id']){delete _0x20dc15[_0xf780('0x49')]['id'];}return db[_0xf780('0x2b')][_0xf780('0x4c')]({'where':{'id':_0x20dc15['params']['id']}})['then'](handleEntityNotFound(_0x2a9180,null))[_0xf780('0x26')](function(_0x24bdcb){if(_0x24bdcb){_0x20dc15[_0xf780('0x49')][_0xf780('0x4f')]=_0x24bdcb['id'];_0x20dc15[_0xf780('0x49')][_0xf780('0x50')]=integrations['getSubjects'](_0x20dc15[_0xf780('0x49')][_0xf780('0x51')],_0x20dc15[_0xf780('0x49')]['type']);_0x20dc15['body'][_0xf780('0x52')]=integrations['getDescriptions'](_0x20dc15[_0xf780('0x49')][_0xf780('0x51')],_0x20dc15[_0xf780('0x49')][_0xf780('0x2d')]);return db[_0xf780('0x4d')][_0xf780('0x48')](_0x20dc15[_0xf780('0x49')],{'include':[{'model':db[_0xf780('0x53')],'as':_0xf780('0x50')},{'model':db[_0xf780('0x53')],'as':_0xf780('0x52')}]});}return null;})[_0xf780('0x26')](respondWithResult(_0x2a9180,null))[_0xf780('0x43')](handleError(_0x2a9180,null));};exports[_0xf780('0x54')]=function(_0x4110fb,_0x2ee4ae,_0x5a64aa){var _0x70e8ad='';return db['FreshdeskAccount'][_0xf780('0x4c')]({'where':{'id':_0x4110fb[_0xf780('0x45')]['id']},'attributes':['id',_0xf780('0x55'),'apiKey']})[_0xf780('0x26')](handleEntityNotFound(_0x2ee4ae,null))[_0xf780('0x26')](function(_0x1aad32){if(_0x1aad32){_0x70e8ad=_0x1aad32[_0xf780('0x55')];var _0x3371f7=_0x70e8ad[_0xf780('0x56')](-0x1);if(_0x3371f7==='/'){_0x70e8ad=_0x70e8ad[_0xf780('0x57')](0x0,_0x70e8ad[_0xf780('0x58')](_0x3371f7));}return rp({'method':_0xf780('0x59'),'uri':util[_0xf780('0x5a')](_0xf780('0x5b'),_0x70e8ad,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0xf780('0x5a')]('Basic\x20%s',new Buffer(util['format'](_0xf780('0x5c'),_0x1aad32['apiKey']))[_0xf780('0x5d')](_0xf780('0x5e')))},'json':!![]});}})['then'](function(_0x46636a){if(_0x46636a){var _0x380601=[_0xf780('0x5f'),'subject',_0xf780('0x60'),_0xf780('0x61'),_0xf780('0x1c'),_0xf780('0x62'),_0xf780('0x63'),'source',_0xf780('0x64'),_0xf780('0x63'),_0xf780('0x65')];_['remove'](_0x46636a,function(_0x297052){return _0x380601['includes'](_0x297052[_0xf780('0x2f')])||!_0x297052[_0xf780('0x66')]&&_0x297052[_0xf780('0x2d')]!==_0xf780('0x67')&&_0x297052[_0xf780('0x2d')]!==_0xf780('0x68');});return{'count':_0x46636a[_0xf780('0x36')],'rows':_['map'](_0x46636a,function(_0x439082){return{'id':_0x439082[_0xf780('0x2f')],'name':_0x439082[_0xf780('0x69')],'custom':!_0x439082['default'],'options':_0x439082[_0xf780('0x6a')]?_[_0xf780('0x2a')](_0x439082[_0xf780('0x6a')],function(_0x5a8e82){return{'name':_[_0xf780('0x6b')](_0x5a8e82),'value':_0x5a8e82};}):[]};})};}})[_0xf780('0x26')](respondWithResult(_0x2ee4ae,null))[_0xf780('0x43')](function(_0x3d6dfb){var _0x4c527e=_0x4110fb[_0xf780('0x30')][_0xf780('0x6c')]?0x1f4:_0x3d6dfb[_0xf780('0x6d')]||0x1f4;logger[_0xf780('0x27')]('getFields,\x20%s,\x20%s,\x20%s',_0xf780('0x54'),_0x4c527e,JSON[_0xf780('0x6e')](_0x3d6dfb));delete _0x3d6dfb[_0xf780('0x2f')];if(_0x4c527e===0x191){_0x4c527e=0x190;}_0x2ee4ae[_0xf780('0x1c')](_0x4c527e)['send'](_0x4110fb[_0xf780('0x30')]['test']?{'message':_0xf780('0x6f'),'statusCode':_0x3d6dfb[_0xf780('0x6d')]}:_0x3d6dfb);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 30abd56..e134b0b 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 _0x8cb6=['moment','path','rimraf','./intFreshdeskAccount.attributes','../../components/integrations/configuration','int_freshdesk_accounts','lodash','util'];(function(_0x2d0c51,_0x52a21f){var _0x2f0bb5=function(_0x2cc7b7){while(--_0x2cc7b7){_0x2d0c51['push'](_0x2d0c51['shift']());}};_0x2f0bb5(++_0x52a21f);}(_0x8cb6,0x1ae));var _0x68cb=function(_0x45b771,_0x2caece){_0x45b771=_0x45b771-0x0;var _0x7ef73d=_0x8cb6[_0x45b771];return _0x7ef73d;};'use strict';var _=require(_0x68cb('0x0'));var util=require(_0x68cb('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x68cb('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x68cb('0x3'));var rimraf=require(_0x68cb('0x4'));var config=require('../../config/environment');var attributes=require(_0x68cb('0x5'));var integrations=require(_0x68cb('0x6'));module['exports']=function(_0x2932ca,_0x5a55b7){return _0x2932ca['define']('FreshdeskAccount',attributes,{'tableName':_0x68cb('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb210=['bluebird','path','./intFreshdeskAccount.attributes','../../components/integrations/configuration','define','FreshdeskAccount','int_freshdesk_accounts','util','../../config/logger','api','moment'];(function(_0x4b87a3,_0x3a698c){var _0x334112=function(_0x3e8fb0){while(--_0x3e8fb0){_0x4b87a3['push'](_0x4b87a3['shift']());}};_0x334112(++_0x3a698c);}(_0xb210,0x15c));var _0x0b21=function(_0x430d9c,_0x8e3c41){_0x430d9c=_0x430d9c-0x0;var _0x243ec7=_0xb210[_0x430d9c];return _0x243ec7;};'use strict';var _=require('lodash');var util=require(_0x0b21('0x0'));var logger=require(_0x0b21('0x1'))(_0x0b21('0x2'));var moment=require(_0x0b21('0x3'));var BPromise=require(_0x0b21('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0b21('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0b21('0x6'));var integrations=require(_0x0b21('0x7'));module['exports']=function(_0xe36f51,_0x9b89ca){return _0xe36f51[_0x0b21('0x8')](_0x0b21('0x9'),attributes,{'tableName':_0x0b21('0xa'),'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 d48f30a..a3d6016 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 _0xea1c=['options','raw','limit','include','attributes','model','info','stringify','catch','ShowFreshdeskAccount','find','where','map','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','GetFreshdeskAccount','FreshdeskAccount','findAll'];(function(_0x8853b1,_0x3319ec){var _0x428c8d=function(_0x326635){while(--_0x326635){_0x8853b1['push'](_0x8853b1['shift']());}};_0x428c8d(++_0x3319ec);}(_0xea1c,0xc1));var _0xcea1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xea1c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xcea1('0x0'));var moment=require(_0xcea1('0x1'));var BPromise=require(_0xcea1('0x2'));var rs=require(_0xcea1('0x3'));var fs=require('fs');var Redis=require(_0xcea1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xcea1('0x5'));var logger=require(_0xcea1('0x6'))('rpc');var config=require(_0xcea1('0x7'));var jayson=require(_0xcea1('0x8'));var client=jayson[_0xcea1('0x9')][_0xcea1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5b97d7,_0x5875d1,_0x593e11){return new BPromise(function(_0x5c454d,_0x20ef17){return client['request'](_0x5b97d7,_0x593e11)[_0xcea1('0xb')](function(_0x1b7d73){logger['info'](_0xcea1('0xc'),_0x5875d1,_0xcea1('0xd'));logger[_0xcea1('0xe')](_0xcea1('0xf'),_0x5875d1,_0xcea1('0xd'),JSON['stringify'](_0x1b7d73));if(_0x1b7d73['error']){if(_0x1b7d73[_0xcea1('0x10')][_0xcea1('0x11')]===0x1f4){logger[_0xcea1('0x10')](_0xcea1('0xc'),_0x5875d1,_0x1b7d73['error']['message']);return _0x20ef17(_0x1b7d73['error'][_0xcea1('0x12')]);}logger[_0xcea1('0x10')](_0xcea1('0xc'),_0x5875d1,_0x1b7d73[_0xcea1('0x10')][_0xcea1('0x12')]);return _0x5c454d(_0x1b7d73['error'][_0xcea1('0x12')]);}else{logger['info'](_0xcea1('0xc'),_0x5875d1,_0xcea1('0xd'));_0x5c454d(_0x1b7d73[_0xcea1('0x13')]['message']);}})['catch'](function(_0x574300){logger[_0xcea1('0x10')]('FreshdeskAccount,\x20%s,\x20%s',_0x5875d1,_0x574300);_0x20ef17(_0x574300);});});}exports[_0xcea1('0x14')]=function(_0x22c564){var _0x19b094=this;return new Promise(function(_0x140ea4,_0x3eb4da){return db[_0xcea1('0x15')][_0xcea1('0x16')]({'raw':_0x22c564[_0xcea1('0x17')]?_0x22c564[_0xcea1('0x17')][_0xcea1('0x18')]===undefined?!![]:![]:!![],'where':_0x22c564[_0xcea1('0x17')]?_0x22c564[_0xcea1('0x17')]['where']||null:null,'attributes':_0x22c564[_0xcea1('0x17')]?_0x22c564[_0xcea1('0x17')]['attributes']||null:null,'limit':_0x22c564[_0xcea1('0x17')]?_0x22c564[_0xcea1('0x17')][_0xcea1('0x19')]||null:null,'include':_0x22c564['options']?_0x22c564[_0xcea1('0x17')][_0xcea1('0x1a')]?_['map'](_0x22c564[_0xcea1('0x17')][_0xcea1('0x1a')],function(_0x407227){return{'model':db[_0x407227['model']],'as':_0x407227['as'],'attributes':_0x407227[_0xcea1('0x1b')],'include':_0x407227['include']?_['map'](_0x407227[_0xcea1('0x1a')],function(_0x1a8523){return{'model':db[_0x1a8523['model']],'as':_0x1a8523['as'],'attributes':_0x1a8523[_0xcea1('0x1b')],'include':_0x1a8523['include']?_['map'](_0x1a8523['include'],function(_0x44ce27){return{'model':db[_0x44ce27[_0xcea1('0x1c')]],'as':_0x44ce27['as'],'attributes':_0x44ce27[_0xcea1('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xcea1('0xb')](function(_0x33ae15){logger[_0xcea1('0x1d')](_0xcea1('0x14'),_0x22c564);logger[_0xcea1('0xe')](_0xcea1('0x14'),_0x22c564,JSON[_0xcea1('0x1e')](_0x33ae15));_0x140ea4(_0x33ae15);})[_0xcea1('0x1f')](function(_0x246966){logger[_0xcea1('0x10')](_0xcea1('0x14'),_0x246966[_0xcea1('0x12')],_0x22c564);_0x3eb4da(_0x19b094[_0xcea1('0x10')](0x1f4,_0x246966[_0xcea1('0x12')]));});});};exports[_0xcea1('0x20')]=function(_0x4fe608){var _0x257ffa=this;return new Promise(function(_0x4794c6,_0x914a59){return db[_0xcea1('0x15')][_0xcea1('0x21')]({'raw':_0x4fe608[_0xcea1('0x17')]?_0x4fe608[_0xcea1('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x4fe608[_0xcea1('0x17')]?_0x4fe608[_0xcea1('0x17')][_0xcea1('0x22')]||null:null,'attributes':_0x4fe608[_0xcea1('0x17')]?_0x4fe608[_0xcea1('0x17')][_0xcea1('0x1b')]||null:null,'include':_0x4fe608[_0xcea1('0x17')]?_0x4fe608['options'][_0xcea1('0x1a')]?_[_0xcea1('0x23')](_0x4fe608['options'][_0xcea1('0x1a')],function(_0x4ea427){return{'model':db[_0x4ea427[_0xcea1('0x1c')]],'as':_0x4ea427['as'],'attributes':_0x4ea427['attributes'],'include':_0x4ea427[_0xcea1('0x1a')]?_[_0xcea1('0x23')](_0x4ea427[_0xcea1('0x1a')],function(_0x365a92){return{'model':db[_0x365a92[_0xcea1('0x1c')]],'as':_0x365a92['as'],'attributes':_0x365a92[_0xcea1('0x1b')],'include':_0x365a92['include']?_[_0xcea1('0x23')](_0x365a92[_0xcea1('0x1a')],function(_0xb9f6ab){return{'model':db[_0xb9f6ab[_0xcea1('0x1c')]],'as':_0xb9f6ab['as'],'attributes':_0xb9f6ab[_0xcea1('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xcea1('0xb')](function(_0x1d0cca){logger[_0xcea1('0x1d')](_0xcea1('0x20'),_0x4fe608);logger[_0xcea1('0xe')](_0xcea1('0x20'),_0x4fe608,JSON[_0xcea1('0x1e')](_0x1d0cca));_0x4794c6(_0x1d0cca);})['catch'](function(_0x393ba4){logger[_0xcea1('0x10')]('ShowFreshdeskAccount',_0x393ba4[_0xcea1('0x12')],_0x4fe608);_0x914a59(_0x257ffa[_0xcea1('0x10')](0x1f4,_0x393ba4[_0xcea1('0x12')]));});});}; \ No newline at end of file +var _0x70fe=['rpc','jayson/promise','client','request','info','request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskAccount,\x20%s,\x20%s','message','result','FreshdeskAccount','findAll','options','where','attributes','limit','include','map','model','then','GetFreshdeskAccount','debug','catch','ShowFreshdeskAccount','find','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x1dea72,_0x525d1b){var _0x19a0c1=function(_0x1038ab){while(--_0x1038ab){_0x1dea72['push'](_0x1dea72['shift']());}};_0x19a0c1(++_0x525d1b);}(_0x70fe,0x1d6));var _0xe70f=function(_0x535a30,_0x222818){_0x535a30=_0x535a30-0x0;var _0x4c3e5d=_0x70fe[_0x535a30];return _0x4c3e5d;};'use strict';var _=require(_0xe70f('0x0'));var util=require(_0xe70f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe70f('0x2'));var fs=require('fs');var Redis=require(_0xe70f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe70f('0x4'));var logger=require(_0xe70f('0x5'))(_0xe70f('0x6'));var config=require('../../config/environment');var jayson=require(_0xe70f('0x7'));var client=jayson[_0xe70f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xdcf3a1,_0x4478bf,_0x581699){return new BPromise(function(_0x441b29,_0x20b5e1){return client[_0xe70f('0x9')](_0xdcf3a1,_0x581699)['then'](function(_0x1b004f){logger[_0xe70f('0xa')]('FreshdeskAccount,\x20%s,\x20%s',_0x4478bf,_0xe70f('0xb'));logger['debug'](_0xe70f('0xc'),_0x4478bf,_0xe70f('0xb'),JSON[_0xe70f('0xd')](_0x1b004f));if(_0x1b004f[_0xe70f('0xe')]){if(_0x1b004f['error'][_0xe70f('0xf')]===0x1f4){logger[_0xe70f('0xe')](_0xe70f('0x10'),_0x4478bf,_0x1b004f[_0xe70f('0xe')][_0xe70f('0x11')]);return _0x20b5e1(_0x1b004f[_0xe70f('0xe')][_0xe70f('0x11')]);}logger['error'](_0xe70f('0x10'),_0x4478bf,_0x1b004f[_0xe70f('0xe')]['message']);return _0x441b29(_0x1b004f[_0xe70f('0xe')][_0xe70f('0x11')]);}else{logger[_0xe70f('0xa')]('FreshdeskAccount,\x20%s,\x20%s',_0x4478bf,_0xe70f('0xb'));_0x441b29(_0x1b004f[_0xe70f('0x12')][_0xe70f('0x11')]);}})['catch'](function(_0x3f08e7){logger['error'](_0xe70f('0x10'),_0x4478bf,_0x3f08e7);_0x20b5e1(_0x3f08e7);});});}exports['GetFreshdeskAccount']=function(_0x516a75){var _0x331ce8=this;return new Promise(function(_0x2c5d0b,_0x44aa05){return db[_0xe70f('0x13')][_0xe70f('0x14')]({'raw':_0x516a75[_0xe70f('0x15')]?_0x516a75[_0xe70f('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x516a75['options']?_0x516a75[_0xe70f('0x15')][_0xe70f('0x16')]||null:null,'attributes':_0x516a75['options']?_0x516a75[_0xe70f('0x15')][_0xe70f('0x17')]||null:null,'limit':_0x516a75[_0xe70f('0x15')]?_0x516a75[_0xe70f('0x15')][_0xe70f('0x18')]||null:null,'include':_0x516a75['options']?_0x516a75[_0xe70f('0x15')][_0xe70f('0x19')]?_[_0xe70f('0x1a')](_0x516a75[_0xe70f('0x15')]['include'],function(_0x1c5073){return{'model':db[_0x1c5073[_0xe70f('0x1b')]],'as':_0x1c5073['as'],'attributes':_0x1c5073[_0xe70f('0x17')],'include':_0x1c5073[_0xe70f('0x19')]?_[_0xe70f('0x1a')](_0x1c5073[_0xe70f('0x19')],function(_0x5c7a09){return{'model':db[_0x5c7a09['model']],'as':_0x5c7a09['as'],'attributes':_0x5c7a09[_0xe70f('0x17')],'include':_0x5c7a09[_0xe70f('0x19')]?_[_0xe70f('0x1a')](_0x5c7a09[_0xe70f('0x19')],function(_0x4f5ff7){return{'model':db[_0x4f5ff7[_0xe70f('0x1b')]],'as':_0x4f5ff7['as'],'attributes':_0x4f5ff7[_0xe70f('0x17')]};}):[]};}):[]};}):[]:[]})[_0xe70f('0x1c')](function(_0x371781){logger[_0xe70f('0xa')](_0xe70f('0x1d'),_0x516a75);logger[_0xe70f('0x1e')](_0xe70f('0x1d'),_0x516a75,JSON[_0xe70f('0xd')](_0x371781));_0x2c5d0b(_0x371781);})[_0xe70f('0x1f')](function(_0x50451c){logger[_0xe70f('0xe')](_0xe70f('0x1d'),_0x50451c[_0xe70f('0x11')],_0x516a75);_0x44aa05(_0x331ce8[_0xe70f('0xe')](0x1f4,_0x50451c[_0xe70f('0x11')]));});});};exports[_0xe70f('0x20')]=function(_0x206516){var _0x44180b=this;return new Promise(function(_0x500ad3,_0x15f16f){return db[_0xe70f('0x13')][_0xe70f('0x21')]({'raw':_0x206516[_0xe70f('0x15')]?_0x206516[_0xe70f('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x206516[_0xe70f('0x15')]?_0x206516['options'][_0xe70f('0x16')]||null:null,'attributes':_0x206516[_0xe70f('0x15')]?_0x206516[_0xe70f('0x15')][_0xe70f('0x17')]||null:null,'include':_0x206516[_0xe70f('0x15')]?_0x206516[_0xe70f('0x15')][_0xe70f('0x19')]?_[_0xe70f('0x1a')](_0x206516[_0xe70f('0x15')][_0xe70f('0x19')],function(_0x2168d6){return{'model':db[_0x2168d6[_0xe70f('0x1b')]],'as':_0x2168d6['as'],'attributes':_0x2168d6[_0xe70f('0x17')],'include':_0x2168d6[_0xe70f('0x19')]?_[_0xe70f('0x1a')](_0x2168d6['include'],function(_0x511657){return{'model':db[_0x511657['model']],'as':_0x511657['as'],'attributes':_0x511657[_0xe70f('0x17')],'include':_0x511657[_0xe70f('0x19')]?_[_0xe70f('0x1a')](_0x511657[_0xe70f('0x19')],function(_0x3a2cf5){return{'model':db[_0x3a2cf5[_0xe70f('0x1b')]],'as':_0x3a2cf5['as'],'attributes':_0x3a2cf5['attributes']};}):[]};}):[]};}):[]:[]})[_0xe70f('0x1c')](function(_0x34f410){logger[_0xe70f('0xa')](_0xe70f('0x20'),_0x206516);logger[_0xe70f('0x1e')](_0xe70f('0x20'),_0x206516,JSON['stringify'](_0x34f410));_0x500ad3(_0x34f410);})[_0xe70f('0x1f')](function(_0xf57327){logger[_0xe70f('0xe')](_0xe70f('0x20'),_0xf57327[_0xe70f('0x11')],_0x206516);_0x15f16f(_0x44180b[_0xe70f('0xe')](0x1f4,_0xf57327[_0xe70f('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 7f95b2a..ccbcfb5 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 _0xf91c=['/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','/:id'];(function(_0x15d2fd,_0x382adb){var _0x421ebe=function(_0x125b58){while(--_0x125b58){_0x15d2fd['push'](_0x15d2fd['shift']());}};_0x421ebe(++_0x382adb);}(_0xf91c,0x8e));var _0xcf91=function(_0x2383f7,_0x53e3ca){_0x2383f7=_0x2383f7-0x0;var _0x1432c6=_0xf91c[_0x2383f7];return _0x1432c6;};'use strict';var multer=require(_0xcf91('0x0'));var util=require(_0xcf91('0x1'));var path=require(_0xcf91('0x2'));var timeout=require('connect-timeout');var express=require(_0xcf91('0x3'));var router=express[_0xcf91('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xcf91('0x5'));var interaction=require(_0xcf91('0x6'));var config=require(_0xcf91('0x7'));var controller=require(_0xcf91('0x8'));router[_0xcf91('0x9')]('/',auth[_0xcf91('0xa')](),controller['index']);router[_0xcf91('0x9')](_0xcf91('0xb'),auth[_0xcf91('0xa')](),controller['show']);router['get'](_0xcf91('0xc'),auth[_0xcf91('0xa')](),controller['getFields']);router[_0xcf91('0x9')](_0xcf91('0xd'),auth['isAuthenticated'](),controller[_0xcf91('0xe')]);router[_0xcf91('0x9')](_0xcf91('0xf'),auth[_0xcf91('0xa')](),controller[_0xcf91('0x10')]);router[_0xcf91('0x9')](_0xcf91('0x11'),auth[_0xcf91('0xa')](),controller[_0xcf91('0x12')]);router[_0xcf91('0x13')]('/',auth[_0xcf91('0xa')](),controller['create']);router['post']('/:id/tags',auth[_0xcf91('0xa')](),controller[_0xcf91('0x14')]);router[_0xcf91('0x15')](_0xcf91('0xb'),auth[_0xcf91('0xa')](),controller['update']);router['delete'](_0xcf91('0xb'),auth[_0xcf91('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x4ca8=['destroy','exports','multer','util','express','fs-extra','../../components/auth/service','./intFreshdeskConfiguration.controller','isAuthenticated','index','/:id','get','/:id/fields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete'];(function(_0x1833dc,_0x121d9d){var _0x77da96=function(_0x5edeb1){while(--_0x5edeb1){_0x1833dc['push'](_0x1833dc['shift']());}};_0x77da96(++_0x121d9d);}(_0x4ca8,0x10a));var _0x84ca=function(_0x5b59f4,_0x43ac44){_0x5b59f4=_0x5b59f4-0x0;var _0x3cb13e=_0x4ca8[_0x5b59f4];return _0x3cb13e;};'use strict';var multer=require(_0x84ca('0x0'));var util=require(_0x84ca('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x84ca('0x2'));var router=express['Router']();var fs_extra=require(_0x84ca('0x3'));var auth=require(_0x84ca('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x84ca('0x5'));router['get']('/',auth[_0x84ca('0x6')](),controller[_0x84ca('0x7')]);router['get'](_0x84ca('0x8'),auth[_0x84ca('0x6')](),controller['show']);router[_0x84ca('0x9')](_0x84ca('0xa'),auth[_0x84ca('0x6')](),controller['getFields']);router['get']('/:id/subjects',auth[_0x84ca('0x6')](),controller[_0x84ca('0xb')]);router[_0x84ca('0x9')](_0x84ca('0xc'),auth[_0x84ca('0x6')](),controller[_0x84ca('0xd')]);router[_0x84ca('0x9')](_0x84ca('0xe'),auth[_0x84ca('0x6')](),controller[_0x84ca('0xf')]);router[_0x84ca('0x10')]('/',auth[_0x84ca('0x6')](),controller[_0x84ca('0x11')]);router[_0x84ca('0x10')](_0x84ca('0xe'),auth['isAuthenticated'](),controller[_0x84ca('0x12')]);router[_0x84ca('0x13')](_0x84ca('0x8'),auth['isAuthenticated'](),controller[_0x84ca('0x14')]);router[_0x84ca('0x15')](_0x84ca('0x8'),auth[_0x84ca('0x6')](),controller[_0x84ca('0x16')]);module[_0x84ca('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 09cbbf7..bedf98e 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 _0x4161=['exports','STRING','sequelize'];(function(_0x2a723e,_0x61bb43){var _0x48a0e1=function(_0x470e57){while(--_0x470e57){_0x2a723e['push'](_0x2a723e['shift']());}};_0x48a0e1(++_0x61bb43);}(_0x4161,0x89));var _0x1416=function(_0x5edadd,_0x1fed55){_0x5edadd=_0x5edadd-0x0;var _0x328a65=_0x4161[_0x5edadd];return _0x328a65;};'use strict';var Sequelize=require(_0x1416('0x0'));module[_0x1416('0x1')]={'name':{'type':Sequelize[_0x1416('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xecdb=['STRING','sequelize'];(function(_0x1726e1,_0x1cc1f4){var _0x44eccc=function(_0x29d671){while(--_0x29d671){_0x1726e1['push'](_0x1726e1['shift']());}};_0x44eccc(++_0x1cc1f4);}(_0xecdb,0x15d));var _0xbecd=function(_0x26fb57,_0x5212de){_0x26fb57=_0x26fb57-0x0;var _0x4db530=_0xecdb[_0x26fb57];return _0x4db530;};'use strict';var Sequelize=require(_0xbecd('0x0'));module['exports']={'name':{'type':Sequelize[_0xbecd('0x1')]},'description':{'type':Sequelize[_0xbecd('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index fad5d01..bede4ba 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 _0xeeea=['stack','name','send','map','FreshdeskConfiguration','rawAttributes','fieldName','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','findAll','catch','show','params','includeAll','include','options','create','body','destroy','getFields','findOne','FreshdeskField','order','pick','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','count','limit','set','apply','save','then','error'];(function(_0x2c5987,_0x101621){var _0x55773d=function(_0x1ba37c){while(--_0x1ba37c){_0x2c5987['push'](_0x2c5987['shift']());}};_0x55773d(++_0x101621);}(_0xeeea,0x16d));var _0xaeee=function(_0x566f05,_0x160e6f){_0x566f05=_0x566f05-0x0;var _0x17833b=_0xeeea[_0x566f05];return _0x17833b;};'use strict';var emlformat=require(_0xaeee('0x0'));var rimraf=require(_0xaeee('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaeee('0x2'));var rp=require(_0xaeee('0x3'));var moment=require('moment');var BPromise=require(_0xaeee('0x4'));var Mustache=require(_0xaeee('0x5'));var util=require(_0xaeee('0x6'));var path=require(_0xaeee('0x7'));var sox=require('sox');var csv=require(_0xaeee('0x8'));var ejs=require(_0xaeee('0x9'));var fs=require('fs');var fs_extra=require(_0xaeee('0xa'));var _=require(_0xaeee('0xb'));var squel=require(_0xaeee('0xc'));var crypto=require(_0xaeee('0xd'));var jsforce=require(_0xaeee('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xaeee('0xf'));var Papa=require('papaparse');var Redis=require(_0xaeee('0x10'));var authService=require(_0xaeee('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaeee('0x12'));var logger=require(_0xaeee('0x13'))(_0xaeee('0x14'));var utils=require(_0xaeee('0x15'));var config=require(_0xaeee('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c6d7a,_0x246f5c){_0x246f5c=_0x246f5c||0xcc;return function(_0x44dcc9){if(_0x44dcc9){return _0x1c6d7a[_0xaeee('0x17')](_0x246f5c);}return _0x1c6d7a[_0xaeee('0x18')](_0x246f5c)['end']();};}function respondWithResult(_0xdcb878,_0x148452){_0x148452=_0x148452||0xc8;return function(_0x8cb6d9){if(_0x8cb6d9){return _0xdcb878[_0xaeee('0x18')](_0x148452)[_0xaeee('0x19')](_0x8cb6d9);}};}function respondWithFilteredResult(_0x175c4b,_0x8d307e){return function(_0x1f07eb){if(_0x1f07eb){var _0x1915f8=typeof _0x8d307e[_0xaeee('0x1a')]===_0xaeee('0x1b')&&typeof _0x8d307e['limit']==='undefined';var _0x133c07=_0x1f07eb['count'];var _0x27c93d=_0x1915f8?0x0:_0x8d307e[_0xaeee('0x1a')];var _0x10bcac=_0x1915f8?_0x1f07eb[_0xaeee('0x1c')]:_0x8d307e[_0xaeee('0x1a')]+_0x8d307e[_0xaeee('0x1d')];var _0x3c2a45;if(_0x10bcac>=_0x133c07){_0x10bcac=_0x133c07;_0x3c2a45=0xc8;}else{_0x3c2a45=0xce;}_0x175c4b[_0xaeee('0x18')](_0x3c2a45);return _0x175c4b[_0xaeee('0x1e')]('Content-Range',_0x27c93d+'-'+_0x10bcac+'/'+_0x133c07)[_0xaeee('0x19')](_0x1f07eb);}return null;};}function patchUpdates(_0x15d5ef){return function(_0x2bca97){try{jsonpatch[_0xaeee('0x1f')](_0x2bca97,_0x15d5ef,!![]);}catch(_0x229ff2){return BPromise['reject'](_0x229ff2);}return _0x2bca97[_0xaeee('0x20')]();};}function saveUpdates(_0x514531,_0x528c4c){return function(_0x1e9a30){if(_0x1e9a30){return _0x1e9a30['update'](_0x514531)['then'](function(_0x47baa3){return _0x47baa3;});}return null;};}function removeEntity(_0x221435,_0xe7b809){return function(_0x52afb7){if(_0x52afb7){return _0x52afb7['destroy']()[_0xaeee('0x21')](function(){_0x221435[_0xaeee('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31fe6c,_0x3d3ca9){return function(_0x14dc12){if(!_0x14dc12){_0x31fe6c[_0xaeee('0x17')](0x194);}return _0x14dc12;};}function handleError(_0xc5bd23,_0x5e12b9){_0x5e12b9=_0x5e12b9||0x1f4;return function(_0x386475){logger[_0xaeee('0x22')](_0x386475[_0xaeee('0x23')]);if(_0x386475[_0xaeee('0x24')]){delete _0x386475[_0xaeee('0x24')];}_0xc5bd23[_0xaeee('0x18')](_0x5e12b9)[_0xaeee('0x25')](_0x386475);};}exports['index']=function(_0x2de737,_0x4d32f9){var _0x45be40={},_0x42c097={},_0x2b254e={'count':0x0,'rows':[]};var _0x3b4b19=_[_0xaeee('0x26')](db[_0xaeee('0x27')][_0xaeee('0x28')],function(_0x14860a){return{'name':_0x14860a[_0xaeee('0x29')],'type':_0x14860a['type'][_0xaeee('0x2a')]};});_0x42c097[_0xaeee('0x2b')]=_[_0xaeee('0x26')](_0x3b4b19,_0xaeee('0x24'));_0x42c097['query']=_[_0xaeee('0x2c')](_0x2de737['query']);_0x42c097[_0xaeee('0x2d')]=_[_0xaeee('0x2e')](_0x42c097[_0xaeee('0x2b')],_0x42c097[_0xaeee('0x2f')]);_0x45be40['attributes']=_[_0xaeee('0x2e')](_0x42c097[_0xaeee('0x2b')],qs[_0xaeee('0x30')](_0x2de737['query'][_0xaeee('0x30')]));_0x45be40[_0xaeee('0x31')]=_0x45be40['attributes'][_0xaeee('0x32')]?_0x45be40['attributes']:_0x42c097[_0xaeee('0x2b')];if(!_0x2de737[_0xaeee('0x2f')][_0xaeee('0x33')](_0xaeee('0x34'))){_0x45be40[_0xaeee('0x1d')]=qs[_0xaeee('0x1d')](_0x2de737[_0xaeee('0x2f')][_0xaeee('0x1d')]);_0x45be40[_0xaeee('0x1a')]=qs['offset'](_0x2de737[_0xaeee('0x2f')]['offset']);}_0x45be40['order']=qs[_0xaeee('0x35')](_0x2de737[_0xaeee('0x2f')][_0xaeee('0x35')]);_0x45be40[_0xaeee('0x36')]=qs[_0xaeee('0x2d')](_['pick'](_0x2de737[_0xaeee('0x2f')],_0x42c097[_0xaeee('0x2d')]),_0x3b4b19);if(_0x2de737[_0xaeee('0x2f')][_0xaeee('0x37')]){_0x45be40[_0xaeee('0x36')]=_[_0xaeee('0x38')](_0x45be40[_0xaeee('0x36')],{'$or':_[_0xaeee('0x26')](_0x3b4b19,function(_0x228876){if(_0x228876[_0xaeee('0x39')]!==_0xaeee('0x3a')){var _0x2666bb={};_0x2666bb[_0x228876['name']]={'$like':'%'+_0x2de737[_0xaeee('0x2f')][_0xaeee('0x37')]+'%'};return _0x2666bb;}})});}_0x45be40=_[_0xaeee('0x38')]({},_0x45be40,_0x2de737['options']);var _0xf15001={'where':_0x45be40['where']};return db[_0xaeee('0x27')][_0xaeee('0x1c')](_0xf15001)['then'](function(_0x4322b4){_0x2b254e[_0xaeee('0x1c')]=_0x4322b4;if(_0x2de737['query']['includeAll']){_0x45be40['include']=[{'all':!![]}];}return db[_0xaeee('0x27')][_0xaeee('0x3b')](_0x45be40);})[_0xaeee('0x21')](function(_0x510a31){_0x2b254e['rows']=_0x510a31;return _0x2b254e;})[_0xaeee('0x21')](respondWithFilteredResult(_0x4d32f9,_0x45be40))[_0xaeee('0x3c')](handleError(_0x4d32f9,null));};exports[_0xaeee('0x3d')]=function(_0x27393b,_0x38115c){var _0x40fcc3={'raw':![],'where':{'id':_0x27393b[_0xaeee('0x3e')]['id']}},_0x4225e3={};_0x4225e3[_0xaeee('0x2b')]=_[_0xaeee('0x2c')](db[_0xaeee('0x27')]['rawAttributes']);_0x4225e3['query']=_[_0xaeee('0x2c')](_0x27393b[_0xaeee('0x2f')]);_0x4225e3[_0xaeee('0x2d')]=_[_0xaeee('0x2e')](_0x4225e3[_0xaeee('0x2b')],_0x4225e3[_0xaeee('0x2f')]);_0x40fcc3[_0xaeee('0x31')]=_[_0xaeee('0x2e')](_0x4225e3[_0xaeee('0x2b')],qs['fields'](_0x27393b[_0xaeee('0x2f')][_0xaeee('0x30')]));_0x40fcc3['attributes']=_0x40fcc3[_0xaeee('0x31')][_0xaeee('0x32')]?_0x40fcc3[_0xaeee('0x31')]:_0x4225e3[_0xaeee('0x2b')];if(_0x27393b[_0xaeee('0x2f')][_0xaeee('0x3f')]){_0x40fcc3[_0xaeee('0x40')]=[{'all':!![]}];}_0x40fcc3=_[_0xaeee('0x38')]({},_0x40fcc3,_0x27393b[_0xaeee('0x41')]);return db[_0xaeee('0x27')]['find'](_0x40fcc3)[_0xaeee('0x21')](handleEntityNotFound(_0x38115c,null))[_0xaeee('0x21')](respondWithResult(_0x38115c,null))['catch'](handleError(_0x38115c,null));};exports[_0xaeee('0x42')]=function(_0x565460,_0x25cd6f){return db[_0xaeee('0x27')][_0xaeee('0x42')](_0x565460['body'],{})[_0xaeee('0x21')](respondWithResult(_0x25cd6f,0xc9))[_0xaeee('0x3c')](handleError(_0x25cd6f,null));};exports['update']=function(_0x3c8269,_0x2ea70d){if(_0x3c8269['body']['id']){delete _0x3c8269[_0xaeee('0x43')]['id'];}return db[_0xaeee('0x27')]['find']({'where':{'id':_0x3c8269[_0xaeee('0x3e')]['id']}})[_0xaeee('0x21')](handleEntityNotFound(_0x2ea70d,null))['then'](saveUpdates(_0x3c8269['body'],null))[_0xaeee('0x21')](respondWithResult(_0x2ea70d,null))['catch'](handleError(_0x2ea70d,null));};exports[_0xaeee('0x44')]=function(_0x1b804f,_0x197231){return db[_0xaeee('0x27')]['find']({'where':{'id':_0x1b804f[_0xaeee('0x3e')]['id']}})[_0xaeee('0x21')](handleEntityNotFound(_0x197231,null))[_0xaeee('0x21')](removeEntity(_0x197231,null))['catch'](handleError(_0x197231,null));};exports[_0xaeee('0x45')]=function(_0x1fc6a3,_0x472e3e,_0x54c094){var _0x3ccd4a={};var _0x25ca54={};var _0x3cfe8e;var _0x30649d;return db['FreshdeskConfiguration'][_0xaeee('0x46')]({'where':{'id':_0x1fc6a3['params']['id']}})['then'](handleEntityNotFound(_0x472e3e,null))['then'](function(_0xd2cad2){if(_0xd2cad2){_0x3cfe8e=_0xd2cad2;_0x25ca54[_0xaeee('0x2b')]=_[_0xaeee('0x2c')](db[_0xaeee('0x47')][_0xaeee('0x28')]);_0x25ca54[_0xaeee('0x2f')]=_['keys'](_0x1fc6a3[_0xaeee('0x2f')]);_0x25ca54[_0xaeee('0x2d')]=_[_0xaeee('0x2e')](_0x25ca54[_0xaeee('0x2b')],_0x25ca54[_0xaeee('0x2f')]);_0x3ccd4a[_0xaeee('0x31')]=_[_0xaeee('0x2e')](_0x25ca54['model'],qs['fields'](_0x1fc6a3[_0xaeee('0x2f')]['fields']));_0x3ccd4a[_0xaeee('0x31')]=_0x3ccd4a['attributes'][_0xaeee('0x32')]?_0x3ccd4a[_0xaeee('0x31')]:_0x25ca54[_0xaeee('0x2b')];_0x3ccd4a[_0xaeee('0x48')]=qs[_0xaeee('0x35')](_0x1fc6a3[_0xaeee('0x2f')]['sort']);_0x3ccd4a[_0xaeee('0x36')]=qs[_0xaeee('0x2d')](_['pick'](_0x1fc6a3['query'],_0x25ca54['filters']));if(_0x1fc6a3['query']['filter']){_0x3ccd4a[_0xaeee('0x36')]=_[_0xaeee('0x38')](_0x3ccd4a[_0xaeee('0x36')],{'$or':_[_0xaeee('0x26')](_0x3ccd4a[_0xaeee('0x31')],function(_0x13b7f5){var _0x14ab13={};_0x14ab13[_0x13b7f5]={'$like':'%'+_0x1fc6a3['query'][_0xaeee('0x37')]+'%'};return _0x14ab13;})});}_0x3ccd4a=_[_0xaeee('0x38')]({},_0x3ccd4a,_0x1fc6a3[_0xaeee('0x41')]);return _0x3cfe8e[_0xaeee('0x45')](_0x3ccd4a);}})[_0xaeee('0x21')](function(_0x172453){if(_0x172453){_0x30649d=_0x172453[_0xaeee('0x32')];if(!_0x1fc6a3[_0xaeee('0x2f')][_0xaeee('0x33')]('nolimit')){_0x3ccd4a['limit']=qs[_0xaeee('0x1d')](_0x1fc6a3[_0xaeee('0x2f')][_0xaeee('0x1d')]);_0x3ccd4a[_0xaeee('0x1a')]=qs['offset'](_0x1fc6a3[_0xaeee('0x2f')]['offset']);}return _0x3cfe8e[_0xaeee('0x45')](_0x3ccd4a);}})[_0xaeee('0x21')](function(_0x4e93c4){if(_0x4e93c4){return _0x4e93c4?{'count':_0x30649d,'rows':_0x4e93c4}:null;}})[_0xaeee('0x21')](respondWithResult(_0x472e3e,null))['catch'](handleError(_0x472e3e,null));};exports['getSubjects']=function(_0x2fd37f,_0x37f9dd,_0x4eb46e){var _0x13d873={};var _0x148292={};var _0x393e75;var _0x45d222;return db['FreshdeskConfiguration'][_0xaeee('0x46')]({'where':{'id':_0x2fd37f[_0xaeee('0x3e')]['id']}})[_0xaeee('0x21')](handleEntityNotFound(_0x37f9dd,null))[_0xaeee('0x21')](function(_0x176cdf){if(_0x176cdf){_0x393e75=_0x176cdf;_0x148292['model']=_[_0xaeee('0x2c')](db[_0xaeee('0x47')][_0xaeee('0x28')]);_0x148292[_0xaeee('0x2f')]=_['keys'](_0x2fd37f[_0xaeee('0x2f')]);_0x148292[_0xaeee('0x2d')]=_['intersection'](_0x148292['model'],_0x148292[_0xaeee('0x2f')]);_0x13d873[_0xaeee('0x31')]=_[_0xaeee('0x2e')](_0x148292[_0xaeee('0x2b')],qs['fields'](_0x2fd37f[_0xaeee('0x2f')][_0xaeee('0x30')]));_0x13d873[_0xaeee('0x31')]=_0x13d873[_0xaeee('0x31')][_0xaeee('0x32')]?_0x13d873['attributes']:_0x148292[_0xaeee('0x2b')];_0x13d873[_0xaeee('0x48')]=qs[_0xaeee('0x35')](_0x2fd37f[_0xaeee('0x2f')][_0xaeee('0x35')]);_0x13d873[_0xaeee('0x36')]=qs[_0xaeee('0x2d')](_[_0xaeee('0x49')](_0x2fd37f[_0xaeee('0x2f')],_0x148292[_0xaeee('0x2d')]));if(_0x2fd37f[_0xaeee('0x2f')]['filter']){_0x13d873[_0xaeee('0x36')]=_['merge'](_0x13d873['where'],{'$or':_[_0xaeee('0x26')](_0x13d873[_0xaeee('0x31')],function(_0x19f344){var _0x576c07={};_0x576c07[_0x19f344]={'$like':'%'+_0x2fd37f[_0xaeee('0x2f')][_0xaeee('0x37')]+'%'};return _0x576c07;})});}_0x13d873=_['merge']({},_0x13d873,_0x2fd37f['options']);return _0x393e75['getSubjects'](_0x13d873);}})['then'](function(_0x3727dd){if(_0x3727dd){_0x45d222=_0x3727dd[_0xaeee('0x32')];if(!_0x2fd37f['query'][_0xaeee('0x33')](_0xaeee('0x34'))){_0x13d873['limit']=qs[_0xaeee('0x1d')](_0x2fd37f[_0xaeee('0x2f')][_0xaeee('0x1d')]);_0x13d873['offset']=qs[_0xaeee('0x1a')](_0x2fd37f[_0xaeee('0x2f')][_0xaeee('0x1a')]);}return _0x393e75[_0xaeee('0x4a')](_0x13d873);}})['then'](function(_0x20ce46){if(_0x20ce46){return _0x20ce46?{'count':_0x45d222,'rows':_0x20ce46}:null;}})[_0xaeee('0x21')](respondWithResult(_0x37f9dd,null))[_0xaeee('0x3c')](handleError(_0x37f9dd,null));};exports[_0xaeee('0x4b')]=function(_0x103c01,_0x298cad,_0x5de1d8){var _0x238780={};var _0x3c034f={};var _0x32fc53;var _0x24354c;return db[_0xaeee('0x27')][_0xaeee('0x46')]({'where':{'id':_0x103c01[_0xaeee('0x3e')]['id']}})[_0xaeee('0x21')](handleEntityNotFound(_0x298cad,null))[_0xaeee('0x21')](function(_0x573240){if(_0x573240){_0x32fc53=_0x573240;_0x3c034f[_0xaeee('0x2b')]=_[_0xaeee('0x2c')](db[_0xaeee('0x47')][_0xaeee('0x28')]);_0x3c034f['query']=_[_0xaeee('0x2c')](_0x103c01[_0xaeee('0x2f')]);_0x3c034f[_0xaeee('0x2d')]=_['intersection'](_0x3c034f[_0xaeee('0x2b')],_0x3c034f[_0xaeee('0x2f')]);_0x238780[_0xaeee('0x31')]=_['intersection'](_0x3c034f[_0xaeee('0x2b')],qs[_0xaeee('0x30')](_0x103c01[_0xaeee('0x2f')][_0xaeee('0x30')]));_0x238780['attributes']=_0x238780[_0xaeee('0x31')][_0xaeee('0x32')]?_0x238780[_0xaeee('0x31')]:_0x3c034f[_0xaeee('0x2b')];_0x238780['order']=qs[_0xaeee('0x35')](_0x103c01[_0xaeee('0x2f')][_0xaeee('0x35')]);_0x238780['where']=qs[_0xaeee('0x2d')](_[_0xaeee('0x49')](_0x103c01[_0xaeee('0x2f')],_0x3c034f[_0xaeee('0x2d')]));if(_0x103c01['query']['filter']){_0x238780['where']=_[_0xaeee('0x38')](_0x238780['where'],{'$or':_['map'](_0x238780['attributes'],function(_0x4c915b){var _0x277bc5={};_0x277bc5[_0x4c915b]={'$like':'%'+_0x103c01['query'][_0xaeee('0x37')]+'%'};return _0x277bc5;})});}_0x238780=_[_0xaeee('0x38')]({},_0x238780,_0x103c01[_0xaeee('0x41')]);return _0x32fc53[_0xaeee('0x4b')](_0x238780);}})[_0xaeee('0x21')](function(_0x228b00){if(_0x228b00){_0x24354c=_0x228b00[_0xaeee('0x32')];if(!_0x103c01['query'][_0xaeee('0x33')](_0xaeee('0x34'))){_0x238780['limit']=qs['limit'](_0x103c01[_0xaeee('0x2f')]['limit']);_0x238780[_0xaeee('0x1a')]=qs['offset'](_0x103c01[_0xaeee('0x2f')][_0xaeee('0x1a')]);}return _0x32fc53['getDescriptions'](_0x238780);}})['then'](function(_0x118f1a){if(_0x118f1a){return _0x118f1a?{'count':_0x24354c,'rows':_0x118f1a}:null;}})[_0xaeee('0x21')](respondWithResult(_0x298cad,null))[_0xaeee('0x3c')](handleError(_0x298cad,null));};exports[_0xaeee('0x4c')]=function(_0x334c30,_0x421087,_0x3bcae5){var _0x531083={};var _0x1e50a7={};var _0x3b2cb5;var _0x3a54bf;return db[_0xaeee('0x27')][_0xaeee('0x46')]({'where':{'id':_0x334c30[_0xaeee('0x3e')]['id']}})['then'](handleEntityNotFound(_0x421087,null))['then'](function(_0x2a6216){if(_0x2a6216){_0x3b2cb5=_0x2a6216;_0x1e50a7['model']=_[_0xaeee('0x2c')](db[_0xaeee('0x4d')][_0xaeee('0x28')]);_0x1e50a7[_0xaeee('0x2f')]=_['keys'](_0x334c30[_0xaeee('0x2f')]);_0x1e50a7[_0xaeee('0x2d')]=_[_0xaeee('0x2e')](_0x1e50a7['model'],_0x1e50a7[_0xaeee('0x2f')]);_0x531083[_0xaeee('0x31')]=_[_0xaeee('0x2e')](_0x1e50a7['model'],qs['fields'](_0x334c30[_0xaeee('0x2f')]['fields']));_0x531083[_0xaeee('0x31')]=_0x531083[_0xaeee('0x31')][_0xaeee('0x32')]?_0x531083[_0xaeee('0x31')]:_0x1e50a7[_0xaeee('0x2b')];_0x531083[_0xaeee('0x48')]=qs[_0xaeee('0x35')](_0x334c30[_0xaeee('0x2f')][_0xaeee('0x35')]);_0x531083[_0xaeee('0x36')]=qs['filters'](_['pick'](_0x334c30[_0xaeee('0x2f')],_0x1e50a7['filters']));if(_0x334c30[_0xaeee('0x2f')][_0xaeee('0x37')]){_0x531083['where']=_['merge'](_0x531083['where'],{'$or':_[_0xaeee('0x26')](_0x531083[_0xaeee('0x31')],function(_0x87c11e){var _0x2039f5={};_0x2039f5[_0x87c11e]={'$like':'%'+_0x334c30[_0xaeee('0x2f')][_0xaeee('0x37')]+'%'};return _0x2039f5;})});}_0x531083=_[_0xaeee('0x38')]({},_0x531083,_0x334c30[_0xaeee('0x41')]);return _0x3b2cb5[_0xaeee('0x4c')](_0x531083);}})[_0xaeee('0x21')](function(_0x4ad809){if(_0x4ad809){_0x3a54bf=_0x4ad809[_0xaeee('0x32')];if(!_0x334c30[_0xaeee('0x2f')][_0xaeee('0x33')](_0xaeee('0x34'))){_0x531083[_0xaeee('0x1d')]=qs[_0xaeee('0x1d')](_0x334c30[_0xaeee('0x2f')][_0xaeee('0x1d')]);_0x531083[_0xaeee('0x1a')]=qs['offset'](_0x334c30[_0xaeee('0x2f')][_0xaeee('0x1a')]);}return _0x3b2cb5[_0xaeee('0x4c')](_0x531083);}})[_0xaeee('0x21')](function(_0x505581){if(_0x505581){return _0x505581?{'count':_0x3a54bf,'rows':_0x505581}:null;}})['then'](respondWithResult(_0x421087,null))[_0xaeee('0x3c')](handleError(_0x421087,null));};exports[_0xaeee('0x4e')]=function(_0x38129e,_0x4f6961,_0x13daaf){if(_0x38129e[_0xaeee('0x43')]['id']){delete _0x38129e[_0xaeee('0x43')]['id'];}return db[_0xaeee('0x27')][_0xaeee('0x46')]({'where':{'id':_0x38129e[_0xaeee('0x3e')]['id']}})[_0xaeee('0x21')](handleEntityNotFound(_0x4f6961,null))[_0xaeee('0x21')](function(_0x49e0fb){if(_0x49e0fb){return _0x49e0fb[_0xaeee('0x4e')](_0x38129e[_0xaeee('0x43')][_0xaeee('0x4f')]||[]);}return null;})['then'](respondWithResult(_0x4f6961,null))[_0xaeee('0x3c')](handleError(_0x4f6961,null));}; \ No newline at end of file +var _0x27b5=['ejs','fs-extra','lodash','squel','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','api','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','stack','name','send','index','map','FreshdeskConfiguration','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','findOne','getFields','getSubjects','FreshdeskField','rawAttributes','hasOwnProperty','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox'];(function(_0x56b595,_0x3f1f86){var _0x4de39a=function(_0x1890de){while(--_0x1890de){_0x56b595['push'](_0x56b595['shift']());}};_0x4de39a(++_0x3f1f86);}(_0x27b5,0x9a));var _0x527b=function(_0x4147ff,_0x154530){_0x4147ff=_0x4147ff-0x0;var _0x1e71e6=_0x27b5[_0x4147ff];return _0x1e71e6;};'use strict';var emlformat=require(_0x527b('0x0'));var rimraf=require(_0x527b('0x1'));var zipdir=require(_0x527b('0x2'));var jsonpatch=require(_0x527b('0x3'));var rp=require(_0x527b('0x4'));var moment=require(_0x527b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x527b('0x6'));var util=require(_0x527b('0x7'));var path=require(_0x527b('0x8'));var sox=require(_0x527b('0x9'));var csv=require('to-csv');var ejs=require(_0x527b('0xa'));var fs=require('fs');var fs_extra=require(_0x527b('0xb'));var _=require(_0x527b('0xc'));var squel=require(_0x527b('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x527b('0xe'));var toCsv=require(_0x527b('0xf'));var querystring=require('querystring');var Papa=require(_0x527b('0x10'));var Redis=require(_0x527b('0x11'));var authService=require(_0x527b('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x527b('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x527b('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x47510c,_0x9c351){_0x9c351=_0x9c351||0xcc;return function(_0x3487c6){if(_0x3487c6){return _0x47510c[_0x527b('0x15')](_0x9c351);}return _0x47510c[_0x527b('0x16')](_0x9c351)[_0x527b('0x17')]();};}function respondWithResult(_0x4ae2c1,_0x218357){_0x218357=_0x218357||0xc8;return function(_0xecda6e){if(_0xecda6e){return _0x4ae2c1['status'](_0x218357)['json'](_0xecda6e);}};}function respondWithFilteredResult(_0x25f18a,_0x1ebb66){return function(_0x108c64){if(_0x108c64){var _0x1714ac=typeof _0x1ebb66[_0x527b('0x18')]===_0x527b('0x19')&&typeof _0x1ebb66[_0x527b('0x1a')]===_0x527b('0x19');var _0x2b54e2=_0x108c64[_0x527b('0x1b')];var _0x44c181=_0x1714ac?0x0:_0x1ebb66['offset'];var _0x375102=_0x1714ac?_0x108c64[_0x527b('0x1b')]:_0x1ebb66['offset']+_0x1ebb66['limit'];var _0x20f736;if(_0x375102>=_0x2b54e2){_0x375102=_0x2b54e2;_0x20f736=0xc8;}else{_0x20f736=0xce;}_0x25f18a[_0x527b('0x16')](_0x20f736);return _0x25f18a[_0x527b('0x1c')](_0x527b('0x1d'),_0x44c181+'-'+_0x375102+'/'+_0x2b54e2)[_0x527b('0x1e')](_0x108c64);}return null;};}function patchUpdates(_0xfe2fc9){return function(_0x40b9b1){try{jsonpatch[_0x527b('0x1f')](_0x40b9b1,_0xfe2fc9,!![]);}catch(_0x5f3c15){return BPromise[_0x527b('0x20')](_0x5f3c15);}return _0x40b9b1['save']();};}function saveUpdates(_0x3105b4,_0x20f094){return function(_0x45e2a3){if(_0x45e2a3){return _0x45e2a3[_0x527b('0x21')](_0x3105b4)[_0x527b('0x22')](function(_0xd32a9f){return _0xd32a9f;});}return null;};}function removeEntity(_0x7383b8,_0x523bee){return function(_0x1f8f81){if(_0x1f8f81){return _0x1f8f81[_0x527b('0x23')]()['then'](function(){_0x7383b8[_0x527b('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x359840,_0x4a09f1){return function(_0xab0143){if(!_0xab0143){_0x359840[_0x527b('0x15')](0x194);}return _0xab0143;};}function handleError(_0x4bb458,_0x25e206){_0x25e206=_0x25e206||0x1f4;return function(_0x39860f){logger['error'](_0x39860f[_0x527b('0x24')]);if(_0x39860f[_0x527b('0x25')]){delete _0x39860f[_0x527b('0x25')];}_0x4bb458[_0x527b('0x16')](_0x25e206)[_0x527b('0x26')](_0x39860f);};}exports[_0x527b('0x27')]=function(_0x350767,_0x291b63){var _0x11163a={},_0x5ee6c6={},_0x323ec4={'count':0x0,'rows':[]};var _0x47695f=_[_0x527b('0x28')](db[_0x527b('0x29')]['rawAttributes'],function(_0x336e0c){return{'name':_0x336e0c[_0x527b('0x2a')],'type':_0x336e0c[_0x527b('0x2b')][_0x527b('0x2c')]};});_0x5ee6c6['model']=_['map'](_0x47695f,_0x527b('0x25'));_0x5ee6c6[_0x527b('0x2d')]=_[_0x527b('0x2e')](_0x350767[_0x527b('0x2d')]);_0x5ee6c6[_0x527b('0x2f')]=_[_0x527b('0x30')](_0x5ee6c6[_0x527b('0x31')],_0x5ee6c6[_0x527b('0x2d')]);_0x11163a[_0x527b('0x32')]=_[_0x527b('0x30')](_0x5ee6c6['model'],qs['fields'](_0x350767[_0x527b('0x2d')][_0x527b('0x33')]));_0x11163a[_0x527b('0x32')]=_0x11163a['attributes'][_0x527b('0x34')]?_0x11163a['attributes']:_0x5ee6c6['model'];if(!_0x350767['query']['hasOwnProperty'](_0x527b('0x35'))){_0x11163a[_0x527b('0x1a')]=qs[_0x527b('0x1a')](_0x350767[_0x527b('0x2d')]['limit']);_0x11163a[_0x527b('0x18')]=qs[_0x527b('0x18')](_0x350767[_0x527b('0x2d')]['offset']);}_0x11163a[_0x527b('0x36')]=qs['sort'](_0x350767[_0x527b('0x2d')][_0x527b('0x37')]);_0x11163a[_0x527b('0x38')]=qs['filters'](_[_0x527b('0x39')](_0x350767[_0x527b('0x2d')],_0x5ee6c6[_0x527b('0x2f')]),_0x47695f);if(_0x350767[_0x527b('0x2d')][_0x527b('0x3a')]){_0x11163a['where']=_[_0x527b('0x3b')](_0x11163a['where'],{'$or':_[_0x527b('0x28')](_0x47695f,function(_0x15164f){if(_0x15164f[_0x527b('0x2b')]!==_0x527b('0x3c')){var _0x518f64={};_0x518f64[_0x15164f['name']]={'$like':'%'+_0x350767['query'][_0x527b('0x3a')]+'%'};return _0x518f64;}})});}_0x11163a=_[_0x527b('0x3b')]({},_0x11163a,_0x350767['options']);var _0x56e2dc={'where':_0x11163a[_0x527b('0x38')]};return db[_0x527b('0x29')]['count'](_0x56e2dc)[_0x527b('0x22')](function(_0x4b0845){_0x323ec4[_0x527b('0x1b')]=_0x4b0845;if(_0x350767['query'][_0x527b('0x3d')]){_0x11163a[_0x527b('0x3e')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0x527b('0x3f')](_0x11163a);})[_0x527b('0x22')](function(_0x593437){_0x323ec4[_0x527b('0x40')]=_0x593437;return _0x323ec4;})[_0x527b('0x22')](respondWithFilteredResult(_0x291b63,_0x11163a))['catch'](handleError(_0x291b63,null));};exports[_0x527b('0x41')]=function(_0x566371,_0xe16874){var _0x25c5f8={'raw':![],'where':{'id':_0x566371[_0x527b('0x42')]['id']}},_0x57b975={};_0x57b975[_0x527b('0x31')]=_[_0x527b('0x2e')](db['FreshdeskConfiguration']['rawAttributes']);_0x57b975[_0x527b('0x2d')]=_['keys'](_0x566371[_0x527b('0x2d')]);_0x57b975['filters']=_[_0x527b('0x30')](_0x57b975['model'],_0x57b975[_0x527b('0x2d')]);_0x25c5f8['attributes']=_[_0x527b('0x30')](_0x57b975[_0x527b('0x31')],qs['fields'](_0x566371['query'][_0x527b('0x33')]));_0x25c5f8['attributes']=_0x25c5f8[_0x527b('0x32')]['length']?_0x25c5f8[_0x527b('0x32')]:_0x57b975[_0x527b('0x31')];if(_0x566371['query'][_0x527b('0x3d')]){_0x25c5f8[_0x527b('0x3e')]=[{'all':!![]}];}_0x25c5f8=_[_0x527b('0x3b')]({},_0x25c5f8,_0x566371[_0x527b('0x43')]);return db[_0x527b('0x29')][_0x527b('0x44')](_0x25c5f8)[_0x527b('0x22')](handleEntityNotFound(_0xe16874,null))['then'](respondWithResult(_0xe16874,null))[_0x527b('0x45')](handleError(_0xe16874,null));};exports['create']=function(_0x3d71ad,_0x1125f5){return db[_0x527b('0x29')][_0x527b('0x46')](_0x3d71ad['body'],{})['then'](respondWithResult(_0x1125f5,0xc9))[_0x527b('0x45')](handleError(_0x1125f5,null));};exports[_0x527b('0x21')]=function(_0x5f2f88,_0xe4a452){if(_0x5f2f88[_0x527b('0x47')]['id']){delete _0x5f2f88[_0x527b('0x47')]['id'];}return db[_0x527b('0x29')][_0x527b('0x44')]({'where':{'id':_0x5f2f88['params']['id']}})[_0x527b('0x22')](handleEntityNotFound(_0xe4a452,null))[_0x527b('0x22')](saveUpdates(_0x5f2f88[_0x527b('0x47')],null))[_0x527b('0x22')](respondWithResult(_0xe4a452,null))[_0x527b('0x45')](handleError(_0xe4a452,null));};exports[_0x527b('0x23')]=function(_0x2c07a0,_0x5edf7b){return db[_0x527b('0x29')][_0x527b('0x44')]({'where':{'id':_0x2c07a0[_0x527b('0x42')]['id']}})['then'](handleEntityNotFound(_0x5edf7b,null))[_0x527b('0x22')](removeEntity(_0x5edf7b,null))[_0x527b('0x45')](handleError(_0x5edf7b,null));};exports['getFields']=function(_0x48948c,_0x495c23,_0x65a36b){var _0x582dd4={};var _0x17e2aa={};var _0x381306;var _0x44f6d9;return db[_0x527b('0x29')][_0x527b('0x48')]({'where':{'id':_0x48948c[_0x527b('0x42')]['id']}})[_0x527b('0x22')](handleEntityNotFound(_0x495c23,null))[_0x527b('0x22')](function(_0x8e2e32){if(_0x8e2e32){_0x381306=_0x8e2e32;_0x17e2aa[_0x527b('0x31')]=_[_0x527b('0x2e')](db['FreshdeskField']['rawAttributes']);_0x17e2aa['query']=_[_0x527b('0x2e')](_0x48948c[_0x527b('0x2d')]);_0x17e2aa[_0x527b('0x2f')]=_[_0x527b('0x30')](_0x17e2aa[_0x527b('0x31')],_0x17e2aa[_0x527b('0x2d')]);_0x582dd4[_0x527b('0x32')]=_[_0x527b('0x30')](_0x17e2aa['model'],qs['fields'](_0x48948c[_0x527b('0x2d')]['fields']));_0x582dd4[_0x527b('0x32')]=_0x582dd4[_0x527b('0x32')][_0x527b('0x34')]?_0x582dd4[_0x527b('0x32')]:_0x17e2aa['model'];_0x582dd4['order']=qs[_0x527b('0x37')](_0x48948c[_0x527b('0x2d')][_0x527b('0x37')]);_0x582dd4['where']=qs['filters'](_[_0x527b('0x39')](_0x48948c[_0x527b('0x2d')],_0x17e2aa[_0x527b('0x2f')]));if(_0x48948c[_0x527b('0x2d')][_0x527b('0x3a')]){_0x582dd4[_0x527b('0x38')]=_[_0x527b('0x3b')](_0x582dd4['where'],{'$or':_[_0x527b('0x28')](_0x582dd4[_0x527b('0x32')],function(_0x241ec0){var _0x135d35={};_0x135d35[_0x241ec0]={'$like':'%'+_0x48948c[_0x527b('0x2d')]['filter']+'%'};return _0x135d35;})});}_0x582dd4=_[_0x527b('0x3b')]({},_0x582dd4,_0x48948c[_0x527b('0x43')]);return _0x381306['getFields'](_0x582dd4);}})['then'](function(_0x270cc9){if(_0x270cc9){_0x44f6d9=_0x270cc9[_0x527b('0x34')];if(!_0x48948c['query']['hasOwnProperty']('nolimit')){_0x582dd4[_0x527b('0x1a')]=qs['limit'](_0x48948c[_0x527b('0x2d')][_0x527b('0x1a')]);_0x582dd4[_0x527b('0x18')]=qs[_0x527b('0x18')](_0x48948c[_0x527b('0x2d')][_0x527b('0x18')]);}return _0x381306[_0x527b('0x49')](_0x582dd4);}})[_0x527b('0x22')](function(_0x84aca6){if(_0x84aca6){return _0x84aca6?{'count':_0x44f6d9,'rows':_0x84aca6}:null;}})[_0x527b('0x22')](respondWithResult(_0x495c23,null))[_0x527b('0x45')](handleError(_0x495c23,null));};exports[_0x527b('0x4a')]=function(_0xb4e2ab,_0x135ddc,_0x18abf9){var _0x1c8326={};var _0x35e8f9={};var _0x18a464;var _0x29fb41;return db[_0x527b('0x29')]['findOne']({'where':{'id':_0xb4e2ab['params']['id']}})['then'](handleEntityNotFound(_0x135ddc,null))[_0x527b('0x22')](function(_0x5cf5cd){if(_0x5cf5cd){_0x18a464=_0x5cf5cd;_0x35e8f9[_0x527b('0x31')]=_[_0x527b('0x2e')](db[_0x527b('0x4b')][_0x527b('0x4c')]);_0x35e8f9[_0x527b('0x2d')]=_[_0x527b('0x2e')](_0xb4e2ab[_0x527b('0x2d')]);_0x35e8f9[_0x527b('0x2f')]=_[_0x527b('0x30')](_0x35e8f9['model'],_0x35e8f9[_0x527b('0x2d')]);_0x1c8326[_0x527b('0x32')]=_[_0x527b('0x30')](_0x35e8f9['model'],qs[_0x527b('0x33')](_0xb4e2ab['query'][_0x527b('0x33')]));_0x1c8326[_0x527b('0x32')]=_0x1c8326[_0x527b('0x32')][_0x527b('0x34')]?_0x1c8326['attributes']:_0x35e8f9[_0x527b('0x31')];_0x1c8326[_0x527b('0x36')]=qs[_0x527b('0x37')](_0xb4e2ab[_0x527b('0x2d')][_0x527b('0x37')]);_0x1c8326[_0x527b('0x38')]=qs['filters'](_[_0x527b('0x39')](_0xb4e2ab[_0x527b('0x2d')],_0x35e8f9[_0x527b('0x2f')]));if(_0xb4e2ab[_0x527b('0x2d')][_0x527b('0x3a')]){_0x1c8326[_0x527b('0x38')]=_[_0x527b('0x3b')](_0x1c8326[_0x527b('0x38')],{'$or':_['map'](_0x1c8326['attributes'],function(_0x31bdc3){var _0xe2d267={};_0xe2d267[_0x31bdc3]={'$like':'%'+_0xb4e2ab['query'][_0x527b('0x3a')]+'%'};return _0xe2d267;})});}_0x1c8326=_[_0x527b('0x3b')]({},_0x1c8326,_0xb4e2ab[_0x527b('0x43')]);return _0x18a464[_0x527b('0x4a')](_0x1c8326);}})[_0x527b('0x22')](function(_0x199121){if(_0x199121){_0x29fb41=_0x199121[_0x527b('0x34')];if(!_0xb4e2ab[_0x527b('0x2d')][_0x527b('0x4d')](_0x527b('0x35'))){_0x1c8326[_0x527b('0x1a')]=qs[_0x527b('0x1a')](_0xb4e2ab[_0x527b('0x2d')][_0x527b('0x1a')]);_0x1c8326[_0x527b('0x18')]=qs['offset'](_0xb4e2ab[_0x527b('0x2d')][_0x527b('0x18')]);}return _0x18a464[_0x527b('0x4a')](_0x1c8326);}})[_0x527b('0x22')](function(_0x5747f4){if(_0x5747f4){return _0x5747f4?{'count':_0x29fb41,'rows':_0x5747f4}:null;}})[_0x527b('0x22')](respondWithResult(_0x135ddc,null))[_0x527b('0x45')](handleError(_0x135ddc,null));};exports[_0x527b('0x4e')]=function(_0xdbe8e8,_0x4db28a,_0x4eaa77){var _0xd9cf3b={};var _0x3c6f99={};var _0x1c6ccf;var _0x5d42cb;return db[_0x527b('0x29')]['findOne']({'where':{'id':_0xdbe8e8[_0x527b('0x42')]['id']}})['then'](handleEntityNotFound(_0x4db28a,null))[_0x527b('0x22')](function(_0x5ff38a){if(_0x5ff38a){_0x1c6ccf=_0x5ff38a;_0x3c6f99[_0x527b('0x31')]=_[_0x527b('0x2e')](db[_0x527b('0x4b')][_0x527b('0x4c')]);_0x3c6f99['query']=_[_0x527b('0x2e')](_0xdbe8e8[_0x527b('0x2d')]);_0x3c6f99[_0x527b('0x2f')]=_[_0x527b('0x30')](_0x3c6f99['model'],_0x3c6f99[_0x527b('0x2d')]);_0xd9cf3b['attributes']=_['intersection'](_0x3c6f99[_0x527b('0x31')],qs['fields'](_0xdbe8e8['query'][_0x527b('0x33')]));_0xd9cf3b['attributes']=_0xd9cf3b[_0x527b('0x32')][_0x527b('0x34')]?_0xd9cf3b[_0x527b('0x32')]:_0x3c6f99[_0x527b('0x31')];_0xd9cf3b[_0x527b('0x36')]=qs[_0x527b('0x37')](_0xdbe8e8[_0x527b('0x2d')][_0x527b('0x37')]);_0xd9cf3b[_0x527b('0x38')]=qs[_0x527b('0x2f')](_['pick'](_0xdbe8e8[_0x527b('0x2d')],_0x3c6f99[_0x527b('0x2f')]));if(_0xdbe8e8[_0x527b('0x2d')][_0x527b('0x3a')]){_0xd9cf3b[_0x527b('0x38')]=_[_0x527b('0x3b')](_0xd9cf3b['where'],{'$or':_['map'](_0xd9cf3b['attributes'],function(_0x5474f6){var _0x37584e={};_0x37584e[_0x5474f6]={'$like':'%'+_0xdbe8e8['query'][_0x527b('0x3a')]+'%'};return _0x37584e;})});}_0xd9cf3b=_[_0x527b('0x3b')]({},_0xd9cf3b,_0xdbe8e8['options']);return _0x1c6ccf[_0x527b('0x4e')](_0xd9cf3b);}})[_0x527b('0x22')](function(_0xc5b173){if(_0xc5b173){_0x5d42cb=_0xc5b173[_0x527b('0x34')];if(!_0xdbe8e8['query'][_0x527b('0x4d')](_0x527b('0x35'))){_0xd9cf3b[_0x527b('0x1a')]=qs[_0x527b('0x1a')](_0xdbe8e8[_0x527b('0x2d')]['limit']);_0xd9cf3b[_0x527b('0x18')]=qs['offset'](_0xdbe8e8[_0x527b('0x2d')][_0x527b('0x18')]);}return _0x1c6ccf[_0x527b('0x4e')](_0xd9cf3b);}})[_0x527b('0x22')](function(_0x5ddfa4){if(_0x5ddfa4){return _0x5ddfa4?{'count':_0x5d42cb,'rows':_0x5ddfa4}:null;}})[_0x527b('0x22')](respondWithResult(_0x4db28a,null))[_0x527b('0x45')](handleError(_0x4db28a,null));};exports[_0x527b('0x4f')]=function(_0x18d84a,_0x50d39f,_0x15873f){var _0xb61c52={};var _0x2d9d6e={};var _0x1cdb31;var _0x2b01eb;return db[_0x527b('0x29')][_0x527b('0x48')]({'where':{'id':_0x18d84a[_0x527b('0x42')]['id']}})[_0x527b('0x22')](handleEntityNotFound(_0x50d39f,null))[_0x527b('0x22')](function(_0x50e2a1){if(_0x50e2a1){_0x1cdb31=_0x50e2a1;_0x2d9d6e[_0x527b('0x31')]=_[_0x527b('0x2e')](db[_0x527b('0x50')][_0x527b('0x4c')]);_0x2d9d6e[_0x527b('0x2d')]=_[_0x527b('0x2e')](_0x18d84a[_0x527b('0x2d')]);_0x2d9d6e[_0x527b('0x2f')]=_[_0x527b('0x30')](_0x2d9d6e['model'],_0x2d9d6e[_0x527b('0x2d')]);_0xb61c52[_0x527b('0x32')]=_[_0x527b('0x30')](_0x2d9d6e[_0x527b('0x31')],qs[_0x527b('0x33')](_0x18d84a['query'][_0x527b('0x33')]));_0xb61c52[_0x527b('0x32')]=_0xb61c52[_0x527b('0x32')]['length']?_0xb61c52[_0x527b('0x32')]:_0x2d9d6e[_0x527b('0x31')];_0xb61c52['order']=qs[_0x527b('0x37')](_0x18d84a[_0x527b('0x2d')][_0x527b('0x37')]);_0xb61c52['where']=qs[_0x527b('0x2f')](_[_0x527b('0x39')](_0x18d84a[_0x527b('0x2d')],_0x2d9d6e['filters']));if(_0x18d84a[_0x527b('0x2d')][_0x527b('0x3a')]){_0xb61c52['where']=_[_0x527b('0x3b')](_0xb61c52[_0x527b('0x38')],{'$or':_[_0x527b('0x28')](_0xb61c52['attributes'],function(_0x131569){var _0x249c4b={};_0x249c4b[_0x131569]={'$like':'%'+_0x18d84a[_0x527b('0x2d')]['filter']+'%'};return _0x249c4b;})});}_0xb61c52=_[_0x527b('0x3b')]({},_0xb61c52,_0x18d84a['options']);return _0x1cdb31[_0x527b('0x4f')](_0xb61c52);}})[_0x527b('0x22')](function(_0x2e4f60){if(_0x2e4f60){_0x2b01eb=_0x2e4f60[_0x527b('0x34')];if(!_0x18d84a[_0x527b('0x2d')][_0x527b('0x4d')](_0x527b('0x35'))){_0xb61c52[_0x527b('0x1a')]=qs[_0x527b('0x1a')](_0x18d84a[_0x527b('0x2d')][_0x527b('0x1a')]);_0xb61c52[_0x527b('0x18')]=qs[_0x527b('0x18')](_0x18d84a[_0x527b('0x2d')][_0x527b('0x18')]);}return _0x1cdb31[_0x527b('0x4f')](_0xb61c52);}})[_0x527b('0x22')](function(_0x3656d2){if(_0x3656d2){return _0x3656d2?{'count':_0x2b01eb,'rows':_0x3656d2}:null;}})[_0x527b('0x22')](respondWithResult(_0x50d39f,null))[_0x527b('0x45')](handleError(_0x50d39f,null));};exports[_0x527b('0x51')]=function(_0x5697ee,_0x31660c,_0x5a0e39){if(_0x5697ee[_0x527b('0x47')]['id']){delete _0x5697ee[_0x527b('0x47')]['id'];}return db[_0x527b('0x29')]['findOne']({'where':{'id':_0x5697ee[_0x527b('0x42')]['id']}})['then'](handleEntityNotFound(_0x31660c,null))[_0x527b('0x22')](function(_0x1761f7){if(_0x1761f7){return _0x1761f7[_0x527b('0x51')](_0x5697ee['body']['ids']||[]);}return null;})[_0x527b('0x22')](respondWithResult(_0x31660c,null))[_0x527b('0x45')](handleError(_0x31660c,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 76c7e1d..ef903c6 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 _0xdcec=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./intFreshdeskConfiguration.attributes','define','FreshdeskConfiguration','int_freshdesk_configurations'];(function(_0x4cd21c,_0x35fa45){var _0x5d8e5e=function(_0x3af223){while(--_0x3af223){_0x4cd21c['push'](_0x4cd21c['shift']());}};_0x5d8e5e(++_0x35fa45);}(_0xdcec,0x1ec));var _0xcdce=function(_0x4d2f00,_0x4e94d5){_0x4d2f00=_0x4d2f00-0x0;var _0x2d7b7f=_0xdcec[_0x4d2f00];return _0x2d7b7f;};'use strict';var _=require(_0xcdce('0x0'));var util=require(_0xcdce('0x1'));var logger=require(_0xcdce('0x2'))(_0xcdce('0x3'));var moment=require(_0xcdce('0x4'));var BPromise=require(_0xcdce('0x5'));var rp=require(_0xcdce('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcdce('0x7'));var config=require('../../config/environment');var attributes=require(_0xcdce('0x8'));module['exports']=function(_0x96aad2,_0x11c50f){return _0x96aad2[_0xcdce('0x9')](_0xcdce('0xa'),attributes,{'tableName':_0xcdce('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc5f1=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations'];(function(_0x40a67c,_0x130aed){var _0x254bc5=function(_0x62e210){while(--_0x62e210){_0x40a67c['push'](_0x40a67c['shift']());}};_0x254bc5(++_0x130aed);}(_0xc5f1,0x1b2));var _0x1c5f=function(_0x56210a,_0x368331){_0x56210a=_0x56210a-0x0;var _0x1d3535=_0xc5f1[_0x56210a];return _0x1d3535;};'use strict';var _=require(_0x1c5f('0x0'));var util=require(_0x1c5f('0x1'));var logger=require(_0x1c5f('0x2'))(_0x1c5f('0x3'));var moment=require(_0x1c5f('0x4'));var BPromise=require(_0x1c5f('0x5'));var rp=require(_0x1c5f('0x6'));var fs=require('fs');var path=require(_0x1c5f('0x7'));var rimraf=require(_0x1c5f('0x8'));var config=require('../../config/environment');var attributes=require(_0x1c5f('0x9'));module[_0x1c5f('0xa')]=function(_0x260d56,_0x1af384){return _0x260d56[_0x1c5f('0xb')](_0x1c5f('0xc'),attributes,{'tableName':_0x1c5f('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 150f30e..614673d 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 _0xeb9e=['util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','catch'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xeb9e,0x104));var _0xeeb9=function(_0x4926ea,_0xadb10d){_0x4926ea=_0x4926ea-0x0;var _0x376182=_0xeb9e[_0x4926ea];return _0x376182;};'use strict';var _=require('lodash');var util=require(_0xeeb9('0x0'));var moment=require(_0xeeb9('0x1'));var BPromise=require(_0xeeb9('0x2'));var rs=require(_0xeeb9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeeb9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xeeb9('0x5'))(_0xeeb9('0x6'));var config=require(_0xeeb9('0x7'));var jayson=require(_0xeeb9('0x8'));var client=jayson[_0xeeb9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ad0f0,_0x1f5bae,_0x5c2135){return new BPromise(function(_0x558155,_0x907322){return client[_0xeeb9('0xa')](_0x2ad0f0,_0x5c2135)['then'](function(_0x2ccbf8){logger[_0xeeb9('0xb')](_0xeeb9('0xc'),_0x1f5bae,_0xeeb9('0xd'));logger[_0xeeb9('0xe')](_0xeeb9('0xf'),_0x1f5bae,_0xeeb9('0xd'),JSON['stringify'](_0x2ccbf8));if(_0x2ccbf8['error']){if(_0x2ccbf8[_0xeeb9('0x10')][_0xeeb9('0x11')]===0x1f4){logger[_0xeeb9('0x10')](_0xeeb9('0xc'),_0x1f5bae,_0x2ccbf8[_0xeeb9('0x10')][_0xeeb9('0x12')]);return _0x907322(_0x2ccbf8[_0xeeb9('0x10')]['message']);}logger[_0xeeb9('0x10')](_0xeeb9('0xc'),_0x1f5bae,_0x2ccbf8[_0xeeb9('0x10')]['message']);return _0x558155(_0x2ccbf8[_0xeeb9('0x10')][_0xeeb9('0x12')]);}else{logger['info'](_0xeeb9('0xc'),_0x1f5bae,_0xeeb9('0xd'));_0x558155(_0x2ccbf8['result']['message']);}})[_0xeeb9('0x13')](function(_0x1ed62d){logger[_0xeeb9('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x1f5bae,_0x1ed62d);_0x907322(_0x1ed62d);});});} \ No newline at end of file +var _0x8ee9=['code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x405996,_0x290e00){var _0x14803d=function(_0x15db3f){while(--_0x15db3f){_0x405996['push'](_0x405996['shift']());}};_0x14803d(++_0x290e00);}(_0x8ee9,0x82));var _0x98ee=function(_0x9f96f,_0x23ed46){_0x9f96f=_0x9f96f-0x0;var _0x6252af=_0x8ee9[_0x9f96f];return _0x6252af;};'use strict';var _=require(_0x98ee('0x0'));var util=require(_0x98ee('0x1'));var moment=require('moment');var BPromise=require(_0x98ee('0x2'));var rs=require(_0x98ee('0x3'));var fs=require('fs');var Redis=require(_0x98ee('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x98ee('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x98ee('0x6'));var jayson=require(_0x98ee('0x7'));var client=jayson[_0x98ee('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x12ad42,_0x5134ce,_0x4b781b){return new BPromise(function(_0x17fb01,_0x1d7d6e){return client[_0x98ee('0x9')](_0x12ad42,_0x4b781b)[_0x98ee('0xa')](function(_0x199db7){logger[_0x98ee('0xb')](_0x98ee('0xc'),_0x5134ce,_0x98ee('0xd'));logger[_0x98ee('0xe')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x5134ce,_0x98ee('0xd'),JSON[_0x98ee('0xf')](_0x199db7));if(_0x199db7[_0x98ee('0x10')]){if(_0x199db7['error'][_0x98ee('0x11')]===0x1f4){logger[_0x98ee('0x10')](_0x98ee('0xc'),_0x5134ce,_0x199db7[_0x98ee('0x10')][_0x98ee('0x12')]);return _0x1d7d6e(_0x199db7[_0x98ee('0x10')][_0x98ee('0x12')]);}logger[_0x98ee('0x10')](_0x98ee('0xc'),_0x5134ce,_0x199db7[_0x98ee('0x10')][_0x98ee('0x12')]);return _0x17fb01(_0x199db7[_0x98ee('0x10')][_0x98ee('0x12')]);}else{logger[_0x98ee('0xb')](_0x98ee('0xc'),_0x5134ce,_0x98ee('0xd'));_0x17fb01(_0x199db7[_0x98ee('0x13')]['message']);}})[_0x98ee('0x14')](function(_0x198d59){logger[_0x98ee('0x10')](_0x98ee('0xc'),_0x5134ce,_0x198d59);_0x1d7d6e(_0x198d59);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 28a2294..eb75f3f 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 _0xb98a=['isAuthenticated','/:id','show','create','put','update','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xb98a,0x16e));var _0xab98=function(_0x4057ca,_0xbe5390){_0x4057ca=_0x4057ca-0x0;var _0x20f2ea=_0xb98a[_0x4057ca];return _0x20f2ea;};'use strict';var multer=require(_0xab98('0x0'));var util=require(_0xab98('0x1'));var path=require(_0xab98('0x2'));var timeout=require('connect-timeout');var express=require(_0xab98('0x3'));var router=express[_0xab98('0x4')]();var fs_extra=require(_0xab98('0x5'));var auth=require(_0xab98('0x6'));var interaction=require(_0xab98('0x7'));var config=require('../../config/environment');var controller=require('./intFreshdeskField.controller');router[_0xab98('0x8')]('/',auth[_0xab98('0x9')](),controller['index']);router[_0xab98('0x8')](_0xab98('0xa'),auth['isAuthenticated'](),controller[_0xab98('0xb')]);router['post']('/',auth[_0xab98('0x9')](),controller[_0xab98('0xc')]);router[_0xab98('0xd')](_0xab98('0xa'),auth[_0xab98('0x9')](),controller[_0xab98('0xe')]);router['delete'](_0xab98('0xa'),auth[_0xab98('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x6bcb=['../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','/:id','isAuthenticated','show','post','create','put','update','util','connect-timeout','express','fs-extra'];(function(_0x590851,_0x496bee){var _0x3b0115=function(_0x5140cc){while(--_0x5140cc){_0x590851['push'](_0x590851['shift']());}};_0x3b0115(++_0x496bee);}(_0x6bcb,0xce));var _0xb6bc=function(_0x19efbc,_0x10b7d7){_0x19efbc=_0x19efbc-0x0;var _0x205c5e=_0x6bcb[_0x19efbc];return _0x205c5e;};'use strict';var multer=require('multer');var util=require(_0xb6bc('0x0'));var path=require('path');var timeout=require(_0xb6bc('0x1'));var express=require(_0xb6bc('0x2'));var router=express['Router']();var fs_extra=require(_0xb6bc('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xb6bc('0x4'));var config=require(_0xb6bc('0x5'));var controller=require(_0xb6bc('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xb6bc('0x7')](_0xb6bc('0x8'),auth[_0xb6bc('0x9')](),controller[_0xb6bc('0xa')]);router[_0xb6bc('0xb')]('/',auth[_0xb6bc('0x9')](),controller[_0xb6bc('0xc')]);router[_0xb6bc('0xd')](_0xb6bc('0x8'),auth[_0xb6bc('0x9')](),controller[_0xb6bc('0xe')]);router['delete'](_0xb6bc('0x8'),auth['isAuthenticated'](),controller['destroy']);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 cf242e8..37fa9e4 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 _0xae72=['string','exports','ENUM','variable','customVariable','picklist','STRING'];(function(_0x265bd8,_0x507dde){var _0x1d3285=function(_0x5a9035){while(--_0x5a9035){_0x265bd8['push'](_0x265bd8['shift']());}};_0x1d3285(++_0x507dde);}(_0xae72,0x86));var _0x2ae7=function(_0x56e5a4,_0x3378ff){_0x56e5a4=_0x56e5a4-0x0;var _0x446855=_0xae72[_0x56e5a4];return _0x446855;};'use strict';var Sequelize=require('sequelize');module[_0x2ae7('0x0')]={'type':{'type':Sequelize[_0x2ae7('0x1')]('string',_0x2ae7('0x2'),_0x2ae7('0x3'),'keyValue',_0x2ae7('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x2ae7('0x5')]},'key':{'type':Sequelize[_0x2ae7('0x5')]},'keyType':{'type':Sequelize[_0x2ae7('0x1')](_0x2ae7('0x6'),_0x2ae7('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0x2ae7('0x5')]},'idField':{'type':Sequelize[_0x2ae7('0x5')]},'nameField':{'type':Sequelize[_0x2ae7('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2ae7('0x5')]}}; \ No newline at end of file +var _0x5712=['STRING','BOOLEAN','exports','ENUM','string','variable','customVariable','keyValue','picklist'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x5712,0x16a));var _0x2571=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x5712[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require('sequelize');module[_0x2571('0x0')]={'type':{'type':Sequelize[_0x2571('0x1')](_0x2571('0x2'),_0x2571('0x3'),_0x2571('0x4'),_0x2571('0x5'),_0x2571('0x6')),'defaultValue':_0x2571('0x2')},'content':{'type':Sequelize[_0x2571('0x7')]},'key':{'type':Sequelize[_0x2571('0x7')]},'keyType':{'type':Sequelize[_0x2571('0x1')](_0x2571('0x2'),_0x2571('0x3'),_0x2571('0x4'))},'keyContent':{'type':Sequelize[_0x2571('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x2571('0x7')]},'customField':{'type':Sequelize[_0x2571('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2571('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index d59e708..ffc9a25 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 _0x073e=['length','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','FreshdeskField','rawAttributes','type','key','keys','query','filters','attributes','model','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','intersection'];(function(_0x3b71f5,_0x1d9b83){var _0xb0338f=function(_0x42da9b){while(--_0x42da9b){_0x3b71f5['push'](_0x3b71f5['shift']());}};_0xb0338f(++_0x1d9b83);}(_0x073e,0x181));var _0xe073=function(_0x4ac48d,_0x171a68){_0x4ac48d=_0x4ac48d-0x0;var _0x7537af=_0x073e[_0x4ac48d];return _0x7537af;};'use strict';var emlformat=require(_0xe073('0x0'));var rimraf=require(_0xe073('0x1'));var zipdir=require(_0xe073('0x2'));var jsonpatch=require(_0xe073('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe073('0x4'));var util=require(_0xe073('0x5'));var path=require(_0xe073('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe073('0x7'));var _=require(_0xe073('0x8'));var squel=require(_0xe073('0x9'));var crypto=require(_0xe073('0xa'));var jsforce=require(_0xe073('0xb'));var deskjs=require(_0xe073('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe073('0xd'));var Papa=require(_0xe073('0xe'));var Redis=require(_0xe073('0xf'));var authService=require(_0xe073('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe073('0x11'));var hardwareService=require(_0xe073('0x12'));var logger=require(_0xe073('0x13'))(_0xe073('0x14'));var utils=require(_0xe073('0x15'));var config=require(_0xe073('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe073('0x17'))['db'];function respondWithStatusCode(_0x56e3f5,_0x3dedf7){_0x3dedf7=_0x3dedf7||0xcc;return function(_0x5d2f2f){if(_0x5d2f2f){return _0x56e3f5[_0xe073('0x18')](_0x3dedf7);}return _0x56e3f5['status'](_0x3dedf7)[_0xe073('0x19')]();};}function respondWithResult(_0x27d34,_0x47828d){_0x47828d=_0x47828d||0xc8;return function(_0x2ce92d){if(_0x2ce92d){return _0x27d34[_0xe073('0x1a')](_0x47828d)[_0xe073('0x1b')](_0x2ce92d);}};}function respondWithFilteredResult(_0x2f4b36,_0xfb28f5){return function(_0x208f2e){if(_0x208f2e){var _0x26f3d3=typeof _0xfb28f5[_0xe073('0x1c')]==='undefined'&&typeof _0xfb28f5['limit']==='undefined';var _0x4c578c=_0x208f2e[_0xe073('0x1d')];var _0x10486c=_0x26f3d3?0x0:_0xfb28f5[_0xe073('0x1c')];var _0x4f9c8e=_0x26f3d3?_0x208f2e[_0xe073('0x1d')]:_0xfb28f5[_0xe073('0x1c')]+_0xfb28f5[_0xe073('0x1e')];var _0x54c10e;if(_0x4f9c8e>=_0x4c578c){_0x4f9c8e=_0x4c578c;_0x54c10e=0xc8;}else{_0x54c10e=0xce;}_0x2f4b36[_0xe073('0x1a')](_0x54c10e);return _0x2f4b36[_0xe073('0x1f')](_0xe073('0x20'),_0x10486c+'-'+_0x4f9c8e+'/'+_0x4c578c)[_0xe073('0x1b')](_0x208f2e);}return null;};}function patchUpdates(_0x43668e){return function(_0x17dd4b){try{jsonpatch[_0xe073('0x21')](_0x17dd4b,_0x43668e,!![]);}catch(_0x1d7a13){return BPromise[_0xe073('0x22')](_0x1d7a13);}return _0x17dd4b[_0xe073('0x23')]();};}function saveUpdates(_0x5143fa,_0x4405fd){return function(_0x21f9c2){if(_0x21f9c2){return _0x21f9c2[_0xe073('0x24')](_0x5143fa)[_0xe073('0x25')](function(_0x39bcb4){return _0x39bcb4;});}return null;};}function removeEntity(_0x275aa8,_0x504c26){return function(_0x4c76ef){if(_0x4c76ef){return _0x4c76ef[_0xe073('0x26')]()['then'](function(){_0x275aa8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c4137,_0x54a38b){return function(_0x50795f){if(!_0x50795f){_0x5c4137[_0xe073('0x18')](0x194);}return _0x50795f;};}function handleError(_0xff003,_0x5bd226){_0x5bd226=_0x5bd226||0x1f4;return function(_0x1fca27){logger[_0xe073('0x27')](_0x1fca27[_0xe073('0x28')]);if(_0x1fca27['name']){delete _0x1fca27[_0xe073('0x29')];}_0xff003['status'](_0x5bd226)[_0xe073('0x2a')](_0x1fca27);};}exports[_0xe073('0x2b')]=function(_0x599972,_0x5dfff9){var _0x15adbb={},_0x859ed8={},_0x278fbb={'count':0x0,'rows':[]};var _0x2f1cd2=_[_0xe073('0x2c')](db[_0xe073('0x2d')][_0xe073('0x2e')],function(_0x2a206a){return{'name':_0x2a206a['fieldName'],'type':_0x2a206a[_0xe073('0x2f')][_0xe073('0x30')]};});_0x859ed8['model']=_['map'](_0x2f1cd2,_0xe073('0x29'));_0x859ed8['query']=_[_0xe073('0x31')](_0x599972[_0xe073('0x32')]);_0x859ed8[_0xe073('0x33')]=_['intersection'](_0x859ed8['model'],_0x859ed8[_0xe073('0x32')]);_0x15adbb[_0xe073('0x34')]=_['intersection'](_0x859ed8[_0xe073('0x35')],qs[_0xe073('0x36')](_0x599972[_0xe073('0x32')]['fields']));_0x15adbb[_0xe073('0x34')]=_0x15adbb['attributes']['length']?_0x15adbb[_0xe073('0x34')]:_0x859ed8[_0xe073('0x35')];if(!_0x599972[_0xe073('0x32')]['hasOwnProperty'](_0xe073('0x37'))){_0x15adbb[_0xe073('0x1e')]=qs[_0xe073('0x1e')](_0x599972['query'][_0xe073('0x1e')]);_0x15adbb[_0xe073('0x1c')]=qs[_0xe073('0x1c')](_0x599972[_0xe073('0x32')][_0xe073('0x1c')]);}_0x15adbb[_0xe073('0x38')]=qs['sort'](_0x599972[_0xe073('0x32')][_0xe073('0x39')]);_0x15adbb[_0xe073('0x3a')]=qs['filters'](_[_0xe073('0x3b')](_0x599972[_0xe073('0x32')],_0x859ed8[_0xe073('0x33')]),_0x2f1cd2);if(_0x599972[_0xe073('0x32')][_0xe073('0x3c')]){_0x15adbb['where']=_[_0xe073('0x3d')](_0x15adbb['where'],{'$or':_[_0xe073('0x2c')](_0x2f1cd2,function(_0x22d278){if(_0x22d278[_0xe073('0x2f')]!==_0xe073('0x3e')){var _0x40f991={};_0x40f991[_0x22d278[_0xe073('0x29')]]={'$like':'%'+_0x599972[_0xe073('0x32')][_0xe073('0x3c')]+'%'};return _0x40f991;}})});}_0x15adbb=_[_0xe073('0x3d')]({},_0x15adbb,_0x599972[_0xe073('0x3f')]);var _0x12976c={'where':_0x15adbb[_0xe073('0x3a')]};return db[_0xe073('0x2d')]['count'](_0x12976c)[_0xe073('0x25')](function(_0x577c87){_0x278fbb[_0xe073('0x1d')]=_0x577c87;if(_0x599972[_0xe073('0x32')][_0xe073('0x40')]){_0x15adbb[_0xe073('0x41')]=[{'all':!![]}];}return db['FreshdeskField'][_0xe073('0x42')](_0x15adbb);})[_0xe073('0x25')](function(_0x93852a){_0x278fbb[_0xe073('0x43')]=_0x93852a;return _0x278fbb;})[_0xe073('0x25')](respondWithFilteredResult(_0x5dfff9,_0x15adbb))['catch'](handleError(_0x5dfff9,null));};exports[_0xe073('0x44')]=function(_0x4b2a82,_0x764196){var _0x2a8c57={'raw':!![],'where':{'id':_0x4b2a82[_0xe073('0x45')]['id']}},_0x125d1f={};_0x125d1f[_0xe073('0x35')]=_[_0xe073('0x31')](db[_0xe073('0x2d')][_0xe073('0x2e')]);_0x125d1f[_0xe073('0x32')]=_[_0xe073('0x31')](_0x4b2a82[_0xe073('0x32')]);_0x125d1f['filters']=_['intersection'](_0x125d1f[_0xe073('0x35')],_0x125d1f[_0xe073('0x32')]);_0x2a8c57[_0xe073('0x34')]=_[_0xe073('0x46')](_0x125d1f[_0xe073('0x35')],qs['fields'](_0x4b2a82[_0xe073('0x32')][_0xe073('0x36')]));_0x2a8c57[_0xe073('0x34')]=_0x2a8c57[_0xe073('0x34')][_0xe073('0x47')]?_0x2a8c57['attributes']:_0x125d1f[_0xe073('0x35')];if(_0x4b2a82['query']['includeAll']){_0x2a8c57[_0xe073('0x41')]=[{'all':!![]}];}_0x2a8c57=_[_0xe073('0x3d')]({},_0x2a8c57,_0x4b2a82['options']);return db['FreshdeskField'][_0xe073('0x48')](_0x2a8c57)[_0xe073('0x25')](handleEntityNotFound(_0x764196,null))[_0xe073('0x25')](respondWithResult(_0x764196,null))[_0xe073('0x49')](handleError(_0x764196,null));};exports[_0xe073('0x4a')]=function(_0x1eec23,_0x317159){return db['FreshdeskField'][_0xe073('0x4a')](_0x1eec23['body'],{})[_0xe073('0x25')](respondWithResult(_0x317159,0xc9))[_0xe073('0x49')](handleError(_0x317159,null));};exports[_0xe073('0x24')]=function(_0x4e1f1d,_0x4d5bcd){if(_0x4e1f1d[_0xe073('0x4b')]['id']){delete _0x4e1f1d[_0xe073('0x4b')]['id'];}return db[_0xe073('0x2d')]['find']({'where':{'id':_0x4e1f1d[_0xe073('0x45')]['id']}})[_0xe073('0x25')](handleEntityNotFound(_0x4d5bcd,null))[_0xe073('0x25')](saveUpdates(_0x4e1f1d[_0xe073('0x4b')],null))[_0xe073('0x25')](respondWithResult(_0x4d5bcd,null))[_0xe073('0x49')](handleError(_0x4d5bcd,null));};exports[_0xe073('0x26')]=function(_0x307541,_0x3238eb){return db['FreshdeskField'][_0xe073('0x48')]({'where':{'id':_0x307541['params']['id']}})[_0xe073('0x25')](handleEntityNotFound(_0x3238eb,null))['then'](removeEntity(_0x3238eb,null))[_0xe073('0x49')](handleError(_0x3238eb,null));}; \ No newline at end of file +var _0x6ae2=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','then','destroy','error','name','index','map','FreshdeskField','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','show','params','find','catch','create','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv'];(function(_0x2bbe3e,_0x9bcd3c){var _0x49402c=function(_0x11f160){while(--_0x11f160){_0x2bbe3e['push'](_0x2bbe3e['shift']());}};_0x49402c(++_0x9bcd3c);}(_0x6ae2,0x1ed));var _0x26ae=function(_0x4d822e,_0xa4f7de){_0x4d822e=_0x4d822e-0x0;var _0x48c6eb=_0x6ae2[_0x4d822e];return _0x48c6eb;};'use strict';var emlformat=require(_0x26ae('0x0'));var rimraf=require(_0x26ae('0x1'));var zipdir=require(_0x26ae('0x2'));var jsonpatch=require(_0x26ae('0x3'));var rp=require(_0x26ae('0x4'));var moment=require(_0x26ae('0x5'));var BPromise=require(_0x26ae('0x6'));var Mustache=require(_0x26ae('0x7'));var util=require(_0x26ae('0x8'));var path=require('path');var sox=require(_0x26ae('0x9'));var csv=require(_0x26ae('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x26ae('0xb'));var squel=require(_0x26ae('0xc'));var crypto=require(_0x26ae('0xd'));var jsforce=require(_0x26ae('0xe'));var deskjs=require(_0x26ae('0xf'));var toCsv=require(_0x26ae('0xa'));var querystring=require(_0x26ae('0x10'));var Papa=require(_0x26ae('0x11'));var Redis=require(_0x26ae('0x12'));var authService=require(_0x26ae('0x13'));var qs=require(_0x26ae('0x14'));var as=require(_0x26ae('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x26ae('0x16'))('api');var utils=require(_0x26ae('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x26ae('0x18'))['db'];function respondWithStatusCode(_0x46bc2,_0x21811d){_0x21811d=_0x21811d||0xcc;return function(_0x17f9a6){if(_0x17f9a6){return _0x46bc2[_0x26ae('0x19')](_0x21811d);}return _0x46bc2[_0x26ae('0x1a')](_0x21811d)[_0x26ae('0x1b')]();};}function respondWithResult(_0x1c66b8,_0x2390a7){_0x2390a7=_0x2390a7||0xc8;return function(_0x52d611){if(_0x52d611){return _0x1c66b8[_0x26ae('0x1a')](_0x2390a7)[_0x26ae('0x1c')](_0x52d611);}};}function respondWithFilteredResult(_0x4e5c4e,_0x15d055){return function(_0x32cd9e){if(_0x32cd9e){var _0x497974=typeof _0x15d055[_0x26ae('0x1d')]===_0x26ae('0x1e')&&typeof _0x15d055[_0x26ae('0x1f')]===_0x26ae('0x1e');var _0x13ad43=_0x32cd9e[_0x26ae('0x20')];var _0x250dc0=_0x497974?0x0:_0x15d055[_0x26ae('0x1d')];var _0x28584c=_0x497974?_0x32cd9e[_0x26ae('0x20')]:_0x15d055[_0x26ae('0x1d')]+_0x15d055[_0x26ae('0x1f')];var _0x38102c;if(_0x28584c>=_0x13ad43){_0x28584c=_0x13ad43;_0x38102c=0xc8;}else{_0x38102c=0xce;}_0x4e5c4e[_0x26ae('0x1a')](_0x38102c);return _0x4e5c4e[_0x26ae('0x21')](_0x26ae('0x22'),_0x250dc0+'-'+_0x28584c+'/'+_0x13ad43)[_0x26ae('0x1c')](_0x32cd9e);}return null;};}function patchUpdates(_0xdfcd69){return function(_0x22d535){try{jsonpatch[_0x26ae('0x23')](_0x22d535,_0xdfcd69,!![]);}catch(_0x334153){return BPromise['reject'](_0x334153);}return _0x22d535['save']();};}function saveUpdates(_0x2a2ba5,_0x5d72dc){return function(_0x22c47b){if(_0x22c47b){return _0x22c47b['update'](_0x2a2ba5)[_0x26ae('0x24')](function(_0x2e34d1){return _0x2e34d1;});}return null;};}function removeEntity(_0x19f641,_0x57062e){return function(_0x4ab3f1){if(_0x4ab3f1){return _0x4ab3f1[_0x26ae('0x25')]()[_0x26ae('0x24')](function(){_0x19f641[_0x26ae('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2caf20,_0x295cc2){return function(_0x53e0da){if(!_0x53e0da){_0x2caf20[_0x26ae('0x19')](0x194);}return _0x53e0da;};}function handleError(_0x2658ed,_0x19eacc){_0x19eacc=_0x19eacc||0x1f4;return function(_0x4a0045){logger[_0x26ae('0x26')](_0x4a0045['stack']);if(_0x4a0045[_0x26ae('0x27')]){delete _0x4a0045[_0x26ae('0x27')];}_0x2658ed[_0x26ae('0x1a')](_0x19eacc)['send'](_0x4a0045);};}exports[_0x26ae('0x28')]=function(_0x5a8301,_0x4cddc4){var _0x2f2e9d={},_0x2fcc89={},_0x5979ec={'count':0x0,'rows':[]};var _0x5308c=_[_0x26ae('0x29')](db[_0x26ae('0x2a')][_0x26ae('0x2b')],function(_0x2d8cac){return{'name':_0x2d8cac['fieldName'],'type':_0x2d8cac[_0x26ae('0x2c')][_0x26ae('0x2d')]};});_0x2fcc89[_0x26ae('0x2e')]=_[_0x26ae('0x29')](_0x5308c,_0x26ae('0x27'));_0x2fcc89['query']=_[_0x26ae('0x2f')](_0x5a8301[_0x26ae('0x30')]);_0x2fcc89[_0x26ae('0x31')]=_[_0x26ae('0x32')](_0x2fcc89[_0x26ae('0x2e')],_0x2fcc89[_0x26ae('0x30')]);_0x2f2e9d[_0x26ae('0x33')]=_[_0x26ae('0x32')](_0x2fcc89['model'],qs[_0x26ae('0x34')](_0x5a8301['query']['fields']));_0x2f2e9d[_0x26ae('0x33')]=_0x2f2e9d[_0x26ae('0x33')][_0x26ae('0x35')]?_0x2f2e9d['attributes']:_0x2fcc89[_0x26ae('0x2e')];if(!_0x5a8301[_0x26ae('0x30')][_0x26ae('0x36')](_0x26ae('0x37'))){_0x2f2e9d[_0x26ae('0x1f')]=qs[_0x26ae('0x1f')](_0x5a8301[_0x26ae('0x30')][_0x26ae('0x1f')]);_0x2f2e9d[_0x26ae('0x1d')]=qs[_0x26ae('0x1d')](_0x5a8301[_0x26ae('0x30')][_0x26ae('0x1d')]);}_0x2f2e9d[_0x26ae('0x38')]=qs[_0x26ae('0x39')](_0x5a8301['query'][_0x26ae('0x39')]);_0x2f2e9d[_0x26ae('0x3a')]=qs[_0x26ae('0x31')](_['pick'](_0x5a8301[_0x26ae('0x30')],_0x2fcc89[_0x26ae('0x31')]),_0x5308c);if(_0x5a8301[_0x26ae('0x30')][_0x26ae('0x3b')]){_0x2f2e9d[_0x26ae('0x3a')]=_['merge'](_0x2f2e9d[_0x26ae('0x3a')],{'$or':_[_0x26ae('0x29')](_0x5308c,function(_0x49eb68){if(_0x49eb68[_0x26ae('0x2c')]!==_0x26ae('0x3c')){var _0x11586b={};_0x11586b[_0x49eb68['name']]={'$like':'%'+_0x5a8301['query']['filter']+'%'};return _0x11586b;}})});}_0x2f2e9d=_[_0x26ae('0x3d')]({},_0x2f2e9d,_0x5a8301[_0x26ae('0x3e')]);var _0x607968={'where':_0x2f2e9d[_0x26ae('0x3a')]};return db[_0x26ae('0x2a')]['count'](_0x607968)[_0x26ae('0x24')](function(_0x3fd0ef){_0x5979ec[_0x26ae('0x20')]=_0x3fd0ef;if(_0x5a8301[_0x26ae('0x30')][_0x26ae('0x3f')]){_0x2f2e9d[_0x26ae('0x40')]=[{'all':!![]}];}return db[_0x26ae('0x2a')]['findAll'](_0x2f2e9d);})[_0x26ae('0x24')](function(_0x7d041f){_0x5979ec['rows']=_0x7d041f;return _0x5979ec;})[_0x26ae('0x24')](respondWithFilteredResult(_0x4cddc4,_0x2f2e9d))['catch'](handleError(_0x4cddc4,null));};exports[_0x26ae('0x41')]=function(_0x150bf1,_0x92a7d8){var _0x5e0369={'raw':!![],'where':{'id':_0x150bf1[_0x26ae('0x42')]['id']}},_0x2a0797={};_0x2a0797[_0x26ae('0x2e')]=_[_0x26ae('0x2f')](db[_0x26ae('0x2a')][_0x26ae('0x2b')]);_0x2a0797['query']=_['keys'](_0x150bf1['query']);_0x2a0797[_0x26ae('0x31')]=_[_0x26ae('0x32')](_0x2a0797[_0x26ae('0x2e')],_0x2a0797[_0x26ae('0x30')]);_0x5e0369[_0x26ae('0x33')]=_['intersection'](_0x2a0797['model'],qs[_0x26ae('0x34')](_0x150bf1[_0x26ae('0x30')][_0x26ae('0x34')]));_0x5e0369['attributes']=_0x5e0369[_0x26ae('0x33')]['length']?_0x5e0369[_0x26ae('0x33')]:_0x2a0797[_0x26ae('0x2e')];if(_0x150bf1['query']['includeAll']){_0x5e0369[_0x26ae('0x40')]=[{'all':!![]}];}_0x5e0369=_['merge']({},_0x5e0369,_0x150bf1[_0x26ae('0x3e')]);return db[_0x26ae('0x2a')][_0x26ae('0x43')](_0x5e0369)[_0x26ae('0x24')](handleEntityNotFound(_0x92a7d8,null))[_0x26ae('0x24')](respondWithResult(_0x92a7d8,null))[_0x26ae('0x44')](handleError(_0x92a7d8,null));};exports[_0x26ae('0x45')]=function(_0x3484cb,_0x21a623){return db[_0x26ae('0x2a')][_0x26ae('0x45')](_0x3484cb['body'],{})[_0x26ae('0x24')](respondWithResult(_0x21a623,0xc9))[_0x26ae('0x44')](handleError(_0x21a623,null));};exports[_0x26ae('0x46')]=function(_0x1fe641,_0x3e56bb){if(_0x1fe641[_0x26ae('0x47')]['id']){delete _0x1fe641[_0x26ae('0x47')]['id'];}return db[_0x26ae('0x2a')][_0x26ae('0x43')]({'where':{'id':_0x1fe641[_0x26ae('0x42')]['id']}})[_0x26ae('0x24')](handleEntityNotFound(_0x3e56bb,null))[_0x26ae('0x24')](saveUpdates(_0x1fe641[_0x26ae('0x47')],null))['then'](respondWithResult(_0x3e56bb,null))[_0x26ae('0x44')](handleError(_0x3e56bb,null));};exports['destroy']=function(_0x3dd581,_0x23e6be){return db[_0x26ae('0x2a')][_0x26ae('0x43')]({'where':{'id':_0x3dd581[_0x26ae('0x42')]['id']}})[_0x26ae('0x24')](handleEntityNotFound(_0x23e6be,null))['then'](removeEntity(_0x23e6be,null))[_0x26ae('0x44')](handleError(_0x23e6be,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index ffd913c..e1e4b4d 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 _0x41eb=['define','FreshdeskField','freshdesk_unique_index','idField','FieldId','lodash','../../config/logger','bluebird','request-promise','rimraf','./intFreshdeskField.attributes','exports'];(function(_0x73b6d,_0x2f9cc4){var _0xff3881=function(_0x23fc4d){while(--_0x23fc4d){_0x73b6d['push'](_0x73b6d['shift']());}};_0xff3881(++_0x2f9cc4);}(_0x41eb,0x7d));var _0xb41e=function(_0x59e821,_0x86c723){_0x59e821=_0x59e821-0x0;var _0x5333f6=_0x41eb[_0x59e821];return _0x5333f6;};'use strict';var _=require(_0xb41e('0x0'));var util=require('util');var logger=require(_0xb41e('0x1'))('api');var moment=require('moment');var BPromise=require(_0xb41e('0x2'));var rp=require(_0xb41e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb41e('0x4'));var config=require('../../config/environment');var attributes=require(_0xb41e('0x5'));module[_0xb41e('0x6')]=function(_0x4d9f39,_0x1bcb46){return _0x4d9f39[_0xb41e('0x7')](_0xb41e('0x8'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0xb41e('0x9'),'fields':[_0xb41e('0xa'),_0xb41e('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0a4b=['../../config/logger','api','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','freshdesk_unique_index','idField','lodash'];(function(_0x45911d,_0x25b782){var _0x387de2=function(_0x148819){while(--_0x148819){_0x45911d['push'](_0x45911d['shift']());}};_0x387de2(++_0x25b782);}(_0x0a4b,0x6d));var _0xb0a4=function(_0x4af9e7,_0x12b844){_0x4af9e7=_0x4af9e7-0x0;var _0x45e7a6=_0x0a4b[_0x4af9e7];return _0x45e7a6;};'use strict';var _=require(_0xb0a4('0x0'));var util=require('util');var logger=require(_0xb0a4('0x1'))(_0xb0a4('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb0a4('0x3'));var config=require(_0xb0a4('0x4'));var attributes=require(_0xb0a4('0x5'));module[_0xb0a4('0x6')]=function(_0x53091a,_0x44e301){return _0x53091a[_0xb0a4('0x7')]('FreshdeskField',attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0xb0a4('0x8'),'fields':[_0xb0a4('0x9'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index 368c577..ebf1a4a 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 _0xda1c=['debug','stringify','error','message','info','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/logger','client','http','request','then','FreshdeskField,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xda1c,0x1b7));var _0xcda1=function(_0x53b97c,_0x38e649){_0x53b97c=_0x53b97c-0x0;var _0x49ad3d=_0xda1c[_0x53b97c];return _0x49ad3d;};'use strict';var _=require(_0xcda1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcda1('0x1'));var fs=require('fs');var Redis=require(_0xcda1('0x2'));var db=require(_0xcda1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xcda1('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xcda1('0x5')][_0xcda1('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x6d6030,_0x49d967,_0x3ffb97){return new BPromise(function(_0x5aecc7,_0x2c1da5){return client[_0xcda1('0x7')](_0x6d6030,_0x3ffb97)[_0xcda1('0x8')](function(_0x626a4a){logger['info'](_0xcda1('0x9'),_0x49d967,_0xcda1('0xa'));logger[_0xcda1('0xb')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x49d967,_0xcda1('0xa'),JSON[_0xcda1('0xc')](_0x626a4a));if(_0x626a4a[_0xcda1('0xd')]){if(_0x626a4a[_0xcda1('0xd')]['code']===0x1f4){logger[_0xcda1('0xd')]('FreshdeskField,\x20%s,\x20%s',_0x49d967,_0x626a4a[_0xcda1('0xd')][_0xcda1('0xe')]);return _0x2c1da5(_0x626a4a[_0xcda1('0xd')][_0xcda1('0xe')]);}logger['error'](_0xcda1('0x9'),_0x49d967,_0x626a4a[_0xcda1('0xd')][_0xcda1('0xe')]);return _0x5aecc7(_0x626a4a[_0xcda1('0xd')][_0xcda1('0xe')]);}else{logger[_0xcda1('0xf')](_0xcda1('0x9'),_0x49d967,'request\x20sent');_0x5aecc7(_0x626a4a[_0xcda1('0x10')][_0xcda1('0xe')]);}})[_0xcda1('0x11')](function(_0x2c87af){logger[_0xcda1('0xd')]('FreshdeskField,\x20%s,\x20%s',_0x49d967,_0x2c87af);_0x2c1da5(_0x2c87af);});});} \ No newline at end of file +var _0x325f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','code','error','message','result','catch'];(function(_0x170387,_0x597ba5){var _0x31aed1=function(_0x13efc1){while(--_0x13efc1){_0x170387['push'](_0x170387['shift']());}};_0x31aed1(++_0x597ba5);}(_0x325f,0xe1));var _0xf325=function(_0x1302ab,_0x2ca912){_0x1302ab=_0x1302ab-0x0;var _0x196605=_0x325f[_0x1302ab];return _0x196605;};'use strict';var _=require(_0xf325('0x0'));var util=require(_0xf325('0x1'));var moment=require(_0xf325('0x2'));var BPromise=require(_0xf325('0x3'));var rs=require(_0xf325('0x4'));var fs=require('fs');var Redis=require(_0xf325('0x5'));var db=require(_0xf325('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf325('0x7'))(_0xf325('0x8'));var config=require(_0xf325('0x9'));var jayson=require(_0xf325('0xa'));var client=jayson[_0xf325('0xb')][_0xf325('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x178444,_0x276a58,_0x3934de){return new BPromise(function(_0x217e70,_0x1871b5){return client[_0xf325('0xd')](_0x178444,_0x3934de)[_0xf325('0xe')](function(_0x4655c0){logger[_0xf325('0xf')](_0xf325('0x10'),_0x276a58,_0xf325('0x11'));logger[_0xf325('0x12')](_0xf325('0x13'),_0x276a58,_0xf325('0x11'),JSON['stringify'](_0x4655c0));if(_0x4655c0['error']){if(_0x4655c0['error'][_0xf325('0x14')]===0x1f4){logger['error']('FreshdeskField,\x20%s,\x20%s',_0x276a58,_0x4655c0[_0xf325('0x15')][_0xf325('0x16')]);return _0x1871b5(_0x4655c0[_0xf325('0x15')]['message']);}logger[_0xf325('0x15')](_0xf325('0x10'),_0x276a58,_0x4655c0[_0xf325('0x15')]['message']);return _0x217e70(_0x4655c0[_0xf325('0x15')][_0xf325('0x16')]);}else{logger[_0xf325('0xf')](_0xf325('0x10'),_0x276a58,_0xf325('0x11'));_0x217e70(_0x4655c0[_0xf325('0x17')][_0xf325('0x16')]);}})[_0xf325('0x18')](function(_0xef5426){logger['error'](_0xf325('0x10'),_0x276a58,_0xef5426);_0x1871b5(_0xef5426);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 157f056..8853af5 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 _0x1be1=['getFields','post','create','addConfiguration','/:id','delete','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesAccount.controller','get','isAuthenticated','show','/:id/configurations','/:id/fields'];(function(_0x49f7c3,_0x339f8c){var _0x147697=function(_0x2559bc){while(--_0x2559bc){_0x49f7c3['push'](_0x49f7c3['shift']());}};_0x147697(++_0x339f8c);}(_0x1be1,0x192));var _0x11be=function(_0x440cbb,_0x3b70d9){_0x440cbb=_0x440cbb-0x0;var _0x451748=_0x1be1[_0x440cbb];return _0x451748;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x11be('0x0'));var timeout=require(_0x11be('0x1'));var express=require('express');var router=express[_0x11be('0x2')]();var fs_extra=require(_0x11be('0x3'));var auth=require(_0x11be('0x4'));var interaction=require(_0x11be('0x5'));var config=require('../../config/environment');var controller=require(_0x11be('0x6'));router[_0x11be('0x7')]('/',auth[_0x11be('0x8')](),controller['index']);router[_0x11be('0x7')]('/:id',auth[_0x11be('0x8')](),controller[_0x11be('0x9')]);router[_0x11be('0x7')](_0x11be('0xa'),auth[_0x11be('0x8')](),controller['getConfigurations']);router[_0x11be('0x7')](_0x11be('0xb'),auth['isAuthenticated'](),controller[_0x11be('0xc')]);router[_0x11be('0xd')]('/',auth[_0x11be('0x8')](),controller[_0x11be('0xe')]);router['post'](_0x11be('0xa'),auth[_0x11be('0x8')](),controller[_0x11be('0xf')]);router['put'](_0x11be('0x10'),auth[_0x11be('0x8')](),controller['update']);router[_0x11be('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=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(_0xc0d9bc,_0x2bd6be){var _0x32ff73=function(_0x28c592){while(--_0x28c592){_0xc0d9bc['push'](_0xc0d9bc['shift']());}};_0x32ff73(++_0x2bd6be);}(_0x282b,0xec));var _0xb282=function(_0x384b7a,_0x43396d){_0x384b7a=_0x384b7a-0x0;var _0x517bef=_0x282b[_0x384b7a];return _0x517bef;};'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 e1019c4..1f4e041 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 _0xeb3b=['sequelize','exports','STRING'];(function(_0x5e42a7,_0x3eba35){var _0x36d21b=function(_0x567f0a){while(--_0x567f0a){_0x5e42a7['push'](_0x5e42a7['shift']());}};_0x36d21b(++_0x3eba35);}(_0xeb3b,0x19e));var _0xbeb3=function(_0x1ebce2,_0x10e903){_0x1ebce2=_0x1ebce2-0x0;var _0x4a330c=_0xeb3b[_0x1ebce2];return _0x4a330c;};'use strict';var Sequelize=require(_0xbeb3('0x0'));module[_0xbeb3('0x1')]={'name':{'type':Sequelize[_0xbeb3('0x2')]},'description':{'type':Sequelize[_0xbeb3('0x2')]},'username':{'type':Sequelize[_0xbeb3('0x2')],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xbeb3('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xbeb3('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xbbbc=['remoteUri','sequelize','exports','STRING','username'];(function(_0x16b557,_0x59a189){var _0x5ce3c6=function(_0x492f6d){while(--_0x492f6d){_0x16b557['push'](_0x16b557['shift']());}};_0x5ce3c6(++_0x59a189);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x5a5fb9,_0x314837){_0x5a5fb9=_0x5a5fb9-0x0;var _0x3585cd=_0xbbbc[_0x5a5fb9];return _0x3585cd;};'use strict';var Sequelize=require(_0xcbbb('0x0'));module[_0xcbbb('0x1')]={'name':{'type':Sequelize[_0xcbbb('0x2')]},'description':{'type':Sequelize[_0xcbbb('0x2')]},'username':{'type':Sequelize[_0xcbbb('0x2')],'unique':_0xcbbb('0x3')},'apiKey':{'type':Sequelize[_0xcbbb('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xcbbb('0x4')},'serverUrl':{'type':Sequelize[_0xcbbb('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 736ee1c..0786de7 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 _0xcbf2=['map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','findAll','rows','catch','show','params','include','options','find','create','body','getConfigurations','findOne','FreshsalesConfiguration','merge','hasOwnProperty','addConfiguration','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','Subjects','getFields','username','apiKey','remoteUri','slice','lastIndexOf','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','stringify','send','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','end','error','stack','name'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0xcbf2,0xa1));var _0x2cbf=function(_0xc96ae,_0x259ceb){_0xc96ae=_0xc96ae-0x0;var _0x497081=_0xcbf2[_0xc96ae];return _0x497081;};'use strict';var emlformat=require(_0x2cbf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2cbf('0x1'));var jsonpatch=require(_0x2cbf('0x2'));var rp=require('request-promise');var moment=require(_0x2cbf('0x3'));var BPromise=require(_0x2cbf('0x4'));var Mustache=require(_0x2cbf('0x5'));var util=require(_0x2cbf('0x6'));var path=require(_0x2cbf('0x7'));var sox=require(_0x2cbf('0x8'));var csv=require(_0x2cbf('0x9'));var ejs=require(_0x2cbf('0xa'));var fs=require('fs');var fs_extra=require(_0x2cbf('0xb'));var _=require(_0x2cbf('0xc'));var squel=require('squel');var crypto=require(_0x2cbf('0xd'));var jsforce=require(_0x2cbf('0xe'));var deskjs=require(_0x2cbf('0xf'));var toCsv=require(_0x2cbf('0x9'));var querystring=require(_0x2cbf('0x10'));var Papa=require(_0x2cbf('0x11'));var Redis=require(_0x2cbf('0x12'));var authService=require(_0x2cbf('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x2cbf('0x14'));var hardwareService=require(_0x2cbf('0x15'));var logger=require(_0x2cbf('0x16'))(_0x2cbf('0x17'));var utils=require(_0x2cbf('0x18'));var config=require(_0x2cbf('0x19'));var licenseUtil=require(_0x2cbf('0x1a'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x42070d,_0x5435b9){_0x5435b9=_0x5435b9||0xcc;return function(_0x3dd5f6){if(_0x3dd5f6){return _0x42070d[_0x2cbf('0x1b')](_0x5435b9);}return _0x42070d[_0x2cbf('0x1c')](_0x5435b9)['end']();};}function respondWithResult(_0x1ce538,_0x342ba9){_0x342ba9=_0x342ba9||0xc8;return function(_0x553c79){if(_0x553c79){return _0x1ce538['status'](_0x342ba9)[_0x2cbf('0x1d')](_0x553c79);}};}function respondWithFilteredResult(_0x5f4cd2,_0x3378cd){return function(_0x1363b3){if(_0x1363b3){var _0x330708=typeof _0x3378cd[_0x2cbf('0x1e')]===_0x2cbf('0x1f')&&typeof _0x3378cd[_0x2cbf('0x20')]==='undefined';var _0x4bdd81=_0x1363b3[_0x2cbf('0x21')];var _0xec2745=_0x330708?0x0:_0x3378cd[_0x2cbf('0x1e')];var _0x5ac50e=_0x330708?_0x1363b3[_0x2cbf('0x21')]:_0x3378cd[_0x2cbf('0x1e')]+_0x3378cd[_0x2cbf('0x20')];var _0x2faa11;if(_0x5ac50e>=_0x4bdd81){_0x5ac50e=_0x4bdd81;_0x2faa11=0xc8;}else{_0x2faa11=0xce;}_0x5f4cd2[_0x2cbf('0x1c')](_0x2faa11);return _0x5f4cd2[_0x2cbf('0x22')](_0x2cbf('0x23'),_0xec2745+'-'+_0x5ac50e+'/'+_0x4bdd81)['json'](_0x1363b3);}return null;};}function patchUpdates(_0x314f65){return function(_0x277d85){try{jsonpatch[_0x2cbf('0x24')](_0x277d85,_0x314f65,!![]);}catch(_0x238006){return BPromise[_0x2cbf('0x25')](_0x238006);}return _0x277d85['save']();};}function saveUpdates(_0x5f1efb,_0x5a4a3a){return function(_0x27100f){if(_0x27100f){return _0x27100f['update'](_0x5f1efb)[_0x2cbf('0x26')](function(_0x1a903f){return _0x1a903f;});}return null;};}function removeEntity(_0x3a3df7,_0x21db96){return function(_0x567ff3){if(_0x567ff3){return _0x567ff3['destroy']()[_0x2cbf('0x26')](function(){_0x3a3df7[_0x2cbf('0x1c')](0xcc)[_0x2cbf('0x27')]();});}};}function handleEntityNotFound(_0x1b649b,_0x47fd07){return function(_0xc086a4){if(!_0xc086a4){_0x1b649b[_0x2cbf('0x1b')](0x194);}return _0xc086a4;};}function handleError(_0x29b3f6,_0x46ae6c){_0x46ae6c=_0x46ae6c||0x1f4;return function(_0x47c37c){logger[_0x2cbf('0x28')](_0x47c37c[_0x2cbf('0x29')]);if(_0x47c37c[_0x2cbf('0x2a')]){delete _0x47c37c['name'];}_0x29b3f6[_0x2cbf('0x1c')](_0x46ae6c)['send'](_0x47c37c);};}exports['index']=function(_0x5cd5b5,_0x15d87d){var _0x517a4d={},_0x29951f={},_0x13e4d1={'count':0x0,'rows':[]};var _0x443224=_[_0x2cbf('0x2b')](db[_0x2cbf('0x2c')][_0x2cbf('0x2d')],function(_0x21446e){return{'name':_0x21446e[_0x2cbf('0x2e')],'type':_0x21446e[_0x2cbf('0x2f')][_0x2cbf('0x30')]};});_0x29951f[_0x2cbf('0x31')]=_[_0x2cbf('0x2b')](_0x443224,_0x2cbf('0x2a'));_0x29951f[_0x2cbf('0x32')]=_[_0x2cbf('0x33')](_0x5cd5b5[_0x2cbf('0x32')]);_0x29951f[_0x2cbf('0x34')]=_[_0x2cbf('0x35')](_0x29951f['model'],_0x29951f[_0x2cbf('0x32')]);_0x517a4d[_0x2cbf('0x36')]=_[_0x2cbf('0x35')](_0x29951f[_0x2cbf('0x31')],qs['fields'](_0x5cd5b5['query'][_0x2cbf('0x37')]));_0x517a4d[_0x2cbf('0x36')]=_0x517a4d['attributes'][_0x2cbf('0x38')]?_0x517a4d['attributes']:_0x29951f[_0x2cbf('0x31')];if(!_0x5cd5b5[_0x2cbf('0x32')]['hasOwnProperty'](_0x2cbf('0x39'))){_0x517a4d[_0x2cbf('0x20')]=qs[_0x2cbf('0x20')](_0x5cd5b5[_0x2cbf('0x32')]['limit']);_0x517a4d[_0x2cbf('0x1e')]=qs[_0x2cbf('0x1e')](_0x5cd5b5['query'][_0x2cbf('0x1e')]);}_0x517a4d[_0x2cbf('0x3a')]=qs[_0x2cbf('0x3b')](_0x5cd5b5[_0x2cbf('0x32')][_0x2cbf('0x3b')]);_0x517a4d[_0x2cbf('0x3c')]=qs[_0x2cbf('0x34')](_[_0x2cbf('0x3d')](_0x5cd5b5[_0x2cbf('0x32')],_0x29951f[_0x2cbf('0x34')]),_0x443224);if(_0x5cd5b5['query'][_0x2cbf('0x3e')]){_0x517a4d[_0x2cbf('0x3c')]=_['merge'](_0x517a4d[_0x2cbf('0x3c')],{'$or':_[_0x2cbf('0x2b')](_0x443224,function(_0x1d05cd){if(_0x1d05cd[_0x2cbf('0x2f')]!==_0x2cbf('0x3f')){var _0x127c23={};_0x127c23[_0x1d05cd['name']]={'$like':'%'+_0x5cd5b5[_0x2cbf('0x32')][_0x2cbf('0x3e')]+'%'};return _0x127c23;}})});}_0x517a4d=_['merge']({},_0x517a4d,_0x5cd5b5['options']);var _0x16076d={'where':_0x517a4d[_0x2cbf('0x3c')]};return db[_0x2cbf('0x2c')]['count'](_0x16076d)[_0x2cbf('0x26')](function(_0x352ceb){_0x13e4d1['count']=_0x352ceb;if(_0x5cd5b5[_0x2cbf('0x32')]['includeAll']){_0x517a4d['include']=[{'all':!![]}];}return db['FreshsalesAccount'][_0x2cbf('0x40')](_0x517a4d);})[_0x2cbf('0x26')](function(_0x1207ad){_0x13e4d1[_0x2cbf('0x41')]=_0x1207ad;return _0x13e4d1;})[_0x2cbf('0x26')](respondWithFilteredResult(_0x15d87d,_0x517a4d))[_0x2cbf('0x42')](handleError(_0x15d87d,null));};exports[_0x2cbf('0x43')]=function(_0x904b99,_0x1505fa){var _0x2a2908={'raw':![],'where':{'id':_0x904b99[_0x2cbf('0x44')]['id']}},_0x58fb88={};_0x58fb88[_0x2cbf('0x31')]=_[_0x2cbf('0x33')](db[_0x2cbf('0x2c')]['rawAttributes']);_0x58fb88[_0x2cbf('0x32')]=_['keys'](_0x904b99[_0x2cbf('0x32')]);_0x58fb88[_0x2cbf('0x34')]=_[_0x2cbf('0x35')](_0x58fb88[_0x2cbf('0x31')],_0x58fb88['query']);_0x2a2908['attributes']=_[_0x2cbf('0x35')](_0x58fb88[_0x2cbf('0x31')],qs['fields'](_0x904b99['query'][_0x2cbf('0x37')]));_0x2a2908[_0x2cbf('0x36')]=_0x2a2908['attributes'][_0x2cbf('0x38')]?_0x2a2908[_0x2cbf('0x36')]:_0x58fb88[_0x2cbf('0x31')];if(_0x904b99[_0x2cbf('0x32')]['includeAll']){_0x2a2908[_0x2cbf('0x45')]=[{'all':!![]}];}_0x2a2908=_['merge']({},_0x2a2908,_0x904b99[_0x2cbf('0x46')]);return db[_0x2cbf('0x2c')][_0x2cbf('0x47')](_0x2a2908)[_0x2cbf('0x26')](handleEntityNotFound(_0x1505fa,null))['then'](respondWithResult(_0x1505fa,null))[_0x2cbf('0x42')](handleError(_0x1505fa,null));};exports[_0x2cbf('0x48')]=function(_0x5b98e2,_0x30ac8c){return db[_0x2cbf('0x2c')][_0x2cbf('0x48')](_0x5b98e2[_0x2cbf('0x49')],{})[_0x2cbf('0x26')](respondWithResult(_0x30ac8c,0xc9))[_0x2cbf('0x42')](handleError(_0x30ac8c,null));};exports['update']=function(_0x277d2d,_0x34489c){if(_0x277d2d['body']['id']){delete _0x277d2d[_0x2cbf('0x49')]['id'];}return db['FreshsalesAccount'][_0x2cbf('0x47')]({'where':{'id':_0x277d2d[_0x2cbf('0x44')]['id']}})[_0x2cbf('0x26')](handleEntityNotFound(_0x34489c,null))[_0x2cbf('0x26')](saveUpdates(_0x277d2d['body'],null))[_0x2cbf('0x26')](respondWithResult(_0x34489c,null))[_0x2cbf('0x42')](handleError(_0x34489c,null));};exports['destroy']=function(_0x1ae931,_0xa62bad){return db['FreshsalesAccount'][_0x2cbf('0x47')]({'where':{'id':_0x1ae931[_0x2cbf('0x44')]['id']}})['then'](handleEntityNotFound(_0xa62bad,null))[_0x2cbf('0x26')](removeEntity(_0xa62bad,null))[_0x2cbf('0x42')](handleError(_0xa62bad,null));};exports[_0x2cbf('0x4a')]=function(_0x4a8e62,_0x2eaa33,_0x2989ba){var _0x23b699={};var _0x55a30a={};var _0x210ea7;var _0x166c7d;return db[_0x2cbf('0x2c')][_0x2cbf('0x4b')]({'where':{'id':_0x4a8e62[_0x2cbf('0x44')]['id']}})[_0x2cbf('0x26')](handleEntityNotFound(_0x2eaa33,null))['then'](function(_0x55e6da){if(_0x55e6da){_0x210ea7=_0x55e6da;_0x55a30a[_0x2cbf('0x31')]=_[_0x2cbf('0x33')](db[_0x2cbf('0x4c')][_0x2cbf('0x2d')]);_0x55a30a[_0x2cbf('0x32')]=_[_0x2cbf('0x33')](_0x4a8e62[_0x2cbf('0x32')]);_0x55a30a[_0x2cbf('0x34')]=_[_0x2cbf('0x35')](_0x55a30a['model'],_0x55a30a[_0x2cbf('0x32')]);_0x23b699['attributes']=_[_0x2cbf('0x35')](_0x55a30a[_0x2cbf('0x31')],qs[_0x2cbf('0x37')](_0x4a8e62[_0x2cbf('0x32')][_0x2cbf('0x37')]));_0x23b699[_0x2cbf('0x36')]=_0x23b699[_0x2cbf('0x36')][_0x2cbf('0x38')]?_0x23b699[_0x2cbf('0x36')]:_0x55a30a['model'];_0x23b699['order']=qs[_0x2cbf('0x3b')](_0x4a8e62['query']['sort']);_0x23b699[_0x2cbf('0x3c')]=qs[_0x2cbf('0x34')](_[_0x2cbf('0x3d')](_0x4a8e62[_0x2cbf('0x32')],_0x55a30a[_0x2cbf('0x34')]));if(_0x4a8e62[_0x2cbf('0x32')][_0x2cbf('0x3e')]){_0x23b699[_0x2cbf('0x3c')]=_[_0x2cbf('0x4d')](_0x23b699[_0x2cbf('0x3c')],{'$or':_[_0x2cbf('0x2b')](_0x23b699[_0x2cbf('0x36')],function(_0xd8fe3){var _0x56b0b1={};_0x56b0b1[_0xd8fe3]={'$like':'%'+_0x4a8e62[_0x2cbf('0x32')][_0x2cbf('0x3e')]+'%'};return _0x56b0b1;})});}_0x23b699=_[_0x2cbf('0x4d')]({},_0x23b699,_0x4a8e62[_0x2cbf('0x46')]);return _0x210ea7[_0x2cbf('0x4a')](_0x23b699);}})['then'](function(_0x48acae){if(_0x48acae){_0x166c7d=_0x48acae[_0x2cbf('0x38')];if(!_0x4a8e62[_0x2cbf('0x32')][_0x2cbf('0x4e')](_0x2cbf('0x39'))){_0x23b699['limit']=qs[_0x2cbf('0x20')](_0x4a8e62['query'][_0x2cbf('0x20')]);_0x23b699['offset']=qs[_0x2cbf('0x1e')](_0x4a8e62[_0x2cbf('0x32')][_0x2cbf('0x1e')]);}return _0x210ea7['getConfigurations'](_0x23b699);}})[_0x2cbf('0x26')](function(_0x5e1dc7){if(_0x5e1dc7){return _0x5e1dc7?{'count':_0x166c7d,'rows':_0x5e1dc7}:null;}})[_0x2cbf('0x26')](respondWithResult(_0x2eaa33,null))[_0x2cbf('0x42')](handleError(_0x2eaa33,null));};exports[_0x2cbf('0x4f')]=function(_0x43b587,_0xd4973c,_0x45d203){if(_0x43b587[_0x2cbf('0x49')]['id']){delete _0x43b587[_0x2cbf('0x49')]['id'];}return db[_0x2cbf('0x2c')][_0x2cbf('0x4b')]({'where':{'id':_0x43b587[_0x2cbf('0x44')]['id']}})['then'](handleEntityNotFound(_0xd4973c,null))[_0x2cbf('0x26')](function(_0x3b83e6){if(_0x3b83e6){_0x43b587[_0x2cbf('0x49')]['AccountId']=_0x3b83e6['id'];_0x43b587[_0x2cbf('0x49')]['Subjects']=integrations[_0x2cbf('0x50')](_0x43b587[_0x2cbf('0x49')][_0x2cbf('0x51')],_0x43b587[_0x2cbf('0x49')]['type']);_0x43b587[_0x2cbf('0x49')][_0x2cbf('0x52')]=integrations[_0x2cbf('0x53')](_0x43b587[_0x2cbf('0x49')][_0x2cbf('0x51')],_0x43b587[_0x2cbf('0x49')][_0x2cbf('0x2f')]);return db[_0x2cbf('0x4c')][_0x2cbf('0x48')](_0x43b587['body'],{'include':[{'model':db[_0x2cbf('0x54')],'as':_0x2cbf('0x55')},{'model':db[_0x2cbf('0x54')],'as':_0x2cbf('0x52')}]});}return null;})['then'](respondWithResult(_0xd4973c,null))[_0x2cbf('0x42')](handleError(_0xd4973c,null));};exports[_0x2cbf('0x56')]=function(_0x40b957,_0x2550a1,_0x742a59){var _0x7189dc='';var _0x4c33d2='';return db[_0x2cbf('0x2c')][_0x2cbf('0x4b')]({'where':{'id':_0x40b957[_0x2cbf('0x44')]['id']},'attributes':['id',_0x2cbf('0x57'),'remoteUri',_0x2cbf('0x58')]})[_0x2cbf('0x26')](handleEntityNotFound(_0x2550a1,null))[_0x2cbf('0x26')](function(_0x322b6d){if(_0x322b6d){_0x4c33d2=_0x322b6d[_0x2cbf('0x57')];_0x7189dc=_0x322b6d[_0x2cbf('0x59')];var _0x2f5e59=_0x322b6d[_0x2cbf('0x59')][_0x2cbf('0x5a')](-0x1);if(_0x2f5e59==='/'){_0x7189dc=_0x7189dc['substring'](0x0,_0x7189dc[_0x2cbf('0x5b')](_0x2f5e59));}return rp({'method':'GET','uri':util['format']('%s%s',_0x7189dc,_0x2cbf('0x5c')),'headers':{'Authorization':_0x2cbf('0x5d')+_0x322b6d['apiKey']},'json':!![]});}})[_0x2cbf('0x26')](function(_0x3d17c8){if(_0x3d17c8){var _0x536045=_0x3d17c8[_0x2cbf('0x5e')];var _0x257cb3=![];var _0x2c8425=null;for(_0x2c8425=0x0;_0x2c8425<_0x536045['length'];_0x2c8425++){if(_0x536045[_0x2c8425][_0x2cbf('0x5f')]===_0x4c33d2){_0x257cb3=!![];}}if(_0x257cb3){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x2cbf('0x60')});}}})[_0x2cbf('0x26')](respondWithResult(_0x2550a1,null))[_0x2cbf('0x42')](function(_0x5a078d){var _0x556ae7=_0x40b957['query'][_0x2cbf('0x61')]?0x1f4:_0x5a078d[_0x2cbf('0x62')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x556ae7,JSON[_0x2cbf('0x63')](_0x5a078d));delete _0x5a078d[_0x2cbf('0x2a')];if(_0x556ae7===0x191){_0x556ae7=0x190;}_0x2550a1['status'](_0x556ae7)[_0x2cbf('0x64')](_0x40b957[_0x2cbf('0x32')]['test']?{'message':_0x2cbf('0x65'),'statusCode':_0x5a078d[_0x2cbf('0x62')]}:_0x5a078d);});}; \ No newline at end of file +var _0xc104=['then','name','send','index','FreshsalesAccount','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','rows','catch','keys','find','create','body','update','destroy','params','getConfigurations','findOne','FreshsalesConfiguration','options','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','FreshsalesField','Descriptions','getFields','username','remoteUri','apiKey','substring','lastIndexOf','GET','%s%s','/api/selector/owners','Token\x20token=','users','Requested\x20Resource\x20not\x20Found','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','offset','limit','undefined','count','status','set','json','apply'];(function(_0x53c256,_0x382a24){var _0x25feb6=function(_0x2652fd){while(--_0x2652fd){_0x53c256['push'](_0x53c256['shift']());}};_0x25feb6(++_0x382a24);}(_0xc104,0xa5));var _0x4c10=function(_0x27fa65,_0x4e02ee){_0x27fa65=_0x27fa65-0x0;var _0x456594=_0xc104[_0x27fa65];return _0x456594;};'use strict';var emlformat=require(_0x4c10('0x0'));var rimraf=require(_0x4c10('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4c10('0x2'));var rp=require(_0x4c10('0x3'));var moment=require(_0x4c10('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4c10('0x5'));var path=require(_0x4c10('0x6'));var sox=require(_0x4c10('0x7'));var csv=require(_0x4c10('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4c10('0x9'));var _=require(_0x4c10('0xa'));var squel=require(_0x4c10('0xb'));var crypto=require(_0x4c10('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x4c10('0xd'));var toCsv=require(_0x4c10('0x8'));var querystring=require(_0x4c10('0xe'));var Papa=require(_0x4c10('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4c10('0x10'));var as=require(_0x4c10('0x11'));var hardwareService=require(_0x4c10('0x12'));var logger=require('../../config/logger')(_0x4c10('0x13'));var utils=require(_0x4c10('0x14'));var config=require(_0x4c10('0x15'));var licenseUtil=require(_0x4c10('0x16'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2693f6,_0x336143){_0x336143=_0x336143||0xcc;return function(_0x5046dc){if(_0x5046dc){return _0x2693f6[_0x4c10('0x17')](_0x336143);}return _0x2693f6['status'](_0x336143)[_0x4c10('0x18')]();};}function respondWithResult(_0x377221,_0x287fe1){_0x287fe1=_0x287fe1||0xc8;return function(_0x4c3570){if(_0x4c3570){return _0x377221['status'](_0x287fe1)['json'](_0x4c3570);}};}function respondWithFilteredResult(_0x737f1a,_0x2b48e5){return function(_0x36a39c){if(_0x36a39c){var _0x441cf8=typeof _0x2b48e5[_0x4c10('0x19')]==='undefined'&&typeof _0x2b48e5[_0x4c10('0x1a')]===_0x4c10('0x1b');var _0x5a0eb8=_0x36a39c['count'];var _0x5d7a51=_0x441cf8?0x0:_0x2b48e5[_0x4c10('0x19')];var _0x122aab=_0x441cf8?_0x36a39c[_0x4c10('0x1c')]:_0x2b48e5['offset']+_0x2b48e5[_0x4c10('0x1a')];var _0x5246b1;if(_0x122aab>=_0x5a0eb8){_0x122aab=_0x5a0eb8;_0x5246b1=0xc8;}else{_0x5246b1=0xce;}_0x737f1a[_0x4c10('0x1d')](_0x5246b1);return _0x737f1a[_0x4c10('0x1e')]('Content-Range',_0x5d7a51+'-'+_0x122aab+'/'+_0x5a0eb8)[_0x4c10('0x1f')](_0x36a39c);}return null;};}function patchUpdates(_0x53f276){return function(_0x422f98){try{jsonpatch[_0x4c10('0x20')](_0x422f98,_0x53f276,!![]);}catch(_0x4c98b5){return BPromise['reject'](_0x4c98b5);}return _0x422f98['save']();};}function saveUpdates(_0x487dcd,_0x5e1bb0){return function(_0x59c8be){if(_0x59c8be){return _0x59c8be['update'](_0x487dcd)[_0x4c10('0x21')](function(_0x203c45){return _0x203c45;});}return null;};}function removeEntity(_0x44dab1,_0xc736c7){return function(_0x177daf){if(_0x177daf){return _0x177daf['destroy']()[_0x4c10('0x21')](function(){_0x44dab1[_0x4c10('0x1d')](0xcc)[_0x4c10('0x18')]();});}};}function handleEntityNotFound(_0x554ea8,_0x33c944){return function(_0x42179d){if(!_0x42179d){_0x554ea8['sendStatus'](0x194);}return _0x42179d;};}function handleError(_0x57b48d,_0x3fd983){_0x3fd983=_0x3fd983||0x1f4;return function(_0x46fd23){logger['error'](_0x46fd23['stack']);if(_0x46fd23[_0x4c10('0x22')]){delete _0x46fd23['name'];}_0x57b48d['status'](_0x3fd983)[_0x4c10('0x23')](_0x46fd23);};}exports[_0x4c10('0x24')]=function(_0x39478a,_0x26c844){var _0x1b0854={},_0x2ff9bc={},_0x20933f={'count':0x0,'rows':[]};var _0x400f4e=_['map'](db[_0x4c10('0x25')][_0x4c10('0x26')],function(_0x49fac1){return{'name':_0x49fac1[_0x4c10('0x27')],'type':_0x49fac1[_0x4c10('0x28')][_0x4c10('0x29')]};});_0x2ff9bc[_0x4c10('0x2a')]=_[_0x4c10('0x2b')](_0x400f4e,'name');_0x2ff9bc['query']=_['keys'](_0x39478a[_0x4c10('0x2c')]);_0x2ff9bc[_0x4c10('0x2d')]=_[_0x4c10('0x2e')](_0x2ff9bc[_0x4c10('0x2a')],_0x2ff9bc['query']);_0x1b0854['attributes']=_[_0x4c10('0x2e')](_0x2ff9bc[_0x4c10('0x2a')],qs[_0x4c10('0x2f')](_0x39478a['query'][_0x4c10('0x2f')]));_0x1b0854[_0x4c10('0x30')]=_0x1b0854[_0x4c10('0x30')][_0x4c10('0x31')]?_0x1b0854[_0x4c10('0x30')]:_0x2ff9bc[_0x4c10('0x2a')];if(!_0x39478a[_0x4c10('0x2c')][_0x4c10('0x32')](_0x4c10('0x33'))){_0x1b0854[_0x4c10('0x1a')]=qs['limit'](_0x39478a[_0x4c10('0x2c')][_0x4c10('0x1a')]);_0x1b0854['offset']=qs['offset'](_0x39478a[_0x4c10('0x2c')][_0x4c10('0x19')]);}_0x1b0854[_0x4c10('0x34')]=qs[_0x4c10('0x35')](_0x39478a['query']['sort']);_0x1b0854[_0x4c10('0x36')]=qs[_0x4c10('0x2d')](_[_0x4c10('0x37')](_0x39478a[_0x4c10('0x2c')],_0x2ff9bc[_0x4c10('0x2d')]),_0x400f4e);if(_0x39478a[_0x4c10('0x2c')][_0x4c10('0x38')]){_0x1b0854['where']=_['merge'](_0x1b0854['where'],{'$or':_[_0x4c10('0x2b')](_0x400f4e,function(_0x2d4fcc){if(_0x2d4fcc[_0x4c10('0x28')]!==_0x4c10('0x39')){var _0x52a695={};_0x52a695[_0x2d4fcc[_0x4c10('0x22')]]={'$like':'%'+_0x39478a[_0x4c10('0x2c')][_0x4c10('0x38')]+'%'};return _0x52a695;}})});}_0x1b0854=_[_0x4c10('0x3a')]({},_0x1b0854,_0x39478a['options']);var _0x3f7999={'where':_0x1b0854[_0x4c10('0x36')]};return db[_0x4c10('0x25')][_0x4c10('0x1c')](_0x3f7999)[_0x4c10('0x21')](function(_0x431344){_0x20933f[_0x4c10('0x1c')]=_0x431344;if(_0x39478a[_0x4c10('0x2c')][_0x4c10('0x3b')]){_0x1b0854[_0x4c10('0x3c')]=[{'all':!![]}];}return db[_0x4c10('0x25')]['findAll'](_0x1b0854);})['then'](function(_0x153ba7){_0x20933f[_0x4c10('0x3d')]=_0x153ba7;return _0x20933f;})['then'](respondWithFilteredResult(_0x26c844,_0x1b0854))[_0x4c10('0x3e')](handleError(_0x26c844,null));};exports['show']=function(_0x5ace65,_0x7280b7){var _0x366b58={'raw':![],'where':{'id':_0x5ace65['params']['id']}},_0xe1d122={};_0xe1d122[_0x4c10('0x2a')]=_[_0x4c10('0x3f')](db[_0x4c10('0x25')][_0x4c10('0x26')]);_0xe1d122[_0x4c10('0x2c')]=_[_0x4c10('0x3f')](_0x5ace65[_0x4c10('0x2c')]);_0xe1d122[_0x4c10('0x2d')]=_[_0x4c10('0x2e')](_0xe1d122[_0x4c10('0x2a')],_0xe1d122[_0x4c10('0x2c')]);_0x366b58[_0x4c10('0x30')]=_[_0x4c10('0x2e')](_0xe1d122[_0x4c10('0x2a')],qs['fields'](_0x5ace65['query']['fields']));_0x366b58[_0x4c10('0x30')]=_0x366b58[_0x4c10('0x30')][_0x4c10('0x31')]?_0x366b58[_0x4c10('0x30')]:_0xe1d122[_0x4c10('0x2a')];if(_0x5ace65[_0x4c10('0x2c')][_0x4c10('0x3b')]){_0x366b58['include']=[{'all':!![]}];}_0x366b58=_['merge']({},_0x366b58,_0x5ace65['options']);return db[_0x4c10('0x25')][_0x4c10('0x40')](_0x366b58)[_0x4c10('0x21')](handleEntityNotFound(_0x7280b7,null))[_0x4c10('0x21')](respondWithResult(_0x7280b7,null))['catch'](handleError(_0x7280b7,null));};exports[_0x4c10('0x41')]=function(_0x5d25d0,_0x4a8d3e){return db[_0x4c10('0x25')]['create'](_0x5d25d0[_0x4c10('0x42')],{})[_0x4c10('0x21')](respondWithResult(_0x4a8d3e,0xc9))[_0x4c10('0x3e')](handleError(_0x4a8d3e,null));};exports[_0x4c10('0x43')]=function(_0x3e6dbf,_0x32ba86){if(_0x3e6dbf[_0x4c10('0x42')]['id']){delete _0x3e6dbf[_0x4c10('0x42')]['id'];}return db[_0x4c10('0x25')][_0x4c10('0x40')]({'where':{'id':_0x3e6dbf['params']['id']}})['then'](handleEntityNotFound(_0x32ba86,null))[_0x4c10('0x21')](saveUpdates(_0x3e6dbf[_0x4c10('0x42')],null))[_0x4c10('0x21')](respondWithResult(_0x32ba86,null))[_0x4c10('0x3e')](handleError(_0x32ba86,null));};exports[_0x4c10('0x44')]=function(_0x38653e,_0xcbeee4){return db[_0x4c10('0x25')][_0x4c10('0x40')]({'where':{'id':_0x38653e[_0x4c10('0x45')]['id']}})[_0x4c10('0x21')](handleEntityNotFound(_0xcbeee4,null))[_0x4c10('0x21')](removeEntity(_0xcbeee4,null))[_0x4c10('0x3e')](handleError(_0xcbeee4,null));};exports[_0x4c10('0x46')]=function(_0x104f97,_0x3598bd,_0x2fe9a0){var _0x2a61f0={};var _0xd82b7a={};var _0x5324d7;var _0x36d0cf;return db[_0x4c10('0x25')][_0x4c10('0x47')]({'where':{'id':_0x104f97[_0x4c10('0x45')]['id']}})[_0x4c10('0x21')](handleEntityNotFound(_0x3598bd,null))[_0x4c10('0x21')](function(_0x3a4b41){if(_0x3a4b41){_0x5324d7=_0x3a4b41;_0xd82b7a[_0x4c10('0x2a')]=_[_0x4c10('0x3f')](db[_0x4c10('0x48')][_0x4c10('0x26')]);_0xd82b7a[_0x4c10('0x2c')]=_[_0x4c10('0x3f')](_0x104f97[_0x4c10('0x2c')]);_0xd82b7a[_0x4c10('0x2d')]=_['intersection'](_0xd82b7a['model'],_0xd82b7a[_0x4c10('0x2c')]);_0x2a61f0[_0x4c10('0x30')]=_['intersection'](_0xd82b7a[_0x4c10('0x2a')],qs[_0x4c10('0x2f')](_0x104f97[_0x4c10('0x2c')]['fields']));_0x2a61f0[_0x4c10('0x30')]=_0x2a61f0[_0x4c10('0x30')][_0x4c10('0x31')]?_0x2a61f0['attributes']:_0xd82b7a[_0x4c10('0x2a')];_0x2a61f0['order']=qs[_0x4c10('0x35')](_0x104f97[_0x4c10('0x2c')][_0x4c10('0x35')]);_0x2a61f0['where']=qs['filters'](_[_0x4c10('0x37')](_0x104f97[_0x4c10('0x2c')],_0xd82b7a['filters']));if(_0x104f97[_0x4c10('0x2c')]['filter']){_0x2a61f0[_0x4c10('0x36')]=_['merge'](_0x2a61f0[_0x4c10('0x36')],{'$or':_['map'](_0x2a61f0[_0x4c10('0x30')],function(_0x480807){var _0x14c0be={};_0x14c0be[_0x480807]={'$like':'%'+_0x104f97[_0x4c10('0x2c')][_0x4c10('0x38')]+'%'};return _0x14c0be;})});}_0x2a61f0=_[_0x4c10('0x3a')]({},_0x2a61f0,_0x104f97[_0x4c10('0x49')]);return _0x5324d7[_0x4c10('0x46')](_0x2a61f0);}})['then'](function(_0x5df583){if(_0x5df583){_0x36d0cf=_0x5df583['length'];if(!_0x104f97[_0x4c10('0x2c')]['hasOwnProperty'](_0x4c10('0x33'))){_0x2a61f0[_0x4c10('0x1a')]=qs[_0x4c10('0x1a')](_0x104f97[_0x4c10('0x2c')][_0x4c10('0x1a')]);_0x2a61f0[_0x4c10('0x19')]=qs[_0x4c10('0x19')](_0x104f97[_0x4c10('0x2c')]['offset']);}return _0x5324d7[_0x4c10('0x46')](_0x2a61f0);}})[_0x4c10('0x21')](function(_0x7a722){if(_0x7a722){return _0x7a722?{'count':_0x36d0cf,'rows':_0x7a722}:null;}})[_0x4c10('0x21')](respondWithResult(_0x3598bd,null))[_0x4c10('0x3e')](handleError(_0x3598bd,null));};exports[_0x4c10('0x4a')]=function(_0x147bdb,_0x3d32c,_0x4384d5){if(_0x147bdb['body']['id']){delete _0x147bdb['body']['id'];}return db[_0x4c10('0x25')][_0x4c10('0x47')]({'where':{'id':_0x147bdb[_0x4c10('0x45')]['id']}})['then'](handleEntityNotFound(_0x3d32c,null))[_0x4c10('0x21')](function(_0x167a36){if(_0x167a36){_0x147bdb[_0x4c10('0x42')][_0x4c10('0x4b')]=_0x167a36['id'];_0x147bdb[_0x4c10('0x42')][_0x4c10('0x4c')]=integrations[_0x4c10('0x4d')](_0x147bdb[_0x4c10('0x42')][_0x4c10('0x4e')],_0x147bdb[_0x4c10('0x42')][_0x4c10('0x28')]);_0x147bdb['body']['Descriptions']=integrations[_0x4c10('0x4f')](_0x147bdb[_0x4c10('0x42')][_0x4c10('0x4e')],_0x147bdb[_0x4c10('0x42')][_0x4c10('0x28')]);return db['FreshsalesConfiguration'][_0x4c10('0x41')](_0x147bdb[_0x4c10('0x42')],{'include':[{'model':db[_0x4c10('0x50')],'as':_0x4c10('0x4c')},{'model':db[_0x4c10('0x50')],'as':_0x4c10('0x51')}]});}return null;})[_0x4c10('0x21')](respondWithResult(_0x3d32c,null))[_0x4c10('0x3e')](handleError(_0x3d32c,null));};exports[_0x4c10('0x52')]=function(_0x5013a5,_0x51a93c,_0x3f8554){var _0x11513d='';var _0x3273ed='';return db['FreshsalesAccount'][_0x4c10('0x47')]({'where':{'id':_0x5013a5[_0x4c10('0x45')]['id']},'attributes':['id',_0x4c10('0x53'),_0x4c10('0x54'),_0x4c10('0x55')]})['then'](handleEntityNotFound(_0x51a93c,null))['then'](function(_0x5ce937){if(_0x5ce937){_0x3273ed=_0x5ce937[_0x4c10('0x53')];_0x11513d=_0x5ce937[_0x4c10('0x54')];var _0x2d26ca=_0x5ce937['remoteUri']['slice'](-0x1);if(_0x2d26ca==='/'){_0x11513d=_0x11513d[_0x4c10('0x56')](0x0,_0x11513d[_0x4c10('0x57')](_0x2d26ca));}return rp({'method':_0x4c10('0x58'),'uri':util['format'](_0x4c10('0x59'),_0x11513d,_0x4c10('0x5a')),'headers':{'Authorization':_0x4c10('0x5b')+_0x5ce937['apiKey']},'json':!![]});}})[_0x4c10('0x21')](function(_0x5e2241){if(_0x5e2241){var _0x3395c6=_0x5e2241[_0x4c10('0x5c')];var _0x409899=![];var _0x5d812f=null;for(_0x5d812f=0x0;_0x5d812f<_0x3395c6[_0x4c10('0x31')];_0x5d812f++){if(_0x3395c6[_0x5d812f]['email']===_0x3273ed){_0x409899=!![];}}if(_0x409899){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x4c10('0x5d')});}}})[_0x4c10('0x21')](respondWithResult(_0x51a93c,null))[_0x4c10('0x3e')](function(_0x352e17){var _0x2b583d=_0x5013a5[_0x4c10('0x2c')]['test']?0x1f4:_0x352e17[_0x4c10('0x5e')]||0x1f4;logger['error'](_0x4c10('0x5f'),_0x4c10('0x52'),_0x2b583d,JSON[_0x4c10('0x60')](_0x352e17));delete _0x352e17['name'];if(_0x2b583d===0x191){_0x2b583d=0x190;}_0x51a93c[_0x4c10('0x1d')](_0x2b583d)[_0x4c10('0x23')](_0x5013a5[_0x4c10('0x2c')][_0x4c10('0x61')]?{'message':_0x4c10('0x62'),'statusCode':_0x352e17['statusCode']}:_0x352e17);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index e840f52..5ac5993 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 _0x66fa=['exports','define','FreshsalesAccount','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1c3b3e,_0x149302){var _0x3f2128=function(_0x1841e1){while(--_0x1841e1){_0x1c3b3e['push'](_0x1c3b3e['shift']());}};_0x3f2128(++_0x149302);}(_0x66fa,0x117));var _0xa66f=function(_0x172cf0,_0xbd1c7b){_0x172cf0=_0x172cf0-0x0;var _0x441d9c=_0x66fa[_0x172cf0];return _0x441d9c;};'use strict';var _=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var logger=require('../../config/logger')(_0xa66f('0x2'));var moment=require(_0xa66f('0x3'));var BPromise=require(_0xa66f('0x4'));var rp=require(_0xa66f('0x5'));var fs=require('fs');var path=require(_0xa66f('0x6'));var rimraf=require(_0xa66f('0x7'));var config=require(_0xa66f('0x8'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xa66f('0x9')]=function(_0x20a150,_0x2f0b78){return _0x20a150[_0xa66f('0xa')](_0xa66f('0xb'),attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc2c7=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../components/integrations/configuration','exports','int_freshsales_accounts'];(function(_0x53ad58,_0x3fb489){var _0x554b03=function(_0x5769ba){while(--_0x5769ba){_0x53ad58['push'](_0x53ad58['shift']());}};_0x554b03(++_0x3fb489);}(_0xc2c7,0x134));var _0x7c2c=function(_0x240441,_0xf4738d){_0x240441=_0x240441-0x0;var _0x933ee2=_0xc2c7[_0x240441];return _0x933ee2;};'use strict';var _=require('lodash');var util=require(_0x7c2c('0x0'));var logger=require(_0x7c2c('0x1'))(_0x7c2c('0x2'));var moment=require(_0x7c2c('0x3'));var BPromise=require(_0x7c2c('0x4'));var rp=require(_0x7c2c('0x5'));var fs=require('fs');var path=require(_0x7c2c('0x6'));var rimraf=require(_0x7c2c('0x7'));var config=require('../../config/environment');var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x7c2c('0x8'));module[_0x7c2c('0x9')]=function(_0x23c038,_0x54f027){return _0x23c038['define']('FreshsalesAccount',attributes,{'tableName':_0x7c2c('0xa'),'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 a2964e3..2387880 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 _0xb016=['include','model','debug','ShowFreshsalesAccount','find','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit','map'];(function(_0x9fd887,_0x47f76c){var _0x1a54ab=function(_0xb65c08){while(--_0xb65c08){_0x9fd887['push'](_0x9fd887['shift']());}};_0x1a54ab(++_0x47f76c);}(_0xb016,0x159));var _0x6b01=function(_0x17ae83,_0x506414){_0x17ae83=_0x17ae83-0x0;var _0x228e52=_0xb016[_0x17ae83];return _0x228e52;};'use strict';var _=require(_0x6b01('0x0'));var util=require(_0x6b01('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6b01('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6b01('0x3'))['db'];var utils=require(_0x6b01('0x4'));var logger=require(_0x6b01('0x5'))(_0x6b01('0x6'));var config=require('../../config/environment');var jayson=require(_0x6b01('0x7'));var client=jayson[_0x6b01('0x8')][_0x6b01('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5759a1,_0x5c5bfb,_0x374aab){return new BPromise(function(_0x39f9fa,_0x526a7d){return client['request'](_0x5759a1,_0x374aab)[_0x6b01('0xa')](function(_0x1cb3a6){logger[_0x6b01('0xb')](_0x6b01('0xc'),_0x5c5bfb,_0x6b01('0xd'));logger['debug']('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x5c5bfb,_0x6b01('0xd'),JSON[_0x6b01('0xe')](_0x1cb3a6));if(_0x1cb3a6[_0x6b01('0xf')]){if(_0x1cb3a6['error'][_0x6b01('0x10')]===0x1f4){logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x5c5bfb,_0x1cb3a6[_0x6b01('0xf')]['message']);return _0x526a7d(_0x1cb3a6[_0x6b01('0xf')][_0x6b01('0x11')]);}logger['error'](_0x6b01('0xc'),_0x5c5bfb,_0x1cb3a6['error']['message']);return _0x39f9fa(_0x1cb3a6['error'][_0x6b01('0x11')]);}else{logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x5c5bfb,_0x6b01('0xd'));_0x39f9fa(_0x1cb3a6[_0x6b01('0x12')][_0x6b01('0x11')]);}})[_0x6b01('0x13')](function(_0x3d7045){logger[_0x6b01('0xf')](_0x6b01('0xc'),_0x5c5bfb,_0x3d7045);_0x526a7d(_0x3d7045);});});}exports[_0x6b01('0x14')]=function(_0x9c6571){var _0xc4e1b1=this;return new Promise(function(_0x18f336,_0x4f2d08){return db[_0x6b01('0x15')][_0x6b01('0x16')]({'raw':_0x9c6571[_0x6b01('0x17')]?_0x9c6571[_0x6b01('0x17')][_0x6b01('0x18')]===undefined?!![]:![]:!![],'where':_0x9c6571[_0x6b01('0x17')]?_0x9c6571[_0x6b01('0x17')][_0x6b01('0x19')]||null:null,'attributes':_0x9c6571['options']?_0x9c6571[_0x6b01('0x17')][_0x6b01('0x1a')]||null:null,'limit':_0x9c6571[_0x6b01('0x17')]?_0x9c6571[_0x6b01('0x17')][_0x6b01('0x1b')]||null:null,'include':_0x9c6571[_0x6b01('0x17')]?_0x9c6571[_0x6b01('0x17')]['include']?_[_0x6b01('0x1c')](_0x9c6571[_0x6b01('0x17')][_0x6b01('0x1d')],function(_0x51243c){return{'model':db[_0x51243c[_0x6b01('0x1e')]],'as':_0x51243c['as'],'attributes':_0x51243c[_0x6b01('0x1a')],'include':_0x51243c[_0x6b01('0x1d')]?_[_0x6b01('0x1c')](_0x51243c[_0x6b01('0x1d')],function(_0x2456e9){return{'model':db[_0x2456e9[_0x6b01('0x1e')]],'as':_0x2456e9['as'],'attributes':_0x2456e9[_0x6b01('0x1a')],'include':_0x2456e9[_0x6b01('0x1d')]?_[_0x6b01('0x1c')](_0x2456e9[_0x6b01('0x1d')],function(_0xa846d8){return{'model':db[_0xa846d8[_0x6b01('0x1e')]],'as':_0xa846d8['as'],'attributes':_0xa846d8['attributes']};}):[]};}):[]};}):[]:[]})[_0x6b01('0xa')](function(_0x220efb){logger[_0x6b01('0xb')](_0x6b01('0x14'),_0x9c6571);logger[_0x6b01('0x1f')]('GetFreshsalesAccount',_0x9c6571,JSON['stringify'](_0x220efb));_0x18f336(_0x220efb);})[_0x6b01('0x13')](function(_0x3df3d4){logger[_0x6b01('0xf')](_0x6b01('0x14'),_0x3df3d4[_0x6b01('0x11')],_0x9c6571);_0x4f2d08(_0xc4e1b1[_0x6b01('0xf')](0x1f4,_0x3df3d4['message']));});});};exports[_0x6b01('0x20')]=function(_0x5482a8){var _0x3942d7=this;return new Promise(function(_0x4e7e32,_0x6920cf){return db[_0x6b01('0x15')][_0x6b01('0x21')]({'raw':_0x5482a8[_0x6b01('0x17')]?_0x5482a8[_0x6b01('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x5482a8[_0x6b01('0x17')]?_0x5482a8[_0x6b01('0x17')][_0x6b01('0x19')]||null:null,'attributes':_0x5482a8['options']?_0x5482a8['options'][_0x6b01('0x1a')]||null:null,'include':_0x5482a8['options']?_0x5482a8[_0x6b01('0x17')][_0x6b01('0x1d')]?_[_0x6b01('0x1c')](_0x5482a8['options'][_0x6b01('0x1d')],function(_0x42d5f7){return{'model':db[_0x42d5f7[_0x6b01('0x1e')]],'as':_0x42d5f7['as'],'attributes':_0x42d5f7['attributes'],'include':_0x42d5f7[_0x6b01('0x1d')]?_[_0x6b01('0x1c')](_0x42d5f7[_0x6b01('0x1d')],function(_0x2eb34f){return{'model':db[_0x2eb34f[_0x6b01('0x1e')]],'as':_0x2eb34f['as'],'attributes':_0x2eb34f['attributes'],'include':_0x2eb34f[_0x6b01('0x1d')]?_[_0x6b01('0x1c')](_0x2eb34f[_0x6b01('0x1d')],function(_0x5269c7){return{'model':db[_0x5269c7[_0x6b01('0x1e')]],'as':_0x5269c7['as'],'attributes':_0x5269c7[_0x6b01('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6b01('0xa')](function(_0x3154d7){logger['info'](_0x6b01('0x20'),_0x5482a8);logger['debug'](_0x6b01('0x20'),_0x5482a8,JSON[_0x6b01('0xe')](_0x3154d7));_0x4e7e32(_0x3154d7);})[_0x6b01('0x13')](function(_0x318b8b){logger[_0x6b01('0xf')](_0x6b01('0x20'),_0x318b8b[_0x6b01('0x11')],_0x5482a8);_0x6920cf(_0x3942d7['error'](0x1f4,_0x318b8b[_0x6b01('0x11')]));});});}; \ No newline at end of file +var _0xdf55=['FreshsalesAccount,\x20%s,\x20%s','message','info','result','catch','GetFreshsalesAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','stringify','ShowFreshsalesAccount','FreshsalesAccount','find','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xdf55,0x83));var _0x5df5=function(_0x7dda42,_0x31357d){_0x7dda42=_0x7dda42-0x0;var _0x3d413c=_0xdf55[_0x7dda42];return _0x3d413c;};'use strict';var _=require(_0x5df5('0x0'));var util=require(_0x5df5('0x1'));var moment=require('moment');var BPromise=require(_0x5df5('0x2'));var rs=require(_0x5df5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5df5('0x4'))['db'];var utils=require(_0x5df5('0x5'));var logger=require(_0x5df5('0x6'))('rpc');var config=require(_0x5df5('0x7'));var jayson=require(_0x5df5('0x8'));var client=jayson[_0x5df5('0x9')][_0x5df5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9b8756,_0x2b7ed9,_0x4722a2){return new BPromise(function(_0x3743f3,_0x4d43a3){return client[_0x5df5('0xb')](_0x9b8756,_0x4722a2)[_0x5df5('0xc')](function(_0x41941e){logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x2b7ed9,_0x5df5('0xd'));logger['debug'](_0x5df5('0xe'),_0x2b7ed9,_0x5df5('0xd'),JSON['stringify'](_0x41941e));if(_0x41941e['error']){if(_0x41941e[_0x5df5('0xf')][_0x5df5('0x10')]===0x1f4){logger[_0x5df5('0xf')](_0x5df5('0x11'),_0x2b7ed9,_0x41941e[_0x5df5('0xf')][_0x5df5('0x12')]);return _0x4d43a3(_0x41941e[_0x5df5('0xf')][_0x5df5('0x12')]);}logger[_0x5df5('0xf')](_0x5df5('0x11'),_0x2b7ed9,_0x41941e['error'][_0x5df5('0x12')]);return _0x3743f3(_0x41941e['error'][_0x5df5('0x12')]);}else{logger[_0x5df5('0x13')](_0x5df5('0x11'),_0x2b7ed9,_0x5df5('0xd'));_0x3743f3(_0x41941e[_0x5df5('0x14')]['message']);}})[_0x5df5('0x15')](function(_0x457205){logger['error'](_0x5df5('0x11'),_0x2b7ed9,_0x457205);_0x4d43a3(_0x457205);});});}exports[_0x5df5('0x16')]=function(_0xb7e1c2){var _0x44f700=this;return new Promise(function(_0x215d59,_0x4b499d){return db['FreshsalesAccount'][_0x5df5('0x17')]({'raw':_0xb7e1c2['options']?_0xb7e1c2[_0x5df5('0x18')][_0x5df5('0x19')]===undefined?!![]:![]:!![],'where':_0xb7e1c2[_0x5df5('0x18')]?_0xb7e1c2[_0x5df5('0x18')][_0x5df5('0x1a')]||null:null,'attributes':_0xb7e1c2['options']?_0xb7e1c2[_0x5df5('0x18')][_0x5df5('0x1b')]||null:null,'limit':_0xb7e1c2[_0x5df5('0x18')]?_0xb7e1c2[_0x5df5('0x18')][_0x5df5('0x1c')]||null:null,'include':_0xb7e1c2[_0x5df5('0x18')]?_0xb7e1c2['options'][_0x5df5('0x1d')]?_[_0x5df5('0x1e')](_0xb7e1c2[_0x5df5('0x18')][_0x5df5('0x1d')],function(_0x5ca542){return{'model':db[_0x5ca542[_0x5df5('0x1f')]],'as':_0x5ca542['as'],'attributes':_0x5ca542[_0x5df5('0x1b')],'include':_0x5ca542[_0x5df5('0x1d')]?_['map'](_0x5ca542['include'],function(_0x532923){return{'model':db[_0x532923[_0x5df5('0x1f')]],'as':_0x532923['as'],'attributes':_0x532923[_0x5df5('0x1b')],'include':_0x532923[_0x5df5('0x1d')]?_[_0x5df5('0x1e')](_0x532923[_0x5df5('0x1d')],function(_0x1fd83c){return{'model':db[_0x1fd83c[_0x5df5('0x1f')]],'as':_0x1fd83c['as'],'attributes':_0x1fd83c[_0x5df5('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x18bb61){logger['info'](_0x5df5('0x16'),_0xb7e1c2);logger[_0x5df5('0x20')]('GetFreshsalesAccount',_0xb7e1c2,JSON[_0x5df5('0x21')](_0x18bb61));_0x215d59(_0x18bb61);})['catch'](function(_0xd2b213){logger['error'](_0x5df5('0x16'),_0xd2b213['message'],_0xb7e1c2);_0x4b499d(_0x44f700[_0x5df5('0xf')](0x1f4,_0xd2b213['message']));});});};exports[_0x5df5('0x22')]=function(_0x47bebb){var _0x4784ca=this;return new Promise(function(_0x485484,_0xf445de){return db[_0x5df5('0x23')][_0x5df5('0x24')]({'raw':_0x47bebb[_0x5df5('0x18')]?_0x47bebb[_0x5df5('0x18')][_0x5df5('0x19')]===undefined?!![]:![]:!![],'where':_0x47bebb[_0x5df5('0x18')]?_0x47bebb['options']['where']||null:null,'attributes':_0x47bebb[_0x5df5('0x18')]?_0x47bebb[_0x5df5('0x18')][_0x5df5('0x1b')]||null:null,'include':_0x47bebb[_0x5df5('0x18')]?_0x47bebb[_0x5df5('0x18')][_0x5df5('0x1d')]?_['map'](_0x47bebb[_0x5df5('0x18')][_0x5df5('0x1d')],function(_0x2f1001){return{'model':db[_0x2f1001[_0x5df5('0x1f')]],'as':_0x2f1001['as'],'attributes':_0x2f1001['attributes'],'include':_0x2f1001[_0x5df5('0x1d')]?_['map'](_0x2f1001[_0x5df5('0x1d')],function(_0x394676){return{'model':db[_0x394676['model']],'as':_0x394676['as'],'attributes':_0x394676[_0x5df5('0x1b')],'include':_0x394676['include']?_[_0x5df5('0x1e')](_0x394676[_0x5df5('0x1d')],function(_0x4697c2){return{'model':db[_0x4697c2[_0x5df5('0x1f')]],'as':_0x4697c2['as'],'attributes':_0x4697c2['attributes']};}):[]};}):[]};}):[]:[]})[_0x5df5('0xc')](function(_0x2e7e64){logger[_0x5df5('0x13')](_0x5df5('0x22'),_0x47bebb);logger['debug'](_0x5df5('0x22'),_0x47bebb,JSON[_0x5df5('0x21')](_0x2e7e64));_0x485484(_0x2e7e64);})[_0x5df5('0x15')](function(_0x18b597){logger[_0x5df5('0xf')](_0x5df5('0x22'),_0x18b597[_0x5df5('0x12')],_0x47bebb);_0xf445de(_0x4784ca['error'](0x1f4,_0x18b597[_0x5df5('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 9049be4..74e94a2 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 _0x004f=['post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','show','/:id/subjects','/:id/descriptions','getDescriptions','/:id/fields','getFields'];(function(_0xf19af5,_0x2414bf){var _0x198afd=function(_0x45e8ba){while(--_0x45e8ba){_0xf19af5['push'](_0xf19af5['shift']());}};_0x198afd(++_0x2414bf);}(_0x004f,0xe9));var _0xf004=function(_0x3cef3b,_0x3a42ee){_0x3cef3b=_0x3cef3b-0x0;var _0x111907=_0x004f[_0x3cef3b];return _0x111907;};'use strict';var multer=require(_0xf004('0x0'));var util=require(_0xf004('0x1'));var path=require(_0xf004('0x2'));var timeout=require(_0xf004('0x3'));var express=require(_0xf004('0x4'));var router=express['Router']();var fs_extra=require(_0xf004('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf004('0x6'));var config=require('../../config/environment');var controller=require(_0xf004('0x7'));router[_0xf004('0x8')]('/',auth[_0xf004('0x9')](),controller[_0xf004('0xa')]);router[_0xf004('0x8')]('/:id',auth[_0xf004('0x9')](),controller[_0xf004('0xb')]);router[_0xf004('0x8')](_0xf004('0xc'),auth[_0xf004('0x9')](),controller['getSubjects']);router[_0xf004('0x8')](_0xf004('0xd'),auth['isAuthenticated'](),controller[_0xf004('0xe')]);router[_0xf004('0x8')](_0xf004('0xf'),auth[_0xf004('0x9')](),controller[_0xf004('0x10')]);router[_0xf004('0x11')]('/',auth[_0xf004('0x9')](),controller[_0xf004('0x12')]);router[_0xf004('0x13')](_0xf004('0x14'),auth['isAuthenticated'](),controller[_0xf004('0x15')]);router[_0xf004('0x16')]('/:id',auth[_0xf004('0x9')](),controller[_0xf004('0x17')]);module[_0xf004('0x18')]=router; \ No newline at end of file +var _0x57ca=['exports','multer','connect-timeout','Router','../../components/auth/service','./intFreshsalesConfiguration.controller','get','index','/:id','isAuthenticated','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','post','create','put','update','delete','destroy'];(function(_0x9b5bb2,_0x5db315){var _0x2e1e92=function(_0x5621c9){while(--_0x5621c9){_0x9b5bb2['push'](_0x9b5bb2['shift']());}};_0x2e1e92(++_0x5db315);}(_0x57ca,0x8d));var _0xa57c=function(_0x1f587f,_0x2ecb4e){_0x1f587f=_0x1f587f-0x0;var _0x59733f=_0x57ca[_0x1f587f];return _0x59733f;};'use strict';var multer=require(_0xa57c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa57c('0x1'));var express=require('express');var router=express[_0xa57c('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xa57c('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa57c('0x4'));router[_0xa57c('0x5')]('/',auth['isAuthenticated'](),controller[_0xa57c('0x6')]);router[_0xa57c('0x5')](_0xa57c('0x7'),auth[_0xa57c('0x8')](),controller['show']);router[_0xa57c('0x5')]('/:id/subjects',auth[_0xa57c('0x8')](),controller[_0xa57c('0x9')]);router[_0xa57c('0x5')](_0xa57c('0xa'),auth[_0xa57c('0x8')](),controller[_0xa57c('0xb')]);router[_0xa57c('0x5')](_0xa57c('0xc'),auth[_0xa57c('0x8')](),controller['getFields']);router[_0xa57c('0xd')]('/',auth[_0xa57c('0x8')](),controller[_0xa57c('0xe')]);router[_0xa57c('0xf')]('/:id',auth[_0xa57c('0x8')](),controller[_0xa57c('0x10')]);router[_0xa57c('0x11')](_0xa57c('0x7'),auth[_0xa57c('0x8')](),controller[_0xa57c('0x12')]);module[_0xa57c('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 78dc2e9..ac48da1 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 _0xc2ac=['STRING','exports'];(function(_0x1c25c0,_0x575b5b){var _0x588338=function(_0x54651a){while(--_0x54651a){_0x1c25c0['push'](_0x1c25c0['shift']());}};_0x588338(++_0x575b5b);}(_0xc2ac,0x143));var _0xcc2a=function(_0x2e6023,_0x3497e3){_0x2e6023=_0x2e6023-0x0;var _0x48ae6e=_0xc2ac[_0x2e6023];return _0x48ae6e;};'use strict';var Sequelize=require('sequelize');module[_0xcc2a('0x0')]={'name':{'type':Sequelize[_0xcc2a('0x1')]},'description':{'type':Sequelize[_0xcc2a('0x1')]}}; \ No newline at end of file +var _0x187e=['STRING','sequelize','exports'];(function(_0x3aa468,_0xdafab9){var _0x164f79=function(_0x34b26d){while(--_0x34b26d){_0x3aa468['push'](_0x3aa468['shift']());}};_0x164f79(++_0xdafab9);}(_0x187e,0x190));var _0xe187=function(_0x161808,_0x19f5bb){_0x161808=_0x161808-0x0;var _0x3d5409=_0x187e[_0x161808];return _0x3d5409;};'use strict';var Sequelize=require(_0xe187('0x0'));module[_0xe187('0x1')]={'name':{'type':Sequelize[_0xe187('0x2')]},'description':{'type':Sequelize[_0xe187('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index f91bf61..a2fb734 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 _0x120d=['findOne','FreshsalesField','order','getFields','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','FreshsalesConfiguration','findAll','rows','catch','show','params','keys','include','find','create','body','getSubjects'];(function(_0x50d2bd,_0x5cf444){var _0x2b8bd7=function(_0x3576c2){while(--_0x3576c2){_0x50d2bd['push'](_0x50d2bd['shift']());}};_0x2b8bd7(++_0x5cf444);}(_0x120d,0x140));var _0xd120=function(_0xdd0313,_0x251c2b){_0xdd0313=_0xdd0313-0x0;var _0x2bd7e8=_0x120d[_0xdd0313];return _0x2bd7e8;};'use strict';var emlformat=require(_0xd120('0x0'));var rimraf=require(_0xd120('0x1'));var zipdir=require(_0xd120('0x2'));var jsonpatch=require(_0xd120('0x3'));var rp=require('request-promise');var moment=require(_0xd120('0x4'));var BPromise=require(_0xd120('0x5'));var Mustache=require(_0xd120('0x6'));var util=require('util');var path=require(_0xd120('0x7'));var sox=require(_0xd120('0x8'));var csv=require(_0xd120('0x9'));var ejs=require(_0xd120('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd120('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd120('0xc'));var toCsv=require(_0xd120('0x9'));var querystring=require(_0xd120('0xd'));var Papa=require(_0xd120('0xe'));var Redis=require('ioredis');var authService=require(_0xd120('0xf'));var qs=require(_0xd120('0x10'));var as=require(_0xd120('0x11'));var hardwareService=require(_0xd120('0x12'));var logger=require('../../config/logger')(_0xd120('0x13'));var utils=require(_0xd120('0x14'));var config=require(_0xd120('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xd120('0x16'))['db'];function respondWithStatusCode(_0x4daafd,_0x38036b){_0x38036b=_0x38036b||0xcc;return function(_0x551eae){if(_0x551eae){return _0x4daafd['sendStatus'](_0x38036b);}return _0x4daafd[_0xd120('0x17')](_0x38036b)[_0xd120('0x18')]();};}function respondWithResult(_0x5d1702,_0x1ee8de){_0x1ee8de=_0x1ee8de||0xc8;return function(_0x33d417){if(_0x33d417){return _0x5d1702[_0xd120('0x17')](_0x1ee8de)[_0xd120('0x19')](_0x33d417);}};}function respondWithFilteredResult(_0x37e229,_0x1fe0a8){return function(_0x39364e){if(_0x39364e){var _0x32192f=typeof _0x1fe0a8['offset']===_0xd120('0x1a')&&typeof _0x1fe0a8[_0xd120('0x1b')]===_0xd120('0x1a');var _0x265854=_0x39364e[_0xd120('0x1c')];var _0x522e14=_0x32192f?0x0:_0x1fe0a8['offset'];var _0x5c4d01=_0x32192f?_0x39364e['count']:_0x1fe0a8[_0xd120('0x1d')]+_0x1fe0a8[_0xd120('0x1b')];var _0x18ef2c;if(_0x5c4d01>=_0x265854){_0x5c4d01=_0x265854;_0x18ef2c=0xc8;}else{_0x18ef2c=0xce;}_0x37e229[_0xd120('0x17')](_0x18ef2c);return _0x37e229['set'](_0xd120('0x1e'),_0x522e14+'-'+_0x5c4d01+'/'+_0x265854)['json'](_0x39364e);}return null;};}function patchUpdates(_0xf31ed4){return function(_0x356059){try{jsonpatch[_0xd120('0x1f')](_0x356059,_0xf31ed4,!![]);}catch(_0x58f97b){return BPromise[_0xd120('0x20')](_0x58f97b);}return _0x356059[_0xd120('0x21')]();};}function saveUpdates(_0x58b3ab,_0x58dde0){return function(_0x1262a2){if(_0x1262a2){return _0x1262a2[_0xd120('0x22')](_0x58b3ab)[_0xd120('0x23')](function(_0x384454){return _0x384454;});}return null;};}function removeEntity(_0x4fff77,_0x26cfc8){return function(_0x2da038){if(_0x2da038){return _0x2da038[_0xd120('0x24')]()[_0xd120('0x23')](function(){_0x4fff77[_0xd120('0x17')](0xcc)[_0xd120('0x18')]();});}};}function handleEntityNotFound(_0x10ffec,_0xd6883d){return function(_0x10cae3){if(!_0x10cae3){_0x10ffec[_0xd120('0x25')](0x194);}return _0x10cae3;};}function handleError(_0x14cb75,_0x3bc3da){_0x3bc3da=_0x3bc3da||0x1f4;return function(_0x4ea26f){logger[_0xd120('0x26')](_0x4ea26f[_0xd120('0x27')]);if(_0x4ea26f[_0xd120('0x28')]){delete _0x4ea26f[_0xd120('0x28')];}_0x14cb75[_0xd120('0x17')](_0x3bc3da)[_0xd120('0x29')](_0x4ea26f);};}exports[_0xd120('0x2a')]=function(_0x1da4b5,_0x13f844){var _0x25cb1b={},_0x5f2e35={},_0x3626fd={'count':0x0,'rows':[]};var _0x445789=_[_0xd120('0x2b')](db['FreshsalesConfiguration'][_0xd120('0x2c')],function(_0x2c2da0){return{'name':_0x2c2da0['fieldName'],'type':_0x2c2da0['type']['key']};});_0x5f2e35['model']=_['map'](_0x445789,_0xd120('0x28'));_0x5f2e35[_0xd120('0x2d')]=_['keys'](_0x1da4b5['query']);_0x5f2e35[_0xd120('0x2e')]=_[_0xd120('0x2f')](_0x5f2e35['model'],_0x5f2e35[_0xd120('0x2d')]);_0x25cb1b['attributes']=_[_0xd120('0x2f')](_0x5f2e35[_0xd120('0x30')],qs[_0xd120('0x31')](_0x1da4b5[_0xd120('0x2d')]['fields']));_0x25cb1b[_0xd120('0x32')]=_0x25cb1b['attributes'][_0xd120('0x33')]?_0x25cb1b[_0xd120('0x32')]:_0x5f2e35[_0xd120('0x30')];if(!_0x1da4b5[_0xd120('0x2d')][_0xd120('0x34')](_0xd120('0x35'))){_0x25cb1b['limit']=qs[_0xd120('0x1b')](_0x1da4b5[_0xd120('0x2d')][_0xd120('0x1b')]);_0x25cb1b[_0xd120('0x1d')]=qs[_0xd120('0x1d')](_0x1da4b5[_0xd120('0x2d')][_0xd120('0x1d')]);}_0x25cb1b['order']=qs[_0xd120('0x36')](_0x1da4b5[_0xd120('0x2d')]['sort']);_0x25cb1b['where']=qs['filters'](_[_0xd120('0x37')](_0x1da4b5[_0xd120('0x2d')],_0x5f2e35[_0xd120('0x2e')]),_0x445789);if(_0x1da4b5[_0xd120('0x2d')][_0xd120('0x38')]){_0x25cb1b[_0xd120('0x39')]=_[_0xd120('0x3a')](_0x25cb1b[_0xd120('0x39')],{'$or':_['map'](_0x445789,function(_0xb7beb5){if(_0xb7beb5[_0xd120('0x3b')]!==_0xd120('0x3c')){var _0x923968={};_0x923968[_0xb7beb5[_0xd120('0x28')]]={'$like':'%'+_0x1da4b5[_0xd120('0x2d')][_0xd120('0x38')]+'%'};return _0x923968;}})});}_0x25cb1b=_[_0xd120('0x3a')]({},_0x25cb1b,_0x1da4b5[_0xd120('0x3d')]);var _0x4458b0={'where':_0x25cb1b[_0xd120('0x39')]};return db['FreshsalesConfiguration'][_0xd120('0x1c')](_0x4458b0)[_0xd120('0x23')](function(_0x1efd4f){_0x3626fd[_0xd120('0x1c')]=_0x1efd4f;if(_0x1da4b5['query'][_0xd120('0x3e')]){_0x25cb1b['include']=[{'all':!![]}];}return db[_0xd120('0x3f')][_0xd120('0x40')](_0x25cb1b);})['then'](function(_0xe90366){_0x3626fd[_0xd120('0x41')]=_0xe90366;return _0x3626fd;})['then'](respondWithFilteredResult(_0x13f844,_0x25cb1b))[_0xd120('0x42')](handleError(_0x13f844,null));};exports[_0xd120('0x43')]=function(_0x40b272,_0x4c312a){var _0x8ee587={'raw':![],'where':{'id':_0x40b272[_0xd120('0x44')]['id']}},_0x2c6004={};_0x2c6004[_0xd120('0x30')]=_[_0xd120('0x45')](db[_0xd120('0x3f')][_0xd120('0x2c')]);_0x2c6004[_0xd120('0x2d')]=_['keys'](_0x40b272[_0xd120('0x2d')]);_0x2c6004[_0xd120('0x2e')]=_[_0xd120('0x2f')](_0x2c6004[_0xd120('0x30')],_0x2c6004['query']);_0x8ee587['attributes']=_[_0xd120('0x2f')](_0x2c6004[_0xd120('0x30')],qs[_0xd120('0x31')](_0x40b272['query'][_0xd120('0x31')]));_0x8ee587[_0xd120('0x32')]=_0x8ee587[_0xd120('0x32')][_0xd120('0x33')]?_0x8ee587[_0xd120('0x32')]:_0x2c6004['model'];if(_0x40b272[_0xd120('0x2d')][_0xd120('0x3e')]){_0x8ee587[_0xd120('0x46')]=[{'all':!![]}];}_0x8ee587=_[_0xd120('0x3a')]({},_0x8ee587,_0x40b272[_0xd120('0x3d')]);return db[_0xd120('0x3f')][_0xd120('0x47')](_0x8ee587)['then'](handleEntityNotFound(_0x4c312a,null))[_0xd120('0x23')](respondWithResult(_0x4c312a,null))['catch'](handleError(_0x4c312a,null));};exports['create']=function(_0x290954,_0x11e6ab){return db[_0xd120('0x3f')][_0xd120('0x48')](_0x290954[_0xd120('0x49')],{})['then'](respondWithResult(_0x11e6ab,0xc9))[_0xd120('0x42')](handleError(_0x11e6ab,null));};exports[_0xd120('0x22')]=function(_0x1d310e,_0x2748f3){if(_0x1d310e[_0xd120('0x49')]['id']){delete _0x1d310e['body']['id'];}return db[_0xd120('0x3f')][_0xd120('0x47')]({'where':{'id':_0x1d310e[_0xd120('0x44')]['id']}})['then'](handleEntityNotFound(_0x2748f3,null))[_0xd120('0x23')](saveUpdates(_0x1d310e['body'],null))['then'](respondWithResult(_0x2748f3,null))[_0xd120('0x42')](handleError(_0x2748f3,null));};exports['destroy']=function(_0x1b721e,_0x172d2e){return db['FreshsalesConfiguration'][_0xd120('0x47')]({'where':{'id':_0x1b721e[_0xd120('0x44')]['id']}})[_0xd120('0x23')](handleEntityNotFound(_0x172d2e,null))[_0xd120('0x23')](removeEntity(_0x172d2e,null))[_0xd120('0x42')](handleError(_0x172d2e,null));};exports[_0xd120('0x4a')]=function(_0x5f2b14,_0x347443,_0x4a6dc7){var _0x29a519={};var _0x37ac25={};var _0x2e8b51;var _0x540429;return db[_0xd120('0x3f')][_0xd120('0x4b')]({'where':{'id':_0x5f2b14['params']['id']}})[_0xd120('0x23')](handleEntityNotFound(_0x347443,null))[_0xd120('0x23')](function(_0x543771){if(_0x543771){_0x2e8b51=_0x543771;_0x37ac25[_0xd120('0x30')]=_['keys'](db[_0xd120('0x4c')]['rawAttributes']);_0x37ac25['query']=_[_0xd120('0x45')](_0x5f2b14[_0xd120('0x2d')]);_0x37ac25['filters']=_[_0xd120('0x2f')](_0x37ac25[_0xd120('0x30')],_0x37ac25[_0xd120('0x2d')]);_0x29a519['attributes']=_[_0xd120('0x2f')](_0x37ac25[_0xd120('0x30')],qs[_0xd120('0x31')](_0x5f2b14[_0xd120('0x2d')]['fields']));_0x29a519[_0xd120('0x32')]=_0x29a519[_0xd120('0x32')][_0xd120('0x33')]?_0x29a519[_0xd120('0x32')]:_0x37ac25[_0xd120('0x30')];_0x29a519['order']=qs[_0xd120('0x36')](_0x5f2b14['query'][_0xd120('0x36')]);_0x29a519[_0xd120('0x39')]=qs['filters'](_['pick'](_0x5f2b14[_0xd120('0x2d')],_0x37ac25[_0xd120('0x2e')]));if(_0x5f2b14[_0xd120('0x2d')][_0xd120('0x38')]){_0x29a519[_0xd120('0x39')]=_[_0xd120('0x3a')](_0x29a519['where'],{'$or':_[_0xd120('0x2b')](_0x29a519[_0xd120('0x32')],function(_0x375ec5){var _0x49dcbe={};_0x49dcbe[_0x375ec5]={'$like':'%'+_0x5f2b14[_0xd120('0x2d')][_0xd120('0x38')]+'%'};return _0x49dcbe;})});}_0x29a519=_[_0xd120('0x3a')]({},_0x29a519,_0x5f2b14[_0xd120('0x3d')]);return _0x2e8b51[_0xd120('0x4a')](_0x29a519);}})[_0xd120('0x23')](function(_0x3fa1d5){if(_0x3fa1d5){_0x540429=_0x3fa1d5[_0xd120('0x33')];if(!_0x5f2b14['query'][_0xd120('0x34')]('nolimit')){_0x29a519['limit']=qs[_0xd120('0x1b')](_0x5f2b14['query'][_0xd120('0x1b')]);_0x29a519[_0xd120('0x1d')]=qs[_0xd120('0x1d')](_0x5f2b14['query']['offset']);}return _0x2e8b51[_0xd120('0x4a')](_0x29a519);}})['then'](function(_0x29ff1d){if(_0x29ff1d){return _0x29ff1d?{'count':_0x540429,'rows':_0x29ff1d}:null;}})[_0xd120('0x23')](respondWithResult(_0x347443,null))[_0xd120('0x42')](handleError(_0x347443,null));};exports['getDescriptions']=function(_0x3ecf44,_0x3eac1c,_0x748550){var _0x1d6ddf={};var _0x6ea31e={};var _0x4da516;var _0x15a2cb;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x3ecf44[_0xd120('0x44')]['id']}})[_0xd120('0x23')](handleEntityNotFound(_0x3eac1c,null))[_0xd120('0x23')](function(_0x34dd96){if(_0x34dd96){_0x4da516=_0x34dd96;_0x6ea31e['model']=_['keys'](db[_0xd120('0x4c')][_0xd120('0x2c')]);_0x6ea31e[_0xd120('0x2d')]=_[_0xd120('0x45')](_0x3ecf44['query']);_0x6ea31e[_0xd120('0x2e')]=_[_0xd120('0x2f')](_0x6ea31e['model'],_0x6ea31e[_0xd120('0x2d')]);_0x1d6ddf[_0xd120('0x32')]=_[_0xd120('0x2f')](_0x6ea31e['model'],qs['fields'](_0x3ecf44[_0xd120('0x2d')][_0xd120('0x31')]));_0x1d6ddf[_0xd120('0x32')]=_0x1d6ddf[_0xd120('0x32')][_0xd120('0x33')]?_0x1d6ddf[_0xd120('0x32')]:_0x6ea31e[_0xd120('0x30')];_0x1d6ddf['order']=qs[_0xd120('0x36')](_0x3ecf44[_0xd120('0x2d')][_0xd120('0x36')]);_0x1d6ddf[_0xd120('0x39')]=qs[_0xd120('0x2e')](_[_0xd120('0x37')](_0x3ecf44[_0xd120('0x2d')],_0x6ea31e[_0xd120('0x2e')]));if(_0x3ecf44[_0xd120('0x2d')][_0xd120('0x38')]){_0x1d6ddf[_0xd120('0x39')]=_['merge'](_0x1d6ddf[_0xd120('0x39')],{'$or':_[_0xd120('0x2b')](_0x1d6ddf[_0xd120('0x32')],function(_0xfb4243){var _0x3f3b83={};_0x3f3b83[_0xfb4243]={'$like':'%'+_0x3ecf44[_0xd120('0x2d')][_0xd120('0x38')]+'%'};return _0x3f3b83;})});}_0x1d6ddf=_[_0xd120('0x3a')]({},_0x1d6ddf,_0x3ecf44[_0xd120('0x3d')]);return _0x4da516['getDescriptions'](_0x1d6ddf);}})[_0xd120('0x23')](function(_0x3e7a7e){if(_0x3e7a7e){_0x15a2cb=_0x3e7a7e[_0xd120('0x33')];if(!_0x3ecf44[_0xd120('0x2d')]['hasOwnProperty']('nolimit')){_0x1d6ddf[_0xd120('0x1b')]=qs[_0xd120('0x1b')](_0x3ecf44[_0xd120('0x2d')][_0xd120('0x1b')]);_0x1d6ddf[_0xd120('0x1d')]=qs[_0xd120('0x1d')](_0x3ecf44['query'][_0xd120('0x1d')]);}return _0x4da516['getDescriptions'](_0x1d6ddf);}})[_0xd120('0x23')](function(_0x5f44cc){if(_0x5f44cc){return _0x5f44cc?{'count':_0x15a2cb,'rows':_0x5f44cc}:null;}})[_0xd120('0x23')](respondWithResult(_0x3eac1c,null))['catch'](handleError(_0x3eac1c,null));};exports['getFields']=function(_0x1eb15e,_0xb591f9,_0x373d72){var _0x1fcc74={};var _0x232aa1={};var _0x35ade5;var _0x3b7b1c;return db[_0xd120('0x3f')][_0xd120('0x4b')]({'where':{'id':_0x1eb15e['params']['id']}})[_0xd120('0x23')](handleEntityNotFound(_0xb591f9,null))[_0xd120('0x23')](function(_0x459d66){if(_0x459d66){_0x35ade5=_0x459d66;_0x232aa1[_0xd120('0x30')]=_['keys'](db[_0xd120('0x4c')]['rawAttributes']);_0x232aa1[_0xd120('0x2d')]=_[_0xd120('0x45')](_0x1eb15e[_0xd120('0x2d')]);_0x232aa1[_0xd120('0x2e')]=_['intersection'](_0x232aa1[_0xd120('0x30')],_0x232aa1['query']);_0x1fcc74['attributes']=_['intersection'](_0x232aa1[_0xd120('0x30')],qs[_0xd120('0x31')](_0x1eb15e[_0xd120('0x2d')][_0xd120('0x31')]));_0x1fcc74['attributes']=_0x1fcc74['attributes'][_0xd120('0x33')]?_0x1fcc74[_0xd120('0x32')]:_0x232aa1[_0xd120('0x30')];_0x1fcc74[_0xd120('0x4d')]=qs[_0xd120('0x36')](_0x1eb15e[_0xd120('0x2d')][_0xd120('0x36')]);_0x1fcc74[_0xd120('0x39')]=qs[_0xd120('0x2e')](_[_0xd120('0x37')](_0x1eb15e[_0xd120('0x2d')],_0x232aa1[_0xd120('0x2e')]));if(_0x1eb15e[_0xd120('0x2d')][_0xd120('0x38')]){_0x1fcc74[_0xd120('0x39')]=_['merge'](_0x1fcc74[_0xd120('0x39')],{'$or':_['map'](_0x1fcc74[_0xd120('0x32')],function(_0x3997c6){var _0x54ceca={};_0x54ceca[_0x3997c6]={'$like':'%'+_0x1eb15e[_0xd120('0x2d')][_0xd120('0x38')]+'%'};return _0x54ceca;})});}_0x1fcc74=_['merge']({},_0x1fcc74,_0x1eb15e['options']);return _0x35ade5[_0xd120('0x4e')](_0x1fcc74);}})['then'](function(_0x50b60a){if(_0x50b60a){_0x3b7b1c=_0x50b60a['length'];if(!_0x1eb15e[_0xd120('0x2d')]['hasOwnProperty'](_0xd120('0x35'))){_0x1fcc74[_0xd120('0x1b')]=qs[_0xd120('0x1b')](_0x1eb15e[_0xd120('0x2d')][_0xd120('0x1b')]);_0x1fcc74[_0xd120('0x1d')]=qs[_0xd120('0x1d')](_0x1eb15e[_0xd120('0x2d')][_0xd120('0x1d')]);}return _0x35ade5[_0xd120('0x4e')](_0x1fcc74);}})[_0xd120('0x23')](function(_0x5dd12d){if(_0x5dd12d){return _0x5dd12d?{'count':_0x3b7b1c,'rows':_0x5dd12d}:null;}})[_0xd120('0x23')](respondWithResult(_0xb591f9,null))[_0xd120('0x42')](handleError(_0xb591f9,null));}; \ No newline at end of file +var _0xadbb=['undefined','limit','count','set','apply','reject','update','then','error','stack','name','send','index','FreshsalesConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','where','VIRTUAL','merge','include','findAll','catch','show','params','includeAll','options','find','create','body','destroy','findOne','FreshsalesField','order','filter','getSubjects','getDescriptions','nolimit','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset'];(function(_0x245b66,_0x474c4f){var _0x3240c9=function(_0x54c1fa){while(--_0x54c1fa){_0x245b66['push'](_0x245b66['shift']());}};_0x3240c9(++_0x474c4f);}(_0xadbb,0xe2));var _0xbadb=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xadbb[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0xbadb('0x0'));var rimraf=require(_0xbadb('0x1'));var zipdir=require(_0xbadb('0x2'));var jsonpatch=require(_0xbadb('0x3'));var rp=require(_0xbadb('0x4'));var moment=require(_0xbadb('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xbadb('0x6'));var util=require(_0xbadb('0x7'));var path=require(_0xbadb('0x8'));var sox=require(_0xbadb('0x9'));var csv=require(_0xbadb('0xa'));var ejs=require(_0xbadb('0xb'));var fs=require('fs');var fs_extra=require(_0xbadb('0xc'));var _=require(_0xbadb('0xd'));var squel=require(_0xbadb('0xe'));var crypto=require(_0xbadb('0xf'));var jsforce=require(_0xbadb('0x10'));var deskjs=require(_0xbadb('0x11'));var toCsv=require(_0xbadb('0xa'));var querystring=require(_0xbadb('0x12'));var Papa=require(_0xbadb('0x13'));var Redis=require(_0xbadb('0x14'));var authService=require(_0xbadb('0x15'));var qs=require(_0xbadb('0x16'));var as=require(_0xbadb('0x17'));var hardwareService=require(_0xbadb('0x18'));var logger=require(_0xbadb('0x19'))(_0xbadb('0x1a'));var utils=require(_0xbadb('0x1b'));var config=require(_0xbadb('0x1c'));var licenseUtil=require(_0xbadb('0x1d'));var db=require(_0xbadb('0x1e'))['db'];function respondWithStatusCode(_0xb21b32,_0x3726ba){_0x3726ba=_0x3726ba||0xcc;return function(_0x435f74){if(_0x435f74){return _0xb21b32['sendStatus'](_0x3726ba);}return _0xb21b32[_0xbadb('0x1f')](_0x3726ba)[_0xbadb('0x20')]();};}function respondWithResult(_0x206282,_0x1ab0bb){_0x1ab0bb=_0x1ab0bb||0xc8;return function(_0x5c5ba5){if(_0x5c5ba5){return _0x206282[_0xbadb('0x1f')](_0x1ab0bb)[_0xbadb('0x21')](_0x5c5ba5);}};}function respondWithFilteredResult(_0x3cd99b,_0x9c23d5){return function(_0x568ecd){if(_0x568ecd){var _0x554f88=typeof _0x9c23d5[_0xbadb('0x22')]===_0xbadb('0x23')&&typeof _0x9c23d5[_0xbadb('0x24')]===_0xbadb('0x23');var _0x26905d=_0x568ecd['count'];var _0xc29ae7=_0x554f88?0x0:_0x9c23d5[_0xbadb('0x22')];var _0x119378=_0x554f88?_0x568ecd[_0xbadb('0x25')]:_0x9c23d5[_0xbadb('0x22')]+_0x9c23d5['limit'];var _0x32404b;if(_0x119378>=_0x26905d){_0x119378=_0x26905d;_0x32404b=0xc8;}else{_0x32404b=0xce;}_0x3cd99b[_0xbadb('0x1f')](_0x32404b);return _0x3cd99b[_0xbadb('0x26')]('Content-Range',_0xc29ae7+'-'+_0x119378+'/'+_0x26905d)[_0xbadb('0x21')](_0x568ecd);}return null;};}function patchUpdates(_0x4cf509){return function(_0x1c9ad6){try{jsonpatch[_0xbadb('0x27')](_0x1c9ad6,_0x4cf509,!![]);}catch(_0x4e570d){return BPromise[_0xbadb('0x28')](_0x4e570d);}return _0x1c9ad6['save']();};}function saveUpdates(_0x3c7488,_0x2f5442){return function(_0x5e3e23){if(_0x5e3e23){return _0x5e3e23[_0xbadb('0x29')](_0x3c7488)[_0xbadb('0x2a')](function(_0x5bafbd){return _0x5bafbd;});}return null;};}function removeEntity(_0x4e3226,_0x1b5b54){return function(_0x2074f1){if(_0x2074f1){return _0x2074f1['destroy']()[_0xbadb('0x2a')](function(){_0x4e3226[_0xbadb('0x1f')](0xcc)[_0xbadb('0x20')]();});}};}function handleEntityNotFound(_0x46d510,_0x445414){return function(_0x45ce03){if(!_0x45ce03){_0x46d510['sendStatus'](0x194);}return _0x45ce03;};}function handleError(_0x58be2d,_0x404c64){_0x404c64=_0x404c64||0x1f4;return function(_0x1ee8a3){logger[_0xbadb('0x2b')](_0x1ee8a3[_0xbadb('0x2c')]);if(_0x1ee8a3[_0xbadb('0x2d')]){delete _0x1ee8a3['name'];}_0x58be2d[_0xbadb('0x1f')](_0x404c64)[_0xbadb('0x2e')](_0x1ee8a3);};}exports[_0xbadb('0x2f')]=function(_0x95a1c8,_0x17d399){var _0x2b8870={},_0x14c7b4={},_0xdf19ea={'count':0x0,'rows':[]};var _0x186271=_['map'](db[_0xbadb('0x30')][_0xbadb('0x31')],function(_0x5d03d9){return{'name':_0x5d03d9[_0xbadb('0x32')],'type':_0x5d03d9[_0xbadb('0x33')][_0xbadb('0x34')]};});_0x14c7b4[_0xbadb('0x35')]=_[_0xbadb('0x36')](_0x186271,'name');_0x14c7b4[_0xbadb('0x37')]=_[_0xbadb('0x38')](_0x95a1c8[_0xbadb('0x37')]);_0x14c7b4[_0xbadb('0x39')]=_[_0xbadb('0x3a')](_0x14c7b4[_0xbadb('0x35')],_0x14c7b4[_0xbadb('0x37')]);_0x2b8870[_0xbadb('0x3b')]=_['intersection'](_0x14c7b4[_0xbadb('0x35')],qs[_0xbadb('0x3c')](_0x95a1c8[_0xbadb('0x37')][_0xbadb('0x3c')]));_0x2b8870[_0xbadb('0x3b')]=_0x2b8870[_0xbadb('0x3b')][_0xbadb('0x3d')]?_0x2b8870['attributes']:_0x14c7b4['model'];if(!_0x95a1c8['query'][_0xbadb('0x3e')]('nolimit')){_0x2b8870[_0xbadb('0x24')]=qs[_0xbadb('0x24')](_0x95a1c8['query'][_0xbadb('0x24')]);_0x2b8870[_0xbadb('0x22')]=qs[_0xbadb('0x22')](_0x95a1c8[_0xbadb('0x37')]['offset']);}_0x2b8870['order']=qs[_0xbadb('0x3f')](_0x95a1c8[_0xbadb('0x37')][_0xbadb('0x3f')]);_0x2b8870['where']=qs[_0xbadb('0x39')](_[_0xbadb('0x40')](_0x95a1c8[_0xbadb('0x37')],_0x14c7b4[_0xbadb('0x39')]),_0x186271);if(_0x95a1c8[_0xbadb('0x37')]['filter']){_0x2b8870['where']=_['merge'](_0x2b8870[_0xbadb('0x41')],{'$or':_[_0xbadb('0x36')](_0x186271,function(_0x495399){if(_0x495399[_0xbadb('0x33')]!==_0xbadb('0x42')){var _0x4a6c87={};_0x4a6c87[_0x495399[_0xbadb('0x2d')]]={'$like':'%'+_0x95a1c8[_0xbadb('0x37')]['filter']+'%'};return _0x4a6c87;}})});}_0x2b8870=_[_0xbadb('0x43')]({},_0x2b8870,_0x95a1c8['options']);var _0x778556={'where':_0x2b8870[_0xbadb('0x41')]};return db[_0xbadb('0x30')][_0xbadb('0x25')](_0x778556)['then'](function(_0x369d72){_0xdf19ea['count']=_0x369d72;if(_0x95a1c8[_0xbadb('0x37')]['includeAll']){_0x2b8870[_0xbadb('0x44')]=[{'all':!![]}];}return db[_0xbadb('0x30')][_0xbadb('0x45')](_0x2b8870);})[_0xbadb('0x2a')](function(_0x4f4b37){_0xdf19ea['rows']=_0x4f4b37;return _0xdf19ea;})[_0xbadb('0x2a')](respondWithFilteredResult(_0x17d399,_0x2b8870))[_0xbadb('0x46')](handleError(_0x17d399,null));};exports[_0xbadb('0x47')]=function(_0x5ad144,_0x266c40){var _0x28fc59={'raw':![],'where':{'id':_0x5ad144[_0xbadb('0x48')]['id']}},_0x52fd2c={};_0x52fd2c['model']=_['keys'](db[_0xbadb('0x30')]['rawAttributes']);_0x52fd2c[_0xbadb('0x37')]=_['keys'](_0x5ad144[_0xbadb('0x37')]);_0x52fd2c['filters']=_[_0xbadb('0x3a')](_0x52fd2c[_0xbadb('0x35')],_0x52fd2c['query']);_0x28fc59[_0xbadb('0x3b')]=_[_0xbadb('0x3a')](_0x52fd2c[_0xbadb('0x35')],qs[_0xbadb('0x3c')](_0x5ad144['query'][_0xbadb('0x3c')]));_0x28fc59[_0xbadb('0x3b')]=_0x28fc59[_0xbadb('0x3b')][_0xbadb('0x3d')]?_0x28fc59[_0xbadb('0x3b')]:_0x52fd2c[_0xbadb('0x35')];if(_0x5ad144[_0xbadb('0x37')][_0xbadb('0x49')]){_0x28fc59[_0xbadb('0x44')]=[{'all':!![]}];}_0x28fc59=_[_0xbadb('0x43')]({},_0x28fc59,_0x5ad144[_0xbadb('0x4a')]);return db[_0xbadb('0x30')][_0xbadb('0x4b')](_0x28fc59)[_0xbadb('0x2a')](handleEntityNotFound(_0x266c40,null))['then'](respondWithResult(_0x266c40,null))['catch'](handleError(_0x266c40,null));};exports[_0xbadb('0x4c')]=function(_0x28a489,_0xec621){return db[_0xbadb('0x30')][_0xbadb('0x4c')](_0x28a489[_0xbadb('0x4d')],{})[_0xbadb('0x2a')](respondWithResult(_0xec621,0xc9))[_0xbadb('0x46')](handleError(_0xec621,null));};exports[_0xbadb('0x29')]=function(_0x5d2e57,_0x190157){if(_0x5d2e57[_0xbadb('0x4d')]['id']){delete _0x5d2e57['body']['id'];}return db[_0xbadb('0x30')][_0xbadb('0x4b')]({'where':{'id':_0x5d2e57[_0xbadb('0x48')]['id']}})[_0xbadb('0x2a')](handleEntityNotFound(_0x190157,null))[_0xbadb('0x2a')](saveUpdates(_0x5d2e57['body'],null))['then'](respondWithResult(_0x190157,null))['catch'](handleError(_0x190157,null));};exports[_0xbadb('0x4e')]=function(_0x6b060c,_0x24d34e){return db['FreshsalesConfiguration'][_0xbadb('0x4b')]({'where':{'id':_0x6b060c[_0xbadb('0x48')]['id']}})[_0xbadb('0x2a')](handleEntityNotFound(_0x24d34e,null))[_0xbadb('0x2a')](removeEntity(_0x24d34e,null))[_0xbadb('0x46')](handleError(_0x24d34e,null));};exports['getSubjects']=function(_0x13523e,_0x479265,_0x1d27c6){var _0x5b730b={};var _0x2a49e5={};var _0x129114;var _0xe836ef;return db[_0xbadb('0x30')][_0xbadb('0x4f')]({'where':{'id':_0x13523e[_0xbadb('0x48')]['id']}})[_0xbadb('0x2a')](handleEntityNotFound(_0x479265,null))[_0xbadb('0x2a')](function(_0x569ca5){if(_0x569ca5){_0x129114=_0x569ca5;_0x2a49e5[_0xbadb('0x35')]=_[_0xbadb('0x38')](db[_0xbadb('0x50')][_0xbadb('0x31')]);_0x2a49e5[_0xbadb('0x37')]=_[_0xbadb('0x38')](_0x13523e[_0xbadb('0x37')]);_0x2a49e5[_0xbadb('0x39')]=_[_0xbadb('0x3a')](_0x2a49e5[_0xbadb('0x35')],_0x2a49e5[_0xbadb('0x37')]);_0x5b730b[_0xbadb('0x3b')]=_[_0xbadb('0x3a')](_0x2a49e5['model'],qs[_0xbadb('0x3c')](_0x13523e['query'][_0xbadb('0x3c')]));_0x5b730b[_0xbadb('0x3b')]=_0x5b730b[_0xbadb('0x3b')][_0xbadb('0x3d')]?_0x5b730b[_0xbadb('0x3b')]:_0x2a49e5['model'];_0x5b730b[_0xbadb('0x51')]=qs[_0xbadb('0x3f')](_0x13523e['query'][_0xbadb('0x3f')]);_0x5b730b[_0xbadb('0x41')]=qs[_0xbadb('0x39')](_['pick'](_0x13523e[_0xbadb('0x37')],_0x2a49e5[_0xbadb('0x39')]));if(_0x13523e['query'][_0xbadb('0x52')]){_0x5b730b[_0xbadb('0x41')]=_[_0xbadb('0x43')](_0x5b730b['where'],{'$or':_[_0xbadb('0x36')](_0x5b730b[_0xbadb('0x3b')],function(_0x5acca7){var _0x19cdfd={};_0x19cdfd[_0x5acca7]={'$like':'%'+_0x13523e[_0xbadb('0x37')]['filter']+'%'};return _0x19cdfd;})});}_0x5b730b=_[_0xbadb('0x43')]({},_0x5b730b,_0x13523e[_0xbadb('0x4a')]);return _0x129114[_0xbadb('0x53')](_0x5b730b);}})['then'](function(_0x538ca3){if(_0x538ca3){_0xe836ef=_0x538ca3[_0xbadb('0x3d')];if(!_0x13523e['query'][_0xbadb('0x3e')]('nolimit')){_0x5b730b[_0xbadb('0x24')]=qs[_0xbadb('0x24')](_0x13523e[_0xbadb('0x37')][_0xbadb('0x24')]);_0x5b730b[_0xbadb('0x22')]=qs[_0xbadb('0x22')](_0x13523e['query']['offset']);}return _0x129114[_0xbadb('0x53')](_0x5b730b);}})[_0xbadb('0x2a')](function(_0x2692f3){if(_0x2692f3){return _0x2692f3?{'count':_0xe836ef,'rows':_0x2692f3}:null;}})[_0xbadb('0x2a')](respondWithResult(_0x479265,null))[_0xbadb('0x46')](handleError(_0x479265,null));};exports['getDescriptions']=function(_0x5df31d,_0x3998e4,_0x4984db){var _0x347b96={};var _0x117d03={};var _0x3da50b;var _0x1f2ef0;return db[_0xbadb('0x30')][_0xbadb('0x4f')]({'where':{'id':_0x5df31d[_0xbadb('0x48')]['id']}})[_0xbadb('0x2a')](handleEntityNotFound(_0x3998e4,null))[_0xbadb('0x2a')](function(_0x2ec99d){if(_0x2ec99d){_0x3da50b=_0x2ec99d;_0x117d03['model']=_['keys'](db[_0xbadb('0x50')]['rawAttributes']);_0x117d03[_0xbadb('0x37')]=_['keys'](_0x5df31d[_0xbadb('0x37')]);_0x117d03[_0xbadb('0x39')]=_[_0xbadb('0x3a')](_0x117d03['model'],_0x117d03['query']);_0x347b96[_0xbadb('0x3b')]=_[_0xbadb('0x3a')](_0x117d03[_0xbadb('0x35')],qs[_0xbadb('0x3c')](_0x5df31d[_0xbadb('0x37')]['fields']));_0x347b96[_0xbadb('0x3b')]=_0x347b96[_0xbadb('0x3b')][_0xbadb('0x3d')]?_0x347b96[_0xbadb('0x3b')]:_0x117d03[_0xbadb('0x35')];_0x347b96['order']=qs[_0xbadb('0x3f')](_0x5df31d['query'][_0xbadb('0x3f')]);_0x347b96[_0xbadb('0x41')]=qs[_0xbadb('0x39')](_[_0xbadb('0x40')](_0x5df31d['query'],_0x117d03[_0xbadb('0x39')]));if(_0x5df31d[_0xbadb('0x37')][_0xbadb('0x52')]){_0x347b96['where']=_['merge'](_0x347b96[_0xbadb('0x41')],{'$or':_[_0xbadb('0x36')](_0x347b96['attributes'],function(_0x221602){var _0x2c9c00={};_0x2c9c00[_0x221602]={'$like':'%'+_0x5df31d['query']['filter']+'%'};return _0x2c9c00;})});}_0x347b96=_[_0xbadb('0x43')]({},_0x347b96,_0x5df31d[_0xbadb('0x4a')]);return _0x3da50b[_0xbadb('0x54')](_0x347b96);}})['then'](function(_0xd886){if(_0xd886){_0x1f2ef0=_0xd886[_0xbadb('0x3d')];if(!_0x5df31d[_0xbadb('0x37')][_0xbadb('0x3e')](_0xbadb('0x55'))){_0x347b96['limit']=qs[_0xbadb('0x24')](_0x5df31d[_0xbadb('0x37')]['limit']);_0x347b96[_0xbadb('0x22')]=qs[_0xbadb('0x22')](_0x5df31d['query']['offset']);}return _0x3da50b['getDescriptions'](_0x347b96);}})[_0xbadb('0x2a')](function(_0x1b0479){if(_0x1b0479){return _0x1b0479?{'count':_0x1f2ef0,'rows':_0x1b0479}:null;}})[_0xbadb('0x2a')](respondWithResult(_0x3998e4,null))['catch'](handleError(_0x3998e4,null));};exports[_0xbadb('0x56')]=function(_0x164b25,_0x7994a1,_0x390a84){var _0x2e439a={};var _0x590b6a={};var _0x3cbcd4;var _0x29151c;return db[_0xbadb('0x30')]['findOne']({'where':{'id':_0x164b25['params']['id']}})[_0xbadb('0x2a')](handleEntityNotFound(_0x7994a1,null))[_0xbadb('0x2a')](function(_0x14c0f0){if(_0x14c0f0){_0x3cbcd4=_0x14c0f0;_0x590b6a[_0xbadb('0x35')]=_[_0xbadb('0x38')](db['FreshsalesField'][_0xbadb('0x31')]);_0x590b6a[_0xbadb('0x37')]=_[_0xbadb('0x38')](_0x164b25[_0xbadb('0x37')]);_0x590b6a['filters']=_[_0xbadb('0x3a')](_0x590b6a['model'],_0x590b6a[_0xbadb('0x37')]);_0x2e439a[_0xbadb('0x3b')]=_[_0xbadb('0x3a')](_0x590b6a[_0xbadb('0x35')],qs['fields'](_0x164b25[_0xbadb('0x37')][_0xbadb('0x3c')]));_0x2e439a['attributes']=_0x2e439a[_0xbadb('0x3b')][_0xbadb('0x3d')]?_0x2e439a[_0xbadb('0x3b')]:_0x590b6a[_0xbadb('0x35')];_0x2e439a['order']=qs[_0xbadb('0x3f')](_0x164b25[_0xbadb('0x37')]['sort']);_0x2e439a[_0xbadb('0x41')]=qs[_0xbadb('0x39')](_['pick'](_0x164b25[_0xbadb('0x37')],_0x590b6a[_0xbadb('0x39')]));if(_0x164b25['query']['filter']){_0x2e439a[_0xbadb('0x41')]=_[_0xbadb('0x43')](_0x2e439a['where'],{'$or':_['map'](_0x2e439a[_0xbadb('0x3b')],function(_0x463324){var _0x1114d5={};_0x1114d5[_0x463324]={'$like':'%'+_0x164b25['query'][_0xbadb('0x52')]+'%'};return _0x1114d5;})});}_0x2e439a=_[_0xbadb('0x43')]({},_0x2e439a,_0x164b25[_0xbadb('0x4a')]);return _0x3cbcd4[_0xbadb('0x56')](_0x2e439a);}})[_0xbadb('0x2a')](function(_0x544d17){if(_0x544d17){_0x29151c=_0x544d17[_0xbadb('0x3d')];if(!_0x164b25['query']['hasOwnProperty'](_0xbadb('0x55'))){_0x2e439a[_0xbadb('0x24')]=qs[_0xbadb('0x24')](_0x164b25[_0xbadb('0x37')][_0xbadb('0x24')]);_0x2e439a[_0xbadb('0x22')]=qs[_0xbadb('0x22')](_0x164b25[_0xbadb('0x37')][_0xbadb('0x22')]);}return _0x3cbcd4[_0xbadb('0x56')](_0x2e439a);}})[_0xbadb('0x2a')](function(_0x37b935){if(_0x37b935){return _0x37b935?{'count':_0x29151c,'rows':_0x37b935}:null;}})[_0xbadb('0x2a')](respondWithResult(_0x7994a1,null))[_0xbadb('0x46')](handleError(_0x7994a1,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index f7c7aca..b684cbf 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 _0x1941=['util','../../config/logger','api','request-promise','path','../../config/environment','./intFreshsalesConfiguration.attributes','exports','FreshsalesConfiguration','int_freshsales_configurations','lodash'];(function(_0x4f0f6d,_0x28b6f4){var _0x2b2c98=function(_0x433703){while(--_0x433703){_0x4f0f6d['push'](_0x4f0f6d['shift']());}};_0x2b2c98(++_0x28b6f4);}(_0x1941,0x13e));var _0x1194=function(_0x54c1b8,_0x240280){_0x54c1b8=_0x54c1b8-0x0;var _0x1eda32=_0x1941[_0x54c1b8];return _0x1eda32;};'use strict';var _=require(_0x1194('0x0'));var util=require(_0x1194('0x1'));var logger=require(_0x1194('0x2'))(_0x1194('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1194('0x4'));var fs=require('fs');var path=require(_0x1194('0x5'));var rimraf=require('rimraf');var config=require(_0x1194('0x6'));var attributes=require(_0x1194('0x7'));module[_0x1194('0x8')]=function(_0x5412a4,_0x5a1c6b){return _0x5412a4['define'](_0x1194('0x9'),attributes,{'tableName':_0x1194('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb7ca=['exports','define','FreshsalesConfiguration','lodash','../../config/logger','api','bluebird','rimraf'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0xb7ca,0x16b));var _0xab7c=function(_0x579941,_0x453dba){_0x579941=_0x579941-0x0;var _0x43711b=_0xb7ca[_0x579941];return _0x43711b;};'use strict';var _=require(_0xab7c('0x0'));var util=require('util');var logger=require(_0xab7c('0x1'))(_0xab7c('0x2'));var moment=require('moment');var BPromise=require(_0xab7c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xab7c('0x4'));var config=require('../../config/environment');var attributes=require('./intFreshsalesConfiguration.attributes');module[_0xab7c('0x5')]=function(_0x472672,_0x1b3b3a){return _0x472672[_0xab7c('0x6')](_0xab7c('0x7'),attributes,{'tableName':'int_freshsales_configurations','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 6142eec..2199819 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 _0xd534=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xd534,0x182));var _0x4d53=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xd534[_0x5f09c5];return _0x426ad9;};'use strict';var _=require('lodash');var util=require(_0x4d53('0x0'));var moment=require(_0x4d53('0x1'));var BPromise=require(_0x4d53('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4d53('0x3'));var db=require(_0x4d53('0x4'))['db'];var utils=require(_0x4d53('0x5'));var logger=require(_0x4d53('0x6'))(_0x4d53('0x7'));var config=require(_0x4d53('0x8'));var jayson=require(_0x4d53('0x9'));var client=jayson[_0x4d53('0xa')][_0x4d53('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5351f8,_0x170c23,_0x3bf002){return new BPromise(function(_0x52a817,_0x51ee2c){return client[_0x4d53('0xc')](_0x5351f8,_0x3bf002)[_0x4d53('0xd')](function(_0x37fbb8){logger[_0x4d53('0xe')](_0x4d53('0xf'),_0x170c23,_0x4d53('0x10'));logger[_0x4d53('0x11')](_0x4d53('0x12'),_0x170c23,_0x4d53('0x10'),JSON[_0x4d53('0x13')](_0x37fbb8));if(_0x37fbb8[_0x4d53('0x14')]){if(_0x37fbb8[_0x4d53('0x14')][_0x4d53('0x15')]===0x1f4){logger['error'](_0x4d53('0xf'),_0x170c23,_0x37fbb8['error'][_0x4d53('0x16')]);return _0x51ee2c(_0x37fbb8[_0x4d53('0x14')][_0x4d53('0x16')]);}logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x170c23,_0x37fbb8['error'][_0x4d53('0x16')]);return _0x52a817(_0x37fbb8[_0x4d53('0x14')][_0x4d53('0x16')]);}else{logger[_0x4d53('0xe')](_0x4d53('0xf'),_0x170c23,_0x4d53('0x10'));_0x52a817(_0x37fbb8['result'][_0x4d53('0x16')]);}})['catch'](function(_0x5014ab){logger['error'](_0x4d53('0xf'),_0x170c23,_0x5014ab);_0x51ee2c(_0x5014ab);});});} \ No newline at end of file +var _0x6f49=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','FreshsalesConfiguration,\x20%s,\x20%s','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird'];(function(_0xfc5535,_0x3e1f80){var _0x4e07c8=function(_0x30fb68){while(--_0x30fb68){_0xfc5535['push'](_0xfc5535['shift']());}};_0x4e07c8(++_0x3e1f80);}(_0x6f49,0x127));var _0x96f4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6f49[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x96f4('0x0'));var util=require(_0x96f4('0x1'));var moment=require(_0x96f4('0x2'));var BPromise=require(_0x96f4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x96f4('0x4'));var db=require(_0x96f4('0x5'))['db'];var utils=require(_0x96f4('0x6'));var logger=require(_0x96f4('0x7'))(_0x96f4('0x8'));var config=require(_0x96f4('0x9'));var jayson=require(_0x96f4('0xa'));var client=jayson[_0x96f4('0xb')][_0x96f4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2c504d,_0x10dee2,_0x439a5e){return new BPromise(function(_0x35e6ba,_0x4fca6c){return client['request'](_0x2c504d,_0x439a5e)['then'](function(_0x2e7b39){logger[_0x96f4('0xd')](_0x96f4('0xe'),_0x10dee2,'request\x20sent');logger[_0x96f4('0xf')](_0x96f4('0x10'),_0x10dee2,_0x96f4('0x11'),JSON[_0x96f4('0x12')](_0x2e7b39));if(_0x2e7b39[_0x96f4('0x13')]){if(_0x2e7b39['error']['code']===0x1f4){logger[_0x96f4('0x13')](_0x96f4('0xe'),_0x10dee2,_0x2e7b39[_0x96f4('0x13')][_0x96f4('0x14')]);return _0x4fca6c(_0x2e7b39['error'][_0x96f4('0x14')]);}logger[_0x96f4('0x13')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x10dee2,_0x2e7b39['error'][_0x96f4('0x14')]);return _0x35e6ba(_0x2e7b39['error'][_0x96f4('0x14')]);}else{logger[_0x96f4('0xd')](_0x96f4('0xe'),_0x10dee2,'request\x20sent');_0x35e6ba(_0x2e7b39[_0x96f4('0x15')][_0x96f4('0x14')]);}})[_0x96f4('0x16')](function(_0x59218c){logger['error'](_0x96f4('0xe'),_0x10dee2,_0x59218c);_0x4fca6c(_0x59218c);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 2e0b5d5..97080ec 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 _0x3756=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','post','create','put','delete','destroy','multer','util'];(function(_0x4e40db,_0x2499ad){var _0x832e9c=function(_0x41206e){while(--_0x41206e){_0x4e40db['push'](_0x4e40db['shift']());}};_0x832e9c(++_0x2499ad);}(_0x3756,0x116));var _0x6375=function(_0x18748e,_0x4ac47e){_0x18748e=_0x18748e-0x0;var _0x225284=_0x3756[_0x18748e];return _0x225284;};'use strict';var multer=require(_0x6375('0x0'));var util=require(_0x6375('0x1'));var path=require(_0x6375('0x2'));var timeout=require(_0x6375('0x3'));var express=require(_0x6375('0x4'));var router=express[_0x6375('0x5')]();var fs_extra=require(_0x6375('0x6'));var auth=require(_0x6375('0x7'));var interaction=require(_0x6375('0x8'));var config=require(_0x6375('0x9'));var controller=require(_0x6375('0xa'));router[_0x6375('0xb')]('/',auth[_0x6375('0xc')](),controller[_0x6375('0xd')]);router[_0x6375('0xb')](_0x6375('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x6375('0xf')]('/',auth[_0x6375('0xc')](),controller[_0x6375('0x10')]);router[_0x6375('0x11')](_0x6375('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x6375('0x12')](_0x6375('0xe'),auth[_0x6375('0xc')](),controller[_0x6375('0x13')]);module['exports']=router; \ No newline at end of file +var _0x6c50=['/:id','show','create','put','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index'];(function(_0x398157,_0x1953ab){var _0x356075=function(_0x202569){while(--_0x202569){_0x398157['push'](_0x398157['shift']());}};_0x356075(++_0x1953ab);}(_0x6c50,0xa4));var _0x06c5=function(_0x5a3b52,_0x30288d){_0x5a3b52=_0x5a3b52-0x0;var _0xb3dc1b=_0x6c50[_0x5a3b52];return _0xb3dc1b;};'use strict';var multer=require(_0x06c5('0x0'));var util=require(_0x06c5('0x1'));var path=require(_0x06c5('0x2'));var timeout=require(_0x06c5('0x3'));var express=require('express');var router=express[_0x06c5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x06c5('0x5'));var interaction=require(_0x06c5('0x6'));var config=require(_0x06c5('0x7'));var controller=require(_0x06c5('0x8'));router[_0x06c5('0x9')]('/',auth[_0x06c5('0xa')](),controller[_0x06c5('0xb')]);router[_0x06c5('0x9')](_0x06c5('0xc'),auth[_0x06c5('0xa')](),controller[_0x06c5('0xd')]);router['post']('/',auth[_0x06c5('0xa')](),controller[_0x06c5('0xe')]);router[_0x06c5('0xf')](_0x06c5('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x06c5('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 9927ecb..df5b3df 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 _0x92c8=['exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize'];(function(_0x4193fc,_0x2b7bf5){var _0x541099=function(_0x582767){while(--_0x582767){_0x4193fc['push'](_0x4193fc['shift']());}};_0x541099(++_0x2b7bf5);}(_0x92c8,0x1c1));var _0x892c=function(_0x38887e,_0x2866bd){_0x38887e=_0x38887e-0x0;var _0xd175b4=_0x92c8[_0x38887e];return _0xd175b4;};'use strict';var Sequelize=require(_0x892c('0x0'));module[_0x892c('0x1')]={'type':{'type':Sequelize[_0x892c('0x2')](_0x892c('0x3'),_0x892c('0x4'),_0x892c('0x5'),_0x892c('0x6'),_0x892c('0x7')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x892c('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0x892c('0x3'),_0x892c('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x892c('0x8')]},'idField':{'type':Sequelize[_0x892c('0x8')]},'nameField':{'type':Sequelize[_0x892c('0x8')]},'customField':{'type':Sequelize[_0x892c('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x892c('0x8')]}}; \ No newline at end of file +var _0x0c03=['picklist','STRING','variable','BOOLEAN','exports','ENUM','string','customVariable','keyValue'];(function(_0x44f7ae,_0x2c6cf0){var _0x37d44a=function(_0x25146b){while(--_0x25146b){_0x44f7ae['push'](_0x44f7ae['shift']());}};_0x37d44a(++_0x2c6cf0);}(_0x0c03,0xca));var _0x30c0=function(_0x59e862,_0x477bf2){_0x59e862=_0x59e862-0x0;var _0x1a25ee=_0x0c03[_0x59e862];return _0x1a25ee;};'use strict';var Sequelize=require('sequelize');module[_0x30c0('0x0')]={'type':{'type':Sequelize[_0x30c0('0x1')](_0x30c0('0x2'),'variable',_0x30c0('0x3'),_0x30c0('0x4'),_0x30c0('0x5')),'defaultValue':_0x30c0('0x2')},'content':{'type':Sequelize[_0x30c0('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x30c0('0x1')]('string',_0x30c0('0x7'),_0x30c0('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x30c0('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x30c0('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x30c0('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 07a4bdf..66e08f8 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 _0xe1ce=['update','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','destroy','then','error','stack','name','send','index','map','FreshsalesField','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','keys','options','find','catch','create','body'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xe1ce,0xda));var _0xee1c=function(_0x56916d,_0x37b935){_0x56916d=_0x56916d-0x0;var _0x2b7f1f=_0xe1ce[_0x56916d];return _0x2b7f1f;};'use strict';var emlformat=require(_0xee1c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xee1c('0x1'));var jsonpatch=require(_0xee1c('0x2'));var rp=require(_0xee1c('0x3'));var moment=require(_0xee1c('0x4'));var BPromise=require(_0xee1c('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xee1c('0x6'));var sox=require(_0xee1c('0x7'));var csv=require(_0xee1c('0x8'));var ejs=require(_0xee1c('0x9'));var fs=require('fs');var fs_extra=require(_0xee1c('0xa'));var _=require('lodash');var squel=require(_0xee1c('0xb'));var crypto=require(_0xee1c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xee1c('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xee1c('0xe'));var Redis=require(_0xee1c('0xf'));var authService=require(_0xee1c('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xee1c('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xee1c('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xee1c('0x13'))['db'];function respondWithStatusCode(_0x263568,_0x1fb7da){_0x1fb7da=_0x1fb7da||0xcc;return function(_0x5db599){if(_0x5db599){return _0x263568[_0xee1c('0x14')](_0x1fb7da);}return _0x263568[_0xee1c('0x15')](_0x1fb7da)[_0xee1c('0x16')]();};}function respondWithResult(_0x445422,_0x131d4d){_0x131d4d=_0x131d4d||0xc8;return function(_0x357408){if(_0x357408){return _0x445422[_0xee1c('0x15')](_0x131d4d)[_0xee1c('0x17')](_0x357408);}};}function respondWithFilteredResult(_0x3991ef,_0x3e9f8e){return function(_0x2a7f85){if(_0x2a7f85){var _0x531399=typeof _0x3e9f8e[_0xee1c('0x18')]===_0xee1c('0x19')&&typeof _0x3e9f8e[_0xee1c('0x1a')]===_0xee1c('0x19');var _0xfdc313=_0x2a7f85[_0xee1c('0x1b')];var _0x1a3f8a=_0x531399?0x0:_0x3e9f8e[_0xee1c('0x18')];var _0x28a2a8=_0x531399?_0x2a7f85['count']:_0x3e9f8e[_0xee1c('0x18')]+_0x3e9f8e[_0xee1c('0x1a')];var _0x489335;if(_0x28a2a8>=_0xfdc313){_0x28a2a8=_0xfdc313;_0x489335=0xc8;}else{_0x489335=0xce;}_0x3991ef[_0xee1c('0x15')](_0x489335);return _0x3991ef[_0xee1c('0x1c')]('Content-Range',_0x1a3f8a+'-'+_0x28a2a8+'/'+_0xfdc313)[_0xee1c('0x17')](_0x2a7f85);}return null;};}function patchUpdates(_0x5bbbbf){return function(_0x3a80b6){try{jsonpatch['apply'](_0x3a80b6,_0x5bbbbf,!![]);}catch(_0x3ad9d1){return BPromise[_0xee1c('0x1d')](_0x3ad9d1);}return _0x3a80b6[_0xee1c('0x1e')]();};}function saveUpdates(_0x427528,_0xafea8e){return function(_0x14a852){if(_0x14a852){return _0x14a852['update'](_0x427528)['then'](function(_0x2c35e1){return _0x2c35e1;});}return null;};}function removeEntity(_0x366b08,_0x38a8cd){return function(_0xf9dd97){if(_0xf9dd97){return _0xf9dd97[_0xee1c('0x1f')]()[_0xee1c('0x20')](function(){_0x366b08['status'](0xcc)[_0xee1c('0x16')]();});}};}function handleEntityNotFound(_0x32eddf,_0x25c460){return function(_0x383a17){if(!_0x383a17){_0x32eddf[_0xee1c('0x14')](0x194);}return _0x383a17;};}function handleError(_0x12981f,_0x72beee){_0x72beee=_0x72beee||0x1f4;return function(_0x85add6){logger[_0xee1c('0x21')](_0x85add6[_0xee1c('0x22')]);if(_0x85add6[_0xee1c('0x23')]){delete _0x85add6[_0xee1c('0x23')];}_0x12981f[_0xee1c('0x15')](_0x72beee)[_0xee1c('0x24')](_0x85add6);};}exports[_0xee1c('0x25')]=function(_0x4bdaa7,_0x5216ec){var _0x3ce809={},_0x45ff16={},_0x3f668a={'count':0x0,'rows':[]};var _0xd5f07f=_[_0xee1c('0x26')](db[_0xee1c('0x27')][_0xee1c('0x28')],function(_0x16afc0){return{'name':_0x16afc0[_0xee1c('0x29')],'type':_0x16afc0[_0xee1c('0x2a')][_0xee1c('0x2b')]};});_0x45ff16[_0xee1c('0x2c')]=_['map'](_0xd5f07f,'name');_0x45ff16[_0xee1c('0x2d')]=_['keys'](_0x4bdaa7[_0xee1c('0x2d')]);_0x45ff16['filters']=_[_0xee1c('0x2e')](_0x45ff16['model'],_0x45ff16['query']);_0x3ce809[_0xee1c('0x2f')]=_[_0xee1c('0x2e')](_0x45ff16[_0xee1c('0x2c')],qs[_0xee1c('0x30')](_0x4bdaa7[_0xee1c('0x2d')][_0xee1c('0x30')]));_0x3ce809[_0xee1c('0x2f')]=_0x3ce809[_0xee1c('0x2f')][_0xee1c('0x31')]?_0x3ce809['attributes']:_0x45ff16[_0xee1c('0x2c')];if(!_0x4bdaa7[_0xee1c('0x2d')][_0xee1c('0x32')]('nolimit')){_0x3ce809[_0xee1c('0x1a')]=qs['limit'](_0x4bdaa7[_0xee1c('0x2d')]['limit']);_0x3ce809['offset']=qs[_0xee1c('0x18')](_0x4bdaa7[_0xee1c('0x2d')][_0xee1c('0x18')]);}_0x3ce809[_0xee1c('0x33')]=qs[_0xee1c('0x34')](_0x4bdaa7[_0xee1c('0x2d')][_0xee1c('0x34')]);_0x3ce809[_0xee1c('0x35')]=qs['filters'](_[_0xee1c('0x36')](_0x4bdaa7['query'],_0x45ff16[_0xee1c('0x37')]),_0xd5f07f);if(_0x4bdaa7[_0xee1c('0x2d')][_0xee1c('0x38')]){_0x3ce809[_0xee1c('0x35')]=_[_0xee1c('0x39')](_0x3ce809[_0xee1c('0x35')],{'$or':_[_0xee1c('0x26')](_0xd5f07f,function(_0x4fef66){if(_0x4fef66[_0xee1c('0x2a')]!==_0xee1c('0x3a')){var _0x581237={};_0x581237[_0x4fef66[_0xee1c('0x23')]]={'$like':'%'+_0x4bdaa7['query'][_0xee1c('0x38')]+'%'};return _0x581237;}})});}_0x3ce809=_['merge']({},_0x3ce809,_0x4bdaa7['options']);var _0x391e17={'where':_0x3ce809[_0xee1c('0x35')]};return db[_0xee1c('0x27')][_0xee1c('0x1b')](_0x391e17)[_0xee1c('0x20')](function(_0x31a2d8){_0x3f668a[_0xee1c('0x1b')]=_0x31a2d8;if(_0x4bdaa7[_0xee1c('0x2d')][_0xee1c('0x3b')]){_0x3ce809[_0xee1c('0x3c')]=[{'all':!![]}];}return db[_0xee1c('0x27')][_0xee1c('0x3d')](_0x3ce809);})[_0xee1c('0x20')](function(_0x1953b4){_0x3f668a[_0xee1c('0x3e')]=_0x1953b4;return _0x3f668a;})[_0xee1c('0x20')](respondWithFilteredResult(_0x5216ec,_0x3ce809))['catch'](handleError(_0x5216ec,null));};exports[_0xee1c('0x3f')]=function(_0x3fc6a5,_0x330862){var _0x447e8b={'raw':!![],'where':{'id':_0x3fc6a5['params']['id']}},_0x48e976={};_0x48e976[_0xee1c('0x2c')]=_[_0xee1c('0x40')](db[_0xee1c('0x27')]['rawAttributes']);_0x48e976[_0xee1c('0x2d')]=_[_0xee1c('0x40')](_0x3fc6a5['query']);_0x48e976[_0xee1c('0x37')]=_[_0xee1c('0x2e')](_0x48e976[_0xee1c('0x2c')],_0x48e976[_0xee1c('0x2d')]);_0x447e8b[_0xee1c('0x2f')]=_['intersection'](_0x48e976['model'],qs['fields'](_0x3fc6a5[_0xee1c('0x2d')][_0xee1c('0x30')]));_0x447e8b[_0xee1c('0x2f')]=_0x447e8b[_0xee1c('0x2f')][_0xee1c('0x31')]?_0x447e8b['attributes']:_0x48e976[_0xee1c('0x2c')];if(_0x3fc6a5[_0xee1c('0x2d')][_0xee1c('0x3b')]){_0x447e8b[_0xee1c('0x3c')]=[{'all':!![]}];}_0x447e8b=_[_0xee1c('0x39')]({},_0x447e8b,_0x3fc6a5[_0xee1c('0x41')]);return db[_0xee1c('0x27')][_0xee1c('0x42')](_0x447e8b)[_0xee1c('0x20')](handleEntityNotFound(_0x330862,null))['then'](respondWithResult(_0x330862,null))[_0xee1c('0x43')](handleError(_0x330862,null));};exports[_0xee1c('0x44')]=function(_0x12c96b,_0x5b6687){return db[_0xee1c('0x27')][_0xee1c('0x44')](_0x12c96b[_0xee1c('0x45')],{})[_0xee1c('0x20')](respondWithResult(_0x5b6687,0xc9))[_0xee1c('0x43')](handleError(_0x5b6687,null));};exports[_0xee1c('0x46')]=function(_0x5e6918,_0x5f023c){if(_0x5e6918[_0xee1c('0x45')]['id']){delete _0x5e6918[_0xee1c('0x45')]['id'];}return db[_0xee1c('0x27')][_0xee1c('0x42')]({'where':{'id':_0x5e6918['params']['id']}})[_0xee1c('0x20')](handleEntityNotFound(_0x5f023c,null))[_0xee1c('0x20')](saveUpdates(_0x5e6918[_0xee1c('0x45')],null))[_0xee1c('0x20')](respondWithResult(_0x5f023c,null))['catch'](handleError(_0x5f023c,null));};exports[_0xee1c('0x1f')]=function(_0x26c933,_0x1f2c69){return db[_0xee1c('0x27')][_0xee1c('0x42')]({'where':{'id':_0x26c933[_0xee1c('0x47')]['id']}})['then'](handleEntityNotFound(_0x1f2c69,null))[_0xee1c('0x20')](removeEntity(_0x1f2c69,null))[_0xee1c('0x43')](handleError(_0x1f2c69,null));}; \ No newline at end of file +var _0xf29f=['desk.js','papaparse','ioredis','../../components/auth/service','../../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','reject','save','update','then','destroy','error','name','index','map','FreshsalesField','rawAttributes','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','include','findAll','rows','show','params','includeAll','find','catch','create','body','eml-format','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x1997f8,_0x5c55f6){var _0x8303c1=function(_0x1dbea7){while(--_0x1dbea7){_0x1997f8['push'](_0x1997f8['shift']());}};_0x8303c1(++_0x5c55f6);}(_0xf29f,0x165));var _0xff29=function(_0x322c20,_0x20e571){_0x322c20=_0x322c20-0x0;var _0x3da7fc=_0xf29f[_0x322c20];return _0x3da7fc;};'use strict';var emlformat=require(_0xff29('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xff29('0x1'));var rp=require(_0xff29('0x2'));var moment=require(_0xff29('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xff29('0x4'));var util=require(_0xff29('0x5'));var path=require('path');var sox=require(_0xff29('0x6'));var csv=require(_0xff29('0x7'));var ejs=require(_0xff29('0x8'));var fs=require('fs');var fs_extra=require(_0xff29('0x9'));var _=require(_0xff29('0xa'));var squel=require(_0xff29('0xb'));var crypto=require(_0xff29('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xff29('0xd'));var toCsv=require(_0xff29('0x7'));var querystring=require('querystring');var Papa=require(_0xff29('0xe'));var Redis=require(_0xff29('0xf'));var authService=require(_0xff29('0x10'));var qs=require(_0xff29('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xff29('0x12'));var logger=require(_0xff29('0x13'))(_0xff29('0x14'));var utils=require(_0xff29('0x15'));var config=require(_0xff29('0x16'));var licenseUtil=require(_0xff29('0x17'));var db=require(_0xff29('0x18'))['db'];function respondWithStatusCode(_0x12b2eb,_0x42c033){_0x42c033=_0x42c033||0xcc;return function(_0xc636d7){if(_0xc636d7){return _0x12b2eb[_0xff29('0x19')](_0x42c033);}return _0x12b2eb[_0xff29('0x1a')](_0x42c033)['end']();};}function respondWithResult(_0x116323,_0x1861d7){_0x1861d7=_0x1861d7||0xc8;return function(_0x1604b1){if(_0x1604b1){return _0x116323['status'](_0x1861d7)['json'](_0x1604b1);}};}function respondWithFilteredResult(_0x9772f9,_0x3fdc25){return function(_0x11f8de){if(_0x11f8de){var _0x1483b0=typeof _0x3fdc25[_0xff29('0x1b')]===_0xff29('0x1c')&&typeof _0x3fdc25['limit']===_0xff29('0x1c');var _0xd55239=_0x11f8de[_0xff29('0x1d')];var _0x557cf1=_0x1483b0?0x0:_0x3fdc25[_0xff29('0x1b')];var _0x16409f=_0x1483b0?_0x11f8de[_0xff29('0x1d')]:_0x3fdc25['offset']+_0x3fdc25[_0xff29('0x1e')];var _0x92e6e9;if(_0x16409f>=_0xd55239){_0x16409f=_0xd55239;_0x92e6e9=0xc8;}else{_0x92e6e9=0xce;}_0x9772f9[_0xff29('0x1a')](_0x92e6e9);return _0x9772f9[_0xff29('0x1f')](_0xff29('0x20'),_0x557cf1+'-'+_0x16409f+'/'+_0xd55239)[_0xff29('0x21')](_0x11f8de);}return null;};}function patchUpdates(_0x4c4e9f){return function(_0x2914a1){try{jsonpatch['apply'](_0x2914a1,_0x4c4e9f,!![]);}catch(_0x1f297b){return BPromise[_0xff29('0x22')](_0x1f297b);}return _0x2914a1[_0xff29('0x23')]();};}function saveUpdates(_0x2c679f,_0x4c7177){return function(_0x1e2c40){if(_0x1e2c40){return _0x1e2c40[_0xff29('0x24')](_0x2c679f)[_0xff29('0x25')](function(_0x27e334){return _0x27e334;});}return null;};}function removeEntity(_0x27447d,_0x4505f1){return function(_0x419282){if(_0x419282){return _0x419282[_0xff29('0x26')]()[_0xff29('0x25')](function(){_0x27447d[_0xff29('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x219f1d,_0x1c2ae9){return function(_0x52db92){if(!_0x52db92){_0x219f1d['sendStatus'](0x194);}return _0x52db92;};}function handleError(_0x740a2b,_0x4ea399){_0x4ea399=_0x4ea399||0x1f4;return function(_0x592156){logger[_0xff29('0x27')](_0x592156['stack']);if(_0x592156[_0xff29('0x28')]){delete _0x592156[_0xff29('0x28')];}_0x740a2b[_0xff29('0x1a')](_0x4ea399)['send'](_0x592156);};}exports[_0xff29('0x29')]=function(_0x331b3d,_0xe1a0ce){var _0x43a1e7={},_0x5d0fda={},_0x4823ab={'count':0x0,'rows':[]};var _0x1eaf06=_[_0xff29('0x2a')](db[_0xff29('0x2b')][_0xff29('0x2c')],function(_0x50b7c4){return{'name':_0x50b7c4['fieldName'],'type':_0x50b7c4['type'][_0xff29('0x2d')]};});_0x5d0fda['model']=_[_0xff29('0x2a')](_0x1eaf06,'name');_0x5d0fda[_0xff29('0x2e')]=_[_0xff29('0x2f')](_0x331b3d[_0xff29('0x2e')]);_0x5d0fda[_0xff29('0x30')]=_[_0xff29('0x31')](_0x5d0fda[_0xff29('0x32')],_0x5d0fda[_0xff29('0x2e')]);_0x43a1e7['attributes']=_[_0xff29('0x31')](_0x5d0fda[_0xff29('0x32')],qs[_0xff29('0x33')](_0x331b3d[_0xff29('0x2e')]['fields']));_0x43a1e7[_0xff29('0x34')]=_0x43a1e7['attributes'][_0xff29('0x35')]?_0x43a1e7['attributes']:_0x5d0fda[_0xff29('0x32')];if(!_0x331b3d['query'][_0xff29('0x36')](_0xff29('0x37'))){_0x43a1e7[_0xff29('0x1e')]=qs[_0xff29('0x1e')](_0x331b3d[_0xff29('0x2e')][_0xff29('0x1e')]);_0x43a1e7[_0xff29('0x1b')]=qs[_0xff29('0x1b')](_0x331b3d['query'][_0xff29('0x1b')]);}_0x43a1e7[_0xff29('0x38')]=qs[_0xff29('0x39')](_0x331b3d[_0xff29('0x2e')][_0xff29('0x39')]);_0x43a1e7[_0xff29('0x3a')]=qs[_0xff29('0x30')](_['pick'](_0x331b3d[_0xff29('0x2e')],_0x5d0fda[_0xff29('0x30')]),_0x1eaf06);if(_0x331b3d['query'][_0xff29('0x3b')]){_0x43a1e7[_0xff29('0x3a')]=_[_0xff29('0x3c')](_0x43a1e7['where'],{'$or':_[_0xff29('0x2a')](_0x1eaf06,function(_0xd4cfc0){if(_0xd4cfc0[_0xff29('0x3d')]!==_0xff29('0x3e')){var _0xd81e87={};_0xd81e87[_0xd4cfc0[_0xff29('0x28')]]={'$like':'%'+_0x331b3d[_0xff29('0x2e')][_0xff29('0x3b')]+'%'};return _0xd81e87;}})});}_0x43a1e7=_[_0xff29('0x3c')]({},_0x43a1e7,_0x331b3d[_0xff29('0x3f')]);var _0x59d412={'where':_0x43a1e7[_0xff29('0x3a')]};return db[_0xff29('0x2b')]['count'](_0x59d412)['then'](function(_0x23cbed){_0x4823ab[_0xff29('0x1d')]=_0x23cbed;if(_0x331b3d[_0xff29('0x2e')]['includeAll']){_0x43a1e7[_0xff29('0x40')]=[{'all':!![]}];}return db['FreshsalesField'][_0xff29('0x41')](_0x43a1e7);})['then'](function(_0x1cfbb3){_0x4823ab[_0xff29('0x42')]=_0x1cfbb3;return _0x4823ab;})[_0xff29('0x25')](respondWithFilteredResult(_0xe1a0ce,_0x43a1e7))['catch'](handleError(_0xe1a0ce,null));};exports[_0xff29('0x43')]=function(_0x89861c,_0x13c787){var _0x41afed={'raw':!![],'where':{'id':_0x89861c[_0xff29('0x44')]['id']}},_0xc7501b={};_0xc7501b[_0xff29('0x32')]=_[_0xff29('0x2f')](db[_0xff29('0x2b')][_0xff29('0x2c')]);_0xc7501b[_0xff29('0x2e')]=_[_0xff29('0x2f')](_0x89861c[_0xff29('0x2e')]);_0xc7501b[_0xff29('0x30')]=_['intersection'](_0xc7501b[_0xff29('0x32')],_0xc7501b[_0xff29('0x2e')]);_0x41afed['attributes']=_['intersection'](_0xc7501b[_0xff29('0x32')],qs[_0xff29('0x33')](_0x89861c['query']['fields']));_0x41afed['attributes']=_0x41afed[_0xff29('0x34')][_0xff29('0x35')]?_0x41afed['attributes']:_0xc7501b[_0xff29('0x32')];if(_0x89861c[_0xff29('0x2e')][_0xff29('0x45')]){_0x41afed[_0xff29('0x40')]=[{'all':!![]}];}_0x41afed=_[_0xff29('0x3c')]({},_0x41afed,_0x89861c[_0xff29('0x3f')]);return db[_0xff29('0x2b')][_0xff29('0x46')](_0x41afed)['then'](handleEntityNotFound(_0x13c787,null))['then'](respondWithResult(_0x13c787,null))[_0xff29('0x47')](handleError(_0x13c787,null));};exports[_0xff29('0x48')]=function(_0x6837d5,_0x290bf2){return db['FreshsalesField'][_0xff29('0x48')](_0x6837d5[_0xff29('0x49')],{})['then'](respondWithResult(_0x290bf2,0xc9))['catch'](handleError(_0x290bf2,null));};exports[_0xff29('0x24')]=function(_0x3acd8e,_0xfb8e78){if(_0x3acd8e[_0xff29('0x49')]['id']){delete _0x3acd8e[_0xff29('0x49')]['id'];}return db[_0xff29('0x2b')][_0xff29('0x46')]({'where':{'id':_0x3acd8e[_0xff29('0x44')]['id']}})[_0xff29('0x25')](handleEntityNotFound(_0xfb8e78,null))['then'](saveUpdates(_0x3acd8e[_0xff29('0x49')],null))[_0xff29('0x25')](respondWithResult(_0xfb8e78,null))[_0xff29('0x47')](handleError(_0xfb8e78,null));};exports[_0xff29('0x26')]=function(_0x33ee96,_0x353cfc){return db[_0xff29('0x2b')][_0xff29('0x46')]({'where':{'id':_0x33ee96[_0xff29('0x44')]['id']}})['then'](handleEntityNotFound(_0x353cfc,null))[_0xff29('0x25')](removeEntity(_0x353cfc,null))[_0xff29('0x47')](handleError(_0x353cfc,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index ca70080..fd2217b 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 _0x0f42=['api','bluebird','path','../../config/environment','./intFreshsalesField.attributes','exports','define','int_freshsales_fields','lodash','util','../../config/logger'];(function(_0x121d21,_0x3d5dca){var _0xd80c4e=function(_0x33e61a){while(--_0x33e61a){_0x121d21['push'](_0x121d21['shift']());}};_0xd80c4e(++_0x3d5dca);}(_0x0f42,0x126));var _0x20f4=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x0f42[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x20f4('0x0'));var util=require(_0x20f4('0x1'));var logger=require(_0x20f4('0x2'))(_0x20f4('0x3'));var moment=require('moment');var BPromise=require(_0x20f4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x20f4('0x5'));var rimraf=require('rimraf');var config=require(_0x20f4('0x6'));var attributes=require(_0x20f4('0x7'));module[_0x20f4('0x8')]=function(_0x4c3214,_0x435359){return _0x4c3214[_0x20f4('0x9')]('FreshsalesField',attributes,{'tableName':_0x20f4('0xa'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa1cc=['request-promise','rimraf','./intFreshsalesField.attributes','exports','int_freshsales_fields','freshsales_unique_index','idField','lodash','util','../../config/logger','moment','bluebird'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0xa1cc,0x10f));var _0xca1c=function(_0x3d5504,_0x27d5cb){_0x3d5504=_0x3d5504-0x0;var _0x1d2e6f=_0xa1cc[_0x3d5504];return _0x1d2e6f;};'use strict';var _=require(_0xca1c('0x0'));var util=require(_0xca1c('0x1'));var logger=require(_0xca1c('0x2'))('api');var moment=require(_0xca1c('0x3'));var BPromise=require(_0xca1c('0x4'));var rp=require(_0xca1c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xca1c('0x6'));var config=require('../../config/environment');var attributes=require(_0xca1c('0x7'));module[_0xca1c('0x8')]=function(_0x375837,_0x98dd5f){return _0x375837['define']('FreshsalesField',attributes,{'tableName':_0xca1c('0x9'),'paranoid':![],'indexes':[{'name':_0xca1c('0xa'),'fields':[_0xca1c('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 0a69b6d..86aa6b7 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 _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','FreshsalesField,\x20%s,\x20%s','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x462999,_0x24d200){var _0x4b1366=function(_0x1fa353){while(--_0x1fa353){_0x462999['push'](_0x462999['shift']());}};_0x4b1366(++_0x24d200);}(_0x2ef3,0xba));var _0x32ef=function(_0x256b5c,_0x466913){_0x256b5c=_0x256b5c-0x0;var _0x5b942f=_0x2ef3[_0x256b5c];return _0x5b942f;};'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')]('FreshsalesField,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('FreshsalesField,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file +var _0xb4c7=['client','http','request','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1c7d7a,_0x1e4e95){var _0xd01b50=function(_0x22f3ad){while(--_0x22f3ad){_0x1c7d7a['push'](_0x1c7d7a['shift']());}};_0xd01b50(++_0x1e4e95);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x1d8b26,_0x5d63b8){_0x1d8b26=_0x1d8b26-0x0;var _0x1d325c=_0xb4c7[_0x1d8b26];return _0x1d325c;};'use strict';var _=require(_0x7b4c('0x0'));var util=require(_0x7b4c('0x1'));var moment=require(_0x7b4c('0x2'));var BPromise=require(_0x7b4c('0x3'));var rs=require(_0x7b4c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b4c('0x5'))['db'];var utils=require(_0x7b4c('0x6'));var logger=require(_0x7b4c('0x7'))(_0x7b4c('0x8'));var config=require(_0x7b4c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7b4c('0xa')][_0x7b4c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2dd5c7,_0x4bf85d,_0x2d7b7e){return new BPromise(function(_0x21687f,_0x570daa){return client[_0x7b4c('0xc')](_0x2dd5c7,_0x2d7b7e)[_0x7b4c('0xd')](function(_0x28e902){logger[_0x7b4c('0xe')](_0x7b4c('0xf'),_0x4bf85d,_0x7b4c('0x10'));logger[_0x7b4c('0x11')](_0x7b4c('0x12'),_0x4bf85d,_0x7b4c('0x10'),JSON[_0x7b4c('0x13')](_0x28e902));if(_0x28e902['error']){if(_0x28e902['error'][_0x7b4c('0x14')]===0x1f4){logger[_0x7b4c('0x15')](_0x7b4c('0xf'),_0x4bf85d,_0x28e902[_0x7b4c('0x15')][_0x7b4c('0x16')]);return _0x570daa(_0x28e902[_0x7b4c('0x15')][_0x7b4c('0x16')]);}logger[_0x7b4c('0x15')](_0x7b4c('0xf'),_0x4bf85d,_0x28e902[_0x7b4c('0x15')]['message']);return _0x21687f(_0x28e902[_0x7b4c('0x15')][_0x7b4c('0x16')]);}else{logger[_0x7b4c('0xe')](_0x7b4c('0xf'),_0x4bf85d,_0x7b4c('0x10'));_0x21687f(_0x28e902[_0x7b4c('0x17')][_0x7b4c('0x16')]);}})[_0x7b4c('0x18')](function(_0x4d3f5e){logger[_0x7b4c('0x15')](_0x7b4c('0xf'),_0x4bf85d,_0x4d3f5e);_0x570daa(_0x4d3f5e);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index d7baa49..90b4dff 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(_0x5e2555,_0x482726){var _0x570dbd=function(_0x577496){while(--_0x577496){_0x5e2555['push'](_0x5e2555['shift']());}};_0x570dbd(++_0x482726);}(_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'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x169692,_0x127dc9){var _0x277616=function(_0xd2489e){while(--_0xd2489e){_0x169692['push'](_0x169692['shift']());}};_0x277616(++_0x127dc9);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index e9ff3b0..7cb18a3 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 _0x8a2a=['STRING','username','ENUM','integrationTab','newTab','exports'];(function(_0x125458,_0x1fadb4){var _0x4e1b85=function(_0xff8422){while(--_0xff8422){_0x125458['push'](_0x125458['shift']());}};_0x4e1b85(++_0x1fadb4);}(_0x8a2a,0x11f));var _0xa8a2=function(_0x1bf809,_0x536f55){_0x1bf809=_0x1bf809-0x0;var _0x1caa4e=_0x8a2a[_0x1bf809];return _0x1caa4e;};'use strict';var Sequelize=require('sequelize');module[_0xa8a2('0x0')]={'name':{'type':Sequelize[_0xa8a2('0x1')]},'description':{'type':Sequelize[_0xa8a2('0x1')]},'username':{'type':Sequelize[_0xa8a2('0x1')],'unique':_0xa8a2('0x2')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xa8a2('0x1')]},'clientId':{'type':Sequelize[_0xa8a2('0x1')]},'clientSecret':{'type':Sequelize[_0xa8a2('0x1')]},'securityToken':{'type':Sequelize[_0xa8a2('0x1')]},'serverUrl':{'type':Sequelize[_0xa8a2('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xa8a2('0x3')](_0xa8a2('0x4'),_0xa8a2('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x3f35=['ENUM','integrationTab','newTab','sequelize','exports','STRING','username'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x3f35,0x1ae));var _0x53f3=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x3f35[_0x3ab9ee];return _0x82ee88;};'use strict';var Sequelize=require(_0x53f3('0x0'));module[_0x53f3('0x1')]={'name':{'type':Sequelize[_0x53f3('0x2')]},'description':{'type':Sequelize[_0x53f3('0x2')]},'username':{'type':Sequelize[_0x53f3('0x2')],'unique':_0x53f3('0x3')},'remoteUri':{'type':Sequelize[_0x53f3('0x2')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x53f3('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x53f3('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x53f3('0x4')](_0x53f3('0x5'),_0x53f3('0x6')),'defaultValue':_0x53f3('0x5')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index a13ee8c..c412113 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 _0xabd8=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','name','send','map','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','SalesforceAccount','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','getConfigurations','SalesforceConfiguration','pick','options','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','clientId','clientSecret','username','securityToken','remoteUri','slice','substring','Connection','password','concat','ticketType','sobject','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','int','picklist','boolean','email','textarea','phone','remove','includes','label','custom','picklistValues','value','True','true','False','test','statusCode','stringify','rimraf','zip-dir','request-promise','mustache','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','../../config/utils'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xabd8,0xe0));var _0x8abd=function(_0xdc37a1,_0x53ebb9){_0xdc37a1=_0xdc37a1-0x0;var _0x99b4fe=_0xabd8[_0xdc37a1];return _0x99b4fe;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8abd('0x0'));var zipdir=require(_0x8abd('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8abd('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8abd('0x3'));var util=require('util');var path=require('path');var sox=require(_0x8abd('0x4'));var csv=require(_0x8abd('0x5'));var ejs=require(_0x8abd('0x6'));var fs=require('fs');var fs_extra=require(_0x8abd('0x7'));var _=require('lodash');var squel=require(_0x8abd('0x8'));var crypto=require(_0x8abd('0x9'));var jsforce=require(_0x8abd('0xa'));var deskjs=require(_0x8abd('0xb'));var toCsv=require(_0x8abd('0x5'));var querystring=require(_0x8abd('0xc'));var Papa=require(_0x8abd('0xd'));var Redis=require(_0x8abd('0xe'));var authService=require(_0x8abd('0xf'));var qs=require(_0x8abd('0x10'));var as=require(_0x8abd('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8abd('0x12'))('api');var utils=require(_0x8abd('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x8abd('0x14'));var db=require(_0x8abd('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2744e3,_0x45e6c3){_0x45e6c3=_0x45e6c3||0xcc;return function(_0x1395f0){if(_0x1395f0){return _0x2744e3[_0x8abd('0x16')](_0x45e6c3);}return _0x2744e3[_0x8abd('0x17')](_0x45e6c3)[_0x8abd('0x18')]();};}function respondWithResult(_0x217906,_0x2206b6){_0x2206b6=_0x2206b6||0xc8;return function(_0x180d49){if(_0x180d49){return _0x217906[_0x8abd('0x17')](_0x2206b6)[_0x8abd('0x19')](_0x180d49);}};}function respondWithFilteredResult(_0x25e7b6,_0x5a0c64){return function(_0x126032){if(_0x126032){var _0xe1ab96=typeof _0x5a0c64[_0x8abd('0x1a')]===_0x8abd('0x1b')&&typeof _0x5a0c64[_0x8abd('0x1c')]===_0x8abd('0x1b');var _0xae71c1=_0x126032[_0x8abd('0x1d')];var _0x324db5=_0xe1ab96?0x0:_0x5a0c64['offset'];var _0x5f0d19=_0xe1ab96?_0x126032[_0x8abd('0x1d')]:_0x5a0c64[_0x8abd('0x1a')]+_0x5a0c64[_0x8abd('0x1c')];var _0x2de279;if(_0x5f0d19>=_0xae71c1){_0x5f0d19=_0xae71c1;_0x2de279=0xc8;}else{_0x2de279=0xce;}_0x25e7b6[_0x8abd('0x17')](_0x2de279);return _0x25e7b6[_0x8abd('0x1e')](_0x8abd('0x1f'),_0x324db5+'-'+_0x5f0d19+'/'+_0xae71c1)[_0x8abd('0x19')](_0x126032);}return null;};}function patchUpdates(_0x4e3316){return function(_0xd326fd){try{jsonpatch[_0x8abd('0x20')](_0xd326fd,_0x4e3316,!![]);}catch(_0x466dd7){return BPromise[_0x8abd('0x21')](_0x466dd7);}return _0xd326fd['save']();};}function saveUpdates(_0x588934,_0x3bc444){return function(_0x4da56e){if(_0x4da56e){return _0x4da56e[_0x8abd('0x22')](_0x588934)[_0x8abd('0x23')](function(_0x4324af){return _0x4324af;});}return null;};}function removeEntity(_0x344ecf,_0x370b88){return function(_0x25ce4f){if(_0x25ce4f){return _0x25ce4f['destroy']()[_0x8abd('0x23')](function(){_0x344ecf[_0x8abd('0x17')](0xcc)[_0x8abd('0x18')]();});}};}function handleEntityNotFound(_0x357f76,_0x20a4f2){return function(_0x2786d9){if(!_0x2786d9){_0x357f76[_0x8abd('0x16')](0x194);}return _0x2786d9;};}function handleError(_0x3af21a,_0x500b44){_0x500b44=_0x500b44||0x1f4;return function(_0x279ff6){logger['error'](_0x279ff6['stack']);if(_0x279ff6[_0x8abd('0x24')]){delete _0x279ff6[_0x8abd('0x24')];}_0x3af21a[_0x8abd('0x17')](_0x500b44)[_0x8abd('0x25')](_0x279ff6);};}exports['index']=function(_0x3a5bc7,_0x4c7c6){var _0x4cd44f={},_0x59a380={},_0x44d346={'count':0x0,'rows':[]};var _0x4a3caa=_[_0x8abd('0x26')](db['SalesforceAccount'][_0x8abd('0x27')],function(_0x1c8eef){return{'name':_0x1c8eef['fieldName'],'type':_0x1c8eef[_0x8abd('0x28')][_0x8abd('0x29')]};});_0x59a380[_0x8abd('0x2a')]=_[_0x8abd('0x26')](_0x4a3caa,_0x8abd('0x24'));_0x59a380[_0x8abd('0x2b')]=_[_0x8abd('0x2c')](_0x3a5bc7['query']);_0x59a380['filters']=_[_0x8abd('0x2d')](_0x59a380['model'],_0x59a380[_0x8abd('0x2b')]);_0x4cd44f['attributes']=_['intersection'](_0x59a380['model'],qs[_0x8abd('0x2e')](_0x3a5bc7['query'][_0x8abd('0x2e')]));_0x4cd44f['attributes']=_0x4cd44f[_0x8abd('0x2f')][_0x8abd('0x30')]?_0x4cd44f[_0x8abd('0x2f')]:_0x59a380[_0x8abd('0x2a')];if(!_0x3a5bc7[_0x8abd('0x2b')][_0x8abd('0x31')](_0x8abd('0x32'))){_0x4cd44f[_0x8abd('0x1c')]=qs['limit'](_0x3a5bc7[_0x8abd('0x2b')]['limit']);_0x4cd44f['offset']=qs[_0x8abd('0x1a')](_0x3a5bc7[_0x8abd('0x2b')][_0x8abd('0x1a')]);}_0x4cd44f[_0x8abd('0x33')]=qs[_0x8abd('0x34')](_0x3a5bc7['query']['sort']);_0x4cd44f[_0x8abd('0x35')]=qs[_0x8abd('0x36')](_['pick'](_0x3a5bc7[_0x8abd('0x2b')],_0x59a380[_0x8abd('0x36')]),_0x4a3caa);if(_0x3a5bc7[_0x8abd('0x2b')][_0x8abd('0x37')]){_0x4cd44f['where']=_[_0x8abd('0x38')](_0x4cd44f[_0x8abd('0x35')],{'$or':_[_0x8abd('0x26')](_0x4a3caa,function(_0x4722bb){if(_0x4722bb[_0x8abd('0x28')]!==_0x8abd('0x39')){var _0x2496f3={};_0x2496f3[_0x4722bb['name']]={'$like':'%'+_0x3a5bc7[_0x8abd('0x2b')]['filter']+'%'};return _0x2496f3;}})});}_0x4cd44f=_[_0x8abd('0x38')]({},_0x4cd44f,_0x3a5bc7['options']);var _0xd91d3c={'where':_0x4cd44f[_0x8abd('0x35')]};return db[_0x8abd('0x3a')][_0x8abd('0x1d')](_0xd91d3c)['then'](function(_0x7e369f){_0x44d346[_0x8abd('0x1d')]=_0x7e369f;if(_0x3a5bc7['query'][_0x8abd('0x3b')]){_0x4cd44f[_0x8abd('0x3c')]=[{'all':!![]}];}return db[_0x8abd('0x3a')][_0x8abd('0x3d')](_0x4cd44f);})[_0x8abd('0x23')](function(_0x57a3b9){_0x44d346[_0x8abd('0x3e')]=_0x57a3b9;return _0x44d346;})[_0x8abd('0x23')](respondWithFilteredResult(_0x4c7c6,_0x4cd44f))[_0x8abd('0x3f')](handleError(_0x4c7c6,null));};exports[_0x8abd('0x40')]=function(_0x3aae29,_0x32e223){var _0x15ea14={'raw':![],'where':{'id':_0x3aae29[_0x8abd('0x41')]['id']}},_0x5b7c03={};_0x5b7c03[_0x8abd('0x2a')]=_[_0x8abd('0x2c')](db[_0x8abd('0x3a')][_0x8abd('0x27')]);_0x5b7c03[_0x8abd('0x2b')]=_['keys'](_0x3aae29[_0x8abd('0x2b')]);_0x5b7c03[_0x8abd('0x36')]=_[_0x8abd('0x2d')](_0x5b7c03[_0x8abd('0x2a')],_0x5b7c03[_0x8abd('0x2b')]);_0x15ea14['attributes']=_[_0x8abd('0x2d')](_0x5b7c03[_0x8abd('0x2a')],qs[_0x8abd('0x2e')](_0x3aae29[_0x8abd('0x2b')][_0x8abd('0x2e')]));_0x15ea14[_0x8abd('0x2f')]=_0x15ea14[_0x8abd('0x2f')]['length']?_0x15ea14[_0x8abd('0x2f')]:_0x5b7c03[_0x8abd('0x2a')];if(_0x3aae29[_0x8abd('0x2b')][_0x8abd('0x3b')]){_0x15ea14[_0x8abd('0x3c')]=[{'all':!![]}];}_0x15ea14=_['merge']({},_0x15ea14,_0x3aae29['options']);return db['SalesforceAccount'][_0x8abd('0x42')](_0x15ea14)['then'](handleEntityNotFound(_0x32e223,null))['then'](respondWithResult(_0x32e223,null))[_0x8abd('0x3f')](handleError(_0x32e223,null));};exports[_0x8abd('0x43')]=function(_0x3a7f6d,_0x48c593){return db[_0x8abd('0x3a')][_0x8abd('0x43')](_0x3a7f6d['body'],{})[_0x8abd('0x23')](respondWithResult(_0x48c593,0xc9))[_0x8abd('0x3f')](handleError(_0x48c593,null));};exports[_0x8abd('0x22')]=function(_0x3930be,_0x34d655){if(_0x3930be[_0x8abd('0x44')]['id']){delete _0x3930be[_0x8abd('0x44')]['id'];}return db[_0x8abd('0x3a')][_0x8abd('0x42')]({'where':{'id':_0x3930be[_0x8abd('0x41')]['id']}})['then'](handleEntityNotFound(_0x34d655,null))['then'](saveUpdates(_0x3930be['body'],null))['then'](respondWithResult(_0x34d655,null))[_0x8abd('0x3f')](handleError(_0x34d655,null));};exports[_0x8abd('0x45')]=function(_0x224a19,_0x476c06){return db[_0x8abd('0x3a')][_0x8abd('0x42')]({'where':{'id':_0x224a19[_0x8abd('0x41')]['id']}})[_0x8abd('0x23')](handleEntityNotFound(_0x476c06,null))[_0x8abd('0x23')](removeEntity(_0x476c06,null))[_0x8abd('0x3f')](handleError(_0x476c06,null));};exports[_0x8abd('0x46')]=function(_0x48f190,_0x5abeb7,_0x262c3c){var _0x46855c={};var _0x59ec6a={};var _0x20b372;var _0x160d5f;return db[_0x8abd('0x3a')]['findOne']({'where':{'id':_0x48f190[_0x8abd('0x41')]['id']}})['then'](handleEntityNotFound(_0x5abeb7,null))[_0x8abd('0x23')](function(_0xcb18db){if(_0xcb18db){_0x20b372=_0xcb18db;_0x59ec6a['model']=_[_0x8abd('0x2c')](db[_0x8abd('0x47')][_0x8abd('0x27')]);_0x59ec6a[_0x8abd('0x2b')]=_[_0x8abd('0x2c')](_0x48f190['query']);_0x59ec6a[_0x8abd('0x36')]=_[_0x8abd('0x2d')](_0x59ec6a[_0x8abd('0x2a')],_0x59ec6a[_0x8abd('0x2b')]);_0x46855c[_0x8abd('0x2f')]=_[_0x8abd('0x2d')](_0x59ec6a[_0x8abd('0x2a')],qs['fields'](_0x48f190[_0x8abd('0x2b')][_0x8abd('0x2e')]));_0x46855c['attributes']=_0x46855c[_0x8abd('0x2f')][_0x8abd('0x30')]?_0x46855c[_0x8abd('0x2f')]:_0x59ec6a[_0x8abd('0x2a')];_0x46855c[_0x8abd('0x33')]=qs[_0x8abd('0x34')](_0x48f190[_0x8abd('0x2b')][_0x8abd('0x34')]);_0x46855c['where']=qs[_0x8abd('0x36')](_[_0x8abd('0x48')](_0x48f190[_0x8abd('0x2b')],_0x59ec6a[_0x8abd('0x36')]));if(_0x48f190[_0x8abd('0x2b')]['filter']){_0x46855c['where']=_[_0x8abd('0x38')](_0x46855c[_0x8abd('0x35')],{'$or':_[_0x8abd('0x26')](_0x46855c[_0x8abd('0x2f')],function(_0x23da28){var _0x1afd33={};_0x1afd33[_0x23da28]={'$like':'%'+_0x48f190[_0x8abd('0x2b')][_0x8abd('0x37')]+'%'};return _0x1afd33;})});}_0x46855c=_[_0x8abd('0x38')]({},_0x46855c,_0x48f190[_0x8abd('0x49')]);return _0x20b372[_0x8abd('0x46')](_0x46855c);}})[_0x8abd('0x23')](function(_0x28987e){if(_0x28987e){_0x160d5f=_0x28987e[_0x8abd('0x30')];if(!_0x48f190['query'][_0x8abd('0x31')](_0x8abd('0x32'))){_0x46855c['limit']=qs[_0x8abd('0x1c')](_0x48f190[_0x8abd('0x2b')][_0x8abd('0x1c')]);_0x46855c['offset']=qs[_0x8abd('0x1a')](_0x48f190[_0x8abd('0x2b')][_0x8abd('0x1a')]);}return _0x20b372[_0x8abd('0x46')](_0x46855c);}})[_0x8abd('0x23')](function(_0x197006){if(_0x197006){return _0x197006?{'count':_0x160d5f,'rows':_0x197006}:null;}})[_0x8abd('0x23')](respondWithResult(_0x5abeb7,null))['catch'](handleError(_0x5abeb7,null));};exports[_0x8abd('0x4a')]=function(_0x1230d1,_0x5b8620,_0x139a57){if(_0x1230d1['body']['id']){delete _0x1230d1[_0x8abd('0x44')]['id'];}return db[_0x8abd('0x3a')][_0x8abd('0x4b')]({'where':{'id':_0x1230d1[_0x8abd('0x41')]['id']}})[_0x8abd('0x23')](handleEntityNotFound(_0x5b8620,null))[_0x8abd('0x23')](function(_0x429422){if(_0x429422){_0x1230d1[_0x8abd('0x44')][_0x8abd('0x4c')]=_0x429422['id'];_0x1230d1['body'][_0x8abd('0x4d')]=integrations[_0x8abd('0x4e')](_0x1230d1[_0x8abd('0x44')][_0x8abd('0x4f')],_0x1230d1[_0x8abd('0x44')][_0x8abd('0x28')]);_0x1230d1[_0x8abd('0x44')][_0x8abd('0x50')]=integrations[_0x8abd('0x51')](_0x1230d1[_0x8abd('0x44')][_0x8abd('0x4f')],_0x1230d1[_0x8abd('0x44')][_0x8abd('0x28')]);return db['SalesforceConfiguration'][_0x8abd('0x43')](_0x1230d1[_0x8abd('0x44')],{'include':[{'model':db[_0x8abd('0x52')],'as':'Subjects'},{'model':db['SalesforceField'],'as':_0x8abd('0x50')}]});}return null;})[_0x8abd('0x23')](respondWithResult(_0x5b8620,null))[_0x8abd('0x3f')](handleError(_0x5b8620,null));};exports[_0x8abd('0x53')]=function(_0x5e025b,_0x2db566,_0x4ec24b){var _0x327a17;var _0xd21a0b='';var _0x507ee9=_0x8abd('0x54');return db[_0x8abd('0x3a')][_0x8abd('0x4b')]({'where':{'id':_0x5e025b['params']['id']},'attributes':['id','remoteUri',_0x8abd('0x55'),_0x8abd('0x56'),_0x8abd('0x57'),'password',_0x8abd('0x58')]})[_0x8abd('0x23')](handleEntityNotFound(_0x2db566,null))[_0x8abd('0x23')](function(_0x30008a){if(_0x30008a){_0xd21a0b=_0x30008a[_0x8abd('0x59')];var _0x4a0ba3=_0xd21a0b[_0x8abd('0x5a')](-0x1);if(_0x4a0ba3==='/'){_0xd21a0b=_0xd21a0b[_0x8abd('0x5b')](0x0,_0xd21a0b['lastIndexOf'](_0x4a0ba3));}_0x327a17=new jsforce[(_0x8abd('0x5c'))]({'oauth2':{'loginUrl':_0xd21a0b,'clientId':_0x30008a[_0x8abd('0x55')],'clientSecret':_0x30008a[_0x8abd('0x56')]}});return _0x327a17['login'](_0x30008a[_0x8abd('0x57')],_0x30008a[_0x8abd('0x5d')][_0x8abd('0x5e')](_0x30008a[_0x8abd('0x58')]));}})[_0x8abd('0x23')](function(_0x29c48f){if(_0x29c48f){if(!_['isNil'](_0x5e025b[_0x8abd('0x2b')][_0x8abd('0x5f')])){_0x507ee9=_0x5e025b[_0x8abd('0x2b')][_0x8abd('0x5f')];}return _0x327a17[_0x8abd('0x60')](_0x507ee9)['describe']();}})[_0x8abd('0x23')](function(_0x19d57c){var _0x200158=[_0x8abd('0x61'),_0x8abd('0x62'),_0x8abd('0x63'),_0x8abd('0x64'),_0x8abd('0x65'),_0x8abd('0x66')];var _0x216233=[_0x8abd('0x67'),_0x8abd('0x68'),_0x8abd('0x69'),_0x8abd('0x6a'),_0x8abd('0x6b'),_0x8abd('0x6c'),_0x8abd('0x6d')];if(_0x19d57c){_[_0x8abd('0x6e')](_0x19d57c[_0x8abd('0x2e')],function(_0xdb8a6b){return _0x200158[_0x8abd('0x6f')](_0xdb8a6b['name'])||!_0x216233[_0x8abd('0x6f')](_0xdb8a6b[_0x8abd('0x28')]);});return{'count':_0x19d57c['fields']['length'],'rows':_[_0x8abd('0x26')](_0x19d57c[_0x8abd('0x2e')],function(_0x446d4d){return{'id':_0x446d4d[_0x8abd('0x24')],'name':_0x446d4d[_0x8abd('0x70')],'custom':_0x446d4d[_0x8abd('0x71')],'options':_0x446d4d[_0x8abd('0x72')][_0x8abd('0x30')]>0x0?_[_0x8abd('0x26')](_0x446d4d[_0x8abd('0x72')],function(_0x13d547){return{'name':_0x13d547[_0x8abd('0x70')],'value':_0x13d547[_0x8abd('0x73')]};}):_0x446d4d[_0x8abd('0x28')]=='boolean'?[{'name':_0x8abd('0x74'),'value':_0x8abd('0x75')},{'name':_0x8abd('0x76'),'value':'false'}]:[]};})};}})['then'](respondWithResult(_0x2db566,null))[_0x8abd('0x3f')](function(_0x51cc1a){var _0x4efa92=_0x5e025b[_0x8abd('0x2b')][_0x8abd('0x77')]?0x1f4:_0x51cc1a[_0x8abd('0x78')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x4efa92,JSON[_0x8abd('0x79')](_0x51cc1a));delete _0x51cc1a[_0x8abd('0x24')];if(_0x4efa92===0x191){_0x4efa92=0x190;}_0x2db566[_0x8abd('0x17')](_0x4efa92)[_0x8abd('0x25')](_0x5e025b[_0x8abd('0x2b')][_0x8abd('0x77')]?{'message':'Wrong\x20credentials','statusCode':_0x51cc1a[_0x8abd('0x78')]}:_0x51cc1a);});}; \ No newline at end of file +var _0xc249=['options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','params','destroy','findOne','SalesforceConfiguration','length','getConfigurations','addConfiguration','Subjects','getSubjects','channel','getDescriptions','SalesforceField','Descriptions','Task','remoteUri','clientId','clientSecret','password','lastIndexOf','Connection','username','concat','securityToken','isNil','sobject','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','string','int','picklist','boolean','email','textarea','phone','remove','includes','label','custom','picklistValues','value','True','False','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','getFields','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','ejs','fs-extra','squel','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','apply','reject','save','update','then','stack','name','map','SalesforceAccount','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x493696,_0x1c1d41){var _0x3c4e2a=function(_0x2e7e4e){while(--_0x2e7e4e){_0x493696['push'](_0x493696['shift']());}};_0x3c4e2a(++_0x1c1d41);}(_0xc249,0xb8));var _0x9c24=function(_0x5cb4ce,_0x14635a){_0x5cb4ce=_0x5cb4ce-0x0;var _0x4b626f=_0xc249[_0x5cb4ce];return _0x4b626f;};'use strict';var emlformat=require(_0x9c24('0x0'));var rimraf=require(_0x9c24('0x1'));var zipdir=require(_0x9c24('0x2'));var jsonpatch=require(_0x9c24('0x3'));var rp=require(_0x9c24('0x4'));var moment=require(_0x9c24('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x9c24('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9c24('0x7'));var fs=require('fs');var fs_extra=require(_0x9c24('0x8'));var _=require('lodash');var squel=require(_0x9c24('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9c24('0xa'));var toCsv=require(_0x9c24('0xb'));var querystring=require('querystring');var Papa=require(_0x9c24('0xc'));var Redis=require(_0x9c24('0xd'));var authService=require(_0x9c24('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x9c24('0xf'));var hardwareService=require(_0x9c24('0x10'));var logger=require(_0x9c24('0x11'))(_0x9c24('0x12'));var utils=require(_0x9c24('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x9c24('0x14'));var db=require(_0x9c24('0x15'))['db'];var integrations=require(_0x9c24('0x16'));function respondWithStatusCode(_0x365762,_0x2666df){_0x2666df=_0x2666df||0xcc;return function(_0x370801){if(_0x370801){return _0x365762[_0x9c24('0x17')](_0x2666df);}return _0x365762['status'](_0x2666df)[_0x9c24('0x18')]();};}function respondWithResult(_0x5e79a3,_0x119ca0){_0x119ca0=_0x119ca0||0xc8;return function(_0x5090c0){if(_0x5090c0){return _0x5e79a3['status'](_0x119ca0)[_0x9c24('0x19')](_0x5090c0);}};}function respondWithFilteredResult(_0x369d61,_0x361eb6){return function(_0x2d7783){if(_0x2d7783){var _0x214c22=typeof _0x361eb6[_0x9c24('0x1a')]===_0x9c24('0x1b')&&typeof _0x361eb6[_0x9c24('0x1c')]===_0x9c24('0x1b');var _0x247b70=_0x2d7783['count'];var _0x1c3221=_0x214c22?0x0:_0x361eb6[_0x9c24('0x1a')];var _0x4b3b8a=_0x214c22?_0x2d7783[_0x9c24('0x1d')]:_0x361eb6['offset']+_0x361eb6[_0x9c24('0x1c')];var _0x420131;if(_0x4b3b8a>=_0x247b70){_0x4b3b8a=_0x247b70;_0x420131=0xc8;}else{_0x420131=0xce;}_0x369d61[_0x9c24('0x1e')](_0x420131);return _0x369d61['set'](_0x9c24('0x1f'),_0x1c3221+'-'+_0x4b3b8a+'/'+_0x247b70)[_0x9c24('0x19')](_0x2d7783);}return null;};}function patchUpdates(_0x4c1078){return function(_0x17c534){try{jsonpatch[_0x9c24('0x20')](_0x17c534,_0x4c1078,!![]);}catch(_0x1739bb){return BPromise[_0x9c24('0x21')](_0x1739bb);}return _0x17c534[_0x9c24('0x22')]();};}function saveUpdates(_0x52b567,_0x86bc6c){return function(_0x270145){if(_0x270145){return _0x270145[_0x9c24('0x23')](_0x52b567)[_0x9c24('0x24')](function(_0xd2de92){return _0xd2de92;});}return null;};}function removeEntity(_0x1f0c7d,_0x20528e){return function(_0x3a3a19){if(_0x3a3a19){return _0x3a3a19['destroy']()[_0x9c24('0x24')](function(){_0x1f0c7d[_0x9c24('0x1e')](0xcc)[_0x9c24('0x18')]();});}};}function handleEntityNotFound(_0x209c58,_0x324821){return function(_0x6512b0){if(!_0x6512b0){_0x209c58[_0x9c24('0x17')](0x194);}return _0x6512b0;};}function handleError(_0x1f7a8a,_0x52893e){_0x52893e=_0x52893e||0x1f4;return function(_0x4231e3){logger['error'](_0x4231e3[_0x9c24('0x25')]);if(_0x4231e3[_0x9c24('0x26')]){delete _0x4231e3['name'];}_0x1f7a8a[_0x9c24('0x1e')](_0x52893e)['send'](_0x4231e3);};}exports['index']=function(_0x3f53e7,_0x163150){var _0x5c0494={},_0x5cdeb3={},_0x3f6016={'count':0x0,'rows':[]};var _0xde4e1e=_[_0x9c24('0x27')](db[_0x9c24('0x28')]['rawAttributes'],function(_0x5f06a6){return{'name':_0x5f06a6['fieldName'],'type':_0x5f06a6[_0x9c24('0x29')][_0x9c24('0x2a')]};});_0x5cdeb3[_0x9c24('0x2b')]=_[_0x9c24('0x27')](_0xde4e1e,'name');_0x5cdeb3[_0x9c24('0x2c')]=_[_0x9c24('0x2d')](_0x3f53e7[_0x9c24('0x2c')]);_0x5cdeb3[_0x9c24('0x2e')]=_[_0x9c24('0x2f')](_0x5cdeb3[_0x9c24('0x2b')],_0x5cdeb3[_0x9c24('0x2c')]);_0x5c0494[_0x9c24('0x30')]=_['intersection'](_0x5cdeb3[_0x9c24('0x2b')],qs[_0x9c24('0x31')](_0x3f53e7['query']['fields']));_0x5c0494[_0x9c24('0x30')]=_0x5c0494[_0x9c24('0x30')]['length']?_0x5c0494[_0x9c24('0x30')]:_0x5cdeb3[_0x9c24('0x2b')];if(!_0x3f53e7[_0x9c24('0x2c')][_0x9c24('0x32')](_0x9c24('0x33'))){_0x5c0494['limit']=qs[_0x9c24('0x1c')](_0x3f53e7[_0x9c24('0x2c')]['limit']);_0x5c0494[_0x9c24('0x1a')]=qs[_0x9c24('0x1a')](_0x3f53e7[_0x9c24('0x2c')][_0x9c24('0x1a')]);}_0x5c0494[_0x9c24('0x34')]=qs[_0x9c24('0x35')](_0x3f53e7['query'][_0x9c24('0x35')]);_0x5c0494[_0x9c24('0x36')]=qs['filters'](_[_0x9c24('0x37')](_0x3f53e7['query'],_0x5cdeb3[_0x9c24('0x2e')]),_0xde4e1e);if(_0x3f53e7[_0x9c24('0x2c')][_0x9c24('0x38')]){_0x5c0494['where']=_[_0x9c24('0x39')](_0x5c0494[_0x9c24('0x36')],{'$or':_[_0x9c24('0x27')](_0xde4e1e,function(_0x3a79b3){if(_0x3a79b3['type']!=='VIRTUAL'){var _0x1fa997={};_0x1fa997[_0x3a79b3[_0x9c24('0x26')]]={'$like':'%'+_0x3f53e7[_0x9c24('0x2c')][_0x9c24('0x38')]+'%'};return _0x1fa997;}})});}_0x5c0494=_[_0x9c24('0x39')]({},_0x5c0494,_0x3f53e7[_0x9c24('0x3a')]);var _0x501ee2={'where':_0x5c0494[_0x9c24('0x36')]};return db['SalesforceAccount'][_0x9c24('0x1d')](_0x501ee2)[_0x9c24('0x24')](function(_0x56dcbb){_0x3f6016[_0x9c24('0x1d')]=_0x56dcbb;if(_0x3f53e7['query'][_0x9c24('0x3b')]){_0x5c0494[_0x9c24('0x3c')]=[{'all':!![]}];}return db[_0x9c24('0x28')][_0x9c24('0x3d')](_0x5c0494);})[_0x9c24('0x24')](function(_0x18d6e3){_0x3f6016[_0x9c24('0x3e')]=_0x18d6e3;return _0x3f6016;})[_0x9c24('0x24')](respondWithFilteredResult(_0x163150,_0x5c0494))[_0x9c24('0x3f')](handleError(_0x163150,null));};exports[_0x9c24('0x40')]=function(_0x259b9c,_0x1b1cc1){var _0x1111fa={'raw':![],'where':{'id':_0x259b9c['params']['id']}},_0x5b4b7c={};_0x5b4b7c[_0x9c24('0x2b')]=_['keys'](db[_0x9c24('0x28')][_0x9c24('0x41')]);_0x5b4b7c[_0x9c24('0x2c')]=_[_0x9c24('0x2d')](_0x259b9c[_0x9c24('0x2c')]);_0x5b4b7c[_0x9c24('0x2e')]=_[_0x9c24('0x2f')](_0x5b4b7c[_0x9c24('0x2b')],_0x5b4b7c['query']);_0x1111fa[_0x9c24('0x30')]=_['intersection'](_0x5b4b7c[_0x9c24('0x2b')],qs[_0x9c24('0x31')](_0x259b9c[_0x9c24('0x2c')][_0x9c24('0x31')]));_0x1111fa['attributes']=_0x1111fa['attributes']['length']?_0x1111fa[_0x9c24('0x30')]:_0x5b4b7c['model'];if(_0x259b9c[_0x9c24('0x2c')][_0x9c24('0x3b')]){_0x1111fa['include']=[{'all':!![]}];}_0x1111fa=_['merge']({},_0x1111fa,_0x259b9c[_0x9c24('0x3a')]);return db['SalesforceAccount'][_0x9c24('0x42')](_0x1111fa)[_0x9c24('0x24')](handleEntityNotFound(_0x1b1cc1,null))[_0x9c24('0x24')](respondWithResult(_0x1b1cc1,null))[_0x9c24('0x3f')](handleError(_0x1b1cc1,null));};exports[_0x9c24('0x43')]=function(_0x26a6e3,_0x5b8c72){return db[_0x9c24('0x28')][_0x9c24('0x43')](_0x26a6e3['body'],{})[_0x9c24('0x24')](respondWithResult(_0x5b8c72,0xc9))[_0x9c24('0x3f')](handleError(_0x5b8c72,null));};exports[_0x9c24('0x23')]=function(_0x10a305,_0x1704f2){if(_0x10a305['body']['id']){delete _0x10a305[_0x9c24('0x44')]['id'];}return db[_0x9c24('0x28')][_0x9c24('0x42')]({'where':{'id':_0x10a305[_0x9c24('0x45')]['id']}})['then'](handleEntityNotFound(_0x1704f2,null))['then'](saveUpdates(_0x10a305['body'],null))[_0x9c24('0x24')](respondWithResult(_0x1704f2,null))[_0x9c24('0x3f')](handleError(_0x1704f2,null));};exports[_0x9c24('0x46')]=function(_0x44c4a0,_0xb79bc6){return db['SalesforceAccount']['find']({'where':{'id':_0x44c4a0[_0x9c24('0x45')]['id']}})[_0x9c24('0x24')](handleEntityNotFound(_0xb79bc6,null))['then'](removeEntity(_0xb79bc6,null))[_0x9c24('0x3f')](handleError(_0xb79bc6,null));};exports['getConfigurations']=function(_0xc5bd4b,_0x889568,_0x4d3ae5){var _0x52cc3a={};var _0xca99f5={};var _0x58b3fc;var _0x581177;return db[_0x9c24('0x28')][_0x9c24('0x47')]({'where':{'id':_0xc5bd4b[_0x9c24('0x45')]['id']}})['then'](handleEntityNotFound(_0x889568,null))['then'](function(_0x580ee1){if(_0x580ee1){_0x58b3fc=_0x580ee1;_0xca99f5[_0x9c24('0x2b')]=_[_0x9c24('0x2d')](db[_0x9c24('0x48')][_0x9c24('0x41')]);_0xca99f5['query']=_[_0x9c24('0x2d')](_0xc5bd4b[_0x9c24('0x2c')]);_0xca99f5[_0x9c24('0x2e')]=_['intersection'](_0xca99f5[_0x9c24('0x2b')],_0xca99f5[_0x9c24('0x2c')]);_0x52cc3a[_0x9c24('0x30')]=_[_0x9c24('0x2f')](_0xca99f5[_0x9c24('0x2b')],qs[_0x9c24('0x31')](_0xc5bd4b[_0x9c24('0x2c')][_0x9c24('0x31')]));_0x52cc3a[_0x9c24('0x30')]=_0x52cc3a[_0x9c24('0x30')][_0x9c24('0x49')]?_0x52cc3a[_0x9c24('0x30')]:_0xca99f5['model'];_0x52cc3a['order']=qs[_0x9c24('0x35')](_0xc5bd4b['query']['sort']);_0x52cc3a[_0x9c24('0x36')]=qs[_0x9c24('0x2e')](_[_0x9c24('0x37')](_0xc5bd4b[_0x9c24('0x2c')],_0xca99f5[_0x9c24('0x2e')]));if(_0xc5bd4b[_0x9c24('0x2c')][_0x9c24('0x38')]){_0x52cc3a[_0x9c24('0x36')]=_[_0x9c24('0x39')](_0x52cc3a[_0x9c24('0x36')],{'$or':_['map'](_0x52cc3a['attributes'],function(_0x44e43a){var _0x39377c={};_0x39377c[_0x44e43a]={'$like':'%'+_0xc5bd4b['query'][_0x9c24('0x38')]+'%'};return _0x39377c;})});}_0x52cc3a=_[_0x9c24('0x39')]({},_0x52cc3a,_0xc5bd4b[_0x9c24('0x3a')]);return _0x58b3fc[_0x9c24('0x4a')](_0x52cc3a);}})[_0x9c24('0x24')](function(_0x5aa34d){if(_0x5aa34d){_0x581177=_0x5aa34d[_0x9c24('0x49')];if(!_0xc5bd4b[_0x9c24('0x2c')]['hasOwnProperty']('nolimit')){_0x52cc3a['limit']=qs[_0x9c24('0x1c')](_0xc5bd4b[_0x9c24('0x2c')][_0x9c24('0x1c')]);_0x52cc3a['offset']=qs[_0x9c24('0x1a')](_0xc5bd4b[_0x9c24('0x2c')][_0x9c24('0x1a')]);}return _0x58b3fc['getConfigurations'](_0x52cc3a);}})[_0x9c24('0x24')](function(_0x5738ba){if(_0x5738ba){return _0x5738ba?{'count':_0x581177,'rows':_0x5738ba}:null;}})['then'](respondWithResult(_0x889568,null))[_0x9c24('0x3f')](handleError(_0x889568,null));};exports[_0x9c24('0x4b')]=function(_0x3aecc9,_0x56f749,_0x453e51){if(_0x3aecc9[_0x9c24('0x44')]['id']){delete _0x3aecc9[_0x9c24('0x44')]['id'];}return db[_0x9c24('0x28')][_0x9c24('0x47')]({'where':{'id':_0x3aecc9[_0x9c24('0x45')]['id']}})['then'](handleEntityNotFound(_0x56f749,null))['then'](function(_0x5d34b3){if(_0x5d34b3){_0x3aecc9['body']['AccountId']=_0x5d34b3['id'];_0x3aecc9['body'][_0x9c24('0x4c')]=integrations[_0x9c24('0x4d')](_0x3aecc9[_0x9c24('0x44')][_0x9c24('0x4e')],_0x3aecc9[_0x9c24('0x44')]['type']);_0x3aecc9['body']['Descriptions']=integrations[_0x9c24('0x4f')](_0x3aecc9[_0x9c24('0x44')][_0x9c24('0x4e')],_0x3aecc9[_0x9c24('0x44')]['type']);return db[_0x9c24('0x48')]['create'](_0x3aecc9[_0x9c24('0x44')],{'include':[{'model':db[_0x9c24('0x50')],'as':_0x9c24('0x4c')},{'model':db['SalesforceField'],'as':_0x9c24('0x51')}]});}return null;})[_0x9c24('0x24')](respondWithResult(_0x56f749,null))[_0x9c24('0x3f')](handleError(_0x56f749,null));};exports['getFields']=function(_0x29057c,_0x5f2a8d,_0x4efb48){var _0x20a4bc;var _0x368cad='';var _0x377cac=_0x9c24('0x52');return db[_0x9c24('0x28')][_0x9c24('0x47')]({'where':{'id':_0x29057c[_0x9c24('0x45')]['id']},'attributes':['id',_0x9c24('0x53'),_0x9c24('0x54'),_0x9c24('0x55'),'username',_0x9c24('0x56'),'securityToken']})['then'](handleEntityNotFound(_0x5f2a8d,null))[_0x9c24('0x24')](function(_0x216c12){if(_0x216c12){_0x368cad=_0x216c12[_0x9c24('0x53')];var _0x3e8a2f=_0x368cad['slice'](-0x1);if(_0x3e8a2f==='/'){_0x368cad=_0x368cad['substring'](0x0,_0x368cad[_0x9c24('0x57')](_0x3e8a2f));}_0x20a4bc=new jsforce[(_0x9c24('0x58'))]({'oauth2':{'loginUrl':_0x368cad,'clientId':_0x216c12['clientId'],'clientSecret':_0x216c12[_0x9c24('0x55')]}});return _0x20a4bc['login'](_0x216c12[_0x9c24('0x59')],_0x216c12['password'][_0x9c24('0x5a')](_0x216c12[_0x9c24('0x5b')]));}})[_0x9c24('0x24')](function(_0x52e660){if(_0x52e660){if(!_[_0x9c24('0x5c')](_0x29057c[_0x9c24('0x2c')]['ticketType'])){_0x377cac=_0x29057c[_0x9c24('0x2c')]['ticketType'];}return _0x20a4bc[_0x9c24('0x5d')](_0x377cac)['describe']();}})[_0x9c24('0x24')](function(_0x246f79){var _0x4835c9=[_0x9c24('0x5e'),_0x9c24('0x5f'),_0x9c24('0x60'),_0x9c24('0x61'),_0x9c24('0x62'),'Description'];var _0x5afd86=[_0x9c24('0x63'),_0x9c24('0x64'),_0x9c24('0x65'),_0x9c24('0x66'),_0x9c24('0x67'),_0x9c24('0x68'),_0x9c24('0x69')];if(_0x246f79){_[_0x9c24('0x6a')](_0x246f79[_0x9c24('0x31')],function(_0x316434){return _0x4835c9[_0x9c24('0x6b')](_0x316434['name'])||!_0x5afd86['includes'](_0x316434[_0x9c24('0x29')]);});return{'count':_0x246f79['fields']['length'],'rows':_[_0x9c24('0x27')](_0x246f79['fields'],function(_0x257825){return{'id':_0x257825[_0x9c24('0x26')],'name':_0x257825[_0x9c24('0x6c')],'custom':_0x257825[_0x9c24('0x6d')],'options':_0x257825[_0x9c24('0x6e')]['length']>0x0?_[_0x9c24('0x27')](_0x257825[_0x9c24('0x6e')],function(_0x1f39a6){return{'name':_0x1f39a6[_0x9c24('0x6c')],'value':_0x1f39a6[_0x9c24('0x6f')]};}):_0x257825[_0x9c24('0x29')]=='boolean'?[{'name':_0x9c24('0x70'),'value':'true'},{'name':_0x9c24('0x71'),'value':'false'}]:[]};})};}})[_0x9c24('0x24')](respondWithResult(_0x5f2a8d,null))['catch'](function(_0x1fb416){var _0x1109c4=_0x29057c[_0x9c24('0x2c')][_0x9c24('0x72')]?0x1f4:_0x1fb416[_0x9c24('0x73')]||0x1f4;logger[_0x9c24('0x74')](_0x9c24('0x75'),_0x9c24('0x76'),_0x1109c4,JSON['stringify'](_0x1fb416));delete _0x1fb416[_0x9c24('0x26')];if(_0x1109c4===0x191){_0x1109c4=0x190;}_0x5f2a8d[_0x9c24('0x1e')](_0x1109c4)[_0x9c24('0x77')](_0x29057c[_0x9c24('0x2c')][_0x9c24('0x72')]?{'message':_0x9c24('0x78'),'statusCode':_0x1fb416[_0x9c24('0x73')]}:_0x1fb416);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 2468d09..758ce96 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 _0xe1df=['lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','int_salesforce_accounts'];(function(_0x1156f7,_0x1cc279){var _0x15825a=function(_0x1f7864){while(--_0x1f7864){_0x1156f7['push'](_0x1156f7['shift']());}};_0x15825a(++_0x1cc279);}(_0xe1df,0x120));var _0xfe1d=function(_0x418935,_0x5d3f59){_0x418935=_0x418935-0x0;var _0x5cdcee=_0xe1df[_0x418935];return _0x5cdcee;};'use strict';var _=require(_0xfe1d('0x0'));var util=require(_0xfe1d('0x1'));var logger=require(_0xfe1d('0x2'))(_0xfe1d('0x3'));var moment=require(_0xfe1d('0x4'));var BPromise=require(_0xfe1d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xfe1d('0x6'));var config=require(_0xfe1d('0x7'));var attributes=require(_0xfe1d('0x8'));var integrations=require(_0xfe1d('0x9'));module[_0xfe1d('0xa')]=function(_0x4a9c22,_0x45d2fa){return _0x4a9c22['define']('SalesforceAccount',attributes,{'tableName':_0xfe1d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x24a6=['../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x24a6,0x14f));var _0x624a=function(_0x5745b0,_0x3743da){_0x5745b0=_0x5745b0-0x0;var _0x5b8a75=_0x24a6[_0x5745b0];return _0x5b8a75;};'use strict';var _=require(_0x624a('0x0'));var util=require('util');var logger=require(_0x624a('0x1'))(_0x624a('0x2'));var moment=require(_0x624a('0x3'));var BPromise=require(_0x624a('0x4'));var rp=require(_0x624a('0x5'));var fs=require('fs');var path=require(_0x624a('0x6'));var rimraf=require(_0x624a('0x7'));var config=require(_0x624a('0x8'));var attributes=require(_0x624a('0x9'));var integrations=require(_0x624a('0xa'));module[_0x624a('0xb')]=function(_0x325aea,_0x1af370){return _0x325aea[_0x624a('0xc')](_0x624a('0xd'),attributes,{'tableName':_0x624a('0xe'),'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 8c78d6c..d2f3dab 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 _0x68bc=['findAll','options','raw','limit','include','model','attributes','map','then','GetSalesforceAccount','find','where','ShowSalesforceAccount','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','SalesforceAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','SalesforceAccount'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0x68bc,0xbc));var _0xc68b=function(_0x4e2a5a,_0x2dbc48){_0x4e2a5a=_0x4e2a5a-0x0;var _0x5bb4d1=_0x68bc[_0x4e2a5a];return _0x5bb4d1;};'use strict';var _=require(_0xc68b('0x0'));var util=require('util');var moment=require(_0xc68b('0x1'));var BPromise=require('bluebird');var rs=require(_0xc68b('0x2'));var fs=require('fs');var Redis=require(_0xc68b('0x3'));var db=require(_0xc68b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc68b('0x5'))(_0xc68b('0x6'));var config=require(_0xc68b('0x7'));var jayson=require(_0xc68b('0x8'));var client=jayson['client'][_0xc68b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x24b08f,_0x32f12a,_0x35b48a){return new BPromise(function(_0x1367fc,_0x29035b){return client[_0xc68b('0xa')](_0x24b08f,_0x35b48a)['then'](function(_0x158daa){logger[_0xc68b('0xb')](_0xc68b('0xc'),_0x32f12a,'request\x20sent');logger[_0xc68b('0xd')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x32f12a,_0xc68b('0xe'),JSON[_0xc68b('0xf')](_0x158daa));if(_0x158daa[_0xc68b('0x10')]){if(_0x158daa['error'][_0xc68b('0x11')]===0x1f4){logger[_0xc68b('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0x32f12a,_0x158daa[_0xc68b('0x10')][_0xc68b('0x12')]);return _0x29035b(_0x158daa['error'][_0xc68b('0x12')]);}logger[_0xc68b('0x10')](_0xc68b('0xc'),_0x32f12a,_0x158daa['error'][_0xc68b('0x12')]);return _0x1367fc(_0x158daa[_0xc68b('0x10')]['message']);}else{logger['info'](_0xc68b('0xc'),_0x32f12a,'request\x20sent');_0x1367fc(_0x158daa[_0xc68b('0x13')][_0xc68b('0x12')]);}})[_0xc68b('0x14')](function(_0x2aa925){logger[_0xc68b('0x10')](_0xc68b('0xc'),_0x32f12a,_0x2aa925);_0x29035b(_0x2aa925);});});}exports['GetSalesforceAccount']=function(_0xdc96ab){var _0x19ef67=this;return new Promise(function(_0x27174d,_0x5e236a){return db[_0xc68b('0x15')][_0xc68b('0x16')]({'raw':_0xdc96ab[_0xc68b('0x17')]?_0xdc96ab[_0xc68b('0x17')][_0xc68b('0x18')]===undefined?!![]:![]:!![],'where':_0xdc96ab[_0xc68b('0x17')]?_0xdc96ab[_0xc68b('0x17')]['where']||null:null,'attributes':_0xdc96ab[_0xc68b('0x17')]?_0xdc96ab['options']['attributes']||null:null,'limit':_0xdc96ab[_0xc68b('0x17')]?_0xdc96ab[_0xc68b('0x17')][_0xc68b('0x19')]||null:null,'include':_0xdc96ab[_0xc68b('0x17')]?_0xdc96ab[_0xc68b('0x17')][_0xc68b('0x1a')]?_['map'](_0xdc96ab[_0xc68b('0x17')]['include'],function(_0x38f759){return{'model':db[_0x38f759[_0xc68b('0x1b')]],'as':_0x38f759['as'],'attributes':_0x38f759[_0xc68b('0x1c')],'include':_0x38f759['include']?_[_0xc68b('0x1d')](_0x38f759[_0xc68b('0x1a')],function(_0x11c5d){return{'model':db[_0x11c5d[_0xc68b('0x1b')]],'as':_0x11c5d['as'],'attributes':_0x11c5d[_0xc68b('0x1c')],'include':_0x11c5d['include']?_[_0xc68b('0x1d')](_0x11c5d['include'],function(_0x647bea){return{'model':db[_0x647bea[_0xc68b('0x1b')]],'as':_0x647bea['as'],'attributes':_0x647bea[_0xc68b('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc68b('0x1e')](function(_0x417533){logger[_0xc68b('0xb')](_0xc68b('0x1f'),_0xdc96ab);logger[_0xc68b('0xd')](_0xc68b('0x1f'),_0xdc96ab,JSON['stringify'](_0x417533));_0x27174d(_0x417533);})[_0xc68b('0x14')](function(_0x23a862){logger[_0xc68b('0x10')](_0xc68b('0x1f'),_0x23a862[_0xc68b('0x12')],_0xdc96ab);_0x5e236a(_0x19ef67[_0xc68b('0x10')](0x1f4,_0x23a862[_0xc68b('0x12')]));});});};exports['ShowSalesforceAccount']=function(_0x2ef82f){var _0x412ce8=this;return new Promise(function(_0x2e1699,_0x7d8830){return db['SalesforceAccount'][_0xc68b('0x20')]({'raw':_0x2ef82f['options']?_0x2ef82f[_0xc68b('0x17')][_0xc68b('0x18')]===undefined?!![]:![]:!![],'where':_0x2ef82f['options']?_0x2ef82f[_0xc68b('0x17')][_0xc68b('0x21')]||null:null,'attributes':_0x2ef82f[_0xc68b('0x17')]?_0x2ef82f[_0xc68b('0x17')][_0xc68b('0x1c')]||null:null,'include':_0x2ef82f[_0xc68b('0x17')]?_0x2ef82f[_0xc68b('0x17')][_0xc68b('0x1a')]?_[_0xc68b('0x1d')](_0x2ef82f[_0xc68b('0x17')][_0xc68b('0x1a')],function(_0x4718a1){return{'model':db[_0x4718a1[_0xc68b('0x1b')]],'as':_0x4718a1['as'],'attributes':_0x4718a1[_0xc68b('0x1c')],'include':_0x4718a1[_0xc68b('0x1a')]?_[_0xc68b('0x1d')](_0x4718a1[_0xc68b('0x1a')],function(_0x2a095b){return{'model':db[_0x2a095b[_0xc68b('0x1b')]],'as':_0x2a095b['as'],'attributes':_0x2a095b[_0xc68b('0x1c')],'include':_0x2a095b[_0xc68b('0x1a')]?_['map'](_0x2a095b[_0xc68b('0x1a')],function(_0x571b0d){return{'model':db[_0x571b0d[_0xc68b('0x1b')]],'as':_0x571b0d['as'],'attributes':_0x571b0d[_0xc68b('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc68b('0x1e')](function(_0x527d89){logger[_0xc68b('0xb')]('ShowSalesforceAccount',_0x2ef82f);logger[_0xc68b('0xd')](_0xc68b('0x22'),_0x2ef82f,JSON[_0xc68b('0xf')](_0x527d89));_0x2e1699(_0x527d89);})[_0xc68b('0x14')](function(_0x23bd5f){logger[_0xc68b('0x10')](_0xc68b('0x22'),_0x23bd5f['message'],_0x2ef82f);_0x7d8830(_0x412ce8[_0xc68b('0x10')](0x1f4,_0x23bd5f['message']));});});}; \ No newline at end of file +var _0x3939=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','catch','find','ShowSalesforceAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x3939,0xe8));var _0x9393=function(_0x45d8ad,_0x30ec90){_0x45d8ad=_0x45d8ad-0x0;var _0x22b127=_0x3939[_0x45d8ad];return _0x22b127;};'use strict';var _=require(_0x9393('0x0'));var util=require(_0x9393('0x1'));var moment=require(_0x9393('0x2'));var BPromise=require(_0x9393('0x3'));var rs=require(_0x9393('0x4'));var fs=require('fs');var Redis=require(_0x9393('0x5'));var db=require(_0x9393('0x6'))['db'];var utils=require(_0x9393('0x7'));var logger=require(_0x9393('0x8'))(_0x9393('0x9'));var config=require(_0x9393('0xa'));var jayson=require(_0x9393('0xb'));var client=jayson[_0x9393('0xc')][_0x9393('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5ed1e,_0x4054b2,_0x59453b){return new BPromise(function(_0x360b84,_0x1bea14){return client[_0x9393('0xe')](_0x5ed1e,_0x59453b)['then'](function(_0x4afab8){logger[_0x9393('0xf')](_0x9393('0x10'),_0x4054b2,_0x9393('0x11'));logger[_0x9393('0x12')](_0x9393('0x13'),_0x4054b2,'request\x20sent',JSON[_0x9393('0x14')](_0x4afab8));if(_0x4afab8['error']){if(_0x4afab8[_0x9393('0x15')][_0x9393('0x16')]===0x1f4){logger[_0x9393('0x15')](_0x9393('0x10'),_0x4054b2,_0x4afab8[_0x9393('0x15')][_0x9393('0x17')]);return _0x1bea14(_0x4afab8[_0x9393('0x15')][_0x9393('0x17')]);}logger[_0x9393('0x15')](_0x9393('0x10'),_0x4054b2,_0x4afab8['error'][_0x9393('0x17')]);return _0x360b84(_0x4afab8[_0x9393('0x15')][_0x9393('0x17')]);}else{logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x4054b2,_0x9393('0x11'));_0x360b84(_0x4afab8[_0x9393('0x18')][_0x9393('0x17')]);}})['catch'](function(_0x5dee86){logger[_0x9393('0x15')](_0x9393('0x10'),_0x4054b2,_0x5dee86);_0x1bea14(_0x5dee86);});});}exports[_0x9393('0x19')]=function(_0x1ca323){var _0x4b78e7=this;return new Promise(function(_0x5e0d7f,_0x7d8b05){return db[_0x9393('0x1a')][_0x9393('0x1b')]({'raw':_0x1ca323['options']?_0x1ca323[_0x9393('0x1c')][_0x9393('0x1d')]===undefined?!![]:![]:!![],'where':_0x1ca323['options']?_0x1ca323['options'][_0x9393('0x1e')]||null:null,'attributes':_0x1ca323[_0x9393('0x1c')]?_0x1ca323[_0x9393('0x1c')][_0x9393('0x1f')]||null:null,'limit':_0x1ca323[_0x9393('0x1c')]?_0x1ca323[_0x9393('0x1c')][_0x9393('0x20')]||null:null,'include':_0x1ca323[_0x9393('0x1c')]?_0x1ca323[_0x9393('0x1c')][_0x9393('0x21')]?_[_0x9393('0x22')](_0x1ca323[_0x9393('0x1c')][_0x9393('0x21')],function(_0x3d74c6){return{'model':db[_0x3d74c6[_0x9393('0x23')]],'as':_0x3d74c6['as'],'attributes':_0x3d74c6['attributes'],'include':_0x3d74c6[_0x9393('0x21')]?_['map'](_0x3d74c6[_0x9393('0x21')],function(_0x4cbff4){return{'model':db[_0x4cbff4['model']],'as':_0x4cbff4['as'],'attributes':_0x4cbff4[_0x9393('0x1f')],'include':_0x4cbff4['include']?_[_0x9393('0x22')](_0x4cbff4[_0x9393('0x21')],function(_0x239139){return{'model':db[_0x239139[_0x9393('0x23')]],'as':_0x239139['as'],'attributes':_0x239139[_0x9393('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x9393('0x24')](function(_0x55b460){logger[_0x9393('0xf')](_0x9393('0x19'),_0x1ca323);logger['debug'](_0x9393('0x19'),_0x1ca323,JSON[_0x9393('0x14')](_0x55b460));_0x5e0d7f(_0x55b460);})[_0x9393('0x25')](function(_0x283542){logger[_0x9393('0x15')](_0x9393('0x19'),_0x283542['message'],_0x1ca323);_0x7d8b05(_0x4b78e7[_0x9393('0x15')](0x1f4,_0x283542['message']));});});};exports['ShowSalesforceAccount']=function(_0x361319){var _0x3f56c4=this;return new Promise(function(_0x4faf95,_0x4bd52b){return db[_0x9393('0x1a')][_0x9393('0x26')]({'raw':_0x361319['options']?_0x361319['options']['raw']===undefined?!![]:![]:!![],'where':_0x361319[_0x9393('0x1c')]?_0x361319[_0x9393('0x1c')][_0x9393('0x1e')]||null:null,'attributes':_0x361319['options']?_0x361319['options']['attributes']||null:null,'include':_0x361319[_0x9393('0x1c')]?_0x361319[_0x9393('0x1c')][_0x9393('0x21')]?_['map'](_0x361319['options'][_0x9393('0x21')],function(_0x2a1df2){return{'model':db[_0x2a1df2[_0x9393('0x23')]],'as':_0x2a1df2['as'],'attributes':_0x2a1df2['attributes'],'include':_0x2a1df2[_0x9393('0x21')]?_[_0x9393('0x22')](_0x2a1df2[_0x9393('0x21')],function(_0x2a85c4){return{'model':db[_0x2a85c4[_0x9393('0x23')]],'as':_0x2a85c4['as'],'attributes':_0x2a85c4[_0x9393('0x1f')],'include':_0x2a85c4[_0x9393('0x21')]?_['map'](_0x2a85c4[_0x9393('0x21')],function(_0x479836){return{'model':db[_0x479836['model']],'as':_0x479836['as'],'attributes':_0x479836[_0x9393('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x9393('0x24')](function(_0x5ac8f3){logger[_0x9393('0xf')](_0x9393('0x27'),_0x361319);logger['debug'](_0x9393('0x27'),_0x361319,JSON[_0x9393('0x14')](_0x5ac8f3));_0x4faf95(_0x5ac8f3);})[_0x9393('0x25')](function(_0x7fbf35){logger['error'](_0x9393('0x27'),_0x7fbf35[_0x9393('0x17')],_0x361319);_0x4bd52b(_0x3f56c4['error'](0x1f4,_0x7fbf35[_0x9393('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 0423cdd..7c923b3 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 _0x5f66=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x5d9cd2,_0x41ecec){var _0x2dea21=function(_0x4a203f){while(--_0x4a203f){_0x5d9cd2['push'](_0x5d9cd2['shift']());}};_0x2dea21(++_0x41ecec);}(_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('./intSalesforceConfiguration.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['getFields']);router['get'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0x7')]('/:id/descriptions',auth[_0x65f6('0x8')](),controller['getDescriptions']);router['post']('/',auth[_0x65f6('0x8')](),controller['create']);router[_0x65f6('0xe')]('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0xf')]);router[_0x65f6('0x10')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x11')]);module[_0x65f6('0x12')]=router; \ No newline at end of file +var _0x0b0e=['post','create','put','/:id','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3fd275,_0xf0cd7){_0x3fd275=_0x3fd275-0x0;var _0xe4f14f=_0x0b0e[_0x3fd275];return _0xe4f14f;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['getFields']);router[_0xe0b0('0x9')](_0xe0b0('0xe'),auth['isAuthenticated'](),controller[_0xe0b0('0xf')]);router[_0xe0b0('0x9')]('/:id/descriptions',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x11')]('/',auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x15')]);router['delete'](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x16')]);module[_0xe0b0('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index cc0061b..fcc6c42 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 _0x283d=['nothing','contact','lead','sequelize','exports','STRING','ENUM','Task','Case','account_contact_lead','account','contact_lead'];(function(_0x2fe4b5,_0x439480){var _0x2b9c0b=function(_0x5bfca9){while(--_0x5bfca9){_0x2fe4b5['push'](_0x2fe4b5['shift']());}};_0x2b9c0b(++_0x439480);}(_0x283d,0x9f));var _0xd283=function(_0x3fcc9d,_0x1c6ffc){_0x3fcc9d=_0x3fcc9d-0x0;var _0x3205fe=_0x283d[_0x3fcc9d];return _0x3205fe;};'use strict';var Sequelize=require(_0xd283('0x0'));module[_0xd283('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd283('0x2')]},'ticketType':{'type':Sequelize[_0xd283('0x3')](_0xd283('0x4'),_0xd283('0x5')),'defaultValue':_0xd283('0x4')},'moduleSearch':{'type':Sequelize[_0xd283('0x3')]('contact_lead','contact','lead',_0xd283('0x6'),_0xd283('0x7')),'defaultValue':_0xd283('0x8')},'moduleCreate':{'type':Sequelize[_0xd283('0x3')](_0xd283('0x9'),_0xd283('0xa'),_0xd283('0xb'),_0xd283('0x7')),'defaultValue':_0xd283('0xb')},'leadId':{'type':Sequelize[_0xd283('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0xd283('0x2')]},'additionalSearchContact':{'type':Sequelize[_0xd283('0x2')]},'additionalSearchLead':{'type':Sequelize[_0xd283('0x2')]}}; \ No newline at end of file +var _0xfdd4=['account','sequelize','exports','STRING','ENUM','Task','Case','lead','account_contact_lead','contact_lead','nothing'];(function(_0x5c9227,_0x21defd){var _0xd1ec66=function(_0x1592d1){while(--_0x1592d1){_0x5c9227['push'](_0x5c9227['shift']());}};_0xd1ec66(++_0x21defd);}(_0xfdd4,0x156));var _0x4fdd=function(_0x444532,_0x2d91d9){_0x444532=_0x444532-0x0;var _0x29586d=_0xfdd4[_0x444532];return _0x29586d;};'use strict';var Sequelize=require(_0x4fdd('0x0'));module[_0x4fdd('0x1')]={'name':{'type':Sequelize[_0x4fdd('0x2')]},'description':{'type':Sequelize[_0x4fdd('0x2')]},'ticketType':{'type':Sequelize[_0x4fdd('0x3')](_0x4fdd('0x4'),_0x4fdd('0x5')),'defaultValue':_0x4fdd('0x4')},'moduleSearch':{'type':Sequelize[_0x4fdd('0x3')]('contact_lead','contact',_0x4fdd('0x6'),_0x4fdd('0x7'),'account'),'defaultValue':_0x4fdd('0x8')},'moduleCreate':{'type':Sequelize['ENUM'](_0x4fdd('0x9'),'contact',_0x4fdd('0x6'),_0x4fdd('0xa')),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0x4fdd('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x4fdd('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x4fdd('0x2')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index f45b943..563be2d 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 _0xef2c=['mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','save','update','then','destroy','error','name','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','options','includeAll','include','findAll','catch','show','params','merge','find','create','body','getFields','findOne','SalesforceField','pick','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','moment','bluebird'];(function(_0xa85dbd,_0x2838a5){var _0x3be7aa=function(_0x2573f8){while(--_0x2573f8){_0xa85dbd['push'](_0xa85dbd['shift']());}};_0x3be7aa(++_0x2838a5);}(_0xef2c,0x177));var _0xcef2=function(_0x32f9ca,_0x2fa8bc){_0x32f9ca=_0x32f9ca-0x0;var _0x52e083=_0xef2c[_0x32f9ca];return _0x52e083;};'use strict';var emlformat=require(_0xcef2('0x0'));var rimraf=require(_0xcef2('0x1'));var zipdir=require(_0xcef2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xcef2('0x3'));var BPromise=require(_0xcef2('0x4'));var Mustache=require(_0xcef2('0x5'));var util=require(_0xcef2('0x6'));var path=require(_0xcef2('0x7'));var sox=require(_0xcef2('0x8'));var csv=require(_0xcef2('0x9'));var ejs=require(_0xcef2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcef2('0xb'));var squel=require(_0xcef2('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xcef2('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xcef2('0xe'));var authService=require(_0xcef2('0xf'));var qs=require(_0xcef2('0x10'));var as=require(_0xcef2('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xcef2('0x12'));var utils=require(_0xcef2('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xcef2('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29404d,_0x3ac41e){_0x3ac41e=_0x3ac41e||0xcc;return function(_0x4527ed){if(_0x4527ed){return _0x29404d[_0xcef2('0x15')](_0x3ac41e);}return _0x29404d[_0xcef2('0x16')](_0x3ac41e)[_0xcef2('0x17')]();};}function respondWithResult(_0x38cae6,_0x1da842){_0x1da842=_0x1da842||0xc8;return function(_0x1567eb){if(_0x1567eb){return _0x38cae6[_0xcef2('0x16')](_0x1da842)[_0xcef2('0x18')](_0x1567eb);}};}function respondWithFilteredResult(_0x3df183,_0x54963c){return function(_0x1e6c7a){if(_0x1e6c7a){var _0x3c42a6=typeof _0x54963c['offset']===_0xcef2('0x19')&&typeof _0x54963c[_0xcef2('0x1a')]===_0xcef2('0x19');var _0x30df0f=_0x1e6c7a[_0xcef2('0x1b')];var _0x466f14=_0x3c42a6?0x0:_0x54963c['offset'];var _0x34eec9=_0x3c42a6?_0x1e6c7a[_0xcef2('0x1b')]:_0x54963c[_0xcef2('0x1c')]+_0x54963c[_0xcef2('0x1a')];var _0x2ef257;if(_0x34eec9>=_0x30df0f){_0x34eec9=_0x30df0f;_0x2ef257=0xc8;}else{_0x2ef257=0xce;}_0x3df183[_0xcef2('0x16')](_0x2ef257);return _0x3df183['set']('Content-Range',_0x466f14+'-'+_0x34eec9+'/'+_0x30df0f)[_0xcef2('0x18')](_0x1e6c7a);}return null;};}function patchUpdates(_0x212ae7){return function(_0x49f315){try{jsonpatch[_0xcef2('0x1d')](_0x49f315,_0x212ae7,!![]);}catch(_0x24de35){return BPromise[_0xcef2('0x1e')](_0x24de35);}return _0x49f315[_0xcef2('0x1f')]();};}function saveUpdates(_0x585230,_0x30dcfe){return function(_0x5a5974){if(_0x5a5974){return _0x5a5974[_0xcef2('0x20')](_0x585230)[_0xcef2('0x21')](function(_0x37f3b7){return _0x37f3b7;});}return null;};}function removeEntity(_0x2faa4a,_0x27094b){return function(_0xdcf3e7){if(_0xdcf3e7){return _0xdcf3e7[_0xcef2('0x22')]()[_0xcef2('0x21')](function(){_0x2faa4a[_0xcef2('0x16')](0xcc)[_0xcef2('0x17')]();});}};}function handleEntityNotFound(_0x3d827b,_0x85a58f){return function(_0x53c68c){if(!_0x53c68c){_0x3d827b['sendStatus'](0x194);}return _0x53c68c;};}function handleError(_0x4ce98f,_0xe69fdc){_0xe69fdc=_0xe69fdc||0x1f4;return function(_0x350b6e){logger[_0xcef2('0x23')](_0x350b6e['stack']);if(_0x350b6e[_0xcef2('0x24')]){delete _0x350b6e[_0xcef2('0x24')];}_0x4ce98f[_0xcef2('0x16')](_0xe69fdc)['send'](_0x350b6e);};}exports[_0xcef2('0x25')]=function(_0x1c079b,_0x41f4da){var _0x1e36cb={},_0x225cc6={},_0xd85e75={'count':0x0,'rows':[]};var _0xf649a3=_[_0xcef2('0x26')](db[_0xcef2('0x27')][_0xcef2('0x28')],function(_0x2f5253){return{'name':_0x2f5253[_0xcef2('0x29')],'type':_0x2f5253[_0xcef2('0x2a')][_0xcef2('0x2b')]};});_0x225cc6[_0xcef2('0x2c')]=_[_0xcef2('0x26')](_0xf649a3,_0xcef2('0x24'));_0x225cc6[_0xcef2('0x2d')]=_[_0xcef2('0x2e')](_0x1c079b[_0xcef2('0x2d')]);_0x225cc6[_0xcef2('0x2f')]=_[_0xcef2('0x30')](_0x225cc6[_0xcef2('0x2c')],_0x225cc6[_0xcef2('0x2d')]);_0x1e36cb['attributes']=_[_0xcef2('0x30')](_0x225cc6['model'],qs[_0xcef2('0x31')](_0x1c079b[_0xcef2('0x2d')][_0xcef2('0x31')]));_0x1e36cb[_0xcef2('0x32')]=_0x1e36cb[_0xcef2('0x32')][_0xcef2('0x33')]?_0x1e36cb[_0xcef2('0x32')]:_0x225cc6['model'];if(!_0x1c079b[_0xcef2('0x2d')][_0xcef2('0x34')](_0xcef2('0x35'))){_0x1e36cb[_0xcef2('0x1a')]=qs[_0xcef2('0x1a')](_0x1c079b[_0xcef2('0x2d')][_0xcef2('0x1a')]);_0x1e36cb['offset']=qs[_0xcef2('0x1c')](_0x1c079b[_0xcef2('0x2d')][_0xcef2('0x1c')]);}_0x1e36cb[_0xcef2('0x36')]=qs[_0xcef2('0x37')](_0x1c079b[_0xcef2('0x2d')][_0xcef2('0x37')]);_0x1e36cb[_0xcef2('0x38')]=qs[_0xcef2('0x2f')](_['pick'](_0x1c079b['query'],_0x225cc6[_0xcef2('0x2f')]),_0xf649a3);if(_0x1c079b[_0xcef2('0x2d')][_0xcef2('0x39')]){_0x1e36cb[_0xcef2('0x38')]=_['merge'](_0x1e36cb[_0xcef2('0x38')],{'$or':_[_0xcef2('0x26')](_0xf649a3,function(_0x463216){if(_0x463216[_0xcef2('0x2a')]!==_0xcef2('0x3a')){var _0x467d72={};_0x467d72[_0x463216[_0xcef2('0x24')]]={'$like':'%'+_0x1c079b['query']['filter']+'%'};return _0x467d72;}})});}_0x1e36cb=_['merge']({},_0x1e36cb,_0x1c079b[_0xcef2('0x3b')]);var _0x212c29={'where':_0x1e36cb[_0xcef2('0x38')]};return db[_0xcef2('0x27')][_0xcef2('0x1b')](_0x212c29)['then'](function(_0x5d4003){_0xd85e75['count']=_0x5d4003;if(_0x1c079b[_0xcef2('0x2d')][_0xcef2('0x3c')]){_0x1e36cb[_0xcef2('0x3d')]=[{'all':!![]}];}return db[_0xcef2('0x27')][_0xcef2('0x3e')](_0x1e36cb);})['then'](function(_0x473940){_0xd85e75['rows']=_0x473940;return _0xd85e75;})[_0xcef2('0x21')](respondWithFilteredResult(_0x41f4da,_0x1e36cb))[_0xcef2('0x3f')](handleError(_0x41f4da,null));};exports[_0xcef2('0x40')]=function(_0x4654d3,_0x162053){var _0x39f0b2={'raw':![],'where':{'id':_0x4654d3[_0xcef2('0x41')]['id']}},_0x14f63a={};_0x14f63a[_0xcef2('0x2c')]=_[_0xcef2('0x2e')](db[_0xcef2('0x27')][_0xcef2('0x28')]);_0x14f63a['query']=_[_0xcef2('0x2e')](_0x4654d3[_0xcef2('0x2d')]);_0x14f63a[_0xcef2('0x2f')]=_[_0xcef2('0x30')](_0x14f63a[_0xcef2('0x2c')],_0x14f63a[_0xcef2('0x2d')]);_0x39f0b2['attributes']=_['intersection'](_0x14f63a[_0xcef2('0x2c')],qs[_0xcef2('0x31')](_0x4654d3[_0xcef2('0x2d')][_0xcef2('0x31')]));_0x39f0b2[_0xcef2('0x32')]=_0x39f0b2[_0xcef2('0x32')][_0xcef2('0x33')]?_0x39f0b2[_0xcef2('0x32')]:_0x14f63a[_0xcef2('0x2c')];if(_0x4654d3[_0xcef2('0x2d')]['includeAll']){_0x39f0b2[_0xcef2('0x3d')]=[{'all':!![]}];}_0x39f0b2=_[_0xcef2('0x42')]({},_0x39f0b2,_0x4654d3['options']);return db[_0xcef2('0x27')][_0xcef2('0x43')](_0x39f0b2)['then'](handleEntityNotFound(_0x162053,null))['then'](respondWithResult(_0x162053,null))[_0xcef2('0x3f')](handleError(_0x162053,null));};exports[_0xcef2('0x44')]=function(_0x1098fa,_0xb2f831){return db[_0xcef2('0x27')][_0xcef2('0x44')](_0x1098fa[_0xcef2('0x45')],{})[_0xcef2('0x21')](respondWithResult(_0xb2f831,0xc9))[_0xcef2('0x3f')](handleError(_0xb2f831,null));};exports[_0xcef2('0x20')]=function(_0x320315,_0x92bf59){if(_0x320315[_0xcef2('0x45')]['id']){delete _0x320315[_0xcef2('0x45')]['id'];}return db[_0xcef2('0x27')]['find']({'where':{'id':_0x320315[_0xcef2('0x41')]['id']}})[_0xcef2('0x21')](handleEntityNotFound(_0x92bf59,null))[_0xcef2('0x21')](saveUpdates(_0x320315[_0xcef2('0x45')],null))['then'](respondWithResult(_0x92bf59,null))[_0xcef2('0x3f')](handleError(_0x92bf59,null));};exports[_0xcef2('0x22')]=function(_0x2c4ccf,_0x2ac09c){return db[_0xcef2('0x27')]['find']({'where':{'id':_0x2c4ccf['params']['id']}})[_0xcef2('0x21')](handleEntityNotFound(_0x2ac09c,null))['then'](removeEntity(_0x2ac09c,null))[_0xcef2('0x3f')](handleError(_0x2ac09c,null));};exports[_0xcef2('0x46')]=function(_0x328245,_0x230f74,_0xe71c94){var _0x1efea0={};var _0x2fa33b={};var _0x23ba0b;var _0x4e75ec;return db[_0xcef2('0x27')][_0xcef2('0x47')]({'where':{'id':_0x328245['params']['id']}})['then'](handleEntityNotFound(_0x230f74,null))[_0xcef2('0x21')](function(_0x3aa28a){if(_0x3aa28a){_0x23ba0b=_0x3aa28a;_0x2fa33b['model']=_['keys'](db[_0xcef2('0x48')][_0xcef2('0x28')]);_0x2fa33b[_0xcef2('0x2d')]=_[_0xcef2('0x2e')](_0x328245['query']);_0x2fa33b[_0xcef2('0x2f')]=_[_0xcef2('0x30')](_0x2fa33b['model'],_0x2fa33b['query']);_0x1efea0['attributes']=_['intersection'](_0x2fa33b['model'],qs[_0xcef2('0x31')](_0x328245[_0xcef2('0x2d')][_0xcef2('0x31')]));_0x1efea0[_0xcef2('0x32')]=_0x1efea0[_0xcef2('0x32')][_0xcef2('0x33')]?_0x1efea0[_0xcef2('0x32')]:_0x2fa33b[_0xcef2('0x2c')];_0x1efea0[_0xcef2('0x36')]=qs[_0xcef2('0x37')](_0x328245['query'][_0xcef2('0x37')]);_0x1efea0['where']=qs[_0xcef2('0x2f')](_[_0xcef2('0x49')](_0x328245['query'],_0x2fa33b[_0xcef2('0x2f')]));if(_0x328245[_0xcef2('0x2d')][_0xcef2('0x39')]){_0x1efea0[_0xcef2('0x38')]=_['merge'](_0x1efea0[_0xcef2('0x38')],{'$or':_[_0xcef2('0x26')](_0x1efea0[_0xcef2('0x32')],function(_0x579539){var _0x3396a={};_0x3396a[_0x579539]={'$like':'%'+_0x328245[_0xcef2('0x2d')]['filter']+'%'};return _0x3396a;})});}_0x1efea0=_[_0xcef2('0x42')]({},_0x1efea0,_0x328245[_0xcef2('0x3b')]);return _0x23ba0b[_0xcef2('0x46')](_0x1efea0);}})[_0xcef2('0x21')](function(_0x456d4e){if(_0x456d4e){_0x4e75ec=_0x456d4e[_0xcef2('0x33')];if(!_0x328245[_0xcef2('0x2d')][_0xcef2('0x34')](_0xcef2('0x35'))){_0x1efea0[_0xcef2('0x1a')]=qs[_0xcef2('0x1a')](_0x328245[_0xcef2('0x2d')][_0xcef2('0x1a')]);_0x1efea0['offset']=qs[_0xcef2('0x1c')](_0x328245['query'][_0xcef2('0x1c')]);}return _0x23ba0b['getFields'](_0x1efea0);}})[_0xcef2('0x21')](function(_0x3a15b0){if(_0x3a15b0){return _0x3a15b0?{'count':_0x4e75ec,'rows':_0x3a15b0}:null;}})[_0xcef2('0x21')](respondWithResult(_0x230f74,null))[_0xcef2('0x3f')](handleError(_0x230f74,null));};exports['getSubjects']=function(_0x564aa4,_0x5806f0,_0x5f21d8){var _0x5ebb32={};var _0x44e023={};var _0x14bd37;var _0x3774be;return db[_0xcef2('0x27')][_0xcef2('0x47')]({'where':{'id':_0x564aa4['params']['id']}})[_0xcef2('0x21')](handleEntityNotFound(_0x5806f0,null))['then'](function(_0x43659e){if(_0x43659e){_0x14bd37=_0x43659e;_0x44e023['model']=_[_0xcef2('0x2e')](db[_0xcef2('0x48')]['rawAttributes']);_0x44e023[_0xcef2('0x2d')]=_[_0xcef2('0x2e')](_0x564aa4['query']);_0x44e023['filters']=_[_0xcef2('0x30')](_0x44e023[_0xcef2('0x2c')],_0x44e023[_0xcef2('0x2d')]);_0x5ebb32['attributes']=_[_0xcef2('0x30')](_0x44e023[_0xcef2('0x2c')],qs[_0xcef2('0x31')](_0x564aa4[_0xcef2('0x2d')]['fields']));_0x5ebb32[_0xcef2('0x32')]=_0x5ebb32[_0xcef2('0x32')]['length']?_0x5ebb32['attributes']:_0x44e023[_0xcef2('0x2c')];_0x5ebb32['order']=qs[_0xcef2('0x37')](_0x564aa4[_0xcef2('0x2d')]['sort']);_0x5ebb32[_0xcef2('0x38')]=qs[_0xcef2('0x2f')](_['pick'](_0x564aa4[_0xcef2('0x2d')],_0x44e023[_0xcef2('0x2f')]));if(_0x564aa4[_0xcef2('0x2d')][_0xcef2('0x39')]){_0x5ebb32['where']=_[_0xcef2('0x42')](_0x5ebb32['where'],{'$or':_[_0xcef2('0x26')](_0x5ebb32[_0xcef2('0x32')],function(_0x33fc0d){var _0x3dc543={};_0x3dc543[_0x33fc0d]={'$like':'%'+_0x564aa4[_0xcef2('0x2d')]['filter']+'%'};return _0x3dc543;})});}_0x5ebb32=_['merge']({},_0x5ebb32,_0x564aa4[_0xcef2('0x3b')]);return _0x14bd37['getSubjects'](_0x5ebb32);}})[_0xcef2('0x21')](function(_0x3ae4b3){if(_0x3ae4b3){_0x3774be=_0x3ae4b3[_0xcef2('0x33')];if(!_0x564aa4['query'][_0xcef2('0x34')]('nolimit')){_0x5ebb32[_0xcef2('0x1a')]=qs[_0xcef2('0x1a')](_0x564aa4[_0xcef2('0x2d')][_0xcef2('0x1a')]);_0x5ebb32[_0xcef2('0x1c')]=qs[_0xcef2('0x1c')](_0x564aa4[_0xcef2('0x2d')][_0xcef2('0x1c')]);}return _0x14bd37[_0xcef2('0x4a')](_0x5ebb32);}})['then'](function(_0x3fc84f){if(_0x3fc84f){return _0x3fc84f?{'count':_0x3774be,'rows':_0x3fc84f}:null;}})[_0xcef2('0x21')](respondWithResult(_0x5806f0,null))[_0xcef2('0x3f')](handleError(_0x5806f0,null));};exports[_0xcef2('0x4b')]=function(_0x75570a,_0x426cd0,_0x1dffef){var _0x5d7d8b={};var _0x3bdf51={};var _0x1791d5;var _0x5ca718;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x75570a['params']['id']}})[_0xcef2('0x21')](handleEntityNotFound(_0x426cd0,null))['then'](function(_0x518fab){if(_0x518fab){_0x1791d5=_0x518fab;_0x3bdf51[_0xcef2('0x2c')]=_[_0xcef2('0x2e')](db['SalesforceField']['rawAttributes']);_0x3bdf51[_0xcef2('0x2d')]=_[_0xcef2('0x2e')](_0x75570a[_0xcef2('0x2d')]);_0x3bdf51[_0xcef2('0x2f')]=_[_0xcef2('0x30')](_0x3bdf51[_0xcef2('0x2c')],_0x3bdf51[_0xcef2('0x2d')]);_0x5d7d8b['attributes']=_['intersection'](_0x3bdf51[_0xcef2('0x2c')],qs['fields'](_0x75570a[_0xcef2('0x2d')]['fields']));_0x5d7d8b['attributes']=_0x5d7d8b[_0xcef2('0x32')][_0xcef2('0x33')]?_0x5d7d8b[_0xcef2('0x32')]:_0x3bdf51[_0xcef2('0x2c')];_0x5d7d8b[_0xcef2('0x36')]=qs['sort'](_0x75570a[_0xcef2('0x2d')][_0xcef2('0x37')]);_0x5d7d8b[_0xcef2('0x38')]=qs[_0xcef2('0x2f')](_[_0xcef2('0x49')](_0x75570a[_0xcef2('0x2d')],_0x3bdf51['filters']));if(_0x75570a['query']['filter']){_0x5d7d8b['where']=_[_0xcef2('0x42')](_0x5d7d8b[_0xcef2('0x38')],{'$or':_[_0xcef2('0x26')](_0x5d7d8b['attributes'],function(_0x2ea24c){var _0x2bc964={};_0x2bc964[_0x2ea24c]={'$like':'%'+_0x75570a[_0xcef2('0x2d')][_0xcef2('0x39')]+'%'};return _0x2bc964;})});}_0x5d7d8b=_[_0xcef2('0x42')]({},_0x5d7d8b,_0x75570a[_0xcef2('0x3b')]);return _0x1791d5['getDescriptions'](_0x5d7d8b);}})[_0xcef2('0x21')](function(_0x2bdd39){if(_0x2bdd39){_0x5ca718=_0x2bdd39[_0xcef2('0x33')];if(!_0x75570a['query'][_0xcef2('0x34')](_0xcef2('0x35'))){_0x5d7d8b[_0xcef2('0x1a')]=qs[_0xcef2('0x1a')](_0x75570a[_0xcef2('0x2d')][_0xcef2('0x1a')]);_0x5d7d8b[_0xcef2('0x1c')]=qs[_0xcef2('0x1c')](_0x75570a[_0xcef2('0x2d')][_0xcef2('0x1c')]);}return _0x1791d5[_0xcef2('0x4b')](_0x5d7d8b);}})[_0xcef2('0x21')](function(_0xf753c5){if(_0xf753c5){return _0xf753c5?{'count':_0x5ca718,'rows':_0xf753c5}:null;}})[_0xcef2('0x21')](respondWithResult(_0x426cd0,null))[_0xcef2('0x3f')](handleError(_0x426cd0,null));}; \ No newline at end of file +var _0x5d74=['include','rows','catch','show','options','find','create','body','destroy','params','findOne','order','pick','getFields','hasOwnProperty','getSubjects','SalesforceField','getDescriptions','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','status','set','reject','save','error','stack','name','send','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','nolimit','limit','sort','filters','filter','where','merge','VIRTUAL','then','includeAll'];(function(_0x14a83c,_0x394b54){var _0x345d56=function(_0x34cfcd){while(--_0x34cfcd){_0x14a83c['push'](_0x14a83c['shift']());}};_0x345d56(++_0x394b54);}(_0x5d74,0x14a));var _0x45d7=function(_0x424b6c,_0x429114){_0x424b6c=_0x424b6c-0x0;var _0x3fb79b=_0x5d74[_0x424b6c];return _0x3fb79b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x45d7('0x0'));var jsonpatch=require(_0x45d7('0x1'));var rp=require(_0x45d7('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x45d7('0x3'));var util=require(_0x45d7('0x4'));var path=require(_0x45d7('0x5'));var sox=require(_0x45d7('0x6'));var csv=require(_0x45d7('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x45d7('0x8'));var squel=require(_0x45d7('0x9'));var crypto=require(_0x45d7('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x45d7('0xb'));var toCsv=require('to-csv');var querystring=require(_0x45d7('0xc'));var Papa=require(_0x45d7('0xd'));var Redis=require(_0x45d7('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x45d7('0xf'));var as=require(_0x45d7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x45d7('0x11'))(_0x45d7('0x12'));var utils=require(_0x45d7('0x13'));var config=require(_0x45d7('0x14'));var licenseUtil=require(_0x45d7('0x15'));var db=require(_0x45d7('0x16'))['db'];function respondWithStatusCode(_0x148b44,_0x547a29){_0x547a29=_0x547a29||0xcc;return function(_0xf8274e){if(_0xf8274e){return _0x148b44[_0x45d7('0x17')](_0x547a29);}return _0x148b44['status'](_0x547a29)[_0x45d7('0x18')]();};}function respondWithResult(_0x574528,_0x2ad630){_0x2ad630=_0x2ad630||0xc8;return function(_0x1ddf75){if(_0x1ddf75){return _0x574528['status'](_0x2ad630)[_0x45d7('0x19')](_0x1ddf75);}};}function respondWithFilteredResult(_0x582d04,_0x576520){return function(_0x13101b){if(_0x13101b){var _0x1be6ef=typeof _0x576520[_0x45d7('0x1a')]===_0x45d7('0x1b')&&typeof _0x576520['limit']==='undefined';var _0x62560a=_0x13101b[_0x45d7('0x1c')];var _0xa65483=_0x1be6ef?0x0:_0x576520['offset'];var _0x4e983e=_0x1be6ef?_0x13101b[_0x45d7('0x1c')]:_0x576520['offset']+_0x576520['limit'];var _0x337098;if(_0x4e983e>=_0x62560a){_0x4e983e=_0x62560a;_0x337098=0xc8;}else{_0x337098=0xce;}_0x582d04[_0x45d7('0x1d')](_0x337098);return _0x582d04[_0x45d7('0x1e')]('Content-Range',_0xa65483+'-'+_0x4e983e+'/'+_0x62560a)[_0x45d7('0x19')](_0x13101b);}return null;};}function patchUpdates(_0x27a2e1){return function(_0x927b5c){try{jsonpatch['apply'](_0x927b5c,_0x27a2e1,!![]);}catch(_0x4b9f71){return BPromise[_0x45d7('0x1f')](_0x4b9f71);}return _0x927b5c[_0x45d7('0x20')]();};}function saveUpdates(_0x3252a3,_0x553667){return function(_0x17b118){if(_0x17b118){return _0x17b118['update'](_0x3252a3)['then'](function(_0x199727){return _0x199727;});}return null;};}function removeEntity(_0x740dba,_0x413a31){return function(_0x57d3a9){if(_0x57d3a9){return _0x57d3a9['destroy']()['then'](function(){_0x740dba[_0x45d7('0x1d')](0xcc)[_0x45d7('0x18')]();});}};}function handleEntityNotFound(_0x3799fb,_0x10d2dc){return function(_0x4b1641){if(!_0x4b1641){_0x3799fb[_0x45d7('0x17')](0x194);}return _0x4b1641;};}function handleError(_0x4592f7,_0xc025d){_0xc025d=_0xc025d||0x1f4;return function(_0x2f7a1f){logger[_0x45d7('0x21')](_0x2f7a1f[_0x45d7('0x22')]);if(_0x2f7a1f[_0x45d7('0x23')]){delete _0x2f7a1f['name'];}_0x4592f7[_0x45d7('0x1d')](_0xc025d)[_0x45d7('0x24')](_0x2f7a1f);};}exports['index']=function(_0x141740,_0x255ec6){var _0xddd88f={},_0x47e7b3={},_0x118fcf={'count':0x0,'rows':[]};var _0x115d2b=_[_0x45d7('0x25')](db[_0x45d7('0x26')][_0x45d7('0x27')],function(_0x31ec24){return{'name':_0x31ec24[_0x45d7('0x28')],'type':_0x31ec24[_0x45d7('0x29')][_0x45d7('0x2a')]};});_0x47e7b3[_0x45d7('0x2b')]=_[_0x45d7('0x25')](_0x115d2b,_0x45d7('0x23'));_0x47e7b3['query']=_[_0x45d7('0x2c')](_0x141740[_0x45d7('0x2d')]);_0x47e7b3['filters']=_[_0x45d7('0x2e')](_0x47e7b3['model'],_0x47e7b3[_0x45d7('0x2d')]);_0xddd88f[_0x45d7('0x2f')]=_[_0x45d7('0x2e')](_0x47e7b3[_0x45d7('0x2b')],qs[_0x45d7('0x30')](_0x141740[_0x45d7('0x2d')][_0x45d7('0x30')]));_0xddd88f['attributes']=_0xddd88f[_0x45d7('0x2f')][_0x45d7('0x31')]?_0xddd88f[_0x45d7('0x2f')]:_0x47e7b3[_0x45d7('0x2b')];if(!_0x141740['query']['hasOwnProperty'](_0x45d7('0x32'))){_0xddd88f[_0x45d7('0x33')]=qs[_0x45d7('0x33')](_0x141740[_0x45d7('0x2d')]['limit']);_0xddd88f[_0x45d7('0x1a')]=qs[_0x45d7('0x1a')](_0x141740[_0x45d7('0x2d')][_0x45d7('0x1a')]);}_0xddd88f['order']=qs['sort'](_0x141740['query'][_0x45d7('0x34')]);_0xddd88f['where']=qs[_0x45d7('0x35')](_['pick'](_0x141740['query'],_0x47e7b3[_0x45d7('0x35')]),_0x115d2b);if(_0x141740['query'][_0x45d7('0x36')]){_0xddd88f[_0x45d7('0x37')]=_[_0x45d7('0x38')](_0xddd88f[_0x45d7('0x37')],{'$or':_[_0x45d7('0x25')](_0x115d2b,function(_0x3c76dd){if(_0x3c76dd[_0x45d7('0x29')]!==_0x45d7('0x39')){var _0x3f783d={};_0x3f783d[_0x3c76dd[_0x45d7('0x23')]]={'$like':'%'+_0x141740[_0x45d7('0x2d')][_0x45d7('0x36')]+'%'};return _0x3f783d;}})});}_0xddd88f=_[_0x45d7('0x38')]({},_0xddd88f,_0x141740['options']);var _0x57ee00={'where':_0xddd88f[_0x45d7('0x37')]};return db[_0x45d7('0x26')][_0x45d7('0x1c')](_0x57ee00)[_0x45d7('0x3a')](function(_0x496f50){_0x118fcf[_0x45d7('0x1c')]=_0x496f50;if(_0x141740['query'][_0x45d7('0x3b')]){_0xddd88f[_0x45d7('0x3c')]=[{'all':!![]}];}return db[_0x45d7('0x26')]['findAll'](_0xddd88f);})['then'](function(_0x5cfb4b){_0x118fcf[_0x45d7('0x3d')]=_0x5cfb4b;return _0x118fcf;})[_0x45d7('0x3a')](respondWithFilteredResult(_0x255ec6,_0xddd88f))[_0x45d7('0x3e')](handleError(_0x255ec6,null));};exports[_0x45d7('0x3f')]=function(_0x34aba9,_0x2a56f6){var _0x367d0b={'raw':![],'where':{'id':_0x34aba9['params']['id']}},_0x37e331={};_0x37e331[_0x45d7('0x2b')]=_[_0x45d7('0x2c')](db[_0x45d7('0x26')]['rawAttributes']);_0x37e331['query']=_[_0x45d7('0x2c')](_0x34aba9[_0x45d7('0x2d')]);_0x37e331[_0x45d7('0x35')]=_['intersection'](_0x37e331[_0x45d7('0x2b')],_0x37e331[_0x45d7('0x2d')]);_0x367d0b[_0x45d7('0x2f')]=_[_0x45d7('0x2e')](_0x37e331['model'],qs[_0x45d7('0x30')](_0x34aba9[_0x45d7('0x2d')][_0x45d7('0x30')]));_0x367d0b['attributes']=_0x367d0b[_0x45d7('0x2f')][_0x45d7('0x31')]?_0x367d0b[_0x45d7('0x2f')]:_0x37e331[_0x45d7('0x2b')];if(_0x34aba9[_0x45d7('0x2d')][_0x45d7('0x3b')]){_0x367d0b[_0x45d7('0x3c')]=[{'all':!![]}];}_0x367d0b=_[_0x45d7('0x38')]({},_0x367d0b,_0x34aba9[_0x45d7('0x40')]);return db['SalesforceConfiguration'][_0x45d7('0x41')](_0x367d0b)['then'](handleEntityNotFound(_0x2a56f6,null))[_0x45d7('0x3a')](respondWithResult(_0x2a56f6,null))[_0x45d7('0x3e')](handleError(_0x2a56f6,null));};exports[_0x45d7('0x42')]=function(_0x1b9c75,_0x1e7f62){return db[_0x45d7('0x26')][_0x45d7('0x42')](_0x1b9c75[_0x45d7('0x43')],{})[_0x45d7('0x3a')](respondWithResult(_0x1e7f62,0xc9))[_0x45d7('0x3e')](handleError(_0x1e7f62,null));};exports['update']=function(_0x21ce5d,_0x9e1601){if(_0x21ce5d[_0x45d7('0x43')]['id']){delete _0x21ce5d[_0x45d7('0x43')]['id'];}return db[_0x45d7('0x26')][_0x45d7('0x41')]({'where':{'id':_0x21ce5d['params']['id']}})[_0x45d7('0x3a')](handleEntityNotFound(_0x9e1601,null))[_0x45d7('0x3a')](saveUpdates(_0x21ce5d[_0x45d7('0x43')],null))[_0x45d7('0x3a')](respondWithResult(_0x9e1601,null))[_0x45d7('0x3e')](handleError(_0x9e1601,null));};exports[_0x45d7('0x44')]=function(_0x5577f6,_0x4b8b9d){return db[_0x45d7('0x26')][_0x45d7('0x41')]({'where':{'id':_0x5577f6[_0x45d7('0x45')]['id']}})[_0x45d7('0x3a')](handleEntityNotFound(_0x4b8b9d,null))[_0x45d7('0x3a')](removeEntity(_0x4b8b9d,null))[_0x45d7('0x3e')](handleError(_0x4b8b9d,null));};exports['getFields']=function(_0x539116,_0xf6a5cb,_0x39af2a){var _0x1d3364={};var _0xbb9143={};var _0x3145a8;var _0x1b30bd;return db[_0x45d7('0x26')][_0x45d7('0x46')]({'where':{'id':_0x539116[_0x45d7('0x45')]['id']}})[_0x45d7('0x3a')](handleEntityNotFound(_0xf6a5cb,null))[_0x45d7('0x3a')](function(_0x94267c){if(_0x94267c){_0x3145a8=_0x94267c;_0xbb9143[_0x45d7('0x2b')]=_[_0x45d7('0x2c')](db['SalesforceField']['rawAttributes']);_0xbb9143[_0x45d7('0x2d')]=_[_0x45d7('0x2c')](_0x539116[_0x45d7('0x2d')]);_0xbb9143[_0x45d7('0x35')]=_['intersection'](_0xbb9143['model'],_0xbb9143[_0x45d7('0x2d')]);_0x1d3364[_0x45d7('0x2f')]=_[_0x45d7('0x2e')](_0xbb9143[_0x45d7('0x2b')],qs[_0x45d7('0x30')](_0x539116[_0x45d7('0x2d')]['fields']));_0x1d3364[_0x45d7('0x2f')]=_0x1d3364[_0x45d7('0x2f')][_0x45d7('0x31')]?_0x1d3364[_0x45d7('0x2f')]:_0xbb9143[_0x45d7('0x2b')];_0x1d3364[_0x45d7('0x47')]=qs[_0x45d7('0x34')](_0x539116[_0x45d7('0x2d')]['sort']);_0x1d3364['where']=qs[_0x45d7('0x35')](_[_0x45d7('0x48')](_0x539116[_0x45d7('0x2d')],_0xbb9143[_0x45d7('0x35')]));if(_0x539116[_0x45d7('0x2d')][_0x45d7('0x36')]){_0x1d3364[_0x45d7('0x37')]=_[_0x45d7('0x38')](_0x1d3364[_0x45d7('0x37')],{'$or':_[_0x45d7('0x25')](_0x1d3364[_0x45d7('0x2f')],function(_0x5a93a3){var _0x180a45={};_0x180a45[_0x5a93a3]={'$like':'%'+_0x539116[_0x45d7('0x2d')][_0x45d7('0x36')]+'%'};return _0x180a45;})});}_0x1d3364=_[_0x45d7('0x38')]({},_0x1d3364,_0x539116[_0x45d7('0x40')]);return _0x3145a8[_0x45d7('0x49')](_0x1d3364);}})[_0x45d7('0x3a')](function(_0x3d78f7){if(_0x3d78f7){_0x1b30bd=_0x3d78f7[_0x45d7('0x31')];if(!_0x539116['query'][_0x45d7('0x4a')](_0x45d7('0x32'))){_0x1d3364['limit']=qs[_0x45d7('0x33')](_0x539116['query'][_0x45d7('0x33')]);_0x1d3364[_0x45d7('0x1a')]=qs['offset'](_0x539116[_0x45d7('0x2d')][_0x45d7('0x1a')]);}return _0x3145a8[_0x45d7('0x49')](_0x1d3364);}})[_0x45d7('0x3a')](function(_0xd05ed9){if(_0xd05ed9){return _0xd05ed9?{'count':_0x1b30bd,'rows':_0xd05ed9}:null;}})[_0x45d7('0x3a')](respondWithResult(_0xf6a5cb,null))[_0x45d7('0x3e')](handleError(_0xf6a5cb,null));};exports[_0x45d7('0x4b')]=function(_0x55294d,_0x62582d,_0x5498d8){var _0x2feaaf={};var _0x2c6e97={};var _0x3f9bb8;var _0x53b69f;return db[_0x45d7('0x26')][_0x45d7('0x46')]({'where':{'id':_0x55294d[_0x45d7('0x45')]['id']}})[_0x45d7('0x3a')](handleEntityNotFound(_0x62582d,null))[_0x45d7('0x3a')](function(_0x40b7a3){if(_0x40b7a3){_0x3f9bb8=_0x40b7a3;_0x2c6e97[_0x45d7('0x2b')]=_[_0x45d7('0x2c')](db[_0x45d7('0x4c')]['rawAttributes']);_0x2c6e97[_0x45d7('0x2d')]=_['keys'](_0x55294d[_0x45d7('0x2d')]);_0x2c6e97[_0x45d7('0x35')]=_[_0x45d7('0x2e')](_0x2c6e97['model'],_0x2c6e97['query']);_0x2feaaf[_0x45d7('0x2f')]=_[_0x45d7('0x2e')](_0x2c6e97[_0x45d7('0x2b')],qs[_0x45d7('0x30')](_0x55294d[_0x45d7('0x2d')]['fields']));_0x2feaaf[_0x45d7('0x2f')]=_0x2feaaf['attributes'][_0x45d7('0x31')]?_0x2feaaf[_0x45d7('0x2f')]:_0x2c6e97[_0x45d7('0x2b')];_0x2feaaf[_0x45d7('0x47')]=qs['sort'](_0x55294d[_0x45d7('0x2d')][_0x45d7('0x34')]);_0x2feaaf[_0x45d7('0x37')]=qs[_0x45d7('0x35')](_[_0x45d7('0x48')](_0x55294d[_0x45d7('0x2d')],_0x2c6e97[_0x45d7('0x35')]));if(_0x55294d[_0x45d7('0x2d')]['filter']){_0x2feaaf[_0x45d7('0x37')]=_[_0x45d7('0x38')](_0x2feaaf[_0x45d7('0x37')],{'$or':_[_0x45d7('0x25')](_0x2feaaf['attributes'],function(_0x30b826){var _0x294eeb={};_0x294eeb[_0x30b826]={'$like':'%'+_0x55294d[_0x45d7('0x2d')]['filter']+'%'};return _0x294eeb;})});}_0x2feaaf=_[_0x45d7('0x38')]({},_0x2feaaf,_0x55294d[_0x45d7('0x40')]);return _0x3f9bb8['getSubjects'](_0x2feaaf);}})[_0x45d7('0x3a')](function(_0x378d10){if(_0x378d10){_0x53b69f=_0x378d10[_0x45d7('0x31')];if(!_0x55294d[_0x45d7('0x2d')][_0x45d7('0x4a')](_0x45d7('0x32'))){_0x2feaaf[_0x45d7('0x33')]=qs[_0x45d7('0x33')](_0x55294d['query'][_0x45d7('0x33')]);_0x2feaaf[_0x45d7('0x1a')]=qs[_0x45d7('0x1a')](_0x55294d['query']['offset']);}return _0x3f9bb8[_0x45d7('0x4b')](_0x2feaaf);}})[_0x45d7('0x3a')](function(_0x1a9133){if(_0x1a9133){return _0x1a9133?{'count':_0x53b69f,'rows':_0x1a9133}:null;}})['then'](respondWithResult(_0x62582d,null))[_0x45d7('0x3e')](handleError(_0x62582d,null));};exports[_0x45d7('0x4d')]=function(_0x4b6ba9,_0x2cc11f,_0x32b640){var _0x1990f9={};var _0xd53603={};var _0x3d8e24;var _0x34770b;return db['SalesforceConfiguration'][_0x45d7('0x46')]({'where':{'id':_0x4b6ba9[_0x45d7('0x45')]['id']}})['then'](handleEntityNotFound(_0x2cc11f,null))[_0x45d7('0x3a')](function(_0x54d3e2){if(_0x54d3e2){_0x3d8e24=_0x54d3e2;_0xd53603['model']=_['keys'](db[_0x45d7('0x4c')][_0x45d7('0x27')]);_0xd53603[_0x45d7('0x2d')]=_[_0x45d7('0x2c')](_0x4b6ba9['query']);_0xd53603[_0x45d7('0x35')]=_[_0x45d7('0x2e')](_0xd53603[_0x45d7('0x2b')],_0xd53603[_0x45d7('0x2d')]);_0x1990f9['attributes']=_[_0x45d7('0x2e')](_0xd53603['model'],qs[_0x45d7('0x30')](_0x4b6ba9[_0x45d7('0x2d')][_0x45d7('0x30')]));_0x1990f9['attributes']=_0x1990f9[_0x45d7('0x2f')][_0x45d7('0x31')]?_0x1990f9['attributes']:_0xd53603[_0x45d7('0x2b')];_0x1990f9['order']=qs[_0x45d7('0x34')](_0x4b6ba9[_0x45d7('0x2d')]['sort']);_0x1990f9[_0x45d7('0x37')]=qs[_0x45d7('0x35')](_[_0x45d7('0x48')](_0x4b6ba9[_0x45d7('0x2d')],_0xd53603[_0x45d7('0x35')]));if(_0x4b6ba9['query'][_0x45d7('0x36')]){_0x1990f9[_0x45d7('0x37')]=_[_0x45d7('0x38')](_0x1990f9[_0x45d7('0x37')],{'$or':_[_0x45d7('0x25')](_0x1990f9['attributes'],function(_0x335a83){var _0x2b982b={};_0x2b982b[_0x335a83]={'$like':'%'+_0x4b6ba9[_0x45d7('0x2d')]['filter']+'%'};return _0x2b982b;})});}_0x1990f9=_[_0x45d7('0x38')]({},_0x1990f9,_0x4b6ba9['options']);return _0x3d8e24[_0x45d7('0x4d')](_0x1990f9);}})[_0x45d7('0x3a')](function(_0x39000b){if(_0x39000b){_0x34770b=_0x39000b['length'];if(!_0x4b6ba9[_0x45d7('0x2d')][_0x45d7('0x4a')](_0x45d7('0x32'))){_0x1990f9['limit']=qs['limit'](_0x4b6ba9[_0x45d7('0x2d')][_0x45d7('0x33')]);_0x1990f9[_0x45d7('0x1a')]=qs['offset'](_0x4b6ba9[_0x45d7('0x2d')]['offset']);}return _0x3d8e24[_0x45d7('0x4d')](_0x1990f9);}})[_0x45d7('0x3a')](function(_0x1e8b95){if(_0x1e8b95){return _0x1e8b95?{'count':_0x34770b,'rows':_0x1e8b95}:null;}})[_0x45d7('0x3a')](respondWithResult(_0x2cc11f,null))[_0x45d7('0x3e')](handleError(_0x2cc11f,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 82b154f..7a96c5c 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 _0x72dd=['request-promise','path','./intSalesforceConfiguration.attributes','int_salesforce_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x32e138,_0x262511){var _0x53f70c=function(_0x2ad6d1){while(--_0x2ad6d1){_0x32e138['push'](_0x32e138['shift']());}};_0x53f70c(++_0x262511);}(_0x72dd,0x1ee));var _0xd72d=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x72dd[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xd72d('0x0'));var util=require(_0xd72d('0x1'));var logger=require(_0xd72d('0x2'))(_0xd72d('0x3'));var moment=require(_0xd72d('0x4'));var BPromise=require(_0xd72d('0x5'));var rp=require(_0xd72d('0x6'));var fs=require('fs');var path=require(_0xd72d('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd72d('0x8'));module['exports']=function(_0x1697a1,_0x5ebf36){return _0x1697a1['define']('SalesforceConfiguration',attributes,{'tableName':_0xd72d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x574a=['int_salesforce_configurations','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','define','SalesforceConfiguration'];(function(_0x334b0e,_0x441488){var _0x38b00d=function(_0x51edac){while(--_0x51edac){_0x334b0e['push'](_0x334b0e['shift']());}};_0x38b00d(++_0x441488);}(_0x574a,0x6d));var _0xa574=function(_0x5b1db2,_0x1755cb){_0x5b1db2=_0x5b1db2-0x0;var _0x4cd815=_0x574a[_0x5b1db2];return _0x4cd815;};'use strict';var _=require(_0xa574('0x0'));var util=require(_0xa574('0x1'));var logger=require(_0xa574('0x2'))(_0xa574('0x3'));var moment=require(_0xa574('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa574('0x5'));var rimraf=require(_0xa574('0x6'));var config=require(_0xa574('0x7'));var attributes=require(_0xa574('0x8'));module['exports']=function(_0x431974,_0x5931f7){return _0x431974[_0xa574('0x9')](_0xa574('0xa'),attributes,{'tableName':_0xa574('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 d2bae3b..312c225 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 _0x0f48=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch'];(function(_0x1b305b,_0x445d8d){var _0x3801f2=function(_0x98c4c5){while(--_0x98c4c5){_0x1b305b['push'](_0x1b305b['shift']());}};_0x3801f2(++_0x445d8d);}(_0x0f48,0x9a));var _0x80f4=function(_0xf332c8,_0x3f1e2a){_0xf332c8=_0xf332c8-0x0;var _0x38c0fb=_0x0f48[_0xf332c8];return _0x38c0fb;};'use strict';var _=require(_0x80f4('0x0'));var util=require(_0x80f4('0x1'));var moment=require(_0x80f4('0x2'));var BPromise=require(_0x80f4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x80f4('0x4'));var db=require(_0x80f4('0x5'))['db'];var utils=require(_0x80f4('0x6'));var logger=require(_0x80f4('0x7'))('rpc');var config=require(_0x80f4('0x8'));var jayson=require(_0x80f4('0x9'));var client=jayson[_0x80f4('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x39319c,_0x15b237,_0x2c9b8e){return new BPromise(function(_0x1045db,_0x566314){return client[_0x80f4('0xb')](_0x39319c,_0x2c9b8e)[_0x80f4('0xc')](function(_0x17755a){logger[_0x80f4('0xd')](_0x80f4('0xe'),_0x15b237,_0x80f4('0xf'));logger[_0x80f4('0x10')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x15b237,'request\x20sent',JSON[_0x80f4('0x11')](_0x17755a));if(_0x17755a[_0x80f4('0x12')]){if(_0x17755a[_0x80f4('0x12')]['code']===0x1f4){logger[_0x80f4('0x12')](_0x80f4('0xe'),_0x15b237,_0x17755a[_0x80f4('0x12')][_0x80f4('0x13')]);return _0x566314(_0x17755a['error'][_0x80f4('0x13')]);}logger[_0x80f4('0x12')](_0x80f4('0xe'),_0x15b237,_0x17755a[_0x80f4('0x12')][_0x80f4('0x13')]);return _0x1045db(_0x17755a[_0x80f4('0x12')][_0x80f4('0x13')]);}else{logger[_0x80f4('0xd')](_0x80f4('0xe'),_0x15b237,_0x80f4('0xf'));_0x1045db(_0x17755a[_0x80f4('0x14')][_0x80f4('0x13')]);}})[_0x80f4('0x15')](function(_0x2de8c7){logger[_0x80f4('0x12')](_0x80f4('0xe'),_0x15b237,_0x2de8c7);_0x566314(_0x2de8c7);});});} \ No newline at end of file +var _0x4250=['../../config/utils','../../config/environment','jayson/promise','request','request\x20sent','stringify','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x5d6c31,_0x45a12c){var _0x52a842=function(_0x5a3042){while(--_0x5a3042){_0x5d6c31['push'](_0x5d6c31['shift']());}};_0x52a842(++_0x45a12c);}(_0x4250,0xde));var _0x0425=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x4250[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x0425('0x0'));var util=require(_0x0425('0x1'));var moment=require(_0x0425('0x2'));var BPromise=require(_0x0425('0x3'));var rs=require(_0x0425('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0425('0x5'))['db'];var utils=require(_0x0425('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x0425('0x7'));var jayson=require(_0x0425('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x28c19b,_0x44484a,_0x301447){return new BPromise(function(_0x35bc2a,_0x269c5d){return client[_0x0425('0x9')](_0x28c19b,_0x301447)['then'](function(_0x1f624e){logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x44484a,_0x0425('0xa'));logger['debug']('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x44484a,_0x0425('0xa'),JSON[_0x0425('0xb')](_0x1f624e));if(_0x1f624e[_0x0425('0xc')]){if(_0x1f624e[_0x0425('0xc')][_0x0425('0xd')]===0x1f4){logger[_0x0425('0xc')](_0x0425('0xe'),_0x44484a,_0x1f624e[_0x0425('0xc')][_0x0425('0xf')]);return _0x269c5d(_0x1f624e[_0x0425('0xc')][_0x0425('0xf')]);}logger[_0x0425('0xc')]('SalesforceConfiguration,\x20%s,\x20%s',_0x44484a,_0x1f624e['error'][_0x0425('0xf')]);return _0x35bc2a(_0x1f624e[_0x0425('0xc')]['message']);}else{logger[_0x0425('0x10')]('SalesforceConfiguration,\x20%s,\x20%s',_0x44484a,'request\x20sent');_0x35bc2a(_0x1f624e[_0x0425('0x11')][_0x0425('0xf')]);}})[_0x0425('0x12')](function(_0x2c8ad3){logger[_0x0425('0xc')]('SalesforceConfiguration,\x20%s,\x20%s',_0x44484a,_0x2c8ad3);_0x269c5d(_0x2c8ad3);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 40846af..6a0ba82 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 _0x162f=['update','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceField.controller','get','index','/:id','show','post','isAuthenticated','create','put'];(function(_0xc673a3,_0x5354c9){var _0x56b292=function(_0x4755d3){while(--_0x4755d3){_0xc673a3['push'](_0xc673a3['shift']());}};_0x56b292(++_0x5354c9);}(_0x162f,0x75));var _0xf162=function(_0x22d105,_0xd381d2){_0x22d105=_0x22d105-0x0;var _0x4455bb=_0x162f[_0x22d105];return _0x4455bb;};'use strict';var multer=require('multer');var util=require(_0xf162('0x0'));var path=require('path');var timeout=require(_0xf162('0x1'));var express=require(_0xf162('0x2'));var router=express[_0xf162('0x3')]();var fs_extra=require(_0xf162('0x4'));var auth=require(_0xf162('0x5'));var interaction=require(_0xf162('0x6'));var config=require('../../config/environment');var controller=require(_0xf162('0x7'));router[_0xf162('0x8')]('/',auth['isAuthenticated'](),controller[_0xf162('0x9')]);router['get'](_0xf162('0xa'),auth['isAuthenticated'](),controller[_0xf162('0xb')]);router[_0xf162('0xc')]('/',auth[_0xf162('0xd')](),controller[_0xf162('0xe')]);router[_0xf162('0xf')](_0xf162('0xa'),auth[_0xf162('0xd')](),controller[_0xf162('0x10')]);router['delete'](_0xf162('0xa'),auth[_0xf162('0xd')](),controller[_0xf162('0x11')]);module[_0xf162('0x12')]=router; \ No newline at end of file +var _0xf4a2=['connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','multer','util','path'];(function(_0x51c725,_0xe6a56e){var _0x51c0fa=function(_0x42a166){while(--_0x42a166){_0x51c725['push'](_0x51c725['shift']());}};_0x51c0fa(++_0xe6a56e);}(_0xf4a2,0x13d));var _0x2f4a=function(_0x2ade6c,_0x2d42f2){_0x2ade6c=_0x2ade6c-0x0;var _0x2cb372=_0xf4a2[_0x2ade6c];return _0x2cb372;};'use strict';var multer=require(_0x2f4a('0x0'));var util=require(_0x2f4a('0x1'));var path=require(_0x2f4a('0x2'));var timeout=require(_0x2f4a('0x3'));var express=require(_0x2f4a('0x4'));var router=express['Router']();var fs_extra=require(_0x2f4a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2f4a('0x6'));var config=require(_0x2f4a('0x7'));var controller=require(_0x2f4a('0x8'));router[_0x2f4a('0x9')]('/',auth[_0x2f4a('0xa')](),controller[_0x2f4a('0xb')]);router['get'](_0x2f4a('0xc'),auth[_0x2f4a('0xa')](),controller[_0x2f4a('0xd')]);router[_0x2f4a('0xe')]('/',auth[_0x2f4a('0xa')](),controller[_0x2f4a('0xf')]);router[_0x2f4a('0x10')](_0x2f4a('0xc'),auth['isAuthenticated'](),controller[_0x2f4a('0x11')]);router[_0x2f4a('0x12')](_0x2f4a('0xc'),auth[_0x2f4a('0xa')](),controller[_0x2f4a('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 142672f..b2c37bb 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 _0x61f0=['variable','customVariable','keyValue','picklist','STRING','sequelize','exports','ENUM','string'];(function(_0x574377,_0x29f805){var _0x224202=function(_0x365772){while(--_0x365772){_0x574377['push'](_0x574377['shift']());}};_0x224202(++_0x29f805);}(_0x61f0,0xc2));var _0x061f=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x61f0[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0x061f('0x0'));module[_0x061f('0x1')]={'type':{'type':Sequelize[_0x061f('0x2')](_0x061f('0x3'),_0x061f('0x4'),_0x061f('0x5'),_0x061f('0x6'),_0x061f('0x7')),'defaultValue':_0x061f('0x3')},'content':{'type':Sequelize[_0x061f('0x8')]},'key':{'type':Sequelize[_0x061f('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0x061f('0x3'),_0x061f('0x4'),_0x061f('0x5'))},'keyContent':{'type':Sequelize[_0x061f('0x8')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x061f('0x8')]}}; \ No newline at end of file +var _0xc463=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x2906dc,_0x2caecf){var _0xcb915a=function(_0x8ad1b3){while(--_0x8ad1b3){_0x2906dc['push'](_0x2906dc['shift']());}};_0xcb915a(++_0x2caecf);}(_0xc463,0x129));var _0x3c46=function(_0xb12603,_0x142505){_0xb12603=_0xb12603-0x0;var _0x2bdc24=_0xc463[_0xb12603];return _0x2bdc24;};'use strict';var Sequelize=require(_0x3c46('0x0'));module[_0x3c46('0x1')]={'type':{'type':Sequelize[_0x3c46('0x2')](_0x3c46('0x3'),_0x3c46('0x4'),_0x3c46('0x5'),_0x3c46('0x6'),_0x3c46('0x7')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x3c46('0x2')](_0x3c46('0x3'),_0x3c46('0x4'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x3c46('0x8')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 59ecfa6..ffc4c2e 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 _0xeed7=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','SalesforceField','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','filter','merge','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0xeed7,0x12b));var _0x7eed=function(_0x1d730b,_0x36a559){_0x1d730b=_0x1d730b-0x0;var _0x23fad6=_0xeed7[_0x1d730b];return _0x23fad6;};'use strict';var emlformat=require(_0x7eed('0x0'));var rimraf=require(_0x7eed('0x1'));var zipdir=require(_0x7eed('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7eed('0x3'));var moment=require(_0x7eed('0x4'));var BPromise=require(_0x7eed('0x5'));var Mustache=require(_0x7eed('0x6'));var util=require(_0x7eed('0x7'));var path=require(_0x7eed('0x8'));var sox=require(_0x7eed('0x9'));var csv=require(_0x7eed('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7eed('0xb'));var squel=require(_0x7eed('0xc'));var crypto=require(_0x7eed('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7eed('0xe'));var toCsv=require(_0x7eed('0xa'));var querystring=require(_0x7eed('0xf'));var Papa=require(_0x7eed('0x10'));var Redis=require('ioredis');var authService=require(_0x7eed('0x11'));var qs=require(_0x7eed('0x12'));var as=require(_0x7eed('0x13'));var hardwareService=require(_0x7eed('0x14'));var logger=require(_0x7eed('0x15'))(_0x7eed('0x16'));var utils=require(_0x7eed('0x17'));var config=require(_0x7eed('0x18'));var licenseUtil=require(_0x7eed('0x19'));var db=require(_0x7eed('0x1a'))['db'];function respondWithStatusCode(_0x393f57,_0x5816ce){_0x5816ce=_0x5816ce||0xcc;return function(_0x434f2f){if(_0x434f2f){return _0x393f57[_0x7eed('0x1b')](_0x5816ce);}return _0x393f57[_0x7eed('0x1c')](_0x5816ce)[_0x7eed('0x1d')]();};}function respondWithResult(_0x17f5f0,_0x148be9){_0x148be9=_0x148be9||0xc8;return function(_0x44b6fd){if(_0x44b6fd){return _0x17f5f0[_0x7eed('0x1c')](_0x148be9)[_0x7eed('0x1e')](_0x44b6fd);}};}function respondWithFilteredResult(_0x4990d7,_0x145e0a){return function(_0x4600fb){if(_0x4600fb){var _0x34d10d=typeof _0x145e0a[_0x7eed('0x1f')]==='undefined'&&typeof _0x145e0a['limit']===_0x7eed('0x20');var _0x404684=_0x4600fb[_0x7eed('0x21')];var _0xb1b7e6=_0x34d10d?0x0:_0x145e0a[_0x7eed('0x1f')];var _0x127253=_0x34d10d?_0x4600fb[_0x7eed('0x21')]:_0x145e0a[_0x7eed('0x1f')]+_0x145e0a[_0x7eed('0x22')];var _0x201d66;if(_0x127253>=_0x404684){_0x127253=_0x404684;_0x201d66=0xc8;}else{_0x201d66=0xce;}_0x4990d7[_0x7eed('0x1c')](_0x201d66);return _0x4990d7[_0x7eed('0x23')](_0x7eed('0x24'),_0xb1b7e6+'-'+_0x127253+'/'+_0x404684)[_0x7eed('0x1e')](_0x4600fb);}return null;};}function patchUpdates(_0x3d4481){return function(_0x5e73a0){try{jsonpatch[_0x7eed('0x25')](_0x5e73a0,_0x3d4481,!![]);}catch(_0x4b3c1f){return BPromise[_0x7eed('0x26')](_0x4b3c1f);}return _0x5e73a0[_0x7eed('0x27')]();};}function saveUpdates(_0x401e1b,_0x166d24){return function(_0x3b6e4d){if(_0x3b6e4d){return _0x3b6e4d[_0x7eed('0x28')](_0x401e1b)[_0x7eed('0x29')](function(_0x345d37){return _0x345d37;});}return null;};}function removeEntity(_0xe7d5b4,_0x1fef4c){return function(_0x35bc28){if(_0x35bc28){return _0x35bc28['destroy']()['then'](function(){_0xe7d5b4[_0x7eed('0x1c')](0xcc)[_0x7eed('0x1d')]();});}};}function handleEntityNotFound(_0x998de7,_0x11ffcf){return function(_0x193283){if(!_0x193283){_0x998de7[_0x7eed('0x1b')](0x194);}return _0x193283;};}function handleError(_0x274fc1,_0x55f05c){_0x55f05c=_0x55f05c||0x1f4;return function(_0x45b0c7){logger[_0x7eed('0x2a')](_0x45b0c7[_0x7eed('0x2b')]);if(_0x45b0c7[_0x7eed('0x2c')]){delete _0x45b0c7[_0x7eed('0x2c')];}_0x274fc1[_0x7eed('0x1c')](_0x55f05c)[_0x7eed('0x2d')](_0x45b0c7);};}exports[_0x7eed('0x2e')]=function(_0x384c0f,_0x22ff6c){var _0x5a47c6={},_0x554ad2={},_0x309bf6={'count':0x0,'rows':[]};var _0x548c2d=_[_0x7eed('0x2f')](db[_0x7eed('0x30')][_0x7eed('0x31')],function(_0x4f2c9d){return{'name':_0x4f2c9d[_0x7eed('0x32')],'type':_0x4f2c9d[_0x7eed('0x33')]['key']};});_0x554ad2[_0x7eed('0x34')]=_[_0x7eed('0x2f')](_0x548c2d,_0x7eed('0x2c'));_0x554ad2[_0x7eed('0x35')]=_['keys'](_0x384c0f['query']);_0x554ad2[_0x7eed('0x36')]=_[_0x7eed('0x37')](_0x554ad2[_0x7eed('0x34')],_0x554ad2[_0x7eed('0x35')]);_0x5a47c6[_0x7eed('0x38')]=_[_0x7eed('0x37')](_0x554ad2[_0x7eed('0x34')],qs['fields'](_0x384c0f[_0x7eed('0x35')][_0x7eed('0x39')]));_0x5a47c6[_0x7eed('0x38')]=_0x5a47c6['attributes'][_0x7eed('0x3a')]?_0x5a47c6[_0x7eed('0x38')]:_0x554ad2['model'];if(!_0x384c0f['query'][_0x7eed('0x3b')](_0x7eed('0x3c'))){_0x5a47c6[_0x7eed('0x22')]=qs[_0x7eed('0x22')](_0x384c0f[_0x7eed('0x35')][_0x7eed('0x22')]);_0x5a47c6['offset']=qs[_0x7eed('0x1f')](_0x384c0f[_0x7eed('0x35')]['offset']);}_0x5a47c6[_0x7eed('0x3d')]=qs[_0x7eed('0x3e')](_0x384c0f[_0x7eed('0x35')][_0x7eed('0x3e')]);_0x5a47c6['where']=qs[_0x7eed('0x36')](_[_0x7eed('0x3f')](_0x384c0f[_0x7eed('0x35')],_0x554ad2[_0x7eed('0x36')]),_0x548c2d);if(_0x384c0f[_0x7eed('0x35')]['filter']){_0x5a47c6[_0x7eed('0x40')]=_['merge'](_0x5a47c6[_0x7eed('0x40')],{'$or':_['map'](_0x548c2d,function(_0x455e65){if(_0x455e65[_0x7eed('0x33')]!=='VIRTUAL'){var _0x5a0805={};_0x5a0805[_0x455e65['name']]={'$like':'%'+_0x384c0f[_0x7eed('0x35')][_0x7eed('0x41')]+'%'};return _0x5a0805;}})});}_0x5a47c6=_[_0x7eed('0x42')]({},_0x5a47c6,_0x384c0f['options']);var _0x3ba74e={'where':_0x5a47c6[_0x7eed('0x40')]};return db[_0x7eed('0x30')]['count'](_0x3ba74e)['then'](function(_0x34100d){_0x309bf6['count']=_0x34100d;if(_0x384c0f[_0x7eed('0x35')][_0x7eed('0x43')]){_0x5a47c6[_0x7eed('0x44')]=[{'all':!![]}];}return db[_0x7eed('0x30')][_0x7eed('0x45')](_0x5a47c6);})[_0x7eed('0x29')](function(_0x2a947b){_0x309bf6[_0x7eed('0x46')]=_0x2a947b;return _0x309bf6;})[_0x7eed('0x29')](respondWithFilteredResult(_0x22ff6c,_0x5a47c6))[_0x7eed('0x47')](handleError(_0x22ff6c,null));};exports[_0x7eed('0x48')]=function(_0x1fe534,_0x1e6a40){var _0x40b791={'raw':!![],'where':{'id':_0x1fe534[_0x7eed('0x49')]['id']}},_0x2c24ac={};_0x2c24ac[_0x7eed('0x34')]=_[_0x7eed('0x4a')](db[_0x7eed('0x30')][_0x7eed('0x31')]);_0x2c24ac[_0x7eed('0x35')]=_[_0x7eed('0x4a')](_0x1fe534[_0x7eed('0x35')]);_0x2c24ac['filters']=_[_0x7eed('0x37')](_0x2c24ac['model'],_0x2c24ac[_0x7eed('0x35')]);_0x40b791['attributes']=_['intersection'](_0x2c24ac[_0x7eed('0x34')],qs[_0x7eed('0x39')](_0x1fe534[_0x7eed('0x35')][_0x7eed('0x39')]));_0x40b791[_0x7eed('0x38')]=_0x40b791[_0x7eed('0x38')][_0x7eed('0x3a')]?_0x40b791[_0x7eed('0x38')]:_0x2c24ac[_0x7eed('0x34')];if(_0x1fe534['query'][_0x7eed('0x43')]){_0x40b791[_0x7eed('0x44')]=[{'all':!![]}];}_0x40b791=_[_0x7eed('0x42')]({},_0x40b791,_0x1fe534[_0x7eed('0x4b')]);return db[_0x7eed('0x30')][_0x7eed('0x4c')](_0x40b791)['then'](handleEntityNotFound(_0x1e6a40,null))[_0x7eed('0x29')](respondWithResult(_0x1e6a40,null))['catch'](handleError(_0x1e6a40,null));};exports[_0x7eed('0x4d')]=function(_0x2946bc,_0x1e9576){return db[_0x7eed('0x30')][_0x7eed('0x4d')](_0x2946bc[_0x7eed('0x4e')],{})[_0x7eed('0x29')](respondWithResult(_0x1e9576,0xc9))[_0x7eed('0x47')](handleError(_0x1e9576,null));};exports[_0x7eed('0x28')]=function(_0x32fb51,_0xb8ee60){if(_0x32fb51[_0x7eed('0x4e')]['id']){delete _0x32fb51[_0x7eed('0x4e')]['id'];}return db['SalesforceField'][_0x7eed('0x4c')]({'where':{'id':_0x32fb51[_0x7eed('0x49')]['id']}})['then'](handleEntityNotFound(_0xb8ee60,null))[_0x7eed('0x29')](saveUpdates(_0x32fb51[_0x7eed('0x4e')],null))['then'](respondWithResult(_0xb8ee60,null))[_0x7eed('0x47')](handleError(_0xb8ee60,null));};exports[_0x7eed('0x4f')]=function(_0x4edfd7,_0x26807f){return db[_0x7eed('0x30')]['find']({'where':{'id':_0x4edfd7[_0x7eed('0x49')]['id']}})['then'](handleEntityNotFound(_0x26807f,null))[_0x7eed('0x29')](removeEntity(_0x26807f,null))[_0x7eed('0x47')](handleError(_0x26807f,null));}; \ No newline at end of file +var _0x5c29=['hasOwnProperty','order','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','sendStatus','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','SalesforceField','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','fields','attributes','length'];(function(_0x3015f9,_0x6eeb0d){var _0x3390b6=function(_0x4cff57){while(--_0x4cff57){_0x3015f9['push'](_0x3015f9['shift']());}};_0x3390b6(++_0x6eeb0d);}(_0x5c29,0x17c));var _0x95c2=function(_0xffb7ce,_0x59404b){_0xffb7ce=_0xffb7ce-0x0;var _0x321b64=_0x5c29[_0xffb7ce];return _0x321b64;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x95c2('0x0'));var zipdir=require(_0x95c2('0x1'));var jsonpatch=require(_0x95c2('0x2'));var rp=require(_0x95c2('0x3'));var moment=require(_0x95c2('0x4'));var BPromise=require(_0x95c2('0x5'));var Mustache=require('mustache');var util=require(_0x95c2('0x6'));var path=require('path');var sox=require(_0x95c2('0x7'));var csv=require(_0x95c2('0x8'));var ejs=require(_0x95c2('0x9'));var fs=require('fs');var fs_extra=require(_0x95c2('0xa'));var _=require(_0x95c2('0xb'));var squel=require('squel');var crypto=require(_0x95c2('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x95c2('0xd'));var toCsv=require(_0x95c2('0x8'));var querystring=require(_0x95c2('0xe'));var Papa=require(_0x95c2('0xf'));var Redis=require(_0x95c2('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x95c2('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x95c2('0x12'));var logger=require('../../config/logger')(_0x95c2('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb63b30,_0x3fee19){_0x3fee19=_0x3fee19||0xcc;return function(_0x1797c5){if(_0x1797c5){return _0xb63b30[_0x95c2('0x14')](_0x3fee19);}return _0xb63b30['status'](_0x3fee19)['end']();};}function respondWithResult(_0x45a865,_0x73c36b){_0x73c36b=_0x73c36b||0xc8;return function(_0x2fd30c){if(_0x2fd30c){return _0x45a865['status'](_0x73c36b)[_0x95c2('0x15')](_0x2fd30c);}};}function respondWithFilteredResult(_0x59912e,_0x340074){return function(_0x1b5524){if(_0x1b5524){var _0x437517=typeof _0x340074[_0x95c2('0x16')]===_0x95c2('0x17')&&typeof _0x340074[_0x95c2('0x18')]===_0x95c2('0x17');var _0x9ed906=_0x1b5524[_0x95c2('0x19')];var _0x32f88f=_0x437517?0x0:_0x340074['offset'];var _0x4d5592=_0x437517?_0x1b5524[_0x95c2('0x19')]:_0x340074[_0x95c2('0x16')]+_0x340074['limit'];var _0x46e6fc;if(_0x4d5592>=_0x9ed906){_0x4d5592=_0x9ed906;_0x46e6fc=0xc8;}else{_0x46e6fc=0xce;}_0x59912e[_0x95c2('0x1a')](_0x46e6fc);return _0x59912e[_0x95c2('0x1b')](_0x95c2('0x1c'),_0x32f88f+'-'+_0x4d5592+'/'+_0x9ed906)['json'](_0x1b5524);}return null;};}function patchUpdates(_0x41ea2a){return function(_0x300817){try{jsonpatch[_0x95c2('0x1d')](_0x300817,_0x41ea2a,!![]);}catch(_0xfda6d8){return BPromise[_0x95c2('0x1e')](_0xfda6d8);}return _0x300817[_0x95c2('0x1f')]();};}function saveUpdates(_0x260b82,_0x44e4f4){return function(_0x596fd5){if(_0x596fd5){return _0x596fd5[_0x95c2('0x20')](_0x260b82)[_0x95c2('0x21')](function(_0x171fcd){return _0x171fcd;});}return null;};}function removeEntity(_0x1adc75,_0x226b3c){return function(_0x21df9f){if(_0x21df9f){return _0x21df9f[_0x95c2('0x22')]()[_0x95c2('0x21')](function(){_0x1adc75[_0x95c2('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ef1d4,_0x3563e7){return function(_0x4ede3d){if(!_0x4ede3d){_0x3ef1d4[_0x95c2('0x14')](0x194);}return _0x4ede3d;};}function handleError(_0x3ec66e,_0x55baa4){_0x55baa4=_0x55baa4||0x1f4;return function(_0xe6785c){logger[_0x95c2('0x23')](_0xe6785c['stack']);if(_0xe6785c['name']){delete _0xe6785c[_0x95c2('0x24')];}_0x3ec66e[_0x95c2('0x1a')](_0x55baa4)[_0x95c2('0x25')](_0xe6785c);};}exports[_0x95c2('0x26')]=function(_0x12f285,_0x325a8d){var _0xeda100={},_0x5911ab={},_0x4383a6={'count':0x0,'rows':[]};var _0x183bde=_['map'](db[_0x95c2('0x27')][_0x95c2('0x28')],function(_0x47c827){return{'name':_0x47c827[_0x95c2('0x29')],'type':_0x47c827['type'][_0x95c2('0x2a')]};});_0x5911ab[_0x95c2('0x2b')]=_[_0x95c2('0x2c')](_0x183bde,_0x95c2('0x24'));_0x5911ab['query']=_[_0x95c2('0x2d')](_0x12f285[_0x95c2('0x2e')]);_0x5911ab[_0x95c2('0x2f')]=_[_0x95c2('0x30')](_0x5911ab[_0x95c2('0x2b')],_0x5911ab[_0x95c2('0x2e')]);_0xeda100['attributes']=_[_0x95c2('0x30')](_0x5911ab[_0x95c2('0x2b')],qs[_0x95c2('0x31')](_0x12f285[_0x95c2('0x2e')][_0x95c2('0x31')]));_0xeda100[_0x95c2('0x32')]=_0xeda100['attributes'][_0x95c2('0x33')]?_0xeda100[_0x95c2('0x32')]:_0x5911ab[_0x95c2('0x2b')];if(!_0x12f285[_0x95c2('0x2e')][_0x95c2('0x34')]('nolimit')){_0xeda100[_0x95c2('0x18')]=qs[_0x95c2('0x18')](_0x12f285['query'][_0x95c2('0x18')]);_0xeda100[_0x95c2('0x16')]=qs[_0x95c2('0x16')](_0x12f285['query'][_0x95c2('0x16')]);}_0xeda100[_0x95c2('0x35')]=qs['sort'](_0x12f285['query'][_0x95c2('0x36')]);_0xeda100['where']=qs[_0x95c2('0x2f')](_[_0x95c2('0x37')](_0x12f285[_0x95c2('0x2e')],_0x5911ab['filters']),_0x183bde);if(_0x12f285['query'][_0x95c2('0x38')]){_0xeda100[_0x95c2('0x39')]=_['merge'](_0xeda100['where'],{'$or':_[_0x95c2('0x2c')](_0x183bde,function(_0x288203){if(_0x288203[_0x95c2('0x3a')]!==_0x95c2('0x3b')){var _0x26e53d={};_0x26e53d[_0x288203[_0x95c2('0x24')]]={'$like':'%'+_0x12f285[_0x95c2('0x2e')]['filter']+'%'};return _0x26e53d;}})});}_0xeda100=_[_0x95c2('0x3c')]({},_0xeda100,_0x12f285[_0x95c2('0x3d')]);var _0x3be1ed={'where':_0xeda100['where']};return db[_0x95c2('0x27')][_0x95c2('0x19')](_0x3be1ed)[_0x95c2('0x21')](function(_0x1db6d7){_0x4383a6['count']=_0x1db6d7;if(_0x12f285[_0x95c2('0x2e')][_0x95c2('0x3e')]){_0xeda100[_0x95c2('0x3f')]=[{'all':!![]}];}return db[_0x95c2('0x27')][_0x95c2('0x40')](_0xeda100);})[_0x95c2('0x21')](function(_0x23a1b7){_0x4383a6[_0x95c2('0x41')]=_0x23a1b7;return _0x4383a6;})['then'](respondWithFilteredResult(_0x325a8d,_0xeda100))[_0x95c2('0x42')](handleError(_0x325a8d,null));};exports[_0x95c2('0x43')]=function(_0x552a7e,_0x1d8be1){var _0xf97eb0={'raw':!![],'where':{'id':_0x552a7e[_0x95c2('0x44')]['id']}},_0x70581e={};_0x70581e['model']=_[_0x95c2('0x2d')](db[_0x95c2('0x27')]['rawAttributes']);_0x70581e[_0x95c2('0x2e')]=_[_0x95c2('0x2d')](_0x552a7e[_0x95c2('0x2e')]);_0x70581e[_0x95c2('0x2f')]=_['intersection'](_0x70581e['model'],_0x70581e[_0x95c2('0x2e')]);_0xf97eb0[_0x95c2('0x32')]=_[_0x95c2('0x30')](_0x70581e[_0x95c2('0x2b')],qs[_0x95c2('0x31')](_0x552a7e['query'][_0x95c2('0x31')]));_0xf97eb0[_0x95c2('0x32')]=_0xf97eb0['attributes'][_0x95c2('0x33')]?_0xf97eb0[_0x95c2('0x32')]:_0x70581e['model'];if(_0x552a7e[_0x95c2('0x2e')]['includeAll']){_0xf97eb0['include']=[{'all':!![]}];}_0xf97eb0=_['merge']({},_0xf97eb0,_0x552a7e[_0x95c2('0x3d')]);return db['SalesforceField'][_0x95c2('0x45')](_0xf97eb0)[_0x95c2('0x21')](handleEntityNotFound(_0x1d8be1,null))[_0x95c2('0x21')](respondWithResult(_0x1d8be1,null))['catch'](handleError(_0x1d8be1,null));};exports[_0x95c2('0x46')]=function(_0x3bb711,_0x5e9397){return db[_0x95c2('0x27')][_0x95c2('0x46')](_0x3bb711[_0x95c2('0x47')],{})['then'](respondWithResult(_0x5e9397,0xc9))['catch'](handleError(_0x5e9397,null));};exports['update']=function(_0x4c3b67,_0x1afdce){if(_0x4c3b67[_0x95c2('0x47')]['id']){delete _0x4c3b67[_0x95c2('0x47')]['id'];}return db[_0x95c2('0x27')][_0x95c2('0x45')]({'where':{'id':_0x4c3b67[_0x95c2('0x44')]['id']}})[_0x95c2('0x21')](handleEntityNotFound(_0x1afdce,null))['then'](saveUpdates(_0x4c3b67[_0x95c2('0x47')],null))['then'](respondWithResult(_0x1afdce,null))['catch'](handleError(_0x1afdce,null));};exports['destroy']=function(_0x36408b,_0x7e4a36){return db[_0x95c2('0x27')]['find']({'where':{'id':_0x36408b[_0x95c2('0x44')]['id']}})[_0x95c2('0x21')](handleEntityNotFound(_0x7e4a36,null))[_0x95c2('0x21')](removeEntity(_0x7e4a36,null))[_0x95c2('0x42')](handleError(_0x7e4a36,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index ee5bec7..a37c0f6 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 _0xd5dc=['salesforce_unique_index','idField','FieldId','lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment','exports','define','SalesforceField','int_salesforce_fields'];(function(_0x45af30,_0x7c6ab2){var _0x20313b=function(_0x4d3e89){while(--_0x4d3e89){_0x45af30['push'](_0x45af30['shift']());}};_0x20313b(++_0x7c6ab2);}(_0xd5dc,0x199));var _0xcd5d=function(_0x2e8712,_0x2edf5e){_0x2e8712=_0x2e8712-0x0;var _0x1c5357=_0xd5dc[_0x2e8712];return _0x1c5357;};'use strict';var _=require(_0xcd5d('0x0'));var util=require('util');var logger=require(_0xcd5d('0x1'))(_0xcd5d('0x2'));var moment=require('moment');var BPromise=require(_0xcd5d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcd5d('0x4'));var rimraf=require(_0xcd5d('0x5'));var config=require(_0xcd5d('0x6'));var attributes=require('./intSalesforceField.attributes');module[_0xcd5d('0x7')]=function(_0x1b72b5,_0x4723d4){return _0x1b72b5[_0xcd5d('0x8')](_0xcd5d('0x9'),attributes,{'tableName':_0xcd5d('0xa'),'paranoid':![],'indexes':[{'name':_0xcd5d('0xb'),'fields':[_0xcd5d('0xc'),_0xcd5d('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x28c8=['exports','define','salesforce_unique_index','idField','FieldId','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes'];(function(_0x501e3c,_0xb5b9b9){var _0x5b9d8f=function(_0x5cc828){while(--_0x5cc828){_0x501e3c['push'](_0x501e3c['shift']());}};_0x5b9d8f(++_0xb5b9b9);}(_0x28c8,0x7d));var _0x828c=function(_0x4e6eb2,_0x16a451){_0x4e6eb2=_0x4e6eb2-0x0;var _0x4e0c1c=_0x28c8[_0x4e6eb2];return _0x4e0c1c;};'use strict';var _=require(_0x828c('0x0'));var util=require(_0x828c('0x1'));var logger=require('../../config/logger')(_0x828c('0x2'));var moment=require(_0x828c('0x3'));var BPromise=require(_0x828c('0x4'));var rp=require(_0x828c('0x5'));var fs=require('fs');var path=require(_0x828c('0x6'));var rimraf=require(_0x828c('0x7'));var config=require(_0x828c('0x8'));var attributes=require(_0x828c('0x9'));module[_0x828c('0xa')]=function(_0x72759,_0x631625){return _0x72759[_0x828c('0xb')]('SalesforceField',attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x828c('0xc'),'fields':[_0x828c('0xd'),_0x828c('0xe')],'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 e1412c3..b3749b2 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 _0xb8d5=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceField,\x20%s,\x20%s','stringify','error','code','message','result','util','moment'];(function(_0x4f6888,_0x4f4cea){var _0xf83e3=function(_0x29cfae){while(--_0x29cfae){_0x4f6888['push'](_0x4f6888['shift']());}};_0xf83e3(++_0x4f4cea);}(_0xb8d5,0x1a2));var _0x5b8d=function(_0x4a8d6b,_0x3eb452){_0x4a8d6b=_0x4a8d6b-0x0;var _0x3c9a04=_0xb8d5[_0x4a8d6b];return _0x3c9a04;};'use strict';var _=require('lodash');var util=require(_0x5b8d('0x0'));var moment=require(_0x5b8d('0x1'));var BPromise=require('bluebird');var rs=require(_0x5b8d('0x2'));var fs=require('fs');var Redis=require(_0x5b8d('0x3'));var db=require(_0x5b8d('0x4'))['db'];var utils=require(_0x5b8d('0x5'));var logger=require(_0x5b8d('0x6'))(_0x5b8d('0x7'));var config=require(_0x5b8d('0x8'));var jayson=require(_0x5b8d('0x9'));var client=jayson[_0x5b8d('0xa')][_0x5b8d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x18a827,_0x555c4e,_0x10a0bc){return new BPromise(function(_0x427543,_0x228052){return client[_0x5b8d('0xc')](_0x18a827,_0x10a0bc)[_0x5b8d('0xd')](function(_0x4e649a){logger[_0x5b8d('0xe')](_0x5b8d('0xf'),_0x555c4e,'request\x20sent');logger['debug']('SalesforceField,\x20%s,\x20%s,\x20%s',_0x555c4e,'request\x20sent',JSON[_0x5b8d('0x10')](_0x4e649a));if(_0x4e649a['error']){if(_0x4e649a[_0x5b8d('0x11')][_0x5b8d('0x12')]===0x1f4){logger[_0x5b8d('0x11')]('SalesforceField,\x20%s,\x20%s',_0x555c4e,_0x4e649a[_0x5b8d('0x11')]['message']);return _0x228052(_0x4e649a[_0x5b8d('0x11')][_0x5b8d('0x13')]);}logger[_0x5b8d('0x11')]('SalesforceField,\x20%s,\x20%s',_0x555c4e,_0x4e649a[_0x5b8d('0x11')][_0x5b8d('0x13')]);return _0x427543(_0x4e649a[_0x5b8d('0x11')]['message']);}else{logger['info'](_0x5b8d('0xf'),_0x555c4e,'request\x20sent');_0x427543(_0x4e649a[_0x5b8d('0x14')][_0x5b8d('0x13')]);}})['catch'](function(_0xf2bda6){logger['error'](_0x5b8d('0xf'),_0x555c4e,_0xf2bda6);_0x228052(_0xf2bda6);});});} \ No newline at end of file +var _0x28b0=['then','info','request\x20sent','debug','stringify','error','code','SalesforceField,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0xa8fcd8,_0x11c8d8){var _0x1fb968=function(_0x124ea4){while(--_0x124ea4){_0xa8fcd8['push'](_0xa8fcd8['shift']());}};_0x1fb968(++_0x11c8d8);}(_0x28b0,0x78));var _0x028b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28b0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x028b('0x0'));var util=require(_0x028b('0x1'));var moment=require(_0x028b('0x2'));var BPromise=require(_0x028b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x028b('0x4'))['db'];var utils=require(_0x028b('0x5'));var logger=require(_0x028b('0x6'))(_0x028b('0x7'));var config=require(_0x028b('0x8'));var jayson=require(_0x028b('0x9'));var client=jayson[_0x028b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x544a02,_0x5dd235,_0x261542){return new BPromise(function(_0x4fb5d0,_0x4265cd){return client[_0x028b('0xb')](_0x544a02,_0x261542)[_0x028b('0xc')](function(_0x3d8f4e){logger[_0x028b('0xd')]('SalesforceField,\x20%s,\x20%s',_0x5dd235,_0x028b('0xe'));logger[_0x028b('0xf')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x5dd235,_0x028b('0xe'),JSON[_0x028b('0x10')](_0x3d8f4e));if(_0x3d8f4e[_0x028b('0x11')]){if(_0x3d8f4e['error'][_0x028b('0x12')]===0x1f4){logger[_0x028b('0x11')](_0x028b('0x13'),_0x5dd235,_0x3d8f4e[_0x028b('0x11')][_0x028b('0x14')]);return _0x4265cd(_0x3d8f4e['error'][_0x028b('0x14')]);}logger[_0x028b('0x11')](_0x028b('0x13'),_0x5dd235,_0x3d8f4e[_0x028b('0x11')][_0x028b('0x14')]);return _0x4fb5d0(_0x3d8f4e[_0x028b('0x11')][_0x028b('0x14')]);}else{logger[_0x028b('0xd')](_0x028b('0x13'),_0x5dd235,'request\x20sent');_0x4fb5d0(_0x3d8f4e['result'][_0x028b('0x14')]);}})[_0x028b('0x15')](function(_0x46315e){logger[_0x028b('0x11')]('SalesforceField,\x20%s,\x20%s',_0x5dd235,_0x46315e);_0x4265cd(_0x46315e);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 84f7445..b2fb3f9 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 _0x1752=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','addConfiguration','delete','destroy','exports','util','path','connect-timeout'];(function(_0x4ba102,_0x3dc213){var _0x1f35e7=function(_0xceae5a){while(--_0xceae5a){_0x4ba102['push'](_0x4ba102['shift']());}};_0x1f35e7(++_0x3dc213);}(_0x1752,0xa5));var _0x2175=function(_0x3a92b3,_0x319210){_0x3a92b3=_0x3a92b3-0x0;var _0x285238=_0x1752[_0x3a92b3];return _0x285238;};'use strict';var multer=require('multer');var util=require(_0x2175('0x0'));var path=require(_0x2175('0x1'));var timeout=require(_0x2175('0x2'));var express=require(_0x2175('0x3'));var router=express[_0x2175('0x4')]();var fs_extra=require(_0x2175('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2175('0x6'));var config=require(_0x2175('0x7'));var controller=require(_0x2175('0x8'));router[_0x2175('0x9')]('/',auth[_0x2175('0xa')](),controller[_0x2175('0xb')]);router[_0x2175('0x9')](_0x2175('0xc'),auth[_0x2175('0xa')](),controller[_0x2175('0xd')]);router['get'](_0x2175('0xe'),auth[_0x2175('0xa')](),controller[_0x2175('0xf')]);router[_0x2175('0x9')](_0x2175('0x10'),auth['isAuthenticated'](),controller['getFields']);router['post']('/',auth[_0x2175('0xa')](),controller['create']);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0x2175('0x11')]);router['put'](_0x2175('0xc'),auth[_0x2175('0xa')](),controller['update']);router[_0x2175('0x12')](_0x2175('0xc'),auth[_0x2175('0xa')](),controller[_0x2175('0x13')]);module[_0x2175('0x14')]=router; \ No newline at end of file +var _0x9df6=['express','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowAccount.controller','isAuthenticated','index','get','/:id','show','getConfigurations','getFields','/:id/configurations','addConfiguration','put','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x9df6,0x1ca));var _0x69df=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0x9df6[_0x3899d1];return _0xeb4a7d;};'use strict';var multer=require(_0x69df('0x0'));var util=require(_0x69df('0x1'));var path=require(_0x69df('0x2'));var timeout=require(_0x69df('0x3'));var express=require(_0x69df('0x4'));var router=express['Router']();var fs_extra=require(_0x69df('0x5'));var auth=require(_0x69df('0x6'));var interaction=require(_0x69df('0x7'));var config=require('../../config/environment');var controller=require(_0x69df('0x8'));router['get']('/',auth[_0x69df('0x9')](),controller[_0x69df('0xa')]);router[_0x69df('0xb')](_0x69df('0xc'),auth[_0x69df('0x9')](),controller[_0x69df('0xd')]);router['get']('/:id/configurations',auth[_0x69df('0x9')](),controller[_0x69df('0xe')]);router[_0x69df('0xb')]('/:id/fields',auth[_0x69df('0x9')](),controller[_0x69df('0xf')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x69df('0x10'),auth[_0x69df('0x9')](),controller[_0x69df('0x11')]);router[_0x69df('0x12')](_0x69df('0xc'),auth[_0x69df('0x9')](),controller['update']);router[_0x69df('0x13')]('/:id',auth[_0x69df('0x9')](),controller[_0x69df('0x14')]);module[_0x69df('0x15')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 496e680..fe1aa1e 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 _0xed6d=['remoteUri','sequelize','exports','STRING','username'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xed6d,0xc9));var _0xded6=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xed6d[_0x465a0c];return _0x1e202e;};'use strict';var Sequelize=require(_0xded6('0x0'));module[_0xded6('0x1')]={'name':{'type':Sequelize[_0xded6('0x2')]},'description':{'type':Sequelize[_0xded6('0x2')]},'username':{'type':Sequelize[_0xded6('0x2')],'unique':_0xded6('0x3')},'password':{'type':Sequelize[_0xded6('0x2')]},'email':{'type':Sequelize[_0xded6('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xded6('0x4')},'serverUrl':{'type':Sequelize[_0xded6('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x8c87=['sequelize','STRING','username','remoteUri'];(function(_0x38d046,_0x2d54ee){var _0x1b174d=function(_0x3ec3cf){while(--_0x3ec3cf){_0x38d046['push'](_0x38d046['shift']());}};_0x1b174d(++_0x2d54ee);}(_0x8c87,0x70));var _0x78c8=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x8c87[_0x2a6809];return _0x11c371;};'use strict';var Sequelize=require(_0x78c8('0x0'));module['exports']={'name':{'type':Sequelize[_0x78c8('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x78c8('0x1')],'unique':_0x78c8('0x2')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x78c8('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x78c8('0x3')},'serverUrl':{'type':Sequelize[_0x78c8('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index b55fd65..b5124f3 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 _0x22ff=['name','index','map','ServicenowAccount','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','findOne','ServicenowConfiguration','length','filter','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','getDescriptions','channel','Descriptions','getFields','hold_reason','knowledge','subcategory','close_code','incident_state','category','parent','caused_by','watch_list','upon_reject','child_incidents','approval_history','number','resolved_by','opened_by','user_input','sys_created_on','state','sys_created_by','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','priority','sys_domain_path','time_worked','expected_start','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','delivery_task','assignment_group','business_stc','additional_assignee_list','description','notify','sys_class_name','close_notes','closed_by','parent_incident','sys_id','contact_type','reopened_by','problem_id','company','reassignment_count','activity_due','assigned_to','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','upon_approval','correlation_id','username','password','email','remoteUri','serverUrl','slice','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','push','all','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','ServiceNow\x20error:\x20','test','statusCode','stack','send','boolean','True','true','false','value','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','end','error'];(function(_0x495635,_0x4ab1d6){var _0x48a96a=function(_0x245a99){while(--_0x245a99){_0x495635['push'](_0x495635['shift']());}};_0x48a96a(++_0x4ab1d6);}(_0x22ff,0x149));var _0xf22f=function(_0x332597,_0x33648e){_0x332597=_0x332597-0x0;var _0x70870e=_0x22ff[_0x332597];return _0x70870e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf22f('0x0'));var zipdir=require(_0xf22f('0x1'));var jsonpatch=require(_0xf22f('0x2'));var rp=require(_0xf22f('0x3'));var moment=require(_0xf22f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf22f('0x5'));var util=require(_0xf22f('0x6'));var path=require(_0xf22f('0x7'));var sox=require(_0xf22f('0x8'));var csv=require(_0xf22f('0x9'));var ejs=require(_0xf22f('0xa'));var fs=require('fs');var fs_extra=require(_0xf22f('0xb'));var _=require(_0xf22f('0xc'));var squel=require(_0xf22f('0xd'));var crypto=require(_0xf22f('0xe'));var jsforce=require(_0xf22f('0xf'));var deskjs=require(_0xf22f('0x10'));var toCsv=require(_0xf22f('0x9'));var querystring=require(_0xf22f('0x11'));var Papa=require('papaparse');var Redis=require(_0xf22f('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xf22f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf22f('0x14'));var logger=require(_0xf22f('0x15'))(_0xf22f('0x16'));var utils=require('../../config/utils');var config=require(_0xf22f('0x17'));var licenseUtil=require(_0xf22f('0x18'));var db=require(_0xf22f('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2fff51,_0xba2c3f){_0xba2c3f=_0xba2c3f||0xcc;return function(_0x64fb06){if(_0x64fb06){return _0x2fff51['sendStatus'](_0xba2c3f);}return _0x2fff51['status'](_0xba2c3f)['end']();};}function respondWithResult(_0x43ef1b,_0x155649){_0x155649=_0x155649||0xc8;return function(_0x2d52ac){if(_0x2d52ac){return _0x43ef1b[_0xf22f('0x1a')](_0x155649)['json'](_0x2d52ac);}};}function respondWithFilteredResult(_0x4d37bf,_0x53068c){return function(_0x47471e){if(_0x47471e){var _0x2f03c0=typeof _0x53068c[_0xf22f('0x1b')]===_0xf22f('0x1c')&&typeof _0x53068c[_0xf22f('0x1d')]===_0xf22f('0x1c');var _0xf60f49=_0x47471e[_0xf22f('0x1e')];var _0x2bb98f=_0x2f03c0?0x0:_0x53068c[_0xf22f('0x1b')];var _0x2352df=_0x2f03c0?_0x47471e[_0xf22f('0x1e')]:_0x53068c[_0xf22f('0x1b')]+_0x53068c[_0xf22f('0x1d')];var _0x275cd5;if(_0x2352df>=_0xf60f49){_0x2352df=_0xf60f49;_0x275cd5=0xc8;}else{_0x275cd5=0xce;}_0x4d37bf[_0xf22f('0x1a')](_0x275cd5);return _0x4d37bf[_0xf22f('0x1f')](_0xf22f('0x20'),_0x2bb98f+'-'+_0x2352df+'/'+_0xf60f49)[_0xf22f('0x21')](_0x47471e);}return null;};}function patchUpdates(_0x48b4a9){return function(_0x40c51b){try{jsonpatch[_0xf22f('0x22')](_0x40c51b,_0x48b4a9,!![]);}catch(_0x28fa28){return BPromise['reject'](_0x28fa28);}return _0x40c51b[_0xf22f('0x23')]();};}function saveUpdates(_0x5157d7,_0x566888){return function(_0x11225c){if(_0x11225c){return _0x11225c[_0xf22f('0x24')](_0x5157d7)[_0xf22f('0x25')](function(_0x333706){return _0x333706;});}return null;};}function removeEntity(_0x5a51c1,_0x162c34){return function(_0xf6d3e6){if(_0xf6d3e6){return _0xf6d3e6[_0xf22f('0x26')]()['then'](function(){_0x5a51c1['status'](0xcc)[_0xf22f('0x27')]();});}};}function handleEntityNotFound(_0x1288b5,_0x363234){return function(_0x5a895e){if(!_0x5a895e){_0x1288b5['sendStatus'](0x194);}return _0x5a895e;};}function handleError(_0xb1fb8,_0x1cb049){_0x1cb049=_0x1cb049||0x1f4;return function(_0x33e3e4){logger[_0xf22f('0x28')](_0x33e3e4['stack']);if(_0x33e3e4[_0xf22f('0x29')]){delete _0x33e3e4[_0xf22f('0x29')];}_0xb1fb8['status'](_0x1cb049)['send'](_0x33e3e4);};}exports[_0xf22f('0x2a')]=function(_0x6454c5,_0x4cc3b8){var _0x44a593={},_0x744eb1={},_0x5b3ede={'count':0x0,'rows':[]};var _0x26cb6e=_[_0xf22f('0x2b')](db[_0xf22f('0x2c')][_0xf22f('0x2d')],function(_0x17a200){return{'name':_0x17a200['fieldName'],'type':_0x17a200[_0xf22f('0x2e')][_0xf22f('0x2f')]};});_0x744eb1[_0xf22f('0x30')]=_['map'](_0x26cb6e,'name');_0x744eb1[_0xf22f('0x31')]=_[_0xf22f('0x32')](_0x6454c5[_0xf22f('0x31')]);_0x744eb1['filters']=_[_0xf22f('0x33')](_0x744eb1['model'],_0x744eb1['query']);_0x44a593[_0xf22f('0x34')]=_[_0xf22f('0x33')](_0x744eb1[_0xf22f('0x30')],qs[_0xf22f('0x35')](_0x6454c5[_0xf22f('0x31')][_0xf22f('0x35')]));_0x44a593['attributes']=_0x44a593[_0xf22f('0x34')]['length']?_0x44a593['attributes']:_0x744eb1['model'];if(!_0x6454c5[_0xf22f('0x31')][_0xf22f('0x36')](_0xf22f('0x37'))){_0x44a593['limit']=qs[_0xf22f('0x1d')](_0x6454c5[_0xf22f('0x31')][_0xf22f('0x1d')]);_0x44a593['offset']=qs[_0xf22f('0x1b')](_0x6454c5['query'][_0xf22f('0x1b')]);}_0x44a593[_0xf22f('0x38')]=qs[_0xf22f('0x39')](_0x6454c5['query'][_0xf22f('0x39')]);_0x44a593['where']=qs[_0xf22f('0x3a')](_[_0xf22f('0x3b')](_0x6454c5['query'],_0x744eb1[_0xf22f('0x3a')]),_0x26cb6e);if(_0x6454c5['query']['filter']){_0x44a593[_0xf22f('0x3c')]=_[_0xf22f('0x3d')](_0x44a593['where'],{'$or':_[_0xf22f('0x2b')](_0x26cb6e,function(_0x3f4fda){if(_0x3f4fda['type']!==_0xf22f('0x3e')){var _0x334c69={};_0x334c69[_0x3f4fda[_0xf22f('0x29')]]={'$like':'%'+_0x6454c5[_0xf22f('0x31')]['filter']+'%'};return _0x334c69;}})});}_0x44a593=_[_0xf22f('0x3d')]({},_0x44a593,_0x6454c5[_0xf22f('0x3f')]);var _0xa2c07c={'where':_0x44a593[_0xf22f('0x3c')]};return db[_0xf22f('0x2c')][_0xf22f('0x1e')](_0xa2c07c)[_0xf22f('0x25')](function(_0x2ed213){_0x5b3ede[_0xf22f('0x1e')]=_0x2ed213;if(_0x6454c5[_0xf22f('0x31')][_0xf22f('0x40')]){_0x44a593['include']=[{'all':!![]}];}return db[_0xf22f('0x2c')][_0xf22f('0x41')](_0x44a593);})[_0xf22f('0x25')](function(_0xef08bf){_0x5b3ede[_0xf22f('0x42')]=_0xef08bf;return _0x5b3ede;})[_0xf22f('0x25')](respondWithFilteredResult(_0x4cc3b8,_0x44a593))[_0xf22f('0x43')](handleError(_0x4cc3b8,null));};exports[_0xf22f('0x44')]=function(_0x497b2f,_0x210b6c){var _0x16367f={'raw':![],'where':{'id':_0x497b2f[_0xf22f('0x45')]['id']}},_0x62d1fe={};_0x62d1fe[_0xf22f('0x30')]=_[_0xf22f('0x32')](db[_0xf22f('0x2c')]['rawAttributes']);_0x62d1fe[_0xf22f('0x31')]=_[_0xf22f('0x32')](_0x497b2f['query']);_0x62d1fe['filters']=_['intersection'](_0x62d1fe[_0xf22f('0x30')],_0x62d1fe['query']);_0x16367f[_0xf22f('0x34')]=_[_0xf22f('0x33')](_0x62d1fe[_0xf22f('0x30')],qs[_0xf22f('0x35')](_0x497b2f[_0xf22f('0x31')]['fields']));_0x16367f['attributes']=_0x16367f['attributes']['length']?_0x16367f[_0xf22f('0x34')]:_0x62d1fe[_0xf22f('0x30')];if(_0x497b2f[_0xf22f('0x31')][_0xf22f('0x40')]){_0x16367f[_0xf22f('0x46')]=[{'all':!![]}];}_0x16367f=_[_0xf22f('0x3d')]({},_0x16367f,_0x497b2f[_0xf22f('0x3f')]);return db[_0xf22f('0x2c')][_0xf22f('0x47')](_0x16367f)['then'](handleEntityNotFound(_0x210b6c,null))[_0xf22f('0x25')](respondWithResult(_0x210b6c,null))[_0xf22f('0x43')](handleError(_0x210b6c,null));};exports[_0xf22f('0x48')]=function(_0x27658e,_0x187ae7){return db['ServicenowAccount'][_0xf22f('0x48')](_0x27658e[_0xf22f('0x49')],{})[_0xf22f('0x25')](respondWithResult(_0x187ae7,0xc9))[_0xf22f('0x43')](handleError(_0x187ae7,null));};exports['update']=function(_0x322617,_0x561533){if(_0x322617[_0xf22f('0x49')]['id']){delete _0x322617['body']['id'];}return db[_0xf22f('0x2c')][_0xf22f('0x47')]({'where':{'id':_0x322617[_0xf22f('0x45')]['id']}})['then'](handleEntityNotFound(_0x561533,null))['then'](saveUpdates(_0x322617[_0xf22f('0x49')],null))[_0xf22f('0x25')](respondWithResult(_0x561533,null))[_0xf22f('0x43')](handleError(_0x561533,null));};exports['destroy']=function(_0x1c2406,_0x4e9be1){return db[_0xf22f('0x2c')]['find']({'where':{'id':_0x1c2406['params']['id']}})[_0xf22f('0x25')](handleEntityNotFound(_0x4e9be1,null))[_0xf22f('0x25')](removeEntity(_0x4e9be1,null))['catch'](handleError(_0x4e9be1,null));};exports['getConfigurations']=function(_0x39bbcb,_0x2dcf6e,_0x325ba8){var _0x56d45c={};var _0x1c3a17={};var _0x350e97;var _0x4d8266;return db[_0xf22f('0x2c')][_0xf22f('0x4a')]({'where':{'id':_0x39bbcb[_0xf22f('0x45')]['id']}})[_0xf22f('0x25')](handleEntityNotFound(_0x2dcf6e,null))[_0xf22f('0x25')](function(_0x166d5e){if(_0x166d5e){_0x350e97=_0x166d5e;_0x1c3a17['model']=_[_0xf22f('0x32')](db[_0xf22f('0x4b')][_0xf22f('0x2d')]);_0x1c3a17[_0xf22f('0x31')]=_[_0xf22f('0x32')](_0x39bbcb[_0xf22f('0x31')]);_0x1c3a17[_0xf22f('0x3a')]=_['intersection'](_0x1c3a17[_0xf22f('0x30')],_0x1c3a17[_0xf22f('0x31')]);_0x56d45c[_0xf22f('0x34')]=_[_0xf22f('0x33')](_0x1c3a17[_0xf22f('0x30')],qs['fields'](_0x39bbcb['query'][_0xf22f('0x35')]));_0x56d45c[_0xf22f('0x34')]=_0x56d45c[_0xf22f('0x34')][_0xf22f('0x4c')]?_0x56d45c[_0xf22f('0x34')]:_0x1c3a17[_0xf22f('0x30')];_0x56d45c[_0xf22f('0x38')]=qs[_0xf22f('0x39')](_0x39bbcb['query']['sort']);_0x56d45c[_0xf22f('0x3c')]=qs['filters'](_[_0xf22f('0x3b')](_0x39bbcb[_0xf22f('0x31')],_0x1c3a17[_0xf22f('0x3a')]));if(_0x39bbcb[_0xf22f('0x31')][_0xf22f('0x4d')]){_0x56d45c[_0xf22f('0x3c')]=_[_0xf22f('0x3d')](_0x56d45c[_0xf22f('0x3c')],{'$or':_[_0xf22f('0x2b')](_0x56d45c['attributes'],function(_0x1c3514){var _0x281f91={};_0x281f91[_0x1c3514]={'$like':'%'+_0x39bbcb[_0xf22f('0x31')]['filter']+'%'};return _0x281f91;})});}_0x56d45c=_[_0xf22f('0x3d')]({},_0x56d45c,_0x39bbcb[_0xf22f('0x3f')]);return _0x350e97[_0xf22f('0x4e')](_0x56d45c);}})['then'](function(_0x564b08){if(_0x564b08){_0x4d8266=_0x564b08[_0xf22f('0x4c')];if(!_0x39bbcb[_0xf22f('0x31')]['hasOwnProperty'](_0xf22f('0x37'))){_0x56d45c['limit']=qs[_0xf22f('0x1d')](_0x39bbcb[_0xf22f('0x31')][_0xf22f('0x1d')]);_0x56d45c['offset']=qs[_0xf22f('0x1b')](_0x39bbcb[_0xf22f('0x31')][_0xf22f('0x1b')]);}return _0x350e97['getConfigurations'](_0x56d45c);}})[_0xf22f('0x25')](function(_0x31d185){if(_0x31d185){return _0x31d185?{'count':_0x4d8266,'rows':_0x31d185}:null;}})[_0xf22f('0x25')](respondWithResult(_0x2dcf6e,null))[_0xf22f('0x43')](handleError(_0x2dcf6e,null));};exports[_0xf22f('0x4f')]=function(_0x87114f,_0x334166,_0x50c8da){if(_0x87114f[_0xf22f('0x49')]['id']){delete _0x87114f[_0xf22f('0x49')]['id'];}return db[_0xf22f('0x2c')][_0xf22f('0x4a')]({'where':{'id':_0x87114f[_0xf22f('0x45')]['id']}})[_0xf22f('0x25')](handleEntityNotFound(_0x334166,null))[_0xf22f('0x25')](function(_0x32c4e5){if(_0x32c4e5){_0x87114f[_0xf22f('0x49')][_0xf22f('0x50')]=_0x32c4e5['id'];_0x87114f[_0xf22f('0x49')][_0xf22f('0x51')]=integrations[_0xf22f('0x52')](_0x87114f[_0xf22f('0x49')]['channel'],_0x87114f[_0xf22f('0x49')]['type']);_0x87114f[_0xf22f('0x49')]['Descriptions']=integrations[_0xf22f('0x53')](_0x87114f[_0xf22f('0x49')][_0xf22f('0x54')],_0x87114f[_0xf22f('0x49')]['type']);return db[_0xf22f('0x4b')][_0xf22f('0x48')](_0x87114f[_0xf22f('0x49')],{'include':[{'model':db['ServicenowField'],'as':_0xf22f('0x51')},{'model':db['ServicenowField'],'as':_0xf22f('0x55')}]});}return null;})[_0xf22f('0x25')](respondWithResult(_0x334166,null))[_0xf22f('0x43')](handleError(_0x334166,null));};exports[_0xf22f('0x56')]=function(_0x3de6b3,_0x32b609,_0x3d8b30){var _0x441ee7=['made_sla',_0xf22f('0x57'),_0xf22f('0x58'),_0xf22f('0x59'),_0xf22f('0x5a'),'notify',_0xf22f('0x5b'),'severity',_0xf22f('0x5c')];var _0x5e219c=[_0xf22f('0x5d'),'made_sla',_0xf22f('0x5e'),_0xf22f('0x5f'),_0xf22f('0x60'),'sys_updated_on',_0xf22f('0x61'),_0xf22f('0x57'),_0xf22f('0x62'),_0xf22f('0x63'),_0xf22f('0x64'),'sys_updated_by',_0xf22f('0x65'),_0xf22f('0x66'),_0xf22f('0x67'),'sys_domain',_0xf22f('0x68'),_0xf22f('0x69'),_0xf22f('0x58'),_0xf22f('0x38'),'calendar_stc',_0xf22f('0x6a'),_0xf22f('0x6b'),_0xf22f('0x6c'),_0xf22f('0x6d'),_0xf22f('0x6e'),_0xf22f('0x6f'),_0xf22f('0x70'),_0xf22f('0x71'),_0xf22f('0x72'),'rfc',_0xf22f('0x73'),_0xf22f('0x74'),'opened_at',_0xf22f('0x75'),_0xf22f('0x76'),_0xf22f('0x77'),_0xf22f('0x78'),_0xf22f('0x79'),_0xf22f('0x7a'),_0xf22f('0x7b'),'subcategory',_0xf22f('0x7c'),_0xf22f('0x7d'),_0xf22f('0x5a'),'correlation_display',_0xf22f('0x7e'),'work_start',_0xf22f('0x7f'),_0xf22f('0x80'),_0xf22f('0x81'),_0xf22f('0x82'),'calendar_duration',_0xf22f('0x83'),_0xf22f('0x84'),_0xf22f('0x85'),_0xf22f('0x86'),'follow_up',_0xf22f('0x87'),_0xf22f('0x88'),_0xf22f('0x89'),_0xf22f('0x8a'),_0xf22f('0x5b'),'urgency',_0xf22f('0x8b'),_0xf22f('0x8c'),_0xf22f('0x8d'),_0xf22f('0x8e'),_0xf22f('0x8f'),'severity','comments',_0xf22f('0x90'),_0xf22f('0x91'),_0xf22f('0x92'),_0xf22f('0x93'),_0xf22f('0x94'),_0xf22f('0x95'),_0xf22f('0x96'),'escalation',_0xf22f('0x97'),_0xf22f('0x98'),'location','category'];var _0x6fdc4d='';var _0x18384e='';var _0x14090c=[];var _0x2e7f14='';var _0xf24bf6='';var _0x4fb746=[];var _0x18f466='';var _0x5d6cf5='';var _0x14cf70={};var _0x2dc673='';return db[_0xf22f('0x2c')][_0xf22f('0x4a')]({'where':{'id':_0x3de6b3['params']['id']},'attributes':['id',_0xf22f('0x99'),_0xf22f('0x9a'),_0xf22f('0x9b'),_0xf22f('0x9c'),_0xf22f('0x9d')]})[_0xf22f('0x25')](handleEntityNotFound(_0x32b609,null))[_0xf22f('0x25')](function(_0x5d3601){if(_0x5d3601){_0x2dc673=_0x5d3601[_0xf22f('0x9c')];var _0x507e00=_0x2dc673[_0xf22f('0x9e')](-0x1);if(_0x507e00==='/'){_0x2dc673=_0x2dc673['substring'](0x0,_0x2dc673['lastIndexOf'](_0x507e00));}_0x5d6cf5=util[_0xf22f('0x9f')](_0xf22f('0xa0'),_0x2dc673);_0x18f466=util['format'](_0xf22f('0xa1'),_0x2dc673);_0x14cf70={'user':_0x5d3601[_0xf22f('0x99')],'pass':_0x5d3601[_0xf22f('0x9a')]};var _0x4be907={'method':_0xf22f('0xa2'),'uri':_0x5d6cf5+'incident?sysparm_display_value=all','auth':_0x14cf70,'json':!![]};return rp(_0x4be907);}})[_0xf22f('0x25')](function(_0x48fc5d){if(_0x48fc5d[_0xf22f('0xa3')]['length']>0x0){_0x6fdc4d=_0x48fc5d[_0xf22f('0xa3')];}console[_0xf22f('0xa4')](_0xf22f('0xa5'),_0x6fdc4d);_0x4fb746=[];_0x18384e=Object[_0xf22f('0xa6')]([],_0x6fdc4d);_[_0xf22f('0xa7')](_0x18384e,function(_0x1ad8c6){return!_0x441ee7[_0xf22f('0xa8')](_0x1ad8c6[_0xf22f('0x29')]);});_0x18384e[_0xf22f('0xa9')](function(_0x5eb6b5){var _0x238405=createFieldObject(_0x18f466,_0x14cf70,_0x5eb6b5[_0xf22f('0xaa')],_0x5eb6b5[_0xf22f('0x29')],_0x5eb6b5[_0xf22f('0xab')],![]);_0x4fb746[_0xf22f('0xac')](_0x238405);});return Promise[_0xf22f('0xad')](_0x4fb746);})['then'](function(_0x1ae1d5){_0x14090c=_0x1ae1d5;_0x2e7f14=Object[_0xf22f('0xa6')]([],_0x6fdc4d);console[_0xf22f('0xa4')]('TCL:\x20_object',_0x6fdc4d);_[_0xf22f('0xa7')](_0x2e7f14,function(_0xeb5933){return _0x5e219c[_0xf22f('0xa8')](_0xeb5933['name']);});console[_0xf22f('0xa4')](_0xf22f('0xae'),_0x2e7f14);_0x4fb746=[];_0x2e7f14[_0xf22f('0xa9')](function(_0x1d895a){var _0x3ae3f7=createFieldObject(_0x18f466,_0x14cf70,_0x1d895a[_0xf22f('0xaa')],_0x1d895a[_0xf22f('0x29')],_0x1d895a[_0xf22f('0xab')],!![]);_0x4fb746[_0xf22f('0xac')](_0x3ae3f7);});return Promise[_0xf22f('0xad')](_0x4fb746);})[_0xf22f('0x25')](function(_0xf4f3ca){_0xf24bf6=_0xf4f3ca;var _0x5e1524=_0x14090c['concat'](_0xf24bf6);return{'count':_0x5e1524[_0xf22f('0x4c')],'rows':_0x5e1524};})[_0xf22f('0x25')](respondWithResult(_0x32b609,null))[_0xf22f('0x43')](function(_0x3bce5b){console['log'](_0xf22f('0xaf')+_0x3bce5b);var _0x4fed=_0x3de6b3['query'][_0xf22f('0xb0')]?0x1f4:_0x3bce5b[_0xf22f('0xb1')]||0x1f4;logger[_0xf22f('0x28')](_0x3bce5b[_0xf22f('0xb2')]);delete _0x3bce5b[_0xf22f('0x29')];if(_0x4fed===0x191){_0x4fed=0x190;}_0x32b609[_0xf22f('0x1a')](_0x4fed)[_0xf22f('0xb3')](_0x3de6b3[_0xf22f('0x31')][_0xf22f('0xb0')]?{'message':'Wrong\x20credentials','statusCode':_0x3bce5b[_0xf22f('0xb1')]}:_0x3bce5b);});};function createFieldObject(_0x31d1d8,_0x1d92b6,_0x224cb0,_0x3ccb93,_0x4fba9b,_0x55e2a0){return new Promise(function(_0x33af8c,_0x3d4f75){var _0x167bf7={'id':_0x3ccb93,'name':_0x4fba9b,'custom':_0x55e2a0};if(_0x224cb0===_0xf22f('0xb4')){_0x167bf7[_0xf22f('0x3f')]=[{'name':_0xf22f('0xb5'),'value':_0xf22f('0xb6')},{'name':'False','value':_0xf22f('0xb7')}];_0x33af8c(_0x167bf7);}else{var _0xbd01a5={'method':'GET','uri':_0x31d1d8+'sys_choice?sysparm_query=name=incident^element='+_0x3ccb93,'auth':_0x1d92b6,'json':!![]};return rp(_0xbd01a5)['then'](function(_0x10dd0c){var _0xbe8aea=[];if(_0x10dd0c[_0xf22f('0xa3')]['length']>0x0){_0x10dd0c[_0xf22f('0xa3')][_0xf22f('0xa9')](function(_0x8404f3){if(_0x8404f3['inactive']===_0xf22f('0xb7')){var _0xfa9fd={'name':_0x8404f3[_0xf22f('0xab')],'value':_0x8404f3[_0xf22f('0xb8')]};_0xbe8aea[_0xf22f('0xac')](_0xfa9fd);}});}_0x167bf7[_0xf22f('0x3f')]=_0xbe8aea;if(_0x167bf7[_0xf22f('0x3f')][_0xf22f('0x4c')]>0x0){_0x33af8c(_0x167bf7);}else{if(_0x55e2a0==![]){_0x33af8c();}else{_0x33af8c(_0x167bf7);}}});}});} \ No newline at end of file +var _0xbaea=['concat','ServiceNow\x20error:\x20','test','statusCode','error','Wrong\x20credentials','boolean','True','true','false','sys_choice?sysparm_query=name=incident^element=','value','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','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','sendStatus','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','nolimit','order','sort','where','merge','VIRTUAL','filter','options','findAll','rows','catch','show','params','fields','includeAll','find','create','body','getConfigurations','findOne','ServicenowConfiguration','pick','hasOwnProperty','addConfiguration','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','Subjects','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','sys_created_by','calendar_stc','closed_at','delivery_plan','impact','active','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','company','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','upon_approval','correlation_id','location','category','username','password','email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','includes','forEach','internalType','label','push','assign','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0xbaea,0xce));var _0xabae=function(_0x3b8242,_0x2f4be0){_0x3b8242=_0x3b8242-0x0;var _0x337ab2=_0xbaea[_0x3b8242];return _0x337ab2;};'use strict';var emlformat=require(_0xabae('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xabae('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xabae('0x2'));var moment=require('moment');var BPromise=require(_0xabae('0x3'));var Mustache=require(_0xabae('0x4'));var util=require(_0xabae('0x5'));var path=require(_0xabae('0x6'));var sox=require(_0xabae('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xabae('0x8'));var _=require(_0xabae('0x9'));var squel=require(_0xabae('0xa'));var crypto=require(_0xabae('0xb'));var jsforce=require(_0xabae('0xc'));var deskjs=require(_0xabae('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xabae('0xe'));var Redis=require(_0xabae('0xf'));var authService=require(_0xabae('0x10'));var qs=require(_0xabae('0x11'));var as=require(_0xabae('0x12'));var hardwareService=require(_0xabae('0x13'));var logger=require(_0xabae('0x14'))(_0xabae('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5cd5bd,_0x3643a1){_0x3643a1=_0x3643a1||0xcc;return function(_0xc152f8){if(_0xc152f8){return _0x5cd5bd[_0xabae('0x16')](_0x3643a1);}return _0x5cd5bd[_0xabae('0x17')](_0x3643a1)[_0xabae('0x18')]();};}function respondWithResult(_0x38f422,_0x3fdf4a){_0x3fdf4a=_0x3fdf4a||0xc8;return function(_0x19d6e4){if(_0x19d6e4){return _0x38f422[_0xabae('0x17')](_0x3fdf4a)[_0xabae('0x19')](_0x19d6e4);}};}function respondWithFilteredResult(_0x20245f,_0x198886){return function(_0x233b70){if(_0x233b70){var _0x431311=typeof _0x198886['offset']===_0xabae('0x1a')&&typeof _0x198886['limit']===_0xabae('0x1a');var _0x3f4308=_0x233b70['count'];var _0x1d814b=_0x431311?0x0:_0x198886[_0xabae('0x1b')];var _0x4579e3=_0x431311?_0x233b70[_0xabae('0x1c')]:_0x198886[_0xabae('0x1b')]+_0x198886[_0xabae('0x1d')];var _0x53097a;if(_0x4579e3>=_0x3f4308){_0x4579e3=_0x3f4308;_0x53097a=0xc8;}else{_0x53097a=0xce;}_0x20245f['status'](_0x53097a);return _0x20245f[_0xabae('0x1e')](_0xabae('0x1f'),_0x1d814b+'-'+_0x4579e3+'/'+_0x3f4308)['json'](_0x233b70);}return null;};}function patchUpdates(_0x3475af){return function(_0x146cec){try{jsonpatch[_0xabae('0x20')](_0x146cec,_0x3475af,!![]);}catch(_0x475f21){return BPromise[_0xabae('0x21')](_0x475f21);}return _0x146cec['save']();};}function saveUpdates(_0x4b6ac1,_0x3b10ce){return function(_0x230e83){if(_0x230e83){return _0x230e83[_0xabae('0x22')](_0x4b6ac1)[_0xabae('0x23')](function(_0x2d53f2){return _0x2d53f2;});}return null;};}function removeEntity(_0x4ff619,_0x1cc37f){return function(_0xbdde17){if(_0xbdde17){return _0xbdde17[_0xabae('0x24')]()[_0xabae('0x23')](function(){_0x4ff619[_0xabae('0x17')](0xcc)[_0xabae('0x18')]();});}};}function handleEntityNotFound(_0x4f14b1,_0x58bd54){return function(_0x3c63e5){if(!_0x3c63e5){_0x4f14b1['sendStatus'](0x194);}return _0x3c63e5;};}function handleError(_0x3e997b,_0x51210a){_0x51210a=_0x51210a||0x1f4;return function(_0x35572d){logger['error'](_0x35572d[_0xabae('0x25')]);if(_0x35572d[_0xabae('0x26')]){delete _0x35572d[_0xabae('0x26')];}_0x3e997b[_0xabae('0x17')](_0x51210a)[_0xabae('0x27')](_0x35572d);};}exports[_0xabae('0x28')]=function(_0x14c374,_0x4b0b3f){var _0x464309={},_0x482c1a={},_0xe95fd9={'count':0x0,'rows':[]};var _0x33964e=_[_0xabae('0x29')](db[_0xabae('0x2a')][_0xabae('0x2b')],function(_0xc802c2){return{'name':_0xc802c2[_0xabae('0x2c')],'type':_0xc802c2[_0xabae('0x2d')][_0xabae('0x2e')]};});_0x482c1a[_0xabae('0x2f')]=_[_0xabae('0x29')](_0x33964e,_0xabae('0x26'));_0x482c1a['query']=_[_0xabae('0x30')](_0x14c374[_0xabae('0x31')]);_0x482c1a[_0xabae('0x32')]=_[_0xabae('0x33')](_0x482c1a['model'],_0x482c1a['query']);_0x464309[_0xabae('0x34')]=_[_0xabae('0x33')](_0x482c1a[_0xabae('0x2f')],qs['fields'](_0x14c374['query']['fields']));_0x464309['attributes']=_0x464309[_0xabae('0x34')][_0xabae('0x35')]?_0x464309['attributes']:_0x482c1a[_0xabae('0x2f')];if(!_0x14c374[_0xabae('0x31')]['hasOwnProperty'](_0xabae('0x36'))){_0x464309['limit']=qs['limit'](_0x14c374[_0xabae('0x31')][_0xabae('0x1d')]);_0x464309[_0xabae('0x1b')]=qs['offset'](_0x14c374[_0xabae('0x31')]['offset']);}_0x464309[_0xabae('0x37')]=qs[_0xabae('0x38')](_0x14c374['query'][_0xabae('0x38')]);_0x464309[_0xabae('0x39')]=qs[_0xabae('0x32')](_['pick'](_0x14c374[_0xabae('0x31')],_0x482c1a[_0xabae('0x32')]),_0x33964e);if(_0x14c374[_0xabae('0x31')]['filter']){_0x464309[_0xabae('0x39')]=_[_0xabae('0x3a')](_0x464309['where'],{'$or':_[_0xabae('0x29')](_0x33964e,function(_0x13d3c1){if(_0x13d3c1[_0xabae('0x2d')]!==_0xabae('0x3b')){var _0x19cdc9={};_0x19cdc9[_0x13d3c1[_0xabae('0x26')]]={'$like':'%'+_0x14c374[_0xabae('0x31')][_0xabae('0x3c')]+'%'};return _0x19cdc9;}})});}_0x464309=_[_0xabae('0x3a')]({},_0x464309,_0x14c374[_0xabae('0x3d')]);var _0x549c17={'where':_0x464309[_0xabae('0x39')]};return db[_0xabae('0x2a')]['count'](_0x549c17)[_0xabae('0x23')](function(_0x6ebbe3){_0xe95fd9['count']=_0x6ebbe3;if(_0x14c374[_0xabae('0x31')]['includeAll']){_0x464309['include']=[{'all':!![]}];}return db[_0xabae('0x2a')][_0xabae('0x3e')](_0x464309);})[_0xabae('0x23')](function(_0x22bf59){_0xe95fd9[_0xabae('0x3f')]=_0x22bf59;return _0xe95fd9;})[_0xabae('0x23')](respondWithFilteredResult(_0x4b0b3f,_0x464309))[_0xabae('0x40')](handleError(_0x4b0b3f,null));};exports[_0xabae('0x41')]=function(_0x56f65c,_0x5ca18c){var _0x32f437={'raw':![],'where':{'id':_0x56f65c[_0xabae('0x42')]['id']}},_0xbba002={};_0xbba002[_0xabae('0x2f')]=_['keys'](db[_0xabae('0x2a')][_0xabae('0x2b')]);_0xbba002[_0xabae('0x31')]=_[_0xabae('0x30')](_0x56f65c[_0xabae('0x31')]);_0xbba002[_0xabae('0x32')]=_[_0xabae('0x33')](_0xbba002[_0xabae('0x2f')],_0xbba002['query']);_0x32f437[_0xabae('0x34')]=_[_0xabae('0x33')](_0xbba002[_0xabae('0x2f')],qs[_0xabae('0x43')](_0x56f65c['query'][_0xabae('0x43')]));_0x32f437[_0xabae('0x34')]=_0x32f437[_0xabae('0x34')][_0xabae('0x35')]?_0x32f437[_0xabae('0x34')]:_0xbba002[_0xabae('0x2f')];if(_0x56f65c['query'][_0xabae('0x44')]){_0x32f437['include']=[{'all':!![]}];}_0x32f437=_[_0xabae('0x3a')]({},_0x32f437,_0x56f65c[_0xabae('0x3d')]);return db['ServicenowAccount'][_0xabae('0x45')](_0x32f437)[_0xabae('0x23')](handleEntityNotFound(_0x5ca18c,null))[_0xabae('0x23')](respondWithResult(_0x5ca18c,null))['catch'](handleError(_0x5ca18c,null));};exports[_0xabae('0x46')]=function(_0x963a78,_0x29151b){return db['ServicenowAccount'][_0xabae('0x46')](_0x963a78[_0xabae('0x47')],{})[_0xabae('0x23')](respondWithResult(_0x29151b,0xc9))[_0xabae('0x40')](handleError(_0x29151b,null));};exports[_0xabae('0x22')]=function(_0x1acdb7,_0x233a0d){if(_0x1acdb7[_0xabae('0x47')]['id']){delete _0x1acdb7['body']['id'];}return db[_0xabae('0x2a')][_0xabae('0x45')]({'where':{'id':_0x1acdb7['params']['id']}})[_0xabae('0x23')](handleEntityNotFound(_0x233a0d,null))['then'](saveUpdates(_0x1acdb7['body'],null))['then'](respondWithResult(_0x233a0d,null))[_0xabae('0x40')](handleError(_0x233a0d,null));};exports[_0xabae('0x24')]=function(_0x4743bc,_0x1602f8){return db[_0xabae('0x2a')][_0xabae('0x45')]({'where':{'id':_0x4743bc[_0xabae('0x42')]['id']}})[_0xabae('0x23')](handleEntityNotFound(_0x1602f8,null))[_0xabae('0x23')](removeEntity(_0x1602f8,null))['catch'](handleError(_0x1602f8,null));};exports[_0xabae('0x48')]=function(_0x3d1258,_0x3d4448,_0x362f91){var _0x49444b={};var _0x19a6a7={};var _0x35722a;var _0x35168e;return db[_0xabae('0x2a')][_0xabae('0x49')]({'where':{'id':_0x3d1258['params']['id']}})[_0xabae('0x23')](handleEntityNotFound(_0x3d4448,null))[_0xabae('0x23')](function(_0x5a1f97){if(_0x5a1f97){_0x35722a=_0x5a1f97;_0x19a6a7['model']=_[_0xabae('0x30')](db[_0xabae('0x4a')][_0xabae('0x2b')]);_0x19a6a7[_0xabae('0x31')]=_[_0xabae('0x30')](_0x3d1258[_0xabae('0x31')]);_0x19a6a7[_0xabae('0x32')]=_[_0xabae('0x33')](_0x19a6a7[_0xabae('0x2f')],_0x19a6a7['query']);_0x49444b[_0xabae('0x34')]=_['intersection'](_0x19a6a7[_0xabae('0x2f')],qs[_0xabae('0x43')](_0x3d1258[_0xabae('0x31')][_0xabae('0x43')]));_0x49444b[_0xabae('0x34')]=_0x49444b['attributes'][_0xabae('0x35')]?_0x49444b[_0xabae('0x34')]:_0x19a6a7[_0xabae('0x2f')];_0x49444b[_0xabae('0x37')]=qs[_0xabae('0x38')](_0x3d1258[_0xabae('0x31')][_0xabae('0x38')]);_0x49444b[_0xabae('0x39')]=qs[_0xabae('0x32')](_[_0xabae('0x4b')](_0x3d1258[_0xabae('0x31')],_0x19a6a7['filters']));if(_0x3d1258[_0xabae('0x31')][_0xabae('0x3c')]){_0x49444b[_0xabae('0x39')]=_['merge'](_0x49444b[_0xabae('0x39')],{'$or':_['map'](_0x49444b[_0xabae('0x34')],function(_0x3e47f1){var _0x582374={};_0x582374[_0x3e47f1]={'$like':'%'+_0x3d1258['query'][_0xabae('0x3c')]+'%'};return _0x582374;})});}_0x49444b=_[_0xabae('0x3a')]({},_0x49444b,_0x3d1258['options']);return _0x35722a[_0xabae('0x48')](_0x49444b);}})[_0xabae('0x23')](function(_0x13cdbf){if(_0x13cdbf){_0x35168e=_0x13cdbf['length'];if(!_0x3d1258[_0xabae('0x31')][_0xabae('0x4c')](_0xabae('0x36'))){_0x49444b[_0xabae('0x1d')]=qs[_0xabae('0x1d')](_0x3d1258[_0xabae('0x31')][_0xabae('0x1d')]);_0x49444b[_0xabae('0x1b')]=qs['offset'](_0x3d1258[_0xabae('0x31')]['offset']);}return _0x35722a[_0xabae('0x48')](_0x49444b);}})['then'](function(_0x460ed5){if(_0x460ed5){return _0x460ed5?{'count':_0x35168e,'rows':_0x460ed5}:null;}})[_0xabae('0x23')](respondWithResult(_0x3d4448,null))[_0xabae('0x40')](handleError(_0x3d4448,null));};exports[_0xabae('0x4d')]=function(_0x32c061,_0x58f9f8,_0x29db33){if(_0x32c061[_0xabae('0x47')]['id']){delete _0x32c061[_0xabae('0x47')]['id'];}return db[_0xabae('0x2a')][_0xabae('0x49')]({'where':{'id':_0x32c061[_0xabae('0x42')]['id']}})[_0xabae('0x23')](handleEntityNotFound(_0x58f9f8,null))[_0xabae('0x23')](function(_0x54c327){if(_0x54c327){_0x32c061['body']['AccountId']=_0x54c327['id'];_0x32c061[_0xabae('0x47')]['Subjects']=integrations[_0xabae('0x4e')](_0x32c061['body'][_0xabae('0x4f')],_0x32c061['body']['type']);_0x32c061[_0xabae('0x47')][_0xabae('0x50')]=integrations[_0xabae('0x51')](_0x32c061[_0xabae('0x47')][_0xabae('0x4f')],_0x32c061[_0xabae('0x47')][_0xabae('0x2d')]);return db['ServicenowConfiguration'][_0xabae('0x46')](_0x32c061[_0xabae('0x47')],{'include':[{'model':db[_0xabae('0x52')],'as':_0xabae('0x53')},{'model':db[_0xabae('0x52')],'as':_0xabae('0x50')}]});}return null;})[_0xabae('0x23')](respondWithResult(_0x58f9f8,null))['catch'](handleError(_0x58f9f8,null));};exports[_0xabae('0x54')]=function(_0x52fbfd,_0x90f52d,_0x3c454c){var _0x76fc52=[_0xabae('0x55'),_0xabae('0x56'),_0xabae('0x57'),_0xabae('0x58'),_0xabae('0x59'),_0xabae('0x5a'),_0xabae('0x5b'),_0xabae('0x5c'),'category'];var _0xee4561=[_0xabae('0x5d'),_0xabae('0x55'),_0xabae('0x5e'),_0xabae('0x5f'),_0xabae('0x60'),_0xabae('0x61'),_0xabae('0x62'),'hold_reason',_0xabae('0x63'),_0xabae('0x64'),_0xabae('0x65'),_0xabae('0x66'),_0xabae('0x67'),_0xabae('0x68'),_0xabae('0x69'),_0xabae('0x6a'),'state',_0xabae('0x6b'),_0xabae('0x57'),_0xabae('0x37'),_0xabae('0x6c'),_0xabae('0x6d'),'cmdb_ci',_0xabae('0x6e'),_0xabae('0x6f'),_0xabae('0x70'),_0xabae('0x71'),_0xabae('0x72'),_0xabae('0x73'),_0xabae('0x74'),_0xabae('0x75'),_0xabae('0x76'),_0xabae('0x77'),_0xabae('0x78'),_0xabae('0x79'),_0xabae('0x7a'),_0xabae('0x7b'),_0xabae('0x7c'),_0xabae('0x7d'),_0xabae('0x7e'),_0xabae('0x7f'),'subcategory',_0xabae('0x80'),_0xabae('0x81'),_0xabae('0x59'),_0xabae('0x82'),_0xabae('0x83'),_0xabae('0x84'),_0xabae('0x85'),_0xabae('0x86'),_0xabae('0x87'),'description',_0xabae('0x88'),'notify',_0xabae('0x89'),_0xabae('0x8a'),_0xabae('0x8b'),_0xabae('0x8c'),_0xabae('0x8d'),_0xabae('0x8e'),_0xabae('0x8f'),_0xabae('0x90'),'incident_state','urgency','problem_id',_0xabae('0x91'),'reassignment_count','activity_due',_0xabae('0x92'),'severity',_0xabae('0x93'),_0xabae('0x94'),_0xabae('0x95'),_0xabae('0x96'),_0xabae('0x97'),_0xabae('0x98'),_0xabae('0x99'),_0xabae('0x9a'),'escalation',_0xabae('0x9b'),_0xabae('0x9c'),_0xabae('0x9d'),_0xabae('0x9e')];var _0x47dbf0='';var _0x530f7e='';var _0x5e7639=[];var _0x2418fe='';var _0x1c4d25='';var _0x4281f9=[];var _0x3ab862='';var _0x13e7aa='';var _0xa36223={};var _0x3c5dd9='';return db[_0xabae('0x2a')]['findOne']({'where':{'id':_0x52fbfd[_0xabae('0x42')]['id']},'attributes':['id',_0xabae('0x9f'),_0xabae('0xa0'),_0xabae('0xa1'),_0xabae('0xa2'),_0xabae('0xa3')]})[_0xabae('0x23')](handleEntityNotFound(_0x90f52d,null))[_0xabae('0x23')](function(_0x4be029){if(_0x4be029){_0x3c5dd9=_0x4be029['remoteUri'];var _0xeabccb=_0x3c5dd9[_0xabae('0xa4')](-0x1);if(_0xeabccb==='/'){_0x3c5dd9=_0x3c5dd9[_0xabae('0xa5')](0x0,_0x3c5dd9[_0xabae('0xa6')](_0xeabccb));}_0x13e7aa=util[_0xabae('0xa7')]('%s/api/now/doc/table/schema/',_0x3c5dd9);_0x3ab862=util[_0xabae('0xa7')](_0xabae('0xa8'),_0x3c5dd9);_0xa36223={'user':_0x4be029[_0xabae('0x9f')],'pass':_0x4be029['password']};var _0x62b44c={'method':_0xabae('0xa9'),'uri':_0x13e7aa+_0xabae('0xaa'),'auth':_0xa36223,'json':!![]};return rp(_0x62b44c);}})[_0xabae('0x23')](function(_0xaf08f0){if(_0xaf08f0[_0xabae('0xab')][_0xabae('0x35')]>0x0){_0x47dbf0=_0xaf08f0[_0xabae('0xab')];}console[_0xabae('0xac')](_0xabae('0xad'),_0x47dbf0);_0x4281f9=[];_0x530f7e=Object['assign']([],_0x47dbf0);_['remove'](_0x530f7e,function(_0x37a7d9){return!_0x76fc52[_0xabae('0xae')](_0x37a7d9[_0xabae('0x26')]);});_0x530f7e[_0xabae('0xaf')](function(_0x1b6e4b){var _0x1cec8b=createFieldObject(_0x3ab862,_0xa36223,_0x1b6e4b[_0xabae('0xb0')],_0x1b6e4b[_0xabae('0x26')],_0x1b6e4b[_0xabae('0xb1')],![]);_0x4281f9[_0xabae('0xb2')](_0x1cec8b);});return Promise['all'](_0x4281f9);})[_0xabae('0x23')](function(_0x403dc5){_0x5e7639=_0x403dc5;_0x2418fe=Object[_0xabae('0xb3')]([],_0x47dbf0);console[_0xabae('0xac')](_0xabae('0xb4'),_0x47dbf0);_['remove'](_0x2418fe,function(_0x43d332){return _0xee4561[_0xabae('0xae')](_0x43d332[_0xabae('0x26')]);});console[_0xabae('0xac')](_0xabae('0xb5'),_0x2418fe);_0x4281f9=[];_0x2418fe['forEach'](function(_0x3df069){var _0x9219db=createFieldObject(_0x3ab862,_0xa36223,_0x3df069[_0xabae('0xb0')],_0x3df069[_0xabae('0x26')],_0x3df069['label'],!![]);_0x4281f9['push'](_0x9219db);});return Promise['all'](_0x4281f9);})['then'](function(_0x12d3be){_0x1c4d25=_0x12d3be;var _0x5d1400=_0x5e7639[_0xabae('0xb6')](_0x1c4d25);return{'count':_0x5d1400[_0xabae('0x35')],'rows':_0x5d1400};})[_0xabae('0x23')](respondWithResult(_0x90f52d,null))[_0xabae('0x40')](function(_0x6918b7){console['log'](_0xabae('0xb7')+_0x6918b7);var _0x522d03=_0x52fbfd[_0xabae('0x31')][_0xabae('0xb8')]?0x1f4:_0x6918b7[_0xabae('0xb9')]||0x1f4;logger[_0xabae('0xba')](_0x6918b7[_0xabae('0x25')]);delete _0x6918b7['name'];if(_0x522d03===0x191){_0x522d03=0x190;}_0x90f52d[_0xabae('0x17')](_0x522d03)[_0xabae('0x27')](_0x52fbfd[_0xabae('0x31')][_0xabae('0xb8')]?{'message':_0xabae('0xbb'),'statusCode':_0x6918b7['statusCode']}:_0x6918b7);});};function createFieldObject(_0x472700,_0x4dfe82,_0x3e21dd,_0x1030c4,_0xb9c6a0,_0x4a4fae){return new Promise(function(_0x2eaf58,_0x42dc12){var _0x3b26b3={'id':_0x1030c4,'name':_0xb9c6a0,'custom':_0x4a4fae};if(_0x3e21dd===_0xabae('0xbc')){_0x3b26b3['options']=[{'name':_0xabae('0xbd'),'value':_0xabae('0xbe')},{'name':'False','value':_0xabae('0xbf')}];_0x2eaf58(_0x3b26b3);}else{var _0x5c4e89={'method':_0xabae('0xa9'),'uri':_0x472700+_0xabae('0xc0')+_0x1030c4,'auth':_0x4dfe82,'json':!![]};return rp(_0x5c4e89)[_0xabae('0x23')](function(_0x2d9b6a){var _0x18069d=[];if(_0x2d9b6a['result']['length']>0x0){_0x2d9b6a[_0xabae('0xab')]['forEach'](function(_0x3c2eb3){if(_0x3c2eb3['inactive']===_0xabae('0xbf')){var _0x10a165={'name':_0x3c2eb3[_0xabae('0xb1')],'value':_0x3c2eb3[_0xabae('0xc1')]};_0x18069d[_0xabae('0xb2')](_0x10a165);}});}_0x3b26b3['options']=_0x18069d;if(_0x3b26b3['options'][_0xabae('0x35')]>0x0){_0x2eaf58(_0x3b26b3);}else{if(_0x4a4fae==![]){_0x2eaf58();}else{_0x2eaf58(_0x3b26b3);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 0c14598..00e0e86 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 _0xc1c6=['rimraf','../../components/integrations/configuration','define','ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x15b9cc,_0x456106){var _0x1c16a2=function(_0x59294f){while(--_0x59294f){_0x15b9cc['push'](_0x15b9cc['shift']());}};_0x1c16a2(++_0x456106);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x4b54e3,_0x2655e1){_0x4b54e3=_0x4b54e3-0x0;var _0xcfc057=_0xc1c6[_0x4b54e3];return _0xcfc057;};'use strict';var _=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var logger=require(_0x6c1c('0x2'))('api');var moment=require(_0x6c1c('0x3'));var BPromise=require('bluebird');var rp=require(_0x6c1c('0x4'));var fs=require('fs');var path=require(_0x6c1c('0x5'));var rimraf=require(_0x6c1c('0x6'));var config=require('../../config/environment');var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0x6c1c('0x7'));module['exports']=function(_0x50c1bb,_0x582bec){return _0x50c1bb[_0x6c1c('0x8')](_0x6c1c('0x9'),attributes,{'tableName':_0x6c1c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb4c7=['moment','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','exports','ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger','api'];(function(_0xf8618c,_0x2d5258){var _0x5380c5=function(_0x3367bc){while(--_0x3367bc){_0xf8618c['push'](_0xf8618c['shift']());}};_0x5380c5(++_0x2d5258);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x17ef24,_0x392dce){_0x17ef24=_0x17ef24-0x0;var _0x367246=_0xb4c7[_0x17ef24];return _0x367246;};'use strict';var _=require(_0x7b4c('0x0'));var util=require(_0x7b4c('0x1'));var logger=require(_0x7b4c('0x2'))(_0x7b4c('0x3'));var moment=require(_0x7b4c('0x4'));var BPromise=require('bluebird');var rp=require(_0x7b4c('0x5'));var fs=require('fs');var path=require(_0x7b4c('0x6'));var rimraf=require(_0x7b4c('0x7'));var config=require(_0x7b4c('0x8'));var attributes=require(_0x7b4c('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x7b4c('0xa')]=function(_0x10e197,_0x2dd5c7){return _0x10e197['define'](_0x7b4c('0xb'),attributes,{'tableName':_0x7b4c('0xc'),'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 eea49f5..779d4a1 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 _0xf569=['client','http','request','info','ServicenowAccount,\x20%s,\x20%s','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetServicenowAccount','ServicenowAccount','findAll','options','include','model','attributes','map','then','debug','catch','ShowServicenowAccount','find','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x427740,_0x4868a0){var _0x541a9d=function(_0x195c11){while(--_0x195c11){_0x427740['push'](_0x427740['shift']());}};_0x541a9d(++_0x4868a0);}(_0xf569,0x86));var _0x9f56=function(_0x1a9204,_0x1c9e00){_0x1a9204=_0x1a9204-0x0;var _0x17ca68=_0xf569[_0x1a9204];return _0x17ca68;};'use strict';var _=require('lodash');var util=require(_0x9f56('0x0'));var moment=require(_0x9f56('0x1'));var BPromise=require(_0x9f56('0x2'));var rs=require(_0x9f56('0x3'));var fs=require('fs');var Redis=require(_0x9f56('0x4'));var db=require(_0x9f56('0x5'))['db'];var utils=require(_0x9f56('0x6'));var logger=require('../../config/logger')(_0x9f56('0x7'));var config=require(_0x9f56('0x8'));var jayson=require(_0x9f56('0x9'));var client=jayson[_0x9f56('0xa')][_0x9f56('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x19b326,_0x3fd106,_0x34fb61){return new BPromise(function(_0x4d44ea,_0x1d3674){return client[_0x9f56('0xc')](_0x19b326,_0x34fb61)['then'](function(_0x2015f1){logger[_0x9f56('0xd')](_0x9f56('0xe'),_0x3fd106,'request\x20sent');logger['debug'](_0x9f56('0xf'),_0x3fd106,_0x9f56('0x10'),JSON[_0x9f56('0x11')](_0x2015f1));if(_0x2015f1[_0x9f56('0x12')]){if(_0x2015f1[_0x9f56('0x12')][_0x9f56('0x13')]===0x1f4){logger['error'](_0x9f56('0xe'),_0x3fd106,_0x2015f1[_0x9f56('0x12')][_0x9f56('0x14')]);return _0x1d3674(_0x2015f1[_0x9f56('0x12')][_0x9f56('0x14')]);}logger[_0x9f56('0x12')]('ServicenowAccount,\x20%s,\x20%s',_0x3fd106,_0x2015f1['error'][_0x9f56('0x14')]);return _0x4d44ea(_0x2015f1[_0x9f56('0x12')]['message']);}else{logger[_0x9f56('0xd')](_0x9f56('0xe'),_0x3fd106,_0x9f56('0x10'));_0x4d44ea(_0x2015f1[_0x9f56('0x15')][_0x9f56('0x14')]);}})['catch'](function(_0x17db0b){logger[_0x9f56('0x12')](_0x9f56('0xe'),_0x3fd106,_0x17db0b);_0x1d3674(_0x17db0b);});});}exports[_0x9f56('0x16')]=function(_0x45a07c){var _0x213619=this;return new Promise(function(_0x31273e,_0x4b5b75){return db[_0x9f56('0x17')][_0x9f56('0x18')]({'raw':_0x45a07c[_0x9f56('0x19')]?_0x45a07c[_0x9f56('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x45a07c[_0x9f56('0x19')]?_0x45a07c[_0x9f56('0x19')]['where']||null:null,'attributes':_0x45a07c[_0x9f56('0x19')]?_0x45a07c[_0x9f56('0x19')]['attributes']||null:null,'limit':_0x45a07c['options']?_0x45a07c[_0x9f56('0x19')]['limit']||null:null,'include':_0x45a07c[_0x9f56('0x19')]?_0x45a07c[_0x9f56('0x19')][_0x9f56('0x1a')]?_['map'](_0x45a07c['options'][_0x9f56('0x1a')],function(_0xfee9ab){return{'model':db[_0xfee9ab[_0x9f56('0x1b')]],'as':_0xfee9ab['as'],'attributes':_0xfee9ab[_0x9f56('0x1c')],'include':_0xfee9ab[_0x9f56('0x1a')]?_[_0x9f56('0x1d')](_0xfee9ab[_0x9f56('0x1a')],function(_0x203e42){return{'model':db[_0x203e42[_0x9f56('0x1b')]],'as':_0x203e42['as'],'attributes':_0x203e42[_0x9f56('0x1c')],'include':_0x203e42[_0x9f56('0x1a')]?_[_0x9f56('0x1d')](_0x203e42['include'],function(_0x3c0bf9){return{'model':db[_0x3c0bf9[_0x9f56('0x1b')]],'as':_0x3c0bf9['as'],'attributes':_0x3c0bf9[_0x9f56('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x9f56('0x1e')](function(_0x90e4cb){logger[_0x9f56('0xd')](_0x9f56('0x16'),_0x45a07c);logger[_0x9f56('0x1f')]('GetServicenowAccount',_0x45a07c,JSON[_0x9f56('0x11')](_0x90e4cb));_0x31273e(_0x90e4cb);})[_0x9f56('0x20')](function(_0x1ffa49){logger[_0x9f56('0x12')](_0x9f56('0x16'),_0x1ffa49[_0x9f56('0x14')],_0x45a07c);_0x4b5b75(_0x213619[_0x9f56('0x12')](0x1f4,_0x1ffa49[_0x9f56('0x14')]));});});};exports[_0x9f56('0x21')]=function(_0x2432ca){var _0x31c128=this;return new Promise(function(_0x4bca9a,_0x183e2c){return db[_0x9f56('0x17')][_0x9f56('0x22')]({'raw':_0x2432ca[_0x9f56('0x19')]?_0x2432ca['options'][_0x9f56('0x23')]===undefined?!![]:![]:!![],'where':_0x2432ca[_0x9f56('0x19')]?_0x2432ca[_0x9f56('0x19')]['where']||null:null,'attributes':_0x2432ca[_0x9f56('0x19')]?_0x2432ca[_0x9f56('0x19')][_0x9f56('0x1c')]||null:null,'include':_0x2432ca[_0x9f56('0x19')]?_0x2432ca[_0x9f56('0x19')][_0x9f56('0x1a')]?_['map'](_0x2432ca[_0x9f56('0x19')][_0x9f56('0x1a')],function(_0x421f9e){return{'model':db[_0x421f9e[_0x9f56('0x1b')]],'as':_0x421f9e['as'],'attributes':_0x421f9e[_0x9f56('0x1c')],'include':_0x421f9e['include']?_[_0x9f56('0x1d')](_0x421f9e['include'],function(_0x599a96){return{'model':db[_0x599a96['model']],'as':_0x599a96['as'],'attributes':_0x599a96['attributes'],'include':_0x599a96[_0x9f56('0x1a')]?_[_0x9f56('0x1d')](_0x599a96[_0x9f56('0x1a')],function(_0x2705bb){return{'model':db[_0x2705bb[_0x9f56('0x1b')]],'as':_0x2705bb['as'],'attributes':_0x2705bb[_0x9f56('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x9f56('0x1e')](function(_0x7f4437){logger[_0x9f56('0xd')](_0x9f56('0x21'),_0x2432ca);logger[_0x9f56('0x1f')](_0x9f56('0x21'),_0x2432ca,JSON[_0x9f56('0x11')](_0x7f4437));_0x4bca9a(_0x7f4437);})[_0x9f56('0x20')](function(_0x43a5d2){logger[_0x9f56('0x12')]('ShowServicenowAccount',_0x43a5d2[_0x9f56('0x14')],_0x2432ca);_0x183e2c(_0x31c128[_0x9f56('0x12')](0x1f4,_0x43a5d2[_0x9f56('0x14')]));});});}; \ No newline at end of file +var _0x9783=['limit','include','map','model','catch','ShowServicenowAccount','ServicenowAccount','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','ServicenowAccount,\x20%s,\x20%s','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetServicenowAccount','findAll','options','raw','where','attributes'];(function(_0x4fa963,_0x1aa2b5){var _0x28cdea=function(_0x2fe5e7){while(--_0x2fe5e7){_0x4fa963['push'](_0x4fa963['shift']());}};_0x28cdea(++_0x1aa2b5);}(_0x9783,0x97));var _0x3978=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9783[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3978('0x0'));var util=require('util');var moment=require(_0x3978('0x1'));var BPromise=require(_0x3978('0x2'));var rs=require(_0x3978('0x3'));var fs=require('fs');var Redis=require(_0x3978('0x4'));var db=require(_0x3978('0x5'))['db'];var utils=require(_0x3978('0x6'));var logger=require(_0x3978('0x7'))(_0x3978('0x8'));var config=require(_0x3978('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3978('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f4e7a,_0x3f7b13,_0x326606){return new BPromise(function(_0x4d5c0c,_0x47103c){return client[_0x3978('0xb')](_0x2f4e7a,_0x326606)[_0x3978('0xc')](function(_0x5f2650){logger[_0x3978('0xd')](_0x3978('0xe'),_0x3f7b13,'request\x20sent');logger[_0x3978('0xf')](_0x3978('0x10'),_0x3f7b13,_0x3978('0x11'),JSON[_0x3978('0x12')](_0x5f2650));if(_0x5f2650['error']){if(_0x5f2650[_0x3978('0x13')][_0x3978('0x14')]===0x1f4){logger[_0x3978('0x13')](_0x3978('0xe'),_0x3f7b13,_0x5f2650[_0x3978('0x13')][_0x3978('0x15')]);return _0x47103c(_0x5f2650['error']['message']);}logger[_0x3978('0x13')](_0x3978('0xe'),_0x3f7b13,_0x5f2650['error']['message']);return _0x4d5c0c(_0x5f2650[_0x3978('0x13')][_0x3978('0x15')]);}else{logger[_0x3978('0xd')](_0x3978('0xe'),_0x3f7b13,_0x3978('0x11'));_0x4d5c0c(_0x5f2650[_0x3978('0x16')][_0x3978('0x15')]);}})['catch'](function(_0x46083d){logger[_0x3978('0x13')](_0x3978('0xe'),_0x3f7b13,_0x46083d);_0x47103c(_0x46083d);});});}exports[_0x3978('0x17')]=function(_0x29ae32){var _0x2eed3c=this;return new Promise(function(_0x9f5834,_0x33971a){return db['ServicenowAccount'][_0x3978('0x18')]({'raw':_0x29ae32[_0x3978('0x19')]?_0x29ae32[_0x3978('0x19')][_0x3978('0x1a')]===undefined?!![]:![]:!![],'where':_0x29ae32[_0x3978('0x19')]?_0x29ae32[_0x3978('0x19')][_0x3978('0x1b')]||null:null,'attributes':_0x29ae32[_0x3978('0x19')]?_0x29ae32[_0x3978('0x19')][_0x3978('0x1c')]||null:null,'limit':_0x29ae32['options']?_0x29ae32[_0x3978('0x19')][_0x3978('0x1d')]||null:null,'include':_0x29ae32[_0x3978('0x19')]?_0x29ae32[_0x3978('0x19')][_0x3978('0x1e')]?_['map'](_0x29ae32[_0x3978('0x19')][_0x3978('0x1e')],function(_0x3b984a){return{'model':db[_0x3b984a['model']],'as':_0x3b984a['as'],'attributes':_0x3b984a[_0x3978('0x1c')],'include':_0x3b984a[_0x3978('0x1e')]?_[_0x3978('0x1f')](_0x3b984a[_0x3978('0x1e')],function(_0x42422b){return{'model':db[_0x42422b['model']],'as':_0x42422b['as'],'attributes':_0x42422b[_0x3978('0x1c')],'include':_0x42422b[_0x3978('0x1e')]?_['map'](_0x42422b[_0x3978('0x1e')],function(_0x7551d8){return{'model':db[_0x7551d8[_0x3978('0x20')]],'as':_0x7551d8['as'],'attributes':_0x7551d8[_0x3978('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3978('0xc')](function(_0xec3903){logger[_0x3978('0xd')](_0x3978('0x17'),_0x29ae32);logger[_0x3978('0xf')](_0x3978('0x17'),_0x29ae32,JSON[_0x3978('0x12')](_0xec3903));_0x9f5834(_0xec3903);})[_0x3978('0x21')](function(_0x41aa53){logger[_0x3978('0x13')](_0x3978('0x17'),_0x41aa53[_0x3978('0x15')],_0x29ae32);_0x33971a(_0x2eed3c[_0x3978('0x13')](0x1f4,_0x41aa53[_0x3978('0x15')]));});});};exports[_0x3978('0x22')]=function(_0x1a431d){var _0xb565c0=this;return new Promise(function(_0x135dad,_0xb8999f){return db[_0x3978('0x23')]['find']({'raw':_0x1a431d['options']?_0x1a431d[_0x3978('0x19')][_0x3978('0x1a')]===undefined?!![]:![]:!![],'where':_0x1a431d[_0x3978('0x19')]?_0x1a431d['options'][_0x3978('0x1b')]||null:null,'attributes':_0x1a431d[_0x3978('0x19')]?_0x1a431d[_0x3978('0x19')][_0x3978('0x1c')]||null:null,'include':_0x1a431d['options']?_0x1a431d[_0x3978('0x19')][_0x3978('0x1e')]?_['map'](_0x1a431d[_0x3978('0x19')][_0x3978('0x1e')],function(_0x388742){return{'model':db[_0x388742['model']],'as':_0x388742['as'],'attributes':_0x388742['attributes'],'include':_0x388742['include']?_[_0x3978('0x1f')](_0x388742[_0x3978('0x1e')],function(_0x4f4902){return{'model':db[_0x4f4902[_0x3978('0x20')]],'as':_0x4f4902['as'],'attributes':_0x4f4902[_0x3978('0x1c')],'include':_0x4f4902[_0x3978('0x1e')]?_[_0x3978('0x1f')](_0x4f4902[_0x3978('0x1e')],function(_0x409417){return{'model':db[_0x409417[_0x3978('0x20')]],'as':_0x409417['as'],'attributes':_0x409417[_0x3978('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3978('0xc')](function(_0x1c1a1b){logger[_0x3978('0xd')](_0x3978('0x22'),_0x1a431d);logger[_0x3978('0xf')](_0x3978('0x22'),_0x1a431d,JSON[_0x3978('0x12')](_0x1c1a1b));_0x135dad(_0x1c1a1b);})['catch'](function(_0x548eeb){logger['error']('ShowServicenowAccount',_0x548eeb[_0x3978('0x15')],_0x1a431d);_0xb8999f(_0xb565c0[_0x3978('0x13')](0x1f4,_0x548eeb[_0x3978('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 864ad59..38ff1ee 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 _0x4670=['./intServicenowConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','/:id/subjects','getDescriptions','post','create','update','delete','destroy','exports','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x4883cb,_0x3df63c){var _0x33aad7=function(_0x2e901e){while(--_0x2e901e){_0x4883cb['push'](_0x4883cb['shift']());}};_0x33aad7(++_0x3df63c);}(_0x4670,0x189));var _0x0467=function(_0x429bb5,_0x5783d9){_0x429bb5=_0x429bb5-0x0;var _0x510ea9=_0x4670[_0x429bb5];return _0x510ea9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0467('0x0'));var timeout=require(_0x0467('0x1'));var express=require('express');var router=express[_0x0467('0x2')]();var fs_extra=require(_0x0467('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x0467('0x4'));var config=require(_0x0467('0x5'));var controller=require(_0x0467('0x6'));router[_0x0467('0x7')]('/',auth['isAuthenticated'](),controller[_0x0467('0x8')]);router['get'](_0x0467('0x9'),auth[_0x0467('0xa')](),controller[_0x0467('0xb')]);router['get'](_0x0467('0xc'),auth[_0x0467('0xa')](),controller['getFields']);router[_0x0467('0x7')](_0x0467('0xd'),auth[_0x0467('0xa')](),controller['getSubjects']);router[_0x0467('0x7')]('/:id/descriptions',auth[_0x0467('0xa')](),controller[_0x0467('0xe')]);router[_0x0467('0xf')]('/',auth[_0x0467('0xa')](),controller[_0x0467('0x10')]);router['put'](_0x0467('0x9'),auth[_0x0467('0xa')](),controller[_0x0467('0x11')]);router[_0x0467('0x12')](_0x0467('0x9'),auth[_0x0467('0xa')](),controller[_0x0467('0x13')]);module[_0x0467('0x14')]=router; \ No newline at end of file +var _0xdecd=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','multer','util','path','express'];(function(_0x1c52bd,_0x295b3c){var _0x506f37=function(_0x372f81){while(--_0x372f81){_0x1c52bd['push'](_0x1c52bd['shift']());}};_0x506f37(++_0x295b3c);}(_0xdecd,0xe2));var _0xddec=function(_0x24be5b,_0xee6e5b){_0x24be5b=_0x24be5b-0x0;var _0x3f8698=_0xdecd[_0x24be5b];return _0x3f8698;};'use strict';var multer=require(_0xddec('0x0'));var util=require(_0xddec('0x1'));var path=require(_0xddec('0x2'));var timeout=require('connect-timeout');var express=require(_0xddec('0x3'));var router=express['Router']();var fs_extra=require(_0xddec('0x4'));var auth=require(_0xddec('0x5'));var interaction=require(_0xddec('0x6'));var config=require(_0xddec('0x7'));var controller=require(_0xddec('0x8'));router[_0xddec('0x9')]('/',auth[_0xddec('0xa')](),controller[_0xddec('0xb')]);router['get'](_0xddec('0xc'),auth[_0xddec('0xa')](),controller[_0xddec('0xd')]);router[_0xddec('0x9')]('/:id/fields',auth[_0xddec('0xa')](),controller[_0xddec('0xe')]);router[_0xddec('0x9')](_0xddec('0xf'),auth['isAuthenticated'](),controller[_0xddec('0x10')]);router[_0xddec('0x9')](_0xddec('0x11'),auth[_0xddec('0xa')](),controller[_0xddec('0x12')]);router[_0xddec('0x13')]('/',auth['isAuthenticated'](),controller[_0xddec('0x14')]);router[_0xddec('0x15')](_0xddec('0xc'),auth[_0xddec('0xa')](),controller[_0xddec('0x16')]);router['delete']('/:id',auth[_0xddec('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index ddf5ecd..ca6d7fc 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 _0xf70a=['sequelize','STRING'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0xf70a,0x1b2));var _0xaf70=function(_0x12a5ac,_0x4cb0d2){_0x12a5ac=_0x12a5ac-0x0;var _0x282958=_0xf70a[_0x12a5ac];return _0x282958;};'use strict';var Sequelize=require(_0xaf70('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xaf70('0x1')]}}; \ No newline at end of file +var _0x4440=['sequelize','exports','STRING'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x4440,0x1e0));var _0x0444=function(_0x4f407e,_0x447f7c){_0x4f407e=_0x4f407e-0x0;var _0x2aff24=_0x4440[_0x4f407e];return _0x2aff24;};'use strict';var Sequelize=require(_0x0444('0x0'));module[_0x0444('0x1')]={'name':{'type':Sequelize[_0x0444('0x2')]},'description':{'type':Sequelize[_0x0444('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 875b621..e02418f 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 _0x27de=['index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','params','keys','fields','includeAll','update','find','destroy','getFields','findOne','options','ServicenowField','getSubjects','hasOwnProperty','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','Content-Range','apply','save','then','end','name','send'];(function(_0x81c724,_0x1042a8){var _0x13e49a=function(_0x59a4ea){while(--_0x59a4ea){_0x81c724['push'](_0x81c724['shift']());}};_0x13e49a(++_0x1042a8);}(_0x27de,0x108));var _0xe27d=function(_0x2a6885,_0xe5b68e){_0x2a6885=_0x2a6885-0x0;var _0x30e958=_0x27de[_0x2a6885];return _0x30e958;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe27d('0x0'));var zipdir=require(_0xe27d('0x1'));var jsonpatch=require(_0xe27d('0x2'));var rp=require(_0xe27d('0x3'));var moment=require(_0xe27d('0x4'));var BPromise=require(_0xe27d('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe27d('0x6'));var sox=require(_0xe27d('0x7'));var csv=require(_0xe27d('0x8'));var ejs=require(_0xe27d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe27d('0xa'));var squel=require('squel');var crypto=require(_0xe27d('0xb'));var jsforce=require(_0xe27d('0xc'));var deskjs=require(_0xe27d('0xd'));var toCsv=require(_0xe27d('0x8'));var querystring=require(_0xe27d('0xe'));var Papa=require(_0xe27d('0xf'));var Redis=require(_0xe27d('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe27d('0x11'));var hardwareService=require(_0xe27d('0x12'));var logger=require('../../config/logger')(_0xe27d('0x13'));var utils=require(_0xe27d('0x14'));var config=require(_0xe27d('0x15'));var licenseUtil=require(_0xe27d('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3fe1d0,_0x5c2525){_0x5c2525=_0x5c2525||0xcc;return function(_0x14156f){if(_0x14156f){return _0x3fe1d0['sendStatus'](_0x5c2525);}return _0x3fe1d0[_0xe27d('0x17')](_0x5c2525)['end']();};}function respondWithResult(_0x3465cb,_0x1918a2){_0x1918a2=_0x1918a2||0xc8;return function(_0x13dbc1){if(_0x13dbc1){return _0x3465cb[_0xe27d('0x17')](_0x1918a2)[_0xe27d('0x18')](_0x13dbc1);}};}function respondWithFilteredResult(_0x16e5ae,_0x392da2){return function(_0xcd2905){if(_0xcd2905){var _0x1fbd56=typeof _0x392da2[_0xe27d('0x19')]===_0xe27d('0x1a')&&typeof _0x392da2[_0xe27d('0x1b')]===_0xe27d('0x1a');var _0x20f743=_0xcd2905[_0xe27d('0x1c')];var _0x2939b0=_0x1fbd56?0x0:_0x392da2[_0xe27d('0x19')];var _0x129b0c=_0x1fbd56?_0xcd2905['count']:_0x392da2[_0xe27d('0x19')]+_0x392da2['limit'];var _0x22e1e4;if(_0x129b0c>=_0x20f743){_0x129b0c=_0x20f743;_0x22e1e4=0xc8;}else{_0x22e1e4=0xce;}_0x16e5ae['status'](_0x22e1e4);return _0x16e5ae['set'](_0xe27d('0x1d'),_0x2939b0+'-'+_0x129b0c+'/'+_0x20f743)[_0xe27d('0x18')](_0xcd2905);}return null;};}function patchUpdates(_0x254c2f){return function(_0x299776){try{jsonpatch[_0xe27d('0x1e')](_0x299776,_0x254c2f,!![]);}catch(_0x16477c){return BPromise['reject'](_0x16477c);}return _0x299776[_0xe27d('0x1f')]();};}function saveUpdates(_0x3fc780,_0xbf6fa){return function(_0x170036){if(_0x170036){return _0x170036['update'](_0x3fc780)[_0xe27d('0x20')](function(_0x49dc3a){return _0x49dc3a;});}return null;};}function removeEntity(_0x57a53d,_0x4a0a17){return function(_0x162f23){if(_0x162f23){return _0x162f23['destroy']()[_0xe27d('0x20')](function(){_0x57a53d[_0xe27d('0x17')](0xcc)[_0xe27d('0x21')]();});}};}function handleEntityNotFound(_0xef1724,_0x4fb9bd){return function(_0x3dfab7){if(!_0x3dfab7){_0xef1724['sendStatus'](0x194);}return _0x3dfab7;};}function handleError(_0x4ce411,_0x2ca7e1){_0x2ca7e1=_0x2ca7e1||0x1f4;return function(_0x2de23c){logger['error'](_0x2de23c['stack']);if(_0x2de23c[_0xe27d('0x22')]){delete _0x2de23c[_0xe27d('0x22')];}_0x4ce411[_0xe27d('0x17')](_0x2ca7e1)[_0xe27d('0x23')](_0x2de23c);};}exports[_0xe27d('0x24')]=function(_0x527f8e,_0x469474){var _0xd36dd4={},_0x240aa3={},_0x1095f7={'count':0x0,'rows':[]};var _0x7dcfb2=_[_0xe27d('0x25')](db[_0xe27d('0x26')][_0xe27d('0x27')],function(_0x1221a){return{'name':_0x1221a[_0xe27d('0x28')],'type':_0x1221a[_0xe27d('0x29')][_0xe27d('0x2a')]};});_0x240aa3[_0xe27d('0x2b')]=_[_0xe27d('0x25')](_0x7dcfb2,'name');_0x240aa3[_0xe27d('0x2c')]=_['keys'](_0x527f8e['query']);_0x240aa3[_0xe27d('0x2d')]=_[_0xe27d('0x2e')](_0x240aa3[_0xe27d('0x2b')],_0x240aa3[_0xe27d('0x2c')]);_0xd36dd4[_0xe27d('0x2f')]=_[_0xe27d('0x2e')](_0x240aa3[_0xe27d('0x2b')],qs['fields'](_0x527f8e[_0xe27d('0x2c')]['fields']));_0xd36dd4[_0xe27d('0x2f')]=_0xd36dd4[_0xe27d('0x2f')][_0xe27d('0x30')]?_0xd36dd4[_0xe27d('0x2f')]:_0x240aa3[_0xe27d('0x2b')];if(!_0x527f8e[_0xe27d('0x2c')]['hasOwnProperty'](_0xe27d('0x31'))){_0xd36dd4[_0xe27d('0x1b')]=qs['limit'](_0x527f8e[_0xe27d('0x2c')][_0xe27d('0x1b')]);_0xd36dd4[_0xe27d('0x19')]=qs['offset'](_0x527f8e[_0xe27d('0x2c')][_0xe27d('0x19')]);}_0xd36dd4[_0xe27d('0x32')]=qs[_0xe27d('0x33')](_0x527f8e[_0xe27d('0x2c')][_0xe27d('0x33')]);_0xd36dd4[_0xe27d('0x34')]=qs['filters'](_[_0xe27d('0x35')](_0x527f8e['query'],_0x240aa3[_0xe27d('0x2d')]),_0x7dcfb2);if(_0x527f8e['query'][_0xe27d('0x36')]){_0xd36dd4[_0xe27d('0x34')]=_[_0xe27d('0x37')](_0xd36dd4[_0xe27d('0x34')],{'$or':_[_0xe27d('0x25')](_0x7dcfb2,function(_0x6dc03e){if(_0x6dc03e[_0xe27d('0x29')]!==_0xe27d('0x38')){var _0x2ef393={};_0x2ef393[_0x6dc03e[_0xe27d('0x22')]]={'$like':'%'+_0x527f8e[_0xe27d('0x2c')][_0xe27d('0x36')]+'%'};return _0x2ef393;}})});}_0xd36dd4=_[_0xe27d('0x37')]({},_0xd36dd4,_0x527f8e['options']);var _0x524aec={'where':_0xd36dd4[_0xe27d('0x34')]};return db[_0xe27d('0x26')][_0xe27d('0x1c')](_0x524aec)[_0xe27d('0x20')](function(_0x3df1e1){_0x1095f7[_0xe27d('0x1c')]=_0x3df1e1;if(_0x527f8e[_0xe27d('0x2c')]['includeAll']){_0xd36dd4[_0xe27d('0x39')]=[{'all':!![]}];}return db[_0xe27d('0x26')][_0xe27d('0x3a')](_0xd36dd4);})[_0xe27d('0x20')](function(_0x1e72e7){_0x1095f7[_0xe27d('0x3b')]=_0x1e72e7;return _0x1095f7;})[_0xe27d('0x20')](respondWithFilteredResult(_0x469474,_0xd36dd4))[_0xe27d('0x3c')](handleError(_0x469474,null));};exports['show']=function(_0x27d955,_0xc925b8){var _0x32f1a1={'raw':![],'where':{'id':_0x27d955[_0xe27d('0x3d')]['id']}},_0xf976a6={};_0xf976a6['model']=_[_0xe27d('0x3e')](db['ServicenowConfiguration'][_0xe27d('0x27')]);_0xf976a6[_0xe27d('0x2c')]=_[_0xe27d('0x3e')](_0x27d955['query']);_0xf976a6['filters']=_[_0xe27d('0x2e')](_0xf976a6[_0xe27d('0x2b')],_0xf976a6[_0xe27d('0x2c')]);_0x32f1a1[_0xe27d('0x2f')]=_[_0xe27d('0x2e')](_0xf976a6[_0xe27d('0x2b')],qs[_0xe27d('0x3f')](_0x27d955[_0xe27d('0x2c')][_0xe27d('0x3f')]));_0x32f1a1[_0xe27d('0x2f')]=_0x32f1a1['attributes']['length']?_0x32f1a1[_0xe27d('0x2f')]:_0xf976a6[_0xe27d('0x2b')];if(_0x27d955[_0xe27d('0x2c')][_0xe27d('0x40')]){_0x32f1a1[_0xe27d('0x39')]=[{'all':!![]}];}_0x32f1a1=_[_0xe27d('0x37')]({},_0x32f1a1,_0x27d955['options']);return db[_0xe27d('0x26')]['find'](_0x32f1a1)[_0xe27d('0x20')](handleEntityNotFound(_0xc925b8,null))['then'](respondWithResult(_0xc925b8,null))['catch'](handleError(_0xc925b8,null));};exports['create']=function(_0x4122f8,_0x260273){return db[_0xe27d('0x26')]['create'](_0x4122f8['body'],{})[_0xe27d('0x20')](respondWithResult(_0x260273,0xc9))[_0xe27d('0x3c')](handleError(_0x260273,null));};exports[_0xe27d('0x41')]=function(_0x5ad9e3,_0x51e2b4){if(_0x5ad9e3['body']['id']){delete _0x5ad9e3['body']['id'];}return db[_0xe27d('0x26')][_0xe27d('0x42')]({'where':{'id':_0x5ad9e3[_0xe27d('0x3d')]['id']}})[_0xe27d('0x20')](handleEntityNotFound(_0x51e2b4,null))['then'](saveUpdates(_0x5ad9e3['body'],null))['then'](respondWithResult(_0x51e2b4,null))['catch'](handleError(_0x51e2b4,null));};exports[_0xe27d('0x43')]=function(_0x54c457,_0x169657){return db[_0xe27d('0x26')][_0xe27d('0x42')]({'where':{'id':_0x54c457[_0xe27d('0x3d')]['id']}})['then'](handleEntityNotFound(_0x169657,null))[_0xe27d('0x20')](removeEntity(_0x169657,null))[_0xe27d('0x3c')](handleError(_0x169657,null));};exports[_0xe27d('0x44')]=function(_0x388f1e,_0x383466,_0x2161cf){var _0x2b5dab={};var _0x37c5e3={};var _0x2b73c7;var _0x1ad641;return db['ServicenowConfiguration'][_0xe27d('0x45')]({'where':{'id':_0x388f1e['params']['id']}})[_0xe27d('0x20')](handleEntityNotFound(_0x383466,null))[_0xe27d('0x20')](function(_0x5a861b){if(_0x5a861b){_0x2b73c7=_0x5a861b;_0x37c5e3['model']=_[_0xe27d('0x3e')](db['ServicenowField'][_0xe27d('0x27')]);_0x37c5e3[_0xe27d('0x2c')]=_['keys'](_0x388f1e[_0xe27d('0x2c')]);_0x37c5e3['filters']=_['intersection'](_0x37c5e3['model'],_0x37c5e3[_0xe27d('0x2c')]);_0x2b5dab[_0xe27d('0x2f')]=_['intersection'](_0x37c5e3[_0xe27d('0x2b')],qs[_0xe27d('0x3f')](_0x388f1e[_0xe27d('0x2c')][_0xe27d('0x3f')]));_0x2b5dab['attributes']=_0x2b5dab[_0xe27d('0x2f')][_0xe27d('0x30')]?_0x2b5dab[_0xe27d('0x2f')]:_0x37c5e3['model'];_0x2b5dab['order']=qs[_0xe27d('0x33')](_0x388f1e[_0xe27d('0x2c')][_0xe27d('0x33')]);_0x2b5dab[_0xe27d('0x34')]=qs['filters'](_['pick'](_0x388f1e[_0xe27d('0x2c')],_0x37c5e3[_0xe27d('0x2d')]));if(_0x388f1e[_0xe27d('0x2c')][_0xe27d('0x36')]){_0x2b5dab[_0xe27d('0x34')]=_[_0xe27d('0x37')](_0x2b5dab[_0xe27d('0x34')],{'$or':_[_0xe27d('0x25')](_0x2b5dab[_0xe27d('0x2f')],function(_0x45bab3){var _0x103bef={};_0x103bef[_0x45bab3]={'$like':'%'+_0x388f1e[_0xe27d('0x2c')]['filter']+'%'};return _0x103bef;})});}_0x2b5dab=_['merge']({},_0x2b5dab,_0x388f1e[_0xe27d('0x46')]);return _0x2b73c7[_0xe27d('0x44')](_0x2b5dab);}})[_0xe27d('0x20')](function(_0x37bc35){if(_0x37bc35){_0x1ad641=_0x37bc35[_0xe27d('0x30')];if(!_0x388f1e[_0xe27d('0x2c')]['hasOwnProperty'](_0xe27d('0x31'))){_0x2b5dab[_0xe27d('0x1b')]=qs['limit'](_0x388f1e[_0xe27d('0x2c')][_0xe27d('0x1b')]);_0x2b5dab[_0xe27d('0x19')]=qs[_0xe27d('0x19')](_0x388f1e['query'][_0xe27d('0x19')]);}return _0x2b73c7[_0xe27d('0x44')](_0x2b5dab);}})[_0xe27d('0x20')](function(_0x4de655){if(_0x4de655){return _0x4de655?{'count':_0x1ad641,'rows':_0x4de655}:null;}})[_0xe27d('0x20')](respondWithResult(_0x383466,null))[_0xe27d('0x3c')](handleError(_0x383466,null));};exports['getSubjects']=function(_0x5a6c55,_0x479a5a,_0x41937c){var _0x365f32={};var _0x35cd12={};var _0x23688f;var _0x14ea0c;return db['ServicenowConfiguration'][_0xe27d('0x45')]({'where':{'id':_0x5a6c55[_0xe27d('0x3d')]['id']}})[_0xe27d('0x20')](handleEntityNotFound(_0x479a5a,null))[_0xe27d('0x20')](function(_0x3df7c6){if(_0x3df7c6){_0x23688f=_0x3df7c6;_0x35cd12[_0xe27d('0x2b')]=_['keys'](db[_0xe27d('0x47')]['rawAttributes']);_0x35cd12[_0xe27d('0x2c')]=_[_0xe27d('0x3e')](_0x5a6c55[_0xe27d('0x2c')]);_0x35cd12[_0xe27d('0x2d')]=_['intersection'](_0x35cd12[_0xe27d('0x2b')],_0x35cd12[_0xe27d('0x2c')]);_0x365f32[_0xe27d('0x2f')]=_[_0xe27d('0x2e')](_0x35cd12[_0xe27d('0x2b')],qs[_0xe27d('0x3f')](_0x5a6c55[_0xe27d('0x2c')][_0xe27d('0x3f')]));_0x365f32[_0xe27d('0x2f')]=_0x365f32[_0xe27d('0x2f')][_0xe27d('0x30')]?_0x365f32['attributes']:_0x35cd12['model'];_0x365f32[_0xe27d('0x32')]=qs[_0xe27d('0x33')](_0x5a6c55['query'][_0xe27d('0x33')]);_0x365f32[_0xe27d('0x34')]=qs[_0xe27d('0x2d')](_['pick'](_0x5a6c55[_0xe27d('0x2c')],_0x35cd12[_0xe27d('0x2d')]));if(_0x5a6c55[_0xe27d('0x2c')][_0xe27d('0x36')]){_0x365f32[_0xe27d('0x34')]=_['merge'](_0x365f32[_0xe27d('0x34')],{'$or':_[_0xe27d('0x25')](_0x365f32[_0xe27d('0x2f')],function(_0x53d6ba){var _0xd56a07={};_0xd56a07[_0x53d6ba]={'$like':'%'+_0x5a6c55['query'][_0xe27d('0x36')]+'%'};return _0xd56a07;})});}_0x365f32=_[_0xe27d('0x37')]({},_0x365f32,_0x5a6c55[_0xe27d('0x46')]);return _0x23688f[_0xe27d('0x48')](_0x365f32);}})[_0xe27d('0x20')](function(_0x3f68e5){if(_0x3f68e5){_0x14ea0c=_0x3f68e5[_0xe27d('0x30')];if(!_0x5a6c55[_0xe27d('0x2c')][_0xe27d('0x49')](_0xe27d('0x31'))){_0x365f32[_0xe27d('0x1b')]=qs[_0xe27d('0x1b')](_0x5a6c55[_0xe27d('0x2c')][_0xe27d('0x1b')]);_0x365f32[_0xe27d('0x19')]=qs[_0xe27d('0x19')](_0x5a6c55[_0xe27d('0x2c')]['offset']);}return _0x23688f[_0xe27d('0x48')](_0x365f32);}})[_0xe27d('0x20')](function(_0x92fde5){if(_0x92fde5){return _0x92fde5?{'count':_0x14ea0c,'rows':_0x92fde5}:null;}})[_0xe27d('0x20')](respondWithResult(_0x479a5a,null))['catch'](handleError(_0x479a5a,null));};exports['getDescriptions']=function(_0x50081f,_0x5a13d8,_0x515113){var _0x57b546={};var _0x10498e={};var _0x4482c7;var _0xc5c91e;return db[_0xe27d('0x26')]['findOne']({'where':{'id':_0x50081f['params']['id']}})[_0xe27d('0x20')](handleEntityNotFound(_0x5a13d8,null))[_0xe27d('0x20')](function(_0x5e48b3){if(_0x5e48b3){_0x4482c7=_0x5e48b3;_0x10498e[_0xe27d('0x2b')]=_[_0xe27d('0x3e')](db[_0xe27d('0x47')][_0xe27d('0x27')]);_0x10498e[_0xe27d('0x2c')]=_[_0xe27d('0x3e')](_0x50081f[_0xe27d('0x2c')]);_0x10498e['filters']=_['intersection'](_0x10498e[_0xe27d('0x2b')],_0x10498e['query']);_0x57b546[_0xe27d('0x2f')]=_[_0xe27d('0x2e')](_0x10498e['model'],qs['fields'](_0x50081f['query'][_0xe27d('0x3f')]));_0x57b546[_0xe27d('0x2f')]=_0x57b546[_0xe27d('0x2f')][_0xe27d('0x30')]?_0x57b546[_0xe27d('0x2f')]:_0x10498e[_0xe27d('0x2b')];_0x57b546[_0xe27d('0x32')]=qs[_0xe27d('0x33')](_0x50081f['query'][_0xe27d('0x33')]);_0x57b546[_0xe27d('0x34')]=qs['filters'](_['pick'](_0x50081f[_0xe27d('0x2c')],_0x10498e['filters']));if(_0x50081f[_0xe27d('0x2c')]['filter']){_0x57b546[_0xe27d('0x34')]=_['merge'](_0x57b546[_0xe27d('0x34')],{'$or':_['map'](_0x57b546[_0xe27d('0x2f')],function(_0x77201e){var _0x15a0c0={};_0x15a0c0[_0x77201e]={'$like':'%'+_0x50081f[_0xe27d('0x2c')][_0xe27d('0x36')]+'%'};return _0x15a0c0;})});}_0x57b546=_[_0xe27d('0x37')]({},_0x57b546,_0x50081f[_0xe27d('0x46')]);return _0x4482c7[_0xe27d('0x4a')](_0x57b546);}})[_0xe27d('0x20')](function(_0x542b02){if(_0x542b02){_0xc5c91e=_0x542b02['length'];if(!_0x50081f[_0xe27d('0x2c')][_0xe27d('0x49')](_0xe27d('0x31'))){_0x57b546['limit']=qs[_0xe27d('0x1b')](_0x50081f[_0xe27d('0x2c')][_0xe27d('0x1b')]);_0x57b546[_0xe27d('0x19')]=qs[_0xe27d('0x19')](_0x50081f['query'][_0xe27d('0x19')]);}return _0x4482c7[_0xe27d('0x4a')](_0x57b546);}})[_0xe27d('0x20')](function(_0x4d82b5){if(_0x4d82b5){return _0x4d82b5?{'count':_0xc5c91e,'rows':_0x4d82b5}:null;}})[_0xe27d('0x20')](respondWithResult(_0x5a13d8,null))['catch'](handleError(_0x5a13d8,null));}; \ No newline at end of file +var _0x86ae=['../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','then','destroy','sendStatus','error','name','send','index','map','ServicenowConfiguration','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','rows','catch','show','params','include','find','create','body','update','getFields','findOne','ServicenowField','order','nolimit','getSubjects','getDescriptions','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x534c30,_0x33ffb9){var _0x5ce099=function(_0x576cbd){while(--_0x576cbd){_0x534c30['push'](_0x534c30['shift']());}};_0x5ce099(++_0x33ffb9);}(_0x86ae,0xd3));var _0xe86a=function(_0x5c5e65,_0x26671e){_0x5c5e65=_0x5c5e65-0x0;var _0x117be3=_0x86ae[_0x5c5e65];return _0x117be3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe86a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe86a('0x1'));var moment=require(_0xe86a('0x2'));var BPromise=require(_0xe86a('0x3'));var Mustache=require(_0xe86a('0x4'));var util=require(_0xe86a('0x5'));var path=require(_0xe86a('0x6'));var sox=require(_0xe86a('0x7'));var csv=require(_0xe86a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe86a('0x9'));var _=require(_0xe86a('0xa'));var squel=require(_0xe86a('0xb'));var crypto=require(_0xe86a('0xc'));var jsforce=require(_0xe86a('0xd'));var deskjs=require(_0xe86a('0xe'));var toCsv=require(_0xe86a('0x8'));var querystring=require(_0xe86a('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe86a('0x10'));var hardwareService=require(_0xe86a('0x11'));var logger=require(_0xe86a('0x12'))('api');var utils=require(_0xe86a('0x13'));var config=require(_0xe86a('0x14'));var licenseUtil=require(_0xe86a('0x15'));var db=require(_0xe86a('0x16'))['db'];function respondWithStatusCode(_0x4a09d5,_0x4b8671){_0x4b8671=_0x4b8671||0xcc;return function(_0x16508f){if(_0x16508f){return _0x4a09d5['sendStatus'](_0x4b8671);}return _0x4a09d5[_0xe86a('0x17')](_0x4b8671)[_0xe86a('0x18')]();};}function respondWithResult(_0x1fc698,_0x4297a4){_0x4297a4=_0x4297a4||0xc8;return function(_0x2e2539){if(_0x2e2539){return _0x1fc698['status'](_0x4297a4)[_0xe86a('0x19')](_0x2e2539);}};}function respondWithFilteredResult(_0x513e9a,_0x2e3ea5){return function(_0x346b4c){if(_0x346b4c){var _0x11f231=typeof _0x2e3ea5[_0xe86a('0x1a')]===_0xe86a('0x1b')&&typeof _0x2e3ea5[_0xe86a('0x1c')]===_0xe86a('0x1b');var _0x3af355=_0x346b4c['count'];var _0x4ffd33=_0x11f231?0x0:_0x2e3ea5[_0xe86a('0x1a')];var _0x4db41a=_0x11f231?_0x346b4c[_0xe86a('0x1d')]:_0x2e3ea5[_0xe86a('0x1a')]+_0x2e3ea5['limit'];var _0x10bbdf;if(_0x4db41a>=_0x3af355){_0x4db41a=_0x3af355;_0x10bbdf=0xc8;}else{_0x10bbdf=0xce;}_0x513e9a['status'](_0x10bbdf);return _0x513e9a['set'](_0xe86a('0x1e'),_0x4ffd33+'-'+_0x4db41a+'/'+_0x3af355)[_0xe86a('0x19')](_0x346b4c);}return null;};}function patchUpdates(_0x1d1caa){return function(_0x595fda){try{jsonpatch['apply'](_0x595fda,_0x1d1caa,!![]);}catch(_0x50927a){return BPromise[_0xe86a('0x1f')](_0x50927a);}return _0x595fda[_0xe86a('0x20')]();};}function saveUpdates(_0x4e5c34,_0x2f623c){return function(_0x4dcfe0){if(_0x4dcfe0){return _0x4dcfe0['update'](_0x4e5c34)[_0xe86a('0x21')](function(_0x346db2){return _0x346db2;});}return null;};}function removeEntity(_0x3b4fba,_0x437051){return function(_0x26017d){if(_0x26017d){return _0x26017d[_0xe86a('0x22')]()['then'](function(){_0x3b4fba[_0xe86a('0x17')](0xcc)[_0xe86a('0x18')]();});}};}function handleEntityNotFound(_0x24ad9b,_0x22a005){return function(_0x286251){if(!_0x286251){_0x24ad9b[_0xe86a('0x23')](0x194);}return _0x286251;};}function handleError(_0x424832,_0x42f677){_0x42f677=_0x42f677||0x1f4;return function(_0x348b0f){logger[_0xe86a('0x24')](_0x348b0f['stack']);if(_0x348b0f[_0xe86a('0x25')]){delete _0x348b0f[_0xe86a('0x25')];}_0x424832[_0xe86a('0x17')](_0x42f677)[_0xe86a('0x26')](_0x348b0f);};}exports[_0xe86a('0x27')]=function(_0x4c8933,_0x27b0cb){var _0x4fb496={},_0x5d56ef={},_0x51a7b4={'count':0x0,'rows':[]};var _0x4a7abe=_[_0xe86a('0x28')](db[_0xe86a('0x29')][_0xe86a('0x2a')],function(_0x46b407){return{'name':_0x46b407['fieldName'],'type':_0x46b407[_0xe86a('0x2b')]['key']};});_0x5d56ef[_0xe86a('0x2c')]=_[_0xe86a('0x28')](_0x4a7abe,_0xe86a('0x25'));_0x5d56ef[_0xe86a('0x2d')]=_[_0xe86a('0x2e')](_0x4c8933[_0xe86a('0x2d')]);_0x5d56ef[_0xe86a('0x2f')]=_[_0xe86a('0x30')](_0x5d56ef['model'],_0x5d56ef[_0xe86a('0x2d')]);_0x4fb496['attributes']=_[_0xe86a('0x30')](_0x5d56ef[_0xe86a('0x2c')],qs[_0xe86a('0x31')](_0x4c8933[_0xe86a('0x2d')]['fields']));_0x4fb496[_0xe86a('0x32')]=_0x4fb496['attributes'][_0xe86a('0x33')]?_0x4fb496[_0xe86a('0x32')]:_0x5d56ef['model'];if(!_0x4c8933['query'][_0xe86a('0x34')]('nolimit')){_0x4fb496[_0xe86a('0x1c')]=qs[_0xe86a('0x1c')](_0x4c8933[_0xe86a('0x2d')][_0xe86a('0x1c')]);_0x4fb496[_0xe86a('0x1a')]=qs[_0xe86a('0x1a')](_0x4c8933[_0xe86a('0x2d')][_0xe86a('0x1a')]);}_0x4fb496['order']=qs[_0xe86a('0x35')](_0x4c8933['query'][_0xe86a('0x35')]);_0x4fb496[_0xe86a('0x36')]=qs['filters'](_[_0xe86a('0x37')](_0x4c8933['query'],_0x5d56ef[_0xe86a('0x2f')]),_0x4a7abe);if(_0x4c8933[_0xe86a('0x2d')][_0xe86a('0x38')]){_0x4fb496[_0xe86a('0x36')]=_['merge'](_0x4fb496['where'],{'$or':_[_0xe86a('0x28')](_0x4a7abe,function(_0x4a3b2b){if(_0x4a3b2b[_0xe86a('0x2b')]!==_0xe86a('0x39')){var _0x1921de={};_0x1921de[_0x4a3b2b[_0xe86a('0x25')]]={'$like':'%'+_0x4c8933['query'][_0xe86a('0x38')]+'%'};return _0x1921de;}})});}_0x4fb496=_[_0xe86a('0x3a')]({},_0x4fb496,_0x4c8933[_0xe86a('0x3b')]);var _0x29920d={'where':_0x4fb496[_0xe86a('0x36')]};return db[_0xe86a('0x29')][_0xe86a('0x1d')](_0x29920d)[_0xe86a('0x21')](function(_0x123d2e){_0x51a7b4[_0xe86a('0x1d')]=_0x123d2e;if(_0x4c8933[_0xe86a('0x2d')][_0xe86a('0x3c')]){_0x4fb496['include']=[{'all':!![]}];}return db['ServicenowConfiguration']['findAll'](_0x4fb496);})[_0xe86a('0x21')](function(_0x1be534){_0x51a7b4[_0xe86a('0x3d')]=_0x1be534;return _0x51a7b4;})[_0xe86a('0x21')](respondWithFilteredResult(_0x27b0cb,_0x4fb496))[_0xe86a('0x3e')](handleError(_0x27b0cb,null));};exports[_0xe86a('0x3f')]=function(_0xf231e3,_0x2b8d21){var _0x140d76={'raw':![],'where':{'id':_0xf231e3[_0xe86a('0x40')]['id']}},_0x17f2cd={};_0x17f2cd[_0xe86a('0x2c')]=_[_0xe86a('0x2e')](db['ServicenowConfiguration'][_0xe86a('0x2a')]);_0x17f2cd[_0xe86a('0x2d')]=_['keys'](_0xf231e3[_0xe86a('0x2d')]);_0x17f2cd['filters']=_[_0xe86a('0x30')](_0x17f2cd[_0xe86a('0x2c')],_0x17f2cd['query']);_0x140d76['attributes']=_[_0xe86a('0x30')](_0x17f2cd[_0xe86a('0x2c')],qs[_0xe86a('0x31')](_0xf231e3['query']['fields']));_0x140d76[_0xe86a('0x32')]=_0x140d76[_0xe86a('0x32')][_0xe86a('0x33')]?_0x140d76[_0xe86a('0x32')]:_0x17f2cd[_0xe86a('0x2c')];if(_0xf231e3[_0xe86a('0x2d')][_0xe86a('0x3c')]){_0x140d76[_0xe86a('0x41')]=[{'all':!![]}];}_0x140d76=_[_0xe86a('0x3a')]({},_0x140d76,_0xf231e3[_0xe86a('0x3b')]);return db['ServicenowConfiguration'][_0xe86a('0x42')](_0x140d76)['then'](handleEntityNotFound(_0x2b8d21,null))[_0xe86a('0x21')](respondWithResult(_0x2b8d21,null))[_0xe86a('0x3e')](handleError(_0x2b8d21,null));};exports['create']=function(_0x53b3c4,_0x5a7cbb){return db[_0xe86a('0x29')][_0xe86a('0x43')](_0x53b3c4[_0xe86a('0x44')],{})[_0xe86a('0x21')](respondWithResult(_0x5a7cbb,0xc9))[_0xe86a('0x3e')](handleError(_0x5a7cbb,null));};exports[_0xe86a('0x45')]=function(_0x27fb55,_0x2fab7b){if(_0x27fb55[_0xe86a('0x44')]['id']){delete _0x27fb55['body']['id'];}return db[_0xe86a('0x29')]['find']({'where':{'id':_0x27fb55[_0xe86a('0x40')]['id']}})[_0xe86a('0x21')](handleEntityNotFound(_0x2fab7b,null))[_0xe86a('0x21')](saveUpdates(_0x27fb55[_0xe86a('0x44')],null))[_0xe86a('0x21')](respondWithResult(_0x2fab7b,null))[_0xe86a('0x3e')](handleError(_0x2fab7b,null));};exports[_0xe86a('0x22')]=function(_0x132606,_0x382b3f){return db[_0xe86a('0x29')][_0xe86a('0x42')]({'where':{'id':_0x132606[_0xe86a('0x40')]['id']}})[_0xe86a('0x21')](handleEntityNotFound(_0x382b3f,null))[_0xe86a('0x21')](removeEntity(_0x382b3f,null))[_0xe86a('0x3e')](handleError(_0x382b3f,null));};exports[_0xe86a('0x46')]=function(_0x1396b0,_0x2ceffe,_0x102c42){var _0x5c1bb1={};var _0x2e5047={};var _0x4a39ed;var _0x23f3ed;return db[_0xe86a('0x29')][_0xe86a('0x47')]({'where':{'id':_0x1396b0['params']['id']}})[_0xe86a('0x21')](handleEntityNotFound(_0x2ceffe,null))[_0xe86a('0x21')](function(_0xdba06){if(_0xdba06){_0x4a39ed=_0xdba06;_0x2e5047[_0xe86a('0x2c')]=_['keys'](db[_0xe86a('0x48')][_0xe86a('0x2a')]);_0x2e5047[_0xe86a('0x2d')]=_[_0xe86a('0x2e')](_0x1396b0['query']);_0x2e5047['filters']=_['intersection'](_0x2e5047[_0xe86a('0x2c')],_0x2e5047[_0xe86a('0x2d')]);_0x5c1bb1['attributes']=_[_0xe86a('0x30')](_0x2e5047[_0xe86a('0x2c')],qs['fields'](_0x1396b0[_0xe86a('0x2d')][_0xe86a('0x31')]));_0x5c1bb1['attributes']=_0x5c1bb1[_0xe86a('0x32')][_0xe86a('0x33')]?_0x5c1bb1[_0xe86a('0x32')]:_0x2e5047[_0xe86a('0x2c')];_0x5c1bb1[_0xe86a('0x49')]=qs[_0xe86a('0x35')](_0x1396b0[_0xe86a('0x2d')]['sort']);_0x5c1bb1[_0xe86a('0x36')]=qs[_0xe86a('0x2f')](_[_0xe86a('0x37')](_0x1396b0[_0xe86a('0x2d')],_0x2e5047['filters']));if(_0x1396b0[_0xe86a('0x2d')][_0xe86a('0x38')]){_0x5c1bb1['where']=_[_0xe86a('0x3a')](_0x5c1bb1[_0xe86a('0x36')],{'$or':_[_0xe86a('0x28')](_0x5c1bb1[_0xe86a('0x32')],function(_0x1ddc18){var _0x124dc7={};_0x124dc7[_0x1ddc18]={'$like':'%'+_0x1396b0[_0xe86a('0x2d')][_0xe86a('0x38')]+'%'};return _0x124dc7;})});}_0x5c1bb1=_[_0xe86a('0x3a')]({},_0x5c1bb1,_0x1396b0[_0xe86a('0x3b')]);return _0x4a39ed[_0xe86a('0x46')](_0x5c1bb1);}})[_0xe86a('0x21')](function(_0x3f40e4){if(_0x3f40e4){_0x23f3ed=_0x3f40e4[_0xe86a('0x33')];if(!_0x1396b0[_0xe86a('0x2d')]['hasOwnProperty'](_0xe86a('0x4a'))){_0x5c1bb1[_0xe86a('0x1c')]=qs['limit'](_0x1396b0[_0xe86a('0x2d')]['limit']);_0x5c1bb1['offset']=qs[_0xe86a('0x1a')](_0x1396b0[_0xe86a('0x2d')][_0xe86a('0x1a')]);}return _0x4a39ed['getFields'](_0x5c1bb1);}})['then'](function(_0x8249e2){if(_0x8249e2){return _0x8249e2?{'count':_0x23f3ed,'rows':_0x8249e2}:null;}})['then'](respondWithResult(_0x2ceffe,null))['catch'](handleError(_0x2ceffe,null));};exports[_0xe86a('0x4b')]=function(_0x31c32f,_0x311422,_0x3cd538){var _0x3a186c={};var _0x8a5d13={};var _0x107343;var _0x472fbd;return db[_0xe86a('0x29')][_0xe86a('0x47')]({'where':{'id':_0x31c32f[_0xe86a('0x40')]['id']}})[_0xe86a('0x21')](handleEntityNotFound(_0x311422,null))[_0xe86a('0x21')](function(_0x496f77){if(_0x496f77){_0x107343=_0x496f77;_0x8a5d13['model']=_[_0xe86a('0x2e')](db[_0xe86a('0x48')][_0xe86a('0x2a')]);_0x8a5d13[_0xe86a('0x2d')]=_[_0xe86a('0x2e')](_0x31c32f['query']);_0x8a5d13[_0xe86a('0x2f')]=_[_0xe86a('0x30')](_0x8a5d13[_0xe86a('0x2c')],_0x8a5d13[_0xe86a('0x2d')]);_0x3a186c['attributes']=_['intersection'](_0x8a5d13[_0xe86a('0x2c')],qs[_0xe86a('0x31')](_0x31c32f[_0xe86a('0x2d')][_0xe86a('0x31')]));_0x3a186c[_0xe86a('0x32')]=_0x3a186c[_0xe86a('0x32')]['length']?_0x3a186c['attributes']:_0x8a5d13['model'];_0x3a186c[_0xe86a('0x49')]=qs[_0xe86a('0x35')](_0x31c32f[_0xe86a('0x2d')][_0xe86a('0x35')]);_0x3a186c[_0xe86a('0x36')]=qs[_0xe86a('0x2f')](_[_0xe86a('0x37')](_0x31c32f[_0xe86a('0x2d')],_0x8a5d13['filters']));if(_0x31c32f[_0xe86a('0x2d')][_0xe86a('0x38')]){_0x3a186c[_0xe86a('0x36')]=_['merge'](_0x3a186c[_0xe86a('0x36')],{'$or':_[_0xe86a('0x28')](_0x3a186c['attributes'],function(_0x19beac){var _0x250214={};_0x250214[_0x19beac]={'$like':'%'+_0x31c32f[_0xe86a('0x2d')][_0xe86a('0x38')]+'%'};return _0x250214;})});}_0x3a186c=_[_0xe86a('0x3a')]({},_0x3a186c,_0x31c32f['options']);return _0x107343[_0xe86a('0x4b')](_0x3a186c);}})[_0xe86a('0x21')](function(_0x58bcb1){if(_0x58bcb1){_0x472fbd=_0x58bcb1[_0xe86a('0x33')];if(!_0x31c32f[_0xe86a('0x2d')][_0xe86a('0x34')](_0xe86a('0x4a'))){_0x3a186c[_0xe86a('0x1c')]=qs[_0xe86a('0x1c')](_0x31c32f[_0xe86a('0x2d')][_0xe86a('0x1c')]);_0x3a186c[_0xe86a('0x1a')]=qs[_0xe86a('0x1a')](_0x31c32f[_0xe86a('0x2d')][_0xe86a('0x1a')]);}return _0x107343['getSubjects'](_0x3a186c);}})[_0xe86a('0x21')](function(_0x1b0075){if(_0x1b0075){return _0x1b0075?{'count':_0x472fbd,'rows':_0x1b0075}:null;}})[_0xe86a('0x21')](respondWithResult(_0x311422,null))[_0xe86a('0x3e')](handleError(_0x311422,null));};exports['getDescriptions']=function(_0x115b56,_0x2e623b,_0xf2bad1){var _0x5e9c56={};var _0x2b8379={};var _0x7f9c0c;var _0x8f1347;return db[_0xe86a('0x29')][_0xe86a('0x47')]({'where':{'id':_0x115b56[_0xe86a('0x40')]['id']}})[_0xe86a('0x21')](handleEntityNotFound(_0x2e623b,null))[_0xe86a('0x21')](function(_0x337015){if(_0x337015){_0x7f9c0c=_0x337015;_0x2b8379[_0xe86a('0x2c')]=_['keys'](db[_0xe86a('0x48')][_0xe86a('0x2a')]);_0x2b8379[_0xe86a('0x2d')]=_[_0xe86a('0x2e')](_0x115b56[_0xe86a('0x2d')]);_0x2b8379[_0xe86a('0x2f')]=_[_0xe86a('0x30')](_0x2b8379['model'],_0x2b8379[_0xe86a('0x2d')]);_0x5e9c56[_0xe86a('0x32')]=_[_0xe86a('0x30')](_0x2b8379[_0xe86a('0x2c')],qs[_0xe86a('0x31')](_0x115b56[_0xe86a('0x2d')][_0xe86a('0x31')]));_0x5e9c56[_0xe86a('0x32')]=_0x5e9c56['attributes']['length']?_0x5e9c56['attributes']:_0x2b8379[_0xe86a('0x2c')];_0x5e9c56[_0xe86a('0x49')]=qs[_0xe86a('0x35')](_0x115b56[_0xe86a('0x2d')][_0xe86a('0x35')]);_0x5e9c56[_0xe86a('0x36')]=qs['filters'](_[_0xe86a('0x37')](_0x115b56['query'],_0x2b8379['filters']));if(_0x115b56[_0xe86a('0x2d')][_0xe86a('0x38')]){_0x5e9c56[_0xe86a('0x36')]=_[_0xe86a('0x3a')](_0x5e9c56['where'],{'$or':_['map'](_0x5e9c56[_0xe86a('0x32')],function(_0x549745){var _0x46fe6d={};_0x46fe6d[_0x549745]={'$like':'%'+_0x115b56[_0xe86a('0x2d')]['filter']+'%'};return _0x46fe6d;})});}_0x5e9c56=_['merge']({},_0x5e9c56,_0x115b56['options']);return _0x7f9c0c[_0xe86a('0x4c')](_0x5e9c56);}})[_0xe86a('0x21')](function(_0x18a15b){if(_0x18a15b){_0x8f1347=_0x18a15b[_0xe86a('0x33')];if(!_0x115b56['query'][_0xe86a('0x34')](_0xe86a('0x4a'))){_0x5e9c56[_0xe86a('0x1c')]=qs[_0xe86a('0x1c')](_0x115b56['query']['limit']);_0x5e9c56[_0xe86a('0x1a')]=qs['offset'](_0x115b56[_0xe86a('0x2d')][_0xe86a('0x1a')]);}return _0x7f9c0c['getDescriptions'](_0x5e9c56);}})[_0xe86a('0x21')](function(_0x4bf930){if(_0x4bf930){return _0x4bf930?{'count':_0x8f1347,'rows':_0x4bf930}:null;}})[_0xe86a('0x21')](respondWithResult(_0x2e623b,null))['catch'](handleError(_0x2e623b,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index ada0b6d..9248435 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 _0xa988=['path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x25af6c,_0x13ba84){var _0x2bf300=function(_0x1c8294){while(--_0x1c8294){_0x25af6c['push'](_0x25af6c['shift']());}};_0x2bf300(++_0x13ba84);}(_0xa988,0x1a7));var _0x8a98=function(_0x31934e,_0x34d021){_0x31934e=_0x31934e-0x0;var _0x171a1c=_0xa988[_0x31934e];return _0x171a1c;};'use strict';var _=require(_0x8a98('0x0'));var util=require(_0x8a98('0x1'));var logger=require(_0x8a98('0x2'))(_0x8a98('0x3'));var moment=require(_0x8a98('0x4'));var BPromise=require('bluebird');var rp=require(_0x8a98('0x5'));var fs=require('fs');var path=require(_0x8a98('0x6'));var rimraf=require(_0x8a98('0x7'));var config=require(_0x8a98('0x8'));var attributes=require(_0x8a98('0x9'));module[_0x8a98('0xa')]=function(_0x3eb5cf,_0x3fcd06){return _0x3eb5cf['define'](_0x8a98('0xb'),attributes,{'tableName':_0x8a98('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x72d7=['define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','api','moment','bluebird','path','./intServicenowConfiguration.attributes','exports'];(function(_0x502478,_0x4fd6fd){var _0x36e5cb=function(_0x17dbb6){while(--_0x17dbb6){_0x502478['push'](_0x502478['shift']());}};_0x36e5cb(++_0x4fd6fd);}(_0x72d7,0x19b));var _0x772d=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x72d7[_0xefd519];return _0x4bb882;};'use strict';var _=require(_0x772d('0x0'));var util=require(_0x772d('0x1'));var logger=require(_0x772d('0x2'))(_0x772d('0x3'));var moment=require(_0x772d('0x4'));var BPromise=require(_0x772d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x772d('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x772d('0x7'));module[_0x772d('0x8')]=function(_0x2b014d,_0x527450){return _0x2b014d[_0x772d('0x9')](_0x772d('0xa'),attributes,{'tableName':_0x772d('0xb'),'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 2f43ef3..cc8afce 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 _0x0a08=['info','ServicenowConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x13a7b0,_0x587c97){var _0x1790a1=function(_0x20afae){while(--_0x20afae){_0x13a7b0['push'](_0x13a7b0['shift']());}};_0x1790a1(++_0x587c97);}(_0x0a08,0x153));var _0x80a0=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0x0a08[_0x3635ce];return _0x97ecd0;};'use strict';var _=require(_0x80a0('0x0'));var util=require(_0x80a0('0x1'));var moment=require(_0x80a0('0x2'));var BPromise=require(_0x80a0('0x3'));var rs=require(_0x80a0('0x4'));var fs=require('fs');var Redis=require(_0x80a0('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x80a0('0x6'));var logger=require('../../config/logger')(_0x80a0('0x7'));var config=require(_0x80a0('0x8'));var jayson=require(_0x80a0('0x9'));var client=jayson[_0x80a0('0xa')][_0x80a0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x216c4e,_0x4f0894,_0x39f40b){return new BPromise(function(_0x108f57,_0x42afec){return client['request'](_0x216c4e,_0x39f40b)[_0x80a0('0xc')](function(_0x15d7e1){logger[_0x80a0('0xd')](_0x80a0('0xe'),_0x4f0894,'request\x20sent');logger[_0x80a0('0xf')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x4f0894,_0x80a0('0x10'),JSON[_0x80a0('0x11')](_0x15d7e1));if(_0x15d7e1[_0x80a0('0x12')]){if(_0x15d7e1[_0x80a0('0x12')]['code']===0x1f4){logger[_0x80a0('0x12')](_0x80a0('0xe'),_0x4f0894,_0x15d7e1[_0x80a0('0x12')][_0x80a0('0x13')]);return _0x42afec(_0x15d7e1[_0x80a0('0x12')][_0x80a0('0x13')]);}logger['error'](_0x80a0('0xe'),_0x4f0894,_0x15d7e1[_0x80a0('0x12')]['message']);return _0x108f57(_0x15d7e1[_0x80a0('0x12')]['message']);}else{logger[_0x80a0('0xd')](_0x80a0('0xe'),_0x4f0894,_0x80a0('0x10'));_0x108f57(_0x15d7e1[_0x80a0('0x14')][_0x80a0('0x13')]);}})[_0x80a0('0x15')](function(_0x252762){logger[_0x80a0('0x12')](_0x80a0('0xe'),_0x4f0894,_0x252762);_0x42afec(_0x252762);});});} \ No newline at end of file +var _0x314f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x91f90e,_0x572696){var _0x54cfd6=function(_0x558f75){while(--_0x558f75){_0x91f90e['push'](_0x91f90e['shift']());}};_0x54cfd6(++_0x572696);}(_0x314f,0x114));var _0xf314=function(_0x517a82,_0x2c4dde){_0x517a82=_0x517a82-0x0;var _0x8fd0d2=_0x314f[_0x517a82];return _0x8fd0d2;};'use strict';var _=require(_0xf314('0x0'));var util=require(_0xf314('0x1'));var moment=require(_0xf314('0x2'));var BPromise=require(_0xf314('0x3'));var rs=require(_0xf314('0x4'));var fs=require('fs');var Redis=require(_0xf314('0x5'));var db=require(_0xf314('0x6'))['db'];var utils=require(_0xf314('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf314('0x8'));var jayson=require(_0xf314('0x9'));var client=jayson[_0xf314('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x387095,_0x5b0cea,_0x5621e7){return new BPromise(function(_0xbea7c3,_0x29a46a){return client[_0xf314('0xb')](_0x387095,_0x5621e7)[_0xf314('0xc')](function(_0x23269b){logger[_0xf314('0xd')](_0xf314('0xe'),_0x5b0cea,'request\x20sent');logger[_0xf314('0xf')](_0xf314('0x10'),_0x5b0cea,_0xf314('0x11'),JSON[_0xf314('0x12')](_0x23269b));if(_0x23269b[_0xf314('0x13')]){if(_0x23269b[_0xf314('0x13')][_0xf314('0x14')]===0x1f4){logger[_0xf314('0x13')](_0xf314('0xe'),_0x5b0cea,_0x23269b[_0xf314('0x13')]['message']);return _0x29a46a(_0x23269b[_0xf314('0x13')]['message']);}logger[_0xf314('0x13')](_0xf314('0xe'),_0x5b0cea,_0x23269b['error'][_0xf314('0x15')]);return _0xbea7c3(_0x23269b[_0xf314('0x13')]['message']);}else{logger[_0xf314('0xd')](_0xf314('0xe'),_0x5b0cea,'request\x20sent');_0xbea7c3(_0x23269b[_0xf314('0x16')][_0xf314('0x15')]);}})['catch'](function(_0x568c8b){logger[_0xf314('0x13')]('ServicenowConfiguration,\x20%s,\x20%s',_0x5b0cea,_0x568c8b);_0x29a46a(_0x568c8b);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 6c73db6..0766f67 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 _0x0ef1=['get','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intServicenowField.controller'];(function(_0x53084c,_0x4a10a7){var _0x3725c5=function(_0x2d650c){while(--_0x2d650c){_0x53084c['push'](_0x53084c['shift']());}};_0x3725c5(++_0x4a10a7);}(_0x0ef1,0x1ad));var _0x10ef=function(_0xe2e224,_0x546ace){_0xe2e224=_0xe2e224-0x0;var _0x5734b8=_0x0ef1[_0xe2e224];return _0x5734b8;};'use strict';var multer=require(_0x10ef('0x0'));var util=require('util');var path=require(_0x10ef('0x1'));var timeout=require(_0x10ef('0x2'));var express=require(_0x10ef('0x3'));var router=express['Router']();var fs_extra=require(_0x10ef('0x4'));var auth=require(_0x10ef('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x10ef('0x6'));var controller=require(_0x10ef('0x7'));router[_0x10ef('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0x10ef('0x9')](),controller[_0x10ef('0xa')]);router[_0x10ef('0xb')]('/',auth[_0x10ef('0x9')](),controller[_0x10ef('0xc')]);router[_0x10ef('0xd')](_0x10ef('0xe'),auth['isAuthenticated'](),controller[_0x10ef('0xf')]);router[_0x10ef('0x10')](_0x10ef('0xe'),auth[_0x10ef('0x9')](),controller[_0x10ef('0x11')]);module[_0x10ef('0x12')]=router; \ No newline at end of file +var _0xe4f8=['./intServicenowField.controller','get','isAuthenticated','post','create','/:id','update','delete','destroy','exports','util','path','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x2dca17,_0x1186ca){var _0x314bb1=function(_0x49f3b6){while(--_0x49f3b6){_0x2dca17['push'](_0x2dca17['shift']());}};_0x314bb1(++_0x1186ca);}(_0xe4f8,0x11a));var _0x8e4f=function(_0x2e4cbf,_0x8763d3){_0x2e4cbf=_0x2e4cbf-0x0;var _0x52840f=_0xe4f8[_0x2e4cbf];return _0x52840f;};'use strict';var multer=require('multer');var util=require(_0x8e4f('0x0'));var path=require(_0x8e4f('0x1'));var timeout=require('connect-timeout');var express=require(_0x8e4f('0x2'));var router=express[_0x8e4f('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8e4f('0x4'));var config=require(_0x8e4f('0x5'));var controller=require(_0x8e4f('0x6'));router[_0x8e4f('0x7')]('/',auth[_0x8e4f('0x8')](),controller['index']);router[_0x8e4f('0x7')]('/:id',auth[_0x8e4f('0x8')](),controller['show']);router[_0x8e4f('0x9')]('/',auth['isAuthenticated'](),controller[_0x8e4f('0xa')]);router['put'](_0x8e4f('0xb'),auth[_0x8e4f('0x8')](),controller[_0x8e4f('0xc')]);router[_0x8e4f('0xd')](_0x8e4f('0xb'),auth['isAuthenticated'](),controller[_0x8e4f('0xe')]);module[_0x8e4f('0xf')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 93ec191..14b3520 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 _0x0431=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x3b04ab,_0x2e0e2){var _0x494c5e=function(_0x1f5822){while(--_0x1f5822){_0x3b04ab['push'](_0x3b04ab['shift']());}};_0x494c5e(++_0x2e0e2);}(_0x0431,0x168));var _0x1043=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x0431[_0xa1e3e3];return _0xc980e9;};'use strict';var Sequelize=require(_0x1043('0x0'));module[_0x1043('0x1')]={'type':{'type':Sequelize[_0x1043('0x2')](_0x1043('0x3'),_0x1043('0x4'),_0x1043('0x5'),_0x1043('0x6'),_0x1043('0x7')),'defaultValue':_0x1043('0x3')},'content':{'type':Sequelize[_0x1043('0x8')]},'key':{'type':Sequelize[_0x1043('0x8')]},'keyType':{'type':Sequelize[_0x1043('0x2')](_0x1043('0x3'),_0x1043('0x4'),_0x1043('0x5'))},'keyContent':{'type':Sequelize[_0x1043('0x8')]},'idField':{'type':Sequelize[_0x1043('0x8')]},'nameField':{'type':Sequelize[_0x1043('0x8')]},'customField':{'type':Sequelize[_0x1043('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1043('0x8')]}}; \ No newline at end of file +var _0xcdbd=['customVariable','keyValue','picklist','string','STRING','ENUM','BOOLEAN','exports','variable'];(function(_0x4c319e,_0x29258a){var _0x597c41=function(_0x2b5178){while(--_0x2b5178){_0x4c319e['push'](_0x4c319e['shift']());}};_0x597c41(++_0x29258a);}(_0xcdbd,0x8e));var _0xdcdb=function(_0x5f374f,_0x4fbdd2){_0x5f374f=_0x5f374f-0x0;var _0x35f1c1=_0xcdbd[_0x5f374f];return _0x35f1c1;};'use strict';var Sequelize=require('sequelize');module[_0xdcdb('0x0')]={'type':{'type':Sequelize['ENUM']('string',_0xdcdb('0x1'),_0xdcdb('0x2'),_0xdcdb('0x3'),_0xdcdb('0x4')),'defaultValue':_0xdcdb('0x5')},'content':{'type':Sequelize[_0xdcdb('0x6')]},'key':{'type':Sequelize[_0xdcdb('0x6')]},'keyType':{'type':Sequelize[_0xdcdb('0x7')](_0xdcdb('0x5'),_0xdcdb('0x1'),_0xdcdb('0x2'))},'keyContent':{'type':Sequelize[_0xdcdb('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xdcdb('0x6')]},'customField':{'type':Sequelize[_0xdcdb('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdcdb('0x6')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 91acc32..9be9243 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 _0x1515=['lodash','squel','jsforce','desk.js','to-csv','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','then','error','stack','name','send','index','ServicenowField','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','update','body','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra'];(function(_0x3cd898,_0x444cfa){var _0x2e79f5=function(_0x51774a){while(--_0x51774a){_0x3cd898['push'](_0x3cd898['shift']());}};_0x2e79f5(++_0x444cfa);}(_0x1515,0x8a));var _0x5151=function(_0x595c57,_0x506643){_0x595c57=_0x595c57-0x0;var _0x10186f=_0x1515[_0x595c57];return _0x10186f;};'use strict';var emlformat=require(_0x5151('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5151('0x1'));var jsonpatch=require(_0x5151('0x2'));var rp=require(_0x5151('0x3'));var moment=require(_0x5151('0x4'));var BPromise=require(_0x5151('0x5'));var Mustache=require(_0x5151('0x6'));var util=require(_0x5151('0x7'));var path=require(_0x5151('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5151('0x9'));var _=require(_0x5151('0xa'));var squel=require(_0x5151('0xb'));var crypto=require('crypto');var jsforce=require(_0x5151('0xc'));var deskjs=require(_0x5151('0xd'));var toCsv=require(_0x5151('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5151('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5151('0x10'));var logger=require(_0x5151('0x11'))(_0x5151('0x12'));var utils=require(_0x5151('0x13'));var config=require(_0x5151('0x14'));var licenseUtil=require(_0x5151('0x15'));var db=require(_0x5151('0x16'))['db'];function respondWithStatusCode(_0x3acaaf,_0x50411b){_0x50411b=_0x50411b||0xcc;return function(_0x679967){if(_0x679967){return _0x3acaaf[_0x5151('0x17')](_0x50411b);}return _0x3acaaf[_0x5151('0x18')](_0x50411b)[_0x5151('0x19')]();};}function respondWithResult(_0x4b1bf9,_0x4f6383){_0x4f6383=_0x4f6383||0xc8;return function(_0x4b5d0e){if(_0x4b5d0e){return _0x4b1bf9[_0x5151('0x18')](_0x4f6383)[_0x5151('0x1a')](_0x4b5d0e);}};}function respondWithFilteredResult(_0x42797c,_0x35a9c0){return function(_0x310e5){if(_0x310e5){var _0x2706d0=typeof _0x35a9c0[_0x5151('0x1b')]===_0x5151('0x1c')&&typeof _0x35a9c0[_0x5151('0x1d')]===_0x5151('0x1c');var _0x373aae=_0x310e5[_0x5151('0x1e')];var _0x1adbe2=_0x2706d0?0x0:_0x35a9c0[_0x5151('0x1b')];var _0x30464f=_0x2706d0?_0x310e5[_0x5151('0x1e')]:_0x35a9c0[_0x5151('0x1b')]+_0x35a9c0[_0x5151('0x1d')];var _0xf19d7d;if(_0x30464f>=_0x373aae){_0x30464f=_0x373aae;_0xf19d7d=0xc8;}else{_0xf19d7d=0xce;}_0x42797c['status'](_0xf19d7d);return _0x42797c[_0x5151('0x1f')](_0x5151('0x20'),_0x1adbe2+'-'+_0x30464f+'/'+_0x373aae)['json'](_0x310e5);}return null;};}function patchUpdates(_0x339971){return function(_0x2b10b3){try{jsonpatch['apply'](_0x2b10b3,_0x339971,!![]);}catch(_0x3c6886){return BPromise[_0x5151('0x21')](_0x3c6886);}return _0x2b10b3['save']();};}function saveUpdates(_0xcf243,_0x1b336f){return function(_0x59552d){if(_0x59552d){return _0x59552d['update'](_0xcf243)[_0x5151('0x22')](function(_0x4dc5da){return _0x4dc5da;});}return null;};}function removeEntity(_0x3e41a6,_0x268e8b){return function(_0x4cf622){if(_0x4cf622){return _0x4cf622['destroy']()[_0x5151('0x22')](function(){_0x3e41a6[_0x5151('0x18')](0xcc)[_0x5151('0x19')]();});}};}function handleEntityNotFound(_0x45b0b3,_0x286fd6){return function(_0x2886a2){if(!_0x2886a2){_0x45b0b3['sendStatus'](0x194);}return _0x2886a2;};}function handleError(_0x2f668f,_0x489166){_0x489166=_0x489166||0x1f4;return function(_0x2bc64a){logger[_0x5151('0x23')](_0x2bc64a[_0x5151('0x24')]);if(_0x2bc64a['name']){delete _0x2bc64a[_0x5151('0x25')];}_0x2f668f[_0x5151('0x18')](_0x489166)[_0x5151('0x26')](_0x2bc64a);};}exports[_0x5151('0x27')]=function(_0x10d6d6,_0x19c06d){var _0x11c580={},_0x5718ab={},_0x495efb={'count':0x0,'rows':[]};var _0x89f3e3=_['map'](db[_0x5151('0x28')][_0x5151('0x29')],function(_0x42e1fe){return{'name':_0x42e1fe[_0x5151('0x2a')],'type':_0x42e1fe[_0x5151('0x2b')][_0x5151('0x2c')]};});_0x5718ab[_0x5151('0x2d')]=_[_0x5151('0x2e')](_0x89f3e3,'name');_0x5718ab[_0x5151('0x2f')]=_[_0x5151('0x30')](_0x10d6d6[_0x5151('0x2f')]);_0x5718ab[_0x5151('0x31')]=_[_0x5151('0x32')](_0x5718ab[_0x5151('0x2d')],_0x5718ab['query']);_0x11c580[_0x5151('0x33')]=_[_0x5151('0x32')](_0x5718ab[_0x5151('0x2d')],qs[_0x5151('0x34')](_0x10d6d6['query'][_0x5151('0x34')]));_0x11c580[_0x5151('0x33')]=_0x11c580[_0x5151('0x33')][_0x5151('0x35')]?_0x11c580[_0x5151('0x33')]:_0x5718ab[_0x5151('0x2d')];if(!_0x10d6d6['query'][_0x5151('0x36')](_0x5151('0x37'))){_0x11c580[_0x5151('0x1d')]=qs[_0x5151('0x1d')](_0x10d6d6[_0x5151('0x2f')][_0x5151('0x1d')]);_0x11c580[_0x5151('0x1b')]=qs['offset'](_0x10d6d6[_0x5151('0x2f')][_0x5151('0x1b')]);}_0x11c580[_0x5151('0x38')]=qs[_0x5151('0x39')](_0x10d6d6[_0x5151('0x2f')]['sort']);_0x11c580[_0x5151('0x3a')]=qs[_0x5151('0x31')](_['pick'](_0x10d6d6[_0x5151('0x2f')],_0x5718ab['filters']),_0x89f3e3);if(_0x10d6d6[_0x5151('0x2f')][_0x5151('0x3b')]){_0x11c580[_0x5151('0x3a')]=_[_0x5151('0x3c')](_0x11c580[_0x5151('0x3a')],{'$or':_[_0x5151('0x2e')](_0x89f3e3,function(_0x37fc93){if(_0x37fc93[_0x5151('0x2b')]!==_0x5151('0x3d')){var _0x529b53={};_0x529b53[_0x37fc93[_0x5151('0x25')]]={'$like':'%'+_0x10d6d6[_0x5151('0x2f')][_0x5151('0x3b')]+'%'};return _0x529b53;}})});}_0x11c580=_[_0x5151('0x3c')]({},_0x11c580,_0x10d6d6[_0x5151('0x3e')]);var _0x26aefc={'where':_0x11c580[_0x5151('0x3a')]};return db[_0x5151('0x28')][_0x5151('0x1e')](_0x26aefc)[_0x5151('0x22')](function(_0x414ef9){_0x495efb[_0x5151('0x1e')]=_0x414ef9;if(_0x10d6d6[_0x5151('0x2f')][_0x5151('0x3f')]){_0x11c580[_0x5151('0x40')]=[{'all':!![]}];}return db[_0x5151('0x28')][_0x5151('0x41')](_0x11c580);})['then'](function(_0x332f00){_0x495efb[_0x5151('0x42')]=_0x332f00;return _0x495efb;})['then'](respondWithFilteredResult(_0x19c06d,_0x11c580))[_0x5151('0x43')](handleError(_0x19c06d,null));};exports['show']=function(_0x30fc8b,_0x15593f){var _0x3f5da0={'raw':!![],'where':{'id':_0x30fc8b[_0x5151('0x44')]['id']}},_0x288d60={};_0x288d60[_0x5151('0x2d')]=_[_0x5151('0x30')](db[_0x5151('0x28')][_0x5151('0x29')]);_0x288d60[_0x5151('0x2f')]=_[_0x5151('0x30')](_0x30fc8b[_0x5151('0x2f')]);_0x288d60[_0x5151('0x31')]=_[_0x5151('0x32')](_0x288d60['model'],_0x288d60[_0x5151('0x2f')]);_0x3f5da0[_0x5151('0x33')]=_[_0x5151('0x32')](_0x288d60['model'],qs[_0x5151('0x34')](_0x30fc8b[_0x5151('0x2f')][_0x5151('0x34')]));_0x3f5da0[_0x5151('0x33')]=_0x3f5da0[_0x5151('0x33')][_0x5151('0x35')]?_0x3f5da0['attributes']:_0x288d60[_0x5151('0x2d')];if(_0x30fc8b['query'][_0x5151('0x3f')]){_0x3f5da0[_0x5151('0x40')]=[{'all':!![]}];}_0x3f5da0=_[_0x5151('0x3c')]({},_0x3f5da0,_0x30fc8b[_0x5151('0x3e')]);return db[_0x5151('0x28')][_0x5151('0x45')](_0x3f5da0)[_0x5151('0x22')](handleEntityNotFound(_0x15593f,null))['then'](respondWithResult(_0x15593f,null))[_0x5151('0x43')](handleError(_0x15593f,null));};exports[_0x5151('0x46')]=function(_0x1cc016,_0x933fcd){return db[_0x5151('0x28')][_0x5151('0x46')](_0x1cc016['body'],{})[_0x5151('0x22')](respondWithResult(_0x933fcd,0xc9))[_0x5151('0x43')](handleError(_0x933fcd,null));};exports[_0x5151('0x47')]=function(_0x5ecada,_0x9d01d9){if(_0x5ecada['body']['id']){delete _0x5ecada[_0x5151('0x48')]['id'];}return db['ServicenowField'][_0x5151('0x45')]({'where':{'id':_0x5ecada['params']['id']}})[_0x5151('0x22')](handleEntityNotFound(_0x9d01d9,null))['then'](saveUpdates(_0x5ecada['body'],null))['then'](respondWithResult(_0x9d01d9,null))['catch'](handleError(_0x9d01d9,null));};exports[_0x5151('0x49')]=function(_0x5d7394,_0xd1bdd7){return db[_0x5151('0x28')]['find']({'where':{'id':_0x5d7394[_0x5151('0x44')]['id']}})[_0x5151('0x22')](handleEntityNotFound(_0xd1bdd7,null))[_0x5151('0x22')](removeEntity(_0xd1bdd7,null))[_0x5151('0x43')](handleError(_0xd1bdd7,null));}; \ No newline at end of file +var _0xb381=['filter','merge','VIRTUAL','includeAll','findAll','rows','catch','params','rawAttributes','include','options','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','ServicenowField','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters'];(function(_0x3632fa,_0x30c819){var _0x35c4cf=function(_0x3e8b94){while(--_0x3e8b94){_0x3632fa['push'](_0x3632fa['shift']());}};_0x35c4cf(++_0x30c819);}(_0xb381,0x1dc));var _0x1b38=function(_0x29db36,_0x410ae9){_0x29db36=_0x29db36-0x0;var _0x234e87=_0xb381[_0x29db36];return _0x234e87;};'use strict';var emlformat=require(_0x1b38('0x0'));var rimraf=require(_0x1b38('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1b38('0x2'));var rp=require(_0x1b38('0x3'));var moment=require(_0x1b38('0x4'));var BPromise=require(_0x1b38('0x5'));var Mustache=require('mustache');var util=require(_0x1b38('0x6'));var path=require('path');var sox=require(_0x1b38('0x7'));var csv=require('to-csv');var ejs=require(_0x1b38('0x8'));var fs=require('fs');var fs_extra=require(_0x1b38('0x9'));var _=require(_0x1b38('0xa'));var squel=require(_0x1b38('0xb'));var crypto=require(_0x1b38('0xc'));var jsforce=require(_0x1b38('0xd'));var deskjs=require(_0x1b38('0xe'));var toCsv=require(_0x1b38('0xf'));var querystring=require(_0x1b38('0x10'));var Papa=require(_0x1b38('0x11'));var Redis=require(_0x1b38('0x12'));var authService=require(_0x1b38('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x1b38('0x14'));var hardwareService=require(_0x1b38('0x15'));var logger=require(_0x1b38('0x16'))(_0x1b38('0x17'));var utils=require('../../config/utils');var config=require(_0x1b38('0x18'));var licenseUtil=require(_0x1b38('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x445e1d,_0x4a25b5){_0x4a25b5=_0x4a25b5||0xcc;return function(_0x17c44b){if(_0x17c44b){return _0x445e1d[_0x1b38('0x1a')](_0x4a25b5);}return _0x445e1d['status'](_0x4a25b5)[_0x1b38('0x1b')]();};}function respondWithResult(_0x3e2ad5,_0x24fe79){_0x24fe79=_0x24fe79||0xc8;return function(_0x1488c8){if(_0x1488c8){return _0x3e2ad5[_0x1b38('0x1c')](_0x24fe79)[_0x1b38('0x1d')](_0x1488c8);}};}function respondWithFilteredResult(_0x2f5ca1,_0x5da3f6){return function(_0x1a0c40){if(_0x1a0c40){var _0x5a4672=typeof _0x5da3f6[_0x1b38('0x1e')]===_0x1b38('0x1f')&&typeof _0x5da3f6[_0x1b38('0x20')]===_0x1b38('0x1f');var _0x1cdde9=_0x1a0c40[_0x1b38('0x21')];var _0x578e95=_0x5a4672?0x0:_0x5da3f6[_0x1b38('0x1e')];var _0x5ef818=_0x5a4672?_0x1a0c40[_0x1b38('0x21')]:_0x5da3f6[_0x1b38('0x1e')]+_0x5da3f6['limit'];var _0x2e94dc;if(_0x5ef818>=_0x1cdde9){_0x5ef818=_0x1cdde9;_0x2e94dc=0xc8;}else{_0x2e94dc=0xce;}_0x2f5ca1[_0x1b38('0x1c')](_0x2e94dc);return _0x2f5ca1[_0x1b38('0x22')](_0x1b38('0x23'),_0x578e95+'-'+_0x5ef818+'/'+_0x1cdde9)[_0x1b38('0x1d')](_0x1a0c40);}return null;};}function patchUpdates(_0x9fd84d){return function(_0x1b821a){try{jsonpatch[_0x1b38('0x24')](_0x1b821a,_0x9fd84d,!![]);}catch(_0x531fae){return BPromise[_0x1b38('0x25')](_0x531fae);}return _0x1b821a[_0x1b38('0x26')]();};}function saveUpdates(_0x4d4cca,_0x4a0384){return function(_0x2bb777){if(_0x2bb777){return _0x2bb777[_0x1b38('0x27')](_0x4d4cca)[_0x1b38('0x28')](function(_0x3ec30b){return _0x3ec30b;});}return null;};}function removeEntity(_0x101265,_0x20fcbb){return function(_0x3a249f){if(_0x3a249f){return _0x3a249f[_0x1b38('0x29')]()[_0x1b38('0x28')](function(){_0x101265[_0x1b38('0x1c')](0xcc)[_0x1b38('0x1b')]();});}};}function handleEntityNotFound(_0x4c3373,_0x2ed649){return function(_0x2cd2ea){if(!_0x2cd2ea){_0x4c3373['sendStatus'](0x194);}return _0x2cd2ea;};}function handleError(_0x2cfaee,_0x3290ad){_0x3290ad=_0x3290ad||0x1f4;return function(_0x267eb2){logger[_0x1b38('0x2a')](_0x267eb2[_0x1b38('0x2b')]);if(_0x267eb2[_0x1b38('0x2c')]){delete _0x267eb2['name'];}_0x2cfaee['status'](_0x3290ad)['send'](_0x267eb2);};}exports[_0x1b38('0x2d')]=function(_0x4dabfb,_0x470f6f){var _0x1ad3e5={},_0xbb0079={},_0x391866={'count':0x0,'rows':[]};var _0x626868=_[_0x1b38('0x2e')](db[_0x1b38('0x2f')]['rawAttributes'],function(_0x18b6f0){return{'name':_0x18b6f0[_0x1b38('0x30')],'type':_0x18b6f0[_0x1b38('0x31')]['key']};});_0xbb0079[_0x1b38('0x32')]=_['map'](_0x626868,_0x1b38('0x2c'));_0xbb0079[_0x1b38('0x33')]=_[_0x1b38('0x34')](_0x4dabfb[_0x1b38('0x33')]);_0xbb0079['filters']=_[_0x1b38('0x35')](_0xbb0079['model'],_0xbb0079['query']);_0x1ad3e5[_0x1b38('0x36')]=_[_0x1b38('0x35')](_0xbb0079[_0x1b38('0x32')],qs[_0x1b38('0x37')](_0x4dabfb[_0x1b38('0x33')]['fields']));_0x1ad3e5[_0x1b38('0x36')]=_0x1ad3e5['attributes'][_0x1b38('0x38')]?_0x1ad3e5[_0x1b38('0x36')]:_0xbb0079[_0x1b38('0x32')];if(!_0x4dabfb[_0x1b38('0x33')][_0x1b38('0x39')](_0x1b38('0x3a'))){_0x1ad3e5[_0x1b38('0x20')]=qs['limit'](_0x4dabfb[_0x1b38('0x33')][_0x1b38('0x20')]);_0x1ad3e5[_0x1b38('0x1e')]=qs['offset'](_0x4dabfb['query'][_0x1b38('0x1e')]);}_0x1ad3e5['order']=qs[_0x1b38('0x3b')](_0x4dabfb[_0x1b38('0x33')]['sort']);_0x1ad3e5[_0x1b38('0x3c')]=qs['filters'](_[_0x1b38('0x3d')](_0x4dabfb[_0x1b38('0x33')],_0xbb0079[_0x1b38('0x3e')]),_0x626868);if(_0x4dabfb['query'][_0x1b38('0x3f')]){_0x1ad3e5[_0x1b38('0x3c')]=_[_0x1b38('0x40')](_0x1ad3e5[_0x1b38('0x3c')],{'$or':_[_0x1b38('0x2e')](_0x626868,function(_0x44dc40){if(_0x44dc40[_0x1b38('0x31')]!==_0x1b38('0x41')){var _0x3a5677={};_0x3a5677[_0x44dc40[_0x1b38('0x2c')]]={'$like':'%'+_0x4dabfb[_0x1b38('0x33')][_0x1b38('0x3f')]+'%'};return _0x3a5677;}})});}_0x1ad3e5=_[_0x1b38('0x40')]({},_0x1ad3e5,_0x4dabfb['options']);var _0x19a9d1={'where':_0x1ad3e5['where']};return db[_0x1b38('0x2f')][_0x1b38('0x21')](_0x19a9d1)[_0x1b38('0x28')](function(_0x4f96af){_0x391866['count']=_0x4f96af;if(_0x4dabfb['query'][_0x1b38('0x42')]){_0x1ad3e5['include']=[{'all':!![]}];}return db[_0x1b38('0x2f')][_0x1b38('0x43')](_0x1ad3e5);})['then'](function(_0x285db4){_0x391866[_0x1b38('0x44')]=_0x285db4;return _0x391866;})[_0x1b38('0x28')](respondWithFilteredResult(_0x470f6f,_0x1ad3e5))[_0x1b38('0x45')](handleError(_0x470f6f,null));};exports['show']=function(_0x481eb8,_0x5c567c){var _0x29fce9={'raw':!![],'where':{'id':_0x481eb8[_0x1b38('0x46')]['id']}},_0x54f466={};_0x54f466['model']=_['keys'](db[_0x1b38('0x2f')][_0x1b38('0x47')]);_0x54f466[_0x1b38('0x33')]=_[_0x1b38('0x34')](_0x481eb8[_0x1b38('0x33')]);_0x54f466[_0x1b38('0x3e')]=_['intersection'](_0x54f466['model'],_0x54f466[_0x1b38('0x33')]);_0x29fce9[_0x1b38('0x36')]=_['intersection'](_0x54f466[_0x1b38('0x32')],qs['fields'](_0x481eb8['query'][_0x1b38('0x37')]));_0x29fce9[_0x1b38('0x36')]=_0x29fce9[_0x1b38('0x36')][_0x1b38('0x38')]?_0x29fce9[_0x1b38('0x36')]:_0x54f466[_0x1b38('0x32')];if(_0x481eb8[_0x1b38('0x33')]['includeAll']){_0x29fce9[_0x1b38('0x48')]=[{'all':!![]}];}_0x29fce9=_[_0x1b38('0x40')]({},_0x29fce9,_0x481eb8[_0x1b38('0x49')]);return db['ServicenowField'][_0x1b38('0x4a')](_0x29fce9)[_0x1b38('0x28')](handleEntityNotFound(_0x5c567c,null))[_0x1b38('0x28')](respondWithResult(_0x5c567c,null))[_0x1b38('0x45')](handleError(_0x5c567c,null));};exports[_0x1b38('0x4b')]=function(_0x3594d3,_0x24a0bf){return db['ServicenowField'][_0x1b38('0x4b')](_0x3594d3[_0x1b38('0x4c')],{})['then'](respondWithResult(_0x24a0bf,0xc9))[_0x1b38('0x45')](handleError(_0x24a0bf,null));};exports[_0x1b38('0x27')]=function(_0x4c5ae4,_0x504597){if(_0x4c5ae4['body']['id']){delete _0x4c5ae4[_0x1b38('0x4c')]['id'];}return db[_0x1b38('0x2f')]['find']({'where':{'id':_0x4c5ae4[_0x1b38('0x46')]['id']}})[_0x1b38('0x28')](handleEntityNotFound(_0x504597,null))[_0x1b38('0x28')](saveUpdates(_0x4c5ae4[_0x1b38('0x4c')],null))[_0x1b38('0x28')](respondWithResult(_0x504597,null))['catch'](handleError(_0x504597,null));};exports[_0x1b38('0x29')]=function(_0x100516,_0x1ebfae){return db[_0x1b38('0x2f')]['find']({'where':{'id':_0x100516[_0x1b38('0x46')]['id']}})[_0x1b38('0x28')](handleEntityNotFound(_0x1ebfae,null))['then'](removeEntity(_0x1ebfae,null))[_0x1b38('0x45')](handleError(_0x1ebfae,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 1aed526..ed1eca1 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 _0x292c=['idField','lodash','util','api','moment','request-promise','path','../../config/environment','exports','define','ServicenowField','int_servicenow_fields'];(function(_0xe00d48,_0x59414a){var _0x1a2b19=function(_0x5b112){while(--_0x5b112){_0xe00d48['push'](_0xe00d48['shift']());}};_0x1a2b19(++_0x59414a);}(_0x292c,0x12d));var _0xc292=function(_0x581af1,_0x4f02c5){_0x581af1=_0x581af1-0x0;var _0x54c22e=_0x292c[_0x581af1];return _0x54c22e;};'use strict';var _=require(_0xc292('0x0'));var util=require(_0xc292('0x1'));var logger=require('../../config/logger')(_0xc292('0x2'));var moment=require(_0xc292('0x3'));var BPromise=require('bluebird');var rp=require(_0xc292('0x4'));var fs=require('fs');var path=require(_0xc292('0x5'));var rimraf=require('rimraf');var config=require(_0xc292('0x6'));var attributes=require('./intServicenowField.attributes');module[_0xc292('0x7')]=function(_0x38a123,_0x36cc50){return _0x38a123[_0xc292('0x8')](_0xc292('0x9'),attributes,{'tableName':_0xc292('0xa'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0xc292('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x85ca=['define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4d4926,_0x27ae21){var _0x135170=function(_0x272d26){while(--_0x272d26){_0x4d4926['push'](_0x4d4926['shift']());}};_0x135170(++_0x27ae21);}(_0x85ca,0x1b6));var _0xa85c=function(_0x137a59,_0x9e08bf){_0x137a59=_0x137a59-0x0;var _0x5cc3b4=_0x85ca[_0x137a59];return _0x5cc3b4;};'use strict';var _=require(_0xa85c('0x0'));var util=require(_0xa85c('0x1'));var logger=require(_0xa85c('0x2'))(_0xa85c('0x3'));var moment=require(_0xa85c('0x4'));var BPromise=require(_0xa85c('0x5'));var rp=require(_0xa85c('0x6'));var fs=require('fs');var path=require(_0xa85c('0x7'));var rimraf=require(_0xa85c('0x8'));var config=require(_0xa85c('0x9'));var attributes=require('./intServicenowField.attributes');module['exports']=function(_0x4b32df,_0x481bac){return _0x4b32df[_0xa85c('0xa')](_0xa85c('0xb'),attributes,{'tableName':_0xa85c('0xc'),'paranoid':![],'indexes':[{'name':_0xa85c('0xd'),'fields':[_0xa85c('0xe'),_0xa85c('0xf')],'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 f1ddbc2..5d87bdc 100644 --- a/server/api/intServicenowField/intServicenowField.rpc.js +++ b/server/api/intServicenowField/intServicenowField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf4eb=['ServicenowField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x31ba1a,_0x4e88ce){var _0xf8402b=function(_0x15c426){while(--_0x15c426){_0x31ba1a['push'](_0x31ba1a['shift']());}};_0xf8402b(++_0x4e88ce);}(_0xf4eb,0xec));var _0xbf4e=function(_0x2710db,_0x583fb9){_0x2710db=_0x2710db-0x0;var _0x355927=_0xf4eb[_0x2710db];return _0x355927;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('ServicenowField,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('ServicenowField,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});} \ No newline at end of file +var _0xb43b=['rpc','../../config/environment','http','request','info','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ServicenowField,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x5435f0,_0x35a415){var _0x2ebe95=function(_0x548bf3){while(--_0x548bf3){_0x5435f0['push'](_0x5435f0['shift']());}};_0x2ebe95(++_0x35a415);}(_0xb43b,0x1b2));var _0xbb43=function(_0x34b08c,_0x5d75ec){_0x34b08c=_0x34b08c-0x0;var _0x3ae0b9=_0xb43b[_0x34b08c];return _0x3ae0b9;};'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')]('ServicenowField,\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')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0x208c2b['error'][_0xbb43('0x12')]);return _0x29ae1a(_0x208c2b['error']['message']);}logger[_0xbb43('0x10')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0x208c2b[_0xbb43('0x10')][_0xbb43('0x12')]);return _0x2a2f11(_0x208c2b['error']['message']);}else{logger['info'](_0xbb43('0x13'),_0x80fe61,_0xbb43('0xc'));_0x2a2f11(_0x208c2b['result']['message']);}})[_0xbb43('0x14')](function(_0x563ce1){logger['error'](_0xbb43('0x13'),_0x80fe61,_0x563ce1);_0x29ae1a(_0x563ce1);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 009f6a0..cc30de1 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x179da2,_0x41489c){var _0x16bbf3=function(_0x43c356){while(--_0x43c356){_0x179da2['push'](_0x179da2['shift']());}};_0x16bbf3(++_0x41489c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x36ca9c,_0x41cd1b){var _0xd55487=function(_0x20883c){while(--_0x20883c){_0x36ca9c['push'](_0x36ca9c['shift']());}};_0xd55487(++_0x41cd1b);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 1628d2e..a709913 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(_0x4c512e,_0x3b89ca){var _0x538ba6=function(_0x1ef163){while(--_0x1ef163){_0x4c512e['push'](_0x4c512e['shift']());}};_0x538ba6(++_0x3b89ca);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'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(_0x20a535,_0x44b5bb){var _0x1d7914=function(_0x32830d){while(--_0x32830d){_0x20a535['push'](_0x20a535['shift']());}};_0x1d7914(++_0x44b5bb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'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 236f2aa..dcab45c 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 _0x209c=['params','includeAll','find','catch','create','body','getConfigurations','findOne','keys','SugarcrmConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','SugarcrmField','getFields','assigned_user_id','created_by','description','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','remoteUri','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','get_module_fields','stringify','values','module_fields','remove','includes','label','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','SugarcrmAccount','findAll'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x209c,0x1a5));var _0xc209=function(_0x24f5e4,_0x51c3a3){_0x24f5e4=_0x24f5e4-0x0;var _0x9f6f18=_0x209c[_0x24f5e4];return _0x9f6f18;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc209('0x0'));var zipdir=require(_0xc209('0x1'));var jsonpatch=require(_0xc209('0x2'));var rp=require(_0xc209('0x3'));var moment=require('moment');var BPromise=require(_0xc209('0x4'));var Mustache=require(_0xc209('0x5'));var util=require('util');var path=require(_0xc209('0x6'));var sox=require(_0xc209('0x7'));var csv=require(_0xc209('0x8'));var ejs=require(_0xc209('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc209('0xa'));var squel=require(_0xc209('0xb'));var crypto=require(_0xc209('0xc'));var jsforce=require(_0xc209('0xd'));var deskjs=require(_0xc209('0xe'));var toCsv=require(_0xc209('0x8'));var querystring=require('querystring');var Papa=require(_0xc209('0xf'));var Redis=require('ioredis');var authService=require(_0xc209('0x10'));var qs=require(_0xc209('0x11'));var as=require(_0xc209('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc209('0x13'))(_0xc209('0x14'));var utils=require(_0xc209('0x15'));var config=require(_0xc209('0x16'));var licenseUtil=require(_0xc209('0x17'));var db=require(_0xc209('0x18'))['db'];var integrations=require(_0xc209('0x19'));function respondWithStatusCode(_0xc2b3b9,_0x29e7f6){_0x29e7f6=_0x29e7f6||0xcc;return function(_0x2e5c4f){if(_0x2e5c4f){return _0xc2b3b9[_0xc209('0x1a')](_0x29e7f6);}return _0xc2b3b9[_0xc209('0x1b')](_0x29e7f6)[_0xc209('0x1c')]();};}function respondWithResult(_0x515d88,_0x34d8f1){_0x34d8f1=_0x34d8f1||0xc8;return function(_0x2712c8){if(_0x2712c8){return _0x515d88['status'](_0x34d8f1)[_0xc209('0x1d')](_0x2712c8);}};}function respondWithFilteredResult(_0x52db12,_0x2fc32a){return function(_0xa0eb1){if(_0xa0eb1){var _0xc7421e=typeof _0x2fc32a['offset']==='undefined'&&typeof _0x2fc32a[_0xc209('0x1e')]===_0xc209('0x1f');var _0x18756c=_0xa0eb1[_0xc209('0x20')];var _0x3bf586=_0xc7421e?0x0:_0x2fc32a[_0xc209('0x21')];var _0x470d64=_0xc7421e?_0xa0eb1[_0xc209('0x20')]:_0x2fc32a[_0xc209('0x21')]+_0x2fc32a[_0xc209('0x1e')];var _0x3f2836;if(_0x470d64>=_0x18756c){_0x470d64=_0x18756c;_0x3f2836=0xc8;}else{_0x3f2836=0xce;}_0x52db12[_0xc209('0x1b')](_0x3f2836);return _0x52db12[_0xc209('0x22')](_0xc209('0x23'),_0x3bf586+'-'+_0x470d64+'/'+_0x18756c)['json'](_0xa0eb1);}return null;};}function patchUpdates(_0x3d8a0f){return function(_0x2ddfb8){try{jsonpatch[_0xc209('0x24')](_0x2ddfb8,_0x3d8a0f,!![]);}catch(_0x52b120){return BPromise[_0xc209('0x25')](_0x52b120);}return _0x2ddfb8[_0xc209('0x26')]();};}function saveUpdates(_0x440f86,_0x44a1d3){return function(_0x4e5f74){if(_0x4e5f74){return _0x4e5f74[_0xc209('0x27')](_0x440f86)[_0xc209('0x28')](function(_0xc091f5){return _0xc091f5;});}return null;};}function removeEntity(_0x2af79c,_0x90dad2){return function(_0x3facb4){if(_0x3facb4){return _0x3facb4[_0xc209('0x29')]()[_0xc209('0x28')](function(){_0x2af79c[_0xc209('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x484260,_0x36d563){return function(_0x33375c){if(!_0x33375c){_0x484260['sendStatus'](0x194);}return _0x33375c;};}function handleError(_0x463606,_0x2f273d){_0x2f273d=_0x2f273d||0x1f4;return function(_0x89b16a){logger[_0xc209('0x2a')](_0x89b16a[_0xc209('0x2b')]);if(_0x89b16a['name']){delete _0x89b16a[_0xc209('0x2c')];}_0x463606[_0xc209('0x1b')](_0x2f273d)[_0xc209('0x2d')](_0x89b16a);};}exports[_0xc209('0x2e')]=function(_0x26dd67,_0x48a4ef){var _0x47196f={},_0x4a330f={},_0x182601={'count':0x0,'rows':[]};var _0x387b16=_[_0xc209('0x2f')](db['SugarcrmAccount'][_0xc209('0x30')],function(_0x4abcbf){return{'name':_0x4abcbf[_0xc209('0x31')],'type':_0x4abcbf[_0xc209('0x32')][_0xc209('0x33')]};});_0x4a330f[_0xc209('0x34')]=_[_0xc209('0x2f')](_0x387b16,_0xc209('0x2c'));_0x4a330f[_0xc209('0x35')]=_['keys'](_0x26dd67[_0xc209('0x35')]);_0x4a330f[_0xc209('0x36')]=_[_0xc209('0x37')](_0x4a330f['model'],_0x4a330f[_0xc209('0x35')]);_0x47196f[_0xc209('0x38')]=_[_0xc209('0x37')](_0x4a330f[_0xc209('0x34')],qs[_0xc209('0x39')](_0x26dd67[_0xc209('0x35')][_0xc209('0x39')]));_0x47196f['attributes']=_0x47196f[_0xc209('0x38')][_0xc209('0x3a')]?_0x47196f[_0xc209('0x38')]:_0x4a330f[_0xc209('0x34')];if(!_0x26dd67['query'][_0xc209('0x3b')](_0xc209('0x3c'))){_0x47196f[_0xc209('0x1e')]=qs[_0xc209('0x1e')](_0x26dd67[_0xc209('0x35')][_0xc209('0x1e')]);_0x47196f[_0xc209('0x21')]=qs[_0xc209('0x21')](_0x26dd67['query'][_0xc209('0x21')]);}_0x47196f[_0xc209('0x3d')]=qs[_0xc209('0x3e')](_0x26dd67[_0xc209('0x35')]['sort']);_0x47196f[_0xc209('0x3f')]=qs[_0xc209('0x36')](_[_0xc209('0x40')](_0x26dd67['query'],_0x4a330f['filters']),_0x387b16);if(_0x26dd67[_0xc209('0x35')][_0xc209('0x41')]){_0x47196f[_0xc209('0x3f')]=_[_0xc209('0x42')](_0x47196f[_0xc209('0x3f')],{'$or':_['map'](_0x387b16,function(_0x88d3d3){if(_0x88d3d3[_0xc209('0x32')]!==_0xc209('0x43')){var _0x162274={};_0x162274[_0x88d3d3[_0xc209('0x2c')]]={'$like':'%'+_0x26dd67[_0xc209('0x35')]['filter']+'%'};return _0x162274;}})});}_0x47196f=_[_0xc209('0x42')]({},_0x47196f,_0x26dd67[_0xc209('0x44')]);var _0x4f8ed1={'where':_0x47196f[_0xc209('0x3f')]};return db[_0xc209('0x45')][_0xc209('0x20')](_0x4f8ed1)['then'](function(_0x427ae3){_0x182601[_0xc209('0x20')]=_0x427ae3;if(_0x26dd67['query']['includeAll']){_0x47196f['include']=[{'all':!![]}];}return db[_0xc209('0x45')][_0xc209('0x46')](_0x47196f);})['then'](function(_0x446287){_0x182601['rows']=_0x446287;return _0x182601;})[_0xc209('0x28')](respondWithFilteredResult(_0x48a4ef,_0x47196f))['catch'](handleError(_0x48a4ef,null));};exports['show']=function(_0x46c9ae,_0x5c0a9a){var _0x18aa9f={'raw':![],'where':{'id':_0x46c9ae[_0xc209('0x47')]['id']}},_0x3f4ffa={};_0x3f4ffa[_0xc209('0x34')]=_['keys'](db[_0xc209('0x45')][_0xc209('0x30')]);_0x3f4ffa['query']=_['keys'](_0x46c9ae[_0xc209('0x35')]);_0x3f4ffa['filters']=_[_0xc209('0x37')](_0x3f4ffa[_0xc209('0x34')],_0x3f4ffa[_0xc209('0x35')]);_0x18aa9f[_0xc209('0x38')]=_[_0xc209('0x37')](_0x3f4ffa[_0xc209('0x34')],qs[_0xc209('0x39')](_0x46c9ae[_0xc209('0x35')][_0xc209('0x39')]));_0x18aa9f[_0xc209('0x38')]=_0x18aa9f[_0xc209('0x38')][_0xc209('0x3a')]?_0x18aa9f[_0xc209('0x38')]:_0x3f4ffa[_0xc209('0x34')];if(_0x46c9ae[_0xc209('0x35')][_0xc209('0x48')]){_0x18aa9f['include']=[{'all':!![]}];}_0x18aa9f=_[_0xc209('0x42')]({},_0x18aa9f,_0x46c9ae[_0xc209('0x44')]);return db[_0xc209('0x45')][_0xc209('0x49')](_0x18aa9f)[_0xc209('0x28')](handleEntityNotFound(_0x5c0a9a,null))[_0xc209('0x28')](respondWithResult(_0x5c0a9a,null))[_0xc209('0x4a')](handleError(_0x5c0a9a,null));};exports['create']=function(_0x52c3c3,_0x4b38be){return db[_0xc209('0x45')][_0xc209('0x4b')](_0x52c3c3[_0xc209('0x4c')],{})['then'](respondWithResult(_0x4b38be,0xc9))[_0xc209('0x4a')](handleError(_0x4b38be,null));};exports[_0xc209('0x27')]=function(_0x3746a5,_0x34b5a6){if(_0x3746a5['body']['id']){delete _0x3746a5['body']['id'];}return db['SugarcrmAccount']['find']({'where':{'id':_0x3746a5['params']['id']}})[_0xc209('0x28')](handleEntityNotFound(_0x34b5a6,null))[_0xc209('0x28')](saveUpdates(_0x3746a5[_0xc209('0x4c')],null))[_0xc209('0x28')](respondWithResult(_0x34b5a6,null))[_0xc209('0x4a')](handleError(_0x34b5a6,null));};exports[_0xc209('0x29')]=function(_0x3ffa01,_0xf27ff7){return db[_0xc209('0x45')][_0xc209('0x49')]({'where':{'id':_0x3ffa01['params']['id']}})['then'](handleEntityNotFound(_0xf27ff7,null))[_0xc209('0x28')](removeEntity(_0xf27ff7,null))[_0xc209('0x4a')](handleError(_0xf27ff7,null));};exports[_0xc209('0x4d')]=function(_0x4ef8ac,_0x145e3b,_0x45c078){var _0x1f4e91={};var _0x1eb3bd={};var _0x3ac52f;var _0x576192;return db[_0xc209('0x45')][_0xc209('0x4e')]({'where':{'id':_0x4ef8ac[_0xc209('0x47')]['id']}})[_0xc209('0x28')](handleEntityNotFound(_0x145e3b,null))[_0xc209('0x28')](function(_0xd22207){if(_0xd22207){_0x3ac52f=_0xd22207;_0x1eb3bd[_0xc209('0x34')]=_[_0xc209('0x4f')](db[_0xc209('0x50')][_0xc209('0x30')]);_0x1eb3bd['query']=_[_0xc209('0x4f')](_0x4ef8ac[_0xc209('0x35')]);_0x1eb3bd['filters']=_[_0xc209('0x37')](_0x1eb3bd['model'],_0x1eb3bd[_0xc209('0x35')]);_0x1f4e91[_0xc209('0x38')]=_['intersection'](_0x1eb3bd[_0xc209('0x34')],qs[_0xc209('0x39')](_0x4ef8ac['query'][_0xc209('0x39')]));_0x1f4e91[_0xc209('0x38')]=_0x1f4e91[_0xc209('0x38')][_0xc209('0x3a')]?_0x1f4e91['attributes']:_0x1eb3bd[_0xc209('0x34')];_0x1f4e91[_0xc209('0x3d')]=qs['sort'](_0x4ef8ac[_0xc209('0x35')][_0xc209('0x3e')]);_0x1f4e91[_0xc209('0x3f')]=qs[_0xc209('0x36')](_['pick'](_0x4ef8ac[_0xc209('0x35')],_0x1eb3bd[_0xc209('0x36')]));if(_0x4ef8ac[_0xc209('0x35')][_0xc209('0x41')]){_0x1f4e91[_0xc209('0x3f')]=_['merge'](_0x1f4e91['where'],{'$or':_['map'](_0x1f4e91['attributes'],function(_0x555b6e){var _0x3398a3={};_0x3398a3[_0x555b6e]={'$like':'%'+_0x4ef8ac[_0xc209('0x35')]['filter']+'%'};return _0x3398a3;})});}_0x1f4e91=_[_0xc209('0x42')]({},_0x1f4e91,_0x4ef8ac[_0xc209('0x44')]);return _0x3ac52f[_0xc209('0x4d')](_0x1f4e91);}})['then'](function(_0x419a87){if(_0x419a87){_0x576192=_0x419a87[_0xc209('0x3a')];if(!_0x4ef8ac[_0xc209('0x35')][_0xc209('0x3b')](_0xc209('0x3c'))){_0x1f4e91['limit']=qs[_0xc209('0x1e')](_0x4ef8ac[_0xc209('0x35')]['limit']);_0x1f4e91[_0xc209('0x21')]=qs[_0xc209('0x21')](_0x4ef8ac[_0xc209('0x35')][_0xc209('0x21')]);}return _0x3ac52f[_0xc209('0x4d')](_0x1f4e91);}})[_0xc209('0x28')](function(_0x1cc0ca){if(_0x1cc0ca){return _0x1cc0ca?{'count':_0x576192,'rows':_0x1cc0ca}:null;}})[_0xc209('0x28')](respondWithResult(_0x145e3b,null))[_0xc209('0x4a')](handleError(_0x145e3b,null));};exports[_0xc209('0x51')]=function(_0x93d5c,_0x30f746,_0x1a86b2){if(_0x93d5c[_0xc209('0x4c')]['id']){delete _0x93d5c[_0xc209('0x4c')]['id'];}return db[_0xc209('0x45')][_0xc209('0x4e')]({'where':{'id':_0x93d5c[_0xc209('0x47')]['id']}})[_0xc209('0x28')](handleEntityNotFound(_0x30f746,null))[_0xc209('0x28')](function(_0x4deb5c){if(_0x4deb5c){_0x93d5c[_0xc209('0x4c')][_0xc209('0x52')]=_0x4deb5c['id'];_0x93d5c[_0xc209('0x4c')][_0xc209('0x53')]=integrations[_0xc209('0x54')](_0x93d5c['body'][_0xc209('0x55')],_0x93d5c[_0xc209('0x4c')][_0xc209('0x32')]);_0x93d5c[_0xc209('0x4c')][_0xc209('0x56')]=integrations['getDescriptions'](_0x93d5c[_0xc209('0x4c')]['channel'],_0x93d5c[_0xc209('0x4c')][_0xc209('0x32')]);return db['SugarcrmConfiguration'][_0xc209('0x4b')](_0x93d5c[_0xc209('0x4c')],{'include':[{'model':db[_0xc209('0x57')],'as':'Subjects'},{'model':db[_0xc209('0x57')],'as':_0xc209('0x56')}]});}return null;})['then'](respondWithResult(_0x30f746,null))['catch'](handleError(_0x30f746,null));};exports[_0xc209('0x58')]=function(_0x36266c,_0x88f20c,_0x2c7df8){var _0x39875a='';var _0x213ff7=['id',_0xc209('0x2c'),_0xc209('0x59'),_0xc209('0x5a'),_0xc209('0x5b'),'date_start',_0xc209('0x5c'),_0xc209('0x5d'),_0xc209('0x5e'),_0xc209('0x5f'),_0xc209('0x60'),_0xc209('0x61')];return db['SugarcrmAccount'][_0xc209('0x4e')]({'where':{'id':_0x36266c[_0xc209('0x47')]['id']},'attributes':['id',_0xc209('0x62'),_0xc209('0x63'),_0xc209('0x64')]})['then'](handleEntityNotFound(_0x88f20c,null))['then'](function(_0x364b16){if(_0x364b16){_0x39875a=_0x364b16['remoteUri'];var _0xc59787=_0x39875a['slice'](-0x1);if(_0xc59787==='/'){_0x39875a=_0x39875a['substring'](0x0,_0x39875a[_0xc209('0x65')](_0xc59787));}return rp({'method':_0xc209('0x66'),'uri':util[_0xc209('0x67')](_0xc209('0x68'),_0x39875a,_0xc209('0x69')),'json':!![],'form':{'method':_0xc209('0x6a'),'input_type':_0xc209('0x6b'),'response_type':_0xc209('0x6b'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x364b16[_0xc209('0x62')],'password':_0x364b16[_0xc209('0x63')],'encryption':_0xc209('0x6c')},'application':_0xc209('0x6d')})}});}})[_0xc209('0x28')](function(_0x4be369){if(_0x4be369&&_0x4be369[_0xc209('0x2c')]!==_0xc209('0x6e')&&_0x4be369[_0xc209('0x2c')]!==_0xc209('0x6f')){return rp({'method':'POST','uri':util[_0xc209('0x67')]('%s%s',_0x39875a,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xc209('0x70'),'input_type':_0xc209('0x6b'),'response_type':_0xc209('0x6b'),'rest_data':JSON[_0xc209('0x71')]({'session':_0x4be369['id'],'module_name':'Calls'})}})[_0xc209('0x28')](function(_0x1e8e4c){if(_0x1e8e4c){var _0x24a18b=_[_0xc209('0x72')](_0x1e8e4c[_0xc209('0x73')]);_[_0xc209('0x74')](_0x24a18b,function(_0x1d00ab){return _0x213ff7[_0xc209('0x75')](_0x1d00ab[_0xc209('0x2c')]);});return{'count':_0x24a18b[_0xc209('0x3a')],'rows':_['map'](_0x24a18b,function(_0x3f618b){return{'id':_0x3f618b[_0xc209('0x2c')],'name':_0x3f618b[_0xc209('0x76')],'custom':_['endsWith'](_0x3f618b['name'],'_c')?!![]:![],'options':_0x3f618b[_0xc209('0x44')]?_[_0xc209('0x2f')](_[_0xc209('0x72')](_0x3f618b[_0xc209('0x44')]),function(_0x3d460a){return{'name':_0x3d460a['value'],'value':_0x3d460a[_0xc209('0x2c')]};}):[]};})};}})[_0xc209('0x28')](respondWithResult(_0x88f20c,null))[_0xc209('0x4a')](function(_0x5ec861){var _0x5afe57=_0x36266c[_0xc209('0x35')][_0xc209('0x77')]?0x1f4:_0x5ec861['statusCode']||0x1f4;logger[_0xc209('0x2a')](_0xc209('0x78'),_0xc209('0x58'),_0x5afe57,JSON[_0xc209('0x71')](_0x5ec861));delete _0x5ec861['name'];if(_0x5afe57===0x191){_0x5afe57=0x190;}_0x88f20c['status'](_0x5afe57)['send'](_0x36266c['query'][_0xc209('0x77')]?{'message':_0xc209('0x79'),'statusCode':_0x5ec861[_0xc209('0x7a')]}:_0x5ec861);});}else{var _0x25efcb=0x1f4;_0x88f20c[_0xc209('0x1b')](_0x25efcb)[_0xc209('0x2d')]({'message':_0xc209('0x79'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x80b0=['set','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','index','SugarcrmAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','include','findAll','show','params','includeAll','find','create','body','catch','destroy','getConfigurations','findOne','SugarcrmConfiguration','order','options','AccountId','Subjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','created_by','description','date_start','parent_id','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','get_module_fields','Calls','values','module_fields','remove','endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count'];(function(_0x2179f2,_0x2dff7c){var _0x236d1b=function(_0x3a0e47){while(--_0x3a0e47){_0x2179f2['push'](_0x2179f2['shift']());}};_0x236d1b(++_0x2dff7c);}(_0x80b0,0x152));var _0x080b=function(_0x4edbe2,_0x30c368){_0x4edbe2=_0x4edbe2-0x0;var _0x4d06e0=_0x80b0[_0x4edbe2];return _0x4d06e0;};'use strict';var emlformat=require(_0x080b('0x0'));var rimraf=require(_0x080b('0x1'));var zipdir=require(_0x080b('0x2'));var jsonpatch=require(_0x080b('0x3'));var rp=require(_0x080b('0x4'));var moment=require(_0x080b('0x5'));var BPromise=require(_0x080b('0x6'));var Mustache=require('mustache');var util=require(_0x080b('0x7'));var path=require('path');var sox=require(_0x080b('0x8'));var csv=require(_0x080b('0x9'));var ejs=require(_0x080b('0xa'));var fs=require('fs');var fs_extra=require(_0x080b('0xb'));var _=require(_0x080b('0xc'));var squel=require(_0x080b('0xd'));var crypto=require('crypto');var jsforce=require(_0x080b('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x080b('0x9'));var querystring=require('querystring');var Papa=require(_0x080b('0xf'));var Redis=require(_0x080b('0x10'));var authService=require(_0x080b('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x080b('0x12'));var hardwareService=require(_0x080b('0x13'));var logger=require(_0x080b('0x14'))(_0x080b('0x15'));var utils=require(_0x080b('0x16'));var config=require(_0x080b('0x17'));var licenseUtil=require(_0x080b('0x18'));var db=require(_0x080b('0x19'))['db'];var integrations=require(_0x080b('0x1a'));function respondWithStatusCode(_0x537c57,_0x5b92bc){_0x5b92bc=_0x5b92bc||0xcc;return function(_0x465787){if(_0x465787){return _0x537c57[_0x080b('0x1b')](_0x5b92bc);}return _0x537c57['status'](_0x5b92bc)['end']();};}function respondWithResult(_0x50a3b8,_0x3f705f){_0x3f705f=_0x3f705f||0xc8;return function(_0x3aad9b){if(_0x3aad9b){return _0x50a3b8[_0x080b('0x1c')](_0x3f705f)[_0x080b('0x1d')](_0x3aad9b);}};}function respondWithFilteredResult(_0x1d81e7,_0x23e4dd){return function(_0x407932){if(_0x407932){var _0x28212b=typeof _0x23e4dd[_0x080b('0x1e')]===_0x080b('0x1f')&&typeof _0x23e4dd[_0x080b('0x20')]==='undefined';var _0x5f2fc3=_0x407932[_0x080b('0x21')];var _0x2e7885=_0x28212b?0x0:_0x23e4dd[_0x080b('0x1e')];var _0x2edd11=_0x28212b?_0x407932[_0x080b('0x21')]:_0x23e4dd[_0x080b('0x1e')]+_0x23e4dd[_0x080b('0x20')];var _0x5a4cc9;if(_0x2edd11>=_0x5f2fc3){_0x2edd11=_0x5f2fc3;_0x5a4cc9=0xc8;}else{_0x5a4cc9=0xce;}_0x1d81e7[_0x080b('0x1c')](_0x5a4cc9);return _0x1d81e7[_0x080b('0x22')](_0x080b('0x23'),_0x2e7885+'-'+_0x2edd11+'/'+_0x5f2fc3)[_0x080b('0x1d')](_0x407932);}return null;};}function patchUpdates(_0x3a3fd4){return function(_0x5ba694){try{jsonpatch[_0x080b('0x24')](_0x5ba694,_0x3a3fd4,!![]);}catch(_0x2bdba8){return BPromise[_0x080b('0x25')](_0x2bdba8);}return _0x5ba694[_0x080b('0x26')]();};}function saveUpdates(_0x4bcbf6,_0x78190d){return function(_0x41c248){if(_0x41c248){return _0x41c248[_0x080b('0x27')](_0x4bcbf6)[_0x080b('0x28')](function(_0x58b55f){return _0x58b55f;});}return null;};}function removeEntity(_0x4961aa,_0x3ec34d){return function(_0x14e44e){if(_0x14e44e){return _0x14e44e['destroy']()['then'](function(){_0x4961aa[_0x080b('0x1c')](0xcc)[_0x080b('0x29')]();});}};}function handleEntityNotFound(_0x23c7de,_0x3e0430){return function(_0x1d4f20){if(!_0x1d4f20){_0x23c7de[_0x080b('0x1b')](0x194);}return _0x1d4f20;};}function handleError(_0x2b7e7b,_0x4d8bbc){_0x4d8bbc=_0x4d8bbc||0x1f4;return function(_0x53a565){logger[_0x080b('0x2a')](_0x53a565[_0x080b('0x2b')]);if(_0x53a565[_0x080b('0x2c')]){delete _0x53a565['name'];}_0x2b7e7b[_0x080b('0x1c')](_0x4d8bbc)[_0x080b('0x2d')](_0x53a565);};}exports[_0x080b('0x2e')]=function(_0x1aaeae,_0x56ef64){var _0x148279={},_0x17e3b2={},_0x3ab939={'count':0x0,'rows':[]};var _0x46af7f=_['map'](db[_0x080b('0x2f')][_0x080b('0x30')],function(_0x370db3){return{'name':_0x370db3[_0x080b('0x31')],'type':_0x370db3[_0x080b('0x32')][_0x080b('0x33')]};});_0x17e3b2[_0x080b('0x34')]=_[_0x080b('0x35')](_0x46af7f,_0x080b('0x2c'));_0x17e3b2[_0x080b('0x36')]=_[_0x080b('0x37')](_0x1aaeae[_0x080b('0x36')]);_0x17e3b2[_0x080b('0x38')]=_[_0x080b('0x39')](_0x17e3b2[_0x080b('0x34')],_0x17e3b2[_0x080b('0x36')]);_0x148279[_0x080b('0x3a')]=_[_0x080b('0x39')](_0x17e3b2[_0x080b('0x34')],qs[_0x080b('0x3b')](_0x1aaeae['query'][_0x080b('0x3b')]));_0x148279['attributes']=_0x148279['attributes'][_0x080b('0x3c')]?_0x148279[_0x080b('0x3a')]:_0x17e3b2[_0x080b('0x34')];if(!_0x1aaeae[_0x080b('0x36')]['hasOwnProperty'](_0x080b('0x3d'))){_0x148279['limit']=qs['limit'](_0x1aaeae[_0x080b('0x36')][_0x080b('0x20')]);_0x148279[_0x080b('0x1e')]=qs[_0x080b('0x1e')](_0x1aaeae[_0x080b('0x36')][_0x080b('0x1e')]);}_0x148279['order']=qs[_0x080b('0x3e')](_0x1aaeae[_0x080b('0x36')]['sort']);_0x148279[_0x080b('0x3f')]=qs[_0x080b('0x38')](_[_0x080b('0x40')](_0x1aaeae[_0x080b('0x36')],_0x17e3b2['filters']),_0x46af7f);if(_0x1aaeae[_0x080b('0x36')][_0x080b('0x41')]){_0x148279[_0x080b('0x3f')]=_[_0x080b('0x42')](_0x148279['where'],{'$or':_['map'](_0x46af7f,function(_0x39743d){if(_0x39743d[_0x080b('0x32')]!==_0x080b('0x43')){var _0x5a8ef5={};_0x5a8ef5[_0x39743d[_0x080b('0x2c')]]={'$like':'%'+_0x1aaeae[_0x080b('0x36')]['filter']+'%'};return _0x5a8ef5;}})});}_0x148279=_[_0x080b('0x42')]({},_0x148279,_0x1aaeae['options']);var _0x3ef13c={'where':_0x148279[_0x080b('0x3f')]};return db[_0x080b('0x2f')][_0x080b('0x21')](_0x3ef13c)['then'](function(_0x1f7d5c){_0x3ab939[_0x080b('0x21')]=_0x1f7d5c;if(_0x1aaeae['query']['includeAll']){_0x148279[_0x080b('0x44')]=[{'all':!![]}];}return db[_0x080b('0x2f')][_0x080b('0x45')](_0x148279);})[_0x080b('0x28')](function(_0x2f3bb1){_0x3ab939['rows']=_0x2f3bb1;return _0x3ab939;})[_0x080b('0x28')](respondWithFilteredResult(_0x56ef64,_0x148279))['catch'](handleError(_0x56ef64,null));};exports[_0x080b('0x46')]=function(_0xdcea0c,_0x2143ab){var _0x2a113f={'raw':![],'where':{'id':_0xdcea0c[_0x080b('0x47')]['id']}},_0x4ea1ba={};_0x4ea1ba[_0x080b('0x34')]=_[_0x080b('0x37')](db[_0x080b('0x2f')][_0x080b('0x30')]);_0x4ea1ba[_0x080b('0x36')]=_[_0x080b('0x37')](_0xdcea0c[_0x080b('0x36')]);_0x4ea1ba[_0x080b('0x38')]=_[_0x080b('0x39')](_0x4ea1ba['model'],_0x4ea1ba[_0x080b('0x36')]);_0x2a113f['attributes']=_['intersection'](_0x4ea1ba[_0x080b('0x34')],qs[_0x080b('0x3b')](_0xdcea0c[_0x080b('0x36')][_0x080b('0x3b')]));_0x2a113f[_0x080b('0x3a')]=_0x2a113f['attributes'][_0x080b('0x3c')]?_0x2a113f[_0x080b('0x3a')]:_0x4ea1ba[_0x080b('0x34')];if(_0xdcea0c['query'][_0x080b('0x48')]){_0x2a113f[_0x080b('0x44')]=[{'all':!![]}];}_0x2a113f=_[_0x080b('0x42')]({},_0x2a113f,_0xdcea0c['options']);return db[_0x080b('0x2f')][_0x080b('0x49')](_0x2a113f)[_0x080b('0x28')](handleEntityNotFound(_0x2143ab,null))[_0x080b('0x28')](respondWithResult(_0x2143ab,null))['catch'](handleError(_0x2143ab,null));};exports['create']=function(_0x6a93b2,_0x34b0c2){return db[_0x080b('0x2f')][_0x080b('0x4a')](_0x6a93b2[_0x080b('0x4b')],{})[_0x080b('0x28')](respondWithResult(_0x34b0c2,0xc9))[_0x080b('0x4c')](handleError(_0x34b0c2,null));};exports[_0x080b('0x27')]=function(_0x1bc5a9,_0xdf617c){if(_0x1bc5a9['body']['id']){delete _0x1bc5a9[_0x080b('0x4b')]['id'];}return db[_0x080b('0x2f')]['find']({'where':{'id':_0x1bc5a9[_0x080b('0x47')]['id']}})[_0x080b('0x28')](handleEntityNotFound(_0xdf617c,null))[_0x080b('0x28')](saveUpdates(_0x1bc5a9[_0x080b('0x4b')],null))[_0x080b('0x28')](respondWithResult(_0xdf617c,null))['catch'](handleError(_0xdf617c,null));};exports[_0x080b('0x4d')]=function(_0x4359a0,_0x418fcc){return db[_0x080b('0x2f')][_0x080b('0x49')]({'where':{'id':_0x4359a0[_0x080b('0x47')]['id']}})['then'](handleEntityNotFound(_0x418fcc,null))[_0x080b('0x28')](removeEntity(_0x418fcc,null))['catch'](handleError(_0x418fcc,null));};exports[_0x080b('0x4e')]=function(_0x5cfa26,_0x3c0bb5,_0x1092bc){var _0x1d5096={};var _0x1cacf5={};var _0x14a694;var _0x4ef109;return db[_0x080b('0x2f')][_0x080b('0x4f')]({'where':{'id':_0x5cfa26[_0x080b('0x47')]['id']}})[_0x080b('0x28')](handleEntityNotFound(_0x3c0bb5,null))[_0x080b('0x28')](function(_0x5aefb5){if(_0x5aefb5){_0x14a694=_0x5aefb5;_0x1cacf5['model']=_['keys'](db[_0x080b('0x50')][_0x080b('0x30')]);_0x1cacf5['query']=_[_0x080b('0x37')](_0x5cfa26[_0x080b('0x36')]);_0x1cacf5[_0x080b('0x38')]=_['intersection'](_0x1cacf5[_0x080b('0x34')],_0x1cacf5[_0x080b('0x36')]);_0x1d5096['attributes']=_[_0x080b('0x39')](_0x1cacf5[_0x080b('0x34')],qs[_0x080b('0x3b')](_0x5cfa26[_0x080b('0x36')][_0x080b('0x3b')]));_0x1d5096[_0x080b('0x3a')]=_0x1d5096[_0x080b('0x3a')][_0x080b('0x3c')]?_0x1d5096[_0x080b('0x3a')]:_0x1cacf5[_0x080b('0x34')];_0x1d5096[_0x080b('0x51')]=qs['sort'](_0x5cfa26[_0x080b('0x36')][_0x080b('0x3e')]);_0x1d5096[_0x080b('0x3f')]=qs[_0x080b('0x38')](_['pick'](_0x5cfa26[_0x080b('0x36')],_0x1cacf5[_0x080b('0x38')]));if(_0x5cfa26[_0x080b('0x36')][_0x080b('0x41')]){_0x1d5096[_0x080b('0x3f')]=_[_0x080b('0x42')](_0x1d5096[_0x080b('0x3f')],{'$or':_[_0x080b('0x35')](_0x1d5096[_0x080b('0x3a')],function(_0x5afcc2){var _0x44aa70={};_0x44aa70[_0x5afcc2]={'$like':'%'+_0x5cfa26[_0x080b('0x36')][_0x080b('0x41')]+'%'};return _0x44aa70;})});}_0x1d5096=_['merge']({},_0x1d5096,_0x5cfa26[_0x080b('0x52')]);return _0x14a694[_0x080b('0x4e')](_0x1d5096);}})[_0x080b('0x28')](function(_0x2ea87f){if(_0x2ea87f){_0x4ef109=_0x2ea87f['length'];if(!_0x5cfa26[_0x080b('0x36')]['hasOwnProperty'](_0x080b('0x3d'))){_0x1d5096['limit']=qs[_0x080b('0x20')](_0x5cfa26[_0x080b('0x36')][_0x080b('0x20')]);_0x1d5096['offset']=qs['offset'](_0x5cfa26[_0x080b('0x36')][_0x080b('0x1e')]);}return _0x14a694[_0x080b('0x4e')](_0x1d5096);}})['then'](function(_0x10f128){if(_0x10f128){return _0x10f128?{'count':_0x4ef109,'rows':_0x10f128}:null;}})[_0x080b('0x28')](respondWithResult(_0x3c0bb5,null))[_0x080b('0x4c')](handleError(_0x3c0bb5,null));};exports['addConfiguration']=function(_0xc3f632,_0x403b98,_0x3f9274){if(_0xc3f632[_0x080b('0x4b')]['id']){delete _0xc3f632[_0x080b('0x4b')]['id'];}return db['SugarcrmAccount'][_0x080b('0x4f')]({'where':{'id':_0xc3f632[_0x080b('0x47')]['id']}})['then'](handleEntityNotFound(_0x403b98,null))['then'](function(_0x5e3a83){if(_0x5e3a83){_0xc3f632[_0x080b('0x4b')][_0x080b('0x53')]=_0x5e3a83['id'];_0xc3f632[_0x080b('0x4b')][_0x080b('0x54')]=integrations['getSubjects'](_0xc3f632[_0x080b('0x4b')][_0x080b('0x55')],_0xc3f632[_0x080b('0x4b')][_0x080b('0x32')]);_0xc3f632[_0x080b('0x4b')][_0x080b('0x56')]=integrations[_0x080b('0x57')](_0xc3f632[_0x080b('0x4b')][_0x080b('0x55')],_0xc3f632[_0x080b('0x4b')]['type']);return db['SugarcrmConfiguration'][_0x080b('0x4a')](_0xc3f632[_0x080b('0x4b')],{'include':[{'model':db['SugarcrmField'],'as':'Subjects'},{'model':db[_0x080b('0x58')],'as':'Descriptions'}]});}return null;})[_0x080b('0x28')](respondWithResult(_0x403b98,null))[_0x080b('0x4c')](handleError(_0x403b98,null));};exports[_0x080b('0x59')]=function(_0x456be3,_0x546ac4,_0x170227){var _0x1fd0d5='';var _0x370958=['id','name','assigned_user_id',_0x080b('0x5a'),_0x080b('0x5b'),_0x080b('0x5c'),'duration_hours','duration_minutes',_0x080b('0x5d'),_0x080b('0x5e'),_0x080b('0x5f'),_0x080b('0x60')];return db[_0x080b('0x2f')][_0x080b('0x4f')]({'where':{'id':_0x456be3[_0x080b('0x47')]['id']},'attributes':['id',_0x080b('0x61'),_0x080b('0x62'),_0x080b('0x63')]})[_0x080b('0x28')](handleEntityNotFound(_0x546ac4,null))['then'](function(_0x559ca2){if(_0x559ca2){_0x1fd0d5=_0x559ca2['remoteUri'];var _0xaf4da0=_0x1fd0d5[_0x080b('0x64')](-0x1);if(_0xaf4da0==='/'){_0x1fd0d5=_0x1fd0d5[_0x080b('0x65')](0x0,_0x1fd0d5[_0x080b('0x66')](_0xaf4da0));}return rp({'method':_0x080b('0x67'),'uri':util[_0x080b('0x68')](_0x080b('0x69'),_0x1fd0d5,_0x080b('0x6a')),'json':!![],'form':{'method':'login','input_type':_0x080b('0x6b'),'response_type':_0x080b('0x6b'),'rest_data':JSON[_0x080b('0x6c')]({'user_auth':{'user_name':_0x559ca2[_0x080b('0x61')],'password':_0x559ca2[_0x080b('0x62')],'encryption':_0x080b('0x6d')},'application':_0x080b('0x6e')})}});}})['then'](function(_0x8069cf){if(_0x8069cf&&_0x8069cf[_0x080b('0x2c')]!==_0x080b('0x6f')&&_0x8069cf['name']!==_0x080b('0x70')){return rp({'method':'POST','uri':util[_0x080b('0x68')](_0x080b('0x69'),_0x1fd0d5,_0x080b('0x6a')),'json':!![],'form':{'method':_0x080b('0x71'),'input_type':_0x080b('0x6b'),'response_type':_0x080b('0x6b'),'rest_data':JSON['stringify']({'session':_0x8069cf['id'],'module_name':_0x080b('0x72')})}})[_0x080b('0x28')](function(_0x32046f){if(_0x32046f){var _0x24b782=_[_0x080b('0x73')](_0x32046f[_0x080b('0x74')]);_[_0x080b('0x75')](_0x24b782,function(_0x239217){return _0x370958['includes'](_0x239217[_0x080b('0x2c')]);});return{'count':_0x24b782[_0x080b('0x3c')],'rows':_[_0x080b('0x35')](_0x24b782,function(_0x15958f){return{'id':_0x15958f[_0x080b('0x2c')],'name':_0x15958f['label'],'custom':_[_0x080b('0x76')](_0x15958f[_0x080b('0x2c')],'_c')?!![]:![],'options':_0x15958f[_0x080b('0x52')]?_[_0x080b('0x35')](_[_0x080b('0x73')](_0x15958f[_0x080b('0x52')]),function(_0x5c88cd){return{'name':_0x5c88cd[_0x080b('0x77')],'value':_0x5c88cd[_0x080b('0x2c')]};}):[]};})};}})['then'](respondWithResult(_0x546ac4,null))[_0x080b('0x4c')](function(_0x36d029){var _0x981712=_0x456be3['query'][_0x080b('0x78')]?0x1f4:_0x36d029[_0x080b('0x79')]||0x1f4;logger[_0x080b('0x2a')](_0x080b('0x7a'),_0x080b('0x59'),_0x981712,JSON['stringify'](_0x36d029));delete _0x36d029[_0x080b('0x2c')];if(_0x981712===0x191){_0x981712=0x190;}_0x546ac4[_0x080b('0x1c')](_0x981712)['send'](_0x456be3[_0x080b('0x36')][_0x080b('0x78')]?{'message':'Wrong\x20credentials','statusCode':_0x36d029[_0x080b('0x79')]}:_0x36d029);});}else{var _0x228791=0x1f4;_0x546ac4['status'](_0x228791)['send']({'message':_0x080b('0x7b'),'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 17e8669..9f3a65f 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 _0x1617=['request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','define','SugarcrmAccount','int_sugarcrm_accounts','util','api','bluebird'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1617,0xa5));var _0x7161=function(_0x3a73bc,_0x550aef){_0x3a73bc=_0x3a73bc-0x0;var _0x32891b=_0x1617[_0x3a73bc];return _0x32891b;};'use strict';var _=require('lodash');var util=require(_0x7161('0x0'));var logger=require('../../config/logger')(_0x7161('0x1'));var moment=require('moment');var BPromise=require(_0x7161('0x2'));var rp=require(_0x7161('0x3'));var fs=require('fs');var path=require(_0x7161('0x4'));var rimraf=require(_0x7161('0x5'));var config=require(_0x7161('0x6'));var attributes=require(_0x7161('0x7'));var integrations=require(_0x7161('0x8'));module['exports']=function(_0x579241,_0x24f962){return _0x579241[_0x7161('0x9')](_0x7161('0xa'),attributes,{'tableName':_0x7161('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb32f=['rimraf','../../config/environment','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x54d5ba,_0x1f1ba9){var _0x6a592e=function(_0x394f8d){while(--_0x394f8d){_0x54d5ba['push'](_0x54d5ba['shift']());}};_0x6a592e(++_0x1f1ba9);}(_0xb32f,0x1c2));var _0xfb32=function(_0x1608b6,_0x24d4da){_0x1608b6=_0x1608b6-0x0;var _0x21a2de=_0xb32f[_0x1608b6];return _0x21a2de;};'use strict';var _=require(_0xfb32('0x0'));var util=require('util');var logger=require(_0xfb32('0x1'))(_0xfb32('0x2'));var moment=require(_0xfb32('0x3'));var BPromise=require(_0xfb32('0x4'));var rp=require(_0xfb32('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfb32('0x6'));var config=require(_0xfb32('0x7'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xfb32('0x8')]=function(_0x40cde9,_0x5a6ecb){return _0x40cde9[_0xfb32('0x9')](_0xfb32('0xa'),attributes,{'tableName':_0xfb32('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 0a27a51..b915ace 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 _0x6913=['ShowSugarcrmAccount','SugarcrmAccount','find','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetSugarcrmAccount','findAll','options','raw','where','attributes','limit','include','map','model','then'];(function(_0x3a9832,_0x28b818){var _0x48c2af=function(_0x177833){while(--_0x177833){_0x3a9832['push'](_0x3a9832['shift']());}};_0x48c2af(++_0x28b818);}(_0x6913,0x1df));var _0x3691=function(_0x4d791f,_0xf61730){_0x4d791f=_0x4d791f-0x0;var _0x106060=_0x6913[_0x4d791f];return _0x106060;};'use strict';var _=require(_0x3691('0x0'));var util=require(_0x3691('0x1'));var moment=require('moment');var BPromise=require(_0x3691('0x2'));var rs=require(_0x3691('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3691('0x4'))['db'];var utils=require(_0x3691('0x5'));var logger=require('../../config/logger')(_0x3691('0x6'));var config=require('../../config/environment');var jayson=require(_0x3691('0x7'));var client=jayson[_0x3691('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x46e6d6,_0x4f2c4e,_0x351609){return new BPromise(function(_0x1e113e,_0x438712){return client[_0x3691('0x9')](_0x46e6d6,_0x351609)['then'](function(_0x1d64d5){logger[_0x3691('0xa')](_0x3691('0xb'),_0x4f2c4e,_0x3691('0xc'));logger[_0x3691('0xd')](_0x3691('0xe'),_0x4f2c4e,_0x3691('0xc'),JSON[_0x3691('0xf')](_0x1d64d5));if(_0x1d64d5['error']){if(_0x1d64d5[_0x3691('0x10')][_0x3691('0x11')]===0x1f4){logger[_0x3691('0x10')](_0x3691('0xb'),_0x4f2c4e,_0x1d64d5[_0x3691('0x10')][_0x3691('0x12')]);return _0x438712(_0x1d64d5['error'][_0x3691('0x12')]);}logger[_0x3691('0x10')](_0x3691('0xb'),_0x4f2c4e,_0x1d64d5[_0x3691('0x10')][_0x3691('0x12')]);return _0x1e113e(_0x1d64d5[_0x3691('0x10')][_0x3691('0x12')]);}else{logger[_0x3691('0xa')]('SugarcrmAccount,\x20%s,\x20%s',_0x4f2c4e,_0x3691('0xc'));_0x1e113e(_0x1d64d5['result']['message']);}})[_0x3691('0x13')](function(_0x5212cc){logger[_0x3691('0x10')]('SugarcrmAccount,\x20%s,\x20%s',_0x4f2c4e,_0x5212cc);_0x438712(_0x5212cc);});});}exports[_0x3691('0x14')]=function(_0x521bad){var _0x557218=this;return new Promise(function(_0x4fd417,_0x4887cb){return db['SugarcrmAccount'][_0x3691('0x15')]({'raw':_0x521bad[_0x3691('0x16')]?_0x521bad[_0x3691('0x16')][_0x3691('0x17')]===undefined?!![]:![]:!![],'where':_0x521bad[_0x3691('0x16')]?_0x521bad[_0x3691('0x16')][_0x3691('0x18')]||null:null,'attributes':_0x521bad[_0x3691('0x16')]?_0x521bad[_0x3691('0x16')][_0x3691('0x19')]||null:null,'limit':_0x521bad[_0x3691('0x16')]?_0x521bad[_0x3691('0x16')][_0x3691('0x1a')]||null:null,'include':_0x521bad[_0x3691('0x16')]?_0x521bad[_0x3691('0x16')][_0x3691('0x1b')]?_[_0x3691('0x1c')](_0x521bad[_0x3691('0x16')]['include'],function(_0xbf96bc){return{'model':db[_0xbf96bc[_0x3691('0x1d')]],'as':_0xbf96bc['as'],'attributes':_0xbf96bc[_0x3691('0x19')],'include':_0xbf96bc[_0x3691('0x1b')]?_['map'](_0xbf96bc['include'],function(_0x4e557e){return{'model':db[_0x4e557e['model']],'as':_0x4e557e['as'],'attributes':_0x4e557e[_0x3691('0x19')],'include':_0x4e557e[_0x3691('0x1b')]?_[_0x3691('0x1c')](_0x4e557e[_0x3691('0x1b')],function(_0x1d8573){return{'model':db[_0x1d8573[_0x3691('0x1d')]],'as':_0x1d8573['as'],'attributes':_0x1d8573[_0x3691('0x19')]};}):[]};}):[]};}):[]:[]})[_0x3691('0x1e')](function(_0x599ea8){logger[_0x3691('0xa')](_0x3691('0x14'),_0x521bad);logger[_0x3691('0xd')](_0x3691('0x14'),_0x521bad,JSON[_0x3691('0xf')](_0x599ea8));_0x4fd417(_0x599ea8);})[_0x3691('0x13')](function(_0x5dff52){logger[_0x3691('0x10')](_0x3691('0x14'),_0x5dff52[_0x3691('0x12')],_0x521bad);_0x4887cb(_0x557218[_0x3691('0x10')](0x1f4,_0x5dff52[_0x3691('0x12')]));});});};exports[_0x3691('0x1f')]=function(_0x4307c3){var _0x2b63eb=this;return new Promise(function(_0x266cc7,_0x48a744){return db[_0x3691('0x20')][_0x3691('0x21')]({'raw':_0x4307c3[_0x3691('0x16')]?_0x4307c3[_0x3691('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x4307c3[_0x3691('0x16')]?_0x4307c3[_0x3691('0x16')][_0x3691('0x18')]||null:null,'attributes':_0x4307c3[_0x3691('0x16')]?_0x4307c3[_0x3691('0x16')][_0x3691('0x19')]||null:null,'include':_0x4307c3[_0x3691('0x16')]?_0x4307c3[_0x3691('0x16')]['include']?_[_0x3691('0x1c')](_0x4307c3[_0x3691('0x16')][_0x3691('0x1b')],function(_0xb99d){return{'model':db[_0xb99d['model']],'as':_0xb99d['as'],'attributes':_0xb99d[_0x3691('0x19')],'include':_0xb99d[_0x3691('0x1b')]?_['map'](_0xb99d[_0x3691('0x1b')],function(_0x444132){return{'model':db[_0x444132[_0x3691('0x1d')]],'as':_0x444132['as'],'attributes':_0x444132[_0x3691('0x19')],'include':_0x444132[_0x3691('0x1b')]?_['map'](_0x444132['include'],function(_0xf76bcf){return{'model':db[_0xf76bcf[_0x3691('0x1d')]],'as':_0xf76bcf['as'],'attributes':_0xf76bcf[_0x3691('0x19')]};}):[]};}):[]};}):[]:[]})[_0x3691('0x1e')](function(_0x5c00cd){logger[_0x3691('0xa')]('ShowSugarcrmAccount',_0x4307c3);logger[_0x3691('0xd')]('ShowSugarcrmAccount',_0x4307c3,JSON[_0x3691('0xf')](_0x5c00cd));_0x266cc7(_0x5c00cd);})[_0x3691('0x13')](function(_0x1c2187){logger[_0x3691('0x10')]('ShowSugarcrmAccount',_0x1c2187[_0x3691('0x12')],_0x4307c3);_0x48a744(_0x2b63eb[_0x3691('0x10')](0x1f4,_0x1c2187['message']));});});}; \ No newline at end of file +var _0x71a9=['include','map','model','attributes','ShowSugarcrmAccount','find','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmAccount,\x20%s,\x20%s','message','info','catch','GetSugarcrmAccount','SugarcrmAccount','raw','options'];(function(_0x409251,_0x40f525){var _0x216f47=function(_0x517895){while(--_0x517895){_0x409251['push'](_0x409251['shift']());}};_0x216f47(++_0x40f525);}(_0x71a9,0x1b3));var _0x971a=function(_0x376717,_0x592b99){_0x376717=_0x376717-0x0;var _0x4c3d32=_0x71a9[_0x376717];return _0x4c3d32;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x971a('0x0'));var BPromise=require(_0x971a('0x1'));var rs=require(_0x971a('0x2'));var fs=require('fs');var Redis=require(_0x971a('0x3'));var db=require(_0x971a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x971a('0x5'))(_0x971a('0x6'));var config=require(_0x971a('0x7'));var jayson=require(_0x971a('0x8'));var client=jayson[_0x971a('0x9')][_0x971a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c9ffc,_0x274084,_0x17e11c){return new BPromise(function(_0x540587,_0xc3be57){return client[_0x971a('0xb')](_0x2c9ffc,_0x17e11c)[_0x971a('0xc')](function(_0x16cc8b){logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x274084,_0x971a('0xd'));logger[_0x971a('0xe')](_0x971a('0xf'),_0x274084,_0x971a('0xd'),JSON[_0x971a('0x10')](_0x16cc8b));if(_0x16cc8b[_0x971a('0x11')]){if(_0x16cc8b[_0x971a('0x11')][_0x971a('0x12')]===0x1f4){logger[_0x971a('0x11')](_0x971a('0x13'),_0x274084,_0x16cc8b[_0x971a('0x11')][_0x971a('0x14')]);return _0xc3be57(_0x16cc8b[_0x971a('0x11')][_0x971a('0x14')]);}logger[_0x971a('0x11')](_0x971a('0x13'),_0x274084,_0x16cc8b[_0x971a('0x11')]['message']);return _0x540587(_0x16cc8b['error']['message']);}else{logger[_0x971a('0x15')](_0x971a('0x13'),_0x274084,'request\x20sent');_0x540587(_0x16cc8b['result']['message']);}})[_0x971a('0x16')](function(_0xdb9139){logger['error'](_0x971a('0x13'),_0x274084,_0xdb9139);_0xc3be57(_0xdb9139);});});}exports[_0x971a('0x17')]=function(_0x120fa6){var _0x42a156=this;return new Promise(function(_0x3efec7,_0x393240){return db[_0x971a('0x18')]['findAll']({'raw':_0x120fa6['options']?_0x120fa6['options'][_0x971a('0x19')]===undefined?!![]:![]:!![],'where':_0x120fa6[_0x971a('0x1a')]?_0x120fa6[_0x971a('0x1a')]['where']||null:null,'attributes':_0x120fa6[_0x971a('0x1a')]?_0x120fa6[_0x971a('0x1a')]['attributes']||null:null,'limit':_0x120fa6['options']?_0x120fa6[_0x971a('0x1a')]['limit']||null:null,'include':_0x120fa6[_0x971a('0x1a')]?_0x120fa6[_0x971a('0x1a')][_0x971a('0x1b')]?_[_0x971a('0x1c')](_0x120fa6['options']['include'],function(_0x57ff7c){return{'model':db[_0x57ff7c[_0x971a('0x1d')]],'as':_0x57ff7c['as'],'attributes':_0x57ff7c[_0x971a('0x1e')],'include':_0x57ff7c[_0x971a('0x1b')]?_['map'](_0x57ff7c[_0x971a('0x1b')],function(_0x47ff43){return{'model':db[_0x47ff43[_0x971a('0x1d')]],'as':_0x47ff43['as'],'attributes':_0x47ff43['attributes'],'include':_0x47ff43[_0x971a('0x1b')]?_['map'](_0x47ff43[_0x971a('0x1b')],function(_0x2790a3){return{'model':db[_0x2790a3[_0x971a('0x1d')]],'as':_0x2790a3['as'],'attributes':_0x2790a3['attributes']};}):[]};}):[]};}):[]:[]})[_0x971a('0xc')](function(_0x36203a){logger[_0x971a('0x15')]('GetSugarcrmAccount',_0x120fa6);logger[_0x971a('0xe')]('GetSugarcrmAccount',_0x120fa6,JSON[_0x971a('0x10')](_0x36203a));_0x3efec7(_0x36203a);})[_0x971a('0x16')](function(_0x4dcf87){logger['error']('GetSugarcrmAccount',_0x4dcf87[_0x971a('0x14')],_0x120fa6);_0x393240(_0x42a156[_0x971a('0x11')](0x1f4,_0x4dcf87[_0x971a('0x14')]));});});};exports[_0x971a('0x1f')]=function(_0x1fa81e){var _0x5efdf0=this;return new Promise(function(_0xa9dfb0,_0x927cec){return db[_0x971a('0x18')][_0x971a('0x20')]({'raw':_0x1fa81e['options']?_0x1fa81e[_0x971a('0x1a')][_0x971a('0x19')]===undefined?!![]:![]:!![],'where':_0x1fa81e[_0x971a('0x1a')]?_0x1fa81e[_0x971a('0x1a')]['where']||null:null,'attributes':_0x1fa81e[_0x971a('0x1a')]?_0x1fa81e['options'][_0x971a('0x1e')]||null:null,'include':_0x1fa81e[_0x971a('0x1a')]?_0x1fa81e[_0x971a('0x1a')]['include']?_['map'](_0x1fa81e[_0x971a('0x1a')][_0x971a('0x1b')],function(_0x328ac1){return{'model':db[_0x328ac1[_0x971a('0x1d')]],'as':_0x328ac1['as'],'attributes':_0x328ac1['attributes'],'include':_0x328ac1[_0x971a('0x1b')]?_['map'](_0x328ac1['include'],function(_0x45e1c4){return{'model':db[_0x45e1c4[_0x971a('0x1d')]],'as':_0x45e1c4['as'],'attributes':_0x45e1c4[_0x971a('0x1e')],'include':_0x45e1c4['include']?_[_0x971a('0x1c')](_0x45e1c4[_0x971a('0x1b')],function(_0x5258ac){return{'model':db[_0x5258ac[_0x971a('0x1d')]],'as':_0x5258ac['as'],'attributes':_0x5258ac['attributes']};}):[]};}):[]};}):[]:[]})[_0x971a('0xc')](function(_0x675699){logger[_0x971a('0x15')](_0x971a('0x1f'),_0x1fa81e);logger[_0x971a('0xe')](_0x971a('0x1f'),_0x1fa81e,JSON[_0x971a('0x10')](_0x675699));_0xa9dfb0(_0x675699);})['catch'](function(_0x4465af){logger[_0x971a('0x11')](_0x971a('0x1f'),_0x4465af[_0x971a('0x14')],_0x1fa81e);_0x927cec(_0x5efdf0[_0x971a('0x11')](0x1f4,_0x4465af['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 6ae7740..5a1d73a 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 _0xdbd7=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','put','update','/:id','destroy','exports','multer','util'];(function(_0x22404b,_0x5bc9df){var _0x5a9b28=function(_0x861071){while(--_0x861071){_0x22404b['push'](_0x22404b['shift']());}};_0x5a9b28(++_0x5bc9df);}(_0xdbd7,0x8e));var _0x7dbd=function(_0x488023,_0x22660b){_0x488023=_0x488023-0x0;var _0x1140c7=_0xdbd7[_0x488023];return _0x1140c7;};'use strict';var multer=require(_0x7dbd('0x0'));var util=require(_0x7dbd('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x7dbd('0x2'));var interaction=require(_0x7dbd('0x3'));var config=require(_0x7dbd('0x4'));var controller=require('./intSugarcrmConfiguration.controller');router[_0x7dbd('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7dbd('0x5')]('/:id',auth[_0x7dbd('0x6')](),controller['show']);router[_0x7dbd('0x5')](_0x7dbd('0x7'),auth[_0x7dbd('0x6')](),controller[_0x7dbd('0x8')]);router[_0x7dbd('0x5')](_0x7dbd('0x9'),auth[_0x7dbd('0x6')](),controller[_0x7dbd('0xa')]);router['get'](_0x7dbd('0xb'),auth[_0x7dbd('0x6')](),controller['getDescriptions']);router[_0x7dbd('0xc')]('/',auth[_0x7dbd('0x6')](),controller['create']);router[_0x7dbd('0xd')]('/:id',auth[_0x7dbd('0x6')](),controller[_0x7dbd('0xe')]);router['delete'](_0x7dbd('0xf'),auth[_0x7dbd('0x6')](),controller[_0x7dbd('0x10')]);module[_0x7dbd('0x11')]=router; \ No newline at end of file +var _0x8d4c=['show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x3f3493,_0x3c1f66){var _0x379d70=function(_0x286c82){while(--_0x286c82){_0x3f3493['push'](_0x3f3493['shift']());}};_0x379d70(++_0x3c1f66);}(_0x8d4c,0x137));var _0xc8d4=function(_0x4611bb,_0x16f2a7){_0x4611bb=_0x4611bb-0x0;var _0x4ab34a=_0x8d4c[_0x4611bb];return _0x4ab34a;};'use strict';var multer=require(_0xc8d4('0x0'));var util=require(_0xc8d4('0x1'));var path=require(_0xc8d4('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc8d4('0x3')]();var fs_extra=require(_0xc8d4('0x4'));var auth=require(_0xc8d4('0x5'));var interaction=require(_0xc8d4('0x6'));var config=require(_0xc8d4('0x7'));var controller=require(_0xc8d4('0x8'));router[_0xc8d4('0x9')]('/',auth[_0xc8d4('0xa')](),controller[_0xc8d4('0xb')]);router[_0xc8d4('0x9')](_0xc8d4('0xc'),auth[_0xc8d4('0xa')](),controller[_0xc8d4('0xd')]);router[_0xc8d4('0x9')](_0xc8d4('0xe'),auth[_0xc8d4('0xa')](),controller[_0xc8d4('0xf')]);router[_0xc8d4('0x9')](_0xc8d4('0x10'),auth[_0xc8d4('0xa')](),controller[_0xc8d4('0x11')]);router[_0xc8d4('0x9')](_0xc8d4('0x12'),auth['isAuthenticated'](),controller[_0xc8d4('0x13')]);router[_0xc8d4('0x14')]('/',auth[_0xc8d4('0xa')](),controller[_0xc8d4('0x15')]);router[_0xc8d4('0x16')](_0xc8d4('0xc'),auth[_0xc8d4('0xa')](),controller[_0xc8d4('0x17')]);router[_0xc8d4('0x18')](_0xc8d4('0xc'),auth['isAuthenticated'](),controller[_0xc8d4('0x19')]);module[_0xc8d4('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 8aba231..99757d1 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 _0xc3d6=['exports','STRING','sequelize'];(function(_0x4649aa,_0xa96950){var _0xf8c283=function(_0x313526){while(--_0x313526){_0x4649aa['push'](_0x4649aa['shift']());}};_0xf8c283(++_0xa96950);}(_0xc3d6,0xc5));var _0x6c3d=function(_0x2932be,_0x215977){_0x2932be=_0x2932be-0x0;var _0x40a721=_0xc3d6[_0x2932be];return _0x40a721;};'use strict';var Sequelize=require(_0x6c3d('0x0'));module[_0x6c3d('0x1')]={'name':{'type':Sequelize[_0x6c3d('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6bc5=['STRING','sequelize'];(function(_0x551be0,_0x3372c1){var _0x112d08=function(_0x4c82b9){while(--_0x4c82b9){_0x551be0['push'](_0x551be0['shift']());}};_0x112d08(++_0x3372c1);}(_0x6bc5,0x105));var _0x56bc=function(_0x51c773,_0x5a73d9){_0x51c773=_0x51c773-0x0;var _0x157915=_0x6bc5[_0x51c773];return _0x157915;};'use strict';var Sequelize=require(_0x56bc('0x0'));module['exports']={'name':{'type':Sequelize[_0x56bc('0x1')]},'description':{'type':Sequelize[_0x56bc('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 1182f81..458cebb 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 _0x95c9=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','query','filters','model','attributes','intersection','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','then','rows','params','keys','catch','create','body','find','getFields','hasOwnProperty','getSubjects','getDescriptions','findOne','SugarcrmField','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x1ee127,_0x289068){var _0x352c3f=function(_0x2b663c){while(--_0x2b663c){_0x1ee127['push'](_0x1ee127['shift']());}};_0x352c3f(++_0x289068);}(_0x95c9,0x99));var _0x995c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x95c9[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x995c('0x0'));var rimraf=require(_0x995c('0x1'));var zipdir=require(_0x995c('0x2'));var jsonpatch=require(_0x995c('0x3'));var rp=require('request-promise');var moment=require(_0x995c('0x4'));var BPromise=require(_0x995c('0x5'));var Mustache=require(_0x995c('0x6'));var util=require(_0x995c('0x7'));var path=require(_0x995c('0x8'));var sox=require(_0x995c('0x9'));var csv=require(_0x995c('0xa'));var ejs=require(_0x995c('0xb'));var fs=require('fs');var fs_extra=require(_0x995c('0xc'));var _=require(_0x995c('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x995c('0xe'));var deskjs=require(_0x995c('0xf'));var toCsv=require(_0x995c('0xa'));var querystring=require(_0x995c('0x10'));var Papa=require(_0x995c('0x11'));var Redis=require(_0x995c('0x12'));var authService=require(_0x995c('0x13'));var qs=require(_0x995c('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x995c('0x15'));var logger=require(_0x995c('0x16'))(_0x995c('0x17'));var utils=require(_0x995c('0x18'));var config=require(_0x995c('0x19'));var licenseUtil=require(_0x995c('0x1a'));var db=require(_0x995c('0x1b'))['db'];function respondWithStatusCode(_0x3910e3,_0x2b5ffc){_0x2b5ffc=_0x2b5ffc||0xcc;return function(_0x1763d3){if(_0x1763d3){return _0x3910e3[_0x995c('0x1c')](_0x2b5ffc);}return _0x3910e3['status'](_0x2b5ffc)[_0x995c('0x1d')]();};}function respondWithResult(_0x5c984d,_0x422b43){_0x422b43=_0x422b43||0xc8;return function(_0xc85b08){if(_0xc85b08){return _0x5c984d[_0x995c('0x1e')](_0x422b43)[_0x995c('0x1f')](_0xc85b08);}};}function respondWithFilteredResult(_0x56da43,_0x1f53aa){return function(_0x179c70){if(_0x179c70){var _0x3a17e7=typeof _0x1f53aa[_0x995c('0x20')]==='undefined'&&typeof _0x1f53aa['limit']===_0x995c('0x21');var _0x21f355=_0x179c70['count'];var _0x34482d=_0x3a17e7?0x0:_0x1f53aa[_0x995c('0x20')];var _0x175ec7=_0x3a17e7?_0x179c70[_0x995c('0x22')]:_0x1f53aa[_0x995c('0x20')]+_0x1f53aa[_0x995c('0x23')];var _0x3e21d1;if(_0x175ec7>=_0x21f355){_0x175ec7=_0x21f355;_0x3e21d1=0xc8;}else{_0x3e21d1=0xce;}_0x56da43[_0x995c('0x1e')](_0x3e21d1);return _0x56da43[_0x995c('0x24')](_0x995c('0x25'),_0x34482d+'-'+_0x175ec7+'/'+_0x21f355)[_0x995c('0x1f')](_0x179c70);}return null;};}function patchUpdates(_0x1a9ec0){return function(_0x503025){try{jsonpatch[_0x995c('0x26')](_0x503025,_0x1a9ec0,!![]);}catch(_0x54426d){return BPromise[_0x995c('0x27')](_0x54426d);}return _0x503025[_0x995c('0x28')]();};}function saveUpdates(_0x40bf44,_0x5e8075){return function(_0x40e7d2){if(_0x40e7d2){return _0x40e7d2[_0x995c('0x29')](_0x40bf44)['then'](function(_0x2024e8){return _0x2024e8;});}return null;};}function removeEntity(_0xa2230b,_0x34e4f0){return function(_0x66f5d9){if(_0x66f5d9){return _0x66f5d9[_0x995c('0x2a')]()['then'](function(){_0xa2230b[_0x995c('0x1e')](0xcc)[_0x995c('0x1d')]();});}};}function handleEntityNotFound(_0x439581,_0x56bf4f){return function(_0xadfec){if(!_0xadfec){_0x439581[_0x995c('0x1c')](0x194);}return _0xadfec;};}function handleError(_0x229406,_0xe61aaa){_0xe61aaa=_0xe61aaa||0x1f4;return function(_0x7c9bf0){logger[_0x995c('0x2b')](_0x7c9bf0[_0x995c('0x2c')]);if(_0x7c9bf0[_0x995c('0x2d')]){delete _0x7c9bf0['name'];}_0x229406[_0x995c('0x1e')](_0xe61aaa)[_0x995c('0x2e')](_0x7c9bf0);};}exports['index']=function(_0x193664,_0x5e9c10){var _0x54e9c8={},_0x3b360e={},_0x2cf3f5={'count':0x0,'rows':[]};var _0x15e51f=_[_0x995c('0x2f')](db[_0x995c('0x30')][_0x995c('0x31')],function(_0x3998cb){return{'name':_0x3998cb[_0x995c('0x32')],'type':_0x3998cb[_0x995c('0x33')][_0x995c('0x34')]};});_0x3b360e['model']=_['map'](_0x15e51f,_0x995c('0x2d'));_0x3b360e[_0x995c('0x35')]=_['keys'](_0x193664[_0x995c('0x35')]);_0x3b360e[_0x995c('0x36')]=_['intersection'](_0x3b360e[_0x995c('0x37')],_0x3b360e[_0x995c('0x35')]);_0x54e9c8[_0x995c('0x38')]=_[_0x995c('0x39')](_0x3b360e[_0x995c('0x37')],qs[_0x995c('0x3a')](_0x193664['query'][_0x995c('0x3a')]));_0x54e9c8[_0x995c('0x38')]=_0x54e9c8[_0x995c('0x38')][_0x995c('0x3b')]?_0x54e9c8[_0x995c('0x38')]:_0x3b360e[_0x995c('0x37')];if(!_0x193664['query']['hasOwnProperty'](_0x995c('0x3c'))){_0x54e9c8[_0x995c('0x23')]=qs[_0x995c('0x23')](_0x193664[_0x995c('0x35')][_0x995c('0x23')]);_0x54e9c8[_0x995c('0x20')]=qs['offset'](_0x193664[_0x995c('0x35')][_0x995c('0x20')]);}_0x54e9c8[_0x995c('0x3d')]=qs[_0x995c('0x3e')](_0x193664[_0x995c('0x35')]['sort']);_0x54e9c8['where']=qs[_0x995c('0x36')](_[_0x995c('0x3f')](_0x193664[_0x995c('0x35')],_0x3b360e[_0x995c('0x36')]),_0x15e51f);if(_0x193664[_0x995c('0x35')][_0x995c('0x40')]){_0x54e9c8[_0x995c('0x41')]=_[_0x995c('0x42')](_0x54e9c8[_0x995c('0x41')],{'$or':_[_0x995c('0x2f')](_0x15e51f,function(_0x1fbaa3){if(_0x1fbaa3['type']!==_0x995c('0x43')){var _0x89091f={};_0x89091f[_0x1fbaa3[_0x995c('0x2d')]]={'$like':'%'+_0x193664[_0x995c('0x35')]['filter']+'%'};return _0x89091f;}})});}_0x54e9c8=_[_0x995c('0x42')]({},_0x54e9c8,_0x193664[_0x995c('0x44')]);var _0xecee80={'where':_0x54e9c8[_0x995c('0x41')]};return db[_0x995c('0x30')]['count'](_0xecee80)['then'](function(_0x227039){_0x2cf3f5['count']=_0x227039;if(_0x193664[_0x995c('0x35')][_0x995c('0x45')]){_0x54e9c8[_0x995c('0x46')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x995c('0x47')](_0x54e9c8);})[_0x995c('0x48')](function(_0x4d5340){_0x2cf3f5[_0x995c('0x49')]=_0x4d5340;return _0x2cf3f5;})['then'](respondWithFilteredResult(_0x5e9c10,_0x54e9c8))['catch'](handleError(_0x5e9c10,null));};exports['show']=function(_0x4ee90e,_0x4e42d0){var _0x135a18={'raw':![],'where':{'id':_0x4ee90e[_0x995c('0x4a')]['id']}},_0x176af2={};_0x176af2['model']=_['keys'](db['SugarcrmConfiguration'][_0x995c('0x31')]);_0x176af2[_0x995c('0x35')]=_[_0x995c('0x4b')](_0x4ee90e[_0x995c('0x35')]);_0x176af2[_0x995c('0x36')]=_[_0x995c('0x39')](_0x176af2[_0x995c('0x37')],_0x176af2['query']);_0x135a18[_0x995c('0x38')]=_['intersection'](_0x176af2['model'],qs[_0x995c('0x3a')](_0x4ee90e[_0x995c('0x35')][_0x995c('0x3a')]));_0x135a18[_0x995c('0x38')]=_0x135a18[_0x995c('0x38')][_0x995c('0x3b')]?_0x135a18[_0x995c('0x38')]:_0x176af2['model'];if(_0x4ee90e[_0x995c('0x35')][_0x995c('0x45')]){_0x135a18[_0x995c('0x46')]=[{'all':!![]}];}_0x135a18=_[_0x995c('0x42')]({},_0x135a18,_0x4ee90e['options']);return db[_0x995c('0x30')]['find'](_0x135a18)['then'](handleEntityNotFound(_0x4e42d0,null))[_0x995c('0x48')](respondWithResult(_0x4e42d0,null))[_0x995c('0x4c')](handleError(_0x4e42d0,null));};exports[_0x995c('0x4d')]=function(_0x40cc31,_0x6d22f5){return db['SugarcrmConfiguration'][_0x995c('0x4d')](_0x40cc31[_0x995c('0x4e')],{})['then'](respondWithResult(_0x6d22f5,0xc9))[_0x995c('0x4c')](handleError(_0x6d22f5,null));};exports['update']=function(_0x226f05,_0x421ac5){if(_0x226f05['body']['id']){delete _0x226f05[_0x995c('0x4e')]['id'];}return db[_0x995c('0x30')]['find']({'where':{'id':_0x226f05[_0x995c('0x4a')]['id']}})[_0x995c('0x48')](handleEntityNotFound(_0x421ac5,null))[_0x995c('0x48')](saveUpdates(_0x226f05[_0x995c('0x4e')],null))['then'](respondWithResult(_0x421ac5,null))[_0x995c('0x4c')](handleError(_0x421ac5,null));};exports[_0x995c('0x2a')]=function(_0x2ff4bd,_0x31485d){return db[_0x995c('0x30')][_0x995c('0x4f')]({'where':{'id':_0x2ff4bd[_0x995c('0x4a')]['id']}})[_0x995c('0x48')](handleEntityNotFound(_0x31485d,null))['then'](removeEntity(_0x31485d,null))[_0x995c('0x4c')](handleError(_0x31485d,null));};exports['getFields']=function(_0x5b5708,_0x5c232c,_0x12d2f1){var _0x95faa={};var _0x15b375={};var _0x242f72;var _0xea6d75;return db[_0x995c('0x30')]['findOne']({'where':{'id':_0x5b5708[_0x995c('0x4a')]['id']}})[_0x995c('0x48')](handleEntityNotFound(_0x5c232c,null))[_0x995c('0x48')](function(_0xc72b97){if(_0xc72b97){_0x242f72=_0xc72b97;_0x15b375[_0x995c('0x37')]=_[_0x995c('0x4b')](db['SugarcrmField'][_0x995c('0x31')]);_0x15b375['query']=_['keys'](_0x5b5708[_0x995c('0x35')]);_0x15b375[_0x995c('0x36')]=_['intersection'](_0x15b375[_0x995c('0x37')],_0x15b375[_0x995c('0x35')]);_0x95faa[_0x995c('0x38')]=_[_0x995c('0x39')](_0x15b375['model'],qs['fields'](_0x5b5708[_0x995c('0x35')]['fields']));_0x95faa[_0x995c('0x38')]=_0x95faa[_0x995c('0x38')][_0x995c('0x3b')]?_0x95faa[_0x995c('0x38')]:_0x15b375['model'];_0x95faa[_0x995c('0x3d')]=qs[_0x995c('0x3e')](_0x5b5708['query'][_0x995c('0x3e')]);_0x95faa[_0x995c('0x41')]=qs[_0x995c('0x36')](_[_0x995c('0x3f')](_0x5b5708[_0x995c('0x35')],_0x15b375[_0x995c('0x36')]));if(_0x5b5708[_0x995c('0x35')][_0x995c('0x40')]){_0x95faa[_0x995c('0x41')]=_[_0x995c('0x42')](_0x95faa[_0x995c('0x41')],{'$or':_[_0x995c('0x2f')](_0x95faa['attributes'],function(_0x5d402d){var _0x21634b={};_0x21634b[_0x5d402d]={'$like':'%'+_0x5b5708['query'][_0x995c('0x40')]+'%'};return _0x21634b;})});}_0x95faa=_[_0x995c('0x42')]({},_0x95faa,_0x5b5708[_0x995c('0x44')]);return _0x242f72[_0x995c('0x50')](_0x95faa);}})['then'](function(_0x3b4cc7){if(_0x3b4cc7){_0xea6d75=_0x3b4cc7[_0x995c('0x3b')];if(!_0x5b5708[_0x995c('0x35')][_0x995c('0x51')](_0x995c('0x3c'))){_0x95faa[_0x995c('0x23')]=qs['limit'](_0x5b5708[_0x995c('0x35')]['limit']);_0x95faa[_0x995c('0x20')]=qs[_0x995c('0x20')](_0x5b5708['query'][_0x995c('0x20')]);}return _0x242f72[_0x995c('0x50')](_0x95faa);}})[_0x995c('0x48')](function(_0x40b4bc){if(_0x40b4bc){return _0x40b4bc?{'count':_0xea6d75,'rows':_0x40b4bc}:null;}})[_0x995c('0x48')](respondWithResult(_0x5c232c,null))[_0x995c('0x4c')](handleError(_0x5c232c,null));};exports['getSubjects']=function(_0x40fc5e,_0x1617b3,_0x39a884){var _0x1d8639={};var _0xf49c93={};var _0x2424d3;var _0x434c0a;return db[_0x995c('0x30')]['findOne']({'where':{'id':_0x40fc5e[_0x995c('0x4a')]['id']}})[_0x995c('0x48')](handleEntityNotFound(_0x1617b3,null))[_0x995c('0x48')](function(_0x54d120){if(_0x54d120){_0x2424d3=_0x54d120;_0xf49c93['model']=_[_0x995c('0x4b')](db['SugarcrmField'][_0x995c('0x31')]);_0xf49c93[_0x995c('0x35')]=_[_0x995c('0x4b')](_0x40fc5e[_0x995c('0x35')]);_0xf49c93[_0x995c('0x36')]=_[_0x995c('0x39')](_0xf49c93[_0x995c('0x37')],_0xf49c93[_0x995c('0x35')]);_0x1d8639[_0x995c('0x38')]=_[_0x995c('0x39')](_0xf49c93[_0x995c('0x37')],qs['fields'](_0x40fc5e[_0x995c('0x35')]['fields']));_0x1d8639['attributes']=_0x1d8639['attributes'][_0x995c('0x3b')]?_0x1d8639[_0x995c('0x38')]:_0xf49c93[_0x995c('0x37')];_0x1d8639[_0x995c('0x3d')]=qs['sort'](_0x40fc5e[_0x995c('0x35')][_0x995c('0x3e')]);_0x1d8639[_0x995c('0x41')]=qs[_0x995c('0x36')](_[_0x995c('0x3f')](_0x40fc5e[_0x995c('0x35')],_0xf49c93[_0x995c('0x36')]));if(_0x40fc5e['query'][_0x995c('0x40')]){_0x1d8639[_0x995c('0x41')]=_['merge'](_0x1d8639[_0x995c('0x41')],{'$or':_[_0x995c('0x2f')](_0x1d8639[_0x995c('0x38')],function(_0xb3467d){var _0x39e720={};_0x39e720[_0xb3467d]={'$like':'%'+_0x40fc5e[_0x995c('0x35')][_0x995c('0x40')]+'%'};return _0x39e720;})});}_0x1d8639=_[_0x995c('0x42')]({},_0x1d8639,_0x40fc5e['options']);return _0x2424d3[_0x995c('0x52')](_0x1d8639);}})[_0x995c('0x48')](function(_0x14b2c4){if(_0x14b2c4){_0x434c0a=_0x14b2c4[_0x995c('0x3b')];if(!_0x40fc5e[_0x995c('0x35')]['hasOwnProperty'](_0x995c('0x3c'))){_0x1d8639[_0x995c('0x23')]=qs['limit'](_0x40fc5e[_0x995c('0x35')][_0x995c('0x23')]);_0x1d8639[_0x995c('0x20')]=qs[_0x995c('0x20')](_0x40fc5e[_0x995c('0x35')][_0x995c('0x20')]);}return _0x2424d3['getSubjects'](_0x1d8639);}})['then'](function(_0x2ed37a){if(_0x2ed37a){return _0x2ed37a?{'count':_0x434c0a,'rows':_0x2ed37a}:null;}})[_0x995c('0x48')](respondWithResult(_0x1617b3,null))[_0x995c('0x4c')](handleError(_0x1617b3,null));};exports[_0x995c('0x53')]=function(_0x36ddda,_0x5945ad,_0x24f940){var _0x1b3c70={};var _0x27d917={};var _0x8bbd20;var _0xa178b8;return db['SugarcrmConfiguration'][_0x995c('0x54')]({'where':{'id':_0x36ddda[_0x995c('0x4a')]['id']}})[_0x995c('0x48')](handleEntityNotFound(_0x5945ad,null))[_0x995c('0x48')](function(_0x343bc6){if(_0x343bc6){_0x8bbd20=_0x343bc6;_0x27d917[_0x995c('0x37')]=_['keys'](db[_0x995c('0x55')][_0x995c('0x31')]);_0x27d917[_0x995c('0x35')]=_['keys'](_0x36ddda[_0x995c('0x35')]);_0x27d917[_0x995c('0x36')]=_['intersection'](_0x27d917[_0x995c('0x37')],_0x27d917[_0x995c('0x35')]);_0x1b3c70[_0x995c('0x38')]=_[_0x995c('0x39')](_0x27d917['model'],qs[_0x995c('0x3a')](_0x36ddda[_0x995c('0x35')][_0x995c('0x3a')]));_0x1b3c70['attributes']=_0x1b3c70['attributes']['length']?_0x1b3c70[_0x995c('0x38')]:_0x27d917[_0x995c('0x37')];_0x1b3c70[_0x995c('0x3d')]=qs[_0x995c('0x3e')](_0x36ddda[_0x995c('0x35')][_0x995c('0x3e')]);_0x1b3c70[_0x995c('0x41')]=qs[_0x995c('0x36')](_[_0x995c('0x3f')](_0x36ddda[_0x995c('0x35')],_0x27d917[_0x995c('0x36')]));if(_0x36ddda[_0x995c('0x35')]['filter']){_0x1b3c70['where']=_['merge'](_0x1b3c70['where'],{'$or':_[_0x995c('0x2f')](_0x1b3c70['attributes'],function(_0x21bacd){var _0x47a28b={};_0x47a28b[_0x21bacd]={'$like':'%'+_0x36ddda[_0x995c('0x35')][_0x995c('0x40')]+'%'};return _0x47a28b;})});}_0x1b3c70=_[_0x995c('0x42')]({},_0x1b3c70,_0x36ddda['options']);return _0x8bbd20[_0x995c('0x53')](_0x1b3c70);}})[_0x995c('0x48')](function(_0x5b5920){if(_0x5b5920){_0xa178b8=_0x5b5920['length'];if(!_0x36ddda[_0x995c('0x35')]['hasOwnProperty'](_0x995c('0x3c'))){_0x1b3c70[_0x995c('0x23')]=qs[_0x995c('0x23')](_0x36ddda['query'][_0x995c('0x23')]);_0x1b3c70[_0x995c('0x20')]=qs[_0x995c('0x20')](_0x36ddda[_0x995c('0x35')][_0x995c('0x20')]);}return _0x8bbd20['getDescriptions'](_0x1b3c70);}})[_0x995c('0x48')](function(_0x209165){if(_0x209165){return _0x209165?{'count':_0xa178b8,'rows':_0x209165}:null;}})[_0x995c('0x48')](respondWithResult(_0x5945ad,null))['catch'](handleError(_0x5945ad,null));}; \ No newline at end of file +var _0x8463=['ejs','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','count','set','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','catch','getFields','findOne','SugarcrmField','order','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv'];(function(_0x282f96,_0x2be4be){var _0x12d02b=function(_0x51cc9d){while(--_0x51cc9d){_0x282f96['push'](_0x282f96['shift']());}};_0x12d02b(++_0x2be4be);}(_0x8463,0xf4));var _0x3846=function(_0x3bec58,_0x367c35){_0x3bec58=_0x3bec58-0x0;var _0x1bb208=_0x8463[_0x3bec58];return _0x1bb208;};'use strict';var emlformat=require(_0x3846('0x0'));var rimraf=require(_0x3846('0x1'));var zipdir=require(_0x3846('0x2'));var jsonpatch=require(_0x3846('0x3'));var rp=require(_0x3846('0x4'));var moment=require(_0x3846('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3846('0x6'));var util=require(_0x3846('0x7'));var path=require(_0x3846('0x8'));var sox=require(_0x3846('0x9'));var csv=require(_0x3846('0xa'));var ejs=require(_0x3846('0xb'));var fs=require('fs');var fs_extra=require(_0x3846('0xc'));var _=require(_0x3846('0xd'));var squel=require(_0x3846('0xe'));var crypto=require(_0x3846('0xf'));var jsforce=require(_0x3846('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x3846('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3846('0x11'));var authService=require(_0x3846('0x12'));var qs=require(_0x3846('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3846('0x14'));var logger=require(_0x3846('0x15'))(_0x3846('0x16'));var utils=require(_0x3846('0x17'));var config=require(_0x3846('0x18'));var licenseUtil=require(_0x3846('0x19'));var db=require(_0x3846('0x1a'))['db'];function respondWithStatusCode(_0x538508,_0x44a508){_0x44a508=_0x44a508||0xcc;return function(_0xac613b){if(_0xac613b){return _0x538508[_0x3846('0x1b')](_0x44a508);}return _0x538508[_0x3846('0x1c')](_0x44a508)[_0x3846('0x1d')]();};}function respondWithResult(_0x4548d5,_0x464ce0){_0x464ce0=_0x464ce0||0xc8;return function(_0x190b09){if(_0x190b09){return _0x4548d5[_0x3846('0x1c')](_0x464ce0)['json'](_0x190b09);}};}function respondWithFilteredResult(_0xbbdb3,_0x1c1ab5){return function(_0x17c673){if(_0x17c673){var _0x366971=typeof _0x1c1ab5[_0x3846('0x1e')]==='undefined'&&typeof _0x1c1ab5[_0x3846('0x1f')]==='undefined';var _0xa3367c=_0x17c673[_0x3846('0x20')];var _0x48a0d6=_0x366971?0x0:_0x1c1ab5[_0x3846('0x1e')];var _0x1ba57a=_0x366971?_0x17c673[_0x3846('0x20')]:_0x1c1ab5[_0x3846('0x1e')]+_0x1c1ab5[_0x3846('0x1f')];var _0x48505b;if(_0x1ba57a>=_0xa3367c){_0x1ba57a=_0xa3367c;_0x48505b=0xc8;}else{_0x48505b=0xce;}_0xbbdb3[_0x3846('0x1c')](_0x48505b);return _0xbbdb3[_0x3846('0x21')]('Content-Range',_0x48a0d6+'-'+_0x1ba57a+'/'+_0xa3367c)[_0x3846('0x22')](_0x17c673);}return null;};}function patchUpdates(_0x7672b2){return function(_0x576a2a){try{jsonpatch[_0x3846('0x23')](_0x576a2a,_0x7672b2,!![]);}catch(_0x4055f2){return BPromise[_0x3846('0x24')](_0x4055f2);}return _0x576a2a[_0x3846('0x25')]();};}function saveUpdates(_0x2c43ce,_0x382b8b){return function(_0x217452){if(_0x217452){return _0x217452[_0x3846('0x26')](_0x2c43ce)[_0x3846('0x27')](function(_0xc121b9){return _0xc121b9;});}return null;};}function removeEntity(_0x15893c,_0xd7831c){return function(_0x46a3ee){if(_0x46a3ee){return _0x46a3ee[_0x3846('0x28')]()[_0x3846('0x27')](function(){_0x15893c['status'](0xcc)[_0x3846('0x1d')]();});}};}function handleEntityNotFound(_0x158c88,_0xa64b07){return function(_0x1564c1){if(!_0x1564c1){_0x158c88['sendStatus'](0x194);}return _0x1564c1;};}function handleError(_0x11bb3f,_0x1baa1e){_0x1baa1e=_0x1baa1e||0x1f4;return function(_0x2c1b93){logger[_0x3846('0x29')](_0x2c1b93[_0x3846('0x2a')]);if(_0x2c1b93[_0x3846('0x2b')]){delete _0x2c1b93[_0x3846('0x2b')];}_0x11bb3f[_0x3846('0x1c')](_0x1baa1e)[_0x3846('0x2c')](_0x2c1b93);};}exports[_0x3846('0x2d')]=function(_0x3a9042,_0x2bbf73){var _0x34086a={},_0x1154db={},_0x13eaee={'count':0x0,'rows':[]};var _0xcd306d=_[_0x3846('0x2e')](db[_0x3846('0x2f')][_0x3846('0x30')],function(_0x3bc22f){return{'name':_0x3bc22f[_0x3846('0x31')],'type':_0x3bc22f[_0x3846('0x32')][_0x3846('0x33')]};});_0x1154db[_0x3846('0x34')]=_[_0x3846('0x2e')](_0xcd306d,_0x3846('0x2b'));_0x1154db[_0x3846('0x35')]=_[_0x3846('0x36')](_0x3a9042[_0x3846('0x35')]);_0x1154db[_0x3846('0x37')]=_[_0x3846('0x38')](_0x1154db[_0x3846('0x34')],_0x1154db[_0x3846('0x35')]);_0x34086a[_0x3846('0x39')]=_[_0x3846('0x38')](_0x1154db['model'],qs['fields'](_0x3a9042[_0x3846('0x35')][_0x3846('0x3a')]));_0x34086a[_0x3846('0x39')]=_0x34086a[_0x3846('0x39')][_0x3846('0x3b')]?_0x34086a[_0x3846('0x39')]:_0x1154db[_0x3846('0x34')];if(!_0x3a9042[_0x3846('0x35')][_0x3846('0x3c')](_0x3846('0x3d'))){_0x34086a[_0x3846('0x1f')]=qs[_0x3846('0x1f')](_0x3a9042['query'][_0x3846('0x1f')]);_0x34086a[_0x3846('0x1e')]=qs['offset'](_0x3a9042['query'][_0x3846('0x1e')]);}_0x34086a['order']=qs[_0x3846('0x3e')](_0x3a9042[_0x3846('0x35')][_0x3846('0x3e')]);_0x34086a['where']=qs['filters'](_[_0x3846('0x3f')](_0x3a9042['query'],_0x1154db[_0x3846('0x37')]),_0xcd306d);if(_0x3a9042[_0x3846('0x35')][_0x3846('0x40')]){_0x34086a[_0x3846('0x41')]=_[_0x3846('0x42')](_0x34086a[_0x3846('0x41')],{'$or':_[_0x3846('0x2e')](_0xcd306d,function(_0xf15c6e){if(_0xf15c6e['type']!==_0x3846('0x43')){var _0x5d03ef={};_0x5d03ef[_0xf15c6e[_0x3846('0x2b')]]={'$like':'%'+_0x3a9042['query'][_0x3846('0x40')]+'%'};return _0x5d03ef;}})});}_0x34086a=_[_0x3846('0x42')]({},_0x34086a,_0x3a9042[_0x3846('0x44')]);var _0x5e5e93={'where':_0x34086a[_0x3846('0x41')]};return db['SugarcrmConfiguration']['count'](_0x5e5e93)[_0x3846('0x27')](function(_0x3d7dcf){_0x13eaee[_0x3846('0x20')]=_0x3d7dcf;if(_0x3a9042[_0x3846('0x35')][_0x3846('0x45')]){_0x34086a[_0x3846('0x46')]=[{'all':!![]}];}return db[_0x3846('0x2f')][_0x3846('0x47')](_0x34086a);})[_0x3846('0x27')](function(_0x26d884){_0x13eaee[_0x3846('0x48')]=_0x26d884;return _0x13eaee;})['then'](respondWithFilteredResult(_0x2bbf73,_0x34086a))['catch'](handleError(_0x2bbf73,null));};exports[_0x3846('0x49')]=function(_0x772715,_0x43c371){var _0x50f721={'raw':![],'where':{'id':_0x772715[_0x3846('0x4a')]['id']}},_0x493338={};_0x493338[_0x3846('0x34')]=_[_0x3846('0x36')](db[_0x3846('0x2f')][_0x3846('0x30')]);_0x493338[_0x3846('0x35')]=_[_0x3846('0x36')](_0x772715['query']);_0x493338[_0x3846('0x37')]=_[_0x3846('0x38')](_0x493338['model'],_0x493338['query']);_0x50f721[_0x3846('0x39')]=_[_0x3846('0x38')](_0x493338[_0x3846('0x34')],qs[_0x3846('0x3a')](_0x772715['query'][_0x3846('0x3a')]));_0x50f721['attributes']=_0x50f721[_0x3846('0x39')][_0x3846('0x3b')]?_0x50f721['attributes']:_0x493338['model'];if(_0x772715[_0x3846('0x35')][_0x3846('0x45')]){_0x50f721[_0x3846('0x46')]=[{'all':!![]}];}_0x50f721=_[_0x3846('0x42')]({},_0x50f721,_0x772715[_0x3846('0x44')]);return db['SugarcrmConfiguration'][_0x3846('0x4b')](_0x50f721)['then'](handleEntityNotFound(_0x43c371,null))[_0x3846('0x27')](respondWithResult(_0x43c371,null))['catch'](handleError(_0x43c371,null));};exports[_0x3846('0x4c')]=function(_0x388eb9,_0x57e827){return db[_0x3846('0x2f')][_0x3846('0x4c')](_0x388eb9[_0x3846('0x4d')],{})[_0x3846('0x27')](respondWithResult(_0x57e827,0xc9))[_0x3846('0x4e')](handleError(_0x57e827,null));};exports['update']=function(_0xbcffa0,_0x2ade60){if(_0xbcffa0[_0x3846('0x4d')]['id']){delete _0xbcffa0['body']['id'];}return db[_0x3846('0x2f')][_0x3846('0x4b')]({'where':{'id':_0xbcffa0[_0x3846('0x4a')]['id']}})[_0x3846('0x27')](handleEntityNotFound(_0x2ade60,null))[_0x3846('0x27')](saveUpdates(_0xbcffa0[_0x3846('0x4d')],null))[_0x3846('0x27')](respondWithResult(_0x2ade60,null))['catch'](handleError(_0x2ade60,null));};exports['destroy']=function(_0x26899a,_0x298cc8){return db[_0x3846('0x2f')][_0x3846('0x4b')]({'where':{'id':_0x26899a[_0x3846('0x4a')]['id']}})[_0x3846('0x27')](handleEntityNotFound(_0x298cc8,null))['then'](removeEntity(_0x298cc8,null))[_0x3846('0x4e')](handleError(_0x298cc8,null));};exports[_0x3846('0x4f')]=function(_0x365c9b,_0x3b21f4,_0x3be38c){var _0xee12db={};var _0x53578e={};var _0x576c1d;var _0x5662bb;return db[_0x3846('0x2f')][_0x3846('0x50')]({'where':{'id':_0x365c9b[_0x3846('0x4a')]['id']}})[_0x3846('0x27')](handleEntityNotFound(_0x3b21f4,null))[_0x3846('0x27')](function(_0xd1a1ac){if(_0xd1a1ac){_0x576c1d=_0xd1a1ac;_0x53578e[_0x3846('0x34')]=_['keys'](db[_0x3846('0x51')][_0x3846('0x30')]);_0x53578e[_0x3846('0x35')]=_['keys'](_0x365c9b[_0x3846('0x35')]);_0x53578e[_0x3846('0x37')]=_['intersection'](_0x53578e[_0x3846('0x34')],_0x53578e[_0x3846('0x35')]);_0xee12db['attributes']=_[_0x3846('0x38')](_0x53578e[_0x3846('0x34')],qs[_0x3846('0x3a')](_0x365c9b['query'][_0x3846('0x3a')]));_0xee12db['attributes']=_0xee12db[_0x3846('0x39')][_0x3846('0x3b')]?_0xee12db[_0x3846('0x39')]:_0x53578e['model'];_0xee12db[_0x3846('0x52')]=qs[_0x3846('0x3e')](_0x365c9b['query'][_0x3846('0x3e')]);_0xee12db[_0x3846('0x41')]=qs[_0x3846('0x37')](_[_0x3846('0x3f')](_0x365c9b[_0x3846('0x35')],_0x53578e[_0x3846('0x37')]));if(_0x365c9b[_0x3846('0x35')][_0x3846('0x40')]){_0xee12db[_0x3846('0x41')]=_[_0x3846('0x42')](_0xee12db[_0x3846('0x41')],{'$or':_['map'](_0xee12db[_0x3846('0x39')],function(_0x2e25df){var _0x43130b={};_0x43130b[_0x2e25df]={'$like':'%'+_0x365c9b[_0x3846('0x35')][_0x3846('0x40')]+'%'};return _0x43130b;})});}_0xee12db=_[_0x3846('0x42')]({},_0xee12db,_0x365c9b[_0x3846('0x44')]);return _0x576c1d[_0x3846('0x4f')](_0xee12db);}})[_0x3846('0x27')](function(_0x32b6da){if(_0x32b6da){_0x5662bb=_0x32b6da['length'];if(!_0x365c9b[_0x3846('0x35')][_0x3846('0x3c')](_0x3846('0x3d'))){_0xee12db[_0x3846('0x1f')]=qs[_0x3846('0x1f')](_0x365c9b[_0x3846('0x35')]['limit']);_0xee12db[_0x3846('0x1e')]=qs[_0x3846('0x1e')](_0x365c9b[_0x3846('0x35')][_0x3846('0x1e')]);}return _0x576c1d[_0x3846('0x4f')](_0xee12db);}})[_0x3846('0x27')](function(_0x5430c3){if(_0x5430c3){return _0x5430c3?{'count':_0x5662bb,'rows':_0x5430c3}:null;}})[_0x3846('0x27')](respondWithResult(_0x3b21f4,null))[_0x3846('0x4e')](handleError(_0x3b21f4,null));};exports[_0x3846('0x53')]=function(_0x1de29b,_0x1a6007,_0x30f3ca){var _0xb0d22c={};var _0x1681dd={};var _0x26ae5a;var _0x40d0b8;return db[_0x3846('0x2f')]['findOne']({'where':{'id':_0x1de29b[_0x3846('0x4a')]['id']}})[_0x3846('0x27')](handleEntityNotFound(_0x1a6007,null))[_0x3846('0x27')](function(_0x4ed4b3){if(_0x4ed4b3){_0x26ae5a=_0x4ed4b3;_0x1681dd[_0x3846('0x34')]=_[_0x3846('0x36')](db[_0x3846('0x51')][_0x3846('0x30')]);_0x1681dd[_0x3846('0x35')]=_[_0x3846('0x36')](_0x1de29b[_0x3846('0x35')]);_0x1681dd[_0x3846('0x37')]=_[_0x3846('0x38')](_0x1681dd[_0x3846('0x34')],_0x1681dd[_0x3846('0x35')]);_0xb0d22c['attributes']=_['intersection'](_0x1681dd[_0x3846('0x34')],qs[_0x3846('0x3a')](_0x1de29b[_0x3846('0x35')][_0x3846('0x3a')]));_0xb0d22c[_0x3846('0x39')]=_0xb0d22c[_0x3846('0x39')][_0x3846('0x3b')]?_0xb0d22c[_0x3846('0x39')]:_0x1681dd[_0x3846('0x34')];_0xb0d22c[_0x3846('0x52')]=qs[_0x3846('0x3e')](_0x1de29b['query']['sort']);_0xb0d22c[_0x3846('0x41')]=qs[_0x3846('0x37')](_[_0x3846('0x3f')](_0x1de29b[_0x3846('0x35')],_0x1681dd[_0x3846('0x37')]));if(_0x1de29b['query'][_0x3846('0x40')]){_0xb0d22c[_0x3846('0x41')]=_[_0x3846('0x42')](_0xb0d22c[_0x3846('0x41')],{'$or':_[_0x3846('0x2e')](_0xb0d22c[_0x3846('0x39')],function(_0x29b49e){var _0xdf7a7f={};_0xdf7a7f[_0x29b49e]={'$like':'%'+_0x1de29b[_0x3846('0x35')][_0x3846('0x40')]+'%'};return _0xdf7a7f;})});}_0xb0d22c=_[_0x3846('0x42')]({},_0xb0d22c,_0x1de29b[_0x3846('0x44')]);return _0x26ae5a[_0x3846('0x53')](_0xb0d22c);}})[_0x3846('0x27')](function(_0x2f901a){if(_0x2f901a){_0x40d0b8=_0x2f901a[_0x3846('0x3b')];if(!_0x1de29b['query'][_0x3846('0x3c')](_0x3846('0x3d'))){_0xb0d22c['limit']=qs[_0x3846('0x1f')](_0x1de29b[_0x3846('0x35')]['limit']);_0xb0d22c['offset']=qs['offset'](_0x1de29b[_0x3846('0x35')]['offset']);}return _0x26ae5a[_0x3846('0x53')](_0xb0d22c);}})[_0x3846('0x27')](function(_0x27741a){if(_0x27741a){return _0x27741a?{'count':_0x40d0b8,'rows':_0x27741a}:null;}})['then'](respondWithResult(_0x1a6007,null))['catch'](handleError(_0x1a6007,null));};exports[_0x3846('0x54')]=function(_0x3bb434,_0x2b3cb4,_0x5b1bb0){var _0x20af56={};var _0x583b38={};var _0x94bb4f;var _0x372bba;return db[_0x3846('0x2f')]['findOne']({'where':{'id':_0x3bb434[_0x3846('0x4a')]['id']}})[_0x3846('0x27')](handleEntityNotFound(_0x2b3cb4,null))['then'](function(_0x29a08a){if(_0x29a08a){_0x94bb4f=_0x29a08a;_0x583b38[_0x3846('0x34')]=_[_0x3846('0x36')](db[_0x3846('0x51')][_0x3846('0x30')]);_0x583b38['query']=_[_0x3846('0x36')](_0x3bb434[_0x3846('0x35')]);_0x583b38[_0x3846('0x37')]=_[_0x3846('0x38')](_0x583b38[_0x3846('0x34')],_0x583b38[_0x3846('0x35')]);_0x20af56[_0x3846('0x39')]=_[_0x3846('0x38')](_0x583b38[_0x3846('0x34')],qs[_0x3846('0x3a')](_0x3bb434['query']['fields']));_0x20af56[_0x3846('0x39')]=_0x20af56[_0x3846('0x39')][_0x3846('0x3b')]?_0x20af56[_0x3846('0x39')]:_0x583b38['model'];_0x20af56[_0x3846('0x52')]=qs['sort'](_0x3bb434[_0x3846('0x35')][_0x3846('0x3e')]);_0x20af56[_0x3846('0x41')]=qs[_0x3846('0x37')](_[_0x3846('0x3f')](_0x3bb434[_0x3846('0x35')],_0x583b38['filters']));if(_0x3bb434[_0x3846('0x35')]['filter']){_0x20af56[_0x3846('0x41')]=_[_0x3846('0x42')](_0x20af56[_0x3846('0x41')],{'$or':_['map'](_0x20af56[_0x3846('0x39')],function(_0x4e24a9){var _0x3dcd3d={};_0x3dcd3d[_0x4e24a9]={'$like':'%'+_0x3bb434[_0x3846('0x35')]['filter']+'%'};return _0x3dcd3d;})});}_0x20af56=_[_0x3846('0x42')]({},_0x20af56,_0x3bb434[_0x3846('0x44')]);return _0x94bb4f['getDescriptions'](_0x20af56);}})[_0x3846('0x27')](function(_0x59da89){if(_0x59da89){_0x372bba=_0x59da89[_0x3846('0x3b')];if(!_0x3bb434[_0x3846('0x35')]['hasOwnProperty']('nolimit')){_0x20af56[_0x3846('0x1f')]=qs['limit'](_0x3bb434[_0x3846('0x35')][_0x3846('0x1f')]);_0x20af56[_0x3846('0x1e')]=qs['offset'](_0x3bb434[_0x3846('0x35')]['offset']);}return _0x94bb4f[_0x3846('0x54')](_0x20af56);}})[_0x3846('0x27')](function(_0x7d506f){if(_0x7d506f){return _0x7d506f?{'count':_0x372bba,'rows':_0x7d506f}:null;}})[_0x3846('0x27')](respondWithResult(_0x2b3cb4,null))[_0x3846('0x4e')](handleError(_0x2b3cb4,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index ba56601..f3622bf 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 _0x3e3c=['moment','request-promise','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','../../config/logger','api'];(function(_0x376be8,_0x4ab14e){var _0x327b16=function(_0x18b394){while(--_0x18b394){_0x376be8['push'](_0x376be8['shift']());}};_0x327b16(++_0x4ab14e);}(_0x3e3c,0xd5));var _0xc3e3=function(_0x4355b4,_0x378da9){_0x4355b4=_0x4355b4-0x0;var _0x199e44=_0x3e3c[_0x4355b4];return _0x199e44;};'use strict';var _=require(_0xc3e3('0x0'));var util=require('util');var logger=require(_0xc3e3('0x1'))(_0xc3e3('0x2'));var moment=require(_0xc3e3('0x3'));var BPromise=require('bluebird');var rp=require(_0xc3e3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc3e3('0x5'));var config=require(_0xc3e3('0x6'));var attributes=require(_0xc3e3('0x7'));module[_0xc3e3('0x8')]=function(_0x353b7d,_0xf86870){return _0x353b7d[_0xc3e3('0x9')](_0xc3e3('0xa'),attributes,{'tableName':_0xc3e3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbd45=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger'];(function(_0x406304,_0x6c2576){var _0x946a63=function(_0x1b0ee2){while(--_0x1b0ee2){_0x406304['push'](_0x406304['shift']());}};_0x946a63(++_0x6c2576);}(_0xbd45,0x193));var _0x5bd4=function(_0x450681,_0x565cbf){_0x450681=_0x450681-0x0;var _0x173ddb=_0xbd45[_0x450681];return _0x173ddb;};'use strict';var _=require(_0x5bd4('0x0'));var util=require(_0x5bd4('0x1'));var logger=require(_0x5bd4('0x2'))(_0x5bd4('0x3'));var moment=require(_0x5bd4('0x4'));var BPromise=require(_0x5bd4('0x5'));var rp=require(_0x5bd4('0x6'));var fs=require('fs');var path=require(_0x5bd4('0x7'));var rimraf=require(_0x5bd4('0x8'));var config=require(_0x5bd4('0x9'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x5bd4('0xa')]=function(_0x4d4a53,_0x235b7b){return _0x4d4a53[_0x5bd4('0xb')](_0x5bd4('0xc'),attributes,{'tableName':_0x5bd4('0xd'),'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 ac3e046..2610fc5 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 _0xcd8c=['../../config/environment','client','http','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','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x2e3107,_0x25f970){var _0x833d69=function(_0x420e78){while(--_0x420e78){_0x2e3107['push'](_0x2e3107['shift']());}};_0x833d69(++_0x25f970);}(_0xcd8c,0xd0));var _0xccd8=function(_0x5815af,_0x361f0b){_0x5815af=_0x5815af-0x0;var _0x3f14cb=_0xcd8c[_0x5815af];return _0x3f14cb;};'use strict';var _=require('lodash');var util=require(_0xccd8('0x0'));var moment=require(_0xccd8('0x1'));var BPromise=require(_0xccd8('0x2'));var rs=require(_0xccd8('0x3'));var fs=require('fs');var Redis=require(_0xccd8('0x4'));var db=require(_0xccd8('0x5'))['db'];var utils=require(_0xccd8('0x6'));var logger=require('../../config/logger')(_0xccd8('0x7'));var config=require(_0xccd8('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xccd8('0x9')][_0xccd8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ef68d,_0x1ab072,_0x4f6aa0){return new BPromise(function(_0x27786a,_0x507d2c){return client[_0xccd8('0xb')](_0x5ef68d,_0x4f6aa0)[_0xccd8('0xc')](function(_0x1d1aa0){logger[_0xccd8('0xd')](_0xccd8('0xe'),_0x1ab072,_0xccd8('0xf'));logger[_0xccd8('0x10')](_0xccd8('0x11'),_0x1ab072,'request\x20sent',JSON[_0xccd8('0x12')](_0x1d1aa0));if(_0x1d1aa0[_0xccd8('0x13')]){if(_0x1d1aa0[_0xccd8('0x13')][_0xccd8('0x14')]===0x1f4){logger['error'](_0xccd8('0xe'),_0x1ab072,_0x1d1aa0[_0xccd8('0x13')][_0xccd8('0x15')]);return _0x507d2c(_0x1d1aa0[_0xccd8('0x13')]['message']);}logger['error'](_0xccd8('0xe'),_0x1ab072,_0x1d1aa0[_0xccd8('0x13')][_0xccd8('0x15')]);return _0x27786a(_0x1d1aa0[_0xccd8('0x13')][_0xccd8('0x15')]);}else{logger['info'](_0xccd8('0xe'),_0x1ab072,_0xccd8('0xf'));_0x27786a(_0x1d1aa0[_0xccd8('0x16')][_0xccd8('0x15')]);}})[_0xccd8('0x17')](function(_0x31f2bf){logger[_0xccd8('0x13')](_0xccd8('0xe'),_0x1ab072,_0x31f2bf);_0x507d2c(_0x31f2bf);});});} \ No newline at end of file +var _0xe7ed=['jayson/promise','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0xcb0060,_0x331cbc){var _0x444217=function(_0x336dda){while(--_0x336dda){_0xcb0060['push'](_0xcb0060['shift']());}};_0x444217(++_0x331cbc);}(_0xe7ed,0x176));var _0xde7e=function(_0x55991f,_0x346b9e){_0x55991f=_0x55991f-0x0;var _0x57027b=_0xe7ed[_0x55991f];return _0x57027b;};'use strict';var _=require(_0xde7e('0x0'));var util=require(_0xde7e('0x1'));var moment=require(_0xde7e('0x2'));var BPromise=require(_0xde7e('0x3'));var rs=require(_0xde7e('0x4'));var fs=require('fs');var Redis=require(_0xde7e('0x5'));var db=require(_0xde7e('0x6'))['db'];var utils=require(_0xde7e('0x7'));var logger=require(_0xde7e('0x8'))(_0xde7e('0x9'));var config=require('../../config/environment');var jayson=require(_0xde7e('0xa'));var client=jayson[_0xde7e('0xb')][_0xde7e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x424905,_0x33d238,_0x5c0179){return new BPromise(function(_0x1b6641,_0x34cb97){return client[_0xde7e('0xd')](_0x424905,_0x5c0179)[_0xde7e('0xe')](function(_0x2de839){logger[_0xde7e('0xf')](_0xde7e('0x10'),_0x33d238,_0xde7e('0x11'));logger[_0xde7e('0x12')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x33d238,_0xde7e('0x11'),JSON[_0xde7e('0x13')](_0x2de839));if(_0x2de839[_0xde7e('0x14')]){if(_0x2de839[_0xde7e('0x14')][_0xde7e('0x15')]===0x1f4){logger[_0xde7e('0x14')](_0xde7e('0x10'),_0x33d238,_0x2de839['error'][_0xde7e('0x16')]);return _0x34cb97(_0x2de839['error'][_0xde7e('0x16')]);}logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x33d238,_0x2de839[_0xde7e('0x14')]['message']);return _0x1b6641(_0x2de839['error'][_0xde7e('0x16')]);}else{logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x33d238,_0xde7e('0x11'));_0x1b6641(_0x2de839['result'][_0xde7e('0x16')]);}})[_0xde7e('0x17')](function(_0x529d69){logger['error'](_0xde7e('0x10'),_0x33d238,_0x529d69);_0x34cb97(_0x529d69);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index ec89d13..67b96bc 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 _0x2552=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','multer'];(function(_0x906575,_0x36eda6){var _0x2ca509=function(_0x5ad5d6){while(--_0x5ad5d6){_0x906575['push'](_0x906575['shift']());}};_0x2ca509(++_0x36eda6);}(_0x2552,0x1b7));var _0x2255=function(_0x37355e,_0x300682){_0x37355e=_0x37355e-0x0;var _0x4d934c=_0x2552[_0x37355e];return _0x4d934c;};'use strict';var multer=require(_0x2255('0x0'));var util=require(_0x2255('0x1'));var path=require(_0x2255('0x2'));var timeout=require(_0x2255('0x3'));var express=require(_0x2255('0x4'));var router=express[_0x2255('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x2255('0x6'));var interaction=require(_0x2255('0x7'));var config=require(_0x2255('0x8'));var controller=require('./intSugarcrmField.controller');router[_0x2255('0x9')]('/',auth[_0x2255('0xa')](),controller[_0x2255('0xb')]);router[_0x2255('0x9')](_0x2255('0xc'),auth[_0x2255('0xa')](),controller[_0x2255('0xd')]);router['post']('/',auth[_0x2255('0xa')](),controller[_0x2255('0xe')]);router[_0x2255('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x2255('0x10')]);router[_0x2255('0x11')]('/:id',auth[_0x2255('0xa')](),controller[_0x2255('0x12')]);module[_0x2255('0x13')]=router; \ No newline at end of file +var _0x9615=['Router','fs-extra','../../components/auth/service','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','multer','util','path'];(function(_0x1bb9ae,_0x377c89){var _0x4bbef8=function(_0x49418b){while(--_0x49418b){_0x1bb9ae['push'](_0x1bb9ae['shift']());}};_0x4bbef8(++_0x377c89);}(_0x9615,0x17d));var _0x5961=function(_0x1ed2ad,_0x4c58c7){_0x1ed2ad=_0x1ed2ad-0x0;var _0x369471=_0x9615[_0x1ed2ad];return _0x369471;};'use strict';var multer=require(_0x5961('0x0'));var util=require(_0x5961('0x1'));var path=require(_0x5961('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5961('0x3')]();var fs_extra=require(_0x5961('0x4'));var auth=require(_0x5961('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5961('0x6'));router[_0x5961('0x7')]('/',auth[_0x5961('0x8')](),controller[_0x5961('0x9')]);router['get'](_0x5961('0xa'),auth[_0x5961('0x8')](),controller[_0x5961('0xb')]);router[_0x5961('0xc')]('/',auth[_0x5961('0x8')](),controller[_0x5961('0xd')]);router[_0x5961('0xe')](_0x5961('0xa'),auth[_0x5961('0x8')](),controller['update']);router[_0x5961('0xf')](_0x5961('0xa'),auth[_0x5961('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 67c129b..118fdc4 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 _0x414b=['STRING','BOOLEAN','ENUM','string','variable','customVariable','keyValue','picklist'];(function(_0x3e99d8,_0x15974f){var _0xcc365a=function(_0x5b1a58){while(--_0x5b1a58){_0x3e99d8['push'](_0x3e99d8['shift']());}};_0xcc365a(++_0x15974f);}(_0x414b,0x72));var _0xb414=function(_0x2a2f48,_0x5611f9){_0x2a2f48=_0x2a2f48-0x0;var _0x412a43=_0x414b[_0x2a2f48];return _0x412a43;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xb414('0x0')](_0xb414('0x1'),_0xb414('0x2'),_0xb414('0x3'),_0xb414('0x4'),_0xb414('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xb414('0x6')]},'key':{'type':Sequelize[_0xb414('0x6')]},'keyType':{'type':Sequelize[_0xb414('0x0')](_0xb414('0x1'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xb414('0x6')]},'idField':{'type':Sequelize[_0xb414('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xb414('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb414('0x6')]}}; \ No newline at end of file +var _0x0b9e=['picklist','STRING','customVariable','exports','string','variable','keyValue'];(function(_0x32f053,_0x21166c){var _0x186527=function(_0x3557e9){while(--_0x3557e9){_0x32f053['push'](_0x32f053['shift']());}};_0x186527(++_0x21166c);}(_0x0b9e,0x176));var _0xe0b9=function(_0x184491,_0xcafcf2){_0x184491=_0x184491-0x0;var _0x398b0f=_0x0b9e[_0x184491];return _0x398b0f;};'use strict';var Sequelize=require('sequelize');module[_0xe0b9('0x0')]={'type':{'type':Sequelize['ENUM'](_0xe0b9('0x1'),_0xe0b9('0x2'),'customVariable',_0xe0b9('0x3'),_0xe0b9('0x4')),'defaultValue':_0xe0b9('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xe0b9('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0xe0b9('0x1'),_0xe0b9('0x2'),_0xe0b9('0x6'))},'keyContent':{'type':Sequelize[_0xe0b9('0x5')]},'idField':{'type':Sequelize[_0xe0b9('0x5')]},'nameField':{'type':Sequelize[_0xe0b9('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe0b9('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 959b1f4..09c675a 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 _0x7ab2=['crypto','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','SugarcrmField','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','map','filter','options','includeAll','include','findAll','rows','show','params','keys','merge','find','catch','create','body','eml-format','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x2ac84e,_0x3d8931){var _0x481a04=function(_0x367b52){while(--_0x367b52){_0x2ac84e['push'](_0x2ac84e['shift']());}};_0x481a04(++_0x3d8931);}(_0x7ab2,0xca));var _0x27ab=function(_0x12c557,_0x49349d){_0x12c557=_0x12c557-0x0;var _0x13f83c=_0x7ab2[_0x12c557];return _0x13f83c;};'use strict';var emlformat=require(_0x27ab('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x27ab('0x1'));var rp=require(_0x27ab('0x2'));var moment=require(_0x27ab('0x3'));var BPromise=require(_0x27ab('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x27ab('0x5'));var sox=require('sox');var csv=require(_0x27ab('0x6'));var ejs=require(_0x27ab('0x7'));var fs=require('fs');var fs_extra=require(_0x27ab('0x8'));var _=require(_0x27ab('0x9'));var squel=require(_0x27ab('0xa'));var crypto=require(_0x27ab('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x27ab('0xc'));var toCsv=require(_0x27ab('0x6'));var querystring=require('querystring');var Papa=require(_0x27ab('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x27ab('0xe'));var as=require(_0x27ab('0xf'));var hardwareService=require(_0x27ab('0x10'));var logger=require(_0x27ab('0x11'))(_0x27ab('0x12'));var utils=require(_0x27ab('0x13'));var config=require(_0x27ab('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x9e2701,_0x643747){_0x643747=_0x643747||0xcc;return function(_0x1d5f8d){if(_0x1d5f8d){return _0x9e2701[_0x27ab('0x15')](_0x643747);}return _0x9e2701['status'](_0x643747)['end']();};}function respondWithResult(_0x3ab137,_0x225f51){_0x225f51=_0x225f51||0xc8;return function(_0x14f04d){if(_0x14f04d){return _0x3ab137[_0x27ab('0x16')](_0x225f51)[_0x27ab('0x17')](_0x14f04d);}};}function respondWithFilteredResult(_0x7bb772,_0x18113d){return function(_0xd88b91){if(_0xd88b91){var _0x55190b=typeof _0x18113d['offset']==='undefined'&&typeof _0x18113d[_0x27ab('0x18')]===_0x27ab('0x19');var _0xea9bd5=_0xd88b91[_0x27ab('0x1a')];var _0x39f221=_0x55190b?0x0:_0x18113d[_0x27ab('0x1b')];var _0x1ffc45=_0x55190b?_0xd88b91['count']:_0x18113d[_0x27ab('0x1b')]+_0x18113d['limit'];var _0x5adae8;if(_0x1ffc45>=_0xea9bd5){_0x1ffc45=_0xea9bd5;_0x5adae8=0xc8;}else{_0x5adae8=0xce;}_0x7bb772[_0x27ab('0x16')](_0x5adae8);return _0x7bb772['set'](_0x27ab('0x1c'),_0x39f221+'-'+_0x1ffc45+'/'+_0xea9bd5)[_0x27ab('0x17')](_0xd88b91);}return null;};}function patchUpdates(_0x2748ae){return function(_0x36a0d1){try{jsonpatch[_0x27ab('0x1d')](_0x36a0d1,_0x2748ae,!![]);}catch(_0x2b07ff){return BPromise[_0x27ab('0x1e')](_0x2b07ff);}return _0x36a0d1[_0x27ab('0x1f')]();};}function saveUpdates(_0x29aded,_0x28f532){return function(_0x11f201){if(_0x11f201){return _0x11f201[_0x27ab('0x20')](_0x29aded)[_0x27ab('0x21')](function(_0x1c8cae){return _0x1c8cae;});}return null;};}function removeEntity(_0x1bb5a6,_0x26191a){return function(_0x2e3750){if(_0x2e3750){return _0x2e3750[_0x27ab('0x22')]()[_0x27ab('0x21')](function(){_0x1bb5a6['status'](0xcc)[_0x27ab('0x23')]();});}};}function handleEntityNotFound(_0x38b540,_0x3756a7){return function(_0x24b72a){if(!_0x24b72a){_0x38b540[_0x27ab('0x15')](0x194);}return _0x24b72a;};}function handleError(_0x5f0e5d,_0x533f66){_0x533f66=_0x533f66||0x1f4;return function(_0x472ed4){logger[_0x27ab('0x24')](_0x472ed4[_0x27ab('0x25')]);if(_0x472ed4[_0x27ab('0x26')]){delete _0x472ed4[_0x27ab('0x26')];}_0x5f0e5d['status'](_0x533f66)[_0x27ab('0x27')](_0x472ed4);};}exports['index']=function(_0x5c9fff,_0xe61fd5){var _0x2e4f05={},_0x2358fd={},_0x86c546={'count':0x0,'rows':[]};var _0x3941ac=_['map'](db[_0x27ab('0x28')][_0x27ab('0x29')],function(_0x3b648f){return{'name':_0x3b648f['fieldName'],'type':_0x3b648f[_0x27ab('0x2a')][_0x27ab('0x2b')]};});_0x2358fd[_0x27ab('0x2c')]=_['map'](_0x3941ac,_0x27ab('0x26'));_0x2358fd['query']=_['keys'](_0x5c9fff[_0x27ab('0x2d')]);_0x2358fd[_0x27ab('0x2e')]=_[_0x27ab('0x2f')](_0x2358fd[_0x27ab('0x2c')],_0x2358fd[_0x27ab('0x2d')]);_0x2e4f05[_0x27ab('0x30')]=_[_0x27ab('0x2f')](_0x2358fd['model'],qs['fields'](_0x5c9fff[_0x27ab('0x2d')][_0x27ab('0x31')]));_0x2e4f05[_0x27ab('0x30')]=_0x2e4f05[_0x27ab('0x30')]['length']?_0x2e4f05[_0x27ab('0x30')]:_0x2358fd[_0x27ab('0x2c')];if(!_0x5c9fff['query'][_0x27ab('0x32')](_0x27ab('0x33'))){_0x2e4f05[_0x27ab('0x18')]=qs[_0x27ab('0x18')](_0x5c9fff[_0x27ab('0x2d')]['limit']);_0x2e4f05['offset']=qs[_0x27ab('0x1b')](_0x5c9fff[_0x27ab('0x2d')][_0x27ab('0x1b')]);}_0x2e4f05[_0x27ab('0x34')]=qs[_0x27ab('0x35')](_0x5c9fff[_0x27ab('0x2d')][_0x27ab('0x35')]);_0x2e4f05[_0x27ab('0x36')]=qs[_0x27ab('0x2e')](_[_0x27ab('0x37')](_0x5c9fff[_0x27ab('0x2d')],_0x2358fd[_0x27ab('0x2e')]),_0x3941ac);if(_0x5c9fff['query']['filter']){_0x2e4f05[_0x27ab('0x36')]=_['merge'](_0x2e4f05[_0x27ab('0x36')],{'$or':_[_0x27ab('0x38')](_0x3941ac,function(_0x240eee){if(_0x240eee['type']!=='VIRTUAL'){var _0x4f0362={};_0x4f0362[_0x240eee['name']]={'$like':'%'+_0x5c9fff[_0x27ab('0x2d')][_0x27ab('0x39')]+'%'};return _0x4f0362;}})});}_0x2e4f05=_['merge']({},_0x2e4f05,_0x5c9fff[_0x27ab('0x3a')]);var _0x2b9f18={'where':_0x2e4f05[_0x27ab('0x36')]};return db[_0x27ab('0x28')][_0x27ab('0x1a')](_0x2b9f18)[_0x27ab('0x21')](function(_0xabc46e){_0x86c546[_0x27ab('0x1a')]=_0xabc46e;if(_0x5c9fff['query'][_0x27ab('0x3b')]){_0x2e4f05[_0x27ab('0x3c')]=[{'all':!![]}];}return db['SugarcrmField'][_0x27ab('0x3d')](_0x2e4f05);})[_0x27ab('0x21')](function(_0x2d6a84){_0x86c546[_0x27ab('0x3e')]=_0x2d6a84;return _0x86c546;})[_0x27ab('0x21')](respondWithFilteredResult(_0xe61fd5,_0x2e4f05))['catch'](handleError(_0xe61fd5,null));};exports[_0x27ab('0x3f')]=function(_0x4c59be,_0x1712b6){var _0x55e621={'raw':!![],'where':{'id':_0x4c59be[_0x27ab('0x40')]['id']}},_0x3ed800={};_0x3ed800['model']=_[_0x27ab('0x41')](db[_0x27ab('0x28')][_0x27ab('0x29')]);_0x3ed800['query']=_['keys'](_0x4c59be[_0x27ab('0x2d')]);_0x3ed800['filters']=_[_0x27ab('0x2f')](_0x3ed800['model'],_0x3ed800[_0x27ab('0x2d')]);_0x55e621[_0x27ab('0x30')]=_[_0x27ab('0x2f')](_0x3ed800[_0x27ab('0x2c')],qs['fields'](_0x4c59be[_0x27ab('0x2d')][_0x27ab('0x31')]));_0x55e621[_0x27ab('0x30')]=_0x55e621['attributes']['length']?_0x55e621[_0x27ab('0x30')]:_0x3ed800[_0x27ab('0x2c')];if(_0x4c59be['query'][_0x27ab('0x3b')]){_0x55e621['include']=[{'all':!![]}];}_0x55e621=_[_0x27ab('0x42')]({},_0x55e621,_0x4c59be[_0x27ab('0x3a')]);return db['SugarcrmField'][_0x27ab('0x43')](_0x55e621)[_0x27ab('0x21')](handleEntityNotFound(_0x1712b6,null))[_0x27ab('0x21')](respondWithResult(_0x1712b6,null))[_0x27ab('0x44')](handleError(_0x1712b6,null));};exports['create']=function(_0x12b001,_0x4fa101){return db['SugarcrmField'][_0x27ab('0x45')](_0x12b001['body'],{})['then'](respondWithResult(_0x4fa101,0xc9))[_0x27ab('0x44')](handleError(_0x4fa101,null));};exports[_0x27ab('0x20')]=function(_0x3936c5,_0x451cbc){if(_0x3936c5['body']['id']){delete _0x3936c5[_0x27ab('0x46')]['id'];}return db[_0x27ab('0x28')][_0x27ab('0x43')]({'where':{'id':_0x3936c5[_0x27ab('0x40')]['id']}})[_0x27ab('0x21')](handleEntityNotFound(_0x451cbc,null))[_0x27ab('0x21')](saveUpdates(_0x3936c5[_0x27ab('0x46')],null))[_0x27ab('0x21')](respondWithResult(_0x451cbc,null))[_0x27ab('0x44')](handleError(_0x451cbc,null));};exports[_0x27ab('0x22')]=function(_0x14461e,_0x58dc1e){return db[_0x27ab('0x28')][_0x27ab('0x43')]({'where':{'id':_0x14461e[_0x27ab('0x40')]['id']}})[_0x27ab('0x21')](handleEntityNotFound(_0x58dc1e,null))[_0x27ab('0x21')](removeEntity(_0x58dc1e,null))[_0x27ab('0x44')](handleError(_0x58dc1e,null));}; \ No newline at end of file +var _0x7223=['ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','update','error','stack','name','send','map','SugarcrmField','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','where','merge','options','then','include','rows','catch','show','params','filters','includeAll','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x8c830a,_0x104f1c){var _0x3e0d0e=function(_0x8b0433){while(--_0x8b0433){_0x8c830a['push'](_0x8c830a['shift']());}};_0x3e0d0e(++_0x104f1c);}(_0x7223,0x1e5));var _0x3722=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0x7223[_0xc4001c];return _0x49f7bc;};'use strict';var emlformat=require(_0x3722('0x0'));var rimraf=require(_0x3722('0x1'));var zipdir=require(_0x3722('0x2'));var jsonpatch=require(_0x3722('0x3'));var rp=require(_0x3722('0x4'));var moment=require(_0x3722('0x5'));var BPromise=require(_0x3722('0x6'));var Mustache=require(_0x3722('0x7'));var util=require(_0x3722('0x8'));var path=require(_0x3722('0x9'));var sox=require(_0x3722('0xa'));var csv=require(_0x3722('0xb'));var ejs=require(_0x3722('0xc'));var fs=require('fs');var fs_extra=require(_0x3722('0xd'));var _=require(_0x3722('0xe'));var squel=require(_0x3722('0xf'));var crypto=require('crypto');var jsforce=require(_0x3722('0x10'));var deskjs=require(_0x3722('0x11'));var toCsv=require('to-csv');var querystring=require(_0x3722('0x12'));var Papa=require(_0x3722('0x13'));var Redis=require(_0x3722('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x3722('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3722('0x16'))('api');var utils=require(_0x3722('0x17'));var config=require(_0x3722('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe74670,_0x3d8cb0){_0x3d8cb0=_0x3d8cb0||0xcc;return function(_0x9eb195){if(_0x9eb195){return _0xe74670[_0x3722('0x19')](_0x3d8cb0);}return _0xe74670[_0x3722('0x1a')](_0x3d8cb0)[_0x3722('0x1b')]();};}function respondWithResult(_0x415b34,_0x176425){_0x176425=_0x176425||0xc8;return function(_0x1e9692){if(_0x1e9692){return _0x415b34[_0x3722('0x1a')](_0x176425)['json'](_0x1e9692);}};}function respondWithFilteredResult(_0x304714,_0x45efa2){return function(_0x4e6792){if(_0x4e6792){var _0x401094=typeof _0x45efa2[_0x3722('0x1c')]===_0x3722('0x1d')&&typeof _0x45efa2['limit']===_0x3722('0x1d');var _0x58b0f5=_0x4e6792[_0x3722('0x1e')];var _0x202e95=_0x401094?0x0:_0x45efa2[_0x3722('0x1c')];var _0x896ecc=_0x401094?_0x4e6792[_0x3722('0x1e')]:_0x45efa2[_0x3722('0x1c')]+_0x45efa2[_0x3722('0x1f')];var _0x1ff5ba;if(_0x896ecc>=_0x58b0f5){_0x896ecc=_0x58b0f5;_0x1ff5ba=0xc8;}else{_0x1ff5ba=0xce;}_0x304714[_0x3722('0x1a')](_0x1ff5ba);return _0x304714[_0x3722('0x20')](_0x3722('0x21'),_0x202e95+'-'+_0x896ecc+'/'+_0x58b0f5)[_0x3722('0x22')](_0x4e6792);}return null;};}function patchUpdates(_0x1a765f){return function(_0xba2e40){try{jsonpatch[_0x3722('0x23')](_0xba2e40,_0x1a765f,!![]);}catch(_0x1b5fa0){return BPromise[_0x3722('0x24')](_0x1b5fa0);}return _0xba2e40['save']();};}function saveUpdates(_0x452f37,_0x46012e){return function(_0x4a31ae){if(_0x4a31ae){return _0x4a31ae[_0x3722('0x25')](_0x452f37)['then'](function(_0x590f76){return _0x590f76;});}return null;};}function removeEntity(_0x1e0cc2,_0x5e2ae7){return function(_0x5dc94d){if(_0x5dc94d){return _0x5dc94d['destroy']()['then'](function(){_0x1e0cc2[_0x3722('0x1a')](0xcc)[_0x3722('0x1b')]();});}};}function handleEntityNotFound(_0xcb0aaf,_0x585107){return function(_0x2e2f44){if(!_0x2e2f44){_0xcb0aaf[_0x3722('0x19')](0x194);}return _0x2e2f44;};}function handleError(_0x2c8e65,_0x3b7559){_0x3b7559=_0x3b7559||0x1f4;return function(_0x9278f5){logger[_0x3722('0x26')](_0x9278f5[_0x3722('0x27')]);if(_0x9278f5[_0x3722('0x28')]){delete _0x9278f5[_0x3722('0x28')];}_0x2c8e65['status'](_0x3b7559)[_0x3722('0x29')](_0x9278f5);};}exports['index']=function(_0x26fde4,_0x36ce94){var _0x578073={},_0x2ec8e0={},_0x4a9715={'count':0x0,'rows':[]};var _0x33313a=_[_0x3722('0x2a')](db[_0x3722('0x2b')][_0x3722('0x2c')],function(_0x3ebedf){return{'name':_0x3ebedf[_0x3722('0x2d')],'type':_0x3ebedf[_0x3722('0x2e')][_0x3722('0x2f')]};});_0x2ec8e0['model']=_[_0x3722('0x2a')](_0x33313a,'name');_0x2ec8e0[_0x3722('0x30')]=_[_0x3722('0x31')](_0x26fde4[_0x3722('0x30')]);_0x2ec8e0['filters']=_[_0x3722('0x32')](_0x2ec8e0[_0x3722('0x33')],_0x2ec8e0[_0x3722('0x30')]);_0x578073[_0x3722('0x34')]=_[_0x3722('0x32')](_0x2ec8e0['model'],qs[_0x3722('0x35')](_0x26fde4['query'][_0x3722('0x35')]));_0x578073[_0x3722('0x34')]=_0x578073[_0x3722('0x34')][_0x3722('0x36')]?_0x578073[_0x3722('0x34')]:_0x2ec8e0[_0x3722('0x33')];if(!_0x26fde4['query'][_0x3722('0x37')]('nolimit')){_0x578073[_0x3722('0x1f')]=qs[_0x3722('0x1f')](_0x26fde4[_0x3722('0x30')][_0x3722('0x1f')]);_0x578073['offset']=qs[_0x3722('0x1c')](_0x26fde4[_0x3722('0x30')][_0x3722('0x1c')]);}_0x578073[_0x3722('0x38')]=qs['sort'](_0x26fde4['query']['sort']);_0x578073[_0x3722('0x39')]=qs['filters'](_['pick'](_0x26fde4[_0x3722('0x30')],_0x2ec8e0['filters']),_0x33313a);if(_0x26fde4[_0x3722('0x30')]['filter']){_0x578073[_0x3722('0x39')]=_[_0x3722('0x3a')](_0x578073[_0x3722('0x39')],{'$or':_[_0x3722('0x2a')](_0x33313a,function(_0x152b8b){if(_0x152b8b['type']!=='VIRTUAL'){var _0x2542d1={};_0x2542d1[_0x152b8b['name']]={'$like':'%'+_0x26fde4[_0x3722('0x30')]['filter']+'%'};return _0x2542d1;}})});}_0x578073=_['merge']({},_0x578073,_0x26fde4[_0x3722('0x3b')]);var _0x9432a8={'where':_0x578073[_0x3722('0x39')]};return db[_0x3722('0x2b')][_0x3722('0x1e')](_0x9432a8)[_0x3722('0x3c')](function(_0xfc38c1){_0x4a9715['count']=_0xfc38c1;if(_0x26fde4[_0x3722('0x30')]['includeAll']){_0x578073[_0x3722('0x3d')]=[{'all':!![]}];}return db[_0x3722('0x2b')]['findAll'](_0x578073);})['then'](function(_0x372b55){_0x4a9715[_0x3722('0x3e')]=_0x372b55;return _0x4a9715;})[_0x3722('0x3c')](respondWithFilteredResult(_0x36ce94,_0x578073))[_0x3722('0x3f')](handleError(_0x36ce94,null));};exports[_0x3722('0x40')]=function(_0x30b327,_0x4c6303){var _0x29e8fc={'raw':!![],'where':{'id':_0x30b327[_0x3722('0x41')]['id']}},_0x271900={};_0x271900[_0x3722('0x33')]=_[_0x3722('0x31')](db['SugarcrmField'][_0x3722('0x2c')]);_0x271900[_0x3722('0x30')]=_[_0x3722('0x31')](_0x30b327[_0x3722('0x30')]);_0x271900[_0x3722('0x42')]=_['intersection'](_0x271900[_0x3722('0x33')],_0x271900['query']);_0x29e8fc[_0x3722('0x34')]=_[_0x3722('0x32')](_0x271900[_0x3722('0x33')],qs['fields'](_0x30b327[_0x3722('0x30')][_0x3722('0x35')]));_0x29e8fc[_0x3722('0x34')]=_0x29e8fc['attributes'][_0x3722('0x36')]?_0x29e8fc[_0x3722('0x34')]:_0x271900['model'];if(_0x30b327[_0x3722('0x30')][_0x3722('0x43')]){_0x29e8fc[_0x3722('0x3d')]=[{'all':!![]}];}_0x29e8fc=_[_0x3722('0x3a')]({},_0x29e8fc,_0x30b327['options']);return db[_0x3722('0x2b')]['find'](_0x29e8fc)[_0x3722('0x3c')](handleEntityNotFound(_0x4c6303,null))[_0x3722('0x3c')](respondWithResult(_0x4c6303,null))[_0x3722('0x3f')](handleError(_0x4c6303,null));};exports[_0x3722('0x44')]=function(_0x1e5fee,_0x562416){return db['SugarcrmField'][_0x3722('0x44')](_0x1e5fee[_0x3722('0x45')],{})['then'](respondWithResult(_0x562416,0xc9))[_0x3722('0x3f')](handleError(_0x562416,null));};exports['update']=function(_0x587fdf,_0x14c6ca){if(_0x587fdf['body']['id']){delete _0x587fdf[_0x3722('0x45')]['id'];}return db[_0x3722('0x2b')][_0x3722('0x46')]({'where':{'id':_0x587fdf[_0x3722('0x41')]['id']}})[_0x3722('0x3c')](handleEntityNotFound(_0x14c6ca,null))[_0x3722('0x3c')](saveUpdates(_0x587fdf[_0x3722('0x45')],null))[_0x3722('0x3c')](respondWithResult(_0x14c6ca,null))[_0x3722('0x3f')](handleError(_0x14c6ca,null));};exports['destroy']=function(_0x1e27df,_0x775fc8){return db[_0x3722('0x2b')][_0x3722('0x46')]({'where':{'id':_0x1e27df[_0x3722('0x41')]['id']}})[_0x3722('0x3c')](handleEntityNotFound(_0x775fc8,null))[_0x3722('0x3c')](removeEntity(_0x775fc8,null))['catch'](handleError(_0x775fc8,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index e5b2e85..e6e3923 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 _0x3c93=['bluebird','request-promise','path','../../config/environment','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','util','api'];(function(_0x4089c7,_0x120195){var _0x33dd04=function(_0x4e4fea){while(--_0x4e4fea){_0x4089c7['push'](_0x4089c7['shift']());}};_0x33dd04(++_0x120195);}(_0x3c93,0x1de));var _0x33c9=function(_0x29cea6,_0x3b8b19){_0x29cea6=_0x29cea6-0x0;var _0x3bf4d1=_0x3c93[_0x29cea6];return _0x3bf4d1;};'use strict';var _=require('lodash');var util=require(_0x33c9('0x0'));var logger=require('../../config/logger')(_0x33c9('0x1'));var moment=require('moment');var BPromise=require(_0x33c9('0x2'));var rp=require(_0x33c9('0x3'));var fs=require('fs');var path=require(_0x33c9('0x4'));var rimraf=require('rimraf');var config=require(_0x33c9('0x5'));var attributes=require('./intSugarcrmField.attributes');module['exports']=function(_0xbdd932,_0x5c4fc9){return _0xbdd932[_0x33c9('0x6')](_0x33c9('0x7'),attributes,{'tableName':_0x33c9('0x8'),'paranoid':![],'indexes':[{'name':_0x33c9('0x9'),'fields':[_0x33c9('0xa'),_0x33c9('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0550=['request-promise','path','../../config/environment','exports','define','int_sugarcrm_fields','sugarcrm_unique_index','FieldId','util','api','moment'];(function(_0x219504,_0x530acd){var _0x31d39e=function(_0x1c5e50){while(--_0x1c5e50){_0x219504['push'](_0x219504['shift']());}};_0x31d39e(++_0x530acd);}(_0x0550,0x8c));var _0x0055=function(_0x3af54c,_0x436158){_0x3af54c=_0x3af54c-0x0;var _0x4bc816=_0x0550[_0x3af54c];return _0x4bc816;};'use strict';var _=require('lodash');var util=require(_0x0055('0x0'));var logger=require('../../config/logger')(_0x0055('0x1'));var moment=require(_0x0055('0x2'));var BPromise=require('bluebird');var rp=require(_0x0055('0x3'));var fs=require('fs');var path=require(_0x0055('0x4'));var rimraf=require('rimraf');var config=require(_0x0055('0x5'));var attributes=require('./intSugarcrmField.attributes');module[_0x0055('0x6')]=function(_0x2ed7d3,_0x168929){return _0x2ed7d3[_0x0055('0x7')]('SugarcrmField',attributes,{'tableName':_0x0055('0x8'),'paranoid':![],'indexes':[{'name':_0x0055('0x9'),'fields':['idField',_0x0055('0xa')],'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 932e6ef..2720145 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 _0x938f=['../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmField,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x51cd94,_0x4b6a50){var _0x4b4097=function(_0x29c45a){while(--_0x29c45a){_0x51cd94['push'](_0x51cd94['shift']());}};_0x4b4097(++_0x4b6a50);}(_0x938f,0x13c));var _0xf938=function(_0x34af74,_0x59ab9d){_0x34af74=_0x34af74-0x0;var _0x12d74b=_0x938f[_0x34af74];return _0x12d74b;};'use strict';var _=require(_0xf938('0x0'));var util=require(_0xf938('0x1'));var moment=require(_0xf938('0x2'));var BPromise=require(_0xf938('0x3'));var rs=require(_0xf938('0x4'));var fs=require('fs');var Redis=require(_0xf938('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf938('0x6'));var logger=require(_0xf938('0x7'))(_0xf938('0x8'));var config=require(_0xf938('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf938('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x424f02,_0x3fc350,_0x102dba){return new BPromise(function(_0x3c912c,_0x34ca99){return client[_0xf938('0xb')](_0x424f02,_0x102dba)[_0xf938('0xc')](function(_0x4fe8cc){logger[_0xf938('0xd')]('SugarcrmField,\x20%s,\x20%s',_0x3fc350,_0xf938('0xe'));logger[_0xf938('0xf')](_0xf938('0x10'),_0x3fc350,_0xf938('0xe'),JSON[_0xf938('0x11')](_0x4fe8cc));if(_0x4fe8cc[_0xf938('0x12')]){if(_0x4fe8cc['error'][_0xf938('0x13')]===0x1f4){logger[_0xf938('0x12')](_0xf938('0x14'),_0x3fc350,_0x4fe8cc['error'][_0xf938('0x15')]);return _0x34ca99(_0x4fe8cc['error']['message']);}logger[_0xf938('0x12')](_0xf938('0x14'),_0x3fc350,_0x4fe8cc['error'][_0xf938('0x15')]);return _0x3c912c(_0x4fe8cc[_0xf938('0x12')][_0xf938('0x15')]);}else{logger['info'](_0xf938('0x14'),_0x3fc350,_0xf938('0xe'));_0x3c912c(_0x4fe8cc['result'][_0xf938('0x15')]);}})[_0xf938('0x16')](function(_0x15bcb9){logger[_0xf938('0x12')](_0xf938('0x14'),_0x3fc350,_0x15bcb9);_0x34ca99(_0x15bcb9);});});} \ No newline at end of file +var _0x4f78=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring'];(function(_0x228b64,_0x3f48b1){var _0x17fa65=function(_0x176f9a){while(--_0x176f9a){_0x228b64['push'](_0x228b64['shift']());}};_0x17fa65(++_0x3f48b1);}(_0x4f78,0xe2));var _0x84f7=function(_0x53be66,_0x9ec3be){_0x53be66=_0x53be66-0x0;var _0x9e5520=_0x4f78[_0x53be66];return _0x9e5520;};'use strict';var _=require(_0x84f7('0x0'));var util=require(_0x84f7('0x1'));var moment=require(_0x84f7('0x2'));var BPromise=require('bluebird');var rs=require(_0x84f7('0x3'));var fs=require('fs');var Redis=require(_0x84f7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x84f7('0x5'));var logger=require(_0x84f7('0x6'))(_0x84f7('0x7'));var config=require(_0x84f7('0x8'));var jayson=require(_0x84f7('0x9'));var client=jayson[_0x84f7('0xa')][_0x84f7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x162dbe,_0x224610,_0x5f5534){return new BPromise(function(_0x1c3768,_0x58a8b5){return client[_0x84f7('0xc')](_0x162dbe,_0x5f5534)[_0x84f7('0xd')](function(_0x39574a){logger['info'](_0x84f7('0xe'),_0x224610,_0x84f7('0xf'));logger[_0x84f7('0x10')](_0x84f7('0x11'),_0x224610,_0x84f7('0xf'),JSON[_0x84f7('0x12')](_0x39574a));if(_0x39574a['error']){if(_0x39574a['error']['code']===0x1f4){logger[_0x84f7('0x13')](_0x84f7('0xe'),_0x224610,_0x39574a[_0x84f7('0x13')][_0x84f7('0x14')]);return _0x58a8b5(_0x39574a[_0x84f7('0x13')][_0x84f7('0x14')]);}logger[_0x84f7('0x13')](_0x84f7('0xe'),_0x224610,_0x39574a[_0x84f7('0x13')][_0x84f7('0x14')]);return _0x1c3768(_0x39574a[_0x84f7('0x13')][_0x84f7('0x14')]);}else{logger['info'](_0x84f7('0xe'),_0x224610,_0x84f7('0xf'));_0x1c3768(_0x39574a[_0x84f7('0x15')][_0x84f7('0x14')]);}})[_0x84f7('0x16')](function(_0x1ed252){logger[_0x84f7('0x13')](_0x84f7('0xe'),_0x224610,_0x1ed252);_0x58a8b5(_0x1ed252);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index cdb2b9b..84fbb4f 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 _0x520e=['post','create','addConfiguration','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x520e,0x90));var _0xe520=function(_0x5471ec,_0x1ce81a){_0x5471ec=_0x5471ec-0x0;var _0x121d4c=_0x520e[_0x5471ec];return _0x121d4c;};'use strict';var multer=require(_0xe520('0x0'));var util=require(_0xe520('0x1'));var path=require(_0xe520('0x2'));var timeout=require(_0xe520('0x3'));var express=require(_0xe520('0x4'));var router=express[_0xe520('0x5')]();var fs_extra=require(_0xe520('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xe520('0x7'));var config=require(_0xe520('0x8'));var controller=require('./intVtigerAccount.controller');router[_0xe520('0x9')]('/',auth[_0xe520('0xa')](),controller[_0xe520('0xb')]);router[_0xe520('0x9')](_0xe520('0xc'),auth[_0xe520('0xa')](),controller['show']);router[_0xe520('0x9')](_0xe520('0xd'),auth[_0xe520('0xa')](),controller[_0xe520('0xe')]);router[_0xe520('0x9')](_0xe520('0xf'),auth[_0xe520('0xa')](),controller[_0xe520('0x10')]);router[_0xe520('0x11')]('/',auth[_0xe520('0xa')](),controller[_0xe520('0x12')]);router[_0xe520('0x11')](_0xe520('0xd'),auth[_0xe520('0xa')](),controller[_0xe520('0x13')]);router[_0xe520('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xe520('0x15')]);router['delete'](_0xe520('0xc'),auth[_0xe520('0xa')](),controller['destroy']);module[_0xe520('0x16')]=router; \ No newline at end of file +var _0x93b6=['/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id'];(function(_0x5f3050,_0x28d28c){var _0x846b2c=function(_0x2a18e6){while(--_0x2a18e6){_0x5f3050['push'](_0x5f3050['shift']());}};_0x846b2c(++_0x28d28c);}(_0x93b6,0x151));var _0x693b=function(_0x97142f,_0x426496){_0x97142f=_0x97142f-0x0;var _0x430048=_0x93b6[_0x97142f];return _0x430048;};'use strict';var multer=require(_0x693b('0x0'));var util=require(_0x693b('0x1'));var path=require('path');var timeout=require(_0x693b('0x2'));var express=require(_0x693b('0x3'));var router=express['Router']();var fs_extra=require(_0x693b('0x4'));var auth=require(_0x693b('0x5'));var interaction=require(_0x693b('0x6'));var config=require(_0x693b('0x7'));var controller=require(_0x693b('0x8'));router[_0x693b('0x9')]('/',auth[_0x693b('0xa')](),controller[_0x693b('0xb')]);router[_0x693b('0x9')](_0x693b('0xc'),auth['isAuthenticated'](),controller['show']);router['get'](_0x693b('0xd'),auth[_0x693b('0xa')](),controller[_0x693b('0xe')]);router[_0x693b('0x9')](_0x693b('0xf'),auth[_0x693b('0xa')](),controller[_0x693b('0x10')]);router[_0x693b('0x11')]('/',auth['isAuthenticated'](),controller[_0x693b('0x12')]);router[_0x693b('0x11')](_0x693b('0xd'),auth['isAuthenticated'](),controller[_0x693b('0x13')]);router[_0x693b('0x14')](_0x693b('0xc'),auth[_0x693b('0xa')](),controller[_0x693b('0x15')]);router[_0x693b('0x16')](_0x693b('0xc'),auth['isAuthenticated'](),controller[_0x693b('0x17')]);module[_0x693b('0x18')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index d3e14c4..5f065b4 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 _0x309b=['exports','STRING','HelpDesk'];(function(_0x47127f,_0x38131c){var _0x1f432a=function(_0x5f314b){while(--_0x5f314b){_0x47127f['push'](_0x47127f['shift']());}};_0x1f432a(++_0x38131c);}(_0x309b,0x114));var _0xb309=function(_0x2f9b0c,_0x4bf62a){_0x2f9b0c=_0x2f9b0c-0x0;var _0x4a3c19=_0x309b[_0x2f9b0c];return _0x4a3c19;};'use strict';var Sequelize=require('sequelize');module[_0xb309('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xb309('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb309('0x2')},'remoteUri':{'type':Sequelize[_0xb309('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xb309('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xb309('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x3e1a=['STRING','HelpDesk','sequelize','exports'];(function(_0x3287f4,_0x131a75){var _0x4f6d7e=function(_0x431e12){while(--_0x431e12){_0x3287f4['push'](_0x3287f4['shift']());}};_0x4f6d7e(++_0x131a75);}(_0x3e1a,0xb6));var _0xa3e1=function(_0x117dc4,_0x5a6f62){_0x117dc4=_0x117dc4-0x0;var _0x2a3017=_0x3e1a[_0x117dc4];return _0x2a3017;};'use strict';var Sequelize=require(_0xa3e1('0x0'));module[_0xa3e1('0x1')]={'name':{'type':Sequelize[_0xa3e1('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xa3e1('0x2')]},'username':{'type':Sequelize[_0xa3e1('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xa3e1('0x2')],'allowNull':![],'defaultValue':_0xa3e1('0x3')},'remoteUri':{'type':Sequelize[_0xa3e1('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0xa3e1('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 8c37671..7048ecc 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 _0xea40=['getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','error','stack','name','send','index','map','VtigerAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','findOne','VtigerConfiguration','getConfigurations','addConfiguration','AccountId','channel','type','Descriptions','VtigerField','Subjects','md5','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','substring','lastIndexOf','format','%s/webservice.php','GET','success','POST','login','result','token','sessionName','autogenerated','reference','owner','includes','editable','label','startsWith','cf_','picklist','picklistValues','log','vTiger\x20error:\x20','test','statusCode'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xea40,0x81));var _0x0ea4=function(_0x5c4585,_0x3d0eab){_0x5c4585=_0x5c4585-0x0;var _0x21dede=_0xea40[_0x5c4585];return _0x21dede;};'use strict';var emlformat=require(_0x0ea4('0x0'));var rimraf=require(_0x0ea4('0x1'));var zipdir=require(_0x0ea4('0x2'));var jsonpatch=require(_0x0ea4('0x3'));var rp=require(_0x0ea4('0x4'));var moment=require(_0x0ea4('0x5'));var BPromise=require(_0x0ea4('0x6'));var Mustache=require(_0x0ea4('0x7'));var util=require(_0x0ea4('0x8'));var path=require(_0x0ea4('0x9'));var sox=require('sox');var csv=require(_0x0ea4('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0ea4('0xb'));var _=require('lodash');var squel=require(_0x0ea4('0xc'));var crypto=require(_0x0ea4('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0ea4('0xe'));var toCsv=require(_0x0ea4('0xa'));var querystring=require(_0x0ea4('0xf'));var Papa=require(_0x0ea4('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0ea4('0x11'));var as=require(_0x0ea4('0x12'));var hardwareService=require(_0x0ea4('0x13'));var logger=require('../../config/logger')(_0x0ea4('0x14'));var utils=require(_0x0ea4('0x15'));var config=require(_0x0ea4('0x16'));var licenseUtil=require(_0x0ea4('0x17'));var db=require(_0x0ea4('0x18'))['db'];var integrations=require(_0x0ea4('0x19'));function respondWithStatusCode(_0x4e57e5,_0x32a043){_0x32a043=_0x32a043||0xcc;return function(_0x4d0dff){if(_0x4d0dff){return _0x4e57e5[_0x0ea4('0x1a')](_0x32a043);}return _0x4e57e5['status'](_0x32a043)[_0x0ea4('0x1b')]();};}function respondWithResult(_0x1e7e55,_0x3f64ad){_0x3f64ad=_0x3f64ad||0xc8;return function(_0x59875f){if(_0x59875f){return _0x1e7e55[_0x0ea4('0x1c')](_0x3f64ad)[_0x0ea4('0x1d')](_0x59875f);}};}function respondWithFilteredResult(_0x974a3c,_0x1ffc60){return function(_0x1533cd){if(_0x1533cd){var _0x20b17a=typeof _0x1ffc60[_0x0ea4('0x1e')]===_0x0ea4('0x1f')&&typeof _0x1ffc60[_0x0ea4('0x20')]===_0x0ea4('0x1f');var _0x49cadd=_0x1533cd[_0x0ea4('0x21')];var _0x1d512a=_0x20b17a?0x0:_0x1ffc60[_0x0ea4('0x1e')];var _0x5a6565=_0x20b17a?_0x1533cd['count']:_0x1ffc60[_0x0ea4('0x1e')]+_0x1ffc60[_0x0ea4('0x20')];var _0x324ae3;if(_0x5a6565>=_0x49cadd){_0x5a6565=_0x49cadd;_0x324ae3=0xc8;}else{_0x324ae3=0xce;}_0x974a3c['status'](_0x324ae3);return _0x974a3c[_0x0ea4('0x22')](_0x0ea4('0x23'),_0x1d512a+'-'+_0x5a6565+'/'+_0x49cadd)[_0x0ea4('0x1d')](_0x1533cd);}return null;};}function patchUpdates(_0x21ab4d){return function(_0xf16a29){try{jsonpatch[_0x0ea4('0x24')](_0xf16a29,_0x21ab4d,!![]);}catch(_0x114dd0){return BPromise['reject'](_0x114dd0);}return _0xf16a29['save']();};}function saveUpdates(_0x3ac014,_0x1953e8){return function(_0x508146){if(_0x508146){return _0x508146[_0x0ea4('0x25')](_0x3ac014)[_0x0ea4('0x26')](function(_0x36f154){return _0x36f154;});}return null;};}function removeEntity(_0x21bf3d,_0x8e7d03){return function(_0x2f6b35){if(_0x2f6b35){return _0x2f6b35[_0x0ea4('0x27')]()[_0x0ea4('0x26')](function(){_0x21bf3d[_0x0ea4('0x1c')](0xcc)[_0x0ea4('0x1b')]();});}};}function handleEntityNotFound(_0x3470ae,_0x432719){return function(_0x3ceba6){if(!_0x3ceba6){_0x3470ae[_0x0ea4('0x1a')](0x194);}return _0x3ceba6;};}function handleError(_0x2b4770,_0x4ce651){_0x4ce651=_0x4ce651||0x1f4;return function(_0x6cda88){logger[_0x0ea4('0x28')](_0x6cda88[_0x0ea4('0x29')]);if(_0x6cda88[_0x0ea4('0x2a')]){delete _0x6cda88[_0x0ea4('0x2a')];}_0x2b4770[_0x0ea4('0x1c')](_0x4ce651)[_0x0ea4('0x2b')](_0x6cda88);};}exports[_0x0ea4('0x2c')]=function(_0xee5a0a,_0x56d58f){var _0x529664={},_0x1357bf={},_0x2c3437={'count':0x0,'rows':[]};var _0x3eb1dd=_[_0x0ea4('0x2d')](db[_0x0ea4('0x2e')][_0x0ea4('0x2f')],function(_0x3380d9){return{'name':_0x3380d9[_0x0ea4('0x30')],'type':_0x3380d9['type'][_0x0ea4('0x31')]};});_0x1357bf[_0x0ea4('0x32')]=_[_0x0ea4('0x2d')](_0x3eb1dd,_0x0ea4('0x2a'));_0x1357bf[_0x0ea4('0x33')]=_[_0x0ea4('0x34')](_0xee5a0a[_0x0ea4('0x33')]);_0x1357bf[_0x0ea4('0x35')]=_[_0x0ea4('0x36')](_0x1357bf[_0x0ea4('0x32')],_0x1357bf[_0x0ea4('0x33')]);_0x529664['attributes']=_[_0x0ea4('0x36')](_0x1357bf[_0x0ea4('0x32')],qs[_0x0ea4('0x37')](_0xee5a0a['query'][_0x0ea4('0x37')]));_0x529664[_0x0ea4('0x38')]=_0x529664[_0x0ea4('0x38')][_0x0ea4('0x39')]?_0x529664[_0x0ea4('0x38')]:_0x1357bf['model'];if(!_0xee5a0a['query'][_0x0ea4('0x3a')](_0x0ea4('0x3b'))){_0x529664['limit']=qs[_0x0ea4('0x20')](_0xee5a0a[_0x0ea4('0x33')][_0x0ea4('0x20')]);_0x529664[_0x0ea4('0x1e')]=qs[_0x0ea4('0x1e')](_0xee5a0a[_0x0ea4('0x33')][_0x0ea4('0x1e')]);}_0x529664[_0x0ea4('0x3c')]=qs[_0x0ea4('0x3d')](_0xee5a0a[_0x0ea4('0x33')]['sort']);_0x529664[_0x0ea4('0x3e')]=qs[_0x0ea4('0x35')](_[_0x0ea4('0x3f')](_0xee5a0a['query'],_0x1357bf[_0x0ea4('0x35')]),_0x3eb1dd);if(_0xee5a0a[_0x0ea4('0x33')]['filter']){_0x529664[_0x0ea4('0x3e')]=_['merge'](_0x529664['where'],{'$or':_['map'](_0x3eb1dd,function(_0x652a1c){if(_0x652a1c['type']!==_0x0ea4('0x40')){var _0x2bd155={};_0x2bd155[_0x652a1c[_0x0ea4('0x2a')]]={'$like':'%'+_0xee5a0a[_0x0ea4('0x33')][_0x0ea4('0x41')]+'%'};return _0x2bd155;}})});}_0x529664=_[_0x0ea4('0x42')]({},_0x529664,_0xee5a0a[_0x0ea4('0x43')]);var _0xf6b1d4={'where':_0x529664[_0x0ea4('0x3e')]};return db['VtigerAccount']['count'](_0xf6b1d4)[_0x0ea4('0x26')](function(_0x39754a){_0x2c3437[_0x0ea4('0x21')]=_0x39754a;if(_0xee5a0a[_0x0ea4('0x33')][_0x0ea4('0x44')]){_0x529664[_0x0ea4('0x45')]=[{'all':!![]}];}return db['VtigerAccount'][_0x0ea4('0x46')](_0x529664);})[_0x0ea4('0x26')](function(_0x2f42f9){_0x2c3437[_0x0ea4('0x47')]=_0x2f42f9;return _0x2c3437;})['then'](respondWithFilteredResult(_0x56d58f,_0x529664))[_0x0ea4('0x48')](handleError(_0x56d58f,null));};exports[_0x0ea4('0x49')]=function(_0x337ce8,_0x69d104){var _0x141f09={'raw':![],'where':{'id':_0x337ce8[_0x0ea4('0x4a')]['id']}},_0x48537f={};_0x48537f[_0x0ea4('0x32')]=_[_0x0ea4('0x34')](db[_0x0ea4('0x2e')][_0x0ea4('0x2f')]);_0x48537f[_0x0ea4('0x33')]=_['keys'](_0x337ce8['query']);_0x48537f['filters']=_[_0x0ea4('0x36')](_0x48537f['model'],_0x48537f[_0x0ea4('0x33')]);_0x141f09[_0x0ea4('0x38')]=_['intersection'](_0x48537f['model'],qs[_0x0ea4('0x37')](_0x337ce8['query']['fields']));_0x141f09['attributes']=_0x141f09['attributes'][_0x0ea4('0x39')]?_0x141f09[_0x0ea4('0x38')]:_0x48537f[_0x0ea4('0x32')];if(_0x337ce8[_0x0ea4('0x33')][_0x0ea4('0x44')]){_0x141f09[_0x0ea4('0x45')]=[{'all':!![]}];}_0x141f09=_['merge']({},_0x141f09,_0x337ce8[_0x0ea4('0x43')]);return db[_0x0ea4('0x2e')][_0x0ea4('0x4b')](_0x141f09)['then'](handleEntityNotFound(_0x69d104,null))[_0x0ea4('0x26')](respondWithResult(_0x69d104,null))[_0x0ea4('0x48')](handleError(_0x69d104,null));};exports[_0x0ea4('0x4c')]=function(_0x3ae71e,_0x114504){return db[_0x0ea4('0x2e')][_0x0ea4('0x4c')](_0x3ae71e[_0x0ea4('0x4d')],{})[_0x0ea4('0x26')](respondWithResult(_0x114504,0xc9))[_0x0ea4('0x48')](handleError(_0x114504,null));};exports[_0x0ea4('0x25')]=function(_0x267d76,_0x3811a3){if(_0x267d76[_0x0ea4('0x4d')]['id']){delete _0x267d76[_0x0ea4('0x4d')]['id'];}return db['VtigerAccount'][_0x0ea4('0x4b')]({'where':{'id':_0x267d76[_0x0ea4('0x4a')]['id']}})[_0x0ea4('0x26')](handleEntityNotFound(_0x3811a3,null))[_0x0ea4('0x26')](saveUpdates(_0x267d76[_0x0ea4('0x4d')],null))['then'](respondWithResult(_0x3811a3,null))[_0x0ea4('0x48')](handleError(_0x3811a3,null));};exports[_0x0ea4('0x27')]=function(_0x58d5a7,_0x20b86a){return db[_0x0ea4('0x2e')][_0x0ea4('0x4b')]({'where':{'id':_0x58d5a7['params']['id']}})[_0x0ea4('0x26')](handleEntityNotFound(_0x20b86a,null))[_0x0ea4('0x26')](removeEntity(_0x20b86a,null))[_0x0ea4('0x48')](handleError(_0x20b86a,null));};exports['getConfigurations']=function(_0x2e1e98,_0x126dae,_0x501d04){var _0x3837ec={};var _0x5b4a43={};var _0x3dff78;var _0x3b1061;return db['VtigerAccount'][_0x0ea4('0x4e')]({'where':{'id':_0x2e1e98[_0x0ea4('0x4a')]['id']}})[_0x0ea4('0x26')](handleEntityNotFound(_0x126dae,null))[_0x0ea4('0x26')](function(_0xad39d1){if(_0xad39d1){_0x3dff78=_0xad39d1;_0x5b4a43['model']=_['keys'](db[_0x0ea4('0x4f')][_0x0ea4('0x2f')]);_0x5b4a43[_0x0ea4('0x33')]=_['keys'](_0x2e1e98[_0x0ea4('0x33')]);_0x5b4a43['filters']=_[_0x0ea4('0x36')](_0x5b4a43[_0x0ea4('0x32')],_0x5b4a43['query']);_0x3837ec[_0x0ea4('0x38')]=_[_0x0ea4('0x36')](_0x5b4a43['model'],qs[_0x0ea4('0x37')](_0x2e1e98[_0x0ea4('0x33')]['fields']));_0x3837ec['attributes']=_0x3837ec[_0x0ea4('0x38')][_0x0ea4('0x39')]?_0x3837ec[_0x0ea4('0x38')]:_0x5b4a43[_0x0ea4('0x32')];_0x3837ec['order']=qs[_0x0ea4('0x3d')](_0x2e1e98[_0x0ea4('0x33')][_0x0ea4('0x3d')]);_0x3837ec['where']=qs['filters'](_[_0x0ea4('0x3f')](_0x2e1e98[_0x0ea4('0x33')],_0x5b4a43[_0x0ea4('0x35')]));if(_0x2e1e98[_0x0ea4('0x33')][_0x0ea4('0x41')]){_0x3837ec[_0x0ea4('0x3e')]=_[_0x0ea4('0x42')](_0x3837ec['where'],{'$or':_[_0x0ea4('0x2d')](_0x3837ec['attributes'],function(_0x31044f){var _0x3e7bf6={};_0x3e7bf6[_0x31044f]={'$like':'%'+_0x2e1e98['query'][_0x0ea4('0x41')]+'%'};return _0x3e7bf6;})});}_0x3837ec=_[_0x0ea4('0x42')]({},_0x3837ec,_0x2e1e98['options']);return _0x3dff78[_0x0ea4('0x50')](_0x3837ec);}})[_0x0ea4('0x26')](function(_0x4835ff){if(_0x4835ff){_0x3b1061=_0x4835ff['length'];if(!_0x2e1e98[_0x0ea4('0x33')][_0x0ea4('0x3a')](_0x0ea4('0x3b'))){_0x3837ec['limit']=qs['limit'](_0x2e1e98[_0x0ea4('0x33')]['limit']);_0x3837ec['offset']=qs[_0x0ea4('0x1e')](_0x2e1e98[_0x0ea4('0x33')]['offset']);}return _0x3dff78[_0x0ea4('0x50')](_0x3837ec);}})[_0x0ea4('0x26')](function(_0x355730){if(_0x355730){return _0x355730?{'count':_0x3b1061,'rows':_0x355730}:null;}})['then'](respondWithResult(_0x126dae,null))['catch'](handleError(_0x126dae,null));};exports[_0x0ea4('0x51')]=function(_0x1378e3,_0x2dd46b,_0x3f4c1b){if(_0x1378e3['body']['id']){delete _0x1378e3[_0x0ea4('0x4d')]['id'];}return db[_0x0ea4('0x2e')][_0x0ea4('0x4e')]({'where':{'id':_0x1378e3['params']['id']}})[_0x0ea4('0x26')](handleEntityNotFound(_0x2dd46b,null))[_0x0ea4('0x26')](function(_0x555e6a){if(_0x555e6a){_0x1378e3[_0x0ea4('0x4d')][_0x0ea4('0x52')]=_0x555e6a['id'];_0x1378e3['body']['Subjects']=integrations['getSubjects'](_0x1378e3[_0x0ea4('0x4d')][_0x0ea4('0x53')],_0x1378e3['body'][_0x0ea4('0x54')]);_0x1378e3[_0x0ea4('0x4d')][_0x0ea4('0x55')]=integrations['getDescriptions'](_0x1378e3['body'][_0x0ea4('0x53')],_0x1378e3['body'][_0x0ea4('0x54')]);return db[_0x0ea4('0x4f')][_0x0ea4('0x4c')](_0x1378e3[_0x0ea4('0x4d')],{'include':[{'model':db[_0x0ea4('0x56')],'as':_0x0ea4('0x57')},{'model':db[_0x0ea4('0x56')],'as':_0x0ea4('0x55')}]});}return null;})[_0x0ea4('0x26')](respondWithResult(_0x2dd46b,null))[_0x0ea4('0x48')](handleError(_0x2dd46b,null));};var md5=require(_0x0ea4('0x58'));exports['getFields']=function(_0x33ceaa,_0x40f99e,_0x1d68eb){var _0x2ede9a=null;var _0x5c8b35=null;var _0x4702d9=null;var _0x54a0b0=null;var _0x14b987='';return db[_0x0ea4('0x2e')]['findOne']({'where':{'id':_0x33ceaa[_0x0ea4('0x4a')]['id']},'attributes':['id',_0x0ea4('0x2a'),_0x0ea4('0x59'),_0x0ea4('0x5a'),_0x0ea4('0x5b'),_0x0ea4('0x5c'),_0x0ea4('0x5d'),_0x0ea4('0x5e')]})[_0x0ea4('0x26')](handleEntityNotFound(_0x40f99e,null))[_0x0ea4('0x26')](function(_0x3989f9){if(_0x3989f9){_0x2ede9a=_0x3989f9[_0x0ea4('0x59')];_0x5c8b35=_0x3989f9['accessKey'];_0x4702d9=_0x3989f9[_0x0ea4('0x5b')];_0x14b987=_0x3989f9[_0x0ea4('0x5c')];var _0xc30a25=_0x14b987[_0x0ea4('0x5f')](-0x1);if(_0xc30a25==='/'){_0x14b987=_0x14b987[_0x0ea4('0x60')](0x0,_0x14b987[_0x0ea4('0x61')](_0xc30a25));}_0x54a0b0=util[_0x0ea4('0x62')](_0x0ea4('0x63'),_0x14b987);var _0x3f6b0d={'method':_0x0ea4('0x64'),'uri':_0x54a0b0,'qs':{'operation':'getchallenge','username':_0x3989f9[_0x0ea4('0x59')]},'json':!![]};return rp(_0x3f6b0d);}})['then'](function(_0x969f01){if(_0x969f01[_0x0ea4('0x65')]){var _0x3f0781={'method':_0x0ea4('0x66'),'uri':_0x54a0b0,'form':{'operation':_0x0ea4('0x67'),'username':_0x2ede9a,'accessKey':md5(_0x969f01[_0x0ea4('0x68')][_0x0ea4('0x69')]+_0x5c8b35)},'json':!![]};return rp(_0x3f0781);}})[_0x0ea4('0x26')](function(_0x15ee13){if(_0x15ee13['success']){var _0x3280f1={'method':_0x0ea4('0x64'),'uri':_0x54a0b0,'qs':{'operation':'describe','username':_0x2ede9a,'sessionName':_0x15ee13[_0x0ea4('0x68')][_0x0ea4('0x6a')],'elementType':_0x4702d9},'json':!![]};return rp(_0x3280f1);}})[_0x0ea4('0x26')](function(_0x4f1a77){if(_0x4f1a77['success']){var _0xad15a4=[_0x0ea4('0x6b'),_0x0ea4('0x6c'),_0x0ea4('0x6d')];_['remove'](_0x4f1a77[_0x0ea4('0x68')]['fields'],function(_0xac5979){return _0xad15a4[_0x0ea4('0x6e')](_0xac5979[_0x0ea4('0x54')][_0x0ea4('0x2a')]);});_['remove'](_0x4f1a77[_0x0ea4('0x68')][_0x0ea4('0x37')],function(_0x29c2ac){return _0x29c2ac[_0x0ea4('0x6f')]==='false';});return{'count':_0x4f1a77[_0x0ea4('0x68')][_0x0ea4('0x37')][_0x0ea4('0x39')],'rows':_[_0x0ea4('0x2d')](_0x4f1a77[_0x0ea4('0x68')][_0x0ea4('0x37')],function(_0x499886){return{'id':_0x499886[_0x0ea4('0x2a')],'name':_0x499886[_0x0ea4('0x70')],'custom':_[_0x0ea4('0x71')](_0x499886['name'],_0x0ea4('0x72'))?!![]:![],'options':_0x499886[_0x0ea4('0x54')][_0x0ea4('0x2a')]===_0x0ea4('0x73')&&_0x499886[_0x0ea4('0x54')][_0x0ea4('0x74')][_0x0ea4('0x39')]>0x0?_[_0x0ea4('0x2d')](_0x499886['type'][_0x0ea4('0x74')],function(_0x2c71c8){return{'name':_0x2c71c8[_0x0ea4('0x70')],'value':_0x2c71c8['value']};}):[]};})};}})[_0x0ea4('0x26')](respondWithResult(_0x40f99e,null))[_0x0ea4('0x48')](function(_0x2f7a6d){console[_0x0ea4('0x75')](_0x0ea4('0x76')+_0x2f7a6d);var _0x31d81e=_0x33ceaa[_0x0ea4('0x33')][_0x0ea4('0x77')]?0x1f4:_0x2f7a6d[_0x0ea4('0x78')]||0x1f4;logger['error'](_0x0ea4('0x79'),_0x0ea4('0x7a'),_0x31d81e,JSON[_0x0ea4('0x7b')](_0x2f7a6d));delete _0x2f7a6d[_0x0ea4('0x2a')];if(_0x31d81e===0x191){_0x31d81e=0x190;}_0x40f99e[_0x0ea4('0x1c')](_0x31d81e)[_0x0ea4('0x2b')](_0x33ceaa[_0x0ea4('0x33')][_0x0ea4('0x77')]?{'message':_0x0ea4('0x7c'),'statusCode':_0x2f7a6d['statusCode']}:_0x2f7a6d);});}; \ No newline at end of file +var _0xb12e=['describe','sessionName','autogenerated','reference','remove','includes','false','label','cf_','picklist','picklistValues','value','log','statusCode','error','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','limit','undefined','count','offset','set','Content-Range','reject','update','then','name','send','index','map','VtigerAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','destroy','findOne','VtigerConfiguration','getConfigurations','hasOwnProperty','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','moduleName','remoteUri','serverUrl','accessKey','username','slice','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','POST','login','result','token'];(function(_0x80a737,_0x3542b1){var _0x44327f=function(_0x23f9fb){while(--_0x23f9fb){_0x80a737['push'](_0x80a737['shift']());}};_0x44327f(++_0x3542b1);}(_0xb12e,0x8f));var _0xeb12=function(_0x38b4b1,_0x1ed56a){_0x38b4b1=_0x38b4b1-0x0;var _0x43af52=_0xb12e[_0x38b4b1];return _0x43af52;};'use strict';var emlformat=require(_0xeb12('0x0'));var rimraf=require(_0xeb12('0x1'));var zipdir=require(_0xeb12('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xeb12('0x3'));var moment=require(_0xeb12('0x4'));var BPromise=require(_0xeb12('0x5'));var Mustache=require(_0xeb12('0x6'));var util=require(_0xeb12('0x7'));var path=require(_0xeb12('0x8'));var sox=require(_0xeb12('0x9'));var csv=require(_0xeb12('0xa'));var ejs=require(_0xeb12('0xb'));var fs=require('fs');var fs_extra=require(_0xeb12('0xc'));var _=require(_0xeb12('0xd'));var squel=require(_0xeb12('0xe'));var crypto=require(_0xeb12('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xeb12('0x10'));var toCsv=require(_0xeb12('0xa'));var querystring=require(_0xeb12('0x11'));var Papa=require(_0xeb12('0x12'));var Redis=require(_0xeb12('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xeb12('0x14'));var hardwareService=require(_0xeb12('0x15'));var logger=require(_0xeb12('0x16'))('api');var utils=require(_0xeb12('0x17'));var config=require(_0xeb12('0x18'));var licenseUtil=require(_0xeb12('0x19'));var db=require(_0xeb12('0x1a'))['db'];var integrations=require(_0xeb12('0x1b'));function respondWithStatusCode(_0xcb2cb8,_0x1af037){_0x1af037=_0x1af037||0xcc;return function(_0x4ec66a){if(_0x4ec66a){return _0xcb2cb8[_0xeb12('0x1c')](_0x1af037);}return _0xcb2cb8['status'](_0x1af037)[_0xeb12('0x1d')]();};}function respondWithResult(_0x446534,_0x584a02){_0x584a02=_0x584a02||0xc8;return function(_0x54235c){if(_0x54235c){return _0x446534[_0xeb12('0x1e')](_0x584a02)[_0xeb12('0x1f')](_0x54235c);}};}function respondWithFilteredResult(_0x40760a,_0x22f81d){return function(_0x37eef4){if(_0x37eef4){var _0x4e2ae2=typeof _0x22f81d['offset']==='undefined'&&typeof _0x22f81d[_0xeb12('0x20')]===_0xeb12('0x21');var _0x1ecaed=_0x37eef4[_0xeb12('0x22')];var _0x18d0cf=_0x4e2ae2?0x0:_0x22f81d[_0xeb12('0x23')];var _0x36a7c7=_0x4e2ae2?_0x37eef4['count']:_0x22f81d[_0xeb12('0x23')]+_0x22f81d[_0xeb12('0x20')];var _0x1b2d67;if(_0x36a7c7>=_0x1ecaed){_0x36a7c7=_0x1ecaed;_0x1b2d67=0xc8;}else{_0x1b2d67=0xce;}_0x40760a[_0xeb12('0x1e')](_0x1b2d67);return _0x40760a[_0xeb12('0x24')](_0xeb12('0x25'),_0x18d0cf+'-'+_0x36a7c7+'/'+_0x1ecaed)[_0xeb12('0x1f')](_0x37eef4);}return null;};}function patchUpdates(_0x3598b0){return function(_0x342238){try{jsonpatch['apply'](_0x342238,_0x3598b0,!![]);}catch(_0xce1b58){return BPromise[_0xeb12('0x26')](_0xce1b58);}return _0x342238['save']();};}function saveUpdates(_0x5a559d,_0x3da345){return function(_0xeada1b){if(_0xeada1b){return _0xeada1b[_0xeb12('0x27')](_0x5a559d)[_0xeb12('0x28')](function(_0x52eadc){return _0x52eadc;});}return null;};}function removeEntity(_0x25c38d,_0x3f6bd0){return function(_0x3049b4){if(_0x3049b4){return _0x3049b4['destroy']()[_0xeb12('0x28')](function(){_0x25c38d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c123a,_0x242e68){return function(_0x491cf6){if(!_0x491cf6){_0x1c123a[_0xeb12('0x1c')](0x194);}return _0x491cf6;};}function handleError(_0x2c8705,_0x4f1526){_0x4f1526=_0x4f1526||0x1f4;return function(_0x55db30){logger['error'](_0x55db30['stack']);if(_0x55db30[_0xeb12('0x29')]){delete _0x55db30[_0xeb12('0x29')];}_0x2c8705[_0xeb12('0x1e')](_0x4f1526)[_0xeb12('0x2a')](_0x55db30);};}exports[_0xeb12('0x2b')]=function(_0x2d0e41,_0xfca078){var _0x2b3717={},_0x168780={},_0x497930={'count':0x0,'rows':[]};var _0x3302ff=_[_0xeb12('0x2c')](db[_0xeb12('0x2d')][_0xeb12('0x2e')],function(_0x26c2f6){return{'name':_0x26c2f6[_0xeb12('0x2f')],'type':_0x26c2f6[_0xeb12('0x30')][_0xeb12('0x31')]};});_0x168780[_0xeb12('0x32')]=_['map'](_0x3302ff,'name');_0x168780['query']=_[_0xeb12('0x33')](_0x2d0e41[_0xeb12('0x34')]);_0x168780[_0xeb12('0x35')]=_[_0xeb12('0x36')](_0x168780[_0xeb12('0x32')],_0x168780[_0xeb12('0x34')]);_0x2b3717['attributes']=_[_0xeb12('0x36')](_0x168780[_0xeb12('0x32')],qs[_0xeb12('0x37')](_0x2d0e41['query'][_0xeb12('0x37')]));_0x2b3717[_0xeb12('0x38')]=_0x2b3717[_0xeb12('0x38')][_0xeb12('0x39')]?_0x2b3717['attributes']:_0x168780['model'];if(!_0x2d0e41[_0xeb12('0x34')]['hasOwnProperty']('nolimit')){_0x2b3717['limit']=qs[_0xeb12('0x20')](_0x2d0e41[_0xeb12('0x34')][_0xeb12('0x20')]);_0x2b3717[_0xeb12('0x23')]=qs[_0xeb12('0x23')](_0x2d0e41[_0xeb12('0x34')][_0xeb12('0x23')]);}_0x2b3717[_0xeb12('0x3a')]=qs[_0xeb12('0x3b')](_0x2d0e41[_0xeb12('0x34')][_0xeb12('0x3b')]);_0x2b3717[_0xeb12('0x3c')]=qs[_0xeb12('0x35')](_[_0xeb12('0x3d')](_0x2d0e41['query'],_0x168780['filters']),_0x3302ff);if(_0x2d0e41['query'][_0xeb12('0x3e')]){_0x2b3717['where']=_[_0xeb12('0x3f')](_0x2b3717['where'],{'$or':_['map'](_0x3302ff,function(_0x53222e){if(_0x53222e['type']!==_0xeb12('0x40')){var _0x464e3b={};_0x464e3b[_0x53222e[_0xeb12('0x29')]]={'$like':'%'+_0x2d0e41[_0xeb12('0x34')][_0xeb12('0x3e')]+'%'};return _0x464e3b;}})});}_0x2b3717=_[_0xeb12('0x3f')]({},_0x2b3717,_0x2d0e41['options']);var _0xa5b1a8={'where':_0x2b3717['where']};return db[_0xeb12('0x2d')]['count'](_0xa5b1a8)['then'](function(_0x56f0a8){_0x497930['count']=_0x56f0a8;if(_0x2d0e41[_0xeb12('0x34')][_0xeb12('0x41')]){_0x2b3717[_0xeb12('0x42')]=[{'all':!![]}];}return db['VtigerAccount'][_0xeb12('0x43')](_0x2b3717);})[_0xeb12('0x28')](function(_0x142029){_0x497930[_0xeb12('0x44')]=_0x142029;return _0x497930;})[_0xeb12('0x28')](respondWithFilteredResult(_0xfca078,_0x2b3717))[_0xeb12('0x45')](handleError(_0xfca078,null));};exports[_0xeb12('0x46')]=function(_0x476720,_0x4c4a09){var _0x3e6540={'raw':![],'where':{'id':_0x476720[_0xeb12('0x47')]['id']}},_0x475152={};_0x475152['model']=_[_0xeb12('0x33')](db[_0xeb12('0x2d')][_0xeb12('0x2e')]);_0x475152[_0xeb12('0x34')]=_['keys'](_0x476720[_0xeb12('0x34')]);_0x475152['filters']=_[_0xeb12('0x36')](_0x475152[_0xeb12('0x32')],_0x475152[_0xeb12('0x34')]);_0x3e6540['attributes']=_[_0xeb12('0x36')](_0x475152[_0xeb12('0x32')],qs[_0xeb12('0x37')](_0x476720[_0xeb12('0x34')][_0xeb12('0x37')]));_0x3e6540[_0xeb12('0x38')]=_0x3e6540[_0xeb12('0x38')][_0xeb12('0x39')]?_0x3e6540['attributes']:_0x475152[_0xeb12('0x32')];if(_0x476720[_0xeb12('0x34')][_0xeb12('0x41')]){_0x3e6540[_0xeb12('0x42')]=[{'all':!![]}];}_0x3e6540=_[_0xeb12('0x3f')]({},_0x3e6540,_0x476720[_0xeb12('0x48')]);return db[_0xeb12('0x2d')][_0xeb12('0x49')](_0x3e6540)[_0xeb12('0x28')](handleEntityNotFound(_0x4c4a09,null))[_0xeb12('0x28')](respondWithResult(_0x4c4a09,null))[_0xeb12('0x45')](handleError(_0x4c4a09,null));};exports[_0xeb12('0x4a')]=function(_0x4dc952,_0x224eb1){return db['VtigerAccount'][_0xeb12('0x4a')](_0x4dc952[_0xeb12('0x4b')],{})[_0xeb12('0x28')](respondWithResult(_0x224eb1,0xc9))['catch'](handleError(_0x224eb1,null));};exports[_0xeb12('0x27')]=function(_0x2432e7,_0x182cda){if(_0x2432e7[_0xeb12('0x4b')]['id']){delete _0x2432e7[_0xeb12('0x4b')]['id'];}return db[_0xeb12('0x2d')][_0xeb12('0x49')]({'where':{'id':_0x2432e7[_0xeb12('0x47')]['id']}})[_0xeb12('0x28')](handleEntityNotFound(_0x182cda,null))[_0xeb12('0x28')](saveUpdates(_0x2432e7[_0xeb12('0x4b')],null))[_0xeb12('0x28')](respondWithResult(_0x182cda,null))[_0xeb12('0x45')](handleError(_0x182cda,null));};exports[_0xeb12('0x4c')]=function(_0x305242,_0x515859){return db[_0xeb12('0x2d')][_0xeb12('0x49')]({'where':{'id':_0x305242[_0xeb12('0x47')]['id']}})[_0xeb12('0x28')](handleEntityNotFound(_0x515859,null))[_0xeb12('0x28')](removeEntity(_0x515859,null))[_0xeb12('0x45')](handleError(_0x515859,null));};exports['getConfigurations']=function(_0x5bdc8f,_0x5191eb,_0xee8b16){var _0xdb5e62={};var _0x52263a={};var _0x58b620;var _0x35ec38;return db[_0xeb12('0x2d')][_0xeb12('0x4d')]({'where':{'id':_0x5bdc8f[_0xeb12('0x47')]['id']}})[_0xeb12('0x28')](handleEntityNotFound(_0x5191eb,null))[_0xeb12('0x28')](function(_0x2386d2){if(_0x2386d2){_0x58b620=_0x2386d2;_0x52263a[_0xeb12('0x32')]=_[_0xeb12('0x33')](db[_0xeb12('0x4e')][_0xeb12('0x2e')]);_0x52263a[_0xeb12('0x34')]=_[_0xeb12('0x33')](_0x5bdc8f[_0xeb12('0x34')]);_0x52263a[_0xeb12('0x35')]=_[_0xeb12('0x36')](_0x52263a[_0xeb12('0x32')],_0x52263a[_0xeb12('0x34')]);_0xdb5e62[_0xeb12('0x38')]=_[_0xeb12('0x36')](_0x52263a[_0xeb12('0x32')],qs['fields'](_0x5bdc8f[_0xeb12('0x34')][_0xeb12('0x37')]));_0xdb5e62[_0xeb12('0x38')]=_0xdb5e62[_0xeb12('0x38')][_0xeb12('0x39')]?_0xdb5e62['attributes']:_0x52263a[_0xeb12('0x32')];_0xdb5e62[_0xeb12('0x3a')]=qs['sort'](_0x5bdc8f[_0xeb12('0x34')][_0xeb12('0x3b')]);_0xdb5e62[_0xeb12('0x3c')]=qs[_0xeb12('0x35')](_['pick'](_0x5bdc8f[_0xeb12('0x34')],_0x52263a[_0xeb12('0x35')]));if(_0x5bdc8f[_0xeb12('0x34')][_0xeb12('0x3e')]){_0xdb5e62[_0xeb12('0x3c')]=_[_0xeb12('0x3f')](_0xdb5e62[_0xeb12('0x3c')],{'$or':_['map'](_0xdb5e62['attributes'],function(_0x42b446){var _0x20fce5={};_0x20fce5[_0x42b446]={'$like':'%'+_0x5bdc8f['query'][_0xeb12('0x3e')]+'%'};return _0x20fce5;})});}_0xdb5e62=_[_0xeb12('0x3f')]({},_0xdb5e62,_0x5bdc8f['options']);return _0x58b620[_0xeb12('0x4f')](_0xdb5e62);}})[_0xeb12('0x28')](function(_0x41b88f){if(_0x41b88f){_0x35ec38=_0x41b88f['length'];if(!_0x5bdc8f[_0xeb12('0x34')][_0xeb12('0x50')]('nolimit')){_0xdb5e62[_0xeb12('0x20')]=qs[_0xeb12('0x20')](_0x5bdc8f[_0xeb12('0x34')]['limit']);_0xdb5e62['offset']=qs[_0xeb12('0x23')](_0x5bdc8f[_0xeb12('0x34')]['offset']);}return _0x58b620[_0xeb12('0x4f')](_0xdb5e62);}})[_0xeb12('0x28')](function(_0x4017df){if(_0x4017df){return _0x4017df?{'count':_0x35ec38,'rows':_0x4017df}:null;}})[_0xeb12('0x28')](respondWithResult(_0x5191eb,null))[_0xeb12('0x45')](handleError(_0x5191eb,null));};exports[_0xeb12('0x51')]=function(_0x5e80e7,_0x182e0c,_0x135be8){if(_0x5e80e7['body']['id']){delete _0x5e80e7[_0xeb12('0x4b')]['id'];}return db['VtigerAccount'][_0xeb12('0x4d')]({'where':{'id':_0x5e80e7[_0xeb12('0x47')]['id']}})[_0xeb12('0x28')](handleEntityNotFound(_0x182e0c,null))[_0xeb12('0x28')](function(_0x1fdab7){if(_0x1fdab7){_0x5e80e7[_0xeb12('0x4b')][_0xeb12('0x52')]=_0x1fdab7['id'];_0x5e80e7['body'][_0xeb12('0x53')]=integrations['getSubjects'](_0x5e80e7[_0xeb12('0x4b')][_0xeb12('0x54')],_0x5e80e7[_0xeb12('0x4b')][_0xeb12('0x30')]);_0x5e80e7[_0xeb12('0x4b')][_0xeb12('0x55')]=integrations[_0xeb12('0x56')](_0x5e80e7['body']['channel'],_0x5e80e7[_0xeb12('0x4b')][_0xeb12('0x30')]);return db[_0xeb12('0x4e')][_0xeb12('0x4a')](_0x5e80e7[_0xeb12('0x4b')],{'include':[{'model':db[_0xeb12('0x57')],'as':'Subjects'},{'model':db['VtigerField'],'as':_0xeb12('0x55')}]});}return null;})['then'](respondWithResult(_0x182e0c,null))[_0xeb12('0x45')](handleError(_0x182e0c,null));};var md5=require(_0xeb12('0x58'));exports[_0xeb12('0x59')]=function(_0x56a9b3,_0x51ff14,_0x1a3a03){var _0x32097e=null;var _0x5d2184=null;var _0x3f0aec=null;var _0x5a4df1=null;var _0x1449dd='';return db[_0xeb12('0x2d')][_0xeb12('0x4d')]({'where':{'id':_0x56a9b3[_0xeb12('0x47')]['id']},'attributes':['id',_0xeb12('0x29'),'username','description',_0xeb12('0x5a'),_0xeb12('0x5b'),_0xeb12('0x5c'),_0xeb12('0x5d')]})[_0xeb12('0x28')](handleEntityNotFound(_0x51ff14,null))[_0xeb12('0x28')](function(_0x674a06){if(_0x674a06){_0x32097e=_0x674a06[_0xeb12('0x5e')];_0x5d2184=_0x674a06['accessKey'];_0x3f0aec=_0x674a06[_0xeb12('0x5a')];_0x1449dd=_0x674a06['remoteUri'];var _0x1b6757=_0x1449dd[_0xeb12('0x5f')](-0x1);if(_0x1b6757==='/'){_0x1449dd=_0x1449dd[_0xeb12('0x60')](0x0,_0x1449dd[_0xeb12('0x61')](_0x1b6757));}_0x5a4df1=util[_0xeb12('0x62')](_0xeb12('0x63'),_0x1449dd);var _0x2543bf={'method':_0xeb12('0x64'),'uri':_0x5a4df1,'qs':{'operation':_0xeb12('0x65'),'username':_0x674a06[_0xeb12('0x5e')]},'json':!![]};return rp(_0x2543bf);}})[_0xeb12('0x28')](function(_0x1c8123){if(_0x1c8123[_0xeb12('0x66')]){var _0xcf6dca={'method':_0xeb12('0x67'),'uri':_0x5a4df1,'form':{'operation':_0xeb12('0x68'),'username':_0x32097e,'accessKey':md5(_0x1c8123[_0xeb12('0x69')][_0xeb12('0x6a')]+_0x5d2184)},'json':!![]};return rp(_0xcf6dca);}})[_0xeb12('0x28')](function(_0x5cef05){if(_0x5cef05['success']){var _0x4a0c91={'method':_0xeb12('0x64'),'uri':_0x5a4df1,'qs':{'operation':_0xeb12('0x6b'),'username':_0x32097e,'sessionName':_0x5cef05[_0xeb12('0x69')][_0xeb12('0x6c')],'elementType':_0x3f0aec},'json':!![]};return rp(_0x4a0c91);}})['then'](function(_0x46a96d){if(_0x46a96d['success']){var _0x167d17=[_0xeb12('0x6d'),_0xeb12('0x6e'),'owner'];_[_0xeb12('0x6f')](_0x46a96d['result'][_0xeb12('0x37')],function(_0x10a10c){return _0x167d17[_0xeb12('0x70')](_0x10a10c[_0xeb12('0x30')]['name']);});_['remove'](_0x46a96d[_0xeb12('0x69')]['fields'],function(_0x1f52ff){return _0x1f52ff['editable']===_0xeb12('0x71');});return{'count':_0x46a96d[_0xeb12('0x69')][_0xeb12('0x37')][_0xeb12('0x39')],'rows':_[_0xeb12('0x2c')](_0x46a96d['result'][_0xeb12('0x37')],function(_0x1d541e){return{'id':_0x1d541e[_0xeb12('0x29')],'name':_0x1d541e[_0xeb12('0x72')],'custom':_['startsWith'](_0x1d541e[_0xeb12('0x29')],_0xeb12('0x73'))?!![]:![],'options':_0x1d541e['type'][_0xeb12('0x29')]===_0xeb12('0x74')&&_0x1d541e[_0xeb12('0x30')]['picklistValues'][_0xeb12('0x39')]>0x0?_[_0xeb12('0x2c')](_0x1d541e[_0xeb12('0x30')][_0xeb12('0x75')],function(_0x33f3fb){return{'name':_0x33f3fb[_0xeb12('0x72')],'value':_0x33f3fb[_0xeb12('0x76')]};}):[]};})};}})['then'](respondWithResult(_0x51ff14,null))[_0xeb12('0x45')](function(_0x274862){console[_0xeb12('0x77')]('vTiger\x20error:\x20'+_0x274862);var _0x4cd6f9=_0x56a9b3[_0xeb12('0x34')]['test']?0x1f4:_0x274862[_0xeb12('0x78')]||0x1f4;logger[_0xeb12('0x79')]('getFields,\x20%s,\x20%s,\x20%s',_0xeb12('0x59'),_0x4cd6f9,JSON[_0xeb12('0x7a')](_0x274862));delete _0x274862['name'];if(_0x4cd6f9===0x191){_0x4cd6f9=0x190;}_0x51ff14['status'](_0x4cd6f9)['send'](_0x56a9b3[_0xeb12('0x34')][_0xeb12('0x7b')]?{'message':_0xeb12('0x7c'),'statusCode':_0x274862[_0xeb12('0x78')]}:_0x274862);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 24dd2e1..c1b4942 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 _0x60e3=['define','VtigerAccount','int_vtiger_accounts','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x43688c,_0x3a89c4){var _0x3f1954=function(_0x2ff878){while(--_0x2ff878){_0x43688c['push'](_0x43688c['shift']());}};_0x3f1954(++_0x3a89c4);}(_0x60e3,0x1bf));var _0x360e=function(_0x3b1a38,_0x3c1a7a){_0x3b1a38=_0x3b1a38-0x0;var _0x50a021=_0x60e3[_0x3b1a38];return _0x50a021;};'use strict';var _=require('lodash');var util=require(_0x360e('0x0'));var logger=require(_0x360e('0x1'))(_0x360e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x360e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x360e('0x4'));var config=require(_0x360e('0x5'));var attributes=require(_0x360e('0x6'));var integrations=require(_0x360e('0x7'));module[_0x360e('0x8')]=function(_0x4eef9a,_0x486237){return _0x4eef9a[_0x360e('0x9')](_0x360e('0xa'),attributes,{'tableName':_0x360e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2551=['define','VtigerAccount','int_vtiger_accounts','bluebird','request-promise','path','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration'];(function(_0x53d709,_0x1906f6){var _0xc1f741=function(_0x5a6643){while(--_0x5a6643){_0x53d709['push'](_0x53d709['shift']());}};_0xc1f741(++_0x1906f6);}(_0x2551,0x1ce));var _0x1255=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x2551[_0x4b7895];return _0x264180;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x1255('0x0'));var rp=require(_0x1255('0x1'));var fs=require('fs');var path=require(_0x1255('0x2'));var rimraf=require('rimraf');var config=require(_0x1255('0x3'));var attributes=require(_0x1255('0x4'));var integrations=require(_0x1255('0x5'));module['exports']=function(_0xeeb8c4,_0x4983e1){return _0xeeb8c4[_0x1255('0x6')](_0x1255('0x7'),attributes,{'tableName':_0x1255('0x8'),'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 cc55b34..5f16e11 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 _0x5ec6=['util','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','attributes','include','map','model','ShowVtigerAccount','find','lodash'];(function(_0x2341ac,_0x219ad7){var _0x265442=function(_0x42c3dd){while(--_0x42c3dd){_0x2341ac['push'](_0x2341ac['shift']());}};_0x265442(++_0x219ad7);}(_0x5ec6,0x7f));var _0x65ec=function(_0x431790,_0x4f1dc9){_0x431790=_0x431790-0x0;var _0x4bb946=_0x5ec6[_0x431790];return _0x4bb946;};'use strict';var _=require(_0x65ec('0x0'));var util=require(_0x65ec('0x1'));var moment=require(_0x65ec('0x2'));var BPromise=require('bluebird');var rs=require(_0x65ec('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x65ec('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x65ec('0x5'))('rpc');var config=require(_0x65ec('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x65ec('0x7')][_0x65ec('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5d6254,_0xb3600b,_0x266254){return new BPromise(function(_0x4f8653,_0x28aa8f){return client[_0x65ec('0x9')](_0x5d6254,_0x266254)[_0x65ec('0xa')](function(_0x50e5c4){logger['info'](_0x65ec('0xb'),_0xb3600b,'request\x20sent');logger[_0x65ec('0xc')](_0x65ec('0xd'),_0xb3600b,'request\x20sent',JSON[_0x65ec('0xe')](_0x50e5c4));if(_0x50e5c4[_0x65ec('0xf')]){if(_0x50e5c4['error'][_0x65ec('0x10')]===0x1f4){logger[_0x65ec('0xf')]('VtigerAccount,\x20%s,\x20%s',_0xb3600b,_0x50e5c4[_0x65ec('0xf')][_0x65ec('0x11')]);return _0x28aa8f(_0x50e5c4[_0x65ec('0xf')][_0x65ec('0x11')]);}logger[_0x65ec('0xf')](_0x65ec('0xb'),_0xb3600b,_0x50e5c4[_0x65ec('0xf')][_0x65ec('0x11')]);return _0x4f8653(_0x50e5c4['error'][_0x65ec('0x11')]);}else{logger[_0x65ec('0x12')](_0x65ec('0xb'),_0xb3600b,'request\x20sent');_0x4f8653(_0x50e5c4['result'][_0x65ec('0x11')]);}})[_0x65ec('0x13')](function(_0xa597d4){logger['error'](_0x65ec('0xb'),_0xb3600b,_0xa597d4);_0x28aa8f(_0xa597d4);});});}exports[_0x65ec('0x14')]=function(_0x1254f8){var _0xb4ed90=this;return new Promise(function(_0x29ebc4,_0xd81ed3){return db[_0x65ec('0x15')][_0x65ec('0x16')]({'raw':_0x1254f8[_0x65ec('0x17')]?_0x1254f8[_0x65ec('0x17')][_0x65ec('0x18')]===undefined?!![]:![]:!![],'where':_0x1254f8[_0x65ec('0x17')]?_0x1254f8[_0x65ec('0x17')][_0x65ec('0x19')]||null:null,'attributes':_0x1254f8[_0x65ec('0x17')]?_0x1254f8[_0x65ec('0x17')][_0x65ec('0x1a')]||null:null,'limit':_0x1254f8[_0x65ec('0x17')]?_0x1254f8[_0x65ec('0x17')]['limit']||null:null,'include':_0x1254f8[_0x65ec('0x17')]?_0x1254f8[_0x65ec('0x17')][_0x65ec('0x1b')]?_[_0x65ec('0x1c')](_0x1254f8[_0x65ec('0x17')][_0x65ec('0x1b')],function(_0x47288d){return{'model':db[_0x47288d['model']],'as':_0x47288d['as'],'attributes':_0x47288d[_0x65ec('0x1a')],'include':_0x47288d[_0x65ec('0x1b')]?_[_0x65ec('0x1c')](_0x47288d[_0x65ec('0x1b')],function(_0x288e66){return{'model':db[_0x288e66[_0x65ec('0x1d')]],'as':_0x288e66['as'],'attributes':_0x288e66[_0x65ec('0x1a')],'include':_0x288e66[_0x65ec('0x1b')]?_[_0x65ec('0x1c')](_0x288e66['include'],function(_0x10baef){return{'model':db[_0x10baef[_0x65ec('0x1d')]],'as':_0x10baef['as'],'attributes':_0x10baef[_0x65ec('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x65ec('0xa')](function(_0x4de451){logger[_0x65ec('0x12')]('GetVtigerAccount',_0x1254f8);logger[_0x65ec('0xc')](_0x65ec('0x14'),_0x1254f8,JSON[_0x65ec('0xe')](_0x4de451));_0x29ebc4(_0x4de451);})[_0x65ec('0x13')](function(_0x14431d){logger[_0x65ec('0xf')](_0x65ec('0x14'),_0x14431d[_0x65ec('0x11')],_0x1254f8);_0xd81ed3(_0xb4ed90[_0x65ec('0xf')](0x1f4,_0x14431d[_0x65ec('0x11')]));});});};exports[_0x65ec('0x1e')]=function(_0x4b435c){var _0x50d81f=this;return new Promise(function(_0x1d2e24,_0x5084af){return db[_0x65ec('0x15')][_0x65ec('0x1f')]({'raw':_0x4b435c['options']?_0x4b435c[_0x65ec('0x17')][_0x65ec('0x18')]===undefined?!![]:![]:!![],'where':_0x4b435c[_0x65ec('0x17')]?_0x4b435c[_0x65ec('0x17')]['where']||null:null,'attributes':_0x4b435c[_0x65ec('0x17')]?_0x4b435c[_0x65ec('0x17')][_0x65ec('0x1a')]||null:null,'include':_0x4b435c[_0x65ec('0x17')]?_0x4b435c[_0x65ec('0x17')][_0x65ec('0x1b')]?_[_0x65ec('0x1c')](_0x4b435c[_0x65ec('0x17')][_0x65ec('0x1b')],function(_0xff3f3c){return{'model':db[_0xff3f3c['model']],'as':_0xff3f3c['as'],'attributes':_0xff3f3c[_0x65ec('0x1a')],'include':_0xff3f3c[_0x65ec('0x1b')]?_['map'](_0xff3f3c[_0x65ec('0x1b')],function(_0x24a242){return{'model':db[_0x24a242[_0x65ec('0x1d')]],'as':_0x24a242['as'],'attributes':_0x24a242[_0x65ec('0x1a')],'include':_0x24a242[_0x65ec('0x1b')]?_[_0x65ec('0x1c')](_0x24a242[_0x65ec('0x1b')],function(_0x5afcfc){return{'model':db[_0x5afcfc[_0x65ec('0x1d')]],'as':_0x5afcfc['as'],'attributes':_0x5afcfc[_0x65ec('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x65ec('0xa')](function(_0x185447){logger['info'](_0x65ec('0x1e'),_0x4b435c);logger[_0x65ec('0xc')](_0x65ec('0x1e'),_0x4b435c,JSON[_0x65ec('0xe')](_0x185447));_0x1d2e24(_0x185447);})['catch'](function(_0x59a1c2){logger[_0x65ec('0xf')]('ShowVtigerAccount',_0x59a1c2[_0x65ec('0x11')],_0x4b435c);_0x5084af(_0x50d81f[_0x65ec('0xf')](0x1f4,_0x59a1c2['message']));});});}; \ No newline at end of file +var _0x0565=['request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','code','message','error','GetVtigerAccount','options','raw','where','attributes','limit','map','model','include','debug','catch','ShowVtigerAccount','VtigerAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s'];(function(_0x2a9ba8,_0x40c6eb){var _0x583752=function(_0x28ab36){while(--_0x28ab36){_0x2a9ba8['push'](_0x2a9ba8['shift']());}};_0x583752(++_0x40c6eb);}(_0x0565,0xf2));var _0x5056=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0x0565[_0x87b0ff];return _0x3bc0b2;};'use strict';var _=require(_0x5056('0x0'));var util=require(_0x5056('0x1'));var moment=require(_0x5056('0x2'));var BPromise=require(_0x5056('0x3'));var rs=require(_0x5056('0x4'));var fs=require('fs');var Redis=require(_0x5056('0x5'));var db=require(_0x5056('0x6'))['db'];var utils=require(_0x5056('0x7'));var logger=require(_0x5056('0x8'))(_0x5056('0x9'));var config=require('../../config/environment');var jayson=require(_0x5056('0xa'));var client=jayson[_0x5056('0xb')][_0x5056('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x22afb7,_0x4b8280,_0x52b01f){return new BPromise(function(_0x38f74,_0x223c92){return client[_0x5056('0xd')](_0x22afb7,_0x52b01f)[_0x5056('0xe')](function(_0x2144a9){logger[_0x5056('0xf')](_0x5056('0x10'),_0x4b8280,_0x5056('0x11'));logger['debug'](_0x5056('0x12'),_0x4b8280,_0x5056('0x11'),JSON[_0x5056('0x13')](_0x2144a9));if(_0x2144a9['error']){if(_0x2144a9['error'][_0x5056('0x14')]===0x1f4){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x4b8280,_0x2144a9['error'][_0x5056('0x15')]);return _0x223c92(_0x2144a9['error'][_0x5056('0x15')]);}logger[_0x5056('0x16')](_0x5056('0x10'),_0x4b8280,_0x2144a9['error'][_0x5056('0x15')]);return _0x38f74(_0x2144a9[_0x5056('0x16')][_0x5056('0x15')]);}else{logger[_0x5056('0xf')](_0x5056('0x10'),_0x4b8280,_0x5056('0x11'));_0x38f74(_0x2144a9['result'][_0x5056('0x15')]);}})['catch'](function(_0x43db77){logger[_0x5056('0x16')](_0x5056('0x10'),_0x4b8280,_0x43db77);_0x223c92(_0x43db77);});});}exports[_0x5056('0x17')]=function(_0x4056ce){var _0x51b21e=this;return new Promise(function(_0x9ea88,_0x56537e){return db['VtigerAccount']['findAll']({'raw':_0x4056ce[_0x5056('0x18')]?_0x4056ce[_0x5056('0x18')][_0x5056('0x19')]===undefined?!![]:![]:!![],'where':_0x4056ce[_0x5056('0x18')]?_0x4056ce[_0x5056('0x18')][_0x5056('0x1a')]||null:null,'attributes':_0x4056ce[_0x5056('0x18')]?_0x4056ce['options'][_0x5056('0x1b')]||null:null,'limit':_0x4056ce[_0x5056('0x18')]?_0x4056ce['options'][_0x5056('0x1c')]||null:null,'include':_0x4056ce[_0x5056('0x18')]?_0x4056ce[_0x5056('0x18')]['include']?_[_0x5056('0x1d')](_0x4056ce[_0x5056('0x18')]['include'],function(_0x4a64be){return{'model':db[_0x4a64be[_0x5056('0x1e')]],'as':_0x4a64be['as'],'attributes':_0x4a64be[_0x5056('0x1b')],'include':_0x4a64be[_0x5056('0x1f')]?_[_0x5056('0x1d')](_0x4a64be['include'],function(_0x267048){return{'model':db[_0x267048[_0x5056('0x1e')]],'as':_0x267048['as'],'attributes':_0x267048['attributes'],'include':_0x267048[_0x5056('0x1f')]?_['map'](_0x267048[_0x5056('0x1f')],function(_0x39d539){return{'model':db[_0x39d539[_0x5056('0x1e')]],'as':_0x39d539['as'],'attributes':_0x39d539[_0x5056('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5056('0xe')](function(_0x50f2a8){logger[_0x5056('0xf')](_0x5056('0x17'),_0x4056ce);logger[_0x5056('0x20')](_0x5056('0x17'),_0x4056ce,JSON['stringify'](_0x50f2a8));_0x9ea88(_0x50f2a8);})[_0x5056('0x21')](function(_0x5b0270){logger[_0x5056('0x16')]('GetVtigerAccount',_0x5b0270['message'],_0x4056ce);_0x56537e(_0x51b21e['error'](0x1f4,_0x5b0270[_0x5056('0x15')]));});});};exports[_0x5056('0x22')]=function(_0x482939){var _0x27f4be=this;return new Promise(function(_0x2c5728,_0x9e2986){return db[_0x5056('0x23')][_0x5056('0x24')]({'raw':_0x482939[_0x5056('0x18')]?_0x482939[_0x5056('0x18')][_0x5056('0x19')]===undefined?!![]:![]:!![],'where':_0x482939[_0x5056('0x18')]?_0x482939[_0x5056('0x18')][_0x5056('0x1a')]||null:null,'attributes':_0x482939['options']?_0x482939['options'][_0x5056('0x1b')]||null:null,'include':_0x482939[_0x5056('0x18')]?_0x482939['options'][_0x5056('0x1f')]?_[_0x5056('0x1d')](_0x482939['options'][_0x5056('0x1f')],function(_0x378b33){return{'model':db[_0x378b33[_0x5056('0x1e')]],'as':_0x378b33['as'],'attributes':_0x378b33[_0x5056('0x1b')],'include':_0x378b33[_0x5056('0x1f')]?_[_0x5056('0x1d')](_0x378b33[_0x5056('0x1f')],function(_0x2f1d27){return{'model':db[_0x2f1d27[_0x5056('0x1e')]],'as':_0x2f1d27['as'],'attributes':_0x2f1d27[_0x5056('0x1b')],'include':_0x2f1d27[_0x5056('0x1f')]?_[_0x5056('0x1d')](_0x2f1d27[_0x5056('0x1f')],function(_0x3d7d78){return{'model':db[_0x3d7d78[_0x5056('0x1e')]],'as':_0x3d7d78['as'],'attributes':_0x3d7d78['attributes']};}):[]};}):[]};}):[]:[]})[_0x5056('0xe')](function(_0x483d1e){logger[_0x5056('0xf')](_0x5056('0x22'),_0x482939);logger[_0x5056('0x20')](_0x5056('0x22'),_0x482939,JSON['stringify'](_0x483d1e));_0x2c5728(_0x483d1e);})[_0x5056('0x21')](function(_0x32fecc){logger['error'](_0x5056('0x22'),_0x32fecc['message'],_0x482939);_0x9e2986(_0x27f4be[_0x5056('0x16')](0x1f4,_0x32fecc[_0x5056('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index a860605..7e60429 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 _0xdcde=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x3c11a0,_0x88755d){var _0x40178a=function(_0x25d0d6){while(--_0x25d0d6){_0x3c11a0['push'](_0x3c11a0['shift']());}};_0x40178a(++_0x88755d);}(_0xdcde,0xd6));var _0xedcd=function(_0x5da83d,_0x3815bb){_0x5da83d=_0x5da83d-0x0;var _0x67238=_0xdcde[_0x5da83d];return _0x67238;};'use strict';var multer=require(_0xedcd('0x0'));var util=require(_0xedcd('0x1'));var path=require('path');var timeout=require(_0xedcd('0x2'));var express=require(_0xedcd('0x3'));var router=express[_0xedcd('0x4')]();var fs_extra=require(_0xedcd('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xedcd('0x6'));var config=require(_0xedcd('0x7'));var controller=require(_0xedcd('0x8'));router[_0xedcd('0x9')]('/',auth[_0xedcd('0xa')](),controller[_0xedcd('0xb')]);router[_0xedcd('0x9')](_0xedcd('0xc'),auth[_0xedcd('0xa')](),controller[_0xedcd('0xd')]);router['get'](_0xedcd('0xe'),auth[_0xedcd('0xa')](),controller[_0xedcd('0xf')]);router[_0xedcd('0x9')](_0xedcd('0x10'),auth[_0xedcd('0xa')](),controller[_0xedcd('0x11')]);router[_0xedcd('0x9')](_0xedcd('0x12'),auth['isAuthenticated'](),controller[_0xedcd('0x13')]);router[_0xedcd('0x14')]('/',auth[_0xedcd('0xa')](),controller[_0xedcd('0x15')]);router[_0xedcd('0x16')](_0xedcd('0xc'),auth['isAuthenticated'](),controller[_0xedcd('0x17')]);router[_0xedcd('0x18')](_0xedcd('0xc'),auth[_0xedcd('0xa')](),controller[_0xedcd('0x19')]);module[_0xedcd('0x1a')]=router; \ No newline at end of file +var _0xf5c9=['delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','./intVtigerConfiguration.controller','isAuthenticated','get','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','update'];(function(_0x2d0375,_0x164216){var _0x548009=function(_0x5bc59a){while(--_0x5bc59a){_0x2d0375['push'](_0x2d0375['shift']());}};_0x548009(++_0x164216);}(_0xf5c9,0xe9));var _0x9f5c=function(_0x20f1d0,_0x1bca7a){_0x20f1d0=_0x20f1d0-0x0;var _0x5180b4=_0xf5c9[_0x20f1d0];return _0x5180b4;};'use strict';var multer=require(_0x9f5c('0x0'));var util=require('util');var path=require(_0x9f5c('0x1'));var timeout=require(_0x9f5c('0x2'));var express=require(_0x9f5c('0x3'));var router=express[_0x9f5c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9f5c('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9f5c('0x6'));router['get']('/',auth[_0x9f5c('0x7')](),controller['index']);router[_0x9f5c('0x8')](_0x9f5c('0x9'),auth[_0x9f5c('0x7')](),controller[_0x9f5c('0xa')]);router['get'](_0x9f5c('0xb'),auth['isAuthenticated'](),controller['getFields']);router[_0x9f5c('0x8')](_0x9f5c('0xc'),auth[_0x9f5c('0x7')](),controller[_0x9f5c('0xd')]);router['get'](_0x9f5c('0xe'),auth[_0x9f5c('0x7')](),controller[_0x9f5c('0xf')]);router[_0x9f5c('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9f5c('0x11')](_0x9f5c('0x9'),auth[_0x9f5c('0x7')](),controller[_0x9f5c('0x12')]);router[_0x9f5c('0x13')](_0x9f5c('0x9'),auth['isAuthenticated'](),controller[_0x9f5c('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index c9bb4a4..76247fd 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 _0x7bf6=['exports','STRING','sequelize'];(function(_0xbe5db9,_0x33e19b){var _0x165e98=function(_0x363507){while(--_0x363507){_0xbe5db9['push'](_0xbe5db9['shift']());}};_0x165e98(++_0x33e19b);}(_0x7bf6,0xaa));var _0x67bf=function(_0x1d1cc2,_0x299f8d){_0x1d1cc2=_0x1d1cc2-0x0;var _0x1476f6=_0x7bf6[_0x1d1cc2];return _0x1476f6;};'use strict';var Sequelize=require(_0x67bf('0x0'));module[_0x67bf('0x1')]={'name':{'type':Sequelize[_0x67bf('0x2')]},'description':{'type':Sequelize[_0x67bf('0x2')]}}; \ No newline at end of file +var _0x5385=['sequelize','STRING'];(function(_0x5627e1,_0x1b2dbf){var _0x2f013f=function(_0x142015){while(--_0x142015){_0x5627e1['push'](_0x5627e1['shift']());}};_0x2f013f(++_0x1b2dbf);}(_0x5385,0x18a));var _0x5538=function(_0xf1a201,_0x331c12){_0xf1a201=_0xf1a201-0x0;var _0x7de137=_0x5385[_0xf1a201];return _0x7de137;};'use strict';var Sequelize=require(_0x5538('0x0'));module['exports']={'name':{'type':Sequelize[_0x5538('0x1')]},'description':{'type':Sequelize[_0x5538('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 2241c57..9871f0e 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 _0xa6e6=['bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','set','apply','reject','save','update','then','destroy','error','stack','name','status','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','limit','order','pick','filter','where','merge','VIRTUAL','options','includeAll','include','VtigerConfiguration','findAll','show','params','keys','find','catch','create','body','getFields','findOne','VtigerField','sort','getSubjects','getDescriptions','eml-format','zip-dir','moment'];(function(_0x53e787,_0x4298e6){var _0x2781a0=function(_0x21f861){while(--_0x21f861){_0x53e787['push'](_0x53e787['shift']());}};_0x2781a0(++_0x4298e6);}(_0xa6e6,0x183));var _0x6a6e=function(_0x3b5ad9,_0x223867){_0x3b5ad9=_0x3b5ad9-0x0;var _0x611ae9=_0xa6e6[_0x3b5ad9];return _0x611ae9;};'use strict';var emlformat=require(_0x6a6e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6a6e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6a6e('0x2'));var BPromise=require(_0x6a6e('0x3'));var Mustache=require(_0x6a6e('0x4'));var util=require(_0x6a6e('0x5'));var path=require(_0x6a6e('0x6'));var sox=require(_0x6a6e('0x7'));var csv=require('to-csv');var ejs=require(_0x6a6e('0x8'));var fs=require('fs');var fs_extra=require(_0x6a6e('0x9'));var _=require(_0x6a6e('0xa'));var squel=require('squel');var crypto=require(_0x6a6e('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x6a6e('0xc'));var toCsv=require(_0x6a6e('0xd'));var querystring=require(_0x6a6e('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6a6e('0xf'));var as=require(_0x6a6e('0x10'));var hardwareService=require(_0x6a6e('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x6a6e('0x12'));var config=require(_0x6a6e('0x13'));var licenseUtil=require(_0x6a6e('0x14'));var db=require(_0x6a6e('0x15'))['db'];function respondWithStatusCode(_0x4e8576,_0x1fe1cb){_0x1fe1cb=_0x1fe1cb||0xcc;return function(_0x3cdf0a){if(_0x3cdf0a){return _0x4e8576[_0x6a6e('0x16')](_0x1fe1cb);}return _0x4e8576['status'](_0x1fe1cb)[_0x6a6e('0x17')]();};}function respondWithResult(_0x14fde1,_0x5a204d){_0x5a204d=_0x5a204d||0xc8;return function(_0x3bf167){if(_0x3bf167){return _0x14fde1['status'](_0x5a204d)[_0x6a6e('0x18')](_0x3bf167);}};}function respondWithFilteredResult(_0x1c4497,_0x171e28){return function(_0x5ba627){if(_0x5ba627){var _0x4f7ecf=typeof _0x171e28[_0x6a6e('0x19')]===_0x6a6e('0x1a')&&typeof _0x171e28['limit']===_0x6a6e('0x1a');var _0x7be14f=_0x5ba627[_0x6a6e('0x1b')];var _0x2f11c9=_0x4f7ecf?0x0:_0x171e28['offset'];var _0x160f6d=_0x4f7ecf?_0x5ba627[_0x6a6e('0x1b')]:_0x171e28[_0x6a6e('0x19')]+_0x171e28['limit'];var _0x5e6821;if(_0x160f6d>=_0x7be14f){_0x160f6d=_0x7be14f;_0x5e6821=0xc8;}else{_0x5e6821=0xce;}_0x1c4497['status'](_0x5e6821);return _0x1c4497[_0x6a6e('0x1c')]('Content-Range',_0x2f11c9+'-'+_0x160f6d+'/'+_0x7be14f)['json'](_0x5ba627);}return null;};}function patchUpdates(_0x485594){return function(_0x39f1c1){try{jsonpatch[_0x6a6e('0x1d')](_0x39f1c1,_0x485594,!![]);}catch(_0x4edb3e){return BPromise[_0x6a6e('0x1e')](_0x4edb3e);}return _0x39f1c1[_0x6a6e('0x1f')]();};}function saveUpdates(_0x388306,_0x40581c){return function(_0x482f5a){if(_0x482f5a){return _0x482f5a[_0x6a6e('0x20')](_0x388306)[_0x6a6e('0x21')](function(_0x4b4eb5){return _0x4b4eb5;});}return null;};}function removeEntity(_0x4c0718,_0x4d197f){return function(_0x2b7645){if(_0x2b7645){return _0x2b7645[_0x6a6e('0x22')]()['then'](function(){_0x4c0718['status'](0xcc)[_0x6a6e('0x17')]();});}};}function handleEntityNotFound(_0x5976f9,_0xaf3ddb){return function(_0x1246d8){if(!_0x1246d8){_0x5976f9[_0x6a6e('0x16')](0x194);}return _0x1246d8;};}function handleError(_0x3f4a62,_0x115de2){_0x115de2=_0x115de2||0x1f4;return function(_0x3a3aa7){logger[_0x6a6e('0x23')](_0x3a3aa7[_0x6a6e('0x24')]);if(_0x3a3aa7[_0x6a6e('0x25')]){delete _0x3a3aa7[_0x6a6e('0x25')];}_0x3f4a62[_0x6a6e('0x26')](_0x115de2)['send'](_0x3a3aa7);};}exports[_0x6a6e('0x27')]=function(_0xc7b968,_0x4244fe){var _0x4820db={},_0x2673c4={},_0x131fff={'count':0x0,'rows':[]};var _0x9403c4=_[_0x6a6e('0x28')](db['VtigerConfiguration'][_0x6a6e('0x29')],function(_0x3d1f81){return{'name':_0x3d1f81[_0x6a6e('0x2a')],'type':_0x3d1f81[_0x6a6e('0x2b')][_0x6a6e('0x2c')]};});_0x2673c4[_0x6a6e('0x2d')]=_[_0x6a6e('0x28')](_0x9403c4,'name');_0x2673c4[_0x6a6e('0x2e')]=_['keys'](_0xc7b968['query']);_0x2673c4[_0x6a6e('0x2f')]=_[_0x6a6e('0x30')](_0x2673c4[_0x6a6e('0x2d')],_0x2673c4[_0x6a6e('0x2e')]);_0x4820db['attributes']=_[_0x6a6e('0x30')](_0x2673c4[_0x6a6e('0x2d')],qs['fields'](_0xc7b968['query'][_0x6a6e('0x31')]));_0x4820db[_0x6a6e('0x32')]=_0x4820db[_0x6a6e('0x32')][_0x6a6e('0x33')]?_0x4820db['attributes']:_0x2673c4[_0x6a6e('0x2d')];if(!_0xc7b968[_0x6a6e('0x2e')]['hasOwnProperty'](_0x6a6e('0x34'))){_0x4820db[_0x6a6e('0x35')]=qs[_0x6a6e('0x35')](_0xc7b968[_0x6a6e('0x2e')]['limit']);_0x4820db[_0x6a6e('0x19')]=qs['offset'](_0xc7b968[_0x6a6e('0x2e')]['offset']);}_0x4820db[_0x6a6e('0x36')]=qs['sort'](_0xc7b968[_0x6a6e('0x2e')]['sort']);_0x4820db['where']=qs[_0x6a6e('0x2f')](_[_0x6a6e('0x37')](_0xc7b968['query'],_0x2673c4[_0x6a6e('0x2f')]),_0x9403c4);if(_0xc7b968[_0x6a6e('0x2e')][_0x6a6e('0x38')]){_0x4820db[_0x6a6e('0x39')]=_[_0x6a6e('0x3a')](_0x4820db[_0x6a6e('0x39')],{'$or':_[_0x6a6e('0x28')](_0x9403c4,function(_0x164ed9){if(_0x164ed9['type']!==_0x6a6e('0x3b')){var _0x568657={};_0x568657[_0x164ed9[_0x6a6e('0x25')]]={'$like':'%'+_0xc7b968[_0x6a6e('0x2e')][_0x6a6e('0x38')]+'%'};return _0x568657;}})});}_0x4820db=_['merge']({},_0x4820db,_0xc7b968[_0x6a6e('0x3c')]);var _0x3a901c={'where':_0x4820db[_0x6a6e('0x39')]};return db['VtigerConfiguration'][_0x6a6e('0x1b')](_0x3a901c)['then'](function(_0x9dd9ae){_0x131fff[_0x6a6e('0x1b')]=_0x9dd9ae;if(_0xc7b968[_0x6a6e('0x2e')][_0x6a6e('0x3d')]){_0x4820db[_0x6a6e('0x3e')]=[{'all':!![]}];}return db[_0x6a6e('0x3f')][_0x6a6e('0x40')](_0x4820db);})[_0x6a6e('0x21')](function(_0x3b3f11){_0x131fff['rows']=_0x3b3f11;return _0x131fff;})[_0x6a6e('0x21')](respondWithFilteredResult(_0x4244fe,_0x4820db))['catch'](handleError(_0x4244fe,null));};exports[_0x6a6e('0x41')]=function(_0x4ea1d3,_0x460275){var _0x1e8d2a={'raw':![],'where':{'id':_0x4ea1d3[_0x6a6e('0x42')]['id']}},_0xd233c={};_0xd233c[_0x6a6e('0x2d')]=_['keys'](db[_0x6a6e('0x3f')][_0x6a6e('0x29')]);_0xd233c[_0x6a6e('0x2e')]=_[_0x6a6e('0x43')](_0x4ea1d3[_0x6a6e('0x2e')]);_0xd233c['filters']=_[_0x6a6e('0x30')](_0xd233c[_0x6a6e('0x2d')],_0xd233c[_0x6a6e('0x2e')]);_0x1e8d2a[_0x6a6e('0x32')]=_['intersection'](_0xd233c['model'],qs[_0x6a6e('0x31')](_0x4ea1d3[_0x6a6e('0x2e')]['fields']));_0x1e8d2a[_0x6a6e('0x32')]=_0x1e8d2a['attributes'][_0x6a6e('0x33')]?_0x1e8d2a[_0x6a6e('0x32')]:_0xd233c[_0x6a6e('0x2d')];if(_0x4ea1d3[_0x6a6e('0x2e')][_0x6a6e('0x3d')]){_0x1e8d2a[_0x6a6e('0x3e')]=[{'all':!![]}];}_0x1e8d2a=_['merge']({},_0x1e8d2a,_0x4ea1d3['options']);return db[_0x6a6e('0x3f')][_0x6a6e('0x44')](_0x1e8d2a)[_0x6a6e('0x21')](handleEntityNotFound(_0x460275,null))[_0x6a6e('0x21')](respondWithResult(_0x460275,null))[_0x6a6e('0x45')](handleError(_0x460275,null));};exports[_0x6a6e('0x46')]=function(_0x4f2a67,_0x3e5d47){return db['VtigerConfiguration'][_0x6a6e('0x46')](_0x4f2a67[_0x6a6e('0x47')],{})[_0x6a6e('0x21')](respondWithResult(_0x3e5d47,0xc9))[_0x6a6e('0x45')](handleError(_0x3e5d47,null));};exports[_0x6a6e('0x20')]=function(_0x3c4dfb,_0x29d4d1){if(_0x3c4dfb[_0x6a6e('0x47')]['id']){delete _0x3c4dfb[_0x6a6e('0x47')]['id'];}return db[_0x6a6e('0x3f')][_0x6a6e('0x44')]({'where':{'id':_0x3c4dfb[_0x6a6e('0x42')]['id']}})[_0x6a6e('0x21')](handleEntityNotFound(_0x29d4d1,null))['then'](saveUpdates(_0x3c4dfb[_0x6a6e('0x47')],null))[_0x6a6e('0x21')](respondWithResult(_0x29d4d1,null))[_0x6a6e('0x45')](handleError(_0x29d4d1,null));};exports['destroy']=function(_0x525559,_0x11088d){return db[_0x6a6e('0x3f')][_0x6a6e('0x44')]({'where':{'id':_0x525559['params']['id']}})[_0x6a6e('0x21')](handleEntityNotFound(_0x11088d,null))[_0x6a6e('0x21')](removeEntity(_0x11088d,null))[_0x6a6e('0x45')](handleError(_0x11088d,null));};exports[_0x6a6e('0x48')]=function(_0x1f8881,_0xbbd037,_0xb2106c){var _0x42940b={};var _0x1be2db={};var _0x5995b4;var _0x507403;return db['VtigerConfiguration'][_0x6a6e('0x49')]({'where':{'id':_0x1f8881[_0x6a6e('0x42')]['id']}})[_0x6a6e('0x21')](handleEntityNotFound(_0xbbd037,null))[_0x6a6e('0x21')](function(_0x32a853){if(_0x32a853){_0x5995b4=_0x32a853;_0x1be2db[_0x6a6e('0x2d')]=_['keys'](db[_0x6a6e('0x4a')][_0x6a6e('0x29')]);_0x1be2db['query']=_[_0x6a6e('0x43')](_0x1f8881[_0x6a6e('0x2e')]);_0x1be2db[_0x6a6e('0x2f')]=_['intersection'](_0x1be2db[_0x6a6e('0x2d')],_0x1be2db[_0x6a6e('0x2e')]);_0x42940b['attributes']=_[_0x6a6e('0x30')](_0x1be2db['model'],qs[_0x6a6e('0x31')](_0x1f8881['query']['fields']));_0x42940b[_0x6a6e('0x32')]=_0x42940b[_0x6a6e('0x32')][_0x6a6e('0x33')]?_0x42940b[_0x6a6e('0x32')]:_0x1be2db[_0x6a6e('0x2d')];_0x42940b[_0x6a6e('0x36')]=qs['sort'](_0x1f8881[_0x6a6e('0x2e')][_0x6a6e('0x4b')]);_0x42940b[_0x6a6e('0x39')]=qs[_0x6a6e('0x2f')](_[_0x6a6e('0x37')](_0x1f8881[_0x6a6e('0x2e')],_0x1be2db[_0x6a6e('0x2f')]));if(_0x1f8881['query'][_0x6a6e('0x38')]){_0x42940b[_0x6a6e('0x39')]=_[_0x6a6e('0x3a')](_0x42940b[_0x6a6e('0x39')],{'$or':_[_0x6a6e('0x28')](_0x42940b[_0x6a6e('0x32')],function(_0x1013cc){var _0x486bda={};_0x486bda[_0x1013cc]={'$like':'%'+_0x1f8881[_0x6a6e('0x2e')][_0x6a6e('0x38')]+'%'};return _0x486bda;})});}_0x42940b=_['merge']({},_0x42940b,_0x1f8881[_0x6a6e('0x3c')]);return _0x5995b4[_0x6a6e('0x48')](_0x42940b);}})[_0x6a6e('0x21')](function(_0x32ce7d){if(_0x32ce7d){_0x507403=_0x32ce7d[_0x6a6e('0x33')];if(!_0x1f8881[_0x6a6e('0x2e')]['hasOwnProperty'](_0x6a6e('0x34'))){_0x42940b[_0x6a6e('0x35')]=qs[_0x6a6e('0x35')](_0x1f8881[_0x6a6e('0x2e')][_0x6a6e('0x35')]);_0x42940b[_0x6a6e('0x19')]=qs[_0x6a6e('0x19')](_0x1f8881[_0x6a6e('0x2e')][_0x6a6e('0x19')]);}return _0x5995b4['getFields'](_0x42940b);}})[_0x6a6e('0x21')](function(_0x4be44a){if(_0x4be44a){return _0x4be44a?{'count':_0x507403,'rows':_0x4be44a}:null;}})[_0x6a6e('0x21')](respondWithResult(_0xbbd037,null))[_0x6a6e('0x45')](handleError(_0xbbd037,null));};exports[_0x6a6e('0x4c')]=function(_0x807474,_0x3dd9e1,_0x243ef0){var _0x5b18dc={};var _0x3c4c5f={};var _0x337a49;var _0x5b45b4;return db[_0x6a6e('0x3f')][_0x6a6e('0x49')]({'where':{'id':_0x807474['params']['id']}})['then'](handleEntityNotFound(_0x3dd9e1,null))[_0x6a6e('0x21')](function(_0x52dd39){if(_0x52dd39){_0x337a49=_0x52dd39;_0x3c4c5f['model']=_[_0x6a6e('0x43')](db[_0x6a6e('0x4a')]['rawAttributes']);_0x3c4c5f[_0x6a6e('0x2e')]=_[_0x6a6e('0x43')](_0x807474[_0x6a6e('0x2e')]);_0x3c4c5f[_0x6a6e('0x2f')]=_[_0x6a6e('0x30')](_0x3c4c5f[_0x6a6e('0x2d')],_0x3c4c5f[_0x6a6e('0x2e')]);_0x5b18dc[_0x6a6e('0x32')]=_[_0x6a6e('0x30')](_0x3c4c5f[_0x6a6e('0x2d')],qs['fields'](_0x807474[_0x6a6e('0x2e')][_0x6a6e('0x31')]));_0x5b18dc['attributes']=_0x5b18dc['attributes'][_0x6a6e('0x33')]?_0x5b18dc[_0x6a6e('0x32')]:_0x3c4c5f[_0x6a6e('0x2d')];_0x5b18dc[_0x6a6e('0x36')]=qs[_0x6a6e('0x4b')](_0x807474[_0x6a6e('0x2e')][_0x6a6e('0x4b')]);_0x5b18dc[_0x6a6e('0x39')]=qs[_0x6a6e('0x2f')](_[_0x6a6e('0x37')](_0x807474['query'],_0x3c4c5f[_0x6a6e('0x2f')]));if(_0x807474[_0x6a6e('0x2e')][_0x6a6e('0x38')]){_0x5b18dc[_0x6a6e('0x39')]=_[_0x6a6e('0x3a')](_0x5b18dc[_0x6a6e('0x39')],{'$or':_[_0x6a6e('0x28')](_0x5b18dc['attributes'],function(_0x382431){var _0x7c9da1={};_0x7c9da1[_0x382431]={'$like':'%'+_0x807474[_0x6a6e('0x2e')][_0x6a6e('0x38')]+'%'};return _0x7c9da1;})});}_0x5b18dc=_[_0x6a6e('0x3a')]({},_0x5b18dc,_0x807474['options']);return _0x337a49[_0x6a6e('0x4c')](_0x5b18dc);}})[_0x6a6e('0x21')](function(_0xa8fb27){if(_0xa8fb27){_0x5b45b4=_0xa8fb27[_0x6a6e('0x33')];if(!_0x807474[_0x6a6e('0x2e')]['hasOwnProperty'](_0x6a6e('0x34'))){_0x5b18dc[_0x6a6e('0x35')]=qs['limit'](_0x807474[_0x6a6e('0x2e')][_0x6a6e('0x35')]);_0x5b18dc[_0x6a6e('0x19')]=qs[_0x6a6e('0x19')](_0x807474['query']['offset']);}return _0x337a49[_0x6a6e('0x4c')](_0x5b18dc);}})[_0x6a6e('0x21')](function(_0x8fcc78){if(_0x8fcc78){return _0x8fcc78?{'count':_0x5b45b4,'rows':_0x8fcc78}:null;}})[_0x6a6e('0x21')](respondWithResult(_0x3dd9e1,null))[_0x6a6e('0x45')](handleError(_0x3dd9e1,null));};exports[_0x6a6e('0x4d')]=function(_0x260d1c,_0x334775,_0x4aedad){var _0x29b791={};var _0x2d1222={};var _0x3058fd;var _0x540f86;return db[_0x6a6e('0x3f')]['findOne']({'where':{'id':_0x260d1c[_0x6a6e('0x42')]['id']}})['then'](handleEntityNotFound(_0x334775,null))[_0x6a6e('0x21')](function(_0x4f0f28){if(_0x4f0f28){_0x3058fd=_0x4f0f28;_0x2d1222['model']=_[_0x6a6e('0x43')](db[_0x6a6e('0x4a')]['rawAttributes']);_0x2d1222[_0x6a6e('0x2e')]=_[_0x6a6e('0x43')](_0x260d1c[_0x6a6e('0x2e')]);_0x2d1222[_0x6a6e('0x2f')]=_[_0x6a6e('0x30')](_0x2d1222[_0x6a6e('0x2d')],_0x2d1222[_0x6a6e('0x2e')]);_0x29b791['attributes']=_['intersection'](_0x2d1222[_0x6a6e('0x2d')],qs[_0x6a6e('0x31')](_0x260d1c[_0x6a6e('0x2e')][_0x6a6e('0x31')]));_0x29b791[_0x6a6e('0x32')]=_0x29b791[_0x6a6e('0x32')][_0x6a6e('0x33')]?_0x29b791[_0x6a6e('0x32')]:_0x2d1222['model'];_0x29b791[_0x6a6e('0x36')]=qs[_0x6a6e('0x4b')](_0x260d1c[_0x6a6e('0x2e')][_0x6a6e('0x4b')]);_0x29b791[_0x6a6e('0x39')]=qs['filters'](_['pick'](_0x260d1c[_0x6a6e('0x2e')],_0x2d1222[_0x6a6e('0x2f')]));if(_0x260d1c[_0x6a6e('0x2e')][_0x6a6e('0x38')]){_0x29b791[_0x6a6e('0x39')]=_['merge'](_0x29b791[_0x6a6e('0x39')],{'$or':_[_0x6a6e('0x28')](_0x29b791['attributes'],function(_0x8462d1){var _0x1650a0={};_0x1650a0[_0x8462d1]={'$like':'%'+_0x260d1c['query'][_0x6a6e('0x38')]+'%'};return _0x1650a0;})});}_0x29b791=_['merge']({},_0x29b791,_0x260d1c[_0x6a6e('0x3c')]);return _0x3058fd[_0x6a6e('0x4d')](_0x29b791);}})[_0x6a6e('0x21')](function(_0x41924b){if(_0x41924b){_0x540f86=_0x41924b[_0x6a6e('0x33')];if(!_0x260d1c[_0x6a6e('0x2e')]['hasOwnProperty'](_0x6a6e('0x34'))){_0x29b791[_0x6a6e('0x35')]=qs[_0x6a6e('0x35')](_0x260d1c[_0x6a6e('0x2e')][_0x6a6e('0x35')]);_0x29b791[_0x6a6e('0x19')]=qs['offset'](_0x260d1c[_0x6a6e('0x2e')]['offset']);}return _0x3058fd[_0x6a6e('0x4d')](_0x29b791);}})[_0x6a6e('0x21')](function(_0x1a74a0){if(_0x1a74a0){return _0x1a74a0?{'count':_0x540f86,'rows':_0x1a74a0}:null;}})[_0x6a6e('0x21')](respondWithResult(_0x334775,null))['catch'](handleError(_0x334775,null));}; \ No newline at end of file +var _0xd0b1=['include','findAll','rows','catch','show','params','keys','rawAttributes','fields','find','create','update','body','getFields','findOne','VtigerField','length','options','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','map','VtigerConfiguration','key','model','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x1699e9,_0x1f2652){var _0x14b104=function(_0x319079){while(--_0x319079){_0x1699e9['push'](_0x1699e9['shift']());}};_0x14b104(++_0x1f2652);}(_0xd0b1,0x64));var _0x1d0b=function(_0x291cf5,_0x33f30b){_0x291cf5=_0x291cf5-0x0;var _0x2eabf8=_0xd0b1[_0x291cf5];return _0x2eabf8;};'use strict';var emlformat=require(_0x1d0b('0x0'));var rimraf=require(_0x1d0b('0x1'));var zipdir=require(_0x1d0b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1d0b('0x3'));var moment=require(_0x1d0b('0x4'));var BPromise=require(_0x1d0b('0x5'));var Mustache=require(_0x1d0b('0x6'));var util=require(_0x1d0b('0x7'));var path=require('path');var sox=require(_0x1d0b('0x8'));var csv=require(_0x1d0b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1d0b('0xa'));var _=require(_0x1d0b('0xb'));var squel=require(_0x1d0b('0xc'));var crypto=require('crypto');var jsforce=require(_0x1d0b('0xd'));var deskjs=require(_0x1d0b('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1d0b('0xf'));var authService=require(_0x1d0b('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x1d0b('0x11'));var hardwareService=require(_0x1d0b('0x12'));var logger=require(_0x1d0b('0x13'))(_0x1d0b('0x14'));var utils=require(_0x1d0b('0x15'));var config=require(_0x1d0b('0x16'));var licenseUtil=require(_0x1d0b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x32817c,_0x94ed14){_0x94ed14=_0x94ed14||0xcc;return function(_0x1d15d4){if(_0x1d15d4){return _0x32817c[_0x1d0b('0x18')](_0x94ed14);}return _0x32817c[_0x1d0b('0x19')](_0x94ed14)[_0x1d0b('0x1a')]();};}function respondWithResult(_0x5d6352,_0xb48d4){_0xb48d4=_0xb48d4||0xc8;return function(_0x529c6b){if(_0x529c6b){return _0x5d6352[_0x1d0b('0x19')](_0xb48d4)[_0x1d0b('0x1b')](_0x529c6b);}};}function respondWithFilteredResult(_0x403a6a,_0x4416d0){return function(_0xddf9c4){if(_0xddf9c4){var _0x4c266e=typeof _0x4416d0[_0x1d0b('0x1c')]===_0x1d0b('0x1d')&&typeof _0x4416d0[_0x1d0b('0x1e')]===_0x1d0b('0x1d');var _0x57746f=_0xddf9c4[_0x1d0b('0x1f')];var _0x3f8075=_0x4c266e?0x0:_0x4416d0[_0x1d0b('0x1c')];var _0xb1b339=_0x4c266e?_0xddf9c4[_0x1d0b('0x1f')]:_0x4416d0[_0x1d0b('0x1c')]+_0x4416d0[_0x1d0b('0x1e')];var _0x57eb6a;if(_0xb1b339>=_0x57746f){_0xb1b339=_0x57746f;_0x57eb6a=0xc8;}else{_0x57eb6a=0xce;}_0x403a6a[_0x1d0b('0x19')](_0x57eb6a);return _0x403a6a[_0x1d0b('0x20')](_0x1d0b('0x21'),_0x3f8075+'-'+_0xb1b339+'/'+_0x57746f)[_0x1d0b('0x1b')](_0xddf9c4);}return null;};}function patchUpdates(_0x5a13e4){return function(_0x11b66c){try{jsonpatch[_0x1d0b('0x22')](_0x11b66c,_0x5a13e4,!![]);}catch(_0x1de352){return BPromise[_0x1d0b('0x23')](_0x1de352);}return _0x11b66c[_0x1d0b('0x24')]();};}function saveUpdates(_0x3eb12c,_0xd48533){return function(_0x47d396){if(_0x47d396){return _0x47d396['update'](_0x3eb12c)['then'](function(_0x3085ba){return _0x3085ba;});}return null;};}function removeEntity(_0xc9e584,_0x216161){return function(_0x3b33c0){if(_0x3b33c0){return _0x3b33c0[_0x1d0b('0x25')]()[_0x1d0b('0x26')](function(){_0xc9e584[_0x1d0b('0x19')](0xcc)[_0x1d0b('0x1a')]();});}};}function handleEntityNotFound(_0x162dd8,_0x53c136){return function(_0xa90b86){if(!_0xa90b86){_0x162dd8[_0x1d0b('0x18')](0x194);}return _0xa90b86;};}function handleError(_0x1551ca,_0x5ef16b){_0x5ef16b=_0x5ef16b||0x1f4;return function(_0x36ad67){logger[_0x1d0b('0x27')](_0x36ad67[_0x1d0b('0x28')]);if(_0x36ad67[_0x1d0b('0x29')]){delete _0x36ad67['name'];}_0x1551ca[_0x1d0b('0x19')](_0x5ef16b)[_0x1d0b('0x2a')](_0x36ad67);};}exports['index']=function(_0x40a9de,_0x5bd6bb){var _0x4b6a93={},_0x23fe0b={},_0x431ed4={'count':0x0,'rows':[]};var _0x4b345f=_[_0x1d0b('0x2b')](db[_0x1d0b('0x2c')]['rawAttributes'],function(_0x5418be){return{'name':_0x5418be['fieldName'],'type':_0x5418be['type'][_0x1d0b('0x2d')]};});_0x23fe0b[_0x1d0b('0x2e')]=_[_0x1d0b('0x2b')](_0x4b345f,_0x1d0b('0x29'));_0x23fe0b[_0x1d0b('0x2f')]=_['keys'](_0x40a9de['query']);_0x23fe0b[_0x1d0b('0x30')]=_[_0x1d0b('0x31')](_0x23fe0b[_0x1d0b('0x2e')],_0x23fe0b[_0x1d0b('0x2f')]);_0x4b6a93[_0x1d0b('0x32')]=_[_0x1d0b('0x31')](_0x23fe0b[_0x1d0b('0x2e')],qs['fields'](_0x40a9de[_0x1d0b('0x2f')]['fields']));_0x4b6a93[_0x1d0b('0x32')]=_0x4b6a93[_0x1d0b('0x32')]['length']?_0x4b6a93[_0x1d0b('0x32')]:_0x23fe0b[_0x1d0b('0x2e')];if(!_0x40a9de[_0x1d0b('0x2f')][_0x1d0b('0x33')](_0x1d0b('0x34'))){_0x4b6a93['limit']=qs[_0x1d0b('0x1e')](_0x40a9de[_0x1d0b('0x2f')][_0x1d0b('0x1e')]);_0x4b6a93[_0x1d0b('0x1c')]=qs[_0x1d0b('0x1c')](_0x40a9de[_0x1d0b('0x2f')]['offset']);}_0x4b6a93[_0x1d0b('0x35')]=qs['sort'](_0x40a9de[_0x1d0b('0x2f')][_0x1d0b('0x36')]);_0x4b6a93[_0x1d0b('0x37')]=qs['filters'](_[_0x1d0b('0x38')](_0x40a9de['query'],_0x23fe0b[_0x1d0b('0x30')]),_0x4b345f);if(_0x40a9de['query'][_0x1d0b('0x39')]){_0x4b6a93[_0x1d0b('0x37')]=_[_0x1d0b('0x3a')](_0x4b6a93[_0x1d0b('0x37')],{'$or':_[_0x1d0b('0x2b')](_0x4b345f,function(_0x1ae02d){if(_0x1ae02d['type']!==_0x1d0b('0x3b')){var _0x3f42ff={};_0x3f42ff[_0x1ae02d['name']]={'$like':'%'+_0x40a9de[_0x1d0b('0x2f')][_0x1d0b('0x39')]+'%'};return _0x3f42ff;}})});}_0x4b6a93=_['merge']({},_0x4b6a93,_0x40a9de['options']);var _0x3c29cf={'where':_0x4b6a93[_0x1d0b('0x37')]};return db['VtigerConfiguration']['count'](_0x3c29cf)[_0x1d0b('0x26')](function(_0xba88e6){_0x431ed4[_0x1d0b('0x1f')]=_0xba88e6;if(_0x40a9de['query']['includeAll']){_0x4b6a93[_0x1d0b('0x3c')]=[{'all':!![]}];}return db['VtigerConfiguration'][_0x1d0b('0x3d')](_0x4b6a93);})[_0x1d0b('0x26')](function(_0x247ffc){_0x431ed4[_0x1d0b('0x3e')]=_0x247ffc;return _0x431ed4;})[_0x1d0b('0x26')](respondWithFilteredResult(_0x5bd6bb,_0x4b6a93))[_0x1d0b('0x3f')](handleError(_0x5bd6bb,null));};exports[_0x1d0b('0x40')]=function(_0xed46a6,_0x4f1704){var _0x2540e5={'raw':![],'where':{'id':_0xed46a6[_0x1d0b('0x41')]['id']}},_0x22669b={};_0x22669b[_0x1d0b('0x2e')]=_[_0x1d0b('0x42')](db[_0x1d0b('0x2c')][_0x1d0b('0x43')]);_0x22669b[_0x1d0b('0x2f')]=_[_0x1d0b('0x42')](_0xed46a6['query']);_0x22669b['filters']=_[_0x1d0b('0x31')](_0x22669b[_0x1d0b('0x2e')],_0x22669b['query']);_0x2540e5['attributes']=_[_0x1d0b('0x31')](_0x22669b[_0x1d0b('0x2e')],qs[_0x1d0b('0x44')](_0xed46a6['query'][_0x1d0b('0x44')]));_0x2540e5[_0x1d0b('0x32')]=_0x2540e5[_0x1d0b('0x32')]['length']?_0x2540e5[_0x1d0b('0x32')]:_0x22669b[_0x1d0b('0x2e')];if(_0xed46a6[_0x1d0b('0x2f')]['includeAll']){_0x2540e5[_0x1d0b('0x3c')]=[{'all':!![]}];}_0x2540e5=_[_0x1d0b('0x3a')]({},_0x2540e5,_0xed46a6['options']);return db[_0x1d0b('0x2c')][_0x1d0b('0x45')](_0x2540e5)['then'](handleEntityNotFound(_0x4f1704,null))['then'](respondWithResult(_0x4f1704,null))[_0x1d0b('0x3f')](handleError(_0x4f1704,null));};exports[_0x1d0b('0x46')]=function(_0x21a290,_0xfd472c){return db[_0x1d0b('0x2c')][_0x1d0b('0x46')](_0x21a290['body'],{})[_0x1d0b('0x26')](respondWithResult(_0xfd472c,0xc9))['catch'](handleError(_0xfd472c,null));};exports[_0x1d0b('0x47')]=function(_0x33fd65,_0x126097){if(_0x33fd65[_0x1d0b('0x48')]['id']){delete _0x33fd65[_0x1d0b('0x48')]['id'];}return db[_0x1d0b('0x2c')][_0x1d0b('0x45')]({'where':{'id':_0x33fd65['params']['id']}})[_0x1d0b('0x26')](handleEntityNotFound(_0x126097,null))[_0x1d0b('0x26')](saveUpdates(_0x33fd65[_0x1d0b('0x48')],null))[_0x1d0b('0x26')](respondWithResult(_0x126097,null))[_0x1d0b('0x3f')](handleError(_0x126097,null));};exports['destroy']=function(_0x1c77da,_0x4b122a){return db[_0x1d0b('0x2c')]['find']({'where':{'id':_0x1c77da[_0x1d0b('0x41')]['id']}})['then'](handleEntityNotFound(_0x4b122a,null))[_0x1d0b('0x26')](removeEntity(_0x4b122a,null))['catch'](handleError(_0x4b122a,null));};exports[_0x1d0b('0x49')]=function(_0x178825,_0x42aa83,_0x4fb1ae){var _0x10147f={};var _0x12fd97={};var _0x4d5685;var _0x28c870;return db[_0x1d0b('0x2c')][_0x1d0b('0x4a')]({'where':{'id':_0x178825[_0x1d0b('0x41')]['id']}})[_0x1d0b('0x26')](handleEntityNotFound(_0x42aa83,null))['then'](function(_0x5e4fcb){if(_0x5e4fcb){_0x4d5685=_0x5e4fcb;_0x12fd97[_0x1d0b('0x2e')]=_[_0x1d0b('0x42')](db[_0x1d0b('0x4b')][_0x1d0b('0x43')]);_0x12fd97[_0x1d0b('0x2f')]=_[_0x1d0b('0x42')](_0x178825[_0x1d0b('0x2f')]);_0x12fd97[_0x1d0b('0x30')]=_[_0x1d0b('0x31')](_0x12fd97[_0x1d0b('0x2e')],_0x12fd97[_0x1d0b('0x2f')]);_0x10147f[_0x1d0b('0x32')]=_['intersection'](_0x12fd97[_0x1d0b('0x2e')],qs[_0x1d0b('0x44')](_0x178825['query'][_0x1d0b('0x44')]));_0x10147f['attributes']=_0x10147f[_0x1d0b('0x32')][_0x1d0b('0x4c')]?_0x10147f[_0x1d0b('0x32')]:_0x12fd97[_0x1d0b('0x2e')];_0x10147f[_0x1d0b('0x35')]=qs[_0x1d0b('0x36')](_0x178825[_0x1d0b('0x2f')][_0x1d0b('0x36')]);_0x10147f[_0x1d0b('0x37')]=qs[_0x1d0b('0x30')](_[_0x1d0b('0x38')](_0x178825[_0x1d0b('0x2f')],_0x12fd97[_0x1d0b('0x30')]));if(_0x178825[_0x1d0b('0x2f')][_0x1d0b('0x39')]){_0x10147f[_0x1d0b('0x37')]=_['merge'](_0x10147f[_0x1d0b('0x37')],{'$or':_[_0x1d0b('0x2b')](_0x10147f['attributes'],function(_0x414ebe){var _0x4d343f={};_0x4d343f[_0x414ebe]={'$like':'%'+_0x178825[_0x1d0b('0x2f')][_0x1d0b('0x39')]+'%'};return _0x4d343f;})});}_0x10147f=_['merge']({},_0x10147f,_0x178825[_0x1d0b('0x4d')]);return _0x4d5685[_0x1d0b('0x49')](_0x10147f);}})[_0x1d0b('0x26')](function(_0x5abcd2){if(_0x5abcd2){_0x28c870=_0x5abcd2[_0x1d0b('0x4c')];if(!_0x178825[_0x1d0b('0x2f')][_0x1d0b('0x33')]('nolimit')){_0x10147f[_0x1d0b('0x1e')]=qs[_0x1d0b('0x1e')](_0x178825[_0x1d0b('0x2f')][_0x1d0b('0x1e')]);_0x10147f['offset']=qs[_0x1d0b('0x1c')](_0x178825['query'][_0x1d0b('0x1c')]);}return _0x4d5685[_0x1d0b('0x49')](_0x10147f);}})[_0x1d0b('0x26')](function(_0x353ebf){if(_0x353ebf){return _0x353ebf?{'count':_0x28c870,'rows':_0x353ebf}:null;}})[_0x1d0b('0x26')](respondWithResult(_0x42aa83,null))[_0x1d0b('0x3f')](handleError(_0x42aa83,null));};exports[_0x1d0b('0x4e')]=function(_0x215e01,_0x29abcc,_0x2b0403){var _0x19366d={};var _0x4a4a1f={};var _0x4ce0cd;var _0x159e8b;return db['VtigerConfiguration'][_0x1d0b('0x4a')]({'where':{'id':_0x215e01[_0x1d0b('0x41')]['id']}})[_0x1d0b('0x26')](handleEntityNotFound(_0x29abcc,null))[_0x1d0b('0x26')](function(_0x507e10){if(_0x507e10){_0x4ce0cd=_0x507e10;_0x4a4a1f['model']=_['keys'](db[_0x1d0b('0x4b')][_0x1d0b('0x43')]);_0x4a4a1f[_0x1d0b('0x2f')]=_[_0x1d0b('0x42')](_0x215e01[_0x1d0b('0x2f')]);_0x4a4a1f[_0x1d0b('0x30')]=_[_0x1d0b('0x31')](_0x4a4a1f[_0x1d0b('0x2e')],_0x4a4a1f[_0x1d0b('0x2f')]);_0x19366d[_0x1d0b('0x32')]=_[_0x1d0b('0x31')](_0x4a4a1f[_0x1d0b('0x2e')],qs[_0x1d0b('0x44')](_0x215e01['query']['fields']));_0x19366d[_0x1d0b('0x32')]=_0x19366d['attributes'][_0x1d0b('0x4c')]?_0x19366d[_0x1d0b('0x32')]:_0x4a4a1f[_0x1d0b('0x2e')];_0x19366d[_0x1d0b('0x35')]=qs['sort'](_0x215e01[_0x1d0b('0x2f')][_0x1d0b('0x36')]);_0x19366d[_0x1d0b('0x37')]=qs[_0x1d0b('0x30')](_[_0x1d0b('0x38')](_0x215e01[_0x1d0b('0x2f')],_0x4a4a1f[_0x1d0b('0x30')]));if(_0x215e01[_0x1d0b('0x2f')]['filter']){_0x19366d[_0x1d0b('0x37')]=_[_0x1d0b('0x3a')](_0x19366d[_0x1d0b('0x37')],{'$or':_['map'](_0x19366d[_0x1d0b('0x32')],function(_0x4d20fe){var _0xdf8597={};_0xdf8597[_0x4d20fe]={'$like':'%'+_0x215e01[_0x1d0b('0x2f')][_0x1d0b('0x39')]+'%'};return _0xdf8597;})});}_0x19366d=_[_0x1d0b('0x3a')]({},_0x19366d,_0x215e01[_0x1d0b('0x4d')]);return _0x4ce0cd['getSubjects'](_0x19366d);}})['then'](function(_0x25d821){if(_0x25d821){_0x159e8b=_0x25d821[_0x1d0b('0x4c')];if(!_0x215e01[_0x1d0b('0x2f')][_0x1d0b('0x33')](_0x1d0b('0x34'))){_0x19366d[_0x1d0b('0x1e')]=qs[_0x1d0b('0x1e')](_0x215e01[_0x1d0b('0x2f')][_0x1d0b('0x1e')]);_0x19366d[_0x1d0b('0x1c')]=qs[_0x1d0b('0x1c')](_0x215e01[_0x1d0b('0x2f')][_0x1d0b('0x1c')]);}return _0x4ce0cd[_0x1d0b('0x4e')](_0x19366d);}})[_0x1d0b('0x26')](function(_0x53523e){if(_0x53523e){return _0x53523e?{'count':_0x159e8b,'rows':_0x53523e}:null;}})[_0x1d0b('0x26')](respondWithResult(_0x29abcc,null))['catch'](handleError(_0x29abcc,null));};exports[_0x1d0b('0x4f')]=function(_0x38ace3,_0x2ad735,_0x3f9fdc){var _0x331cfc={};var _0x53c5ec={};var _0x54315d;var _0x1aa057;return db[_0x1d0b('0x2c')][_0x1d0b('0x4a')]({'where':{'id':_0x38ace3[_0x1d0b('0x41')]['id']}})[_0x1d0b('0x26')](handleEntityNotFound(_0x2ad735,null))[_0x1d0b('0x26')](function(_0x3734c2){if(_0x3734c2){_0x54315d=_0x3734c2;_0x53c5ec[_0x1d0b('0x2e')]=_[_0x1d0b('0x42')](db['VtigerField'][_0x1d0b('0x43')]);_0x53c5ec[_0x1d0b('0x2f')]=_[_0x1d0b('0x42')](_0x38ace3[_0x1d0b('0x2f')]);_0x53c5ec['filters']=_[_0x1d0b('0x31')](_0x53c5ec[_0x1d0b('0x2e')],_0x53c5ec[_0x1d0b('0x2f')]);_0x331cfc[_0x1d0b('0x32')]=_['intersection'](_0x53c5ec[_0x1d0b('0x2e')],qs[_0x1d0b('0x44')](_0x38ace3[_0x1d0b('0x2f')][_0x1d0b('0x44')]));_0x331cfc['attributes']=_0x331cfc[_0x1d0b('0x32')][_0x1d0b('0x4c')]?_0x331cfc[_0x1d0b('0x32')]:_0x53c5ec[_0x1d0b('0x2e')];_0x331cfc[_0x1d0b('0x35')]=qs[_0x1d0b('0x36')](_0x38ace3[_0x1d0b('0x2f')][_0x1d0b('0x36')]);_0x331cfc[_0x1d0b('0x37')]=qs[_0x1d0b('0x30')](_['pick'](_0x38ace3[_0x1d0b('0x2f')],_0x53c5ec[_0x1d0b('0x30')]));if(_0x38ace3['query'][_0x1d0b('0x39')]){_0x331cfc['where']=_[_0x1d0b('0x3a')](_0x331cfc[_0x1d0b('0x37')],{'$or':_[_0x1d0b('0x2b')](_0x331cfc[_0x1d0b('0x32')],function(_0x4b42ff){var _0x4c478c={};_0x4c478c[_0x4b42ff]={'$like':'%'+_0x38ace3[_0x1d0b('0x2f')][_0x1d0b('0x39')]+'%'};return _0x4c478c;})});}_0x331cfc=_[_0x1d0b('0x3a')]({},_0x331cfc,_0x38ace3['options']);return _0x54315d[_0x1d0b('0x4f')](_0x331cfc);}})[_0x1d0b('0x26')](function(_0x14fb53){if(_0x14fb53){_0x1aa057=_0x14fb53[_0x1d0b('0x4c')];if(!_0x38ace3[_0x1d0b('0x2f')]['hasOwnProperty']('nolimit')){_0x331cfc[_0x1d0b('0x1e')]=qs[_0x1d0b('0x1e')](_0x38ace3[_0x1d0b('0x2f')][_0x1d0b('0x1e')]);_0x331cfc[_0x1d0b('0x1c')]=qs['offset'](_0x38ace3[_0x1d0b('0x2f')][_0x1d0b('0x1c')]);}return _0x54315d[_0x1d0b('0x4f')](_0x331cfc);}})['then'](function(_0xc0eb90){if(_0xc0eb90){return _0xc0eb90?{'count':_0x1aa057,'rows':_0xc0eb90}:null;}})[_0x1d0b('0x26')](respondWithResult(_0x2ad735,null))[_0x1d0b('0x3f')](handleError(_0x2ad735,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 8099068..28775cb 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 _0xda0d=['bluebird','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','util','moment'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xda0d,0xfe));var _0xdda0=function(_0x215d85,_0x2cf379){_0x215d85=_0x215d85-0x0;var _0x1d8783=_0xda0d[_0x215d85];return _0x1d8783;};'use strict';var _=require('lodash');var util=require(_0xdda0('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xdda0('0x1'));var BPromise=require(_0xdda0('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdda0('0x3'));var rimraf=require(_0xdda0('0x4'));var config=require(_0xdda0('0x5'));var attributes=require(_0xdda0('0x6'));module[_0xdda0('0x7')]=function(_0x23a30d,_0x4879ba){return _0x23a30d['define']('VtigerConfiguration',attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0047=['int_vtiger_configurations','lodash','util','api','bluebird','request-promise','path','../../config/environment','exports','VtigerConfiguration'];(function(_0xa1ff31,_0xe70724){var _0x34b6a1=function(_0x54990c){while(--_0x54990c){_0xa1ff31['push'](_0xa1ff31['shift']());}};_0x34b6a1(++_0xe70724);}(_0x0047,0x1af));var _0x7004=function(_0x2a18b7,_0x5041c8){_0x2a18b7=_0x2a18b7-0x0;var _0x45e74e=_0x0047[_0x2a18b7];return _0x45e74e;};'use strict';var _=require(_0x7004('0x0'));var util=require(_0x7004('0x1'));var logger=require('../../config/logger')(_0x7004('0x2'));var moment=require('moment');var BPromise=require(_0x7004('0x3'));var rp=require(_0x7004('0x4'));var fs=require('fs');var path=require(_0x7004('0x5'));var rimraf=require('rimraf');var config=require(_0x7004('0x6'));var attributes=require('./intVtigerConfiguration.attributes');module[_0x7004('0x7')]=function(_0x2413d8,_0x2e4791){return _0x2413d8['define'](_0x7004('0x8'),attributes,{'tableName':_0x7004('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index c06017e..abf3378 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 _0xb410=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xb410,0x1ca));var _0x0b41=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0xb410[_0xaa0309];return _0x5de7ce;};'use strict';var _=require(_0x0b41('0x0'));var util=require(_0x0b41('0x1'));var moment=require(_0x0b41('0x2'));var BPromise=require('bluebird');var rs=require(_0x0b41('0x3'));var fs=require('fs');var Redis=require(_0x0b41('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0b41('0x5'));var logger=require(_0x0b41('0x6'))(_0x0b41('0x7'));var config=require(_0x0b41('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0b41('0x9')][_0x0b41('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2337ba,_0x4d0591,_0x3c740d){return new BPromise(function(_0x4bb21a,_0x5bc144){return client[_0x0b41('0xb')](_0x2337ba,_0x3c740d)[_0x0b41('0xc')](function(_0x2b83f7){logger[_0x0b41('0xd')](_0x0b41('0xe'),_0x4d0591,_0x0b41('0xf'));logger[_0x0b41('0x10')](_0x0b41('0x11'),_0x4d0591,_0x0b41('0xf'),JSON[_0x0b41('0x12')](_0x2b83f7));if(_0x2b83f7[_0x0b41('0x13')]){if(_0x2b83f7['error'][_0x0b41('0x14')]===0x1f4){logger[_0x0b41('0x13')](_0x0b41('0xe'),_0x4d0591,_0x2b83f7[_0x0b41('0x13')]['message']);return _0x5bc144(_0x2b83f7['error'][_0x0b41('0x15')]);}logger['error'](_0x0b41('0xe'),_0x4d0591,_0x2b83f7['error'][_0x0b41('0x15')]);return _0x4bb21a(_0x2b83f7[_0x0b41('0x13')][_0x0b41('0x15')]);}else{logger[_0x0b41('0xd')](_0x0b41('0xe'),_0x4d0591,_0x0b41('0xf'));_0x4bb21a(_0x2b83f7['result'][_0x0b41('0x15')]);}})[_0x0b41('0x16')](function(_0x2017b9){logger[_0x0b41('0x13')](_0x0b41('0xe'),_0x4d0591,_0x2017b9);_0x5bc144(_0x2017b9);});});} \ No newline at end of file +var _0x9d25=['randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','catch','moment','bluebird'];(function(_0x1141f2,_0x2b7ef4){var _0x2b7a8b=function(_0x3f1c7d){while(--_0x3f1c7d){_0x1141f2['push'](_0x1141f2['shift']());}};_0x2b7a8b(++_0x2b7ef4);}(_0x9d25,0x166));var _0x59d2=function(_0x58b426,_0x5977d5){_0x58b426=_0x58b426-0x0;var _0x187af5=_0x9d25[_0x58b426];return _0x187af5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x59d2('0x0'));var BPromise=require(_0x59d2('0x1'));var rs=require(_0x59d2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x59d2('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x59d2('0x4'))(_0x59d2('0x5'));var config=require(_0x59d2('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x59d2('0x7')][_0x59d2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4c375a,_0x415ced,_0x4e8be2){return new BPromise(function(_0x28d697,_0x2c77af){return client[_0x59d2('0x9')](_0x4c375a,_0x4e8be2)[_0x59d2('0xa')](function(_0x5545f8){logger[_0x59d2('0xb')](_0x59d2('0xc'),_0x415ced,_0x59d2('0xd'));logger[_0x59d2('0xe')](_0x59d2('0xf'),_0x415ced,_0x59d2('0xd'),JSON['stringify'](_0x5545f8));if(_0x5545f8[_0x59d2('0x10')]){if(_0x5545f8['error'][_0x59d2('0x11')]===0x1f4){logger[_0x59d2('0x10')](_0x59d2('0xc'),_0x415ced,_0x5545f8[_0x59d2('0x10')][_0x59d2('0x12')]);return _0x2c77af(_0x5545f8[_0x59d2('0x10')]['message']);}logger[_0x59d2('0x10')](_0x59d2('0xc'),_0x415ced,_0x5545f8[_0x59d2('0x10')][_0x59d2('0x12')]);return _0x28d697(_0x5545f8[_0x59d2('0x10')][_0x59d2('0x12')]);}else{logger[_0x59d2('0xb')]('VtigerConfiguration,\x20%s,\x20%s',_0x415ced,_0x59d2('0xd'));_0x28d697(_0x5545f8['result'][_0x59d2('0x12')]);}})[_0x59d2('0x13')](function(_0x2f189e){logger['error'](_0x59d2('0xc'),_0x415ced,_0x2f189e);_0x2c77af(_0x2f189e);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index eb00cd4..aba4c30 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 _0x6f1c=['/:id','update','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','show','post'];(function(_0x5ea151,_0x5a0510){var _0x1ff0d6=function(_0x231b9c){while(--_0x231b9c){_0x5ea151['push'](_0x5ea151['shift']());}};_0x1ff0d6(++_0x5a0510);}(_0x6f1c,0x8c));var _0xc6f1=function(_0x3978f4,_0x2afaec){_0x3978f4=_0x3978f4-0x0;var _0x554e5c=_0x6f1c[_0x3978f4];return _0x554e5c;};'use strict';var multer=require(_0xc6f1('0x0'));var util=require(_0xc6f1('0x1'));var path=require(_0xc6f1('0x2'));var timeout=require('connect-timeout');var express=require(_0xc6f1('0x3'));var router=express['Router']();var fs_extra=require(_0xc6f1('0x4'));var auth=require(_0xc6f1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc6f1('0x6'));var controller=require(_0xc6f1('0x7'));router[_0xc6f1('0x8')]('/',auth[_0xc6f1('0x9')](),controller[_0xc6f1('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xc6f1('0xb')]);router[_0xc6f1('0xc')]('/',auth[_0xc6f1('0x9')](),controller['create']);router['put'](_0xc6f1('0xd'),auth[_0xc6f1('0x9')](),controller[_0xc6f1('0xe')]);router['delete'](_0xc6f1('0xd'),auth[_0xc6f1('0x9')](),controller[_0xc6f1('0xf')]);module[_0xc6f1('0x10')]=router; \ No newline at end of file +var _0xde78=['multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','/:id','isAuthenticated','show','create','put','update','delete'];(function(_0x1f522f,_0x3d5e6b){var _0x33ff22=function(_0x2eb403){while(--_0x2eb403){_0x1f522f['push'](_0x1f522f['shift']());}};_0x33ff22(++_0x3d5e6b);}(_0xde78,0x120));var _0x8de7=function(_0xda464c,_0x26e47d){_0xda464c=_0xda464c-0x0;var _0x19e222=_0xde78[_0xda464c];return _0x19e222;};'use strict';var multer=require(_0x8de7('0x0'));var util=require('util');var path=require(_0x8de7('0x1'));var timeout=require('connect-timeout');var express=require(_0x8de7('0x2'));var router=express['Router']();var fs_extra=require(_0x8de7('0x3'));var auth=require(_0x8de7('0x4'));var interaction=require(_0x8de7('0x5'));var config=require(_0x8de7('0x6'));var controller=require(_0x8de7('0x7'));router[_0x8de7('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x8de7('0x9'),auth[_0x8de7('0xa')](),controller[_0x8de7('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8de7('0xc')]);router[_0x8de7('0xd')](_0x8de7('0x9'),auth['isAuthenticated'](),controller[_0x8de7('0xe')]);router[_0x8de7('0xf')](_0x8de7('0x9'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 61e89ae..588823e 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 _0xd005=['BOOLEAN','exports','string','customVariable','keyValue','picklist','STRING','ENUM','variable'];(function(_0x4c2f8d,_0x55bc33){var _0x16c437=function(_0x36b9f6){while(--_0x36b9f6){_0x4c2f8d['push'](_0x4c2f8d['shift']());}};_0x16c437(++_0x55bc33);}(_0xd005,0x19f));var _0x5d00=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd005[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x5d00('0x0')]={'type':{'type':Sequelize['ENUM'](_0x5d00('0x1'),'variable',_0x5d00('0x2'),_0x5d00('0x3'),_0x5d00('0x4')),'defaultValue':_0x5d00('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x5d00('0x5')]},'keyType':{'type':Sequelize[_0x5d00('0x6')]('string',_0x5d00('0x7'),_0x5d00('0x2'))},'keyContent':{'type':Sequelize[_0x5d00('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x5d00('0x5')]},'customField':{'type':Sequelize[_0x5d00('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5d00('0x5')]}}; \ No newline at end of file +var _0xb108=['sequelize','ENUM','variable','customVariable','picklist','string','STRING'];(function(_0x16b907,_0x3b16cd){var _0x308056=function(_0x1830e8){while(--_0x1830e8){_0x16b907['push'](_0x16b907['shift']());}};_0x308056(++_0x3b16cd);}(_0xb108,0x7e));var _0x8b10=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0xb108[_0x4c12ec];return _0x3ae42c;};'use strict';var Sequelize=require(_0x8b10('0x0'));module['exports']={'type':{'type':Sequelize[_0x8b10('0x1')]('string',_0x8b10('0x2'),_0x8b10('0x3'),'keyValue',_0x8b10('0x4')),'defaultValue':_0x8b10('0x5')},'content':{'type':Sequelize[_0x8b10('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0x8b10('0x2'),_0x8b10('0x3'))},'keyContent':{'type':Sequelize[_0x8b10('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x8b10('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8b10('0x6')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index ff1b80e..3351efa 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 _0x190d=['rawAttributes','fieldName','map','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','type','count','includeAll','include','findAll','rows','catch','show','params','length','options','create','body','find','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','offset','undefined','limit','status','set','json','apply','save','then','destroy','error','stack','name','send','index','VtigerField'];(function(_0x1d3db5,_0x3fa1d6){var _0x3123fe=function(_0x1f6c8b){while(--_0x1f6c8b){_0x1d3db5['push'](_0x1d3db5['shift']());}};_0x3123fe(++_0x3fa1d6);}(_0x190d,0x13b));var _0xd190=function(_0x40e197,_0x229884){_0x40e197=_0x40e197-0x0;var _0x1c76bd=_0x190d[_0x40e197];return _0x1c76bd;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd190('0x0'));var rp=require(_0xd190('0x1'));var moment=require(_0xd190('0x2'));var BPromise=require(_0xd190('0x3'));var Mustache=require('mustache');var util=require(_0xd190('0x4'));var path=require(_0xd190('0x5'));var sox=require('sox');var csv=require(_0xd190('0x6'));var ejs=require(_0xd190('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd190('0x8'));var squel=require(_0xd190('0x9'));var crypto=require(_0xd190('0xa'));var jsforce=require(_0xd190('0xb'));var deskjs=require(_0xd190('0xc'));var toCsv=require(_0xd190('0x6'));var querystring=require('querystring');var Papa=require(_0xd190('0xd'));var Redis=require('ioredis');var authService=require(_0xd190('0xe'));var qs=require(_0xd190('0xf'));var as=require(_0xd190('0x10'));var hardwareService=require(_0xd190('0x11'));var logger=require(_0xd190('0x12'))(_0xd190('0x13'));var utils=require(_0xd190('0x14'));var config=require(_0xd190('0x15'));var licenseUtil=require(_0xd190('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b53a3,_0x3417c6){_0x3417c6=_0x3417c6||0xcc;return function(_0x4c79d9){if(_0x4c79d9){return _0x2b53a3['sendStatus'](_0x3417c6);}return _0x2b53a3['status'](_0x3417c6)[_0xd190('0x17')]();};}function respondWithResult(_0xd7710a,_0x1eff98){_0x1eff98=_0x1eff98||0xc8;return function(_0x5cdfa3){if(_0x5cdfa3){return _0xd7710a['status'](_0x1eff98)['json'](_0x5cdfa3);}};}function respondWithFilteredResult(_0x5763b1,_0x3a4388){return function(_0x14e9d5){if(_0x14e9d5){var _0x1b3f5d=typeof _0x3a4388[_0xd190('0x18')]===_0xd190('0x19')&&typeof _0x3a4388[_0xd190('0x1a')]===_0xd190('0x19');var _0x16e235=_0x14e9d5['count'];var _0x5a28f3=_0x1b3f5d?0x0:_0x3a4388[_0xd190('0x18')];var _0x176d9c=_0x1b3f5d?_0x14e9d5['count']:_0x3a4388[_0xd190('0x18')]+_0x3a4388[_0xd190('0x1a')];var _0x57331f;if(_0x176d9c>=_0x16e235){_0x176d9c=_0x16e235;_0x57331f=0xc8;}else{_0x57331f=0xce;}_0x5763b1[_0xd190('0x1b')](_0x57331f);return _0x5763b1[_0xd190('0x1c')]('Content-Range',_0x5a28f3+'-'+_0x176d9c+'/'+_0x16e235)[_0xd190('0x1d')](_0x14e9d5);}return null;};}function patchUpdates(_0x474363){return function(_0x400c97){try{jsonpatch[_0xd190('0x1e')](_0x400c97,_0x474363,!![]);}catch(_0x27a378){return BPromise['reject'](_0x27a378);}return _0x400c97[_0xd190('0x1f')]();};}function saveUpdates(_0xb2ddd4,_0x36cf6f){return function(_0x2727d1){if(_0x2727d1){return _0x2727d1['update'](_0xb2ddd4)[_0xd190('0x20')](function(_0x5b2ffe){return _0x5b2ffe;});}return null;};}function removeEntity(_0x56b9b1,_0x3e0e1c){return function(_0x40bb0b){if(_0x40bb0b){return _0x40bb0b[_0xd190('0x21')]()['then'](function(){_0x56b9b1[_0xd190('0x1b')](0xcc)[_0xd190('0x17')]();});}};}function handleEntityNotFound(_0x12e21f,_0x247f60){return function(_0x3dee9e){if(!_0x3dee9e){_0x12e21f['sendStatus'](0x194);}return _0x3dee9e;};}function handleError(_0x38d36e,_0x3a2cf9){_0x3a2cf9=_0x3a2cf9||0x1f4;return function(_0x2b7b87){logger[_0xd190('0x22')](_0x2b7b87[_0xd190('0x23')]);if(_0x2b7b87[_0xd190('0x24')]){delete _0x2b7b87[_0xd190('0x24')];}_0x38d36e[_0xd190('0x1b')](_0x3a2cf9)[_0xd190('0x25')](_0x2b7b87);};}exports[_0xd190('0x26')]=function(_0x1ef06,_0x5d7b4c){var _0x3cb769={},_0x2f6e76={},_0x4059b2={'count':0x0,'rows':[]};var _0x198182=_['map'](db[_0xd190('0x27')][_0xd190('0x28')],function(_0x3791a8){return{'name':_0x3791a8[_0xd190('0x29')],'type':_0x3791a8['type']['key']};});_0x2f6e76['model']=_[_0xd190('0x2a')](_0x198182,_0xd190('0x24'));_0x2f6e76[_0xd190('0x2b')]=_[_0xd190('0x2c')](_0x1ef06[_0xd190('0x2b')]);_0x2f6e76[_0xd190('0x2d')]=_[_0xd190('0x2e')](_0x2f6e76['model'],_0x2f6e76[_0xd190('0x2b')]);_0x3cb769[_0xd190('0x2f')]=_[_0xd190('0x2e')](_0x2f6e76[_0xd190('0x30')],qs['fields'](_0x1ef06['query'][_0xd190('0x31')]));_0x3cb769['attributes']=_0x3cb769[_0xd190('0x2f')]['length']?_0x3cb769['attributes']:_0x2f6e76['model'];if(!_0x1ef06[_0xd190('0x2b')][_0xd190('0x32')](_0xd190('0x33'))){_0x3cb769[_0xd190('0x1a')]=qs[_0xd190('0x1a')](_0x1ef06[_0xd190('0x2b')][_0xd190('0x1a')]);_0x3cb769[_0xd190('0x18')]=qs['offset'](_0x1ef06[_0xd190('0x2b')][_0xd190('0x18')]);}_0x3cb769[_0xd190('0x34')]=qs['sort'](_0x1ef06[_0xd190('0x2b')][_0xd190('0x35')]);_0x3cb769['where']=qs['filters'](_['pick'](_0x1ef06[_0xd190('0x2b')],_0x2f6e76['filters']),_0x198182);if(_0x1ef06['query'][_0xd190('0x36')]){_0x3cb769[_0xd190('0x37')]=_[_0xd190('0x38')](_0x3cb769[_0xd190('0x37')],{'$or':_[_0xd190('0x2a')](_0x198182,function(_0x23cbec){if(_0x23cbec[_0xd190('0x39')]!=='VIRTUAL'){var _0x2068b4={};_0x2068b4[_0x23cbec[_0xd190('0x24')]]={'$like':'%'+_0x1ef06['query'][_0xd190('0x36')]+'%'};return _0x2068b4;}})});}_0x3cb769=_[_0xd190('0x38')]({},_0x3cb769,_0x1ef06['options']);var _0x24b653={'where':_0x3cb769[_0xd190('0x37')]};return db[_0xd190('0x27')][_0xd190('0x3a')](_0x24b653)[_0xd190('0x20')](function(_0xfbe7cf){_0x4059b2[_0xd190('0x3a')]=_0xfbe7cf;if(_0x1ef06[_0xd190('0x2b')][_0xd190('0x3b')]){_0x3cb769[_0xd190('0x3c')]=[{'all':!![]}];}return db[_0xd190('0x27')][_0xd190('0x3d')](_0x3cb769);})['then'](function(_0x428ccd){_0x4059b2[_0xd190('0x3e')]=_0x428ccd;return _0x4059b2;})[_0xd190('0x20')](respondWithFilteredResult(_0x5d7b4c,_0x3cb769))[_0xd190('0x3f')](handleError(_0x5d7b4c,null));};exports[_0xd190('0x40')]=function(_0x49eb94,_0x29570b){var _0x1f46be={'raw':!![],'where':{'id':_0x49eb94[_0xd190('0x41')]['id']}},_0x1bafde={};_0x1bafde['model']=_[_0xd190('0x2c')](db[_0xd190('0x27')][_0xd190('0x28')]);_0x1bafde[_0xd190('0x2b')]=_['keys'](_0x49eb94[_0xd190('0x2b')]);_0x1bafde[_0xd190('0x2d')]=_[_0xd190('0x2e')](_0x1bafde[_0xd190('0x30')],_0x1bafde[_0xd190('0x2b')]);_0x1f46be[_0xd190('0x2f')]=_['intersection'](_0x1bafde['model'],qs[_0xd190('0x31')](_0x49eb94['query'][_0xd190('0x31')]));_0x1f46be[_0xd190('0x2f')]=_0x1f46be[_0xd190('0x2f')][_0xd190('0x42')]?_0x1f46be[_0xd190('0x2f')]:_0x1bafde[_0xd190('0x30')];if(_0x49eb94[_0xd190('0x2b')][_0xd190('0x3b')]){_0x1f46be[_0xd190('0x3c')]=[{'all':!![]}];}_0x1f46be=_[_0xd190('0x38')]({},_0x1f46be,_0x49eb94[_0xd190('0x43')]);return db[_0xd190('0x27')]['find'](_0x1f46be)[_0xd190('0x20')](handleEntityNotFound(_0x29570b,null))[_0xd190('0x20')](respondWithResult(_0x29570b,null))['catch'](handleError(_0x29570b,null));};exports[_0xd190('0x44')]=function(_0x33b7c2,_0x2e50d7){return db[_0xd190('0x27')][_0xd190('0x44')](_0x33b7c2[_0xd190('0x45')],{})[_0xd190('0x20')](respondWithResult(_0x2e50d7,0xc9))['catch'](handleError(_0x2e50d7,null));};exports['update']=function(_0x3f450c,_0x3e1bc8){if(_0x3f450c[_0xd190('0x45')]['id']){delete _0x3f450c[_0xd190('0x45')]['id'];}return db['VtigerField'][_0xd190('0x46')]({'where':{'id':_0x3f450c[_0xd190('0x41')]['id']}})[_0xd190('0x20')](handleEntityNotFound(_0x3e1bc8,null))['then'](saveUpdates(_0x3f450c['body'],null))[_0xd190('0x20')](respondWithResult(_0x3e1bc8,null))['catch'](handleError(_0x3e1bc8,null));};exports[_0xd190('0x21')]=function(_0x3d931b,_0x141c50){return db[_0xd190('0x27')][_0xd190('0x46')]({'where':{'id':_0x3d931b[_0xd190('0x41')]['id']}})[_0xd190('0x20')](handleEntityNotFound(_0x141c50,null))['then'](removeEntity(_0x141c50,null))['catch'](handleError(_0x141c50,null));}; \ No newline at end of file +var _0x2ae3=['index','map','VtigerField','fieldName','type','key','name','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','where','pick','VIRTUAL','filter','merge','options','includeAll','include','show','params','rawAttributes','find','catch','create','body','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','end','stack','send'];(function(_0x38152f,_0x9ba1a6){var _0x15da9e=function(_0x22653c){while(--_0x22653c){_0x38152f['push'](_0x38152f['shift']());}};_0x15da9e(++_0x9ba1a6);}(_0x2ae3,0x6c));var _0x32ae=function(_0x596fb3,_0x596e02){_0x596fb3=_0x596fb3-0x0;var _0x1211ca=_0x2ae3[_0x596fb3];return _0x1211ca;};'use strict';var emlformat=require(_0x32ae('0x0'));var rimraf=require(_0x32ae('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x32ae('0x2'));var rp=require('request-promise');var moment=require(_0x32ae('0x3'));var BPromise=require(_0x32ae('0x4'));var Mustache=require(_0x32ae('0x5'));var util=require(_0x32ae('0x6'));var path=require(_0x32ae('0x7'));var sox=require(_0x32ae('0x8'));var csv=require('to-csv');var ejs=require(_0x32ae('0x9'));var fs=require('fs');var fs_extra=require(_0x32ae('0xa'));var _=require(_0x32ae('0xb'));var squel=require(_0x32ae('0xc'));var crypto=require(_0x32ae('0xd'));var jsforce=require(_0x32ae('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x32ae('0xf'));var querystring=require('querystring');var Papa=require(_0x32ae('0x10'));var Redis=require('ioredis');var authService=require(_0x32ae('0x11'));var qs=require(_0x32ae('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ae('0x13'));var logger=require(_0x32ae('0x14'))('api');var utils=require(_0x32ae('0x15'));var config=require(_0x32ae('0x16'));var licenseUtil=require(_0x32ae('0x17'));var db=require(_0x32ae('0x18'))['db'];function respondWithStatusCode(_0x19b41d,_0x3b7cf5){_0x3b7cf5=_0x3b7cf5||0xcc;return function(_0x5764aa){if(_0x5764aa){return _0x19b41d[_0x32ae('0x19')](_0x3b7cf5);}return _0x19b41d['status'](_0x3b7cf5)['end']();};}function respondWithResult(_0x3e91da,_0x1b055f){_0x1b055f=_0x1b055f||0xc8;return function(_0x5c04d8){if(_0x5c04d8){return _0x3e91da[_0x32ae('0x1a')](_0x1b055f)[_0x32ae('0x1b')](_0x5c04d8);}};}function respondWithFilteredResult(_0x4c6283,_0x1e320d){return function(_0x57d3d7){if(_0x57d3d7){var _0x425c2e=typeof _0x1e320d[_0x32ae('0x1c')]===_0x32ae('0x1d')&&typeof _0x1e320d['limit']===_0x32ae('0x1d');var _0x8e3cfc=_0x57d3d7['count'];var _0x380530=_0x425c2e?0x0:_0x1e320d['offset'];var _0x3f8a2f=_0x425c2e?_0x57d3d7[_0x32ae('0x1e')]:_0x1e320d[_0x32ae('0x1c')]+_0x1e320d['limit'];var _0x309788;if(_0x3f8a2f>=_0x8e3cfc){_0x3f8a2f=_0x8e3cfc;_0x309788=0xc8;}else{_0x309788=0xce;}_0x4c6283[_0x32ae('0x1a')](_0x309788);return _0x4c6283[_0x32ae('0x1f')](_0x32ae('0x20'),_0x380530+'-'+_0x3f8a2f+'/'+_0x8e3cfc)[_0x32ae('0x1b')](_0x57d3d7);}return null;};}function patchUpdates(_0x1fffba){return function(_0x4e3cc5){try{jsonpatch[_0x32ae('0x21')](_0x4e3cc5,_0x1fffba,!![]);}catch(_0x2b1a34){return BPromise[_0x32ae('0x22')](_0x2b1a34);}return _0x4e3cc5[_0x32ae('0x23')]();};}function saveUpdates(_0x5a66cc,_0xf061bd){return function(_0x592d36){if(_0x592d36){return _0x592d36[_0x32ae('0x24')](_0x5a66cc)['then'](function(_0x74e4eb){return _0x74e4eb;});}return null;};}function removeEntity(_0x157101,_0x2a786b){return function(_0x5598be){if(_0x5598be){return _0x5598be[_0x32ae('0x25')]()[_0x32ae('0x26')](function(){_0x157101[_0x32ae('0x1a')](0xcc)[_0x32ae('0x27')]();});}};}function handleEntityNotFound(_0xc7a99b,_0x551df3){return function(_0x3e7983){if(!_0x3e7983){_0xc7a99b[_0x32ae('0x19')](0x194);}return _0x3e7983;};}function handleError(_0x49b4e5,_0x4757d1){_0x4757d1=_0x4757d1||0x1f4;return function(_0x3276c2){logger['error'](_0x3276c2[_0x32ae('0x28')]);if(_0x3276c2['name']){delete _0x3276c2['name'];}_0x49b4e5[_0x32ae('0x1a')](_0x4757d1)[_0x32ae('0x29')](_0x3276c2);};}exports[_0x32ae('0x2a')]=function(_0xe2a926,_0x4c4e13){var _0x4f53a1={},_0xf8767a={},_0x3bb8a7={'count':0x0,'rows':[]};var _0x1cf7e5=_[_0x32ae('0x2b')](db[_0x32ae('0x2c')]['rawAttributes'],function(_0x585edf){return{'name':_0x585edf[_0x32ae('0x2d')],'type':_0x585edf[_0x32ae('0x2e')][_0x32ae('0x2f')]};});_0xf8767a['model']=_[_0x32ae('0x2b')](_0x1cf7e5,_0x32ae('0x30'));_0xf8767a['query']=_[_0x32ae('0x31')](_0xe2a926[_0x32ae('0x32')]);_0xf8767a[_0x32ae('0x33')]=_[_0x32ae('0x34')](_0xf8767a[_0x32ae('0x35')],_0xf8767a['query']);_0x4f53a1[_0x32ae('0x36')]=_['intersection'](_0xf8767a[_0x32ae('0x35')],qs[_0x32ae('0x37')](_0xe2a926[_0x32ae('0x32')]['fields']));_0x4f53a1['attributes']=_0x4f53a1[_0x32ae('0x36')][_0x32ae('0x38')]?_0x4f53a1[_0x32ae('0x36')]:_0xf8767a['model'];if(!_0xe2a926[_0x32ae('0x32')][_0x32ae('0x39')](_0x32ae('0x3a'))){_0x4f53a1[_0x32ae('0x3b')]=qs[_0x32ae('0x3b')](_0xe2a926[_0x32ae('0x32')]['limit']);_0x4f53a1[_0x32ae('0x1c')]=qs[_0x32ae('0x1c')](_0xe2a926['query'][_0x32ae('0x1c')]);}_0x4f53a1['order']=qs['sort'](_0xe2a926['query']['sort']);_0x4f53a1[_0x32ae('0x3c')]=qs[_0x32ae('0x33')](_[_0x32ae('0x3d')](_0xe2a926[_0x32ae('0x32')],_0xf8767a[_0x32ae('0x33')]),_0x1cf7e5);if(_0xe2a926[_0x32ae('0x32')]['filter']){_0x4f53a1[_0x32ae('0x3c')]=_['merge'](_0x4f53a1[_0x32ae('0x3c')],{'$or':_[_0x32ae('0x2b')](_0x1cf7e5,function(_0x1e31ac){if(_0x1e31ac['type']!==_0x32ae('0x3e')){var _0x1f3bec={};_0x1f3bec[_0x1e31ac[_0x32ae('0x30')]]={'$like':'%'+_0xe2a926[_0x32ae('0x32')][_0x32ae('0x3f')]+'%'};return _0x1f3bec;}})});}_0x4f53a1=_[_0x32ae('0x40')]({},_0x4f53a1,_0xe2a926[_0x32ae('0x41')]);var _0x385f84={'where':_0x4f53a1[_0x32ae('0x3c')]};return db[_0x32ae('0x2c')][_0x32ae('0x1e')](_0x385f84)['then'](function(_0x1589cc){_0x3bb8a7[_0x32ae('0x1e')]=_0x1589cc;if(_0xe2a926[_0x32ae('0x32')][_0x32ae('0x42')]){_0x4f53a1[_0x32ae('0x43')]=[{'all':!![]}];}return db['VtigerField']['findAll'](_0x4f53a1);})[_0x32ae('0x26')](function(_0x59c179){_0x3bb8a7['rows']=_0x59c179;return _0x3bb8a7;})['then'](respondWithFilteredResult(_0x4c4e13,_0x4f53a1))['catch'](handleError(_0x4c4e13,null));};exports[_0x32ae('0x44')]=function(_0x58fd39,_0x185cc6){var _0x269e87={'raw':!![],'where':{'id':_0x58fd39[_0x32ae('0x45')]['id']}},_0x5ee812={};_0x5ee812[_0x32ae('0x35')]=_[_0x32ae('0x31')](db[_0x32ae('0x2c')][_0x32ae('0x46')]);_0x5ee812[_0x32ae('0x32')]=_[_0x32ae('0x31')](_0x58fd39[_0x32ae('0x32')]);_0x5ee812[_0x32ae('0x33')]=_[_0x32ae('0x34')](_0x5ee812[_0x32ae('0x35')],_0x5ee812[_0x32ae('0x32')]);_0x269e87['attributes']=_[_0x32ae('0x34')](_0x5ee812[_0x32ae('0x35')],qs[_0x32ae('0x37')](_0x58fd39[_0x32ae('0x32')][_0x32ae('0x37')]));_0x269e87[_0x32ae('0x36')]=_0x269e87[_0x32ae('0x36')][_0x32ae('0x38')]?_0x269e87[_0x32ae('0x36')]:_0x5ee812[_0x32ae('0x35')];if(_0x58fd39['query'][_0x32ae('0x42')]){_0x269e87[_0x32ae('0x43')]=[{'all':!![]}];}_0x269e87=_[_0x32ae('0x40')]({},_0x269e87,_0x58fd39['options']);return db[_0x32ae('0x2c')][_0x32ae('0x47')](_0x269e87)[_0x32ae('0x26')](handleEntityNotFound(_0x185cc6,null))['then'](respondWithResult(_0x185cc6,null))[_0x32ae('0x48')](handleError(_0x185cc6,null));};exports[_0x32ae('0x49')]=function(_0x151cd4,_0x163105){return db[_0x32ae('0x2c')][_0x32ae('0x49')](_0x151cd4[_0x32ae('0x4a')],{})['then'](respondWithResult(_0x163105,0xc9))[_0x32ae('0x48')](handleError(_0x163105,null));};exports[_0x32ae('0x24')]=function(_0xe6408a,_0x27864c){if(_0xe6408a[_0x32ae('0x4a')]['id']){delete _0xe6408a[_0x32ae('0x4a')]['id'];}return db['VtigerField']['find']({'where':{'id':_0xe6408a[_0x32ae('0x45')]['id']}})['then'](handleEntityNotFound(_0x27864c,null))['then'](saveUpdates(_0xe6408a[_0x32ae('0x4a')],null))['then'](respondWithResult(_0x27864c,null))[_0x32ae('0x48')](handleError(_0x27864c,null));};exports[_0x32ae('0x25')]=function(_0x318225,_0x1c815a){return db[_0x32ae('0x2c')]['find']({'where':{'id':_0x318225[_0x32ae('0x45')]['id']}})[_0x32ae('0x26')](handleEntityNotFound(_0x1c815a,null))['then'](removeEntity(_0x1c815a,null))[_0x32ae('0x48')](handleError(_0x1c815a,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index b3a87d0..ac3198d 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 _0x50a6=['VtigerField','vtiger_unique_index','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./intVtigerField.attributes','define'];(function(_0x3c5e54,_0x2b991b){var _0x3ae1f3=function(_0x43f80f){while(--_0x43f80f){_0x3c5e54['push'](_0x3c5e54['shift']());}};_0x3ae1f3(++_0x2b991b);}(_0x50a6,0x1ca));var _0x650a=function(_0x347399,_0x42bbda){_0x347399=_0x347399-0x0;var _0x24e7be=_0x50a6[_0x347399];return _0x24e7be;};'use strict';var _=require(_0x650a('0x0'));var util=require(_0x650a('0x1'));var logger=require(_0x650a('0x2'))('api');var moment=require(_0x650a('0x3'));var BPromise=require(_0x650a('0x4'));var rp=require(_0x650a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x650a('0x6'));var config=require(_0x650a('0x7'));var attributes=require(_0x650a('0x8'));module['exports']=function(_0x313864,_0x12ee1d){return _0x313864[_0x650a('0x9')](_0x650a('0xa'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x650a('0xb'),'fields':['idField',_0x650a('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x22d7=['idField','util','api','bluebird','request-promise','path','exports','define','VtigerField','vtiger_unique_index'];(function(_0x490694,_0x7c702c){var _0x239d9f=function(_0x3ba6c7){while(--_0x3ba6c7){_0x490694['push'](_0x490694['shift']());}};_0x239d9f(++_0x7c702c);}(_0x22d7,0x10f));var _0x722d=function(_0x6b7dd0,_0x2eebf2){_0x6b7dd0=_0x6b7dd0-0x0;var _0x2356cc=_0x22d7[_0x6b7dd0];return _0x2356cc;};'use strict';var _=require('lodash');var util=require(_0x722d('0x0'));var logger=require('../../config/logger')(_0x722d('0x1'));var moment=require('moment');var BPromise=require(_0x722d('0x2'));var rp=require(_0x722d('0x3'));var fs=require('fs');var path=require(_0x722d('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intVtigerField.attributes');module[_0x722d('0x5')]=function(_0xf7b32,_0x9bc04c){return _0xf7b32[_0x722d('0x6')](_0x722d('0x7'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x722d('0x8'),'fields':[_0x722d('0x9'),'FieldId'],'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 4a30669..5ea6c12 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 _0x7a79=['client','http','request','then','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerField,\x20%s,\x20%s','message','info','result','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a79,0x1dc));var _0x97a7=function(_0x3203a1,_0x46c498){_0x3203a1=_0x3203a1-0x0;var _0x24215e=_0x7a79[_0x3203a1];return _0x24215e;};'use strict';var _=require('lodash');var util=require(_0x97a7('0x0'));var moment=require(_0x97a7('0x1'));var BPromise=require(_0x97a7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x97a7('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x97a7('0x4'));var logger=require(_0x97a7('0x5'))(_0x97a7('0x6'));var config=require('../../config/environment');var jayson=require(_0x97a7('0x7'));var client=jayson[_0x97a7('0x8')][_0x97a7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x307312,_0x5957d9,_0x3df97b){return new BPromise(function(_0x59d386,_0x387969){return client[_0x97a7('0xa')](_0x307312,_0x3df97b)[_0x97a7('0xb')](function(_0x403890){logger['info']('VtigerField,\x20%s,\x20%s',_0x5957d9,_0x97a7('0xc'));logger[_0x97a7('0xd')](_0x97a7('0xe'),_0x5957d9,_0x97a7('0xc'),JSON[_0x97a7('0xf')](_0x403890));if(_0x403890['error']){if(_0x403890[_0x97a7('0x10')][_0x97a7('0x11')]===0x1f4){logger[_0x97a7('0x10')](_0x97a7('0x12'),_0x5957d9,_0x403890[_0x97a7('0x10')][_0x97a7('0x13')]);return _0x387969(_0x403890['error']['message']);}logger[_0x97a7('0x10')](_0x97a7('0x12'),_0x5957d9,_0x403890['error']['message']);return _0x59d386(_0x403890[_0x97a7('0x10')][_0x97a7('0x13')]);}else{logger[_0x97a7('0x14')](_0x97a7('0x12'),_0x5957d9,_0x97a7('0xc'));_0x59d386(_0x403890[_0x97a7('0x15')][_0x97a7('0x13')]);}})['catch'](function(_0x132e6c){logger[_0x97a7('0x10')](_0x97a7('0x12'),_0x5957d9,_0x132e6c);_0x387969(_0x132e6c);});});} \ No newline at end of file +var _0xc3d3=['stringify','error','code','VtigerField,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent'];(function(_0x4b55c7,_0x5c4919){var _0x22f39f=function(_0x3f2b3e){while(--_0x3f2b3e){_0x4b55c7['push'](_0x4b55c7['shift']());}};_0x22f39f(++_0x5c4919);}(_0xc3d3,0x182));var _0x3c3d=function(_0x556306,_0x23b911){_0x556306=_0x556306-0x0;var _0x1e86db=_0xc3d3[_0x556306];return _0x1e86db;};'use strict';var _=require(_0x3c3d('0x0'));var util=require('util');var moment=require(_0x3c3d('0x1'));var BPromise=require(_0x3c3d('0x2'));var rs=require(_0x3c3d('0x3'));var fs=require('fs');var Redis=require(_0x3c3d('0x4'));var db=require(_0x3c3d('0x5'))['db'];var utils=require(_0x3c3d('0x6'));var logger=require(_0x3c3d('0x7'))(_0x3c3d('0x8'));var config=require(_0x3c3d('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3c3d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x36cade,_0x43ff3a,_0x48508b){return new BPromise(function(_0x245ba7,_0x1b72f7){return client['request'](_0x36cade,_0x48508b)[_0x3c3d('0xb')](function(_0x52c6dd){logger[_0x3c3d('0xc')]('VtigerField,\x20%s,\x20%s',_0x43ff3a,_0x3c3d('0xd'));logger['debug']('VtigerField,\x20%s,\x20%s,\x20%s',_0x43ff3a,_0x3c3d('0xd'),JSON[_0x3c3d('0xe')](_0x52c6dd));if(_0x52c6dd[_0x3c3d('0xf')]){if(_0x52c6dd['error'][_0x3c3d('0x10')]===0x1f4){logger[_0x3c3d('0xf')](_0x3c3d('0x11'),_0x43ff3a,_0x52c6dd['error'][_0x3c3d('0x12')]);return _0x1b72f7(_0x52c6dd[_0x3c3d('0xf')][_0x3c3d('0x12')]);}logger['error'](_0x3c3d('0x11'),_0x43ff3a,_0x52c6dd[_0x3c3d('0xf')][_0x3c3d('0x12')]);return _0x245ba7(_0x52c6dd[_0x3c3d('0xf')][_0x3c3d('0x12')]);}else{logger[_0x3c3d('0xc')]('VtigerField,\x20%s,\x20%s',_0x43ff3a,'request\x20sent');_0x245ba7(_0x52c6dd['result'][_0x3c3d('0x12')]);}})[_0x3c3d('0x13')](function(_0x4dc2f7){logger[_0x3c3d('0xf')](_0x3c3d('0x11'),_0x43ff3a,_0x4dc2f7);_0x1b72f7(_0x4dc2f7);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 31ceb35..df3281f 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 _0x84a2=['../../config/environment','./intZendeskAccount.controller','get','index','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','update','delete','/:id','destroy','exports','util','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x84a2,0x103));var _0x284a=function(_0x515cff,_0x27d4a5){_0x515cff=_0x515cff-0x0;var _0x419c0e=_0x84a2[_0x515cff];return _0x419c0e;};'use strict';var multer=require('multer');var util=require(_0x284a('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x284a('0x1'));var router=express['Router']();var fs_extra=require(_0x284a('0x2'));var auth=require(_0x284a('0x3'));var interaction=require(_0x284a('0x4'));var config=require(_0x284a('0x5'));var controller=require(_0x284a('0x6'));router[_0x284a('0x7')]('/',auth['isAuthenticated'](),controller[_0x284a('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x284a('0x7')](_0x284a('0x9'),auth[_0x284a('0xa')](),controller[_0x284a('0xb')]);router['get'](_0x284a('0xc'),auth[_0x284a('0xa')](),controller[_0x284a('0xd')]);router[_0x284a('0xe')]('/',auth[_0x284a('0xa')](),controller[_0x284a('0xf')]);router[_0x284a('0xe')](_0x284a('0x9'),auth[_0x284a('0xa')](),controller[_0x284a('0x10')]);router['put']('/:id',auth[_0x284a('0xa')](),controller[_0x284a('0x11')]);router[_0x284a('0x12')](_0x284a('0x13'),auth['isAuthenticated'](),controller[_0x284a('0x14')]);module[_0x284a('0x15')]=router; \ No newline at end of file +var _0x3eea=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','getFields','post','create','addConfiguration','put','delete','destroy','path','connect-timeout','Router','fs-extra'];(function(_0x51b855,_0x1ec9d1){var _0x2eda59=function(_0x5d39cc){while(--_0x5d39cc){_0x51b855['push'](_0x51b855['shift']());}};_0x2eda59(++_0x1ec9d1);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x304b51,_0x328561){_0x304b51=_0x304b51-0x0;var _0x251d23=_0x3eea[_0x304b51];return _0x251d23;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa3ee('0x0'));var timeout=require(_0xa3ee('0x1'));var express=require('express');var router=express[_0xa3ee('0x2')]();var fs_extra=require(_0xa3ee('0x3'));var auth=require(_0xa3ee('0x4'));var interaction=require(_0xa3ee('0x5'));var config=require(_0xa3ee('0x6'));var controller=require(_0xa3ee('0x7'));router[_0xa3ee('0x8')]('/',auth[_0xa3ee('0x9')](),controller[_0xa3ee('0xa')]);router[_0xa3ee('0x8')](_0xa3ee('0xb'),auth[_0xa3ee('0x9')](),controller[_0xa3ee('0xc')]);router[_0xa3ee('0x8')]('/:id/configurations',auth[_0xa3ee('0x9')](),controller[_0xa3ee('0xd')]);router[_0xa3ee('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0xa3ee('0xe')]);router[_0xa3ee('0xf')]('/',auth['isAuthenticated'](),controller[_0xa3ee('0x10')]);router[_0xa3ee('0xf')]('/:id/configurations',auth[_0xa3ee('0x9')](),controller[_0xa3ee('0x11')]);router[_0xa3ee('0x12')](_0xa3ee('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xa3ee('0x13')](_0xa3ee('0xb'),auth[_0xa3ee('0x9')](),controller[_0xa3ee('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 0464870..fef6877 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 _0x44ff=['password','integrationTab','newTab','exports','STRING','remoteUri','token'];(function(_0x57ca75,_0x4c03fd){var _0x551d12=function(_0x4b24a5){while(--_0x4b24a5){_0x57ca75['push'](_0x57ca75['shift']());}};_0x551d12(++_0x4c03fd);}(_0x44ff,0x1c3));var _0xf44f=function(_0x55805d,_0x3815b2){_0x55805d=_0x55805d-0x0;var _0x263d53=_0x44ff[_0x55805d];return _0x263d53;};'use strict';var Sequelize=require('sequelize');module[_0xf44f('0x0')]={'name':{'type':Sequelize[_0xf44f('0x1')]},'description':{'type':Sequelize[_0xf44f('0x1')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xf44f('0x1')],'unique':_0xf44f('0x2')},'authType':{'type':Sequelize['ENUM']('password',_0xf44f('0x3')),'defaultValue':_0xf44f('0x4')},'serverUrl':{'type':Sequelize[_0xf44f('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xf44f('0x5'),_0xf44f('0x6')),'defaultValue':_0xf44f('0x5')}}; \ No newline at end of file +var _0x7af9=['ENUM','integrationTab','sequelize','STRING','username','remoteUri','password'];(function(_0x260c05,_0x1b8037){var _0x49b07c=function(_0x233162){while(--_0x233162){_0x260c05['push'](_0x260c05['shift']());}};_0x49b07c(++_0x1b8037);}(_0x7af9,0x95));var _0x97af=function(_0x4fca36,_0x246b7b){_0x4fca36=_0x4fca36-0x0;var _0x371e9e=_0x7af9[_0x4fca36];return _0x371e9e;};'use strict';var Sequelize=require(_0x97af('0x0'));module['exports']={'name':{'type':Sequelize[_0x97af('0x1')]},'description':{'type':Sequelize[_0x97af('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x97af('0x2')},'password':{'type':Sequelize[_0x97af('0x1')]},'token':{'type':Sequelize[_0x97af('0x1')]},'remoteUri':{'type':Sequelize[_0x97af('0x1')],'unique':_0x97af('0x3')},'authType':{'type':Sequelize['ENUM']('password','token'),'defaultValue':_0x97af('0x4')},'serverUrl':{'type':Sequelize[_0x97af('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x97af('0x5')](_0x97af('0x6'),'newTab'),'defaultValue':_0x97af('0x6')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index a862eef..071ad82 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 _0xe706=['getConfigurations','findOne','ZendeskConfiguration','pick','hasOwnProperty','AccountId','Subjects','getSubjects','Descriptions','channel','ZendeskField','getFields','username','token','authType','remoteUri','slice','substring','GET','format','password','headers','Basic\x20%s','base64','%s/token:%s','toString','Sequelize','ValidationError','Unknown\x20authentication\x20type','description','remove','includes','ticket_fields','title','position','system_field_options','custom_field_options','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','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/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','json','offset','undefined','limit','status','set','Content-Range','apply','reject','save','update','then','stack','name','send','map','ZendeskAccount','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','findAll','rows','show','includeAll','include','find','create','body','catch','params'];(function(_0x56138f,_0x1e9ebb){var _0x1acaf7=function(_0x48690d){while(--_0x48690d){_0x56138f['push'](_0x56138f['shift']());}};_0x1acaf7(++_0x1e9ebb);}(_0xe706,0xa3));var _0x6e70=function(_0x5f46ee,_0x550dbb){_0x5f46ee=_0x5f46ee-0x0;var _0x5f3804=_0xe706[_0x5f46ee];return _0x5f3804;};'use strict';var emlformat=require(_0x6e70('0x0'));var rimraf=require(_0x6e70('0x1'));var zipdir=require(_0x6e70('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6e70('0x3'));var moment=require(_0x6e70('0x4'));var BPromise=require(_0x6e70('0x5'));var Mustache=require(_0x6e70('0x6'));var util=require(_0x6e70('0x7'));var path=require(_0x6e70('0x8'));var sox=require(_0x6e70('0x9'));var csv=require(_0x6e70('0xa'));var ejs=require(_0x6e70('0xb'));var fs=require('fs');var fs_extra=require(_0x6e70('0xc'));var _=require(_0x6e70('0xd'));var squel=require(_0x6e70('0xe'));var crypto=require(_0x6e70('0xf'));var jsforce=require(_0x6e70('0x10'));var deskjs=require(_0x6e70('0x11'));var toCsv=require(_0x6e70('0xa'));var querystring=require(_0x6e70('0x12'));var Papa=require(_0x6e70('0x13'));var Redis=require(_0x6e70('0x14'));var authService=require(_0x6e70('0x15'));var qs=require(_0x6e70('0x16'));var as=require(_0x6e70('0x17'));var hardwareService=require(_0x6e70('0x18'));var logger=require(_0x6e70('0x19'))('api');var utils=require('../../config/utils');var config=require(_0x6e70('0x1a'));var licenseUtil=require(_0x6e70('0x1b'));var db=require(_0x6e70('0x1c'))['db'];var integrations=require(_0x6e70('0x1d'));function respondWithStatusCode(_0x3b38f3,_0x310eb7){_0x310eb7=_0x310eb7||0xcc;return function(_0xa1eb74){if(_0xa1eb74){return _0x3b38f3[_0x6e70('0x1e')](_0x310eb7);}return _0x3b38f3['status'](_0x310eb7)['end']();};}function respondWithResult(_0x48bc72,_0x257e81){_0x257e81=_0x257e81||0xc8;return function(_0x5a37a6){if(_0x5a37a6){return _0x48bc72['status'](_0x257e81)[_0x6e70('0x1f')](_0x5a37a6);}};}function respondWithFilteredResult(_0x22c50c,_0x5d9263){return function(_0x24f3ac){if(_0x24f3ac){var _0x5c3fe7=typeof _0x5d9263[_0x6e70('0x20')]===_0x6e70('0x21')&&typeof _0x5d9263['limit']==='undefined';var _0x3bd572=_0x24f3ac['count'];var _0x28a21f=_0x5c3fe7?0x0:_0x5d9263[_0x6e70('0x20')];var _0x53acdc=_0x5c3fe7?_0x24f3ac['count']:_0x5d9263[_0x6e70('0x20')]+_0x5d9263[_0x6e70('0x22')];var _0x2368eb;if(_0x53acdc>=_0x3bd572){_0x53acdc=_0x3bd572;_0x2368eb=0xc8;}else{_0x2368eb=0xce;}_0x22c50c[_0x6e70('0x23')](_0x2368eb);return _0x22c50c[_0x6e70('0x24')](_0x6e70('0x25'),_0x28a21f+'-'+_0x53acdc+'/'+_0x3bd572)[_0x6e70('0x1f')](_0x24f3ac);}return null;};}function patchUpdates(_0x44a49f){return function(_0x29326f){try{jsonpatch[_0x6e70('0x26')](_0x29326f,_0x44a49f,!![]);}catch(_0x4a0cfe){return BPromise[_0x6e70('0x27')](_0x4a0cfe);}return _0x29326f[_0x6e70('0x28')]();};}function saveUpdates(_0x27b294,_0x502b2d){return function(_0x3ccd87){if(_0x3ccd87){return _0x3ccd87[_0x6e70('0x29')](_0x27b294)[_0x6e70('0x2a')](function(_0x50da2c){return _0x50da2c;});}return null;};}function removeEntity(_0x10fc91,_0x538b9c){return function(_0x50aec2){if(_0x50aec2){return _0x50aec2['destroy']()[_0x6e70('0x2a')](function(){_0x10fc91[_0x6e70('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ecdf1,_0x1196ed){return function(_0x5f268f){if(!_0x5f268f){_0x3ecdf1[_0x6e70('0x1e')](0x194);}return _0x5f268f;};}function handleError(_0x67fb43,_0x2bb231){_0x2bb231=_0x2bb231||0x1f4;return function(_0x4a67ac){logger['error'](_0x4a67ac[_0x6e70('0x2b')]);if(_0x4a67ac[_0x6e70('0x2c')]){delete _0x4a67ac[_0x6e70('0x2c')];}_0x67fb43[_0x6e70('0x23')](_0x2bb231)[_0x6e70('0x2d')](_0x4a67ac);};}exports['index']=function(_0x1952ea,_0x406f29){var _0xecf336={},_0x2864a0={},_0x396a67={'count':0x0,'rows':[]};var _0x20a225=_[_0x6e70('0x2e')](db[_0x6e70('0x2f')][_0x6e70('0x30')],function(_0x3a5d30){return{'name':_0x3a5d30['fieldName'],'type':_0x3a5d30[_0x6e70('0x31')]['key']};});_0x2864a0[_0x6e70('0x32')]=_['map'](_0x20a225,_0x6e70('0x2c'));_0x2864a0[_0x6e70('0x33')]=_[_0x6e70('0x34')](_0x1952ea['query']);_0x2864a0[_0x6e70('0x35')]=_[_0x6e70('0x36')](_0x2864a0['model'],_0x2864a0[_0x6e70('0x33')]);_0xecf336[_0x6e70('0x37')]=_['intersection'](_0x2864a0[_0x6e70('0x32')],qs[_0x6e70('0x38')](_0x1952ea[_0x6e70('0x33')][_0x6e70('0x38')]));_0xecf336[_0x6e70('0x37')]=_0xecf336[_0x6e70('0x37')][_0x6e70('0x39')]?_0xecf336[_0x6e70('0x37')]:_0x2864a0[_0x6e70('0x32')];if(!_0x1952ea[_0x6e70('0x33')]['hasOwnProperty'](_0x6e70('0x3a'))){_0xecf336['limit']=qs[_0x6e70('0x22')](_0x1952ea[_0x6e70('0x33')][_0x6e70('0x22')]);_0xecf336[_0x6e70('0x20')]=qs[_0x6e70('0x20')](_0x1952ea[_0x6e70('0x33')][_0x6e70('0x20')]);}_0xecf336[_0x6e70('0x3b')]=qs[_0x6e70('0x3c')](_0x1952ea[_0x6e70('0x33')][_0x6e70('0x3c')]);_0xecf336[_0x6e70('0x3d')]=qs[_0x6e70('0x35')](_['pick'](_0x1952ea['query'],_0x2864a0['filters']),_0x20a225);if(_0x1952ea[_0x6e70('0x33')][_0x6e70('0x3e')]){_0xecf336[_0x6e70('0x3d')]=_[_0x6e70('0x3f')](_0xecf336[_0x6e70('0x3d')],{'$or':_[_0x6e70('0x2e')](_0x20a225,function(_0x572a71){if(_0x572a71[_0x6e70('0x31')]!==_0x6e70('0x40')){var _0x1c5cde={};_0x1c5cde[_0x572a71[_0x6e70('0x2c')]]={'$like':'%'+_0x1952ea[_0x6e70('0x33')][_0x6e70('0x3e')]+'%'};return _0x1c5cde;}})});}_0xecf336=_[_0x6e70('0x3f')]({},_0xecf336,_0x1952ea[_0x6e70('0x41')]);var _0x5be100={'where':_0xecf336[_0x6e70('0x3d')]};return db[_0x6e70('0x2f')][_0x6e70('0x42')](_0x5be100)[_0x6e70('0x2a')](function(_0x201da9){_0x396a67[_0x6e70('0x42')]=_0x201da9;if(_0x1952ea[_0x6e70('0x33')]['includeAll']){_0xecf336['include']=[{'all':!![]}];}return db['ZendeskAccount'][_0x6e70('0x43')](_0xecf336);})[_0x6e70('0x2a')](function(_0x83847b){_0x396a67[_0x6e70('0x44')]=_0x83847b;return _0x396a67;})[_0x6e70('0x2a')](respondWithFilteredResult(_0x406f29,_0xecf336))['catch'](handleError(_0x406f29,null));};exports[_0x6e70('0x45')]=function(_0x2a58d7,_0x2a2aca){var _0x52b197={'raw':![],'where':{'id':_0x2a58d7['params']['id']}},_0x544ad0={};_0x544ad0[_0x6e70('0x32')]=_['keys'](db[_0x6e70('0x2f')][_0x6e70('0x30')]);_0x544ad0[_0x6e70('0x33')]=_[_0x6e70('0x34')](_0x2a58d7['query']);_0x544ad0[_0x6e70('0x35')]=_['intersection'](_0x544ad0[_0x6e70('0x32')],_0x544ad0[_0x6e70('0x33')]);_0x52b197[_0x6e70('0x37')]=_[_0x6e70('0x36')](_0x544ad0['model'],qs[_0x6e70('0x38')](_0x2a58d7[_0x6e70('0x33')][_0x6e70('0x38')]));_0x52b197[_0x6e70('0x37')]=_0x52b197[_0x6e70('0x37')][_0x6e70('0x39')]?_0x52b197[_0x6e70('0x37')]:_0x544ad0['model'];if(_0x2a58d7[_0x6e70('0x33')][_0x6e70('0x46')]){_0x52b197[_0x6e70('0x47')]=[{'all':!![]}];}_0x52b197=_[_0x6e70('0x3f')]({},_0x52b197,_0x2a58d7[_0x6e70('0x41')]);return db[_0x6e70('0x2f')][_0x6e70('0x48')](_0x52b197)['then'](handleEntityNotFound(_0x2a2aca,null))[_0x6e70('0x2a')](respondWithResult(_0x2a2aca,null))['catch'](handleError(_0x2a2aca,null));};exports[_0x6e70('0x49')]=function(_0x3836e4,_0x4b351e){return db['ZendeskAccount'][_0x6e70('0x49')](_0x3836e4[_0x6e70('0x4a')],{})[_0x6e70('0x2a')](respondWithResult(_0x4b351e,0xc9))['catch'](handleError(_0x4b351e,null));};exports['update']=function(_0x238ebb,_0x11ac3d){if(_0x238ebb[_0x6e70('0x4a')]['id']){delete _0x238ebb[_0x6e70('0x4a')]['id'];}return db[_0x6e70('0x2f')][_0x6e70('0x48')]({'where':{'id':_0x238ebb['params']['id']}})[_0x6e70('0x2a')](handleEntityNotFound(_0x11ac3d,null))[_0x6e70('0x2a')](saveUpdates(_0x238ebb[_0x6e70('0x4a')],null))[_0x6e70('0x2a')](respondWithResult(_0x11ac3d,null))[_0x6e70('0x4b')](handleError(_0x11ac3d,null));};exports['destroy']=function(_0x4ae901,_0x2c5538){return db[_0x6e70('0x2f')][_0x6e70('0x48')]({'where':{'id':_0x4ae901[_0x6e70('0x4c')]['id']}})[_0x6e70('0x2a')](handleEntityNotFound(_0x2c5538,null))['then'](removeEntity(_0x2c5538,null))[_0x6e70('0x4b')](handleError(_0x2c5538,null));};exports[_0x6e70('0x4d')]=function(_0x1fa320,_0x23ebfb,_0x3aba34){var _0x4a111a={};var _0x1142cd={};var _0x1dd242;var _0x2c20d3;return db[_0x6e70('0x2f')][_0x6e70('0x4e')]({'where':{'id':_0x1fa320[_0x6e70('0x4c')]['id']}})['then'](handleEntityNotFound(_0x23ebfb,null))[_0x6e70('0x2a')](function(_0x8d425d){if(_0x8d425d){_0x1dd242=_0x8d425d;_0x1142cd['model']=_[_0x6e70('0x34')](db[_0x6e70('0x4f')]['rawAttributes']);_0x1142cd[_0x6e70('0x33')]=_[_0x6e70('0x34')](_0x1fa320[_0x6e70('0x33')]);_0x1142cd[_0x6e70('0x35')]=_[_0x6e70('0x36')](_0x1142cd['model'],_0x1142cd[_0x6e70('0x33')]);_0x4a111a[_0x6e70('0x37')]=_[_0x6e70('0x36')](_0x1142cd[_0x6e70('0x32')],qs[_0x6e70('0x38')](_0x1fa320[_0x6e70('0x33')][_0x6e70('0x38')]));_0x4a111a[_0x6e70('0x37')]=_0x4a111a[_0x6e70('0x37')][_0x6e70('0x39')]?_0x4a111a[_0x6e70('0x37')]:_0x1142cd[_0x6e70('0x32')];_0x4a111a[_0x6e70('0x3b')]=qs[_0x6e70('0x3c')](_0x1fa320[_0x6e70('0x33')][_0x6e70('0x3c')]);_0x4a111a[_0x6e70('0x3d')]=qs[_0x6e70('0x35')](_[_0x6e70('0x50')](_0x1fa320[_0x6e70('0x33')],_0x1142cd['filters']));if(_0x1fa320[_0x6e70('0x33')][_0x6e70('0x3e')]){_0x4a111a[_0x6e70('0x3d')]=_[_0x6e70('0x3f')](_0x4a111a[_0x6e70('0x3d')],{'$or':_[_0x6e70('0x2e')](_0x4a111a['attributes'],function(_0x42bd85){var _0x6cabf0={};_0x6cabf0[_0x42bd85]={'$like':'%'+_0x1fa320['query'][_0x6e70('0x3e')]+'%'};return _0x6cabf0;})});}_0x4a111a=_[_0x6e70('0x3f')]({},_0x4a111a,_0x1fa320[_0x6e70('0x41')]);return _0x1dd242['getConfigurations'](_0x4a111a);}})['then'](function(_0x2f9be4){if(_0x2f9be4){_0x2c20d3=_0x2f9be4[_0x6e70('0x39')];if(!_0x1fa320[_0x6e70('0x33')][_0x6e70('0x51')](_0x6e70('0x3a'))){_0x4a111a[_0x6e70('0x22')]=qs[_0x6e70('0x22')](_0x1fa320['query']['limit']);_0x4a111a[_0x6e70('0x20')]=qs[_0x6e70('0x20')](_0x1fa320[_0x6e70('0x33')][_0x6e70('0x20')]);}return _0x1dd242['getConfigurations'](_0x4a111a);}})['then'](function(_0x2e972b){if(_0x2e972b){return _0x2e972b?{'count':_0x2c20d3,'rows':_0x2e972b}:null;}})[_0x6e70('0x2a')](respondWithResult(_0x23ebfb,null))['catch'](handleError(_0x23ebfb,null));};exports['addConfiguration']=function(_0x355708,_0x47fbed,_0x2a8fb7){if(_0x355708[_0x6e70('0x4a')]['id']){delete _0x355708[_0x6e70('0x4a')]['id'];}return db[_0x6e70('0x2f')][_0x6e70('0x4e')]({'where':{'id':_0x355708[_0x6e70('0x4c')]['id']}})[_0x6e70('0x2a')](handleEntityNotFound(_0x47fbed,null))[_0x6e70('0x2a')](function(_0x570115){if(_0x570115){_0x355708[_0x6e70('0x4a')][_0x6e70('0x52')]=_0x570115['id'];_0x355708[_0x6e70('0x4a')][_0x6e70('0x53')]=integrations[_0x6e70('0x54')](_0x355708['body']['channel'],_0x355708['body'][_0x6e70('0x31')]);_0x355708[_0x6e70('0x4a')][_0x6e70('0x55')]=integrations['getDescriptions'](_0x355708['body'][_0x6e70('0x56')],_0x355708[_0x6e70('0x4a')][_0x6e70('0x31')]);return db[_0x6e70('0x4f')][_0x6e70('0x49')](_0x355708[_0x6e70('0x4a')],{'include':[{'model':db['ZendeskField'],'as':_0x6e70('0x53')},{'model':db[_0x6e70('0x57')],'as':_0x6e70('0x55')}]});}return null;})[_0x6e70('0x2a')](respondWithResult(_0x47fbed,null))['catch'](handleError(_0x47fbed,null));};exports[_0x6e70('0x58')]=function(_0x531097,_0x5b4046,_0x30487b){var _0x3249a5='';return db[_0x6e70('0x2f')][_0x6e70('0x4e')]({'where':{'id':_0x531097[_0x6e70('0x4c')]['id']},'attributes':['id',_0x6e70('0x59'),'password',_0x6e70('0x5a'),_0x6e70('0x5b'),_0x6e70('0x5c')]})[_0x6e70('0x2a')](handleEntityNotFound(_0x5b4046,null))[_0x6e70('0x2a')](function(_0x13c092){if(_0x13c092){_0x3249a5=_0x13c092[_0x6e70('0x5c')];var _0xd9b4a9=_0x3249a5[_0x6e70('0x5d')](-0x1);if(_0xd9b4a9==='/'){_0x3249a5=_0x3249a5[_0x6e70('0x5e')](0x0,_0x3249a5['lastIndexOf'](_0xd9b4a9));}var _0x44c877={'method':_0x6e70('0x5f'),'uri':util[_0x6e70('0x60')]('%s/%s',_0x3249a5,'ticket_fields'),'json':!![]};switch(_0x13c092[_0x6e70('0x5b')]){case _0x6e70('0x61'):_0x44c877[_0x6e70('0x62')]={'Authorization':util[_0x6e70('0x60')](_0x6e70('0x63'),new Buffer(util['format']('%s:%s',_0x13c092[_0x6e70('0x59')],_0x13c092[_0x6e70('0x61')]))['toString'](_0x6e70('0x64')))};break;case _0x6e70('0x5a'):_0x44c877[_0x6e70('0x62')]={'Authorization':util[_0x6e70('0x60')](_0x6e70('0x63'),new Buffer(util[_0x6e70('0x60')](_0x6e70('0x65'),_0x13c092[_0x6e70('0x59')],_0x13c092[_0x6e70('0x5a')]))[_0x6e70('0x66')](_0x6e70('0x64')))};break;default:throw new db[(_0x6e70('0x67'))][(_0x6e70('0x68'))](_0x6e70('0x69'));}return rp(_0x44c877);}})['then'](function(_0x5b3cb0){if(_0x5b3cb0){var _0x39ed95=['subject',_0x6e70('0x6a'),'group','assignee'];_[_0x6e70('0x6b')](_0x5b3cb0['ticket_fields'],function(_0x576069){return _0x39ed95[_0x6e70('0x6c')](_0x576069[_0x6e70('0x31')]);});return{'count':_0x5b3cb0[_0x6e70('0x6d')]['length'],'rows':_['map'](_0x5b3cb0['ticket_fields'],function(_0x3e7be7){return{'id':_0x3e7be7['id'],'name':_0x3e7be7['position']>0x7?_0x3e7be7[_0x6e70('0x6e')]:_0x3e7be7[_0x6e70('0x31')],'custom':_0x3e7be7[_0x6e70('0x6f')]>0x7?!![]:![],'options':_0x3e7be7[_0x6e70('0x70')]?_0x3e7be7[_0x6e70('0x70')]:_0x3e7be7[_0x6e70('0x71')]?_0x3e7be7[_0x6e70('0x71')]:[]};})};}})['then'](respondWithResult(_0x5b4046,null))[_0x6e70('0x4b')](function(_0x2493b0){var _0xb649a6=_0x531097['query'][_0x6e70('0x72')]?0x1f4:_0x2493b0[_0x6e70('0x73')]||0x1f4;logger[_0x6e70('0x74')](_0x6e70('0x75'),_0x6e70('0x58'),_0xb649a6,JSON[_0x6e70('0x76')](_0x2493b0));delete _0x2493b0[_0x6e70('0x2c')];if(_0xb649a6===0x191){_0xb649a6=0x190;}_0x5b4046[_0x6e70('0x23')](_0xb649a6)[_0x6e70('0x2d')](_0x531097['query'][_0x6e70('0x72')]?{'message':_0x6e70('0x77'),'statusCode':_0x2493b0['statusCode']}:_0x2493b0);});}; \ No newline at end of file +var _0xc788=['query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','findAll','rows','show','params','include','find','catch','create','body','getConfigurations','findOne','ZendeskConfiguration','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','username','password','token','remoteUri','slice','substring','lastIndexOf','GET','format','authType','headers','Basic\x20%s','%s:%s','toString','base64','%s/token:%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','ticket_fields','includes','title','position','system_field_options','custom_field_options','error','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','stack','name','send','index','map','ZendeskAccount','rawAttributes','fieldName','type','model','keys'];(function(_0x3a33cb,_0x34d401){var _0xce8311=function(_0x46cbf7){while(--_0x46cbf7){_0x3a33cb['push'](_0x3a33cb['shift']());}};_0xce8311(++_0x34d401);}(_0xc788,0xc4));var _0x8c78=function(_0x4247e5,_0x30b7bb){_0x4247e5=_0x4247e5-0x0;var _0x5ee3d5=_0xc788[_0x4247e5];return _0x5ee3d5;};'use strict';var emlformat=require(_0x8c78('0x0'));var rimraf=require(_0x8c78('0x1'));var zipdir=require(_0x8c78('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8c78('0x3'));var BPromise=require(_0x8c78('0x4'));var Mustache=require(_0x8c78('0x5'));var util=require(_0x8c78('0x6'));var path=require(_0x8c78('0x7'));var sox=require('sox');var csv=require(_0x8c78('0x8'));var ejs=require(_0x8c78('0x9'));var fs=require('fs');var fs_extra=require(_0x8c78('0xa'));var _=require(_0x8c78('0xb'));var squel=require(_0x8c78('0xc'));var crypto=require('crypto');var jsforce=require(_0x8c78('0xd'));var deskjs=require(_0x8c78('0xe'));var toCsv=require(_0x8c78('0x8'));var querystring=require(_0x8c78('0xf'));var Papa=require(_0x8c78('0x10'));var Redis=require(_0x8c78('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8c78('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8c78('0x13'));var logger=require(_0x8c78('0x14'))('api');var utils=require(_0x8c78('0x15'));var config=require(_0x8c78('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x8c78('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x56a802,_0x349dfa){_0x349dfa=_0x349dfa||0xcc;return function(_0x1b1d0e){if(_0x1b1d0e){return _0x56a802[_0x8c78('0x18')](_0x349dfa);}return _0x56a802[_0x8c78('0x19')](_0x349dfa)[_0x8c78('0x1a')]();};}function respondWithResult(_0x3d1306,_0xe5f8ae){_0xe5f8ae=_0xe5f8ae||0xc8;return function(_0x930233){if(_0x930233){return _0x3d1306[_0x8c78('0x19')](_0xe5f8ae)[_0x8c78('0x1b')](_0x930233);}};}function respondWithFilteredResult(_0x4ff4b0,_0x1fa78e){return function(_0x293cfe){if(_0x293cfe){var _0x57ad11=typeof _0x1fa78e[_0x8c78('0x1c')]===_0x8c78('0x1d')&&typeof _0x1fa78e[_0x8c78('0x1e')]===_0x8c78('0x1d');var _0x2a982c=_0x293cfe[_0x8c78('0x1f')];var _0x54eafa=_0x57ad11?0x0:_0x1fa78e['offset'];var _0x339d04=_0x57ad11?_0x293cfe['count']:_0x1fa78e['offset']+_0x1fa78e[_0x8c78('0x1e')];var _0x56c191;if(_0x339d04>=_0x2a982c){_0x339d04=_0x2a982c;_0x56c191=0xc8;}else{_0x56c191=0xce;}_0x4ff4b0[_0x8c78('0x19')](_0x56c191);return _0x4ff4b0[_0x8c78('0x20')]('Content-Range',_0x54eafa+'-'+_0x339d04+'/'+_0x2a982c)[_0x8c78('0x1b')](_0x293cfe);}return null;};}function patchUpdates(_0x5b111b){return function(_0x2dba52){try{jsonpatch[_0x8c78('0x21')](_0x2dba52,_0x5b111b,!![]);}catch(_0x5a254d){return BPromise[_0x8c78('0x22')](_0x5a254d);}return _0x2dba52[_0x8c78('0x23')]();};}function saveUpdates(_0x499603,_0x2bc595){return function(_0x28ed3a){if(_0x28ed3a){return _0x28ed3a[_0x8c78('0x24')](_0x499603)[_0x8c78('0x25')](function(_0x215940){return _0x215940;});}return null;};}function removeEntity(_0x20f483,_0xbfdf6f){return function(_0x1958f1){if(_0x1958f1){return _0x1958f1[_0x8c78('0x26')]()['then'](function(){_0x20f483[_0x8c78('0x19')](0xcc)[_0x8c78('0x1a')]();});}};}function handleEntityNotFound(_0x1d1cef,_0x49cccb){return function(_0x331bfe){if(!_0x331bfe){_0x1d1cef['sendStatus'](0x194);}return _0x331bfe;};}function handleError(_0xe85d05,_0x24f9a7){_0x24f9a7=_0x24f9a7||0x1f4;return function(_0x8d9ff9){logger['error'](_0x8d9ff9[_0x8c78('0x27')]);if(_0x8d9ff9[_0x8c78('0x28')]){delete _0x8d9ff9['name'];}_0xe85d05[_0x8c78('0x19')](_0x24f9a7)[_0x8c78('0x29')](_0x8d9ff9);};}exports[_0x8c78('0x2a')]=function(_0x36e8e5,_0x253776){var _0x2ab5cc={},_0x5ba7d4={},_0x1c3039={'count':0x0,'rows':[]};var _0x51add6=_[_0x8c78('0x2b')](db[_0x8c78('0x2c')][_0x8c78('0x2d')],function(_0x4e764f){return{'name':_0x4e764f[_0x8c78('0x2e')],'type':_0x4e764f[_0x8c78('0x2f')]['key']};});_0x5ba7d4[_0x8c78('0x30')]=_[_0x8c78('0x2b')](_0x51add6,_0x8c78('0x28'));_0x5ba7d4['query']=_[_0x8c78('0x31')](_0x36e8e5[_0x8c78('0x32')]);_0x5ba7d4[_0x8c78('0x33')]=_['intersection'](_0x5ba7d4[_0x8c78('0x30')],_0x5ba7d4[_0x8c78('0x32')]);_0x2ab5cc['attributes']=_[_0x8c78('0x34')](_0x5ba7d4[_0x8c78('0x30')],qs[_0x8c78('0x35')](_0x36e8e5[_0x8c78('0x32')][_0x8c78('0x35')]));_0x2ab5cc[_0x8c78('0x36')]=_0x2ab5cc[_0x8c78('0x36')][_0x8c78('0x37')]?_0x2ab5cc[_0x8c78('0x36')]:_0x5ba7d4[_0x8c78('0x30')];if(!_0x36e8e5['query'][_0x8c78('0x38')](_0x8c78('0x39'))){_0x2ab5cc[_0x8c78('0x1e')]=qs[_0x8c78('0x1e')](_0x36e8e5[_0x8c78('0x32')]['limit']);_0x2ab5cc[_0x8c78('0x1c')]=qs[_0x8c78('0x1c')](_0x36e8e5[_0x8c78('0x32')]['offset']);}_0x2ab5cc[_0x8c78('0x3a')]=qs[_0x8c78('0x3b')](_0x36e8e5['query'][_0x8c78('0x3b')]);_0x2ab5cc['where']=qs[_0x8c78('0x33')](_[_0x8c78('0x3c')](_0x36e8e5[_0x8c78('0x32')],_0x5ba7d4[_0x8c78('0x33')]),_0x51add6);if(_0x36e8e5['query'][_0x8c78('0x3d')]){_0x2ab5cc['where']=_[_0x8c78('0x3e')](_0x2ab5cc[_0x8c78('0x3f')],{'$or':_[_0x8c78('0x2b')](_0x51add6,function(_0x5ae2aa){if(_0x5ae2aa['type']!==_0x8c78('0x40')){var _0x25d143={};_0x25d143[_0x5ae2aa[_0x8c78('0x28')]]={'$like':'%'+_0x36e8e5[_0x8c78('0x32')][_0x8c78('0x3d')]+'%'};return _0x25d143;}})});}_0x2ab5cc=_[_0x8c78('0x3e')]({},_0x2ab5cc,_0x36e8e5[_0x8c78('0x41')]);var _0x314679={'where':_0x2ab5cc[_0x8c78('0x3f')]};return db[_0x8c78('0x2c')][_0x8c78('0x1f')](_0x314679)[_0x8c78('0x25')](function(_0x234d0e){_0x1c3039['count']=_0x234d0e;if(_0x36e8e5[_0x8c78('0x32')][_0x8c78('0x42')]){_0x2ab5cc['include']=[{'all':!![]}];}return db['ZendeskAccount'][_0x8c78('0x43')](_0x2ab5cc);})[_0x8c78('0x25')](function(_0x5c9af3){_0x1c3039[_0x8c78('0x44')]=_0x5c9af3;return _0x1c3039;})[_0x8c78('0x25')](respondWithFilteredResult(_0x253776,_0x2ab5cc))['catch'](handleError(_0x253776,null));};exports[_0x8c78('0x45')]=function(_0x27603f,_0x57e2c7){var _0x10d521={'raw':![],'where':{'id':_0x27603f[_0x8c78('0x46')]['id']}},_0x24a8ea={};_0x24a8ea[_0x8c78('0x30')]=_[_0x8c78('0x31')](db['ZendeskAccount']['rawAttributes']);_0x24a8ea[_0x8c78('0x32')]=_[_0x8c78('0x31')](_0x27603f[_0x8c78('0x32')]);_0x24a8ea[_0x8c78('0x33')]=_[_0x8c78('0x34')](_0x24a8ea[_0x8c78('0x30')],_0x24a8ea[_0x8c78('0x32')]);_0x10d521[_0x8c78('0x36')]=_[_0x8c78('0x34')](_0x24a8ea[_0x8c78('0x30')],qs[_0x8c78('0x35')](_0x27603f['query'][_0x8c78('0x35')]));_0x10d521[_0x8c78('0x36')]=_0x10d521[_0x8c78('0x36')][_0x8c78('0x37')]?_0x10d521[_0x8c78('0x36')]:_0x24a8ea['model'];if(_0x27603f[_0x8c78('0x32')][_0x8c78('0x42')]){_0x10d521[_0x8c78('0x47')]=[{'all':!![]}];}_0x10d521=_[_0x8c78('0x3e')]({},_0x10d521,_0x27603f[_0x8c78('0x41')]);return db['ZendeskAccount'][_0x8c78('0x48')](_0x10d521)['then'](handleEntityNotFound(_0x57e2c7,null))['then'](respondWithResult(_0x57e2c7,null))[_0x8c78('0x49')](handleError(_0x57e2c7,null));};exports[_0x8c78('0x4a')]=function(_0x61e20,_0x5a5f3b){return db[_0x8c78('0x2c')][_0x8c78('0x4a')](_0x61e20[_0x8c78('0x4b')],{})[_0x8c78('0x25')](respondWithResult(_0x5a5f3b,0xc9))[_0x8c78('0x49')](handleError(_0x5a5f3b,null));};exports[_0x8c78('0x24')]=function(_0x26103c,_0x1f5cdb){if(_0x26103c[_0x8c78('0x4b')]['id']){delete _0x26103c['body']['id'];}return db[_0x8c78('0x2c')][_0x8c78('0x48')]({'where':{'id':_0x26103c[_0x8c78('0x46')]['id']}})[_0x8c78('0x25')](handleEntityNotFound(_0x1f5cdb,null))['then'](saveUpdates(_0x26103c[_0x8c78('0x4b')],null))[_0x8c78('0x25')](respondWithResult(_0x1f5cdb,null))[_0x8c78('0x49')](handleError(_0x1f5cdb,null));};exports[_0x8c78('0x26')]=function(_0x53e75c,_0x336b95){return db[_0x8c78('0x2c')][_0x8c78('0x48')]({'where':{'id':_0x53e75c['params']['id']}})[_0x8c78('0x25')](handleEntityNotFound(_0x336b95,null))['then'](removeEntity(_0x336b95,null))[_0x8c78('0x49')](handleError(_0x336b95,null));};exports[_0x8c78('0x4c')]=function(_0x402faa,_0xa87aba,_0x349b87){var _0x462b89={};var _0xf68e0={};var _0x38fec1;var _0x19d807;return db[_0x8c78('0x2c')][_0x8c78('0x4d')]({'where':{'id':_0x402faa[_0x8c78('0x46')]['id']}})[_0x8c78('0x25')](handleEntityNotFound(_0xa87aba,null))[_0x8c78('0x25')](function(_0x54b40d){if(_0x54b40d){_0x38fec1=_0x54b40d;_0xf68e0[_0x8c78('0x30')]=_[_0x8c78('0x31')](db[_0x8c78('0x4e')][_0x8c78('0x2d')]);_0xf68e0['query']=_[_0x8c78('0x31')](_0x402faa[_0x8c78('0x32')]);_0xf68e0[_0x8c78('0x33')]=_[_0x8c78('0x34')](_0xf68e0[_0x8c78('0x30')],_0xf68e0[_0x8c78('0x32')]);_0x462b89['attributes']=_[_0x8c78('0x34')](_0xf68e0[_0x8c78('0x30')],qs['fields'](_0x402faa[_0x8c78('0x32')]['fields']));_0x462b89[_0x8c78('0x36')]=_0x462b89[_0x8c78('0x36')][_0x8c78('0x37')]?_0x462b89[_0x8c78('0x36')]:_0xf68e0[_0x8c78('0x30')];_0x462b89[_0x8c78('0x3a')]=qs[_0x8c78('0x3b')](_0x402faa['query'][_0x8c78('0x3b')]);_0x462b89[_0x8c78('0x3f')]=qs['filters'](_[_0x8c78('0x3c')](_0x402faa[_0x8c78('0x32')],_0xf68e0['filters']));if(_0x402faa[_0x8c78('0x32')][_0x8c78('0x3d')]){_0x462b89[_0x8c78('0x3f')]=_[_0x8c78('0x3e')](_0x462b89[_0x8c78('0x3f')],{'$or':_[_0x8c78('0x2b')](_0x462b89[_0x8c78('0x36')],function(_0x445630){var _0x20a0d9={};_0x20a0d9[_0x445630]={'$like':'%'+_0x402faa[_0x8c78('0x32')][_0x8c78('0x3d')]+'%'};return _0x20a0d9;})});}_0x462b89=_[_0x8c78('0x3e')]({},_0x462b89,_0x402faa[_0x8c78('0x41')]);return _0x38fec1[_0x8c78('0x4c')](_0x462b89);}})['then'](function(_0x3897ea){if(_0x3897ea){_0x19d807=_0x3897ea['length'];if(!_0x402faa[_0x8c78('0x32')]['hasOwnProperty']('nolimit')){_0x462b89['limit']=qs[_0x8c78('0x1e')](_0x402faa['query']['limit']);_0x462b89['offset']=qs[_0x8c78('0x1c')](_0x402faa[_0x8c78('0x32')][_0x8c78('0x1c')]);}return _0x38fec1[_0x8c78('0x4c')](_0x462b89);}})['then'](function(_0x333272){if(_0x333272){return _0x333272?{'count':_0x19d807,'rows':_0x333272}:null;}})[_0x8c78('0x25')](respondWithResult(_0xa87aba,null))[_0x8c78('0x49')](handleError(_0xa87aba,null));};exports[_0x8c78('0x4f')]=function(_0x334d0a,_0x3c3332,_0x3990c2){if(_0x334d0a[_0x8c78('0x4b')]['id']){delete _0x334d0a[_0x8c78('0x4b')]['id'];}return db[_0x8c78('0x2c')][_0x8c78('0x4d')]({'where':{'id':_0x334d0a[_0x8c78('0x46')]['id']}})[_0x8c78('0x25')](handleEntityNotFound(_0x3c3332,null))[_0x8c78('0x25')](function(_0x4bdb7e){if(_0x4bdb7e){_0x334d0a[_0x8c78('0x4b')]['AccountId']=_0x4bdb7e['id'];_0x334d0a[_0x8c78('0x4b')][_0x8c78('0x50')]=integrations[_0x8c78('0x51')](_0x334d0a['body'][_0x8c78('0x52')],_0x334d0a[_0x8c78('0x4b')][_0x8c78('0x2f')]);_0x334d0a['body'][_0x8c78('0x53')]=integrations[_0x8c78('0x54')](_0x334d0a['body'][_0x8c78('0x52')],_0x334d0a[_0x8c78('0x4b')][_0x8c78('0x2f')]);return db['ZendeskConfiguration'][_0x8c78('0x4a')](_0x334d0a[_0x8c78('0x4b')],{'include':[{'model':db[_0x8c78('0x55')],'as':_0x8c78('0x50')},{'model':db[_0x8c78('0x55')],'as':_0x8c78('0x53')}]});}return null;})[_0x8c78('0x25')](respondWithResult(_0x3c3332,null))[_0x8c78('0x49')](handleError(_0x3c3332,null));};exports[_0x8c78('0x56')]=function(_0x5646ff,_0x1f2b8f,_0x21b400){var _0x3c6886='';return db[_0x8c78('0x2c')][_0x8c78('0x4d')]({'where':{'id':_0x5646ff[_0x8c78('0x46')]['id']},'attributes':['id',_0x8c78('0x57'),_0x8c78('0x58'),_0x8c78('0x59'),'authType',_0x8c78('0x5a')]})[_0x8c78('0x25')](handleEntityNotFound(_0x1f2b8f,null))['then'](function(_0x5e6a23){if(_0x5e6a23){_0x3c6886=_0x5e6a23[_0x8c78('0x5a')];var _0x4dbb47=_0x3c6886[_0x8c78('0x5b')](-0x1);if(_0x4dbb47==='/'){_0x3c6886=_0x3c6886[_0x8c78('0x5c')](0x0,_0x3c6886[_0x8c78('0x5d')](_0x4dbb47));}var _0x476835={'method':_0x8c78('0x5e'),'uri':util[_0x8c78('0x5f')]('%s/%s',_0x3c6886,'ticket_fields'),'json':!![]};switch(_0x5e6a23[_0x8c78('0x60')]){case _0x8c78('0x58'):_0x476835[_0x8c78('0x61')]={'Authorization':util[_0x8c78('0x5f')](_0x8c78('0x62'),new Buffer(util['format'](_0x8c78('0x63'),_0x5e6a23[_0x8c78('0x57')],_0x5e6a23[_0x8c78('0x58')]))[_0x8c78('0x64')](_0x8c78('0x65')))};break;case _0x8c78('0x59'):_0x476835['headers']={'Authorization':util[_0x8c78('0x5f')](_0x8c78('0x62'),new Buffer(util['format'](_0x8c78('0x66'),_0x5e6a23[_0x8c78('0x57')],_0x5e6a23[_0x8c78('0x59')]))[_0x8c78('0x64')](_0x8c78('0x65')))};break;default:throw new db[(_0x8c78('0x67'))][(_0x8c78('0x68'))](_0x8c78('0x69'));}return rp(_0x476835);}})[_0x8c78('0x25')](function(_0x402cff){if(_0x402cff){var _0x280a8b=[_0x8c78('0x6a'),_0x8c78('0x6b'),_0x8c78('0x6c'),_0x8c78('0x6d')];_[_0x8c78('0x6e')](_0x402cff[_0x8c78('0x6f')],function(_0x4c6cc5){return _0x280a8b[_0x8c78('0x70')](_0x4c6cc5['type']);});return{'count':_0x402cff['ticket_fields'][_0x8c78('0x37')],'rows':_[_0x8c78('0x2b')](_0x402cff[_0x8c78('0x6f')],function(_0x3b3c51){return{'id':_0x3b3c51['id'],'name':_0x3b3c51['position']>0x7?_0x3b3c51[_0x8c78('0x71')]:_0x3b3c51[_0x8c78('0x2f')],'custom':_0x3b3c51[_0x8c78('0x72')]>0x7?!![]:![],'options':_0x3b3c51['system_field_options']?_0x3b3c51[_0x8c78('0x73')]:_0x3b3c51[_0x8c78('0x74')]?_0x3b3c51[_0x8c78('0x74')]:[]};})};}})[_0x8c78('0x25')](respondWithResult(_0x1f2b8f,null))['catch'](function(_0xfff9a5){var _0x837c68=_0x5646ff['query']['test']?0x1f4:_0xfff9a5['statusCode']||0x1f4;logger[_0x8c78('0x75')](_0x8c78('0x76'),_0x8c78('0x56'),_0x837c68,JSON[_0x8c78('0x77')](_0xfff9a5));delete _0xfff9a5['name'];if(_0x837c68===0x191){_0x837c68=0x190;}_0x1f2b8f[_0x8c78('0x19')](_0x837c68)['send'](_0x5646ff[_0x8c78('0x32')][_0x8c78('0x78')]?{'message':_0x8c78('0x79'),'statusCode':_0xfff9a5[_0x8c78('0x7a')]}:_0xfff9a5);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 395b2b3..368583d 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 _0x54e0=['rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','define','int_zendesk_accounts','lodash','moment','bluebird','path'];(function(_0x3dbd5f,_0x4dff30){var _0x3c619a=function(_0x379f01){while(--_0x379f01){_0x3dbd5f['push'](_0x3dbd5f['shift']());}};_0x3c619a(++_0x4dff30);}(_0x54e0,0x182));var _0x054e=function(_0x18f674,_0x47cd0a){_0x18f674=_0x18f674-0x0;var _0xdd157f=_0x54e0[_0x18f674];return _0xdd157f;};'use strict';var _=require(_0x054e('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x054e('0x1'));var BPromise=require(_0x054e('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x054e('0x3'));var rimraf=require(_0x054e('0x4'));var config=require(_0x054e('0x5'));var attributes=require(_0x054e('0x6'));var integrations=require(_0x054e('0x7'));module['exports']=function(_0x3bfad4,_0x294608){return _0x3bfad4[_0x054e('0x8')]('ZendeskAccount',attributes,{'tableName':_0x054e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x47fc=['lodash','api','moment','bluebird','request-promise','path','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount'];(function(_0x2d2623,_0x1aaea0){var _0x28f6c1=function(_0x599d40){while(--_0x599d40){_0x2d2623['push'](_0x2d2623['shift']());}};_0x28f6c1(++_0x1aaea0);}(_0x47fc,0x18c));var _0xc47f=function(_0x414564,_0x496715){_0x414564=_0x414564-0x0;var _0x1a6071=_0x47fc[_0x414564];return _0x1a6071;};'use strict';var _=require(_0xc47f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc47f('0x1'));var moment=require(_0xc47f('0x2'));var BPromise=require(_0xc47f('0x3'));var rp=require(_0xc47f('0x4'));var fs=require('fs');var path=require(_0xc47f('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc47f('0x6'));var integrations=require(_0xc47f('0x7'));module[_0xc47f('0x8')]=function(_0x11a529,_0x315619){return _0x11a529[_0xc47f('0x9')](_0xc47f('0xa'),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 6330369..6c6ed3b 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 _0x6838=['bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','attributes','include','map','model','ShowZendeskAccount','find','moment'];(function(_0xc4e092,_0x5059f7){var _0xa4f542=function(_0x302769){while(--_0x302769){_0xc4e092['push'](_0xc4e092['shift']());}};_0xa4f542(++_0x5059f7);}(_0x6838,0x7b));var _0x8683=function(_0x5b077b,_0x50b707){_0x5b077b=_0x5b077b-0x0;var _0x16faf7=_0x6838[_0x5b077b];return _0x16faf7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8683('0x0'));var BPromise=require(_0x8683('0x1'));var rs=require(_0x8683('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8683('0x3'))['db'];var utils=require(_0x8683('0x4'));var logger=require('../../config/logger')(_0x8683('0x5'));var config=require(_0x8683('0x6'));var jayson=require(_0x8683('0x7'));var client=jayson[_0x8683('0x8')][_0x8683('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1d59c8,_0xf807b1,_0x5df399){return new BPromise(function(_0x5c88c2,_0x110bad){return client['request'](_0x1d59c8,_0x5df399)[_0x8683('0xa')](function(_0x565014){logger[_0x8683('0xb')](_0x8683('0xc'),_0xf807b1,_0x8683('0xd'));logger[_0x8683('0xe')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0xf807b1,_0x8683('0xd'),JSON[_0x8683('0xf')](_0x565014));if(_0x565014[_0x8683('0x10')]){if(_0x565014[_0x8683('0x10')][_0x8683('0x11')]===0x1f4){logger[_0x8683('0x10')](_0x8683('0xc'),_0xf807b1,_0x565014['error'][_0x8683('0x12')]);return _0x110bad(_0x565014[_0x8683('0x10')][_0x8683('0x12')]);}logger[_0x8683('0x10')](_0x8683('0xc'),_0xf807b1,_0x565014[_0x8683('0x10')][_0x8683('0x12')]);return _0x5c88c2(_0x565014[_0x8683('0x10')][_0x8683('0x12')]);}else{logger[_0x8683('0xb')](_0x8683('0xc'),_0xf807b1,'request\x20sent');_0x5c88c2(_0x565014['result'][_0x8683('0x12')]);}})[_0x8683('0x13')](function(_0x18248e){logger[_0x8683('0x10')](_0x8683('0xc'),_0xf807b1,_0x18248e);_0x110bad(_0x18248e);});});}exports[_0x8683('0x14')]=function(_0x52efb4){var _0x434c0b=this;return new Promise(function(_0x359377,_0x2db028){return db[_0x8683('0x15')][_0x8683('0x16')]({'raw':_0x52efb4[_0x8683('0x17')]?_0x52efb4['options'][_0x8683('0x18')]===undefined?!![]:![]:!![],'where':_0x52efb4['options']?_0x52efb4['options']['where']||null:null,'attributes':_0x52efb4[_0x8683('0x17')]?_0x52efb4[_0x8683('0x17')][_0x8683('0x19')]||null:null,'limit':_0x52efb4[_0x8683('0x17')]?_0x52efb4['options']['limit']||null:null,'include':_0x52efb4[_0x8683('0x17')]?_0x52efb4[_0x8683('0x17')][_0x8683('0x1a')]?_[_0x8683('0x1b')](_0x52efb4[_0x8683('0x17')][_0x8683('0x1a')],function(_0x1ccf9a){return{'model':db[_0x1ccf9a[_0x8683('0x1c')]],'as':_0x1ccf9a['as'],'attributes':_0x1ccf9a[_0x8683('0x19')],'include':_0x1ccf9a[_0x8683('0x1a')]?_[_0x8683('0x1b')](_0x1ccf9a[_0x8683('0x1a')],function(_0x521f67){return{'model':db[_0x521f67[_0x8683('0x1c')]],'as':_0x521f67['as'],'attributes':_0x521f67['attributes'],'include':_0x521f67[_0x8683('0x1a')]?_[_0x8683('0x1b')](_0x521f67[_0x8683('0x1a')],function(_0x3e5120){return{'model':db[_0x3e5120['model']],'as':_0x3e5120['as'],'attributes':_0x3e5120['attributes']};}):[]};}):[]};}):[]:[]})[_0x8683('0xa')](function(_0x1b0d86){logger[_0x8683('0xb')](_0x8683('0x14'),_0x52efb4);logger[_0x8683('0xe')](_0x8683('0x14'),_0x52efb4,JSON[_0x8683('0xf')](_0x1b0d86));_0x359377(_0x1b0d86);})[_0x8683('0x13')](function(_0x43cc4c){logger[_0x8683('0x10')](_0x8683('0x14'),_0x43cc4c[_0x8683('0x12')],_0x52efb4);_0x2db028(_0x434c0b[_0x8683('0x10')](0x1f4,_0x43cc4c[_0x8683('0x12')]));});});};exports[_0x8683('0x1d')]=function(_0x4030f8){var _0x223188=this;return new Promise(function(_0x4bc62a,_0x36bd2f){return db[_0x8683('0x15')][_0x8683('0x1e')]({'raw':_0x4030f8[_0x8683('0x17')]?_0x4030f8[_0x8683('0x17')][_0x8683('0x18')]===undefined?!![]:![]:!![],'where':_0x4030f8[_0x8683('0x17')]?_0x4030f8['options']['where']||null:null,'attributes':_0x4030f8[_0x8683('0x17')]?_0x4030f8['options'][_0x8683('0x19')]||null:null,'include':_0x4030f8[_0x8683('0x17')]?_0x4030f8[_0x8683('0x17')][_0x8683('0x1a')]?_[_0x8683('0x1b')](_0x4030f8['options'][_0x8683('0x1a')],function(_0x579f67){return{'model':db[_0x579f67[_0x8683('0x1c')]],'as':_0x579f67['as'],'attributes':_0x579f67[_0x8683('0x19')],'include':_0x579f67[_0x8683('0x1a')]?_[_0x8683('0x1b')](_0x579f67[_0x8683('0x1a')],function(_0x2bb363){return{'model':db[_0x2bb363[_0x8683('0x1c')]],'as':_0x2bb363['as'],'attributes':_0x2bb363[_0x8683('0x19')],'include':_0x2bb363[_0x8683('0x1a')]?_[_0x8683('0x1b')](_0x2bb363[_0x8683('0x1a')],function(_0x1f8d52){return{'model':db[_0x1f8d52[_0x8683('0x1c')]],'as':_0x1f8d52['as'],'attributes':_0x1f8d52[_0x8683('0x19')]};}):[]};}):[]};}):[]:[]})[_0x8683('0xa')](function(_0x23b5a4){logger[_0x8683('0xb')](_0x8683('0x1d'),_0x4030f8);logger['debug'](_0x8683('0x1d'),_0x4030f8,JSON[_0x8683('0xf')](_0x23b5a4));_0x4bc62a(_0x23b5a4);})[_0x8683('0x13')](function(_0x4ba2be){logger[_0x8683('0x10')]('ShowZendeskAccount',_0x4ba2be['message'],_0x4030f8);_0x36bd2f(_0x223188[_0x8683('0x10')](0x1f4,_0x4ba2be[_0x8683('0x12')]));});});}; \ No newline at end of file +var _0x9616=['request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetZendeskAccount','findAll','options','raw','attributes','limit','include','map','model','ShowZendeskAccount','ZendeskAccount','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','http','then','info','ZendeskAccount,\x20%s,\x20%s'];(function(_0x247508,_0xe90ba2){var _0x403c07=function(_0x4e0ae7){while(--_0x4e0ae7){_0x247508['push'](_0x247508['shift']());}};_0x403c07(++_0xe90ba2);}(_0x9616,0x1f4));var _0x6961=function(_0xd158dc,_0x128608){_0xd158dc=_0xd158dc-0x0;var _0x12d25f=_0x9616[_0xd158dc];return _0x12d25f;};'use strict';var _=require(_0x6961('0x0'));var util=require('util');var moment=require(_0x6961('0x1'));var BPromise=require(_0x6961('0x2'));var rs=require(_0x6961('0x3'));var fs=require('fs');var Redis=require(_0x6961('0x4'));var db=require(_0x6961('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6961('0x6'))(_0x6961('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x6961('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x396bb5,_0x806896,_0xb1a894){return new BPromise(function(_0x2ca863,_0x3b490f){return client['request'](_0x396bb5,_0xb1a894)[_0x6961('0x9')](function(_0xc9dfd4){logger[_0x6961('0xa')](_0x6961('0xb'),_0x806896,_0x6961('0xc'));logger[_0x6961('0xd')](_0x6961('0xe'),_0x806896,_0x6961('0xc'),JSON[_0x6961('0xf')](_0xc9dfd4));if(_0xc9dfd4[_0x6961('0x10')]){if(_0xc9dfd4[_0x6961('0x10')][_0x6961('0x11')]===0x1f4){logger[_0x6961('0x10')](_0x6961('0xb'),_0x806896,_0xc9dfd4[_0x6961('0x10')][_0x6961('0x12')]);return _0x3b490f(_0xc9dfd4[_0x6961('0x10')]['message']);}logger[_0x6961('0x10')](_0x6961('0xb'),_0x806896,_0xc9dfd4['error'][_0x6961('0x12')]);return _0x2ca863(_0xc9dfd4[_0x6961('0x10')][_0x6961('0x12')]);}else{logger['info'](_0x6961('0xb'),_0x806896,_0x6961('0xc'));_0x2ca863(_0xc9dfd4['result']['message']);}})[_0x6961('0x13')](function(_0x233cde){logger['error'](_0x6961('0xb'),_0x806896,_0x233cde);_0x3b490f(_0x233cde);});});}exports[_0x6961('0x14')]=function(_0x1e67cd){var _0x15c250=this;return new Promise(function(_0x133872,_0xdc4b42){return db['ZendeskAccount'][_0x6961('0x15')]({'raw':_0x1e67cd[_0x6961('0x16')]?_0x1e67cd['options'][_0x6961('0x17')]===undefined?!![]:![]:!![],'where':_0x1e67cd[_0x6961('0x16')]?_0x1e67cd['options']['where']||null:null,'attributes':_0x1e67cd[_0x6961('0x16')]?_0x1e67cd['options'][_0x6961('0x18')]||null:null,'limit':_0x1e67cd[_0x6961('0x16')]?_0x1e67cd[_0x6961('0x16')][_0x6961('0x19')]||null:null,'include':_0x1e67cd[_0x6961('0x16')]?_0x1e67cd['options'][_0x6961('0x1a')]?_[_0x6961('0x1b')](_0x1e67cd['options'][_0x6961('0x1a')],function(_0x4e1aa2){return{'model':db[_0x4e1aa2[_0x6961('0x1c')]],'as':_0x4e1aa2['as'],'attributes':_0x4e1aa2[_0x6961('0x18')],'include':_0x4e1aa2[_0x6961('0x1a')]?_[_0x6961('0x1b')](_0x4e1aa2[_0x6961('0x1a')],function(_0xc42693){return{'model':db[_0xc42693[_0x6961('0x1c')]],'as':_0xc42693['as'],'attributes':_0xc42693[_0x6961('0x18')],'include':_0xc42693[_0x6961('0x1a')]?_[_0x6961('0x1b')](_0xc42693['include'],function(_0x455486){return{'model':db[_0x455486['model']],'as':_0x455486['as'],'attributes':_0x455486['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x414d13){logger[_0x6961('0xa')]('GetZendeskAccount',_0x1e67cd);logger[_0x6961('0xd')](_0x6961('0x14'),_0x1e67cd,JSON['stringify'](_0x414d13));_0x133872(_0x414d13);})['catch'](function(_0x446d5d){logger[_0x6961('0x10')]('GetZendeskAccount',_0x446d5d[_0x6961('0x12')],_0x1e67cd);_0xdc4b42(_0x15c250['error'](0x1f4,_0x446d5d[_0x6961('0x12')]));});});};exports[_0x6961('0x1d')]=function(_0x3776ff){var _0x95ee8a=this;return new Promise(function(_0x3388d8,_0x1030c9){return db[_0x6961('0x1e')][_0x6961('0x1f')]({'raw':_0x3776ff[_0x6961('0x16')]?_0x3776ff['options'][_0x6961('0x17')]===undefined?!![]:![]:!![],'where':_0x3776ff[_0x6961('0x16')]?_0x3776ff['options']['where']||null:null,'attributes':_0x3776ff[_0x6961('0x16')]?_0x3776ff[_0x6961('0x16')][_0x6961('0x18')]||null:null,'include':_0x3776ff['options']?_0x3776ff[_0x6961('0x16')][_0x6961('0x1a')]?_[_0x6961('0x1b')](_0x3776ff[_0x6961('0x16')][_0x6961('0x1a')],function(_0x3362e2){return{'model':db[_0x3362e2[_0x6961('0x1c')]],'as':_0x3362e2['as'],'attributes':_0x3362e2[_0x6961('0x18')],'include':_0x3362e2[_0x6961('0x1a')]?_[_0x6961('0x1b')](_0x3362e2[_0x6961('0x1a')],function(_0xb4b116){return{'model':db[_0xb4b116['model']],'as':_0xb4b116['as'],'attributes':_0xb4b116[_0x6961('0x18')],'include':_0xb4b116[_0x6961('0x1a')]?_[_0x6961('0x1b')](_0xb4b116[_0x6961('0x1a')],function(_0x3e9392){return{'model':db[_0x3e9392[_0x6961('0x1c')]],'as':_0x3e9392['as'],'attributes':_0x3e9392['attributes']};}):[]};}):[]};}):[]:[]})[_0x6961('0x9')](function(_0x3815b1){logger[_0x6961('0xa')](_0x6961('0x1d'),_0x3776ff);logger[_0x6961('0xd')](_0x6961('0x1d'),_0x3776ff,JSON[_0x6961('0xf')](_0x3815b1));_0x3388d8(_0x3815b1);})['catch'](function(_0x3b822d){logger[_0x6961('0x10')](_0x6961('0x1d'),_0x3b822d[_0x6961('0x12')],_0x3776ff);_0x1030c9(_0x95ee8a[_0x6961('0x10')](0x1f4,_0x3b822d['message']));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index f2a2849..cfb8db8 100644 --- a/server/api/intZendeskConfiguration/index.js +++ b/server/api/intZendeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['index','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','post','setTags','put','/:id','update','delete','destroy','exports','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get'];(function(_0x200e00,_0x11ebeb){var _0x2b65b6=function(_0x2d2753){while(--_0x2d2753){_0x200e00['push'](_0x200e00['shift']());}};_0x2b65b6(++_0x11ebeb);}(_0x757a,0xde));var _0xa757=function(_0x24879e,_0x34cc62){_0x24879e=_0x24879e-0x0;var _0x288df4=_0x757a[_0x24879e];return _0x288df4;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa757('0x2'));var auth=require(_0xa757('0x3'));var interaction=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var controller=require(_0xa757('0x6'));router[_0xa757('0x7')]('/',auth['isAuthenticated'](),controller[_0xa757('0x8')]);router[_0xa757('0x7')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0x7')](_0xa757('0xb'),auth[_0xa757('0x9')](),controller['getFields']);router[_0xa757('0x7')](_0xa757('0xc'),auth[_0xa757('0x9')](),controller[_0xa757('0xd')]);router[_0xa757('0x7')](_0xa757('0xe'),auth[_0xa757('0x9')](),controller['getDescriptions']);router['get']('/:id/tags',auth['isAuthenticated'](),controller['getTags']);router[_0xa757('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa757('0xf')]('/:id/tags',auth['isAuthenticated'](),controller[_0xa757('0x10')]);router[_0xa757('0x11')](_0xa757('0x12'),auth[_0xa757('0x9')](),controller[_0xa757('0x13')]);router[_0xa757('0x14')](_0xa757('0x12'),auth[_0xa757('0x9')](),controller[_0xa757('0x15')]);module[_0xa757('0x16')]=router; \ No newline at end of file +var _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(_0x551eeb,_0x3e3b01){var _0x18bd9b=function(_0x157b37){while(--_0x157b37){_0x551eeb['push'](_0x551eeb['shift']());}};_0x18bd9b(++_0x3e3b01);}(_0xe706,0xa3));var _0x6e70=function(_0x2e1906,_0xa281e9){_0x2e1906=_0x2e1906-0x0;var _0x3ea10e=_0xe706[_0x2e1906];return _0x3ea10e;};'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 diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index a03321b..792b2bd 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 _0xa38e=['STRING','sequelize'];(function(_0x13e062,_0x125d96){var _0x3c3693=function(_0x399106){while(--_0x399106){_0x13e062['push'](_0x13e062['shift']());}};_0x3c3693(++_0x125d96);}(_0xa38e,0xf1));var _0xea38=function(_0x2d126e,_0x1e8257){_0x2d126e=_0x2d126e-0x0;var _0xcb04d3=_0xa38e[_0x2d126e];return _0xcb04d3;};'use strict';var Sequelize=require(_0xea38('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xea38('0x1')]}}; \ No newline at end of file +var _0x5146=['sequelize','exports','STRING'];(function(_0x5d88c0,_0x5d7d83){var _0x1b40f0=function(_0x3fde10){while(--_0x3fde10){_0x5d88c0['push'](_0x5d88c0['shift']());}};_0x1b40f0(++_0x5d7d83);}(_0x5146,0x15f));var _0x6514=function(_0x602fa3,_0x43a87f){_0x602fa3=_0x602fa3-0x0;var _0x352fa1=_0x5146[_0x602fa3];return _0x352fa1;};'use strict';var Sequelize=require(_0x6514('0x0'));module[_0x6514('0x1')]={'name':{'type':Sequelize[_0x6514('0x2')]},'description':{'type':Sequelize[_0x6514('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 33d4481..d0e511c 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 _0x94b0=['rows','show','params','length','includeAll','catch','create','body','update','destroy','getFields','findOne','ZendeskField','hasOwnProperty','getSubjects','getDescriptions','Tag','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','stack','name','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll'];(function(_0x2eeca7,_0x47ca76){var _0x420e12=function(_0x171076){while(--_0x171076){_0x2eeca7['push'](_0x2eeca7['shift']());}};_0x420e12(++_0x47ca76);}(_0x94b0,0xc4));var _0x094b=function(_0x14fda9,_0x52860f){_0x14fda9=_0x14fda9-0x0;var _0x4046e6=_0x94b0[_0x14fda9];return _0x4046e6;};'use strict';var emlformat=require(_0x094b('0x0'));var rimraf=require(_0x094b('0x1'));var zipdir=require(_0x094b('0x2'));var jsonpatch=require(_0x094b('0x3'));var rp=require(_0x094b('0x4'));var moment=require(_0x094b('0x5'));var BPromise=require(_0x094b('0x6'));var Mustache=require(_0x094b('0x7'));var util=require(_0x094b('0x8'));var path=require(_0x094b('0x9'));var sox=require('sox');var csv=require(_0x094b('0xa'));var ejs=require(_0x094b('0xb'));var fs=require('fs');var fs_extra=require(_0x094b('0xc'));var _=require(_0x094b('0xd'));var squel=require(_0x094b('0xe'));var crypto=require('crypto');var jsforce=require(_0x094b('0xf'));var deskjs=require(_0x094b('0x10'));var toCsv=require('to-csv');var querystring=require(_0x094b('0x11'));var Papa=require('papaparse');var Redis=require(_0x094b('0x12'));var authService=require(_0x094b('0x13'));var qs=require(_0x094b('0x14'));var as=require(_0x094b('0x15'));var hardwareService=require(_0x094b('0x16'));var logger=require(_0x094b('0x17'))(_0x094b('0x18'));var utils=require(_0x094b('0x19'));var config=require(_0x094b('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x094b('0x1b'))['db'];function respondWithStatusCode(_0xa5593f,_0x3eb0ad){_0x3eb0ad=_0x3eb0ad||0xcc;return function(_0x343a91){if(_0x343a91){return _0xa5593f['sendStatus'](_0x3eb0ad);}return _0xa5593f[_0x094b('0x1c')](_0x3eb0ad)[_0x094b('0x1d')]();};}function respondWithResult(_0x36d800,_0x15d9d0){_0x15d9d0=_0x15d9d0||0xc8;return function(_0xdd6e77){if(_0xdd6e77){return _0x36d800[_0x094b('0x1c')](_0x15d9d0)[_0x094b('0x1e')](_0xdd6e77);}};}function respondWithFilteredResult(_0x3dd993,_0x59fbf0){return function(_0x52be86){if(_0x52be86){var _0x2f1750=typeof _0x59fbf0[_0x094b('0x1f')]===_0x094b('0x20')&&typeof _0x59fbf0[_0x094b('0x21')]===_0x094b('0x20');var _0x50311d=_0x52be86[_0x094b('0x22')];var _0x3b3b48=_0x2f1750?0x0:_0x59fbf0[_0x094b('0x1f')];var _0x36a2ea=_0x2f1750?_0x52be86['count']:_0x59fbf0['offset']+_0x59fbf0[_0x094b('0x21')];var _0x4c4fb0;if(_0x36a2ea>=_0x50311d){_0x36a2ea=_0x50311d;_0x4c4fb0=0xc8;}else{_0x4c4fb0=0xce;}_0x3dd993[_0x094b('0x1c')](_0x4c4fb0);return _0x3dd993[_0x094b('0x23')](_0x094b('0x24'),_0x3b3b48+'-'+_0x36a2ea+'/'+_0x50311d)[_0x094b('0x1e')](_0x52be86);}return null;};}function patchUpdates(_0x4c7c07){return function(_0x29b596){try{jsonpatch[_0x094b('0x25')](_0x29b596,_0x4c7c07,!![]);}catch(_0x237594){return BPromise[_0x094b('0x26')](_0x237594);}return _0x29b596[_0x094b('0x27')]();};}function saveUpdates(_0x542141,_0x5b0b70){return function(_0x16a3cb){if(_0x16a3cb){return _0x16a3cb['update'](_0x542141)[_0x094b('0x28')](function(_0xf276da){return _0xf276da;});}return null;};}function removeEntity(_0x4f0a9d,_0x324cbc){return function(_0x18700a){if(_0x18700a){return _0x18700a['destroy']()[_0x094b('0x28')](function(){_0x4f0a9d[_0x094b('0x1c')](0xcc)[_0x094b('0x1d')]();});}};}function handleEntityNotFound(_0x592460,_0x535e4a){return function(_0x2b5bc9){if(!_0x2b5bc9){_0x592460['sendStatus'](0x194);}return _0x2b5bc9;};}function handleError(_0x37ca53,_0x335737){_0x335737=_0x335737||0x1f4;return function(_0x55667d){logger['error'](_0x55667d[_0x094b('0x29')]);if(_0x55667d[_0x094b('0x2a')]){delete _0x55667d[_0x094b('0x2a')];}_0x37ca53['status'](_0x335737)['send'](_0x55667d);};}exports[_0x094b('0x2b')]=function(_0x11e01d,_0xb7da4f){var _0x541dfb={},_0x387333={},_0x513003={'count':0x0,'rows':[]};var _0x2c41d8=_[_0x094b('0x2c')](db[_0x094b('0x2d')][_0x094b('0x2e')],function(_0x731c40){return{'name':_0x731c40[_0x094b('0x2f')],'type':_0x731c40[_0x094b('0x30')][_0x094b('0x31')]};});_0x387333[_0x094b('0x32')]=_[_0x094b('0x2c')](_0x2c41d8,_0x094b('0x2a'));_0x387333['query']=_[_0x094b('0x33')](_0x11e01d[_0x094b('0x34')]);_0x387333[_0x094b('0x35')]=_[_0x094b('0x36')](_0x387333['model'],_0x387333[_0x094b('0x34')]);_0x541dfb[_0x094b('0x37')]=_[_0x094b('0x36')](_0x387333[_0x094b('0x32')],qs[_0x094b('0x38')](_0x11e01d[_0x094b('0x34')][_0x094b('0x38')]));_0x541dfb[_0x094b('0x37')]=_0x541dfb[_0x094b('0x37')]['length']?_0x541dfb[_0x094b('0x37')]:_0x387333[_0x094b('0x32')];if(!_0x11e01d['query']['hasOwnProperty'](_0x094b('0x39'))){_0x541dfb[_0x094b('0x21')]=qs[_0x094b('0x21')](_0x11e01d[_0x094b('0x34')]['limit']);_0x541dfb[_0x094b('0x1f')]=qs[_0x094b('0x1f')](_0x11e01d[_0x094b('0x34')][_0x094b('0x1f')]);}_0x541dfb[_0x094b('0x3a')]=qs[_0x094b('0x3b')](_0x11e01d[_0x094b('0x34')][_0x094b('0x3b')]);_0x541dfb[_0x094b('0x3c')]=qs[_0x094b('0x35')](_[_0x094b('0x3d')](_0x11e01d[_0x094b('0x34')],_0x387333['filters']),_0x2c41d8);if(_0x11e01d[_0x094b('0x34')][_0x094b('0x3e')]){_0x541dfb[_0x094b('0x3c')]=_['merge'](_0x541dfb[_0x094b('0x3c')],{'$or':_[_0x094b('0x2c')](_0x2c41d8,function(_0x178b48){if(_0x178b48['type']!==_0x094b('0x3f')){var _0x83d7f={};_0x83d7f[_0x178b48['name']]={'$like':'%'+_0x11e01d[_0x094b('0x34')]['filter']+'%'};return _0x83d7f;}})});}_0x541dfb=_[_0x094b('0x40')]({},_0x541dfb,_0x11e01d[_0x094b('0x41')]);var _0x2e481d={'where':_0x541dfb[_0x094b('0x3c')]};return db[_0x094b('0x2d')][_0x094b('0x22')](_0x2e481d)[_0x094b('0x28')](function(_0x31fc57){_0x513003['count']=_0x31fc57;if(_0x11e01d[_0x094b('0x34')]['includeAll']){_0x541dfb[_0x094b('0x42')]=[{'all':!![]}];}return db[_0x094b('0x2d')][_0x094b('0x43')](_0x541dfb);})['then'](function(_0x3ca4a7){_0x513003[_0x094b('0x44')]=_0x3ca4a7;return _0x513003;})[_0x094b('0x28')](respondWithFilteredResult(_0xb7da4f,_0x541dfb))['catch'](handleError(_0xb7da4f,null));};exports[_0x094b('0x45')]=function(_0x58deeb,_0x5d2ac4){var _0x2814a1={'raw':![],'where':{'id':_0x58deeb[_0x094b('0x46')]['id']}},_0x2d53e7={};_0x2d53e7[_0x094b('0x32')]=_[_0x094b('0x33')](db['ZendeskConfiguration'][_0x094b('0x2e')]);_0x2d53e7[_0x094b('0x34')]=_[_0x094b('0x33')](_0x58deeb[_0x094b('0x34')]);_0x2d53e7[_0x094b('0x35')]=_['intersection'](_0x2d53e7['model'],_0x2d53e7[_0x094b('0x34')]);_0x2814a1[_0x094b('0x37')]=_[_0x094b('0x36')](_0x2d53e7[_0x094b('0x32')],qs[_0x094b('0x38')](_0x58deeb['query']['fields']));_0x2814a1[_0x094b('0x37')]=_0x2814a1[_0x094b('0x37')][_0x094b('0x47')]?_0x2814a1['attributes']:_0x2d53e7[_0x094b('0x32')];if(_0x58deeb['query'][_0x094b('0x48')]){_0x2814a1[_0x094b('0x42')]=[{'all':!![]}];}_0x2814a1=_[_0x094b('0x40')]({},_0x2814a1,_0x58deeb[_0x094b('0x41')]);return db['ZendeskConfiguration']['find'](_0x2814a1)[_0x094b('0x28')](handleEntityNotFound(_0x5d2ac4,null))['then'](respondWithResult(_0x5d2ac4,null))[_0x094b('0x49')](handleError(_0x5d2ac4,null));};exports[_0x094b('0x4a')]=function(_0x48ae0c,_0x1b88ae){return db[_0x094b('0x2d')]['create'](_0x48ae0c[_0x094b('0x4b')],{})[_0x094b('0x28')](respondWithResult(_0x1b88ae,0xc9))[_0x094b('0x49')](handleError(_0x1b88ae,null));};exports[_0x094b('0x4c')]=function(_0x2c2ba6,_0xe86b01){if(_0x2c2ba6[_0x094b('0x4b')]['id']){delete _0x2c2ba6[_0x094b('0x4b')]['id'];}return db[_0x094b('0x2d')]['find']({'where':{'id':_0x2c2ba6[_0x094b('0x46')]['id']}})[_0x094b('0x28')](handleEntityNotFound(_0xe86b01,null))[_0x094b('0x28')](saveUpdates(_0x2c2ba6[_0x094b('0x4b')],null))[_0x094b('0x28')](respondWithResult(_0xe86b01,null))['catch'](handleError(_0xe86b01,null));};exports[_0x094b('0x4d')]=function(_0x5080d1,_0x57dc10){return db[_0x094b('0x2d')]['find']({'where':{'id':_0x5080d1[_0x094b('0x46')]['id']}})[_0x094b('0x28')](handleEntityNotFound(_0x57dc10,null))['then'](removeEntity(_0x57dc10,null))[_0x094b('0x49')](handleError(_0x57dc10,null));};exports[_0x094b('0x4e')]=function(_0x383ac6,_0x2623f9,_0x566acb){var _0x1fb288={};var _0x404fc6={};var _0xd50e;var _0x540736;return db[_0x094b('0x2d')][_0x094b('0x4f')]({'where':{'id':_0x383ac6[_0x094b('0x46')]['id']}})['then'](handleEntityNotFound(_0x2623f9,null))['then'](function(_0x1f0705){if(_0x1f0705){_0xd50e=_0x1f0705;_0x404fc6['model']=_['keys'](db[_0x094b('0x50')][_0x094b('0x2e')]);_0x404fc6[_0x094b('0x34')]=_['keys'](_0x383ac6[_0x094b('0x34')]);_0x404fc6[_0x094b('0x35')]=_['intersection'](_0x404fc6[_0x094b('0x32')],_0x404fc6[_0x094b('0x34')]);_0x1fb288[_0x094b('0x37')]=_[_0x094b('0x36')](_0x404fc6[_0x094b('0x32')],qs[_0x094b('0x38')](_0x383ac6['query'][_0x094b('0x38')]));_0x1fb288[_0x094b('0x37')]=_0x1fb288[_0x094b('0x37')][_0x094b('0x47')]?_0x1fb288[_0x094b('0x37')]:_0x404fc6[_0x094b('0x32')];_0x1fb288[_0x094b('0x3a')]=qs[_0x094b('0x3b')](_0x383ac6[_0x094b('0x34')][_0x094b('0x3b')]);_0x1fb288[_0x094b('0x3c')]=qs[_0x094b('0x35')](_[_0x094b('0x3d')](_0x383ac6[_0x094b('0x34')],_0x404fc6[_0x094b('0x35')]));if(_0x383ac6[_0x094b('0x34')][_0x094b('0x3e')]){_0x1fb288['where']=_[_0x094b('0x40')](_0x1fb288[_0x094b('0x3c')],{'$or':_[_0x094b('0x2c')](_0x1fb288[_0x094b('0x37')],function(_0x4e19c9){var _0x2896d3={};_0x2896d3[_0x4e19c9]={'$like':'%'+_0x383ac6[_0x094b('0x34')][_0x094b('0x3e')]+'%'};return _0x2896d3;})});}_0x1fb288=_['merge']({},_0x1fb288,_0x383ac6[_0x094b('0x41')]);return _0xd50e[_0x094b('0x4e')](_0x1fb288);}})['then'](function(_0x41cdfa){if(_0x41cdfa){_0x540736=_0x41cdfa[_0x094b('0x47')];if(!_0x383ac6[_0x094b('0x34')][_0x094b('0x51')](_0x094b('0x39'))){_0x1fb288[_0x094b('0x21')]=qs['limit'](_0x383ac6[_0x094b('0x34')]['limit']);_0x1fb288[_0x094b('0x1f')]=qs[_0x094b('0x1f')](_0x383ac6[_0x094b('0x34')]['offset']);}return _0xd50e['getFields'](_0x1fb288);}})[_0x094b('0x28')](function(_0x46e066){if(_0x46e066){return _0x46e066?{'count':_0x540736,'rows':_0x46e066}:null;}})[_0x094b('0x28')](respondWithResult(_0x2623f9,null))[_0x094b('0x49')](handleError(_0x2623f9,null));};exports[_0x094b('0x52')]=function(_0x1f1a8e,_0x1f1c71,_0x16b56c){var _0xedc91b={};var _0x1d7b07={};var _0x3e14ae;var _0x537d11;return db[_0x094b('0x2d')][_0x094b('0x4f')]({'where':{'id':_0x1f1a8e[_0x094b('0x46')]['id']}})['then'](handleEntityNotFound(_0x1f1c71,null))['then'](function(_0x1a9185){if(_0x1a9185){_0x3e14ae=_0x1a9185;_0x1d7b07[_0x094b('0x32')]=_[_0x094b('0x33')](db[_0x094b('0x50')][_0x094b('0x2e')]);_0x1d7b07[_0x094b('0x34')]=_[_0x094b('0x33')](_0x1f1a8e['query']);_0x1d7b07[_0x094b('0x35')]=_[_0x094b('0x36')](_0x1d7b07[_0x094b('0x32')],_0x1d7b07['query']);_0xedc91b[_0x094b('0x37')]=_[_0x094b('0x36')](_0x1d7b07[_0x094b('0x32')],qs[_0x094b('0x38')](_0x1f1a8e[_0x094b('0x34')][_0x094b('0x38')]));_0xedc91b[_0x094b('0x37')]=_0xedc91b['attributes'][_0x094b('0x47')]?_0xedc91b[_0x094b('0x37')]:_0x1d7b07[_0x094b('0x32')];_0xedc91b[_0x094b('0x3a')]=qs[_0x094b('0x3b')](_0x1f1a8e[_0x094b('0x34')][_0x094b('0x3b')]);_0xedc91b[_0x094b('0x3c')]=qs['filters'](_['pick'](_0x1f1a8e['query'],_0x1d7b07[_0x094b('0x35')]));if(_0x1f1a8e[_0x094b('0x34')][_0x094b('0x3e')]){_0xedc91b['where']=_[_0x094b('0x40')](_0xedc91b['where'],{'$or':_[_0x094b('0x2c')](_0xedc91b[_0x094b('0x37')],function(_0x2881ad){var _0x4c560f={};_0x4c560f[_0x2881ad]={'$like':'%'+_0x1f1a8e['query'][_0x094b('0x3e')]+'%'};return _0x4c560f;})});}_0xedc91b=_[_0x094b('0x40')]({},_0xedc91b,_0x1f1a8e[_0x094b('0x41')]);return _0x3e14ae['getSubjects'](_0xedc91b);}})[_0x094b('0x28')](function(_0x9b9c52){if(_0x9b9c52){_0x537d11=_0x9b9c52[_0x094b('0x47')];if(!_0x1f1a8e[_0x094b('0x34')][_0x094b('0x51')](_0x094b('0x39'))){_0xedc91b[_0x094b('0x21')]=qs['limit'](_0x1f1a8e[_0x094b('0x34')][_0x094b('0x21')]);_0xedc91b[_0x094b('0x1f')]=qs['offset'](_0x1f1a8e['query'][_0x094b('0x1f')]);}return _0x3e14ae[_0x094b('0x52')](_0xedc91b);}})[_0x094b('0x28')](function(_0x3c70c1){if(_0x3c70c1){return _0x3c70c1?{'count':_0x537d11,'rows':_0x3c70c1}:null;}})['then'](respondWithResult(_0x1f1c71,null))['catch'](handleError(_0x1f1c71,null));};exports[_0x094b('0x53')]=function(_0x44e565,_0x915be1,_0x4425fc){var _0x20f802={};var _0x2a0c84={};var _0x5133de;var _0x1cc21a;return db[_0x094b('0x2d')][_0x094b('0x4f')]({'where':{'id':_0x44e565[_0x094b('0x46')]['id']}})['then'](handleEntityNotFound(_0x915be1,null))[_0x094b('0x28')](function(_0x38919e){if(_0x38919e){_0x5133de=_0x38919e;_0x2a0c84[_0x094b('0x32')]=_[_0x094b('0x33')](db[_0x094b('0x50')][_0x094b('0x2e')]);_0x2a0c84['query']=_[_0x094b('0x33')](_0x44e565['query']);_0x2a0c84[_0x094b('0x35')]=_[_0x094b('0x36')](_0x2a0c84['model'],_0x2a0c84[_0x094b('0x34')]);_0x20f802[_0x094b('0x37')]=_[_0x094b('0x36')](_0x2a0c84[_0x094b('0x32')],qs[_0x094b('0x38')](_0x44e565['query'][_0x094b('0x38')]));_0x20f802[_0x094b('0x37')]=_0x20f802[_0x094b('0x37')][_0x094b('0x47')]?_0x20f802[_0x094b('0x37')]:_0x2a0c84['model'];_0x20f802[_0x094b('0x3a')]=qs[_0x094b('0x3b')](_0x44e565[_0x094b('0x34')]['sort']);_0x20f802['where']=qs[_0x094b('0x35')](_[_0x094b('0x3d')](_0x44e565[_0x094b('0x34')],_0x2a0c84[_0x094b('0x35')]));if(_0x44e565['query'][_0x094b('0x3e')]){_0x20f802['where']=_[_0x094b('0x40')](_0x20f802[_0x094b('0x3c')],{'$or':_[_0x094b('0x2c')](_0x20f802[_0x094b('0x37')],function(_0x489d82){var _0x4b9b76={};_0x4b9b76[_0x489d82]={'$like':'%'+_0x44e565[_0x094b('0x34')]['filter']+'%'};return _0x4b9b76;})});}_0x20f802=_[_0x094b('0x40')]({},_0x20f802,_0x44e565[_0x094b('0x41')]);return _0x5133de[_0x094b('0x53')](_0x20f802);}})[_0x094b('0x28')](function(_0x14574c){if(_0x14574c){_0x1cc21a=_0x14574c['length'];if(!_0x44e565[_0x094b('0x34')][_0x094b('0x51')](_0x094b('0x39'))){_0x20f802[_0x094b('0x21')]=qs[_0x094b('0x21')](_0x44e565[_0x094b('0x34')][_0x094b('0x21')]);_0x20f802[_0x094b('0x1f')]=qs['offset'](_0x44e565['query'][_0x094b('0x1f')]);}return _0x5133de[_0x094b('0x53')](_0x20f802);}})['then'](function(_0x16e827){if(_0x16e827){return _0x16e827?{'count':_0x1cc21a,'rows':_0x16e827}:null;}})[_0x094b('0x28')](respondWithResult(_0x915be1,null))[_0x094b('0x49')](handleError(_0x915be1,null));};exports['getTags']=function(_0x5dce62,_0xdcb309,_0x31c671){var _0x277afb={};var _0x41ee79={};var _0xc4ddc4;var _0x52e294;return db['ZendeskConfiguration'][_0x094b('0x4f')]({'where':{'id':_0x5dce62[_0x094b('0x46')]['id']}})['then'](handleEntityNotFound(_0xdcb309,null))[_0x094b('0x28')](function(_0x382740){if(_0x382740){_0xc4ddc4=_0x382740;_0x41ee79[_0x094b('0x32')]=_[_0x094b('0x33')](db[_0x094b('0x54')][_0x094b('0x2e')]);_0x41ee79['query']=_['keys'](_0x5dce62[_0x094b('0x34')]);_0x41ee79['filters']=_['intersection'](_0x41ee79['model'],_0x41ee79[_0x094b('0x34')]);_0x277afb['attributes']=_[_0x094b('0x36')](_0x41ee79[_0x094b('0x32')],qs['fields'](_0x5dce62[_0x094b('0x34')]['fields']));_0x277afb['attributes']=_0x277afb[_0x094b('0x37')][_0x094b('0x47')]?_0x277afb[_0x094b('0x37')]:_0x41ee79['model'];_0x277afb['order']=qs[_0x094b('0x3b')](_0x5dce62[_0x094b('0x34')][_0x094b('0x3b')]);_0x277afb[_0x094b('0x3c')]=qs[_0x094b('0x35')](_[_0x094b('0x3d')](_0x5dce62[_0x094b('0x34')],_0x41ee79[_0x094b('0x35')]));if(_0x5dce62[_0x094b('0x34')][_0x094b('0x3e')]){_0x277afb['where']=_[_0x094b('0x40')](_0x277afb[_0x094b('0x3c')],{'$or':_[_0x094b('0x2c')](_0x277afb[_0x094b('0x37')],function(_0x31945c){var _0x4995f0={};_0x4995f0[_0x31945c]={'$like':'%'+_0x5dce62['query'][_0x094b('0x3e')]+'%'};return _0x4995f0;})});}_0x277afb=_[_0x094b('0x40')]({},_0x277afb,_0x5dce62['options']);return _0xc4ddc4['getTags'](_0x277afb);}})['then'](function(_0x4dff85){if(_0x4dff85){_0x52e294=_0x4dff85['length'];if(!_0x5dce62[_0x094b('0x34')][_0x094b('0x51')](_0x094b('0x39'))){_0x277afb[_0x094b('0x21')]=qs['limit'](_0x5dce62[_0x094b('0x34')][_0x094b('0x21')]);_0x277afb[_0x094b('0x1f')]=qs[_0x094b('0x1f')](_0x5dce62[_0x094b('0x34')]['offset']);}return _0xc4ddc4[_0x094b('0x55')](_0x277afb);}})['then'](function(_0xd76589){if(_0xd76589){return _0xd76589?{'count':_0x52e294,'rows':_0xd76589}:null;}})[_0x094b('0x28')](respondWithResult(_0xdcb309,null))[_0x094b('0x49')](handleError(_0xdcb309,null));};exports[_0x094b('0x56')]=function(_0x1854b3,_0x52b278,_0x1bfe36){if(_0x1854b3['body']['id']){delete _0x1854b3[_0x094b('0x4b')]['id'];}return db[_0x094b('0x2d')]['findOne']({'where':{'id':_0x1854b3[_0x094b('0x46')]['id']}})[_0x094b('0x28')](handleEntityNotFound(_0x52b278,null))[_0x094b('0x28')](function(_0x5cb115){if(_0x5cb115){return _0x5cb115[_0x094b('0x56')](_0x1854b3['body'][_0x094b('0x57')]||[]);}return null;})['then'](respondWithResult(_0x52b278,null))[_0x094b('0x49')](handleError(_0x52b278,null));}; \ No newline at end of file +var _0xc5cf=['Content-Range','apply','reject','save','then','destroy','sendStatus','error','name','send','index','map','rawAttributes','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','ZendeskConfiguration','includeAll','include','findAll','rows','catch','show','find','create','update','body','params','getFields','findOne','ZendeskField','getSubjects','getDescriptions','getTags','Tag','setTags','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set'];(function(_0x1ae3f1,_0xb5cac2){var _0x1c3eb1=function(_0x188352){while(--_0x188352){_0x1ae3f1['push'](_0x1ae3f1['shift']());}};_0x1c3eb1(++_0xb5cac2);}(_0xc5cf,0x1cd));var _0xfc5c=function(_0x51fdcc,_0x27affe){_0x51fdcc=_0x51fdcc-0x0;var _0x38d545=_0xc5cf[_0x51fdcc];return _0x38d545;};'use strict';var emlformat=require(_0xfc5c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfc5c('0x1'));var rp=require(_0xfc5c('0x2'));var moment=require('moment');var BPromise=require(_0xfc5c('0x3'));var Mustache=require(_0xfc5c('0x4'));var util=require(_0xfc5c('0x5'));var path=require(_0xfc5c('0x6'));var sox=require(_0xfc5c('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(_0xfc5c('0x8'));var crypto=require(_0xfc5c('0x9'));var jsforce=require(_0xfc5c('0xa'));var deskjs=require(_0xfc5c('0xb'));var toCsv=require(_0xfc5c('0xc'));var querystring=require('querystring');var Papa=require(_0xfc5c('0xd'));var Redis=require(_0xfc5c('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xfc5c('0xf'));var as=require(_0xfc5c('0x10'));var hardwareService=require(_0xfc5c('0x11'));var logger=require(_0xfc5c('0x12'))(_0xfc5c('0x13'));var utils=require(_0xfc5c('0x14'));var config=require(_0xfc5c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xfc5c('0x16'))['db'];function respondWithStatusCode(_0x73401,_0x43e458){_0x43e458=_0x43e458||0xcc;return function(_0x5e062c){if(_0x5e062c){return _0x73401['sendStatus'](_0x43e458);}return _0x73401[_0xfc5c('0x17')](_0x43e458)[_0xfc5c('0x18')]();};}function respondWithResult(_0x2e5178,_0xa77280){_0xa77280=_0xa77280||0xc8;return function(_0x74a3cf){if(_0x74a3cf){return _0x2e5178[_0xfc5c('0x17')](_0xa77280)[_0xfc5c('0x19')](_0x74a3cf);}};}function respondWithFilteredResult(_0x13ac24,_0xd2b33f){return function(_0x5e2589){if(_0x5e2589){var _0x51c300=typeof _0xd2b33f[_0xfc5c('0x1a')]===_0xfc5c('0x1b')&&typeof _0xd2b33f[_0xfc5c('0x1c')]===_0xfc5c('0x1b');var _0x3102de=_0x5e2589[_0xfc5c('0x1d')];var _0x4da899=_0x51c300?0x0:_0xd2b33f['offset'];var _0x3cb8a4=_0x51c300?_0x5e2589[_0xfc5c('0x1d')]:_0xd2b33f[_0xfc5c('0x1a')]+_0xd2b33f[_0xfc5c('0x1c')];var _0x376398;if(_0x3cb8a4>=_0x3102de){_0x3cb8a4=_0x3102de;_0x376398=0xc8;}else{_0x376398=0xce;}_0x13ac24[_0xfc5c('0x17')](_0x376398);return _0x13ac24[_0xfc5c('0x1e')](_0xfc5c('0x1f'),_0x4da899+'-'+_0x3cb8a4+'/'+_0x3102de)[_0xfc5c('0x19')](_0x5e2589);}return null;};}function patchUpdates(_0x5196ba){return function(_0x213d1a){try{jsonpatch[_0xfc5c('0x20')](_0x213d1a,_0x5196ba,!![]);}catch(_0x47d393){return BPromise[_0xfc5c('0x21')](_0x47d393);}return _0x213d1a[_0xfc5c('0x22')]();};}function saveUpdates(_0x2226fb,_0x5e6d4e){return function(_0x534de6){if(_0x534de6){return _0x534de6['update'](_0x2226fb)[_0xfc5c('0x23')](function(_0x190b9c){return _0x190b9c;});}return null;};}function removeEntity(_0x50c2c3,_0xe48b98){return function(_0x15bcda){if(_0x15bcda){return _0x15bcda[_0xfc5c('0x24')]()['then'](function(){_0x50c2c3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xc842d1,_0x26389d){return function(_0x301ce3){if(!_0x301ce3){_0xc842d1[_0xfc5c('0x25')](0x194);}return _0x301ce3;};}function handleError(_0x1eec41,_0x4c72a0){_0x4c72a0=_0x4c72a0||0x1f4;return function(_0x5c538c){logger[_0xfc5c('0x26')](_0x5c538c['stack']);if(_0x5c538c[_0xfc5c('0x27')]){delete _0x5c538c[_0xfc5c('0x27')];}_0x1eec41[_0xfc5c('0x17')](_0x4c72a0)[_0xfc5c('0x28')](_0x5c538c);};}exports[_0xfc5c('0x29')]=function(_0x396ce1,_0x352e0a){var _0x2a5fbe={},_0x4574e5={},_0x3d260b={'count':0x0,'rows':[]};var _0x18545e=_[_0xfc5c('0x2a')](db['ZendeskConfiguration'][_0xfc5c('0x2b')],function(_0x4cbc17){return{'name':_0x4cbc17['fieldName'],'type':_0x4cbc17[_0xfc5c('0x2c')]['key']};});_0x4574e5[_0xfc5c('0x2d')]=_[_0xfc5c('0x2a')](_0x18545e,_0xfc5c('0x27'));_0x4574e5[_0xfc5c('0x2e')]=_[_0xfc5c('0x2f')](_0x396ce1[_0xfc5c('0x2e')]);_0x4574e5['filters']=_[_0xfc5c('0x30')](_0x4574e5[_0xfc5c('0x2d')],_0x4574e5[_0xfc5c('0x2e')]);_0x2a5fbe['attributes']=_[_0xfc5c('0x30')](_0x4574e5[_0xfc5c('0x2d')],qs[_0xfc5c('0x31')](_0x396ce1[_0xfc5c('0x2e')][_0xfc5c('0x31')]));_0x2a5fbe[_0xfc5c('0x32')]=_0x2a5fbe['attributes'][_0xfc5c('0x33')]?_0x2a5fbe[_0xfc5c('0x32')]:_0x4574e5[_0xfc5c('0x2d')];if(!_0x396ce1[_0xfc5c('0x2e')][_0xfc5c('0x34')](_0xfc5c('0x35'))){_0x2a5fbe['limit']=qs[_0xfc5c('0x1c')](_0x396ce1[_0xfc5c('0x2e')][_0xfc5c('0x1c')]);_0x2a5fbe['offset']=qs['offset'](_0x396ce1[_0xfc5c('0x2e')][_0xfc5c('0x1a')]);}_0x2a5fbe[_0xfc5c('0x36')]=qs[_0xfc5c('0x37')](_0x396ce1['query']['sort']);_0x2a5fbe[_0xfc5c('0x38')]=qs[_0xfc5c('0x39')](_[_0xfc5c('0x3a')](_0x396ce1[_0xfc5c('0x2e')],_0x4574e5[_0xfc5c('0x39')]),_0x18545e);if(_0x396ce1['query'][_0xfc5c('0x3b')]){_0x2a5fbe[_0xfc5c('0x38')]=_[_0xfc5c('0x3c')](_0x2a5fbe[_0xfc5c('0x38')],{'$or':_[_0xfc5c('0x2a')](_0x18545e,function(_0x3166cf){if(_0x3166cf[_0xfc5c('0x2c')]!=='VIRTUAL'){var _0x45fbc0={};_0x45fbc0[_0x3166cf[_0xfc5c('0x27')]]={'$like':'%'+_0x396ce1[_0xfc5c('0x2e')]['filter']+'%'};return _0x45fbc0;}})});}_0x2a5fbe=_[_0xfc5c('0x3c')]({},_0x2a5fbe,_0x396ce1[_0xfc5c('0x3d')]);var _0x12e1ea={'where':_0x2a5fbe[_0xfc5c('0x38')]};return db[_0xfc5c('0x3e')][_0xfc5c('0x1d')](_0x12e1ea)[_0xfc5c('0x23')](function(_0x530a01){_0x3d260b[_0xfc5c('0x1d')]=_0x530a01;if(_0x396ce1[_0xfc5c('0x2e')][_0xfc5c('0x3f')]){_0x2a5fbe[_0xfc5c('0x40')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0xfc5c('0x41')](_0x2a5fbe);})[_0xfc5c('0x23')](function(_0x2cf7bc){_0x3d260b[_0xfc5c('0x42')]=_0x2cf7bc;return _0x3d260b;})[_0xfc5c('0x23')](respondWithFilteredResult(_0x352e0a,_0x2a5fbe))[_0xfc5c('0x43')](handleError(_0x352e0a,null));};exports[_0xfc5c('0x44')]=function(_0x2c9c4b,_0x3b2833){var _0x5e253a={'raw':![],'where':{'id':_0x2c9c4b['params']['id']}},_0x280496={};_0x280496['model']=_[_0xfc5c('0x2f')](db['ZendeskConfiguration'][_0xfc5c('0x2b')]);_0x280496[_0xfc5c('0x2e')]=_[_0xfc5c('0x2f')](_0x2c9c4b['query']);_0x280496[_0xfc5c('0x39')]=_[_0xfc5c('0x30')](_0x280496[_0xfc5c('0x2d')],_0x280496[_0xfc5c('0x2e')]);_0x5e253a[_0xfc5c('0x32')]=_[_0xfc5c('0x30')](_0x280496['model'],qs[_0xfc5c('0x31')](_0x2c9c4b[_0xfc5c('0x2e')][_0xfc5c('0x31')]));_0x5e253a[_0xfc5c('0x32')]=_0x5e253a[_0xfc5c('0x32')][_0xfc5c('0x33')]?_0x5e253a[_0xfc5c('0x32')]:_0x280496[_0xfc5c('0x2d')];if(_0x2c9c4b[_0xfc5c('0x2e')][_0xfc5c('0x3f')]){_0x5e253a['include']=[{'all':!![]}];}_0x5e253a=_[_0xfc5c('0x3c')]({},_0x5e253a,_0x2c9c4b[_0xfc5c('0x3d')]);return db[_0xfc5c('0x3e')][_0xfc5c('0x45')](_0x5e253a)[_0xfc5c('0x23')](handleEntityNotFound(_0x3b2833,null))[_0xfc5c('0x23')](respondWithResult(_0x3b2833,null))[_0xfc5c('0x43')](handleError(_0x3b2833,null));};exports[_0xfc5c('0x46')]=function(_0x48f983,_0x5f4276){return db[_0xfc5c('0x3e')]['create'](_0x48f983['body'],{})[_0xfc5c('0x23')](respondWithResult(_0x5f4276,0xc9))['catch'](handleError(_0x5f4276,null));};exports[_0xfc5c('0x47')]=function(_0x31dc79,_0x2e893b){if(_0x31dc79[_0xfc5c('0x48')]['id']){delete _0x31dc79['body']['id'];}return db[_0xfc5c('0x3e')][_0xfc5c('0x45')]({'where':{'id':_0x31dc79[_0xfc5c('0x49')]['id']}})[_0xfc5c('0x23')](handleEntityNotFound(_0x2e893b,null))['then'](saveUpdates(_0x31dc79[_0xfc5c('0x48')],null))[_0xfc5c('0x23')](respondWithResult(_0x2e893b,null))['catch'](handleError(_0x2e893b,null));};exports['destroy']=function(_0x14daf5,_0x174410){return db[_0xfc5c('0x3e')][_0xfc5c('0x45')]({'where':{'id':_0x14daf5['params']['id']}})[_0xfc5c('0x23')](handleEntityNotFound(_0x174410,null))['then'](removeEntity(_0x174410,null))[_0xfc5c('0x43')](handleError(_0x174410,null));};exports[_0xfc5c('0x4a')]=function(_0x5ff5db,_0x39971f,_0x309030){var _0x481ec0={};var _0x5bfcbb={};var _0x5cb342;var _0x460442;return db[_0xfc5c('0x3e')][_0xfc5c('0x4b')]({'where':{'id':_0x5ff5db[_0xfc5c('0x49')]['id']}})[_0xfc5c('0x23')](handleEntityNotFound(_0x39971f,null))[_0xfc5c('0x23')](function(_0x17d7c2){if(_0x17d7c2){_0x5cb342=_0x17d7c2;_0x5bfcbb[_0xfc5c('0x2d')]=_[_0xfc5c('0x2f')](db[_0xfc5c('0x4c')][_0xfc5c('0x2b')]);_0x5bfcbb['query']=_[_0xfc5c('0x2f')](_0x5ff5db['query']);_0x5bfcbb[_0xfc5c('0x39')]=_['intersection'](_0x5bfcbb['model'],_0x5bfcbb[_0xfc5c('0x2e')]);_0x481ec0[_0xfc5c('0x32')]=_[_0xfc5c('0x30')](_0x5bfcbb[_0xfc5c('0x2d')],qs['fields'](_0x5ff5db[_0xfc5c('0x2e')]['fields']));_0x481ec0['attributes']=_0x481ec0['attributes']['length']?_0x481ec0[_0xfc5c('0x32')]:_0x5bfcbb[_0xfc5c('0x2d')];_0x481ec0[_0xfc5c('0x36')]=qs['sort'](_0x5ff5db[_0xfc5c('0x2e')]['sort']);_0x481ec0[_0xfc5c('0x38')]=qs['filters'](_['pick'](_0x5ff5db[_0xfc5c('0x2e')],_0x5bfcbb[_0xfc5c('0x39')]));if(_0x5ff5db[_0xfc5c('0x2e')][_0xfc5c('0x3b')]){_0x481ec0[_0xfc5c('0x38')]=_[_0xfc5c('0x3c')](_0x481ec0[_0xfc5c('0x38')],{'$or':_[_0xfc5c('0x2a')](_0x481ec0[_0xfc5c('0x32')],function(_0x120ef3){var _0x39dc70={};_0x39dc70[_0x120ef3]={'$like':'%'+_0x5ff5db[_0xfc5c('0x2e')][_0xfc5c('0x3b')]+'%'};return _0x39dc70;})});}_0x481ec0=_[_0xfc5c('0x3c')]({},_0x481ec0,_0x5ff5db[_0xfc5c('0x3d')]);return _0x5cb342[_0xfc5c('0x4a')](_0x481ec0);}})[_0xfc5c('0x23')](function(_0x2a17a1){if(_0x2a17a1){_0x460442=_0x2a17a1[_0xfc5c('0x33')];if(!_0x5ff5db[_0xfc5c('0x2e')][_0xfc5c('0x34')]('nolimit')){_0x481ec0[_0xfc5c('0x1c')]=qs[_0xfc5c('0x1c')](_0x5ff5db[_0xfc5c('0x2e')][_0xfc5c('0x1c')]);_0x481ec0[_0xfc5c('0x1a')]=qs[_0xfc5c('0x1a')](_0x5ff5db[_0xfc5c('0x2e')][_0xfc5c('0x1a')]);}return _0x5cb342['getFields'](_0x481ec0);}})[_0xfc5c('0x23')](function(_0x520ae7){if(_0x520ae7){return _0x520ae7?{'count':_0x460442,'rows':_0x520ae7}:null;}})[_0xfc5c('0x23')](respondWithResult(_0x39971f,null))[_0xfc5c('0x43')](handleError(_0x39971f,null));};exports['getSubjects']=function(_0x58b247,_0x412a2b,_0x3e4cf1){var _0x13c1ea={};var _0x382e00={};var _0x44c8f7;var _0x50abc7;return db[_0xfc5c('0x3e')][_0xfc5c('0x4b')]({'where':{'id':_0x58b247[_0xfc5c('0x49')]['id']}})[_0xfc5c('0x23')](handleEntityNotFound(_0x412a2b,null))[_0xfc5c('0x23')](function(_0x1ba49a){if(_0x1ba49a){_0x44c8f7=_0x1ba49a;_0x382e00[_0xfc5c('0x2d')]=_[_0xfc5c('0x2f')](db[_0xfc5c('0x4c')][_0xfc5c('0x2b')]);_0x382e00[_0xfc5c('0x2e')]=_[_0xfc5c('0x2f')](_0x58b247[_0xfc5c('0x2e')]);_0x382e00[_0xfc5c('0x39')]=_['intersection'](_0x382e00['model'],_0x382e00['query']);_0x13c1ea[_0xfc5c('0x32')]=_[_0xfc5c('0x30')](_0x382e00[_0xfc5c('0x2d')],qs[_0xfc5c('0x31')](_0x58b247[_0xfc5c('0x2e')][_0xfc5c('0x31')]));_0x13c1ea[_0xfc5c('0x32')]=_0x13c1ea[_0xfc5c('0x32')][_0xfc5c('0x33')]?_0x13c1ea[_0xfc5c('0x32')]:_0x382e00[_0xfc5c('0x2d')];_0x13c1ea[_0xfc5c('0x36')]=qs[_0xfc5c('0x37')](_0x58b247['query']['sort']);_0x13c1ea[_0xfc5c('0x38')]=qs[_0xfc5c('0x39')](_[_0xfc5c('0x3a')](_0x58b247[_0xfc5c('0x2e')],_0x382e00[_0xfc5c('0x39')]));if(_0x58b247[_0xfc5c('0x2e')][_0xfc5c('0x3b')]){_0x13c1ea['where']=_[_0xfc5c('0x3c')](_0x13c1ea[_0xfc5c('0x38')],{'$or':_['map'](_0x13c1ea[_0xfc5c('0x32')],function(_0x1bbc7c){var _0x3e0596={};_0x3e0596[_0x1bbc7c]={'$like':'%'+_0x58b247[_0xfc5c('0x2e')][_0xfc5c('0x3b')]+'%'};return _0x3e0596;})});}_0x13c1ea=_['merge']({},_0x13c1ea,_0x58b247[_0xfc5c('0x3d')]);return _0x44c8f7['getSubjects'](_0x13c1ea);}})[_0xfc5c('0x23')](function(_0x435512){if(_0x435512){_0x50abc7=_0x435512[_0xfc5c('0x33')];if(!_0x58b247[_0xfc5c('0x2e')][_0xfc5c('0x34')](_0xfc5c('0x35'))){_0x13c1ea['limit']=qs['limit'](_0x58b247[_0xfc5c('0x2e')][_0xfc5c('0x1c')]);_0x13c1ea[_0xfc5c('0x1a')]=qs[_0xfc5c('0x1a')](_0x58b247[_0xfc5c('0x2e')][_0xfc5c('0x1a')]);}return _0x44c8f7[_0xfc5c('0x4d')](_0x13c1ea);}})[_0xfc5c('0x23')](function(_0x52d10b){if(_0x52d10b){return _0x52d10b?{'count':_0x50abc7,'rows':_0x52d10b}:null;}})[_0xfc5c('0x23')](respondWithResult(_0x412a2b,null))['catch'](handleError(_0x412a2b,null));};exports[_0xfc5c('0x4e')]=function(_0x53cc38,_0x7ac058,_0x2b81fa){var _0x444332={};var _0x451a9={};var _0x14c7c3;var _0x2edd6d;return db['ZendeskConfiguration'][_0xfc5c('0x4b')]({'where':{'id':_0x53cc38['params']['id']}})[_0xfc5c('0x23')](handleEntityNotFound(_0x7ac058,null))['then'](function(_0x7f8ff5){if(_0x7f8ff5){_0x14c7c3=_0x7f8ff5;_0x451a9[_0xfc5c('0x2d')]=_[_0xfc5c('0x2f')](db[_0xfc5c('0x4c')][_0xfc5c('0x2b')]);_0x451a9[_0xfc5c('0x2e')]=_[_0xfc5c('0x2f')](_0x53cc38[_0xfc5c('0x2e')]);_0x451a9[_0xfc5c('0x39')]=_['intersection'](_0x451a9[_0xfc5c('0x2d')],_0x451a9[_0xfc5c('0x2e')]);_0x444332[_0xfc5c('0x32')]=_['intersection'](_0x451a9['model'],qs[_0xfc5c('0x31')](_0x53cc38[_0xfc5c('0x2e')][_0xfc5c('0x31')]));_0x444332[_0xfc5c('0x32')]=_0x444332['attributes']['length']?_0x444332[_0xfc5c('0x32')]:_0x451a9['model'];_0x444332[_0xfc5c('0x36')]=qs[_0xfc5c('0x37')](_0x53cc38[_0xfc5c('0x2e')][_0xfc5c('0x37')]);_0x444332[_0xfc5c('0x38')]=qs['filters'](_[_0xfc5c('0x3a')](_0x53cc38[_0xfc5c('0x2e')],_0x451a9['filters']));if(_0x53cc38[_0xfc5c('0x2e')][_0xfc5c('0x3b')]){_0x444332['where']=_[_0xfc5c('0x3c')](_0x444332[_0xfc5c('0x38')],{'$or':_[_0xfc5c('0x2a')](_0x444332[_0xfc5c('0x32')],function(_0x4a6d43){var _0x3aef66={};_0x3aef66[_0x4a6d43]={'$like':'%'+_0x53cc38[_0xfc5c('0x2e')][_0xfc5c('0x3b')]+'%'};return _0x3aef66;})});}_0x444332=_[_0xfc5c('0x3c')]({},_0x444332,_0x53cc38[_0xfc5c('0x3d')]);return _0x14c7c3[_0xfc5c('0x4e')](_0x444332);}})['then'](function(_0x3307ef){if(_0x3307ef){_0x2edd6d=_0x3307ef[_0xfc5c('0x33')];if(!_0x53cc38[_0xfc5c('0x2e')][_0xfc5c('0x34')](_0xfc5c('0x35'))){_0x444332[_0xfc5c('0x1c')]=qs[_0xfc5c('0x1c')](_0x53cc38[_0xfc5c('0x2e')][_0xfc5c('0x1c')]);_0x444332[_0xfc5c('0x1a')]=qs[_0xfc5c('0x1a')](_0x53cc38['query'][_0xfc5c('0x1a')]);}return _0x14c7c3['getDescriptions'](_0x444332);}})[_0xfc5c('0x23')](function(_0x17d483){if(_0x17d483){return _0x17d483?{'count':_0x2edd6d,'rows':_0x17d483}:null;}})[_0xfc5c('0x23')](respondWithResult(_0x7ac058,null))[_0xfc5c('0x43')](handleError(_0x7ac058,null));};exports[_0xfc5c('0x4f')]=function(_0x283d5e,_0x2d45cf,_0x1dc737){var _0x1ce783={};var _0x16bf49={};var _0x41ae9f;var _0x33f87b;return db['ZendeskConfiguration'][_0xfc5c('0x4b')]({'where':{'id':_0x283d5e[_0xfc5c('0x49')]['id']}})[_0xfc5c('0x23')](handleEntityNotFound(_0x2d45cf,null))[_0xfc5c('0x23')](function(_0x5084c7){if(_0x5084c7){_0x41ae9f=_0x5084c7;_0x16bf49[_0xfc5c('0x2d')]=_['keys'](db[_0xfc5c('0x50')]['rawAttributes']);_0x16bf49[_0xfc5c('0x2e')]=_[_0xfc5c('0x2f')](_0x283d5e['query']);_0x16bf49[_0xfc5c('0x39')]=_[_0xfc5c('0x30')](_0x16bf49[_0xfc5c('0x2d')],_0x16bf49[_0xfc5c('0x2e')]);_0x1ce783[_0xfc5c('0x32')]=_[_0xfc5c('0x30')](_0x16bf49[_0xfc5c('0x2d')],qs[_0xfc5c('0x31')](_0x283d5e[_0xfc5c('0x2e')][_0xfc5c('0x31')]));_0x1ce783['attributes']=_0x1ce783[_0xfc5c('0x32')]['length']?_0x1ce783[_0xfc5c('0x32')]:_0x16bf49[_0xfc5c('0x2d')];_0x1ce783[_0xfc5c('0x36')]=qs[_0xfc5c('0x37')](_0x283d5e[_0xfc5c('0x2e')][_0xfc5c('0x37')]);_0x1ce783[_0xfc5c('0x38')]=qs['filters'](_[_0xfc5c('0x3a')](_0x283d5e[_0xfc5c('0x2e')],_0x16bf49[_0xfc5c('0x39')]));if(_0x283d5e[_0xfc5c('0x2e')][_0xfc5c('0x3b')]){_0x1ce783[_0xfc5c('0x38')]=_[_0xfc5c('0x3c')](_0x1ce783[_0xfc5c('0x38')],{'$or':_[_0xfc5c('0x2a')](_0x1ce783[_0xfc5c('0x32')],function(_0x292dcd){var _0xc43528={};_0xc43528[_0x292dcd]={'$like':'%'+_0x283d5e[_0xfc5c('0x2e')][_0xfc5c('0x3b')]+'%'};return _0xc43528;})});}_0x1ce783=_[_0xfc5c('0x3c')]({},_0x1ce783,_0x283d5e['options']);return _0x41ae9f[_0xfc5c('0x4f')](_0x1ce783);}})[_0xfc5c('0x23')](function(_0x956dbb){if(_0x956dbb){_0x33f87b=_0x956dbb[_0xfc5c('0x33')];if(!_0x283d5e[_0xfc5c('0x2e')][_0xfc5c('0x34')](_0xfc5c('0x35'))){_0x1ce783[_0xfc5c('0x1c')]=qs[_0xfc5c('0x1c')](_0x283d5e[_0xfc5c('0x2e')][_0xfc5c('0x1c')]);_0x1ce783['offset']=qs[_0xfc5c('0x1a')](_0x283d5e[_0xfc5c('0x2e')]['offset']);}return _0x41ae9f['getTags'](_0x1ce783);}})[_0xfc5c('0x23')](function(_0x3f0a33){if(_0x3f0a33){return _0x3f0a33?{'count':_0x33f87b,'rows':_0x3f0a33}:null;}})['then'](respondWithResult(_0x2d45cf,null))[_0xfc5c('0x43')](handleError(_0x2d45cf,null));};exports[_0xfc5c('0x51')]=function(_0x11ecc9,_0x139932,_0x4e1c58){if(_0x11ecc9[_0xfc5c('0x48')]['id']){delete _0x11ecc9['body']['id'];}return db[_0xfc5c('0x3e')][_0xfc5c('0x4b')]({'where':{'id':_0x11ecc9[_0xfc5c('0x49')]['id']}})[_0xfc5c('0x23')](handleEntityNotFound(_0x139932,null))[_0xfc5c('0x23')](function(_0x2d8ed4){if(_0x2d8ed4){return _0x2d8ed4[_0xfc5c('0x51')](_0x11ecc9[_0xfc5c('0x48')]['ids']||[]);}return null;})[_0xfc5c('0x23')](respondWithResult(_0x139932,null))[_0xfc5c('0x43')](handleError(_0x139932,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index c912a90..2ac0453 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 _0xb574=['./intZendeskConfiguration.attributes','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x339b1c,_0x21f42e){var _0x1a37f0=function(_0x41ea50){while(--_0x41ea50){_0x339b1c['push'](_0x339b1c['shift']());}};_0x1a37f0(++_0x21f42e);}(_0xb574,0x106));var _0x4b57=function(_0x20cdc4,_0x14b72e){_0x20cdc4=_0x20cdc4-0x0;var _0x13cd59=_0xb574[_0x20cdc4];return _0x13cd59;};'use strict';var _=require(_0x4b57('0x0'));var util=require(_0x4b57('0x1'));var logger=require('../../config/logger')(_0x4b57('0x2'));var moment=require(_0x4b57('0x3'));var BPromise=require('bluebird');var rp=require(_0x4b57('0x4'));var fs=require('fs');var path=require(_0x4b57('0x5'));var rimraf=require(_0x4b57('0x6'));var config=require(_0x4b57('0x7'));var attributes=require(_0x4b57('0x8'));module['exports']=function(_0x4eb019,_0x1c97e5){return _0x4eb019['define']('ZendeskConfiguration',attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x14a0=['../../config/logger','api','moment','bluebird','request-promise','path','./intZendeskConfiguration.attributes','exports','ZendeskConfiguration','int_zendesk_configurations','util'];(function(_0x502d44,_0xf54854){var _0x100d10=function(_0x27dc06){while(--_0x27dc06){_0x502d44['push'](_0x502d44['shift']());}};_0x100d10(++_0xf54854);}(_0x14a0,0x8e));var _0x014a=function(_0x4d26f9,_0x505d76){_0x4d26f9=_0x4d26f9-0x0;var _0x31eed7=_0x14a0[_0x4d26f9];return _0x31eed7;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var logger=require(_0x014a('0x1'))(_0x014a('0x2'));var moment=require(_0x014a('0x3'));var BPromise=require(_0x014a('0x4'));var rp=require(_0x014a('0x5'));var fs=require('fs');var path=require(_0x014a('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x014a('0x7'));module[_0x014a('0x8')]=function(_0x38a22c,_0x5ec84d){return _0x38a22c['define'](_0x014a('0x9'),attributes,{'tableName':_0x014a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 81daa88..b9bc1dc 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 _0xddf4=['code','message','info','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x23129b,_0x2d13ae){var _0x3b2fe9=function(_0x4cd6b7){while(--_0x4cd6b7){_0x23129b['push'](_0x23129b['shift']());}};_0x3b2fe9(++_0x2d13ae);}(_0xddf4,0xea));var _0x4ddf=function(_0x1c510a,_0x1413a9){_0x1c510a=_0x1c510a-0x0;var _0x23cedd=_0xddf4[_0x1c510a];return _0x23cedd;};'use strict';var _=require(_0x4ddf('0x0'));var util=require(_0x4ddf('0x1'));var moment=require(_0x4ddf('0x2'));var BPromise=require(_0x4ddf('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4ddf('0x4'));var db=require(_0x4ddf('0x5'))['db'];var utils=require(_0x4ddf('0x6'));var logger=require(_0x4ddf('0x7'))(_0x4ddf('0x8'));var config=require(_0x4ddf('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4ddf('0xa')][_0x4ddf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3d7777,_0xc180fb,_0x322739){return new BPromise(function(_0x534fbc,_0x5bbd94){return client[_0x4ddf('0xc')](_0x3d7777,_0x322739)[_0x4ddf('0xd')](function(_0x5a73c2){logger['info'](_0x4ddf('0xe'),_0xc180fb,_0x4ddf('0xf'));logger[_0x4ddf('0x10')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0xc180fb,_0x4ddf('0xf'),JSON[_0x4ddf('0x11')](_0x5a73c2));if(_0x5a73c2[_0x4ddf('0x12')]){if(_0x5a73c2['error'][_0x4ddf('0x13')]===0x1f4){logger[_0x4ddf('0x12')](_0x4ddf('0xe'),_0xc180fb,_0x5a73c2['error'][_0x4ddf('0x14')]);return _0x5bbd94(_0x5a73c2[_0x4ddf('0x12')][_0x4ddf('0x14')]);}logger[_0x4ddf('0x12')]('ZendeskConfiguration,\x20%s,\x20%s',_0xc180fb,_0x5a73c2[_0x4ddf('0x12')][_0x4ddf('0x14')]);return _0x534fbc(_0x5a73c2[_0x4ddf('0x12')][_0x4ddf('0x14')]);}else{logger[_0x4ddf('0x15')](_0x4ddf('0xe'),_0xc180fb,_0x4ddf('0xf'));_0x534fbc(_0x5a73c2[_0x4ddf('0x16')][_0x4ddf('0x14')]);}})['catch'](function(_0x23e97c){logger[_0x4ddf('0x12')]('ZendeskConfiguration,\x20%s,\x20%s',_0xc180fb,_0x23e97c);_0x5bbd94(_0x23e97c);});});} \ No newline at end of file +var _0x8404=['request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise'];(function(_0x421413,_0x235069){var _0x35a137=function(_0x197cef){while(--_0x197cef){_0x421413['push'](_0x421413['shift']());}};_0x35a137(++_0x235069);}(_0x8404,0xf2));var _0x4840=function(_0x578222,_0x3c803e){_0x578222=_0x578222-0x0;var _0x50b868=_0x8404[_0x578222];return _0x50b868;};'use strict';var _=require(_0x4840('0x0'));var util=require(_0x4840('0x1'));var moment=require(_0x4840('0x2'));var BPromise=require(_0x4840('0x3'));var rs=require(_0x4840('0x4'));var fs=require('fs');var Redis=require(_0x4840('0x5'));var db=require(_0x4840('0x6'))['db'];var utils=require(_0x4840('0x7'));var logger=require('../../config/logger')(_0x4840('0x8'));var config=require('../../config/environment');var jayson=require(_0x4840('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x16e60f,_0x231b04,_0x573811){return new BPromise(function(_0x1393eb,_0x26cf06){return client[_0x4840('0xa')](_0x16e60f,_0x573811)[_0x4840('0xb')](function(_0x129384){logger[_0x4840('0xc')](_0x4840('0xd'),_0x231b04,_0x4840('0xe'));logger[_0x4840('0xf')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x231b04,_0x4840('0xe'),JSON[_0x4840('0x10')](_0x129384));if(_0x129384['error']){if(_0x129384[_0x4840('0x11')][_0x4840('0x12')]===0x1f4){logger[_0x4840('0x11')](_0x4840('0xd'),_0x231b04,_0x129384[_0x4840('0x11')]['message']);return _0x26cf06(_0x129384[_0x4840('0x11')][_0x4840('0x13')]);}logger[_0x4840('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x231b04,_0x129384[_0x4840('0x11')][_0x4840('0x13')]);return _0x1393eb(_0x129384[_0x4840('0x11')]['message']);}else{logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x231b04,_0x4840('0xe'));_0x1393eb(_0x129384['result'][_0x4840('0x13')]);}})[_0x4840('0x14')](function(_0x2882da){logger[_0x4840('0x11')](_0x4840('0xd'),_0x231b04,_0x2882da);_0x26cf06(_0x2882da);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index bbf3541..1405b51 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 _0x08cd=['../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','create','destroy','multer','util','path','Router','fs-extra'];(function(_0xf94a45,_0x24796a){var _0x2b2ee8=function(_0x108f08){while(--_0x108f08){_0xf94a45['push'](_0xf94a45['shift']());}};_0x2b2ee8(++_0x24796a);}(_0x08cd,0x1ae));var _0xd08c=function(_0x4091c5,_0x5102cd){_0x4091c5=_0x4091c5-0x0;var _0x1ac660=_0x08cd[_0x4091c5];return _0x1ac660;};'use strict';var multer=require(_0xd08c('0x0'));var util=require(_0xd08c('0x1'));var path=require(_0xd08c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd08c('0x3')]();var fs_extra=require(_0xd08c('0x4'));var auth=require(_0xd08c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd08c('0x6'));var controller=require('./intZendeskField.controller');router['get']('/',auth[_0xd08c('0x7')](),controller[_0xd08c('0x8')]);router[_0xd08c('0x9')](_0xd08c('0xa'),auth[_0xd08c('0x7')](),controller[_0xd08c('0xb')]);router[_0xd08c('0xc')]('/',auth[_0xd08c('0x7')](),controller[_0xd08c('0xd')]);router['put'](_0xd08c('0xa'),auth[_0xd08c('0x7')](),controller['update']);router['delete'](_0xd08c('0xa'),auth[_0xd08c('0x7')](),controller[_0xd08c('0xe')]);module['exports']=router; \ No newline at end of file +var _0x46cf=['./intZendeskField.controller','get','isAuthenticated','index','show','post','put','/:id','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xf26bf5,_0x3835fb){var _0x30e480=function(_0x27fdc6){while(--_0x27fdc6){_0xf26bf5['push'](_0xf26bf5['shift']());}};_0x30e480(++_0x3835fb);}(_0x46cf,0x1b2));var _0xf46c=function(_0xda464c,_0x26e47d){_0xda464c=_0xda464c-0x0;var _0x19e222=_0x46cf[_0xda464c];return _0x19e222;};'use strict';var multer=require(_0xf46c('0x0'));var util=require(_0xf46c('0x1'));var path=require('path');var timeout=require(_0xf46c('0x2'));var express=require('express');var router=express[_0xf46c('0x3')]();var fs_extra=require(_0xf46c('0x4'));var auth=require(_0xf46c('0x5'));var interaction=require(_0xf46c('0x6'));var config=require(_0xf46c('0x7'));var controller=require(_0xf46c('0x8'));router[_0xf46c('0x9')]('/',auth[_0xf46c('0xa')](),controller[_0xf46c('0xb')]);router[_0xf46c('0x9')]('/:id',auth[_0xf46c('0xa')](),controller[_0xf46c('0xc')]);router[_0xf46c('0xd')]('/',auth[_0xf46c('0xa')](),controller['create']);router[_0xf46c('0xe')](_0xf46c('0xf'),auth[_0xf46c('0xa')](),controller['update']);router['delete'](_0xf46c('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0xf46c('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index c00652a..5d76098 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 _0xcecc=['ENUM','string','variable','customVariable','picklist','STRING','BOOLEAN','sequelize','exports'];(function(_0x1265ed,_0x4b85e8){var _0x5ac459=function(_0xf0c114){while(--_0xf0c114){_0x1265ed['push'](_0x1265ed['shift']());}};_0x5ac459(++_0x4b85e8);}(_0xcecc,0x1c0));var _0xccec=function(_0x5e6815,_0x322750){_0x5e6815=_0x5e6815-0x0;var _0x5e4a69=_0xcecc[_0x5e6815];return _0x5e4a69;};'use strict';var Sequelize=require(_0xccec('0x0'));module[_0xccec('0x1')]={'type':{'type':Sequelize[_0xccec('0x2')](_0xccec('0x3'),_0xccec('0x4'),_0xccec('0x5'),'keyValue',_0xccec('0x6')),'defaultValue':_0xccec('0x3')},'content':{'type':Sequelize[_0xccec('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xccec('0x2')](_0xccec('0x3'),_0xccec('0x4'),_0xccec('0x5'))},'keyContent':{'type':Sequelize[_0xccec('0x7')]},'idField':{'type':Sequelize[_0xccec('0x7')]},'nameField':{'type':Sequelize[_0xccec('0x7')]},'customField':{'type':Sequelize[_0xccec('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xccec('0x7')]}}; \ No newline at end of file +var _0xe2b0=['STRING','ENUM','customVariable','BOOLEAN','sequelize','exports','keyValue','picklist','string'];(function(_0x30a17b,_0x2063de){var _0xf2d3c9=function(_0x2b880a){while(--_0x2b880a){_0x30a17b['push'](_0x30a17b['shift']());}};_0xf2d3c9(++_0x2063de);}(_0xe2b0,0x1d8));var _0x0e2b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2b0[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x0e2b('0x0'));module[_0x0e2b('0x1')]={'type':{'type':Sequelize['ENUM']('string','variable','customVariable',_0x0e2b('0x2'),_0x0e2b('0x3')),'defaultValue':_0x0e2b('0x4')},'content':{'type':Sequelize[_0x0e2b('0x5')]},'key':{'type':Sequelize[_0x0e2b('0x5')]},'keyType':{'type':Sequelize[_0x0e2b('0x6')](_0x0e2b('0x4'),'variable',_0x0e2b('0x7'))},'keyContent':{'type':Sequelize[_0x0e2b('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x0e2b('0x5')]},'customField':{'type':Sequelize[_0x0e2b('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0e2b('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 048f479..6eb6740 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 _0x15b7=['send','index','map','ZendeskField','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','zip-dir','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','squel','crypto','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','limit','undefined','count','apply','save','then','destroy','error','stack','name','status'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x15b7,0x13a));var _0x715b=function(_0x54dfe4,_0x13c62d){_0x54dfe4=_0x54dfe4-0x0;var _0x2b8482=_0x15b7[_0x54dfe4];return _0x2b8482;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x715b('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x715b('0x1'));var moment=require(_0x715b('0x2'));var BPromise=require(_0x715b('0x3'));var Mustache=require('mustache');var util=require(_0x715b('0x4'));var path=require(_0x715b('0x5'));var sox=require(_0x715b('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x715b('0x7'));var _=require(_0x715b('0x8'));var squel=require(_0x715b('0x9'));var crypto=require(_0x715b('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x715b('0xb'));var querystring=require('querystring');var Papa=require(_0x715b('0xc'));var Redis=require(_0x715b('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x715b('0xe'));var as=require(_0x715b('0xf'));var hardwareService=require(_0x715b('0x10'));var logger=require(_0x715b('0x11'))('api');var utils=require(_0x715b('0x12'));var config=require(_0x715b('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x715b('0x14'))['db'];function respondWithStatusCode(_0x2f341b,_0x2cd619){_0x2cd619=_0x2cd619||0xcc;return function(_0x429c05){if(_0x429c05){return _0x2f341b[_0x715b('0x15')](_0x2cd619);}return _0x2f341b['status'](_0x2cd619)[_0x715b('0x16')]();};}function respondWithResult(_0x5a42ac,_0xb623be){_0xb623be=_0xb623be||0xc8;return function(_0x1b1267){if(_0x1b1267){return _0x5a42ac['status'](_0xb623be)[_0x715b('0x17')](_0x1b1267);}};}function respondWithFilteredResult(_0x5004a6,_0x48e194){return function(_0x18d021){if(_0x18d021){var _0x31b79e=typeof _0x48e194[_0x715b('0x18')]==='undefined'&&typeof _0x48e194[_0x715b('0x19')]===_0x715b('0x1a');var _0x3fa454=_0x18d021[_0x715b('0x1b')];var _0x27d498=_0x31b79e?0x0:_0x48e194[_0x715b('0x18')];var _0x3d8207=_0x31b79e?_0x18d021[_0x715b('0x1b')]:_0x48e194[_0x715b('0x18')]+_0x48e194[_0x715b('0x19')];var _0x5c731e;if(_0x3d8207>=_0x3fa454){_0x3d8207=_0x3fa454;_0x5c731e=0xc8;}else{_0x5c731e=0xce;}_0x5004a6['status'](_0x5c731e);return _0x5004a6['set']('Content-Range',_0x27d498+'-'+_0x3d8207+'/'+_0x3fa454)[_0x715b('0x17')](_0x18d021);}return null;};}function patchUpdates(_0x4bb35a){return function(_0x105f47){try{jsonpatch[_0x715b('0x1c')](_0x105f47,_0x4bb35a,!![]);}catch(_0x5991c9){return BPromise['reject'](_0x5991c9);}return _0x105f47[_0x715b('0x1d')]();};}function saveUpdates(_0x445929,_0x841c76){return function(_0x18695e){if(_0x18695e){return _0x18695e['update'](_0x445929)[_0x715b('0x1e')](function(_0xf1fbd5){return _0xf1fbd5;});}return null;};}function removeEntity(_0x58e6c5,_0x434827){return function(_0x2bda78){if(_0x2bda78){return _0x2bda78[_0x715b('0x1f')]()[_0x715b('0x1e')](function(){_0x58e6c5['status'](0xcc)[_0x715b('0x16')]();});}};}function handleEntityNotFound(_0x426af1,_0x24828c){return function(_0x48a4d3){if(!_0x48a4d3){_0x426af1['sendStatus'](0x194);}return _0x48a4d3;};}function handleError(_0xf7992a,_0x1e6a68){_0x1e6a68=_0x1e6a68||0x1f4;return function(_0x2465cd){logger[_0x715b('0x20')](_0x2465cd[_0x715b('0x21')]);if(_0x2465cd[_0x715b('0x22')]){delete _0x2465cd['name'];}_0xf7992a[_0x715b('0x23')](_0x1e6a68)[_0x715b('0x24')](_0x2465cd);};}exports[_0x715b('0x25')]=function(_0x52eb5c,_0x2cb4f7){var _0x48eafa={},_0x5af092={},_0x4b1ff7={'count':0x0,'rows':[]};var _0x3c02ef=_[_0x715b('0x26')](db[_0x715b('0x27')]['rawAttributes'],function(_0x1ee1ec){return{'name':_0x1ee1ec[_0x715b('0x28')],'type':_0x1ee1ec[_0x715b('0x29')]['key']};});_0x5af092[_0x715b('0x2a')]=_[_0x715b('0x26')](_0x3c02ef,_0x715b('0x22'));_0x5af092[_0x715b('0x2b')]=_[_0x715b('0x2c')](_0x52eb5c[_0x715b('0x2b')]);_0x5af092[_0x715b('0x2d')]=_[_0x715b('0x2e')](_0x5af092[_0x715b('0x2a')],_0x5af092[_0x715b('0x2b')]);_0x48eafa[_0x715b('0x2f')]=_[_0x715b('0x2e')](_0x5af092[_0x715b('0x2a')],qs['fields'](_0x52eb5c[_0x715b('0x2b')][_0x715b('0x30')]));_0x48eafa[_0x715b('0x2f')]=_0x48eafa['attributes'][_0x715b('0x31')]?_0x48eafa[_0x715b('0x2f')]:_0x5af092[_0x715b('0x2a')];if(!_0x52eb5c[_0x715b('0x2b')][_0x715b('0x32')](_0x715b('0x33'))){_0x48eafa['limit']=qs[_0x715b('0x19')](_0x52eb5c[_0x715b('0x2b')][_0x715b('0x19')]);_0x48eafa['offset']=qs[_0x715b('0x18')](_0x52eb5c['query'][_0x715b('0x18')]);}_0x48eafa[_0x715b('0x34')]=qs[_0x715b('0x35')](_0x52eb5c[_0x715b('0x2b')][_0x715b('0x35')]);_0x48eafa[_0x715b('0x36')]=qs[_0x715b('0x2d')](_[_0x715b('0x37')](_0x52eb5c[_0x715b('0x2b')],_0x5af092[_0x715b('0x2d')]),_0x3c02ef);if(_0x52eb5c[_0x715b('0x2b')][_0x715b('0x38')]){_0x48eafa[_0x715b('0x36')]=_[_0x715b('0x39')](_0x48eafa['where'],{'$or':_['map'](_0x3c02ef,function(_0x3b52e9){if(_0x3b52e9[_0x715b('0x29')]!=='VIRTUAL'){var _0x4b3d7d={};_0x4b3d7d[_0x3b52e9[_0x715b('0x22')]]={'$like':'%'+_0x52eb5c[_0x715b('0x2b')][_0x715b('0x38')]+'%'};return _0x4b3d7d;}})});}_0x48eafa=_[_0x715b('0x39')]({},_0x48eafa,_0x52eb5c[_0x715b('0x3a')]);var _0x105523={'where':_0x48eafa[_0x715b('0x36')]};return db[_0x715b('0x27')]['count'](_0x105523)[_0x715b('0x1e')](function(_0x3b3aa6){_0x4b1ff7[_0x715b('0x1b')]=_0x3b3aa6;if(_0x52eb5c['query'][_0x715b('0x3b')]){_0x48eafa[_0x715b('0x3c')]=[{'all':!![]}];}return db['ZendeskField'][_0x715b('0x3d')](_0x48eafa);})[_0x715b('0x1e')](function(_0x4cbbd7){_0x4b1ff7[_0x715b('0x3e')]=_0x4cbbd7;return _0x4b1ff7;})[_0x715b('0x1e')](respondWithFilteredResult(_0x2cb4f7,_0x48eafa))['catch'](handleError(_0x2cb4f7,null));};exports[_0x715b('0x3f')]=function(_0x273171,_0x5466eb){var _0x5870f0={'raw':!![],'where':{'id':_0x273171[_0x715b('0x40')]['id']}},_0x220764={};_0x220764['model']=_[_0x715b('0x2c')](db[_0x715b('0x27')][_0x715b('0x41')]);_0x220764[_0x715b('0x2b')]=_[_0x715b('0x2c')](_0x273171[_0x715b('0x2b')]);_0x220764[_0x715b('0x2d')]=_['intersection'](_0x220764[_0x715b('0x2a')],_0x220764[_0x715b('0x2b')]);_0x5870f0[_0x715b('0x2f')]=_[_0x715b('0x2e')](_0x220764['model'],qs['fields'](_0x273171[_0x715b('0x2b')][_0x715b('0x30')]));_0x5870f0['attributes']=_0x5870f0[_0x715b('0x2f')]['length']?_0x5870f0['attributes']:_0x220764[_0x715b('0x2a')];if(_0x273171[_0x715b('0x2b')]['includeAll']){_0x5870f0['include']=[{'all':!![]}];}_0x5870f0=_[_0x715b('0x39')]({},_0x5870f0,_0x273171[_0x715b('0x3a')]);return db['ZendeskField'][_0x715b('0x42')](_0x5870f0)[_0x715b('0x1e')](handleEntityNotFound(_0x5466eb,null))[_0x715b('0x1e')](respondWithResult(_0x5466eb,null))[_0x715b('0x43')](handleError(_0x5466eb,null));};exports['create']=function(_0xba6178,_0x13eae8){return db[_0x715b('0x27')][_0x715b('0x44')](_0xba6178[_0x715b('0x45')],{})['then'](respondWithResult(_0x13eae8,0xc9))[_0x715b('0x43')](handleError(_0x13eae8,null));};exports['update']=function(_0x143d4b,_0x5c740a){if(_0x143d4b[_0x715b('0x45')]['id']){delete _0x143d4b[_0x715b('0x45')]['id'];}return db[_0x715b('0x27')]['find']({'where':{'id':_0x143d4b[_0x715b('0x40')]['id']}})[_0x715b('0x1e')](handleEntityNotFound(_0x5c740a,null))[_0x715b('0x1e')](saveUpdates(_0x143d4b[_0x715b('0x45')],null))['then'](respondWithResult(_0x5c740a,null))[_0x715b('0x43')](handleError(_0x5c740a,null));};exports[_0x715b('0x1f')]=function(_0x5df3f1,_0x9498f5){return db[_0x715b('0x27')]['find']({'where':{'id':_0x5df3f1[_0x715b('0x40')]['id']}})[_0x715b('0x1e')](handleEntityNotFound(_0x9498f5,null))[_0x715b('0x1e')](removeEntity(_0x9498f5,null))[_0x715b('0x43')](handleError(_0x9498f5,null));}; \ No newline at end of file +var _0x0624=['json','apply','reject','save','then','end','error','stack','name','map','ZendeskField','rawAttributes','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','filter','options','includeAll','include','rows','catch','params','keys','find','create','update','body','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','limit','count','offset','set'];(function(_0x24ab5e,_0x1f05cb){var _0x511c0e=function(_0x12c5e3){while(--_0x12c5e3){_0x24ab5e['push'](_0x24ab5e['shift']());}};_0x511c0e(++_0x1f05cb);}(_0x0624,0x132));var _0x4062=function(_0x3d3ef4,_0x2a8457){_0x3d3ef4=_0x3d3ef4-0x0;var _0x2655f2=_0x0624[_0x3d3ef4];return _0x2655f2;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4062('0x0'));var moment=require(_0x4062('0x1'));var BPromise=require(_0x4062('0x2'));var Mustache=require(_0x4062('0x3'));var util=require(_0x4062('0x4'));var path=require(_0x4062('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4062('0x6'));var fs=require('fs');var fs_extra=require(_0x4062('0x7'));var _=require(_0x4062('0x8'));var squel=require(_0x4062('0x9'));var crypto=require(_0x4062('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x4062('0xb'));var toCsv=require('to-csv');var querystring=require(_0x4062('0xc'));var Papa=require(_0x4062('0xd'));var Redis=require(_0x4062('0xe'));var authService=require(_0x4062('0xf'));var qs=require(_0x4062('0x10'));var as=require(_0x4062('0x11'));var hardwareService=require(_0x4062('0x12'));var logger=require('../../config/logger')(_0x4062('0x13'));var utils=require('../../config/utils');var config=require(_0x4062('0x14'));var licenseUtil=require(_0x4062('0x15'));var db=require(_0x4062('0x16'))['db'];function respondWithStatusCode(_0x3146e2,_0x160b6d){_0x160b6d=_0x160b6d||0xcc;return function(_0x57e04b){if(_0x57e04b){return _0x3146e2[_0x4062('0x17')](_0x160b6d);}return _0x3146e2[_0x4062('0x18')](_0x160b6d)['end']();};}function respondWithResult(_0x32ced6,_0x42859d){_0x42859d=_0x42859d||0xc8;return function(_0x95bb42){if(_0x95bb42){return _0x32ced6['status'](_0x42859d)['json'](_0x95bb42);}};}function respondWithFilteredResult(_0x25a717,_0x467ac7){return function(_0x48ea2b){if(_0x48ea2b){var _0x4d7166=typeof _0x467ac7['offset']==='undefined'&&typeof _0x467ac7[_0x4062('0x19')]==='undefined';var _0x2efc3c=_0x48ea2b[_0x4062('0x1a')];var _0x3d14bb=_0x4d7166?0x0:_0x467ac7[_0x4062('0x1b')];var _0x2a04c7=_0x4d7166?_0x48ea2b[_0x4062('0x1a')]:_0x467ac7[_0x4062('0x1b')]+_0x467ac7['limit'];var _0x324bb3;if(_0x2a04c7>=_0x2efc3c){_0x2a04c7=_0x2efc3c;_0x324bb3=0xc8;}else{_0x324bb3=0xce;}_0x25a717['status'](_0x324bb3);return _0x25a717[_0x4062('0x1c')]('Content-Range',_0x3d14bb+'-'+_0x2a04c7+'/'+_0x2efc3c)[_0x4062('0x1d')](_0x48ea2b);}return null;};}function patchUpdates(_0x31777f){return function(_0x12c6a3){try{jsonpatch[_0x4062('0x1e')](_0x12c6a3,_0x31777f,!![]);}catch(_0x3cb45d){return BPromise[_0x4062('0x1f')](_0x3cb45d);}return _0x12c6a3[_0x4062('0x20')]();};}function saveUpdates(_0x341310,_0xc6c0ba){return function(_0x53648a){if(_0x53648a){return _0x53648a['update'](_0x341310)[_0x4062('0x21')](function(_0xc5e4a0){return _0xc5e4a0;});}return null;};}function removeEntity(_0x23f81c,_0x1fa194){return function(_0x59d19f){if(_0x59d19f){return _0x59d19f['destroy']()['then'](function(){_0x23f81c[_0x4062('0x18')](0xcc)[_0x4062('0x22')]();});}};}function handleEntityNotFound(_0x11b962,_0x4117db){return function(_0x3c1ee0){if(!_0x3c1ee0){_0x11b962[_0x4062('0x17')](0x194);}return _0x3c1ee0;};}function handleError(_0x4a28c8,_0x3dec4f){_0x3dec4f=_0x3dec4f||0x1f4;return function(_0x448545){logger[_0x4062('0x23')](_0x448545[_0x4062('0x24')]);if(_0x448545[_0x4062('0x25')]){delete _0x448545['name'];}_0x4a28c8[_0x4062('0x18')](_0x3dec4f)['send'](_0x448545);};}exports['index']=function(_0x391065,_0x52c29b){var _0x42ee1a={},_0x169c12={},_0x9c9fc3={'count':0x0,'rows':[]};var _0xc1c540=_[_0x4062('0x26')](db[_0x4062('0x27')][_0x4062('0x28')],function(_0x253bcf){return{'name':_0x253bcf['fieldName'],'type':_0x253bcf['type']['key']};});_0x169c12[_0x4062('0x29')]=_[_0x4062('0x26')](_0xc1c540,'name');_0x169c12[_0x4062('0x2a')]=_['keys'](_0x391065['query']);_0x169c12['filters']=_[_0x4062('0x2b')](_0x169c12[_0x4062('0x29')],_0x169c12[_0x4062('0x2a')]);_0x42ee1a[_0x4062('0x2c')]=_[_0x4062('0x2b')](_0x169c12[_0x4062('0x29')],qs[_0x4062('0x2d')](_0x391065[_0x4062('0x2a')][_0x4062('0x2d')]));_0x42ee1a[_0x4062('0x2c')]=_0x42ee1a[_0x4062('0x2c')][_0x4062('0x2e')]?_0x42ee1a['attributes']:_0x169c12[_0x4062('0x29')];if(!_0x391065['query'][_0x4062('0x2f')](_0x4062('0x30'))){_0x42ee1a[_0x4062('0x19')]=qs['limit'](_0x391065[_0x4062('0x2a')][_0x4062('0x19')]);_0x42ee1a[_0x4062('0x1b')]=qs[_0x4062('0x1b')](_0x391065[_0x4062('0x2a')][_0x4062('0x1b')]);}_0x42ee1a[_0x4062('0x31')]=qs[_0x4062('0x32')](_0x391065[_0x4062('0x2a')]['sort']);_0x42ee1a[_0x4062('0x33')]=qs[_0x4062('0x34')](_[_0x4062('0x35')](_0x391065[_0x4062('0x2a')],_0x169c12[_0x4062('0x34')]),_0xc1c540);if(_0x391065[_0x4062('0x2a')]['filter']){_0x42ee1a[_0x4062('0x33')]=_[_0x4062('0x36')](_0x42ee1a[_0x4062('0x33')],{'$or':_[_0x4062('0x26')](_0xc1c540,function(_0xaa22d7){if(_0xaa22d7['type']!=='VIRTUAL'){var _0x2ed7a2={};_0x2ed7a2[_0xaa22d7[_0x4062('0x25')]]={'$like':'%'+_0x391065['query'][_0x4062('0x37')]+'%'};return _0x2ed7a2;}})});}_0x42ee1a=_[_0x4062('0x36')]({},_0x42ee1a,_0x391065[_0x4062('0x38')]);var _0x3e8aa3={'where':_0x42ee1a[_0x4062('0x33')]};return db[_0x4062('0x27')][_0x4062('0x1a')](_0x3e8aa3)[_0x4062('0x21')](function(_0x5f239){_0x9c9fc3[_0x4062('0x1a')]=_0x5f239;if(_0x391065['query'][_0x4062('0x39')]){_0x42ee1a[_0x4062('0x3a')]=[{'all':!![]}];}return db['ZendeskField']['findAll'](_0x42ee1a);})['then'](function(_0x3e903b){_0x9c9fc3[_0x4062('0x3b')]=_0x3e903b;return _0x9c9fc3;})[_0x4062('0x21')](respondWithFilteredResult(_0x52c29b,_0x42ee1a))[_0x4062('0x3c')](handleError(_0x52c29b,null));};exports['show']=function(_0x4a743f,_0x5158f4){var _0x42d0d3={'raw':!![],'where':{'id':_0x4a743f[_0x4062('0x3d')]['id']}},_0x39c9ef={};_0x39c9ef['model']=_['keys'](db[_0x4062('0x27')][_0x4062('0x28')]);_0x39c9ef[_0x4062('0x2a')]=_[_0x4062('0x3e')](_0x4a743f[_0x4062('0x2a')]);_0x39c9ef[_0x4062('0x34')]=_[_0x4062('0x2b')](_0x39c9ef[_0x4062('0x29')],_0x39c9ef['query']);_0x42d0d3[_0x4062('0x2c')]=_[_0x4062('0x2b')](_0x39c9ef[_0x4062('0x29')],qs['fields'](_0x4a743f[_0x4062('0x2a')]['fields']));_0x42d0d3['attributes']=_0x42d0d3[_0x4062('0x2c')][_0x4062('0x2e')]?_0x42d0d3['attributes']:_0x39c9ef[_0x4062('0x29')];if(_0x4a743f[_0x4062('0x2a')][_0x4062('0x39')]){_0x42d0d3[_0x4062('0x3a')]=[{'all':!![]}];}_0x42d0d3=_[_0x4062('0x36')]({},_0x42d0d3,_0x4a743f['options']);return db['ZendeskField'][_0x4062('0x3f')](_0x42d0d3)[_0x4062('0x21')](handleEntityNotFound(_0x5158f4,null))[_0x4062('0x21')](respondWithResult(_0x5158f4,null))['catch'](handleError(_0x5158f4,null));};exports[_0x4062('0x40')]=function(_0xe615bd,_0x58a141){return db[_0x4062('0x27')][_0x4062('0x40')](_0xe615bd['body'],{})['then'](respondWithResult(_0x58a141,0xc9))['catch'](handleError(_0x58a141,null));};exports[_0x4062('0x41')]=function(_0x560b20,_0x58921a){if(_0x560b20[_0x4062('0x42')]['id']){delete _0x560b20['body']['id'];}return db['ZendeskField'][_0x4062('0x3f')]({'where':{'id':_0x560b20[_0x4062('0x3d')]['id']}})[_0x4062('0x21')](handleEntityNotFound(_0x58921a,null))['then'](saveUpdates(_0x560b20[_0x4062('0x42')],null))[_0x4062('0x21')](respondWithResult(_0x58921a,null))[_0x4062('0x3c')](handleError(_0x58921a,null));};exports['destroy']=function(_0x5c75b6,_0x36b58e){return db[_0x4062('0x27')]['find']({'where':{'id':_0x5c75b6[_0x4062('0x3d')]['id']}})[_0x4062('0x21')](handleEntityNotFound(_0x36b58e,null))[_0x4062('0x21')](removeEntity(_0x36b58e,null))['catch'](handleError(_0x36b58e,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 403cf4a..a41b5e0 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 _0x9a0f=['idField','util','api','moment','bluebird','request-promise','../../config/environment','./intZendeskField.attributes','define','ZendeskField'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x9a0f,0x15f));var _0xf9a0=function(_0x5cfe2c,_0x281794){_0x5cfe2c=_0x5cfe2c-0x0;var _0x94d05a=_0x9a0f[_0x5cfe2c];return _0x94d05a;};'use strict';var _=require('lodash');var util=require(_0xf9a0('0x0'));var logger=require('../../config/logger')(_0xf9a0('0x1'));var moment=require(_0xf9a0('0x2'));var BPromise=require(_0xf9a0('0x3'));var rp=require(_0xf9a0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf9a0('0x5'));var attributes=require(_0xf9a0('0x6'));module['exports']=function(_0x5c4ad9,_0x583edf){return _0x5c4ad9[_0xf9a0('0x7')](_0xf9a0('0x8'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0xf9a0('0x9'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4a2e=['./intZendeskField.attributes','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x5c2fc,_0x99f582){var _0x3559a4=function(_0x2acb72){while(--_0x2acb72){_0x5c2fc['push'](_0x5c2fc['shift']());}};_0x3559a4(++_0x99f582);}(_0x4a2e,0x130));var _0xe4a2=function(_0x3aa0ac,_0x5f5da6){_0x3aa0ac=_0x3aa0ac-0x0;var _0x568a11=_0x4a2e[_0x3aa0ac];return _0x568a11;};'use strict';var _=require('lodash');var util=require(_0xe4a2('0x0'));var logger=require(_0xe4a2('0x1'))(_0xe4a2('0x2'));var moment=require(_0xe4a2('0x3'));var BPromise=require(_0xe4a2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe4a2('0x5'));var rimraf=require(_0xe4a2('0x6'));var config=require(_0xe4a2('0x7'));var attributes=require(_0xe4a2('0x8'));module['exports']=function(_0x1605be,_0x38e783){return _0x1605be['define'](_0xe4a2('0x9'),attributes,{'tableName':_0xe4a2('0xa'),'paranoid':![],'indexes':[{'name':_0xe4a2('0xb'),'fields':[_0xe4a2('0xc'),'FieldId'],'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 f381d6a..fe3f8d5 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 _0x390a=['../../config/logger','rpc','../../config/environment','client','http','then','ZendeskField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x308881,_0x267509){var _0x1086c3=function(_0x5aea40){while(--_0x5aea40){_0x308881['push'](_0x308881['shift']());}};_0x1086c3(++_0x267509);}(_0x390a,0x177));var _0xa390=function(_0x2b80f4,_0x587a50){_0x2b80f4=_0x2b80f4-0x0;var _0x86804c=_0x390a[_0x2b80f4];return _0x86804c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa390('0x0'));var BPromise=require(_0xa390('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa390('0x2'));var db=require(_0xa390('0x3'))['db'];var utils=require(_0xa390('0x4'));var logger=require(_0xa390('0x5'))(_0xa390('0x6'));var config=require(_0xa390('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa390('0x8')][_0xa390('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e6fff,_0x3f115f,_0x35facd){return new BPromise(function(_0x51f9a4,_0x3d5a7c){return client['request'](_0x3e6fff,_0x35facd)[_0xa390('0xa')](function(_0x5a436f){logger['info'](_0xa390('0xb'),_0x3f115f,'request\x20sent');logger[_0xa390('0xc')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x3f115f,_0xa390('0xd'),JSON[_0xa390('0xe')](_0x5a436f));if(_0x5a436f[_0xa390('0xf')]){if(_0x5a436f['error'][_0xa390('0x10')]===0x1f4){logger[_0xa390('0xf')]('ZendeskField,\x20%s,\x20%s',_0x3f115f,_0x5a436f[_0xa390('0xf')][_0xa390('0x11')]);return _0x3d5a7c(_0x5a436f['error'][_0xa390('0x11')]);}logger[_0xa390('0xf')](_0xa390('0xb'),_0x3f115f,_0x5a436f[_0xa390('0xf')][_0xa390('0x11')]);return _0x51f9a4(_0x5a436f[_0xa390('0xf')][_0xa390('0x11')]);}else{logger['info']('ZendeskField,\x20%s,\x20%s',_0x3f115f,_0xa390('0xd'));_0x51f9a4(_0x5a436f[_0xa390('0x12')][_0xa390('0x11')]);}})[_0xa390('0x13')](function(_0x421f00){logger['error'](_0xa390('0xb'),_0x3f115f,_0x421f00);_0x3d5a7c(_0x421f00);});});} \ No newline at end of file +var _0x44f2=['ZendeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x18ffc5,_0x5ba169){var _0x577936=function(_0x124b09){while(--_0x124b09){_0x18ffc5['push'](_0x18ffc5['shift']());}};_0x577936(++_0x5ba169);}(_0x44f2,0x190));var _0x244f=function(_0x4126dc,_0x1430f8){_0x4126dc=_0x4126dc-0x0;var _0xef998b=_0x44f2[_0x4126dc];return _0xef998b;};'use strict';var _=require(_0x244f('0x0'));var util=require(_0x244f('0x1'));var moment=require(_0x244f('0x2'));var BPromise=require(_0x244f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x244f('0x4'));var db=require(_0x244f('0x5'))['db'];var utils=require(_0x244f('0x6'));var logger=require(_0x244f('0x7'))(_0x244f('0x8'));var config=require(_0x244f('0x9'));var jayson=require(_0x244f('0xa'));var client=jayson[_0x244f('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5759e4,_0x3ee3f0,_0x2e2486){return new BPromise(function(_0xc53ebc,_0x2de420){return client[_0x244f('0xc')](_0x5759e4,_0x2e2486)[_0x244f('0xd')](function(_0x3b76be){logger['info'](_0x244f('0xe'),_0x3ee3f0,_0x244f('0xf'));logger[_0x244f('0x10')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x3ee3f0,'request\x20sent',JSON[_0x244f('0x11')](_0x3b76be));if(_0x3b76be[_0x244f('0x12')]){if(_0x3b76be['error'][_0x244f('0x13')]===0x1f4){logger[_0x244f('0x12')](_0x244f('0xe'),_0x3ee3f0,_0x3b76be[_0x244f('0x12')][_0x244f('0x14')]);return _0x2de420(_0x3b76be[_0x244f('0x12')]['message']);}logger[_0x244f('0x12')](_0x244f('0xe'),_0x3ee3f0,_0x3b76be[_0x244f('0x12')][_0x244f('0x14')]);return _0xc53ebc(_0x3b76be[_0x244f('0x12')][_0x244f('0x14')]);}else{logger['info']('ZendeskField,\x20%s,\x20%s',_0x3ee3f0,'request\x20sent');_0xc53ebc(_0x3b76be[_0x244f('0x15')][_0x244f('0x14')]);}})[_0x244f('0x16')](function(_0x511a0d){logger[_0x244f('0x12')](_0x244f('0xe'),_0x3ee3f0,_0x511a0d);_0x2de420(_0x511a0d);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index a03b003..64f5abc 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 _0xb06e=['show','/:id/configurations','get','/:id/fields','getFields','post','create','addConfiguration','put','update','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xb06e,0x1d8));var _0xeb06=function(_0x2ddb37,_0x4fa2bb){_0x2ddb37=_0x2ddb37-0x0;var _0x326b70=_0xb06e[_0x2ddb37];return _0x326b70;};'use strict';var multer=require('multer');var util=require(_0xeb06('0x0'));var path=require(_0xeb06('0x1'));var timeout=require(_0xeb06('0x2'));var express=require(_0xeb06('0x3'));var router=express['Router']();var fs_extra=require(_0xeb06('0x4'));var auth=require(_0xeb06('0x5'));var interaction=require(_0xeb06('0x6'));var config=require(_0xeb06('0x7'));var controller=require('./intZohoAccount.controller');router['get']('/',auth[_0xeb06('0x8')](),controller[_0xeb06('0x9')]);router['get'](_0xeb06('0xa'),auth[_0xeb06('0x8')](),controller[_0xeb06('0xb')]);router['get'](_0xeb06('0xc'),auth[_0xeb06('0x8')](),controller['getConfigurations']);router[_0xeb06('0xd')](_0xeb06('0xe'),auth[_0xeb06('0x8')](),controller[_0xeb06('0xf')]);router[_0xeb06('0x10')]('/',auth[_0xeb06('0x8')](),controller[_0xeb06('0x11')]);router[_0xeb06('0x10')](_0xeb06('0xc'),auth[_0xeb06('0x8')](),controller[_0xeb06('0x12')]);router[_0xeb06('0x13')](_0xeb06('0xa'),auth[_0xeb06('0x8')](),controller[_0xeb06('0x14')]);router['delete'](_0xeb06('0xa'),auth[_0xeb06('0x8')](),controller[_0xeb06('0x15')]);module[_0xeb06('0x16')]=router; \ No newline at end of file +var _0x163a=['getConfigurations','/:id/fields','getFields','create','addConfiguration','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id/configurations'];(function(_0x39553b,_0x15d6ac){var _0x3cd31d=function(_0x2ea569){while(--_0x2ea569){_0x39553b['push'](_0x39553b['shift']());}};_0x3cd31d(++_0x15d6ac);}(_0x163a,0x1d7));var _0xa163=function(_0x27d8bc,_0x19e010){_0x27d8bc=_0x27d8bc-0x0;var _0x4b04cb=_0x163a[_0x27d8bc];return _0x4b04cb;};'use strict';var multer=require(_0xa163('0x0'));var util=require(_0xa163('0x1'));var path=require(_0xa163('0x2'));var timeout=require(_0xa163('0x3'));var express=require(_0xa163('0x4'));var router=express[_0xa163('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xa163('0x6'));var interaction=require(_0xa163('0x7'));var config=require('../../config/environment');var controller=require('./intZohoAccount.controller');router['get']('/',auth[_0xa163('0x8')](),controller[_0xa163('0x9')]);router[_0xa163('0xa')]('/:id',auth[_0xa163('0x8')](),controller['show']);router[_0xa163('0xa')](_0xa163('0xb'),auth[_0xa163('0x8')](),controller[_0xa163('0xc')]);router[_0xa163('0xa')](_0xa163('0xd'),auth[_0xa163('0x8')](),controller[_0xa163('0xe')]);router['post']('/',auth[_0xa163('0x8')](),controller[_0xa163('0xf')]);router['post'](_0xa163('0xb'),auth[_0xa163('0x8')](),controller[_0xa163('0x10')]);router[_0xa163('0x11')](_0xa163('0x12'),auth[_0xa163('0x8')](),controller[_0xa163('0x13')]);router[_0xa163('0x14')](_0xa163('0x12'),auth[_0xa163('0x8')](),controller[_0xa163('0x15')]);module[_0xa163('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 03d189c..b3ca70b 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 _0x4522=['STRING'];(function(_0x3ecdc7,_0x5978ee){var _0x4c9d74=function(_0x1394b3){while(--_0x1394b3){_0x3ecdc7['push'](_0x3ecdc7['shift']());}};_0x4c9d74(++_0x5978ee);}(_0x4522,0x1a0));var _0x2452=function(_0x5d4eb3,_0x45660d){_0x5d4eb3=_0x5d4eb3-0x0;var _0x4abaa1=_0x4522[_0x5d4eb3];return _0x4abaa1;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x2452('0x0')]},'description':{'type':Sequelize[_0x2452('0x0')]},'host':{'type':Sequelize[_0x2452('0x0')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x2452('0x0')]},'clientSecret':{'type':Sequelize[_0x2452('0x0')]},'serverUrl':{'type':Sequelize[_0x2452('0x0')],'allowNull':![]},'code':{'type':Sequelize[_0x2452('0x0')]},'refreshToken':{'type':Sequelize[_0x2452('0x0')]}}; \ No newline at end of file +var _0x17ba=['sequelize','exports','STRING'];(function(_0x54b396,_0x3612ee){var _0x532e6d=function(_0xc8286e){while(--_0xc8286e){_0x54b396['push'](_0x54b396['shift']());}};_0x532e6d(++_0x3612ee);}(_0x17ba,0xab));var _0xa17b=function(_0x52c15f,_0xa46850){_0x52c15f=_0x52c15f-0x0;var _0x504b46=_0x17ba[_0x52c15f];return _0x504b46;};'use strict';var Sequelize=require(_0xa17b('0x0'));module[_0xa17b('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa17b('0x2')]},'host':{'type':Sequelize[_0xa17b('0x2')]},'zone':{'type':Sequelize[_0xa17b('0x2')]},'clientId':{'type':Sequelize[_0xa17b('0x2')]},'clientSecret':{'type':Sequelize[_0xa17b('0x2')]},'serverUrl':{'type':Sequelize[_0xa17b('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0xa17b('0x2')]},'refreshToken':{'type':Sequelize[_0xa17b('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index db88902..0533198 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 _0x79a2=['Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','error','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','includes','api_name','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','stack','name','send','map','ZohoAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','keys','create','body','find','params','getConfigurations','findOne','order','hasOwnProperty','addConfiguration','channel','getDescriptions','ZohoConfiguration','ZohoField','Subjects','Descriptions','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','access_token'];(function(_0x4a06ad,_0x4184bc){var _0x264297=function(_0x11d9bc){while(--_0x11d9bc){_0x4a06ad['push'](_0x4a06ad['shift']());}};_0x264297(++_0x4184bc);}(_0x79a2,0x138));var _0x279a=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x79a2[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x279a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x279a('0x1'));var BPromise=require(_0x279a('0x2'));var Mustache=require(_0x279a('0x3'));var util=require(_0x279a('0x4'));var path=require(_0x279a('0x5'));var sox=require(_0x279a('0x6'));var csv=require(_0x279a('0x7'));var ejs=require(_0x279a('0x8'));var fs=require('fs');var fs_extra=require(_0x279a('0x9'));var _=require(_0x279a('0xa'));var squel=require(_0x279a('0xb'));var crypto=require(_0x279a('0xc'));var jsforce=require(_0x279a('0xd'));var deskjs=require(_0x279a('0xe'));var toCsv=require(_0x279a('0x7'));var querystring=require(_0x279a('0xf'));var Papa=require(_0x279a('0x10'));var Redis=require(_0x279a('0x11'));var authService=require(_0x279a('0x12'));var qs=require(_0x279a('0x13'));var as=require(_0x279a('0x14'));var hardwareService=require(_0x279a('0x15'));var logger=require(_0x279a('0x16'))(_0x279a('0x17'));var utils=require(_0x279a('0x18'));var config=require(_0x279a('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x279a('0x1a'))['db'];var integrations=require(_0x279a('0x1b'));function respondWithStatusCode(_0x2a0210,_0x3eaf03){_0x3eaf03=_0x3eaf03||0xcc;return function(_0xab8680){if(_0xab8680){return _0x2a0210[_0x279a('0x1c')](_0x3eaf03);}return _0x2a0210[_0x279a('0x1d')](_0x3eaf03)[_0x279a('0x1e')]();};}function respondWithResult(_0x2ab541,_0x2dded3){_0x2dded3=_0x2dded3||0xc8;return function(_0x33ac8b){if(_0x33ac8b){return _0x2ab541['status'](_0x2dded3)[_0x279a('0x1f')](_0x33ac8b);}};}function respondWithFilteredResult(_0x33042f,_0x148921){return function(_0x16b5ad){if(_0x16b5ad){var _0xe55d=typeof _0x148921['offset']==='undefined'&&typeof _0x148921['limit']==='undefined';var _0x3e42e0=_0x16b5ad[_0x279a('0x20')];var _0x224a13=_0xe55d?0x0:_0x148921[_0x279a('0x21')];var _0x2bed45=_0xe55d?_0x16b5ad[_0x279a('0x20')]:_0x148921['offset']+_0x148921[_0x279a('0x22')];var _0x252843;if(_0x2bed45>=_0x3e42e0){_0x2bed45=_0x3e42e0;_0x252843=0xc8;}else{_0x252843=0xce;}_0x33042f[_0x279a('0x1d')](_0x252843);return _0x33042f[_0x279a('0x23')](_0x279a('0x24'),_0x224a13+'-'+_0x2bed45+'/'+_0x3e42e0)[_0x279a('0x1f')](_0x16b5ad);}return null;};}function patchUpdates(_0x1581bc){return function(_0x3bcf7a){try{jsonpatch[_0x279a('0x25')](_0x3bcf7a,_0x1581bc,!![]);}catch(_0x525a53){return BPromise['reject'](_0x525a53);}return _0x3bcf7a[_0x279a('0x26')]();};}function saveUpdates(_0x227572,_0xdb8a11){return function(_0x34298a){if(_0x34298a){return _0x34298a[_0x279a('0x27')](_0x227572)[_0x279a('0x28')](function(_0x51f81d){return _0x51f81d;});}return null;};}function removeEntity(_0x458694,_0x26c6f6){return function(_0x4de82a){if(_0x4de82a){return _0x4de82a[_0x279a('0x29')]()[_0x279a('0x28')](function(){_0x458694[_0x279a('0x1d')](0xcc)[_0x279a('0x1e')]();});}};}function handleEntityNotFound(_0x5a2b66,_0x1bd51f){return function(_0x11c8a3){if(!_0x11c8a3){_0x5a2b66[_0x279a('0x1c')](0x194);}return _0x11c8a3;};}function handleError(_0x2477bb,_0x44d62f){_0x44d62f=_0x44d62f||0x1f4;return function(_0x3f7895){logger['error'](_0x3f7895[_0x279a('0x2a')]);if(_0x3f7895[_0x279a('0x2b')]){delete _0x3f7895[_0x279a('0x2b')];}_0x2477bb['status'](_0x44d62f)[_0x279a('0x2c')](_0x3f7895);};}exports['index']=function(_0x4782d8,_0x3deeae){var _0x42ef46={},_0x23a91b={},_0x1cd750={'count':0x0,'rows':[]};var _0x4e1975=_[_0x279a('0x2d')](db[_0x279a('0x2e')][_0x279a('0x2f')],function(_0x64d49b){return{'name':_0x64d49b[_0x279a('0x30')],'type':_0x64d49b[_0x279a('0x31')][_0x279a('0x32')]};});_0x23a91b[_0x279a('0x33')]=_['map'](_0x4e1975,_0x279a('0x2b'));_0x23a91b[_0x279a('0x34')]=_['keys'](_0x4782d8[_0x279a('0x34')]);_0x23a91b[_0x279a('0x35')]=_[_0x279a('0x36')](_0x23a91b['model'],_0x23a91b[_0x279a('0x34')]);_0x42ef46[_0x279a('0x37')]=_[_0x279a('0x36')](_0x23a91b[_0x279a('0x33')],qs[_0x279a('0x38')](_0x4782d8[_0x279a('0x34')][_0x279a('0x38')]));_0x42ef46['attributes']=_0x42ef46[_0x279a('0x37')][_0x279a('0x39')]?_0x42ef46[_0x279a('0x37')]:_0x23a91b[_0x279a('0x33')];if(!_0x4782d8[_0x279a('0x34')]['hasOwnProperty'](_0x279a('0x3a'))){_0x42ef46[_0x279a('0x22')]=qs[_0x279a('0x22')](_0x4782d8[_0x279a('0x34')][_0x279a('0x22')]);_0x42ef46['offset']=qs[_0x279a('0x21')](_0x4782d8[_0x279a('0x34')][_0x279a('0x21')]);}_0x42ef46['order']=qs[_0x279a('0x3b')](_0x4782d8[_0x279a('0x34')]['sort']);_0x42ef46[_0x279a('0x3c')]=qs[_0x279a('0x35')](_[_0x279a('0x3d')](_0x4782d8['query'],_0x23a91b[_0x279a('0x35')]),_0x4e1975);if(_0x4782d8[_0x279a('0x34')][_0x279a('0x3e')]){_0x42ef46[_0x279a('0x3c')]=_['merge'](_0x42ef46[_0x279a('0x3c')],{'$or':_[_0x279a('0x2d')](_0x4e1975,function(_0x3f3b40){if(_0x3f3b40[_0x279a('0x31')]!==_0x279a('0x3f')){var _0x4e2e8b={};_0x4e2e8b[_0x3f3b40[_0x279a('0x2b')]]={'$like':'%'+_0x4782d8[_0x279a('0x34')][_0x279a('0x3e')]+'%'};return _0x4e2e8b;}})});}_0x42ef46=_[_0x279a('0x40')]({},_0x42ef46,_0x4782d8[_0x279a('0x41')]);var _0x4dc980={'where':_0x42ef46[_0x279a('0x3c')]};return db[_0x279a('0x2e')][_0x279a('0x20')](_0x4dc980)[_0x279a('0x28')](function(_0x337008){_0x1cd750[_0x279a('0x20')]=_0x337008;if(_0x4782d8[_0x279a('0x34')][_0x279a('0x42')]){_0x42ef46[_0x279a('0x43')]=[{'all':!![]}];}return db['ZohoAccount'][_0x279a('0x44')](_0x42ef46);})[_0x279a('0x28')](function(_0x514ba9){_0x1cd750[_0x279a('0x45')]=_0x514ba9;return _0x1cd750;})[_0x279a('0x28')](respondWithFilteredResult(_0x3deeae,_0x42ef46))[_0x279a('0x46')](handleError(_0x3deeae,null));};exports[_0x279a('0x47')]=function(_0x4b2b17,_0x387624){var _0x3e3dff={'raw':![],'where':{'id':_0x4b2b17['params']['id']}},_0x1221e2={};_0x1221e2[_0x279a('0x33')]=_['keys'](db[_0x279a('0x2e')]['rawAttributes']);_0x1221e2['query']=_[_0x279a('0x48')](_0x4b2b17[_0x279a('0x34')]);_0x1221e2['filters']=_[_0x279a('0x36')](_0x1221e2[_0x279a('0x33')],_0x1221e2[_0x279a('0x34')]);_0x3e3dff['attributes']=_[_0x279a('0x36')](_0x1221e2['model'],qs[_0x279a('0x38')](_0x4b2b17[_0x279a('0x34')][_0x279a('0x38')]));_0x3e3dff[_0x279a('0x37')]=_0x3e3dff[_0x279a('0x37')][_0x279a('0x39')]?_0x3e3dff[_0x279a('0x37')]:_0x1221e2[_0x279a('0x33')];if(_0x4b2b17['query'][_0x279a('0x42')]){_0x3e3dff[_0x279a('0x43')]=[{'all':!![]}];}_0x3e3dff=_['merge']({},_0x3e3dff,_0x4b2b17[_0x279a('0x41')]);return db[_0x279a('0x2e')]['find'](_0x3e3dff)['then'](handleEntityNotFound(_0x387624,null))[_0x279a('0x28')](respondWithResult(_0x387624,null))[_0x279a('0x46')](handleError(_0x387624,null));};exports[_0x279a('0x49')]=function(_0x210297,_0x11beb8){return db[_0x279a('0x2e')]['create'](_0x210297[_0x279a('0x4a')],{})['then'](respondWithResult(_0x11beb8,0xc9))[_0x279a('0x46')](handleError(_0x11beb8,null));};exports[_0x279a('0x27')]=function(_0x38463,_0x424db0){if(_0x38463[_0x279a('0x4a')]['id']){delete _0x38463[_0x279a('0x4a')]['id'];}return db['ZohoAccount'][_0x279a('0x4b')]({'where':{'id':_0x38463[_0x279a('0x4c')]['id']}})[_0x279a('0x28')](handleEntityNotFound(_0x424db0,null))[_0x279a('0x28')](saveUpdates(_0x38463['body'],null))[_0x279a('0x28')](respondWithResult(_0x424db0,null))[_0x279a('0x46')](handleError(_0x424db0,null));};exports[_0x279a('0x29')]=function(_0x504f58,_0x10d876){return db[_0x279a('0x2e')]['find']({'where':{'id':_0x504f58[_0x279a('0x4c')]['id']}})[_0x279a('0x28')](handleEntityNotFound(_0x10d876,null))[_0x279a('0x28')](removeEntity(_0x10d876,null))['catch'](handleError(_0x10d876,null));};exports[_0x279a('0x4d')]=function(_0x43e7b0,_0x301c46,_0x357453){var _0xfbc90={};var _0x5832fd={};var _0x25a433;var _0x2725f;return db[_0x279a('0x2e')][_0x279a('0x4e')]({'where':{'id':_0x43e7b0[_0x279a('0x4c')]['id']}})[_0x279a('0x28')](handleEntityNotFound(_0x301c46,null))[_0x279a('0x28')](function(_0x339782){if(_0x339782){_0x25a433=_0x339782;_0x5832fd[_0x279a('0x33')]=_[_0x279a('0x48')](db['ZohoConfiguration'][_0x279a('0x2f')]);_0x5832fd[_0x279a('0x34')]=_[_0x279a('0x48')](_0x43e7b0[_0x279a('0x34')]);_0x5832fd[_0x279a('0x35')]=_[_0x279a('0x36')](_0x5832fd[_0x279a('0x33')],_0x5832fd[_0x279a('0x34')]);_0xfbc90[_0x279a('0x37')]=_[_0x279a('0x36')](_0x5832fd[_0x279a('0x33')],qs[_0x279a('0x38')](_0x43e7b0['query'][_0x279a('0x38')]));_0xfbc90['attributes']=_0xfbc90['attributes'][_0x279a('0x39')]?_0xfbc90[_0x279a('0x37')]:_0x5832fd[_0x279a('0x33')];_0xfbc90[_0x279a('0x4f')]=qs[_0x279a('0x3b')](_0x43e7b0['query']['sort']);_0xfbc90[_0x279a('0x3c')]=qs['filters'](_[_0x279a('0x3d')](_0x43e7b0[_0x279a('0x34')],_0x5832fd[_0x279a('0x35')]));if(_0x43e7b0['query'][_0x279a('0x3e')]){_0xfbc90[_0x279a('0x3c')]=_[_0x279a('0x40')](_0xfbc90[_0x279a('0x3c')],{'$or':_[_0x279a('0x2d')](_0xfbc90[_0x279a('0x37')],function(_0x52838a){var _0x1731b1={};_0x1731b1[_0x52838a]={'$like':'%'+_0x43e7b0[_0x279a('0x34')][_0x279a('0x3e')]+'%'};return _0x1731b1;})});}_0xfbc90=_['merge']({},_0xfbc90,_0x43e7b0['options']);return _0x25a433[_0x279a('0x4d')](_0xfbc90);}})[_0x279a('0x28')](function(_0x2ca318){if(_0x2ca318){_0x2725f=_0x2ca318[_0x279a('0x39')];if(!_0x43e7b0[_0x279a('0x34')][_0x279a('0x50')](_0x279a('0x3a'))){_0xfbc90[_0x279a('0x22')]=qs[_0x279a('0x22')](_0x43e7b0['query']['limit']);_0xfbc90[_0x279a('0x21')]=qs[_0x279a('0x21')](_0x43e7b0[_0x279a('0x34')]['offset']);}return _0x25a433[_0x279a('0x4d')](_0xfbc90);}})['then'](function(_0x1288a7){if(_0x1288a7){return _0x1288a7?{'count':_0x2725f,'rows':_0x1288a7}:null;}})[_0x279a('0x28')](respondWithResult(_0x301c46,null))[_0x279a('0x46')](handleError(_0x301c46,null));};exports[_0x279a('0x51')]=function(_0x203a13,_0x195c66,_0x1dd48f){if(_0x203a13['body']['id']){delete _0x203a13[_0x279a('0x4a')]['id'];}return db[_0x279a('0x2e')][_0x279a('0x4e')]({'where':{'id':_0x203a13[_0x279a('0x4c')]['id']}})['then'](handleEntityNotFound(_0x195c66,null))[_0x279a('0x28')](function(_0x4f6755){if(_0x4f6755){_0x203a13[_0x279a('0x4a')]['AccountId']=_0x4f6755['id'];_0x203a13[_0x279a('0x4a')]['Subjects']=integrations['getSubjects'](_0x203a13[_0x279a('0x4a')][_0x279a('0x52')],_0x203a13[_0x279a('0x4a')][_0x279a('0x31')]);_0x203a13[_0x279a('0x4a')]['Descriptions']=integrations[_0x279a('0x53')](_0x203a13[_0x279a('0x4a')]['channel'],_0x203a13['body'][_0x279a('0x31')]);return db[_0x279a('0x54')][_0x279a('0x49')](_0x203a13[_0x279a('0x4a')],{'include':[{'model':db[_0x279a('0x55')],'as':_0x279a('0x56')},{'model':db[_0x279a('0x55')],'as':_0x279a('0x57')}]});}return null;})[_0x279a('0x28')](respondWithResult(_0x195c66,null))[_0x279a('0x46')](handleError(_0x195c66,null));};function getAccessToken(_0x528cc7){return new Promise(function(_0x550740,_0x27a8f0){var _0x22d561;switch(_0x528cc7[_0x279a('0x58')]){case'US':_0x22d561=_0x279a('0x59');break;case'AU':_0x22d561=_0x279a('0x5a');break;case'EU':_0x22d561=_0x279a('0x5b');break;case'IN':_0x22d561=_0x279a('0x5c');break;case'CN':_0x22d561='https://accounts.zoho.com.cn';break;default:_0x22d561=_0x279a('0x5b');break;}var _0x16617d={'method':_0x279a('0x5d'),'uri':_0x22d561+_0x279a('0x5e'),'qs':{'refresh_token':_0x528cc7[_0x279a('0x5f')],'client_id':_0x528cc7[_0x279a('0x60')],'client_secret':_0x528cc7[_0x279a('0x61')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x16617d)[_0x279a('0x28')](function(_0x52f462){if(_0x52f462[_0x279a('0x62')]){_0x550740(_0x52f462[_0x279a('0x62')]);}else{_0x27a8f0(_0x279a('0x63'));}})[_0x279a('0x46')](function(_0xc46608){_0x27a8f0(_0xc46608);});});}exports[_0x279a('0x64')]=function(_0x1ba669,_0x5653cd,_0x375490){var _0x5479bf,_0x116ed6,_0x2b86a7,_0x5b82f0,_0x345f3c;return db['ZohoAccount'][_0x279a('0x4e')]({'where':{'id':_0x1ba669['params']['id']},'attributes':['id',_0x279a('0x65'),'zone',_0x279a('0x60'),_0x279a('0x61'),_0x279a('0x66'),'code',_0x279a('0x5f')]})['then'](handleEntityNotFound(_0x5653cd,null))[_0x279a('0x28')](function(_0x43bf2e){_0x345f3c=_0x43bf2e;_0x5479bf=_0x345f3c['host'];_0x116ed6=_0x5479bf===_0x279a('0x67')?'eu':_0x279a('0x68');_0x2b86a7=_0x345f3c[_0x279a('0x66')];var _0xc11674=_0x2b86a7[_0x279a('0x69')](-0x1);if(_0xc11674==='/'||_0xc11674==='\x5c'||_0xc11674===':'){_0x2b86a7=_0x2b86a7[_0x279a('0x6a')](0x0,_0x2b86a7[_0x279a('0x6b')](_0xc11674));}if(!_0x345f3c[_0x279a('0x5f')]){throw new Error(_0x279a('0x6c'));}return getAccessToken(_0x345f3c);})[_0x279a('0x28')](function(_0x480fdf){if(_0x480fdf){return rp({'method':_0x279a('0x6d'),'uri':util['format'](_0x279a('0x6e'),_0x116ed6),'qs':{'module':_0x279a('0x6f')},'headers':{'Authorization':_0x279a('0x70')+_0x480fdf},'json':!![]});}})[_0x279a('0x28')](function(_0x786335){if(_0x786335){if(_0x786335[_0x279a('0x71')]&&_0x786335[_0x279a('0x71')][_0x279a('0x72')]){throw new Error(_0x786335['response'][_0x279a('0x72')][_0x279a('0x73')]);}var _0x1e7936=[];var _0xff581f=[];var _0x453192=[_0x279a('0x74'),_0x279a('0x75'),_0x279a('0x76'),_0x279a('0x77'),_0x279a('0x78'),_0x279a('0x79'),_0x279a('0x7a'),_0x279a('0x7b')];_0xff581f=_['remove'](_0x786335[_0x279a('0x38')],function(_0x28ddd9){return _0x453192[_0x279a('0x7c')](_0x28ddd9[_0x279a('0x7d')]);});for(var _0x549e2c=0x0;_0x549e2c<_0xff581f[_0x279a('0x39')];_0x549e2c++){if(_0xff581f[_0x549e2c][_0x279a('0x7e')]===![]){_0x1e7936[_0x279a('0x7f')]({'id':_0xff581f[_0x549e2c]['id'],'name':_0xff581f[_0x549e2c][_0x279a('0x80')],'custom':_0xff581f[_0x549e2c][_0x279a('0x81')],'options':_0xff581f[_0x549e2c][_0x279a('0x82')]===_0x279a('0x83')&&_0xff581f[_0x549e2c][_0x279a('0x84')][_0x279a('0x39')]>-0x1?_[_0x279a('0x2d')](_0xff581f[_0x549e2c]['pick_list_values'],function(_0x54c426){return{'name':_0x54c426,'value':_0x54c426};}):[]});}}return{'count':_0x1e7936[_0x279a('0x39')],'rows':_0x1e7936};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x5653cd,null))['catch'](function(_0x3a357b){var _0x493461=_0x1ba669[_0x279a('0x34')][_0x279a('0x85')]?0x1f4:_0x3a357b[_0x279a('0x86')]||0x1f4;logger['error'](_0x279a('0x87'),_0x279a('0x64'),_0x493461,JSON[_0x279a('0x88')](_0x3a357b));delete _0x3a357b[_0x279a('0x2b')];if(_0x493461===0x191){_0x493461=0x190;}_0x5653cd['status'](_0x493461)[_0x279a('0x2c')](_0x1ba669[_0x279a('0x34')][_0x279a('0x85')]?{'message':'Wrong\x20credentials','statusCode':_0x3a357b[_0x279a('0x86')]}:_0x3a357b);});}; \ No newline at end of file +var _0xf9aa=['Subjects','getSubjects','channel','getDescriptions','ZohoConfiguration','ZohoField','Descriptions','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','clientId','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','code','zoho.eu','substring','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Owner','Subject','WhoId','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','save','then','destroy','sendStatus','error','stack','name','send','index','map','ZohoAccount','rawAttributes','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','order','sort','filters','pick','where','merge','includeAll','rows','catch','params','options','create','body','update','find','filter','getConfigurations','hasOwnProperty','addConfiguration','findOne','AccountId'];(function(_0x46ec8a,_0x5509d3){var _0xe110ba=function(_0x54b5b8){while(--_0x54b5b8){_0x46ec8a['push'](_0x46ec8a['shift']());}};_0xe110ba(++_0x5509d3);}(_0xf9aa,0x1ad));var _0xaf9a=function(_0x45bd84,_0x4a61bb){_0x45bd84=_0x45bd84-0x0;var _0x551b62=_0xf9aa[_0x45bd84];return _0x551b62;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaf9a('0x0'));var zipdir=require(_0xaf9a('0x1'));var jsonpatch=require(_0xaf9a('0x2'));var rp=require(_0xaf9a('0x3'));var moment=require(_0xaf9a('0x4'));var BPromise=require(_0xaf9a('0x5'));var Mustache=require(_0xaf9a('0x6'));var util=require(_0xaf9a('0x7'));var path=require(_0xaf9a('0x8'));var sox=require('sox');var csv=require(_0xaf9a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaf9a('0xa'));var squel=require(_0xaf9a('0xb'));var crypto=require(_0xaf9a('0xc'));var jsforce=require(_0xaf9a('0xd'));var deskjs=require(_0xaf9a('0xe'));var toCsv=require(_0xaf9a('0x9'));var querystring=require(_0xaf9a('0xf'));var Papa=require(_0xaf9a('0x10'));var Redis=require('ioredis');var authService=require(_0xaf9a('0x11'));var qs=require(_0xaf9a('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaf9a('0x13'));var logger=require(_0xaf9a('0x14'))(_0xaf9a('0x15'));var utils=require('../../config/utils');var config=require(_0xaf9a('0x16'));var licenseUtil=require(_0xaf9a('0x17'));var db=require(_0xaf9a('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1d3fd8,_0x1e1808){_0x1e1808=_0x1e1808||0xcc;return function(_0x51cb37){if(_0x51cb37){return _0x1d3fd8['sendStatus'](_0x1e1808);}return _0x1d3fd8[_0xaf9a('0x19')](_0x1e1808)[_0xaf9a('0x1a')]();};}function respondWithResult(_0x3db5a4,_0x40a278){_0x40a278=_0x40a278||0xc8;return function(_0x17f8dc){if(_0x17f8dc){return _0x3db5a4['status'](_0x40a278)[_0xaf9a('0x1b')](_0x17f8dc);}};}function respondWithFilteredResult(_0x1f4d77,_0x30f2bf){return function(_0x43e3b7){if(_0x43e3b7){var _0x5a23b8=typeof _0x30f2bf['offset']===_0xaf9a('0x1c')&&typeof _0x30f2bf[_0xaf9a('0x1d')]===_0xaf9a('0x1c');var _0x4414df=_0x43e3b7[_0xaf9a('0x1e')];var _0x25a1b3=_0x5a23b8?0x0:_0x30f2bf['offset'];var _0x57487f=_0x5a23b8?_0x43e3b7[_0xaf9a('0x1e')]:_0x30f2bf[_0xaf9a('0x1f')]+_0x30f2bf[_0xaf9a('0x1d')];var _0x91ccc2;if(_0x57487f>=_0x4414df){_0x57487f=_0x4414df;_0x91ccc2=0xc8;}else{_0x91ccc2=0xce;}_0x1f4d77[_0xaf9a('0x19')](_0x91ccc2);return _0x1f4d77['set']('Content-Range',_0x25a1b3+'-'+_0x57487f+'/'+_0x4414df)['json'](_0x43e3b7);}return null;};}function patchUpdates(_0x259060){return function(_0x58ec4c){try{jsonpatch['apply'](_0x58ec4c,_0x259060,!![]);}catch(_0x54bc39){return BPromise['reject'](_0x54bc39);}return _0x58ec4c[_0xaf9a('0x20')]();};}function saveUpdates(_0x30826e,_0x40ade6){return function(_0x547d22){if(_0x547d22){return _0x547d22['update'](_0x30826e)[_0xaf9a('0x21')](function(_0x5f57cf){return _0x5f57cf;});}return null;};}function removeEntity(_0x2eb790,_0x5a1f80){return function(_0x2ad3a7){if(_0x2ad3a7){return _0x2ad3a7[_0xaf9a('0x22')]()[_0xaf9a('0x21')](function(){_0x2eb790[_0xaf9a('0x19')](0xcc)[_0xaf9a('0x1a')]();});}};}function handleEntityNotFound(_0x56940a,_0x58cc88){return function(_0x52f191){if(!_0x52f191){_0x56940a[_0xaf9a('0x23')](0x194);}return _0x52f191;};}function handleError(_0x5a81d5,_0x403c72){_0x403c72=_0x403c72||0x1f4;return function(_0x42e7e6){logger[_0xaf9a('0x24')](_0x42e7e6[_0xaf9a('0x25')]);if(_0x42e7e6['name']){delete _0x42e7e6[_0xaf9a('0x26')];}_0x5a81d5['status'](_0x403c72)[_0xaf9a('0x27')](_0x42e7e6);};}exports[_0xaf9a('0x28')]=function(_0x389a2e,_0x483376){var _0xf58df5={},_0x189eaa={},_0x37c1f6={'count':0x0,'rows':[]};var _0x45df4c=_[_0xaf9a('0x29')](db[_0xaf9a('0x2a')][_0xaf9a('0x2b')],function(_0x788f78){return{'name':_0x788f78['fieldName'],'type':_0x788f78[_0xaf9a('0x2c')][_0xaf9a('0x2d')]};});_0x189eaa[_0xaf9a('0x2e')]=_[_0xaf9a('0x29')](_0x45df4c,_0xaf9a('0x26'));_0x189eaa[_0xaf9a('0x2f')]=_[_0xaf9a('0x30')](_0x389a2e[_0xaf9a('0x2f')]);_0x189eaa['filters']=_['intersection'](_0x189eaa['model'],_0x189eaa[_0xaf9a('0x2f')]);_0xf58df5[_0xaf9a('0x31')]=_[_0xaf9a('0x32')](_0x189eaa[_0xaf9a('0x2e')],qs[_0xaf9a('0x33')](_0x389a2e['query'][_0xaf9a('0x33')]));_0xf58df5[_0xaf9a('0x31')]=_0xf58df5[_0xaf9a('0x31')][_0xaf9a('0x34')]?_0xf58df5[_0xaf9a('0x31')]:_0x189eaa[_0xaf9a('0x2e')];if(!_0x389a2e[_0xaf9a('0x2f')]['hasOwnProperty'](_0xaf9a('0x35'))){_0xf58df5[_0xaf9a('0x1d')]=qs[_0xaf9a('0x1d')](_0x389a2e[_0xaf9a('0x2f')]['limit']);_0xf58df5[_0xaf9a('0x1f')]=qs[_0xaf9a('0x1f')](_0x389a2e[_0xaf9a('0x2f')]['offset']);}_0xf58df5[_0xaf9a('0x36')]=qs['sort'](_0x389a2e[_0xaf9a('0x2f')][_0xaf9a('0x37')]);_0xf58df5['where']=qs[_0xaf9a('0x38')](_[_0xaf9a('0x39')](_0x389a2e[_0xaf9a('0x2f')],_0x189eaa[_0xaf9a('0x38')]),_0x45df4c);if(_0x389a2e[_0xaf9a('0x2f')]['filter']){_0xf58df5[_0xaf9a('0x3a')]=_[_0xaf9a('0x3b')](_0xf58df5[_0xaf9a('0x3a')],{'$or':_[_0xaf9a('0x29')](_0x45df4c,function(_0x2ec8ab){if(_0x2ec8ab[_0xaf9a('0x2c')]!=='VIRTUAL'){var _0x1f28ec={};_0x1f28ec[_0x2ec8ab[_0xaf9a('0x26')]]={'$like':'%'+_0x389a2e[_0xaf9a('0x2f')]['filter']+'%'};return _0x1f28ec;}})});}_0xf58df5=_['merge']({},_0xf58df5,_0x389a2e['options']);var _0x5867b6={'where':_0xf58df5['where']};return db[_0xaf9a('0x2a')][_0xaf9a('0x1e')](_0x5867b6)[_0xaf9a('0x21')](function(_0x27e6d8){_0x37c1f6[_0xaf9a('0x1e')]=_0x27e6d8;if(_0x389a2e[_0xaf9a('0x2f')][_0xaf9a('0x3c')]){_0xf58df5['include']=[{'all':!![]}];}return db[_0xaf9a('0x2a')]['findAll'](_0xf58df5);})[_0xaf9a('0x21')](function(_0xa5db3a){_0x37c1f6[_0xaf9a('0x3d')]=_0xa5db3a;return _0x37c1f6;})[_0xaf9a('0x21')](respondWithFilteredResult(_0x483376,_0xf58df5))[_0xaf9a('0x3e')](handleError(_0x483376,null));};exports['show']=function(_0x32a757,_0x643703){var _0x2412ab={'raw':![],'where':{'id':_0x32a757[_0xaf9a('0x3f')]['id']}},_0x4d1d3d={};_0x4d1d3d[_0xaf9a('0x2e')]=_[_0xaf9a('0x30')](db[_0xaf9a('0x2a')]['rawAttributes']);_0x4d1d3d[_0xaf9a('0x2f')]=_[_0xaf9a('0x30')](_0x32a757[_0xaf9a('0x2f')]);_0x4d1d3d[_0xaf9a('0x38')]=_[_0xaf9a('0x32')](_0x4d1d3d['model'],_0x4d1d3d[_0xaf9a('0x2f')]);_0x2412ab[_0xaf9a('0x31')]=_['intersection'](_0x4d1d3d[_0xaf9a('0x2e')],qs[_0xaf9a('0x33')](_0x32a757[_0xaf9a('0x2f')][_0xaf9a('0x33')]));_0x2412ab['attributes']=_0x2412ab['attributes'][_0xaf9a('0x34')]?_0x2412ab[_0xaf9a('0x31')]:_0x4d1d3d[_0xaf9a('0x2e')];if(_0x32a757['query'][_0xaf9a('0x3c')]){_0x2412ab['include']=[{'all':!![]}];}_0x2412ab=_[_0xaf9a('0x3b')]({},_0x2412ab,_0x32a757[_0xaf9a('0x40')]);return db[_0xaf9a('0x2a')]['find'](_0x2412ab)[_0xaf9a('0x21')](handleEntityNotFound(_0x643703,null))[_0xaf9a('0x21')](respondWithResult(_0x643703,null))[_0xaf9a('0x3e')](handleError(_0x643703,null));};exports[_0xaf9a('0x41')]=function(_0x9efd3f,_0x361610){return db[_0xaf9a('0x2a')][_0xaf9a('0x41')](_0x9efd3f[_0xaf9a('0x42')],{})[_0xaf9a('0x21')](respondWithResult(_0x361610,0xc9))[_0xaf9a('0x3e')](handleError(_0x361610,null));};exports[_0xaf9a('0x43')]=function(_0x2314b9,_0x40478f){if(_0x2314b9['body']['id']){delete _0x2314b9[_0xaf9a('0x42')]['id'];}return db[_0xaf9a('0x2a')][_0xaf9a('0x44')]({'where':{'id':_0x2314b9[_0xaf9a('0x3f')]['id']}})[_0xaf9a('0x21')](handleEntityNotFound(_0x40478f,null))[_0xaf9a('0x21')](saveUpdates(_0x2314b9[_0xaf9a('0x42')],null))[_0xaf9a('0x21')](respondWithResult(_0x40478f,null))['catch'](handleError(_0x40478f,null));};exports[_0xaf9a('0x22')]=function(_0x30f059,_0x8cd213){return db['ZohoAccount'][_0xaf9a('0x44')]({'where':{'id':_0x30f059[_0xaf9a('0x3f')]['id']}})[_0xaf9a('0x21')](handleEntityNotFound(_0x8cd213,null))[_0xaf9a('0x21')](removeEntity(_0x8cd213,null))[_0xaf9a('0x3e')](handleError(_0x8cd213,null));};exports['getConfigurations']=function(_0x264874,_0x5f3a6c,_0x5b0e0c){var _0x5b277c={};var _0x4e713a={};var _0x5b62d7;var _0x27295d;return db[_0xaf9a('0x2a')]['findOne']({'where':{'id':_0x264874[_0xaf9a('0x3f')]['id']}})[_0xaf9a('0x21')](handleEntityNotFound(_0x5f3a6c,null))[_0xaf9a('0x21')](function(_0x5af98d){if(_0x5af98d){_0x5b62d7=_0x5af98d;_0x4e713a[_0xaf9a('0x2e')]=_[_0xaf9a('0x30')](db['ZohoConfiguration']['rawAttributes']);_0x4e713a[_0xaf9a('0x2f')]=_[_0xaf9a('0x30')](_0x264874[_0xaf9a('0x2f')]);_0x4e713a[_0xaf9a('0x38')]=_[_0xaf9a('0x32')](_0x4e713a[_0xaf9a('0x2e')],_0x4e713a['query']);_0x5b277c[_0xaf9a('0x31')]=_[_0xaf9a('0x32')](_0x4e713a[_0xaf9a('0x2e')],qs[_0xaf9a('0x33')](_0x264874[_0xaf9a('0x2f')]['fields']));_0x5b277c[_0xaf9a('0x31')]=_0x5b277c[_0xaf9a('0x31')][_0xaf9a('0x34')]?_0x5b277c[_0xaf9a('0x31')]:_0x4e713a['model'];_0x5b277c[_0xaf9a('0x36')]=qs[_0xaf9a('0x37')](_0x264874[_0xaf9a('0x2f')]['sort']);_0x5b277c['where']=qs[_0xaf9a('0x38')](_[_0xaf9a('0x39')](_0x264874[_0xaf9a('0x2f')],_0x4e713a['filters']));if(_0x264874[_0xaf9a('0x2f')][_0xaf9a('0x45')]){_0x5b277c['where']=_[_0xaf9a('0x3b')](_0x5b277c[_0xaf9a('0x3a')],{'$or':_[_0xaf9a('0x29')](_0x5b277c[_0xaf9a('0x31')],function(_0x52360a){var _0x49898a={};_0x49898a[_0x52360a]={'$like':'%'+_0x264874[_0xaf9a('0x2f')][_0xaf9a('0x45')]+'%'};return _0x49898a;})});}_0x5b277c=_[_0xaf9a('0x3b')]({},_0x5b277c,_0x264874[_0xaf9a('0x40')]);return _0x5b62d7[_0xaf9a('0x46')](_0x5b277c);}})[_0xaf9a('0x21')](function(_0x1f038c){if(_0x1f038c){_0x27295d=_0x1f038c['length'];if(!_0x264874[_0xaf9a('0x2f')][_0xaf9a('0x47')](_0xaf9a('0x35'))){_0x5b277c[_0xaf9a('0x1d')]=qs[_0xaf9a('0x1d')](_0x264874[_0xaf9a('0x2f')][_0xaf9a('0x1d')]);_0x5b277c[_0xaf9a('0x1f')]=qs[_0xaf9a('0x1f')](_0x264874[_0xaf9a('0x2f')]['offset']);}return _0x5b62d7[_0xaf9a('0x46')](_0x5b277c);}})['then'](function(_0x4656a6){if(_0x4656a6){return _0x4656a6?{'count':_0x27295d,'rows':_0x4656a6}:null;}})[_0xaf9a('0x21')](respondWithResult(_0x5f3a6c,null))[_0xaf9a('0x3e')](handleError(_0x5f3a6c,null));};exports[_0xaf9a('0x48')]=function(_0x272b70,_0x20d8fd,_0x305d14){if(_0x272b70[_0xaf9a('0x42')]['id']){delete _0x272b70[_0xaf9a('0x42')]['id'];}return db[_0xaf9a('0x2a')][_0xaf9a('0x49')]({'where':{'id':_0x272b70[_0xaf9a('0x3f')]['id']}})[_0xaf9a('0x21')](handleEntityNotFound(_0x20d8fd,null))['then'](function(_0x334bbe){if(_0x334bbe){_0x272b70[_0xaf9a('0x42')][_0xaf9a('0x4a')]=_0x334bbe['id'];_0x272b70[_0xaf9a('0x42')][_0xaf9a('0x4b')]=integrations[_0xaf9a('0x4c')](_0x272b70[_0xaf9a('0x42')][_0xaf9a('0x4d')],_0x272b70['body'][_0xaf9a('0x2c')]);_0x272b70[_0xaf9a('0x42')]['Descriptions']=integrations[_0xaf9a('0x4e')](_0x272b70[_0xaf9a('0x42')]['channel'],_0x272b70[_0xaf9a('0x42')][_0xaf9a('0x2c')]);return db[_0xaf9a('0x4f')][_0xaf9a('0x41')](_0x272b70['body'],{'include':[{'model':db['ZohoField'],'as':_0xaf9a('0x4b')},{'model':db[_0xaf9a('0x50')],'as':_0xaf9a('0x51')}]});}return null;})['then'](respondWithResult(_0x20d8fd,null))[_0xaf9a('0x3e')](handleError(_0x20d8fd,null));};function getAccessToken(_0x24b651){return new Promise(function(_0x48e58e,_0x34023e){var _0x5d66dc;switch(_0x24b651[_0xaf9a('0x52')]){case'US':_0x5d66dc=_0xaf9a('0x53');break;case'AU':_0x5d66dc='https://accounts.zoho.com.au';break;case'EU':_0x5d66dc=_0xaf9a('0x54');break;case'IN':_0x5d66dc='https://accounts.zoho.in';break;case'CN':_0x5d66dc=_0xaf9a('0x55');break;default:_0x5d66dc=_0xaf9a('0x54');break;}var _0x35927a={'method':'POST','uri':_0x5d66dc+_0xaf9a('0x56'),'qs':{'refresh_token':_0x24b651[_0xaf9a('0x57')],'client_id':_0x24b651[_0xaf9a('0x58')],'client_secret':_0x24b651['clientSecret'],'grant_type':_0xaf9a('0x59')},'json':!![]};return rp(_0x35927a)[_0xaf9a('0x21')](function(_0x2bd361){if(_0x2bd361[_0xaf9a('0x5a')]){_0x48e58e(_0x2bd361[_0xaf9a('0x5a')]);}else{_0x34023e(_0xaf9a('0x5b'));}})[_0xaf9a('0x3e')](function(_0x523022){_0x34023e(_0x523022);});});}exports[_0xaf9a('0x5c')]=function(_0x40fd78,_0x2a9c48,_0x31d140){var _0x5a9d41,_0x250d3b,_0x2d4ff5,_0x411ee8,_0x411e02;return db[_0xaf9a('0x2a')]['findOne']({'where':{'id':_0x40fd78['params']['id']},'attributes':['id',_0xaf9a('0x5d'),_0xaf9a('0x52'),'clientId','clientSecret',_0xaf9a('0x5e'),_0xaf9a('0x5f'),_0xaf9a('0x57')]})[_0xaf9a('0x21')](handleEntityNotFound(_0x2a9c48,null))[_0xaf9a('0x21')](function(_0x1bd002){_0x411e02=_0x1bd002;_0x5a9d41=_0x411e02[_0xaf9a('0x5d')];_0x250d3b=_0x5a9d41===_0xaf9a('0x60')?'eu':'com';_0x2d4ff5=_0x411e02['serverUrl'];var _0x5180df=_0x2d4ff5['slice'](-0x1);if(_0x5180df==='/'||_0x5180df==='\x5c'||_0x5180df===':'){_0x2d4ff5=_0x2d4ff5[_0xaf9a('0x61')](0x0,_0x2d4ff5['lastIndexOf'](_0x5180df));}if(!_0x411e02['refreshToken']){throw new Error(_0xaf9a('0x62'));}return getAccessToken(_0x411e02);})['then'](function(_0x1bec41){if(_0x1bec41){return rp({'method':_0xaf9a('0x63'),'uri':util[_0xaf9a('0x64')](_0xaf9a('0x65'),_0x250d3b),'qs':{'module':_0xaf9a('0x66')},'headers':{'Authorization':_0xaf9a('0x67')+_0x1bec41},'json':!![]});}})[_0xaf9a('0x21')](function(_0x494a6d){if(_0x494a6d){if(_0x494a6d[_0xaf9a('0x68')]&&_0x494a6d[_0xaf9a('0x68')][_0xaf9a('0x24')]){throw new Error(_0x494a6d['response'][_0xaf9a('0x24')][_0xaf9a('0x69')]);}var _0x2f8cbf=[];var _0x202b72=[];var _0x5e5d7e=[_0xaf9a('0x6a'),_0xaf9a('0x6b'),'Description',_0xaf9a('0x6c'),'Call_Duration','Call_Result',_0xaf9a('0x6d'),_0xaf9a('0x6e')];_0x202b72=_[_0xaf9a('0x6f')](_0x494a6d[_0xaf9a('0x33')],function(_0x5c92e2){return _0x5e5d7e[_0xaf9a('0x70')](_0x5c92e2[_0xaf9a('0x71')]);});for(var _0x27f2b9=0x0;_0x27f2b9<_0x202b72[_0xaf9a('0x34')];_0x27f2b9++){if(_0x202b72[_0x27f2b9][_0xaf9a('0x72')]===![]){_0x2f8cbf[_0xaf9a('0x73')]({'id':_0x202b72[_0x27f2b9]['id'],'name':_0x202b72[_0x27f2b9][_0xaf9a('0x74')],'custom':_0x202b72[_0x27f2b9][_0xaf9a('0x75')],'options':_0x202b72[_0x27f2b9][_0xaf9a('0x76')]===_0xaf9a('0x77')&&_0x202b72[_0x27f2b9]['pick_list_values'][_0xaf9a('0x34')]>-0x1?_['map'](_0x202b72[_0x27f2b9][_0xaf9a('0x78')],function(_0x4838cb){return{'name':_0x4838cb,'value':_0x4838cb};}):[]});}}return{'count':_0x2f8cbf[_0xaf9a('0x34')],'rows':_0x2f8cbf};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x2a9c48,null))[_0xaf9a('0x3e')](function(_0x13404c){var _0x3a8978=_0x40fd78[_0xaf9a('0x2f')][_0xaf9a('0x79')]?0x1f4:_0x13404c[_0xaf9a('0x7a')]||0x1f4;logger[_0xaf9a('0x24')](_0xaf9a('0x7b'),'getFields',_0x3a8978,JSON[_0xaf9a('0x7c')](_0x13404c));delete _0x13404c[_0xaf9a('0x26')];if(_0x3a8978===0x191){_0x3a8978=0x190;}_0x2a9c48['status'](_0x3a8978)[_0xaf9a('0x27')](_0x40fd78[_0xaf9a('0x2f')][_0xaf9a('0x79')]?{'message':_0xaf9a('0x7d'),'statusCode':_0x13404c[_0xaf9a('0x7a')]}:_0x13404c);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index bd58071..d46a2dc 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 _0x89cf=['application/x-www-form-urlencoded','then','parse','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','https://accounts.zoho.com','https://accounts.zoho.com.cn','name','lodash','util','moment','bluebird','path','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','changed','zone','serverUrl','code','host','slice','substring','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','/oauth/v2/token','authorization_code','clientId','clientSecret'];(function(_0x4b66ae,_0x367707){var _0x3bb455=function(_0x40958e){while(--_0x40958e){_0x4b66ae['push'](_0x4b66ae['shift']());}};_0x3bb455(++_0x367707);}(_0x89cf,0x19e));var _0xf89c=function(_0x10714c,_0x169b40){_0x10714c=_0x10714c-0x0;var _0x3c0491=_0x89cf[_0x10714c];return _0x3c0491;};'use strict';var _=require(_0xf89c('0x0'));var util=require(_0xf89c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf89c('0x2'));var BPromise=require(_0xf89c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf89c('0x4'));var rimraf=require('rimraf');var config=require(_0xf89c('0x5'));var attributes=require(_0xf89c('0x6'));var integrations=require(_0xf89c('0x7'));module[_0xf89c('0x8')]=function(_0x8b4652,_0x4f0657){return _0x8b4652[_0xf89c('0x9')](_0xf89c('0xa'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x48e10b,_0x4e4444,_0x46bb91){if(_0x48e10b[_0xf89c('0xb')](_0xf89c('0xc'))||_0x48e10b[_0xf89c('0xb')](_0xf89c('0xd'))||_0x48e10b[_0xf89c('0xb')]('clientId')||_0x48e10b['changed']('clientSecret')||_0x48e10b['changed'](_0xf89c('0xe'))||_0x48e10b[_0xf89c('0xb')](_0xf89c('0xf'))){var _0x428356,_0x3d4319;_0x428356=_0x48e10b[_0xf89c('0xd')];var _0x52732c=_0x428356[_0xf89c('0x10')](-0x1);if(_0x52732c==='/'||_0x52732c==='\x5c'||_0x52732c===':'){_0x428356=_0x428356[_0xf89c('0x11')](0x0,_0x428356[_0xf89c('0x12')](_0x52732c));}switch(_0x48e10b['zone']){case'US':_0x3d4319='https://accounts.zoho.com';break;case'AU':_0x3d4319=_0xf89c('0x13');break;case'IN':_0x3d4319=_0xf89c('0x14');break;case'CN':_0x3d4319='https://accounts.zoho.com.cn';break;default:_0x3d4319=_0xf89c('0x15');break;}var _0x23de9f={'method':'POST','uri':_0x3d4319+_0xf89c('0x16'),'form':{'grant_type':_0xf89c('0x17'),'client_id':_0x48e10b[_0xf89c('0x18')],'client_secret':_0x48e10b[_0xf89c('0x19')],'redirect_uri':_0x48e10b[_0xf89c('0xd')],'code':_0x48e10b[_0xf89c('0xe')]},'headers':{'Content-Type':_0xf89c('0x1a')}};return rp(_0x23de9f)[_0xf89c('0x1b')](function(_0x57aa77){var _0x2759f9=JSON[_0xf89c('0x1c')](_0x57aa77);if(_0x2759f9['refresh_token']){_0x48e10b[_0xf89c('0x1d')]=_0x2759f9['refresh_token'];logger[_0xf89c('0x1e')](util[_0xf89c('0x1f')](_0xf89c('0x20'),_0x48e10b['name'],_0x48e10b['id']));}else{logger[_0xf89c('0x21')](util[_0xf89c('0x1f')](_0xf89c('0x22'),_0x48e10b['name'],_0x48e10b['id']),util[_0xf89c('0x23')](_0x2759f9,{'showHidden':![],'depth':null}));}return _0x46bb91(null,_0x4e4444);})[_0xf89c('0x24')](function(_0x58ded4){logger[_0xf89c('0x21')](util[_0xf89c('0x1f')](_0xf89c('0x22'),_0x48e10b['name'],_0x48e10b['id']),util[_0xf89c('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x46bb91(_0x58ded4);});}else{return _0x46bb91(null,_0x4e4444);}},'beforeUpdate':function(_0x5dca5e,_0xcd82c4,_0x20abc0){if(_0x5dca5e[_0xf89c('0xb')](_0xf89c('0xc'))||_0x5dca5e[_0xf89c('0xb')](_0xf89c('0xd'))||_0x5dca5e[_0xf89c('0xb')](_0xf89c('0x18'))||_0x5dca5e[_0xf89c('0xb')](_0xf89c('0x19'))||_0x5dca5e[_0xf89c('0xb')](_0xf89c('0xe'))||_0x5dca5e[_0xf89c('0xb')](_0xf89c('0xf'))){var _0x4f1666,_0xe56d62;_0x4f1666=_0x5dca5e[_0xf89c('0xd')];var _0x7684fd=_0x4f1666[_0xf89c('0x10')](-0x1);if(_0x7684fd==='/'||_0x7684fd==='\x5c'||_0x7684fd===':'){_0x4f1666=_0x4f1666[_0xf89c('0x11')](0x0,_0x4f1666[_0xf89c('0x12')](_0x7684fd));}switch(_0x5dca5e[_0xf89c('0xc')]){case'US':_0xe56d62=_0xf89c('0x25');break;case'AU':_0xe56d62=_0xf89c('0x13');break;case'IN':_0xe56d62=_0xf89c('0x14');break;case'CN':_0xe56d62=_0xf89c('0x26');break;default:_0xe56d62='https://accounts.zoho.eu';break;}var _0x1473d9={'method':'POST','uri':_0xe56d62+_0xf89c('0x16'),'form':{'grant_type':'authorization_code','client_id':_0x5dca5e[_0xf89c('0x18')],'client_secret':_0x5dca5e[_0xf89c('0x19')],'redirect_uri':_0x5dca5e[_0xf89c('0xd')],'code':_0x5dca5e[_0xf89c('0xe')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x1473d9)[_0xf89c('0x1b')](function(_0x5ec3ee){var _0x3fcc93=JSON[_0xf89c('0x1c')](_0x5ec3ee);if(_0x3fcc93['refresh_token']){_0x5dca5e[_0xf89c('0x1d')]=_0x3fcc93['refresh_token'];logger[_0xf89c('0x1e')](util[_0xf89c('0x1f')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x5dca5e[_0xf89c('0x27')],_0x5dca5e['id']));}else{logger[_0xf89c('0x21')](util[_0xf89c('0x1f')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x5dca5e[_0xf89c('0x27')],_0x5dca5e['id']),util[_0xf89c('0x23')](_0x3fcc93,{'showHidden':![],'depth':null}));}return _0x20abc0(null,_0xcd82c4);})[_0xf89c('0x24')](function(_0x43064e){logger[_0xf89c('0x21')](util['format'](_0xf89c('0x22'),_0x5dca5e[_0xf89c('0x27')],_0x5dca5e['id']),util[_0xf89c('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x20abc0(_0x43064e);});}else{return _0x20abc0(null,_0xcd82c4);}}}});}; \ No newline at end of file +var _0x2570=['/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','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','host','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','code','then','catch','lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','ZohoAccount','zone','changed','serverUrl','clientId','clientSecret','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in'];(function(_0x5476f7,_0x59b079){var _0x247f6d=function(_0x10eb8c){while(--_0x10eb8c){_0x5476f7['push'](_0x5476f7['shift']());}};_0x247f6d(++_0x59b079);}(_0x2570,0x92));var _0x0257=function(_0x24bbd5,_0x34a7c4){_0x24bbd5=_0x24bbd5-0x0;var _0x8fb737=_0x2570[_0x24bbd5];return _0x8fb737;};'use strict';var _=require(_0x0257('0x0'));var util=require(_0x0257('0x1'));var logger=require(_0x0257('0x2'))(_0x0257('0x3'));var moment=require(_0x0257('0x4'));var BPromise=require(_0x0257('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0257('0x6'));var attributes=require(_0x0257('0x7'));var integrations=require(_0x0257('0x8'));module[_0x0257('0x9')]=function(_0xed668b,_0x34deb9){return _0xed668b['define'](_0x0257('0xa'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x298d3b,_0x22680c,_0x2508c0){if(_0x298d3b['changed'](_0x0257('0xb'))||_0x298d3b[_0x0257('0xc')](_0x0257('0xd'))||_0x298d3b[_0x0257('0xc')](_0x0257('0xe'))||_0x298d3b['changed'](_0x0257('0xf'))||_0x298d3b['changed']('code')||_0x298d3b[_0x0257('0xc')]('host')){var _0x2abdae,_0xf07024;_0x2abdae=_0x298d3b[_0x0257('0xd')];var _0x29974c=_0x2abdae[_0x0257('0x10')](-0x1);if(_0x29974c==='/'||_0x29974c==='\x5c'||_0x29974c===':'){_0x2abdae=_0x2abdae[_0x0257('0x11')](0x0,_0x2abdae[_0x0257('0x12')](_0x29974c));}switch(_0x298d3b[_0x0257('0xb')]){case'US':_0xf07024=_0x0257('0x13');break;case'AU':_0xf07024=_0x0257('0x14');break;case'IN':_0xf07024=_0x0257('0x15');break;case'CN':_0xf07024='https://accounts.zoho.com.cn';break;default:_0xf07024='https://accounts.zoho.eu';break;}var _0x17fc98={'method':'POST','uri':_0xf07024+_0x0257('0x16'),'form':{'grant_type':_0x0257('0x17'),'client_id':_0x298d3b[_0x0257('0xe')],'client_secret':_0x298d3b[_0x0257('0xf')],'redirect_uri':_0x298d3b['serverUrl'],'code':_0x298d3b['code']},'headers':{'Content-Type':_0x0257('0x18')}};return rp(_0x17fc98)['then'](function(_0x224411){var _0x269c60=JSON[_0x0257('0x19')](_0x224411);if(_0x269c60[_0x0257('0x1a')]){_0x298d3b[_0x0257('0x1b')]=_0x269c60['refresh_token'];logger[_0x0257('0x1c')](util[_0x0257('0x1d')](_0x0257('0x1e'),_0x298d3b[_0x0257('0x1f')],_0x298d3b['id']));}else{logger[_0x0257('0x20')](util[_0x0257('0x1d')](_0x0257('0x21'),_0x298d3b[_0x0257('0x1f')],_0x298d3b['id']),util[_0x0257('0x22')](_0x269c60,{'showHidden':![],'depth':null}));}return _0x2508c0(null,_0x22680c);})['catch'](function(_0x333f34){logger[_0x0257('0x20')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x298d3b[_0x0257('0x1f')],_0x298d3b['id']),util[_0x0257('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x2508c0(_0x333f34);});}else{return _0x2508c0(null,_0x22680c);}},'beforeUpdate':function(_0x597c4c,_0x237d80,_0x4d4ab9){if(_0x597c4c[_0x0257('0xc')](_0x0257('0xb'))||_0x597c4c[_0x0257('0xc')](_0x0257('0xd'))||_0x597c4c['changed'](_0x0257('0xe'))||_0x597c4c[_0x0257('0xc')]('clientSecret')||_0x597c4c[_0x0257('0xc')]('code')||_0x597c4c[_0x0257('0xc')](_0x0257('0x23'))){var _0x4413f6,_0x99ce32;_0x4413f6=_0x597c4c[_0x0257('0xd')];var _0x5974b1=_0x4413f6[_0x0257('0x10')](-0x1);if(_0x5974b1==='/'||_0x5974b1==='\x5c'||_0x5974b1===':'){_0x4413f6=_0x4413f6[_0x0257('0x11')](0x0,_0x4413f6[_0x0257('0x12')](_0x5974b1));}switch(_0x597c4c[_0x0257('0xb')]){case'US':_0x99ce32=_0x0257('0x13');break;case'AU':_0x99ce32=_0x0257('0x14');break;case'IN':_0x99ce32='https://accounts.zoho.in';break;case'CN':_0x99ce32=_0x0257('0x24');break;default:_0x99ce32=_0x0257('0x25');break;}var _0x2df1e5={'method':_0x0257('0x26'),'uri':_0x99ce32+'/oauth/v2/token','form':{'grant_type':_0x0257('0x17'),'client_id':_0x597c4c[_0x0257('0xe')],'client_secret':_0x597c4c[_0x0257('0xf')],'redirect_uri':_0x597c4c[_0x0257('0xd')],'code':_0x597c4c[_0x0257('0x27')]},'headers':{'Content-Type':_0x0257('0x18')}};return rp(_0x2df1e5)[_0x0257('0x28')](function(_0x4c4d2d){var _0x51fc0e=JSON[_0x0257('0x19')](_0x4c4d2d);if(_0x51fc0e[_0x0257('0x1a')]){_0x597c4c[_0x0257('0x1b')]=_0x51fc0e['refresh_token'];logger[_0x0257('0x1c')](util[_0x0257('0x1d')](_0x0257('0x1e'),_0x597c4c[_0x0257('0x1f')],_0x597c4c['id']));}else{logger[_0x0257('0x20')](util[_0x0257('0x1d')](_0x0257('0x21'),_0x597c4c['name'],_0x597c4c['id']),util[_0x0257('0x22')](_0x51fc0e,{'showHidden':![],'depth':null}));}return _0x4d4ab9(null,_0x237d80);})[_0x0257('0x29')](function(_0x5d3979){logger[_0x0257('0x20')](util[_0x0257('0x1d')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x597c4c[_0x0257('0x1f')],_0x597c4c['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x4d4ab9(_0x5d3979);});}else{return _0x4d4ab9(null,_0x237d80);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 7a4e6ef..90c1604 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 _0x6f75=['ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZohoAccount','ZohoAccount','options','raw','attributes','limit','include','map','model','ShowZohoAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x8445ad,_0x3fc81d){var _0x13e22=function(_0x3c5dc1){while(--_0x3c5dc1){_0x8445ad['push'](_0x8445ad['shift']());}};_0x13e22(++_0x3fc81d);}(_0x6f75,0x71));var _0x56f7=function(_0x16e957,_0xfe9f78){_0x16e957=_0x16e957-0x0;var _0x47529f=_0x6f75[_0x16e957];return _0x47529f;};'use strict';var _=require(_0x56f7('0x0'));var util=require(_0x56f7('0x1'));var moment=require(_0x56f7('0x2'));var BPromise=require(_0x56f7('0x3'));var rs=require(_0x56f7('0x4'));var fs=require('fs');var Redis=require(_0x56f7('0x5'));var db=require(_0x56f7('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x56f7('0x7'))(_0x56f7('0x8'));var config=require(_0x56f7('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x137d14,_0xcc51b1,_0x4b5dcc){return new BPromise(function(_0x184bf7,_0x5155ff){return client['request'](_0x137d14,_0x4b5dcc)[_0x56f7('0xa')](function(_0x1e607c){logger[_0x56f7('0xb')](_0x56f7('0xc'),_0xcc51b1,_0x56f7('0xd'));logger[_0x56f7('0xe')](_0x56f7('0xf'),_0xcc51b1,_0x56f7('0xd'),JSON[_0x56f7('0x10')](_0x1e607c));if(_0x1e607c[_0x56f7('0x11')]){if(_0x1e607c[_0x56f7('0x11')][_0x56f7('0x12')]===0x1f4){logger[_0x56f7('0x11')](_0x56f7('0xc'),_0xcc51b1,_0x1e607c['error'][_0x56f7('0x13')]);return _0x5155ff(_0x1e607c[_0x56f7('0x11')][_0x56f7('0x13')]);}logger[_0x56f7('0x11')](_0x56f7('0xc'),_0xcc51b1,_0x1e607c[_0x56f7('0x11')][_0x56f7('0x13')]);return _0x184bf7(_0x1e607c[_0x56f7('0x11')][_0x56f7('0x13')]);}else{logger['info']('ZohoAccount,\x20%s,\x20%s',_0xcc51b1,_0x56f7('0xd'));_0x184bf7(_0x1e607c[_0x56f7('0x14')][_0x56f7('0x13')]);}})[_0x56f7('0x15')](function(_0x40fb77){logger[_0x56f7('0x11')]('ZohoAccount,\x20%s,\x20%s',_0xcc51b1,_0x40fb77);_0x5155ff(_0x40fb77);});});}exports[_0x56f7('0x16')]=function(_0x789c67){var _0x4f0e3a=this;return new Promise(function(_0x5af8cf,_0x2ccb9e){return db[_0x56f7('0x17')]['findAll']({'raw':_0x789c67[_0x56f7('0x18')]?_0x789c67[_0x56f7('0x18')][_0x56f7('0x19')]===undefined?!![]:![]:!![],'where':_0x789c67['options']?_0x789c67['options']['where']||null:null,'attributes':_0x789c67[_0x56f7('0x18')]?_0x789c67[_0x56f7('0x18')][_0x56f7('0x1a')]||null:null,'limit':_0x789c67[_0x56f7('0x18')]?_0x789c67[_0x56f7('0x18')][_0x56f7('0x1b')]||null:null,'include':_0x789c67['options']?_0x789c67['options'][_0x56f7('0x1c')]?_[_0x56f7('0x1d')](_0x789c67[_0x56f7('0x18')]['include'],function(_0x1cfaca){return{'model':db[_0x1cfaca[_0x56f7('0x1e')]],'as':_0x1cfaca['as'],'attributes':_0x1cfaca[_0x56f7('0x1a')],'include':_0x1cfaca[_0x56f7('0x1c')]?_[_0x56f7('0x1d')](_0x1cfaca[_0x56f7('0x1c')],function(_0x2209d9){return{'model':db[_0x2209d9[_0x56f7('0x1e')]],'as':_0x2209d9['as'],'attributes':_0x2209d9[_0x56f7('0x1a')],'include':_0x2209d9[_0x56f7('0x1c')]?_[_0x56f7('0x1d')](_0x2209d9['include'],function(_0x1b5267){return{'model':db[_0x1b5267[_0x56f7('0x1e')]],'as':_0x1b5267['as'],'attributes':_0x1b5267['attributes']};}):[]};}):[]};}):[]:[]})[_0x56f7('0xa')](function(_0xfec74c){logger[_0x56f7('0xb')](_0x56f7('0x16'),_0x789c67);logger[_0x56f7('0xe')](_0x56f7('0x16'),_0x789c67,JSON[_0x56f7('0x10')](_0xfec74c));_0x5af8cf(_0xfec74c);})[_0x56f7('0x15')](function(_0x4c59a0){logger[_0x56f7('0x11')](_0x56f7('0x16'),_0x4c59a0['message'],_0x789c67);_0x2ccb9e(_0x4f0e3a['error'](0x1f4,_0x4c59a0[_0x56f7('0x13')]));});});};exports[_0x56f7('0x1f')]=function(_0x4c985b){var _0x219a2b=this;return new Promise(function(_0x1bd0c2,_0x38fbe7){return db[_0x56f7('0x17')]['find']({'raw':_0x4c985b['options']?_0x4c985b['options'][_0x56f7('0x19')]===undefined?!![]:![]:!![],'where':_0x4c985b['options']?_0x4c985b['options']['where']||null:null,'attributes':_0x4c985b[_0x56f7('0x18')]?_0x4c985b[_0x56f7('0x18')][_0x56f7('0x1a')]||null:null,'include':_0x4c985b[_0x56f7('0x18')]?_0x4c985b['options'][_0x56f7('0x1c')]?_[_0x56f7('0x1d')](_0x4c985b[_0x56f7('0x18')][_0x56f7('0x1c')],function(_0x407a79){return{'model':db[_0x407a79['model']],'as':_0x407a79['as'],'attributes':_0x407a79[_0x56f7('0x1a')],'include':_0x407a79['include']?_[_0x56f7('0x1d')](_0x407a79['include'],function(_0x48ff44){return{'model':db[_0x48ff44[_0x56f7('0x1e')]],'as':_0x48ff44['as'],'attributes':_0x48ff44[_0x56f7('0x1a')],'include':_0x48ff44[_0x56f7('0x1c')]?_[_0x56f7('0x1d')](_0x48ff44[_0x56f7('0x1c')],function(_0x2afcc8){return{'model':db[_0x2afcc8['model']],'as':_0x2afcc8['as'],'attributes':_0x2afcc8[_0x56f7('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x56f7('0xa')](function(_0x587ddc){logger['info'](_0x56f7('0x1f'),_0x4c985b);logger[_0x56f7('0xe')](_0x56f7('0x1f'),_0x4c985b,JSON['stringify'](_0x587ddc));_0x1bd0c2(_0x587ddc);})[_0x56f7('0x15')](function(_0x69dcfd){logger[_0x56f7('0x11')](_0x56f7('0x1f'),_0x69dcfd['message'],_0x4c985b);_0x38fbe7(_0x219a2b[_0x56f7('0x11')](0x1f4,_0x69dcfd[_0x56f7('0x13')]));});});}; \ No newline at end of file +var _0x7af9=['limit','include','map','model','ShowZohoAccount','ZohoAccount','find','raw','where','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','info','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoAccount,\x20%s,\x20%s','message','result','catch','GetZohoAccount','findAll','options','attributes'];(function(_0x5a6644,_0x45d612){var _0x3a2a5d=function(_0x54159e){while(--_0x54159e){_0x5a6644['push'](_0x5a6644['shift']());}};_0x3a2a5d(++_0x45d612);}(_0x7af9,0x95));var _0x97af=function(_0x32c7b0,_0x238f5b){_0x32c7b0=_0x32c7b0-0x0;var _0x4ac60c=_0x7af9[_0x32c7b0];return _0x4ac60c;};'use strict';var _=require(_0x97af('0x0'));var util=require('util');var moment=require(_0x97af('0x1'));var BPromise=require(_0x97af('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x97af('0x3'));var db=require(_0x97af('0x4'))['db'];var utils=require(_0x97af('0x5'));var logger=require(_0x97af('0x6'))(_0x97af('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x97af('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x966c4e,_0x265d22,_0x70b4db){return new BPromise(function(_0x52835d,_0x2c2ee4){return client[_0x97af('0x9')](_0x966c4e,_0x70b4db)[_0x97af('0xa')](function(_0x4b866a){logger[_0x97af('0xb')]('ZohoAccount,\x20%s,\x20%s',_0x265d22,_0x97af('0xc'));logger[_0x97af('0xd')](_0x97af('0xe'),_0x265d22,_0x97af('0xc'),JSON[_0x97af('0xf')](_0x4b866a));if(_0x4b866a[_0x97af('0x10')]){if(_0x4b866a[_0x97af('0x10')][_0x97af('0x11')]===0x1f4){logger[_0x97af('0x10')](_0x97af('0x12'),_0x265d22,_0x4b866a[_0x97af('0x10')]['message']);return _0x2c2ee4(_0x4b866a[_0x97af('0x10')]['message']);}logger['error'](_0x97af('0x12'),_0x265d22,_0x4b866a[_0x97af('0x10')][_0x97af('0x13')]);return _0x52835d(_0x4b866a[_0x97af('0x10')][_0x97af('0x13')]);}else{logger[_0x97af('0xb')](_0x97af('0x12'),_0x265d22,'request\x20sent');_0x52835d(_0x4b866a[_0x97af('0x14')]['message']);}})[_0x97af('0x15')](function(_0x58d967){logger[_0x97af('0x10')]('ZohoAccount,\x20%s,\x20%s',_0x265d22,_0x58d967);_0x2c2ee4(_0x58d967);});});}exports[_0x97af('0x16')]=function(_0x2ae4ce){var _0x3815da=this;return new Promise(function(_0x1481d4,_0xc5c15f){return db['ZohoAccount'][_0x97af('0x17')]({'raw':_0x2ae4ce[_0x97af('0x18')]?_0x2ae4ce['options']['raw']===undefined?!![]:![]:!![],'where':_0x2ae4ce[_0x97af('0x18')]?_0x2ae4ce[_0x97af('0x18')]['where']||null:null,'attributes':_0x2ae4ce[_0x97af('0x18')]?_0x2ae4ce['options'][_0x97af('0x19')]||null:null,'limit':_0x2ae4ce[_0x97af('0x18')]?_0x2ae4ce[_0x97af('0x18')][_0x97af('0x1a')]||null:null,'include':_0x2ae4ce[_0x97af('0x18')]?_0x2ae4ce['options'][_0x97af('0x1b')]?_[_0x97af('0x1c')](_0x2ae4ce[_0x97af('0x18')][_0x97af('0x1b')],function(_0x1a08b0){return{'model':db[_0x1a08b0[_0x97af('0x1d')]],'as':_0x1a08b0['as'],'attributes':_0x1a08b0[_0x97af('0x19')],'include':_0x1a08b0[_0x97af('0x1b')]?_['map'](_0x1a08b0[_0x97af('0x1b')],function(_0x651a83){return{'model':db[_0x651a83[_0x97af('0x1d')]],'as':_0x651a83['as'],'attributes':_0x651a83[_0x97af('0x19')],'include':_0x651a83[_0x97af('0x1b')]?_[_0x97af('0x1c')](_0x651a83['include'],function(_0x36400d){return{'model':db[_0x36400d[_0x97af('0x1d')]],'as':_0x36400d['as'],'attributes':_0x36400d[_0x97af('0x19')]};}):[]};}):[]};}):[]:[]})[_0x97af('0xa')](function(_0x465708){logger['info'](_0x97af('0x16'),_0x2ae4ce);logger[_0x97af('0xd')]('GetZohoAccount',_0x2ae4ce,JSON[_0x97af('0xf')](_0x465708));_0x1481d4(_0x465708);})[_0x97af('0x15')](function(_0x8af287){logger[_0x97af('0x10')](_0x97af('0x16'),_0x8af287[_0x97af('0x13')],_0x2ae4ce);_0xc5c15f(_0x3815da[_0x97af('0x10')](0x1f4,_0x8af287[_0x97af('0x13')]));});});};exports[_0x97af('0x1e')]=function(_0x431f41){var _0x4e4127=this;return new Promise(function(_0x32b3c0,_0x564e58){return db[_0x97af('0x1f')][_0x97af('0x20')]({'raw':_0x431f41[_0x97af('0x18')]?_0x431f41[_0x97af('0x18')][_0x97af('0x21')]===undefined?!![]:![]:!![],'where':_0x431f41[_0x97af('0x18')]?_0x431f41[_0x97af('0x18')][_0x97af('0x22')]||null:null,'attributes':_0x431f41[_0x97af('0x18')]?_0x431f41[_0x97af('0x18')]['attributes']||null:null,'include':_0x431f41[_0x97af('0x18')]?_0x431f41[_0x97af('0x18')]['include']?_[_0x97af('0x1c')](_0x431f41['options'][_0x97af('0x1b')],function(_0x4db0f3){return{'model':db[_0x4db0f3['model']],'as':_0x4db0f3['as'],'attributes':_0x4db0f3[_0x97af('0x19')],'include':_0x4db0f3[_0x97af('0x1b')]?_[_0x97af('0x1c')](_0x4db0f3['include'],function(_0x1c106d){return{'model':db[_0x1c106d[_0x97af('0x1d')]],'as':_0x1c106d['as'],'attributes':_0x1c106d[_0x97af('0x19')],'include':_0x1c106d[_0x97af('0x1b')]?_[_0x97af('0x1c')](_0x1c106d['include'],function(_0xb80be0){return{'model':db[_0xb80be0[_0x97af('0x1d')]],'as':_0xb80be0['as'],'attributes':_0xb80be0[_0x97af('0x19')]};}):[]};}):[]};}):[]:[]})[_0x97af('0xa')](function(_0x4ff894){logger['info']('ShowZohoAccount',_0x431f41);logger[_0x97af('0xd')](_0x97af('0x1e'),_0x431f41,JSON[_0x97af('0xf')](_0x4ff894));_0x32b3c0(_0x4ff894);})[_0x97af('0x15')](function(_0x489236){logger['error']('ShowZohoAccount',_0x489236[_0x97af('0x13')],_0x431f41);_0x564e58(_0x4e4127[_0x97af('0x10')](0x1f4,_0x489236[_0x97af('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index ba310f2..76bf59c 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 _0x27b0=['path','connect-timeout','Router','../../components/interaction/service','get','isAuthenticated','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','update','delete','destroy','exports','multer'];(function(_0x19d9d7,_0x6c2304){var _0x57bb06=function(_0x45a0bd){while(--_0x45a0bd){_0x19d9d7['push'](_0x19d9d7['shift']());}};_0x57bb06(++_0x6c2304);}(_0x27b0,0x1df));var _0x027b=function(_0x1f6f84,_0x2bab55){_0x1f6f84=_0x1f6f84-0x0;var _0x177f40=_0x27b0[_0x1f6f84];return _0x177f40;};'use strict';var multer=require(_0x027b('0x0'));var util=require('util');var path=require(_0x027b('0x1'));var timeout=require(_0x027b('0x2'));var express=require('express');var router=express[_0x027b('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x027b('0x4'));var config=require('../../config/environment');var controller=require('./intZohoConfiguration.controller');router[_0x027b('0x5')]('/',auth[_0x027b('0x6')](),controller['index']);router[_0x027b('0x5')](_0x027b('0x7'),auth[_0x027b('0x6')](),controller['show']);router[_0x027b('0x5')](_0x027b('0x8'),auth[_0x027b('0x6')](),controller[_0x027b('0x9')]);router['get'](_0x027b('0xa'),auth[_0x027b('0x6')](),controller[_0x027b('0xb')]);router['get'](_0x027b('0xc'),auth[_0x027b('0x6')](),controller[_0x027b('0xd')]);router[_0x027b('0xe')]('/',auth[_0x027b('0x6')](),controller[_0x027b('0xf')]);router['put']('/:id',auth[_0x027b('0x6')](),controller[_0x027b('0x10')]);router[_0x027b('0x11')](_0x027b('0x7'),auth[_0x027b('0x6')](),controller[_0x027b('0x12')]);module[_0x027b('0x13')]=router; \ No newline at end of file +var _0xf0ac=['./intZohoConfiguration.controller','/:id','get','isAuthenticated','getFields','getSubjects','getDescriptions','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x45dfcc,_0x4517b8){var _0x4fb439=function(_0x117cf9){while(--_0x117cf9){_0x45dfcc['push'](_0x45dfcc['shift']());}};_0x4fb439(++_0x4517b8);}(_0xf0ac,0xf1));var _0xcf0a=function(_0x7142,_0xce5b05){_0x7142=_0x7142-0x0;var _0x1efb3a=_0xf0ac[_0x7142];return _0x1efb3a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xcf0a('0x0'));var timeout=require(_0xcf0a('0x1'));var express=require(_0xcf0a('0x2'));var router=express[_0xcf0a('0x3')]();var fs_extra=require(_0xcf0a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xcf0a('0x5'));var config=require('../../config/environment');var controller=require(_0xcf0a('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xcf0a('0x7'),auth['isAuthenticated'](),controller['show']);router[_0xcf0a('0x8')]('/:id/fields',auth[_0xcf0a('0x9')](),controller[_0xcf0a('0xa')]);router[_0xcf0a('0x8')]('/:id/subjects',auth[_0xcf0a('0x9')](),controller[_0xcf0a('0xb')]);router['get']('/:id/descriptions',auth[_0xcf0a('0x9')](),controller[_0xcf0a('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xcf0a('0xd')]);router[_0xcf0a('0xe')](_0xcf0a('0x7'),auth['isAuthenticated'](),controller[_0xcf0a('0xf')]);router[_0xcf0a('0x10')](_0xcf0a('0x7'),auth[_0xcf0a('0x9')](),controller[_0xcf0a('0x11')]);module[_0xcf0a('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 7dad90a..48794a1 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 _0xa7f1=['contact','nothing','contact_lead','STRING','exports','ENUM','lead'];(function(_0x31cc4a,_0x49fcf6){var _0x11d222=function(_0x2e7394){while(--_0x2e7394){_0x31cc4a['push'](_0x31cc4a['shift']());}};_0x11d222(++_0x49fcf6);}(_0xa7f1,0x11c));var _0x1a7f=function(_0x56a7bc,_0x41d6f6){_0x56a7bc=_0x56a7bc-0x0;var _0x4f5883=_0xa7f1[_0x56a7bc];return _0x4f5883;};'use strict';var Sequelize=require('sequelize');module[_0x1a7f('0x0')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0x1a7f('0x1')](_0x1a7f('0x2'),_0x1a7f('0x3'),_0x1a7f('0x4')),'defaultValue':_0x1a7f('0x2')},'moduleSearch':{'type':Sequelize[_0x1a7f('0x1')](_0x1a7f('0x5'),_0x1a7f('0x3'),_0x1a7f('0x2')),'defaultValue':_0x1a7f('0x5')},'description':{'type':Sequelize[_0x1a7f('0x6')]}}; \ No newline at end of file +var _0xb410=['exports','STRING','contact','nothing','lead','ENUM','contact_lead','sequelize'];(function(_0x56e8f9,_0x5f0bcc){var _0xc3c838=function(_0x2d4cf1){while(--_0x2d4cf1){_0x56e8f9['push'](_0x56e8f9['shift']());}};_0xc3c838(++_0x5f0bcc);}(_0xb410,0x8f));var _0x0b41=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xb410[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require(_0x0b41('0x0'));module[_0x0b41('0x1')]={'name':{'type':Sequelize[_0x0b41('0x2')]},'moduleCreate':{'type':Sequelize['ENUM']('lead',_0x0b41('0x3'),_0x0b41('0x4')),'defaultValue':_0x0b41('0x5')},'moduleSearch':{'type':Sequelize[_0x0b41('0x6')](_0x0b41('0x7'),_0x0b41('0x3'),_0x0b41('0x5')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0x0b41('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index c987326..43a9d9a 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 _0x8ccc=['undefined','offset','count','set','Content-Range','apply','reject','save','destroy','stack','name','index','map','ZohoConfiguration','rawAttributes','fieldName','type','key','model','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','options','includeAll','findAll','then','catch','show','params','find','create','update','body','getFields','findOne','ZohoField','getSubjects','getDescriptions','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit'];(function(_0x3e228c,_0x57206f){var _0x12f226=function(_0x14f8a2){while(--_0x14f8a2){_0x3e228c['push'](_0x3e228c['shift']());}};_0x12f226(++_0x57206f);}(_0x8ccc,0x183));var _0xc8cc=function(_0x34def0,_0x554b5b){_0x34def0=_0x34def0-0x0;var _0x2be1c9=_0x8ccc[_0x34def0];return _0x2be1c9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc8cc('0x0'));var zipdir=require(_0xc8cc('0x1'));var jsonpatch=require(_0xc8cc('0x2'));var rp=require(_0xc8cc('0x3'));var moment=require('moment');var BPromise=require(_0xc8cc('0x4'));var Mustache=require(_0xc8cc('0x5'));var util=require(_0xc8cc('0x6'));var path=require(_0xc8cc('0x7'));var sox=require('sox');var csv=require(_0xc8cc('0x8'));var ejs=require(_0xc8cc('0x9'));var fs=require('fs');var fs_extra=require(_0xc8cc('0xa'));var _=require(_0xc8cc('0xb'));var squel=require(_0xc8cc('0xc'));var crypto=require(_0xc8cc('0xd'));var jsforce=require(_0xc8cc('0xe'));var deskjs=require(_0xc8cc('0xf'));var toCsv=require(_0xc8cc('0x8'));var querystring=require(_0xc8cc('0x10'));var Papa=require(_0xc8cc('0x11'));var Redis=require(_0xc8cc('0x12'));var authService=require(_0xc8cc('0x13'));var qs=require(_0xc8cc('0x14'));var as=require(_0xc8cc('0x15'));var hardwareService=require(_0xc8cc('0x16'));var logger=require(_0xc8cc('0x17'))('api');var utils=require(_0xc8cc('0x18'));var config=require(_0xc8cc('0x19'));var licenseUtil=require(_0xc8cc('0x1a'));var db=require(_0xc8cc('0x1b'))['db'];function respondWithStatusCode(_0x3f886a,_0x5ec92f){_0x5ec92f=_0x5ec92f||0xcc;return function(_0x2175a9){if(_0x2175a9){return _0x3f886a[_0xc8cc('0x1c')](_0x5ec92f);}return _0x3f886a[_0xc8cc('0x1d')](_0x5ec92f)[_0xc8cc('0x1e')]();};}function respondWithResult(_0x369ebc,_0x172a11){_0x172a11=_0x172a11||0xc8;return function(_0x267dc9){if(_0x267dc9){return _0x369ebc[_0xc8cc('0x1d')](_0x172a11)[_0xc8cc('0x1f')](_0x267dc9);}};}function respondWithFilteredResult(_0x3b4029,_0x39ec1e){return function(_0x3074de){if(_0x3074de){var _0x346328=typeof _0x39ec1e['offset']==='undefined'&&typeof _0x39ec1e[_0xc8cc('0x20')]===_0xc8cc('0x21');var _0x3826d8=_0x3074de['count'];var _0x5ad150=_0x346328?0x0:_0x39ec1e[_0xc8cc('0x22')];var _0x26f8a3=_0x346328?_0x3074de[_0xc8cc('0x23')]:_0x39ec1e[_0xc8cc('0x22')]+_0x39ec1e[_0xc8cc('0x20')];var _0x2814e1;if(_0x26f8a3>=_0x3826d8){_0x26f8a3=_0x3826d8;_0x2814e1=0xc8;}else{_0x2814e1=0xce;}_0x3b4029[_0xc8cc('0x1d')](_0x2814e1);return _0x3b4029[_0xc8cc('0x24')](_0xc8cc('0x25'),_0x5ad150+'-'+_0x26f8a3+'/'+_0x3826d8)[_0xc8cc('0x1f')](_0x3074de);}return null;};}function patchUpdates(_0x25fa7d){return function(_0x590aa1){try{jsonpatch[_0xc8cc('0x26')](_0x590aa1,_0x25fa7d,!![]);}catch(_0x60e7f8){return BPromise[_0xc8cc('0x27')](_0x60e7f8);}return _0x590aa1[_0xc8cc('0x28')]();};}function saveUpdates(_0x4ce1b9,_0x5f22d9){return function(_0x3ec568){if(_0x3ec568){return _0x3ec568['update'](_0x4ce1b9)['then'](function(_0xfe556a){return _0xfe556a;});}return null;};}function removeEntity(_0x3cfa64,_0x44018d){return function(_0x2553ab){if(_0x2553ab){return _0x2553ab[_0xc8cc('0x29')]()['then'](function(){_0x3cfa64['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x246760,_0x4910f0){return function(_0x31d82d){if(!_0x31d82d){_0x246760[_0xc8cc('0x1c')](0x194);}return _0x31d82d;};}function handleError(_0x1e82e6,_0x36af35){_0x36af35=_0x36af35||0x1f4;return function(_0x48379f){logger['error'](_0x48379f[_0xc8cc('0x2a')]);if(_0x48379f[_0xc8cc('0x2b')]){delete _0x48379f['name'];}_0x1e82e6['status'](_0x36af35)['send'](_0x48379f);};}exports[_0xc8cc('0x2c')]=function(_0xe9df63,_0x46751e){var _0x4b32aa={},_0x207f76={},_0x16deed={'count':0x0,'rows':[]};var _0x102487=_[_0xc8cc('0x2d')](db[_0xc8cc('0x2e')][_0xc8cc('0x2f')],function(_0x4a54e9){return{'name':_0x4a54e9[_0xc8cc('0x30')],'type':_0x4a54e9[_0xc8cc('0x31')][_0xc8cc('0x32')]};});_0x207f76[_0xc8cc('0x33')]=_[_0xc8cc('0x2d')](_0x102487,'name');_0x207f76['query']=_[_0xc8cc('0x34')](_0xe9df63['query']);_0x207f76[_0xc8cc('0x35')]=_[_0xc8cc('0x36')](_0x207f76[_0xc8cc('0x33')],_0x207f76['query']);_0x4b32aa[_0xc8cc('0x37')]=_[_0xc8cc('0x36')](_0x207f76[_0xc8cc('0x33')],qs[_0xc8cc('0x38')](_0xe9df63[_0xc8cc('0x39')]['fields']));_0x4b32aa[_0xc8cc('0x37')]=_0x4b32aa[_0xc8cc('0x37')][_0xc8cc('0x3a')]?_0x4b32aa['attributes']:_0x207f76['model'];if(!_0xe9df63[_0xc8cc('0x39')][_0xc8cc('0x3b')](_0xc8cc('0x3c'))){_0x4b32aa['limit']=qs[_0xc8cc('0x20')](_0xe9df63['query'][_0xc8cc('0x20')]);_0x4b32aa[_0xc8cc('0x22')]=qs[_0xc8cc('0x22')](_0xe9df63[_0xc8cc('0x39')][_0xc8cc('0x22')]);}_0x4b32aa[_0xc8cc('0x3d')]=qs[_0xc8cc('0x3e')](_0xe9df63[_0xc8cc('0x39')][_0xc8cc('0x3e')]);_0x4b32aa['where']=qs[_0xc8cc('0x35')](_[_0xc8cc('0x3f')](_0xe9df63[_0xc8cc('0x39')],_0x207f76['filters']),_0x102487);if(_0xe9df63[_0xc8cc('0x39')]['filter']){_0x4b32aa['where']=_['merge'](_0x4b32aa[_0xc8cc('0x40')],{'$or':_[_0xc8cc('0x2d')](_0x102487,function(_0x4e5f18){if(_0x4e5f18[_0xc8cc('0x31')]!==_0xc8cc('0x41')){var _0x1b4290={};_0x1b4290[_0x4e5f18['name']]={'$like':'%'+_0xe9df63[_0xc8cc('0x39')][_0xc8cc('0x42')]+'%'};return _0x1b4290;}})});}_0x4b32aa=_[_0xc8cc('0x43')]({},_0x4b32aa,_0xe9df63[_0xc8cc('0x44')]);var _0x128998={'where':_0x4b32aa[_0xc8cc('0x40')]};return db[_0xc8cc('0x2e')][_0xc8cc('0x23')](_0x128998)['then'](function(_0x2aa0c6){_0x16deed['count']=_0x2aa0c6;if(_0xe9df63[_0xc8cc('0x39')][_0xc8cc('0x45')]){_0x4b32aa['include']=[{'all':!![]}];}return db[_0xc8cc('0x2e')][_0xc8cc('0x46')](_0x4b32aa);})[_0xc8cc('0x47')](function(_0x3ec0fb){_0x16deed['rows']=_0x3ec0fb;return _0x16deed;})[_0xc8cc('0x47')](respondWithFilteredResult(_0x46751e,_0x4b32aa))[_0xc8cc('0x48')](handleError(_0x46751e,null));};exports[_0xc8cc('0x49')]=function(_0xe2dd72,_0x231981){var _0x406525={'raw':![],'where':{'id':_0xe2dd72[_0xc8cc('0x4a')]['id']}},_0x5969ce={};_0x5969ce[_0xc8cc('0x33')]=_[_0xc8cc('0x34')](db['ZohoConfiguration'][_0xc8cc('0x2f')]);_0x5969ce[_0xc8cc('0x39')]=_['keys'](_0xe2dd72[_0xc8cc('0x39')]);_0x5969ce[_0xc8cc('0x35')]=_[_0xc8cc('0x36')](_0x5969ce[_0xc8cc('0x33')],_0x5969ce[_0xc8cc('0x39')]);_0x406525[_0xc8cc('0x37')]=_[_0xc8cc('0x36')](_0x5969ce[_0xc8cc('0x33')],qs[_0xc8cc('0x38')](_0xe2dd72[_0xc8cc('0x39')][_0xc8cc('0x38')]));_0x406525['attributes']=_0x406525[_0xc8cc('0x37')]['length']?_0x406525[_0xc8cc('0x37')]:_0x5969ce[_0xc8cc('0x33')];if(_0xe2dd72[_0xc8cc('0x39')]['includeAll']){_0x406525['include']=[{'all':!![]}];}_0x406525=_[_0xc8cc('0x43')]({},_0x406525,_0xe2dd72['options']);return db[_0xc8cc('0x2e')][_0xc8cc('0x4b')](_0x406525)[_0xc8cc('0x47')](handleEntityNotFound(_0x231981,null))[_0xc8cc('0x47')](respondWithResult(_0x231981,null))[_0xc8cc('0x48')](handleError(_0x231981,null));};exports[_0xc8cc('0x4c')]=function(_0x578928,_0x16333d){return db[_0xc8cc('0x2e')]['create'](_0x578928['body'],{})['then'](respondWithResult(_0x16333d,0xc9))['catch'](handleError(_0x16333d,null));};exports[_0xc8cc('0x4d')]=function(_0x274e7a,_0x3c494f){if(_0x274e7a[_0xc8cc('0x4e')]['id']){delete _0x274e7a['body']['id'];}return db[_0xc8cc('0x2e')][_0xc8cc('0x4b')]({'where':{'id':_0x274e7a['params']['id']}})[_0xc8cc('0x47')](handleEntityNotFound(_0x3c494f,null))['then'](saveUpdates(_0x274e7a[_0xc8cc('0x4e')],null))[_0xc8cc('0x47')](respondWithResult(_0x3c494f,null))[_0xc8cc('0x48')](handleError(_0x3c494f,null));};exports[_0xc8cc('0x29')]=function(_0x31c180,_0x9389d8){return db[_0xc8cc('0x2e')][_0xc8cc('0x4b')]({'where':{'id':_0x31c180[_0xc8cc('0x4a')]['id']}})['then'](handleEntityNotFound(_0x9389d8,null))[_0xc8cc('0x47')](removeEntity(_0x9389d8,null))[_0xc8cc('0x48')](handleError(_0x9389d8,null));};exports[_0xc8cc('0x4f')]=function(_0x329c2b,_0x425a77,_0x317352){var _0x31cd9e={};var _0x37d055={};var _0x25743b;var _0x1aed30;return db[_0xc8cc('0x2e')][_0xc8cc('0x50')]({'where':{'id':_0x329c2b[_0xc8cc('0x4a')]['id']}})[_0xc8cc('0x47')](handleEntityNotFound(_0x425a77,null))['then'](function(_0x1a67b6){if(_0x1a67b6){_0x25743b=_0x1a67b6;_0x37d055[_0xc8cc('0x33')]=_[_0xc8cc('0x34')](db[_0xc8cc('0x51')][_0xc8cc('0x2f')]);_0x37d055[_0xc8cc('0x39')]=_[_0xc8cc('0x34')](_0x329c2b[_0xc8cc('0x39')]);_0x37d055[_0xc8cc('0x35')]=_[_0xc8cc('0x36')](_0x37d055[_0xc8cc('0x33')],_0x37d055['query']);_0x31cd9e['attributes']=_[_0xc8cc('0x36')](_0x37d055[_0xc8cc('0x33')],qs[_0xc8cc('0x38')](_0x329c2b[_0xc8cc('0x39')]['fields']));_0x31cd9e[_0xc8cc('0x37')]=_0x31cd9e[_0xc8cc('0x37')][_0xc8cc('0x3a')]?_0x31cd9e[_0xc8cc('0x37')]:_0x37d055[_0xc8cc('0x33')];_0x31cd9e[_0xc8cc('0x3d')]=qs[_0xc8cc('0x3e')](_0x329c2b[_0xc8cc('0x39')][_0xc8cc('0x3e')]);_0x31cd9e[_0xc8cc('0x40')]=qs['filters'](_[_0xc8cc('0x3f')](_0x329c2b[_0xc8cc('0x39')],_0x37d055[_0xc8cc('0x35')]));if(_0x329c2b[_0xc8cc('0x39')][_0xc8cc('0x42')]){_0x31cd9e[_0xc8cc('0x40')]=_[_0xc8cc('0x43')](_0x31cd9e[_0xc8cc('0x40')],{'$or':_[_0xc8cc('0x2d')](_0x31cd9e[_0xc8cc('0x37')],function(_0x10506d){var _0x260e74={};_0x260e74[_0x10506d]={'$like':'%'+_0x329c2b[_0xc8cc('0x39')][_0xc8cc('0x42')]+'%'};return _0x260e74;})});}_0x31cd9e=_['merge']({},_0x31cd9e,_0x329c2b[_0xc8cc('0x44')]);return _0x25743b[_0xc8cc('0x4f')](_0x31cd9e);}})[_0xc8cc('0x47')](function(_0x1ae03b){if(_0x1ae03b){_0x1aed30=_0x1ae03b[_0xc8cc('0x3a')];if(!_0x329c2b['query'][_0xc8cc('0x3b')](_0xc8cc('0x3c'))){_0x31cd9e['limit']=qs['limit'](_0x329c2b[_0xc8cc('0x39')][_0xc8cc('0x20')]);_0x31cd9e[_0xc8cc('0x22')]=qs[_0xc8cc('0x22')](_0x329c2b['query'][_0xc8cc('0x22')]);}return _0x25743b[_0xc8cc('0x4f')](_0x31cd9e);}})[_0xc8cc('0x47')](function(_0x27263e){if(_0x27263e){return _0x27263e?{'count':_0x1aed30,'rows':_0x27263e}:null;}})[_0xc8cc('0x47')](respondWithResult(_0x425a77,null))['catch'](handleError(_0x425a77,null));};exports['getSubjects']=function(_0xdb34d7,_0x30288b,_0x4a4aad){var _0x3ce36a={};var _0x123ecb={};var _0x2c45c3;var _0x4789d0;return db[_0xc8cc('0x2e')]['findOne']({'where':{'id':_0xdb34d7[_0xc8cc('0x4a')]['id']}})[_0xc8cc('0x47')](handleEntityNotFound(_0x30288b,null))['then'](function(_0x55b005){if(_0x55b005){_0x2c45c3=_0x55b005;_0x123ecb['model']=_['keys'](db[_0xc8cc('0x51')]['rawAttributes']);_0x123ecb[_0xc8cc('0x39')]=_[_0xc8cc('0x34')](_0xdb34d7[_0xc8cc('0x39')]);_0x123ecb[_0xc8cc('0x35')]=_[_0xc8cc('0x36')](_0x123ecb[_0xc8cc('0x33')],_0x123ecb[_0xc8cc('0x39')]);_0x3ce36a[_0xc8cc('0x37')]=_['intersection'](_0x123ecb[_0xc8cc('0x33')],qs[_0xc8cc('0x38')](_0xdb34d7[_0xc8cc('0x39')]['fields']));_0x3ce36a[_0xc8cc('0x37')]=_0x3ce36a[_0xc8cc('0x37')][_0xc8cc('0x3a')]?_0x3ce36a[_0xc8cc('0x37')]:_0x123ecb[_0xc8cc('0x33')];_0x3ce36a[_0xc8cc('0x3d')]=qs[_0xc8cc('0x3e')](_0xdb34d7[_0xc8cc('0x39')][_0xc8cc('0x3e')]);_0x3ce36a[_0xc8cc('0x40')]=qs['filters'](_[_0xc8cc('0x3f')](_0xdb34d7[_0xc8cc('0x39')],_0x123ecb[_0xc8cc('0x35')]));if(_0xdb34d7[_0xc8cc('0x39')]['filter']){_0x3ce36a[_0xc8cc('0x40')]=_[_0xc8cc('0x43')](_0x3ce36a[_0xc8cc('0x40')],{'$or':_[_0xc8cc('0x2d')](_0x3ce36a[_0xc8cc('0x37')],function(_0x1f45be){var _0x1dfd98={};_0x1dfd98[_0x1f45be]={'$like':'%'+_0xdb34d7[_0xc8cc('0x39')][_0xc8cc('0x42')]+'%'};return _0x1dfd98;})});}_0x3ce36a=_[_0xc8cc('0x43')]({},_0x3ce36a,_0xdb34d7[_0xc8cc('0x44')]);return _0x2c45c3[_0xc8cc('0x52')](_0x3ce36a);}})['then'](function(_0x16cce6){if(_0x16cce6){_0x4789d0=_0x16cce6[_0xc8cc('0x3a')];if(!_0xdb34d7['query']['hasOwnProperty'](_0xc8cc('0x3c'))){_0x3ce36a[_0xc8cc('0x20')]=qs[_0xc8cc('0x20')](_0xdb34d7[_0xc8cc('0x39')]['limit']);_0x3ce36a[_0xc8cc('0x22')]=qs['offset'](_0xdb34d7[_0xc8cc('0x39')]['offset']);}return _0x2c45c3[_0xc8cc('0x52')](_0x3ce36a);}})[_0xc8cc('0x47')](function(_0x292b83){if(_0x292b83){return _0x292b83?{'count':_0x4789d0,'rows':_0x292b83}:null;}})['then'](respondWithResult(_0x30288b,null))[_0xc8cc('0x48')](handleError(_0x30288b,null));};exports[_0xc8cc('0x53')]=function(_0x24ecc8,_0x52688c,_0x57ea9f){var _0x43d0ee={};var _0x3e9852={};var _0x4183d8;var _0x48f2f7;return db[_0xc8cc('0x2e')][_0xc8cc('0x50')]({'where':{'id':_0x24ecc8[_0xc8cc('0x4a')]['id']}})['then'](handleEntityNotFound(_0x52688c,null))[_0xc8cc('0x47')](function(_0x3fa1ea){if(_0x3fa1ea){_0x4183d8=_0x3fa1ea;_0x3e9852[_0xc8cc('0x33')]=_[_0xc8cc('0x34')](db[_0xc8cc('0x51')][_0xc8cc('0x2f')]);_0x3e9852['query']=_[_0xc8cc('0x34')](_0x24ecc8[_0xc8cc('0x39')]);_0x3e9852[_0xc8cc('0x35')]=_['intersection'](_0x3e9852['model'],_0x3e9852[_0xc8cc('0x39')]);_0x43d0ee['attributes']=_[_0xc8cc('0x36')](_0x3e9852[_0xc8cc('0x33')],qs['fields'](_0x24ecc8[_0xc8cc('0x39')][_0xc8cc('0x38')]));_0x43d0ee[_0xc8cc('0x37')]=_0x43d0ee['attributes'][_0xc8cc('0x3a')]?_0x43d0ee[_0xc8cc('0x37')]:_0x3e9852[_0xc8cc('0x33')];_0x43d0ee[_0xc8cc('0x3d')]=qs[_0xc8cc('0x3e')](_0x24ecc8['query'][_0xc8cc('0x3e')]);_0x43d0ee[_0xc8cc('0x40')]=qs[_0xc8cc('0x35')](_[_0xc8cc('0x3f')](_0x24ecc8[_0xc8cc('0x39')],_0x3e9852[_0xc8cc('0x35')]));if(_0x24ecc8[_0xc8cc('0x39')][_0xc8cc('0x42')]){_0x43d0ee[_0xc8cc('0x40')]=_[_0xc8cc('0x43')](_0x43d0ee[_0xc8cc('0x40')],{'$or':_[_0xc8cc('0x2d')](_0x43d0ee['attributes'],function(_0xafb755){var _0x2d4cef={};_0x2d4cef[_0xafb755]={'$like':'%'+_0x24ecc8['query'][_0xc8cc('0x42')]+'%'};return _0x2d4cef;})});}_0x43d0ee=_[_0xc8cc('0x43')]({},_0x43d0ee,_0x24ecc8['options']);return _0x4183d8[_0xc8cc('0x53')](_0x43d0ee);}})[_0xc8cc('0x47')](function(_0x1301ae){if(_0x1301ae){_0x48f2f7=_0x1301ae['length'];if(!_0x24ecc8['query'][_0xc8cc('0x3b')](_0xc8cc('0x3c'))){_0x43d0ee[_0xc8cc('0x20')]=qs[_0xc8cc('0x20')](_0x24ecc8[_0xc8cc('0x39')][_0xc8cc('0x20')]);_0x43d0ee[_0xc8cc('0x22')]=qs[_0xc8cc('0x22')](_0x24ecc8[_0xc8cc('0x39')][_0xc8cc('0x22')]);}return _0x4183d8['getDescriptions'](_0x43d0ee);}})[_0xc8cc('0x47')](function(_0x158a3a){if(_0x158a3a){return _0x158a3a?{'count':_0x48f2f7,'rows':_0x158a3a}:null;}})['then'](respondWithResult(_0x52688c,null))['catch'](handleError(_0x52688c,null));}; \ No newline at end of file +var _0xa6e6=['name','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','ZohoConfiguration','includeAll','include','findAll','catch','show','create','body','find','params','destroy','getFields','ZohoField','options','nolimit','getSubjects','findOne','getDescriptions','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','reject','save','update','then','error','send','index','map','rawAttributes','fieldName','type','key','model'];(function(_0x5b6687,_0x315b98){var _0x193329=function(_0x1e5b7b){while(--_0x1e5b7b){_0x5b6687['push'](_0x5b6687['shift']());}};_0x193329(++_0x315b98);}(_0xa6e6,0x112));var _0x6a6e=function(_0x2341c6,_0x3af092){_0x2341c6=_0x2341c6-0x0;var _0x54c34d=_0xa6e6[_0x2341c6];return _0x54c34d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6a6e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6a6e('0x1'));var rp=require(_0x6a6e('0x2'));var moment=require('moment');var BPromise=require(_0x6a6e('0x3'));var Mustache=require(_0x6a6e('0x4'));var util=require(_0x6a6e('0x5'));var path=require('path');var sox=require(_0x6a6e('0x6'));var csv=require(_0x6a6e('0x7'));var ejs=require(_0x6a6e('0x8'));var fs=require('fs');var fs_extra=require(_0x6a6e('0x9'));var _=require(_0x6a6e('0xa'));var squel=require(_0x6a6e('0xb'));var crypto=require('crypto');var jsforce=require(_0x6a6e('0xc'));var deskjs=require(_0x6a6e('0xd'));var toCsv=require(_0x6a6e('0x7'));var querystring=require(_0x6a6e('0xe'));var Papa=require(_0x6a6e('0xf'));var Redis=require('ioredis');var authService=require(_0x6a6e('0x10'));var qs=require(_0x6a6e('0x11'));var as=require(_0x6a6e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6a6e('0x13'))(_0x6a6e('0x14'));var utils=require(_0x6a6e('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x6a6e('0x16'));var db=require(_0x6a6e('0x17'))['db'];function respondWithStatusCode(_0x5e973f,_0x4b1745){_0x4b1745=_0x4b1745||0xcc;return function(_0x4e8882){if(_0x4e8882){return _0x5e973f[_0x6a6e('0x18')](_0x4b1745);}return _0x5e973f[_0x6a6e('0x19')](_0x4b1745)[_0x6a6e('0x1a')]();};}function respondWithResult(_0x55b0d8,_0x1bc280){_0x1bc280=_0x1bc280||0xc8;return function(_0x5489c7){if(_0x5489c7){return _0x55b0d8['status'](_0x1bc280)[_0x6a6e('0x1b')](_0x5489c7);}};}function respondWithFilteredResult(_0x31281d,_0x11b0d0){return function(_0x5ccba6){if(_0x5ccba6){var _0x4a078c=typeof _0x11b0d0[_0x6a6e('0x1c')]==='undefined'&&typeof _0x11b0d0['limit']===_0x6a6e('0x1d');var _0x1b4f95=_0x5ccba6[_0x6a6e('0x1e')];var _0x4dc4bb=_0x4a078c?0x0:_0x11b0d0[_0x6a6e('0x1c')];var _0x50f75d=_0x4a078c?_0x5ccba6[_0x6a6e('0x1e')]:_0x11b0d0[_0x6a6e('0x1c')]+_0x11b0d0[_0x6a6e('0x1f')];var _0x2c2714;if(_0x50f75d>=_0x1b4f95){_0x50f75d=_0x1b4f95;_0x2c2714=0xc8;}else{_0x2c2714=0xce;}_0x31281d[_0x6a6e('0x19')](_0x2c2714);return _0x31281d[_0x6a6e('0x20')]('Content-Range',_0x4dc4bb+'-'+_0x50f75d+'/'+_0x1b4f95)[_0x6a6e('0x1b')](_0x5ccba6);}return null;};}function patchUpdates(_0x5969a9){return function(_0x22a095){try{jsonpatch['apply'](_0x22a095,_0x5969a9,!![]);}catch(_0x3e16c3){return BPromise[_0x6a6e('0x21')](_0x3e16c3);}return _0x22a095[_0x6a6e('0x22')]();};}function saveUpdates(_0x3a82d6,_0x3a683c){return function(_0xf6cfff){if(_0xf6cfff){return _0xf6cfff[_0x6a6e('0x23')](_0x3a82d6)[_0x6a6e('0x24')](function(_0x374840){return _0x374840;});}return null;};}function removeEntity(_0x5442d9,_0xe93053){return function(_0x9b13e4){if(_0x9b13e4){return _0x9b13e4['destroy']()['then'](function(){_0x5442d9[_0x6a6e('0x19')](0xcc)[_0x6a6e('0x1a')]();});}};}function handleEntityNotFound(_0x278170,_0x1fa03d){return function(_0x45e22e){if(!_0x45e22e){_0x278170[_0x6a6e('0x18')](0x194);}return _0x45e22e;};}function handleError(_0x157c9f,_0x3d1c9d){_0x3d1c9d=_0x3d1c9d||0x1f4;return function(_0x4e7ab1){logger[_0x6a6e('0x25')](_0x4e7ab1['stack']);if(_0x4e7ab1['name']){delete _0x4e7ab1['name'];}_0x157c9f[_0x6a6e('0x19')](_0x3d1c9d)[_0x6a6e('0x26')](_0x4e7ab1);};}exports[_0x6a6e('0x27')]=function(_0xf0b1a3,_0x40952d){var _0x4831f4={},_0x2066ff={},_0x217438={'count':0x0,'rows':[]};var _0x2a5b4c=_[_0x6a6e('0x28')](db['ZohoConfiguration'][_0x6a6e('0x29')],function(_0x3b0474){return{'name':_0x3b0474[_0x6a6e('0x2a')],'type':_0x3b0474[_0x6a6e('0x2b')][_0x6a6e('0x2c')]};});_0x2066ff[_0x6a6e('0x2d')]=_[_0x6a6e('0x28')](_0x2a5b4c,_0x6a6e('0x2e'));_0x2066ff['query']=_[_0x6a6e('0x2f')](_0xf0b1a3['query']);_0x2066ff[_0x6a6e('0x30')]=_[_0x6a6e('0x31')](_0x2066ff[_0x6a6e('0x2d')],_0x2066ff[_0x6a6e('0x32')]);_0x4831f4[_0x6a6e('0x33')]=_['intersection'](_0x2066ff[_0x6a6e('0x2d')],qs['fields'](_0xf0b1a3[_0x6a6e('0x32')][_0x6a6e('0x34')]));_0x4831f4[_0x6a6e('0x33')]=_0x4831f4['attributes'][_0x6a6e('0x35')]?_0x4831f4[_0x6a6e('0x33')]:_0x2066ff[_0x6a6e('0x2d')];if(!_0xf0b1a3['query'][_0x6a6e('0x36')]('nolimit')){_0x4831f4[_0x6a6e('0x1f')]=qs[_0x6a6e('0x1f')](_0xf0b1a3[_0x6a6e('0x32')][_0x6a6e('0x1f')]);_0x4831f4[_0x6a6e('0x1c')]=qs[_0x6a6e('0x1c')](_0xf0b1a3['query'][_0x6a6e('0x1c')]);}_0x4831f4[_0x6a6e('0x37')]=qs['sort'](_0xf0b1a3['query'][_0x6a6e('0x38')]);_0x4831f4[_0x6a6e('0x39')]=qs[_0x6a6e('0x30')](_[_0x6a6e('0x3a')](_0xf0b1a3['query'],_0x2066ff[_0x6a6e('0x30')]),_0x2a5b4c);if(_0xf0b1a3[_0x6a6e('0x32')][_0x6a6e('0x3b')]){_0x4831f4['where']=_[_0x6a6e('0x3c')](_0x4831f4[_0x6a6e('0x39')],{'$or':_[_0x6a6e('0x28')](_0x2a5b4c,function(_0x1ed5c2){if(_0x1ed5c2[_0x6a6e('0x2b')]!==_0x6a6e('0x3d')){var _0x3be0ee={};_0x3be0ee[_0x1ed5c2[_0x6a6e('0x2e')]]={'$like':'%'+_0xf0b1a3[_0x6a6e('0x32')][_0x6a6e('0x3b')]+'%'};return _0x3be0ee;}})});}_0x4831f4=_[_0x6a6e('0x3c')]({},_0x4831f4,_0xf0b1a3['options']);var _0xe9efbe={'where':_0x4831f4[_0x6a6e('0x39')]};return db[_0x6a6e('0x3e')]['count'](_0xe9efbe)[_0x6a6e('0x24')](function(_0x38a49d){_0x217438[_0x6a6e('0x1e')]=_0x38a49d;if(_0xf0b1a3[_0x6a6e('0x32')][_0x6a6e('0x3f')]){_0x4831f4[_0x6a6e('0x40')]=[{'all':!![]}];}return db[_0x6a6e('0x3e')][_0x6a6e('0x41')](_0x4831f4);})[_0x6a6e('0x24')](function(_0x32f733){_0x217438['rows']=_0x32f733;return _0x217438;})[_0x6a6e('0x24')](respondWithFilteredResult(_0x40952d,_0x4831f4))[_0x6a6e('0x42')](handleError(_0x40952d,null));};exports[_0x6a6e('0x43')]=function(_0x174ab0,_0x2e1643){var _0x2a9d45={'raw':![],'where':{'id':_0x174ab0['params']['id']}},_0x598956={};_0x598956[_0x6a6e('0x2d')]=_[_0x6a6e('0x2f')](db[_0x6a6e('0x3e')][_0x6a6e('0x29')]);_0x598956['query']=_[_0x6a6e('0x2f')](_0x174ab0['query']);_0x598956[_0x6a6e('0x30')]=_[_0x6a6e('0x31')](_0x598956[_0x6a6e('0x2d')],_0x598956[_0x6a6e('0x32')]);_0x2a9d45['attributes']=_[_0x6a6e('0x31')](_0x598956['model'],qs[_0x6a6e('0x34')](_0x174ab0[_0x6a6e('0x32')]['fields']));_0x2a9d45[_0x6a6e('0x33')]=_0x2a9d45[_0x6a6e('0x33')]['length']?_0x2a9d45[_0x6a6e('0x33')]:_0x598956[_0x6a6e('0x2d')];if(_0x174ab0[_0x6a6e('0x32')][_0x6a6e('0x3f')]){_0x2a9d45[_0x6a6e('0x40')]=[{'all':!![]}];}_0x2a9d45=_[_0x6a6e('0x3c')]({},_0x2a9d45,_0x174ab0['options']);return db[_0x6a6e('0x3e')]['find'](_0x2a9d45)['then'](handleEntityNotFound(_0x2e1643,null))[_0x6a6e('0x24')](respondWithResult(_0x2e1643,null))['catch'](handleError(_0x2e1643,null));};exports[_0x6a6e('0x44')]=function(_0x582f6a,_0x22b7ad){return db['ZohoConfiguration'][_0x6a6e('0x44')](_0x582f6a[_0x6a6e('0x45')],{})[_0x6a6e('0x24')](respondWithResult(_0x22b7ad,0xc9))[_0x6a6e('0x42')](handleError(_0x22b7ad,null));};exports['update']=function(_0x5b8876,_0x3d0711){if(_0x5b8876[_0x6a6e('0x45')]['id']){delete _0x5b8876[_0x6a6e('0x45')]['id'];}return db[_0x6a6e('0x3e')][_0x6a6e('0x46')]({'where':{'id':_0x5b8876[_0x6a6e('0x47')]['id']}})[_0x6a6e('0x24')](handleEntityNotFound(_0x3d0711,null))['then'](saveUpdates(_0x5b8876[_0x6a6e('0x45')],null))[_0x6a6e('0x24')](respondWithResult(_0x3d0711,null))['catch'](handleError(_0x3d0711,null));};exports[_0x6a6e('0x48')]=function(_0x2d5ba0,_0x44e422){return db[_0x6a6e('0x3e')][_0x6a6e('0x46')]({'where':{'id':_0x2d5ba0[_0x6a6e('0x47')]['id']}})['then'](handleEntityNotFound(_0x44e422,null))[_0x6a6e('0x24')](removeEntity(_0x44e422,null))['catch'](handleError(_0x44e422,null));};exports[_0x6a6e('0x49')]=function(_0x2eb960,_0x178a90,_0x114821){var _0xddef20={};var _0x131620={};var _0x31321d;var _0xb9012a;return db[_0x6a6e('0x3e')]['findOne']({'where':{'id':_0x2eb960[_0x6a6e('0x47')]['id']}})['then'](handleEntityNotFound(_0x178a90,null))[_0x6a6e('0x24')](function(_0x315737){if(_0x315737){_0x31321d=_0x315737;_0x131620['model']=_[_0x6a6e('0x2f')](db[_0x6a6e('0x4a')]['rawAttributes']);_0x131620['query']=_[_0x6a6e('0x2f')](_0x2eb960[_0x6a6e('0x32')]);_0x131620['filters']=_[_0x6a6e('0x31')](_0x131620[_0x6a6e('0x2d')],_0x131620[_0x6a6e('0x32')]);_0xddef20[_0x6a6e('0x33')]=_[_0x6a6e('0x31')](_0x131620[_0x6a6e('0x2d')],qs[_0x6a6e('0x34')](_0x2eb960['query'][_0x6a6e('0x34')]));_0xddef20[_0x6a6e('0x33')]=_0xddef20[_0x6a6e('0x33')][_0x6a6e('0x35')]?_0xddef20[_0x6a6e('0x33')]:_0x131620[_0x6a6e('0x2d')];_0xddef20['order']=qs[_0x6a6e('0x38')](_0x2eb960['query']['sort']);_0xddef20[_0x6a6e('0x39')]=qs[_0x6a6e('0x30')](_[_0x6a6e('0x3a')](_0x2eb960[_0x6a6e('0x32')],_0x131620[_0x6a6e('0x30')]));if(_0x2eb960['query'][_0x6a6e('0x3b')]){_0xddef20[_0x6a6e('0x39')]=_['merge'](_0xddef20['where'],{'$or':_[_0x6a6e('0x28')](_0xddef20[_0x6a6e('0x33')],function(_0x23004e){var _0x43c3e1={};_0x43c3e1[_0x23004e]={'$like':'%'+_0x2eb960[_0x6a6e('0x32')]['filter']+'%'};return _0x43c3e1;})});}_0xddef20=_['merge']({},_0xddef20,_0x2eb960[_0x6a6e('0x4b')]);return _0x31321d[_0x6a6e('0x49')](_0xddef20);}})[_0x6a6e('0x24')](function(_0x71569e){if(_0x71569e){_0xb9012a=_0x71569e[_0x6a6e('0x35')];if(!_0x2eb960[_0x6a6e('0x32')][_0x6a6e('0x36')](_0x6a6e('0x4c'))){_0xddef20[_0x6a6e('0x1f')]=qs[_0x6a6e('0x1f')](_0x2eb960[_0x6a6e('0x32')][_0x6a6e('0x1f')]);_0xddef20[_0x6a6e('0x1c')]=qs[_0x6a6e('0x1c')](_0x2eb960['query'][_0x6a6e('0x1c')]);}return _0x31321d[_0x6a6e('0x49')](_0xddef20);}})[_0x6a6e('0x24')](function(_0x56b6a8){if(_0x56b6a8){return _0x56b6a8?{'count':_0xb9012a,'rows':_0x56b6a8}:null;}})[_0x6a6e('0x24')](respondWithResult(_0x178a90,null))['catch'](handleError(_0x178a90,null));};exports[_0x6a6e('0x4d')]=function(_0xa0aebe,_0x2c4f77,_0x242806){var _0x54bb42={};var _0x4926f3={};var _0x8a7df1;var _0x181b98;return db['ZohoConfiguration'][_0x6a6e('0x4e')]({'where':{'id':_0xa0aebe[_0x6a6e('0x47')]['id']}})[_0x6a6e('0x24')](handleEntityNotFound(_0x2c4f77,null))[_0x6a6e('0x24')](function(_0x2a4404){if(_0x2a4404){_0x8a7df1=_0x2a4404;_0x4926f3[_0x6a6e('0x2d')]=_[_0x6a6e('0x2f')](db[_0x6a6e('0x4a')][_0x6a6e('0x29')]);_0x4926f3[_0x6a6e('0x32')]=_['keys'](_0xa0aebe[_0x6a6e('0x32')]);_0x4926f3[_0x6a6e('0x30')]=_[_0x6a6e('0x31')](_0x4926f3['model'],_0x4926f3[_0x6a6e('0x32')]);_0x54bb42[_0x6a6e('0x33')]=_[_0x6a6e('0x31')](_0x4926f3[_0x6a6e('0x2d')],qs[_0x6a6e('0x34')](_0xa0aebe[_0x6a6e('0x32')][_0x6a6e('0x34')]));_0x54bb42[_0x6a6e('0x33')]=_0x54bb42[_0x6a6e('0x33')][_0x6a6e('0x35')]?_0x54bb42[_0x6a6e('0x33')]:_0x4926f3[_0x6a6e('0x2d')];_0x54bb42[_0x6a6e('0x37')]=qs[_0x6a6e('0x38')](_0xa0aebe[_0x6a6e('0x32')]['sort']);_0x54bb42[_0x6a6e('0x39')]=qs[_0x6a6e('0x30')](_['pick'](_0xa0aebe[_0x6a6e('0x32')],_0x4926f3[_0x6a6e('0x30')]));if(_0xa0aebe[_0x6a6e('0x32')][_0x6a6e('0x3b')]){_0x54bb42[_0x6a6e('0x39')]=_[_0x6a6e('0x3c')](_0x54bb42[_0x6a6e('0x39')],{'$or':_[_0x6a6e('0x28')](_0x54bb42[_0x6a6e('0x33')],function(_0x27e1f3){var _0x179d19={};_0x179d19[_0x27e1f3]={'$like':'%'+_0xa0aebe[_0x6a6e('0x32')]['filter']+'%'};return _0x179d19;})});}_0x54bb42=_[_0x6a6e('0x3c')]({},_0x54bb42,_0xa0aebe[_0x6a6e('0x4b')]);return _0x8a7df1[_0x6a6e('0x4d')](_0x54bb42);}})[_0x6a6e('0x24')](function(_0x3522e5){if(_0x3522e5){_0x181b98=_0x3522e5[_0x6a6e('0x35')];if(!_0xa0aebe[_0x6a6e('0x32')][_0x6a6e('0x36')](_0x6a6e('0x4c'))){_0x54bb42['limit']=qs[_0x6a6e('0x1f')](_0xa0aebe['query'][_0x6a6e('0x1f')]);_0x54bb42['offset']=qs[_0x6a6e('0x1c')](_0xa0aebe[_0x6a6e('0x32')]['offset']);}return _0x8a7df1[_0x6a6e('0x4d')](_0x54bb42);}})[_0x6a6e('0x24')](function(_0x2a617d){if(_0x2a617d){return _0x2a617d?{'count':_0x181b98,'rows':_0x2a617d}:null;}})[_0x6a6e('0x24')](respondWithResult(_0x2c4f77,null))[_0x6a6e('0x42')](handleError(_0x2c4f77,null));};exports[_0x6a6e('0x4f')]=function(_0x46b207,_0x267d45,_0x5be82e){var _0x195025={};var _0x37f152={};var _0x4ffbc4;var _0x5db302;return db[_0x6a6e('0x3e')][_0x6a6e('0x4e')]({'where':{'id':_0x46b207['params']['id']}})[_0x6a6e('0x24')](handleEntityNotFound(_0x267d45,null))[_0x6a6e('0x24')](function(_0x3e61ec){if(_0x3e61ec){_0x4ffbc4=_0x3e61ec;_0x37f152[_0x6a6e('0x2d')]=_[_0x6a6e('0x2f')](db['ZohoField'][_0x6a6e('0x29')]);_0x37f152[_0x6a6e('0x32')]=_[_0x6a6e('0x2f')](_0x46b207['query']);_0x37f152[_0x6a6e('0x30')]=_[_0x6a6e('0x31')](_0x37f152[_0x6a6e('0x2d')],_0x37f152['query']);_0x195025[_0x6a6e('0x33')]=_[_0x6a6e('0x31')](_0x37f152['model'],qs[_0x6a6e('0x34')](_0x46b207[_0x6a6e('0x32')][_0x6a6e('0x34')]));_0x195025[_0x6a6e('0x33')]=_0x195025[_0x6a6e('0x33')][_0x6a6e('0x35')]?_0x195025[_0x6a6e('0x33')]:_0x37f152[_0x6a6e('0x2d')];_0x195025[_0x6a6e('0x37')]=qs['sort'](_0x46b207[_0x6a6e('0x32')][_0x6a6e('0x38')]);_0x195025[_0x6a6e('0x39')]=qs[_0x6a6e('0x30')](_[_0x6a6e('0x3a')](_0x46b207[_0x6a6e('0x32')],_0x37f152[_0x6a6e('0x30')]));if(_0x46b207[_0x6a6e('0x32')][_0x6a6e('0x3b')]){_0x195025[_0x6a6e('0x39')]=_[_0x6a6e('0x3c')](_0x195025[_0x6a6e('0x39')],{'$or':_[_0x6a6e('0x28')](_0x195025[_0x6a6e('0x33')],function(_0x50cdf6){var _0x528321={};_0x528321[_0x50cdf6]={'$like':'%'+_0x46b207[_0x6a6e('0x32')][_0x6a6e('0x3b')]+'%'};return _0x528321;})});}_0x195025=_[_0x6a6e('0x3c')]({},_0x195025,_0x46b207[_0x6a6e('0x4b')]);return _0x4ffbc4[_0x6a6e('0x4f')](_0x195025);}})[_0x6a6e('0x24')](function(_0x1f05ff){if(_0x1f05ff){_0x5db302=_0x1f05ff[_0x6a6e('0x35')];if(!_0x46b207[_0x6a6e('0x32')]['hasOwnProperty']('nolimit')){_0x195025[_0x6a6e('0x1f')]=qs[_0x6a6e('0x1f')](_0x46b207[_0x6a6e('0x32')][_0x6a6e('0x1f')]);_0x195025[_0x6a6e('0x1c')]=qs[_0x6a6e('0x1c')](_0x46b207[_0x6a6e('0x32')][_0x6a6e('0x1c')]);}return _0x4ffbc4[_0x6a6e('0x4f')](_0x195025);}})[_0x6a6e('0x24')](function(_0x3adf94){if(_0x3adf94){return _0x3adf94?{'count':_0x5db302,'rows':_0x3adf94}:null;}})[_0x6a6e('0x24')](respondWithResult(_0x267d45,null))['catch'](handleError(_0x267d45,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index c94f99d..d31f9fb 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 _0x7f25=['./intZohoConfiguration.attributes','exports','int_zoho_configurations','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x2161a9,_0x482cb6){var _0xfcef73=function(_0x1b7708){while(--_0x1b7708){_0x2161a9['push'](_0x2161a9['shift']());}};_0xfcef73(++_0x482cb6);}(_0x7f25,0x1ed));var _0x57f2=function(_0xd02def,_0x144f25){_0xd02def=_0xd02def-0x0;var _0x2e8374=_0x7f25[_0xd02def];return _0x2e8374;};'use strict';var _=require(_0x57f2('0x0'));var util=require(_0x57f2('0x1'));var logger=require(_0x57f2('0x2'))('api');var moment=require(_0x57f2('0x3'));var BPromise=require(_0x57f2('0x4'));var rp=require(_0x57f2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x57f2('0x6'));var config=require('../../config/environment');var attributes=require(_0x57f2('0x7'));module[_0x57f2('0x8')]=function(_0x1b9250,_0x3219c7){return _0x1b9250['define']('ZohoConfiguration',attributes,{'tableName':_0x57f2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5fa5=['rimraf','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','util','../../config/logger','api','bluebird','request-promise'];(function(_0x1120a0,_0x12e808){var _0x2820d6=function(_0xcf5b43){while(--_0xcf5b43){_0x1120a0['push'](_0x1120a0['shift']());}};_0x2820d6(++_0x12e808);}(_0x5fa5,0x109));var _0x55fa=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0x5fa5[_0xd0b415];return _0x2bdf2c;};'use strict';var _=require('lodash');var util=require(_0x55fa('0x0'));var logger=require(_0x55fa('0x1'))(_0x55fa('0x2'));var moment=require('moment');var BPromise=require(_0x55fa('0x3'));var rp=require(_0x55fa('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x55fa('0x5'));var config=require('../../config/environment');var attributes=require(_0x55fa('0x6'));module[_0x55fa('0x7')]=function(_0x2febb8,_0x32ff7b){return _0x2febb8[_0x55fa('0x8')](_0x55fa('0x9'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index 061e8a1..a1cb7b4 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 _0x6a4c=['stringify','error','code','message','util','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x45b1fa,_0x242474){var _0x514dfd=function(_0x151354){while(--_0x151354){_0x45b1fa['push'](_0x45b1fa['shift']());}};_0x514dfd(++_0x242474);}(_0x6a4c,0x1f3));var _0xc6a4=function(_0x3043a7,_0xdfc3db){_0x3043a7=_0x3043a7-0x0;var _0x4ee5a3=_0x6a4c[_0x3043a7];return _0x4ee5a3;};'use strict';var _=require('lodash');var util=require(_0xc6a4('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc6a4('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0xc6a4('0x2'));var logger=require(_0xc6a4('0x3'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc6a4('0x4'));var client=jayson[_0xc6a4('0x5')][_0xc6a4('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x302199,_0x3e8a28,_0x331148){return new BPromise(function(_0x5063e1,_0x457499){return client[_0xc6a4('0x7')](_0x302199,_0x331148)['then'](function(_0x3fdd00){logger[_0xc6a4('0x8')](_0xc6a4('0x9'),_0x3e8a28,_0xc6a4('0xa'));logger['debug']('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x3e8a28,_0xc6a4('0xa'),JSON[_0xc6a4('0xb')](_0x3fdd00));if(_0x3fdd00[_0xc6a4('0xc')]){if(_0x3fdd00[_0xc6a4('0xc')][_0xc6a4('0xd')]===0x1f4){logger[_0xc6a4('0xc')](_0xc6a4('0x9'),_0x3e8a28,_0x3fdd00[_0xc6a4('0xc')][_0xc6a4('0xe')]);return _0x457499(_0x3fdd00[_0xc6a4('0xc')][_0xc6a4('0xe')]);}logger['error'](_0xc6a4('0x9'),_0x3e8a28,_0x3fdd00['error'][_0xc6a4('0xe')]);return _0x5063e1(_0x3fdd00[_0xc6a4('0xc')][_0xc6a4('0xe')]);}else{logger[_0xc6a4('0x8')](_0xc6a4('0x9'),_0x3e8a28,_0xc6a4('0xa'));_0x5063e1(_0x3fdd00['result']['message']);}})['catch'](function(_0x130143){logger[_0xc6a4('0xc')](_0xc6a4('0x9'),_0x3e8a28,_0x130143);_0x457499(_0x130143);});});} \ No newline at end of file +var _0x87fa=['../../mysqldb','../../config/logger','rpc','client','http','request','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','ioredis'];(function(_0x4a713e,_0x146ef1){var _0x582aa5=function(_0x54394e){while(--_0x54394e){_0x4a713e['push'](_0x4a713e['shift']());}};_0x582aa5(++_0x146ef1);}(_0x87fa,0x17a));var _0xa87f=function(_0x330180,_0x3f0c3c){_0x330180=_0x330180-0x0;var _0x2f0741=_0x87fa[_0x330180];return _0x2f0741;};'use strict';var _=require('lodash');var util=require(_0xa87f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa87f('0x1'));var db=require(_0xa87f('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xa87f('0x3'))(_0xa87f('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa87f('0x5')][_0xa87f('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5266a1,_0x2b0e6d,_0x3b8fe6){return new BPromise(function(_0x1daf8e,_0x1eba27){return client[_0xa87f('0x7')](_0x5266a1,_0x3b8fe6)[_0xa87f('0x8')](function(_0x4889b7){logger['info'](_0xa87f('0x9'),_0x2b0e6d,_0xa87f('0xa'));logger[_0xa87f('0xb')](_0xa87f('0xc'),_0x2b0e6d,_0xa87f('0xa'),JSON[_0xa87f('0xd')](_0x4889b7));if(_0x4889b7[_0xa87f('0xe')]){if(_0x4889b7['error'][_0xa87f('0xf')]===0x1f4){logger[_0xa87f('0xe')](_0xa87f('0x9'),_0x2b0e6d,_0x4889b7[_0xa87f('0xe')]['message']);return _0x1eba27(_0x4889b7[_0xa87f('0xe')][_0xa87f('0x10')]);}logger[_0xa87f('0xe')](_0xa87f('0x9'),_0x2b0e6d,_0x4889b7['error'][_0xa87f('0x10')]);return _0x1daf8e(_0x4889b7['error'][_0xa87f('0x10')]);}else{logger[_0xa87f('0x11')](_0xa87f('0x9'),_0x2b0e6d,_0xa87f('0xa'));_0x1daf8e(_0x4889b7[_0xa87f('0x12')][_0xa87f('0x10')]);}})[_0xa87f('0x13')](function(_0x25b3b0){logger[_0xa87f('0xe')](_0xa87f('0x9'),_0x2b0e6d,_0x25b3b0);_0x1eba27(_0x25b3b0);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 05ad712..58e307a 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 _0x4504=['index','get','show','post','create','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated'];(function(_0x3716e6,_0x1a51df){var _0xd06104=function(_0x2127de){while(--_0x2127de){_0x3716e6['push'](_0x3716e6['shift']());}};_0xd06104(++_0x1a51df);}(_0x4504,0x14d));var _0x4450=function(_0x40ee8f,_0x54f7bf){_0x40ee8f=_0x40ee8f-0x0;var _0x363bb6=_0x4504[_0x40ee8f];return _0x363bb6;};'use strict';var multer=require(_0x4450('0x0'));var util=require(_0x4450('0x1'));var path=require(_0x4450('0x2'));var timeout=require(_0x4450('0x3'));var express=require(_0x4450('0x4'));var router=express['Router']();var fs_extra=require(_0x4450('0x5'));var auth=require(_0x4450('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4450('0x7'));var controller=require('./intZohoField.controller');router['get']('/',auth[_0x4450('0x8')](),controller[_0x4450('0x9')]);router[_0x4450('0xa')]('/:id',auth[_0x4450('0x8')](),controller[_0x4450('0xb')]);router[_0x4450('0xc')]('/',auth[_0x4450('0x8')](),controller[_0x4450('0xd')]);router['put']('/:id',auth[_0x4450('0x8')](),controller[_0x4450('0xe')]);router[_0x4450('0xf')](_0x4450('0x10'),auth[_0x4450('0x8')](),controller[_0x4450('0x11')]);module[_0x4450('0x12')]=router; \ No newline at end of file +var _0x4109=['../../config/environment','get','isAuthenticated','index','/:id','show','post','create','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3bdaab,_0x2578cd){var _0x75a7ce=function(_0x107806){while(--_0x107806){_0x3bdaab['push'](_0x3bdaab['shift']());}};_0x75a7ce(++_0x2578cd);}(_0x4109,0xe8));var _0x9410=function(_0x35a7f7,_0x499bae){_0x35a7f7=_0x35a7f7-0x0;var _0x545ac0=_0x4109[_0x35a7f7];return _0x545ac0;};'use strict';var multer=require(_0x9410('0x0'));var util=require(_0x9410('0x1'));var path=require('path');var timeout=require(_0x9410('0x2'));var express=require('express');var router=express[_0x9410('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9410('0x4'));var interaction=require(_0x9410('0x5'));var config=require(_0x9410('0x6'));var controller=require('./intZohoField.controller');router[_0x9410('0x7')]('/',auth[_0x9410('0x8')](),controller[_0x9410('0x9')]);router['get'](_0x9410('0xa'),auth[_0x9410('0x8')](),controller[_0x9410('0xb')]);router[_0x9410('0xc')]('/',auth[_0x9410('0x8')](),controller[_0x9410('0xd')]);router['put'](_0x9410('0xa'),auth[_0x9410('0x8')](),controller['update']);router[_0x9410('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x9410('0xf')]);module[_0x9410('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 3f2223b..49eff4c 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 _0xd92e=['exports','ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize'];(function(_0x2bcd69,_0x322ba2){var _0x2cfdd9=function(_0xc6cb5a){while(--_0xc6cb5a){_0x2bcd69['push'](_0x2bcd69['shift']());}};_0x2cfdd9(++_0x322ba2);}(_0xd92e,0xf2));var _0xed92=function(_0x427a09,_0x1ba036){_0x427a09=_0x427a09-0x0;var _0x3e99ff=_0xd92e[_0x427a09];return _0x3e99ff;};'use strict';var Sequelize=require(_0xed92('0x0'));module[_0xed92('0x1')]={'type':{'type':Sequelize[_0xed92('0x2')](_0xed92('0x3'),_0xed92('0x4'),_0xed92('0x5'),_0xed92('0x6'),'picklist'),'defaultValue':_0xed92('0x3')},'content':{'type':Sequelize[_0xed92('0x7')]},'key':{'type':Sequelize[_0xed92('0x7')]},'keyType':{'type':Sequelize[_0xed92('0x2')](_0xed92('0x3'),_0xed92('0x4'),_0xed92('0x5'))},'keyContent':{'type':Sequelize[_0xed92('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xed92('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xed92('0x7')]}}; \ No newline at end of file +var _0xfc27=['BOOLEAN','sequelize','exports','ENUM','variable','customVariable','string','STRING'];(function(_0xc4adf2,_0x26a4fc){var _0xbcdd6d=function(_0x229104){while(--_0x229104){_0xc4adf2['push'](_0xc4adf2['shift']());}};_0xbcdd6d(++_0x26a4fc);}(_0xfc27,0xc9));var _0x7fc2=function(_0x15acce,_0x234617){_0x15acce=_0x15acce-0x0;var _0x1c950e=_0xfc27[_0x15acce];return _0x1c950e;};'use strict';var Sequelize=require(_0x7fc2('0x0'));module[_0x7fc2('0x1')]={'type':{'type':Sequelize[_0x7fc2('0x2')]('string',_0x7fc2('0x3'),_0x7fc2('0x4'),'keyValue','picklist'),'defaultValue':_0x7fc2('0x5')},'content':{'type':Sequelize[_0x7fc2('0x6')]},'key':{'type':Sequelize[_0x7fc2('0x6')]},'keyType':{'type':Sequelize[_0x7fc2('0x2')](_0x7fc2('0x5'),'variable',_0x7fc2('0x4'))},'keyContent':{'type':Sequelize[_0x7fc2('0x6')]},'idField':{'type':Sequelize[_0x7fc2('0x6')]},'nameField':{'type':Sequelize[_0x7fc2('0x6')]},'customField':{'type':Sequelize[_0x7fc2('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7fc2('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 3f9555c..28d4119 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 _0x2825=['limit','count','set','Content-Range','apply','save','then','destroy','error','stack','name','send','index','map','ZohoField','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','where','merge','filter','options','includeAll','include','findAll','catch','show','length','find','create','body','update','params','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x46be5f,_0x170cab){var _0x192673=function(_0x304b3b){while(--_0x304b3b){_0x46be5f['push'](_0x46be5f['shift']());}};_0x192673(++_0x170cab);}(_0x2825,0x195));var _0x5282=function(_0x48c222,_0x5c2682){_0x48c222=_0x48c222-0x0;var _0x56f159=_0x2825[_0x48c222];return _0x56f159;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5282('0x0'));var moment=require(_0x5282('0x1'));var BPromise=require(_0x5282('0x2'));var Mustache=require('mustache');var util=require(_0x5282('0x3'));var path=require(_0x5282('0x4'));var sox=require(_0x5282('0x5'));var csv=require(_0x5282('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5282('0x7'));var _=require('lodash');var squel=require(_0x5282('0x8'));var crypto=require(_0x5282('0x9'));var jsforce=require(_0x5282('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x5282('0x6'));var querystring=require(_0x5282('0xb'));var Papa=require(_0x5282('0xc'));var Redis=require('ioredis');var authService=require(_0x5282('0xd'));var qs=require(_0x5282('0xe'));var as=require(_0x5282('0xf'));var hardwareService=require(_0x5282('0x10'));var logger=require(_0x5282('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x5282('0x12'));var licenseUtil=require(_0x5282('0x13'));var db=require(_0x5282('0x14'))['db'];function respondWithStatusCode(_0x502382,_0x89bfb){_0x89bfb=_0x89bfb||0xcc;return function(_0x4d5c9d){if(_0x4d5c9d){return _0x502382[_0x5282('0x15')](_0x89bfb);}return _0x502382[_0x5282('0x16')](_0x89bfb)[_0x5282('0x17')]();};}function respondWithResult(_0x50acd2,_0x55ca18){_0x55ca18=_0x55ca18||0xc8;return function(_0x1cb6a4){if(_0x1cb6a4){return _0x50acd2[_0x5282('0x16')](_0x55ca18)[_0x5282('0x18')](_0x1cb6a4);}};}function respondWithFilteredResult(_0x16f43b,_0x49da44){return function(_0x176977){if(_0x176977){var _0x379867=typeof _0x49da44[_0x5282('0x19')]===_0x5282('0x1a')&&typeof _0x49da44[_0x5282('0x1b')]===_0x5282('0x1a');var _0x9f5df9=_0x176977['count'];var _0x52909a=_0x379867?0x0:_0x49da44[_0x5282('0x19')];var _0x15efff=_0x379867?_0x176977[_0x5282('0x1c')]:_0x49da44[_0x5282('0x19')]+_0x49da44[_0x5282('0x1b')];var _0x5e8e98;if(_0x15efff>=_0x9f5df9){_0x15efff=_0x9f5df9;_0x5e8e98=0xc8;}else{_0x5e8e98=0xce;}_0x16f43b['status'](_0x5e8e98);return _0x16f43b[_0x5282('0x1d')](_0x5282('0x1e'),_0x52909a+'-'+_0x15efff+'/'+_0x9f5df9)['json'](_0x176977);}return null;};}function patchUpdates(_0x35b216){return function(_0x268b79){try{jsonpatch[_0x5282('0x1f')](_0x268b79,_0x35b216,!![]);}catch(_0xaa9d6e){return BPromise['reject'](_0xaa9d6e);}return _0x268b79[_0x5282('0x20')]();};}function saveUpdates(_0x186be3,_0x16bb7d){return function(_0x9779a5){if(_0x9779a5){return _0x9779a5['update'](_0x186be3)[_0x5282('0x21')](function(_0x3b63db){return _0x3b63db;});}return null;};}function removeEntity(_0x1dcf81,_0x1ef536){return function(_0xb51465){if(_0xb51465){return _0xb51465[_0x5282('0x22')]()[_0x5282('0x21')](function(){_0x1dcf81[_0x5282('0x16')](0xcc)[_0x5282('0x17')]();});}};}function handleEntityNotFound(_0x21877e,_0x29a004){return function(_0x4505e9){if(!_0x4505e9){_0x21877e['sendStatus'](0x194);}return _0x4505e9;};}function handleError(_0x4c1db7,_0x23c5de){_0x23c5de=_0x23c5de||0x1f4;return function(_0x459a97){logger[_0x5282('0x23')](_0x459a97[_0x5282('0x24')]);if(_0x459a97[_0x5282('0x25')]){delete _0x459a97[_0x5282('0x25')];}_0x4c1db7[_0x5282('0x16')](_0x23c5de)[_0x5282('0x26')](_0x459a97);};}exports[_0x5282('0x27')]=function(_0x389f91,_0x44ca3a){var _0x5ad30d={},_0x11047a={},_0x1caf5a={'count':0x0,'rows':[]};var _0x19eb01=_[_0x5282('0x28')](db[_0x5282('0x29')][_0x5282('0x2a')],function(_0x59620d){return{'name':_0x59620d['fieldName'],'type':_0x59620d[_0x5282('0x2b')][_0x5282('0x2c')]};});_0x11047a[_0x5282('0x2d')]=_[_0x5282('0x28')](_0x19eb01,_0x5282('0x25'));_0x11047a['query']=_[_0x5282('0x2e')](_0x389f91[_0x5282('0x2f')]);_0x11047a[_0x5282('0x30')]=_[_0x5282('0x31')](_0x11047a[_0x5282('0x2d')],_0x11047a[_0x5282('0x2f')]);_0x5ad30d['attributes']=_[_0x5282('0x31')](_0x11047a[_0x5282('0x2d')],qs[_0x5282('0x32')](_0x389f91[_0x5282('0x2f')][_0x5282('0x32')]));_0x5ad30d[_0x5282('0x33')]=_0x5ad30d['attributes']['length']?_0x5ad30d[_0x5282('0x33')]:_0x11047a['model'];if(!_0x389f91['query'][_0x5282('0x34')](_0x5282('0x35'))){_0x5ad30d[_0x5282('0x1b')]=qs['limit'](_0x389f91[_0x5282('0x2f')][_0x5282('0x1b')]);_0x5ad30d[_0x5282('0x19')]=qs[_0x5282('0x19')](_0x389f91[_0x5282('0x2f')][_0x5282('0x19')]);}_0x5ad30d[_0x5282('0x36')]=qs[_0x5282('0x37')](_0x389f91[_0x5282('0x2f')][_0x5282('0x37')]);_0x5ad30d['where']=qs[_0x5282('0x30')](_[_0x5282('0x38')](_0x389f91[_0x5282('0x2f')],_0x11047a['filters']),_0x19eb01);if(_0x389f91['query']['filter']){_0x5ad30d[_0x5282('0x39')]=_[_0x5282('0x3a')](_0x5ad30d[_0x5282('0x39')],{'$or':_[_0x5282('0x28')](_0x19eb01,function(_0x167bbb){if(_0x167bbb['type']!=='VIRTUAL'){var _0x3b27ae={};_0x3b27ae[_0x167bbb[_0x5282('0x25')]]={'$like':'%'+_0x389f91[_0x5282('0x2f')][_0x5282('0x3b')]+'%'};return _0x3b27ae;}})});}_0x5ad30d=_[_0x5282('0x3a')]({},_0x5ad30d,_0x389f91[_0x5282('0x3c')]);var _0x7bcf28={'where':_0x5ad30d[_0x5282('0x39')]};return db[_0x5282('0x29')][_0x5282('0x1c')](_0x7bcf28)['then'](function(_0x170242){_0x1caf5a[_0x5282('0x1c')]=_0x170242;if(_0x389f91['query'][_0x5282('0x3d')]){_0x5ad30d[_0x5282('0x3e')]=[{'all':!![]}];}return db[_0x5282('0x29')][_0x5282('0x3f')](_0x5ad30d);})[_0x5282('0x21')](function(_0x4d61cd){_0x1caf5a['rows']=_0x4d61cd;return _0x1caf5a;})['then'](respondWithFilteredResult(_0x44ca3a,_0x5ad30d))[_0x5282('0x40')](handleError(_0x44ca3a,null));};exports[_0x5282('0x41')]=function(_0x486211,_0x236ebe){var _0x13dbf3={'raw':!![],'where':{'id':_0x486211['params']['id']}},_0x59b965={};_0x59b965['model']=_[_0x5282('0x2e')](db[_0x5282('0x29')][_0x5282('0x2a')]);_0x59b965[_0x5282('0x2f')]=_[_0x5282('0x2e')](_0x486211[_0x5282('0x2f')]);_0x59b965[_0x5282('0x30')]=_[_0x5282('0x31')](_0x59b965['model'],_0x59b965[_0x5282('0x2f')]);_0x13dbf3[_0x5282('0x33')]=_[_0x5282('0x31')](_0x59b965['model'],qs[_0x5282('0x32')](_0x486211['query'][_0x5282('0x32')]));_0x13dbf3[_0x5282('0x33')]=_0x13dbf3[_0x5282('0x33')][_0x5282('0x42')]?_0x13dbf3[_0x5282('0x33')]:_0x59b965[_0x5282('0x2d')];if(_0x486211[_0x5282('0x2f')]['includeAll']){_0x13dbf3[_0x5282('0x3e')]=[{'all':!![]}];}_0x13dbf3=_[_0x5282('0x3a')]({},_0x13dbf3,_0x486211[_0x5282('0x3c')]);return db['ZohoField'][_0x5282('0x43')](_0x13dbf3)[_0x5282('0x21')](handleEntityNotFound(_0x236ebe,null))[_0x5282('0x21')](respondWithResult(_0x236ebe,null))[_0x5282('0x40')](handleError(_0x236ebe,null));};exports['create']=function(_0x51cb7a,_0x485d78){return db['ZohoField'][_0x5282('0x44')](_0x51cb7a[_0x5282('0x45')],{})['then'](respondWithResult(_0x485d78,0xc9))[_0x5282('0x40')](handleError(_0x485d78,null));};exports[_0x5282('0x46')]=function(_0x5aff58,_0x509372){if(_0x5aff58[_0x5282('0x45')]['id']){delete _0x5aff58[_0x5282('0x45')]['id'];}return db[_0x5282('0x29')][_0x5282('0x43')]({'where':{'id':_0x5aff58[_0x5282('0x47')]['id']}})['then'](handleEntityNotFound(_0x509372,null))[_0x5282('0x21')](saveUpdates(_0x5aff58['body'],null))[_0x5282('0x21')](respondWithResult(_0x509372,null))[_0x5282('0x40')](handleError(_0x509372,null));};exports[_0x5282('0x22')]=function(_0x5c1e83,_0xea9cb8){return db[_0x5282('0x29')][_0x5282('0x43')]({'where':{'id':_0x5c1e83[_0x5282('0x47')]['id']}})[_0x5282('0x21')](handleEntityNotFound(_0xea9cb8,null))[_0x5282('0x21')](removeEntity(_0xea9cb8,null))['catch'](handleError(_0xea9cb8,null));}; \ No newline at end of file +var _0xafe1=['key','model','query','intersection','fields','attributes','length','nolimit','order','where','filters','pick','filter','VIRTUAL','merge','options','ZohoField','includeAll','include','findAll','rows','catch','show','keys','create','body','params','find','eml-format','rimraf','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/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','reject','save','update','then','destroy','error','name','index','map','rawAttributes','fieldName','type'];(function(_0x54b415,_0x3fbd4e){var _0x43f23a=function(_0x15c41e){while(--_0x15c41e){_0x54b415['push'](_0x54b415['shift']());}};_0x43f23a(++_0x3fbd4e);}(_0xafe1,0x100));var _0x1afe=function(_0x47f7c1,_0x3f5dd2){_0x47f7c1=_0x47f7c1-0x0;var _0xdfa709=_0xafe1[_0x47f7c1];return _0xdfa709;};'use strict';var emlformat=require(_0x1afe('0x0'));var rimraf=require(_0x1afe('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1afe('0x2'));var rp=require(_0x1afe('0x3'));var moment=require(_0x1afe('0x4'));var BPromise=require(_0x1afe('0x5'));var Mustache=require('mustache');var util=require(_0x1afe('0x6'));var path=require(_0x1afe('0x7'));var sox=require(_0x1afe('0x8'));var csv=require(_0x1afe('0x9'));var ejs=require(_0x1afe('0xa'));var fs=require('fs');var fs_extra=require(_0x1afe('0xb'));var _=require(_0x1afe('0xc'));var squel=require(_0x1afe('0xd'));var crypto=require(_0x1afe('0xe'));var jsforce=require(_0x1afe('0xf'));var deskjs=require(_0x1afe('0x10'));var toCsv=require('to-csv');var querystring=require(_0x1afe('0x11'));var Papa=require(_0x1afe('0x12'));var Redis=require(_0x1afe('0x13'));var authService=require(_0x1afe('0x14'));var qs=require(_0x1afe('0x15'));var as=require(_0x1afe('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x1afe('0x17'));var config=require(_0x1afe('0x18'));var licenseUtil=require(_0x1afe('0x19'));var db=require(_0x1afe('0x1a'))['db'];function respondWithStatusCode(_0x4ac00a,_0x55a8e1){_0x55a8e1=_0x55a8e1||0xcc;return function(_0x1d4020){if(_0x1d4020){return _0x4ac00a[_0x1afe('0x1b')](_0x55a8e1);}return _0x4ac00a['status'](_0x55a8e1)[_0x1afe('0x1c')]();};}function respondWithResult(_0x5ed9b4,_0x9d615e){_0x9d615e=_0x9d615e||0xc8;return function(_0x525d9e){if(_0x525d9e){return _0x5ed9b4[_0x1afe('0x1d')](_0x9d615e)[_0x1afe('0x1e')](_0x525d9e);}};}function respondWithFilteredResult(_0x306040,_0x3e9638){return function(_0x5dc86a){if(_0x5dc86a){var _0xc68344=typeof _0x3e9638[_0x1afe('0x1f')]===_0x1afe('0x20')&&typeof _0x3e9638['limit']==='undefined';var _0x3f73b5=_0x5dc86a[_0x1afe('0x21')];var _0x1621b8=_0xc68344?0x0:_0x3e9638[_0x1afe('0x1f')];var _0x338e65=_0xc68344?_0x5dc86a[_0x1afe('0x21')]:_0x3e9638[_0x1afe('0x1f')]+_0x3e9638[_0x1afe('0x22')];var _0x57955b;if(_0x338e65>=_0x3f73b5){_0x338e65=_0x3f73b5;_0x57955b=0xc8;}else{_0x57955b=0xce;}_0x306040[_0x1afe('0x1d')](_0x57955b);return _0x306040['set'](_0x1afe('0x23'),_0x1621b8+'-'+_0x338e65+'/'+_0x3f73b5)['json'](_0x5dc86a);}return null;};}function patchUpdates(_0x419e0b){return function(_0x393558){try{jsonpatch['apply'](_0x393558,_0x419e0b,!![]);}catch(_0x80bad5){return BPromise[_0x1afe('0x24')](_0x80bad5);}return _0x393558[_0x1afe('0x25')]();};}function saveUpdates(_0x51c055,_0x120cee){return function(_0x33b37b){if(_0x33b37b){return _0x33b37b[_0x1afe('0x26')](_0x51c055)[_0x1afe('0x27')](function(_0x46472b){return _0x46472b;});}return null;};}function removeEntity(_0x4ff238,_0x4e6bfd){return function(_0x4ee7e4){if(_0x4ee7e4){return _0x4ee7e4[_0x1afe('0x28')]()[_0x1afe('0x27')](function(){_0x4ff238[_0x1afe('0x1d')](0xcc)[_0x1afe('0x1c')]();});}};}function handleEntityNotFound(_0x2bf008,_0x1b72d1){return function(_0x17b024){if(!_0x17b024){_0x2bf008[_0x1afe('0x1b')](0x194);}return _0x17b024;};}function handleError(_0x390994,_0x35eb8c){_0x35eb8c=_0x35eb8c||0x1f4;return function(_0x33bb18){logger[_0x1afe('0x29')](_0x33bb18['stack']);if(_0x33bb18[_0x1afe('0x2a')]){delete _0x33bb18[_0x1afe('0x2a')];}_0x390994['status'](_0x35eb8c)['send'](_0x33bb18);};}exports[_0x1afe('0x2b')]=function(_0x1c1607,_0x9386ab){var _0x4ec76e={},_0x16ac88={},_0x1dd0ed={'count':0x0,'rows':[]};var _0x525ee3=_[_0x1afe('0x2c')](db['ZohoField'][_0x1afe('0x2d')],function(_0x3a3827){return{'name':_0x3a3827[_0x1afe('0x2e')],'type':_0x3a3827[_0x1afe('0x2f')][_0x1afe('0x30')]};});_0x16ac88[_0x1afe('0x31')]=_[_0x1afe('0x2c')](_0x525ee3,'name');_0x16ac88[_0x1afe('0x32')]=_['keys'](_0x1c1607[_0x1afe('0x32')]);_0x16ac88['filters']=_[_0x1afe('0x33')](_0x16ac88[_0x1afe('0x31')],_0x16ac88[_0x1afe('0x32')]);_0x4ec76e['attributes']=_[_0x1afe('0x33')](_0x16ac88[_0x1afe('0x31')],qs[_0x1afe('0x34')](_0x1c1607['query'][_0x1afe('0x34')]));_0x4ec76e['attributes']=_0x4ec76e[_0x1afe('0x35')][_0x1afe('0x36')]?_0x4ec76e['attributes']:_0x16ac88[_0x1afe('0x31')];if(!_0x1c1607[_0x1afe('0x32')]['hasOwnProperty'](_0x1afe('0x37'))){_0x4ec76e[_0x1afe('0x22')]=qs['limit'](_0x1c1607[_0x1afe('0x32')][_0x1afe('0x22')]);_0x4ec76e['offset']=qs[_0x1afe('0x1f')](_0x1c1607[_0x1afe('0x32')][_0x1afe('0x1f')]);}_0x4ec76e[_0x1afe('0x38')]=qs['sort'](_0x1c1607[_0x1afe('0x32')]['sort']);_0x4ec76e[_0x1afe('0x39')]=qs[_0x1afe('0x3a')](_[_0x1afe('0x3b')](_0x1c1607[_0x1afe('0x32')],_0x16ac88[_0x1afe('0x3a')]),_0x525ee3);if(_0x1c1607[_0x1afe('0x32')][_0x1afe('0x3c')]){_0x4ec76e[_0x1afe('0x39')]=_['merge'](_0x4ec76e[_0x1afe('0x39')],{'$or':_[_0x1afe('0x2c')](_0x525ee3,function(_0x381efa){if(_0x381efa[_0x1afe('0x2f')]!==_0x1afe('0x3d')){var _0x381eb5={};_0x381eb5[_0x381efa[_0x1afe('0x2a')]]={'$like':'%'+_0x1c1607[_0x1afe('0x32')]['filter']+'%'};return _0x381eb5;}})});}_0x4ec76e=_[_0x1afe('0x3e')]({},_0x4ec76e,_0x1c1607[_0x1afe('0x3f')]);var _0x54bb62={'where':_0x4ec76e[_0x1afe('0x39')]};return db[_0x1afe('0x40')]['count'](_0x54bb62)[_0x1afe('0x27')](function(_0x1a07a8){_0x1dd0ed[_0x1afe('0x21')]=_0x1a07a8;if(_0x1c1607[_0x1afe('0x32')][_0x1afe('0x41')]){_0x4ec76e[_0x1afe('0x42')]=[{'all':!![]}];}return db[_0x1afe('0x40')][_0x1afe('0x43')](_0x4ec76e);})[_0x1afe('0x27')](function(_0x3eb985){_0x1dd0ed[_0x1afe('0x44')]=_0x3eb985;return _0x1dd0ed;})[_0x1afe('0x27')](respondWithFilteredResult(_0x9386ab,_0x4ec76e))[_0x1afe('0x45')](handleError(_0x9386ab,null));};exports[_0x1afe('0x46')]=function(_0x10a870,_0x6c4fdc){var _0x9bc82d={'raw':!![],'where':{'id':_0x10a870['params']['id']}},_0x1b7ba6={};_0x1b7ba6[_0x1afe('0x31')]=_[_0x1afe('0x47')](db['ZohoField'][_0x1afe('0x2d')]);_0x1b7ba6[_0x1afe('0x32')]=_['keys'](_0x10a870[_0x1afe('0x32')]);_0x1b7ba6[_0x1afe('0x3a')]=_[_0x1afe('0x33')](_0x1b7ba6[_0x1afe('0x31')],_0x1b7ba6[_0x1afe('0x32')]);_0x9bc82d[_0x1afe('0x35')]=_[_0x1afe('0x33')](_0x1b7ba6[_0x1afe('0x31')],qs[_0x1afe('0x34')](_0x10a870['query']['fields']));_0x9bc82d[_0x1afe('0x35')]=_0x9bc82d[_0x1afe('0x35')][_0x1afe('0x36')]?_0x9bc82d['attributes']:_0x1b7ba6[_0x1afe('0x31')];if(_0x10a870['query'][_0x1afe('0x41')]){_0x9bc82d[_0x1afe('0x42')]=[{'all':!![]}];}_0x9bc82d=_[_0x1afe('0x3e')]({},_0x9bc82d,_0x10a870['options']);return db['ZohoField']['find'](_0x9bc82d)[_0x1afe('0x27')](handleEntityNotFound(_0x6c4fdc,null))['then'](respondWithResult(_0x6c4fdc,null))['catch'](handleError(_0x6c4fdc,null));};exports[_0x1afe('0x48')]=function(_0x3e1277,_0x1a6c69){return db[_0x1afe('0x40')]['create'](_0x3e1277[_0x1afe('0x49')],{})[_0x1afe('0x27')](respondWithResult(_0x1a6c69,0xc9))[_0x1afe('0x45')](handleError(_0x1a6c69,null));};exports['update']=function(_0x48bb84,_0x100dbb){if(_0x48bb84[_0x1afe('0x49')]['id']){delete _0x48bb84[_0x1afe('0x49')]['id'];}return db[_0x1afe('0x40')]['find']({'where':{'id':_0x48bb84[_0x1afe('0x4a')]['id']}})[_0x1afe('0x27')](handleEntityNotFound(_0x100dbb,null))[_0x1afe('0x27')](saveUpdates(_0x48bb84[_0x1afe('0x49')],null))['then'](respondWithResult(_0x100dbb,null))['catch'](handleError(_0x100dbb,null));};exports[_0x1afe('0x28')]=function(_0x709c0,_0x367990){return db['ZohoField'][_0x1afe('0x4b')]({'where':{'id':_0x709c0[_0x1afe('0x4a')]['id']}})[_0x1afe('0x27')](handleEntityNotFound(_0x367990,null))[_0x1afe('0x27')](removeEntity(_0x367990,null))[_0x1afe('0x45')](handleError(_0x367990,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 9b069fd..9fe7912 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 _0x2a07=['api','moment','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0x1eaa74,_0xcbbafc){var _0x2fd0e0=function(_0x14eafa){while(--_0x14eafa){_0x1eaa74['push'](_0x1eaa74['shift']());}};_0x2fd0e0(++_0xcbbafc);}(_0x2a07,0x74));var _0x72a0=function(_0x589eb4,_0xaa2019){_0x589eb4=_0x589eb4-0x0;var _0xf50816=_0x2a07[_0x589eb4];return _0xf50816;};'use strict';var _=require(_0x72a0('0x0'));var util=require(_0x72a0('0x1'));var logger=require(_0x72a0('0x2'))(_0x72a0('0x3'));var moment=require(_0x72a0('0x4'));var BPromise=require('bluebird');var rp=require(_0x72a0('0x5'));var fs=require('fs');var path=require(_0x72a0('0x6'));var rimraf=require(_0x72a0('0x7'));var config=require(_0x72a0('0x8'));var attributes=require(_0x72a0('0x9'));module[_0x72a0('0xa')]=function(_0x3ccf6d,_0x20dab9){return _0x3ccf6d[_0x72a0('0xb')](_0x72a0('0xc'),attributes,{'tableName':_0x72a0('0xd'),'paranoid':![],'indexes':[{'name':_0x72a0('0xe'),'fields':[_0x72a0('0xf'),_0x72a0('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3a6d=['../../config/environment','./intZohoField.attributes','exports','define','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x558c14,_0x433dc1){var _0x1d8a3c=function(_0xe1edfb){while(--_0xe1edfb){_0x558c14['push'](_0x558c14['shift']());}};_0x1d8a3c(++_0x433dc1);}(_0x3a6d,0x143));var _0xd3a6=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x3a6d[_0x2070da];return _0x4f9fe1;};'use strict';var _=require(_0xd3a6('0x0'));var util=require(_0xd3a6('0x1'));var logger=require('../../config/logger')(_0xd3a6('0x2'));var moment=require(_0xd3a6('0x3'));var BPromise=require(_0xd3a6('0x4'));var rp=require(_0xd3a6('0x5'));var fs=require('fs');var path=require(_0xd3a6('0x6'));var rimraf=require('rimraf');var config=require(_0xd3a6('0x7'));var attributes=require(_0xd3a6('0x8'));module[_0xd3a6('0x9')]=function(_0x1fc450,_0x25b042){return _0x1fc450[_0xd3a6('0xa')]('ZohoField',attributes,{'tableName':_0xd3a6('0xb'),'paranoid':![],'indexes':[{'name':_0xd3a6('0xc'),'fields':[_0xd3a6('0xd'),_0xd3a6('0xe')],'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 e519597..877acdc 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 _0xf0e6=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xf0e6,0x16e));var _0x6f0e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf0e6[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6f0e('0x0'));var util=require('util');var moment=require(_0x6f0e('0x1'));var BPromise=require(_0x6f0e('0x2'));var rs=require(_0x6f0e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6f0e('0x4'))['db'];var utils=require(_0x6f0e('0x5'));var logger=require('../../config/logger')(_0x6f0e('0x6'));var config=require(_0x6f0e('0x7'));var jayson=require(_0x6f0e('0x8'));var client=jayson[_0x6f0e('0x9')][_0x6f0e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x57d817,_0x51c1eb,_0x344e0a){return new BPromise(function(_0x6bfc01,_0x4a1104){return client[_0x6f0e('0xb')](_0x57d817,_0x344e0a)[_0x6f0e('0xc')](function(_0x23ddfc){logger[_0x6f0e('0xd')](_0x6f0e('0xe'),_0x51c1eb,_0x6f0e('0xf'));logger[_0x6f0e('0x10')](_0x6f0e('0x11'),_0x51c1eb,_0x6f0e('0xf'),JSON[_0x6f0e('0x12')](_0x23ddfc));if(_0x23ddfc[_0x6f0e('0x13')]){if(_0x23ddfc[_0x6f0e('0x13')][_0x6f0e('0x14')]===0x1f4){logger[_0x6f0e('0x13')](_0x6f0e('0xe'),_0x51c1eb,_0x23ddfc['error'][_0x6f0e('0x15')]);return _0x4a1104(_0x23ddfc[_0x6f0e('0x13')][_0x6f0e('0x15')]);}logger['error'](_0x6f0e('0xe'),_0x51c1eb,_0x23ddfc[_0x6f0e('0x13')][_0x6f0e('0x15')]);return _0x6bfc01(_0x23ddfc[_0x6f0e('0x13')][_0x6f0e('0x15')]);}else{logger[_0x6f0e('0xd')]('ZohoField,\x20%s,\x20%s',_0x51c1eb,_0x6f0e('0xf'));_0x6bfc01(_0x23ddfc[_0x6f0e('0x16')][_0x6f0e('0x15')]);}})[_0x6f0e('0x17')](function(_0x3a99be){logger['error'](_0x6f0e('0xe'),_0x51c1eb,_0x3a99be);_0x4a1104(_0x3a99be);});});} \ No newline at end of file +var _0x04a3=['result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x441994,_0x4df14c){var _0x390707=function(_0x4a0a8d){while(--_0x4a0a8d){_0x441994['push'](_0x441994['shift']());}};_0x390707(++_0x4df14c);}(_0x04a3,0xaa));var _0x304a=function(_0x54f8cb,_0xa8994e){_0x54f8cb=_0x54f8cb-0x0;var _0x4a1d18=_0x04a3[_0x54f8cb];return _0x4a1d18;};'use strict';var _=require(_0x304a('0x0'));var util=require(_0x304a('0x1'));var moment=require(_0x304a('0x2'));var BPromise=require(_0x304a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x304a('0x4'))['db'];var utils=require(_0x304a('0x5'));var logger=require(_0x304a('0x6'))(_0x304a('0x7'));var config=require(_0x304a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x304a('0x9')][_0x304a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25c867,_0x39be8b,_0x4a4472){return new BPromise(function(_0x326aeb,_0x388628){return client[_0x304a('0xb')](_0x25c867,_0x4a4472)[_0x304a('0xc')](function(_0x8cca1e){logger[_0x304a('0xd')](_0x304a('0xe'),_0x39be8b,_0x304a('0xf'));logger[_0x304a('0x10')](_0x304a('0x11'),_0x39be8b,_0x304a('0xf'),JSON[_0x304a('0x12')](_0x8cca1e));if(_0x8cca1e['error']){if(_0x8cca1e[_0x304a('0x13')][_0x304a('0x14')]===0x1f4){logger['error'](_0x304a('0xe'),_0x39be8b,_0x8cca1e[_0x304a('0x13')]['message']);return _0x388628(_0x8cca1e[_0x304a('0x13')]['message']);}logger['error'](_0x304a('0xe'),_0x39be8b,_0x8cca1e[_0x304a('0x13')][_0x304a('0x15')]);return _0x326aeb(_0x8cca1e[_0x304a('0x13')][_0x304a('0x15')]);}else{logger[_0x304a('0xd')](_0x304a('0xe'),_0x39be8b,_0x304a('0xf'));_0x326aeb(_0x8cca1e[_0x304a('0x16')]['message']);}})[_0x304a('0x17')](function(_0x4d8e78){logger[_0x304a('0x13')]('ZohoField,\x20%s,\x20%s',_0x39be8b,_0x4d8e78);_0x388628(_0x4d8e78);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 8160226..54935aa 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0xe7f153,_0xe07497){var _0x5b452b=function(_0x119164){while(--_0x119164){_0xe7f153['push'](_0xe7f153['shift']());}};_0x5b452b(++_0xe07497);}(_0x9c44,0x178));var _0x49c4=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x9c44[_0x5d2803];return _0xdcad2c;};'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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x59145a,_0x1f60f1){var _0xf04d7=function(_0x247581){while(--_0x247581){_0x59145a['push'](_0x59145a['shift']());}};_0xf04d7(++_0x1f60f1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 7651ccd..3a0e96e 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 _0x94df=['INTEGER','BOOLEAN','state','sequelize','exports','STRING','unique_name_and_version','app.js'];(function(_0x5aa373,_0x54c7f4){var _0x590e8e=function(_0x505e62){while(--_0x505e62){_0x5aa373['push'](_0x5aa373['shift']());}};_0x590e8e(++_0x54c7f4);}(_0x94df,0xa3));var _0xf94d=function(_0x33321f,_0x5122ec){_0x33321f=_0x33321f-0x0;var _0x5dc246=_0x94df[_0x33321f];return _0x5dc246;};'use strict';var Sequelize=require(_0xf94d('0x0'));module[_0xf94d('0x1')]={'name':{'type':Sequelize[_0xf94d('0x2')],'allowNull':![],'unique':_0xf94d('0x3')},'version':{'type':Sequelize[_0xf94d('0x2')],'allowNull':![],'unique':_0xf94d('0x3')},'main':{'type':Sequelize['STRING'],'defaultValue':_0xf94d('0x4')},'filename':{'type':Sequelize[_0xf94d('0x2')]},'path':{'type':Sequelize[_0xf94d('0x2')]},'type':{'type':Sequelize[_0xf94d('0x2')]},'size':{'type':Sequelize[_0xf94d('0x5')]},'active':{'type':Sequelize[_0xf94d('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0xf94d('0x2')]},'logo':{'type':Sequelize[_0xf94d('0x2')]},'state':{'type':Sequelize[_0xf94d('0x2')],'unique':_0xf94d('0x7')},'description':{'type':Sequelize[_0xf94d('0x2')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xf94d('0x2')]},'link':{'type':Sequelize[_0xf94d('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0x9ef8=['sequelize','STRING','unique_name_and_version','app.js','INTEGER'];(function(_0x4e2a88,_0x3ccd60){var _0x280579=function(_0x570af5){while(--_0x570af5){_0x4e2a88['push'](_0x4e2a88['shift']());}};_0x280579(++_0x3ccd60);}(_0x9ef8,0x78));var _0x89ef=function(_0x5f6a8a,_0x45f474){_0x5f6a8a=_0x5f6a8a-0x0;var _0x2cce4d=_0x9ef8[_0x5f6a8a];return _0x2cce4d;};'use strict';var Sequelize=require(_0x89ef('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0x89ef('0x1')],'allowNull':![],'unique':_0x89ef('0x2')},'main':{'type':Sequelize[_0x89ef('0x1')],'defaultValue':_0x89ef('0x3')},'filename':{'type':Sequelize[_0x89ef('0x1')]},'path':{'type':Sequelize[_0x89ef('0x1')]},'type':{'type':Sequelize[_0x89ef('0x1')]},'size':{'type':Sequelize[_0x89ef('0x4')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x89ef('0x1')]},'logo':{'type':Sequelize[_0x89ef('0x1')]},'state':{'type':Sequelize[_0x89ef('0x1')],'unique':'state'},'description':{'type':Sequelize[_0x89ef('0x1')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x89ef('0x1')]},'link':{'type':Sequelize[_0x89ef('0x1')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index c6263ab..e368820 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 _0x53ec=['count','set','Content-Range','apply','reject','save','then','sendStatus','name','send','map','Integration','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','rows','show','params','include','find','catch','create','update','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x53ec,0x192));var _0xc53e=function(_0x3d00db,_0x3692b3){_0x3d00db=_0x3d00db-0x0;var _0x41f115=_0x53ec[_0x3d00db];return _0x41f115;};'use strict';var emlformat=require(_0xc53e('0x0'));var rimraf=require(_0xc53e('0x1'));var zipdir=require(_0xc53e('0x2'));var jsonpatch=require(_0xc53e('0x3'));var rp=require(_0xc53e('0x4'));var moment=require(_0xc53e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc53e('0x6'));var util=require('util');var path=require(_0xc53e('0x7'));var sox=require(_0xc53e('0x8'));var csv=require('to-csv');var ejs=require(_0xc53e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc53e('0xa'));var squel=require(_0xc53e('0xb'));var crypto=require('crypto');var jsforce=require(_0xc53e('0xc'));var deskjs=require(_0xc53e('0xd'));var toCsv=require(_0xc53e('0xe'));var querystring=require(_0xc53e('0xf'));var Papa=require(_0xc53e('0x10'));var Redis=require(_0xc53e('0x11'));var authService=require(_0xc53e('0x12'));var qs=require(_0xc53e('0x13'));var as=require(_0xc53e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc53e('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc53e('0x16'));var db=require(_0xc53e('0x17'))['db'];function respondWithStatusCode(_0x863fa,_0x4203aa){_0x4203aa=_0x4203aa||0xcc;return function(_0x56f0e5){if(_0x56f0e5){return _0x863fa['sendStatus'](_0x4203aa);}return _0x863fa[_0xc53e('0x18')](_0x4203aa)[_0xc53e('0x19')]();};}function respondWithResult(_0x7cd798,_0x3d2e17){_0x3d2e17=_0x3d2e17||0xc8;return function(_0x358ef3){if(_0x358ef3){return _0x7cd798[_0xc53e('0x18')](_0x3d2e17)[_0xc53e('0x1a')](_0x358ef3);}};}function respondWithFilteredResult(_0x19c0d1,_0x455e4d){return function(_0x2ad6eb){if(_0x2ad6eb){var _0x5b0a88=typeof _0x455e4d[_0xc53e('0x1b')]===_0xc53e('0x1c')&&typeof _0x455e4d[_0xc53e('0x1d')]===_0xc53e('0x1c');var _0x15333b=_0x2ad6eb[_0xc53e('0x1e')];var _0x164016=_0x5b0a88?0x0:_0x455e4d[_0xc53e('0x1b')];var _0x3b550e=_0x5b0a88?_0x2ad6eb['count']:_0x455e4d['offset']+_0x455e4d[_0xc53e('0x1d')];var _0x2a5bac;if(_0x3b550e>=_0x15333b){_0x3b550e=_0x15333b;_0x2a5bac=0xc8;}else{_0x2a5bac=0xce;}_0x19c0d1[_0xc53e('0x18')](_0x2a5bac);return _0x19c0d1[_0xc53e('0x1f')](_0xc53e('0x20'),_0x164016+'-'+_0x3b550e+'/'+_0x15333b)[_0xc53e('0x1a')](_0x2ad6eb);}return null;};}function patchUpdates(_0x15a015){return function(_0x25702b){try{jsonpatch[_0xc53e('0x21')](_0x25702b,_0x15a015,!![]);}catch(_0x401af6){return BPromise[_0xc53e('0x22')](_0x401af6);}return _0x25702b[_0xc53e('0x23')]();};}function saveUpdates(_0x426467,_0x4fb695){return function(_0x47cfdd){if(_0x47cfdd){return _0x47cfdd['update'](_0x426467)[_0xc53e('0x24')](function(_0x384218){return _0x384218;});}return null;};}function removeEntity(_0x7591c1,_0x4015c8){return function(_0x180811){if(_0x180811){return _0x180811['destroy']()['then'](function(){_0x7591c1[_0xc53e('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ae55e,_0x3a5ce8){return function(_0x443179){if(!_0x443179){_0x1ae55e[_0xc53e('0x25')](0x194);}return _0x443179;};}function handleError(_0x63c5dc,_0x4df8cf){_0x4df8cf=_0x4df8cf||0x1f4;return function(_0x398e7a){logger['error'](_0x398e7a['stack']);if(_0x398e7a['name']){delete _0x398e7a[_0xc53e('0x26')];}_0x63c5dc['status'](_0x4df8cf)[_0xc53e('0x27')](_0x398e7a);};}exports['index']=function(_0x24a77e,_0x5112d2){var _0x5ce216={},_0x8f0ee6={},_0x6a62b0={'count':0x0,'rows':[]};var _0x42dec1=_[_0xc53e('0x28')](db[_0xc53e('0x29')][_0xc53e('0x2a')],function(_0x3280fe){return{'name':_0x3280fe[_0xc53e('0x2b')],'type':_0x3280fe['type'][_0xc53e('0x2c')]};});_0x8f0ee6[_0xc53e('0x2d')]=_[_0xc53e('0x28')](_0x42dec1,'name');_0x8f0ee6[_0xc53e('0x2e')]=_['keys'](_0x24a77e[_0xc53e('0x2e')]);_0x8f0ee6[_0xc53e('0x2f')]=_['intersection'](_0x8f0ee6['model'],_0x8f0ee6[_0xc53e('0x2e')]);_0x5ce216[_0xc53e('0x30')]=_[_0xc53e('0x31')](_0x8f0ee6[_0xc53e('0x2d')],qs[_0xc53e('0x32')](_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x32')]));_0x5ce216[_0xc53e('0x30')]=_0x5ce216['attributes'][_0xc53e('0x33')]?_0x5ce216[_0xc53e('0x30')]:_0x8f0ee6[_0xc53e('0x2d')];if(!_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x34')](_0xc53e('0x35'))){_0x5ce216[_0xc53e('0x1d')]=qs[_0xc53e('0x1d')](_0x24a77e[_0xc53e('0x2e')]['limit']);_0x5ce216[_0xc53e('0x1b')]=qs['offset'](_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x1b')]);}_0x5ce216['order']=qs[_0xc53e('0x36')](_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x36')]);_0x5ce216['where']=qs[_0xc53e('0x2f')](_[_0xc53e('0x37')](_0x24a77e[_0xc53e('0x2e')],_0x8f0ee6[_0xc53e('0x2f')]),_0x42dec1);if(_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x38')]){_0x5ce216[_0xc53e('0x39')]=_['merge'](_0x5ce216[_0xc53e('0x39')],{'$or':_[_0xc53e('0x28')](_0x42dec1,function(_0x2db711){if(_0x2db711['type']!==_0xc53e('0x3a')){var _0x5e8ab7={};_0x5e8ab7[_0x2db711[_0xc53e('0x26')]]={'$like':'%'+_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x38')]+'%'};return _0x5e8ab7;}})});}_0x5ce216=_[_0xc53e('0x3b')]({},_0x5ce216,_0x24a77e[_0xc53e('0x3c')]);var _0x5507d0={'where':_0x5ce216[_0xc53e('0x39')]};return db[_0xc53e('0x29')]['count'](_0x5507d0)['then'](function(_0x5e9e15){_0x6a62b0['count']=_0x5e9e15;if(_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x3d')]){_0x5ce216['include']=[{'all':!![]}];}return db[_0xc53e('0x29')]['findAll'](_0x5ce216);})['then'](function(_0x53447e){_0x6a62b0[_0xc53e('0x3e')]=_0x53447e;return _0x6a62b0;})['then'](respondWithFilteredResult(_0x5112d2,_0x5ce216))['catch'](handleError(_0x5112d2,null));};exports[_0xc53e('0x3f')]=function(_0x53a82f,_0x422088){var _0x360af9={'raw':![],'where':{'id':_0x53a82f[_0xc53e('0x40')]['id']}},_0x49f204={};_0x49f204[_0xc53e('0x2d')]=_['keys'](db[_0xc53e('0x29')]['rawAttributes']);_0x49f204['query']=_['keys'](_0x53a82f['query']);_0x49f204[_0xc53e('0x2f')]=_[_0xc53e('0x31')](_0x49f204[_0xc53e('0x2d')],_0x49f204['query']);_0x360af9[_0xc53e('0x30')]=_[_0xc53e('0x31')](_0x49f204['model'],qs['fields'](_0x53a82f[_0xc53e('0x2e')][_0xc53e('0x32')]));_0x360af9[_0xc53e('0x30')]=_0x360af9['attributes'][_0xc53e('0x33')]?_0x360af9[_0xc53e('0x30')]:_0x49f204[_0xc53e('0x2d')];if(_0x53a82f[_0xc53e('0x2e')][_0xc53e('0x3d')]){_0x360af9[_0xc53e('0x41')]=[{'all':!![]}];}_0x360af9=_[_0xc53e('0x3b')]({},_0x360af9,_0x53a82f['options']);return db[_0xc53e('0x29')][_0xc53e('0x42')](_0x360af9)[_0xc53e('0x24')](handleEntityNotFound(_0x422088,null))['then'](respondWithResult(_0x422088,null))[_0xc53e('0x43')](handleError(_0x422088,null));};exports[_0xc53e('0x44')]=function(_0x4458c8,_0x15e744){return db[_0xc53e('0x29')][_0xc53e('0x44')](_0x4458c8['body'],{})[_0xc53e('0x24')](respondWithResult(_0x15e744,0xc9))[_0xc53e('0x43')](handleError(_0x15e744,null));};exports[_0xc53e('0x45')]=function(_0x5a6e41,_0x33d45c){if(_0x5a6e41[_0xc53e('0x46')]['id']){delete _0x5a6e41[_0xc53e('0x46')]['id'];}return db[_0xc53e('0x29')][_0xc53e('0x42')]({'where':{'id':_0x5a6e41[_0xc53e('0x40')]['id']}})[_0xc53e('0x24')](handleEntityNotFound(_0x33d45c,null))[_0xc53e('0x24')](saveUpdates(_0x5a6e41[_0xc53e('0x46')],null))[_0xc53e('0x24')](respondWithResult(_0x33d45c,null))['catch'](handleError(_0x33d45c,null));};exports[_0xc53e('0x47')]=function(_0x17cf13,_0x38520c){return db[_0xc53e('0x29')][_0xc53e('0x42')]({'where':{'id':_0x17cf13['params']['id']}})['then'](handleEntityNotFound(_0x38520c,null))[_0xc53e('0x24')](removeEntity(_0x38520c,null))['catch'](handleError(_0x38520c,null));}; \ No newline at end of file +var _0x5fab=['querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','end','sendStatus','name','send','index','map','Integration','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','includeAll','include','findAll','then','rows','show','params','intersection','fields','options','find','catch','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce'];(function(_0x24e7b0,_0x23104f){var _0x1b09a1=function(_0xf17972){while(--_0xf17972){_0x24e7b0['push'](_0x24e7b0['shift']());}};_0x1b09a1(++_0x23104f);}(_0x5fab,0x177));var _0xb5fa=function(_0x196c94,_0x58fa96){_0x196c94=_0x196c94-0x0;var _0x4f7e3f=_0x5fab[_0x196c94];return _0x4f7e3f;};'use strict';var emlformat=require(_0xb5fa('0x0'));var rimraf=require(_0xb5fa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb5fa('0x2'));var rp=require(_0xb5fa('0x3'));var moment=require(_0xb5fa('0x4'));var BPromise=require(_0xb5fa('0x5'));var Mustache=require(_0xb5fa('0x6'));var util=require(_0xb5fa('0x7'));var path=require(_0xb5fa('0x8'));var sox=require(_0xb5fa('0x9'));var csv=require(_0xb5fa('0xa'));var ejs=require(_0xb5fa('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb5fa('0xc'));var crypto=require(_0xb5fa('0xd'));var jsforce=require(_0xb5fa('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb5fa('0xa'));var querystring=require(_0xb5fa('0xf'));var Papa=require(_0xb5fa('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb5fa('0x11'));var as=require(_0xb5fa('0x12'));var hardwareService=require(_0xb5fa('0x13'));var logger=require(_0xb5fa('0x14'))(_0xb5fa('0x15'));var utils=require(_0xb5fa('0x16'));var config=require(_0xb5fa('0x17'));var licenseUtil=require(_0xb5fa('0x18'));var db=require(_0xb5fa('0x19'))['db'];function respondWithStatusCode(_0x4d3576,_0x2ad830){_0x2ad830=_0x2ad830||0xcc;return function(_0x3dad4d){if(_0x3dad4d){return _0x4d3576['sendStatus'](_0x2ad830);}return _0x4d3576[_0xb5fa('0x1a')](_0x2ad830)['end']();};}function respondWithResult(_0x265992,_0x3fc372){_0x3fc372=_0x3fc372||0xc8;return function(_0x40c914){if(_0x40c914){return _0x265992[_0xb5fa('0x1a')](_0x3fc372)[_0xb5fa('0x1b')](_0x40c914);}};}function respondWithFilteredResult(_0x5371cf,_0x567f31){return function(_0x38e964){if(_0x38e964){var _0x587043=typeof _0x567f31[_0xb5fa('0x1c')]===_0xb5fa('0x1d')&&typeof _0x567f31['limit']==='undefined';var _0x451a55=_0x38e964[_0xb5fa('0x1e')];var _0x32e9e5=_0x587043?0x0:_0x567f31[_0xb5fa('0x1c')];var _0x324ba5=_0x587043?_0x38e964[_0xb5fa('0x1e')]:_0x567f31[_0xb5fa('0x1c')]+_0x567f31[_0xb5fa('0x1f')];var _0xc14dc4;if(_0x324ba5>=_0x451a55){_0x324ba5=_0x451a55;_0xc14dc4=0xc8;}else{_0xc14dc4=0xce;}_0x5371cf[_0xb5fa('0x1a')](_0xc14dc4);return _0x5371cf[_0xb5fa('0x20')](_0xb5fa('0x21'),_0x32e9e5+'-'+_0x324ba5+'/'+_0x451a55)['json'](_0x38e964);}return null;};}function patchUpdates(_0x432bfa){return function(_0x519e20){try{jsonpatch[_0xb5fa('0x22')](_0x519e20,_0x432bfa,!![]);}catch(_0x4a6c04){return BPromise[_0xb5fa('0x23')](_0x4a6c04);}return _0x519e20[_0xb5fa('0x24')]();};}function saveUpdates(_0x4e05c0,_0x40dfdf){return function(_0x3a2ab9){if(_0x3a2ab9){return _0x3a2ab9[_0xb5fa('0x25')](_0x4e05c0)['then'](function(_0x32a85c){return _0x32a85c;});}return null;};}function removeEntity(_0xec108f,_0x444237){return function(_0x542348){if(_0x542348){return _0x542348[_0xb5fa('0x26')]()['then'](function(){_0xec108f[_0xb5fa('0x1a')](0xcc)[_0xb5fa('0x27')]();});}};}function handleEntityNotFound(_0x11053a,_0x543edf){return function(_0x2dbd22){if(!_0x2dbd22){_0x11053a[_0xb5fa('0x28')](0x194);}return _0x2dbd22;};}function handleError(_0x6a455c,_0x20d649){_0x20d649=_0x20d649||0x1f4;return function(_0x568870){logger['error'](_0x568870['stack']);if(_0x568870['name']){delete _0x568870[_0xb5fa('0x29')];}_0x6a455c[_0xb5fa('0x1a')](_0x20d649)[_0xb5fa('0x2a')](_0x568870);};}exports[_0xb5fa('0x2b')]=function(_0x534884,_0x3506a4){var _0x358549={},_0x353314={},_0x409af9={'count':0x0,'rows':[]};var _0x2a5690=_[_0xb5fa('0x2c')](db[_0xb5fa('0x2d')][_0xb5fa('0x2e')],function(_0x1f4380){return{'name':_0x1f4380[_0xb5fa('0x2f')],'type':_0x1f4380[_0xb5fa('0x30')][_0xb5fa('0x31')]};});_0x353314[_0xb5fa('0x32')]=_[_0xb5fa('0x2c')](_0x2a5690,_0xb5fa('0x29'));_0x353314[_0xb5fa('0x33')]=_[_0xb5fa('0x34')](_0x534884[_0xb5fa('0x33')]);_0x353314[_0xb5fa('0x35')]=_['intersection'](_0x353314[_0xb5fa('0x32')],_0x353314['query']);_0x358549['attributes']=_['intersection'](_0x353314[_0xb5fa('0x32')],qs['fields'](_0x534884[_0xb5fa('0x33')]['fields']));_0x358549['attributes']=_0x358549[_0xb5fa('0x36')][_0xb5fa('0x37')]?_0x358549['attributes']:_0x353314['model'];if(!_0x534884[_0xb5fa('0x33')][_0xb5fa('0x38')](_0xb5fa('0x39'))){_0x358549['limit']=qs[_0xb5fa('0x1f')](_0x534884[_0xb5fa('0x33')]['limit']);_0x358549[_0xb5fa('0x1c')]=qs[_0xb5fa('0x1c')](_0x534884[_0xb5fa('0x33')]['offset']);}_0x358549[_0xb5fa('0x3a')]=qs[_0xb5fa('0x3b')](_0x534884[_0xb5fa('0x33')]['sort']);_0x358549[_0xb5fa('0x3c')]=qs[_0xb5fa('0x35')](_[_0xb5fa('0x3d')](_0x534884[_0xb5fa('0x33')],_0x353314['filters']),_0x2a5690);if(_0x534884['query']['filter']){_0x358549['where']=_['merge'](_0x358549['where'],{'$or':_[_0xb5fa('0x2c')](_0x2a5690,function(_0x4c0a4d){if(_0x4c0a4d[_0xb5fa('0x30')]!==_0xb5fa('0x3e')){var _0x36db1a={};_0x36db1a[_0x4c0a4d[_0xb5fa('0x29')]]={'$like':'%'+_0x534884[_0xb5fa('0x33')][_0xb5fa('0x3f')]+'%'};return _0x36db1a;}})});}_0x358549=_['merge']({},_0x358549,_0x534884['options']);var _0x4c4bf0={'where':_0x358549[_0xb5fa('0x3c')]};return db['Integration'][_0xb5fa('0x1e')](_0x4c4bf0)['then'](function(_0x58aa97){_0x409af9[_0xb5fa('0x1e')]=_0x58aa97;if(_0x534884[_0xb5fa('0x33')][_0xb5fa('0x40')]){_0x358549[_0xb5fa('0x41')]=[{'all':!![]}];}return db[_0xb5fa('0x2d')][_0xb5fa('0x42')](_0x358549);})[_0xb5fa('0x43')](function(_0x83df0b){_0x409af9[_0xb5fa('0x44')]=_0x83df0b;return _0x409af9;})[_0xb5fa('0x43')](respondWithFilteredResult(_0x3506a4,_0x358549))['catch'](handleError(_0x3506a4,null));};exports[_0xb5fa('0x45')]=function(_0x4bc9df,_0x233f90){var _0x39aac3={'raw':![],'where':{'id':_0x4bc9df[_0xb5fa('0x46')]['id']}},_0x2c7c5f={};_0x2c7c5f[_0xb5fa('0x32')]=_[_0xb5fa('0x34')](db[_0xb5fa('0x2d')][_0xb5fa('0x2e')]);_0x2c7c5f['query']=_[_0xb5fa('0x34')](_0x4bc9df[_0xb5fa('0x33')]);_0x2c7c5f['filters']=_[_0xb5fa('0x47')](_0x2c7c5f['model'],_0x2c7c5f[_0xb5fa('0x33')]);_0x39aac3[_0xb5fa('0x36')]=_['intersection'](_0x2c7c5f['model'],qs[_0xb5fa('0x48')](_0x4bc9df[_0xb5fa('0x33')][_0xb5fa('0x48')]));_0x39aac3[_0xb5fa('0x36')]=_0x39aac3[_0xb5fa('0x36')][_0xb5fa('0x37')]?_0x39aac3[_0xb5fa('0x36')]:_0x2c7c5f[_0xb5fa('0x32')];if(_0x4bc9df['query'][_0xb5fa('0x40')]){_0x39aac3[_0xb5fa('0x41')]=[{'all':!![]}];}_0x39aac3=_['merge']({},_0x39aac3,_0x4bc9df[_0xb5fa('0x49')]);return db[_0xb5fa('0x2d')][_0xb5fa('0x4a')](_0x39aac3)[_0xb5fa('0x43')](handleEntityNotFound(_0x233f90,null))[_0xb5fa('0x43')](respondWithResult(_0x233f90,null))[_0xb5fa('0x4b')](handleError(_0x233f90,null));};exports[_0xb5fa('0x4c')]=function(_0x33eb2c,_0x20f5f5){return db[_0xb5fa('0x2d')][_0xb5fa('0x4c')](_0x33eb2c[_0xb5fa('0x4d')],{})[_0xb5fa('0x43')](respondWithResult(_0x20f5f5,0xc9))[_0xb5fa('0x4b')](handleError(_0x20f5f5,null));};exports[_0xb5fa('0x25')]=function(_0x3a39f2,_0x52f5d8){if(_0x3a39f2['body']['id']){delete _0x3a39f2[_0xb5fa('0x4d')]['id'];}return db['Integration'][_0xb5fa('0x4a')]({'where':{'id':_0x3a39f2[_0xb5fa('0x46')]['id']}})['then'](handleEntityNotFound(_0x52f5d8,null))[_0xb5fa('0x43')](saveUpdates(_0x3a39f2[_0xb5fa('0x4d')],null))[_0xb5fa('0x43')](respondWithResult(_0x52f5d8,null))[_0xb5fa('0x4b')](handleError(_0x52f5d8,null));};exports[_0xb5fa('0x26')]=function(_0x3ffee0,_0x51d5f7){return db[_0xb5fa('0x2d')]['find']({'where':{'id':_0x3ffee0[_0xb5fa('0x46')]['id']}})[_0xb5fa('0x43')](handleEntityNotFound(_0x51d5f7,null))[_0xb5fa('0x43')](removeEntity(_0x51d5f7,null))['catch'](handleError(_0x51d5f7,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 0ce20f8..39ee391 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 _0x06f5=['api','moment','bluebird','path','rimraf','./integration.attributes','exports','Integration','lodash','util','../../config/logger'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0x06f5,0xce));var _0x506f=function(_0x4e4a44,_0x105c11){_0x4e4a44=_0x4e4a44-0x0;var _0x28a81e=_0x06f5[_0x4e4a44];return _0x28a81e;};'use strict';var _=require(_0x506f('0x0'));var util=require(_0x506f('0x1'));var logger=require(_0x506f('0x2'))(_0x506f('0x3'));var moment=require(_0x506f('0x4'));var BPromise=require(_0x506f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x506f('0x6'));var rimraf=require(_0x506f('0x7'));var config=require('../../config/environment');var attributes=require(_0x506f('0x8'));module[_0x506f('0x9')]=function(_0x184f13,_0x21d7f2){return _0x184f13['define'](_0x506f('0xa'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0ef6=['lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./integration.attributes','define','Integration','integrations'];(function(_0xb15638,_0x2e9270){var _0x161b09=function(_0x11ab8b){while(--_0x11ab8b){_0xb15638['push'](_0xb15638['shift']());}};_0x161b09(++_0x2e9270);}(_0x0ef6,0x1a4));var _0x60ef=function(_0x164f87,_0x4607e4){_0x164f87=_0x164f87-0x0;var _0x2b3a65=_0x0ef6[_0x164f87];return _0x2b3a65;};'use strict';var _=require(_0x60ef('0x0'));var util=require(_0x60ef('0x1'));var logger=require('../../config/logger')(_0x60ef('0x2'));var moment=require(_0x60ef('0x3'));var BPromise=require(_0x60ef('0x4'));var rp=require(_0x60ef('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x60ef('0x6'));var config=require(_0x60ef('0x7'));var attributes=require(_0x60ef('0x8'));module['exports']=function(_0x390d78,_0x25c33e){return _0x390d78[_0x60ef('0x9')](_0x60ef('0xa'),attributes,{'tableName':_0x60ef('0xb'),'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 5ee3f8f..1e8d2dd 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 _0xda2d=['bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','then','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','util','moment'];(function(_0x45d56b,_0x3b99e4){var _0xd62e37=function(_0x12f150){while(--_0x12f150){_0x45d56b['push'](_0x45d56b['shift']());}};_0xd62e37(++_0x3b99e4);}(_0xda2d,0x102));var _0xdda2=function(_0x50a9d2,_0x174627){_0x50a9d2=_0x50a9d2-0x0;var _0x2d681c=_0xda2d[_0x50a9d2];return _0x2d681c;};'use strict';var _=require('lodash');var util=require(_0xdda2('0x0'));var moment=require(_0xdda2('0x1'));var BPromise=require(_0xdda2('0x2'));var rs=require(_0xdda2('0x3'));var fs=require('fs');var Redis=require(_0xdda2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdda2('0x5'));var config=require(_0xdda2('0x6'));var jayson=require(_0xdda2('0x7'));var client=jayson[_0xdda2('0x8')][_0xdda2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf38e58,_0x2f55dc,_0x436676){return new BPromise(function(_0x2e2523,_0x341c7b){return client['request'](_0xf38e58,_0x436676)[_0xdda2('0xa')](function(_0x22c6e5){logger['info'](_0xdda2('0xb'),_0x2f55dc,_0xdda2('0xc'));logger[_0xdda2('0xd')](_0xdda2('0xe'),_0x2f55dc,_0xdda2('0xc'),JSON[_0xdda2('0xf')](_0x22c6e5));if(_0x22c6e5[_0xdda2('0x10')]){if(_0x22c6e5[_0xdda2('0x10')]['code']===0x1f4){logger['error']('Integration,\x20%s,\x20%s',_0x2f55dc,_0x22c6e5[_0xdda2('0x10')][_0xdda2('0x11')]);return _0x341c7b(_0x22c6e5[_0xdda2('0x10')][_0xdda2('0x11')]);}logger[_0xdda2('0x10')](_0xdda2('0xb'),_0x2f55dc,_0x22c6e5[_0xdda2('0x10')]['message']);return _0x2e2523(_0x22c6e5[_0xdda2('0x10')]['message']);}else{logger[_0xdda2('0x12')](_0xdda2('0xb'),_0x2f55dc,_0xdda2('0xc'));_0x2e2523(_0x22c6e5[_0xdda2('0x13')][_0xdda2('0x11')]);}})['catch'](function(_0x55d674){logger[_0xdda2('0x10')]('Integration,\x20%s,\x20%s',_0x2f55dc,_0x55d674);_0x341c7b(_0x55d674);});});} \ No newline at end of file +var _0x2542=['info','Integration,\x20%s,\x20%s','debug','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x52bf89,_0x265df5){var _0x40782e=function(_0x2eb6f7){while(--_0x2eb6f7){_0x52bf89['push'](_0x52bf89['shift']());}};_0x40782e(++_0x265df5);}(_0x2542,0x169));var _0x2254=function(_0x191608,_0x25c607){_0x191608=_0x191608-0x0;var _0x45e96a=_0x2542[_0x191608];return _0x45e96a;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var moment=require(_0x2254('0x2'));var BPromise=require(_0x2254('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2254('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2254('0x5'));var logger=require(_0x2254('0x6'))(_0x2254('0x7'));var config=require(_0x2254('0x8'));var jayson=require(_0x2254('0x9'));var client=jayson['client'][_0x2254('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe8ca50,_0x2ee7ee,_0x3c45ec){return new BPromise(function(_0x1637ad,_0x477b47){return client[_0x2254('0xb')](_0xe8ca50,_0x3c45ec)[_0x2254('0xc')](function(_0xb395da){logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,'request\x20sent');logger[_0x2254('0xf')](_0x2254('0x10'),_0x2ee7ee,_0x2254('0x11'),JSON[_0x2254('0x12')](_0xb395da));if(_0xb395da['error']){if(_0xb395da['error'][_0x2254('0x13')]===0x1f4){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);return _0x477b47(_0xb395da[_0x2254('0x14')]['message']);}logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da['error'][_0x2254('0x15')]);return _0x1637ad(_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);}else{logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,_0x2254('0x11'));_0x1637ad(_0xb395da['result'][_0x2254('0x15')]);}})['catch'](function(_0x327d6d){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0x327d6d);_0x477b47(_0x327d6d);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 2014f6d..3b4dd22 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 _0x0b0e=['get','isAuthenticated','index','describe','/:id','post','put','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller'];(function(_0x2f68da,_0x521e11){var _0x5cd9fb=function(_0x49705a){while(--_0x49705a){_0x2f68da['push'](_0x2f68da['shift']());}};_0x5cd9fb(++_0x521e11);}(_0x0b0e,0x187));var _0xe0b0=function(_0xa1e3ca,_0x559022){_0xa1e3ca=_0xa1e3ca-0x0;var _0x5005ab=_0x0b0e[_0xa1e3ca];return _0x5005ab;};'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')]('/describe',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['show']);router[_0xe0b0('0xe')]('/',auth[_0xe0b0('0xa')](),controller['create']);router[_0xe0b0('0xf')](_0xe0b0('0xd'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x11')](_0xe0b0('0xd'),auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);module[_0xe0b0('0x13')]=router; \ No newline at end of file +var _0x5f66=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','create','put','update','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5f66,0x1a0));var _0x65f6=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x5f66[_0x36eaaa];return _0x461349;};'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('./integrationReport.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['show']);router['post']('/',auth[_0x65f6('0x8')](),controller[_0x65f6('0xc')]);router[_0x65f6('0xd')](_0x65f6('0xb'),auth['isAuthenticated'](),controller[_0x65f6('0xe')]);router['delete']('/:id',auth[_0x65f6('0x8')](),controller['destroy']);module[_0x65f6('0xf')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 7467b9d..d9bc20d 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 _0xc298=['SENT','SENDING','RECEIVED','FAILED','sequelize','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM'];(function(_0x2b9e76,_0x467e25){var _0x4c014e=function(_0x165284){while(--_0x165284){_0x2b9e76['push'](_0x2b9e76['shift']());}};_0x4c014e(++_0x467e25);}(_0xc298,0xbf));var _0x8c29=function(_0x2cdae3,_0x5856e2){_0x2cdae3=_0x2cdae3-0x0;var _0x241c0f=_0xc298[_0x2cdae3];return _0x241c0f;};'use strict';var Sequelize=require(_0x8c29('0x0'));module['exports']={'integration':{'type':Sequelize[_0x8c29('0x1')]},'eventChannel':{'type':Sequelize[_0x8c29('0x1')]},'exitStatus':{'type':Sequelize[_0x8c29('0x1')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0x8c29('0x2')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x8c29('0x1')]},'calleridnum':{'type':Sequelize[_0x8c29('0x1')]},'calleridname':{'type':Sequelize[_0x8c29('0x1')]},'queue':{'type':Sequelize[_0x8c29('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x8c29('0x3')]},'agentconnectAt':{'type':Sequelize[_0x8c29('0x3')]},'holdtime':{'type':Sequelize[_0x8c29('0x2')]},'agentcomplete':{'type':Sequelize[_0x8c29('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x8c29('0x3')]},'talktime':{'type':Sequelize[_0x8c29('0x2')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x8c29('0x2')]},'reason':{'type':Sequelize[_0x8c29('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x8c29('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x8c29('0x3')]},'agentdump':{'type':Sequelize[_0x8c29('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x8c29('0x1')]},'channel':{'type':Sequelize[_0x8c29('0x1')]},'channelstate':{'type':Sequelize[_0x8c29('0x2')]},'channelstatedesc':{'type':Sequelize[_0x8c29('0x1')]},'connectedlinenum':{'type':Sequelize[_0x8c29('0x1')]},'connectedlinename':{'type':Sequelize[_0x8c29('0x1')]},'language':{'type':Sequelize[_0x8c29('0x1')]},'accountcode':{'type':Sequelize[_0x8c29('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x8c29('0x1')]},'priority':{'type':Sequelize[_0x8c29('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x8c29('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x8c29('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x8c29('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x8c29('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x8c29('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x8c29('0x1')]},'destexten':{'type':Sequelize[_0x8c29('0x1')]},'destpriority':{'type':Sequelize[_0x8c29('0x1')]},'destuniqueid':{'type':Sequelize[_0x8c29('0x1')]},'messageId':{'type':Sequelize[_0x8c29('0x1')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x8c29('0x1')]},'cc':{'type':Sequelize[_0x8c29('0x1')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x8c29('0x5')]},'status':{'type':Sequelize[_0x8c29('0x6')](_0x8c29('0x7'),_0x8c29('0x8'),_0x8c29('0x9'),_0x8c29('0xa'))},'url':{'type':Sequelize[_0x8c29('0x1')]},'app':{'type':Sequelize[_0x8c29('0x1')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x0261=['SENT','FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT'];(function(_0x4e4c74,_0x2a578f){var _0xa73201=function(_0x21cd68){while(--_0x21cd68){_0x4e4c74['push'](_0x4e4c74['shift']());}};_0xa73201(++_0x2a578f);}(_0x0261,0xd1));var _0x1026=function(_0x53f715,_0x52587b){_0x53f715=_0x53f715-0x0;var _0x16c757=_0x0261[_0x53f715];return _0x16c757;};'use strict';var Sequelize=require(_0x1026('0x0'));module[_0x1026('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x1026('0x2')]},'exitStatus':{'type':Sequelize[_0x1026('0x2')]},'ticketId':{'type':Sequelize[_0x1026('0x2')]},'integrationId':{'type':Sequelize[_0x1026('0x3')]},'contacts':{'type':Sequelize[_0x1026('0x2')]},'uniqueid':{'type':Sequelize[_0x1026('0x2')]},'calleridnum':{'type':Sequelize[_0x1026('0x2')]},'calleridname':{'type':Sequelize[_0x1026('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x1026('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x1026('0x4')]},'holdtime':{'type':Sequelize[_0x1026('0x3')]},'agentcomplete':{'type':Sequelize[_0x1026('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0x1026('0x3')]},'agentacw':{'type':Sequelize[_0x1026('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x1026('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x1026('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x1026('0x4')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x1026('0x4')]},'lastevent':{'type':Sequelize[_0x1026('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x1026('0x3')]},'channelstatedesc':{'type':Sequelize[_0x1026('0x2')]},'connectedlinenum':{'type':Sequelize[_0x1026('0x2')]},'connectedlinename':{'type':Sequelize[_0x1026('0x2')]},'language':{'type':Sequelize[_0x1026('0x2')]},'accountcode':{'type':Sequelize[_0x1026('0x2')]},'context':{'type':Sequelize[_0x1026('0x2')]},'exten':{'type':Sequelize[_0x1026('0x2')]},'priority':{'type':Sequelize[_0x1026('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x1026('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x1026('0x2')]},'destcalleridnum':{'type':Sequelize[_0x1026('0x2')]},'destcalleridname':{'type':Sequelize[_0x1026('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x1026('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x1026('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x1026('0x2')]},'destcontext':{'type':Sequelize[_0x1026('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x1026('0x2')]},'destuniqueid':{'type':Sequelize[_0x1026('0x2')]},'messageId':{'type':Sequelize[_0x1026('0x2')]},'inReplyTo':{'type':Sequelize[_0x1026('0x2')]},'subject':{'type':Sequelize[_0x1026('0x2')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x1026('0x2')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0x1026('0x6')]},'html':{'type':Sequelize[_0x1026('0x6')]},'text':{'type':Sequelize[_0x1026('0x6')]},'status':{'type':Sequelize['ENUM'](_0x1026('0x7'),'SENDING','RECEIVED',_0x1026('0x8'))},'url':{'type':Sequelize[_0x1026('0x2')]},'app':{'type':Sequelize[_0x1026('0x2')]},'appdata':{'type':Sequelize[_0x1026('0x2')]},'projectId':{'type':Sequelize[_0x1026('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index cda8088..6d747a2 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 _0xc892=['status','end','limit','undefined','count','offset','set','Content-Range','json','apply','save','update','then','destroy','stack','name','send','map','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','options','IntegrationReport','includeAll','include','catch','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x2a8249,_0x2c6b2b){var _0x1bd2cc=function(_0x2a0098){while(--_0x2a0098){_0x2a8249['push'](_0x2a8249['shift']());}};_0x1bd2cc(++_0x2c6b2b);}(_0xc892,0x14f));var _0x2c89=function(_0x158cd8,_0x3bf412){_0x158cd8=_0x158cd8-0x0;var _0x5b93ad=_0xc892[_0x158cd8];return _0x5b93ad;};'use strict';var emlformat=require(_0x2c89('0x0'));var rimraf=require(_0x2c89('0x1'));var zipdir=require(_0x2c89('0x2'));var jsonpatch=require(_0x2c89('0x3'));var rp=require(_0x2c89('0x4'));var moment=require(_0x2c89('0x5'));var BPromise=require(_0x2c89('0x6'));var Mustache=require('mustache');var util=require(_0x2c89('0x7'));var path=require(_0x2c89('0x8'));var sox=require(_0x2c89('0x9'));var csv=require(_0x2c89('0xa'));var ejs=require(_0x2c89('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2c89('0xc'));var squel=require(_0x2c89('0xd'));var crypto=require(_0x2c89('0xe'));var jsforce=require(_0x2c89('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x2c89('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2c89('0x10'));var authService=require(_0x2c89('0x11'));var qs=require(_0x2c89('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2c89('0x13'));var logger=require(_0x2c89('0x14'))(_0x2c89('0x15'));var utils=require(_0x2c89('0x16'));var config=require(_0x2c89('0x17'));var licenseUtil=require(_0x2c89('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc1fb51,_0x1ed4e1){_0x1ed4e1=_0x1ed4e1||0xcc;return function(_0x444823){if(_0x444823){return _0xc1fb51['sendStatus'](_0x1ed4e1);}return _0xc1fb51[_0x2c89('0x19')](_0x1ed4e1)[_0x2c89('0x1a')]();};}function respondWithResult(_0x387e9d,_0x400239){_0x400239=_0x400239||0xc8;return function(_0x374e94){if(_0x374e94){return _0x387e9d[_0x2c89('0x19')](_0x400239)['json'](_0x374e94);}};}function respondWithFilteredResult(_0x1f566a,_0x4012ed){return function(_0x379f0d){if(_0x379f0d){var _0x4fecff=typeof _0x4012ed['offset']==='undefined'&&typeof _0x4012ed[_0x2c89('0x1b')]===_0x2c89('0x1c');var _0x2cd048=_0x379f0d[_0x2c89('0x1d')];var _0x46bdd2=_0x4fecff?0x0:_0x4012ed['offset'];var _0x2ea800=_0x4fecff?_0x379f0d['count']:_0x4012ed[_0x2c89('0x1e')]+_0x4012ed['limit'];var _0x361079;if(_0x2ea800>=_0x2cd048){_0x2ea800=_0x2cd048;_0x361079=0xc8;}else{_0x361079=0xce;}_0x1f566a[_0x2c89('0x19')](_0x361079);return _0x1f566a[_0x2c89('0x1f')](_0x2c89('0x20'),_0x46bdd2+'-'+_0x2ea800+'/'+_0x2cd048)[_0x2c89('0x21')](_0x379f0d);}return null;};}function patchUpdates(_0x2fb130){return function(_0x3cfbff){try{jsonpatch[_0x2c89('0x22')](_0x3cfbff,_0x2fb130,!![]);}catch(_0x26fd8a){return BPromise['reject'](_0x26fd8a);}return _0x3cfbff[_0x2c89('0x23')]();};}function saveUpdates(_0x1c8329,_0x2872cf){return function(_0xd40169){if(_0xd40169){return _0xd40169[_0x2c89('0x24')](_0x1c8329)[_0x2c89('0x25')](function(_0x276d8b){return _0x276d8b;});}return null;};}function removeEntity(_0x60ca47,_0x4f3379){return function(_0x23963b){if(_0x23963b){return _0x23963b[_0x2c89('0x26')]()[_0x2c89('0x25')](function(){_0x60ca47['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ddd20,_0x490403){return function(_0x4d36d7){if(!_0x4d36d7){_0x4ddd20['sendStatus'](0x194);}return _0x4d36d7;};}function handleError(_0x3ab2b2,_0x4d05df){_0x4d05df=_0x4d05df||0x1f4;return function(_0x21b56a){logger['error'](_0x21b56a[_0x2c89('0x27')]);if(_0x21b56a[_0x2c89('0x28')]){delete _0x21b56a['name'];}_0x3ab2b2['status'](_0x4d05df)[_0x2c89('0x29')](_0x21b56a);};}exports['index']=function(_0x2b96cd,_0x5e2f26){var _0x338c4d={},_0x1d9d8c={},_0x456adf={'count':0x0,'rows':[]};var _0x20e318=_[_0x2c89('0x2a')](db['IntegrationReport'][_0x2c89('0x2b')],function(_0x17ff1c){return{'name':_0x17ff1c[_0x2c89('0x2c')],'type':_0x17ff1c['type'][_0x2c89('0x2d')]};});_0x1d9d8c[_0x2c89('0x2e')]=_['map'](_0x20e318,_0x2c89('0x28'));_0x1d9d8c['query']=_[_0x2c89('0x2f')](_0x2b96cd[_0x2c89('0x30')]);_0x1d9d8c[_0x2c89('0x31')]=_[_0x2c89('0x32')](_0x1d9d8c['model'],_0x1d9d8c[_0x2c89('0x30')]);_0x338c4d[_0x2c89('0x33')]=_['intersection'](_0x1d9d8c[_0x2c89('0x2e')],qs[_0x2c89('0x34')](_0x2b96cd[_0x2c89('0x30')][_0x2c89('0x34')]));_0x338c4d['attributes']=_0x338c4d['attributes'][_0x2c89('0x35')]?_0x338c4d['attributes']:_0x1d9d8c[_0x2c89('0x2e')];if(!_0x2b96cd[_0x2c89('0x30')]['hasOwnProperty'](_0x2c89('0x36'))){_0x338c4d[_0x2c89('0x1b')]=qs['limit'](_0x2b96cd[_0x2c89('0x30')][_0x2c89('0x1b')]);_0x338c4d[_0x2c89('0x1e')]=qs[_0x2c89('0x1e')](_0x2b96cd[_0x2c89('0x30')][_0x2c89('0x1e')]);}_0x338c4d['order']=qs[_0x2c89('0x37')](_0x2b96cd['query'][_0x2c89('0x37')]);_0x338c4d['where']=qs[_0x2c89('0x31')](_[_0x2c89('0x38')](_0x2b96cd[_0x2c89('0x30')],_0x1d9d8c[_0x2c89('0x31')]),_0x20e318);if(_0x2b96cd['query'][_0x2c89('0x39')]){_0x338c4d[_0x2c89('0x3a')]=_[_0x2c89('0x3b')](_0x338c4d['where'],{'$or':_[_0x2c89('0x2a')](_0x20e318,function(_0x459be3){if(_0x459be3[_0x2c89('0x3c')]!==_0x2c89('0x3d')){var _0x5179ab={};_0x5179ab[_0x459be3[_0x2c89('0x28')]]={'$like':'%'+_0x2b96cd[_0x2c89('0x30')]['filter']+'%'};return _0x5179ab;}})});}_0x338c4d=_[_0x2c89('0x3b')]({},_0x338c4d,_0x2b96cd[_0x2c89('0x3e')]);var _0x5bac5b={'where':_0x338c4d['where']};return db[_0x2c89('0x3f')][_0x2c89('0x1d')](_0x5bac5b)[_0x2c89('0x25')](function(_0x40d05a){_0x456adf[_0x2c89('0x1d')]=_0x40d05a;if(_0x2b96cd[_0x2c89('0x30')][_0x2c89('0x40')]){_0x338c4d[_0x2c89('0x41')]=[{'all':!![]}];}return db[_0x2c89('0x3f')]['findAll'](_0x338c4d);})[_0x2c89('0x25')](function(_0x7d29bc){_0x456adf['rows']=_0x7d29bc;return _0x456adf;})[_0x2c89('0x25')](respondWithFilteredResult(_0x5e2f26,_0x338c4d))[_0x2c89('0x42')](handleError(_0x5e2f26,null));};exports['show']=function(_0x40ce51,_0x506939){var _0x392ed6={'raw':![],'where':{'id':_0x40ce51['params']['id']}},_0x352dfa={};_0x352dfa[_0x2c89('0x2e')]=_[_0x2c89('0x2f')](db[_0x2c89('0x3f')][_0x2c89('0x2b')]);_0x352dfa[_0x2c89('0x30')]=_['keys'](_0x40ce51[_0x2c89('0x30')]);_0x352dfa[_0x2c89('0x31')]=_['intersection'](_0x352dfa[_0x2c89('0x2e')],_0x352dfa[_0x2c89('0x30')]);_0x392ed6['attributes']=_[_0x2c89('0x32')](_0x352dfa['model'],qs[_0x2c89('0x34')](_0x40ce51[_0x2c89('0x30')]['fields']));_0x392ed6['attributes']=_0x392ed6[_0x2c89('0x33')]['length']?_0x392ed6[_0x2c89('0x33')]:_0x352dfa['model'];if(_0x40ce51['query'][_0x2c89('0x40')]){_0x392ed6[_0x2c89('0x41')]=[{'all':!![]}];}_0x392ed6=_[_0x2c89('0x3b')]({},_0x392ed6,_0x40ce51[_0x2c89('0x3e')]);return db[_0x2c89('0x3f')][_0x2c89('0x43')](_0x392ed6)[_0x2c89('0x25')](handleEntityNotFound(_0x506939,null))[_0x2c89('0x25')](respondWithResult(_0x506939,null))[_0x2c89('0x42')](handleError(_0x506939,null));};exports['create']=function(_0x1d7661,_0x574a24){return db[_0x2c89('0x3f')][_0x2c89('0x44')](_0x1d7661['body'],{})[_0x2c89('0x25')](respondWithResult(_0x574a24,0xc9))[_0x2c89('0x42')](handleError(_0x574a24,null));};exports[_0x2c89('0x24')]=function(_0x33d344,_0x1abad3){if(_0x33d344[_0x2c89('0x45')]['id']){delete _0x33d344['body']['id'];}return db[_0x2c89('0x3f')][_0x2c89('0x43')]({'where':{'id':_0x33d344[_0x2c89('0x46')]['id']}})[_0x2c89('0x25')](handleEntityNotFound(_0x1abad3,null))['then'](saveUpdates(_0x33d344[_0x2c89('0x45')],null))[_0x2c89('0x25')](respondWithResult(_0x1abad3,null))['catch'](handleError(_0x1abad3,null));};exports[_0x2c89('0x26')]=function(_0x99b029,_0x4ca030){return db[_0x2c89('0x3f')][_0x2c89('0x43')]({'where':{'id':_0x99b029[_0x2c89('0x46')]['id']}})[_0x2c89('0x25')](handleEntityNotFound(_0x4ca030,null))['then'](removeEntity(_0x4ca030,null))[_0x2c89('0x42')](handleError(_0x4ca030,null));};exports[_0x2c89('0x47')]=function(_0x5ac01e,_0x15e85d){return db[_0x2c89('0x3f')][_0x2c89('0x47')]()[_0x2c89('0x25')](respondWithResult(_0x15e85d,null))['catch'](handleError(_0x15e85d,null));}; \ No newline at end of file +var _0x5356=['find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','destroy','then','error','name','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','IntegrationReport','rows','catch','params'];(function(_0x122cc1,_0x5c956e){var _0x1e33af=function(_0x949b75){while(--_0x949b75){_0x122cc1['push'](_0x122cc1['shift']());}};_0x1e33af(++_0x5c956e);}(_0x5356,0x95));var _0x6535=function(_0x4cd04a,_0x286165){_0x4cd04a=_0x4cd04a-0x0;var _0x42f016=_0x5356[_0x4cd04a];return _0x42f016;};'use strict';var emlformat=require(_0x6535('0x0'));var rimraf=require(_0x6535('0x1'));var zipdir=require(_0x6535('0x2'));var jsonpatch=require(_0x6535('0x3'));var rp=require(_0x6535('0x4'));var moment=require('moment');var BPromise=require(_0x6535('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6535('0x6'));var sox=require('sox');var csv=require(_0x6535('0x7'));var ejs=require(_0x6535('0x8'));var fs=require('fs');var fs_extra=require(_0x6535('0x9'));var _=require('lodash');var squel=require(_0x6535('0xa'));var crypto=require('crypto');var jsforce=require(_0x6535('0xb'));var deskjs=require(_0x6535('0xc'));var toCsv=require(_0x6535('0x7'));var querystring=require(_0x6535('0xd'));var Papa=require('papaparse');var Redis=require(_0x6535('0xe'));var authService=require(_0x6535('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x6535('0x10'));var hardwareService=require(_0x6535('0x11'));var logger=require(_0x6535('0x12'))('api');var utils=require(_0x6535('0x13'));var config=require(_0x6535('0x14'));var licenseUtil=require(_0x6535('0x15'));var db=require(_0x6535('0x16'))['db'];function respondWithStatusCode(_0x1488f5,_0x18fe7b){_0x18fe7b=_0x18fe7b||0xcc;return function(_0x29d58b){if(_0x29d58b){return _0x1488f5[_0x6535('0x17')](_0x18fe7b);}return _0x1488f5['status'](_0x18fe7b)[_0x6535('0x18')]();};}function respondWithResult(_0x494e0f,_0x200901){_0x200901=_0x200901||0xc8;return function(_0x1ec66b){if(_0x1ec66b){return _0x494e0f[_0x6535('0x19')](_0x200901)['json'](_0x1ec66b);}};}function respondWithFilteredResult(_0x2fd9ec,_0x1de318){return function(_0x468af6){if(_0x468af6){var _0x250391=typeof _0x1de318[_0x6535('0x1a')]===_0x6535('0x1b')&&typeof _0x1de318[_0x6535('0x1c')]==='undefined';var _0xcec62e=_0x468af6[_0x6535('0x1d')];var _0x520baa=_0x250391?0x0:_0x1de318[_0x6535('0x1a')];var _0x390e39=_0x250391?_0x468af6[_0x6535('0x1d')]:_0x1de318[_0x6535('0x1a')]+_0x1de318[_0x6535('0x1c')];var _0x159105;if(_0x390e39>=_0xcec62e){_0x390e39=_0xcec62e;_0x159105=0xc8;}else{_0x159105=0xce;}_0x2fd9ec[_0x6535('0x19')](_0x159105);return _0x2fd9ec[_0x6535('0x1e')](_0x6535('0x1f'),_0x520baa+'-'+_0x390e39+'/'+_0xcec62e)[_0x6535('0x20')](_0x468af6);}return null;};}function patchUpdates(_0x3bae0){return function(_0x49efef){try{jsonpatch[_0x6535('0x21')](_0x49efef,_0x3bae0,!![]);}catch(_0x97bf4c){return BPromise['reject'](_0x97bf4c);}return _0x49efef[_0x6535('0x22')]();};}function saveUpdates(_0x208ce5,_0x3372e2){return function(_0x36dee8){if(_0x36dee8){return _0x36dee8[_0x6535('0x23')](_0x208ce5)['then'](function(_0xdcd70f){return _0xdcd70f;});}return null;};}function removeEntity(_0x2ae2e2,_0x3f7828){return function(_0x1e3456){if(_0x1e3456){return _0x1e3456[_0x6535('0x24')]()[_0x6535('0x25')](function(){_0x2ae2e2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1561f7,_0x1a8d7e){return function(_0x12eaba){if(!_0x12eaba){_0x1561f7[_0x6535('0x17')](0x194);}return _0x12eaba;};}function handleError(_0x76643e,_0x34d529){_0x34d529=_0x34d529||0x1f4;return function(_0x24e2f3){logger[_0x6535('0x26')](_0x24e2f3['stack']);if(_0x24e2f3[_0x6535('0x27')]){delete _0x24e2f3[_0x6535('0x27')];}_0x76643e[_0x6535('0x19')](_0x34d529)['send'](_0x24e2f3);};}exports[_0x6535('0x28')]=function(_0x5b9aa1,_0x4c1449){var _0x57ccab={},_0x24df99={},_0x235369={'count':0x0,'rows':[]};var _0xa4478f=_[_0x6535('0x29')](db['IntegrationReport'][_0x6535('0x2a')],function(_0x10ad15){return{'name':_0x10ad15[_0x6535('0x2b')],'type':_0x10ad15[_0x6535('0x2c')][_0x6535('0x2d')]};});_0x24df99[_0x6535('0x2e')]=_[_0x6535('0x29')](_0xa4478f,'name');_0x24df99['query']=_[_0x6535('0x2f')](_0x5b9aa1[_0x6535('0x30')]);_0x24df99[_0x6535('0x31')]=_['intersection'](_0x24df99[_0x6535('0x2e')],_0x24df99['query']);_0x57ccab[_0x6535('0x32')]=_[_0x6535('0x33')](_0x24df99[_0x6535('0x2e')],qs[_0x6535('0x34')](_0x5b9aa1[_0x6535('0x30')][_0x6535('0x34')]));_0x57ccab[_0x6535('0x32')]=_0x57ccab[_0x6535('0x32')][_0x6535('0x35')]?_0x57ccab[_0x6535('0x32')]:_0x24df99[_0x6535('0x2e')];if(!_0x5b9aa1[_0x6535('0x30')][_0x6535('0x36')](_0x6535('0x37'))){_0x57ccab[_0x6535('0x1c')]=qs[_0x6535('0x1c')](_0x5b9aa1[_0x6535('0x30')]['limit']);_0x57ccab[_0x6535('0x1a')]=qs[_0x6535('0x1a')](_0x5b9aa1[_0x6535('0x30')][_0x6535('0x1a')]);}_0x57ccab[_0x6535('0x38')]=qs[_0x6535('0x39')](_0x5b9aa1[_0x6535('0x30')][_0x6535('0x39')]);_0x57ccab['where']=qs[_0x6535('0x31')](_[_0x6535('0x3a')](_0x5b9aa1[_0x6535('0x30')],_0x24df99[_0x6535('0x31')]),_0xa4478f);if(_0x5b9aa1[_0x6535('0x30')][_0x6535('0x3b')]){_0x57ccab[_0x6535('0x3c')]=_['merge'](_0x57ccab[_0x6535('0x3c')],{'$or':_[_0x6535('0x29')](_0xa4478f,function(_0x17c75e){if(_0x17c75e[_0x6535('0x2c')]!==_0x6535('0x3d')){var _0x2ec825={};_0x2ec825[_0x17c75e[_0x6535('0x27')]]={'$like':'%'+_0x5b9aa1[_0x6535('0x30')][_0x6535('0x3b')]+'%'};return _0x2ec825;}})});}_0x57ccab=_[_0x6535('0x3e')]({},_0x57ccab,_0x5b9aa1[_0x6535('0x3f')]);var _0x46c1b5={'where':_0x57ccab[_0x6535('0x3c')]};return db['IntegrationReport'][_0x6535('0x1d')](_0x46c1b5)[_0x6535('0x25')](function(_0x4f7778){_0x235369[_0x6535('0x1d')]=_0x4f7778;if(_0x5b9aa1[_0x6535('0x30')][_0x6535('0x40')]){_0x57ccab[_0x6535('0x41')]=[{'all':!![]}];}return db[_0x6535('0x42')]['findAll'](_0x57ccab);})[_0x6535('0x25')](function(_0x1e45cc){_0x235369[_0x6535('0x43')]=_0x1e45cc;return _0x235369;})[_0x6535('0x25')](respondWithFilteredResult(_0x4c1449,_0x57ccab))[_0x6535('0x44')](handleError(_0x4c1449,null));};exports['show']=function(_0x1bf856,_0x359041){var _0x289f8a={'raw':![],'where':{'id':_0x1bf856[_0x6535('0x45')]['id']}},_0x2696db={};_0x2696db[_0x6535('0x2e')]=_[_0x6535('0x2f')](db[_0x6535('0x42')][_0x6535('0x2a')]);_0x2696db[_0x6535('0x30')]=_['keys'](_0x1bf856[_0x6535('0x30')]);_0x2696db[_0x6535('0x31')]=_['intersection'](_0x2696db[_0x6535('0x2e')],_0x2696db[_0x6535('0x30')]);_0x289f8a['attributes']=_[_0x6535('0x33')](_0x2696db[_0x6535('0x2e')],qs[_0x6535('0x34')](_0x1bf856['query'][_0x6535('0x34')]));_0x289f8a[_0x6535('0x32')]=_0x289f8a[_0x6535('0x32')][_0x6535('0x35')]?_0x289f8a[_0x6535('0x32')]:_0x2696db[_0x6535('0x2e')];if(_0x1bf856[_0x6535('0x30')]['includeAll']){_0x289f8a[_0x6535('0x41')]=[{'all':!![]}];}_0x289f8a=_[_0x6535('0x3e')]({},_0x289f8a,_0x1bf856[_0x6535('0x3f')]);return db[_0x6535('0x42')][_0x6535('0x46')](_0x289f8a)[_0x6535('0x25')](handleEntityNotFound(_0x359041,null))[_0x6535('0x25')](respondWithResult(_0x359041,null))[_0x6535('0x44')](handleError(_0x359041,null));};exports['create']=function(_0x210da0,_0x785070){return db[_0x6535('0x42')]['create'](_0x210da0[_0x6535('0x47')],{})[_0x6535('0x25')](respondWithResult(_0x785070,0xc9))['catch'](handleError(_0x785070,null));};exports[_0x6535('0x23')]=function(_0x5c91de,_0x23560f){if(_0x5c91de[_0x6535('0x47')]['id']){delete _0x5c91de[_0x6535('0x47')]['id'];}return db['IntegrationReport'][_0x6535('0x46')]({'where':{'id':_0x5c91de[_0x6535('0x45')]['id']}})['then'](handleEntityNotFound(_0x23560f,null))[_0x6535('0x25')](saveUpdates(_0x5c91de['body'],null))['then'](respondWithResult(_0x23560f,null))[_0x6535('0x44')](handleError(_0x23560f,null));};exports[_0x6535('0x24')]=function(_0x4d824c,_0x5e132a){return db[_0x6535('0x42')][_0x6535('0x46')]({'where':{'id':_0x4d824c[_0x6535('0x45')]['id']}})[_0x6535('0x25')](handleEntityNotFound(_0x5e132a,null))[_0x6535('0x25')](removeEntity(_0x5e132a,null))[_0x6535('0x44')](handleError(_0x5e132a,null));};exports[_0x6535('0x48')]=function(_0x5515f9,_0x19206a){return db['IntegrationReport'][_0x6535('0x48')]()[_0x6535('0x25')](respondWithResult(_0x19206a,null))[_0x6535('0x44')](handleError(_0x19206a,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 00d81a3..e594cfa 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 _0x8ecc=['moment','bluebird','../../config/environment','exports','define','IntegrationReport','report_integration','lodash','util','../../config/logger','api'];(function(_0x2070c9,_0x40401a){var _0x28b55e=function(_0xc08ba3){while(--_0xc08ba3){_0x2070c9['push'](_0x2070c9['shift']());}};_0x28b55e(++_0x40401a);}(_0x8ecc,0xee));var _0xc8ec=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8ecc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc8ec('0x0'));var util=require(_0xc8ec('0x1'));var logger=require(_0xc8ec('0x2'))(_0xc8ec('0x3'));var moment=require(_0xc8ec('0x4'));var BPromise=require(_0xc8ec('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc8ec('0x6'));var attributes=require('./integrationReport.attributes');module[_0xc8ec('0x7')]=function(_0xf7d814,_0x5f16df){return _0xf7d814[_0xc8ec('0x8')](_0xc8ec('0x9'),attributes,{'tableName':_0xc8ec('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0d75=['report_integration','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport'];(function(_0xb38709,_0x5d7047){var _0x148a56=function(_0x1e6994){while(--_0x1e6994){_0xb38709['push'](_0xb38709['shift']());}};_0x148a56(++_0x5d7047);}(_0x0d75,0x1dd));var _0x50d7=function(_0x4dfe17,_0x145773){_0x4dfe17=_0x4dfe17-0x0;var _0x3efcbc=_0x0d75[_0x4dfe17];return _0x3efcbc;};'use strict';var _=require(_0x50d7('0x0'));var util=require(_0x50d7('0x1'));var logger=require(_0x50d7('0x2'))(_0x50d7('0x3'));var moment=require(_0x50d7('0x4'));var BPromise=require(_0x50d7('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x50d7('0x6'));var rimraf=require(_0x50d7('0x7'));var config=require(_0x50d7('0x8'));var attributes=require(_0x50d7('0x9'));module[_0x50d7('0xa')]=function(_0x31c255,_0x499ef1){return _0x31c255[_0x50d7('0xb')](_0x50d7('0xc'),attributes,{'tableName':_0x50d7('0xd'),'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 69c7ba4..592b212 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 _0x814b=['info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x814b,0x1a2));var _0xb814=function(_0x324d77,_0x307ef7){_0x324d77=_0x324d77-0x0;var _0x2a77a7=_0x814b[_0x324d77];return _0x2a77a7;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var BPromise=require(_0xb814('0x3'));var rs=require(_0xb814('0x4'));var fs=require('fs');var Redis=require(_0xb814('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));var config=require(_0xb814('0x9'));var jayson=require(_0xb814('0xa'));var client=jayson[_0xb814('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b0829,_0x2e6272,_0x5c8539){return new BPromise(function(_0x271af9,_0x2913a6){return client[_0xb814('0xc')](_0x3b0829,_0x5c8539)[_0xb814('0xd')](function(_0x1fea33){logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));logger[_0xb814('0x11')](_0xb814('0x12'),_0x2e6272,_0xb814('0x10'),JSON['stringify'](_0x1fea33));if(_0x1fea33[_0xb814('0x13')]){if(_0x1fea33['error'][_0xb814('0x14')]===0x1f4){logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x2913a6(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x271af9(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}else{logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));_0x271af9(_0x1fea33[_0xb814('0x16')][_0xb814('0x15')]);}})[_0xb814('0x17')](function(_0x21b73f){logger[_0xb814('0x13')]('IntegrationReport,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});} \ No newline at end of file +var _0x57ca=['client','http','request','info','request\x20sent','IntegrationReport,\x20%s,\x20%s,\x20%s','error','code','IntegrationReport,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x27a441,_0x42ba61){var _0x3c55c0=function(_0x2102b5){while(--_0x2102b5){_0x27a441['push'](_0x27a441['shift']());}};_0x3c55c0(++_0x42ba61);}(_0x57ca,0x108));var _0xa57c=function(_0x5bca19,_0x5e3dd0){_0x5bca19=_0x5bca19-0x0;var _0x811b8f=_0x57ca[_0x5bca19];return _0x811b8f;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa57c('0x2'));var fs=require('fs');var Redis=require(_0xa57c('0x3'));var db=require(_0xa57c('0x4'))['db'];var utils=require(_0xa57c('0x5'));var logger=require(_0xa57c('0x6'))('rpc');var config=require(_0xa57c('0x7'));var jayson=require(_0xa57c('0x8'));var client=jayson[_0xa57c('0x9')][_0xa57c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbdfffb,_0x314574,_0x19e28e){return new BPromise(function(_0x271ccc,_0x5e3962){return client[_0xa57c('0xb')](_0xbdfffb,_0x19e28e)['then'](function(_0x46ba92){logger[_0xa57c('0xc')]('IntegrationReport,\x20%s,\x20%s',_0x314574,_0xa57c('0xd'));logger['debug'](_0xa57c('0xe'),_0x314574,_0xa57c('0xd'),JSON['stringify'](_0x46ba92));if(_0x46ba92[_0xa57c('0xf')]){if(_0x46ba92['error'][_0xa57c('0x10')]===0x1f4){logger[_0xa57c('0xf')](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x5e3962(_0x46ba92['error'][_0xa57c('0x12')]);}logger['error'](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x271ccc(_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);}else{logger[_0xa57c('0xc')](_0xa57c('0x11'),_0x314574,'request\x20sent');_0x271ccc(_0x46ba92[_0xa57c('0x13')][_0xa57c('0x12')]);}})[_0xa57c('0x14')](function(_0x5a6024){logger[_0xa57c('0xf')]('IntegrationReport,\x20%s,\x20%s',_0x314574,_0x5a6024);_0x5e3962(_0x5a6024);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index ea3518e..993774a 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 _0x46cb=['../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','/:id/sub_intervals','getIntervals','post','addInterval','/:id/sub_intervals/create_many','put','update','destroy','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4e9a52,_0x25b20d){var _0x2d425f=function(_0x4f2157){while(--_0x4f2157){_0x4e9a52['push'](_0x4e9a52['shift']());}};_0x2d425f(++_0x25b20d);}(_0x46cb,0xd6));var _0xb46c=function(_0xd8face,_0x4ef518){_0xd8face=_0xd8face-0x0;var _0x38d98d=_0x46cb[_0xd8face];return _0x38d98d;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xb46c('0x0'));var express=require(_0xb46c('0x1'));var router=express[_0xb46c('0x2')]();var fs_extra=require(_0xb46c('0x3'));var auth=require(_0xb46c('0x4'));var interaction=require(_0xb46c('0x5'));var config=require(_0xb46c('0x6'));var controller=require(_0xb46c('0x7'));router[_0xb46c('0x8')]('/',auth[_0xb46c('0x9')](),controller[_0xb46c('0xa')]);router[_0xb46c('0x8')](_0xb46c('0xb'),auth[_0xb46c('0x9')](),controller['show']);router[_0xb46c('0x8')](_0xb46c('0xc'),auth[_0xb46c('0x9')](),controller[_0xb46c('0xd')]);router[_0xb46c('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xb46c('0xc'),auth[_0xb46c('0x9')](),controller[_0xb46c('0xf')]);router[_0xb46c('0xe')](_0xb46c('0x10'),auth[_0xb46c('0x9')](),controller['addIntervals']);router[_0xb46c('0x11')]('/:id',auth[_0xb46c('0x9')](),controller[_0xb46c('0x12')]);router['delete'](_0xb46c('0xb'),auth[_0xb46c('0x9')](),controller[_0xb46c('0x13')]);module['exports']=router; \ No newline at end of file +var _0xbd3c=['Router','fs-extra','../../config/environment','get','isAuthenticated','/:id','/:id/sub_intervals','getIntervals','post','/:id/sub_intervals/create_many','addIntervals','update','delete','exports','multer','util','path','express'];(function(_0xbcc528,_0x2277c8){var _0x372add=function(_0x9c0f18){while(--_0x9c0f18){_0xbcc528['push'](_0xbcc528['shift']());}};_0x372add(++_0x2277c8);}(_0xbd3c,0xc2));var _0xcbd3=function(_0x16f4ab,_0x2da579){_0x16f4ab=_0x16f4ab-0x0;var _0x227f9d=_0xbd3c[_0x16f4ab];return _0x227f9d;};'use strict';var multer=require(_0xcbd3('0x0'));var util=require(_0xcbd3('0x1'));var path=require(_0xcbd3('0x2'));var timeout=require('connect-timeout');var express=require(_0xcbd3('0x3'));var router=express[_0xcbd3('0x4')]();var fs_extra=require(_0xcbd3('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xcbd3('0x6'));var controller=require('./interval.controller');router[_0xcbd3('0x7')]('/',auth[_0xcbd3('0x8')](),controller['index']);router[_0xcbd3('0x7')](_0xcbd3('0x9'),auth[_0xcbd3('0x8')](),controller['show']);router[_0xcbd3('0x7')](_0xcbd3('0xa'),auth[_0xcbd3('0x8')](),controller[_0xcbd3('0xb')]);router[_0xcbd3('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xcbd3('0xc')](_0xcbd3('0xa'),auth['isAuthenticated'](),controller['addInterval']);router['post'](_0xcbd3('0xd'),auth[_0xcbd3('0x8')](),controller[_0xcbd3('0xe')]);router['put'](_0xcbd3('0x9'),auth[_0xcbd3('0x8')](),controller[_0xcbd3('0xf')]);router[_0xcbd3('0x10')](_0xcbd3('0x9'),auth[_0xcbd3('0x8')](),controller['destroy']);module[_0xcbd3('0x11')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 111508f..2de9af6 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 _0xec13=['exports','STRING','sequelize'];(function(_0x511016,_0x434344){var _0x2d537a=function(_0x4989c5){while(--_0x4989c5){_0x511016['push'](_0x511016['shift']());}};_0x2d537a(++_0x434344);}(_0xec13,0x116));var _0x3ec1=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xec13[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require(_0x3ec1('0x0'));module[_0x3ec1('0x1')]={'name':{'type':Sequelize[_0x3ec1('0x2')]},'description':{'type':Sequelize[_0x3ec1('0x2')]},'interval':{'type':Sequelize[_0x3ec1('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x31a6=['STRING','sequelize','exports'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x31a6,0x7f));var _0x631a=function(_0x487d33,_0x21614e){_0x487d33=_0x487d33-0x0;var _0x4191b3=_0x31a6[_0x487d33];return _0x4191b3;};'use strict';var Sequelize=require(_0x631a('0x0'));module[_0x631a('0x1')]={'name':{'type':Sequelize[_0x631a('0x2')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 25c4248..629ad18 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 _0x2260=['end','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','Intervals','UserProfileResource','destroy','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','Interval','findAll','show','rawAttributes','includeAll','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addInterval','IntervalId','findOne','getIntervals','hasOwnProperty','sequelize','transaction','bulkCreate','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status'];(function(_0x316a28,_0x216300){var _0x476ea7=function(_0x45f6b7){while(--_0x45f6b7){_0x316a28['push'](_0x316a28['shift']());}};_0x476ea7(++_0x216300);}(_0x2260,0x101));var _0x0226=function(_0x10004e,_0xd701e6){_0x10004e=_0x10004e-0x0;var _0x5af990=_0x2260[_0x10004e];return _0x5af990;};'use strict';var emlformat=require(_0x0226('0x0'));var rimraf=require(_0x0226('0x1'));var zipdir=require(_0x0226('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0226('0x3'));var moment=require(_0x0226('0x4'));var BPromise=require(_0x0226('0x5'));var Mustache=require(_0x0226('0x6'));var util=require(_0x0226('0x7'));var path=require(_0x0226('0x8'));var sox=require(_0x0226('0x9'));var csv=require(_0x0226('0xa'));var ejs=require(_0x0226('0xb'));var fs=require('fs');var fs_extra=require(_0x0226('0xc'));var _=require(_0x0226('0xd'));var squel=require(_0x0226('0xe'));var crypto=require(_0x0226('0xf'));var jsforce=require(_0x0226('0x10'));var deskjs=require(_0x0226('0x11'));var toCsv=require(_0x0226('0xa'));var querystring=require('querystring');var Papa=require(_0x0226('0x12'));var Redis=require(_0x0226('0x13'));var authService=require(_0x0226('0x14'));var qs=require(_0x0226('0x15'));var as=require(_0x0226('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0226('0x17'))(_0x0226('0x18'));var utils=require('../../config/utils');var config=require(_0x0226('0x19'));var licenseUtil=require(_0x0226('0x1a'));var db=require(_0x0226('0x1b'))['db'];var extensions=require(_0x0226('0x1c'));function respondWithStatusCode(_0x2819d2,_0x5aa329){_0x5aa329=_0x5aa329||0xcc;return function(_0x356ea4){if(_0x356ea4){return _0x2819d2[_0x0226('0x1d')](_0x5aa329);}return _0x2819d2[_0x0226('0x1e')](_0x5aa329)[_0x0226('0x1f')]();};}function respondWithResult(_0x4f5953,_0x5dd4a1){_0x5dd4a1=_0x5dd4a1||0xc8;return function(_0x43ef44){if(_0x43ef44){return _0x4f5953['status'](_0x5dd4a1)['json'](_0x43ef44);}};}function respondWithFilteredResult(_0x46eb91,_0x4ea86d){return function(_0x48035b){if(_0x48035b){var _0x58e425=typeof _0x4ea86d['offset']===_0x0226('0x20')&&typeof _0x4ea86d[_0x0226('0x21')]===_0x0226('0x20');var _0x1a2ef8=_0x48035b[_0x0226('0x22')];var _0x46fa8d=_0x58e425?0x0:_0x4ea86d[_0x0226('0x23')];var _0x121ec9=_0x58e425?_0x48035b['count']:_0x4ea86d[_0x0226('0x23')]+_0x4ea86d[_0x0226('0x21')];var _0x46e8e8;if(_0x121ec9>=_0x1a2ef8){_0x121ec9=_0x1a2ef8;_0x46e8e8=0xc8;}else{_0x46e8e8=0xce;}_0x46eb91[_0x0226('0x1e')](_0x46e8e8);return _0x46eb91['set'](_0x0226('0x24'),_0x46fa8d+'-'+_0x121ec9+'/'+_0x1a2ef8)['json'](_0x48035b);}return null;};}function patchUpdates(_0x2b15e1){return function(_0x52b77d){try{jsonpatch[_0x0226('0x25')](_0x52b77d,_0x2b15e1,!![]);}catch(_0x4eec94){return BPromise[_0x0226('0x26')](_0x4eec94);}return _0x52b77d[_0x0226('0x27')]();};}function saveUpdates(_0x8812fe,_0x553acc){return function(_0x4f0b8d){if(_0x4f0b8d){return _0x4f0b8d[_0x0226('0x28')](_0x8812fe)[_0x0226('0x29')](function(_0x2a9f19){return _0x2a9f19;});}return null;};}function removeEntity(_0x392c16,_0x40830d){return function(_0x27a33e){if(_0x27a33e){return _0x27a33e['destroy']()[_0x0226('0x29')](function(){var _0x3948d0=_0x27a33e['get']({'plain':!![]});var _0x521f7a=_0x0226('0x2a');return db[_0x0226('0x2b')][_0x0226('0x2c')]({'where':{'type':_0x521f7a,'resourceId':_0x3948d0['id']}})['then'](function(){return _0x27a33e;});})['then'](function(){_0x392c16[_0x0226('0x1e')](0xcc)[_0x0226('0x1f')]();});}};}function handleEntityNotFound(_0x5b4125,_0x3dbaf4){return function(_0x4d81b0){if(!_0x4d81b0){_0x5b4125[_0x0226('0x1d')](0x194);}return _0x4d81b0;};}function handleError(_0x3add13,_0xd4a53b){_0xd4a53b=_0xd4a53b||0x1f4;return function(_0x1b46fc){logger[_0x0226('0x2d')](_0x1b46fc[_0x0226('0x2e')]);if(_0x1b46fc[_0x0226('0x2f')]){delete _0x1b46fc[_0x0226('0x2f')];}_0x3add13[_0x0226('0x1e')](_0xd4a53b)[_0x0226('0x30')](_0x1b46fc);};}exports[_0x0226('0x31')]=function(_0x2a0424,_0x480e9a){var _0x45e44d={},_0x19cbb1={},_0x71599f={'count':0x0,'rows':[]};var _0x430e8a=_[_0x0226('0x32')](db['Interval']['rawAttributes'],function(_0x35f487){return{'name':_0x35f487[_0x0226('0x33')],'type':_0x35f487[_0x0226('0x34')][_0x0226('0x35')]};});_0x19cbb1[_0x0226('0x36')]=_[_0x0226('0x32')](_0x430e8a,_0x0226('0x2f'));_0x19cbb1[_0x0226('0x37')]=_[_0x0226('0x38')](_0x2a0424['query']);_0x19cbb1['filters']=_[_0x0226('0x39')](_0x19cbb1[_0x0226('0x36')],_0x19cbb1[_0x0226('0x37')]);_0x45e44d[_0x0226('0x3a')]=_[_0x0226('0x39')](_0x19cbb1[_0x0226('0x36')],qs[_0x0226('0x3b')](_0x2a0424[_0x0226('0x37')]['fields']));_0x45e44d['attributes']=_0x45e44d['attributes'][_0x0226('0x3c')]?_0x45e44d['attributes']:_0x19cbb1[_0x0226('0x36')];if(!_0x2a0424['query']['hasOwnProperty'](_0x0226('0x3d'))){_0x45e44d[_0x0226('0x21')]=qs[_0x0226('0x21')](_0x2a0424['query'][_0x0226('0x21')]);_0x45e44d[_0x0226('0x23')]=qs['offset'](_0x2a0424[_0x0226('0x37')][_0x0226('0x23')]);}_0x45e44d[_0x0226('0x3e')]=qs[_0x0226('0x3f')](_0x2a0424[_0x0226('0x37')][_0x0226('0x3f')]);_0x45e44d[_0x0226('0x40')]=qs[_0x0226('0x41')](_[_0x0226('0x42')](_0x2a0424['query'],_0x19cbb1[_0x0226('0x41')]),_0x430e8a);if(_0x2a0424['query'][_0x0226('0x43')]){_0x45e44d[_0x0226('0x40')]=_[_0x0226('0x44')](_0x45e44d[_0x0226('0x40')],{'$or':_[_0x0226('0x32')](_0x430e8a,function(_0x7bf80){if(_0x7bf80[_0x0226('0x34')]!==_0x0226('0x45')){var _0x3df95b={};_0x3df95b[_0x7bf80[_0x0226('0x2f')]]={'$like':'%'+_0x2a0424['query']['filter']+'%'};return _0x3df95b;}})});}_0x45e44d=_['merge']({},_0x45e44d,_0x2a0424[_0x0226('0x46')]);var _0xb961ef={'where':_0x45e44d[_0x0226('0x40')]};return db[_0x0226('0x47')][_0x0226('0x22')](_0xb961ef)[_0x0226('0x29')](function(_0x5d579e){_0x71599f[_0x0226('0x22')]=_0x5d579e;if(_0x2a0424[_0x0226('0x37')]['includeAll']){_0x45e44d['include']=[{'all':!![]}];}return db['Interval'][_0x0226('0x48')](_0x45e44d);})['then'](function(_0x5574eb){_0x71599f['rows']=_0x5574eb;return _0x71599f;})[_0x0226('0x29')](respondWithFilteredResult(_0x480e9a,_0x45e44d))['catch'](handleError(_0x480e9a,null));};exports[_0x0226('0x49')]=function(_0x267bc0,_0x44e73b){var _0x130f99={'raw':!![],'where':{'id':_0x267bc0['params']['id']}},_0x463768={};_0x463768[_0x0226('0x36')]=_[_0x0226('0x38')](db[_0x0226('0x47')][_0x0226('0x4a')]);_0x463768['query']=_[_0x0226('0x38')](_0x267bc0[_0x0226('0x37')]);_0x463768[_0x0226('0x41')]=_['intersection'](_0x463768[_0x0226('0x36')],_0x463768[_0x0226('0x37')]);_0x130f99[_0x0226('0x3a')]=_['intersection'](_0x463768[_0x0226('0x36')],qs['fields'](_0x267bc0['query']['fields']));_0x130f99[_0x0226('0x3a')]=_0x130f99[_0x0226('0x3a')][_0x0226('0x3c')]?_0x130f99[_0x0226('0x3a')]:_0x463768['model'];if(_0x267bc0['query'][_0x0226('0x4b')]){_0x130f99['include']=[{'all':!![]}];}_0x130f99=_[_0x0226('0x44')]({},_0x130f99,_0x267bc0[_0x0226('0x46')]);return db[_0x0226('0x47')][_0x0226('0x4c')](_0x130f99)[_0x0226('0x29')](handleEntityNotFound(_0x44e73b,null))[_0x0226('0x29')](respondWithResult(_0x44e73b,null))[_0x0226('0x4d')](handleError(_0x44e73b,null));};exports['create']=function(_0x3eb173,_0x1b4cdc){return db[_0x0226('0x47')][_0x0226('0x4e')](_0x3eb173[_0x0226('0x4f')],{})['then'](function(_0xdff77f){var _0x1aa319=_0x3eb173[_0x0226('0x50')][_0x0226('0x51')]({'plain':!![]});if(!_0x1aa319)throw new Error(_0x0226('0x52'));if(_0x1aa319['role']==='user'){var _0x1a74c3=_0xdff77f[_0x0226('0x51')]({'plain':!![]});var _0x45c98f=_0x0226('0x2a');return db[_0x0226('0x53')][_0x0226('0x4c')]({'where':{'name':_0x45c98f,'userProfileId':_0x1aa319[_0x0226('0x54')]},'raw':!![]})[_0x0226('0x29')](function(_0x4d2ae4){if(_0x4d2ae4&&_0x4d2ae4[_0x0226('0x55')]===0x0){return db[_0x0226('0x2b')]['create']({'name':_0x1a74c3[_0x0226('0x2f')],'resourceId':_0x1a74c3['id'],'type':_0x4d2ae4[_0x0226('0x2f')],'sectionId':_0x4d2ae4['id']},{})['then'](function(){return _0xdff77f;});}else{return _0xdff77f;}})['catch'](function(_0x5c53ee){logger[_0x0226('0x2d')](_0x0226('0x56'),_0x5c53ee);throw _0x5c53ee;});}return _0xdff77f;})[_0x0226('0x29')](respondWithResult(_0x1b4cdc,0xc9))[_0x0226('0x4d')](handleError(_0x1b4cdc,null));};exports[_0x0226('0x28')]=function(_0x302e56,_0x3904a7){if(_0x302e56[_0x0226('0x4f')]['id']){delete _0x302e56[_0x0226('0x4f')]['id'];}return db[_0x0226('0x47')][_0x0226('0x4c')]({'where':{'id':_0x302e56['params']['id']}})[_0x0226('0x29')](handleEntityNotFound(_0x3904a7,null))[_0x0226('0x29')](saveUpdates(_0x302e56[_0x0226('0x4f')],null))['then'](respondWithResult(_0x3904a7,null))[_0x0226('0x4d')](handleError(_0x3904a7,null));};exports[_0x0226('0x2c')]=function(_0x16db71,_0x1fbbca){return db[_0x0226('0x47')]['find']({'where':{'id':_0x16db71[_0x0226('0x57')]['id']}})['then'](handleEntityNotFound(_0x1fbbca,null))['then'](removeEntity(_0x1fbbca,null))[_0x0226('0x4d')](handleError(_0x1fbbca,null));};exports[_0x0226('0x58')]=function(_0xe1ef2,_0x43d41d,_0x2a95d4){if(_0xe1ef2[_0x0226('0x4f')]['id']){delete _0xe1ef2[_0x0226('0x4f')]['id'];}return db[_0x0226('0x47')][_0x0226('0x4c')]({'where':{'id':_0xe1ef2[_0x0226('0x57')]['id']}})[_0x0226('0x29')](handleEntityNotFound(_0x43d41d,null))[_0x0226('0x29')](function(_0x12932e){if(_0x12932e){_0xe1ef2[_0x0226('0x4f')][_0x0226('0x59')]=_0x12932e['id'];return db['Interval'][_0x0226('0x4e')](_0xe1ef2[_0x0226('0x4f')]);}})[_0x0226('0x29')](respondWithResult(_0x43d41d,null))['catch'](handleError(_0x43d41d,null));};exports['getIntervals']=function(_0x56f0ce,_0x4ec21e,_0x486bd4){var _0x43070b={};var _0x12b394={};var _0x34346e;var _0x3fffec;return db['Interval'][_0x0226('0x5a')]({'where':{'id':_0x56f0ce[_0x0226('0x57')]['id']}})['then'](handleEntityNotFound(_0x4ec21e,null))[_0x0226('0x29')](function(_0x5d2f16){if(_0x5d2f16){_0x34346e=_0x5d2f16;_0x12b394[_0x0226('0x36')]=_[_0x0226('0x38')](db[_0x0226('0x47')][_0x0226('0x4a')]);_0x12b394[_0x0226('0x37')]=_[_0x0226('0x38')](_0x56f0ce[_0x0226('0x37')]);_0x12b394[_0x0226('0x41')]=_[_0x0226('0x39')](_0x12b394[_0x0226('0x36')],_0x12b394[_0x0226('0x37')]);_0x43070b[_0x0226('0x3a')]=_['intersection'](_0x12b394['model'],qs['fields'](_0x56f0ce[_0x0226('0x37')][_0x0226('0x3b')]));_0x43070b[_0x0226('0x3a')]=_0x43070b['attributes'][_0x0226('0x3c')]?_0x43070b['attributes']:_0x12b394[_0x0226('0x36')];_0x43070b[_0x0226('0x3e')]=qs[_0x0226('0x3f')](_0x56f0ce[_0x0226('0x37')][_0x0226('0x3f')]);_0x43070b[_0x0226('0x40')]=qs[_0x0226('0x41')](_[_0x0226('0x42')](_0x56f0ce[_0x0226('0x37')],_0x12b394[_0x0226('0x41')]));if(_0x56f0ce[_0x0226('0x37')][_0x0226('0x43')]){_0x43070b[_0x0226('0x40')]=_[_0x0226('0x44')](_0x43070b[_0x0226('0x40')],{'$or':_[_0x0226('0x32')](_0x43070b[_0x0226('0x3a')],function(_0x492f68){var _0x490317={};_0x490317[_0x492f68]={'$like':'%'+_0x56f0ce[_0x0226('0x37')][_0x0226('0x43')]+'%'};return _0x490317;})});}_0x43070b=_[_0x0226('0x44')]({},_0x43070b,_0x56f0ce['options']);return _0x34346e[_0x0226('0x5b')](_0x43070b);}})['then'](function(_0x18715f){if(_0x18715f){_0x3fffec=_0x18715f[_0x0226('0x3c')];if(!_0x56f0ce[_0x0226('0x37')][_0x0226('0x5c')](_0x0226('0x3d'))){_0x43070b[_0x0226('0x21')]=qs['limit'](_0x56f0ce['query'][_0x0226('0x21')]);_0x43070b['offset']=qs[_0x0226('0x23')](_0x56f0ce['query'][_0x0226('0x23')]);}return _0x34346e['getIntervals'](_0x43070b);}})[_0x0226('0x29')](function(_0x154a53){if(_0x154a53){return _0x154a53?{'count':_0x3fffec,'rows':_0x154a53}:null;}})[_0x0226('0x29')](respondWithResult(_0x4ec21e,null))['catch'](handleError(_0x4ec21e,null));};exports['addIntervals']=function(_0x11d8c2,_0x33f522,_0x1f7f39){return db['Interval'][_0x0226('0x5a')]({'where':{'id':_0x11d8c2[_0x0226('0x57')]['id']}})[_0x0226('0x29')](handleEntityNotFound(_0x33f522,null))['then'](function(_0x30b1b2){if(_0x30b1b2){return db[_0x0226('0x5d')][_0x0226('0x5e')](function(_0xd15d12){return db[_0x0226('0x47')][_0x0226('0x2c')]({'where':{'IntervalId':_0x11d8c2[_0x0226('0x57')]['id']},'transaction':_0xd15d12})[_0x0226('0x29')](function(_0x5cee0d){var _0x8f3da=_['map'](_0x11d8c2[_0x0226('0x4f')],function(_0x1a7252){delete _0x1a7252['id'];_0x1a7252[_0x0226('0x59')]=_0x11d8c2[_0x0226('0x57')]['id'];return _0x1a7252;});return db[_0x0226('0x47')][_0x0226('0x5f')](_0x8f3da,{'transaction':_0xd15d12});});})[_0x0226('0x29')](function(){return db[_0x0226('0x47')][_0x0226('0x48')]({'where':{'IntervalId':_0x11d8c2[_0x0226('0x57')]['id']}});});}})['then'](respondWithResult(_0x33f522,null))[_0x0226('0x4d')](handleError(_0x33f522,null));}; \ No newline at end of file +var _0xaf2c=['options','include','rows','catch','show','params','includeAll','find','create','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','IntervalId','getIntervals','findOne','addIntervals','sequelize','transaction','bulkCreate','findAll','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/extensions/rewrite','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','Intervals','sendStatus','error','stack','name','send','index','Interval','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','map','VIRTUAL'];(function(_0x175346,_0x396958){var _0x445cf3=function(_0x30a0aa){while(--_0x30a0aa){_0x175346['push'](_0x175346['shift']());}};_0x445cf3(++_0x396958);}(_0xaf2c,0x18c));var _0xcaf2=function(_0x580865,_0x4cefc4){_0x580865=_0x580865-0x0;var _0x40895d=_0xaf2c[_0x580865];return _0x40895d;};'use strict';var emlformat=require(_0xcaf2('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xcaf2('0x1'));var rp=require(_0xcaf2('0x2'));var moment=require(_0xcaf2('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xcaf2('0x4'));var util=require(_0xcaf2('0x5'));var path=require(_0xcaf2('0x6'));var sox=require(_0xcaf2('0x7'));var csv=require(_0xcaf2('0x8'));var ejs=require(_0xcaf2('0x9'));var fs=require('fs');var fs_extra=require(_0xcaf2('0xa'));var _=require(_0xcaf2('0xb'));var squel=require(_0xcaf2('0xc'));var crypto=require('crypto');var jsforce=require(_0xcaf2('0xd'));var deskjs=require(_0xcaf2('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xcaf2('0xf'));var authService=require(_0xcaf2('0x10'));var qs=require(_0xcaf2('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcaf2('0x12'));var logger=require(_0xcaf2('0x13'))(_0xcaf2('0x14'));var utils=require(_0xcaf2('0x15'));var config=require(_0xcaf2('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xcaf2('0x17'))['db'];var extensions=require(_0xcaf2('0x18'));function respondWithStatusCode(_0x364322,_0x438efd){_0x438efd=_0x438efd||0xcc;return function(_0x4063df){if(_0x4063df){return _0x364322['sendStatus'](_0x438efd);}return _0x364322[_0xcaf2('0x19')](_0x438efd)[_0xcaf2('0x1a')]();};}function respondWithResult(_0x5a0ba4,_0x273563){_0x273563=_0x273563||0xc8;return function(_0xfa1f7f){if(_0xfa1f7f){return _0x5a0ba4[_0xcaf2('0x19')](_0x273563)[_0xcaf2('0x1b')](_0xfa1f7f);}};}function respondWithFilteredResult(_0x4d09e9,_0x5c6ed0){return function(_0x3cc639){if(_0x3cc639){var _0x5d9bb9=typeof _0x5c6ed0[_0xcaf2('0x1c')]===_0xcaf2('0x1d')&&typeof _0x5c6ed0[_0xcaf2('0x1e')]===_0xcaf2('0x1d');var _0x5b2722=_0x3cc639[_0xcaf2('0x1f')];var _0x3b22b8=_0x5d9bb9?0x0:_0x5c6ed0['offset'];var _0x1e7524=_0x5d9bb9?_0x3cc639[_0xcaf2('0x1f')]:_0x5c6ed0[_0xcaf2('0x1c')]+_0x5c6ed0[_0xcaf2('0x1e')];var _0x1a19ee;if(_0x1e7524>=_0x5b2722){_0x1e7524=_0x5b2722;_0x1a19ee=0xc8;}else{_0x1a19ee=0xce;}_0x4d09e9[_0xcaf2('0x19')](_0x1a19ee);return _0x4d09e9[_0xcaf2('0x20')](_0xcaf2('0x21'),_0x3b22b8+'-'+_0x1e7524+'/'+_0x5b2722)[_0xcaf2('0x1b')](_0x3cc639);}return null;};}function patchUpdates(_0x1efe99){return function(_0x18bae9){try{jsonpatch[_0xcaf2('0x22')](_0x18bae9,_0x1efe99,!![]);}catch(_0x17410f){return BPromise['reject'](_0x17410f);}return _0x18bae9[_0xcaf2('0x23')]();};}function saveUpdates(_0x2cdb98,_0x4125fe){return function(_0x23d2c3){if(_0x23d2c3){return _0x23d2c3[_0xcaf2('0x24')](_0x2cdb98)[_0xcaf2('0x25')](function(_0x298280){return _0x298280;});}return null;};}function removeEntity(_0x53dc01,_0x21ef4e){return function(_0x3a114c){if(_0x3a114c){return _0x3a114c[_0xcaf2('0x26')]()[_0xcaf2('0x25')](function(){var _0x108b5b=_0x3a114c[_0xcaf2('0x27')]({'plain':!![]});var _0x183e9e=_0xcaf2('0x28');return db['UserProfileResource'][_0xcaf2('0x26')]({'where':{'type':_0x183e9e,'resourceId':_0x108b5b['id']}})[_0xcaf2('0x25')](function(){return _0x3a114c;});})[_0xcaf2('0x25')](function(){_0x53dc01[_0xcaf2('0x19')](0xcc)[_0xcaf2('0x1a')]();});}};}function handleEntityNotFound(_0x332c9f,_0x104b56){return function(_0x1fd935){if(!_0x1fd935){_0x332c9f[_0xcaf2('0x29')](0x194);}return _0x1fd935;};}function handleError(_0x4dded9,_0x50830c){_0x50830c=_0x50830c||0x1f4;return function(_0xdabce2){logger[_0xcaf2('0x2a')](_0xdabce2[_0xcaf2('0x2b')]);if(_0xdabce2[_0xcaf2('0x2c')]){delete _0xdabce2[_0xcaf2('0x2c')];}_0x4dded9[_0xcaf2('0x19')](_0x50830c)[_0xcaf2('0x2d')](_0xdabce2);};}exports[_0xcaf2('0x2e')]=function(_0x126f59,_0x387da1){var _0x24b10f={},_0x3b0b3d={},_0x125f8d={'count':0x0,'rows':[]};var _0x1cec51=_['map'](db[_0xcaf2('0x2f')][_0xcaf2('0x30')],function(_0x137cfd){return{'name':_0x137cfd['fieldName'],'type':_0x137cfd[_0xcaf2('0x31')][_0xcaf2('0x32')]};});_0x3b0b3d[_0xcaf2('0x33')]=_['map'](_0x1cec51,_0xcaf2('0x2c'));_0x3b0b3d[_0xcaf2('0x34')]=_[_0xcaf2('0x35')](_0x126f59[_0xcaf2('0x34')]);_0x3b0b3d['filters']=_[_0xcaf2('0x36')](_0x3b0b3d['model'],_0x3b0b3d['query']);_0x24b10f[_0xcaf2('0x37')]=_[_0xcaf2('0x36')](_0x3b0b3d['model'],qs['fields'](_0x126f59[_0xcaf2('0x34')][_0xcaf2('0x38')]));_0x24b10f[_0xcaf2('0x37')]=_0x24b10f[_0xcaf2('0x37')][_0xcaf2('0x39')]?_0x24b10f[_0xcaf2('0x37')]:_0x3b0b3d[_0xcaf2('0x33')];if(!_0x126f59[_0xcaf2('0x34')][_0xcaf2('0x3a')](_0xcaf2('0x3b'))){_0x24b10f[_0xcaf2('0x1e')]=qs[_0xcaf2('0x1e')](_0x126f59[_0xcaf2('0x34')][_0xcaf2('0x1e')]);_0x24b10f[_0xcaf2('0x1c')]=qs['offset'](_0x126f59[_0xcaf2('0x34')][_0xcaf2('0x1c')]);}_0x24b10f[_0xcaf2('0x3c')]=qs[_0xcaf2('0x3d')](_0x126f59[_0xcaf2('0x34')][_0xcaf2('0x3d')]);_0x24b10f[_0xcaf2('0x3e')]=qs[_0xcaf2('0x3f')](_[_0xcaf2('0x40')](_0x126f59['query'],_0x3b0b3d[_0xcaf2('0x3f')]),_0x1cec51);if(_0x126f59[_0xcaf2('0x34')][_0xcaf2('0x41')]){_0x24b10f['where']=_[_0xcaf2('0x42')](_0x24b10f[_0xcaf2('0x3e')],{'$or':_[_0xcaf2('0x43')](_0x1cec51,function(_0x1cd56c){if(_0x1cd56c['type']!==_0xcaf2('0x44')){var _0x279a39={};_0x279a39[_0x1cd56c[_0xcaf2('0x2c')]]={'$like':'%'+_0x126f59[_0xcaf2('0x34')][_0xcaf2('0x41')]+'%'};return _0x279a39;}})});}_0x24b10f=_[_0xcaf2('0x42')]({},_0x24b10f,_0x126f59[_0xcaf2('0x45')]);var _0x55aef5={'where':_0x24b10f[_0xcaf2('0x3e')]};return db['Interval'][_0xcaf2('0x1f')](_0x55aef5)[_0xcaf2('0x25')](function(_0x42ff60){_0x125f8d['count']=_0x42ff60;if(_0x126f59['query']['includeAll']){_0x24b10f[_0xcaf2('0x46')]=[{'all':!![]}];}return db['Interval']['findAll'](_0x24b10f);})[_0xcaf2('0x25')](function(_0x2c5bf0){_0x125f8d[_0xcaf2('0x47')]=_0x2c5bf0;return _0x125f8d;})['then'](respondWithFilteredResult(_0x387da1,_0x24b10f))[_0xcaf2('0x48')](handleError(_0x387da1,null));};exports[_0xcaf2('0x49')]=function(_0x1a0af2,_0x713f2c){var _0x1e2750={'raw':!![],'where':{'id':_0x1a0af2[_0xcaf2('0x4a')]['id']}},_0x3b88f4={};_0x3b88f4[_0xcaf2('0x33')]=_[_0xcaf2('0x35')](db[_0xcaf2('0x2f')][_0xcaf2('0x30')]);_0x3b88f4[_0xcaf2('0x34')]=_[_0xcaf2('0x35')](_0x1a0af2[_0xcaf2('0x34')]);_0x3b88f4['filters']=_[_0xcaf2('0x36')](_0x3b88f4[_0xcaf2('0x33')],_0x3b88f4[_0xcaf2('0x34')]);_0x1e2750['attributes']=_[_0xcaf2('0x36')](_0x3b88f4[_0xcaf2('0x33')],qs[_0xcaf2('0x38')](_0x1a0af2[_0xcaf2('0x34')]['fields']));_0x1e2750['attributes']=_0x1e2750['attributes']['length']?_0x1e2750['attributes']:_0x3b88f4[_0xcaf2('0x33')];if(_0x1a0af2[_0xcaf2('0x34')][_0xcaf2('0x4b')]){_0x1e2750['include']=[{'all':!![]}];}_0x1e2750=_[_0xcaf2('0x42')]({},_0x1e2750,_0x1a0af2[_0xcaf2('0x45')]);return db[_0xcaf2('0x2f')][_0xcaf2('0x4c')](_0x1e2750)[_0xcaf2('0x25')](handleEntityNotFound(_0x713f2c,null))[_0xcaf2('0x25')](respondWithResult(_0x713f2c,null))[_0xcaf2('0x48')](handleError(_0x713f2c,null));};exports[_0xcaf2('0x4d')]=function(_0x544826,_0x1f3fd){return db[_0xcaf2('0x2f')]['create'](_0x544826['body'],{})[_0xcaf2('0x25')](function(_0x282160){var _0x147b7e=_0x544826['user']['get']({'plain':!![]});if(!_0x147b7e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x147b7e['role']===_0xcaf2('0x4e')){var _0x9bbba0=_0x282160[_0xcaf2('0x27')]({'plain':!![]});var _0x4c8956=_0xcaf2('0x28');return db[_0xcaf2('0x4f')][_0xcaf2('0x4c')]({'where':{'name':_0x4c8956,'userProfileId':_0x147b7e[_0xcaf2('0x50')]},'raw':!![]})[_0xcaf2('0x25')](function(_0x2a96b3){if(_0x2a96b3&&_0x2a96b3[_0xcaf2('0x51')]===0x0){return db[_0xcaf2('0x52')][_0xcaf2('0x4d')]({'name':_0x9bbba0['name'],'resourceId':_0x9bbba0['id'],'type':_0x2a96b3[_0xcaf2('0x2c')],'sectionId':_0x2a96b3['id']},{})['then'](function(){return _0x282160;});}else{return _0x282160;}})[_0xcaf2('0x48')](function(_0x404e3d){logger[_0xcaf2('0x2a')](_0xcaf2('0x53'),_0x404e3d);throw _0x404e3d;});}return _0x282160;})['then'](respondWithResult(_0x1f3fd,0xc9))[_0xcaf2('0x48')](handleError(_0x1f3fd,null));};exports['update']=function(_0x1ca51c,_0x4ee031){if(_0x1ca51c[_0xcaf2('0x54')]['id']){delete _0x1ca51c['body']['id'];}return db[_0xcaf2('0x2f')][_0xcaf2('0x4c')]({'where':{'id':_0x1ca51c['params']['id']}})[_0xcaf2('0x25')](handleEntityNotFound(_0x4ee031,null))['then'](saveUpdates(_0x1ca51c[_0xcaf2('0x54')],null))[_0xcaf2('0x25')](respondWithResult(_0x4ee031,null))[_0xcaf2('0x48')](handleError(_0x4ee031,null));};exports[_0xcaf2('0x26')]=function(_0x24ab51,_0x5d33b0){return db[_0xcaf2('0x2f')][_0xcaf2('0x4c')]({'where':{'id':_0x24ab51[_0xcaf2('0x4a')]['id']}})[_0xcaf2('0x25')](handleEntityNotFound(_0x5d33b0,null))['then'](removeEntity(_0x5d33b0,null))['catch'](handleError(_0x5d33b0,null));};exports['addInterval']=function(_0xa7b876,_0x49c289,_0x13707a){if(_0xa7b876[_0xcaf2('0x54')]['id']){delete _0xa7b876[_0xcaf2('0x54')]['id'];}return db[_0xcaf2('0x2f')][_0xcaf2('0x4c')]({'where':{'id':_0xa7b876['params']['id']}})[_0xcaf2('0x25')](handleEntityNotFound(_0x49c289,null))[_0xcaf2('0x25')](function(_0x2e5f34){if(_0x2e5f34){_0xa7b876[_0xcaf2('0x54')][_0xcaf2('0x55')]=_0x2e5f34['id'];return db[_0xcaf2('0x2f')][_0xcaf2('0x4d')](_0xa7b876[_0xcaf2('0x54')]);}})[_0xcaf2('0x25')](respondWithResult(_0x49c289,null))['catch'](handleError(_0x49c289,null));};exports[_0xcaf2('0x56')]=function(_0x7304a8,_0x48418a,_0x4b3133){var _0x5e0dfe={};var _0x5075b0={};var _0x519312;var _0x1e896d;return db[_0xcaf2('0x2f')][_0xcaf2('0x57')]({'where':{'id':_0x7304a8[_0xcaf2('0x4a')]['id']}})[_0xcaf2('0x25')](handleEntityNotFound(_0x48418a,null))[_0xcaf2('0x25')](function(_0x137990){if(_0x137990){_0x519312=_0x137990;_0x5075b0[_0xcaf2('0x33')]=_[_0xcaf2('0x35')](db[_0xcaf2('0x2f')][_0xcaf2('0x30')]);_0x5075b0[_0xcaf2('0x34')]=_[_0xcaf2('0x35')](_0x7304a8[_0xcaf2('0x34')]);_0x5075b0[_0xcaf2('0x3f')]=_[_0xcaf2('0x36')](_0x5075b0['model'],_0x5075b0[_0xcaf2('0x34')]);_0x5e0dfe['attributes']=_[_0xcaf2('0x36')](_0x5075b0[_0xcaf2('0x33')],qs[_0xcaf2('0x38')](_0x7304a8[_0xcaf2('0x34')]['fields']));_0x5e0dfe[_0xcaf2('0x37')]=_0x5e0dfe[_0xcaf2('0x37')][_0xcaf2('0x39')]?_0x5e0dfe['attributes']:_0x5075b0[_0xcaf2('0x33')];_0x5e0dfe[_0xcaf2('0x3c')]=qs['sort'](_0x7304a8[_0xcaf2('0x34')][_0xcaf2('0x3d')]);_0x5e0dfe[_0xcaf2('0x3e')]=qs[_0xcaf2('0x3f')](_[_0xcaf2('0x40')](_0x7304a8[_0xcaf2('0x34')],_0x5075b0[_0xcaf2('0x3f')]));if(_0x7304a8[_0xcaf2('0x34')][_0xcaf2('0x41')]){_0x5e0dfe[_0xcaf2('0x3e')]=_[_0xcaf2('0x42')](_0x5e0dfe['where'],{'$or':_[_0xcaf2('0x43')](_0x5e0dfe['attributes'],function(_0x8ec572){var _0x62c28={};_0x62c28[_0x8ec572]={'$like':'%'+_0x7304a8[_0xcaf2('0x34')][_0xcaf2('0x41')]+'%'};return _0x62c28;})});}_0x5e0dfe=_[_0xcaf2('0x42')]({},_0x5e0dfe,_0x7304a8[_0xcaf2('0x45')]);return _0x519312[_0xcaf2('0x56')](_0x5e0dfe);}})[_0xcaf2('0x25')](function(_0x2c1c15){if(_0x2c1c15){_0x1e896d=_0x2c1c15[_0xcaf2('0x39')];if(!_0x7304a8[_0xcaf2('0x34')][_0xcaf2('0x3a')](_0xcaf2('0x3b'))){_0x5e0dfe[_0xcaf2('0x1e')]=qs[_0xcaf2('0x1e')](_0x7304a8[_0xcaf2('0x34')][_0xcaf2('0x1e')]);_0x5e0dfe[_0xcaf2('0x1c')]=qs[_0xcaf2('0x1c')](_0x7304a8[_0xcaf2('0x34')][_0xcaf2('0x1c')]);}return _0x519312['getIntervals'](_0x5e0dfe);}})[_0xcaf2('0x25')](function(_0x44511c){if(_0x44511c){return _0x44511c?{'count':_0x1e896d,'rows':_0x44511c}:null;}})['then'](respondWithResult(_0x48418a,null))[_0xcaf2('0x48')](handleError(_0x48418a,null));};exports[_0xcaf2('0x58')]=function(_0x24331a,_0x4faf7d,_0x3b0224){return db[_0xcaf2('0x2f')][_0xcaf2('0x57')]({'where':{'id':_0x24331a[_0xcaf2('0x4a')]['id']}})[_0xcaf2('0x25')](handleEntityNotFound(_0x4faf7d,null))['then'](function(_0xb96ed4){if(_0xb96ed4){return db[_0xcaf2('0x59')][_0xcaf2('0x5a')](function(_0x439135){return db[_0xcaf2('0x2f')][_0xcaf2('0x26')]({'where':{'IntervalId':_0x24331a[_0xcaf2('0x4a')]['id']},'transaction':_0x439135})[_0xcaf2('0x25')](function(_0x5ef62b){var _0x590df1=_[_0xcaf2('0x43')](_0x24331a[_0xcaf2('0x54')],function(_0x1c6040){delete _0x1c6040['id'];_0x1c6040[_0xcaf2('0x55')]=_0x24331a[_0xcaf2('0x4a')]['id'];return _0x1c6040;});return db['Interval'][_0xcaf2('0x5b')](_0x590df1,{'transaction':_0x439135});});})['then'](function(){return db[_0xcaf2('0x2f')][_0xcaf2('0x5c')]({'where':{'IntervalId':_0x24331a[_0xcaf2('0x4a')]['id']}});});}})[_0xcaf2('0x25')](respondWithResult(_0x4faf7d,null))[_0xcaf2('0x48')](handleError(_0x4faf7d,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 19ba716..c922496 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 _0x1332=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../components/extensions/rewrite','define','Interval','tools_intervals','rewrite'];(function(_0x132ecc,_0x96b970){var _0x175ef5=function(_0x153902){while(--_0x153902){_0x132ecc['push'](_0x132ecc['shift']());}};_0x175ef5(++_0x96b970);}(_0x1332,0x1d4));var _0x2133=function(_0xa63a30,_0x275c35){_0xa63a30=_0xa63a30-0x0;var _0xa993ee=_0x1332[_0xa63a30];return _0xa993ee;};'use strict';var _=require(_0x2133('0x0'));var util=require(_0x2133('0x1'));var logger=require(_0x2133('0x2'))(_0x2133('0x3'));var moment=require(_0x2133('0x4'));var BPromise=require(_0x2133('0x5'));var rp=require(_0x2133('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2133('0x7'));var config=require('../../config/environment');var attributes=require('./interval.attributes');var extensions=require(_0x2133('0x8'));module['exports']=function(_0x2704d1,_0x42c2cc){return _0x2704d1[_0x2133('0x9')](_0x2133('0xa'),attributes,{'tableName':_0x2133('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x35cc72,_0x486e1a){extensions[_0x2133('0xc')](_0x2704d1,_0x35cc72);},'afterBulkCreate':function(_0x1b93a1,_0xf9f1e2,_0x2c8ac1){_0x2c8ac1();extensions['rewrite'](_0x2704d1,_0x1b93a1[0x0]);},'afterUpdate':function(_0x1965ef,_0x4ffb6f){extensions['rewrite'](_0x2704d1,_0x1965ef);},'afterDestroy':function(_0x5f3060,_0x43c54d){extensions['rewrite'](_0x2704d1,_0x5f3060);}}});}; \ No newline at end of file +var _0xa12e=['lodash','util','bluebird','request-promise','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','define','Interval','tools_intervals','rewrite'];(function(_0x146d06,_0x46d63c){var _0x119ea7=function(_0x598ba9){while(--_0x598ba9){_0x146d06['push'](_0x146d06['shift']());}};_0x119ea7(++_0x46d63c);}(_0xa12e,0x138));var _0xea12=function(_0x6054be,_0x2f4ffa){_0x6054be=_0x6054be-0x0;var _0xd1d697=_0xa12e[_0x6054be];return _0xd1d697;};'use strict';var _=require(_0xea12('0x0'));var util=require(_0xea12('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xea12('0x2'));var rp=require(_0xea12('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xea12('0x4'));var config=require(_0xea12('0x5'));var attributes=require(_0xea12('0x6'));var extensions=require(_0xea12('0x7'));module[_0xea12('0x8')]=function(_0x2904ef,_0x2f325a){return _0x2904ef[_0xea12('0x9')](_0xea12('0xa'),attributes,{'tableName':_0xea12('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2b8e29,_0x35b137){extensions['rewrite'](_0x2904ef,_0x2b8e29);},'afterBulkCreate':function(_0x3f39cf,_0x2a22f9,_0x13bf70){_0x13bf70();extensions[_0xea12('0xc')](_0x2904ef,_0x3f39cf[0x0]);},'afterUpdate':function(_0x1dd0c6,_0x1eccaf){extensions['rewrite'](_0x2904ef,_0x1dd0c6);},'afterDestroy':function(_0x2b65d9,_0x162d5c){extensions[_0xea12('0xc')](_0x2904ef,_0x2b65d9);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index c1ed8af..fbadde5 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(_0x4d180c,_0x45c68e){var _0x49b57e=function(_0x264741){while(--_0x264741){_0x4d180c['push'](_0x4d180c['shift']());}};_0x49b57e(++_0x45c68e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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(_0x1778e1,_0x3e1727){var _0x2bc4c6=function(_0x359c65){while(--_0x359c65){_0x1778e1['push'](_0x1778e1['shift']());}};_0x2bc4c6(++_0x3e1727);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'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 61bcba3..e90e2c4 100644 --- a/server/api/jira/index.js +++ b/server/api/jira/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['./jira.controller','post','send','exports','express','../../components/auth/service'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0xb10b,0x12a));var _0xbb10=function(_0xa92559,_0x1d2e45){_0xa92559=_0xa92559-0x0;var _0x502df8=_0xb10b[_0xa92559];return _0x502df8;};'use strict';var express=require(_0xbb10('0x0'));var router=express['Router']();var auth=require(_0xbb10('0x1'));var controller=require(_0xbb10('0x2'));router[_0xbb10('0x3')]('/',auth['isAuthenticated'](),controller[_0xbb10('0x4')]);module[_0xbb10('0x5')]=router; \ No newline at end of file +var _0x2032=['isAuthenticated','send','Router','../../components/auth/service','./jira.controller'];(function(_0x5d8b71,_0xc5a792){var _0x1c032c=function(_0x1aad62){while(--_0x1aad62){_0x5d8b71['push'](_0x5d8b71['shift']());}};_0x1c032c(++_0xc5a792);}(_0x2032,0xd9));var _0x2203=function(_0x545550,_0x3734ac){_0x545550=_0x545550-0x0;var _0x17d598=_0x2032[_0x545550];return _0x17d598;};'use strict';var express=require('express');var router=express[_0x2203('0x0')]();var auth=require(_0x2203('0x1'));var controller=require(_0x2203('0x2'));router['post']('/',auth[_0x2203('0x3')](),controller[_0x2203('0x4')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 3218e36..2dcd026 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 _0x72f0=['../../config/logger','api','support','3eAmWpBVP0','MOTGUI','summary','\x20from\x20','description','stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','newToken','name','customfield_11504','track.xcallymotion.com','POST','application/json','Basic\x20','toString','request','setEncoding','utf8','data','end','statusCode','json','parse','api.jira','write','openIssue','send','body','headers','x-forwarded-for','connection','socket','remoteAddress','bluebird'];(function(_0x57aaff,_0x53d28e){var _0x362f63=function(_0xd748fa){while(--_0xd748fa){_0x57aaff['push'](_0x57aaff['shift']());}};_0x362f63(++_0x53d28e);}(_0x72f0,0x1e3));var _0x072f=function(_0x13b3b5,_0x52d8d8){_0x13b3b5=_0x13b3b5-0x0;var _0x337cd0=_0x72f0[_0x13b3b5];return _0x337cd0;};'use strict';var BPromise=require(_0x072f('0x0'));var https=require('https');var logger=require(_0x072f('0x1'))(_0x072f('0x2'));var USERNAME=_0x072f('0x3');var PASSWORD=_0x072f('0x4');function openIssue(_0x2fa3f9,_0x29c130){var _0x4e5565={'fields':{'project':{'key':_0x2fa3f9['key']||_0x072f('0x5')},'summary':(_0x2fa3f9[_0x072f('0x6')]||'Report')+_0x072f('0x7')+_0x2fa3f9['ip'],'description':_0x2fa3f9[_0x072f('0x8')]||JSON[_0x072f('0x9')](_0x2fa3f9),'issuetype':{'name':_0x2fa3f9[_0x072f('0xa')]||_0x072f('0xb')}}};_0x4e5565[_0x072f('0xc')][_0x072f('0xd')]=_0x2fa3f9[_0x072f('0xe')];_0x4e5565[_0x072f('0xc')][_0x072f('0xf')]=_0x2fa3f9[_0x072f('0x10')];_0x4e5565[_0x072f('0xc')][_0x072f('0x11')]=_0x2fa3f9[_0x072f('0x12')];_0x4e5565[_0x072f('0xc')]['customfield_11503']=_0x2fa3f9[_0x072f('0x13')];_0x4e5565['fields'][_0x072f('0x14')]=_0x2fa3f9['reason'];_0x4e5565[_0x072f('0xc')]['customfield_10102']=_0x2fa3f9['ip'];var _0x2de74f={'host':_0x072f('0x15'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x072f('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0x072f('0x17'),'Authorization':_0x072f('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0x072f('0x19')]('base64')}};var _0x1f93ca=JSON[_0x072f('0x9')](_0x4e5565);var _0x14d481=https[_0x072f('0x1a')](_0x2de74f,function(_0x4d8ddb){_0x4d8ddb[_0x072f('0x1b')](_0x072f('0x1c'));var _0x54eb7d='';_0x4d8ddb['on'](_0x072f('0x1d'),function(_0x3e3b5c){_0x54eb7d+=_0x3e3b5c;});_0x4d8ddb['on'](_0x072f('0x1e'),function(){if(_0x29c130){return _0x29c130['status'](_0x4d8ddb[_0x072f('0x1f')])[_0x072f('0x20')](JSON[_0x072f('0x21')](_0x54eb7d));}});});_0x14d481['on']('error',function(_0xd5723c){if(_0x29c130){return _0x29c130['status'](0x1f4)['json']({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x072f('0x22')}]});}});_0x14d481[_0x072f('0x23')](_0x1f93ca);_0x14d481[_0x072f('0x1e')]();}exports[_0x072f('0x24')]=openIssue;exports[_0x072f('0x25')]=function(_0x3339eb,_0x4b8400){_0x3339eb[_0x072f('0x26')]['ip']=_0x3339eb[_0x072f('0x27')][_0x072f('0x28')]||_0x3339eb[_0x072f('0x29')]['remoteAddress']||_0x3339eb[_0x072f('0x2a')][_0x072f('0x2b')]||_0x3339eb[_0x072f('0x29')][_0x072f('0x2a')][_0x072f('0x2b')];return openIssue(_0x3339eb[_0x072f('0x26')],_0x4b8400);}; \ No newline at end of file +var _0xf1e5=['fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','newToken','name','customfield_11504','reason','/rest/api/2/issue','application/json','toString','base64','request','setEncoding','utf8','statusCode','json','parse','error','status','write','end','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','api','support','3eAmWpBVP0','key','Report','description','stringify','issuetype','Bug'];(function(_0x407461,_0x1cf61c){var _0x2b3ffa=function(_0x2acb31){while(--_0x2acb31){_0x407461['push'](_0x407461['shift']());}};_0x2b3ffa(++_0x1cf61c);}(_0xf1e5,0x166));var _0x5f1e=function(_0x5960bd,_0x166aef){_0x5960bd=_0x5960bd-0x0;var _0x4de12f=_0xf1e5[_0x5960bd];return _0x4de12f;};'use strict';var BPromise=require(_0x5f1e('0x0'));var https=require(_0x5f1e('0x1'));var logger=require('../../config/logger')(_0x5f1e('0x2'));var USERNAME=_0x5f1e('0x3');var PASSWORD=_0x5f1e('0x4');function openIssue(_0x5aa880,_0x10b806){var _0x53dea6={'fields':{'project':{'key':_0x5aa880[_0x5f1e('0x5')]||'MOTGUI'},'summary':(_0x5aa880['summary']||_0x5f1e('0x6'))+'\x20from\x20'+_0x5aa880['ip'],'description':_0x5aa880[_0x5f1e('0x7')]||JSON[_0x5f1e('0x8')](_0x5aa880),'issuetype':{'name':_0x5aa880[_0x5f1e('0x9')]||_0x5f1e('0xa')}}};_0x53dea6[_0x5f1e('0xb')][_0x5f1e('0xc')]=_0x5aa880[_0x5f1e('0xd')];_0x53dea6[_0x5f1e('0xb')][_0x5f1e('0xe')]=_0x5aa880[_0x5f1e('0xf')];_0x53dea6[_0x5f1e('0xb')][_0x5f1e('0x10')]=_0x5aa880[_0x5f1e('0x11')];_0x53dea6['fields']['customfield_11503']=_0x5aa880[_0x5f1e('0x12')];_0x53dea6[_0x5f1e('0xb')][_0x5f1e('0x13')]=_0x5aa880[_0x5f1e('0x14')];_0x53dea6[_0x5f1e('0xb')]['customfield_10102']=_0x5aa880['ip'];var _0x1d7881={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x5f1e('0x15'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0x5f1e('0x16'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0x5f1e('0x17')](_0x5f1e('0x18'))}};var _0x363e73=JSON[_0x5f1e('0x8')](_0x53dea6);var _0x47a504=https[_0x5f1e('0x19')](_0x1d7881,function(_0x170b75){_0x170b75[_0x5f1e('0x1a')](_0x5f1e('0x1b'));var _0x1e57ab='';_0x170b75['on']('data',function(_0x418d10){_0x1e57ab+=_0x418d10;});_0x170b75['on']('end',function(){if(_0x10b806){return _0x10b806['status'](_0x170b75[_0x5f1e('0x1c')])[_0x5f1e('0x1d')](JSON[_0x5f1e('0x1e')](_0x1e57ab));}});});_0x47a504['on'](_0x5f1e('0x1f'),function(_0x4ab3ec){if(_0x10b806){return _0x10b806[_0x5f1e('0x20')](0x1f4)[_0x5f1e('0x1d')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':'api.jira'}]});}});_0x47a504[_0x5f1e('0x21')](_0x363e73);_0x47a504[_0x5f1e('0x22')]();}exports['openIssue']=openIssue;exports['send']=function(_0x3ba553,_0x3dff25){_0x3ba553[_0x5f1e('0x23')]['ip']=_0x3ba553[_0x5f1e('0x24')][_0x5f1e('0x25')]||_0x3ba553[_0x5f1e('0x26')][_0x5f1e('0x27')]||_0x3ba553[_0x5f1e('0x28')]['remoteAddress']||_0x3ba553[_0x5f1e('0x26')][_0x5f1e('0x28')]['remoteAddress'];return openIssue(_0x3ba553[_0x5f1e('0x23')],_0x3dff25);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index ba5c5ae..cca2e36 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 _0xa8a8=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post'];(function(_0x480cca,_0x33709f){var _0x22bcdb=function(_0x15ab17){while(--_0x15ab17){_0x480cca['push'](_0x480cca['shift']());}};_0x22bcdb(++_0x33709f);}(_0xa8a8,0xec));var _0x8a8a=function(_0x46411e,_0x4f9c38){_0x46411e=_0x46411e-0x0;var _0x3d1bda=_0xa8a8[_0x46411e];return _0x3d1bda;};'use strict';var multer=require(_0x8a8a('0x0'));var util=require(_0x8a8a('0x1'));var path=require(_0x8a8a('0x2'));var timeout=require(_0x8a8a('0x3'));var express=require('express');var router=express[_0x8a8a('0x4')]();var fs_extra=require(_0x8a8a('0x5'));var auth=require(_0x8a8a('0x6'));var interaction=require(_0x8a8a('0x7'));var config=require(_0x8a8a('0x8'));var controller=require(_0x8a8a('0x9'));router[_0x8a8a('0xa')]('/',auth[_0x8a8a('0xb')](),controller[_0x8a8a('0xc')]);router[_0x8a8a('0xa')](_0x8a8a('0xd'),auth[_0x8a8a('0xb')](),controller[_0x8a8a('0xe')]);router[_0x8a8a('0xa')](_0x8a8a('0xf'),auth['isAuthenticated'](),controller['show']);router[_0x8a8a('0x10')]('/',auth['isAuthenticated'](),controller[_0x8a8a('0x11')]);router[_0x8a8a('0x12')]('/:id',auth[_0x8a8a('0xb')](),controller[_0x8a8a('0x13')]);router[_0x8a8a('0x14')]('/:id',auth[_0x8a8a('0xb')](),controller[_0x8a8a('0x15')]);module[_0x8a8a('0x16')]=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','./jscriptyAnswerReport.controller','get','index','/describe','show','post'];(function(_0x2becba,_0x4ea656){var _0x90b5dd=function(_0x26ae2b){while(--_0x26ae2b){_0x2becba['push'](_0x2becba['shift']());}};_0x90b5dd(++_0x4ea656);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('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/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 8b822b5..c7612c2 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(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x7a54,0x106));var _0x47a5=function(_0x3c06ea,_0x50c010){_0x3c06ea=_0x3c06ea-0x0;var _0x93fb5d=_0x7a54[_0x3c06ea];return _0x93fb5d;};'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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x7a54,0x106));var _0x47a5=function(_0x4ba7bd,_0x51ebea){_0x4ba7bd=_0x4ba7bd-0x0;var _0x55dbfb=_0x7a54[_0x4ba7bd];return _0x55dbfb;};'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 a7c97bd..46ba325 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 _0xdded=['zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','update','then','destroy','error','name','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','include','findAll','catch','show','params','length','includeAll','merge','options','find','create','body','describe','eml-format','rimraf'];(function(_0x2ca854,_0x2c039c){var _0x5c4d97=function(_0x397dfe){while(--_0x397dfe){_0x2ca854['push'](_0x2ca854['shift']());}};_0x5c4d97(++_0x2c039c);}(_0xdded,0x17a));var _0xddde=function(_0x24e0c2,_0x4af47b){_0x24e0c2=_0x24e0c2-0x0;var _0x7e1484=_0xdded[_0x24e0c2];return _0x7e1484;};'use strict';var emlformat=require(_0xddde('0x0'));var rimraf=require(_0xddde('0x1'));var zipdir=require(_0xddde('0x2'));var jsonpatch=require(_0xddde('0x3'));var rp=require(_0xddde('0x4'));var moment=require(_0xddde('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xddde('0x6'));var util=require(_0xddde('0x7'));var path=require(_0xddde('0x8'));var sox=require(_0xddde('0x9'));var csv=require(_0xddde('0xa'));var ejs=require(_0xddde('0xb'));var fs=require('fs');var fs_extra=require(_0xddde('0xc'));var _=require(_0xddde('0xd'));var squel=require(_0xddde('0xe'));var crypto=require(_0xddde('0xf'));var jsforce=require(_0xddde('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xddde('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xddde('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xddde('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xddde('0x13'))(_0xddde('0x14'));var utils=require(_0xddde('0x15'));var config=require(_0xddde('0x16'));var licenseUtil=require(_0xddde('0x17'));var db=require(_0xddde('0x18'))['db'];function respondWithStatusCode(_0x25fadc,_0x35172e){_0x35172e=_0x35172e||0xcc;return function(_0x57e121){if(_0x57e121){return _0x25fadc[_0xddde('0x19')](_0x35172e);}return _0x25fadc[_0xddde('0x1a')](_0x35172e)[_0xddde('0x1b')]();};}function respondWithResult(_0x860ff4,_0x7cbcee){_0x7cbcee=_0x7cbcee||0xc8;return function(_0x31c111){if(_0x31c111){return _0x860ff4['status'](_0x7cbcee)[_0xddde('0x1c')](_0x31c111);}};}function respondWithFilteredResult(_0xbe1df5,_0x3698d4){return function(_0x48f602){if(_0x48f602){var _0x5de7ce=typeof _0x3698d4[_0xddde('0x1d')]==='undefined'&&typeof _0x3698d4[_0xddde('0x1e')]===_0xddde('0x1f');var _0x338fa7=_0x48f602[_0xddde('0x20')];var _0x2f0e58=_0x5de7ce?0x0:_0x3698d4['offset'];var _0x249f19=_0x5de7ce?_0x48f602[_0xddde('0x20')]:_0x3698d4['offset']+_0x3698d4[_0xddde('0x1e')];var _0x1185f9;if(_0x249f19>=_0x338fa7){_0x249f19=_0x338fa7;_0x1185f9=0xc8;}else{_0x1185f9=0xce;}_0xbe1df5['status'](_0x1185f9);return _0xbe1df5['set'](_0xddde('0x21'),_0x2f0e58+'-'+_0x249f19+'/'+_0x338fa7)['json'](_0x48f602);}return null;};}function patchUpdates(_0x1ef35a){return function(_0x5175bd){try{jsonpatch[_0xddde('0x22')](_0x5175bd,_0x1ef35a,!![]);}catch(_0xea045b){return BPromise['reject'](_0xea045b);}return _0x5175bd['save']();};}function saveUpdates(_0x3cfd91,_0x107bca){return function(_0x97bb0f){if(_0x97bb0f){return _0x97bb0f[_0xddde('0x23')](_0x3cfd91)[_0xddde('0x24')](function(_0xa663e4){return _0xa663e4;});}return null;};}function removeEntity(_0x3bc4bf,_0x56a33a){return function(_0x59320f){if(_0x59320f){return _0x59320f[_0xddde('0x25')]()[_0xddde('0x24')](function(){_0x3bc4bf[_0xddde('0x1a')](0xcc)[_0xddde('0x1b')]();});}};}function handleEntityNotFound(_0xdb57ef,_0x533332){return function(_0x394da0){if(!_0x394da0){_0xdb57ef[_0xddde('0x19')](0x194);}return _0x394da0;};}function handleError(_0x4ca351,_0x4bd409){_0x4bd409=_0x4bd409||0x1f4;return function(_0xa60e85){logger[_0xddde('0x26')](_0xa60e85['stack']);if(_0xa60e85[_0xddde('0x27')]){delete _0xa60e85[_0xddde('0x27')];}_0x4ca351['status'](_0x4bd409)[_0xddde('0x28')](_0xa60e85);};}exports[_0xddde('0x29')]=function(_0x2dd131,_0x32be0f){var _0x477d44={},_0xb5d4b6={},_0x450bac={'count':0x0,'rows':[]};var _0x7c0c18=_[_0xddde('0x2a')](db[_0xddde('0x2b')][_0xddde('0x2c')],function(_0x1ff3e2){return{'name':_0x1ff3e2[_0xddde('0x2d')],'type':_0x1ff3e2[_0xddde('0x2e')][_0xddde('0x2f')]};});_0xb5d4b6[_0xddde('0x30')]=_[_0xddde('0x2a')](_0x7c0c18,_0xddde('0x27'));_0xb5d4b6[_0xddde('0x31')]=_[_0xddde('0x32')](_0x2dd131['query']);_0xb5d4b6['filters']=_[_0xddde('0x33')](_0xb5d4b6[_0xddde('0x30')],_0xb5d4b6[_0xddde('0x31')]);_0x477d44['attributes']=_['intersection'](_0xb5d4b6[_0xddde('0x30')],qs[_0xddde('0x34')](_0x2dd131[_0xddde('0x31')][_0xddde('0x34')]));_0x477d44['attributes']=_0x477d44[_0xddde('0x35')]['length']?_0x477d44[_0xddde('0x35')]:_0xb5d4b6[_0xddde('0x30')];if(!_0x2dd131[_0xddde('0x31')][_0xddde('0x36')](_0xddde('0x37'))){_0x477d44[_0xddde('0x1e')]=qs[_0xddde('0x1e')](_0x2dd131[_0xddde('0x31')][_0xddde('0x1e')]);_0x477d44[_0xddde('0x1d')]=qs[_0xddde('0x1d')](_0x2dd131[_0xddde('0x31')]['offset']);}_0x477d44[_0xddde('0x38')]=qs[_0xddde('0x39')](_0x2dd131['query']['sort']);_0x477d44['where']=qs[_0xddde('0x3a')](_[_0xddde('0x3b')](_0x2dd131[_0xddde('0x31')],_0xb5d4b6[_0xddde('0x3a')]),_0x7c0c18);if(_0x2dd131[_0xddde('0x31')][_0xddde('0x3c')]){_0x477d44[_0xddde('0x3d')]=_['merge'](_0x477d44['where'],{'$or':_[_0xddde('0x2a')](_0x7c0c18,function(_0x5595a7){if(_0x5595a7[_0xddde('0x2e')]!==_0xddde('0x3e')){var _0x4c356a={};_0x4c356a[_0x5595a7[_0xddde('0x27')]]={'$like':'%'+_0x2dd131[_0xddde('0x31')][_0xddde('0x3c')]+'%'};return _0x4c356a;}})});}_0x477d44=_['merge']({},_0x477d44,_0x2dd131['options']);var _0x434868={'where':_0x477d44['where']};return db[_0xddde('0x2b')][_0xddde('0x20')](_0x434868)[_0xddde('0x24')](function(_0x216b12){_0x450bac[_0xddde('0x20')]=_0x216b12;if(_0x2dd131[_0xddde('0x31')]['includeAll']){_0x477d44[_0xddde('0x3f')]=[{'all':!![]}];}return db[_0xddde('0x2b')][_0xddde('0x40')](_0x477d44);})[_0xddde('0x24')](function(_0x10d9d3){_0x450bac['rows']=_0x10d9d3;return _0x450bac;})[_0xddde('0x24')](respondWithFilteredResult(_0x32be0f,_0x477d44))[_0xddde('0x41')](handleError(_0x32be0f,null));};exports[_0xddde('0x42')]=function(_0x3a52b5,_0x21b469){var _0xb0c016={'raw':!![],'where':{'id':_0x3a52b5[_0xddde('0x43')]['id']}},_0x6cbadb={};_0x6cbadb[_0xddde('0x30')]=_['keys'](db[_0xddde('0x2b')]['rawAttributes']);_0x6cbadb[_0xddde('0x31')]=_[_0xddde('0x32')](_0x3a52b5['query']);_0x6cbadb[_0xddde('0x3a')]=_[_0xddde('0x33')](_0x6cbadb[_0xddde('0x30')],_0x6cbadb['query']);_0xb0c016['attributes']=_['intersection'](_0x6cbadb[_0xddde('0x30')],qs[_0xddde('0x34')](_0x3a52b5[_0xddde('0x31')][_0xddde('0x34')]));_0xb0c016['attributes']=_0xb0c016[_0xddde('0x35')][_0xddde('0x44')]?_0xb0c016[_0xddde('0x35')]:_0x6cbadb['model'];if(_0x3a52b5[_0xddde('0x31')][_0xddde('0x45')]){_0xb0c016[_0xddde('0x3f')]=[{'all':!![]}];}_0xb0c016=_[_0xddde('0x46')]({},_0xb0c016,_0x3a52b5[_0xddde('0x47')]);return db['JscriptyAnswerReport'][_0xddde('0x48')](_0xb0c016)['then'](handleEntityNotFound(_0x21b469,null))[_0xddde('0x24')](respondWithResult(_0x21b469,null))['catch'](handleError(_0x21b469,null));};exports[_0xddde('0x49')]=function(_0x3c3c6c,_0x1db505){return db[_0xddde('0x2b')][_0xddde('0x49')](_0x3c3c6c[_0xddde('0x4a')],{})[_0xddde('0x24')](respondWithResult(_0x1db505,0xc9))[_0xddde('0x41')](handleError(_0x1db505,null));};exports['update']=function(_0x3ad9b6,_0x1b4a00){if(_0x3ad9b6[_0xddde('0x4a')]['id']){delete _0x3ad9b6[_0xddde('0x4a')]['id'];}return db[_0xddde('0x2b')][_0xddde('0x48')]({'where':{'id':_0x3ad9b6['params']['id']}})[_0xddde('0x24')](handleEntityNotFound(_0x1b4a00,null))[_0xddde('0x24')](saveUpdates(_0x3ad9b6[_0xddde('0x4a')],null))[_0xddde('0x24')](respondWithResult(_0x1b4a00,null))[_0xddde('0x41')](handleError(_0x1b4a00,null));};exports['destroy']=function(_0x2a8537,_0x42a325){return db[_0xddde('0x2b')][_0xddde('0x48')]({'where':{'id':_0x2a8537[_0xddde('0x43')]['id']}})[_0xddde('0x24')](handleEntityNotFound(_0x42a325,null))[_0xddde('0x24')](removeEntity(_0x42a325,null))[_0xddde('0x41')](handleError(_0x42a325,null));};exports[_0xddde('0x4b')]=function(_0xff548d,_0x43fcf6){return db[_0xddde('0x2b')][_0xddde('0x4b')]()[_0xddde('0x24')](respondWithResult(_0x43fcf6,null))[_0xddde('0x41')](handleError(_0x43fcf6,null));}; \ No newline at end of file +var _0x425d=['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','error','name','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','fields','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x425d,0x1e0));var _0xd425=function(_0xae03ec,_0x126329){_0xae03ec=_0xae03ec-0x0;var _0x26b415=_0x425d[_0xae03ec];return _0x26b415;};'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(){_0x2b030b[_0xd425('0x1f')](0xcc)[_0xd425('0x1e')]();});}};}function handleEntityNotFound(_0x1908a5,_0x2afcdb){return function(_0x400dd7){if(!_0x400dd7){_0x1908a5[_0xd425('0x1d')](0x194);}return _0x400dd7;};}function handleError(_0x577e4b,_0x12f951){_0x12f951=_0x12f951||0x1f4;return function(_0x177de2){logger[_0xd425('0x2b')](_0x177de2['stack']);if(_0x177de2[_0xd425('0x2c')]){delete _0x177de2[_0xd425('0x2c')];}_0x577e4b[_0xd425('0x1f')](_0x12f951)[_0xd425('0x2d')](_0x177de2);};}exports[_0xd425('0x2e')]=function(_0x185d7e,_0x2fd17a){var _0x37b63c={},_0x24da23={},_0x1cac61={'count':0x0,'rows':[]};var _0x482ba6=_[_0xd425('0x2f')](db[_0xd425('0x30')][_0xd425('0x31')],function(_0x3695dd){return{'name':_0x3695dd[_0xd425('0x32')],'type':_0x3695dd[_0xd425('0x33')][_0xd425('0x34')]};});_0x24da23[_0xd425('0x35')]=_[_0xd425('0x2f')](_0x482ba6,_0xd425('0x2c'));_0x24da23[_0xd425('0x36')]=_['keys'](_0x185d7e[_0xd425('0x36')]);_0x24da23[_0xd425('0x37')]=_[_0xd425('0x38')](_0x24da23[_0xd425('0x35')],_0x24da23[_0xd425('0x36')]);_0x37b63c['attributes']=_[_0xd425('0x38')](_0x24da23[_0xd425('0x35')],qs['fields'](_0x185d7e['query']['fields']));_0x37b63c[_0xd425('0x39')]=_0x37b63c[_0xd425('0x39')][_0xd425('0x3a')]?_0x37b63c[_0xd425('0x39')]:_0x24da23['model'];if(!_0x185d7e[_0xd425('0x36')][_0xd425('0x3b')](_0xd425('0x3c'))){_0x37b63c[_0xd425('0x23')]=qs[_0xd425('0x23')](_0x185d7e[_0xd425('0x36')][_0xd425('0x23')]);_0x37b63c['offset']=qs[_0xd425('0x21')](_0x185d7e['query'][_0xd425('0x21')]);}_0x37b63c[_0xd425('0x3d')]=qs[_0xd425('0x3e')](_0x185d7e['query'][_0xd425('0x3e')]);_0x37b63c[_0xd425('0x3f')]=qs[_0xd425('0x37')](_[_0xd425('0x40')](_0x185d7e['query'],_0x24da23[_0xd425('0x37')]),_0x482ba6);if(_0x185d7e[_0xd425('0x36')]['filter']){_0x37b63c['where']=_['merge'](_0x37b63c[_0xd425('0x3f')],{'$or':_[_0xd425('0x2f')](_0x482ba6,function(_0x1f30c1){if(_0x1f30c1['type']!=='VIRTUAL'){var _0x58ebb1={};_0x58ebb1[_0x1f30c1[_0xd425('0x2c')]]={'$like':'%'+_0x185d7e[_0xd425('0x36')][_0xd425('0x41')]+'%'};return _0x58ebb1;}})});}_0x37b63c=_[_0xd425('0x42')]({},_0x37b63c,_0x185d7e[_0xd425('0x43')]);var _0x14f3be={'where':_0x37b63c[_0xd425('0x3f')]};return db['JscriptyAnswerReport'][_0xd425('0x24')](_0x14f3be)[_0xd425('0x2a')](function(_0x1d82ec){_0x1cac61['count']=_0x1d82ec;if(_0x185d7e[_0xd425('0x36')][_0xd425('0x44')]){_0x37b63c[_0xd425('0x45')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xd425('0x46')](_0x37b63c);})[_0xd425('0x2a')](function(_0x1c5ba6){_0x1cac61[_0xd425('0x47')]=_0x1c5ba6;return _0x1cac61;})['then'](respondWithFilteredResult(_0x2fd17a,_0x37b63c))[_0xd425('0x48')](handleError(_0x2fd17a,null));};exports[_0xd425('0x49')]=function(_0x2b1149,_0x41b25e){var _0x3f24fb={'raw':!![],'where':{'id':_0x2b1149[_0xd425('0x4a')]['id']}},_0x2f6bf7={};_0x2f6bf7['model']=_[_0xd425('0x4b')](db[_0xd425('0x30')]['rawAttributes']);_0x2f6bf7[_0xd425('0x36')]=_['keys'](_0x2b1149['query']);_0x2f6bf7[_0xd425('0x37')]=_['intersection'](_0x2f6bf7[_0xd425('0x35')],_0x2f6bf7['query']);_0x3f24fb[_0xd425('0x39')]=_[_0xd425('0x38')](_0x2f6bf7[_0xd425('0x35')],qs[_0xd425('0x4c')](_0x2b1149[_0xd425('0x36')]['fields']));_0x3f24fb[_0xd425('0x39')]=_0x3f24fb['attributes'][_0xd425('0x3a')]?_0x3f24fb['attributes']:_0x2f6bf7[_0xd425('0x35')];if(_0x2b1149[_0xd425('0x36')][_0xd425('0x44')]){_0x3f24fb[_0xd425('0x45')]=[{'all':!![]}];}_0x3f24fb=_[_0xd425('0x42')]({},_0x3f24fb,_0x2b1149['options']);return db[_0xd425('0x30')][_0xd425('0x4d')](_0x3f24fb)[_0xd425('0x2a')](handleEntityNotFound(_0x41b25e,null))[_0xd425('0x2a')](respondWithResult(_0x41b25e,null))[_0xd425('0x48')](handleError(_0x41b25e,null));};exports['create']=function(_0x440dc5,_0x177704){return db[_0xd425('0x30')][_0xd425('0x4e')](_0x440dc5[_0xd425('0x4f')],{})[_0xd425('0x2a')](respondWithResult(_0x177704,0xc9))['catch'](handleError(_0x177704,null));};exports[_0xd425('0x29')]=function(_0x128cb3,_0x5bfac6){if(_0x128cb3[_0xd425('0x4f')]['id']){delete _0x128cb3[_0xd425('0x4f')]['id'];}return db[_0xd425('0x30')][_0xd425('0x4d')]({'where':{'id':_0x128cb3['params']['id']}})[_0xd425('0x2a')](handleEntityNotFound(_0x5bfac6,null))[_0xd425('0x2a')](saveUpdates(_0x128cb3[_0xd425('0x4f')],null))[_0xd425('0x2a')](respondWithResult(_0x5bfac6,null))[_0xd425('0x48')](handleError(_0x5bfac6,null));};exports['destroy']=function(_0x4be6fa,_0x381bdb){return db['JscriptyAnswerReport'][_0xd425('0x4d')]({'where':{'id':_0x4be6fa[_0xd425('0x4a')]['id']}})['then'](handleEntityNotFound(_0x381bdb,null))[_0xd425('0x2a')](removeEntity(_0x381bdb,null))['catch'](handleError(_0x381bdb,null));};exports['describe']=function(_0x39f588,_0x111905){return db[_0xd425('0x30')][_0xd425('0x50')]()[_0xd425('0x2a')](respondWithResult(_0x111905,null))[_0xd425('0x48')](handleError(_0x111905,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index eb354f7..70d06c3 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 _0x9904=['JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./jscriptyAnswerReport.attributes','exports','define'];(function(_0x359059,_0x29503b){var _0x4a4ba4=function(_0x1c5d1f){while(--_0x1c5d1f){_0x359059['push'](_0x359059['shift']());}};_0x4a4ba4(++_0x29503b);}(_0x9904,0xb8));var _0x4990=function(_0x5380c5,_0x5bc69f){_0x5380c5=_0x5380c5-0x0;var _0x32c4a6=_0x9904[_0x5380c5];return _0x32c4a6;};'use strict';var _=require(_0x4990('0x0'));var util=require(_0x4990('0x1'));var logger=require(_0x4990('0x2'))(_0x4990('0x3'));var moment=require('moment');var BPromise=require(_0x4990('0x4'));var rp=require(_0x4990('0x5'));var fs=require('fs');var path=require(_0x4990('0x6'));var rimraf=require('rimraf');var config=require(_0x4990('0x7'));var attributes=require(_0x4990('0x8'));module[_0x4990('0x9')]=function(_0x2f35d3,_0xfe370a){return _0x2f35d3[_0x4990('0xa')](_0x4990('0xb'),attributes,{'tableName':_0x4990('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x83e4=['report_jscripty_answers','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport'];(function(_0x171ce7,_0xed973b){var _0x7303cd=function(_0x4dd7c2){while(--_0x4dd7c2){_0x171ce7['push'](_0x171ce7['shift']());}};_0x7303cd(++_0xed973b);}(_0x83e4,0x16d));var _0x483e=function(_0x2d8625,_0x3e3a89){_0x2d8625=_0x2d8625-0x0;var _0x42dcee=_0x83e4[_0x2d8625];return _0x42dcee;};'use strict';var _=require(_0x483e('0x0'));var util=require(_0x483e('0x1'));var logger=require(_0x483e('0x2'))(_0x483e('0x3'));var moment=require('moment');var BPromise=require(_0x483e('0x4'));var rp=require(_0x483e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x483e('0x6'));var config=require(_0x483e('0x7'));var attributes=require(_0x483e('0x8'));module[_0x483e('0x9')]=function(_0xe2a57b,_0x541ff0){return _0xe2a57b[_0x483e('0xa')](_0x483e('0xb'),attributes,{'tableName':_0x483e('0xc'),'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 b7a9fa9..add8069 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 _0x2c65=['request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http'];(function(_0x154cb5,_0x1a8d5a){var _0x3f574f=function(_0x597a52){while(--_0x597a52){_0x154cb5['push'](_0x154cb5['shift']());}};_0x3f574f(++_0x1a8d5a);}(_0x2c65,0xd1));var _0x52c6=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x2c65[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x52c6('0x0'));var util=require(_0x52c6('0x1'));var moment=require(_0x52c6('0x2'));var BPromise=require(_0x52c6('0x3'));var rs=require(_0x52c6('0x4'));var fs=require('fs');var Redis=require(_0x52c6('0x5'));var db=require(_0x52c6('0x6'))['db'];var utils=require(_0x52c6('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x52c6('0x8'));var jayson=require(_0x52c6('0x9'));var client=jayson['client'][_0x52c6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4761b3,_0x3448e0,_0x4c2c03){return new BPromise(function(_0x271700,_0x8ccf57){return client[_0x52c6('0xb')](_0x4761b3,_0x4c2c03)[_0x52c6('0xc')](function(_0x23ca5e){logger[_0x52c6('0xd')](_0x52c6('0xe'),_0x3448e0,'request\x20sent');logger['debug'](_0x52c6('0xf'),_0x3448e0,_0x52c6('0x10'),JSON['stringify'](_0x23ca5e));if(_0x23ca5e[_0x52c6('0x11')]){if(_0x23ca5e[_0x52c6('0x11')][_0x52c6('0x12')]===0x1f4){logger[_0x52c6('0x11')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x3448e0,_0x23ca5e[_0x52c6('0x11')][_0x52c6('0x13')]);return _0x8ccf57(_0x23ca5e[_0x52c6('0x11')][_0x52c6('0x13')]);}logger['error'](_0x52c6('0xe'),_0x3448e0,_0x23ca5e['error']['message']);return _0x271700(_0x23ca5e[_0x52c6('0x11')][_0x52c6('0x13')]);}else{logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0x3448e0,_0x52c6('0x10'));_0x271700(_0x23ca5e[_0x52c6('0x14')][_0x52c6('0x13')]);}})[_0x52c6('0x15')](function(_0x1e61e4){logger[_0x52c6('0x11')](_0x52c6('0xe'),_0x3448e0,_0x1e61e4);_0x8ccf57(_0x1e61e4);});});} \ No newline at end of file +var _0x8883=['client','http','request','then','info','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','JscriptyAnswerReport,\x20%s,\x20%s','result','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x40aa35,_0x4ea2e4){var _0x4e999c=function(_0x30c2f8){while(--_0x30c2f8){_0x40aa35['push'](_0x40aa35['shift']());}};_0x4e999c(++_0x4ea2e4);}(_0x8883,0xb0));var _0x3888=function(_0x369929,_0x111c5d){_0x369929=_0x369929-0x0;var _0x442594=_0x8883[_0x369929];return _0x442594;};'use strict';var _=require(_0x3888('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3888('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3888('0x2'))['db'];var utils=require(_0x3888('0x3'));var logger=require(_0x3888('0x4'))(_0x3888('0x5'));var config=require(_0x3888('0x6'));var jayson=require(_0x3888('0x7'));var client=jayson[_0x3888('0x8')][_0x3888('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x479bf7,_0x340ce3,_0x49d138){return new BPromise(function(_0x1b7232,_0x13dba2){return client[_0x3888('0xa')](_0x479bf7,_0x49d138)[_0x3888('0xb')](function(_0xb7e38c){logger[_0x3888('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x340ce3,_0x3888('0xd'));logger[_0x3888('0xe')](_0x3888('0xf'),_0x340ce3,_0x3888('0xd'),JSON[_0x3888('0x10')](_0xb7e38c));if(_0xb7e38c[_0x3888('0x11')]){if(_0xb7e38c[_0x3888('0x11')][_0x3888('0x12')]===0x1f4){logger[_0x3888('0x11')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x340ce3,_0xb7e38c[_0x3888('0x11')][_0x3888('0x13')]);return _0x13dba2(_0xb7e38c[_0x3888('0x11')]['message']);}logger[_0x3888('0x11')](_0x3888('0x14'),_0x340ce3,_0xb7e38c[_0x3888('0x11')][_0x3888('0x13')]);return _0x1b7232(_0xb7e38c['error'][_0x3888('0x13')]);}else{logger[_0x3888('0xc')](_0x3888('0x14'),_0x340ce3,_0x3888('0xd'));_0x1b7232(_0xb7e38c[_0x3888('0x15')]['message']);}})[_0x3888('0x16')](function(_0x51ff09){logger[_0x3888('0x11')](_0x3888('0x14'),_0x340ce3,_0x51ff09);_0x13dba2(_0x51ff09);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 1c9fa4a..5ee1a1b 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 _0x5ba8=['put','update','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/sessions','getSessions','getAnswers','/:id/summary','30s','create','post','/:id/clone','clone'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x5ba8,0x16b));var _0x85ba=function(_0x3d3870,_0x5bc14){_0x3d3870=_0x3d3870-0x0;var _0x47df13=_0x5ba8[_0x3d3870];return _0x47df13;};'use strict';var multer=require(_0x85ba('0x0'));var util=require(_0x85ba('0x1'));var path=require('path');var timeout=require(_0x85ba('0x2'));var express=require(_0x85ba('0x3'));var router=express['Router']();var fs_extra=require(_0x85ba('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x85ba('0x5'));var config=require(_0x85ba('0x6'));var controller=require('./jscriptyProject.controller');router['get']('/',auth[_0x85ba('0x7')](),controller[_0x85ba('0x8')]);router[_0x85ba('0x9')](_0x85ba('0xa'),auth[_0x85ba('0x7')](),controller[_0x85ba('0xb')]);router[_0x85ba('0x9')](_0x85ba('0xc'),auth['isAuthenticated'](),controller[_0x85ba('0xd')]);router['get']('/:id/answers',auth[_0x85ba('0x7')](),controller[_0x85ba('0xe')]);router[_0x85ba('0x9')](_0x85ba('0xf'),auth[_0x85ba('0x7')](),timeout(_0x85ba('0x10')),controller['getSummary']);router['post']('/',auth[_0x85ba('0x7')](),controller[_0x85ba('0x11')]);router[_0x85ba('0x12')](_0x85ba('0x13'),auth[_0x85ba('0x7')](),controller[_0x85ba('0x14')]);router[_0x85ba('0x15')](_0x85ba('0xa'),auth[_0x85ba('0x7')](),controller[_0x85ba('0x16')]);router['delete'](_0x85ba('0xa'),auth[_0x85ba('0x7')](),controller['destroy']);module[_0x85ba('0x17')]=router; \ No newline at end of file +var _0x9f7a=['exports','multer','path','connect-timeout','express','fs-extra','./jscriptyProject.controller','get','isAuthenticated','show','/:id/sessions','getSessions','getAnswers','/:id/summary','30s','getSummary','post','create','clone','put','/:id','destroy'];(function(_0x462bdc,_0x1556d2){var _0x5815e5=function(_0x32b9a3){while(--_0x32b9a3){_0x462bdc['push'](_0x462bdc['shift']());}};_0x5815e5(++_0x1556d2);}(_0x9f7a,0xdd));var _0xa9f7=function(_0x46d0c9,_0x526bfa){_0x46d0c9=_0x46d0c9-0x0;var _0x174506=_0x9f7a[_0x46d0c9];return _0x174506;};'use strict';var multer=require(_0xa9f7('0x0'));var util=require('util');var path=require(_0xa9f7('0x1'));var timeout=require(_0xa9f7('0x2'));var express=require(_0xa9f7('0x3'));var router=express['Router']();var fs_extra=require(_0xa9f7('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa9f7('0x5'));router[_0xa9f7('0x6')]('/',auth[_0xa9f7('0x7')](),controller['index']);router[_0xa9f7('0x6')]('/:id',auth[_0xa9f7('0x7')](),controller[_0xa9f7('0x8')]);router[_0xa9f7('0x6')](_0xa9f7('0x9'),auth['isAuthenticated'](),controller[_0xa9f7('0xa')]);router[_0xa9f7('0x6')]('/:id/answers',auth[_0xa9f7('0x7')](),controller[_0xa9f7('0xb')]);router[_0xa9f7('0x6')](_0xa9f7('0xc'),auth[_0xa9f7('0x7')](),timeout(_0xa9f7('0xd')),controller[_0xa9f7('0xe')]);router[_0xa9f7('0xf')]('/',auth[_0xa9f7('0x7')](),controller[_0xa9f7('0x10')]);router[_0xa9f7('0xf')]('/:id/clone',auth[_0xa9f7('0x7')](),controller[_0xa9f7('0x11')]);router[_0xa9f7('0x12')](_0xa9f7('0x13'),auth[_0xa9f7('0x7')](),controller['update']);router['delete'](_0xa9f7('0x13'),auth[_0xa9f7('0x7')](),controller[_0xa9f7('0x14')]);module[_0xa9f7('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 956b384..80415bd 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 _0xe1e7=['{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','exports','STRING','name','long','formData','stringify','isString','setDataValue','format'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0xe1e7,0x163));var _0x7e1e=function(_0x4b4204,_0x177efa){_0x4b4204=_0x4b4204-0x0;var _0x591f75=_0xe1e7[_0x4b4204];return _0x591f75;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');var util=require('util');module[_0x7e1e('0x0')]={'name':{'type':Sequelize[_0x7e1e('0x1')],'unique':_0x7e1e('0x2')},'description':{'type':Sequelize[_0x7e1e('0x1')]},'formData':{'type':Sequelize['TEXT'](_0x7e1e('0x3')),'set':function(_0x11a3f3){if(_['isObjectLike'](_0x11a3f3)){this['setDataValue'](_0x7e1e('0x4'),JSON[_0x7e1e('0x5')](_0x11a3f3));}else if(_[_0x7e1e('0x6')](_0x11a3f3)){this[_0x7e1e('0x7')](_0x7e1e('0x4'),_0x11a3f3);}else{this['setDataValue'](_0x7e1e('0x4'),util[_0x7e1e('0x8')](_0x7e1e('0x9'),this[_0x7e1e('0xa')]('name')||'',this[_0x7e1e('0xa')](_0x7e1e('0xb'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x7e1e('0xc')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x7e1e('0xc')],'defaultValue':![]}}; \ No newline at end of file +var _0x47c2=['BOOLEAN','sequelize','util','STRING','name','TEXT','isObjectLike','setDataValue','formData','isString','format','getDataValue','description'];(function(_0x3d62c9,_0xe10bc1){var _0x296774=function(_0x568f70){while(--_0x568f70){_0x3d62c9['push'](_0x3d62c9['shift']());}};_0x296774(++_0xe10bc1);}(_0x47c2,0x139));var _0x247c=function(_0x307fc9,_0x46c299){_0x307fc9=_0x307fc9-0x0;var _0x2a090d=_0x47c2[_0x307fc9];return _0x2a090d;};'use strict';var Sequelize=require(_0x247c('0x0'));var _=require('lodash');var util=require(_0x247c('0x1'));module['exports']={'name':{'type':Sequelize[_0x247c('0x2')],'unique':_0x247c('0x3')},'description':{'type':Sequelize[_0x247c('0x2')]},'formData':{'type':Sequelize[_0x247c('0x4')]('long'),'set':function(_0x5bfbf6){if(_[_0x247c('0x5')](_0x5bfbf6)){this[_0x247c('0x6')](_0x247c('0x7'),JSON['stringify'](_0x5bfbf6));}else if(_[_0x247c('0x8')](_0x5bfbf6)){this[_0x247c('0x6')](_0x247c('0x7'),_0x5bfbf6);}else{this[_0x247c('0x6')](_0x247c('0x7'),util[_0x247c('0x9')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this['getDataValue'](_0x247c('0x3'))||'',this[_0x247c('0xa')](_0x247c('0xb'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x247c('0xc')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x247c('0xc')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 34429fb..775bfdb 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 _0x1399=['isEmpty','now','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','undefined','limit','set','Content-Range','json','apply','reject','save','update','then','Projects','UserProfileResource','sendStatus','error','stack','name','send','index','map','JscriptyProject','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','count','findAll','rows','show','rawAttributes','includeAll','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','include','find','omit','createdAt','updatedAt','role','destroy','getSessions','findOne','JscriptySessionReport','getAnswers','JscriptyAnswerReport','fromCharCode','toString','indexOf','getSummary','startTime','starttime','JscriptyQuestionReport','-createdAt','questionId','question','format','SessionId','answer','push'];(function(_0x4d674b,_0x176474){var _0x535a1f=function(_0xac7726){while(--_0xac7726){_0x4d674b['push'](_0x4d674b['shift']());}};_0x535a1f(++_0x176474);}(_0x1399,0x16c));var _0x9139=function(_0x125bad,_0x4bc955){_0x125bad=_0x125bad-0x0;var _0x40e256=_0x1399[_0x125bad];return _0x40e256;};'use strict';var emlformat=require(_0x9139('0x0'));var rimraf=require(_0x9139('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9139('0x2'));var rp=require('request-promise');var moment=require(_0x9139('0x3'));var BPromise=require(_0x9139('0x4'));var Mustache=require(_0x9139('0x5'));var util=require(_0x9139('0x6'));var path=require(_0x9139('0x7'));var sox=require(_0x9139('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9139('0x9'));var _=require(_0x9139('0xa'));var squel=require(_0x9139('0xb'));var crypto=require('crypto');var jsforce=require(_0x9139('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9139('0xd'));var Papa=require(_0x9139('0xe'));var Redis=require('ioredis');var authService=require(_0x9139('0xf'));var qs=require(_0x9139('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9139('0x11'))(_0x9139('0x12'));var utils=require(_0x9139('0x13'));var config=require(_0x9139('0x14'));var licenseUtil=require(_0x9139('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52b32d,_0x511ec9){_0x511ec9=_0x511ec9||0xcc;return function(_0x417637){if(_0x417637){return _0x52b32d['sendStatus'](_0x511ec9);}return _0x52b32d[_0x9139('0x16')](_0x511ec9)[_0x9139('0x17')]();};}function respondWithResult(_0x375ada,_0x262009){_0x262009=_0x262009||0xc8;return function(_0x5936d2){if(_0x5936d2){return _0x375ada[_0x9139('0x16')](_0x262009)['json'](_0x5936d2);}};}function respondWithFilteredResult(_0x58307f,_0x52c57b){return function(_0x159e50){if(_0x159e50){var _0x3e2bad=typeof _0x52c57b[_0x9139('0x18')]===_0x9139('0x19')&&typeof _0x52c57b[_0x9139('0x1a')]===_0x9139('0x19');var _0x4bd957=_0x159e50['count'];var _0x13cab8=_0x3e2bad?0x0:_0x52c57b[_0x9139('0x18')];var _0x5e0a59=_0x3e2bad?_0x159e50['count']:_0x52c57b[_0x9139('0x18')]+_0x52c57b[_0x9139('0x1a')];var _0x56add4;if(_0x5e0a59>=_0x4bd957){_0x5e0a59=_0x4bd957;_0x56add4=0xc8;}else{_0x56add4=0xce;}_0x58307f[_0x9139('0x16')](_0x56add4);return _0x58307f[_0x9139('0x1b')](_0x9139('0x1c'),_0x13cab8+'-'+_0x5e0a59+'/'+_0x4bd957)[_0x9139('0x1d')](_0x159e50);}return null;};}function patchUpdates(_0xd2eb33){return function(_0x6f901b){try{jsonpatch[_0x9139('0x1e')](_0x6f901b,_0xd2eb33,!![]);}catch(_0x45fa16){return BPromise[_0x9139('0x1f')](_0x45fa16);}return _0x6f901b[_0x9139('0x20')]();};}function saveUpdates(_0x1bac18,_0x269f8a){return function(_0x5a3e2e){if(_0x5a3e2e){return _0x5a3e2e[_0x9139('0x21')](_0x1bac18)[_0x9139('0x22')](function(_0x31635a){return _0x31635a;});}return null;};}function removeEntity(_0x1aee3b,_0x934732){return function(_0x1a7350){if(_0x1a7350){return _0x1a7350['destroy']()[_0x9139('0x22')](function(){var _0x31c22d=_0x1a7350['get']({'plain':!![]});var _0x3ed4da=_0x9139('0x23');return db[_0x9139('0x24')]['destroy']({'where':{'type':_0x3ed4da,'resourceId':_0x31c22d['id']}})[_0x9139('0x22')](function(){return _0x1a7350;});})[_0x9139('0x22')](function(){_0x1aee3b['status'](0xcc)[_0x9139('0x17')]();});}};}function handleEntityNotFound(_0x39e8cf,_0x452d9a){return function(_0x55e95f){if(!_0x55e95f){_0x39e8cf[_0x9139('0x25')](0x194);}return _0x55e95f;};}function handleError(_0x22e11e,_0x2a35fd){_0x2a35fd=_0x2a35fd||0x1f4;return function(_0x22994c){logger[_0x9139('0x26')](_0x22994c[_0x9139('0x27')]);if(_0x22994c[_0x9139('0x28')]){delete _0x22994c['name'];}_0x22e11e['status'](_0x2a35fd)[_0x9139('0x29')](_0x22994c);};}exports[_0x9139('0x2a')]=function(_0xd27355,_0x4c1693){var _0x50d545={},_0x24e8d5={},_0x2118a2={'count':0x0,'rows':[]};var _0x2dff49=_[_0x9139('0x2b')](db[_0x9139('0x2c')]['rawAttributes'],function(_0x5a1673){return{'name':_0x5a1673[_0x9139('0x2d')],'type':_0x5a1673['type']['key']};});_0x24e8d5[_0x9139('0x2e')]=_[_0x9139('0x2b')](_0x2dff49,'name');_0x24e8d5[_0x9139('0x2f')]=_[_0x9139('0x30')](_0xd27355['query']);_0x24e8d5[_0x9139('0x31')]=_[_0x9139('0x32')](_0x24e8d5[_0x9139('0x2e')],_0x24e8d5[_0x9139('0x2f')]);_0x50d545[_0x9139('0x33')]=_[_0x9139('0x32')](_0x24e8d5[_0x9139('0x2e')],qs[_0x9139('0x34')](_0xd27355[_0x9139('0x2f')][_0x9139('0x34')]));_0x50d545[_0x9139('0x33')]=_0x50d545['attributes'][_0x9139('0x35')]?_0x50d545[_0x9139('0x33')]:_0x24e8d5['model'];if(!_0xd27355[_0x9139('0x2f')][_0x9139('0x36')](_0x9139('0x37'))){_0x50d545['limit']=qs[_0x9139('0x1a')](_0xd27355[_0x9139('0x2f')][_0x9139('0x1a')]);_0x50d545[_0x9139('0x18')]=qs[_0x9139('0x18')](_0xd27355[_0x9139('0x2f')][_0x9139('0x18')]);}_0x50d545[_0x9139('0x38')]=qs[_0x9139('0x39')](_0xd27355[_0x9139('0x2f')]['sort']);_0x50d545[_0x9139('0x3a')]=qs[_0x9139('0x31')](_[_0x9139('0x3b')](_0xd27355[_0x9139('0x2f')],_0x24e8d5[_0x9139('0x31')]),_0x2dff49);if(_0xd27355[_0x9139('0x2f')][_0x9139('0x3c')]){_0x50d545['where']=_[_0x9139('0x3d')](_0x50d545['where'],{'$or':_[_0x9139('0x2b')](_0x2dff49,function(_0x11789e){if(_0x11789e[_0x9139('0x3e')]!=='VIRTUAL'){var _0x1228b6={};_0x1228b6[_0x11789e[_0x9139('0x28')]]={'$like':'%'+_0xd27355[_0x9139('0x2f')][_0x9139('0x3c')]+'%'};return _0x1228b6;}})});}_0x50d545=_[_0x9139('0x3d')]({},_0x50d545,_0xd27355[_0x9139('0x3f')]);var _0x3c98a4={'where':_0x50d545[_0x9139('0x3a')]};return db[_0x9139('0x2c')][_0x9139('0x40')](_0x3c98a4)['then'](function(_0xf14393){_0x2118a2[_0x9139('0x40')]=_0xf14393;if(_0xd27355[_0x9139('0x2f')]['includeAll']){_0x50d545['include']=[{'all':!![]}];}return db['JscriptyProject'][_0x9139('0x41')](_0x50d545);})[_0x9139('0x22')](function(_0x3611b4){_0x2118a2[_0x9139('0x42')]=_0x3611b4;return _0x2118a2;})[_0x9139('0x22')](respondWithFilteredResult(_0x4c1693,_0x50d545))['catch'](handleError(_0x4c1693,null));};exports[_0x9139('0x43')]=function(_0x2f3ed4,_0x40fd52){var _0xf81f77={'raw':![],'where':{'id':_0x2f3ed4['params']['id']}},_0x2197ff={};_0x2197ff[_0x9139('0x2e')]=_[_0x9139('0x30')](db[_0x9139('0x2c')][_0x9139('0x44')]);_0x2197ff['query']=_['keys'](_0x2f3ed4[_0x9139('0x2f')]);_0x2197ff[_0x9139('0x31')]=_['intersection'](_0x2197ff['model'],_0x2197ff[_0x9139('0x2f')]);_0xf81f77[_0x9139('0x33')]=_['intersection'](_0x2197ff[_0x9139('0x2e')],qs[_0x9139('0x34')](_0x2f3ed4['query'][_0x9139('0x34')]));_0xf81f77['attributes']=_0xf81f77['attributes'][_0x9139('0x35')]?_0xf81f77[_0x9139('0x33')]:_0x2197ff[_0x9139('0x2e')];if(_0x2f3ed4[_0x9139('0x2f')][_0x9139('0x45')]){_0xf81f77['include']=[{'all':!![]}];}_0xf81f77=_[_0x9139('0x3d')]({},_0xf81f77,_0x2f3ed4[_0x9139('0x3f')]);return db[_0x9139('0x2c')]['find'](_0xf81f77)[_0x9139('0x22')](handleEntityNotFound(_0x40fd52,null))[_0x9139('0x22')](respondWithResult(_0x40fd52,null))[_0x9139('0x46')](handleError(_0x40fd52,null));};exports[_0x9139('0x47')]=function(_0x215793,_0x31395f){return db[_0x9139('0x2c')][_0x9139('0x47')](_0x215793[_0x9139('0x48')],{})[_0x9139('0x22')](function(_0x2da28c){var _0x54c926=_0x215793[_0x9139('0x49')][_0x9139('0x4a')]({'plain':!![]});if(!_0x54c926)throw new Error(_0x9139('0x4b'));if(_0x54c926['role']===_0x9139('0x49')){var _0x46f77a=_0x2da28c['get']({'plain':!![]});var _0x2f4a6f=_0x9139('0x23');return db[_0x9139('0x4c')]['find']({'where':{'name':_0x2f4a6f,'userProfileId':_0x54c926[_0x9139('0x4d')]},'raw':!![]})[_0x9139('0x22')](function(_0x1404ce){if(_0x1404ce&&_0x1404ce[_0x9139('0x4e')]===0x0){return db['UserProfileResource'][_0x9139('0x47')]({'name':_0x46f77a[_0x9139('0x28')],'resourceId':_0x46f77a['id'],'type':_0x1404ce[_0x9139('0x28')],'sectionId':_0x1404ce['id']},{})['then'](function(){return _0x2da28c;});}else{return _0x2da28c;}})[_0x9139('0x46')](function(_0x146201){logger[_0x9139('0x26')](_0x9139('0x4f'),_0x146201);throw _0x146201;});}return _0x2da28c;})[_0x9139('0x22')](respondWithResult(_0x31395f,0xc9))[_0x9139('0x46')](handleError(_0x31395f,null));};exports[_0x9139('0x50')]=function(_0x5857bf,_0x35002d){var _0x2d361f={'where':{'id':_0x5857bf[_0x9139('0x51')]['id']}},_0x5f3a48={};_0x5f3a48[_0x9139('0x2e')]=_[_0x9139('0x30')](db[_0x9139('0x2c')][_0x9139('0x44')]);_0x2d361f['attributes']=_[_0x9139('0x32')](_0x5f3a48[_0x9139('0x2e')],qs['fields'](_0x5857bf['query'][_0x9139('0x34')]));_0x2d361f[_0x9139('0x33')]=_0x2d361f[_0x9139('0x33')]['length']?_0x2d361f[_0x9139('0x33')]:_0x5f3a48['model'];if(_0x5857bf['query'][_0x9139('0x45')]){_0x2d361f[_0x9139('0x52')]=[{'all':!![]}];}_0x2d361f=_[_0x9139('0x3d')]({},_0x2d361f,_0x5857bf[_0x9139('0x3f')]);return db['JscriptyProject'][_0x9139('0x53')](_0x2d361f)[_0x9139('0x22')](handleEntityNotFound(_0x35002d,null))[_0x9139('0x22')](function(_0x4a74d2){if(_0x4a74d2){var _0x18421a=_0x4a74d2[_0x9139('0x4a')]({'plain':!![]});_0x18421a=qs[_0x9139('0x54')](_0x18421a,['id',_0x9139('0x55'),_0x9139('0x56')]);_0x5857bf[_0x9139('0x48')]=_[_0x9139('0x54')](_0x5857bf[_0x9139('0x48')],['id',_0x9139('0x55'),_0x9139('0x56')]);return db[_0x9139('0x2c')][_0x9139('0x47')](_[_0x9139('0x3d')](_0x18421a,_0x5857bf[_0x9139('0x48')]),{'include':_0x5857bf['query'][_0x9139('0x45')]?[{'all':!![]}]:undefined})[_0x9139('0x22')](function(_0x3ef34c){var _0x37433c=_0x5857bf[_0x9139('0x49')]['get']({'plain':!![]});if(!_0x37433c)throw new Error(_0x9139('0x4b'));if(_0x37433c[_0x9139('0x57')]===_0x9139('0x49')){var _0x196be1=_0x3ef34c[_0x9139('0x4a')]({'plain':!![]});var _0x581ae0='Projects';return db[_0x9139('0x4c')][_0x9139('0x53')]({'where':{'name':_0x581ae0,'userProfileId':_0x37433c['userProfileId']},'raw':!![]})[_0x9139('0x22')](function(_0xd20c65){if(_0xd20c65&&_0xd20c65[_0x9139('0x4e')]===0x0){return db[_0x9139('0x24')][_0x9139('0x47')]({'name':_0x196be1[_0x9139('0x28')],'resourceId':_0x196be1['id'],'type':_0xd20c65[_0x9139('0x28')],'sectionId':_0xd20c65['id']},{})[_0x9139('0x22')](function(){return _0x3ef34c;});}else{return _0x3ef34c;}})[_0x9139('0x46')](function(_0x53a27f){logger[_0x9139('0x26')](_0x9139('0x4f'),_0x53a27f);throw _0x53a27f;});}return _0x3ef34c;});}})[_0x9139('0x22')](respondWithResult(_0x35002d,0xc9))[_0x9139('0x46')](handleError(_0x35002d,null));};exports['update']=function(_0x53152f,_0x46b5cb){if(_0x53152f[_0x9139('0x48')]['id']){delete _0x53152f[_0x9139('0x48')]['id'];}return db[_0x9139('0x2c')]['find']({'where':{'id':_0x53152f[_0x9139('0x51')]['id']}})[_0x9139('0x22')](handleEntityNotFound(_0x46b5cb,null))['then'](saveUpdates(_0x53152f[_0x9139('0x48')],null))[_0x9139('0x22')](respondWithResult(_0x46b5cb,null))[_0x9139('0x46')](handleError(_0x46b5cb,null));};exports[_0x9139('0x58')]=function(_0x198ddb,_0x45eeda){return db[_0x9139('0x2c')][_0x9139('0x53')]({'where':{'id':_0x198ddb['params']['id']}})['then'](handleEntityNotFound(_0x45eeda,null))['then'](removeEntity(_0x45eeda,null))[_0x9139('0x46')](handleError(_0x45eeda,null));};exports[_0x9139('0x59')]=function(_0x2235fb,_0x4eefd8,_0x42f66c){var _0x3f3d58={'raw':!![],'where':{}};var _0x42d389={};var _0x235241={'count':0x0,'rows':[]};return db[_0x9139('0x2c')][_0x9139('0x5a')]({'where':{'id':_0x2235fb['params']['id']}})[_0x9139('0x22')](handleEntityNotFound(_0x4eefd8,null))['then'](function(_0xf079b8){if(_0xf079b8){_0x42d389['model']=_[_0x9139('0x30')](db[_0x9139('0x5b')]['rawAttributes']);_0x42d389['query']=_[_0x9139('0x30')](_0x2235fb[_0x9139('0x2f')]);_0x42d389[_0x9139('0x31')]=_['intersection'](_0x42d389[_0x9139('0x2e')],_0x42d389[_0x9139('0x2f')]);_0x3f3d58[_0x9139('0x33')]=_[_0x9139('0x32')](_0x42d389['model'],qs['fields'](_0x2235fb[_0x9139('0x2f')][_0x9139('0x34')]));_0x3f3d58['attributes']=_0x3f3d58[_0x9139('0x33')][_0x9139('0x35')]?_0x3f3d58[_0x9139('0x33')]:_0x42d389[_0x9139('0x2e')];if(!_0x2235fb[_0x9139('0x2f')][_0x9139('0x36')](_0x9139('0x37'))){_0x3f3d58[_0x9139('0x1a')]=qs[_0x9139('0x1a')](_0x2235fb[_0x9139('0x2f')][_0x9139('0x1a')]);_0x3f3d58[_0x9139('0x18')]=qs[_0x9139('0x18')](_0x2235fb['query'][_0x9139('0x18')]);}_0x3f3d58[_0x9139('0x38')]=qs[_0x9139('0x39')](_0x2235fb[_0x9139('0x2f')][_0x9139('0x39')]);_0x3f3d58['where']=qs[_0x9139('0x31')](_['pick'](_0x2235fb[_0x9139('0x2f')],_0x42d389[_0x9139('0x31')]));_0x3f3d58[_0x9139('0x3a')]['ProjectId']=_0xf079b8['id'];if(_0x2235fb[_0x9139('0x2f')][_0x9139('0x3c')]){_0x3f3d58['where']=_[_0x9139('0x3d')](_0x3f3d58[_0x9139('0x3a')],{'$or':_[_0x9139('0x2b')](_0x3f3d58[_0x9139('0x33')],function(_0x16a1f6){var _0x451458={};_0x451458[_0x16a1f6]={'$like':'%'+_0x2235fb[_0x9139('0x2f')][_0x9139('0x3c')]+'%'};return _0x451458;})});}_0x3f3d58=_[_0x9139('0x3d')]({},_0x3f3d58,_0x2235fb['options']);return db[_0x9139('0x5b')][_0x9139('0x40')]({'where':_0x3f3d58[_0x9139('0x3a')]})[_0x9139('0x22')](function(_0x276609){_0x235241['count']=_0x276609;if(_0x2235fb[_0x9139('0x2f')][_0x9139('0x45')]){_0x3f3d58['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x9139('0x41')](_0x3f3d58);})[_0x9139('0x22')](function(_0x1a3833){_0x235241[_0x9139('0x42')]=_0x1a3833;return _0x235241;});}})['then'](respondWithFilteredResult(_0x4eefd8,_0x3f3d58))[_0x9139('0x46')](handleError(_0x4eefd8,null));};exports[_0x9139('0x5c')]=function(_0x2a4696,_0x2e5727,_0xf3162b){var _0x13510c={'raw':!![],'where':{}};var _0x3f0ddd={};var _0x207f10={'count':0x0,'rows':[]};return db[_0x9139('0x2c')][_0x9139('0x5a')]({'where':{'id':_0x2a4696[_0x9139('0x51')]['id']}})[_0x9139('0x22')](handleEntityNotFound(_0x2e5727,null))[_0x9139('0x22')](function(_0x100c61){if(_0x100c61){_0x3f0ddd[_0x9139('0x2e')]=_[_0x9139('0x30')](db[_0x9139('0x5d')][_0x9139('0x44')]);_0x3f0ddd[_0x9139('0x2f')]=_['keys'](_0x2a4696[_0x9139('0x2f')]);_0x3f0ddd[_0x9139('0x31')]=_[_0x9139('0x32')](_0x3f0ddd[_0x9139('0x2e')],_0x3f0ddd[_0x9139('0x2f')]);_0x13510c['attributes']=_[_0x9139('0x32')](_0x3f0ddd[_0x9139('0x2e')],qs[_0x9139('0x34')](_0x2a4696[_0x9139('0x2f')][_0x9139('0x34')]));_0x13510c[_0x9139('0x33')]=_0x13510c[_0x9139('0x33')]['length']?_0x13510c['attributes']:_0x3f0ddd[_0x9139('0x2e')];if(!_0x2a4696[_0x9139('0x2f')][_0x9139('0x36')](_0x9139('0x37'))){_0x13510c['limit']=qs['limit'](_0x2a4696[_0x9139('0x2f')][_0x9139('0x1a')]);_0x13510c[_0x9139('0x18')]=qs[_0x9139('0x18')](_0x2a4696[_0x9139('0x2f')][_0x9139('0x18')]);}_0x13510c[_0x9139('0x38')]=qs[_0x9139('0x39')](_0x2a4696[_0x9139('0x2f')]['sort']);_0x13510c[_0x9139('0x3a')]=qs['filters'](_[_0x9139('0x3b')](_0x2a4696[_0x9139('0x2f')],_0x3f0ddd[_0x9139('0x31')]));_0x13510c[_0x9139('0x3a')]['ProjectId']=_0x100c61['id'];if(_0x2a4696['query'][_0x9139('0x3c')]){_0x13510c[_0x9139('0x3a')]=_[_0x9139('0x3d')](_0x13510c[_0x9139('0x3a')],{'$or':_[_0x9139('0x2b')](_0x13510c['attributes'],function(_0x47e8bf){var _0x315f1a={};_0x315f1a[_0x47e8bf]={'$like':'%'+_0x2a4696['query'][_0x9139('0x3c')]+'%'};return _0x315f1a;})});}_0x13510c=_[_0x9139('0x3d')]({},_0x13510c,_0x2a4696[_0x9139('0x3f')]);return db['JscriptyAnswerReport'][_0x9139('0x40')]({'where':_0x13510c[_0x9139('0x3a')]})[_0x9139('0x22')](function(_0x1213c6){_0x207f10[_0x9139('0x40')]=_0x1213c6;if(_0x2a4696[_0x9139('0x2f')]['includeAll']){_0x13510c[_0x9139('0x52')]=[{'all':!![]}];}return db[_0x9139('0x5d')][_0x9139('0x41')](_0x13510c);})[_0x9139('0x22')](function(_0x53ecf0){_0x207f10['rows']=_0x53ecf0;return _0x207f10;});}})[_0x9139('0x22')](respondWithFilteredResult(_0x2e5727,_0x13510c))[_0x9139('0x46')](handleError(_0x2e5727,null));};function char(_0x4fe06f){return'number'===typeof _0x4fe06f?String[_0x9139('0x5e')]['apply'](null,arguments):_0x4fe06f;}function needsEncapsulation(_0x43514f){return!!_0x43514f&&(_0x43514f['toString']()['indexOf'](char(0xd))>=0x0||_0x43514f[_0x9139('0x5f')]()[_0x9139('0x60')](char(0xa))>=0x0||_0x43514f[_0x9139('0x5f')]()[_0x9139('0x60')](char(0x2c))>=0x0||_0x43514f[_0x9139('0x5f')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x4f7b28){var _0x2d5136=char(0x22),_0xc0aed='\x5c'+char(0x22),_0x459e1e=_0x4f7b28[_0x9139('0x5f')]()['replace'](new RegExp(_0x2d5136,'g'),_0xc0aed);return _0x2d5136+_0x459e1e+_0x2d5136;}exports[_0x9139('0x61')]=function(_0x4fc4f5,_0xee2971,_0x4dae55){var _0x17aa23,_0x5b5a60;var _0x11e439={'where':{'ProjectId':_0x4fc4f5['params']['id']}};if(_0x4fc4f5['query'][_0x9139('0x62')]){_0x11e439[_0x9139('0x3a')][_0x9139('0x63')]=JSON['parse'](_0x4fc4f5[_0x9139('0x2f')]['startTime']);}return db[_0x9139('0x5b')][_0x9139('0x41')](_0x11e439)[_0x9139('0x22')](handleEntityNotFound(_0xee2971,null))[_0x9139('0x22')](function(_0x354e08){if(_0x354e08){_0x17aa23=_0x354e08;return db[_0x9139('0x64')]['findAll']({'where':{'SessionId':{'$in':_['map'](_0x17aa23,'id')},'ProjectId':_0x4fc4f5[_0x9139('0x51')]['id']},'order':_0x9139('0x65')});}})[_0x9139('0x22')](handleEntityNotFound(_0xee2971,null))[_0x9139('0x22')](function(_0xb2cb17){if(_0xb2cb17){_0x5b5a60=_0xb2cb17;var _0x4d9e23={};for(var _0x5beb9d=0x0,_0x28b7bc=_0x5b5a60[_0x9139('0x35')];_0x5beb9d<_0x28b7bc;_0x5beb9d++){if(!_0x4d9e23[_0x9139('0x36')](_0x5b5a60[_0x5beb9d][_0x9139('0x66')])){_0x4d9e23[_0x5b5a60[_0x5beb9d][_0x9139('0x66')]]=needsEncapsulation(_0x5b5a60[_0x5beb9d][_0x9139('0x67')])?encapsulate(_0x5b5a60[_0x5beb9d]['question']):_0x5b5a60[_0x5beb9d]['question'];}}var _0x2fb0f0=[],_0x310f49={};for(var _0x10d4ac=0x0,_0x49d58d=_0x17aa23['length'];_0x10d4ac<_0x49d58d;_0x10d4ac++){_0x310f49={'ProjectId':_0x4fc4f5[_0x9139('0x51')]['id'],'SessionId':_0x17aa23[_0x10d4ac]['id'],'StartTime':moment(_0x17aa23[_0x10d4ac]['starttime'])[_0x9139('0x68')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x156dca=0x0,_0x332381=_0x5b5a60['length'];_0x156dca<_0x332381;_0x156dca++){if(_0x5b5a60[_0x156dca][_0x9139('0x69')]==_0x17aa23[_0x10d4ac]['id']&&_0x4d9e23['hasOwnProperty'](_0x5b5a60[_0x156dca]['questionId'])){_0x310f49[_0x4d9e23[_0x5b5a60[_0x156dca][_0x9139('0x66')]]]=_0x5b5a60[_0x156dca][_0x9139('0x6a')];}}for(var _0xd3ec0b in _0x4d9e23){if(!_0x310f49[_0x9139('0x36')](_0x4d9e23[_0xd3ec0b])){_0x310f49[_0x4d9e23[_0xd3ec0b]]=null;}}_0x2fb0f0[_0x9139('0x6b')](_0x310f49);}return _0x2fb0f0;}})[_0x9139('0x22')](function(_0x4cce2c){if(!_[_0x9139('0x6c')](_0x4cce2c)){var _0x3b5254=toCsv(_0x4cce2c);var _0x80b742=Date[_0x9139('0x6d')]();fs['writeFileSync'](util[_0x9139('0x68')](_0x9139('0x6e'),_0x4fc4f5[_0x9139('0x51')]['id'],_0x80b742),_0x3b5254);_0xee2971[_0x9139('0x6f')](_0x9139('0x70'),_0x9139('0x71')+util[_0x9139('0x68')](_0x9139('0x72'),_0x4fc4f5['params']['id'],_0x80b742));_0xee2971[_0x9139('0x6f')](_0x9139('0x73'),_0x9139('0x74'));return _0xee2971[_0x9139('0x75')](util[_0x9139('0x68')](_0x9139('0x6e'),_0x4fc4f5[_0x9139('0x51')]['id'],_0x80b742));}else{return _0xee2971[_0x9139('0x25')](0xcc);}})['catch'](handleError(_0xee2971,null));}; \ No newline at end of file +var _0xaed4=['text/csv','download','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','Projects','UserProfileResource','error','name','send','map','JscriptyProject','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','filter','where','merge','VIRTUAL','include','findAll','rows','show','rawAttributes','includeAll','options','create','body','user','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','find','get','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','params','getSessions','findOne','JscriptySessionReport','sort','pick','ProjectId','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','startTime','parse','JscriptyQuestionReport','-createdAt','questionId','question','starttime','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','Content-type'];(function(_0x1c0391,_0x5a6e0f){var _0x47b19b=function(_0x324f35){while(--_0x324f35){_0x1c0391['push'](_0x1c0391['shift']());}};_0x47b19b(++_0x5a6e0f);}(_0xaed4,0xf4));var _0x4aed=function(_0x4b9977,_0x2969fe){_0x4b9977=_0x4b9977-0x0;var _0x4b4c09=_0xaed4[_0x4b9977];return _0x4b4c09;};'use strict';var emlformat=require(_0x4aed('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4aed('0x1'));var jsonpatch=require(_0x4aed('0x2'));var rp=require(_0x4aed('0x3'));var moment=require(_0x4aed('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4aed('0x5'));var util=require(_0x4aed('0x6'));var path=require(_0x4aed('0x7'));var sox=require(_0x4aed('0x8'));var csv=require(_0x4aed('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4aed('0xa'));var _=require(_0x4aed('0xb'));var squel=require(_0x4aed('0xc'));var crypto=require(_0x4aed('0xd'));var jsforce=require(_0x4aed('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4aed('0x9'));var querystring=require('querystring');var Papa=require(_0x4aed('0xf'));var Redis=require(_0x4aed('0x10'));var authService=require(_0x4aed('0x11'));var qs=require(_0x4aed('0x12'));var as=require(_0x4aed('0x13'));var hardwareService=require(_0x4aed('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x4aed('0x15'));var config=require(_0x4aed('0x16'));var licenseUtil=require(_0x4aed('0x17'));var db=require(_0x4aed('0x18'))['db'];function respondWithStatusCode(_0x4a4725,_0x3b26ec){_0x3b26ec=_0x3b26ec||0xcc;return function(_0x4a7c7a){if(_0x4a7c7a){return _0x4a4725[_0x4aed('0x19')](_0x3b26ec);}return _0x4a4725[_0x4aed('0x1a')](_0x3b26ec)[_0x4aed('0x1b')]();};}function respondWithResult(_0x4550fb,_0x3f105a){_0x3f105a=_0x3f105a||0xc8;return function(_0x4c21f7){if(_0x4c21f7){return _0x4550fb[_0x4aed('0x1a')](_0x3f105a)[_0x4aed('0x1c')](_0x4c21f7);}};}function respondWithFilteredResult(_0x6cba6d,_0xec855b){return function(_0x4880aa){if(_0x4880aa){var _0x49bd62=typeof _0xec855b[_0x4aed('0x1d')]===_0x4aed('0x1e')&&typeof _0xec855b[_0x4aed('0x1f')]===_0x4aed('0x1e');var _0x134db1=_0x4880aa[_0x4aed('0x20')];var _0xd07a09=_0x49bd62?0x0:_0xec855b['offset'];var _0x5e766b=_0x49bd62?_0x4880aa['count']:_0xec855b[_0x4aed('0x1d')]+_0xec855b[_0x4aed('0x1f')];var _0x3d2d7f;if(_0x5e766b>=_0x134db1){_0x5e766b=_0x134db1;_0x3d2d7f=0xc8;}else{_0x3d2d7f=0xce;}_0x6cba6d[_0x4aed('0x1a')](_0x3d2d7f);return _0x6cba6d[_0x4aed('0x21')](_0x4aed('0x22'),_0xd07a09+'-'+_0x5e766b+'/'+_0x134db1)[_0x4aed('0x1c')](_0x4880aa);}return null;};}function patchUpdates(_0x556598){return function(_0x37a926){try{jsonpatch[_0x4aed('0x23')](_0x37a926,_0x556598,!![]);}catch(_0x18e16c){return BPromise['reject'](_0x18e16c);}return _0x37a926[_0x4aed('0x24')]();};}function saveUpdates(_0x3e3eff,_0x5aed24){return function(_0xa32922){if(_0xa32922){return _0xa32922[_0x4aed('0x25')](_0x3e3eff)[_0x4aed('0x26')](function(_0xa68fdb){return _0xa68fdb;});}return null;};}function removeEntity(_0x3410a4,_0x2453cd){return function(_0x1daea7){if(_0x1daea7){return _0x1daea7[_0x4aed('0x27')]()[_0x4aed('0x26')](function(){var _0x34c213=_0x1daea7['get']({'plain':!![]});var _0x3d388a=_0x4aed('0x28');return db[_0x4aed('0x29')]['destroy']({'where':{'type':_0x3d388a,'resourceId':_0x34c213['id']}})[_0x4aed('0x26')](function(){return _0x1daea7;});})[_0x4aed('0x26')](function(){_0x3410a4[_0x4aed('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56f4d9,_0x1760c2){return function(_0x137eab){if(!_0x137eab){_0x56f4d9['sendStatus'](0x194);}return _0x137eab;};}function handleError(_0x2d6285,_0x1ac50a){_0x1ac50a=_0x1ac50a||0x1f4;return function(_0x620f5f){logger[_0x4aed('0x2a')](_0x620f5f['stack']);if(_0x620f5f[_0x4aed('0x2b')]){delete _0x620f5f['name'];}_0x2d6285[_0x4aed('0x1a')](_0x1ac50a)[_0x4aed('0x2c')](_0x620f5f);};}exports['index']=function(_0x249d7f,_0x299182){var _0x163aa7={},_0x1ca992={},_0x6a53dd={'count':0x0,'rows':[]};var _0x2d0b6c=_[_0x4aed('0x2d')](db[_0x4aed('0x2e')]['rawAttributes'],function(_0x18f0cd){return{'name':_0x18f0cd[_0x4aed('0x2f')],'type':_0x18f0cd[_0x4aed('0x30')]['key']};});_0x1ca992[_0x4aed('0x31')]=_[_0x4aed('0x2d')](_0x2d0b6c,'name');_0x1ca992[_0x4aed('0x32')]=_[_0x4aed('0x33')](_0x249d7f[_0x4aed('0x32')]);_0x1ca992[_0x4aed('0x34')]=_[_0x4aed('0x35')](_0x1ca992[_0x4aed('0x31')],_0x1ca992[_0x4aed('0x32')]);_0x163aa7[_0x4aed('0x36')]=_['intersection'](_0x1ca992[_0x4aed('0x31')],qs[_0x4aed('0x37')](_0x249d7f['query'][_0x4aed('0x37')]));_0x163aa7[_0x4aed('0x36')]=_0x163aa7[_0x4aed('0x36')][_0x4aed('0x38')]?_0x163aa7[_0x4aed('0x36')]:_0x1ca992[_0x4aed('0x31')];if(!_0x249d7f[_0x4aed('0x32')][_0x4aed('0x39')](_0x4aed('0x3a'))){_0x163aa7[_0x4aed('0x1f')]=qs[_0x4aed('0x1f')](_0x249d7f['query']['limit']);_0x163aa7[_0x4aed('0x1d')]=qs[_0x4aed('0x1d')](_0x249d7f[_0x4aed('0x32')][_0x4aed('0x1d')]);}_0x163aa7[_0x4aed('0x3b')]=qs['sort'](_0x249d7f[_0x4aed('0x32')]['sort']);_0x163aa7['where']=qs[_0x4aed('0x34')](_['pick'](_0x249d7f['query'],_0x1ca992[_0x4aed('0x34')]),_0x2d0b6c);if(_0x249d7f[_0x4aed('0x32')][_0x4aed('0x3c')]){_0x163aa7[_0x4aed('0x3d')]=_[_0x4aed('0x3e')](_0x163aa7[_0x4aed('0x3d')],{'$or':_[_0x4aed('0x2d')](_0x2d0b6c,function(_0x41323d){if(_0x41323d[_0x4aed('0x30')]!==_0x4aed('0x3f')){var _0x182b81={};_0x182b81[_0x41323d[_0x4aed('0x2b')]]={'$like':'%'+_0x249d7f[_0x4aed('0x32')][_0x4aed('0x3c')]+'%'};return _0x182b81;}})});}_0x163aa7=_[_0x4aed('0x3e')]({},_0x163aa7,_0x249d7f['options']);var _0x3c02e9={'where':_0x163aa7[_0x4aed('0x3d')]};return db['JscriptyProject']['count'](_0x3c02e9)[_0x4aed('0x26')](function(_0x24ab20){_0x6a53dd[_0x4aed('0x20')]=_0x24ab20;if(_0x249d7f[_0x4aed('0x32')]['includeAll']){_0x163aa7[_0x4aed('0x40')]=[{'all':!![]}];}return db[_0x4aed('0x2e')][_0x4aed('0x41')](_0x163aa7);})[_0x4aed('0x26')](function(_0x1ea7ff){_0x6a53dd[_0x4aed('0x42')]=_0x1ea7ff;return _0x6a53dd;})[_0x4aed('0x26')](respondWithFilteredResult(_0x299182,_0x163aa7))['catch'](handleError(_0x299182,null));};exports[_0x4aed('0x43')]=function(_0x4af896,_0x4d0154){var _0xf301f5={'raw':![],'where':{'id':_0x4af896['params']['id']}},_0x2552ea={};_0x2552ea[_0x4aed('0x31')]=_[_0x4aed('0x33')](db[_0x4aed('0x2e')][_0x4aed('0x44')]);_0x2552ea['query']=_['keys'](_0x4af896[_0x4aed('0x32')]);_0x2552ea[_0x4aed('0x34')]=_[_0x4aed('0x35')](_0x2552ea['model'],_0x2552ea['query']);_0xf301f5['attributes']=_[_0x4aed('0x35')](_0x2552ea[_0x4aed('0x31')],qs[_0x4aed('0x37')](_0x4af896['query'][_0x4aed('0x37')]));_0xf301f5[_0x4aed('0x36')]=_0xf301f5['attributes'][_0x4aed('0x38')]?_0xf301f5[_0x4aed('0x36')]:_0x2552ea['model'];if(_0x4af896[_0x4aed('0x32')][_0x4aed('0x45')]){_0xf301f5[_0x4aed('0x40')]=[{'all':!![]}];}_0xf301f5=_[_0x4aed('0x3e')]({},_0xf301f5,_0x4af896[_0x4aed('0x46')]);return db[_0x4aed('0x2e')]['find'](_0xf301f5)[_0x4aed('0x26')](handleEntityNotFound(_0x4d0154,null))['then'](respondWithResult(_0x4d0154,null))['catch'](handleError(_0x4d0154,null));};exports['create']=function(_0x5ab9da,_0x28adbf){return db[_0x4aed('0x2e')][_0x4aed('0x47')](_0x5ab9da[_0x4aed('0x48')],{})[_0x4aed('0x26')](function(_0x25b3ab){var _0x15fd61=_0x5ab9da['user']['get']({'plain':!![]});if(!_0x15fd61)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x15fd61['role']===_0x4aed('0x49')){var _0x538def=_0x25b3ab['get']({'plain':!![]});var _0x2494af='Projects';return db[_0x4aed('0x4a')]['find']({'where':{'name':_0x2494af,'userProfileId':_0x15fd61[_0x4aed('0x4b')]},'raw':!![]})['then'](function(_0xe52bc6){if(_0xe52bc6&&_0xe52bc6[_0x4aed('0x4c')]===0x0){return db[_0x4aed('0x29')][_0x4aed('0x47')]({'name':_0x538def[_0x4aed('0x2b')],'resourceId':_0x538def['id'],'type':_0xe52bc6[_0x4aed('0x2b')],'sectionId':_0xe52bc6['id']},{})['then'](function(){return _0x25b3ab;});}else{return _0x25b3ab;}})[_0x4aed('0x4d')](function(_0x52dc29){logger[_0x4aed('0x2a')](_0x4aed('0x4e'),_0x52dc29);throw _0x52dc29;});}return _0x25b3ab;})[_0x4aed('0x26')](respondWithResult(_0x28adbf,0xc9))[_0x4aed('0x4d')](handleError(_0x28adbf,null));};exports[_0x4aed('0x4f')]=function(_0x2a7747,_0x3f39d2){var _0x4a9e90={'where':{'id':_0x2a7747['params']['id']}},_0x149f27={};_0x149f27[_0x4aed('0x31')]=_[_0x4aed('0x33')](db['JscriptyProject'][_0x4aed('0x44')]);_0x4a9e90[_0x4aed('0x36')]=_['intersection'](_0x149f27['model'],qs['fields'](_0x2a7747[_0x4aed('0x32')][_0x4aed('0x37')]));_0x4a9e90['attributes']=_0x4a9e90[_0x4aed('0x36')][_0x4aed('0x38')]?_0x4a9e90['attributes']:_0x149f27[_0x4aed('0x31')];if(_0x2a7747[_0x4aed('0x32')]['includeAll']){_0x4a9e90[_0x4aed('0x40')]=[{'all':!![]}];}_0x4a9e90=_[_0x4aed('0x3e')]({},_0x4a9e90,_0x2a7747[_0x4aed('0x46')]);return db[_0x4aed('0x2e')][_0x4aed('0x50')](_0x4a9e90)[_0x4aed('0x26')](handleEntityNotFound(_0x3f39d2,null))[_0x4aed('0x26')](function(_0x38ef67){if(_0x38ef67){var _0x518799=_0x38ef67[_0x4aed('0x51')]({'plain':!![]});_0x518799=qs[_0x4aed('0x52')](_0x518799,['id',_0x4aed('0x53'),_0x4aed('0x54')]);_0x2a7747[_0x4aed('0x48')]=_['omit'](_0x2a7747[_0x4aed('0x48')],['id',_0x4aed('0x53'),_0x4aed('0x54')]);return db['JscriptyProject'][_0x4aed('0x47')](_[_0x4aed('0x3e')](_0x518799,_0x2a7747[_0x4aed('0x48')]),{'include':_0x2a7747[_0x4aed('0x32')][_0x4aed('0x45')]?[{'all':!![]}]:undefined})[_0x4aed('0x26')](function(_0x4f7b06){var _0x5b9fdd=_0x2a7747['user'][_0x4aed('0x51')]({'plain':!![]});if(!_0x5b9fdd)throw new Error(_0x4aed('0x55'));if(_0x5b9fdd[_0x4aed('0x56')]===_0x4aed('0x49')){var _0x500aec=_0x4f7b06[_0x4aed('0x51')]({'plain':!![]});var _0x2c8b69=_0x4aed('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x2c8b69,'userProfileId':_0x5b9fdd[_0x4aed('0x4b')]},'raw':!![]})[_0x4aed('0x26')](function(_0x49bcb7){if(_0x49bcb7&&_0x49bcb7[_0x4aed('0x4c')]===0x0){return db['UserProfileResource'][_0x4aed('0x47')]({'name':_0x500aec[_0x4aed('0x2b')],'resourceId':_0x500aec['id'],'type':_0x49bcb7[_0x4aed('0x2b')],'sectionId':_0x49bcb7['id']},{})['then'](function(){return _0x4f7b06;});}else{return _0x4f7b06;}})[_0x4aed('0x4d')](function(_0x454ef9){logger['error'](_0x4aed('0x4e'),_0x454ef9);throw _0x454ef9;});}return _0x4f7b06;});}})[_0x4aed('0x26')](respondWithResult(_0x3f39d2,0xc9))[_0x4aed('0x4d')](handleError(_0x3f39d2,null));};exports[_0x4aed('0x25')]=function(_0x50ff20,_0xdf0cd0){if(_0x50ff20[_0x4aed('0x48')]['id']){delete _0x50ff20[_0x4aed('0x48')]['id'];}return db[_0x4aed('0x2e')][_0x4aed('0x50')]({'where':{'id':_0x50ff20[_0x4aed('0x57')]['id']}})[_0x4aed('0x26')](handleEntityNotFound(_0xdf0cd0,null))[_0x4aed('0x26')](saveUpdates(_0x50ff20[_0x4aed('0x48')],null))[_0x4aed('0x26')](respondWithResult(_0xdf0cd0,null))[_0x4aed('0x4d')](handleError(_0xdf0cd0,null));};exports['destroy']=function(_0x3be44e,_0x3f35f3){return db[_0x4aed('0x2e')]['find']({'where':{'id':_0x3be44e[_0x4aed('0x57')]['id']}})[_0x4aed('0x26')](handleEntityNotFound(_0x3f35f3,null))[_0x4aed('0x26')](removeEntity(_0x3f35f3,null))[_0x4aed('0x4d')](handleError(_0x3f35f3,null));};exports[_0x4aed('0x58')]=function(_0x5f1924,_0x4ae2d4,_0x366f22){var _0x4645cb={'raw':!![],'where':{}};var _0x2a7d16={};var _0x314973={'count':0x0,'rows':[]};return db[_0x4aed('0x2e')][_0x4aed('0x59')]({'where':{'id':_0x5f1924[_0x4aed('0x57')]['id']}})[_0x4aed('0x26')](handleEntityNotFound(_0x4ae2d4,null))[_0x4aed('0x26')](function(_0x3696a7){if(_0x3696a7){_0x2a7d16['model']=_['keys'](db[_0x4aed('0x5a')][_0x4aed('0x44')]);_0x2a7d16[_0x4aed('0x32')]=_[_0x4aed('0x33')](_0x5f1924[_0x4aed('0x32')]);_0x2a7d16[_0x4aed('0x34')]=_['intersection'](_0x2a7d16[_0x4aed('0x31')],_0x2a7d16[_0x4aed('0x32')]);_0x4645cb[_0x4aed('0x36')]=_['intersection'](_0x2a7d16[_0x4aed('0x31')],qs['fields'](_0x5f1924['query'][_0x4aed('0x37')]));_0x4645cb['attributes']=_0x4645cb[_0x4aed('0x36')][_0x4aed('0x38')]?_0x4645cb[_0x4aed('0x36')]:_0x2a7d16[_0x4aed('0x31')];if(!_0x5f1924[_0x4aed('0x32')][_0x4aed('0x39')](_0x4aed('0x3a'))){_0x4645cb['limit']=qs[_0x4aed('0x1f')](_0x5f1924['query'][_0x4aed('0x1f')]);_0x4645cb['offset']=qs[_0x4aed('0x1d')](_0x5f1924[_0x4aed('0x32')]['offset']);}_0x4645cb[_0x4aed('0x3b')]=qs['sort'](_0x5f1924['query'][_0x4aed('0x5b')]);_0x4645cb[_0x4aed('0x3d')]=qs[_0x4aed('0x34')](_[_0x4aed('0x5c')](_0x5f1924[_0x4aed('0x32')],_0x2a7d16[_0x4aed('0x34')]));_0x4645cb['where'][_0x4aed('0x5d')]=_0x3696a7['id'];if(_0x5f1924[_0x4aed('0x32')][_0x4aed('0x3c')]){_0x4645cb[_0x4aed('0x3d')]=_['merge'](_0x4645cb[_0x4aed('0x3d')],{'$or':_['map'](_0x4645cb['attributes'],function(_0x383447){var _0x27cc24={};_0x27cc24[_0x383447]={'$like':'%'+_0x5f1924[_0x4aed('0x32')][_0x4aed('0x3c')]+'%'};return _0x27cc24;})});}_0x4645cb=_['merge']({},_0x4645cb,_0x5f1924[_0x4aed('0x46')]);return db[_0x4aed('0x5a')][_0x4aed('0x20')]({'where':_0x4645cb[_0x4aed('0x3d')]})['then'](function(_0x24c97e){_0x314973['count']=_0x24c97e;if(_0x5f1924[_0x4aed('0x32')]['includeAll']){_0x4645cb[_0x4aed('0x40')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x4aed('0x41')](_0x4645cb);})[_0x4aed('0x26')](function(_0x53606a){_0x314973[_0x4aed('0x42')]=_0x53606a;return _0x314973;});}})['then'](respondWithFilteredResult(_0x4ae2d4,_0x4645cb))['catch'](handleError(_0x4ae2d4,null));};exports[_0x4aed('0x5e')]=function(_0x2166ce,_0x2cf983,_0x1ff4c8){var _0x51a4b6={'raw':!![],'where':{}};var _0x341b39={};var _0x214e38={'count':0x0,'rows':[]};return db[_0x4aed('0x2e')][_0x4aed('0x59')]({'where':{'id':_0x2166ce[_0x4aed('0x57')]['id']}})['then'](handleEntityNotFound(_0x2cf983,null))[_0x4aed('0x26')](function(_0x489160){if(_0x489160){_0x341b39['model']=_['keys'](db[_0x4aed('0x5f')][_0x4aed('0x44')]);_0x341b39[_0x4aed('0x32')]=_[_0x4aed('0x33')](_0x2166ce['query']);_0x341b39[_0x4aed('0x34')]=_[_0x4aed('0x35')](_0x341b39['model'],_0x341b39['query']);_0x51a4b6[_0x4aed('0x36')]=_[_0x4aed('0x35')](_0x341b39['model'],qs[_0x4aed('0x37')](_0x2166ce['query'][_0x4aed('0x37')]));_0x51a4b6[_0x4aed('0x36')]=_0x51a4b6[_0x4aed('0x36')][_0x4aed('0x38')]?_0x51a4b6[_0x4aed('0x36')]:_0x341b39[_0x4aed('0x31')];if(!_0x2166ce[_0x4aed('0x32')]['hasOwnProperty'](_0x4aed('0x3a'))){_0x51a4b6[_0x4aed('0x1f')]=qs[_0x4aed('0x1f')](_0x2166ce[_0x4aed('0x32')]['limit']);_0x51a4b6[_0x4aed('0x1d')]=qs[_0x4aed('0x1d')](_0x2166ce[_0x4aed('0x32')][_0x4aed('0x1d')]);}_0x51a4b6[_0x4aed('0x3b')]=qs['sort'](_0x2166ce[_0x4aed('0x32')][_0x4aed('0x5b')]);_0x51a4b6['where']=qs[_0x4aed('0x34')](_[_0x4aed('0x5c')](_0x2166ce['query'],_0x341b39['filters']));_0x51a4b6[_0x4aed('0x3d')][_0x4aed('0x5d')]=_0x489160['id'];if(_0x2166ce[_0x4aed('0x32')][_0x4aed('0x3c')]){_0x51a4b6[_0x4aed('0x3d')]=_['merge'](_0x51a4b6[_0x4aed('0x3d')],{'$or':_['map'](_0x51a4b6[_0x4aed('0x36')],function(_0xa97c53){var _0xe43651={};_0xe43651[_0xa97c53]={'$like':'%'+_0x2166ce[_0x4aed('0x32')][_0x4aed('0x3c')]+'%'};return _0xe43651;})});}_0x51a4b6=_[_0x4aed('0x3e')]({},_0x51a4b6,_0x2166ce['options']);return db['JscriptyAnswerReport'][_0x4aed('0x20')]({'where':_0x51a4b6[_0x4aed('0x3d')]})['then'](function(_0x3149ab){_0x214e38[_0x4aed('0x20')]=_0x3149ab;if(_0x2166ce[_0x4aed('0x32')][_0x4aed('0x45')]){_0x51a4b6[_0x4aed('0x40')]=[{'all':!![]}];}return db[_0x4aed('0x5f')][_0x4aed('0x41')](_0x51a4b6);})[_0x4aed('0x26')](function(_0x22d99a){_0x214e38['rows']=_0x22d99a;return _0x214e38;});}})[_0x4aed('0x26')](respondWithFilteredResult(_0x2cf983,_0x51a4b6))['catch'](handleError(_0x2cf983,null));};function char(_0x49714d){return _0x4aed('0x60')===typeof _0x49714d?String[_0x4aed('0x61')]['apply'](null,arguments):_0x49714d;}function needsEncapsulation(_0x562b6){return!!_0x562b6&&(_0x562b6[_0x4aed('0x62')]()[_0x4aed('0x63')](char(0xd))>=0x0||_0x562b6[_0x4aed('0x62')]()[_0x4aed('0x63')](char(0xa))>=0x0||_0x562b6['toString']()[_0x4aed('0x63')](char(0x2c))>=0x0||_0x562b6[_0x4aed('0x62')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x4eb8a6){var _0x57350e=char(0x22),_0x22dd18='\x5c'+char(0x22),_0x5b5f8e=_0x4eb8a6[_0x4aed('0x62')]()[_0x4aed('0x64')](new RegExp(_0x57350e,'g'),_0x22dd18);return _0x57350e+_0x5b5f8e+_0x57350e;}exports['getSummary']=function(_0x227adf,_0x2f333d,_0x535ff1){var _0x3a2423,_0x19a743;var _0x20a88e={'where':{'ProjectId':_0x227adf['params']['id']}};if(_0x227adf['query'][_0x4aed('0x65')]){_0x20a88e[_0x4aed('0x3d')]['starttime']=JSON[_0x4aed('0x66')](_0x227adf[_0x4aed('0x32')][_0x4aed('0x65')]);}return db[_0x4aed('0x5a')][_0x4aed('0x41')](_0x20a88e)['then'](handleEntityNotFound(_0x2f333d,null))[_0x4aed('0x26')](function(_0xbd00da){if(_0xbd00da){_0x3a2423=_0xbd00da;return db[_0x4aed('0x67')][_0x4aed('0x41')]({'where':{'SessionId':{'$in':_[_0x4aed('0x2d')](_0x3a2423,'id')},'ProjectId':_0x227adf['params']['id']},'order':_0x4aed('0x68')});}})[_0x4aed('0x26')](handleEntityNotFound(_0x2f333d,null))[_0x4aed('0x26')](function(_0x21366e){if(_0x21366e){_0x19a743=_0x21366e;var _0x364762={};for(var _0x17ba93=0x0,_0x538ff5=_0x19a743[_0x4aed('0x38')];_0x17ba93<_0x538ff5;_0x17ba93++){if(!_0x364762[_0x4aed('0x39')](_0x19a743[_0x17ba93][_0x4aed('0x69')])){_0x364762[_0x19a743[_0x17ba93][_0x4aed('0x69')]]=needsEncapsulation(_0x19a743[_0x17ba93][_0x4aed('0x6a')])?encapsulate(_0x19a743[_0x17ba93][_0x4aed('0x6a')]):_0x19a743[_0x17ba93][_0x4aed('0x6a')];}}var _0x8b567f=[],_0x23db7d={};for(var _0xeec258=0x0,_0x20bb88=_0x3a2423[_0x4aed('0x38')];_0xeec258<_0x20bb88;_0xeec258++){_0x23db7d={'ProjectId':_0x227adf[_0x4aed('0x57')]['id'],'SessionId':_0x3a2423[_0xeec258]['id'],'StartTime':moment(_0x3a2423[_0xeec258][_0x4aed('0x6b')])[_0x4aed('0x6c')](_0x4aed('0x6d'))};for(var _0x5a31b4=0x0,_0x3ce26d=_0x19a743[_0x4aed('0x38')];_0x5a31b4<_0x3ce26d;_0x5a31b4++){if(_0x19a743[_0x5a31b4][_0x4aed('0x6e')]==_0x3a2423[_0xeec258]['id']&&_0x364762['hasOwnProperty'](_0x19a743[_0x5a31b4][_0x4aed('0x69')])){_0x23db7d[_0x364762[_0x19a743[_0x5a31b4][_0x4aed('0x69')]]]=_0x19a743[_0x5a31b4][_0x4aed('0x6f')];}}for(var _0x14304e in _0x364762){if(!_0x23db7d['hasOwnProperty'](_0x364762[_0x14304e])){_0x23db7d[_0x364762[_0x14304e]]=null;}}_0x8b567f[_0x4aed('0x70')](_0x23db7d);}return _0x8b567f;}})['then'](function(_0x4cbc78){if(!_[_0x4aed('0x71')](_0x4cbc78)){var _0x307c99=toCsv(_0x4cbc78);var _0xab7e2d=Date[_0x4aed('0x72')]();fs['writeFileSync'](util[_0x4aed('0x6c')](_0x4aed('0x73'),_0x227adf[_0x4aed('0x57')]['id'],_0xab7e2d),_0x307c99);_0x2f333d[_0x4aed('0x74')](_0x4aed('0x75'),'attachment;\x20filename='+util['format']('Jscripty_Project_%d_Summary_%s.csv',_0x227adf[_0x4aed('0x57')]['id'],_0xab7e2d));_0x2f333d[_0x4aed('0x74')](_0x4aed('0x76'),_0x4aed('0x77'));return _0x2f333d[_0x4aed('0x78')](util['format'](_0x4aed('0x73'),_0x227adf[_0x4aed('0x57')]['id'],_0xab7e2d));}else{return _0x2f333d['sendStatus'](0xcc);}})[_0x4aed('0x4d')](handleError(_0x2f333d,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 98a3aa7..768f01a 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 _0x89c3=['exports','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x60b245,_0xa99bae){var _0x928472=function(_0x4365c6){while(--_0x4365c6){_0x60b245['push'](_0x60b245['shift']());}};_0x928472(++_0xa99bae);}(_0x89c3,0xff));var _0x389c=function(_0x372f8d,_0xaf56ae){_0x372f8d=_0x372f8d-0x0;var _0x4267f1=_0x89c3[_0x372f8d];return _0x4267f1;};'use strict';var _=require(_0x389c('0x0'));var util=require(_0x389c('0x1'));var logger=require(_0x389c('0x2'))(_0x389c('0x3'));var moment=require(_0x389c('0x4'));var BPromise=require(_0x389c('0x5'));var rp=require(_0x389c('0x6'));var fs=require('fs');var path=require(_0x389c('0x7'));var rimraf=require('rimraf');var config=require(_0x389c('0x8'));var attributes=require('./jscriptyProject.attributes');module[_0x389c('0x9')]=function(_0x4bece6,_0x51f5f5){return _0x4bece6[_0x389c('0xa')]('JscriptyProject',attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3f1c=['JscriptyProject','jscripty_projects','lodash','api','request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes','define'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x3f1c,0xd4));var _0xc3f1=function(_0x162ebd,_0x487377){_0x162ebd=_0x162ebd-0x0;var _0x4d8947=_0x3f1c[_0x162ebd];return _0x4d8947;};'use strict';var _=require(_0xc3f1('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc3f1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc3f1('0x2'));var fs=require('fs');var path=require(_0xc3f1('0x3'));var rimraf=require(_0xc3f1('0x4'));var config=require(_0xc3f1('0x5'));var attributes=require(_0xc3f1('0x6'));module['exports']=function(_0x12e78a,_0x4ebd4c){return _0x12e78a[_0xc3f1('0x7')](_0xc3f1('0x8'),attributes,{'tableName':_0xc3f1('0x9'),'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 c5e5db8..c0253b9 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 _0xac4a=['JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xac4a,0x13f));var _0xaac4=function(_0x1ebdb7,_0x59fa85){_0x1ebdb7=_0x1ebdb7-0x0;var _0x176286=_0xac4a[_0x1ebdb7];return _0x176286;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file +var _0xac4a=['JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xac4a,0x13f));var _0xaac4=function(_0x5b69b0,_0x189e05){_0x5b69b0=_0x5b69b0-0x0;var _0x1d73ca=_0xac4a[_0x5b69b0];return _0x1d73ca;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 37a38b3..c4bc7f0 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 _0xc16c=['../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','index','get','/describe','isAuthenticated','describe','/:id','show','create','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra'];(function(_0x3eec1a,_0x28a1af){var _0x50ac15=function(_0x470954){while(--_0x470954){_0x3eec1a['push'](_0x3eec1a['shift']());}};_0x50ac15(++_0x28a1af);}(_0xc16c,0x121));var _0xcc16=function(_0x252983,_0x6de0da){_0x252983=_0x252983-0x0;var _0x3df207=_0xc16c[_0x252983];return _0x3df207;};'use strict';var multer=require('multer');var util=require(_0xcc16('0x0'));var path=require(_0xcc16('0x1'));var timeout=require(_0xcc16('0x2'));var express=require(_0xcc16('0x3'));var router=express['Router']();var fs_extra=require(_0xcc16('0x4'));var auth=require(_0xcc16('0x5'));var interaction=require(_0xcc16('0x6'));var config=require(_0xcc16('0x7'));var controller=require(_0xcc16('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xcc16('0x9')]);router[_0xcc16('0xa')](_0xcc16('0xb'),auth[_0xcc16('0xc')](),controller[_0xcc16('0xd')]);router[_0xcc16('0xa')](_0xcc16('0xe'),auth[_0xcc16('0xc')](),controller[_0xcc16('0xf')]);router['post']('/',auth[_0xcc16('0xc')](),controller[_0xcc16('0x10')]);router['put'](_0xcc16('0xe'),auth[_0xcc16('0xc')](),controller[_0xcc16('0x11')]);router[_0xcc16('0x12')](_0xcc16('0xe'),auth[_0xcc16('0xc')](),controller[_0xcc16('0x13')]);module[_0xcc16('0x14')]=router; \ No newline at end of file +var _0x4e14=['show','create','put','/:id','update','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index'];(function(_0x131b08,_0x4c2f04){var _0x43a2c4=function(_0x57329a){while(--_0x57329a){_0x131b08['push'](_0x131b08['shift']());}};_0x43a2c4(++_0x4c2f04);}(_0x4e14,0xf4));var _0x44e1=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4e14[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0x44e1('0x0'));var path=require(_0x44e1('0x1'));var timeout=require(_0x44e1('0x2'));var express=require(_0x44e1('0x3'));var router=express[_0x44e1('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x44e1('0x5'));var config=require(_0x44e1('0x6'));var controller=require(_0x44e1('0x7'));router[_0x44e1('0x8')]('/',auth[_0x44e1('0x9')](),controller[_0x44e1('0xa')]);router['get']('/describe',auth[_0x44e1('0x9')](),controller['describe']);router[_0x44e1('0x8')]('/:id',auth[_0x44e1('0x9')](),controller[_0x44e1('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x44e1('0xc')]);router[_0x44e1('0xd')](_0x44e1('0xe'),auth[_0x44e1('0x9')](),controller[_0x44e1('0xf')]);router['delete'](_0x44e1('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x44e1('0x10')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 7b51d2b..7b671ef 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(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x7a54,0x106));var _0x47a5=function(_0x503f31,_0x244346){_0x503f31=_0x503f31-0x0;var _0x4a08e0=_0x7a54[_0x503f31];return _0x4a08e0;};'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(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x7a54,0x106));var _0x47a5=function(_0x46b9dd,_0xca3b0a){_0x46b9dd=_0x46b9dd-0x0;var _0x11ddad=_0x7a54[_0x46b9dd];return _0x11ddad;};'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 b6c3d76..a146f08 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 _0xd3dd=['order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','rawAttributes','intersection','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','apply','reject','save','then','destroy','error','stack','name','index','map','JscriptyQuestionReport','fieldName','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x447b84,_0x368591){var _0x492d68=function(_0x3afdde){while(--_0x3afdde){_0x447b84['push'](_0x447b84['shift']());}};_0x492d68(++_0x368591);}(_0xd3dd,0xad));var _0xdd3d=function(_0x1c3c83,_0x80c101){_0x1c3c83=_0x1c3c83-0x0;var _0x1d747e=_0xd3dd[_0x1c3c83];return _0x1d747e;};'use strict';var emlformat=require(_0xdd3d('0x0'));var rimraf=require(_0xdd3d('0x1'));var zipdir=require(_0xdd3d('0x2'));var jsonpatch=require(_0xdd3d('0x3'));var rp=require(_0xdd3d('0x4'));var moment=require(_0xdd3d('0x5'));var BPromise=require(_0xdd3d('0x6'));var Mustache=require('mustache');var util=require(_0xdd3d('0x7'));var path=require('path');var sox=require(_0xdd3d('0x8'));var csv=require(_0xdd3d('0x9'));var ejs=require(_0xdd3d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdd3d('0xb'));var squel=require(_0xdd3d('0xc'));var crypto=require(_0xdd3d('0xd'));var jsforce=require(_0xdd3d('0xe'));var deskjs=require(_0xdd3d('0xf'));var toCsv=require(_0xdd3d('0x9'));var querystring=require('querystring');var Papa=require(_0xdd3d('0x10'));var Redis=require(_0xdd3d('0x11'));var authService=require(_0xdd3d('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xdd3d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xdd3d('0x14'));var utils=require(_0xdd3d('0x15'));var config=require(_0xdd3d('0x16'));var licenseUtil=require(_0xdd3d('0x17'));var db=require(_0xdd3d('0x18'))['db'];function respondWithStatusCode(_0x3c51c0,_0x12c844){_0x12c844=_0x12c844||0xcc;return function(_0xa06658){if(_0xa06658){return _0x3c51c0[_0xdd3d('0x19')](_0x12c844);}return _0x3c51c0[_0xdd3d('0x1a')](_0x12c844)[_0xdd3d('0x1b')]();};}function respondWithResult(_0x56ab70,_0x50868d){_0x50868d=_0x50868d||0xc8;return function(_0x12b685){if(_0x12b685){return _0x56ab70[_0xdd3d('0x1a')](_0x50868d)[_0xdd3d('0x1c')](_0x12b685);}};}function respondWithFilteredResult(_0x2918b1,_0xc6b9a3){return function(_0xed99a9){if(_0xed99a9){var _0x4edf3a=typeof _0xc6b9a3[_0xdd3d('0x1d')]===_0xdd3d('0x1e')&&typeof _0xc6b9a3[_0xdd3d('0x1f')]==='undefined';var _0x3ce384=_0xed99a9['count'];var _0x26edb6=_0x4edf3a?0x0:_0xc6b9a3[_0xdd3d('0x1d')];var _0x577acd=_0x4edf3a?_0xed99a9['count']:_0xc6b9a3[_0xdd3d('0x1d')]+_0xc6b9a3[_0xdd3d('0x1f')];var _0x420b20;if(_0x577acd>=_0x3ce384){_0x577acd=_0x3ce384;_0x420b20=0xc8;}else{_0x420b20=0xce;}_0x2918b1[_0xdd3d('0x1a')](_0x420b20);return _0x2918b1[_0xdd3d('0x20')]('Content-Range',_0x26edb6+'-'+_0x577acd+'/'+_0x3ce384)[_0xdd3d('0x1c')](_0xed99a9);}return null;};}function patchUpdates(_0x4fa2bf){return function(_0x45beec){try{jsonpatch[_0xdd3d('0x21')](_0x45beec,_0x4fa2bf,!![]);}catch(_0x386ebb){return BPromise[_0xdd3d('0x22')](_0x386ebb);}return _0x45beec[_0xdd3d('0x23')]();};}function saveUpdates(_0x164a2d,_0x2e329a){return function(_0x44c2da){if(_0x44c2da){return _0x44c2da['update'](_0x164a2d)[_0xdd3d('0x24')](function(_0x31bff5){return _0x31bff5;});}return null;};}function removeEntity(_0x33cf61,_0xabba67){return function(_0xb0eeb3){if(_0xb0eeb3){return _0xb0eeb3[_0xdd3d('0x25')]()[_0xdd3d('0x24')](function(){_0x33cf61[_0xdd3d('0x1a')](0xcc)[_0xdd3d('0x1b')]();});}};}function handleEntityNotFound(_0x178e7d,_0x90e4de){return function(_0x3388da){if(!_0x3388da){_0x178e7d['sendStatus'](0x194);}return _0x3388da;};}function handleError(_0xd7f531,_0x584d5e){_0x584d5e=_0x584d5e||0x1f4;return function(_0xaeee37){logger[_0xdd3d('0x26')](_0xaeee37[_0xdd3d('0x27')]);if(_0xaeee37[_0xdd3d('0x28')]){delete _0xaeee37[_0xdd3d('0x28')];}_0xd7f531[_0xdd3d('0x1a')](_0x584d5e)['send'](_0xaeee37);};}exports[_0xdd3d('0x29')]=function(_0x4d03e0,_0x2cbd9c){var _0x10409d={},_0x2862be={},_0x1d86f1={'count':0x0,'rows':[]};var _0x4104b0=_[_0xdd3d('0x2a')](db[_0xdd3d('0x2b')]['rawAttributes'],function(_0xf991b8){return{'name':_0xf991b8[_0xdd3d('0x2c')],'type':_0xf991b8[_0xdd3d('0x2d')]['key']};});_0x2862be[_0xdd3d('0x2e')]=_[_0xdd3d('0x2a')](_0x4104b0,'name');_0x2862be[_0xdd3d('0x2f')]=_[_0xdd3d('0x30')](_0x4d03e0[_0xdd3d('0x2f')]);_0x2862be[_0xdd3d('0x31')]=_['intersection'](_0x2862be[_0xdd3d('0x2e')],_0x2862be[_0xdd3d('0x2f')]);_0x10409d[_0xdd3d('0x32')]=_['intersection'](_0x2862be[_0xdd3d('0x2e')],qs['fields'](_0x4d03e0[_0xdd3d('0x2f')][_0xdd3d('0x33')]));_0x10409d[_0xdd3d('0x32')]=_0x10409d[_0xdd3d('0x32')][_0xdd3d('0x34')]?_0x10409d['attributes']:_0x2862be[_0xdd3d('0x2e')];if(!_0x4d03e0[_0xdd3d('0x2f')][_0xdd3d('0x35')](_0xdd3d('0x36'))){_0x10409d['limit']=qs['limit'](_0x4d03e0[_0xdd3d('0x2f')][_0xdd3d('0x1f')]);_0x10409d['offset']=qs[_0xdd3d('0x1d')](_0x4d03e0['query'][_0xdd3d('0x1d')]);}_0x10409d[_0xdd3d('0x37')]=qs[_0xdd3d('0x38')](_0x4d03e0[_0xdd3d('0x2f')][_0xdd3d('0x38')]);_0x10409d[_0xdd3d('0x39')]=qs[_0xdd3d('0x31')](_[_0xdd3d('0x3a')](_0x4d03e0[_0xdd3d('0x2f')],_0x2862be['filters']),_0x4104b0);if(_0x4d03e0[_0xdd3d('0x2f')][_0xdd3d('0x3b')]){_0x10409d[_0xdd3d('0x39')]=_[_0xdd3d('0x3c')](_0x10409d['where'],{'$or':_['map'](_0x4104b0,function(_0x391337){if(_0x391337[_0xdd3d('0x2d')]!==_0xdd3d('0x3d')){var _0x4b3d04={};_0x4b3d04[_0x391337['name']]={'$like':'%'+_0x4d03e0['query'][_0xdd3d('0x3b')]+'%'};return _0x4b3d04;}})});}_0x10409d=_['merge']({},_0x10409d,_0x4d03e0[_0xdd3d('0x3e')]);var _0x148861={'where':_0x10409d[_0xdd3d('0x39')]};return db['JscriptyQuestionReport'][_0xdd3d('0x3f')](_0x148861)['then'](function(_0x5bc5be){_0x1d86f1['count']=_0x5bc5be;if(_0x4d03e0['query'][_0xdd3d('0x40')]){_0x10409d[_0xdd3d('0x41')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xdd3d('0x42')](_0x10409d);})[_0xdd3d('0x24')](function(_0x233993){_0x1d86f1[_0xdd3d('0x43')]=_0x233993;return _0x1d86f1;})[_0xdd3d('0x24')](respondWithFilteredResult(_0x2cbd9c,_0x10409d))[_0xdd3d('0x44')](handleError(_0x2cbd9c,null));};exports['show']=function(_0xf1ac93,_0x55a0fe){var _0x43c5d8={'raw':!![],'where':{'id':_0xf1ac93[_0xdd3d('0x45')]['id']}},_0x68debd={};_0x68debd[_0xdd3d('0x2e')]=_['keys'](db[_0xdd3d('0x2b')][_0xdd3d('0x46')]);_0x68debd[_0xdd3d('0x2f')]=_[_0xdd3d('0x30')](_0xf1ac93['query']);_0x68debd[_0xdd3d('0x31')]=_[_0xdd3d('0x47')](_0x68debd[_0xdd3d('0x2e')],_0x68debd['query']);_0x43c5d8[_0xdd3d('0x32')]=_[_0xdd3d('0x47')](_0x68debd[_0xdd3d('0x2e')],qs[_0xdd3d('0x33')](_0xf1ac93[_0xdd3d('0x2f')]['fields']));_0x43c5d8['attributes']=_0x43c5d8[_0xdd3d('0x32')][_0xdd3d('0x34')]?_0x43c5d8[_0xdd3d('0x32')]:_0x68debd[_0xdd3d('0x2e')];if(_0xf1ac93['query'][_0xdd3d('0x40')]){_0x43c5d8['include']=[{'all':!![]}];}_0x43c5d8=_[_0xdd3d('0x3c')]({},_0x43c5d8,_0xf1ac93[_0xdd3d('0x3e')]);return db['JscriptyQuestionReport']['find'](_0x43c5d8)[_0xdd3d('0x24')](handleEntityNotFound(_0x55a0fe,null))[_0xdd3d('0x24')](respondWithResult(_0x55a0fe,null))[_0xdd3d('0x44')](handleError(_0x55a0fe,null));};exports[_0xdd3d('0x48')]=function(_0x33224b,_0x5eabb4){return db[_0xdd3d('0x2b')][_0xdd3d('0x48')](_0x33224b[_0xdd3d('0x49')],{})[_0xdd3d('0x24')](respondWithResult(_0x5eabb4,0xc9))[_0xdd3d('0x44')](handleError(_0x5eabb4,null));};exports['update']=function(_0x5c6171,_0x2d73bd){if(_0x5c6171[_0xdd3d('0x49')]['id']){delete _0x5c6171[_0xdd3d('0x49')]['id'];}return db[_0xdd3d('0x2b')]['find']({'where':{'id':_0x5c6171[_0xdd3d('0x45')]['id']}})[_0xdd3d('0x24')](handleEntityNotFound(_0x2d73bd,null))[_0xdd3d('0x24')](saveUpdates(_0x5c6171[_0xdd3d('0x49')],null))[_0xdd3d('0x24')](respondWithResult(_0x2d73bd,null))['catch'](handleError(_0x2d73bd,null));};exports[_0xdd3d('0x25')]=function(_0xe900b5,_0x24d207){return db['JscriptyQuestionReport'][_0xdd3d('0x4a')]({'where':{'id':_0xe900b5[_0xdd3d('0x45')]['id']}})[_0xdd3d('0x24')](handleEntityNotFound(_0x24d207,null))[_0xdd3d('0x24')](removeEntity(_0x24d207,null))[_0xdd3d('0x44')](handleError(_0x24d207,null));};exports[_0xdd3d('0x4b')]=function(_0x13e149,_0x46c7f2){return db[_0xdd3d('0x2b')][_0xdd3d('0x4b')]()[_0xdd3d('0x24')](respondWithResult(_0x46c7f2,null))[_0xdd3d('0x44')](handleError(_0x46c7f2,null));}; \ No newline at end of file +var _0x3ae9=['reject','update','then','destroy','error','name','map','JscriptyQuestionReport','rawAttributes','fieldName','keys','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','fields','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','limit','count','offset','status','set','Content-Range','apply'];(function(_0xdf7367,_0x5c7f4a){var _0x3c17ae=function(_0x284f1f){while(--_0x284f1f){_0xdf7367['push'](_0xdf7367['shift']());}};_0x3c17ae(++_0x5c7f4a);}(_0x3ae9,0xb3));var _0x93ae=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x3ae9[_0x2763f2];return _0x3ef471;};'use strict';var emlformat=require(_0x93ae('0x0'));var rimraf=require(_0x93ae('0x1'));var zipdir=require(_0x93ae('0x2'));var jsonpatch=require(_0x93ae('0x3'));var rp=require('request-promise');var moment=require(_0x93ae('0x4'));var BPromise=require(_0x93ae('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x93ae('0x6'));var sox=require(_0x93ae('0x7'));var csv=require(_0x93ae('0x8'));var ejs=require(_0x93ae('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x93ae('0xa'));var crypto=require(_0x93ae('0xb'));var jsforce=require(_0x93ae('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x93ae('0x8'));var querystring=require(_0x93ae('0xd'));var Papa=require(_0x93ae('0xe'));var Redis=require(_0x93ae('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x93ae('0x10'));var as=require(_0x93ae('0x11'));var hardwareService=require(_0x93ae('0x12'));var logger=require(_0x93ae('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x93ae('0x14'));var licenseUtil=require(_0x93ae('0x15'));var db=require(_0x93ae('0x16'))['db'];function respondWithStatusCode(_0x2d48b8,_0x3a07f8){_0x3a07f8=_0x3a07f8||0xcc;return function(_0x1986d8){if(_0x1986d8){return _0x2d48b8[_0x93ae('0x17')](_0x3a07f8);}return _0x2d48b8['status'](_0x3a07f8)[_0x93ae('0x18')]();};}function respondWithResult(_0x4915fd,_0x3c9a3e){_0x3c9a3e=_0x3c9a3e||0xc8;return function(_0x12f31e){if(_0x12f31e){return _0x4915fd['status'](_0x3c9a3e)[_0x93ae('0x19')](_0x12f31e);}};}function respondWithFilteredResult(_0x58b878,_0x5b86fe){return function(_0x5289b1){if(_0x5289b1){var _0x59661b=typeof _0x5b86fe['offset']===_0x93ae('0x1a')&&typeof _0x5b86fe[_0x93ae('0x1b')]===_0x93ae('0x1a');var _0x3671ee=_0x5289b1[_0x93ae('0x1c')];var _0x494f02=_0x59661b?0x0:_0x5b86fe[_0x93ae('0x1d')];var _0x12d659=_0x59661b?_0x5289b1[_0x93ae('0x1c')]:_0x5b86fe[_0x93ae('0x1d')]+_0x5b86fe[_0x93ae('0x1b')];var _0x519f25;if(_0x12d659>=_0x3671ee){_0x12d659=_0x3671ee;_0x519f25=0xc8;}else{_0x519f25=0xce;}_0x58b878[_0x93ae('0x1e')](_0x519f25);return _0x58b878[_0x93ae('0x1f')](_0x93ae('0x20'),_0x494f02+'-'+_0x12d659+'/'+_0x3671ee)[_0x93ae('0x19')](_0x5289b1);}return null;};}function patchUpdates(_0x338d0b){return function(_0x44272b){try{jsonpatch[_0x93ae('0x21')](_0x44272b,_0x338d0b,!![]);}catch(_0x342818){return BPromise[_0x93ae('0x22')](_0x342818);}return _0x44272b['save']();};}function saveUpdates(_0x212f88,_0x461f71){return function(_0x4cf8d2){if(_0x4cf8d2){return _0x4cf8d2[_0x93ae('0x23')](_0x212f88)[_0x93ae('0x24')](function(_0x3662f8){return _0x3662f8;});}return null;};}function removeEntity(_0x31cbc0,_0x355094){return function(_0x1e94b6){if(_0x1e94b6){return _0x1e94b6[_0x93ae('0x25')]()[_0x93ae('0x24')](function(){_0x31cbc0[_0x93ae('0x1e')](0xcc)[_0x93ae('0x18')]();});}};}function handleEntityNotFound(_0xc58a3b,_0x29830a){return function(_0x49dd70){if(!_0x49dd70){_0xc58a3b[_0x93ae('0x17')](0x194);}return _0x49dd70;};}function handleError(_0x6d0b5c,_0x1004e2){_0x1004e2=_0x1004e2||0x1f4;return function(_0x17e961){logger[_0x93ae('0x26')](_0x17e961['stack']);if(_0x17e961[_0x93ae('0x27')]){delete _0x17e961['name'];}_0x6d0b5c['status'](_0x1004e2)['send'](_0x17e961);};}exports['index']=function(_0x1de872,_0xb379c0){var _0x52e7b4={},_0x1761c8={},_0x2c6e1b={'count':0x0,'rows':[]};var _0x128db3=_[_0x93ae('0x28')](db[_0x93ae('0x29')][_0x93ae('0x2a')],function(_0x5354eb){return{'name':_0x5354eb[_0x93ae('0x2b')],'type':_0x5354eb['type']['key']};});_0x1761c8['model']=_[_0x93ae('0x28')](_0x128db3,'name');_0x1761c8['query']=_[_0x93ae('0x2c')](_0x1de872[_0x93ae('0x2d')]);_0x1761c8[_0x93ae('0x2e')]=_[_0x93ae('0x2f')](_0x1761c8[_0x93ae('0x30')],_0x1761c8[_0x93ae('0x2d')]);_0x52e7b4[_0x93ae('0x31')]=_[_0x93ae('0x2f')](_0x1761c8[_0x93ae('0x30')],qs['fields'](_0x1de872[_0x93ae('0x2d')]['fields']));_0x52e7b4[_0x93ae('0x31')]=_0x52e7b4[_0x93ae('0x31')][_0x93ae('0x32')]?_0x52e7b4[_0x93ae('0x31')]:_0x1761c8['model'];if(!_0x1de872[_0x93ae('0x2d')][_0x93ae('0x33')](_0x93ae('0x34'))){_0x52e7b4['limit']=qs[_0x93ae('0x1b')](_0x1de872[_0x93ae('0x2d')]['limit']);_0x52e7b4[_0x93ae('0x1d')]=qs[_0x93ae('0x1d')](_0x1de872[_0x93ae('0x2d')][_0x93ae('0x1d')]);}_0x52e7b4[_0x93ae('0x35')]=qs['sort'](_0x1de872['query'][_0x93ae('0x36')]);_0x52e7b4['where']=qs['filters'](_['pick'](_0x1de872[_0x93ae('0x2d')],_0x1761c8[_0x93ae('0x2e')]),_0x128db3);if(_0x1de872[_0x93ae('0x2d')]['filter']){_0x52e7b4['where']=_[_0x93ae('0x37')](_0x52e7b4['where'],{'$or':_[_0x93ae('0x28')](_0x128db3,function(_0x21e85b){if(_0x21e85b['type']!==_0x93ae('0x38')){var _0x2b04bb={};_0x2b04bb[_0x21e85b['name']]={'$like':'%'+_0x1de872[_0x93ae('0x2d')][_0x93ae('0x39')]+'%'};return _0x2b04bb;}})});}_0x52e7b4=_[_0x93ae('0x37')]({},_0x52e7b4,_0x1de872[_0x93ae('0x3a')]);var _0x488283={'where':_0x52e7b4['where']};return db[_0x93ae('0x29')]['count'](_0x488283)[_0x93ae('0x24')](function(_0x5c6fb8){_0x2c6e1b[_0x93ae('0x1c')]=_0x5c6fb8;if(_0x1de872[_0x93ae('0x2d')][_0x93ae('0x3b')]){_0x52e7b4[_0x93ae('0x3c')]=[{'all':!![]}];}return db[_0x93ae('0x29')][_0x93ae('0x3d')](_0x52e7b4);})[_0x93ae('0x24')](function(_0x1594a2){_0x2c6e1b[_0x93ae('0x3e')]=_0x1594a2;return _0x2c6e1b;})[_0x93ae('0x24')](respondWithFilteredResult(_0xb379c0,_0x52e7b4))[_0x93ae('0x3f')](handleError(_0xb379c0,null));};exports[_0x93ae('0x40')]=function(_0x277daa,_0x3247db){var _0x1d7b4c={'raw':!![],'where':{'id':_0x277daa['params']['id']}},_0x561bb6={};_0x561bb6[_0x93ae('0x30')]=_[_0x93ae('0x2c')](db['JscriptyQuestionReport'][_0x93ae('0x2a')]);_0x561bb6['query']=_[_0x93ae('0x2c')](_0x277daa[_0x93ae('0x2d')]);_0x561bb6['filters']=_['intersection'](_0x561bb6['model'],_0x561bb6['query']);_0x1d7b4c[_0x93ae('0x31')]=_[_0x93ae('0x2f')](_0x561bb6[_0x93ae('0x30')],qs[_0x93ae('0x41')](_0x277daa[_0x93ae('0x2d')][_0x93ae('0x41')]));_0x1d7b4c['attributes']=_0x1d7b4c['attributes']['length']?_0x1d7b4c[_0x93ae('0x31')]:_0x561bb6[_0x93ae('0x30')];if(_0x277daa[_0x93ae('0x2d')][_0x93ae('0x3b')]){_0x1d7b4c[_0x93ae('0x3c')]=[{'all':!![]}];}_0x1d7b4c=_['merge']({},_0x1d7b4c,_0x277daa[_0x93ae('0x3a')]);return db['JscriptyQuestionReport'][_0x93ae('0x42')](_0x1d7b4c)[_0x93ae('0x24')](handleEntityNotFound(_0x3247db,null))['then'](respondWithResult(_0x3247db,null))[_0x93ae('0x3f')](handleError(_0x3247db,null));};exports['create']=function(_0x986ffd,_0x394283){return db[_0x93ae('0x29')][_0x93ae('0x43')](_0x986ffd[_0x93ae('0x44')],{})[_0x93ae('0x24')](respondWithResult(_0x394283,0xc9))[_0x93ae('0x3f')](handleError(_0x394283,null));};exports[_0x93ae('0x23')]=function(_0x4b627f,_0x20b8f9){if(_0x4b627f[_0x93ae('0x44')]['id']){delete _0x4b627f[_0x93ae('0x44')]['id'];}return db[_0x93ae('0x29')][_0x93ae('0x42')]({'where':{'id':_0x4b627f[_0x93ae('0x45')]['id']}})[_0x93ae('0x24')](handleEntityNotFound(_0x20b8f9,null))[_0x93ae('0x24')](saveUpdates(_0x4b627f[_0x93ae('0x44')],null))['then'](respondWithResult(_0x20b8f9,null))[_0x93ae('0x3f')](handleError(_0x20b8f9,null));};exports[_0x93ae('0x25')]=function(_0x5117ad,_0x142d6a){return db[_0x93ae('0x29')]['find']({'where':{'id':_0x5117ad[_0x93ae('0x45')]['id']}})[_0x93ae('0x24')](handleEntityNotFound(_0x142d6a,null))[_0x93ae('0x24')](removeEntity(_0x142d6a,null))[_0x93ae('0x3f')](handleError(_0x142d6a,null));};exports[_0x93ae('0x46')]=function(_0x588ac2,_0x25a934){return db['JscriptyQuestionReport'][_0x93ae('0x46')]()[_0x93ae('0x24')](respondWithResult(_0x25a934,null))[_0x93ae('0x3f')](handleError(_0x25a934,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 6414525..d348bc7 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 _0x07a8=['JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports'];(function(_0x250e00,_0x587cd6){var _0x4d9898=function(_0x4bda0a){while(--_0x4bda0a){_0x250e00['push'](_0x250e00['shift']());}};_0x4d9898(++_0x587cd6);}(_0x07a8,0x17b));var _0x807a=function(_0x894dcb,_0x3727ca){_0x894dcb=_0x894dcb-0x0;var _0x54f5c6=_0x07a8[_0x894dcb];return _0x54f5c6;};'use strict';var _=require(_0x807a('0x0'));var util=require(_0x807a('0x1'));var logger=require(_0x807a('0x2'))(_0x807a('0x3'));var moment=require(_0x807a('0x4'));var BPromise=require(_0x807a('0x5'));var rp=require(_0x807a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x807a('0x7'));var config=require(_0x807a('0x8'));var attributes=require(_0x807a('0x9'));module[_0x807a('0xa')]=function(_0xbe5f03,_0x341a73){return _0xbe5f03['define'](_0x807a('0xb'),attributes,{'tableName':_0x807a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbb77=['request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','moment','bluebird'];(function(_0x184bfd,_0x34de3e){var _0x198366=function(_0x258b79){while(--_0x258b79){_0x184bfd['push'](_0x184bfd['shift']());}};_0x198366(++_0x34de3e);}(_0xbb77,0x187));var _0x7bb7=function(_0x4bb19e,_0x27ca5e){_0x4bb19e=_0x4bb19e-0x0;var _0x2430d8=_0xbb77[_0x4bb19e];return _0x2430d8;};'use strict';var _=require(_0x7bb7('0x0'));var util=require(_0x7bb7('0x1'));var logger=require(_0x7bb7('0x2'))('api');var moment=require(_0x7bb7('0x3'));var BPromise=require(_0x7bb7('0x4'));var rp=require(_0x7bb7('0x5'));var fs=require('fs');var path=require(_0x7bb7('0x6'));var rimraf=require(_0x7bb7('0x7'));var config=require(_0x7bb7('0x8'));var attributes=require(_0x7bb7('0x9'));module['exports']=function(_0x377fe7,_0x1ab6b4){return _0x377fe7['define'](_0x7bb7('0xa'),attributes,{'tableName':_0x7bb7('0xb'),'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 1ba9d8c..9ca7212 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 _0x53ad=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x1252a7,_0x242e76){var _0x4310ad=function(_0x2b803f){while(--_0x2b803f){_0x1252a7['push'](_0x1252a7['shift']());}};_0x4310ad(++_0x242e76);}(_0x53ad,0xa0));var _0xd53a=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x53ad[_0xae7c2f];return _0x5d7001;};'use strict';var _=require(_0xd53a('0x0'));var util=require('util');var moment=require(_0xd53a('0x1'));var BPromise=require(_0xd53a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd53a('0x3'));var db=require(_0xd53a('0x4'))['db'];var utils=require(_0xd53a('0x5'));var logger=require('../../config/logger')(_0xd53a('0x6'));var config=require('../../config/environment');var jayson=require(_0xd53a('0x7'));var client=jayson[_0xd53a('0x8')][_0xd53a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x20043c,_0x2c44af,_0x3b0426){return new BPromise(function(_0x95331f,_0x2993ec){return client[_0xd53a('0xa')](_0x20043c,_0x3b0426)[_0xd53a('0xb')](function(_0x46cd14){logger[_0xd53a('0xc')](_0xd53a('0xd'),_0x2c44af,_0xd53a('0xe'));logger[_0xd53a('0xf')](_0xd53a('0x10'),_0x2c44af,_0xd53a('0xe'),JSON[_0xd53a('0x11')](_0x46cd14));if(_0x46cd14[_0xd53a('0x12')]){if(_0x46cd14['error'][_0xd53a('0x13')]===0x1f4){logger['error'](_0xd53a('0xd'),_0x2c44af,_0x46cd14[_0xd53a('0x12')][_0xd53a('0x14')]);return _0x2993ec(_0x46cd14[_0xd53a('0x12')][_0xd53a('0x14')]);}logger[_0xd53a('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x2c44af,_0x46cd14['error']['message']);return _0x95331f(_0x46cd14[_0xd53a('0x12')][_0xd53a('0x14')]);}else{logger['info'](_0xd53a('0xd'),_0x2c44af,'request\x20sent');_0x95331f(_0x46cd14[_0xd53a('0x15')][_0xd53a('0x14')]);}})[_0xd53a('0x16')](function(_0xc6c2be){logger[_0xd53a('0x12')](_0xd53a('0xd'),_0x2c44af,_0xc6c2be);_0x2993ec(_0xc6c2be);});});} \ No newline at end of file +var _0xb281=['ioredis','../../config/logger','rpc','jayson/promise','client','http','request','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x280ff0,_0x5969c4){var _0x3494b6=function(_0x839e59){while(--_0x839e59){_0x280ff0['push'](_0x280ff0['shift']());}};_0x3494b6(++_0x5969c4);}(_0xb281,0x160));var _0x1b28=function(_0x564610,_0x4214bf){_0x564610=_0x564610-0x0;var _0x37f5d4=_0xb281[_0x564610];return _0x37f5d4;};'use strict';var _=require(_0x1b28('0x0'));var util=require(_0x1b28('0x1'));var moment=require(_0x1b28('0x2'));var BPromise=require(_0x1b28('0x3'));var rs=require(_0x1b28('0x4'));var fs=require('fs');var Redis=require(_0x1b28('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1b28('0x6'))(_0x1b28('0x7'));var config=require('../../config/environment');var jayson=require(_0x1b28('0x8'));var client=jayson[_0x1b28('0x9')][_0x1b28('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4509a1,_0x558083,_0x2f61aa){return new BPromise(function(_0x10ff5d,_0x1c7f7c){return client[_0x1b28('0xb')](_0x4509a1,_0x2f61aa)['then'](function(_0x38e2f7){logger[_0x1b28('0xc')](_0x1b28('0xd'),_0x558083,_0x1b28('0xe'));logger[_0x1b28('0xf')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x558083,_0x1b28('0xe'),JSON[_0x1b28('0x10')](_0x38e2f7));if(_0x38e2f7[_0x1b28('0x11')]){if(_0x38e2f7['error'][_0x1b28('0x12')]===0x1f4){logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x558083,_0x38e2f7[_0x1b28('0x11')]['message']);return _0x1c7f7c(_0x38e2f7[_0x1b28('0x11')][_0x1b28('0x13')]);}logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x558083,_0x38e2f7[_0x1b28('0x11')][_0x1b28('0x13')]);return _0x10ff5d(_0x38e2f7[_0x1b28('0x11')][_0x1b28('0x13')]);}else{logger[_0x1b28('0xc')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x558083,'request\x20sent');_0x10ff5d(_0x38e2f7['result'][_0x1b28('0x13')]);}})[_0x1b28('0x14')](function(_0x2264cf){logger[_0x1b28('0x11')](_0x1b28('0xd'),_0x558083,_0x2264cf);_0x1c7f7c(_0x2264cf);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index cbb6b6b..5188457 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 _0x0706=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','/:id/questions','getQuestions','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x82b961,_0x56d40b){var _0x32728d=function(_0x954c31){while(--_0x954c31){_0x82b961['push'](_0x82b961['shift']());}};_0x32728d(++_0x56d40b);}(_0x0706,0xef));var _0x6070=function(_0x14da2e,_0x1a8186){_0x14da2e=_0x14da2e-0x0;var _0x19459b=_0x0706[_0x14da2e];return _0x19459b;};'use strict';var multer=require(_0x6070('0x0'));var util=require(_0x6070('0x1'));var path=require(_0x6070('0x2'));var timeout=require('connect-timeout');var express=require(_0x6070('0x3'));var router=express[_0x6070('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6070('0x5'));var interaction=require(_0x6070('0x6'));var config=require(_0x6070('0x7'));var controller=require('./jscriptySessionReport.controller');router[_0x6070('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6070('0x8')](_0x6070('0x9'),auth[_0x6070('0xa')](),controller[_0x6070('0xb')]);router[_0x6070('0x8')](_0x6070('0xc'),auth[_0x6070('0xa')](),controller['show']);router[_0x6070('0x8')](_0x6070('0xd'),auth[_0x6070('0xa')](),controller[_0x6070('0xe')]);router[_0x6070('0xf')]('/',auth[_0x6070('0xa')](),controller[_0x6070('0x10')]);router[_0x6070('0x11')]('/:id',auth[_0x6070('0xa')](),controller[_0x6070('0x12')]);router[_0x6070('0x13')](_0x6070('0xc'),auth[_0x6070('0xa')](),controller[_0x6070('0x14')]);module[_0x6070('0x15')]=router; \ No newline at end of file +var _0xa004=['./jscriptySessionReport.controller','isAuthenticated','index','get','/describe','describe','show','/:id/questions','put','update','delete','multer','util','path','Router','fs-extra','../../components/interaction/service'];(function(_0x14194d,_0x2d8a50){var _0x29418e=function(_0x5234af){while(--_0x5234af){_0x14194d['push'](_0x14194d['shift']());}};_0x29418e(++_0x2d8a50);}(_0xa004,0x170));var _0x4a00=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa004[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x4a00('0x0'));var util=require(_0x4a00('0x1'));var path=require(_0x4a00('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4a00('0x3')]();var fs_extra=require(_0x4a00('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4a00('0x5'));var config=require('../../config/environment');var controller=require(_0x4a00('0x6'));router['get']('/',auth[_0x4a00('0x7')](),controller[_0x4a00('0x8')]);router[_0x4a00('0x9')](_0x4a00('0xa'),auth[_0x4a00('0x7')](),controller[_0x4a00('0xb')]);router[_0x4a00('0x9')]('/:id',auth[_0x4a00('0x7')](),controller[_0x4a00('0xc')]);router[_0x4a00('0x9')](_0x4a00('0xd'),auth[_0x4a00('0x7')](),controller['getQuestions']);router['post']('/',auth[_0x4a00('0x7')](),controller['create']);router[_0x4a00('0xe')]('/:id',auth[_0x4a00('0x7')](),controller[_0x4a00('0xf')]);router[_0x4a00('0x10')]('/:id',auth[_0x4a00('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 51aba4d..875244c 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 _0x0007=['YYYY-MM-DD\x20HH:mm:ss','DATE','STRING','BOOLEAN','moment','sequelize','exports','setDataValue','starttime','format'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x0007,0x1ee));var _0x7000=function(_0x2442dd,_0x269ded){_0x2442dd=_0x2442dd-0x0;var _0x9d4594=_0x0007[_0x2442dd];return _0x9d4594;};'use strict';var moment=require(_0x7000('0x0'));var Sequelize=require(_0x7000('0x1'));module[_0x7000('0x2')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x704959){this[_0x7000('0x3')](_0x7000('0x4'),_0x704959);this[_0x7000('0x3')]('endtime',moment()[_0x7000('0x5')](_0x7000('0x6')));}},'endtime':{'type':Sequelize[_0x7000('0x7')]},'membername':{'type':Sequelize[_0x7000('0x8')]},'projectname':{'type':Sequelize[_0x7000('0x8')]},'queue':{'type':Sequelize[_0x7000('0x8')]},'uniqueid':{'type':Sequelize[_0x7000('0x8')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x7000('0x8')]},'completed':{'type':Sequelize[_0x7000('0x9')],'defaultValue':![]}}; \ No newline at end of file +var _0xad6a=['format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','exports','DATE','setDataValue','starttime'];(function(_0x4fbe76,_0x1b7645){var _0x72a29b=function(_0x293702){while(--_0x293702){_0x4fbe76['push'](_0x4fbe76['shift']());}};_0x72a29b(++_0x1b7645);}(_0xad6a,0x112));var _0xaad6=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xad6a[_0x2c91e9];return _0x13f0ff;};'use strict';var moment=require(_0xaad6('0x0'));var Sequelize=require(_0xaad6('0x1'));module[_0xaad6('0x2')]={'starttime':{'type':Sequelize[_0xaad6('0x3')],'set':function(_0x5b47a1){this[_0xaad6('0x4')](_0xaad6('0x5'),_0x5b47a1);this[_0xaad6('0x4')]('endtime',moment()[_0xaad6('0x6')](_0xaad6('0x7')));}},'endtime':{'type':Sequelize[_0xaad6('0x3')]},'membername':{'type':Sequelize[_0xaad6('0x8')]},'projectname':{'type':Sequelize[_0xaad6('0x8')]},'queue':{'type':Sequelize[_0xaad6('0x8')]},'uniqueid':{'type':Sequelize[_0xaad6('0x8')]},'calleridname':{'type':Sequelize[_0xaad6('0x8')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0xaad6('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 43b6183..551c218 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 _0x5567=['fieldName','type','key','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','find','create','body','update','params','describe','getQuestions','JscriptyQuestionReport','sort','pick','SessionId','filter','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','destroy','then','error','stack','send','index','map','JscriptySessionReport'];(function(_0x54d285,_0x454de7){var _0x1cc0c5=function(_0x1ee50f){while(--_0x1ee50f){_0x54d285['push'](_0x54d285['shift']());}};_0x1cc0c5(++_0x454de7);}(_0x5567,0x11c));var _0x7556=function(_0x2bff66,_0x15e26d){_0x2bff66=_0x2bff66-0x0;var _0x57dee3=_0x5567[_0x2bff66];return _0x57dee3;};'use strict';var emlformat=require(_0x7556('0x0'));var rimraf=require(_0x7556('0x1'));var zipdir=require(_0x7556('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7556('0x3'));var moment=require(_0x7556('0x4'));var BPromise=require(_0x7556('0x5'));var Mustache=require(_0x7556('0x6'));var util=require('util');var path=require(_0x7556('0x7'));var sox=require(_0x7556('0x8'));var csv=require(_0x7556('0x9'));var ejs=require(_0x7556('0xa'));var fs=require('fs');var fs_extra=require(_0x7556('0xb'));var _=require('lodash');var squel=require(_0x7556('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7556('0xd'));var toCsv=require(_0x7556('0x9'));var querystring=require(_0x7556('0xe'));var Papa=require(_0x7556('0xf'));var Redis=require('ioredis');var authService=require(_0x7556('0x10'));var qs=require(_0x7556('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7556('0x12'));var logger=require(_0x7556('0x13'))(_0x7556('0x14'));var utils=require(_0x7556('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x7556('0x16'));var db=require(_0x7556('0x17'))['db'];function respondWithStatusCode(_0x3d897d,_0x4c4133){_0x4c4133=_0x4c4133||0xcc;return function(_0x531e79){if(_0x531e79){return _0x3d897d[_0x7556('0x18')](_0x4c4133);}return _0x3d897d[_0x7556('0x19')](_0x4c4133)[_0x7556('0x1a')]();};}function respondWithResult(_0x1d8e2f,_0x59bcb4){_0x59bcb4=_0x59bcb4||0xc8;return function(_0x44f7b2){if(_0x44f7b2){return _0x1d8e2f['status'](_0x59bcb4)[_0x7556('0x1b')](_0x44f7b2);}};}function respondWithFilteredResult(_0x5b20b4,_0x286851){return function(_0xee0b69){if(_0xee0b69){var _0x4af02b=typeof _0x286851['offset']===_0x7556('0x1c')&&typeof _0x286851[_0x7556('0x1d')]==='undefined';var _0x29c40e=_0xee0b69[_0x7556('0x1e')];var _0x1aaf80=_0x4af02b?0x0:_0x286851[_0x7556('0x1f')];var _0x3d85b6=_0x4af02b?_0xee0b69[_0x7556('0x1e')]:_0x286851['offset']+_0x286851['limit'];var _0x489f1e;if(_0x3d85b6>=_0x29c40e){_0x3d85b6=_0x29c40e;_0x489f1e=0xc8;}else{_0x489f1e=0xce;}_0x5b20b4['status'](_0x489f1e);return _0x5b20b4['set'](_0x7556('0x20'),_0x1aaf80+'-'+_0x3d85b6+'/'+_0x29c40e)['json'](_0xee0b69);}return null;};}function patchUpdates(_0x384b17){return function(_0x3f5c10){try{jsonpatch[_0x7556('0x21')](_0x3f5c10,_0x384b17,!![]);}catch(_0x4dd531){return BPromise[_0x7556('0x22')](_0x4dd531);}return _0x3f5c10[_0x7556('0x23')]();};}function saveUpdates(_0x1417eb,_0x43379a){return function(_0x53a35c){if(_0x53a35c){return _0x53a35c['update'](_0x1417eb)['then'](function(_0x1b8e32){return _0x1b8e32;});}return null;};}function removeEntity(_0x588b5d,_0x5bb572){return function(_0x1bb3bb){if(_0x1bb3bb){return _0x1bb3bb[_0x7556('0x24')]()[_0x7556('0x25')](function(){_0x588b5d[_0x7556('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a7097,_0x12c42a){return function(_0x446dd2){if(!_0x446dd2){_0x4a7097[_0x7556('0x18')](0x194);}return _0x446dd2;};}function handleError(_0x9ab9f9,_0x38750a){_0x38750a=_0x38750a||0x1f4;return function(_0xe859d3){logger[_0x7556('0x26')](_0xe859d3[_0x7556('0x27')]);if(_0xe859d3['name']){delete _0xe859d3['name'];}_0x9ab9f9[_0x7556('0x19')](_0x38750a)[_0x7556('0x28')](_0xe859d3);};}exports[_0x7556('0x29')]=function(_0x1e6823,_0x560eef){var _0x307d21={},_0x3fd5fd={},_0x265306={'count':0x0,'rows':[]};var _0x4025dd=_[_0x7556('0x2a')](db[_0x7556('0x2b')]['rawAttributes'],function(_0x3d395f){return{'name':_0x3d395f[_0x7556('0x2c')],'type':_0x3d395f[_0x7556('0x2d')][_0x7556('0x2e')]};});_0x3fd5fd[_0x7556('0x2f')]=_[_0x7556('0x2a')](_0x4025dd,_0x7556('0x30'));_0x3fd5fd[_0x7556('0x31')]=_['keys'](_0x1e6823[_0x7556('0x31')]);_0x3fd5fd[_0x7556('0x32')]=_[_0x7556('0x33')](_0x3fd5fd['model'],_0x3fd5fd[_0x7556('0x31')]);_0x307d21[_0x7556('0x34')]=_[_0x7556('0x33')](_0x3fd5fd[_0x7556('0x2f')],qs[_0x7556('0x35')](_0x1e6823[_0x7556('0x31')][_0x7556('0x35')]));_0x307d21[_0x7556('0x34')]=_0x307d21[_0x7556('0x34')][_0x7556('0x36')]?_0x307d21[_0x7556('0x34')]:_0x3fd5fd['model'];if(!_0x1e6823[_0x7556('0x31')][_0x7556('0x37')](_0x7556('0x38'))){_0x307d21[_0x7556('0x1d')]=qs[_0x7556('0x1d')](_0x1e6823[_0x7556('0x31')][_0x7556('0x1d')]);_0x307d21[_0x7556('0x1f')]=qs['offset'](_0x1e6823['query'][_0x7556('0x1f')]);}_0x307d21[_0x7556('0x39')]=qs['sort'](_0x1e6823[_0x7556('0x31')]['sort']);_0x307d21['where']=qs[_0x7556('0x32')](_['pick'](_0x1e6823[_0x7556('0x31')],_0x3fd5fd[_0x7556('0x32')]),_0x4025dd);if(_0x1e6823[_0x7556('0x31')]['filter']){_0x307d21[_0x7556('0x3a')]=_['merge'](_0x307d21[_0x7556('0x3a')],{'$or':_[_0x7556('0x2a')](_0x4025dd,function(_0x5a2783){if(_0x5a2783[_0x7556('0x2d')]!==_0x7556('0x3b')){var _0x2fd954={};_0x2fd954[_0x5a2783[_0x7556('0x30')]]={'$like':'%'+_0x1e6823['query']['filter']+'%'};return _0x2fd954;}})});}_0x307d21=_[_0x7556('0x3c')]({},_0x307d21,_0x1e6823[_0x7556('0x3d')]);var _0x2d84b2={'where':_0x307d21[_0x7556('0x3a')]};return db[_0x7556('0x2b')][_0x7556('0x1e')](_0x2d84b2)[_0x7556('0x25')](function(_0x26f4f2){_0x265306[_0x7556('0x1e')]=_0x26f4f2;if(_0x1e6823['query'][_0x7556('0x3e')]){_0x307d21[_0x7556('0x3f')]=[{'all':!![]}];}return db[_0x7556('0x2b')][_0x7556('0x40')](_0x307d21);})[_0x7556('0x25')](function(_0x39d3d1){_0x265306[_0x7556('0x41')]=_0x39d3d1;return _0x265306;})[_0x7556('0x25')](respondWithFilteredResult(_0x560eef,_0x307d21))[_0x7556('0x42')](handleError(_0x560eef,null));};exports[_0x7556('0x43')]=function(_0x5b29e1,_0x1a9332){var _0x1dd06b={'raw':!![],'where':{'id':_0x5b29e1['params']['id']}},_0x545f90={};_0x545f90[_0x7556('0x2f')]=_[_0x7556('0x44')](db[_0x7556('0x2b')][_0x7556('0x45')]);_0x545f90['query']=_[_0x7556('0x44')](_0x5b29e1[_0x7556('0x31')]);_0x545f90[_0x7556('0x32')]=_[_0x7556('0x33')](_0x545f90[_0x7556('0x2f')],_0x545f90[_0x7556('0x31')]);_0x1dd06b['attributes']=_[_0x7556('0x33')](_0x545f90[_0x7556('0x2f')],qs['fields'](_0x5b29e1[_0x7556('0x31')][_0x7556('0x35')]));_0x1dd06b[_0x7556('0x34')]=_0x1dd06b[_0x7556('0x34')]['length']?_0x1dd06b['attributes']:_0x545f90[_0x7556('0x2f')];if(_0x5b29e1[_0x7556('0x31')][_0x7556('0x3e')]){_0x1dd06b['include']=[{'all':!![]}];}_0x1dd06b=_['merge']({},_0x1dd06b,_0x5b29e1[_0x7556('0x3d')]);return db[_0x7556('0x2b')][_0x7556('0x46')](_0x1dd06b)[_0x7556('0x25')](handleEntityNotFound(_0x1a9332,null))[_0x7556('0x25')](respondWithResult(_0x1a9332,null))[_0x7556('0x42')](handleError(_0x1a9332,null));};exports[_0x7556('0x47')]=function(_0x4d290c,_0x3055f3){return db[_0x7556('0x2b')][_0x7556('0x47')](_0x4d290c[_0x7556('0x48')],{})[_0x7556('0x25')](respondWithResult(_0x3055f3,0xc9))['catch'](handleError(_0x3055f3,null));};exports[_0x7556('0x49')]=function(_0x466cfc,_0x279d75){if(_0x466cfc[_0x7556('0x48')]['id']){delete _0x466cfc[_0x7556('0x48')]['id'];}return db['JscriptySessionReport'][_0x7556('0x46')]({'where':{'id':_0x466cfc[_0x7556('0x4a')]['id']}})[_0x7556('0x25')](handleEntityNotFound(_0x279d75,null))[_0x7556('0x25')](saveUpdates(_0x466cfc[_0x7556('0x48')],null))[_0x7556('0x25')](respondWithResult(_0x279d75,null))['catch'](handleError(_0x279d75,null));};exports[_0x7556('0x24')]=function(_0x579e59,_0x4381ce){return db[_0x7556('0x2b')][_0x7556('0x46')]({'where':{'id':_0x579e59['params']['id']}})[_0x7556('0x25')](handleEntityNotFound(_0x4381ce,null))[_0x7556('0x25')](removeEntity(_0x4381ce,null))[_0x7556('0x42')](handleError(_0x4381ce,null));};exports[_0x7556('0x4b')]=function(_0x424a85,_0x55d25c){return db[_0x7556('0x2b')]['describe']()[_0x7556('0x25')](respondWithResult(_0x55d25c,null))[_0x7556('0x42')](handleError(_0x55d25c,null));};exports[_0x7556('0x4c')]=function(_0x58e5d6,_0x34f539,_0x160ff2){var _0x3e15fa={'raw':!![],'where':{}};var _0x254d83={};var _0x38776b={'count':0x0,'rows':[]};return db[_0x7556('0x2b')]['findOne']({'where':{'id':_0x58e5d6[_0x7556('0x4a')]['id']}})['then'](handleEntityNotFound(_0x34f539,null))['then'](function(_0x277220){if(_0x277220){_0x254d83[_0x7556('0x2f')]=_[_0x7556('0x44')](db[_0x7556('0x4d')][_0x7556('0x45')]);_0x254d83[_0x7556('0x31')]=_[_0x7556('0x44')](_0x58e5d6['query']);_0x254d83['filters']=_[_0x7556('0x33')](_0x254d83[_0x7556('0x2f')],_0x254d83[_0x7556('0x31')]);_0x3e15fa[_0x7556('0x34')]=_[_0x7556('0x33')](_0x254d83[_0x7556('0x2f')],qs[_0x7556('0x35')](_0x58e5d6['query'][_0x7556('0x35')]));_0x3e15fa[_0x7556('0x34')]=_0x3e15fa[_0x7556('0x34')]['length']?_0x3e15fa[_0x7556('0x34')]:_0x254d83[_0x7556('0x2f')];if(!_0x58e5d6[_0x7556('0x31')]['hasOwnProperty']('nolimit')){_0x3e15fa[_0x7556('0x1d')]=qs[_0x7556('0x1d')](_0x58e5d6[_0x7556('0x31')][_0x7556('0x1d')]);_0x3e15fa['offset']=qs['offset'](_0x58e5d6[_0x7556('0x31')][_0x7556('0x1f')]);}_0x3e15fa[_0x7556('0x39')]=qs['sort'](_0x58e5d6[_0x7556('0x31')][_0x7556('0x4e')]);_0x3e15fa[_0x7556('0x3a')]=qs[_0x7556('0x32')](_[_0x7556('0x4f')](_0x58e5d6['query'],_0x254d83[_0x7556('0x32')]));_0x3e15fa[_0x7556('0x3a')][_0x7556('0x50')]=_0x277220['id'];if(_0x58e5d6[_0x7556('0x31')][_0x7556('0x51')]){_0x3e15fa[_0x7556('0x3a')]=_[_0x7556('0x3c')](_0x3e15fa[_0x7556('0x3a')],{'$or':_[_0x7556('0x2a')](_0x3e15fa[_0x7556('0x34')],function(_0x39c493){var _0x44b11f={};_0x44b11f[_0x39c493]={'$like':'%'+_0x58e5d6[_0x7556('0x31')]['filter']+'%'};return _0x44b11f;})});}_0x3e15fa=_[_0x7556('0x3c')]({},_0x3e15fa,_0x58e5d6[_0x7556('0x3d')]);return db[_0x7556('0x4d')]['count']({'where':_0x3e15fa['where']})[_0x7556('0x25')](function(_0x2470f7){_0x38776b['count']=_0x2470f7;if(_0x58e5d6[_0x7556('0x31')][_0x7556('0x3e')]){_0x3e15fa[_0x7556('0x3f')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x7556('0x40')](_0x3e15fa);})[_0x7556('0x25')](function(_0x520930){_0x38776b[_0x7556('0x41')]=_0x520930;return _0x38776b;});}})[_0x7556('0x25')](respondWithFilteredResult(_0x34f539,_0x3e15fa))[_0x7556('0x42')](handleError(_0x34f539,null));}; \ No newline at end of file +var _0xe127=['body','find','describe','getQuestions','findOne','JscriptyQuestionReport','pick','SessionId','options','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','status','set','Content-Range','apply','update','destroy','end','error','stack','send','JscriptySessionReport','rawAttributes','fieldName','type','key','model','map','name','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','then','include','findAll','rows','catch','show','params','includeAll','merge','create'];(function(_0x14289d,_0x19d097){var _0x19467a=function(_0x445d83){while(--_0x445d83){_0x14289d['push'](_0x14289d['shift']());}};_0x19467a(++_0x19d097);}(_0xe127,0x1a8));var _0x7e12=function(_0x2f66a0,_0x8ed27e){_0x2f66a0=_0x2f66a0-0x0;var _0x418213=_0xe127[_0x2f66a0];return _0x418213;};'use strict';var emlformat=require(_0x7e12('0x0'));var rimraf=require(_0x7e12('0x1'));var zipdir=require(_0x7e12('0x2'));var jsonpatch=require(_0x7e12('0x3'));var rp=require(_0x7e12('0x4'));var moment=require(_0x7e12('0x5'));var BPromise=require(_0x7e12('0x6'));var Mustache=require('mustache');var util=require(_0x7e12('0x7'));var path=require(_0x7e12('0x8'));var sox=require(_0x7e12('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7e12('0xa'));var _=require(_0x7e12('0xb'));var squel=require('squel');var crypto=require(_0x7e12('0xc'));var jsforce=require(_0x7e12('0xd'));var deskjs=require(_0x7e12('0xe'));var toCsv=require(_0x7e12('0xf'));var querystring=require(_0x7e12('0x10'));var Papa=require(_0x7e12('0x11'));var Redis=require(_0x7e12('0x12'));var authService=require(_0x7e12('0x13'));var qs=require(_0x7e12('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7e12('0x15'));var logger=require(_0x7e12('0x16'))(_0x7e12('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7e12('0x18'));var db=require(_0x7e12('0x19'))['db'];function respondWithStatusCode(_0x2120c8,_0x94fe54){_0x94fe54=_0x94fe54||0xcc;return function(_0x2eefc3){if(_0x2eefc3){return _0x2120c8[_0x7e12('0x1a')](_0x94fe54);}return _0x2120c8['status'](_0x94fe54)['end']();};}function respondWithResult(_0xe442b6,_0x5dc8bd){_0x5dc8bd=_0x5dc8bd||0xc8;return function(_0x15a2a5){if(_0x15a2a5){return _0xe442b6['status'](_0x5dc8bd)[_0x7e12('0x1b')](_0x15a2a5);}};}function respondWithFilteredResult(_0x397e3f,_0x48aaea){return function(_0x23863a){if(_0x23863a){var _0x3737da=typeof _0x48aaea[_0x7e12('0x1c')]===_0x7e12('0x1d')&&typeof _0x48aaea[_0x7e12('0x1e')]===_0x7e12('0x1d');var _0xb6b0df=_0x23863a[_0x7e12('0x1f')];var _0x18a1b1=_0x3737da?0x0:_0x48aaea['offset'];var _0x44d865=_0x3737da?_0x23863a[_0x7e12('0x1f')]:_0x48aaea[_0x7e12('0x1c')]+_0x48aaea[_0x7e12('0x1e')];var _0x311063;if(_0x44d865>=_0xb6b0df){_0x44d865=_0xb6b0df;_0x311063=0xc8;}else{_0x311063=0xce;}_0x397e3f[_0x7e12('0x20')](_0x311063);return _0x397e3f[_0x7e12('0x21')](_0x7e12('0x22'),_0x18a1b1+'-'+_0x44d865+'/'+_0xb6b0df)[_0x7e12('0x1b')](_0x23863a);}return null;};}function patchUpdates(_0x2b637b){return function(_0xcb15bc){try{jsonpatch[_0x7e12('0x23')](_0xcb15bc,_0x2b637b,!![]);}catch(_0x40fb7c){return BPromise['reject'](_0x40fb7c);}return _0xcb15bc['save']();};}function saveUpdates(_0x5170ba,_0x1286c2){return function(_0x3ccd75){if(_0x3ccd75){return _0x3ccd75[_0x7e12('0x24')](_0x5170ba)['then'](function(_0x1ded2b){return _0x1ded2b;});}return null;};}function removeEntity(_0x88738a,_0x41282c){return function(_0x2dd3d3){if(_0x2dd3d3){return _0x2dd3d3[_0x7e12('0x25')]()['then'](function(){_0x88738a[_0x7e12('0x20')](0xcc)[_0x7e12('0x26')]();});}};}function handleEntityNotFound(_0x262ff5,_0x31bfb5){return function(_0xad20c6){if(!_0xad20c6){_0x262ff5[_0x7e12('0x1a')](0x194);}return _0xad20c6;};}function handleError(_0x247f2d,_0x3c6a5f){_0x3c6a5f=_0x3c6a5f||0x1f4;return function(_0x307801){logger[_0x7e12('0x27')](_0x307801[_0x7e12('0x28')]);if(_0x307801['name']){delete _0x307801['name'];}_0x247f2d[_0x7e12('0x20')](_0x3c6a5f)[_0x7e12('0x29')](_0x307801);};}exports['index']=function(_0x101f47,_0x212742){var _0x1462de={},_0x1bf0c5={},_0x51b032={'count':0x0,'rows':[]};var _0x32c7c4=_['map'](db[_0x7e12('0x2a')][_0x7e12('0x2b')],function(_0x3b13c7){return{'name':_0x3b13c7[_0x7e12('0x2c')],'type':_0x3b13c7[_0x7e12('0x2d')][_0x7e12('0x2e')]};});_0x1bf0c5[_0x7e12('0x2f')]=_[_0x7e12('0x30')](_0x32c7c4,_0x7e12('0x31'));_0x1bf0c5[_0x7e12('0x32')]=_[_0x7e12('0x33')](_0x101f47[_0x7e12('0x32')]);_0x1bf0c5['filters']=_['intersection'](_0x1bf0c5[_0x7e12('0x2f')],_0x1bf0c5[_0x7e12('0x32')]);_0x1462de['attributes']=_[_0x7e12('0x34')](_0x1bf0c5['model'],qs[_0x7e12('0x35')](_0x101f47[_0x7e12('0x32')][_0x7e12('0x35')]));_0x1462de[_0x7e12('0x36')]=_0x1462de['attributes'][_0x7e12('0x37')]?_0x1462de[_0x7e12('0x36')]:_0x1bf0c5[_0x7e12('0x2f')];if(!_0x101f47[_0x7e12('0x32')][_0x7e12('0x38')](_0x7e12('0x39'))){_0x1462de[_0x7e12('0x1e')]=qs[_0x7e12('0x1e')](_0x101f47['query']['limit']);_0x1462de[_0x7e12('0x1c')]=qs[_0x7e12('0x1c')](_0x101f47[_0x7e12('0x32')][_0x7e12('0x1c')]);}_0x1462de[_0x7e12('0x3a')]=qs[_0x7e12('0x3b')](_0x101f47[_0x7e12('0x32')][_0x7e12('0x3b')]);_0x1462de[_0x7e12('0x3c')]=qs[_0x7e12('0x3d')](_['pick'](_0x101f47[_0x7e12('0x32')],_0x1bf0c5[_0x7e12('0x3d')]),_0x32c7c4);if(_0x101f47[_0x7e12('0x32')][_0x7e12('0x3e')]){_0x1462de['where']=_['merge'](_0x1462de['where'],{'$or':_['map'](_0x32c7c4,function(_0x4bce03){if(_0x4bce03['type']!==_0x7e12('0x3f')){var _0x59859d={};_0x59859d[_0x4bce03[_0x7e12('0x31')]]={'$like':'%'+_0x101f47['query'][_0x7e12('0x3e')]+'%'};return _0x59859d;}})});}_0x1462de=_['merge']({},_0x1462de,_0x101f47['options']);var _0x26388d={'where':_0x1462de[_0x7e12('0x3c')]};return db[_0x7e12('0x2a')][_0x7e12('0x1f')](_0x26388d)[_0x7e12('0x40')](function(_0x4c8a1b){_0x51b032[_0x7e12('0x1f')]=_0x4c8a1b;if(_0x101f47['query']['includeAll']){_0x1462de[_0x7e12('0x41')]=[{'all':!![]}];}return db[_0x7e12('0x2a')][_0x7e12('0x42')](_0x1462de);})[_0x7e12('0x40')](function(_0x50debd){_0x51b032[_0x7e12('0x43')]=_0x50debd;return _0x51b032;})[_0x7e12('0x40')](respondWithFilteredResult(_0x212742,_0x1462de))[_0x7e12('0x44')](handleError(_0x212742,null));};exports[_0x7e12('0x45')]=function(_0x591c89,_0x4fea1c){var _0x12c3ee={'raw':!![],'where':{'id':_0x591c89[_0x7e12('0x46')]['id']}},_0x372bec={};_0x372bec[_0x7e12('0x2f')]=_[_0x7e12('0x33')](db[_0x7e12('0x2a')]['rawAttributes']);_0x372bec[_0x7e12('0x32')]=_[_0x7e12('0x33')](_0x591c89[_0x7e12('0x32')]);_0x372bec[_0x7e12('0x3d')]=_[_0x7e12('0x34')](_0x372bec[_0x7e12('0x2f')],_0x372bec[_0x7e12('0x32')]);_0x12c3ee[_0x7e12('0x36')]=_[_0x7e12('0x34')](_0x372bec['model'],qs['fields'](_0x591c89[_0x7e12('0x32')][_0x7e12('0x35')]));_0x12c3ee[_0x7e12('0x36')]=_0x12c3ee['attributes'][_0x7e12('0x37')]?_0x12c3ee[_0x7e12('0x36')]:_0x372bec['model'];if(_0x591c89[_0x7e12('0x32')][_0x7e12('0x47')]){_0x12c3ee[_0x7e12('0x41')]=[{'all':!![]}];}_0x12c3ee=_[_0x7e12('0x48')]({},_0x12c3ee,_0x591c89['options']);return db[_0x7e12('0x2a')]['find'](_0x12c3ee)[_0x7e12('0x40')](handleEntityNotFound(_0x4fea1c,null))[_0x7e12('0x40')](respondWithResult(_0x4fea1c,null))[_0x7e12('0x44')](handleError(_0x4fea1c,null));};exports[_0x7e12('0x49')]=function(_0x4c615a,_0x12a98c){return db[_0x7e12('0x2a')][_0x7e12('0x49')](_0x4c615a[_0x7e12('0x4a')],{})[_0x7e12('0x40')](respondWithResult(_0x12a98c,0xc9))[_0x7e12('0x44')](handleError(_0x12a98c,null));};exports['update']=function(_0x1fd3d3,_0x348e50){if(_0x1fd3d3[_0x7e12('0x4a')]['id']){delete _0x1fd3d3['body']['id'];}return db[_0x7e12('0x2a')]['find']({'where':{'id':_0x1fd3d3[_0x7e12('0x46')]['id']}})['then'](handleEntityNotFound(_0x348e50,null))[_0x7e12('0x40')](saveUpdates(_0x1fd3d3[_0x7e12('0x4a')],null))[_0x7e12('0x40')](respondWithResult(_0x348e50,null))[_0x7e12('0x44')](handleError(_0x348e50,null));};exports[_0x7e12('0x25')]=function(_0x1e2bfb,_0x54b554){return db['JscriptySessionReport'][_0x7e12('0x4b')]({'where':{'id':_0x1e2bfb[_0x7e12('0x46')]['id']}})['then'](handleEntityNotFound(_0x54b554,null))[_0x7e12('0x40')](removeEntity(_0x54b554,null))[_0x7e12('0x44')](handleError(_0x54b554,null));};exports[_0x7e12('0x4c')]=function(_0x4e85b7,_0x1cfffe){return db[_0x7e12('0x2a')][_0x7e12('0x4c')]()[_0x7e12('0x40')](respondWithResult(_0x1cfffe,null))[_0x7e12('0x44')](handleError(_0x1cfffe,null));};exports[_0x7e12('0x4d')]=function(_0x278053,_0x5d9453,_0x539525){var _0x178a45={'raw':!![],'where':{}};var _0x3c4261={};var _0x157d00={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x7e12('0x4e')]({'where':{'id':_0x278053[_0x7e12('0x46')]['id']}})[_0x7e12('0x40')](handleEntityNotFound(_0x5d9453,null))['then'](function(_0x289342){if(_0x289342){_0x3c4261['model']=_[_0x7e12('0x33')](db[_0x7e12('0x4f')][_0x7e12('0x2b')]);_0x3c4261[_0x7e12('0x32')]=_[_0x7e12('0x33')](_0x278053[_0x7e12('0x32')]);_0x3c4261['filters']=_['intersection'](_0x3c4261[_0x7e12('0x2f')],_0x3c4261[_0x7e12('0x32')]);_0x178a45[_0x7e12('0x36')]=_['intersection'](_0x3c4261[_0x7e12('0x2f')],qs[_0x7e12('0x35')](_0x278053[_0x7e12('0x32')][_0x7e12('0x35')]));_0x178a45[_0x7e12('0x36')]=_0x178a45[_0x7e12('0x36')][_0x7e12('0x37')]?_0x178a45[_0x7e12('0x36')]:_0x3c4261[_0x7e12('0x2f')];if(!_0x278053[_0x7e12('0x32')][_0x7e12('0x38')](_0x7e12('0x39'))){_0x178a45['limit']=qs[_0x7e12('0x1e')](_0x278053[_0x7e12('0x32')][_0x7e12('0x1e')]);_0x178a45['offset']=qs[_0x7e12('0x1c')](_0x278053[_0x7e12('0x32')][_0x7e12('0x1c')]);}_0x178a45['order']=qs[_0x7e12('0x3b')](_0x278053[_0x7e12('0x32')][_0x7e12('0x3b')]);_0x178a45[_0x7e12('0x3c')]=qs[_0x7e12('0x3d')](_[_0x7e12('0x50')](_0x278053['query'],_0x3c4261[_0x7e12('0x3d')]));_0x178a45[_0x7e12('0x3c')][_0x7e12('0x51')]=_0x289342['id'];if(_0x278053[_0x7e12('0x32')][_0x7e12('0x3e')]){_0x178a45[_0x7e12('0x3c')]=_['merge'](_0x178a45[_0x7e12('0x3c')],{'$or':_[_0x7e12('0x30')](_0x178a45['attributes'],function(_0x32702b){var _0x189aae={};_0x189aae[_0x32702b]={'$like':'%'+_0x278053['query'][_0x7e12('0x3e')]+'%'};return _0x189aae;})});}_0x178a45=_[_0x7e12('0x48')]({},_0x178a45,_0x278053[_0x7e12('0x52')]);return db[_0x7e12('0x4f')][_0x7e12('0x1f')]({'where':_0x178a45[_0x7e12('0x3c')]})[_0x7e12('0x40')](function(_0x5d5102){_0x157d00['count']=_0x5d5102;if(_0x278053[_0x7e12('0x32')][_0x7e12('0x47')]){_0x178a45['include']=[{'all':!![]}];}return db[_0x7e12('0x4f')][_0x7e12('0x42')](_0x178a45);})['then'](function(_0x2fb6c8){_0x157d00['rows']=_0x2fb6c8;return _0x157d00;});}})[_0x7e12('0x40')](respondWithFilteredResult(_0x5d9453,_0x178a45))['catch'](handleError(_0x5d9453,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 218e7df..63fd127 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 _0x1623=['lodash','api','moment','bluebird','request-promise','path','./jscriptySessionReport.attributes','JscriptySessionReport','report_jscripty_sessions'];(function(_0x32715c,_0x317ddb){var _0x101baf=function(_0x20db55){while(--_0x20db55){_0x32715c['push'](_0x32715c['shift']());}};_0x101baf(++_0x317ddb);}(_0x1623,0xab));var _0x3162=function(_0x184d85,_0x36491a){_0x184d85=_0x184d85-0x0;var _0x22814a=_0x1623[_0x184d85];return _0x22814a;};'use strict';var _=require(_0x3162('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3162('0x1'));var moment=require(_0x3162('0x2'));var BPromise=require(_0x3162('0x3'));var rp=require(_0x3162('0x4'));var fs=require('fs');var path=require(_0x3162('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3162('0x6'));module['exports']=function(_0x1b55f2,_0x428de6){return _0x1b55f2['define'](_0x3162('0x7'),attributes,{'tableName':_0x3162('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfdbd=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./jscriptySessionReport.attributes'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0xfdbd[_0x1eda20];return _0x31b953;};'use strict';var _=require(_0xdfdb('0x0'));var util=require(_0xdfdb('0x1'));var logger=require(_0xdfdb('0x2'))(_0xdfdb('0x3'));var moment=require(_0xdfdb('0x4'));var BPromise=require(_0xdfdb('0x5'));var rp=require(_0xdfdb('0x6'));var fs=require('fs');var path=require(_0xdfdb('0x7'));var rimraf=require(_0xdfdb('0x8'));var config=require('../../config/environment');var attributes=require(_0xdfdb('0x9'));module['exports']=function(_0x453ef6,_0x41bd5e){return _0x453ef6['define']('JscriptySessionReport',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 f066caf..e3f65bf 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 _0x6455=['client','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x5f4720,_0x1b3681){var _0x547b28=function(_0x2eddc1){while(--_0x2eddc1){_0x5f4720['push'](_0x5f4720['shift']());}};_0x547b28(++_0x1b3681);}(_0x6455,0x97));var _0x5645=function(_0x461448,_0x371e6d){_0x461448=_0x461448-0x0;var _0x3968fe=_0x6455[_0x461448];return _0x3968fe;};'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});function respondWithRpcPromise(_0x37d672,_0xa14a06,_0x278d86){return new BPromise(function(_0x518a28,_0x5f4037){return client[_0x5645('0xc')](_0x37d672,_0x278d86)[_0x5645('0xd')](function(_0x38c07a){logger[_0x5645('0xe')](_0x5645('0xf'),_0xa14a06,_0x5645('0x10'));logger['debug'](_0x5645('0x11'),_0xa14a06,_0x5645('0x10'),JSON[_0x5645('0x12')](_0x38c07a));if(_0x38c07a[_0x5645('0x13')]){if(_0x38c07a['error'][_0x5645('0x14')]===0x1f4){logger['error'](_0x5645('0xf'),_0xa14a06,_0x38c07a[_0x5645('0x13')][_0x5645('0x15')]);return _0x5f4037(_0x38c07a[_0x5645('0x13')][_0x5645('0x15')]);}logger[_0x5645('0x13')](_0x5645('0xf'),_0xa14a06,_0x38c07a[_0x5645('0x13')]['message']);return _0x518a28(_0x38c07a[_0x5645('0x13')][_0x5645('0x15')]);}else{logger[_0x5645('0xe')]('JscriptySessionReport,\x20%s,\x20%s',_0xa14a06,'request\x20sent');_0x518a28(_0x38c07a[_0x5645('0x16')][_0x5645('0x15')]);}})['catch'](function(_0x35e0c7){logger[_0x5645('0x13')](_0x5645('0xf'),_0xa14a06,_0x35e0c7);_0x5f4037(_0x35e0c7);});});} \ No newline at end of file +var _0x71ab=['http','request','then','info','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','JscriptySessionReport,\x20%s,\x20%s','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3f5568,_0xf35bfc){var _0x121d83=function(_0x2cd70e){while(--_0x2cd70e){_0x3f5568['push'](_0x3f5568['shift']());}};_0x121d83(++_0xf35bfc);}(_0x71ab,0x64));var _0xb71a=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x71ab[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require('lodash');var util=require(_0xb71a('0x0'));var moment=require('moment');var BPromise=require(_0xb71a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb71a('0x2'));var db=require(_0xb71a('0x3'))['db'];var utils=require(_0xb71a('0x4'));var logger=require(_0xb71a('0x5'))(_0xb71a('0x6'));var config=require(_0xb71a('0x7'));var jayson=require(_0xb71a('0x8'));var client=jayson[_0xb71a('0x9')][_0xb71a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x35a84e,_0x4358ce,_0x2a4c86){return new BPromise(function(_0x43ca14,_0x471ab6){return client[_0xb71a('0xb')](_0x35a84e,_0x2a4c86)[_0xb71a('0xc')](function(_0x378c96){logger[_0xb71a('0xd')]('JscriptySessionReport,\x20%s,\x20%s',_0x4358ce,_0xb71a('0xe'));logger['debug'](_0xb71a('0xf'),_0x4358ce,_0xb71a('0xe'),JSON[_0xb71a('0x10')](_0x378c96));if(_0x378c96['error']){if(_0x378c96[_0xb71a('0x11')]['code']===0x1f4){logger[_0xb71a('0x11')]('JscriptySessionReport,\x20%s,\x20%s',_0x4358ce,_0x378c96['error'][_0xb71a('0x12')]);return _0x471ab6(_0x378c96[_0xb71a('0x11')][_0xb71a('0x12')]);}logger[_0xb71a('0x11')]('JscriptySessionReport,\x20%s,\x20%s',_0x4358ce,_0x378c96['error']['message']);return _0x43ca14(_0x378c96[_0xb71a('0x11')][_0xb71a('0x12')]);}else{logger[_0xb71a('0xd')](_0xb71a('0x13'),_0x4358ce,_0xb71a('0xe'));_0x43ca14(_0x378c96[_0xb71a('0x14')][_0xb71a('0x12')]);}})[_0xb71a('0x15')](function(_0x7710a8){logger['error'](_0xb71a('0x13'),_0x4358ce,_0x7710a8);_0x471ab6(_0x7710a8);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 853b6be..439920f 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 _0x8e52=['get','index','put','/:id','isAuthenticated','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller'];(function(_0x27ebe8,_0x21dd01){var _0x431778=function(_0xcf97c6){while(--_0xcf97c6){_0x27ebe8['push'](_0x27ebe8['shift']());}};_0x431778(++_0x21dd01);}(_0x8e52,0x1c6));var _0x28e5=function(_0x291aaf,_0x4c6d8d){_0x291aaf=_0x291aaf-0x0;var _0x5571e6=_0x8e52[_0x291aaf];return _0x5571e6;};'use strict';var multer=require('multer');var util=require(_0x28e5('0x0'));var path=require(_0x28e5('0x1'));var timeout=require(_0x28e5('0x2'));var express=require(_0x28e5('0x3'));var router=express[_0x28e5('0x4')]();var fs_extra=require(_0x28e5('0x5'));var auth=require(_0x28e5('0x6'));var interaction=require(_0x28e5('0x7'));var config=require(_0x28e5('0x8'));var controller=require(_0x28e5('0x9'));router[_0x28e5('0xa')]('/',controller[_0x28e5('0xb')]);router[_0x28e5('0xc')](_0x28e5('0xd'),auth[_0x28e5('0xe')](),controller['update']);module[_0x28e5('0xf')]=router; \ No newline at end of file +var _0x3561=['put','/:id','update','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','index'];(function(_0x4f5224,_0x226de2){var _0x1a489a=function(_0x2a6347){while(--_0x2a6347){_0x4f5224['push'](_0x4f5224['shift']());}};_0x1a489a(++_0x226de2);}(_0x3561,0x94));var _0x1356=function(_0x19b50c,_0x36284d){_0x19b50c=_0x19b50c-0x0;var _0x4517e2=_0x3561[_0x19b50c];return _0x4517e2;};'use strict';var multer=require(_0x1356('0x0'));var util=require('util');var path=require(_0x1356('0x1'));var timeout=require(_0x1356('0x2'));var express=require(_0x1356('0x3'));var router=express[_0x1356('0x4')]();var fs_extra=require(_0x1356('0x5'));var auth=require(_0x1356('0x6'));var interaction=require(_0x1356('0x7'));var config=require(_0x1356('0x8'));var controller=require(_0x1356('0x9'));router[_0x1356('0xa')]('/',controller[_0x1356('0xb')]);router[_0x1356('0xc')](_0x1356('0xd'),auth['isAuthenticated'](),controller[_0x1356('0xe')]);module[_0x1356('0xf')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 4e27a38..71fc04e 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 _0x4a0b=['TEXT','STRING','INTEGER','sequelize'];(function(_0x2bdcc5,_0xb8f532){var _0x2ea7c3=function(_0x2c6f05){while(--_0x2c6f05){_0x2bdcc5['push'](_0x2bdcc5['shift']());}};_0x2ea7c3(++_0xb8f532);}(_0x4a0b,0x147));var _0xb4a0=function(_0x5bb4f4,_0x4e41dc){_0x5bb4f4=_0x5bb4f4-0x0;var _0x32cc12=_0x4a0b[_0x5bb4f4];return _0x32cc12;};'use strict';var Sequelize=require(_0xb4a0('0x0'));module['exports']={'license':{'type':Sequelize[_0xb4a0('0x1')]},'data1':{'type':Sequelize[_0xb4a0('0x2')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0xb4a0('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x51db=['INTEGER','exports','TEXT','STRING'];(function(_0x491ebe,_0x54c880){var _0x977b05=function(_0x596625){while(--_0x596625){_0x491ebe['push'](_0x491ebe['shift']());}};_0x977b05(++_0x54c880);}(_0x51db,0x10d));var _0xb51d=function(_0x2c851d,_0x4fe594){_0x2c851d=_0x2c851d-0x0;var _0x4aabe8=_0x51db[_0x2c851d];return _0x4aabe8;};'use strict';var Sequelize=require('sequelize');module[_0xb51d('0x0')]={'license':{'type':Sequelize[_0xb51d('0x1')]},'data1':{'type':Sequelize[_0xb51d('0x2')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0xb51d('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 d282d04..e9220e3 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 _0x5fab=['checkLicense','key','demo','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','end','sendStatus','name','send','index','model','keys','License','rawAttributes','query','filters','intersection','attributes','fields','merge','then','catch','body','find','params'];(function(_0x166c15,_0x17858c){var _0x28c0bd=function(_0x43e5fe){while(--_0x43e5fe){_0x166c15['push'](_0x166c15['shift']());}};_0x28c0bd(++_0x17858c);}(_0x5fab,0x177));var _0xb5fa=function(_0x16ffe2,_0x2f73ed){_0x16ffe2=_0x16ffe2-0x0;var _0x4193e5=_0x5fab[_0x16ffe2];return _0x4193e5;};'use strict';var emlformat=require(_0xb5fa('0x0'));var rimraf=require(_0xb5fa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb5fa('0x2'));var rp=require(_0xb5fa('0x3'));var moment=require(_0xb5fa('0x4'));var BPromise=require(_0xb5fa('0x5'));var Mustache=require(_0xb5fa('0x6'));var util=require(_0xb5fa('0x7'));var path=require(_0xb5fa('0x8'));var sox=require(_0xb5fa('0x9'));var csv=require(_0xb5fa('0xa'));var ejs=require(_0xb5fa('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb5fa('0xc'));var crypto=require(_0xb5fa('0xd'));var jsforce=require(_0xb5fa('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb5fa('0xa'));var querystring=require(_0xb5fa('0xf'));var Papa=require(_0xb5fa('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb5fa('0x11'));var as=require(_0xb5fa('0x12'));var hardwareService=require(_0xb5fa('0x13'));var logger=require(_0xb5fa('0x14'))(_0xb5fa('0x15'));var utils=require(_0xb5fa('0x16'));var config=require(_0xb5fa('0x17'));var licenseUtil=require(_0xb5fa('0x18'));var db=require(_0xb5fa('0x19'))['db'];function respondWithStatusCode(_0x4d3576,_0x2ad830){_0x2ad830=_0x2ad830||0xcc;return function(_0x3dad4d){if(_0x3dad4d){return _0x4d3576['sendStatus'](_0x2ad830);}return _0x4d3576[_0xb5fa('0x1a')](_0x2ad830)['end']();};}function respondWithResult(_0x265992,_0x3fc372){_0x3fc372=_0x3fc372||0xc8;return function(_0x40c914){if(_0x40c914){return _0x265992[_0xb5fa('0x1a')](_0x3fc372)[_0xb5fa('0x1b')](_0x40c914);}};}function respondWithFilteredResult(_0x5371cf,_0x567f31){return function(_0x38e964){if(_0x38e964){var _0x587043=typeof _0x567f31[_0xb5fa('0x1c')]===_0xb5fa('0x1d')&&typeof _0x567f31['limit']==='undefined';var _0x451a55=_0x38e964[_0xb5fa('0x1e')];var _0x32e9e5=_0x587043?0x0:_0x567f31[_0xb5fa('0x1c')];var _0x324ba5=_0x587043?_0x38e964[_0xb5fa('0x1e')]:_0x567f31[_0xb5fa('0x1c')]+_0x567f31[_0xb5fa('0x1f')];var _0xc14dc4;if(_0x324ba5>=_0x451a55){_0x324ba5=_0x451a55;_0xc14dc4=0xc8;}else{_0xc14dc4=0xce;}_0x5371cf[_0xb5fa('0x1a')](_0xc14dc4);return _0x5371cf[_0xb5fa('0x20')](_0xb5fa('0x21'),_0x32e9e5+'-'+_0x324ba5+'/'+_0x451a55)['json'](_0x38e964);}return null;};}function patchUpdates(_0x432bfa){return function(_0x519e20){try{jsonpatch[_0xb5fa('0x22')](_0x519e20,_0x432bfa,!![]);}catch(_0x4a6c04){return BPromise[_0xb5fa('0x23')](_0x4a6c04);}return _0x519e20[_0xb5fa('0x24')]();};}function saveUpdates(_0x4e05c0,_0x40dfdf){return function(_0x3a2ab9){if(_0x3a2ab9){return _0x3a2ab9[_0xb5fa('0x25')](_0x4e05c0)['then'](function(_0x32a85c){return _0x32a85c;});}return null;};}function removeEntity(_0xec108f,_0x444237){return function(_0x542348){if(_0x542348){return _0x542348[_0xb5fa('0x26')]()['then'](function(){_0xec108f[_0xb5fa('0x1a')](0xcc)[_0xb5fa('0x27')]();});}};}function handleEntityNotFound(_0x11053a,_0x543edf){return function(_0x2dbd22){if(!_0x2dbd22){_0x11053a[_0xb5fa('0x28')](0x194);}return _0x2dbd22;};}function handleError(_0x6a455c,_0x20d649){_0x20d649=_0x20d649||0x1f4;return function(_0x568870){logger['error'](_0x568870['stack']);if(_0x568870['name']){delete _0x568870[_0xb5fa('0x29')];}_0x6a455c[_0xb5fa('0x1a')](_0x20d649)[_0xb5fa('0x2a')](_0x568870);};}var utilLicense=require(_0xb5fa('0x18'));exports[_0xb5fa('0x2b')]=function(_0x3506a4,_0x358549){var _0x353314={'raw':!![],'where':{'id':0x1}},_0x409af9={};_0x409af9[_0xb5fa('0x2c')]=_[_0xb5fa('0x2d')](db[_0xb5fa('0x2e')][_0xb5fa('0x2f')]);_0x409af9[_0xb5fa('0x30')]=_[_0xb5fa('0x2d')](_0x3506a4[_0xb5fa('0x30')]);_0x409af9[_0xb5fa('0x31')]=_[_0xb5fa('0x32')](_0x409af9[_0xb5fa('0x2c')],_0x409af9[_0xb5fa('0x30')]);_0x353314[_0xb5fa('0x33')]=_[_0xb5fa('0x32')](_0x409af9[_0xb5fa('0x2c')],qs[_0xb5fa('0x34')](_0x3506a4['query'][_0xb5fa('0x34')]));_0x353314['attributes']=_0x353314['attributes']['length']?_0x353314[_0xb5fa('0x33')]:_0x409af9['model'];_0x353314=_[_0xb5fa('0x35')]({},_0x353314,_0x3506a4['options']);return utilLicense['getLicense'](_0x353314)[_0xb5fa('0x36')](respondWithResult(_0x358549,null))[_0xb5fa('0x37')](handleError(_0x358549,null));};exports['update']=function(_0x59f41d,_0x3d73c2){if(_0x59f41d[_0xb5fa('0x38')]['id']){delete _0x59f41d[_0xb5fa('0x38')]['id'];}return db['License'][_0xb5fa('0x39')]({'where':{'id':_0x59f41d[_0xb5fa('0x3a')]['id']}})['then'](handleEntityNotFound(_0x3d73c2,null))[_0xb5fa('0x36')](function(_0x2056de){var _0x204d6b=_0x2056de['get']({'plain':!![]});return utilLicense[_0xb5fa('0x3b')](_0x204d6b,_0x59f41d[_0xb5fa('0x38')][_0xb5fa('0x3c')]);})['then'](function(_0x117694){if(!_0x117694[_0xb5fa('0x3d')]){return saveUpdates(_0x59f41d[_0xb5fa('0x38')],null);}return _0x117694;})[_0xb5fa('0x36')](respondWithResult(_0x3d73c2,null))['catch'](handleError(_0x3d73c2,null));}; \ No newline at end of file +var _0x1967=['params','checkLicense','key','demo','catch','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','set','apply','save','update','then','status','error','name','send','index','model','keys','rawAttributes','query','intersection','attributes','fields','merge','getLicense','body','find'];(function(_0x24144b,_0x340329){var _0x29aa90=function(_0x28ded3){while(--_0x28ded3){_0x24144b['push'](_0x24144b['shift']());}};_0x29aa90(++_0x340329);}(_0x1967,0x173));var _0x7196=function(_0x3bfa43,_0x5277b8){_0x3bfa43=_0x3bfa43-0x0;var _0xdc9e98=_0x1967[_0x3bfa43];return _0xdc9e98;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7196('0x0'));var zipdir=require(_0x7196('0x1'));var jsonpatch=require(_0x7196('0x2'));var rp=require(_0x7196('0x3'));var moment=require(_0x7196('0x4'));var BPromise=require(_0x7196('0x5'));var Mustache=require(_0x7196('0x6'));var util=require(_0x7196('0x7'));var path=require(_0x7196('0x8'));var sox=require(_0x7196('0x9'));var csv=require('to-csv');var ejs=require(_0x7196('0xa'));var fs=require('fs');var fs_extra=require(_0x7196('0xb'));var _=require(_0x7196('0xc'));var squel=require(_0x7196('0xd'));var crypto=require(_0x7196('0xe'));var jsforce=require(_0x7196('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7196('0x10'));var querystring=require(_0x7196('0x11'));var Papa=require(_0x7196('0x12'));var Redis=require(_0x7196('0x13'));var authService=require(_0x7196('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7196('0x15'));var logger=require(_0x7196('0x16'))(_0x7196('0x17'));var utils=require(_0x7196('0x18'));var config=require(_0x7196('0x19'));var licenseUtil=require(_0x7196('0x1a'));var db=require(_0x7196('0x1b'))['db'];function respondWithStatusCode(_0x325641,_0x24f1c3){_0x24f1c3=_0x24f1c3||0xcc;return function(_0xba707b){if(_0xba707b){return _0x325641[_0x7196('0x1c')](_0x24f1c3);}return _0x325641['status'](_0x24f1c3)[_0x7196('0x1d')]();};}function respondWithResult(_0x3feccd,_0x3545aa){_0x3545aa=_0x3545aa||0xc8;return function(_0xf098c1){if(_0xf098c1){return _0x3feccd['status'](_0x3545aa)[_0x7196('0x1e')](_0xf098c1);}};}function respondWithFilteredResult(_0x539414,_0xe32933){return function(_0x2590a6){if(_0x2590a6){var _0xf7e97=typeof _0xe32933[_0x7196('0x1f')]===_0x7196('0x20')&&typeof _0xe32933[_0x7196('0x21')]===_0x7196('0x20');var _0x1ed296=_0x2590a6[_0x7196('0x22')];var _0x32fe2b=_0xf7e97?0x0:_0xe32933[_0x7196('0x1f')];var _0x5b716a=_0xf7e97?_0x2590a6['count']:_0xe32933[_0x7196('0x1f')]+_0xe32933[_0x7196('0x21')];var _0x40418d;if(_0x5b716a>=_0x1ed296){_0x5b716a=_0x1ed296;_0x40418d=0xc8;}else{_0x40418d=0xce;}_0x539414['status'](_0x40418d);return _0x539414[_0x7196('0x23')]('Content-Range',_0x32fe2b+'-'+_0x5b716a+'/'+_0x1ed296)['json'](_0x2590a6);}return null;};}function patchUpdates(_0x296e07){return function(_0x627223){try{jsonpatch[_0x7196('0x24')](_0x627223,_0x296e07,!![]);}catch(_0x4ddf78){return BPromise['reject'](_0x4ddf78);}return _0x627223[_0x7196('0x25')]();};}function saveUpdates(_0x3cd8ff,_0x598a26){return function(_0x18649b){if(_0x18649b){return _0x18649b[_0x7196('0x26')](_0x3cd8ff)[_0x7196('0x27')](function(_0x18d389){return _0x18d389;});}return null;};}function removeEntity(_0x38b3d6,_0x549f34){return function(_0x3f8178){if(_0x3f8178){return _0x3f8178['destroy']()[_0x7196('0x27')](function(){_0x38b3d6[_0x7196('0x28')](0xcc)[_0x7196('0x1d')]();});}};}function handleEntityNotFound(_0xa69810,_0x70aa65){return function(_0x43f6a2){if(!_0x43f6a2){_0xa69810['sendStatus'](0x194);}return _0x43f6a2;};}function handleError(_0x57c404,_0x1482e5){_0x1482e5=_0x1482e5||0x1f4;return function(_0x2d284f){logger[_0x7196('0x29')](_0x2d284f['stack']);if(_0x2d284f['name']){delete _0x2d284f[_0x7196('0x2a')];}_0x57c404[_0x7196('0x28')](_0x1482e5)[_0x7196('0x2b')](_0x2d284f);};}var utilLicense=require('../../config/license/util');exports[_0x7196('0x2c')]=function(_0x4ecea1,_0x4fd339){var _0x59d79d={'raw':!![],'where':{'id':0x1}},_0x30151f={};_0x30151f[_0x7196('0x2d')]=_[_0x7196('0x2e')](db['License'][_0x7196('0x2f')]);_0x30151f[_0x7196('0x30')]=_[_0x7196('0x2e')](_0x4ecea1[_0x7196('0x30')]);_0x30151f['filters']=_[_0x7196('0x31')](_0x30151f[_0x7196('0x2d')],_0x30151f[_0x7196('0x30')]);_0x59d79d[_0x7196('0x32')]=_[_0x7196('0x31')](_0x30151f[_0x7196('0x2d')],qs[_0x7196('0x33')](_0x4ecea1[_0x7196('0x30')][_0x7196('0x33')]));_0x59d79d[_0x7196('0x32')]=_0x59d79d[_0x7196('0x32')]['length']?_0x59d79d[_0x7196('0x32')]:_0x30151f['model'];_0x59d79d=_[_0x7196('0x34')]({},_0x59d79d,_0x4ecea1['options']);return utilLicense[_0x7196('0x35')](_0x59d79d)[_0x7196('0x27')](respondWithResult(_0x4fd339,null))['catch'](handleError(_0x4fd339,null));};exports[_0x7196('0x26')]=function(_0x2bcadd,_0x4531d7){if(_0x2bcadd[_0x7196('0x36')]['id']){delete _0x2bcadd[_0x7196('0x36')]['id'];}return db['License'][_0x7196('0x37')]({'where':{'id':_0x2bcadd[_0x7196('0x38')]['id']}})[_0x7196('0x27')](handleEntityNotFound(_0x4531d7,null))[_0x7196('0x27')](function(_0x3e8f98){var _0x123cad=_0x3e8f98['get']({'plain':!![]});return utilLicense[_0x7196('0x39')](_0x123cad,_0x2bcadd[_0x7196('0x36')][_0x7196('0x3a')]);})['then'](function(_0x33831a){if(!_0x33831a[_0x7196('0x3b')]){return saveUpdates(_0x2bcadd[_0x7196('0x36')],null);}return _0x33831a;})[_0x7196('0x27')](respondWithResult(_0x4531d7,null))[_0x7196('0x3c')](handleError(_0x4531d7,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index a545460..ff3c459 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 _0xbd83=['util','../../config/logger','api','moment','bluebird','rimraf','exports','define','License','license'];(function(_0x10dfdf,_0x36b623){var _0x4d857d=function(_0x4683ee){while(--_0x4683ee){_0x10dfdf['push'](_0x10dfdf['shift']());}};_0x4d857d(++_0x36b623);}(_0xbd83,0x140));var _0x3bd8=function(_0xbeb808,_0x881ddf){_0xbeb808=_0xbeb808-0x0;var _0x5d6909=_0xbd83[_0xbeb808];return _0x5d6909;};'use strict';var _=require('lodash');var util=require(_0x3bd8('0x0'));var logger=require(_0x3bd8('0x1'))(_0x3bd8('0x2'));var moment=require(_0x3bd8('0x3'));var BPromise=require(_0x3bd8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3bd8('0x5'));var config=require('../../config/environment');var attributes=require('./license.attributes');module[_0x3bd8('0x6')]=function(_0x1246f9,_0x127256){return _0x1246f9[_0x3bd8('0x7')](_0x3bd8('0x8'),attributes,{'tableName':_0x3bd8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd85d=['define','License','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./license.attributes','exports'];(function(_0x21bb2f,_0x4199b9){var _0x279b0e=function(_0x4014b5){while(--_0x4014b5){_0x21bb2f['push'](_0x21bb2f['shift']());}};_0x279b0e(++_0x4199b9);}(_0xd85d,0x1e2));var _0xdd85=function(_0x299b76,_0x44ade7){_0x299b76=_0x299b76-0x0;var _0x4b6f79=_0xd85d[_0x299b76];return _0x4b6f79;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xdd85('0x0'))(_0xdd85('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xdd85('0x2'));var fs=require('fs');var path=require(_0xdd85('0x3'));var rimraf=require(_0xdd85('0x4'));var config=require(_0xdd85('0x5'));var attributes=require(_0xdd85('0x6'));module[_0xdd85('0x7')]=function(_0x4d018f,_0x253c9){return _0x4d018f[_0xdd85('0x8')](_0xdd85('0x9'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 01fc73a..f79315d 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 _0xb75d=['stringify','error','code','License,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','License,\x20%s,\x20%s,\x20%s'];(function(_0x385b16,_0x248dc9){var _0xf204d8=function(_0x44fab9){while(--_0x44fab9){_0x385b16['push'](_0x385b16['shift']());}};_0xf204d8(++_0x248dc9);}(_0xb75d,0x12c));var _0xdb75=function(_0x3b1b23,_0x21bccd){_0x3b1b23=_0x3b1b23-0x0;var _0x1efc85=_0xb75d[_0x3b1b23];return _0x1efc85;};'use strict';var _=require(_0xdb75('0x0'));var util=require('util');var moment=require(_0xdb75('0x1'));var BPromise=require(_0xdb75('0x2'));var rs=require(_0xdb75('0x3'));var fs=require('fs');var Redis=require(_0xdb75('0x4'));var db=require(_0xdb75('0x5'))['db'];var utils=require(_0xdb75('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xdb75('0x7'));var jayson=require(_0xdb75('0x8'));var client=jayson[_0xdb75('0x9')][_0xdb75('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xaf6d4f,_0x4ea92e,_0x1f4090){return new BPromise(function(_0x5e4ebe,_0x3aa4b4){return client[_0xdb75('0xb')](_0xaf6d4f,_0x1f4090)[_0xdb75('0xc')](function(_0x107ed7){logger[_0xdb75('0xd')]('License,\x20%s,\x20%s',_0x4ea92e,'request\x20sent');logger['debug'](_0xdb75('0xe'),_0x4ea92e,'request\x20sent',JSON[_0xdb75('0xf')](_0x107ed7));if(_0x107ed7[_0xdb75('0x10')]){if(_0x107ed7[_0xdb75('0x10')][_0xdb75('0x11')]===0x1f4){logger['error'](_0xdb75('0x12'),_0x4ea92e,_0x107ed7[_0xdb75('0x10')][_0xdb75('0x13')]);return _0x3aa4b4(_0x107ed7[_0xdb75('0x10')][_0xdb75('0x13')]);}logger['error'](_0xdb75('0x12'),_0x4ea92e,_0x107ed7['error'][_0xdb75('0x13')]);return _0x5e4ebe(_0x107ed7['error']['message']);}else{logger['info'](_0xdb75('0x12'),_0x4ea92e,'request\x20sent');_0x5e4ebe(_0x107ed7['result'][_0xdb75('0x13')]);}})[_0xdb75('0x14')](function(_0x1c42c6){logger['error']('License,\x20%s,\x20%s',_0x4ea92e,_0x1c42c6);_0x3aa4b4(_0x1c42c6);});});} \ No newline at end of file +var _0x543b=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','License,\x20%s,\x20%s','message','catch','lodash','util'];(function(_0x1e0a79,_0x43c089){var _0x3f5288=function(_0x406e73){while(--_0x406e73){_0x1e0a79['push'](_0x1e0a79['shift']());}};_0x3f5288(++_0x43c089);}(_0x543b,0x8a));var _0xb543=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x543b[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xb543('0x0'));var util=require(_0xb543('0x1'));var moment=require(_0xb543('0x2'));var BPromise=require(_0xb543('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb543('0x4'));var db=require(_0xb543('0x5'))['db'];var utils=require(_0xb543('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xb543('0x7'));var jayson=require(_0xb543('0x8'));var client=jayson['client'][_0xb543('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3cc298,_0x1a0cd0,_0x46f5d1){return new BPromise(function(_0x5ce784,_0x4626c5){return client[_0xb543('0xa')](_0x3cc298,_0x46f5d1)[_0xb543('0xb')](function(_0x261d29){logger[_0xb543('0xc')]('License,\x20%s,\x20%s',_0x1a0cd0,_0xb543('0xd'));logger[_0xb543('0xe')]('License,\x20%s,\x20%s,\x20%s',_0x1a0cd0,_0xb543('0xd'),JSON[_0xb543('0xf')](_0x261d29));if(_0x261d29[_0xb543('0x10')]){if(_0x261d29[_0xb543('0x10')]['code']===0x1f4){logger['error'](_0xb543('0x11'),_0x1a0cd0,_0x261d29[_0xb543('0x10')][_0xb543('0x12')]);return _0x4626c5(_0x261d29['error'][_0xb543('0x12')]);}logger['error'](_0xb543('0x11'),_0x1a0cd0,_0x261d29[_0xb543('0x10')][_0xb543('0x12')]);return _0x5ce784(_0x261d29[_0xb543('0x10')]['message']);}else{logger[_0xb543('0xc')]('License,\x20%s,\x20%s',_0x1a0cd0,_0xb543('0xd'));_0x5ce784(_0x261d29['result'][_0xb543('0x12')]);}})[_0xb543('0x13')](function(_0x449d23){logger[_0xb543('0x10')](_0xb543('0x11'),_0x1a0cd0,_0x449d23);_0x4626c5(_0x449d23);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index be19ce2..7ec55ed 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 _0x3aae=['/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','post','addDisposition','addAnswer','create','addImap','addSmtp','addInteraction','addApplications','/:id/send','send','addAgents','delete','removeDispositions','removeAnswers','/:id/in_servers','removeImap','removeSmtp','destroy','/:id/users','removeAgents','exports','multer','path','Router','fs-extra','../../components/auth/service','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getImap','/:id/out_servers'];(function(_0x19e9da,_0x422d6d){var _0x12a0e8=function(_0x4ece0d){while(--_0x4ece0d){_0x19e9da['push'](_0x19e9da['shift']());}};_0x12a0e8(++_0x422d6d);}(_0x3aae,0x78));var _0xe3aa=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x3aae[_0x21a9d9];return _0x46adce;};'use strict';var multer=require(_0xe3aa('0x0'));var util=require('util');var path=require(_0xe3aa('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe3aa('0x2')]();var fs_extra=require(_0xe3aa('0x3'));var auth=require(_0xe3aa('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./mailAccount.controller');router[_0xe3aa('0x5')]('/',auth['isAuthenticated'](),controller[_0xe3aa('0x6')]);router[_0xe3aa('0x5')](_0xe3aa('0x7'),auth[_0xe3aa('0x8')](),controller[_0xe3aa('0x9')]);router[_0xe3aa('0x5')](_0xe3aa('0xa'),auth['isAuthenticated'](),controller[_0xe3aa('0xb')]);router['get'](_0xe3aa('0xc'),auth[_0xe3aa('0x8')](),controller[_0xe3aa('0xd')]);router[_0xe3aa('0x5')](_0xe3aa('0xe'),auth['isAuthenticated'](),controller[_0xe3aa('0xf')]);router[_0xe3aa('0x5')]('/:id/in_servers',auth[_0xe3aa('0x8')](),controller[_0xe3aa('0x10')]);router['get'](_0xe3aa('0x11'),auth[_0xe3aa('0x8')](),controller['getSmtp']);router['get'](_0xe3aa('0x12'),auth[_0xe3aa('0x8')](),controller[_0xe3aa('0x13')]);router[_0xe3aa('0x5')](_0xe3aa('0x14'),auth['isAuthenticated'](),controller[_0xe3aa('0x15')]);router[_0xe3aa('0x5')](_0xe3aa('0x16'),auth[_0xe3aa('0x8')](),controller[_0xe3aa('0x17')]);router['get'](_0xe3aa('0x18'),auth['isAuthenticated'](),controller['verifySmtp']);router['get']('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0xe3aa('0x19')]('/:id/dispositions',auth[_0xe3aa('0x8')](),controller[_0xe3aa('0x1a')]);router[_0xe3aa('0x19')](_0xe3aa('0xe'),auth['isAuthenticated'](),controller[_0xe3aa('0x1b')]);router[_0xe3aa('0x19')]('/',auth[_0xe3aa('0x8')](),controller[_0xe3aa('0x1c')]);router[_0xe3aa('0x19')]('/:id/in_servers',auth['isAuthenticated'](),controller[_0xe3aa('0x1d')]);router[_0xe3aa('0x19')](_0xe3aa('0x11'),auth[_0xe3aa('0x8')](),controller[_0xe3aa('0x1e')]);router[_0xe3aa('0x19')](_0xe3aa('0x12'),auth[_0xe3aa('0x8')](),controller[_0xe3aa('0x1f')]);router['post'](_0xe3aa('0x14'),auth[_0xe3aa('0x8')](),controller[_0xe3aa('0x20')]);router[_0xe3aa('0x19')](_0xe3aa('0x21'),auth[_0xe3aa('0x8')](),controller[_0xe3aa('0x22')]);router[_0xe3aa('0x19')]('/:id/users',auth[_0xe3aa('0x8')](),controller[_0xe3aa('0x23')]);router['put'](_0xe3aa('0xa'),auth[_0xe3aa('0x8')](),controller['update']);router[_0xe3aa('0x24')]('/:id/dispositions',auth[_0xe3aa('0x8')](),controller[_0xe3aa('0x25')]);router[_0xe3aa('0x24')]('/:id/canned_answers',auth[_0xe3aa('0x8')](),controller[_0xe3aa('0x26')]);router['delete'](_0xe3aa('0x27'),auth[_0xe3aa('0x8')](),controller[_0xe3aa('0x28')]);router[_0xe3aa('0x24')](_0xe3aa('0x11'),auth[_0xe3aa('0x8')](),controller[_0xe3aa('0x29')]);router[_0xe3aa('0x24')](_0xe3aa('0xa'),auth[_0xe3aa('0x8')](),controller[_0xe3aa('0x2a')]);router[_0xe3aa('0x24')](_0xe3aa('0x2b'),auth[_0xe3aa('0x8')](),controller[_0xe3aa('0x2c')]);module[_0xe3aa('0x2d')]=router; \ No newline at end of file +var _0x8ffd=['getApplications','/:id/messages','getMessages','/:id/users','post','addDisposition','addAnswer','addImap','addSmtp','addInteraction','/:id/applications','addApplications','send','put','/:id','delete','removeDispositions','removeAnswers','removeSmtp','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','/describe','describe','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions'];(function(_0x377a7e,_0x1b204f){var _0x3169a7=function(_0x1e785a){while(--_0x1e785a){_0x377a7e['push'](_0x377a7e['shift']());}};_0x3169a7(++_0x1b204f);}(_0x8ffd,0x6d));var _0xd8ff=function(_0x495ac2,_0x3a5324){_0x495ac2=_0x495ac2-0x0;var _0x191c51=_0x8ffd[_0x495ac2];return _0x191c51;};'use strict';var multer=require(_0xd8ff('0x0'));var util=require(_0xd8ff('0x1'));var path=require(_0xd8ff('0x2'));var timeout=require(_0xd8ff('0x3'));var express=require(_0xd8ff('0x4'));var router=express[_0xd8ff('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd8ff('0x6'));var config=require(_0xd8ff('0x7'));var controller=require(_0xd8ff('0x8'));router[_0xd8ff('0x9')]('/',auth[_0xd8ff('0xa')](),controller['index']);router[_0xd8ff('0x9')](_0xd8ff('0xb'),auth[_0xd8ff('0xa')](),controller[_0xd8ff('0xc')]);router[_0xd8ff('0x9')]('/:id',auth[_0xd8ff('0xa')](),controller['show']);router[_0xd8ff('0x9')](_0xd8ff('0xd'),auth[_0xd8ff('0xa')](),controller[_0xd8ff('0xe')]);router[_0xd8ff('0x9')](_0xd8ff('0xf'),auth[_0xd8ff('0xa')](),controller[_0xd8ff('0x10')]);router[_0xd8ff('0x9')](_0xd8ff('0x11'),auth[_0xd8ff('0xa')](),controller[_0xd8ff('0x12')]);router[_0xd8ff('0x9')](_0xd8ff('0x13'),auth['isAuthenticated'](),controller[_0xd8ff('0x14')]);router['get'](_0xd8ff('0x15'),auth['isAuthenticated'](),controller[_0xd8ff('0x16')]);router[_0xd8ff('0x9')]('/:id/applications',auth[_0xd8ff('0xa')](),controller[_0xd8ff('0x17')]);router[_0xd8ff('0x9')](_0xd8ff('0x18'),auth[_0xd8ff('0xa')](),controller[_0xd8ff('0x19')]);router[_0xd8ff('0x9')]('/:id/verify',auth[_0xd8ff('0xa')](),controller['verifySmtp']);router[_0xd8ff('0x9')](_0xd8ff('0x1a'),auth['isAuthenticated'](),controller['getAgents']);router[_0xd8ff('0x1b')](_0xd8ff('0xd'),auth[_0xd8ff('0xa')](),controller[_0xd8ff('0x1c')]);router[_0xd8ff('0x1b')](_0xd8ff('0xf'),auth[_0xd8ff('0xa')](),controller[_0xd8ff('0x1d')]);router[_0xd8ff('0x1b')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xd8ff('0x11'),auth['isAuthenticated'](),controller[_0xd8ff('0x1e')]);router['post'](_0xd8ff('0x13'),auth['isAuthenticated'](),controller[_0xd8ff('0x1f')]);router[_0xd8ff('0x1b')](_0xd8ff('0x15'),auth[_0xd8ff('0xa')](),controller[_0xd8ff('0x20')]);router[_0xd8ff('0x1b')](_0xd8ff('0x21'),auth[_0xd8ff('0xa')](),controller[_0xd8ff('0x22')]);router[_0xd8ff('0x1b')]('/:id/send',auth[_0xd8ff('0xa')](),controller[_0xd8ff('0x23')]);router[_0xd8ff('0x1b')](_0xd8ff('0x1a'),auth['isAuthenticated'](),controller['addAgents']);router[_0xd8ff('0x24')](_0xd8ff('0x25'),auth['isAuthenticated'](),controller['update']);router[_0xd8ff('0x26')](_0xd8ff('0xd'),auth[_0xd8ff('0xa')](),controller[_0xd8ff('0x27')]);router['delete'](_0xd8ff('0xf'),auth[_0xd8ff('0xa')](),controller[_0xd8ff('0x28')]);router[_0xd8ff('0x26')](_0xd8ff('0x11'),auth[_0xd8ff('0xa')](),controller['removeImap']);router[_0xd8ff('0x26')](_0xd8ff('0x13'),auth[_0xd8ff('0xa')](),controller[_0xd8ff('0x29')]);router[_0xd8ff('0x26')](_0xd8ff('0x25'),auth[_0xd8ff('0xa')](),controller[_0xd8ff('0x2a')]);router[_0xd8ff('0x26')](_0xd8ff('0x1a'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xd8ff('0x2b')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 6af1ab6..880670b 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 _0xa9b1=['mandatoryDisposition','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'];(function(_0x288478,_0x23303e){var _0x234c05=function(_0x4ff5a5){while(--_0x4ff5a5){_0x288478['push'](_0x288478['shift']());}};_0x234c05(++_0x23303e);}(_0xa9b1,0x133));var _0x1a9b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa9b1[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0x1a9b('0x0')]},'name':{'type':Sequelize[_0x1a9b('0x0')],'allowNull':![]},'service':{'type':Sequelize[_0x1a9b('0x1')],'defaultValue':![]},'email':{'type':Sequelize[_0x1a9b('0x0')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x1a9b('0x1')],'defaultValue':!![]},'key':{'type':Sequelize[_0x1a9b('0x0')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1a9b('0x2')},'fontSize':{'type':Sequelize[_0x1a9b('0x3')](0x2)[_0x1a9b('0x4')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x1a9b('0x5')],'defaultValue':function(){return _0x1a9b('0x6');}},'notificationSound':{'type':Sequelize[_0x1a9b('0x1')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x1a9b('0x1')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1a9b('0x3')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x1a9b('0x1')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1a9b('0x3')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1a9b('0x1')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1a9b('0x3')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x1a9b('0x1')],'defaultValue':![],'comment':_0x1a9b('0x7'),'set':function(_0x2c2ee4){if(!_0x2c2ee4)this['setDataValue']('mandatoryDispositionPauseId',null);this['setDataValue'](_0x1a9b('0x8'),_0x2c2ee4);}}}; \ No newline at end of file +var _0x0fda=['Arial,Helvetica,sans-serif','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','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','BOOLEAN','TEXT'];(function(_0x257652,_0x3005ad){var _0xbc5883=function(_0x1f7233){while(--_0x1f7233){_0x257652['push'](_0x257652['shift']());}};_0xbc5883(++_0x3005ad);}(_0x0fda,0x1a0));var _0xa0fd=function(_0x226ca2,_0x5e668e){_0x226ca2=_0x226ca2-0x0;var _0x5b087a=_0x0fda[_0x226ca2];return _0x5b087a;};'use strict';var Sequelize=require(_0xa0fd('0x0'));module['exports']={'description':{'type':Sequelize[_0xa0fd('0x1')]},'name':{'type':Sequelize[_0xa0fd('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0xa0fd('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xa0fd('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xa0fd('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0xa0fd('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0xa0fd('0x3')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xa0fd('0x4')},'fontSize':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xa0fd('0x3')],'defaultValue':function(){return _0xa0fd('0x5');}},'notificationSound':{'type':Sequelize[_0xa0fd('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa0fd('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xa0fd('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa0fd('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa0fd('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa0fd('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xa0fd('0x7')},'mandatoryDisposition':{'type':Sequelize[_0xa0fd('0x2')],'defaultValue':![],'comment':_0xa0fd('0x8'),'set':function(_0x5c1786){if(!_0x5c1786)this[_0xa0fd('0x9')](_0xa0fd('0xa'),null);this[_0xa0fd('0x9')](_0xa0fd('0xb'),_0x5c1786);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index c968e26..3d55558 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 _0xc5b1=['sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','update','destroy','MailAccounts','UserProfileResource','stack','name','MailServerIn','Imap','MailServerOut','Smtp','Pause','mandatoryDispositionPause','map','MailAccount','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','body','params','addDisposition','Disposition','getDispositions','rawAttributes','MailAccountId','filter','removeDispositions','ids','CannedAnswer','create','getAnswers','findOne','removeAnswers','key','email','ListId','isNil','active','cservice','user','cuser','password','pass','cpassword','authentication','host','port','service','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','getInteractions','User','Owner','fullname','internal','Tags','color','tag','MailInteraction','addApplications','sequelize','transaction','MailApplication','findAndCountAll','getApplications','getMessages','MailMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','true','send','split','CmList','List','Contacts','DESC','from','%s\x20<%s>','attachments','join','root','basename','secure','auth','SendMail','sendMail','List\x20not\x20found','CmContact','messageId','subject','attach','out','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','juice','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./mailAccount.socket','register','client','http','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x511bd1,_0x223e5b){var _0x4c48ec=function(_0x31814e){while(--_0x31814e){_0x511bd1['push'](_0x511bd1['shift']());}};_0x4c48ec(++_0x223e5b);}(_0xc5b1,0x98));var _0x1c5b=function(_0x3b1cda,_0x340fa0){_0x3b1cda=_0x3b1cda-0x0;var _0x19a821=_0xc5b1[_0x3b1cda];return _0x19a821;};'use strict';var emlformat=require(_0x1c5b('0x0'));var rimraf=require(_0x1c5b('0x1'));var zipdir=require(_0x1c5b('0x2'));var jsonpatch=require(_0x1c5b('0x3'));var rp=require(_0x1c5b('0x4'));var moment=require(_0x1c5b('0x5'));var BPromise=require(_0x1c5b('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1c5b('0x7'));var sox=require(_0x1c5b('0x8'));var csv=require(_0x1c5b('0x9'));var ejs=require(_0x1c5b('0xa'));var fs=require('fs');var fs_extra=require(_0x1c5b('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x1c5b('0xc'));var jsforce=require(_0x1c5b('0xd'));var deskjs=require(_0x1c5b('0xe'));var toCsv=require(_0x1c5b('0x9'));var querystring=require(_0x1c5b('0xf'));var Papa=require(_0x1c5b('0x10'));var htmlToText=require('html-to-text');var juice=require(_0x1c5b('0x11'));var Redis=require(_0x1c5b('0x12'));var authService=require(_0x1c5b('0x13'));var qs=require(_0x1c5b('0x14'));var as=require(_0x1c5b('0x15'));var hardwareService=require(_0x1c5b('0x16'));var logger=require(_0x1c5b('0x17'))(_0x1c5b('0x18'));var utils=require('../../config/utils');var config=require(_0x1c5b('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x1c5b('0x1a'))['db'];config[_0x1c5b('0x1b')]=_[_0x1c5b('0x1c')](config[_0x1c5b('0x1b')],{'host':_0x1c5b('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1c5b('0x1b')]));require(_0x1c5b('0x1e'))[_0x1c5b('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson[_0x1c5b('0x20')][_0x1c5b('0x21')]({'port':0x232b});function respondWithRpcPromise(_0x58d5c6,_0x38c993,_0x56ab4f,_0x1a0971){return new BPromise(function(_0x46c743,_0x8adb31){var _0x47474b=_0x1a0971||client;return _0x47474b[_0x1c5b('0x22')](_0x58d5c6,_0x56ab4f)[_0x1c5b('0x23')](function(_0x393aff){logger['info'](_0x1c5b('0x24'),_0x38c993,_0x1c5b('0x25'));logger[_0x1c5b('0x26')](_0x1c5b('0x27'),_0x38c993,_0x1c5b('0x25'),JSON[_0x1c5b('0x28')](_0x393aff));if(_0x393aff['error']){if(_0x393aff[_0x1c5b('0x29')][_0x1c5b('0x2a')]===0x1f4){logger['error'](_0x1c5b('0x24'),_0x38c993,_0x393aff[_0x1c5b('0x29')][_0x1c5b('0x2b')]);return _0x8adb31(_0x393aff['error'][_0x1c5b('0x2b')]);}logger[_0x1c5b('0x29')](_0x1c5b('0x24'),_0x38c993,_0x393aff['error'][_0x1c5b('0x2b')]);return _0x46c743(_0x393aff['error'][_0x1c5b('0x2b')]);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x38c993,_0x1c5b('0x25'));_0x46c743(_0x393aff[_0x1c5b('0x2c')][_0x1c5b('0x2b')]);}})[_0x1c5b('0x2d')](function(_0x3962cc){logger['error'](_0x1c5b('0x24'),_0x38c993,_0x3962cc);_0x8adb31(_0x3962cc);});});}function respondWithStatusCode(_0x1c2247,_0x20d63b){_0x20d63b=_0x20d63b||0xcc;return function(_0x3702cc){if(_0x3702cc){return _0x1c2247[_0x1c5b('0x2e')](_0x20d63b);}return _0x1c2247[_0x1c5b('0x2f')](_0x20d63b)[_0x1c5b('0x30')]();};}function respondWithResult(_0x33e317,_0xf958ed){_0xf958ed=_0xf958ed||0xc8;return function(_0x51a37f){if(_0x51a37f){return _0x33e317[_0x1c5b('0x2f')](_0xf958ed)[_0x1c5b('0x31')](_0x51a37f);}};}function respondWithFilteredResult(_0x73c654,_0x3c2771){return function(_0xbc30a4){if(_0xbc30a4){var _0x4c8dfe=typeof _0x3c2771['offset']===_0x1c5b('0x32')&&typeof _0x3c2771[_0x1c5b('0x33')]===_0x1c5b('0x32');var _0x37fd5d=_0xbc30a4[_0x1c5b('0x34')];var _0x228751=_0x4c8dfe?0x0:_0x3c2771[_0x1c5b('0x35')];var _0x252766=_0x4c8dfe?_0xbc30a4[_0x1c5b('0x34')]:_0x3c2771[_0x1c5b('0x35')]+_0x3c2771[_0x1c5b('0x33')];var _0x582502;if(_0x252766>=_0x37fd5d){_0x252766=_0x37fd5d;_0x582502=0xc8;}else{_0x582502=0xce;}_0x73c654[_0x1c5b('0x2f')](_0x582502);return _0x73c654[_0x1c5b('0x36')](_0x1c5b('0x37'),_0x228751+'-'+_0x252766+'/'+_0x37fd5d)[_0x1c5b('0x31')](_0xbc30a4);}return null;};}function patchUpdates(_0x97d5b2){return function(_0xd4f181){try{jsonpatch[_0x1c5b('0x38')](_0xd4f181,_0x97d5b2,!![]);}catch(_0x2be968){return BPromise['reject'](_0x2be968);}return _0xd4f181['save']();};}function saveUpdates(_0xc06d76,_0x2f497d){return function(_0x29f7a2){if(_0x29f7a2){return _0x29f7a2[_0x1c5b('0x39')](_0xc06d76)[_0x1c5b('0x23')](function(_0x510978){return _0x510978;});}return null;};}function removeEntity(_0x1d194f,_0x5bb521){return function(_0x25abb3){if(_0x25abb3){return _0x25abb3[_0x1c5b('0x3a')]()[_0x1c5b('0x23')](function(){var _0x1be54e=_0x25abb3['get']({'plain':!![]});var _0x138f7e=_0x1c5b('0x3b');return db[_0x1c5b('0x3c')][_0x1c5b('0x3a')]({'where':{'type':_0x138f7e,'resourceId':_0x1be54e['id']}})[_0x1c5b('0x23')](function(){return _0x25abb3;});})[_0x1c5b('0x23')](function(){_0x1d194f['status'](0xcc)[_0x1c5b('0x30')]();});}};}function handleEntityNotFound(_0x514672,_0x275a1c){return function(_0x322514){if(!_0x322514){_0x514672['sendStatus'](0x194);}return _0x322514;};}function handleError(_0xa086dd,_0x160fb9){_0x160fb9=_0x160fb9||0x1f4;return function(_0x5afe1e){logger[_0x1c5b('0x29')](_0x5afe1e[_0x1c5b('0x3d')]);if(_0x5afe1e[_0x1c5b('0x3e')]){delete _0x5afe1e['name'];}_0xa086dd['status'](_0x160fb9)['send'](_0x5afe1e);};}exports['index']=function(_0x379720,_0x35dd32){var _0xe1fd69={'include':[{'model':db[_0x1c5b('0x3f')],'as':_0x1c5b('0x40')},{'model':db[_0x1c5b('0x41')],'as':_0x1c5b('0x42')},{'model':db[_0x1c5b('0x43')],'as':_0x1c5b('0x44')}]},_0x2d5bbd={},_0x4f77dc={'count':0x0,'rows':[]};var _0x1574b6=_[_0x1c5b('0x45')](db[_0x1c5b('0x46')]['rawAttributes'],function(_0x1a71ea){return{'name':_0x1a71ea[_0x1c5b('0x47')],'type':_0x1a71ea[_0x1c5b('0x48')]['key']};});_0x2d5bbd[_0x1c5b('0x49')]=_[_0x1c5b('0x45')](_0x1574b6,_0x1c5b('0x3e'));_0x2d5bbd[_0x1c5b('0x4a')]=_[_0x1c5b('0x4b')](_0x379720['query']);_0x2d5bbd[_0x1c5b('0x4c')]=_['intersection'](_0x2d5bbd['model'],_0x2d5bbd[_0x1c5b('0x4a')]);_0xe1fd69[_0x1c5b('0x4d')]=_[_0x1c5b('0x4e')](_0x2d5bbd[_0x1c5b('0x49')],qs[_0x1c5b('0x4f')](_0x379720[_0x1c5b('0x4a')][_0x1c5b('0x4f')]));_0xe1fd69[_0x1c5b('0x4d')]=_0xe1fd69[_0x1c5b('0x4d')][_0x1c5b('0x50')]?_0xe1fd69['attributes']:_0x2d5bbd['model'];if(!_0x379720[_0x1c5b('0x4a')][_0x1c5b('0x51')](_0x1c5b('0x52'))){_0xe1fd69[_0x1c5b('0x33')]=qs[_0x1c5b('0x33')](_0x379720[_0x1c5b('0x4a')]['limit']);_0xe1fd69[_0x1c5b('0x35')]=qs[_0x1c5b('0x35')](_0x379720[_0x1c5b('0x4a')][_0x1c5b('0x35')]);}_0xe1fd69[_0x1c5b('0x53')]=qs[_0x1c5b('0x54')](_0x379720[_0x1c5b('0x4a')]['sort']);_0xe1fd69[_0x1c5b('0x55')]=qs[_0x1c5b('0x4c')](_[_0x1c5b('0x56')](_0x379720[_0x1c5b('0x4a')],_0x2d5bbd[_0x1c5b('0x4c')]),_0x1574b6);if(_0x379720[_0x1c5b('0x4a')]['filter']){_0xe1fd69[_0x1c5b('0x55')]=_[_0x1c5b('0x57')](_0xe1fd69[_0x1c5b('0x55')],{'$or':_[_0x1c5b('0x45')](_0x1574b6,function(_0x4cae22){if(_0x4cae22[_0x1c5b('0x48')]!==_0x1c5b('0x58')){var _0x32ee4a={};_0x32ee4a[_0x4cae22[_0x1c5b('0x3e')]]={'$like':'%'+_0x379720[_0x1c5b('0x4a')]['filter']+'%'};return _0x32ee4a;}})});}_0xe1fd69=_[_0x1c5b('0x57')]({},_0xe1fd69,_0x379720[_0x1c5b('0x59')]);var _0x146317={'where':_0xe1fd69[_0x1c5b('0x55')]};return db[_0x1c5b('0x46')][_0x1c5b('0x34')](_0x146317)[_0x1c5b('0x23')](function(_0xd9162){_0x4f77dc[_0x1c5b('0x34')]=_0xd9162;if(_0x379720[_0x1c5b('0x4a')][_0x1c5b('0x5a')]){_0xe1fd69[_0x1c5b('0x5b')]=[{'all':!![]}];}return db[_0x1c5b('0x46')][_0x1c5b('0x5c')](_0xe1fd69);})[_0x1c5b('0x23')](function(_0x260c6b){_0x4f77dc[_0x1c5b('0x5d')]=_0x260c6b;return _0x4f77dc;})[_0x1c5b('0x23')](respondWithFilteredResult(_0x35dd32,_0xe1fd69))[_0x1c5b('0x2d')](handleError(_0x35dd32,null));};exports[_0x1c5b('0x5e')]=function(_0x4df766,_0x219fd6){var _0x4bafee={'raw':![],'where':{'id':_0x4df766['params']['id']},'include':[{'model':db[_0x1c5b('0x3f')],'as':_0x1c5b('0x40')},{'model':db[_0x1c5b('0x41')],'as':_0x1c5b('0x42')},{'model':db[_0x1c5b('0x43')],'as':_0x1c5b('0x44')}]},_0x42d00c={};_0x42d00c[_0x1c5b('0x49')]=_[_0x1c5b('0x4b')](db['MailAccount']['rawAttributes']);_0x42d00c[_0x1c5b('0x4a')]=_[_0x1c5b('0x4b')](_0x4df766[_0x1c5b('0x4a')]);_0x42d00c['filters']=_['intersection'](_0x42d00c[_0x1c5b('0x49')],_0x42d00c['query']);_0x4bafee[_0x1c5b('0x4d')]=_['intersection'](_0x42d00c[_0x1c5b('0x49')],qs['fields'](_0x4df766[_0x1c5b('0x4a')][_0x1c5b('0x4f')]));_0x4bafee[_0x1c5b('0x4d')]=_0x4bafee[_0x1c5b('0x4d')][_0x1c5b('0x50')]?_0x4bafee[_0x1c5b('0x4d')]:_0x42d00c[_0x1c5b('0x49')];if(_0x4df766[_0x1c5b('0x4a')]['includeAll']){_0x4bafee[_0x1c5b('0x5b')]=[{'all':!![]}];}_0x4bafee=_[_0x1c5b('0x57')]({},_0x4bafee,_0x4df766['options']);return db[_0x1c5b('0x46')][_0x1c5b('0x5f')](_0x4bafee)[_0x1c5b('0x23')](handleEntityNotFound(_0x219fd6,null))[_0x1c5b('0x23')](respondWithResult(_0x219fd6,null))[_0x1c5b('0x2d')](handleError(_0x219fd6,null));};exports[_0x1c5b('0x39')]=function(_0x3ec946,_0x414885){if(_0x3ec946[_0x1c5b('0x60')]['id']){delete _0x3ec946[_0x1c5b('0x60')]['id'];}return db[_0x1c5b('0x46')][_0x1c5b('0x5f')]({'where':{'id':_0x3ec946[_0x1c5b('0x61')]['id']},'include':[{'model':db[_0x1c5b('0x3f')],'as':_0x1c5b('0x40')},{'model':db[_0x1c5b('0x41')],'as':'Smtp'},{'model':db[_0x1c5b('0x43')],'as':_0x1c5b('0x44')}]})['then'](handleEntityNotFound(_0x414885,null))['then'](saveUpdates(_0x3ec946[_0x1c5b('0x60')],null))[_0x1c5b('0x23')](function(_0x448b1f){if(_0x448b1f&&_0x3ec946[_0x1c5b('0x60')]['Imap']){return db[_0x1c5b('0x3f')]['update'](_0x3ec946['body'][_0x1c5b('0x40')],{'where':{'MailAccountId':_0x448b1f['id']}})[_0x1c5b('0x23')](function(){return _0x448b1f;});}return _0x448b1f;})['then'](function(_0x59d03){if(_0x59d03&&_0x3ec946[_0x1c5b('0x60')][_0x1c5b('0x42')]){return db[_0x1c5b('0x41')][_0x1c5b('0x39')](_0x3ec946[_0x1c5b('0x60')][_0x1c5b('0x42')],{'where':{'MailAccountId':_0x59d03['id']}})['then'](function(){return _0x59d03;});}return _0x59d03;})['then'](respondWithResult(_0x414885,null))[_0x1c5b('0x2d')](handleError(_0x414885,null));};exports['describe']=function(_0x5c203d,_0x585e4d){return db['MailAccount']['describe']()[_0x1c5b('0x23')](respondWithResult(_0x585e4d,null))[_0x1c5b('0x2d')](handleError(_0x585e4d,null));};exports[_0x1c5b('0x62')]=function(_0x3c7203,_0x6cfbc2,_0x2f0880){if(_0x3c7203['body']['id']){delete _0x3c7203[_0x1c5b('0x60')]['id'];}return db[_0x1c5b('0x46')][_0x1c5b('0x5f')]({'where':{'id':_0x3c7203[_0x1c5b('0x61')]['id']}})[_0x1c5b('0x23')](handleEntityNotFound(_0x6cfbc2,null))['then'](function(_0x10d4f0){if(_0x10d4f0){_0x3c7203[_0x1c5b('0x60')]['MailAccountId']=_0x10d4f0['id'];return db[_0x1c5b('0x63')]['create'](_0x3c7203[_0x1c5b('0x60')]);}})[_0x1c5b('0x23')](respondWithResult(_0x6cfbc2,null))[_0x1c5b('0x2d')](handleError(_0x6cfbc2,null));};exports[_0x1c5b('0x64')]=function(_0x13e32f,_0x1162fb,_0x13c131){var _0x566ecb={'raw':![],'where':{}};var _0x356a7e={};var _0x2293c3={'count':0x0,'rows':[]};return db[_0x1c5b('0x46')]['findOne']({'where':{'id':_0x13e32f[_0x1c5b('0x61')]['id']}})[_0x1c5b('0x23')](handleEntityNotFound(_0x1162fb,null))[_0x1c5b('0x23')](function(_0x417000){if(_0x417000){_0x356a7e[_0x1c5b('0x49')]=_[_0x1c5b('0x4b')](db[_0x1c5b('0x63')][_0x1c5b('0x65')]);_0x356a7e[_0x1c5b('0x4a')]=_[_0x1c5b('0x4b')](_0x13e32f[_0x1c5b('0x4a')]);_0x356a7e[_0x1c5b('0x4c')]=_[_0x1c5b('0x4e')](_0x356a7e[_0x1c5b('0x49')],_0x356a7e[_0x1c5b('0x4a')]);_0x566ecb['attributes']=_[_0x1c5b('0x4e')](_0x356a7e[_0x1c5b('0x49')],qs[_0x1c5b('0x4f')](_0x13e32f[_0x1c5b('0x4a')][_0x1c5b('0x4f')]));_0x566ecb[_0x1c5b('0x4d')]=_0x566ecb[_0x1c5b('0x4d')][_0x1c5b('0x50')]?_0x566ecb[_0x1c5b('0x4d')]:_0x356a7e[_0x1c5b('0x49')];if(!_0x13e32f[_0x1c5b('0x4a')][_0x1c5b('0x51')](_0x1c5b('0x52'))){_0x566ecb[_0x1c5b('0x33')]=qs[_0x1c5b('0x33')](_0x13e32f[_0x1c5b('0x4a')][_0x1c5b('0x33')]);_0x566ecb[_0x1c5b('0x35')]=qs[_0x1c5b('0x35')](_0x13e32f[_0x1c5b('0x4a')][_0x1c5b('0x35')]);}_0x566ecb[_0x1c5b('0x53')]=qs[_0x1c5b('0x54')](_0x13e32f['query']['sort']);_0x566ecb[_0x1c5b('0x55')]=qs['filters'](_[_0x1c5b('0x56')](_0x13e32f[_0x1c5b('0x4a')],_0x356a7e[_0x1c5b('0x4c')]));_0x566ecb['where'][_0x1c5b('0x66')]=_0x417000['id'];if(_0x13e32f[_0x1c5b('0x4a')][_0x1c5b('0x67')]){_0x566ecb[_0x1c5b('0x55')]=_[_0x1c5b('0x57')](_0x566ecb[_0x1c5b('0x55')],{'$or':_['map'](_0x566ecb[_0x1c5b('0x4d')],function(_0x48c6aa){var _0x11fa0d={};_0x11fa0d[_0x48c6aa]={'$like':'%'+_0x13e32f[_0x1c5b('0x4a')][_0x1c5b('0x67')]+'%'};return _0x11fa0d;})});}_0x566ecb=_[_0x1c5b('0x57')]({},_0x566ecb,_0x13e32f[_0x1c5b('0x59')]);return db[_0x1c5b('0x63')][_0x1c5b('0x34')]({'where':_0x566ecb['where']})[_0x1c5b('0x23')](function(_0x4b4052){_0x2293c3[_0x1c5b('0x34')]=_0x4b4052;if(_0x13e32f[_0x1c5b('0x4a')][_0x1c5b('0x5a')]){_0x566ecb[_0x1c5b('0x5b')]=[{'all':!![]}];}return db[_0x1c5b('0x63')][_0x1c5b('0x5c')](_0x566ecb);})[_0x1c5b('0x23')](function(_0x2cfbd1){_0x2293c3[_0x1c5b('0x5d')]=_0x2cfbd1;return _0x2293c3;});}})['then'](respondWithFilteredResult(_0x1162fb,_0x566ecb))['catch'](handleError(_0x1162fb,null));};exports[_0x1c5b('0x68')]=function(_0x514f92,_0x299ac8,_0x22d8eb){return db['MailAccount'][_0x1c5b('0x5f')]({'where':{'id':_0x514f92[_0x1c5b('0x61')]['id']}})['then'](handleEntityNotFound(_0x299ac8,null))['then'](function(_0x761e82){if(_0x761e82){return _0x761e82[_0x1c5b('0x68')](_0x514f92[_0x1c5b('0x4a')][_0x1c5b('0x69')]);}})['then'](respondWithStatusCode(_0x299ac8,null))['catch'](handleError(_0x299ac8,null));};exports['addAnswer']=function(_0x617e5c,_0x10c7b8,_0x5170f3){if(_0x617e5c[_0x1c5b('0x60')]['id']){delete _0x617e5c[_0x1c5b('0x60')]['id'];}return db[_0x1c5b('0x46')][_0x1c5b('0x5f')]({'where':{'id':_0x617e5c[_0x1c5b('0x61')]['id']}})['then'](handleEntityNotFound(_0x10c7b8,null))[_0x1c5b('0x23')](function(_0x3b90d8){if(_0x3b90d8){_0x617e5c['body'][_0x1c5b('0x66')]=_0x3b90d8['id'];return db[_0x1c5b('0x6a')][_0x1c5b('0x6b')](_0x617e5c[_0x1c5b('0x60')]);}})[_0x1c5b('0x23')](respondWithResult(_0x10c7b8,null))['catch'](handleError(_0x10c7b8,null));};exports[_0x1c5b('0x6c')]=function(_0x77c70d,_0x5c6c71,_0x5c716f){var _0x3795b4={'raw':![],'where':{}};var _0x2328fd={};var _0x46cb0f={'count':0x0,'rows':[]};return db[_0x1c5b('0x46')][_0x1c5b('0x6d')]({'where':{'id':_0x77c70d['params']['id']}})[_0x1c5b('0x23')](handleEntityNotFound(_0x5c6c71,null))[_0x1c5b('0x23')](function(_0x175619){if(_0x175619){_0x2328fd['model']=_[_0x1c5b('0x4b')](db[_0x1c5b('0x6a')]['rawAttributes']);_0x2328fd[_0x1c5b('0x4a')]=_['keys'](_0x77c70d[_0x1c5b('0x4a')]);_0x2328fd[_0x1c5b('0x4c')]=_['intersection'](_0x2328fd[_0x1c5b('0x49')],_0x2328fd[_0x1c5b('0x4a')]);_0x3795b4[_0x1c5b('0x4d')]=_[_0x1c5b('0x4e')](_0x2328fd[_0x1c5b('0x49')],qs[_0x1c5b('0x4f')](_0x77c70d[_0x1c5b('0x4a')][_0x1c5b('0x4f')]));_0x3795b4[_0x1c5b('0x4d')]=_0x3795b4[_0x1c5b('0x4d')][_0x1c5b('0x50')]?_0x3795b4[_0x1c5b('0x4d')]:_0x2328fd['model'];if(!_0x77c70d[_0x1c5b('0x4a')][_0x1c5b('0x51')](_0x1c5b('0x52'))){_0x3795b4[_0x1c5b('0x33')]=qs[_0x1c5b('0x33')](_0x77c70d[_0x1c5b('0x4a')]['limit']);_0x3795b4[_0x1c5b('0x35')]=qs[_0x1c5b('0x35')](_0x77c70d[_0x1c5b('0x4a')][_0x1c5b('0x35')]);}_0x3795b4['order']=qs[_0x1c5b('0x54')](_0x77c70d['query'][_0x1c5b('0x54')]);_0x3795b4[_0x1c5b('0x55')]=qs[_0x1c5b('0x4c')](_[_0x1c5b('0x56')](_0x77c70d[_0x1c5b('0x4a')],_0x2328fd['filters']));_0x3795b4[_0x1c5b('0x55')]['MailAccountId']=_0x175619['id'];if(_0x77c70d[_0x1c5b('0x4a')][_0x1c5b('0x67')]){_0x3795b4[_0x1c5b('0x55')]=_['merge'](_0x3795b4[_0x1c5b('0x55')],{'$or':_['map'](_0x3795b4[_0x1c5b('0x4d')],function(_0x439e12){var _0x22fcc7={};_0x22fcc7[_0x439e12]={'$like':'%'+_0x77c70d[_0x1c5b('0x4a')][_0x1c5b('0x67')]+'%'};return _0x22fcc7;})});}_0x3795b4=_['merge']({},_0x3795b4,_0x77c70d[_0x1c5b('0x59')]);return db[_0x1c5b('0x6a')][_0x1c5b('0x34')]({'where':_0x3795b4['where']})[_0x1c5b('0x23')](function(_0x111143){_0x46cb0f[_0x1c5b('0x34')]=_0x111143;if(_0x77c70d[_0x1c5b('0x4a')]['includeAll']){_0x3795b4[_0x1c5b('0x5b')]=[{'all':!![]}];}return db[_0x1c5b('0x6a')][_0x1c5b('0x5c')](_0x3795b4);})['then'](function(_0x4478a3){_0x46cb0f[_0x1c5b('0x5d')]=_0x4478a3;return _0x46cb0f;});}})['then'](respondWithFilteredResult(_0x5c6c71,_0x3795b4))[_0x1c5b('0x2d')](handleError(_0x5c6c71,null));};exports[_0x1c5b('0x6e')]=function(_0x310170,_0x1e571b,_0x265392){return db['MailAccount']['find']({'where':{'id':_0x310170[_0x1c5b('0x61')]['id']}})['then'](handleEntityNotFound(_0x1e571b,null))[_0x1c5b('0x23')](function(_0xc47701){if(_0xc47701){return _0xc47701[_0x1c5b('0x6e')](_0x310170[_0x1c5b('0x4a')][_0x1c5b('0x69')]);}})[_0x1c5b('0x23')](respondWithStatusCode(_0x1e571b,null))['catch'](handleError(_0x1e571b,null));};exports['create']=function(_0x3e3a51,_0x1dce65){var _0x497ab8={'name':_0x3e3a51[_0x1c5b('0x60')]['name'],'key':_0x3e3a51[_0x1c5b('0x60')][_0x1c5b('0x6f')],'email':_0x3e3a51[_0x1c5b('0x60')][_0x1c5b('0x70')],'ListId':_0x3e3a51[_0x1c5b('0x60')][_0x1c5b('0x71')],'active':!_[_0x1c5b('0x72')](_0x3e3a51['body'][_0x1c5b('0x73')])?_0x3e3a51[_0x1c5b('0x60')]['active']:!![],'description':_0x3e3a51[_0x1c5b('0x60')]['description']||null,'Imap':{},'Smtp':{}};if(_[_0x1c5b('0x72')](_0x3e3a51['body'][_0x1c5b('0x74')])){if(_0x3e3a51['body']['cauthentication']){_0x497ab8[_0x1c5b('0x40')][_0x1c5b('0x75')]=_0x497ab8[_0x1c5b('0x42')][_0x1c5b('0x75')]=_0x3e3a51[_0x1c5b('0x60')][_0x1c5b('0x76')];_0x497ab8[_0x1c5b('0x40')][_0x1c5b('0x77')]=_0x497ab8[_0x1c5b('0x42')][_0x1c5b('0x78')]=_0x3e3a51[_0x1c5b('0x60')][_0x1c5b('0x79')];}else{_0x497ab8[_0x1c5b('0x40')][_0x1c5b('0x7a')]=_0x497ab8[_0x1c5b('0x42')][_0x1c5b('0x7a')]=![];}_0x497ab8[_0x1c5b('0x40')][_0x1c5b('0x7b')]=_0x3e3a51[_0x1c5b('0x60')][_0x1c5b('0x40')][_0x1c5b('0x7b')];_0x497ab8[_0x1c5b('0x40')][_0x1c5b('0x7c')]=_0x3e3a51[_0x1c5b('0x60')]['Imap'][_0x1c5b('0x7c')];_0x497ab8['Smtp']['host']=_0x3e3a51['body'][_0x1c5b('0x42')][_0x1c5b('0x7b')];_0x497ab8[_0x1c5b('0x42')][_0x1c5b('0x7c')]=_0x3e3a51['body']['Smtp'][_0x1c5b('0x7c')];}else{_0x497ab8['Imap'][_0x1c5b('0x7d')]=_0x497ab8['Smtp'][_0x1c5b('0x7d')]=_0x3e3a51[_0x1c5b('0x60')][_0x1c5b('0x74')];_0x497ab8[_0x1c5b('0x40')][_0x1c5b('0x75')]=_0x497ab8[_0x1c5b('0x42')][_0x1c5b('0x75')]=_0x3e3a51[_0x1c5b('0x60')]['cuser'];_0x497ab8[_0x1c5b('0x40')][_0x1c5b('0x77')]=_0x497ab8[_0x1c5b('0x42')][_0x1c5b('0x78')]=_0x3e3a51['body']['cpassword'];}return db[_0x1c5b('0x46')][_0x1c5b('0x6b')](_0x497ab8,{'include':[{'model':db[_0x1c5b('0x41')],'as':_0x1c5b('0x42')},{'model':db['MailServerIn'],'as':_0x1c5b('0x40')}]})[_0x1c5b('0x23')](function(_0x4e90e5){var _0x21805c=_0x3e3a51[_0x1c5b('0x75')][_0x1c5b('0x7e')]({'plain':!![]});if(!_0x21805c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x21805c[_0x1c5b('0x7f')]===_0x1c5b('0x75')){var _0xd3f8e1=_0x4e90e5[_0x1c5b('0x7e')]({'plain':!![]});return db[_0x1c5b('0x80')][_0x1c5b('0x5f')]({'where':{'name':_0x1c5b('0x3b'),'userProfileId':_0x21805c[_0x1c5b('0x81')]},'raw':!![]})['then'](function(_0x536446){if(_0x536446&&_0x536446[_0x1c5b('0x82')]===0x0){return db[_0x1c5b('0x3c')][_0x1c5b('0x6b')]({'name':_0xd3f8e1['name'],'resourceId':_0xd3f8e1['id'],'type':_0x536446[_0x1c5b('0x3e')],'sectionId':_0x536446['id']},{})[_0x1c5b('0x23')](function(){return _0x4e90e5;});}else{return _0x4e90e5;}})[_0x1c5b('0x2d')](function(_0x4ee1a5){logger[_0x1c5b('0x29')](_0x1c5b('0x83'),_0x4ee1a5);throw _0x4ee1a5;});}return _0x4e90e5;})[_0x1c5b('0x23')](respondWithResult(_0x1dce65,0xc9))[_0x1c5b('0x2d')](handleError(_0x1dce65,null));};exports[_0x1c5b('0x84')]=function(_0x41751f,_0x2c0362,_0x2cbfc8){return db[_0x1c5b('0x46')]['findOne']({'where':{'id':_0x41751f[_0x1c5b('0x61')]['id']}})[_0x1c5b('0x23')](handleEntityNotFound(_0x2c0362,null))['then'](function(_0x35a8f2){if(_0x35a8f2){return _0x35a8f2['getImap']();}return null;})[_0x1c5b('0x23')](respondWithResult(_0x2c0362,null))['catch'](handleError(_0x2c0362,null));};exports['addImap']=function(_0x2ec390,_0x37d1ed,_0x11a011){if(_0x2ec390['body']['id']){delete _0x2ec390['body']['id'];}return db['MailAccount'][_0x1c5b('0x5f')]({'where':{'id':_0x2ec390[_0x1c5b('0x61')]['id']}})['then'](handleEntityNotFound(_0x37d1ed,null))[_0x1c5b('0x23')](function(_0x88472a){if(_0x88472a){_0x2ec390[_0x1c5b('0x60')][_0x1c5b('0x66')]=_0x88472a['id'];return db[_0x1c5b('0x3f')][_0x1c5b('0x6b')](_0x2ec390[_0x1c5b('0x60')]);}})[_0x1c5b('0x23')](respondWithResult(_0x37d1ed,null))[_0x1c5b('0x2d')](handleError(_0x37d1ed,null));};exports[_0x1c5b('0x85')]=function(_0x44e8fa,_0x2e2c11,_0x5198be){return db['MailAccount'][_0x1c5b('0x6d')]({'where':{'id':_0x44e8fa[_0x1c5b('0x61')]['id']}})['then'](handleEntityNotFound(_0x2e2c11,null))[_0x1c5b('0x23')](function(_0x1e440d){if(_0x1e440d){return _0x1e440d[_0x1c5b('0x86')](null);}return null;})[_0x1c5b('0x23')](respondWithStatusCode(_0x2e2c11,null))[_0x1c5b('0x2d')](handleError(_0x2e2c11,null));};exports[_0x1c5b('0x87')]=function(_0x1e0967,_0x1b9d7a,_0x227122){return db[_0x1c5b('0x46')][_0x1c5b('0x6d')]({'where':{'id':_0x1e0967['params']['id']}})[_0x1c5b('0x23')](handleEntityNotFound(_0x1b9d7a,null))[_0x1c5b('0x23')](function(_0x2c0b2b){if(_0x2c0b2b){return _0x2c0b2b[_0x1c5b('0x87')]();}return null;})[_0x1c5b('0x23')](respondWithResult(_0x1b9d7a,null))[_0x1c5b('0x2d')](handleError(_0x1b9d7a,null));};exports[_0x1c5b('0x88')]=function(_0x4fcdf5,_0x527b67,_0x1e4db7){if(_0x4fcdf5[_0x1c5b('0x60')]['id']){delete _0x4fcdf5['body']['id'];}return db[_0x1c5b('0x46')][_0x1c5b('0x5f')]({'where':{'id':_0x4fcdf5['params']['id']}})[_0x1c5b('0x23')](handleEntityNotFound(_0x527b67,null))[_0x1c5b('0x23')](function(_0x33d0b3){if(_0x33d0b3){_0x4fcdf5['body'][_0x1c5b('0x66')]=_0x33d0b3['id'];return db['MailServerOut'][_0x1c5b('0x6b')](_0x4fcdf5[_0x1c5b('0x60')]);}})['then'](respondWithResult(_0x527b67,null))[_0x1c5b('0x2d')](handleError(_0x527b67,null));};exports[_0x1c5b('0x89')]=function(_0x496de1,_0xc87808,_0x56ff36){return db[_0x1c5b('0x46')][_0x1c5b('0x6d')]({'where':{'id':_0x496de1[_0x1c5b('0x61')]['id']}})[_0x1c5b('0x23')](handleEntityNotFound(_0xc87808,null))[_0x1c5b('0x23')](function(_0x5aa90a){if(_0x5aa90a){return _0x5aa90a[_0x1c5b('0x8a')](null);}return null;})['then'](respondWithStatusCode(_0xc87808,null))[_0x1c5b('0x2d')](handleError(_0xc87808,null));};exports[_0x1c5b('0x8b')]=function(_0x35d58a,_0x2eb494,_0x21c2c3){return db['MailInteraction'][_0x1c5b('0x5f')]({'where':{'id':_0x35d58a['params']['id']}})[_0x1c5b('0x23')](handleEntityNotFound(_0x2eb494,null))[_0x1c5b('0x23')](function(_0x18e850){if(_0x18e850){return _0x18e850[_0x1c5b('0x8b')](_0x35d58a[_0x1c5b('0x60')][_0x1c5b('0x69')],_['omit'](_0x35d58a[_0x1c5b('0x60')],[_0x1c5b('0x69'),'id'])||{});}})[_0x1c5b('0x23')](respondWithResult(_0x2eb494,null))[_0x1c5b('0x2d')](handleError(_0x2eb494,null));};exports[_0x1c5b('0x8c')]=function(_0x984c8d,_0x5bb2f8,_0x1a9f30){var _0x5a8966={'raw':![],'where':{}};var _0x2ec072={};var _0x32dd29={'count':0x0,'rows':[]};return db[_0x1c5b('0x46')][_0x1c5b('0x6d')]({'where':{'id':_0x984c8d[_0x1c5b('0x61')]['id']}})['then'](handleEntityNotFound(_0x5bb2f8,null))[_0x1c5b('0x23')](function(_0x4ec069){if(_0x4ec069){_0x2ec072[_0x1c5b('0x49')]=_[_0x1c5b('0x4b')](db['MailInteraction']['rawAttributes']);_0x2ec072[_0x1c5b('0x4a')]=_[_0x1c5b('0x4b')](_0x984c8d[_0x1c5b('0x4a')]);_0x2ec072[_0x1c5b('0x4c')]=_['intersection'](_0x2ec072[_0x1c5b('0x49')],_0x2ec072[_0x1c5b('0x4a')]);_0x5a8966[_0x1c5b('0x4d')]=_[_0x1c5b('0x4e')](_0x2ec072[_0x1c5b('0x49')],qs[_0x1c5b('0x4f')](_0x984c8d[_0x1c5b('0x4a')]['fields']));_0x5a8966['attributes']=_0x5a8966[_0x1c5b('0x4d')][_0x1c5b('0x50')]?_0x5a8966[_0x1c5b('0x4d')]:_0x2ec072[_0x1c5b('0x49')];if(!_0x984c8d[_0x1c5b('0x4a')][_0x1c5b('0x51')](_0x1c5b('0x52'))){_0x5a8966[_0x1c5b('0x33')]=qs[_0x1c5b('0x33')](_0x984c8d[_0x1c5b('0x4a')]['limit']);_0x5a8966[_0x1c5b('0x35')]=qs[_0x1c5b('0x35')](_0x984c8d[_0x1c5b('0x4a')][_0x1c5b('0x35')]);}_0x5a8966[_0x1c5b('0x53')]=qs[_0x1c5b('0x54')](_0x984c8d[_0x1c5b('0x4a')][_0x1c5b('0x54')]);_0x5a8966[_0x1c5b('0x55')]=qs['filters'](_['pick'](_0x984c8d['query'],_0x2ec072['filters']));_0x5a8966['where'][_0x1c5b('0x66')]=_0x4ec069['id'];if(_0x984c8d[_0x1c5b('0x4a')][_0x1c5b('0x67')]){_0x5a8966[_0x1c5b('0x55')]=_[_0x1c5b('0x57')](_0x5a8966[_0x1c5b('0x55')],{'$or':_[_0x1c5b('0x45')](_0x5a8966[_0x1c5b('0x4d')],function(_0xb1f9c3){var _0x33531a={};_0x33531a[_0xb1f9c3]={'$like':'%'+_0x984c8d[_0x1c5b('0x4a')][_0x1c5b('0x67')]+'%'};return _0x33531a;})});}_0x5a8966=_[_0x1c5b('0x57')]({},_0x5a8966,_0x984c8d[_0x1c5b('0x59')]);return db['MailInteraction'][_0x1c5b('0x34')]({'where':_0x5a8966[_0x1c5b('0x55')]})[_0x1c5b('0x23')](function(_0x4d50c0){_0x32dd29[_0x1c5b('0x34')]=_0x4d50c0;if(_0x984c8d['query']['includeAll']){_0x5a8966['include']=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x1c5b('0x8d')],'as':_0x1c5b('0x8e'),'attributes':[_0x1c5b('0x3e'),_0x1c5b('0x8f'),_0x1c5b('0x90')],'required':![]},{'model':db['Tag'],'as':_0x1c5b('0x91'),'attributes':['id',_0x1c5b('0x3e'),_0x1c5b('0x92')],'where':_0x984c8d[_0x1c5b('0x4a')]['tag']?{'id':_0x984c8d['query'][_0x1c5b('0x93')]}:undefined,'required':_0x984c8d[_0x1c5b('0x4a')][_0x1c5b('0x93')]?!![]:![]}];}return db[_0x1c5b('0x94')][_0x1c5b('0x5c')](_0x5a8966);})[_0x1c5b('0x23')](function(_0x40635e){_0x32dd29['rows']=_0x40635e;return _0x32dd29;});}})[_0x1c5b('0x23')](respondWithFilteredResult(_0x5bb2f8,_0x5a8966))[_0x1c5b('0x2d')](handleError(_0x5bb2f8,null));};exports[_0x1c5b('0x95')]=function(_0x12eae0,_0x3c0703,_0xee74e0){return db[_0x1c5b('0x46')]['findOne']({'where':{'id':_0x12eae0[_0x1c5b('0x61')]['id']}})[_0x1c5b('0x23')](handleEntityNotFound(_0x3c0703,null))[_0x1c5b('0x23')](function(_0x5e8e70){if(_0x5e8e70){return db[_0x1c5b('0x96')][_0x1c5b('0x97')](function(_0x2ab39e){return db[_0x1c5b('0x98')][_0x1c5b('0x3a')]({'where':{'MailAccountId':_0x12eae0[_0x1c5b('0x61')]['id']},'transaction':_0x2ab39e})['then'](function(_0x4a8fbc){var _0x89bd16=_[_0x1c5b('0x45')](_0x12eae0[_0x1c5b('0x60')],function(_0x320cfb){_0x320cfb['MailAccountId']=_0x12eae0[_0x1c5b('0x61')]['id'];return _0x320cfb;});return db[_0x1c5b('0x98')]['bulkCreate'](_0x89bd16,{'transaction':_0x2ab39e});});})[_0x1c5b('0x23')](function(){return db[_0x1c5b('0x98')][_0x1c5b('0x99')]({'where':{'MailAccountId':_0x12eae0[_0x1c5b('0x61')]['id']},'order':'priority'});});}})[_0x1c5b('0x23')](respondWithResult(_0x3c0703,null))['catch'](handleError(_0x3c0703,null));};exports[_0x1c5b('0x9a')]=function(_0x4a93b8,_0x2889c0,_0x7c6637){var _0x57c6ac={};var _0x578882={};var _0x40cbce;var _0x133c30;return db[_0x1c5b('0x46')][_0x1c5b('0x6d')]({'where':{'id':_0x4a93b8[_0x1c5b('0x61')]['id']}})[_0x1c5b('0x23')](handleEntityNotFound(_0x2889c0,null))['then'](function(_0x238acb){if(_0x238acb){_0x40cbce=_0x238acb;_0x578882[_0x1c5b('0x49')]=_[_0x1c5b('0x4b')](db[_0x1c5b('0x98')][_0x1c5b('0x65')]);_0x578882['query']=_[_0x1c5b('0x4b')](_0x4a93b8[_0x1c5b('0x4a')]);_0x578882[_0x1c5b('0x4c')]=_[_0x1c5b('0x4e')](_0x578882[_0x1c5b('0x49')],_0x578882[_0x1c5b('0x4a')]);_0x57c6ac[_0x1c5b('0x4d')]=_['intersection'](_0x578882[_0x1c5b('0x49')],qs[_0x1c5b('0x4f')](_0x4a93b8[_0x1c5b('0x4a')]['fields']));_0x57c6ac[_0x1c5b('0x4d')]=_0x57c6ac[_0x1c5b('0x4d')][_0x1c5b('0x50')]?_0x57c6ac[_0x1c5b('0x4d')]:_0x578882[_0x1c5b('0x49')];_0x57c6ac[_0x1c5b('0x53')]=qs['sort'](_0x4a93b8[_0x1c5b('0x4a')][_0x1c5b('0x54')]);_0x57c6ac[_0x1c5b('0x55')]=qs[_0x1c5b('0x4c')](_[_0x1c5b('0x56')](_0x4a93b8[_0x1c5b('0x4a')],_0x578882[_0x1c5b('0x4c')]));if(_0x4a93b8['query'][_0x1c5b('0x67')]){_0x57c6ac[_0x1c5b('0x55')]=_[_0x1c5b('0x57')](_0x57c6ac[_0x1c5b('0x55')],{'$or':_[_0x1c5b('0x45')](_0x57c6ac['attributes'],function(_0x4d634b){var _0x238944={};_0x238944[_0x4d634b]={'$like':'%'+_0x4a93b8[_0x1c5b('0x4a')][_0x1c5b('0x67')]+'%'};return _0x238944;})});}_0x57c6ac=_[_0x1c5b('0x57')]({},_0x57c6ac,_0x4a93b8[_0x1c5b('0x59')]);return _0x40cbce['getApplications'](_0x57c6ac);}})['then'](function(_0x178c5b){if(_0x178c5b){_0x133c30=_0x178c5b['length'];if(!_0x4a93b8[_0x1c5b('0x4a')][_0x1c5b('0x51')](_0x1c5b('0x52'))){_0x57c6ac[_0x1c5b('0x33')]=qs[_0x1c5b('0x33')](_0x4a93b8[_0x1c5b('0x4a')][_0x1c5b('0x33')]);_0x57c6ac['offset']=qs['offset'](_0x4a93b8['query']['offset']);}return _0x40cbce[_0x1c5b('0x9a')](_0x57c6ac);}})[_0x1c5b('0x23')](function(_0x518b83){if(_0x518b83){return _0x518b83?{'count':_0x133c30,'rows':_0x518b83}:null;}})[_0x1c5b('0x23')](respondWithResult(_0x2889c0,null))['catch'](handleError(_0x2889c0,null));};exports[_0x1c5b('0x9b')]=function(_0x4449de,_0x2ae5ac,_0x408a9a){var _0x1eb3cc={'raw':!![],'where':{}};var _0x1206c0={};var _0x51ef03={'count':0x0,'rows':[]};return db[_0x1c5b('0x46')][_0x1c5b('0x6d')]({'where':{'id':_0x4449de[_0x1c5b('0x61')]['id']}})[_0x1c5b('0x23')](handleEntityNotFound(_0x2ae5ac,null))[_0x1c5b('0x23')](function(_0x3f4f7e){if(_0x3f4f7e){_0x1206c0['model']=_['keys'](db[_0x1c5b('0x9c')][_0x1c5b('0x65')]);_0x1206c0['query']=_['keys'](_0x4449de[_0x1c5b('0x4a')]);_0x1206c0[_0x1c5b('0x4c')]=_[_0x1c5b('0x4e')](_0x1206c0['model'],_0x1206c0[_0x1c5b('0x4a')]);_0x1eb3cc[_0x1c5b('0x4d')]=_['intersection'](_0x1206c0[_0x1c5b('0x49')],qs[_0x1c5b('0x4f')](_0x4449de[_0x1c5b('0x4a')][_0x1c5b('0x4f')]));_0x1eb3cc['attributes']=_0x1eb3cc[_0x1c5b('0x4d')]['length']?_0x1eb3cc[_0x1c5b('0x4d')]:_0x1206c0['model'];if(!_0x4449de[_0x1c5b('0x4a')][_0x1c5b('0x51')](_0x1c5b('0x52'))){_0x1eb3cc[_0x1c5b('0x33')]=qs[_0x1c5b('0x33')](_0x4449de[_0x1c5b('0x4a')]['limit']);_0x1eb3cc['offset']=qs[_0x1c5b('0x35')](_0x4449de[_0x1c5b('0x4a')]['offset']);}_0x1eb3cc['order']=qs[_0x1c5b('0x54')](_0x4449de[_0x1c5b('0x4a')][_0x1c5b('0x54')]);_0x1eb3cc[_0x1c5b('0x55')]=qs[_0x1c5b('0x4c')](_['pick'](_0x4449de[_0x1c5b('0x4a')],_0x1206c0[_0x1c5b('0x4c')]));_0x1eb3cc[_0x1c5b('0x55')][_0x1c5b('0x66')]=_0x3f4f7e['id'];if(_0x4449de[_0x1c5b('0x4a')][_0x1c5b('0x67')]){_0x1eb3cc['where']=_[_0x1c5b('0x57')](_0x1eb3cc[_0x1c5b('0x55')],{'$or':_[_0x1c5b('0x45')](_0x1eb3cc[_0x1c5b('0x4d')],function(_0x190672){var _0x2def49={};_0x2def49[_0x190672]={'$like':'%'+_0x4449de[_0x1c5b('0x4a')][_0x1c5b('0x67')]+'%'};return _0x2def49;})});}if(_0x4449de['query'][_0x1c5b('0x9d')]){var _0xf2ec3f=_0x4449de[_0x1c5b('0x4a')][_0x1c5b('0x9d')]['split'](',');var _0x387bb5={};_0x387bb5[_0xf2ec3f[0x0]]={'$gte':moment(_0xf2ec3f[0x1])[_0x1c5b('0x9e')](_0x1c5b('0x9f'))};_0x1eb3cc['where']=_['merge'](_0x1eb3cc['where'],_0x387bb5);}_0x1eb3cc=_['merge']({},_0x1eb3cc,_0x4449de[_0x1c5b('0x59')]);return db['MailMessage'][_0x1c5b('0x34')]({'where':_0x1eb3cc['where']})[_0x1c5b('0x23')](function(_0x4d9e86){_0x51ef03[_0x1c5b('0x34')]=_0x4d9e86;if(_0x4449de[_0x1c5b('0x4a')][_0x1c5b('0x5a')]){_0x1eb3cc['include']=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x1eb3cc);})['then'](function(_0x1766ad){if(_0x4449de['query']['inlineCss']===_0x1c5b('0xa0')){for(var _0x590ac6=0x0;_0x590ac6<_0x1766ad['length'];_0x590ac6++){_0x1766ad[_0x590ac6][_0x1c5b('0x60')]=juice(_0x1766ad[_0x590ac6][_0x1c5b('0x60')]);}}_0x51ef03['rows']=_0x1766ad;return _0x51ef03;});}})[_0x1c5b('0x23')](respondWithFilteredResult(_0x2ae5ac,_0x1eb3cc))[_0x1c5b('0x2d')](handleError(_0x2ae5ac,null));};exports[_0x1c5b('0xa1')]=function(_0x167de2,_0x4351fb,_0x189e90){var _0x32ecda,_0x3afb24={},_0x4839db;if(_0x167de2[_0x1c5b('0x60')]['to']){_0x4839db=_0x167de2['body']['to'][_0x1c5b('0xa2')](',')[0x0];}return db[_0x1c5b('0x46')][_0x1c5b('0x5f')]({'where':{'id':_0x167de2[_0x1c5b('0x61')]['id']},'include':[{'model':db[_0x1c5b('0xa3')],'as':_0x1c5b('0xa4'),'include':[{'model':db['CmContact'],'as':_0x1c5b('0xa5'),'where':{'email':_0x4839db},'limit':0x1,'order':[['updatedAt',_0x1c5b('0xa6')]]}]},{'model':db['MailServerOut'],'as':_0x1c5b('0x42'),'raw':!![]}]})[_0x1c5b('0x23')](handleEntityNotFound(_0x4351fb,null))[_0x1c5b('0x23')](function(_0x55fda7){if(_0x55fda7){_0x32ecda=_0x55fda7;if(_0x55fda7[_0x1c5b('0x42')]){if(_[_0x1c5b('0x72')](_0x167de2[_0x1c5b('0x60')][_0x1c5b('0xa7')])){_0x167de2[_0x1c5b('0x60')][_0x1c5b('0xa7')]=util['format'](_0x1c5b('0xa8'),_0x55fda7[_0x1c5b('0x3e')],_0x55fda7[_0x1c5b('0x70')]||_0x55fda7[_0x1c5b('0x42')][_0x1c5b('0x75')]);}if(_0x167de2['body'][_0x1c5b('0xa9')]&&_0x167de2[_0x1c5b('0x60')][_0x1c5b('0xa9')][_0x1c5b('0x50')]){for(var _0x5c93db=0x0;_0x5c93db<_0x167de2[_0x1c5b('0x60')][_0x1c5b('0xa9')][_0x1c5b('0x50')];_0x5c93db+=0x1){_0x167de2[_0x1c5b('0x60')][_0x1c5b('0xa9')][_0x5c93db]={'filename':_0x167de2[_0x1c5b('0x60')][_0x1c5b('0xa9')][_0x5c93db][_0x1c5b('0x3e')],'path':path[_0x1c5b('0xaa')](config[_0x1c5b('0xab')],'server/files/attachments',_0x167de2[_0x1c5b('0x60')][_0x1c5b('0xa9')][_0x5c93db][_0x1c5b('0xac')])};}}var _0x1feee9={'tls':{'rejectUnauthorized':![]}};if(_[_0x1c5b('0x72')](_0x55fda7[_0x1c5b('0x42')][_0x1c5b('0x7d')])){if(_0x55fda7['Smtp'][_0x1c5b('0x7a')]){_0x1feee9['auth']={'user':_0x55fda7[_0x1c5b('0x42')]['user'],'pass':_0x55fda7[_0x1c5b('0x42')][_0x1c5b('0x78')]};}_0x1feee9[_0x1c5b('0x7b')]=_0x55fda7[_0x1c5b('0x42')][_0x1c5b('0x7b')];_0x1feee9[_0x1c5b('0x7c')]=_0x55fda7['Smtp'][_0x1c5b('0x7c')];_0x1feee9[_0x1c5b('0xad')]=_0x55fda7['Smtp'][_0x1c5b('0xad')];}else{_0x1feee9[_0x1c5b('0x7d')]=_0x55fda7['Smtp'][_0x1c5b('0x7d')];_0x1feee9[_0x1c5b('0xae')]={'user':_0x55fda7[_0x1c5b('0x42')][_0x1c5b('0x75')],'pass':_0x55fda7[_0x1c5b('0x42')][_0x1c5b('0x78')]};}return respondWithRpcPromise(_0x1c5b('0xaf'),_0x1c5b('0xb0'),{'account':_0x1feee9,'message':_0x167de2[_0x1c5b('0x60')]});}else{throw new Error(_0x1c5b('0xb1'));}}})[_0x1c5b('0x23')](function(_0x183464){if(_0x183464){_0x3afb24=_0x183464;if(_0x32ecda[_0x1c5b('0xa4')]){if(_0x32ecda['List']['Contacts'][_0x1c5b('0x50')]){return _0x32ecda['List'][_0x1c5b('0xa5')][0x0];}else{return db[_0x1c5b('0xb2')]['create'](_[_0x1c5b('0x1c')](_0x167de2[_0x1c5b('0x60')],{'firstName':_0x167de2[_0x1c5b('0x60')]['to'],'email':_0x167de2[_0x1c5b('0x60')]['to'],'phone':_0x167de2[_0x1c5b('0x60')]['to'],'ListId':_0x32ecda[_0x1c5b('0x71')]}));}}else{throw new Error(_0x1c5b('0xb1'));}}})[_0x1c5b('0x23')](function(_0xc1c7ce){if(_0xc1c7ce){var _0x36f233={'UserId':_0x167de2['user']['id'],'ContactId':_0xc1c7ce['id'],'MailAccountId':_0x32ecda['id'],'inReplyTo':_0x3afb24[_0x1c5b('0xb3')],'to':_0x167de2[_0x1c5b('0x60')][_0x1c5b('0xa7')],'cc':_0x167de2['body']['cc'],'subject':_0x167de2['body'][_0x1c5b('0xb4')],'attach':_0x167de2[_0x1c5b('0x60')][_0x1c5b('0xb5')],'firstMsgDirection':_0x1c5b('0xb6'),'lastMsgAt':moment()[_0x1c5b('0x9e')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x1c5b('0xb6'),'Messages':[_[_0x1c5b('0x57')](_0x167de2[_0x1c5b('0x60')],{'messageId':_0x3afb24[_0x1c5b('0xb3')],'sentAt':moment()[_0x1c5b('0x9e')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x32ecda['id'],'UserId':_0x167de2[_0x1c5b('0x75')]['id'],'ContactId':_0xc1c7ce['id']})]};if(_0x167de2[_0x1c5b('0x60')][_0x1c5b('0xb7')]){_0x36f233=_[_0x1c5b('0x57')](_0x36f233,_0x167de2[_0x1c5b('0x60')]['Interaction']);}return db[_0x1c5b('0x94')][_0x1c5b('0x6b')](_0x36f233,{'include':[{'model':db[_0x1c5b('0x9c')],'as':_0x1c5b('0xb8')}]});}})[_0x1c5b('0x23')](respondWithResult(_0x4351fb,null))['catch'](handleError(_0x4351fb,null));};exports[_0x1c5b('0xb9')]=function(_0xf76da2,_0x272109,_0x709b8c){return db[_0x1c5b('0x46')][_0x1c5b('0x5f')]({'where':{'id':_0xf76da2[_0x1c5b('0x61')]['id']},'include':[{'model':db[_0x1c5b('0x41')],'as':_0x1c5b('0x42'),'raw':!![]}]})[_0x1c5b('0x23')](handleEntityNotFound(_0x272109,null))[_0x1c5b('0x23')](function(_0x51bc64){if(_0x51bc64&&_0x51bc64[_0x1c5b('0x42')]){var _0x27cb22={'id':_0x51bc64['id'],'tls':{'rejectUnauthorized':![]}};if(_0x51bc64[_0x1c5b('0x42')][_0x1c5b('0x7d')]){_0x27cb22[_0x1c5b('0x7d')]=_0x51bc64[_0x1c5b('0x42')][_0x1c5b('0x7d')];}else{_0x27cb22[_0x1c5b('0x7b')]=_0x51bc64[_0x1c5b('0x42')][_0x1c5b('0x7b')];_0x27cb22['port']=_0x51bc64[_0x1c5b('0x42')][_0x1c5b('0x7c')];_0x27cb22[_0x1c5b('0xad')]=_0x51bc64[_0x1c5b('0x42')][_0x1c5b('0xad')];}if(_0x51bc64[_0x1c5b('0x42')][_0x1c5b('0x7a')]){_0x27cb22[_0x1c5b('0xae')]={'user':_0x51bc64[_0x1c5b('0x42')][_0x1c5b('0x75')],'pass':_0x51bc64[_0x1c5b('0x42')]['pass']};}return respondWithRpcPromise(_0x1c5b('0xba'),_0x1c5b('0xb9'),{'account':_0x27cb22});}})['then'](respondWithResult(_0x272109,null))[_0x1c5b('0x2d')](handleError(_0x272109,null));};exports['destroy']=function(_0x140edf,_0x30ddbf){return db[_0x1c5b('0x46')]['find']({'where':{'id':_0x140edf[_0x1c5b('0x61')]['id']}})[_0x1c5b('0x23')](handleEntityNotFound(_0x30ddbf,null))[_0x1c5b('0x23')](function(_0x16fd3e){if(_0x16fd3e&&_0x16fd3e['service']){throw new db[(_0x1c5b('0xbb'))][(_0x1c5b('0xbc'))](_0x1c5b('0xbd'));}return _0x16fd3e;})[_0x1c5b('0x23')](removeEntity(_0x30ddbf,null))[_0x1c5b('0x2d')](handleError(_0x30ddbf,null));};exports[_0x1c5b('0xbe')]=function(_0x2c3eff,_0x225c40,_0xd39be){return db[_0x1c5b('0x46')][_0x1c5b('0x5f')]({'where':{'id':_0x2c3eff[_0x1c5b('0x61')]['id']}})[_0x1c5b('0x23')](handleEntityNotFound(_0x225c40,null))['then'](function(_0x1254ab){if(_0x1254ab){return _0x1254ab[_0x1c5b('0xbe')](_0x2c3eff[_0x1c5b('0x60')][_0x1c5b('0x69')],_['omit'](_0x2c3eff[_0x1c5b('0x60')],[_0x1c5b('0x69'),'id'])||{})[_0x1c5b('0xbf')](function(_0x1ebc6a){for(var _0x4ac3a3=0x0;_0x4ac3a3<_0x2c3eff[_0x1c5b('0x60')][_0x1c5b('0x69')][_0x1c5b('0x50')];_0x4ac3a3+=0x1){socket[_0x1c5b('0xc0')](_0x1c5b('0xc1'),{'UserId':Number(_0x2c3eff[_0x1c5b('0x60')][_0x1c5b('0x69')][_0x4ac3a3]),'MailAccountId':Number(_0x2c3eff[_0x1c5b('0x61')]['id'])});}return _0x1ebc6a;});}})['then'](respondWithResult(_0x225c40,null))[_0x1c5b('0x2d')](handleError(_0x225c40,null));};exports[_0x1c5b('0xc2')]=function(_0xa5c2c0,_0x6383ed,_0x40b8a5){return db['MailAccount'][_0x1c5b('0x5f')]({'where':{'id':_0xa5c2c0[_0x1c5b('0x61')]['id']}})['then'](handleEntityNotFound(_0x6383ed,null))[_0x1c5b('0x23')](function(_0x4735a2){if(_0x4735a2){return _0x4735a2[_0x1c5b('0xc2')](_0xa5c2c0[_0x1c5b('0x4a')][_0x1c5b('0x69')])['then'](function(){if(_[_0x1c5b('0xc3')](_0xa5c2c0[_0x1c5b('0x4a')]['ids'])){for(var _0x3dfa20=0x0;_0x3dfa20<_0xa5c2c0[_0x1c5b('0x4a')][_0x1c5b('0x69')][_0x1c5b('0x50')];_0x3dfa20+=0x1){socket[_0x1c5b('0xc0')](_0x1c5b('0xc4'),{'UserId':Number(_0xa5c2c0[_0x1c5b('0x4a')][_0x1c5b('0x69')][_0x3dfa20]),'MailAccountId':Number(_0xa5c2c0[_0x1c5b('0x61')]['id'])});}}else{socket[_0x1c5b('0xc0')](_0x1c5b('0xc4'),{'UserId':Number(_0xa5c2c0[_0x1c5b('0x4a')][_0x1c5b('0x69')]),'MailAccountId':Number(_0xa5c2c0[_0x1c5b('0x61')]['id'])});}});}})[_0x1c5b('0x23')](respondWithStatusCode(_0x6383ed,null))[_0x1c5b('0x2d')](handleError(_0x6383ed,null));};exports[_0x1c5b('0xc5')]=function(_0x3d960e,_0xffe2,_0x41c4c4){var _0x44b9c6={};var _0x3678d8={};var _0x588051;var _0x5df9b1;return db[_0x1c5b('0x46')][_0x1c5b('0x6d')]({'where':{'id':_0x3d960e[_0x1c5b('0x61')]['id']}})[_0x1c5b('0x23')](handleEntityNotFound(_0xffe2,null))[_0x1c5b('0x23')](function(_0x523d7d){if(_0x523d7d){_0x588051=_0x523d7d;_0x3678d8['model']=_[_0x1c5b('0x4b')](db[_0x1c5b('0x8d')]['rawAttributes']);_0x3678d8[_0x1c5b('0x4a')]=_[_0x1c5b('0x4b')](_0x3d960e[_0x1c5b('0x4a')]);_0x3678d8[_0x1c5b('0x4c')]=_[_0x1c5b('0x4e')](_0x3678d8[_0x1c5b('0x49')],_0x3678d8[_0x1c5b('0x4a')]);_0x44b9c6[_0x1c5b('0x4d')]=_[_0x1c5b('0x4e')](_0x3678d8[_0x1c5b('0x49')],qs[_0x1c5b('0x4f')](_0x3d960e[_0x1c5b('0x4a')][_0x1c5b('0x4f')]));_0x44b9c6[_0x1c5b('0x4d')]=_0x44b9c6[_0x1c5b('0x4d')][_0x1c5b('0x50')]?_0x44b9c6[_0x1c5b('0x4d')]:_0x3678d8[_0x1c5b('0x49')];_0x44b9c6[_0x1c5b('0x53')]=qs[_0x1c5b('0x54')](_0x3d960e[_0x1c5b('0x4a')][_0x1c5b('0x54')]);_0x44b9c6['where']=qs[_0x1c5b('0x4c')](_[_0x1c5b('0x56')](_0x3d960e[_0x1c5b('0x4a')],_0x3678d8[_0x1c5b('0x4c')]));if(_0x3d960e['query'][_0x1c5b('0x67')]){_0x44b9c6[_0x1c5b('0x55')]=_['merge'](_0x44b9c6['where'],{'$or':_[_0x1c5b('0x45')](_0x44b9c6[_0x1c5b('0x4d')],function(_0x5aa63b){var _0x4a7178={};_0x4a7178[_0x5aa63b]={'$like':'%'+_0x3d960e[_0x1c5b('0x4a')][_0x1c5b('0x67')]+'%'};return _0x4a7178;})});}_0x44b9c6=_[_0x1c5b('0x57')]({},_0x44b9c6,_0x3d960e['options']);return _0x588051[_0x1c5b('0xc5')](_0x44b9c6);}})[_0x1c5b('0x23')](function(_0x2077d1){if(_0x2077d1){_0x5df9b1=_0x2077d1[_0x1c5b('0x50')];if(!_0x3d960e[_0x1c5b('0x4a')][_0x1c5b('0x51')](_0x1c5b('0x52'))){_0x44b9c6['limit']=qs['limit'](_0x3d960e['query'][_0x1c5b('0x33')]);_0x44b9c6[_0x1c5b('0x35')]=qs[_0x1c5b('0x35')](_0x3d960e[_0x1c5b('0x4a')][_0x1c5b('0x35')]);}return _0x588051[_0x1c5b('0xc5')](_0x44b9c6);}})[_0x1c5b('0x23')](function(_0x2f7ce6){if(_0x2f7ce6){return _0x2f7ce6?{'count':_0x5df9b1,'rows':_0x2f7ce6}:null;}})[_0x1c5b('0x23')](respondWithResult(_0xffe2,null))[_0x1c5b('0x2d')](handleError(_0xffe2,null));}; \ No newline at end of file +var _0x5ad0=['Pause','mandatoryDispositionPause','map','MailAccount','fieldName','type','model','query','keys','filters','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','rows','catch','show','Imap','attributes','include','find','body','params','describe','MailAccountId','Disposition','create','getDispositions','findOne','rawAttributes','intersection','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','key','email','ListId','isNil','active','description','cservice','cauthentication','user','password','cpassword','authentication','host','port','service','cuser','pass','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MailAccounts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','addInteraction','MailInteraction','omit','getInteractions','Contact','User','Owner','Tags','tag','addApplications','sequelize','transaction','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','split','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','true','List','Contacts','updatedAt','DESC','from','%s\x20<%s>','attachments','root','server/files/attachments','basename','auth','SendMail','sendMail','List\x20not\x20found','messageId','attach','out','Interaction','Messages','secure','VerifySmtp','verifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','html-to-text','juice','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./mailAccount.socket','register','http','request','then','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','MailAccount,\x20%s,\x20%s','message','info','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','save','update','destroy','get','UserProfileResource','stack','name','send','index','MailServerIn','MailServerOut','Smtp'];(function(_0x198d97,_0x1d98a0){var _0x4b51ab=function(_0x34d85a){while(--_0x34d85a){_0x198d97['push'](_0x198d97['shift']());}};_0x4b51ab(++_0x1d98a0);}(_0x5ad0,0x147));var _0x05ad=function(_0x12b294,_0x192e53){_0x12b294=_0x12b294-0x0;var _0x7b92cb=_0x5ad0[_0x12b294];return _0x7b92cb;};'use strict';var emlformat=require(_0x05ad('0x0'));var rimraf=require(_0x05ad('0x1'));var zipdir=require(_0x05ad('0x2'));var jsonpatch=require(_0x05ad('0x3'));var rp=require(_0x05ad('0x4'));var moment=require(_0x05ad('0x5'));var BPromise=require(_0x05ad('0x6'));var Mustache=require(_0x05ad('0x7'));var util=require(_0x05ad('0x8'));var path=require('path');var sox=require(_0x05ad('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x05ad('0xa'));var squel=require('squel');var crypto=require(_0x05ad('0xb'));var jsforce=require(_0x05ad('0xc'));var deskjs=require(_0x05ad('0xd'));var toCsv=require(_0x05ad('0xe'));var querystring=require(_0x05ad('0xf'));var Papa=require('papaparse');var htmlToText=require(_0x05ad('0x10'));var juice=require(_0x05ad('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x05ad('0x12'));var as=require(_0x05ad('0x13'));var hardwareService=require(_0x05ad('0x14'));var logger=require('../../config/logger')(_0x05ad('0x15'));var utils=require(_0x05ad('0x16'));var config=require(_0x05ad('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x05ad('0x18'))['db'];config['redis']=_[_0x05ad('0x19')](config['redis'],{'host':_0x05ad('0x1a'),'port':0x18eb});var socket=require(_0x05ad('0x1b'))(new Redis(config[_0x05ad('0x1c')]));require(_0x05ad('0x1d'))[_0x05ad('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x05ad('0x1f')]({'port':0x232b});function respondWithRpcPromise(_0xede4cf,_0x1556e8,_0x5abe34,_0x17d0d0){return new BPromise(function(_0x496f29,_0x3697c6){var _0x3f80f7=_0x17d0d0||client;return _0x3f80f7[_0x05ad('0x20')](_0xede4cf,_0x5abe34)[_0x05ad('0x21')](function(_0x2f94e1){logger['info']('MailAccount,\x20%s,\x20%s',_0x1556e8,_0x05ad('0x22'));logger[_0x05ad('0x23')](_0x05ad('0x24'),_0x1556e8,'request\x20sent',JSON['stringify'](_0x2f94e1));if(_0x2f94e1[_0x05ad('0x25')]){if(_0x2f94e1[_0x05ad('0x25')][_0x05ad('0x26')]===0x1f4){logger[_0x05ad('0x25')](_0x05ad('0x27'),_0x1556e8,_0x2f94e1[_0x05ad('0x25')][_0x05ad('0x28')]);return _0x3697c6(_0x2f94e1[_0x05ad('0x25')]['message']);}logger[_0x05ad('0x25')](_0x05ad('0x27'),_0x1556e8,_0x2f94e1[_0x05ad('0x25')][_0x05ad('0x28')]);return _0x496f29(_0x2f94e1[_0x05ad('0x25')][_0x05ad('0x28')]);}else{logger[_0x05ad('0x29')]('MailAccount,\x20%s,\x20%s',_0x1556e8,_0x05ad('0x22'));_0x496f29(_0x2f94e1['result'][_0x05ad('0x28')]);}})['catch'](function(_0x9bf082){logger[_0x05ad('0x25')]('MailAccount,\x20%s,\x20%s',_0x1556e8,_0x9bf082);_0x3697c6(_0x9bf082);});});}function respondWithStatusCode(_0x126bfa,_0x2f932a){_0x2f932a=_0x2f932a||0xcc;return function(_0x46854a){if(_0x46854a){return _0x126bfa[_0x05ad('0x2a')](_0x2f932a);}return _0x126bfa['status'](_0x2f932a)[_0x05ad('0x2b')]();};}function respondWithResult(_0x5234c6,_0x2aa257){_0x2aa257=_0x2aa257||0xc8;return function(_0x8318a9){if(_0x8318a9){return _0x5234c6[_0x05ad('0x2c')](_0x2aa257)[_0x05ad('0x2d')](_0x8318a9);}};}function respondWithFilteredResult(_0x1c40a3,_0x585025){return function(_0x4120d7){if(_0x4120d7){var _0x1d309d=typeof _0x585025[_0x05ad('0x2e')]===_0x05ad('0x2f')&&typeof _0x585025[_0x05ad('0x30')]===_0x05ad('0x2f');var _0xb4cfea=_0x4120d7['count'];var _0x4c8610=_0x1d309d?0x0:_0x585025['offset'];var _0x1afdad=_0x1d309d?_0x4120d7[_0x05ad('0x31')]:_0x585025[_0x05ad('0x2e')]+_0x585025['limit'];var _0x5c45cd;if(_0x1afdad>=_0xb4cfea){_0x1afdad=_0xb4cfea;_0x5c45cd=0xc8;}else{_0x5c45cd=0xce;}_0x1c40a3[_0x05ad('0x2c')](_0x5c45cd);return _0x1c40a3['set'](_0x05ad('0x32'),_0x4c8610+'-'+_0x1afdad+'/'+_0xb4cfea)['json'](_0x4120d7);}return null;};}function patchUpdates(_0x3daa6b){return function(_0x2df7d5){try{jsonpatch['apply'](_0x2df7d5,_0x3daa6b,!![]);}catch(_0x98165){return BPromise['reject'](_0x98165);}return _0x2df7d5[_0x05ad('0x33')]();};}function saveUpdates(_0x1308a3,_0x57b07d){return function(_0x30dafd){if(_0x30dafd){return _0x30dafd[_0x05ad('0x34')](_0x1308a3)[_0x05ad('0x21')](function(_0x32eece){return _0x32eece;});}return null;};}function removeEntity(_0x1a5f91,_0xb31289){return function(_0x2a7e93){if(_0x2a7e93){return _0x2a7e93[_0x05ad('0x35')]()[_0x05ad('0x21')](function(){var _0x6e55a7=_0x2a7e93[_0x05ad('0x36')]({'plain':!![]});var _0x5a19ec='MailAccounts';return db[_0x05ad('0x37')][_0x05ad('0x35')]({'where':{'type':_0x5a19ec,'resourceId':_0x6e55a7['id']}})[_0x05ad('0x21')](function(){return _0x2a7e93;});})['then'](function(){_0x1a5f91[_0x05ad('0x2c')](0xcc)[_0x05ad('0x2b')]();});}};}function handleEntityNotFound(_0xcfd43b,_0x206d3b){return function(_0x28bcba){if(!_0x28bcba){_0xcfd43b[_0x05ad('0x2a')](0x194);}return _0x28bcba;};}function handleError(_0x473cfc,_0x5f34e1){_0x5f34e1=_0x5f34e1||0x1f4;return function(_0x50b41f){logger[_0x05ad('0x25')](_0x50b41f[_0x05ad('0x38')]);if(_0x50b41f[_0x05ad('0x39')]){delete _0x50b41f[_0x05ad('0x39')];}_0x473cfc[_0x05ad('0x2c')](_0x5f34e1)[_0x05ad('0x3a')](_0x50b41f);};}exports[_0x05ad('0x3b')]=function(_0x2cba5e,_0x205ed4){var _0x5185c5={'include':[{'model':db[_0x05ad('0x3c')],'as':'Imap'},{'model':db[_0x05ad('0x3d')],'as':_0x05ad('0x3e')},{'model':db[_0x05ad('0x3f')],'as':_0x05ad('0x40')}]},_0x1619cb={},_0x2b859f={'count':0x0,'rows':[]};var _0x4fe757=_[_0x05ad('0x41')](db[_0x05ad('0x42')]['rawAttributes'],function(_0x23a54e){return{'name':_0x23a54e[_0x05ad('0x43')],'type':_0x23a54e[_0x05ad('0x44')]['key']};});_0x1619cb[_0x05ad('0x45')]=_['map'](_0x4fe757,'name');_0x1619cb[_0x05ad('0x46')]=_[_0x05ad('0x47')](_0x2cba5e[_0x05ad('0x46')]);_0x1619cb[_0x05ad('0x48')]=_['intersection'](_0x1619cb[_0x05ad('0x45')],_0x1619cb['query']);_0x5185c5['attributes']=_['intersection'](_0x1619cb[_0x05ad('0x45')],qs[_0x05ad('0x49')](_0x2cba5e[_0x05ad('0x46')][_0x05ad('0x49')]));_0x5185c5['attributes']=_0x5185c5['attributes'][_0x05ad('0x4a')]?_0x5185c5['attributes']:_0x1619cb[_0x05ad('0x45')];if(!_0x2cba5e['query'][_0x05ad('0x4b')](_0x05ad('0x4c'))){_0x5185c5[_0x05ad('0x30')]=qs[_0x05ad('0x30')](_0x2cba5e['query'][_0x05ad('0x30')]);_0x5185c5['offset']=qs[_0x05ad('0x2e')](_0x2cba5e[_0x05ad('0x46')]['offset']);}_0x5185c5[_0x05ad('0x4d')]=qs[_0x05ad('0x4e')](_0x2cba5e[_0x05ad('0x46')][_0x05ad('0x4e')]);_0x5185c5[_0x05ad('0x4f')]=qs[_0x05ad('0x48')](_[_0x05ad('0x50')](_0x2cba5e['query'],_0x1619cb[_0x05ad('0x48')]),_0x4fe757);if(_0x2cba5e['query']['filter']){_0x5185c5[_0x05ad('0x4f')]=_[_0x05ad('0x51')](_0x5185c5[_0x05ad('0x4f')],{'$or':_[_0x05ad('0x41')](_0x4fe757,function(_0x378965){if(_0x378965[_0x05ad('0x44')]!==_0x05ad('0x52')){var _0x2b0067={};_0x2b0067[_0x378965[_0x05ad('0x39')]]={'$like':'%'+_0x2cba5e[_0x05ad('0x46')][_0x05ad('0x53')]+'%'};return _0x2b0067;}})});}_0x5185c5=_[_0x05ad('0x51')]({},_0x5185c5,_0x2cba5e[_0x05ad('0x54')]);var _0x35c7dd={'where':_0x5185c5['where']};return db['MailAccount'][_0x05ad('0x31')](_0x35c7dd)[_0x05ad('0x21')](function(_0x1fa7e2){_0x2b859f[_0x05ad('0x31')]=_0x1fa7e2;if(_0x2cba5e[_0x05ad('0x46')][_0x05ad('0x55')]){_0x5185c5['include']=[{'all':!![]}];}return db['MailAccount']['findAll'](_0x5185c5);})[_0x05ad('0x21')](function(_0x4ecd90){_0x2b859f[_0x05ad('0x56')]=_0x4ecd90;return _0x2b859f;})['then'](respondWithFilteredResult(_0x205ed4,_0x5185c5))[_0x05ad('0x57')](handleError(_0x205ed4,null));};exports[_0x05ad('0x58')]=function(_0x10a172,_0x4f8940){var _0x28f571={'raw':![],'where':{'id':_0x10a172['params']['id']},'include':[{'model':db['MailServerIn'],'as':_0x05ad('0x59')},{'model':db[_0x05ad('0x3d')],'as':'Smtp'},{'model':db[_0x05ad('0x3f')],'as':'mandatoryDispositionPause'}]},_0x491c86={};_0x491c86[_0x05ad('0x45')]=_[_0x05ad('0x47')](db[_0x05ad('0x42')]['rawAttributes']);_0x491c86[_0x05ad('0x46')]=_[_0x05ad('0x47')](_0x10a172['query']);_0x491c86[_0x05ad('0x48')]=_['intersection'](_0x491c86[_0x05ad('0x45')],_0x491c86[_0x05ad('0x46')]);_0x28f571[_0x05ad('0x5a')]=_['intersection'](_0x491c86[_0x05ad('0x45')],qs['fields'](_0x10a172[_0x05ad('0x46')][_0x05ad('0x49')]));_0x28f571[_0x05ad('0x5a')]=_0x28f571[_0x05ad('0x5a')][_0x05ad('0x4a')]?_0x28f571[_0x05ad('0x5a')]:_0x491c86[_0x05ad('0x45')];if(_0x10a172[_0x05ad('0x46')][_0x05ad('0x55')]){_0x28f571[_0x05ad('0x5b')]=[{'all':!![]}];}_0x28f571=_[_0x05ad('0x51')]({},_0x28f571,_0x10a172[_0x05ad('0x54')]);return db[_0x05ad('0x42')][_0x05ad('0x5c')](_0x28f571)[_0x05ad('0x21')](handleEntityNotFound(_0x4f8940,null))[_0x05ad('0x21')](respondWithResult(_0x4f8940,null))[_0x05ad('0x57')](handleError(_0x4f8940,null));};exports['update']=function(_0x1e8f3e,_0x2d271c){if(_0x1e8f3e['body']['id']){delete _0x1e8f3e[_0x05ad('0x5d')]['id'];}return db[_0x05ad('0x42')][_0x05ad('0x5c')]({'where':{'id':_0x1e8f3e[_0x05ad('0x5e')]['id']},'include':[{'model':db[_0x05ad('0x3c')],'as':_0x05ad('0x59')},{'model':db[_0x05ad('0x3d')],'as':_0x05ad('0x3e')},{'model':db['Pause'],'as':_0x05ad('0x40')}]})['then'](handleEntityNotFound(_0x2d271c,null))[_0x05ad('0x21')](saveUpdates(_0x1e8f3e[_0x05ad('0x5d')],null))[_0x05ad('0x21')](function(_0x2bc8b0){if(_0x2bc8b0&&_0x1e8f3e['body'][_0x05ad('0x59')]){return db[_0x05ad('0x3c')][_0x05ad('0x34')](_0x1e8f3e[_0x05ad('0x5d')]['Imap'],{'where':{'MailAccountId':_0x2bc8b0['id']}})['then'](function(){return _0x2bc8b0;});}return _0x2bc8b0;})[_0x05ad('0x21')](function(_0x4dc945){if(_0x4dc945&&_0x1e8f3e[_0x05ad('0x5d')]['Smtp']){return db[_0x05ad('0x3d')]['update'](_0x1e8f3e[_0x05ad('0x5d')][_0x05ad('0x3e')],{'where':{'MailAccountId':_0x4dc945['id']}})[_0x05ad('0x21')](function(){return _0x4dc945;});}return _0x4dc945;})[_0x05ad('0x21')](respondWithResult(_0x2d271c,null))[_0x05ad('0x57')](handleError(_0x2d271c,null));};exports[_0x05ad('0x5f')]=function(_0x5c8990,_0x8f53cc){return db['MailAccount'][_0x05ad('0x5f')]()['then'](respondWithResult(_0x8f53cc,null))[_0x05ad('0x57')](handleError(_0x8f53cc,null));};exports['addDisposition']=function(_0x3073ba,_0x3d0613,_0x3c8fe5){if(_0x3073ba[_0x05ad('0x5d')]['id']){delete _0x3073ba[_0x05ad('0x5d')]['id'];}return db[_0x05ad('0x42')][_0x05ad('0x5c')]({'where':{'id':_0x3073ba['params']['id']}})[_0x05ad('0x21')](handleEntityNotFound(_0x3d0613,null))[_0x05ad('0x21')](function(_0x161667){if(_0x161667){_0x3073ba[_0x05ad('0x5d')][_0x05ad('0x60')]=_0x161667['id'];return db[_0x05ad('0x61')][_0x05ad('0x62')](_0x3073ba[_0x05ad('0x5d')]);}})[_0x05ad('0x21')](respondWithResult(_0x3d0613,null))[_0x05ad('0x57')](handleError(_0x3d0613,null));};exports[_0x05ad('0x63')]=function(_0x49d866,_0x278be7,_0x5ce0c3){var _0xc27ff2={'raw':![],'where':{}};var _0x391c13={};var _0x57133c={'count':0x0,'rows':[]};return db[_0x05ad('0x42')][_0x05ad('0x64')]({'where':{'id':_0x49d866[_0x05ad('0x5e')]['id']}})[_0x05ad('0x21')](handleEntityNotFound(_0x278be7,null))[_0x05ad('0x21')](function(_0x2ccd4f){if(_0x2ccd4f){_0x391c13[_0x05ad('0x45')]=_['keys'](db[_0x05ad('0x61')][_0x05ad('0x65')]);_0x391c13[_0x05ad('0x46')]=_[_0x05ad('0x47')](_0x49d866[_0x05ad('0x46')]);_0x391c13['filters']=_[_0x05ad('0x66')](_0x391c13['model'],_0x391c13[_0x05ad('0x46')]);_0xc27ff2[_0x05ad('0x5a')]=_['intersection'](_0x391c13[_0x05ad('0x45')],qs[_0x05ad('0x49')](_0x49d866[_0x05ad('0x46')][_0x05ad('0x49')]));_0xc27ff2['attributes']=_0xc27ff2[_0x05ad('0x5a')][_0x05ad('0x4a')]?_0xc27ff2[_0x05ad('0x5a')]:_0x391c13['model'];if(!_0x49d866[_0x05ad('0x46')][_0x05ad('0x4b')](_0x05ad('0x4c'))){_0xc27ff2[_0x05ad('0x30')]=qs[_0x05ad('0x30')](_0x49d866[_0x05ad('0x46')]['limit']);_0xc27ff2[_0x05ad('0x2e')]=qs[_0x05ad('0x2e')](_0x49d866['query'][_0x05ad('0x2e')]);}_0xc27ff2[_0x05ad('0x4d')]=qs[_0x05ad('0x4e')](_0x49d866[_0x05ad('0x46')]['sort']);_0xc27ff2[_0x05ad('0x4f')]=qs[_0x05ad('0x48')](_[_0x05ad('0x50')](_0x49d866[_0x05ad('0x46')],_0x391c13[_0x05ad('0x48')]));_0xc27ff2[_0x05ad('0x4f')][_0x05ad('0x60')]=_0x2ccd4f['id'];if(_0x49d866[_0x05ad('0x46')][_0x05ad('0x53')]){_0xc27ff2['where']=_[_0x05ad('0x51')](_0xc27ff2[_0x05ad('0x4f')],{'$or':_[_0x05ad('0x41')](_0xc27ff2[_0x05ad('0x5a')],function(_0x1908ba){var _0x36cbdd={};_0x36cbdd[_0x1908ba]={'$like':'%'+_0x49d866['query'][_0x05ad('0x53')]+'%'};return _0x36cbdd;})});}_0xc27ff2=_[_0x05ad('0x51')]({},_0xc27ff2,_0x49d866[_0x05ad('0x54')]);return db[_0x05ad('0x61')]['count']({'where':_0xc27ff2[_0x05ad('0x4f')]})[_0x05ad('0x21')](function(_0x61e48e){_0x57133c[_0x05ad('0x31')]=_0x61e48e;if(_0x49d866[_0x05ad('0x46')]['includeAll']){_0xc27ff2[_0x05ad('0x5b')]=[{'all':!![]}];}return db[_0x05ad('0x61')][_0x05ad('0x67')](_0xc27ff2);})[_0x05ad('0x21')](function(_0x724519){_0x57133c[_0x05ad('0x56')]=_0x724519;return _0x57133c;});}})[_0x05ad('0x21')](respondWithFilteredResult(_0x278be7,_0xc27ff2))[_0x05ad('0x57')](handleError(_0x278be7,null));};exports[_0x05ad('0x68')]=function(_0x2864d3,_0x201f84,_0x263b9c){return db[_0x05ad('0x42')]['find']({'where':{'id':_0x2864d3['params']['id']}})[_0x05ad('0x21')](handleEntityNotFound(_0x201f84,null))[_0x05ad('0x21')](function(_0x24cf33){if(_0x24cf33){return _0x24cf33['removeDispositions'](_0x2864d3[_0x05ad('0x46')][_0x05ad('0x69')]);}})[_0x05ad('0x21')](respondWithStatusCode(_0x201f84,null))[_0x05ad('0x57')](handleError(_0x201f84,null));};exports[_0x05ad('0x6a')]=function(_0x5c1325,_0x116b17,_0x4a530c){if(_0x5c1325[_0x05ad('0x5d')]['id']){delete _0x5c1325[_0x05ad('0x5d')]['id'];}return db[_0x05ad('0x42')][_0x05ad('0x5c')]({'where':{'id':_0x5c1325[_0x05ad('0x5e')]['id']}})[_0x05ad('0x21')](handleEntityNotFound(_0x116b17,null))['then'](function(_0x1e1e4c){if(_0x1e1e4c){_0x5c1325['body'][_0x05ad('0x60')]=_0x1e1e4c['id'];return db[_0x05ad('0x6b')][_0x05ad('0x62')](_0x5c1325[_0x05ad('0x5d')]);}})[_0x05ad('0x21')](respondWithResult(_0x116b17,null))[_0x05ad('0x57')](handleError(_0x116b17,null));};exports[_0x05ad('0x6c')]=function(_0x35e781,_0x26e5a4,_0x468360){var _0x4bf5b4={'raw':![],'where':{}};var _0x44d679={};var _0x329bf3={'count':0x0,'rows':[]};return db['MailAccount'][_0x05ad('0x64')]({'where':{'id':_0x35e781[_0x05ad('0x5e')]['id']}})[_0x05ad('0x21')](handleEntityNotFound(_0x26e5a4,null))['then'](function(_0xd8df0a){if(_0xd8df0a){_0x44d679[_0x05ad('0x45')]=_[_0x05ad('0x47')](db[_0x05ad('0x6b')][_0x05ad('0x65')]);_0x44d679['query']=_[_0x05ad('0x47')](_0x35e781[_0x05ad('0x46')]);_0x44d679['filters']=_['intersection'](_0x44d679[_0x05ad('0x45')],_0x44d679[_0x05ad('0x46')]);_0x4bf5b4[_0x05ad('0x5a')]=_['intersection'](_0x44d679[_0x05ad('0x45')],qs[_0x05ad('0x49')](_0x35e781[_0x05ad('0x46')][_0x05ad('0x49')]));_0x4bf5b4[_0x05ad('0x5a')]=_0x4bf5b4[_0x05ad('0x5a')][_0x05ad('0x4a')]?_0x4bf5b4[_0x05ad('0x5a')]:_0x44d679[_0x05ad('0x45')];if(!_0x35e781[_0x05ad('0x46')][_0x05ad('0x4b')](_0x05ad('0x4c'))){_0x4bf5b4[_0x05ad('0x30')]=qs['limit'](_0x35e781['query'][_0x05ad('0x30')]);_0x4bf5b4[_0x05ad('0x2e')]=qs[_0x05ad('0x2e')](_0x35e781[_0x05ad('0x46')][_0x05ad('0x2e')]);}_0x4bf5b4[_0x05ad('0x4d')]=qs['sort'](_0x35e781['query'][_0x05ad('0x4e')]);_0x4bf5b4[_0x05ad('0x4f')]=qs['filters'](_[_0x05ad('0x50')](_0x35e781[_0x05ad('0x46')],_0x44d679['filters']));_0x4bf5b4[_0x05ad('0x4f')][_0x05ad('0x60')]=_0xd8df0a['id'];if(_0x35e781[_0x05ad('0x46')][_0x05ad('0x53')]){_0x4bf5b4[_0x05ad('0x4f')]=_[_0x05ad('0x51')](_0x4bf5b4[_0x05ad('0x4f')],{'$or':_[_0x05ad('0x41')](_0x4bf5b4[_0x05ad('0x5a')],function(_0x48eb04){var _0x3fa959={};_0x3fa959[_0x48eb04]={'$like':'%'+_0x35e781[_0x05ad('0x46')][_0x05ad('0x53')]+'%'};return _0x3fa959;})});}_0x4bf5b4=_[_0x05ad('0x51')]({},_0x4bf5b4,_0x35e781[_0x05ad('0x54')]);return db[_0x05ad('0x6b')][_0x05ad('0x31')]({'where':_0x4bf5b4[_0x05ad('0x4f')]})[_0x05ad('0x21')](function(_0x5266a0){_0x329bf3[_0x05ad('0x31')]=_0x5266a0;if(_0x35e781['query'][_0x05ad('0x55')]){_0x4bf5b4[_0x05ad('0x5b')]=[{'all':!![]}];}return db[_0x05ad('0x6b')][_0x05ad('0x67')](_0x4bf5b4);})['then'](function(_0x3593a2){_0x329bf3[_0x05ad('0x56')]=_0x3593a2;return _0x329bf3;});}})[_0x05ad('0x21')](respondWithFilteredResult(_0x26e5a4,_0x4bf5b4))['catch'](handleError(_0x26e5a4,null));};exports[_0x05ad('0x6d')]=function(_0x48ec62,_0x36e1f0,_0x53d77f){return db[_0x05ad('0x42')]['find']({'where':{'id':_0x48ec62[_0x05ad('0x5e')]['id']}})[_0x05ad('0x21')](handleEntityNotFound(_0x36e1f0,null))['then'](function(_0x476b4c){if(_0x476b4c){return _0x476b4c[_0x05ad('0x6d')](_0x48ec62['query'][_0x05ad('0x69')]);}})[_0x05ad('0x21')](respondWithStatusCode(_0x36e1f0,null))[_0x05ad('0x57')](handleError(_0x36e1f0,null));};exports['create']=function(_0x54049e,_0x39be5c){var _0x5c7832={'name':_0x54049e[_0x05ad('0x5d')][_0x05ad('0x39')],'key':_0x54049e[_0x05ad('0x5d')][_0x05ad('0x6e')],'email':_0x54049e[_0x05ad('0x5d')][_0x05ad('0x6f')],'ListId':_0x54049e[_0x05ad('0x5d')][_0x05ad('0x70')],'active':!_[_0x05ad('0x71')](_0x54049e[_0x05ad('0x5d')][_0x05ad('0x72')])?_0x54049e['body'][_0x05ad('0x72')]:!![],'description':_0x54049e[_0x05ad('0x5d')][_0x05ad('0x73')]||null,'Imap':{},'Smtp':{}};if(_[_0x05ad('0x71')](_0x54049e['body'][_0x05ad('0x74')])){if(_0x54049e[_0x05ad('0x5d')][_0x05ad('0x75')]){_0x5c7832['Imap'][_0x05ad('0x76')]=_0x5c7832[_0x05ad('0x3e')][_0x05ad('0x76')]=_0x54049e[_0x05ad('0x5d')]['cuser'];_0x5c7832[_0x05ad('0x59')][_0x05ad('0x77')]=_0x5c7832[_0x05ad('0x3e')]['pass']=_0x54049e[_0x05ad('0x5d')][_0x05ad('0x78')];}else{_0x5c7832['Imap'][_0x05ad('0x79')]=_0x5c7832['Smtp'][_0x05ad('0x79')]=![];}_0x5c7832['Imap'][_0x05ad('0x7a')]=_0x54049e[_0x05ad('0x5d')][_0x05ad('0x59')]['host'];_0x5c7832[_0x05ad('0x59')][_0x05ad('0x7b')]=_0x54049e[_0x05ad('0x5d')][_0x05ad('0x59')]['port'];_0x5c7832[_0x05ad('0x3e')][_0x05ad('0x7a')]=_0x54049e[_0x05ad('0x5d')]['Smtp'][_0x05ad('0x7a')];_0x5c7832[_0x05ad('0x3e')][_0x05ad('0x7b')]=_0x54049e[_0x05ad('0x5d')][_0x05ad('0x3e')][_0x05ad('0x7b')];}else{_0x5c7832[_0x05ad('0x59')][_0x05ad('0x7c')]=_0x5c7832['Smtp'][_0x05ad('0x7c')]=_0x54049e[_0x05ad('0x5d')]['cservice'];_0x5c7832['Imap'][_0x05ad('0x76')]=_0x5c7832['Smtp'][_0x05ad('0x76')]=_0x54049e[_0x05ad('0x5d')][_0x05ad('0x7d')];_0x5c7832[_0x05ad('0x59')]['password']=_0x5c7832['Smtp'][_0x05ad('0x7e')]=_0x54049e[_0x05ad('0x5d')][_0x05ad('0x78')];}return db['MailAccount']['create'](_0x5c7832,{'include':[{'model':db[_0x05ad('0x3d')],'as':'Smtp'},{'model':db[_0x05ad('0x3c')],'as':_0x05ad('0x59')}]})[_0x05ad('0x21')](function(_0x131093){var _0x2b13e4=_0x54049e['user'][_0x05ad('0x36')]({'plain':!![]});if(!_0x2b13e4)throw new Error(_0x05ad('0x7f'));if(_0x2b13e4[_0x05ad('0x80')]===_0x05ad('0x76')){var _0x14e48a=_0x131093[_0x05ad('0x36')]({'plain':!![]});return db[_0x05ad('0x81')][_0x05ad('0x5c')]({'where':{'name':_0x05ad('0x82'),'userProfileId':_0x2b13e4[_0x05ad('0x83')]},'raw':!![]})['then'](function(_0x2245d7){if(_0x2245d7&&_0x2245d7[_0x05ad('0x84')]===0x0){return db[_0x05ad('0x37')][_0x05ad('0x62')]({'name':_0x14e48a[_0x05ad('0x39')],'resourceId':_0x14e48a['id'],'type':_0x2245d7[_0x05ad('0x39')],'sectionId':_0x2245d7['id']},{})[_0x05ad('0x21')](function(){return _0x131093;});}else{return _0x131093;}})[_0x05ad('0x57')](function(_0x1fb0b4){logger[_0x05ad('0x25')](_0x05ad('0x85'),_0x1fb0b4);throw _0x1fb0b4;});}return _0x131093;})[_0x05ad('0x21')](respondWithResult(_0x39be5c,0xc9))[_0x05ad('0x57')](handleError(_0x39be5c,null));};exports['getImap']=function(_0x4fb30f,_0x5cf915,_0xd5ae40){return db[_0x05ad('0x42')][_0x05ad('0x64')]({'where':{'id':_0x4fb30f[_0x05ad('0x5e')]['id']}})[_0x05ad('0x21')](handleEntityNotFound(_0x5cf915,null))[_0x05ad('0x21')](function(_0x39d4e8){if(_0x39d4e8){return _0x39d4e8['getImap']();}return null;})[_0x05ad('0x21')](respondWithResult(_0x5cf915,null))['catch'](handleError(_0x5cf915,null));};exports[_0x05ad('0x86')]=function(_0x17f0dc,_0x135aac,_0x40632a){if(_0x17f0dc[_0x05ad('0x5d')]['id']){delete _0x17f0dc[_0x05ad('0x5d')]['id'];}return db['MailAccount'][_0x05ad('0x5c')]({'where':{'id':_0x17f0dc[_0x05ad('0x5e')]['id']}})['then'](handleEntityNotFound(_0x135aac,null))[_0x05ad('0x21')](function(_0x167251){if(_0x167251){_0x17f0dc[_0x05ad('0x5d')][_0x05ad('0x60')]=_0x167251['id'];return db[_0x05ad('0x3c')][_0x05ad('0x62')](_0x17f0dc[_0x05ad('0x5d')]);}})['then'](respondWithResult(_0x135aac,null))[_0x05ad('0x57')](handleError(_0x135aac,null));};exports[_0x05ad('0x87')]=function(_0x516a04,_0xd673f5,_0x5ab503){return db[_0x05ad('0x42')]['findOne']({'where':{'id':_0x516a04[_0x05ad('0x5e')]['id']}})[_0x05ad('0x21')](handleEntityNotFound(_0xd673f5,null))[_0x05ad('0x21')](function(_0x535e0d){if(_0x535e0d){return _0x535e0d[_0x05ad('0x88')](null);}return null;})[_0x05ad('0x21')](respondWithStatusCode(_0xd673f5,null))['catch'](handleError(_0xd673f5,null));};exports['getSmtp']=function(_0x50e635,_0x4ac5a2,_0x5404dd){return db[_0x05ad('0x42')][_0x05ad('0x64')]({'where':{'id':_0x50e635[_0x05ad('0x5e')]['id']}})[_0x05ad('0x21')](handleEntityNotFound(_0x4ac5a2,null))[_0x05ad('0x21')](function(_0x4bd29b){if(_0x4bd29b){return _0x4bd29b[_0x05ad('0x89')]();}return null;})[_0x05ad('0x21')](respondWithResult(_0x4ac5a2,null))['catch'](handleError(_0x4ac5a2,null));};exports[_0x05ad('0x8a')]=function(_0x3ad1c9,_0x40eb57,_0x281622){if(_0x3ad1c9['body']['id']){delete _0x3ad1c9[_0x05ad('0x5d')]['id'];}return db[_0x05ad('0x42')][_0x05ad('0x5c')]({'where':{'id':_0x3ad1c9[_0x05ad('0x5e')]['id']}})['then'](handleEntityNotFound(_0x40eb57,null))[_0x05ad('0x21')](function(_0x366f4d){if(_0x366f4d){_0x3ad1c9[_0x05ad('0x5d')]['MailAccountId']=_0x366f4d['id'];return db[_0x05ad('0x3d')]['create'](_0x3ad1c9['body']);}})[_0x05ad('0x21')](respondWithResult(_0x40eb57,null))[_0x05ad('0x57')](handleError(_0x40eb57,null));};exports[_0x05ad('0x8b')]=function(_0xf869df,_0x119ec6,_0x34b5f3){return db[_0x05ad('0x42')][_0x05ad('0x64')]({'where':{'id':_0xf869df['params']['id']}})[_0x05ad('0x21')](handleEntityNotFound(_0x119ec6,null))[_0x05ad('0x21')](function(_0x3b51fe){if(_0x3b51fe){return _0x3b51fe['setSmtp'](null);}return null;})[_0x05ad('0x21')](respondWithStatusCode(_0x119ec6,null))['catch'](handleError(_0x119ec6,null));};exports[_0x05ad('0x8c')]=function(_0x1dfd46,_0x5143ae,_0x7bec58){return db[_0x05ad('0x8d')][_0x05ad('0x5c')]({'where':{'id':_0x1dfd46[_0x05ad('0x5e')]['id']}})[_0x05ad('0x21')](handleEntityNotFound(_0x5143ae,null))[_0x05ad('0x21')](function(_0x53490d){if(_0x53490d){return _0x53490d[_0x05ad('0x8c')](_0x1dfd46[_0x05ad('0x5d')][_0x05ad('0x69')],_[_0x05ad('0x8e')](_0x1dfd46[_0x05ad('0x5d')],[_0x05ad('0x69'),'id'])||{});}})[_0x05ad('0x21')](respondWithResult(_0x5143ae,null))[_0x05ad('0x57')](handleError(_0x5143ae,null));};exports[_0x05ad('0x8f')]=function(_0x5d3ae0,_0x422dcb,_0x432222){var _0x29f0ca={'raw':![],'where':{}};var _0x34e05a={};var _0x38da39={'count':0x0,'rows':[]};return db['MailAccount'][_0x05ad('0x64')]({'where':{'id':_0x5d3ae0[_0x05ad('0x5e')]['id']}})[_0x05ad('0x21')](handleEntityNotFound(_0x422dcb,null))['then'](function(_0x24bd71){if(_0x24bd71){_0x34e05a['model']=_['keys'](db[_0x05ad('0x8d')]['rawAttributes']);_0x34e05a[_0x05ad('0x46')]=_[_0x05ad('0x47')](_0x5d3ae0[_0x05ad('0x46')]);_0x34e05a[_0x05ad('0x48')]=_[_0x05ad('0x66')](_0x34e05a[_0x05ad('0x45')],_0x34e05a[_0x05ad('0x46')]);_0x29f0ca['attributes']=_[_0x05ad('0x66')](_0x34e05a[_0x05ad('0x45')],qs[_0x05ad('0x49')](_0x5d3ae0[_0x05ad('0x46')]['fields']));_0x29f0ca[_0x05ad('0x5a')]=_0x29f0ca[_0x05ad('0x5a')][_0x05ad('0x4a')]?_0x29f0ca[_0x05ad('0x5a')]:_0x34e05a['model'];if(!_0x5d3ae0[_0x05ad('0x46')][_0x05ad('0x4b')](_0x05ad('0x4c'))){_0x29f0ca[_0x05ad('0x30')]=qs[_0x05ad('0x30')](_0x5d3ae0[_0x05ad('0x46')][_0x05ad('0x30')]);_0x29f0ca[_0x05ad('0x2e')]=qs['offset'](_0x5d3ae0['query']['offset']);}_0x29f0ca[_0x05ad('0x4d')]=qs[_0x05ad('0x4e')](_0x5d3ae0[_0x05ad('0x46')][_0x05ad('0x4e')]);_0x29f0ca[_0x05ad('0x4f')]=qs[_0x05ad('0x48')](_[_0x05ad('0x50')](_0x5d3ae0['query'],_0x34e05a[_0x05ad('0x48')]));_0x29f0ca['where'][_0x05ad('0x60')]=_0x24bd71['id'];if(_0x5d3ae0[_0x05ad('0x46')][_0x05ad('0x53')]){_0x29f0ca[_0x05ad('0x4f')]=_['merge'](_0x29f0ca[_0x05ad('0x4f')],{'$or':_['map'](_0x29f0ca[_0x05ad('0x5a')],function(_0x48b93c){var _0x50b2a0={};_0x50b2a0[_0x48b93c]={'$like':'%'+_0x5d3ae0[_0x05ad('0x46')]['filter']+'%'};return _0x50b2a0;})});}_0x29f0ca=_[_0x05ad('0x51')]({},_0x29f0ca,_0x5d3ae0[_0x05ad('0x54')]);return db['MailInteraction'][_0x05ad('0x31')]({'where':_0x29f0ca[_0x05ad('0x4f')]})[_0x05ad('0x21')](function(_0x9675c7){_0x38da39[_0x05ad('0x31')]=_0x9675c7;if(_0x5d3ae0[_0x05ad('0x46')][_0x05ad('0x55')]){_0x29f0ca[_0x05ad('0x5b')]=[{'model':db['CmContact'],'as':_0x05ad('0x90'),'required':![]},{'model':db[_0x05ad('0x91')],'as':_0x05ad('0x92'),'attributes':[_0x05ad('0x39'),'fullname','internal'],'required':![]},{'model':db['Tag'],'as':_0x05ad('0x93'),'attributes':['id',_0x05ad('0x39'),'color'],'where':_0x5d3ae0['query'][_0x05ad('0x94')]?{'id':_0x5d3ae0[_0x05ad('0x46')]['tag']}:undefined,'required':_0x5d3ae0[_0x05ad('0x46')][_0x05ad('0x94')]?!![]:![]}];}return db[_0x05ad('0x8d')][_0x05ad('0x67')](_0x29f0ca);})[_0x05ad('0x21')](function(_0x27f43c){_0x38da39[_0x05ad('0x56')]=_0x27f43c;return _0x38da39;});}})['then'](respondWithFilteredResult(_0x422dcb,_0x29f0ca))['catch'](handleError(_0x422dcb,null));};exports[_0x05ad('0x95')]=function(_0x5b1f2e,_0x1f73be,_0x4f7f59){return db['MailAccount'][_0x05ad('0x64')]({'where':{'id':_0x5b1f2e['params']['id']}})[_0x05ad('0x21')](handleEntityNotFound(_0x1f73be,null))[_0x05ad('0x21')](function(_0x3c1c7c){if(_0x3c1c7c){return db[_0x05ad('0x96')][_0x05ad('0x97')](function(_0x306244){return db[_0x05ad('0x98')][_0x05ad('0x35')]({'where':{'MailAccountId':_0x5b1f2e[_0x05ad('0x5e')]['id']},'transaction':_0x306244})[_0x05ad('0x21')](function(_0x49ba4a){var _0xf5e55b=_['map'](_0x5b1f2e[_0x05ad('0x5d')],function(_0x30510b){_0x30510b['MailAccountId']=_0x5b1f2e['params']['id'];return _0x30510b;});return db['MailApplication'][_0x05ad('0x99')](_0xf5e55b,{'transaction':_0x306244});});})[_0x05ad('0x21')](function(){return db[_0x05ad('0x98')][_0x05ad('0x9a')]({'where':{'MailAccountId':_0x5b1f2e[_0x05ad('0x5e')]['id']},'order':_0x05ad('0x9b')});});}})[_0x05ad('0x21')](respondWithResult(_0x1f73be,null))[_0x05ad('0x57')](handleError(_0x1f73be,null));};exports[_0x05ad('0x9c')]=function(_0x5a7611,_0x5b452f,_0x2935af){var _0x3552f4={};var _0x1da9a4={};var _0xa16a0a;var _0x59ea3a;return db['MailAccount'][_0x05ad('0x64')]({'where':{'id':_0x5a7611['params']['id']}})[_0x05ad('0x21')](handleEntityNotFound(_0x5b452f,null))[_0x05ad('0x21')](function(_0x4c2928){if(_0x4c2928){_0xa16a0a=_0x4c2928;_0x1da9a4['model']=_[_0x05ad('0x47')](db['MailApplication'][_0x05ad('0x65')]);_0x1da9a4[_0x05ad('0x46')]=_['keys'](_0x5a7611[_0x05ad('0x46')]);_0x1da9a4[_0x05ad('0x48')]=_[_0x05ad('0x66')](_0x1da9a4[_0x05ad('0x45')],_0x1da9a4[_0x05ad('0x46')]);_0x3552f4[_0x05ad('0x5a')]=_[_0x05ad('0x66')](_0x1da9a4[_0x05ad('0x45')],qs[_0x05ad('0x49')](_0x5a7611[_0x05ad('0x46')][_0x05ad('0x49')]));_0x3552f4['attributes']=_0x3552f4[_0x05ad('0x5a')][_0x05ad('0x4a')]?_0x3552f4[_0x05ad('0x5a')]:_0x1da9a4['model'];_0x3552f4[_0x05ad('0x4d')]=qs[_0x05ad('0x4e')](_0x5a7611['query'][_0x05ad('0x4e')]);_0x3552f4[_0x05ad('0x4f')]=qs[_0x05ad('0x48')](_[_0x05ad('0x50')](_0x5a7611[_0x05ad('0x46')],_0x1da9a4[_0x05ad('0x48')]));if(_0x5a7611[_0x05ad('0x46')][_0x05ad('0x53')]){_0x3552f4[_0x05ad('0x4f')]=_[_0x05ad('0x51')](_0x3552f4[_0x05ad('0x4f')],{'$or':_[_0x05ad('0x41')](_0x3552f4[_0x05ad('0x5a')],function(_0x474af4){var _0x4efef8={};_0x4efef8[_0x474af4]={'$like':'%'+_0x5a7611[_0x05ad('0x46')][_0x05ad('0x53')]+'%'};return _0x4efef8;})});}_0x3552f4=_[_0x05ad('0x51')]({},_0x3552f4,_0x5a7611[_0x05ad('0x54')]);return _0xa16a0a[_0x05ad('0x9c')](_0x3552f4);}})[_0x05ad('0x21')](function(_0x3025d4){if(_0x3025d4){_0x59ea3a=_0x3025d4[_0x05ad('0x4a')];if(!_0x5a7611[_0x05ad('0x46')][_0x05ad('0x4b')]('nolimit')){_0x3552f4[_0x05ad('0x30')]=qs[_0x05ad('0x30')](_0x5a7611[_0x05ad('0x46')]['limit']);_0x3552f4['offset']=qs[_0x05ad('0x2e')](_0x5a7611[_0x05ad('0x46')][_0x05ad('0x2e')]);}return _0xa16a0a[_0x05ad('0x9c')](_0x3552f4);}})[_0x05ad('0x21')](function(_0x2560e4){if(_0x2560e4){return _0x2560e4?{'count':_0x59ea3a,'rows':_0x2560e4}:null;}})[_0x05ad('0x21')](respondWithResult(_0x5b452f,null))[_0x05ad('0x57')](handleError(_0x5b452f,null));};exports['getMessages']=function(_0x48926c,_0x498fc3,_0x169a17){var _0x114bd5={'raw':!![],'where':{}};var _0x1328e6={};var _0xc1db44={'count':0x0,'rows':[]};return db['MailAccount'][_0x05ad('0x64')]({'where':{'id':_0x48926c[_0x05ad('0x5e')]['id']}})[_0x05ad('0x21')](handleEntityNotFound(_0x498fc3,null))[_0x05ad('0x21')](function(_0x4b582c){if(_0x4b582c){_0x1328e6[_0x05ad('0x45')]=_[_0x05ad('0x47')](db['MailMessage'][_0x05ad('0x65')]);_0x1328e6[_0x05ad('0x46')]=_[_0x05ad('0x47')](_0x48926c['query']);_0x1328e6['filters']=_['intersection'](_0x1328e6[_0x05ad('0x45')],_0x1328e6['query']);_0x114bd5[_0x05ad('0x5a')]=_['intersection'](_0x1328e6[_0x05ad('0x45')],qs[_0x05ad('0x49')](_0x48926c['query'][_0x05ad('0x49')]));_0x114bd5['attributes']=_0x114bd5[_0x05ad('0x5a')][_0x05ad('0x4a')]?_0x114bd5[_0x05ad('0x5a')]:_0x1328e6[_0x05ad('0x45')];if(!_0x48926c[_0x05ad('0x46')][_0x05ad('0x4b')](_0x05ad('0x4c'))){_0x114bd5['limit']=qs['limit'](_0x48926c[_0x05ad('0x46')][_0x05ad('0x30')]);_0x114bd5['offset']=qs[_0x05ad('0x2e')](_0x48926c['query'][_0x05ad('0x2e')]);}_0x114bd5[_0x05ad('0x4d')]=qs['sort'](_0x48926c[_0x05ad('0x46')][_0x05ad('0x4e')]);_0x114bd5[_0x05ad('0x4f')]=qs[_0x05ad('0x48')](_[_0x05ad('0x50')](_0x48926c[_0x05ad('0x46')],_0x1328e6[_0x05ad('0x48')]));_0x114bd5[_0x05ad('0x4f')][_0x05ad('0x60')]=_0x4b582c['id'];if(_0x48926c[_0x05ad('0x46')][_0x05ad('0x53')]){_0x114bd5['where']=_['merge'](_0x114bd5[_0x05ad('0x4f')],{'$or':_['map'](_0x114bd5[_0x05ad('0x5a')],function(_0x25bd2f){var _0x70192c={};_0x70192c[_0x25bd2f]={'$like':'%'+_0x48926c['query'][_0x05ad('0x53')]+'%'};return _0x70192c;})});}if(_0x48926c['query']['$gte']){var _0x51741e=_0x48926c[_0x05ad('0x46')]['$gte'][_0x05ad('0x9d')](',');var _0x215601={};_0x215601[_0x51741e[0x0]]={'$gte':moment(_0x51741e[0x1])[_0x05ad('0x9e')](_0x05ad('0x9f'))};_0x114bd5['where']=_['merge'](_0x114bd5[_0x05ad('0x4f')],_0x215601);}_0x114bd5=_[_0x05ad('0x51')]({},_0x114bd5,_0x48926c[_0x05ad('0x54')]);return db[_0x05ad('0xa0')][_0x05ad('0x31')]({'where':_0x114bd5['where']})[_0x05ad('0x21')](function(_0x13c42d){_0xc1db44['count']=_0x13c42d;if(_0x48926c['query'][_0x05ad('0x55')]){_0x114bd5['include']=[{'all':!![]}];}return db[_0x05ad('0xa0')][_0x05ad('0x67')](_0x114bd5);})[_0x05ad('0x21')](function(_0x1cb0f6){if(_0x48926c[_0x05ad('0x46')][_0x05ad('0xa1')]===_0x05ad('0xa2')){for(var _0x5b5fb3=0x0;_0x5b5fb3<_0x1cb0f6[_0x05ad('0x4a')];_0x5b5fb3++){_0x1cb0f6[_0x5b5fb3][_0x05ad('0x5d')]=juice(_0x1cb0f6[_0x5b5fb3]['body']);}}_0xc1db44['rows']=_0x1cb0f6;return _0xc1db44;});}})['then'](respondWithFilteredResult(_0x498fc3,_0x114bd5))[_0x05ad('0x57')](handleError(_0x498fc3,null));};exports['send']=function(_0x3b6a09,_0x13885f,_0x276ffe){var _0x3d2f73,_0xe0f5ce={},_0x1844c3;if(_0x3b6a09[_0x05ad('0x5d')]['to']){_0x1844c3=_0x3b6a09['body']['to'][_0x05ad('0x9d')](',')[0x0];}return db[_0x05ad('0x42')][_0x05ad('0x5c')]({'where':{'id':_0x3b6a09[_0x05ad('0x5e')]['id']},'include':[{'model':db['CmList'],'as':_0x05ad('0xa3'),'include':[{'model':db['CmContact'],'as':_0x05ad('0xa4'),'where':{'email':_0x1844c3},'limit':0x1,'order':[[_0x05ad('0xa5'),_0x05ad('0xa6')]]}]},{'model':db[_0x05ad('0x3d')],'as':_0x05ad('0x3e'),'raw':!![]}]})['then'](handleEntityNotFound(_0x13885f,null))['then'](function(_0x54b7c5){if(_0x54b7c5){_0x3d2f73=_0x54b7c5;if(_0x54b7c5[_0x05ad('0x3e')]){if(_[_0x05ad('0x71')](_0x3b6a09[_0x05ad('0x5d')][_0x05ad('0xa7')])){_0x3b6a09[_0x05ad('0x5d')][_0x05ad('0xa7')]=util[_0x05ad('0x9e')](_0x05ad('0xa8'),_0x54b7c5[_0x05ad('0x39')],_0x54b7c5[_0x05ad('0x6f')]||_0x54b7c5['Smtp']['user']);}if(_0x3b6a09[_0x05ad('0x5d')]['attachments']&&_0x3b6a09['body'][_0x05ad('0xa9')][_0x05ad('0x4a')]){for(var _0x5e9315=0x0;_0x5e9315<_0x3b6a09[_0x05ad('0x5d')][_0x05ad('0xa9')][_0x05ad('0x4a')];_0x5e9315+=0x1){_0x3b6a09[_0x05ad('0x5d')]['attachments'][_0x5e9315]={'filename':_0x3b6a09[_0x05ad('0x5d')]['attachments'][_0x5e9315][_0x05ad('0x39')],'path':path['join'](config[_0x05ad('0xaa')],_0x05ad('0xab'),_0x3b6a09[_0x05ad('0x5d')][_0x05ad('0xa9')][_0x5e9315][_0x05ad('0xac')])};}}var _0x6a129f={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x54b7c5[_0x05ad('0x3e')][_0x05ad('0x7c')])){if(_0x54b7c5[_0x05ad('0x3e')]['authentication']){_0x6a129f[_0x05ad('0xad')]={'user':_0x54b7c5[_0x05ad('0x3e')][_0x05ad('0x76')],'pass':_0x54b7c5[_0x05ad('0x3e')]['pass']};}_0x6a129f['host']=_0x54b7c5['Smtp'][_0x05ad('0x7a')];_0x6a129f[_0x05ad('0x7b')]=_0x54b7c5[_0x05ad('0x3e')][_0x05ad('0x7b')];_0x6a129f['secure']=_0x54b7c5[_0x05ad('0x3e')]['secure'];}else{_0x6a129f[_0x05ad('0x7c')]=_0x54b7c5[_0x05ad('0x3e')][_0x05ad('0x7c')];_0x6a129f[_0x05ad('0xad')]={'user':_0x54b7c5['Smtp'][_0x05ad('0x76')],'pass':_0x54b7c5[_0x05ad('0x3e')]['pass']};}return respondWithRpcPromise(_0x05ad('0xae'),_0x05ad('0xaf'),{'account':_0x6a129f,'message':_0x3b6a09[_0x05ad('0x5d')]});}else{throw new Error(_0x05ad('0xb0'));}}})['then'](function(_0xc6a5b9){if(_0xc6a5b9){_0xe0f5ce=_0xc6a5b9;if(_0x3d2f73[_0x05ad('0xa3')]){if(_0x3d2f73[_0x05ad('0xa3')]['Contacts']['length']){return _0x3d2f73[_0x05ad('0xa3')]['Contacts'][0x0];}else{return db['CmContact']['create'](_[_0x05ad('0x19')](_0x3b6a09['body'],{'firstName':_0x3b6a09[_0x05ad('0x5d')]['to'],'email':_0x3b6a09['body']['to'],'phone':_0x3b6a09[_0x05ad('0x5d')]['to'],'ListId':_0x3d2f73[_0x05ad('0x70')]}));}}else{throw new Error('List\x20not\x20found');}}})['then'](function(_0x1a0f97){if(_0x1a0f97){var _0x4e69b0={'UserId':_0x3b6a09[_0x05ad('0x76')]['id'],'ContactId':_0x1a0f97['id'],'MailAccountId':_0x3d2f73['id'],'inReplyTo':_0xe0f5ce[_0x05ad('0xb1')],'to':_0x3b6a09[_0x05ad('0x5d')][_0x05ad('0xa7')],'cc':_0x3b6a09['body']['cc'],'subject':_0x3b6a09[_0x05ad('0x5d')]['subject'],'attach':_0x3b6a09[_0x05ad('0x5d')][_0x05ad('0xb2')],'firstMsgDirection':_0x05ad('0xb3'),'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x05ad('0xb3'),'Messages':[_[_0x05ad('0x51')](_0x3b6a09[_0x05ad('0x5d')],{'messageId':_0xe0f5ce[_0x05ad('0xb1')],'sentAt':moment()[_0x05ad('0x9e')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x3d2f73['id'],'UserId':_0x3b6a09[_0x05ad('0x76')]['id'],'ContactId':_0x1a0f97['id']})]};if(_0x3b6a09[_0x05ad('0x5d')][_0x05ad('0xb4')]){_0x4e69b0=_[_0x05ad('0x51')](_0x4e69b0,_0x3b6a09['body']['Interaction']);}return db[_0x05ad('0x8d')]['create'](_0x4e69b0,{'include':[{'model':db[_0x05ad('0xa0')],'as':_0x05ad('0xb5')}]});}})[_0x05ad('0x21')](respondWithResult(_0x13885f,null))['catch'](handleError(_0x13885f,null));};exports['verifySmtp']=function(_0x107428,_0x41ef5d,_0x104343){return db[_0x05ad('0x42')][_0x05ad('0x5c')]({'where':{'id':_0x107428[_0x05ad('0x5e')]['id']},'include':[{'model':db[_0x05ad('0x3d')],'as':_0x05ad('0x3e'),'raw':!![]}]})[_0x05ad('0x21')](handleEntityNotFound(_0x41ef5d,null))[_0x05ad('0x21')](function(_0x25a3a1){if(_0x25a3a1&&_0x25a3a1[_0x05ad('0x3e')]){var _0x5ff81b={'id':_0x25a3a1['id'],'tls':{'rejectUnauthorized':![]}};if(_0x25a3a1[_0x05ad('0x3e')]['service']){_0x5ff81b['service']=_0x25a3a1['Smtp'][_0x05ad('0x7c')];}else{_0x5ff81b[_0x05ad('0x7a')]=_0x25a3a1[_0x05ad('0x3e')][_0x05ad('0x7a')];_0x5ff81b['port']=_0x25a3a1[_0x05ad('0x3e')][_0x05ad('0x7b')];_0x5ff81b['secure']=_0x25a3a1[_0x05ad('0x3e')][_0x05ad('0xb6')];}if(_0x25a3a1['Smtp'][_0x05ad('0x79')]){_0x5ff81b[_0x05ad('0xad')]={'user':_0x25a3a1[_0x05ad('0x3e')][_0x05ad('0x76')],'pass':_0x25a3a1[_0x05ad('0x3e')][_0x05ad('0x7e')]};}return respondWithRpcPromise(_0x05ad('0xb7'),_0x05ad('0xb8'),{'account':_0x5ff81b});}})[_0x05ad('0x21')](respondWithResult(_0x41ef5d,null))[_0x05ad('0x57')](handleError(_0x41ef5d,null));};exports[_0x05ad('0x35')]=function(_0x1ccf16,_0x1a7232){return db[_0x05ad('0x42')]['find']({'where':{'id':_0x1ccf16[_0x05ad('0x5e')]['id']}})['then'](handleEntityNotFound(_0x1a7232,null))[_0x05ad('0x21')](function(_0x182968){if(_0x182968&&_0x182968[_0x05ad('0x7c')]){throw new db[(_0x05ad('0xb9'))][(_0x05ad('0xba'))](_0x05ad('0xbb'));}return _0x182968;})[_0x05ad('0x21')](removeEntity(_0x1a7232,null))['catch'](handleError(_0x1a7232,null));};exports[_0x05ad('0xbc')]=function(_0x221d2d,_0x1d122c,_0xc97247){return db[_0x05ad('0x42')][_0x05ad('0x5c')]({'where':{'id':_0x221d2d[_0x05ad('0x5e')]['id']}})[_0x05ad('0x21')](handleEntityNotFound(_0x1d122c,null))[_0x05ad('0x21')](function(_0xff15eb){if(_0xff15eb){return _0xff15eb[_0x05ad('0xbc')](_0x221d2d['body'][_0x05ad('0x69')],_['omit'](_0x221d2d[_0x05ad('0x5d')],[_0x05ad('0x69'),'id'])||{})['spread'](function(_0x4d3755){for(var _0x6a30c6=0x0;_0x6a30c6<_0x221d2d[_0x05ad('0x5d')][_0x05ad('0x69')][_0x05ad('0x4a')];_0x6a30c6+=0x1){socket[_0x05ad('0xbd')](_0x05ad('0xbe'),{'UserId':Number(_0x221d2d[_0x05ad('0x5d')]['ids'][_0x6a30c6]),'MailAccountId':Number(_0x221d2d[_0x05ad('0x5e')]['id'])});}return _0x4d3755;});}})[_0x05ad('0x21')](respondWithResult(_0x1d122c,null))[_0x05ad('0x57')](handleError(_0x1d122c,null));};exports['removeAgents']=function(_0x3792cb,_0xa97f6a,_0xaec8ad){return db[_0x05ad('0x42')][_0x05ad('0x5c')]({'where':{'id':_0x3792cb[_0x05ad('0x5e')]['id']}})[_0x05ad('0x21')](handleEntityNotFound(_0xa97f6a,null))[_0x05ad('0x21')](function(_0x51fd9b){if(_0x51fd9b){return _0x51fd9b[_0x05ad('0xbf')](_0x3792cb[_0x05ad('0x46')][_0x05ad('0x69')])[_0x05ad('0x21')](function(){if(_[_0x05ad('0xc0')](_0x3792cb[_0x05ad('0x46')][_0x05ad('0x69')])){for(var _0x4aa672=0x0;_0x4aa672<_0x3792cb[_0x05ad('0x46')][_0x05ad('0x69')][_0x05ad('0x4a')];_0x4aa672+=0x1){socket['emit'](_0x05ad('0xc1'),{'UserId':Number(_0x3792cb[_0x05ad('0x46')][_0x05ad('0x69')][_0x4aa672]),'MailAccountId':Number(_0x3792cb[_0x05ad('0x5e')]['id'])});}}else{socket['emit'](_0x05ad('0xc1'),{'UserId':Number(_0x3792cb[_0x05ad('0x46')][_0x05ad('0x69')]),'MailAccountId':Number(_0x3792cb[_0x05ad('0x5e')]['id'])});}});}})[_0x05ad('0x21')](respondWithStatusCode(_0xa97f6a,null))['catch'](handleError(_0xa97f6a,null));};exports[_0x05ad('0xc2')]=function(_0x35de84,_0x5ee1a7,_0x4a3731){var _0x27ffb4={};var _0x401b8a={};var _0x425005;var _0x28fe46;return db[_0x05ad('0x42')][_0x05ad('0x64')]({'where':{'id':_0x35de84[_0x05ad('0x5e')]['id']}})[_0x05ad('0x21')](handleEntityNotFound(_0x5ee1a7,null))['then'](function(_0x975c76){if(_0x975c76){_0x425005=_0x975c76;_0x401b8a['model']=_[_0x05ad('0x47')](db[_0x05ad('0x91')][_0x05ad('0x65')]);_0x401b8a[_0x05ad('0x46')]=_[_0x05ad('0x47')](_0x35de84['query']);_0x401b8a[_0x05ad('0x48')]=_[_0x05ad('0x66')](_0x401b8a[_0x05ad('0x45')],_0x401b8a['query']);_0x27ffb4[_0x05ad('0x5a')]=_[_0x05ad('0x66')](_0x401b8a[_0x05ad('0x45')],qs['fields'](_0x35de84[_0x05ad('0x46')][_0x05ad('0x49')]));_0x27ffb4[_0x05ad('0x5a')]=_0x27ffb4['attributes'][_0x05ad('0x4a')]?_0x27ffb4[_0x05ad('0x5a')]:_0x401b8a['model'];_0x27ffb4['order']=qs[_0x05ad('0x4e')](_0x35de84['query']['sort']);_0x27ffb4[_0x05ad('0x4f')]=qs[_0x05ad('0x48')](_[_0x05ad('0x50')](_0x35de84[_0x05ad('0x46')],_0x401b8a[_0x05ad('0x48')]));if(_0x35de84[_0x05ad('0x46')][_0x05ad('0x53')]){_0x27ffb4[_0x05ad('0x4f')]=_[_0x05ad('0x51')](_0x27ffb4['where'],{'$or':_['map'](_0x27ffb4[_0x05ad('0x5a')],function(_0x1db106){var _0xb2d89f={};_0xb2d89f[_0x1db106]={'$like':'%'+_0x35de84[_0x05ad('0x46')]['filter']+'%'};return _0xb2d89f;})});}_0x27ffb4=_[_0x05ad('0x51')]({},_0x27ffb4,_0x35de84[_0x05ad('0x54')]);return _0x425005[_0x05ad('0xc2')](_0x27ffb4);}})[_0x05ad('0x21')](function(_0xe3ce79){if(_0xe3ce79){_0x28fe46=_0xe3ce79[_0x05ad('0x4a')];if(!_0x35de84[_0x05ad('0x46')][_0x05ad('0x4b')]('nolimit')){_0x27ffb4[_0x05ad('0x30')]=qs[_0x05ad('0x30')](_0x35de84['query'][_0x05ad('0x30')]);_0x27ffb4['offset']=qs[_0x05ad('0x2e')](_0x35de84[_0x05ad('0x46')][_0x05ad('0x2e')]);}return _0x425005[_0x05ad('0xc2')](_0x27ffb4);}})[_0x05ad('0x21')](function(_0x53658d){if(_0x53658d){return _0x53658d?{'count':_0x28fe46,'rows':_0x53658d}:null;}})[_0x05ad('0x21')](respondWithResult(_0x5ee1a7,null))[_0x05ad('0x57')](handleError(_0x5ee1a7,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 7a60a0d..27c38b5 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 _0x4f75=['emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','remove'];(function(_0x5be1fb,_0x3b19c3){var _0x29c471=function(_0x3c81b){while(--_0x3c81b){_0x5be1fb['push'](_0x5be1fb['shift']());}};_0x29c471(++_0x3b19c3);}(_0x4f75,0xbb));var _0x54f7=function(_0x2a80cf,_0x3975a0){_0x2a80cf=_0x2a80cf-0x0;var _0x42f7f9=_0x4f75[_0x2a80cf];return _0x42f7f9;};'use strict';var EventEmitter=require(_0x54f7('0x0'));var MailAccount=require(_0x54f7('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x54f7('0x2')](0x0);var events={'afterCreate':_0x54f7('0x3'),'afterUpdate':'update','afterDestroy':_0x54f7('0x4')};function emitEvent(_0x383133){return function(_0x141cd0,_0x328d55,_0x11c0c9){MailAccountEvents[_0x54f7('0x5')](_0x383133+':'+_0x141cd0['id'],_0x141cd0);MailAccountEvents['emit'](_0x383133,_0x141cd0);_0x11c0c9(null);};}for(var e in events){if(events[_0x54f7('0x6')](e)){var event=events[e];MailAccount[_0x54f7('0x7')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file +var _0xfa74=['MailAccount','save','update','remove','emit','hook'];(function(_0x51108d,_0x3b15ce){var _0x4e8231=function(_0x558ef1){while(--_0x558ef1){_0x51108d['push'](_0x51108d['shift']());}};_0x4e8231(++_0x3b15ce);}(_0xfa74,0x1b0));var _0x4fa7=function(_0x535246,_0xb9ab72){_0x535246=_0x535246-0x0;var _0x43d339=_0xfa74[_0x535246];return _0x43d339;};'use strict';var EventEmitter=require('events');var MailAccount=require('../../mysqldb')['db'][_0x4fa7('0x0')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4fa7('0x1'),'afterUpdate':_0x4fa7('0x2'),'afterDestroy':_0x4fa7('0x3')};function emitEvent(_0x4dabf8){return function(_0x3296c3,_0x1ba5b9,_0x218cd3){MailAccountEvents[_0x4fa7('0x4')](_0x4dabf8+':'+_0x3296c3['id'],_0x3296c3);MailAccountEvents['emit'](_0x4dabf8,_0x3296c3);_0x218cd3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0x4fa7('0x5')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 10d4bba..1f42195 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 _0x354d=['MailAccount','lodash','api','moment','bluebird','rimraf','../../config/environment','./mailAccount.attributes','exports'];(function(_0x3f9d37,_0x1c1590){var _0x450b65=function(_0x49f20d){while(--_0x49f20d){_0x3f9d37['push'](_0x3f9d37['shift']());}};_0x450b65(++_0x1c1590);}(_0x354d,0x14e));var _0xd354=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x354d[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0xd354('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd354('0x1'));var moment=require(_0xd354('0x2'));var BPromise=require(_0xd354('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd354('0x4'));var config=require(_0xd354('0x5'));var attributes=require(_0xd354('0x6'));module[_0xd354('0x7')]=function(_0x513423,_0x40b992){return _0x513423['define'](_0xd354('0x8'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfe9b=['./mailAccount.attributes','define','MailAccount','mail_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x32b774,_0x785261){var _0x5f2ae3=function(_0x3ed03d){while(--_0x3ed03d){_0x32b774['push'](_0x32b774['shift']());}};_0x5f2ae3(++_0x785261);}(_0xfe9b,0x149));var _0xbfe9=function(_0x295811,_0xa1c6fe){_0x295811=_0x295811-0x0;var _0x2cdd67=_0xfe9b[_0x295811];return _0x2cdd67;};'use strict';var _=require(_0xbfe9('0x0'));var util=require(_0xbfe9('0x1'));var logger=require(_0xbfe9('0x2'))(_0xbfe9('0x3'));var moment=require('moment');var BPromise=require(_0xbfe9('0x4'));var rp=require(_0xbfe9('0x5'));var fs=require('fs');var path=require(_0xbfe9('0x6'));var rimraf=require(_0xbfe9('0x7'));var config=require(_0xbfe9('0x8'));var attributes=require(_0xbfe9('0x9'));module['exports']=function(_0x199322,_0x3c655a){return _0x199322[_0xbfe9('0xa')](_0xbfe9('0xb'),attributes,{'tableName':_0xbfe9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index a06fd99..c383d84 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 _0xae50=['omit','applications','list','orderBy','priority','asc','autoclose','push','close','length','create','contact','messageId','generate','subject','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','update','attach','format','interaction','created','attachments','originTo','originCc','bcc','originChannel','ChatOfflineMessageId','Attachment','Attachments','User','name','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','startRouting','Start','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailAccount','MailAccount','findAll','options','where','attributes','include','map','model','ShowMailAccount','find','raw','NotifyMailAccount','body','mail','difference','CmContact','rawAttributes','CompanyId','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','account','CmList','List','Contacts','updatedAt','MailApplication','Applications','MailServerOut','Smtp','get'];(function(_0x3d2587,_0x4c59be){var _0x137742=function(_0x24bdee){while(--_0x24bdee){_0x3d2587['push'](_0x3d2587['shift']());}};_0x137742(++_0x4c59be);}(_0xae50,0x179));var _0x0ae5=function(_0x2d9535,_0x4bc592){_0x2d9535=_0x2d9535-0x0;var _0xb4e710=_0xae50[_0x2d9535];return _0xb4e710;};'use strict';var _=require(_0x0ae5('0x0'));var util=require(_0x0ae5('0x1'));var moment=require(_0x0ae5('0x2'));var BPromise=require(_0x0ae5('0x3'));var rs=require(_0x0ae5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0ae5('0x5'))['db'];var utils=require(_0x0ae5('0x6'));var logger=require(_0x0ae5('0x7'))(_0x0ae5('0x8'));var config=require(_0x0ae5('0x9'));var jayson=require(_0x0ae5('0xa'));var client=jayson['client'][_0x0ae5('0xb')]({'port':0x232c});config[_0x0ae5('0xc')]=_[_0x0ae5('0xd')](config[_0x0ae5('0xc')],{'host':_0x0ae5('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0ae5('0xc')]));require(_0x0ae5('0xf'))[_0x0ae5('0x10')](socket);function respondWithRpcPromise(_0x392722,_0x27e9dd,_0x368dcc){return new BPromise(function(_0x555b93,_0x240c6f){return client[_0x0ae5('0x11')](_0x392722,_0x368dcc)[_0x0ae5('0x12')](function(_0x49d9c7){logger[_0x0ae5('0x13')](_0x0ae5('0x14'),_0x27e9dd,_0x0ae5('0x15'));logger[_0x0ae5('0x16')](_0x0ae5('0x17'),_0x27e9dd,'request\x20sent',JSON[_0x0ae5('0x18')](_0x49d9c7));if(_0x49d9c7['error']){if(_0x49d9c7[_0x0ae5('0x19')][_0x0ae5('0x1a')]===0x1f4){logger[_0x0ae5('0x19')](_0x0ae5('0x14'),_0x27e9dd,_0x49d9c7[_0x0ae5('0x19')][_0x0ae5('0x1b')]);return _0x240c6f(_0x49d9c7[_0x0ae5('0x19')][_0x0ae5('0x1b')]);}logger[_0x0ae5('0x19')](_0x0ae5('0x14'),_0x27e9dd,_0x49d9c7['error'][_0x0ae5('0x1b')]);return _0x555b93(_0x49d9c7[_0x0ae5('0x19')][_0x0ae5('0x1b')]);}else{logger[_0x0ae5('0x13')](_0x0ae5('0x14'),_0x27e9dd,_0x0ae5('0x15'));_0x555b93(_0x49d9c7[_0x0ae5('0x1c')][_0x0ae5('0x1b')]);}})[_0x0ae5('0x1d')](function(_0x272dc6){logger['error']('MailAccount,\x20%s,\x20%s',_0x27e9dd,_0x272dc6);_0x240c6f(_0x272dc6);});});}exports[_0x0ae5('0x1e')]=function(_0x43eacd){var _0x7751a0=this;return new Promise(function(_0x8af735,_0x183286){return db[_0x0ae5('0x1f')][_0x0ae5('0x20')]({'raw':_0x43eacd['options']?_0x43eacd[_0x0ae5('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x43eacd[_0x0ae5('0x21')]?_0x43eacd[_0x0ae5('0x21')][_0x0ae5('0x22')]||null:null,'attributes':_0x43eacd[_0x0ae5('0x21')]?_0x43eacd['options'][_0x0ae5('0x23')]||null:null,'limit':_0x43eacd[_0x0ae5('0x21')]?_0x43eacd[_0x0ae5('0x21')]['limit']||null:null,'include':_0x43eacd[_0x0ae5('0x21')]?_0x43eacd['options'][_0x0ae5('0x24')]?_[_0x0ae5('0x25')](_0x43eacd[_0x0ae5('0x21')][_0x0ae5('0x24')],function(_0x50f519){return{'model':db[_0x50f519[_0x0ae5('0x26')]],'as':_0x50f519['as'],'attributes':_0x50f519[_0x0ae5('0x23')],'include':_0x50f519['include']?_[_0x0ae5('0x25')](_0x50f519[_0x0ae5('0x24')],function(_0x58f521){return{'model':db[_0x58f521[_0x0ae5('0x26')]],'as':_0x58f521['as'],'attributes':_0x58f521[_0x0ae5('0x23')],'include':_0x58f521[_0x0ae5('0x24')]?_[_0x0ae5('0x25')](_0x58f521[_0x0ae5('0x24')],function(_0x23b82c){return{'model':db[_0x23b82c[_0x0ae5('0x26')]],'as':_0x23b82c['as'],'attributes':_0x23b82c[_0x0ae5('0x23')]};}):[]};}):[]};}):[]:[]})[_0x0ae5('0x12')](function(_0x2da991){logger['info']('GetMailAccount',_0x43eacd);logger[_0x0ae5('0x16')]('GetMailAccount',_0x43eacd,JSON['stringify'](_0x2da991));_0x8af735(_0x2da991);})[_0x0ae5('0x1d')](function(_0x1481bc){logger[_0x0ae5('0x19')](_0x0ae5('0x1e'),_0x1481bc[_0x0ae5('0x1b')],_0x43eacd);_0x183286(_0x7751a0[_0x0ae5('0x19')](0x1f4,_0x1481bc[_0x0ae5('0x1b')]));});});};exports[_0x0ae5('0x27')]=function(_0x128263){var _0x3e4a21=this;return new Promise(function(_0x40217d,_0x594a3a){return db[_0x0ae5('0x1f')][_0x0ae5('0x28')]({'raw':_0x128263[_0x0ae5('0x21')]?_0x128263[_0x0ae5('0x21')][_0x0ae5('0x29')]===undefined?!![]:![]:!![],'where':_0x128263['options']?_0x128263['options'][_0x0ae5('0x22')]||null:null,'attributes':_0x128263[_0x0ae5('0x21')]?_0x128263[_0x0ae5('0x21')][_0x0ae5('0x23')]||null:null,'include':_0x128263[_0x0ae5('0x21')]?_0x128263['options'][_0x0ae5('0x24')]?_[_0x0ae5('0x25')](_0x128263[_0x0ae5('0x21')][_0x0ae5('0x24')],function(_0x117a23){return{'model':db[_0x117a23[_0x0ae5('0x26')]],'as':_0x117a23['as'],'attributes':_0x117a23[_0x0ae5('0x23')],'include':_0x117a23[_0x0ae5('0x24')]?_['map'](_0x117a23[_0x0ae5('0x24')],function(_0xa3e785){return{'model':db[_0xa3e785[_0x0ae5('0x26')]],'as':_0xa3e785['as'],'attributes':_0xa3e785[_0x0ae5('0x23')],'include':_0xa3e785['include']?_[_0x0ae5('0x25')](_0xa3e785[_0x0ae5('0x24')],function(_0x33d400){return{'model':db[_0x33d400[_0x0ae5('0x26')]],'as':_0x33d400['as'],'attributes':_0x33d400[_0x0ae5('0x23')]};}):[]};}):[]};}):[]:[]})[_0x0ae5('0x12')](function(_0x5c0110){logger[_0x0ae5('0x13')](_0x0ae5('0x27'),_0x128263);logger['debug']('ShowMailAccount',_0x128263,JSON[_0x0ae5('0x18')](_0x5c0110));_0x40217d(_0x5c0110);})[_0x0ae5('0x1d')](function(_0x42a84e){logger['error'](_0x0ae5('0x27'),_0x42a84e[_0x0ae5('0x1b')],_0x128263);_0x594a3a(_0x3e4a21[_0x0ae5('0x19')](0x1f4,_0x42a84e['message']));});});};exports[_0x0ae5('0x2a')]=function(_0xbcc7a2){var _0xb71e86=this;return new Promise(function(_0x11ae91,_0x22c8bb){var _0x39c0bd={'body':_0xbcc7a2[_0x0ae5('0x2b')],'channel':_0x0ae5('0x2c')};var _0x4a1af0=_[_0x0ae5('0x2d')](_['keys'](db[_0x0ae5('0x2e')][_0x0ae5('0x2f')]),['createdAt','updatedAt',_0x0ae5('0x30'),_0x0ae5('0x31')]);var _0x505301=![];if(_0xbcc7a2['body']['id']){delete _0xbcc7a2[_0x0ae5('0x2b')]['id'];}if(_['isNil'](_0xbcc7a2[_0x0ae5('0x2b')][_0x0ae5('0x32')])){return _0x22c8bb(_0xb71e86[_0x0ae5('0x19')](0x1f4,_0x0ae5('0x33')));}if(_['isNil'](_0xbcc7a2[_0x0ae5('0x2b')][_0x0ae5('0x2b')])||_0xbcc7a2[_0x0ae5('0x2b')]['body']===''){return _0x22c8bb(_0xb71e86[_0x0ae5('0x19')](0x1f4,_0x0ae5('0x34')));}if(_['isNil'](_0xbcc7a2[_0x0ae5('0x2b')]['mapKey'])){return _0x22c8bb(_0xb71e86[_0x0ae5('0x19')](0x1f4,_0x0ae5('0x35')+_0x4a1af0));}if(!_[_0x0ae5('0x36')](_0x4a1af0,_0xbcc7a2[_0x0ae5('0x2b')]['mapKey'])){return _0x22c8bb(_0xb71e86[_0x0ae5('0x19')](0x1f4,_0x0ae5('0x37')+_0x4a1af0));}var _0x378489={};_0x378489[_0xbcc7a2[_0x0ae5('0x2b')][_0x0ae5('0x38')]]=_0xbcc7a2['body'][_0x0ae5('0x32')];return db[_0x0ae5('0x1f')][_0x0ae5('0x28')]({'where':{'id':_0xbcc7a2[_0x0ae5('0x39')]['id']},'include':[{'model':db[_0x0ae5('0x3a')],'as':_0x0ae5('0x3b'),'include':[{'model':db['CmContact'],'as':_0x0ae5('0x3c'),'where':_0x378489,'limit':0x1,'order':[[_0x0ae5('0x3d'),'DESC']]}]},{'model':db[_0x0ae5('0x3e')],'as':_0x0ae5('0x3f')},{'model':db[_0x0ae5('0x40')],'as':_0x0ae5('0x41')}]})[_0x0ae5('0x12')](function(_0x421305){if(_0x421305&&_0x421305['List']){var _0x1eb9d2=_0x421305[_0x0ae5('0x42')]({'plain':!![]});_0x39c0bd[_0x0ae5('0x39')]=_[_0x0ae5('0x43')](_0x1eb9d2,['Applications','List']);_0x39c0bd[_0x0ae5('0x44')]=_0x1eb9d2[_0x0ae5('0x3f')];_0x39c0bd[_0x0ae5('0x45')]=_0x1eb9d2[_0x0ae5('0x3b')];_0x39c0bd[_0x0ae5('0x44')]=_[_0x0ae5('0x46')](_0x39c0bd[_0x0ae5('0x44')],[_0x0ae5('0x47')],[_0x0ae5('0x48')]);if(_0x39c0bd[_0x0ae5('0x39')]&&_0x39c0bd[_0x0ae5('0x39')][_0x0ae5('0x49')]){_0x39c0bd[_0x0ae5('0x44')][_0x0ae5('0x4a')]({'id':0x0,'priority':_0x39c0bd[_0x0ae5('0x44')]['length']+0x1,'app':_0x0ae5('0x4b'),'appdata':_0x0ae5('0x49'),'interval':'*,*,*,*'});}if(_0x39c0bd[_0x0ae5('0x39')]['Applications']){delete _0x39c0bd[_0x0ae5('0x39')][_0x0ae5('0x3f')];}if(_0x39c0bd[_0x0ae5('0x39')][_0x0ae5('0x3b')]){delete _0x39c0bd[_0x0ae5('0x39')][_0x0ae5('0x3b')];}if(_0x1eb9d2[_0x0ae5('0x3b')][_0x0ae5('0x3c')][_0x0ae5('0x4c')]){return _0x1eb9d2['List'][_0x0ae5('0x3c')][0x0];}var _0x29c16d=_[_0x0ae5('0xd')](_0xbcc7a2[_0x0ae5('0x2b')],{'firstName':_0xbcc7a2[_0x0ae5('0x2b')][_0x0ae5('0x32')],'ListId':_0x1eb9d2['ListId']});_0x29c16d[_0xbcc7a2['body'][_0x0ae5('0x38')]]=_0xbcc7a2[_0x0ae5('0x2b')][_0x0ae5('0x32')];return db[_0x0ae5('0x2e')][_0x0ae5('0x4d')](_0x29c16d);}else{throw new Error('List\x20not\x20found');}})['then'](function(_0x16b12d){_0x39c0bd[_0x0ae5('0x4e')]=_0x16b12d;if(_0x16b12d){if(!_0xbcc7a2['body'][_0x0ae5('0x1b')][_0x0ae5('0x4f')]){_0xbcc7a2['body'][_0x0ae5('0x1b')]['messageId']=rs[_0x0ae5('0x50')]()+'\x20'+_0xbcc7a2['body'][_0x0ae5('0x1b')][_0x0ae5('0x32')];}var _0x3ba50a={'ContactId':_0x16b12d['id'],'MailAccountId':_0xbcc7a2[_0x0ae5('0x39')]['id'],'inReplyTo':_0xbcc7a2[_0x0ae5('0x2b')][_0x0ae5('0x1b')][_0x0ae5('0x4f')],'to':_0xbcc7a2[_0x0ae5('0x2b')][_0x0ae5('0x1b')][_0x0ae5('0x32')],'cc':_0xbcc7a2[_0x0ae5('0x2b')]['message']['cc'],'subject':_0xbcc7a2['body'][_0x0ae5('0x1b')][_0x0ae5('0x51')],'attach':_0xbcc7a2['body'][_0x0ae5('0x1b')]['attach'],'lastMsgAt':moment()['format'](_0x0ae5('0x52')),'lastMsgDirection':'in'};return db[_0x0ae5('0x53')]['find']({'where':{'closed':![],'MailAccountId':_0xbcc7a2[_0x0ae5('0x39')]['id']},'include':[{'model':db[_0x0ae5('0x54')],'as':_0x0ae5('0x55'),'attributes':['messageId'],'where':{'messageId':_0xbcc7a2[_0x0ae5('0x2b')][_0x0ae5('0x1b')][_0x0ae5('0x56')]}}]})[_0x0ae5('0x12')](function(_0x4c3980){if(_0x4c3980){return[_0x4c3980,![]];}return db[_0x0ae5('0x53')]['create'](_0x3ba50a)[_0x0ae5('0x12')](function(_0x5f5846){return[_0x5f5846,!![]];});});}else{throw new Error(_0x0ae5('0x57'));}})[_0x0ae5('0x58')](function(_0x334878,_0x4d805d){if(_0x334878){_0x505301=_0x4d805d;if(!_0x4d805d){return _0x334878[_0x0ae5('0x59')]({'inReplyTo':_0xbcc7a2[_0x0ae5('0x2b')][_0x0ae5('0x1b')][_0x0ae5('0x4f')],'to':_0xbcc7a2[_0x0ae5('0x2b')][_0x0ae5('0x1b')][_0x0ae5('0x32')],'cc':_0xbcc7a2[_0x0ae5('0x2b')][_0x0ae5('0x1b')]['cc'],'subject':_0xbcc7a2[_0x0ae5('0x2b')][_0x0ae5('0x1b')][_0x0ae5('0x51')],'attach':_0x334878[_0x0ae5('0x5a')]?_0x334878[_0x0ae5('0x5a')]:_0xbcc7a2['body'][_0x0ae5('0x1b')][_0x0ae5('0x5a')],'substatus':null,'substatusAt':moment()[_0x0ae5('0x5b')](_0x0ae5('0x52')),'lastMsgAt':moment()[_0x0ae5('0x5b')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x334878;}}})[_0x0ae5('0x12')](function(_0x3f8cbc){_0x39c0bd[_0x0ae5('0x5c')]=_0x3f8cbc[_0x0ae5('0x42')]({'plain':!![]});_0x39c0bd['interaction'][_0x0ae5('0x5d')]=_0x505301;return db[_0x0ae5('0x54')][_0x0ae5('0x4d')]({'body':_0xbcc7a2[_0x0ae5('0x2b')][_0x0ae5('0x2b')],'MailAccountId':_0xbcc7a2[_0x0ae5('0x39')]['id'],'MailInteractionId':_0x3f8cbc['id'],'direction':'in','ContactId':_0x39c0bd[_0x0ae5('0x4e')]['id'],'messageId':_0xbcc7a2[_0x0ae5('0x2b')]['message']['messageId'],'from':_0xbcc7a2['body'][_0x0ae5('0x1b')][_0x0ae5('0x32')],'to':_0xbcc7a2[_0x0ae5('0x2b')][_0x0ae5('0x1b')]['to'],'cc':_0xbcc7a2[_0x0ae5('0x2b')][_0x0ae5('0x1b')]['cc'],'subject':_0xbcc7a2[_0x0ae5('0x2b')][_0x0ae5('0x1b')][_0x0ae5('0x51')],'attach':_0xbcc7a2['body'][_0x0ae5('0x1b')][_0x0ae5('0x5a')],'Attachments':_0xbcc7a2[_0x0ae5('0x2b')][_0x0ae5('0x1b')][_0x0ae5('0x5e')],'originTo':_0xbcc7a2[_0x0ae5('0x2b')][_0x0ae5('0x1b')][_0x0ae5('0x5f')],'originCc':_0xbcc7a2[_0x0ae5('0x2b')][_0x0ae5('0x1b')][_0x0ae5('0x60')],'bcc':_0xbcc7a2[_0x0ae5('0x2b')][_0x0ae5('0x1b')][_0x0ae5('0x61')],'ChatWebsiteId':_0xbcc7a2[_0x0ae5('0x2b')][_0x0ae5('0x1b')]['ChatWebsiteId']||null,'originChannel':_0xbcc7a2[_0x0ae5('0x2b')][_0x0ae5('0x1b')][_0x0ae5('0x62')]||'Email','ChatOfflineMessageId':_0xbcc7a2[_0x0ae5('0x2b')][_0x0ae5('0x1b')][_0x0ae5('0x63')]||null},{'include':[{'model':db[_0x0ae5('0x64')],'as':_0x0ae5('0x65')}]});})[_0x0ae5('0x12')](function(_0x23f423){_0x39c0bd['message']=_0x23f423;if(_0x39c0bd[_0x0ae5('0x5c')]['UserId']){return db[_0x0ae5('0x66')][_0x0ae5('0x28')]({'attributes':['id',_0x0ae5('0x67')],'where':{'id':_0x39c0bd[_0x0ae5('0x5c')][_0x0ae5('0x68')]}})['then'](function(_0x336521){if(_0x336521){_0x39c0bd[_0x0ae5('0x44')][_0x0ae5('0x69')]({'id':0x0,'priority':0x0,'app':_0x0ae5('0x6a'),'appdata':_0x336521[_0x0ae5('0x67')]+','+(_0x39c0bd[_0x0ae5('0x39')][_0x0ae5('0x6b')]||0xa),'interval':_0x0ae5('0x6c')});}return respondWithRpcPromise('Start',_0x0ae5('0x6d'),_0x39c0bd);});}return respondWithRpcPromise(_0x0ae5('0x6e'),_0x0ae5('0x6d'),_0x39c0bd);})[_0x0ae5('0x12')](function(_0x1b3caa){_0x11ae91(_0x1b3caa);})[_0x0ae5('0x1d')](function(_0x4c268a){_0x22c8bb(_0xb71e86[_0x0ae5('0x19')](0x1f4,_0x4c268a[_0x0ae5('0x1b')]));});});}; \ No newline at end of file +var _0x7f0a=['raw','where','limit','include','model','attributes','map','GetMailAccount','ShowMailAccount','find','body','mail','keys','CmContact','createdAt','updatedAt','CompanyId','ListId','from','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','List','Contacts','DESC','MailApplication','Applications','MailServerOut','get','account','omit','list','applications','orderBy','asc','push','length','close','*,*,*,*','create','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','Messages','inReplyTo','Contact\x20not\x20found','update','interaction','created','MailMessage','attachments','originCc','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','User','name','unshift','agent','Start','startRouting','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','then','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','MailAccount,\x20%s,\x20%s','message','result','catch','MailAccount','findAll','options'];(function(_0x12ea90,_0x1a6106){var _0x4a38a6=function(_0x226705){while(--_0x226705){_0x12ea90['push'](_0x12ea90['shift']());}};_0x4a38a6(++_0x1a6106);}(_0x7f0a,0xb6));var _0xa7f0=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0x7f0a[_0x23e7c1];return _0x1add43;};'use strict';var _=require(_0xa7f0('0x0'));var util=require('util');var moment=require(_0xa7f0('0x1'));var BPromise=require(_0xa7f0('0x2'));var rs=require(_0xa7f0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa7f0('0x4'))['db'];var utils=require(_0xa7f0('0x5'));var logger=require(_0xa7f0('0x6'))(_0xa7f0('0x7'));var config=require(_0xa7f0('0x8'));var jayson=require(_0xa7f0('0x9'));var client=jayson[_0xa7f0('0xa')][_0xa7f0('0xb')]({'port':0x232c});config[_0xa7f0('0xc')]=_[_0xa7f0('0xd')](config[_0xa7f0('0xc')],{'host':_0xa7f0('0xe'),'port':0x18eb});var socket=require(_0xa7f0('0xf'))(new Redis(config[_0xa7f0('0xc')]));require(_0xa7f0('0x10'))[_0xa7f0('0x11')](socket);function respondWithRpcPromise(_0x1a2cd7,_0x22858d,_0x519c35){return new BPromise(function(_0x4f70e3,_0x235050){return client['request'](_0x1a2cd7,_0x519c35)[_0xa7f0('0x12')](function(_0x4a931c){logger[_0xa7f0('0x13')]('MailAccount,\x20%s,\x20%s',_0x22858d,_0xa7f0('0x14'));logger[_0xa7f0('0x15')](_0xa7f0('0x16'),_0x22858d,_0xa7f0('0x14'),JSON[_0xa7f0('0x17')](_0x4a931c));if(_0x4a931c['error']){if(_0x4a931c[_0xa7f0('0x18')]['code']===0x1f4){logger[_0xa7f0('0x18')](_0xa7f0('0x19'),_0x22858d,_0x4a931c[_0xa7f0('0x18')][_0xa7f0('0x1a')]);return _0x235050(_0x4a931c[_0xa7f0('0x18')][_0xa7f0('0x1a')]);}logger[_0xa7f0('0x18')]('MailAccount,\x20%s,\x20%s',_0x22858d,_0x4a931c['error']['message']);return _0x4f70e3(_0x4a931c['error'][_0xa7f0('0x1a')]);}else{logger[_0xa7f0('0x13')](_0xa7f0('0x19'),_0x22858d,_0xa7f0('0x14'));_0x4f70e3(_0x4a931c[_0xa7f0('0x1b')][_0xa7f0('0x1a')]);}})[_0xa7f0('0x1c')](function(_0x11e88a){logger[_0xa7f0('0x18')]('MailAccount,\x20%s,\x20%s',_0x22858d,_0x11e88a);_0x235050(_0x11e88a);});});}exports['GetMailAccount']=function(_0x5c0848){var _0x15a3be=this;return new Promise(function(_0x4167e4,_0x8f77c3){return db[_0xa7f0('0x1d')][_0xa7f0('0x1e')]({'raw':_0x5c0848[_0xa7f0('0x1f')]?_0x5c0848['options'][_0xa7f0('0x20')]===undefined?!![]:![]:!![],'where':_0x5c0848[_0xa7f0('0x1f')]?_0x5c0848[_0xa7f0('0x1f')][_0xa7f0('0x21')]||null:null,'attributes':_0x5c0848[_0xa7f0('0x1f')]?_0x5c0848['options']['attributes']||null:null,'limit':_0x5c0848[_0xa7f0('0x1f')]?_0x5c0848[_0xa7f0('0x1f')][_0xa7f0('0x22')]||null:null,'include':_0x5c0848[_0xa7f0('0x1f')]?_0x5c0848[_0xa7f0('0x1f')]['include']?_['map'](_0x5c0848[_0xa7f0('0x1f')][_0xa7f0('0x23')],function(_0x5072fd){return{'model':db[_0x5072fd[_0xa7f0('0x24')]],'as':_0x5072fd['as'],'attributes':_0x5072fd[_0xa7f0('0x25')],'include':_0x5072fd[_0xa7f0('0x23')]?_[_0xa7f0('0x26')](_0x5072fd['include'],function(_0x4ab31b){return{'model':db[_0x4ab31b[_0xa7f0('0x24')]],'as':_0x4ab31b['as'],'attributes':_0x4ab31b[_0xa7f0('0x25')],'include':_0x4ab31b[_0xa7f0('0x23')]?_['map'](_0x4ab31b[_0xa7f0('0x23')],function(_0x23e88e){return{'model':db[_0x23e88e[_0xa7f0('0x24')]],'as':_0x23e88e['as'],'attributes':_0x23e88e['attributes']};}):[]};}):[]};}):[]:[]})[_0xa7f0('0x12')](function(_0x7f95db){logger[_0xa7f0('0x13')](_0xa7f0('0x27'),_0x5c0848);logger[_0xa7f0('0x15')](_0xa7f0('0x27'),_0x5c0848,JSON[_0xa7f0('0x17')](_0x7f95db));_0x4167e4(_0x7f95db);})[_0xa7f0('0x1c')](function(_0x1fbfcf){logger[_0xa7f0('0x18')](_0xa7f0('0x27'),_0x1fbfcf[_0xa7f0('0x1a')],_0x5c0848);_0x8f77c3(_0x15a3be[_0xa7f0('0x18')](0x1f4,_0x1fbfcf[_0xa7f0('0x1a')]));});});};exports[_0xa7f0('0x28')]=function(_0x21b2fa){var _0x1cf900=this;return new Promise(function(_0x552905,_0x53d699){return db[_0xa7f0('0x1d')][_0xa7f0('0x29')]({'raw':_0x21b2fa[_0xa7f0('0x1f')]?_0x21b2fa[_0xa7f0('0x1f')][_0xa7f0('0x20')]===undefined?!![]:![]:!![],'where':_0x21b2fa[_0xa7f0('0x1f')]?_0x21b2fa[_0xa7f0('0x1f')]['where']||null:null,'attributes':_0x21b2fa[_0xa7f0('0x1f')]?_0x21b2fa[_0xa7f0('0x1f')][_0xa7f0('0x25')]||null:null,'include':_0x21b2fa[_0xa7f0('0x1f')]?_0x21b2fa['options']['include']?_[_0xa7f0('0x26')](_0x21b2fa[_0xa7f0('0x1f')][_0xa7f0('0x23')],function(_0x1c0924){return{'model':db[_0x1c0924[_0xa7f0('0x24')]],'as':_0x1c0924['as'],'attributes':_0x1c0924['attributes'],'include':_0x1c0924[_0xa7f0('0x23')]?_['map'](_0x1c0924[_0xa7f0('0x23')],function(_0xe3d6d2){return{'model':db[_0xe3d6d2[_0xa7f0('0x24')]],'as':_0xe3d6d2['as'],'attributes':_0xe3d6d2[_0xa7f0('0x25')],'include':_0xe3d6d2[_0xa7f0('0x23')]?_[_0xa7f0('0x26')](_0xe3d6d2['include'],function(_0xd72b1f){return{'model':db[_0xd72b1f['model']],'as':_0xd72b1f['as'],'attributes':_0xd72b1f[_0xa7f0('0x25')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x339b7a){logger[_0xa7f0('0x13')](_0xa7f0('0x28'),_0x21b2fa);logger['debug'](_0xa7f0('0x28'),_0x21b2fa,JSON[_0xa7f0('0x17')](_0x339b7a));_0x552905(_0x339b7a);})[_0xa7f0('0x1c')](function(_0x161ce9){logger[_0xa7f0('0x18')](_0xa7f0('0x28'),_0x161ce9[_0xa7f0('0x1a')],_0x21b2fa);_0x53d699(_0x1cf900[_0xa7f0('0x18')](0x1f4,_0x161ce9['message']));});});};exports['NotifyMailAccount']=function(_0x3a866b){var _0x25e753=this;return new Promise(function(_0x2bdcf9,_0x12abf9){var _0x5ec388={'body':_0x3a866b[_0xa7f0('0x2a')],'channel':_0xa7f0('0x2b')};var _0x599e6f=_['difference'](_[_0xa7f0('0x2c')](db[_0xa7f0('0x2d')]['rawAttributes']),[_0xa7f0('0x2e'),_0xa7f0('0x2f'),_0xa7f0('0x30'),_0xa7f0('0x31')]);var _0x5ccd51=![];if(_0x3a866b[_0xa7f0('0x2a')]['id']){delete _0x3a866b[_0xa7f0('0x2a')]['id'];}if(_['isNil'](_0x3a866b[_0xa7f0('0x2a')][_0xa7f0('0x32')])){return _0x12abf9(_0x25e753[_0xa7f0('0x18')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0xa7f0('0x33')](_0x3a866b[_0xa7f0('0x2a')][_0xa7f0('0x2a')])||_0x3a866b[_0xa7f0('0x2a')][_0xa7f0('0x2a')]===''){return _0x12abf9(_0x25e753['error'](0x1f4,_0xa7f0('0x34')));}if(_['isNil'](_0x3a866b[_0xa7f0('0x2a')][_0xa7f0('0x35')])){return _0x12abf9(_0x25e753[_0xa7f0('0x18')](0x1f4,_0xa7f0('0x36')+_0x599e6f));}if(!_[_0xa7f0('0x37')](_0x599e6f,_0x3a866b[_0xa7f0('0x2a')][_0xa7f0('0x35')])){return _0x12abf9(_0x25e753[_0xa7f0('0x18')](0x1f4,_0xa7f0('0x38')+_0x599e6f));}var _0x23249e={};_0x23249e[_0x3a866b[_0xa7f0('0x2a')]['mapKey']]=_0x3a866b[_0xa7f0('0x2a')]['from'];return db[_0xa7f0('0x1d')][_0xa7f0('0x29')]({'where':{'id':_0x3a866b['account']['id']},'include':[{'model':db[_0xa7f0('0x39')],'as':_0xa7f0('0x3a'),'include':[{'model':db[_0xa7f0('0x2d')],'as':_0xa7f0('0x3b'),'where':_0x23249e,'limit':0x1,'order':[[_0xa7f0('0x2f'),_0xa7f0('0x3c')]]}]},{'model':db[_0xa7f0('0x3d')],'as':_0xa7f0('0x3e')},{'model':db[_0xa7f0('0x3f')],'as':'Smtp'}]})[_0xa7f0('0x12')](function(_0x402a52){if(_0x402a52&&_0x402a52[_0xa7f0('0x3a')]){var _0x176382=_0x402a52[_0xa7f0('0x40')]({'plain':!![]});_0x5ec388[_0xa7f0('0x41')]=_[_0xa7f0('0x42')](_0x176382,[_0xa7f0('0x3e'),'List']);_0x5ec388['applications']=_0x176382[_0xa7f0('0x3e')];_0x5ec388[_0xa7f0('0x43')]=_0x176382[_0xa7f0('0x3a')];_0x5ec388[_0xa7f0('0x44')]=_[_0xa7f0('0x45')](_0x5ec388[_0xa7f0('0x44')],['priority'],[_0xa7f0('0x46')]);if(_0x5ec388[_0xa7f0('0x41')]&&_0x5ec388[_0xa7f0('0x41')]['autoclose']){_0x5ec388[_0xa7f0('0x44')][_0xa7f0('0x47')]({'id':0x0,'priority':_0x5ec388['applications'][_0xa7f0('0x48')]+0x1,'app':_0xa7f0('0x49'),'appdata':'autoclose','interval':_0xa7f0('0x4a')});}if(_0x5ec388['account'][_0xa7f0('0x3e')]){delete _0x5ec388[_0xa7f0('0x41')][_0xa7f0('0x3e')];}if(_0x5ec388[_0xa7f0('0x41')][_0xa7f0('0x3a')]){delete _0x5ec388['account'][_0xa7f0('0x3a')];}if(_0x176382[_0xa7f0('0x3a')]['Contacts'][_0xa7f0('0x48')]){return _0x176382[_0xa7f0('0x3a')]['Contacts'][0x0];}var _0x2f2220=_['defaults'](_0x3a866b[_0xa7f0('0x2a')],{'firstName':_0x3a866b['body'][_0xa7f0('0x32')],'ListId':_0x176382[_0xa7f0('0x31')]});_0x2f2220[_0x3a866b[_0xa7f0('0x2a')]['mapKey']]=_0x3a866b[_0xa7f0('0x2a')][_0xa7f0('0x32')];return db[_0xa7f0('0x2d')][_0xa7f0('0x4b')](_0x2f2220);}else{throw new Error('List\x20not\x20found');}})[_0xa7f0('0x12')](function(_0x4ece96){_0x5ec388[_0xa7f0('0x4c')]=_0x4ece96;if(_0x4ece96){if(!_0x3a866b[_0xa7f0('0x2a')]['message'][_0xa7f0('0x4d')]){_0x3a866b[_0xa7f0('0x2a')]['message'][_0xa7f0('0x4d')]=rs[_0xa7f0('0x4e')]()+'\x20'+_0x3a866b[_0xa7f0('0x2a')][_0xa7f0('0x1a')][_0xa7f0('0x32')];}var _0x331ed2={'ContactId':_0x4ece96['id'],'MailAccountId':_0x3a866b[_0xa7f0('0x41')]['id'],'inReplyTo':_0x3a866b['body'][_0xa7f0('0x1a')]['messageId'],'to':_0x3a866b[_0xa7f0('0x2a')][_0xa7f0('0x1a')]['from'],'cc':_0x3a866b['body'][_0xa7f0('0x1a')]['cc'],'subject':_0x3a866b[_0xa7f0('0x2a')][_0xa7f0('0x1a')][_0xa7f0('0x4f')],'attach':_0x3a866b['body'][_0xa7f0('0x1a')][_0xa7f0('0x50')],'lastMsgAt':moment()[_0xa7f0('0x51')](_0xa7f0('0x52')),'lastMsgDirection':'in'};return db[_0xa7f0('0x53')]['find']({'where':{'closed':![],'MailAccountId':_0x3a866b['account']['id']},'include':[{'model':db['MailMessage'],'as':_0xa7f0('0x54'),'attributes':[_0xa7f0('0x4d')],'where':{'messageId':_0x3a866b['body']['message'][_0xa7f0('0x55')]}}]})[_0xa7f0('0x12')](function(_0x4fc4ea){if(_0x4fc4ea){return[_0x4fc4ea,![]];}return db[_0xa7f0('0x53')]['create'](_0x331ed2)[_0xa7f0('0x12')](function(_0x281438){return[_0x281438,!![]];});});}else{throw new Error(_0xa7f0('0x56'));}})['spread'](function(_0x4e8c0d,_0xf11f1){if(_0x4e8c0d){_0x5ccd51=_0xf11f1;if(!_0xf11f1){return _0x4e8c0d[_0xa7f0('0x57')]({'inReplyTo':_0x3a866b[_0xa7f0('0x2a')][_0xa7f0('0x1a')][_0xa7f0('0x4d')],'to':_0x3a866b[_0xa7f0('0x2a')][_0xa7f0('0x1a')][_0xa7f0('0x32')],'cc':_0x3a866b[_0xa7f0('0x2a')][_0xa7f0('0x1a')]['cc'],'subject':_0x3a866b['body']['message'][_0xa7f0('0x4f')],'attach':_0x4e8c0d['attach']?_0x4e8c0d['attach']:_0x3a866b[_0xa7f0('0x2a')][_0xa7f0('0x1a')][_0xa7f0('0x50')],'substatus':null,'substatusAt':moment()[_0xa7f0('0x51')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0xa7f0('0x51')](_0xa7f0('0x52')),'lastMsgDirection':'in'});}else{return _0x4e8c0d;}}})[_0xa7f0('0x12')](function(_0x23eb9d){_0x5ec388[_0xa7f0('0x58')]=_0x23eb9d[_0xa7f0('0x40')]({'plain':!![]});_0x5ec388['interaction'][_0xa7f0('0x59')]=_0x5ccd51;return db[_0xa7f0('0x5a')]['create']({'body':_0x3a866b[_0xa7f0('0x2a')][_0xa7f0('0x2a')],'MailAccountId':_0x3a866b[_0xa7f0('0x41')]['id'],'MailInteractionId':_0x23eb9d['id'],'direction':'in','ContactId':_0x5ec388[_0xa7f0('0x4c')]['id'],'messageId':_0x3a866b['body'][_0xa7f0('0x1a')][_0xa7f0('0x4d')],'from':_0x3a866b['body'][_0xa7f0('0x1a')][_0xa7f0('0x32')],'to':_0x3a866b[_0xa7f0('0x2a')]['message']['to'],'cc':_0x3a866b['body'][_0xa7f0('0x1a')]['cc'],'subject':_0x3a866b[_0xa7f0('0x2a')]['message'][_0xa7f0('0x4f')],'attach':_0x3a866b['body'][_0xa7f0('0x1a')][_0xa7f0('0x50')],'Attachments':_0x3a866b[_0xa7f0('0x2a')][_0xa7f0('0x1a')][_0xa7f0('0x5b')],'originTo':_0x3a866b['body'][_0xa7f0('0x1a')]['originTo'],'originCc':_0x3a866b[_0xa7f0('0x2a')][_0xa7f0('0x1a')][_0xa7f0('0x5c')],'bcc':_0x3a866b[_0xa7f0('0x2a')][_0xa7f0('0x1a')][_0xa7f0('0x5d')],'ChatWebsiteId':_0x3a866b[_0xa7f0('0x2a')][_0xa7f0('0x1a')][_0xa7f0('0x5e')]||null,'originChannel':_0x3a866b[_0xa7f0('0x2a')]['message'][_0xa7f0('0x5f')]||_0xa7f0('0x60'),'ChatOfflineMessageId':_0x3a866b['body'][_0xa7f0('0x1a')][_0xa7f0('0x61')]||null},{'include':[{'model':db[_0xa7f0('0x62')],'as':_0xa7f0('0x63')}]});})[_0xa7f0('0x12')](function(_0x27155e){_0x5ec388[_0xa7f0('0x1a')]=_0x27155e;if(_0x5ec388[_0xa7f0('0x58')][_0xa7f0('0x64')]){return db[_0xa7f0('0x65')]['find']({'attributes':['id',_0xa7f0('0x66')],'where':{'id':_0x5ec388[_0xa7f0('0x58')][_0xa7f0('0x64')]}})[_0xa7f0('0x12')](function(_0x4d92ee){if(_0x4d92ee){_0x5ec388['applications'][_0xa7f0('0x67')]({'id':0x0,'priority':0x0,'app':_0xa7f0('0x68'),'appdata':_0x4d92ee[_0xa7f0('0x66')]+','+(_0x5ec388[_0xa7f0('0x41')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xa7f0('0x69'),_0xa7f0('0x6a'),_0x5ec388);});}return respondWithRpcPromise('Start','startRouting',_0x5ec388);})[_0xa7f0('0x12')](function(_0x24df5d){_0x2bdcf9(_0x24df5d);})[_0xa7f0('0x1c')](function(_0x1d21c3){_0x12abf9(_0x25e753[_0xa7f0('0x18')](0x1f4,_0x1d21c3[_0xa7f0('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index ebe82cc..eff012a 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 _0xdb21=['length','mailAccount:','./mailAccount.events','save','update','removeListener','register'];(function(_0x594e4a,_0x6fa99f){var _0x3d4a53=function(_0x59123c){while(--_0x59123c){_0x594e4a['push'](_0x594e4a['shift']());}};_0x3d4a53(++_0x6fa99f);}(_0xdb21,0xcd));var _0x1db2=function(_0x288478,_0x23303e){_0x288478=_0x288478-0x0;var _0x234c05=_0xdb21[_0x288478];return _0x234c05;};'use strict';var MailAccountEvents=require(_0x1db2('0x0'));var events=[_0x1db2('0x1'),'remove',_0x1db2('0x2')];function createListener(_0x19f0df,_0x2f38e9){return function(_0x1d1d5c){_0x2f38e9['emit'](_0x19f0df,_0x1d1d5c);};}function removeListener(_0x3b352c,_0x45ca76){return function(){MailAccountEvents[_0x1db2('0x3')](_0x3b352c,_0x45ca76);};}exports[_0x1db2('0x4')]=function(_0x23784b){for(var _0x1f5184=0x0,_0x2091b4=events[_0x1db2('0x5')];_0x1f5184<_0x2091b4;_0x1f5184++){var _0x6285ab=events[_0x1f5184];var _0x55af3a=createListener(_0x1db2('0x6')+_0x6285ab,_0x23784b);MailAccountEvents['on'](_0x6285ab,_0x55af3a);}}; \ No newline at end of file +var _0x2e17=['register','length','./mailAccount.events','save','update'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x2e17,0x98));var _0x72e1=function(_0x365e54,_0x44be74){_0x365e54=_0x365e54-0x0;var _0x13317a=_0x2e17[_0x365e54];return _0x13317a;};'use strict';var MailAccountEvents=require(_0x72e1('0x0'));var events=[_0x72e1('0x1'),'remove',_0x72e1('0x2')];function createListener(_0x4ac975,_0x20967a){return function(_0x1156d8){_0x20967a['emit'](_0x4ac975,_0x1156d8);};}function removeListener(_0x208c54,_0x2187c9){return function(){MailAccountEvents['removeListener'](_0x208c54,_0x2187c9);};}exports[_0x72e1('0x3')]=function(_0x4a33d3){for(var _0x26f444=0x0,_0x2fe2f1=events[_0x72e1('0x4')];_0x26f444<_0x2fe2f1;_0x26f444++){var _0x5166d5=events[_0x26f444];var _0x4fc481=createListener('mailAccount:'+_0x5166d5,_0x4a33d3);MailAccountEvents['on'](_0x5166d5,_0x4fc481);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 4f5fcdb..7885c36 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 _0xaece=['/:id','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','isAuthenticated','show'];(function(_0x1e145e,_0x26460f){var _0x5a8eca=function(_0x1234ff){while(--_0x1234ff){_0x1e145e['push'](_0x1e145e['shift']());}};_0x5a8eca(++_0x26460f);}(_0xaece,0xb6));var _0xeaec=function(_0x17c003,_0x241582){_0x17c003=_0x17c003-0x0;var _0x2866aa=_0xaece[_0x17c003];return _0x2866aa;};'use strict';var multer=require(_0xeaec('0x0'));var util=require(_0xeaec('0x1'));var path=require(_0xeaec('0x2'));var timeout=require(_0xeaec('0x3'));var express=require(_0xeaec('0x4'));var router=express['Router']();var fs_extra=require(_0xeaec('0x5'));var auth=require(_0xeaec('0x6'));var interaction=require(_0xeaec('0x7'));var config=require(_0xeaec('0x8'));var controller=require(_0xeaec('0x9'));router[_0xeaec('0xa')]('/:id',auth[_0xeaec('0xb')](),controller[_0xeaec('0xc')]);router['put'](_0xeaec('0xd'),auth[_0xeaec('0xb')](),controller['update']);router['delete']('/:id',auth[_0xeaec('0xb')](),controller[_0xeaec('0xe')]);module['exports']=router; \ No newline at end of file +var _0x74ff=['isAuthenticated','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../config/environment','./mailApplication.controller','get','/:id','show'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x74ff,0xd7));var _0xf74f=function(_0x139cc0,_0x1c67f3){_0x139cc0=_0x139cc0-0x0;var _0x11dc1a=_0x74ff[_0x139cc0];return _0x11dc1a;};'use strict';var multer=require(_0xf74f('0x0'));var util=require(_0xf74f('0x1'));var path=require(_0xf74f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf74f('0x3')]();var fs_extra=require(_0xf74f('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf74f('0x5'));var controller=require(_0xf74f('0x6'));router[_0xf74f('0x7')](_0xf74f('0x8'),auth['isAuthenticated'](),controller[_0xf74f('0x9')]);router['put'](_0xf74f('0x8'),auth[_0xf74f('0xa')](),controller[_0xf74f('0xb')]);router[_0xf74f('0xc')](_0xf74f('0x8'),auth[_0xf74f('0xa')](),controller[_0xf74f('0xd')]);module[_0xf74f('0xe')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index b07f513..8875514 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 _0x0e88=['INTEGER','STRING','exports'];(function(_0x12b1a2,_0x269a7f){var _0x17bf43=function(_0x4c0c32){while(--_0x4c0c32){_0x12b1a2['push'](_0x12b1a2['shift']());}};_0x17bf43(++_0x269a7f);}(_0x0e88,0x194));var _0x80e8=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x0e88[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require('sequelize');module[_0x80e8('0x0')]={'priority':{'type':Sequelize[_0x80e8('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x80e8('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x80e8('0x2')]},'interval':{'type':Sequelize[_0x80e8('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x3f86=['noop','*,*,*,*','exports','INTEGER','STRING'];(function(_0x2cb858,_0x3b792b){var _0x544775=function(_0x367dd9){while(--_0x367dd9){_0x2cb858['push'](_0x2cb858['shift']());}};_0x544775(++_0x3b792b);}(_0x3f86,0xa7));var _0x63f8=function(_0x51fa83,_0x4a7c9e){_0x51fa83=_0x51fa83-0x0;var _0x482538=_0x3f86[_0x51fa83];return _0x482538;};'use strict';var Sequelize=require('sequelize');module[_0x63f8('0x0')]={'priority':{'type':Sequelize[_0x63f8('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x63f8('0x2')],'allowNull':![],'defaultValue':_0x63f8('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x63f8('0x2')]},'interval':{'type':Sequelize[_0x63f8('0x2')],'defaultValue':_0x63f8('0x4')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index a997adc..8fa8ada 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(_0x194adf,_0x220258){var _0x2242e3=function(_0x42afcd){while(--_0x42afcd){_0x194adf['push'](_0x194adf['shift']());}};_0x2242e3(++_0x220258);}(_0x70e0,0x17b));var _0x070e=function(_0x2b126e,_0x5c6a70){_0x2b126e=_0x2b126e-0x0;var _0x11bdc4=_0x70e0[_0x2b126e];return _0x11bdc4;};'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 _0x9bde=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','error','name','send','show','model','keys','MailApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','update','body','params','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment'];(function(_0xd16d61,_0x2a7235){var _0x4902fa=function(_0x485208){while(--_0x485208){_0xd16d61['push'](_0xd16d61['shift']());}};_0x4902fa(++_0x2a7235);}(_0x9bde,0xe1));var _0xe9bd=function(_0x3841ba,_0x3c523c){_0x3841ba=_0x3841ba-0x0;var _0x2de277=_0x9bde[_0x3841ba];return _0x2de277;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe9bd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe9bd('0x1'));var rp=require('request-promise');var moment=require(_0xe9bd('0x2'));var BPromise=require(_0xe9bd('0x3'));var Mustache=require(_0xe9bd('0x4'));var util=require(_0xe9bd('0x5'));var path=require(_0xe9bd('0x6'));var sox=require(_0xe9bd('0x7'));var csv=require(_0xe9bd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe9bd('0x9'));var _=require(_0xe9bd('0xa'));var squel=require(_0xe9bd('0xb'));var crypto=require(_0xe9bd('0xc'));var jsforce=require(_0xe9bd('0xd'));var deskjs=require(_0xe9bd('0xe'));var toCsv=require(_0xe9bd('0x8'));var querystring=require(_0xe9bd('0xf'));var Papa=require(_0xe9bd('0x10'));var Redis=require(_0xe9bd('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe9bd('0x12'));var hardwareService=require(_0xe9bd('0x13'));var logger=require(_0xe9bd('0x14'))('api');var utils=require(_0xe9bd('0x15'));var config=require(_0xe9bd('0x16'));var licenseUtil=require(_0xe9bd('0x17'));var db=require(_0xe9bd('0x18'))['db'];function respondWithStatusCode(_0x5e022a,_0x2c1d98){_0x2c1d98=_0x2c1d98||0xcc;return function(_0x4ac319){if(_0x4ac319){return _0x5e022a[_0xe9bd('0x19')](_0x2c1d98);}return _0x5e022a[_0xe9bd('0x1a')](_0x2c1d98)[_0xe9bd('0x1b')]();};}function respondWithResult(_0x51109f,_0x47ba5e){_0x47ba5e=_0x47ba5e||0xc8;return function(_0x46a95e){if(_0x46a95e){return _0x51109f[_0xe9bd('0x1a')](_0x47ba5e)[_0xe9bd('0x1c')](_0x46a95e);}};}function respondWithFilteredResult(_0x46a59b,_0x3360bd){return function(_0x389e7b){if(_0x389e7b){var _0x45a9f2=typeof _0x3360bd['offset']===_0xe9bd('0x1d')&&typeof _0x3360bd[_0xe9bd('0x1e')]===_0xe9bd('0x1d');var _0x494b27=_0x389e7b[_0xe9bd('0x1f')];var _0x3bae08=_0x45a9f2?0x0:_0x3360bd[_0xe9bd('0x20')];var _0x330733=_0x45a9f2?_0x389e7b['count']:_0x3360bd[_0xe9bd('0x20')]+_0x3360bd['limit'];var _0xc6b661;if(_0x330733>=_0x494b27){_0x330733=_0x494b27;_0xc6b661=0xc8;}else{_0xc6b661=0xce;}_0x46a59b['status'](_0xc6b661);return _0x46a59b[_0xe9bd('0x21')](_0xe9bd('0x22'),_0x3bae08+'-'+_0x330733+'/'+_0x494b27)[_0xe9bd('0x1c')](_0x389e7b);}return null;};}function patchUpdates(_0x3dda13){return function(_0x1acb82){try{jsonpatch[_0xe9bd('0x23')](_0x1acb82,_0x3dda13,!![]);}catch(_0x6593ce){return BPromise['reject'](_0x6593ce);}return _0x1acb82[_0xe9bd('0x24')]();};}function saveUpdates(_0x28cd17,_0x4ecaf5){return function(_0x37aec1){if(_0x37aec1){return _0x37aec1['update'](_0x28cd17)[_0xe9bd('0x25')](function(_0x1b9cc9){return _0x1b9cc9;});}return null;};}function removeEntity(_0x36f8c0,_0xf02209){return function(_0x5bc4bf){if(_0x5bc4bf){return _0x5bc4bf[_0xe9bd('0x26')]()[_0xe9bd('0x25')](function(){_0x36f8c0[_0xe9bd('0x1a')](0xcc)[_0xe9bd('0x1b')]();});}};}function handleEntityNotFound(_0x2641be,_0xb52d45){return function(_0x399f3c){if(!_0x399f3c){_0x2641be[_0xe9bd('0x19')](0x194);}return _0x399f3c;};}function handleError(_0x1ae889,_0x5987af){_0x5987af=_0x5987af||0x1f4;return function(_0x3c211a){logger[_0xe9bd('0x27')](_0x3c211a['stack']);if(_0x3c211a[_0xe9bd('0x28')]){delete _0x3c211a[_0xe9bd('0x28')];}_0x1ae889[_0xe9bd('0x1a')](_0x5987af)[_0xe9bd('0x29')](_0x3c211a);};}exports[_0xe9bd('0x2a')]=function(_0x183601,_0x519f48){var _0x5b7f1d={'raw':!![],'where':{'id':_0x183601['params']['id']}},_0x1de54c={};_0x1de54c[_0xe9bd('0x2b')]=_[_0xe9bd('0x2c')](db[_0xe9bd('0x2d')][_0xe9bd('0x2e')]);_0x1de54c[_0xe9bd('0x2f')]=_['keys'](_0x183601['query']);_0x1de54c[_0xe9bd('0x30')]=_[_0xe9bd('0x31')](_0x1de54c[_0xe9bd('0x2b')],_0x1de54c[_0xe9bd('0x2f')]);_0x5b7f1d[_0xe9bd('0x32')]=_[_0xe9bd('0x31')](_0x1de54c[_0xe9bd('0x2b')],qs[_0xe9bd('0x33')](_0x183601[_0xe9bd('0x2f')]['fields']));_0x5b7f1d[_0xe9bd('0x32')]=_0x5b7f1d[_0xe9bd('0x32')][_0xe9bd('0x34')]?_0x5b7f1d['attributes']:_0x1de54c['model'];if(_0x183601[_0xe9bd('0x2f')][_0xe9bd('0x35')]){_0x5b7f1d[_0xe9bd('0x36')]=[{'all':!![]}];}_0x5b7f1d=_[_0xe9bd('0x37')]({},_0x5b7f1d,_0x183601[_0xe9bd('0x38')]);return db[_0xe9bd('0x2d')][_0xe9bd('0x39')](_0x5b7f1d)[_0xe9bd('0x25')](handleEntityNotFound(_0x519f48,null))[_0xe9bd('0x25')](respondWithResult(_0x519f48,null))[_0xe9bd('0x3a')](handleError(_0x519f48,null));};exports[_0xe9bd('0x3b')]=function(_0x549dd1,_0x2ad46e){if(_0x549dd1[_0xe9bd('0x3c')]['id']){delete _0x549dd1[_0xe9bd('0x3c')]['id'];}return db[_0xe9bd('0x2d')][_0xe9bd('0x39')]({'where':{'id':_0x549dd1[_0xe9bd('0x3d')]['id']}})['then'](handleEntityNotFound(_0x2ad46e,null))[_0xe9bd('0x25')](saveUpdates(_0x549dd1[_0xe9bd('0x3c')],null))['then'](respondWithResult(_0x2ad46e,null))[_0xe9bd('0x3a')](handleError(_0x2ad46e,null));};exports[_0xe9bd('0x26')]=function(_0x4c7d47,_0x4b1da0){return db[_0xe9bd('0x2d')][_0xe9bd('0x39')]({'where':{'id':_0x4c7d47['params']['id']}})[_0xe9bd('0x25')](handleEntityNotFound(_0x4b1da0,null))[_0xe9bd('0x25')](removeEntity(_0x4b1da0,null))[_0xe9bd('0x3a')](handleError(_0x4b1da0,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index e2299e2..997ffae 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 _0x73c9=['api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x310eeb,_0x48821f){var _0xc33f1c=function(_0x1975fc){while(--_0x1975fc){_0x310eeb['push'](_0x310eeb['shift']());}};_0xc33f1c(++_0x48821f);}(_0x73c9,0xde));var _0x973c=function(_0xcdd286,_0x138504){_0xcdd286=_0xcdd286-0x0;var _0x324ffe=_0x73c9[_0xcdd286];return _0x324ffe;};'use strict';var _=require(_0x973c('0x0'));var util=require(_0x973c('0x1'));var logger=require('../../config/logger')(_0x973c('0x2'));var moment=require(_0x973c('0x3'));var BPromise=require(_0x973c('0x4'));var rp=require(_0x973c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x973c('0x6'));var config=require(_0x973c('0x7'));var attributes=require('./mailApplication.attributes');module[_0x973c('0x8')]=function(_0x3dbe04,_0x5c79a0){return _0x3dbe04[_0x973c('0x9')](_0x973c('0xa'),attributes,{'tableName':_0x973c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x973c('0xc'),'collate':_0x973c('0xd')});}; \ No newline at end of file +var _0x5af2=['exports','define','MailApplication','mail_applications','utf8mb4','lodash','util','../../config/logger','moment','bluebird','rimraf','./mailApplication.attributes'];(function(_0x21939d,_0x3d8232){var _0x2b9289=function(_0x5f3ffc){while(--_0x5f3ffc){_0x21939d['push'](_0x21939d['shift']());}};_0x2b9289(++_0x3d8232);}(_0x5af2,0xb9));var _0x25af=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x5af2[_0x4f9b18];return _0x29f20c;};'use strict';var _=require(_0x25af('0x0'));var util=require(_0x25af('0x1'));var logger=require(_0x25af('0x2'))('api');var moment=require(_0x25af('0x3'));var BPromise=require(_0x25af('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x25af('0x5'));var config=require('../../config/environment');var attributes=require(_0x25af('0x6'));module[_0x25af('0x7')]=function(_0x51fe3f,_0x536f5f){return _0x51fe3f[_0x25af('0x8')](_0x25af('0x9'),attributes,{'tableName':_0x25af('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x25af('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 6e293a7..8f1aeaa 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 _0x5e86=['catch','MailApplication','update','body','raw','options','where','attributes','UpdateMailApplication','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','MailApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info'];(function(_0x288f9e,_0x250e00){var _0x388030=function(_0x5e3996){while(--_0x5e3996){_0x288f9e['push'](_0x288f9e['shift']());}};_0x388030(++_0x250e00);}(_0x5e86,0xbd));var _0x65e8=function(_0xeb913a,_0x160172){_0xeb913a=_0xeb913a-0x0;var _0x20c141=_0x5e86[_0xeb913a];return _0x20c141;};'use strict';var _=require(_0x65e8('0x0'));var util=require(_0x65e8('0x1'));var moment=require(_0x65e8('0x2'));var BPromise=require(_0x65e8('0x3'));var rs=require(_0x65e8('0x4'));var fs=require('fs');var Redis=require(_0x65e8('0x5'));var db=require(_0x65e8('0x6'))['db'];var utils=require(_0x65e8('0x7'));var logger=require(_0x65e8('0x8'))('rpc');var config=require(_0x65e8('0x9'));var jayson=require(_0x65e8('0xa'));var client=jayson['client'][_0x65e8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x165e24,_0x40a99f,_0x583fa8){return new BPromise(function(_0x31249b,_0x2c294e){return client[_0x65e8('0xc')](_0x165e24,_0x583fa8)[_0x65e8('0xd')](function(_0x6dc9af){logger['info'](_0x65e8('0xe'),_0x40a99f,'request\x20sent');logger['debug']('MailApplication,\x20%s,\x20%s,\x20%s',_0x40a99f,_0x65e8('0xf'),JSON[_0x65e8('0x10')](_0x6dc9af));if(_0x6dc9af['error']){if(_0x6dc9af[_0x65e8('0x11')][_0x65e8('0x12')]===0x1f4){logger[_0x65e8('0x11')]('MailApplication,\x20%s,\x20%s',_0x40a99f,_0x6dc9af['error']['message']);return _0x2c294e(_0x6dc9af[_0x65e8('0x11')][_0x65e8('0x13')]);}logger[_0x65e8('0x11')](_0x65e8('0xe'),_0x40a99f,_0x6dc9af[_0x65e8('0x11')]['message']);return _0x31249b(_0x6dc9af[_0x65e8('0x11')][_0x65e8('0x13')]);}else{logger[_0x65e8('0x14')](_0x65e8('0xe'),_0x40a99f,_0x65e8('0xf'));_0x31249b(_0x6dc9af['result'][_0x65e8('0x13')]);}})[_0x65e8('0x15')](function(_0x286c06){logger[_0x65e8('0x11')](_0x65e8('0xe'),_0x40a99f,_0x286c06);_0x2c294e(_0x286c06);});});}exports['UpdateMailApplication']=function(_0x212ed2){var _0x3c1ddb=this;return new Promise(function(_0x590ef2,_0x4c3071){return db[_0x65e8('0x16')][_0x65e8('0x17')](_0x212ed2[_0x65e8('0x18')],{'raw':_0x212ed2['options']?_0x212ed2['options'][_0x65e8('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x212ed2[_0x65e8('0x1a')]?_0x212ed2['options'][_0x65e8('0x1b')]||null:null,'attributes':_0x212ed2[_0x65e8('0x1a')]?_0x212ed2[_0x65e8('0x1a')][_0x65e8('0x1c')]||null:null,'limit':_0x212ed2[_0x65e8('0x1a')]?_0x212ed2[_0x65e8('0x1a')]['limit']||null:null})[_0x65e8('0xd')](function(_0x528244){logger[_0x65e8('0x14')](_0x65e8('0x1d'),_0x212ed2);logger['debug']('UpdateMailApplication',_0x212ed2,JSON[_0x65e8('0x10')](_0x528244));_0x590ef2(_0x528244);})[_0x65e8('0x15')](function(_0x5bb4c1){logger[_0x65e8('0x11')](_0x65e8('0x1d'),_0x5bb4c1[_0x65e8('0x13')],_0x212ed2);_0x4c3071(_0x3c1ddb['error'](0x1f4,_0x5bb4c1[_0x65e8('0x13')]));});});}; \ No newline at end of file +var _0xc174=['limit','then','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','MailApplication,\x20%s,\x20%s','message','UpdateMailApplication','update','options','raw','where','attributes'];(function(_0x3fd718,_0x27fd47){var _0x5520ff=function(_0x423883){while(--_0x423883){_0x3fd718['push'](_0x3fd718['shift']());}};_0x5520ff(++_0x27fd47);}(_0xc174,0x1f3));var _0x4c17=function(_0x586fa2,_0x1a45bc){_0x586fa2=_0x586fa2-0x0;var _0x515be9=_0xc174[_0x586fa2];return _0x515be9;};'use strict';var _=require(_0x4c17('0x0'));var util=require(_0x4c17('0x1'));var moment=require(_0x4c17('0x2'));var BPromise=require('bluebird');var rs=require(_0x4c17('0x3'));var fs=require('fs');var Redis=require(_0x4c17('0x4'));var db=require(_0x4c17('0x5'))['db'];var utils=require(_0x4c17('0x6'));var logger=require(_0x4c17('0x7'))(_0x4c17('0x8'));var config=require(_0x4c17('0x9'));var jayson=require(_0x4c17('0xa'));var client=jayson[_0x4c17('0xb')][_0x4c17('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x85c950,_0x3cd83e,_0x59d84b){return new BPromise(function(_0x313e9b,_0x8d514){return client['request'](_0x85c950,_0x59d84b)['then'](function(_0x19ba25){logger[_0x4c17('0xd')]('MailApplication,\x20%s,\x20%s',_0x3cd83e,_0x4c17('0xe'));logger[_0x4c17('0xf')](_0x4c17('0x10'),_0x3cd83e,_0x4c17('0xe'),JSON[_0x4c17('0x11')](_0x19ba25));if(_0x19ba25[_0x4c17('0x12')]){if(_0x19ba25[_0x4c17('0x12')][_0x4c17('0x13')]===0x1f4){logger[_0x4c17('0x12')](_0x4c17('0x14'),_0x3cd83e,_0x19ba25[_0x4c17('0x12')][_0x4c17('0x15')]);return _0x8d514(_0x19ba25[_0x4c17('0x12')][_0x4c17('0x15')]);}logger['error'](_0x4c17('0x14'),_0x3cd83e,_0x19ba25[_0x4c17('0x12')][_0x4c17('0x15')]);return _0x313e9b(_0x19ba25[_0x4c17('0x12')][_0x4c17('0x15')]);}else{logger[_0x4c17('0xd')](_0x4c17('0x14'),_0x3cd83e,_0x4c17('0xe'));_0x313e9b(_0x19ba25['result'][_0x4c17('0x15')]);}})['catch'](function(_0x1a9f9e){logger[_0x4c17('0x12')](_0x4c17('0x14'),_0x3cd83e,_0x1a9f9e);_0x8d514(_0x1a9f9e);});});}exports[_0x4c17('0x16')]=function(_0x5cd98e){var _0x55d448=this;return new Promise(function(_0x317883,_0x5af538){return db['MailApplication'][_0x4c17('0x17')](_0x5cd98e['body'],{'raw':_0x5cd98e[_0x4c17('0x18')]?_0x5cd98e['options'][_0x4c17('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5cd98e[_0x4c17('0x18')]?_0x5cd98e[_0x4c17('0x18')][_0x4c17('0x1a')]||null:null,'attributes':_0x5cd98e[_0x4c17('0x18')]?_0x5cd98e['options'][_0x4c17('0x1b')]||null:null,'limit':_0x5cd98e[_0x4c17('0x18')]?_0x5cd98e[_0x4c17('0x18')][_0x4c17('0x1c')]||null:null})[_0x4c17('0x1d')](function(_0x278e1c){logger[_0x4c17('0xd')](_0x4c17('0x16'),_0x5cd98e);logger[_0x4c17('0xf')](_0x4c17('0x16'),_0x5cd98e,JSON[_0x4c17('0x11')](_0x278e1c));_0x317883(_0x278e1c);})[_0x4c17('0x1e')](function(_0x4bc089){logger[_0x4c17('0x12')](_0x4c17('0x16'),_0x4bc089[_0x4c17('0x15')],_0x5cd98e);_0x5af538(_0x55d448[_0x4c17('0x12')](0x1f4,_0x4bc089[_0x4c17('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index b7b49bd..a91e6a3 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 _0x0466=['exports','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','/:id/download','download','post','create','addMessage','/:id/tags','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','update','tracked','mailinteraction:destroy','destroy','removeTags'];(function(_0x53d8fb,_0x1d6175){var _0x4d8bd3=function(_0x455ace){while(--_0x455ace){_0x53d8fb['push'](_0x53d8fb['shift']());}};_0x4d8bd3(++_0x1d6175);}(_0x0466,0x187));var _0x6046=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x0466[_0x4565bf];return _0x5610ba;};'use strict';var express=require(_0x6046('0x0'));var router=express[_0x6046('0x1')]();var auth=require(_0x6046('0x2'));var interaction=require(_0x6046('0x3'));var controller=require(_0x6046('0x4'));router[_0x6046('0x5')]('/',auth[_0x6046('0x6')](),controller[_0x6046('0x7')]);router[_0x6046('0x5')](_0x6046('0x8'),auth[_0x6046('0x6')](),controller[_0x6046('0x9')]);router[_0x6046('0x5')](_0x6046('0xa'),auth[_0x6046('0x6')](),controller[_0x6046('0xb')]);router[_0x6046('0x5')](_0x6046('0xc'),auth[_0x6046('0x6')](),controller['getMessages']);router[_0x6046('0x5')](_0x6046('0xd'),auth[_0x6046('0x6')](),controller[_0x6046('0xe')]);router[_0x6046('0xf')]('/',auth[_0x6046('0x6')](),controller[_0x6046('0x10')]);router[_0x6046('0xf')]('/:id/messages',auth['isAuthenticated'](),controller[_0x6046('0x11')]);router[_0x6046('0xf')](_0x6046('0x12'),auth[_0x6046('0x6')](),interaction['tracked'](_0x6046('0x13'),_0x6046('0x14')),controller[_0x6046('0x15')]);router[_0x6046('0x16')](_0x6046('0xa'),auth[_0x6046('0x6')](),interaction['tracked']('mail',_0x6046('0x17')),controller[_0x6046('0x18')]);router['delete'](_0x6046('0xa'),auth['isAuthenticated'](),interaction[_0x6046('0x19')](_0x6046('0x13'),_0x6046('0x1a')),controller[_0x6046('0x1b')]);router['delete'](_0x6046('0x12'),auth[_0x6046('0x6')](),controller[_0x6046('0x1c')]);module[_0x6046('0x1d')]=router; \ No newline at end of file +var _0x898e=['/describe','/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','/:id/tags','tracked','addTags','put','mail','mailinteraction:update','update','destroy','delete','removeTags','express','Router','../../components/auth/service','./mailInteraction.controller','get','isAuthenticated','index'];(function(_0x1871e5,_0x29d668){var _0x2a0503=function(_0x4b79d2){while(--_0x4b79d2){_0x1871e5['push'](_0x1871e5['shift']());}};_0x2a0503(++_0x29d668);}(_0x898e,0x65));var _0xe898=function(_0x26e5c6,_0xfefa41){_0x26e5c6=_0x26e5c6-0x0;var _0x2588fb=_0x898e[_0x26e5c6];return _0x2588fb;};'use strict';var express=require(_0xe898('0x0'));var router=express[_0xe898('0x1')]();var auth=require(_0xe898('0x2'));var interaction=require('../../components/interaction/service');var controller=require(_0xe898('0x3'));router[_0xe898('0x4')]('/',auth[_0xe898('0x5')](),controller[_0xe898('0x6')]);router['get'](_0xe898('0x7'),auth[_0xe898('0x5')](),controller['describe']);router[_0xe898('0x4')](_0xe898('0x8'),auth[_0xe898('0x5')](),controller[_0xe898('0x9')]);router['get'](_0xe898('0xa'),auth[_0xe898('0x5')](),controller[_0xe898('0xb')]);router['get'](_0xe898('0xc'),auth[_0xe898('0x5')](),controller[_0xe898('0xd')]);router['post']('/',auth[_0xe898('0x5')](),controller[_0xe898('0xe')]);router[_0xe898('0xf')](_0xe898('0xa'),auth[_0xe898('0x5')](),controller[_0xe898('0x10')]);router[_0xe898('0xf')](_0xe898('0x11'),auth[_0xe898('0x5')](),interaction[_0xe898('0x12')]('mail','mailinteraction:addtags'),controller[_0xe898('0x13')]);router[_0xe898('0x14')](_0xe898('0x8'),auth[_0xe898('0x5')](),interaction[_0xe898('0x12')](_0xe898('0x15'),_0xe898('0x16')),controller[_0xe898('0x17')]);router['delete'](_0xe898('0x8'),auth[_0xe898('0x5')](),interaction[_0xe898('0x12')](_0xe898('0x15'),'mailinteraction:destroy'),controller[_0xe898('0x18')]);router[_0xe898('0x19')](_0xe898('0x11'),auth['isAuthenticated'](),controller[_0xe898('0x1a')]);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 cb9a729..dba3962 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 _0xe8cb=['out','BOOLEAN','sequelize','iconv','exports','STRING','TEXT','long','DATE','ENUM'];(function(_0x180fc8,_0x169157){var _0x411749=function(_0x5d1cc1){while(--_0x5d1cc1){_0x180fc8['push'](_0x180fc8['shift']());}};_0x411749(++_0x169157);}(_0xe8cb,0x11a));var _0xbe8c=function(_0x370d76,_0x28b1ee){_0x370d76=_0x370d76-0x0;var _0x2ce434=_0xe8cb[_0x370d76];return _0x2ce434;};'use strict';var Sequelize=require(_0xbe8c('0x0'));var iconv=require(_0xbe8c('0x1'));module[_0xbe8c('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xbe8c('0x3')]},'secondDisposition':{'type':Sequelize[_0xbe8c('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xbe8c('0x3')](0x1fe)},'to':{'type':Sequelize[_0xbe8c('0x3')]},'cc':{'type':Sequelize[_0xbe8c('0x4')](_0xbe8c('0x5'))},'subject':{'type':Sequelize[_0xbe8c('0x4')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xbe8c('0x6')]},'substatus':{'type':Sequelize[_0xbe8c('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0xbe8c('0x6')]},'firstMsgDirection':{'type':Sequelize[_0xbe8c('0x7')]('in',_0xbe8c('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xbe8c('0x6')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xbe8c('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xbe8c('0x9')],'defaultValue':![]}}; \ No newline at end of file +var _0x5d60=['BOOLEAN','DATE','STRING','TEXT','ENUM','out','sequelize','iconv','exports'];(function(_0x574b1b,_0x1b25ef){var _0x1115f1=function(_0x452ca1){while(--_0x452ca1){_0x574b1b['push'](_0x574b1b['shift']());}};_0x1115f1(++_0x1b25ef);}(_0x5d60,0x126));var _0x05d6=function(_0xc867de,_0x370d1b){_0xc867de=_0xc867de-0x0;var _0x4350c2=_0x5d60[_0xc867de];return _0x4350c2;};'use strict';var Sequelize=require(_0x05d6('0x0'));var iconv=require(_0x05d6('0x1'));module[_0x05d6('0x2')]={'closed':{'type':Sequelize[_0x05d6('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x05d6('0x4')]},'disposition':{'type':Sequelize[_0x05d6('0x5')]},'secondDisposition':{'type':Sequelize[_0x05d6('0x5')]},'thirdDisposition':{'type':Sequelize[_0x05d6('0x5')]},'note':{'type':Sequelize[_0x05d6('0x5')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0x05d6('0x5')]},'cc':{'type':Sequelize[_0x05d6('0x6')]('long')},'subject':{'type':Sequelize[_0x05d6('0x6')]()},'attach':{'type':Sequelize[_0x05d6('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0x05d6('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0x05d6('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x05d6('0x7')]('in',_0x05d6('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x05d6('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x05d6('0x7')]('in',_0x05d6('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x05d6('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 09b6bca..09cdd08 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 _0xa9e0=['o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','Setting','enableEmailPreview','all','rows','show','params','includeAll','include','options','create','body','addMessage','ids','omit','getMessages','nolimit','MailInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','true','addTags','setTags','Tag','mailInteractionTags:save','download','join','root','server','tmp','attachments','Attachment','Attachments','subject','Messages','get','mkdirSync','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','existsSync','readFileSync','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','util','lodash','squel','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','defaults','socket.io-emitter','redis','./mailInteraction.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','send','Users','fullname','Tags','split','forEach','push','TagIds','MailMessage','findOne','out','-id','plainBody','lastMsgText','trimStart','catch','index','MailInteraction','rawAttributes','fieldName','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','sort','filters','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','type','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','keys','some','compact','where','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','group','QueryTypes','SELECT','clone','i.id','order','contactName','DESC','t.id\x20IN\x20?','resolve','MailAccountId','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgDirection','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.to','i.MailAccountId','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname'];(function(_0x60759a,_0x119045){var _0x10661e=function(_0x4e1ddc){while(--_0x4e1ddc){_0x60759a['push'](_0x60759a['shift']());}};_0x10661e(++_0x119045);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x0a9e('0x3'));var path=require('path');var fs=require('fs');var _=require(_0x0a9e('0x4'));var squel=require(_0x0a9e('0x5'));var juice=require(_0x0a9e('0x6'));var Redis=require(_0x0a9e('0x7'));var qs=require(_0x0a9e('0x8'));var as=require('../../components/parsers/advancedSearch');var logger=require(_0x0a9e('0x9'))(_0x0a9e('0xa'));var config=require(_0x0a9e('0xb'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x0a9e('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0a9e('0xd'))(new Redis(config[_0x0a9e('0xe')]));require(_0x0a9e('0xf'))[_0x0a9e('0x10')](socket);function respondWithStatusCode(_0xfeb75b,_0xbd1168){_0xbd1168=_0xbd1168||0xcc;return function(_0x4a4c56){if(_0x4a4c56){return _0xfeb75b['sendStatus'](_0xbd1168);}return _0xfeb75b['status'](_0xbd1168)['end']();};}function respondWithResult(_0x273d4d,_0x36471c){_0x36471c=_0x36471c||0xc8;return function(_0xd5b662){if(_0xd5b662){return _0x273d4d[_0x0a9e('0x11')](_0x36471c)[_0x0a9e('0x12')](_0xd5b662);}};}function respondWithFilteredResult(_0x69aeb7,_0x5db4b0){return function(_0x4283ce){if(_0x4283ce){var _0x239b12=typeof _0x5db4b0[_0x0a9e('0x13')]===_0x0a9e('0x14')&&typeof _0x5db4b0[_0x0a9e('0x15')]===_0x0a9e('0x14');var _0x52a03d=_0x4283ce[_0x0a9e('0x16')];var _0x5d0880=_0x239b12?0x0:_0x5db4b0[_0x0a9e('0x13')];var _0x519dfd=_0x239b12?_0x4283ce[_0x0a9e('0x16')]:_0x5db4b0[_0x0a9e('0x13')]+_0x5db4b0['limit'];var _0x225616;if(_0x519dfd>=_0x52a03d){_0x519dfd=_0x52a03d;_0x225616=0xc8;}else{_0x225616=0xce;}_0x69aeb7['status'](_0x225616);return _0x69aeb7[_0x0a9e('0x17')](_0x0a9e('0x18'),_0x5d0880+'-'+_0x519dfd+'/'+_0x52a03d)[_0x0a9e('0x12')](_0x4283ce);}return null;};}function saveUpdates(_0x205fd6){return function(_0x31b1ca){if(_0x31b1ca){return _0x31b1ca[_0x0a9e('0x19')](_0x205fd6)[_0x0a9e('0x1a')](function(_0x20559e){return _0x20559e;});}return null;};}function removeEntity(_0x1314ae){return function(_0x112016){if(_0x112016){return _0x112016[_0x0a9e('0x1b')]()[_0x0a9e('0x1a')](function(){_0x1314ae['status'](0xcc)[_0x0a9e('0x1c')]();});}};}function handleEntityNotFound(_0x155cce){return function(_0x53682f){if(!_0x53682f){_0x155cce[_0x0a9e('0x1d')](0x194);}return _0x53682f;};}function handleError(_0x5a09ef,_0x588269){_0x588269=_0x588269||0x1f4;return function(_0x3a02e1){logger[_0x0a9e('0x1e')](_0x3a02e1[_0x0a9e('0x1f')]);if(_0x3a02e1[_0x0a9e('0x20')]){delete _0x3a02e1['name'];}_0x5a09ef[_0x0a9e('0x11')](_0x588269)[_0x0a9e('0x21')](_0x3a02e1);};}function getInteractionUsers(_0x3b45bc,_0x4d00e6){return new BPromise(function(_0x370d86,_0x42ac8f){try{if(_0x4d00e6[_0x3b45bc['id']]){_0x3b45bc[_0x0a9e('0x22')]=_['map'](_0x4d00e6[_0x3b45bc['id']],function(_0x59181e){return{'id':_0x59181e['id'],'fullname':_0x59181e[_0x0a9e('0x23')]};});}}catch(_0x3a8e58){_0x42ac8f(_0x3a8e58);}_0x370d86(_0x3b45bc);});}function getInteractionTags(_0x40c424,_0x33161b){return new BPromise(function(_0x526cf3,_0x384319){try{if(_0x40c424['TagIds']){_0x40c424[_0x0a9e('0x24')]=[];_0x40c424['TagIds'][_0x0a9e('0x25')](',')[_0x0a9e('0x26')](function(_0x25fba9){_0x40c424[_0x0a9e('0x24')][_0x0a9e('0x27')](_0x33161b[_0x25fba9]);});}delete _0x40c424[_0x0a9e('0x28')];}catch(_0x11c3b6){_0x384319(_0x11c3b6);}_0x526cf3(_0x40c424);});}function getLastMessageText(_0x14de77){return new BPromise(function(_0x5a101a,_0x3652a7){return db[_0x0a9e('0x29')][_0x0a9e('0x2a')]({'where':{'$and':[{'MailInteractionId':_0x14de77['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x0a9e('0x2b')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x0a9e('0x2c'),'raw':!![]})[_0x0a9e('0x1a')](function(_0x1843b2){if(_0x1843b2&&_0x1843b2[_0x0a9e('0x2d')]){_0x14de77[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x1843b2[_0x0a9e('0x2d')]);}_0x5a101a(_0x14de77);})[_0x0a9e('0x30')](function(_0x1dbde2){_0x3652a7(_0x1dbde2);});});}function updateMailInteraction(_0x540530,_0x426950,_0x5d1e0e,_0x2407f9){return new BPromise(function(_0x3ae878,_0x1122db){return getInteractionUsers(_0x540530,_0x5d1e0e)[_0x0a9e('0x1a')](function(_0x25ce3a){return getInteractionTags(_0x25ce3a,_0x426950);})['then'](function(_0x66c1d2){if(_0x2407f9){_0x3ae878(getLastMessageText(_0x66c1d2));}else{_0x3ae878(_0x66c1d2);}})[_0x0a9e('0x30')](function(_0x40cb85){_0x1122db(_0x40cb85);});});}exports[_0x0a9e('0x31')]=function(_0x2b45ea,_0x409319){var _0x332d35={},_0x39e565={},_0x5583a4={'count':0x0,'rows':[]};var _0x44295a=_['map'](db[_0x0a9e('0x32')][_0x0a9e('0x33')],function(_0x2b7e7f){return{'name':_0x2b7e7f[_0x0a9e('0x34')],'type':_0x2b7e7f['type'][_0x0a9e('0x35')]};});_0x39e565[_0x0a9e('0x36')]=_[_0x0a9e('0x37')](_0x44295a,_0x0a9e('0x20'));_0x39e565['query']=_['keys'](_0x2b45ea[_0x0a9e('0x38')]);_0x39e565['filters']=_[_0x0a9e('0x39')](_0x39e565[_0x0a9e('0x36')],_0x39e565[_0x0a9e('0x38')]);_0x332d35[_0x0a9e('0x3a')]=_['intersection'](_0x39e565[_0x0a9e('0x36')],qs[_0x0a9e('0x3b')](_0x2b45ea[_0x0a9e('0x38')]['fields']));_0x332d35[_0x0a9e('0x3a')]=_0x332d35[_0x0a9e('0x3a')][_0x0a9e('0x3c')]?_0x332d35['attributes']:_0x39e565['model'];if(!_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x3d')]('nolimit')){_0x332d35[_0x0a9e('0x15')]=qs[_0x0a9e('0x15')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x15')]);_0x332d35['offset']=qs['offset'](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x13')]);}_0x332d35['order']=qs[_0x0a9e('0x3e')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x3e')]);_0x332d35['where']=qs[_0x0a9e('0x3f')](_[_0x0a9e('0x40')](_0x2b45ea[_0x0a9e('0x38')],_0x39e565[_0x0a9e('0x3f')]),_0x44295a);var _0x13cb1f=[];var _0xeaa5e5=squel[_0x0a9e('0x41')]()[_0x0a9e('0x42')]('id')[_0x0a9e('0x42')](_0x0a9e('0x20'))[_0x0a9e('0x42')](_0x0a9e('0x43'))[_0x0a9e('0x44')](_0x0a9e('0x45'));var _0x37f6cc=squel['select']()['field'](_0x0a9e('0x46'))[_0x0a9e('0x42')](_0x0a9e('0x47'))[_0x0a9e('0x42')](_0x0a9e('0x48'))[_0x0a9e('0x44')](_0x0a9e('0x49'),'ui')[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'u',_0x0a9e('0x4c'));var _0x2c2cb0=squel[_0x0a9e('0x41')]()['from'](_0x0a9e('0x4d'),'i')[_0x0a9e('0x4a')](_0x0a9e('0x4e'),'c',_0x0a9e('0x4f'))[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'o',_0x0a9e('0x50'))[_0x0a9e('0x4a')]('mail_accounts','a',_0x0a9e('0x51'))['left_join'](_0x0a9e('0x52'),'me',_0x0a9e('0x53'))[_0x0a9e('0x4a')]('mail_interaction_has_tags','it',_0x0a9e('0x54'))[_0x0a9e('0x4a')](_0x0a9e('0x45'),'t',_0x0a9e('0x55'));var _0x45c845=squel[_0x0a9e('0x56')]();var _0x45bf7f=[];var _0x5bbcde=squel[_0x0a9e('0x56')]();var _0x1bde3c;if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x57')]){_0x1bde3c=as[_0x0a9e('0x58')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x57')]);var _0x19383e=_0x1bde3c[_0x0a9e('0x59')];for(var _0x58a5c2=0x0;_0x58a5c2<_0x1bde3c[_0x0a9e('0x5a')][_0x0a9e('0x3c')];_0x58a5c2++){var _0x4f7240=_0x1bde3c['conditions'][_0x58a5c2];var _0x5ddf84='i';var _0x1adfee=_[_0x0a9e('0x5b')](_0x44295a,[_0x0a9e('0x20'),_0x4f7240[_0x0a9e('0x42')]]);if(!_0x1adfee){switch(_0x4f7240[_0x0a9e('0x42')]){case _0x0a9e('0x5c'):if(_0x4f7240[_0x0a9e('0x5d')]==0x1){_0x2c2cb0[_0x0a9e('0x5e')]('`'+_0x4f7240['field']+'`\x20=\x200');}else{_0x2c2cb0['having']('`'+_0x4f7240[_0x0a9e('0x42')]+_0x0a9e('0x5f'));}break;case _0x0a9e('0x60'):if(_0x4f7240['operator']===_0x0a9e('0x61')){if(_0x4f7240[_0x0a9e('0x5d')]['split']('\x20')['length']>0x1){_0x45c845[_0x19383e](_0x0a9e('0x62'),qs['getFullTextValue'](_0x4f7240[_0x0a9e('0x5d')]),null);}else{var _0x4c3845='%'+_0x4f7240[_0x0a9e('0x5d')]+'%';_0x45c845[_0x19383e](_0x0a9e('0x63'),_0x4c3845,_0x4c3845,_0x4c3845);}}else{_0x1adfee=_[_0x0a9e('0x5b')](_0x44295a,['name',_0x0a9e('0x64')]);_0x4f7240[_0x0a9e('0x42')]='ContactId';_0x2244d6=as['buildExpression'](_0x5ddf84,_0x1adfee[_0x0a9e('0x65')],_0x4f7240);_0x45c845[_0x19383e](_0x2244d6[_0x0a9e('0x66')],_0x2244d6['value'][_0x0a9e('0x67')],_0x2244d6['value'][_0x0a9e('0x1c')]);}break;case'Tag':var _0xe22ccc=_0x4f7240['value']['split'](',')['map'](function(_0x2da03c){return Number(_0x2da03c);});_0xe22ccc['forEach'](function(_0x2f7092){_0x5bbcde['or'](_0x0a9e('0x68'),'%,'+_0x2f7092+',%');});_0x45bf7f=_[_0x0a9e('0x69')](_0x45bf7f,_0xe22ccc);break;case _0x0a9e('0x6a'):if(_0x4f7240[_0x0a9e('0x6b')]===_0x0a9e('0x61')){_0x45c845[_0x19383e](_0x0a9e('0x6c'),'%'+_0x4f7240[_0x0a9e('0x5d')]+'%',null);}else{_0x1adfee=_['find'](_0x44295a,[_0x0a9e('0x20'),_0x0a9e('0x6d')]);_0x4f7240[_0x0a9e('0x42')]=_0x0a9e('0x6d');_0x2244d6=as[_0x0a9e('0x6e')](_0x5ddf84,_0x1adfee[_0x0a9e('0x65')],_0x4f7240);_0x45c845[_0x19383e](_0x2244d6['text'],_0x2244d6[_0x0a9e('0x5d')][_0x0a9e('0x67')],_0x2244d6['value'][_0x0a9e('0x1c')]);}break;case'plainBody':_0x2244d6=as[_0x0a9e('0x6e')]('me',null,_0x4f7240);_0x45c845[_0x19383e](_0x2244d6['text'],_0x2244d6['value']['start'],_0x2244d6[_0x0a9e('0x5d')]['end']);break;}}else{var _0x2244d6=as[_0x0a9e('0x6e')](_0x5ddf84,_0x1adfee[_0x0a9e('0x65')],_0x4f7240);_0x45c845[_0x19383e](_0x2244d6[_0x0a9e('0x66')],_0x2244d6[_0x0a9e('0x5d')][_0x0a9e('0x67')],_0x2244d6['value'][_0x0a9e('0x1c')]);}}}else{var _0x5854cc=_(_0x2b45ea[_0x0a9e('0x38')])[_0x0a9e('0x6f')]()[_0x0a9e('0x37')](function(_0x5adf8f){return _[_0x0a9e('0x70')](_0x44295a,[_0x0a9e('0x20'),_0x5adf8f])?_0x5adf8f:undefined;})[_0x0a9e('0x71')]()[_0x0a9e('0x5d')]();if(!_['isEmpty'](_0x5854cc)){_0x5854cc[_0x0a9e('0x26')](function(_0xe05a5a){if(_0xe05a5a==='MailAccountId'){_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x73'),[][_0x0a9e('0x74')](_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a]));}else if(_0xe05a5a===_0x0a9e('0x75')){var _0x4d4a35=JSON[_0x0a9e('0x76')](_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a])[_0x0a9e('0x77')];var _0x47bb43=JSON[_0x0a9e('0x76')](_0x2b45ea['query'][_0xe05a5a])['$lte'];_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x78'),_0x4d4a35,_0x47bb43);}else{if(_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a]===_0x0a9e('0x79')){_0x2c2cb0[_0x0a9e('0x72')]('i.'+_0xe05a5a+_0x0a9e('0x7a'));}else{_0x2c2cb0[_0x0a9e('0x72')]('i.'+_0xe05a5a+_0x0a9e('0x7b'),_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a]);}}});}if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x7c')]){if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x7c')]==0x1){_0x2c2cb0[_0x0a9e('0x5e')](_0x0a9e('0x7d'));}else{_0x2c2cb0[_0x0a9e('0x5e')](_0x0a9e('0x7e'));}}if(_0x2b45ea[_0x0a9e('0x38')]['tag']){_0x45bf7f=_[_0x0a9e('0x7f')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x80')])?_0x2b45ea['query'][_0x0a9e('0x80')]:new Array(_0x2b45ea[_0x0a9e('0x38')]['tag']);_0x45bf7f[_0x0a9e('0x26')](function(_0x56e31e){_0x5bbcde['or'](_0x0a9e('0x68'),'%,'+_0x56e31e+',%');});}if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x81')]){var _0x4a43a8=_0x2b45ea['query']['filter'][_0x0a9e('0x82')]('\x5c','\x5c\x5c')[_0x0a9e('0x82')](/'/g,'\x27\x27');if(qs[_0x0a9e('0x83')](_0x4a43a8)){_0x45c845['or'](_0x0a9e('0x84'),_0x4a43a8+'%');}else if(qs[_0x0a9e('0x85')](_0x4a43a8)){_0x45c845['or'](_0x0a9e('0x86'),_0x4a43a8+'%');}else{_0x45c845['or'](_0x0a9e('0x87'),qs[_0x0a9e('0x88')](_0x4a43a8))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x0a9e('0x88')](_0x4a43a8));}}}_0x2c2cb0[_0x0a9e('0x72')](_0x45c845);_0x2c2cb0[_0x0a9e('0x89')]('i.id');var _0x2bdc44={'type':db['Sequelize'][_0x0a9e('0x8a')][_0x0a9e('0x8b')],'raw':!![]};var _0x4c46c1=_0x2c2cb0[_0x0a9e('0x8c')]();_0x4c46c1[_0x0a9e('0x42')](_0x0a9e('0x8d'));_0x4c46c1[_0x0a9e('0x42')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0a9e('0x5c'));if(_0x332d35[_0x0a9e('0x8e')]){_0x332d35[_0x0a9e('0x8e')][_0x0a9e('0x26')](function(_0x5b7fc3){var _0x109ccb=_0x5b7fc3[0x0]===_0x0a9e('0x8f')?_0x5b7fc3[0x0]:'i.'+_0x5b7fc3[0x0];_0x2c2cb0[_0x0a9e('0x8e')](_0x109ccb,_0x5b7fc3[0x1]===_0x0a9e('0x90')?![]:!![]);});}if(!_['isEmpty'](_0x45bf7f)){_0x2c2cb0[_0x0a9e('0x5e')](_0x5bbcde);_0x4c46c1[_0x0a9e('0x72')](_0x0a9e('0x91'),_0x45bf7f);}BPromise[_0x0a9e('0x92')]()[_0x0a9e('0x1a')](function(){if(!_0x1bde3c){if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x93')])return;_0x4c46c1[_0x0a9e('0x72')](_0x0a9e('0x94'));_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x94'));return;}if(_0x2b45ea[_0x0a9e('0x95')][_0x0a9e('0x96')]!==_0x0a9e('0x97'))return;return _0x2b45ea['user'][_0x0a9e('0x98')]({'attributes':['id'],'raw':!![]})[_0x0a9e('0x1a')](function(_0xc599b3){if(_['isEmpty'](_0xc599b3)){_0x4c46c1[_0x0a9e('0x72')](_0x0a9e('0x99'));_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x99'));}else{_0x4c46c1['where']('i.MailAccountId\x20IN\x20?',_[_0x0a9e('0x37')](_0xc599b3,'id'));_0x2c2cb0[_0x0a9e('0x72')]('i.MailAccountId\x20IN\x20?',_[_0x0a9e('0x37')](_0xc599b3,'id'));}});})['then'](function(){if(_0x2b45ea[_0x0a9e('0x95')][_0x0a9e('0x96')]==='agent'&&!_0x1bde3c&&!_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x93')])return[];return db[_0x0a9e('0x9a')][_0x0a9e('0x38')](_0x4c46c1[_0x0a9e('0x9b')](),_0x2bdc44);})[_0x0a9e('0x1a')](function(_0x444f1f){_0x5583a4['count']=_0x444f1f[_0x0a9e('0x3c')];if(_0x5583a4[_0x0a9e('0x16')]===0x0)return[];return db[_0x0a9e('0x9a')][_0x0a9e('0x38')](_0xeaa5e5['toString'](),_0x2bdc44)[_0x0a9e('0x1a')](function(_0xf0db1){_0x13cb1f=_['keyBy'](_0xf0db1,'id');_0x2bdc44=_[_0x0a9e('0x9c')](_0x2bdc44,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x3b')]){_0x332d35[_0x0a9e('0x3a')][_0x0a9e('0x26')](function(_0x5af453){_0x2c2cb0['field']('i.'+_0x5af453);});}else{_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0x9d'),_0x0a9e('0x5c'));_0x2c2cb0['field'](_0x0a9e('0x9e'),_0x0a9e('0x9f'));_0x2c2cb0['field']('a.mandatoryDisposition',_0x0a9e('0xa0'));_0x2c2cb0['field']('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0x8d'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa1'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa2'));_0x2c2cb0['field'](_0x0a9e('0xa3'));_0x2c2cb0['field'](_0x0a9e('0xa4'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa5'));_0x2c2cb0[_0x0a9e('0x42')]('i.lastMsgAt');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa6'));_0x2c2cb0[_0x0a9e('0x42')]('i.subject');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa7'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa8'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa9'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xaa'));_0x2c2cb0['field'](_0x0a9e('0xab'));_0x2c2cb0[_0x0a9e('0x42')]('i.ContactId');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xac'));_0x2c2cb0[_0x0a9e('0x42')]('i.UserId');_0x2c2cb0[_0x0a9e('0x42')]('c.firstName',_0x0a9e('0xad'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xae'),_0x0a9e('0xaf'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb0'),_0x0a9e('0xb1'));_0x2c2cb0[_0x0a9e('0x42')]('c.phone',_0x0a9e('0xb2'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb3'),_0x0a9e('0xb4'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb5'),_0x0a9e('0xb6'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb7'),_0x0a9e('0xb8'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb9'),_0x0a9e('0xba'));_0x2c2cb0['field'](_0x0a9e('0xbb'),_0x0a9e('0x28'));}if(_0x332d35[_0x0a9e('0x15')])_0x2c2cb0[_0x0a9e('0x15')](_0x332d35[_0x0a9e('0x15')]);if(_0x332d35['offset'])_0x2c2cb0[_0x0a9e('0x13')](_0x332d35[_0x0a9e('0x13')]);return db['sequelize'][_0x0a9e('0x38')](_0x2c2cb0['toString'](),_0x2bdc44);})[_0x0a9e('0x1a')](function(_0x27041d){if(_0x27041d[_0x0a9e('0x3c')]>0x0)_0x37f6cc[_0x0a9e('0x72')]('ui.MailInteractionId\x20IN\x20?',_[_0x0a9e('0x37')](_0x27041d,'id'));return db['sequelize'][_0x0a9e('0x38')](_0x37f6cc[_0x0a9e('0x9b')](),_0x2bdc44)['then'](function(_0x231c6a){var _0x63c9f7=_[_0x0a9e('0xbc')](_0x231c6a,'MailInteractionId');var _0x4c788f=[];return db[_0x0a9e('0xbd')][_0x0a9e('0x2a')]({'attributes':[_0x0a9e('0xbe')],'raw':!![]})[_0x0a9e('0x1a')](function(_0x3f2f40){var _0x2450a8=_0x3f2f40[_0x0a9e('0xbe')];_0x27041d[_0x0a9e('0x26')](function(_0x3f8124){_0x4c788f['push'](updateMailInteraction(_0x3f8124,_0x13cb1f,_0x63c9f7,_0x2450a8));});return BPromise[_0x0a9e('0xbf')](_0x4c788f);});});});})['then'](function(_0x287324){_0x5583a4[_0x0a9e('0xc0')]=_0x287324;return _0x5583a4;})[_0x0a9e('0x1a')](respondWithFilteredResult(_0x409319,_0x332d35))[_0x0a9e('0x30')](handleError(_0x409319,null));};exports[_0x0a9e('0xc1')]=function(_0x4e7273,_0x436313){var _0x4667bf={'raw':![],'where':{'id':_0x4e7273[_0x0a9e('0xc2')]['id']}},_0x2791c5={};_0x2791c5[_0x0a9e('0x36')]=_['keys'](db['MailInteraction'][_0x0a9e('0x33')]);_0x2791c5['query']=_[_0x0a9e('0x6f')](_0x4e7273[_0x0a9e('0x38')]);_0x2791c5[_0x0a9e('0x3f')]=_[_0x0a9e('0x39')](_0x2791c5[_0x0a9e('0x36')],_0x2791c5[_0x0a9e('0x38')]);_0x4667bf['attributes']=_['intersection'](_0x2791c5[_0x0a9e('0x36')],qs['fields'](_0x4e7273[_0x0a9e('0x38')]['fields']));_0x4667bf[_0x0a9e('0x3a')]=_0x4667bf['attributes']['length']?_0x4667bf[_0x0a9e('0x3a')]:_0x2791c5[_0x0a9e('0x36')];if(_0x4e7273['query'][_0x0a9e('0xc3')]){_0x4667bf[_0x0a9e('0xc4')]=[{'all':!![]}];}_0x4667bf=_[_0x0a9e('0x9c')]({},_0x4667bf,_0x4e7273[_0x0a9e('0xc5')]);return db[_0x0a9e('0x32')]['find'](_0x4667bf)['then'](handleEntityNotFound(_0x436313,null))[_0x0a9e('0x1a')](respondWithResult(_0x436313,null))[_0x0a9e('0x30')](handleError(_0x436313,null));};exports[_0x0a9e('0xc6')]=function(_0x24beb6,_0x59303b){return db['MailInteraction'][_0x0a9e('0xc6')](_0x24beb6[_0x0a9e('0xc7')],{})['then'](respondWithResult(_0x59303b,0xc9))[_0x0a9e('0x30')](handleError(_0x59303b,null));};exports[_0x0a9e('0x19')]=function(_0xcacabb,_0x2427d5){if(_0xcacabb[_0x0a9e('0xc7')]['id']){delete _0xcacabb[_0x0a9e('0xc7')]['id'];}return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0xcacabb[_0x0a9e('0xc2')]['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x2427d5,null))['then'](saveUpdates(_0xcacabb[_0x0a9e('0xc7')],null))[_0x0a9e('0x1a')](respondWithResult(_0x2427d5,null))[_0x0a9e('0x30')](handleError(_0x2427d5,null));};exports[_0x0a9e('0x1b')]=function(_0x1d0b02,_0x547e37){return db['MailInteraction'][_0x0a9e('0x5b')]({'where':{'id':_0x1d0b02[_0x0a9e('0xc2')]['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x547e37,null))[_0x0a9e('0x1a')](removeEntity(_0x547e37,null))[_0x0a9e('0x30')](handleError(_0x547e37,null));};exports['describe']=function(_0x1339d0,_0x3c775a){return db[_0x0a9e('0x32')]['describe']()[_0x0a9e('0x1a')](respondWithResult(_0x3c775a,null))['catch'](handleError(_0x3c775a,null));};exports[_0x0a9e('0xc8')]=function(_0x4799d4,_0x25b745){return db[_0x0a9e('0x29')][_0x0a9e('0x5b')]({'where':{'id':_0x4799d4['params']['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x25b745,null))['then'](function(_0x4383da){if(_0x4383da){return _0x4383da[_0x0a9e('0xc8')](_0x4799d4[_0x0a9e('0xc7')][_0x0a9e('0xc9')],_[_0x0a9e('0xca')](_0x4799d4[_0x0a9e('0xc7')],[_0x0a9e('0xc9'),'id'])||{});}})[_0x0a9e('0x1a')](respondWithResult(_0x25b745,null))[_0x0a9e('0x30')](handleError(_0x25b745,null));};exports[_0x0a9e('0xcb')]=function(_0x4262d0,_0xc876d4){var _0x2415fe={'raw':![],'where':{}};var _0x399def={};var _0x98c62c={'count':0x0,'rows':[]};return db[_0x0a9e('0x32')]['findOne']({'where':{'id':_0x4262d0['params']['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0xc876d4,null))['then'](function(_0x1d999b){if(_0x1d999b){_0x399def[_0x0a9e('0x36')]=_['keys'](db[_0x0a9e('0x29')][_0x0a9e('0x33')]);_0x399def[_0x0a9e('0x38')]=_[_0x0a9e('0x6f')](_0x4262d0['query']);_0x399def[_0x0a9e('0x3f')]=_[_0x0a9e('0x39')](_0x399def[_0x0a9e('0x36')],_0x399def[_0x0a9e('0x38')]);_0x2415fe['attributes']=_[_0x0a9e('0x39')](_0x399def[_0x0a9e('0x36')],qs[_0x0a9e('0x3b')](_0x4262d0['query'][_0x0a9e('0x3b')]));_0x2415fe[_0x0a9e('0x3a')]=_0x2415fe[_0x0a9e('0x3a')]['length']?_0x2415fe[_0x0a9e('0x3a')]:_0x399def[_0x0a9e('0x36')];if(!_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x3d')](_0x0a9e('0xcc'))){_0x2415fe['limit']=qs[_0x0a9e('0x15')](_0x4262d0[_0x0a9e('0x38')]['limit']);_0x2415fe[_0x0a9e('0x13')]=qs[_0x0a9e('0x13')](_0x4262d0[_0x0a9e('0x38')]['offset']);}_0x2415fe['order']=qs['sort'](_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x3e')]);_0x2415fe['where']=qs[_0x0a9e('0x3f')](_[_0x0a9e('0x40')](_0x4262d0[_0x0a9e('0x38')],_0x399def['filters']));_0x2415fe[_0x0a9e('0x72')][_0x0a9e('0xcd')]=_0x1d999b['id'];if(_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x81')]){_0x2415fe[_0x0a9e('0x72')]=_[_0x0a9e('0x9c')](_0x2415fe[_0x0a9e('0x72')],{'$or':_[_0x0a9e('0x37')](_0x2415fe[_0x0a9e('0x3a')],function(_0x5a1848){var _0x43c397={};_0x43c397[_0x5a1848]={'$like':'%'+_0x4262d0['query'][_0x0a9e('0x81')]+'%'};return _0x43c397;})});}if(_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x77')]){var _0x3cf222=_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x77')]['split'](',');var _0x1a0314={};_0x1a0314[_0x3cf222[0x0]]={'$gte':moment(_0x3cf222[0x1])[_0x0a9e('0xce')](_0x0a9e('0xcf'))};_0x2415fe[_0x0a9e('0x72')]=_['merge'](_0x2415fe[_0x0a9e('0x72')],_0x1a0314);}_0x2415fe=_[_0x0a9e('0x9c')]({},_0x2415fe,_0x4262d0[_0x0a9e('0xc5')]);return db[_0x0a9e('0x29')][_0x0a9e('0x16')]({'where':_0x2415fe[_0x0a9e('0x72')]})[_0x0a9e('0x1a')](function(_0x25931e){_0x98c62c[_0x0a9e('0x16')]=_0x25931e;if(_0x4262d0[_0x0a9e('0x38')]['includeAll']){_0x2415fe[_0x0a9e('0xc4')]=[{'all':!![]}];}return db[_0x0a9e('0x29')][_0x0a9e('0xd0')](_0x2415fe);})[_0x0a9e('0x1a')](function(_0xea8bd1){if(_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0xd1')]===_0x0a9e('0xd2')){for(var _0x566b90=0x0;_0x566b90<_0xea8bd1[_0x0a9e('0x3c')];_0x566b90++){_0xea8bd1[_0x566b90][_0x0a9e('0xc7')]=juice(_0xea8bd1[_0x566b90][_0x0a9e('0xc7')]);}}_0x98c62c['rows']=_0xea8bd1;return _0x98c62c;});}})[_0x0a9e('0x1a')](respondWithFilteredResult(_0xc876d4,_0x2415fe))[_0x0a9e('0x30')](handleError(_0xc876d4,null));};exports[_0x0a9e('0xd3')]=function(_0x97d5b5,_0x370b5e){return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0x97d5b5[_0x0a9e('0xc2')]['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x370b5e,null))[_0x0a9e('0x1a')](function(_0x5a7dad){if(_0x5a7dad){return _0x5a7dad[_0x0a9e('0xd4')](_0x97d5b5[_0x0a9e('0xc7')][_0x0a9e('0xc9')],_[_0x0a9e('0xca')](_0x97d5b5[_0x0a9e('0xc7')],[_0x0a9e('0xc9'),'id'])||{})['spread'](function(){return db[_0x0a9e('0xd5')]['findAll']({'attributes':['id','name','color'],'where':{'id':_0x97d5b5[_0x0a9e('0xc7')][_0x0a9e('0xc9')]}});})[_0x0a9e('0x1a')](function(_0x2a07d0){socket['emit'](_0x0a9e('0xd6'),{'id':Number(_0x97d5b5[_0x0a9e('0xc2')]['id']),'tags':_0x2a07d0||[]});return{'id':Number(_0x97d5b5[_0x0a9e('0xc2')]['id']),'tags':_0x2a07d0||[]};});}})[_0x0a9e('0x1a')](respondWithResult(_0x370b5e,null))[_0x0a9e('0x30')](handleError(_0x370b5e,null));};exports['removeTags']=function(_0x57b1b1,_0x9484c8){return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0x57b1b1['params']['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x9484c8,null))[_0x0a9e('0x1a')](function(_0x422f0a){if(_0x422f0a){return _0x422f0a['removeTags'](_0x57b1b1[_0x0a9e('0x38')][_0x0a9e('0xc9')]);}})[_0x0a9e('0x1a')](respondWithStatusCode(_0x9484c8,null))['catch'](handleError(_0x9484c8,null));};exports[_0x0a9e('0xd7')]=function(_0x336b30,_0x3b7213){var _0x549e03=moment()['unix']()['toString']();var _0x3b04fd=path[_0x0a9e('0xd8')](config[_0x0a9e('0xd9')],_0x0a9e('0xda'),'files',_0x0a9e('0xdb'));var _0x532424=path[_0x0a9e('0xd8')](config[_0x0a9e('0xd9')],_0x0a9e('0xda'),'files',_0x0a9e('0xdc'));var _0x33a26c=path[_0x0a9e('0xd8')](_0x3b04fd,_0x549e03);var _0x580dd6=util[_0x0a9e('0xce')]('transcript-%d-%s.zip',_0x336b30[_0x0a9e('0xc2')]['id'],_0x549e03);var _0x5c57e1=path[_0x0a9e('0xd8')](_0x3b04fd,_0x580dd6);var _0x57b7d4=[];if(_0x336b30[_0x0a9e('0x38')][_0x0a9e('0xdc')]){_0x57b7d4[_0x0a9e('0x27')]({'model':db[_0x0a9e('0xdd')],'as':_0x0a9e('0xde'),'raw':!![]});}var _0x251dd9=[{'model':db[_0x0a9e('0x29')],'as':'Messages','attributes':['id',_0x0a9e('0xc7'),_0x0a9e('0x44'),'to','cc','bcc',_0x0a9e('0xdf'),_0x0a9e('0x75')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x57b7d4}];return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0x336b30[_0x0a9e('0xc2')]['id']},'include':_0x251dd9})['then'](handleEntityNotFound(_0x3b7213,null))[_0x0a9e('0x1a')](function(_0xf49ed4){if(_0xf49ed4&&_0xf49ed4[_0x0a9e('0xe0')]){var _0x3f0d64=_0xf49ed4[_0x0a9e('0xe1')]({'plain':!![]});fs[_0x0a9e('0xe2')](_0x33a26c);return BPromise[_0x0a9e('0xe3')](_0x3f0d64[_0x0a9e('0xe0')],function(_0x22767f,_0x426c3c){var _0x56e148={'from':_0x22767f[_0x0a9e('0x44')],'to':_0x22767f['to'],'subject':_0x22767f['subject'],'html':_0x22767f[_0x0a9e('0xc7')],'headers':{'Date':moment(_0x22767f[_0x0a9e('0x75')])[_0x0a9e('0xce')](_0x0a9e('0xe4'))},'attachments':[]};if(_0x22767f['cc']){_0x56e148[_0x0a9e('0xe5')]['Cc']=_0x22767f['cc'];}if(_0x22767f[_0x0a9e('0xe6')]){_0x56e148['headers'][_0x0a9e('0xe7')]=_0x22767f[_0x0a9e('0xe6')];}return new BPromise(function(_0x2977a7,_0x55a599){if(_0x22767f[_0x0a9e('0xde')]){for(var _0x402544=0x0;_0x402544<_0x22767f[_0x0a9e('0xde')][_0x0a9e('0x3c')];_0x402544++){var _0x31e1e0=_0x22767f[_0x0a9e('0xde')][_0x402544];var _0x1e93f5=path['join'](_0x532424,_0x31e1e0[_0x0a9e('0xe8')]);if(fs[_0x0a9e('0xe9')](_0x1e93f5)){_0x56e148[_0x0a9e('0xdc')][_0x0a9e('0x27')]({'name':_0x31e1e0[_0x0a9e('0x20')],'contentType':_0x31e1e0[_0x0a9e('0x65')],'data':fs[_0x0a9e('0xea')](_0x1e93f5)});}}}emlformat['build'](_0x56e148,function(_0x5c8720,_0x10aa22){if(_0x5c8720)return _0x55a599(_0x5c8720);fs[_0x0a9e('0xeb')](path[_0x0a9e('0xd8')](_0x33a26c,util[_0x0a9e('0xce')](_0x0a9e('0xec'),_0x426c3c)),_0x10aa22);return _0x2977a7(_0x10aa22);});});})[_0x0a9e('0x1a')](function(){return new BPromise(function(_0x609711,_0x584854){zipdir(_0x33a26c,{'saveTo':_0x5c57e1},function(_0x39ea62,_0x1d7fc4){if(_0x39ea62)return _0x584854(_0x39ea62);return _0x609711(_0x1d7fc4);});})[_0x0a9e('0x1a')](function(){return new BPromise(function(_0x2675a5,_0x1b1757){rimraf(_0x33a26c,function(_0x3c6082){if(_0x3c6082)_0x1b1757(_0x3c6082);return _0x2675a5();});});})[_0x0a9e('0x1a')](function(){return _0x3b7213['download'](_0x5c57e1,_0x580dd6,function(_0x311288){if(!_0x311288)fs[_0x0a9e('0xed')](_0x5c57e1);});});});}else{return _0x3b7213[_0x0a9e('0x1d')](0xc8);}})['catch'](handleError(_0x3b7213,null));}; \ No newline at end of file +var _0xb10b=['Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','findOne','enableEmailPreview','show','params','rawAttributes','includeAll','include','merge','options','create','body','describe','addMessage','ids','omit','getMessages','nolimit','pick','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','rows','spread','emit','mailInteractionTags:save','removeTags','download','unix','join','server','tmp','root','files','attachments','transcript-%d-%s.zip','Attachment','Attachments','Messages','subject','get','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','existsSync','build','message%d.eml','unlinkSync','eml-format','zip-dir','moment','bluebird','path','lodash','squel','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','error','stack','name','send','fullname','TagIds','Tags','split','forEach','push','MailMessage','out','-id','trimStart','plainBody','catch','index','map','MailInteraction','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','field','color','tools_tags','u.id','ui.MailInteractionId','from','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','select','mail_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','it.MailInteractionId\x20=\x20i.id','expr','search','parseSearch','conditions','length','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','some','compact','isEmpty','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','isEmail','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','MailAccountId','i.MailAccountId\x20IS\x20NOT\x20NULL','role','getMailAccounts','i.MailAccountId\x20IS\x20NULL','agent','toString','sequelize','keyBy','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.createdAt','i.updatedAt','i.closed','i.attach','i.lastMsgAt','i.subject','i.disposition','i.secondDisposition','i.thirdDisposition','i.ContactId','i.MailAccountId','Contact.firstName','c.email'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xb10b,0x12a));var _0xbb10=function(_0x166e71,_0x3a1cd4){_0x166e71=_0x166e71-0x0;var _0x2ebc75=_0xb10b[_0x166e71];return _0x2ebc75;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var BPromise=require(_0xbb10('0x3'));var util=require('util');var path=require(_0xbb10('0x4'));var fs=require('fs');var _=require(_0xbb10('0x5'));var squel=require(_0xbb10('0x6'));var juice=require(_0xbb10('0x7'));var Redis=require(_0xbb10('0x8'));var qs=require(_0xbb10('0x9'));var as=require('../../components/parsers/advancedSearch');var logger=require(_0xbb10('0xa'))(_0xbb10('0xb'));var config=require('../../config/environment');var db=require(_0xbb10('0xc'))['db'];config[_0xbb10('0xd')]=_[_0xbb10('0xe')](config[_0xbb10('0xd')],{'host':_0xbb10('0xf'),'port':0x18eb});var socket=require(_0xbb10('0x10'))(new Redis(config[_0xbb10('0xd')]));require(_0xbb10('0x11'))['register'](socket);function respondWithStatusCode(_0x4e47f8,_0x20bd61){_0x20bd61=_0x20bd61||0xcc;return function(_0x118a74){if(_0x118a74){return _0x4e47f8[_0xbb10('0x12')](_0x20bd61);}return _0x4e47f8['status'](_0x20bd61)[_0xbb10('0x13')]();};}function respondWithResult(_0x5be7e0,_0x44fb19){_0x44fb19=_0x44fb19||0xc8;return function(_0x916a32){if(_0x916a32){return _0x5be7e0[_0xbb10('0x14')](_0x44fb19)[_0xbb10('0x15')](_0x916a32);}};}function respondWithFilteredResult(_0x442548,_0x147230){return function(_0x58a612){if(_0x58a612){var _0x26e021=typeof _0x147230[_0xbb10('0x16')]===_0xbb10('0x17')&&typeof _0x147230[_0xbb10('0x18')]===_0xbb10('0x17');var _0x2f2ebf=_0x58a612[_0xbb10('0x19')];var _0x36b5e8=_0x26e021?0x0:_0x147230[_0xbb10('0x16')];var _0x2b184e=_0x26e021?_0x58a612['count']:_0x147230[_0xbb10('0x16')]+_0x147230[_0xbb10('0x18')];var _0x133ac2;if(_0x2b184e>=_0x2f2ebf){_0x2b184e=_0x2f2ebf;_0x133ac2=0xc8;}else{_0x133ac2=0xce;}_0x442548[_0xbb10('0x14')](_0x133ac2);return _0x442548[_0xbb10('0x1a')](_0xbb10('0x1b'),_0x36b5e8+'-'+_0x2b184e+'/'+_0x2f2ebf)[_0xbb10('0x15')](_0x58a612);}return null;};}function saveUpdates(_0x30efc6){return function(_0xbf2906){if(_0xbf2906){return _0xbf2906[_0xbb10('0x1c')](_0x30efc6)['then'](function(_0x5ff0cf){return _0x5ff0cf;});}return null;};}function removeEntity(_0x19f48d){return function(_0x388fab){if(_0x388fab){return _0x388fab[_0xbb10('0x1d')]()[_0xbb10('0x1e')](function(){_0x19f48d[_0xbb10('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12f888){return function(_0x12ef77){if(!_0x12ef77){_0x12f888['sendStatus'](0x194);}return _0x12ef77;};}function handleError(_0x4c4b0d,_0x8e2b97){_0x8e2b97=_0x8e2b97||0x1f4;return function(_0x311abe){logger[_0xbb10('0x1f')](_0x311abe[_0xbb10('0x20')]);if(_0x311abe[_0xbb10('0x21')]){delete _0x311abe[_0xbb10('0x21')];}_0x4c4b0d[_0xbb10('0x14')](_0x8e2b97)[_0xbb10('0x22')](_0x311abe);};}function getInteractionUsers(_0x7f2377,_0x395404){return new BPromise(function(_0x3ba6cd,_0x26ad93){try{if(_0x395404[_0x7f2377['id']]){_0x7f2377['Users']=_['map'](_0x395404[_0x7f2377['id']],function(_0x4fb5e0){return{'id':_0x4fb5e0['id'],'fullname':_0x4fb5e0[_0xbb10('0x23')]};});}}catch(_0x3c5ae7){_0x26ad93(_0x3c5ae7);}_0x3ba6cd(_0x7f2377);});}function getInteractionTags(_0x2c89b9,_0x4e25ff){return new BPromise(function(_0x2fdde9,_0x24d586){try{if(_0x2c89b9[_0xbb10('0x24')]){_0x2c89b9[_0xbb10('0x25')]=[];_0x2c89b9[_0xbb10('0x24')][_0xbb10('0x26')](',')[_0xbb10('0x27')](function(_0x4aabb9){_0x2c89b9[_0xbb10('0x25')][_0xbb10('0x28')](_0x4e25ff[_0x4aabb9]);});}delete _0x2c89b9[_0xbb10('0x24')];}catch(_0x2e0249){_0x24d586(_0x2e0249);}_0x2fdde9(_0x2c89b9);});}function getLastMessageText(_0x1d30aa){return new BPromise(function(_0x2ff4c1,_0x5d5c80){return db[_0xbb10('0x29')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x1d30aa['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xbb10('0x2a')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0xbb10('0x2b'),'raw':!![]})[_0xbb10('0x1e')](function(_0x1b59f9){if(_0x1b59f9&&_0x1b59f9['plainBody']){_0x1d30aa['lastMsgText']=_[_0xbb10('0x2c')](_0x1b59f9[_0xbb10('0x2d')]);}_0x2ff4c1(_0x1d30aa);})['catch'](function(_0x359ad4){_0x5d5c80(_0x359ad4);});});}function updateMailInteraction(_0x37dde7,_0x2f653f,_0x1c0b57,_0x37a83f){return new BPromise(function(_0x138bc6,_0xf85197){return getInteractionUsers(_0x37dde7,_0x1c0b57)['then'](function(_0x25acb3){return getInteractionTags(_0x25acb3,_0x2f653f);})[_0xbb10('0x1e')](function(_0x441d15){if(_0x37a83f){_0x138bc6(getLastMessageText(_0x441d15));}else{_0x138bc6(_0x441d15);}})[_0xbb10('0x2e')](function(_0xfb2c5e){_0xf85197(_0xfb2c5e);});});}exports[_0xbb10('0x2f')]=function(_0x188cbd,_0x10202c){var _0x3c8d7d={},_0x56943c={},_0x2b5352={'count':0x0,'rows':[]};var _0x150107=_[_0xbb10('0x30')](db[_0xbb10('0x31')]['rawAttributes'],function(_0x111762){return{'name':_0x111762['fieldName'],'type':_0x111762['type'][_0xbb10('0x32')]};});_0x56943c[_0xbb10('0x33')]=_[_0xbb10('0x30')](_0x150107,_0xbb10('0x21'));_0x56943c[_0xbb10('0x34')]=_[_0xbb10('0x35')](_0x188cbd['query']);_0x56943c[_0xbb10('0x36')]=_[_0xbb10('0x37')](_0x56943c['model'],_0x56943c['query']);_0x3c8d7d['attributes']=_[_0xbb10('0x37')](_0x56943c[_0xbb10('0x33')],qs[_0xbb10('0x38')](_0x188cbd['query'][_0xbb10('0x38')]));_0x3c8d7d[_0xbb10('0x39')]=_0x3c8d7d[_0xbb10('0x39')]['length']?_0x3c8d7d[_0xbb10('0x39')]:_0x56943c[_0xbb10('0x33')];if(!_0x188cbd[_0xbb10('0x34')][_0xbb10('0x3a')]('nolimit')){_0x3c8d7d[_0xbb10('0x18')]=qs[_0xbb10('0x18')](_0x188cbd['query'][_0xbb10('0x18')]);_0x3c8d7d[_0xbb10('0x16')]=qs[_0xbb10('0x16')](_0x188cbd[_0xbb10('0x34')][_0xbb10('0x16')]);}_0x3c8d7d[_0xbb10('0x3b')]=qs['sort'](_0x188cbd[_0xbb10('0x34')][_0xbb10('0x3c')]);_0x3c8d7d[_0xbb10('0x3d')]=qs[_0xbb10('0x36')](_['pick'](_0x188cbd[_0xbb10('0x34')],_0x56943c[_0xbb10('0x36')]),_0x150107);var _0x23dc18=[];var _0x403beb=squel['select']()[_0xbb10('0x3e')]('id')[_0xbb10('0x3e')]('name')['field'](_0xbb10('0x3f'))['from'](_0xbb10('0x40'));var _0x180933=squel['select']()[_0xbb10('0x3e')](_0xbb10('0x41'))[_0xbb10('0x3e')]('u.fullname')[_0xbb10('0x3e')](_0xbb10('0x42'))[_0xbb10('0x43')](_0xbb10('0x44'),'ui')[_0xbb10('0x45')](_0xbb10('0x46'),'u',_0xbb10('0x47'));var _0x3efa96=squel[_0xbb10('0x48')]()[_0xbb10('0x43')](_0xbb10('0x49'),'i')[_0xbb10('0x45')]('cm_contacts','c',_0xbb10('0x4a'))[_0xbb10('0x45')]('users','o',_0xbb10('0x4b'))[_0xbb10('0x45')](_0xbb10('0x4c'),'a',_0xbb10('0x4d'))[_0xbb10('0x45')](_0xbb10('0x4e'),'me',_0xbb10('0x4f'))['left_join']('mail_interaction_has_tags','it',_0xbb10('0x50'))[_0xbb10('0x45')](_0xbb10('0x40'),'t','t.id\x20=\x20it.TagId');var _0x5f0c12=squel[_0xbb10('0x51')]();var _0x34cf4e=[];var _0x1bd054=squel[_0xbb10('0x51')]();var _0x10159b;if(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x52')]){_0x10159b=as[_0xbb10('0x53')](_0x188cbd[_0xbb10('0x34')][_0xbb10('0x52')]);var _0x550111=_0x10159b['sqlOperator'];for(var _0x412e13=0x0;_0x412e13<_0x10159b[_0xbb10('0x54')][_0xbb10('0x55')];_0x412e13++){var _0xb014b0=_0x10159b[_0xbb10('0x54')][_0x412e13];var _0x440f9e='i';var _0x358e7e=_[_0xbb10('0x56')](_0x150107,[_0xbb10('0x21'),_0xb014b0[_0xbb10('0x3e')]]);if(!_0x358e7e){switch(_0xb014b0[_0xbb10('0x3e')]){case _0xbb10('0x57'):if(_0xb014b0[_0xbb10('0x58')]==0x1){_0x3efa96[_0xbb10('0x59')]('`'+_0xb014b0[_0xbb10('0x3e')]+'`\x20=\x200');}else{_0x3efa96[_0xbb10('0x59')]('`'+_0xb014b0['field']+_0xbb10('0x5a'));}break;case _0xbb10('0x5b'):if(_0xb014b0[_0xbb10('0x5c')]===_0xbb10('0x5d')){if(_0xb014b0[_0xbb10('0x58')][_0xbb10('0x26')]('\x20')[_0xbb10('0x55')]>0x1){_0x5f0c12[_0x550111](_0xbb10('0x5e'),qs[_0xbb10('0x5f')](_0xb014b0[_0xbb10('0x58')]),null);}else{var _0x44a056='%'+_0xb014b0[_0xbb10('0x58')]+'%';_0x5f0c12[_0x550111](_0xbb10('0x60'),_0x44a056,_0x44a056,_0x44a056);}}else{_0x358e7e=_[_0xbb10('0x56')](_0x150107,[_0xbb10('0x21'),'ContactId']);_0xb014b0[_0xbb10('0x3e')]=_0xbb10('0x61');_0x155dc5=as[_0xbb10('0x62')](_0x440f9e,_0x358e7e[_0xbb10('0x63')],_0xb014b0);_0x5f0c12[_0x550111](_0x155dc5[_0xbb10('0x64')],_0x155dc5[_0xbb10('0x58')]['start'],_0x155dc5[_0xbb10('0x58')][_0xbb10('0x13')]);}break;case _0xbb10('0x65'):var _0x14fed3=_0xb014b0[_0xbb10('0x58')][_0xbb10('0x26')](',')[_0xbb10('0x30')](function(_0x12ec18){return Number(_0x12ec18);});_0x14fed3[_0xbb10('0x27')](function(_0x40c4fb){_0x1bd054['or'](_0xbb10('0x66'),'%,'+_0x40c4fb+',%');});_0x34cf4e=_[_0xbb10('0x67')](_0x34cf4e,_0x14fed3);break;case _0xbb10('0x68'):if(_0xb014b0['operator']==='$substring'){_0x5f0c12[_0x550111](_0xbb10('0x69'),'%'+_0xb014b0[_0xbb10('0x58')]+'%',null);}else{_0x358e7e=_[_0xbb10('0x56')](_0x150107,[_0xbb10('0x21'),'UserId']);_0xb014b0['field']=_0xbb10('0x6a');_0x155dc5=as[_0xbb10('0x62')](_0x440f9e,_0x358e7e[_0xbb10('0x63')],_0xb014b0);_0x5f0c12[_0x550111](_0x155dc5[_0xbb10('0x64')],_0x155dc5[_0xbb10('0x58')][_0xbb10('0x6b')],_0x155dc5[_0xbb10('0x58')]['end']);}break;case _0xbb10('0x2d'):_0x155dc5=as[_0xbb10('0x62')]('me',null,_0xb014b0);_0x5f0c12[_0x550111](_0x155dc5['text'],_0x155dc5['value']['start'],_0x155dc5[_0xbb10('0x58')][_0xbb10('0x13')]);break;}}else{var _0x155dc5=as['buildExpression'](_0x440f9e,_0x358e7e['type'],_0xb014b0);_0x5f0c12[_0x550111](_0x155dc5['text'],_0x155dc5[_0xbb10('0x58')][_0xbb10('0x6b')],_0x155dc5[_0xbb10('0x58')]['end']);}}}else{var _0xa1bbd9=_(_0x188cbd[_0xbb10('0x34')])['keys']()['map'](function(_0x27d7b9){return _[_0xbb10('0x6c')](_0x150107,[_0xbb10('0x21'),_0x27d7b9])?_0x27d7b9:undefined;})[_0xbb10('0x6d')]()['value']();if(!_[_0xbb10('0x6e')](_0xa1bbd9)){_0xa1bbd9[_0xbb10('0x27')](function(_0xa7179d){if(_0xa7179d==='MailAccountId'){_0x3efa96[_0xbb10('0x3d')](_0xbb10('0x6f'),[][_0xbb10('0x70')](_0x188cbd['query'][_0xa7179d]));}else if(_0xa7179d===_0xbb10('0x71')){var _0x31e85e=JSON[_0xbb10('0x72')](_0x188cbd[_0xbb10('0x34')][_0xa7179d])['$gte'];var _0x251417=JSON[_0xbb10('0x72')](_0x188cbd[_0xbb10('0x34')][_0xa7179d])[_0xbb10('0x73')];_0x3efa96['where'](_0xbb10('0x74'),_0x31e85e,_0x251417);}else{if(_0x188cbd[_0xbb10('0x34')][_0xa7179d]===_0xbb10('0x75')){_0x3efa96[_0xbb10('0x3d')]('i.'+_0xa7179d+_0xbb10('0x76'));}else{_0x3efa96[_0xbb10('0x3d')]('i.'+_0xa7179d+_0xbb10('0x77'),_0x188cbd['query'][_0xa7179d]);}}});}if(_0x188cbd['query']['read']){if(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x78')]==0x1){_0x3efa96[_0xbb10('0x59')]('`unreadMessages`\x20=\x200');}else{_0x3efa96['having'](_0xbb10('0x79'));}}if(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x7a')]){_0x34cf4e=_[_0xbb10('0x7b')](_0x188cbd[_0xbb10('0x34')][_0xbb10('0x7a')])?_0x188cbd['query'][_0xbb10('0x7a')]:new Array(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x7a')]);_0x34cf4e[_0xbb10('0x27')](function(_0x2aaaa6){_0x1bd054['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2aaaa6+',%');});}if(_0x188cbd['query']['filter']){var _0x329da7=_0x188cbd[_0xbb10('0x34')][_0xbb10('0x7c')][_0xbb10('0x7d')]('\x5c','\x5c\x5c')[_0xbb10('0x7d')](/'/g,'\x27\x27');if(qs[_0xbb10('0x7e')](_0x329da7)){_0x5f0c12['or']('i.id\x20LIKE\x20?',_0x329da7+'%');}else if(qs[_0xbb10('0x7f')](_0x329da7)){_0x5f0c12['or']('c.email\x20LIKE\x20?',_0x329da7+'%');}else{_0x5f0c12['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x329da7))['or'](_0xbb10('0x80'),qs[_0xbb10('0x5f')](_0x329da7));}}}_0x3efa96[_0xbb10('0x3d')](_0x5f0c12);_0x3efa96[_0xbb10('0x81')]('i.id');var _0x122d38={'type':db['Sequelize']['QueryTypes'][_0xbb10('0x82')],'raw':!![]};var _0xfe3db0=_0x3efa96[_0xbb10('0x83')]();_0xfe3db0[_0xbb10('0x3e')](_0xbb10('0x84'));_0xfe3db0['field'](_0xbb10('0x85'),_0xbb10('0x57'));if(_0x3c8d7d[_0xbb10('0x3b')]){_0x3c8d7d[_0xbb10('0x3b')][_0xbb10('0x27')](function(_0x27f42f){var _0x174395=_0x27f42f[0x0]==='contactName'?_0x27f42f[0x0]:'i.'+_0x27f42f[0x0];_0x3efa96[_0xbb10('0x3b')](_0x174395,_0x27f42f[0x1]===_0xbb10('0x86')?![]:!![]);});}if(!_[_0xbb10('0x6e')](_0x34cf4e)){_0x3efa96[_0xbb10('0x59')](_0x1bd054);_0xfe3db0[_0xbb10('0x3d')](_0xbb10('0x87'),_0x34cf4e);}BPromise[_0xbb10('0x88')]()[_0xbb10('0x1e')](function(){if(!_0x10159b){if(_0x188cbd['query'][_0xbb10('0x89')])return;_0xfe3db0[_0xbb10('0x3d')](_0xbb10('0x8a'));_0x3efa96['where']('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x188cbd['user'][_0xbb10('0x8b')]!=='agent')return;return _0x188cbd['user'][_0xbb10('0x8c')]({'attributes':['id'],'raw':!![]})[_0xbb10('0x1e')](function(_0x33ff06){if(_[_0xbb10('0x6e')](_0x33ff06)){_0xfe3db0[_0xbb10('0x3d')](_0xbb10('0x8d'));_0x3efa96[_0xbb10('0x3d')](_0xbb10('0x8d'));}else{_0xfe3db0[_0xbb10('0x3d')]('i.MailAccountId\x20IN\x20?',_[_0xbb10('0x30')](_0x33ff06,'id'));_0x3efa96[_0xbb10('0x3d')](_0xbb10('0x6f'),_[_0xbb10('0x30')](_0x33ff06,'id'));}});})['then'](function(){if(_0x188cbd['user'][_0xbb10('0x8b')]===_0xbb10('0x8e')&&!_0x10159b&&!_0x188cbd[_0xbb10('0x34')][_0xbb10('0x89')])return[];return db['sequelize'][_0xbb10('0x34')](_0xfe3db0[_0xbb10('0x8f')](),_0x122d38);})[_0xbb10('0x1e')](function(_0xf7b3e1){_0x2b5352[_0xbb10('0x19')]=_0xf7b3e1['length'];if(_0x2b5352['count']===0x0)return[];return db[_0xbb10('0x90')][_0xbb10('0x34')](_0x403beb[_0xbb10('0x8f')](),_0x122d38)['then'](function(_0x256b35){_0x23dc18=_[_0xbb10('0x91')](_0x256b35,'id');_0x122d38=_['merge'](_0x122d38,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x38')]){_0x3c8d7d[_0xbb10('0x39')]['forEach'](function(_0x32d5a5){_0x3efa96[_0xbb10('0x3e')]('i.'+_0x32d5a5);});}else{_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x85'),_0xbb10('0x57'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x92'),_0xbb10('0x93'));_0x3efa96[_0xbb10('0x3e')]('a.mandatoryDisposition',_0xbb10('0x94'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x95'),_0xbb10('0x96'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x84'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x97'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x98'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x99'));_0x3efa96['field']('i.closedAt');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9a'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9b'));_0x3efa96[_0xbb10('0x3e')]('i.lastMsgDirection');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9c'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9d'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9e'));_0x3efa96['field'](_0xbb10('0x9f'));_0x3efa96[_0xbb10('0x3e')]('i.substatus');_0x3efa96[_0xbb10('0x3e')]('i.to');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa0'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa1'));_0x3efa96[_0xbb10('0x3e')]('i.UserId');_0x3efa96[_0xbb10('0x3e')]('c.firstName',_0xbb10('0xa2'));_0x3efa96[_0xbb10('0x3e')]('c.lastName','Contact.lastName');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa3'),_0xbb10('0xa4'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa5'),_0xbb10('0xa6'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa7'),_0xbb10('0xa8'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa9'),'Contact.fax');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xaa'),_0xbb10('0xab'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xac'),_0xbb10('0xad'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xae'),_0xbb10('0x24'));}if(_0x3c8d7d[_0xbb10('0x18')])_0x3efa96[_0xbb10('0x18')](_0x3c8d7d[_0xbb10('0x18')]);if(_0x3c8d7d['offset'])_0x3efa96[_0xbb10('0x16')](_0x3c8d7d['offset']);return db[_0xbb10('0x90')][_0xbb10('0x34')](_0x3efa96[_0xbb10('0x8f')](),_0x122d38);})[_0xbb10('0x1e')](function(_0x38d369){if(_0x38d369['length']>0x0)_0x180933[_0xbb10('0x3d')](_0xbb10('0xaf'),_[_0xbb10('0x30')](_0x38d369,'id'));return db[_0xbb10('0x90')][_0xbb10('0x34')](_0x180933[_0xbb10('0x8f')](),_0x122d38)['then'](function(_0x4bd470){var _0x5cc9d7=_[_0xbb10('0xb0')](_0x4bd470,_0xbb10('0xb1'));var _0x57d5a1=[];return db[_0xbb10('0xb2')][_0xbb10('0xb3')]({'attributes':['enableEmailPreview'],'raw':!![]})[_0xbb10('0x1e')](function(_0xaede56){var _0x5642c3=_0xaede56[_0xbb10('0xb4')];_0x38d369['forEach'](function(_0x34cec7){_0x57d5a1[_0xbb10('0x28')](updateMailInteraction(_0x34cec7,_0x23dc18,_0x5cc9d7,_0x5642c3));});return BPromise['all'](_0x57d5a1);});});});})[_0xbb10('0x1e')](function(_0x28cc74){_0x2b5352['rows']=_0x28cc74;return _0x2b5352;})['then'](respondWithFilteredResult(_0x10202c,_0x3c8d7d))[_0xbb10('0x2e')](handleError(_0x10202c,null));};exports[_0xbb10('0xb5')]=function(_0x3e0e34,_0x3299bc){var _0x3ceb77={'raw':![],'where':{'id':_0x3e0e34[_0xbb10('0xb6')]['id']}},_0x4c3bdc={};_0x4c3bdc[_0xbb10('0x33')]=_[_0xbb10('0x35')](db['MailInteraction'][_0xbb10('0xb7')]);_0x4c3bdc[_0xbb10('0x34')]=_[_0xbb10('0x35')](_0x3e0e34[_0xbb10('0x34')]);_0x4c3bdc[_0xbb10('0x36')]=_[_0xbb10('0x37')](_0x4c3bdc[_0xbb10('0x33')],_0x4c3bdc[_0xbb10('0x34')]);_0x3ceb77[_0xbb10('0x39')]=_['intersection'](_0x4c3bdc['model'],qs[_0xbb10('0x38')](_0x3e0e34[_0xbb10('0x34')][_0xbb10('0x38')]));_0x3ceb77[_0xbb10('0x39')]=_0x3ceb77[_0xbb10('0x39')][_0xbb10('0x55')]?_0x3ceb77[_0xbb10('0x39')]:_0x4c3bdc[_0xbb10('0x33')];if(_0x3e0e34[_0xbb10('0x34')][_0xbb10('0xb8')]){_0x3ceb77[_0xbb10('0xb9')]=[{'all':!![]}];}_0x3ceb77=_[_0xbb10('0xba')]({},_0x3ceb77,_0x3e0e34[_0xbb10('0xbb')]);return db['MailInteraction'][_0xbb10('0x56')](_0x3ceb77)[_0xbb10('0x1e')](handleEntityNotFound(_0x3299bc,null))[_0xbb10('0x1e')](respondWithResult(_0x3299bc,null))[_0xbb10('0x2e')](handleError(_0x3299bc,null));};exports[_0xbb10('0xbc')]=function(_0xd9284e,_0x4258fc){return db[_0xbb10('0x31')][_0xbb10('0xbc')](_0xd9284e[_0xbb10('0xbd')],{})[_0xbb10('0x1e')](respondWithResult(_0x4258fc,0xc9))['catch'](handleError(_0x4258fc,null));};exports[_0xbb10('0x1c')]=function(_0x5e1ac5,_0x3faaca){if(_0x5e1ac5[_0xbb10('0xbd')]['id']){delete _0x5e1ac5[_0xbb10('0xbd')]['id'];}return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x5e1ac5[_0xbb10('0xb6')]['id']}})['then'](handleEntityNotFound(_0x3faaca,null))[_0xbb10('0x1e')](saveUpdates(_0x5e1ac5['body'],null))[_0xbb10('0x1e')](respondWithResult(_0x3faaca,null))[_0xbb10('0x2e')](handleError(_0x3faaca,null));};exports[_0xbb10('0x1d')]=function(_0x576bb6,_0x2b652c){return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x576bb6[_0xbb10('0xb6')]['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x2b652c,null))[_0xbb10('0x1e')](removeEntity(_0x2b652c,null))[_0xbb10('0x2e')](handleError(_0x2b652c,null));};exports[_0xbb10('0xbe')]=function(_0x589565,_0x3696b3){return db['MailInteraction'][_0xbb10('0xbe')]()[_0xbb10('0x1e')](respondWithResult(_0x3696b3,null))[_0xbb10('0x2e')](handleError(_0x3696b3,null));};exports[_0xbb10('0xbf')]=function(_0x44c229,_0x40271f){return db[_0xbb10('0x29')]['find']({'where':{'id':_0x44c229[_0xbb10('0xb6')]['id']}})['then'](handleEntityNotFound(_0x40271f,null))['then'](function(_0x1513e0){if(_0x1513e0){return _0x1513e0[_0xbb10('0xbf')](_0x44c229[_0xbb10('0xbd')][_0xbb10('0xc0')],_[_0xbb10('0xc1')](_0x44c229[_0xbb10('0xbd')],['ids','id'])||{});}})[_0xbb10('0x1e')](respondWithResult(_0x40271f,null))[_0xbb10('0x2e')](handleError(_0x40271f,null));};exports[_0xbb10('0xc2')]=function(_0xb1b7c8,_0x136520){var _0x28127c={'raw':![],'where':{}};var _0x528aff={};var _0xdfdc42={'count':0x0,'rows':[]};return db[_0xbb10('0x31')][_0xbb10('0xb3')]({'where':{'id':_0xb1b7c8[_0xbb10('0xb6')]['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x136520,null))[_0xbb10('0x1e')](function(_0x2764e1){if(_0x2764e1){_0x528aff['model']=_[_0xbb10('0x35')](db['MailMessage'][_0xbb10('0xb7')]);_0x528aff['query']=_['keys'](_0xb1b7c8[_0xbb10('0x34')]);_0x528aff[_0xbb10('0x36')]=_[_0xbb10('0x37')](_0x528aff[_0xbb10('0x33')],_0x528aff[_0xbb10('0x34')]);_0x28127c['attributes']=_[_0xbb10('0x37')](_0x528aff['model'],qs['fields'](_0xb1b7c8['query'][_0xbb10('0x38')]));_0x28127c[_0xbb10('0x39')]=_0x28127c[_0xbb10('0x39')][_0xbb10('0x55')]?_0x28127c[_0xbb10('0x39')]:_0x528aff['model'];if(!_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0x3a')](_0xbb10('0xc3'))){_0x28127c[_0xbb10('0x18')]=qs[_0xbb10('0x18')](_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0x18')]);_0x28127c['offset']=qs['offset'](_0xb1b7c8['query'][_0xbb10('0x16')]);}_0x28127c[_0xbb10('0x3b')]=qs[_0xbb10('0x3c')](_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0x3c')]);_0x28127c[_0xbb10('0x3d')]=qs[_0xbb10('0x36')](_[_0xbb10('0xc4')](_0xb1b7c8[_0xbb10('0x34')],_0x528aff[_0xbb10('0x36')]));_0x28127c['where']['MailInteractionId']=_0x2764e1['id'];if(_0xb1b7c8['query'][_0xbb10('0x7c')]){_0x28127c[_0xbb10('0x3d')]=_[_0xbb10('0xba')](_0x28127c['where'],{'$or':_[_0xbb10('0x30')](_0x28127c[_0xbb10('0x39')],function(_0x2c638d){var _0x290280={};_0x290280[_0x2c638d]={'$like':'%'+_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0x7c')]+'%'};return _0x290280;})});}if(_0xb1b7c8['query']['$gte']){var _0x356660=_0xb1b7c8['query'][_0xbb10('0xc5')][_0xbb10('0x26')](',');var _0x152ca9={};_0x152ca9[_0x356660[0x0]]={'$gte':moment(_0x356660[0x1])[_0xbb10('0xc6')](_0xbb10('0xc7'))};_0x28127c[_0xbb10('0x3d')]=_[_0xbb10('0xba')](_0x28127c[_0xbb10('0x3d')],_0x152ca9);}_0x28127c=_[_0xbb10('0xba')]({},_0x28127c,_0xb1b7c8[_0xbb10('0xbb')]);return db['MailMessage'][_0xbb10('0x19')]({'where':_0x28127c['where']})[_0xbb10('0x1e')](function(_0x5547fa){_0xdfdc42[_0xbb10('0x19')]=_0x5547fa;if(_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0xb8')]){_0x28127c[_0xbb10('0xb9')]=[{'all':!![]}];}return db['MailMessage'][_0xbb10('0xc8')](_0x28127c);})['then'](function(_0xfe1154){if(_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0xc9')]==='true'){for(var _0x298167=0x0;_0x298167<_0xfe1154[_0xbb10('0x55')];_0x298167++){_0xfe1154[_0x298167][_0xbb10('0xbd')]=juice(_0xfe1154[_0x298167][_0xbb10('0xbd')]);}}_0xdfdc42[_0xbb10('0xca')]=_0xfe1154;return _0xdfdc42;});}})[_0xbb10('0x1e')](respondWithFilteredResult(_0x136520,_0x28127c))['catch'](handleError(_0x136520,null));};exports['addTags']=function(_0x522a88,_0x26a752){return db['MailInteraction'][_0xbb10('0x56')]({'where':{'id':_0x522a88['params']['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x26a752,null))[_0xbb10('0x1e')](function(_0x385ad3){if(_0x385ad3){return _0x385ad3['setTags'](_0x522a88['body'][_0xbb10('0xc0')],_[_0xbb10('0xc1')](_0x522a88[_0xbb10('0xbd')],['ids','id'])||{})[_0xbb10('0xcb')](function(){return db[_0xbb10('0x65')][_0xbb10('0xc8')]({'attributes':['id','name','color'],'where':{'id':_0x522a88['body'][_0xbb10('0xc0')]}});})['then'](function(_0x3dfbcd){socket[_0xbb10('0xcc')](_0xbb10('0xcd'),{'id':Number(_0x522a88[_0xbb10('0xb6')]['id']),'tags':_0x3dfbcd||[]});return{'id':Number(_0x522a88[_0xbb10('0xb6')]['id']),'tags':_0x3dfbcd||[]};});}})[_0xbb10('0x1e')](respondWithResult(_0x26a752,null))[_0xbb10('0x2e')](handleError(_0x26a752,null));};exports[_0xbb10('0xce')]=function(_0x2746eb,_0x431792){return db[_0xbb10('0x31')]['find']({'where':{'id':_0x2746eb[_0xbb10('0xb6')]['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x431792,null))['then'](function(_0x14ef50){if(_0x14ef50){return _0x14ef50['removeTags'](_0x2746eb['query'][_0xbb10('0xc0')]);}})[_0xbb10('0x1e')](respondWithStatusCode(_0x431792,null))[_0xbb10('0x2e')](handleError(_0x431792,null));};exports[_0xbb10('0xcf')]=function(_0x99c4,_0x4ca4ce){var _0x161171=moment()[_0xbb10('0xd0')]()['toString']();var _0xa45726=path[_0xbb10('0xd1')](config['root'],_0xbb10('0xd2'),'files',_0xbb10('0xd3'));var _0x8e8049=path[_0xbb10('0xd1')](config[_0xbb10('0xd4')],_0xbb10('0xd2'),_0xbb10('0xd5'),_0xbb10('0xd6'));var _0x56f902=path[_0xbb10('0xd1')](_0xa45726,_0x161171);var _0x4720a1=util[_0xbb10('0xc6')](_0xbb10('0xd7'),_0x99c4[_0xbb10('0xb6')]['id'],_0x161171);var _0x1301e3=path['join'](_0xa45726,_0x4720a1);var _0x550301=[];if(_0x99c4['query'][_0xbb10('0xd6')]){_0x550301[_0xbb10('0x28')]({'model':db[_0xbb10('0xd8')],'as':_0xbb10('0xd9'),'raw':!![]});}var _0x57700b=[{'model':db[_0xbb10('0x29')],'as':_0xbb10('0xda'),'attributes':['id',_0xbb10('0xbd'),'from','to','cc','bcc',_0xbb10('0xdb'),'createdAt'],'where':{'secret':![]},'order':qs[_0xbb10('0x3c')]('id'),'include':_0x550301}];return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x99c4[_0xbb10('0xb6')]['id']},'include':_0x57700b})[_0xbb10('0x1e')](handleEntityNotFound(_0x4ca4ce,null))[_0xbb10('0x1e')](function(_0x1fe250){if(_0x1fe250&&_0x1fe250['Messages']){var _0x424371=_0x1fe250[_0xbb10('0xdc')]({'plain':!![]});fs['mkdirSync'](_0x56f902);return BPromise[_0xbb10('0xdd')](_0x424371[_0xbb10('0xda')],function(_0x32f261,_0x5b11a2){var _0x4b490a={'from':_0x32f261['from'],'to':_0x32f261['to'],'subject':_0x32f261[_0xbb10('0xdb')],'html':_0x32f261[_0xbb10('0xbd')],'headers':{'Date':moment(_0x32f261['createdAt'])[_0xbb10('0xc6')](_0xbb10('0xde'))},'attachments':[]};if(_0x32f261['cc']){_0x4b490a[_0xbb10('0xdf')]['Cc']=_0x32f261['cc'];}if(_0x32f261[_0xbb10('0xe0')]){_0x4b490a[_0xbb10('0xdf')][_0xbb10('0xe1')]=_0x32f261[_0xbb10('0xe0')];}return new BPromise(function(_0x48f0eb,_0x304603){if(_0x32f261['Attachments']){for(var _0x5a7c4e=0x0;_0x5a7c4e<_0x32f261['Attachments'][_0xbb10('0x55')];_0x5a7c4e++){var _0x572d73=_0x32f261['Attachments'][_0x5a7c4e];var _0x1f09f1=path['join'](_0x8e8049,_0x572d73[_0xbb10('0xe2')]);if(fs[_0xbb10('0xe3')](_0x1f09f1)){_0x4b490a[_0xbb10('0xd6')]['push']({'name':_0x572d73['name'],'contentType':_0x572d73[_0xbb10('0x63')],'data':fs['readFileSync'](_0x1f09f1)});}}}emlformat[_0xbb10('0xe4')](_0x4b490a,function(_0x211172,_0x589ecb){if(_0x211172)return _0x304603(_0x211172);fs['writeFileSync'](path[_0xbb10('0xd1')](_0x56f902,util[_0xbb10('0xc6')](_0xbb10('0xe5'),_0x5b11a2)),_0x589ecb);return _0x48f0eb(_0x589ecb);});});})['then'](function(){return new BPromise(function(_0x4f4aa8,_0x426a4f){zipdir(_0x56f902,{'saveTo':_0x1301e3},function(_0x22f153,_0x4d47cc){if(_0x22f153)return _0x426a4f(_0x22f153);return _0x4f4aa8(_0x4d47cc);});})[_0xbb10('0x1e')](function(){return new BPromise(function(_0x203e5a,_0xe88e90){rimraf(_0x56f902,function(_0x4845b5){if(_0x4845b5)_0xe88e90(_0x4845b5);return _0x203e5a();});});})[_0xbb10('0x1e')](function(){return _0x4ca4ce[_0xbb10('0xcf')](_0x1301e3,_0x4720a1,function(_0x166f4f){if(!_0x166f4f)fs[_0xbb10('0xe6')](_0x1301e3);});});});}else{return _0x4ca4ce[_0xbb10('0x12')](0xc8);}})[_0xbb10('0x2e')](handleError(_0x4ca4ce,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 27197c7..c3e9869 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 _0x9dc5=['update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','exports','events','../../mysqldb','MailInteraction','MailMessage','save'];(function(_0x19b389,_0x4d9ae4){var _0x4a14db=function(_0xd68c58){while(--_0xd68c58){_0x19b389['push'](_0x19b389['shift']());}};_0x4a14db(++_0x4d9ae4);}(_0x9dc5,0x14f));var _0x59dc=function(_0x1f4147,_0x4e2059){_0x1f4147=_0x1f4147-0x0;var _0x29e403=_0x9dc5[_0x1f4147];return _0x29e403;};'use strict';var EventEmitter=require(_0x59dc('0x0'));var MailInteraction=require(_0x59dc('0x1'))['db'][_0x59dc('0x2')];var MailMessage=require('../../mysqldb')['db'][_0x59dc('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x59dc('0x4'),'afterUpdate':_0x59dc('0x5'),'afterDestroy':_0x59dc('0x6')};function emitEvent(_0x3bc5a6){return function(_0x212888,_0x425289,_0x2d2f75){_0x212888[_0x59dc('0x7')]({'attributes':['id'],'raw':!![]})[_0x59dc('0x8')](function(_0x422294){_0x212888[_0x59dc('0x9')](_0x59dc('0xa'),_0x422294[_0x59dc('0xb')](function(_0x19f8d5){return{'id':_0x19f8d5['id']};}));return MailMessage[_0x59dc('0xc')]({'where':{'MailInteractionId':_0x212888['id'],'direction':'in','read':![]},'raw':!![]});})[_0x59dc('0x8')](function(_0x160c10){_0x212888[_0x59dc('0x9')](_0x59dc('0xd'),_0x160c10[_0x59dc('0xe')]);MailInteractionEvents[_0x59dc('0xf')](_0x3bc5a6+':'+_0x212888['id'],_0x212888);MailInteractionEvents['emit'](_0x3bc5a6,_0x212888);_0x2d2f75(null);})['catch'](_0x2d2f75(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0x59dc('0x10')]=MailInteractionEvents; \ No newline at end of file +var _0x4331=['emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','MailMessage','setMaxListeners','save','remove','setDataValue','Users','map','findAll','then','unreadMessages','length'];(function(_0x2b711c,_0x231d9d){var _0x46bad2=function(_0x30b44e){while(--_0x30b44e){_0x2b711c['push'](_0x2b711c['shift']());}};_0x46bad2(++_0x231d9d);}(_0x4331,0xa7));var _0x1433=function(_0x4e90e3,_0x570a1d){_0x4e90e3=_0x4e90e3-0x0;var _0x295e5b=_0x4331[_0x4e90e3];return _0x295e5b;};'use strict';var EventEmitter=require(_0x1433('0x0'));var MailInteraction=require(_0x1433('0x1'))['db']['MailInteraction'];var MailMessage=require(_0x1433('0x1'))['db'][_0x1433('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x1433('0x3')](0x0);var events={'afterCreate':_0x1433('0x4'),'afterUpdate':'update','afterDestroy':_0x1433('0x5')};function emitEvent(_0x27610f){return function(_0x7536e2,_0x37c5a4,_0x4b92ff){_0x7536e2['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x274015){_0x7536e2[_0x1433('0x6')](_0x1433('0x7'),_0x274015[_0x1433('0x8')](function(_0x50aa6c){return{'id':_0x50aa6c['id']};}));return MailMessage[_0x1433('0x9')]({'where':{'MailInteractionId':_0x7536e2['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1433('0xa')](function(_0x2f1d23){_0x7536e2[_0x1433('0x6')](_0x1433('0xb'),_0x2f1d23[_0x1433('0xc')]);MailInteractionEvents['emit'](_0x27610f+':'+_0x7536e2['id'],_0x7536e2);MailInteractionEvents[_0x1433('0xd')](_0x27610f,_0x7536e2);_0x4b92ff(null);})[_0x1433('0xe')](_0x4b92ff(null));};}for(var e in events){if(events[_0x1433('0xf')](e)){var event=events[e];MailInteraction[_0x1433('0x10')](e,emitEvent(event));}}module[_0x1433('0x11')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 52d4ef1..99a7d48 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 _0x9341=['../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','MailInteraction','mail_interactions','subject','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','changed','closedAt','models','get','MailMessage','update','then','catch','lodash','util'];(function(_0x13556f,_0x35b410){var _0x43b023=function(_0x128496){while(--_0x128496){_0x13556f['push'](_0x13556f['shift']());}};_0x43b023(++_0x35b410);}(_0x9341,0x9a));var _0x1934=function(_0x506c35,_0xcb0f41){_0x506c35=_0x506c35-0x0;var _0x466e19=_0x9341[_0x506c35];return _0x466e19;};'use strict';var _=require(_0x1934('0x0'));var util=require(_0x1934('0x1'));var logger=require(_0x1934('0x2'))('api');var moment=require(_0x1934('0x3'));var BPromise=require('bluebird');var rp=require(_0x1934('0x4'));var fs=require('fs');var path=require(_0x1934('0x5'));var rimraf=require(_0x1934('0x6'));var config=require(_0x1934('0x7'));var attributes=require(_0x1934('0x8'));module[_0x1934('0x9')]=function(_0x213d96,_0x450a8a){return _0x213d96['define'](_0x1934('0xa'),attributes,{'tableName':_0x1934('0xb'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0x1934('0xc'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x126275,_0x1845a8,_0x432993){if(_0x126275[_0x1934('0xd')]){_0x126275[_0x1934('0xe')]=moment()[_0x1934('0xf')](_0x1934('0x10'));}if(_0x126275[_0x1934('0x11')]){_0x126275['closedAt']=moment()['format'](_0x1934('0x10'));}_0x432993(null,_0x1845a8);},'beforeUpdate':function(_0x4fb62c,_0x420d56,_0x3c53c8){if(_0x4fb62c['changed'](_0x1934('0xd'))){_0x4fb62c[_0x1934('0xe')]=_0x4fb62c[_0x1934('0xd')]?moment()[_0x1934('0xf')](_0x1934('0x10')):null;}if(_0x4fb62c[_0x1934('0x12')](_0x1934('0x11'))){_0x4fb62c[_0x1934('0x13')]=moment()[_0x1934('0xf')](_0x1934('0x10'));_0x4fb62c[_0x1934('0xd')]=null;_0x4fb62c[_0x1934('0xe')]=null;}_0x3c53c8(null,_0x4fb62c);},'afterUpdate':function(_0x289565,_0x3edeed,_0x549ffe){var _0x1f3fd4=_0x213d96[_0x1934('0x14')];var _0x3c0043=_0x289565[_0x1934('0x15')]({'plain':!![]});if(_0x3c0043['closed']){return _0x1f3fd4[_0x1934('0x16')][_0x1934('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x3c0043['id']}})[_0x1934('0x18')](function(){_0x549ffe();})[_0x1934('0x19')](function(_0x31afbe){_0x549ffe(_0x31afbe);});}else{_0x549ffe();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xacdf=['closed','closedAt','changed','get','MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x1f5092,_0xe91c4e){var _0xf86e84=function(_0x186a84){while(--_0x186a84){_0x1f5092['push'](_0x1f5092['shift']());}};_0xf86e84(++_0xe91c4e);}(_0xacdf,0x12c));var _0xfacd=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0xacdf[_0x12f688];return _0x59c3de;};'use strict';var _=require(_0xfacd('0x0'));var util=require(_0xfacd('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xfacd('0x2'));var BPromise=require(_0xfacd('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfacd('0x4'));var rimraf=require(_0xfacd('0x5'));var config=require(_0xfacd('0x6'));var attributes=require(_0xfacd('0x7'));module[_0xfacd('0x8')]=function(_0x412fd3,_0x23e27d){return _0x412fd3[_0xfacd('0x9')](_0xfacd('0xa'),attributes,{'tableName':_0xfacd('0xb'),'paranoid':![],'indexes':[{'name':_0xfacd('0xc'),'fields':[_0xfacd('0xd'),'to'],'type':_0xfacd('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2f8984,_0x3d3388,_0x5959ab){if(_0x2f8984[_0xfacd('0xf')]){_0x2f8984[_0xfacd('0x10')]=moment()[_0xfacd('0x11')](_0xfacd('0x12'));}if(_0x2f8984[_0xfacd('0x13')]){_0x2f8984[_0xfacd('0x14')]=moment()['format'](_0xfacd('0x12'));}_0x5959ab(null,_0x3d3388);},'beforeUpdate':function(_0x54c475,_0x7e42f,_0x332733){if(_0x54c475[_0xfacd('0x15')](_0xfacd('0xf'))){_0x54c475[_0xfacd('0x10')]=_0x54c475[_0xfacd('0xf')]?moment()[_0xfacd('0x11')](_0xfacd('0x12')):null;}if(_0x54c475['changed'](_0xfacd('0x13'))){_0x54c475[_0xfacd('0x14')]=moment()['format'](_0xfacd('0x12'));_0x54c475[_0xfacd('0xf')]=null;_0x54c475[_0xfacd('0x10')]=null;}_0x332733(null,_0x54c475);},'afterUpdate':function(_0x441da3,_0x48565e,_0x5cdb4d){var _0x3fde0e=_0x412fd3['models'];var _0x3fb50c=_0x441da3[_0xfacd('0x16')]({'plain':!![]});if(_0x3fb50c[_0xfacd('0x13')]){return _0x3fde0e[_0xfacd('0x17')][_0xfacd('0x18')]({'read':!![]},{'where':{'MailInteractionId':_0x3fb50c['id']}})[_0xfacd('0x19')](function(){_0x5cdb4d();})[_0xfacd('0x1a')](function(_0x4c741f){_0x5cdb4d(_0x4c741f);});}else{_0x5cdb4d();}}},'charset':_0xfacd('0x1b'),'collate':_0xfacd('0x1c')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 895a182..ec1a370 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 _0x8ba4=['redis','defaults','socket.io-emitter','./mailInteraction.socket','register','then','info','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','error','code','MailInteraction,\x20%s,\x20%s','message','catch','UpdateMailInteraction','MailInteraction','update','options','raw','where','attributes','stringify','AddTagsToMailInteraction','find','addTags','body','omit','ids','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x41e0a4,_0x5f837d){var _0x4ea78e=function(_0x5259e5){while(--_0x5259e5){_0x41e0a4['push'](_0x41e0a4['shift']());}};_0x4ea78e(++_0x5f837d);}(_0x8ba4,0x1ec));var _0x48ba=function(_0x581f8e,_0x5617cb){_0x581f8e=_0x581f8e-0x0;var _0x18aec=_0x8ba4[_0x581f8e];return _0x18aec;};'use strict';var _=require(_0x48ba('0x0'));var util=require(_0x48ba('0x1'));var moment=require(_0x48ba('0x2'));var BPromise=require('bluebird');var rs=require(_0x48ba('0x3'));var fs=require('fs');var Redis=require(_0x48ba('0x4'));var db=require(_0x48ba('0x5'))['db'];var utils=require(_0x48ba('0x6'));var logger=require(_0x48ba('0x7'))(_0x48ba('0x8'));var config=require('../../config/environment');var jayson=require(_0x48ba('0x9'));var client=jayson[_0x48ba('0xa')][_0x48ba('0xb')]({'port':0x232a});config[_0x48ba('0xc')]=_[_0x48ba('0xd')](config[_0x48ba('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x48ba('0xe'))(new Redis(config['redis']));require(_0x48ba('0xf'))[_0x48ba('0x10')](socket);function respondWithRpcPromise(_0x3548ac,_0x363c0c,_0xe4a448){return new BPromise(function(_0x3c0e4c,_0x26e1c2){return client['request'](_0x3548ac,_0xe4a448)[_0x48ba('0x11')](function(_0x4e36e0){logger[_0x48ba('0x12')]('MailInteraction,\x20%s,\x20%s',_0x363c0c,_0x48ba('0x13'));logger[_0x48ba('0x14')](_0x48ba('0x15'),_0x363c0c,_0x48ba('0x13'),JSON['stringify'](_0x4e36e0));if(_0x4e36e0[_0x48ba('0x16')]){if(_0x4e36e0[_0x48ba('0x16')][_0x48ba('0x17')]===0x1f4){logger[_0x48ba('0x16')](_0x48ba('0x18'),_0x363c0c,_0x4e36e0[_0x48ba('0x16')][_0x48ba('0x19')]);return _0x26e1c2(_0x4e36e0[_0x48ba('0x16')][_0x48ba('0x19')]);}logger[_0x48ba('0x16')](_0x48ba('0x18'),_0x363c0c,_0x4e36e0['error'][_0x48ba('0x19')]);return _0x3c0e4c(_0x4e36e0[_0x48ba('0x16')][_0x48ba('0x19')]);}else{logger[_0x48ba('0x12')](_0x48ba('0x18'),_0x363c0c,_0x48ba('0x13'));_0x3c0e4c(_0x4e36e0['result'][_0x48ba('0x19')]);}})[_0x48ba('0x1a')](function(_0x517125){logger[_0x48ba('0x16')](_0x48ba('0x18'),_0x363c0c,_0x517125);_0x26e1c2(_0x517125);});});}exports[_0x48ba('0x1b')]=function(_0x737fc7){var _0x1ed38a=this;return new Promise(function(_0x241c98,_0x396a8f){return db[_0x48ba('0x1c')][_0x48ba('0x1d')](_0x737fc7['body'],{'raw':_0x737fc7['options']?_0x737fc7[_0x48ba('0x1e')][_0x48ba('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x737fc7[_0x48ba('0x1e')]?_0x737fc7[_0x48ba('0x1e')][_0x48ba('0x20')]||null:null,'attributes':_0x737fc7[_0x48ba('0x1e')]?_0x737fc7[_0x48ba('0x1e')][_0x48ba('0x21')]||null:null,'limit':_0x737fc7[_0x48ba('0x1e')]?_0x737fc7[_0x48ba('0x1e')]['limit']||null:null})[_0x48ba('0x11')](function(_0x274dfe){logger[_0x48ba('0x12')](_0x48ba('0x1b'),_0x737fc7);logger['debug'](_0x48ba('0x1b'),_0x737fc7,JSON[_0x48ba('0x22')](_0x274dfe));_0x241c98(_0x274dfe);})[_0x48ba('0x1a')](function(_0x3e9e9b){logger[_0x48ba('0x16')](_0x48ba('0x1b'),_0x3e9e9b['message'],_0x737fc7);_0x396a8f(_0x1ed38a['error'](0x1f4,_0x3e9e9b[_0x48ba('0x19')]));});});};exports[_0x48ba('0x23')]=function(_0x46d274){return new Promise(function(_0x1a469a,_0x495e07){return db[_0x48ba('0x1c')][_0x48ba('0x24')]({'where':_0x46d274[_0x48ba('0x1e')]?_0x46d274[_0x48ba('0x1e')][_0x48ba('0x20')]||null:null})[_0x48ba('0x11')](function(_0x5c4426){if(_0x5c4426){return _0x5c4426[_0x48ba('0x25')](_0x46d274[_0x48ba('0x26')]['ids'],_[_0x48ba('0x27')](_0x46d274[_0x48ba('0x26')],[_0x48ba('0x28'),'id'])||{});}})['spread'](function(_0x460e52){logger[_0x48ba('0x12')](_0x48ba('0x29'),_0x46d274);logger[_0x48ba('0x14')](_0x48ba('0x29'),_0x46d274,JSON['stringify'](_0x460e52));_0x1a469a(_0x460e52);})[_0x48ba('0x1a')](function(_0x13c142){logger[_0x48ba('0x16')](_0x48ba('0x29'),_0x13c142[_0x48ba('0x19')],_0x46d274);_0x495e07(_this[_0x48ba('0x16')](0x1f4,_0x13c142[_0x48ba('0x19')]));});});}; \ No newline at end of file +var _0x4233=['defaults','redis','./mailInteraction.socket','register','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailInteraction','MailInteraction','update','options','raw','attributes','limit','then','find','where','addTags','body','omit','ids','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4233,0x199));var _0x3423=function(_0x4e8152,_0x3f6a39){_0x4e8152=_0x4e8152-0x0;var _0x285833=_0x4233[_0x4e8152];return _0x285833;};'use strict';var _=require('lodash');var util=require(_0x3423('0x0'));var moment=require(_0x3423('0x1'));var BPromise=require(_0x3423('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3423('0x3'));var db=require(_0x3423('0x4'))['db'];var utils=require(_0x3423('0x5'));var logger=require(_0x3423('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3423('0x7'));var client=jayson[_0x3423('0x8')]['http']({'port':0x232a});config['redis']=_[_0x3423('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3423('0xa')]));require(_0x3423('0xb'))[_0x3423('0xc')](socket);function respondWithRpcPromise(_0x38cb4d,_0x290b6d,_0x2050c){return new BPromise(function(_0x37cbb2,_0x566cc6){return client['request'](_0x38cb4d,_0x2050c)['then'](function(_0x3d3955){logger[_0x3423('0xd')](_0x3423('0xe'),_0x290b6d,_0x3423('0xf'));logger[_0x3423('0x10')](_0x3423('0x11'),_0x290b6d,_0x3423('0xf'),JSON[_0x3423('0x12')](_0x3d3955));if(_0x3d3955['error']){if(_0x3d3955[_0x3423('0x13')][_0x3423('0x14')]===0x1f4){logger[_0x3423('0x13')](_0x3423('0xe'),_0x290b6d,_0x3d3955[_0x3423('0x13')][_0x3423('0x15')]);return _0x566cc6(_0x3d3955[_0x3423('0x13')][_0x3423('0x15')]);}logger[_0x3423('0x13')](_0x3423('0xe'),_0x290b6d,_0x3d3955['error'][_0x3423('0x15')]);return _0x37cbb2(_0x3d3955[_0x3423('0x13')][_0x3423('0x15')]);}else{logger[_0x3423('0xd')](_0x3423('0xe'),_0x290b6d,'request\x20sent');_0x37cbb2(_0x3d3955[_0x3423('0x16')][_0x3423('0x15')]);}})[_0x3423('0x17')](function(_0x9b914a){logger[_0x3423('0x13')](_0x3423('0xe'),_0x290b6d,_0x9b914a);_0x566cc6(_0x9b914a);});});}exports[_0x3423('0x18')]=function(_0x2c7fc2){var _0x100325=this;return new Promise(function(_0x4738a5,_0x57b39a){return db[_0x3423('0x19')][_0x3423('0x1a')](_0x2c7fc2['body'],{'raw':_0x2c7fc2[_0x3423('0x1b')]?_0x2c7fc2[_0x3423('0x1b')][_0x3423('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c7fc2[_0x3423('0x1b')]?_0x2c7fc2[_0x3423('0x1b')]['where']||null:null,'attributes':_0x2c7fc2['options']?_0x2c7fc2[_0x3423('0x1b')][_0x3423('0x1d')]||null:null,'limit':_0x2c7fc2[_0x3423('0x1b')]?_0x2c7fc2[_0x3423('0x1b')][_0x3423('0x1e')]||null:null})[_0x3423('0x1f')](function(_0x4e7e41){logger[_0x3423('0xd')](_0x3423('0x18'),_0x2c7fc2);logger[_0x3423('0x10')]('UpdateMailInteraction',_0x2c7fc2,JSON[_0x3423('0x12')](_0x4e7e41));_0x4738a5(_0x4e7e41);})[_0x3423('0x17')](function(_0x1111cd){logger['error'](_0x3423('0x18'),_0x1111cd['message'],_0x2c7fc2);_0x57b39a(_0x100325['error'](0x1f4,_0x1111cd[_0x3423('0x15')]));});});};exports['AddTagsToMailInteraction']=function(_0x3d4dec){return new Promise(function(_0x2a9783,_0x1e1482){return db['MailInteraction'][_0x3423('0x20')]({'where':_0x3d4dec[_0x3423('0x1b')]?_0x3d4dec[_0x3423('0x1b')][_0x3423('0x21')]||null:null})['then'](function(_0x33ac9e){if(_0x33ac9e){return _0x33ac9e[_0x3423('0x22')](_0x3d4dec[_0x3423('0x23')]['ids'],_[_0x3423('0x24')](_0x3d4dec[_0x3423('0x23')],[_0x3423('0x25'),'id'])||{});}})['spread'](function(_0x26865b){logger[_0x3423('0xd')]('AddTags',_0x3d4dec);logger['debug']('AddTags',_0x3d4dec,JSON[_0x3423('0x12')](_0x26865b));_0x2a9783(_0x26865b);})['catch'](function(_0x45a9cc){logger['error']('AddTags',_0x45a9cc[_0x3423('0x15')],_0x3d4dec);_0x1e1482(_this[_0x3423('0x13')](0x1f4,_0x45a9cc[_0x3423('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index bb21317..60354a5 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 _0x5b27=['length','mailInteraction:','./mailInteraction.events','update','emit','removeListener','register'];(function(_0x1c8c2f,_0x1d99fe){var _0x24fa67=function(_0x15fd50){while(--_0x15fd50){_0x1c8c2f['push'](_0x1c8c2f['shift']());}};_0x24fa67(++_0x1d99fe);}(_0x5b27,0x1de));var _0x75b2=function(_0x51fac0,_0x3d310a){_0x51fac0=_0x51fac0-0x0;var _0x19d017=_0x5b27[_0x51fac0];return _0x19d017;};'use strict';var MailInteractionEvents=require(_0x75b2('0x0'));var events=['save','remove',_0x75b2('0x1')];function createListener(_0x5399ad,_0x107d71){return function(_0x45ac58){_0x107d71[_0x75b2('0x2')](_0x5399ad,_0x45ac58);};}function removeListener(_0x4cced2,_0x5dd1ff){return function(){MailInteractionEvents[_0x75b2('0x3')](_0x4cced2,_0x5dd1ff);};}exports[_0x75b2('0x4')]=function(_0x1f72df){for(var _0x54346c=0x0,_0x325b24=events[_0x75b2('0x5')];_0x54346c<_0x325b24;_0x54346c++){var _0x1eb892=events[_0x54346c];var _0xd11409=createListener(_0x75b2('0x6')+_0x1eb892,_0x1f72df);MailInteractionEvents['on'](_0x1eb892,_0xd11409);}}; \ No newline at end of file +var _0x5e8c=['emit','removeListener','register','length','mailInteraction:','remove','update'];(function(_0x3d11be,_0x1b9a8c){var _0x4b657b=function(_0x4a96f2){while(--_0x4a96f2){_0x3d11be['push'](_0x3d11be['shift']());}};_0x4b657b(++_0x1b9a8c);}(_0x5e8c,0x11d));var _0xc5e8=function(_0x3fc610,_0x390ef4){_0x3fc610=_0x3fc610-0x0;var _0xf31525=_0x5e8c[_0x3fc610];return _0xf31525;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=['save',_0xc5e8('0x0'),_0xc5e8('0x1')];function createListener(_0x440db4,_0x98b34f){return function(_0x3985de){_0x98b34f[_0xc5e8('0x2')](_0x440db4,_0x3985de);};}function removeListener(_0x3ccba1,_0x224c08){return function(){MailInteractionEvents[_0xc5e8('0x3')](_0x3ccba1,_0x224c08);};}exports[_0xc5e8('0x4')]=function(_0xb33f7){for(var _0x36fa8a=0x0,_0x51b482=events[_0xc5e8('0x5')];_0x36fa8a<_0x51b482;_0x36fa8a++){var _0x38ed5d=events[_0x36fa8a];var _0x5eb94d=createListener(_0xc5e8('0x6')+_0x38ed5d,_0xb33f7);MailInteractionEvents['on'](_0x38ed5d,_0x5eb94d);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index cb8285f..02da5dc 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 _0x2a41=['show','download','post','tracked','mail','mailmessage:create','create','put','update','/:id/accept','accept','/:id/reject','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','isAuthenticated','index','get','/:id'];(function(_0x17174c,_0x266797){var _0x38125a=function(_0x551221){while(--_0x551221){_0x17174c['push'](_0x17174c['shift']());}};_0x38125a(++_0x266797);}(_0x2a41,0x126));var _0x12a4=function(_0x2badfc,_0x21dec9){_0x2badfc=_0x2badfc-0x0;var _0x29f9cb=_0x2a41[_0x2badfc];return _0x29f9cb;};'use strict';var multer=require(_0x12a4('0x0'));var util=require('util');var path=require(_0x12a4('0x1'));var timeout=require(_0x12a4('0x2'));var express=require(_0x12a4('0x3'));var router=express[_0x12a4('0x4')]();var fs_extra=require(_0x12a4('0x5'));var auth=require(_0x12a4('0x6'));var interaction=require(_0x12a4('0x7'));var config=require(_0x12a4('0x8'));var controller=require(_0x12a4('0x9'));router['get']('/',auth[_0x12a4('0xa')](),controller[_0x12a4('0xb')]);router['get']('/describe',auth[_0x12a4('0xa')](),controller['describe']);router[_0x12a4('0xc')](_0x12a4('0xd'),auth[_0x12a4('0xa')](),controller[_0x12a4('0xe')]);router[_0x12a4('0xc')]('/:id/download',auth[_0x12a4('0xa')](),controller[_0x12a4('0xf')]);router[_0x12a4('0x10')]('/',auth[_0x12a4('0xa')](),interaction[_0x12a4('0x11')](_0x12a4('0x12'),_0x12a4('0x13')),controller[_0x12a4('0x14')]);router[_0x12a4('0x15')](_0x12a4('0xd'),auth[_0x12a4('0xa')](),controller[_0x12a4('0x16')]);router['put'](_0x12a4('0x17'),auth[_0x12a4('0xa')](),controller[_0x12a4('0x18')]);router[_0x12a4('0x15')](_0x12a4('0x19'),auth['isAuthenticated'](),controller['reject']);router[_0x12a4('0x1a')](_0x12a4('0xd'),auth[_0x12a4('0xa')](),controller[_0x12a4('0x1b')]);module['exports']=router; \ No newline at end of file +var _0xe0fd=['../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','post','tracked','mail','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3e5f89,_0x2c0c76){var _0x24dc56=function(_0x29b8bc){while(--_0x29b8bc){_0x3e5f89['push'](_0x3e5f89['shift']());}};_0x24dc56(++_0x2c0c76);}(_0xe0fd,0x1bb));var _0xde0f=function(_0x5b94da,_0x13e0de){_0x5b94da=_0x5b94da-0x0;var _0x27f164=_0xe0fd[_0x5b94da];return _0x27f164;};'use strict';var multer=require(_0xde0f('0x0'));var util=require(_0xde0f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xde0f('0x2'));var router=express[_0xde0f('0x3')]();var fs_extra=require(_0xde0f('0x4'));var auth=require(_0xde0f('0x5'));var interaction=require(_0xde0f('0x6'));var config=require(_0xde0f('0x7'));var controller=require(_0xde0f('0x8'));router[_0xde0f('0x9')]('/',auth[_0xde0f('0xa')](),controller[_0xde0f('0xb')]);router[_0xde0f('0x9')](_0xde0f('0xc'),auth['isAuthenticated'](),controller[_0xde0f('0xd')]);router[_0xde0f('0x9')](_0xde0f('0xe'),auth['isAuthenticated'](),controller[_0xde0f('0xf')]);router[_0xde0f('0x9')](_0xde0f('0x10'),auth['isAuthenticated'](),controller['download']);router[_0xde0f('0x11')]('/',auth[_0xde0f('0xa')](),interaction[_0xde0f('0x12')](_0xde0f('0x13'),'mailmessage:create'),controller[_0xde0f('0x14')]);router[_0xde0f('0x15')](_0xde0f('0xe'),auth['isAuthenticated'](),controller[_0xde0f('0x16')]);router[_0xde0f('0x15')](_0xde0f('0x17'),auth['isAuthenticated'](),controller[_0xde0f('0x18')]);router[_0xde0f('0x15')](_0xde0f('0x19'),auth[_0xde0f('0xa')](),controller[_0xde0f('0x1a')]);router[_0xde0f('0x1b')](_0xde0f('0xe'),auth[_0xde0f('0xa')](),controller[_0xde0f('0x1c')]);module[_0xde0f('0x1d')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 0f70345..fa34549 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 _0x91c7=['exports','TEXT','long','BOOLEAN','ENUM','out','STRING','DATE','Chat','Email','sequelize'];(function(_0x5dea4d,_0x1df403){var _0x309e3a=function(_0x25ef8a){while(--_0x25ef8a){_0x5dea4d['push'](_0x5dea4d['shift']());}};_0x309e3a(++_0x1df403);}(_0x91c7,0xdb));var _0x791c=function(_0x2a8255,_0x2ab6cb){_0x2a8255=_0x2a8255-0x0;var _0x20d7a5=_0x91c7[_0x2a8255];return _0x20d7a5;};'use strict';var Sequelize=require(_0x791c('0x0'));var _=require('lodash');module[_0x791c('0x1')]={'body':{'type':Sequelize[_0x791c('0x2')](_0x791c('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x791c('0x2')]('medium')},'read':{'type':Sequelize[_0x791c('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x791c('0x5')]('in',_0x791c('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x791c('0x7')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x791c('0x2')](_0x791c('0x3'))},'cc':{'type':Sequelize[_0x791c('0x2')]('long')},'bcc':{'type':Sequelize[_0x791c('0x2')]('long')},'subject':{'type':Sequelize[_0x791c('0x2')]},'sentAt':{'type':Sequelize[_0x791c('0x8')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0x791c('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x791c('0x2')](_0x791c('0x3'))},'originCc':{'type':Sequelize[_0x791c('0x2')]('long')},'originChannel':{'type':Sequelize[_0x791c('0x5')]('Email',_0x791c('0x9')),'defaultValue':_0x791c('0xa'),'allowNull':![]}}; \ No newline at end of file +var _0x76e9=['BOOLEAN','ENUM','out','STRING','long','INTEGER','DATE','Chat','sequelize','lodash','exports','TEXT','medium'];(function(_0x2c185d,_0xf2278f){var _0x50767a=function(_0x2e1aef){while(--_0x2e1aef){_0x2c185d['push'](_0x2c185d['shift']());}};_0x50767a(++_0xf2278f);}(_0x76e9,0x140));var _0x976e=function(_0x1100f1,_0x27badc){_0x1100f1=_0x1100f1-0x0;var _0x4e6f8e=_0x76e9[_0x1100f1];return _0x4e6f8e;};'use strict';var Sequelize=require(_0x976e('0x0'));var _=require(_0x976e('0x1'));module[_0x976e('0x2')]={'body':{'type':Sequelize[_0x976e('0x3')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0x976e('0x3')](_0x976e('0x4'))},'read':{'type':Sequelize[_0x976e('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x976e('0x6')]('in',_0x976e('0x7')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x976e('0x8')](0x1fe)},'from':{'type':Sequelize[_0x976e('0x8')]},'to':{'type':Sequelize[_0x976e('0x3')](_0x976e('0x9'))},'cc':{'type':Sequelize[_0x976e('0x3')](_0x976e('0x9'))},'bcc':{'type':Sequelize[_0x976e('0x3')](_0x976e('0x9'))},'subject':{'type':Sequelize[_0x976e('0x3')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0x976e('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x976e('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x976e('0xb')]},'originTo':{'type':Sequelize['TEXT']('long')},'originCc':{'type':Sequelize[_0x976e('0x3')](_0x976e('0x9'))},'originChannel':{'type':Sequelize[_0x976e('0x6')]('Email',_0x976e('0xc')),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 28ecea5..5e9a072 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 _0x008c=['pass','attachments','join','root','server/files/attachments','basename','ListId','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','stringify','accept','mail','read','UserId','agent','get','MailInteraction','update','read1stAt','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','SELECT','contact','email','manual','channel','event','fromString','EventManager','acceptmessage','reject','MailInteractionId','interaction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','ContactId','sequelize','fullname','interface','SIP/%s','rejectmessage','download','unix','toString','tmp','server','files','from','bcc','subject','createdAt','Attachment','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','Bcc','existsSync','push','readFileSync','build','writeFileSync','eml-format','moment','bluebird','util','path','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','defaults','localhost','./mailMessage.socket','register','client','http','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','status','json','offset','undefined','limit','count','sendStatus','stack','name','send','index','map','MailMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','include','findAll','rows','catch','show','params','includeAll','options','find','body','destroy','describe','create','direction','out','secret','MailAccount','findOne','MailAccountId','List','CmContact','Contacts','DESC','MailServerOut','Smtp','isNil','service','host','secure','authentication','auth','user'];(function(_0x68c432,_0x3f3a3e){var _0x6515fe=function(_0x464c60){while(--_0x464c60){_0x68c432['push'](_0x68c432['shift']());}};_0x6515fe(++_0x3f3a3e);}(_0x008c,0x188));var _0xc008=function(_0x42ee1e,_0x3f1a64){_0x42ee1e=_0x42ee1e-0x0;var _0x1e21b8=_0x008c[_0x42ee1e];return _0x1e21b8;};'use strict';var emlformat=require(_0xc008('0x0'));var moment=require(_0xc008('0x1'));var BPromise=require(_0xc008('0x2'));var util=require(_0xc008('0x3'));var path=require(_0xc008('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xc008('0x5'));var htmlToText=require(_0xc008('0x6'));var qs=require(_0xc008('0x7'));var logger=require(_0xc008('0x8'))(_0xc008('0x9'));var interaction_log=require(_0xc008('0x8'))(_0xc008('0xa'));var config=require(_0xc008('0xb'));var db=require(_0xc008('0xc'))['db'];config['redis']=_[_0xc008('0xd')](config['redis'],{'host':_0xc008('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc008('0xf'))[_0xc008('0x10')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9003=jayson[_0xc008('0x11')][_0xc008('0x12')]({'port':0x232b});var client9002=jayson['client'][_0xc008('0x12')]({'port':0x232a});function respondWithRpcPromise(_0x332fd4,_0x2ea200,_0x2a5b4e,_0x9ffa93){return new BPromise(function(_0x1819c6,_0x69726e){var _0x593f7a=_0x9ffa93||client;return _0x593f7a['request'](_0x332fd4,_0x2a5b4e)[_0xc008('0x13')](function(_0x50c1ab){logger[_0xc008('0x14')](_0xc008('0x15'),_0x2ea200,_0xc008('0x16'));logger[_0xc008('0x17')](_0xc008('0x18'),_0x2ea200,'request\x20sent',JSON['stringify'](_0x50c1ab));if(_0x50c1ab['error']){if(_0x50c1ab[_0xc008('0x19')][_0xc008('0x1a')]===0x1f4){logger[_0xc008('0x19')](_0xc008('0x15'),_0x2ea200,_0x50c1ab['error']['message']);return _0x69726e(_0x50c1ab['error']['message']);}logger[_0xc008('0x19')](_0xc008('0x15'),_0x2ea200,_0x50c1ab['error'][_0xc008('0x1b')]);return _0x1819c6(_0x50c1ab['error']['message']);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x2ea200,_0xc008('0x16'));_0x1819c6(_0x50c1ab['result']['message']);}})['catch'](function(_0x4a582d){logger['error'](_0xc008('0x15'),_0x2ea200,_0x4a582d);_0x69726e(_0x4a582d);});});}function respondWithResult(_0x4777a6,_0x251db2){_0x251db2=_0x251db2||0xc8;return function(_0x415af3){if(_0x415af3){return _0x4777a6[_0xc008('0x1c')](_0x251db2)[_0xc008('0x1d')](_0x415af3);}};}function respondWithFilteredResult(_0x4f43e2,_0x459fd9){return function(_0x5c85f2){if(_0x5c85f2){var _0x58a6ea=typeof _0x459fd9[_0xc008('0x1e')]===_0xc008('0x1f')&&typeof _0x459fd9[_0xc008('0x20')]===_0xc008('0x1f');var _0x5410f5=_0x5c85f2['count'];var _0x5de1e9=_0x58a6ea?0x0:_0x459fd9[_0xc008('0x1e')];var _0x15dade=_0x58a6ea?_0x5c85f2[_0xc008('0x21')]:_0x459fd9[_0xc008('0x1e')]+_0x459fd9['limit'];var _0x5e2aca;if(_0x15dade>=_0x5410f5){_0x15dade=_0x5410f5;_0x5e2aca=0xc8;}else{_0x5e2aca=0xce;}_0x4f43e2['status'](_0x5e2aca);return _0x4f43e2['set']('Content-Range',_0x5de1e9+'-'+_0x15dade+'/'+_0x5410f5)[_0xc008('0x1d')](_0x5c85f2);}return null;};}function saveUpdates(_0x29ba43){return function(_0x25eae4){if(_0x25eae4){return _0x25eae4['update'](_0x29ba43)[_0xc008('0x13')](function(_0x32390d){return _0x32390d;});}return null;};}function removeEntity(_0x209591){return function(_0x2a7d4f){if(_0x2a7d4f){return _0x2a7d4f['destroy']()[_0xc008('0x13')](function(){_0x209591[_0xc008('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58db82){return function(_0x539766){if(!_0x539766){_0x58db82[_0xc008('0x22')](0x194);}return _0x539766;};}function handleError(_0x267abd,_0xf831f2){_0xf831f2=_0xf831f2||0x1f4;return function(_0x10889f){logger[_0xc008('0x19')](_0x10889f[_0xc008('0x23')]);if(_0x10889f[_0xc008('0x24')]){delete _0x10889f[_0xc008('0x24')];}_0x267abd[_0xc008('0x1c')](_0xf831f2)[_0xc008('0x25')](_0x10889f);};}exports[_0xc008('0x26')]=function(_0x1ac7c8,_0x596ee8){var _0x334a09={},_0x4b7fd4={},_0x499754={'count':0x0,'rows':[]};var _0xaf4b84=_[_0xc008('0x27')](db[_0xc008('0x28')][_0xc008('0x29')],function(_0xd0e05a){return{'name':_0xd0e05a[_0xc008('0x2a')],'type':_0xd0e05a[_0xc008('0x2b')][_0xc008('0x2c')]};});_0x4b7fd4[_0xc008('0x2d')]=_['map'](_0xaf4b84,_0xc008('0x24'));_0x4b7fd4[_0xc008('0x2e')]=_[_0xc008('0x2f')](_0x1ac7c8[_0xc008('0x2e')]);_0x4b7fd4[_0xc008('0x30')]=_[_0xc008('0x31')](_0x4b7fd4[_0xc008('0x2d')],_0x4b7fd4['query']);_0x334a09[_0xc008('0x32')]=_[_0xc008('0x31')](_0x4b7fd4['model'],qs[_0xc008('0x33')](_0x1ac7c8[_0xc008('0x2e')]['fields']));_0x334a09[_0xc008('0x32')]=_0x334a09[_0xc008('0x32')][_0xc008('0x34')]?_0x334a09['attributes']:_0x4b7fd4['model'];if(!_0x1ac7c8['query'][_0xc008('0x35')]('nolimit')){_0x334a09[_0xc008('0x20')]=qs[_0xc008('0x20')](_0x1ac7c8[_0xc008('0x2e')][_0xc008('0x20')]);_0x334a09[_0xc008('0x1e')]=qs[_0xc008('0x1e')](_0x1ac7c8[_0xc008('0x2e')][_0xc008('0x1e')]);}_0x334a09[_0xc008('0x36')]=qs[_0xc008('0x37')](_0x1ac7c8[_0xc008('0x2e')][_0xc008('0x37')]);_0x334a09[_0xc008('0x38')]=qs[_0xc008('0x30')](_['pick'](_0x1ac7c8[_0xc008('0x2e')],_0x4b7fd4[_0xc008('0x30')]),_0xaf4b84);if(_0x1ac7c8[_0xc008('0x2e')][_0xc008('0x39')]){_0x334a09['where']=_[_0xc008('0x3a')](_0x334a09[_0xc008('0x38')],{'$or':_[_0xc008('0x27')](_0xaf4b84,function(_0x36e7ae){if(_0x36e7ae[_0xc008('0x2b')]!=='VIRTUAL'){var _0x398cdd={};_0x398cdd[_0x36e7ae[_0xc008('0x24')]]={'$like':'%'+_0x1ac7c8[_0xc008('0x2e')][_0xc008('0x39')]+'%'};return _0x398cdd;}})});}_0x334a09=_[_0xc008('0x3a')]({},_0x334a09,_0x1ac7c8['options']);var _0xf4cc4b={'where':_0x334a09[_0xc008('0x38')]};return db[_0xc008('0x28')][_0xc008('0x21')](_0xf4cc4b)['then'](function(_0x26cd05){_0x499754[_0xc008('0x21')]=_0x26cd05;if(_0x1ac7c8[_0xc008('0x2e')]['includeAll']){_0x334a09[_0xc008('0x3b')]=[{'all':!![]}];}return db['MailMessage'][_0xc008('0x3c')](_0x334a09);})['then'](function(_0x46fa8f){_0x499754[_0xc008('0x3d')]=_0x46fa8f;return _0x499754;})['then'](respondWithFilteredResult(_0x596ee8,_0x334a09))[_0xc008('0x3e')](handleError(_0x596ee8,null));};exports[_0xc008('0x3f')]=function(_0x6d6d4c,_0x5caaa2){var _0x1cec64={'raw':!![],'where':{'id':_0x6d6d4c[_0xc008('0x40')]['id']}},_0x2a9b5c={};_0x2a9b5c[_0xc008('0x2d')]=_[_0xc008('0x2f')](db[_0xc008('0x28')]['rawAttributes']);_0x2a9b5c['query']=_['keys'](_0x6d6d4c[_0xc008('0x2e')]);_0x2a9b5c[_0xc008('0x30')]=_[_0xc008('0x31')](_0x2a9b5c[_0xc008('0x2d')],_0x2a9b5c[_0xc008('0x2e')]);_0x1cec64[_0xc008('0x32')]=_[_0xc008('0x31')](_0x2a9b5c[_0xc008('0x2d')],qs['fields'](_0x6d6d4c['query']['fields']));_0x1cec64[_0xc008('0x32')]=_0x1cec64[_0xc008('0x32')][_0xc008('0x34')]?_0x1cec64['attributes']:_0x2a9b5c[_0xc008('0x2d')];if(_0x6d6d4c[_0xc008('0x2e')][_0xc008('0x41')]){_0x1cec64[_0xc008('0x3b')]=[{'all':!![]}];}_0x1cec64=_[_0xc008('0x3a')]({},_0x1cec64,_0x6d6d4c[_0xc008('0x42')]);return db[_0xc008('0x28')][_0xc008('0x43')](_0x1cec64)[_0xc008('0x13')](handleEntityNotFound(_0x5caaa2,null))[_0xc008('0x13')](respondWithResult(_0x5caaa2,null))['catch'](handleError(_0x5caaa2,null));};exports['update']=function(_0x223056,_0x51cb14){if(_0x223056[_0xc008('0x44')]['id']){delete _0x223056[_0xc008('0x44')]['id'];}return db[_0xc008('0x28')]['find']({'where':{'id':_0x223056[_0xc008('0x40')]['id']}})[_0xc008('0x13')](handleEntityNotFound(_0x51cb14,null))[_0xc008('0x13')](saveUpdates(_0x223056[_0xc008('0x44')],null))[_0xc008('0x13')](respondWithResult(_0x51cb14,null))['catch'](handleError(_0x51cb14,null));};exports[_0xc008('0x45')]=function(_0x27b022,_0x4b4c6d){return db[_0xc008('0x28')][_0xc008('0x43')]({'where':{'id':_0x27b022['params']['id']}})['then'](handleEntityNotFound(_0x4b4c6d,null))[_0xc008('0x13')](removeEntity(_0x4b4c6d,null))[_0xc008('0x3e')](handleError(_0x4b4c6d,null));};exports[_0xc008('0x46')]=function(_0x30d0aa,_0x14b6a0){return db['MailMessage']['describe']()[_0xc008('0x13')](respondWithResult(_0x14b6a0,null))['catch'](handleError(_0x14b6a0,null));};exports[_0xc008('0x47')]=function(_0x25d351,_0xf94fcb){return db[_0xc008('0x28')][_0xc008('0x47')](_0x25d351[_0xc008('0x44')])['then'](function(_0x2ea742){if(_0x2ea742){if(_0x2ea742[_0xc008('0x48')]===_0xc008('0x49')&&!_0x2ea742[_0xc008('0x4a')]){var _0x4424f5,_0x5aa385,_0x41fae3;if(_0x25d351['body']['to']){_0x5aa385=_0x25d351['body']['to']['split'](',')[0x0];}return db[_0xc008('0x4b')][_0xc008('0x4c')]({'where':{'id':_0x2ea742[_0xc008('0x4d')]},'include':[{'model':db['CmList'],'as':_0xc008('0x4e'),'include':[{'model':db[_0xc008('0x4f')],'as':_0xc008('0x50'),'where':{'email':_0x5aa385},'limit':0x1,'order':[['updatedAt',_0xc008('0x51')]]}]},{'model':db[_0xc008('0x52')],'as':_0xc008('0x53'),'raw':!![]}]})[_0xc008('0x13')](function(_0x5baff1){_0x4424f5=_0x5baff1;if(_0x4424f5&&_0x4424f5[_0xc008('0x53')]){var _0x4eaa6d={'tls':{'rejectUnauthorized':![]}};if(_[_0xc008('0x54')](_0x4424f5[_0xc008('0x53')][_0xc008('0x55')])){_0x4eaa6d[_0xc008('0x56')]=_0x4424f5[_0xc008('0x53')][_0xc008('0x56')];_0x4eaa6d['port']=_0x4424f5[_0xc008('0x53')]['port'];_0x4eaa6d['secure']=_0x4424f5[_0xc008('0x53')][_0xc008('0x57')];if(_0x4424f5['Smtp'][_0xc008('0x58')]){_0x4eaa6d[_0xc008('0x59')]={'user':_0x4424f5[_0xc008('0x53')][_0xc008('0x5a')],'pass':_0x4424f5[_0xc008('0x53')][_0xc008('0x5b')]};}}else{_0x4eaa6d[_0xc008('0x55')]=_0x4424f5['Smtp'][_0xc008('0x55')];_0x4eaa6d[_0xc008('0x59')]={'user':_0x4424f5[_0xc008('0x53')][_0xc008('0x5a')],'pass':_0x4424f5[_0xc008('0x53')][_0xc008('0x5b')]};_0x4eaa6d[_0xc008('0x57')]=_0x4424f5[_0xc008('0x53')][_0xc008('0x57')];}if(_0x25d351[_0xc008('0x44')][_0xc008('0x5c')]&&_0x25d351[_0xc008('0x44')][_0xc008('0x5c')][_0xc008('0x34')]){for(var _0x4e0251=0x0;_0x4e0251<_0x25d351[_0xc008('0x44')][_0xc008('0x5c')][_0xc008('0x34')];_0x4e0251+=0x1){_0x25d351['body'][_0xc008('0x5c')][_0x4e0251]={'filename':_0x25d351[_0xc008('0x44')]['attachments'][_0x4e0251]['name'],'path':path[_0xc008('0x5d')](config[_0xc008('0x5e')],_0xc008('0x5f'),_0x25d351[_0xc008('0x44')][_0xc008('0x5c')][_0x4e0251][_0xc008('0x60')])};}}_0x41fae3={'account':_0x4eaa6d,'message':_0x25d351[_0xc008('0x44')]};return;}})[_0xc008('0x13')](function(){if(_0x4424f5[_0xc008('0x4e')]){if(_0x4424f5[_0xc008('0x4e')][_0xc008('0x50')]['length']){return _0x4424f5[_0xc008('0x4e')][_0xc008('0x50')][0x0];}else{return db[_0xc008('0x4f')][_0xc008('0x47')](_['defaults'](_0x25d351[_0xc008('0x44')],{'firstName':_0x25d351['body']['to'],'email':_0x25d351[_0xc008('0x44')]['to'],'phone':_0x25d351[_0xc008('0x44')]['to'],'ListId':_0x4424f5[_0xc008('0x61')]}));}}else{throw new Error('List\x20not\x20found');}})[_0xc008('0x13')](function(){if(_0x41fae3){return respondWithRpcPromise(_0xc008('0x62'),_0xc008('0x63'),_0x41fae3,client9003)['then'](function(_0x35b28a){return _0x2ea742['update']({'read':!![],'messageId':_0x35b28a[_0xc008('0x64')],'sentAt':moment()[_0xc008('0x65')](_0xc008('0x66'))});})[_0xc008('0x3e')](function(_0x295ec7){logger['error']('%s',JSON[_0xc008('0x67')](_0x295ec7));return _0x2ea742;});}return _0x2ea742;});}return _0x2ea742;}})[_0xc008('0x13')](respondWithResult(_0xf94fcb,0xc9))['catch'](handleError(_0xf94fcb,null));};exports[_0xc008('0x68')]=function(_0x5233bb,_0x278cbe){var _0x50bfe5={'agent':{},'channel':_0xc008('0x69')};if(_0x5233bb['body']['id']){delete _0x5233bb[_0xc008('0x44')]['id'];}_0x5233bb[_0xc008('0x44')][_0xc008('0x6a')]=!![];_0x5233bb[_0xc008('0x44')]['readAt']=moment()[_0xc008('0x65')](_0xc008('0x66'));_0x5233bb[_0xc008('0x44')][_0xc008('0x6b')]=_0x5233bb[_0xc008('0x44')][_0xc008('0x6b')]||_0x5233bb[_0xc008('0x5a')]['id'];_0x50bfe5[_0xc008('0x6c')]['id']=_0x5233bb['body'][_0xc008('0x6b')];return db['MailMessage']['find']({'where':{'id':_0x5233bb['params']['id'],'UserId':null}})[_0xc008('0x13')](handleEntityNotFound(_0x278cbe,null))[_0xc008('0x13')](saveUpdates(_0x5233bb[_0xc008('0x44')],null))[_0xc008('0x13')](function(_0xc2f684){if(_0xc2f684){_0x50bfe5[_0xc008('0x1b')]=_0xc2f684[_0xc008('0x6d')]({'plain':!![]});return db[_0xc008('0x6e')][_0xc008('0x43')]({'where':{'id':_0xc2f684['MailInteractionId']}});}return null;})[_0xc008('0x13')](handleEntityNotFound(_0x278cbe,null))[_0xc008('0x13')](function(_0x2b1b26){if(_0x2b1b26){return _0x2b1b26[_0xc008('0x6f')]({'UserId':_0x5233bb[_0xc008('0x44')][_0xc008('0x6b')],'read1stAt':_[_0xc008('0x54')](_0x2b1b26[_0xc008('0x70')])?moment()[_0xc008('0x65')](_0xc008('0x66')):undefined});}return null;})[_0xc008('0x13')](function(_0x1dd9fe){if(_0x1dd9fe){_0x50bfe5['interaction']=_0x1dd9fe['get']({'plain':!![]});interaction_log[_0xc008('0x14')](_0xc008('0x71'),_0x5233bb[_0xc008('0x5a')]['id'],_0x5233bb['user'][_0xc008('0x24')],_0x5233bb[_0xc008('0x5a')]['role'],_0x50bfe5['interaction']['id'],_0x5233bb['body']?JSON[_0xc008('0x67')](_0x5233bb[_0xc008('0x44')]):_0xc008('0x72'));return respondWithRpcPromise(_0xc008('0x73'),_0xc008('0x74'),_0x50bfe5);}return null;})[_0xc008('0x13')](function(_0x285c09){var _0x43ba59=_0xc008('0x75')+_0x285c09[_0xc008('0x1b')]['ContactId'];return db['sequelize'][_0xc008('0x2e')](_0x43ba59,{'type':db[_0xc008('0x76')][_0xc008('0x77')][_0xc008('0x78')],'raw':!![]})[_0xc008('0x13')](function(_0x37fc2c){return _0x37fc2c;});})['then'](function(_0x5794fe){if(_0x5794fe){_0x50bfe5[_0xc008('0x1b')][_0xc008('0x79')]=_0x5794fe[0x0];if(!_0x5233bb[_0xc008('0x44')]['UserId'])return;return db['User']['find']({'where':{'id':_0x5233bb['body']['UserId'],'role':'agent'},'attributes':['id',_0xc008('0x24'),'fullname',_0xc008('0x7a'),'internal'],'raw':!![]});}return null;})[_0xc008('0x13')](function(_0x41151e){if(!_0x41151e)return null;_0x50bfe5[_0xc008('0x1b')]['agent']=_0x41151e;return _0x50bfe5;})['then'](function(_0x2ff671){if(_0x2ff671){if(_0x5233bb['body'][_0xc008('0x7b')]){_0x50bfe5[_0xc008('0x1b')]['interface']=util[_0xc008('0x65')]('SIP/%s',_0x5233bb['user'][_0xc008('0x24')]);_0x50bfe5[_0xc008('0x1b')]['channel']=_0x50bfe5[_0xc008('0x7c')];_0x50bfe5[_0xc008('0x1b')][_0xc008('0x7d')]='accept';_0x50bfe5[_0xc008('0x1b')][_0xc008('0x44')]=htmlToText[_0xc008('0x7e')](_0x50bfe5[_0xc008('0x1b')][_0xc008('0x44')]);return respondWithRpcPromise(_0xc008('0x7f'),'EventManager',{'event':_0xc008('0x80'),'message':_0x50bfe5[_0xc008('0x1b')]},client9002)[_0xc008('0x13')](function(){return _0x50bfe5;});}return _0x50bfe5;}return null;})['then'](respondWithResult(_0x278cbe,null))[_0xc008('0x3e')](handleError(_0x278cbe,null));};exports[_0xc008('0x81')]=function(_0x4452a8,_0x4914ed){var _0x48c38b={'agent':{},'channel':'mail'};if(_0x4452a8[_0xc008('0x44')]['id']){delete _0x4452a8[_0xc008('0x44')]['id'];}_0x4452a8[_0xc008('0x44')][_0xc008('0x6b')]=_0x4452a8[_0xc008('0x44')][_0xc008('0x6b')]||_0x4452a8[_0xc008('0x5a')]['id'];_0x48c38b[_0xc008('0x6c')]['id']=_0x4452a8['body'][_0xc008('0x6b')];return db[_0xc008('0x28')]['find']({'where':{'id':_0x4452a8['params']['id'],'UserId':null}})[_0xc008('0x13')](handleEntityNotFound(_0x4914ed,null))[_0xc008('0x13')](function(_0x2be063){if(_0x2be063){_0x48c38b[_0xc008('0x1b')]=_0x2be063[_0xc008('0x6d')]({'plain':!![]});return db['MailInteraction'][_0xc008('0x43')]({'where':{'id':_0x2be063[_0xc008('0x82')]}});}return null;})['then'](handleEntityNotFound(_0x4914ed,null))[_0xc008('0x13')](function(_0x1cc68f){if(_0x1cc68f){_0x48c38b[_0xc008('0x83')]=_0x1cc68f[_0xc008('0x6d')]({'plain':!![]});interaction_log['info'](_0xc008('0x84'),_0x4452a8[_0xc008('0x5a')]['id'],_0x4452a8[_0xc008('0x5a')][_0xc008('0x24')],_0x4452a8['user'][_0xc008('0x85')],_0x48c38b[_0xc008('0x83')]['id'],_0x4452a8['body']?JSON['stringify'](_0x4452a8[_0xc008('0x44')]):'null');return respondWithRpcPromise(_0xc008('0x86'),_0xc008('0x87'),_0x48c38b);}return null;})['then'](function(_0x1b6858){var _0x201ffa=_0xc008('0x75')+_0x1b6858[_0xc008('0x1b')][_0xc008('0x88')];return db[_0xc008('0x89')][_0xc008('0x2e')](_0x201ffa,{'type':db[_0xc008('0x76')][_0xc008('0x77')][_0xc008('0x78')],'raw':!![]})['then'](function(_0x49e6d5){return _0x49e6d5;});})[_0xc008('0x13')](function(_0x3d6f70){if(_0x3d6f70){_0x48c38b['message'][_0xc008('0x79')]=_0x3d6f70[0x0];if(!_0x4452a8[_0xc008('0x44')][_0xc008('0x6b')])return;return db['User'][_0xc008('0x43')]({'where':{'id':_0x4452a8[_0xc008('0x44')][_0xc008('0x6b')],'role':_0xc008('0x6c')},'attributes':['id',_0xc008('0x24'),_0xc008('0x8a'),_0xc008('0x7a'),'internal'],'raw':!![]});}return null;})[_0xc008('0x13')](function(_0x49cd29){if(!_0x49cd29)return null;_0x48c38b[_0xc008('0x1b')][_0xc008('0x6c')]=_0x49cd29;return _0x48c38b;})[_0xc008('0x13')](function(_0x583077){if(_0x583077){_0x583077[_0xc008('0x1b')][_0xc008('0x8b')]=util[_0xc008('0x65')](_0xc008('0x8c'),_0x4452a8[_0xc008('0x5a')][_0xc008('0x24')]);_0x583077[_0xc008('0x1b')][_0xc008('0x7c')]=_0x48c38b[_0xc008('0x7c')];_0x583077[_0xc008('0x1b')]['event']=_0xc008('0x81');_0x583077[_0xc008('0x1b')][_0xc008('0x44')]=htmlToText[_0xc008('0x7e')](_0x48c38b[_0xc008('0x1b')]['body']);respondWithRpcPromise(_0xc008('0x7f'),_0xc008('0x7f'),{'event':_0xc008('0x8d'),'message':_0x583077[_0xc008('0x1b')]},client9002);return _0x48c38b;}return null;})[_0xc008('0x13')](respondWithResult(_0x4914ed,null))[_0xc008('0x3e')](handleError(_0x4914ed,null));};exports[_0xc008('0x8e')]=function(_0x220170,_0x2cc170){var _0x3e200b=moment()[_0xc008('0x8f')]()[_0xc008('0x90')]();var _0x2e2c2a=path[_0xc008('0x5d')](config[_0xc008('0x5e')],'server','files',_0xc008('0x91'));var _0x276ced=path[_0xc008('0x5d')](config[_0xc008('0x5e')],_0xc008('0x92'),_0xc008('0x93'),_0xc008('0x5c'));var _0x3eb3de=util[_0xc008('0x65')]('message-%s.eml',_0x3e200b);return db[_0xc008('0x28')][_0xc008('0x43')]({'where':{'id':_0x220170['params']['id']},'attributes':['id',_0xc008('0x44'),_0xc008('0x94'),'to','cc',_0xc008('0x95'),_0xc008('0x96'),_0xc008('0x97')],'include':_0x220170[_0xc008('0x2e')]['attachments']?[{'model':db[_0xc008('0x98')],'as':_0xc008('0x99')}]:undefined})[_0xc008('0x13')](handleEntityNotFound(_0x2cc170,null))[_0xc008('0x13')](function(_0x59e3d0){if(_0x59e3d0){var _0x13a0bd=_0x59e3d0;var _0x5d5d2f={'from':_0x13a0bd[_0xc008('0x94')],'to':_0x13a0bd['to'],'subject':_0x13a0bd[_0xc008('0x96')],'html':_0x13a0bd['body'],'headers':{'Date':moment(_0x13a0bd[_0xc008('0x97')])['format'](_0xc008('0x9a'))},'attachments':[]};if(_0x59e3d0['cc']){_0x5d5d2f['headers']['Cc']=_0x59e3d0['cc'];}if(_0x59e3d0['bcc']){_0x5d5d2f['headers'][_0xc008('0x9b')]=_0x59e3d0[_0xc008('0x95')];}return new BPromise(function(_0x48f40f,_0x4fda8){if(_0x59e3d0[_0xc008('0x99')]){for(var _0x4a7692=0x0;_0x4a7692<_0x59e3d0[_0xc008('0x99')][_0xc008('0x34')];_0x4a7692++){var _0x1564a9=_0x59e3d0['Attachments'][_0x4a7692];var _0x33cad3=path[_0xc008('0x5d')](_0x276ced,_0x1564a9[_0xc008('0x60')]);if(fs[_0xc008('0x9c')](_0x33cad3)){_0x5d5d2f[_0xc008('0x5c')][_0xc008('0x9d')]({'name':_0x1564a9[_0xc008('0x24')],'contentType':_0x1564a9[_0xc008('0x2b')],'data':fs[_0xc008('0x9e')](_0x33cad3)});}}}emlformat[_0xc008('0x9f')](_0x5d5d2f,function(_0x427fd2,_0x4ea18b){if(_0x427fd2)return _0x4fda8(_0x427fd2);fs[_0xc008('0xa0')](path[_0xc008('0x5d')](_0x2e2c2a,_0x3eb3de),_0x4ea18b);return _0x48f40f(_0x4ea18b);});});}})[_0xc008('0x13')](function(_0x4b946a){if(_0x4b946a){return _0x2cc170[_0xc008('0x8e')](path[_0xc008('0x5d')](_0x2e2c2a,_0x3eb3de),_0x3eb3de,function(_0x3f6018){if(!_0x3f6018)fs['unlinkSync'](path[_0xc008('0x5d')](_0x2e2c2a,_0x3eb3de));});}})['catch'](handleError(_0x2cc170,null));}; \ No newline at end of file +var _0x3e74=['join','root','server/files/attachments','basename','CmContact','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','UserId','get','MailInteraction','MailInteractionId','read1stAt','interaction','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','agent','fullname','email','internal','manual','interface','channel','fromString','EventManager','acceptmessage','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','contact','SIP/%s','event','download','tmp','files','message-%s.eml','subject','createdAt','Attachments','from','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','bcc','push','readFileSync','build','unlinkSync','eml-format','bluebird','util','path','html-to-text','../../config/logger','api','mail-interactions','../../config/environment','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','client','http','then','info','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','MailMessage,\x20%s,\x20%s','message','result','catch','status','json','offset','undefined','count','Content-Range','destroy','end','sendStatus','stack','name','send','MailMessage','rawAttributes','fieldName','type','key','intersection','query','attributes','model','fields','hasOwnProperty','nolimit','limit','sort','where','filters','pick','filter','merge','options','findAll','keys','length','include','find','update','body','params','describe','create','out','secret','MailAccount','findOne','CmList','Contacts','updatedAt','DESC','MailServerOut','Smtp','isNil','service','port','secure','authentication','auth','pass','user','attachments'];(function(_0x4432d8,_0x4ec93f){var _0x174287=function(_0xbb9e3e){while(--_0xbb9e3e){_0x4432d8['push'](_0x4432d8['shift']());}};_0x174287(++_0x4ec93f);}(_0x3e74,0x175));var _0x43e7=function(_0x2cca38,_0x1090b0){_0x2cca38=_0x2cca38-0x0;var _0x2ea6b4=_0x3e74[_0x2cca38];return _0x2ea6b4;};'use strict';var emlformat=require(_0x43e7('0x0'));var moment=require('moment');var BPromise=require(_0x43e7('0x1'));var util=require(_0x43e7('0x2'));var path=require(_0x43e7('0x3'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var htmlToText=require(_0x43e7('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0x43e7('0x5'))(_0x43e7('0x6'));var interaction_log=require(_0x43e7('0x5'))(_0x43e7('0x7'));var config=require(_0x43e7('0x8'));var db=require('../../mysqldb')['db'];config[_0x43e7('0x9')]=_[_0x43e7('0xa')](config[_0x43e7('0x9')],{'host':_0x43e7('0xb'),'port':0x18eb});var socket=require(_0x43e7('0xc'))(new Redis(config['redis']));require(_0x43e7('0xd'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x43e7('0xe')][_0x43e7('0xf')]({'port':0x232c});var client9003=jayson['client'][_0x43e7('0xf')]({'port':0x232b});var client9002=jayson['client'][_0x43e7('0xf')]({'port':0x232a});function respondWithRpcPromise(_0x37302c,_0x4ebc8e,_0x3eb206,_0xc960ea){return new BPromise(function(_0x2718d3,_0x3bb83f){var _0x4e008c=_0xc960ea||client;return _0x4e008c['request'](_0x37302c,_0x3eb206)[_0x43e7('0x10')](function(_0x21fdd3){logger[_0x43e7('0x11')]('MailMessage,\x20%s,\x20%s',_0x4ebc8e,'request\x20sent');logger[_0x43e7('0x12')](_0x43e7('0x13'),_0x4ebc8e,_0x43e7('0x14'),JSON[_0x43e7('0x15')](_0x21fdd3));if(_0x21fdd3['error']){if(_0x21fdd3['error'][_0x43e7('0x16')]===0x1f4){logger[_0x43e7('0x17')](_0x43e7('0x18'),_0x4ebc8e,_0x21fdd3['error']['message']);return _0x3bb83f(_0x21fdd3[_0x43e7('0x17')][_0x43e7('0x19')]);}logger[_0x43e7('0x17')](_0x43e7('0x18'),_0x4ebc8e,_0x21fdd3[_0x43e7('0x17')][_0x43e7('0x19')]);return _0x2718d3(_0x21fdd3[_0x43e7('0x17')][_0x43e7('0x19')]);}else{logger[_0x43e7('0x11')](_0x43e7('0x18'),_0x4ebc8e,_0x43e7('0x14'));_0x2718d3(_0x21fdd3[_0x43e7('0x1a')]['message']);}})[_0x43e7('0x1b')](function(_0x3c6625){logger['error'](_0x43e7('0x18'),_0x4ebc8e,_0x3c6625);_0x3bb83f(_0x3c6625);});});}function respondWithResult(_0x3e281e,_0x3945bb){_0x3945bb=_0x3945bb||0xc8;return function(_0x28aacc){if(_0x28aacc){return _0x3e281e[_0x43e7('0x1c')](_0x3945bb)[_0x43e7('0x1d')](_0x28aacc);}};}function respondWithFilteredResult(_0x54a9e7,_0x454359){return function(_0x4eea52){if(_0x4eea52){var _0x4c9df3=typeof _0x454359[_0x43e7('0x1e')]===_0x43e7('0x1f')&&typeof _0x454359['limit']===_0x43e7('0x1f');var _0x4ca5cf=_0x4eea52[_0x43e7('0x20')];var _0x5c5e67=_0x4c9df3?0x0:_0x454359[_0x43e7('0x1e')];var _0x1b5f50=_0x4c9df3?_0x4eea52[_0x43e7('0x20')]:_0x454359[_0x43e7('0x1e')]+_0x454359['limit'];var _0x52b7b3;if(_0x1b5f50>=_0x4ca5cf){_0x1b5f50=_0x4ca5cf;_0x52b7b3=0xc8;}else{_0x52b7b3=0xce;}_0x54a9e7[_0x43e7('0x1c')](_0x52b7b3);return _0x54a9e7['set'](_0x43e7('0x21'),_0x5c5e67+'-'+_0x1b5f50+'/'+_0x4ca5cf)[_0x43e7('0x1d')](_0x4eea52);}return null;};}function saveUpdates(_0x3565cf){return function(_0xb1fc63){if(_0xb1fc63){return _0xb1fc63['update'](_0x3565cf)[_0x43e7('0x10')](function(_0x4690a6){return _0x4690a6;});}return null;};}function removeEntity(_0x45b675){return function(_0x50f9f5){if(_0x50f9f5){return _0x50f9f5[_0x43e7('0x22')]()[_0x43e7('0x10')](function(){_0x45b675[_0x43e7('0x1c')](0xcc)[_0x43e7('0x23')]();});}};}function handleEntityNotFound(_0x3bf475){return function(_0x35dbcd){if(!_0x35dbcd){_0x3bf475[_0x43e7('0x24')](0x194);}return _0x35dbcd;};}function handleError(_0x19725a,_0x2bde44){_0x2bde44=_0x2bde44||0x1f4;return function(_0x208706){logger['error'](_0x208706[_0x43e7('0x25')]);if(_0x208706[_0x43e7('0x26')]){delete _0x208706[_0x43e7('0x26')];}_0x19725a[_0x43e7('0x1c')](_0x2bde44)[_0x43e7('0x27')](_0x208706);};}exports['index']=function(_0x1eba65,_0x49b83d){var _0x30d47e={},_0x3f280d={},_0x4c61b9={'count':0x0,'rows':[]};var _0x5a7342=_['map'](db[_0x43e7('0x28')][_0x43e7('0x29')],function(_0x117c07){return{'name':_0x117c07[_0x43e7('0x2a')],'type':_0x117c07[_0x43e7('0x2b')][_0x43e7('0x2c')]};});_0x3f280d['model']=_['map'](_0x5a7342,'name');_0x3f280d['query']=_['keys'](_0x1eba65['query']);_0x3f280d['filters']=_[_0x43e7('0x2d')](_0x3f280d['model'],_0x3f280d[_0x43e7('0x2e')]);_0x30d47e[_0x43e7('0x2f')]=_[_0x43e7('0x2d')](_0x3f280d[_0x43e7('0x30')],qs[_0x43e7('0x31')](_0x1eba65[_0x43e7('0x2e')][_0x43e7('0x31')]));_0x30d47e['attributes']=_0x30d47e['attributes']['length']?_0x30d47e[_0x43e7('0x2f')]:_0x3f280d[_0x43e7('0x30')];if(!_0x1eba65[_0x43e7('0x2e')][_0x43e7('0x32')](_0x43e7('0x33'))){_0x30d47e[_0x43e7('0x34')]=qs[_0x43e7('0x34')](_0x1eba65[_0x43e7('0x2e')]['limit']);_0x30d47e[_0x43e7('0x1e')]=qs[_0x43e7('0x1e')](_0x1eba65['query'][_0x43e7('0x1e')]);}_0x30d47e['order']=qs[_0x43e7('0x35')](_0x1eba65[_0x43e7('0x2e')][_0x43e7('0x35')]);_0x30d47e[_0x43e7('0x36')]=qs[_0x43e7('0x37')](_[_0x43e7('0x38')](_0x1eba65['query'],_0x3f280d['filters']),_0x5a7342);if(_0x1eba65[_0x43e7('0x2e')][_0x43e7('0x39')]){_0x30d47e[_0x43e7('0x36')]=_[_0x43e7('0x3a')](_0x30d47e[_0x43e7('0x36')],{'$or':_['map'](_0x5a7342,function(_0x32a451){if(_0x32a451[_0x43e7('0x2b')]!=='VIRTUAL'){var _0x3628e0={};_0x3628e0[_0x32a451['name']]={'$like':'%'+_0x1eba65[_0x43e7('0x2e')]['filter']+'%'};return _0x3628e0;}})});}_0x30d47e=_[_0x43e7('0x3a')]({},_0x30d47e,_0x1eba65[_0x43e7('0x3b')]);var _0x3a5807={'where':_0x30d47e[_0x43e7('0x36')]};return db['MailMessage']['count'](_0x3a5807)[_0x43e7('0x10')](function(_0x40c509){_0x4c61b9[_0x43e7('0x20')]=_0x40c509;if(_0x1eba65[_0x43e7('0x2e')]['includeAll']){_0x30d47e['include']=[{'all':!![]}];}return db['MailMessage'][_0x43e7('0x3c')](_0x30d47e);})['then'](function(_0x2ab022){_0x4c61b9['rows']=_0x2ab022;return _0x4c61b9;})['then'](respondWithFilteredResult(_0x49b83d,_0x30d47e))[_0x43e7('0x1b')](handleError(_0x49b83d,null));};exports['show']=function(_0x2de14f,_0x39db7f){var _0x257bd8={'raw':!![],'where':{'id':_0x2de14f['params']['id']}},_0x99b9e1={};_0x99b9e1[_0x43e7('0x30')]=_[_0x43e7('0x3d')](db[_0x43e7('0x28')][_0x43e7('0x29')]);_0x99b9e1[_0x43e7('0x2e')]=_[_0x43e7('0x3d')](_0x2de14f['query']);_0x99b9e1['filters']=_[_0x43e7('0x2d')](_0x99b9e1[_0x43e7('0x30')],_0x99b9e1[_0x43e7('0x2e')]);_0x257bd8['attributes']=_['intersection'](_0x99b9e1['model'],qs[_0x43e7('0x31')](_0x2de14f[_0x43e7('0x2e')]['fields']));_0x257bd8[_0x43e7('0x2f')]=_0x257bd8[_0x43e7('0x2f')][_0x43e7('0x3e')]?_0x257bd8['attributes']:_0x99b9e1['model'];if(_0x2de14f['query']['includeAll']){_0x257bd8[_0x43e7('0x3f')]=[{'all':!![]}];}_0x257bd8=_[_0x43e7('0x3a')]({},_0x257bd8,_0x2de14f['options']);return db[_0x43e7('0x28')][_0x43e7('0x40')](_0x257bd8)[_0x43e7('0x10')](handleEntityNotFound(_0x39db7f,null))[_0x43e7('0x10')](respondWithResult(_0x39db7f,null))['catch'](handleError(_0x39db7f,null));};exports[_0x43e7('0x41')]=function(_0x483f20,_0x4bebd4){if(_0x483f20[_0x43e7('0x42')]['id']){delete _0x483f20[_0x43e7('0x42')]['id'];}return db[_0x43e7('0x28')][_0x43e7('0x40')]({'where':{'id':_0x483f20[_0x43e7('0x43')]['id']}})[_0x43e7('0x10')](handleEntityNotFound(_0x4bebd4,null))[_0x43e7('0x10')](saveUpdates(_0x483f20[_0x43e7('0x42')],null))[_0x43e7('0x10')](respondWithResult(_0x4bebd4,null))[_0x43e7('0x1b')](handleError(_0x4bebd4,null));};exports['destroy']=function(_0x119d34,_0x46c910){return db['MailMessage'][_0x43e7('0x40')]({'where':{'id':_0x119d34['params']['id']}})[_0x43e7('0x10')](handleEntityNotFound(_0x46c910,null))[_0x43e7('0x10')](removeEntity(_0x46c910,null))[_0x43e7('0x1b')](handleError(_0x46c910,null));};exports[_0x43e7('0x44')]=function(_0xfe13fa,_0x5e5556){return db['MailMessage'][_0x43e7('0x44')]()[_0x43e7('0x10')](respondWithResult(_0x5e5556,null))[_0x43e7('0x1b')](handleError(_0x5e5556,null));};exports[_0x43e7('0x45')]=function(_0x23d835,_0x25bb44){return db[_0x43e7('0x28')][_0x43e7('0x45')](_0x23d835[_0x43e7('0x42')])[_0x43e7('0x10')](function(_0x312306){if(_0x312306){if(_0x312306['direction']===_0x43e7('0x46')&&!_0x312306[_0x43e7('0x47')]){var _0x50a3fa,_0x4314d8,_0x220bf2;if(_0x23d835[_0x43e7('0x42')]['to']){_0x4314d8=_0x23d835['body']['to']['split'](',')[0x0];}return db[_0x43e7('0x48')][_0x43e7('0x49')]({'where':{'id':_0x312306['MailAccountId']},'include':[{'model':db[_0x43e7('0x4a')],'as':'List','include':[{'model':db['CmContact'],'as':_0x43e7('0x4b'),'where':{'email':_0x4314d8},'limit':0x1,'order':[[_0x43e7('0x4c'),_0x43e7('0x4d')]]}]},{'model':db[_0x43e7('0x4e')],'as':_0x43e7('0x4f'),'raw':!![]}]})['then'](function(_0xc3976){_0x50a3fa=_0xc3976;if(_0x50a3fa&&_0x50a3fa[_0x43e7('0x4f')]){var _0x4d89bd={'tls':{'rejectUnauthorized':![]}};if(_[_0x43e7('0x50')](_0x50a3fa[_0x43e7('0x4f')][_0x43e7('0x51')])){_0x4d89bd['host']=_0x50a3fa['Smtp']['host'];_0x4d89bd[_0x43e7('0x52')]=_0x50a3fa[_0x43e7('0x4f')][_0x43e7('0x52')];_0x4d89bd[_0x43e7('0x53')]=_0x50a3fa['Smtp']['secure'];if(_0x50a3fa[_0x43e7('0x4f')][_0x43e7('0x54')]){_0x4d89bd[_0x43e7('0x55')]={'user':_0x50a3fa[_0x43e7('0x4f')]['user'],'pass':_0x50a3fa[_0x43e7('0x4f')][_0x43e7('0x56')]};}}else{_0x4d89bd[_0x43e7('0x51')]=_0x50a3fa[_0x43e7('0x4f')][_0x43e7('0x51')];_0x4d89bd[_0x43e7('0x55')]={'user':_0x50a3fa[_0x43e7('0x4f')][_0x43e7('0x57')],'pass':_0x50a3fa[_0x43e7('0x4f')][_0x43e7('0x56')]};_0x4d89bd[_0x43e7('0x53')]=_0x50a3fa['Smtp']['secure'];}if(_0x23d835[_0x43e7('0x42')]['attachments']&&_0x23d835['body']['attachments'][_0x43e7('0x3e')]){for(var _0xe666b0=0x0;_0xe666b0<_0x23d835['body'][_0x43e7('0x58')][_0x43e7('0x3e')];_0xe666b0+=0x1){_0x23d835[_0x43e7('0x42')]['attachments'][_0xe666b0]={'filename':_0x23d835[_0x43e7('0x42')][_0x43e7('0x58')][_0xe666b0][_0x43e7('0x26')],'path':path[_0x43e7('0x59')](config[_0x43e7('0x5a')],_0x43e7('0x5b'),_0x23d835[_0x43e7('0x42')]['attachments'][_0xe666b0][_0x43e7('0x5c')])};}}_0x220bf2={'account':_0x4d89bd,'message':_0x23d835[_0x43e7('0x42')]};return;}})[_0x43e7('0x10')](function(){if(_0x50a3fa['List']){if(_0x50a3fa['List'][_0x43e7('0x4b')]['length']){return _0x50a3fa['List'][_0x43e7('0x4b')][0x0];}else{return db[_0x43e7('0x5d')]['create'](_[_0x43e7('0xa')](_0x23d835[_0x43e7('0x42')],{'firstName':_0x23d835[_0x43e7('0x42')]['to'],'email':_0x23d835[_0x43e7('0x42')]['to'],'phone':_0x23d835[_0x43e7('0x42')]['to'],'ListId':_0x50a3fa[_0x43e7('0x5e')]}));}}else{throw new Error(_0x43e7('0x5f'));}})['then'](function(){if(_0x220bf2){return respondWithRpcPromise(_0x43e7('0x60'),_0x43e7('0x61'),_0x220bf2,client9003)['then'](function(_0x418213){return _0x312306['update']({'read':!![],'messageId':_0x418213[_0x43e7('0x62')],'sentAt':moment()[_0x43e7('0x63')](_0x43e7('0x64'))});})[_0x43e7('0x1b')](function(_0x506361){logger[_0x43e7('0x17')]('%s',JSON[_0x43e7('0x15')](_0x506361));return _0x312306;});}return _0x312306;});}return _0x312306;}})[_0x43e7('0x10')](respondWithResult(_0x25bb44,0xc9))['catch'](handleError(_0x25bb44,null));};exports[_0x43e7('0x65')]=function(_0x38fa5b,_0x219dc6){var _0x703a30={'agent':{},'channel':_0x43e7('0x66')};if(_0x38fa5b['body']['id']){delete _0x38fa5b[_0x43e7('0x42')]['id'];}_0x38fa5b[_0x43e7('0x42')][_0x43e7('0x67')]=!![];_0x38fa5b[_0x43e7('0x42')][_0x43e7('0x68')]=moment()[_0x43e7('0x63')](_0x43e7('0x64'));_0x38fa5b['body']['UserId']=_0x38fa5b[_0x43e7('0x42')]['UserId']||_0x38fa5b['user']['id'];_0x703a30['agent']['id']=_0x38fa5b[_0x43e7('0x42')][_0x43e7('0x69')];return db[_0x43e7('0x28')][_0x43e7('0x40')]({'where':{'id':_0x38fa5b[_0x43e7('0x43')]['id'],'UserId':null}})[_0x43e7('0x10')](handleEntityNotFound(_0x219dc6,null))['then'](saveUpdates(_0x38fa5b[_0x43e7('0x42')],null))[_0x43e7('0x10')](function(_0x2cd420){if(_0x2cd420){_0x703a30['message']=_0x2cd420[_0x43e7('0x6a')]({'plain':!![]});return db[_0x43e7('0x6b')][_0x43e7('0x40')]({'where':{'id':_0x2cd420[_0x43e7('0x6c')]}});}return null;})[_0x43e7('0x10')](handleEntityNotFound(_0x219dc6,null))[_0x43e7('0x10')](function(_0x1d4a29){if(_0x1d4a29){return _0x1d4a29[_0x43e7('0x41')]({'UserId':_0x38fa5b['body']['UserId'],'read1stAt':_['isNil'](_0x1d4a29[_0x43e7('0x6d')])?moment()[_0x43e7('0x63')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x43e7('0x10')](function(_0x39a787){if(_0x39a787){_0x703a30[_0x43e7('0x6e')]=_0x39a787[_0x43e7('0x6a')]({'plain':!![]});interaction_log['info']('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x38fa5b['user']['id'],_0x38fa5b[_0x43e7('0x57')][_0x43e7('0x26')],_0x38fa5b['user']['role'],_0x703a30[_0x43e7('0x6e')]['id'],_0x38fa5b[_0x43e7('0x42')]?JSON[_0x43e7('0x15')](_0x38fa5b['body']):_0x43e7('0x6f'));return respondWithRpcPromise(_0x43e7('0x70'),_0x43e7('0x71'),_0x703a30);}return null;})[_0x43e7('0x10')](function(_0x48f1dc){var _0x1d7048='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x48f1dc[_0x43e7('0x19')][_0x43e7('0x72')];return db[_0x43e7('0x73')][_0x43e7('0x2e')](_0x1d7048,{'type':db[_0x43e7('0x74')][_0x43e7('0x75')][_0x43e7('0x76')],'raw':!![]})['then'](function(_0x109c86){return _0x109c86;});})[_0x43e7('0x10')](function(_0x1aea4e){if(_0x1aea4e){_0x703a30[_0x43e7('0x19')]['contact']=_0x1aea4e[0x0];if(!_0x38fa5b['body']['UserId'])return;return db[_0x43e7('0x77')]['find']({'where':{'id':_0x38fa5b[_0x43e7('0x42')][_0x43e7('0x69')],'role':_0x43e7('0x78')},'attributes':['id',_0x43e7('0x26'),_0x43e7('0x79'),_0x43e7('0x7a'),_0x43e7('0x7b')],'raw':!![]});}return null;})[_0x43e7('0x10')](function(_0x363af5){if(!_0x363af5)return null;_0x703a30[_0x43e7('0x19')][_0x43e7('0x78')]=_0x363af5;return _0x703a30;})['then'](function(_0xeaef5c){if(_0xeaef5c){if(_0x38fa5b[_0x43e7('0x42')][_0x43e7('0x7c')]){_0x703a30[_0x43e7('0x19')][_0x43e7('0x7d')]=util['format']('SIP/%s',_0x38fa5b[_0x43e7('0x57')][_0x43e7('0x26')]);_0x703a30['message'][_0x43e7('0x7e')]=_0x703a30[_0x43e7('0x7e')];_0x703a30['message']['event']=_0x43e7('0x65');_0x703a30[_0x43e7('0x19')][_0x43e7('0x42')]=htmlToText[_0x43e7('0x7f')](_0x703a30[_0x43e7('0x19')]['body']);return respondWithRpcPromise('EventManager',_0x43e7('0x80'),{'event':_0x43e7('0x81'),'message':_0x703a30[_0x43e7('0x19')]},client9002)[_0x43e7('0x10')](function(){return _0x703a30;});}return _0x703a30;}return null;})['then'](respondWithResult(_0x219dc6,null))[_0x43e7('0x1b')](handleError(_0x219dc6,null));};exports[_0x43e7('0x82')]=function(_0x1ed590,_0x15ee83){var _0x5bc060={'agent':{},'channel':_0x43e7('0x66')};if(_0x1ed590[_0x43e7('0x42')]['id']){delete _0x1ed590[_0x43e7('0x42')]['id'];}_0x1ed590[_0x43e7('0x42')][_0x43e7('0x69')]=_0x1ed590['body'][_0x43e7('0x69')]||_0x1ed590[_0x43e7('0x57')]['id'];_0x5bc060['agent']['id']=_0x1ed590[_0x43e7('0x42')][_0x43e7('0x69')];return db[_0x43e7('0x28')][_0x43e7('0x40')]({'where':{'id':_0x1ed590['params']['id'],'UserId':null}})[_0x43e7('0x10')](handleEntityNotFound(_0x15ee83,null))['then'](function(_0x130b41){if(_0x130b41){_0x5bc060[_0x43e7('0x19')]=_0x130b41[_0x43e7('0x6a')]({'plain':!![]});return db[_0x43e7('0x6b')][_0x43e7('0x40')]({'where':{'id':_0x130b41[_0x43e7('0x6c')]}});}return null;})[_0x43e7('0x10')](handleEntityNotFound(_0x15ee83,null))[_0x43e7('0x10')](function(_0xa693a3){if(_0xa693a3){_0x5bc060['interaction']=_0xa693a3[_0x43e7('0x6a')]({'plain':!![]});interaction_log[_0x43e7('0x11')](_0x43e7('0x83'),_0x1ed590[_0x43e7('0x57')]['id'],_0x1ed590['user']['name'],_0x1ed590[_0x43e7('0x57')][_0x43e7('0x84')],_0x5bc060[_0x43e7('0x6e')]['id'],_0x1ed590['body']?JSON[_0x43e7('0x15')](_0x1ed590['body']):'null');return respondWithRpcPromise('RejectMessage',_0x43e7('0x85'),_0x5bc060);}return null;})['then'](function(_0x28f15e){var _0x233819=_0x43e7('0x86')+_0x28f15e[_0x43e7('0x19')][_0x43e7('0x72')];return db['sequelize']['query'](_0x233819,{'type':db[_0x43e7('0x74')][_0x43e7('0x75')]['SELECT'],'raw':!![]})[_0x43e7('0x10')](function(_0x10fd28){return _0x10fd28;});})[_0x43e7('0x10')](function(_0x3310ef){if(_0x3310ef){_0x5bc060[_0x43e7('0x19')][_0x43e7('0x87')]=_0x3310ef[0x0];if(!_0x1ed590[_0x43e7('0x42')][_0x43e7('0x69')])return;return db[_0x43e7('0x77')][_0x43e7('0x40')]({'where':{'id':_0x1ed590[_0x43e7('0x42')][_0x43e7('0x69')],'role':_0x43e7('0x78')},'attributes':['id',_0x43e7('0x26'),_0x43e7('0x79'),_0x43e7('0x7a'),_0x43e7('0x7b')],'raw':!![]});}return null;})[_0x43e7('0x10')](function(_0xec3d2a){if(!_0xec3d2a)return null;_0x5bc060[_0x43e7('0x19')][_0x43e7('0x78')]=_0xec3d2a;return _0x5bc060;})[_0x43e7('0x10')](function(_0x492c2f){if(_0x492c2f){_0x492c2f[_0x43e7('0x19')][_0x43e7('0x7d')]=util[_0x43e7('0x63')](_0x43e7('0x88'),_0x1ed590['user'][_0x43e7('0x26')]);_0x492c2f['message'][_0x43e7('0x7e')]=_0x5bc060[_0x43e7('0x7e')];_0x492c2f[_0x43e7('0x19')][_0x43e7('0x89')]=_0x43e7('0x82');_0x492c2f[_0x43e7('0x19')]['body']=htmlToText[_0x43e7('0x7f')](_0x5bc060[_0x43e7('0x19')][_0x43e7('0x42')]);respondWithRpcPromise(_0x43e7('0x80'),_0x43e7('0x80'),{'event':'rejectmessage','message':_0x492c2f['message']},client9002);return _0x5bc060;}return null;})[_0x43e7('0x10')](respondWithResult(_0x15ee83,null))['catch'](handleError(_0x15ee83,null));};exports[_0x43e7('0x8a')]=function(_0x45aef7,_0x35e743){var _0x29ef54=moment()['unix']()['toString']();var _0x52ddb7=path[_0x43e7('0x59')](config['root'],'server','files',_0x43e7('0x8b'));var _0x1e6ddb=path['join'](config[_0x43e7('0x5a')],'server',_0x43e7('0x8c'),_0x43e7('0x58'));var _0x271f55=util[_0x43e7('0x63')](_0x43e7('0x8d'),_0x29ef54);return db['MailMessage'][_0x43e7('0x40')]({'where':{'id':_0x45aef7[_0x43e7('0x43')]['id']},'attributes':['id',_0x43e7('0x42'),'from','to','cc','bcc',_0x43e7('0x8e'),_0x43e7('0x8f')],'include':_0x45aef7[_0x43e7('0x2e')][_0x43e7('0x58')]?[{'model':db['Attachment'],'as':_0x43e7('0x90')}]:undefined})[_0x43e7('0x10')](handleEntityNotFound(_0x35e743,null))[_0x43e7('0x10')](function(_0x56150e){if(_0x56150e){var _0x41a222=_0x56150e;var _0x2c410e={'from':_0x41a222[_0x43e7('0x91')],'to':_0x41a222['to'],'subject':_0x41a222[_0x43e7('0x8e')],'html':_0x41a222['body'],'headers':{'Date':moment(_0x41a222[_0x43e7('0x8f')])['format'](_0x43e7('0x92'))},'attachments':[]};if(_0x56150e['cc']){_0x2c410e[_0x43e7('0x93')]['Cc']=_0x56150e['cc'];}if(_0x56150e['bcc']){_0x2c410e['headers'][_0x43e7('0x94')]=_0x56150e[_0x43e7('0x95')];}return new BPromise(function(_0x21d001,_0x4600e5){if(_0x56150e[_0x43e7('0x90')]){for(var _0x28986d=0x0;_0x28986d<_0x56150e[_0x43e7('0x90')][_0x43e7('0x3e')];_0x28986d++){var _0x1bff0a=_0x56150e[_0x43e7('0x90')][_0x28986d];var _0x615c=path['join'](_0x1e6ddb,_0x1bff0a[_0x43e7('0x5c')]);if(fs['existsSync'](_0x615c)){_0x2c410e[_0x43e7('0x58')][_0x43e7('0x96')]({'name':_0x1bff0a[_0x43e7('0x26')],'contentType':_0x1bff0a['type'],'data':fs[_0x43e7('0x97')](_0x615c)});}}}emlformat[_0x43e7('0x98')](_0x2c410e,function(_0x119cd2,_0x352405){if(_0x119cd2)return _0x4600e5(_0x119cd2);fs['writeFileSync'](path[_0x43e7('0x59')](_0x52ddb7,_0x271f55),_0x352405);return _0x21d001(_0x352405);});});}})[_0x43e7('0x10')](function(_0x524dc2){if(_0x524dc2){return _0x35e743['download'](path['join'](_0x52ddb7,_0x271f55),_0x271f55,function(_0x124024){if(!_0x124024)fs[_0x43e7('0x99')](path[_0x43e7('0x59')](_0x52ddb7,_0x271f55));});}})[_0x43e7('0x1b')](handleError(_0x35e743,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 26b1841..2b478de 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 _0x1bd9=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x59616b,_0x38e534){var _0x5c4523=function(_0x166f2e){while(--_0x166f2e){_0x59616b['push'](_0x59616b['shift']());}};_0x5c4523(++_0x38e534);}(_0x1bd9,0x98));var _0x91bd=function(_0xa5b54f,_0x1a2438){_0xa5b54f=_0xa5b54f-0x0;var _0x377f6e=_0x1bd9[_0xa5b54f];return _0x377f6e;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0x91bd('0x0'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x91bd('0x1')](0x0);var events={'afterCreate':_0x91bd('0x2'),'afterUpdate':_0x91bd('0x3'),'afterDestroy':_0x91bd('0x4')};function emitEvent(_0x59e511){return function(_0x165505,_0x591be,_0x4129c1){MailMessageEvents[_0x91bd('0x5')](_0x59e511+':'+_0x165505['id'],_0x165505);MailMessageEvents[_0x91bd('0x5')](_0x59e511,_0x165505);_0x4129c1(null);};}for(var e in events){if(events[_0x91bd('0x6')](e)){var event=events[e];MailMessage[_0x91bd('0x7')](e,emitEvent(event));}}module[_0x91bd('0x8')]=MailMessageEvents; \ No newline at end of file +var _0x8f11=['save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners'];(function(_0x47ef91,_0x409ee5){var _0x4e8103=function(_0x189936){while(--_0x189936){_0x47ef91['push'](_0x47ef91['shift']());}};_0x4e8103(++_0x409ee5);}(_0x8f11,0x15c));var _0x18f1=function(_0x38de50,_0x212afb){_0x38de50=_0x38de50-0x0;var _0x131743=_0x8f11[_0x38de50];return _0x131743;};'use strict';var EventEmitter=require(_0x18f1('0x0'));var MailMessage=require(_0x18f1('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x18f1('0x2')](0x0);var events={'afterCreate':_0x18f1('0x3'),'afterUpdate':_0x18f1('0x4'),'afterDestroy':_0x18f1('0x5')};function emitEvent(_0x234079){return function(_0x7224a1,_0x42d164,_0x6b3a3d){MailMessageEvents[_0x18f1('0x6')](_0x234079+':'+_0x7224a1['id'],_0x7224a1);MailMessageEvents[_0x18f1('0x6')](_0x234079,_0x7224a1);_0x6b3a3d(null);};}for(var e in events){if(events[_0x18f1('0x7')](e)){var event=events[e];MailMessage[_0x18f1('0x8')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index a15519c..6f71c18 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 _0x2bf5=['update','createdAt','error','utf8mb4_unicode_ci','lodash','api','moment','bluebird','request-promise','html-to-text','path','../../config/environment','./mailMessage.attributes','define','MailMessage','mail_messages','messageId','fti_mail_messages','FULLTEXT','plainBody','fromString','body','get','direction','toLowerCase','out','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','then'];(function(_0x217281,_0x3e87c7){var _0x16209b=function(_0x25f6fb){while(--_0x25f6fb){_0x217281['push'](_0x217281['shift']());}};_0x16209b(++_0x3e87c7);}(_0x2bf5,0x1d2));var _0x52bf=function(_0x51743d,_0x5aa931){_0x51743d=_0x51743d-0x0;var _0x5bcf7f=_0x2bf5[_0x51743d];return _0x5bcf7f;};'use strict';var _=require(_0x52bf('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x52bf('0x1'));var moment=require(_0x52bf('0x2'));var BPromise=require(_0x52bf('0x3'));var rp=require(_0x52bf('0x4'));var htmlToText=require(_0x52bf('0x5'));var fs=require('fs');var path=require(_0x52bf('0x6'));var rimraf=require('rimraf');var config=require(_0x52bf('0x7'));var attributes=require(_0x52bf('0x8'));module['exports']=function(_0x38e039,_0xd2fcf2){return _0x38e039[_0x52bf('0x9')](_0x52bf('0xa'),attributes,{'tableName':_0x52bf('0xb'),'paranoid':![],'indexes':[{'name':_0x52bf('0xc'),'fields':['messageId']},{'name':_0x52bf('0xd'),'fields':['plainBody','subject'],'type':_0x52bf('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5b3cb1,_0x2cd1dc,_0xdb884a){if(_0x5b3cb1['body']){_0x5b3cb1[_0x52bf('0xf')]=htmlToText[_0x52bf('0x10')](_0x5b3cb1[_0x52bf('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0xdb884a(null,_0x2cd1dc);},'afterCreate':function(_0x3e114d,_0x214e7e,_0x286bd1){var _0x35f935=_0x38e039['models'];var _0x52e744=_0x3e114d[_0x52bf('0x12')]({'plain':!![]});if(_0x52e744[_0x52bf('0x13')]['toLowerCase']()==='in'||_0x52e744['direction'][_0x52bf('0x14')]()===_0x52bf('0x15')&&!_0x52e744[_0x52bf('0x16')]&&!_[_0x52bf('0x17')](_0x52e744[_0x52bf('0x18')])){_0x35f935[_0x52bf('0x19')][_0x52bf('0x1a')]({'where':{'id':_0x52e744[_0x52bf('0x1b')]}})[_0x52bf('0x1c')](function(_0x4541f6){if(_0x4541f6){_0x4541f6[_0x52bf('0x1d')]({'lastMsgAt':_0x52e744[_0x52bf('0x1e')],'lastMsgDirection':_0x52e744[_0x52bf('0x13')][_0x52bf('0x14')]()});}})['catch'](function(_0xcf5502){console[_0x52bf('0x1f')](_0xcf5502);});}_0x286bd1();}},'charset':'utf8mb4','collate':_0x52bf('0x20')});}; \ No newline at end of file +var _0x161d=['exports','define','MailMessage','mail_messages','messageId','plainBody','subject','body','fromString','models','get','direction','toLowerCase','secret','UserId','MailInteraction','findOne','MailInteractionId','then','update','createdAt','catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','html-to-text','rimraf','../../config/environment','./mailMessage.attributes'];(function(_0x48bb8a,_0x5c8e2f){var _0x45be3e=function(_0x32883a){while(--_0x32883a){_0x48bb8a['push'](_0x48bb8a['shift']());}};_0x45be3e(++_0x5c8e2f);}(_0x161d,0x7b));var _0xd161=function(_0x1eedb6,_0x3e07c4){_0x1eedb6=_0x1eedb6-0x0;var _0x127ac7=_0x161d[_0x1eedb6];return _0x127ac7;};'use strict';var _=require(_0xd161('0x0'));var util=require(_0xd161('0x1'));var logger=require(_0xd161('0x2'))(_0xd161('0x3'));var moment=require(_0xd161('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var htmlToText=require(_0xd161('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd161('0x6'));var config=require(_0xd161('0x7'));var attributes=require(_0xd161('0x8'));module[_0xd161('0x9')]=function(_0x3b13c9,_0x529dc1){return _0x3b13c9[_0xd161('0xa')](_0xd161('0xb'),attributes,{'tableName':_0xd161('0xc'),'paranoid':![],'indexes':[{'name':_0xd161('0xd'),'fields':[_0xd161('0xd')]},{'name':'fti_mail_messages','fields':[_0xd161('0xe'),_0xd161('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x208064,_0x1b1b24,_0xb2d42e){if(_0x208064[_0xd161('0x10')]){_0x208064['plainBody']=htmlToText[_0xd161('0x11')](_0x208064[_0xd161('0x10')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0xb2d42e(null,_0x1b1b24);},'afterCreate':function(_0x45f0ee,_0x4d87ab,_0x321789){var _0x25a357=_0x3b13c9[_0xd161('0x12')];var _0x46f202=_0x45f0ee[_0xd161('0x13')]({'plain':!![]});if(_0x46f202[_0xd161('0x14')][_0xd161('0x15')]()==='in'||_0x46f202[_0xd161('0x14')]['toLowerCase']()==='out'&&!_0x46f202[_0xd161('0x16')]&&!_['isNil'](_0x46f202[_0xd161('0x17')])){_0x25a357[_0xd161('0x18')][_0xd161('0x19')]({'where':{'id':_0x46f202[_0xd161('0x1a')]}})[_0xd161('0x1b')](function(_0x1d1e32){if(_0x1d1e32){_0x1d1e32[_0xd161('0x1c')]({'lastMsgAt':_0x46f202[_0xd161('0x1d')],'lastMsgDirection':_0x46f202[_0xd161('0x14')][_0xd161('0x15')]()});}})[_0xd161('0x1e')](function(_0x325b69){console[_0xd161('0x1f')](_0x325b69);});}_0x321789();}},'charset':'utf8mb4','collate':_0xd161('0x20')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 91d8011..c77c6f7 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 _0x5b12=['MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateMailMessage','create','options','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','client','defaults','redis','localhost','socket.io-emitter','./mailMessage.socket','register','request','then','info'];(function(_0x54d4fe,_0x55e869){var _0x1ab5bb=function(_0x5b1af2){while(--_0x5b1af2){_0x54d4fe['push'](_0x54d4fe['shift']());}};_0x1ab5bb(++_0x55e869);}(_0x5b12,0xa3));var _0x25b1=function(_0x1fd72a,_0x5aca7d){_0x1fd72a=_0x1fd72a-0x0;var _0x4c5075=_0x5b12[_0x1fd72a];return _0x4c5075;};'use strict';var _=require(_0x25b1('0x0'));var util=require(_0x25b1('0x1'));var moment=require(_0x25b1('0x2'));var BPromise=require('bluebird');var rs=require(_0x25b1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x25b1('0x4'))['db'];var utils=require(_0x25b1('0x5'));var logger=require('../../config/logger')(_0x25b1('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x25b1('0x7')]['http']({'port':0x232a});config['redis']=_[_0x25b1('0x8')](config[_0x25b1('0x9')],{'host':_0x25b1('0xa'),'port':0x18eb});var socket=require(_0x25b1('0xb'))(new Redis(config[_0x25b1('0x9')]));require(_0x25b1('0xc'))[_0x25b1('0xd')](socket);function respondWithRpcPromise(_0x6235e2,_0x5b7224,_0x2b739e){return new BPromise(function(_0x1c28cf,_0x2cee35){return client[_0x25b1('0xe')](_0x6235e2,_0x2b739e)[_0x25b1('0xf')](function(_0x8a71af){logger[_0x25b1('0x10')](_0x25b1('0x11'),_0x5b7224,_0x25b1('0x12'));logger[_0x25b1('0x13')](_0x25b1('0x14'),_0x5b7224,_0x25b1('0x12'),JSON[_0x25b1('0x15')](_0x8a71af));if(_0x8a71af[_0x25b1('0x16')]){if(_0x8a71af[_0x25b1('0x16')][_0x25b1('0x17')]===0x1f4){logger['error'](_0x25b1('0x11'),_0x5b7224,_0x8a71af[_0x25b1('0x16')]['message']);return _0x2cee35(_0x8a71af[_0x25b1('0x16')][_0x25b1('0x18')]);}logger[_0x25b1('0x16')]('MailMessage,\x20%s,\x20%s',_0x5b7224,_0x8a71af['error'][_0x25b1('0x18')]);return _0x1c28cf(_0x8a71af['error'][_0x25b1('0x18')]);}else{logger[_0x25b1('0x10')](_0x25b1('0x11'),_0x5b7224,_0x25b1('0x12'));_0x1c28cf(_0x8a71af[_0x25b1('0x19')][_0x25b1('0x18')]);}})[_0x25b1('0x1a')](function(_0x292463){logger['error']('MailMessage,\x20%s,\x20%s',_0x5b7224,_0x292463);_0x2cee35(_0x292463);});});}exports[_0x25b1('0x1b')]=function(_0x501dc8){var _0x174f4a=this;return new Promise(function(_0x50ae0f,_0x3bfd7d){return db['MailMessage'][_0x25b1('0x1c')](_0x501dc8['body'],{'raw':_0x501dc8[_0x25b1('0x1d')]?_0x501dc8['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x3bca9f){logger[_0x25b1('0x10')]('CreateMailMessage',_0x501dc8);logger[_0x25b1('0x13')](_0x25b1('0x1b'),_0x501dc8,JSON[_0x25b1('0x15')](_0x3bca9f));_0x50ae0f(_0x3bca9f);})[_0x25b1('0x1a')](function(_0x1aabbb){logger['error'](_0x25b1('0x1b'),_0x1aabbb[_0x25b1('0x18')],_0x501dc8);_0x3bfd7d(_0x174f4a[_0x25b1('0x16')](0x1f4,_0x1aabbb[_0x25b1('0x18')]));});});}; \ No newline at end of file +var _0xaebd=['MailMessage,\x20%s,\x20%s','result','catch','CreateMailMessage','MailMessage','create','body','options','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./mailMessage.socket','then','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xaebd,0x1e9));var _0xdaeb=function(_0x4c9be7,_0x538b4d){_0x4c9be7=_0x4c9be7-0x0;var _0x5250a7=_0xaebd[_0x4c9be7];return _0x5250a7;};'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});config[_0xdaeb('0xb')]=_[_0xdaeb('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xdaeb('0xd'))(new Redis(config[_0xdaeb('0xb')]));require(_0xdaeb('0xe'))['register'](socket);function respondWithRpcPromise(_0xbb4b72,_0x494d42,_0x3e83f3){return new BPromise(function(_0x4ba89d,_0x2218d6){return client['request'](_0xbb4b72,_0x3e83f3)[_0xdaeb('0xf')](function(_0x3f0e95){logger['info']('MailMessage,\x20%s,\x20%s',_0x494d42,_0xdaeb('0x10'));logger['debug'](_0xdaeb('0x11'),_0x494d42,_0xdaeb('0x10'),JSON[_0xdaeb('0x12')](_0x3f0e95));if(_0x3f0e95[_0xdaeb('0x13')]){if(_0x3f0e95[_0xdaeb('0x13')][_0xdaeb('0x14')]===0x1f4){logger[_0xdaeb('0x13')]('MailMessage,\x20%s,\x20%s',_0x494d42,_0x3f0e95['error'][_0xdaeb('0x15')]);return _0x2218d6(_0x3f0e95[_0xdaeb('0x13')][_0xdaeb('0x15')]);}logger[_0xdaeb('0x13')]('MailMessage,\x20%s,\x20%s',_0x494d42,_0x3f0e95['error'][_0xdaeb('0x15')]);return _0x4ba89d(_0x3f0e95['error']['message']);}else{logger[_0xdaeb('0x16')](_0xdaeb('0x17'),_0x494d42,_0xdaeb('0x10'));_0x4ba89d(_0x3f0e95[_0xdaeb('0x18')][_0xdaeb('0x15')]);}})[_0xdaeb('0x19')](function(_0x501f77){logger[_0xdaeb('0x13')]('MailMessage,\x20%s,\x20%s',_0x494d42,_0x501f77);_0x2218d6(_0x501f77);});});}exports[_0xdaeb('0x1a')]=function(_0x13b3f2){var _0x18bd81=this;return new Promise(function(_0x5360ce,_0x4e97e0){return db[_0xdaeb('0x1b')][_0xdaeb('0x1c')](_0x13b3f2[_0xdaeb('0x1d')],{'raw':_0x13b3f2[_0xdaeb('0x1e')]?_0x13b3f2[_0xdaeb('0x1e')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2c969d){logger[_0xdaeb('0x16')](_0xdaeb('0x1a'),_0x13b3f2);logger[_0xdaeb('0x1f')](_0xdaeb('0x1a'),_0x13b3f2,JSON['stringify'](_0x2c969d));_0x5360ce(_0x2c969d);})[_0xdaeb('0x19')](function(_0x4dc25f){logger[_0xdaeb('0x13')](_0xdaeb('0x1a'),_0x4dc25f[_0xdaeb('0x15')],_0x13b3f2);_0x4e97e0(_0x18bd81[_0xdaeb('0x13')](0x1f4,_0x4dc25f[_0xdaeb('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index d17433d..247b22e 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 _0x573a=['emit','removeListener','register','mailMessage:','./mailMessage.events','remove','update'];(function(_0x1ca93c,_0x3271ab){var _0x185169=function(_0x507763){while(--_0x507763){_0x1ca93c['push'](_0x1ca93c['shift']());}};_0x185169(++_0x3271ab);}(_0x573a,0x82));var _0xa573=function(_0x4a5494,_0x3ad336){_0x4a5494=_0x4a5494-0x0;var _0x57cbb5=_0x573a[_0x4a5494];return _0x57cbb5;};'use strict';var MailMessageEvents=require(_0xa573('0x0'));var events=['save',_0xa573('0x1'),_0xa573('0x2')];function createListener(_0x284d55,_0xf509c2){return function(_0x38c4b6){_0xf509c2[_0xa573('0x3')](_0x284d55,_0x38c4b6);};}function removeListener(_0x97d2b3,_0x48f7eb){return function(){MailMessageEvents[_0xa573('0x4')](_0x97d2b3,_0x48f7eb);};}exports[_0xa573('0x5')]=function(_0x281922){for(var _0x110d77=0x0,_0x1bb25b=events['length'];_0x110d77<_0x1bb25b;_0x110d77++){var _0x281bd0=events[_0x110d77];var _0x278f55=createListener(_0xa573('0x6')+_0x281bd0,_0x281922);MailMessageEvents['on'](_0x281bd0,_0x278f55);}}; \ No newline at end of file +var _0xfa1e=['length','mailMessage:','./mailMessage.events','save','remove','update','removeListener','register'];(function(_0x4e1545,_0x402557){var _0x1455f0=function(_0x1a24c8){while(--_0x1a24c8){_0x4e1545['push'](_0x4e1545['shift']());}};_0x1455f0(++_0x402557);}(_0xfa1e,0x102));var _0xefa1=function(_0x109371,_0x441c8e){_0x109371=_0x109371-0x0;var _0x4fd858=_0xfa1e[_0x109371];return _0x4fd858;};'use strict';var MailMessageEvents=require(_0xefa1('0x0'));var events=[_0xefa1('0x1'),_0xefa1('0x2'),_0xefa1('0x3')];function createListener(_0x5d3e34,_0x4f4764){return function(_0x217d12){_0x4f4764['emit'](_0x5d3e34,_0x217d12);};}function removeListener(_0x1fdbd4,_0x274a30){return function(){MailMessageEvents[_0xefa1('0x4')](_0x1fdbd4,_0x274a30);};}exports[_0xefa1('0x5')]=function(_0x22315d){for(var _0x599473=0x0,_0x5a384a=events[_0xefa1('0x6')];_0x599473<_0x5a384a;_0x599473++){var _0x3b7366=events[_0x599473];var _0x39e16f=createListener(_0xefa1('0x7')+_0x3b7366,_0x22315d);MailMessageEvents['on'](_0x3b7366,_0x39e16f);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index b7710e5..aec1a06 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 _0xe9b8=['/:id/users','getAgents','create','post','/:id/teams','addAgents','put','update','delete','/:id','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','index','get','/describe','isAuthenticated','describe','show','/:id/members','getTeams'];(function(_0x5bb6ab,_0x68052b){var _0x7f58a2=function(_0x5e9004){while(--_0x5e9004){_0x5bb6ab['push'](_0x5bb6ab['shift']());}};_0x7f58a2(++_0x68052b);}(_0xe9b8,0x116));var _0x8e9b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe9b8[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x8e9b('0x0'));var util=require(_0x8e9b('0x1'));var path=require(_0x8e9b('0x2'));var timeout=require(_0x8e9b('0x3'));var express=require(_0x8e9b('0x4'));var router=express[_0x8e9b('0x5')]();var fs_extra=require(_0x8e9b('0x6'));var auth=require(_0x8e9b('0x7'));var interaction=require(_0x8e9b('0x8'));var config=require(_0x8e9b('0x9'));var controller=require(_0x8e9b('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0x8e9b('0xb')]);router[_0x8e9b('0xc')](_0x8e9b('0xd'),auth[_0x8e9b('0xe')](),controller[_0x8e9b('0xf')]);router[_0x8e9b('0xc')]('/:id',auth[_0x8e9b('0xe')](),controller[_0x8e9b('0x10')]);router['get'](_0x8e9b('0x11'),auth['isAuthenticated'](),controller['getMembers']);router[_0x8e9b('0xc')]('/:id/teams',auth[_0x8e9b('0xe')](),controller[_0x8e9b('0x12')]);router[_0x8e9b('0xc')](_0x8e9b('0x13'),auth[_0x8e9b('0xe')](),controller[_0x8e9b('0x14')]);router['post']('/',auth[_0x8e9b('0xe')](),controller[_0x8e9b('0x15')]);router[_0x8e9b('0x16')](_0x8e9b('0x17'),auth['isAuthenticated'](),controller['addTeams']);router[_0x8e9b('0x16')]('/:id/users',auth[_0x8e9b('0xe')](),controller[_0x8e9b('0x18')]);router[_0x8e9b('0x19')]('/:id',auth[_0x8e9b('0xe')](),controller[_0x8e9b('0x1a')]);router[_0x8e9b('0x1b')](_0x8e9b('0x1c'),auth['isAuthenticated'](),controller[_0x8e9b('0x1d')]);router[_0x8e9b('0x1b')](_0x8e9b('0x17'),auth[_0x8e9b('0xe')](),controller[_0x8e9b('0x1e')]);router['delete'](_0x8e9b('0x13'),auth[_0x8e9b('0xe')](),controller[_0x8e9b('0x1f')]);module[_0x8e9b('0x20')]=router; \ No newline at end of file +var _0xca59=['/:id','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','/describe','describe','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','update','delete'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0xca59,0xf8));var _0x9ca5=function(_0x55ce54,_0x1fdbca){_0x55ce54=_0x55ce54-0x0;var _0x2c26e8=_0xca59[_0x55ce54];return _0x2c26e8;};'use strict';var multer=require(_0x9ca5('0x0'));var util=require(_0x9ca5('0x1'));var path=require('path');var timeout=require(_0x9ca5('0x2'));var express=require(_0x9ca5('0x3'));var router=express[_0x9ca5('0x4')]();var fs_extra=require(_0x9ca5('0x5'));var auth=require(_0x9ca5('0x6'));var interaction=require(_0x9ca5('0x7'));var config=require(_0x9ca5('0x8'));var controller=require(_0x9ca5('0x9'));router[_0x9ca5('0xa')]('/',auth[_0x9ca5('0xb')](),controller['index']);router[_0x9ca5('0xa')](_0x9ca5('0xc'),auth[_0x9ca5('0xb')](),controller[_0x9ca5('0xd')]);router[_0x9ca5('0xa')]('/:id',auth[_0x9ca5('0xb')](),controller['show']);router[_0x9ca5('0xa')](_0x9ca5('0xe'),auth[_0x9ca5('0xb')](),controller['getMembers']);router[_0x9ca5('0xa')](_0x9ca5('0xf'),auth[_0x9ca5('0xb')](),controller[_0x9ca5('0x10')]);router['get'](_0x9ca5('0x11'),auth[_0x9ca5('0xb')](),controller[_0x9ca5('0x12')]);router[_0x9ca5('0x13')]('/',auth[_0x9ca5('0xb')](),controller['create']);router['post'](_0x9ca5('0xf'),auth[_0x9ca5('0xb')](),controller['addTeams']);router[_0x9ca5('0x13')](_0x9ca5('0x11'),auth[_0x9ca5('0xb')](),controller['addAgents']);router['put']('/:id',auth[_0x9ca5('0xb')](),controller[_0x9ca5('0x14')]);router[_0x9ca5('0x15')](_0x9ca5('0x16'),auth['isAuthenticated'](),controller[_0x9ca5('0x17')]);router[_0x9ca5('0x15')](_0x9ca5('0xf'),auth[_0x9ca5('0xb')](),controller[_0x9ca5('0x18')]);router['delete'](_0x9ca5('0x11'),auth[_0x9ca5('0xb')](),controller[_0x9ca5('0x19')]);module[_0x9ca5('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index d5d673a..67074f0 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 _0x2abe=['roundrobin','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2abe,0x109));var _0xe2ab=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x2abe[_0x465a0c];return _0x1e202e;};'use strict';var Sequelize=require('sequelize');module[_0xe2ab('0x0')]={'name':{'type':Sequelize[_0xe2ab('0x1')],'unique':_0xe2ab('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe2ab('0x1')]},'timeout':{'type':Sequelize[_0xe2ab('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe2ab('0x4')](_0xe2ab('0x5'),_0xe2ab('0x6'),_0xe2ab('0x7'))}}; \ No newline at end of file +var _0x62d0=['exports','STRING','name','INTEGER','ENUM','rrmemory','roundrobin','sequelize'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x62d0,0x1bf));var _0x062d=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x62d0[_0x2070da];return _0x4f9fe1;};'use strict';var Sequelize=require(_0x062d('0x0'));module[_0x062d('0x1')]={'name':{'type':Sequelize[_0x062d('0x2')],'unique':_0x062d('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x062d('0x2')]},'timeout':{'type':Sequelize[_0x062d('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x062d('0x5')](_0x062d('0x6'),'beepall',_0x062d('0x7'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 6663c79..e16cbf3 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 _0x0879=['create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','UserMailQueue','hasOwnProperty','pick','MailQueueId','User','findAndCountAll','UserId','agent','mailPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','findOne','Team','addTeams','ids','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','select','field','from','team_has_mail_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','push','toString','SELECT','every','TeamId','includes','union','compact','value','isEmpty','removeAgents','userMailQueue:remove','addAgents','spread','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./mailQueue.socket','sendStatus','end','status','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','get','MailQueues','UserProfileResource','stack','name','index','rawAttributes','fieldName','key','query','keys','filters','attributes','intersection','model','fields','length','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','MailQueue','includeAll','include','findAll','rows','catch','show','params','user','role','UserProfileSection','find','userProfileId','autoAssociation'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x0879,0x1e9));var _0x9087=function(_0x20aed7,_0x441459){_0x20aed7=_0x20aed7-0x0;var _0x4480ae=_0x0879[_0x20aed7];return _0x4480ae;};'use strict';var emlformat=require(_0x9087('0x0'));var rimraf=require(_0x9087('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9087('0x2'));var rp=require(_0x9087('0x3'));var moment=require(_0x9087('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9087('0x5'));var util=require(_0x9087('0x6'));var path=require(_0x9087('0x7'));var sox=require(_0x9087('0x8'));var csv=require('to-csv');var ejs=require(_0x9087('0x9'));var fs=require('fs');var fs_extra=require(_0x9087('0xa'));var _=require(_0x9087('0xb'));var squel=require(_0x9087('0xc'));var crypto=require(_0x9087('0xd'));var jsforce=require(_0x9087('0xe'));var deskjs=require(_0x9087('0xf'));var toCsv=require('to-csv');var querystring=require(_0x9087('0x10'));var Papa=require('papaparse');var Redis=require(_0x9087('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9087('0x12'));var hardwareService=require(_0x9087('0x13'));var logger=require('../../config/logger')(_0x9087('0x14'));var utils=require(_0x9087('0x15'));var config=require(_0x9087('0x16'));var licenseUtil=require(_0x9087('0x17'));var db=require('../../mysqldb')['db'];config[_0x9087('0x18')]=_[_0x9087('0x19')](config[_0x9087('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x9087('0x1a'))(new Redis(config[_0x9087('0x18')]));require(_0x9087('0x1b'))['register'](socket);function respondWithStatusCode(_0x43e290,_0x377e9a){_0x377e9a=_0x377e9a||0xcc;return function(_0x250fb0){if(_0x250fb0){return _0x43e290[_0x9087('0x1c')](_0x377e9a);}return _0x43e290['status'](_0x377e9a)[_0x9087('0x1d')]();};}function respondWithResult(_0x144521,_0x51fc87){_0x51fc87=_0x51fc87||0xc8;return function(_0x47d3e3){if(_0x47d3e3){return _0x144521[_0x9087('0x1e')](_0x51fc87)['json'](_0x47d3e3);}};}function respondWithFilteredResult(_0x5590f9,_0xd9b1b){return function(_0x569a46){if(_0x569a46){var _0x45e93e=typeof _0xd9b1b[_0x9087('0x1f')]===_0x9087('0x20')&&typeof _0xd9b1b[_0x9087('0x21')]===_0x9087('0x20');var _0x1e99b7=_0x569a46[_0x9087('0x22')];var _0x2b36ad=_0x45e93e?0x0:_0xd9b1b['offset'];var _0x54b512=_0x45e93e?_0x569a46[_0x9087('0x22')]:_0xd9b1b[_0x9087('0x1f')]+_0xd9b1b[_0x9087('0x21')];var _0x209f95;if(_0x54b512>=_0x1e99b7){_0x54b512=_0x1e99b7;_0x209f95=0xc8;}else{_0x209f95=0xce;}_0x5590f9[_0x9087('0x1e')](_0x209f95);return _0x5590f9[_0x9087('0x23')]('Content-Range',_0x2b36ad+'-'+_0x54b512+'/'+_0x1e99b7)[_0x9087('0x24')](_0x569a46);}return null;};}function patchUpdates(_0x585c86){return function(_0x346707){try{jsonpatch[_0x9087('0x25')](_0x346707,_0x585c86,!![]);}catch(_0xc3cab4){return BPromise[_0x9087('0x26')](_0xc3cab4);}return _0x346707[_0x9087('0x27')]();};}function saveUpdates(_0x52713b,_0x45c711){return function(_0x17b43a){if(_0x17b43a){return _0x17b43a[_0x9087('0x28')](_0x52713b)[_0x9087('0x29')](function(_0x4f3e97){return _0x4f3e97;});}return null;};}function removeEntity(_0x73e123,_0x4ca6b7){return function(_0x228fd6){if(_0x228fd6){return _0x228fd6[_0x9087('0x2a')]()[_0x9087('0x29')](function(){var _0x3e4141=_0x228fd6[_0x9087('0x2b')]({'plain':!![]});var _0x5c25c7=_0x9087('0x2c');return db[_0x9087('0x2d')]['destroy']({'where':{'type':_0x5c25c7,'resourceId':_0x3e4141['id']}})[_0x9087('0x29')](function(){return _0x228fd6;});})[_0x9087('0x29')](function(){_0x73e123[_0x9087('0x1e')](0xcc)[_0x9087('0x1d')]();});}};}function handleEntityNotFound(_0x189929,_0x400919){return function(_0x306386){if(!_0x306386){_0x189929[_0x9087('0x1c')](0x194);}return _0x306386;};}function handleError(_0x572345,_0x23d9eb){_0x23d9eb=_0x23d9eb||0x1f4;return function(_0x28e922){logger['error'](_0x28e922[_0x9087('0x2e')]);if(_0x28e922[_0x9087('0x2f')]){delete _0x28e922['name'];}_0x572345[_0x9087('0x1e')](_0x23d9eb)['send'](_0x28e922);};}exports[_0x9087('0x30')]=function(_0x5b7b00,_0x118a8e){var _0x51fc25={},_0x18a83b={},_0x5484ee={'count':0x0,'rows':[]};var _0x3f6625=_['map'](db['MailQueue'][_0x9087('0x31')],function(_0x515b07){return{'name':_0x515b07[_0x9087('0x32')],'type':_0x515b07['type'][_0x9087('0x33')]};});_0x18a83b['model']=_['map'](_0x3f6625,_0x9087('0x2f'));_0x18a83b[_0x9087('0x34')]=_[_0x9087('0x35')](_0x5b7b00[_0x9087('0x34')]);_0x18a83b[_0x9087('0x36')]=_['intersection'](_0x18a83b['model'],_0x18a83b[_0x9087('0x34')]);_0x51fc25[_0x9087('0x37')]=_[_0x9087('0x38')](_0x18a83b[_0x9087('0x39')],qs[_0x9087('0x3a')](_0x5b7b00[_0x9087('0x34')][_0x9087('0x3a')]));_0x51fc25[_0x9087('0x37')]=_0x51fc25['attributes'][_0x9087('0x3b')]?_0x51fc25['attributes']:_0x18a83b[_0x9087('0x39')];if(!_0x5b7b00[_0x9087('0x34')]['hasOwnProperty'](_0x9087('0x3c'))){_0x51fc25[_0x9087('0x21')]=qs[_0x9087('0x21')](_0x5b7b00[_0x9087('0x34')][_0x9087('0x21')]);_0x51fc25[_0x9087('0x1f')]=qs['offset'](_0x5b7b00[_0x9087('0x34')][_0x9087('0x1f')]);}_0x51fc25[_0x9087('0x3d')]=qs[_0x9087('0x3e')](_0x5b7b00[_0x9087('0x34')]['sort']);_0x51fc25[_0x9087('0x3f')]=qs['filters'](_['pick'](_0x5b7b00['query'],_0x18a83b[_0x9087('0x36')]),_0x3f6625);if(_0x5b7b00[_0x9087('0x34')][_0x9087('0x40')]){_0x51fc25[_0x9087('0x3f')]=_[_0x9087('0x41')](_0x51fc25[_0x9087('0x3f')],{'$or':_[_0x9087('0x42')](_0x3f6625,function(_0x4cf5e2){if(_0x4cf5e2['type']!==_0x9087('0x43')){var _0x1e4f14={};_0x1e4f14[_0x4cf5e2[_0x9087('0x2f')]]={'$like':'%'+_0x5b7b00[_0x9087('0x34')][_0x9087('0x40')]+'%'};return _0x1e4f14;}})});}_0x51fc25=_[_0x9087('0x41')]({},_0x51fc25,_0x5b7b00[_0x9087('0x44')]);var _0x2f0d6d={'where':_0x51fc25['where']};return db[_0x9087('0x45')][_0x9087('0x22')](_0x2f0d6d)['then'](function(_0x37e532){_0x5484ee[_0x9087('0x22')]=_0x37e532;if(_0x5b7b00['query'][_0x9087('0x46')]){_0x51fc25[_0x9087('0x47')]=[{'all':!![]}];}return db['MailQueue'][_0x9087('0x48')](_0x51fc25);})['then'](function(_0x39fecb){_0x5484ee[_0x9087('0x49')]=_0x39fecb;return _0x5484ee;})['then'](respondWithFilteredResult(_0x118a8e,_0x51fc25))[_0x9087('0x4a')](handleError(_0x118a8e,null));};exports[_0x9087('0x4b')]=function(_0x3f0f99,_0x1a0742){var _0x1ddf7e={'raw':!![],'where':{'id':_0x3f0f99[_0x9087('0x4c')]['id']}},_0x5b2ef8={};_0x5b2ef8[_0x9087('0x39')]=_[_0x9087('0x35')](db['MailQueue'][_0x9087('0x31')]);_0x5b2ef8[_0x9087('0x34')]=_[_0x9087('0x35')](_0x3f0f99[_0x9087('0x34')]);_0x5b2ef8[_0x9087('0x36')]=_[_0x9087('0x38')](_0x5b2ef8['model'],_0x5b2ef8[_0x9087('0x34')]);_0x1ddf7e[_0x9087('0x37')]=_[_0x9087('0x38')](_0x5b2ef8[_0x9087('0x39')],qs[_0x9087('0x3a')](_0x3f0f99[_0x9087('0x34')][_0x9087('0x3a')]));_0x1ddf7e[_0x9087('0x37')]=_0x1ddf7e[_0x9087('0x37')][_0x9087('0x3b')]?_0x1ddf7e[_0x9087('0x37')]:_0x5b2ef8[_0x9087('0x39')];if(_0x3f0f99[_0x9087('0x34')][_0x9087('0x46')]){_0x1ddf7e['include']=[{'all':!![]}];}_0x1ddf7e=_['merge']({},_0x1ddf7e,_0x3f0f99[_0x9087('0x44')]);return db[_0x9087('0x45')]['find'](_0x1ddf7e)['then'](handleEntityNotFound(_0x1a0742,null))['then'](respondWithResult(_0x1a0742,null))[_0x9087('0x4a')](handleError(_0x1a0742,null));};exports['create']=function(_0x9f10a1,_0x257fbb){return db[_0x9087('0x45')]['create'](_0x9f10a1['body'],{})[_0x9087('0x29')](function(_0x16158d){var _0x18274=_0x9f10a1[_0x9087('0x4d')]['get']({'plain':!![]});if(!_0x18274)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x18274[_0x9087('0x4e')]===_0x9087('0x4d')){var _0x1ed0ee=_0x16158d['get']({'plain':!![]});var _0x52346a=_0x9087('0x2c');return db[_0x9087('0x4f')][_0x9087('0x50')]({'where':{'name':_0x52346a,'userProfileId':_0x18274[_0x9087('0x51')]},'raw':!![]})[_0x9087('0x29')](function(_0x32c2f9){if(_0x32c2f9&&_0x32c2f9[_0x9087('0x52')]===0x0){return db[_0x9087('0x2d')][_0x9087('0x53')]({'name':_0x1ed0ee['name'],'resourceId':_0x1ed0ee['id'],'type':_0x32c2f9['name'],'sectionId':_0x32c2f9['id']},{})[_0x9087('0x29')](function(){return _0x16158d;});}else{return _0x16158d;}})[_0x9087('0x4a')](function(_0x2a7837){logger[_0x9087('0x54')](_0x9087('0x55'),_0x2a7837);throw _0x2a7837;});}return _0x16158d;})['then'](respondWithResult(_0x257fbb,0xc9))[_0x9087('0x4a')](handleError(_0x257fbb,null));};exports[_0x9087('0x28')]=function(_0x459d23,_0x25dac1){if(_0x459d23['body']['id']){delete _0x459d23[_0x9087('0x56')]['id'];}return db[_0x9087('0x45')][_0x9087('0x50')]({'where':{'id':_0x459d23[_0x9087('0x4c')]['id']}})[_0x9087('0x29')](handleEntityNotFound(_0x25dac1,null))[_0x9087('0x29')](saveUpdates(_0x459d23[_0x9087('0x56')],null))['then'](respondWithResult(_0x25dac1,null))[_0x9087('0x4a')](handleError(_0x25dac1,null));};exports[_0x9087('0x2a')]=function(_0x190b17,_0x3cb66d){return db[_0x9087('0x45')][_0x9087('0x50')]({'where':{'id':_0x190b17[_0x9087('0x4c')]['id']}})[_0x9087('0x29')](handleEntityNotFound(_0x3cb66d,null))[_0x9087('0x29')](removeEntity(_0x3cb66d,null))[_0x9087('0x4a')](handleError(_0x3cb66d,null));};exports[_0x9087('0x57')]=function(_0x11663e,_0x7da4fb){return db['MailQueue']['describe']()[_0x9087('0x29')](respondWithResult(_0x7da4fb,null))['catch'](handleError(_0x7da4fb,null));};exports[_0x9087('0x58')]=function(_0x20e2d4,_0x171294,_0x8d69a1){var _0x3a0c31={'raw':!![],'where':{}},_0x13abc5={},_0x17aa11;return db[_0x9087('0x45')]['findOne']({'where':{'id':_0x20e2d4['params']['id']}})[_0x9087('0x29')](handleEntityNotFound(_0x171294,null))[_0x9087('0x29')](function(_0x4541bd){if(_0x4541bd){_0x17aa11=_0x4541bd[_0x9087('0x2b')]({'plain':!![]});_0x13abc5[_0x9087('0x39')]=_[_0x9087('0x35')](db[_0x9087('0x59')][_0x9087('0x31')]);_0x13abc5['query']=_[_0x9087('0x35')](_0x20e2d4[_0x9087('0x34')]);_0x13abc5[_0x9087('0x36')]=_['intersection'](_0x13abc5['model'],_0x13abc5[_0x9087('0x34')]);_0x3a0c31[_0x9087('0x37')]=_['intersection'](_0x13abc5[_0x9087('0x39')],qs[_0x9087('0x3a')](_0x20e2d4[_0x9087('0x34')][_0x9087('0x3a')]));_0x3a0c31[_0x9087('0x37')]=_0x3a0c31[_0x9087('0x37')][_0x9087('0x3b')]?_0x3a0c31[_0x9087('0x37')]:_0x13abc5[_0x9087('0x39')];if(!_0x20e2d4[_0x9087('0x34')][_0x9087('0x5a')](_0x9087('0x3c'))){_0x3a0c31[_0x9087('0x21')]=qs['limit'](_0x20e2d4[_0x9087('0x34')][_0x9087('0x21')]);_0x3a0c31[_0x9087('0x1f')]=qs[_0x9087('0x1f')](_0x20e2d4[_0x9087('0x34')][_0x9087('0x1f')]);}_0x3a0c31[_0x9087('0x3d')]=qs[_0x9087('0x3e')](_0x20e2d4[_0x9087('0x34')][_0x9087('0x3e')]);_0x3a0c31[_0x9087('0x3f')]=qs[_0x9087('0x36')](_[_0x9087('0x5b')](_0x20e2d4[_0x9087('0x34')],_0x13abc5[_0x9087('0x36')]));_0x3a0c31[_0x9087('0x3f')][_0x9087('0x5c')]=_0x4541bd['id'];if(_0x20e2d4['query'][_0x9087('0x40')]){_0x3a0c31['where']=_[_0x9087('0x41')](_0x3a0c31[_0x9087('0x3f')],{'$or':_['map'](_0x3a0c31[_0x9087('0x37')],function(_0x3266f4){var _0x9f5d42={};_0x9f5d42[_0x3266f4]={'$like':'%'+_0x20e2d4[_0x9087('0x34')][_0x9087('0x40')]+'%'};return _0x9f5d42;})});}_0x3a0c31=_[_0x9087('0x41')]({},_0x3a0c31,_0x20e2d4[_0x9087('0x44')]);return db[_0x9087('0x59')][_0x9087('0x48')](_0x3a0c31);}})['then'](function(_0x303d13){if(_0x303d13){return db[_0x9087('0x5d')][_0x9087('0x5e')]({'where':{'id':_[_0x9087('0x42')](_0x303d13,_0x9087('0x5f')),'role':_0x9087('0x60')},'attributes':['id',_0x9087('0x2f'),_0x9087('0x61'),_0x9087('0x62'),'createdAt']});}})[_0x9087('0x29')](function(_0x2c7d78){if(_0x2c7d78){return{'count':_0x2c7d78[_0x9087('0x22')],'rows':_[_0x9087('0x42')](_0x2c7d78['rows'],function(_0xe739b9){return{'membername':_0xe739b9[_0x9087('0x2f')],'UserId':_0xe739b9['id'],'queue_name':_0x17aa11['name'],'MailQueueId':_0x17aa11['id'],'interface':util[_0x9087('0x63')](_0x9087('0x64'),_0x9087('0x65'),_0xe739b9[_0x9087('0x2f')]),'penalty':0x0,'paused':_0xe739b9['mailPause'],'createdAt':_0xe739b9[_0x9087('0x66')],'updatedAt':_0xe739b9[_0x9087('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x9087('0x29')](respondWithFilteredResult(_0x171294,_0x3a0c31))[_0x9087('0x4a')](handleError(_0x171294,null));};exports[_0x9087('0x67')]=function(_0x1bf1f1,_0x5ecc95,_0x401deb){var _0x38945e={};var _0xd73918={};var _0x4ee2d5;var _0x210acb;return db[_0x9087('0x45')][_0x9087('0x68')]({'where':{'id':_0x1bf1f1[_0x9087('0x4c')]['id']}})[_0x9087('0x29')](handleEntityNotFound(_0x5ecc95,null))[_0x9087('0x29')](function(_0x2d303d){if(_0x2d303d){_0x4ee2d5=_0x2d303d;_0xd73918['model']=_[_0x9087('0x35')](db[_0x9087('0x69')][_0x9087('0x31')]);_0xd73918[_0x9087('0x34')]=_[_0x9087('0x35')](_0x1bf1f1[_0x9087('0x34')]);_0xd73918[_0x9087('0x36')]=_[_0x9087('0x38')](_0xd73918[_0x9087('0x39')],_0xd73918[_0x9087('0x34')]);_0x38945e[_0x9087('0x37')]=_[_0x9087('0x38')](_0xd73918[_0x9087('0x39')],qs['fields'](_0x1bf1f1[_0x9087('0x34')][_0x9087('0x3a')]));_0x38945e['attributes']=_0x38945e[_0x9087('0x37')][_0x9087('0x3b')]?_0x38945e[_0x9087('0x37')]:_0xd73918[_0x9087('0x39')];_0x38945e[_0x9087('0x3d')]=qs['sort'](_0x1bf1f1[_0x9087('0x34')][_0x9087('0x3e')]);_0x38945e[_0x9087('0x3f')]=qs[_0x9087('0x36')](_['pick'](_0x1bf1f1[_0x9087('0x34')],_0xd73918[_0x9087('0x36')]));if(_0x1bf1f1[_0x9087('0x34')][_0x9087('0x40')]){_0x38945e[_0x9087('0x3f')]=_[_0x9087('0x41')](_0x38945e[_0x9087('0x3f')],{'$or':_['map'](_0x38945e[_0x9087('0x37')],function(_0xe026e7){var _0x5afd5a={};_0x5afd5a[_0xe026e7]={'$like':'%'+_0x1bf1f1[_0x9087('0x34')]['filter']+'%'};return _0x5afd5a;})});}_0x38945e=_['merge']({},_0x38945e,_0x1bf1f1['options']);return _0x4ee2d5[_0x9087('0x67')](_0x38945e);}})[_0x9087('0x29')](function(_0x302196){if(_0x302196){_0x210acb=_0x302196[_0x9087('0x3b')];if(!_0x1bf1f1['query']['hasOwnProperty'](_0x9087('0x3c'))){_0x38945e['limit']=qs[_0x9087('0x21')](_0x1bf1f1['query']['limit']);_0x38945e['offset']=qs[_0x9087('0x1f')](_0x1bf1f1['query'][_0x9087('0x1f')]);}return _0x4ee2d5['getTeams'](_0x38945e);}})[_0x9087('0x29')](function(_0x2b47df){if(_0x2b47df){return _0x2b47df?{'count':_0x210acb,'rows':_0x2b47df}:null;}})[_0x9087('0x29')](respondWithResult(_0x5ecc95,null))['catch'](handleError(_0x5ecc95,null));};exports[_0x9087('0x6a')]=function(_0x2addcb,_0x1c5b12,_0x26542d){var _0x3a2000=_0x2addcb[_0x9087('0x56')][_0x9087('0x6b')];return db[_0x9087('0x69')][_0x9087('0x48')]({'where':{'id':_0x3a2000},'attributes':['id'],'include':[{'model':db[_0x9087('0x5d')],'as':_0x9087('0x6c'),'attributes':['id',_0x9087('0x2f'),_0x9087('0x6d'),'voicePause',_0x9087('0x6e')],'raw':!![]}]})[_0x9087('0x29')](function(_0x3f3afd){if(_0x3f3afd){var _0x8cf759=_[_0x9087('0x6f')](_0x3f3afd,function(_0x461b75){var _0x6257a2=_0x461b75[_0x9087('0x2b')]({'plain':!![]});return _0x6257a2[_0x9087('0x6c')];});return db[_0x9087('0x45')][_0x9087('0x50')]({'where':{'id':_0x2addcb[_0x9087('0x4c')]['id']}})[_0x9087('0x29')](function(_0x29ac9b){return db[_0x9087('0x70')][_0x9087('0x71')](function(_0xa0549d){return _0x29ac9b[_0x9087('0x6a')](_0x3a2000,{'transaction':_0xa0549d})[_0x9087('0x29')](function(){return BPromise[_0x9087('0x72')](_0x8cf759,function(_0x1fd554){return db[_0x9087('0x59')][_0x9087('0x73')]({'where':{'UserId':_0x1fd554['id'],'MailQueueId':_0x2addcb['params']['id']},'transaction':_0xa0549d});});})[_0x9087('0x29')](function(){_0x8cf759[_0x9087('0x74')](function(_0x284281){socket[_0x9087('0x75')](_0x9087('0x76'),{'UserId':_0x284281['id'],'MailQueueId':_0x29ac9b['id']});});});});});}})['then'](respondWithStatusCode(_0x1c5b12,null))[_0x9087('0x4a')](handleError(_0x1c5b12,null));};exports[_0x9087('0x77')]=function(_0x4b6a64,_0x2fe083,_0x26fbba){return db[_0x9087('0x69')][_0x9087('0x48')]({'where':{'id':_0x4b6a64[_0x9087('0x34')][_0x9087('0x6b')]},'attributes':['id'],'include':[{'model':db[_0x9087('0x5d')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x9087('0x29')](handleEntityNotFound(_0x2fe083,null))[_0x9087('0x29')](function(_0x4b866f){var _0x52ee44=_[_0x9087('0x42')](_0x4b866f,'id');var _0x9561f6=[];var _0x12195c=[];var _0x3cde6c=squel[_0x9087('0x78')]();_0x3cde6c[_0x9087('0x79')]('tq.TeamId')[_0x9087('0x7a')](_0x9087('0x7b'),'tq')['join'](_0x9087('0x7c'),'ut',_0x9087('0x7d'))['where'](_0x9087('0x7e'),_0x4b6a64[_0x9087('0x4c')]['id']);for(var _0x16bfe2=0x0;_0x16bfe2<_0x4b866f[_0x9087('0x3b')];_0x16bfe2+=0x1){let _0xd7a7ac=_0x4b866f[_0x16bfe2];for(var _0x14542a=0x0;_0x14542a<_0xd7a7ac[_0x9087('0x6c')][_0x9087('0x3b')];_0x14542a+=0x1){let _0x2fc810=_0xd7a7ac[_0x9087('0x6c')][_0x14542a];var _0x205906=_0x3cde6c[_0x9087('0x7f')]();_0x205906[_0x9087('0x3f')]('ut.UserId\x20=\x20?',_0x2fc810['id']);_0x12195c[_0x9087('0x80')](db['sequelize'][_0x9087('0x34')](_0x205906[_0x9087('0x81')](),{'type':db['sequelize']['QueryTypes'][_0x9087('0x82')]})[_0x9087('0x29')](function(_0x278ba3){if(_0x278ba3[_0x9087('0x3b')]===0x1){return _0x2fc810['id'];}else{var _0x5f0b19=_[_0x9087('0x83')](_['map'](_0x278ba3,_0x9087('0x84')),function(_0x15a53e){return _[_0x9087('0x85')](_0x52ee44,_0x15a53e);});if(_0x5f0b19){return _0x2fc810['id'];}}}));}}return BPromise['all'](_0x12195c)['then'](function(_0x4671cb){_0x9561f6=_(_0x9561f6)[_0x9087('0x86')](_0x4671cb)[_0x9087('0x87')]()[_0x9087('0x88')]();return db[_0x9087('0x45')][_0x9087('0x50')]({'where':{'id':_0x4b6a64[_0x9087('0x4c')]['id']}})['then'](function(_0x6190ed){return db['sequelize']['transaction'](function(_0x307162){return _0x6190ed[_0x9087('0x77')](_0x4b6a64[_0x9087('0x34')][_0x9087('0x6b')],{'transaction':_0x307162})[_0x9087('0x29')](function(){if(!_[_0x9087('0x89')](_0x9561f6)){return _0x6190ed[_0x9087('0x8a')](_0x9561f6,{'transaction':_0x307162});}})[_0x9087('0x29')](function(){_0x9561f6[_0x9087('0x74')](function(_0x5a0e8d){socket[_0x9087('0x75')](_0x9087('0x8b'),{'UserId':_0x5a0e8d,'MailQueueId':_0x6190ed['id']});});});});});});})[_0x9087('0x29')](respondWithStatusCode(_0x2fe083,null))['catch'](handleError(_0x2fe083,null));};exports['addAgents']=function(_0x527f7d,_0x137a24,_0x3d3ba2){return db['MailQueue'][_0x9087('0x50')]({'where':{'id':_0x527f7d[_0x9087('0x4c')]['id']}})[_0x9087('0x29')](handleEntityNotFound(_0x137a24,null))['then'](function(_0x42eb60){if(_0x42eb60){return _0x42eb60[_0x9087('0x8c')](_0x527f7d['body'][_0x9087('0x6b')],_['omit'](_0x527f7d[_0x9087('0x56')],['ids','id'])||{})[_0x9087('0x8d')](function(_0x2e38a5){for(var _0xabcb87=0x0;_0xabcb87<_0x527f7d['body'][_0x9087('0x6b')][_0x9087('0x3b')];_0xabcb87+=0x1){socket[_0x9087('0x75')](_0x9087('0x76'),{'UserId':Number(_0x527f7d[_0x9087('0x56')][_0x9087('0x6b')][_0xabcb87]),'MailQueueId':Number(_0x527f7d[_0x9087('0x4c')]['id'])});}return _0x2e38a5;});}})[_0x9087('0x29')](respondWithResult(_0x137a24,null))['catch'](handleError(_0x137a24,null));};exports[_0x9087('0x8a')]=function(_0x27d188,_0x2e9e1d,_0x107543){return db[_0x9087('0x45')]['find']({'where':{'id':_0x27d188[_0x9087('0x4c')]['id']}})[_0x9087('0x29')](handleEntityNotFound(_0x2e9e1d,null))['then'](function(_0x5482be){if(_0x5482be){return _0x5482be[_0x9087('0x8a')](_0x27d188['query'][_0x9087('0x6b')])['then'](function(){if(_['isArray'](_0x27d188[_0x9087('0x34')][_0x9087('0x6b')])){for(var _0x514213=0x0;_0x514213<_0x27d188[_0x9087('0x34')][_0x9087('0x6b')]['length'];_0x514213+=0x1){socket[_0x9087('0x75')]('userMailQueue:remove',{'UserId':Number(_0x27d188[_0x9087('0x34')]['ids'][_0x514213]),'MailQueueId':Number(_0x27d188[_0x9087('0x4c')]['id'])});}}else{socket['emit'](_0x9087('0x8b'),{'UserId':Number(_0x27d188['query'][_0x9087('0x6b')]),'MailQueueId':Number(_0x27d188[_0x9087('0x4c')]['id'])});}});}})[_0x9087('0x29')](respondWithStatusCode(_0x2e9e1d,null))['catch'](handleError(_0x2e9e1d,null));};exports[_0x9087('0x8e')]=function(_0x5dfa4c,_0x1e3750,_0x4d32e6){var _0x1588f6={};var _0x32d1e2={};var _0x161661;var _0x5c4ca9;return db[_0x9087('0x45')]['findOne']({'where':{'id':_0x5dfa4c['params']['id']}})[_0x9087('0x29')](handleEntityNotFound(_0x1e3750,null))[_0x9087('0x29')](function(_0x122435){if(_0x122435){_0x161661=_0x122435;_0x32d1e2[_0x9087('0x39')]=_['keys'](db[_0x9087('0x5d')]['rawAttributes']);_0x32d1e2[_0x9087('0x34')]=_['keys'](_0x5dfa4c[_0x9087('0x34')]);_0x32d1e2[_0x9087('0x36')]=_[_0x9087('0x38')](_0x32d1e2[_0x9087('0x39')],_0x32d1e2[_0x9087('0x34')]);_0x1588f6[_0x9087('0x37')]=_[_0x9087('0x38')](_0x32d1e2[_0x9087('0x39')],qs[_0x9087('0x3a')](_0x5dfa4c[_0x9087('0x34')]['fields']));_0x1588f6[_0x9087('0x37')]=_0x1588f6[_0x9087('0x37')][_0x9087('0x3b')]?_0x1588f6[_0x9087('0x37')]:_0x32d1e2[_0x9087('0x39')];_0x1588f6[_0x9087('0x3d')]=qs[_0x9087('0x3e')](_0x5dfa4c[_0x9087('0x34')][_0x9087('0x3e')]);_0x1588f6['where']=qs[_0x9087('0x36')](_[_0x9087('0x5b')](_0x5dfa4c[_0x9087('0x34')],_0x32d1e2['filters']));if(_0x5dfa4c[_0x9087('0x34')][_0x9087('0x40')]){_0x1588f6['where']=_['merge'](_0x1588f6[_0x9087('0x3f')],{'$or':_[_0x9087('0x42')](_0x1588f6[_0x9087('0x37')],function(_0x5abc6d){var _0x317d96={};_0x317d96[_0x5abc6d]={'$like':'%'+_0x5dfa4c[_0x9087('0x34')][_0x9087('0x40')]+'%'};return _0x317d96;})});}_0x1588f6=_['merge']({},_0x1588f6,_0x5dfa4c[_0x9087('0x44')]);return _0x161661[_0x9087('0x8e')](_0x1588f6);}})[_0x9087('0x29')](function(_0x2488b1){if(_0x2488b1){_0x5c4ca9=_0x2488b1['length'];if(!_0x5dfa4c[_0x9087('0x34')][_0x9087('0x5a')](_0x9087('0x3c'))){_0x1588f6[_0x9087('0x21')]=qs[_0x9087('0x21')](_0x5dfa4c[_0x9087('0x34')][_0x9087('0x21')]);_0x1588f6[_0x9087('0x1f')]=qs[_0x9087('0x1f')](_0x5dfa4c[_0x9087('0x34')]['offset']);}return _0x161661['getAgents'](_0x1588f6);}})[_0x9087('0x29')](function(_0x4b8403){if(_0x4b8403){return _0x4b8403?{'count':_0x5c4ca9,'rows':_0x4b8403}:null;}})[_0x9087('0x29')](respondWithResult(_0x1e3750,null))['catch'](handleError(_0x1e3750,null));}; \ No newline at end of file +var _0x4a3d=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./mailQueue.socket','register','status','end','offset','limit','undefined','count','apply','reject','save','update','destroy','then','get','MailQueues','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','MailQueue','include','findAll','rows','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserMailQueue','User','findAndCountAll','agent','mailPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','length','addTeams','ids','Team','Agents','online','voicePause','interface','sequelize','transaction','each','emit','userMailQueue:save','removeTeams','select','field','from','team_has_mail_queues','join','user_has_teams','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','includes','all','union','value','isEmpty','forEach','userMailQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x254673,_0x29e023){var _0x26075a=function(_0x41d8ae){while(--_0x41d8ae){_0x254673['push'](_0x254673['shift']());}};_0x26075a(++_0x29e023);}(_0x4a3d,0x79));var _0xd4a3=function(_0x5d02ea,_0x1781b1){_0x5d02ea=_0x5d02ea-0x0;var _0x54bee1=_0x4a3d[_0x5d02ea];return _0x54bee1;};'use strict';var emlformat=require(_0xd4a3('0x0'));var rimraf=require(_0xd4a3('0x1'));var zipdir=require(_0xd4a3('0x2'));var jsonpatch=require(_0xd4a3('0x3'));var rp=require(_0xd4a3('0x4'));var moment=require(_0xd4a3('0x5'));var BPromise=require(_0xd4a3('0x6'));var Mustache=require(_0xd4a3('0x7'));var util=require(_0xd4a3('0x8'));var path=require(_0xd4a3('0x9'));var sox=require(_0xd4a3('0xa'));var csv=require(_0xd4a3('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd4a3('0xc'));var squel=require(_0xd4a3('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd4a3('0xe'));var toCsv=require(_0xd4a3('0xb'));var querystring=require(_0xd4a3('0xf'));var Papa=require(_0xd4a3('0x10'));var Redis=require(_0xd4a3('0x11'));var authService=require(_0xd4a3('0x12'));var qs=require(_0xd4a3('0x13'));var as=require(_0xd4a3('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd4a3('0x15'))(_0xd4a3('0x16'));var utils=require(_0xd4a3('0x17'));var config=require(_0xd4a3('0x18'));var licenseUtil=require(_0xd4a3('0x19'));var db=require(_0xd4a3('0x1a'))['db'];config[_0xd4a3('0x1b')]=_['defaults'](config[_0xd4a3('0x1b')],{'host':_0xd4a3('0x1c'),'port':0x18eb});var socket=require(_0xd4a3('0x1d'))(new Redis(config[_0xd4a3('0x1b')]));require(_0xd4a3('0x1e'))[_0xd4a3('0x1f')](socket);function respondWithStatusCode(_0x2bfeb6,_0x306926){_0x306926=_0x306926||0xcc;return function(_0x5b9238){if(_0x5b9238){return _0x2bfeb6['sendStatus'](_0x306926);}return _0x2bfeb6[_0xd4a3('0x20')](_0x306926)[_0xd4a3('0x21')]();};}function respondWithResult(_0x124d03,_0xfd502c){_0xfd502c=_0xfd502c||0xc8;return function(_0x1c4dde){if(_0x1c4dde){return _0x124d03[_0xd4a3('0x20')](_0xfd502c)['json'](_0x1c4dde);}};}function respondWithFilteredResult(_0x2a3b7e,_0x56ab48){return function(_0xf9fc3c){if(_0xf9fc3c){var _0x592077=typeof _0x56ab48[_0xd4a3('0x22')]==='undefined'&&typeof _0x56ab48[_0xd4a3('0x23')]===_0xd4a3('0x24');var _0x4be8b7=_0xf9fc3c[_0xd4a3('0x25')];var _0x2677c5=_0x592077?0x0:_0x56ab48[_0xd4a3('0x22')];var _0x4c07f5=_0x592077?_0xf9fc3c['count']:_0x56ab48[_0xd4a3('0x22')]+_0x56ab48['limit'];var _0x402201;if(_0x4c07f5>=_0x4be8b7){_0x4c07f5=_0x4be8b7;_0x402201=0xc8;}else{_0x402201=0xce;}_0x2a3b7e[_0xd4a3('0x20')](_0x402201);return _0x2a3b7e['set']('Content-Range',_0x2677c5+'-'+_0x4c07f5+'/'+_0x4be8b7)['json'](_0xf9fc3c);}return null;};}function patchUpdates(_0x40535d){return function(_0xd558a8){try{jsonpatch[_0xd4a3('0x26')](_0xd558a8,_0x40535d,!![]);}catch(_0x5717f7){return BPromise[_0xd4a3('0x27')](_0x5717f7);}return _0xd558a8[_0xd4a3('0x28')]();};}function saveUpdates(_0x1a4ced,_0x2e632f){return function(_0xac252b){if(_0xac252b){return _0xac252b[_0xd4a3('0x29')](_0x1a4ced)['then'](function(_0x35a871){return _0x35a871;});}return null;};}function removeEntity(_0x1dea89,_0x50c8ac){return function(_0x2b6cd8){if(_0x2b6cd8){return _0x2b6cd8[_0xd4a3('0x2a')]()[_0xd4a3('0x2b')](function(){var _0x4ce98a=_0x2b6cd8[_0xd4a3('0x2c')]({'plain':!![]});var _0xf2c907=_0xd4a3('0x2d');return db['UserProfileResource'][_0xd4a3('0x2a')]({'where':{'type':_0xf2c907,'resourceId':_0x4ce98a['id']}})['then'](function(){return _0x2b6cd8;});})[_0xd4a3('0x2b')](function(){_0x1dea89['status'](0xcc)[_0xd4a3('0x21')]();});}};}function handleEntityNotFound(_0x5d84f2,_0x2769b7){return function(_0x535ecd){if(!_0x535ecd){_0x5d84f2[_0xd4a3('0x2e')](0x194);}return _0x535ecd;};}function handleError(_0x5d1039,_0x140b2b){_0x140b2b=_0x140b2b||0x1f4;return function(_0x31baf2){logger[_0xd4a3('0x2f')](_0x31baf2[_0xd4a3('0x30')]);if(_0x31baf2[_0xd4a3('0x31')]){delete _0x31baf2['name'];}_0x5d1039['status'](_0x140b2b)[_0xd4a3('0x32')](_0x31baf2);};}exports[_0xd4a3('0x33')]=function(_0x220e0a,_0x168d9f){var _0x51840f={},_0x249e83={},_0x3c59c9={'count':0x0,'rows':[]};var _0x515eb6=_[_0xd4a3('0x34')](db['MailQueue'][_0xd4a3('0x35')],function(_0xf6fb14){return{'name':_0xf6fb14[_0xd4a3('0x36')],'type':_0xf6fb14[_0xd4a3('0x37')][_0xd4a3('0x38')]};});_0x249e83[_0xd4a3('0x39')]=_[_0xd4a3('0x34')](_0x515eb6,_0xd4a3('0x31'));_0x249e83[_0xd4a3('0x3a')]=_['keys'](_0x220e0a[_0xd4a3('0x3a')]);_0x249e83[_0xd4a3('0x3b')]=_[_0xd4a3('0x3c')](_0x249e83['model'],_0x249e83[_0xd4a3('0x3a')]);_0x51840f[_0xd4a3('0x3d')]=_[_0xd4a3('0x3c')](_0x249e83[_0xd4a3('0x39')],qs[_0xd4a3('0x3e')](_0x220e0a[_0xd4a3('0x3a')][_0xd4a3('0x3e')]));_0x51840f['attributes']=_0x51840f[_0xd4a3('0x3d')]['length']?_0x51840f['attributes']:_0x249e83[_0xd4a3('0x39')];if(!_0x220e0a[_0xd4a3('0x3a')][_0xd4a3('0x3f')](_0xd4a3('0x40'))){_0x51840f['limit']=qs[_0xd4a3('0x23')](_0x220e0a['query'][_0xd4a3('0x23')]);_0x51840f[_0xd4a3('0x22')]=qs[_0xd4a3('0x22')](_0x220e0a[_0xd4a3('0x3a')]['offset']);}_0x51840f[_0xd4a3('0x41')]=qs[_0xd4a3('0x42')](_0x220e0a[_0xd4a3('0x3a')][_0xd4a3('0x42')]);_0x51840f['where']=qs['filters'](_[_0xd4a3('0x43')](_0x220e0a[_0xd4a3('0x3a')],_0x249e83[_0xd4a3('0x3b')]),_0x515eb6);if(_0x220e0a[_0xd4a3('0x3a')][_0xd4a3('0x44')]){_0x51840f[_0xd4a3('0x45')]=_[_0xd4a3('0x46')](_0x51840f['where'],{'$or':_['map'](_0x515eb6,function(_0x72c93d){if(_0x72c93d[_0xd4a3('0x37')]!==_0xd4a3('0x47')){var _0xc16db9={};_0xc16db9[_0x72c93d[_0xd4a3('0x31')]]={'$like':'%'+_0x220e0a[_0xd4a3('0x3a')][_0xd4a3('0x44')]+'%'};return _0xc16db9;}})});}_0x51840f=_[_0xd4a3('0x46')]({},_0x51840f,_0x220e0a[_0xd4a3('0x48')]);var _0x7188bd={'where':_0x51840f['where']};return db[_0xd4a3('0x49')][_0xd4a3('0x25')](_0x7188bd)[_0xd4a3('0x2b')](function(_0x40b847){_0x3c59c9['count']=_0x40b847;if(_0x220e0a[_0xd4a3('0x3a')]['includeAll']){_0x51840f[_0xd4a3('0x4a')]=[{'all':!![]}];}return db['MailQueue'][_0xd4a3('0x4b')](_0x51840f);})[_0xd4a3('0x2b')](function(_0x1bbf98){_0x3c59c9[_0xd4a3('0x4c')]=_0x1bbf98;return _0x3c59c9;})[_0xd4a3('0x2b')](respondWithFilteredResult(_0x168d9f,_0x51840f))['catch'](handleError(_0x168d9f,null));};exports[_0xd4a3('0x4d')]=function(_0x1bf79a,_0x25fde9){var _0x4b421b={'raw':!![],'where':{'id':_0x1bf79a[_0xd4a3('0x4e')]['id']}},_0x63a29d={};_0x63a29d['model']=_[_0xd4a3('0x4f')](db[_0xd4a3('0x49')][_0xd4a3('0x35')]);_0x63a29d[_0xd4a3('0x3a')]=_[_0xd4a3('0x4f')](_0x1bf79a['query']);_0x63a29d['filters']=_[_0xd4a3('0x3c')](_0x63a29d[_0xd4a3('0x39')],_0x63a29d[_0xd4a3('0x3a')]);_0x4b421b[_0xd4a3('0x3d')]=_[_0xd4a3('0x3c')](_0x63a29d[_0xd4a3('0x39')],qs[_0xd4a3('0x3e')](_0x1bf79a[_0xd4a3('0x3a')]['fields']));_0x4b421b[_0xd4a3('0x3d')]=_0x4b421b[_0xd4a3('0x3d')]['length']?_0x4b421b['attributes']:_0x63a29d[_0xd4a3('0x39')];if(_0x1bf79a['query']['includeAll']){_0x4b421b[_0xd4a3('0x4a')]=[{'all':!![]}];}_0x4b421b=_[_0xd4a3('0x46')]({},_0x4b421b,_0x1bf79a[_0xd4a3('0x48')]);return db[_0xd4a3('0x49')][_0xd4a3('0x50')](_0x4b421b)[_0xd4a3('0x2b')](handleEntityNotFound(_0x25fde9,null))['then'](respondWithResult(_0x25fde9,null))['catch'](handleError(_0x25fde9,null));};exports['create']=function(_0x2b9ea9,_0x52ee9f){return db[_0xd4a3('0x49')][_0xd4a3('0x51')](_0x2b9ea9[_0xd4a3('0x52')],{})[_0xd4a3('0x2b')](function(_0x37cdd3){var _0x1ec9a3=_0x2b9ea9[_0xd4a3('0x53')]['get']({'plain':!![]});if(!_0x1ec9a3)throw new Error(_0xd4a3('0x54'));if(_0x1ec9a3['role']===_0xd4a3('0x53')){var _0x5665a0=_0x37cdd3[_0xd4a3('0x2c')]({'plain':!![]});var _0x31d2ca='MailQueues';return db[_0xd4a3('0x55')][_0xd4a3('0x50')]({'where':{'name':_0x31d2ca,'userProfileId':_0x1ec9a3['userProfileId']},'raw':!![]})[_0xd4a3('0x2b')](function(_0x155744){if(_0x155744&&_0x155744[_0xd4a3('0x56')]===0x0){return db['UserProfileResource'][_0xd4a3('0x51')]({'name':_0x5665a0[_0xd4a3('0x31')],'resourceId':_0x5665a0['id'],'type':_0x155744[_0xd4a3('0x31')],'sectionId':_0x155744['id']},{})['then'](function(){return _0x37cdd3;});}else{return _0x37cdd3;}})[_0xd4a3('0x57')](function(_0x100f76){logger['error'](_0xd4a3('0x58'),_0x100f76);throw _0x100f76;});}return _0x37cdd3;})[_0xd4a3('0x2b')](respondWithResult(_0x52ee9f,0xc9))[_0xd4a3('0x57')](handleError(_0x52ee9f,null));};exports[_0xd4a3('0x29')]=function(_0x2c7cc3,_0x142e6d){if(_0x2c7cc3['body']['id']){delete _0x2c7cc3[_0xd4a3('0x52')]['id'];}return db[_0xd4a3('0x49')][_0xd4a3('0x50')]({'where':{'id':_0x2c7cc3[_0xd4a3('0x4e')]['id']}})[_0xd4a3('0x2b')](handleEntityNotFound(_0x142e6d,null))[_0xd4a3('0x2b')](saveUpdates(_0x2c7cc3[_0xd4a3('0x52')],null))[_0xd4a3('0x2b')](respondWithResult(_0x142e6d,null))[_0xd4a3('0x57')](handleError(_0x142e6d,null));};exports[_0xd4a3('0x2a')]=function(_0x150da5,_0x3b1f21){return db[_0xd4a3('0x49')][_0xd4a3('0x50')]({'where':{'id':_0x150da5[_0xd4a3('0x4e')]['id']}})[_0xd4a3('0x2b')](handleEntityNotFound(_0x3b1f21,null))[_0xd4a3('0x2b')](removeEntity(_0x3b1f21,null))[_0xd4a3('0x57')](handleError(_0x3b1f21,null));};exports['describe']=function(_0x25f94f,_0x1811db){return db[_0xd4a3('0x49')][_0xd4a3('0x59')]()[_0xd4a3('0x2b')](respondWithResult(_0x1811db,null))[_0xd4a3('0x57')](handleError(_0x1811db,null));};exports[_0xd4a3('0x5a')]=function(_0x54feef,_0x572f29,_0x4293bf){var _0x55edc8={'raw':!![],'where':{}},_0x1c3819={},_0x2209a5;return db[_0xd4a3('0x49')][_0xd4a3('0x5b')]({'where':{'id':_0x54feef[_0xd4a3('0x4e')]['id']}})['then'](handleEntityNotFound(_0x572f29,null))['then'](function(_0x434970){if(_0x434970){_0x2209a5=_0x434970[_0xd4a3('0x2c')]({'plain':!![]});_0x1c3819[_0xd4a3('0x39')]=_[_0xd4a3('0x4f')](db['UserMailQueue']['rawAttributes']);_0x1c3819[_0xd4a3('0x3a')]=_[_0xd4a3('0x4f')](_0x54feef[_0xd4a3('0x3a')]);_0x1c3819['filters']=_['intersection'](_0x1c3819['model'],_0x1c3819[_0xd4a3('0x3a')]);_0x55edc8['attributes']=_[_0xd4a3('0x3c')](_0x1c3819[_0xd4a3('0x39')],qs[_0xd4a3('0x3e')](_0x54feef[_0xd4a3('0x3a')]['fields']));_0x55edc8[_0xd4a3('0x3d')]=_0x55edc8[_0xd4a3('0x3d')]['length']?_0x55edc8[_0xd4a3('0x3d')]:_0x1c3819[_0xd4a3('0x39')];if(!_0x54feef['query']['hasOwnProperty']('nolimit')){_0x55edc8[_0xd4a3('0x23')]=qs[_0xd4a3('0x23')](_0x54feef[_0xd4a3('0x3a')][_0xd4a3('0x23')]);_0x55edc8[_0xd4a3('0x22')]=qs[_0xd4a3('0x22')](_0x54feef['query'][_0xd4a3('0x22')]);}_0x55edc8['order']=qs['sort'](_0x54feef['query'][_0xd4a3('0x42')]);_0x55edc8[_0xd4a3('0x45')]=qs[_0xd4a3('0x3b')](_[_0xd4a3('0x43')](_0x54feef[_0xd4a3('0x3a')],_0x1c3819[_0xd4a3('0x3b')]));_0x55edc8[_0xd4a3('0x45')]['MailQueueId']=_0x434970['id'];if(_0x54feef[_0xd4a3('0x3a')][_0xd4a3('0x44')]){_0x55edc8[_0xd4a3('0x45')]=_[_0xd4a3('0x46')](_0x55edc8[_0xd4a3('0x45')],{'$or':_[_0xd4a3('0x34')](_0x55edc8[_0xd4a3('0x3d')],function(_0x4624cb){var _0x2a0b97={};_0x2a0b97[_0x4624cb]={'$like':'%'+_0x54feef[_0xd4a3('0x3a')]['filter']+'%'};return _0x2a0b97;})});}_0x55edc8=_[_0xd4a3('0x46')]({},_0x55edc8,_0x54feef['options']);return db[_0xd4a3('0x5c')]['findAll'](_0x55edc8);}})['then'](function(_0x5dab1b){if(_0x5dab1b){return db[_0xd4a3('0x5d')][_0xd4a3('0x5e')]({'where':{'id':_[_0xd4a3('0x34')](_0x5dab1b,'UserId'),'role':_0xd4a3('0x5f')},'attributes':['id','name',_0xd4a3('0x60'),_0xd4a3('0x61'),_0xd4a3('0x62')]});}})[_0xd4a3('0x2b')](function(_0x4b5ec5){if(_0x4b5ec5){return{'count':_0x4b5ec5[_0xd4a3('0x25')],'rows':_[_0xd4a3('0x34')](_0x4b5ec5[_0xd4a3('0x4c')],function(_0x417185){return{'membername':_0x417185['name'],'UserId':_0x417185['id'],'queue_name':_0x2209a5['name'],'MailQueueId':_0x2209a5['id'],'interface':util[_0xd4a3('0x63')](_0xd4a3('0x64'),_0xd4a3('0x65'),_0x417185[_0xd4a3('0x31')]),'penalty':0x0,'paused':_0x417185['mailPause'],'createdAt':_0x417185[_0xd4a3('0x62')],'updatedAt':_0x417185['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x572f29,_0x55edc8))[_0xd4a3('0x57')](handleError(_0x572f29,null));};exports[_0xd4a3('0x66')]=function(_0x2830ff,_0x71d99f,_0x133ff0){var _0x56507b={};var _0x4b01ad={};var _0x5a6b1f;var _0xf0b78d;return db[_0xd4a3('0x49')]['findOne']({'where':{'id':_0x2830ff[_0xd4a3('0x4e')]['id']}})[_0xd4a3('0x2b')](handleEntityNotFound(_0x71d99f,null))['then'](function(_0x244440){if(_0x244440){_0x5a6b1f=_0x244440;_0x4b01ad[_0xd4a3('0x39')]=_['keys'](db['Team'][_0xd4a3('0x35')]);_0x4b01ad[_0xd4a3('0x3a')]=_[_0xd4a3('0x4f')](_0x2830ff['query']);_0x4b01ad[_0xd4a3('0x3b')]=_[_0xd4a3('0x3c')](_0x4b01ad[_0xd4a3('0x39')],_0x4b01ad[_0xd4a3('0x3a')]);_0x56507b[_0xd4a3('0x3d')]=_[_0xd4a3('0x3c')](_0x4b01ad[_0xd4a3('0x39')],qs[_0xd4a3('0x3e')](_0x2830ff[_0xd4a3('0x3a')][_0xd4a3('0x3e')]));_0x56507b[_0xd4a3('0x3d')]=_0x56507b['attributes'][_0xd4a3('0x67')]?_0x56507b[_0xd4a3('0x3d')]:_0x4b01ad['model'];_0x56507b[_0xd4a3('0x41')]=qs[_0xd4a3('0x42')](_0x2830ff['query'][_0xd4a3('0x42')]);_0x56507b[_0xd4a3('0x45')]=qs[_0xd4a3('0x3b')](_[_0xd4a3('0x43')](_0x2830ff[_0xd4a3('0x3a')],_0x4b01ad['filters']));if(_0x2830ff[_0xd4a3('0x3a')]['filter']){_0x56507b['where']=_[_0xd4a3('0x46')](_0x56507b[_0xd4a3('0x45')],{'$or':_[_0xd4a3('0x34')](_0x56507b['attributes'],function(_0x552cfe){var _0x34bd67={};_0x34bd67[_0x552cfe]={'$like':'%'+_0x2830ff[_0xd4a3('0x3a')][_0xd4a3('0x44')]+'%'};return _0x34bd67;})});}_0x56507b=_[_0xd4a3('0x46')]({},_0x56507b,_0x2830ff[_0xd4a3('0x48')]);return _0x5a6b1f[_0xd4a3('0x66')](_0x56507b);}})[_0xd4a3('0x2b')](function(_0x497909){if(_0x497909){_0xf0b78d=_0x497909[_0xd4a3('0x67')];if(!_0x2830ff['query'][_0xd4a3('0x3f')](_0xd4a3('0x40'))){_0x56507b[_0xd4a3('0x23')]=qs[_0xd4a3('0x23')](_0x2830ff[_0xd4a3('0x3a')]['limit']);_0x56507b[_0xd4a3('0x22')]=qs[_0xd4a3('0x22')](_0x2830ff[_0xd4a3('0x3a')][_0xd4a3('0x22')]);}return _0x5a6b1f[_0xd4a3('0x66')](_0x56507b);}})[_0xd4a3('0x2b')](function(_0x34875b){if(_0x34875b){return _0x34875b?{'count':_0xf0b78d,'rows':_0x34875b}:null;}})['then'](respondWithResult(_0x71d99f,null))['catch'](handleError(_0x71d99f,null));};exports[_0xd4a3('0x68')]=function(_0xe8563d,_0x4ab255,_0x1b7a08){var _0x8f19cf=_0xe8563d[_0xd4a3('0x52')][_0xd4a3('0x69')];return db[_0xd4a3('0x6a')][_0xd4a3('0x4b')]({'where':{'id':_0x8f19cf},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd4a3('0x6b'),'attributes':['id',_0xd4a3('0x31'),_0xd4a3('0x6c'),_0xd4a3('0x6d'),_0xd4a3('0x6e')],'raw':!![]}]})[_0xd4a3('0x2b')](function(_0x3ef5c0){if(_0x3ef5c0){var _0x4ca2e3=_['flatMap'](_0x3ef5c0,function(_0x5a8996){var _0x313cf9=_0x5a8996[_0xd4a3('0x2c')]({'plain':!![]});return _0x313cf9[_0xd4a3('0x6b')];});return db[_0xd4a3('0x49')][_0xd4a3('0x50')]({'where':{'id':_0xe8563d[_0xd4a3('0x4e')]['id']}})['then'](function(_0x143e7d){return db[_0xd4a3('0x6f')][_0xd4a3('0x70')](function(_0x144fde){return _0x143e7d[_0xd4a3('0x68')](_0x8f19cf,{'transaction':_0x144fde})[_0xd4a3('0x2b')](function(){return BPromise[_0xd4a3('0x71')](_0x4ca2e3,function(_0x582430){return db[_0xd4a3('0x5c')]['findOrCreate']({'where':{'UserId':_0x582430['id'],'MailQueueId':_0xe8563d[_0xd4a3('0x4e')]['id']},'transaction':_0x144fde});});})['then'](function(){_0x4ca2e3['forEach'](function(_0x5dcf14){socket[_0xd4a3('0x72')](_0xd4a3('0x73'),{'UserId':_0x5dcf14['id'],'MailQueueId':_0x143e7d['id']});});});});});}})[_0xd4a3('0x2b')](respondWithStatusCode(_0x4ab255,null))[_0xd4a3('0x57')](handleError(_0x4ab255,null));};exports[_0xd4a3('0x74')]=function(_0x3024b7,_0x3a9c63,_0x54aa05){return db[_0xd4a3('0x6a')]['findAll']({'where':{'id':_0x3024b7[_0xd4a3('0x3a')][_0xd4a3('0x69')]},'attributes':['id'],'include':[{'model':db[_0xd4a3('0x5d')],'as':_0xd4a3('0x6b'),'attributes':['id'],'raw':!![]}]})[_0xd4a3('0x2b')](handleEntityNotFound(_0x3a9c63,null))[_0xd4a3('0x2b')](function(_0x1c9f6b){var _0x50c41c=_[_0xd4a3('0x34')](_0x1c9f6b,'id');var _0x1d14b3=[];var _0x361f08=[];var _0x10c50b=squel[_0xd4a3('0x75')]();_0x10c50b[_0xd4a3('0x76')]('tq.TeamId')[_0xd4a3('0x77')](_0xd4a3('0x78'),'tq')[_0xd4a3('0x79')](_0xd4a3('0x7a'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xd4a3('0x45')]('MailQueueId\x20=\x20?',_0x3024b7['params']['id']);for(var _0x4c0549=0x0;_0x4c0549<_0x1c9f6b[_0xd4a3('0x67')];_0x4c0549+=0x1){let _0x3c9084=_0x1c9f6b[_0x4c0549];for(var _0x463afa=0x0;_0x463afa<_0x3c9084[_0xd4a3('0x6b')]['length'];_0x463afa+=0x1){let _0x2faa1f=_0x3c9084['Agents'][_0x463afa];var _0x52e115=_0x10c50b[_0xd4a3('0x7b')]();_0x52e115[_0xd4a3('0x45')](_0xd4a3('0x7c'),_0x2faa1f['id']);_0x361f08[_0xd4a3('0x7d')](db[_0xd4a3('0x6f')][_0xd4a3('0x3a')](_0x52e115[_0xd4a3('0x7e')](),{'type':db[_0xd4a3('0x6f')]['QueryTypes'][_0xd4a3('0x7f')]})[_0xd4a3('0x2b')](function(_0x688288){if(_0x688288[_0xd4a3('0x67')]===0x1){return _0x2faa1f['id'];}else{var _0x1df43a=_[_0xd4a3('0x80')](_[_0xd4a3('0x34')](_0x688288,'TeamId'),function(_0x4ac4b6){return _[_0xd4a3('0x81')](_0x50c41c,_0x4ac4b6);});if(_0x1df43a){return _0x2faa1f['id'];}}}));}}return BPromise[_0xd4a3('0x82')](_0x361f08)[_0xd4a3('0x2b')](function(_0x2f622d){_0x1d14b3=_(_0x1d14b3)[_0xd4a3('0x83')](_0x2f622d)['compact']()[_0xd4a3('0x84')]();return db[_0xd4a3('0x49')][_0xd4a3('0x50')]({'where':{'id':_0x3024b7[_0xd4a3('0x4e')]['id']}})[_0xd4a3('0x2b')](function(_0x28e6de){return db[_0xd4a3('0x6f')][_0xd4a3('0x70')](function(_0x116039){return _0x28e6de['removeTeams'](_0x3024b7[_0xd4a3('0x3a')][_0xd4a3('0x69')],{'transaction':_0x116039})['then'](function(){if(!_[_0xd4a3('0x85')](_0x1d14b3)){return _0x28e6de['removeAgents'](_0x1d14b3,{'transaction':_0x116039});}})[_0xd4a3('0x2b')](function(){_0x1d14b3[_0xd4a3('0x86')](function(_0x35de4a){socket['emit'](_0xd4a3('0x87'),{'UserId':_0x35de4a,'MailQueueId':_0x28e6de['id']});});});});});});})[_0xd4a3('0x2b')](respondWithStatusCode(_0x3a9c63,null))[_0xd4a3('0x57')](handleError(_0x3a9c63,null));};exports[_0xd4a3('0x88')]=function(_0x1e60d0,_0x17366d,_0x644f08){return db[_0xd4a3('0x49')][_0xd4a3('0x50')]({'where':{'id':_0x1e60d0[_0xd4a3('0x4e')]['id']}})[_0xd4a3('0x2b')](handleEntityNotFound(_0x17366d,null))[_0xd4a3('0x2b')](function(_0x58080b){if(_0x58080b){return _0x58080b[_0xd4a3('0x88')](_0x1e60d0[_0xd4a3('0x52')][_0xd4a3('0x69')],_[_0xd4a3('0x89')](_0x1e60d0['body'],['ids','id'])||{})[_0xd4a3('0x8a')](function(_0x1da4c3){for(var _0x546aaa=0x0;_0x546aaa<_0x1e60d0['body'][_0xd4a3('0x69')][_0xd4a3('0x67')];_0x546aaa+=0x1){socket[_0xd4a3('0x72')](_0xd4a3('0x73'),{'UserId':Number(_0x1e60d0[_0xd4a3('0x52')][_0xd4a3('0x69')][_0x546aaa]),'MailQueueId':Number(_0x1e60d0[_0xd4a3('0x4e')]['id'])});}return _0x1da4c3;});}})[_0xd4a3('0x2b')](respondWithResult(_0x17366d,null))[_0xd4a3('0x57')](handleError(_0x17366d,null));};exports[_0xd4a3('0x8b')]=function(_0x1ca437,_0x14c364,_0xac0888){return db[_0xd4a3('0x49')]['find']({'where':{'id':_0x1ca437['params']['id']}})[_0xd4a3('0x2b')](handleEntityNotFound(_0x14c364,null))[_0xd4a3('0x2b')](function(_0x2a2c4c){if(_0x2a2c4c){return _0x2a2c4c['removeAgents'](_0x1ca437['query'][_0xd4a3('0x69')])['then'](function(){if(_[_0xd4a3('0x8c')](_0x1ca437['query'][_0xd4a3('0x69')])){for(var _0x40a314=0x0;_0x40a314<_0x1ca437['query'][_0xd4a3('0x69')]['length'];_0x40a314+=0x1){socket['emit'](_0xd4a3('0x87'),{'UserId':Number(_0x1ca437['query'][_0xd4a3('0x69')][_0x40a314]),'MailQueueId':Number(_0x1ca437[_0xd4a3('0x4e')]['id'])});}}else{socket[_0xd4a3('0x72')](_0xd4a3('0x87'),{'UserId':Number(_0x1ca437[_0xd4a3('0x3a')][_0xd4a3('0x69')]),'MailQueueId':Number(_0x1ca437[_0xd4a3('0x4e')]['id'])});}});}})[_0xd4a3('0x2b')](respondWithStatusCode(_0x14c364,null))[_0xd4a3('0x57')](handleError(_0x14c364,null));};exports['getAgents']=function(_0x23d0eb,_0x267ed0,_0x549bad){var _0x139f27={};var _0xa374da={};var _0x16b889;var _0x4af9ec;return db['MailQueue'][_0xd4a3('0x5b')]({'where':{'id':_0x23d0eb[_0xd4a3('0x4e')]['id']}})[_0xd4a3('0x2b')](handleEntityNotFound(_0x267ed0,null))[_0xd4a3('0x2b')](function(_0x458f15){if(_0x458f15){_0x16b889=_0x458f15;_0xa374da[_0xd4a3('0x39')]=_[_0xd4a3('0x4f')](db[_0xd4a3('0x5d')]['rawAttributes']);_0xa374da[_0xd4a3('0x3a')]=_['keys'](_0x23d0eb[_0xd4a3('0x3a')]);_0xa374da['filters']=_[_0xd4a3('0x3c')](_0xa374da[_0xd4a3('0x39')],_0xa374da[_0xd4a3('0x3a')]);_0x139f27[_0xd4a3('0x3d')]=_[_0xd4a3('0x3c')](_0xa374da[_0xd4a3('0x39')],qs['fields'](_0x23d0eb[_0xd4a3('0x3a')][_0xd4a3('0x3e')]));_0x139f27[_0xd4a3('0x3d')]=_0x139f27[_0xd4a3('0x3d')]['length']?_0x139f27[_0xd4a3('0x3d')]:_0xa374da[_0xd4a3('0x39')];_0x139f27[_0xd4a3('0x41')]=qs[_0xd4a3('0x42')](_0x23d0eb[_0xd4a3('0x3a')][_0xd4a3('0x42')]);_0x139f27[_0xd4a3('0x45')]=qs[_0xd4a3('0x3b')](_[_0xd4a3('0x43')](_0x23d0eb[_0xd4a3('0x3a')],_0xa374da[_0xd4a3('0x3b')]));if(_0x23d0eb[_0xd4a3('0x3a')][_0xd4a3('0x44')]){_0x139f27[_0xd4a3('0x45')]=_[_0xd4a3('0x46')](_0x139f27[_0xd4a3('0x45')],{'$or':_[_0xd4a3('0x34')](_0x139f27[_0xd4a3('0x3d')],function(_0x50dd61){var _0x4f4d4d={};_0x4f4d4d[_0x50dd61]={'$like':'%'+_0x23d0eb['query'][_0xd4a3('0x44')]+'%'};return _0x4f4d4d;})});}_0x139f27=_['merge']({},_0x139f27,_0x23d0eb[_0xd4a3('0x48')]);return _0x16b889[_0xd4a3('0x8d')](_0x139f27);}})[_0xd4a3('0x2b')](function(_0x4c86df){if(_0x4c86df){_0x4af9ec=_0x4c86df[_0xd4a3('0x67')];if(!_0x23d0eb[_0xd4a3('0x3a')][_0xd4a3('0x3f')](_0xd4a3('0x40'))){_0x139f27[_0xd4a3('0x23')]=qs['limit'](_0x23d0eb[_0xd4a3('0x3a')]['limit']);_0x139f27[_0xd4a3('0x22')]=qs[_0xd4a3('0x22')](_0x23d0eb[_0xd4a3('0x3a')][_0xd4a3('0x22')]);}return _0x16b889[_0xd4a3('0x8d')](_0x139f27);}})[_0xd4a3('0x2b')](function(_0x12d586){if(_0x12d586){return _0x12d586?{'count':_0x4af9ec,'rows':_0x12d586}:null;}})['then'](respondWithResult(_0x267ed0,null))[_0xd4a3('0x57')](handleError(_0x267ed0,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index e38cc70..ae9db1e 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 _0x167c=['events','save','update','remove','hasOwnProperty','hook','exports'];(function(_0xe41448,_0x2dd011){var _0x2ad7fa=function(_0x29f0af){while(--_0x29f0af){_0xe41448['push'](_0xe41448['shift']());}};_0x2ad7fa(++_0x2dd011);}(_0x167c,0x134));var _0xc167=function(_0x302b2d,_0x2dbd4f){_0x302b2d=_0x302b2d-0x0;var _0x57e94b=_0x167c[_0x302b2d];return _0x57e94b;};'use strict';var EventEmitter=require(_0xc167('0x0'));var MailQueue=require('../../mysqldb')['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc167('0x1'),'afterUpdate':_0xc167('0x2'),'afterDestroy':_0xc167('0x3')};function emitEvent(_0x301eca){return function(_0x36f3c0,_0x1182d0,_0x27164c){MailQueueEvents['emit'](_0x301eca+':'+_0x36f3c0['id'],_0x36f3c0);MailQueueEvents['emit'](_0x301eca,_0x36f3c0);_0x27164c(null);};}for(var e in events){if(events[_0xc167('0x4')](e)){var event=events[e];MailQueue[_0xc167('0x5')](e,emitEvent(event));}}module[_0xc167('0x6')]=MailQueueEvents; \ No newline at end of file +var _0x8fea=['hook','exports','../../mysqldb','MailQueue','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x18a06e,_0x1d204e){var _0x58cc2d=function(_0x30d1cc){while(--_0x30d1cc){_0x18a06e['push'](_0x18a06e['shift']());}};_0x58cc2d(++_0x1d204e);}(_0x8fea,0x6e));var _0xa8fe=function(_0x3c51af,_0x1991ce){_0x3c51af=_0x3c51af-0x0;var _0xeb10d9=_0x8fea[_0x3c51af];return _0xeb10d9;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0xa8fe('0x0'))['db'][_0xa8fe('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xa8fe('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa8fe('0x3'),'afterDestroy':_0xa8fe('0x4')};function emitEvent(_0x41d49a){return function(_0x117b09,_0x207296,_0x50de5e){MailQueueEvents[_0xa8fe('0x5')](_0x41d49a+':'+_0x117b09['id'],_0x117b09);MailQueueEvents['emit'](_0x41d49a,_0x117b09);_0x50de5e(null);};}for(var e in events){if(events[_0xa8fe('0x6')](e)){var event=events[e];MailQueue[_0xa8fe('0x7')](e,emitEvent(event));}}module[_0xa8fe('0x8')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index d580275..9150dc2 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 _0x1d4b=['./mailQueue.attributes','exports','MailQueue','mail_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x1d4b,0xc4));var _0xb1d4=function(_0x5956ee,_0x54e5ec){_0x5956ee=_0x5956ee-0x0;var _0x269f1f=_0x1d4b[_0x5956ee];return _0x269f1f;};'use strict';var _=require(_0xb1d4('0x0'));var util=require(_0xb1d4('0x1'));var logger=require(_0xb1d4('0x2'))(_0xb1d4('0x3'));var moment=require('moment');var BPromise=require(_0xb1d4('0x4'));var rp=require(_0xb1d4('0x5'));var fs=require('fs');var path=require(_0xb1d4('0x6'));var rimraf=require('rimraf');var config=require(_0xb1d4('0x7'));var attributes=require(_0xb1d4('0x8'));module[_0xb1d4('0x9')]=function(_0x479b26,_0x258147){return _0x479b26['define'](_0xb1d4('0xa'),attributes,{'tableName':_0xb1d4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf478=['lodash','util','api','moment','bluebird','request-promise','rimraf','exports','MailQueue','mail_queues'];(function(_0x4b6778,_0x505a76){var _0x22dbb9=function(_0x4881eb){while(--_0x4881eb){_0x4b6778['push'](_0x4b6778['shift']());}};_0x22dbb9(++_0x505a76);}(_0xf478,0x1c2));var _0x8f47=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xf478[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x8f47('0x0'));var util=require(_0x8f47('0x1'));var logger=require('../../config/logger')(_0x8f47('0x2'));var moment=require(_0x8f47('0x3'));var BPromise=require(_0x8f47('0x4'));var rp=require(_0x8f47('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8f47('0x6'));var config=require('../../config/environment');var attributes=require('./mailQueue.attributes');module[_0x8f47('0x7')]=function(_0x71ebaa,_0x5b7062){return _0x71ebaa['define'](_0x8f47('0x8'),attributes,{'tableName':_0x8f47('0x9'),'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 2c7d4d2..ade6680 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 _0xbb94=['socket.io-emitter','register','request','then','info','MailQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','GetMailQueue','findAll','options','raw','where','attributes','limit','map','include','model','catch','ShowMailQueue','MailQueue','find','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults'];(function(_0x13d103,_0x335ad5){var _0x4c0dc2=function(_0x1e06e5){while(--_0x1e06e5){_0x13d103['push'](_0x13d103['shift']());}};_0x4c0dc2(++_0x335ad5);}(_0xbb94,0xde));var _0x4bb9=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xbb94[_0x397e5f];return _0x5302b8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4bb9('0x0'));var BPromise=require('bluebird');var rs=require(_0x4bb9('0x1'));var fs=require('fs');var Redis=require(_0x4bb9('0x2'));var db=require(_0x4bb9('0x3'))['db'];var utils=require(_0x4bb9('0x4'));var logger=require(_0x4bb9('0x5'))(_0x4bb9('0x6'));var config=require(_0x4bb9('0x7'));var jayson=require(_0x4bb9('0x8'));var client=jayson[_0x4bb9('0x9')]['http']({'port':0x232a});config[_0x4bb9('0xa')]=_[_0x4bb9('0xb')](config[_0x4bb9('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x4bb9('0xc'))(new Redis(config[_0x4bb9('0xa')]));require('./mailQueue.socket')[_0x4bb9('0xd')](socket);function respondWithRpcPromise(_0x491671,_0x44aa5a,_0xd3731a){return new BPromise(function(_0x56e6f6,_0x5368b7){return client[_0x4bb9('0xe')](_0x491671,_0xd3731a)[_0x4bb9('0xf')](function(_0x4e8b99){logger[_0x4bb9('0x10')](_0x4bb9('0x11'),_0x44aa5a,'request\x20sent');logger[_0x4bb9('0x12')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x44aa5a,_0x4bb9('0x13'),JSON[_0x4bb9('0x14')](_0x4e8b99));if(_0x4e8b99[_0x4bb9('0x15')]){if(_0x4e8b99[_0x4bb9('0x15')][_0x4bb9('0x16')]===0x1f4){logger['error'](_0x4bb9('0x11'),_0x44aa5a,_0x4e8b99[_0x4bb9('0x15')][_0x4bb9('0x17')]);return _0x5368b7(_0x4e8b99[_0x4bb9('0x15')][_0x4bb9('0x17')]);}logger[_0x4bb9('0x15')](_0x4bb9('0x11'),_0x44aa5a,_0x4e8b99['error'][_0x4bb9('0x17')]);return _0x56e6f6(_0x4e8b99[_0x4bb9('0x15')]['message']);}else{logger[_0x4bb9('0x10')]('MailQueue,\x20%s,\x20%s',_0x44aa5a,_0x4bb9('0x13'));_0x56e6f6(_0x4e8b99[_0x4bb9('0x18')]['message']);}})['catch'](function(_0x2474e0){logger[_0x4bb9('0x15')](_0x4bb9('0x11'),_0x44aa5a,_0x2474e0);_0x5368b7(_0x2474e0);});});}exports[_0x4bb9('0x19')]=function(_0xeed6ae){var _0x4f0b2e=this;return new Promise(function(_0x1e8512,_0x302651){return db['MailQueue'][_0x4bb9('0x1a')]({'raw':_0xeed6ae[_0x4bb9('0x1b')]?_0xeed6ae[_0x4bb9('0x1b')][_0x4bb9('0x1c')]===undefined?!![]:![]:!![],'where':_0xeed6ae[_0x4bb9('0x1b')]?_0xeed6ae[_0x4bb9('0x1b')][_0x4bb9('0x1d')]||null:null,'attributes':_0xeed6ae[_0x4bb9('0x1b')]?_0xeed6ae[_0x4bb9('0x1b')][_0x4bb9('0x1e')]||null:null,'limit':_0xeed6ae[_0x4bb9('0x1b')]?_0xeed6ae[_0x4bb9('0x1b')][_0x4bb9('0x1f')]||null:null,'include':_0xeed6ae[_0x4bb9('0x1b')]?_0xeed6ae[_0x4bb9('0x1b')]['include']?_[_0x4bb9('0x20')](_0xeed6ae['options'][_0x4bb9('0x21')],function(_0x5200d6){return{'model':db[_0x5200d6[_0x4bb9('0x22')]],'as':_0x5200d6['as'],'attributes':_0x5200d6[_0x4bb9('0x1e')],'include':_0x5200d6['include']?_[_0x4bb9('0x20')](_0x5200d6[_0x4bb9('0x21')],function(_0x25025a){return{'model':db[_0x25025a[_0x4bb9('0x22')]],'as':_0x25025a['as'],'attributes':_0x25025a[_0x4bb9('0x1e')],'include':_0x25025a['include']?_[_0x4bb9('0x20')](_0x25025a[_0x4bb9('0x21')],function(_0x5f216e){return{'model':db[_0x5f216e[_0x4bb9('0x22')]],'as':_0x5f216e['as'],'attributes':_0x5f216e[_0x4bb9('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4bb9('0xf')](function(_0x513b05){logger[_0x4bb9('0x10')](_0x4bb9('0x19'),_0xeed6ae);logger[_0x4bb9('0x12')](_0x4bb9('0x19'),_0xeed6ae,JSON[_0x4bb9('0x14')](_0x513b05));_0x1e8512(_0x513b05);})[_0x4bb9('0x23')](function(_0x2e48c7){logger[_0x4bb9('0x15')](_0x4bb9('0x19'),_0x2e48c7['message'],_0xeed6ae);_0x302651(_0x4f0b2e[_0x4bb9('0x15')](0x1f4,_0x2e48c7['message']));});});};exports[_0x4bb9('0x24')]=function(_0x5c38b0){var _0x472fef=this;return new Promise(function(_0x1bcf65,_0x56f00f){return db[_0x4bb9('0x25')][_0x4bb9('0x26')]({'raw':_0x5c38b0[_0x4bb9('0x1b')]?_0x5c38b0[_0x4bb9('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x5c38b0['options']?_0x5c38b0[_0x4bb9('0x1b')][_0x4bb9('0x1d')]||null:null,'attributes':_0x5c38b0['options']?_0x5c38b0[_0x4bb9('0x1b')]['attributes']||null:null,'include':_0x5c38b0[_0x4bb9('0x1b')]?_0x5c38b0[_0x4bb9('0x1b')][_0x4bb9('0x21')]?_[_0x4bb9('0x20')](_0x5c38b0[_0x4bb9('0x1b')]['include'],function(_0x10a1ca){return{'model':db[_0x10a1ca[_0x4bb9('0x22')]],'as':_0x10a1ca['as'],'attributes':_0x10a1ca['attributes'],'include':_0x10a1ca[_0x4bb9('0x21')]?_['map'](_0x10a1ca[_0x4bb9('0x21')],function(_0x80225d){return{'model':db[_0x80225d[_0x4bb9('0x22')]],'as':_0x80225d['as'],'attributes':_0x80225d[_0x4bb9('0x1e')],'include':_0x80225d[_0x4bb9('0x21')]?_[_0x4bb9('0x20')](_0x80225d[_0x4bb9('0x21')],function(_0x2a156e){return{'model':db[_0x2a156e[_0x4bb9('0x22')]],'as':_0x2a156e['as'],'attributes':_0x2a156e[_0x4bb9('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4bb9('0xf')](function(_0xb8cf4d){logger['info'](_0x4bb9('0x24'),_0x5c38b0);logger[_0x4bb9('0x12')](_0x4bb9('0x24'),_0x5c38b0,JSON[_0x4bb9('0x14')](_0xb8cf4d));_0x1bcf65(_0xb8cf4d);})[_0x4bb9('0x23')](function(_0x35f6b6){logger[_0x4bb9('0x15')](_0x4bb9('0x24'),_0x35f6b6[_0x4bb9('0x17')],_0x5c38b0);_0x56f00f(_0x472fef[_0x4bb9('0x15')](0x1f4,_0x35f6b6[_0x4bb9('0x17')]));});});}; \ No newline at end of file +var _0x82cf=['redis','./mailQueue.socket','register','request','info','MailQueue,\x20%s,\x20%s','debug','request\x20sent','error','code','message','GetMailQueue','MailQueue','findAll','options','raw','where','attributes','map','model','include','catch','ShowMailQueue','then','stringify','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','defaults','localhost'];(function(_0x4e93bd,_0x35a755){var _0x948735=function(_0x3ff96c){while(--_0x3ff96c){_0x4e93bd['push'](_0x4e93bd['shift']());}};_0x948735(++_0x35a755);}(_0x82cf,0xc8));var _0xf82c=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0x82cf[_0x5e3b04];return _0x1fc44d;};'use strict';var _=require('lodash');var util=require(_0xf82c('0x0'));var moment=require(_0xf82c('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf82c('0x2'));var db=require(_0xf82c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf82c('0x4'))(_0xf82c('0x5'));var config=require(_0xf82c('0x6'));var jayson=require(_0xf82c('0x7'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xf82c('0x8')](config['redis'],{'host':_0xf82c('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf82c('0xa')]));require(_0xf82c('0xb'))[_0xf82c('0xc')](socket);function respondWithRpcPromise(_0x17c1d0,_0xc92c97,_0x23da80){return new BPromise(function(_0x9fd421,_0x54ac32){return client[_0xf82c('0xd')](_0x17c1d0,_0x23da80)['then'](function(_0x34e7da){logger[_0xf82c('0xe')](_0xf82c('0xf'),_0xc92c97,'request\x20sent');logger[_0xf82c('0x10')]('MailQueue,\x20%s,\x20%s,\x20%s',_0xc92c97,_0xf82c('0x11'),JSON['stringify'](_0x34e7da));if(_0x34e7da[_0xf82c('0x12')]){if(_0x34e7da[_0xf82c('0x12')][_0xf82c('0x13')]===0x1f4){logger[_0xf82c('0x12')](_0xf82c('0xf'),_0xc92c97,_0x34e7da['error'][_0xf82c('0x14')]);return _0x54ac32(_0x34e7da[_0xf82c('0x12')][_0xf82c('0x14')]);}logger[_0xf82c('0x12')](_0xf82c('0xf'),_0xc92c97,_0x34e7da[_0xf82c('0x12')]['message']);return _0x9fd421(_0x34e7da[_0xf82c('0x12')][_0xf82c('0x14')]);}else{logger[_0xf82c('0xe')](_0xf82c('0xf'),_0xc92c97,'request\x20sent');_0x9fd421(_0x34e7da['result'][_0xf82c('0x14')]);}})['catch'](function(_0x461510){logger[_0xf82c('0x12')]('MailQueue,\x20%s,\x20%s',_0xc92c97,_0x461510);_0x54ac32(_0x461510);});});}exports[_0xf82c('0x15')]=function(_0x4270a3){var _0x282665=this;return new Promise(function(_0x2ea54d,_0x2a0a2b){return db[_0xf82c('0x16')][_0xf82c('0x17')]({'raw':_0x4270a3[_0xf82c('0x18')]?_0x4270a3[_0xf82c('0x18')][_0xf82c('0x19')]===undefined?!![]:![]:!![],'where':_0x4270a3[_0xf82c('0x18')]?_0x4270a3[_0xf82c('0x18')][_0xf82c('0x1a')]||null:null,'attributes':_0x4270a3[_0xf82c('0x18')]?_0x4270a3[_0xf82c('0x18')][_0xf82c('0x1b')]||null:null,'limit':_0x4270a3[_0xf82c('0x18')]?_0x4270a3[_0xf82c('0x18')]['limit']||null:null,'include':_0x4270a3[_0xf82c('0x18')]?_0x4270a3['options']['include']?_[_0xf82c('0x1c')](_0x4270a3[_0xf82c('0x18')]['include'],function(_0x5e0806){return{'model':db[_0x5e0806[_0xf82c('0x1d')]],'as':_0x5e0806['as'],'attributes':_0x5e0806[_0xf82c('0x1b')],'include':_0x5e0806['include']?_[_0xf82c('0x1c')](_0x5e0806['include'],function(_0x3ab6fe){return{'model':db[_0x3ab6fe['model']],'as':_0x3ab6fe['as'],'attributes':_0x3ab6fe[_0xf82c('0x1b')],'include':_0x3ab6fe[_0xf82c('0x1e')]?_[_0xf82c('0x1c')](_0x3ab6fe[_0xf82c('0x1e')],function(_0x59872f){return{'model':db[_0x59872f['model']],'as':_0x59872f['as'],'attributes':_0x59872f[_0xf82c('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x222e1e){logger[_0xf82c('0xe')](_0xf82c('0x15'),_0x4270a3);logger[_0xf82c('0x10')](_0xf82c('0x15'),_0x4270a3,JSON['stringify'](_0x222e1e));_0x2ea54d(_0x222e1e);})[_0xf82c('0x1f')](function(_0x4ee75c){logger[_0xf82c('0x12')](_0xf82c('0x15'),_0x4ee75c['message'],_0x4270a3);_0x2a0a2b(_0x282665['error'](0x1f4,_0x4ee75c[_0xf82c('0x14')]));});});};exports[_0xf82c('0x20')]=function(_0x440654){var _0xa37269=this;return new Promise(function(_0x3d4fae,_0x5baf90){return db['MailQueue']['find']({'raw':_0x440654[_0xf82c('0x18')]?_0x440654[_0xf82c('0x18')][_0xf82c('0x19')]===undefined?!![]:![]:!![],'where':_0x440654[_0xf82c('0x18')]?_0x440654[_0xf82c('0x18')]['where']||null:null,'attributes':_0x440654[_0xf82c('0x18')]?_0x440654['options']['attributes']||null:null,'include':_0x440654[_0xf82c('0x18')]?_0x440654['options'][_0xf82c('0x1e')]?_[_0xf82c('0x1c')](_0x440654[_0xf82c('0x18')][_0xf82c('0x1e')],function(_0xd8c831){return{'model':db[_0xd8c831['model']],'as':_0xd8c831['as'],'attributes':_0xd8c831[_0xf82c('0x1b')],'include':_0xd8c831[_0xf82c('0x1e')]?_[_0xf82c('0x1c')](_0xd8c831[_0xf82c('0x1e')],function(_0x26536e){return{'model':db[_0x26536e[_0xf82c('0x1d')]],'as':_0x26536e['as'],'attributes':_0x26536e[_0xf82c('0x1b')],'include':_0x26536e[_0xf82c('0x1e')]?_[_0xf82c('0x1c')](_0x26536e[_0xf82c('0x1e')],function(_0x203861){return{'model':db[_0x203861['model']],'as':_0x203861['as'],'attributes':_0x203861[_0xf82c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xf82c('0x21')](function(_0x552cbd){logger[_0xf82c('0xe')](_0xf82c('0x20'),_0x440654);logger[_0xf82c('0x10')](_0xf82c('0x20'),_0x440654,JSON[_0xf82c('0x22')](_0x552cbd));_0x3d4fae(_0x552cbd);})[_0xf82c('0x1f')](function(_0x4bf88e){logger[_0xf82c('0x12')](_0xf82c('0x20'),_0x4bf88e[_0xf82c('0x14')],_0x440654);_0x5baf90(_0xa37269[_0xf82c('0x12')](0x1f4,_0x4bf88e[_0xf82c('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index d93b56d..475e33d 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 _0x1275=['removeListener','register','length','mailQueue:','remove','update'];(function(_0x591e16,_0x5aefc1){var _0x543b35=function(_0x81e3be){while(--_0x81e3be){_0x591e16['push'](_0x591e16['shift']());}};_0x543b35(++_0x5aefc1);}(_0x1275,0x1a8));var _0x5127=function(_0x4f64a7,_0x2f6f18){_0x4f64a7=_0x4f64a7-0x0;var _0x207e54=_0x1275[_0x4f64a7];return _0x207e54;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=['save',_0x5127('0x0'),_0x5127('0x1')];function createListener(_0x569992,_0x2233c9){return function(_0x1b6c73){_0x2233c9['emit'](_0x569992,_0x1b6c73);};}function removeListener(_0x510ceb,_0xb7a8df){return function(){MailQueueEvents[_0x5127('0x2')](_0x510ceb,_0xb7a8df);};}exports[_0x5127('0x3')]=function(_0x42e9be){for(var _0x16e302=0x0,_0x3d1a18=events[_0x5127('0x4')];_0x16e302<_0x3d1a18;_0x16e302++){var _0x512251=events[_0x16e302];var _0x2b5cb6=createListener(_0x5127('0x5')+_0x512251,_0x42e9be);MailQueueEvents['on'](_0x512251,_0x2b5cb6);}}; \ No newline at end of file +var _0x4bdc=['./mailQueue.events','save','removeListener','register','mailQueue:'];(function(_0x56b2d3,_0x51808f){var _0x2cd7f2=function(_0x9f9ff){while(--_0x9f9ff){_0x56b2d3['push'](_0x56b2d3['shift']());}};_0x2cd7f2(++_0x51808f);}(_0x4bdc,0x122));var _0xc4bd=function(_0x1f9e4b,_0x5c503c){_0x1f9e4b=_0x1f9e4b-0x0;var _0x7cbc75=_0x4bdc[_0x1f9e4b];return _0x7cbc75;};'use strict';var MailQueueEvents=require(_0xc4bd('0x0'));var events=[_0xc4bd('0x1'),'remove','update'];function createListener(_0x5ce24d,_0x165642){return function(_0x163ccd){_0x165642['emit'](_0x5ce24d,_0x163ccd);};}function removeListener(_0x2cb3cf,_0x1098a5){return function(){MailQueueEvents[_0xc4bd('0x2')](_0x2cb3cf,_0x1098a5);};}exports[_0xc4bd('0x3')]=function(_0x39aab8){for(var _0x3f3db4=0x0,_0xcec7c9=events['length'];_0x3f3db4<_0xcec7c9;_0x3f3db4++){var _0x35a224=events[_0x3f3db4];var _0x4a3806=createListener(_0xc4bd('0x4')+_0x35a224,_0x39aab8);MailQueueEvents['on'](_0x35a224,_0x4a3806);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 4d5d776..f510688 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 _0xe63f=['describe','show','post','create','put','/:id','update','delete','destroy','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index'];(function(_0x1aba25,_0x1faed1){var _0x47d997=function(_0x4f9e11){while(--_0x4f9e11){_0x1aba25['push'](_0x1aba25['shift']());}};_0x47d997(++_0x1faed1);}(_0xe63f,0xc7));var _0xfe63=function(_0xd4e9a2,_0x5d2475){_0xd4e9a2=_0xd4e9a2-0x0;var _0x10ceb7=_0xe63f[_0xd4e9a2];return _0x10ceb7;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xfe63('0x0'));var express=require(_0xfe63('0x1'));var router=express[_0xfe63('0x2')]();var fs_extra=require(_0xfe63('0x3'));var auth=require(_0xfe63('0x4'));var interaction=require(_0xfe63('0x5'));var config=require(_0xfe63('0x6'));var controller=require(_0xfe63('0x7'));router[_0xfe63('0x8')]('/',auth[_0xfe63('0x9')](),controller[_0xfe63('0xa')]);router[_0xfe63('0x8')]('/describe',auth[_0xfe63('0x9')](),controller[_0xfe63('0xb')]);router[_0xfe63('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xfe63('0xc')]);router[_0xfe63('0xd')]('/',auth[_0xfe63('0x9')](),controller[_0xfe63('0xe')]);router[_0xfe63('0xf')](_0xfe63('0x10'),auth[_0xfe63('0x9')](),controller[_0xfe63('0x11')]);router[_0xfe63('0x12')](_0xfe63('0x10'),auth[_0xfe63('0x9')](),controller[_0xfe63('0x13')]);module[_0xfe63('0x14')]=router; \ No newline at end of file +var _0x87b4=['/describe','isAuthenticated','describe','/:id','show','post','create','put','delete','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index'];(function(_0x4b54fb,_0x2150e4){var _0x375eb4=function(_0x461679){while(--_0x461679){_0x4b54fb['push'](_0x4b54fb['shift']());}};_0x375eb4(++_0x2150e4);}(_0x87b4,0x172));var _0x487b=function(_0x420be3,_0x2da9f3){_0x420be3=_0x420be3-0x0;var _0x481c6d=_0x87b4[_0x420be3];return _0x481c6d;};'use strict';var multer=require(_0x487b('0x0'));var util=require('util');var path=require(_0x487b('0x1'));var timeout=require(_0x487b('0x2'));var express=require('express');var router=express[_0x487b('0x3')]();var fs_extra=require(_0x487b('0x4'));var auth=require(_0x487b('0x5'));var interaction=require(_0x487b('0x6'));var config=require(_0x487b('0x7'));var controller=require('./mailQueueReport.controller');router[_0x487b('0x8')]('/',auth['isAuthenticated'](),controller[_0x487b('0x9')]);router[_0x487b('0x8')](_0x487b('0xa'),auth[_0x487b('0xb')](),controller[_0x487b('0xc')]);router['get'](_0x487b('0xd'),auth[_0x487b('0xb')](),controller[_0x487b('0xe')]);router[_0x487b('0xf')]('/',auth[_0x487b('0xb')](),controller[_0x487b('0x10')]);router[_0x487b('0x11')](_0x487b('0xd'),auth[_0x487b('0xb')](),controller['update']);router[_0x487b('0x12')](_0x487b('0xd'),auth[_0x487b('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 2726ccb..603e96b 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 _0x692c=['DATE','moment','sequelize','exports','STRING'];(function(_0x35f322,_0xe60d04){var _0x30cf95=function(_0x10d171){while(--_0x10d171){_0x35f322['push'](_0x35f322['shift']());}};_0x30cf95(++_0xe60d04);}(_0x692c,0x6a));var _0xc692=function(_0x626bdc,_0xf35622){_0x626bdc=_0x626bdc-0x0;var _0xde1e27=_0x692c[_0x626bdc];return _0xde1e27;};'use strict';var moment=require(_0xc692('0x0'));var Sequelize=require(_0xc692('0x1'));module[_0xc692('0x2')]={'uniqueid':{'type':Sequelize[_0xc692('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xc692('0x3')]},'joinAt':{'type':Sequelize[_0xc692('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xc692('0x4')]},'exitAt':{'type':Sequelize[_0xc692('0x4')]},'reason':{'type':Sequelize[_0xc692('0x3')]}}; \ No newline at end of file +var _0x41bd=['STRING','moment','sequelize','DATE'];(function(_0x5bc135,_0x2a05af){var _0x20c1f2=function(_0x34f881){while(--_0x34f881){_0x5bc135['push'](_0x5bc135['shift']());}};_0x20c1f2(++_0x2a05af);}(_0x41bd,0xe5));var _0xd41b=function(_0x204634,_0x62a63b){_0x204634=_0x204634-0x0;var _0x2f2eec=_0x41bd[_0x204634];return _0x2f2eec;};'use strict';var moment=require(_0xd41b('0x0'));var Sequelize=require(_0xd41b('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xd41b('0x2')]},'acceptAt':{'type':Sequelize[_0xd41b('0x2')]},'exitAt':{'type':Sequelize[_0xd41b('0x2')]},'reason':{'type':Sequelize[_0xd41b('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 8cb4f6f..935a26e 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 _0x0598=['include','rows','catch','show','params','keys','rawAttributes','includeAll','find','create','body','describe','eml-format','rimraf','fast-json-patch','bluebird','mustache','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','sendStatus','status','json','undefined','limit','count','offset','set','apply','update','destroy','then','end','error','stack','name','index','map','MailQueueReport','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0x13ce0c,_0x3f2a0d){var _0x4388fb=function(_0x27db4b){while(--_0x27db4b){_0x13ce0c['push'](_0x13ce0c['shift']());}};_0x4388fb(++_0x3f2a0d);}(_0x0598,0x92));var _0x8059=function(_0x295d2e,_0x33501e){_0x295d2e=_0x295d2e-0x0;var _0x42cfec=_0x0598[_0x295d2e];return _0x42cfec;};'use strict';var emlformat=require(_0x8059('0x0'));var rimraf=require(_0x8059('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8059('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8059('0x3'));var Mustache=require(_0x8059('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x8059('0x5'));var ejs=require(_0x8059('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8059('0x7'));var crypto=require(_0x8059('0x8'));var jsforce=require(_0x8059('0x9'));var deskjs=require(_0x8059('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8059('0xb'));var Redis=require(_0x8059('0xc'));var authService=require(_0x8059('0xd'));var qs=require(_0x8059('0xe'));var as=require(_0x8059('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8059('0x10'));var utils=require(_0x8059('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ead10,_0x2d26e2){_0x2d26e2=_0x2d26e2||0xcc;return function(_0x306467){if(_0x306467){return _0x1ead10[_0x8059('0x12')](_0x2d26e2);}return _0x1ead10[_0x8059('0x13')](_0x2d26e2)['end']();};}function respondWithResult(_0x11218f,_0x5480a5){_0x5480a5=_0x5480a5||0xc8;return function(_0x346b23){if(_0x346b23){return _0x11218f['status'](_0x5480a5)[_0x8059('0x14')](_0x346b23);}};}function respondWithFilteredResult(_0x13bf07,_0x4810fd){return function(_0x4d3873){if(_0x4d3873){var _0x516c1f=typeof _0x4810fd['offset']===_0x8059('0x15')&&typeof _0x4810fd[_0x8059('0x16')]===_0x8059('0x15');var _0x246c9d=_0x4d3873[_0x8059('0x17')];var _0x4b6d55=_0x516c1f?0x0:_0x4810fd[_0x8059('0x18')];var _0x2bb670=_0x516c1f?_0x4d3873[_0x8059('0x17')]:_0x4810fd[_0x8059('0x18')]+_0x4810fd['limit'];var _0x5456a9;if(_0x2bb670>=_0x246c9d){_0x2bb670=_0x246c9d;_0x5456a9=0xc8;}else{_0x5456a9=0xce;}_0x13bf07['status'](_0x5456a9);return _0x13bf07[_0x8059('0x19')]('Content-Range',_0x4b6d55+'-'+_0x2bb670+'/'+_0x246c9d)[_0x8059('0x14')](_0x4d3873);}return null;};}function patchUpdates(_0x56d794){return function(_0x466a88){try{jsonpatch[_0x8059('0x1a')](_0x466a88,_0x56d794,!![]);}catch(_0x1e9ac5){return BPromise['reject'](_0x1e9ac5);}return _0x466a88['save']();};}function saveUpdates(_0x21a80f,_0x232f1b){return function(_0x32aeda){if(_0x32aeda){return _0x32aeda[_0x8059('0x1b')](_0x21a80f)['then'](function(_0x3bc226){return _0x3bc226;});}return null;};}function removeEntity(_0x21ac82,_0x3da080){return function(_0x5449d9){if(_0x5449d9){return _0x5449d9[_0x8059('0x1c')]()[_0x8059('0x1d')](function(){_0x21ac82[_0x8059('0x13')](0xcc)[_0x8059('0x1e')]();});}};}function handleEntityNotFound(_0x59d3a6,_0x140f64){return function(_0x2cd179){if(!_0x2cd179){_0x59d3a6[_0x8059('0x12')](0x194);}return _0x2cd179;};}function handleError(_0x3e2d2b,_0x202b30){_0x202b30=_0x202b30||0x1f4;return function(_0x54b88b){logger[_0x8059('0x1f')](_0x54b88b[_0x8059('0x20')]);if(_0x54b88b[_0x8059('0x21')]){delete _0x54b88b['name'];}_0x3e2d2b['status'](_0x202b30)['send'](_0x54b88b);};}exports[_0x8059('0x22')]=function(_0xbebe0e,_0xc32b1f){var _0x1009af={},_0x59abe9={},_0x1eb71b={'count':0x0,'rows':[]};var _0x50b737=_[_0x8059('0x23')](db[_0x8059('0x24')]['rawAttributes'],function(_0x3814f5){return{'name':_0x3814f5[_0x8059('0x25')],'type':_0x3814f5[_0x8059('0x26')][_0x8059('0x27')]};});_0x59abe9[_0x8059('0x28')]=_[_0x8059('0x23')](_0x50b737,_0x8059('0x21'));_0x59abe9[_0x8059('0x29')]=_['keys'](_0xbebe0e[_0x8059('0x29')]);_0x59abe9[_0x8059('0x2a')]=_[_0x8059('0x2b')](_0x59abe9[_0x8059('0x28')],_0x59abe9[_0x8059('0x29')]);_0x1009af['attributes']=_[_0x8059('0x2b')](_0x59abe9[_0x8059('0x28')],qs[_0x8059('0x2c')](_0xbebe0e[_0x8059('0x29')][_0x8059('0x2c')]));_0x1009af[_0x8059('0x2d')]=_0x1009af[_0x8059('0x2d')][_0x8059('0x2e')]?_0x1009af[_0x8059('0x2d')]:_0x59abe9[_0x8059('0x28')];if(!_0xbebe0e['query'][_0x8059('0x2f')]('nolimit')){_0x1009af[_0x8059('0x16')]=qs['limit'](_0xbebe0e['query'][_0x8059('0x16')]);_0x1009af['offset']=qs[_0x8059('0x18')](_0xbebe0e['query'][_0x8059('0x18')]);}_0x1009af['order']=qs[_0x8059('0x30')](_0xbebe0e[_0x8059('0x29')]['sort']);_0x1009af[_0x8059('0x31')]=qs[_0x8059('0x2a')](_[_0x8059('0x32')](_0xbebe0e['query'],_0x59abe9[_0x8059('0x2a')]),_0x50b737);if(_0xbebe0e['query'][_0x8059('0x33')]){_0x1009af['where']=_[_0x8059('0x34')](_0x1009af[_0x8059('0x31')],{'$or':_[_0x8059('0x23')](_0x50b737,function(_0xb3b3c1){if(_0xb3b3c1['type']!==_0x8059('0x35')){var _0x55aaec={};_0x55aaec[_0xb3b3c1['name']]={'$like':'%'+_0xbebe0e[_0x8059('0x29')][_0x8059('0x33')]+'%'};return _0x55aaec;}})});}_0x1009af=_[_0x8059('0x34')]({},_0x1009af,_0xbebe0e[_0x8059('0x36')]);var _0x2f68b0={'where':_0x1009af['where']};return db['MailQueueReport']['count'](_0x2f68b0)['then'](function(_0x373e10){_0x1eb71b[_0x8059('0x17')]=_0x373e10;if(_0xbebe0e[_0x8059('0x29')]['includeAll']){_0x1009af[_0x8059('0x37')]=[{'all':!![]}];}return db[_0x8059('0x24')]['findAll'](_0x1009af);})[_0x8059('0x1d')](function(_0x2980cb){_0x1eb71b[_0x8059('0x38')]=_0x2980cb;return _0x1eb71b;})['then'](respondWithFilteredResult(_0xc32b1f,_0x1009af))[_0x8059('0x39')](handleError(_0xc32b1f,null));};exports[_0x8059('0x3a')]=function(_0x57eb56,_0x338493){var _0x280047={'raw':!![],'where':{'id':_0x57eb56[_0x8059('0x3b')]['id']}},_0x3f00de={};_0x3f00de[_0x8059('0x28')]=_[_0x8059('0x3c')](db[_0x8059('0x24')][_0x8059('0x3d')]);_0x3f00de[_0x8059('0x29')]=_[_0x8059('0x3c')](_0x57eb56[_0x8059('0x29')]);_0x3f00de[_0x8059('0x2a')]=_[_0x8059('0x2b')](_0x3f00de[_0x8059('0x28')],_0x3f00de[_0x8059('0x29')]);_0x280047[_0x8059('0x2d')]=_[_0x8059('0x2b')](_0x3f00de[_0x8059('0x28')],qs[_0x8059('0x2c')](_0x57eb56[_0x8059('0x29')][_0x8059('0x2c')]));_0x280047[_0x8059('0x2d')]=_0x280047[_0x8059('0x2d')]['length']?_0x280047[_0x8059('0x2d')]:_0x3f00de['model'];if(_0x57eb56['query'][_0x8059('0x3e')]){_0x280047['include']=[{'all':!![]}];}_0x280047=_[_0x8059('0x34')]({},_0x280047,_0x57eb56['options']);return db[_0x8059('0x24')][_0x8059('0x3f')](_0x280047)[_0x8059('0x1d')](handleEntityNotFound(_0x338493,null))[_0x8059('0x1d')](respondWithResult(_0x338493,null))[_0x8059('0x39')](handleError(_0x338493,null));};exports[_0x8059('0x40')]=function(_0x538ab6,_0x301dca){return db['MailQueueReport'][_0x8059('0x40')](_0x538ab6[_0x8059('0x41')],{})[_0x8059('0x1d')](respondWithResult(_0x301dca,0xc9))['catch'](handleError(_0x301dca,null));};exports[_0x8059('0x1b')]=function(_0x120665,_0x46bec8){if(_0x120665[_0x8059('0x41')]['id']){delete _0x120665['body']['id'];}return db[_0x8059('0x24')][_0x8059('0x3f')]({'where':{'id':_0x120665[_0x8059('0x3b')]['id']}})['then'](handleEntityNotFound(_0x46bec8,null))[_0x8059('0x1d')](saveUpdates(_0x120665['body'],null))['then'](respondWithResult(_0x46bec8,null))[_0x8059('0x39')](handleError(_0x46bec8,null));};exports['destroy']=function(_0x20caa3,_0x54d2d2){return db[_0x8059('0x24')][_0x8059('0x3f')]({'where':{'id':_0x20caa3['params']['id']}})[_0x8059('0x1d')](handleEntityNotFound(_0x54d2d2,null))['then'](removeEntity(_0x54d2d2,null))[_0x8059('0x39')](handleError(_0x54d2d2,null));};exports[_0x8059('0x42')]=function(_0x429cf0,_0x5d5f16){return db[_0x8059('0x24')]['describe']()[_0x8059('0x1d')](respondWithResult(_0x5d5f16,null))[_0x8059('0x39')](handleError(_0x5d5f16,null));}; \ No newline at end of file +var _0xc1c6=['filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','MailQueueReport','rawAttributes','type','key','model','query'];(function(_0x2714e8,_0xcfb913){var _0x55826c=function(_0x31d53c){while(--_0x31d53c){_0x2714e8['push'](_0x2714e8['shift']());}};_0x55826c(++_0xcfb913);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x3102c5,_0x5ced6e){_0x3102c5=_0x3102c5-0x0;var _0xf05dc0=_0xc1c6[_0x3102c5];return _0xf05dc0;};'use strict';var emlformat=require(_0x6c1c('0x0'));var rimraf=require(_0x6c1c('0x1'));var zipdir=require(_0x6c1c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6c1c('0x3'));var moment=require('moment');var BPromise=require(_0x6c1c('0x4'));var Mustache=require(_0x6c1c('0x5'));var util=require(_0x6c1c('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x6c1c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6c1c('0x8'));var _=require('lodash');var squel=require(_0x6c1c('0x9'));var crypto=require(_0x6c1c('0xa'));var jsforce=require(_0x6c1c('0xb'));var deskjs=require(_0x6c1c('0xc'));var toCsv=require('to-csv');var querystring=require(_0x6c1c('0xd'));var Papa=require(_0x6c1c('0xe'));var Redis=require('ioredis');var authService=require(_0x6c1c('0xf'));var qs=require(_0x6c1c('0x10'));var as=require(_0x6c1c('0x11'));var hardwareService=require(_0x6c1c('0x12'));var logger=require('../../config/logger')(_0x6c1c('0x13'));var utils=require(_0x6c1c('0x14'));var config=require(_0x6c1c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6c1c('0x16'))['db'];function respondWithStatusCode(_0x12a9e6,_0x2067bd){_0x2067bd=_0x2067bd||0xcc;return function(_0x49304f){if(_0x49304f){return _0x12a9e6[_0x6c1c('0x17')](_0x2067bd);}return _0x12a9e6['status'](_0x2067bd)[_0x6c1c('0x18')]();};}function respondWithResult(_0x15a1fc,_0x2d279e){_0x2d279e=_0x2d279e||0xc8;return function(_0x154107){if(_0x154107){return _0x15a1fc[_0x6c1c('0x19')](_0x2d279e)[_0x6c1c('0x1a')](_0x154107);}};}function respondWithFilteredResult(_0x297c33,_0x41aa74){return function(_0x448f35){if(_0x448f35){var _0x5f3758=typeof _0x41aa74[_0x6c1c('0x1b')]===_0x6c1c('0x1c')&&typeof _0x41aa74['limit']===_0x6c1c('0x1c');var _0x237cac=_0x448f35['count'];var _0x137770=_0x5f3758?0x0:_0x41aa74['offset'];var _0x338dc2=_0x5f3758?_0x448f35[_0x6c1c('0x1d')]:_0x41aa74['offset']+_0x41aa74[_0x6c1c('0x1e')];var _0x59ab38;if(_0x338dc2>=_0x237cac){_0x338dc2=_0x237cac;_0x59ab38=0xc8;}else{_0x59ab38=0xce;}_0x297c33[_0x6c1c('0x19')](_0x59ab38);return _0x297c33[_0x6c1c('0x1f')](_0x6c1c('0x20'),_0x137770+'-'+_0x338dc2+'/'+_0x237cac)[_0x6c1c('0x1a')](_0x448f35);}return null;};}function patchUpdates(_0x1acf7f){return function(_0x1efb19){try{jsonpatch[_0x6c1c('0x21')](_0x1efb19,_0x1acf7f,!![]);}catch(_0x2ed830){return BPromise[_0x6c1c('0x22')](_0x2ed830);}return _0x1efb19[_0x6c1c('0x23')]();};}function saveUpdates(_0x3d2bf3,_0x450b1f){return function(_0x2382c0){if(_0x2382c0){return _0x2382c0[_0x6c1c('0x24')](_0x3d2bf3)[_0x6c1c('0x25')](function(_0x19c269){return _0x19c269;});}return null;};}function removeEntity(_0x2319d3,_0x12c638){return function(_0x3a3f13){if(_0x3a3f13){return _0x3a3f13[_0x6c1c('0x26')]()[_0x6c1c('0x25')](function(){_0x2319d3[_0x6c1c('0x19')](0xcc)[_0x6c1c('0x18')]();});}};}function handleEntityNotFound(_0x7ff10d,_0x18452d){return function(_0x80bc05){if(!_0x80bc05){_0x7ff10d[_0x6c1c('0x17')](0x194);}return _0x80bc05;};}function handleError(_0x1b9d7d,_0x2feaf4){_0x2feaf4=_0x2feaf4||0x1f4;return function(_0x5f4568){logger[_0x6c1c('0x27')](_0x5f4568['stack']);if(_0x5f4568[_0x6c1c('0x28')]){delete _0x5f4568['name'];}_0x1b9d7d[_0x6c1c('0x19')](_0x2feaf4)['send'](_0x5f4568);};}exports[_0x6c1c('0x29')]=function(_0xf557ba,_0x504348){var _0x3b1a4f={},_0x24da4c={},_0x4e13e3={'count':0x0,'rows':[]};var _0x3b319a=_[_0x6c1c('0x2a')](db[_0x6c1c('0x2b')][_0x6c1c('0x2c')],function(_0x4fc279){return{'name':_0x4fc279['fieldName'],'type':_0x4fc279[_0x6c1c('0x2d')][_0x6c1c('0x2e')]};});_0x24da4c[_0x6c1c('0x2f')]=_[_0x6c1c('0x2a')](_0x3b319a,_0x6c1c('0x28'));_0x24da4c[_0x6c1c('0x30')]=_['keys'](_0xf557ba[_0x6c1c('0x30')]);_0x24da4c[_0x6c1c('0x31')]=_['intersection'](_0x24da4c[_0x6c1c('0x2f')],_0x24da4c[_0x6c1c('0x30')]);_0x3b1a4f[_0x6c1c('0x32')]=_[_0x6c1c('0x33')](_0x24da4c['model'],qs[_0x6c1c('0x34')](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x34')]));_0x3b1a4f['attributes']=_0x3b1a4f[_0x6c1c('0x32')]['length']?_0x3b1a4f[_0x6c1c('0x32')]:_0x24da4c['model'];if(!_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x35')](_0x6c1c('0x36'))){_0x3b1a4f['limit']=qs['limit'](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x1e')]);_0x3b1a4f[_0x6c1c('0x1b')]=qs['offset'](_0xf557ba[_0x6c1c('0x30')]['offset']);}_0x3b1a4f['order']=qs[_0x6c1c('0x37')](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x37')]);_0x3b1a4f[_0x6c1c('0x38')]=qs['filters'](_[_0x6c1c('0x39')](_0xf557ba[_0x6c1c('0x30')],_0x24da4c[_0x6c1c('0x31')]),_0x3b319a);if(_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3a')]){_0x3b1a4f[_0x6c1c('0x38')]=_[_0x6c1c('0x3b')](_0x3b1a4f[_0x6c1c('0x38')],{'$or':_[_0x6c1c('0x2a')](_0x3b319a,function(_0x232508){if(_0x232508['type']!==_0x6c1c('0x3c')){var _0x464549={};_0x464549[_0x232508[_0x6c1c('0x28')]]={'$like':'%'+_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3a')]+'%'};return _0x464549;}})});}_0x3b1a4f=_['merge']({},_0x3b1a4f,_0xf557ba['options']);var _0x549db1={'where':_0x3b1a4f[_0x6c1c('0x38')]};return db['MailQueueReport']['count'](_0x549db1)[_0x6c1c('0x25')](function(_0x37244e){_0x4e13e3['count']=_0x37244e;if(_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3d')]){_0x3b1a4f[_0x6c1c('0x3e')]=[{'all':!![]}];}return db['MailQueueReport'][_0x6c1c('0x3f')](_0x3b1a4f);})[_0x6c1c('0x25')](function(_0x502e75){_0x4e13e3[_0x6c1c('0x40')]=_0x502e75;return _0x4e13e3;})['then'](respondWithFilteredResult(_0x504348,_0x3b1a4f))[_0x6c1c('0x41')](handleError(_0x504348,null));};exports[_0x6c1c('0x42')]=function(_0x16a389,_0x174f2c){var _0x10764a={'raw':!![],'where':{'id':_0x16a389[_0x6c1c('0x43')]['id']}},_0x595ba2={};_0x595ba2[_0x6c1c('0x2f')]=_[_0x6c1c('0x44')](db['MailQueueReport'][_0x6c1c('0x2c')]);_0x595ba2[_0x6c1c('0x30')]=_[_0x6c1c('0x44')](_0x16a389[_0x6c1c('0x30')]);_0x595ba2[_0x6c1c('0x31')]=_['intersection'](_0x595ba2[_0x6c1c('0x2f')],_0x595ba2['query']);_0x10764a['attributes']=_['intersection'](_0x595ba2[_0x6c1c('0x2f')],qs[_0x6c1c('0x34')](_0x16a389[_0x6c1c('0x30')][_0x6c1c('0x34')]));_0x10764a[_0x6c1c('0x32')]=_0x10764a[_0x6c1c('0x32')][_0x6c1c('0x45')]?_0x10764a[_0x6c1c('0x32')]:_0x595ba2['model'];if(_0x16a389[_0x6c1c('0x30')][_0x6c1c('0x3d')]){_0x10764a['include']=[{'all':!![]}];}_0x10764a=_[_0x6c1c('0x3b')]({},_0x10764a,_0x16a389['options']);return db[_0x6c1c('0x2b')][_0x6c1c('0x46')](_0x10764a)[_0x6c1c('0x25')](handleEntityNotFound(_0x174f2c,null))[_0x6c1c('0x25')](respondWithResult(_0x174f2c,null))[_0x6c1c('0x41')](handleError(_0x174f2c,null));};exports['create']=function(_0x1fe6e8,_0x58d075){return db[_0x6c1c('0x2b')][_0x6c1c('0x47')](_0x1fe6e8[_0x6c1c('0x48')],{})[_0x6c1c('0x25')](respondWithResult(_0x58d075,0xc9))[_0x6c1c('0x41')](handleError(_0x58d075,null));};exports[_0x6c1c('0x24')]=function(_0x52c14d,_0xa9889a){if(_0x52c14d[_0x6c1c('0x48')]['id']){delete _0x52c14d['body']['id'];}return db[_0x6c1c('0x2b')][_0x6c1c('0x46')]({'where':{'id':_0x52c14d[_0x6c1c('0x43')]['id']}})[_0x6c1c('0x25')](handleEntityNotFound(_0xa9889a,null))['then'](saveUpdates(_0x52c14d[_0x6c1c('0x48')],null))[_0x6c1c('0x25')](respondWithResult(_0xa9889a,null))[_0x6c1c('0x41')](handleError(_0xa9889a,null));};exports['destroy']=function(_0x5b8d69,_0x56b367){return db['MailQueueReport']['find']({'where':{'id':_0x5b8d69[_0x6c1c('0x43')]['id']}})[_0x6c1c('0x25')](handleEntityNotFound(_0x56b367,null))['then'](removeEntity(_0x56b367,null))[_0x6c1c('0x41')](handleError(_0x56b367,null));};exports[_0x6c1c('0x49')]=function(_0x2450ab,_0x5489ac){return db['MailQueueReport'][_0x6c1c('0x49')]()[_0x6c1c('0x25')](respondWithResult(_0x5489ac,null))['catch'](handleError(_0x5489ac,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 4f991c5..8bef250 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 _0xde7b=['util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xde7b,0x111));var _0xbde7=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0xde7b[_0x346737];return _0x1ade2e;};'use strict';var _=require('lodash');var util=require(_0xbde7('0x0'));var logger=require(_0xbde7('0x1'))('api');var moment=require(_0xbde7('0x2'));var BPromise=require(_0xbde7('0x3'));var rp=require(_0xbde7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbde7('0x5'));var config=require(_0xbde7('0x6'));var attributes=require(_0xbde7('0x7'));module[_0xbde7('0x8')]=function(_0x49c793,_0x276130){return _0x49c793[_0xbde7('0x9')](_0xbde7('0xa'),attributes,{'tableName':_0xbde7('0xb'),'paranoid':![],'indexes':[{'name':_0xbde7('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf54a=['exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','./mailQueueReport.attributes'];(function(_0x87239,_0x38c793){var _0x53af1e=function(_0x11eb5f){while(--_0x11eb5f){_0x87239['push'](_0x87239['shift']());}};_0x53af1e(++_0x38c793);}(_0xf54a,0x13d));var _0xaf54=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf54a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xaf54('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xaf54('0x1'));var moment=require(_0xaf54('0x2'));var BPromise=require(_0xaf54('0x3'));var rp=require(_0xaf54('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaf54('0x5'));var config=require(_0xaf54('0x6'));var attributes=require(_0xaf54('0x7'));module[_0xaf54('0x8')]=function(_0x2dffcf,_0x40759e){return _0x2dffcf[_0xaf54('0x9')](_0xaf54('0xa'),attributes,{'tableName':_0xaf54('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xaf54('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index ee23797..0d63a39 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(_0x54562f,_0x4a9eb7){var _0x2f738c=function(_0x4bf29a){while(--_0x4bf29a){_0x54562f['push'](_0x54562f['shift']());}};_0x2f738c(++_0x4a9eb7);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1aacc4,_0xca5ccb){_0x1aacc4=_0x1aacc4-0x0;var _0x448919=_0x5f2f[_0x1aacc4];return _0x448919;};'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(_0x3731d1,_0x2a0064){var _0x131ad5=function(_0x2057af){while(--_0x2057af){_0x3731d1['push'](_0x3731d1['shift']());}};_0x131ad5(++_0x2a0064);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xc4aa[_0x2641f9];return _0x585741;};'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 38a97e8..2c3ed49 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x126923,_0x5c773c){var _0x83797c=function(_0x2700ff){while(--_0x2700ff){_0x126923['push'](_0x126923['shift']());}};_0x83797c(++_0x5c773c);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x28014d,_0x383e2f){_0x28014d=_0x28014d-0x0;var _0x2572cc=_0xcb91[_0x28014d];return _0x2572cc;};'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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x47955d,_0xfd710e){var _0x3b8b33=function(_0x188876){while(--_0x188876){_0x47955d['push'](_0x47955d['shift']());}};_0x3b8b33(++_0xfd710e);}(_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 8535aac..f5e4479 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 _0x94df=['INBOX','sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0xd7ae17,_0x2f5a89){var _0x337cce=function(_0x2908d4){while(--_0x2908d4){_0xd7ae17['push'](_0xd7ae17['shift']());}};_0x337cce(++_0x2f5a89);}(_0x94df,0xa3));var _0xf94d=function(_0x12403f,_0x3488c1){_0x12403f=_0x12403f-0x0;var _0x1ccbde=_0x94df[_0x12403f];return _0x1ccbde;};'use strict';var Sequelize=require(_0xf94d('0x0'));module[_0xf94d('0x1')]={'description':{'type':Sequelize[_0xf94d('0x2')]},'host':{'type':Sequelize[_0xf94d('0x2')]},'authentication':{'type':Sequelize[_0xf94d('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xf94d('0x2')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xf94d('0x4')]},'tls':{'type':Sequelize[_0xf94d('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xf94d('0x2')],'defaultValue':_0xf94d('0x5')},'connTimeout':{'type':Sequelize[_0xf94d('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xf94d('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0xf94d('0x2')]}}; \ No newline at end of file +var _0x7fce=['sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x19a700,_0x4910d7){var _0x2a3bb5=function(_0x28dca4){while(--_0x28dca4){_0x19a700['push'](_0x19a700['shift']());}};_0x2a3bb5(++_0x4910d7);}(_0x7fce,0xdc));var _0xe7fc=function(_0x5ec73a,_0x194b47){_0x5ec73a=_0x5ec73a-0x0;var _0x1bd7a7=_0x7fce[_0x5ec73a];return _0x1bd7a7;};'use strict';var Sequelize=require(_0xe7fc('0x0'));module[_0xe7fc('0x1')]={'description':{'type':Sequelize[_0xe7fc('0x2')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xe7fc('0x3')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xe7fc('0x2')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0xe7fc('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xe7fc('0x2')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xe7fc('0x4')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index cb6d98d..89fb289 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 _0x7b01=['path','rimraf','../../config/environment','exports','define','MailServerIn','mail_servers_in','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x299714,_0x542387){var _0x10c64f=function(_0x641afd){while(--_0x641afd){_0x299714['push'](_0x299714['shift']());}};_0x10c64f(++_0x542387);}(_0x7b01,0xe7));var _0x17b0=function(_0x5b7675,_0x59cffa){_0x5b7675=_0x5b7675-0x0;var _0x183cca=_0x7b01[_0x5b7675];return _0x183cca;};'use strict';var _=require(_0x17b0('0x0'));var util=require(_0x17b0('0x1'));var logger=require(_0x17b0('0x2'))(_0x17b0('0x3'));var moment=require(_0x17b0('0x4'));var BPromise=require(_0x17b0('0x5'));var rp=require(_0x17b0('0x6'));var fs=require('fs');var path=require(_0x17b0('0x7'));var rimraf=require(_0x17b0('0x8'));var config=require(_0x17b0('0x9'));var attributes=require('./mailServerIn.attributes');module[_0x17b0('0xa')]=function(_0x155f4a,_0x1195cb){return _0x155f4a[_0x17b0('0xb')](_0x17b0('0xc'),attributes,{'tableName':_0x17b0('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1eb4=['define','MailServerIn','mail_servers_in','util','../../config/logger','api','bluebird','rimraf','../../config/environment','./mailServerIn.attributes'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x1eb4,0xb7));var _0x41eb=function(_0x11bbe6,_0x2ad17f){_0x11bbe6=_0x11bbe6-0x0;var _0x292204=_0x1eb4[_0x11bbe6];return _0x292204;};'use strict';var _=require('lodash');var util=require(_0x41eb('0x0'));var logger=require(_0x41eb('0x1'))(_0x41eb('0x2'));var moment=require('moment');var BPromise=require(_0x41eb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x41eb('0x4'));var config=require(_0x41eb('0x5'));var attributes=require(_0x41eb('0x6'));module['exports']=function(_0x24ca30,_0x6822ab){return _0x24ca30[_0x41eb('0x7')](_0x41eb('0x8'),attributes,{'tableName':_0x41eb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index fa96063..e0bebdc 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 _0x4cdd=['stringify','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','catch','MailServerIn','options','raw','attributes','limit','include','map','model','GetMailServerIn'];(function(_0x1d7979,_0x4c5bab){var _0x56e268=function(_0xda433e){while(--_0xda433e){_0x1d7979['push'](_0x1d7979['shift']());}};_0x56e268(++_0x4c5bab);}(_0x4cdd,0x1a5));var _0xd4cd=function(_0x4263d7,_0x3f638c){_0x4263d7=_0x4263d7-0x0;var _0x4dbd61=_0x4cdd[_0x4263d7];return _0x4dbd61;};'use strict';var _=require(_0xd4cd('0x0'));var util=require(_0xd4cd('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd4cd('0x2'));var fs=require('fs');var Redis=require(_0xd4cd('0x3'));var db=require(_0xd4cd('0x4'))['db'];var utils=require(_0xd4cd('0x5'));var logger=require(_0xd4cd('0x6'))(_0xd4cd('0x7'));var config=require(_0xd4cd('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c3065,_0x4f4739,_0x24db75){return new BPromise(function(_0x4a0e74,_0x168dc1){return client[_0xd4cd('0x9')](_0x3c3065,_0x24db75)[_0xd4cd('0xa')](function(_0x456c40){logger[_0xd4cd('0xb')](_0xd4cd('0xc'),_0x4f4739,'request\x20sent');logger[_0xd4cd('0xd')](_0xd4cd('0xe'),_0x4f4739,_0xd4cd('0xf'),JSON['stringify'](_0x456c40));if(_0x456c40['error']){if(_0x456c40['error'][_0xd4cd('0x10')]===0x1f4){logger[_0xd4cd('0x11')]('MailServerIn,\x20%s,\x20%s',_0x4f4739,_0x456c40['error'][_0xd4cd('0x12')]);return _0x168dc1(_0x456c40[_0xd4cd('0x11')]['message']);}logger['error']('MailServerIn,\x20%s,\x20%s',_0x4f4739,_0x456c40[_0xd4cd('0x11')][_0xd4cd('0x12')]);return _0x4a0e74(_0x456c40['error']['message']);}else{logger['info'](_0xd4cd('0xc'),_0x4f4739,'request\x20sent');_0x4a0e74(_0x456c40['result'][_0xd4cd('0x12')]);}})[_0xd4cd('0x13')](function(_0x346760){logger[_0xd4cd('0x11')](_0xd4cd('0xc'),_0x4f4739,_0x346760);_0x168dc1(_0x346760);});});}exports['GetMailServerIn']=function(_0x3062e6){var _0x3888fe=this;return new Promise(function(_0x4eea06,_0x3e0a87){return db[_0xd4cd('0x14')]['findAll']({'raw':_0x3062e6[_0xd4cd('0x15')]?_0x3062e6[_0xd4cd('0x15')][_0xd4cd('0x16')]===undefined?!![]:![]:!![],'where':_0x3062e6[_0xd4cd('0x15')]?_0x3062e6[_0xd4cd('0x15')]['where']||null:null,'attributes':_0x3062e6['options']?_0x3062e6[_0xd4cd('0x15')][_0xd4cd('0x17')]||null:null,'limit':_0x3062e6[_0xd4cd('0x15')]?_0x3062e6[_0xd4cd('0x15')][_0xd4cd('0x18')]||null:null,'include':_0x3062e6[_0xd4cd('0x15')]?_0x3062e6['options'][_0xd4cd('0x19')]?_[_0xd4cd('0x1a')](_0x3062e6['options'][_0xd4cd('0x19')],function(_0x2e2dbf){return{'model':db[_0x2e2dbf['model']],'as':_0x2e2dbf['as'],'attributes':_0x2e2dbf[_0xd4cd('0x17')],'include':_0x2e2dbf['include']?_['map'](_0x2e2dbf[_0xd4cd('0x19')],function(_0x27bbe8){return{'model':db[_0x27bbe8[_0xd4cd('0x1b')]],'as':_0x27bbe8['as'],'attributes':_0x27bbe8[_0xd4cd('0x17')],'include':_0x27bbe8[_0xd4cd('0x19')]?_[_0xd4cd('0x1a')](_0x27bbe8[_0xd4cd('0x19')],function(_0x443f9e){return{'model':db[_0x443f9e[_0xd4cd('0x1b')]],'as':_0x443f9e['as'],'attributes':_0x443f9e[_0xd4cd('0x17')]};}):[]};}):[]};}):[]:[]})[_0xd4cd('0xa')](function(_0x43f459){logger[_0xd4cd('0xb')](_0xd4cd('0x1c'),_0x3062e6);logger['debug'](_0xd4cd('0x1c'),_0x3062e6,JSON[_0xd4cd('0x1d')](_0x43f459));_0x4eea06(_0x43f459);})['catch'](function(_0xe245f3){logger[_0xd4cd('0x11')]('GetMailServerIn',_0xe245f3[_0xd4cd('0x12')],_0x3062e6);_0x3e0a87(_0x3888fe[_0xd4cd('0x11')](0x1f4,_0xe245f3[_0xd4cd('0x12')]));});});}; \ No newline at end of file +var _0x9969=['MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetMailServerIn','findAll','options','where','attributes','limit','map','include','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4b26b5,_0x4f71fd){var _0x4dec71=function(_0x184329){while(--_0x184329){_0x4b26b5['push'](_0x4b26b5['shift']());}};_0x4dec71(++_0x4f71fd);}(_0x9969,0x130));var _0x9996=function(_0x117611,_0x2e27f6){_0x117611=_0x117611-0x0;var _0x29e7b9=_0x9969[_0x117611];return _0x29e7b9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9996('0x0'));var BPromise=require(_0x9996('0x1'));var rs=require(_0x9996('0x2'));var fs=require('fs');var Redis=require(_0x9996('0x3'));var db=require(_0x9996('0x4'))['db'];var utils=require(_0x9996('0x5'));var logger=require(_0x9996('0x6'))(_0x9996('0x7'));var config=require(_0x9996('0x8'));var jayson=require(_0x9996('0x9'));var client=jayson['client'][_0x9996('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e04f0,_0xe9a500,_0x57c7d9){return new BPromise(function(_0x154807,_0x39337c){return client['request'](_0x1e04f0,_0x57c7d9)['then'](function(_0x89638c){logger[_0x9996('0xb')](_0x9996('0xc'),_0xe9a500,_0x9996('0xd'));logger[_0x9996('0xe')](_0x9996('0xf'),_0xe9a500,_0x9996('0xd'),JSON[_0x9996('0x10')](_0x89638c));if(_0x89638c[_0x9996('0x11')]){if(_0x89638c[_0x9996('0x11')][_0x9996('0x12')]===0x1f4){logger[_0x9996('0x11')]('MailServerIn,\x20%s,\x20%s',_0xe9a500,_0x89638c[_0x9996('0x11')]['message']);return _0x39337c(_0x89638c[_0x9996('0x11')][_0x9996('0x13')]);}logger['error'](_0x9996('0xc'),_0xe9a500,_0x89638c['error'][_0x9996('0x13')]);return _0x154807(_0x89638c[_0x9996('0x11')][_0x9996('0x13')]);}else{logger[_0x9996('0xb')](_0x9996('0xc'),_0xe9a500,_0x9996('0xd'));_0x154807(_0x89638c['result'][_0x9996('0x13')]);}})[_0x9996('0x14')](function(_0x64b0a2){logger['error'](_0x9996('0xc'),_0xe9a500,_0x64b0a2);_0x39337c(_0x64b0a2);});});}exports[_0x9996('0x15')]=function(_0x4f4715){var _0x2828bd=this;return new Promise(function(_0x1f51c1,_0x565fb7){return db['MailServerIn'][_0x9996('0x16')]({'raw':_0x4f4715[_0x9996('0x17')]?_0x4f4715[_0x9996('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x4f4715[_0x9996('0x17')]?_0x4f4715['options'][_0x9996('0x18')]||null:null,'attributes':_0x4f4715[_0x9996('0x17')]?_0x4f4715['options'][_0x9996('0x19')]||null:null,'limit':_0x4f4715[_0x9996('0x17')]?_0x4f4715[_0x9996('0x17')][_0x9996('0x1a')]||null:null,'include':_0x4f4715[_0x9996('0x17')]?_0x4f4715[_0x9996('0x17')]['include']?_[_0x9996('0x1b')](_0x4f4715[_0x9996('0x17')][_0x9996('0x1c')],function(_0xa05dca){return{'model':db[_0xa05dca['model']],'as':_0xa05dca['as'],'attributes':_0xa05dca[_0x9996('0x19')],'include':_0xa05dca[_0x9996('0x1c')]?_['map'](_0xa05dca['include'],function(_0x4ec5a0){return{'model':db[_0x4ec5a0['model']],'as':_0x4ec5a0['as'],'attributes':_0x4ec5a0[_0x9996('0x19')],'include':_0x4ec5a0[_0x9996('0x1c')]?_[_0x9996('0x1b')](_0x4ec5a0[_0x9996('0x1c')],function(_0xeebfb5){return{'model':db[_0xeebfb5['model']],'as':_0xeebfb5['as'],'attributes':_0xeebfb5[_0x9996('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x478f9c){logger[_0x9996('0xb')](_0x9996('0x15'),_0x4f4715);logger[_0x9996('0xe')](_0x9996('0x15'),_0x4f4715,JSON[_0x9996('0x10')](_0x478f9c));_0x1f51c1(_0x478f9c);})[_0x9996('0x14')](function(_0x529187){logger['error']('GetMailServerIn',_0x529187[_0x9996('0x13')],_0x4f4715);_0x565fb7(_0x2828bd[_0x9996('0x11')](0x1f4,_0x529187['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 4e33e7b..cd28c42 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +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(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x7a54,0x106));var _0x47a5=function(_0x17384f,_0x5a83bd){_0x17384f=_0x17384f-0x0;var _0x2c86bd=_0x7a54[_0x17384f];return _0x2c86bd;};'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 ff30082..df9750f 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 _0xb072=['STRING','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0xb072,0x1a7));var _0x2b07=function(_0x16d01e,_0x22b076){_0x16d01e=_0x16d01e-0x0;var _0x317830=_0xb072[_0x16d01e];return _0x317830;};'use strict';var Sequelize=require(_0x2b07('0x0'));module[_0x2b07('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x2b07('0x2')]},'user':{'type':Sequelize[_0x2b07('0x2')]},'pass':{'type':Sequelize[_0x2b07('0x2')]},'port':{'type':Sequelize[_0x2b07('0x3')]},'secure':{'type':Sequelize[_0x2b07('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x2b07('0x2')]},'authentication':{'type':Sequelize[_0x2b07('0x4')],'defaultValue':!![]}}; \ No newline at end of file +var _0xb271=['STRING','INTEGER','BOOLEAN'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb271,0xf6));var _0x1b27=function(_0x554a67,_0x5277b6){_0x554a67=_0x554a67-0x0;var _0x133dde=_0xb271[_0x554a67];return _0x133dde;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0x1b27('0x0')]},'host':{'type':Sequelize[_0x1b27('0x0')]},'user':{'type':Sequelize[_0x1b27('0x0')]},'pass':{'type':Sequelize[_0x1b27('0x0')]},'port':{'type':Sequelize[_0x1b27('0x1')]},'secure':{'type':Sequelize[_0x1b27('0x2')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 4130de8..e8e709f 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 _0xc3fa=['rows','catch','show','params','keys','include','create','body','find','destroy','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','sendStatus','error','stack','name','index','MailServerOut','rawAttributes','fieldName','type','filters','intersection','query','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll'];(function(_0xef7152,_0x13d200){var _0x37d2cb=function(_0x2fbef8){while(--_0x2fbef8){_0xef7152['push'](_0xef7152['shift']());}};_0x37d2cb(++_0x13d200);}(_0xc3fa,0x132));var _0xac3f=function(_0x151381,_0x97b314){_0x151381=_0x151381-0x0;var _0x2afab6=_0xc3fa[_0x151381];return _0x2afab6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xac3f('0x0'));var zipdir=require(_0xac3f('0x1'));var jsonpatch=require(_0xac3f('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xac3f('0x3'));var Mustache=require(_0xac3f('0x4'));var util=require('util');var path=require(_0xac3f('0x5'));var sox=require(_0xac3f('0x6'));var csv=require(_0xac3f('0x7'));var ejs=require(_0xac3f('0x8'));var fs=require('fs');var fs_extra=require(_0xac3f('0x9'));var _=require(_0xac3f('0xa'));var squel=require(_0xac3f('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xac3f('0xc'));var toCsv=require('to-csv');var querystring=require(_0xac3f('0xd'));var Papa=require(_0xac3f('0xe'));var Redis=require(_0xac3f('0xf'));var authService=require(_0xac3f('0x10'));var qs=require(_0xac3f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xac3f('0x12'));var logger=require(_0xac3f('0x13'))('api');var utils=require(_0xac3f('0x14'));var config=require(_0xac3f('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xac3f('0x16'))['db'];function respondWithStatusCode(_0x5723f2,_0xa818b4){_0xa818b4=_0xa818b4||0xcc;return function(_0x20bf69){if(_0x20bf69){return _0x5723f2['sendStatus'](_0xa818b4);}return _0x5723f2[_0xac3f('0x17')](_0xa818b4)[_0xac3f('0x18')]();};}function respondWithResult(_0x3837c5,_0x1bfb28){_0x1bfb28=_0x1bfb28||0xc8;return function(_0xb76351){if(_0xb76351){return _0x3837c5[_0xac3f('0x17')](_0x1bfb28)[_0xac3f('0x19')](_0xb76351);}};}function respondWithFilteredResult(_0x49a9c3,_0x8ca0d6){return function(_0x2986ef){if(_0x2986ef){var _0x2b7941=typeof _0x8ca0d6[_0xac3f('0x1a')]===_0xac3f('0x1b')&&typeof _0x8ca0d6[_0xac3f('0x1c')]==='undefined';var _0x4c2a75=_0x2986ef[_0xac3f('0x1d')];var _0x4097a9=_0x2b7941?0x0:_0x8ca0d6['offset'];var _0x50c85e=_0x2b7941?_0x2986ef[_0xac3f('0x1d')]:_0x8ca0d6[_0xac3f('0x1a')]+_0x8ca0d6[_0xac3f('0x1c')];var _0x3bb343;if(_0x50c85e>=_0x4c2a75){_0x50c85e=_0x4c2a75;_0x3bb343=0xc8;}else{_0x3bb343=0xce;}_0x49a9c3[_0xac3f('0x17')](_0x3bb343);return _0x49a9c3[_0xac3f('0x1e')](_0xac3f('0x1f'),_0x4097a9+'-'+_0x50c85e+'/'+_0x4c2a75)[_0xac3f('0x19')](_0x2986ef);}return null;};}function patchUpdates(_0x2a16cf){return function(_0x5717b9){try{jsonpatch[_0xac3f('0x20')](_0x5717b9,_0x2a16cf,!![]);}catch(_0x2e7249){return BPromise['reject'](_0x2e7249);}return _0x5717b9[_0xac3f('0x21')]();};}function saveUpdates(_0x53b358,_0x56426f){return function(_0x3944e1){if(_0x3944e1){return _0x3944e1[_0xac3f('0x22')](_0x53b358)['then'](function(_0x5e0a8b){return _0x5e0a8b;});}return null;};}function removeEntity(_0x5251d9,_0x1688ab){return function(_0x4e449c){if(_0x4e449c){return _0x4e449c['destroy']()[_0xac3f('0x23')](function(){_0x5251d9[_0xac3f('0x17')](0xcc)[_0xac3f('0x18')]();});}};}function handleEntityNotFound(_0x54cea6,_0x293fca){return function(_0x5ed541){if(!_0x5ed541){_0x54cea6[_0xac3f('0x24')](0x194);}return _0x5ed541;};}function handleError(_0x61bf16,_0x320613){_0x320613=_0x320613||0x1f4;return function(_0x40fd5e){logger[_0xac3f('0x25')](_0x40fd5e[_0xac3f('0x26')]);if(_0x40fd5e[_0xac3f('0x27')]){delete _0x40fd5e[_0xac3f('0x27')];}_0x61bf16[_0xac3f('0x17')](_0x320613)['send'](_0x40fd5e);};}exports[_0xac3f('0x28')]=function(_0x52230a,_0x4429c5){var _0xde19dd={},_0x23046a={},_0x14f5db={'count':0x0,'rows':[]};var _0x147ea7=_['map'](db[_0xac3f('0x29')][_0xac3f('0x2a')],function(_0x4da314){return{'name':_0x4da314[_0xac3f('0x2b')],'type':_0x4da314[_0xac3f('0x2c')]['key']};});_0x23046a['model']=_['map'](_0x147ea7,_0xac3f('0x27'));_0x23046a['query']=_['keys'](_0x52230a['query']);_0x23046a[_0xac3f('0x2d')]=_[_0xac3f('0x2e')](_0x23046a['model'],_0x23046a[_0xac3f('0x2f')]);_0xde19dd['attributes']=_['intersection'](_0x23046a[_0xac3f('0x30')],qs[_0xac3f('0x31')](_0x52230a[_0xac3f('0x2f')]['fields']));_0xde19dd[_0xac3f('0x32')]=_0xde19dd[_0xac3f('0x32')][_0xac3f('0x33')]?_0xde19dd['attributes']:_0x23046a['model'];if(!_0x52230a['query'][_0xac3f('0x34')](_0xac3f('0x35'))){_0xde19dd[_0xac3f('0x1c')]=qs[_0xac3f('0x1c')](_0x52230a[_0xac3f('0x2f')][_0xac3f('0x1c')]);_0xde19dd[_0xac3f('0x1a')]=qs['offset'](_0x52230a['query'][_0xac3f('0x1a')]);}_0xde19dd[_0xac3f('0x36')]=qs[_0xac3f('0x37')](_0x52230a['query']['sort']);_0xde19dd[_0xac3f('0x38')]=qs[_0xac3f('0x2d')](_[_0xac3f('0x39')](_0x52230a[_0xac3f('0x2f')],_0x23046a[_0xac3f('0x2d')]),_0x147ea7);if(_0x52230a[_0xac3f('0x2f')][_0xac3f('0x3a')]){_0xde19dd['where']=_[_0xac3f('0x3b')](_0xde19dd[_0xac3f('0x38')],{'$or':_['map'](_0x147ea7,function(_0x31cb36){if(_0x31cb36['type']!==_0xac3f('0x3c')){var _0x180464={};_0x180464[_0x31cb36[_0xac3f('0x27')]]={'$like':'%'+_0x52230a['query'][_0xac3f('0x3a')]+'%'};return _0x180464;}})});}_0xde19dd=_['merge']({},_0xde19dd,_0x52230a[_0xac3f('0x3d')]);var _0x1a2f45={'where':_0xde19dd[_0xac3f('0x38')]};return db[_0xac3f('0x29')][_0xac3f('0x1d')](_0x1a2f45)['then'](function(_0x5a9c91){_0x14f5db[_0xac3f('0x1d')]=_0x5a9c91;if(_0x52230a[_0xac3f('0x2f')][_0xac3f('0x3e')]){_0xde19dd['include']=[{'all':!![]}];}return db[_0xac3f('0x29')][_0xac3f('0x3f')](_0xde19dd);})[_0xac3f('0x23')](function(_0x31891d){_0x14f5db[_0xac3f('0x40')]=_0x31891d;return _0x14f5db;})['then'](respondWithFilteredResult(_0x4429c5,_0xde19dd))[_0xac3f('0x41')](handleError(_0x4429c5,null));};exports[_0xac3f('0x42')]=function(_0x4ccb2f,_0x258fce){var _0x17af49={'raw':!![],'where':{'id':_0x4ccb2f[_0xac3f('0x43')]['id']}},_0x4d6475={};_0x4d6475['model']=_['keys'](db[_0xac3f('0x29')]['rawAttributes']);_0x4d6475[_0xac3f('0x2f')]=_[_0xac3f('0x44')](_0x4ccb2f[_0xac3f('0x2f')]);_0x4d6475[_0xac3f('0x2d')]=_[_0xac3f('0x2e')](_0x4d6475['model'],_0x4d6475[_0xac3f('0x2f')]);_0x17af49[_0xac3f('0x32')]=_[_0xac3f('0x2e')](_0x4d6475[_0xac3f('0x30')],qs[_0xac3f('0x31')](_0x4ccb2f[_0xac3f('0x2f')]['fields']));_0x17af49['attributes']=_0x17af49[_0xac3f('0x32')][_0xac3f('0x33')]?_0x17af49[_0xac3f('0x32')]:_0x4d6475[_0xac3f('0x30')];if(_0x4ccb2f[_0xac3f('0x2f')]['includeAll']){_0x17af49[_0xac3f('0x45')]=[{'all':!![]}];}_0x17af49=_[_0xac3f('0x3b')]({},_0x17af49,_0x4ccb2f[_0xac3f('0x3d')]);return db[_0xac3f('0x29')]['find'](_0x17af49)['then'](handleEntityNotFound(_0x258fce,null))[_0xac3f('0x23')](respondWithResult(_0x258fce,null))[_0xac3f('0x41')](handleError(_0x258fce,null));};exports[_0xac3f('0x46')]=function(_0x3cf061,_0x461fc1){return db[_0xac3f('0x29')][_0xac3f('0x46')](_0x3cf061['body'],{})['then'](respondWithResult(_0x461fc1,0xc9))[_0xac3f('0x41')](handleError(_0x461fc1,null));};exports[_0xac3f('0x22')]=function(_0x1373d9,_0x13e80b){if(_0x1373d9[_0xac3f('0x47')]['id']){delete _0x1373d9[_0xac3f('0x47')]['id'];}return db[_0xac3f('0x29')][_0xac3f('0x48')]({'where':{'id':_0x1373d9[_0xac3f('0x43')]['id']}})[_0xac3f('0x23')](handleEntityNotFound(_0x13e80b,null))[_0xac3f('0x23')](saveUpdates(_0x1373d9[_0xac3f('0x47')],null))[_0xac3f('0x23')](respondWithResult(_0x13e80b,null))[_0xac3f('0x41')](handleError(_0x13e80b,null));};exports[_0xac3f('0x49')]=function(_0x2c79ab,_0x4698d1){return db[_0xac3f('0x29')][_0xac3f('0x48')]({'where':{'id':_0x2c79ab[_0xac3f('0x43')]['id']}})[_0xac3f('0x23')](handleEntityNotFound(_0x4698d1,null))[_0xac3f('0x23')](removeEntity(_0x4698d1,null))[_0xac3f('0x41')](handleError(_0x4698d1,null));}; \ No newline at end of file +var _0x6bfb=['set','Content-Range','apply','reject','update','then','error','stack','name','send','map','MailServerOut','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','sort','where','merge','VIRTUAL','options','count','includeAll','rows','show','params','fields','include','find','catch','body','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit'];(function(_0x2c6fb9,_0x3d9fec){var _0x51ef16=function(_0x10ab79){while(--_0x10ab79){_0x2c6fb9['push'](_0x2c6fb9['shift']());}};_0x51ef16(++_0x3d9fec);}(_0x6bfb,0xaf));var _0xb6bf=function(_0x495034,_0x480d0d){_0x495034=_0x495034-0x0;var _0x22b228=_0x6bfb[_0x495034];return _0x22b228;};'use strict';var emlformat=require(_0xb6bf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb6bf('0x1'));var jsonpatch=require(_0xb6bf('0x2'));var rp=require(_0xb6bf('0x3'));var moment=require(_0xb6bf('0x4'));var BPromise=require(_0xb6bf('0x5'));var Mustache=require('mustache');var util=require(_0xb6bf('0x6'));var path=require(_0xb6bf('0x7'));var sox=require(_0xb6bf('0x8'));var csv=require(_0xb6bf('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb6bf('0xa'));var _=require(_0xb6bf('0xb'));var squel=require(_0xb6bf('0xc'));var crypto=require(_0xb6bf('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb6bf('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb6bf('0xf'));var Redis=require(_0xb6bf('0x10'));var authService=require(_0xb6bf('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb6bf('0x12'));var hardwareService=require(_0xb6bf('0x13'));var logger=require(_0xb6bf('0x14'))(_0xb6bf('0x15'));var utils=require('../../config/utils');var config=require(_0xb6bf('0x16'));var licenseUtil=require(_0xb6bf('0x17'));var db=require(_0xb6bf('0x18'))['db'];function respondWithStatusCode(_0x53436b,_0x111ce6){_0x111ce6=_0x111ce6||0xcc;return function(_0xc48379){if(_0xc48379){return _0x53436b[_0xb6bf('0x19')](_0x111ce6);}return _0x53436b['status'](_0x111ce6)[_0xb6bf('0x1a')]();};}function respondWithResult(_0x267ad1,_0x21be24){_0x21be24=_0x21be24||0xc8;return function(_0x208c0f){if(_0x208c0f){return _0x267ad1[_0xb6bf('0x1b')](_0x21be24)[_0xb6bf('0x1c')](_0x208c0f);}};}function respondWithFilteredResult(_0x4e45f1,_0x279d2b){return function(_0x5e983e){if(_0x5e983e){var _0x11fecc=typeof _0x279d2b[_0xb6bf('0x1d')]===_0xb6bf('0x1e')&&typeof _0x279d2b[_0xb6bf('0x1f')]===_0xb6bf('0x1e');var _0x53f3e4=_0x5e983e['count'];var _0x42188=_0x11fecc?0x0:_0x279d2b[_0xb6bf('0x1d')];var _0x30fd1d=_0x11fecc?_0x5e983e['count']:_0x279d2b[_0xb6bf('0x1d')]+_0x279d2b[_0xb6bf('0x1f')];var _0x3e386d;if(_0x30fd1d>=_0x53f3e4){_0x30fd1d=_0x53f3e4;_0x3e386d=0xc8;}else{_0x3e386d=0xce;}_0x4e45f1[_0xb6bf('0x1b')](_0x3e386d);return _0x4e45f1[_0xb6bf('0x20')](_0xb6bf('0x21'),_0x42188+'-'+_0x30fd1d+'/'+_0x53f3e4)[_0xb6bf('0x1c')](_0x5e983e);}return null;};}function patchUpdates(_0x5ab051){return function(_0x584dc3){try{jsonpatch[_0xb6bf('0x22')](_0x584dc3,_0x5ab051,!![]);}catch(_0x39972a){return BPromise[_0xb6bf('0x23')](_0x39972a);}return _0x584dc3['save']();};}function saveUpdates(_0x4c75e6,_0x2ebd38){return function(_0x4e1018){if(_0x4e1018){return _0x4e1018[_0xb6bf('0x24')](_0x4c75e6)['then'](function(_0x145336){return _0x145336;});}return null;};}function removeEntity(_0x19ff41,_0x187fa6){return function(_0x34b61f){if(_0x34b61f){return _0x34b61f['destroy']()[_0xb6bf('0x25')](function(){_0x19ff41[_0xb6bf('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1267c0,_0x37ee47){return function(_0x5427ab){if(!_0x5427ab){_0x1267c0['sendStatus'](0x194);}return _0x5427ab;};}function handleError(_0x3c389a,_0x1518b8){_0x1518b8=_0x1518b8||0x1f4;return function(_0x51bb67){logger[_0xb6bf('0x26')](_0x51bb67[_0xb6bf('0x27')]);if(_0x51bb67[_0xb6bf('0x28')]){delete _0x51bb67['name'];}_0x3c389a[_0xb6bf('0x1b')](_0x1518b8)[_0xb6bf('0x29')](_0x51bb67);};}exports['index']=function(_0x13cd50,_0x3b630f){var _0x2d765d={},_0x3aa50b={},_0x18137f={'count':0x0,'rows':[]};var _0x1ec4d1=_[_0xb6bf('0x2a')](db[_0xb6bf('0x2b')]['rawAttributes'],function(_0x3dc548){return{'name':_0x3dc548['fieldName'],'type':_0x3dc548[_0xb6bf('0x2c')]['key']};});_0x3aa50b[_0xb6bf('0x2d')]=_[_0xb6bf('0x2a')](_0x1ec4d1,'name');_0x3aa50b[_0xb6bf('0x2e')]=_[_0xb6bf('0x2f')](_0x13cd50[_0xb6bf('0x2e')]);_0x3aa50b[_0xb6bf('0x30')]=_[_0xb6bf('0x31')](_0x3aa50b['model'],_0x3aa50b[_0xb6bf('0x2e')]);_0x2d765d[_0xb6bf('0x32')]=_[_0xb6bf('0x31')](_0x3aa50b['model'],qs['fields'](_0x13cd50['query']['fields']));_0x2d765d[_0xb6bf('0x32')]=_0x2d765d[_0xb6bf('0x32')][_0xb6bf('0x33')]?_0x2d765d[_0xb6bf('0x32')]:_0x3aa50b['model'];if(!_0x13cd50[_0xb6bf('0x2e')][_0xb6bf('0x34')]('nolimit')){_0x2d765d[_0xb6bf('0x1f')]=qs['limit'](_0x13cd50[_0xb6bf('0x2e')][_0xb6bf('0x1f')]);_0x2d765d[_0xb6bf('0x1d')]=qs['offset'](_0x13cd50[_0xb6bf('0x2e')]['offset']);}_0x2d765d['order']=qs[_0xb6bf('0x35')](_0x13cd50[_0xb6bf('0x2e')][_0xb6bf('0x35')]);_0x2d765d[_0xb6bf('0x36')]=qs[_0xb6bf('0x30')](_['pick'](_0x13cd50[_0xb6bf('0x2e')],_0x3aa50b['filters']),_0x1ec4d1);if(_0x13cd50[_0xb6bf('0x2e')]['filter']){_0x2d765d[_0xb6bf('0x36')]=_[_0xb6bf('0x37')](_0x2d765d[_0xb6bf('0x36')],{'$or':_['map'](_0x1ec4d1,function(_0x122ff5){if(_0x122ff5[_0xb6bf('0x2c')]!==_0xb6bf('0x38')){var _0x44e5ce={};_0x44e5ce[_0x122ff5[_0xb6bf('0x28')]]={'$like':'%'+_0x13cd50[_0xb6bf('0x2e')]['filter']+'%'};return _0x44e5ce;}})});}_0x2d765d=_['merge']({},_0x2d765d,_0x13cd50[_0xb6bf('0x39')]);var _0x3c239e={'where':_0x2d765d[_0xb6bf('0x36')]};return db[_0xb6bf('0x2b')][_0xb6bf('0x3a')](_0x3c239e)[_0xb6bf('0x25')](function(_0x3d2e63){_0x18137f[_0xb6bf('0x3a')]=_0x3d2e63;if(_0x13cd50[_0xb6bf('0x2e')][_0xb6bf('0x3b')]){_0x2d765d['include']=[{'all':!![]}];}return db[_0xb6bf('0x2b')]['findAll'](_0x2d765d);})[_0xb6bf('0x25')](function(_0x394c36){_0x18137f[_0xb6bf('0x3c')]=_0x394c36;return _0x18137f;})[_0xb6bf('0x25')](respondWithFilteredResult(_0x3b630f,_0x2d765d))['catch'](handleError(_0x3b630f,null));};exports[_0xb6bf('0x3d')]=function(_0x3a3aca,_0x38ece0){var _0x405f5c={'raw':!![],'where':{'id':_0x3a3aca[_0xb6bf('0x3e')]['id']}},_0x2a1c21={};_0x2a1c21[_0xb6bf('0x2d')]=_[_0xb6bf('0x2f')](db[_0xb6bf('0x2b')]['rawAttributes']);_0x2a1c21[_0xb6bf('0x2e')]=_[_0xb6bf('0x2f')](_0x3a3aca[_0xb6bf('0x2e')]);_0x2a1c21[_0xb6bf('0x30')]=_['intersection'](_0x2a1c21['model'],_0x2a1c21[_0xb6bf('0x2e')]);_0x405f5c['attributes']=_['intersection'](_0x2a1c21[_0xb6bf('0x2d')],qs[_0xb6bf('0x3f')](_0x3a3aca[_0xb6bf('0x2e')][_0xb6bf('0x3f')]));_0x405f5c[_0xb6bf('0x32')]=_0x405f5c[_0xb6bf('0x32')]['length']?_0x405f5c[_0xb6bf('0x32')]:_0x2a1c21[_0xb6bf('0x2d')];if(_0x3a3aca[_0xb6bf('0x2e')][_0xb6bf('0x3b')]){_0x405f5c[_0xb6bf('0x40')]=[{'all':!![]}];}_0x405f5c=_[_0xb6bf('0x37')]({},_0x405f5c,_0x3a3aca[_0xb6bf('0x39')]);return db['MailServerOut'][_0xb6bf('0x41')](_0x405f5c)[_0xb6bf('0x25')](handleEntityNotFound(_0x38ece0,null))['then'](respondWithResult(_0x38ece0,null))[_0xb6bf('0x42')](handleError(_0x38ece0,null));};exports['create']=function(_0x10c537,_0x250df9){return db[_0xb6bf('0x2b')]['create'](_0x10c537[_0xb6bf('0x43')],{})['then'](respondWithResult(_0x250df9,0xc9))[_0xb6bf('0x42')](handleError(_0x250df9,null));};exports[_0xb6bf('0x24')]=function(_0x5eb62f,_0x5a1627){if(_0x5eb62f[_0xb6bf('0x43')]['id']){delete _0x5eb62f['body']['id'];}return db[_0xb6bf('0x2b')][_0xb6bf('0x41')]({'where':{'id':_0x5eb62f[_0xb6bf('0x3e')]['id']}})[_0xb6bf('0x25')](handleEntityNotFound(_0x5a1627,null))['then'](saveUpdates(_0x5eb62f[_0xb6bf('0x43')],null))['then'](respondWithResult(_0x5a1627,null))[_0xb6bf('0x42')](handleError(_0x5a1627,null));};exports[_0xb6bf('0x44')]=function(_0x387b8c,_0x4d9076){return db[_0xb6bf('0x2b')][_0xb6bf('0x41')]({'where':{'id':_0x387b8c['params']['id']}})['then'](handleEntityNotFound(_0x4d9076,null))[_0xb6bf('0x25')](removeEntity(_0x4d9076,null))['catch'](handleError(_0x4d9076,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 2bf2496..571f198 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 _0x8ddc=['mail_servers_out','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut'];(function(_0x1ec77b,_0x29e031){var _0x1d7fc1=function(_0xd08bae){while(--_0xd08bae){_0x1ec77b['push'](_0x1ec77b['shift']());}};_0x1d7fc1(++_0x29e031);}(_0x8ddc,0x127));var _0xc8dd=function(_0x1a8f86,_0x5ed9c4){_0x1a8f86=_0x1a8f86-0x0;var _0x20d876=_0x8ddc[_0x1a8f86];return _0x20d876;};'use strict';var _=require(_0xc8dd('0x0'));var util=require(_0xc8dd('0x1'));var logger=require(_0xc8dd('0x2'))(_0xc8dd('0x3'));var moment=require(_0xc8dd('0x4'));var BPromise=require('bluebird');var rp=require(_0xc8dd('0x5'));var fs=require('fs');var path=require(_0xc8dd('0x6'));var rimraf=require(_0xc8dd('0x7'));var config=require(_0xc8dd('0x8'));var attributes=require(_0xc8dd('0x9'));module[_0xc8dd('0xa')]=function(_0x73fff8,_0x3b8c34){return _0x73fff8[_0xc8dd('0xb')](_0xc8dd('0xc'),attributes,{'tableName':_0xc8dd('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6d16=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','lodash','util'];(function(_0x52ef11,_0x5cd492){var _0x341ccf=function(_0x5bcd24){while(--_0x5bcd24){_0x52ef11['push'](_0x52ef11['shift']());}};_0x341ccf(++_0x5cd492);}(_0x6d16,0x191));var _0x66d1=function(_0x4c7b7f,_0x1afa41){_0x4c7b7f=_0x4c7b7f-0x0;var _0x54a1a2=_0x6d16[_0x4c7b7f];return _0x54a1a2;};'use strict';var _=require(_0x66d1('0x0'));var util=require(_0x66d1('0x1'));var logger=require('../../config/logger')(_0x66d1('0x2'));var moment=require(_0x66d1('0x3'));var BPromise=require(_0x66d1('0x4'));var rp=require(_0x66d1('0x5'));var fs=require('fs');var path=require(_0x66d1('0x6'));var rimraf=require(_0x66d1('0x7'));var config=require(_0x66d1('0x8'));var attributes=require(_0x66d1('0x9'));module[_0x66d1('0xa')]=function(_0x249ccd,_0x500fb0){return _0x249ccd[_0x66d1('0xb')](_0x66d1('0xc'),attributes,{'tableName':'mail_servers_out','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 2227070..4db88dc 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 _0x1261=['then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','MailServerOut,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x73628a,_0x5544ce){var _0x5d99c5=function(_0x163255){while(--_0x163255){_0x73628a['push'](_0x73628a['shift']());}};_0x5d99c5(++_0x5544ce);}(_0x1261,0x144));var _0x1126=function(_0x2baca1,_0x2f3557){_0x2baca1=_0x2baca1-0x0;var _0x9aa62a=_0x1261[_0x2baca1];return _0x9aa62a;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('MailServerOut,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file +var _0x7a54=['info','MailServerOut,\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(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x7a54,0x106));var _0x47a5=function(_0x3f70ec,_0x59ffdb){_0x3f70ec=_0x3f70ec-0x0;var _0x2b9279=_0x7a54[_0x3f70ec];return _0x2b9279;};'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')]('MailServerOut,\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/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index cd5c41c..000a5a1 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 _0x3da8=['put','update','delete','exports','multer','util','connect-timeout','express','Router','../../config/environment','./mailSubstatus.controller','isAuthenticated','get','/describe','describe','/:id','create'];(function(_0x29c3d1,_0xd92dbb){var _0xd46316=function(_0x4c8975){while(--_0x4c8975){_0x29c3d1['push'](_0x29c3d1['shift']());}};_0xd46316(++_0xd92dbb);}(_0x3da8,0xf2));var _0x83da=function(_0x164237,_0x23da9b){_0x164237=_0x164237-0x0;var _0x32c567=_0x3da8[_0x164237];return _0x32c567;};'use strict';var multer=require(_0x83da('0x0'));var util=require(_0x83da('0x1'));var path=require('path');var timeout=require(_0x83da('0x2'));var express=require(_0x83da('0x3'));var router=express[_0x83da('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x83da('0x5'));var controller=require(_0x83da('0x6'));router['get']('/',auth[_0x83da('0x7')](),controller['index']);router[_0x83da('0x8')](_0x83da('0x9'),auth[_0x83da('0x7')](),controller[_0x83da('0xa')]);router[_0x83da('0x8')](_0x83da('0xb'),auth[_0x83da('0x7')](),controller['show']);router['post']('/',auth[_0x83da('0x7')](),controller[_0x83da('0xc')]);router[_0x83da('0xd')](_0x83da('0xb'),auth[_0x83da('0x7')](),controller[_0x83da('0xe')]);router[_0x83da('0xf')](_0x83da('0xb'),auth[_0x83da('0x7')](),controller['destroy']);module[_0x83da('0x10')]=router; \ No newline at end of file +var _0x51a0=['express','Router','../../components/auth/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','describe','/:id','show','post','put','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x1a51db,_0x2eecdc){var _0xea0473=function(_0x54b391){while(--_0x54b391){_0x1a51db['push'](_0x1a51db['shift']());}};_0xea0473(++_0x2eecdc);}(_0x51a0,0x18b));var _0x051a=function(_0x8fb7a4,_0x607700){_0x8fb7a4=_0x8fb7a4-0x0;var _0x1fdca2=_0x51a0[_0x8fb7a4];return _0x1fdca2;};'use strict';var multer=require(_0x051a('0x0'));var util=require(_0x051a('0x1'));var path=require(_0x051a('0x2'));var timeout=require(_0x051a('0x3'));var express=require(_0x051a('0x4'));var router=express[_0x051a('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x051a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x051a('0x7'));var controller=require(_0x051a('0x8'));router[_0x051a('0x9')]('/',auth[_0x051a('0xa')](),controller['index']);router['get']('/describe',auth[_0x051a('0xa')](),controller[_0x051a('0xb')]);router[_0x051a('0x9')](_0x051a('0xc'),auth[_0x051a('0xa')](),controller[_0x051a('0xd')]);router[_0x051a('0xe')]('/',auth[_0x051a('0xa')](),controller['create']);router[_0x051a('0xf')](_0x051a('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x051a('0x10')](_0x051a('0xc'),auth[_0x051a('0xa')](),controller[_0x051a('0x11')]);module[_0x051a('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 67d036c..bbd4cab 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 _0x0309=['STRING','sequelize'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x0309,0x165));var _0x9030=function(_0x1a6fec,_0x33077c){_0x1a6fec=_0x1a6fec-0x0;var _0x283065=_0x0309[_0x1a6fec];return _0x283065;};'use strict';var Sequelize=require(_0x9030('0x0'));module['exports']={'name':{'type':Sequelize[_0x9030('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9030('0x1')]}}; \ No newline at end of file +var _0x7d9f=['sequelize','exports','STRING','name'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x7d9f,0x15c));var _0xf7d9=function(_0x1399d6,_0x2c1661){_0x1399d6=_0x1399d6-0x0;var _0x4a9db4=_0x7d9f[_0x1399d6];return _0x4a9db4;};'use strict';var Sequelize=require(_0xf7d9('0x0'));module[_0xf7d9('0x1')]={'name':{'type':Sequelize[_0xf7d9('0x2')],'unique':_0xf7d9('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xf7d9('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index d725718..9e62e6d 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 _0xf170=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','end','stack','send','index','map','MailSubstatus','rawAttributes','fieldName','name','query','keys','model','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','eml-format','rimraf','zip-dir','moment','mustache','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x1c1b20,_0x2ae408){var _0x4b56bf=function(_0x555571){while(--_0x555571){_0x1c1b20['push'](_0x1c1b20['shift']());}};_0x4b56bf(++_0x2ae408);}(_0xf170,0x80));var _0x0f17=function(_0x2ec2bf,_0x64e983){_0x2ec2bf=_0x2ec2bf-0x0;var _0x2c279c=_0xf170[_0x2ec2bf];return _0x2c279c;};'use strict';var emlformat=require(_0x0f17('0x0'));var rimraf=require(_0x0f17('0x1'));var zipdir=require(_0x0f17('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0f17('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0f17('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x0f17('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0f17('0x6'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x0f17('0x7'));var jsforce=require(_0x0f17('0x8'));var deskjs=require(_0x0f17('0x9'));var toCsv=require(_0x0f17('0x5'));var querystring=require(_0x0f17('0xa'));var Papa=require(_0x0f17('0xb'));var Redis=require('ioredis');var authService=require(_0x0f17('0xc'));var qs=require(_0x0f17('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0f17('0xe'));var logger=require(_0x0f17('0xf'))(_0x0f17('0x10'));var utils=require(_0x0f17('0x11'));var config=require(_0x0f17('0x12'));var licenseUtil=require(_0x0f17('0x13'));var db=require(_0x0f17('0x14'))['db'];function respondWithStatusCode(_0x3dbbc2,_0x3a1397){_0x3a1397=_0x3a1397||0xcc;return function(_0x22a971){if(_0x22a971){return _0x3dbbc2[_0x0f17('0x15')](_0x3a1397);}return _0x3dbbc2[_0x0f17('0x16')](_0x3a1397)['end']();};}function respondWithResult(_0x2f826d,_0x1bb915){_0x1bb915=_0x1bb915||0xc8;return function(_0x3430d3){if(_0x3430d3){return _0x2f826d[_0x0f17('0x16')](_0x1bb915)[_0x0f17('0x17')](_0x3430d3);}};}function respondWithFilteredResult(_0x14d76a,_0x233e19){return function(_0x2d8739){if(_0x2d8739){var _0x3872c6=typeof _0x233e19[_0x0f17('0x18')]===_0x0f17('0x19')&&typeof _0x233e19[_0x0f17('0x1a')]===_0x0f17('0x19');var _0x7d6b3=_0x2d8739['count'];var _0x408003=_0x3872c6?0x0:_0x233e19[_0x0f17('0x18')];var _0x129bd5=_0x3872c6?_0x2d8739[_0x0f17('0x1b')]:_0x233e19['offset']+_0x233e19[_0x0f17('0x1a')];var _0x392f33;if(_0x129bd5>=_0x7d6b3){_0x129bd5=_0x7d6b3;_0x392f33=0xc8;}else{_0x392f33=0xce;}_0x14d76a[_0x0f17('0x16')](_0x392f33);return _0x14d76a[_0x0f17('0x1c')](_0x0f17('0x1d'),_0x408003+'-'+_0x129bd5+'/'+_0x7d6b3)['json'](_0x2d8739);}return null;};}function patchUpdates(_0x59a712){return function(_0x5d4e0c){try{jsonpatch['apply'](_0x5d4e0c,_0x59a712,!![]);}catch(_0x59403f){return BPromise['reject'](_0x59403f);}return _0x5d4e0c[_0x0f17('0x1e')]();};}function saveUpdates(_0x45fca4,_0xc33453){return function(_0x3ec68f){if(_0x3ec68f){return _0x3ec68f[_0x0f17('0x1f')](_0x45fca4)[_0x0f17('0x20')](function(_0x3d56d1){return _0x3d56d1;});}return null;};}function removeEntity(_0x4a4b1a,_0x478119){return function(_0x304d04){if(_0x304d04){return _0x304d04[_0x0f17('0x21')]()['then'](function(){_0x4a4b1a[_0x0f17('0x16')](0xcc)[_0x0f17('0x22')]();});}};}function handleEntityNotFound(_0x36c8b7,_0x59afb5){return function(_0x3bad63){if(!_0x3bad63){_0x36c8b7[_0x0f17('0x15')](0x194);}return _0x3bad63;};}function handleError(_0x5badce,_0x5445d2){_0x5445d2=_0x5445d2||0x1f4;return function(_0x56eab4){logger['error'](_0x56eab4[_0x0f17('0x23')]);if(_0x56eab4['name']){delete _0x56eab4['name'];}_0x5badce['status'](_0x5445d2)[_0x0f17('0x24')](_0x56eab4);};}exports[_0x0f17('0x25')]=function(_0x4a381a,_0x1d5b29){var _0x2a9af5={},_0x530fac={},_0x22aa77={'count':0x0,'rows':[]};var _0x2b7441=_[_0x0f17('0x26')](db[_0x0f17('0x27')][_0x0f17('0x28')],function(_0x436e5a){return{'name':_0x436e5a[_0x0f17('0x29')],'type':_0x436e5a['type']['key']};});_0x530fac['model']=_[_0x0f17('0x26')](_0x2b7441,_0x0f17('0x2a'));_0x530fac[_0x0f17('0x2b')]=_[_0x0f17('0x2c')](_0x4a381a[_0x0f17('0x2b')]);_0x530fac['filters']=_['intersection'](_0x530fac[_0x0f17('0x2d')],_0x530fac[_0x0f17('0x2b')]);_0x2a9af5[_0x0f17('0x2e')]=_[_0x0f17('0x2f')](_0x530fac['model'],qs[_0x0f17('0x30')](_0x4a381a[_0x0f17('0x2b')][_0x0f17('0x30')]));_0x2a9af5[_0x0f17('0x2e')]=_0x2a9af5[_0x0f17('0x2e')][_0x0f17('0x31')]?_0x2a9af5[_0x0f17('0x2e')]:_0x530fac[_0x0f17('0x2d')];if(!_0x4a381a[_0x0f17('0x2b')]['hasOwnProperty'](_0x0f17('0x32'))){_0x2a9af5[_0x0f17('0x1a')]=qs['limit'](_0x4a381a[_0x0f17('0x2b')][_0x0f17('0x1a')]);_0x2a9af5[_0x0f17('0x18')]=qs[_0x0f17('0x18')](_0x4a381a[_0x0f17('0x2b')][_0x0f17('0x18')]);}_0x2a9af5[_0x0f17('0x33')]=qs[_0x0f17('0x34')](_0x4a381a['query']['sort']);_0x2a9af5[_0x0f17('0x35')]=qs[_0x0f17('0x36')](_[_0x0f17('0x37')](_0x4a381a[_0x0f17('0x2b')],_0x530fac['filters']),_0x2b7441);if(_0x4a381a['query'][_0x0f17('0x38')]){_0x2a9af5[_0x0f17('0x35')]=_['merge'](_0x2a9af5[_0x0f17('0x35')],{'$or':_[_0x0f17('0x26')](_0x2b7441,function(_0x1ff063){if(_0x1ff063['type']!==_0x0f17('0x39')){var _0x4cef81={};_0x4cef81[_0x1ff063[_0x0f17('0x2a')]]={'$like':'%'+_0x4a381a['query'][_0x0f17('0x38')]+'%'};return _0x4cef81;}})});}_0x2a9af5=_[_0x0f17('0x3a')]({},_0x2a9af5,_0x4a381a[_0x0f17('0x3b')]);var _0x357c4f={'where':_0x2a9af5[_0x0f17('0x35')]};return db[_0x0f17('0x27')][_0x0f17('0x1b')](_0x357c4f)['then'](function(_0x2a24b2){_0x22aa77['count']=_0x2a24b2;if(_0x4a381a[_0x0f17('0x2b')][_0x0f17('0x3c')]){_0x2a9af5[_0x0f17('0x3d')]=[{'all':!![]}];}return db[_0x0f17('0x27')][_0x0f17('0x3e')](_0x2a9af5);})[_0x0f17('0x20')](function(_0x9343d3){_0x22aa77[_0x0f17('0x3f')]=_0x9343d3;return _0x22aa77;})[_0x0f17('0x20')](respondWithFilteredResult(_0x1d5b29,_0x2a9af5))[_0x0f17('0x40')](handleError(_0x1d5b29,null));};exports[_0x0f17('0x41')]=function(_0xebefeb,_0x403653){var _0x37845b={'raw':!![],'where':{'id':_0xebefeb['params']['id']}},_0x28f01b={};_0x28f01b[_0x0f17('0x2d')]=_[_0x0f17('0x2c')](db[_0x0f17('0x27')]['rawAttributes']);_0x28f01b[_0x0f17('0x2b')]=_[_0x0f17('0x2c')](_0xebefeb['query']);_0x28f01b['filters']=_['intersection'](_0x28f01b[_0x0f17('0x2d')],_0x28f01b['query']);_0x37845b[_0x0f17('0x2e')]=_['intersection'](_0x28f01b[_0x0f17('0x2d')],qs[_0x0f17('0x30')](_0xebefeb['query'][_0x0f17('0x30')]));_0x37845b[_0x0f17('0x2e')]=_0x37845b[_0x0f17('0x2e')][_0x0f17('0x31')]?_0x37845b[_0x0f17('0x2e')]:_0x28f01b[_0x0f17('0x2d')];if(_0xebefeb['query'][_0x0f17('0x3c')]){_0x37845b[_0x0f17('0x3d')]=[{'all':!![]}];}_0x37845b=_[_0x0f17('0x3a')]({},_0x37845b,_0xebefeb[_0x0f17('0x3b')]);return db[_0x0f17('0x27')][_0x0f17('0x42')](_0x37845b)[_0x0f17('0x20')](handleEntityNotFound(_0x403653,null))['then'](respondWithResult(_0x403653,null))[_0x0f17('0x40')](handleError(_0x403653,null));};exports[_0x0f17('0x43')]=function(_0x4ea0cb,_0x57793a){return db['MailSubstatus']['create'](_0x4ea0cb['body'],{})[_0x0f17('0x20')](respondWithResult(_0x57793a,0xc9))[_0x0f17('0x40')](handleError(_0x57793a,null));};exports['update']=function(_0x3cef76,_0x356f3a){if(_0x3cef76[_0x0f17('0x44')]['id']){delete _0x3cef76[_0x0f17('0x44')]['id'];}return db[_0x0f17('0x27')][_0x0f17('0x42')]({'where':{'id':_0x3cef76[_0x0f17('0x45')]['id']}})[_0x0f17('0x20')](handleEntityNotFound(_0x356f3a,null))[_0x0f17('0x20')](saveUpdates(_0x3cef76[_0x0f17('0x44')],null))[_0x0f17('0x20')](respondWithResult(_0x356f3a,null))['catch'](handleError(_0x356f3a,null));};exports[_0x0f17('0x21')]=function(_0x2cb0af,_0x42f20a){return db[_0x0f17('0x27')]['find']({'where':{'id':_0x2cb0af['params']['id']}})['then'](handleEntityNotFound(_0x42f20a,null))[_0x0f17('0x20')](removeEntity(_0x42f20a,null))[_0x0f17('0x40')](handleError(_0x42f20a,null));};exports[_0x0f17('0x46')]=function(_0x350c4e,_0x5f282a){return db[_0x0f17('0x27')][_0x0f17('0x46')]()[_0x0f17('0x20')](respondWithResult(_0x5f282a,null))[_0x0f17('0x40')](handleError(_0x5f282a,null));}; \ No newline at end of file +var _0x566a=['error','stack','name','send','map','MailSubstatus','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','lodash','squel','jsforce','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','update','then','destroy'];(function(_0x2aa3ca,_0x88f99){var _0xf3cc17=function(_0x22a0d7){while(--_0x22a0d7){_0x2aa3ca['push'](_0x2aa3ca['shift']());}};_0xf3cc17(++_0x88f99);}(_0x566a,0xb0));var _0xa566=function(_0x278821,_0x4112c6){_0x278821=_0x278821-0x0;var _0x68e139=_0x566a[_0x278821];return _0x68e139;};'use strict';var emlformat=require(_0xa566('0x0'));var rimraf=require(_0xa566('0x1'));var zipdir=require(_0xa566('0x2'));var jsonpatch=require(_0xa566('0x3'));var rp=require(_0xa566('0x4'));var moment=require(_0xa566('0x5'));var BPromise=require(_0xa566('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa566('0x7'));var sox=require(_0xa566('0x8'));var csv=require(_0xa566('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa566('0xa'));var squel=require(_0xa566('0xb'));var crypto=require('crypto');var jsforce=require(_0xa566('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa566('0x9'));var querystring=require('querystring');var Papa=require(_0xa566('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa566('0xe'));var as=require(_0xa566('0xf'));var hardwareService=require(_0xa566('0x10'));var logger=require(_0xa566('0x11'))(_0xa566('0x12'));var utils=require(_0xa566('0x13'));var config=require(_0xa566('0x14'));var licenseUtil=require(_0xa566('0x15'));var db=require(_0xa566('0x16'))['db'];function respondWithStatusCode(_0xde4b1e,_0x9de93c){_0x9de93c=_0x9de93c||0xcc;return function(_0xe9a638){if(_0xe9a638){return _0xde4b1e[_0xa566('0x17')](_0x9de93c);}return _0xde4b1e[_0xa566('0x18')](_0x9de93c)[_0xa566('0x19')]();};}function respondWithResult(_0x8f05e5,_0x22cc19){_0x22cc19=_0x22cc19||0xc8;return function(_0x7c2603){if(_0x7c2603){return _0x8f05e5[_0xa566('0x18')](_0x22cc19)[_0xa566('0x1a')](_0x7c2603);}};}function respondWithFilteredResult(_0x11ed97,_0x3204b6){return function(_0x104163){if(_0x104163){var _0x20e057=typeof _0x3204b6[_0xa566('0x1b')]==='undefined'&&typeof _0x3204b6[_0xa566('0x1c')]==='undefined';var _0x12e834=_0x104163[_0xa566('0x1d')];var _0x41ac38=_0x20e057?0x0:_0x3204b6[_0xa566('0x1b')];var _0x3736a7=_0x20e057?_0x104163[_0xa566('0x1d')]:_0x3204b6[_0xa566('0x1b')]+_0x3204b6['limit'];var _0x2249b9;if(_0x3736a7>=_0x12e834){_0x3736a7=_0x12e834;_0x2249b9=0xc8;}else{_0x2249b9=0xce;}_0x11ed97[_0xa566('0x18')](_0x2249b9);return _0x11ed97[_0xa566('0x1e')](_0xa566('0x1f'),_0x41ac38+'-'+_0x3736a7+'/'+_0x12e834)[_0xa566('0x1a')](_0x104163);}return null;};}function patchUpdates(_0x19ccc6){return function(_0x177eef){try{jsonpatch[_0xa566('0x20')](_0x177eef,_0x19ccc6,!![]);}catch(_0x1e767e){return BPromise[_0xa566('0x21')](_0x1e767e);}return _0x177eef['save']();};}function saveUpdates(_0x564345,_0x4973c5){return function(_0x417958){if(_0x417958){return _0x417958[_0xa566('0x22')](_0x564345)[_0xa566('0x23')](function(_0x210c15){return _0x210c15;});}return null;};}function removeEntity(_0x4c0d60,_0x48eb2a){return function(_0x460ed2){if(_0x460ed2){return _0x460ed2[_0xa566('0x24')]()[_0xa566('0x23')](function(){_0x4c0d60[_0xa566('0x18')](0xcc)[_0xa566('0x19')]();});}};}function handleEntityNotFound(_0x15c9dd,_0x2a4d4b){return function(_0x3ce043){if(!_0x3ce043){_0x15c9dd[_0xa566('0x17')](0x194);}return _0x3ce043;};}function handleError(_0x197778,_0x42a479){_0x42a479=_0x42a479||0x1f4;return function(_0x4aad9e){logger[_0xa566('0x25')](_0x4aad9e[_0xa566('0x26')]);if(_0x4aad9e[_0xa566('0x27')]){delete _0x4aad9e['name'];}_0x197778['status'](_0x42a479)[_0xa566('0x28')](_0x4aad9e);};}exports['index']=function(_0x2b404a,_0x165517){var _0x1be0eb={},_0x2dcca7={},_0x315203={'count':0x0,'rows':[]};var _0x3c1aa9=_[_0xa566('0x29')](db[_0xa566('0x2a')]['rawAttributes'],function(_0x48f48e){return{'name':_0x48f48e[_0xa566('0x2b')],'type':_0x48f48e[_0xa566('0x2c')]['key']};});_0x2dcca7[_0xa566('0x2d')]=_['map'](_0x3c1aa9,'name');_0x2dcca7['query']=_[_0xa566('0x2e')](_0x2b404a[_0xa566('0x2f')]);_0x2dcca7[_0xa566('0x30')]=_[_0xa566('0x31')](_0x2dcca7[_0xa566('0x2d')],_0x2dcca7[_0xa566('0x2f')]);_0x1be0eb[_0xa566('0x32')]=_[_0xa566('0x31')](_0x2dcca7[_0xa566('0x2d')],qs[_0xa566('0x33')](_0x2b404a[_0xa566('0x2f')][_0xa566('0x33')]));_0x1be0eb[_0xa566('0x32')]=_0x1be0eb['attributes'][_0xa566('0x34')]?_0x1be0eb[_0xa566('0x32')]:_0x2dcca7['model'];if(!_0x2b404a[_0xa566('0x2f')][_0xa566('0x35')]('nolimit')){_0x1be0eb[_0xa566('0x1c')]=qs[_0xa566('0x1c')](_0x2b404a['query'][_0xa566('0x1c')]);_0x1be0eb[_0xa566('0x1b')]=qs[_0xa566('0x1b')](_0x2b404a[_0xa566('0x2f')][_0xa566('0x1b')]);}_0x1be0eb['order']=qs[_0xa566('0x36')](_0x2b404a[_0xa566('0x2f')][_0xa566('0x36')]);_0x1be0eb[_0xa566('0x37')]=qs['filters'](_[_0xa566('0x38')](_0x2b404a['query'],_0x2dcca7[_0xa566('0x30')]),_0x3c1aa9);if(_0x2b404a[_0xa566('0x2f')][_0xa566('0x39')]){_0x1be0eb[_0xa566('0x37')]=_[_0xa566('0x3a')](_0x1be0eb['where'],{'$or':_[_0xa566('0x29')](_0x3c1aa9,function(_0x17bbcf){if(_0x17bbcf[_0xa566('0x2c')]!=='VIRTUAL'){var _0x3ada76={};_0x3ada76[_0x17bbcf[_0xa566('0x27')]]={'$like':'%'+_0x2b404a[_0xa566('0x2f')][_0xa566('0x39')]+'%'};return _0x3ada76;}})});}_0x1be0eb=_[_0xa566('0x3a')]({},_0x1be0eb,_0x2b404a[_0xa566('0x3b')]);var _0x53d4f3={'where':_0x1be0eb[_0xa566('0x37')]};return db[_0xa566('0x2a')][_0xa566('0x1d')](_0x53d4f3)['then'](function(_0x316ca1){_0x315203[_0xa566('0x1d')]=_0x316ca1;if(_0x2b404a['query'][_0xa566('0x3c')]){_0x1be0eb[_0xa566('0x3d')]=[{'all':!![]}];}return db[_0xa566('0x2a')][_0xa566('0x3e')](_0x1be0eb);})[_0xa566('0x23')](function(_0x56b921){_0x315203[_0xa566('0x3f')]=_0x56b921;return _0x315203;})[_0xa566('0x23')](respondWithFilteredResult(_0x165517,_0x1be0eb))[_0xa566('0x40')](handleError(_0x165517,null));};exports[_0xa566('0x41')]=function(_0x511413,_0x1cbda2){var _0x3368a0={'raw':!![],'where':{'id':_0x511413[_0xa566('0x42')]['id']}},_0x561e22={};_0x561e22['model']=_[_0xa566('0x2e')](db[_0xa566('0x2a')]['rawAttributes']);_0x561e22[_0xa566('0x2f')]=_[_0xa566('0x2e')](_0x511413[_0xa566('0x2f')]);_0x561e22[_0xa566('0x30')]=_[_0xa566('0x31')](_0x561e22[_0xa566('0x2d')],_0x561e22['query']);_0x3368a0[_0xa566('0x32')]=_['intersection'](_0x561e22[_0xa566('0x2d')],qs[_0xa566('0x33')](_0x511413['query'][_0xa566('0x33')]));_0x3368a0[_0xa566('0x32')]=_0x3368a0[_0xa566('0x32')][_0xa566('0x34')]?_0x3368a0['attributes']:_0x561e22[_0xa566('0x2d')];if(_0x511413[_0xa566('0x2f')][_0xa566('0x3c')]){_0x3368a0['include']=[{'all':!![]}];}_0x3368a0=_[_0xa566('0x3a')]({},_0x3368a0,_0x511413[_0xa566('0x3b')]);return db['MailSubstatus'][_0xa566('0x43')](_0x3368a0)[_0xa566('0x23')](handleEntityNotFound(_0x1cbda2,null))['then'](respondWithResult(_0x1cbda2,null))['catch'](handleError(_0x1cbda2,null));};exports[_0xa566('0x44')]=function(_0x5d5151,_0x316afe){return db[_0xa566('0x2a')][_0xa566('0x44')](_0x5d5151[_0xa566('0x45')],{})[_0xa566('0x23')](respondWithResult(_0x316afe,0xc9))[_0xa566('0x40')](handleError(_0x316afe,null));};exports[_0xa566('0x22')]=function(_0x37519c,_0x57b12d){if(_0x37519c['body']['id']){delete _0x37519c[_0xa566('0x45')]['id'];}return db[_0xa566('0x2a')][_0xa566('0x43')]({'where':{'id':_0x37519c[_0xa566('0x42')]['id']}})[_0xa566('0x23')](handleEntityNotFound(_0x57b12d,null))[_0xa566('0x23')](saveUpdates(_0x37519c[_0xa566('0x45')],null))[_0xa566('0x23')](respondWithResult(_0x57b12d,null))[_0xa566('0x40')](handleError(_0x57b12d,null));};exports[_0xa566('0x24')]=function(_0x3c37fa,_0x37c440){return db['MailSubstatus']['find']({'where':{'id':_0x3c37fa[_0xa566('0x42')]['id']}})[_0xa566('0x23')](handleEntityNotFound(_0x37c440,null))[_0xa566('0x23')](removeEntity(_0x37c440,null))[_0xa566('0x40')](handleError(_0x37c440,null));};exports[_0xa566('0x46')]=function(_0x605d68,_0x12c97f){return db[_0xa566('0x2a')]['describe']()['then'](respondWithResult(_0x12c97f,null))['catch'](handleError(_0x12c97f,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index a6e0281..c5b0317 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 _0xd790=['mail_substatuses','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./mailSubstatus.attributes','exports','define','MailSubstatus'];(function(_0x53871c,_0xade12c){var _0x3a10ff=function(_0x443efe){while(--_0x443efe){_0x53871c['push'](_0x53871c['shift']());}};_0x3a10ff(++_0xade12c);}(_0xd790,0x83));var _0x0d79=function(_0x56260c,_0x3594bc){_0x56260c=_0x56260c-0x0;var _0x3293b9=_0xd790[_0x56260c];return _0x3293b9;};'use strict';var _=require(_0x0d79('0x0'));var util=require(_0x0d79('0x1'));var logger=require('../../config/logger')(_0x0d79('0x2'));var moment=require(_0x0d79('0x3'));var BPromise=require(_0x0d79('0x4'));var rp=require(_0x0d79('0x5'));var fs=require('fs');var path=require(_0x0d79('0x6'));var rimraf=require(_0x0d79('0x7'));var config=require('../../config/environment');var attributes=require(_0x0d79('0x8'));module[_0x0d79('0x9')]=function(_0xdfef71,_0x1af400){return _0xdfef71[_0x0d79('0xa')](_0x0d79('0xb'),attributes,{'tableName':_0x0d79('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9e0c=['moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','MailSubstatus','mail_substatuses','lodash','util','../../config/logger'];(function(_0x383356,_0x33d2f5){var _0x32ee5a=function(_0x2741db){while(--_0x2741db){_0x383356['push'](_0x383356['shift']());}};_0x32ee5a(++_0x33d2f5);}(_0x9e0c,0x11d));var _0xc9e0=function(_0x346b96,_0x408b05){_0x346b96=_0x346b96-0x0;var _0x1bc3e1=_0x9e0c[_0x346b96];return _0x1bc3e1;};'use strict';var _=require(_0xc9e0('0x0'));var util=require(_0xc9e0('0x1'));var logger=require(_0xc9e0('0x2'))('api');var moment=require(_0xc9e0('0x3'));var BPromise=require(_0xc9e0('0x4'));var rp=require(_0xc9e0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc9e0('0x6'));var config=require(_0xc9e0('0x7'));var attributes=require('./mailSubstatus.attributes');module[_0xc9e0('0x8')]=function(_0x312151,_0x5a3c2d){return _0x312151[_0xc9e0('0x9')](_0xc9e0('0xa'),attributes,{'tableName':_0xc9e0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index cdba591..2d64f5f 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 _0x0a08=['catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x46361e,_0x243aaf){var _0x14e302=function(_0x9ebecf){while(--_0x9ebecf){_0x46361e['push'](_0x46361e['shift']());}};_0x14e302(++_0x243aaf);}(_0x0a08,0x65));var _0x80a0=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0x0a08[_0x481bf7];return _0x461787;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x80a0('0x0'));var BPromise=require(_0x80a0('0x1'));var rs=require(_0x80a0('0x2'));var fs=require('fs');var Redis=require(_0x80a0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x80a0('0x4'));var logger=require(_0x80a0('0x5'))(_0x80a0('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x80a0('0x7')][_0x80a0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xb94b55,_0x46b894,_0xb0743c){return new BPromise(function(_0x811df7,_0x29064b){return client[_0x80a0('0x9')](_0xb94b55,_0xb0743c)[_0x80a0('0xa')](function(_0x15d188){logger[_0x80a0('0xb')](_0x80a0('0xc'),_0x46b894,_0x80a0('0xd'));logger[_0x80a0('0xe')](_0x80a0('0xf'),_0x46b894,_0x80a0('0xd'),JSON['stringify'](_0x15d188));if(_0x15d188[_0x80a0('0x10')]){if(_0x15d188[_0x80a0('0x10')][_0x80a0('0x11')]===0x1f4){logger[_0x80a0('0x10')](_0x80a0('0xc'),_0x46b894,_0x15d188[_0x80a0('0x10')][_0x80a0('0x12')]);return _0x29064b(_0x15d188[_0x80a0('0x10')][_0x80a0('0x12')]);}logger[_0x80a0('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x46b894,_0x15d188[_0x80a0('0x10')][_0x80a0('0x12')]);return _0x811df7(_0x15d188[_0x80a0('0x10')]['message']);}else{logger['info'](_0x80a0('0xc'),_0x46b894,_0x80a0('0xd'));_0x811df7(_0x15d188['result'][_0x80a0('0x12')]);}})[_0x80a0('0x13')](function(_0x1c2576){logger[_0x80a0('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x46b894,_0x1c2576);_0x29064b(_0x1c2576);});});} \ No newline at end of file +var _0xe053=['MailSubstatus,\x20%s,\x20%s','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','catch','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','then'];(function(_0x59fa1b,_0x13aabe){var _0xc21e4c=function(_0x17f811){while(--_0x17f811){_0x59fa1b['push'](_0x59fa1b['shift']());}};_0xc21e4c(++_0x13aabe);}(_0xe053,0x91));var _0x3e05=function(_0x561771,_0x554760){_0x561771=_0x561771-0x0;var _0x54d16e=_0xe053[_0x561771];return _0x54d16e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3e05('0x0'));var BPromise=require(_0x3e05('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3e05('0x2'))['db'];var utils=require(_0x3e05('0x3'));var logger=require(_0x3e05('0x4'))(_0x3e05('0x5'));var config=require(_0x3e05('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x27fc0f,_0x583963,_0x21e940){return new BPromise(function(_0x494ac9,_0x12a2dd){return client['request'](_0x27fc0f,_0x21e940)[_0x3e05('0x7')](function(_0x2c7f54){logger['info'](_0x3e05('0x8'),_0x583963,'request\x20sent');logger[_0x3e05('0x9')](_0x3e05('0xa'),_0x583963,_0x3e05('0xb'),JSON[_0x3e05('0xc')](_0x2c7f54));if(_0x2c7f54['error']){if(_0x2c7f54[_0x3e05('0xd')]['code']===0x1f4){logger[_0x3e05('0xd')](_0x3e05('0x8'),_0x583963,_0x2c7f54[_0x3e05('0xd')][_0x3e05('0xe')]);return _0x12a2dd(_0x2c7f54['error']['message']);}logger['error'](_0x3e05('0x8'),_0x583963,_0x2c7f54[_0x3e05('0xd')][_0x3e05('0xe')]);return _0x494ac9(_0x2c7f54[_0x3e05('0xd')][_0x3e05('0xe')]);}else{logger[_0x3e05('0xf')](_0x3e05('0x8'),_0x583963,_0x3e05('0xb'));_0x494ac9(_0x2c7f54['result']['message']);}})[_0x3e05('0x10')](function(_0x311bfa){logger[_0x3e05('0xd')](_0x3e05('0x8'),_0x583963,_0x311bfa);_0x12a2dd(_0x311bfa);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index f135250..9aea837 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 _0x9448=['describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','./mailTransferReport.controller','index','get','/describe','isAuthenticated'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x9448,0x112));var _0x8944=function(_0xd07790,_0x3db009){_0xd07790=_0xd07790-0x0;var _0x32f10e=_0x9448[_0xd07790];return _0x32f10e;};'use strict';var multer=require(_0x8944('0x0'));var util=require(_0x8944('0x1'));var path=require(_0x8944('0x2'));var timeout=require(_0x8944('0x3'));var express=require(_0x8944('0x4'));var router=express[_0x8944('0x5')]();var fs_extra=require(_0x8944('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8944('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x8944('0x8')]);router[_0x8944('0x9')](_0x8944('0xa'),auth[_0x8944('0xb')](),controller[_0x8944('0xc')]);router[_0x8944('0x9')](_0x8944('0xd'),auth[_0x8944('0xb')](),controller[_0x8944('0xe')]);router[_0x8944('0xf')]('/',auth['isAuthenticated'](),controller[_0x8944('0x10')]);router[_0x8944('0x11')]('/:id',auth[_0x8944('0xb')](),controller[_0x8944('0x12')]);router[_0x8944('0x13')](_0x8944('0xd'),auth[_0x8944('0xb')](),controller[_0x8944('0x14')]);module[_0x8944('0x15')]=router; \ No newline at end of file +var _0xa9b6=['exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe','/:id','post','create','put','update','delete'];(function(_0x31a1b5,_0x5bdb93){var _0x122e46=function(_0x32735e){while(--_0x32735e){_0x31a1b5['push'](_0x31a1b5['shift']());}};_0x122e46(++_0x5bdb93);}(_0xa9b6,0x119));var _0x6a9b=function(_0x155f5f,_0x250b6b){_0x155f5f=_0x155f5f-0x0;var _0x4b1014=_0xa9b6[_0x155f5f];return _0x4b1014;};'use strict';var multer=require(_0x6a9b('0x0'));var util=require('util');var path=require(_0x6a9b('0x1'));var timeout=require(_0x6a9b('0x2'));var express=require(_0x6a9b('0x3'));var router=express[_0x6a9b('0x4')]();var fs_extra=require(_0x6a9b('0x5'));var auth=require(_0x6a9b('0x6'));var interaction=require(_0x6a9b('0x7'));var config=require(_0x6a9b('0x8'));var controller=require('./mailTransferReport.controller');router[_0x6a9b('0x9')]('/',auth['isAuthenticated'](),controller[_0x6a9b('0xa')]);router[_0x6a9b('0x9')]('/describe',auth[_0x6a9b('0xb')](),controller[_0x6a9b('0xc')]);router['get'](_0x6a9b('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x6a9b('0xe')]('/',auth[_0x6a9b('0xb')](),controller[_0x6a9b('0xf')]);router[_0x6a9b('0x10')](_0x6a9b('0xd'),auth['isAuthenticated'](),controller[_0x6a9b('0x11')]);router[_0x6a9b('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x6a9b('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 6aaa1e9..ece104e 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 _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x19115e,_0x507bab){var _0x45bbd4=function(_0x1308bf){while(--_0x1308bf){_0x19115e['push'](_0x19115e['shift']());}};_0x45bbd4(++_0x507bab);}(_0x9c44,0x178));var _0x49c4=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x9c44[_0x5d2803];return _0xdcad2c;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file +var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x2a4692,_0x5db910){var _0x370e6b=function(_0x5b4e23){while(--_0x5b4e23){_0x2a4692['push'](_0x2a4692['shift']());}};_0x370e6b(++_0x5db910);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'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 e679bf2..15ff3d0 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 _0x4a20=['show','length','find','create','body','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','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','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','MailTransferReport','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','options','includeAll','include','findAll','catch'];(function(_0xefe95f,_0x4c6493){var _0x29a7ee=function(_0x15c070){while(--_0x15c070){_0xefe95f['push'](_0xefe95f['shift']());}};_0x29a7ee(++_0x4c6493);}(_0x4a20,0xa5));var _0x04a2=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0x4a20[_0x565ed7];return _0x183ad7;};'use strict';var emlformat=require(_0x04a2('0x0'));var rimraf=require(_0x04a2('0x1'));var zipdir=require(_0x04a2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x04a2('0x3'));var moment=require(_0x04a2('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x04a2('0x5'));var path=require(_0x04a2('0x6'));var sox=require(_0x04a2('0x7'));var csv=require(_0x04a2('0x8'));var ejs=require(_0x04a2('0x9'));var fs=require('fs');var fs_extra=require(_0x04a2('0xa'));var _=require(_0x04a2('0xb'));var squel=require('squel');var crypto=require(_0x04a2('0xc'));var jsforce=require(_0x04a2('0xd'));var deskjs=require(_0x04a2('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x04a2('0xf'));var Redis=require(_0x04a2('0x10'));var authService=require(_0x04a2('0x11'));var qs=require(_0x04a2('0x12'));var as=require(_0x04a2('0x13'));var hardwareService=require(_0x04a2('0x14'));var logger=require(_0x04a2('0x15'))(_0x04a2('0x16'));var utils=require(_0x04a2('0x17'));var config=require(_0x04a2('0x18'));var licenseUtil=require(_0x04a2('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x541f06,_0x46a4d6){_0x46a4d6=_0x46a4d6||0xcc;return function(_0x2b6d12){if(_0x2b6d12){return _0x541f06[_0x04a2('0x1a')](_0x46a4d6);}return _0x541f06[_0x04a2('0x1b')](_0x46a4d6)[_0x04a2('0x1c')]();};}function respondWithResult(_0x45f57c,_0x243c77){_0x243c77=_0x243c77||0xc8;return function(_0xf4749d){if(_0xf4749d){return _0x45f57c[_0x04a2('0x1b')](_0x243c77)[_0x04a2('0x1d')](_0xf4749d);}};}function respondWithFilteredResult(_0x23fda0,_0x188a36){return function(_0x1f3b6b){if(_0x1f3b6b){var _0xb34b88=typeof _0x188a36[_0x04a2('0x1e')]===_0x04a2('0x1f')&&typeof _0x188a36[_0x04a2('0x20')]===_0x04a2('0x1f');var _0x4e7395=_0x1f3b6b[_0x04a2('0x21')];var _0x5c70ab=_0xb34b88?0x0:_0x188a36[_0x04a2('0x1e')];var _0x1c5ef8=_0xb34b88?_0x1f3b6b[_0x04a2('0x21')]:_0x188a36[_0x04a2('0x1e')]+_0x188a36[_0x04a2('0x20')];var _0x1b553a;if(_0x1c5ef8>=_0x4e7395){_0x1c5ef8=_0x4e7395;_0x1b553a=0xc8;}else{_0x1b553a=0xce;}_0x23fda0[_0x04a2('0x1b')](_0x1b553a);return _0x23fda0[_0x04a2('0x22')](_0x04a2('0x23'),_0x5c70ab+'-'+_0x1c5ef8+'/'+_0x4e7395)[_0x04a2('0x1d')](_0x1f3b6b);}return null;};}function patchUpdates(_0x4e5c84){return function(_0x18a079){try{jsonpatch['apply'](_0x18a079,_0x4e5c84,!![]);}catch(_0x56cf8d){return BPromise[_0x04a2('0x24')](_0x56cf8d);}return _0x18a079[_0x04a2('0x25')]();};}function saveUpdates(_0x875bcc,_0x2b929e){return function(_0x21d522){if(_0x21d522){return _0x21d522[_0x04a2('0x26')](_0x875bcc)[_0x04a2('0x27')](function(_0x44fabb){return _0x44fabb;});}return null;};}function removeEntity(_0x4a95ca,_0x5e1f20){return function(_0x53bba2){if(_0x53bba2){return _0x53bba2[_0x04a2('0x28')]()['then'](function(){_0x4a95ca[_0x04a2('0x1b')](0xcc)[_0x04a2('0x1c')]();});}};}function handleEntityNotFound(_0x2c53f9,_0x3b2e25){return function(_0x2acf7b){if(!_0x2acf7b){_0x2c53f9[_0x04a2('0x1a')](0x194);}return _0x2acf7b;};}function handleError(_0x516d60,_0x4bfb23){_0x4bfb23=_0x4bfb23||0x1f4;return function(_0x21de81){logger[_0x04a2('0x29')](_0x21de81[_0x04a2('0x2a')]);if(_0x21de81[_0x04a2('0x2b')]){delete _0x21de81['name'];}_0x516d60[_0x04a2('0x1b')](_0x4bfb23)[_0x04a2('0x2c')](_0x21de81);};}exports[_0x04a2('0x2d')]=function(_0x57ce6f,_0x3b6816){var _0x545ffe={},_0x2fe80c={},_0x5bafc3={'count':0x0,'rows':[]};var _0x276c95=_[_0x04a2('0x2e')](db[_0x04a2('0x2f')][_0x04a2('0x30')],function(_0x406d68){return{'name':_0x406d68[_0x04a2('0x31')],'type':_0x406d68['type'][_0x04a2('0x32')]};});_0x2fe80c[_0x04a2('0x33')]=_['map'](_0x276c95,_0x04a2('0x2b'));_0x2fe80c[_0x04a2('0x34')]=_[_0x04a2('0x35')](_0x57ce6f[_0x04a2('0x34')]);_0x2fe80c['filters']=_[_0x04a2('0x36')](_0x2fe80c[_0x04a2('0x33')],_0x2fe80c[_0x04a2('0x34')]);_0x545ffe['attributes']=_[_0x04a2('0x36')](_0x2fe80c[_0x04a2('0x33')],qs[_0x04a2('0x37')](_0x57ce6f[_0x04a2('0x34')]['fields']));_0x545ffe[_0x04a2('0x38')]=_0x545ffe['attributes']['length']?_0x545ffe[_0x04a2('0x38')]:_0x2fe80c[_0x04a2('0x33')];if(!_0x57ce6f['query'][_0x04a2('0x39')](_0x04a2('0x3a'))){_0x545ffe['limit']=qs[_0x04a2('0x20')](_0x57ce6f[_0x04a2('0x34')][_0x04a2('0x20')]);_0x545ffe[_0x04a2('0x1e')]=qs[_0x04a2('0x1e')](_0x57ce6f[_0x04a2('0x34')]['offset']);}_0x545ffe[_0x04a2('0x3b')]=qs[_0x04a2('0x3c')](_0x57ce6f['query']['sort']);_0x545ffe[_0x04a2('0x3d')]=qs[_0x04a2('0x3e')](_[_0x04a2('0x3f')](_0x57ce6f[_0x04a2('0x34')],_0x2fe80c[_0x04a2('0x3e')]),_0x276c95);if(_0x57ce6f[_0x04a2('0x34')][_0x04a2('0x40')]){_0x545ffe[_0x04a2('0x3d')]=_[_0x04a2('0x41')](_0x545ffe[_0x04a2('0x3d')],{'$or':_[_0x04a2('0x2e')](_0x276c95,function(_0x174dc0){if(_0x174dc0[_0x04a2('0x42')]!=='VIRTUAL'){var _0x1233f4={};_0x1233f4[_0x174dc0[_0x04a2('0x2b')]]={'$like':'%'+_0x57ce6f[_0x04a2('0x34')]['filter']+'%'};return _0x1233f4;}})});}_0x545ffe=_['merge']({},_0x545ffe,_0x57ce6f[_0x04a2('0x43')]);var _0x2b87a9={'where':_0x545ffe[_0x04a2('0x3d')]};return db[_0x04a2('0x2f')][_0x04a2('0x21')](_0x2b87a9)[_0x04a2('0x27')](function(_0xd874a6){_0x5bafc3['count']=_0xd874a6;if(_0x57ce6f[_0x04a2('0x34')][_0x04a2('0x44')]){_0x545ffe[_0x04a2('0x45')]=[{'all':!![]}];}return db[_0x04a2('0x2f')][_0x04a2('0x46')](_0x545ffe);})[_0x04a2('0x27')](function(_0x138732){_0x5bafc3['rows']=_0x138732;return _0x5bafc3;})[_0x04a2('0x27')](respondWithFilteredResult(_0x3b6816,_0x545ffe))[_0x04a2('0x47')](handleError(_0x3b6816,null));};exports[_0x04a2('0x48')]=function(_0x4f0d91,_0x58aaa8){var _0x551b36={'raw':!![],'where':{'id':_0x4f0d91['params']['id']}},_0x436646={};_0x436646[_0x04a2('0x33')]=_[_0x04a2('0x35')](db[_0x04a2('0x2f')][_0x04a2('0x30')]);_0x436646['query']=_[_0x04a2('0x35')](_0x4f0d91[_0x04a2('0x34')]);_0x436646[_0x04a2('0x3e')]=_[_0x04a2('0x36')](_0x436646[_0x04a2('0x33')],_0x436646[_0x04a2('0x34')]);_0x551b36[_0x04a2('0x38')]=_[_0x04a2('0x36')](_0x436646[_0x04a2('0x33')],qs[_0x04a2('0x37')](_0x4f0d91[_0x04a2('0x34')]['fields']));_0x551b36[_0x04a2('0x38')]=_0x551b36[_0x04a2('0x38')][_0x04a2('0x49')]?_0x551b36[_0x04a2('0x38')]:_0x436646['model'];if(_0x4f0d91['query'][_0x04a2('0x44')]){_0x551b36['include']=[{'all':!![]}];}_0x551b36=_['merge']({},_0x551b36,_0x4f0d91[_0x04a2('0x43')]);return db[_0x04a2('0x2f')][_0x04a2('0x4a')](_0x551b36)[_0x04a2('0x27')](handleEntityNotFound(_0x58aaa8,null))[_0x04a2('0x27')](respondWithResult(_0x58aaa8,null))[_0x04a2('0x47')](handleError(_0x58aaa8,null));};exports['create']=function(_0x4965b,_0x4ba9e1){return db[_0x04a2('0x2f')][_0x04a2('0x4b')](_0x4965b[_0x04a2('0x4c')],{})[_0x04a2('0x27')](respondWithResult(_0x4ba9e1,0xc9))['catch'](handleError(_0x4ba9e1,null));};exports[_0x04a2('0x26')]=function(_0x5b6dd4,_0x50dd7a){if(_0x5b6dd4[_0x04a2('0x4c')]['id']){delete _0x5b6dd4[_0x04a2('0x4c')]['id'];}return db[_0x04a2('0x2f')][_0x04a2('0x4a')]({'where':{'id':_0x5b6dd4[_0x04a2('0x4d')]['id']}})[_0x04a2('0x27')](handleEntityNotFound(_0x50dd7a,null))[_0x04a2('0x27')](saveUpdates(_0x5b6dd4[_0x04a2('0x4c')],null))['then'](respondWithResult(_0x50dd7a,null))[_0x04a2('0x47')](handleError(_0x50dd7a,null));};exports[_0x04a2('0x28')]=function(_0x2fd706,_0x16a7c7){return db['MailTransferReport']['find']({'where':{'id':_0x2fd706[_0x04a2('0x4d')]['id']}})['then'](handleEntityNotFound(_0x16a7c7,null))['then'](removeEntity(_0x16a7c7,null))[_0x04a2('0x47')](handleError(_0x16a7c7,null));};exports[_0x04a2('0x4e')]=function(_0x542f0e,_0x40a3be){return db[_0x04a2('0x2f')]['describe']()['then'](respondWithResult(_0x40a3be,null))['catch'](handleError(_0x40a3be,null));}; \ No newline at end of file +var _0x6c39=['nolimit','order','sort','where','merge','filter','MailTransferReport','findAll','show','params','length','includeAll','include','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','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','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','rawAttributes','type','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty'];(function(_0x561032,_0x5d7ebe){var _0x14cac9=function(_0x503f2d){while(--_0x503f2d){_0x561032['push'](_0x561032['shift']());}};_0x14cac9(++_0x5d7ebe);}(_0x6c39,0x184));var _0x96c3=function(_0x100e36,_0x4da225){_0x100e36=_0x100e36-0x0;var _0x1df0c9=_0x6c39[_0x100e36];return _0x1df0c9;};'use strict';var emlformat=require(_0x96c3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x96c3('0x1'));var jsonpatch=require(_0x96c3('0x2'));var rp=require('request-promise');var moment=require(_0x96c3('0x3'));var BPromise=require(_0x96c3('0x4'));var Mustache=require('mustache');var util=require(_0x96c3('0x5'));var path=require(_0x96c3('0x6'));var sox=require('sox');var csv=require(_0x96c3('0x7'));var ejs=require(_0x96c3('0x8'));var fs=require('fs');var fs_extra=require(_0x96c3('0x9'));var _=require(_0x96c3('0xa'));var squel=require(_0x96c3('0xb'));var crypto=require('crypto');var jsforce=require(_0x96c3('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x96c3('0x7'));var querystring=require('querystring');var Papa=require(_0x96c3('0xd'));var Redis=require(_0x96c3('0xe'));var authService=require(_0x96c3('0xf'));var qs=require(_0x96c3('0x10'));var as=require(_0x96c3('0x11'));var hardwareService=require(_0x96c3('0x12'));var logger=require('../../config/logger')(_0x96c3('0x13'));var utils=require(_0x96c3('0x14'));var config=require(_0x96c3('0x15'));var licenseUtil=require(_0x96c3('0x16'));var db=require(_0x96c3('0x17'))['db'];function respondWithStatusCode(_0x142416,_0x3fe30c){_0x3fe30c=_0x3fe30c||0xcc;return function(_0x57a242){if(_0x57a242){return _0x142416[_0x96c3('0x18')](_0x3fe30c);}return _0x142416[_0x96c3('0x19')](_0x3fe30c)['end']();};}function respondWithResult(_0x414a22,_0x226158){_0x226158=_0x226158||0xc8;return function(_0x12461b){if(_0x12461b){return _0x414a22[_0x96c3('0x19')](_0x226158)[_0x96c3('0x1a')](_0x12461b);}};}function respondWithFilteredResult(_0x19774b,_0x419ee8){return function(_0x2ef2e6){if(_0x2ef2e6){var _0x92d85f=typeof _0x419ee8[_0x96c3('0x1b')]==='undefined'&&typeof _0x419ee8[_0x96c3('0x1c')]===_0x96c3('0x1d');var _0x5181f9=_0x2ef2e6[_0x96c3('0x1e')];var _0x428349=_0x92d85f?0x0:_0x419ee8['offset'];var _0xd9c0cb=_0x92d85f?_0x2ef2e6[_0x96c3('0x1e')]:_0x419ee8[_0x96c3('0x1b')]+_0x419ee8['limit'];var _0x3f9b47;if(_0xd9c0cb>=_0x5181f9){_0xd9c0cb=_0x5181f9;_0x3f9b47=0xc8;}else{_0x3f9b47=0xce;}_0x19774b[_0x96c3('0x19')](_0x3f9b47);return _0x19774b[_0x96c3('0x1f')](_0x96c3('0x20'),_0x428349+'-'+_0xd9c0cb+'/'+_0x5181f9)['json'](_0x2ef2e6);}return null;};}function patchUpdates(_0x43dcd4){return function(_0x49fe76){try{jsonpatch[_0x96c3('0x21')](_0x49fe76,_0x43dcd4,!![]);}catch(_0x2857a0){return BPromise[_0x96c3('0x22')](_0x2857a0);}return _0x49fe76[_0x96c3('0x23')]();};}function saveUpdates(_0x4e75cb,_0x57bbd1){return function(_0x513741){if(_0x513741){return _0x513741[_0x96c3('0x24')](_0x4e75cb)[_0x96c3('0x25')](function(_0x1a6513){return _0x1a6513;});}return null;};}function removeEntity(_0x5db224,_0x4e7a9f){return function(_0x1bbb5d){if(_0x1bbb5d){return _0x1bbb5d[_0x96c3('0x26')]()[_0x96c3('0x25')](function(){_0x5db224[_0x96c3('0x19')](0xcc)[_0x96c3('0x27')]();});}};}function handleEntityNotFound(_0x28f13f,_0x29a53b){return function(_0x133bdc){if(!_0x133bdc){_0x28f13f[_0x96c3('0x18')](0x194);}return _0x133bdc;};}function handleError(_0x169812,_0x160899){_0x160899=_0x160899||0x1f4;return function(_0x3635f0){logger[_0x96c3('0x28')](_0x3635f0[_0x96c3('0x29')]);if(_0x3635f0[_0x96c3('0x2a')]){delete _0x3635f0[_0x96c3('0x2a')];}_0x169812['status'](_0x160899)[_0x96c3('0x2b')](_0x3635f0);};}exports[_0x96c3('0x2c')]=function(_0x5e9ff8,_0x105cf5){var _0x27e295={},_0x34e877={},_0x460b85={'count':0x0,'rows':[]};var _0x3a1637=_['map'](db['MailTransferReport'][_0x96c3('0x2d')],function(_0x7016c4){return{'name':_0x7016c4['fieldName'],'type':_0x7016c4[_0x96c3('0x2e')]['key']};});_0x34e877[_0x96c3('0x2f')]=_[_0x96c3('0x30')](_0x3a1637,_0x96c3('0x2a'));_0x34e877[_0x96c3('0x31')]=_[_0x96c3('0x32')](_0x5e9ff8['query']);_0x34e877[_0x96c3('0x33')]=_[_0x96c3('0x34')](_0x34e877[_0x96c3('0x2f')],_0x34e877[_0x96c3('0x31')]);_0x27e295[_0x96c3('0x35')]=_[_0x96c3('0x34')](_0x34e877[_0x96c3('0x2f')],qs[_0x96c3('0x36')](_0x5e9ff8[_0x96c3('0x31')][_0x96c3('0x36')]));_0x27e295[_0x96c3('0x35')]=_0x27e295[_0x96c3('0x35')]['length']?_0x27e295[_0x96c3('0x35')]:_0x34e877[_0x96c3('0x2f')];if(!_0x5e9ff8[_0x96c3('0x31')][_0x96c3('0x37')](_0x96c3('0x38'))){_0x27e295[_0x96c3('0x1c')]=qs['limit'](_0x5e9ff8[_0x96c3('0x31')][_0x96c3('0x1c')]);_0x27e295[_0x96c3('0x1b')]=qs[_0x96c3('0x1b')](_0x5e9ff8['query'][_0x96c3('0x1b')]);}_0x27e295[_0x96c3('0x39')]=qs[_0x96c3('0x3a')](_0x5e9ff8[_0x96c3('0x31')][_0x96c3('0x3a')]);_0x27e295[_0x96c3('0x3b')]=qs[_0x96c3('0x33')](_['pick'](_0x5e9ff8[_0x96c3('0x31')],_0x34e877[_0x96c3('0x33')]),_0x3a1637);if(_0x5e9ff8[_0x96c3('0x31')]['filter']){_0x27e295[_0x96c3('0x3b')]=_[_0x96c3('0x3c')](_0x27e295[_0x96c3('0x3b')],{'$or':_[_0x96c3('0x30')](_0x3a1637,function(_0xf7f56d){if(_0xf7f56d[_0x96c3('0x2e')]!=='VIRTUAL'){var _0x2d9e30={};_0x2d9e30[_0xf7f56d[_0x96c3('0x2a')]]={'$like':'%'+_0x5e9ff8[_0x96c3('0x31')][_0x96c3('0x3d')]+'%'};return _0x2d9e30;}})});}_0x27e295=_['merge']({},_0x27e295,_0x5e9ff8['options']);var _0x35e5c0={'where':_0x27e295[_0x96c3('0x3b')]};return db['MailTransferReport'][_0x96c3('0x1e')](_0x35e5c0)['then'](function(_0x29b771){_0x460b85['count']=_0x29b771;if(_0x5e9ff8['query']['includeAll']){_0x27e295['include']=[{'all':!![]}];}return db[_0x96c3('0x3e')][_0x96c3('0x3f')](_0x27e295);})[_0x96c3('0x25')](function(_0x21e23f){_0x460b85['rows']=_0x21e23f;return _0x460b85;})['then'](respondWithFilteredResult(_0x105cf5,_0x27e295))['catch'](handleError(_0x105cf5,null));};exports[_0x96c3('0x40')]=function(_0x4a1dff,_0x45ae30){var _0x23e0e6={'raw':!![],'where':{'id':_0x4a1dff[_0x96c3('0x41')]['id']}},_0x372a9a={};_0x372a9a[_0x96c3('0x2f')]=_[_0x96c3('0x32')](db['MailTransferReport'][_0x96c3('0x2d')]);_0x372a9a[_0x96c3('0x31')]=_['keys'](_0x4a1dff['query']);_0x372a9a[_0x96c3('0x33')]=_[_0x96c3('0x34')](_0x372a9a[_0x96c3('0x2f')],_0x372a9a[_0x96c3('0x31')]);_0x23e0e6['attributes']=_['intersection'](_0x372a9a[_0x96c3('0x2f')],qs[_0x96c3('0x36')](_0x4a1dff['query'][_0x96c3('0x36')]));_0x23e0e6[_0x96c3('0x35')]=_0x23e0e6['attributes'][_0x96c3('0x42')]?_0x23e0e6['attributes']:_0x372a9a['model'];if(_0x4a1dff['query'][_0x96c3('0x43')]){_0x23e0e6[_0x96c3('0x44')]=[{'all':!![]}];}_0x23e0e6=_[_0x96c3('0x3c')]({},_0x23e0e6,_0x4a1dff['options']);return db['MailTransferReport'][_0x96c3('0x45')](_0x23e0e6)[_0x96c3('0x25')](handleEntityNotFound(_0x45ae30,null))[_0x96c3('0x25')](respondWithResult(_0x45ae30,null))[_0x96c3('0x46')](handleError(_0x45ae30,null));};exports[_0x96c3('0x47')]=function(_0x3b11ca,_0x4859d1){return db['MailTransferReport']['create'](_0x3b11ca['body'],{})[_0x96c3('0x25')](respondWithResult(_0x4859d1,0xc9))[_0x96c3('0x46')](handleError(_0x4859d1,null));};exports[_0x96c3('0x24')]=function(_0x3be772,_0x1830a2){if(_0x3be772[_0x96c3('0x48')]['id']){delete _0x3be772[_0x96c3('0x48')]['id'];}return db['MailTransferReport']['find']({'where':{'id':_0x3be772['params']['id']}})['then'](handleEntityNotFound(_0x1830a2,null))[_0x96c3('0x25')](saveUpdates(_0x3be772[_0x96c3('0x48')],null))[_0x96c3('0x25')](respondWithResult(_0x1830a2,null))[_0x96c3('0x46')](handleError(_0x1830a2,null));};exports[_0x96c3('0x26')]=function(_0x94b6,_0x31ccae){return db['MailTransferReport'][_0x96c3('0x45')]({'where':{'id':_0x94b6[_0x96c3('0x41')]['id']}})[_0x96c3('0x25')](handleEntityNotFound(_0x31ccae,null))[_0x96c3('0x25')](removeEntity(_0x31ccae,null))[_0x96c3('0x46')](handleError(_0x31ccae,null));};exports[_0x96c3('0x49')]=function(_0x3ba537,_0x3132b4){return db[_0x96c3('0x3e')][_0x96c3('0x49')]()[_0x96c3('0x25')](respondWithResult(_0x3132b4,null))[_0x96c3('0x46')](handleError(_0x3132b4,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index c6f0374..8e9477d 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 _0xa81a=['MailTransferReport','report_mail_transfer','uniqueid','lodash','../../config/logger','api','moment','request-promise','path','rimraf','./mailTransferReport.attributes','exports','define'];(function(_0x279841,_0x4e9e3b){var _0x4d3a9f=function(_0x261c2d){while(--_0x261c2d){_0x279841['push'](_0x279841['shift']());}};_0x4d3a9f(++_0x4e9e3b);}(_0xa81a,0x1f1));var _0xaa81=function(_0xd5c365,_0x4040b7){_0xd5c365=_0xd5c365-0x0;var _0x3e4875=_0xa81a[_0xd5c365];return _0x3e4875;};'use strict';var _=require(_0xaa81('0x0'));var util=require('util');var logger=require(_0xaa81('0x1'))(_0xaa81('0x2'));var moment=require(_0xaa81('0x3'));var BPromise=require('bluebird');var rp=require(_0xaa81('0x4'));var fs=require('fs');var path=require(_0xaa81('0x5'));var rimraf=require(_0xaa81('0x6'));var config=require('../../config/environment');var attributes=require(_0xaa81('0x7'));module[_0xaa81('0x8')]=function(_0x597248,_0x1df780){return _0x597248[_0xaa81('0x9')](_0xaa81('0xa'),attributes,{'tableName':_0xaa81('0xb'),'paranoid':![],'indexes':[{'name':_0xaa81('0xc'),'fields':[_0xaa81('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x330c=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util'];(function(_0x3c23fd,_0x2018c2){var _0x3636a1=function(_0x1a041e){while(--_0x1a041e){_0x3c23fd['push'](_0x3c23fd['shift']());}};_0x3636a1(++_0x2018c2);}(_0x330c,0x186));var _0xc330=function(_0xacb8e1,_0x51ceb9){_0xacb8e1=_0xacb8e1-0x0;var _0x2033c6=_0x330c[_0xacb8e1];return _0x2033c6;};'use strict';var _=require(_0xc330('0x0'));var util=require(_0xc330('0x1'));var logger=require(_0xc330('0x2'))(_0xc330('0x3'));var moment=require('moment');var BPromise=require(_0xc330('0x4'));var rp=require(_0xc330('0x5'));var fs=require('fs');var path=require(_0xc330('0x6'));var rimraf=require(_0xc330('0x7'));var config=require(_0xc330('0x8'));var attributes=require(_0xc330('0x9'));module['exports']=function(_0x4f49fb,_0x53d0ca){return _0x4f49fb[_0xc330('0xa')](_0xc330('0xb'),attributes,{'tableName':_0xc330('0xc'),'paranoid':![],'indexes':[{'name':_0xc330('0xd'),'fields':[_0xc330('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 4cd6738..41deffc 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 _0x57f1=['util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailTransferReport,\x20%s,\x20%s','message','result','lodash'];(function(_0xe57447,_0x44f6e0){var _0x5666e4=function(_0x119d34){while(--_0x119d34){_0xe57447['push'](_0xe57447['shift']());}};_0x5666e4(++_0x44f6e0);}(_0x57f1,0x141));var _0x157f=function(_0x3f6b3f,_0x2c6dc3){_0x3f6b3f=_0x3f6b3f-0x0;var _0x27db54=_0x57f1[_0x3f6b3f];return _0x27db54;};'use strict';var _=require(_0x157f('0x0'));var util=require(_0x157f('0x1'));var moment=require(_0x157f('0x2'));var BPromise=require(_0x157f('0x3'));var rs=require(_0x157f('0x4'));var fs=require('fs');var Redis=require(_0x157f('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x157f('0x6'))(_0x157f('0x7'));var config=require(_0x157f('0x8'));var jayson=require(_0x157f('0x9'));var client=jayson[_0x157f('0xa')][_0x157f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x683a50,_0x1e49eb,_0x2144dc){return new BPromise(function(_0x5a753e,_0x4259b1){return client['request'](_0x683a50,_0x2144dc)[_0x157f('0xc')](function(_0x56f5ab){logger[_0x157f('0xd')]('MailTransferReport,\x20%s,\x20%s',_0x1e49eb,'request\x20sent');logger[_0x157f('0xe')](_0x157f('0xf'),_0x1e49eb,_0x157f('0x10'),JSON[_0x157f('0x11')](_0x56f5ab));if(_0x56f5ab[_0x157f('0x12')]){if(_0x56f5ab[_0x157f('0x12')][_0x157f('0x13')]===0x1f4){logger[_0x157f('0x12')](_0x157f('0x14'),_0x1e49eb,_0x56f5ab[_0x157f('0x12')]['message']);return _0x4259b1(_0x56f5ab[_0x157f('0x12')][_0x157f('0x15')]);}logger[_0x157f('0x12')](_0x157f('0x14'),_0x1e49eb,_0x56f5ab[_0x157f('0x12')][_0x157f('0x15')]);return _0x5a753e(_0x56f5ab['error'][_0x157f('0x15')]);}else{logger[_0x157f('0xd')](_0x157f('0x14'),_0x1e49eb,_0x157f('0x10'));_0x5a753e(_0x56f5ab[_0x157f('0x16')][_0x157f('0x15')]);}})['catch'](function(_0x5201df){logger[_0x157f('0x12')]('MailTransferReport,\x20%s,\x20%s',_0x1e49eb,_0x5201df);_0x4259b1(_0x5201df);});});} \ No newline at end of file +var _0xc553=['../../config/environment','jayson/promise','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x408ee9,_0x462d58){var _0x361fc7=function(_0x1a4dd6){while(--_0x1a4dd6){_0x408ee9['push'](_0x408ee9['shift']());}};_0x361fc7(++_0x462d58);}(_0xc553,0x15f));var _0x3c55=function(_0x56b32d,_0x4c4b13){_0x56b32d=_0x56b32d-0x0;var _0x36a615=_0xc553[_0x56b32d];return _0x36a615;};'use strict';var _=require(_0x3c55('0x0'));var util=require('util');var moment=require(_0x3c55('0x1'));var BPromise=require(_0x3c55('0x2'));var rs=require(_0x3c55('0x3'));var fs=require('fs');var Redis=require(_0x3c55('0x4'));var db=require(_0x3c55('0x5'))['db'];var utils=require(_0x3c55('0x6'));var logger=require(_0x3c55('0x7'))(_0x3c55('0x8'));var config=require(_0x3c55('0x9'));var jayson=require(_0x3c55('0xa'));var client=jayson['client'][_0x3c55('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a5fb0,_0x2b1f77,_0x5c53ef){return new BPromise(function(_0x37da69,_0x3eb901){return client[_0x3c55('0xc')](_0x4a5fb0,_0x5c53ef)[_0x3c55('0xd')](function(_0xfa1a03){logger[_0x3c55('0xe')](_0x3c55('0xf'),_0x2b1f77,_0x3c55('0x10'));logger[_0x3c55('0x11')](_0x3c55('0x12'),_0x2b1f77,_0x3c55('0x10'),JSON['stringify'](_0xfa1a03));if(_0xfa1a03['error']){if(_0xfa1a03['error'][_0x3c55('0x13')]===0x1f4){logger[_0x3c55('0x14')]('MailTransferReport,\x20%s,\x20%s',_0x2b1f77,_0xfa1a03[_0x3c55('0x14')][_0x3c55('0x15')]);return _0x3eb901(_0xfa1a03[_0x3c55('0x14')][_0x3c55('0x15')]);}logger[_0x3c55('0x14')](_0x3c55('0xf'),_0x2b1f77,_0xfa1a03[_0x3c55('0x14')]['message']);return _0x37da69(_0xfa1a03[_0x3c55('0x14')][_0x3c55('0x15')]);}else{logger[_0x3c55('0xe')](_0x3c55('0xf'),_0x2b1f77,_0x3c55('0x10'));_0x37da69(_0xfa1a03[_0x3c55('0x16')]['message']);}})[_0x3c55('0x17')](function(_0x261348){logger['error']('MailTransferReport,\x20%s,\x20%s',_0x2b1f77,_0x261348);_0x3eb901(_0x261348);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 16275c2..c56da3d 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 _0x6b78=['create','put','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x29ed5a,_0x11abda){var _0x1ca80c=function(_0xaf6506){while(--_0xaf6506){_0x29ed5a['push'](_0x29ed5a['shift']());}};_0x1ca80c(++_0x11abda);}(_0x6b78,0x136));var _0x86b7=function(_0xae7928,_0x4f823d){_0xae7928=_0xae7928-0x0;var _0x30d1af=_0x6b78[_0xae7928];return _0x30d1af;};'use strict';var multer=require(_0x86b7('0x0'));var util=require('util');var path=require(_0x86b7('0x1'));var timeout=require(_0x86b7('0x2'));var express=require('express');var router=express[_0x86b7('0x3')]();var fs_extra=require(_0x86b7('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x86b7('0x5'));var config=require('../../config/environment');var controller=require('./memberReport.controller');router[_0x86b7('0x6')]('/',auth[_0x86b7('0x7')](),controller[_0x86b7('0x8')]);router['get'](_0x86b7('0x9'),auth['isAuthenticated'](),controller[_0x86b7('0xa')]);router['get'](_0x86b7('0xb'),auth[_0x86b7('0x7')](),controller[_0x86b7('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x86b7('0xd')]);router[_0x86b7('0xe')]('/:id',auth[_0x86b7('0x7')](),controller['update']);router['delete'](_0x86b7('0xb'),auth[_0x86b7('0x7')](),controller[_0x86b7('0xf')]);module[_0x86b7('0x10')]=router; \ No newline at end of file +var _0x4b18=['put','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x4b18,0x14e));var _0x84b1=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4b18[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x84b1('0x0'));var util=require('util');var path=require(_0x84b1('0x1'));var timeout=require(_0x84b1('0x2'));var express=require(_0x84b1('0x3'));var router=express['Router']();var fs_extra=require(_0x84b1('0x4'));var auth=require(_0x84b1('0x5'));var interaction=require(_0x84b1('0x6'));var config=require(_0x84b1('0x7'));var controller=require(_0x84b1('0x8'));router['get']('/',auth[_0x84b1('0x9')](),controller[_0x84b1('0xa')]);router[_0x84b1('0xb')](_0x84b1('0xc'),auth[_0x84b1('0x9')](),controller[_0x84b1('0xd')]);router[_0x84b1('0xb')](_0x84b1('0xe'),auth[_0x84b1('0x9')](),controller[_0x84b1('0xf')]);router[_0x84b1('0x10')]('/',auth[_0x84b1('0x9')](),controller[_0x84b1('0x11')]);router[_0x84b1('0x12')](_0x84b1('0xe'),auth[_0x84b1('0x9')](),controller[_0x84b1('0x13')]);router['delete'](_0x84b1('0xe'),auth[_0x84b1('0x9')](),controller[_0x84b1('0x14')]);module[_0x84b1('0x15')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 6f80c59..cfe8ec6 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 _0x7794=['talk:[destination]','talk:[dial\x20string]','talk:[queue]','moment','exports','STRING','DEFAULT\x20PAUSE','INTEGER','enterAt','diff','seconds','setDataValue','exitAt','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]'];(function(_0x5cef2b,_0x43cb68){var _0x1b144e=function(_0xa4cecf){while(--_0xa4cecf){_0x5cef2b['push'](_0x5cef2b['shift']());}};_0x1b144e(++_0x43cb68);}(_0x7794,0x7b));var _0x4779=function(_0x1a68f7,_0x35e028){_0x1a68f7=_0x1a68f7-0x0;var _0x51b498=_0x7794[_0x1a68f7];return _0x51b498;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x4779('0x0'));module[_0x4779('0x1')]={'channel':{'type':Sequelize[_0x4779('0x2')]},'membername':{'type':Sequelize[_0x4779('0x2')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x4779('0x2')],'defaultValue':_0x4779('0x3'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0x4779('0x4')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x53fd58){var _0x45cd71=moment(_0x53fd58);var _0x339512=moment(this['getDataValue'](_0x4779('0x5')));var _0x13bb66=_0x45cd71[_0x4779('0x6')](_0x339512,_0x4779('0x7'));this[_0x4779('0x8')](_0x4779('0x9'),_0x53fd58);this[_0x4779('0x8')]('duration',_0x13bb66||null);}},'data1':{'type':Sequelize[_0x4779('0x2')],'comment':_0x4779('0xa')},'data2':{'type':Sequelize[_0x4779('0x2')],'comment':_0x4779('0xb')},'data3':{'type':Sequelize[_0x4779('0x2')],'comment':_0x4779('0xc')},'data4':{'type':Sequelize[_0x4779('0x2')],'comment':_0x4779('0xd')},'data5':{'type':Sequelize[_0x4779('0x2')],'comment':_0x4779('0xe')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9181=['INTEGER','DATE','getDataValue','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING','LOGIN,\x20PAUSE,\x20TALKING'];(function(_0xa78ff7,_0x326665){var _0x5812eb=function(_0x526ec4){while(--_0x526ec4){_0xa78ff7['push'](_0xa78ff7['shift']());}};_0x5812eb(++_0x326665);}(_0x9181,0x182));var _0x1918=function(_0x196d60,_0x36dadc){_0x196d60=_0x196d60-0x0;var _0x38bd44=_0x9181[_0x196d60];return _0x38bd44;};'use strict';var Sequelize=require(_0x1918('0x0'));var moment=require(_0x1918('0x1'));module[_0x1918('0x2')]={'channel':{'type':Sequelize[_0x1918('0x3')]},'membername':{'type':Sequelize[_0x1918('0x3')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x1918('0x3')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0x1918('0x4')},'duration':{'type':Sequelize[_0x1918('0x5')]},'enterAt':{'type':Sequelize[_0x1918('0x6')]},'exitAt':{'type':Sequelize[_0x1918('0x6')],'set':function(_0x424951){var _0x4106d7=moment(_0x424951);var _0x4cf696=moment(this[_0x1918('0x7')]('enterAt'));var _0x434acb=_0x4106d7['diff'](_0x4cf696,_0x1918('0x8'));this[_0x1918('0x9')](_0x1918('0xa'),_0x424951);this[_0x1918('0x9')](_0x1918('0xb'),_0x434acb||null);}},'data1':{'type':Sequelize[_0x1918('0x3')],'comment':_0x1918('0xc')},'data2':{'type':Sequelize[_0x1918('0x3')],'comment':_0x1918('0xd')},'data3':{'type':Sequelize[_0x1918('0x3')],'comment':_0x1918('0xe')},'data4':{'type':Sequelize[_0x1918('0x3')],'comment':_0x1918('0xf')},'data5':{'type':Sequelize['STRING'],'comment':_0x1918('0x10')},'role':{'type':Sequelize[_0x1918('0x3')]},'internal':{'type':Sequelize[_0x1918('0x5')]},'uniqueid':{'type':Sequelize[_0x1918('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 8a3a138..306f93b 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 _0x9c44=['catch','params','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','MemberReport','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','then','includeAll','include','findAll','rows'];(function(_0x916a4d,_0x5a26cd){var _0x90ff04=function(_0x3767a6){while(--_0x3767a6){_0x916a4d['push'](_0x916a4d['shift']());}};_0x90ff04(++_0x5a26cd);}(_0x9c44,0x178));var _0x49c4=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9c44[_0x2641f9];return _0x585741;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}exports[_0x49c4('0x28')]=function(_0x5987ae,_0x889909){var _0x2b2793={},_0x46e04d={},_0x4f28a2={'count':0x0,'rows':[]};var _0x6329b3=_[_0x49c4('0x29')](db[_0x49c4('0x2a')][_0x49c4('0x2b')],function(_0x17b50f){return{'name':_0x17b50f[_0x49c4('0x2c')],'type':_0x17b50f[_0x49c4('0x2d')]['key']};});_0x46e04d['model']=_['map'](_0x6329b3,_0x49c4('0x26'));_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d[_0x49c4('0x30')]=_['intersection'](_0x46e04d[_0x49c4('0x31')],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x46e04d['model'],qs['fields'](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x2b2793[_0x49c4('0x32')]=_0x2b2793[_0x49c4('0x32')][_0x49c4('0x35')]?_0x2b2793['attributes']:_0x46e04d[_0x49c4('0x31')];if(!_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x36')]('nolimit')){_0x2b2793['limit']=qs[_0x49c4('0x1b')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x1b')]);_0x2b2793[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x19')]);}_0x2b2793[_0x49c4('0x37')]=qs[_0x49c4('0x38')](_0x5987ae['query'][_0x49c4('0x38')]);_0x2b2793['where']=qs[_0x49c4('0x30')](_[_0x49c4('0x39')](_0x5987ae[_0x49c4('0x2e')],_0x46e04d[_0x49c4('0x30')]),_0x6329b3);if(_0x5987ae['query'][_0x49c4('0x3a')]){_0x2b2793[_0x49c4('0x3b')]=_[_0x49c4('0x3c')](_0x2b2793['where'],{'$or':_[_0x49c4('0x29')](_0x6329b3,function(_0x21d8c7){if(_0x21d8c7[_0x49c4('0x2d')]!==_0x49c4('0x3d')){var _0x1ba7a0={};_0x1ba7a0[_0x21d8c7[_0x49c4('0x26')]]={'$like':'%'+_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x3a')]+'%'};return _0x1ba7a0;}})});}_0x2b2793=_[_0x49c4('0x3c')]({},_0x2b2793,_0x5987ae[_0x49c4('0x3e')]);var _0x1e506a={'where':_0x2b2793['where']};return db[_0x49c4('0x2a')][_0x49c4('0x1c')](_0x1e506a)[_0x49c4('0x3f')](function(_0x23aa32){_0x4f28a2[_0x49c4('0x1c')]=_0x23aa32;if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x2b2793[_0x49c4('0x41')]=[{'all':!![]}];}return db[_0x49c4('0x2a')][_0x49c4('0x42')](_0x2b2793);})[_0x49c4('0x3f')](function(_0xa3d59e){_0x4f28a2[_0x49c4('0x43')]=_0xa3d59e;return _0x4f28a2;})['then'](respondWithFilteredResult(_0x889909,_0x2b2793))[_0x49c4('0x44')](handleError(_0x889909,null));};exports['show']=function(_0x104efb,_0x4915bc){var _0x28d4fb={'raw':!![],'where':{'id':_0x104efb[_0x49c4('0x45')]['id']}},_0x1480da={};_0x1480da[_0x49c4('0x31')]=_['keys'](db['MemberReport'][_0x49c4('0x2b')]);_0x1480da[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x104efb[_0x49c4('0x2e')]);_0x1480da['filters']=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],_0x1480da[_0x49c4('0x2e')]);_0x28d4fb[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],qs[_0x49c4('0x34')](_0x104efb[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x28d4fb['attributes']=_0x28d4fb[_0x49c4('0x32')]['length']?_0x28d4fb[_0x49c4('0x32')]:_0x1480da[_0x49c4('0x31')];if(_0x104efb[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x28d4fb[_0x49c4('0x41')]=[{'all':!![]}];}_0x28d4fb=_['merge']({},_0x28d4fb,_0x104efb[_0x49c4('0x3e')]);return db[_0x49c4('0x2a')][_0x49c4('0x46')](_0x28d4fb)[_0x49c4('0x3f')](handleEntityNotFound(_0x4915bc,null))[_0x49c4('0x3f')](respondWithResult(_0x4915bc,null))[_0x49c4('0x44')](handleError(_0x4915bc,null));};exports[_0x49c4('0x47')]=function(_0x4d89e0,_0x3bac1b){return db['MemberReport'][_0x49c4('0x47')](_0x4d89e0[_0x49c4('0x48')],{})[_0x49c4('0x3f')](respondWithResult(_0x3bac1b,0xc9))[_0x49c4('0x44')](handleError(_0x3bac1b,null));};exports[_0x49c4('0x22')]=function(_0x30bea5,_0x2c6be1){if(_0x30bea5['body']['id']){delete _0x30bea5[_0x49c4('0x48')]['id'];}return db[_0x49c4('0x2a')]['find']({'where':{'id':_0x30bea5[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x2c6be1,null))[_0x49c4('0x3f')](saveUpdates(_0x30bea5[_0x49c4('0x48')],null))['then'](respondWithResult(_0x2c6be1,null))['catch'](handleError(_0x2c6be1,null));};exports[_0x49c4('0x23')]=function(_0x4e8221,_0x4597c3){return db[_0x49c4('0x2a')][_0x49c4('0x46')]({'where':{'id':_0x4e8221[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x4597c3,null))[_0x49c4('0x3f')](removeEntity(_0x4597c3,null))[_0x49c4('0x44')](handleError(_0x4597c3,null));};exports['describe']=function(_0x1f26c2,_0x1550ce){return db[_0x49c4('0x2a')][_0x49c4('0x49')]()[_0x49c4('0x3f')](respondWithResult(_0x1550ce,null))[_0x49c4('0x44')](handleError(_0x1550ce,null));}; \ No newline at end of file +var _0x9c44=['catch','params','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','MemberReport','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','then','includeAll','include','findAll','rows'];(function(_0x299431,_0x1a9282){var _0x2879d3=function(_0x530c2a){while(--_0x530c2a){_0x299431['push'](_0x299431['shift']());}};_0x2879d3(++_0x1a9282);}(_0x9c44,0x178));var _0x49c4=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x9c44[_0x2dea24];return _0x309d58;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}exports[_0x49c4('0x28')]=function(_0x5987ae,_0x889909){var _0x2b2793={},_0x46e04d={},_0x4f28a2={'count':0x0,'rows':[]};var _0x6329b3=_[_0x49c4('0x29')](db[_0x49c4('0x2a')][_0x49c4('0x2b')],function(_0x17b50f){return{'name':_0x17b50f[_0x49c4('0x2c')],'type':_0x17b50f[_0x49c4('0x2d')]['key']};});_0x46e04d['model']=_['map'](_0x6329b3,_0x49c4('0x26'));_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d[_0x49c4('0x30')]=_['intersection'](_0x46e04d[_0x49c4('0x31')],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x46e04d['model'],qs['fields'](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x2b2793[_0x49c4('0x32')]=_0x2b2793[_0x49c4('0x32')][_0x49c4('0x35')]?_0x2b2793['attributes']:_0x46e04d[_0x49c4('0x31')];if(!_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x36')]('nolimit')){_0x2b2793['limit']=qs[_0x49c4('0x1b')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x1b')]);_0x2b2793[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x19')]);}_0x2b2793[_0x49c4('0x37')]=qs[_0x49c4('0x38')](_0x5987ae['query'][_0x49c4('0x38')]);_0x2b2793['where']=qs[_0x49c4('0x30')](_[_0x49c4('0x39')](_0x5987ae[_0x49c4('0x2e')],_0x46e04d[_0x49c4('0x30')]),_0x6329b3);if(_0x5987ae['query'][_0x49c4('0x3a')]){_0x2b2793[_0x49c4('0x3b')]=_[_0x49c4('0x3c')](_0x2b2793['where'],{'$or':_[_0x49c4('0x29')](_0x6329b3,function(_0x21d8c7){if(_0x21d8c7[_0x49c4('0x2d')]!==_0x49c4('0x3d')){var _0x1ba7a0={};_0x1ba7a0[_0x21d8c7[_0x49c4('0x26')]]={'$like':'%'+_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x3a')]+'%'};return _0x1ba7a0;}})});}_0x2b2793=_[_0x49c4('0x3c')]({},_0x2b2793,_0x5987ae[_0x49c4('0x3e')]);var _0x1e506a={'where':_0x2b2793['where']};return db[_0x49c4('0x2a')][_0x49c4('0x1c')](_0x1e506a)[_0x49c4('0x3f')](function(_0x23aa32){_0x4f28a2[_0x49c4('0x1c')]=_0x23aa32;if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x2b2793[_0x49c4('0x41')]=[{'all':!![]}];}return db[_0x49c4('0x2a')][_0x49c4('0x42')](_0x2b2793);})[_0x49c4('0x3f')](function(_0xa3d59e){_0x4f28a2[_0x49c4('0x43')]=_0xa3d59e;return _0x4f28a2;})['then'](respondWithFilteredResult(_0x889909,_0x2b2793))[_0x49c4('0x44')](handleError(_0x889909,null));};exports['show']=function(_0x104efb,_0x4915bc){var _0x28d4fb={'raw':!![],'where':{'id':_0x104efb[_0x49c4('0x45')]['id']}},_0x1480da={};_0x1480da[_0x49c4('0x31')]=_['keys'](db['MemberReport'][_0x49c4('0x2b')]);_0x1480da[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x104efb[_0x49c4('0x2e')]);_0x1480da['filters']=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],_0x1480da[_0x49c4('0x2e')]);_0x28d4fb[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],qs[_0x49c4('0x34')](_0x104efb[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x28d4fb['attributes']=_0x28d4fb[_0x49c4('0x32')]['length']?_0x28d4fb[_0x49c4('0x32')]:_0x1480da[_0x49c4('0x31')];if(_0x104efb[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x28d4fb[_0x49c4('0x41')]=[{'all':!![]}];}_0x28d4fb=_['merge']({},_0x28d4fb,_0x104efb[_0x49c4('0x3e')]);return db[_0x49c4('0x2a')][_0x49c4('0x46')](_0x28d4fb)[_0x49c4('0x3f')](handleEntityNotFound(_0x4915bc,null))[_0x49c4('0x3f')](respondWithResult(_0x4915bc,null))[_0x49c4('0x44')](handleError(_0x4915bc,null));};exports[_0x49c4('0x47')]=function(_0x4d89e0,_0x3bac1b){return db['MemberReport'][_0x49c4('0x47')](_0x4d89e0[_0x49c4('0x48')],{})[_0x49c4('0x3f')](respondWithResult(_0x3bac1b,0xc9))[_0x49c4('0x44')](handleError(_0x3bac1b,null));};exports[_0x49c4('0x22')]=function(_0x30bea5,_0x2c6be1){if(_0x30bea5['body']['id']){delete _0x30bea5[_0x49c4('0x48')]['id'];}return db[_0x49c4('0x2a')]['find']({'where':{'id':_0x30bea5[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x2c6be1,null))[_0x49c4('0x3f')](saveUpdates(_0x30bea5[_0x49c4('0x48')],null))['then'](respondWithResult(_0x2c6be1,null))['catch'](handleError(_0x2c6be1,null));};exports[_0x49c4('0x23')]=function(_0x4e8221,_0x4597c3){return db[_0x49c4('0x2a')][_0x49c4('0x46')]({'where':{'id':_0x4e8221[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x4597c3,null))[_0x49c4('0x3f')](removeEntity(_0x4597c3,null))[_0x49c4('0x44')](handleError(_0x4597c3,null));};exports['describe']=function(_0x1f26c2,_0x1550ce){return db[_0x49c4('0x2a')][_0x49c4('0x49')]()[_0x49c4('0x3f')](respondWithResult(_0x1550ce,null))[_0x49c4('0x44')](handleError(_0x1550ce,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index de2dedf..016a089 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 _0xb296=['../../config/logger','api','moment','bluebird','request-promise','rimraf','./memberReport.attributes','exports','define','MemberReport','report_member','membername_interface','interface','lodash','util'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0xb296,0xa3));var _0x6b29=function(_0x432591,_0x4d06c1){_0x432591=_0x432591-0x0;var _0x421634=_0xb296[_0x432591];return _0x421634;};'use strict';var _=require(_0x6b29('0x0'));var util=require(_0x6b29('0x1'));var logger=require(_0x6b29('0x2'))(_0x6b29('0x3'));var moment=require(_0x6b29('0x4'));var BPromise=require(_0x6b29('0x5'));var rp=require(_0x6b29('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6b29('0x7'));var config=require('../../config/environment');var attributes=require(_0x6b29('0x8'));module[_0x6b29('0x9')]=function(_0x5e0aa1,_0x327329){return _0x5e0aa1[_0x6b29('0xa')](_0x6b29('0xb'),attributes,{'tableName':_0x6b29('0xc'),'paranoid':![],'indexes':[{'name':_0x6b29('0xd'),'fields':['membername',_0x6b29('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe927=['interface','util','api','moment','../../config/environment','./memberReport.attributes','MemberReport','report_member','membername_interface'];(function(_0x2b5513,_0x3fe5cd){var _0x578fd2=function(_0x7a9106){while(--_0x7a9106){_0x2b5513['push'](_0x2b5513['shift']());}};_0x578fd2(++_0x3fe5cd);}(_0xe927,0x1a8));var _0x7e92=function(_0x4862de,_0x3ea85f){_0x4862de=_0x4862de-0x0;var _0x59c5b0=_0xe927[_0x4862de];return _0x59c5b0;};'use strict';var _=require('lodash');var util=require(_0x7e92('0x0'));var logger=require('../../config/logger')(_0x7e92('0x1'));var moment=require(_0x7e92('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7e92('0x3'));var attributes=require(_0x7e92('0x4'));module['exports']=function(_0x5547e6,_0x234ef5){return _0x5547e6['define'](_0x7e92('0x5'),attributes,{'tableName':_0x7e92('0x6'),'paranoid':![],'indexes':[{'name':_0x7e92('0x7'),'fields':['membername',_0x7e92('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 70ae2b3..6000944 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 _0x12e9=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','error','code','message','result','MemberReport','options','raw','where','attributes','include','model','map','then','info','GetMemberReport','stringify','create','body','CreateMemberReport','UpdateMemberReport','update','moment','randomstring','ioredis'];(function(_0x220079,_0x237f40){var _0x2c2610=function(_0x38b9cd){while(--_0x38b9cd){_0x220079['push'](_0x220079['shift']());}};_0x2c2610(++_0x237f40);}(_0x12e9,0x66));var _0x912e=function(_0x41899d,_0x2082c1){_0x41899d=_0x41899d-0x0;var _0x49bb4c=_0x12e9[_0x41899d];return _0x49bb4c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x912e('0x0'));var BPromise=require('bluebird');var rs=require(_0x912e('0x1'));var fs=require('fs');var Redis=require(_0x912e('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x912e('0x3'));var logger=require(_0x912e('0x4'))('rpc');var config=require(_0x912e('0x5'));var jayson=require(_0x912e('0x6'));var client=jayson[_0x912e('0x7')][_0x912e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4f4dbb,_0x2e950a,_0x2ccba9){return new BPromise(function(_0x2a8fc3,_0x7ac782){return client[_0x912e('0x9')](_0x4f4dbb,_0x2ccba9)['then'](function(_0x4beb4d){logger['info'](_0x912e('0xa'),_0x2e950a,_0x912e('0xb'));logger[_0x912e('0xc')](_0x912e('0xd'),_0x2e950a,_0x912e('0xb'),JSON['stringify'](_0x4beb4d));if(_0x4beb4d[_0x912e('0xe')]){if(_0x4beb4d[_0x912e('0xe')][_0x912e('0xf')]===0x1f4){logger[_0x912e('0xe')](_0x912e('0xa'),_0x2e950a,_0x4beb4d[_0x912e('0xe')][_0x912e('0x10')]);return _0x7ac782(_0x4beb4d[_0x912e('0xe')][_0x912e('0x10')]);}logger[_0x912e('0xe')](_0x912e('0xa'),_0x2e950a,_0x4beb4d[_0x912e('0xe')]['message']);return _0x2a8fc3(_0x4beb4d[_0x912e('0xe')]['message']);}else{logger['info'](_0x912e('0xa'),_0x2e950a,_0x912e('0xb'));_0x2a8fc3(_0x4beb4d[_0x912e('0x11')]['message']);}})['catch'](function(_0x174227){logger[_0x912e('0xe')](_0x912e('0xa'),_0x2e950a,_0x174227);_0x7ac782(_0x174227);});});}exports['GetMemberReport']=function(_0x36fb67){var _0x100790=this;return new Promise(function(_0x3286bb,_0x1d3345){return db[_0x912e('0x12')]['findAll']({'raw':_0x36fb67[_0x912e('0x13')]?_0x36fb67[_0x912e('0x13')][_0x912e('0x14')]===undefined?!![]:![]:!![],'where':_0x36fb67[_0x912e('0x13')]?_0x36fb67[_0x912e('0x13')][_0x912e('0x15')]||null:null,'attributes':_0x36fb67[_0x912e('0x13')]?_0x36fb67[_0x912e('0x13')][_0x912e('0x16')]||null:null,'limit':_0x36fb67[_0x912e('0x13')]?_0x36fb67[_0x912e('0x13')]['limit']||null:null,'include':_0x36fb67[_0x912e('0x13')]?_0x36fb67['options'][_0x912e('0x17')]?_['map'](_0x36fb67[_0x912e('0x13')][_0x912e('0x17')],function(_0x59feaa){return{'model':db[_0x59feaa[_0x912e('0x18')]],'as':_0x59feaa['as'],'attributes':_0x59feaa[_0x912e('0x16')],'include':_0x59feaa[_0x912e('0x17')]?_[_0x912e('0x19')](_0x59feaa[_0x912e('0x17')],function(_0x5ba003){return{'model':db[_0x5ba003[_0x912e('0x18')]],'as':_0x5ba003['as'],'attributes':_0x5ba003[_0x912e('0x16')],'include':_0x5ba003[_0x912e('0x17')]?_['map'](_0x5ba003[_0x912e('0x17')],function(_0x52c388){return{'model':db[_0x52c388[_0x912e('0x18')]],'as':_0x52c388['as'],'attributes':_0x52c388[_0x912e('0x16')]};}):[]};}):[]};}):[]:[]})[_0x912e('0x1a')](function(_0x3c6a2a){logger[_0x912e('0x1b')]('GetMemberReport',_0x36fb67);logger[_0x912e('0xc')](_0x912e('0x1c'),_0x36fb67,JSON[_0x912e('0x1d')](_0x3c6a2a));_0x3286bb(_0x3c6a2a);})['catch'](function(_0x357668){logger['error']('GetMemberReport',_0x357668['message'],_0x36fb67);_0x1d3345(_0x100790[_0x912e('0xe')](0x1f4,_0x357668['message']));});});};exports['CreateMemberReport']=function(_0x58d575){var _0x3f61a2=this;return new Promise(function(_0x106e86,_0x3c4cac){return db[_0x912e('0x12')][_0x912e('0x1e')](_0x58d575[_0x912e('0x1f')],{'raw':_0x58d575[_0x912e('0x13')]?_0x58d575[_0x912e('0x13')][_0x912e('0x14')]===undefined?!![]:![]:!![]})[_0x912e('0x1a')](function(_0x2faa5d){logger[_0x912e('0x1b')](_0x912e('0x20'),_0x58d575);logger['debug']('CreateMemberReport',_0x58d575,JSON[_0x912e('0x1d')](_0x2faa5d));_0x106e86(_0x2faa5d);})['catch'](function(_0xe5f115){logger[_0x912e('0xe')](_0x912e('0x20'),_0xe5f115[_0x912e('0x10')],_0x58d575);_0x3c4cac(_0x3f61a2[_0x912e('0xe')](0x1f4,_0xe5f115[_0x912e('0x10')]));});});};exports[_0x912e('0x21')]=function(_0x2405e1){var _0x7314f1=this;return new Promise(function(_0x1aa316,_0x5dd9e9){return db[_0x912e('0x12')][_0x912e('0x22')](_0x2405e1[_0x912e('0x1f')],{'raw':_0x2405e1[_0x912e('0x13')]?_0x2405e1[_0x912e('0x13')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2405e1[_0x912e('0x13')]?_0x2405e1['options'][_0x912e('0x15')]||null:null,'attributes':_0x2405e1[_0x912e('0x13')]?_0x2405e1[_0x912e('0x13')]['attributes']||null:null,'limit':_0x2405e1[_0x912e('0x13')]?_0x2405e1[_0x912e('0x13')]['limit']||null:null})[_0x912e('0x1a')](function(_0x3e3418){logger['info'](_0x912e('0x21'),_0x2405e1);logger[_0x912e('0xc')](_0x912e('0x21'),_0x2405e1,JSON[_0x912e('0x1d')](_0x3e3418));_0x1aa316(_0x3e3418);})['catch'](function(_0x243ee9){logger['error']('UpdateMemberReport',_0x243ee9[_0x912e('0x10')],_0x2405e1);_0x5dd9e9(_0x7314f1[_0x912e('0xe')](0x1f4,_0x243ee9[_0x912e('0x10')]));});});}; \ No newline at end of file +var _0x363e=['result','catch','GetMemberReport','findAll','options','raw','attributes','limit','include','map','model','CreateMemberReport','MemberReport','create','body','UpdateMemberReport','where','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','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'];(function(_0x30238a,_0x3ddfc6){var _0x1ae3d2=function(_0x1daeb9){while(--_0x1daeb9){_0x30238a['push'](_0x30238a['shift']());}};_0x1ae3d2(++_0x3ddfc6);}(_0x363e,0x179));var _0xe363=function(_0x3d2f1b,_0x48e775){_0x3d2f1b=_0x3d2f1b-0x0;var _0x13703d=_0x363e[_0x3d2f1b];return _0x13703d;};'use strict';var _=require(_0xe363('0x0'));var util=require(_0xe363('0x1'));var moment=require('moment');var BPromise=require(_0xe363('0x2'));var rs=require(_0xe363('0x3'));var fs=require('fs');var Redis=require(_0xe363('0x4'));var db=require(_0xe363('0x5'))['db'];var utils=require(_0xe363('0x6'));var logger=require(_0xe363('0x7'))(_0xe363('0x8'));var config=require(_0xe363('0x9'));var jayson=require(_0xe363('0xa'));var client=jayson[_0xe363('0xb')][_0xe363('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4fe10b,_0x1fc808,_0x30bffc){return new BPromise(function(_0xc5df66,_0x29d330){return client['request'](_0x4fe10b,_0x30bffc)[_0xe363('0xd')](function(_0x308de7){logger[_0xe363('0xe')](_0xe363('0xf'),_0x1fc808,_0xe363('0x10'));logger[_0xe363('0x11')](_0xe363('0x12'),_0x1fc808,'request\x20sent',JSON[_0xe363('0x13')](_0x308de7));if(_0x308de7[_0xe363('0x14')]){if(_0x308de7['error'][_0xe363('0x15')]===0x1f4){logger['error']('MemberReport,\x20%s,\x20%s',_0x1fc808,_0x308de7[_0xe363('0x14')][_0xe363('0x16')]);return _0x29d330(_0x308de7[_0xe363('0x14')][_0xe363('0x16')]);}logger[_0xe363('0x14')]('MemberReport,\x20%s,\x20%s',_0x1fc808,_0x308de7[_0xe363('0x14')][_0xe363('0x16')]);return _0xc5df66(_0x308de7['error'][_0xe363('0x16')]);}else{logger[_0xe363('0xe')]('MemberReport,\x20%s,\x20%s',_0x1fc808,_0xe363('0x10'));_0xc5df66(_0x308de7[_0xe363('0x17')]['message']);}})[_0xe363('0x18')](function(_0xc94d0a){logger['error'](_0xe363('0xf'),_0x1fc808,_0xc94d0a);_0x29d330(_0xc94d0a);});});}exports[_0xe363('0x19')]=function(_0x2f2c20){var _0x4dcba0=this;return new Promise(function(_0x287104,_0x470103){return db['MemberReport'][_0xe363('0x1a')]({'raw':_0x2f2c20[_0xe363('0x1b')]?_0x2f2c20[_0xe363('0x1b')][_0xe363('0x1c')]===undefined?!![]:![]:!![],'where':_0x2f2c20[_0xe363('0x1b')]?_0x2f2c20[_0xe363('0x1b')]['where']||null:null,'attributes':_0x2f2c20[_0xe363('0x1b')]?_0x2f2c20[_0xe363('0x1b')][_0xe363('0x1d')]||null:null,'limit':_0x2f2c20[_0xe363('0x1b')]?_0x2f2c20[_0xe363('0x1b')][_0xe363('0x1e')]||null:null,'include':_0x2f2c20[_0xe363('0x1b')]?_0x2f2c20[_0xe363('0x1b')][_0xe363('0x1f')]?_[_0xe363('0x20')](_0x2f2c20[_0xe363('0x1b')][_0xe363('0x1f')],function(_0x11556d){return{'model':db[_0x11556d[_0xe363('0x21')]],'as':_0x11556d['as'],'attributes':_0x11556d[_0xe363('0x1d')],'include':_0x11556d[_0xe363('0x1f')]?_[_0xe363('0x20')](_0x11556d[_0xe363('0x1f')],function(_0x19c7b4){return{'model':db[_0x19c7b4[_0xe363('0x21')]],'as':_0x19c7b4['as'],'attributes':_0x19c7b4[_0xe363('0x1d')],'include':_0x19c7b4[_0xe363('0x1f')]?_['map'](_0x19c7b4[_0xe363('0x1f')],function(_0x12358b){return{'model':db[_0x12358b[_0xe363('0x21')]],'as':_0x12358b['as'],'attributes':_0x12358b[_0xe363('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe363('0xd')](function(_0x52cafe){logger[_0xe363('0xe')](_0xe363('0x19'),_0x2f2c20);logger['debug'](_0xe363('0x19'),_0x2f2c20,JSON['stringify'](_0x52cafe));_0x287104(_0x52cafe);})[_0xe363('0x18')](function(_0x45d664){logger['error'](_0xe363('0x19'),_0x45d664[_0xe363('0x16')],_0x2f2c20);_0x470103(_0x4dcba0[_0xe363('0x14')](0x1f4,_0x45d664['message']));});});};exports[_0xe363('0x22')]=function(_0x32c9ab){var _0x102030=this;return new Promise(function(_0x451b23,_0x4c6946){return db[_0xe363('0x23')][_0xe363('0x24')](_0x32c9ab[_0xe363('0x25')],{'raw':_0x32c9ab[_0xe363('0x1b')]?_0x32c9ab[_0xe363('0x1b')][_0xe363('0x1c')]===undefined?!![]:![]:!![]})[_0xe363('0xd')](function(_0x251b98){logger[_0xe363('0xe')](_0xe363('0x22'),_0x32c9ab);logger['debug']('CreateMemberReport',_0x32c9ab,JSON[_0xe363('0x13')](_0x251b98));_0x451b23(_0x251b98);})[_0xe363('0x18')](function(_0x5adb53){logger[_0xe363('0x14')](_0xe363('0x22'),_0x5adb53['message'],_0x32c9ab);_0x4c6946(_0x102030[_0xe363('0x14')](0x1f4,_0x5adb53[_0xe363('0x16')]));});});};exports[_0xe363('0x26')]=function(_0x1ed87e){var _0x5903e2=this;return new Promise(function(_0x5362af,_0x256de9){return db['MemberReport']['update'](_0x1ed87e[_0xe363('0x25')],{'raw':_0x1ed87e[_0xe363('0x1b')]?_0x1ed87e[_0xe363('0x1b')][_0xe363('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ed87e[_0xe363('0x1b')]?_0x1ed87e[_0xe363('0x1b')][_0xe363('0x27')]||null:null,'attributes':_0x1ed87e[_0xe363('0x1b')]?_0x1ed87e[_0xe363('0x1b')][_0xe363('0x1d')]||null:null,'limit':_0x1ed87e[_0xe363('0x1b')]?_0x1ed87e[_0xe363('0x1b')]['limit']||null:null})['then'](function(_0x14238f){logger[_0xe363('0xe')](_0xe363('0x26'),_0x1ed87e);logger['debug']('UpdateMemberReport',_0x1ed87e,JSON[_0xe363('0x13')](_0x14238f));_0x5362af(_0x14238f);})[_0xe363('0x18')](function(_0x114f41){logger[_0xe363('0x14')]('UpdateMemberReport',_0x114f41[_0xe363('0x16')],_0x1ed87e);_0x256de9(_0x5903e2['error'](0x1f4,_0x114f41[_0xe363('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 31d3604..43ad6e0 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 _0xad60=['exports','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./migration.controller','get','index'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0xad60,0x19f));var _0x0ad6=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xad60[_0xfae23b];return _0x200640;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0ad6('0x0'));var timeout=require(_0x0ad6('0x1'));var express=require('express');var router=express[_0x0ad6('0x2')]();var fs_extra=require(_0x0ad6('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x0ad6('0x4'));var config=require('../../config/environment');var controller=require(_0x0ad6('0x5'));router[_0x0ad6('0x6')]('/',controller[_0x0ad6('0x7')]);module[_0x0ad6('0x8')]=router; \ No newline at end of file +var _0x8cdb=['get','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xc187bc,_0x4472be){var _0xa419ae=function(_0x372704){while(--_0x372704){_0xc187bc['push'](_0xc187bc['shift']());}};_0xa419ae(++_0x4472be);}(_0x8cdb,0x138));var _0xb8cd=function(_0x2cc521,_0x27436b){_0x2cc521=_0x2cc521-0x0;var _0x506e85=_0x8cdb[_0x2cc521];return _0x506e85;};'use strict';var multer=require(_0xb8cd('0x0'));var util=require('util');var path=require(_0xb8cd('0x1'));var timeout=require(_0xb8cd('0x2'));var express=require(_0xb8cd('0x3'));var router=express['Router']();var fs_extra=require(_0xb8cd('0x4'));var auth=require(_0xb8cd('0x5'));var interaction=require(_0xb8cd('0x6'));var config=require(_0xb8cd('0x7'));var controller=require('./migration.controller');router[_0xb8cd('0x8')]('/',controller['index']);module[_0xb8cd('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 a11cdbd..b77439c 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 _0x3415=['STRING','version'];(function(_0x2a9ae5,_0x5cc8a6){var _0x49257f=function(_0x1cd1cd){while(--_0x1cd1cd){_0x2a9ae5['push'](_0x2a9ae5['shift']());}};_0x49257f(++_0x5cc8a6);}(_0x3415,0x158));var _0x5341=function(_0x5a7226,_0x5e524b){_0x5a7226=_0x5a7226-0x0;var _0x1d74f3=_0x3415[_0x5a7226];return _0x1d74f3;};'use strict';var Sequelize=require('sequelize');module['exports']={'version':{'type':Sequelize[_0x5341('0x0')],'unique':_0x5341('0x1')}}; \ No newline at end of file +var _0xb5d3=['sequelize','exports','STRING','version'];(function(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0xb5d3,0xc4));var _0x3b5d=function(_0x3bd52b,_0xbbc735){_0x3bd52b=_0x3bd52b-0x0;var _0x1e5b89=_0xb5d3[_0x3bd52b];return _0x1e5b89;};'use strict';var Sequelize=require(_0x3b5d('0x0'));module[_0x3b5d('0x1')]={'version':{'type':Sequelize[_0x3b5d('0x2')],'unique':_0x3b5d('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index d3c2735..7a2b175 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 _0x4a05=['type','model','name','query','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','count','include','rows','catch','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save','update','then','destroy','map','Migration','rawAttributes'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0x4a05,0x112));var _0x54a0=function(_0x3bc158,_0x436e3a){_0x3bc158=_0x3bc158-0x0;var _0x977671=_0x4a05[_0x3bc158];return _0x977671;};'use strict';var emlformat=require(_0x54a0('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x54a0('0x1'));var rp=require(_0x54a0('0x2'));var moment=require(_0x54a0('0x3'));var BPromise=require(_0x54a0('0x4'));var Mustache=require(_0x54a0('0x5'));var util=require('util');var path=require(_0x54a0('0x6'));var sox=require(_0x54a0('0x7'));var csv=require(_0x54a0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x54a0('0x9'));var _=require('lodash');var squel=require(_0x54a0('0xa'));var crypto=require(_0x54a0('0xb'));var jsforce=require(_0x54a0('0xc'));var deskjs=require(_0x54a0('0xd'));var toCsv=require('to-csv');var querystring=require(_0x54a0('0xe'));var Papa=require(_0x54a0('0xf'));var Redis=require(_0x54a0('0x10'));var authService=require(_0x54a0('0x11'));var qs=require(_0x54a0('0x12'));var as=require(_0x54a0('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x54a0('0x14'))('api');var utils=require(_0x54a0('0x15'));var config=require(_0x54a0('0x16'));var licenseUtil=require(_0x54a0('0x17'));var db=require(_0x54a0('0x18'))['db'];function respondWithStatusCode(_0x4af15b,_0x487cea){_0x487cea=_0x487cea||0xcc;return function(_0x5e3f88){if(_0x5e3f88){return _0x4af15b[_0x54a0('0x19')](_0x487cea);}return _0x4af15b[_0x54a0('0x1a')](_0x487cea)[_0x54a0('0x1b')]();};}function respondWithResult(_0x2aeb5a,_0x140bda){_0x140bda=_0x140bda||0xc8;return function(_0x3a9cc8){if(_0x3a9cc8){return _0x2aeb5a[_0x54a0('0x1a')](_0x140bda)[_0x54a0('0x1c')](_0x3a9cc8);}};}function respondWithFilteredResult(_0x549166,_0x17dff0){return function(_0x1e89a2){if(_0x1e89a2){var _0x441f96=typeof _0x17dff0[_0x54a0('0x1d')]==='undefined'&&typeof _0x17dff0[_0x54a0('0x1e')]==='undefined';var _0x4a1200=_0x1e89a2['count'];var _0x405b2e=_0x441f96?0x0:_0x17dff0[_0x54a0('0x1d')];var _0x2834f7=_0x441f96?_0x1e89a2['count']:_0x17dff0[_0x54a0('0x1d')]+_0x17dff0['limit'];var _0x1cc950;if(_0x2834f7>=_0x4a1200){_0x2834f7=_0x4a1200;_0x1cc950=0xc8;}else{_0x1cc950=0xce;}_0x549166[_0x54a0('0x1a')](_0x1cc950);return _0x549166['set'](_0x54a0('0x1f'),_0x405b2e+'-'+_0x2834f7+'/'+_0x4a1200)['json'](_0x1e89a2);}return null;};}function patchUpdates(_0x28ed20){return function(_0x3d6731){try{jsonpatch[_0x54a0('0x20')](_0x3d6731,_0x28ed20,!![]);}catch(_0x29c02b){return BPromise[_0x54a0('0x21')](_0x29c02b);}return _0x3d6731[_0x54a0('0x22')]();};}function saveUpdates(_0x353ff0,_0x16a486){return function(_0x2c2eb2){if(_0x2c2eb2){return _0x2c2eb2[_0x54a0('0x23')](_0x353ff0)[_0x54a0('0x24')](function(_0x44c81){return _0x44c81;});}return null;};}function removeEntity(_0x212036,_0x163b7c){return function(_0x3eb514){if(_0x3eb514){return _0x3eb514[_0x54a0('0x25')]()[_0x54a0('0x24')](function(){_0x212036[_0x54a0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50db81,_0x113975){return function(_0x1ba25f){if(!_0x1ba25f){_0x50db81[_0x54a0('0x19')](0x194);}return _0x1ba25f;};}function handleError(_0x4f0ad3,_0x32c769){_0x32c769=_0x32c769||0x1f4;return function(_0x2c1737){logger['error'](_0x2c1737['stack']);if(_0x2c1737['name']){delete _0x2c1737['name'];}_0x4f0ad3[_0x54a0('0x1a')](_0x32c769)['send'](_0x2c1737);};}exports['index']=function(_0x2709c4,_0x3a98a7){var _0x422281={},_0x640020={},_0x205fa3={'count':0x0,'rows':[]};var _0xdc6ef3=_[_0x54a0('0x26')](db[_0x54a0('0x27')][_0x54a0('0x28')],function(_0x5b67f0){return{'name':_0x5b67f0['fieldName'],'type':_0x5b67f0[_0x54a0('0x29')]['key']};});_0x640020[_0x54a0('0x2a')]=_[_0x54a0('0x26')](_0xdc6ef3,_0x54a0('0x2b'));_0x640020[_0x54a0('0x2c')]=_['keys'](_0x2709c4[_0x54a0('0x2c')]);_0x640020['filters']=_['intersection'](_0x640020[_0x54a0('0x2a')],_0x640020[_0x54a0('0x2c')]);_0x422281[_0x54a0('0x2d')]=_[_0x54a0('0x2e')](_0x640020['model'],qs['fields'](_0x2709c4[_0x54a0('0x2c')][_0x54a0('0x2f')]));_0x422281[_0x54a0('0x2d')]=_0x422281[_0x54a0('0x2d')][_0x54a0('0x30')]?_0x422281['attributes']:_0x640020['model'];if(!_0x2709c4['query']['hasOwnProperty'](_0x54a0('0x31'))){_0x422281['limit']=qs[_0x54a0('0x1e')](_0x2709c4['query'][_0x54a0('0x1e')]);_0x422281['offset']=qs[_0x54a0('0x1d')](_0x2709c4[_0x54a0('0x2c')][_0x54a0('0x1d')]);}_0x422281[_0x54a0('0x32')]=qs[_0x54a0('0x33')](_0x2709c4[_0x54a0('0x2c')][_0x54a0('0x33')]);_0x422281[_0x54a0('0x34')]=qs['filters'](_[_0x54a0('0x35')](_0x2709c4['query'],_0x640020[_0x54a0('0x36')]),_0xdc6ef3);if(_0x2709c4[_0x54a0('0x2c')][_0x54a0('0x37')]){_0x422281[_0x54a0('0x34')]=_[_0x54a0('0x38')](_0x422281[_0x54a0('0x34')],{'$or':_[_0x54a0('0x26')](_0xdc6ef3,function(_0x4c2be3){if(_0x4c2be3['type']!==_0x54a0('0x39')){var _0x166e71={};_0x166e71[_0x4c2be3['name']]={'$like':'%'+_0x2709c4[_0x54a0('0x2c')][_0x54a0('0x37')]+'%'};return _0x166e71;}})});}_0x422281=_[_0x54a0('0x38')]({},_0x422281,_0x2709c4[_0x54a0('0x3a')]);var _0x1c08fe={'where':_0x422281['where']};return db[_0x54a0('0x27')][_0x54a0('0x3b')](_0x1c08fe)[_0x54a0('0x24')](function(_0x31aa2b){_0x205fa3[_0x54a0('0x3b')]=_0x31aa2b;if(_0x2709c4[_0x54a0('0x2c')]['includeAll']){_0x422281[_0x54a0('0x3c')]=[{'all':!![]}];}return db[_0x54a0('0x27')]['findAll'](_0x422281);})['then'](function(_0x15712d){_0x205fa3[_0x54a0('0x3d')]=_0x15712d;return _0x205fa3;})['then'](respondWithFilteredResult(_0x3a98a7,_0x422281))[_0x54a0('0x3e')](handleError(_0x3a98a7,null));}; \ No newline at end of file +var _0xe35c=['catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','Migration','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','map','filter','options','include','findAll','rows'];(function(_0x566168,_0x4c39af){var _0x4e1f7a=function(_0x5ec3ee){while(--_0x5ec3ee){_0x566168['push'](_0x566168['shift']());}};_0x4e1f7a(++_0x4c39af);}(_0xe35c,0x146));var _0xce35=function(_0x304292,_0xcb4fb6){_0x304292=_0x304292-0x0;var _0x1b5918=_0xe35c[_0x304292];return _0x1b5918;};'use strict';var emlformat=require(_0xce35('0x0'));var rimraf=require(_0xce35('0x1'));var zipdir=require(_0xce35('0x2'));var jsonpatch=require(_0xce35('0x3'));var rp=require(_0xce35('0x4'));var moment=require(_0xce35('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xce35('0x6'));var path=require('path');var sox=require(_0xce35('0x7'));var csv=require(_0xce35('0x8'));var ejs=require(_0xce35('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xce35('0xa'));var squel=require(_0xce35('0xb'));var crypto=require(_0xce35('0xc'));var jsforce=require(_0xce35('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xce35('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xce35('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xce35('0xf'));var hardwareService=require(_0xce35('0x10'));var logger=require(_0xce35('0x11'))(_0xce35('0x12'));var utils=require(_0xce35('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xce35('0x14'))['db'];function respondWithStatusCode(_0x20553a,_0x45ccf8){_0x45ccf8=_0x45ccf8||0xcc;return function(_0x251ca5){if(_0x251ca5){return _0x20553a[_0xce35('0x15')](_0x45ccf8);}return _0x20553a['status'](_0x45ccf8)['end']();};}function respondWithResult(_0xc8ec3f,_0x15f921){_0x15f921=_0x15f921||0xc8;return function(_0x55e36d){if(_0x55e36d){return _0xc8ec3f[_0xce35('0x16')](_0x15f921)[_0xce35('0x17')](_0x55e36d);}};}function respondWithFilteredResult(_0x30fe18,_0x231143){return function(_0x3540bc){if(_0x3540bc){var _0x398fc6=typeof _0x231143[_0xce35('0x18')]===_0xce35('0x19')&&typeof _0x231143[_0xce35('0x1a')]===_0xce35('0x19');var _0x36812b=_0x3540bc['count'];var _0x8d7f28=_0x398fc6?0x0:_0x231143[_0xce35('0x18')];var _0x3efb22=_0x398fc6?_0x3540bc[_0xce35('0x1b')]:_0x231143[_0xce35('0x18')]+_0x231143['limit'];var _0x40321d;if(_0x3efb22>=_0x36812b){_0x3efb22=_0x36812b;_0x40321d=0xc8;}else{_0x40321d=0xce;}_0x30fe18[_0xce35('0x16')](_0x40321d);return _0x30fe18[_0xce35('0x1c')](_0xce35('0x1d'),_0x8d7f28+'-'+_0x3efb22+'/'+_0x36812b)[_0xce35('0x17')](_0x3540bc);}return null;};}function patchUpdates(_0x8a0771){return function(_0x18ff68){try{jsonpatch[_0xce35('0x1e')](_0x18ff68,_0x8a0771,!![]);}catch(_0x556a73){return BPromise[_0xce35('0x1f')](_0x556a73);}return _0x18ff68[_0xce35('0x20')]();};}function saveUpdates(_0x32a76d,_0x43ce68){return function(_0x2f6d42){if(_0x2f6d42){return _0x2f6d42[_0xce35('0x21')](_0x32a76d)[_0xce35('0x22')](function(_0x16b19a){return _0x16b19a;});}return null;};}function removeEntity(_0x320800,_0x323497){return function(_0x5e88b2){if(_0x5e88b2){return _0x5e88b2[_0xce35('0x23')]()[_0xce35('0x22')](function(){_0x320800[_0xce35('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x422874,_0x66335c){return function(_0x510307){if(!_0x510307){_0x422874[_0xce35('0x15')](0x194);}return _0x510307;};}function handleError(_0x1b41a2,_0x2b87b4){_0x2b87b4=_0x2b87b4||0x1f4;return function(_0x184f1f){logger[_0xce35('0x24')](_0x184f1f['stack']);if(_0x184f1f[_0xce35('0x25')]){delete _0x184f1f[_0xce35('0x25')];}_0x1b41a2[_0xce35('0x16')](_0x2b87b4)[_0xce35('0x26')](_0x184f1f);};}exports[_0xce35('0x27')]=function(_0x3876ed,_0xa66ead){var _0x104315={},_0x295ecc={},_0x5b619e={'count':0x0,'rows':[]};var _0xd26850=_['map'](db[_0xce35('0x28')][_0xce35('0x29')],function(_0x401422){return{'name':_0x401422[_0xce35('0x2a')],'type':_0x401422[_0xce35('0x2b')][_0xce35('0x2c')]};});_0x295ecc[_0xce35('0x2d')]=_['map'](_0xd26850,_0xce35('0x25'));_0x295ecc['query']=_[_0xce35('0x2e')](_0x3876ed[_0xce35('0x2f')]);_0x295ecc[_0xce35('0x30')]=_[_0xce35('0x31')](_0x295ecc['model'],_0x295ecc[_0xce35('0x2f')]);_0x104315[_0xce35('0x32')]=_[_0xce35('0x31')](_0x295ecc[_0xce35('0x2d')],qs[_0xce35('0x33')](_0x3876ed[_0xce35('0x2f')][_0xce35('0x33')]));_0x104315[_0xce35('0x32')]=_0x104315[_0xce35('0x32')][_0xce35('0x34')]?_0x104315[_0xce35('0x32')]:_0x295ecc[_0xce35('0x2d')];if(!_0x3876ed[_0xce35('0x2f')]['hasOwnProperty']('nolimit')){_0x104315[_0xce35('0x1a')]=qs[_0xce35('0x1a')](_0x3876ed[_0xce35('0x2f')]['limit']);_0x104315[_0xce35('0x18')]=qs[_0xce35('0x18')](_0x3876ed[_0xce35('0x2f')]['offset']);}_0x104315[_0xce35('0x35')]=qs[_0xce35('0x36')](_0x3876ed[_0xce35('0x2f')][_0xce35('0x36')]);_0x104315[_0xce35('0x37')]=qs[_0xce35('0x30')](_[_0xce35('0x38')](_0x3876ed['query'],_0x295ecc['filters']),_0xd26850);if(_0x3876ed[_0xce35('0x2f')]['filter']){_0x104315['where']=_[_0xce35('0x39')](_0x104315[_0xce35('0x37')],{'$or':_[_0xce35('0x3a')](_0xd26850,function(_0x49d0de){if(_0x49d0de[_0xce35('0x2b')]!=='VIRTUAL'){var _0x51e4f9={};_0x51e4f9[_0x49d0de[_0xce35('0x25')]]={'$like':'%'+_0x3876ed['query'][_0xce35('0x3b')]+'%'};return _0x51e4f9;}})});}_0x104315=_[_0xce35('0x39')]({},_0x104315,_0x3876ed[_0xce35('0x3c')]);var _0x293ae4={'where':_0x104315[_0xce35('0x37')]};return db[_0xce35('0x28')][_0xce35('0x1b')](_0x293ae4)['then'](function(_0x10640c){_0x5b619e[_0xce35('0x1b')]=_0x10640c;if(_0x3876ed[_0xce35('0x2f')]['includeAll']){_0x104315[_0xce35('0x3d')]=[{'all':!![]}];}return db[_0xce35('0x28')][_0xce35('0x3e')](_0x104315);})[_0xce35('0x22')](function(_0x2c6de5){_0x5b619e[_0xce35('0x3f')]=_0x2c6de5;return _0x5b619e;})['then'](respondWithFilteredResult(_0xa66ead,_0x104315))[_0xce35('0x40')](handleError(_0xa66ead,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index a23d42f..f141bd7 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 _0xde48=['./migration.attributes','define','migrations','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x21b0e1,_0x7a8b77){var _0x25ad36=function(_0xffb259){while(--_0xffb259){_0x21b0e1['push'](_0x21b0e1['shift']());}};_0x25ad36(++_0x7a8b77);}(_0xde48,0x1cb));var _0x8de4=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0xde48[_0x550d12];return _0x12103d;};'use strict';var _=require(_0x8de4('0x0'));var util=require(_0x8de4('0x1'));var logger=require(_0x8de4('0x2'))('api');var moment=require(_0x8de4('0x3'));var BPromise=require(_0x8de4('0x4'));var rp=require(_0x8de4('0x5'));var fs=require('fs');var path=require(_0x8de4('0x6'));var rimraf=require(_0x8de4('0x7'));var config=require(_0x8de4('0x8'));var attributes=require(_0x8de4('0x9'));module['exports']=function(_0x2235bf,_0x312c4d){return _0x2235bf[_0x8de4('0xa')]('Migration',attributes,{'tableName':_0x8de4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd625=['./migration.attributes','exports','define','migrations','lodash','util','api','request-promise','path','rimraf','../../config/environment'];(function(_0x469f4d,_0x40c891){var _0x5b96c2=function(_0x29055a){while(--_0x29055a){_0x469f4d['push'](_0x469f4d['shift']());}};_0x5b96c2(++_0x40c891);}(_0xd625,0x1d2));var _0x5d62=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xd625[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x5d62('0x0'));var util=require(_0x5d62('0x1'));var logger=require('../../config/logger')(_0x5d62('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5d62('0x3'));var fs=require('fs');var path=require(_0x5d62('0x4'));var rimraf=require(_0x5d62('0x5'));var config=require(_0x5d62('0x6'));var attributes=require(_0x5d62('0x7'));module[_0x5d62('0x8')]=function(_0x2b1490,_0x9c8b50){return _0x2b1490[_0x5d62('0x9')]('Migration',attributes,{'tableName':_0x5d62('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index 42add48..0df9e81 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 _0xb32d=['client','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x545f2c,_0x58fbca){var _0x24305c=function(_0x1ff754){while(--_0x1ff754){_0x545f2c['push'](_0x545f2c['shift']());}};_0x24305c(++_0x58fbca);}(_0xb32d,0x1da));var _0xdb32=function(_0x107a84,_0x206679){_0x107a84=_0x107a84-0x0;var _0x3c494a=_0xb32d[_0x107a84];return _0x3c494a;};'use strict';var _=require(_0xdb32('0x0'));var util=require(_0xdb32('0x1'));var moment=require(_0xdb32('0x2'));var BPromise=require(_0xdb32('0x3'));var rs=require(_0xdb32('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdb32('0x5'));var logger=require(_0xdb32('0x6'))('rpc');var config=require(_0xdb32('0x7'));var jayson=require(_0xdb32('0x8'));var client=jayson[_0xdb32('0x9')][_0xdb32('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x6f4af0,_0x386309,_0x5bb076){return new BPromise(function(_0x3b0995,_0x2686db){return client[_0xdb32('0xb')](_0x6f4af0,_0x5bb076)[_0xdb32('0xc')](function(_0x30e03d){logger[_0xdb32('0xd')](_0xdb32('0xe'),_0x386309,_0xdb32('0xf'));logger[_0xdb32('0x10')](_0xdb32('0x11'),_0x386309,_0xdb32('0xf'),JSON[_0xdb32('0x12')](_0x30e03d));if(_0x30e03d[_0xdb32('0x13')]){if(_0x30e03d[_0xdb32('0x13')][_0xdb32('0x14')]===0x1f4){logger[_0xdb32('0x13')](_0xdb32('0xe'),_0x386309,_0x30e03d[_0xdb32('0x13')][_0xdb32('0x15')]);return _0x2686db(_0x30e03d[_0xdb32('0x13')][_0xdb32('0x15')]);}logger['error'](_0xdb32('0xe'),_0x386309,_0x30e03d[_0xdb32('0x13')][_0xdb32('0x15')]);return _0x3b0995(_0x30e03d[_0xdb32('0x13')][_0xdb32('0x15')]);}else{logger['info'](_0xdb32('0xe'),_0x386309,_0xdb32('0xf'));_0x3b0995(_0x30e03d[_0xdb32('0x16')]['message']);}})['catch'](function(_0x59a5f8){logger['error'](_0xdb32('0xe'),_0x386309,_0x59a5f8);_0x2686db(_0x59a5f8);});});} \ No newline at end of file +var _0x65f4=['then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x33628a,_0x2df134){var _0x25d370=function(_0x5567fc){while(--_0x5567fc){_0x33628a['push'](_0x33628a['shift']());}};_0x25d370(++_0x2df134);}(_0x65f4,0x19a));var _0x465f=function(_0x128aa0,_0x3e5df8){_0x128aa0=_0x128aa0-0x0;var _0x197ddc=_0x65f4[_0x128aa0];return _0x197ddc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x465f('0x0'));var BPromise=require(_0x465f('0x1'));var rs=require(_0x465f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x465f('0x3'));var logger=require(_0x465f('0x4'))(_0x465f('0x5'));var config=require('../../config/environment');var jayson=require(_0x465f('0x6'));var client=jayson[_0x465f('0x7')][_0x465f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x553ce9,_0x1d4267,_0x5e26ea){return new BPromise(function(_0x523ca1,_0x41b261){return client[_0x465f('0x9')](_0x553ce9,_0x5e26ea)[_0x465f('0xa')](function(_0xc3d49d){logger[_0x465f('0xb')](_0x465f('0xc'),_0x1d4267,_0x465f('0xd'));logger[_0x465f('0xe')]('Migration,\x20%s,\x20%s,\x20%s',_0x1d4267,_0x465f('0xd'),JSON[_0x465f('0xf')](_0xc3d49d));if(_0xc3d49d[_0x465f('0x10')]){if(_0xc3d49d[_0x465f('0x10')][_0x465f('0x11')]===0x1f4){logger[_0x465f('0x10')](_0x465f('0xc'),_0x1d4267,_0xc3d49d[_0x465f('0x10')][_0x465f('0x12')]);return _0x41b261(_0xc3d49d['error']['message']);}logger[_0x465f('0x10')](_0x465f('0xc'),_0x1d4267,_0xc3d49d[_0x465f('0x10')][_0x465f('0x12')]);return _0x523ca1(_0xc3d49d['error'][_0x465f('0x12')]);}else{logger[_0x465f('0xb')]('Migration,\x20%s,\x20%s',_0x1d4267,'request\x20sent');_0x523ca1(_0xc3d49d[_0x465f('0x13')][_0x465f('0x12')]);}})[_0x465f('0x14')](function(_0xf38782){logger[_0x465f('0x10')]('Migration,\x20%s,\x20%s',_0x1d4267,_0xf38782);_0x41b261(_0xf38782);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index b9a3522..f50138b 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 _0xcde7=['connect-timeout','express','../../components/auth/service','../../config/environment','./network.controller','get','isAuthenticated','index','post','create','put','update','delete','/:id','destroy','exports','path'];(function(_0x4d34f0,_0x1534b3){var _0x42b500=function(_0x4b3fe1){while(--_0x4b3fe1){_0x4d34f0['push'](_0x4d34f0['shift']());}};_0x42b500(++_0x1534b3);}(_0xcde7,0x65));var _0x7cde=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xcde7[_0x413feb];return _0x40ee88;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7cde('0x0'));var timeout=require(_0x7cde('0x1'));var express=require(_0x7cde('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x7cde('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7cde('0x4'));var controller=require(_0x7cde('0x5'));router[_0x7cde('0x6')]('/',auth[_0x7cde('0x7')](),controller[_0x7cde('0x8')]);router[_0x7cde('0x6')]('/:id',auth[_0x7cde('0x7')](),controller['show']);router[_0x7cde('0x9')]('/',auth[_0x7cde('0x7')](),controller[_0x7cde('0xa')]);router[_0x7cde('0xb')]('/:id',auth[_0x7cde('0x7')](),controller[_0x7cde('0xc')]);router[_0x7cde('0xd')](_0x7cde('0xe'),auth[_0x7cde('0x7')](),controller[_0x7cde('0xf')]);module[_0x7cde('0x10')]=router; \ No newline at end of file +var _0xe978=['path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','multer','util'];(function(_0x2bc377,_0x4adf29){var _0x8c8cfc=function(_0x2c1ff0){while(--_0x2c1ff0){_0x2bc377['push'](_0x2bc377['shift']());}};_0x8c8cfc(++_0x4adf29);}(_0xe978,0x70));var _0x8e97=function(_0xe6c56f,_0x1032d6){_0xe6c56f=_0xe6c56f-0x0;var _0x42aad6=_0xe978[_0xe6c56f];return _0x42aad6;};'use strict';var multer=require(_0x8e97('0x0'));var util=require(_0x8e97('0x1'));var path=require(_0x8e97('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8e97('0x3')]();var fs_extra=require(_0x8e97('0x4'));var auth=require(_0x8e97('0x5'));var interaction=require(_0x8e97('0x6'));var config=require(_0x8e97('0x7'));var controller=require('./network.controller');router[_0x8e97('0x8')]('/',auth[_0x8e97('0x9')](),controller[_0x8e97('0xa')]);router[_0x8e97('0x8')](_0x8e97('0xb'),auth['isAuthenticated'](),controller[_0x8e97('0xc')]);router['post']('/',auth[_0x8e97('0x9')](),controller[_0x8e97('0xd')]);router[_0x8e97('0xe')]('/:id',auth[_0x8e97('0x9')](),controller[_0x8e97('0xf')]);router[_0x8e97('0x10')](_0x8e97('0xb'),auth[_0x8e97('0x9')](),controller[_0x8e97('0x11')]);module[_0x8e97('0x12')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 25de5ee..aecdcf0 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 _0x6096=['exports','localnet','stun','turn','STRING','sequelize'];(function(_0x1771a4,_0x5daef8){var _0x2191d7=function(_0x5c9e2f){while(--_0x5c9e2f){_0x1771a4['push'](_0x1771a4['shift']());}};_0x2191d7(++_0x5daef8);}(_0x6096,0xbf));var _0x6609=function(_0x1a759e,_0x23ca52){_0x1a759e=_0x1a759e-0x0;var _0x1c0ba7=_0x6096[_0x1a759e];return _0x1c0ba7;};'use strict';var Sequelize=require(_0x6609('0x0'));module[_0x6609('0x1')]={'type':{'type':Sequelize['ENUM'](_0x6609('0x2'),'externip',_0x6609('0x3'),_0x6609('0x4'))},'value':{'type':Sequelize[_0x6609('0x5')]},'username':{'type':Sequelize[_0x6609('0x5')]},'password':{'type':Sequelize[_0x6609('0x5')]}}; \ No newline at end of file +var _0xcc88=['ENUM','localnet','externip','stun','turn','STRING','sequelize','exports'];(function(_0x4a1b73,_0xfbd93c){var _0x4eb052=function(_0x1acb99){while(--_0x1acb99){_0x4a1b73['push'](_0x4a1b73['shift']());}};_0x4eb052(++_0xfbd93c);}(_0xcc88,0x1be));var _0x8cc8=function(_0x946c2e,_0x1561df){_0x946c2e=_0x946c2e-0x0;var _0xabe960=_0xcc88[_0x946c2e];return _0xabe960;};'use strict';var Sequelize=require(_0x8cc8('0x0'));module[_0x8cc8('0x1')]={'type':{'type':Sequelize[_0x8cc8('0x2')](_0x8cc8('0x3'),_0x8cc8('0x4'),_0x8cc8('0x5'),_0x8cc8('0x6'))},'value':{'type':Sequelize[_0x8cc8('0x7')]},'username':{'type':Sequelize[_0x8cc8('0x7')]},'password':{'type':Sequelize[_0x8cc8('0x7')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index e89cc95..63423ba 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 _0xce5c=['root','server/files/templates/turn_multiple.ejs','server/files/templates/network.ejs','toLowerCase','chan_sip.so','update','sequelize','params','STUN','/etc/asterisk/turn_xcally.conf','destroy','format','eml-format','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','stack','name','send','index','map','rawAttributes','type','key','model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','Network','includeAll','include','findAll','show','find','transaction','create','body','toUpperCase','readFileSync','join','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN'];(function(_0x4cd3db,_0x28e2a0){var _0x20135a=function(_0x27cdca){while(--_0x27cdca){_0x4cd3db['push'](_0x4cd3db['shift']());}};_0x20135a(++_0x28e2a0);}(_0xce5c,0x79));var _0xcce5=function(_0x3bfdde,_0x306be4){_0x3bfdde=_0x3bfdde-0x0;var _0x3f752a=_0xce5c[_0x3bfdde];return _0x3f752a;};'use strict';var emlformat=require(_0xcce5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcce5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xcce5('0x2'));var BPromise=require(_0xcce5('0x3'));var Mustache=require(_0xcce5('0x4'));var util=require('util');var path=require(_0xcce5('0x5'));var sox=require(_0xcce5('0x6'));var csv=require(_0xcce5('0x7'));var ejs=require(_0xcce5('0x8'));var fs=require('fs');var fs_extra=require(_0xcce5('0x9'));var _=require(_0xcce5('0xa'));var squel=require(_0xcce5('0xb'));var crypto=require(_0xcce5('0xc'));var jsforce=require(_0xcce5('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xcce5('0x7'));var querystring=require(_0xcce5('0xe'));var Papa=require(_0xcce5('0xf'));var Redis=require(_0xcce5('0x10'));var authService=require(_0xcce5('0x11'));var qs=require(_0xcce5('0x12'));var as=require(_0xcce5('0x13'));var hardwareService=require(_0xcce5('0x14'));var logger=require(_0xcce5('0x15'))(_0xcce5('0x16'));var utils=require(_0xcce5('0x17'));var config=require(_0xcce5('0x18'));var licenseUtil=require(_0xcce5('0x19'));var db=require('../../mysqldb')['db'];var jayson=require(_0xcce5('0x1a'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x44c437,_0x2318b7,_0x4e82d9,_0x1fa558){return new BPromise(function(_0x29a501,_0x2dc241){var _0xbbe1d9=_0x1fa558||client;return _0xbbe1d9['request'](_0x44c437,_0x4e82d9)[_0xcce5('0x1b')](function(_0x3b7cef){logger[_0xcce5('0x1c')](_0xcce5('0x1d'),_0x2318b7,_0xcce5('0x1e'));logger[_0xcce5('0x1f')](_0xcce5('0x20'),_0x2318b7,_0xcce5('0x1e'),JSON[_0xcce5('0x21')](_0x3b7cef));if(_0x3b7cef[_0xcce5('0x22')]){if(_0x3b7cef['error'][_0xcce5('0x23')]===0x1f4){logger[_0xcce5('0x22')]('Network,\x20%s,\x20%s',_0x2318b7,_0x3b7cef[_0xcce5('0x22')][_0xcce5('0x24')]);return _0x2dc241(_0x3b7cef[_0xcce5('0x22')][_0xcce5('0x24')]);}logger['error'](_0xcce5('0x1d'),_0x2318b7,_0x3b7cef[_0xcce5('0x22')]['message']);return _0x29a501(_0x3b7cef[_0xcce5('0x22')][_0xcce5('0x24')]);}else{logger[_0xcce5('0x1c')](_0xcce5('0x1d'),_0x2318b7,_0xcce5('0x1e'));_0x29a501(_0x3b7cef[_0xcce5('0x25')]['message']);}})[_0xcce5('0x26')](function(_0x5b05ce){logger['error']('Network,\x20%s,\x20%s',_0x2318b7,_0x5b05ce);_0x2dc241(_0x5b05ce);});});}function respondWithStatusCode(_0x581632,_0x124919){_0x124919=_0x124919||0xcc;return function(_0x179f04){if(_0x179f04){return _0x581632[_0xcce5('0x27')](_0x124919);}return _0x581632[_0xcce5('0x28')](_0x124919)[_0xcce5('0x29')]();};}function respondWithResult(_0x389d10,_0x33ca89){_0x33ca89=_0x33ca89||0xc8;return function(_0x5e801a){if(_0x5e801a){return _0x389d10[_0xcce5('0x28')](_0x33ca89)[_0xcce5('0x2a')](_0x5e801a);}};}function respondWithFilteredResult(_0x5c88d4,_0x589e63){return function(_0x3dbbaf){if(_0x3dbbaf){var _0x15c7d8=typeof _0x589e63[_0xcce5('0x2b')]===_0xcce5('0x2c')&&typeof _0x589e63[_0xcce5('0x2d')]===_0xcce5('0x2c');var _0x360a43=_0x3dbbaf[_0xcce5('0x2e')];var _0x13ae88=_0x15c7d8?0x0:_0x589e63[_0xcce5('0x2b')];var _0x2209a6=_0x15c7d8?_0x3dbbaf[_0xcce5('0x2e')]:_0x589e63[_0xcce5('0x2b')]+_0x589e63[_0xcce5('0x2d')];var _0x19b4e4;if(_0x2209a6>=_0x360a43){_0x2209a6=_0x360a43;_0x19b4e4=0xc8;}else{_0x19b4e4=0xce;}_0x5c88d4['status'](_0x19b4e4);return _0x5c88d4[_0xcce5('0x2f')](_0xcce5('0x30'),_0x13ae88+'-'+_0x2209a6+'/'+_0x360a43)['json'](_0x3dbbaf);}return null;};}function patchUpdates(_0x40b50d){return function(_0x57a240){try{jsonpatch[_0xcce5('0x31')](_0x57a240,_0x40b50d,!![]);}catch(_0xe7c038){return BPromise['reject'](_0xe7c038);}return _0x57a240[_0xcce5('0x32')]();};}function saveUpdates(_0x14d3f5,_0x430b52){return function(_0x3194ac){if(_0x3194ac){return _0x3194ac['update'](_0x14d3f5)[_0xcce5('0x1b')](function(_0x39005b){return _0x39005b;});}return null;};}function removeEntity(_0x9189ec,_0x539c20){return function(_0x208540){if(_0x208540){return _0x208540['destroy']()[_0xcce5('0x1b')](function(){_0x9189ec[_0xcce5('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28fc1d,_0x1e3f9a){return function(_0x314a32){if(!_0x314a32){_0x28fc1d[_0xcce5('0x27')](0x194);}return _0x314a32;};}function handleError(_0x99b718,_0x206240){_0x206240=_0x206240||0x1f4;return function(_0x14a48e){logger['error'](_0x14a48e[_0xcce5('0x33')]);if(_0x14a48e[_0xcce5('0x34')]){delete _0x14a48e[_0xcce5('0x34')];}_0x99b718['status'](_0x206240)[_0xcce5('0x35')](_0x14a48e);};}exports[_0xcce5('0x36')]=function(_0x2f692a,_0x3043f0){var _0x508c33={},_0x2ad305={},_0xf07982={'count':0x0,'rows':[]};var _0x39f4cc=_[_0xcce5('0x37')](db['Network'][_0xcce5('0x38')],function(_0x19b50e){return{'name':_0x19b50e['fieldName'],'type':_0x19b50e[_0xcce5('0x39')][_0xcce5('0x3a')]};});_0x2ad305[_0xcce5('0x3b')]=_[_0xcce5('0x37')](_0x39f4cc,_0xcce5('0x34'));_0x2ad305['query']=_[_0xcce5('0x3c')](_0x2f692a['query']);_0x2ad305[_0xcce5('0x3d')]=_['intersection'](_0x2ad305[_0xcce5('0x3b')],_0x2ad305[_0xcce5('0x3e')]);_0x508c33[_0xcce5('0x3f')]=_[_0xcce5('0x40')](_0x2ad305[_0xcce5('0x3b')],qs['fields'](_0x2f692a[_0xcce5('0x3e')][_0xcce5('0x41')]));_0x508c33['attributes']=_0x508c33[_0xcce5('0x3f')][_0xcce5('0x42')]?_0x508c33[_0xcce5('0x3f')]:_0x2ad305[_0xcce5('0x3b')];if(!_0x2f692a[_0xcce5('0x3e')][_0xcce5('0x43')](_0xcce5('0x44'))){_0x508c33['limit']=qs['limit'](_0x2f692a[_0xcce5('0x3e')][_0xcce5('0x2d')]);_0x508c33['offset']=qs[_0xcce5('0x2b')](_0x2f692a[_0xcce5('0x3e')][_0xcce5('0x2b')]);}_0x508c33[_0xcce5('0x45')]=qs[_0xcce5('0x46')](_0x2f692a[_0xcce5('0x3e')]['sort']);_0x508c33['where']=qs[_0xcce5('0x3d')](_[_0xcce5('0x47')](_0x2f692a['query'],_0x2ad305['filters']),_0x39f4cc);if(_0x2f692a[_0xcce5('0x3e')][_0xcce5('0x48')]){_0x508c33['where']=_[_0xcce5('0x49')](_0x508c33[_0xcce5('0x4a')],{'$or':_['map'](_0x39f4cc,function(_0x3a4a6f){if(_0x3a4a6f['type']!==_0xcce5('0x4b')){var _0x109c7a={};_0x109c7a[_0x3a4a6f[_0xcce5('0x34')]]={'$like':'%'+_0x2f692a[_0xcce5('0x3e')][_0xcce5('0x48')]+'%'};return _0x109c7a;}})});}_0x508c33=_['merge']({},_0x508c33,_0x2f692a[_0xcce5('0x4c')]);var _0x10f9f4={'where':_0x508c33[_0xcce5('0x4a')]};return db[_0xcce5('0x4d')][_0xcce5('0x2e')](_0x10f9f4)[_0xcce5('0x1b')](function(_0x34a2a9){_0xf07982[_0xcce5('0x2e')]=_0x34a2a9;if(_0x2f692a['query'][_0xcce5('0x4e')]){_0x508c33[_0xcce5('0x4f')]=[{'all':!![]}];}return db[_0xcce5('0x4d')][_0xcce5('0x50')](_0x508c33);})[_0xcce5('0x1b')](function(_0x12fc13){_0xf07982['rows']=_0x12fc13;return _0xf07982;})[_0xcce5('0x1b')](respondWithFilteredResult(_0x3043f0,_0x508c33))[_0xcce5('0x26')](handleError(_0x3043f0,null));};exports[_0xcce5('0x51')]=function(_0x61bb16,_0x3db801){var _0xd0c94b={'raw':!![],'where':{'id':_0x61bb16['params']['id']}},_0x3aad26={};_0x3aad26[_0xcce5('0x3b')]=_[_0xcce5('0x3c')](db[_0xcce5('0x4d')]['rawAttributes']);_0x3aad26[_0xcce5('0x3e')]=_[_0xcce5('0x3c')](_0x61bb16[_0xcce5('0x3e')]);_0x3aad26[_0xcce5('0x3d')]=_[_0xcce5('0x40')](_0x3aad26['model'],_0x3aad26[_0xcce5('0x3e')]);_0xd0c94b[_0xcce5('0x3f')]=_[_0xcce5('0x40')](_0x3aad26['model'],qs[_0xcce5('0x41')](_0x61bb16[_0xcce5('0x3e')][_0xcce5('0x41')]));_0xd0c94b['attributes']=_0xd0c94b[_0xcce5('0x3f')][_0xcce5('0x42')]?_0xd0c94b['attributes']:_0x3aad26[_0xcce5('0x3b')];if(_0x61bb16[_0xcce5('0x3e')][_0xcce5('0x4e')]){_0xd0c94b[_0xcce5('0x4f')]=[{'all':!![]}];}_0xd0c94b=_[_0xcce5('0x49')]({},_0xd0c94b,_0x61bb16[_0xcce5('0x4c')]);return db[_0xcce5('0x4d')][_0xcce5('0x52')](_0xd0c94b)[_0xcce5('0x1b')](handleEntityNotFound(_0x3db801,null))[_0xcce5('0x1b')](respondWithResult(_0x3db801,null))[_0xcce5('0x26')](handleError(_0x3db801,null));};exports['create']=function(_0x35165b,_0x3f67a2,_0x151aeb){var _0x270da3;return db['sequelize'][_0xcce5('0x53')](function(_0x279503){return db['Network'][_0xcce5('0x54')](_0x35165b['body'],{'raw':!![]})['then'](function(_0x443e74){_0x270da3=_0x443e74;return db[_0xcce5('0x4d')]['findAll']({'where':{'type':_0x35165b[_0xcce5('0x55')][_0xcce5('0x39')]},'raw':!![]});})[_0xcce5('0x1b')](function(_0x23defe){if(_0x270da3[_0xcce5('0x39')][_0xcce5('0x56')]()=='STUN'){var _0x5e550a=fs[_0xcce5('0x57')](path[_0xcce5('0x58')](config['root'],_0xcce5('0x59')),_0xcce5('0x5a'));var _0x4d76d6=ejs[_0xcce5('0x5b')](_0x5e550a,{'networks':_0x23defe||[]});fs[_0xcce5('0x5c')](_0xcce5('0x5d'),_0x4d76d6);return respondWithRpcPromise(_0xcce5('0x5e'),_0xcce5('0x54'),{'module':_0xcce5('0x5f')});}else if(_0x270da3[_0xcce5('0x39')][_0xcce5('0x56')]()==_0xcce5('0x60')){var _0x2925f7=fs[_0xcce5('0x57')](path['join'](config[_0xcce5('0x61')],_0xcce5('0x62')),_0xcce5('0x5a'));var _0x131ddd=ejs[_0xcce5('0x5b')](_0x2925f7,{'networks':_0x23defe||[]});fs[_0xcce5('0x5c')]('/etc/asterisk/turn_xcally.conf',_0x131ddd);return respondWithRpcPromise('Reload','create',{'module':_0xcce5('0x5f')});}else{var _0x1d3023=fs[_0xcce5('0x57')](path[_0xcce5('0x58')](config['root'],_0xcce5('0x63')),_0xcce5('0x5a'));var _0x126fdd=ejs[_0xcce5('0x5b')](_0x1d3023,{'networks':_0x23defe||[]});fs[_0xcce5('0x5c')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x35165b[_0xcce5('0x55')][_0xcce5('0x39')][_0xcce5('0x64')]()),_0x126fdd);return respondWithRpcPromise('Reload','create',{'module':_0xcce5('0x65')});}return null;})[_0xcce5('0x1b')](function(){return _0x270da3;});})['then'](respondWithResult(_0x3f67a2,0xc9))[_0xcce5('0x26')](handleError(_0x3f67a2,null));};exports[_0xcce5('0x66')]=function(_0x1cb7fa,_0x916638,_0xfa5f2){var _0x3d40f6;return db[_0xcce5('0x67')][_0xcce5('0x53')](function(_0x40b4b0){return db[_0xcce5('0x4d')][_0xcce5('0x52')]({'where':{'id':_0x1cb7fa[_0xcce5('0x68')]['id']}})['then'](handleEntityNotFound(_0x916638,null))['then'](saveUpdates(_0x1cb7fa[_0xcce5('0x55')],null))['then'](function(_0x4d774a){if(_0x4d774a){_0x3d40f6=_0x4d774a;return db[_0xcce5('0x4d')][_0xcce5('0x50')]({'where':{'type':_0x3d40f6[_0xcce5('0x39')]},'raw':!![]});}return null;})['then'](function(_0x16c47a){if(_0x3d40f6[_0xcce5('0x39')]['toUpperCase']()==_0xcce5('0x69')){var _0x47f700=fs['readFileSync'](path[_0xcce5('0x58')](config[_0xcce5('0x61')],_0xcce5('0x59')),_0xcce5('0x5a'));var _0x5923fc=ejs[_0xcce5('0x5b')](_0x47f700,{'networks':_0x16c47a||[]});fs[_0xcce5('0x5c')]('/etc/asterisk/stun_xcally.conf',_0x5923fc);return respondWithRpcPromise(_0xcce5('0x5e'),_0xcce5('0x66'),{'module':_0xcce5('0x5f')});}else if(_0x3d40f6[_0xcce5('0x39')][_0xcce5('0x56')]()=='TURN'){var _0x3cafc8=fs['readFileSync'](path['join'](config[_0xcce5('0x61')],'server/files/templates/turn_multiple.ejs'),_0xcce5('0x5a'));var _0x531d09=ejs[_0xcce5('0x5b')](_0x3cafc8,{'networks':_0x16c47a||[]});fs[_0xcce5('0x5c')](_0xcce5('0x6a'),_0x531d09);return respondWithRpcPromise(_0xcce5('0x5e'),_0xcce5('0x66'),{'module':'res_stun_monitor.so'});}else{var _0x50f129=fs['readFileSync'](path[_0xcce5('0x58')](config[_0xcce5('0x61')],_0xcce5('0x63')),'utf8');var _0x5c546f=ejs['render'](_0x50f129,{'networks':_0x16c47a||[]});fs[_0xcce5('0x5c')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x1cb7fa[_0xcce5('0x55')]['type'][_0xcce5('0x64')]()),_0x5c546f);return respondWithRpcPromise(_0xcce5('0x5e'),_0xcce5('0x66'),{'module':_0xcce5('0x65')});}return null;})[_0xcce5('0x1b')](function(_0x909d2e){if(_0x909d2e){return _0x3d40f6;}return null;});})[_0xcce5('0x1b')](respondWithResult(_0x916638,null))[_0xcce5('0x26')](handleError(_0x916638,null));};exports[_0xcce5('0x6b')]=function(_0xd7e08d,_0x1d6c23,_0x38965b){var _0x3605f8;return db[_0xcce5('0x4d')][_0xcce5('0x52')]({'where':{'id':_0xd7e08d[_0xcce5('0x68')]['id']}})[_0xcce5('0x1b')](function(_0x5d72c9){_0x3605f8=_0x5d72c9;return _0x5d72c9;})[_0xcce5('0x1b')](handleEntityNotFound(_0x1d6c23,null))['then'](removeEntity(_0x1d6c23,null))['then'](function(){if(_0x3605f8){return db[_0xcce5('0x4d')][_0xcce5('0x50')]({'where':{'type':_0x3605f8[_0xcce5('0x39')]},'raw':!![]});}})[_0xcce5('0x1b')](function(_0x4386c6){if(_0x3605f8[_0xcce5('0x39')]['toUpperCase']()==_0xcce5('0x69')){var _0x15d87e=fs['readFileSync'](path[_0xcce5('0x58')](config['root'],_0xcce5('0x59')),_0xcce5('0x5a'));var _0x1e7f40=ejs[_0xcce5('0x5b')](_0x15d87e,{'networks':_0x4386c6||[]});fs[_0xcce5('0x5c')](_0xcce5('0x5d'),_0x1e7f40);return respondWithRpcPromise('Reload',_0xcce5('0x6b'),{'module':_0xcce5('0x5f')});}else if(_0x3605f8[_0xcce5('0x39')]['toUpperCase']()==_0xcce5('0x60')){var _0x3f0fa5=fs['readFileSync'](path[_0xcce5('0x58')](config[_0xcce5('0x61')],_0xcce5('0x62')),_0xcce5('0x5a'));var _0x4db34b=ejs[_0xcce5('0x5b')](_0x3f0fa5,{'networks':_0x4386c6||[]});fs[_0xcce5('0x5c')](_0xcce5('0x6a'),_0x4db34b);return respondWithRpcPromise(_0xcce5('0x5e'),'destroy',{'module':_0xcce5('0x5f')});}else{var _0x5089c8=fs[_0xcce5('0x57')](path['join'](config['root'],_0xcce5('0x63')),_0xcce5('0x5a'));var _0x4ada7a=ejs[_0xcce5('0x5b')](_0x5089c8,{'networks':_0x4386c6||[]});fs[_0xcce5('0x5c')](util[_0xcce5('0x6c')]('/etc/asterisk/sip_xcally_%s.conf',_0xd7e08d[_0xcce5('0x55')][_0xcce5('0x39')][_0xcce5('0x64')]()),_0x4ada7a);return respondWithRpcPromise(_0xcce5('0x5e'),_0xcce5('0x6b'),{'module':_0xcce5('0x65')});}return null;})[_0xcce5('0x26')](handleError(_0x1d6c23,null));}; \ No newline at end of file +var _0xab72=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','request','then','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','offset','limit','count','json','reject','save','update','destroy','end','send','index','map','Network','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','length','order','sort','where','filters','filter','VIRTUAL','name','options','includeAll','findAll','rows','show','params','fields','find','create','sequelize','transaction','body','STUN','root','utf8','writeFileSync','/etc/asterisk/stun_xcally.conf','toUpperCase','TURN','join','server/files/templates/turn_multiple.ejs','render','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','readFileSync','server/files/templates/network.ejs','toLowerCase','Reload','format','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','server/files/templates/stun_multiple.ejs','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x1dd884,_0x275c20){var _0x1d5b70=function(_0x2d4ef0){while(--_0x2d4ef0){_0x1dd884['push'](_0x1dd884['shift']());}};_0x1d5b70(++_0x275c20);}(_0xab72,0x123));var _0x2ab7=function(_0x3a9b36,_0x4e3247){_0x3a9b36=_0x3a9b36-0x0;var _0xf4b354=_0xab72[_0x3a9b36];return _0xf4b354;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2ab7('0x0'));var jsonpatch=require(_0x2ab7('0x1'));var rp=require(_0x2ab7('0x2'));var moment=require(_0x2ab7('0x3'));var BPromise=require(_0x2ab7('0x4'));var Mustache=require(_0x2ab7('0x5'));var util=require(_0x2ab7('0x6'));var path=require(_0x2ab7('0x7'));var sox=require(_0x2ab7('0x8'));var csv=require(_0x2ab7('0x9'));var ejs=require(_0x2ab7('0xa'));var fs=require('fs');var fs_extra=require(_0x2ab7('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2ab7('0xc'));var jsforce=require(_0x2ab7('0xd'));var deskjs=require(_0x2ab7('0xe'));var toCsv=require(_0x2ab7('0x9'));var querystring=require(_0x2ab7('0xf'));var Papa=require(_0x2ab7('0x10'));var Redis=require(_0x2ab7('0x11'));var authService=require(_0x2ab7('0x12'));var qs=require(_0x2ab7('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2ab7('0x14'));var logger=require('../../config/logger')(_0x2ab7('0x15'));var utils=require(_0x2ab7('0x16'));var config=require(_0x2ab7('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x2ab7('0x18'))['db'];var jayson=require(_0x2ab7('0x19'));var client=jayson[_0x2ab7('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x12ae68,_0x215104,_0x4bf36f,_0x6bcbad){return new BPromise(function(_0x31a481,_0x2da69d){var _0x2275a1=_0x6bcbad||client;return _0x2275a1[_0x2ab7('0x1b')](_0x12ae68,_0x4bf36f)[_0x2ab7('0x1c')](function(_0x49b199){logger['info'](_0x2ab7('0x1d'),_0x215104,_0x2ab7('0x1e'));logger['debug'](_0x2ab7('0x1f'),_0x215104,_0x2ab7('0x1e'),JSON[_0x2ab7('0x20')](_0x49b199));if(_0x49b199['error']){if(_0x49b199[_0x2ab7('0x21')][_0x2ab7('0x22')]===0x1f4){logger['error']('Network,\x20%s,\x20%s',_0x215104,_0x49b199[_0x2ab7('0x21')][_0x2ab7('0x23')]);return _0x2da69d(_0x49b199[_0x2ab7('0x21')][_0x2ab7('0x23')]);}logger[_0x2ab7('0x21')](_0x2ab7('0x1d'),_0x215104,_0x49b199['error'][_0x2ab7('0x23')]);return _0x31a481(_0x49b199['error'][_0x2ab7('0x23')]);}else{logger['info'](_0x2ab7('0x1d'),_0x215104,_0x2ab7('0x1e'));_0x31a481(_0x49b199['result'][_0x2ab7('0x23')]);}})[_0x2ab7('0x24')](function(_0x3daad1){logger[_0x2ab7('0x21')]('Network,\x20%s,\x20%s',_0x215104,_0x3daad1);_0x2da69d(_0x3daad1);});});}function respondWithStatusCode(_0x38b4f5,_0xeb10c9){_0xeb10c9=_0xeb10c9||0xcc;return function(_0x2c15d1){if(_0x2c15d1){return _0x38b4f5[_0x2ab7('0x25')](_0xeb10c9);}return _0x38b4f5[_0x2ab7('0x26')](_0xeb10c9)['end']();};}function respondWithResult(_0x3095d4,_0x46cf39){_0x46cf39=_0x46cf39||0xc8;return function(_0x1d1c5d){if(_0x1d1c5d){return _0x3095d4['status'](_0x46cf39)['json'](_0x1d1c5d);}};}function respondWithFilteredResult(_0x317854,_0xe5c585){return function(_0x3fe969){if(_0x3fe969){var _0x413557=typeof _0xe5c585[_0x2ab7('0x27')]==='undefined'&&typeof _0xe5c585[_0x2ab7('0x28')]==='undefined';var _0x5c73cc=_0x3fe969[_0x2ab7('0x29')];var _0x3ced34=_0x413557?0x0:_0xe5c585[_0x2ab7('0x27')];var _0x2f82f8=_0x413557?_0x3fe969[_0x2ab7('0x29')]:_0xe5c585[_0x2ab7('0x27')]+_0xe5c585[_0x2ab7('0x28')];var _0x55d4c2;if(_0x2f82f8>=_0x5c73cc){_0x2f82f8=_0x5c73cc;_0x55d4c2=0xc8;}else{_0x55d4c2=0xce;}_0x317854[_0x2ab7('0x26')](_0x55d4c2);return _0x317854['set']('Content-Range',_0x3ced34+'-'+_0x2f82f8+'/'+_0x5c73cc)[_0x2ab7('0x2a')](_0x3fe969);}return null;};}function patchUpdates(_0x3a0cec){return function(_0x55259e){try{jsonpatch['apply'](_0x55259e,_0x3a0cec,!![]);}catch(_0x5db591){return BPromise[_0x2ab7('0x2b')](_0x5db591);}return _0x55259e[_0x2ab7('0x2c')]();};}function saveUpdates(_0x1990bd,_0x225534){return function(_0x4bbef0){if(_0x4bbef0){return _0x4bbef0[_0x2ab7('0x2d')](_0x1990bd)[_0x2ab7('0x1c')](function(_0x2cf06a){return _0x2cf06a;});}return null;};}function removeEntity(_0x295af6,_0x46300d){return function(_0x4d5e9d){if(_0x4d5e9d){return _0x4d5e9d[_0x2ab7('0x2e')]()[_0x2ab7('0x1c')](function(){_0x295af6[_0x2ab7('0x26')](0xcc)[_0x2ab7('0x2f')]();});}};}function handleEntityNotFound(_0x38b0a0,_0x20d274){return function(_0x319732){if(!_0x319732){_0x38b0a0[_0x2ab7('0x25')](0x194);}return _0x319732;};}function handleError(_0x4a5927,_0x57555a){_0x57555a=_0x57555a||0x1f4;return function(_0xadefce){logger[_0x2ab7('0x21')](_0xadefce['stack']);if(_0xadefce['name']){delete _0xadefce['name'];}_0x4a5927[_0x2ab7('0x26')](_0x57555a)[_0x2ab7('0x30')](_0xadefce);};}exports[_0x2ab7('0x31')]=function(_0x150115,_0x5ad713){var _0x2d8deb={},_0x46b134={},_0x3fbcb0={'count':0x0,'rows':[]};var _0x23c2c3=_[_0x2ab7('0x32')](db[_0x2ab7('0x33')][_0x2ab7('0x34')],function(_0x1a455f){return{'name':_0x1a455f[_0x2ab7('0x35')],'type':_0x1a455f[_0x2ab7('0x36')][_0x2ab7('0x37')]};});_0x46b134[_0x2ab7('0x38')]=_['map'](_0x23c2c3,'name');_0x46b134[_0x2ab7('0x39')]=_[_0x2ab7('0x3a')](_0x150115[_0x2ab7('0x39')]);_0x46b134['filters']=_[_0x2ab7('0x3b')](_0x46b134['model'],_0x46b134['query']);_0x2d8deb[_0x2ab7('0x3c')]=_[_0x2ab7('0x3b')](_0x46b134[_0x2ab7('0x38')],qs['fields'](_0x150115[_0x2ab7('0x39')]['fields']));_0x2d8deb['attributes']=_0x2d8deb[_0x2ab7('0x3c')][_0x2ab7('0x3d')]?_0x2d8deb[_0x2ab7('0x3c')]:_0x46b134['model'];if(!_0x150115[_0x2ab7('0x39')]['hasOwnProperty']('nolimit')){_0x2d8deb[_0x2ab7('0x28')]=qs[_0x2ab7('0x28')](_0x150115['query'][_0x2ab7('0x28')]);_0x2d8deb[_0x2ab7('0x27')]=qs[_0x2ab7('0x27')](_0x150115[_0x2ab7('0x39')]['offset']);}_0x2d8deb[_0x2ab7('0x3e')]=qs[_0x2ab7('0x3f')](_0x150115[_0x2ab7('0x39')][_0x2ab7('0x3f')]);_0x2d8deb[_0x2ab7('0x40')]=qs[_0x2ab7('0x41')](_['pick'](_0x150115[_0x2ab7('0x39')],_0x46b134[_0x2ab7('0x41')]),_0x23c2c3);if(_0x150115[_0x2ab7('0x39')][_0x2ab7('0x42')]){_0x2d8deb[_0x2ab7('0x40')]=_['merge'](_0x2d8deb[_0x2ab7('0x40')],{'$or':_[_0x2ab7('0x32')](_0x23c2c3,function(_0x502e6a){if(_0x502e6a[_0x2ab7('0x36')]!==_0x2ab7('0x43')){var _0x38f91d={};_0x38f91d[_0x502e6a[_0x2ab7('0x44')]]={'$like':'%'+_0x150115[_0x2ab7('0x39')][_0x2ab7('0x42')]+'%'};return _0x38f91d;}})});}_0x2d8deb=_['merge']({},_0x2d8deb,_0x150115[_0x2ab7('0x45')]);var _0x2be724={'where':_0x2d8deb[_0x2ab7('0x40')]};return db[_0x2ab7('0x33')][_0x2ab7('0x29')](_0x2be724)[_0x2ab7('0x1c')](function(_0x39f040){_0x3fbcb0[_0x2ab7('0x29')]=_0x39f040;if(_0x150115[_0x2ab7('0x39')][_0x2ab7('0x46')]){_0x2d8deb['include']=[{'all':!![]}];}return db[_0x2ab7('0x33')][_0x2ab7('0x47')](_0x2d8deb);})[_0x2ab7('0x1c')](function(_0x57e124){_0x3fbcb0[_0x2ab7('0x48')]=_0x57e124;return _0x3fbcb0;})['then'](respondWithFilteredResult(_0x5ad713,_0x2d8deb))['catch'](handleError(_0x5ad713,null));};exports[_0x2ab7('0x49')]=function(_0x18d3ef,_0x19d9c5){var _0x4e860d={'raw':!![],'where':{'id':_0x18d3ef[_0x2ab7('0x4a')]['id']}},_0x2b406a={};_0x2b406a[_0x2ab7('0x38')]=_[_0x2ab7('0x3a')](db[_0x2ab7('0x33')]['rawAttributes']);_0x2b406a[_0x2ab7('0x39')]=_[_0x2ab7('0x3a')](_0x18d3ef[_0x2ab7('0x39')]);_0x2b406a[_0x2ab7('0x41')]=_[_0x2ab7('0x3b')](_0x2b406a[_0x2ab7('0x38')],_0x2b406a[_0x2ab7('0x39')]);_0x4e860d[_0x2ab7('0x3c')]=_[_0x2ab7('0x3b')](_0x2b406a['model'],qs['fields'](_0x18d3ef[_0x2ab7('0x39')][_0x2ab7('0x4b')]));_0x4e860d[_0x2ab7('0x3c')]=_0x4e860d[_0x2ab7('0x3c')][_0x2ab7('0x3d')]?_0x4e860d['attributes']:_0x2b406a[_0x2ab7('0x38')];if(_0x18d3ef[_0x2ab7('0x39')][_0x2ab7('0x46')]){_0x4e860d['include']=[{'all':!![]}];}_0x4e860d=_['merge']({},_0x4e860d,_0x18d3ef['options']);return db[_0x2ab7('0x33')][_0x2ab7('0x4c')](_0x4e860d)[_0x2ab7('0x1c')](handleEntityNotFound(_0x19d9c5,null))[_0x2ab7('0x1c')](respondWithResult(_0x19d9c5,null))['catch'](handleError(_0x19d9c5,null));};exports[_0x2ab7('0x4d')]=function(_0x268fe4,_0x13fbda,_0x55bf0d){var _0x18304c;return db[_0x2ab7('0x4e')][_0x2ab7('0x4f')](function(_0x5b71a3){return db[_0x2ab7('0x33')][_0x2ab7('0x4d')](_0x268fe4[_0x2ab7('0x50')],{'raw':!![]})[_0x2ab7('0x1c')](function(_0x333099){_0x18304c=_0x333099;return db[_0x2ab7('0x33')][_0x2ab7('0x47')]({'where':{'type':_0x268fe4[_0x2ab7('0x50')][_0x2ab7('0x36')]},'raw':!![]});})[_0x2ab7('0x1c')](function(_0x44180f){if(_0x18304c['type']['toUpperCase']()==_0x2ab7('0x51')){var _0xeb9190=fs['readFileSync'](path['join'](config[_0x2ab7('0x52')],'server/files/templates/stun_multiple.ejs'),_0x2ab7('0x53'));var _0xf23793=ejs['render'](_0xeb9190,{'networks':_0x44180f||[]});fs[_0x2ab7('0x54')](_0x2ab7('0x55'),_0xf23793);return respondWithRpcPromise('Reload',_0x2ab7('0x4d'),{'module':'res_stun_monitor.so'});}else if(_0x18304c[_0x2ab7('0x36')][_0x2ab7('0x56')]()==_0x2ab7('0x57')){var _0x50bb4d=fs['readFileSync'](path[_0x2ab7('0x58')](config['root'],_0x2ab7('0x59')),'utf8');var _0x357140=ejs[_0x2ab7('0x5a')](_0x50bb4d,{'networks':_0x44180f||[]});fs[_0x2ab7('0x54')](_0x2ab7('0x5b'),_0x357140);return respondWithRpcPromise('Reload',_0x2ab7('0x4d'),{'module':_0x2ab7('0x5c')});}else{var _0x5e7416=fs[_0x2ab7('0x5d')](path[_0x2ab7('0x58')](config['root'],_0x2ab7('0x5e')),_0x2ab7('0x53'));var _0x577d3b=ejs[_0x2ab7('0x5a')](_0x5e7416,{'networks':_0x44180f||[]});fs[_0x2ab7('0x54')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x268fe4['body']['type'][_0x2ab7('0x5f')]()),_0x577d3b);return respondWithRpcPromise('Reload',_0x2ab7('0x4d'),{'module':'chan_sip.so'});}return null;})['then'](function(){return _0x18304c;});})[_0x2ab7('0x1c')](respondWithResult(_0x13fbda,0xc9))[_0x2ab7('0x24')](handleError(_0x13fbda,null));};exports['update']=function(_0x20b8a0,_0x34d614,_0x2ab9ee){var _0x3a66e7;return db['sequelize'][_0x2ab7('0x4f')](function(_0xa191e1){return db[_0x2ab7('0x33')][_0x2ab7('0x4c')]({'where':{'id':_0x20b8a0[_0x2ab7('0x4a')]['id']}})[_0x2ab7('0x1c')](handleEntityNotFound(_0x34d614,null))[_0x2ab7('0x1c')](saveUpdates(_0x20b8a0[_0x2ab7('0x50')],null))[_0x2ab7('0x1c')](function(_0x46cd37){if(_0x46cd37){_0x3a66e7=_0x46cd37;return db[_0x2ab7('0x33')]['findAll']({'where':{'type':_0x3a66e7[_0x2ab7('0x36')]},'raw':!![]});}return null;})[_0x2ab7('0x1c')](function(_0x361132){if(_0x3a66e7[_0x2ab7('0x36')][_0x2ab7('0x56')]()==_0x2ab7('0x51')){var _0x5c096c=fs[_0x2ab7('0x5d')](path[_0x2ab7('0x58')](config[_0x2ab7('0x52')],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x5e695a=ejs[_0x2ab7('0x5a')](_0x5c096c,{'networks':_0x361132||[]});fs[_0x2ab7('0x54')](_0x2ab7('0x55'),_0x5e695a);return respondWithRpcPromise('Reload','update',{'module':_0x2ab7('0x5c')});}else if(_0x3a66e7[_0x2ab7('0x36')]['toUpperCase']()==_0x2ab7('0x57')){var _0x39c588=fs[_0x2ab7('0x5d')](path[_0x2ab7('0x58')](config[_0x2ab7('0x52')],_0x2ab7('0x59')),_0x2ab7('0x53'));var _0x207b3d=ejs[_0x2ab7('0x5a')](_0x39c588,{'networks':_0x361132||[]});fs[_0x2ab7('0x54')]('/etc/asterisk/turn_xcally.conf',_0x207b3d);return respondWithRpcPromise(_0x2ab7('0x60'),_0x2ab7('0x2d'),{'module':'res_stun_monitor.so'});}else{var _0x337be8=fs[_0x2ab7('0x5d')](path['join'](config[_0x2ab7('0x52')],_0x2ab7('0x5e')),'utf8');var _0x1703a6=ejs[_0x2ab7('0x5a')](_0x337be8,{'networks':_0x361132||[]});fs[_0x2ab7('0x54')](util[_0x2ab7('0x61')](_0x2ab7('0x62'),_0x20b8a0['body']['type'][_0x2ab7('0x5f')]()),_0x1703a6);return respondWithRpcPromise(_0x2ab7('0x60'),_0x2ab7('0x2d'),{'module':_0x2ab7('0x63')});}return null;})[_0x2ab7('0x1c')](function(_0x35cf9f){if(_0x35cf9f){return _0x3a66e7;}return null;});})[_0x2ab7('0x1c')](respondWithResult(_0x34d614,null))['catch'](handleError(_0x34d614,null));};exports['destroy']=function(_0x13fad7,_0x3daf0c,_0x199918){var _0x43b4a6;return db['Network'][_0x2ab7('0x4c')]({'where':{'id':_0x13fad7[_0x2ab7('0x4a')]['id']}})[_0x2ab7('0x1c')](function(_0x5d7216){_0x43b4a6=_0x5d7216;return _0x5d7216;})['then'](handleEntityNotFound(_0x3daf0c,null))[_0x2ab7('0x1c')](removeEntity(_0x3daf0c,null))['then'](function(){if(_0x43b4a6){return db[_0x2ab7('0x33')]['findAll']({'where':{'type':_0x43b4a6['type']},'raw':!![]});}})[_0x2ab7('0x1c')](function(_0x5de8cb){if(_0x43b4a6[_0x2ab7('0x36')][_0x2ab7('0x56')]()=='STUN'){var _0x4a047b=fs[_0x2ab7('0x5d')](path[_0x2ab7('0x58')](config[_0x2ab7('0x52')],_0x2ab7('0x64')),'utf8');var _0x5dc3b3=ejs['render'](_0x4a047b,{'networks':_0x5de8cb||[]});fs[_0x2ab7('0x54')](_0x2ab7('0x55'),_0x5dc3b3);return respondWithRpcPromise(_0x2ab7('0x60'),_0x2ab7('0x2e'),{'module':_0x2ab7('0x5c')});}else if(_0x43b4a6[_0x2ab7('0x36')][_0x2ab7('0x56')]()==_0x2ab7('0x57')){var _0x4feb32=fs['readFileSync'](path['join'](config[_0x2ab7('0x52')],_0x2ab7('0x59')),_0x2ab7('0x53'));var _0x527ec1=ejs['render'](_0x4feb32,{'networks':_0x5de8cb||[]});fs[_0x2ab7('0x54')](_0x2ab7('0x5b'),_0x527ec1);return respondWithRpcPromise('Reload',_0x2ab7('0x2e'),{'module':_0x2ab7('0x5c')});}else{var _0x429a70=fs[_0x2ab7('0x5d')](path[_0x2ab7('0x58')](config[_0x2ab7('0x52')],'server/files/templates/network.ejs'),_0x2ab7('0x53'));var _0x55a71e=ejs[_0x2ab7('0x5a')](_0x429a70,{'networks':_0x5de8cb||[]});fs['writeFileSync'](util[_0x2ab7('0x61')](_0x2ab7('0x62'),_0x13fad7[_0x2ab7('0x50')]['type'][_0x2ab7('0x5f')]()),_0x55a71e);return respondWithRpcPromise(_0x2ab7('0x60'),_0x2ab7('0x2e'),{'module':'chan_sip.so'});}return null;})[_0x2ab7('0x24')](handleError(_0x3daf0c,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 77675ef..374167d 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 _0xd8b0=['define','network','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4a0fb5,_0x52fdb9){var _0x412869=function(_0x52b155){while(--_0x52b155){_0x4a0fb5['push'](_0x4a0fb5['shift']());}};_0x412869(++_0x52fdb9);}(_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('./network.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('Network',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd547=['define','../../config/logger','api','moment','bluebird','rimraf','./network.attributes'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0xd547,0x1c1));var _0x7d54=function(_0x4b634f,_0x4c0372){_0x4b634f=_0x4b634f-0x0;var _0x302e3c=_0xd547[_0x4b634f];return _0x302e3c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7d54('0x0'))(_0x7d54('0x1'));var moment=require(_0x7d54('0x2'));var BPromise=require(_0x7d54('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7d54('0x4'));var config=require('../../config/environment');var attributes=require(_0x7d54('0x5'));module['exports']=function(_0x296dd6,_0x37defc){return _0x296dd6[_0x7d54('0x6')]('Network',attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index ba288b2..6fe5f29 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(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a54,0x106));var _0x47a5=function(_0x25c019,_0x1e4058){_0x25c019=_0x25c019-0x0;var _0x56681e=_0x7a54[_0x25c019];return _0x56681e;};'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 _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7a54,0x106));var _0x47a5=function(_0x5b6ab4,_0x54a146){_0x5b6ab4=_0x5b6ab4-0x0;var _0x142b92=_0x7a54[_0x5b6ab4];return _0x142b92;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index d25bce6..e9726ed 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 _0xaeeb=['/:id/send','put','delete','destroy','removeDispositions','removeAnswers','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getInteractions','/:id/users','getAgents','post','create','addAnswer','/:id/notify','/:id/applications','addApplications','addAgents'];(function(_0x62fdb8,_0xbfab9e){var _0x32f44e=function(_0x204bb8){while(--_0x204bb8){_0x62fdb8['push'](_0x62fdb8['shift']());}};_0x32f44e(++_0xbfab9e);}(_0xaeeb,0x14a));var _0xbaee=function(_0x2e725f,_0x4e8f74){_0x2e725f=_0x2e725f-0x0;var _0x3349db=_0xaeeb[_0x2e725f];return _0x3349db;};'use strict';var multer=require(_0xbaee('0x0'));var util=require(_0xbaee('0x1'));var path=require('path');var timeout=require(_0xbaee('0x2'));var express=require(_0xbaee('0x3'));var router=express[_0xbaee('0x4')]();var fs_extra=require(_0xbaee('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xbaee('0x6'));var config=require(_0xbaee('0x7'));var controller=require(_0xbaee('0x8'));router[_0xbaee('0x9')]('/',auth['isAuthenticated'](),controller[_0xbaee('0xa')]);router['get'](_0xbaee('0xb'),auth[_0xbaee('0xc')](),controller[_0xbaee('0xd')]);router['get'](_0xbaee('0xe'),auth[_0xbaee('0xc')](),controller[_0xbaee('0xf')]);router['get'](_0xbaee('0x10'),auth[_0xbaee('0xc')](),controller[_0xbaee('0x11')]);router[_0xbaee('0x9')](_0xbaee('0x12'),auth['isAuthenticated'](),controller[_0xbaee('0x13')]);router[_0xbaee('0x9')]('/:id/applications',auth['isAuthenticated'](),controller['getApplications']);router[_0xbaee('0x9')]('/:id/interactions',auth[_0xbaee('0xc')](),controller[_0xbaee('0x14')]);router[_0xbaee('0x9')](_0xbaee('0x15'),auth['isAuthenticated'](),controller[_0xbaee('0x16')]);router[_0xbaee('0x17')]('/',auth[_0xbaee('0xc')](),controller[_0xbaee('0x18')]);router[_0xbaee('0x17')](_0xbaee('0x10'),auth[_0xbaee('0xc')](),controller['addDisposition']);router[_0xbaee('0x17')](_0xbaee('0x12'),auth[_0xbaee('0xc')](),controller[_0xbaee('0x19')]);router[_0xbaee('0x17')](_0xbaee('0x1a'),controller['notify']);router[_0xbaee('0x17')](_0xbaee('0x1b'),auth[_0xbaee('0xc')](),controller[_0xbaee('0x1c')]);router[_0xbaee('0x17')](_0xbaee('0x15'),auth[_0xbaee('0xc')](),controller[_0xbaee('0x1d')]);router['post'](_0xbaee('0x1e'),auth[_0xbaee('0xc')](),controller['send']);router[_0xbaee('0x1f')](_0xbaee('0xe'),auth['isAuthenticated'](),controller['update']);router[_0xbaee('0x20')](_0xbaee('0xe'),auth[_0xbaee('0xc')](),controller[_0xbaee('0x21')]);router['delete'](_0xbaee('0x10'),auth[_0xbaee('0xc')](),controller[_0xbaee('0x22')]);router[_0xbaee('0x20')](_0xbaee('0x12'),auth[_0xbaee('0xc')](),controller[_0xbaee('0x23')]);router[_0xbaee('0x20')]('/:id/users',auth[_0xbaee('0xc')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x1270=['delete','removeAnswers','removeAgents','exports','multer','util','fs-extra','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','getInteractions','/:id/users','getAgents','create','post','addDisposition','addAnswer','/:id/notify','addAgents','/:id/send','send','put','update','destroy'];(function(_0x10476d,_0x5b124b){var _0xae5230=function(_0x2bc337){while(--_0x2bc337){_0x10476d['push'](_0x10476d['shift']());}};_0xae5230(++_0x5b124b);}(_0x1270,0x151));var _0x0127=function(_0x2ca840,_0x1f6d0c){_0x2ca840=_0x2ca840-0x0;var _0xa068b=_0x1270[_0x2ca840];return _0xa068b;};'use strict';var multer=require(_0x0127('0x0'));var util=require(_0x0127('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x0127('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x0127('0x3'));var config=require(_0x0127('0x4'));var controller=require(_0x0127('0x5'));router[_0x0127('0x6')]('/',auth['isAuthenticated'](),controller[_0x0127('0x7')]);router[_0x0127('0x6')](_0x0127('0x8'),auth[_0x0127('0x9')](),controller[_0x0127('0xa')]);router['get'](_0x0127('0xb'),auth[_0x0127('0x9')](),controller[_0x0127('0xc')]);router[_0x0127('0x6')](_0x0127('0xd'),auth['isAuthenticated'](),controller[_0x0127('0xe')]);router[_0x0127('0x6')](_0x0127('0xf'),auth['isAuthenticated'](),controller[_0x0127('0x10')]);router[_0x0127('0x6')](_0x0127('0x11'),auth[_0x0127('0x9')](),controller[_0x0127('0x12')]);router[_0x0127('0x6')]('/:id/interactions',auth[_0x0127('0x9')](),controller[_0x0127('0x13')]);router[_0x0127('0x6')](_0x0127('0x14'),auth[_0x0127('0x9')](),controller[_0x0127('0x15')]);router['post']('/',auth[_0x0127('0x9')](),controller[_0x0127('0x16')]);router[_0x0127('0x17')]('/:id/dispositions',auth[_0x0127('0x9')](),controller[_0x0127('0x18')]);router['post'](_0x0127('0xf'),auth['isAuthenticated'](),controller[_0x0127('0x19')]);router[_0x0127('0x17')](_0x0127('0x1a'),controller['notify']);router[_0x0127('0x17')]('/:id/applications',auth[_0x0127('0x9')](),controller['addApplications']);router[_0x0127('0x17')]('/:id/users',auth[_0x0127('0x9')](),controller[_0x0127('0x1b')]);router['post'](_0x0127('0x1c'),auth[_0x0127('0x9')](),controller[_0x0127('0x1d')]);router[_0x0127('0x1e')](_0x0127('0xb'),auth[_0x0127('0x9')](),controller[_0x0127('0x1f')]);router['delete']('/:id',auth[_0x0127('0x9')](),controller[_0x0127('0x20')]);router[_0x0127('0x21')]('/:id/dispositions',auth[_0x0127('0x9')](),controller['removeDispositions']);router[_0x0127('0x21')](_0x0127('0xf'),auth[_0x0127('0x9')](),controller[_0x0127('0x22')]);router[_0x0127('0x21')](_0x0127('0x14'),auth[_0x0127('0x9')](),controller[_0x0127('0x23')]);module[_0x0127('0x24')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 11938e4..348a9d7 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 _0xf5db=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','STRING','generate','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER'];(function(_0x4e7dd7,_0x3e7134){var _0x4f4461=function(_0x17aabb){while(--_0x17aabb){_0x4e7dd7['push'](_0x4e7dd7['shift']());}};_0x4f4461(++_0x3e7134);}(_0xf5db,0x1a7));var _0xbf5d=function(_0x3bda15,_0x2a1cae){_0x3bda15=_0x3bda15-0x0;var _0x129f06=_0xf5db[_0x3bda15];return _0x129f06;};'use strict';var Sequelize=require(_0xbf5d('0x0'));var rs=require(_0xbf5d('0x1'));module['exports']={'name':{'type':Sequelize[_0xbf5d('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xbf5d('0x2')],'defaultValue':function(){return rs[_0xbf5d('0x3')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xbf5d('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xbf5d('0x4');}},'notificationSound':{'type':Sequelize[_0xbf5d('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xbf5d('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xbf5d('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xbf5d('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xbf5d('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xbf5d('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbf5d('0x6')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xbf5d('0x5')],'defaultValue':![],'comment':_0xbf5d('0x7'),'set':function(_0x150f7f){if(!_0x150f7f)this[_0xbf5d('0x8')](_0xbf5d('0x9'),null);this[_0xbf5d('0x8')]('mandatoryDisposition',_0x150f7f);}}}; \ No newline at end of file +var _0x5a64=['mandatoryDisposition','sequelize','name','STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x5a64,0x1a3));var _0x45a6=function(_0x55b44e,_0x2ada22){_0x55b44e=_0x55b44e-0x0;var _0x1d3822=_0x5a64[_0x55b44e];return _0x1d3822;};'use strict';var Sequelize=require(_0x45a6('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x45a6('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0x45a6('0x2')]},'token':{'type':Sequelize[_0x45a6('0x2')],'defaultValue':function(){return rs[_0x45a6('0x3')]();}},'replyUri':{'type':Sequelize[_0x45a6('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x45a6('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x45a6('0x4')],'defaultValue':function(){return _0x45a6('0x5');}},'notificationSound':{'type':Sequelize[_0x45a6('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x45a6('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0x45a6('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x45a6('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x45a6('0x6')],'defaultValue':![],'comment':_0x45a6('0x8'),'set':function(_0x2f5952){if(!_0x2f5952)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x45a6('0x9')](_0x45a6('0xa'),_0x2f5952);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 5ea93ca..caa7e7e 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 _0x692c=['addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','Sequelize','ValidationError','no\x20available\x20attributes','updatedAt','difference','CompanyId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','List','DESC','OpenchannelApplication','Applications','account','applications','orderBy','priority','Contacts','ListId','CmContact','firstName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','contact','lastName','messageId','interaction','created','push','close','unmanaged','AttachmentId','UserId','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','EventManager','bulkCreate','findAndCountAll','getApplications','getInteractions','User','Owner','fullname','internal','Tag','Tags','tag','addAgents','omit','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','OpenchannelMessage','dataValues','Messages','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','http','client','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','status','end','undefined','limit','count','offset','Content-Range','json','save','update','get','UserProfileResource','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','filter','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','user','role','OpenchannelAccounts','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','sort','pick','removeDispositions','ids'];(function(_0x2a7678,_0x12e86e){var _0xcbef37=function(_0x5cc667){while(--_0x5cc667){_0x2a7678['push'](_0x2a7678['shift']());}};_0xcbef37(++_0x12e86e);}(_0x692c,0x1bb));var _0xc692=function(_0x3ce692,_0x491ea9){_0x3ce692=_0x3ce692-0x0;var _0x5307f3=_0x692c[_0x3ce692];return _0x5307f3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc692('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc692('0x1'));var BPromise=require(_0xc692('0x2'));var Mustache=require(_0xc692('0x3'));var util=require(_0xc692('0x4'));var path=require(_0xc692('0x5'));var sox=require(_0xc692('0x6'));var csv=require(_0xc692('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc692('0x8'));var _=require(_0xc692('0x9'));var squel=require(_0xc692('0xa'));var crypto=require(_0xc692('0xb'));var jsforce=require(_0xc692('0xc'));var deskjs=require(_0xc692('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc692('0xe'));var authService=require(_0xc692('0xf'));var qs=require(_0xc692('0x10'));var as=require(_0xc692('0x11'));var hardwareService=require(_0xc692('0x12'));var logger=require(_0xc692('0x13'))(_0xc692('0x14'));var utils=require(_0xc692('0x15'));var config=require(_0xc692('0x16'));var licenseUtil=require(_0xc692('0x17'));var db=require(_0xc692('0x18'))['db'];config['redis']=_[_0xc692('0x19')](config[_0xc692('0x1a')],{'host':_0xc692('0x1b'),'port':0x18eb});var socket=require(_0xc692('0x1c'))(new Redis(config[_0xc692('0x1a')]));require(_0xc692('0x1d'))[_0xc692('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xc692('0x1f')]({'port':0x232c});var client9002=jayson[_0xc692('0x20')][_0xc692('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x1dcda0,_0x2e933a,_0x4d6b1e,_0x1a5f06){return new BPromise(function(_0x54c37,_0x3c0604){var _0x333d00=_0x1a5f06||client;return _0x333d00[_0xc692('0x21')](_0x1dcda0,_0x4d6b1e)[_0xc692('0x22')](function(_0x1229c9){logger[_0xc692('0x23')](_0xc692('0x24'),_0x2e933a,_0xc692('0x25'));logger[_0xc692('0x26')](_0xc692('0x27'),_0x2e933a,'request\x20sent',JSON['stringify'](_0x1229c9));if(_0x1229c9[_0xc692('0x28')]){if(_0x1229c9[_0xc692('0x28')][_0xc692('0x29')]===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x2e933a,_0x1229c9[_0xc692('0x28')][_0xc692('0x2a')]);return _0x3c0604(_0x1229c9[_0xc692('0x28')][_0xc692('0x2a')]);}logger['error'](_0xc692('0x24'),_0x2e933a,_0x1229c9[_0xc692('0x28')]['message']);return _0x54c37(_0x1229c9['error'][_0xc692('0x2a')]);}else{logger[_0xc692('0x23')]('OpenchannelAccount,\x20%s,\x20%s',_0x2e933a,_0xc692('0x25'));_0x54c37(_0x1229c9['result']['message']);}})['catch'](function(_0x13366f){logger['error'](_0xc692('0x24'),_0x2e933a,_0x13366f);_0x3c0604(_0x13366f);});});}function respondWithStatusCode(_0x3021d4,_0x4beef9){_0x4beef9=_0x4beef9||0xcc;return function(_0x5ba625){if(_0x5ba625){return _0x3021d4['sendStatus'](_0x4beef9);}return _0x3021d4[_0xc692('0x2b')](_0x4beef9)[_0xc692('0x2c')]();};}function respondWithResult(_0x411f29,_0x19ca87){_0x19ca87=_0x19ca87||0xc8;return function(_0x47e6f8){if(_0x47e6f8){return _0x411f29['status'](_0x19ca87)['json'](_0x47e6f8);}};}function respondWithFilteredResult(_0x566683,_0x30be97){return function(_0x5b488a){if(_0x5b488a){var _0x5c1fa2=typeof _0x30be97['offset']===_0xc692('0x2d')&&typeof _0x30be97[_0xc692('0x2e')]===_0xc692('0x2d');var _0x35ebfc=_0x5b488a[_0xc692('0x2f')];var _0x254bcb=_0x5c1fa2?0x0:_0x30be97[_0xc692('0x30')];var _0x5bf375=_0x5c1fa2?_0x5b488a[_0xc692('0x2f')]:_0x30be97[_0xc692('0x30')]+_0x30be97[_0xc692('0x2e')];var _0x2609e7;if(_0x5bf375>=_0x35ebfc){_0x5bf375=_0x35ebfc;_0x2609e7=0xc8;}else{_0x2609e7=0xce;}_0x566683[_0xc692('0x2b')](_0x2609e7);return _0x566683['set'](_0xc692('0x31'),_0x254bcb+'-'+_0x5bf375+'/'+_0x35ebfc)[_0xc692('0x32')](_0x5b488a);}return null;};}function patchUpdates(_0x561adb){return function(_0x249089){try{jsonpatch['apply'](_0x249089,_0x561adb,!![]);}catch(_0x3156a5){return BPromise['reject'](_0x3156a5);}return _0x249089[_0xc692('0x33')]();};}function saveUpdates(_0x5c2760,_0x6f42e4){return function(_0x3b51c3){if(_0x3b51c3){return _0x3b51c3[_0xc692('0x34')](_0x5c2760)[_0xc692('0x22')](function(_0x11d87e){return _0x11d87e;});}return null;};}function removeEntity(_0xa0ee42,_0x585668){return function(_0x18e500){if(_0x18e500){return _0x18e500['destroy']()[_0xc692('0x22')](function(){var _0x3765c4=_0x18e500[_0xc692('0x35')]({'plain':!![]});var _0x5c09fc='OpenchannelAccounts';return db[_0xc692('0x36')][_0xc692('0x37')]({'where':{'type':_0x5c09fc,'resourceId':_0x3765c4['id']}})[_0xc692('0x22')](function(){return _0x18e500;});})[_0xc692('0x22')](function(){_0xa0ee42[_0xc692('0x2b')](0xcc)[_0xc692('0x2c')]();});}};}function handleEntityNotFound(_0x2bedc7,_0x174b5c){return function(_0x2721ad){if(!_0x2721ad){_0x2bedc7['sendStatus'](0x194);}return _0x2721ad;};}function handleError(_0x3c2f48,_0x4256c0){_0x4256c0=_0x4256c0||0x1f4;return function(_0x4ddeab){logger[_0xc692('0x28')](_0x4ddeab[_0xc692('0x38')]);if(_0x4ddeab[_0xc692('0x39')]){delete _0x4ddeab[_0xc692('0x39')];}_0x3c2f48[_0xc692('0x2b')](_0x4256c0)[_0xc692('0x3a')](_0x4ddeab);};}exports[_0xc692('0x3b')]=function(_0xb98436,_0x3dc03c){var _0x503038={'include':[{'model':db[_0xc692('0x3c')],'as':_0xc692('0x3d')}]},_0x33d5d4={},_0x404e74={'count':0x0,'rows':[]};var _0x52d8c8=_[_0xc692('0x3e')](db[_0xc692('0x3f')][_0xc692('0x40')],function(_0x275647){return{'name':_0x275647[_0xc692('0x41')],'type':_0x275647[_0xc692('0x42')][_0xc692('0x43')]};});_0x33d5d4[_0xc692('0x44')]=_[_0xc692('0x3e')](_0x52d8c8,_0xc692('0x39'));_0x33d5d4[_0xc692('0x45')]=_[_0xc692('0x46')](_0xb98436[_0xc692('0x45')]);_0x33d5d4[_0xc692('0x47')]=_[_0xc692('0x48')](_0x33d5d4[_0xc692('0x44')],_0x33d5d4[_0xc692('0x45')]);_0x503038['attributes']=_[_0xc692('0x48')](_0x33d5d4[_0xc692('0x44')],qs[_0xc692('0x49')](_0xb98436[_0xc692('0x45')][_0xc692('0x49')]));_0x503038[_0xc692('0x4a')]=_0x503038['attributes'][_0xc692('0x4b')]?_0x503038[_0xc692('0x4a')]:_0x33d5d4[_0xc692('0x44')];if(!_0xb98436[_0xc692('0x45')][_0xc692('0x4c')](_0xc692('0x4d'))){_0x503038[_0xc692('0x2e')]=qs[_0xc692('0x2e')](_0xb98436[_0xc692('0x45')][_0xc692('0x2e')]);_0x503038['offset']=qs[_0xc692('0x30')](_0xb98436['query'][_0xc692('0x30')]);}_0x503038[_0xc692('0x4e')]=qs['sort'](_0xb98436['query']['sort']);_0x503038[_0xc692('0x4f')]=qs['filters'](_['pick'](_0xb98436[_0xc692('0x45')],_0x33d5d4[_0xc692('0x47')]),_0x52d8c8);if(_0xb98436[_0xc692('0x45')][_0xc692('0x50')]){_0x503038[_0xc692('0x4f')]=_[_0xc692('0x51')](_0x503038['where'],{'$or':_[_0xc692('0x3e')](_0x52d8c8,function(_0x6851e1){if(_0x6851e1[_0xc692('0x42')]!=='VIRTUAL'){var _0x189f5a={};_0x189f5a[_0x6851e1[_0xc692('0x39')]]={'$like':'%'+_0xb98436[_0xc692('0x45')]['filter']+'%'};return _0x189f5a;}})});}_0x503038=_[_0xc692('0x51')]({},_0x503038,_0xb98436[_0xc692('0x52')]);var _0x45fa95={'where':_0x503038[_0xc692('0x4f')]};return db[_0xc692('0x3f')][_0xc692('0x2f')](_0x45fa95)['then'](function(_0x4e8d03){_0x404e74[_0xc692('0x2f')]=_0x4e8d03;if(_0xb98436[_0xc692('0x45')][_0xc692('0x53')]){_0x503038['include']=[{'all':!![]}];}return db[_0xc692('0x3f')][_0xc692('0x54')](_0x503038);})[_0xc692('0x22')](function(_0x2ed11a){_0x404e74[_0xc692('0x55')]=_0x2ed11a;return _0x404e74;})[_0xc692('0x22')](respondWithFilteredResult(_0x3dc03c,_0x503038))[_0xc692('0x56')](handleError(_0x3dc03c,null));};exports[_0xc692('0x57')]=function(_0x466c35,_0x86aad1){var _0x1ee49b={'raw':![],'where':{'id':_0x466c35[_0xc692('0x58')]['id']},'include':[{'model':db[_0xc692('0x3c')],'as':'mandatoryDispositionPause'}]},_0xd7bfc5={};_0xd7bfc5[_0xc692('0x44')]=_[_0xc692('0x46')](db['OpenchannelAccount'][_0xc692('0x40')]);_0xd7bfc5[_0xc692('0x45')]=_[_0xc692('0x46')](_0x466c35[_0xc692('0x45')]);_0xd7bfc5['filters']=_['intersection'](_0xd7bfc5['model'],_0xd7bfc5[_0xc692('0x45')]);_0x1ee49b[_0xc692('0x4a')]=_[_0xc692('0x48')](_0xd7bfc5[_0xc692('0x44')],qs[_0xc692('0x49')](_0x466c35[_0xc692('0x45')][_0xc692('0x49')]));_0x1ee49b[_0xc692('0x4a')]=_0x1ee49b[_0xc692('0x4a')][_0xc692('0x4b')]?_0x1ee49b[_0xc692('0x4a')]:_0xd7bfc5[_0xc692('0x44')];if(_0x466c35[_0xc692('0x45')][_0xc692('0x53')]){_0x1ee49b[_0xc692('0x59')]=[{'all':!![]}];}_0x1ee49b=_['merge']({},_0x1ee49b,_0x466c35[_0xc692('0x52')]);return db[_0xc692('0x3f')][_0xc692('0x5a')](_0x1ee49b)[_0xc692('0x22')](handleEntityNotFound(_0x86aad1,null))['then'](respondWithResult(_0x86aad1,null))[_0xc692('0x56')](handleError(_0x86aad1,null));};exports[_0xc692('0x5b')]=function(_0x40d630,_0x5d198e){return db[_0xc692('0x3f')][_0xc692('0x5b')](_0x40d630[_0xc692('0x5c')],{})[_0xc692('0x22')](function(_0x1ce4c8){var _0x5580b5=_0x40d630[_0xc692('0x5d')][_0xc692('0x35')]({'plain':!![]});if(!_0x5580b5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5580b5[_0xc692('0x5e')]===_0xc692('0x5d')){var _0x1af56f=_0x1ce4c8[_0xc692('0x35')]({'plain':!![]});var _0x47d388=_0xc692('0x5f');return db[_0xc692('0x60')]['find']({'where':{'name':_0x47d388,'userProfileId':_0x5580b5['userProfileId']},'raw':!![]})['then'](function(_0x2c4e52){if(_0x2c4e52&&_0x2c4e52[_0xc692('0x61')]===0x0){return db[_0xc692('0x36')][_0xc692('0x5b')]({'name':_0x1af56f[_0xc692('0x39')],'resourceId':_0x1af56f['id'],'type':_0x2c4e52[_0xc692('0x39')],'sectionId':_0x2c4e52['id']},{})[_0xc692('0x22')](function(){return _0x1ce4c8;});}else{return _0x1ce4c8;}})[_0xc692('0x56')](function(_0x2e7b6c){logger[_0xc692('0x28')](_0xc692('0x62'),_0x2e7b6c);throw _0x2e7b6c;});}return _0x1ce4c8;})[_0xc692('0x22')](respondWithResult(_0x5d198e,0xc9))[_0xc692('0x56')](handleError(_0x5d198e,null));};exports[_0xc692('0x34')]=function(_0x2b06d5,_0x39b818){if(_0x2b06d5[_0xc692('0x5c')]['id']){delete _0x2b06d5[_0xc692('0x5c')]['id'];}return db[_0xc692('0x3f')][_0xc692('0x5a')]({'where':{'id':_0x2b06d5[_0xc692('0x58')]['id']},'include':[{'model':db[_0xc692('0x3c')],'as':_0xc692('0x3d')}]})['then'](handleEntityNotFound(_0x39b818,null))[_0xc692('0x22')](saveUpdates(_0x2b06d5[_0xc692('0x5c')],null))[_0xc692('0x22')](respondWithResult(_0x39b818,null))[_0xc692('0x56')](handleError(_0x39b818,null));};exports[_0xc692('0x37')]=function(_0x106831,_0x262791){return db[_0xc692('0x3f')][_0xc692('0x5a')]({'where':{'id':_0x106831['params']['id']}})['then'](handleEntityNotFound(_0x262791,null))[_0xc692('0x22')](removeEntity(_0x262791,null))[_0xc692('0x56')](handleError(_0x262791,null));};exports[_0xc692('0x63')]=function(_0x3923bb,_0x39487e){return db[_0xc692('0x3f')][_0xc692('0x63')]()[_0xc692('0x22')](respondWithResult(_0x39487e,null))[_0xc692('0x56')](handleError(_0x39487e,null));};exports[_0xc692('0x64')]=function(_0x4681e3,_0x32be17,_0x42fe68){if(_0x4681e3[_0xc692('0x5c')]['id']){delete _0x4681e3['body']['id'];}return db[_0xc692('0x3f')][_0xc692('0x5a')]({'where':{'id':_0x4681e3['params']['id']}})[_0xc692('0x22')](handleEntityNotFound(_0x32be17,null))[_0xc692('0x22')](function(_0x52c57d){if(_0x52c57d){_0x4681e3[_0xc692('0x5c')][_0xc692('0x65')]=_0x52c57d['id'];return db[_0xc692('0x66')][_0xc692('0x5b')](_0x4681e3['body']);}})['then'](respondWithResult(_0x32be17,null))[_0xc692('0x56')](handleError(_0x32be17,null));};exports[_0xc692('0x67')]=function(_0x20ffd0,_0x3ef263,_0x4034f7){var _0x106b4d={'raw':![],'where':{}};var _0x394b52={};var _0x2fe245={'count':0x0,'rows':[]};return db[_0xc692('0x3f')][_0xc692('0x68')]({'where':{'id':_0x20ffd0['params']['id']}})[_0xc692('0x22')](handleEntityNotFound(_0x3ef263,null))[_0xc692('0x22')](function(_0x101926){if(_0x101926){_0x394b52[_0xc692('0x44')]=_['keys'](db['Disposition']['rawAttributes']);_0x394b52[_0xc692('0x45')]=_[_0xc692('0x46')](_0x20ffd0[_0xc692('0x45')]);_0x394b52[_0xc692('0x47')]=_[_0xc692('0x48')](_0x394b52[_0xc692('0x44')],_0x394b52[_0xc692('0x45')]);_0x106b4d[_0xc692('0x4a')]=_[_0xc692('0x48')](_0x394b52[_0xc692('0x44')],qs[_0xc692('0x49')](_0x20ffd0[_0xc692('0x45')][_0xc692('0x49')]));_0x106b4d['attributes']=_0x106b4d[_0xc692('0x4a')]['length']?_0x106b4d[_0xc692('0x4a')]:_0x394b52[_0xc692('0x44')];if(!_0x20ffd0[_0xc692('0x45')]['hasOwnProperty'](_0xc692('0x4d'))){_0x106b4d[_0xc692('0x2e')]=qs['limit'](_0x20ffd0[_0xc692('0x45')][_0xc692('0x2e')]);_0x106b4d[_0xc692('0x30')]=qs[_0xc692('0x30')](_0x20ffd0['query'][_0xc692('0x30')]);}_0x106b4d[_0xc692('0x4e')]=qs['sort'](_0x20ffd0[_0xc692('0x45')][_0xc692('0x69')]);_0x106b4d['where']=qs[_0xc692('0x47')](_[_0xc692('0x6a')](_0x20ffd0[_0xc692('0x45')],_0x394b52[_0xc692('0x47')]));_0x106b4d['where'][_0xc692('0x65')]=_0x101926['id'];if(_0x20ffd0['query']['filter']){_0x106b4d[_0xc692('0x4f')]=_['merge'](_0x106b4d[_0xc692('0x4f')],{'$or':_[_0xc692('0x3e')](_0x106b4d[_0xc692('0x4a')],function(_0x179a1e){var _0x434d8d={};_0x434d8d[_0x179a1e]={'$like':'%'+_0x20ffd0[_0xc692('0x45')][_0xc692('0x50')]+'%'};return _0x434d8d;})});}_0x106b4d=_[_0xc692('0x51')]({},_0x106b4d,_0x20ffd0[_0xc692('0x52')]);return db[_0xc692('0x66')]['count']({'where':_0x106b4d[_0xc692('0x4f')]})[_0xc692('0x22')](function(_0x3a3917){_0x2fe245[_0xc692('0x2f')]=_0x3a3917;if(_0x20ffd0['query'][_0xc692('0x53')]){_0x106b4d[_0xc692('0x59')]=[{'all':!![]}];}return db[_0xc692('0x66')][_0xc692('0x54')](_0x106b4d);})['then'](function(_0x3779d8){_0x2fe245[_0xc692('0x55')]=_0x3779d8;return _0x2fe245;});}})[_0xc692('0x22')](respondWithFilteredResult(_0x3ef263,_0x106b4d))['catch'](handleError(_0x3ef263,null));};exports[_0xc692('0x6b')]=function(_0x1e40c5,_0x1dfa9b,_0x44579a){return db['OpenchannelAccount'][_0xc692('0x5a')]({'where':{'id':_0x1e40c5[_0xc692('0x58')]['id']}})[_0xc692('0x22')](handleEntityNotFound(_0x1dfa9b,null))[_0xc692('0x22')](function(_0x3b5730){if(_0x3b5730){return _0x3b5730[_0xc692('0x6b')](_0x1e40c5[_0xc692('0x45')][_0xc692('0x6c')]);}})[_0xc692('0x22')](respondWithStatusCode(_0x1dfa9b,null))[_0xc692('0x56')](handleError(_0x1dfa9b,null));};exports[_0xc692('0x6d')]=function(_0xcafe44,_0x26835e,_0x56d439){if(_0xcafe44['body']['id']){delete _0xcafe44['body']['id'];}return db[_0xc692('0x3f')][_0xc692('0x5a')]({'where':{'id':_0xcafe44[_0xc692('0x58')]['id']}})[_0xc692('0x22')](handleEntityNotFound(_0x26835e,null))[_0xc692('0x22')](function(_0x12b6f3){if(_0x12b6f3){_0xcafe44['body'][_0xc692('0x65')]=_0x12b6f3['id'];return db[_0xc692('0x6e')][_0xc692('0x5b')](_0xcafe44[_0xc692('0x5c')]);}})[_0xc692('0x22')](respondWithResult(_0x26835e,null))[_0xc692('0x56')](handleError(_0x26835e,null));};exports[_0xc692('0x6f')]=function(_0x567257,_0x11a0d4,_0x559e09){var _0x371743={'raw':![],'where':{}};var _0x4e15bd={};var _0xbb6c35={'count':0x0,'rows':[]};return db[_0xc692('0x3f')]['findOne']({'where':{'id':_0x567257[_0xc692('0x58')]['id']}})[_0xc692('0x22')](handleEntityNotFound(_0x11a0d4,null))['then'](function(_0x41acf4){if(_0x41acf4){_0x4e15bd[_0xc692('0x44')]=_['keys'](db['CannedAnswer'][_0xc692('0x40')]);_0x4e15bd['query']=_['keys'](_0x567257[_0xc692('0x45')]);_0x4e15bd['filters']=_['intersection'](_0x4e15bd[_0xc692('0x44')],_0x4e15bd[_0xc692('0x45')]);_0x371743[_0xc692('0x4a')]=_[_0xc692('0x48')](_0x4e15bd[_0xc692('0x44')],qs['fields'](_0x567257[_0xc692('0x45')][_0xc692('0x49')]));_0x371743[_0xc692('0x4a')]=_0x371743[_0xc692('0x4a')][_0xc692('0x4b')]?_0x371743[_0xc692('0x4a')]:_0x4e15bd['model'];if(!_0x567257['query'][_0xc692('0x4c')](_0xc692('0x4d'))){_0x371743[_0xc692('0x2e')]=qs[_0xc692('0x2e')](_0x567257[_0xc692('0x45')][_0xc692('0x2e')]);_0x371743[_0xc692('0x30')]=qs[_0xc692('0x30')](_0x567257[_0xc692('0x45')][_0xc692('0x30')]);}_0x371743[_0xc692('0x4e')]=qs[_0xc692('0x69')](_0x567257[_0xc692('0x45')][_0xc692('0x69')]);_0x371743[_0xc692('0x4f')]=qs[_0xc692('0x47')](_['pick'](_0x567257[_0xc692('0x45')],_0x4e15bd[_0xc692('0x47')]));_0x371743[_0xc692('0x4f')]['OpenchannelAccountId']=_0x41acf4['id'];if(_0x567257['query'][_0xc692('0x50')]){_0x371743[_0xc692('0x4f')]=_['merge'](_0x371743['where'],{'$or':_['map'](_0x371743[_0xc692('0x4a')],function(_0x4caef2){var _0x5240b8={};_0x5240b8[_0x4caef2]={'$like':'%'+_0x567257[_0xc692('0x45')][_0xc692('0x50')]+'%'};return _0x5240b8;})});}_0x371743=_['merge']({},_0x371743,_0x567257[_0xc692('0x52')]);return db[_0xc692('0x6e')][_0xc692('0x2f')]({'where':_0x371743[_0xc692('0x4f')]})[_0xc692('0x22')](function(_0x3880af){_0xbb6c35[_0xc692('0x2f')]=_0x3880af;if(_0x567257[_0xc692('0x45')][_0xc692('0x53')]){_0x371743[_0xc692('0x59')]=[{'all':!![]}];}return db['CannedAnswer'][_0xc692('0x54')](_0x371743);})['then'](function(_0x547242){_0xbb6c35[_0xc692('0x55')]=_0x547242;return _0xbb6c35;});}})['then'](respondWithFilteredResult(_0x11a0d4,_0x371743))[_0xc692('0x56')](handleError(_0x11a0d4,null));};exports[_0xc692('0x70')]=function(_0x232e2a,_0x251d7d,_0x5f1e9a){return db[_0xc692('0x3f')][_0xc692('0x5a')]({'where':{'id':_0x232e2a[_0xc692('0x58')]['id']}})['then'](handleEntityNotFound(_0x251d7d,null))[_0xc692('0x22')](function(_0x5bd396){if(_0x5bd396){return _0x5bd396[_0xc692('0x70')](_0x232e2a[_0xc692('0x45')]['ids']);}})[_0xc692('0x22')](respondWithStatusCode(_0x251d7d,null))[_0xc692('0x56')](handleError(_0x251d7d,null));};exports[_0xc692('0x71')]=function(_0x29325c,_0x275eae,_0x5de786){var _0x2fcb49={'body':_0x29325c[_0xc692('0x5c')],'channel':_0xc692('0x72')};var _0x47aa2c=[];var _0x4de215=[];var _0xf7efd3={};var _0x56ad5a=![];return db['CmContact'][_0xc692('0x63')]()[_0xc692('0x22')](function(_0x6ef90d){if(!_0x6ef90d){throw new db[(_0xc692('0x73'))][(_0xc692('0x74'))](_0xc692('0x75'));}_0x47aa2c=_['difference'](_[_0xc692('0x46')](_0x6ef90d),['createdAt',_0xc692('0x76')]);_0x4de215=_[_0xc692('0x77')](_[_0xc692('0x46')](_0x6ef90d),['createdAt',_0xc692('0x76'),_0xc692('0x78'),'ListId']);if(_0x29325c['body']['id']){delete _0x29325c[_0xc692('0x5c')]['id'];}if(_[_0xc692('0x79')](_0x29325c[_0xc692('0x5c')][_0xc692('0x7a')])){throw new db[(_0xc692('0x73'))][(_0xc692('0x74'))](_0xc692('0x7b'));}if(_[_0xc692('0x79')](_0x29325c['body']['body'])||_0x29325c[_0xc692('0x5c')][_0xc692('0x5c')]===''){throw new db[(_0xc692('0x73'))][(_0xc692('0x74'))](_0xc692('0x7c'));}if(_[_0xc692('0x79')](_0x29325c['body'][_0xc692('0x7d')])){throw new db['Sequelize'][(_0xc692('0x74'))](_0xc692('0x7e')+_0x4de215);}if(!_[_0xc692('0x7f')](_0x4de215,_0x29325c[_0xc692('0x5c')][_0xc692('0x7d')])){throw new db['Sequelize'][(_0xc692('0x74'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4de215);}_0xf7efd3[_0x29325c[_0xc692('0x5c')][_0xc692('0x7d')]]=_0x29325c[_0xc692('0x5c')]['from'];})[_0xc692('0x22')](function(){return db[_0xc692('0x3f')][_0xc692('0x5a')]({'where':{'id':_0x29325c['params']['id']},'include':[{'model':db[_0xc692('0x80')],'as':_0xc692('0x81'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0xf7efd3,'limit':0x1,'order':[[_0xc692('0x76'),_0xc692('0x82')]]}]},{'model':db[_0xc692('0x83')],'as':_0xc692('0x84')}]});})[_0xc692('0x22')](handleEntityNotFound(_0x275eae,null))[_0xc692('0x22')](function(_0x298112){if(_0x298112&&_0x298112[_0xc692('0x81')]){_0x2fcb49[_0xc692('0x85')]=_0x298112;_0x2fcb49['applications']=_0x298112['Applications'];_0x2fcb49['list']=_0x298112[_0xc692('0x81')];_0x2fcb49[_0xc692('0x86')]=_[_0xc692('0x87')](_0x2fcb49[_0xc692('0x86')],[_0xc692('0x88')],['asc']);if(_0x2fcb49[_0xc692('0x85')][_0xc692('0x84')]){delete _0x2fcb49[_0xc692('0x85')][_0xc692('0x84')];}if(_0x2fcb49['account']['List']&&_0x2fcb49[_0xc692('0x85')][_0xc692('0x81')]['Contacts'][_0xc692('0x4b')]){return _0x2fcb49[_0xc692('0x85')]['List'][_0xc692('0x89')][0x0];}var _0x66b519=_[_0xc692('0x19')](_0x29325c[_0xc692('0x5c')],{'firstName':_0x29325c['body'][_0xc692('0x7a')],'ListId':_0x298112[_0xc692('0x8a')]});_0x66b519[_0x29325c[_0xc692('0x5c')][_0xc692('0x7d')]]=_0x29325c[_0xc692('0x5c')][_0xc692('0x7a')];return db[_0xc692('0x8b')][_0xc692('0x5b')](_0x66b519,{'fields':_0x47aa2c,'raw':!![]});}})[_0xc692('0x22')](handleEntityNotFound(_0x275eae,null))['then'](function(_0x50405c){_0x2fcb49['contact']=_0x50405c;if(_0x50405c){var _0x52e3e8={'ContactId':_0x50405c['id'],'OpenchannelAccountId':_0x29325c['params']['id'],'from':(_0x50405c[_0xc692('0x8c')]||'')+'\x20'+(_0x50405c['lastName']||'')};var _0x262e49={'OpenchannelAccountId':_0x29325c[_0xc692('0x58')]['id'],'closed':![]};if(_0x29325c[_0xc692('0x5c')]['threadId']){_0x262e49[_0xc692('0x8d')]=_0x29325c[_0xc692('0x5c')][_0xc692('0x8d')];return db[_0xc692('0x8e')][_0xc692('0x5a')]({'where':_0x262e49})[_0xc692('0x22')](function(_0x47fad3){if(_0x47fad3){return[_0x47fad3,![]];}_0x52e3e8[_0xc692('0x8d')]=_0x29325c[_0xc692('0x5c')][_0xc692('0x8d')];_0x52e3e8[_0xc692('0x8f')]=_0x29325c[_0xc692('0x5c')]['externalUrl'];return db[_0xc692('0x8e')][_0xc692('0x5b')](_0x52e3e8)[_0xc692('0x22')](function(_0x1fd09a){return[_0x1fd09a,!![]];});});}else{_0x262e49[_0xc692('0x8d')]=null;}_0x262e49[_0xc692('0x90')]=_0x50405c['id'];return db[_0xc692('0x8e')][_0xc692('0x5a')]({'where':_0x262e49})[_0xc692('0x22')](function(_0x30661e){if(_0x30661e){return[_0x30661e,![]];}return db[_0xc692('0x8e')][_0xc692('0x5b')](_0x52e3e8)[_0xc692('0x22')](function(_0x2b37eb){return[_0x2b37eb,!![]];});});}})[_0xc692('0x91')](function(_0x92be6a,_0x57d3c2){if(_0x92be6a){_0x56ad5a=_0x57d3c2;if(!_0x57d3c2){var _0x38d656={'from':(_0x2fcb49[_0xc692('0x92')]['firstName']||'')+'\x20'+(_0x2fcb49[_0xc692('0x92')][_0xc692('0x93')]||'')};if(_0x29325c[_0xc692('0x5c')][_0xc692('0x8d')]&&_0x29325c[_0xc692('0x5c')]['messageId']&&_0x29325c[_0xc692('0x5c')][_0xc692('0x8d')]!=_0x29325c[_0xc692('0x5c')][_0xc692('0x94')]){_0x38d656['threadId']=_0x29325c[_0xc692('0x5c')]['messageId'];}return _0x92be6a[_0xc692('0x34')](_0x38d656);}else{return _0x92be6a;}}})[_0xc692('0x22')](function(_0x83f081){_0x2fcb49[_0xc692('0x95')]=_0x83f081['get']({'plain':!![]});_0x2fcb49[_0xc692('0x95')]['created']=_0x56ad5a;if(_0x2fcb49[_0xc692('0x95')][_0xc692('0x96')]){if(_0x2fcb49['account']['autoclose']){_0x2fcb49[_0xc692('0x86')][_0xc692('0x97')]({'id':0x0,'priority':_0x2fcb49['applications']['length']+0x1,'app':_0xc692('0x98'),'appdata':_0xc692('0x99'),'interval':'*,*,*,*'});}}return db['OpenchannelMessage'][_0xc692('0x5b')]({'body':_0x29325c[_0xc692('0x5c')]['body'],'OpenchannelAccountId':_0x29325c[_0xc692('0x58')]['id'],'OpenchannelInteractionId':_0x83f081['id'],'direction':'in','ContactId':_0x2fcb49[_0xc692('0x92')]['id'],'AttachmentId':_0x29325c['body'][_0xc692('0x9a')]});})['then'](function(_0x71c558){_0x2fcb49[_0xc692('0x2a')]=_0x71c558;if(_0x2fcb49[_0xc692('0x95')]['UserId']){return db['User'][_0xc692('0x5a')]({'attributes':['id',_0xc692('0x39')],'where':{'id':_0x2fcb49['interaction'][_0xc692('0x9b')]}})['then'](function(_0x445a18){if(_0x445a18){_0x2fcb49['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xc692('0x9c'),'appdata':_0x445a18['name']+','+(_0x2fcb49['account'][_0xc692('0x9d')]||0xa),'interval':_0xc692('0x9e')});_0x2fcb49['forcedOwnership']=![];}return respondWithRpcPromise(_0xc692('0x9f'),_0xc692('0xa0'),_0x2fcb49);});}return respondWithRpcPromise(_0xc692('0x9f'),_0xc692('0xa0'),_0x2fcb49);})[_0xc692('0x22')](function(_0x2ef94a){respondWithRpcPromise(_0xc692('0xa1'),_0xc692('0xa1'),{'event':_0xc692('0x71'),'message':_0x2ef94a},client9002);return _0x2ef94a;})[_0xc692('0x22')](respondWithResult(_0x275eae,null))[_0xc692('0x56')](handleError(_0x275eae,null));};exports['addApplications']=function(_0x4d2d2f,_0x37baba,_0x32354b){return db['OpenchannelAccount']['findOne']({'where':{'id':_0x4d2d2f['params']['id']}})['then'](handleEntityNotFound(_0x37baba,null))['then'](function(_0x3fc94c){if(_0x3fc94c){return db['sequelize']['transaction'](function(_0x201400){return db[_0xc692('0x83')]['destroy']({'where':{'OpenchannelAccountId':_0x4d2d2f[_0xc692('0x58')]['id']},'transaction':_0x201400})[_0xc692('0x22')](function(_0x5e5d55){var _0xae6123=_[_0xc692('0x3e')](_0x4d2d2f[_0xc692('0x5c')],function(_0x452249){_0x452249[_0xc692('0x65')]=_0x4d2d2f[_0xc692('0x58')]['id'];return _0x452249;});return db[_0xc692('0x83')][_0xc692('0xa2')](_0xae6123,{'transaction':_0x201400});});})[_0xc692('0x22')](function(){return db[_0xc692('0x83')][_0xc692('0xa3')]({'where':{'OpenchannelAccountId':_0x4d2d2f['params']['id']},'order':_0xc692('0x88')});});}})[_0xc692('0x22')](respondWithResult(_0x37baba,null))['catch'](handleError(_0x37baba,null));};exports[_0xc692('0xa4')]=function(_0x2d88e3,_0x82ccf4,_0x230989){var _0x24239d={};var _0x43d2c1={};var _0x21f424;var _0x40490;return db['OpenchannelAccount'][_0xc692('0x68')]({'where':{'id':_0x2d88e3[_0xc692('0x58')]['id']}})[_0xc692('0x22')](handleEntityNotFound(_0x82ccf4,null))['then'](function(_0x49874c){if(_0x49874c){_0x21f424=_0x49874c;_0x43d2c1[_0xc692('0x44')]=_[_0xc692('0x46')](db['OpenchannelApplication'][_0xc692('0x40')]);_0x43d2c1[_0xc692('0x45')]=_['keys'](_0x2d88e3[_0xc692('0x45')]);_0x43d2c1[_0xc692('0x47')]=_['intersection'](_0x43d2c1[_0xc692('0x44')],_0x43d2c1[_0xc692('0x45')]);_0x24239d['attributes']=_[_0xc692('0x48')](_0x43d2c1[_0xc692('0x44')],qs[_0xc692('0x49')](_0x2d88e3[_0xc692('0x45')][_0xc692('0x49')]));_0x24239d['attributes']=_0x24239d[_0xc692('0x4a')][_0xc692('0x4b')]?_0x24239d[_0xc692('0x4a')]:_0x43d2c1[_0xc692('0x44')];_0x24239d[_0xc692('0x4e')]=qs[_0xc692('0x69')](_0x2d88e3[_0xc692('0x45')][_0xc692('0x69')]);_0x24239d[_0xc692('0x4f')]=qs[_0xc692('0x47')](_[_0xc692('0x6a')](_0x2d88e3['query'],_0x43d2c1[_0xc692('0x47')]));if(_0x2d88e3['query'][_0xc692('0x50')]){_0x24239d['where']=_[_0xc692('0x51')](_0x24239d['where'],{'$or':_[_0xc692('0x3e')](_0x24239d[_0xc692('0x4a')],function(_0x39f244){var _0x255051={};_0x255051[_0x39f244]={'$like':'%'+_0x2d88e3['query']['filter']+'%'};return _0x255051;})});}_0x24239d=_[_0xc692('0x51')]({},_0x24239d,_0x2d88e3[_0xc692('0x52')]);return _0x21f424['getApplications'](_0x24239d);}})[_0xc692('0x22')](function(_0x2291ce){if(_0x2291ce){_0x40490=_0x2291ce[_0xc692('0x4b')];if(!_0x2d88e3['query']['hasOwnProperty']('nolimit')){_0x24239d[_0xc692('0x2e')]=qs[_0xc692('0x2e')](_0x2d88e3['query'][_0xc692('0x2e')]);_0x24239d['offset']=qs[_0xc692('0x30')](_0x2d88e3[_0xc692('0x45')][_0xc692('0x30')]);}return _0x21f424['getApplications'](_0x24239d);}})[_0xc692('0x22')](function(_0x4045d2){if(_0x4045d2){return _0x4045d2?{'count':_0x40490,'rows':_0x4045d2}:null;}})[_0xc692('0x22')](respondWithResult(_0x82ccf4,null))[_0xc692('0x56')](handleError(_0x82ccf4,null));};exports[_0xc692('0xa5')]=function(_0x136be3,_0x411241,_0x57443b){var _0x32cb58={'raw':![],'where':{}};var _0x2dac0d={};var _0xb18600={'count':0x0,'rows':[]};return db[_0xc692('0x3f')]['findOne']({'where':{'id':_0x136be3[_0xc692('0x58')]['id']}})[_0xc692('0x22')](handleEntityNotFound(_0x411241,null))[_0xc692('0x22')](function(_0x4aa991){if(_0x4aa991){_0x2dac0d['model']=_[_0xc692('0x46')](db[_0xc692('0x8e')][_0xc692('0x40')]);_0x2dac0d[_0xc692('0x45')]=_[_0xc692('0x46')](_0x136be3[_0xc692('0x45')]);_0x2dac0d['filters']=_[_0xc692('0x48')](_0x2dac0d[_0xc692('0x44')],_0x2dac0d['query']);_0x32cb58['attributes']=_['intersection'](_0x2dac0d['model'],qs[_0xc692('0x49')](_0x136be3[_0xc692('0x45')][_0xc692('0x49')]));_0x32cb58['attributes']=_0x32cb58[_0xc692('0x4a')][_0xc692('0x4b')]?_0x32cb58[_0xc692('0x4a')]:_0x2dac0d[_0xc692('0x44')];if(!_0x136be3['query'][_0xc692('0x4c')](_0xc692('0x4d'))){_0x32cb58[_0xc692('0x2e')]=qs[_0xc692('0x2e')](_0x136be3[_0xc692('0x45')][_0xc692('0x2e')]);_0x32cb58[_0xc692('0x30')]=qs[_0xc692('0x30')](_0x136be3[_0xc692('0x45')][_0xc692('0x30')]);}_0x32cb58[_0xc692('0x4e')]=qs[_0xc692('0x69')](_0x136be3[_0xc692('0x45')][_0xc692('0x69')]);_0x32cb58[_0xc692('0x4f')]=qs[_0xc692('0x47')](_[_0xc692('0x6a')](_0x136be3[_0xc692('0x45')],_0x2dac0d[_0xc692('0x47')]));_0x32cb58[_0xc692('0x4f')][_0xc692('0x65')]=_0x4aa991['id'];if(_0x136be3[_0xc692('0x45')]['filter']){_0x32cb58[_0xc692('0x4f')]=_[_0xc692('0x51')](_0x32cb58[_0xc692('0x4f')],{'$or':_[_0xc692('0x3e')](_0x32cb58[_0xc692('0x4a')],function(_0x4c5777){var _0x341c1e={};_0x341c1e[_0x4c5777]={'$like':'%'+_0x136be3[_0xc692('0x45')][_0xc692('0x50')]+'%'};return _0x341c1e;})});}_0x32cb58=_['merge']({},_0x32cb58,_0x136be3[_0xc692('0x52')]);return db[_0xc692('0x8e')][_0xc692('0x2f')]({'where':_0x32cb58['where']})[_0xc692('0x22')](function(_0x5cf969){_0xb18600[_0xc692('0x2f')]=_0x5cf969;if(_0x136be3[_0xc692('0x45')]['includeAll']){_0x32cb58[_0xc692('0x59')]=[{'model':db[_0xc692('0x8b')],'as':'Contact','required':![]},{'model':db[_0xc692('0xa6')],'as':_0xc692('0xa7'),'attributes':[_0xc692('0x39'),_0xc692('0xa8'),_0xc692('0xa9')],'required':![]},{'model':db[_0xc692('0xaa')],'as':_0xc692('0xab'),'attributes':['id',_0xc692('0x39'),'color'],'where':_0x136be3[_0xc692('0x45')][_0xc692('0xac')]?{'id':_0x136be3['query'][_0xc692('0xac')]}:undefined,'required':_0x136be3[_0xc692('0x45')][_0xc692('0xac')]?!![]:![]}];}return db[_0xc692('0x8e')][_0xc692('0x54')](_0x32cb58);})[_0xc692('0x22')](function(_0x39034e){_0xb18600['rows']=_0x39034e;return _0xb18600;});}})[_0xc692('0x22')](respondWithFilteredResult(_0x411241,_0x32cb58))['catch'](handleError(_0x411241,null));};exports['addAgents']=function(_0x11242b,_0x387848,_0x250b84){return db[_0xc692('0x3f')][_0xc692('0x5a')]({'where':{'id':_0x11242b['params']['id']}})[_0xc692('0x22')](handleEntityNotFound(_0x387848,null))['then'](function(_0x1bee48){if(_0x1bee48){return _0x1bee48[_0xc692('0xad')](_0x11242b[_0xc692('0x5c')]['ids'],_[_0xc692('0xae')](_0x11242b[_0xc692('0x5c')],[_0xc692('0x6c'),'id'])||{})[_0xc692('0x91')](function(_0x3aac93){for(var _0x25f533=0x0;_0x25f533<_0x11242b['body'][_0xc692('0x6c')][_0xc692('0x4b')];_0x25f533+=0x1){socket[_0xc692('0xaf')]('userOpenchannelAccount:save',{'UserId':Number(_0x11242b['body'][_0xc692('0x6c')][_0x25f533]),'OpenchannelAccountId':Number(_0x11242b[_0xc692('0x58')]['id'])});}return _0x3aac93;});}})[_0xc692('0x22')](respondWithResult(_0x387848,null))['catch'](handleError(_0x387848,null));};exports[_0xc692('0xb0')]=function(_0x2731e2,_0x23ce89,_0x23b69b){return db['OpenchannelAccount'][_0xc692('0x5a')]({'where':{'id':_0x2731e2[_0xc692('0x58')]['id']}})[_0xc692('0x22')](handleEntityNotFound(_0x23ce89,null))['then'](function(_0x13c53e){if(_0x13c53e){return _0x13c53e['removeAgents'](_0x2731e2[_0xc692('0x45')][_0xc692('0x6c')])[_0xc692('0x22')](function(){if(_[_0xc692('0xb1')](_0x2731e2[_0xc692('0x45')][_0xc692('0x6c')])){for(var _0x2fb84b=0x0;_0x2fb84b<_0x2731e2[_0xc692('0x45')]['ids'][_0xc692('0x4b')];_0x2fb84b+=0x1){socket[_0xc692('0xaf')](_0xc692('0xb2'),{'UserId':Number(_0x2731e2[_0xc692('0x45')]['ids'][_0x2fb84b]),'OpenchannelAccountId':Number(_0x2731e2[_0xc692('0x58')]['id'])});}}else{socket['emit'](_0xc692('0xb2'),{'UserId':Number(_0x2731e2['query'][_0xc692('0x6c')]),'OpenchannelAccountId':Number(_0x2731e2[_0xc692('0x58')]['id'])});}});}})[_0xc692('0x22')](respondWithStatusCode(_0x23ce89,null))['catch'](handleError(_0x23ce89,null));};exports[_0xc692('0xb3')]=function(_0xd9c17f,_0x1a1f49,_0x305f60){var _0x422612={};var _0x5dc296={};var _0x1167a1;var _0x5ce7e5;return db['OpenchannelAccount'][_0xc692('0x68')]({'where':{'id':_0xd9c17f['params']['id']}})[_0xc692('0x22')](handleEntityNotFound(_0x1a1f49,null))['then'](function(_0x24c443){if(_0x24c443){_0x1167a1=_0x24c443;_0x5dc296['model']=_['keys'](db[_0xc692('0xa6')]['rawAttributes']);_0x5dc296['query']=_[_0xc692('0x46')](_0xd9c17f[_0xc692('0x45')]);_0x5dc296[_0xc692('0x47')]=_[_0xc692('0x48')](_0x5dc296[_0xc692('0x44')],_0x5dc296['query']);_0x422612['attributes']=_[_0xc692('0x48')](_0x5dc296[_0xc692('0x44')],qs[_0xc692('0x49')](_0xd9c17f[_0xc692('0x45')]['fields']));_0x422612[_0xc692('0x4a')]=_0x422612[_0xc692('0x4a')][_0xc692('0x4b')]?_0x422612[_0xc692('0x4a')]:_0x5dc296[_0xc692('0x44')];_0x422612[_0xc692('0x4e')]=qs['sort'](_0xd9c17f[_0xc692('0x45')]['sort']);_0x422612[_0xc692('0x4f')]=qs[_0xc692('0x47')](_['pick'](_0xd9c17f['query'],_0x5dc296[_0xc692('0x47')]));if(_0xd9c17f[_0xc692('0x45')][_0xc692('0x50')]){_0x422612['where']=_[_0xc692('0x51')](_0x422612[_0xc692('0x4f')],{'$or':_[_0xc692('0x3e')](_0x422612[_0xc692('0x4a')],function(_0x6a087b){var _0x2fa7c7={};_0x2fa7c7[_0x6a087b]={'$like':'%'+_0xd9c17f[_0xc692('0x45')][_0xc692('0x50')]+'%'};return _0x2fa7c7;})});}_0x422612=_[_0xc692('0x51')]({},_0x422612,_0xd9c17f[_0xc692('0x52')]);return _0x1167a1['getAgents'](_0x422612);}})[_0xc692('0x22')](function(_0x13230d){if(_0x13230d){_0x5ce7e5=_0x13230d[_0xc692('0x4b')];if(!_0xd9c17f[_0xc692('0x45')][_0xc692('0x4c')]('nolimit')){_0x422612[_0xc692('0x2e')]=qs[_0xc692('0x2e')](_0xd9c17f[_0xc692('0x45')]['limit']);_0x422612[_0xc692('0x30')]=qs[_0xc692('0x30')](_0xd9c17f['query'][_0xc692('0x30')]);}return _0x1167a1[_0xc692('0xb3')](_0x422612);}})[_0xc692('0x22')](function(_0x301167){if(_0x301167){return _0x301167?{'count':_0x5ce7e5,'rows':_0x301167}:null;}})[_0xc692('0x22')](respondWithResult(_0x1a1f49,null))['catch'](handleError(_0x1a1f49,null));};exports[_0xc692('0x3a')]=function(_0x1fad6b,_0x596535,_0x34d1af){var _0x264514,_0x184847,_0x5f4a74;if(_[_0xc692('0x79')](_0x1fad6b[_0xc692('0x5c')]['body'])||_0x1fad6b['body'][_0xc692('0x5c')]===''){throw new db[(_0xc692('0x73'))][(_0xc692('0x74'))](_0xc692('0x7c'));}if(_['isNil'](_0x1fad6b[_0xc692('0x5c')]['to'])){}_0x264514=_0x1fad6b[_0xc692('0x5c')]['to'];return db[_0xc692('0x3f')][_0xc692('0x68')]({'where':{'id':_0x1fad6b[_0xc692('0x58')]['id']}})[_0xc692('0x22')](handleEntityNotFound(_0x596535,null))['then'](function(_0x424585){if(_0x424585){return db[_0xc692('0x3f')][_0xc692('0x5a')]({'where':{'id':_0x424585['id']},'include':[{'model':db[_0xc692('0x80')],'as':'List','include':[{'model':db[_0xc692('0x8b')],'as':'Contacts','where':{[_0x424585[_0xc692('0x7d')]]:_0x264514},'limit':0x1,'order':[[_0xc692('0x76'),_0xc692('0x82')]]}]}]})[_0xc692('0x22')](handleEntityNotFound(_0x596535,null))[_0xc692('0x22')](function(_0x6978d4){if(_0x6978d4&&_0x6978d4[_0xc692('0x81')]){_0x184847=_0x6978d4[_0xc692('0x35')]({'plain':!![]});if(_0x184847[_0xc692('0x81')]&&_0x184847[_0xc692('0x81')][_0xc692('0x89')][_0xc692('0x4b')]){return _0x184847['List']['Contacts'][0x0];}return db[_0xc692('0x8b')]['create'](_[_0xc692('0x19')](_0x1fad6b[_0xc692('0x5c')],{'firstName':_0x264514,[_0x6978d4['mapKey']]:_0x264514,'phone':_0x264514,'ListId':_0x184847['ListId']}));}})[_0xc692('0x22')](handleEntityNotFound(_0x596535,null))[_0xc692('0x22')](function(_0x45b2ba){if(_0x45b2ba){_0x5f4a74=_0x45b2ba;return db[_0xc692('0x8e')]['find']({'where':{'ContactId':_0x5f4a74['id'],'closed':![],'OpenchannelAccountId':_0x184847['id']}})[_0xc692('0x22')](function(_0x216309){if(_0x216309){return[_0x216309,![]];}return db[_0xc692('0x8e')]['create']({'UserId':_0x1fad6b[_0xc692('0x5d')]['id'],'ContactId':_0x5f4a74['id'],'OpenchannelAccountId':_0x184847['id'],'lastMsgDirection':_0xc692('0xb4'),'Messages':[_[_0xc692('0x51')](_0x1fad6b[_0xc692('0x5c')],{'read':![],'body':_0x1fad6b[_0xc692('0x5c')][_0xc692('0x5c')],'OpenchannelAccountId':_0x184847['id'],'UserId':_0x1fad6b[_0xc692('0x5d')]['id'],'ContactId':_0x5f4a74['id']})]},{'include':[{'model':db[_0xc692('0xb5')],'as':'Messages'}]})[_0xc692('0x22')](function(_0x54a56a){return[_0x54a56a,!![]];});});}})[_0xc692('0x91')](function(_0x5d01f4,_0x59430a){if(_0x59430a){return _0x5d01f4;}return db['OpenchannelMessage'][_0xc692('0x5b')](_[_0xc692('0x51')](_0x1fad6b[_0xc692('0x5c')],{'read':![],'body':_0x1fad6b['body'][_0xc692('0x5c')],'OpenchannelAccountId':_0x184847['id'],'OpenchannelInteractionId':_0x5d01f4['id'],'UserId':_0x1fad6b[_0xc692('0x5d')]['id'],'ContactId':_0x5f4a74['id']}))[_0xc692('0x22')](function(_0x5df822){_0x5d01f4[_0xc692('0xb6')]['Messages']=[];_0x5d01f4[_0xc692('0xb6')][_0xc692('0xb7')][_0xc692('0x97')](_0x5df822[_0xc692('0xb6')]);return _0x5d01f4;});});}})[_0xc692('0x22')](respondWithResult(_0x596535,null))['catch'](handleError(_0x596535,null));}; \ No newline at end of file +var _0x483c=['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','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','code','message','result','catch','OpenchannelAccount,\x20%s,\x20%s','sendStatus','status','json','limit','undefined','offset','Content-Range','reject','save','update','destroy','get','OpenchannelAccounts','UserProfileResource','stack','name','send','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','where','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','show','params','Pause','length','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','order','sort','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','openchannel','CmContact','Sequelize','ValidationError','difference','updatedAt','CompanyId','ListId','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','from','CmList','List','Contacts','DESC','OpenchannelApplication','Applications','account','applications','priority','asc','contact','firstName','lastName','threadId','externalUrl','OpenchannelInteraction','ContactId','spread','messageId','interaction','created','autoclose','push','close','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','EventManager','addApplications','sequelize','bulkCreate','findAndCountAll','getApplications','Owner','fullname','internal','Tags','color','tag','addAgents','omit','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','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'];(function(_0x129a61,_0x5848a1){var _0x39b8db=function(_0x319ec1){while(--_0x319ec1){_0x129a61['push'](_0x129a61['shift']());}};_0x39b8db(++_0x5848a1);}(_0x483c,0xae));var _0xc483=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x483c[_0x543084];return _0x306a57;};'use strict';var emlformat=require(_0xc483('0x0'));var rimraf=require(_0xc483('0x1'));var zipdir=require(_0xc483('0x2'));var jsonpatch=require(_0xc483('0x3'));var rp=require(_0xc483('0x4'));var moment=require(_0xc483('0x5'));var BPromise=require(_0xc483('0x6'));var Mustache=require(_0xc483('0x7'));var util=require(_0xc483('0x8'));var path=require(_0xc483('0x9'));var sox=require(_0xc483('0xa'));var csv=require(_0xc483('0xb'));var ejs=require(_0xc483('0xc'));var fs=require('fs');var fs_extra=require(_0xc483('0xd'));var _=require(_0xc483('0xe'));var squel=require('squel');var crypto=require(_0xc483('0xf'));var jsforce=require(_0xc483('0x10'));var deskjs=require(_0xc483('0x11'));var toCsv=require(_0xc483('0xb'));var querystring=require(_0xc483('0x12'));var Papa=require(_0xc483('0x13'));var Redis=require(_0xc483('0x14'));var authService=require(_0xc483('0x15'));var qs=require(_0xc483('0x16'));var as=require(_0xc483('0x17'));var hardwareService=require(_0xc483('0x18'));var logger=require(_0xc483('0x19'))(_0xc483('0x1a'));var utils=require(_0xc483('0x1b'));var config=require(_0xc483('0x1c'));var licenseUtil=require(_0xc483('0x1d'));var db=require('../../mysqldb')['db'];config[_0xc483('0x1e')]=_[_0xc483('0x1f')](config['redis'],{'host':_0xc483('0x20'),'port':0x18eb});var socket=require(_0xc483('0x21'))(new Redis(config[_0xc483('0x1e')]));require(_0xc483('0x22'))[_0xc483('0x23')](socket);var jayson=require(_0xc483('0x24'));var client=jayson['client'][_0xc483('0x25')]({'port':0x232c});var client9002=jayson['client'][_0xc483('0x25')]({'port':0x232a});function respondWithRpcPromise(_0x4bb44a,_0x925cd0,_0x2527d8,_0x3c5cbb){return new BPromise(function(_0x17bfb7,_0x37ef43){var _0x1d7b82=_0x3c5cbb||client;return _0x1d7b82[_0xc483('0x26')](_0x4bb44a,_0x2527d8)[_0xc483('0x27')](function(_0x40df5f){logger[_0xc483('0x28')]('OpenchannelAccount,\x20%s,\x20%s',_0x925cd0,_0xc483('0x29'));logger[_0xc483('0x2a')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x925cd0,_0xc483('0x29'),JSON[_0xc483('0x2b')](_0x40df5f));if(_0x40df5f[_0xc483('0x2c')]){if(_0x40df5f[_0xc483('0x2c')][_0xc483('0x2d')]===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x925cd0,_0x40df5f['error']['message']);return _0x37ef43(_0x40df5f['error']['message']);}logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x925cd0,_0x40df5f[_0xc483('0x2c')][_0xc483('0x2e')]);return _0x17bfb7(_0x40df5f[_0xc483('0x2c')][_0xc483('0x2e')]);}else{logger[_0xc483('0x28')]('OpenchannelAccount,\x20%s,\x20%s',_0x925cd0,_0xc483('0x29'));_0x17bfb7(_0x40df5f[_0xc483('0x2f')][_0xc483('0x2e')]);}})[_0xc483('0x30')](function(_0x15faf9){logger[_0xc483('0x2c')](_0xc483('0x31'),_0x925cd0,_0x15faf9);_0x37ef43(_0x15faf9);});});}function respondWithStatusCode(_0x4c2b40,_0x393555){_0x393555=_0x393555||0xcc;return function(_0x2bbf5a){if(_0x2bbf5a){return _0x4c2b40[_0xc483('0x32')](_0x393555);}return _0x4c2b40[_0xc483('0x33')](_0x393555)['end']();};}function respondWithResult(_0x490df5,_0xaf4438){_0xaf4438=_0xaf4438||0xc8;return function(_0x1ee240){if(_0x1ee240){return _0x490df5[_0xc483('0x33')](_0xaf4438)[_0xc483('0x34')](_0x1ee240);}};}function respondWithFilteredResult(_0x31d363,_0x8e5752){return function(_0x5981f9){if(_0x5981f9){var _0x4e513d=typeof _0x8e5752['offset']==='undefined'&&typeof _0x8e5752[_0xc483('0x35')]===_0xc483('0x36');var _0x4d5e42=_0x5981f9['count'];var _0x12c29d=_0x4e513d?0x0:_0x8e5752['offset'];var _0x2f938a=_0x4e513d?_0x5981f9['count']:_0x8e5752[_0xc483('0x37')]+_0x8e5752[_0xc483('0x35')];var _0x36e081;if(_0x2f938a>=_0x4d5e42){_0x2f938a=_0x4d5e42;_0x36e081=0xc8;}else{_0x36e081=0xce;}_0x31d363[_0xc483('0x33')](_0x36e081);return _0x31d363['set'](_0xc483('0x38'),_0x12c29d+'-'+_0x2f938a+'/'+_0x4d5e42)[_0xc483('0x34')](_0x5981f9);}return null;};}function patchUpdates(_0x2a6d03){return function(_0x49e62a){try{jsonpatch['apply'](_0x49e62a,_0x2a6d03,!![]);}catch(_0x1c69a8){return BPromise[_0xc483('0x39')](_0x1c69a8);}return _0x49e62a[_0xc483('0x3a')]();};}function saveUpdates(_0x1ebe1c,_0x839302){return function(_0x287735){if(_0x287735){return _0x287735[_0xc483('0x3b')](_0x1ebe1c)[_0xc483('0x27')](function(_0x41db92){return _0x41db92;});}return null;};}function removeEntity(_0x86d53a,_0xc919bb){return function(_0x37e030){if(_0x37e030){return _0x37e030[_0xc483('0x3c')]()[_0xc483('0x27')](function(){var _0x28f339=_0x37e030[_0xc483('0x3d')]({'plain':!![]});var _0x3a8add=_0xc483('0x3e');return db[_0xc483('0x3f')]['destroy']({'where':{'type':_0x3a8add,'resourceId':_0x28f339['id']}})[_0xc483('0x27')](function(){return _0x37e030;});})['then'](function(){_0x86d53a[_0xc483('0x33')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f8a00,_0x4e5b08){return function(_0x265782){if(!_0x265782){_0x3f8a00['sendStatus'](0x194);}return _0x265782;};}function handleError(_0x5ee1dd,_0x3974b3){_0x3974b3=_0x3974b3||0x1f4;return function(_0x4323a1){logger['error'](_0x4323a1[_0xc483('0x40')]);if(_0x4323a1[_0xc483('0x41')]){delete _0x4323a1[_0xc483('0x41')];}_0x5ee1dd[_0xc483('0x33')](_0x3974b3)[_0xc483('0x42')](_0x4323a1);};}exports['index']=function(_0x2116bf,_0x18978c){var _0x203cc9={'include':[{'model':db['Pause'],'as':_0xc483('0x43')}]},_0x4a97fd={},_0x3a03f2={'count':0x0,'rows':[]};var _0x2d4f1e=_[_0xc483('0x44')](db[_0xc483('0x45')][_0xc483('0x46')],function(_0xfc6576){return{'name':_0xfc6576[_0xc483('0x47')],'type':_0xfc6576[_0xc483('0x48')][_0xc483('0x49')]};});_0x4a97fd[_0xc483('0x4a')]=_[_0xc483('0x44')](_0x2d4f1e,_0xc483('0x41'));_0x4a97fd[_0xc483('0x4b')]=_[_0xc483('0x4c')](_0x2116bf[_0xc483('0x4b')]);_0x4a97fd[_0xc483('0x4d')]=_[_0xc483('0x4e')](_0x4a97fd[_0xc483('0x4a')],_0x4a97fd[_0xc483('0x4b')]);_0x203cc9[_0xc483('0x4f')]=_[_0xc483('0x4e')](_0x4a97fd[_0xc483('0x4a')],qs[_0xc483('0x50')](_0x2116bf['query'][_0xc483('0x50')]));_0x203cc9[_0xc483('0x4f')]=_0x203cc9['attributes']['length']?_0x203cc9[_0xc483('0x4f')]:_0x4a97fd[_0xc483('0x4a')];if(!_0x2116bf['query'][_0xc483('0x51')](_0xc483('0x52'))){_0x203cc9[_0xc483('0x35')]=qs['limit'](_0x2116bf['query'][_0xc483('0x35')]);_0x203cc9['offset']=qs[_0xc483('0x37')](_0x2116bf[_0xc483('0x4b')][_0xc483('0x37')]);}_0x203cc9['order']=qs['sort'](_0x2116bf['query']['sort']);_0x203cc9[_0xc483('0x53')]=qs[_0xc483('0x4d')](_[_0xc483('0x54')](_0x2116bf[_0xc483('0x4b')],_0x4a97fd[_0xc483('0x4d')]),_0x2d4f1e);if(_0x2116bf[_0xc483('0x4b')][_0xc483('0x55')]){_0x203cc9[_0xc483('0x53')]=_[_0xc483('0x56')](_0x203cc9[_0xc483('0x53')],{'$or':_[_0xc483('0x44')](_0x2d4f1e,function(_0x66560b){if(_0x66560b[_0xc483('0x48')]!==_0xc483('0x57')){var _0xacac55={};_0xacac55[_0x66560b[_0xc483('0x41')]]={'$like':'%'+_0x2116bf[_0xc483('0x4b')][_0xc483('0x55')]+'%'};return _0xacac55;}})});}_0x203cc9=_[_0xc483('0x56')]({},_0x203cc9,_0x2116bf['options']);var _0xa124de={'where':_0x203cc9[_0xc483('0x53')]};return db[_0xc483('0x45')][_0xc483('0x58')](_0xa124de)[_0xc483('0x27')](function(_0x119d5c){_0x3a03f2['count']=_0x119d5c;if(_0x2116bf[_0xc483('0x4b')][_0xc483('0x59')]){_0x203cc9[_0xc483('0x5a')]=[{'all':!![]}];}return db[_0xc483('0x45')][_0xc483('0x5b')](_0x203cc9);})[_0xc483('0x27')](function(_0x5639df){_0x3a03f2[_0xc483('0x5c')]=_0x5639df;return _0x3a03f2;})['then'](respondWithFilteredResult(_0x18978c,_0x203cc9))[_0xc483('0x30')](handleError(_0x18978c,null));};exports[_0xc483('0x5d')]=function(_0x3d86d4,_0x289069){var _0x1ef163={'raw':![],'where':{'id':_0x3d86d4[_0xc483('0x5e')]['id']},'include':[{'model':db[_0xc483('0x5f')],'as':_0xc483('0x43')}]},_0x20fbf9={};_0x20fbf9[_0xc483('0x4a')]=_['keys'](db[_0xc483('0x45')][_0xc483('0x46')]);_0x20fbf9[_0xc483('0x4b')]=_[_0xc483('0x4c')](_0x3d86d4[_0xc483('0x4b')]);_0x20fbf9[_0xc483('0x4d')]=_[_0xc483('0x4e')](_0x20fbf9['model'],_0x20fbf9[_0xc483('0x4b')]);_0x1ef163[_0xc483('0x4f')]=_[_0xc483('0x4e')](_0x20fbf9[_0xc483('0x4a')],qs[_0xc483('0x50')](_0x3d86d4[_0xc483('0x4b')][_0xc483('0x50')]));_0x1ef163['attributes']=_0x1ef163['attributes'][_0xc483('0x60')]?_0x1ef163['attributes']:_0x20fbf9['model'];if(_0x3d86d4[_0xc483('0x4b')]['includeAll']){_0x1ef163[_0xc483('0x5a')]=[{'all':!![]}];}_0x1ef163=_['merge']({},_0x1ef163,_0x3d86d4[_0xc483('0x61')]);return db[_0xc483('0x45')][_0xc483('0x62')](_0x1ef163)[_0xc483('0x27')](handleEntityNotFound(_0x289069,null))[_0xc483('0x27')](respondWithResult(_0x289069,null))[_0xc483('0x30')](handleError(_0x289069,null));};exports[_0xc483('0x63')]=function(_0x328c5f,_0x20e233){return db[_0xc483('0x45')][_0xc483('0x63')](_0x328c5f['body'],{})['then'](function(_0x41c409){var _0x5bb001=_0x328c5f[_0xc483('0x64')]['get']({'plain':!![]});if(!_0x5bb001)throw new Error(_0xc483('0x65'));if(_0x5bb001[_0xc483('0x66')]==='user'){var _0x3878d7=_0x41c409[_0xc483('0x3d')]({'plain':!![]});var _0x3c4893=_0xc483('0x3e');return db['UserProfileSection'][_0xc483('0x62')]({'where':{'name':_0x3c4893,'userProfileId':_0x5bb001[_0xc483('0x67')]},'raw':!![]})['then'](function(_0x321a18){if(_0x321a18&&_0x321a18[_0xc483('0x68')]===0x0){return db[_0xc483('0x3f')][_0xc483('0x63')]({'name':_0x3878d7['name'],'resourceId':_0x3878d7['id'],'type':_0x321a18[_0xc483('0x41')],'sectionId':_0x321a18['id']},{})[_0xc483('0x27')](function(){return _0x41c409;});}else{return _0x41c409;}})[_0xc483('0x30')](function(_0x3a8dc9){logger[_0xc483('0x2c')](_0xc483('0x69'),_0x3a8dc9);throw _0x3a8dc9;});}return _0x41c409;})[_0xc483('0x27')](respondWithResult(_0x20e233,0xc9))['catch'](handleError(_0x20e233,null));};exports[_0xc483('0x3b')]=function(_0x37169c,_0x44534f){if(_0x37169c['body']['id']){delete _0x37169c['body']['id'];}return db[_0xc483('0x45')]['find']({'where':{'id':_0x37169c['params']['id']},'include':[{'model':db[_0xc483('0x5f')],'as':_0xc483('0x43')}]})[_0xc483('0x27')](handleEntityNotFound(_0x44534f,null))[_0xc483('0x27')](saveUpdates(_0x37169c[_0xc483('0x6a')],null))[_0xc483('0x27')](respondWithResult(_0x44534f,null))[_0xc483('0x30')](handleError(_0x44534f,null));};exports['destroy']=function(_0xa3be6b,_0xd3cad5){return db[_0xc483('0x45')][_0xc483('0x62')]({'where':{'id':_0xa3be6b[_0xc483('0x5e')]['id']}})[_0xc483('0x27')](handleEntityNotFound(_0xd3cad5,null))[_0xc483('0x27')](removeEntity(_0xd3cad5,null))['catch'](handleError(_0xd3cad5,null));};exports[_0xc483('0x6b')]=function(_0x39b9e5,_0xe8cb1c){return db[_0xc483('0x45')][_0xc483('0x6b')]()[_0xc483('0x27')](respondWithResult(_0xe8cb1c,null))['catch'](handleError(_0xe8cb1c,null));};exports[_0xc483('0x6c')]=function(_0x53929a,_0x525fda,_0x5dc9dd){if(_0x53929a[_0xc483('0x6a')]['id']){delete _0x53929a[_0xc483('0x6a')]['id'];}return db[_0xc483('0x45')]['find']({'where':{'id':_0x53929a['params']['id']}})[_0xc483('0x27')](handleEntityNotFound(_0x525fda,null))[_0xc483('0x27')](function(_0x20bfa0){if(_0x20bfa0){_0x53929a[_0xc483('0x6a')][_0xc483('0x6d')]=_0x20bfa0['id'];return db[_0xc483('0x6e')][_0xc483('0x63')](_0x53929a[_0xc483('0x6a')]);}})[_0xc483('0x27')](respondWithResult(_0x525fda,null))[_0xc483('0x30')](handleError(_0x525fda,null));};exports[_0xc483('0x6f')]=function(_0x33f68a,_0x22ff5b,_0x2f6572){var _0xbfc3eb={'raw':![],'where':{}};var _0x535feb={};var _0x5461e6={'count':0x0,'rows':[]};return db[_0xc483('0x45')][_0xc483('0x70')]({'where':{'id':_0x33f68a[_0xc483('0x5e')]['id']}})[_0xc483('0x27')](handleEntityNotFound(_0x22ff5b,null))['then'](function(_0x25361c){if(_0x25361c){_0x535feb[_0xc483('0x4a')]=_['keys'](db[_0xc483('0x6e')][_0xc483('0x46')]);_0x535feb[_0xc483('0x4b')]=_[_0xc483('0x4c')](_0x33f68a[_0xc483('0x4b')]);_0x535feb['filters']=_[_0xc483('0x4e')](_0x535feb[_0xc483('0x4a')],_0x535feb[_0xc483('0x4b')]);_0xbfc3eb[_0xc483('0x4f')]=_[_0xc483('0x4e')](_0x535feb[_0xc483('0x4a')],qs[_0xc483('0x50')](_0x33f68a[_0xc483('0x4b')][_0xc483('0x50')]));_0xbfc3eb[_0xc483('0x4f')]=_0xbfc3eb[_0xc483('0x4f')][_0xc483('0x60')]?_0xbfc3eb[_0xc483('0x4f')]:_0x535feb[_0xc483('0x4a')];if(!_0x33f68a[_0xc483('0x4b')][_0xc483('0x51')](_0xc483('0x52'))){_0xbfc3eb[_0xc483('0x35')]=qs['limit'](_0x33f68a[_0xc483('0x4b')][_0xc483('0x35')]);_0xbfc3eb['offset']=qs[_0xc483('0x37')](_0x33f68a[_0xc483('0x4b')][_0xc483('0x37')]);}_0xbfc3eb[_0xc483('0x71')]=qs[_0xc483('0x72')](_0x33f68a[_0xc483('0x4b')]['sort']);_0xbfc3eb[_0xc483('0x53')]=qs[_0xc483('0x4d')](_[_0xc483('0x54')](_0x33f68a['query'],_0x535feb['filters']));_0xbfc3eb[_0xc483('0x53')]['OpenchannelAccountId']=_0x25361c['id'];if(_0x33f68a[_0xc483('0x4b')][_0xc483('0x55')]){_0xbfc3eb[_0xc483('0x53')]=_['merge'](_0xbfc3eb[_0xc483('0x53')],{'$or':_[_0xc483('0x44')](_0xbfc3eb[_0xc483('0x4f')],function(_0x27dc35){var _0x257c75={};_0x257c75[_0x27dc35]={'$like':'%'+_0x33f68a[_0xc483('0x4b')][_0xc483('0x55')]+'%'};return _0x257c75;})});}_0xbfc3eb=_[_0xc483('0x56')]({},_0xbfc3eb,_0x33f68a[_0xc483('0x61')]);return db[_0xc483('0x6e')][_0xc483('0x58')]({'where':_0xbfc3eb[_0xc483('0x53')]})[_0xc483('0x27')](function(_0x403f55){_0x5461e6[_0xc483('0x58')]=_0x403f55;if(_0x33f68a[_0xc483('0x4b')][_0xc483('0x59')]){_0xbfc3eb[_0xc483('0x5a')]=[{'all':!![]}];}return db[_0xc483('0x6e')][_0xc483('0x5b')](_0xbfc3eb);})[_0xc483('0x27')](function(_0x364160){_0x5461e6[_0xc483('0x5c')]=_0x364160;return _0x5461e6;});}})[_0xc483('0x27')](respondWithFilteredResult(_0x22ff5b,_0xbfc3eb))[_0xc483('0x30')](handleError(_0x22ff5b,null));};exports[_0xc483('0x73')]=function(_0x4251da,_0x2ba558,_0x1838ab){return db[_0xc483('0x45')][_0xc483('0x62')]({'where':{'id':_0x4251da[_0xc483('0x5e')]['id']}})[_0xc483('0x27')](handleEntityNotFound(_0x2ba558,null))[_0xc483('0x27')](function(_0xcb6d9d){if(_0xcb6d9d){return _0xcb6d9d[_0xc483('0x73')](_0x4251da[_0xc483('0x4b')][_0xc483('0x74')]);}})[_0xc483('0x27')](respondWithStatusCode(_0x2ba558,null))[_0xc483('0x30')](handleError(_0x2ba558,null));};exports[_0xc483('0x75')]=function(_0x46d864,_0x5e50a9,_0x5a7a5d){if(_0x46d864[_0xc483('0x6a')]['id']){delete _0x46d864[_0xc483('0x6a')]['id'];}return db[_0xc483('0x45')][_0xc483('0x62')]({'where':{'id':_0x46d864[_0xc483('0x5e')]['id']}})[_0xc483('0x27')](handleEntityNotFound(_0x5e50a9,null))[_0xc483('0x27')](function(_0x1176bb){if(_0x1176bb){_0x46d864[_0xc483('0x6a')][_0xc483('0x6d')]=_0x1176bb['id'];return db[_0xc483('0x76')]['create'](_0x46d864[_0xc483('0x6a')]);}})[_0xc483('0x27')](respondWithResult(_0x5e50a9,null))[_0xc483('0x30')](handleError(_0x5e50a9,null));};exports['getAnswers']=function(_0x43208d,_0x1e0686,_0x419168){var _0xdcd0f5={'raw':![],'where':{}};var _0x14cf70={};var _0x2d1a8e={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xc483('0x70')]({'where':{'id':_0x43208d[_0xc483('0x5e')]['id']}})[_0xc483('0x27')](handleEntityNotFound(_0x1e0686,null))['then'](function(_0x27b18){if(_0x27b18){_0x14cf70[_0xc483('0x4a')]=_['keys'](db['CannedAnswer'][_0xc483('0x46')]);_0x14cf70['query']=_[_0xc483('0x4c')](_0x43208d[_0xc483('0x4b')]);_0x14cf70[_0xc483('0x4d')]=_[_0xc483('0x4e')](_0x14cf70[_0xc483('0x4a')],_0x14cf70[_0xc483('0x4b')]);_0xdcd0f5[_0xc483('0x4f')]=_[_0xc483('0x4e')](_0x14cf70[_0xc483('0x4a')],qs[_0xc483('0x50')](_0x43208d[_0xc483('0x4b')][_0xc483('0x50')]));_0xdcd0f5[_0xc483('0x4f')]=_0xdcd0f5[_0xc483('0x4f')][_0xc483('0x60')]?_0xdcd0f5[_0xc483('0x4f')]:_0x14cf70[_0xc483('0x4a')];if(!_0x43208d[_0xc483('0x4b')]['hasOwnProperty'](_0xc483('0x52'))){_0xdcd0f5[_0xc483('0x35')]=qs['limit'](_0x43208d[_0xc483('0x4b')][_0xc483('0x35')]);_0xdcd0f5[_0xc483('0x37')]=qs['offset'](_0x43208d[_0xc483('0x4b')][_0xc483('0x37')]);}_0xdcd0f5[_0xc483('0x71')]=qs[_0xc483('0x72')](_0x43208d[_0xc483('0x4b')][_0xc483('0x72')]);_0xdcd0f5[_0xc483('0x53')]=qs['filters'](_[_0xc483('0x54')](_0x43208d['query'],_0x14cf70[_0xc483('0x4d')]));_0xdcd0f5[_0xc483('0x53')][_0xc483('0x6d')]=_0x27b18['id'];if(_0x43208d['query'][_0xc483('0x55')]){_0xdcd0f5[_0xc483('0x53')]=_[_0xc483('0x56')](_0xdcd0f5['where'],{'$or':_['map'](_0xdcd0f5[_0xc483('0x4f')],function(_0x32d3e2){var _0x3d1ed0={};_0x3d1ed0[_0x32d3e2]={'$like':'%'+_0x43208d[_0xc483('0x4b')]['filter']+'%'};return _0x3d1ed0;})});}_0xdcd0f5=_['merge']({},_0xdcd0f5,_0x43208d[_0xc483('0x61')]);return db[_0xc483('0x76')][_0xc483('0x58')]({'where':_0xdcd0f5['where']})[_0xc483('0x27')](function(_0x2610c6){_0x2d1a8e[_0xc483('0x58')]=_0x2610c6;if(_0x43208d[_0xc483('0x4b')]['includeAll']){_0xdcd0f5[_0xc483('0x5a')]=[{'all':!![]}];}return db['CannedAnswer'][_0xc483('0x5b')](_0xdcd0f5);})[_0xc483('0x27')](function(_0x43ceb2){_0x2d1a8e[_0xc483('0x5c')]=_0x43ceb2;return _0x2d1a8e;});}})[_0xc483('0x27')](respondWithFilteredResult(_0x1e0686,_0xdcd0f5))[_0xc483('0x30')](handleError(_0x1e0686,null));};exports[_0xc483('0x77')]=function(_0x18669f,_0x211d08,_0x11173f){return db[_0xc483('0x45')][_0xc483('0x62')]({'where':{'id':_0x18669f[_0xc483('0x5e')]['id']}})[_0xc483('0x27')](handleEntityNotFound(_0x211d08,null))[_0xc483('0x27')](function(_0x31c806){if(_0x31c806){return _0x31c806[_0xc483('0x77')](_0x18669f[_0xc483('0x4b')][_0xc483('0x74')]);}})[_0xc483('0x27')](respondWithStatusCode(_0x211d08,null))['catch'](handleError(_0x211d08,null));};exports['notify']=function(_0x36d0ed,_0xbd4be4,_0x1fac4c){var _0x5135c4={'body':_0x36d0ed[_0xc483('0x6a')],'channel':_0xc483('0x78')};var _0x25a434=[];var _0x1d1c23=[];var _0x3603de={};var _0x2aaac8=![];return db[_0xc483('0x79')][_0xc483('0x6b')]()['then'](function(_0x570961){if(!_0x570961){throw new db[(_0xc483('0x7a'))][(_0xc483('0x7b'))]('no\x20available\x20attributes');}_0x25a434=_['difference'](_[_0xc483('0x4c')](_0x570961),['createdAt','updatedAt']);_0x1d1c23=_[_0xc483('0x7c')](_[_0xc483('0x4c')](_0x570961),['createdAt',_0xc483('0x7d'),_0xc483('0x7e'),_0xc483('0x7f')]);if(_0x36d0ed[_0xc483('0x6a')]['id']){delete _0x36d0ed[_0xc483('0x6a')]['id'];}if(_['isNil'](_0x36d0ed[_0xc483('0x6a')]['from'])){throw new db['Sequelize'][(_0xc483('0x7b'))](_0xc483('0x80'));}if(_[_0xc483('0x81')](_0x36d0ed[_0xc483('0x6a')][_0xc483('0x6a')])||_0x36d0ed[_0xc483('0x6a')]['body']===''){throw new db['Sequelize'][(_0xc483('0x7b'))](_0xc483('0x82'));}if(_[_0xc483('0x81')](_0x36d0ed[_0xc483('0x6a')][_0xc483('0x83')])){throw new db['Sequelize'][(_0xc483('0x7b'))](_0xc483('0x84')+_0x1d1c23);}if(!_[_0xc483('0x85')](_0x1d1c23,_0x36d0ed[_0xc483('0x6a')][_0xc483('0x83')])){throw new db['Sequelize'][(_0xc483('0x7b'))](_0xc483('0x86')+_0x1d1c23);}_0x3603de[_0x36d0ed[_0xc483('0x6a')][_0xc483('0x83')]]=_0x36d0ed[_0xc483('0x6a')][_0xc483('0x87')];})[_0xc483('0x27')](function(){return db['OpenchannelAccount']['find']({'where':{'id':_0x36d0ed[_0xc483('0x5e')]['id']},'include':[{'model':db[_0xc483('0x88')],'as':_0xc483('0x89'),'include':[{'model':db[_0xc483('0x79')],'as':_0xc483('0x8a'),'where':_0x3603de,'limit':0x1,'order':[['updatedAt',_0xc483('0x8b')]]}]},{'model':db[_0xc483('0x8c')],'as':_0xc483('0x8d')}]});})[_0xc483('0x27')](handleEntityNotFound(_0xbd4be4,null))[_0xc483('0x27')](function(_0x468e1e){if(_0x468e1e&&_0x468e1e[_0xc483('0x89')]){_0x5135c4[_0xc483('0x8e')]=_0x468e1e;_0x5135c4[_0xc483('0x8f')]=_0x468e1e['Applications'];_0x5135c4['list']=_0x468e1e[_0xc483('0x89')];_0x5135c4[_0xc483('0x8f')]=_['orderBy'](_0x5135c4[_0xc483('0x8f')],[_0xc483('0x90')],[_0xc483('0x91')]);if(_0x5135c4[_0xc483('0x8e')]['Applications']){delete _0x5135c4[_0xc483('0x8e')][_0xc483('0x8d')];}if(_0x5135c4['account'][_0xc483('0x89')]&&_0x5135c4['account'][_0xc483('0x89')][_0xc483('0x8a')][_0xc483('0x60')]){return _0x5135c4[_0xc483('0x8e')][_0xc483('0x89')][_0xc483('0x8a')][0x0];}var _0x3e3197=_[_0xc483('0x1f')](_0x36d0ed[_0xc483('0x6a')],{'firstName':_0x36d0ed[_0xc483('0x6a')][_0xc483('0x87')],'ListId':_0x468e1e['ListId']});_0x3e3197[_0x36d0ed[_0xc483('0x6a')]['mapKey']]=_0x36d0ed[_0xc483('0x6a')]['from'];return db[_0xc483('0x79')][_0xc483('0x63')](_0x3e3197,{'fields':_0x25a434,'raw':!![]});}})[_0xc483('0x27')](handleEntityNotFound(_0xbd4be4,null))[_0xc483('0x27')](function(_0x562bde){_0x5135c4[_0xc483('0x92')]=_0x562bde;if(_0x562bde){var _0x59589b={'ContactId':_0x562bde['id'],'OpenchannelAccountId':_0x36d0ed[_0xc483('0x5e')]['id'],'from':(_0x562bde[_0xc483('0x93')]||'')+'\x20'+(_0x562bde[_0xc483('0x94')]||'')};var _0x341e2a={'OpenchannelAccountId':_0x36d0ed['params']['id'],'closed':![]};if(_0x36d0ed[_0xc483('0x6a')][_0xc483('0x95')]){_0x341e2a[_0xc483('0x95')]=_0x36d0ed[_0xc483('0x6a')][_0xc483('0x95')];return db['OpenchannelInteraction']['find']({'where':_0x341e2a})['then'](function(_0xeb1d23){if(_0xeb1d23){return[_0xeb1d23,![]];}_0x59589b['threadId']=_0x36d0ed['body'][_0xc483('0x95')];_0x59589b[_0xc483('0x96')]=_0x36d0ed[_0xc483('0x6a')]['externalUrl'];return db[_0xc483('0x97')][_0xc483('0x63')](_0x59589b)['then'](function(_0xa3811e){return[_0xa3811e,!![]];});});}else{_0x341e2a['threadId']=null;}_0x341e2a[_0xc483('0x98')]=_0x562bde['id'];return db[_0xc483('0x97')][_0xc483('0x62')]({'where':_0x341e2a})['then'](function(_0x5973de){if(_0x5973de){return[_0x5973de,![]];}return db[_0xc483('0x97')][_0xc483('0x63')](_0x59589b)[_0xc483('0x27')](function(_0x260dd4){return[_0x260dd4,!![]];});});}})[_0xc483('0x99')](function(_0x253848,_0x364dc0){if(_0x253848){_0x2aaac8=_0x364dc0;if(!_0x364dc0){var _0x276e11={'from':(_0x5135c4[_0xc483('0x92')][_0xc483('0x93')]||'')+'\x20'+(_0x5135c4['contact']['lastName']||'')};if(_0x36d0ed[_0xc483('0x6a')][_0xc483('0x95')]&&_0x36d0ed['body'][_0xc483('0x9a')]&&_0x36d0ed[_0xc483('0x6a')][_0xc483('0x95')]!=_0x36d0ed[_0xc483('0x6a')][_0xc483('0x9a')]){_0x276e11[_0xc483('0x95')]=_0x36d0ed[_0xc483('0x6a')][_0xc483('0x9a')];}return _0x253848[_0xc483('0x3b')](_0x276e11);}else{return _0x253848;}}})[_0xc483('0x27')](function(_0x5a0884){_0x5135c4[_0xc483('0x9b')]=_0x5a0884[_0xc483('0x3d')]({'plain':!![]});_0x5135c4[_0xc483('0x9b')][_0xc483('0x9c')]=_0x2aaac8;if(_0x5135c4[_0xc483('0x9b')][_0xc483('0x9c')]){if(_0x5135c4[_0xc483('0x8e')][_0xc483('0x9d')]){_0x5135c4[_0xc483('0x8f')][_0xc483('0x9e')]({'id':0x0,'priority':_0x5135c4[_0xc483('0x8f')][_0xc483('0x60')]+0x1,'app':_0xc483('0x9f'),'appdata':'unmanaged','interval':_0xc483('0xa0')});}}return db[_0xc483('0xa1')][_0xc483('0x63')]({'body':_0x36d0ed[_0xc483('0x6a')][_0xc483('0x6a')],'OpenchannelAccountId':_0x36d0ed['params']['id'],'OpenchannelInteractionId':_0x5a0884['id'],'direction':'in','ContactId':_0x5135c4[_0xc483('0x92')]['id'],'AttachmentId':_0x36d0ed[_0xc483('0x6a')][_0xc483('0xa2')]});})['then'](function(_0x357362){_0x5135c4['message']=_0x357362;if(_0x5135c4['interaction'][_0xc483('0xa3')]){return db[_0xc483('0xa4')][_0xc483('0x62')]({'attributes':['id',_0xc483('0x41')],'where':{'id':_0x5135c4[_0xc483('0x9b')]['UserId']}})[_0xc483('0x27')](function(_0x338ab8){if(_0x338ab8){_0x5135c4['applications'][_0xc483('0xa5')]({'id':0x0,'priority':0x0,'app':_0xc483('0xa6'),'appdata':_0x338ab8[_0xc483('0x41')]+','+(_0x5135c4[_0xc483('0x8e')][_0xc483('0xa7')]||0xa),'interval':_0xc483('0xa0')});_0x5135c4[_0xc483('0xa8')]=![];}return respondWithRpcPromise(_0xc483('0xa9'),'startRouting',_0x5135c4);});}return respondWithRpcPromise('Start','startRouting',_0x5135c4);})[_0xc483('0x27')](function(_0x233203){respondWithRpcPromise(_0xc483('0xaa'),_0xc483('0xaa'),{'event':'notify','message':_0x233203},client9002);return _0x233203;})[_0xc483('0x27')](respondWithResult(_0xbd4be4,null))[_0xc483('0x30')](handleError(_0xbd4be4,null));};exports[_0xc483('0xab')]=function(_0x92f1fe,_0x4bed93,_0x42c9b7){return db[_0xc483('0x45')][_0xc483('0x70')]({'where':{'id':_0x92f1fe['params']['id']}})[_0xc483('0x27')](handleEntityNotFound(_0x4bed93,null))['then'](function(_0x463ce5){if(_0x463ce5){return db[_0xc483('0xac')]['transaction'](function(_0x575efe){return db['OpenchannelApplication'][_0xc483('0x3c')]({'where':{'OpenchannelAccountId':_0x92f1fe[_0xc483('0x5e')]['id']},'transaction':_0x575efe})[_0xc483('0x27')](function(_0x33a722){var _0x3f2602=_[_0xc483('0x44')](_0x92f1fe[_0xc483('0x6a')],function(_0x458e6f){_0x458e6f[_0xc483('0x6d')]=_0x92f1fe[_0xc483('0x5e')]['id'];return _0x458e6f;});return db[_0xc483('0x8c')][_0xc483('0xad')](_0x3f2602,{'transaction':_0x575efe});});})['then'](function(){return db[_0xc483('0x8c')][_0xc483('0xae')]({'where':{'OpenchannelAccountId':_0x92f1fe[_0xc483('0x5e')]['id']},'order':_0xc483('0x90')});});}})[_0xc483('0x27')](respondWithResult(_0x4bed93,null))['catch'](handleError(_0x4bed93,null));};exports[_0xc483('0xaf')]=function(_0x46f793,_0x50659d,_0xe6de1){var _0x34784b={};var _0x356845={};var _0x23e532;var _0x529369;return db[_0xc483('0x45')][_0xc483('0x70')]({'where':{'id':_0x46f793[_0xc483('0x5e')]['id']}})[_0xc483('0x27')](handleEntityNotFound(_0x50659d,null))['then'](function(_0x1ee936){if(_0x1ee936){_0x23e532=_0x1ee936;_0x356845['model']=_[_0xc483('0x4c')](db['OpenchannelApplication']['rawAttributes']);_0x356845[_0xc483('0x4b')]=_['keys'](_0x46f793['query']);_0x356845[_0xc483('0x4d')]=_['intersection'](_0x356845[_0xc483('0x4a')],_0x356845[_0xc483('0x4b')]);_0x34784b[_0xc483('0x4f')]=_[_0xc483('0x4e')](_0x356845['model'],qs[_0xc483('0x50')](_0x46f793[_0xc483('0x4b')]['fields']));_0x34784b[_0xc483('0x4f')]=_0x34784b['attributes'][_0xc483('0x60')]?_0x34784b[_0xc483('0x4f')]:_0x356845[_0xc483('0x4a')];_0x34784b[_0xc483('0x71')]=qs[_0xc483('0x72')](_0x46f793['query']['sort']);_0x34784b[_0xc483('0x53')]=qs['filters'](_[_0xc483('0x54')](_0x46f793[_0xc483('0x4b')],_0x356845['filters']));if(_0x46f793[_0xc483('0x4b')]['filter']){_0x34784b[_0xc483('0x53')]=_[_0xc483('0x56')](_0x34784b['where'],{'$or':_[_0xc483('0x44')](_0x34784b[_0xc483('0x4f')],function(_0x48861d){var _0x364e76={};_0x364e76[_0x48861d]={'$like':'%'+_0x46f793['query'][_0xc483('0x55')]+'%'};return _0x364e76;})});}_0x34784b=_['merge']({},_0x34784b,_0x46f793[_0xc483('0x61')]);return _0x23e532['getApplications'](_0x34784b);}})[_0xc483('0x27')](function(_0x32d147){if(_0x32d147){_0x529369=_0x32d147[_0xc483('0x60')];if(!_0x46f793[_0xc483('0x4b')]['hasOwnProperty']('nolimit')){_0x34784b[_0xc483('0x35')]=qs['limit'](_0x46f793['query'][_0xc483('0x35')]);_0x34784b[_0xc483('0x37')]=qs[_0xc483('0x37')](_0x46f793[_0xc483('0x4b')][_0xc483('0x37')]);}return _0x23e532['getApplications'](_0x34784b);}})['then'](function(_0x1b389d){if(_0x1b389d){return _0x1b389d?{'count':_0x529369,'rows':_0x1b389d}:null;}})[_0xc483('0x27')](respondWithResult(_0x50659d,null))['catch'](handleError(_0x50659d,null));};exports['getInteractions']=function(_0x498df8,_0xc91ee9,_0x3dc1bc){var _0x2f10d3={'raw':![],'where':{}};var _0x29111f={};var _0x37e5b2={'count':0x0,'rows':[]};return db[_0xc483('0x45')][_0xc483('0x70')]({'where':{'id':_0x498df8[_0xc483('0x5e')]['id']}})[_0xc483('0x27')](handleEntityNotFound(_0xc91ee9,null))[_0xc483('0x27')](function(_0x237297){if(_0x237297){_0x29111f[_0xc483('0x4a')]=_[_0xc483('0x4c')](db['OpenchannelInteraction'][_0xc483('0x46')]);_0x29111f[_0xc483('0x4b')]=_[_0xc483('0x4c')](_0x498df8[_0xc483('0x4b')]);_0x29111f[_0xc483('0x4d')]=_['intersection'](_0x29111f[_0xc483('0x4a')],_0x29111f[_0xc483('0x4b')]);_0x2f10d3[_0xc483('0x4f')]=_[_0xc483('0x4e')](_0x29111f['model'],qs[_0xc483('0x50')](_0x498df8[_0xc483('0x4b')][_0xc483('0x50')]));_0x2f10d3['attributes']=_0x2f10d3[_0xc483('0x4f')][_0xc483('0x60')]?_0x2f10d3[_0xc483('0x4f')]:_0x29111f[_0xc483('0x4a')];if(!_0x498df8[_0xc483('0x4b')]['hasOwnProperty'](_0xc483('0x52'))){_0x2f10d3[_0xc483('0x35')]=qs['limit'](_0x498df8[_0xc483('0x4b')][_0xc483('0x35')]);_0x2f10d3[_0xc483('0x37')]=qs[_0xc483('0x37')](_0x498df8[_0xc483('0x4b')][_0xc483('0x37')]);}_0x2f10d3[_0xc483('0x71')]=qs[_0xc483('0x72')](_0x498df8['query'][_0xc483('0x72')]);_0x2f10d3['where']=qs['filters'](_['pick'](_0x498df8[_0xc483('0x4b')],_0x29111f[_0xc483('0x4d')]));_0x2f10d3[_0xc483('0x53')][_0xc483('0x6d')]=_0x237297['id'];if(_0x498df8[_0xc483('0x4b')][_0xc483('0x55')]){_0x2f10d3[_0xc483('0x53')]=_[_0xc483('0x56')](_0x2f10d3[_0xc483('0x53')],{'$or':_[_0xc483('0x44')](_0x2f10d3['attributes'],function(_0x4881b1){var _0x3cf3da={};_0x3cf3da[_0x4881b1]={'$like':'%'+_0x498df8['query'][_0xc483('0x55')]+'%'};return _0x3cf3da;})});}_0x2f10d3=_[_0xc483('0x56')]({},_0x2f10d3,_0x498df8['options']);return db[_0xc483('0x97')]['count']({'where':_0x2f10d3[_0xc483('0x53')]})[_0xc483('0x27')](function(_0x644bd2){_0x37e5b2[_0xc483('0x58')]=_0x644bd2;if(_0x498df8['query'][_0xc483('0x59')]){_0x2f10d3[_0xc483('0x5a')]=[{'model':db[_0xc483('0x79')],'as':'Contact','required':![]},{'model':db['User'],'as':_0xc483('0xb0'),'attributes':[_0xc483('0x41'),_0xc483('0xb1'),_0xc483('0xb2')],'required':![]},{'model':db['Tag'],'as':_0xc483('0xb3'),'attributes':['id',_0xc483('0x41'),_0xc483('0xb4')],'where':_0x498df8[_0xc483('0x4b')][_0xc483('0xb5')]?{'id':_0x498df8[_0xc483('0x4b')]['tag']}:undefined,'required':_0x498df8[_0xc483('0x4b')][_0xc483('0xb5')]?!![]:![]}];}return db[_0xc483('0x97')][_0xc483('0x5b')](_0x2f10d3);})[_0xc483('0x27')](function(_0x155a1d){_0x37e5b2['rows']=_0x155a1d;return _0x37e5b2;});}})['then'](respondWithFilteredResult(_0xc91ee9,_0x2f10d3))[_0xc483('0x30')](handleError(_0xc91ee9,null));};exports[_0xc483('0xb6')]=function(_0x3112a6,_0x3a1d2b,_0x253fb4){return db[_0xc483('0x45')]['find']({'where':{'id':_0x3112a6[_0xc483('0x5e')]['id']}})[_0xc483('0x27')](handleEntityNotFound(_0x3a1d2b,null))[_0xc483('0x27')](function(_0x385154){if(_0x385154){return _0x385154[_0xc483('0xb6')](_0x3112a6[_0xc483('0x6a')][_0xc483('0x74')],_[_0xc483('0xb7')](_0x3112a6[_0xc483('0x6a')],[_0xc483('0x74'),'id'])||{})[_0xc483('0x99')](function(_0x9e0065){for(var _0x2831e8=0x0;_0x2831e8<_0x3112a6[_0xc483('0x6a')]['ids'][_0xc483('0x60')];_0x2831e8+=0x1){socket[_0xc483('0xb8')]('userOpenchannelAccount:save',{'UserId':Number(_0x3112a6['body'][_0xc483('0x74')][_0x2831e8]),'OpenchannelAccountId':Number(_0x3112a6[_0xc483('0x5e')]['id'])});}return _0x9e0065;});}})[_0xc483('0x27')](respondWithResult(_0x3a1d2b,null))[_0xc483('0x30')](handleError(_0x3a1d2b,null));};exports['removeAgents']=function(_0x435063,_0x2192a5,_0xc5f9){return db[_0xc483('0x45')][_0xc483('0x62')]({'where':{'id':_0x435063[_0xc483('0x5e')]['id']}})['then'](handleEntityNotFound(_0x2192a5,null))[_0xc483('0x27')](function(_0x1229dd){if(_0x1229dd){return _0x1229dd[_0xc483('0xb9')](_0x435063[_0xc483('0x4b')][_0xc483('0x74')])['then'](function(){if(_[_0xc483('0xba')](_0x435063[_0xc483('0x4b')][_0xc483('0x74')])){for(var _0x4f16d2=0x0;_0x4f16d2<_0x435063[_0xc483('0x4b')][_0xc483('0x74')][_0xc483('0x60')];_0x4f16d2+=0x1){socket[_0xc483('0xb8')](_0xc483('0xbb'),{'UserId':Number(_0x435063[_0xc483('0x4b')][_0xc483('0x74')][_0x4f16d2]),'OpenchannelAccountId':Number(_0x435063['params']['id'])});}}else{socket[_0xc483('0xb8')]('userOpenchannelAccount:remove',{'UserId':Number(_0x435063[_0xc483('0x4b')]['ids']),'OpenchannelAccountId':Number(_0x435063[_0xc483('0x5e')]['id'])});}});}})[_0xc483('0x27')](respondWithStatusCode(_0x2192a5,null))[_0xc483('0x30')](handleError(_0x2192a5,null));};exports[_0xc483('0xbc')]=function(_0x80364e,_0x280afa,_0x50c49e){var _0x2ecdb9={};var _0x3131eb={};var _0x20cfd2;var _0x44a9f0;return db[_0xc483('0x45')]['findOne']({'where':{'id':_0x80364e[_0xc483('0x5e')]['id']}})[_0xc483('0x27')](handleEntityNotFound(_0x280afa,null))[_0xc483('0x27')](function(_0x24ce22){if(_0x24ce22){_0x20cfd2=_0x24ce22;_0x3131eb[_0xc483('0x4a')]=_[_0xc483('0x4c')](db[_0xc483('0xa4')]['rawAttributes']);_0x3131eb[_0xc483('0x4b')]=_[_0xc483('0x4c')](_0x80364e[_0xc483('0x4b')]);_0x3131eb[_0xc483('0x4d')]=_[_0xc483('0x4e')](_0x3131eb[_0xc483('0x4a')],_0x3131eb['query']);_0x2ecdb9['attributes']=_[_0xc483('0x4e')](_0x3131eb[_0xc483('0x4a')],qs['fields'](_0x80364e['query'][_0xc483('0x50')]));_0x2ecdb9[_0xc483('0x4f')]=_0x2ecdb9['attributes']['length']?_0x2ecdb9[_0xc483('0x4f')]:_0x3131eb[_0xc483('0x4a')];_0x2ecdb9[_0xc483('0x71')]=qs[_0xc483('0x72')](_0x80364e[_0xc483('0x4b')][_0xc483('0x72')]);_0x2ecdb9[_0xc483('0x53')]=qs[_0xc483('0x4d')](_[_0xc483('0x54')](_0x80364e[_0xc483('0x4b')],_0x3131eb['filters']));if(_0x80364e['query'][_0xc483('0x55')]){_0x2ecdb9[_0xc483('0x53')]=_[_0xc483('0x56')](_0x2ecdb9['where'],{'$or':_['map'](_0x2ecdb9[_0xc483('0x4f')],function(_0x4a5c62){var _0x346fbd={};_0x346fbd[_0x4a5c62]={'$like':'%'+_0x80364e['query'][_0xc483('0x55')]+'%'};return _0x346fbd;})});}_0x2ecdb9=_[_0xc483('0x56')]({},_0x2ecdb9,_0x80364e[_0xc483('0x61')]);return _0x20cfd2[_0xc483('0xbc')](_0x2ecdb9);}})['then'](function(_0x19b21c){if(_0x19b21c){_0x44a9f0=_0x19b21c[_0xc483('0x60')];if(!_0x80364e['query'][_0xc483('0x51')](_0xc483('0x52'))){_0x2ecdb9[_0xc483('0x35')]=qs['limit'](_0x80364e[_0xc483('0x4b')][_0xc483('0x35')]);_0x2ecdb9['offset']=qs[_0xc483('0x37')](_0x80364e[_0xc483('0x4b')][_0xc483('0x37')]);}return _0x20cfd2[_0xc483('0xbc')](_0x2ecdb9);}})[_0xc483('0x27')](function(_0x8a1f7d){if(_0x8a1f7d){return _0x8a1f7d?{'count':_0x44a9f0,'rows':_0x8a1f7d}:null;}})[_0xc483('0x27')](respondWithResult(_0x280afa,null))[_0xc483('0x30')](handleError(_0x280afa,null));};exports[_0xc483('0x42')]=function(_0x599b58,_0x2934a4,_0x40d762){var _0x3bb798,_0x4920b3,_0x2e45df;if(_[_0xc483('0x81')](_0x599b58[_0xc483('0x6a')]['body'])||_0x599b58[_0xc483('0x6a')][_0xc483('0x6a')]===''){throw new db[(_0xc483('0x7a'))]['ValidationError'](_0xc483('0x82'));}if(_[_0xc483('0x81')](_0x599b58[_0xc483('0x6a')]['to'])){}_0x3bb798=_0x599b58[_0xc483('0x6a')]['to'];return db[_0xc483('0x45')][_0xc483('0x70')]({'where':{'id':_0x599b58[_0xc483('0x5e')]['id']}})[_0xc483('0x27')](handleEntityNotFound(_0x2934a4,null))[_0xc483('0x27')](function(_0xcce4d3){if(_0xcce4d3){return db[_0xc483('0x45')][_0xc483('0x62')]({'where':{'id':_0xcce4d3['id']},'include':[{'model':db[_0xc483('0x88')],'as':_0xc483('0x89'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{[_0xcce4d3['mapKey']]:_0x3bb798},'limit':0x1,'order':[['updatedAt',_0xc483('0x8b')]]}]}]})[_0xc483('0x27')](handleEntityNotFound(_0x2934a4,null))[_0xc483('0x27')](function(_0x5a842e){if(_0x5a842e&&_0x5a842e['List']){_0x4920b3=_0x5a842e[_0xc483('0x3d')]({'plain':!![]});if(_0x4920b3[_0xc483('0x89')]&&_0x4920b3['List'][_0xc483('0x8a')]['length']){return _0x4920b3['List']['Contacts'][0x0];}return db['CmContact'][_0xc483('0x63')](_[_0xc483('0x1f')](_0x599b58[_0xc483('0x6a')],{'firstName':_0x3bb798,[_0x5a842e[_0xc483('0x83')]]:_0x3bb798,'phone':_0x3bb798,'ListId':_0x4920b3[_0xc483('0x7f')]}));}})[_0xc483('0x27')](handleEntityNotFound(_0x2934a4,null))[_0xc483('0x27')](function(_0xa8273){if(_0xa8273){_0x2e45df=_0xa8273;return db['OpenchannelInteraction'][_0xc483('0x62')]({'where':{'ContactId':_0x2e45df['id'],'closed':![],'OpenchannelAccountId':_0x4920b3['id']}})[_0xc483('0x27')](function(_0x4e8a77){if(_0x4e8a77){return[_0x4e8a77,![]];}return db[_0xc483('0x97')][_0xc483('0x63')]({'UserId':_0x599b58[_0xc483('0x64')]['id'],'ContactId':_0x2e45df['id'],'OpenchannelAccountId':_0x4920b3['id'],'lastMsgDirection':_0xc483('0xbd'),'Messages':[_['merge'](_0x599b58['body'],{'read':![],'body':_0x599b58['body'][_0xc483('0x6a')],'OpenchannelAccountId':_0x4920b3['id'],'UserId':_0x599b58[_0xc483('0x64')]['id'],'ContactId':_0x2e45df['id']})]},{'include':[{'model':db[_0xc483('0xa1')],'as':_0xc483('0xbe')}]})[_0xc483('0x27')](function(_0x553284){return[_0x553284,!![]];});});}})[_0xc483('0x99')](function(_0x5bb90d,_0x1d41b2){if(_0x1d41b2){return _0x5bb90d;}return db[_0xc483('0xa1')][_0xc483('0x63')](_[_0xc483('0x56')](_0x599b58[_0xc483('0x6a')],{'read':![],'body':_0x599b58['body'][_0xc483('0x6a')],'OpenchannelAccountId':_0x4920b3['id'],'OpenchannelInteractionId':_0x5bb90d['id'],'UserId':_0x599b58['user']['id'],'ContactId':_0x2e45df['id']}))[_0xc483('0x27')](function(_0x30d349){_0x5bb90d['dataValues'][_0xc483('0xbe')]=[];_0x5bb90d[_0xc483('0xbf')]['Messages'][_0xc483('0x9e')](_0x30d349[_0xc483('0xbf')]);return _0x5bb90d;});});}})[_0xc483('0x27')](respondWithResult(_0x2934a4,null))[_0xc483('0x30')](handleError(_0x2934a4,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index c5e8479..ea49bb0 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 _0x13f6=['save','update','remove','emit','hasOwnProperty','events','../../mysqldb'];(function(_0x23092b,_0x13e81e){var _0x307d77=function(_0x3f820a){while(--_0x3f820a){_0x23092b['push'](_0x23092b['shift']());}};_0x307d77(++_0x13e81e);}(_0x13f6,0x124));var _0x613f=function(_0x585950,_0xf4ca1f){_0x585950=_0x585950-0x0;var _0x35c421=_0x13f6[_0x585950];return _0x35c421;};'use strict';var EventEmitter=require(_0x613f('0x0'));var OpenchannelAccount=require(_0x613f('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x613f('0x2'),'afterUpdate':_0x613f('0x3'),'afterDestroy':_0x613f('0x4')};function emitEvent(_0x5414ff){return function(_0x179f6e,_0x1e01e3,_0x20af2f){OpenchannelAccountEvents['emit'](_0x5414ff+':'+_0x179f6e['id'],_0x179f6e);OpenchannelAccountEvents[_0x613f('0x5')](_0x5414ff,_0x179f6e);_0x20af2f(null);};}for(var e in events){if(events[_0x613f('0x6')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0xa9e0=['hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelAccount','update','emit'];(function(_0x33c9f8,_0x5aedbb){var _0x2d7004=function(_0x4f4f43){while(--_0x4f4f43){_0x33c9f8['push'](_0x33c9f8['shift']());}};_0x2d7004(++_0x5aedbb);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'use strict';var EventEmitter=require(_0x0a9e('0x0'));var OpenchannelAccount=require(_0x0a9e('0x1'))['db'][_0x0a9e('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x0a9e('0x3'),'afterDestroy':'remove'};function emitEvent(_0x333808){return function(_0x432180,_0x2ab90b,_0x991246){OpenchannelAccountEvents[_0x0a9e('0x4')](_0x333808+':'+_0x432180['id'],_0x432180);OpenchannelAccountEvents['emit'](_0x333808,_0x432180);_0x991246(null);};}for(var e in events){if(events[_0x0a9e('0x5')](e)){var event=events[e];OpenchannelAccount[_0x0a9e('0x6')](e,emitEvent(event));}}module[_0x0a9e('0x7')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 20590c7..0680f58 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(_0x471289,_0x263668){var _0x210939=function(_0x443a14){while(--_0x443a14){_0x471289['push'](_0x471289['shift']());}};_0x210939(++_0x263668);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'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(_0x2defdd,_0x4ae8f6){var _0x2a4dc1=function(_0x2f7741){while(--_0x2f7741){_0x2defdd['push'](_0x2defdd['shift']());}};_0x2a4dc1(++_0x4ae8f6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'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 52d9c52..3f5e6fa 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 _0x97c1=['../../config/environment','http','redis','defaults','register','request','then','info','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','OpenchannelAccount,\x20%s,\x20%s','message','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3be2e2,_0x5c166d){var _0x53b9c5=function(_0x248aa7){while(--_0x248aa7){_0x3be2e2['push'](_0x3be2e2['shift']());}};_0x53b9c5(++_0x5c166d);}(_0x97c1,0xdf));var _0x197c=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x97c1[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x197c('0x0'));var util=require(_0x197c('0x1'));var moment=require('moment');var BPromise=require(_0x197c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x197c('0x3'))['db'];var utils=require(_0x197c('0x4'));var logger=require(_0x197c('0x5'))(_0x197c('0x6'));var config=require(_0x197c('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x197c('0x8')]({'port':0x232a});config[_0x197c('0x9')]=_[_0x197c('0xa')](config[_0x197c('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x197c('0x9')]));require('./openchannelAccount.socket')[_0x197c('0xb')](socket);function respondWithRpcPromise(_0x3e83e6,_0x853d68,_0x286af5){return new BPromise(function(_0x49cd61,_0x46fb80){return client[_0x197c('0xc')](_0x3e83e6,_0x286af5)[_0x197c('0xd')](function(_0x1c5428){logger[_0x197c('0xe')]('OpenchannelAccount,\x20%s,\x20%s',_0x853d68,_0x197c('0xf'));logger[_0x197c('0x10')](_0x197c('0x11'),_0x853d68,_0x197c('0xf'),JSON['stringify'](_0x1c5428));if(_0x1c5428[_0x197c('0x12')]){if(_0x1c5428[_0x197c('0x12')][_0x197c('0x13')]===0x1f4){logger[_0x197c('0x12')](_0x197c('0x14'),_0x853d68,_0x1c5428[_0x197c('0x12')]['message']);return _0x46fb80(_0x1c5428['error'][_0x197c('0x15')]);}logger[_0x197c('0x12')](_0x197c('0x14'),_0x853d68,_0x1c5428[_0x197c('0x12')][_0x197c('0x15')]);return _0x49cd61(_0x1c5428[_0x197c('0x12')][_0x197c('0x15')]);}else{logger[_0x197c('0xe')]('OpenchannelAccount,\x20%s,\x20%s',_0x853d68,_0x197c('0xf'));_0x49cd61(_0x1c5428['result']['message']);}})[_0x197c('0x16')](function(_0x226756){logger[_0x197c('0x12')](_0x197c('0x14'),_0x853d68,_0x226756);_0x46fb80(_0x226756);});});} \ No newline at end of file +var _0xbf6e=['client','http','redis','defaults','socket.io-emitter','./openchannelAccount.socket','request','then','info','request\x20sent','debug','stringify','error','code','message','OpenchannelAccount,\x20%s,\x20%s','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x329eef,_0x1d6364){var _0x5a1b7f=function(_0x32810d){while(--_0x32810d){_0x329eef['push'](_0x329eef['shift']());}};_0x5a1b7f(++_0x1d6364);}(_0xbf6e,0x149));var _0xebf6=function(_0x2ff142,_0x1616be){_0x2ff142=_0x2ff142-0x0;var _0x3c2e10=_0xbf6e[_0x2ff142];return _0x3c2e10;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xebf6('0x0'));var BPromise=require(_0xebf6('0x1'));var rs=require(_0xebf6('0x2'));var fs=require('fs');var Redis=require(_0xebf6('0x3'));var db=require(_0xebf6('0x4'))['db'];var utils=require(_0xebf6('0x5'));var logger=require(_0xebf6('0x6'))('rpc');var config=require(_0xebf6('0x7'));var jayson=require(_0xebf6('0x8'));var client=jayson[_0xebf6('0x9')][_0xebf6('0xa')]({'port':0x232a});config[_0xebf6('0xb')]=_[_0xebf6('0xc')](config[_0xebf6('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xebf6('0xd'))(new Redis(config[_0xebf6('0xb')]));require(_0xebf6('0xe'))['register'](socket);function respondWithRpcPromise(_0x38cee4,_0x14f41e,_0x5c6727){return new BPromise(function(_0x3d4b60,_0x231d6b){return client[_0xebf6('0xf')](_0x38cee4,_0x5c6727)[_0xebf6('0x10')](function(_0x1bd481){logger[_0xebf6('0x11')]('OpenchannelAccount,\x20%s,\x20%s',_0x14f41e,_0xebf6('0x12'));logger[_0xebf6('0x13')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x14f41e,_0xebf6('0x12'),JSON[_0xebf6('0x14')](_0x1bd481));if(_0x1bd481[_0xebf6('0x15')]){if(_0x1bd481[_0xebf6('0x15')][_0xebf6('0x16')]===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x14f41e,_0x1bd481['error'][_0xebf6('0x17')]);return _0x231d6b(_0x1bd481[_0xebf6('0x15')]['message']);}logger[_0xebf6('0x15')](_0xebf6('0x18'),_0x14f41e,_0x1bd481[_0xebf6('0x15')][_0xebf6('0x17')]);return _0x3d4b60(_0x1bd481[_0xebf6('0x15')][_0xebf6('0x17')]);}else{logger[_0xebf6('0x11')](_0xebf6('0x18'),_0x14f41e,_0xebf6('0x12'));_0x3d4b60(_0x1bd481[_0xebf6('0x19')]['message']);}})['catch'](function(_0xe03844){logger[_0xebf6('0x15')](_0xebf6('0x18'),_0x14f41e,_0xe03844);_0x231d6b(_0xe03844);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 63c7c34..0ebda87 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 _0x9f62=['save','update','removeListener','register','length'];(function(_0x3a4318,_0x13c6eb){var _0x36d746=function(_0x508617){while(--_0x508617){_0x3a4318['push'](_0x3a4318['shift']());}};_0x36d746(++_0x13c6eb);}(_0x9f62,0x154));var _0x29f6=function(_0x5d8284,_0x26db89){_0x5d8284=_0x5d8284-0x0;var _0x2afddc=_0x9f62[_0x5d8284];return _0x2afddc;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0x29f6('0x0'),'remove',_0x29f6('0x1')];function createListener(_0x254ab3,_0x548050){return function(_0x5618b7){_0x548050['emit'](_0x254ab3,_0x5618b7);};}function removeListener(_0x258ddd,_0x2f0420){return function(){OpenchannelAccountEvents[_0x29f6('0x2')](_0x258ddd,_0x2f0420);};}exports[_0x29f6('0x3')]=function(_0x595034){for(var _0xf66137=0x0,_0x272876=events[_0x29f6('0x4')];_0xf66137<_0x272876;_0xf66137++){var _0x2ba602=events[_0xf66137];var _0x416c6c=createListener('openchannelAccount:'+_0x2ba602,_0x595034);OpenchannelAccountEvents['on'](_0x2ba602,_0x416c6c);}}; \ No newline at end of file +var _0x220b=['update','removeListener','register','length','openchannelAccount:','save','remove'];(function(_0xe2beb3,_0x57748c){var _0x4e0442=function(_0x2302cc){while(--_0x2302cc){_0xe2beb3['push'](_0xe2beb3['shift']());}};_0x4e0442(++_0x57748c);}(_0x220b,0x1a2));var _0xb220=function(_0x256d6a,_0x2f002f){_0x256d6a=_0x256d6a-0x0;var _0x460058=_0x220b[_0x256d6a];return _0x460058;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0xb220('0x0'),_0xb220('0x1'),_0xb220('0x2')];function createListener(_0xec63f9,_0x53992c){return function(_0x2d2ad3){_0x53992c['emit'](_0xec63f9,_0x2d2ad3);};}function removeListener(_0x1aa3b8,_0x4dc358){return function(){OpenchannelAccountEvents[_0xb220('0x3')](_0x1aa3b8,_0x4dc358);};}exports[_0xb220('0x4')]=function(_0x1d2be4){for(var _0x366a4d=0x0,_0x5d7d19=events[_0xb220('0x5')];_0x366a4d<_0x5d7d19;_0x366a4d++){var _0x7fa0dd=events[_0x366a4d];var _0x5b83b9=createListener(_0xb220('0x6')+_0x7fa0dd,_0x1d2be4);OpenchannelAccountEvents['on'](_0x7fa0dd,_0x5b83b9);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 540c8d8..0fcacad 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 _0x60a1=['show','create','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index'];(function(_0x3efcd5,_0x9bbba3){var _0x54e50a=function(_0x34d7f4){while(--_0x34d7f4){_0x3efcd5['push'](_0x3efcd5['shift']());}};_0x54e50a(++_0x9bbba3);}(_0x60a1,0x1ac));var _0x160a=function(_0x5e86fe,_0x302f50){_0x5e86fe=_0x5e86fe-0x0;var _0x50ce69=_0x60a1[_0x5e86fe];return _0x50ce69;};'use strict';var multer=require(_0x160a('0x0'));var util=require(_0x160a('0x1'));var path=require(_0x160a('0x2'));var timeout=require(_0x160a('0x3'));var express=require('express');var router=express[_0x160a('0x4')]();var fs_extra=require(_0x160a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x160a('0x6'));var config=require(_0x160a('0x7'));var controller=require(_0x160a('0x8'));router[_0x160a('0x9')]('/',auth[_0x160a('0xa')](),controller[_0x160a('0xb')]);router[_0x160a('0x9')]('/:id',auth[_0x160a('0xa')](),controller[_0x160a('0xc')]);router['post']('/',auth[_0x160a('0xa')](),controller[_0x160a('0xd')]);router[_0x160a('0xe')]('/:id',auth[_0x160a('0xa')](),controller[_0x160a('0xf')]);router[_0x160a('0x10')](_0x160a('0x11'),auth[_0x160a('0xa')](),controller[_0x160a('0x12')]);module[_0x160a('0x13')]=router; \ No newline at end of file +var _0xb61f=['destroy','exports','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./openchannelApplication.controller','get','isAuthenticated','index','/:id','post','put'];(function(_0xe93ea9,_0x5401c2){var _0x28bc56=function(_0x476e85){while(--_0x476e85){_0xe93ea9['push'](_0xe93ea9['shift']());}};_0x28bc56(++_0x5401c2);}(_0xb61f,0x136));var _0xfb61=function(_0x5750c0,_0x5beab2){_0x5750c0=_0x5750c0-0x0;var _0x50df82=_0xb61f[_0x5750c0];return _0x50df82;};'use strict';var multer=require('multer');var util=require(_0xfb61('0x0'));var path=require('path');var timeout=require(_0xfb61('0x1'));var express=require('express');var router=express[_0xfb61('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xfb61('0x3'));var interaction=require(_0xfb61('0x4'));var config=require('../../config/environment');var controller=require(_0xfb61('0x5'));router[_0xfb61('0x6')]('/',auth[_0xfb61('0x7')](),controller[_0xfb61('0x8')]);router[_0xfb61('0x6')](_0xfb61('0x9'),auth[_0xfb61('0x7')](),controller['show']);router[_0xfb61('0xa')]('/',auth[_0xfb61('0x7')](),controller['create']);router[_0xfb61('0xb')](_0xfb61('0x9'),auth[_0xfb61('0x7')](),controller['update']);router['delete'](_0xfb61('0x9'),auth[_0xfb61('0x7')](),controller[_0xfb61('0xc')]);module[_0xfb61('0xd')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 2eb5e53..b8b99ac 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 _0x02b6=['STRING','*,*,*,*','sequelize','exports','INTEGER','noop','TEXT'];(function(_0x24a9ed,_0x5ed83e){var _0x1f1390=function(_0x2f4945){while(--_0x2f4945){_0x24a9ed['push'](_0x24a9ed['shift']());}};_0x1f1390(++_0x5ed83e);}(_0x02b6,0xa3));var _0x602b=function(_0x5681fb,_0x3baf28){_0x5681fb=_0x5681fb-0x0;var _0x3d1f31=_0x02b6[_0x5681fb];return _0x3d1f31;};'use strict';var Sequelize=require(_0x602b('0x0'));module[_0x602b('0x1')]={'priority':{'type':Sequelize[_0x602b('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x602b('0x3')},'appdata':{'type':Sequelize[_0x602b('0x4')]()},'description':{'type':Sequelize[_0x602b('0x5')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x602b('0x6')}}; \ No newline at end of file +var _0xd923=['TEXT','*,*,*,*','sequelize','INTEGER','STRING'];(function(_0x21bc19,_0x56723a){var _0x336f21=function(_0x5450e4){while(--_0x5450e4){_0x21bc19['push'](_0x21bc19['shift']());}};_0x336f21(++_0x56723a);}(_0xd923,0x1dd));var _0x3d92=function(_0x447d85,_0x7e0934){_0x447d85=_0x447d85-0x0;var _0x32d431=_0xd923[_0x447d85];return _0x32d431;};'use strict';var Sequelize=require(_0x3d92('0x0'));module['exports']={'priority':{'type':Sequelize[_0x3d92('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x3d92('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x3d92('0x3')]()},'description':{'type':Sequelize[_0x3d92('0x2')]},'interval':{'type':Sequelize[_0x3d92('0x2')],'defaultValue':_0x3d92('0x4')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index a2ceb53..be77146 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 _0x960d=['../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','apply','update','then','destroy','error','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','fields','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util'];(function(_0x239473,_0x4f5af6){var _0x26b6a7=function(_0x5b1f87){while(--_0x5b1f87){_0x239473['push'](_0x239473['shift']());}};_0x26b6a7(++_0x4f5af6);}(_0x960d,0x1e2));var _0xd960=function(_0x35f7b4,_0x2481bc){_0x35f7b4=_0x35f7b4-0x0;var _0x242e40=_0x960d[_0x35f7b4];return _0x242e40;};'use strict';var emlformat=require(_0xd960('0x0'));var rimraf=require(_0xd960('0x1'));var zipdir=require(_0xd960('0x2'));var jsonpatch=require(_0xd960('0x3'));var rp=require('request-promise');var moment=require(_0xd960('0x4'));var BPromise=require(_0xd960('0x5'));var Mustache=require('mustache');var util=require(_0xd960('0x6'));var path=require(_0xd960('0x7'));var sox=require(_0xd960('0x8'));var csv=require(_0xd960('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd960('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd960('0xb'));var jsforce=require(_0xd960('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd960('0x9'));var querystring=require(_0xd960('0xd'));var Papa=require(_0xd960('0xe'));var Redis=require(_0xd960('0xf'));var authService=require(_0xd960('0x10'));var qs=require(_0xd960('0x11'));var as=require(_0xd960('0x12'));var hardwareService=require(_0xd960('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xd960('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xd960('0x15'));var db=require(_0xd960('0x16'))['db'];function respondWithStatusCode(_0x5e6c7d,_0x457a8e){_0x457a8e=_0x457a8e||0xcc;return function(_0x15d960){if(_0x15d960){return _0x5e6c7d[_0xd960('0x17')](_0x457a8e);}return _0x5e6c7d['status'](_0x457a8e)[_0xd960('0x18')]();};}function respondWithResult(_0xfdb2ff,_0x3f571d){_0x3f571d=_0x3f571d||0xc8;return function(_0x109db4){if(_0x109db4){return _0xfdb2ff[_0xd960('0x19')](_0x3f571d)[_0xd960('0x1a')](_0x109db4);}};}function respondWithFilteredResult(_0x2f6e65,_0x57937f){return function(_0x9c06cc){if(_0x9c06cc){var _0x1f924d=typeof _0x57937f['offset']===_0xd960('0x1b')&&typeof _0x57937f[_0xd960('0x1c')]==='undefined';var _0x8ec3ad=_0x9c06cc[_0xd960('0x1d')];var _0x561c4f=_0x1f924d?0x0:_0x57937f[_0xd960('0x1e')];var _0x2720bd=_0x1f924d?_0x9c06cc[_0xd960('0x1d')]:_0x57937f['offset']+_0x57937f[_0xd960('0x1c')];var _0x343193;if(_0x2720bd>=_0x8ec3ad){_0x2720bd=_0x8ec3ad;_0x343193=0xc8;}else{_0x343193=0xce;}_0x2f6e65[_0xd960('0x19')](_0x343193);return _0x2f6e65[_0xd960('0x1f')]('Content-Range',_0x561c4f+'-'+_0x2720bd+'/'+_0x8ec3ad)[_0xd960('0x1a')](_0x9c06cc);}return null;};}function patchUpdates(_0x377e8f){return function(_0x1a1b8f){try{jsonpatch[_0xd960('0x20')](_0x1a1b8f,_0x377e8f,!![]);}catch(_0x3dba3a){return BPromise['reject'](_0x3dba3a);}return _0x1a1b8f['save']();};}function saveUpdates(_0x19a5b3,_0x575117){return function(_0xd6f02e){if(_0xd6f02e){return _0xd6f02e[_0xd960('0x21')](_0x19a5b3)[_0xd960('0x22')](function(_0x17cb28){return _0x17cb28;});}return null;};}function removeEntity(_0x21e754,_0x1e3ad0){return function(_0x3800a2){if(_0x3800a2){return _0x3800a2[_0xd960('0x23')]()[_0xd960('0x22')](function(){_0x21e754[_0xd960('0x19')](0xcc)[_0xd960('0x18')]();});}};}function handleEntityNotFound(_0x2f4265,_0x134427){return function(_0x33a9b7){if(!_0x33a9b7){_0x2f4265[_0xd960('0x17')](0x194);}return _0x33a9b7;};}function handleError(_0x3fe60c,_0x2d0c4b){_0x2d0c4b=_0x2d0c4b||0x1f4;return function(_0x2b6def){logger[_0xd960('0x24')](_0x2b6def['stack']);if(_0x2b6def[_0xd960('0x25')]){delete _0x2b6def[_0xd960('0x25')];}_0x3fe60c[_0xd960('0x19')](_0x2d0c4b)[_0xd960('0x26')](_0x2b6def);};}exports[_0xd960('0x27')]=function(_0x1ee642,_0x466b2a){var _0x42d7bf={},_0xabd164={},_0x9addd0={'count':0x0,'rows':[]};var _0x2a3e46=_[_0xd960('0x28')](db[_0xd960('0x29')][_0xd960('0x2a')],function(_0x4f7247){return{'name':_0x4f7247[_0xd960('0x2b')],'type':_0x4f7247['type']['key']};});_0xabd164[_0xd960('0x2c')]=_[_0xd960('0x28')](_0x2a3e46,_0xd960('0x25'));_0xabd164[_0xd960('0x2d')]=_[_0xd960('0x2e')](_0x1ee642[_0xd960('0x2d')]);_0xabd164[_0xd960('0x2f')]=_[_0xd960('0x30')](_0xabd164[_0xd960('0x2c')],_0xabd164[_0xd960('0x2d')]);_0x42d7bf[_0xd960('0x31')]=_[_0xd960('0x30')](_0xabd164[_0xd960('0x2c')],qs['fields'](_0x1ee642['query']['fields']));_0x42d7bf[_0xd960('0x31')]=_0x42d7bf[_0xd960('0x31')][_0xd960('0x32')]?_0x42d7bf['attributes']:_0xabd164[_0xd960('0x2c')];if(!_0x1ee642['query'][_0xd960('0x33')](_0xd960('0x34'))){_0x42d7bf[_0xd960('0x1c')]=qs['limit'](_0x1ee642[_0xd960('0x2d')][_0xd960('0x1c')]);_0x42d7bf['offset']=qs[_0xd960('0x1e')](_0x1ee642['query'][_0xd960('0x1e')]);}_0x42d7bf[_0xd960('0x35')]=qs[_0xd960('0x36')](_0x1ee642[_0xd960('0x2d')][_0xd960('0x36')]);_0x42d7bf[_0xd960('0x37')]=qs[_0xd960('0x2f')](_[_0xd960('0x38')](_0x1ee642[_0xd960('0x2d')],_0xabd164[_0xd960('0x2f')]),_0x2a3e46);if(_0x1ee642['query'][_0xd960('0x39')]){_0x42d7bf[_0xd960('0x37')]=_[_0xd960('0x3a')](_0x42d7bf[_0xd960('0x37')],{'$or':_['map'](_0x2a3e46,function(_0x56bee4){if(_0x56bee4['type']!==_0xd960('0x3b')){var _0x20a007={};_0x20a007[_0x56bee4[_0xd960('0x25')]]={'$like':'%'+_0x1ee642['query']['filter']+'%'};return _0x20a007;}})});}_0x42d7bf=_['merge']({},_0x42d7bf,_0x1ee642['options']);var _0x38cd1b={'where':_0x42d7bf[_0xd960('0x37')]};return db[_0xd960('0x29')]['count'](_0x38cd1b)[_0xd960('0x22')](function(_0x14490d){_0x9addd0[_0xd960('0x1d')]=_0x14490d;if(_0x1ee642[_0xd960('0x2d')][_0xd960('0x3c')]){_0x42d7bf[_0xd960('0x3d')]=[{'all':!![]}];}return db[_0xd960('0x29')][_0xd960('0x3e')](_0x42d7bf);})[_0xd960('0x22')](function(_0x2f6b77){_0x9addd0[_0xd960('0x3f')]=_0x2f6b77;return _0x9addd0;})[_0xd960('0x22')](respondWithFilteredResult(_0x466b2a,_0x42d7bf))[_0xd960('0x40')](handleError(_0x466b2a,null));};exports[_0xd960('0x41')]=function(_0x55428f,_0x2b0e9a){var _0x3b172b={'raw':!![],'where':{'id':_0x55428f[_0xd960('0x42')]['id']}},_0x308cb6={};_0x308cb6['model']=_[_0xd960('0x2e')](db[_0xd960('0x29')][_0xd960('0x2a')]);_0x308cb6['query']=_[_0xd960('0x2e')](_0x55428f[_0xd960('0x2d')]);_0x308cb6[_0xd960('0x2f')]=_['intersection'](_0x308cb6[_0xd960('0x2c')],_0x308cb6[_0xd960('0x2d')]);_0x3b172b['attributes']=_[_0xd960('0x30')](_0x308cb6[_0xd960('0x2c')],qs[_0xd960('0x43')](_0x55428f['query'][_0xd960('0x43')]));_0x3b172b[_0xd960('0x31')]=_0x3b172b[_0xd960('0x31')][_0xd960('0x32')]?_0x3b172b[_0xd960('0x31')]:_0x308cb6['model'];if(_0x55428f[_0xd960('0x2d')][_0xd960('0x3c')]){_0x3b172b[_0xd960('0x3d')]=[{'all':!![]}];}_0x3b172b=_['merge']({},_0x3b172b,_0x55428f[_0xd960('0x44')]);return db[_0xd960('0x29')][_0xd960('0x45')](_0x3b172b)[_0xd960('0x22')](handleEntityNotFound(_0x2b0e9a,null))[_0xd960('0x22')](respondWithResult(_0x2b0e9a,null))[_0xd960('0x40')](handleError(_0x2b0e9a,null));};exports[_0xd960('0x46')]=function(_0x5ee3a1,_0x4172b5){return db['OpenchannelApplication'][_0xd960('0x46')](_0x5ee3a1[_0xd960('0x47')],{})[_0xd960('0x22')](respondWithResult(_0x4172b5,0xc9))[_0xd960('0x40')](handleError(_0x4172b5,null));};exports[_0xd960('0x21')]=function(_0x2e6bcd,_0x51fa35){if(_0x2e6bcd[_0xd960('0x47')]['id']){delete _0x2e6bcd[_0xd960('0x47')]['id'];}return db[_0xd960('0x29')][_0xd960('0x45')]({'where':{'id':_0x2e6bcd['params']['id']}})[_0xd960('0x22')](handleEntityNotFound(_0x51fa35,null))[_0xd960('0x22')](saveUpdates(_0x2e6bcd[_0xd960('0x47')],null))['then'](respondWithResult(_0x51fa35,null))[_0xd960('0x40')](handleError(_0x51fa35,null));};exports['destroy']=function(_0x36c436,_0x234fc3){return db[_0xd960('0x29')][_0xd960('0x45')]({'where':{'id':_0x36c436[_0xd960('0x42')]['id']}})['then'](handleEntityNotFound(_0x234fc3,null))[_0xd960('0x22')](removeEntity(_0x234fc3,null))[_0xd960('0x40')](handleError(_0x234fc3,null));}; \ No newline at end of file +var _0x0b15=['name','send','index','map','OpenchannelApplication','fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','merge','VIRTUAL','options','include','findAll','show','rawAttributes','keys','find','catch','update','body','params','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','then','destroy','sendStatus','stack'];(function(_0x2237dd,_0x2806f1){var _0x17e5fe=function(_0x3c6bc4){while(--_0x3c6bc4){_0x2237dd['push'](_0x2237dd['shift']());}};_0x17e5fe(++_0x2806f1);}(_0x0b15,0xf1));var _0x50b1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0b15[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x50b1('0x0'));var zipdir=require(_0x50b1('0x1'));var jsonpatch=require(_0x50b1('0x2'));var rp=require(_0x50b1('0x3'));var moment=require('moment');var BPromise=require(_0x50b1('0x4'));var Mustache=require(_0x50b1('0x5'));var util=require(_0x50b1('0x6'));var path=require(_0x50b1('0x7'));var sox=require(_0x50b1('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x50b1('0x9'));var _=require(_0x50b1('0xa'));var squel=require(_0x50b1('0xb'));var crypto=require('crypto');var jsforce=require(_0x50b1('0xc'));var deskjs=require(_0x50b1('0xd'));var toCsv=require(_0x50b1('0xe'));var querystring=require(_0x50b1('0xf'));var Papa=require(_0x50b1('0x10'));var Redis=require(_0x50b1('0x11'));var authService=require(_0x50b1('0x12'));var qs=require(_0x50b1('0x13'));var as=require(_0x50b1('0x14'));var hardwareService=require(_0x50b1('0x15'));var logger=require(_0x50b1('0x16'))(_0x50b1('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x50b1('0x18'))['db'];function respondWithStatusCode(_0x5ce0d2,_0xf3608c){_0xf3608c=_0xf3608c||0xcc;return function(_0x35c7bb){if(_0x35c7bb){return _0x5ce0d2['sendStatus'](_0xf3608c);}return _0x5ce0d2[_0x50b1('0x19')](_0xf3608c)[_0x50b1('0x1a')]();};}function respondWithResult(_0x436b48,_0x2fda70){_0x2fda70=_0x2fda70||0xc8;return function(_0x12cfd4){if(_0x12cfd4){return _0x436b48[_0x50b1('0x19')](_0x2fda70)[_0x50b1('0x1b')](_0x12cfd4);}};}function respondWithFilteredResult(_0x3be927,_0x308633){return function(_0x50281e){if(_0x50281e){var _0x17ab64=typeof _0x308633[_0x50b1('0x1c')]===_0x50b1('0x1d')&&typeof _0x308633['limit']===_0x50b1('0x1d');var _0x3d2f1f=_0x50281e[_0x50b1('0x1e')];var _0x33d9b4=_0x17ab64?0x0:_0x308633[_0x50b1('0x1c')];var _0x4a4dc5=_0x17ab64?_0x50281e['count']:_0x308633['offset']+_0x308633['limit'];var _0x312e58;if(_0x4a4dc5>=_0x3d2f1f){_0x4a4dc5=_0x3d2f1f;_0x312e58=0xc8;}else{_0x312e58=0xce;}_0x3be927[_0x50b1('0x19')](_0x312e58);return _0x3be927['set'](_0x50b1('0x1f'),_0x33d9b4+'-'+_0x4a4dc5+'/'+_0x3d2f1f)[_0x50b1('0x1b')](_0x50281e);}return null;};}function patchUpdates(_0x2a1571){return function(_0x57b869){try{jsonpatch[_0x50b1('0x20')](_0x57b869,_0x2a1571,!![]);}catch(_0x1a7141){return BPromise[_0x50b1('0x21')](_0x1a7141);}return _0x57b869[_0x50b1('0x22')]();};}function saveUpdates(_0x14f214,_0x380e51){return function(_0x541ea0){if(_0x541ea0){return _0x541ea0['update'](_0x14f214)[_0x50b1('0x23')](function(_0x2dd970){return _0x2dd970;});}return null;};}function removeEntity(_0x30d521,_0xd7fed2){return function(_0x1147da){if(_0x1147da){return _0x1147da[_0x50b1('0x24')]()[_0x50b1('0x23')](function(){_0x30d521[_0x50b1('0x19')](0xcc)[_0x50b1('0x1a')]();});}};}function handleEntityNotFound(_0x548ae1,_0x2469e3){return function(_0x5ab32a){if(!_0x5ab32a){_0x548ae1[_0x50b1('0x25')](0x194);}return _0x5ab32a;};}function handleError(_0x3b2bbd,_0x5417cb){_0x5417cb=_0x5417cb||0x1f4;return function(_0x1b5b59){logger['error'](_0x1b5b59[_0x50b1('0x26')]);if(_0x1b5b59[_0x50b1('0x27')]){delete _0x1b5b59['name'];}_0x3b2bbd[_0x50b1('0x19')](_0x5417cb)[_0x50b1('0x28')](_0x1b5b59);};}exports[_0x50b1('0x29')]=function(_0x57765d,_0x45fb8b){var _0x292aff={},_0x17586d={},_0xcf539e={'count':0x0,'rows':[]};var _0x1edfcf=_[_0x50b1('0x2a')](db[_0x50b1('0x2b')]['rawAttributes'],function(_0x38f80f){return{'name':_0x38f80f[_0x50b1('0x2c')],'type':_0x38f80f['type']['key']};});_0x17586d[_0x50b1('0x2d')]=_['map'](_0x1edfcf,_0x50b1('0x27'));_0x17586d[_0x50b1('0x2e')]=_['keys'](_0x57765d[_0x50b1('0x2e')]);_0x17586d[_0x50b1('0x2f')]=_[_0x50b1('0x30')](_0x17586d[_0x50b1('0x2d')],_0x17586d[_0x50b1('0x2e')]);_0x292aff[_0x50b1('0x31')]=_[_0x50b1('0x30')](_0x17586d[_0x50b1('0x2d')],qs[_0x50b1('0x32')](_0x57765d[_0x50b1('0x2e')][_0x50b1('0x32')]));_0x292aff[_0x50b1('0x31')]=_0x292aff['attributes'][_0x50b1('0x33')]?_0x292aff[_0x50b1('0x31')]:_0x17586d[_0x50b1('0x2d')];if(!_0x57765d[_0x50b1('0x2e')][_0x50b1('0x34')](_0x50b1('0x35'))){_0x292aff[_0x50b1('0x36')]=qs[_0x50b1('0x36')](_0x57765d['query'][_0x50b1('0x36')]);_0x292aff[_0x50b1('0x1c')]=qs[_0x50b1('0x1c')](_0x57765d[_0x50b1('0x2e')][_0x50b1('0x1c')]);}_0x292aff['order']=qs[_0x50b1('0x37')](_0x57765d[_0x50b1('0x2e')]['sort']);_0x292aff[_0x50b1('0x38')]=qs[_0x50b1('0x2f')](_['pick'](_0x57765d[_0x50b1('0x2e')],_0x17586d[_0x50b1('0x2f')]),_0x1edfcf);if(_0x57765d[_0x50b1('0x2e')]['filter']){_0x292aff[_0x50b1('0x38')]=_[_0x50b1('0x39')](_0x292aff[_0x50b1('0x38')],{'$or':_[_0x50b1('0x2a')](_0x1edfcf,function(_0x1a6fee){if(_0x1a6fee['type']!==_0x50b1('0x3a')){var _0x37668b={};_0x37668b[_0x1a6fee[_0x50b1('0x27')]]={'$like':'%'+_0x57765d['query']['filter']+'%'};return _0x37668b;}})});}_0x292aff=_[_0x50b1('0x39')]({},_0x292aff,_0x57765d[_0x50b1('0x3b')]);var _0x52b7e9={'where':_0x292aff[_0x50b1('0x38')]};return db[_0x50b1('0x2b')][_0x50b1('0x1e')](_0x52b7e9)[_0x50b1('0x23')](function(_0x3f0f64){_0xcf539e['count']=_0x3f0f64;if(_0x57765d['query']['includeAll']){_0x292aff[_0x50b1('0x3c')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0x50b1('0x3d')](_0x292aff);})[_0x50b1('0x23')](function(_0x336f3f){_0xcf539e['rows']=_0x336f3f;return _0xcf539e;})[_0x50b1('0x23')](respondWithFilteredResult(_0x45fb8b,_0x292aff))['catch'](handleError(_0x45fb8b,null));};exports[_0x50b1('0x3e')]=function(_0x5b1b6d,_0x4d2774){var _0x12a143={'raw':!![],'where':{'id':_0x5b1b6d['params']['id']}},_0x1071b9={};_0x1071b9[_0x50b1('0x2d')]=_['keys'](db['OpenchannelApplication'][_0x50b1('0x3f')]);_0x1071b9[_0x50b1('0x2e')]=_[_0x50b1('0x40')](_0x5b1b6d['query']);_0x1071b9[_0x50b1('0x2f')]=_[_0x50b1('0x30')](_0x1071b9[_0x50b1('0x2d')],_0x1071b9[_0x50b1('0x2e')]);_0x12a143[_0x50b1('0x31')]=_[_0x50b1('0x30')](_0x1071b9[_0x50b1('0x2d')],qs[_0x50b1('0x32')](_0x5b1b6d[_0x50b1('0x2e')]['fields']));_0x12a143[_0x50b1('0x31')]=_0x12a143['attributes'][_0x50b1('0x33')]?_0x12a143[_0x50b1('0x31')]:_0x1071b9[_0x50b1('0x2d')];if(_0x5b1b6d[_0x50b1('0x2e')]['includeAll']){_0x12a143[_0x50b1('0x3c')]=[{'all':!![]}];}_0x12a143=_['merge']({},_0x12a143,_0x5b1b6d['options']);return db['OpenchannelApplication'][_0x50b1('0x41')](_0x12a143)['then'](handleEntityNotFound(_0x4d2774,null))[_0x50b1('0x23')](respondWithResult(_0x4d2774,null))['catch'](handleError(_0x4d2774,null));};exports['create']=function(_0xe9dae,_0x19425c){return db[_0x50b1('0x2b')]['create'](_0xe9dae['body'],{})[_0x50b1('0x23')](respondWithResult(_0x19425c,0xc9))[_0x50b1('0x42')](handleError(_0x19425c,null));};exports[_0x50b1('0x43')]=function(_0x3ccf28,_0x5df625){if(_0x3ccf28[_0x50b1('0x44')]['id']){delete _0x3ccf28[_0x50b1('0x44')]['id'];}return db['OpenchannelApplication']['find']({'where':{'id':_0x3ccf28[_0x50b1('0x45')]['id']}})['then'](handleEntityNotFound(_0x5df625,null))[_0x50b1('0x23')](saveUpdates(_0x3ccf28[_0x50b1('0x44')],null))[_0x50b1('0x23')](respondWithResult(_0x5df625,null))[_0x50b1('0x42')](handleError(_0x5df625,null));};exports['destroy']=function(_0x1ed671,_0x340e8e){return db[_0x50b1('0x2b')][_0x50b1('0x41')]({'where':{'id':_0x1ed671[_0x50b1('0x45')]['id']}})[_0x50b1('0x23')](handleEntityNotFound(_0x340e8e,null))[_0x50b1('0x23')](removeEntity(_0x340e8e,null))[_0x50b1('0x42')](handleError(_0x340e8e,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 3af1b47..83d4f93 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 _0xd60d=['moment','request-promise','rimraf','./openchannelApplication.attributes','define','OpenchannelApplication','openchannel_applications','utf8mb4','util','../../config/logger','api'];(function(_0x45c48f,_0x4aa891){var _0xaf5037=function(_0x3e3c1f){while(--_0x3e3c1f){_0x45c48f['push'](_0x45c48f['shift']());}};_0xaf5037(++_0x4aa891);}(_0xd60d,0x17e));var _0xdd60=function(_0x264f2e,_0x619b7d){_0x264f2e=_0x264f2e-0x0;var _0x316d36=_0xd60d[_0x264f2e];return _0x316d36;};'use strict';var _=require('lodash');var util=require(_0xdd60('0x0'));var logger=require(_0xdd60('0x1'))(_0xdd60('0x2'));var moment=require(_0xdd60('0x3'));var BPromise=require('bluebird');var rp=require(_0xdd60('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdd60('0x5'));var config=require('../../config/environment');var attributes=require(_0xdd60('0x6'));module['exports']=function(_0xae8a62,_0x20a7dc){return _0xae8a62[_0xdd60('0x7')](_0xdd60('0x8'),attributes,{'tableName':_0xdd60('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdd60('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x80e9=['utf8mb4_unicode_ci','../../config/logger','api','request-promise','rimraf','../../config/environment','./openchannelApplication.attributes','define','OpenchannelApplication','openchannel_applications','utf8mb4'];(function(_0xf5d6b,_0x2b2036){var _0x4de3e0=function(_0x7e6c97){while(--_0x7e6c97){_0xf5d6b['push'](_0xf5d6b['shift']());}};_0x4de3e0(++_0x2b2036);}(_0x80e9,0x16c));var _0x980e=function(_0x2c2511,_0xfe834c){_0x2c2511=_0x2c2511-0x0;var _0x3a11da=_0x80e9[_0x2c2511];return _0x3a11da;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x980e('0x0'))(_0x980e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x980e('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x980e('0x3'));var config=require(_0x980e('0x4'));var attributes=require(_0x980e('0x5'));module['exports']=function(_0x11b007,_0xb7ce1){return _0x11b007[_0x980e('0x6')](_0x980e('0x7'),attributes,{'tableName':_0x980e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x980e('0x9'),'collate':_0x980e('0xa')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index a1c8fa1..6f69f3d 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 _0x8426=['update','body','options','raw','attributes','catch','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateOpenchannelApplication','OpenchannelApplication'];(function(_0x4523b3,_0x4cf522){var _0x63f922=function(_0x2ffd44){while(--_0x2ffd44){_0x4523b3['push'](_0x4523b3['shift']());}};_0x63f922(++_0x4cf522);}(_0x8426,0x114));var _0x6842=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x8426[_0x21a9d9];return _0x46adce;};'use strict';var _=require('lodash');var util=require(_0x6842('0x0'));var moment=require(_0x6842('0x1'));var BPromise=require(_0x6842('0x2'));var rs=require(_0x6842('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6842('0x4'));var logger=require(_0x6842('0x5'))(_0x6842('0x6'));var config=require(_0x6842('0x7'));var jayson=require(_0x6842('0x8'));var client=jayson[_0x6842('0x9')][_0x6842('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4cd01f,_0x18604c,_0x239072){return new BPromise(function(_0x27e392,_0x53c683){return client['request'](_0x4cd01f,_0x239072)[_0x6842('0xb')](function(_0x17d8e8){logger[_0x6842('0xc')](_0x6842('0xd'),_0x18604c,_0x6842('0xe'));logger[_0x6842('0xf')](_0x6842('0x10'),_0x18604c,'request\x20sent',JSON[_0x6842('0x11')](_0x17d8e8));if(_0x17d8e8[_0x6842('0x12')]){if(_0x17d8e8[_0x6842('0x12')][_0x6842('0x13')]===0x1f4){logger[_0x6842('0x12')]('OpenchannelApplication,\x20%s,\x20%s',_0x18604c,_0x17d8e8[_0x6842('0x12')][_0x6842('0x14')]);return _0x53c683(_0x17d8e8['error'][_0x6842('0x14')]);}logger[_0x6842('0x12')](_0x6842('0xd'),_0x18604c,_0x17d8e8['error'][_0x6842('0x14')]);return _0x27e392(_0x17d8e8[_0x6842('0x12')][_0x6842('0x14')]);}else{logger['info'](_0x6842('0xd'),_0x18604c,_0x6842('0xe'));_0x27e392(_0x17d8e8[_0x6842('0x15')][_0x6842('0x14')]);}})['catch'](function(_0x38141d){logger[_0x6842('0x12')](_0x6842('0xd'),_0x18604c,_0x38141d);_0x53c683(_0x38141d);});});}exports[_0x6842('0x16')]=function(_0x526fa5){var _0x4106c2=this;return new Promise(function(_0x581472,_0x456e35){return db[_0x6842('0x17')][_0x6842('0x18')](_0x526fa5[_0x6842('0x19')],{'raw':_0x526fa5[_0x6842('0x1a')]?_0x526fa5[_0x6842('0x1a')][_0x6842('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x526fa5[_0x6842('0x1a')]?_0x526fa5[_0x6842('0x1a')]['where']||null:null,'attributes':_0x526fa5[_0x6842('0x1a')]?_0x526fa5[_0x6842('0x1a')][_0x6842('0x1c')]||null:null,'limit':_0x526fa5[_0x6842('0x1a')]?_0x526fa5[_0x6842('0x1a')]['limit']||null:null})[_0x6842('0xb')](function(_0x442ad8){logger[_0x6842('0xc')]('UpdateOpenchannelApplication',_0x526fa5);logger['debug'](_0x6842('0x16'),_0x526fa5,JSON[_0x6842('0x11')](_0x442ad8));_0x581472(_0x442ad8);})[_0x6842('0x1d')](function(_0x4f313e){logger[_0x6842('0x12')](_0x6842('0x16'),_0x4f313e[_0x6842('0x14')],_0x526fa5);_0x456e35(_0x4106c2[_0x6842('0x12')](0x1f4,_0x4f313e[_0x6842('0x14')]));});});}; \ No newline at end of file +var _0xe9e3=['message','OpenchannelApplication,\x20%s,\x20%s','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','where','attributes','limit','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error'];(function(_0x22ac5b,_0x2ef85c){var _0x4b5cc4=function(_0x58cf23){while(--_0x58cf23){_0x22ac5b['push'](_0x22ac5b['shift']());}};_0x4b5cc4(++_0x2ef85c);}(_0xe9e3,0x1cf));var _0x3e9e=function(_0x42c6f1,_0x338d7b){_0x42c6f1=_0x42c6f1-0x0;var _0x3c7398=_0xe9e3[_0x42c6f1];return _0x3c7398;};'use strict';var _=require(_0x3e9e('0x0'));var util=require(_0x3e9e('0x1'));var moment=require(_0x3e9e('0x2'));var BPromise=require(_0x3e9e('0x3'));var rs=require(_0x3e9e('0x4'));var fs=require('fs');var Redis=require(_0x3e9e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3e9e('0x6'));var logger=require('../../config/logger')(_0x3e9e('0x7'));var config=require('../../config/environment');var jayson=require(_0x3e9e('0x8'));var client=jayson[_0x3e9e('0x9')][_0x3e9e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c2bad,_0x31b97f,_0x13c972){return new BPromise(function(_0x281e1d,_0x502e65){return client[_0x3e9e('0xb')](_0x1c2bad,_0x13c972)[_0x3e9e('0xc')](function(_0x4fa9cb){logger[_0x3e9e('0xd')]('OpenchannelApplication,\x20%s,\x20%s',_0x31b97f,_0x3e9e('0xe'));logger['debug']('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x31b97f,_0x3e9e('0xe'),JSON[_0x3e9e('0xf')](_0x4fa9cb));if(_0x4fa9cb['error']){if(_0x4fa9cb[_0x3e9e('0x10')]['code']===0x1f4){logger[_0x3e9e('0x10')]('OpenchannelApplication,\x20%s,\x20%s',_0x31b97f,_0x4fa9cb['error'][_0x3e9e('0x11')]);return _0x502e65(_0x4fa9cb[_0x3e9e('0x10')]['message']);}logger['error'](_0x3e9e('0x12'),_0x31b97f,_0x4fa9cb['error'][_0x3e9e('0x11')]);return _0x281e1d(_0x4fa9cb[_0x3e9e('0x10')][_0x3e9e('0x11')]);}else{logger[_0x3e9e('0xd')](_0x3e9e('0x12'),_0x31b97f,_0x3e9e('0xe'));_0x281e1d(_0x4fa9cb[_0x3e9e('0x13')][_0x3e9e('0x11')]);}})[_0x3e9e('0x14')](function(_0x51c50d){logger[_0x3e9e('0x10')](_0x3e9e('0x12'),_0x31b97f,_0x51c50d);_0x502e65(_0x51c50d);});});}exports[_0x3e9e('0x15')]=function(_0x5c3363){var _0x5220cf=this;return new Promise(function(_0x8416be,_0x33ac04){return db[_0x3e9e('0x16')][_0x3e9e('0x17')](_0x5c3363['body'],{'raw':_0x5c3363[_0x3e9e('0x18')]?_0x5c3363['options'][_0x3e9e('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c3363[_0x3e9e('0x18')]?_0x5c3363[_0x3e9e('0x18')][_0x3e9e('0x1a')]||null:null,'attributes':_0x5c3363[_0x3e9e('0x18')]?_0x5c3363[_0x3e9e('0x18')][_0x3e9e('0x1b')]||null:null,'limit':_0x5c3363[_0x3e9e('0x18')]?_0x5c3363[_0x3e9e('0x18')][_0x3e9e('0x1c')]||null:null})[_0x3e9e('0xc')](function(_0x4b4017){logger[_0x3e9e('0xd')](_0x3e9e('0x15'),_0x5c3363);logger[_0x3e9e('0x1d')](_0x3e9e('0x15'),_0x5c3363,JSON[_0x3e9e('0xf')](_0x4b4017));_0x8416be(_0x4b4017);})[_0x3e9e('0x14')](function(_0x2b6070){logger[_0x3e9e('0x10')](_0x3e9e('0x15'),_0x2b6070['message'],_0x5c3363);_0x33ac04(_0x5220cf['error'](0x1f4,_0x2b6070[_0x3e9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 4ee6c0a..aa468ad 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 _0x392f=['/:id/tags','tracked','openchannel','addTags','put','openchannelinteraction:update','update','openchannelinteraction:destroy','destroy','delete','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','show','getMessages','/:id/download','download','post','addMessage'];(function(_0x522b6f,_0x557102){var _0x3dd7a1=function(_0x42685d){while(--_0x42685d){_0x522b6f['push'](_0x522b6f['shift']());}};_0x3dd7a1(++_0x557102);}(_0x392f,0x9c));var _0xf392=function(_0x39c545,_0x4a7b5c){_0x39c545=_0x39c545-0x0;var _0x2ceed9=_0x392f[_0x39c545];return _0x2ceed9;};'use strict';var multer=require(_0xf392('0x0'));var util=require(_0xf392('0x1'));var path=require(_0xf392('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf392('0x3')]();var fs_extra=require(_0xf392('0x4'));var auth=require(_0xf392('0x5'));var interaction=require(_0xf392('0x6'));var config=require(_0xf392('0x7'));var controller=require('./openchannelInteraction.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xf392('0x8')]('/describe',auth[_0xf392('0x9')](),controller[_0xf392('0xa')]);router[_0xf392('0x8')](_0xf392('0xb'),auth[_0xf392('0x9')](),controller[_0xf392('0xc')]);router[_0xf392('0x8')]('/:id/messages',auth[_0xf392('0x9')](),controller[_0xf392('0xd')]);router['get'](_0xf392('0xe'),auth[_0xf392('0x9')](),controller[_0xf392('0xf')]);router[_0xf392('0x10')]('/',auth[_0xf392('0x9')](),controller['create']);router[_0xf392('0x10')]('/:id/messages',auth[_0xf392('0x9')](),controller[_0xf392('0x11')]);router[_0xf392('0x10')](_0xf392('0x12'),auth[_0xf392('0x9')](),interaction[_0xf392('0x13')](_0xf392('0x14'),'openchannelinteraction:addtags'),controller[_0xf392('0x15')]);router[_0xf392('0x16')](_0xf392('0xb'),auth['isAuthenticated'](),interaction[_0xf392('0x13')](_0xf392('0x14'),_0xf392('0x17')),controller[_0xf392('0x18')]);router['delete'](_0xf392('0xb'),auth[_0xf392('0x9')](),interaction[_0xf392('0x13')](_0xf392('0x14'),_0xf392('0x19')),controller[_0xf392('0x1a')]);router[_0xf392('0x1b')]('/:id/tags',auth[_0xf392('0x9')](),controller['removeTags']);module[_0xf392('0x1c')]=router; \ No newline at end of file +var _0x4dd2=['connect-timeout','express','fs-extra','../../components/auth/service','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMessages','/:id/download','post','create','/:id/messages','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','removeTags','exports','multer','util'];(function(_0x1ccc19,_0x2a5e47){var _0x393065=function(_0x1ffa38){while(--_0x1ffa38){_0x1ccc19['push'](_0x1ccc19['shift']());}};_0x393065(++_0x2a5e47);}(_0x4dd2,0x1b1));var _0x24dd=function(_0xa72cf,_0x24a05c){_0xa72cf=_0xa72cf-0x0;var _0x263735=_0x4dd2[_0xa72cf];return _0x263735;};'use strict';var multer=require(_0x24dd('0x0'));var util=require(_0x24dd('0x1'));var path=require('path');var timeout=require(_0x24dd('0x2'));var express=require(_0x24dd('0x3'));var router=express['Router']();var fs_extra=require(_0x24dd('0x4'));var auth=require(_0x24dd('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x24dd('0x6'));router[_0x24dd('0x7')]('/',auth[_0x24dd('0x8')](),controller[_0x24dd('0x9')]);router[_0x24dd('0x7')](_0x24dd('0xa'),auth['isAuthenticated'](),controller[_0x24dd('0xb')]);router['get'](_0x24dd('0xc'),auth[_0x24dd('0x8')](),controller[_0x24dd('0xd')]);router[_0x24dd('0x7')]('/:id/messages',auth[_0x24dd('0x8')](),controller[_0x24dd('0xe')]);router['get'](_0x24dd('0xf'),auth[_0x24dd('0x8')](),controller['download']);router[_0x24dd('0x10')]('/',auth['isAuthenticated'](),controller[_0x24dd('0x11')]);router[_0x24dd('0x10')](_0x24dd('0x12'),auth[_0x24dd('0x8')](),controller['addMessage']);router['post'](_0x24dd('0x13'),auth[_0x24dd('0x8')](),interaction[_0x24dd('0x14')](_0x24dd('0x15'),_0x24dd('0x16')),controller['addTags']);router['put']('/:id',auth[_0x24dd('0x8')](),interaction[_0x24dd('0x14')](_0x24dd('0x15'),_0x24dd('0x17')),controller[_0x24dd('0x18')]);router[_0x24dd('0x19')](_0x24dd('0xc'),auth[_0x24dd('0x8')](),interaction['tracked'](_0x24dd('0x15'),_0x24dd('0x1a')),controller['destroy']);router[_0x24dd('0x19')]('/:id/tags',auth[_0x24dd('0x8')](),controller[_0x24dd('0x1b')]);module[_0x24dd('0x1c')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 7e06474..b4cbdab 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 _0x6d4f=['exports','BOOLEAN','DATE','STRING','sequelize'];(function(_0x1367aa,_0x3eb3ef){var _0x3a11b7=function(_0x5539fb){while(--_0x5539fb){_0x1367aa['push'](_0x1367aa['shift']());}};_0x3a11b7(++_0x3eb3ef);}(_0x6d4f,0x121));var _0xf6d4=function(_0x4e8db9,_0x15ff81){_0x4e8db9=_0x4e8db9-0x0;var _0x1fc3be=_0x6d4f[_0x4e8db9];return _0x1fc3be;};'use strict';var Sequelize=require(_0xf6d4('0x0'));module[_0xf6d4('0x1')]={'closed':{'type':Sequelize[_0xf6d4('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xf6d4('0x3')]},'disposition':{'type':Sequelize[_0xf6d4('0x4')]},'secondDisposition':{'type':Sequelize[_0xf6d4('0x4')]},'thirdDisposition':{'type':Sequelize[_0xf6d4('0x4')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xf6d4('0x3')]},'threadId':{'type':Sequelize[_0xf6d4('0x4')]},'externalUrl':{'type':Sequelize[_0xf6d4('0x4')]},'lastMsgAt':{'type':Sequelize[_0xf6d4('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xf6d4('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0xf6d4('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x6f2d=['out','BOOLEAN','sequelize','DATE','STRING','ENUM'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x6f2d,0x182));var _0xd6f2=function(_0x4a43d4,_0x109ece){_0x4a43d4=_0x4a43d4-0x0;var _0x3d58f5=_0x6f2d[_0x4a43d4];return _0x3d58f5;};'use strict';var Sequelize=require(_0xd6f2('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd6f2('0x1')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xd6f2('0x2')]},'thirdDisposition':{'type':Sequelize[_0xd6f2('0x2')]},'note':{'type':Sequelize[_0xd6f2('0x2')]},'read1stAt':{'type':Sequelize[_0xd6f2('0x1')]},'threadId':{'type':Sequelize[_0xd6f2('0x2')]},'externalUrl':{'type':Sequelize[_0xd6f2('0x2')]},'lastMsgAt':{'type':Sequelize[_0xd6f2('0x1')]},'lastMsgDirection':{'type':Sequelize[_0xd6f2('0x3')]('in',_0xd6f2('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xd6f2('0x2')]},'autoreplyExecuted':{'type':Sequelize[_0xd6f2('0x5')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index cc4a36c..9aa59e6 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 _0xb79e=['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','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','destroy','then','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','catch','index','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','sort','where','select','field','from','tools_tags','u.id','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_accounts','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','having','Contact','operator','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','read','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.from\x20LIKE\x20?','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','contactName','DESC','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','merge','OpenchannelInteraction','unreadMessages','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','push','all','rows','intersection','options','create','update','params','describe','addMessage','OpenchannelMessage','ids','getMessages','findOne','nolimit','pick','OpenchannelInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','addTags','setTags','spread','Tag','color','emit','download','join','files','root','server','transcript-%d-%s.zip','CmContact','firstName','attachments','Messages','direction','secret','OpenchannelAccount','Owner','get','mkdirSync','Openchannel','Account','N.A.','closed','closedAt','disposition','threadId','Public','Attachment','existsSync','createReadStream','createWriteStream','basename','lastName','out','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','unlinkSync'];(function(_0x36b400,_0x277ec5){var _0x4d47bf=function(_0x55372b){while(--_0x55372b){_0x36b400['push'](_0x36b400['shift']());}};_0x4d47bf(++_0x277ec5);}(_0xb79e,0xf7));var _0xeb79=function(_0x6c5d40,_0x4390ab){_0x6c5d40=_0x6c5d40-0x0;var _0x20724c=_0xb79e[_0x6c5d40];return _0x20724c;};'use strict';var emlformat=require(_0xeb79('0x0'));var rimraf=require(_0xeb79('0x1'));var zipdir=require(_0xeb79('0x2'));var jsonpatch=require(_0xeb79('0x3'));var rp=require(_0xeb79('0x4'));var moment=require(_0xeb79('0x5'));var BPromise=require(_0xeb79('0x6'));var Mustache=require(_0xeb79('0x7'));var util=require(_0xeb79('0x8'));var path=require(_0xeb79('0x9'));var sox=require(_0xeb79('0xa'));var csv=require(_0xeb79('0xb'));var ejs=require(_0xeb79('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeb79('0xd'));var squel=require(_0xeb79('0xe'));var crypto=require(_0xeb79('0xf'));var jsforce=require(_0xeb79('0x10'));var deskjs=require(_0xeb79('0x11'));var toCsv=require(_0xeb79('0xb'));var querystring=require(_0xeb79('0x12'));var Papa=require(_0xeb79('0x13'));var Redis=require(_0xeb79('0x14'));var authService=require(_0xeb79('0x15'));var qs=require(_0xeb79('0x16'));var as=require(_0xeb79('0x17'));var pdf=require(_0xeb79('0x18'));var hardwareService=require(_0xeb79('0x19'));var logger=require(_0xeb79('0x1a'))(_0xeb79('0x1b'));var utils=require('../../config/utils');var config=require(_0xeb79('0x1c'));var licenseUtil=require(_0xeb79('0x1d'));var db=require('../../mysqldb')['db'];config[_0xeb79('0x1e')]=_[_0xeb79('0x1f')](config[_0xeb79('0x1e')],{'host':_0xeb79('0x20'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xeb79('0x1e')]));require(_0xeb79('0x21'))[_0xeb79('0x22')](socket);function respondWithStatusCode(_0x394562,_0x2f6c79){_0x2f6c79=_0x2f6c79||0xcc;return function(_0x1c29e0){if(_0x1c29e0){return _0x394562[_0xeb79('0x23')](_0x2f6c79);}return _0x394562[_0xeb79('0x24')](_0x2f6c79)[_0xeb79('0x25')]();};}function respondWithResult(_0x301da5,_0x4a46c8){_0x4a46c8=_0x4a46c8||0xc8;return function(_0x35f175){if(_0x35f175){return _0x301da5['status'](_0x4a46c8)[_0xeb79('0x26')](_0x35f175);}};}function respondWithFilteredResult(_0x3f657a,_0x4ff664){return function(_0x582fd7){if(_0x582fd7){var _0x2f7074=typeof _0x4ff664[_0xeb79('0x27')]===_0xeb79('0x28')&&typeof _0x4ff664[_0xeb79('0x29')]===_0xeb79('0x28');var _0x4300c0=_0x582fd7[_0xeb79('0x2a')];var _0x171a47=_0x2f7074?0x0:_0x4ff664['offset'];var _0x12d326=_0x2f7074?_0x582fd7[_0xeb79('0x2a')]:_0x4ff664[_0xeb79('0x27')]+_0x4ff664['limit'];var _0x1a6ce6;if(_0x12d326>=_0x4300c0){_0x12d326=_0x4300c0;_0x1a6ce6=0xc8;}else{_0x1a6ce6=0xce;}_0x3f657a[_0xeb79('0x24')](_0x1a6ce6);return _0x3f657a[_0xeb79('0x2b')](_0xeb79('0x2c'),_0x171a47+'-'+_0x12d326+'/'+_0x4300c0)['json'](_0x582fd7);}return null;};}function patchUpdates(_0x5c9a09){return function(_0x165fcf){try{jsonpatch['apply'](_0x165fcf,_0x5c9a09,!![]);}catch(_0x2a8321){return BPromise[_0xeb79('0x2d')](_0x2a8321);}return _0x165fcf[_0xeb79('0x2e')]();};}function saveUpdates(_0x3cc78a,_0x3bb083){return function(_0x170dca){if(_0x170dca){return _0x170dca['update'](_0x3cc78a)['then'](function(_0x4c4f12){return _0x4c4f12;});}return null;};}function removeEntity(_0x48d1ba,_0x54c319){return function(_0x402fbf){if(_0x402fbf){return _0x402fbf[_0xeb79('0x2f')]()[_0xeb79('0x30')](function(){_0x48d1ba[_0xeb79('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x126a5f,_0x54e8bc){return function(_0x55c008){if(!_0x55c008){_0x126a5f[_0xeb79('0x23')](0x194);}return _0x55c008;};}function handleError(_0x47148d,_0x47a5d5){_0x47a5d5=_0x47a5d5||0x1f4;return function(_0x38ebf3){logger['error'](_0x38ebf3[_0xeb79('0x31')]);if(_0x38ebf3[_0xeb79('0x32')]){delete _0x38ebf3[_0xeb79('0x32')];}_0x47148d[_0xeb79('0x24')](_0x47a5d5)[_0xeb79('0x33')](_0x38ebf3);};}function getInteractionUsers(_0x4844c2,_0x349f9e){return new BPromise(function(_0x48845f,_0xa21385){try{if(_0x349f9e[_0x4844c2['id']]){_0x4844c2[_0xeb79('0x34')]=_[_0xeb79('0x35')](_0x349f9e[_0x4844c2['id']],function(_0x32dbec){return{'id':_0x32dbec['id'],'fullname':_0x32dbec[_0xeb79('0x36')]};});}}catch(_0x30497b){_0xa21385(_0x30497b);}_0x48845f(_0x4844c2);});}function getInteractionTags(_0x54f7d7,_0x55ed76){return new BPromise(function(_0x41ac57,_0x199ed5){try{if(_0x54f7d7[_0xeb79('0x37')]){_0x54f7d7[_0xeb79('0x38')]=[];_0x54f7d7[_0xeb79('0x37')][_0xeb79('0x39')](',')[_0xeb79('0x3a')](function(_0x45339b){_0x54f7d7['Tags']['push'](_0x55ed76[_0x45339b]);});}delete _0x54f7d7[_0xeb79('0x37')];}catch(_0x23e178){_0x199ed5(_0x23e178);}_0x41ac57(_0x54f7d7);});}function updateOpenchannelInteraction(_0x559664,_0x16a767,_0xb85417){return new BPromise(function(_0x1026b1,_0x1b037f){return getInteractionUsers(_0x559664,_0xb85417)[_0xeb79('0x30')](function(_0xbaa22c){return getInteractionTags(_0xbaa22c,_0x16a767);})[_0xeb79('0x30')](function(_0x1be944){_0x1026b1(_0x1be944);})[_0xeb79('0x3b')](function(_0x5f1b57){_0x1b037f(_0x5f1b57);});});}exports[_0xeb79('0x3c')]=function(_0x5b5569,_0x53269f){var _0x4029a9={},_0x44b529={},_0x32673e={'count':0x0,'rows':[]};var _0x65c7ad=_[_0xeb79('0x35')](db['OpenchannelInteraction'][_0xeb79('0x3d')],function(_0x462470){return{'name':_0x462470[_0xeb79('0x3e')],'type':_0x462470[_0xeb79('0x3f')][_0xeb79('0x40')]};});_0x44b529[_0xeb79('0x41')]=_[_0xeb79('0x35')](_0x65c7ad,_0xeb79('0x32'));_0x44b529[_0xeb79('0x42')]=_[_0xeb79('0x43')](_0x5b5569[_0xeb79('0x42')]);_0x44b529[_0xeb79('0x44')]=_['intersection'](_0x44b529[_0xeb79('0x41')],_0x44b529[_0xeb79('0x42')]);_0x4029a9[_0xeb79('0x45')]=_['intersection'](_0x44b529[_0xeb79('0x41')],qs[_0xeb79('0x46')](_0x5b5569[_0xeb79('0x42')][_0xeb79('0x46')]));_0x4029a9[_0xeb79('0x45')]=_0x4029a9['attributes'][_0xeb79('0x47')]?_0x4029a9[_0xeb79('0x45')]:_0x44b529[_0xeb79('0x41')];if(!_0x5b5569[_0xeb79('0x42')][_0xeb79('0x48')]('nolimit')){_0x4029a9[_0xeb79('0x29')]=qs[_0xeb79('0x29')](_0x5b5569[_0xeb79('0x42')]['limit']);_0x4029a9[_0xeb79('0x27')]=qs['offset'](_0x5b5569['query']['offset']);}_0x4029a9['order']=qs['sort'](_0x5b5569['query'][_0xeb79('0x49')]);_0x4029a9[_0xeb79('0x4a')]=qs[_0xeb79('0x44')](_['pick'](_0x5b5569[_0xeb79('0x42')],_0x44b529['filters']),_0x65c7ad);var _0x4c50ac=[];var _0x146f6a=squel[_0xeb79('0x4b')]()[_0xeb79('0x4c')]('id')['field'](_0xeb79('0x32'))[_0xeb79('0x4c')]('color')[_0xeb79('0x4d')](_0xeb79('0x4e'));var _0xcdfc72=squel[_0xeb79('0x4b')]()['field'](_0xeb79('0x4f'))['field'](_0xeb79('0x50'))[_0xeb79('0x4c')](_0xeb79('0x51'))[_0xeb79('0x4d')](_0xeb79('0x52'),'ui')[_0xeb79('0x53')](_0xeb79('0x54'),'u',_0xeb79('0x55'));var _0x17ec94=squel[_0xeb79('0x4b')]()['from'](_0xeb79('0x56'),'i')[_0xeb79('0x53')](_0xeb79('0x57'),'c',_0xeb79('0x58'))[_0xeb79('0x53')]('users','o',_0xeb79('0x59'))[_0xeb79('0x53')](_0xeb79('0x5a'),'a','a.id\x20=\x20i.OpenchannelAccountId')[_0xeb79('0x53')](_0xeb79('0x5b'),'me',_0xeb79('0x5c'))[_0xeb79('0x53')](_0xeb79('0x5d'),'it',_0xeb79('0x5e'))[_0xeb79('0x53')]('tools_tags','t',_0xeb79('0x5f'));var _0xb2b2d9=squel[_0xeb79('0x60')]();var _0x47854e=[];var _0x5d6c2d=squel['expr']();var _0x3f54ea;if(_0x5b5569[_0xeb79('0x42')][_0xeb79('0x61')]){_0x3f54ea=as[_0xeb79('0x62')](_0x5b5569[_0xeb79('0x42')][_0xeb79('0x61')]);var _0x35f6eb=_0x3f54ea[_0xeb79('0x63')];for(var _0x35631f=0x0;_0x35631f<_0x3f54ea[_0xeb79('0x64')][_0xeb79('0x47')];_0x35631f++){var _0x4a83e2=_0x3f54ea[_0xeb79('0x64')][_0x35631f];var _0x230924='i';var _0x1bb39f=_[_0xeb79('0x65')](_0x65c7ad,['name',_0x4a83e2['field']]);if(!_0x1bb39f){switch(_0x4a83e2[_0xeb79('0x4c')]){case'unreadMessages':if(_0x4a83e2['value']==0x1){_0x17ec94[_0xeb79('0x66')]('`'+_0x4a83e2[_0xeb79('0x4c')]+'`\x20=\x200');}else{_0x17ec94[_0xeb79('0x66')]('`'+_0x4a83e2[_0xeb79('0x4c')]+'`\x20>\x200');}break;case _0xeb79('0x67'):if(_0x4a83e2[_0xeb79('0x68')]===_0xeb79('0x69')){if(_0x4a83e2[_0xeb79('0x6a')][_0xeb79('0x39')]('\x20')[_0xeb79('0x47')]>0x1){_0xb2b2d9[_0x35f6eb](_0xeb79('0x6b'),qs[_0xeb79('0x6c')](_0x4a83e2[_0xeb79('0x6a')]),null);}else{var _0x3a5ed6='%'+_0x4a83e2[_0xeb79('0x6a')]+'%';_0xb2b2d9[_0x35f6eb](_0xeb79('0x6d'),_0x3a5ed6,_0x3a5ed6,_0x3a5ed6);}}else{_0x1bb39f=_[_0xeb79('0x65')](_0x65c7ad,[_0xeb79('0x32'),_0xeb79('0x6e')]);_0x4a83e2['field']='ContactId';_0x49a26e=as[_0xeb79('0x6f')](_0x230924,_0x1bb39f[_0xeb79('0x3f')],_0x4a83e2);_0xb2b2d9[_0x35f6eb](_0x49a26e[_0xeb79('0x70')],_0x49a26e[_0xeb79('0x6a')][_0xeb79('0x71')],_0x49a26e[_0xeb79('0x6a')]['end']);}break;case'Tag':var _0x51a0c4=_0x4a83e2[_0xeb79('0x6a')][_0xeb79('0x39')](',')[_0xeb79('0x35')](function(_0x343d02){return Number(_0x343d02);});_0x51a0c4[_0xeb79('0x3a')](function(_0x476c69){_0x5d6c2d['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x476c69+',%');});_0x47854e=_[_0xeb79('0x72')](_0x47854e,_0x51a0c4);break;case _0xeb79('0x73'):if(_0x4a83e2[_0xeb79('0x68')]===_0xeb79('0x69')){_0xb2b2d9[_0x35f6eb](_0xeb79('0x74'),'%'+_0x4a83e2[_0xeb79('0x6a')]+'%',null);}else{_0x1bb39f=_[_0xeb79('0x65')](_0x65c7ad,[_0xeb79('0x32'),_0xeb79('0x75')]);_0x4a83e2[_0xeb79('0x4c')]='UserId';_0x49a26e=as[_0xeb79('0x6f')](_0x230924,_0x1bb39f[_0xeb79('0x3f')],_0x4a83e2);_0xb2b2d9[_0x35f6eb](_0x49a26e[_0xeb79('0x70')],_0x49a26e[_0xeb79('0x6a')][_0xeb79('0x71')],_0x49a26e['value'][_0xeb79('0x25')]);}break;case _0xeb79('0x76'):_0x49a26e=as['buildExpression']('me',null,_0x4a83e2);_0xb2b2d9[_0x35f6eb](_0x49a26e[_0xeb79('0x70')],_0x49a26e[_0xeb79('0x6a')]['start'],_0x49a26e[_0xeb79('0x6a')][_0xeb79('0x25')]);break;}}else{var _0x49a26e=as[_0xeb79('0x6f')](_0x230924,_0x1bb39f[_0xeb79('0x3f')],_0x4a83e2);_0xb2b2d9[_0x35f6eb](_0x49a26e[_0xeb79('0x70')],_0x49a26e[_0xeb79('0x6a')][_0xeb79('0x71')],_0x49a26e['value'][_0xeb79('0x25')]);}}}else{var _0x486223=_(_0x5b5569[_0xeb79('0x42')])[_0xeb79('0x43')]()[_0xeb79('0x35')](function(_0x25d5e9){return _[_0xeb79('0x77')](_0x65c7ad,[_0xeb79('0x32'),_0x25d5e9])?_0x25d5e9:undefined;})[_0xeb79('0x78')]()[_0xeb79('0x6a')]();if(!_[_0xeb79('0x79')](_0x486223)){_0x486223['forEach'](function(_0x57d9ee){if(_0x57d9ee===_0xeb79('0x7a')){_0x17ec94[_0xeb79('0x4a')](_0xeb79('0x7b'),[][_0xeb79('0x7c')](_0x5b5569['query'][_0x57d9ee]));}else if(_0x57d9ee===_0xeb79('0x7d')){var _0x2449a4=JSON['parse'](_0x5b5569[_0xeb79('0x42')][_0x57d9ee])[_0xeb79('0x7e')];var _0x5d842d=JSON[_0xeb79('0x7f')](_0x5b5569[_0xeb79('0x42')][_0x57d9ee])[_0xeb79('0x80')];_0x17ec94[_0xeb79('0x4a')](_0xeb79('0x81'),_0x2449a4,_0x5d842d);}else{if(_0x5b5569[_0xeb79('0x42')][_0x57d9ee]==='null'){_0x17ec94[_0xeb79('0x4a')]('i.'+_0x57d9ee+_0xeb79('0x82'));}else{_0x17ec94[_0xeb79('0x4a')]('i.'+_0x57d9ee+'\x20=\x20?',_0x5b5569[_0xeb79('0x42')][_0x57d9ee]);}}});}if(_0x5b5569['query'][_0xeb79('0x83')]){if(_0x5b5569['query'][_0xeb79('0x83')]==0x1){_0x17ec94[_0xeb79('0x66')]('`unreadMessages`\x20=\x200');}else{_0x17ec94[_0xeb79('0x66')]('`unreadMessages`\x20>\x200');}}if(_0x5b5569[_0xeb79('0x42')][_0xeb79('0x84')]){_0x47854e=_[_0xeb79('0x85')](_0x5b5569['query'][_0xeb79('0x84')])?_0x5b5569['query']['tag']:new Array(_0x5b5569[_0xeb79('0x42')][_0xeb79('0x84')]);_0x47854e[_0xeb79('0x3a')](function(_0x282f7c){_0x5d6c2d['or'](_0xeb79('0x86'),'%,'+_0x282f7c+',%');});}if(_0x5b5569[_0xeb79('0x42')][_0xeb79('0x87')]){var _0x472dec=_0x5b5569[_0xeb79('0x42')]['filter'][_0xeb79('0x88')]('\x5c','\x5c\x5c')[_0xeb79('0x88')](/'/g,'\x27\x27');if(qs[_0xeb79('0x89')](_0x472dec)){_0xb2b2d9['or'](_0xeb79('0x8a'),_0x472dec+'%');}else{_0xb2b2d9['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xeb79('0x6c')](_0x472dec))['or'](_0xeb79('0x8b'),_0x472dec+'%')['or'](_0xeb79('0x8c'),_0x472dec+'%');}}}_0x17ec94[_0xeb79('0x4a')](_0xb2b2d9);_0x17ec94[_0xeb79('0x8d')](_0xeb79('0x8e'));var _0x4c1a11={'type':db[_0xeb79('0x8f')][_0xeb79('0x90')][_0xeb79('0x91')],'raw':!![]};var _0x10b2eb=_0x17ec94[_0xeb79('0x92')]();_0x10b2eb[_0xeb79('0x4c')](_0xeb79('0x8e'));_0x10b2eb['field'](_0xeb79('0x93'),'unreadMessages');if(_0x4029a9[_0xeb79('0x94')]){_0x4029a9['order']['forEach'](function(_0x3ee0ec){var _0x3a0955=_0x3ee0ec[0x0]===_0xeb79('0x95')?_0x3ee0ec[0x0]:'i.'+_0x3ee0ec[0x0];_0x17ec94[_0xeb79('0x94')](_0x3a0955,_0x3ee0ec[0x1]===_0xeb79('0x96')?![]:!![]);});}if(!_[_0xeb79('0x79')](_0x47854e)){_0x17ec94[_0xeb79('0x66')](_0x5d6c2d);_0x10b2eb[_0xeb79('0x4a')]('t.id\x20IN\x20?',_0x47854e);}BPromise[_0xeb79('0x97')]()['then'](function(){if(!_0x3f54ea){if(_0x5b5569[_0xeb79('0x42')][_0xeb79('0x7a')])return;_0x10b2eb['where'](_0xeb79('0x98'));_0x17ec94['where']('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x5b5569[_0xeb79('0x99')][_0xeb79('0x9a')]!==_0xeb79('0x9b'))return;return _0x5b5569[_0xeb79('0x99')][_0xeb79('0x9c')]({'attributes':['id'],'raw':!![]})[_0xeb79('0x30')](function(_0xa811c9){if(_['isEmpty'](_0xa811c9)){_0x10b2eb[_0xeb79('0x4a')](_0xeb79('0x9d'));_0x17ec94[_0xeb79('0x4a')](_0xeb79('0x9d'));}else{_0x10b2eb[_0xeb79('0x4a')]('i.OpenchannelAccountId\x20IN\x20?',_[_0xeb79('0x35')](_0xa811c9,'id'));_0x17ec94['where'](_0xeb79('0x7b'),_[_0xeb79('0x35')](_0xa811c9,'id'));}});})['then'](function(){if(_0x5b5569[_0xeb79('0x99')][_0xeb79('0x9a')]===_0xeb79('0x9b')&&!_0x3f54ea&&!_0x5b5569['query'][_0xeb79('0x7a')])return[];return db[_0xeb79('0x9e')][_0xeb79('0x42')](_0x10b2eb[_0xeb79('0x9f')](),_0x4c1a11);})['then'](function(_0x3bea21){_0x32673e[_0xeb79('0x2a')]=_0x3bea21[_0xeb79('0x47')];if(_0x32673e[_0xeb79('0x2a')]===0x0)return[];return db['sequelize']['query'](_0x146f6a[_0xeb79('0x9f')](),_0x4c1a11)[_0xeb79('0x30')](function(_0x4c43df){_0x4c50ac=_['keyBy'](_0x4c43df,'id');_0x4c1a11=_[_0xeb79('0xa0')](_0x4c1a11,{'model':db[_0xeb79('0xa1')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5b5569[_0xeb79('0x42')][_0xeb79('0x46')]){_0x4029a9[_0xeb79('0x45')][_0xeb79('0x3a')](function(_0x589563){_0x17ec94[_0xeb79('0x4c')]('i.'+_0x589563);});}else{_0x17ec94[_0xeb79('0x4c')](_0xeb79('0x93'),_0xeb79('0xa2'));_0x17ec94['field']('a.key','Account.key');_0x17ec94[_0xeb79('0x4c')](_0xeb79('0xa3'),_0xeb79('0xa4'));_0x17ec94[_0xeb79('0x4c')]('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',_0xeb79('0x95'));_0x17ec94[_0xeb79('0x4c')](_0xeb79('0xa5'));_0x17ec94['field'](_0xeb79('0xa6'),'Contact.firstName');_0x17ec94[_0xeb79('0x4c')](_0xeb79('0xa7'),_0xeb79('0xa8'));_0x17ec94[_0xeb79('0x4c')](_0xeb79('0xa9'),_0xeb79('0xaa'));_0x17ec94['field'](_0xeb79('0xab'),'Contact.phone');_0x17ec94[_0xeb79('0x4c')](_0xeb79('0xac'),_0xeb79('0xad'));_0x17ec94[_0xeb79('0x4c')]('c.fax',_0xeb79('0xae'));_0x17ec94['field'](_0xeb79('0xaf'),_0xeb79('0xb0'));_0x17ec94[_0xeb79('0x4c')]('o.internal',_0xeb79('0xb1'));_0x17ec94['field'](_0xeb79('0xb2'),'TagIds');}if(_0x4029a9['limit'])_0x17ec94[_0xeb79('0x29')](_0x4029a9[_0xeb79('0x29')]);if(_0x4029a9[_0xeb79('0x27')])_0x17ec94[_0xeb79('0x27')](_0x4029a9['offset']);return db[_0xeb79('0x9e')][_0xeb79('0x42')](_0x17ec94[_0xeb79('0x9f')](),_0x4c1a11);})[_0xeb79('0x30')](function(_0x572be2){if(_0x572be2[_0xeb79('0x47')]>0x0)_0xcdfc72['where'](_0xeb79('0xb3'),_[_0xeb79('0x35')](_0x572be2,'id'));return db[_0xeb79('0x9e')][_0xeb79('0x42')](_0xcdfc72[_0xeb79('0x9f')](),_0x4c1a11)[_0xeb79('0x30')](function(_0x4ecbbd){var _0x29968d=_[_0xeb79('0xb4')](_0x4ecbbd,'OpenchannelInteractionId');var _0x262760=[];_0x572be2[_0xeb79('0x3a')](function(_0x2ea0fb){_0x262760[_0xeb79('0xb5')](updateOpenchannelInteraction(_0x2ea0fb,_0x4c50ac,_0x29968d));});return BPromise[_0xeb79('0xb6')](_0x262760);});});})[_0xeb79('0x30')](function(_0x28dcaa){_0x32673e[_0xeb79('0xb7')]=_0x28dcaa;return _0x32673e;})['then'](respondWithFilteredResult(_0x53269f,_0x4029a9))[_0xeb79('0x3b')](handleError(_0x53269f,null));};exports['show']=function(_0x38e96f,_0x48252f){var _0x2eaa50={};if(_0x38e96f[_0xeb79('0x42')][_0xeb79('0x3f')]&&_0x38e96f[_0xeb79('0x42')][_0xeb79('0x3f')]==='from'){_0x2eaa50[_0xeb79('0x4d')]=_0x38e96f['params']['id'];}else{_0x2eaa50['id']=_0x38e96f['params']['id'];}var _0x18c5a7={'raw':![],'where':_0x2eaa50},_0x527972={};_0x527972[_0xeb79('0x41')]=_[_0xeb79('0x43')](db[_0xeb79('0xa1')][_0xeb79('0x3d')]);_0x527972[_0xeb79('0x42')]=_[_0xeb79('0x43')](_0x38e96f[_0xeb79('0x42')]);_0x527972[_0xeb79('0x44')]=_[_0xeb79('0xb8')](_0x527972[_0xeb79('0x41')],_0x527972[_0xeb79('0x42')]);_0x18c5a7[_0xeb79('0x45')]=_['intersection'](_0x527972[_0xeb79('0x41')],qs[_0xeb79('0x46')](_0x38e96f[_0xeb79('0x42')]['fields']));_0x18c5a7['attributes']=_0x18c5a7[_0xeb79('0x45')][_0xeb79('0x47')]?_0x18c5a7[_0xeb79('0x45')]:_0x527972[_0xeb79('0x41')];if(_0x38e96f[_0xeb79('0x42')]['includeAll']){_0x18c5a7['include']=[{'all':!![]}];}_0x18c5a7=_[_0xeb79('0xa0')]({},_0x18c5a7,_0x38e96f[_0xeb79('0xb9')]);return db[_0xeb79('0xa1')]['find'](_0x18c5a7)['then'](handleEntityNotFound(_0x48252f,null))[_0xeb79('0x30')](respondWithResult(_0x48252f,null))[_0xeb79('0x3b')](handleError(_0x48252f,null));};exports[_0xeb79('0xba')]=function(_0x205fc6,_0x14ecd3){return db[_0xeb79('0xa1')][_0xeb79('0xba')](_0x205fc6[_0xeb79('0x76')],{})['then'](respondWithResult(_0x14ecd3,0xc9))[_0xeb79('0x3b')](handleError(_0x14ecd3,null));};exports[_0xeb79('0xbb')]=function(_0x1c8419,_0x41ed36){if(_0x1c8419[_0xeb79('0x76')]['id']){delete _0x1c8419[_0xeb79('0x76')]['id'];}return db[_0xeb79('0xa1')][_0xeb79('0x65')]({'where':{'id':_0x1c8419[_0xeb79('0xbc')]['id']}})[_0xeb79('0x30')](handleEntityNotFound(_0x41ed36,null))['then'](saveUpdates(_0x1c8419[_0xeb79('0x76')],null))[_0xeb79('0x30')](respondWithResult(_0x41ed36,null))['catch'](handleError(_0x41ed36,null));};exports[_0xeb79('0x2f')]=function(_0x4d6c2c,_0x227575){return db[_0xeb79('0xa1')]['find']({'where':{'id':_0x4d6c2c[_0xeb79('0xbc')]['id']}})[_0xeb79('0x30')](handleEntityNotFound(_0x227575,null))[_0xeb79('0x30')](removeEntity(_0x227575,null))[_0xeb79('0x3b')](handleError(_0x227575,null));};exports[_0xeb79('0xbd')]=function(_0x60aee7,_0x1cb9dc){return db[_0xeb79('0xa1')][_0xeb79('0xbd')]()[_0xeb79('0x30')](respondWithResult(_0x1cb9dc,null))[_0xeb79('0x3b')](handleError(_0x1cb9dc,null));};exports[_0xeb79('0xbe')]=function(_0x4370fc,_0x4e6788,_0x43092b){return db[_0xeb79('0xbf')]['find']({'where':{'id':_0x4370fc['params']['id']}})[_0xeb79('0x30')](handleEntityNotFound(_0x4e6788,null))[_0xeb79('0x30')](function(_0x4dbb31){if(_0x4dbb31){return _0x4dbb31['addMessage'](_0x4370fc[_0xeb79('0x76')][_0xeb79('0xc0')],_['omit'](_0x4370fc[_0xeb79('0x76')],[_0xeb79('0xc0'),'id'])||{});}})['then'](respondWithResult(_0x4e6788,null))['catch'](handleError(_0x4e6788,null));};exports[_0xeb79('0xc1')]=function(_0x637993,_0x25eec5,_0x497085){var _0x429284={'raw':![],'where':{}};var _0xb003a5={};var _0x4d17eb={'count':0x0,'rows':[]};return db[_0xeb79('0xa1')][_0xeb79('0xc2')]({'where':{'id':_0x637993[_0xeb79('0xbc')]['id']}})[_0xeb79('0x30')](handleEntityNotFound(_0x25eec5,null))[_0xeb79('0x30')](function(_0x4d19ca){if(_0x4d19ca){_0xb003a5[_0xeb79('0x41')]=_[_0xeb79('0x43')](db['OpenchannelMessage']['rawAttributes']);_0xb003a5[_0xeb79('0x42')]=_[_0xeb79('0x43')](_0x637993[_0xeb79('0x42')]);_0xb003a5[_0xeb79('0x44')]=_[_0xeb79('0xb8')](_0xb003a5[_0xeb79('0x41')],_0xb003a5['query']);_0x429284[_0xeb79('0x45')]=_['intersection'](_0xb003a5[_0xeb79('0x41')],qs['fields'](_0x637993['query'][_0xeb79('0x46')]));_0x429284[_0xeb79('0x45')]=_0x429284['attributes'][_0xeb79('0x47')]?_0x429284[_0xeb79('0x45')]:_0xb003a5[_0xeb79('0x41')];if(!_0x637993[_0xeb79('0x42')][_0xeb79('0x48')](_0xeb79('0xc3'))){_0x429284[_0xeb79('0x29')]=qs[_0xeb79('0x29')](_0x637993[_0xeb79('0x42')][_0xeb79('0x29')]);_0x429284[_0xeb79('0x27')]=qs[_0xeb79('0x27')](_0x637993[_0xeb79('0x42')][_0xeb79('0x27')]);}_0x429284[_0xeb79('0x94')]=qs[_0xeb79('0x49')](_0x637993[_0xeb79('0x42')]['sort']);_0x429284['where']=qs[_0xeb79('0x44')](_[_0xeb79('0xc4')](_0x637993['query'],_0xb003a5[_0xeb79('0x44')]));_0x429284[_0xeb79('0x4a')][_0xeb79('0xc5')]=_0x4d19ca['id'];if(_0x637993[_0xeb79('0x42')][_0xeb79('0x87')]){_0x429284[_0xeb79('0x4a')]=_[_0xeb79('0xa0')](_0x429284[_0xeb79('0x4a')],{'$or':_['map'](_0x429284[_0xeb79('0x45')],function(_0x151861){var _0x3c048c={};_0x3c048c[_0x151861]={'$like':'%'+_0x637993['query'][_0xeb79('0x87')]+'%'};return _0x3c048c;})});}if(_0x637993[_0xeb79('0x42')]['$gte']){var _0x1969e5=_0x637993[_0xeb79('0x42')][_0xeb79('0x7e')]['split'](',');var _0x253934={};_0x253934[_0x1969e5[0x0]]={'$gte':moment(_0x1969e5[0x1])[_0xeb79('0xc6')](_0xeb79('0xc7'))};_0x429284[_0xeb79('0x4a')]=_['merge'](_0x429284[_0xeb79('0x4a')],_0x253934);}_0x429284=_[_0xeb79('0xa0')]({},_0x429284,_0x637993[_0xeb79('0xb9')]);return db[_0xeb79('0xbf')][_0xeb79('0x2a')]({'where':_0x429284[_0xeb79('0x4a')]})[_0xeb79('0x30')](function(_0x57406b){_0x4d17eb['count']=_0x57406b;if(_0x637993['query']['includeAll']){_0x429284[_0xeb79('0xc8')]=[{'all':!![]}];}return db[_0xeb79('0xbf')][_0xeb79('0xc9')](_0x429284);})[_0xeb79('0x30')](function(_0x1c58bf){_0x4d17eb[_0xeb79('0xb7')]=_0x1c58bf;return _0x4d17eb;});}})[_0xeb79('0x30')](respondWithFilteredResult(_0x25eec5,_0x429284))[_0xeb79('0x3b')](handleError(_0x25eec5,null));};exports[_0xeb79('0xca')]=function(_0x40c76b,_0x1d60e0,_0x3a7815){return db[_0xeb79('0xa1')]['find']({'where':{'id':_0x40c76b[_0xeb79('0xbc')]['id']}})[_0xeb79('0x30')](handleEntityNotFound(_0x1d60e0,null))['then'](function(_0x26d26c){if(_0x26d26c){return _0x26d26c[_0xeb79('0xcb')](_0x40c76b['body'][_0xeb79('0xc0')],_['omit'](_0x40c76b['body'],['ids','id'])||{})[_0xeb79('0xcc')](function(){return db[_0xeb79('0xcd')]['findAll']({'attributes':['id',_0xeb79('0x32'),_0xeb79('0xce')],'where':{'id':_0x40c76b[_0xeb79('0x76')][_0xeb79('0xc0')]}});})['then'](function(_0x7d918e){socket[_0xeb79('0xcf')]('openchannelInteractionTags:save',{'id':Number(_0x40c76b[_0xeb79('0xbc')]['id']),'tags':_0x7d918e||[]});return{'id':Number(_0x40c76b['params']['id']),'tags':_0x7d918e||[]};});}})[_0xeb79('0x30')](respondWithResult(_0x1d60e0,null))[_0xeb79('0x3b')](handleError(_0x1d60e0,null));};exports['removeTags']=function(_0x3532ad,_0x42ba2e,_0x28a4da){return db[_0xeb79('0xa1')][_0xeb79('0x65')]({'where':{'id':_0x3532ad['params']['id']}})[_0xeb79('0x30')](handleEntityNotFound(_0x42ba2e,null))[_0xeb79('0x30')](function(_0x288a6e){if(_0x288a6e){return _0x288a6e['removeTags'](_0x3532ad[_0xeb79('0x42')][_0xeb79('0xc0')]);}})[_0xeb79('0x30')](respondWithStatusCode(_0x42ba2e,null))['catch'](handleError(_0x42ba2e,null));};exports[_0xeb79('0xd0')]=function(_0x5d8398,_0x7f128b){var _0x2f6948=moment()['unix']()[_0xeb79('0x9f')]();var _0x593144=path[_0xeb79('0xd1')](config['root'],'server',_0xeb79('0xd2'),'tmp');var _0x5ac21e=path['join'](config[_0xeb79('0xd3')],_0xeb79('0xd4'),_0xeb79('0xd2'),'attachments');var _0x12189b=path[_0xeb79('0xd1')](_0x593144,_0x2f6948);var _0x1e75d7=util[_0xeb79('0xc6')](_0xeb79('0xd5'),_0x5d8398[_0xeb79('0xbc')]['id'],_0x2f6948);var _0x44b461=path[_0xeb79('0xd1')](_0x593144,_0x1e75d7);var _0x1b176d=[];_0x1b176d[_0xeb79('0xb5')]({'model':db[_0xeb79('0x73')],'as':_0xeb79('0x73'),'attributes':['id',_0xeb79('0x36')],'raw':!![]});_0x1b176d['push']({'model':db[_0xeb79('0xd6')],'as':'Contact','attributes':['id',_0xeb79('0xd7'),'lastName'],'raw':!![]});if(_0x5d8398['query'][_0xeb79('0xd8')]){_0x1b176d[_0xeb79('0xb5')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x1bc967=[{'model':db[_0xeb79('0xbf')],'as':_0xeb79('0xd9'),'attributes':['id',_0xeb79('0x76'),_0xeb79('0x7d'),_0xeb79('0xda'),_0xeb79('0xdb'),_0xeb79('0x83')],'include':_0x1b176d}];_0x1bc967['push']({'model':db[_0xeb79('0xdc')],'as':'Account','attributes':['id',_0xeb79('0x32')]});_0x1bc967[_0xeb79('0xb5')]({'model':db['User'],'as':_0xeb79('0xdd'),'attributes':['id',_0xeb79('0x36')]});return db[_0xeb79('0xa1')][_0xeb79('0x65')]({'where':{'id':_0x5d8398[_0xeb79('0xbc')]['id']},'include':_0x1bc967})['then'](handleEntityNotFound(_0x7f128b,null))[_0xeb79('0x30')](function(_0x4edde1){if(_0x4edde1){var _0x39fb07=_0x4edde1[_0xeb79('0xde')]({'plain':!![]});fs[_0xeb79('0xdf')](_0x12189b);var _0x3767ce={'channel':_0xeb79('0xe0'),'account':_0x39fb07[_0xeb79('0xe1')][_0xeb79('0x32')],'agent':_0x39fb07[_0xeb79('0xdd')]?_0x39fb07[_0xeb79('0xdd')]['fullname']:_0xeb79('0xe2'),'createdAt':moment(_0x39fb07['createdAt'])[_0xeb79('0xc6')](_0xeb79('0xc7'))[_0xeb79('0x9f')](),'closedAt':_0x39fb07[_0xeb79('0xe3')]?moment(_0x39fb07[_0xeb79('0xe4')])[_0xeb79('0xc6')](_0xeb79('0xc7'))[_0xeb79('0x9f')]():'','disposition':_0x39fb07[_0xeb79('0xe5')],'visibility':_0x39fb07[_0xeb79('0xe6')]?_0xeb79('0xe7'):'Private','messages':_(_0x39fb07[_0xeb79('0xd9')])['filter']({'secret':![]})[_0xeb79('0x35')](function(_0x205dd2){if(_0x205dd2[_0xeb79('0xe8')]){var _0x51e1be=path['join'](_0x5ac21e,_0x205dd2[_0xeb79('0xe8')]['basename']);if(fs[_0xeb79('0xe9')](_0x51e1be)){fs[_0xeb79('0xea')](_0x51e1be)['pipe'](fs[_0xeb79('0xeb')](path['join'](_0x12189b,_0x205dd2[_0xeb79('0xe8')][_0xeb79('0xec')])));}}return{'date':moment(_0x205dd2[_0xeb79('0x7d')])[_0xeb79('0xc6')]('YYYY-MM-DD\x20HH:mm:ss')[_0xeb79('0x9f')](),'sender':_0x205dd2[_0xeb79('0xda')]==='out'?_0x205dd2[_0xeb79('0x73')]?_0x205dd2[_0xeb79('0x73')][_0xeb79('0x36')]:'System':_0x205dd2[_0xeb79('0x67')]['firstName']+(_0x205dd2[_0xeb79('0x67')][_0xeb79('0xed')]?'\x20'+_0x205dd2[_0xeb79('0x67')][_0xeb79('0xed')]:''),'body':_0x205dd2[_0xeb79('0xe8')]?_0x205dd2[_0xeb79('0xe8')]['basename']:_0x205dd2[_0xeb79('0x76')],'direction':_0x205dd2[_0xeb79('0xda')]===_0xeb79('0xee')?'A':'C','secret':_0x205dd2[_0xeb79('0xdb')],'read':_0x205dd2[_0xeb79('0x83')],'attachment':_0x205dd2['Attachment']};})[_0xeb79('0x6a')]()};return ejs[_0xeb79('0xef')](path['join'](config[_0xeb79('0xd3')],_0xeb79('0xd4'),_0xeb79('0xf0'),_0xeb79('0xf1')),{'interaction':_0x3767ce})['then'](function(_0x5ba7c9){var _0x4e757e=path['join'](_0x12189b,_0xeb79('0xf2')+_0x39fb07['id']+'-'+_0x2f6948+_0xeb79('0xf3'));var _0xfed8e2={'path':_0x4e757e,'channel':'Openchannel','interactionId':_0x39fb07['id']};return pdf[_0xeb79('0xf4')](_0x5ba7c9,_0xfed8e2);})[_0xeb79('0x30')](function(){return new BPromise(function(_0x146ccb,_0x4d5376){zipdir(_0x12189b,{'saveTo':_0x44b461},function(_0x80daa9,_0x54bf1c){if(_0x80daa9)return _0x4d5376(_0x80daa9);return _0x146ccb(_0x54bf1c);});})[_0xeb79('0x30')](function(){return new BPromise(function(_0x358515,_0x3fe073){rimraf(_0x12189b,function(_0x2c16a0){if(_0x2c16a0)_0x3fe073(_0x2c16a0);return _0x358515();});});})[_0xeb79('0x30')](function(){return _0x7f128b[_0xeb79('0xd0')](_0x44b461,_0x1e75d7,function(_0x45100f){if(_0x45100f){console[_0xeb79('0xf5')]('err',_0x45100f);}else{fs[_0xeb79('0xf6')](_0x44b461);}});});});}else{return _0x7f128b[_0xeb79('0x23')](0xc8);}})[_0xeb79('0x3b')](handleError(_0x7f128b,null));}; \ No newline at end of file +var _0x8d16=['util','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','sendStatus','error','stack','name','send','Users','map','fullname','TagIds','Tags','forEach','push','index','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','select','field','color','tools_tags','u.id','u.fullname','ui.OpenchannelInteractionId','from','user_has_openchannel_interactions','u.id\x20=\x20ui.UserId','openchannel_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','openchannel_accounts','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','operator','$substring','split','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','UserId','body','some','compact','OpenchannelAccountId','createdAt','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\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)','i.from\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?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','agent','user','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','role','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','i.*','Contact.lastName','c.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Owner.fullname','o.internal','Owner.internal','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','rows','show','params','keys','OpenchannelInteraction','includeAll','include','options','catch','create','destroy','describe','omit','ids','findOne','format','YYYY-MM-DD\x20HH:mm:ss','OpenchannelMessage','findAll','addTags','emit','removeTags','download','unix','join','files','tmp','root','server','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Attachment','Messages','direction','OpenchannelAccount','Account','User','get','mkdirSync','Openchannel','Owner','N.A.','closed','closedAt','Public','basename','existsSync','out','secret','views','downloadInteraction.ejs','transcript-','.pdf','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache'];(function(_0x745a18,_0x2b4207){var _0x228286=function(_0x288738){while(--_0x288738){_0x745a18['push'](_0x745a18['shift']());}};_0x228286(++_0x2b4207);}(_0x8d16,0x1cc));var _0x68d1=function(_0x752f9b,_0x1abff2){_0x752f9b=_0x752f9b-0x0;var _0x4cdc28=_0x8d16[_0x752f9b];return _0x4cdc28;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x68d1('0x0'));var zipdir=require(_0x68d1('0x1'));var jsonpatch=require(_0x68d1('0x2'));var rp=require(_0x68d1('0x3'));var moment=require(_0x68d1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x68d1('0x5'));var util=require(_0x68d1('0x6'));var path=require('path');var sox=require(_0x68d1('0x7'));var csv=require('to-csv');var ejs=require(_0x68d1('0x8'));var fs=require('fs');var fs_extra=require(_0x68d1('0x9'));var _=require('lodash');var squel=require(_0x68d1('0xa'));var crypto=require(_0x68d1('0xb'));var jsforce=require(_0x68d1('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x68d1('0xd'));var querystring=require(_0x68d1('0xe'));var Papa=require(_0x68d1('0xf'));var Redis=require(_0x68d1('0x10'));var authService=require(_0x68d1('0x11'));var qs=require(_0x68d1('0x12'));var as=require(_0x68d1('0x13'));var pdf=require('../../components/export/pdf');var hardwareService=require(_0x68d1('0x14'));var logger=require('../../config/logger')(_0x68d1('0x15'));var utils=require(_0x68d1('0x16'));var config=require(_0x68d1('0x17'));var licenseUtil=require(_0x68d1('0x18'));var db=require('../../mysqldb')['db'];config[_0x68d1('0x19')]=_[_0x68d1('0x1a')](config[_0x68d1('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x68d1('0x1b'))(new Redis(config['redis']));require(_0x68d1('0x1c'))[_0x68d1('0x1d')](socket);function respondWithStatusCode(_0x248536,_0x1386dd){_0x1386dd=_0x1386dd||0xcc;return function(_0x597064){if(_0x597064){return _0x248536['sendStatus'](_0x1386dd);}return _0x248536[_0x68d1('0x1e')](_0x1386dd)[_0x68d1('0x1f')]();};}function respondWithResult(_0x3ea5b0,_0x3cddaa){_0x3cddaa=_0x3cddaa||0xc8;return function(_0x2e67ed){if(_0x2e67ed){return _0x3ea5b0[_0x68d1('0x1e')](_0x3cddaa)[_0x68d1('0x20')](_0x2e67ed);}};}function respondWithFilteredResult(_0x16acaa,_0x37135f){return function(_0x51a8d9){if(_0x51a8d9){var _0x562a78=typeof _0x37135f[_0x68d1('0x21')]===_0x68d1('0x22')&&typeof _0x37135f[_0x68d1('0x23')]===_0x68d1('0x22');var _0x2ff035=_0x51a8d9[_0x68d1('0x24')];var _0x37d8d8=_0x562a78?0x0:_0x37135f['offset'];var _0x284645=_0x562a78?_0x51a8d9['count']:_0x37135f[_0x68d1('0x21')]+_0x37135f[_0x68d1('0x23')];var _0x48ce45;if(_0x284645>=_0x2ff035){_0x284645=_0x2ff035;_0x48ce45=0xc8;}else{_0x48ce45=0xce;}_0x16acaa['status'](_0x48ce45);return _0x16acaa[_0x68d1('0x25')]('Content-Range',_0x37d8d8+'-'+_0x284645+'/'+_0x2ff035)[_0x68d1('0x20')](_0x51a8d9);}return null;};}function patchUpdates(_0x2c0b0b){return function(_0x47ffec){try{jsonpatch[_0x68d1('0x26')](_0x47ffec,_0x2c0b0b,!![]);}catch(_0x7ef82b){return BPromise[_0x68d1('0x27')](_0x7ef82b);}return _0x47ffec[_0x68d1('0x28')]();};}function saveUpdates(_0x3807d6,_0xff2e9d){return function(_0x2fcfbc){if(_0x2fcfbc){return _0x2fcfbc[_0x68d1('0x29')](_0x3807d6)[_0x68d1('0x2a')](function(_0x1291e9){return _0x1291e9;});}return null;};}function removeEntity(_0x1fe11c,_0x438899){return function(_0x12567e){if(_0x12567e){return _0x12567e['destroy']()[_0x68d1('0x2a')](function(){_0x1fe11c[_0x68d1('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x22580c,_0x1b6db3){return function(_0x4c6cdc){if(!_0x4c6cdc){_0x22580c[_0x68d1('0x2b')](0x194);}return _0x4c6cdc;};}function handleError(_0x160b84,_0x45db77){_0x45db77=_0x45db77||0x1f4;return function(_0x285012){logger[_0x68d1('0x2c')](_0x285012[_0x68d1('0x2d')]);if(_0x285012[_0x68d1('0x2e')]){delete _0x285012[_0x68d1('0x2e')];}_0x160b84[_0x68d1('0x1e')](_0x45db77)[_0x68d1('0x2f')](_0x285012);};}function getInteractionUsers(_0x5db865,_0x57f423){return new BPromise(function(_0x359996,_0x593c33){try{if(_0x57f423[_0x5db865['id']]){_0x5db865[_0x68d1('0x30')]=_[_0x68d1('0x31')](_0x57f423[_0x5db865['id']],function(_0x31c639){return{'id':_0x31c639['id'],'fullname':_0x31c639[_0x68d1('0x32')]};});}}catch(_0x3db483){_0x593c33(_0x3db483);}_0x359996(_0x5db865);});}function getInteractionTags(_0x3bc3b0,_0x19d0d7){return new BPromise(function(_0x480846,_0x4173c6){try{if(_0x3bc3b0[_0x68d1('0x33')]){_0x3bc3b0[_0x68d1('0x34')]=[];_0x3bc3b0[_0x68d1('0x33')]['split'](',')[_0x68d1('0x35')](function(_0x113e4b){_0x3bc3b0[_0x68d1('0x34')][_0x68d1('0x36')](_0x19d0d7[_0x113e4b]);});}delete _0x3bc3b0[_0x68d1('0x33')];}catch(_0x1709a5){_0x4173c6(_0x1709a5);}_0x480846(_0x3bc3b0);});}function updateOpenchannelInteraction(_0xe615e6,_0x126212,_0x5129db){return new BPromise(function(_0x22d906,_0x39d9bf){return getInteractionUsers(_0xe615e6,_0x5129db)['then'](function(_0x485c32){return getInteractionTags(_0x485c32,_0x126212);})[_0x68d1('0x2a')](function(_0x51e5be){_0x22d906(_0x51e5be);})['catch'](function(_0x497f3b){_0x39d9bf(_0x497f3b);});});}exports[_0x68d1('0x37')]=function(_0x49c4a7,_0x1fcfa9){var _0x53fd01={},_0x55c0b1={},_0x5aeb1b={'count':0x0,'rows':[]};var _0x2bccb4=_[_0x68d1('0x31')](db['OpenchannelInteraction'][_0x68d1('0x38')],function(_0x5a50eb){return{'name':_0x5a50eb[_0x68d1('0x39')],'type':_0x5a50eb[_0x68d1('0x3a')][_0x68d1('0x3b')]};});_0x55c0b1[_0x68d1('0x3c')]=_[_0x68d1('0x31')](_0x2bccb4,_0x68d1('0x2e'));_0x55c0b1['query']=_['keys'](_0x49c4a7[_0x68d1('0x3d')]);_0x55c0b1[_0x68d1('0x3e')]=_['intersection'](_0x55c0b1['model'],_0x55c0b1[_0x68d1('0x3d')]);_0x53fd01['attributes']=_[_0x68d1('0x3f')](_0x55c0b1[_0x68d1('0x3c')],qs[_0x68d1('0x40')](_0x49c4a7[_0x68d1('0x3d')][_0x68d1('0x40')]));_0x53fd01[_0x68d1('0x41')]=_0x53fd01['attributes'][_0x68d1('0x42')]?_0x53fd01[_0x68d1('0x41')]:_0x55c0b1['model'];if(!_0x49c4a7[_0x68d1('0x3d')][_0x68d1('0x43')](_0x68d1('0x44'))){_0x53fd01[_0x68d1('0x23')]=qs['limit'](_0x49c4a7[_0x68d1('0x3d')][_0x68d1('0x23')]);_0x53fd01[_0x68d1('0x21')]=qs[_0x68d1('0x21')](_0x49c4a7[_0x68d1('0x3d')][_0x68d1('0x21')]);}_0x53fd01['order']=qs[_0x68d1('0x45')](_0x49c4a7[_0x68d1('0x3d')][_0x68d1('0x45')]);_0x53fd01[_0x68d1('0x46')]=qs[_0x68d1('0x3e')](_[_0x68d1('0x47')](_0x49c4a7[_0x68d1('0x3d')],_0x55c0b1[_0x68d1('0x3e')]),_0x2bccb4);var _0x250148=[];var _0x5cb3b6=squel[_0x68d1('0x48')]()['field']('id')['field']('name')[_0x68d1('0x49')](_0x68d1('0x4a'))['from'](_0x68d1('0x4b'));var _0x4e9b51=squel[_0x68d1('0x48')]()[_0x68d1('0x49')](_0x68d1('0x4c'))['field'](_0x68d1('0x4d'))[_0x68d1('0x49')](_0x68d1('0x4e'))[_0x68d1('0x4f')](_0x68d1('0x50'),'ui')['left_join']('users','u',_0x68d1('0x51'));var _0x3e7179=squel[_0x68d1('0x48')]()[_0x68d1('0x4f')](_0x68d1('0x52'),'i')[_0x68d1('0x53')](_0x68d1('0x54'),'c',_0x68d1('0x55'))['left_join'](_0x68d1('0x56'),'o',_0x68d1('0x57'))[_0x68d1('0x53')](_0x68d1('0x58'),'a','a.id\x20=\x20i.OpenchannelAccountId')[_0x68d1('0x53')]('openchannel_messages','me',_0x68d1('0x59'))[_0x68d1('0x53')](_0x68d1('0x5a'),'it',_0x68d1('0x5b'))[_0x68d1('0x53')](_0x68d1('0x4b'),'t',_0x68d1('0x5c'));var _0x18889e=squel[_0x68d1('0x5d')]();var _0x4b0975=[];var _0x303c52=squel[_0x68d1('0x5d')]();var _0x47f6b3;if(_0x49c4a7[_0x68d1('0x3d')][_0x68d1('0x5e')]){_0x47f6b3=as[_0x68d1('0x5f')](_0x49c4a7[_0x68d1('0x3d')][_0x68d1('0x5e')]);var _0x211ed0=_0x47f6b3[_0x68d1('0x60')];for(var _0x18e64b=0x0;_0x18e64b<_0x47f6b3[_0x68d1('0x61')][_0x68d1('0x42')];_0x18e64b++){var _0x55043e=_0x47f6b3[_0x68d1('0x61')][_0x18e64b];var _0x27371e='i';var _0x5511e3=_[_0x68d1('0x62')](_0x2bccb4,[_0x68d1('0x2e'),_0x55043e[_0x68d1('0x49')]]);if(!_0x5511e3){switch(_0x55043e['field']){case _0x68d1('0x63'):if(_0x55043e[_0x68d1('0x64')]==0x1){_0x3e7179[_0x68d1('0x65')]('`'+_0x55043e[_0x68d1('0x49')]+_0x68d1('0x66'));}else{_0x3e7179[_0x68d1('0x65')]('`'+_0x55043e[_0x68d1('0x49')]+_0x68d1('0x67'));}break;case'Contact':if(_0x55043e[_0x68d1('0x68')]===_0x68d1('0x69')){if(_0x55043e[_0x68d1('0x64')][_0x68d1('0x6a')]('\x20')[_0x68d1('0x42')]>0x1){_0x18889e[_0x211ed0]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x68d1('0x6b')](_0x55043e[_0x68d1('0x64')]),null);}else{var _0x14a7ff='%'+_0x55043e[_0x68d1('0x64')]+'%';_0x18889e[_0x211ed0](_0x68d1('0x6c'),_0x14a7ff,_0x14a7ff,_0x14a7ff);}}else{_0x5511e3=_[_0x68d1('0x62')](_0x2bccb4,[_0x68d1('0x2e'),_0x68d1('0x6d')]);_0x55043e['field']=_0x68d1('0x6d');_0x4b93c4=as[_0x68d1('0x6e')](_0x27371e,_0x5511e3[_0x68d1('0x3a')],_0x55043e);_0x18889e[_0x211ed0](_0x4b93c4[_0x68d1('0x6f')],_0x4b93c4[_0x68d1('0x64')][_0x68d1('0x70')],_0x4b93c4[_0x68d1('0x64')][_0x68d1('0x1f')]);}break;case _0x68d1('0x71'):var _0x504b2a=_0x55043e['value'][_0x68d1('0x6a')](',')['map'](function(_0x29188d){return Number(_0x29188d);});_0x504b2a[_0x68d1('0x35')](function(_0x80ed9c){_0x303c52['or'](_0x68d1('0x72'),'%,'+_0x80ed9c+',%');});_0x4b0975=_[_0x68d1('0x73')](_0x4b0975,_0x504b2a);break;case'User':if(_0x55043e[_0x68d1('0x68')]===_0x68d1('0x69')){_0x18889e[_0x211ed0]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x55043e['value']+'%',null);}else{_0x5511e3=_['find'](_0x2bccb4,['name',_0x68d1('0x74')]);_0x55043e[_0x68d1('0x49')]=_0x68d1('0x74');_0x4b93c4=as['buildExpression'](_0x27371e,_0x5511e3[_0x68d1('0x3a')],_0x55043e);_0x18889e[_0x211ed0](_0x4b93c4[_0x68d1('0x6f')],_0x4b93c4[_0x68d1('0x64')][_0x68d1('0x70')],_0x4b93c4[_0x68d1('0x64')][_0x68d1('0x1f')]);}break;case _0x68d1('0x75'):_0x4b93c4=as[_0x68d1('0x6e')]('me',null,_0x55043e);_0x18889e[_0x211ed0](_0x4b93c4[_0x68d1('0x6f')],_0x4b93c4[_0x68d1('0x64')][_0x68d1('0x70')],_0x4b93c4['value']['end']);break;}}else{var _0x4b93c4=as['buildExpression'](_0x27371e,_0x5511e3['type'],_0x55043e);_0x18889e[_0x211ed0](_0x4b93c4[_0x68d1('0x6f')],_0x4b93c4['value'][_0x68d1('0x70')],_0x4b93c4[_0x68d1('0x64')][_0x68d1('0x1f')]);}}}else{var _0x598294=_(_0x49c4a7[_0x68d1('0x3d')])['keys']()['map'](function(_0x2226af){return _[_0x68d1('0x76')](_0x2bccb4,[_0x68d1('0x2e'),_0x2226af])?_0x2226af:undefined;})[_0x68d1('0x77')]()[_0x68d1('0x64')]();if(!_['isEmpty'](_0x598294)){_0x598294['forEach'](function(_0x474df0){if(_0x474df0===_0x68d1('0x78')){_0x3e7179[_0x68d1('0x46')]('i.OpenchannelAccountId\x20IN\x20?',[]['concat'](_0x49c4a7[_0x68d1('0x3d')][_0x474df0]));}else if(_0x474df0===_0x68d1('0x79')){var _0x17120e=JSON['parse'](_0x49c4a7[_0x68d1('0x3d')][_0x474df0])[_0x68d1('0x7a')];var _0x468ce6=JSON['parse'](_0x49c4a7['query'][_0x474df0])['$lte'];_0x3e7179[_0x68d1('0x46')](_0x68d1('0x7b'),_0x17120e,_0x468ce6);}else{if(_0x49c4a7['query'][_0x474df0]===_0x68d1('0x7c')){_0x3e7179[_0x68d1('0x46')]('i.'+_0x474df0+_0x68d1('0x7d'));}else{_0x3e7179['where']('i.'+_0x474df0+'\x20=\x20?',_0x49c4a7[_0x68d1('0x3d')][_0x474df0]);}}});}if(_0x49c4a7['query']['read']){if(_0x49c4a7[_0x68d1('0x3d')][_0x68d1('0x7e')]==0x1){_0x3e7179['having'](_0x68d1('0x7f'));}else{_0x3e7179[_0x68d1('0x65')](_0x68d1('0x80'));}}if(_0x49c4a7[_0x68d1('0x3d')][_0x68d1('0x81')]){_0x4b0975=_['isArray'](_0x49c4a7[_0x68d1('0x3d')][_0x68d1('0x81')])?_0x49c4a7[_0x68d1('0x3d')][_0x68d1('0x81')]:new Array(_0x49c4a7[_0x68d1('0x3d')]['tag']);_0x4b0975['forEach'](function(_0x5369c9){_0x303c52['or'](_0x68d1('0x72'),'%,'+_0x5369c9+',%');});}if(_0x49c4a7[_0x68d1('0x3d')][_0x68d1('0x82')]){var _0x1abadc=_0x49c4a7[_0x68d1('0x3d')][_0x68d1('0x82')][_0x68d1('0x83')]('\x5c','\x5c\x5c')[_0x68d1('0x83')](/'/g,'\x27\x27');if(qs[_0x68d1('0x84')](_0x1abadc)){_0x18889e['or'](_0x68d1('0x85'),_0x1abadc+'%');}else{_0x18889e['or'](_0x68d1('0x86'),qs[_0x68d1('0x6b')](_0x1abadc))['or'](_0x68d1('0x87'),_0x1abadc+'%')['or'](_0x68d1('0x88'),_0x1abadc+'%');}}}_0x3e7179['where'](_0x18889e);_0x3e7179['group'](_0x68d1('0x89'));var _0xeb7148={'type':db[_0x68d1('0x8a')][_0x68d1('0x8b')][_0x68d1('0x8c')],'raw':!![]};var _0x5a88da=_0x3e7179[_0x68d1('0x8d')]();_0x5a88da['field']('i.id');_0x5a88da[_0x68d1('0x49')](_0x68d1('0x8e'),_0x68d1('0x63'));if(_0x53fd01['order']){_0x53fd01[_0x68d1('0x8f')][_0x68d1('0x35')](function(_0x5ddc5f){var _0xe2157c=_0x5ddc5f[0x0]===_0x68d1('0x90')?_0x5ddc5f[0x0]:'i.'+_0x5ddc5f[0x0];_0x3e7179[_0x68d1('0x8f')](_0xe2157c,_0x5ddc5f[0x1]===_0x68d1('0x91')?![]:!![]);});}if(!_['isEmpty'](_0x4b0975)){_0x3e7179[_0x68d1('0x65')](_0x303c52);_0x5a88da[_0x68d1('0x46')](_0x68d1('0x92'),_0x4b0975);}BPromise[_0x68d1('0x93')]()[_0x68d1('0x2a')](function(){if(!_0x47f6b3){if(_0x49c4a7[_0x68d1('0x3d')][_0x68d1('0x78')])return;_0x5a88da[_0x68d1('0x46')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0x3e7179['where'](_0x68d1('0x94'));return;}if(_0x49c4a7['user']['role']!==_0x68d1('0x95'))return;return _0x49c4a7[_0x68d1('0x96')][_0x68d1('0x97')]({'attributes':['id'],'raw':!![]})[_0x68d1('0x2a')](function(_0x307543){if(_['isEmpty'](_0x307543)){_0x5a88da[_0x68d1('0x46')](_0x68d1('0x98'));_0x3e7179[_0x68d1('0x46')](_0x68d1('0x98'));}else{_0x5a88da[_0x68d1('0x46')](_0x68d1('0x99'),_[_0x68d1('0x31')](_0x307543,'id'));_0x3e7179['where']('i.OpenchannelAccountId\x20IN\x20?',_[_0x68d1('0x31')](_0x307543,'id'));}});})[_0x68d1('0x2a')](function(){if(_0x49c4a7['user'][_0x68d1('0x9a')]===_0x68d1('0x95')&&!_0x47f6b3&&!_0x49c4a7[_0x68d1('0x3d')][_0x68d1('0x78')])return[];return db['sequelize'][_0x68d1('0x3d')](_0x5a88da['toString'](),_0xeb7148);})['then'](function(_0x4a6f93){_0x5aeb1b['count']=_0x4a6f93['length'];if(_0x5aeb1b['count']===0x0)return[];return db[_0x68d1('0x9b')][_0x68d1('0x3d')](_0x5cb3b6[_0x68d1('0x9c')](),_0xeb7148)[_0x68d1('0x2a')](function(_0x427cc4){_0x250148=_[_0x68d1('0x9d')](_0x427cc4,'id');_0xeb7148=_[_0x68d1('0x9e')](_0xeb7148,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x49c4a7['query']['fields']){_0x53fd01['attributes'][_0x68d1('0x35')](function(_0x936053){_0x3e7179[_0x68d1('0x49')]('i.'+_0x936053);});}else{_0x3e7179[_0x68d1('0x49')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x68d1('0x63'));_0x3e7179[_0x68d1('0x49')](_0x68d1('0x9f'),_0x68d1('0xa0'));_0x3e7179['field'](_0x68d1('0xa1'),'Account.mandatoryDisposition');_0x3e7179[_0x68d1('0x49')]('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',_0x68d1('0x90'));_0x3e7179['field'](_0x68d1('0xa2'));_0x3e7179[_0x68d1('0x49')]('c.firstName','Contact.firstName');_0x3e7179[_0x68d1('0x49')]('c.lastName',_0x68d1('0xa3'));_0x3e7179[_0x68d1('0x49')](_0x68d1('0xa4'),'Contact.email');_0x3e7179['field']('c.phone',_0x68d1('0xa5'));_0x3e7179['field'](_0x68d1('0xa6'),_0x68d1('0xa7'));_0x3e7179['field'](_0x68d1('0xa8'),'Contact.fax');_0x3e7179[_0x68d1('0x49')]('o.fullname',_0x68d1('0xa9'));_0x3e7179['field'](_0x68d1('0xaa'),_0x68d1('0xab'));_0x3e7179['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0x68d1('0x33'));}if(_0x53fd01[_0x68d1('0x23')])_0x3e7179['limit'](_0x53fd01[_0x68d1('0x23')]);if(_0x53fd01[_0x68d1('0x21')])_0x3e7179[_0x68d1('0x21')](_0x53fd01[_0x68d1('0x21')]);return db['sequelize'][_0x68d1('0x3d')](_0x3e7179['toString'](),_0xeb7148);})['then'](function(_0x2b3da4){if(_0x2b3da4[_0x68d1('0x42')]>0x0)_0x4e9b51['where'](_0x68d1('0xac'),_[_0x68d1('0x31')](_0x2b3da4,'id'));return db['sequelize'][_0x68d1('0x3d')](_0x4e9b51[_0x68d1('0x9c')](),_0xeb7148)['then'](function(_0x32defb){var _0x37641a=_[_0x68d1('0xad')](_0x32defb,_0x68d1('0xae'));var _0x328d92=[];_0x2b3da4[_0x68d1('0x35')](function(_0xcbe3a6){_0x328d92['push'](updateOpenchannelInteraction(_0xcbe3a6,_0x250148,_0x37641a));});return BPromise[_0x68d1('0xaf')](_0x328d92);});});})['then'](function(_0x3680f8){_0x5aeb1b[_0x68d1('0xb0')]=_0x3680f8;return _0x5aeb1b;})[_0x68d1('0x2a')](respondWithFilteredResult(_0x1fcfa9,_0x53fd01))['catch'](handleError(_0x1fcfa9,null));};exports[_0x68d1('0xb1')]=function(_0x5688c8,_0xea749f){var _0x2c00f7={};if(_0x5688c8[_0x68d1('0x3d')][_0x68d1('0x3a')]&&_0x5688c8['query'][_0x68d1('0x3a')]==='from'){_0x2c00f7[_0x68d1('0x4f')]=_0x5688c8[_0x68d1('0xb2')]['id'];}else{_0x2c00f7['id']=_0x5688c8[_0x68d1('0xb2')]['id'];}var _0x1dbc4c={'raw':![],'where':_0x2c00f7},_0x2a7861={};_0x2a7861['model']=_[_0x68d1('0xb3')](db[_0x68d1('0xb4')][_0x68d1('0x38')]);_0x2a7861['query']=_[_0x68d1('0xb3')](_0x5688c8[_0x68d1('0x3d')]);_0x2a7861[_0x68d1('0x3e')]=_[_0x68d1('0x3f')](_0x2a7861[_0x68d1('0x3c')],_0x2a7861[_0x68d1('0x3d')]);_0x1dbc4c['attributes']=_[_0x68d1('0x3f')](_0x2a7861[_0x68d1('0x3c')],qs[_0x68d1('0x40')](_0x5688c8['query'][_0x68d1('0x40')]));_0x1dbc4c[_0x68d1('0x41')]=_0x1dbc4c[_0x68d1('0x41')][_0x68d1('0x42')]?_0x1dbc4c['attributes']:_0x2a7861[_0x68d1('0x3c')];if(_0x5688c8[_0x68d1('0x3d')][_0x68d1('0xb5')]){_0x1dbc4c[_0x68d1('0xb6')]=[{'all':!![]}];}_0x1dbc4c=_['merge']({},_0x1dbc4c,_0x5688c8[_0x68d1('0xb7')]);return db[_0x68d1('0xb4')][_0x68d1('0x62')](_0x1dbc4c)['then'](handleEntityNotFound(_0xea749f,null))[_0x68d1('0x2a')](respondWithResult(_0xea749f,null))[_0x68d1('0xb8')](handleError(_0xea749f,null));};exports['create']=function(_0x4f4e80,_0x589142){return db[_0x68d1('0xb4')][_0x68d1('0xb9')](_0x4f4e80[_0x68d1('0x75')],{})['then'](respondWithResult(_0x589142,0xc9))[_0x68d1('0xb8')](handleError(_0x589142,null));};exports[_0x68d1('0x29')]=function(_0x34f19c,_0x5b14a8){if(_0x34f19c[_0x68d1('0x75')]['id']){delete _0x34f19c[_0x68d1('0x75')]['id'];}return db[_0x68d1('0xb4')]['find']({'where':{'id':_0x34f19c[_0x68d1('0xb2')]['id']}})[_0x68d1('0x2a')](handleEntityNotFound(_0x5b14a8,null))['then'](saveUpdates(_0x34f19c['body'],null))[_0x68d1('0x2a')](respondWithResult(_0x5b14a8,null))[_0x68d1('0xb8')](handleError(_0x5b14a8,null));};exports[_0x68d1('0xba')]=function(_0x252283,_0x469255){return db[_0x68d1('0xb4')][_0x68d1('0x62')]({'where':{'id':_0x252283['params']['id']}})['then'](handleEntityNotFound(_0x469255,null))['then'](removeEntity(_0x469255,null))[_0x68d1('0xb8')](handleError(_0x469255,null));};exports[_0x68d1('0xbb')]=function(_0x34c1cd,_0xbfbedf){return db[_0x68d1('0xb4')][_0x68d1('0xbb')]()[_0x68d1('0x2a')](respondWithResult(_0xbfbedf,null))[_0x68d1('0xb8')](handleError(_0xbfbedf,null));};exports['addMessage']=function(_0x3773ea,_0x2aeb9f,_0x32c959){return db['OpenchannelMessage'][_0x68d1('0x62')]({'where':{'id':_0x3773ea[_0x68d1('0xb2')]['id']}})['then'](handleEntityNotFound(_0x2aeb9f,null))[_0x68d1('0x2a')](function(_0x297ce9){if(_0x297ce9){return _0x297ce9['addMessage'](_0x3773ea[_0x68d1('0x75')]['ids'],_[_0x68d1('0xbc')](_0x3773ea[_0x68d1('0x75')],[_0x68d1('0xbd'),'id'])||{});}})[_0x68d1('0x2a')](respondWithResult(_0x2aeb9f,null))[_0x68d1('0xb8')](handleError(_0x2aeb9f,null));};exports['getMessages']=function(_0x2a60f3,_0x575a0e,_0x182e51){var _0x39c20d={'raw':![],'where':{}};var _0x501ee5={};var _0x555646={'count':0x0,'rows':[]};return db[_0x68d1('0xb4')][_0x68d1('0xbe')]({'where':{'id':_0x2a60f3[_0x68d1('0xb2')]['id']}})[_0x68d1('0x2a')](handleEntityNotFound(_0x575a0e,null))['then'](function(_0x4e31d7){if(_0x4e31d7){_0x501ee5[_0x68d1('0x3c')]=_[_0x68d1('0xb3')](db['OpenchannelMessage'][_0x68d1('0x38')]);_0x501ee5[_0x68d1('0x3d')]=_[_0x68d1('0xb3')](_0x2a60f3[_0x68d1('0x3d')]);_0x501ee5['filters']=_[_0x68d1('0x3f')](_0x501ee5[_0x68d1('0x3c')],_0x501ee5[_0x68d1('0x3d')]);_0x39c20d[_0x68d1('0x41')]=_[_0x68d1('0x3f')](_0x501ee5[_0x68d1('0x3c')],qs[_0x68d1('0x40')](_0x2a60f3[_0x68d1('0x3d')][_0x68d1('0x40')]));_0x39c20d['attributes']=_0x39c20d[_0x68d1('0x41')][_0x68d1('0x42')]?_0x39c20d[_0x68d1('0x41')]:_0x501ee5[_0x68d1('0x3c')];if(!_0x2a60f3['query'][_0x68d1('0x43')](_0x68d1('0x44'))){_0x39c20d[_0x68d1('0x23')]=qs['limit'](_0x2a60f3[_0x68d1('0x3d')][_0x68d1('0x23')]);_0x39c20d[_0x68d1('0x21')]=qs[_0x68d1('0x21')](_0x2a60f3[_0x68d1('0x3d')][_0x68d1('0x21')]);}_0x39c20d[_0x68d1('0x8f')]=qs[_0x68d1('0x45')](_0x2a60f3[_0x68d1('0x3d')]['sort']);_0x39c20d['where']=qs[_0x68d1('0x3e')](_[_0x68d1('0x47')](_0x2a60f3[_0x68d1('0x3d')],_0x501ee5[_0x68d1('0x3e')]));_0x39c20d[_0x68d1('0x46')][_0x68d1('0xae')]=_0x4e31d7['id'];if(_0x2a60f3[_0x68d1('0x3d')][_0x68d1('0x82')]){_0x39c20d['where']=_['merge'](_0x39c20d[_0x68d1('0x46')],{'$or':_[_0x68d1('0x31')](_0x39c20d[_0x68d1('0x41')],function(_0x113ce9){var _0x2f1905={};_0x2f1905[_0x113ce9]={'$like':'%'+_0x2a60f3['query'][_0x68d1('0x82')]+'%'};return _0x2f1905;})});}if(_0x2a60f3[_0x68d1('0x3d')][_0x68d1('0x7a')]){var _0x110338=_0x2a60f3['query'][_0x68d1('0x7a')][_0x68d1('0x6a')](',');var _0x527323={};_0x527323[_0x110338[0x0]]={'$gte':moment(_0x110338[0x1])[_0x68d1('0xbf')](_0x68d1('0xc0'))};_0x39c20d[_0x68d1('0x46')]=_[_0x68d1('0x9e')](_0x39c20d[_0x68d1('0x46')],_0x527323);}_0x39c20d=_[_0x68d1('0x9e')]({},_0x39c20d,_0x2a60f3['options']);return db[_0x68d1('0xc1')][_0x68d1('0x24')]({'where':_0x39c20d[_0x68d1('0x46')]})[_0x68d1('0x2a')](function(_0x5c08ae){_0x555646[_0x68d1('0x24')]=_0x5c08ae;if(_0x2a60f3['query'][_0x68d1('0xb5')]){_0x39c20d[_0x68d1('0xb6')]=[{'all':!![]}];}return db[_0x68d1('0xc1')][_0x68d1('0xc2')](_0x39c20d);})['then'](function(_0x43007f){_0x555646[_0x68d1('0xb0')]=_0x43007f;return _0x555646;});}})['then'](respondWithFilteredResult(_0x575a0e,_0x39c20d))[_0x68d1('0xb8')](handleError(_0x575a0e,null));};exports[_0x68d1('0xc3')]=function(_0x4387c4,_0x31f0a8,_0x328147){return db[_0x68d1('0xb4')][_0x68d1('0x62')]({'where':{'id':_0x4387c4[_0x68d1('0xb2')]['id']}})['then'](handleEntityNotFound(_0x31f0a8,null))[_0x68d1('0x2a')](function(_0x445d6b){if(_0x445d6b){return _0x445d6b['setTags'](_0x4387c4[_0x68d1('0x75')]['ids'],_['omit'](_0x4387c4[_0x68d1('0x75')],[_0x68d1('0xbd'),'id'])||{})['spread'](function(){return db[_0x68d1('0x71')][_0x68d1('0xc2')]({'attributes':['id',_0x68d1('0x2e'),_0x68d1('0x4a')],'where':{'id':_0x4387c4[_0x68d1('0x75')][_0x68d1('0xbd')]}});})[_0x68d1('0x2a')](function(_0x15635c){socket[_0x68d1('0xc4')]('openchannelInteractionTags:save',{'id':Number(_0x4387c4['params']['id']),'tags':_0x15635c||[]});return{'id':Number(_0x4387c4[_0x68d1('0xb2')]['id']),'tags':_0x15635c||[]};});}})[_0x68d1('0x2a')](respondWithResult(_0x31f0a8,null))[_0x68d1('0xb8')](handleError(_0x31f0a8,null));};exports[_0x68d1('0xc5')]=function(_0x83b718,_0x32005c,_0x2750e8){return db[_0x68d1('0xb4')][_0x68d1('0x62')]({'where':{'id':_0x83b718[_0x68d1('0xb2')]['id']}})[_0x68d1('0x2a')](handleEntityNotFound(_0x32005c,null))[_0x68d1('0x2a')](function(_0x35b985){if(_0x35b985){return _0x35b985[_0x68d1('0xc5')](_0x83b718[_0x68d1('0x3d')][_0x68d1('0xbd')]);}})[_0x68d1('0x2a')](respondWithStatusCode(_0x32005c,null))[_0x68d1('0xb8')](handleError(_0x32005c,null));};exports[_0x68d1('0xc6')]=function(_0x45260b,_0x890f0e){var _0x35401d=moment()[_0x68d1('0xc7')]()[_0x68d1('0x9c')]();var _0x421dab=path[_0x68d1('0xc8')](config['root'],'server',_0x68d1('0xc9'),_0x68d1('0xca'));var _0x1333e3=path['join'](config[_0x68d1('0xcb')],_0x68d1('0xcc'),_0x68d1('0xc9'),_0x68d1('0xcd'));var _0x235c19=path[_0x68d1('0xc8')](_0x421dab,_0x35401d);var _0x4f857b=util[_0x68d1('0xbf')](_0x68d1('0xce'),_0x45260b[_0x68d1('0xb2')]['id'],_0x35401d);var _0x14cda8=path[_0x68d1('0xc8')](_0x421dab,_0x4f857b);var _0x44d551=[];_0x44d551[_0x68d1('0x36')]({'model':db['User'],'as':'User','attributes':['id',_0x68d1('0x32')],'raw':!![]});_0x44d551[_0x68d1('0x36')]({'model':db[_0x68d1('0xcf')],'as':'Contact','attributes':['id',_0x68d1('0xd0'),_0x68d1('0xd1')],'raw':!![]});if(_0x45260b['query'][_0x68d1('0xcd')]){_0x44d551[_0x68d1('0x36')]({'model':db['Attachment'],'as':_0x68d1('0xd2'),'raw':!![]});}var _0x4a1146=[{'model':db[_0x68d1('0xc1')],'as':_0x68d1('0xd3'),'attributes':['id',_0x68d1('0x75'),_0x68d1('0x79'),_0x68d1('0xd4'),'secret',_0x68d1('0x7e')],'include':_0x44d551}];_0x4a1146[_0x68d1('0x36')]({'model':db[_0x68d1('0xd5')],'as':_0x68d1('0xd6'),'attributes':['id',_0x68d1('0x2e')]});_0x4a1146['push']({'model':db[_0x68d1('0xd7')],'as':'Owner','attributes':['id',_0x68d1('0x32')]});return db[_0x68d1('0xb4')][_0x68d1('0x62')]({'where':{'id':_0x45260b[_0x68d1('0xb2')]['id']},'include':_0x4a1146})[_0x68d1('0x2a')](handleEntityNotFound(_0x890f0e,null))[_0x68d1('0x2a')](function(_0x21e59f){if(_0x21e59f){var _0x24d2c9=_0x21e59f[_0x68d1('0xd8')]({'plain':!![]});fs[_0x68d1('0xd9')](_0x235c19);var _0x2e364b={'channel':_0x68d1('0xda'),'account':_0x24d2c9[_0x68d1('0xd6')][_0x68d1('0x2e')],'agent':_0x24d2c9['Owner']?_0x24d2c9[_0x68d1('0xdb')][_0x68d1('0x32')]:_0x68d1('0xdc'),'createdAt':moment(_0x24d2c9[_0x68d1('0x79')])[_0x68d1('0xbf')]('YYYY-MM-DD\x20HH:mm:ss')[_0x68d1('0x9c')](),'closedAt':_0x24d2c9[_0x68d1('0xdd')]?moment(_0x24d2c9[_0x68d1('0xde')])[_0x68d1('0xbf')](_0x68d1('0xc0'))[_0x68d1('0x9c')]():'','disposition':_0x24d2c9['disposition'],'visibility':_0x24d2c9['threadId']?_0x68d1('0xdf'):'Private','messages':_(_0x24d2c9['Messages'])['filter']({'secret':![]})[_0x68d1('0x31')](function(_0x232f4a){if(_0x232f4a['Attachment']){var _0x3b58f3=path[_0x68d1('0xc8')](_0x1333e3,_0x232f4a[_0x68d1('0xd2')][_0x68d1('0xe0')]);if(fs[_0x68d1('0xe1')](_0x3b58f3)){fs['createReadStream'](_0x3b58f3)['pipe'](fs['createWriteStream'](path[_0x68d1('0xc8')](_0x235c19,_0x232f4a[_0x68d1('0xd2')][_0x68d1('0xe0')])));}}return{'date':moment(_0x232f4a[_0x68d1('0x79')])['format'](_0x68d1('0xc0'))[_0x68d1('0x9c')](),'sender':_0x232f4a[_0x68d1('0xd4')]===_0x68d1('0xe2')?_0x232f4a['User']?_0x232f4a['User']['fullname']:'System':_0x232f4a['Contact']['firstName']+(_0x232f4a['Contact']['lastName']?'\x20'+_0x232f4a['Contact'][_0x68d1('0xd1')]:''),'body':_0x232f4a[_0x68d1('0xd2')]?_0x232f4a[_0x68d1('0xd2')]['basename']:_0x232f4a['body'],'direction':_0x232f4a[_0x68d1('0xd4')]===_0x68d1('0xe2')?'A':'C','secret':_0x232f4a[_0x68d1('0xe3')],'read':_0x232f4a[_0x68d1('0x7e')],'attachment':_0x232f4a[_0x68d1('0xd2')]};})['value']()};return ejs['renderFile'](path[_0x68d1('0xc8')](config['root'],'server',_0x68d1('0xe4'),_0x68d1('0xe5')),{'interaction':_0x2e364b})[_0x68d1('0x2a')](function(_0x41beb5){var _0x65ac9d=path[_0x68d1('0xc8')](_0x235c19,_0x68d1('0xe6')+_0x24d2c9['id']+'-'+_0x35401d+_0x68d1('0xe7'));var _0x3414bd={'path':_0x65ac9d,'channel':_0x68d1('0xda'),'interactionId':_0x24d2c9['id']};return pdf['createPdfFromHTML'](_0x41beb5,_0x3414bd);})[_0x68d1('0x2a')](function(){return new BPromise(function(_0x2b627b,_0xc31083){zipdir(_0x235c19,{'saveTo':_0x14cda8},function(_0x4a45d9,_0x44f5cf){if(_0x4a45d9)return _0xc31083(_0x4a45d9);return _0x2b627b(_0x44f5cf);});})['then'](function(){return new BPromise(function(_0x10ac87,_0x40ab23){rimraf(_0x235c19,function(_0x2cbf51){if(_0x2cbf51)_0x40ab23(_0x2cbf51);return _0x10ac87();});});})[_0x68d1('0x2a')](function(){return _0x890f0e[_0x68d1('0xc6')](_0x14cda8,_0x4f857b,function(_0x3b40d1){if(_0x3b40d1){console['log']('err',_0x3b40d1);}else{fs[_0x68d1('0xe8')](_0x14cda8);}});});});}else{return _0x890f0e[_0x68d1('0x2b')](0xc8);}})[_0x68d1('0xb8')](handleError(_0x890f0e,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index fde8ba6..ff5acae 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 _0xa37e=['hasOwnProperty','hook','exports','events','OpenchannelInteraction','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','getUsers','then','map','findAll','setDataValue','unreadMessages','length','emit'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0xa37e,0x1e9));var _0xea37=function(_0x1db7c4,_0x3ee62c){_0x1db7c4=_0x1db7c4-0x0;var _0x35bf98=_0xa37e[_0x1db7c4];return _0x35bf98;};'use strict';var EventEmitter=require(_0xea37('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0xea37('0x1')];var OpenchannelMessage=require(_0xea37('0x2'))['db'][_0xea37('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xea37('0x4')](0x0);var events={'afterCreate':_0xea37('0x5'),'afterUpdate':_0xea37('0x6'),'afterDestroy':'remove'};function emitEvent(_0x470ea8){return function(_0x4bf4d3,_0x298d6d,_0x2ca15f){_0x4bf4d3[_0xea37('0x7')]({'attributes':['id'],'raw':!![]})[_0xea37('0x8')](function(_0x1f1255){_0x4bf4d3['setDataValue']('Users',_0x1f1255[_0xea37('0x9')](function(_0x47210b){return{'id':_0x47210b['id']};}));return OpenchannelMessage[_0xea37('0xa')]({'where':{'OpenchannelInteractionId':_0x4bf4d3['id'],'direction':'in','read':![]},'raw':!![]});})[_0xea37('0x8')](function(_0x5ca548){_0x4bf4d3[_0xea37('0xb')](_0xea37('0xc'),_0x5ca548[_0xea37('0xd')]);OpenchannelInteractionEvents[_0xea37('0xe')](_0x470ea8+':'+_0x4bf4d3['id'],_0x4bf4d3);OpenchannelInteractionEvents[_0xea37('0xe')](_0x470ea8,_0x4bf4d3);_0x2ca15f(null);})['catch'](_0x2ca15f(null));};}for(var e in events){if(events[_0xea37('0xf')](e)){var event=events[e];OpenchannelInteraction[_0xea37('0x10')](e,emitEvent(event));}}module[_0xea37('0x11')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0xb4b6=['emit','catch','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','save','remove','getUsers','then','setDataValue','Users','map','unreadMessages'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb4b6,0x198));var _0x6b4b=function(_0x592982,_0x31ee36){_0x592982=_0x592982-0x0;var _0x3c34db=_0xb4b6[_0x592982];return _0x3c34db;};'use strict';var EventEmitter=require(_0x6b4b('0x0'));var OpenchannelInteraction=require(_0x6b4b('0x1'))['db'][_0x6b4b('0x2')];var OpenchannelMessage=require(_0x6b4b('0x1'))['db'][_0x6b4b('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6b4b('0x4'),'afterUpdate':'update','afterDestroy':_0x6b4b('0x5')};function emitEvent(_0x466584){return function(_0x41c714,_0x95bd42,_0x23383a){_0x41c714[_0x6b4b('0x6')]({'attributes':['id'],'raw':!![]})[_0x6b4b('0x7')](function(_0x383dbe){_0x41c714[_0x6b4b('0x8')](_0x6b4b('0x9'),_0x383dbe[_0x6b4b('0xa')](function(_0x2957e2){return{'id':_0x2957e2['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x41c714['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3d38a8){_0x41c714['setDataValue'](_0x6b4b('0xb'),_0x3d38a8['length']);OpenchannelInteractionEvents[_0x6b4b('0xc')](_0x466584+':'+_0x41c714['id'],_0x41c714);OpenchannelInteractionEvents[_0x6b4b('0xc')](_0x466584,_0x41c714);_0x23383a(null);})[_0x6b4b('0xd')](_0x23383a(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0x6b4b('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index a1747c4..d2e145c 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 _0x30cd=['moment','bluebird','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','format','lodash','util','../../config/logger'];(function(_0x2e87aa,_0x553dcb){var _0x4b25=function(_0x2d3612){while(--_0x2d3612){_0x2e87aa['push'](_0x2e87aa['shift']());}};_0x4b25(++_0x553dcb);}(_0x30cd,0x1e3));var _0xd30c=function(_0x25cacb,_0x49f700){_0x25cacb=_0x25cacb-0x0;var _0x382b5d=_0x30cd[_0x25cacb];return _0x382b5d;};'use strict';var _=require(_0xd30c('0x0'));var util=require(_0xd30c('0x1'));var logger=require(_0xd30c('0x2'))('api');var moment=require(_0xd30c('0x3'));var BPromise=require(_0xd30c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd30c('0x5'));var rimraf=require(_0xd30c('0x6'));var config=require(_0xd30c('0x7'));var attributes=require(_0xd30c('0x8'));module[_0xd30c('0x9')]=function(_0x352f7d,_0x699ce0){return _0x352f7d['define'](_0xd30c('0xa'),attributes,{'tableName':_0xd30c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd30c('0xc'),'collate':_0xd30c('0xd'),'hooks':{'beforeUpdate':function(_0x44af2e,_0x1d2d98,_0x23aef6){if(_0x44af2e[_0xd30c('0xe')](_0xd30c('0xf'))){_0x44af2e[_0xd30c('0x10')]=moment()[_0xd30c('0x11')]('YYYY-MM-DD\x20HH:mm:ss');}_0x23aef6(null,_0x44af2e);}}});}; \ No newline at end of file +var _0x2f1e=['define','OpenchannelInteraction','openchannel_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x3efe87,_0x35ad48){var _0x56a4cc=function(_0x47869e){while(--_0x47869e){_0x3efe87['push'](_0x3efe87['shift']());}};_0x56a4cc(++_0x35ad48);}(_0x2f1e,0xd9));var _0xe2f1=function(_0x3ced90,_0xf1aad1){_0x3ced90=_0x3ced90-0x0;var _0x5b9d75=_0x2f1e[_0x3ced90];return _0x5b9d75;};'use strict';var _=require(_0xe2f1('0x0'));var util=require(_0xe2f1('0x1'));var logger=require(_0xe2f1('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe2f1('0x3'));var rp=require(_0xe2f1('0x4'));var fs=require('fs');var path=require(_0xe2f1('0x5'));var rimraf=require(_0xe2f1('0x6'));var config=require('../../config/environment');var attributes=require('./openchannelInteraction.attributes');module['exports']=function(_0x561d2c,_0xdaef9f){return _0x561d2c[_0xe2f1('0x7')](_0xe2f1('0x8'),attributes,{'tableName':_0xe2f1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x5b2f4d,_0x38d0a2,_0x49afa6){if(_0x5b2f4d[_0xe2f1('0xa')](_0xe2f1('0xb'))){_0x5b2f4d['closedAt']=moment()[_0xe2f1('0xc')](_0xe2f1('0xd'));}_0x49afa6(null,_0x5b2f4d);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index e52da6e..66bcd4b 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 _0xb53c=['rpc','../../config/environment','client','http','redis','defaults','./openchannelInteraction.socket','register','request','then','info','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelInteraction,\x20%s,\x20%s','UpdateOpenchannelInteraction','OpenchannelInteraction','options','raw','where','attributes','limit','catch','AddTagsToOpenchannelInteraction','addTags','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x44e827,_0x145ed8){var _0xa19d97=function(_0x3a1176){while(--_0x3a1176){_0x44e827['push'](_0x44e827['shift']());}};_0xa19d97(++_0x145ed8);}(_0xb53c,0x124));var _0xcb53=function(_0x160bab,_0x34a7d6){_0x160bab=_0x160bab-0x0;var _0x4a8ed9=_0xb53c[_0x160bab];return _0x4a8ed9;};'use strict';var _=require(_0xcb53('0x0'));var util=require(_0xcb53('0x1'));var moment=require(_0xcb53('0x2'));var BPromise=require(_0xcb53('0x3'));var rs=require(_0xcb53('0x4'));var fs=require('fs');var Redis=require(_0xcb53('0x5'));var db=require(_0xcb53('0x6'))['db'];var utils=require(_0xcb53('0x7'));var logger=require(_0xcb53('0x8'))(_0xcb53('0x9'));var config=require(_0xcb53('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xcb53('0xb')][_0xcb53('0xc')]({'port':0x232a});config[_0xcb53('0xd')]=_[_0xcb53('0xe')](config[_0xcb53('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcb53('0xd')]));require(_0xcb53('0xf'))[_0xcb53('0x10')](socket);function respondWithRpcPromise(_0x354784,_0x47c553,_0x470e63){return new BPromise(function(_0x487f66,_0x23d845){return client[_0xcb53('0x11')](_0x354784,_0x470e63)[_0xcb53('0x12')](function(_0x5b16e2){logger[_0xcb53('0x13')]('OpenchannelInteraction,\x20%s,\x20%s',_0x47c553,_0xcb53('0x14'));logger[_0xcb53('0x15')](_0xcb53('0x16'),_0x47c553,_0xcb53('0x14'),JSON[_0xcb53('0x17')](_0x5b16e2));if(_0x5b16e2[_0xcb53('0x18')]){if(_0x5b16e2[_0xcb53('0x18')][_0xcb53('0x19')]===0x1f4){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x47c553,_0x5b16e2['error'][_0xcb53('0x1a')]);return _0x23d845(_0x5b16e2[_0xcb53('0x18')][_0xcb53('0x1a')]);}logger['error'](_0xcb53('0x1b'),_0x47c553,_0x5b16e2[_0xcb53('0x18')][_0xcb53('0x1a')]);return _0x487f66(_0x5b16e2[_0xcb53('0x18')]['message']);}else{logger[_0xcb53('0x13')]('OpenchannelInteraction,\x20%s,\x20%s',_0x47c553,_0xcb53('0x14'));_0x487f66(_0x5b16e2['result'][_0xcb53('0x1a')]);}})['catch'](function(_0x39a1bd){logger[_0xcb53('0x18')](_0xcb53('0x1b'),_0x47c553,_0x39a1bd);_0x23d845(_0x39a1bd);});});}exports[_0xcb53('0x1c')]=function(_0x879258){var _0x98ddf1=this;return new Promise(function(_0x13f653,_0x1bd4c7){return db[_0xcb53('0x1d')]['update'](_0x879258['body'],{'raw':_0x879258[_0xcb53('0x1e')]?_0x879258[_0xcb53('0x1e')][_0xcb53('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x879258[_0xcb53('0x1e')]?_0x879258[_0xcb53('0x1e')][_0xcb53('0x20')]||null:null,'attributes':_0x879258[_0xcb53('0x1e')]?_0x879258[_0xcb53('0x1e')][_0xcb53('0x21')]||null:null,'limit':_0x879258[_0xcb53('0x1e')]?_0x879258[_0xcb53('0x1e')][_0xcb53('0x22')]||null:null})[_0xcb53('0x12')](function(_0x519d83){logger[_0xcb53('0x13')](_0xcb53('0x1c'),_0x879258);logger[_0xcb53('0x15')](_0xcb53('0x1c'),_0x879258,JSON[_0xcb53('0x17')](_0x519d83));_0x13f653(_0x519d83);})[_0xcb53('0x23')](function(_0x3cd7f3){logger[_0xcb53('0x18')](_0xcb53('0x1c'),_0x3cd7f3[_0xcb53('0x1a')],_0x879258);_0x1bd4c7(_0x98ddf1[_0xcb53('0x18')](0x1f4,_0x3cd7f3['message']));});});};exports[_0xcb53('0x24')]=function(_0x22253d){return new Promise(function(_0x269c5e,_0x473a9b){return db['OpenchannelInteraction']['find']({'where':_0x22253d['options']?_0x22253d[_0xcb53('0x1e')][_0xcb53('0x20')]||null:null})[_0xcb53('0x12')](function(_0x7d9c25){if(_0x7d9c25){return _0x7d9c25[_0xcb53('0x25')](_0x22253d[_0xcb53('0x26')][_0xcb53('0x27')],_[_0xcb53('0x28')](_0x22253d['body'],['ids','id'])||{});}})[_0xcb53('0x29')](function(_0x17e0ec){logger[_0xcb53('0x13')](_0xcb53('0x2a'),_0x22253d);logger[_0xcb53('0x15')]('AddTags',_0x22253d,JSON[_0xcb53('0x17')](_0x17e0ec));_0x269c5e(_0x17e0ec);})['catch'](function(_0x3c1971){logger[_0xcb53('0x18')](_0xcb53('0x2a'),_0x3c1971[_0xcb53('0x1a')],_0x22253d);_0x473a9b(_this[_0xcb53('0x18')](0x1f4,_0x3c1971[_0xcb53('0x1a')]));});});}; \ No newline at end of file +var _0x6c68=['http','redis','register','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','where','attributes','limit','find','then','addTags','ids','spread','AddTags','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x6c68,0x11e));var _0x86c6=function(_0x3fb135,_0xa2bc39){_0x3fb135=_0x3fb135-0x0;var _0x1120fb=_0x6c68[_0x3fb135];return _0x1120fb;};'use strict';var _=require(_0x86c6('0x0'));var util=require(_0x86c6('0x1'));var moment=require('moment');var BPromise=require(_0x86c6('0x2'));var rs=require(_0x86c6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x86c6('0x4'));var logger=require(_0x86c6('0x5'))(_0x86c6('0x6'));var config=require(_0x86c6('0x7'));var jayson=require(_0x86c6('0x8'));var client=jayson[_0x86c6('0x9')][_0x86c6('0xa')]({'port':0x232a});config[_0x86c6('0xb')]=_['defaults'](config[_0x86c6('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x86c6('0xb')]));require('./openchannelInteraction.socket')[_0x86c6('0xc')](socket);function respondWithRpcPromise(_0x50a6f9,_0x344d8f,_0x42fab6){return new BPromise(function(_0x40a3bf,_0x823a90){return client['request'](_0x50a6f9,_0x42fab6)['then'](function(_0x38d1c9){logger[_0x86c6('0xd')](_0x86c6('0xe'),_0x344d8f,_0x86c6('0xf'));logger[_0x86c6('0x10')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x344d8f,_0x86c6('0xf'),JSON[_0x86c6('0x11')](_0x38d1c9));if(_0x38d1c9[_0x86c6('0x12')]){if(_0x38d1c9[_0x86c6('0x12')][_0x86c6('0x13')]===0x1f4){logger[_0x86c6('0x12')]('OpenchannelInteraction,\x20%s,\x20%s',_0x344d8f,_0x38d1c9[_0x86c6('0x12')][_0x86c6('0x14')]);return _0x823a90(_0x38d1c9[_0x86c6('0x12')][_0x86c6('0x14')]);}logger[_0x86c6('0x12')]('OpenchannelInteraction,\x20%s,\x20%s',_0x344d8f,_0x38d1c9[_0x86c6('0x12')][_0x86c6('0x14')]);return _0x40a3bf(_0x38d1c9[_0x86c6('0x12')]['message']);}else{logger['info'](_0x86c6('0xe'),_0x344d8f,_0x86c6('0xf'));_0x40a3bf(_0x38d1c9[_0x86c6('0x15')]['message']);}})[_0x86c6('0x16')](function(_0x3c66ab){logger[_0x86c6('0x12')](_0x86c6('0xe'),_0x344d8f,_0x3c66ab);_0x823a90(_0x3c66ab);});});}exports[_0x86c6('0x17')]=function(_0x151484){var _0x578a08=this;return new Promise(function(_0x5b132e,_0x5eb1fb){return db[_0x86c6('0x18')][_0x86c6('0x19')](_0x151484[_0x86c6('0x1a')],{'raw':_0x151484[_0x86c6('0x1b')]?_0x151484[_0x86c6('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x151484[_0x86c6('0x1b')]?_0x151484[_0x86c6('0x1b')][_0x86c6('0x1c')]||null:null,'attributes':_0x151484['options']?_0x151484[_0x86c6('0x1b')][_0x86c6('0x1d')]||null:null,'limit':_0x151484[_0x86c6('0x1b')]?_0x151484[_0x86c6('0x1b')][_0x86c6('0x1e')]||null:null})['then'](function(_0x5537b8){logger['info'](_0x86c6('0x17'),_0x151484);logger['debug'](_0x86c6('0x17'),_0x151484,JSON[_0x86c6('0x11')](_0x5537b8));_0x5b132e(_0x5537b8);})[_0x86c6('0x16')](function(_0x5376d0){logger[_0x86c6('0x12')](_0x86c6('0x17'),_0x5376d0['message'],_0x151484);_0x5eb1fb(_0x578a08[_0x86c6('0x12')](0x1f4,_0x5376d0['message']));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x5806dc){return new Promise(function(_0x817156,_0x4cfffa){return db['OpenchannelInteraction'][_0x86c6('0x1f')]({'where':_0x5806dc[_0x86c6('0x1b')]?_0x5806dc[_0x86c6('0x1b')][_0x86c6('0x1c')]||null:null})[_0x86c6('0x20')](function(_0x5e7d83){if(_0x5e7d83){return _0x5e7d83[_0x86c6('0x21')](_0x5806dc[_0x86c6('0x1a')][_0x86c6('0x22')],_['omit'](_0x5806dc[_0x86c6('0x1a')],[_0x86c6('0x22'),'id'])||{});}})[_0x86c6('0x23')](function(_0xfdb1d){logger[_0x86c6('0xd')]('AddTags',_0x5806dc);logger[_0x86c6('0x10')](_0x86c6('0x24'),_0x5806dc,JSON['stringify'](_0xfdb1d));_0x817156(_0xfdb1d);})['catch'](function(_0x5ac686){logger['error'](_0x86c6('0x24'),_0x5ac686[_0x86c6('0x14')],_0x5806dc);_0x4cfffa(_this[_0x86c6('0x12')](0x1f4,_0x5ac686[_0x86c6('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 1d57839..8890465 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 _0x47a9=['length','openchannelInteraction:','./openchannelInteraction.events','save','remove','update','removeListener','register'];(function(_0x4db723,_0x3c32eb){var _0x2302f9=function(_0x521dad){while(--_0x521dad){_0x4db723['push'](_0x4db723['shift']());}};_0x2302f9(++_0x3c32eb);}(_0x47a9,0x92));var _0x947a=function(_0x404e39,_0x4afcf9){_0x404e39=_0x404e39-0x0;var _0x1089dd=_0x47a9[_0x404e39];return _0x1089dd;};'use strict';var OpenchannelInteractionEvents=require(_0x947a('0x0'));var events=[_0x947a('0x1'),_0x947a('0x2'),_0x947a('0x3')];function createListener(_0x4d59ca,_0x4d809d){return function(_0x5811e2){_0x4d809d['emit'](_0x4d59ca,_0x5811e2);};}function removeListener(_0x6728dc,_0x44533f){return function(){OpenchannelInteractionEvents[_0x947a('0x4')](_0x6728dc,_0x44533f);};}exports[_0x947a('0x5')]=function(_0x5c80b9){for(var _0x38da1e=0x0,_0x1c7a68=events[_0x947a('0x6')];_0x38da1e<_0x1c7a68;_0x38da1e++){var _0x459c46=events[_0x38da1e];var _0x3aa7d2=createListener(_0x947a('0x7')+_0x459c46,_0x5c80b9);OpenchannelInteractionEvents['on'](_0x459c46,_0x3aa7d2);}}; \ No newline at end of file +var _0x46b8=['openchannelInteraction:','save','emit','removeListener','register'];(function(_0x4db0f9,_0x1b02ce){var _0x5527dc=function(_0x2c9be6){while(--_0x2c9be6){_0x4db0f9['push'](_0x4db0f9['shift']());}};_0x5527dc(++_0x1b02ce);}(_0x46b8,0x1c3));var _0x846b=function(_0x459081,_0x54e545){_0x459081=_0x459081-0x0;var _0x18f4dd=_0x46b8[_0x459081];return _0x18f4dd;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x846b('0x0'),'remove','update'];function createListener(_0x322741,_0x50b7e0){return function(_0x3464c3){_0x50b7e0[_0x846b('0x1')](_0x322741,_0x3464c3);};}function removeListener(_0x38b70d,_0x24b83d){return function(){OpenchannelInteractionEvents[_0x846b('0x2')](_0x38b70d,_0x24b83d);};}exports[_0x846b('0x3')]=function(_0x1dfd1e){for(var _0x35254b=0x0,_0x45a192=events['length'];_0x35254b<_0x45a192;_0x35254b++){var _0x2d3f1e=events[_0x35254b];var _0x24425a=createListener(_0x846b('0x4')+_0x2d3f1e,_0x1dfd1e);OpenchannelInteractionEvents['on'](_0x2d3f1e,_0x24425a);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 546d93f..a9e9c68 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 _0xe706=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','create','update','put','/:id/accept','accept','/:id/reject','exports','multer','util','path','express','Router'];(function(_0x240674,_0x5821fa){var _0x2e9173=function(_0x4f98e3){while(--_0x4f98e3){_0x240674['push'](_0x240674['shift']());}};_0x2e9173(++_0x5821fa);}(_0xe706,0xa3));var _0x6e70=function(_0x355ca3,_0xd3e1e7){_0x355ca3=_0x355ca3-0x0;var _0x55edba=_0xe706[_0x355ca3];return _0x55edba;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),interaction[_0x6e70('0x12')](_0x6e70('0x13'),_0x6e70('0x14')),controller[_0x6e70('0x15')]);router['put']('/:id',auth[_0x6e70('0xb')](),controller[_0x6e70('0x16')]);router[_0x6e70('0x17')](_0x6e70('0x18'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x19')]);router[_0x6e70('0x17')](_0x6e70('0x1a'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0x6e70('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x6e70('0x1b')]=router; \ No newline at end of file +var _0xa9e0=['index','/describe','show','post','isAuthenticated','tracked','openchannel','openchannelmessage:create','update','put','/:id/accept','accept','reject','delete','/:id','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get'];(function(_0x7388f6,_0x2a3381){var _0x189d35=function(_0x250ab6){while(--_0x250ab6){_0x7388f6['push'](_0x7388f6['shift']());}};_0x189d35(++_0x2a3381);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),interaction[_0x0a9e('0xe')](_0x0a9e('0xf'),_0x0a9e('0x10')),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0x11')]);router[_0x0a9e('0x12')](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x12')]('/:id/reject',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x15')]);router[_0x0a9e('0x16')](_0x0a9e('0x17'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 784cb68..a423339 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 _0xc692=['exports','TEXT','BOOLEAN','ENUM','out','DATE','STRING','sequelize'];(function(_0x3c9570,_0x4d502a){var _0xc9d539=function(_0x2bffbf){while(--_0x2bffbf){_0x3c9570['push'](_0x3c9570['shift']());}};_0xc9d539(++_0x4d502a);}(_0xc692,0x15f));var _0x2c69=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xc692[_0x47b58b];return _0x46bebe;};'use strict';var Sequelize=require(_0x2c69('0x0'));module[_0x2c69('0x1')]={'body':{'type':Sequelize[_0x2c69('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x2c69('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x2c69('0x4')]('in',_0x2c69('0x5')),'defaultValue':_0x2c69('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x2c69('0x6')]},'providerName':{'type':Sequelize[_0x2c69('0x7')]},'providerResponse':{'type':Sequelize[_0x2c69('0x2')]}}; \ No newline at end of file +var _0x88c3=['DATE','STRING','sequelize','TEXT','BOOLEAN','out'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x88c3,0x1ee));var _0x388c=function(_0x2f7991,_0xf3568e){_0x2f7991=_0x2f7991-0x0;var _0x49643a=_0x88c3[_0x2f7991];return _0x49643a;};'use strict';var Sequelize=require(_0x388c('0x0'));module['exports']={'body':{'type':Sequelize[_0x388c('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x388c('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x388c('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0x388c('0x4')]},'providerName':{'type':Sequelize[_0x388c('0x5')]},'providerResponse':{'type':Sequelize[_0x388c('0x1')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 0a36269..90c6890 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 _0x8921=['path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./openchannelMessage.socket','jayson/promise','http','client','request','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','stack','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','length','find','create','body','destroy','describe','openchannel-interactions','accept','openchannel','read','readAt','UserId','user','agent','get','OpenchannelInteraction','isNil','read1stAt','format','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','QueryTypes','SELECT','fullname','email','internal','interface','SIP/%s','channel','event','EventManager','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','rejectMessage','Sequelize','contact','User','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util'];(function(_0x406f12,_0x3620aa){var _0x1e0fd2=function(_0xc8e670){while(--_0xc8e670){_0x406f12['push'](_0x406f12['shift']());}};_0x1e0fd2(++_0x3620aa);}(_0x8921,0x110));var _0x1892=function(_0x36edf9,_0x51af75){_0x36edf9=_0x36edf9-0x0;var _0x48b0f8=_0x8921[_0x36edf9];return _0x48b0f8;};'use strict';var emlformat=require(_0x1892('0x0'));var rimraf=require(_0x1892('0x1'));var zipdir=require(_0x1892('0x2'));var jsonpatch=require(_0x1892('0x3'));var rp=require(_0x1892('0x4'));var moment=require(_0x1892('0x5'));var BPromise=require(_0x1892('0x6'));var Mustache=require('mustache');var util=require(_0x1892('0x7'));var path=require(_0x1892('0x8'));var sox=require(_0x1892('0x9'));var csv=require(_0x1892('0xa'));var ejs=require(_0x1892('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1892('0xc'));var squel=require(_0x1892('0xd'));var crypto=require(_0x1892('0xe'));var jsforce=require(_0x1892('0xf'));var deskjs=require(_0x1892('0x10'));var toCsv=require(_0x1892('0xa'));var querystring=require(_0x1892('0x11'));var Papa=require(_0x1892('0x12'));var Redis=require(_0x1892('0x13'));var authService=require(_0x1892('0x14'));var qs=require(_0x1892('0x15'));var as=require(_0x1892('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1892('0x17'))(_0x1892('0x18'));var utils=require(_0x1892('0x19'));var config=require(_0x1892('0x1a'));var licenseUtil=require(_0x1892('0x1b'));var db=require(_0x1892('0x1c'))['db'];config[_0x1892('0x1d')]=_['defaults'](config[_0x1892('0x1d')],{'host':'localhost','port':0x18eb});var socket=require(_0x1892('0x1e'))(new Redis(config['redis']));require(_0x1892('0x1f'))['register'](socket);var jayson=require(_0x1892('0x20'));var client=jayson['client'][_0x1892('0x21')]({'port':0x232c});var client9002=jayson[_0x1892('0x22')][_0x1892('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x2265b8,_0x1edfa5,_0xea2168,_0x118639){return new BPromise(function(_0x21bf13,_0x1b67d4){var _0x2619c0=_0x118639||client;return _0x2619c0[_0x1892('0x23')](_0x2265b8,_0xea2168)['then'](function(_0x4bd8b5){logger[_0x1892('0x24')](_0x1892('0x25'),_0x1edfa5,_0x1892('0x26'));logger[_0x1892('0x27')](_0x1892('0x28'),_0x1edfa5,_0x1892('0x26'),JSON[_0x1892('0x29')](_0x4bd8b5));if(_0x4bd8b5[_0x1892('0x2a')]){if(_0x4bd8b5[_0x1892('0x2a')][_0x1892('0x2b')]===0x1f4){logger[_0x1892('0x2a')](_0x1892('0x25'),_0x1edfa5,_0x4bd8b5[_0x1892('0x2a')][_0x1892('0x2c')]);return _0x1b67d4(_0x4bd8b5[_0x1892('0x2a')]['message']);}logger[_0x1892('0x2a')](_0x1892('0x25'),_0x1edfa5,_0x4bd8b5[_0x1892('0x2a')][_0x1892('0x2c')]);return _0x21bf13(_0x4bd8b5['error']['message']);}else{logger[_0x1892('0x24')]('OpenchannelMessage,\x20%s,\x20%s',_0x1edfa5,_0x1892('0x26'));_0x21bf13(_0x4bd8b5[_0x1892('0x2d')][_0x1892('0x2c')]);}})[_0x1892('0x2e')](function(_0x206a37){logger[_0x1892('0x2a')]('OpenchannelMessage,\x20%s,\x20%s',_0x1edfa5,_0x206a37);_0x1b67d4(_0x206a37);});});}function respondWithStatusCode(_0xc1e10,_0x28709b){_0x28709b=_0x28709b||0xcc;return function(_0x44406c){if(_0x44406c){return _0xc1e10[_0x1892('0x2f')](_0x28709b);}return _0xc1e10[_0x1892('0x30')](_0x28709b)[_0x1892('0x31')]();};}function respondWithResult(_0x589732,_0x5dfaf5){_0x5dfaf5=_0x5dfaf5||0xc8;return function(_0x143342){if(_0x143342){return _0x589732[_0x1892('0x30')](_0x5dfaf5)['json'](_0x143342);}};}function respondWithFilteredResult(_0x34b67b,_0x23b4fd){return function(_0x3b81d7){if(_0x3b81d7){var _0x59f0e0=typeof _0x23b4fd[_0x1892('0x32')]===_0x1892('0x33')&&typeof _0x23b4fd[_0x1892('0x34')]==='undefined';var _0x21e10b=_0x3b81d7['count'];var _0x28cfd0=_0x59f0e0?0x0:_0x23b4fd['offset'];var _0x41b70b=_0x59f0e0?_0x3b81d7[_0x1892('0x35')]:_0x23b4fd[_0x1892('0x32')]+_0x23b4fd[_0x1892('0x34')];var _0xfbcc1;if(_0x41b70b>=_0x21e10b){_0x41b70b=_0x21e10b;_0xfbcc1=0xc8;}else{_0xfbcc1=0xce;}_0x34b67b[_0x1892('0x30')](_0xfbcc1);return _0x34b67b[_0x1892('0x36')](_0x1892('0x37'),_0x28cfd0+'-'+_0x41b70b+'/'+_0x21e10b)[_0x1892('0x38')](_0x3b81d7);}return null;};}function patchUpdates(_0x45a5ff){return function(_0x3063eb){try{jsonpatch[_0x1892('0x39')](_0x3063eb,_0x45a5ff,!![]);}catch(_0x427ce8){return BPromise[_0x1892('0x3a')](_0x427ce8);}return _0x3063eb[_0x1892('0x3b')]();};}function saveUpdates(_0x3c2c57,_0x1644b5){return function(_0x50f72f){if(_0x50f72f){return _0x50f72f[_0x1892('0x3c')](_0x3c2c57)['then'](function(_0x46e5ee){return _0x46e5ee;});}return null;};}function removeEntity(_0x50692c,_0x2e3556){return function(_0x50da25){if(_0x50da25){return _0x50da25['destroy']()[_0x1892('0x3d')](function(){_0x50692c['status'](0xcc)[_0x1892('0x31')]();});}};}function handleEntityNotFound(_0x293e1c,_0x164c46){return function(_0x20d1f9){if(!_0x20d1f9){_0x293e1c['sendStatus'](0x194);}return _0x20d1f9;};}function handleError(_0x39c1e6,_0x5a1359){_0x5a1359=_0x5a1359||0x1f4;return function(_0x583fa5){logger[_0x1892('0x2a')](_0x583fa5[_0x1892('0x3e')]);if(_0x583fa5[_0x1892('0x3f')]){delete _0x583fa5[_0x1892('0x3f')];}_0x39c1e6[_0x1892('0x30')](_0x5a1359)[_0x1892('0x40')](_0x583fa5);};}exports[_0x1892('0x41')]=function(_0xaf2673,_0x708702){var _0x3e7403={},_0x643c61={},_0x2c62e0={'count':0x0,'rows':[]};var _0x5ed879=_[_0x1892('0x42')](db[_0x1892('0x43')][_0x1892('0x44')],function(_0x429fba){return{'name':_0x429fba[_0x1892('0x45')],'type':_0x429fba[_0x1892('0x46')][_0x1892('0x47')]};});_0x643c61[_0x1892('0x48')]=_[_0x1892('0x42')](_0x5ed879,'name');_0x643c61[_0x1892('0x49')]=_['keys'](_0xaf2673['query']);_0x643c61[_0x1892('0x4a')]=_['intersection'](_0x643c61[_0x1892('0x48')],_0x643c61[_0x1892('0x49')]);_0x3e7403[_0x1892('0x4b')]=_[_0x1892('0x4c')](_0x643c61[_0x1892('0x48')],qs['fields'](_0xaf2673[_0x1892('0x49')][_0x1892('0x4d')]));_0x3e7403['attributes']=_0x3e7403[_0x1892('0x4b')]['length']?_0x3e7403[_0x1892('0x4b')]:_0x643c61[_0x1892('0x48')];if(!_0xaf2673[_0x1892('0x49')][_0x1892('0x4e')](_0x1892('0x4f'))){_0x3e7403[_0x1892('0x34')]=qs['limit'](_0xaf2673[_0x1892('0x49')][_0x1892('0x34')]);_0x3e7403[_0x1892('0x32')]=qs[_0x1892('0x32')](_0xaf2673[_0x1892('0x49')][_0x1892('0x32')]);}_0x3e7403[_0x1892('0x50')]=qs[_0x1892('0x51')](_0xaf2673[_0x1892('0x49')][_0x1892('0x51')]);_0x3e7403[_0x1892('0x52')]=qs['filters'](_[_0x1892('0x53')](_0xaf2673[_0x1892('0x49')],_0x643c61[_0x1892('0x4a')]),_0x5ed879);if(_0xaf2673['query'][_0x1892('0x54')]){_0x3e7403['where']=_[_0x1892('0x55')](_0x3e7403['where'],{'$or':_['map'](_0x5ed879,function(_0x92e23f){if(_0x92e23f[_0x1892('0x46')]!==_0x1892('0x56')){var _0x2a1774={};_0x2a1774[_0x92e23f[_0x1892('0x3f')]]={'$like':'%'+_0xaf2673[_0x1892('0x49')][_0x1892('0x54')]+'%'};return _0x2a1774;}})});}_0x3e7403=_[_0x1892('0x55')]({},_0x3e7403,_0xaf2673[_0x1892('0x57')]);var _0x2e9bae={'where':_0x3e7403[_0x1892('0x52')]};return db[_0x1892('0x43')][_0x1892('0x35')](_0x2e9bae)[_0x1892('0x3d')](function(_0x43caa5){_0x2c62e0[_0x1892('0x35')]=_0x43caa5;if(_0xaf2673[_0x1892('0x49')][_0x1892('0x58')]){_0x3e7403[_0x1892('0x59')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x1892('0x5a')](_0x3e7403);})[_0x1892('0x3d')](function(_0x3ef43a){_0x2c62e0[_0x1892('0x5b')]=_0x3ef43a;return _0x2c62e0;})['then'](respondWithFilteredResult(_0x708702,_0x3e7403))[_0x1892('0x2e')](handleError(_0x708702,null));};exports[_0x1892('0x5c')]=function(_0xc8324a,_0x175eec){var _0x2e9c3c={'raw':!![],'where':{'id':_0xc8324a[_0x1892('0x5d')]['id']}},_0x334287={};_0x334287[_0x1892('0x48')]=_[_0x1892('0x5e')](db['OpenchannelMessage'][_0x1892('0x44')]);_0x334287[_0x1892('0x49')]=_[_0x1892('0x5e')](_0xc8324a['query']);_0x334287[_0x1892('0x4a')]=_[_0x1892('0x4c')](_0x334287[_0x1892('0x48')],_0x334287[_0x1892('0x49')]);_0x2e9c3c['attributes']=_['intersection'](_0x334287[_0x1892('0x48')],qs[_0x1892('0x4d')](_0xc8324a[_0x1892('0x49')][_0x1892('0x4d')]));_0x2e9c3c['attributes']=_0x2e9c3c['attributes'][_0x1892('0x5f')]?_0x2e9c3c[_0x1892('0x4b')]:_0x334287['model'];if(_0xc8324a[_0x1892('0x49')][_0x1892('0x58')]){_0x2e9c3c[_0x1892('0x59')]=[{'all':!![]}];}_0x2e9c3c=_[_0x1892('0x55')]({},_0x2e9c3c,_0xc8324a[_0x1892('0x57')]);return db[_0x1892('0x43')][_0x1892('0x60')](_0x2e9c3c)[_0x1892('0x3d')](handleEntityNotFound(_0x175eec,null))[_0x1892('0x3d')](respondWithResult(_0x175eec,null))[_0x1892('0x2e')](handleError(_0x175eec,null));};exports[_0x1892('0x61')]=function(_0x5234be,_0x85b2f3){return db[_0x1892('0x43')]['create'](_0x5234be[_0x1892('0x62')],{})['then'](respondWithResult(_0x85b2f3,0xc9))[_0x1892('0x2e')](handleError(_0x85b2f3,null));};exports['update']=function(_0x34b5d9,_0x16a11f){if(_0x34b5d9['body']['id']){delete _0x34b5d9[_0x1892('0x62')]['id'];}return db[_0x1892('0x43')][_0x1892('0x60')]({'where':{'id':_0x34b5d9[_0x1892('0x5d')]['id']}})[_0x1892('0x3d')](handleEntityNotFound(_0x16a11f,null))[_0x1892('0x3d')](saveUpdates(_0x34b5d9[_0x1892('0x62')],null))[_0x1892('0x3d')](respondWithResult(_0x16a11f,null))[_0x1892('0x2e')](handleError(_0x16a11f,null));};exports[_0x1892('0x63')]=function(_0x5179c1,_0x3b421a){return db[_0x1892('0x43')][_0x1892('0x60')]({'where':{'id':_0x5179c1['params']['id']}})[_0x1892('0x3d')](handleEntityNotFound(_0x3b421a,null))['then'](removeEntity(_0x3b421a,null))[_0x1892('0x2e')](handleError(_0x3b421a,null));};exports['describe']=function(_0x30cf28,_0x37b30f){return db[_0x1892('0x43')][_0x1892('0x64')]()[_0x1892('0x3d')](respondWithResult(_0x37b30f,null))[_0x1892('0x2e')](handleError(_0x37b30f,null));};var interaction_log=require(_0x1892('0x17'))(_0x1892('0x65'));exports[_0x1892('0x66')]=function(_0x56a6ad,_0x152b7f,_0x271a21){var _0xdc3380={'agent':{},'channel':_0x1892('0x67')};if(_0x56a6ad[_0x1892('0x62')]['id']){delete _0x56a6ad[_0x1892('0x62')]['id'];}_0x56a6ad['body'][_0x1892('0x68')]=!![];_0x56a6ad['body'][_0x1892('0x69')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x56a6ad['body'][_0x1892('0x6a')]=_0x56a6ad['body'][_0x1892('0x6a')]||_0x56a6ad[_0x1892('0x6b')]['id'];_0xdc3380[_0x1892('0x6c')]['id']=_0x56a6ad[_0x1892('0x62')][_0x1892('0x6a')];return db[_0x1892('0x43')][_0x1892('0x60')]({'where':{'id':_0x56a6ad[_0x1892('0x5d')]['id'],'UserId':null}})[_0x1892('0x3d')](handleEntityNotFound(_0x152b7f,null))[_0x1892('0x3d')](saveUpdates(_0x56a6ad[_0x1892('0x62')],null))['then'](function(_0x2f63be){if(_0x2f63be){_0xdc3380[_0x1892('0x2c')]=_0x2f63be[_0x1892('0x6d')]({'plain':!![]});return db[_0x1892('0x6e')][_0x1892('0x60')]({'where':{'id':_0x2f63be['OpenchannelInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x152b7f,null))[_0x1892('0x3d')](function(_0xdc4364){if(_0xdc4364){return _0xdc4364[_0x1892('0x3c')]({'UserId':_0x56a6ad[_0x1892('0x62')][_0x1892('0x6a')],'read1stAt':_[_0x1892('0x6f')](_0xdc4364[_0x1892('0x70')])?moment()[_0x1892('0x71')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x1892('0x3d')](function(_0x305746){if(_0x305746){_0xdc3380[_0x1892('0x72')]=_0x305746[_0x1892('0x6d')]({'plain':!![]});interaction_log[_0x1892('0x24')](_0x1892('0x73'),_0x56a6ad[_0x1892('0x6b')]['id'],_0x56a6ad['user']['name'],_0x56a6ad[_0x1892('0x6b')]['role'],_0xdc3380[_0x1892('0x72')]['id'],_0x56a6ad[_0x1892('0x62')]?JSON[_0x1892('0x29')](_0x56a6ad[_0x1892('0x62')]):'null');return respondWithRpcPromise(_0x1892('0x74'),_0x1892('0x75'),_0xdc3380);}return null;})[_0x1892('0x3d')](function(_0x5f926e){var _0x1108f2=_0x1892('0x76')+_0x5f926e['message'][_0x1892('0x77')];return db['sequelize'][_0x1892('0x49')](_0x1108f2,{'type':db['Sequelize'][_0x1892('0x78')][_0x1892('0x79')],'raw':!![]})[_0x1892('0x3d')](function(_0x525d24){return _0x525d24;});})[_0x1892('0x3d')](function(_0x1e45c2){if(_0x1e45c2){_0xdc3380[_0x1892('0x2c')]['contact']=_0x1e45c2[0x0];if(!_0x56a6ad['body'][_0x1892('0x6a')])return;return db['User']['find']({'where':{'id':_0x56a6ad[_0x1892('0x62')][_0x1892('0x6a')],'role':'agent'},'attributes':['id',_0x1892('0x3f'),_0x1892('0x7a'),_0x1892('0x7b'),_0x1892('0x7c')],'raw':!![]});}return null;})['then'](function(_0x1be543){if(!_0x1be543)return null;_0xdc3380['message']['agent']=_0x1be543;return _0xdc3380;})[_0x1892('0x3d')](function(_0x25e92c){if(_0x25e92c){if(_0x56a6ad[_0x1892('0x62')]['manual']){_0xdc3380[_0x1892('0x2c')][_0x1892('0x7d')]=util[_0x1892('0x71')](_0x1892('0x7e'),_0x56a6ad['user'][_0x1892('0x3f')]);_0xdc3380[_0x1892('0x2c')][_0x1892('0x7f')]=_0xdc3380[_0x1892('0x7f')];_0xdc3380['message'][_0x1892('0x80')]=_0x1892('0x66');return respondWithRpcPromise(_0x1892('0x81'),_0x1892('0x81'),{'event':_0x1892('0x82'),'message':_0xdc3380['message']},client9002)[_0x1892('0x3d')](function(){return _0xdc3380;});}return _0xdc3380;}return null;})[_0x1892('0x3d')](respondWithResult(_0x152b7f,null))[_0x1892('0x2e')](handleError(_0x152b7f,null));};var interaction_log=require('../../config/logger')(_0x1892('0x65'));exports['reject']=function(_0xa56851,_0x3f538d,_0x22d164){var _0x4cd529={'agent':{},'channel':_0x1892('0x67')};if(_0xa56851['body']['id']){delete _0xa56851[_0x1892('0x62')]['id'];}_0xa56851[_0x1892('0x62')][_0x1892('0x6a')]=_0xa56851['body'][_0x1892('0x6a')]||_0xa56851[_0x1892('0x6b')]['id'];_0x4cd529[_0x1892('0x6c')]['id']=_0xa56851[_0x1892('0x62')][_0x1892('0x6a')];return db[_0x1892('0x43')][_0x1892('0x60')]({'where':{'id':_0xa56851[_0x1892('0x5d')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3f538d,null))[_0x1892('0x3d')](function(_0x57028e){if(_0x57028e){_0x4cd529[_0x1892('0x2c')]=_0x57028e['get']({'plain':!![]});return db[_0x1892('0x6e')][_0x1892('0x60')]({'where':{'id':_0x57028e['OpenchannelInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x3f538d,null))[_0x1892('0x3d')](function(_0xd33f34){if(_0xd33f34){_0x4cd529[_0x1892('0x72')]=_0xd33f34['get']({'plain':!![]});interaction_log[_0x1892('0x24')](_0x1892('0x83'),_0xa56851[_0x1892('0x6b')]['id'],_0xa56851[_0x1892('0x6b')]['name'],_0xa56851['user'][_0x1892('0x84')],_0x4cd529['interaction']['id'],_0xa56851[_0x1892('0x62')]?JSON[_0x1892('0x29')](_0xa56851[_0x1892('0x62')]):_0x1892('0x85'));return respondWithRpcPromise(_0x1892('0x86'),_0x1892('0x87'),_0x4cd529);}return null;})[_0x1892('0x3d')](function(_0x14bce8){var _0x3a3f77=_0x1892('0x76')+_0x14bce8[_0x1892('0x2c')][_0x1892('0x77')];return db['sequelize'][_0x1892('0x49')](_0x3a3f77,{'type':db[_0x1892('0x88')]['QueryTypes'][_0x1892('0x79')],'raw':!![]})[_0x1892('0x3d')](function(_0x48aff7){return _0x48aff7;});})['then'](function(_0x37c74a){if(_0x37c74a){_0x4cd529[_0x1892('0x2c')][_0x1892('0x89')]=_0x37c74a[0x0];if(!_0xa56851[_0x1892('0x62')][_0x1892('0x6a')])return;return db[_0x1892('0x8a')]['find']({'where':{'id':_0xa56851[_0x1892('0x62')]['UserId'],'role':'agent'},'attributes':['id',_0x1892('0x3f'),'fullname','email','internal'],'raw':!![]});}return null;})[_0x1892('0x3d')](function(_0x366669){if(!_0x366669)return null;_0x4cd529[_0x1892('0x2c')][_0x1892('0x6c')]=_0x366669;return _0x4cd529;})[_0x1892('0x3d')](function(_0x3d3f86){if(_0x3d3f86){_0x3d3f86[_0x1892('0x2c')][_0x1892('0x7d')]=util[_0x1892('0x71')]('SIP/%s',_0xa56851[_0x1892('0x6b')][_0x1892('0x3f')]);_0x3d3f86[_0x1892('0x2c')][_0x1892('0x7f')]=_0x4cd529[_0x1892('0x7f')];_0x3d3f86[_0x1892('0x2c')]['event']=_0x1892('0x3a');respondWithRpcPromise(_0x1892('0x81'),_0x1892('0x81'),{'event':_0x1892('0x8b'),'message':_0x3d3f86[_0x1892('0x2c')]},client9002);return _0x4cd529;}return null;})[_0x1892('0x3d')](respondWithResult(_0x3f538d,null))['catch'](handleError(_0x3f538d,null));}; \ No newline at end of file +var _0xfb50=['eml-format','rimraf','request-promise','moment','bluebird','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','stack','name','send','index','map','OpenchannelMessage','rawAttributes','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','findAll','params','includeAll','include','options','find','create','body','describe','openchannel-interactions','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','OpenchannelInteraction','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','sequelize','Sequelize','SELECT','contact','User','fullname','email','internal','agent','manual','SIP/%s','channel','EventManager','OpenchannelInteractionId','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','interface','rejectmessage'];(function(_0x1d3f41,_0x5000c4){var _0x3233b6=function(_0x32eebd){while(--_0x32eebd){_0x1d3f41['push'](_0x1d3f41['shift']());}};_0x3233b6(++_0x5000c4);}(_0xfb50,0x1ec));var _0x0fb5=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0xfb50[_0x4b7895];return _0x264180;};'use strict';var emlformat=require(_0x0fb5('0x0'));var rimraf=require(_0x0fb5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0fb5('0x2'));var moment=require(_0x0fb5('0x3'));var BPromise=require(_0x0fb5('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x0fb5('0x5'));var sox=require(_0x0fb5('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0fb5('0x7'));var _=require(_0x0fb5('0x8'));var squel=require(_0x0fb5('0x9'));var crypto=require('crypto');var jsforce=require(_0x0fb5('0xa'));var deskjs=require(_0x0fb5('0xb'));var toCsv=require(_0x0fb5('0xc'));var querystring=require(_0x0fb5('0xd'));var Papa=require(_0x0fb5('0xe'));var Redis=require(_0x0fb5('0xf'));var authService=require(_0x0fb5('0x10'));var qs=require(_0x0fb5('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0fb5('0x12'));var logger=require(_0x0fb5('0x13'))(_0x0fb5('0x14'));var utils=require('../../config/utils');var config=require(_0x0fb5('0x15'));var licenseUtil=require(_0x0fb5('0x16'));var db=require(_0x0fb5('0x17'))['db'];config['redis']=_[_0x0fb5('0x18')](config[_0x0fb5('0x19')],{'host':_0x0fb5('0x1a'),'port':0x18eb});var socket=require(_0x0fb5('0x1b'))(new Redis(config[_0x0fb5('0x19')]));require(_0x0fb5('0x1c'))[_0x0fb5('0x1d')](socket);var jayson=require(_0x0fb5('0x1e'));var client=jayson[_0x0fb5('0x1f')]['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x408f1e,_0x375ebc,_0x20ccdf,_0xe79950){return new BPromise(function(_0xb3a437,_0x315c3c){var _0x3de867=_0xe79950||client;return _0x3de867[_0x0fb5('0x20')](_0x408f1e,_0x20ccdf)[_0x0fb5('0x21')](function(_0x549362){logger[_0x0fb5('0x22')](_0x0fb5('0x23'),_0x375ebc,_0x0fb5('0x24'));logger['debug']('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x375ebc,_0x0fb5('0x24'),JSON[_0x0fb5('0x25')](_0x549362));if(_0x549362[_0x0fb5('0x26')]){if(_0x549362[_0x0fb5('0x26')]['code']===0x1f4){logger[_0x0fb5('0x26')]('OpenchannelMessage,\x20%s,\x20%s',_0x375ebc,_0x549362[_0x0fb5('0x26')][_0x0fb5('0x27')]);return _0x315c3c(_0x549362[_0x0fb5('0x26')][_0x0fb5('0x27')]);}logger[_0x0fb5('0x26')](_0x0fb5('0x23'),_0x375ebc,_0x549362[_0x0fb5('0x26')][_0x0fb5('0x27')]);return _0xb3a437(_0x549362[_0x0fb5('0x26')][_0x0fb5('0x27')]);}else{logger['info'](_0x0fb5('0x23'),_0x375ebc,_0x0fb5('0x24'));_0xb3a437(_0x549362['result'][_0x0fb5('0x27')]);}})[_0x0fb5('0x28')](function(_0x651223){logger['error'](_0x0fb5('0x23'),_0x375ebc,_0x651223);_0x315c3c(_0x651223);});});}function respondWithStatusCode(_0x4f8666,_0x5a5275){_0x5a5275=_0x5a5275||0xcc;return function(_0x1aee90){if(_0x1aee90){return _0x4f8666[_0x0fb5('0x29')](_0x5a5275);}return _0x4f8666[_0x0fb5('0x2a')](_0x5a5275)[_0x0fb5('0x2b')]();};}function respondWithResult(_0x5e525f,_0x4b538f){_0x4b538f=_0x4b538f||0xc8;return function(_0x3d215e){if(_0x3d215e){return _0x5e525f[_0x0fb5('0x2a')](_0x4b538f)[_0x0fb5('0x2c')](_0x3d215e);}};}function respondWithFilteredResult(_0x5d2132,_0x2be848){return function(_0x4f1bd4){if(_0x4f1bd4){var _0x5056fc=typeof _0x2be848[_0x0fb5('0x2d')]===_0x0fb5('0x2e')&&typeof _0x2be848[_0x0fb5('0x2f')]===_0x0fb5('0x2e');var _0x10a70c=_0x4f1bd4[_0x0fb5('0x30')];var _0x228235=_0x5056fc?0x0:_0x2be848[_0x0fb5('0x2d')];var _0x5e6cb2=_0x5056fc?_0x4f1bd4['count']:_0x2be848[_0x0fb5('0x2d')]+_0x2be848[_0x0fb5('0x2f')];var _0xef4af4;if(_0x5e6cb2>=_0x10a70c){_0x5e6cb2=_0x10a70c;_0xef4af4=0xc8;}else{_0xef4af4=0xce;}_0x5d2132['status'](_0xef4af4);return _0x5d2132[_0x0fb5('0x31')](_0x0fb5('0x32'),_0x228235+'-'+_0x5e6cb2+'/'+_0x10a70c)[_0x0fb5('0x2c')](_0x4f1bd4);}return null;};}function patchUpdates(_0xcb37d0){return function(_0x279edd){try{jsonpatch[_0x0fb5('0x33')](_0x279edd,_0xcb37d0,!![]);}catch(_0x1ac320){return BPromise[_0x0fb5('0x34')](_0x1ac320);}return _0x279edd['save']();};}function saveUpdates(_0x1f0c76,_0x363c18){return function(_0x16eef1){if(_0x16eef1){return _0x16eef1[_0x0fb5('0x35')](_0x1f0c76)[_0x0fb5('0x21')](function(_0x53b935){return _0x53b935;});}return null;};}function removeEntity(_0x12dddc,_0x36a9fb){return function(_0x3e5f77){if(_0x3e5f77){return _0x3e5f77[_0x0fb5('0x36')]()[_0x0fb5('0x21')](function(){_0x12dddc[_0x0fb5('0x2a')](0xcc)[_0x0fb5('0x2b')]();});}};}function handleEntityNotFound(_0x3ab2ec,_0x39414c){return function(_0x555485){if(!_0x555485){_0x3ab2ec[_0x0fb5('0x29')](0x194);}return _0x555485;};}function handleError(_0x140924,_0x6c45c3){_0x6c45c3=_0x6c45c3||0x1f4;return function(_0x2f048b){logger[_0x0fb5('0x26')](_0x2f048b[_0x0fb5('0x37')]);if(_0x2f048b[_0x0fb5('0x38')]){delete _0x2f048b['name'];}_0x140924['status'](_0x6c45c3)[_0x0fb5('0x39')](_0x2f048b);};}exports[_0x0fb5('0x3a')]=function(_0x4a9636,_0x541a61){var _0x4580fb={},_0x55b292={},_0x12322e={'count':0x0,'rows':[]};var _0x2da79d=_[_0x0fb5('0x3b')](db[_0x0fb5('0x3c')][_0x0fb5('0x3d')],function(_0x4d7df2){return{'name':_0x4d7df2['fieldName'],'type':_0x4d7df2[_0x0fb5('0x3e')][_0x0fb5('0x3f')]};});_0x55b292['model']=_[_0x0fb5('0x3b')](_0x2da79d,'name');_0x55b292[_0x0fb5('0x40')]=_[_0x0fb5('0x41')](_0x4a9636[_0x0fb5('0x40')]);_0x55b292[_0x0fb5('0x42')]=_[_0x0fb5('0x43')](_0x55b292['model'],_0x55b292['query']);_0x4580fb[_0x0fb5('0x44')]=_[_0x0fb5('0x43')](_0x55b292[_0x0fb5('0x45')],qs[_0x0fb5('0x46')](_0x4a9636[_0x0fb5('0x40')]['fields']));_0x4580fb[_0x0fb5('0x44')]=_0x4580fb[_0x0fb5('0x44')][_0x0fb5('0x47')]?_0x4580fb[_0x0fb5('0x44')]:_0x55b292['model'];if(!_0x4a9636[_0x0fb5('0x40')][_0x0fb5('0x48')](_0x0fb5('0x49'))){_0x4580fb[_0x0fb5('0x2f')]=qs['limit'](_0x4a9636['query'][_0x0fb5('0x2f')]);_0x4580fb[_0x0fb5('0x2d')]=qs[_0x0fb5('0x2d')](_0x4a9636[_0x0fb5('0x40')]['offset']);}_0x4580fb[_0x0fb5('0x4a')]=qs[_0x0fb5('0x4b')](_0x4a9636['query']['sort']);_0x4580fb[_0x0fb5('0x4c')]=qs[_0x0fb5('0x42')](_['pick'](_0x4a9636['query'],_0x55b292['filters']),_0x2da79d);if(_0x4a9636[_0x0fb5('0x40')][_0x0fb5('0x4d')]){_0x4580fb['where']=_[_0x0fb5('0x4e')](_0x4580fb[_0x0fb5('0x4c')],{'$or':_[_0x0fb5('0x3b')](_0x2da79d,function(_0x6efad3){if(_0x6efad3[_0x0fb5('0x3e')]!=='VIRTUAL'){var _0x52628b={};_0x52628b[_0x6efad3[_0x0fb5('0x38')]]={'$like':'%'+_0x4a9636[_0x0fb5('0x40')]['filter']+'%'};return _0x52628b;}})});}_0x4580fb=_[_0x0fb5('0x4e')]({},_0x4580fb,_0x4a9636['options']);var _0x38573b={'where':_0x4580fb[_0x0fb5('0x4c')]};return db[_0x0fb5('0x3c')]['count'](_0x38573b)[_0x0fb5('0x21')](function(_0x5876a1){_0x12322e['count']=_0x5876a1;if(_0x4a9636[_0x0fb5('0x40')]['includeAll']){_0x4580fb['include']=[{'all':!![]}];}return db['OpenchannelMessage'][_0x0fb5('0x4f')](_0x4580fb);})[_0x0fb5('0x21')](function(_0x342d56){_0x12322e['rows']=_0x342d56;return _0x12322e;})[_0x0fb5('0x21')](respondWithFilteredResult(_0x541a61,_0x4580fb))[_0x0fb5('0x28')](handleError(_0x541a61,null));};exports['show']=function(_0x2346bd,_0xe18d7a){var _0x59d9dd={'raw':!![],'where':{'id':_0x2346bd[_0x0fb5('0x50')]['id']}},_0x2efdc7={};_0x2efdc7[_0x0fb5('0x45')]=_['keys'](db[_0x0fb5('0x3c')][_0x0fb5('0x3d')]);_0x2efdc7['query']=_[_0x0fb5('0x41')](_0x2346bd[_0x0fb5('0x40')]);_0x2efdc7[_0x0fb5('0x42')]=_[_0x0fb5('0x43')](_0x2efdc7[_0x0fb5('0x45')],_0x2efdc7[_0x0fb5('0x40')]);_0x59d9dd[_0x0fb5('0x44')]=_[_0x0fb5('0x43')](_0x2efdc7['model'],qs[_0x0fb5('0x46')](_0x2346bd['query'][_0x0fb5('0x46')]));_0x59d9dd[_0x0fb5('0x44')]=_0x59d9dd['attributes'][_0x0fb5('0x47')]?_0x59d9dd[_0x0fb5('0x44')]:_0x2efdc7['model'];if(_0x2346bd[_0x0fb5('0x40')][_0x0fb5('0x51')]){_0x59d9dd[_0x0fb5('0x52')]=[{'all':!![]}];}_0x59d9dd=_['merge']({},_0x59d9dd,_0x2346bd[_0x0fb5('0x53')]);return db[_0x0fb5('0x3c')][_0x0fb5('0x54')](_0x59d9dd)[_0x0fb5('0x21')](handleEntityNotFound(_0xe18d7a,null))[_0x0fb5('0x21')](respondWithResult(_0xe18d7a,null))[_0x0fb5('0x28')](handleError(_0xe18d7a,null));};exports[_0x0fb5('0x55')]=function(_0x2becf7,_0x5848b1){return db[_0x0fb5('0x3c')][_0x0fb5('0x55')](_0x2becf7['body'],{})[_0x0fb5('0x21')](respondWithResult(_0x5848b1,0xc9))[_0x0fb5('0x28')](handleError(_0x5848b1,null));};exports['update']=function(_0x104a7f,_0x42ec32){if(_0x104a7f[_0x0fb5('0x56')]['id']){delete _0x104a7f[_0x0fb5('0x56')]['id'];}return db[_0x0fb5('0x3c')][_0x0fb5('0x54')]({'where':{'id':_0x104a7f[_0x0fb5('0x50')]['id']}})[_0x0fb5('0x21')](handleEntityNotFound(_0x42ec32,null))['then'](saveUpdates(_0x104a7f[_0x0fb5('0x56')],null))[_0x0fb5('0x21')](respondWithResult(_0x42ec32,null))[_0x0fb5('0x28')](handleError(_0x42ec32,null));};exports['destroy']=function(_0x1183a8,_0x49876d){return db[_0x0fb5('0x3c')]['find']({'where':{'id':_0x1183a8[_0x0fb5('0x50')]['id']}})[_0x0fb5('0x21')](handleEntityNotFound(_0x49876d,null))[_0x0fb5('0x21')](removeEntity(_0x49876d,null))['catch'](handleError(_0x49876d,null));};exports[_0x0fb5('0x57')]=function(_0x34d185,_0x509f75){return db['OpenchannelMessage']['describe']()[_0x0fb5('0x21')](respondWithResult(_0x509f75,null))['catch'](handleError(_0x509f75,null));};var interaction_log=require(_0x0fb5('0x13'))(_0x0fb5('0x58'));exports[_0x0fb5('0x59')]=function(_0x5ae92a,_0x33c4eb,_0x7fb558){var _0x7061cd={'agent':{},'channel':_0x0fb5('0x5a')};if(_0x5ae92a[_0x0fb5('0x56')]['id']){delete _0x5ae92a[_0x0fb5('0x56')]['id'];}_0x5ae92a['body'][_0x0fb5('0x5b')]=!![];_0x5ae92a['body'][_0x0fb5('0x5c')]=moment()[_0x0fb5('0x5d')](_0x0fb5('0x5e'));_0x5ae92a[_0x0fb5('0x56')][_0x0fb5('0x5f')]=_0x5ae92a[_0x0fb5('0x56')][_0x0fb5('0x5f')]||_0x5ae92a[_0x0fb5('0x60')]['id'];_0x7061cd['agent']['id']=_0x5ae92a[_0x0fb5('0x56')][_0x0fb5('0x5f')];return db['OpenchannelMessage'][_0x0fb5('0x54')]({'where':{'id':_0x5ae92a['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x33c4eb,null))[_0x0fb5('0x21')](saveUpdates(_0x5ae92a['body'],null))[_0x0fb5('0x21')](function(_0x5c647c){if(_0x5c647c){_0x7061cd[_0x0fb5('0x27')]=_0x5c647c[_0x0fb5('0x61')]({'plain':!![]});return db[_0x0fb5('0x62')][_0x0fb5('0x54')]({'where':{'id':_0x5c647c['OpenchannelInteractionId']}});}return null;})[_0x0fb5('0x21')](handleEntityNotFound(_0x33c4eb,null))['then'](function(_0x2711a9){if(_0x2711a9){return _0x2711a9[_0x0fb5('0x35')]({'UserId':_0x5ae92a[_0x0fb5('0x56')][_0x0fb5('0x5f')],'read1stAt':_['isNil'](_0x2711a9['read1stAt'])?moment()[_0x0fb5('0x5d')](_0x0fb5('0x5e')):undefined});}return null;})[_0x0fb5('0x21')](function(_0x25ce49){if(_0x25ce49){_0x7061cd[_0x0fb5('0x63')]=_0x25ce49[_0x0fb5('0x61')]({'plain':!![]});interaction_log['info'](_0x0fb5('0x64'),_0x5ae92a[_0x0fb5('0x60')]['id'],_0x5ae92a[_0x0fb5('0x60')][_0x0fb5('0x38')],_0x5ae92a[_0x0fb5('0x60')][_0x0fb5('0x65')],_0x7061cd[_0x0fb5('0x63')]['id'],_0x5ae92a[_0x0fb5('0x56')]?JSON['stringify'](_0x5ae92a[_0x0fb5('0x56')]):_0x0fb5('0x66'));return respondWithRpcPromise('AcceptMessage',_0x0fb5('0x67'),_0x7061cd);}return null;})[_0x0fb5('0x21')](function(_0x53e7e2){var _0x459110='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x53e7e2['message']['ContactId'];return db[_0x0fb5('0x68')]['query'](_0x459110,{'type':db[_0x0fb5('0x69')]['QueryTypes'][_0x0fb5('0x6a')],'raw':!![]})[_0x0fb5('0x21')](function(_0x38f481){return _0x38f481;});})[_0x0fb5('0x21')](function(_0x44072f){if(_0x44072f){_0x7061cd['message'][_0x0fb5('0x6b')]=_0x44072f[0x0];if(!_0x5ae92a[_0x0fb5('0x56')][_0x0fb5('0x5f')])return;return db[_0x0fb5('0x6c')][_0x0fb5('0x54')]({'where':{'id':_0x5ae92a[_0x0fb5('0x56')]['UserId'],'role':'agent'},'attributes':['id',_0x0fb5('0x38'),_0x0fb5('0x6d'),_0x0fb5('0x6e'),_0x0fb5('0x6f')],'raw':!![]});}return null;})['then'](function(_0x9015aa){if(!_0x9015aa)return null;_0x7061cd[_0x0fb5('0x27')][_0x0fb5('0x70')]=_0x9015aa;return _0x7061cd;})[_0x0fb5('0x21')](function(_0x4e23a1){if(_0x4e23a1){if(_0x5ae92a[_0x0fb5('0x56')][_0x0fb5('0x71')]){_0x7061cd[_0x0fb5('0x27')]['interface']=util[_0x0fb5('0x5d')](_0x0fb5('0x72'),_0x5ae92a['user'][_0x0fb5('0x38')]);_0x7061cd[_0x0fb5('0x27')][_0x0fb5('0x73')]=_0x7061cd[_0x0fb5('0x73')];_0x7061cd['message']['event']='accept';return respondWithRpcPromise(_0x0fb5('0x74'),_0x0fb5('0x74'),{'event':'acceptmessage','message':_0x7061cd[_0x0fb5('0x27')]},client9002)[_0x0fb5('0x21')](function(){return _0x7061cd;});}return _0x7061cd;}return null;})[_0x0fb5('0x21')](respondWithResult(_0x33c4eb,null))[_0x0fb5('0x28')](handleError(_0x33c4eb,null));};var interaction_log=require('../../config/logger')(_0x0fb5('0x58'));exports[_0x0fb5('0x34')]=function(_0x675ff7,_0x2bf445,_0x329492){var _0x3ddb6a={'agent':{},'channel':_0x0fb5('0x5a')};if(_0x675ff7[_0x0fb5('0x56')]['id']){delete _0x675ff7['body']['id'];}_0x675ff7[_0x0fb5('0x56')][_0x0fb5('0x5f')]=_0x675ff7[_0x0fb5('0x56')]['UserId']||_0x675ff7[_0x0fb5('0x60')]['id'];_0x3ddb6a[_0x0fb5('0x70')]['id']=_0x675ff7[_0x0fb5('0x56')]['UserId'];return db[_0x0fb5('0x3c')][_0x0fb5('0x54')]({'where':{'id':_0x675ff7[_0x0fb5('0x50')]['id'],'UserId':null}})[_0x0fb5('0x21')](handleEntityNotFound(_0x2bf445,null))[_0x0fb5('0x21')](function(_0x164939){if(_0x164939){_0x3ddb6a[_0x0fb5('0x27')]=_0x164939[_0x0fb5('0x61')]({'plain':!![]});return db['OpenchannelInteraction'][_0x0fb5('0x54')]({'where':{'id':_0x164939[_0x0fb5('0x75')]}});}return null;})['then'](handleEntityNotFound(_0x2bf445,null))['then'](function(_0x41161f){if(_0x41161f){_0x3ddb6a[_0x0fb5('0x63')]=_0x41161f[_0x0fb5('0x61')]({'plain':!![]});interaction_log[_0x0fb5('0x22')](_0x0fb5('0x76'),_0x675ff7[_0x0fb5('0x60')]['id'],_0x675ff7['user'][_0x0fb5('0x38')],_0x675ff7[_0x0fb5('0x60')][_0x0fb5('0x65')],_0x3ddb6a['interaction']['id'],_0x675ff7['body']?JSON[_0x0fb5('0x25')](_0x675ff7[_0x0fb5('0x56')]):'null');return respondWithRpcPromise('RejectMessage',_0x0fb5('0x77'),_0x3ddb6a);}return null;})[_0x0fb5('0x21')](function(_0x4c532b){var _0x32a0fd=_0x0fb5('0x78')+_0x4c532b[_0x0fb5('0x27')]['ContactId'];return db['sequelize'][_0x0fb5('0x40')](_0x32a0fd,{'type':db[_0x0fb5('0x69')]['QueryTypes'][_0x0fb5('0x6a')],'raw':!![]})['then'](function(_0x7345a1){return _0x7345a1;});})['then'](function(_0x19cfd8){if(_0x19cfd8){_0x3ddb6a[_0x0fb5('0x27')][_0x0fb5('0x6b')]=_0x19cfd8[0x0];if(!_0x675ff7[_0x0fb5('0x56')]['UserId'])return;return db[_0x0fb5('0x6c')][_0x0fb5('0x54')]({'where':{'id':_0x675ff7[_0x0fb5('0x56')][_0x0fb5('0x5f')],'role':'agent'},'attributes':['id','name',_0x0fb5('0x6d'),_0x0fb5('0x6e'),_0x0fb5('0x6f')],'raw':!![]});}return null;})['then'](function(_0x1905e4){if(!_0x1905e4)return null;_0x3ddb6a[_0x0fb5('0x27')][_0x0fb5('0x70')]=_0x1905e4;return _0x3ddb6a;})[_0x0fb5('0x21')](function(_0x375889){if(_0x375889){_0x375889[_0x0fb5('0x27')][_0x0fb5('0x79')]=util[_0x0fb5('0x5d')]('SIP/%s',_0x675ff7['user']['name']);_0x375889[_0x0fb5('0x27')]['channel']=_0x3ddb6a[_0x0fb5('0x73')];_0x375889['message']['event']='reject';respondWithRpcPromise(_0x0fb5('0x74'),'EventManager',{'event':_0x0fb5('0x7a'),'message':_0x375889[_0x0fb5('0x27')]},client9002);return _0x3ddb6a;}return null;})[_0x0fb5('0x21')](respondWithResult(_0x2bf445,null))['catch'](handleError(_0x2bf445,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index a257647..71db089 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 _0x28b4=['emit','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','remove'];(function(_0x3a79a1,_0x3a12d9){var _0x43a83b=function(_0x3d83d8){while(--_0x3d83d8){_0x3a79a1['push'](_0x3a79a1['shift']());}};_0x43a83b(++_0x3a12d9);}(_0x28b4,0xb1));var _0x428b=function(_0x3947f0,_0x36a4aa){_0x3947f0=_0x3947f0-0x0;var _0x4712be=_0x28b4[_0x3947f0];return _0x4712be;};'use strict';var EventEmitter=require(_0x428b('0x0'));var OpenchannelMessage=require(_0x428b('0x1'))['db'][_0x428b('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x428b('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x428b('0x4')};function emitEvent(_0x5466ff){return function(_0x26ee3f,_0x2ce485,_0x25db82){OpenchannelMessageEvents[_0x428b('0x5')](_0x5466ff+':'+_0x26ee3f['id'],_0x26ee3f);OpenchannelMessageEvents[_0x428b('0x5')](_0x5466ff,_0x26ee3f);_0x25db82(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0x428b('0x6')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x96db=['remove','exports','events','OpenchannelMessage','setMaxListeners','save','update'];(function(_0xacbfa5,_0xfe352){var _0x5a8a3d=function(_0x28d101){while(--_0x28d101){_0xacbfa5['push'](_0xacbfa5['shift']());}};_0x5a8a3d(++_0xfe352);}(_0x96db,0x8e));var _0xb96d=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0x96db[_0x616290];return _0x453879;};'use strict';var EventEmitter=require(_0xb96d('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0xb96d('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xb96d('0x2')](0x0);var events={'afterCreate':_0xb96d('0x3'),'afterUpdate':_0xb96d('0x4'),'afterDestroy':_0xb96d('0x5')};function emitEvent(_0x2c68ab){return function(_0x207fdf,_0x38aa77,_0x4d63d8){OpenchannelMessageEvents['emit'](_0x2c68ab+':'+_0x207fdf['id'],_0x207fdf);OpenchannelMessageEvents['emit'](_0x2c68ab,_0x207fdf);_0x4d63d8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0xb96d('0x6')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 060b78f..f92c67d 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 _0x0972=['rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','catch','CmContact','describe','find','OpenchannelAccountId','Interactions','Contact','keys','info','OpenchannelMessage,\x20%s,\x20%s','format','replyUri','length','Interaction','omit','POST','method','GET','afterCreate','Message\x20%d\x20forwarded\x20to\x20%s','threadId','error','finally','utf8mb4','utf8mb4_unicode_ci','util','api','bluebird','request-promise'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0972,0x64));var _0x2097=function(_0x3d68df,_0x5af574){_0x3d68df=_0x3d68df-0x0;var _0x378db4=_0x0972[_0x3d68df];return _0x378db4;};'use strict';var _=require('lodash');var util=require(_0x2097('0x0'));var logger=require('../../config/logger')(_0x2097('0x1'));var moment=require('moment');var BPromise=require(_0x2097('0x2'));var rp=require(_0x2097('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2097('0x4'));var config=require(_0x2097('0x5'));var attributes=require(_0x2097('0x6'));module[_0x2097('0x7')]=function(_0x2f84d8,_0x11ed13){return _0x2f84d8[_0x2097('0x8')]('OpenchannelMessage',attributes,{'tableName':_0x2097('0x9'),'paranoid':![],'indexes':[{'name':_0x2097('0xa'),'fields':[_0x2097('0xb')],'type':_0x2097('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3b8fac,_0x59d947,_0x2e0024){var _0x3b8b76=_0x2f84d8[_0x2097('0xd')];var _0x430754=_0x3b8fac[_0x2097('0xe')]({'plain':!![]});if(_0x430754[_0x2097('0xf')][_0x2097('0x10')]()==='in'||_0x430754[_0x2097('0xf')][_0x2097('0x10')]()===_0x2097('0x11')&&!_0x430754[_0x2097('0x12')]&&!_[_0x2097('0x13')](_0x430754[_0x2097('0x14')])){_0x3b8b76[_0x2097('0x15')][_0x2097('0x16')]({'where':{'id':_0x430754[_0x2097('0x17')]}})[_0x2097('0x18')](function(_0x1c9ef9){if(_0x1c9ef9){_0x1c9ef9[_0x2097('0x19')]({'lastMsgAt':_0x430754[_0x2097('0x1a')],'lastMsgDirection':_0x430754['direction'][_0x2097('0x10')]()});}})[_0x2097('0x1b')](function(_0x4d31bc){console['error'](_0x4d31bc);});}if(_0x430754['direction']===_0x2097('0x11')&&!_0x430754['secret']){var _0x28c35c;_0x3b8b76[_0x2097('0x1c')][_0x2097('0x1d')]()[_0x2097('0x18')](function(_0x44c584){return _0x3b8b76['OpenchannelAccount'][_0x2097('0x1e')]({'where':{'id':_0x430754[_0x2097('0x1f')]},'include':[{'model':_0x3b8b76[_0x2097('0x15')],'as':_0x2097('0x20'),'where':{'id':_0x430754[_0x2097('0x17')]},'limit':0x1,'include':[{'model':_0x3b8b76[_0x2097('0x1c')],'as':_0x2097('0x21'),'attributes':_[_0x2097('0x22')](_0x44c584)}]}]});})['then'](function(_0x4d957e){_0x28c35c=_0x4d957e[_0x2097('0xe')]({'plain':!![]});if(_0x28c35c&&_0x28c35c['replyUri']){logger[_0x2097('0x23')](_0x2097('0x24'),'afterCreate',util[_0x2097('0x25')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x430754['id'],_0x28c35c[_0x2097('0x26')]));if(_0x28c35c[_0x2097('0x20')]&&_0x28c35c[_0x2097('0x20')][_0x2097('0x27')]){_0x430754[_0x2097('0x28')]=_[_0x2097('0x29')](_0x28c35c['Interactions'][0x0],_0x2097('0x21'));_0x430754['Contact']=_0x28c35c[_0x2097('0x20')][0x0][_0x2097('0x21')];}var _0x59d947={'method':_0x2097('0x2a'),'uri':encodeURI(_0x28c35c['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x59d947[_0x2097('0x2b')]){case _0x2097('0x2c'):_0x59d947['qs']=_0x430754;break;case'POST':_0x59d947[_0x2097('0xb')]=_0x430754;break;}return rp(_0x59d947)['then'](function(_0x29b879){logger['info'](_0x2097('0x24'),_0x2097('0x2d'),util[_0x2097('0x25')](_0x2097('0x2e'),_0x430754['id'],_0x28c35c[_0x2097('0x26')]));if(_0x29b879[_0x2097('0xb')][_0x2097('0x2f')]&&_0x29b879['body'][_0x2097('0x2f')]!=_0x430754[_0x2097('0x28')]['threadId']){return _0x3b8b76[_0x2097('0x15')][_0x2097('0x19')]({'threadId':_0x29b879['body']['threadId']},{'logging':!![],'where':{'id':_0x430754[_0x2097('0x28')]['id']}});}else{return;}})[_0x2097('0x18')](function(){return _0x3b8fac[_0x2097('0x19')]({'read':!![]});})[_0x2097('0x1b')](function(_0x74ccdc){logger[_0x2097('0x30')]('OpenchannelMessage,\x20%s,\x20%s',_0x2097('0x2d'),util['inspect'](_0x74ccdc,{'showHidden':![],'depth':null}));_0x2e0024();});}else{_0x2e0024();}})[_0x2097('0x31')](function(){_0x2e0024();});}else{_0x2e0024();}}},'charset':_0x2097('0x32'),'collate':_0x2097('0x33')});}; \ No newline at end of file +var _0x757a=['find','OpenchannelAccountId','OpenchannelInteraction','Interactions','keys','replyUri','info','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','Contact','POST','method','OpenchannelMessage,\x20%s,\x20%s','threadId','afterCreate','inspect','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','UserId','OpenchannelInteractionId','update','createdAt','catch','error','out','secret','CmContact','describe','then'];(function(_0x5ef2c3,_0x40c528){var _0x2f295b=function(_0x5b784d){while(--_0x5b784d){_0x5ef2c3['push'](_0x5ef2c3['shift']());}};_0x2f295b(++_0x40c528);}(_0x757a,0xde));var _0xa757=function(_0x3e45b1,_0xe3a2e5){_0x3e45b1=_0x3e45b1-0x0;var _0x2eb57b=_0x757a[_0x3e45b1];return _0x2eb57b;};'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')]('OpenchannelMessage',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[{'name':_0xa757('0xa'),'fields':[_0xa757('0xb')],'type':_0xa757('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3a3db6,_0x5aef8a,_0x89c630){var _0x2ca96f=_0x5edca8[_0xa757('0xd')];var _0x3e2c9a=_0x3a3db6[_0xa757('0xe')]({'plain':!![]});if(_0x3e2c9a[_0xa757('0xf')][_0xa757('0x10')]()==='in'||_0x3e2c9a['direction']['toLowerCase']()==='out'&&!_0x3e2c9a['secret']&&!_['isNil'](_0x3e2c9a[_0xa757('0x11')])){_0x2ca96f['OpenchannelInteraction']['findOne']({'where':{'id':_0x3e2c9a[_0xa757('0x12')]}})['then'](function(_0x481508){if(_0x481508){_0x481508[_0xa757('0x13')]({'lastMsgAt':_0x3e2c9a[_0xa757('0x14')],'lastMsgDirection':_0x3e2c9a[_0xa757('0xf')][_0xa757('0x10')]()});}})[_0xa757('0x15')](function(_0x31cfd2){console[_0xa757('0x16')](_0x31cfd2);});}if(_0x3e2c9a[_0xa757('0xf')]===_0xa757('0x17')&&!_0x3e2c9a[_0xa757('0x18')]){var _0x50aac1;_0x2ca96f[_0xa757('0x19')][_0xa757('0x1a')]()[_0xa757('0x1b')](function(_0x4d9f58){return _0x2ca96f['OpenchannelAccount'][_0xa757('0x1c')]({'where':{'id':_0x3e2c9a[_0xa757('0x1d')]},'include':[{'model':_0x2ca96f[_0xa757('0x1e')],'as':_0xa757('0x1f'),'where':{'id':_0x3e2c9a[_0xa757('0x12')]},'limit':0x1,'include':[{'model':_0x2ca96f[_0xa757('0x19')],'as':'Contact','attributes':_[_0xa757('0x20')](_0x4d9f58)}]}]});})['then'](function(_0x32c2a1){_0x50aac1=_0x32c2a1[_0xa757('0xe')]({'plain':!![]});if(_0x50aac1&&_0x50aac1[_0xa757('0x21')]){logger[_0xa757('0x22')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0xa757('0x23')](_0xa757('0x24'),_0x3e2c9a['id'],_0x50aac1[_0xa757('0x21')]));if(_0x50aac1[_0xa757('0x1f')]&&_0x50aac1[_0xa757('0x1f')][_0xa757('0x25')]){_0x3e2c9a[_0xa757('0x26')]=_[_0xa757('0x27')](_0x50aac1[_0xa757('0x1f')][0x0],'Contact');_0x3e2c9a[_0xa757('0x28')]=_0x50aac1['Interactions'][0x0][_0xa757('0x28')];}var _0x5aef8a={'method':_0xa757('0x29'),'uri':encodeURI(_0x50aac1[_0xa757('0x21')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x5aef8a[_0xa757('0x2a')]){case'GET':_0x5aef8a['qs']=_0x3e2c9a;break;case _0xa757('0x29'):_0x5aef8a[_0xa757('0xb')]=_0x3e2c9a;break;}return rp(_0x5aef8a)[_0xa757('0x1b')](function(_0x3bf7f3){logger['info'](_0xa757('0x2b'),'afterCreate',util['format']('Message\x20%d\x20forwarded\x20to\x20%s',_0x3e2c9a['id'],_0x50aac1['replyUri']));if(_0x3bf7f3[_0xa757('0xb')]['threadId']&&_0x3bf7f3[_0xa757('0xb')][_0xa757('0x2c')]!=_0x3e2c9a['Interaction'][_0xa757('0x2c')]){return _0x2ca96f['OpenchannelInteraction'][_0xa757('0x13')]({'threadId':_0x3bf7f3[_0xa757('0xb')]['threadId']},{'logging':!![],'where':{'id':_0x3e2c9a[_0xa757('0x26')]['id']}});}else{return;}})['then'](function(){return _0x3a3db6[_0xa757('0x13')]({'read':!![]});})[_0xa757('0x15')](function(_0x458974){logger[_0xa757('0x16')](_0xa757('0x2b'),_0xa757('0x2d'),util[_0xa757('0x2e')](_0x458974,{'showHidden':![],'depth':null}));_0x89c630();});}else{_0x89c630();}})[_0xa757('0x2f')](function(){_0x89c630();});}else{_0x89c630();}}},'charset':_0xa757('0x30'),'collate':_0xa757('0x31')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index d2eda17..6569cb8 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 _0x5f2f=['OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','OpenchannelMessage','create','options','raw','CreateOpenchannelMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x42554d,_0x2dc2e6){var _0x5e9e01=function(_0x5561ea){while(--_0x5561ea){_0x42554d['push'](_0x42554d['shift']());}};_0x5e9e01(++_0x2dc2e6);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3d2362,_0x3ca9f0){_0x3d2362=_0x3d2362-0x0;var _0x1b4b5a=_0x5f2f[_0x3d2362];return _0x1b4b5a;};'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});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./openchannelMessage.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['CreateOpenchannelMessage']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')](_0x34706d['body'],{'raw':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![]})[_0xf5f2('0x11')](function(_0x36f1cb){logger['info'](_0xf5f2('0x21'),_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x21'),_0x34706d,JSON[_0xf5f2('0x16')](_0x36f1cb));_0x49dac2(_0x36f1cb);})[_0xf5f2('0x1c')](function(_0x5bdf4a){logger['error'](_0xf5f2('0x21'),_0x5bdf4a[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e[_0xf5f2('0x17')](0x1f4,_0x5bdf4a[_0xf5f2('0x19')]));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body','options','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x361b57,_0x5d2f96){var _0x1d6255=function(_0x3193a5){while(--_0x3193a5){_0x361b57['push'](_0x361b57['shift']());}};_0x1d6255(++_0x5d2f96);}(_0x7a54,0x106));var _0x47a5=function(_0x1bb2d0,_0x1a89ad){_0x1bb2d0=_0x1bb2d0-0x0;var _0x30f573=_0x7a54[_0x1bb2d0];return _0x30f573;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});config['redis']=_[_0x47a5('0xb')](config[_0x47a5('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0xd'))(new Redis(config['redis']));require('./openchannelMessage.socket')['register'](socket);function respondWithRpcPromise(_0x2a0e98,_0x2baee7,_0x5e31dd){return new BPromise(function(_0x2eb0dd,_0x49e844){return client['request'](_0x2a0e98,_0x5e31dd)[_0x47a5('0xe')](function(_0x69e4d4){logger[_0x47a5('0xf')](_0x47a5('0x10'),_0x2baee7,_0x47a5('0x11'));logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x2baee7,'request\x20sent',JSON[_0x47a5('0x14')](_0x69e4d4));if(_0x69e4d4[_0x47a5('0x15')]){if(_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x16')]===0x1f4){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x49e844(_0x69e4d4['error'][_0x47a5('0x17')]);}logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x2eb0dd(_0x69e4d4['error']['message']);}else{logger[_0x47a5('0xf')]('OpenchannelMessage,\x20%s,\x20%s',_0x2baee7,'request\x20sent');_0x2eb0dd(_0x69e4d4[_0x47a5('0x18')][_0x47a5('0x17')]);}})[_0x47a5('0x19')](function(_0x1ef371){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x1ef371);_0x49e844(_0x1ef371);});});}exports[_0x47a5('0x1a')]=function(_0xe3c618){var _0x3aed38=this;return new Promise(function(_0x4a9fcb,_0x1570bc){return db[_0x47a5('0x1b')]['create'](_0xe3c618[_0x47a5('0x1c')],{'raw':_0xe3c618[_0x47a5('0x1d')]?_0xe3c618[_0x47a5('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x47a5('0xe')](function(_0x2f142b){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xe3c618);logger['debug'](_0x47a5('0x1a'),_0xe3c618,JSON[_0x47a5('0x14')](_0x2f142b));_0x4a9fcb(_0x2f142b);})['catch'](function(_0x28747d){logger[_0x47a5('0x15')](_0x47a5('0x1a'),_0x28747d[_0x47a5('0x17')],_0xe3c618);_0x1570bc(_0x3aed38[_0x47a5('0x15')](0x1f4,_0x28747d['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 8d2606a..7e5c6f0 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 _0x5379=['remove','emit','length','./openchannelMessage.events','save'];(function(_0x5a30e8,_0x595db8){var _0x4095c0=function(_0x40424a){while(--_0x40424a){_0x5a30e8['push'](_0x5a30e8['shift']());}};_0x4095c0(++_0x595db8);}(_0x5379,0x1a2));var _0x9537=function(_0x553cde,_0x2c697a){_0x553cde=_0x553cde-0x0;var _0x25335d=_0x5379[_0x553cde];return _0x25335d;};'use strict';var OpenchannelMessageEvents=require(_0x9537('0x0'));var events=[_0x9537('0x1'),_0x9537('0x2'),'update'];function createListener(_0x2e1f6f,_0x5a0662){return function(_0x449248){_0x5a0662[_0x9537('0x3')](_0x2e1f6f,_0x449248);};}function removeListener(_0x2bc830,_0x35ff2c){return function(){OpenchannelMessageEvents['removeListener'](_0x2bc830,_0x35ff2c);};}exports['register']=function(_0x3ee12d){for(var _0x5a62f0=0x0,_0x227ac6=events[_0x9537('0x4')];_0x5a62f0<_0x227ac6;_0x5a62f0++){var _0x379123=events[_0x5a62f0];var _0x2b7054=createListener('openchannelMessage:'+_0x379123,_0x3ee12d);OpenchannelMessageEvents['on'](_0x379123,_0x2b7054);}}; \ No newline at end of file +var _0x65eb=['save','update','removeListener','register','length','openchannelMessage:','./openchannelMessage.events'];(function(_0x33c0d8,_0x467885){var _0xb80222=function(_0x4610d2){while(--_0x4610d2){_0x33c0d8['push'](_0x33c0d8['shift']());}};_0xb80222(++_0x467885);}(_0x65eb,0x1a3));var _0xb65e=function(_0x3b81eb,_0x4e2c08){_0x3b81eb=_0x3b81eb-0x0;var _0xf3a610=_0x65eb[_0x3b81eb];return _0xf3a610;};'use strict';var OpenchannelMessageEvents=require(_0xb65e('0x0'));var events=[_0xb65e('0x1'),'remove',_0xb65e('0x2')];function createListener(_0xccfa9e,_0x38cf85){return function(_0x128bd0){_0x38cf85['emit'](_0xccfa9e,_0x128bd0);};}function removeListener(_0x5aeb37,_0x5e511f){return function(){OpenchannelMessageEvents[_0xb65e('0x3')](_0x5aeb37,_0x5e511f);};}exports[_0xb65e('0x4')]=function(_0x3acce1){for(var _0x3ce1db=0x0,_0x2792fa=events[_0xb65e('0x5')];_0x3ce1db<_0x2792fa;_0x3ce1db++){var _0x57e82f=events[_0x3ce1db];var _0x16159d=createListener(_0xb65e('0x6')+_0x57e82f,_0x3acce1);OpenchannelMessageEvents['on'](_0x57e82f,_0x16159d);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 037f746..fd7240b 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 _0xc378=['connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','getAgents','create','addTeams','post','addAgents','update','delete','removeTeams','/:id/users','removeAgents','exports','multer','util'];(function(_0x48773d,_0x32346f){var _0x2f0694=function(_0x24efbe){while(--_0x24efbe){_0x48773d['push'](_0x48773d['shift']());}};_0x2f0694(++_0x32346f);}(_0xc378,0x16a));var _0x8c37=function(_0x13c174,_0xda25fe){_0x13c174=_0x13c174-0x0;var _0x160654=_0xc378[_0x13c174];return _0x160654;};'use strict';var multer=require(_0x8c37('0x0'));var util=require(_0x8c37('0x1'));var path=require('path');var timeout=require(_0x8c37('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8c37('0x3'));var auth=require(_0x8c37('0x4'));var interaction=require(_0x8c37('0x5'));var config=require('../../config/environment');var controller=require(_0x8c37('0x6'));router[_0x8c37('0x7')]('/',auth[_0x8c37('0x8')](),controller[_0x8c37('0x9')]);router[_0x8c37('0x7')](_0x8c37('0xa'),auth[_0x8c37('0x8')](),controller[_0x8c37('0xb')]);router['get'](_0x8c37('0xc'),auth[_0x8c37('0x8')](),controller[_0x8c37('0xd')]);router[_0x8c37('0x7')]('/:id/members',auth[_0x8c37('0x8')](),controller[_0x8c37('0xe')]);router[_0x8c37('0x7')](_0x8c37('0xf'),auth[_0x8c37('0x8')](),controller[_0x8c37('0x10')]);router[_0x8c37('0x7')]('/:id/users',auth[_0x8c37('0x8')](),controller[_0x8c37('0x11')]);router['post']('/',auth[_0x8c37('0x8')](),controller[_0x8c37('0x12')]);router['post'](_0x8c37('0xf'),auth[_0x8c37('0x8')](),controller[_0x8c37('0x13')]);router[_0x8c37('0x14')]('/:id/users',auth[_0x8c37('0x8')](),controller[_0x8c37('0x15')]);router['put'](_0x8c37('0xc'),auth[_0x8c37('0x8')](),controller[_0x8c37('0x16')]);router[_0x8c37('0x17')](_0x8c37('0xc'),auth[_0x8c37('0x8')](),controller['destroy']);router[_0x8c37('0x17')](_0x8c37('0xf'),auth[_0x8c37('0x8')](),controller[_0x8c37('0x18')]);router[_0x8c37('0x17')](_0x8c37('0x19'),auth[_0x8c37('0x8')](),controller[_0x8c37('0x1a')]);module[_0x8c37('0x1b')]=router; \ No newline at end of file +var _0x2f32=['removeAgents','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','create','addTeams','put','update','delete','destroy'];(function(_0x58ea22,_0x1e7e70){var _0x10d49c=function(_0x43f293){while(--_0x43f293){_0x58ea22['push'](_0x58ea22['shift']());}};_0x10d49c(++_0x1e7e70);}(_0x2f32,0x110));var _0x22f3=function(_0x47d820,_0x4bac50){_0x47d820=_0x47d820-0x0;var _0x39e37e=_0x2f32[_0x47d820];return _0x39e37e;};'use strict';var multer=require(_0x22f3('0x0'));var util=require(_0x22f3('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x22f3('0x2'));var router=express[_0x22f3('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x22f3('0x4'));var interaction=require(_0x22f3('0x5'));var config=require(_0x22f3('0x6'));var controller=require('./openchannelQueue.controller');router[_0x22f3('0x7')]('/',auth[_0x22f3('0x8')](),controller['index']);router['get'](_0x22f3('0x9'),auth[_0x22f3('0x8')](),controller[_0x22f3('0xa')]);router[_0x22f3('0x7')](_0x22f3('0xb'),auth['isAuthenticated'](),controller[_0x22f3('0xc')]);router[_0x22f3('0x7')](_0x22f3('0xd'),auth[_0x22f3('0x8')](),controller[_0x22f3('0xe')]);router['get'](_0x22f3('0xf'),auth['isAuthenticated'](),controller[_0x22f3('0x10')]);router[_0x22f3('0x7')](_0x22f3('0x11'),auth[_0x22f3('0x8')](),controller['getAgents']);router[_0x22f3('0x12')]('/',auth[_0x22f3('0x8')](),controller[_0x22f3('0x13')]);router[_0x22f3('0x12')](_0x22f3('0xf'),auth[_0x22f3('0x8')](),controller[_0x22f3('0x14')]);router[_0x22f3('0x12')](_0x22f3('0x11'),auth[_0x22f3('0x8')](),controller['addAgents']);router[_0x22f3('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x22f3('0x16')]);router[_0x22f3('0x17')](_0x22f3('0xb'),auth['isAuthenticated'](),controller[_0x22f3('0x18')]);router[_0x22f3('0x17')](_0x22f3('0xf'),auth['isAuthenticated'](),controller['removeTeams']);router[_0x22f3('0x17')](_0x22f3('0x11'),auth[_0x22f3('0x8')](),controller[_0x22f3('0x19')]);module[_0x22f3('0x1a')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 2671665..cd87748 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 _0x8b87=['INTEGER','ENUM','rrmemory','beepall','exports','STRING','name'];(function(_0x3f8648,_0x17cb1a){var _0x44c3fd=function(_0x1ab02b){while(--_0x1ab02b){_0x3f8648['push'](_0x3f8648['shift']());}};_0x44c3fd(++_0x17cb1a);}(_0x8b87,0x162));var _0x78b8=function(_0xd278f9,_0x157d43){_0xd278f9=_0xd278f9-0x0;var _0x3d7e95=_0x8b87[_0xd278f9];return _0x3d7e95;};'use strict';var Sequelize=require('sequelize');module[_0x78b8('0x0')]={'name':{'type':Sequelize[_0x78b8('0x1')],'unique':_0x78b8('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x78b8('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x78b8('0x4')](_0x78b8('0x5'),_0x78b8('0x6'),'roundrobin')}}; \ No newline at end of file +var _0x7335=['exports','name','STRING','ENUM','beepall','sequelize'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x7335,0x71));var _0x5733=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7335[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x5733('0x0'));module[_0x5733('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x5733('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5733('0x3')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5733('0x4')]('rrmemory',_0x5733('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 897efb4..feb526d 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 _0x85cd=['findOrCreate','forEach','emit','removeTeams','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','all','union','value','isEmpty','removeAgents','addAgents','omit','spread','userOpenchannelQueue:save','isArray','userOpenchannelQueue:remove','getAgents','eml-format','rimraf','zip-dir','moment','bluebird','path','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','OpenchannelQueues','UserProfileResource','status','error','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserOpenchannelQueue','OpenchannelQueueId','findAndCountAll','UserId','openchannelPause','createdAt','format','updatedAt','getTeams','Team','order','nolimit','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each'];(function(_0x21d2d6,_0xa4612e){var _0x31602e=function(_0x2a4e6a){while(--_0x2a4e6a){_0x21d2d6['push'](_0x21d2d6['shift']());}};_0x31602e(++_0xa4612e);}(_0x85cd,0x13b));var _0xd85c=function(_0x45c8a6,_0x5587e3){_0x45c8a6=_0x45c8a6-0x0;var _0x53b596=_0x85cd[_0x45c8a6];return _0x53b596;};'use strict';var emlformat=require(_0xd85c('0x0'));var rimraf=require(_0xd85c('0x1'));var zipdir=require(_0xd85c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd85c('0x3'));var BPromise=require(_0xd85c('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd85c('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd85c('0x6'));var fs=require('fs');var fs_extra=require(_0xd85c('0x7'));var _=require(_0xd85c('0x8'));var squel=require(_0xd85c('0x9'));var crypto=require(_0xd85c('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xd85c('0xb'));var toCsv=require(_0xd85c('0xc'));var querystring=require(_0xd85c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd85c('0xe'));var as=require(_0xd85c('0xf'));var hardwareService=require(_0xd85c('0x10'));var logger=require(_0xd85c('0x11'))(_0xd85c('0x12'));var utils=require(_0xd85c('0x13'));var config=require(_0xd85c('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xd85c('0x15')]=_[_0xd85c('0x16')](config[_0xd85c('0x15')],{'host':_0xd85c('0x17'),'port':0x18eb});var socket=require(_0xd85c('0x18'))(new Redis(config['redis']));require('./openchannelQueue.socket')[_0xd85c('0x19')](socket);function respondWithStatusCode(_0x9bd41b,_0x25a31c){_0x25a31c=_0x25a31c||0xcc;return function(_0x4702ba){if(_0x4702ba){return _0x9bd41b[_0xd85c('0x1a')](_0x25a31c);}return _0x9bd41b['status'](_0x25a31c)[_0xd85c('0x1b')]();};}function respondWithResult(_0x5b348a,_0x43aa96){_0x43aa96=_0x43aa96||0xc8;return function(_0x35de95){if(_0x35de95){return _0x5b348a['status'](_0x43aa96)[_0xd85c('0x1c')](_0x35de95);}};}function respondWithFilteredResult(_0x1e6f9d,_0xc7f99f){return function(_0x9d6e1b){if(_0x9d6e1b){var _0x24c601=typeof _0xc7f99f[_0xd85c('0x1d')]===_0xd85c('0x1e')&&typeof _0xc7f99f[_0xd85c('0x1f')]==='undefined';var _0x5dd61b=_0x9d6e1b[_0xd85c('0x20')];var _0x34de18=_0x24c601?0x0:_0xc7f99f[_0xd85c('0x1d')];var _0x446007=_0x24c601?_0x9d6e1b[_0xd85c('0x20')]:_0xc7f99f['offset']+_0xc7f99f[_0xd85c('0x1f')];var _0x4f4248;if(_0x446007>=_0x5dd61b){_0x446007=_0x5dd61b;_0x4f4248=0xc8;}else{_0x4f4248=0xce;}_0x1e6f9d['status'](_0x4f4248);return _0x1e6f9d[_0xd85c('0x21')](_0xd85c('0x22'),_0x34de18+'-'+_0x446007+'/'+_0x5dd61b)[_0xd85c('0x1c')](_0x9d6e1b);}return null;};}function patchUpdates(_0x382a39){return function(_0x50264a){try{jsonpatch['apply'](_0x50264a,_0x382a39,!![]);}catch(_0x1bcb60){return BPromise[_0xd85c('0x23')](_0x1bcb60);}return _0x50264a[_0xd85c('0x24')]();};}function saveUpdates(_0x41ddcb,_0x246e25){return function(_0x3ec847){if(_0x3ec847){return _0x3ec847[_0xd85c('0x25')](_0x41ddcb)[_0xd85c('0x26')](function(_0x4e78ba){return _0x4e78ba;});}return null;};}function removeEntity(_0xf3028b,_0x394190){return function(_0x394368){if(_0x394368){return _0x394368[_0xd85c('0x27')]()['then'](function(){var _0x5a7ec9=_0x394368[_0xd85c('0x28')]({'plain':!![]});var _0x1ee617=_0xd85c('0x29');return db[_0xd85c('0x2a')][_0xd85c('0x27')]({'where':{'type':_0x1ee617,'resourceId':_0x5a7ec9['id']}})[_0xd85c('0x26')](function(){return _0x394368;});})[_0xd85c('0x26')](function(){_0xf3028b[_0xd85c('0x2b')](0xcc)[_0xd85c('0x1b')]();});}};}function handleEntityNotFound(_0xa8c199,_0x27d61f){return function(_0x5dc61a){if(!_0x5dc61a){_0xa8c199['sendStatus'](0x194);}return _0x5dc61a;};}function handleError(_0x1f50b0,_0x2558d8){_0x2558d8=_0x2558d8||0x1f4;return function(_0x4b9e17){logger[_0xd85c('0x2c')](_0x4b9e17[_0xd85c('0x2d')]);if(_0x4b9e17[_0xd85c('0x2e')]){delete _0x4b9e17[_0xd85c('0x2e')];}_0x1f50b0['status'](_0x2558d8)[_0xd85c('0x2f')](_0x4b9e17);};}exports[_0xd85c('0x30')]=function(_0x8eeeb0,_0x5d10d){var _0x4cfb0c={},_0x4681f1={},_0xb9e7a7={'count':0x0,'rows':[]};var _0x53a086=_[_0xd85c('0x31')](db[_0xd85c('0x32')][_0xd85c('0x33')],function(_0x532c92){return{'name':_0x532c92[_0xd85c('0x34')],'type':_0x532c92['type'][_0xd85c('0x35')]};});_0x4681f1[_0xd85c('0x36')]=_[_0xd85c('0x31')](_0x53a086,_0xd85c('0x2e'));_0x4681f1[_0xd85c('0x37')]=_[_0xd85c('0x38')](_0x8eeeb0[_0xd85c('0x37')]);_0x4681f1[_0xd85c('0x39')]=_['intersection'](_0x4681f1[_0xd85c('0x36')],_0x4681f1[_0xd85c('0x37')]);_0x4cfb0c[_0xd85c('0x3a')]=_[_0xd85c('0x3b')](_0x4681f1[_0xd85c('0x36')],qs['fields'](_0x8eeeb0[_0xd85c('0x37')][_0xd85c('0x3c')]));_0x4cfb0c[_0xd85c('0x3a')]=_0x4cfb0c[_0xd85c('0x3a')][_0xd85c('0x3d')]?_0x4cfb0c[_0xd85c('0x3a')]:_0x4681f1[_0xd85c('0x36')];if(!_0x8eeeb0['query'][_0xd85c('0x3e')]('nolimit')){_0x4cfb0c[_0xd85c('0x1f')]=qs['limit'](_0x8eeeb0['query'][_0xd85c('0x1f')]);_0x4cfb0c['offset']=qs[_0xd85c('0x1d')](_0x8eeeb0[_0xd85c('0x37')][_0xd85c('0x1d')]);}_0x4cfb0c['order']=qs[_0xd85c('0x3f')](_0x8eeeb0[_0xd85c('0x37')][_0xd85c('0x3f')]);_0x4cfb0c[_0xd85c('0x40')]=qs[_0xd85c('0x39')](_[_0xd85c('0x41')](_0x8eeeb0[_0xd85c('0x37')],_0x4681f1[_0xd85c('0x39')]),_0x53a086);if(_0x8eeeb0[_0xd85c('0x37')]['filter']){_0x4cfb0c['where']=_[_0xd85c('0x42')](_0x4cfb0c['where'],{'$or':_[_0xd85c('0x31')](_0x53a086,function(_0x133ecd){if(_0x133ecd['type']!==_0xd85c('0x43')){var _0x5af0fa={};_0x5af0fa[_0x133ecd[_0xd85c('0x2e')]]={'$like':'%'+_0x8eeeb0['query'][_0xd85c('0x44')]+'%'};return _0x5af0fa;}})});}_0x4cfb0c=_[_0xd85c('0x42')]({},_0x4cfb0c,_0x8eeeb0[_0xd85c('0x45')]);var _0xb96e35={'where':_0x4cfb0c['where']};return db['OpenchannelQueue'][_0xd85c('0x20')](_0xb96e35)['then'](function(_0xe9dd12){_0xb9e7a7[_0xd85c('0x20')]=_0xe9dd12;if(_0x8eeeb0['query'][_0xd85c('0x46')]){_0x4cfb0c[_0xd85c('0x47')]=[{'all':!![]}];}return db[_0xd85c('0x32')][_0xd85c('0x48')](_0x4cfb0c);})['then'](function(_0x3779c6){_0xb9e7a7[_0xd85c('0x49')]=_0x3779c6;return _0xb9e7a7;})[_0xd85c('0x26')](respondWithFilteredResult(_0x5d10d,_0x4cfb0c))[_0xd85c('0x4a')](handleError(_0x5d10d,null));};exports[_0xd85c('0x4b')]=function(_0x62e9be,_0x45361a){var _0x2dc429={'raw':!![],'where':{'id':_0x62e9be[_0xd85c('0x4c')]['id']}},_0x14da6c={};_0x14da6c['model']=_['keys'](db[_0xd85c('0x32')]['rawAttributes']);_0x14da6c[_0xd85c('0x37')]=_['keys'](_0x62e9be[_0xd85c('0x37')]);_0x14da6c[_0xd85c('0x39')]=_['intersection'](_0x14da6c[_0xd85c('0x36')],_0x14da6c[_0xd85c('0x37')]);_0x2dc429[_0xd85c('0x3a')]=_[_0xd85c('0x3b')](_0x14da6c['model'],qs[_0xd85c('0x3c')](_0x62e9be['query'][_0xd85c('0x3c')]));_0x2dc429['attributes']=_0x2dc429[_0xd85c('0x3a')]['length']?_0x2dc429[_0xd85c('0x3a')]:_0x14da6c['model'];if(_0x62e9be[_0xd85c('0x37')][_0xd85c('0x46')]){_0x2dc429['include']=[{'all':!![]}];}_0x2dc429=_['merge']({},_0x2dc429,_0x62e9be[_0xd85c('0x45')]);return db[_0xd85c('0x32')][_0xd85c('0x4d')](_0x2dc429)[_0xd85c('0x26')](handleEntityNotFound(_0x45361a,null))[_0xd85c('0x26')](respondWithResult(_0x45361a,null))['catch'](handleError(_0x45361a,null));};exports[_0xd85c('0x4e')]=function(_0x13b843,_0x40254e){return db[_0xd85c('0x32')][_0xd85c('0x4e')](_0x13b843['body'],{})[_0xd85c('0x26')](function(_0x9ee621){var _0x2149ed=_0x13b843[_0xd85c('0x4f')][_0xd85c('0x28')]({'plain':!![]});if(!_0x2149ed)throw new Error(_0xd85c('0x50'));if(_0x2149ed[_0xd85c('0x51')]===_0xd85c('0x4f')){var _0x2a71c1=_0x9ee621[_0xd85c('0x28')]({'plain':!![]});var _0x1fc57c=_0xd85c('0x29');return db['UserProfileSection'][_0xd85c('0x4d')]({'where':{'name':_0x1fc57c,'userProfileId':_0x2149ed['userProfileId']},'raw':!![]})[_0xd85c('0x26')](function(_0x3bbc90){if(_0x3bbc90&&_0x3bbc90[_0xd85c('0x52')]===0x0){return db[_0xd85c('0x2a')][_0xd85c('0x4e')]({'name':_0x2a71c1[_0xd85c('0x2e')],'resourceId':_0x2a71c1['id'],'type':_0x3bbc90['name'],'sectionId':_0x3bbc90['id']},{})[_0xd85c('0x26')](function(){return _0x9ee621;});}else{return _0x9ee621;}})[_0xd85c('0x4a')](function(_0x47611a){logger[_0xd85c('0x2c')](_0xd85c('0x53'),_0x47611a);throw _0x47611a;});}return _0x9ee621;})[_0xd85c('0x26')](respondWithResult(_0x40254e,0xc9))[_0xd85c('0x4a')](handleError(_0x40254e,null));};exports[_0xd85c('0x25')]=function(_0x227401,_0x3ea68a){if(_0x227401['body']['id']){delete _0x227401[_0xd85c('0x54')]['id'];}return db[_0xd85c('0x32')][_0xd85c('0x4d')]({'where':{'id':_0x227401[_0xd85c('0x4c')]['id']}})[_0xd85c('0x26')](handleEntityNotFound(_0x3ea68a,null))['then'](saveUpdates(_0x227401['body'],null))[_0xd85c('0x26')](respondWithResult(_0x3ea68a,null))[_0xd85c('0x4a')](handleError(_0x3ea68a,null));};exports[_0xd85c('0x27')]=function(_0x25dc0a,_0x2757a2){return db['OpenchannelQueue']['find']({'where':{'id':_0x25dc0a[_0xd85c('0x4c')]['id']}})[_0xd85c('0x26')](handleEntityNotFound(_0x2757a2,null))[_0xd85c('0x26')](removeEntity(_0x2757a2,null))[_0xd85c('0x4a')](handleError(_0x2757a2,null));};exports[_0xd85c('0x55')]=function(_0x3952e9,_0x237a69){return db['OpenchannelQueue'][_0xd85c('0x55')]()[_0xd85c('0x26')](respondWithResult(_0x237a69,null))[_0xd85c('0x4a')](handleError(_0x237a69,null));};exports[_0xd85c('0x56')]=function(_0x4c157e,_0x4a651a,_0x458750){var _0x4dc087={'raw':!![],'where':{}},_0x1fa4b4={},_0xccaed3;return db[_0xd85c('0x32')][_0xd85c('0x57')]({'where':{'id':_0x4c157e[_0xd85c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4a651a,null))[_0xd85c('0x26')](function(_0x618ba9){if(_0x618ba9){_0xccaed3=_0x618ba9['get']({'plain':!![]});_0x1fa4b4['model']=_[_0xd85c('0x38')](db[_0xd85c('0x58')][_0xd85c('0x33')]);_0x1fa4b4['query']=_[_0xd85c('0x38')](_0x4c157e[_0xd85c('0x37')]);_0x1fa4b4[_0xd85c('0x39')]=_[_0xd85c('0x3b')](_0x1fa4b4[_0xd85c('0x36')],_0x1fa4b4[_0xd85c('0x37')]);_0x4dc087['attributes']=_[_0xd85c('0x3b')](_0x1fa4b4[_0xd85c('0x36')],qs[_0xd85c('0x3c')](_0x4c157e[_0xd85c('0x37')][_0xd85c('0x3c')]));_0x4dc087[_0xd85c('0x3a')]=_0x4dc087[_0xd85c('0x3a')][_0xd85c('0x3d')]?_0x4dc087[_0xd85c('0x3a')]:_0x1fa4b4[_0xd85c('0x36')];if(!_0x4c157e[_0xd85c('0x37')]['hasOwnProperty']('nolimit')){_0x4dc087[_0xd85c('0x1f')]=qs[_0xd85c('0x1f')](_0x4c157e['query'][_0xd85c('0x1f')]);_0x4dc087['offset']=qs[_0xd85c('0x1d')](_0x4c157e[_0xd85c('0x37')][_0xd85c('0x1d')]);}_0x4dc087['order']=qs[_0xd85c('0x3f')](_0x4c157e['query'][_0xd85c('0x3f')]);_0x4dc087[_0xd85c('0x40')]=qs[_0xd85c('0x39')](_[_0xd85c('0x41')](_0x4c157e[_0xd85c('0x37')],_0x1fa4b4['filters']));_0x4dc087[_0xd85c('0x40')][_0xd85c('0x59')]=_0x618ba9['id'];if(_0x4c157e['query'][_0xd85c('0x44')]){_0x4dc087[_0xd85c('0x40')]=_[_0xd85c('0x42')](_0x4dc087[_0xd85c('0x40')],{'$or':_[_0xd85c('0x31')](_0x4dc087['attributes'],function(_0x189a1d){var _0x5d1b03={};_0x5d1b03[_0x189a1d]={'$like':'%'+_0x4c157e[_0xd85c('0x37')][_0xd85c('0x44')]+'%'};return _0x5d1b03;})});}_0x4dc087=_['merge']({},_0x4dc087,_0x4c157e[_0xd85c('0x45')]);return db['UserOpenchannelQueue'][_0xd85c('0x48')](_0x4dc087);}})[_0xd85c('0x26')](function(_0x14d997){if(_0x14d997){return db['User'][_0xd85c('0x5a')]({'where':{'id':_[_0xd85c('0x31')](_0x14d997,_0xd85c('0x5b')),'role':'agent'},'attributes':['id',_0xd85c('0x2e'),_0xd85c('0x5c'),'updatedAt',_0xd85c('0x5d')]});}})[_0xd85c('0x26')](function(_0x366a07){if(_0x366a07){return{'count':_0x366a07[_0xd85c('0x20')],'rows':_['map'](_0x366a07['rows'],function(_0x54f604){return{'membername':_0x54f604[_0xd85c('0x2e')],'UserId':_0x54f604['id'],'queue_name':_0xccaed3['name'],'OpenchannelQueueId':_0xccaed3['id'],'interface':util[_0xd85c('0x5e')]('%s/%s','SIP',_0x54f604[_0xd85c('0x2e')]),'penalty':0x0,'paused':_0x54f604[_0xd85c('0x5c')],'createdAt':_0x54f604[_0xd85c('0x5d')],'updatedAt':_0x54f604[_0xd85c('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4a651a,_0x4dc087))[_0xd85c('0x4a')](handleError(_0x4a651a,null));};exports[_0xd85c('0x60')]=function(_0x529d91,_0xadd9e,_0x17a177){var _0x3f6971={};var _0x3a727d={};var _0x3deb5f;var _0x79bd63;return db[_0xd85c('0x32')][_0xd85c('0x57')]({'where':{'id':_0x529d91[_0xd85c('0x4c')]['id']}})['then'](handleEntityNotFound(_0xadd9e,null))[_0xd85c('0x26')](function(_0xed7767){if(_0xed7767){_0x3deb5f=_0xed7767;_0x3a727d['model']=_[_0xd85c('0x38')](db[_0xd85c('0x61')][_0xd85c('0x33')]);_0x3a727d[_0xd85c('0x37')]=_[_0xd85c('0x38')](_0x529d91['query']);_0x3a727d[_0xd85c('0x39')]=_['intersection'](_0x3a727d['model'],_0x3a727d['query']);_0x3f6971['attributes']=_['intersection'](_0x3a727d['model'],qs[_0xd85c('0x3c')](_0x529d91[_0xd85c('0x37')][_0xd85c('0x3c')]));_0x3f6971[_0xd85c('0x3a')]=_0x3f6971[_0xd85c('0x3a')]['length']?_0x3f6971[_0xd85c('0x3a')]:_0x3a727d['model'];_0x3f6971[_0xd85c('0x62')]=qs[_0xd85c('0x3f')](_0x529d91['query'][_0xd85c('0x3f')]);_0x3f6971['where']=qs['filters'](_['pick'](_0x529d91[_0xd85c('0x37')],_0x3a727d[_0xd85c('0x39')]));if(_0x529d91['query'][_0xd85c('0x44')]){_0x3f6971[_0xd85c('0x40')]=_[_0xd85c('0x42')](_0x3f6971[_0xd85c('0x40')],{'$or':_[_0xd85c('0x31')](_0x3f6971[_0xd85c('0x3a')],function(_0xa80f49){var _0x84357a={};_0x84357a[_0xa80f49]={'$like':'%'+_0x529d91['query'][_0xd85c('0x44')]+'%'};return _0x84357a;})});}_0x3f6971=_[_0xd85c('0x42')]({},_0x3f6971,_0x529d91[_0xd85c('0x45')]);return _0x3deb5f['getTeams'](_0x3f6971);}})[_0xd85c('0x26')](function(_0x33b548){if(_0x33b548){_0x79bd63=_0x33b548[_0xd85c('0x3d')];if(!_0x529d91[_0xd85c('0x37')][_0xd85c('0x3e')](_0xd85c('0x63'))){_0x3f6971[_0xd85c('0x1f')]=qs[_0xd85c('0x1f')](_0x529d91['query'][_0xd85c('0x1f')]);_0x3f6971[_0xd85c('0x1d')]=qs['offset'](_0x529d91[_0xd85c('0x37')][_0xd85c('0x1d')]);}return _0x3deb5f[_0xd85c('0x60')](_0x3f6971);}})[_0xd85c('0x26')](function(_0x57c280){if(_0x57c280){return _0x57c280?{'count':_0x79bd63,'rows':_0x57c280}:null;}})[_0xd85c('0x26')](respondWithResult(_0xadd9e,null))[_0xd85c('0x4a')](handleError(_0xadd9e,null));};exports[_0xd85c('0x64')]=function(_0xe6378e,_0x11b3d7,_0xdda062){var _0x269f70=_0xe6378e['body'][_0xd85c('0x65')];return db[_0xd85c('0x61')][_0xd85c('0x48')]({'where':{'id':_0x269f70},'attributes':['id'],'include':[{'model':db[_0xd85c('0x66')],'as':_0xd85c('0x67'),'attributes':['id',_0xd85c('0x2e'),_0xd85c('0x68'),_0xd85c('0x69'),_0xd85c('0x6a')],'raw':!![]}]})[_0xd85c('0x26')](function(_0x354272){if(_0x354272){var _0x37b730=_[_0xd85c('0x6b')](_0x354272,function(_0x319408){var _0xc5482e=_0x319408[_0xd85c('0x28')]({'plain':!![]});return _0xc5482e[_0xd85c('0x67')];});return db[_0xd85c('0x32')][_0xd85c('0x4d')]({'where':{'id':_0xe6378e['params']['id']}})[_0xd85c('0x26')](function(_0x2a04fe){return db[_0xd85c('0x6c')][_0xd85c('0x6d')](function(_0x17d654){return _0x2a04fe[_0xd85c('0x64')](_0x269f70,{'transaction':_0x17d654})['then'](function(){return BPromise[_0xd85c('0x6e')](_0x37b730,function(_0x383400){return db[_0xd85c('0x58')][_0xd85c('0x6f')]({'where':{'UserId':_0x383400['id'],'OpenchannelQueueId':_0xe6378e[_0xd85c('0x4c')]['id']},'transaction':_0x17d654});});})[_0xd85c('0x26')](function(){_0x37b730[_0xd85c('0x70')](function(_0x4a8904){socket[_0xd85c('0x71')]('userOpenchannelQueue:save',{'UserId':_0x4a8904['id'],'OpenchannelQueueId':_0x2a04fe['id']});});});});});}})[_0xd85c('0x26')](respondWithStatusCode(_0x11b3d7,null))[_0xd85c('0x4a')](handleError(_0x11b3d7,null));};exports[_0xd85c('0x72')]=function(_0x142a0e,_0x3652a6,_0x26fd1f){return db['Team'][_0xd85c('0x48')]({'where':{'id':_0x142a0e[_0xd85c('0x37')][_0xd85c('0x65')]},'attributes':['id'],'include':[{'model':db[_0xd85c('0x66')],'as':_0xd85c('0x67'),'attributes':['id'],'raw':!![]}]})[_0xd85c('0x26')](handleEntityNotFound(_0x3652a6,null))[_0xd85c('0x26')](function(_0x54d267){var _0xd3c328=_[_0xd85c('0x31')](_0x54d267,'id');var _0x4434d5=[];var _0x33ead7=[];var _0x21fa86=squel['select']();_0x21fa86[_0xd85c('0x73')](_0xd85c('0x74'))[_0xd85c('0x75')]('team_has_openchannel_queues','tq')[_0xd85c('0x76')](_0xd85c('0x77'),'ut',_0xd85c('0x78'))[_0xd85c('0x40')](_0xd85c('0x79'),_0x142a0e[_0xd85c('0x4c')]['id']);for(var _0xef9770=0x0;_0xef9770<_0x54d267[_0xd85c('0x3d')];_0xef9770+=0x1){let _0x299114=_0x54d267[_0xef9770];for(var _0x40ba64=0x0;_0x40ba64<_0x299114[_0xd85c('0x67')][_0xd85c('0x3d')];_0x40ba64+=0x1){let _0x8dd6e8=_0x299114[_0xd85c('0x67')][_0x40ba64];var _0x53a943=_0x21fa86[_0xd85c('0x7a')]();_0x53a943[_0xd85c('0x40')](_0xd85c('0x7b'),_0x8dd6e8['id']);_0x33ead7[_0xd85c('0x7c')](db[_0xd85c('0x6c')][_0xd85c('0x37')](_0x53a943[_0xd85c('0x7d')](),{'type':db[_0xd85c('0x6c')][_0xd85c('0x7e')][_0xd85c('0x7f')]})['then'](function(_0x44d4e3){if(_0x44d4e3[_0xd85c('0x3d')]===0x1){return _0x8dd6e8['id'];}else{var _0x295fa9=_[_0xd85c('0x80')](_[_0xd85c('0x31')](_0x44d4e3,'TeamId'),function(_0x422fde){return _[_0xd85c('0x81')](_0xd3c328,_0x422fde);});if(_0x295fa9){return _0x8dd6e8['id'];}}}));}}return BPromise[_0xd85c('0x82')](_0x33ead7)['then'](function(_0x5cc993){_0x4434d5=_(_0x4434d5)[_0xd85c('0x83')](_0x5cc993)['compact']()[_0xd85c('0x84')]();return db[_0xd85c('0x32')][_0xd85c('0x4d')]({'where':{'id':_0x142a0e[_0xd85c('0x4c')]['id']}})[_0xd85c('0x26')](function(_0x13e591){return db[_0xd85c('0x6c')][_0xd85c('0x6d')](function(_0x9387aa){return _0x13e591[_0xd85c('0x72')](_0x142a0e[_0xd85c('0x37')]['ids'],{'transaction':_0x9387aa})[_0xd85c('0x26')](function(){if(!_[_0xd85c('0x85')](_0x4434d5)){return _0x13e591[_0xd85c('0x86')](_0x4434d5,{'transaction':_0x9387aa});}})[_0xd85c('0x26')](function(){_0x4434d5[_0xd85c('0x70')](function(_0x4c90f4){socket[_0xd85c('0x71')]('userOpenchannelQueue:remove',{'UserId':_0x4c90f4,'OpenchannelQueueId':_0x13e591['id']});});});});});});})[_0xd85c('0x26')](respondWithStatusCode(_0x3652a6,null))[_0xd85c('0x4a')](handleError(_0x3652a6,null));};exports['addAgents']=function(_0x546962,_0x148ed5,_0x3e1919){return db[_0xd85c('0x32')][_0xd85c('0x4d')]({'where':{'id':_0x546962['params']['id']}})['then'](handleEntityNotFound(_0x148ed5,null))[_0xd85c('0x26')](function(_0x44d084){if(_0x44d084){return _0x44d084[_0xd85c('0x87')](_0x546962[_0xd85c('0x54')][_0xd85c('0x65')],_[_0xd85c('0x88')](_0x546962['body'],[_0xd85c('0x65'),'id'])||{})[_0xd85c('0x89')](function(_0x1e0a1b){for(var _0x27ffe7=0x0;_0x27ffe7<_0x546962[_0xd85c('0x54')][_0xd85c('0x65')][_0xd85c('0x3d')];_0x27ffe7+=0x1){socket[_0xd85c('0x71')](_0xd85c('0x8a'),{'UserId':Number(_0x546962[_0xd85c('0x54')][_0xd85c('0x65')][_0x27ffe7]),'OpenchannelQueueId':Number(_0x546962[_0xd85c('0x4c')]['id'])});}return _0x1e0a1b;});}})[_0xd85c('0x26')](respondWithResult(_0x148ed5,null))['catch'](handleError(_0x148ed5,null));};exports['removeAgents']=function(_0x670c9b,_0x394e0a,_0x1cf95a){return db['OpenchannelQueue'][_0xd85c('0x4d')]({'where':{'id':_0x670c9b[_0xd85c('0x4c')]['id']}})[_0xd85c('0x26')](handleEntityNotFound(_0x394e0a,null))[_0xd85c('0x26')](function(_0x2ef0f2){if(_0x2ef0f2){return _0x2ef0f2[_0xd85c('0x86')](_0x670c9b[_0xd85c('0x37')][_0xd85c('0x65')])[_0xd85c('0x26')](function(){if(_[_0xd85c('0x8b')](_0x670c9b['query'][_0xd85c('0x65')])){for(var _0x84b96=0x0;_0x84b96<_0x670c9b[_0xd85c('0x37')][_0xd85c('0x65')]['length'];_0x84b96+=0x1){socket['emit'](_0xd85c('0x8c'),{'UserId':Number(_0x670c9b[_0xd85c('0x37')]['ids'][_0x84b96]),'OpenchannelQueueId':Number(_0x670c9b[_0xd85c('0x4c')]['id'])});}}else{socket['emit'](_0xd85c('0x8c'),{'UserId':Number(_0x670c9b[_0xd85c('0x37')][_0xd85c('0x65')]),'OpenchannelQueueId':Number(_0x670c9b['params']['id'])});}});}})['then'](respondWithStatusCode(_0x394e0a,null))['catch'](handleError(_0x394e0a,null));};exports[_0xd85c('0x8d')]=function(_0x1fad6e,_0x14553b,_0x54f069){var _0x308c47={};var _0x2bcdfd={};var _0x54a086;var _0x31b7ff;return db[_0xd85c('0x32')][_0xd85c('0x57')]({'where':{'id':_0x1fad6e[_0xd85c('0x4c')]['id']}})[_0xd85c('0x26')](handleEntityNotFound(_0x14553b,null))['then'](function(_0x27ca78){if(_0x27ca78){_0x54a086=_0x27ca78;_0x2bcdfd[_0xd85c('0x36')]=_[_0xd85c('0x38')](db['User'][_0xd85c('0x33')]);_0x2bcdfd[_0xd85c('0x37')]=_[_0xd85c('0x38')](_0x1fad6e[_0xd85c('0x37')]);_0x2bcdfd[_0xd85c('0x39')]=_['intersection'](_0x2bcdfd[_0xd85c('0x36')],_0x2bcdfd[_0xd85c('0x37')]);_0x308c47[_0xd85c('0x3a')]=_[_0xd85c('0x3b')](_0x2bcdfd['model'],qs[_0xd85c('0x3c')](_0x1fad6e[_0xd85c('0x37')]['fields']));_0x308c47['attributes']=_0x308c47[_0xd85c('0x3a')][_0xd85c('0x3d')]?_0x308c47['attributes']:_0x2bcdfd[_0xd85c('0x36')];_0x308c47[_0xd85c('0x62')]=qs['sort'](_0x1fad6e[_0xd85c('0x37')]['sort']);_0x308c47['where']=qs[_0xd85c('0x39')](_[_0xd85c('0x41')](_0x1fad6e[_0xd85c('0x37')],_0x2bcdfd[_0xd85c('0x39')]));if(_0x1fad6e[_0xd85c('0x37')][_0xd85c('0x44')]){_0x308c47[_0xd85c('0x40')]=_[_0xd85c('0x42')](_0x308c47[_0xd85c('0x40')],{'$or':_[_0xd85c('0x31')](_0x308c47[_0xd85c('0x3a')],function(_0x3dc86e){var _0x91a672={};_0x91a672[_0x3dc86e]={'$like':'%'+_0x1fad6e['query'][_0xd85c('0x44')]+'%'};return _0x91a672;})});}_0x308c47=_['merge']({},_0x308c47,_0x1fad6e[_0xd85c('0x45')]);return _0x54a086[_0xd85c('0x8d')](_0x308c47);}})[_0xd85c('0x26')](function(_0x13f24d){if(_0x13f24d){_0x31b7ff=_0x13f24d[_0xd85c('0x3d')];if(!_0x1fad6e[_0xd85c('0x37')][_0xd85c('0x3e')](_0xd85c('0x63'))){_0x308c47['limit']=qs[_0xd85c('0x1f')](_0x1fad6e[_0xd85c('0x37')]['limit']);_0x308c47['offset']=qs[_0xd85c('0x1d')](_0x1fad6e['query'][_0xd85c('0x1d')]);}return _0x54a086[_0xd85c('0x8d')](_0x308c47);}})['then'](function(_0x572536){if(_0x572536){return _0x572536?{'count':_0x31b7ff,'rows':_0x572536}:null;}})[_0xd85c('0x26')](respondWithResult(_0x14553b,null))[_0xd85c('0x4a')](handleError(_0x14553b,null));}; \ No newline at end of file +var _0xd0bc=['intersection','attributes','fields','length','nolimit','order','sort','filters','pick','where','merge','VIRTUAL','options','includeAll','include','OpenchannelQueue','findAll','show','params','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','OpenchannelQueueId','filter','UserOpenchannelQueue','User','UserId','agent','updatedAt','createdAt','SIP','getTeams','findOne','Team','hasOwnProperty','addTeams','Agents','online','voicePause','flatMap','sequelize','transaction','each','findOrCreate','emit','ids','select','field','from','team_has_openchannel_queues','join','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','includes','all','union','isEmpty','removeAgents','forEach','userOpenchannelQueue:remove','addAgents','userOpenchannelQueue:save','isArray','getAgents','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','redis','localhost','socket.io-emitter','./openchannelQueue.socket','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','OpenchannelQueues','UserProfileResource','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys'];(function(_0x1ac562,_0x270a2d){var _0x483610=function(_0x1eb389){while(--_0x1eb389){_0x1ac562['push'](_0x1ac562['shift']());}};_0x483610(++_0x270a2d);}(_0xd0bc,0xd6));var _0xcd0b=function(_0x59fc33,_0x2e182d){_0x59fc33=_0x59fc33-0x0;var _0x39066f=_0xd0bc[_0x59fc33];return _0x39066f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xcd0b('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcd0b('0x1'));var moment=require(_0xcd0b('0x2'));var BPromise=require(_0xcd0b('0x3'));var Mustache=require(_0xcd0b('0x4'));var util=require(_0xcd0b('0x5'));var path=require(_0xcd0b('0x6'));var sox=require(_0xcd0b('0x7'));var csv=require(_0xcd0b('0x8'));var ejs=require(_0xcd0b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcd0b('0xa'));var squel=require(_0xcd0b('0xb'));var crypto=require(_0xcd0b('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xcd0b('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xcd0b('0xe'));var Redis=require(_0xcd0b('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xcd0b('0x10'));var as=require(_0xcd0b('0x11'));var hardwareService=require(_0xcd0b('0x12'));var logger=require('../../config/logger')(_0xcd0b('0x13'));var utils=require(_0xcd0b('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xcd0b('0x15'));var db=require('../../mysqldb')['db'];config[_0xcd0b('0x16')]=_['defaults'](config['redis'],{'host':_0xcd0b('0x17'),'port':0x18eb});var socket=require(_0xcd0b('0x18'))(new Redis(config[_0xcd0b('0x16')]));require(_0xcd0b('0x19'))['register'](socket);function respondWithStatusCode(_0x184b94,_0x60652f){_0x60652f=_0x60652f||0xcc;return function(_0x275f58){if(_0x275f58){return _0x184b94['sendStatus'](_0x60652f);}return _0x184b94['status'](_0x60652f)['end']();};}function respondWithResult(_0x2e97b9,_0x25fb34){_0x25fb34=_0x25fb34||0xc8;return function(_0x458151){if(_0x458151){return _0x2e97b9[_0xcd0b('0x1a')](_0x25fb34)[_0xcd0b('0x1b')](_0x458151);}};}function respondWithFilteredResult(_0x4c97a2,_0x3d485e){return function(_0x39988c){if(_0x39988c){var _0x187732=typeof _0x3d485e['offset']===_0xcd0b('0x1c')&&typeof _0x3d485e[_0xcd0b('0x1d')]==='undefined';var _0x2b27de=_0x39988c[_0xcd0b('0x1e')];var _0x15678b=_0x187732?0x0:_0x3d485e['offset'];var _0x961ce9=_0x187732?_0x39988c[_0xcd0b('0x1e')]:_0x3d485e[_0xcd0b('0x1f')]+_0x3d485e[_0xcd0b('0x1d')];var _0x4d4df5;if(_0x961ce9>=_0x2b27de){_0x961ce9=_0x2b27de;_0x4d4df5=0xc8;}else{_0x4d4df5=0xce;}_0x4c97a2[_0xcd0b('0x1a')](_0x4d4df5);return _0x4c97a2[_0xcd0b('0x20')](_0xcd0b('0x21'),_0x15678b+'-'+_0x961ce9+'/'+_0x2b27de)[_0xcd0b('0x1b')](_0x39988c);}return null;};}function patchUpdates(_0x444b69){return function(_0x14850d){try{jsonpatch[_0xcd0b('0x22')](_0x14850d,_0x444b69,!![]);}catch(_0x936e7a){return BPromise[_0xcd0b('0x23')](_0x936e7a);}return _0x14850d[_0xcd0b('0x24')]();};}function saveUpdates(_0x46a149,_0x10b3c8){return function(_0x3a7b86){if(_0x3a7b86){return _0x3a7b86[_0xcd0b('0x25')](_0x46a149)[_0xcd0b('0x26')](function(_0x5e0824){return _0x5e0824;});}return null;};}function removeEntity(_0x1aeaa0,_0x505a0a){return function(_0x16f622){if(_0x16f622){return _0x16f622[_0xcd0b('0x27')]()[_0xcd0b('0x26')](function(){var _0x31f9dd=_0x16f622['get']({'plain':!![]});var _0x5c4d5b=_0xcd0b('0x28');return db[_0xcd0b('0x29')][_0xcd0b('0x27')]({'where':{'type':_0x5c4d5b,'resourceId':_0x31f9dd['id']}})[_0xcd0b('0x26')](function(){return _0x16f622;});})[_0xcd0b('0x26')](function(){_0x1aeaa0[_0xcd0b('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f37eb,_0x460b3f){return function(_0x3f2a32){if(!_0x3f2a32){_0x1f37eb[_0xcd0b('0x2a')](0x194);}return _0x3f2a32;};}function handleError(_0x22669e,_0x1304c8){_0x1304c8=_0x1304c8||0x1f4;return function(_0x3e179b){logger[_0xcd0b('0x2b')](_0x3e179b[_0xcd0b('0x2c')]);if(_0x3e179b[_0xcd0b('0x2d')]){delete _0x3e179b[_0xcd0b('0x2d')];}_0x22669e['status'](_0x1304c8)[_0xcd0b('0x2e')](_0x3e179b);};}exports[_0xcd0b('0x2f')]=function(_0x1c1f50,_0x4bf4c3){var _0x134b37={},_0x375efa={},_0x35a519={'count':0x0,'rows':[]};var _0x24b08a=_[_0xcd0b('0x30')](db['OpenchannelQueue'][_0xcd0b('0x31')],function(_0x580f84){return{'name':_0x580f84[_0xcd0b('0x32')],'type':_0x580f84[_0xcd0b('0x33')][_0xcd0b('0x34')]};});_0x375efa[_0xcd0b('0x35')]=_[_0xcd0b('0x30')](_0x24b08a,_0xcd0b('0x2d'));_0x375efa[_0xcd0b('0x36')]=_[_0xcd0b('0x37')](_0x1c1f50[_0xcd0b('0x36')]);_0x375efa['filters']=_[_0xcd0b('0x38')](_0x375efa[_0xcd0b('0x35')],_0x375efa[_0xcd0b('0x36')]);_0x134b37[_0xcd0b('0x39')]=_[_0xcd0b('0x38')](_0x375efa[_0xcd0b('0x35')],qs[_0xcd0b('0x3a')](_0x1c1f50[_0xcd0b('0x36')][_0xcd0b('0x3a')]));_0x134b37[_0xcd0b('0x39')]=_0x134b37[_0xcd0b('0x39')][_0xcd0b('0x3b')]?_0x134b37[_0xcd0b('0x39')]:_0x375efa['model'];if(!_0x1c1f50[_0xcd0b('0x36')]['hasOwnProperty'](_0xcd0b('0x3c'))){_0x134b37[_0xcd0b('0x1d')]=qs[_0xcd0b('0x1d')](_0x1c1f50[_0xcd0b('0x36')][_0xcd0b('0x1d')]);_0x134b37[_0xcd0b('0x1f')]=qs[_0xcd0b('0x1f')](_0x1c1f50['query'][_0xcd0b('0x1f')]);}_0x134b37[_0xcd0b('0x3d')]=qs[_0xcd0b('0x3e')](_0x1c1f50[_0xcd0b('0x36')][_0xcd0b('0x3e')]);_0x134b37['where']=qs[_0xcd0b('0x3f')](_[_0xcd0b('0x40')](_0x1c1f50['query'],_0x375efa[_0xcd0b('0x3f')]),_0x24b08a);if(_0x1c1f50[_0xcd0b('0x36')]['filter']){_0x134b37[_0xcd0b('0x41')]=_[_0xcd0b('0x42')](_0x134b37['where'],{'$or':_[_0xcd0b('0x30')](_0x24b08a,function(_0x17f00a){if(_0x17f00a[_0xcd0b('0x33')]!==_0xcd0b('0x43')){var _0x49ed71={};_0x49ed71[_0x17f00a['name']]={'$like':'%'+_0x1c1f50[_0xcd0b('0x36')]['filter']+'%'};return _0x49ed71;}})});}_0x134b37=_[_0xcd0b('0x42')]({},_0x134b37,_0x1c1f50[_0xcd0b('0x44')]);var _0x239901={'where':_0x134b37[_0xcd0b('0x41')]};return db['OpenchannelQueue']['count'](_0x239901)[_0xcd0b('0x26')](function(_0x3cfb17){_0x35a519[_0xcd0b('0x1e')]=_0x3cfb17;if(_0x1c1f50['query'][_0xcd0b('0x45')]){_0x134b37[_0xcd0b('0x46')]=[{'all':!![]}];}return db[_0xcd0b('0x47')][_0xcd0b('0x48')](_0x134b37);})[_0xcd0b('0x26')](function(_0x17ea82){_0x35a519['rows']=_0x17ea82;return _0x35a519;})['then'](respondWithFilteredResult(_0x4bf4c3,_0x134b37))['catch'](handleError(_0x4bf4c3,null));};exports[_0xcd0b('0x49')]=function(_0x5a6cc6,_0x368603){var _0x1fa64e={'raw':!![],'where':{'id':_0x5a6cc6[_0xcd0b('0x4a')]['id']}},_0xfa2c01={};_0xfa2c01['model']=_[_0xcd0b('0x37')](db['OpenchannelQueue'][_0xcd0b('0x31')]);_0xfa2c01['query']=_[_0xcd0b('0x37')](_0x5a6cc6['query']);_0xfa2c01['filters']=_[_0xcd0b('0x38')](_0xfa2c01[_0xcd0b('0x35')],_0xfa2c01[_0xcd0b('0x36')]);_0x1fa64e[_0xcd0b('0x39')]=_[_0xcd0b('0x38')](_0xfa2c01[_0xcd0b('0x35')],qs[_0xcd0b('0x3a')](_0x5a6cc6[_0xcd0b('0x36')][_0xcd0b('0x3a')]));_0x1fa64e[_0xcd0b('0x39')]=_0x1fa64e[_0xcd0b('0x39')][_0xcd0b('0x3b')]?_0x1fa64e[_0xcd0b('0x39')]:_0xfa2c01['model'];if(_0x5a6cc6[_0xcd0b('0x36')]['includeAll']){_0x1fa64e['include']=[{'all':!![]}];}_0x1fa64e=_[_0xcd0b('0x42')]({},_0x1fa64e,_0x5a6cc6[_0xcd0b('0x44')]);return db[_0xcd0b('0x47')][_0xcd0b('0x4b')](_0x1fa64e)[_0xcd0b('0x26')](handleEntityNotFound(_0x368603,null))[_0xcd0b('0x26')](respondWithResult(_0x368603,null))[_0xcd0b('0x4c')](handleError(_0x368603,null));};exports[_0xcd0b('0x4d')]=function(_0xdb92a4,_0x197fe5){return db['OpenchannelQueue'][_0xcd0b('0x4d')](_0xdb92a4[_0xcd0b('0x4e')],{})[_0xcd0b('0x26')](function(_0x105e1c){var _0x27c00b=_0xdb92a4[_0xcd0b('0x4f')][_0xcd0b('0x50')]({'plain':!![]});if(!_0x27c00b)throw new Error(_0xcd0b('0x51'));if(_0x27c00b['role']===_0xcd0b('0x4f')){var _0x3c8ff8=_0x105e1c[_0xcd0b('0x50')]({'plain':!![]});var _0x24f37d='OpenchannelQueues';return db[_0xcd0b('0x52')]['find']({'where':{'name':_0x24f37d,'userProfileId':_0x27c00b[_0xcd0b('0x53')]},'raw':!![]})['then'](function(_0x2c9c80){if(_0x2c9c80&&_0x2c9c80[_0xcd0b('0x54')]===0x0){return db[_0xcd0b('0x29')][_0xcd0b('0x4d')]({'name':_0x3c8ff8[_0xcd0b('0x2d')],'resourceId':_0x3c8ff8['id'],'type':_0x2c9c80[_0xcd0b('0x2d')],'sectionId':_0x2c9c80['id']},{})[_0xcd0b('0x26')](function(){return _0x105e1c;});}else{return _0x105e1c;}})['catch'](function(_0x592329){logger[_0xcd0b('0x2b')](_0xcd0b('0x55'),_0x592329);throw _0x592329;});}return _0x105e1c;})[_0xcd0b('0x26')](respondWithResult(_0x197fe5,0xc9))[_0xcd0b('0x4c')](handleError(_0x197fe5,null));};exports[_0xcd0b('0x25')]=function(_0x434a9f,_0x47c72f){if(_0x434a9f['body']['id']){delete _0x434a9f[_0xcd0b('0x4e')]['id'];}return db[_0xcd0b('0x47')]['find']({'where':{'id':_0x434a9f['params']['id']}})[_0xcd0b('0x26')](handleEntityNotFound(_0x47c72f,null))[_0xcd0b('0x26')](saveUpdates(_0x434a9f['body'],null))[_0xcd0b('0x26')](respondWithResult(_0x47c72f,null))[_0xcd0b('0x4c')](handleError(_0x47c72f,null));};exports[_0xcd0b('0x27')]=function(_0x24081a,_0x382d53){return db[_0xcd0b('0x47')][_0xcd0b('0x4b')]({'where':{'id':_0x24081a[_0xcd0b('0x4a')]['id']}})[_0xcd0b('0x26')](handleEntityNotFound(_0x382d53,null))['then'](removeEntity(_0x382d53,null))[_0xcd0b('0x4c')](handleError(_0x382d53,null));};exports['describe']=function(_0xba1016,_0x57d53c){return db['OpenchannelQueue'][_0xcd0b('0x56')]()[_0xcd0b('0x26')](respondWithResult(_0x57d53c,null))[_0xcd0b('0x4c')](handleError(_0x57d53c,null));};exports['getMembers']=function(_0x9aa0b0,_0x209b2f,_0x52a0b4){var _0x10cd09={'raw':!![],'where':{}},_0x3ad178={},_0x35efc0;return db[_0xcd0b('0x47')]['findOne']({'where':{'id':_0x9aa0b0[_0xcd0b('0x4a')]['id']}})[_0xcd0b('0x26')](handleEntityNotFound(_0x209b2f,null))['then'](function(_0x40a32d){if(_0x40a32d){_0x35efc0=_0x40a32d[_0xcd0b('0x50')]({'plain':!![]});_0x3ad178[_0xcd0b('0x35')]=_[_0xcd0b('0x37')](db['UserOpenchannelQueue'][_0xcd0b('0x31')]);_0x3ad178[_0xcd0b('0x36')]=_[_0xcd0b('0x37')](_0x9aa0b0[_0xcd0b('0x36')]);_0x3ad178['filters']=_['intersection'](_0x3ad178['model'],_0x3ad178['query']);_0x10cd09[_0xcd0b('0x39')]=_[_0xcd0b('0x38')](_0x3ad178[_0xcd0b('0x35')],qs['fields'](_0x9aa0b0[_0xcd0b('0x36')]['fields']));_0x10cd09[_0xcd0b('0x39')]=_0x10cd09[_0xcd0b('0x39')][_0xcd0b('0x3b')]?_0x10cd09[_0xcd0b('0x39')]:_0x3ad178[_0xcd0b('0x35')];if(!_0x9aa0b0[_0xcd0b('0x36')]['hasOwnProperty'](_0xcd0b('0x3c'))){_0x10cd09[_0xcd0b('0x1d')]=qs[_0xcd0b('0x1d')](_0x9aa0b0[_0xcd0b('0x36')]['limit']);_0x10cd09[_0xcd0b('0x1f')]=qs[_0xcd0b('0x1f')](_0x9aa0b0[_0xcd0b('0x36')][_0xcd0b('0x1f')]);}_0x10cd09[_0xcd0b('0x3d')]=qs[_0xcd0b('0x3e')](_0x9aa0b0['query'][_0xcd0b('0x3e')]);_0x10cd09[_0xcd0b('0x41')]=qs['filters'](_[_0xcd0b('0x40')](_0x9aa0b0['query'],_0x3ad178[_0xcd0b('0x3f')]));_0x10cd09[_0xcd0b('0x41')][_0xcd0b('0x57')]=_0x40a32d['id'];if(_0x9aa0b0['query'][_0xcd0b('0x58')]){_0x10cd09['where']=_[_0xcd0b('0x42')](_0x10cd09[_0xcd0b('0x41')],{'$or':_['map'](_0x10cd09[_0xcd0b('0x39')],function(_0x19ff64){var _0xc7d39={};_0xc7d39[_0x19ff64]={'$like':'%'+_0x9aa0b0[_0xcd0b('0x36')][_0xcd0b('0x58')]+'%'};return _0xc7d39;})});}_0x10cd09=_['merge']({},_0x10cd09,_0x9aa0b0['options']);return db[_0xcd0b('0x59')]['findAll'](_0x10cd09);}})[_0xcd0b('0x26')](function(_0x1571de){if(_0x1571de){return db[_0xcd0b('0x5a')]['findAndCountAll']({'where':{'id':_[_0xcd0b('0x30')](_0x1571de,_0xcd0b('0x5b')),'role':_0xcd0b('0x5c')},'attributes':['id',_0xcd0b('0x2d'),'openchannelPause',_0xcd0b('0x5d'),_0xcd0b('0x5e')]});}})[_0xcd0b('0x26')](function(_0x295bfc){if(_0x295bfc){return{'count':_0x295bfc[_0xcd0b('0x1e')],'rows':_['map'](_0x295bfc['rows'],function(_0x59a9f5){return{'membername':_0x59a9f5[_0xcd0b('0x2d')],'UserId':_0x59a9f5['id'],'queue_name':_0x35efc0[_0xcd0b('0x2d')],'OpenchannelQueueId':_0x35efc0['id'],'interface':util['format']('%s/%s',_0xcd0b('0x5f'),_0x59a9f5[_0xcd0b('0x2d')]),'penalty':0x0,'paused':_0x59a9f5['openchannelPause'],'createdAt':_0x59a9f5[_0xcd0b('0x5e')],'updatedAt':_0x59a9f5[_0xcd0b('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xcd0b('0x26')](respondWithFilteredResult(_0x209b2f,_0x10cd09))[_0xcd0b('0x4c')](handleError(_0x209b2f,null));};exports[_0xcd0b('0x60')]=function(_0x4707f9,_0x20f059,_0x378cef){var _0x18bffb={};var _0x1b8a4b={};var _0x10ddd4;var _0x95e607;return db['OpenchannelQueue'][_0xcd0b('0x61')]({'where':{'id':_0x4707f9[_0xcd0b('0x4a')]['id']}})[_0xcd0b('0x26')](handleEntityNotFound(_0x20f059,null))['then'](function(_0x3940a7){if(_0x3940a7){_0x10ddd4=_0x3940a7;_0x1b8a4b['model']=_['keys'](db[_0xcd0b('0x62')]['rawAttributes']);_0x1b8a4b[_0xcd0b('0x36')]=_[_0xcd0b('0x37')](_0x4707f9[_0xcd0b('0x36')]);_0x1b8a4b['filters']=_[_0xcd0b('0x38')](_0x1b8a4b[_0xcd0b('0x35')],_0x1b8a4b[_0xcd0b('0x36')]);_0x18bffb[_0xcd0b('0x39')]=_['intersection'](_0x1b8a4b[_0xcd0b('0x35')],qs['fields'](_0x4707f9[_0xcd0b('0x36')][_0xcd0b('0x3a')]));_0x18bffb['attributes']=_0x18bffb[_0xcd0b('0x39')][_0xcd0b('0x3b')]?_0x18bffb[_0xcd0b('0x39')]:_0x1b8a4b[_0xcd0b('0x35')];_0x18bffb[_0xcd0b('0x3d')]=qs[_0xcd0b('0x3e')](_0x4707f9[_0xcd0b('0x36')][_0xcd0b('0x3e')]);_0x18bffb[_0xcd0b('0x41')]=qs['filters'](_['pick'](_0x4707f9[_0xcd0b('0x36')],_0x1b8a4b[_0xcd0b('0x3f')]));if(_0x4707f9[_0xcd0b('0x36')][_0xcd0b('0x58')]){_0x18bffb[_0xcd0b('0x41')]=_['merge'](_0x18bffb[_0xcd0b('0x41')],{'$or':_['map'](_0x18bffb['attributes'],function(_0x817ea5){var _0x372aa6={};_0x372aa6[_0x817ea5]={'$like':'%'+_0x4707f9[_0xcd0b('0x36')][_0xcd0b('0x58')]+'%'};return _0x372aa6;})});}_0x18bffb=_[_0xcd0b('0x42')]({},_0x18bffb,_0x4707f9[_0xcd0b('0x44')]);return _0x10ddd4[_0xcd0b('0x60')](_0x18bffb);}})[_0xcd0b('0x26')](function(_0x9afbfe){if(_0x9afbfe){_0x95e607=_0x9afbfe['length'];if(!_0x4707f9[_0xcd0b('0x36')][_0xcd0b('0x63')]('nolimit')){_0x18bffb[_0xcd0b('0x1d')]=qs[_0xcd0b('0x1d')](_0x4707f9[_0xcd0b('0x36')]['limit']);_0x18bffb[_0xcd0b('0x1f')]=qs[_0xcd0b('0x1f')](_0x4707f9[_0xcd0b('0x36')][_0xcd0b('0x1f')]);}return _0x10ddd4[_0xcd0b('0x60')](_0x18bffb);}})[_0xcd0b('0x26')](function(_0x38c046){if(_0x38c046){return _0x38c046?{'count':_0x95e607,'rows':_0x38c046}:null;}})[_0xcd0b('0x26')](respondWithResult(_0x20f059,null))[_0xcd0b('0x4c')](handleError(_0x20f059,null));};exports[_0xcd0b('0x64')]=function(_0x182bef,_0x5bc054,_0x171f29){var _0x4be6df=_0x182bef[_0xcd0b('0x4e')]['ids'];return db[_0xcd0b('0x62')][_0xcd0b('0x48')]({'where':{'id':_0x4be6df},'attributes':['id'],'include':[{'model':db[_0xcd0b('0x5a')],'as':_0xcd0b('0x65'),'attributes':['id',_0xcd0b('0x2d'),_0xcd0b('0x66'),_0xcd0b('0x67'),'interface'],'raw':!![]}]})[_0xcd0b('0x26')](function(_0x451f35){if(_0x451f35){var _0x367f6d=_[_0xcd0b('0x68')](_0x451f35,function(_0xd64738){var _0x494e3f=_0xd64738[_0xcd0b('0x50')]({'plain':!![]});return _0x494e3f[_0xcd0b('0x65')];});return db[_0xcd0b('0x47')][_0xcd0b('0x4b')]({'where':{'id':_0x182bef[_0xcd0b('0x4a')]['id']}})[_0xcd0b('0x26')](function(_0x5e3656){return db[_0xcd0b('0x69')][_0xcd0b('0x6a')](function(_0x583a63){return _0x5e3656['addTeams'](_0x4be6df,{'transaction':_0x583a63})[_0xcd0b('0x26')](function(){return BPromise[_0xcd0b('0x6b')](_0x367f6d,function(_0xb3ca1d){return db[_0xcd0b('0x59')][_0xcd0b('0x6c')]({'where':{'UserId':_0xb3ca1d['id'],'OpenchannelQueueId':_0x182bef[_0xcd0b('0x4a')]['id']},'transaction':_0x583a63});});})[_0xcd0b('0x26')](function(){_0x367f6d['forEach'](function(_0x3e88fa){socket[_0xcd0b('0x6d')]('userOpenchannelQueue:save',{'UserId':_0x3e88fa['id'],'OpenchannelQueueId':_0x5e3656['id']});});});});});}})[_0xcd0b('0x26')](respondWithStatusCode(_0x5bc054,null))[_0xcd0b('0x4c')](handleError(_0x5bc054,null));};exports['removeTeams']=function(_0x5b001c,_0x5ceab1,_0x3b4832){return db[_0xcd0b('0x62')][_0xcd0b('0x48')]({'where':{'id':_0x5b001c['query'][_0xcd0b('0x6e')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5ceab1,null))[_0xcd0b('0x26')](function(_0x250c6c){var _0x330ff8=_['map'](_0x250c6c,'id');var _0x419cb6=[];var _0xf69f79=[];var _0x24822e=squel[_0xcd0b('0x6f')]();_0x24822e[_0xcd0b('0x70')]('tq.TeamId')[_0xcd0b('0x71')](_0xcd0b('0x72'),'tq')[_0xcd0b('0x73')]('user_has_teams','ut',_0xcd0b('0x74'))[_0xcd0b('0x41')](_0xcd0b('0x75'),_0x5b001c[_0xcd0b('0x4a')]['id']);for(var _0x3f2f65=0x0;_0x3f2f65<_0x250c6c[_0xcd0b('0x3b')];_0x3f2f65+=0x1){let _0x4c52db=_0x250c6c[_0x3f2f65];for(var _0x2edafe=0x0;_0x2edafe<_0x4c52db[_0xcd0b('0x65')][_0xcd0b('0x3b')];_0x2edafe+=0x1){let _0x19f4e9=_0x4c52db['Agents'][_0x2edafe];var _0x413cf8=_0x24822e[_0xcd0b('0x76')]();_0x413cf8['where'](_0xcd0b('0x77'),_0x19f4e9['id']);_0xf69f79[_0xcd0b('0x78')](db[_0xcd0b('0x69')][_0xcd0b('0x36')](_0x413cf8[_0xcd0b('0x79')](),{'type':db['sequelize'][_0xcd0b('0x7a')]['SELECT']})[_0xcd0b('0x26')](function(_0x31d3fa){if(_0x31d3fa[_0xcd0b('0x3b')]===0x1){return _0x19f4e9['id'];}else{var _0x5e0d65=_[_0xcd0b('0x7b')](_[_0xcd0b('0x30')](_0x31d3fa,'TeamId'),function(_0x2cfe4b){return _[_0xcd0b('0x7c')](_0x330ff8,_0x2cfe4b);});if(_0x5e0d65){return _0x19f4e9['id'];}}}));}}return BPromise[_0xcd0b('0x7d')](_0xf69f79)[_0xcd0b('0x26')](function(_0x4884aa){_0x419cb6=_(_0x419cb6)[_0xcd0b('0x7e')](_0x4884aa)['compact']()['value']();return db['OpenchannelQueue'][_0xcd0b('0x4b')]({'where':{'id':_0x5b001c['params']['id']}})[_0xcd0b('0x26')](function(_0x21577b){return db['sequelize'][_0xcd0b('0x6a')](function(_0x50015d){return _0x21577b['removeTeams'](_0x5b001c[_0xcd0b('0x36')]['ids'],{'transaction':_0x50015d})[_0xcd0b('0x26')](function(){if(!_[_0xcd0b('0x7f')](_0x419cb6)){return _0x21577b[_0xcd0b('0x80')](_0x419cb6,{'transaction':_0x50015d});}})[_0xcd0b('0x26')](function(){_0x419cb6[_0xcd0b('0x81')](function(_0x38db56){socket[_0xcd0b('0x6d')](_0xcd0b('0x82'),{'UserId':_0x38db56,'OpenchannelQueueId':_0x21577b['id']});});});});});});})[_0xcd0b('0x26')](respondWithStatusCode(_0x5ceab1,null))[_0xcd0b('0x4c')](handleError(_0x5ceab1,null));};exports[_0xcd0b('0x83')]=function(_0x153cb0,_0x57aa7c,_0x1616e3){return db[_0xcd0b('0x47')]['find']({'where':{'id':_0x153cb0[_0xcd0b('0x4a')]['id']}})[_0xcd0b('0x26')](handleEntityNotFound(_0x57aa7c,null))[_0xcd0b('0x26')](function(_0x13af04){if(_0x13af04){return _0x13af04['addAgents'](_0x153cb0[_0xcd0b('0x4e')][_0xcd0b('0x6e')],_['omit'](_0x153cb0[_0xcd0b('0x4e')],[_0xcd0b('0x6e'),'id'])||{})['spread'](function(_0x59d84c){for(var _0x378f89=0x0;_0x378f89<_0x153cb0['body'][_0xcd0b('0x6e')][_0xcd0b('0x3b')];_0x378f89+=0x1){socket[_0xcd0b('0x6d')](_0xcd0b('0x84'),{'UserId':Number(_0x153cb0[_0xcd0b('0x4e')][_0xcd0b('0x6e')][_0x378f89]),'OpenchannelQueueId':Number(_0x153cb0[_0xcd0b('0x4a')]['id'])});}return _0x59d84c;});}})[_0xcd0b('0x26')](respondWithResult(_0x57aa7c,null))[_0xcd0b('0x4c')](handleError(_0x57aa7c,null));};exports[_0xcd0b('0x80')]=function(_0x2dbb35,_0x50ddb8,_0x4b63ae){return db[_0xcd0b('0x47')][_0xcd0b('0x4b')]({'where':{'id':_0x2dbb35['params']['id']}})['then'](handleEntityNotFound(_0x50ddb8,null))[_0xcd0b('0x26')](function(_0x3ccd22){if(_0x3ccd22){return _0x3ccd22['removeAgents'](_0x2dbb35[_0xcd0b('0x36')]['ids'])[_0xcd0b('0x26')](function(){if(_[_0xcd0b('0x85')](_0x2dbb35[_0xcd0b('0x36')]['ids'])){for(var _0x24634c=0x0;_0x24634c<_0x2dbb35['query'][_0xcd0b('0x6e')][_0xcd0b('0x3b')];_0x24634c+=0x1){socket[_0xcd0b('0x6d')](_0xcd0b('0x82'),{'UserId':Number(_0x2dbb35[_0xcd0b('0x36')]['ids'][_0x24634c]),'OpenchannelQueueId':Number(_0x2dbb35[_0xcd0b('0x4a')]['id'])});}}else{socket[_0xcd0b('0x6d')]('userOpenchannelQueue:remove',{'UserId':Number(_0x2dbb35['query'][_0xcd0b('0x6e')]),'OpenchannelQueueId':Number(_0x2dbb35['params']['id'])});}});}})['then'](respondWithStatusCode(_0x50ddb8,null))[_0xcd0b('0x4c')](handleError(_0x50ddb8,null));};exports[_0xcd0b('0x86')]=function(_0x2bb02b,_0x5b68a3,_0x3ad311){var _0x57c5d6={};var _0x4dc8ce={};var _0x258788;var _0x1948f6;return db[_0xcd0b('0x47')][_0xcd0b('0x61')]({'where':{'id':_0x2bb02b[_0xcd0b('0x4a')]['id']}})[_0xcd0b('0x26')](handleEntityNotFound(_0x5b68a3,null))[_0xcd0b('0x26')](function(_0x1efeb9){if(_0x1efeb9){_0x258788=_0x1efeb9;_0x4dc8ce[_0xcd0b('0x35')]=_[_0xcd0b('0x37')](db[_0xcd0b('0x5a')][_0xcd0b('0x31')]);_0x4dc8ce['query']=_[_0xcd0b('0x37')](_0x2bb02b[_0xcd0b('0x36')]);_0x4dc8ce[_0xcd0b('0x3f')]=_[_0xcd0b('0x38')](_0x4dc8ce[_0xcd0b('0x35')],_0x4dc8ce[_0xcd0b('0x36')]);_0x57c5d6['attributes']=_['intersection'](_0x4dc8ce['model'],qs[_0xcd0b('0x3a')](_0x2bb02b[_0xcd0b('0x36')]['fields']));_0x57c5d6['attributes']=_0x57c5d6[_0xcd0b('0x39')]['length']?_0x57c5d6[_0xcd0b('0x39')]:_0x4dc8ce[_0xcd0b('0x35')];_0x57c5d6[_0xcd0b('0x3d')]=qs[_0xcd0b('0x3e')](_0x2bb02b['query'][_0xcd0b('0x3e')]);_0x57c5d6['where']=qs[_0xcd0b('0x3f')](_[_0xcd0b('0x40')](_0x2bb02b[_0xcd0b('0x36')],_0x4dc8ce[_0xcd0b('0x3f')]));if(_0x2bb02b[_0xcd0b('0x36')]['filter']){_0x57c5d6[_0xcd0b('0x41')]=_['merge'](_0x57c5d6[_0xcd0b('0x41')],{'$or':_['map'](_0x57c5d6['attributes'],function(_0xe06119){var _0x5a6fe5={};_0x5a6fe5[_0xe06119]={'$like':'%'+_0x2bb02b[_0xcd0b('0x36')][_0xcd0b('0x58')]+'%'};return _0x5a6fe5;})});}_0x57c5d6=_[_0xcd0b('0x42')]({},_0x57c5d6,_0x2bb02b[_0xcd0b('0x44')]);return _0x258788[_0xcd0b('0x86')](_0x57c5d6);}})[_0xcd0b('0x26')](function(_0x310512){if(_0x310512){_0x1948f6=_0x310512[_0xcd0b('0x3b')];if(!_0x2bb02b[_0xcd0b('0x36')]['hasOwnProperty']('nolimit')){_0x57c5d6[_0xcd0b('0x1d')]=qs['limit'](_0x2bb02b[_0xcd0b('0x36')][_0xcd0b('0x1d')]);_0x57c5d6['offset']=qs['offset'](_0x2bb02b[_0xcd0b('0x36')][_0xcd0b('0x1f')]);}return _0x258788['getAgents'](_0x57c5d6);}})[_0xcd0b('0x26')](function(_0x336949){if(_0x336949){return _0x336949?{'count':_0x1948f6,'rows':_0x336949}:null;}})[_0xcd0b('0x26')](respondWithResult(_0x5b68a3,null))[_0xcd0b('0x4c')](handleError(_0x5b68a3,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index a383ffa..bc9bc59 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 _0x3ebd=['save','emit','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x5c4c10,_0xb1a77b){var _0x4d145e=function(_0x313b8a){while(--_0x313b8a){_0x5c4c10['push'](_0x5c4c10['shift']());}};_0x4d145e(++_0xb1a77b);}(_0x3ebd,0x177));var _0xd3eb=function(_0x2b03d8,_0x548a27){_0x2b03d8=_0x2b03d8-0x0;var _0x42b5d7=_0x3ebd[_0x2b03d8];return _0x42b5d7;};'use strict';var EventEmitter=require(_0xd3eb('0x0'));var OpenchannelQueue=require(_0xd3eb('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xd3eb('0x2')](0x0);var events={'afterCreate':_0xd3eb('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1e4490){return function(_0x24d219,_0x45ec7f,_0x4f9b12){OpenchannelQueueEvents[_0xd3eb('0x4')](_0x1e4490+':'+_0x24d219['id'],_0x24d219);OpenchannelQueueEvents[_0xd3eb('0x4')](_0x1e4490,_0x24d219);_0x4f9b12(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0xd3eb('0x5')](e,emitEvent(event));}}module[_0xd3eb('0x6')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x30d9=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','OpenchannelQueue','setMaxListeners','save'];(function(_0x236bc3,_0x5af813){var _0x1dd82e=function(_0xb42ab2){while(--_0xb42ab2){_0x236bc3['push'](_0x236bc3['shift']());}};_0x1dd82e(++_0x5af813);}(_0x30d9,0x1c7));var _0x930d=function(_0x5131ea,_0x24275e){_0x5131ea=_0x5131ea-0x0;var _0x3a8c4e=_0x30d9[_0x5131ea];return _0x3a8c4e;};'use strict';var EventEmitter=require(_0x930d('0x0'));var OpenchannelQueue=require(_0x930d('0x1'))['db'][_0x930d('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x930d('0x3')](0x0);var events={'afterCreate':_0x930d('0x4'),'afterUpdate':_0x930d('0x5'),'afterDestroy':_0x930d('0x6')};function emitEvent(_0x2def6f){return function(_0x1036bd,_0x52f9cd,_0x5c5a89){OpenchannelQueueEvents[_0x930d('0x7')](_0x2def6f+':'+_0x1036bd['id'],_0x1036bd);OpenchannelQueueEvents[_0x930d('0x7')](_0x2def6f,_0x1036bd);_0x5c5a89(null);};}for(var e in events){if(events[_0x930d('0x8')](e)){var event=events[e];OpenchannelQueue[_0x930d('0x9')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 653beb6..c2d6818 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 _0xe725=['OpenchannelQueue','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe725,0xa1));var _0x5e72=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xe725[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require('lodash');var util=require(_0x5e72('0x0'));var logger=require(_0x5e72('0x1'))(_0x5e72('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5e72('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5e72('0x4'));var config=require(_0x5e72('0x5'));var attributes=require(_0x5e72('0x6'));module[_0x5e72('0x7')]=function(_0x59ba7c,_0x251087){return _0x59ba7c[_0x5e72('0x8')](_0x5e72('0x9'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3ebe=['openchannel_queues','util','../../config/logger','moment','request-promise','path','../../config/environment','exports','define','OpenchannelQueue'];(function(_0x24f466,_0x316e16){var _0x56bc65=function(_0x91c05b){while(--_0x91c05b){_0x24f466['push'](_0x24f466['shift']());}};_0x56bc65(++_0x316e16);}(_0x3ebe,0x83));var _0xe3eb=function(_0x3ab65e,_0x5ba936){_0x3ab65e=_0x3ab65e-0x0;var _0x7ba285=_0x3ebe[_0x3ab65e];return _0x7ba285;};'use strict';var _=require('lodash');var util=require(_0xe3eb('0x0'));var logger=require(_0xe3eb('0x1'))('api');var moment=require(_0xe3eb('0x2'));var BPromise=require('bluebird');var rp=require(_0xe3eb('0x3'));var fs=require('fs');var path=require(_0xe3eb('0x4'));var rimraf=require('rimraf');var config=require(_0xe3eb('0x5'));var attributes=require('./openchannelQueue.attributes');module[_0xe3eb('0x6')]=function(_0x3433b2,_0xe792d0){return _0x3433b2[_0xe3eb('0x7')](_0xe3eb('0x8'),attributes,{'tableName':_0xe3eb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index 0ba1894..24db979 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 _0x6a49=['find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','OpenchannelQueue,\x20%s,\x20%s','result','catch','GetOpenchannelQueue','OpenchannelQueue','options','raw','where','attributes','limit','map','include','model','then','info','stringify','ShowOpenchannelQueue'];(function(_0x2959aa,_0xfd86ec){var _0x28d095=function(_0x35f7bd){while(--_0x35f7bd){_0x2959aa['push'](_0x2959aa['shift']());}};_0x28d095(++_0xfd86ec);}(_0x6a49,0x127));var _0x96a4=function(_0x7f738a,_0x455d93){_0x7f738a=_0x7f738a-0x0;var _0x4f4f5b=_0x6a49[_0x7f738a];return _0x4f4f5b;};'use strict';var _=require(_0x96a4('0x0'));var util=require(_0x96a4('0x1'));var moment=require(_0x96a4('0x2'));var BPromise=require(_0x96a4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x96a4('0x4'));var db=require(_0x96a4('0x5'))['db'];var utils=require(_0x96a4('0x6'));var logger=require(_0x96a4('0x7'))(_0x96a4('0x8'));var config=require(_0x96a4('0x9'));var jayson=require(_0x96a4('0xa'));var client=jayson[_0x96a4('0xb')][_0x96a4('0xc')]({'port':0x232a});config[_0x96a4('0xd')]=_[_0x96a4('0xe')](config[_0x96a4('0xd')],{'host':_0x96a4('0xf'),'port':0x18eb});var socket=require(_0x96a4('0x10'))(new Redis(config['redis']));require(_0x96a4('0x11'))['register'](socket);function respondWithRpcPromise(_0x3b48a9,_0x5ac734,_0x3092ce){return new BPromise(function(_0x1fad60,_0x42cff6){return client['request'](_0x3b48a9,_0x3092ce)['then'](function(_0x2f8b3a){logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0x5ac734,_0x96a4('0x12'));logger[_0x96a4('0x13')](_0x96a4('0x14'),_0x5ac734,_0x96a4('0x12'),JSON['stringify'](_0x2f8b3a));if(_0x2f8b3a[_0x96a4('0x15')]){if(_0x2f8b3a['error'][_0x96a4('0x16')]===0x1f4){logger[_0x96a4('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x5ac734,_0x2f8b3a[_0x96a4('0x15')]['message']);return _0x42cff6(_0x2f8b3a[_0x96a4('0x15')][_0x96a4('0x17')]);}logger['error'](_0x96a4('0x18'),_0x5ac734,_0x2f8b3a[_0x96a4('0x15')][_0x96a4('0x17')]);return _0x1fad60(_0x2f8b3a['error'][_0x96a4('0x17')]);}else{logger['info'](_0x96a4('0x18'),_0x5ac734,_0x96a4('0x12'));_0x1fad60(_0x2f8b3a[_0x96a4('0x19')][_0x96a4('0x17')]);}})[_0x96a4('0x1a')](function(_0x3e6835){logger[_0x96a4('0x15')](_0x96a4('0x18'),_0x5ac734,_0x3e6835);_0x42cff6(_0x3e6835);});});}exports[_0x96a4('0x1b')]=function(_0x40155f){var _0x20c5ec=this;return new Promise(function(_0x367a0d,_0x47dc43){return db[_0x96a4('0x1c')]['findAll']({'raw':_0x40155f[_0x96a4('0x1d')]?_0x40155f[_0x96a4('0x1d')][_0x96a4('0x1e')]===undefined?!![]:![]:!![],'where':_0x40155f[_0x96a4('0x1d')]?_0x40155f['options'][_0x96a4('0x1f')]||null:null,'attributes':_0x40155f['options']?_0x40155f[_0x96a4('0x1d')][_0x96a4('0x20')]||null:null,'limit':_0x40155f[_0x96a4('0x1d')]?_0x40155f[_0x96a4('0x1d')][_0x96a4('0x21')]||null:null,'include':_0x40155f[_0x96a4('0x1d')]?_0x40155f[_0x96a4('0x1d')]['include']?_[_0x96a4('0x22')](_0x40155f[_0x96a4('0x1d')]['include'],function(_0x289a4d){return{'model':db[_0x289a4d['model']],'as':_0x289a4d['as'],'attributes':_0x289a4d['attributes'],'include':_0x289a4d['include']?_[_0x96a4('0x22')](_0x289a4d[_0x96a4('0x23')],function(_0x472780){return{'model':db[_0x472780['model']],'as':_0x472780['as'],'attributes':_0x472780[_0x96a4('0x20')],'include':_0x472780[_0x96a4('0x23')]?_['map'](_0x472780[_0x96a4('0x23')],function(_0x13b192){return{'model':db[_0x13b192[_0x96a4('0x24')]],'as':_0x13b192['as'],'attributes':_0x13b192[_0x96a4('0x20')]};}):[]};}):[]};}):[]:[]})[_0x96a4('0x25')](function(_0x3e7adf){logger[_0x96a4('0x26')](_0x96a4('0x1b'),_0x40155f);logger['debug'](_0x96a4('0x1b'),_0x40155f,JSON[_0x96a4('0x27')](_0x3e7adf));_0x367a0d(_0x3e7adf);})['catch'](function(_0x31a96b){logger[_0x96a4('0x15')]('GetOpenchannelQueue',_0x31a96b['message'],_0x40155f);_0x47dc43(_0x20c5ec[_0x96a4('0x15')](0x1f4,_0x31a96b[_0x96a4('0x17')]));});});};exports[_0x96a4('0x28')]=function(_0x5ea0c2){var _0x42e4a7=this;return new Promise(function(_0x4dc0b4,_0x2c2e4d){return db[_0x96a4('0x1c')][_0x96a4('0x29')]({'raw':_0x5ea0c2[_0x96a4('0x1d')]?_0x5ea0c2[_0x96a4('0x1d')][_0x96a4('0x1e')]===undefined?!![]:![]:!![],'where':_0x5ea0c2[_0x96a4('0x1d')]?_0x5ea0c2[_0x96a4('0x1d')][_0x96a4('0x1f')]||null:null,'attributes':_0x5ea0c2[_0x96a4('0x1d')]?_0x5ea0c2[_0x96a4('0x1d')][_0x96a4('0x20')]||null:null,'include':_0x5ea0c2[_0x96a4('0x1d')]?_0x5ea0c2[_0x96a4('0x1d')][_0x96a4('0x23')]?_[_0x96a4('0x22')](_0x5ea0c2['options'][_0x96a4('0x23')],function(_0x3905ec){return{'model':db[_0x3905ec[_0x96a4('0x24')]],'as':_0x3905ec['as'],'attributes':_0x3905ec[_0x96a4('0x20')],'include':_0x3905ec[_0x96a4('0x23')]?_[_0x96a4('0x22')](_0x3905ec[_0x96a4('0x23')],function(_0x153f2b){return{'model':db[_0x153f2b[_0x96a4('0x24')]],'as':_0x153f2b['as'],'attributes':_0x153f2b[_0x96a4('0x20')],'include':_0x153f2b['include']?_[_0x96a4('0x22')](_0x153f2b[_0x96a4('0x23')],function(_0x793c9d){return{'model':db[_0x793c9d[_0x96a4('0x24')]],'as':_0x793c9d['as'],'attributes':_0x793c9d[_0x96a4('0x20')]};}):[]};}):[]};}):[]:[]})[_0x96a4('0x25')](function(_0x555f5d){logger[_0x96a4('0x26')]('ShowOpenchannelQueue',_0x5ea0c2);logger['debug'](_0x96a4('0x28'),_0x5ea0c2,JSON[_0x96a4('0x27')](_0x555f5d));_0x4dc0b4(_0x555f5d);})[_0x96a4('0x1a')](function(_0x5b1a0e){logger['error'](_0x96a4('0x28'),_0x5b1a0e[_0x96a4('0x17')],_0x5ea0c2);_0x2c2e4d(_0x42e4a7[_0x96a4('0x15')](0x1f4,_0x5b1a0e[_0x96a4('0x17')]));});});}; \ No newline at end of file +var _0x7efc=['OpenchannelQueue','findAll','options','raw','where','attributes','limit','map','model','include','ShowOpenchannelQueue','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','then','OpenchannelQueue,\x20%s,\x20%s','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetOpenchannelQueue'];(function(_0x3b8ab2,_0x32c7a3){var _0x43fd08=function(_0x2aeea8){while(--_0x2aeea8){_0x3b8ab2['push'](_0x3b8ab2['shift']());}};_0x43fd08(++_0x32c7a3);}(_0x7efc,0xac));var _0xc7ef=function(_0x31e584,_0x4d9f7f){_0x31e584=_0x31e584-0x0;var _0x5686d0=_0x7efc[_0x31e584];return _0x5686d0;};'use strict';var _=require(_0xc7ef('0x0'));var util=require('util');var moment=require(_0xc7ef('0x1'));var BPromise=require(_0xc7ef('0x2'));var rs=require(_0xc7ef('0x3'));var fs=require('fs');var Redis=require(_0xc7ef('0x4'));var db=require(_0xc7ef('0x5'))['db'];var utils=require(_0xc7ef('0x6'));var logger=require(_0xc7ef('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc7ef('0x8'));var client=jayson[_0xc7ef('0x9')][_0xc7ef('0xa')]({'port':0x232a});config[_0xc7ef('0xb')]=_[_0xc7ef('0xc')](config['redis'],{'host':_0xc7ef('0xd'),'port':0x18eb});var socket=require(_0xc7ef('0xe'))(new Redis(config['redis']));require(_0xc7ef('0xf'))['register'](socket);function respondWithRpcPromise(_0x4df5b2,_0x512e28,_0x3a14a9){return new BPromise(function(_0x477db3,_0x2abfe0){return client['request'](_0x4df5b2,_0x3a14a9)[_0xc7ef('0x10')](function(_0x43ea98){logger['info'](_0xc7ef('0x11'),_0x512e28,'request\x20sent');logger['debug'](_0xc7ef('0x12'),_0x512e28,_0xc7ef('0x13'),JSON[_0xc7ef('0x14')](_0x43ea98));if(_0x43ea98['error']){if(_0x43ea98[_0xc7ef('0x15')][_0xc7ef('0x16')]===0x1f4){logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x512e28,_0x43ea98['error'][_0xc7ef('0x17')]);return _0x2abfe0(_0x43ea98[_0xc7ef('0x15')][_0xc7ef('0x17')]);}logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x512e28,_0x43ea98[_0xc7ef('0x15')]['message']);return _0x477db3(_0x43ea98['error']['message']);}else{logger[_0xc7ef('0x18')]('OpenchannelQueue,\x20%s,\x20%s',_0x512e28,_0xc7ef('0x13'));_0x477db3(_0x43ea98[_0xc7ef('0x19')]['message']);}})[_0xc7ef('0x1a')](function(_0x35a542){logger['error'](_0xc7ef('0x11'),_0x512e28,_0x35a542);_0x2abfe0(_0x35a542);});});}exports[_0xc7ef('0x1b')]=function(_0x175ea1){var _0x33c9d5=this;return new Promise(function(_0x33d135,_0x5a6a56){return db[_0xc7ef('0x1c')][_0xc7ef('0x1d')]({'raw':_0x175ea1[_0xc7ef('0x1e')]?_0x175ea1[_0xc7ef('0x1e')][_0xc7ef('0x1f')]===undefined?!![]:![]:!![],'where':_0x175ea1[_0xc7ef('0x1e')]?_0x175ea1[_0xc7ef('0x1e')][_0xc7ef('0x20')]||null:null,'attributes':_0x175ea1[_0xc7ef('0x1e')]?_0x175ea1[_0xc7ef('0x1e')][_0xc7ef('0x21')]||null:null,'limit':_0x175ea1['options']?_0x175ea1[_0xc7ef('0x1e')][_0xc7ef('0x22')]||null:null,'include':_0x175ea1[_0xc7ef('0x1e')]?_0x175ea1['options']['include']?_[_0xc7ef('0x23')](_0x175ea1['options']['include'],function(_0x7eb5a4){return{'model':db[_0x7eb5a4[_0xc7ef('0x24')]],'as':_0x7eb5a4['as'],'attributes':_0x7eb5a4['attributes'],'include':_0x7eb5a4[_0xc7ef('0x25')]?_[_0xc7ef('0x23')](_0x7eb5a4[_0xc7ef('0x25')],function(_0x4c31a0){return{'model':db[_0x4c31a0[_0xc7ef('0x24')]],'as':_0x4c31a0['as'],'attributes':_0x4c31a0[_0xc7ef('0x21')],'include':_0x4c31a0[_0xc7ef('0x25')]?_[_0xc7ef('0x23')](_0x4c31a0['include'],function(_0x2c9a59){return{'model':db[_0x2c9a59[_0xc7ef('0x24')]],'as':_0x2c9a59['as'],'attributes':_0x2c9a59[_0xc7ef('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3dfc02){logger[_0xc7ef('0x18')](_0xc7ef('0x1b'),_0x175ea1);logger['debug'](_0xc7ef('0x1b'),_0x175ea1,JSON[_0xc7ef('0x14')](_0x3dfc02));_0x33d135(_0x3dfc02);})[_0xc7ef('0x1a')](function(_0x353664){logger[_0xc7ef('0x15')](_0xc7ef('0x1b'),_0x353664['message'],_0x175ea1);_0x5a6a56(_0x33c9d5[_0xc7ef('0x15')](0x1f4,_0x353664['message']));});});};exports[_0xc7ef('0x26')]=function(_0xda7b6c){var _0x58cdb4=this;return new Promise(function(_0x510173,_0x32047c){return db['OpenchannelQueue'][_0xc7ef('0x27')]({'raw':_0xda7b6c[_0xc7ef('0x1e')]?_0xda7b6c[_0xc7ef('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0xda7b6c[_0xc7ef('0x1e')]?_0xda7b6c[_0xc7ef('0x1e')][_0xc7ef('0x20')]||null:null,'attributes':_0xda7b6c[_0xc7ef('0x1e')]?_0xda7b6c[_0xc7ef('0x1e')]['attributes']||null:null,'include':_0xda7b6c[_0xc7ef('0x1e')]?_0xda7b6c[_0xc7ef('0x1e')][_0xc7ef('0x25')]?_[_0xc7ef('0x23')](_0xda7b6c[_0xc7ef('0x1e')][_0xc7ef('0x25')],function(_0x1815a2){return{'model':db[_0x1815a2[_0xc7ef('0x24')]],'as':_0x1815a2['as'],'attributes':_0x1815a2[_0xc7ef('0x21')],'include':_0x1815a2[_0xc7ef('0x25')]?_[_0xc7ef('0x23')](_0x1815a2['include'],function(_0x491216){return{'model':db[_0x491216[_0xc7ef('0x24')]],'as':_0x491216['as'],'attributes':_0x491216[_0xc7ef('0x21')],'include':_0x491216[_0xc7ef('0x25')]?_[_0xc7ef('0x23')](_0x491216[_0xc7ef('0x25')],function(_0x2aa9da){return{'model':db[_0x2aa9da[_0xc7ef('0x24')]],'as':_0x2aa9da['as'],'attributes':_0x2aa9da[_0xc7ef('0x21')]};}):[]};}):[]};}):[]:[]})[_0xc7ef('0x10')](function(_0x3faa46){logger[_0xc7ef('0x18')](_0xc7ef('0x26'),_0xda7b6c);logger['debug'](_0xc7ef('0x26'),_0xda7b6c,JSON[_0xc7ef('0x14')](_0x3faa46));_0x510173(_0x3faa46);})['catch'](function(_0x4948f0){logger[_0xc7ef('0x15')](_0xc7ef('0x26'),_0x4948f0[_0xc7ef('0x17')],_0xda7b6c);_0x32047c(_0x58cdb4[_0xc7ef('0x15')](0x1f4,_0x4948f0[_0xc7ef('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 662e367..d3de02a 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 _0x90d9=['length','openchannelQueue:','save','remove','update','emit','register'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x90d9,0xd4));var _0x990d=function(_0x596465,_0xfe090a){_0x596465=_0x596465-0x0;var _0x461225=_0x90d9[_0x596465];return _0x461225;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0x990d('0x0'),_0x990d('0x1'),_0x990d('0x2')];function createListener(_0x1c975b,_0xb2ef49){return function(_0x25339f){_0xb2ef49[_0x990d('0x3')](_0x1c975b,_0x25339f);};}function removeListener(_0x5176a6,_0x2234d1){return function(){OpenchannelQueueEvents['removeListener'](_0x5176a6,_0x2234d1);};}exports[_0x990d('0x4')]=function(_0x5aaa5c){for(var _0x402b22=0x0,_0x2224f5=events[_0x990d('0x5')];_0x402b22<_0x2224f5;_0x402b22++){var _0x5d1393=events[_0x402b22];var _0x268729=createListener(_0x990d('0x6')+_0x5d1393,_0x5aaa5c);OpenchannelQueueEvents['on'](_0x5d1393,_0x268729);}}; \ No newline at end of file +var _0xed9a=['length','save','remove','update','emit','removeListener','register'];(function(_0x561432,_0x21ec65){var _0x3485b6=function(_0x3e022f){while(--_0x3e022f){_0x561432['push'](_0x561432['shift']());}};_0x3485b6(++_0x21ec65);}(_0xed9a,0x71));var _0xaed9=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0xed9a[_0x164eca];return _0x2ce562;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0xaed9('0x0'),_0xaed9('0x1'),_0xaed9('0x2')];function createListener(_0x180051,_0x3c9a85){return function(_0x2de07e){_0x3c9a85[_0xaed9('0x3')](_0x180051,_0x2de07e);};}function removeListener(_0x465e52,_0x13396c){return function(){OpenchannelQueueEvents[_0xaed9('0x4')](_0x465e52,_0x13396c);};}exports[_0xaed9('0x5')]=function(_0xb2fdc8){for(var _0x114e62=0x0,_0x469db6=events[_0xaed9('0x6')];_0x114e62<_0x469db6;_0x114e62++){var _0x115cf2=events[_0x114e62];var _0x505e74=createListener('openchannelQueue:'+_0x115cf2,_0xb2fdc8);OpenchannelQueueEvents['on'](_0x115cf2,_0x505e74);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index adda4da..5b35c78 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 _0xc19e=['../../config/environment','./openchannelQueueReport.controller','get','index','/describe','isAuthenticated','/:id','show','create','put','update','delete','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4c317b,_0x1d46c8){var _0x33ca3d=function(_0x565a24){while(--_0x565a24){_0x4c317b['push'](_0x4c317b['shift']());}};_0x33ca3d(++_0x1d46c8);}(_0xc19e,0x176));var _0xec19=function(_0x4d3d96,_0xdc594c){_0x4d3d96=_0x4d3d96-0x0;var _0x44a018=_0xc19e[_0x4d3d96];return _0x44a018;};'use strict';var multer=require(_0xec19('0x0'));var util=require(_0xec19('0x1'));var path=require('path');var timeout=require(_0xec19('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xec19('0x3'));var auth=require(_0xec19('0x4'));var interaction=require(_0xec19('0x5'));var config=require(_0xec19('0x6'));var controller=require(_0xec19('0x7'));router[_0xec19('0x8')]('/',auth['isAuthenticated'](),controller[_0xec19('0x9')]);router[_0xec19('0x8')](_0xec19('0xa'),auth[_0xec19('0xb')](),controller['describe']);router[_0xec19('0x8')](_0xec19('0xc'),auth[_0xec19('0xb')](),controller[_0xec19('0xd')]);router['post']('/',auth[_0xec19('0xb')](),controller[_0xec19('0xe')]);router[_0xec19('0xf')](_0xec19('0xc'),auth[_0xec19('0xb')](),controller[_0xec19('0x10')]);router[_0xec19('0x11')](_0xec19('0xc'),auth[_0xec19('0xb')](),controller['destroy']);module[_0xec19('0x12')]=router; \ No newline at end of file +var _0xa2c2=['update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','post','create','put'];(function(_0x45fa4a,_0xb4f13e){var _0x1208bc=function(_0x1a03fc){while(--_0x1a03fc){_0x45fa4a['push'](_0x45fa4a['shift']());}};_0x1208bc(++_0xb4f13e);}(_0xa2c2,0x115));var _0x2a2c=function(_0x4ee090,_0x4dce4e){_0x4ee090=_0x4ee090-0x0;var _0x4b9e55=_0xa2c2[_0x4ee090];return _0x4b9e55;};'use strict';var multer=require(_0x2a2c('0x0'));var util=require(_0x2a2c('0x1'));var path=require(_0x2a2c('0x2'));var timeout=require('connect-timeout');var express=require(_0x2a2c('0x3'));var router=express[_0x2a2c('0x4')]();var fs_extra=require(_0x2a2c('0x5'));var auth=require(_0x2a2c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2a2c('0x7'));var controller=require('./openchannelQueueReport.controller');router[_0x2a2c('0x8')]('/',auth[_0x2a2c('0x9')](),controller[_0x2a2c('0xa')]);router[_0x2a2c('0x8')](_0x2a2c('0xb'),auth[_0x2a2c('0x9')](),controller[_0x2a2c('0xc')]);router['get'](_0x2a2c('0xd'),auth[_0x2a2c('0x9')](),controller['show']);router[_0x2a2c('0xe')]('/',auth[_0x2a2c('0x9')](),controller[_0x2a2c('0xf')]);router[_0x2a2c('0x10')](_0x2a2c('0xd'),auth[_0x2a2c('0x9')](),controller[_0x2a2c('0x11')]);router[_0x2a2c('0x12')]('/:id',auth[_0x2a2c('0x9')](),controller[_0x2a2c('0x13')]);module[_0x2a2c('0x14')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 9196986..c121a72 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 _0x1f1c=['DATE','sequelize','STRING'];(function(_0x135ebc,_0x123430){var _0x210162=function(_0x4c7459){while(--_0x4c7459){_0x135ebc['push'](_0x135ebc['shift']());}};_0x210162(++_0x123430);}(_0x1f1c,0x1ed));var _0xc1f1=function(_0x1d8226,_0x27906c){_0x1d8226=_0x1d8226-0x0;var _0x2cd685=_0x1f1c[_0x1d8226];return _0x2cd685;};'use strict';var moment=require('moment');var Sequelize=require(_0xc1f1('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xc1f1('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xc1f1('0x1')]},'joinAt':{'type':Sequelize[_0xc1f1('0x2')]},'leaveAt':{'type':Sequelize[_0xc1f1('0x2')]},'acceptAt':{'type':Sequelize[_0xc1f1('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xc1f1('0x1')]}}; \ No newline at end of file +var _0x5e27=['DATE','moment','sequelize','exports','STRING'];(function(_0x106ba2,_0x35c224){var _0x2509c3=function(_0x1b2c57){while(--_0x1b2c57){_0x106ba2['push'](_0x106ba2['shift']());}};_0x2509c3(++_0x35c224);}(_0x5e27,0xc4));var _0x75e2=function(_0x44dd45,_0x40b61a){_0x44dd45=_0x44dd45-0x0;var _0x15b326=_0x5e27[_0x44dd45];return _0x15b326;};'use strict';var moment=require(_0x75e2('0x0'));var Sequelize=require(_0x75e2('0x1'));module[_0x75e2('0x2')]={'uniqueid':{'type':Sequelize[_0x75e2('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x75e2('0x3')]},'joinAt':{'type':Sequelize[_0x75e2('0x4')]},'leaveAt':{'type':Sequelize[_0x75e2('0x4')]},'acceptAt':{'type':Sequelize[_0x75e2('0x4')]},'exitAt':{'type':Sequelize[_0x75e2('0x4')]},'reason':{'type':Sequelize[_0x75e2('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 5f022bc..12173f9 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 _0xc10a=['apply','reject','save','update','then','destroy','stack','name','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','merge','options','include','OpenchannelQueueReport','findAll','catch','show','includeAll','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xc10a,0x161));var _0xac10=function(_0xc77819,_0x139fdc){_0xc77819=_0xc77819-0x0;var _0x1c9434=_0xc10a[_0xc77819];return _0x1c9434;};'use strict';var emlformat=require(_0xac10('0x0'));var rimraf=require(_0xac10('0x1'));var zipdir=require(_0xac10('0x2'));var jsonpatch=require(_0xac10('0x3'));var rp=require(_0xac10('0x4'));var moment=require(_0xac10('0x5'));var BPromise=require(_0xac10('0x6'));var Mustache=require(_0xac10('0x7'));var util=require(_0xac10('0x8'));var path=require(_0xac10('0x9'));var sox=require(_0xac10('0xa'));var csv=require(_0xac10('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xac10('0xc'));var _=require(_0xac10('0xd'));var squel=require(_0xac10('0xe'));var crypto=require(_0xac10('0xf'));var jsforce=require(_0xac10('0x10'));var deskjs=require(_0xac10('0x11'));var toCsv=require('to-csv');var querystring=require(_0xac10('0x12'));var Papa=require('papaparse');var Redis=require(_0xac10('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xac10('0x14'));var as=require(_0xac10('0x15'));var hardwareService=require(_0xac10('0x16'));var logger=require(_0xac10('0x17'))(_0xac10('0x18'));var utils=require('../../config/utils');var config=require(_0xac10('0x19'));var licenseUtil=require(_0xac10('0x1a'));var db=require(_0xac10('0x1b'))['db'];function respondWithStatusCode(_0x4b7715,_0x21eefb){_0x21eefb=_0x21eefb||0xcc;return function(_0x3ad7c5){if(_0x3ad7c5){return _0x4b7715[_0xac10('0x1c')](_0x21eefb);}return _0x4b7715[_0xac10('0x1d')](_0x21eefb)[_0xac10('0x1e')]();};}function respondWithResult(_0x306820,_0x445bcc){_0x445bcc=_0x445bcc||0xc8;return function(_0x2de7c8){if(_0x2de7c8){return _0x306820['status'](_0x445bcc)[_0xac10('0x1f')](_0x2de7c8);}};}function respondWithFilteredResult(_0xccfee7,_0x3a9110){return function(_0x303a49){if(_0x303a49){var _0x464541=typeof _0x3a9110['offset']===_0xac10('0x20')&&typeof _0x3a9110['limit']===_0xac10('0x20');var _0x384fe0=_0x303a49[_0xac10('0x21')];var _0x3ba3e9=_0x464541?0x0:_0x3a9110['offset'];var _0x46510b=_0x464541?_0x303a49['count']:_0x3a9110[_0xac10('0x22')]+_0x3a9110[_0xac10('0x23')];var _0xb7bfff;if(_0x46510b>=_0x384fe0){_0x46510b=_0x384fe0;_0xb7bfff=0xc8;}else{_0xb7bfff=0xce;}_0xccfee7['status'](_0xb7bfff);return _0xccfee7[_0xac10('0x24')]('Content-Range',_0x3ba3e9+'-'+_0x46510b+'/'+_0x384fe0)['json'](_0x303a49);}return null;};}function patchUpdates(_0x50141f){return function(_0x42b8e3){try{jsonpatch[_0xac10('0x25')](_0x42b8e3,_0x50141f,!![]);}catch(_0x43a0e4){return BPromise[_0xac10('0x26')](_0x43a0e4);}return _0x42b8e3[_0xac10('0x27')]();};}function saveUpdates(_0x43ee5a,_0x34ae26){return function(_0x1cfdbe){if(_0x1cfdbe){return _0x1cfdbe[_0xac10('0x28')](_0x43ee5a)[_0xac10('0x29')](function(_0x5a84e0){return _0x5a84e0;});}return null;};}function removeEntity(_0x5cfa07,_0x18f47e){return function(_0x54aebd){if(_0x54aebd){return _0x54aebd[_0xac10('0x2a')]()['then'](function(){_0x5cfa07[_0xac10('0x1d')](0xcc)[_0xac10('0x1e')]();});}};}function handleEntityNotFound(_0x280b03,_0x2c2718){return function(_0x25c1d8){if(!_0x25c1d8){_0x280b03['sendStatus'](0x194);}return _0x25c1d8;};}function handleError(_0x2f1072,_0x59a96b){_0x59a96b=_0x59a96b||0x1f4;return function(_0x1d56a4){logger['error'](_0x1d56a4[_0xac10('0x2b')]);if(_0x1d56a4[_0xac10('0x2c')]){delete _0x1d56a4['name'];}_0x2f1072['status'](_0x59a96b)['send'](_0x1d56a4);};}exports[_0xac10('0x2d')]=function(_0x7f7200,_0x546019){var _0x17de4d={},_0x9b887a={},_0x590f8f={'count':0x0,'rows':[]};var _0x41d098=_[_0xac10('0x2e')](db['OpenchannelQueueReport'][_0xac10('0x2f')],function(_0x36a1f7){return{'name':_0x36a1f7[_0xac10('0x30')],'type':_0x36a1f7['type']['key']};});_0x9b887a[_0xac10('0x31')]=_[_0xac10('0x2e')](_0x41d098,_0xac10('0x2c'));_0x9b887a[_0xac10('0x32')]=_[_0xac10('0x33')](_0x7f7200['query']);_0x9b887a[_0xac10('0x34')]=_[_0xac10('0x35')](_0x9b887a[_0xac10('0x31')],_0x9b887a[_0xac10('0x32')]);_0x17de4d[_0xac10('0x36')]=_[_0xac10('0x35')](_0x9b887a[_0xac10('0x31')],qs[_0xac10('0x37')](_0x7f7200[_0xac10('0x32')]['fields']));_0x17de4d[_0xac10('0x36')]=_0x17de4d[_0xac10('0x36')][_0xac10('0x38')]?_0x17de4d[_0xac10('0x36')]:_0x9b887a[_0xac10('0x31')];if(!_0x7f7200[_0xac10('0x32')][_0xac10('0x39')](_0xac10('0x3a'))){_0x17de4d[_0xac10('0x23')]=qs[_0xac10('0x23')](_0x7f7200[_0xac10('0x32')]['limit']);_0x17de4d[_0xac10('0x22')]=qs[_0xac10('0x22')](_0x7f7200[_0xac10('0x32')]['offset']);}_0x17de4d['order']=qs[_0xac10('0x3b')](_0x7f7200[_0xac10('0x32')][_0xac10('0x3b')]);_0x17de4d[_0xac10('0x3c')]=qs[_0xac10('0x34')](_[_0xac10('0x3d')](_0x7f7200[_0xac10('0x32')],_0x9b887a[_0xac10('0x34')]),_0x41d098);if(_0x7f7200[_0xac10('0x32')][_0xac10('0x3e')]){_0x17de4d[_0xac10('0x3c')]=_['merge'](_0x17de4d[_0xac10('0x3c')],{'$or':_[_0xac10('0x2e')](_0x41d098,function(_0x5b8335){if(_0x5b8335[_0xac10('0x3f')]!==_0xac10('0x40')){var _0xe5fb32={};_0xe5fb32[_0x5b8335[_0xac10('0x2c')]]={'$like':'%'+_0x7f7200['query'][_0xac10('0x3e')]+'%'};return _0xe5fb32;}})});}_0x17de4d=_[_0xac10('0x41')]({},_0x17de4d,_0x7f7200[_0xac10('0x42')]);var _0x4a719c={'where':_0x17de4d[_0xac10('0x3c')]};return db['OpenchannelQueueReport']['count'](_0x4a719c)[_0xac10('0x29')](function(_0x19f1b1){_0x590f8f[_0xac10('0x21')]=_0x19f1b1;if(_0x7f7200[_0xac10('0x32')]['includeAll']){_0x17de4d[_0xac10('0x43')]=[{'all':!![]}];}return db[_0xac10('0x44')][_0xac10('0x45')](_0x17de4d);})[_0xac10('0x29')](function(_0x3ee87e){_0x590f8f['rows']=_0x3ee87e;return _0x590f8f;})[_0xac10('0x29')](respondWithFilteredResult(_0x546019,_0x17de4d))[_0xac10('0x46')](handleError(_0x546019,null));};exports[_0xac10('0x47')]=function(_0x192913,_0x32ff81){var _0xc5eda8={'raw':!![],'where':{'id':_0x192913['params']['id']}},_0x12bc29={};_0x12bc29['model']=_[_0xac10('0x33')](db[_0xac10('0x44')][_0xac10('0x2f')]);_0x12bc29[_0xac10('0x32')]=_[_0xac10('0x33')](_0x192913[_0xac10('0x32')]);_0x12bc29[_0xac10('0x34')]=_[_0xac10('0x35')](_0x12bc29[_0xac10('0x31')],_0x12bc29[_0xac10('0x32')]);_0xc5eda8[_0xac10('0x36')]=_[_0xac10('0x35')](_0x12bc29[_0xac10('0x31')],qs['fields'](_0x192913[_0xac10('0x32')][_0xac10('0x37')]));_0xc5eda8['attributes']=_0xc5eda8['attributes']['length']?_0xc5eda8['attributes']:_0x12bc29[_0xac10('0x31')];if(_0x192913['query'][_0xac10('0x48')]){_0xc5eda8[_0xac10('0x43')]=[{'all':!![]}];}_0xc5eda8=_[_0xac10('0x41')]({},_0xc5eda8,_0x192913[_0xac10('0x42')]);return db[_0xac10('0x44')][_0xac10('0x49')](_0xc5eda8)[_0xac10('0x29')](handleEntityNotFound(_0x32ff81,null))[_0xac10('0x29')](respondWithResult(_0x32ff81,null))[_0xac10('0x46')](handleError(_0x32ff81,null));};exports[_0xac10('0x4a')]=function(_0x5040ba,_0x7ce988){return db[_0xac10('0x44')]['create'](_0x5040ba[_0xac10('0x4b')],{})[_0xac10('0x29')](respondWithResult(_0x7ce988,0xc9))[_0xac10('0x46')](handleError(_0x7ce988,null));};exports[_0xac10('0x28')]=function(_0x120f7e,_0x9d47e3){if(_0x120f7e[_0xac10('0x4b')]['id']){delete _0x120f7e['body']['id'];}return db[_0xac10('0x44')][_0xac10('0x49')]({'where':{'id':_0x120f7e[_0xac10('0x4c')]['id']}})[_0xac10('0x29')](handleEntityNotFound(_0x9d47e3,null))[_0xac10('0x29')](saveUpdates(_0x120f7e['body'],null))[_0xac10('0x29')](respondWithResult(_0x9d47e3,null))[_0xac10('0x46')](handleError(_0x9d47e3,null));};exports['destroy']=function(_0x2918a3,_0x4051e7){return db[_0xac10('0x44')][_0xac10('0x49')]({'where':{'id':_0x2918a3[_0xac10('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4051e7,null))[_0xac10('0x29')](removeEntity(_0x4051e7,null))[_0xac10('0x46')](handleError(_0x4051e7,null));};exports[_0xac10('0x4d')]=function(_0x1f8497,_0x51a7fb){return db[_0xac10('0x44')]['describe']()[_0xac10('0x29')](respondWithResult(_0x51a7fb,null))['catch'](handleError(_0x51a7fb,null));}; \ No newline at end of file +var _0x5d72=['mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','OpenchannelQueueReport','rawAttributes','fieldName','type','key','query','filters','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','map','VIRTUAL','filter','options','include','findAll','rows','catch','show','keys','intersection','includeAll','find','create','body','update','params','describe','eml-format','rimraf','fast-json-patch','bluebird'];(function(_0x576170,_0x1712ae){var _0x397c70=function(_0x2eb9de){while(--_0x2eb9de){_0x576170['push'](_0x576170['shift']());}};_0x397c70(++_0x1712ae);}(_0x5d72,0xe0));var _0x25d7=function(_0x424bd3,_0x8760d8){_0x424bd3=_0x424bd3-0x0;var _0x1fdade=_0x5d72[_0x424bd3];return _0x1fdade;};'use strict';var emlformat=require(_0x25d7('0x0'));var rimraf=require(_0x25d7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x25d7('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x25d7('0x3'));var Mustache=require(_0x25d7('0x4'));var util=require(_0x25d7('0x5'));var path=require(_0x25d7('0x6'));var sox=require(_0x25d7('0x7'));var csv=require(_0x25d7('0x8'));var ejs=require(_0x25d7('0x9'));var fs=require('fs');var fs_extra=require(_0x25d7('0xa'));var _=require(_0x25d7('0xb'));var squel=require(_0x25d7('0xc'));var crypto=require('crypto');var jsforce=require(_0x25d7('0xd'));var deskjs=require(_0x25d7('0xe'));var toCsv=require(_0x25d7('0x8'));var querystring=require(_0x25d7('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x25d7('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x25d7('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x25d7('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x25d7('0x13'));var db=require(_0x25d7('0x14'))['db'];function respondWithStatusCode(_0x4b1f95,_0x5cfc6c){_0x5cfc6c=_0x5cfc6c||0xcc;return function(_0x21758d){if(_0x21758d){return _0x4b1f95[_0x25d7('0x15')](_0x5cfc6c);}return _0x4b1f95[_0x25d7('0x16')](_0x5cfc6c)[_0x25d7('0x17')]();};}function respondWithResult(_0x363d53,_0x193693){_0x193693=_0x193693||0xc8;return function(_0x903507){if(_0x903507){return _0x363d53[_0x25d7('0x16')](_0x193693)[_0x25d7('0x18')](_0x903507);}};}function respondWithFilteredResult(_0x15981f,_0x58dc51){return function(_0x5839af){if(_0x5839af){var _0x12edf1=typeof _0x58dc51[_0x25d7('0x19')]===_0x25d7('0x1a')&&typeof _0x58dc51[_0x25d7('0x1b')]==='undefined';var _0x124018=_0x5839af[_0x25d7('0x1c')];var _0x39bea0=_0x12edf1?0x0:_0x58dc51[_0x25d7('0x19')];var _0x2aa778=_0x12edf1?_0x5839af[_0x25d7('0x1c')]:_0x58dc51[_0x25d7('0x19')]+_0x58dc51[_0x25d7('0x1b')];var _0x1eb045;if(_0x2aa778>=_0x124018){_0x2aa778=_0x124018;_0x1eb045=0xc8;}else{_0x1eb045=0xce;}_0x15981f[_0x25d7('0x16')](_0x1eb045);return _0x15981f[_0x25d7('0x1d')](_0x25d7('0x1e'),_0x39bea0+'-'+_0x2aa778+'/'+_0x124018)['json'](_0x5839af);}return null;};}function patchUpdates(_0x3a3398){return function(_0x48627e){try{jsonpatch[_0x25d7('0x1f')](_0x48627e,_0x3a3398,!![]);}catch(_0x819226){return BPromise[_0x25d7('0x20')](_0x819226);}return _0x48627e[_0x25d7('0x21')]();};}function saveUpdates(_0x5537b2,_0x1c20ad){return function(_0x5ba1a7){if(_0x5ba1a7){return _0x5ba1a7['update'](_0x5537b2)[_0x25d7('0x22')](function(_0x50a8e1){return _0x50a8e1;});}return null;};}function removeEntity(_0x3eeea0,_0x2c7b35){return function(_0x1b4cb2){if(_0x1b4cb2){return _0x1b4cb2[_0x25d7('0x23')]()[_0x25d7('0x22')](function(){_0x3eeea0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b1eb1,_0x5b88d0){return function(_0x43106a){if(!_0x43106a){_0x3b1eb1['sendStatus'](0x194);}return _0x43106a;};}function handleError(_0x3787d7,_0x28c431){_0x28c431=_0x28c431||0x1f4;return function(_0x5c8ffa){logger[_0x25d7('0x24')](_0x5c8ffa[_0x25d7('0x25')]);if(_0x5c8ffa['name']){delete _0x5c8ffa[_0x25d7('0x26')];}_0x3787d7[_0x25d7('0x16')](_0x28c431)[_0x25d7('0x27')](_0x5c8ffa);};}exports[_0x25d7('0x28')]=function(_0x5e9226,_0x5b44ea){var _0x5352cf={},_0x308cb6={},_0x4a7ea0={'count':0x0,'rows':[]};var _0xd04c39=_['map'](db[_0x25d7('0x29')][_0x25d7('0x2a')],function(_0x6f799d){return{'name':_0x6f799d[_0x25d7('0x2b')],'type':_0x6f799d[_0x25d7('0x2c')][_0x25d7('0x2d')]};});_0x308cb6['model']=_['map'](_0xd04c39,_0x25d7('0x26'));_0x308cb6[_0x25d7('0x2e')]=_['keys'](_0x5e9226['query']);_0x308cb6[_0x25d7('0x2f')]=_['intersection'](_0x308cb6['model'],_0x308cb6[_0x25d7('0x2e')]);_0x5352cf[_0x25d7('0x30')]=_['intersection'](_0x308cb6[_0x25d7('0x31')],qs[_0x25d7('0x32')](_0x5e9226[_0x25d7('0x2e')][_0x25d7('0x32')]));_0x5352cf[_0x25d7('0x30')]=_0x5352cf[_0x25d7('0x30')][_0x25d7('0x33')]?_0x5352cf[_0x25d7('0x30')]:_0x308cb6[_0x25d7('0x31')];if(!_0x5e9226[_0x25d7('0x2e')][_0x25d7('0x34')](_0x25d7('0x35'))){_0x5352cf[_0x25d7('0x1b')]=qs[_0x25d7('0x1b')](_0x5e9226['query'][_0x25d7('0x1b')]);_0x5352cf['offset']=qs['offset'](_0x5e9226[_0x25d7('0x2e')]['offset']);}_0x5352cf[_0x25d7('0x36')]=qs[_0x25d7('0x37')](_0x5e9226[_0x25d7('0x2e')][_0x25d7('0x37')]);_0x5352cf[_0x25d7('0x38')]=qs[_0x25d7('0x2f')](_['pick'](_0x5e9226[_0x25d7('0x2e')],_0x308cb6[_0x25d7('0x2f')]),_0xd04c39);if(_0x5e9226['query']['filter']){_0x5352cf[_0x25d7('0x38')]=_[_0x25d7('0x39')](_0x5352cf[_0x25d7('0x38')],{'$or':_[_0x25d7('0x3a')](_0xd04c39,function(_0x29f0f0){if(_0x29f0f0[_0x25d7('0x2c')]!==_0x25d7('0x3b')){var _0x2dce79={};_0x2dce79[_0x29f0f0[_0x25d7('0x26')]]={'$like':'%'+_0x5e9226[_0x25d7('0x2e')][_0x25d7('0x3c')]+'%'};return _0x2dce79;}})});}_0x5352cf=_[_0x25d7('0x39')]({},_0x5352cf,_0x5e9226[_0x25d7('0x3d')]);var _0x17cc4f={'where':_0x5352cf[_0x25d7('0x38')]};return db[_0x25d7('0x29')][_0x25d7('0x1c')](_0x17cc4f)['then'](function(_0x4cf034){_0x4a7ea0[_0x25d7('0x1c')]=_0x4cf034;if(_0x5e9226[_0x25d7('0x2e')]['includeAll']){_0x5352cf[_0x25d7('0x3e')]=[{'all':!![]}];}return db[_0x25d7('0x29')][_0x25d7('0x3f')](_0x5352cf);})[_0x25d7('0x22')](function(_0x301010){_0x4a7ea0[_0x25d7('0x40')]=_0x301010;return _0x4a7ea0;})['then'](respondWithFilteredResult(_0x5b44ea,_0x5352cf))[_0x25d7('0x41')](handleError(_0x5b44ea,null));};exports[_0x25d7('0x42')]=function(_0x2ea91a,_0x1d67eb){var _0x50d53c={'raw':!![],'where':{'id':_0x2ea91a['params']['id']}},_0x3c0f86={};_0x3c0f86['model']=_[_0x25d7('0x43')](db[_0x25d7('0x29')]['rawAttributes']);_0x3c0f86[_0x25d7('0x2e')]=_['keys'](_0x2ea91a[_0x25d7('0x2e')]);_0x3c0f86['filters']=_[_0x25d7('0x44')](_0x3c0f86[_0x25d7('0x31')],_0x3c0f86[_0x25d7('0x2e')]);_0x50d53c[_0x25d7('0x30')]=_['intersection'](_0x3c0f86[_0x25d7('0x31')],qs[_0x25d7('0x32')](_0x2ea91a[_0x25d7('0x2e')][_0x25d7('0x32')]));_0x50d53c['attributes']=_0x50d53c['attributes']['length']?_0x50d53c[_0x25d7('0x30')]:_0x3c0f86[_0x25d7('0x31')];if(_0x2ea91a[_0x25d7('0x2e')][_0x25d7('0x45')]){_0x50d53c['include']=[{'all':!![]}];}_0x50d53c=_[_0x25d7('0x39')]({},_0x50d53c,_0x2ea91a[_0x25d7('0x3d')]);return db[_0x25d7('0x29')][_0x25d7('0x46')](_0x50d53c)[_0x25d7('0x22')](handleEntityNotFound(_0x1d67eb,null))[_0x25d7('0x22')](respondWithResult(_0x1d67eb,null))['catch'](handleError(_0x1d67eb,null));};exports[_0x25d7('0x47')]=function(_0x4fad67,_0x3cdd66){return db[_0x25d7('0x29')][_0x25d7('0x47')](_0x4fad67[_0x25d7('0x48')],{})[_0x25d7('0x22')](respondWithResult(_0x3cdd66,0xc9))[_0x25d7('0x41')](handleError(_0x3cdd66,null));};exports[_0x25d7('0x49')]=function(_0x51f810,_0x532f10){if(_0x51f810['body']['id']){delete _0x51f810[_0x25d7('0x48')]['id'];}return db[_0x25d7('0x29')][_0x25d7('0x46')]({'where':{'id':_0x51f810[_0x25d7('0x4a')]['id']}})[_0x25d7('0x22')](handleEntityNotFound(_0x532f10,null))['then'](saveUpdates(_0x51f810[_0x25d7('0x48')],null))[_0x25d7('0x22')](respondWithResult(_0x532f10,null))[_0x25d7('0x41')](handleError(_0x532f10,null));};exports[_0x25d7('0x23')]=function(_0x4e8a8,_0x40e3b1){return db[_0x25d7('0x29')][_0x25d7('0x46')]({'where':{'id':_0x4e8a8['params']['id']}})['then'](handleEntityNotFound(_0x40e3b1,null))[_0x25d7('0x22')](removeEntity(_0x40e3b1,null))['catch'](handleError(_0x40e3b1,null));};exports[_0x25d7('0x4b')]=function(_0x2967b9,_0x682875){return db[_0x25d7('0x29')][_0x25d7('0x4b')]()[_0x25d7('0x22')](respondWithResult(_0x682875,null))['catch'](handleError(_0x682875,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index d2b9126..8f69193 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 _0x2ef3=['define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./openchannelQueueReport.attributes','exports'];(function(_0xbbf34a,_0x50d3c4){var _0x2f29c5=function(_0x584f37){while(--_0x584f37){_0xbbf34a['push'](_0xbbf34a['shift']());}};_0x2f29c5(++_0x50d3c4);}(_0x2ef3,0xba));var _0x32ef=function(_0x3c5b75,_0x2f3015){_0x3c5b75=_0x3c5b75-0x0;var _0x3dc846=_0x2ef3[_0x3c5b75];return _0x3dc846;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var logger=require(_0x32ef('0x2'))(_0x32ef('0x3'));var moment=require(_0x32ef('0x4'));var BPromise=require(_0x32ef('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x32ef('0x6'));var rimraf=require(_0x32ef('0x7'));var config=require('../../config/environment');var attributes=require(_0x32ef('0x8'));module[_0x32ef('0x9')]=function(_0x4c8104,_0x5dfa09){return _0x4c8104[_0x32ef('0xa')](_0x32ef('0xb'),attributes,{'tableName':_0x32ef('0xc'),'paranoid':![],'indexes':[{'name':_0x32ef('0xd'),'fields':[_0x32ef('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc4aa=['bluebird','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','../../config/logger','api','moment'];(function(_0x2e9151,_0xfb4fa7){var _0x2a33b5=function(_0x157605){while(--_0x157605){_0x2e9151['push'](_0x2e9151['shift']());}};_0x2a33b5(++_0xfb4fa7);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0xc4aa[_0x2064e5];return _0x21a233;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 1bf23ed..a9c5501 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 _0x4227=['CreateOpenchannelQueueReport','OpenchannelQueueReport','body','options','UpdateOpenchannelQueueReport','update','raw','attributes','limit','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch'];(function(_0x3f1861,_0x7b4285){var _0x7ca70a=function(_0x119b09){while(--_0x119b09){_0x3f1861['push'](_0x3f1861['shift']());}};_0x7ca70a(++_0x7b4285);}(_0x4227,0x89));var _0x7422=function(_0x24cebf,_0x60ac39){_0x24cebf=_0x24cebf-0x0;var _0x2e770a=_0x4227[_0x24cebf];return _0x2e770a;};'use strict';var _=require(_0x7422('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7422('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7422('0x2'));var db=require(_0x7422('0x3'))['db'];var utils=require(_0x7422('0x4'));var logger=require('../../config/logger')(_0x7422('0x5'));var config=require(_0x7422('0x6'));var jayson=require(_0x7422('0x7'));var client=jayson[_0x7422('0x8')][_0x7422('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b3432,_0xe99299,_0x45ca1a){return new BPromise(function(_0x12965e,_0x599d78){return client[_0x7422('0xa')](_0x2b3432,_0x45ca1a)[_0x7422('0xb')](function(_0x25de34){logger['info'](_0x7422('0xc'),_0xe99299,'request\x20sent');logger[_0x7422('0xd')](_0x7422('0xe'),_0xe99299,_0x7422('0xf'),JSON[_0x7422('0x10')](_0x25de34));if(_0x25de34[_0x7422('0x11')]){if(_0x25de34['error'][_0x7422('0x12')]===0x1f4){logger[_0x7422('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s',_0xe99299,_0x25de34[_0x7422('0x11')][_0x7422('0x13')]);return _0x599d78(_0x25de34['error'][_0x7422('0x13')]);}logger[_0x7422('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s',_0xe99299,_0x25de34['error'][_0x7422('0x13')]);return _0x12965e(_0x25de34['error'][_0x7422('0x13')]);}else{logger[_0x7422('0x14')]('OpenchannelQueueReport,\x20%s,\x20%s',_0xe99299,_0x7422('0xf'));_0x12965e(_0x25de34[_0x7422('0x15')][_0x7422('0x13')]);}})[_0x7422('0x16')](function(_0x2946ca){logger[_0x7422('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s',_0xe99299,_0x2946ca);_0x599d78(_0x2946ca);});});}exports[_0x7422('0x17')]=function(_0xa7ff41){var _0x493f59=this;return new Promise(function(_0x30656d,_0x57b8bf){return db[_0x7422('0x18')]['create'](_0xa7ff41[_0x7422('0x19')],{'raw':_0xa7ff41[_0x7422('0x1a')]?_0xa7ff41[_0x7422('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x7422('0xb')](function(_0xacaad1){logger[_0x7422('0x14')](_0x7422('0x17'),_0xa7ff41);logger['debug']('CreateOpenchannelQueueReport',_0xa7ff41,JSON[_0x7422('0x10')](_0xacaad1));_0x30656d(_0xacaad1);})[_0x7422('0x16')](function(_0x20c1e3){logger[_0x7422('0x11')](_0x7422('0x17'),_0x20c1e3[_0x7422('0x13')],_0xa7ff41);_0x57b8bf(_0x493f59[_0x7422('0x11')](0x1f4,_0x20c1e3['message']));});});};exports[_0x7422('0x1b')]=function(_0x46b927){var _0x4fc200=this;return new Promise(function(_0x3a5a0c,_0x23fb68){return db[_0x7422('0x18')][_0x7422('0x1c')](_0x46b927['body'],{'raw':_0x46b927[_0x7422('0x1a')]?_0x46b927[_0x7422('0x1a')][_0x7422('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46b927[_0x7422('0x1a')]?_0x46b927[_0x7422('0x1a')]['where']||null:null,'attributes':_0x46b927[_0x7422('0x1a')]?_0x46b927[_0x7422('0x1a')][_0x7422('0x1e')]||null:null,'limit':_0x46b927[_0x7422('0x1a')]?_0x46b927['options'][_0x7422('0x1f')]||null:null})[_0x7422('0xb')](function(_0x9b0144){logger[_0x7422('0x14')]('UpdateOpenchannelQueueReport',_0x46b927);logger[_0x7422('0xd')](_0x7422('0x1b'),_0x46b927,JSON['stringify'](_0x9b0144));_0x3a5a0c(_0x9b0144);})['catch'](function(_0x2baac6){logger[_0x7422('0x11')]('UpdateOpenchannelQueueReport',_0x2baac6[_0x7422('0x13')],_0x46b927);_0x23fb68(_0x4fc200[_0x7422('0x11')](0x1f4,_0x2baac6[_0x7422('0x13')]));});});}; \ No newline at end of file +var _0xbbbc=['jayson/promise','client','request','then','info','debug','request\x20sent','error','message','result','catch','CreateOpenchannelQueueReport','create','body','options','raw','stringify','UpdateOpenchannelQueueReport','OpenchannelQueueReport','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x414658,_0x32591f){_0x414658=_0x414658-0x0;var _0x3f33b8=_0xbbbc[_0x414658];return _0x3f33b8;};'use strict';var _=require(_0xcbbb('0x0'));var util=require(_0xcbbb('0x1'));var moment=require(_0xcbbb('0x2'));var BPromise=require(_0xcbbb('0x3'));var rs=require(_0xcbbb('0x4'));var fs=require('fs');var Redis=require(_0xcbbb('0x5'));var db=require(_0xcbbb('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xcbbb('0x7'))(_0xcbbb('0x8'));var config=require(_0xcbbb('0x9'));var jayson=require(_0xcbbb('0xa'));var client=jayson[_0xcbbb('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x388197,_0x1796b4,_0x32ec9c){return new BPromise(function(_0x6f4fd8,_0x356249){return client[_0xcbbb('0xc')](_0x388197,_0x32ec9c)[_0xcbbb('0xd')](function(_0x4ec90a){logger[_0xcbbb('0xe')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x1796b4,'request\x20sent');logger[_0xcbbb('0xf')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x1796b4,_0xcbbb('0x10'),JSON['stringify'](_0x4ec90a));if(_0x4ec90a[_0xcbbb('0x11')]){if(_0x4ec90a[_0xcbbb('0x11')]['code']===0x1f4){logger[_0xcbbb('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x1796b4,_0x4ec90a[_0xcbbb('0x11')]['message']);return _0x356249(_0x4ec90a[_0xcbbb('0x11')][_0xcbbb('0x12')]);}logger[_0xcbbb('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x1796b4,_0x4ec90a[_0xcbbb('0x11')][_0xcbbb('0x12')]);return _0x6f4fd8(_0x4ec90a[_0xcbbb('0x11')][_0xcbbb('0x12')]);}else{logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x1796b4,_0xcbbb('0x10'));_0x6f4fd8(_0x4ec90a[_0xcbbb('0x13')][_0xcbbb('0x12')]);}})[_0xcbbb('0x14')](function(_0x5e25ca){logger[_0xcbbb('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x1796b4,_0x5e25ca);_0x356249(_0x5e25ca);});});}exports[_0xcbbb('0x15')]=function(_0x3436af){var _0x3572bb=this;return new Promise(function(_0x5052df,_0x57c5e9){return db['OpenchannelQueueReport'][_0xcbbb('0x16')](_0x3436af[_0xcbbb('0x17')],{'raw':_0x3436af[_0xcbbb('0x18')]?_0x3436af[_0xcbbb('0x18')][_0xcbbb('0x19')]===undefined?!![]:![]:!![]})[_0xcbbb('0xd')](function(_0x45de5f){logger[_0xcbbb('0xe')](_0xcbbb('0x15'),_0x3436af);logger[_0xcbbb('0xf')]('CreateOpenchannelQueueReport',_0x3436af,JSON[_0xcbbb('0x1a')](_0x45de5f));_0x5052df(_0x45de5f);})[_0xcbbb('0x14')](function(_0x159c62){logger[_0xcbbb('0x11')](_0xcbbb('0x15'),_0x159c62[_0xcbbb('0x12')],_0x3436af);_0x57c5e9(_0x3572bb[_0xcbbb('0x11')](0x1f4,_0x159c62[_0xcbbb('0x12')]));});});};exports[_0xcbbb('0x1b')]=function(_0x5e3970){var _0xf39ddd=this;return new Promise(function(_0x4490c1,_0x4c543a){return db[_0xcbbb('0x1c')]['update'](_0x5e3970['body'],{'raw':_0x5e3970[_0xcbbb('0x18')]?_0x5e3970[_0xcbbb('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e3970['options']?_0x5e3970['options'][_0xcbbb('0x1d')]||null:null,'attributes':_0x5e3970['options']?_0x5e3970['options'][_0xcbbb('0x1e')]||null:null,'limit':_0x5e3970[_0xcbbb('0x18')]?_0x5e3970[_0xcbbb('0x18')][_0xcbbb('0x1f')]||null:null})[_0xcbbb('0xd')](function(_0x39ba8b){logger[_0xcbbb('0xe')](_0xcbbb('0x1b'),_0x5e3970);logger[_0xcbbb('0xf')](_0xcbbb('0x1b'),_0x5e3970,JSON[_0xcbbb('0x1a')](_0x39ba8b));_0x4490c1(_0x39ba8b);})[_0xcbbb('0x14')](function(_0xfa973b){logger[_0xcbbb('0x11')](_0xcbbb('0x1b'),_0xfa973b[_0xcbbb('0x12')],_0x5e3970);_0x4c543a(_0xf39ddd[_0xcbbb('0x11')](0x1f4,_0xfa973b[_0xcbbb('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index fbd38c3..109589d 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 _0x2553=['util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','post','create','put','update','delete','/:id','destroy','exports','multer'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x2553,0xc7));var _0x3255=function(_0x506d2f,_0x5ab76e){_0x506d2f=_0x506d2f-0x0;var _0x101255=_0x2553[_0x506d2f];return _0x101255;};'use strict';var multer=require(_0x3255('0x0'));var util=require(_0x3255('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3255('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x3255('0x3'));var interaction=require(_0x3255('0x4'));var config=require(_0x3255('0x5'));var controller=require('./openchannelTransferReport.controller');router[_0x3255('0x6')]('/',auth[_0x3255('0x7')](),controller[_0x3255('0x8')]);router[_0x3255('0x6')](_0x3255('0x9'),auth[_0x3255('0x7')](),controller[_0x3255('0xa')]);router[_0x3255('0x6')]('/:id',auth[_0x3255('0x7')](),controller[_0x3255('0xb')]);router[_0x3255('0xc')]('/',auth[_0x3255('0x7')](),controller[_0x3255('0xd')]);router[_0x3255('0xe')]('/:id',auth[_0x3255('0x7')](),controller[_0x3255('0xf')]);router[_0x3255('0x10')](_0x3255('0x11'),auth[_0x3255('0x7')](),controller[_0x3255('0x12')]);module[_0x3255('0x13')]=router; \ No newline at end of file +var _0xfdc1=['Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x531cb8,_0x8ef36f){var _0x5cf297=function(_0x45acb4){while(--_0x45acb4){_0x531cb8['push'](_0x531cb8['shift']());}};_0x5cf297(++_0x8ef36f);}(_0xfdc1,0x100));var _0x1fdc=function(_0x4c80d7,_0x2bef29){_0x4c80d7=_0x4c80d7-0x0;var _0x3c5095=_0xfdc1[_0x4c80d7];return _0x3c5095;};'use strict';var multer=require('multer');var util=require(_0x1fdc('0x0'));var path=require(_0x1fdc('0x1'));var timeout=require(_0x1fdc('0x2'));var express=require(_0x1fdc('0x3'));var router=express[_0x1fdc('0x4')]();var fs_extra=require(_0x1fdc('0x5'));var auth=require(_0x1fdc('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./openchannelTransferReport.controller');router[_0x1fdc('0x7')]('/',auth[_0x1fdc('0x8')](),controller[_0x1fdc('0x9')]);router[_0x1fdc('0x7')](_0x1fdc('0xa'),auth[_0x1fdc('0x8')](),controller[_0x1fdc('0xb')]);router['get'](_0x1fdc('0xc'),auth[_0x1fdc('0x8')](),controller['show']);router[_0x1fdc('0xd')]('/',auth['isAuthenticated'](),controller[_0x1fdc('0xe')]);router[_0x1fdc('0xf')](_0x1fdc('0xc'),auth['isAuthenticated'](),controller[_0x1fdc('0x10')]);router[_0x1fdc('0x11')](_0x1fdc('0xc'),auth[_0x1fdc('0x8')](),controller[_0x1fdc('0x12')]);module[_0x1fdc('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index d50d428..b513122 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 _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x27314d,_0x33c0f2){var _0x30a648=function(_0x21e50b){while(--_0x21e50b){_0x27314d['push'](_0x27314d['shift']());}};_0x30a648(++_0x33c0f2);}(_0x9c44,0x178));var _0x49c4=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x9c44[_0x36c5b0];return _0xf19333;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file +var _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x12efd7,_0x14202f){var _0x4bb9b2=function(_0x57e640){while(--_0x57e640){_0x12efd7['push'](_0x12efd7['shift']());}};_0x4bb9b2(++_0x14202f);}(_0x008c,0x188));var _0xc008=function(_0x52598d,_0x10fb73){_0x52598d=_0x52598d-0x0;var _0x170309=_0x008c[_0x52598d];return _0x170309;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index a128826..f3ea0e9 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 _0x4124=['hasOwnProperty','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','catch','show','rawAttributes','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','bluebird','mustache','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','destroy','then','name','index','map','OpenchannelTransferReport','fieldName','type','key','query','keys','intersection','model','fields','attributes','length'];(function(_0xdeff63,_0x2032c6){var _0x5b9101=function(_0x10f1ec){while(--_0x10f1ec){_0xdeff63['push'](_0xdeff63['shift']());}};_0x5b9101(++_0x2032c6);}(_0x4124,0x128));var _0x4412=function(_0x57671a,_0x303181){_0x57671a=_0x57671a-0x0;var _0x523694=_0x4124[_0x57671a];return _0x523694;};'use strict';var emlformat=require(_0x4412('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4412('0x1'));var jsonpatch=require(_0x4412('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4412('0x3'));var Mustache=require(_0x4412('0x4'));var util=require('util');var path=require('path');var sox=require(_0x4412('0x5'));var csv=require(_0x4412('0x6'));var ejs=require(_0x4412('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4412('0x8'));var squel=require(_0x4412('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4412('0xa'));var toCsv=require(_0x4412('0x6'));var querystring=require(_0x4412('0xb'));var Papa=require(_0x4412('0xc'));var Redis=require('ioredis');var authService=require(_0x4412('0xd'));var qs=require(_0x4412('0xe'));var as=require(_0x4412('0xf'));var hardwareService=require(_0x4412('0x10'));var logger=require('../../config/logger')(_0x4412('0x11'));var utils=require('../../config/utils');var config=require(_0x4412('0x12'));var licenseUtil=require(_0x4412('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x32472a,_0x11c299){_0x11c299=_0x11c299||0xcc;return function(_0x53cfb1){if(_0x53cfb1){return _0x32472a[_0x4412('0x14')](_0x11c299);}return _0x32472a[_0x4412('0x15')](_0x11c299)[_0x4412('0x16')]();};}function respondWithResult(_0x3cc6fc,_0x5c1a7a){_0x5c1a7a=_0x5c1a7a||0xc8;return function(_0x4f1670){if(_0x4f1670){return _0x3cc6fc[_0x4412('0x15')](_0x5c1a7a)[_0x4412('0x17')](_0x4f1670);}};}function respondWithFilteredResult(_0x5f2769,_0x1ae385){return function(_0x29b630){if(_0x29b630){var _0x5dd429=typeof _0x1ae385[_0x4412('0x18')]==='undefined'&&typeof _0x1ae385[_0x4412('0x19')]===_0x4412('0x1a');var _0x52f052=_0x29b630[_0x4412('0x1b')];var _0x5b4b09=_0x5dd429?0x0:_0x1ae385['offset'];var _0x4bb8fc=_0x5dd429?_0x29b630[_0x4412('0x1b')]:_0x1ae385['offset']+_0x1ae385['limit'];var _0x37318e;if(_0x4bb8fc>=_0x52f052){_0x4bb8fc=_0x52f052;_0x37318e=0xc8;}else{_0x37318e=0xce;}_0x5f2769[_0x4412('0x15')](_0x37318e);return _0x5f2769[_0x4412('0x1c')](_0x4412('0x1d'),_0x5b4b09+'-'+_0x4bb8fc+'/'+_0x52f052)[_0x4412('0x17')](_0x29b630);}return null;};}function patchUpdates(_0x38989f){return function(_0x3a248b){try{jsonpatch[_0x4412('0x1e')](_0x3a248b,_0x38989f,!![]);}catch(_0x41d525){return BPromise[_0x4412('0x1f')](_0x41d525);}return _0x3a248b['save']();};}function saveUpdates(_0x4a4ab3,_0x24f817){return function(_0x4ac023){if(_0x4ac023){return _0x4ac023[_0x4412('0x20')](_0x4a4ab3)['then'](function(_0x35e4a2){return _0x35e4a2;});}return null;};}function removeEntity(_0x44f81b,_0x399dd1){return function(_0x348787){if(_0x348787){return _0x348787[_0x4412('0x21')]()[_0x4412('0x22')](function(){_0x44f81b[_0x4412('0x15')](0xcc)[_0x4412('0x16')]();});}};}function handleEntityNotFound(_0x308a02,_0x569f5b){return function(_0x4ea49c){if(!_0x4ea49c){_0x308a02[_0x4412('0x14')](0x194);}return _0x4ea49c;};}function handleError(_0x74be29,_0x380fb8){_0x380fb8=_0x380fb8||0x1f4;return function(_0x4630e0){logger['error'](_0x4630e0['stack']);if(_0x4630e0[_0x4412('0x23')]){delete _0x4630e0[_0x4412('0x23')];}_0x74be29[_0x4412('0x15')](_0x380fb8)['send'](_0x4630e0);};}exports[_0x4412('0x24')]=function(_0x4db15c,_0xd06d2f){var _0xb9f6a={},_0x19d0c8={},_0x104108={'count':0x0,'rows':[]};var _0x3d0465=_[_0x4412('0x25')](db[_0x4412('0x26')]['rawAttributes'],function(_0x1285da){return{'name':_0x1285da[_0x4412('0x27')],'type':_0x1285da[_0x4412('0x28')][_0x4412('0x29')]};});_0x19d0c8['model']=_['map'](_0x3d0465,_0x4412('0x23'));_0x19d0c8[_0x4412('0x2a')]=_[_0x4412('0x2b')](_0x4db15c[_0x4412('0x2a')]);_0x19d0c8['filters']=_[_0x4412('0x2c')](_0x19d0c8[_0x4412('0x2d')],_0x19d0c8[_0x4412('0x2a')]);_0xb9f6a['attributes']=_[_0x4412('0x2c')](_0x19d0c8['model'],qs[_0x4412('0x2e')](_0x4db15c['query'][_0x4412('0x2e')]));_0xb9f6a[_0x4412('0x2f')]=_0xb9f6a['attributes'][_0x4412('0x30')]?_0xb9f6a['attributes']:_0x19d0c8[_0x4412('0x2d')];if(!_0x4db15c['query'][_0x4412('0x31')]('nolimit')){_0xb9f6a[_0x4412('0x19')]=qs['limit'](_0x4db15c[_0x4412('0x2a')]['limit']);_0xb9f6a[_0x4412('0x18')]=qs[_0x4412('0x18')](_0x4db15c[_0x4412('0x2a')]['offset']);}_0xb9f6a[_0x4412('0x32')]=qs[_0x4412('0x33')](_0x4db15c[_0x4412('0x2a')]['sort']);_0xb9f6a[_0x4412('0x34')]=qs['filters'](_[_0x4412('0x35')](_0x4db15c[_0x4412('0x2a')],_0x19d0c8[_0x4412('0x36')]),_0x3d0465);if(_0x4db15c[_0x4412('0x2a')][_0x4412('0x37')]){_0xb9f6a[_0x4412('0x34')]=_[_0x4412('0x38')](_0xb9f6a[_0x4412('0x34')],{'$or':_[_0x4412('0x25')](_0x3d0465,function(_0x1aca37){if(_0x1aca37[_0x4412('0x28')]!==_0x4412('0x39')){var _0x356a72={};_0x356a72[_0x1aca37[_0x4412('0x23')]]={'$like':'%'+_0x4db15c[_0x4412('0x2a')][_0x4412('0x37')]+'%'};return _0x356a72;}})});}_0xb9f6a=_[_0x4412('0x38')]({},_0xb9f6a,_0x4db15c[_0x4412('0x3a')]);var _0x58f838={'where':_0xb9f6a[_0x4412('0x34')]};return db[_0x4412('0x26')][_0x4412('0x1b')](_0x58f838)['then'](function(_0x2748d4){_0x104108['count']=_0x2748d4;if(_0x4db15c[_0x4412('0x2a')][_0x4412('0x3b')]){_0xb9f6a[_0x4412('0x3c')]=[{'all':!![]}];}return db['OpenchannelTransferReport']['findAll'](_0xb9f6a);})[_0x4412('0x22')](function(_0xe7744b){_0x104108['rows']=_0xe7744b;return _0x104108;})[_0x4412('0x22')](respondWithFilteredResult(_0xd06d2f,_0xb9f6a))[_0x4412('0x3d')](handleError(_0xd06d2f,null));};exports[_0x4412('0x3e')]=function(_0x14ab8b,_0x12a1bb){var _0x1a8a83={'raw':!![],'where':{'id':_0x14ab8b['params']['id']}},_0x4d8b36={};_0x4d8b36[_0x4412('0x2d')]=_[_0x4412('0x2b')](db['OpenchannelTransferReport'][_0x4412('0x3f')]);_0x4d8b36['query']=_[_0x4412('0x2b')](_0x14ab8b[_0x4412('0x2a')]);_0x4d8b36[_0x4412('0x36')]=_['intersection'](_0x4d8b36[_0x4412('0x2d')],_0x4d8b36[_0x4412('0x2a')]);_0x1a8a83[_0x4412('0x2f')]=_[_0x4412('0x2c')](_0x4d8b36[_0x4412('0x2d')],qs[_0x4412('0x2e')](_0x14ab8b[_0x4412('0x2a')]['fields']));_0x1a8a83[_0x4412('0x2f')]=_0x1a8a83[_0x4412('0x2f')]['length']?_0x1a8a83[_0x4412('0x2f')]:_0x4d8b36[_0x4412('0x2d')];if(_0x14ab8b[_0x4412('0x2a')][_0x4412('0x3b')]){_0x1a8a83[_0x4412('0x3c')]=[{'all':!![]}];}_0x1a8a83=_[_0x4412('0x38')]({},_0x1a8a83,_0x14ab8b[_0x4412('0x3a')]);return db[_0x4412('0x26')][_0x4412('0x40')](_0x1a8a83)[_0x4412('0x22')](handleEntityNotFound(_0x12a1bb,null))['then'](respondWithResult(_0x12a1bb,null))[_0x4412('0x3d')](handleError(_0x12a1bb,null));};exports[_0x4412('0x41')]=function(_0x8312ac,_0x2a63b3){return db[_0x4412('0x26')]['create'](_0x8312ac[_0x4412('0x42')],{})[_0x4412('0x22')](respondWithResult(_0x2a63b3,0xc9))['catch'](handleError(_0x2a63b3,null));};exports['update']=function(_0xce3727,_0x472ac6){if(_0xce3727[_0x4412('0x42')]['id']){delete _0xce3727[_0x4412('0x42')]['id'];}return db[_0x4412('0x26')][_0x4412('0x40')]({'where':{'id':_0xce3727['params']['id']}})[_0x4412('0x22')](handleEntityNotFound(_0x472ac6,null))[_0x4412('0x22')](saveUpdates(_0xce3727['body'],null))['then'](respondWithResult(_0x472ac6,null))['catch'](handleError(_0x472ac6,null));};exports[_0x4412('0x21')]=function(_0x2d9b98,_0x44a8fd){return db[_0x4412('0x26')][_0x4412('0x40')]({'where':{'id':_0x2d9b98[_0x4412('0x43')]['id']}})['then'](handleEntityNotFound(_0x44a8fd,null))[_0x4412('0x22')](removeEntity(_0x44a8fd,null))[_0x4412('0x3d')](handleError(_0x44a8fd,null));};exports['describe']=function(_0x235e5f,_0x30df90){return db[_0x4412('0x26')][_0x4412('0x44')]()[_0x4412('0x22')](respondWithResult(_0x30df90,null))['catch'](handleError(_0x30df90,null));}; \ No newline at end of file +var _0x0553=['map','OpenchannelTransferReport','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','includeAll','include','findAll','catch','show','params','create','body','find','describe','eml-format','rimraf','moment','bluebird','util','sox','ejs','fs-extra','lodash','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','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index'];(function(_0x4828c5,_0x1388d4){var _0x49ac52=function(_0x27df5a){while(--_0x27df5a){_0x4828c5['push'](_0x4828c5['shift']());}};_0x49ac52(++_0x1388d4);}(_0x0553,0x186));var _0x3055=function(_0x39d89b,_0x413243){_0x39d89b=_0x39d89b-0x0;var _0x477b21=_0x0553[_0x39d89b];return _0x477b21;};'use strict';var emlformat=require(_0x3055('0x0'));var rimraf=require(_0x3055('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3055('0x2'));var BPromise=require(_0x3055('0x3'));var Mustache=require('mustache');var util=require(_0x3055('0x4'));var path=require('path');var sox=require(_0x3055('0x5'));var csv=require('to-csv');var ejs=require(_0x3055('0x6'));var fs=require('fs');var fs_extra=require(_0x3055('0x7'));var _=require(_0x3055('0x8'));var squel=require('squel');var crypto=require(_0x3055('0x9'));var jsforce=require(_0x3055('0xa'));var deskjs=require(_0x3055('0xb'));var toCsv=require('to-csv');var querystring=require(_0x3055('0xc'));var Papa=require(_0x3055('0xd'));var Redis=require('ioredis');var authService=require(_0x3055('0xe'));var qs=require(_0x3055('0xf'));var as=require(_0x3055('0x10'));var hardwareService=require(_0x3055('0x11'));var logger=require(_0x3055('0x12'))('api');var utils=require(_0x3055('0x13'));var config=require(_0x3055('0x14'));var licenseUtil=require(_0x3055('0x15'));var db=require(_0x3055('0x16'))['db'];function respondWithStatusCode(_0x47ff2c,_0x1f1b1c){_0x1f1b1c=_0x1f1b1c||0xcc;return function(_0x234bbd){if(_0x234bbd){return _0x47ff2c[_0x3055('0x17')](_0x1f1b1c);}return _0x47ff2c[_0x3055('0x18')](_0x1f1b1c)[_0x3055('0x19')]();};}function respondWithResult(_0x171487,_0x418914){_0x418914=_0x418914||0xc8;return function(_0x2d5465){if(_0x2d5465){return _0x171487[_0x3055('0x18')](_0x418914)[_0x3055('0x1a')](_0x2d5465);}};}function respondWithFilteredResult(_0x1c6a0a,_0x51bc40){return function(_0x51e914){if(_0x51e914){var _0x40e9d9=typeof _0x51bc40[_0x3055('0x1b')]===_0x3055('0x1c')&&typeof _0x51bc40[_0x3055('0x1d')]==='undefined';var _0x452a6b=_0x51e914[_0x3055('0x1e')];var _0x2efed6=_0x40e9d9?0x0:_0x51bc40[_0x3055('0x1b')];var _0x2c2035=_0x40e9d9?_0x51e914[_0x3055('0x1e')]:_0x51bc40[_0x3055('0x1b')]+_0x51bc40[_0x3055('0x1d')];var _0x5be472;if(_0x2c2035>=_0x452a6b){_0x2c2035=_0x452a6b;_0x5be472=0xc8;}else{_0x5be472=0xce;}_0x1c6a0a[_0x3055('0x18')](_0x5be472);return _0x1c6a0a['set'](_0x3055('0x1f'),_0x2efed6+'-'+_0x2c2035+'/'+_0x452a6b)[_0x3055('0x1a')](_0x51e914);}return null;};}function patchUpdates(_0x2a9812){return function(_0x5bd307){try{jsonpatch[_0x3055('0x20')](_0x5bd307,_0x2a9812,!![]);}catch(_0x13edee){return BPromise[_0x3055('0x21')](_0x13edee);}return _0x5bd307[_0x3055('0x22')]();};}function saveUpdates(_0x2a1440,_0x12bcc5){return function(_0x20d836){if(_0x20d836){return _0x20d836[_0x3055('0x23')](_0x2a1440)[_0x3055('0x24')](function(_0x58f249){return _0x58f249;});}return null;};}function removeEntity(_0x4039dc,_0x58c77c){return function(_0x3cdb94){if(_0x3cdb94){return _0x3cdb94[_0x3055('0x25')]()[_0x3055('0x24')](function(){_0x4039dc[_0x3055('0x18')](0xcc)[_0x3055('0x19')]();});}};}function handleEntityNotFound(_0x29819e,_0x2b9ecf){return function(_0x25cf61){if(!_0x25cf61){_0x29819e[_0x3055('0x17')](0x194);}return _0x25cf61;};}function handleError(_0x304eb0,_0x1e4f2b){_0x1e4f2b=_0x1e4f2b||0x1f4;return function(_0x310e6b){logger[_0x3055('0x26')](_0x310e6b['stack']);if(_0x310e6b[_0x3055('0x27')]){delete _0x310e6b[_0x3055('0x27')];}_0x304eb0[_0x3055('0x18')](_0x1e4f2b)[_0x3055('0x28')](_0x310e6b);};}exports[_0x3055('0x29')]=function(_0x4a1ff5,_0x2e60e4){var _0x41d714={},_0xa207f3={},_0x4b9145={'count':0x0,'rows':[]};var _0x4146df=_[_0x3055('0x2a')](db[_0x3055('0x2b')][_0x3055('0x2c')],function(_0x5050a7){return{'name':_0x5050a7['fieldName'],'type':_0x5050a7[_0x3055('0x2d')][_0x3055('0x2e')]};});_0xa207f3['model']=_[_0x3055('0x2a')](_0x4146df,_0x3055('0x27'));_0xa207f3[_0x3055('0x2f')]=_[_0x3055('0x30')](_0x4a1ff5[_0x3055('0x2f')]);_0xa207f3[_0x3055('0x31')]=_[_0x3055('0x32')](_0xa207f3[_0x3055('0x33')],_0xa207f3['query']);_0x41d714['attributes']=_[_0x3055('0x32')](_0xa207f3['model'],qs[_0x3055('0x34')](_0x4a1ff5[_0x3055('0x2f')][_0x3055('0x34')]));_0x41d714[_0x3055('0x35')]=_0x41d714[_0x3055('0x35')][_0x3055('0x36')]?_0x41d714[_0x3055('0x35')]:_0xa207f3[_0x3055('0x33')];if(!_0x4a1ff5[_0x3055('0x2f')][_0x3055('0x37')](_0x3055('0x38'))){_0x41d714[_0x3055('0x1d')]=qs[_0x3055('0x1d')](_0x4a1ff5[_0x3055('0x2f')]['limit']);_0x41d714['offset']=qs[_0x3055('0x1b')](_0x4a1ff5[_0x3055('0x2f')][_0x3055('0x1b')]);}_0x41d714['order']=qs[_0x3055('0x39')](_0x4a1ff5['query'][_0x3055('0x39')]);_0x41d714[_0x3055('0x3a')]=qs[_0x3055('0x31')](_['pick'](_0x4a1ff5['query'],_0xa207f3[_0x3055('0x31')]),_0x4146df);if(_0x4a1ff5[_0x3055('0x2f')][_0x3055('0x3b')]){_0x41d714['where']=_[_0x3055('0x3c')](_0x41d714[_0x3055('0x3a')],{'$or':_['map'](_0x4146df,function(_0x2a83d5){if(_0x2a83d5[_0x3055('0x2d')]!=='VIRTUAL'){var _0x400ee9={};_0x400ee9[_0x2a83d5[_0x3055('0x27')]]={'$like':'%'+_0x4a1ff5['query']['filter']+'%'};return _0x400ee9;}})});}_0x41d714=_[_0x3055('0x3c')]({},_0x41d714,_0x4a1ff5[_0x3055('0x3d')]);var _0x22d1f7={'where':_0x41d714[_0x3055('0x3a')]};return db[_0x3055('0x2b')][_0x3055('0x1e')](_0x22d1f7)[_0x3055('0x24')](function(_0x2519ee){_0x4b9145['count']=_0x2519ee;if(_0x4a1ff5[_0x3055('0x2f')][_0x3055('0x3e')]){_0x41d714[_0x3055('0x3f')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0x3055('0x40')](_0x41d714);})[_0x3055('0x24')](function(_0x229dd6){_0x4b9145['rows']=_0x229dd6;return _0x4b9145;})[_0x3055('0x24')](respondWithFilteredResult(_0x2e60e4,_0x41d714))[_0x3055('0x41')](handleError(_0x2e60e4,null));};exports[_0x3055('0x42')]=function(_0x49b12c,_0x45d8d8){var _0x21a1af={'raw':!![],'where':{'id':_0x49b12c[_0x3055('0x43')]['id']}},_0x38c51b={};_0x38c51b[_0x3055('0x33')]=_[_0x3055('0x30')](db[_0x3055('0x2b')]['rawAttributes']);_0x38c51b[_0x3055('0x2f')]=_[_0x3055('0x30')](_0x49b12c[_0x3055('0x2f')]);_0x38c51b[_0x3055('0x31')]=_['intersection'](_0x38c51b[_0x3055('0x33')],_0x38c51b[_0x3055('0x2f')]);_0x21a1af[_0x3055('0x35')]=_[_0x3055('0x32')](_0x38c51b['model'],qs[_0x3055('0x34')](_0x49b12c[_0x3055('0x2f')][_0x3055('0x34')]));_0x21a1af['attributes']=_0x21a1af[_0x3055('0x35')][_0x3055('0x36')]?_0x21a1af[_0x3055('0x35')]:_0x38c51b[_0x3055('0x33')];if(_0x49b12c[_0x3055('0x2f')][_0x3055('0x3e')]){_0x21a1af['include']=[{'all':!![]}];}_0x21a1af=_['merge']({},_0x21a1af,_0x49b12c[_0x3055('0x3d')]);return db[_0x3055('0x2b')]['find'](_0x21a1af)[_0x3055('0x24')](handleEntityNotFound(_0x45d8d8,null))[_0x3055('0x24')](respondWithResult(_0x45d8d8,null))[_0x3055('0x41')](handleError(_0x45d8d8,null));};exports['create']=function(_0x50249c,_0x506475){return db['OpenchannelTransferReport'][_0x3055('0x44')](_0x50249c[_0x3055('0x45')],{})['then'](respondWithResult(_0x506475,0xc9))[_0x3055('0x41')](handleError(_0x506475,null));};exports['update']=function(_0x34a31d,_0x61d1bd){if(_0x34a31d[_0x3055('0x45')]['id']){delete _0x34a31d[_0x3055('0x45')]['id'];}return db[_0x3055('0x2b')][_0x3055('0x46')]({'where':{'id':_0x34a31d[_0x3055('0x43')]['id']}})['then'](handleEntityNotFound(_0x61d1bd,null))[_0x3055('0x24')](saveUpdates(_0x34a31d['body'],null))['then'](respondWithResult(_0x61d1bd,null))['catch'](handleError(_0x61d1bd,null));};exports[_0x3055('0x25')]=function(_0x17ac81,_0xef50a0){return db[_0x3055('0x2b')][_0x3055('0x46')]({'where':{'id':_0x17ac81[_0x3055('0x43')]['id']}})[_0x3055('0x24')](handleEntityNotFound(_0xef50a0,null))[_0x3055('0x24')](removeEntity(_0xef50a0,null))[_0x3055('0x41')](handleError(_0xef50a0,null));};exports[_0x3055('0x47')]=function(_0xf372e2,_0x4f3a0a){return db[_0x3055('0x2b')][_0x3055('0x47')]()[_0x3055('0x24')](respondWithResult(_0x4f3a0a,null))[_0x3055('0x41')](handleError(_0x4f3a0a,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index a16528d..cb2bb08 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 _0x54ab=['path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','api','bluebird','request-promise'];(function(_0x264f53,_0x33db5f){var _0x490668=function(_0xc3a7d4){while(--_0xc3a7d4){_0x264f53['push'](_0x264f53['shift']());}};_0x490668(++_0x33db5f);}(_0x54ab,0xf7));var _0xb54a=function(_0x14ca4e,_0x2ca826){_0x14ca4e=_0x14ca4e-0x0;var _0x157e46=_0x54ab[_0x14ca4e];return _0x157e46;};'use strict';var _=require(_0xb54a('0x0'));var util=require(_0xb54a('0x1'));var logger=require('../../config/logger')(_0xb54a('0x2'));var moment=require('moment');var BPromise=require(_0xb54a('0x3'));var rp=require(_0xb54a('0x4'));var fs=require('fs');var path=require(_0xb54a('0x5'));var rimraf=require(_0xb54a('0x6'));var config=require(_0xb54a('0x7'));var attributes=require(_0xb54a('0x8'));module[_0xb54a('0x9')]=function(_0x40f876,_0x21bee8){return _0x40f876[_0xb54a('0xa')](_0xb54a('0xb'),attributes,{'tableName':_0xb54a('0xc'),'paranoid':![],'indexes':[{'name':_0xb54a('0xd'),'fields':[_0xb54a('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x15c4=['./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x18de8c,_0x4505c7){var _0x255fef=function(_0x2e6a41){while(--_0x2e6a41){_0x18de8c['push'](_0x18de8c['shift']());}};_0x255fef(++_0x4505c7);}(_0x15c4,0x11a));var _0x415c=function(_0x41938d,_0x54c6a4){_0x41938d=_0x41938d-0x0;var _0x3395c4=_0x15c4[_0x41938d];return _0x3395c4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x415c('0x0'))(_0x415c('0x1'));var moment=require('moment');var BPromise=require(_0x415c('0x2'));var rp=require(_0x415c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x415c('0x4'));var config=require(_0x415c('0x5'));var attributes=require(_0x415c('0x6'));module[_0x415c('0x7')]=function(_0x2f690e,_0x29c580){return _0x2f690e[_0x415c('0x8')](_0x415c('0x9'),attributes,{'tableName':_0x415c('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x415c('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 8edbd66..80ca747 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 _0x102b=['error','code','OpenchannelTransferReport,\x20%s,\x20%s','message','info','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request\x20sent','debug','stringify'];(function(_0x20fe10,_0x4aa816){var _0x5202ac=function(_0x14a8d1){while(--_0x14a8d1){_0x20fe10['push'](_0x20fe10['shift']());}};_0x5202ac(++_0x4aa816);}(_0x102b,0x1be));var _0xb102=function(_0x52eeaa,_0x4591f8){_0x52eeaa=_0x52eeaa-0x0;var _0x5c9216=_0x102b[_0x52eeaa];return _0x5c9216;};'use strict';var _=require('lodash');var util=require(_0xb102('0x0'));var moment=require('moment');var BPromise=require(_0xb102('0x1'));var rs=require(_0xb102('0x2'));var fs=require('fs');var Redis=require(_0xb102('0x3'));var db=require(_0xb102('0x4'))['db'];var utils=require(_0xb102('0x5'));var logger=require(_0xb102('0x6'))(_0xb102('0x7'));var config=require(_0xb102('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb102('0x9')][_0xb102('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xd131eb,_0x256052,_0x1ee0c0){return new BPromise(function(_0x5879bb,_0x338e0f){return client['request'](_0xd131eb,_0x1ee0c0)['then'](function(_0xee2164){logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x256052,_0xb102('0xb'));logger[_0xb102('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x256052,_0xb102('0xb'),JSON[_0xb102('0xd')](_0xee2164));if(_0xee2164[_0xb102('0xe')]){if(_0xee2164[_0xb102('0xe')][_0xb102('0xf')]===0x1f4){logger[_0xb102('0xe')](_0xb102('0x10'),_0x256052,_0xee2164['error'][_0xb102('0x11')]);return _0x338e0f(_0xee2164['error'][_0xb102('0x11')]);}logger[_0xb102('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x256052,_0xee2164[_0xb102('0xe')][_0xb102('0x11')]);return _0x5879bb(_0xee2164['error'][_0xb102('0x11')]);}else{logger[_0xb102('0x12')](_0xb102('0x10'),_0x256052,'request\x20sent');_0x5879bb(_0xee2164['result']['message']);}})[_0xb102('0x13')](function(_0x7f3487){logger[_0xb102('0xe')](_0xb102('0x10'),_0x256052,_0x7f3487);_0x338e0f(_0x7f3487);});});} \ No newline at end of file +var _0xc3a8=['result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','message','OpenchannelTransferReport,\x20%s,\x20%s'];(function(_0x509816,_0x489abc){var _0x3d654e=function(_0x17fb14){while(--_0x17fb14){_0x509816['push'](_0x509816['shift']());}};_0x3d654e(++_0x489abc);}(_0xc3a8,0xe8));var _0x8c3a=function(_0xf34109,_0x380779){_0xf34109=_0xf34109-0x0;var _0x570bfc=_0xc3a8[_0xf34109];return _0x570bfc;};'use strict';var _=require(_0x8c3a('0x0'));var util=require(_0x8c3a('0x1'));var moment=require(_0x8c3a('0x2'));var BPromise=require('bluebird');var rs=require(_0x8c3a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8c3a('0x4'))['db'];var utils=require(_0x8c3a('0x5'));var logger=require(_0x8c3a('0x6'))(_0x8c3a('0x7'));var config=require('../../config/environment');var jayson=require(_0x8c3a('0x8'));var client=jayson[_0x8c3a('0x9')][_0x8c3a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x170999,_0x2fae6f,_0x37047e){return new BPromise(function(_0x58a9b0,_0x174e6c){return client[_0x8c3a('0xb')](_0x170999,_0x37047e)[_0x8c3a('0xc')](function(_0x1593a7){logger[_0x8c3a('0xd')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x2fae6f,_0x8c3a('0xe'));logger[_0x8c3a('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x2fae6f,_0x8c3a('0xe'),JSON[_0x8c3a('0x10')](_0x1593a7));if(_0x1593a7[_0x8c3a('0x11')]){if(_0x1593a7[_0x8c3a('0x11')][_0x8c3a('0x12')]===0x1f4){logger[_0x8c3a('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x2fae6f,_0x1593a7[_0x8c3a('0x11')]['message']);return _0x174e6c(_0x1593a7['error'][_0x8c3a('0x13')]);}logger[_0x8c3a('0x11')](_0x8c3a('0x14'),_0x2fae6f,_0x1593a7[_0x8c3a('0x11')][_0x8c3a('0x13')]);return _0x58a9b0(_0x1593a7[_0x8c3a('0x11')][_0x8c3a('0x13')]);}else{logger[_0x8c3a('0xd')](_0x8c3a('0x14'),_0x2fae6f,'request\x20sent');_0x58a9b0(_0x1593a7[_0x8c3a('0x15')][_0x8c3a('0x13')]);}})[_0x8c3a('0x16')](function(_0x1ee355){logger[_0x8c3a('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x2fae6f,_0x1ee355);_0x174e6c(_0x1ee355);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 0e88169..e837c24 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 _0xaff1=['isAuthenticated','index','get','show','post','create','put','/:id','update','delete','destroy','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaff1,0x1d3));var _0x1aff=function(_0x58aeb9,_0x6c3f84){_0x58aeb9=_0x58aeb9-0x0;var _0xc3130a=_0xaff1[_0x58aeb9];return _0xc3130a;};'use strict';var multer=require('multer');var util=require(_0x1aff('0x0'));var path=require('path');var timeout=require(_0x1aff('0x1'));var express=require(_0x1aff('0x2'));var router=express['Router']();var fs_extra=require(_0x1aff('0x3'));var auth=require(_0x1aff('0x4'));var interaction=require(_0x1aff('0x5'));var config=require(_0x1aff('0x6'));var controller=require(_0x1aff('0x7'));router['get']('/',auth[_0x1aff('0x8')](),controller[_0x1aff('0x9')]);router[_0x1aff('0xa')]('/:id',auth[_0x1aff('0x8')](),controller[_0x1aff('0xb')]);router[_0x1aff('0xc')]('/',auth[_0x1aff('0x8')](),controller[_0x1aff('0xd')]);router[_0x1aff('0xe')](_0x1aff('0xf'),auth[_0x1aff('0x8')](),controller[_0x1aff('0x10')]);router[_0x1aff('0x11')](_0x1aff('0xf'),auth['isAuthenticated'](),controller[_0x1aff('0x12')]);module['exports']=router; \ No newline at end of file +var _0xaa9b=['isAuthenticated','index','/:id','post','create','put','update','delete','destroy','multer','util','express','fs-extra','../../components/interaction/service','../../config/environment','./pause.controller','get'];(function(_0x4abe3d,_0x410aee){var _0xa5246c=function(_0x12c332){while(--_0x12c332){_0x4abe3d['push'](_0x4abe3d['shift']());}};_0xa5246c(++_0x410aee);}(_0xaa9b,0x16e));var _0xbaa9=function(_0x4603f8,_0x3bd1c6){_0x4603f8=_0x4603f8-0x0;var _0x37e621=_0xaa9b[_0x4603f8];return _0x37e621;};'use strict';var multer=require(_0xbaa9('0x0'));var util=require(_0xbaa9('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbaa9('0x2'));var router=express['Router']();var fs_extra=require(_0xbaa9('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xbaa9('0x4'));var config=require(_0xbaa9('0x5'));var controller=require(_0xbaa9('0x6'));router[_0xbaa9('0x7')]('/',auth[_0xbaa9('0x8')](),controller[_0xbaa9('0x9')]);router[_0xbaa9('0x7')](_0xbaa9('0xa'),auth[_0xbaa9('0x8')](),controller['show']);router[_0xbaa9('0xb')]('/',auth[_0xbaa9('0x8')](),controller[_0xbaa9('0xc')]);router[_0xbaa9('0xd')](_0xbaa9('0xa'),auth[_0xbaa9('0x8')](),controller[_0xbaa9('0xe')]);router[_0xbaa9('0xf')](_0xbaa9('0xa'),auth[_0xbaa9('0x8')](),controller[_0xbaa9('0x10')]);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 1a5613c..a839b33 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 _0x8db7=['exports','STRING','name','sequelize'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8db7,0x12f));var _0x78db=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x8db7[_0x49b207];return _0x2dc8fa;};'use strict';var Sequelize=require(_0x78db('0x0'));module[_0x78db('0x1')]={'name':{'type':Sequelize[_0x78db('0x2')],'unique':_0x78db('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x78db('0x2')]}}; \ No newline at end of file +var _0xc9b2=['name','sequelize','exports','STRING'];(function(_0x5a4634,_0x592869){var _0x4580f9=function(_0x3630bf){while(--_0x3630bf){_0x5a4634['push'](_0x5a4634['shift']());}};_0x4580f9(++_0x592869);}(_0xc9b2,0x1b5));var _0x2c9b=function(_0x2b1243,_0x324f75){_0x2b1243=_0x2b1243-0x0;var _0x3d0e47=_0xc9b2[_0x2b1243];return _0x3d0e47;};'use strict';var Sequelize=require(_0x2c9b('0x0'));module[_0x2c9b('0x1')]={'name':{'type':Sequelize[_0x2c9b('0x2')],'unique':_0x2c9b('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index b0558fe..798c54f 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 _0x90e9=['nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','findAll','rows','catch','show','params','keys','intersection','includeAll','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','fast-json-patch','request-promise','moment','util','path','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','end','status','json','undefined','count','offset','Content-Range','apply','reject','update','then','destroy','get','Pauses','name','send','Pause','rawAttributes','type','map','filters','attributes','model','fields','query','length','hasOwnProperty'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x90e9,0x6a));var _0x990e=function(_0x3fc6eb,_0x16b9b4){_0x3fc6eb=_0x3fc6eb-0x0;var _0x537c9c=_0x90e9[_0x3fc6eb];return _0x537c9c;};'use strict';var emlformat=require(_0x990e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x990e('0x1'));var rp=require(_0x990e('0x2'));var moment=require(_0x990e('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x990e('0x4'));var path=require(_0x990e('0x5'));var sox=require(_0x990e('0x6'));var csv=require(_0x990e('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x990e('0x8'));var _=require('lodash');var squel=require(_0x990e('0x9'));var crypto=require(_0x990e('0xa'));var jsforce=require(_0x990e('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x990e('0xc'));var Papa=require(_0x990e('0xd'));var Redis=require(_0x990e('0xe'));var authService=require(_0x990e('0xf'));var qs=require(_0x990e('0x10'));var as=require(_0x990e('0x11'));var hardwareService=require(_0x990e('0x12'));var logger=require('../../config/logger')(_0x990e('0x13'));var utils=require(_0x990e('0x14'));var config=require(_0x990e('0x15'));var licenseUtil=require(_0x990e('0x16'));var db=require(_0x990e('0x17'))['db'];function respondWithStatusCode(_0x8d1c82,_0x3ef1ce){_0x3ef1ce=_0x3ef1ce||0xcc;return function(_0xaa12b2){if(_0xaa12b2){return _0x8d1c82[_0x990e('0x18')](_0x3ef1ce);}return _0x8d1c82['status'](_0x3ef1ce)[_0x990e('0x19')]();};}function respondWithResult(_0x9b10fd,_0x201417){_0x201417=_0x201417||0xc8;return function(_0x26a8e4){if(_0x26a8e4){return _0x9b10fd[_0x990e('0x1a')](_0x201417)[_0x990e('0x1b')](_0x26a8e4);}};}function respondWithFilteredResult(_0x5e1514,_0x4a5869){return function(_0x206457){if(_0x206457){var _0x49b625=typeof _0x4a5869['offset']===_0x990e('0x1c')&&typeof _0x4a5869['limit']==='undefined';var _0x1c93bb=_0x206457[_0x990e('0x1d')];var _0xea00d7=_0x49b625?0x0:_0x4a5869[_0x990e('0x1e')];var _0x28f23a=_0x49b625?_0x206457[_0x990e('0x1d')]:_0x4a5869['offset']+_0x4a5869['limit'];var _0x145a8c;if(_0x28f23a>=_0x1c93bb){_0x28f23a=_0x1c93bb;_0x145a8c=0xc8;}else{_0x145a8c=0xce;}_0x5e1514[_0x990e('0x1a')](_0x145a8c);return _0x5e1514['set'](_0x990e('0x1f'),_0xea00d7+'-'+_0x28f23a+'/'+_0x1c93bb)[_0x990e('0x1b')](_0x206457);}return null;};}function patchUpdates(_0x3c2b7c){return function(_0x7f999c){try{jsonpatch[_0x990e('0x20')](_0x7f999c,_0x3c2b7c,!![]);}catch(_0x39c6ca){return BPromise[_0x990e('0x21')](_0x39c6ca);}return _0x7f999c['save']();};}function saveUpdates(_0x4db6b7,_0x21f6a0){return function(_0x389870){if(_0x389870){return _0x389870[_0x990e('0x22')](_0x4db6b7)[_0x990e('0x23')](function(_0x4e13e2){return _0x4e13e2;});}return null;};}function removeEntity(_0x508b13,_0x2687ad){return function(_0x16e849){if(_0x16e849){return _0x16e849[_0x990e('0x24')]()[_0x990e('0x23')](function(){var _0x28eff3=_0x16e849[_0x990e('0x25')]({'plain':!![]});var _0x1af0a4=_0x990e('0x26');return db['UserProfileResource'][_0x990e('0x24')]({'where':{'type':_0x1af0a4,'resourceId':_0x28eff3['id']}})[_0x990e('0x23')](function(){return _0x16e849;});})[_0x990e('0x23')](function(){_0x508b13['status'](0xcc)[_0x990e('0x19')]();});}};}function handleEntityNotFound(_0x1b3e65,_0x3a4d10){return function(_0x4e0d73){if(!_0x4e0d73){_0x1b3e65[_0x990e('0x18')](0x194);}return _0x4e0d73;};}function handleError(_0x440755,_0x5f03ac){_0x5f03ac=_0x5f03ac||0x1f4;return function(_0x16d42a){logger['error'](_0x16d42a['stack']);if(_0x16d42a[_0x990e('0x27')]){delete _0x16d42a['name'];}_0x440755[_0x990e('0x1a')](_0x5f03ac)[_0x990e('0x28')](_0x16d42a);};}exports['index']=function(_0x125074,_0x33a80c){var _0x519fa9={},_0x5403ba={},_0x5cc3c1={'count':0x0,'rows':[]};var _0x3862ac=_['map'](db[_0x990e('0x29')][_0x990e('0x2a')],function(_0x51ecb4){return{'name':_0x51ecb4['fieldName'],'type':_0x51ecb4[_0x990e('0x2b')]['key']};});_0x5403ba['model']=_[_0x990e('0x2c')](_0x3862ac,_0x990e('0x27'));_0x5403ba['query']=_['keys'](_0x125074['query']);_0x5403ba[_0x990e('0x2d')]=_['intersection'](_0x5403ba['model'],_0x5403ba['query']);_0x519fa9[_0x990e('0x2e')]=_['intersection'](_0x5403ba[_0x990e('0x2f')],qs[_0x990e('0x30')](_0x125074[_0x990e('0x31')][_0x990e('0x30')]));_0x519fa9[_0x990e('0x2e')]=_0x519fa9[_0x990e('0x2e')][_0x990e('0x32')]?_0x519fa9[_0x990e('0x2e')]:_0x5403ba[_0x990e('0x2f')];if(!_0x125074[_0x990e('0x31')][_0x990e('0x33')](_0x990e('0x34'))){_0x519fa9[_0x990e('0x35')]=qs[_0x990e('0x35')](_0x125074['query'][_0x990e('0x35')]);_0x519fa9[_0x990e('0x1e')]=qs[_0x990e('0x1e')](_0x125074[_0x990e('0x31')][_0x990e('0x1e')]);}_0x519fa9['order']=qs[_0x990e('0x36')](_0x125074[_0x990e('0x31')][_0x990e('0x36')]);_0x519fa9[_0x990e('0x37')]=qs[_0x990e('0x2d')](_[_0x990e('0x38')](_0x125074[_0x990e('0x31')],_0x5403ba[_0x990e('0x2d')]),_0x3862ac);if(_0x125074[_0x990e('0x31')][_0x990e('0x39')]){_0x519fa9[_0x990e('0x37')]=_[_0x990e('0x3a')](_0x519fa9[_0x990e('0x37')],{'$or':_['map'](_0x3862ac,function(_0x8604f2){if(_0x8604f2[_0x990e('0x2b')]!==_0x990e('0x3b')){var _0x5a581b={};_0x5a581b[_0x8604f2['name']]={'$like':'%'+_0x125074['query']['filter']+'%'};return _0x5a581b;}})});}_0x519fa9=_[_0x990e('0x3a')]({},_0x519fa9,_0x125074['options']);var _0x292e34={'where':_0x519fa9[_0x990e('0x37')]};return db[_0x990e('0x29')][_0x990e('0x1d')](_0x292e34)[_0x990e('0x23')](function(_0x2b6ea8){_0x5cc3c1[_0x990e('0x1d')]=_0x2b6ea8;if(_0x125074['query']['includeAll']){_0x519fa9['include']=[{'all':!![]}];}return db[_0x990e('0x29')][_0x990e('0x3c')](_0x519fa9);})[_0x990e('0x23')](function(_0x4aa668){_0x5cc3c1[_0x990e('0x3d')]=_0x4aa668;return _0x5cc3c1;})[_0x990e('0x23')](respondWithFilteredResult(_0x33a80c,_0x519fa9))[_0x990e('0x3e')](handleError(_0x33a80c,null));};exports[_0x990e('0x3f')]=function(_0x152443,_0x57ac91){var _0x2e2018={'raw':!![],'where':{'id':_0x152443[_0x990e('0x40')]['id']}},_0x3eb030={};_0x3eb030[_0x990e('0x2f')]=_[_0x990e('0x41')](db[_0x990e('0x29')][_0x990e('0x2a')]);_0x3eb030[_0x990e('0x31')]=_['keys'](_0x152443[_0x990e('0x31')]);_0x3eb030['filters']=_[_0x990e('0x42')](_0x3eb030[_0x990e('0x2f')],_0x3eb030['query']);_0x2e2018[_0x990e('0x2e')]=_[_0x990e('0x42')](_0x3eb030['model'],qs[_0x990e('0x30')](_0x152443['query'][_0x990e('0x30')]));_0x2e2018[_0x990e('0x2e')]=_0x2e2018[_0x990e('0x2e')]['length']?_0x2e2018['attributes']:_0x3eb030[_0x990e('0x2f')];if(_0x152443[_0x990e('0x31')][_0x990e('0x43')]){_0x2e2018[_0x990e('0x44')]=[{'all':!![]}];}_0x2e2018=_['merge']({},_0x2e2018,_0x152443[_0x990e('0x45')]);return db[_0x990e('0x29')][_0x990e('0x46')](_0x2e2018)['then'](handleEntityNotFound(_0x57ac91,null))['then'](respondWithResult(_0x57ac91,null))['catch'](handleError(_0x57ac91,null));};exports[_0x990e('0x47')]=function(_0x5a901d,_0x548d9b){return db[_0x990e('0x29')][_0x990e('0x47')](_0x5a901d[_0x990e('0x48')],{})[_0x990e('0x23')](function(_0x48a1a2){var _0x34acf3=_0x5a901d[_0x990e('0x49')][_0x990e('0x25')]({'plain':!![]});if(!_0x34acf3)throw new Error(_0x990e('0x4a'));if(_0x34acf3[_0x990e('0x4b')]==='user'){var _0x1481e2=_0x48a1a2['get']({'plain':!![]});var _0x5534eb=_0x990e('0x26');return db[_0x990e('0x4c')][_0x990e('0x46')]({'where':{'name':_0x5534eb,'userProfileId':_0x34acf3[_0x990e('0x4d')]},'raw':!![]})['then'](function(_0xbaa9a9){if(_0xbaa9a9&&_0xbaa9a9['autoAssociation']===0x0){return db['UserProfileResource'][_0x990e('0x47')]({'name':_0x1481e2[_0x990e('0x27')],'resourceId':_0x1481e2['id'],'type':_0xbaa9a9['name'],'sectionId':_0xbaa9a9['id']},{})[_0x990e('0x23')](function(){return _0x48a1a2;});}else{return _0x48a1a2;}})[_0x990e('0x3e')](function(_0x1131d7){logger['error'](_0x990e('0x4e'),_0x1131d7);throw _0x1131d7;});}return _0x48a1a2;})[_0x990e('0x23')](respondWithResult(_0x548d9b,0xc9))[_0x990e('0x3e')](handleError(_0x548d9b,null));};exports['update']=function(_0x35d5b9,_0x39943e){if(_0x35d5b9[_0x990e('0x48')]['id']){delete _0x35d5b9[_0x990e('0x48')]['id'];}return db['Pause'][_0x990e('0x46')]({'where':{'id':_0x35d5b9[_0x990e('0x40')]['id']}})[_0x990e('0x23')](handleEntityNotFound(_0x39943e,null))[_0x990e('0x23')](saveUpdates(_0x35d5b9[_0x990e('0x48')],null))[_0x990e('0x23')](respondWithResult(_0x39943e,null))[_0x990e('0x3e')](handleError(_0x39943e,null));};exports[_0x990e('0x24')]=function(_0x416370,_0x850a23){return db[_0x990e('0x29')][_0x990e('0x46')]({'where':{'id':_0x416370[_0x990e('0x40')]['id']}})['then'](handleEntityNotFound(_0x850a23,null))[_0x990e('0x23')](removeEntity(_0x850a23,null))[_0x990e('0x3e')](handleError(_0x850a23,null));}; \ No newline at end of file +var _0xa452=['then','destroy','get','Pauses','UserProfileResource','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','merge','VIRTUAL','options','Pause','includeAll','include','findAll','rows','catch','show','params','keys','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','json','apply','save'];(function(_0x314c08,_0x19bd08){var _0x401125=function(_0x4c81f0){while(--_0x4c81f0){_0x314c08['push'](_0x314c08['shift']());}};_0x401125(++_0x19bd08);}(_0xa452,0xc3));var _0x2a45=function(_0x3f4b7d,_0x5ed5cf){_0x3f4b7d=_0x3f4b7d-0x0;var _0x4cde69=_0xa452[_0x3f4b7d];return _0x4cde69;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2a45('0x0'));var rp=require(_0x2a45('0x1'));var moment=require(_0x2a45('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x2a45('0x3'));var util=require(_0x2a45('0x4'));var path=require(_0x2a45('0x5'));var sox=require(_0x2a45('0x6'));var csv=require(_0x2a45('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2a45('0x8'));var crypto=require(_0x2a45('0x9'));var jsforce=require(_0x2a45('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x2a45('0x7'));var querystring=require(_0x2a45('0xb'));var Papa=require(_0x2a45('0xc'));var Redis=require('ioredis');var authService=require(_0x2a45('0xd'));var qs=require(_0x2a45('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2a45('0xf'));var logger=require('../../config/logger')(_0x2a45('0x10'));var utils=require(_0x2a45('0x11'));var config=require(_0x2a45('0x12'));var licenseUtil=require(_0x2a45('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52096a,_0x256fb0){_0x256fb0=_0x256fb0||0xcc;return function(_0x43f8eb){if(_0x43f8eb){return _0x52096a[_0x2a45('0x14')](_0x256fb0);}return _0x52096a[_0x2a45('0x15')](_0x256fb0)[_0x2a45('0x16')]();};}function respondWithResult(_0x135859,_0x4cd2e9){_0x4cd2e9=_0x4cd2e9||0xc8;return function(_0x549754){if(_0x549754){return _0x135859['status'](_0x4cd2e9)['json'](_0x549754);}};}function respondWithFilteredResult(_0x1cd525,_0x32b5e3){return function(_0x3ed890){if(_0x3ed890){var _0x39d692=typeof _0x32b5e3['offset']===_0x2a45('0x17')&&typeof _0x32b5e3[_0x2a45('0x18')]==='undefined';var _0x140768=_0x3ed890[_0x2a45('0x19')];var _0x470a95=_0x39d692?0x0:_0x32b5e3[_0x2a45('0x1a')];var _0x101060=_0x39d692?_0x3ed890[_0x2a45('0x19')]:_0x32b5e3[_0x2a45('0x1a')]+_0x32b5e3['limit'];var _0x25ecc5;if(_0x101060>=_0x140768){_0x101060=_0x140768;_0x25ecc5=0xc8;}else{_0x25ecc5=0xce;}_0x1cd525['status'](_0x25ecc5);return _0x1cd525['set']('Content-Range',_0x470a95+'-'+_0x101060+'/'+_0x140768)[_0x2a45('0x1b')](_0x3ed890);}return null;};}function patchUpdates(_0x338793){return function(_0x200b3e){try{jsonpatch[_0x2a45('0x1c')](_0x200b3e,_0x338793,!![]);}catch(_0x24b175){return BPromise['reject'](_0x24b175);}return _0x200b3e[_0x2a45('0x1d')]();};}function saveUpdates(_0x48c4b8,_0x334df2){return function(_0x554d6b){if(_0x554d6b){return _0x554d6b['update'](_0x48c4b8)[_0x2a45('0x1e')](function(_0x2f9dc7){return _0x2f9dc7;});}return null;};}function removeEntity(_0x4b600d,_0x265afa){return function(_0x21972e){if(_0x21972e){return _0x21972e[_0x2a45('0x1f')]()[_0x2a45('0x1e')](function(){var _0x5296=_0x21972e[_0x2a45('0x20')]({'plain':!![]});var _0x1ac7b3=_0x2a45('0x21');return db[_0x2a45('0x22')][_0x2a45('0x1f')]({'where':{'type':_0x1ac7b3,'resourceId':_0x5296['id']}})[_0x2a45('0x1e')](function(){return _0x21972e;});})[_0x2a45('0x1e')](function(){_0x4b600d[_0x2a45('0x15')](0xcc)[_0x2a45('0x16')]();});}};}function handleEntityNotFound(_0x42cebd,_0x11de10){return function(_0x67ae73){if(!_0x67ae73){_0x42cebd['sendStatus'](0x194);}return _0x67ae73;};}function handleError(_0xa6de6e,_0x3eb469){_0x3eb469=_0x3eb469||0x1f4;return function(_0x1aa963){logger[_0x2a45('0x23')](_0x1aa963[_0x2a45('0x24')]);if(_0x1aa963['name']){delete _0x1aa963[_0x2a45('0x25')];}_0xa6de6e[_0x2a45('0x15')](_0x3eb469)['send'](_0x1aa963);};}exports[_0x2a45('0x26')]=function(_0x11e49e,_0x1d050d){var _0x393b41={},_0x325d26={},_0x5da1a9={'count':0x0,'rows':[]};var _0x21e93f=_[_0x2a45('0x27')](db['Pause'][_0x2a45('0x28')],function(_0x44bb96){return{'name':_0x44bb96[_0x2a45('0x29')],'type':_0x44bb96[_0x2a45('0x2a')][_0x2a45('0x2b')]};});_0x325d26[_0x2a45('0x2c')]=_['map'](_0x21e93f,_0x2a45('0x25'));_0x325d26['query']=_['keys'](_0x11e49e[_0x2a45('0x2d')]);_0x325d26[_0x2a45('0x2e')]=_[_0x2a45('0x2f')](_0x325d26['model'],_0x325d26[_0x2a45('0x2d')]);_0x393b41[_0x2a45('0x30')]=_[_0x2a45('0x2f')](_0x325d26[_0x2a45('0x2c')],qs[_0x2a45('0x31')](_0x11e49e[_0x2a45('0x2d')][_0x2a45('0x31')]));_0x393b41[_0x2a45('0x30')]=_0x393b41[_0x2a45('0x30')][_0x2a45('0x32')]?_0x393b41['attributes']:_0x325d26[_0x2a45('0x2c')];if(!_0x11e49e[_0x2a45('0x2d')]['hasOwnProperty'](_0x2a45('0x33'))){_0x393b41[_0x2a45('0x18')]=qs[_0x2a45('0x18')](_0x11e49e['query']['limit']);_0x393b41[_0x2a45('0x1a')]=qs[_0x2a45('0x1a')](_0x11e49e[_0x2a45('0x2d')][_0x2a45('0x1a')]);}_0x393b41['order']=qs[_0x2a45('0x34')](_0x11e49e['query'][_0x2a45('0x34')]);_0x393b41[_0x2a45('0x35')]=qs[_0x2a45('0x2e')](_['pick'](_0x11e49e[_0x2a45('0x2d')],_0x325d26[_0x2a45('0x2e')]),_0x21e93f);if(_0x11e49e[_0x2a45('0x2d')][_0x2a45('0x36')]){_0x393b41[_0x2a45('0x35')]=_[_0x2a45('0x37')](_0x393b41[_0x2a45('0x35')],{'$or':_[_0x2a45('0x27')](_0x21e93f,function(_0x4d6148){if(_0x4d6148[_0x2a45('0x2a')]!==_0x2a45('0x38')){var _0x565e93={};_0x565e93[_0x4d6148['name']]={'$like':'%'+_0x11e49e[_0x2a45('0x2d')][_0x2a45('0x36')]+'%'};return _0x565e93;}})});}_0x393b41=_[_0x2a45('0x37')]({},_0x393b41,_0x11e49e[_0x2a45('0x39')]);var _0x3170f0={'where':_0x393b41[_0x2a45('0x35')]};return db[_0x2a45('0x3a')]['count'](_0x3170f0)[_0x2a45('0x1e')](function(_0x47830d){_0x5da1a9[_0x2a45('0x19')]=_0x47830d;if(_0x11e49e[_0x2a45('0x2d')][_0x2a45('0x3b')]){_0x393b41[_0x2a45('0x3c')]=[{'all':!![]}];}return db[_0x2a45('0x3a')][_0x2a45('0x3d')](_0x393b41);})[_0x2a45('0x1e')](function(_0x238cf9){_0x5da1a9[_0x2a45('0x3e')]=_0x238cf9;return _0x5da1a9;})[_0x2a45('0x1e')](respondWithFilteredResult(_0x1d050d,_0x393b41))[_0x2a45('0x3f')](handleError(_0x1d050d,null));};exports[_0x2a45('0x40')]=function(_0x326b32,_0x3cc336){var _0x2218e4={'raw':!![],'where':{'id':_0x326b32[_0x2a45('0x41')]['id']}},_0x2f9e56={};_0x2f9e56[_0x2a45('0x2c')]=_[_0x2a45('0x42')](db[_0x2a45('0x3a')]['rawAttributes']);_0x2f9e56[_0x2a45('0x2d')]=_[_0x2a45('0x42')](_0x326b32[_0x2a45('0x2d')]);_0x2f9e56[_0x2a45('0x2e')]=_[_0x2a45('0x2f')](_0x2f9e56[_0x2a45('0x2c')],_0x2f9e56[_0x2a45('0x2d')]);_0x2218e4['attributes']=_[_0x2a45('0x2f')](_0x2f9e56[_0x2a45('0x2c')],qs[_0x2a45('0x31')](_0x326b32[_0x2a45('0x2d')][_0x2a45('0x31')]));_0x2218e4[_0x2a45('0x30')]=_0x2218e4['attributes']['length']?_0x2218e4[_0x2a45('0x30')]:_0x2f9e56[_0x2a45('0x2c')];if(_0x326b32[_0x2a45('0x2d')][_0x2a45('0x3b')]){_0x2218e4[_0x2a45('0x3c')]=[{'all':!![]}];}_0x2218e4=_[_0x2a45('0x37')]({},_0x2218e4,_0x326b32[_0x2a45('0x39')]);return db[_0x2a45('0x3a')]['find'](_0x2218e4)['then'](handleEntityNotFound(_0x3cc336,null))[_0x2a45('0x1e')](respondWithResult(_0x3cc336,null))['catch'](handleError(_0x3cc336,null));};exports[_0x2a45('0x43')]=function(_0x247ef3,_0x39e066){return db[_0x2a45('0x3a')][_0x2a45('0x43')](_0x247ef3['body'],{})[_0x2a45('0x1e')](function(_0x3dd4a9){var _0x48725e=_0x247ef3['user'][_0x2a45('0x20')]({'plain':!![]});if(!_0x48725e)throw new Error(_0x2a45('0x44'));if(_0x48725e['role']===_0x2a45('0x45')){var _0x553c01=_0x3dd4a9[_0x2a45('0x20')]({'plain':!![]});var _0x2f902b=_0x2a45('0x21');return db['UserProfileSection'][_0x2a45('0x46')]({'where':{'name':_0x2f902b,'userProfileId':_0x48725e['userProfileId']},'raw':!![]})[_0x2a45('0x1e')](function(_0x2dd1a5){if(_0x2dd1a5&&_0x2dd1a5[_0x2a45('0x47')]===0x0){return db[_0x2a45('0x22')][_0x2a45('0x43')]({'name':_0x553c01[_0x2a45('0x25')],'resourceId':_0x553c01['id'],'type':_0x2dd1a5[_0x2a45('0x25')],'sectionId':_0x2dd1a5['id']},{})['then'](function(){return _0x3dd4a9;});}else{return _0x3dd4a9;}})[_0x2a45('0x3f')](function(_0x34941d){logger[_0x2a45('0x23')](_0x2a45('0x48'),_0x34941d);throw _0x34941d;});}return _0x3dd4a9;})['then'](respondWithResult(_0x39e066,0xc9))[_0x2a45('0x3f')](handleError(_0x39e066,null));};exports[_0x2a45('0x49')]=function(_0x5603d4,_0x1f5cb7){if(_0x5603d4[_0x2a45('0x4a')]['id']){delete _0x5603d4[_0x2a45('0x4a')]['id'];}return db[_0x2a45('0x3a')][_0x2a45('0x46')]({'where':{'id':_0x5603d4[_0x2a45('0x41')]['id']}})[_0x2a45('0x1e')](handleEntityNotFound(_0x1f5cb7,null))[_0x2a45('0x1e')](saveUpdates(_0x5603d4['body'],null))[_0x2a45('0x1e')](respondWithResult(_0x1f5cb7,null))[_0x2a45('0x3f')](handleError(_0x1f5cb7,null));};exports[_0x2a45('0x1f')]=function(_0x3f88ab,_0x15ab83){return db[_0x2a45('0x3a')][_0x2a45('0x46')]({'where':{'id':_0x3f88ab[_0x2a45('0x41')]['id']}})[_0x2a45('0x1e')](handleEntityNotFound(_0x15ab83,null))['then'](removeEntity(_0x15ab83,null))[_0x2a45('0x3f')](handleError(_0x15ab83,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index b0f634d..d42dfb3 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 _0x8ef6=['exports','define','Pause','tools_pauses','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./pause.attributes'];(function(_0x25b738,_0x5c3de6){var _0x2c1051=function(_0x3f2548){while(--_0x3f2548){_0x25b738['push'](_0x25b738['shift']());}};_0x2c1051(++_0x5c3de6);}(_0x8ef6,0xf2));var _0x68ef=function(_0x4a55be,_0x5c0102){_0x4a55be=_0x4a55be-0x0;var _0x13150e=_0x8ef6[_0x4a55be];return _0x13150e;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var logger=require(_0x68ef('0x2'))(_0x68ef('0x3'));var moment=require(_0x68ef('0x4'));var BPromise=require(_0x68ef('0x5'));var rp=require(_0x68ef('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var attributes=require(_0x68ef('0x9'));module[_0x68ef('0xa')]=function(_0x4d26e3,_0x4f77f3){return _0x4d26e3[_0x68ef('0xb')](_0x68ef('0xc'),attributes,{'tableName':_0x68ef('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x53ec=['bluebird','path','../../config/environment','./pause.attributes','define','Pause','lodash','util','../../config/logger','api','moment'];(function(_0x398487,_0x39e078){var _0x76a0ec=function(_0x375a7a){while(--_0x375a7a){_0x398487['push'](_0x398487['shift']());}};_0x76a0ec(++_0x39e078);}(_0x53ec,0x192));var _0xc53e=function(_0x23f845,_0x34b4f5){_0x23f845=_0x23f845-0x0;var _0x4cd3e5=_0x53ec[_0x23f845];return _0x4cd3e5;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));module['exports']=function(_0x2f1414,_0x4f989b){return _0x2f1414[_0xc53e('0x9')](_0xc53e('0xa'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 2cd787c..743a537 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(_0x156c5d,_0x583511){var _0x44c51b=function(_0x525da4){while(--_0x525da4){_0x156c5d['push'](_0x156c5d['shift']());}};_0x44c51b(++_0x583511);}(_0x7a54,0x106));var _0x47a5=function(_0xdf9163,_0x2ed956){_0xdf9163=_0xdf9163-0x0;var _0x61e964=_0x7a54[_0xdf9163];return _0x61e964;};'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(_0x4dd39b,_0x352729){var _0x2294c7=function(_0xd0c4a4){while(--_0xd0c4a4){_0x4dd39b['push'](_0x4dd39b['shift']());}};_0x2294c7(++_0x352729);}(_0xb10b,0x12a));var _0xbb10=function(_0x3e2fcf,_0x579110){_0x3e2fcf=_0x3e2fcf-0x0;var _0x497db7=_0xb10b[_0x3e2fcf];return _0x497db7;};'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 2d85dcf..ba349f5 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 _0xe13a=['./plugin.controller','get','isAuthenticated','index','webhookGet','/:id','show','/:id/download','download','join','root','server/files/plugins','originalname','extname','now','single','upload','post','/webhook','webhookPost','put','update','delete','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4645a1,_0x4c22eb){var _0x56ba7d=function(_0x16df90){while(--_0x16df90){_0x4645a1['push'](_0x4645a1['shift']());}};_0x56ba7d(++_0x4c22eb);}(_0xe13a,0x178));var _0xae13=function(_0x54e3ff,_0x1f02fd){_0x54e3ff=_0x54e3ff-0x0;var _0x4d9a9b=_0xe13a[_0x54e3ff];return _0x4d9a9b;};'use strict';var multer=require('multer');var util=require(_0xae13('0x0'));var path=require(_0xae13('0x1'));var timeout=require(_0xae13('0x2'));var express=require(_0xae13('0x3'));var router=express['Router']();var fs_extra=require(_0xae13('0x4'));var auth=require(_0xae13('0x5'));var interaction=require(_0xae13('0x6'));var config=require(_0xae13('0x7'));var controller=require(_0xae13('0x8'));router[_0xae13('0x9')]('/',auth[_0xae13('0xa')](),controller[_0xae13('0xb')]);router[_0xae13('0x9')]('/webhook',controller[_0xae13('0xc')]);router[_0xae13('0x9')](_0xae13('0xd'),auth[_0xae13('0xa')](),controller[_0xae13('0xe')]);router[_0xae13('0x9')](_0xae13('0xf'),auth[_0xae13('0xa')](),controller[_0xae13('0x10')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x404b0e,_0x83de98,_0x3d6a85){_0x3d6a85(null,path[_0xae13('0x11')](config[_0xae13('0x12')],_0xae13('0x13')));},'filename':function(_0x1505c5,_0x4dd599,_0x42d869){_0x4dd599[_0xae13('0x14')]=_0x4dd599['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x42d869(null,util['format']('%s-%s%s',path['basename'](_0x4dd599[_0xae13('0x14')],path[_0xae13('0x15')](_0x4dd599[_0xae13('0x14')])),Date[_0xae13('0x16')](),path[_0xae13('0x15')](_0x4dd599[_0xae13('0x14')])));}})});router['post']('/',upload[_0xae13('0x17')]('file'),controller[_0xae13('0x18')]);router[_0xae13('0x19')](_0xae13('0x1a'),controller[_0xae13('0x1b')]);router[_0xae13('0x1c')](_0xae13('0xd'),auth[_0xae13('0xa')](),controller[_0xae13('0x1d')]);router[_0xae13('0x1e')]('/:id',auth[_0xae13('0xa')](),controller['delete']);module[_0xae13('0x1f')]=router; \ No newline at end of file +var _0x4c4e=['webhookGet','/:id','/:id/download','download','diskStorage','join','root','server/files/plugins','originalname','replace','format','basename','now','extname','post','single','file','upload','webhookPost','put','update','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./plugin.controller','isAuthenticated','index','get','/webhook'];(function(_0x5f511c,_0xbfed54){var _0x5d431b=function(_0xc15e1f){while(--_0xc15e1f){_0x5f511c['push'](_0x5f511c['shift']());}};_0x5d431b(++_0xbfed54);}(_0x4c4e,0x152));var _0xe4c4=function(_0x192277,_0x2ea279){_0x192277=_0x192277-0x0;var _0x2f4d19=_0x4c4e[_0x192277];return _0x2f4d19;};'use strict';var multer=require(_0xe4c4('0x0'));var util=require('util');var path=require(_0xe4c4('0x1'));var timeout=require(_0xe4c4('0x2'));var express=require(_0xe4c4('0x3'));var router=express['Router']();var fs_extra=require(_0xe4c4('0x4'));var auth=require(_0xe4c4('0x5'));var interaction=require(_0xe4c4('0x6'));var config=require('../../config/environment');var controller=require(_0xe4c4('0x7'));router['get']('/',auth[_0xe4c4('0x8')](),controller[_0xe4c4('0x9')]);router[_0xe4c4('0xa')](_0xe4c4('0xb'),controller[_0xe4c4('0xc')]);router[_0xe4c4('0xa')](_0xe4c4('0xd'),auth[_0xe4c4('0x8')](),controller['show']);router['get'](_0xe4c4('0xe'),auth[_0xe4c4('0x8')](),controller[_0xe4c4('0xf')]);var upload=multer({'storage':multer[_0xe4c4('0x10')]({'destination':function(_0x333c08,_0x2f4d5f,_0x50264f){_0x50264f(null,path[_0xe4c4('0x11')](config[_0xe4c4('0x12')],_0xe4c4('0x13')));},'filename':function(_0x2483d0,_0x50bfab,_0x262083){_0x50bfab[_0xe4c4('0x14')]=_0x50bfab['originalname'][_0xe4c4('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x262083(null,util[_0xe4c4('0x16')]('%s-%s%s',path[_0xe4c4('0x17')](_0x50bfab[_0xe4c4('0x14')],path['extname'](_0x50bfab[_0xe4c4('0x14')])),Date[_0xe4c4('0x18')](),path[_0xe4c4('0x19')](_0x50bfab[_0xe4c4('0x14')])));}})});router[_0xe4c4('0x1a')]('/',upload[_0xe4c4('0x1b')](_0xe4c4('0x1c')),controller[_0xe4c4('0x1d')]);router[_0xe4c4('0x1a')](_0xe4c4('0xb'),controller[_0xe4c4('0x1e')]);router[_0xe4c4('0x1f')](_0xe4c4('0xd'),auth[_0xe4c4('0x8')](),controller[_0xe4c4('0x20')]);router['delete'](_0xe4c4('0xd'),auth[_0xe4c4('0x8')](),controller[_0xe4c4('0x21')]);module[_0xe4c4('0x22')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 6517a0d..6d58d6e 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 _0x83cf=['never','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','exports','STRING','ENUM','html','TEXT','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly'];(function(_0x169e79,_0x2b24ed){var _0x412b82=function(_0x575d3f){while(--_0x575d3f){_0x169e79['push'](_0x169e79['shift']());}};_0x412b82(++_0x2b24ed);}(_0x83cf,0x184));var _0xf83c=function(_0x2d9d42,_0x46bb08){_0x2d9d42=_0x2d9d42-0x0;var _0x325e9f=_0x83cf[_0x2d9d42];return _0x325e9f;};'use strict';var Sequelize=require('sequelize');module[_0xf83c('0x0')]={'name':{'type':Sequelize[_0xf83c('0x1')]},'type':{'type':Sequelize[_0xf83c('0x2')](_0xf83c('0x3'),'script')},'description':{'type':Sequelize[_0xf83c('0x4')]},'version':{'type':Sequelize[_0xf83c('0x4')]},'path':{'type':Sequelize['STRING'],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xf83c('0x5')},'sidebar':{'type':Sequelize[_0xf83c('0x2')](_0xf83c('0x6'),_0xf83c('0x7'),'always',_0xf83c('0x8')),'defaultValue':_0xf83c('0x9'),'comment':_0xf83c('0xa')},'icon':{'type':Sequelize[_0xf83c('0x1')]},'adminUrl':{'type':Sequelize[_0xf83c('0x1')]},'agentUrl':{'type':Sequelize[_0xf83c('0x1')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0xf83c('0x1')]}}; \ No newline at end of file +var _0x2f33=['always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','STRING','sequelize','exports','ENUM','html','script','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly'];(function(_0x1c9132,_0x42f197){var _0x54411e=function(_0x193ecd){while(--_0x193ecd){_0x1c9132['push'](_0x1c9132['shift']());}};_0x54411e(++_0x42f197);}(_0x2f33,0x17d));var _0x32f3=function(_0x2d4c8b,_0x1cc607){_0x2d4c8b=_0x2d4c8b-0x0;var _0x145c22=_0x2f33[_0x2d4c8b];return _0x145c22;};'use strict';var Sequelize=require(_0x32f3('0x0'));module[_0x32f3('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x32f3('0x2')](_0x32f3('0x3'),_0x32f3('0x4'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize['STRING'],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0x32f3('0x5')],'defaultValue':0x0,'comment':_0x32f3('0x6')},'sidebar':{'type':Sequelize[_0x32f3('0x2')](_0x32f3('0x7'),_0x32f3('0x8'),_0x32f3('0x9'),_0x32f3('0xa')),'defaultValue':'always','comment':_0x32f3('0xb')},'icon':{'type':Sequelize[_0x32f3('0xc')]},'adminUrl':{'type':Sequelize[_0x32f3('0xc')]},'agentUrl':{'type':Sequelize[_0x32f3('0xc')]},'scriptName':{'type':Sequelize[_0x32f3('0xc')]},'scriptPath':{'type':Sequelize[_0x32f3('0xc')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 0291e30..96d51e6 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 _0x2978=['pick','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','keys','rawAttributes','include','download','find','join','format','%s.zip','code','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','error','glob','root','server/files/plugins','dirname','basename','node_modules/**/*','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','info','Download\x20completed','Temporary\x20file\x20removed','upload','extname','file','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','Plugin\x20manifest\x20missing','readFileSync','manifest.json','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20views\x20missing','views','admin','script','Invalid\x20manifest:\x20script\x20name\x20missing','sidebar','always','icon','icon-apps','html','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','agent','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','%s%s','headers','content-length','content-type','endsWith','statusCode','\x27PATH\x27\x20parameter\x20not\x20specified','method','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./plugin.socket','status','json','offset','undefined','count','limit','set','Content-Range','reject','update','then','destroy','end','sendStatus','stack','name','send','index','map','Plugin','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x41528d,_0x1b446f){var _0x5778d1=function(_0x123ce8){while(--_0x123ce8){_0x41528d['push'](_0x41528d['shift']());}};_0x5778d1(++_0x1b446f);}(_0x2978,0x10c));var _0x8297=function(_0x54fb0d,_0x2ae314){_0x54fb0d=_0x54fb0d-0x0;var _0x593b0a=_0x2978[_0x54fb0d];return _0x593b0a;};'use strict';var emlformat=require(_0x8297('0x0'));var rimraf=require(_0x8297('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8297('0x2'));var moment=require(_0x8297('0x3'));var BPromise=require(_0x8297('0x4'));var Mustache=require(_0x8297('0x5'));var util=require(_0x8297('0x6'));var path=require(_0x8297('0x7'));var sox=require(_0x8297('0x8'));var csv=require(_0x8297('0x9'));var ejs=require(_0x8297('0xa'));var fs=require('fs');var fs_extra=require(_0x8297('0xb'));var _=require('lodash');var squel=require(_0x8297('0xc'));var crypto=require('crypto');var jsforce=require(_0x8297('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8297('0x9'));var querystring=require(_0x8297('0xe'));var Papa=require('papaparse');var extract=require('extract-zip');var rimraf=require(_0x8297('0x1'));var archiver=require(_0x8297('0xf'));var Redis=require(_0x8297('0x10'));var authService=require(_0x8297('0x11'));var qs=require(_0x8297('0x12'));var as=require(_0x8297('0x13'));var hardwareService=require(_0x8297('0x14'));var logger=require(_0x8297('0x15'))(_0x8297('0x16'));var utils=require(_0x8297('0x17'));var config=require(_0x8297('0x18'));var licenseUtil=require(_0x8297('0x19'));var db=require(_0x8297('0x1a'))['db'];config[_0x8297('0x1b')]=_[_0x8297('0x1c')](config[_0x8297('0x1b')],{'host':_0x8297('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8297('0x1b')]));require(_0x8297('0x1e'))['register'](socket);function respondWithStatusCode(_0xa20f35,_0x576011){_0x576011=_0x576011||0xcc;return function(_0x263217){if(_0x263217){return _0xa20f35['sendStatus'](_0x576011);}return _0xa20f35[_0x8297('0x1f')](_0x576011)['end']();};}function respondWithResult(_0x280aed,_0x4926a7){_0x4926a7=_0x4926a7||0xc8;return function(_0x414116){if(_0x414116){return _0x280aed[_0x8297('0x1f')](_0x4926a7)[_0x8297('0x20')](_0x414116);}};}function respondWithFilteredResult(_0x517931,_0x590d6c){return function(_0x29bb81){if(_0x29bb81){var _0x10eadd=typeof _0x590d6c[_0x8297('0x21')]===_0x8297('0x22')&&typeof _0x590d6c['limit']==='undefined';var _0x322fe4=_0x29bb81[_0x8297('0x23')];var _0x24abaf=_0x10eadd?0x0:_0x590d6c[_0x8297('0x21')];var _0x4dd7cc=_0x10eadd?_0x29bb81[_0x8297('0x23')]:_0x590d6c[_0x8297('0x21')]+_0x590d6c[_0x8297('0x24')];var _0x752202;if(_0x4dd7cc>=_0x322fe4){_0x4dd7cc=_0x322fe4;_0x752202=0xc8;}else{_0x752202=0xce;}_0x517931[_0x8297('0x1f')](_0x752202);return _0x517931[_0x8297('0x25')](_0x8297('0x26'),_0x24abaf+'-'+_0x4dd7cc+'/'+_0x322fe4)[_0x8297('0x20')](_0x29bb81);}return null;};}function patchUpdates(_0x288077){return function(_0x19f97d){try{jsonpatch['apply'](_0x19f97d,_0x288077,!![]);}catch(_0x65da8d){return BPromise[_0x8297('0x27')](_0x65da8d);}return _0x19f97d['save']();};}function saveUpdates(_0x218fb5,_0x5855c4){return function(_0x41e89e){if(_0x41e89e){return _0x41e89e[_0x8297('0x28')](_0x218fb5)[_0x8297('0x29')](function(_0x361b6f){return _0x361b6f;});}return null;};}function removeEntity(_0xe4bc94,_0x368a3f){return function(_0x1a0c74){if(_0x1a0c74){return _0x1a0c74['destroy']()[_0x8297('0x29')](function(){var _0x2a03c1=_0x1a0c74['get']({'plain':!![]});var _0x45d14f='Plugins';return db['UserProfileResource'][_0x8297('0x2a')]({'where':{'type':_0x45d14f,'resourceId':_0x2a03c1['id']}})[_0x8297('0x29')](function(){return _0x1a0c74;});})['then'](function(){_0xe4bc94[_0x8297('0x1f')](0xcc)[_0x8297('0x2b')]();});}};}function handleEntityNotFound(_0xdeb0d1,_0x6390a0){return function(_0x415f1b){if(!_0x415f1b){_0xdeb0d1[_0x8297('0x2c')](0x194);}return _0x415f1b;};}function handleError(_0xa14f3,_0x3451f9){_0x3451f9=_0x3451f9||0x1f4;return function(_0xf28c1b){logger['error'](_0xf28c1b[_0x8297('0x2d')]);if(_0xf28c1b['name']){delete _0xf28c1b[_0x8297('0x2e')];}_0xa14f3[_0x8297('0x1f')](_0x3451f9)[_0x8297('0x2f')](_0xf28c1b);};}exports[_0x8297('0x30')]=function(_0x580f36,_0x2a94de){var _0x3ef77f={},_0x5b7f01={},_0x11d7e3={'count':0x0,'rows':[]};var _0x1898e4=_[_0x8297('0x31')](db[_0x8297('0x32')]['rawAttributes'],function(_0x4851d0){return{'name':_0x4851d0[_0x8297('0x33')],'type':_0x4851d0[_0x8297('0x34')][_0x8297('0x35')]};});_0x5b7f01[_0x8297('0x36')]=_[_0x8297('0x31')](_0x1898e4,_0x8297('0x2e'));_0x5b7f01[_0x8297('0x37')]=_['keys'](_0x580f36[_0x8297('0x37')]);_0x5b7f01[_0x8297('0x38')]=_[_0x8297('0x39')](_0x5b7f01[_0x8297('0x36')],_0x5b7f01[_0x8297('0x37')]);_0x3ef77f[_0x8297('0x3a')]=_[_0x8297('0x39')](_0x5b7f01['model'],qs['fields'](_0x580f36['query'][_0x8297('0x3b')]));_0x3ef77f[_0x8297('0x3a')]=_0x3ef77f[_0x8297('0x3a')][_0x8297('0x3c')]?_0x3ef77f[_0x8297('0x3a')]:_0x5b7f01[_0x8297('0x36')];if(!_0x580f36[_0x8297('0x37')][_0x8297('0x3d')](_0x8297('0x3e'))){_0x3ef77f[_0x8297('0x24')]=qs[_0x8297('0x24')](_0x580f36[_0x8297('0x37')][_0x8297('0x24')]);_0x3ef77f[_0x8297('0x21')]=qs[_0x8297('0x21')](_0x580f36[_0x8297('0x37')][_0x8297('0x21')]);}_0x3ef77f[_0x8297('0x3f')]=qs[_0x8297('0x40')](_0x580f36['query']['sort']);_0x3ef77f[_0x8297('0x41')]=qs['filters'](_[_0x8297('0x42')](_0x580f36[_0x8297('0x37')],_0x5b7f01[_0x8297('0x38')]),_0x1898e4);if(_0x580f36[_0x8297('0x37')]['filter']){_0x3ef77f['where']=_[_0x8297('0x43')](_0x3ef77f['where'],{'$or':_[_0x8297('0x31')](_0x1898e4,function(_0x2d66e8){if(_0x2d66e8['type']!==_0x8297('0x44')){var _0x229c44={};_0x229c44[_0x2d66e8['name']]={'$like':'%'+_0x580f36[_0x8297('0x37')]['filter']+'%'};return _0x229c44;}})});}_0x3ef77f=_['merge']({},_0x3ef77f,_0x580f36[_0x8297('0x45')]);var _0x223184={'where':_0x3ef77f[_0x8297('0x41')]};return db['Plugin'][_0x8297('0x23')](_0x223184)[_0x8297('0x29')](function(_0x5901df){_0x11d7e3[_0x8297('0x23')]=_0x5901df;if(_0x580f36[_0x8297('0x37')][_0x8297('0x46')]){_0x3ef77f['include']=[{'all':!![]}];}return db['Plugin'][_0x8297('0x47')](_0x3ef77f);})[_0x8297('0x29')](function(_0x4082e0){_0x11d7e3['rows']=_0x4082e0;return _0x11d7e3;})[_0x8297('0x29')](respondWithFilteredResult(_0x2a94de,_0x3ef77f))[_0x8297('0x48')](handleError(_0x2a94de,null));};exports[_0x8297('0x49')]=function(_0x1e70f7,_0x53f60a){var _0x4595fb={'raw':!![],'where':{'id':_0x1e70f7[_0x8297('0x4a')]['id']}},_0x22f5ce={};_0x22f5ce['model']=_[_0x8297('0x4b')](db[_0x8297('0x32')][_0x8297('0x4c')]);_0x22f5ce[_0x8297('0x37')]=_[_0x8297('0x4b')](_0x1e70f7[_0x8297('0x37')]);_0x22f5ce[_0x8297('0x38')]=_[_0x8297('0x39')](_0x22f5ce[_0x8297('0x36')],_0x22f5ce[_0x8297('0x37')]);_0x4595fb[_0x8297('0x3a')]=_[_0x8297('0x39')](_0x22f5ce[_0x8297('0x36')],qs[_0x8297('0x3b')](_0x1e70f7[_0x8297('0x37')][_0x8297('0x3b')]));_0x4595fb[_0x8297('0x3a')]=_0x4595fb[_0x8297('0x3a')][_0x8297('0x3c')]?_0x4595fb[_0x8297('0x3a')]:_0x22f5ce[_0x8297('0x36')];if(_0x1e70f7['query'][_0x8297('0x46')]){_0x4595fb[_0x8297('0x4d')]=[{'all':!![]}];}_0x4595fb=_['merge']({},_0x4595fb,_0x1e70f7[_0x8297('0x45')]);return db[_0x8297('0x32')]['find'](_0x4595fb)[_0x8297('0x29')](handleEntityNotFound(_0x53f60a,null))[_0x8297('0x29')](respondWithResult(_0x53f60a,null))['catch'](handleError(_0x53f60a,null));};exports[_0x8297('0x4e')]=function(_0x454426,_0x450326,_0x29c354){return db[_0x8297('0x32')][_0x8297('0x4f')]({'where':{'id':_0x454426[_0x8297('0x4a')]['id']},'attributes':['name',_0x8297('0x7')],'raw':!![]})[_0x8297('0x29')](handleEntityNotFound(_0x450326,null))[_0x8297('0x29')](function(_0x2fa06a){if(_0x2fa06a){var _0x3653be=path[_0x8297('0x50')](config['root'],'server/files/plugins',util[_0x8297('0x51')](_0x8297('0x52'),path['basename'](_0x2fa06a[_0x8297('0x7')])));var _0x3d77bb=fs['createWriteStream'](_0x3653be);var _0x33338e=archiver('zip',{'zlib':{'level':0x9}});_0x33338e['on']('warning',function(_0x21145a){if(_0x21145a[_0x8297('0x53')]==='ENOENT'){logger['error'](_0x21145a);}else{throw new db[(_0x8297('0x54'))][(_0x8297('0x55'))](_0x8297('0x56'));}});_0x33338e['on'](_0x8297('0x57'),function(_0x33f6e6){throw new db[(_0x8297('0x54'))][(_0x8297('0x55'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x33338e['pipe'](_0x3d77bb);_0x33338e[_0x8297('0x58')]('**/*',{'cwd':path[_0x8297('0x50')](config[_0x8297('0x59')],_0x8297('0x5a'),path[_0x8297('0x5b')](_0x2fa06a[_0x8297('0x7')])),'ignore':[path['join'](path[_0x8297('0x5c')](_0x2fa06a[_0x8297('0x7')]),_0x8297('0x5d')),path[_0x8297('0x50')](path['basename'](_0x2fa06a[_0x8297('0x7')]),'attachments/**/*')],'nodir':!![]})['finalize']();_0x3d77bb['on'](_0x8297('0x5e'),function(){if(!fs[_0x8297('0x5f')](_0x3653be)){throw new db[(_0x8297('0x54'))][(_0x8297('0x55'))](_0x8297('0x60'));}return _0x450326[_0x8297('0x4e')](_0x3653be,util[_0x8297('0x51')](_0x8297('0x52'),path[_0x8297('0x5c')](_0x2fa06a[_0x8297('0x7')])),function(_0x373c5a){if(_0x373c5a){throw new db[(_0x8297('0x54'))]['Error'](_0x8297('0x61'));}fs['unlinkSync'](_0x3653be);logger[_0x8297('0x62')](_0x8297('0x63'));logger['info'](_0x8297('0x64'));});});}return null;})[_0x8297('0x48')](handleError(_0x450326,null));};exports[_0x8297('0x65')]=function(_0x256a6d,_0xb39d3f,_0x3432da){var _0xafeae=path[_0x8297('0x5c')](_0x256a6d['file']['filename'],path[_0x8297('0x66')](_0x256a6d[_0x8297('0x67')][_0x8297('0x68')]));var _0x35d867=path[_0x8297('0x50')](config[_0x8297('0x59')],'server/files/plugins',_0x256a6d[_0x8297('0x67')]['filename']);var _0x9f1a7f=path[_0x8297('0x50')](config[_0x8297('0x59')],'server/files/plugins',_0xafeae);logger[_0x8297('0x62')](_0x8297('0x69'),_0x35d867);logger[_0x8297('0x62')](_0x8297('0x6a'),_0x9f1a7f);try{fs[_0x8297('0x6b')](_0x35d867,parseInt(_0x8297('0x6c'),0x8));extract(_0x35d867,{'dir':_0x9f1a7f},function(_0x2a5124){if(_0x2a5124){logger['error'](_0x2a5124);handleError(_0x2a5124,!![]);};var _0x175f02=fs[_0x8297('0x6d')](_0x9f1a7f);if(_0x175f02['length']>0x1){removeReferences(_0x35d867,_0x9f1a7f);logger[_0x8297('0x57')](_0x8297('0x6e'));return _0x3432da(new Error(_0x8297('0x6e')));}var _0xcfe71d=fs[_0x8297('0x6f')](path['join'](_0x9f1a7f,_0x175f02[0x0]));if(_0xcfe71d[_0x8297('0x70')]()){removeReferences(_0x35d867,_0x9f1a7f);logger[_0x8297('0x57')](_0x8297('0x6e'));return _0x3432da(new Error(_0x8297('0x6e')));}if(_0xcfe71d[_0x8297('0x71')]()){var _0x1dcf44=fs['readdirSync'](path[_0x8297('0x50')](_0x9f1a7f,_0x175f02[0x0]));if(_0x1dcf44['length']===0x0){removeReferences(_0x35d867,_0x9f1a7f);logger[_0x8297('0x57')](_0x8297('0x6e'));return _0x3432da(new Error('Invalid\x20plugin\x20structure'));}var _0x12a34e=_0x1dcf44[_0x8297('0x72')](function(_0x3e04c2){return _0x3e04c2==='manifest.json';});if(!_0x12a34e){return _0x3432da(new Error(_0x8297('0x73')));}var _0x3b7231=fs[_0x8297('0x74')](path[_0x8297('0x50')](_0x9f1a7f,_0x175f02[0x0],_0x8297('0x75')));var _0x45d073=JSON[_0x8297('0x76')](_0x3b7231);if(_0x8297('0x22')==typeof _0x45d073['name']){return _0x3432da(new Error(_0x8297('0x77')));}if(_0x8297('0x22')==typeof _0x45d073['type']){return _0x3432da(new Error(_0x8297('0x78')));}if(_0x8297('0x22')==typeof _0x45d073[_0x8297('0x79')]){return _0x3432da(new Error(_0x8297('0x7a')));}if(_0x8297('0x22')==typeof _0x45d073[_0x8297('0x7b')]){return _0x3432da(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x45d073[_0x8297('0x34')]==='html'){if(_0x8297('0x22')==typeof _0x45d073['parameters']['views']){return _0x3432da(new Error(_0x8297('0x7c')));}if('undefined'==typeof _0x45d073['parameters'][_0x8297('0x7d')][_0x8297('0x7e')]&&_0x8297('0x22')==typeof _0x45d073[_0x8297('0x7b')][_0x8297('0x7d')]['agent']){return _0x3432da(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x45d073['type']===_0x8297('0x7f')){if(_0x8297('0x22')==typeof _0x45d073[_0x8297('0x7b')]['scriptName']){return _0x3432da(new Error(_0x8297('0x80')));}if(_0x8297('0x22')==typeof _0x45d073[_0x8297('0x7b')]['scriptPath']){return _0x3432da(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x3432da(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x169e49=_0x45d073['name'];var _0x14761b=_0x45d073['description'];var _0x2e9e79=_0x45d073[_0x8297('0x34')];var _0x2c89ac=_0x45d073[_0x8297('0x81')]?_0x45d073[_0x8297('0x81')]:_0x8297('0x82');var _0x134fdd=_0x45d073['icon']?_0x45d073[_0x8297('0x83')]:_0x8297('0x84');var _0x8d52da='';var _0x3dc551='';var _0x550562='';var _0x332e09='';var _0xb39074=_0x45d073['version'];if(_0x2e9e79===_0x8297('0x85')){if(_0x8297('0x22')!=typeof _0x45d073['parameters']['views'][_0x8297('0x7e')]){var _0x4f3ff1=_0x45d073[_0x8297('0x7b')]['views']['admin'];if(!/^(f|ht)tps?:\/\//i[_0x8297('0x86')](_0x4f3ff1)){_0x8d52da=path[_0x8297('0x50')](_0x8297('0x87'),_0xafeae,_0x175f02[0x0],_0x4f3ff1);}else{_0x8d52da=_0x4f3ff1;}}else{logger[_0x8297('0x62')](_0x8297('0x88'));}if('undefined'!=typeof _0x45d073['parameters']['views']['agent']){var _0x1950f2=_0x45d073[_0x8297('0x7b')][_0x8297('0x7d')]['agent'];if(!/^(f|ht)tps?:\/\//i['test'](_0x1950f2)){_0x3dc551=path['join']('plugins',_0xafeae,_0x175f02[0x0],_0x1950f2);}else{_0x3dc551=_0x1950f2;}}else{logger[_0x8297('0x62')](_0x8297('0x89'));}}else if(_0x2e9e79===_0x8297('0x7f')){_0x550562=_0x45d073[_0x8297('0x7b')]['scriptName'];_0x332e09=_0x45d073[_0x8297('0x7b')]['scriptPath'];if('undefined'!=typeof _0x45d073[_0x8297('0x7b')][_0x8297('0x7d')]){if(_0x8297('0x22')!=typeof _0x45d073[_0x8297('0x7b')][_0x8297('0x7d')]['admin']){var _0x4f3ff1=_0x45d073['parameters'][_0x8297('0x7d')][_0x8297('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0x8297('0x86')](_0x4f3ff1)){_0x8d52da=path[_0x8297('0x50')](_0x8297('0x87'),_0xafeae,_0x175f02[0x0],_0x4f3ff1);}else{_0x8d52da=_0x4f3ff1;}}if(_0x8297('0x22')!=typeof _0x45d073[_0x8297('0x7b')][_0x8297('0x7d')][_0x8297('0x8a')]){var _0x1950f2=_0x45d073[_0x8297('0x7b')][_0x8297('0x7d')][_0x8297('0x8a')];if(!/^(f|ht)tps?:\/\//i['test'](_0x1950f2)){_0x3dc551=path[_0x8297('0x50')](_0x8297('0x87'),_0xafeae,_0x175f02[0x0],_0x1950f2);}else{_0x3dc551=_0x1950f2;}}}}var _0x4428a9={'name':_0x169e49,'description':_0x14761b,'path':path[_0x8297('0x50')](_0xafeae,_0x175f02[0x0]),'type':_0x2e9e79,'sidebar':_0x2c89ac,'icon':_0x134fdd,'adminUrl':_0x8d52da,'agentUrl':_0x3dc551,'scriptName':_0x550562,'scriptPath':_0x332e09,'version':_0xb39074};removeReferences(_0x35d867,null);return db[_0x8297('0x32')][_0x8297('0x8b')](_0x4428a9)[_0x8297('0x29')](function(_0x321a42){var _0x4453ab={'role':_0x256a6d[_0x8297('0x8c')][_0x8297('0x8d')],'userProfileId':_0x256a6d[_0x8297('0x8c')][_0x8297('0x8e')]};if(!_0x4453ab)throw new Error(_0x8297('0x8f'));if(_0x4453ab[_0x8297('0x8d')]===_0x8297('0x90')){var _0xc86174=_0x321a42[_0x8297('0x91')]({'plain':!![]});return db[_0x8297('0x92')][_0x8297('0x4f')]({'where':{'name':'Plugins','userProfileId':_0x4453ab[_0x8297('0x8e')]},'raw':!![]})[_0x8297('0x29')](function(_0xea26eb){if(_0xea26eb&&_0xea26eb['autoAssociation']===0x0){return db['UserProfileResource'][_0x8297('0x8b')]({'name':_0xc86174[_0x8297('0x2e')],'resourceId':_0xc86174['id'],'type':_0xea26eb['name'],'sectionId':_0xea26eb['id']},{})['then'](function(){return _0x321a42;});}else{return _0x321a42;}})[_0x8297('0x48')](function(_0x2429bf){logger[_0x8297('0x57')](_0x8297('0x93'),_0x2429bf);throw _0x2429bf;});}return _0x321a42;})['then'](respondWithResult(_0xb39d3f,null))[_0x8297('0x48')](handleError(_0xb39d3f,null));}});}catch(_0x53acd9){_0xb39d3f['status'](0x1f4)[_0x8297('0x2f')](_0x53acd9);}};function removeReferences(_0x3ee9f6,_0x5ab867){try{if(_0x3ee9f6){fs[_0x8297('0x94')](_0x3ee9f6);logger[_0x8297('0x62')](_0x8297('0x95'));}if(_0x5ab867){rimraf(_0x5ab867,function(){});logger['info'](_0x8297('0x96'));}}catch(_0x1dc0e7){logger[_0x8297('0x57')](_0x1dc0e7);}}exports[_0x8297('0x28')]=function(_0x3c180f,_0x55ced2,_0x3a234d){return db['Plugin'][_0x8297('0x4f')]({'where':{'id':_0x3c180f[_0x8297('0x4a')]['id']}})[_0x8297('0x29')](handleEntityNotFound(_0x55ced2,null))[_0x8297('0x29')](saveUpdates(_0x3c180f[_0x8297('0x8c')],null))[_0x8297('0x29')](respondWithResult(_0x55ced2,null))['catch'](handleError(_0x55ced2,null));};exports[_0x8297('0x97')]=function(_0x2394b2,_0x1016b2,_0x3f5f62){return db['Plugin']['find']({'where':{'id':_0x2394b2['params']['id']}})['then'](function(_0x5a650d){if(_0x5a650d){return _0x5a650d['destroy']();}})['then'](function(_0x1f230d){rimraf(path[_0x8297('0x50')](config[_0x8297('0x59')],'server/files/plugins',path[_0x8297('0x5b')](_0x1f230d[_0x8297('0x7')])),function(){});return _0x1f230d;})[_0x8297('0x29')](handleEntityNotFound(_0x1016b2,null))['then'](respondWithStatusCode(_0x1016b2,null))['catch'](handleError(_0x1016b2,null));};exports[_0x8297('0x98')]=function(_0xd87a82,_0x465389,_0x430c69){return BPromise[_0x8297('0x99')]()[_0x8297('0x29')](function(){if(!_0xd87a82[_0x8297('0x37')][_0x8297('0x7')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0xd87a82[_0x8297('0x37')][_0x8297('0x9a')]){throw new Error(_0x8297('0x9b'));}var _0x54bbc5=_0xd87a82['query'][_0x8297('0x9c')]?_0xd87a82['query'][_0x8297('0x9c')]+':'+_0xd87a82[_0x8297('0x37')]['port']:_0x8297('0x9d')+_0xd87a82[_0x8297('0x37')][_0x8297('0x9a')];var _0x2b91d6=_0xd87a82[_0x8297('0x37')][_0x8297('0x20')]?_0xd87a82[_0x8297('0x37')][_0x8297('0x20')]:!![];var _0x3debb4=_0xd87a82[_0x8297('0x37')][_0x8297('0x9e')]?_0xd87a82[_0x8297('0x37')][_0x8297('0x9e')]:null;var _0x4b1c7b={'method':_0xd87a82['method'],'uri':util[_0x8297('0x51')](_0x8297('0x9f'),_0x54bbc5,_0xd87a82[_0x8297('0x37')][_0x8297('0x7')]),'json':_0x2b91d6,'resolveWithFullResponse':!![],'encoding':_0x3debb4,'qs':_0xd87a82[_0x8297('0x37')]};if(_0xd87a82['headers']){_0x4b1c7b[_0x8297('0xa0')]=_0xd87a82['headers'];if(_0x4b1c7b[_0x8297('0xa0')][_0x8297('0xa1')]){delete _0x4b1c7b['headers']['content-length'];}}if(_0x4b1c7b['headers'][_0x8297('0xa2')]){delete _0x4b1c7b[_0x8297('0xa0')][_0x8297('0xa2')];}return rp(_0x4b1c7b);})[_0x8297('0x29')](function(_0xb20287){if(_0xb20287){_0x465389[_0x8297('0x25')](_0xb20287[_0x8297('0xa0')]);logger[_0x8297('0x62')](_0xb20287[_0x8297('0x8c')]);if(_[_0x8297('0xa3')](_0xd87a82[_0x8297('0x37')][_0x8297('0x7')],_0x8297('0x4e'))&&_0xb20287[_0x8297('0xa4')]==0x1f4){return _0x465389[_0x8297('0x2c')](_0xb20287[_0x8297('0xa4')]);}else{return _0x465389['status'](_0xb20287['statusCode'])[_0x8297('0x2f')](_0xb20287['body']);}}else{return _0x465389[_0x8297('0x2c')](0xc8);}})[_0x8297('0x48')](handleError(_0x465389,null));};exports['webhookPost']=function(_0x644286,_0x1c303c,_0x17ea71){return BPromise['resolve']()[_0x8297('0x29')](function(){if(!_0x644286[_0x8297('0x37')]['path']){throw new Error(_0x8297('0xa5'));}if(!_0x644286[_0x8297('0x37')][_0x8297('0x9a')]){throw new Error(_0x8297('0x9b'));}var _0x3e9a9b=_0x644286[_0x8297('0x37')][_0x8297('0x9c')]?_0x644286[_0x8297('0x37')]['hostname']+':'+_0x644286[_0x8297('0x37')][_0x8297('0x9a')]:_0x8297('0x9d')+_0x644286[_0x8297('0x37')]['port'];var _0x1eaedf=_0x644286[_0x8297('0x37')][_0x8297('0x20')]?_0x644286[_0x8297('0x37')][_0x8297('0x20')]:!![];var _0x567426=_0x644286[_0x8297('0x37')][_0x8297('0x9e')]?_0x644286[_0x8297('0x37')][_0x8297('0x9e')]:null;var _0x4d9107={'method':_0x644286[_0x8297('0xa6')],'uri':util[_0x8297('0x51')](_0x8297('0x9f'),_0x3e9a9b,_0x644286[_0x8297('0x37')][_0x8297('0x7')]),'json':_0x1eaedf,'resolveWithFullResponse':!![],'encoding':_0x567426,'body':_0x644286['body']};if(_0x644286[_0x8297('0xa0')]){_0x4d9107[_0x8297('0xa0')]=_0x644286[_0x8297('0xa0')];if(_0x4d9107[_0x8297('0xa0')][_0x8297('0xa1')]){delete _0x4d9107['headers'][_0x8297('0xa1')];}}if(_0x4d9107[_0x8297('0xa0')][_0x8297('0xa2')]){delete _0x4d9107['headers']['content-type'];}return rp(_0x4d9107);})[_0x8297('0x29')](function(_0x2fcb97){if(_0x2fcb97){_0x1c303c['set'](_0x2fcb97[_0x8297('0xa0')]);logger[_0x8297('0x62')](_0x2fcb97[_0x8297('0x8c')]);return _0x1c303c['status'](_0x2fcb97['statusCode'])['send'](_0x2fcb97[_0x8297('0x8c')]);}else{return _0x1c303c[_0x8297('0x2c')](0xc8);}})[_0x8297('0x48')](handleError(_0x1c303c,null));}; \ No newline at end of file +var _0xa61f=['../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','Plugins','UserProfileResource','error','stack','name','send','index','map','Plugin','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','find','join','root','format','%s.zip','basename','createWriteStream','warning','code','ENOENT','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','pipe','dirname','node_modules/**/*','finalize','close','existsSync','Plugin\x20not\x20found','download','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','extname','server/files/plugins','Plugin\x20upload\x20filepath:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','Invalid\x20manifest:\x20views\x20missing','views','script','scriptName','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','icon','version','admin','test','Warning:\x20admin\x20view\x20not\x20specified','agent','plugins','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','userProfileId','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','%s%s','headers','content-length','content-type','statusCode','method','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','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','../../config/license/util'];(function(_0x337813,_0x390d10){var _0x683993=function(_0x60eb10){while(--_0x60eb10){_0x337813['push'](_0x337813['shift']());}};_0x683993(++_0x390d10);}(_0xa61f,0x1ee));var _0xfa61=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xa61f[_0x19950b];return _0x3c6b41;};'use strict';var emlformat=require(_0xfa61('0x0'));var rimraf=require(_0xfa61('0x1'));var zipdir=require(_0xfa61('0x2'));var jsonpatch=require(_0xfa61('0x3'));var rp=require(_0xfa61('0x4'));var moment=require(_0xfa61('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xfa61('0x6'));var util=require(_0xfa61('0x7'));var path=require(_0xfa61('0x8'));var sox=require(_0xfa61('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfa61('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xfa61('0xb'));var jsforce=require(_0xfa61('0xc'));var deskjs=require(_0xfa61('0xd'));var toCsv=require(_0xfa61('0xe'));var querystring=require(_0xfa61('0xf'));var Papa=require(_0xfa61('0x10'));var extract=require(_0xfa61('0x11'));var rimraf=require(_0xfa61('0x1'));var archiver=require(_0xfa61('0x12'));var Redis=require(_0xfa61('0x13'));var authService=require(_0xfa61('0x14'));var qs=require(_0xfa61('0x15'));var as=require(_0xfa61('0x16'));var hardwareService=require(_0xfa61('0x17'));var logger=require(_0xfa61('0x18'))(_0xfa61('0x19'));var utils=require('../../config/utils');var config=require(_0xfa61('0x1a'));var licenseUtil=require(_0xfa61('0x1b'));var db=require(_0xfa61('0x1c'))['db'];config[_0xfa61('0x1d')]=_[_0xfa61('0x1e')](config[_0xfa61('0x1d')],{'host':_0xfa61('0x1f'),'port':0x18eb});var socket=require(_0xfa61('0x20'))(new Redis(config[_0xfa61('0x1d')]));require(_0xfa61('0x21'))[_0xfa61('0x22')](socket);function respondWithStatusCode(_0x58fba2,_0x14e9c1){_0x14e9c1=_0x14e9c1||0xcc;return function(_0x209221){if(_0x209221){return _0x58fba2[_0xfa61('0x23')](_0x14e9c1);}return _0x58fba2['status'](_0x14e9c1)[_0xfa61('0x24')]();};}function respondWithResult(_0x380b82,_0x2da3eb){_0x2da3eb=_0x2da3eb||0xc8;return function(_0x3eef36){if(_0x3eef36){return _0x380b82[_0xfa61('0x25')](_0x2da3eb)[_0xfa61('0x26')](_0x3eef36);}};}function respondWithFilteredResult(_0x10b685,_0x14a24f){return function(_0x78db97){if(_0x78db97){var _0x3d64e7=typeof _0x14a24f[_0xfa61('0x27')]==='undefined'&&typeof _0x14a24f[_0xfa61('0x28')]===_0xfa61('0x29');var _0x2635a3=_0x78db97[_0xfa61('0x2a')];var _0x3e26b3=_0x3d64e7?0x0:_0x14a24f[_0xfa61('0x27')];var _0x37a208=_0x3d64e7?_0x78db97[_0xfa61('0x2a')]:_0x14a24f[_0xfa61('0x27')]+_0x14a24f['limit'];var _0x46734e;if(_0x37a208>=_0x2635a3){_0x37a208=_0x2635a3;_0x46734e=0xc8;}else{_0x46734e=0xce;}_0x10b685[_0xfa61('0x25')](_0x46734e);return _0x10b685[_0xfa61('0x2b')](_0xfa61('0x2c'),_0x3e26b3+'-'+_0x37a208+'/'+_0x2635a3)['json'](_0x78db97);}return null;};}function patchUpdates(_0x1c6cb1){return function(_0x41f993){try{jsonpatch[_0xfa61('0x2d')](_0x41f993,_0x1c6cb1,!![]);}catch(_0x3d4e7b){return BPromise[_0xfa61('0x2e')](_0x3d4e7b);}return _0x41f993[_0xfa61('0x2f')]();};}function saveUpdates(_0x240c66,_0x13902e){return function(_0x43bd11){if(_0x43bd11){return _0x43bd11['update'](_0x240c66)[_0xfa61('0x30')](function(_0x2e8076){return _0x2e8076;});}return null;};}function removeEntity(_0x452fc6,_0x338ac3){return function(_0x248800){if(_0x248800){return _0x248800[_0xfa61('0x31')]()['then'](function(){var _0x5c131c=_0x248800['get']({'plain':!![]});var _0x2a46d8=_0xfa61('0x32');return db[_0xfa61('0x33')]['destroy']({'where':{'type':_0x2a46d8,'resourceId':_0x5c131c['id']}})[_0xfa61('0x30')](function(){return _0x248800;});})['then'](function(){_0x452fc6[_0xfa61('0x25')](0xcc)[_0xfa61('0x24')]();});}};}function handleEntityNotFound(_0x2946de,_0x15b108){return function(_0x1a9742){if(!_0x1a9742){_0x2946de[_0xfa61('0x23')](0x194);}return _0x1a9742;};}function handleError(_0x36e25c,_0x4ca8b3){_0x4ca8b3=_0x4ca8b3||0x1f4;return function(_0x5446c7){logger[_0xfa61('0x34')](_0x5446c7[_0xfa61('0x35')]);if(_0x5446c7[_0xfa61('0x36')]){delete _0x5446c7['name'];}_0x36e25c[_0xfa61('0x25')](_0x4ca8b3)[_0xfa61('0x37')](_0x5446c7);};}exports[_0xfa61('0x38')]=function(_0x4a6777,_0x473a26){var _0x223d47={},_0x5f53b6={},_0x2ce810={'count':0x0,'rows':[]};var _0x3d1629=_[_0xfa61('0x39')](db[_0xfa61('0x3a')][_0xfa61('0x3b')],function(_0x387302){return{'name':_0x387302[_0xfa61('0x3c')],'type':_0x387302[_0xfa61('0x3d')][_0xfa61('0x3e')]};});_0x5f53b6[_0xfa61('0x3f')]=_[_0xfa61('0x39')](_0x3d1629,_0xfa61('0x36'));_0x5f53b6[_0xfa61('0x40')]=_[_0xfa61('0x41')](_0x4a6777[_0xfa61('0x40')]);_0x5f53b6[_0xfa61('0x42')]=_[_0xfa61('0x43')](_0x5f53b6[_0xfa61('0x3f')],_0x5f53b6[_0xfa61('0x40')]);_0x223d47[_0xfa61('0x44')]=_[_0xfa61('0x43')](_0x5f53b6[_0xfa61('0x3f')],qs[_0xfa61('0x45')](_0x4a6777['query'][_0xfa61('0x45')]));_0x223d47[_0xfa61('0x44')]=_0x223d47[_0xfa61('0x44')][_0xfa61('0x46')]?_0x223d47[_0xfa61('0x44')]:_0x5f53b6[_0xfa61('0x3f')];if(!_0x4a6777[_0xfa61('0x40')][_0xfa61('0x47')](_0xfa61('0x48'))){_0x223d47[_0xfa61('0x28')]=qs[_0xfa61('0x28')](_0x4a6777[_0xfa61('0x40')][_0xfa61('0x28')]);_0x223d47[_0xfa61('0x27')]=qs['offset'](_0x4a6777[_0xfa61('0x40')][_0xfa61('0x27')]);}_0x223d47[_0xfa61('0x49')]=qs[_0xfa61('0x4a')](_0x4a6777['query'][_0xfa61('0x4a')]);_0x223d47[_0xfa61('0x4b')]=qs[_0xfa61('0x42')](_[_0xfa61('0x4c')](_0x4a6777[_0xfa61('0x40')],_0x5f53b6['filters']),_0x3d1629);if(_0x4a6777['query'][_0xfa61('0x4d')]){_0x223d47[_0xfa61('0x4b')]=_[_0xfa61('0x4e')](_0x223d47[_0xfa61('0x4b')],{'$or':_[_0xfa61('0x39')](_0x3d1629,function(_0x485cae){if(_0x485cae['type']!==_0xfa61('0x4f')){var _0x596df5={};_0x596df5[_0x485cae[_0xfa61('0x36')]]={'$like':'%'+_0x4a6777[_0xfa61('0x40')][_0xfa61('0x4d')]+'%'};return _0x596df5;}})});}_0x223d47=_[_0xfa61('0x4e')]({},_0x223d47,_0x4a6777['options']);var _0x379559={'where':_0x223d47[_0xfa61('0x4b')]};return db[_0xfa61('0x3a')][_0xfa61('0x2a')](_0x379559)[_0xfa61('0x30')](function(_0x3e77d9){_0x2ce810[_0xfa61('0x2a')]=_0x3e77d9;if(_0x4a6777[_0xfa61('0x40')][_0xfa61('0x50')]){_0x223d47[_0xfa61('0x51')]=[{'all':!![]}];}return db[_0xfa61('0x3a')][_0xfa61('0x52')](_0x223d47);})[_0xfa61('0x30')](function(_0x5a3a31){_0x2ce810[_0xfa61('0x53')]=_0x5a3a31;return _0x2ce810;})[_0xfa61('0x30')](respondWithFilteredResult(_0x473a26,_0x223d47))[_0xfa61('0x54')](handleError(_0x473a26,null));};exports[_0xfa61('0x55')]=function(_0x5b0b7a,_0x5ecdbc){var _0x438572={'raw':!![],'where':{'id':_0x5b0b7a[_0xfa61('0x56')]['id']}},_0x3195aa={};_0x3195aa[_0xfa61('0x3f')]=_[_0xfa61('0x41')](db[_0xfa61('0x3a')][_0xfa61('0x3b')]);_0x3195aa[_0xfa61('0x40')]=_[_0xfa61('0x41')](_0x5b0b7a[_0xfa61('0x40')]);_0x3195aa[_0xfa61('0x42')]=_[_0xfa61('0x43')](_0x3195aa[_0xfa61('0x3f')],_0x3195aa[_0xfa61('0x40')]);_0x438572[_0xfa61('0x44')]=_['intersection'](_0x3195aa['model'],qs[_0xfa61('0x45')](_0x5b0b7a['query'][_0xfa61('0x45')]));_0x438572[_0xfa61('0x44')]=_0x438572[_0xfa61('0x44')][_0xfa61('0x46')]?_0x438572[_0xfa61('0x44')]:_0x3195aa['model'];if(_0x5b0b7a['query']['includeAll']){_0x438572[_0xfa61('0x51')]=[{'all':!![]}];}_0x438572=_[_0xfa61('0x4e')]({},_0x438572,_0x5b0b7a['options']);return db[_0xfa61('0x3a')][_0xfa61('0x57')](_0x438572)['then'](handleEntityNotFound(_0x5ecdbc,null))['then'](respondWithResult(_0x5ecdbc,null))['catch'](handleError(_0x5ecdbc,null));};exports['download']=function(_0x5c1e48,_0x32528b,_0x2962ab){return db[_0xfa61('0x3a')][_0xfa61('0x57')]({'where':{'id':_0x5c1e48['params']['id']},'attributes':[_0xfa61('0x36'),_0xfa61('0x8')],'raw':!![]})[_0xfa61('0x30')](handleEntityNotFound(_0x32528b,null))[_0xfa61('0x30')](function(_0x1d3823){if(_0x1d3823){var _0x5ebeb0=path[_0xfa61('0x58')](config[_0xfa61('0x59')],'server/files/plugins',util[_0xfa61('0x5a')](_0xfa61('0x5b'),path[_0xfa61('0x5c')](_0x1d3823[_0xfa61('0x8')])));var _0x50deb8=fs[_0xfa61('0x5d')](_0x5ebeb0);var _0x2ff40d=archiver('zip',{'zlib':{'level':0x9}});_0x2ff40d['on'](_0xfa61('0x5e'),function(_0x2b266d){if(_0x2b266d[_0xfa61('0x5f')]===_0xfa61('0x60')){logger['error'](_0x2b266d);}else{throw new db['Sequelize'][(_0xfa61('0x61'))](_0xfa61('0x62'));}});_0x2ff40d['on'](_0xfa61('0x34'),function(_0x26afff){throw new db[(_0xfa61('0x63'))][(_0xfa61('0x61'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x2ff40d[_0xfa61('0x64')](_0x50deb8);_0x2ff40d['glob']('**/*',{'cwd':path['join'](config[_0xfa61('0x59')],'server/files/plugins',path[_0xfa61('0x65')](_0x1d3823[_0xfa61('0x8')])),'ignore':[path['join'](path[_0xfa61('0x5c')](_0x1d3823[_0xfa61('0x8')]),_0xfa61('0x66')),path['join'](path[_0xfa61('0x5c')](_0x1d3823[_0xfa61('0x8')]),'attachments/**/*')],'nodir':!![]})[_0xfa61('0x67')]();_0x50deb8['on'](_0xfa61('0x68'),function(){if(!fs[_0xfa61('0x69')](_0x5ebeb0)){throw new db[(_0xfa61('0x63'))]['Error'](_0xfa61('0x6a'));}return _0x32528b[_0xfa61('0x6b')](_0x5ebeb0,util[_0xfa61('0x5a')](_0xfa61('0x5b'),path[_0xfa61('0x5c')](_0x1d3823[_0xfa61('0x8')])),function(_0x428182){if(_0x428182){throw new db[(_0xfa61('0x63'))][(_0xfa61('0x61'))](_0xfa61('0x6c'));}fs[_0xfa61('0x6d')](_0x5ebeb0);logger[_0xfa61('0x6e')](_0xfa61('0x6f'));logger[_0xfa61('0x6e')](_0xfa61('0x70'));});});}return null;})[_0xfa61('0x54')](handleError(_0x32528b,null));};exports[_0xfa61('0x71')]=function(_0x52aa6f,_0x1ac69e,_0x1a611c){var _0x44400e=path[_0xfa61('0x5c')](_0x52aa6f[_0xfa61('0x72')][_0xfa61('0x73')],path[_0xfa61('0x74')](_0x52aa6f[_0xfa61('0x72')][_0xfa61('0x73')]));var _0xaddce1=path[_0xfa61('0x58')](config['root'],_0xfa61('0x75'),_0x52aa6f['file'][_0xfa61('0x73')]);var _0x21db7e=path[_0xfa61('0x58')](config['root'],_0xfa61('0x75'),_0x44400e);logger[_0xfa61('0x6e')](_0xfa61('0x76'),_0xaddce1);logger[_0xfa61('0x6e')]('Plugin\x20upload\x20destination:\x20%s',_0x21db7e);try{fs[_0xfa61('0x77')](_0xaddce1,parseInt(_0xfa61('0x78'),0x8));extract(_0xaddce1,{'dir':_0x21db7e},function(_0x2a5ca6){if(_0x2a5ca6){logger['error'](_0x2a5ca6);handleError(_0x2a5ca6,!![]);};var _0x4833a2=fs[_0xfa61('0x79')](_0x21db7e);if(_0x4833a2[_0xfa61('0x46')]>0x1){removeReferences(_0xaddce1,_0x21db7e);logger[_0xfa61('0x34')]('Invalid\x20plugin\x20structure');return _0x1a611c(new Error(_0xfa61('0x7a')));}var _0x359f2c=fs[_0xfa61('0x7b')](path[_0xfa61('0x58')](_0x21db7e,_0x4833a2[0x0]));if(_0x359f2c[_0xfa61('0x7c')]()){removeReferences(_0xaddce1,_0x21db7e);logger[_0xfa61('0x34')](_0xfa61('0x7a'));return _0x1a611c(new Error(_0xfa61('0x7a')));}if(_0x359f2c['isDirectory']()){var _0x5deb16=fs[_0xfa61('0x79')](path[_0xfa61('0x58')](_0x21db7e,_0x4833a2[0x0]));if(_0x5deb16[_0xfa61('0x46')]===0x0){removeReferences(_0xaddce1,_0x21db7e);logger['error'](_0xfa61('0x7a'));return _0x1a611c(new Error(_0xfa61('0x7a')));}var _0xbc2a3d=_0x5deb16[_0xfa61('0x7d')](function(_0x1fb69b){return _0x1fb69b===_0xfa61('0x7e');});if(!_0xbc2a3d){return _0x1a611c(new Error(_0xfa61('0x7f')));}var _0x244438=fs[_0xfa61('0x80')](path[_0xfa61('0x58')](_0x21db7e,_0x4833a2[0x0],_0xfa61('0x7e')));var _0x309ced=JSON['parse'](_0x244438);if(_0xfa61('0x29')==typeof _0x309ced[_0xfa61('0x36')]){return _0x1a611c(new Error(_0xfa61('0x81')));}if(_0xfa61('0x29')==typeof _0x309ced[_0xfa61('0x3d')]){return _0x1a611c(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0xfa61('0x29')==typeof _0x309ced['version']){return _0x1a611c(new Error(_0xfa61('0x82')));}if('undefined'==typeof _0x309ced[_0xfa61('0x83')]){return _0x1a611c(new Error(_0xfa61('0x84')));}if(_0x309ced[_0xfa61('0x3d')]===_0xfa61('0x85')){if(_0xfa61('0x29')==typeof _0x309ced[_0xfa61('0x83')]['views']){return _0x1a611c(new Error(_0xfa61('0x86')));}if(_0xfa61('0x29')==typeof _0x309ced['parameters']['views']['admin']&&_0xfa61('0x29')==typeof _0x309ced['parameters'][_0xfa61('0x87')]['agent']){return _0x1a611c(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x309ced[_0xfa61('0x3d')]===_0xfa61('0x88')){if(_0xfa61('0x29')==typeof _0x309ced['parameters'][_0xfa61('0x89')]){return _0x1a611c(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0xfa61('0x29')==typeof _0x309ced[_0xfa61('0x83')][_0xfa61('0x8a')]){return _0x1a611c(new Error(_0xfa61('0x8b')));}}else{return _0x1a611c(new Error(_0xfa61('0x8c')));}var _0x540671=_0x309ced[_0xfa61('0x36')];var _0x1a7288=_0x309ced[_0xfa61('0x8d')];var _0x107e4b=_0x309ced['type'];var _0x370854=_0x309ced[_0xfa61('0x8e')]?_0x309ced[_0xfa61('0x8e')]:'always';var _0x5e0c51=_0x309ced['icon']?_0x309ced[_0xfa61('0x8f')]:'icon-apps';var _0x533231='';var _0x443c39='';var _0x4a1bab='';var _0x4e8b3f='';var _0x108d95=_0x309ced[_0xfa61('0x90')];if(_0x107e4b===_0xfa61('0x85')){if('undefined'!=typeof _0x309ced[_0xfa61('0x83')][_0xfa61('0x87')][_0xfa61('0x91')]){var _0x48ce70=_0x309ced[_0xfa61('0x83')]['views'][_0xfa61('0x91')];if(!/^(f|ht)tps?:\/\//i[_0xfa61('0x92')](_0x48ce70)){_0x533231=path[_0xfa61('0x58')]('plugins',_0x44400e,_0x4833a2[0x0],_0x48ce70);}else{_0x533231=_0x48ce70;}}else{logger[_0xfa61('0x6e')](_0xfa61('0x93'));}if(_0xfa61('0x29')!=typeof _0x309ced[_0xfa61('0x83')][_0xfa61('0x87')]['agent']){var _0x1a3f84=_0x309ced[_0xfa61('0x83')][_0xfa61('0x87')][_0xfa61('0x94')];if(!/^(f|ht)tps?:\/\//i['test'](_0x1a3f84)){_0x443c39=path['join'](_0xfa61('0x95'),_0x44400e,_0x4833a2[0x0],_0x1a3f84);}else{_0x443c39=_0x1a3f84;}}else{logger[_0xfa61('0x6e')](_0xfa61('0x96'));}}else if(_0x107e4b===_0xfa61('0x88')){_0x4a1bab=_0x309ced[_0xfa61('0x83')][_0xfa61('0x89')];_0x4e8b3f=_0x309ced['parameters'][_0xfa61('0x8a')];if('undefined'!=typeof _0x309ced[_0xfa61('0x83')][_0xfa61('0x87')]){if(_0xfa61('0x29')!=typeof _0x309ced['parameters'][_0xfa61('0x87')]['admin']){var _0x48ce70=_0x309ced[_0xfa61('0x83')][_0xfa61('0x87')][_0xfa61('0x91')];if(!/^(f|ht)tps?:\/\//i[_0xfa61('0x92')](_0x48ce70)){_0x533231=path[_0xfa61('0x58')](_0xfa61('0x95'),_0x44400e,_0x4833a2[0x0],_0x48ce70);}else{_0x533231=_0x48ce70;}}if('undefined'!=typeof _0x309ced[_0xfa61('0x83')][_0xfa61('0x87')][_0xfa61('0x94')]){var _0x1a3f84=_0x309ced[_0xfa61('0x83')][_0xfa61('0x87')][_0xfa61('0x94')];if(!/^(f|ht)tps?:\/\//i[_0xfa61('0x92')](_0x1a3f84)){_0x443c39=path[_0xfa61('0x58')](_0xfa61('0x95'),_0x44400e,_0x4833a2[0x0],_0x1a3f84);}else{_0x443c39=_0x1a3f84;}}}}var _0x32e001={'name':_0x540671,'description':_0x1a7288,'path':path[_0xfa61('0x58')](_0x44400e,_0x4833a2[0x0]),'type':_0x107e4b,'sidebar':_0x370854,'icon':_0x5e0c51,'adminUrl':_0x533231,'agentUrl':_0x443c39,'scriptName':_0x4a1bab,'scriptPath':_0x4e8b3f,'version':_0x108d95};removeReferences(_0xaddce1,null);return db['Plugin'][_0xfa61('0x97')](_0x32e001)['then'](function(_0xeb9d57){var _0x49c59a={'role':_0x52aa6f[_0xfa61('0x98')][_0xfa61('0x99')],'userProfileId':_0x52aa6f[_0xfa61('0x98')][_0xfa61('0x9a')]};if(!_0x49c59a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x49c59a[_0xfa61('0x99')]===_0xfa61('0x9b')){var _0xbf704c=_0xeb9d57['get']({'plain':!![]});return db[_0xfa61('0x9c')][_0xfa61('0x57')]({'where':{'name':_0xfa61('0x32'),'userProfileId':_0x49c59a[_0xfa61('0x9a')]},'raw':!![]})[_0xfa61('0x30')](function(_0x5672bb){if(_0x5672bb&&_0x5672bb[_0xfa61('0x9d')]===0x0){return db[_0xfa61('0x33')][_0xfa61('0x97')]({'name':_0xbf704c[_0xfa61('0x36')],'resourceId':_0xbf704c['id'],'type':_0x5672bb[_0xfa61('0x36')],'sectionId':_0x5672bb['id']},{})[_0xfa61('0x30')](function(){return _0xeb9d57;});}else{return _0xeb9d57;}})[_0xfa61('0x54')](function(_0x480c8a){logger[_0xfa61('0x34')](_0xfa61('0x9e'),_0x480c8a);throw _0x480c8a;});}return _0xeb9d57;})['then'](respondWithResult(_0x1ac69e,null))[_0xfa61('0x54')](handleError(_0x1ac69e,null));}});}catch(_0x59d4f2){_0x1ac69e[_0xfa61('0x25')](0x1f4)[_0xfa61('0x37')](_0x59d4f2);}};function removeReferences(_0x412950,_0x3869ab){try{if(_0x412950){fs['unlinkSync'](_0x412950);logger[_0xfa61('0x6e')](_0xfa61('0x9f'));}if(_0x3869ab){rimraf(_0x3869ab,function(){});logger[_0xfa61('0x6e')](_0xfa61('0xa0'));}}catch(_0x29501e){logger[_0xfa61('0x34')](_0x29501e);}}exports[_0xfa61('0xa1')]=function(_0x10944c,_0xfc51f4,_0x47864a){return db[_0xfa61('0x3a')]['find']({'where':{'id':_0x10944c['params']['id']}})[_0xfa61('0x30')](handleEntityNotFound(_0xfc51f4,null))[_0xfa61('0x30')](saveUpdates(_0x10944c[_0xfa61('0x98')],null))['then'](respondWithResult(_0xfc51f4,null))[_0xfa61('0x54')](handleError(_0xfc51f4,null));};exports['delete']=function(_0x35dda2,_0x49c578,_0xc15d22){return db[_0xfa61('0x3a')][_0xfa61('0x57')]({'where':{'id':_0x35dda2['params']['id']}})[_0xfa61('0x30')](function(_0x4556aa){if(_0x4556aa){return _0x4556aa[_0xfa61('0x31')]();}})[_0xfa61('0x30')](function(_0x1e417d){rimraf(path[_0xfa61('0x58')](config[_0xfa61('0x59')],'server/files/plugins',path[_0xfa61('0x65')](_0x1e417d[_0xfa61('0x8')])),function(){});return _0x1e417d;})['then'](handleEntityNotFound(_0x49c578,null))[_0xfa61('0x30')](respondWithStatusCode(_0x49c578,null))['catch'](handleError(_0x49c578,null));};exports['webhookGet']=function(_0x308270,_0x242948,_0x3ef778){return BPromise['resolve']()[_0xfa61('0x30')](function(){if(!_0x308270[_0xfa61('0x40')][_0xfa61('0x8')]){throw new Error(_0xfa61('0xa2'));}if(!_0x308270[_0xfa61('0x40')][_0xfa61('0xa3')]){throw new Error(_0xfa61('0xa4'));}var _0x274f27=_0x308270[_0xfa61('0x40')][_0xfa61('0xa5')]?_0x308270[_0xfa61('0x40')][_0xfa61('0xa5')]+':'+_0x308270[_0xfa61('0x40')][_0xfa61('0xa3')]:_0xfa61('0xa6')+_0x308270[_0xfa61('0x40')]['port'];var _0x3c2a73=_0x308270[_0xfa61('0x40')][_0xfa61('0x26')]?_0x308270[_0xfa61('0x40')][_0xfa61('0x26')]:!![];var _0x54fcd0=_0x308270['query'][_0xfa61('0xa7')]?_0x308270[_0xfa61('0x40')][_0xfa61('0xa7')]:null;var _0x3d121a={'method':_0x308270['method'],'uri':util[_0xfa61('0x5a')](_0xfa61('0xa8'),_0x274f27,_0x308270[_0xfa61('0x40')][_0xfa61('0x8')]),'json':_0x3c2a73,'resolveWithFullResponse':!![],'encoding':_0x54fcd0,'qs':_0x308270['query']};if(_0x308270['headers']){_0x3d121a[_0xfa61('0xa9')]=_0x308270[_0xfa61('0xa9')];if(_0x3d121a['headers']['content-length']){delete _0x3d121a[_0xfa61('0xa9')][_0xfa61('0xaa')];}}if(_0x3d121a[_0xfa61('0xa9')][_0xfa61('0xab')]){delete _0x3d121a[_0xfa61('0xa9')][_0xfa61('0xab')];}return rp(_0x3d121a);})[_0xfa61('0x30')](function(_0x420ee0){if(_0x420ee0){_0x242948[_0xfa61('0x2b')](_0x420ee0[_0xfa61('0xa9')]);logger['info'](_0x420ee0[_0xfa61('0x98')]);if(_['endsWith'](_0x308270[_0xfa61('0x40')][_0xfa61('0x8')],_0xfa61('0x6b'))&&_0x420ee0[_0xfa61('0xac')]==0x1f4){return _0x242948[_0xfa61('0x23')](_0x420ee0['statusCode']);}else{return _0x242948[_0xfa61('0x25')](_0x420ee0[_0xfa61('0xac')])['send'](_0x420ee0['body']);}}else{return _0x242948['sendStatus'](0xc8);}})[_0xfa61('0x54')](handleError(_0x242948,null));};exports['webhookPost']=function(_0x118fcf,_0x23b120,_0x512786){return BPromise['resolve']()[_0xfa61('0x30')](function(){if(!_0x118fcf[_0xfa61('0x40')][_0xfa61('0x8')]){throw new Error(_0xfa61('0xa2'));}if(!_0x118fcf['query'][_0xfa61('0xa3')]){throw new Error(_0xfa61('0xa4'));}var _0x32a4dc=_0x118fcf['query'][_0xfa61('0xa5')]?_0x118fcf['query']['hostname']+':'+_0x118fcf[_0xfa61('0x40')]['port']:_0xfa61('0xa6')+_0x118fcf[_0xfa61('0x40')]['port'];var _0x447546=_0x118fcf[_0xfa61('0x40')][_0xfa61('0x26')]?_0x118fcf[_0xfa61('0x40')][_0xfa61('0x26')]:!![];var _0x1d8e12=_0x118fcf[_0xfa61('0x40')][_0xfa61('0xa7')]?_0x118fcf[_0xfa61('0x40')]['encoding']:null;var _0x2455c3={'method':_0x118fcf[_0xfa61('0xad')],'uri':util[_0xfa61('0x5a')](_0xfa61('0xa8'),_0x32a4dc,_0x118fcf[_0xfa61('0x40')][_0xfa61('0x8')]),'json':_0x447546,'resolveWithFullResponse':!![],'encoding':_0x1d8e12,'body':_0x118fcf[_0xfa61('0x98')]};if(_0x118fcf[_0xfa61('0xa9')]){_0x2455c3[_0xfa61('0xa9')]=_0x118fcf['headers'];if(_0x2455c3[_0xfa61('0xa9')]['content-length']){delete _0x2455c3['headers'][_0xfa61('0xaa')];}}if(_0x2455c3[_0xfa61('0xa9')]['content-type']){delete _0x2455c3[_0xfa61('0xa9')]['content-type'];}return rp(_0x2455c3);})[_0xfa61('0x30')](function(_0x1234a2){if(_0x1234a2){_0x23b120[_0xfa61('0x2b')](_0x1234a2['headers']);logger[_0xfa61('0x6e')](_0x1234a2[_0xfa61('0x98')]);return _0x23b120[_0xfa61('0x25')](_0x1234a2[_0xfa61('0xac')])[_0xfa61('0x37')](_0x1234a2[_0xfa61('0x98')]);}else{return _0x23b120[_0xfa61('0x23')](0xc8);}})[_0xfa61('0x54')](handleError(_0x23b120,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index f3713e4..7302999 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 _0xf3fe=['save','update','emit','hook','exports','../../mysqldb','Plugin','setMaxListeners'];(function(_0x5c7e92,_0x2face4){var _0x1c43ef=function(_0x5560a3){while(--_0x5560a3){_0x5c7e92['push'](_0x5c7e92['shift']());}};_0x1c43ef(++_0x2face4);}(_0xf3fe,0x1cd));var _0xef3f=function(_0x4b09c8,_0x442f24){_0x4b09c8=_0x4b09c8-0x0;var _0x37eb95=_0xf3fe[_0x4b09c8];return _0x37eb95;};'use strict';var EventEmitter=require('events');var Plugin=require(_0xef3f('0x0'))['db'][_0xef3f('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0xef3f('0x2')](0x0);var events={'afterCreate':_0xef3f('0x3'),'afterUpdate':_0xef3f('0x4'),'afterDestroy':'remove'};function emitEvent(_0x29b501){return function(_0x18a97c,_0x171ff9,_0x431bc5){PluginEvents[_0xef3f('0x5')](_0x29b501+':'+_0x18a97c['id'],_0x18a97c);PluginEvents['emit'](_0x29b501,_0x18a97c);_0x431bc5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0xef3f('0x6')](e,emitEvent(event));}}module[_0xef3f('0x7')]=PluginEvents; \ No newline at end of file +var _0x1b65=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Plugin','setMaxListeners'];(function(_0x4835be,_0x37ee12){var _0x57534a=function(_0x20a2c9){while(--_0x20a2c9){_0x4835be['push'](_0x4835be['shift']());}};_0x57534a(++_0x37ee12);}(_0x1b65,0x1b4));var _0x51b6=function(_0x36b261,_0x504c02){_0x36b261=_0x36b261-0x0;var _0x2cf069=_0x1b65[_0x36b261];return _0x2cf069;};'use strict';var EventEmitter=require(_0x51b6('0x0'));var Plugin=require(_0x51b6('0x1'))['db'][_0x51b6('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x51b6('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x51b6('0x4'),'afterDestroy':_0x51b6('0x5')};function emitEvent(_0x3c6f36){return function(_0x2d5762,_0x1a1c26,_0x1ba2e9){PluginEvents[_0x51b6('0x6')](_0x3c6f36+':'+_0x2d5762['id'],_0x2d5762);PluginEvents['emit'](_0x3c6f36,_0x2d5762);_0x1ba2e9(null);};}for(var e in events){if(events[_0x51b6('0x7')](e)){var event=events[e];Plugin[_0x51b6('0x8')](e,emitEvent(event));}}module[_0x51b6('0x9')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 1e03172..54e5db9 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 _0xaaf1=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./plugin.attributes','define','Plugin','plugins','util'];(function(_0x5131a8,_0x3a3a6f){var _0x1fb0dd=function(_0x15abef){while(--_0x15abef){_0x5131a8['push'](_0x5131a8['shift']());}};_0x1fb0dd(++_0x3a3a6f);}(_0xaaf1,0x173));var _0x1aaf=function(_0x4543f5,_0x4b454f){_0x4543f5=_0x4543f5-0x0;var _0x3799b8=_0xaaf1[_0x4543f5];return _0x3799b8;};'use strict';var _=require('lodash');var util=require(_0x1aaf('0x0'));var logger=require(_0x1aaf('0x1'))(_0x1aaf('0x2'));var moment=require(_0x1aaf('0x3'));var BPromise=require(_0x1aaf('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1aaf('0x5'));var rimraf=require(_0x1aaf('0x6'));var config=require(_0x1aaf('0x7'));var attributes=require(_0x1aaf('0x8'));module['exports']=function(_0x4f6273,_0x557cbe){return _0x4f6273[_0x1aaf('0x9')](_0x1aaf('0xa'),attributes,{'tableName':_0x1aaf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x416c=['../../config/environment','./plugin.attributes','define','lodash','bluebird','request-promise','rimraf'];(function(_0x324e86,_0x81b1cb){var _0x592846=function(_0x33439c){while(--_0x33439c){_0x324e86['push'](_0x324e86['shift']());}};_0x592846(++_0x81b1cb);}(_0x416c,0x184));var _0xc416=function(_0x153bf9,_0x2faaaa){_0x153bf9=_0x153bf9-0x0;var _0xe61df7=_0x416c[_0x153bf9];return _0xe61df7;};'use strict';var _=require(_0xc416('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xc416('0x1'));var rp=require(_0xc416('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc416('0x3'));var config=require(_0xc416('0x4'));var attributes=require(_0xc416('0x5'));module['exports']=function(_0x7f160b,_0x140689){return _0x7f160b[_0xc416('0x6')]('Plugin',attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index 5e2fb8d..1be702d 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 _0x1d7c=['options','raw','debug','stringify','util','moment','randomstring','../../mysqldb','../../config/logger','http','redis','defaults','localhost','socket.io-emitter','request','then','info','Plugin,\x20%s,\x20%s','Plugin,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','CreatePlugin','create','body'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1d7c,0x1b4));var _0xc1d7=function(_0xb5179e,_0x67e31d){_0xb5179e=_0xb5179e-0x0;var _0x423511=_0x1d7c[_0xb5179e];return _0x423511;};'use strict';var _=require('lodash');var util=require(_0xc1d7('0x0'));var moment=require(_0xc1d7('0x1'));var BPromise=require('bluebird');var rs=require(_0xc1d7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc1d7('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xc1d7('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xc1d7('0x5')]({'port':0x232a});config[_0xc1d7('0x6')]=_[_0xc1d7('0x7')](config[_0xc1d7('0x6')],{'host':_0xc1d7('0x8'),'port':0x18eb});var socket=require(_0xc1d7('0x9'))(new Redis(config['redis']));require('./plugin.socket')['register'](socket);function respondWithRpcPromise(_0x909ad3,_0x31785b,_0x7e7474){return new BPromise(function(_0x38cca0,_0x2f78d8){return client[_0xc1d7('0xa')](_0x909ad3,_0x7e7474)[_0xc1d7('0xb')](function(_0x3a0994){logger[_0xc1d7('0xc')](_0xc1d7('0xd'),_0x31785b,'request\x20sent');logger['debug'](_0xc1d7('0xe'),_0x31785b,_0xc1d7('0xf'),JSON['stringify'](_0x3a0994));if(_0x3a0994[_0xc1d7('0x10')]){if(_0x3a0994['error'][_0xc1d7('0x11')]===0x1f4){logger[_0xc1d7('0x10')](_0xc1d7('0xd'),_0x31785b,_0x3a0994[_0xc1d7('0x10')]['message']);return _0x2f78d8(_0x3a0994['error'][_0xc1d7('0x12')]);}logger[_0xc1d7('0x10')]('Plugin,\x20%s,\x20%s',_0x31785b,_0x3a0994[_0xc1d7('0x10')][_0xc1d7('0x12')]);return _0x38cca0(_0x3a0994['error'][_0xc1d7('0x12')]);}else{logger[_0xc1d7('0xc')]('Plugin,\x20%s,\x20%s',_0x31785b,_0xc1d7('0xf'));_0x38cca0(_0x3a0994['result'][_0xc1d7('0x12')]);}})[_0xc1d7('0x13')](function(_0x5e5884){logger[_0xc1d7('0x10')](_0xc1d7('0xd'),_0x31785b,_0x5e5884);_0x2f78d8(_0x5e5884);});});}exports[_0xc1d7('0x14')]=function(_0x4717b1){var _0x15e734=this;return new Promise(function(_0x275e07,_0x52a9d8){return db['Plugin'][_0xc1d7('0x15')](_0x4717b1[_0xc1d7('0x16')],{'raw':_0x4717b1[_0xc1d7('0x17')]?_0x4717b1[_0xc1d7('0x17')][_0xc1d7('0x18')]===undefined?!![]:![]:!![]})[_0xc1d7('0xb')](function(_0x52d026){logger[_0xc1d7('0xc')](_0xc1d7('0x14'),_0x4717b1);logger[_0xc1d7('0x19')](_0xc1d7('0x14'),_0x4717b1,JSON[_0xc1d7('0x1a')](_0x52d026));_0x275e07(_0x52d026);})['catch'](function(_0x58bd08){logger[_0xc1d7('0x10')](_0xc1d7('0x14'),_0x58bd08[_0xc1d7('0x12')],_0x4717b1);_0x52a9d8(_0x15e734[_0xc1d7('0x10')](0x1f4,_0x58bd08[_0xc1d7('0x12')]));});});}; \ No newline at end of file +var _0x315c=['then','stringify','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','request','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','error','code','message','result','CreatePlugin','Plugin','body','raw'];(function(_0x8de54f,_0x271987){var _0x14cba4=function(_0x58ed41){while(--_0x58ed41){_0x8de54f['push'](_0x8de54f['shift']());}};_0x14cba4(++_0x271987);}(_0x315c,0xd5));var _0xc315=function(_0x1fdd54,_0x2f12f5){_0x1fdd54=_0x1fdd54-0x0;var _0x1870d7=_0x315c[_0x1fdd54];return _0x1870d7;};'use strict';var _=require(_0xc315('0x0'));var util=require(_0xc315('0x1'));var moment=require(_0xc315('0x2'));var BPromise=require('bluebird');var rs=require(_0xc315('0x3'));var fs=require('fs');var Redis=require(_0xc315('0x4'));var db=require(_0xc315('0x5'))['db'];var utils=require(_0xc315('0x6'));var logger=require('../../config/logger')(_0xc315('0x7'));var config=require(_0xc315('0x8'));var jayson=require(_0xc315('0x9'));var client=jayson[_0xc315('0xa')][_0xc315('0xb')]({'port':0x232a});config[_0xc315('0xc')]=_[_0xc315('0xd')](config[_0xc315('0xc')],{'host':_0xc315('0xe'),'port':0x18eb});var socket=require(_0xc315('0xf'))(new Redis(config[_0xc315('0xc')]));require(_0xc315('0x10'))[_0xc315('0x11')](socket);function respondWithRpcPromise(_0x1ca123,_0x7238c3,_0x5bc36f){return new BPromise(function(_0x2972a1,_0x4176f1){return client[_0xc315('0x12')](_0x1ca123,_0x5bc36f)['then'](function(_0x4bffc1){logger[_0xc315('0x13')](_0xc315('0x14'),_0x7238c3,_0xc315('0x15'));logger[_0xc315('0x16')](_0xc315('0x17'),_0x7238c3,_0xc315('0x15'),JSON['stringify'](_0x4bffc1));if(_0x4bffc1[_0xc315('0x18')]){if(_0x4bffc1[_0xc315('0x18')][_0xc315('0x19')]===0x1f4){logger[_0xc315('0x18')](_0xc315('0x14'),_0x7238c3,_0x4bffc1[_0xc315('0x18')][_0xc315('0x1a')]);return _0x4176f1(_0x4bffc1[_0xc315('0x18')][_0xc315('0x1a')]);}logger[_0xc315('0x18')]('Plugin,\x20%s,\x20%s',_0x7238c3,_0x4bffc1[_0xc315('0x18')]['message']);return _0x2972a1(_0x4bffc1[_0xc315('0x18')][_0xc315('0x1a')]);}else{logger[_0xc315('0x13')](_0xc315('0x14'),_0x7238c3,_0xc315('0x15'));_0x2972a1(_0x4bffc1[_0xc315('0x1b')][_0xc315('0x1a')]);}})['catch'](function(_0xd5caba){logger[_0xc315('0x18')](_0xc315('0x14'),_0x7238c3,_0xd5caba);_0x4176f1(_0xd5caba);});});}exports[_0xc315('0x1c')]=function(_0x1ee70e){var _0x38a1cc=this;return new Promise(function(_0x50c0db,_0x26b6ea){return db[_0xc315('0x1d')]['create'](_0x1ee70e[_0xc315('0x1e')],{'raw':_0x1ee70e['options']?_0x1ee70e['options'][_0xc315('0x1f')]===undefined?!![]:![]:!![]})[_0xc315('0x20')](function(_0x2b5c3f){logger['info']('CreatePlugin',_0x1ee70e);logger[_0xc315('0x16')]('CreatePlugin',_0x1ee70e,JSON[_0xc315('0x21')](_0x2b5c3f));_0x50c0db(_0x2b5c3f);})[_0xc315('0x22')](function(_0x34bab9){logger[_0xc315('0x18')](_0xc315('0x1c'),_0x34bab9[_0xc315('0x1a')],_0x1ee70e);_0x26b6ea(_0x38a1cc[_0xc315('0x18')](0x1f4,_0x34bab9['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 8c4e97f..42c1830 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 _0xf1b4=['remove','update','emit','register','plugin:','./plugin.events','save'];(function(_0x35c04a,_0x1b02e6){var _0x597229=function(_0x4e04a0){while(--_0x4e04a0){_0x35c04a['push'](_0x35c04a['shift']());}};_0x597229(++_0x1b02e6);}(_0xf1b4,0x8a));var _0x4f1b=function(_0x6e5a7,_0x48c04b){_0x6e5a7=_0x6e5a7-0x0;var _0xc424d7=_0xf1b4[_0x6e5a7];return _0xc424d7;};'use strict';var PluginEvents=require(_0x4f1b('0x0'));var events=[_0x4f1b('0x1'),_0x4f1b('0x2'),_0x4f1b('0x3')];function createListener(_0x577091,_0x1e2015){return function(_0xf95d1b){_0x1e2015[_0x4f1b('0x4')](_0x577091,_0xf95d1b);};}function removeListener(_0x44c216,_0x93602e){return function(){PluginEvents['removeListener'](_0x44c216,_0x93602e);};}exports[_0x4f1b('0x5')]=function(_0x4c0f56){for(var _0x59782e=0x0,_0x88ce46=events['length'];_0x59782e<_0x88ce46;_0x59782e++){var _0x2a00d7=events[_0x59782e];var _0x4d5614=createListener(_0x4f1b('0x6')+_0x2a00d7,_0x4c0f56);PluginEvents['on'](_0x2a00d7,_0x4d5614);}}; \ No newline at end of file +var _0xc5e1=['save','remove','emit','removeListener','register','./plugin.events'];(function(_0x236572,_0x5eec3f){var _0x479a92=function(_0x3401d8){while(--_0x3401d8){_0x236572['push'](_0x236572['shift']());}};_0x479a92(++_0x5eec3f);}(_0xc5e1,0x14f));var _0x1c5e=function(_0x39433d,_0x416204){_0x39433d=_0x39433d-0x0;var _0x46b7f6=_0xc5e1[_0x39433d];return _0x46b7f6;};'use strict';var PluginEvents=require(_0x1c5e('0x0'));var events=[_0x1c5e('0x1'),_0x1c5e('0x2'),'update'];function createListener(_0x3a8def,_0xb1750d){return function(_0x420194){_0xb1750d[_0x1c5e('0x3')](_0x3a8def,_0x420194);};}function removeListener(_0x17af41,_0x5f37b4){return function(){PluginEvents[_0x1c5e('0x4')](_0x17af41,_0x5f37b4);};}exports[_0x1c5e('0x5')]=function(_0x1f2149){for(var _0xf3f293=0x0,_0x555112=events['length'];_0xf3f293<_0x555112;_0xf3f293++){var _0x247d2f=events[_0xf3f293];var _0x144e24=createListener('plugin:'+_0x247d2f,_0x1f2149);PluginEvents['on'](_0x247d2f,_0x144e24);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index a170689..1ea0051 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(_0x5c1a7e,_0x301721){var _0x507e43=function(_0x2ad452){while(--_0x2ad452){_0x5c1a7e['push'](_0x5c1a7e['shift']());}};_0x507e43(++_0x301721);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'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(_0x5a84d3,_0x5db227){var _0x572170=function(_0x277369){while(--_0x277369){_0x5a84d3['push'](_0x5a84d3['shift']());}};_0x572170(++_0x5db227);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'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 45480d6..4adacef 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 _0xa8a8=['dirname','start','dump','update','restart','Unknown\x20status','destroy','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','child_process','exec','bluebird','sendStatus','status','json','name','send','npm\x20install','info','error','list','then','reject','length','catch','show','describe','params','create','script','join','../../files/plugins','body','cwd','chdir'];(function(_0xf1402a,_0x187f5c){var _0x4f7ead=function(_0x57dfd9){while(--_0x57dfd9){_0xf1402a['push'](_0xf1402a['shift']());}};_0x4f7ead(++_0x187f5c);}(_0xa8a8,0xec));var _0x8a8a=function(_0x3255a2,_0x38c561){_0x3255a2=_0x3255a2-0x0;var _0x239f61=_0xa8a8[_0x3255a2];return _0x239f61;};'use strict';var _=require(_0x8a8a('0x0'));var pm2=require(_0x8a8a('0x1'));var logger=require(_0x8a8a('0x2'))(_0x8a8a('0x3'));var path=require('path');var exec=require(_0x8a8a('0x4'))[_0x8a8a('0x5')];var BPromise=require(_0x8a8a('0x6'));function handleEntityNotFound(_0x3ed1de,_0x45515d){return function(_0x1cecd4){if(!_0x1cecd4){_0x3ed1de[_0x8a8a('0x7')](0x194);;}return _0x1cecd4;};}function respondWithResult(_0x12db82,_0x2e8193){_0x2e8193=_0x2e8193||0xc8;return function(_0x315fe9){if(_0x315fe9){return _0x12db82[_0x8a8a('0x8')](_0x2e8193)[_0x8a8a('0x9')](_0x315fe9);}return null;};}function handleError(_0x4225b9,_0xecaa6f){_0xecaa6f=_0xecaa6f||0x1f4;return function(_0x3287f5){logger['error'](_0x3287f5['stack']);if(_0x3287f5[_0x8a8a('0xa')]){delete _0x3287f5['name'];}_0x4225b9[_0x8a8a('0x8')](_0xecaa6f)[_0x8a8a('0xb')](_0x3287f5);};}function execChildProcess(){return new BPromise(function(_0x532621,_0x118380){exec(_0x8a8a('0xc'),function(_0xb13fca,_0x5e448d,_0x679da2){logger[_0x8a8a('0xd')](_0x5e448d);logger[_0x8a8a('0xd')](_0x679da2);if(_0xb13fca){logger[_0x8a8a('0xe')](_0xb13fca);return _0x118380(_0xb13fca);}return _0x532621(_0x5e448d);});});}exports['index']=function(_0x23febf,_0x4e5d74){return pm2[_0x8a8a('0xf')]()[_0x8a8a('0x10')](function(_0x787eec){if(_0x787eec){var _0x2f6e33=_[_0x8a8a('0x11')](_0x787eec,function(_0x78b0f0){return _0x78b0f0[_0x8a8a('0xa')]==='express'||_0x78b0f0[_0x8a8a('0xa')]==='motion2';});return{'rows':_0x2f6e33,'count':_0x2f6e33[_0x8a8a('0x12')]};}return null;})[_0x8a8a('0x10')](respondWithResult(_0x4e5d74,null))[_0x8a8a('0x13')](handleError(_0x4e5d74,null));};exports[_0x8a8a('0x14')]=function(_0x42e8b6,_0x5dd616){return pm2[_0x8a8a('0x15')](_0x42e8b6[_0x8a8a('0x16')]['id'])[_0x8a8a('0x10')](respondWithResult(_0x5dd616,null))[_0x8a8a('0x10')](handleEntityNotFound(_0x5dd616,null))[_0x8a8a('0x13')](handleError(_0x5dd616,null));};exports[_0x8a8a('0x17')]=function(_0x4d7a45,_0x5dc5ae){if(_0x4d7a45['body']['name']&&_0x4d7a45['body'][_0x8a8a('0x18')]){var _0x45095b=path[_0x8a8a('0x19')](__dirname,_0x8a8a('0x1a'),_0x4d7a45[_0x8a8a('0x1b')][_0x8a8a('0x18')]);var _0x242bac=process[_0x8a8a('0x1c')]();process[_0x8a8a('0x1d')](path[_0x8a8a('0x1e')](_0x45095b));return execChildProcess()[_0x8a8a('0x10')](function(_0x3aa2bb){process[_0x8a8a('0x1d')](_0x242bac);return pm2[_0x8a8a('0x1f')]({'name':_0x4d7a45[_0x8a8a('0x1b')]['name'],'script':_0x45095b});})[_0x8a8a('0x10')](function(_0x16c55b){pm2[_0x8a8a('0x20')]();return _0x16c55b[0x0];})[_0x8a8a('0x10')](respondWithResult(_0x5dc5ae,0xc9))[_0x8a8a('0x13')](handleError(_0x5dc5ae,null));}else{return _0x5dc5ae[_0x8a8a('0x8')](0x1f4)[_0x8a8a('0xb')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x8a8a('0x21')]=function(_0x38c1e0,_0x2e217a){if(_0x38c1e0['body']['id']){delete _0x38c1e0['body']['id'];}var _0x2dafcd={'online':_0x8a8a('0x22'),'stopped':'stop'};if(_0x2dafcd['hasOwnProperty'](_0x38c1e0['body'][_0x8a8a('0x8')])){return pm2[_0x2dafcd[_0x38c1e0['body'][_0x8a8a('0x8')]]](_0x38c1e0[_0x8a8a('0x16')]['id'])['then'](respondWithResult(_0x2e217a,0xc8))[_0x8a8a('0x13')](handleError(_0x2e217a,null));}else{return _0x2e217a[_0x8a8a('0x8')](0x1f4)[_0x8a8a('0xb')]({'message':_0x8a8a('0x23')});}};exports[_0x8a8a('0x24')]=function(_0x3d6594,_0x3e73b1){if(_0x3d6594[_0x8a8a('0x1b')]['id']){delete _0x3d6594['body']['id'];}if(_0x3d6594['params']['id']){return pm2['delete'](_0x3d6594[_0x8a8a('0x16')]['id'])[_0x8a8a('0x10')](function(_0x5f301e){pm2[_0x8a8a('0x20')]();return _0x5f301e[0x0];})[_0x8a8a('0x10')](respondWithResult(_0x3e73b1,null))['catch'](handleError(_0x3e73b1,null));}else{return _0x3e73b1[_0x8a8a('0x8')](0x1f4)[_0x8a8a('0xb')]({'message':_0x8a8a('0x25')});}}; \ No newline at end of file +var _0x2dae=['stack','name','send','npm\x20install','info','index','list','then','reject','express','motion2','catch','show','describe','params','body','script','join','../../files/plugins','cwd','chdir','dirname','start','dump','update','restart','stop','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/logger','api','path','child_process','exec','sendStatus','status','json','error'];(function(_0x2ac3cf,_0x465bb6){var _0x27dcca=function(_0x33f954){while(--_0x33f954){_0x2ac3cf['push'](_0x2ac3cf['shift']());}};_0x27dcca(++_0x465bb6);}(_0x2dae,0xc3));var _0xe2da=function(_0x256d6a,_0x2f002f){_0x256d6a=_0x256d6a-0x0;var _0x460058=_0x2dae[_0x256d6a];return _0x460058;};'use strict';var _=require(_0xe2da('0x0'));var pm2=require('../../config/pm2');var logger=require(_0xe2da('0x1'))(_0xe2da('0x2'));var path=require(_0xe2da('0x3'));var exec=require(_0xe2da('0x4'))[_0xe2da('0x5')];var BPromise=require('bluebird');function handleEntityNotFound(_0x25b9f2,_0x439b5d){return function(_0x77e45e){if(!_0x77e45e){_0x25b9f2[_0xe2da('0x6')](0x194);;}return _0x77e45e;};}function respondWithResult(_0x523c60,_0x3e3e25){_0x3e3e25=_0x3e3e25||0xc8;return function(_0x89c70b){if(_0x89c70b){return _0x523c60[_0xe2da('0x7')](_0x3e3e25)[_0xe2da('0x8')](_0x89c70b);}return null;};}function handleError(_0x238da3,_0x1c71ea){_0x1c71ea=_0x1c71ea||0x1f4;return function(_0x29960a){logger[_0xe2da('0x9')](_0x29960a[_0xe2da('0xa')]);if(_0x29960a['name']){delete _0x29960a[_0xe2da('0xb')];}_0x238da3[_0xe2da('0x7')](_0x1c71ea)[_0xe2da('0xc')](_0x29960a);};}function execChildProcess(){return new BPromise(function(_0x17086c,_0x3c1309){exec(_0xe2da('0xd'),function(_0x1a29b9,_0x173244,_0x5aab71){logger[_0xe2da('0xe')](_0x173244);logger['info'](_0x5aab71);if(_0x1a29b9){logger[_0xe2da('0x9')](_0x1a29b9);return _0x3c1309(_0x1a29b9);}return _0x17086c(_0x173244);});});}exports[_0xe2da('0xf')]=function(_0x37064e,_0x411b9f){return pm2[_0xe2da('0x10')]()[_0xe2da('0x11')](function(_0x295a86){if(_0x295a86){var _0x48584b=_[_0xe2da('0x12')](_0x295a86,function(_0x5e1702){return _0x5e1702['name']===_0xe2da('0x13')||_0x5e1702[_0xe2da('0xb')]===_0xe2da('0x14');});return{'rows':_0x48584b,'count':_0x48584b['length']};}return null;})[_0xe2da('0x11')](respondWithResult(_0x411b9f,null))[_0xe2da('0x15')](handleError(_0x411b9f,null));};exports[_0xe2da('0x16')]=function(_0x33568f,_0x4e1623){return pm2[_0xe2da('0x17')](_0x33568f[_0xe2da('0x18')]['id'])[_0xe2da('0x11')](respondWithResult(_0x4e1623,null))[_0xe2da('0x11')](handleEntityNotFound(_0x4e1623,null))[_0xe2da('0x15')](handleError(_0x4e1623,null));};exports['create']=function(_0x56eeb1,_0x2e16b2){if(_0x56eeb1['body'][_0xe2da('0xb')]&&_0x56eeb1[_0xe2da('0x19')][_0xe2da('0x1a')]){var _0x203d36=path[_0xe2da('0x1b')](__dirname,_0xe2da('0x1c'),_0x56eeb1['body'][_0xe2da('0x1a')]);var _0x53cc4e=process[_0xe2da('0x1d')]();process[_0xe2da('0x1e')](path[_0xe2da('0x1f')](_0x203d36));return execChildProcess()[_0xe2da('0x11')](function(_0x30dea4){process[_0xe2da('0x1e')](_0x53cc4e);return pm2[_0xe2da('0x20')]({'name':_0x56eeb1[_0xe2da('0x19')]['name'],'script':_0x203d36});})[_0xe2da('0x11')](function(_0x357bff){pm2[_0xe2da('0x21')]();return _0x357bff[0x0];})[_0xe2da('0x11')](respondWithResult(_0x2e16b2,0xc9))[_0xe2da('0x15')](handleError(_0x2e16b2,null));}else{return _0x2e16b2[_0xe2da('0x7')](0x1f4)[_0xe2da('0xc')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0xe2da('0x22')]=function(_0x3e23d7,_0x1dc228){if(_0x3e23d7[_0xe2da('0x19')]['id']){delete _0x3e23d7[_0xe2da('0x19')]['id'];}var _0x2b6c9e={'online':_0xe2da('0x23'),'stopped':_0xe2da('0x24')};if(_0x2b6c9e['hasOwnProperty'](_0x3e23d7['body']['status'])){return pm2[_0x2b6c9e[_0x3e23d7[_0xe2da('0x19')][_0xe2da('0x7')]]](_0x3e23d7[_0xe2da('0x18')]['id'])[_0xe2da('0x11')](respondWithResult(_0x1dc228,0xc8))['catch'](handleError(_0x1dc228,null));}else{return _0x1dc228['status'](0x1f4)[_0xe2da('0xc')]({'message':_0xe2da('0x25')});}};exports[_0xe2da('0x26')]=function(_0x39f983,_0x7ab5ee){if(_0x39f983[_0xe2da('0x19')]['id']){delete _0x39f983[_0xe2da('0x19')]['id'];}if(_0x39f983[_0xe2da('0x18')]['id']){return pm2[_0xe2da('0x27')](_0x39f983['params']['id'])['then'](function(_0x672767){pm2[_0xe2da('0x21')]();return _0x672767[0x0];})[_0xe2da('0x11')](respondWithResult(_0x7ab5ee,null))[_0xe2da('0x15')](handleError(_0x7ab5ee,null));}else{return _0x7ab5ee[_0xe2da('0x7')](0x1f4)[_0xe2da('0xc')]({'message':_0xe2da('0x28')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index e8f2546..60d3c55 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 _0x720b=['/queues','getQueues','exports','express','Router','../../components/auth/service','get'];(function(_0x57fcc0,_0x585004){var _0x5270df=function(_0x5f2db0){while(--_0x5f2db0){_0x57fcc0['push'](_0x57fcc0['shift']());}};_0x5270df(++_0x585004);}(_0x720b,0x1d8));var _0xb720=function(_0x5a037f,_0x36980c){_0x5a037f=_0x5a037f-0x0;var _0x35a5eb=_0x720b[_0x5a037f];return _0x35a5eb;};'use strict';var express=require(_0xb720('0x0'));var router=express[_0xb720('0x1')]();var auth=require(_0xb720('0x2'));var controller=require('./realtime.controller');router[_0xb720('0x3')](_0xb720('0x4'),auth['isAuthenticated'](),controller[_0xb720('0x5')]);module[_0xb720('0x6')]=router; \ No newline at end of file +var _0x1b97=['express','Router','get','/queues','isAuthenticated','exports'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x1b97,0x15c));var _0x71b9=function(_0x508cf4,_0xc15217){_0x508cf4=_0x508cf4-0x0;var _0x4e9352=_0x1b97[_0x508cf4];return _0x4e9352;};'use strict';var express=require(_0x71b9('0x0'));var router=express[_0x71b9('0x1')]();var auth=require('../../components/auth/service');var controller=require('./realtime.controller');router[_0x71b9('0x2')](_0x71b9('0x3'),auth[_0x71b9('0x4')](),controller['getQueues']);module[_0x71b9('0x5')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 52b9fa8..ad2607d 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 _0x323f=['Queues','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','loggedIn','available','waiting','talking','paused','push','originated','dialActive','dialMethod','startPredictive','erlangCalls','erlangAbandonmentRate','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','get','loggedInDb','pTalking','agents','find','rows','merge','pick','getAgents','online','getMembers','length','UserId','Pause','findAll','QueueId','User','agent','all','catch','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','client','http','offset','undefined','limit','count','status','set','Content-Range','stack','name','send','getQueues','mail','chat','sms','openchannel','whatsapp','voice','resolve','then','query','channel','Invalid\x20channel','toLowerCase','startCase','Queue','rawAttributes','fieldName','type','key','getOptions','user','role','userProfileId','outbound','filter','UserProfile','getResources','findAndCountAll','request'];(function(_0x4e3c02,_0x2a00dc){var _0x5f47d2=function(_0x3b45dd){while(--_0x3b45dd){_0x4e3c02['push'](_0x4e3c02['shift']());}};_0x5f47d2(++_0x2a00dc);}(_0x323f,0x1ee));var _0xf323=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x323f[_0x46aff0];return _0x9d78cf;};'use strict';var util=require('util');var _=require(_0xf323('0x0'));var jayson=require('jayson/promise');var qs=require(_0xf323('0x1'));var logger=require(_0xf323('0x2'))(_0xf323('0x3'));var db=require(_0xf323('0x4'))['db'];var client=jayson[_0xf323('0x5')][_0xf323('0x6')]({'port':0x232a});var routingClient=jayson[_0xf323('0x5')][_0xf323('0x6')]({'port':0x232c});function respondWithFilteredResult(_0x3cfee3,_0x371707){return function(_0x5d7d60){if(_0x5d7d60){var _0xb9a667=typeof _0x371707[_0xf323('0x7')]===_0xf323('0x8')&&typeof _0x371707[_0xf323('0x9')]===_0xf323('0x8');var _0x3c416a=_0x5d7d60[_0xf323('0xa')];var _0x2b24a2=_0xb9a667?0x0:_0x371707[_0xf323('0x7')];var _0x21e82e=_0xb9a667?_0x5d7d60[_0xf323('0xa')]:_0x371707[_0xf323('0x7')]+_0x371707[_0xf323('0x9')];var _0x20c013;if(_0x21e82e>=_0x3c416a){_0x21e82e=_0x3c416a;_0x20c013=0xc8;}else{_0x20c013=0xce;}_0x3cfee3[_0xf323('0xb')](_0x20c013);return _0x3cfee3[_0xf323('0xc')](_0xf323('0xd'),_0x2b24a2+'-'+_0x21e82e+'/'+_0x3c416a)['json'](_0x5d7d60);}return null;};}function handleError(_0x1b6a09,_0x7dbd26){_0x7dbd26=_0x7dbd26||0x1f4;return function(_0x26eddb){logger['error'](_0x26eddb[_0xf323('0xe')]);if(_0x26eddb[_0xf323('0xf')]){delete _0x26eddb[_0xf323('0xf')];}_0x1b6a09[_0xf323('0xb')](_0x7dbd26)[_0xf323('0x10')](_0x26eddb);};}exports[_0xf323('0x11')]=function(_0x59ffbc,_0x4cc3ce){var _0x874219=[_0xf323('0x12'),_0xf323('0x13'),_0xf323('0x14'),_0xf323('0x15'),'fax',_0xf323('0x16'),_0xf323('0x17')];var _0xb9859f={'count':0x0,'rows':[]},_0x44671c={},_0x49b115;Promise[_0xf323('0x18')]()[_0xf323('0x19')](function(){if(_0x59ffbc[_0xf323('0x1a')][_0xf323('0x1b')]){if(!_['includes'](_0x874219,_0x59ffbc[_0xf323('0x1a')][_0xf323('0x1b')]['toLowerCase']()))throw new Error(_0xf323('0x1c'));_0x49b115=_0x59ffbc[_0xf323('0x1a')][_0xf323('0x1b')][_0xf323('0x1d')]();}var _0x58e22b=_[_0xf323('0x1e')](_0x49b115)+_0xf323('0x1f');var _0x1c29d9=_['map'](db[_0x58e22b][_0xf323('0x20')],function(_0x375473){return{'name':_0x375473[_0xf323('0x21')],'type':_0x375473[_0xf323('0x22')][_0xf323('0x23')]};});_0x44671c=qs[_0xf323('0x24')](_0x1c29d9,_0x59ffbc);if(_0x59ffbc[_0xf323('0x25')][_0xf323('0x26')]===_0xf323('0x25')){var _0x47fb15={'params':{'id':_0x59ffbc[_0xf323('0x25')][_0xf323('0x27')]},'query':{'section':_0x49b115===_0xf323('0x17')&&_0x59ffbc[_0xf323('0x1a')][_0xf323('0x22')]===_0xf323('0x28')?'QueueCampaigns':_[_0xf323('0x1e')](_0x49b115)+'Queues','type':_0x59ffbc[_0xf323('0x1a')][_0xf323('0x22')],'nolimit':!![],'sort':'name','filter':_0x59ffbc[_0xf323('0x1a')][_0xf323('0x29')]}};return db[_0xf323('0x2a')][_0xf323('0x2b')](_0x47fb15);}return db[_0x58e22b][_0xf323('0x2c')](_0x44671c);})['then'](function(_0x44c944){_0xb9859f[_0xf323('0xa')]=_0x44c944[_0xf323('0xa')];var _0x30a5d7=_0x49b115===_0xf323('0x17')?client:routingClient;return _0x30a5d7[_0xf323('0x2d')](_[_0xf323('0x1e')](_0x49b115)+_0xf323('0x2e'),_0x59ffbc)[_0xf323('0x19')](function(_0x52300b){if(_0x52300b[_0xf323('0x2f')])throw new Error(util[_0xf323('0x30')](_0xf323('0x31'),_0x49b115));var _0x3d09d8=_0x52300b[_0xf323('0x32')];var _0x5cd5c0=[_0xf323('0x33'),_0xf323('0x34'),_0xf323('0x35'),_0xf323('0x36'),_0xf323('0x37')];if(_0x49b115==='voice'&&_0x59ffbc[_0xf323('0x1a')][_0xf323('0x22')]===_0xf323('0x28')){_0x5cd5c0[_0xf323('0x38')]('pTalking',_0xf323('0x39'),'message',_0xf323('0x3a'),_0xf323('0x3b'),'Trunk',_0xf323('0x3c'),'startProgressive',_0xf323('0x3d'),'erlangCallToSecond',_0xf323('0x3e'),'erlangBusyFactor',_0xf323('0x3f'),_0xf323('0x40'),'dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls',_0xf323('0x41'),_0xf323('0x42'),_0xf323('0x43'),_0xf323('0x44'),_0xf323('0x45'));}var _0x49e458=_0x44c944['rows']['map'](function(_0x365297){var _0x59fee2=_0x365297[_0xf323('0x46')]({'plain':!![]});_0x59fee2['paused']=0x0;_0x59fee2[_0xf323('0x47')]=0x0;_0x59fee2[_0xf323('0x33')]=0x0;_0x59fee2[_0xf323('0x34')]=0x0;_0x59fee2[_0xf323('0x37')]=0x0;_0x59fee2[_0xf323('0x35')]=0x0;if(_0x49b115==='voice'){_0x59fee2[_0xf323('0x36')]=0x0;if(_0x59ffbc[_0xf323('0x1a')][_0xf323('0x22')]===_0xf323('0x28')){_0x59fee2[_0xf323('0x48')]=0x0;_0x59fee2[_0xf323('0x39')]=0x0;}}_0x59fee2[_0xf323('0x49')]=[];var _0x2dcb00=_[_0xf323('0x4a')](_0x3d09d8[_0xf323('0x4b')],['id',_0x59fee2['id']]);if(_0x2dcb00)_[_0xf323('0x4c')](_0x59fee2,_[_0xf323('0x4d')](_0x2dcb00,_0x5cd5c0));if(_0x49b115===_0xf323('0x17')){return _0x365297[_0xf323('0x4e')]({'attributes':['id',_0xf323('0xf'),_0xf323('0x4f')],'joinTableAttributes':[],'raw':!![]})['then'](function(_0x502114){return _0x365297[_0xf323('0x50')]({'raw':!![]})[_0xf323('0x19')](function(_0x2864f7){for(var _0xb21a85=0x0;_0xb21a85<_0x502114[_0xf323('0x51')];_0xb21a85++){var _0xcdbb9a=_[_0xf323('0x4a')](_0x2864f7,[_0xf323('0x52'),_0x502114[_0xb21a85]['id']]);var _0x1c0136={'id':_0x502114[_0xb21a85]['id'],'name':_0x502114[_0xb21a85][_0xf323('0xf')],'online':Boolean(_0x502114[_0xb21a85][_0xf323('0x4f')]),'paused':_0xcdbb9a?Boolean(_0xcdbb9a[_0xf323('0x37')]):![]};if(_0x1c0136[_0xf323('0x4f')])_0x59fee2['loggedInDb']++;if(_0x1c0136[_0xf323('0x37')])_0x59fee2['paused']++;_0x59fee2['agents'][_0xf323('0x38')](_0x1c0136);}return _0x59fee2;});});}else{var _0x5926ad='User'+_[_0xf323('0x1e')](_0x49b115)+_0xf323('0x1f');var _0x370d87=_0x49b115+_0xf323('0x53');return db[_0x5926ad][_0xf323('0x54')]({'where':{[_[_0xf323('0x1e')](_0x49b115)+_0xf323('0x55')]:_0x365297['id']},'raw':!![]})[_0xf323('0x19')](function(_0x2ade7d){return db[_0xf323('0x56')][_0xf323('0x54')]({'attributes':['id','name',_0xf323('0x4f'),_0x370d87],'where':{'id':_['map'](_0x2ade7d,_0xf323('0x52')),'role':_0xf323('0x57')},'raw':!![]});})[_0xf323('0x19')](function(_0x9c525e){for(var _0x542205=0x0;_0x542205<_0x9c525e['length'];_0x542205++){var _0x36b688={'id':_0x9c525e[_0x542205]['id'],'name':_0x9c525e[_0x542205]['name'],'online':Boolean(_0x9c525e[_0x542205][_0xf323('0x4f')]),'paused':Boolean(_0x9c525e[_0x542205][_0x370d87])};if(_0x36b688['online'])_0x59fee2[_0xf323('0x47')]++;if(_0x36b688[_0xf323('0x37')])_0x59fee2['paused']++;_0x59fee2[_0xf323('0x49')][_0xf323('0x38')](_0x36b688);}return _0x59fee2;});}});return Promise[_0xf323('0x58')](_0x49e458);});})[_0xf323('0x19')](function(_0x1e50b3){_0xb9859f[_0xf323('0x4b')]=_0x1e50b3;return _0xb9859f;})[_0xf323('0x19')](respondWithFilteredResult(_0x4cc3ce,_0x44671c))[_0xf323('0x59')](handleError(_0x4cc3ce,null));}; \ No newline at end of file +var _0x33af=['count','status','set','Content-Range','json','error','name','send','getQueues','mail','sms','fax','whatsapp','resolve','then','query','channel','toLowerCase','Invalid\x20channel','startCase','Queue','map','rawAttributes','fieldName','type','getOptions','role','user','userProfileId','UserProfile','getResources','findAndCountAll','voice','request','Queues','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','available','waiting','talking','paused','outbound','push','pTalking','originated','message','Trunk','erlangCallToSecond','erlangAbandonmentRate','dialPredictiveInterval','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','loggedInDb','loggedIn','agents','rows','merge','getAgents','length','UserId','online','User','findAll','QueueId','agent','all','catch','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','client','http','offset','undefined','limit'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x33af,0xec));var _0xf33a=function(_0x5814ca,_0x3b6713){_0x5814ca=_0x5814ca-0x0;var _0xeb1833=_0x33af[_0x5814ca];return _0xeb1833;};'use strict';var util=require('util');var _=require(_0xf33a('0x0'));var jayson=require('jayson/promise');var qs=require(_0xf33a('0x1'));var logger=require(_0xf33a('0x2'))(_0xf33a('0x3'));var db=require(_0xf33a('0x4'))['db'];var client=jayson[_0xf33a('0x5')][_0xf33a('0x6')]({'port':0x232a});var routingClient=jayson['client'][_0xf33a('0x6')]({'port':0x232c});function respondWithFilteredResult(_0x44cfa5,_0x583e54){return function(_0xc0dd13){if(_0xc0dd13){var _0x384b14=typeof _0x583e54[_0xf33a('0x7')]===_0xf33a('0x8')&&typeof _0x583e54[_0xf33a('0x9')]===_0xf33a('0x8');var _0x52517f=_0xc0dd13[_0xf33a('0xa')];var _0x14eb0e=_0x384b14?0x0:_0x583e54[_0xf33a('0x7')];var _0x457b3b=_0x384b14?_0xc0dd13[_0xf33a('0xa')]:_0x583e54[_0xf33a('0x7')]+_0x583e54['limit'];var _0x4ea282;if(_0x457b3b>=_0x52517f){_0x457b3b=_0x52517f;_0x4ea282=0xc8;}else{_0x4ea282=0xce;}_0x44cfa5[_0xf33a('0xb')](_0x4ea282);return _0x44cfa5[_0xf33a('0xc')](_0xf33a('0xd'),_0x14eb0e+'-'+_0x457b3b+'/'+_0x52517f)[_0xf33a('0xe')](_0xc0dd13);}return null;};}function handleError(_0x338d1b,_0x5959c9){_0x5959c9=_0x5959c9||0x1f4;return function(_0x9f87bc){logger[_0xf33a('0xf')](_0x9f87bc['stack']);if(_0x9f87bc['name']){delete _0x9f87bc[_0xf33a('0x10')];}_0x338d1b[_0xf33a('0xb')](_0x5959c9)[_0xf33a('0x11')](_0x9f87bc);};}exports[_0xf33a('0x12')]=function(_0x1e9be2,_0xc01217){var _0x45e311=[_0xf33a('0x13'),'chat',_0xf33a('0x14'),'openchannel',_0xf33a('0x15'),_0xf33a('0x16'),'voice'];var _0x37e76c={'count':0x0,'rows':[]},_0x25c931={},_0x524109;Promise[_0xf33a('0x17')]()[_0xf33a('0x18')](function(){if(_0x1e9be2[_0xf33a('0x19')][_0xf33a('0x1a')]){if(!_['includes'](_0x45e311,_0x1e9be2[_0xf33a('0x19')][_0xf33a('0x1a')][_0xf33a('0x1b')]()))throw new Error(_0xf33a('0x1c'));_0x524109=_0x1e9be2[_0xf33a('0x19')][_0xf33a('0x1a')][_0xf33a('0x1b')]();}var _0x288275=_[_0xf33a('0x1d')](_0x524109)+_0xf33a('0x1e');var _0x520dc4=_[_0xf33a('0x1f')](db[_0x288275][_0xf33a('0x20')],function(_0x1bf9bc){return{'name':_0x1bf9bc[_0xf33a('0x21')],'type':_0x1bf9bc[_0xf33a('0x22')]['key']};});_0x25c931=qs[_0xf33a('0x23')](_0x520dc4,_0x1e9be2);if(_0x1e9be2['user'][_0xf33a('0x24')]===_0xf33a('0x25')){var _0x394468={'params':{'id':_0x1e9be2[_0xf33a('0x25')][_0xf33a('0x26')]},'query':{'section':_0x524109==='voice'&&_0x1e9be2[_0xf33a('0x19')][_0xf33a('0x22')]==='outbound'?'QueueCampaigns':_[_0xf33a('0x1d')](_0x524109)+'Queues','type':_0x1e9be2['query'][_0xf33a('0x22')],'nolimit':!![],'sort':'name','filter':_0x1e9be2[_0xf33a('0x19')]['filter']}};return db[_0xf33a('0x27')][_0xf33a('0x28')](_0x394468);}return db[_0x288275][_0xf33a('0x29')](_0x25c931);})[_0xf33a('0x18')](function(_0x4552c9){_0x37e76c[_0xf33a('0xa')]=_0x4552c9[_0xf33a('0xa')];var _0x1246ff=_0x524109===_0xf33a('0x2a')?client:routingClient;return _0x1246ff[_0xf33a('0x2b')](_[_0xf33a('0x1d')](_0x524109)+_0xf33a('0x2c'),_0x1e9be2)[_0xf33a('0x18')](function(_0x3f714e){if(_0x3f714e[_0xf33a('0xf')])throw new Error(util['format'](_0xf33a('0x2d'),_0x524109));var _0x293cb5=_0x3f714e[_0xf33a('0x2e')];var _0xbdc10e=['loggedIn',_0xf33a('0x2f'),_0xf33a('0x30'),_0xf33a('0x31'),_0xf33a('0x32')];if(_0x524109===_0xf33a('0x2a')&&_0x1e9be2[_0xf33a('0x19')]['type']===_0xf33a('0x33')){_0xbdc10e[_0xf33a('0x34')](_0xf33a('0x35'),_0xf33a('0x36'),_0xf33a('0x37'),'dialActive','dialMethod',_0xf33a('0x38'),'startPredictive','startProgressive','erlangCalls',_0xf33a('0x39'),_0xf33a('0x3a'),'erlangBusyFactor',_0xf33a('0x3b'),'dialPredictiveIntervalMaxThreshold',_0xf33a('0x3c'),_0xf33a('0x3d'),_0xf33a('0x3e'),_0xf33a('0x3f'),_0xf33a('0x40'),_0xf33a('0x41'),'predictiveIntervalAvgHoldtime',_0xf33a('0x42'));}var _0x29a39f=_0x4552c9['rows'][_0xf33a('0x1f')](function(_0x3793b4){var _0x3e0a98=_0x3793b4['get']({'plain':!![]});_0x3e0a98[_0xf33a('0x32')]=0x0;_0x3e0a98[_0xf33a('0x43')]=0x0;_0x3e0a98[_0xf33a('0x44')]=0x0;_0x3e0a98[_0xf33a('0x2f')]=0x0;_0x3e0a98[_0xf33a('0x32')]=0x0;_0x3e0a98[_0xf33a('0x30')]=0x0;if(_0x524109===_0xf33a('0x2a')){_0x3e0a98[_0xf33a('0x31')]=0x0;if(_0x1e9be2[_0xf33a('0x19')]['type']===_0xf33a('0x33')){_0x3e0a98[_0xf33a('0x35')]=0x0;_0x3e0a98['originated']=0x0;}}_0x3e0a98[_0xf33a('0x45')]=[];var _0x4c6906=_['find'](_0x293cb5[_0xf33a('0x46')],['id',_0x3e0a98['id']]);if(_0x4c6906)_[_0xf33a('0x47')](_0x3e0a98,_['pick'](_0x4c6906,_0xbdc10e));if(_0x524109===_0xf33a('0x2a')){return _0x3793b4[_0xf33a('0x48')]({'attributes':['id',_0xf33a('0x10'),'online'],'joinTableAttributes':[],'raw':!![]})[_0xf33a('0x18')](function(_0x21b8da){return _0x3793b4['getMembers']({'raw':!![]})[_0xf33a('0x18')](function(_0x20e57b){for(var _0x36b9c9=0x0;_0x36b9c9<_0x21b8da[_0xf33a('0x49')];_0x36b9c9++){var _0x40954c=_['find'](_0x20e57b,[_0xf33a('0x4a'),_0x21b8da[_0x36b9c9]['id']]);var _0x1722e5={'id':_0x21b8da[_0x36b9c9]['id'],'name':_0x21b8da[_0x36b9c9][_0xf33a('0x10')],'online':Boolean(_0x21b8da[_0x36b9c9][_0xf33a('0x4b')]),'paused':_0x40954c?Boolean(_0x40954c[_0xf33a('0x32')]):![]};if(_0x1722e5['online'])_0x3e0a98[_0xf33a('0x43')]++;if(_0x1722e5[_0xf33a('0x32')])_0x3e0a98[_0xf33a('0x32')]++;_0x3e0a98['agents'][_0xf33a('0x34')](_0x1722e5);}return _0x3e0a98;});});}else{var _0x43889e=_0xf33a('0x4c')+_[_0xf33a('0x1d')](_0x524109)+_0xf33a('0x1e');var _0x6380fa=_0x524109+'Pause';return db[_0x43889e][_0xf33a('0x4d')]({'where':{[_[_0xf33a('0x1d')](_0x524109)+_0xf33a('0x4e')]:_0x3793b4['id']},'raw':!![]})[_0xf33a('0x18')](function(_0x229533){return db['User'][_0xf33a('0x4d')]({'attributes':['id',_0xf33a('0x10'),_0xf33a('0x4b'),_0x6380fa],'where':{'id':_['map'](_0x229533,_0xf33a('0x4a')),'role':_0xf33a('0x4f')},'raw':!![]});})['then'](function(_0x4c0f24){for(var _0x3cb451=0x0;_0x3cb451<_0x4c0f24['length'];_0x3cb451++){var _0x36b8f6={'id':_0x4c0f24[_0x3cb451]['id'],'name':_0x4c0f24[_0x3cb451][_0xf33a('0x10')],'online':Boolean(_0x4c0f24[_0x3cb451][_0xf33a('0x4b')]),'paused':Boolean(_0x4c0f24[_0x3cb451][_0x6380fa])};if(_0x36b8f6[_0xf33a('0x4b')])_0x3e0a98[_0xf33a('0x43')]++;if(_0x36b8f6[_0xf33a('0x32')])_0x3e0a98[_0xf33a('0x32')]++;_0x3e0a98[_0xf33a('0x45')][_0xf33a('0x34')](_0x36b8f6);}return _0x3e0a98;});}});return Promise[_0xf33a('0x50')](_0x29a39f);});})[_0xf33a('0x18')](function(_0x4107b1){_0x37e76c[_0xf33a('0x46')]=_0x4107b1;return _0x37e76c;})[_0xf33a('0x18')](respondWithFilteredResult(_0xc01217,_0x25c931))[_0xf33a('0x51')](handleError(_0xc01217,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 48a445f..ba7cbf2 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x4fa108,_0x1fb98e){var _0x3dd249=function(_0x4c0d17){while(--_0x4c0d17){_0x4fa108['push'](_0x4fa108['shift']());}};_0x3dd249(++_0x1fb98e);}(_0xedd9,0xfc));var _0x9edd=function(_0xe0ba74,_0x5dcbac){_0xe0ba74=_0xe0ba74-0x0;var _0x5efbef=_0xedd9[_0xe0ba74];return _0x5efbef;};'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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x27cbc0,_0x273895){var _0xad34bb=function(_0x1ad09b){while(--_0x1ad09b){_0x27cbc0['push'](_0x27cbc0['shift']());}};_0xad34bb(++_0x273895);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'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 813b03d..79c799e 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 _0xd43e=['sequelize','INTEGER','STRING','DATE'];(function(_0x4fdd3a,_0x19ce14){var _0x47c3d0=function(_0x633ed){while(--_0x633ed){_0x4fdd3a['push'](_0x4fdd3a['shift']());}};_0x47c3d0(++_0x19ce14);}(_0xd43e,0x88));var _0xed43=function(_0x43e977,_0x11a735){_0x43e977=_0x43e977-0x0;var _0x4fa35c=_0xd43e[_0x43e977];return _0x4fa35c;};'use strict';var Sequelize=require(_0xed43('0x0'));module['exports']={'state':{'type':Sequelize[_0xed43('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xed43('0x2')]},'scheduledat':{'type':Sequelize[_0xed43('0x3')]},'uniqueid':{'type':Sequelize[_0xed43('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xed43('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xed43('0x2')]},'campaigntype':{'type':Sequelize[_0xed43('0x2')]},'membername':{'type':Sequelize[_0xed43('0x2')]}}; \ No newline at end of file +var _0x7919=['sequelize','exports','INTEGER','STRING','DATE'];(function(_0x3edfa2,_0x200ac1){var _0x5a3e8b=function(_0x536171){while(--_0x536171){_0x3edfa2['push'](_0x3edfa2['shift']());}};_0x5a3e8b(++_0x200ac1);}(_0x7919,0xeb));var _0x9791=function(_0x50d1d6,_0x2bf259){_0x50d1d6=_0x50d1d6-0x0;var _0x33aef9=_0x7919[_0x50d1d6];return _0x33aef9;};'use strict';var Sequelize=require(_0x9791('0x0'));module[_0x9791('0x1')]={'state':{'type':Sequelize[_0x9791('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x9791('0x3')]},'scheduledat':{'type':Sequelize[_0x9791('0x4')]},'uniqueid':{'type':Sequelize[_0x9791('0x3')]},'starttime':{'type':Sequelize[_0x9791('0x4')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x9791('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x9791('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x9791('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index c58e081..d0a845c 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 _0xc57a=['util','../../config/logger','moment','bluebird','../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview'];(function(_0x422afa,_0x1ea712){var _0x14344c=function(_0x2c88bf){while(--_0x2c88bf){_0x422afa['push'](_0x422afa['shift']());}};_0x14344c(++_0x1ea712);}(_0xc57a,0xc8));var _0xac57=function(_0x5401e2,_0xb8e801){_0x5401e2=_0x5401e2-0x0;var _0x557f0f=_0xc57a[_0x5401e2];return _0x557f0f;};'use strict';var _=require('lodash');var util=require(_0xac57('0x0'));var logger=require(_0xac57('0x1'))('api');var moment=require(_0xac57('0x2'));var BPromise=require(_0xac57('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac57('0x4'));var attributes=require(_0xac57('0x5'));module[_0xac57('0x6')]=function(_0x2ba863,_0x1c450f){return _0x2ba863[_0xac57('0x7')](_0xac57('0x8'),attributes,{'tableName':_0xac57('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfe6c=['util','../../config/logger','api','moment','request-promise','rimraf','ReportAgentPreview','report_agent_preview'];(function(_0x1ac2d8,_0xe1aa59){var _0x2744af=function(_0x37a898){while(--_0x37a898){_0x1ac2d8['push'](_0x1ac2d8['shift']());}};_0x2744af(++_0xe1aa59);}(_0xfe6c,0xc8));var _0xcfe6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfe6c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xcfe6('0x0'));var logger=require(_0xcfe6('0x1'))(_0xcfe6('0x2'));var moment=require(_0xcfe6('0x3'));var BPromise=require('bluebird');var rp=require(_0xcfe6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcfe6('0x5'));var config=require('../../config/environment');var attributes=require('./reportAgentPreview.attributes');module['exports']=function(_0x1b1d1e,_0x34d40e){return _0x1b1d1e['define'](_0xcfe6('0x6'),attributes,{'tableName':_0xcfe6('0x7'),'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 dd08d6d..1bc73b4 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 _0x6cf2=['CreateReportAgentPreview','ReportAgentPreview','create','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0x6cf2,0x7c));var _0x26cf=function(_0x49f534,_0x171cda){_0x49f534=_0x49f534-0x0;var _0x2960e6=_0x6cf2[_0x49f534];return _0x2960e6;};'use strict';var _=require('lodash');var util=require(_0x26cf('0x0'));var moment=require(_0x26cf('0x1'));var BPromise=require(_0x26cf('0x2'));var rs=require(_0x26cf('0x3'));var fs=require('fs');var Redis=require(_0x26cf('0x4'));var db=require(_0x26cf('0x5'))['db'];var utils=require(_0x26cf('0x6'));var logger=require(_0x26cf('0x7'))(_0x26cf('0x8'));var config=require(_0x26cf('0x9'));var jayson=require(_0x26cf('0xa'));var client=jayson[_0x26cf('0xb')][_0x26cf('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x188cb2,_0x8e8f63,_0x48202d){return new BPromise(function(_0x2db018,_0x58daf4){return client[_0x26cf('0xd')](_0x188cb2,_0x48202d)[_0x26cf('0xe')](function(_0x4a087e){logger[_0x26cf('0xf')](_0x26cf('0x10'),_0x8e8f63,_0x26cf('0x11'));logger[_0x26cf('0x12')](_0x26cf('0x13'),_0x8e8f63,_0x26cf('0x11'),JSON[_0x26cf('0x14')](_0x4a087e));if(_0x4a087e[_0x26cf('0x15')]){if(_0x4a087e['error'][_0x26cf('0x16')]===0x1f4){logger[_0x26cf('0x15')](_0x26cf('0x10'),_0x8e8f63,_0x4a087e[_0x26cf('0x15')][_0x26cf('0x17')]);return _0x58daf4(_0x4a087e[_0x26cf('0x15')][_0x26cf('0x17')]);}logger['error'](_0x26cf('0x10'),_0x8e8f63,_0x4a087e[_0x26cf('0x15')][_0x26cf('0x17')]);return _0x2db018(_0x4a087e[_0x26cf('0x15')][_0x26cf('0x17')]);}else{logger[_0x26cf('0xf')](_0x26cf('0x10'),_0x8e8f63,_0x26cf('0x11'));_0x2db018(_0x4a087e[_0x26cf('0x18')][_0x26cf('0x17')]);}})[_0x26cf('0x19')](function(_0x1645d5){logger[_0x26cf('0x15')](_0x26cf('0x10'),_0x8e8f63,_0x1645d5);_0x58daf4(_0x1645d5);});});}exports[_0x26cf('0x1a')]=function(_0x4b107b){var _0x4c83f3=this;return new Promise(function(_0x3c8b8c,_0x3e1b0c){return db[_0x26cf('0x1b')][_0x26cf('0x1c')](_0x4b107b['body'],{'raw':_0x4b107b['options']?_0x4b107b['options'][_0x26cf('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x3c682d){logger[_0x26cf('0xf')](_0x26cf('0x1a'),_0x4b107b);logger[_0x26cf('0x12')](_0x26cf('0x1a'),_0x4b107b,JSON[_0x26cf('0x14')](_0x3c682d));_0x3c8b8c(_0x3c682d);})[_0x26cf('0x19')](function(_0x5089f4){logger[_0x26cf('0x15')]('CreateReportAgentPreview',_0x5089f4[_0x26cf('0x17')],_0x4b107b);_0x3e1b0c(_0x4c83f3[_0x26cf('0x15')](0x1f4,_0x5089f4[_0x26cf('0x17')]));});});}; \ No newline at end of file +var _0x78d8=['request','then','info','ReportAgentPreview,\x20%s,\x20%s','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','ReportAgentPreview','body','options','raw','CreateReportAgentPreview','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x7a42d9,_0x5a0c72){var _0x278b78=function(_0x1fa030){while(--_0x1fa030){_0x7a42d9['push'](_0x7a42d9['shift']());}};_0x278b78(++_0x5a0c72);}(_0x78d8,0x1a7));var _0x878d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x78d8[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x878d('0x0'));var util=require(_0x878d('0x1'));var moment=require(_0x878d('0x2'));var BPromise=require('bluebird');var rs=require(_0x878d('0x3'));var fs=require('fs');var Redis=require(_0x878d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x878d('0x5'));var logger=require(_0x878d('0x6'))(_0x878d('0x7'));var config=require(_0x878d('0x8'));var jayson=require(_0x878d('0x9'));var client=jayson[_0x878d('0xa')][_0x878d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4d9a16,_0xf143b6,_0x44c344){return new BPromise(function(_0x296970,_0x1762d6){return client[_0x878d('0xc')](_0x4d9a16,_0x44c344)[_0x878d('0xd')](function(_0x493e9c){logger[_0x878d('0xe')](_0x878d('0xf'),_0xf143b6,'request\x20sent');logger[_0x878d('0x10')](_0x878d('0x11'),_0xf143b6,_0x878d('0x12'),JSON[_0x878d('0x13')](_0x493e9c));if(_0x493e9c[_0x878d('0x14')]){if(_0x493e9c['error']['code']===0x1f4){logger['error'](_0x878d('0xf'),_0xf143b6,_0x493e9c['error'][_0x878d('0x15')]);return _0x1762d6(_0x493e9c['error'][_0x878d('0x15')]);}logger[_0x878d('0x14')](_0x878d('0xf'),_0xf143b6,_0x493e9c[_0x878d('0x14')][_0x878d('0x15')]);return _0x296970(_0x493e9c[_0x878d('0x14')]['message']);}else{logger[_0x878d('0xe')]('ReportAgentPreview,\x20%s,\x20%s',_0xf143b6,_0x878d('0x12'));_0x296970(_0x493e9c[_0x878d('0x16')][_0x878d('0x15')]);}})[_0x878d('0x17')](function(_0x59e355){logger['error'](_0x878d('0xf'),_0xf143b6,_0x59e355);_0x1762d6(_0x59e355);});});}exports['CreateReportAgentPreview']=function(_0x6f0693){var _0x196152=this;return new Promise(function(_0x3b1980,_0x1f5f2a){return db[_0x878d('0x18')]['create'](_0x6f0693[_0x878d('0x19')],{'raw':_0x6f0693['options']?_0x6f0693[_0x878d('0x1a')][_0x878d('0x1b')]===undefined?!![]:![]:!![]})[_0x878d('0xd')](function(_0x1158a9){logger['info'](_0x878d('0x1c'),_0x6f0693);logger['debug']('CreateReportAgentPreview',_0x6f0693,JSON[_0x878d('0x13')](_0x1158a9));_0x3b1980(_0x1158a9);})[_0x878d('0x17')](function(_0x112e5b){logger[_0x878d('0x14')](_0x878d('0x1c'),_0x112e5b[_0x878d('0x15')],_0x6f0693);_0x1f5f2a(_0x196152[_0x878d('0x14')](0x1f4,_0x112e5b[_0x878d('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index fbf9dbd..fb1aaaa 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 _0xb870=['/campaigns','campaigns','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','showFaxQueues','/openchannel/queues/:id/notify','openchannel','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','agentNotify','exports','multer','path','express','Router','../../components/auth/service','get','/voice/channels','isAuthenticated','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','/mail/queues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','agentCapacity','/trunks','trunks'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xb870,0x7a));var _0x0b87=function(_0x260859,_0x3cfcff){_0x260859=_0x260859-0x0;var _0x4b77f8=_0xb870[_0x260859];return _0x4b77f8;};'use strict';var multer=require(_0x0b87('0x0'));var util=require('util');var path=require(_0x0b87('0x1'));var express=require(_0x0b87('0x2'));var router=express[_0x0b87('0x3')]();var auth=require(_0x0b87('0x4'));var controller=require('./rpc.controller');router[_0x0b87('0x5')](_0x0b87('0x6'),auth[_0x0b87('0x7')](),controller['voiceChannels']);router[_0x0b87('0x5')](_0x0b87('0x8'),auth[_0x0b87('0x7')](),controller[_0x0b87('0x9')]);router[_0x0b87('0x5')](_0x0b87('0xa'),auth['isAuthenticated'](),controller[_0x0b87('0xb')]);router[_0x0b87('0x5')](_0x0b87('0xc'),auth['isAuthenticated'](),controller[_0x0b87('0xd')]);router[_0x0b87('0x5')](_0x0b87('0xe'),auth[_0x0b87('0x7')](),controller['chatQueues']);router[_0x0b87('0x5')](_0x0b87('0xf'),auth[_0x0b87('0x7')](),controller['mailQueues']);router[_0x0b87('0x5')](_0x0b87('0x10'),auth[_0x0b87('0x7')](),controller[_0x0b87('0x11')]);router[_0x0b87('0x5')](_0x0b87('0x12'),auth[_0x0b87('0x7')](),controller[_0x0b87('0x13')]);router[_0x0b87('0x5')]('/sms/queues',auth['isAuthenticated'](),controller[_0x0b87('0x14')]);router[_0x0b87('0x5')](_0x0b87('0x15'),auth[_0x0b87('0x7')](),controller[_0x0b87('0x16')]);router[_0x0b87('0x5')](_0x0b87('0x17'),auth[_0x0b87('0x7')](),controller[_0x0b87('0x18')]);router['get'](_0x0b87('0x19'),auth['isAuthenticated'](),controller[_0x0b87('0x1a')]);router[_0x0b87('0x5')](_0x0b87('0x1b'),auth[_0x0b87('0x7')](),controller[_0x0b87('0x1c')]);router[_0x0b87('0x5')]('/voice/queues/channels/:uniqueid',auth[_0x0b87('0x7')](),controller[_0x0b87('0x1d')]);router[_0x0b87('0x5')](_0x0b87('0x1e'),auth[_0x0b87('0x7')](),controller[_0x0b87('0x1f')]);router[_0x0b87('0x5')](_0x0b87('0x20'),auth['isAuthenticated'](),controller[_0x0b87('0x21')]);router[_0x0b87('0x5')](_0x0b87('0x22'),auth[_0x0b87('0x7')](),controller[_0x0b87('0x23')]);router[_0x0b87('0x24')](_0x0b87('0x22'),auth['isAuthenticated'](),controller[_0x0b87('0x25')]);router['get'](_0x0b87('0x26'),auth[_0x0b87('0x7')](),controller[_0x0b87('0x27')]);router[_0x0b87('0x5')](_0x0b87('0x28'),auth['isAuthenticated'](),controller['outboundChannels']);router['get']('/agents',auth[_0x0b87('0x7')](),controller['agents']);router[_0x0b87('0x24')]('/agents/:id/capacity',auth[_0x0b87('0x7')](),controller[_0x0b87('0x29')]);router[_0x0b87('0x5')]('/telephones',auth[_0x0b87('0x7')](),controller['telephones']);router[_0x0b87('0x5')](_0x0b87('0x2a'),auth[_0x0b87('0x7')](),controller[_0x0b87('0x2b')]);router[_0x0b87('0x5')](_0x0b87('0x2c'),auth[_0x0b87('0x7')](),controller[_0x0b87('0x2d')]);router['get']('/fax/accounts',auth['isAuthenticated'](),controller[_0x0b87('0x2e')]);router[_0x0b87('0x5')](_0x0b87('0x2f'),auth[_0x0b87('0x7')](),controller[_0x0b87('0x30')]);router[_0x0b87('0x5')](_0x0b87('0x31'),auth[_0x0b87('0x7')](),controller['mailQueuesWaitingInteractions']);router[_0x0b87('0x5')](_0x0b87('0x32'),auth['isAuthenticated'](),controller[_0x0b87('0x33')]);router['get']('/openchannel/queues/:id/waitinginteractions',auth['isAuthenticated'](),controller[_0x0b87('0x34')]);router[_0x0b87('0x5')](_0x0b87('0x35'),auth[_0x0b87('0x7')](),controller[_0x0b87('0x36')]);router[_0x0b87('0x5')](_0x0b87('0x37'),auth[_0x0b87('0x7')](),controller[_0x0b87('0x38')]);router[_0x0b87('0x5')](_0x0b87('0x39'),auth[_0x0b87('0x7')](),controller[_0x0b87('0x3a')]);router[_0x0b87('0x3b')](_0x0b87('0x3c'),auth[_0x0b87('0x7')](),controller[_0x0b87('0x3d')](_0x0b87('0x3e')));router['get'](_0x0b87('0x3f'),auth[_0x0b87('0x7')](),controller[_0x0b87('0x40')]);router[_0x0b87('0x3b')](_0x0b87('0x41'),auth[_0x0b87('0x7')](),controller[_0x0b87('0x3d')](_0x0b87('0x42')));router[_0x0b87('0x5')](_0x0b87('0x43'),auth[_0x0b87('0x7')](),controller[_0x0b87('0x44')]);router[_0x0b87('0x3b')](_0x0b87('0x45'),auth['isAuthenticated'](),controller['queueNotify'](_0x0b87('0x46')));router[_0x0b87('0x5')]('/fax/queues/:id',auth[_0x0b87('0x7')](),controller[_0x0b87('0x47')]);router[_0x0b87('0x3b')](_0x0b87('0x48'),auth['isAuthenticated'](),controller['queueNotify'](_0x0b87('0x49')));router[_0x0b87('0x5')]('/openchannel/queues/:id',auth[_0x0b87('0x7')](),controller[_0x0b87('0x4a')]);router[_0x0b87('0x3b')](_0x0b87('0x4b'),auth[_0x0b87('0x7')](),controller['queueNotify'](_0x0b87('0x4c')));router[_0x0b87('0x3b')](_0x0b87('0x4d'),auth['isAuthenticated'](),controller[_0x0b87('0x3d')]('whatsapp'));router['get'](_0x0b87('0x4e'),auth[_0x0b87('0x7')](),controller[_0x0b87('0x4f')]);router['get'](_0x0b87('0x50'),auth[_0x0b87('0x7')](),controller['showWhatsappQueues']);router['post']('/agents/:id/notify',auth[_0x0b87('0x7')](),controller[_0x0b87('0x51')]);module[_0x0b87('0x52')]=router; \ No newline at end of file +var _0x31b7=['faxQueuesWaitingInteractions','post','queueNotify','/mail/queues/:id','/chat/queues/:id/notify','/chat/queues/:id','showFaxQueues','openchannel','/openchannel/queues/:id','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','agentNotify','exports','multer','util','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','voiceQueues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','/fax/queues','voiceQueuesPreview','/voice/queues/channels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','put','/voice/queues/:id','updateVoiceQueue','outbound','/outbound/channels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions'];(function(_0x5ed208,_0x5e24e0){var _0x1395c3=function(_0x16b5fd){while(--_0x16b5fd){_0x5ed208['push'](_0x5ed208['shift']());}};_0x1395c3(++_0x5e24e0);}(_0x31b7,0xf7));var _0x731b=function(_0x410116,_0x5d2b04){_0x410116=_0x410116-0x0;var _0x4ea5a8=_0x31b7[_0x410116];return _0x4ea5a8;};'use strict';var multer=require(_0x731b('0x0'));var util=require(_0x731b('0x1'));var path=require('path');var express=require('express');var router=express['Router']();var auth=require(_0x731b('0x2'));var controller=require(_0x731b('0x3'));router[_0x731b('0x4')](_0x731b('0x5'),auth[_0x731b('0x6')](),controller[_0x731b('0x7')]);router[_0x731b('0x4')](_0x731b('0x8'),auth[_0x731b('0x6')](),controller['voiceChannelMixMonitor']);router['get'](_0x731b('0x9'),auth[_0x731b('0x6')](),controller[_0x731b('0xa')]);router[_0x731b('0x4')]('/voice/queues',auth[_0x731b('0x6')](),controller[_0x731b('0xb')]);router[_0x731b('0x4')]('/chat/queues',auth[_0x731b('0x6')](),controller[_0x731b('0xc')]);router[_0x731b('0x4')](_0x731b('0xd'),auth[_0x731b('0x6')](),controller[_0x731b('0xe')]);router[_0x731b('0x4')](_0x731b('0xf'),auth[_0x731b('0x6')](),controller[_0x731b('0x10')]);router[_0x731b('0x4')](_0x731b('0x11'),auth['isAuthenticated'](),controller[_0x731b('0x12')]);router[_0x731b('0x4')](_0x731b('0x13'),auth[_0x731b('0x6')](),controller[_0x731b('0x14')]);router[_0x731b('0x4')](_0x731b('0x15'),auth['isAuthenticated'](),controller['whatsappQueues']);router[_0x731b('0x4')](_0x731b('0x16'),auth[_0x731b('0x6')](),controller['faxQueues']);router[_0x731b('0x4')]('/voice/queues/preview/:id',auth[_0x731b('0x6')](),controller[_0x731b('0x17')]);router[_0x731b('0x4')](_0x731b('0x18'),auth[_0x731b('0x6')](),controller['voiceQueuesChannels']);router['get'](_0x731b('0x19'),auth[_0x731b('0x6')](),controller['voiceQueuesChannel']);router[_0x731b('0x4')](_0x731b('0x1a'),auth[_0x731b('0x6')](),controller[_0x731b('0x1b')]);router[_0x731b('0x4')](_0x731b('0x1c'),auth['isAuthenticated'](),controller[_0x731b('0x1d')]);router[_0x731b('0x4')]('/voice/queues/:id',auth['isAuthenticated'](),controller[_0x731b('0x1e')]);router[_0x731b('0x1f')](_0x731b('0x20'),auth[_0x731b('0x6')](),controller[_0x731b('0x21')]);router['get']('/outbound',auth[_0x731b('0x6')](),controller[_0x731b('0x22')]);router[_0x731b('0x4')](_0x731b('0x23'),auth[_0x731b('0x6')](),controller['outboundChannels']);router[_0x731b('0x4')](_0x731b('0x24'),auth['isAuthenticated'](),controller[_0x731b('0x25')]);router['put'](_0x731b('0x26'),auth[_0x731b('0x6')](),controller[_0x731b('0x27')]);router[_0x731b('0x4')](_0x731b('0x28'),auth[_0x731b('0x6')](),controller[_0x731b('0x29')]);router[_0x731b('0x4')](_0x731b('0x2a'),auth['isAuthenticated'](),controller[_0x731b('0x2b')]);router[_0x731b('0x4')](_0x731b('0x2c'),auth[_0x731b('0x6')](),controller[_0x731b('0x2d')]);router[_0x731b('0x4')]('/fax/accounts',auth[_0x731b('0x6')](),controller['faxAccounts']);router[_0x731b('0x4')](_0x731b('0x2e'),auth[_0x731b('0x6')](),controller['chatQueuesWaitingInteractions']);router[_0x731b('0x4')](_0x731b('0x2f'),auth[_0x731b('0x6')](),controller[_0x731b('0x30')]);router['get'](_0x731b('0x31'),auth[_0x731b('0x6')](),controller[_0x731b('0x32')]);router['get'](_0x731b('0x33'),auth[_0x731b('0x6')](),controller[_0x731b('0x34')]);router[_0x731b('0x4')](_0x731b('0x35'),auth[_0x731b('0x6')](),controller[_0x731b('0x36')]);router[_0x731b('0x4')]('/whatsapp/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x731b('0x37')]);router[_0x731b('0x4')](_0x731b('0x38'),auth[_0x731b('0x6')](),controller[_0x731b('0x39')]);router[_0x731b('0x3a')]('/mail/queues/:id/notify',auth['isAuthenticated'](),controller[_0x731b('0x3b')]('mail'));router[_0x731b('0x4')](_0x731b('0x3c'),auth[_0x731b('0x6')](),controller['showMailQueues']);router[_0x731b('0x3a')](_0x731b('0x3d'),auth['isAuthenticated'](),controller[_0x731b('0x3b')]('chat'));router[_0x731b('0x4')](_0x731b('0x3e'),auth[_0x731b('0x6')](),controller['showChatQueues']);router['post']('/fax/queues/:id/notify',auth[_0x731b('0x6')](),controller[_0x731b('0x3b')]('fax'));router[_0x731b('0x4')]('/fax/queues/:id',auth[_0x731b('0x6')](),controller[_0x731b('0x3f')]);router['post']('/openchannel/queues/:id/notify',auth[_0x731b('0x6')](),controller['queueNotify'](_0x731b('0x40')));router[_0x731b('0x4')](_0x731b('0x41'),auth[_0x731b('0x6')](),controller['showOpenchannelQueues']);router['post'](_0x731b('0x42'),auth[_0x731b('0x6')](),controller['queueNotify'](_0x731b('0x43')));router['post'](_0x731b('0x44'),auth[_0x731b('0x6')](),controller[_0x731b('0x3b')](_0x731b('0x45')));router['get'](_0x731b('0x46'),auth[_0x731b('0x6')](),controller[_0x731b('0x47')]);router[_0x731b('0x4')](_0x731b('0x48'),auth['isAuthenticated'](),controller[_0x731b('0x49')]);router[_0x731b('0x3a')]('/agents/:id/notify',auth[_0x731b('0x6')](),controller[_0x731b('0x4a')]);module[_0x731b('0x4b')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 3c94048..701297d 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 _0x6f47=['voiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','user','hasOwnProperty','MemberReport','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','interface','agent','internal','telephones','trunks','Trunks','Campaigns','showChatQueues','ChatQueues','MailQueues','showMailQueues','mailAccounts','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','uniq','value','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','From','QueueId','Start','queueTransferTimeout','*,*,*,*','channel','Channel\x20field\x20is\x20mandatory','User','create','moment','lodash','../../mysqldb','api','client','http','request','then','error','code','message','result','catch','status','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel'];(function(_0x561ff7,_0x31ca7c){var _0x21689d=function(_0x1da030){while(--_0x1da030){_0x561ff7['push'](_0x561ff7['shift']());}};_0x21689d(++_0x31ca7c);}(_0x6f47,0xc7));var _0x76f4=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0x6f47[_0x5037ab];return _0x512adb;};'use strict';var BPromise=require('bluebird');var moment=require(_0x76f4('0x0'));var _=require(_0x76f4('0x1'));var util=require('util');var db=require(_0x76f4('0x2'))['db'];var logger=require('../../config/logger')(_0x76f4('0x3'));var jayson=require('jayson/promise');var amiClient=jayson[_0x76f4('0x4')][_0x76f4('0x5')]({'port':0x232a});var mailClient=jayson[_0x76f4('0x4')][_0x76f4('0x5')]({'port':0x232b});var routingClient=jayson['client'][_0x76f4('0x5')]({'port':0x232c});function respondWithRpcPromise(_0xfc2405,_0x2176a7,_0x497f99){return new BPromise(function(_0x1a3172,_0x25656d){var _0x65d2c7=_0x497f99?_0x497f99:amiClient;return _0x65d2c7[_0x76f4('0x6')](_0xfc2405,_0x2176a7)[_0x76f4('0x7')](function(_0x4c6b5c){if(_0x4c6b5c['error']){if(_0x4c6b5c[_0x76f4('0x8')][_0x76f4('0x9')]===0x1f4){return _0x25656d(_0x4c6b5c['error']['message']);}return _0x1a3172(_0x4c6b5c[_0x76f4('0x8')][_0x76f4('0xa')]);}else{_0x1a3172(_0x4c6b5c[_0x76f4('0xb')]);}})[_0x76f4('0xc')](function(_0x1aee7f){_0x25656d(_0x1aee7f);});});}function respondWithResult(_0xafd21e,_0xf7e347){_0xf7e347=_0xf7e347||0xc8;return function(_0x3ec740){if(_0x3ec740){return _0xafd21e[_0x76f4('0xd')](_0xf7e347)['json'](_0x3ec740);}return _0xafd21e[_0x76f4('0xe')](0x194);};}function handleError(_0x30dabf,_0x5da1ff){_0x5da1ff=_0x5da1ff||0x1f4;return function(_0x4b6021){logger['error'](_0x4b6021[_0x76f4('0xf')]);if(_0x4b6021[_0x76f4('0x10')]){delete _0x4b6021[_0x76f4('0x10')];}_0x30dabf[_0x76f4('0xd')](_0x5da1ff)[_0x76f4('0x11')](_0x4b6021);};}function findById(_0x2b5e23){return function(_0x46ba51){if(!_[_0x76f4('0x12')](_0x2b5e23)&&!_[_0x76f4('0x12')](_0x46ba51)&&!_[_0x76f4('0x12')](_0x46ba51[_0x76f4('0x13')])){return _[_0x76f4('0x14')](_0x46ba51[_0x76f4('0x13')],function(_0x38450e){return _0x38450e['id']==_0x2b5e23;});}return null;};}exports[_0x76f4('0x15')]=function(_0x397360,_0xfedbe4){return respondWithRpcPromise(_0x76f4('0x16'),_0x397360[_0x76f4('0x17')])[_0x76f4('0x7')](respondWithResult(_0xfedbe4,null))[_0x76f4('0xc')](handleError(_0xfedbe4,null));};exports[_0x76f4('0x18')]=function(_0x5bf3d5,_0x262937){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0x76f4('0x19')](_0x5bf3d5[_0x76f4('0x17')],_0x5bf3d5[_0x76f4('0x1a')]))['then'](respondWithResult(_0x262937,null))['catch'](handleError(_0x262937,null));};exports['voiceChannelStopMixMonitor']=function(_0x465240,_0x681d67){return respondWithRpcPromise(_0x76f4('0x1b'),_[_0x76f4('0x19')](_0x465240[_0x76f4('0x17')],_0x465240[_0x76f4('0x1a')]))[_0x76f4('0x7')](respondWithResult(_0x681d67,null))['catch'](handleError(_0x681d67,null));};exports['voiceQueues']=function(_0x3794fa,_0x497913){return respondWithRpcPromise(_0x76f4('0x1c'),_0x3794fa['query'])['then'](respondWithResult(_0x497913,null))['catch'](handleError(_0x497913,null));};exports[_0x76f4('0x1d')]=function(_0x38300d,_0xd368a2){return respondWithRpcPromise(_0x76f4('0x1c'),_0x38300d[_0x76f4('0x17')])[_0x76f4('0x7')](findById(_0x38300d['params']['id']))[_0x76f4('0x7')](respondWithResult(_0xd368a2,null))['catch'](handleError(_0xd368a2,null));};exports['updateVoiceQueue']=function(_0x5b3f07,_0x10ddb4){return respondWithRpcPromise(_0x76f4('0x1e'),_[_0x76f4('0x19')](_0x5b3f07[_0x76f4('0x1f')],_0x5b3f07['params']))[_0x76f4('0x7')](respondWithResult(_0x10ddb4,null))['catch'](handleError(_0x10ddb4,null));};exports[_0x76f4('0x20')]=function(_0x3c7513,_0x43ac4a){return respondWithRpcPromise(_0x76f4('0x21'),_[_0x76f4('0x19')](_0x3c7513['query'],_0x3c7513['params']))[_0x76f4('0x7')](respondWithResult(_0x43ac4a,null))[_0x76f4('0xc')](handleError(_0x43ac4a,null));};exports[_0x76f4('0x22')]=function(_0x281db6,_0x1f2adf){return respondWithRpcPromise(_0x76f4('0x23'),_0x281db6[_0x76f4('0x17')])[_0x76f4('0x7')](respondWithResult(_0x1f2adf,null))[_0x76f4('0xc')](handleError(_0x1f2adf,null));};exports[_0x76f4('0x24')]=function(_0x308af2,_0x2527a6){return respondWithRpcPromise('VoiceQueuesChannel',_['merge'](_0x308af2['query'],_0x308af2['params']))[_0x76f4('0x7')](respondWithResult(_0x2527a6,null))[_0x76f4('0xc')](handleError(_0x2527a6,null));};exports[_0x76f4('0x25')]=function(_0x456b1f,_0x26fdd6){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x76f4('0x19')](_0x456b1f[_0x76f4('0x17')],_0x456b1f[_0x76f4('0x1a')]))[_0x76f4('0x7')](respondWithResult(_0x26fdd6,null))[_0x76f4('0xc')](handleError(_0x26fdd6,null));};exports[_0x76f4('0x26')]=function(_0xb806cc,_0x28d9d6){return respondWithRpcPromise(_0x76f4('0x27'),_[_0x76f4('0x19')](_0xb806cc[_0x76f4('0x17')],_0xb806cc[_0x76f4('0x1a')]))[_0x76f4('0x7')](respondWithResult(_0x28d9d6,null))[_0x76f4('0xc')](handleError(_0x28d9d6,null));};exports[_0x76f4('0x28')]=function(_0x88506b,_0x3308e3){return respondWithRpcPromise(_0x76f4('0x29'),_0x88506b['query'])[_0x76f4('0x7')](respondWithResult(_0x3308e3,null))[_0x76f4('0xc')](handleError(_0x3308e3,null));};exports[_0x76f4('0x2a')]=function(_0x589637,_0x597e83){return respondWithRpcPromise(_0x76f4('0x2b'),_0x589637['query'])[_0x76f4('0x7')](respondWithResult(_0x597e83,null))['catch'](handleError(_0x597e83,null));};exports[_0x76f4('0x2c')]=function(_0x16f36d,_0x312243){var _0x378675;return respondWithRpcPromise(_0x76f4('0x2d'),_0x16f36d[_0x76f4('0x17')])[_0x76f4('0x7')](function(_0x109ad9){_0x378675=_0x109ad9;return respondWithRpcPromise(_0x76f4('0x2d'),_0x16f36d[_0x76f4('0x17')],routingClient);})['then'](function(_0x5b8d2d){return _[_0x76f4('0x19')]({},_0x5b8d2d,_0x378675);})[_0x76f4('0x7')](respondWithResult(_0x312243,null))[_0x76f4('0xc')](handleError(_0x312243,null));};exports[_0x76f4('0x2e')]=function(_0x2b7dc8,_0x2d6068){if(_0x2b7dc8[_0x76f4('0x1f')]&&_0x2b7dc8[_0x76f4('0x1f')][_0x76f4('0x2f')]&&_0x2b7dc8['user']&&_0x2b7dc8[_0x76f4('0x30')][_0x76f4('0x10')]){for(var _0x4f0d1a in _0x2b7dc8['body'][_0x76f4('0x2f')]){if(_0x2b7dc8[_0x76f4('0x1f')][_0x76f4('0x2f')][_0x76f4('0x31')](_0x4f0d1a)){db[_0x76f4('0x32')]['findAll']({'where':{'channel':_0x4f0d1a,'membername':_0x2b7dc8[_0x76f4('0x30')][_0x76f4('0x10')],'type':_0x76f4('0x33'),'exitAt':null,'uniqueid':_0x2b7dc8[_0x76f4('0x1f')][_0x76f4('0x2f')][_0x4f0d1a]&&_0x2b7dc8[_0x76f4('0x1f')]['interaction'][_0x4f0d1a][_0x76f4('0x34')]?{'$notIn':_0x2b7dc8[_0x76f4('0x1f')][_0x76f4('0x2f')][_0x4f0d1a]}:{'$ne':null}}})['then'](function(_0x571261){var _0x11ea58=moment()[_0x76f4('0x35')](_0x76f4('0x36'));for(var _0x2bea6d=0x0,_0x36fa03=_0x571261['length'];_0x2bea6d<_0x36fa03;_0x2bea6d+=0x1){_0x571261[_0x2bea6d]['updateAttributes']({'exitAt':_0x11ea58});}});for(var _0x8e5b60=0x0;_0x8e5b60<_0x2b7dc8['body'][_0x76f4('0x2f')][_0x4f0d1a][_0x76f4('0x34')];_0x8e5b60+=0x1){db['MemberReport']['findOrCreate']({'where':{'channel':_0x4f0d1a,'membername':_0x2b7dc8[_0x76f4('0x30')][_0x76f4('0x10')],'type':_0x76f4('0x33'),'uniqueid':_0x2b7dc8[_0x76f4('0x1f')]['interaction'][_0x4f0d1a][_0x8e5b60],'exitAt':null},'defaults':{'channel':_0x4f0d1a,'membername':_0x2b7dc8[_0x76f4('0x30')][_0x76f4('0x10')],'interface':_[_0x76f4('0x12')](_0x2b7dc8['user'][_0x76f4('0x37')])?util[_0x76f4('0x35')]('SIP/%s',_0x2b7dc8['user'][_0x76f4('0x10')]):_0x2b7dc8[_0x76f4('0x30')][_0x76f4('0x37')],'type':_0x76f4('0x33'),'enterAt':moment()[_0x76f4('0x35')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x76f4('0x38'),'internal':_0x2b7dc8['user'][_0x76f4('0x39')],'uniqueid':_0x2b7dc8[_0x76f4('0x1f')][_0x76f4('0x2f')][_0x4f0d1a][_0x8e5b60]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x2b7dc8[_0x76f4('0x1a')]['id'],'capacity':_0x2b7dc8[_0x76f4('0x1f')]['capacity']},routingClient)[_0x76f4('0x7')](respondWithResult(_0x2d6068,null))[_0x76f4('0xc')](handleError(_0x2d6068,null));};exports[_0x76f4('0x3a')]=function(_0x1c658c,_0x40ff20){return respondWithRpcPromise('Telephones',_0x1c658c[_0x76f4('0x17')])['then'](respondWithResult(_0x40ff20,null))[_0x76f4('0xc')](handleError(_0x40ff20,null));};exports[_0x76f4('0x3b')]=function(_0x154ba,_0x5121ec){return respondWithRpcPromise(_0x76f4('0x3c'),_0x154ba[_0x76f4('0x17')])[_0x76f4('0x7')](respondWithResult(_0x5121ec,null))[_0x76f4('0xc')](handleError(_0x5121ec,null));};exports['campaigns']=function(_0x2028e9,_0xf11e07){return respondWithRpcPromise(_0x76f4('0x3d'),_0x2028e9[_0x76f4('0x17')])['then'](respondWithResult(_0xf11e07,null))[_0x76f4('0xc')](handleError(_0xf11e07,null));};exports['chatQueues']=function(_0x129048,_0x190c8d){return respondWithRpcPromise('ChatQueues',_0x129048['query'],routingClient)[_0x76f4('0x7')](respondWithResult(_0x190c8d,null))[_0x76f4('0xc')](handleError(_0x190c8d,null));};exports[_0x76f4('0x3e')]=function(_0x596b51,_0x27ba06){return respondWithRpcPromise(_0x76f4('0x3f'),_0x596b51[_0x76f4('0x17')],routingClient)['then'](findById(_0x596b51['params']['id']))[_0x76f4('0x7')](respondWithResult(_0x27ba06,null))[_0x76f4('0xc')](handleError(_0x27ba06,null));};exports['mailQueues']=function(_0x490ced,_0x3f1840){return respondWithRpcPromise(_0x76f4('0x40'),_0x490ced[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](respondWithResult(_0x3f1840,null))[_0x76f4('0xc')](handleError(_0x3f1840,null));};exports[_0x76f4('0x41')]=function(_0x97be11,_0x36a52a){return respondWithRpcPromise(_0x76f4('0x40'),_0x97be11['query'],routingClient)['then'](findById(_0x97be11['params']['id']))[_0x76f4('0x7')](respondWithResult(_0x36a52a,null))[_0x76f4('0xc')](handleError(_0x36a52a,null));};exports[_0x76f4('0x42')]=function(_0x3b6c16,_0x4c9d64){return respondWithRpcPromise('MailAccounts',_0x3b6c16[_0x76f4('0x17')],mailClient)['then'](respondWithResult(_0x4c9d64,null))[_0x76f4('0xc')](handleError(_0x4c9d64,null));};exports['openchannelQueues']=function(_0x4285dd,_0x25e510){return respondWithRpcPromise(_0x76f4('0x43'),_0x4285dd[_0x76f4('0x17')],routingClient)['then'](respondWithResult(_0x25e510,null))[_0x76f4('0xc')](handleError(_0x25e510,null));};exports[_0x76f4('0x44')]=function(_0x22a0cc,_0x40c170){return respondWithRpcPromise(_0x76f4('0x43'),_0x22a0cc[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](findById(_0x22a0cc['params']['id']))[_0x76f4('0x7')](respondWithResult(_0x40c170,null))[_0x76f4('0xc')](handleError(_0x40c170,null));};exports[_0x76f4('0x45')]=function(_0x320a87,_0x28cf4c){return respondWithRpcPromise(_0x76f4('0x46'),_0x320a87[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](respondWithResult(_0x28cf4c,null))['catch'](handleError(_0x28cf4c,null));};exports['showSmsQueues']=function(_0xa3091a,_0x617924){return respondWithRpcPromise(_0x76f4('0x46'),_0xa3091a['query'],routingClient)[_0x76f4('0x7')](findById(_0xa3091a['params']['id']))[_0x76f4('0x7')](respondWithResult(_0x617924,null))[_0x76f4('0xc')](handleError(_0x617924,null));};exports['whatsappQueues']=function(_0xda0ac2,_0x37b7f7){return respondWithRpcPromise(_0x76f4('0x47'),_0xda0ac2[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](respondWithResult(_0x37b7f7,null))[_0x76f4('0xc')](handleError(_0x37b7f7,null));};exports[_0x76f4('0x48')]=function(_0x410d83,_0x1f7257){return respondWithRpcPromise('WhatsappQueues',_0x410d83[_0x76f4('0x17')],routingClient)['then'](findById(_0x410d83[_0x76f4('0x1a')]['id']))[_0x76f4('0x7')](respondWithResult(_0x1f7257,null))[_0x76f4('0xc')](handleError(_0x1f7257,null));};exports[_0x76f4('0x49')]=function(_0xfbb52c,_0x8de630){return respondWithRpcPromise(_0x76f4('0x4a'),_0xfbb52c[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](respondWithResult(_0x8de630,null))[_0x76f4('0xc')](handleError(_0x8de630,null));};exports['showFaxQueues']=function(_0x30f3de,_0x6f874d){return respondWithRpcPromise('FaxQueues',_0x30f3de[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](findById(_0x30f3de[_0x76f4('0x1a')]['id']))['then'](respondWithResult(_0x6f874d,null))[_0x76f4('0xc')](handleError(_0x6f874d,null));};exports[_0x76f4('0x4b')]=function(_0x3e829f,_0x52610a){return respondWithRpcPromise(_0x76f4('0x4c'),_0x3e829f[_0x76f4('0x17')])[_0x76f4('0x7')](respondWithResult(_0x52610a,null))[_0x76f4('0xc')](handleError(_0x52610a,null));};exports[_0x76f4('0x4d')]=function(_0x10ee07,_0x19b99c){return respondWithRpcPromise(_0x76f4('0x4e'),_0x10ee07[_0x76f4('0x17')],routingClient)['then'](respondWithResult(_0x19b99c,null))[_0x76f4('0xc')](handleError(_0x19b99c,null));};exports[_0x76f4('0x4f')]=function(_0x19fdc3,_0x39c9af){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x19fdc3[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](respondWithResult(_0x39c9af,null))[_0x76f4('0xc')](handleError(_0x39c9af,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x43b44d,_0x1375d5){return respondWithRpcPromise(_0x76f4('0x50'),_0x43b44d[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](respondWithResult(_0x1375d5,null))['catch'](handleError(_0x1375d5,null));};exports[_0x76f4('0x51')]=function(_0x4dd41f,_0x2b8467){return respondWithRpcPromise(_0x76f4('0x50'),_0x4dd41f['query'],routingClient)['then'](function(_0x58251e){if(_0x4dd41f[_0x76f4('0x17')][_0x76f4('0x52')]!==undefined){var _0x1e7b6=_(_0x58251e[_0x76f4('0x13')])[_0x76f4('0x53')]([_0x4dd41f[_0x76f4('0x17')]['type'],_0x4dd41f[_0x76f4('0x1a')]['id']])[_0x76f4('0x54')](_0x76f4('0x55'))[_0x76f4('0x56')]()[_0x76f4('0x57')]();return _0x58251e[_0x76f4('0x13')][_0x76f4('0x53')](function(_0x202fc8){return _0x1e7b6['indexOf'](_0x202fc8[_0x76f4('0x55')])>-0x1;});}else{return _0x58251e['rows'][_0x76f4('0x53')](function(_0x30358a){return _0x30358a[_0x76f4('0x55')]===parseInt(_0x4dd41f[_0x76f4('0x1a')]['id']);});}})[_0x76f4('0x7')](respondWithResult(_0x2b8467,null))[_0x76f4('0xc')](handleError(_0x2b8467,null));};exports[_0x76f4('0x58')]=function(_0x2a0491,_0x54729b){return respondWithRpcPromise(_0x76f4('0x59'),_0x2a0491['query'],routingClient)['then'](respondWithResult(_0x54729b,null))['catch'](handleError(_0x54729b,null));};exports[_0x76f4('0x5a')]=function(_0x402209,_0x279040){return respondWithRpcPromise(_0x76f4('0x5b'),_0x402209['query'],routingClient)[_0x76f4('0x7')](respondWithResult(_0x279040,null))[_0x76f4('0xc')](handleError(_0x279040,null));};exports[_0x76f4('0x5c')]=function(_0x5f5c24,_0x12f16e){return respondWithRpcPromise(_0x76f4('0x5d'),_0x5f5c24[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](respondWithResult(_0x12f16e,null))[_0x76f4('0xc')](handleError(_0x12f16e,null));};exports[_0x76f4('0x5e')]=function(_0x3b5e15){return function(_0x4b562c,_0x2e991e){var _0xa49e2a,_0x4c7307;var _0x3bc914=_[_0x76f4('0x5f')](_0x3b5e15);var _0x5e6393=_0x3b5e15===_0x76f4('0x60')?_0x76f4('0x61'):_0x76f4('0x62');return db[_0x3bc914+_0x76f4('0x63')][_0x76f4('0x64')]({'raw':!![],'where':{'id':_0x4b562c[_0x76f4('0x1a')]['id']}})['then'](function(_0x2dac86){if(_[_0x76f4('0x12')](_0x2dac86)){throw new Error(_0x3bc914+_0x76f4('0x65'));}_0xa49e2a=_0x2dac86;return db[_0x3bc914+_0x76f4('0x66')]['findOne']({'where':{'id':_0x4b562c[_0x76f4('0x1f')]['messageId']},'include':[{'model':db[_0x3bc914+_0x76f4('0x67')],'as':'Interaction'},{'model':db[_0x3bc914+_0x5e6393],'as':_0x76f4('0x62')}]});})[_0x76f4('0x7')](function(_0x59e9ed){if(_['isNil'](_0x59e9ed)){throw new Error(_0x3bc914+_0x76f4('0x68'));}_0x4c7307=_0x59e9ed;return _0x59e9ed[_0x76f4('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x76f4('0x7')](function(){var _0x4a2969={'uniqueid':_0x3b5e15+'.'+_0x4c7307['id']+'.'+_0x4c7307['Interaction']['id'],'FromUserId':_0x4b562c[_0x76f4('0x30')]['id'],'type':_0x76f4('0x6a')};_0x4a2969[_0x3bc914+_0x76f4('0x6b')]=_0x4c7307['id'];_0x4a2969[_0x3bc914+_0x76f4('0x6c')]=_0x4c7307[_0x76f4('0x67')]['id'];_0x4a2969[_0x76f4('0x6d')+_0x3bc914+_0x5e6393+'Id']=_0x4c7307[_0x76f4('0x62')]['id'];_0x4a2969['To'+_0x3bc914+_0x76f4('0x6e')]=_0xa49e2a['id'];return db[_0x3bc914+'TransferReport']['create'](_0x4a2969);})[_0x76f4('0x7')](function(){return respondWithRpcPromise(_0x76f4('0x6f'),{'channel':_0x3b5e15,'interaction':_0x4c7307[_0x76f4('0x67')],'message':_0x4c7307,'account':_0x4c7307['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x76f4('0x6a'),'appdata':_0xa49e2a[_0x76f4('0x10')]+','+(_0x4c7307[_0x76f4('0x62')][_0x76f4('0x70')]||0x12c),'interval':_0x76f4('0x71')}]},routingClient);})[_0x76f4('0x7')](respondWithResult(_0x2e991e,null))[_0x76f4('0xc')](handleError(_0x2e991e,null));};};exports['agentNotify']=function(_0x13cf2a,_0x316f86){var _0x3e537b,_0x53252e;if(_[_0x76f4('0x12')](_0x13cf2a[_0x76f4('0x1f')][_0x76f4('0x72')])){throw new Error(_0x76f4('0x73'));}var _0x5080a9=_0x13cf2a[_0x76f4('0x1f')]['channel'];var _0xc80d4c=_['capitalize'](_0x5080a9);var _0x238df3=_0x5080a9===_0x76f4('0x60')?_0x76f4('0x61'):'Account';return db[_0x76f4('0x74')][_0x76f4('0x64')]({'raw':!![],'where':{'id':_0x13cf2a[_0x76f4('0x1a')]['id'],'role':'agent'}})[_0x76f4('0x7')](function(_0x460867){if(_['isNil'](_0x460867)){throw new Error('Agent\x20not\x20found');}_0x3e537b=_0x460867;return db[_0xc80d4c+_0x76f4('0x66')][_0x76f4('0x64')]({'where':{'id':_0x13cf2a['body']['messageId']},'include':[{'model':db[_0xc80d4c+_0x76f4('0x67')],'as':_0x76f4('0x67')},{'model':db[_0xc80d4c+_0x238df3],'as':'Account'}]});})[_0x76f4('0x7')](function(_0x54ae6c){if(_['isNil'](_0x54ae6c)){throw new Error(_0xc80d4c+'\x20Message\x20not\x20found');}_0x53252e=_0x54ae6c;return _0x54ae6c[_0x76f4('0x69')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x59265d={'uniqueid':_0x5080a9+'.'+_0x53252e['id']+'.'+_0x53252e[_0x76f4('0x67')]['id'],'FromUserId':_0x13cf2a['user']['id'],'type':'queue','ToUserId':_0x3e537b['id']};_0x59265d[_0xc80d4c+_0x76f4('0x6b')]=_0x53252e['id'];_0x59265d[_0xc80d4c+'InteractionId']=_0x53252e[_0x76f4('0x67')]['id'];_0x59265d[_0x76f4('0x6d')+_0xc80d4c+_0x238df3+'Id']=_0x53252e['Account']['id'];return db[_0xc80d4c+'TransferReport'][_0x76f4('0x75')](_0x59265d);})[_0x76f4('0x7')](function(){return respondWithRpcPromise(_0x76f4('0x6f'),{'channel':_0x5080a9,'interaction':_0x53252e['Interaction'],'message':_0x53252e,'account':_0x53252e[_0x76f4('0x62')],'applications':[{'id':0x0,'priority':0x1,'app':_0x76f4('0x38'),'appdata':_0x3e537b[_0x76f4('0x10')]+','+(_0x53252e[_0x76f4('0x62')]['agentTransferTimeout']||0x12c),'interval':_0x76f4('0x71')}]},routingClient);})[_0x76f4('0x7')](respondWithResult(_0x316f86,null))[_0x76f4('0xc')](handleError(_0x316f86,null));}; \ No newline at end of file +var _0x3eea=['whatsappQueues','WhatsappQueues','faxQueues','showFaxQueues','FaxQueues','faxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','filter','type','queue_id','uniq','value','indexOf','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Website','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','From','Account','QueueId','TransferReport','create','Start','queueTransferTimeout','agentNotify','channel','Channel\x20field\x20is\x20mandatory','chat','User','Agent\x20not\x20found','agentTransferTimeout','*,*,*,*','bluebird','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','client','http','then','error','code','message','catch','status','sendStatus','stack','name','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','merge','params','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','OutboundChannels','Agents','user','interaction','hasOwnProperty','MemberReport','findAll','INTERACTION','length','YYYY-MM-DD\x20HH:mm:ss','findOrCreate','format','SIP/%s','interface','agent','internal','capacity','telephones','Telephones','trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','showOpenchannelQueues','OpenchannelQueues','smsQueues','showSmsQueues','SmsQueues'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x583469,_0x11f10a){_0x583469=_0x583469-0x0;var _0x18a243=_0x3eea[_0x583469];return _0x18a243;};'use strict';var BPromise=require(_0xa3ee('0x0'));var moment=require('moment');var _=require(_0xa3ee('0x1'));var util=require(_0xa3ee('0x2'));var db=require(_0xa3ee('0x3'))['db'];var logger=require(_0xa3ee('0x4'))(_0xa3ee('0x5'));var jayson=require(_0xa3ee('0x6'));var amiClient=jayson[_0xa3ee('0x7')][_0xa3ee('0x8')]({'port':0x232a});var mailClient=jayson[_0xa3ee('0x7')][_0xa3ee('0x8')]({'port':0x232b});var routingClient=jayson[_0xa3ee('0x7')]['http']({'port':0x232c});function respondWithRpcPromise(_0x538bf9,_0x4183ee,_0x4e4588){return new BPromise(function(_0x37a3f0,_0x56f37b){var _0x1eeb5b=_0x4e4588?_0x4e4588:amiClient;return _0x1eeb5b['request'](_0x538bf9,_0x4183ee)[_0xa3ee('0x9')](function(_0x5ef236){if(_0x5ef236[_0xa3ee('0xa')]){if(_0x5ef236[_0xa3ee('0xa')][_0xa3ee('0xb')]===0x1f4){return _0x56f37b(_0x5ef236['error'][_0xa3ee('0xc')]);}return _0x37a3f0(_0x5ef236[_0xa3ee('0xa')]['message']);}else{_0x37a3f0(_0x5ef236['result']);}})[_0xa3ee('0xd')](function(_0x30e652){_0x56f37b(_0x30e652);});});}function respondWithResult(_0x403518,_0x4363d1){_0x4363d1=_0x4363d1||0xc8;return function(_0x594c88){if(_0x594c88){return _0x403518[_0xa3ee('0xe')](_0x4363d1)['json'](_0x594c88);}return _0x403518[_0xa3ee('0xf')](0x194);};}function handleError(_0x20535f,_0x2c34cf){_0x2c34cf=_0x2c34cf||0x1f4;return function(_0x150e20){logger['error'](_0x150e20[_0xa3ee('0x10')]);if(_0x150e20[_0xa3ee('0x11')]){delete _0x150e20['name'];}_0x20535f['status'](_0x2c34cf)['send'](_0x150e20);};}function findById(_0x40decb){return function(_0x7277cd){if(!_[_0xa3ee('0x12')](_0x40decb)&&!_[_0xa3ee('0x12')](_0x7277cd)&&!_['isNil'](_0x7277cd[_0xa3ee('0x13')])){return _[_0xa3ee('0x14')](_0x7277cd[_0xa3ee('0x13')],function(_0x299b1e){return _0x299b1e['id']==_0x40decb;});}return null;};}exports[_0xa3ee('0x15')]=function(_0x4aac0e,_0x377b9d){return respondWithRpcPromise(_0xa3ee('0x16'),_0x4aac0e[_0xa3ee('0x17')])[_0xa3ee('0x9')](respondWithResult(_0x377b9d,null))[_0xa3ee('0xd')](handleError(_0x377b9d,null));};exports[_0xa3ee('0x18')]=function(_0x4f8c56,_0x3f5d70){return respondWithRpcPromise(_0xa3ee('0x19'),_['merge'](_0x4f8c56[_0xa3ee('0x17')],_0x4f8c56['params']))[_0xa3ee('0x9')](respondWithResult(_0x3f5d70,null))[_0xa3ee('0xd')](handleError(_0x3f5d70,null));};exports[_0xa3ee('0x1a')]=function(_0x1bd196,_0x60b899){return respondWithRpcPromise(_0xa3ee('0x1b'),_[_0xa3ee('0x1c')](_0x1bd196[_0xa3ee('0x17')],_0x1bd196[_0xa3ee('0x1d')]))[_0xa3ee('0x9')](respondWithResult(_0x60b899,null))['catch'](handleError(_0x60b899,null));};exports[_0xa3ee('0x1e')]=function(_0x1dca29,_0x157071){return respondWithRpcPromise(_0xa3ee('0x1f'),_0x1dca29[_0xa3ee('0x17')])['then'](respondWithResult(_0x157071,null))[_0xa3ee('0xd')](handleError(_0x157071,null));};exports[_0xa3ee('0x20')]=function(_0x146493,_0xd9a7f8){return respondWithRpcPromise(_0xa3ee('0x1f'),_0x146493[_0xa3ee('0x17')])[_0xa3ee('0x9')](findById(_0x146493[_0xa3ee('0x1d')]['id']))[_0xa3ee('0x9')](respondWithResult(_0xd9a7f8,null))[_0xa3ee('0xd')](handleError(_0xd9a7f8,null));};exports['updateVoiceQueue']=function(_0x5ba571,_0x4abf49){return respondWithRpcPromise(_0xa3ee('0x21'),_['merge'](_0x5ba571[_0xa3ee('0x22')],_0x5ba571[_0xa3ee('0x1d')]))[_0xa3ee('0x9')](respondWithResult(_0x4abf49,null))[_0xa3ee('0xd')](handleError(_0x4abf49,null));};exports[_0xa3ee('0x23')]=function(_0x14547d,_0x30ba4e){return respondWithRpcPromise(_0xa3ee('0x24'),_[_0xa3ee('0x1c')](_0x14547d[_0xa3ee('0x17')],_0x14547d['params']))[_0xa3ee('0x9')](respondWithResult(_0x30ba4e,null))['catch'](handleError(_0x30ba4e,null));};exports[_0xa3ee('0x25')]=function(_0x332d61,_0x496839){return respondWithRpcPromise(_0xa3ee('0x26'),_0x332d61['query'])[_0xa3ee('0x9')](respondWithResult(_0x496839,null))['catch'](handleError(_0x496839,null));};exports[_0xa3ee('0x27')]=function(_0x299099,_0x2f803c){return respondWithRpcPromise(_0xa3ee('0x28'),_[_0xa3ee('0x1c')](_0x299099['query'],_0x299099[_0xa3ee('0x1d')]))[_0xa3ee('0x9')](respondWithResult(_0x2f803c,null))[_0xa3ee('0xd')](handleError(_0x2f803c,null));};exports['voiceQueuesChannelHangup']=function(_0x1599e4,_0x531f58){return respondWithRpcPromise(_0xa3ee('0x29'),_['merge'](_0x1599e4[_0xa3ee('0x17')],_0x1599e4['params']))[_0xa3ee('0x9')](respondWithResult(_0x531f58,null))[_0xa3ee('0xd')](handleError(_0x531f58,null));};exports[_0xa3ee('0x2a')]=function(_0x45be9b,_0x1717ba){return respondWithRpcPromise(_0xa3ee('0x2b'),_[_0xa3ee('0x1c')](_0x45be9b[_0xa3ee('0x17')],_0x45be9b[_0xa3ee('0x1d')]))[_0xa3ee('0x9')](respondWithResult(_0x1717ba,null))[_0xa3ee('0xd')](handleError(_0x1717ba,null));};exports[_0xa3ee('0x2c')]=function(_0x447efd,_0x595b55){return respondWithRpcPromise(_0xa3ee('0x2d'),_0x447efd[_0xa3ee('0x17')])[_0xa3ee('0x9')](respondWithResult(_0x595b55,null))[_0xa3ee('0xd')](handleError(_0x595b55,null));};exports['outboundChannels']=function(_0x257627,_0x11a721){return respondWithRpcPromise(_0xa3ee('0x2e'),_0x257627['query'])[_0xa3ee('0x9')](respondWithResult(_0x11a721,null))[_0xa3ee('0xd')](handleError(_0x11a721,null));};exports['agents']=function(_0x319c26,_0x3ecbe6){var _0x4ef99a;return respondWithRpcPromise(_0xa3ee('0x2f'),_0x319c26[_0xa3ee('0x17')])[_0xa3ee('0x9')](function(_0x2c8873){_0x4ef99a=_0x2c8873;return respondWithRpcPromise(_0xa3ee('0x2f'),_0x319c26[_0xa3ee('0x17')],routingClient);})[_0xa3ee('0x9')](function(_0x3e0eec){return _[_0xa3ee('0x1c')]({},_0x3e0eec,_0x4ef99a);})[_0xa3ee('0x9')](respondWithResult(_0x3ecbe6,null))[_0xa3ee('0xd')](handleError(_0x3ecbe6,null));};exports['agentCapacity']=function(_0x5aa4b3,_0x548534){if(_0x5aa4b3[_0xa3ee('0x22')]&&_0x5aa4b3[_0xa3ee('0x22')]['interaction']&&_0x5aa4b3[_0xa3ee('0x30')]&&_0x5aa4b3[_0xa3ee('0x30')][_0xa3ee('0x11')]){for(var _0x55f47f in _0x5aa4b3[_0xa3ee('0x22')]['interaction']){if(_0x5aa4b3[_0xa3ee('0x22')][_0xa3ee('0x31')][_0xa3ee('0x32')](_0x55f47f)){db[_0xa3ee('0x33')][_0xa3ee('0x34')]({'where':{'channel':_0x55f47f,'membername':_0x5aa4b3[_0xa3ee('0x30')][_0xa3ee('0x11')],'type':_0xa3ee('0x35'),'exitAt':null,'uniqueid':_0x5aa4b3[_0xa3ee('0x22')][_0xa3ee('0x31')][_0x55f47f]&&_0x5aa4b3[_0xa3ee('0x22')][_0xa3ee('0x31')][_0x55f47f][_0xa3ee('0x36')]?{'$notIn':_0x5aa4b3[_0xa3ee('0x22')][_0xa3ee('0x31')][_0x55f47f]}:{'$ne':null}}})[_0xa3ee('0x9')](function(_0x25e0fe){var _0x4594e1=moment()['format'](_0xa3ee('0x37'));for(var _0xdca412=0x0,_0x112e80=_0x25e0fe[_0xa3ee('0x36')];_0xdca412<_0x112e80;_0xdca412+=0x1){_0x25e0fe[_0xdca412]['updateAttributes']({'exitAt':_0x4594e1});}});for(var _0x30fcf1=0x0;_0x30fcf1<_0x5aa4b3['body'][_0xa3ee('0x31')][_0x55f47f][_0xa3ee('0x36')];_0x30fcf1+=0x1){db[_0xa3ee('0x33')][_0xa3ee('0x38')]({'where':{'channel':_0x55f47f,'membername':_0x5aa4b3[_0xa3ee('0x30')][_0xa3ee('0x11')],'type':_0xa3ee('0x35'),'uniqueid':_0x5aa4b3[_0xa3ee('0x22')][_0xa3ee('0x31')][_0x55f47f][_0x30fcf1],'exitAt':null},'defaults':{'channel':_0x55f47f,'membername':_0x5aa4b3[_0xa3ee('0x30')]['name'],'interface':_[_0xa3ee('0x12')](_0x5aa4b3['user']['interface'])?util[_0xa3ee('0x39')](_0xa3ee('0x3a'),_0x5aa4b3[_0xa3ee('0x30')][_0xa3ee('0x11')]):_0x5aa4b3[_0xa3ee('0x30')][_0xa3ee('0x3b')],'type':_0xa3ee('0x35'),'enterAt':moment()['format'](_0xa3ee('0x37')),'role':_0xa3ee('0x3c'),'internal':_0x5aa4b3['user'][_0xa3ee('0x3d')],'uniqueid':_0x5aa4b3[_0xa3ee('0x22')][_0xa3ee('0x31')][_0x55f47f][_0x30fcf1]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x5aa4b3['params']['id'],'capacity':_0x5aa4b3[_0xa3ee('0x22')][_0xa3ee('0x3e')]},routingClient)[_0xa3ee('0x9')](respondWithResult(_0x548534,null))[_0xa3ee('0xd')](handleError(_0x548534,null));};exports[_0xa3ee('0x3f')]=function(_0x57e654,_0x55678e){return respondWithRpcPromise(_0xa3ee('0x40'),_0x57e654[_0xa3ee('0x17')])['then'](respondWithResult(_0x55678e,null))[_0xa3ee('0xd')](handleError(_0x55678e,null));};exports[_0xa3ee('0x41')]=function(_0x13cd8b,_0x579ec8){return respondWithRpcPromise('Trunks',_0x13cd8b[_0xa3ee('0x17')])['then'](respondWithResult(_0x579ec8,null))[_0xa3ee('0xd')](handleError(_0x579ec8,null));};exports[_0xa3ee('0x42')]=function(_0x5b8e79,_0x4232e0){return respondWithRpcPromise(_0xa3ee('0x43'),_0x5b8e79[_0xa3ee('0x17')])['then'](respondWithResult(_0x4232e0,null))[_0xa3ee('0xd')](handleError(_0x4232e0,null));};exports[_0xa3ee('0x44')]=function(_0x594034,_0x1d832c){return respondWithRpcPromise(_0xa3ee('0x45'),_0x594034[_0xa3ee('0x17')],routingClient)['then'](respondWithResult(_0x1d832c,null))['catch'](handleError(_0x1d832c,null));};exports[_0xa3ee('0x46')]=function(_0x17ac07,_0x4a1a2f){return respondWithRpcPromise(_0xa3ee('0x45'),_0x17ac07[_0xa3ee('0x17')],routingClient)['then'](findById(_0x17ac07['params']['id']))[_0xa3ee('0x9')](respondWithResult(_0x4a1a2f,null))[_0xa3ee('0xd')](handleError(_0x4a1a2f,null));};exports[_0xa3ee('0x47')]=function(_0x52b824,_0x11fb6e){return respondWithRpcPromise(_0xa3ee('0x48'),_0x52b824[_0xa3ee('0x17')],routingClient)[_0xa3ee('0x9')](respondWithResult(_0x11fb6e,null))[_0xa3ee('0xd')](handleError(_0x11fb6e,null));};exports[_0xa3ee('0x49')]=function(_0x497be4,_0x10f508){return respondWithRpcPromise(_0xa3ee('0x48'),_0x497be4['query'],routingClient)[_0xa3ee('0x9')](findById(_0x497be4[_0xa3ee('0x1d')]['id']))[_0xa3ee('0x9')](respondWithResult(_0x10f508,null))[_0xa3ee('0xd')](handleError(_0x10f508,null));};exports[_0xa3ee('0x4a')]=function(_0x330778,_0x4a2255){return respondWithRpcPromise(_0xa3ee('0x4b'),_0x330778[_0xa3ee('0x17')],mailClient)[_0xa3ee('0x9')](respondWithResult(_0x4a2255,null))['catch'](handleError(_0x4a2255,null));};exports[_0xa3ee('0x4c')]=function(_0x13b81b,_0x519f10){return respondWithRpcPromise('OpenchannelQueues',_0x13b81b['query'],routingClient)['then'](respondWithResult(_0x519f10,null))[_0xa3ee('0xd')](handleError(_0x519f10,null));};exports[_0xa3ee('0x4d')]=function(_0x3adafb,_0x2f0424){return respondWithRpcPromise(_0xa3ee('0x4e'),_0x3adafb[_0xa3ee('0x17')],routingClient)[_0xa3ee('0x9')](findById(_0x3adafb['params']['id']))[_0xa3ee('0x9')](respondWithResult(_0x2f0424,null))[_0xa3ee('0xd')](handleError(_0x2f0424,null));};exports[_0xa3ee('0x4f')]=function(_0xaff641,_0x147024){return respondWithRpcPromise('SmsQueues',_0xaff641['query'],routingClient)[_0xa3ee('0x9')](respondWithResult(_0x147024,null))[_0xa3ee('0xd')](handleError(_0x147024,null));};exports[_0xa3ee('0x50')]=function(_0x24613d,_0x16aabe){return respondWithRpcPromise(_0xa3ee('0x51'),_0x24613d[_0xa3ee('0x17')],routingClient)[_0xa3ee('0x9')](findById(_0x24613d[_0xa3ee('0x1d')]['id']))[_0xa3ee('0x9')](respondWithResult(_0x16aabe,null))[_0xa3ee('0xd')](handleError(_0x16aabe,null));};exports[_0xa3ee('0x52')]=function(_0x64f353,_0x224790){return respondWithRpcPromise(_0xa3ee('0x53'),_0x64f353['query'],routingClient)[_0xa3ee('0x9')](respondWithResult(_0x224790,null))['catch'](handleError(_0x224790,null));};exports['showWhatsappQueues']=function(_0x2b1c6e,_0x49daf9){return respondWithRpcPromise(_0xa3ee('0x53'),_0x2b1c6e[_0xa3ee('0x17')],routingClient)[_0xa3ee('0x9')](findById(_0x2b1c6e[_0xa3ee('0x1d')]['id']))['then'](respondWithResult(_0x49daf9,null))[_0xa3ee('0xd')](handleError(_0x49daf9,null));};exports[_0xa3ee('0x54')]=function(_0x179ae2,_0x370e3e){return respondWithRpcPromise('FaxQueues',_0x179ae2[_0xa3ee('0x17')],routingClient)[_0xa3ee('0x9')](respondWithResult(_0x370e3e,null))['catch'](handleError(_0x370e3e,null));};exports[_0xa3ee('0x55')]=function(_0x52a066,_0x4f3aac){return respondWithRpcPromise(_0xa3ee('0x56'),_0x52a066['query'],routingClient)['then'](findById(_0x52a066[_0xa3ee('0x1d')]['id']))['then'](respondWithResult(_0x4f3aac,null))['catch'](handleError(_0x4f3aac,null));};exports[_0xa3ee('0x57')]=function(_0xf8689f,_0x538a9b){return respondWithRpcPromise('FaxAccounts',_0xf8689f['query'])[_0xa3ee('0x9')](respondWithResult(_0x538a9b,null))[_0xa3ee('0xd')](handleError(_0x538a9b,null));};exports[_0xa3ee('0x58')]=function(_0x7844ae,_0x389547){return respondWithRpcPromise(_0xa3ee('0x59'),_0x7844ae['query'],routingClient)['then'](respondWithResult(_0x389547,null))[_0xa3ee('0xd')](handleError(_0x389547,null));};exports[_0xa3ee('0x5a')]=function(_0x42a79e,_0x5675fb){return respondWithRpcPromise(_0xa3ee('0x5b'),_0x42a79e[_0xa3ee('0x17')],routingClient)['then'](respondWithResult(_0x5675fb,null))[_0xa3ee('0xd')](handleError(_0x5675fb,null));};exports[_0xa3ee('0x5c')]=function(_0x3be877,_0x2ad745){return respondWithRpcPromise(_0xa3ee('0x5d'),_0x3be877['query'],routingClient)[_0xa3ee('0x9')](respondWithResult(_0x2ad745,null))[_0xa3ee('0xd')](handleError(_0x2ad745,null));};exports[_0xa3ee('0x5e')]=function(_0x37e1c2,_0xbfb429){return respondWithRpcPromise(_0xa3ee('0x5d'),_0x37e1c2[_0xa3ee('0x17')],routingClient)[_0xa3ee('0x9')](function(_0x448f14){if(_0x37e1c2['query']['type']!==undefined){var _0x228671=_(_0x448f14['rows'])[_0xa3ee('0x5f')]([_0x37e1c2[_0xa3ee('0x17')][_0xa3ee('0x60')],_0x37e1c2[_0xa3ee('0x1d')]['id']])['map'](_0xa3ee('0x61'))[_0xa3ee('0x62')]()[_0xa3ee('0x63')]();return _0x448f14[_0xa3ee('0x13')][_0xa3ee('0x5f')](function(_0x4e9473){return _0x228671[_0xa3ee('0x64')](_0x4e9473[_0xa3ee('0x61')])>-0x1;});}else{return _0x448f14[_0xa3ee('0x13')]['filter'](function(_0x3ca523){return _0x3ca523['queue_id']===parseInt(_0x37e1c2[_0xa3ee('0x1d')]['id']);});}})['then'](respondWithResult(_0xbfb429,null))[_0xa3ee('0xd')](handleError(_0xbfb429,null));};exports[_0xa3ee('0x65')]=function(_0x119c3d,_0x140ee0){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x119c3d[_0xa3ee('0x17')],routingClient)[_0xa3ee('0x9')](respondWithResult(_0x140ee0,null))['catch'](handleError(_0x140ee0,null));};exports[_0xa3ee('0x66')]=function(_0xa82482,_0x44b084){return respondWithRpcPromise(_0xa3ee('0x67'),_0xa82482[_0xa3ee('0x17')],routingClient)['then'](respondWithResult(_0x44b084,null))[_0xa3ee('0xd')](handleError(_0x44b084,null));};exports[_0xa3ee('0x68')]=function(_0x55a6b7,_0x2535ef){return respondWithRpcPromise(_0xa3ee('0x69'),_0x55a6b7[_0xa3ee('0x17')],routingClient)[_0xa3ee('0x9')](respondWithResult(_0x2535ef,null))[_0xa3ee('0xd')](handleError(_0x2535ef,null));};exports[_0xa3ee('0x6a')]=function(_0x31d3ca){return function(_0x329e32,_0x37bde3){var _0x25334c,_0x4f7ace;var _0x21fd56=_[_0xa3ee('0x6b')](_0x31d3ca);var _0x26a124=_0x31d3ca==='chat'?_0xa3ee('0x6c'):'Account';return db[_0x21fd56+_0xa3ee('0x6d')][_0xa3ee('0x6e')]({'raw':!![],'where':{'id':_0x329e32['params']['id']}})[_0xa3ee('0x9')](function(_0x44f27b){if(_['isNil'](_0x44f27b)){throw new Error(_0x21fd56+_0xa3ee('0x6f'));}_0x25334c=_0x44f27b;return db[_0x21fd56+_0xa3ee('0x70')][_0xa3ee('0x6e')]({'where':{'id':_0x329e32[_0xa3ee('0x22')][_0xa3ee('0x71')]},'include':[{'model':db[_0x21fd56+_0xa3ee('0x72')],'as':'Interaction'},{'model':db[_0x21fd56+_0x26a124],'as':'Account'}]});})['then'](function(_0x27454a){if(_['isNil'](_0x27454a)){throw new Error(_0x21fd56+_0xa3ee('0x73'));}_0x4f7ace=_0x27454a;return _0x27454a[_0xa3ee('0x74')]({'read':0x0,'readAt':null,'UserId':null});})[_0xa3ee('0x9')](function(){var _0x312ad8={'uniqueid':_0x31d3ca+'.'+_0x4f7ace['id']+'.'+_0x4f7ace[_0xa3ee('0x72')]['id'],'FromUserId':_0x329e32[_0xa3ee('0x30')]['id'],'type':_0xa3ee('0x75')};_0x312ad8[_0x21fd56+_0xa3ee('0x76')]=_0x4f7ace['id'];_0x312ad8[_0x21fd56+_0xa3ee('0x77')]=_0x4f7ace[_0xa3ee('0x72')]['id'];_0x312ad8[_0xa3ee('0x78')+_0x21fd56+_0x26a124+'Id']=_0x4f7ace[_0xa3ee('0x79')]['id'];_0x312ad8['To'+_0x21fd56+_0xa3ee('0x7a')]=_0x25334c['id'];return db[_0x21fd56+_0xa3ee('0x7b')][_0xa3ee('0x7c')](_0x312ad8);})[_0xa3ee('0x9')](function(){return respondWithRpcPromise(_0xa3ee('0x7d'),{'channel':_0x31d3ca,'interaction':_0x4f7ace[_0xa3ee('0x72')],'message':_0x4f7ace,'account':_0x4f7ace[_0xa3ee('0x79')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x25334c[_0xa3ee('0x11')]+','+(_0x4f7ace[_0xa3ee('0x79')][_0xa3ee('0x7e')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})['then'](respondWithResult(_0x37bde3,null))[_0xa3ee('0xd')](handleError(_0x37bde3,null));};};exports[_0xa3ee('0x7f')]=function(_0x591bfa,_0x5b53f1){var _0x24cbc9,_0x157436;if(_[_0xa3ee('0x12')](_0x591bfa[_0xa3ee('0x22')][_0xa3ee('0x80')])){throw new Error(_0xa3ee('0x81'));}var _0x18a74b=_0x591bfa[_0xa3ee('0x22')][_0xa3ee('0x80')];var _0x3e6657=_[_0xa3ee('0x6b')](_0x18a74b);var _0x3236b3=_0x18a74b===_0xa3ee('0x82')?'Website':_0xa3ee('0x79');return db[_0xa3ee('0x83')][_0xa3ee('0x6e')]({'raw':!![],'where':{'id':_0x591bfa[_0xa3ee('0x1d')]['id'],'role':_0xa3ee('0x3c')}})[_0xa3ee('0x9')](function(_0x4cc5e5){if(_['isNil'](_0x4cc5e5)){throw new Error(_0xa3ee('0x84'));}_0x24cbc9=_0x4cc5e5;return db[_0x3e6657+_0xa3ee('0x70')][_0xa3ee('0x6e')]({'where':{'id':_0x591bfa['body'][_0xa3ee('0x71')]},'include':[{'model':db[_0x3e6657+'Interaction'],'as':_0xa3ee('0x72')},{'model':db[_0x3e6657+_0x3236b3],'as':_0xa3ee('0x79')}]});})[_0xa3ee('0x9')](function(_0x10ec99){if(_[_0xa3ee('0x12')](_0x10ec99)){throw new Error(_0x3e6657+_0xa3ee('0x73'));}_0x157436=_0x10ec99;return _0x10ec99[_0xa3ee('0x74')]({'read':0x0,'readAt':null,'UserId':null});})[_0xa3ee('0x9')](function(){var _0x116de1={'uniqueid':_0x18a74b+'.'+_0x157436['id']+'.'+_0x157436[_0xa3ee('0x72')]['id'],'FromUserId':_0x591bfa['user']['id'],'type':'queue','ToUserId':_0x24cbc9['id']};_0x116de1[_0x3e6657+'MessageId']=_0x157436['id'];_0x116de1[_0x3e6657+_0xa3ee('0x77')]=_0x157436['Interaction']['id'];_0x116de1[_0xa3ee('0x78')+_0x3e6657+_0x3236b3+'Id']=_0x157436[_0xa3ee('0x79')]['id'];return db[_0x3e6657+_0xa3ee('0x7b')][_0xa3ee('0x7c')](_0x116de1);})[_0xa3ee('0x9')](function(){return respondWithRpcPromise(_0xa3ee('0x7d'),{'channel':_0x18a74b,'interaction':_0x157436[_0xa3ee('0x72')],'message':_0x157436,'account':_0x157436[_0xa3ee('0x79')],'applications':[{'id':0x0,'priority':0x1,'app':_0xa3ee('0x3c'),'appdata':_0x24cbc9['name']+','+(_0x157436['Account'][_0xa3ee('0x85')]||0x12c),'interval':_0xa3ee('0x86')}]},routingClient);})[_0xa3ee('0x9')](respondWithResult(_0x5b53f1,null))[_0xa3ee('0xd')](handleError(_0x5b53f1,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 6bbb101..da0a570 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 _0x0005=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','index','show','/:id/run','isAuthenticated','run','post','put','delete','destroy','multer','path','connect-timeout'];(function(_0x388769,_0x4e2945){var _0x8c0bc7=function(_0x465e15){while(--_0x465e15){_0x388769['push'](_0x388769['shift']());}};_0x8c0bc7(++_0x4e2945);}(_0x0005,0xbb));var _0x5000=function(_0x38d4ab,_0x24da45){_0x38d4ab=_0x38d4ab-0x0;var _0x6b3747=_0x0005[_0x38d4ab];return _0x6b3747;};'use strict';var multer=require(_0x5000('0x0'));var util=require('util');var path=require(_0x5000('0x1'));var timeout=require(_0x5000('0x2'));var express=require(_0x5000('0x3'));var router=express['Router']();var fs_extra=require(_0x5000('0x4'));var auth=require(_0x5000('0x5'));var interaction=require(_0x5000('0x6'));var config=require(_0x5000('0x7'));var controller=require(_0x5000('0x8'));router[_0x5000('0x9')]('/',auth['isAuthenticated'](),controller[_0x5000('0xa')]);router[_0x5000('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x5000('0xb')]);router[_0x5000('0x9')](_0x5000('0xc'),auth[_0x5000('0xd')](),controller[_0x5000('0xe')]);router[_0x5000('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5000('0x10')]('/:id',auth[_0x5000('0xd')](),controller['update']);router[_0x5000('0x11')]('/:id',auth[_0x5000('0xd')](),controller[_0x5000('0x12')]);module['exports']=router; \ No newline at end of file +var _0x1b16=['isAuthenticated','run','post','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./schedule.controller','get','index','show','/:id/run'];(function(_0x3c176a,_0x23ab4c){var _0x2ea8e5=function(_0x22e0e4){while(--_0x22e0e4){_0x3c176a['push'](_0x3c176a['shift']());}};_0x2ea8e5(++_0x23ab4c);}(_0x1b16,0x1ad));var _0x61b1=function(_0x231632,_0x4f5edc){_0x231632=_0x231632-0x0;var _0x3f614c=_0x1b16[_0x231632];return _0x3f614c;};'use strict';var multer=require(_0x61b1('0x0'));var util=require(_0x61b1('0x1'));var path=require('path');var timeout=require(_0x61b1('0x2'));var express=require(_0x61b1('0x3'));var router=express['Router']();var fs_extra=require(_0x61b1('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x61b1('0x5'));var config=require(_0x61b1('0x6'));var controller=require(_0x61b1('0x7'));router[_0x61b1('0x8')]('/',auth['isAuthenticated'](),controller[_0x61b1('0x9')]);router[_0x61b1('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x61b1('0xa')]);router[_0x61b1('0x8')](_0x61b1('0xb'),auth[_0x61b1('0xc')](),controller[_0x61b1('0xd')]);router[_0x61b1('0xe')]('/',auth[_0x61b1('0xc')](),controller['create']);router[_0x61b1('0xf')](_0x61b1('0x10'),auth[_0x61b1('0xc')](),controller[_0x61b1('0x11')]);router[_0x61b1('0x12')](_0x61b1('0x10'),auth['isAuthenticated'](),controller[_0x61b1('0x13')]);module[_0x61b1('0x14')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 341890a..88f1091 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 _0x4605=['sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','days','csv','pdf','xlsx','custom','default','TEXT'];(function(_0x4beb38,_0x37e0fb){var _0x9fad39=function(_0xe21dba){while(--_0xe21dba){_0x4beb38['push'](_0x4beb38['shift']());}};_0x9fad39(++_0x37e0fb);}(_0x4605,0xc0));var _0x5460=function(_0x29a7ec,_0x4e3a9c){_0x29a7ec=_0x29a7ec-0x0;var _0x38ad00=_0x4605[_0x29a7ec];return _0x38ad00;};'use strict';var Sequelize=require(_0x5460('0x0'));module[_0x5460('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x5460('0x2')]},'active':{'type':Sequelize[_0x5460('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x5460('0x2')],'allowNull':![],'defaultValue':_0x5460('0x4')},'startAt':{'type':Sequelize[_0x5460('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0x5460('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x5460('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x5460('0x7')](_0x5460('0x8'),'quarters','months','weeks','days','hours','minutes'),'allowNull':![],'defaultValue':_0x5460('0x9')},'output':{'type':Sequelize[_0x5460('0x7')](_0x5460('0xa'),_0x5460('0xb'),_0x5460('0xc')),'allowNull':![],'defaultValue':_0x5460('0xa')},'type':{'type':Sequelize[_0x5460('0x7')](_0x5460('0xd'),_0x5460('0xe')),'allowNull':![],'defaultValue':_0x5460('0xd')},'sendMail':{'type':Sequelize[_0x5460('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x5460('0x2')]},'cc':{'type':Sequelize[_0x5460('0xf')]},'bcc':{'type':Sequelize[_0x5460('0xf')]},'sendIfEmpty':{'type':Sequelize[_0x5460('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xbdd1=['pdf','xlsx','custom','default','TEXT','sequelize','exports','STRING','0\x200\x20*\x20*\x20*','DATE','INTEGER','quarters','months','weeks','days','hours','minutes','ENUM','csv'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0xbdd1,0xe9));var _0x1bdd=function(_0x4f0fd2,_0x457369){_0x4f0fd2=_0x4f0fd2-0x0;var _0x5921d3=_0xbdd1[_0x4f0fd2];return _0x5921d3;};'use strict';var Sequelize=require(_0x1bdd('0x0'));module[_0x1bdd('0x1')]={'name':{'type':Sequelize[_0x1bdd('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x1bdd('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x1bdd('0x2')],'allowNull':![],'defaultValue':_0x1bdd('0x3')},'startAt':{'type':Sequelize[_0x1bdd('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x1bdd('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x1bdd('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM']('years',_0x1bdd('0x6'),_0x1bdd('0x7'),_0x1bdd('0x8'),_0x1bdd('0x9'),_0x1bdd('0xa'),_0x1bdd('0xb')),'allowNull':![],'defaultValue':_0x1bdd('0x9')},'output':{'type':Sequelize[_0x1bdd('0xc')](_0x1bdd('0xd'),_0x1bdd('0xe'),_0x1bdd('0xf')),'allowNull':![],'defaultValue':_0x1bdd('0xd')},'type':{'type':Sequelize['ENUM'](_0x1bdd('0x10'),_0x1bdd('0x11')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x1bdd('0x2')]},'cc':{'type':Sequelize[_0x1bdd('0x12')]},'bcc':{'type':Sequelize[_0x1bdd('0x12')]},'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 6d98cbd..4619f9a 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 _0x1fcf=['count','set','Content-Range','apply','reject','save','update','destroy','Scheduler','UserProfileResource','then','stack','name','send','index','Schedule','rawAttributes','fieldName','key','query','filters','attributes','intersection','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','sendStatus','end','status','json','offset','undefined','limit'];(function(_0x47d457,_0x14a1c2){var _0x4c1009=function(_0xa984df){while(--_0xa984df){_0x47d457['push'](_0x47d457['shift']());}};_0x4c1009(++_0x14a1c2);}(_0x1fcf,0xec));var _0xf1fc=function(_0x292ecc,_0x2ed340){_0x292ecc=_0x292ecc-0x0;var _0x59aabc=_0x1fcf[_0x292ecc];return _0x59aabc;};'use strict';var emlformat=require(_0xf1fc('0x0'));var rimraf=require(_0xf1fc('0x1'));var zipdir=require(_0xf1fc('0x2'));var jsonpatch=require(_0xf1fc('0x3'));var rp=require(_0xf1fc('0x4'));var moment=require('moment');var BPromise=require(_0xf1fc('0x5'));var Mustache=require(_0xf1fc('0x6'));var util=require(_0xf1fc('0x7'));var path=require('path');var sox=require(_0xf1fc('0x8'));var csv=require(_0xf1fc('0x9'));var ejs=require(_0xf1fc('0xa'));var fs=require('fs');var fs_extra=require(_0xf1fc('0xb'));var _=require(_0xf1fc('0xc'));var squel=require(_0xf1fc('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf1fc('0xe'));var toCsv=require(_0xf1fc('0x9'));var querystring=require(_0xf1fc('0xf'));var Papa=require(_0xf1fc('0x10'));var Redis=require(_0xf1fc('0x11'));var authService=require(_0xf1fc('0x12'));var qs=require(_0xf1fc('0x13'));var as=require(_0xf1fc('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf1fc('0x15'))(_0xf1fc('0x16'));var utils=require('../../config/utils');var config=require(_0xf1fc('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c3424,_0x5e9628){_0x5e9628=_0x5e9628||0xcc;return function(_0xc6b558){if(_0xc6b558){return _0x5c3424[_0xf1fc('0x18')](_0x5e9628);}return _0x5c3424['status'](_0x5e9628)[_0xf1fc('0x19')]();};}function respondWithResult(_0x56084d,_0x4057da){_0x4057da=_0x4057da||0xc8;return function(_0x4b03fa){if(_0x4b03fa){return _0x56084d[_0xf1fc('0x1a')](_0x4057da)[_0xf1fc('0x1b')](_0x4b03fa);}};}function respondWithFilteredResult(_0x45f6b1,_0x4f7026){return function(_0xbe2702){if(_0xbe2702){var _0x179c20=typeof _0x4f7026[_0xf1fc('0x1c')]===_0xf1fc('0x1d')&&typeof _0x4f7026[_0xf1fc('0x1e')]===_0xf1fc('0x1d');var _0x346a12=_0xbe2702[_0xf1fc('0x1f')];var _0x4f26de=_0x179c20?0x0:_0x4f7026[_0xf1fc('0x1c')];var _0x2f351a=_0x179c20?_0xbe2702['count']:_0x4f7026['offset']+_0x4f7026[_0xf1fc('0x1e')];var _0x1c318f;if(_0x2f351a>=_0x346a12){_0x2f351a=_0x346a12;_0x1c318f=0xc8;}else{_0x1c318f=0xce;}_0x45f6b1[_0xf1fc('0x1a')](_0x1c318f);return _0x45f6b1[_0xf1fc('0x20')](_0xf1fc('0x21'),_0x4f26de+'-'+_0x2f351a+'/'+_0x346a12)['json'](_0xbe2702);}return null;};}function patchUpdates(_0x46f92e){return function(_0x337eee){try{jsonpatch[_0xf1fc('0x22')](_0x337eee,_0x46f92e,!![]);}catch(_0x962cbf){return BPromise[_0xf1fc('0x23')](_0x962cbf);}return _0x337eee[_0xf1fc('0x24')]();};}function saveUpdates(_0x4c0f39,_0x3dc12b){return function(_0xc18fa7){if(_0xc18fa7){return _0xc18fa7[_0xf1fc('0x25')](_0x4c0f39)['then'](function(_0x3d8da4){return _0x3d8da4;});}return null;};}function removeEntity(_0x423256,_0x295a82){return function(_0xd5e485){if(_0xd5e485){return _0xd5e485[_0xf1fc('0x26')]()['then'](function(){var _0x24605a=_0xd5e485['get']({'plain':!![]});var _0x57154b=_0xf1fc('0x27');return db[_0xf1fc('0x28')]['destroy']({'where':{'type':_0x57154b,'resourceId':_0x24605a['id']}})[_0xf1fc('0x29')](function(){return _0xd5e485;});})[_0xf1fc('0x29')](function(){_0x423256['status'](0xcc)[_0xf1fc('0x19')]();});}};}function handleEntityNotFound(_0x5c2abc,_0x35cf88){return function(_0x31b96d){if(!_0x31b96d){_0x5c2abc['sendStatus'](0x194);}return _0x31b96d;};}function handleError(_0x5f36e0,_0x49fcec){_0x49fcec=_0x49fcec||0x1f4;return function(_0x40ca85){logger['error'](_0x40ca85[_0xf1fc('0x2a')]);if(_0x40ca85[_0xf1fc('0x2b')]){delete _0x40ca85['name'];}_0x5f36e0[_0xf1fc('0x1a')](_0x49fcec)[_0xf1fc('0x2c')](_0x40ca85);};}exports[_0xf1fc('0x2d')]=function(_0x44c8f0,_0x51f0ad){var _0x2849de={},_0x27eaeb={},_0x55e6f6={'count':0x0,'rows':[]};var _0x79088d=_['map'](db[_0xf1fc('0x2e')][_0xf1fc('0x2f')],function(_0x464137){return{'name':_0x464137[_0xf1fc('0x30')],'type':_0x464137['type'][_0xf1fc('0x31')]};});_0x27eaeb['model']=_['map'](_0x79088d,_0xf1fc('0x2b'));_0x27eaeb[_0xf1fc('0x32')]=_['keys'](_0x44c8f0[_0xf1fc('0x32')]);_0x27eaeb[_0xf1fc('0x33')]=_['intersection'](_0x27eaeb['model'],_0x27eaeb['query']);_0x2849de[_0xf1fc('0x34')]=_[_0xf1fc('0x35')](_0x27eaeb['model'],qs[_0xf1fc('0x36')](_0x44c8f0[_0xf1fc('0x32')][_0xf1fc('0x36')]));_0x2849de[_0xf1fc('0x34')]=_0x2849de[_0xf1fc('0x34')][_0xf1fc('0x37')]?_0x2849de[_0xf1fc('0x34')]:_0x27eaeb[_0xf1fc('0x38')];if(!_0x44c8f0[_0xf1fc('0x32')][_0xf1fc('0x39')](_0xf1fc('0x3a'))){_0x2849de[_0xf1fc('0x1e')]=qs[_0xf1fc('0x1e')](_0x44c8f0['query'][_0xf1fc('0x1e')]);_0x2849de[_0xf1fc('0x1c')]=qs['offset'](_0x44c8f0[_0xf1fc('0x32')][_0xf1fc('0x1c')]);}_0x2849de[_0xf1fc('0x3b')]=qs['sort'](_0x44c8f0[_0xf1fc('0x32')][_0xf1fc('0x3c')]);_0x2849de[_0xf1fc('0x3d')]=qs['filters'](_[_0xf1fc('0x3e')](_0x44c8f0[_0xf1fc('0x32')],_0x27eaeb['filters']),_0x79088d);if(_0x44c8f0[_0xf1fc('0x32')][_0xf1fc('0x3f')]){_0x2849de['where']=_[_0xf1fc('0x40')](_0x2849de[_0xf1fc('0x3d')],{'$or':_[_0xf1fc('0x41')](_0x79088d,function(_0x9fddb7){if(_0x9fddb7[_0xf1fc('0x42')]!==_0xf1fc('0x43')){var _0x411419={};_0x411419[_0x9fddb7[_0xf1fc('0x2b')]]={'$like':'%'+_0x44c8f0[_0xf1fc('0x32')]['filter']+'%'};return _0x411419;}})});}_0x2849de=_['merge']({},_0x2849de,_0x44c8f0[_0xf1fc('0x44')]);var _0x2d2d07={'where':_0x2849de['where']};return db[_0xf1fc('0x2e')]['count'](_0x2d2d07)['then'](function(_0x4ae237){_0x55e6f6['count']=_0x4ae237;if(_0x44c8f0[_0xf1fc('0x32')][_0xf1fc('0x45')]){_0x2849de[_0xf1fc('0x46')]=[{'all':!![]}];}return db[_0xf1fc('0x2e')][_0xf1fc('0x47')](_0x2849de);})[_0xf1fc('0x29')](function(_0x4637d9){_0x55e6f6[_0xf1fc('0x48')]=_0x4637d9;return _0x55e6f6;})[_0xf1fc('0x29')](respondWithFilteredResult(_0x51f0ad,_0x2849de))[_0xf1fc('0x49')](handleError(_0x51f0ad,null));};exports[_0xf1fc('0x4a')]=function(_0x7e2c53,_0x8a6c53){var _0x52fab8={'raw':![],'where':{'id':_0x7e2c53[_0xf1fc('0x4b')]['id']}},_0x2f5e54={};_0x2f5e54[_0xf1fc('0x38')]=_[_0xf1fc('0x4c')](db[_0xf1fc('0x2e')][_0xf1fc('0x2f')]);_0x2f5e54[_0xf1fc('0x32')]=_['keys'](_0x7e2c53[_0xf1fc('0x32')]);_0x2f5e54[_0xf1fc('0x33')]=_[_0xf1fc('0x35')](_0x2f5e54[_0xf1fc('0x38')],_0x2f5e54[_0xf1fc('0x32')]);_0x52fab8[_0xf1fc('0x34')]=_[_0xf1fc('0x35')](_0x2f5e54[_0xf1fc('0x38')],qs[_0xf1fc('0x36')](_0x7e2c53[_0xf1fc('0x32')]['fields']));_0x52fab8[_0xf1fc('0x34')]=_0x52fab8[_0xf1fc('0x34')][_0xf1fc('0x37')]?_0x52fab8[_0xf1fc('0x34')]:_0x2f5e54[_0xf1fc('0x38')];if(_0x7e2c53[_0xf1fc('0x32')][_0xf1fc('0x45')]){_0x52fab8[_0xf1fc('0x46')]=[{'all':!![]}];}_0x52fab8=_['merge']({},_0x52fab8,_0x7e2c53[_0xf1fc('0x44')]);return db['Schedule'][_0xf1fc('0x4d')](_0x52fab8)[_0xf1fc('0x29')](handleEntityNotFound(_0x8a6c53,null))[_0xf1fc('0x29')](respondWithResult(_0x8a6c53,null))[_0xf1fc('0x49')](handleError(_0x8a6c53,null));};exports[_0xf1fc('0x4e')]=function(_0x3c06da,_0x4c8ef5){return db['Schedule'][_0xf1fc('0x4e')](_0x3c06da[_0xf1fc('0x4f')],{})['then'](function(_0xa6b1dc){var _0x439748=_0x3c06da['user'][_0xf1fc('0x50')]({'plain':!![]});if(!_0x439748)throw new Error(_0xf1fc('0x51'));if(_0x439748[_0xf1fc('0x52')]===_0xf1fc('0x53')){var _0x25304a=_0xa6b1dc[_0xf1fc('0x50')]({'plain':!![]});var _0x49d1b2='Scheduler';return db[_0xf1fc('0x54')][_0xf1fc('0x4d')]({'where':{'name':_0x49d1b2,'userProfileId':_0x439748['userProfileId']},'raw':!![]})['then'](function(_0xfb600d){if(_0xfb600d&&_0xfb600d[_0xf1fc('0x55')]===0x0){return db[_0xf1fc('0x28')][_0xf1fc('0x4e')]({'name':_0x25304a[_0xf1fc('0x2b')],'resourceId':_0x25304a['id'],'type':_0xfb600d['name'],'sectionId':_0xfb600d['id']},{})['then'](function(){return _0xa6b1dc;});}else{return _0xa6b1dc;}})[_0xf1fc('0x49')](function(_0x3bc416){logger['error'](_0xf1fc('0x56'),_0x3bc416);throw _0x3bc416;});}return _0xa6b1dc;})[_0xf1fc('0x29')](respondWithResult(_0x4c8ef5,0xc9))['catch'](handleError(_0x4c8ef5,null));};exports['update']=function(_0x922fad,_0x57c1cb){if(_0x922fad[_0xf1fc('0x4f')]['id']){delete _0x922fad[_0xf1fc('0x4f')]['id'];}return db[_0xf1fc('0x2e')][_0xf1fc('0x4d')]({'where':{'id':_0x922fad['params']['id']}})['then'](handleEntityNotFound(_0x57c1cb,null))['then'](saveUpdates(_0x922fad['body'],null))[_0xf1fc('0x29')](respondWithResult(_0x57c1cb,null))[_0xf1fc('0x49')](handleError(_0x57c1cb,null));};exports['destroy']=function(_0x1c4135,_0x44077d){return db[_0xf1fc('0x2e')][_0xf1fc('0x4d')]({'where':{'id':_0x1c4135[_0xf1fc('0x4b')]['id']}})[_0xf1fc('0x29')](handleEntityNotFound(_0x44077d,null))['then'](removeEntity(_0x44077d,null))[_0xf1fc('0x49')](handleError(_0x44077d,null));};exports[_0xf1fc('0x57')]=function(_0x328c7b,_0x1939b3,_0x2772d6){var _0x336d13=require(_0xf1fc('0x58'));return db[_0xf1fc('0x2e')][_0xf1fc('0x4d')]({'where':{'id':_0x328c7b[_0xf1fc('0x4b')]['id']},'raw':!![]})[_0xf1fc('0x29')](handleEntityNotFound(_0x1939b3,null))[_0xf1fc('0x29')](function(){_0x336d13[_0xf1fc('0x57')](_0x328c7b[_0xf1fc('0x4b')]['id']);})[_0xf1fc('0x29')](respondWithStatusCode(_0x1939b3,null))[_0xf1fc('0x49')](handleError(_0x1939b3,null));}; \ No newline at end of file +var _0xe2ee=['merge','VIRTUAL','options','Schedule','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','body','run','../../config/schedule','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../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','reject','save','update','then','get','Scheduler','UserProfileResource','error','name','send','index','map','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter'];(function(_0x317c9b,_0x3043fb){var _0x662c9c=function(_0x34b6bf){while(--_0x34b6bf){_0x317c9b['push'](_0x317c9b['shift']());}};_0x662c9c(++_0x3043fb);}(_0xe2ee,0x72));var _0xee2e=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xe2ee[_0x1694f5];return _0x5b4321;};'use strict';var emlformat=require(_0xee2e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xee2e('0x1'));var jsonpatch=require(_0xee2e('0x2'));var rp=require(_0xee2e('0x3'));var moment=require(_0xee2e('0x4'));var BPromise=require(_0xee2e('0x5'));var Mustache=require(_0xee2e('0x6'));var util=require(_0xee2e('0x7'));var path=require(_0xee2e('0x8'));var sox=require(_0xee2e('0x9'));var csv=require(_0xee2e('0xa'));var ejs=require(_0xee2e('0xb'));var fs=require('fs');var fs_extra=require(_0xee2e('0xc'));var _=require(_0xee2e('0xd'));var squel=require(_0xee2e('0xe'));var crypto=require(_0xee2e('0xf'));var jsforce=require(_0xee2e('0x10'));var deskjs=require(_0xee2e('0x11'));var toCsv=require(_0xee2e('0xa'));var querystring=require(_0xee2e('0x12'));var Papa=require(_0xee2e('0x13'));var Redis=require(_0xee2e('0x14'));var authService=require(_0xee2e('0x15'));var qs=require(_0xee2e('0x16'));var as=require(_0xee2e('0x17'));var hardwareService=require(_0xee2e('0x18'));var logger=require(_0xee2e('0x19'))(_0xee2e('0x1a'));var utils=require(_0xee2e('0x1b'));var config=require('../../config/environment');var licenseUtil=require(_0xee2e('0x1c'));var db=require(_0xee2e('0x1d'))['db'];function respondWithStatusCode(_0x2635bf,_0x349456){_0x349456=_0x349456||0xcc;return function(_0x28dadf){if(_0x28dadf){return _0x2635bf[_0xee2e('0x1e')](_0x349456);}return _0x2635bf[_0xee2e('0x1f')](_0x349456)['end']();};}function respondWithResult(_0x24969b,_0x22bf49){_0x22bf49=_0x22bf49||0xc8;return function(_0x37c142){if(_0x37c142){return _0x24969b['status'](_0x22bf49)['json'](_0x37c142);}};}function respondWithFilteredResult(_0x5ca1e8,_0x3052d7){return function(_0x203ff9){if(_0x203ff9){var _0x33d60f=typeof _0x3052d7[_0xee2e('0x20')]===_0xee2e('0x21')&&typeof _0x3052d7[_0xee2e('0x22')]==='undefined';var _0xc0aedb=_0x203ff9[_0xee2e('0x23')];var _0x3c1e1b=_0x33d60f?0x0:_0x3052d7[_0xee2e('0x20')];var _0x3dbec0=_0x33d60f?_0x203ff9['count']:_0x3052d7[_0xee2e('0x20')]+_0x3052d7[_0xee2e('0x22')];var _0x1f478f;if(_0x3dbec0>=_0xc0aedb){_0x3dbec0=_0xc0aedb;_0x1f478f=0xc8;}else{_0x1f478f=0xce;}_0x5ca1e8[_0xee2e('0x1f')](_0x1f478f);return _0x5ca1e8[_0xee2e('0x24')](_0xee2e('0x25'),_0x3c1e1b+'-'+_0x3dbec0+'/'+_0xc0aedb)[_0xee2e('0x26')](_0x203ff9);}return null;};}function patchUpdates(_0x507f7e){return function(_0x186e51){try{jsonpatch[_0xee2e('0x27')](_0x186e51,_0x507f7e,!![]);}catch(_0xf506f){return BPromise[_0xee2e('0x28')](_0xf506f);}return _0x186e51[_0xee2e('0x29')]();};}function saveUpdates(_0x413a51,_0xa9fffc){return function(_0x33a4c3){if(_0x33a4c3){return _0x33a4c3[_0xee2e('0x2a')](_0x413a51)[_0xee2e('0x2b')](function(_0x55f3a1){return _0x55f3a1;});}return null;};}function removeEntity(_0x4f607d,_0xd7e66e){return function(_0x4fbf16){if(_0x4fbf16){return _0x4fbf16['destroy']()[_0xee2e('0x2b')](function(){var _0x2e2d2b=_0x4fbf16[_0xee2e('0x2c')]({'plain':!![]});var _0x2a99ff=_0xee2e('0x2d');return db[_0xee2e('0x2e')]['destroy']({'where':{'type':_0x2a99ff,'resourceId':_0x2e2d2b['id']}})[_0xee2e('0x2b')](function(){return _0x4fbf16;});})[_0xee2e('0x2b')](function(){_0x4f607d[_0xee2e('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30ce34,_0x1217e9){return function(_0x302d08){if(!_0x302d08){_0x30ce34['sendStatus'](0x194);}return _0x302d08;};}function handleError(_0x199b4a,_0x146ff6){_0x146ff6=_0x146ff6||0x1f4;return function(_0x5b2ed4){logger[_0xee2e('0x2f')](_0x5b2ed4['stack']);if(_0x5b2ed4['name']){delete _0x5b2ed4[_0xee2e('0x30')];}_0x199b4a[_0xee2e('0x1f')](_0x146ff6)[_0xee2e('0x31')](_0x5b2ed4);};}exports[_0xee2e('0x32')]=function(_0x2d31a7,_0x5215dd){var _0x333d75={},_0x1c08ef={},_0x35c504={'count':0x0,'rows':[]};var _0x223bc8=_[_0xee2e('0x33')](db['Schedule']['rawAttributes'],function(_0x583b94){return{'name':_0x583b94[_0xee2e('0x34')],'type':_0x583b94[_0xee2e('0x35')][_0xee2e('0x36')]};});_0x1c08ef['model']=_['map'](_0x223bc8,_0xee2e('0x30'));_0x1c08ef[_0xee2e('0x37')]=_[_0xee2e('0x38')](_0x2d31a7['query']);_0x1c08ef['filters']=_[_0xee2e('0x39')](_0x1c08ef[_0xee2e('0x3a')],_0x1c08ef[_0xee2e('0x37')]);_0x333d75[_0xee2e('0x3b')]=_[_0xee2e('0x39')](_0x1c08ef[_0xee2e('0x3a')],qs[_0xee2e('0x3c')](_0x2d31a7[_0xee2e('0x37')][_0xee2e('0x3c')]));_0x333d75[_0xee2e('0x3b')]=_0x333d75[_0xee2e('0x3b')][_0xee2e('0x3d')]?_0x333d75[_0xee2e('0x3b')]:_0x1c08ef['model'];if(!_0x2d31a7[_0xee2e('0x37')][_0xee2e('0x3e')](_0xee2e('0x3f'))){_0x333d75['limit']=qs[_0xee2e('0x22')](_0x2d31a7[_0xee2e('0x37')]['limit']);_0x333d75[_0xee2e('0x20')]=qs[_0xee2e('0x20')](_0x2d31a7[_0xee2e('0x37')][_0xee2e('0x20')]);}_0x333d75[_0xee2e('0x40')]=qs[_0xee2e('0x41')](_0x2d31a7[_0xee2e('0x37')][_0xee2e('0x41')]);_0x333d75[_0xee2e('0x42')]=qs[_0xee2e('0x43')](_[_0xee2e('0x44')](_0x2d31a7[_0xee2e('0x37')],_0x1c08ef[_0xee2e('0x43')]),_0x223bc8);if(_0x2d31a7[_0xee2e('0x37')][_0xee2e('0x45')]){_0x333d75[_0xee2e('0x42')]=_[_0xee2e('0x46')](_0x333d75[_0xee2e('0x42')],{'$or':_[_0xee2e('0x33')](_0x223bc8,function(_0x41483b){if(_0x41483b[_0xee2e('0x35')]!==_0xee2e('0x47')){var _0x170a63={};_0x170a63[_0x41483b['name']]={'$like':'%'+_0x2d31a7[_0xee2e('0x37')]['filter']+'%'};return _0x170a63;}})});}_0x333d75=_[_0xee2e('0x46')]({},_0x333d75,_0x2d31a7[_0xee2e('0x48')]);var _0x4bf6f3={'where':_0x333d75[_0xee2e('0x42')]};return db[_0xee2e('0x49')][_0xee2e('0x23')](_0x4bf6f3)[_0xee2e('0x2b')](function(_0x53eccc){_0x35c504['count']=_0x53eccc;if(_0x2d31a7[_0xee2e('0x37')][_0xee2e('0x4a')]){_0x333d75[_0xee2e('0x4b')]=[{'all':!![]}];}return db[_0xee2e('0x49')][_0xee2e('0x4c')](_0x333d75);})[_0xee2e('0x2b')](function(_0x32fddf){_0x35c504[_0xee2e('0x4d')]=_0x32fddf;return _0x35c504;})[_0xee2e('0x2b')](respondWithFilteredResult(_0x5215dd,_0x333d75))[_0xee2e('0x4e')](handleError(_0x5215dd,null));};exports[_0xee2e('0x4f')]=function(_0x159681,_0x414dca){var _0x2ec967={'raw':![],'where':{'id':_0x159681[_0xee2e('0x50')]['id']}},_0x978875={};_0x978875[_0xee2e('0x3a')]=_[_0xee2e('0x38')](db[_0xee2e('0x49')][_0xee2e('0x51')]);_0x978875[_0xee2e('0x37')]=_[_0xee2e('0x38')](_0x159681[_0xee2e('0x37')]);_0x978875[_0xee2e('0x43')]=_[_0xee2e('0x39')](_0x978875['model'],_0x978875[_0xee2e('0x37')]);_0x2ec967[_0xee2e('0x3b')]=_[_0xee2e('0x39')](_0x978875[_0xee2e('0x3a')],qs[_0xee2e('0x3c')](_0x159681[_0xee2e('0x37')][_0xee2e('0x3c')]));_0x2ec967[_0xee2e('0x3b')]=_0x2ec967[_0xee2e('0x3b')][_0xee2e('0x3d')]?_0x2ec967[_0xee2e('0x3b')]:_0x978875[_0xee2e('0x3a')];if(_0x159681['query'][_0xee2e('0x4a')]){_0x2ec967['include']=[{'all':!![]}];}_0x2ec967=_[_0xee2e('0x46')]({},_0x2ec967,_0x159681[_0xee2e('0x48')]);return db['Schedule'][_0xee2e('0x52')](_0x2ec967)[_0xee2e('0x2b')](handleEntityNotFound(_0x414dca,null))[_0xee2e('0x2b')](respondWithResult(_0x414dca,null))[_0xee2e('0x4e')](handleError(_0x414dca,null));};exports[_0xee2e('0x53')]=function(_0x54236c,_0x1dd6b2){return db['Schedule']['create'](_0x54236c['body'],{})[_0xee2e('0x2b')](function(_0x38c01c){var _0x1c4406=_0x54236c['user'][_0xee2e('0x2c')]({'plain':!![]});if(!_0x1c4406)throw new Error(_0xee2e('0x54'));if(_0x1c4406['role']===_0xee2e('0x55')){var _0x33984=_0x38c01c['get']({'plain':!![]});var _0x195f8c=_0xee2e('0x2d');return db[_0xee2e('0x56')]['find']({'where':{'name':_0x195f8c,'userProfileId':_0x1c4406[_0xee2e('0x57')]},'raw':!![]})[_0xee2e('0x2b')](function(_0x24ea36){if(_0x24ea36&&_0x24ea36[_0xee2e('0x58')]===0x0){return db[_0xee2e('0x2e')][_0xee2e('0x53')]({'name':_0x33984[_0xee2e('0x30')],'resourceId':_0x33984['id'],'type':_0x24ea36[_0xee2e('0x30')],'sectionId':_0x24ea36['id']},{})[_0xee2e('0x2b')](function(){return _0x38c01c;});}else{return _0x38c01c;}})[_0xee2e('0x4e')](function(_0x1ea45a){logger[_0xee2e('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1ea45a);throw _0x1ea45a;});}return _0x38c01c;})['then'](respondWithResult(_0x1dd6b2,0xc9))[_0xee2e('0x4e')](handleError(_0x1dd6b2,null));};exports[_0xee2e('0x2a')]=function(_0x179210,_0x17b15){if(_0x179210[_0xee2e('0x59')]['id']){delete _0x179210[_0xee2e('0x59')]['id'];}return db['Schedule'][_0xee2e('0x52')]({'where':{'id':_0x179210['params']['id']}})[_0xee2e('0x2b')](handleEntityNotFound(_0x17b15,null))[_0xee2e('0x2b')](saveUpdates(_0x179210[_0xee2e('0x59')],null))[_0xee2e('0x2b')](respondWithResult(_0x17b15,null))[_0xee2e('0x4e')](handleError(_0x17b15,null));};exports['destroy']=function(_0x196342,_0x36221b){return db[_0xee2e('0x49')][_0xee2e('0x52')]({'where':{'id':_0x196342[_0xee2e('0x50')]['id']}})[_0xee2e('0x2b')](handleEntityNotFound(_0x36221b,null))[_0xee2e('0x2b')](removeEntity(_0x36221b,null))[_0xee2e('0x4e')](handleError(_0x36221b,null));};exports[_0xee2e('0x5a')]=function(_0x2095d4,_0x5e209,_0x76c5ae){var _0x3ca159=require(_0xee2e('0x5b'));return db[_0xee2e('0x49')][_0xee2e('0x52')]({'where':{'id':_0x2095d4[_0xee2e('0x50')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x5e209,null))[_0xee2e('0x2b')](function(){_0x3ca159[_0xee2e('0x5a')](_0x2095d4['params']['id']);})[_0xee2e('0x2b')](respondWithStatusCode(_0x5e209,null))[_0xee2e('0x4e')](handleError(_0x5e209,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 20e9364..6fb645c 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 _0x0f29=['exports','Schedule','tools_schedules','lodash','../../config/logger','api','moment','request-promise','rimraf','./schedule.attributes'];(function(_0x48ccc4,_0x4045e4){var _0x49d8bd=function(_0x25fc2b){while(--_0x25fc2b){_0x48ccc4['push'](_0x48ccc4['shift']());}};_0x49d8bd(++_0x4045e4);}(_0x0f29,0x1a7));var _0x90f2=function(_0xdf31cd,_0xa5d965){_0xdf31cd=_0xdf31cd-0x0;var _0x5f07f9=_0x0f29[_0xdf31cd];return _0x5f07f9;};'use strict';var _=require(_0x90f2('0x0'));var util=require('util');var logger=require(_0x90f2('0x1'))(_0x90f2('0x2'));var moment=require(_0x90f2('0x3'));var BPromise=require('bluebird');var rp=require(_0x90f2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x90f2('0x5'));var config=require('../../config/environment');var attributes=require(_0x90f2('0x6'));module[_0x90f2('0x7')]=function(_0x14a1db,_0x3e3475){return _0x14a1db['define'](_0x90f2('0x8'),attributes,{'tableName':_0x90f2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5ee4=['lodash','util','api','moment','request-promise','path','../../config/environment','./schedule.attributes','exports','define'];(function(_0x525b28,_0x5cf5a0){var _0x180178=function(_0x43e066){while(--_0x43e066){_0x525b28['push'](_0x525b28['shift']());}};_0x180178(++_0x5cf5a0);}(_0x5ee4,0xf0));var _0x45ee=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x5ee4[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0x45ee('0x0'));var util=require(_0x45ee('0x1'));var logger=require('../../config/logger')(_0x45ee('0x2'));var moment=require(_0x45ee('0x3'));var BPromise=require('bluebird');var rp=require(_0x45ee('0x4'));var fs=require('fs');var path=require(_0x45ee('0x5'));var rimraf=require('rimraf');var config=require(_0x45ee('0x6'));var attributes=require(_0x45ee('0x7'));module[_0x45ee('0x8')]=function(_0x480886,_0x19fdc2){return _0x480886[_0x45ee('0x9')]('Schedule',attributes,{'tableName':'tools_schedules','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 a84cbfc..ec21cae 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 _0x4a48=['result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0xca5fbd,_0x479c8e){var _0x5ee881=function(_0x18d288){while(--_0x18d288){_0xca5fbd['push'](_0xca5fbd['shift']());}};_0x5ee881(++_0x479c8e);}(_0x4a48,0x16a));var _0x84a4=function(_0x25f242,_0x3c8800){_0x25f242=_0x25f242-0x0;var _0x1aa0fa=_0x4a48[_0x25f242];return _0x1aa0fa;};'use strict';var _=require(_0x84a4('0x0'));var util=require(_0x84a4('0x1'));var moment=require(_0x84a4('0x2'));var BPromise=require('bluebird');var rs=require(_0x84a4('0x3'));var fs=require('fs');var Redis=require(_0x84a4('0x4'));var db=require(_0x84a4('0x5'))['db'];var utils=require(_0x84a4('0x6'));var logger=require('../../config/logger')(_0x84a4('0x7'));var config=require(_0x84a4('0x8'));var jayson=require(_0x84a4('0x9'));var client=jayson[_0x84a4('0xa')][_0x84a4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2617f3,_0x17506f,_0x2e15f3){return new BPromise(function(_0x132bcf,_0x4bb774){return client[_0x84a4('0xc')](_0x2617f3,_0x2e15f3)['then'](function(_0x251f90){logger[_0x84a4('0xd')](_0x84a4('0xe'),_0x17506f,_0x84a4('0xf'));logger[_0x84a4('0x10')](_0x84a4('0x11'),_0x17506f,'request\x20sent',JSON[_0x84a4('0x12')](_0x251f90));if(_0x251f90[_0x84a4('0x13')]){if(_0x251f90[_0x84a4('0x13')][_0x84a4('0x14')]===0x1f4){logger['error'](_0x84a4('0xe'),_0x17506f,_0x251f90[_0x84a4('0x13')][_0x84a4('0x15')]);return _0x4bb774(_0x251f90[_0x84a4('0x13')][_0x84a4('0x15')]);}logger[_0x84a4('0x13')](_0x84a4('0xe'),_0x17506f,_0x251f90[_0x84a4('0x13')][_0x84a4('0x15')]);return _0x132bcf(_0x251f90['error'][_0x84a4('0x15')]);}else{logger['info']('Schedule,\x20%s,\x20%s',_0x17506f,_0x84a4('0xf'));_0x132bcf(_0x251f90[_0x84a4('0x16')]['message']);}})[_0x84a4('0x17')](function(_0xd281c7){logger['error'](_0x84a4('0xe'),_0x17506f,_0xd281c7);_0x4bb774(_0xd281c7);});});} \ No newline at end of file +var _0xe3ff=['stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s'];(function(_0x4fa489,_0x4cba6b){var _0x41d2ce=function(_0x364060){while(--_0x364060){_0x4fa489['push'](_0x4fa489['shift']());}};_0x41d2ce(++_0x4cba6b);}(_0xe3ff,0x1d3));var _0xfe3f=function(_0x4afc72,_0x321e63){_0x4afc72=_0x4afc72-0x0;var _0x4dcbab=_0xe3ff[_0x4afc72];return _0x4dcbab;};'use strict';var _=require(_0xfe3f('0x0'));var util=require(_0xfe3f('0x1'));var moment=require(_0xfe3f('0x2'));var BPromise=require('bluebird');var rs=require(_0xfe3f('0x3'));var fs=require('fs');var Redis=require(_0xfe3f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfe3f('0x5'))(_0xfe3f('0x6'));var config=require(_0xfe3f('0x7'));var jayson=require(_0xfe3f('0x8'));var client=jayson['client'][_0xfe3f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x51c324,_0x39383c,_0x5c89ce){return new BPromise(function(_0x2ce958,_0x4bb063){return client[_0xfe3f('0xa')](_0x51c324,_0x5c89ce)[_0xfe3f('0xb')](function(_0x55be24){logger['info'](_0xfe3f('0xc'),_0x39383c,_0xfe3f('0xd'));logger[_0xfe3f('0xe')](_0xfe3f('0xf'),_0x39383c,_0xfe3f('0xd'),JSON[_0xfe3f('0x10')](_0x55be24));if(_0x55be24['error']){if(_0x55be24[_0xfe3f('0x11')][_0xfe3f('0x12')]===0x1f4){logger['error'](_0xfe3f('0xc'),_0x39383c,_0x55be24[_0xfe3f('0x11')][_0xfe3f('0x13')]);return _0x4bb063(_0x55be24[_0xfe3f('0x11')]['message']);}logger[_0xfe3f('0x11')](_0xfe3f('0xc'),_0x39383c,_0x55be24[_0xfe3f('0x11')][_0xfe3f('0x13')]);return _0x2ce958(_0x55be24[_0xfe3f('0x11')][_0xfe3f('0x13')]);}else{logger[_0xfe3f('0x14')](_0xfe3f('0xc'),_0x39383c,_0xfe3f('0xd'));_0x2ce958(_0x55be24[_0xfe3f('0x15')]['message']);}})[_0xfe3f('0x16')](function(_0x25ede3){logger[_0xfe3f('0x11')](_0xfe3f('0xc'),_0x39383c,_0x25ede3);_0x4bb063(_0x25ede3);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index de43531..d3474e1 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 _0x595e=['./screenRecording.controller','get','isAuthenticated','index','/:id','/:id/download','download','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x37bbcd,_0x3b7eef){var _0xa3ce51=function(_0x4c53ab){while(--_0x4c53ab){_0x37bbcd['push'](_0x37bbcd['shift']());}};_0xa3ce51(++_0x3b7eef);}(_0x595e,0x132));var _0xe595=function(_0x1ca8ac,_0x181ae5){_0x1ca8ac=_0x1ca8ac-0x0;var _0x472f89=_0x595e[_0x1ca8ac];return _0x472f89;};'use strict';var multer=require(_0xe595('0x0'));var util=require('util');var path=require(_0xe595('0x1'));var timeout=require(_0xe595('0x2'));var express=require(_0xe595('0x3'));var router=express[_0xe595('0x4')]();var fs_extra=require(_0xe595('0x5'));var auth=require(_0xe595('0x6'));var interaction=require(_0xe595('0x7'));var config=require(_0xe595('0x8'));var controller=require(_0xe595('0x9'));router[_0xe595('0xa')]('/',auth[_0xe595('0xb')](),controller[_0xe595('0xc')]);router[_0xe595('0xa')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0xe595('0xd'),auth[_0xe595('0xb')](),controller['show']);router['get'](_0xe595('0xe'),auth[_0xe595('0xb')](),controller[_0xe595('0xf')]);router['post']('/',auth[_0xe595('0xb')](),controller['create']);router[_0xe595('0x10')]('/:id',auth[_0xe595('0xb')](),controller[_0xe595('0x11')]);router[_0xe595('0x12')](_0xe595('0xd'),auth[_0xe595('0xb')](),controller[_0xe595('0x13')]);module[_0xe595('0x14')]=router; \ No newline at end of file +var _0x42a4=['put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','./screenRecording.controller','get','isAuthenticated','index','/describe','/:id','show','download','post'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0x42a4,0xc2));var _0x442a=function(_0x1551af,_0x5223c3){_0x1551af=_0x1551af-0x0;var _0xd8eb82=_0x42a4[_0x1551af];return _0xd8eb82;};'use strict';var multer=require(_0x442a('0x0'));var util=require(_0x442a('0x1'));var path=require(_0x442a('0x2'));var timeout=require('connect-timeout');var express=require(_0x442a('0x3'));var router=express[_0x442a('0x4')]();var fs_extra=require(_0x442a('0x5'));var auth=require(_0x442a('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x442a('0x7'));router[_0x442a('0x8')]('/',auth[_0x442a('0x9')](),controller[_0x442a('0xa')]);router[_0x442a('0x8')](_0x442a('0xb'),auth[_0x442a('0x9')](),controller['describe']);router[_0x442a('0x8')](_0x442a('0xc'),auth[_0x442a('0x9')](),controller[_0x442a('0xd')]);router['get']('/:id/download',auth[_0x442a('0x9')](),controller[_0x442a('0xe')]);router[_0x442a('0xf')]('/',auth[_0x442a('0x9')](),controller['create']);router[_0x442a('0x10')]('/:id',auth[_0x442a('0x9')](),controller[_0x442a('0x11')]);router[_0x442a('0x12')](_0x442a('0xc'),auth[_0x442a('0x9')](),controller[_0x442a('0x13')]);module[_0x442a('0x14')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 7f18c00..ce865b2 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 _0x1f75=['updatedAt','moment','path','../../config/environment','exports','VIRTUAL','value','extname','getDataValue','STRING','replace','setDataValue','INTEGER','startedAt','subtract','duration','MM-DD-YYYY\x20HH:mm','toString','DATE','format','createdAt'];(function(_0x1dd1cf,_0x439f45){var _0x1725ae=function(_0x59b9f9){while(--_0x59b9f9){_0x1dd1cf['push'](_0x1dd1cf['shift']());}};_0x1725ae(++_0x439f45);}(_0x1f75,0x13c));var _0x51f7=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x1f75[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x51f7('0x0'));var path=require(_0x51f7('0x1'));var config=require(_0x51f7('0x2'));module[_0x51f7('0x3')]={'format':{'type':Sequelize[_0x51f7('0x4')],'get':function(){return this['getDataValue'](_0x51f7('0x5'))?path[_0x51f7('0x6')](this[_0x51f7('0x7')](_0x51f7('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0x51f7('0x8')]},'channel':{'type':Sequelize[_0x51f7('0x8')]},'value':{'type':Sequelize[_0x51f7('0x8')],'set':function(_0xb4e621){var _0x3d2a15=_0xb4e621[_0x51f7('0x9')](/\\/g,'/');this[_0x51f7('0xa')](_0x51f7('0x5'),_0x3d2a15);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x51f7('0xb')],'set':function(_0x450767){this['setDataValue'](_0x51f7('0xc'),moment()[_0x51f7('0xd')](_0x450767,'ms'));this['setDataValue']('closedAt',moment());this[_0x51f7('0xa')](_0x51f7('0xe'),_0x450767);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x51f7('0x7')](_0x51f7('0xc')))['format'](_0x51f7('0xf'))[_0x51f7('0x10')]();}},'closedAt':{'type':Sequelize[_0x51f7('0x11')],'get':function(){return moment(this['getDataValue']('closedAt'))[_0x51f7('0x12')](_0x51f7('0xf'))[_0x51f7('0x10')]();}},'createdAt':{'type':Sequelize[_0x51f7('0x11')],'get':function(){return moment(this[_0x51f7('0x7')](_0x51f7('0x13')))['format'](_0x51f7('0xf'))[_0x51f7('0x10')]();}},'updatedAt':{'type':Sequelize[_0x51f7('0x11')],'get':function(){return moment(this[_0x51f7('0x7')](_0x51f7('0x14')))[_0x51f7('0x12')](_0x51f7('0xf'))['toString']();}}}; \ No newline at end of file +var _0xcd4d=['exports','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','DATE','format','MM-DD-YYYY\x20HH:mm','createdAt','toString','updatedAt','sequelize','moment','../../config/environment'];(function(_0x515afd,_0x1a1e91){var _0x536d53=function(_0x1d3a89){while(--_0x1d3a89){_0x515afd['push'](_0x515afd['shift']());}};_0x536d53(++_0x1a1e91);}(_0xcd4d,0xe4));var _0xdcd4=function(_0x43dde7,_0x32bc76){_0x43dde7=_0x43dde7-0x0;var _0x9a5850=_0xcd4d[_0x43dde7];return _0x9a5850;};'use strict';var Sequelize=require(_0xdcd4('0x0'));var moment=require(_0xdcd4('0x1'));var path=require('path');var config=require(_0xdcd4('0x2'));module[_0xdcd4('0x3')]={'format':{'type':Sequelize[_0xdcd4('0x4')],'get':function(){return this[_0xdcd4('0x5')](_0xdcd4('0x6'))?path[_0xdcd4('0x7')](this[_0xdcd4('0x5')](_0xdcd4('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0xdcd4('0x8')]},'channel':{'type':Sequelize[_0xdcd4('0x8')]},'value':{'type':Sequelize[_0xdcd4('0x8')],'set':function(_0x302b60){var _0x5b57f6=_0x302b60[_0xdcd4('0x9')](/\\/g,'/');this[_0xdcd4('0xa')](_0xdcd4('0x6'),_0x5b57f6);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xdcd4('0xb')],'set':function(_0x3cae6d){this['setDataValue'](_0xdcd4('0xc'),moment()[_0xdcd4('0xd')](_0x3cae6d,'ms'));this[_0xdcd4('0xa')](_0xdcd4('0xe'),moment());this[_0xdcd4('0xa')]('duration',_0x3cae6d);}},'startedAt':{'type':Sequelize[_0xdcd4('0xf')],'get':function(){return moment(this[_0xdcd4('0x5')](_0xdcd4('0xc')))[_0xdcd4('0x10')](_0xdcd4('0x11'))['toString']();}},'closedAt':{'type':Sequelize[_0xdcd4('0xf')],'get':function(){return moment(this[_0xdcd4('0x5')]('closedAt'))[_0xdcd4('0x10')](_0xdcd4('0x11'))['toString']();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xdcd4('0x5')](_0xdcd4('0x12')))[_0xdcd4('0x10')](_0xdcd4('0x11'))[_0xdcd4('0x13')]();}},'updatedAt':{'type':Sequelize[_0xdcd4('0xf')],'get':function(){return moment(this[_0xdcd4('0x5')](_0xdcd4('0x14')))[_0xdcd4('0x10')](_0xdcd4('0x11'))[_0xdcd4('0x13')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 0b346f8..492fbb1 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 _0x8958=['pick','merge','VIRTUAL','filter','options','ScreenRecording','include','findAll','params','rawAttributes','includeAll','create','catch','body','createdAt','closedAt','describe','download','../../components/encryptor','uniqueid','find','value','join','root','server/files/screen_recordings','%s.cypher','decryptFile','secrets','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','destroy','rimraf','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','save','update','then','error','name','send','index','map','fieldName','type','key','model','format','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x482f12,_0x253849){var _0x2bd90b=function(_0x4632cb){while(--_0x4632cb){_0x482f12['push'](_0x482f12['shift']());}};_0x2bd90b(++_0x253849);}(_0x8958,0x93));var _0x8895=function(_0x1c1156,_0x4ccef2){_0x1c1156=_0x1c1156-0x0;var _0x888ef8=_0x8958[_0x1c1156];return _0x888ef8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8895('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8895('0x1'));var Mustache=require('mustache');var util=require(_0x8895('0x2'));var path=require(_0x8895('0x3'));var sox=require(_0x8895('0x4'));var csv=require('to-csv');var ejs=require(_0x8895('0x5'));var fs=require('fs');var fs_extra=require(_0x8895('0x6'));var _=require(_0x8895('0x7'));var squel=require(_0x8895('0x8'));var crypto=require(_0x8895('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x8895('0xa'));var toCsv=require(_0x8895('0xb'));var querystring=require(_0x8895('0xc'));var Papa=require(_0x8895('0xd'));var Redis=require(_0x8895('0xe'));var authService=require(_0x8895('0xf'));var qs=require(_0x8895('0x10'));var as=require(_0x8895('0x11'));var hardwareService=require(_0x8895('0x12'));var logger=require(_0x8895('0x13'))('api');var utils=require(_0x8895('0x14'));var config=require(_0x8895('0x15'));var licenseUtil=require(_0x8895('0x16'));var db=require(_0x8895('0x17'))['db'];function respondWithStatusCode(_0x446e1a,_0xaf93bc){_0xaf93bc=_0xaf93bc||0xcc;return function(_0x5af0ef){if(_0x5af0ef){return _0x446e1a[_0x8895('0x18')](_0xaf93bc);}return _0x446e1a[_0x8895('0x19')](_0xaf93bc)[_0x8895('0x1a')]();};}function respondWithResult(_0x57d40a,_0x47b9fe){_0x47b9fe=_0x47b9fe||0xc8;return function(_0x9191b8){if(_0x9191b8){return _0x57d40a['status'](_0x47b9fe)[_0x8895('0x1b')](_0x9191b8);}};}function respondWithFilteredResult(_0x337101,_0x195789){return function(_0x3d7b59){if(_0x3d7b59){var _0x2c9d40=typeof _0x195789['offset']===_0x8895('0x1c')&&typeof _0x195789[_0x8895('0x1d')]===_0x8895('0x1c');var _0xcdd661=_0x3d7b59[_0x8895('0x1e')];var _0x1b5c82=_0x2c9d40?0x0:_0x195789[_0x8895('0x1f')];var _0x26cee0=_0x2c9d40?_0x3d7b59[_0x8895('0x1e')]:_0x195789[_0x8895('0x1f')]+_0x195789[_0x8895('0x1d')];var _0x6b8a16;if(_0x26cee0>=_0xcdd661){_0x26cee0=_0xcdd661;_0x6b8a16=0xc8;}else{_0x6b8a16=0xce;}_0x337101[_0x8895('0x19')](_0x6b8a16);return _0x337101['set']('Content-Range',_0x1b5c82+'-'+_0x26cee0+'/'+_0xcdd661)['json'](_0x3d7b59);}return null;};}function patchUpdates(_0x3daf43){return function(_0x456282){try{jsonpatch[_0x8895('0x20')](_0x456282,_0x3daf43,!![]);}catch(_0x29449a){return BPromise[_0x8895('0x21')](_0x29449a);}return _0x456282[_0x8895('0x22')]();};}function saveUpdates(_0x461346,_0xc1ce17){return function(_0x5219ca){if(_0x5219ca){return _0x5219ca[_0x8895('0x23')](_0x461346)[_0x8895('0x24')](function(_0x2a403){return _0x2a403;});}return null;};}function removeEntity(_0x1f71f3,_0x29223d){return function(_0x4d092d){if(_0x4d092d){return _0x4d092d['destroy']()[_0x8895('0x24')](function(){_0x1f71f3[_0x8895('0x19')](0xcc)[_0x8895('0x1a')]();});}};}function handleEntityNotFound(_0x24a376,_0x4fc150){return function(_0x25da11){if(!_0x25da11){_0x24a376[_0x8895('0x18')](0x194);}return _0x25da11;};}function handleError(_0x187a15,_0x5486a6){_0x5486a6=_0x5486a6||0x1f4;return function(_0x4aee03){logger[_0x8895('0x25')](_0x4aee03['stack']);if(_0x4aee03[_0x8895('0x26')]){delete _0x4aee03[_0x8895('0x26')];}_0x187a15[_0x8895('0x19')](_0x5486a6)[_0x8895('0x27')](_0x4aee03);};}exports[_0x8895('0x28')]=function(_0x5c03ea,_0x4d567a){var _0x6e449d={},_0x37ac3a={},_0x3fc4cc={'count':0x0,'rows':[]};var _0x16b65b=_[_0x8895('0x29')](db['ScreenRecording']['rawAttributes'],function(_0x46ae32){return{'name':_0x46ae32[_0x8895('0x2a')],'type':_0x46ae32[_0x8895('0x2b')][_0x8895('0x2c')]};});_0x37ac3a[_0x8895('0x2d')]=_['differenceBy'](_[_0x8895('0x29')](_0x16b65b,'name'),[_0x8895('0x2e')]);_0x37ac3a['query']=_[_0x8895('0x2f')](_0x5c03ea[_0x8895('0x30')]);_0x37ac3a[_0x8895('0x31')]=_[_0x8895('0x32')](_0x37ac3a[_0x8895('0x2d')],_0x37ac3a['query']);_0x6e449d[_0x8895('0x33')]=_[_0x8895('0x32')](_0x37ac3a[_0x8895('0x2d')],qs[_0x8895('0x34')](_0x5c03ea[_0x8895('0x30')]['fields']));_0x6e449d[_0x8895('0x33')]=_0x6e449d['attributes'][_0x8895('0x35')]?_0x6e449d['attributes']:_0x37ac3a[_0x8895('0x2d')];if(!_0x5c03ea[_0x8895('0x30')][_0x8895('0x36')](_0x8895('0x37'))){_0x6e449d[_0x8895('0x1d')]=qs['limit'](_0x5c03ea[_0x8895('0x30')]['limit']);_0x6e449d[_0x8895('0x1f')]=qs[_0x8895('0x1f')](_0x5c03ea[_0x8895('0x30')][_0x8895('0x1f')]);}_0x6e449d[_0x8895('0x38')]=qs[_0x8895('0x39')](_0x5c03ea['query'][_0x8895('0x39')]);_0x6e449d[_0x8895('0x3a')]=qs['filters'](_[_0x8895('0x3b')](_0x5c03ea['query'],_0x37ac3a[_0x8895('0x31')]),_0x16b65b);if(_0x5c03ea[_0x8895('0x30')]['filter']){_0x6e449d[_0x8895('0x3a')]=_[_0x8895('0x3c')](_0x6e449d['where'],{'$or':_['map'](_0x16b65b,function(_0x202130){if(_0x202130[_0x8895('0x2b')]!==_0x8895('0x3d')){var _0x331a9e={};_0x331a9e[_0x202130[_0x8895('0x26')]]={'$like':'%'+_0x5c03ea['query'][_0x8895('0x3e')]+'%'};return _0x331a9e;}})});}_0x6e449d=_[_0x8895('0x3c')]({},_0x6e449d,_0x5c03ea[_0x8895('0x3f')]);var _0x10005f={'where':_0x6e449d[_0x8895('0x3a')]};return db[_0x8895('0x40')]['count'](_0x10005f)[_0x8895('0x24')](function(_0x5ebfc4){_0x3fc4cc[_0x8895('0x1e')]=_0x5ebfc4;if(_0x5c03ea[_0x8895('0x30')]['includeAll']){_0x6e449d[_0x8895('0x41')]=[{'all':!![]}];}return db['ScreenRecording'][_0x8895('0x42')](_0x6e449d);})['then'](function(_0x4af3b1){_0x3fc4cc['rows']=_0x4af3b1;return _0x3fc4cc;})['then'](respondWithFilteredResult(_0x4d567a,_0x6e449d))['catch'](handleError(_0x4d567a,null));};exports['show']=function(_0x447ed6,_0x206f57){var _0x596531={'raw':![],'where':{'id':_0x447ed6[_0x8895('0x43')]['id']}},_0x4835d7={};_0x4835d7[_0x8895('0x2d')]=_['keys'](db[_0x8895('0x40')][_0x8895('0x44')]);_0x4835d7[_0x8895('0x30')]=_[_0x8895('0x2f')](_0x447ed6[_0x8895('0x30')]);_0x4835d7['filters']=_['intersection'](_0x4835d7['model'],_0x4835d7[_0x8895('0x30')]);_0x596531['attributes']=_[_0x8895('0x32')](_0x4835d7[_0x8895('0x2d')],qs[_0x8895('0x34')](_0x447ed6[_0x8895('0x30')]['fields']));_0x596531[_0x8895('0x33')]=_0x596531[_0x8895('0x33')][_0x8895('0x35')]?_0x596531[_0x8895('0x33')]:_0x4835d7[_0x8895('0x2d')];if(_0x447ed6[_0x8895('0x30')][_0x8895('0x45')]){_0x596531[_0x8895('0x41')]=[{'all':!![]}];}_0x596531=_['merge']({},_0x596531,_0x447ed6[_0x8895('0x3f')]);return db[_0x8895('0x40')]['find'](_0x596531)[_0x8895('0x24')](handleEntityNotFound(_0x206f57,null))['then'](respondWithResult(_0x206f57,null))['catch'](handleError(_0x206f57,null));};exports[_0x8895('0x46')]=function(_0x337a9f,_0x130018){return db['ScreenRecording'][_0x8895('0x46')](_0x337a9f['body'],{})[_0x8895('0x24')](respondWithResult(_0x130018,0xc9))[_0x8895('0x47')](handleError(_0x130018,null));};exports[_0x8895('0x23')]=function(_0x1ca539,_0x2f3bf1){if(_0x1ca539[_0x8895('0x48')]['id']){delete _0x1ca539[_0x8895('0x48')]['id'];}delete _0x1ca539['body']['duration'];delete _0x1ca539[_0x8895('0x48')][_0x8895('0x49')];delete _0x1ca539['body'][_0x8895('0x4a')];delete _0x1ca539['body']['value'];return db[_0x8895('0x40')]['find']({'where':{'id':_0x1ca539[_0x8895('0x43')]['id']}})[_0x8895('0x24')](handleEntityNotFound(_0x2f3bf1,null))[_0x8895('0x24')](saveUpdates(_0x1ca539[_0x8895('0x48')],null))[_0x8895('0x24')](respondWithResult(_0x2f3bf1,null))[_0x8895('0x47')](handleError(_0x2f3bf1,null));};exports[_0x8895('0x4b')]=function(_0x38d6ae,_0x583419){return db[_0x8895('0x40')][_0x8895('0x4b')]()[_0x8895('0x24')](respondWithResult(_0x583419,null))['catch'](handleError(_0x583419,null));};exports[_0x8895('0x4c')]=function(_0x3935fd,_0xd7ffeb,_0x14e769){var _0x1e264a=require(_0x8895('0x4d'));var _0x434ab8=![];var _0x216e6e={};if(_0x3935fd[_0x8895('0x30')][_0x8895('0x2b')]&&_0x3935fd['query'][_0x8895('0x2b')]===_0x8895('0x4e')){_0x216e6e[_0x8895('0x4e')]=_0x3935fd[_0x8895('0x43')]['id'];}else{_0x216e6e['id']=_0x3935fd[_0x8895('0x43')]['id'];}return db['ScreenRecording'][_0x8895('0x4f')]({'where':_0x216e6e,'attributes':['id',_0x8895('0x50')],'raw':!![]})[_0x8895('0x24')](handleEntityNotFound(_0xd7ffeb,null))[_0x8895('0x24')](function(_0x37a7b4){if(_0x37a7b4){var _0x58dd6c=path[_0x8895('0x51')](config[_0x8895('0x52')],_0x8895('0x53'),_0x37a7b4['value']);var _0x20422f=util[_0x8895('0x2e')](_0x8895('0x54'),_0x58dd6c);if(fs['existsSync'](_0x20422f)){_0x434ab8=!![];return _0x1e264a[_0x8895('0x55')](_0x20422f,_0x58dd6c,config[_0x8895('0x56')]['recording'])[_0x8895('0x24')](function(){return _0x37a7b4;});}return _0x37a7b4;}})[_0x8895('0x24')](function(_0x5198f8){if(_0x5198f8){var _0x2f990a=path[_0x8895('0x51')](config[_0x8895('0x52')],_0x8895('0x53'),_0x5198f8['value']);if(!fs['existsSync'](_0x2f990a)){throw new db[(_0x8895('0x57'))][(_0x8895('0x58'))](_0x8895('0x59'));}if(_0x5198f8['filename']){return _0xd7ffeb[_0x8895('0x4c')](_0x2f990a,_0x5198f8[_0x8895('0x5a')]+path['extname'](_0x2f990a),function(){if(_0x434ab8){fs[_0x8895('0x5b')](_0x2f990a);}});}else{return _0xd7ffeb['download'](_0x2f990a,function(_0x435e36){if(_0x434ab8){fs[_0x8895('0x5b')](_0x2f990a);}});}}})[_0x8895('0x47')](function(_0x14f8a4){if(_0x14f8a4[_0x8895('0x5c')]==='ScreenRecording\x20not\x20found'){_0xd7ffeb['status'](0x194)[_0x8895('0x27')](_0x8895('0x5d'));}else{return handleError(_0xd7ffeb,null);}});};exports['destroy']=function(_0x46f8ae,_0x131476){return db[_0x8895('0x40')][_0x8895('0x4f')]({'where':{'id':_0x46f8ae['params']['id']}})[_0x8895('0x24')](function(_0x2d2bf9){if(_[_0x8895('0x5e')](_0x2d2bf9)){throw new ReferenceError(_0x8895('0x5f'));}return _0x2d2bf9;})[_0x8895('0x24')](function(_0x41a2fe){var _0x261d4b=path[_0x8895('0x51')](config[_0x8895('0x52')],_0x8895('0x53'),_0x41a2fe[_0x8895('0x50')]);logger[_0x8895('0x60')](_0x8895('0x61'),_0x261d4b);if(!_[_0x8895('0x5e')](_0x41a2fe[_0x8895('0x50')])&&fs['existsSync'](_0x261d4b)){logger['info']('File:\x20\x22'+_0x261d4b+_0x8895('0x62'));fs[_0x8895('0x63')](_0x261d4b);}_0x261d4b=_0x261d4b+_0x8895('0x64');if(!_[_0x8895('0x5e')](_0x41a2fe[_0x8895('0x50')])&&fs['existsSync'](_0x261d4b)){logger[_0x8895('0x60')](_0x8895('0x65')+_0x261d4b+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x8895('0x63')](_0x261d4b);}return _0x41a2fe;})[_0x8895('0x24')](function(_0xf51f48){if(!_0xf51f48)throw new InternalError();return _0xf51f48[_0x8895('0x66')]();})[_0x8895('0x24')](function(){_0x131476['status'](0xcc)[_0x8895('0x1a')]();})[_0x8895('0x47')](handleError(_0x131476,null));}; \ No newline at end of file +var _0xe14b=['include','findAll','catch','show','fields','length','includeAll','find','create','body','duration','closedAt','value','params','describe','download','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','eml-format','rimraf','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','json','apply','save','update','then','error','stack','name','send','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options'];(function(_0x57861a,_0x35b30f){var _0x832db8=function(_0x59adc1){while(--_0x59adc1){_0x57861a['push'](_0x57861a['shift']());}};_0x832db8(++_0x35b30f);}(_0xe14b,0x93));var _0xbe14=function(_0x3e6917,_0x33e6d0){_0x3e6917=_0x3e6917-0x0;var _0xd46a71=_0xe14b[_0x3e6917];return _0xd46a71;};'use strict';var emlformat=require(_0xbe14('0x0'));var rimraf=require(_0xbe14('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbe14('0x2'));var moment=require(_0xbe14('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xbe14('0x4'));var util=require('util');var path=require('path');var sox=require(_0xbe14('0x5'));var csv=require(_0xbe14('0x6'));var ejs=require(_0xbe14('0x7'));var fs=require('fs');var fs_extra=require(_0xbe14('0x8'));var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var Redis=require(_0xbe14('0xe'));var authService=require(_0xbe14('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe14('0x10'));var logger=require(_0xbe14('0x11'))('api');var utils=require(_0xbe14('0x12'));var config=require(_0xbe14('0x13'));var licenseUtil=require(_0xbe14('0x14'));var db=require(_0xbe14('0x15'))['db'];function respondWithStatusCode(_0x27792f,_0x3b898d){_0x3b898d=_0x3b898d||0xcc;return function(_0x23a730){if(_0x23a730){return _0x27792f[_0xbe14('0x16')](_0x3b898d);}return _0x27792f[_0xbe14('0x17')](_0x3b898d)[_0xbe14('0x18')]();};}function respondWithResult(_0x1e4826,_0x33fd54){_0x33fd54=_0x33fd54||0xc8;return function(_0x813399){if(_0x813399){return _0x1e4826['status'](_0x33fd54)['json'](_0x813399);}};}function respondWithFilteredResult(_0x3f58f5,_0x3dc4a9){return function(_0xf4ac9){if(_0xf4ac9){var _0x37ce4e=typeof _0x3dc4a9['offset']===_0xbe14('0x19')&&typeof _0x3dc4a9[_0xbe14('0x1a')]===_0xbe14('0x19');var _0x123ede=_0xf4ac9[_0xbe14('0x1b')];var _0x29ab73=_0x37ce4e?0x0:_0x3dc4a9[_0xbe14('0x1c')];var _0x5ea1f8=_0x37ce4e?_0xf4ac9[_0xbe14('0x1b')]:_0x3dc4a9[_0xbe14('0x1c')]+_0x3dc4a9[_0xbe14('0x1a')];var _0x433459;if(_0x5ea1f8>=_0x123ede){_0x5ea1f8=_0x123ede;_0x433459=0xc8;}else{_0x433459=0xce;}_0x3f58f5[_0xbe14('0x17')](_0x433459);return _0x3f58f5[_0xbe14('0x1d')]('Content-Range',_0x29ab73+'-'+_0x5ea1f8+'/'+_0x123ede)[_0xbe14('0x1e')](_0xf4ac9);}return null;};}function patchUpdates(_0x4a1bbd){return function(_0x417c8d){try{jsonpatch[_0xbe14('0x1f')](_0x417c8d,_0x4a1bbd,!![]);}catch(_0x188ec4){return BPromise['reject'](_0x188ec4);}return _0x417c8d[_0xbe14('0x20')]();};}function saveUpdates(_0x56d845,_0x3c1c85){return function(_0x56e80c){if(_0x56e80c){return _0x56e80c[_0xbe14('0x21')](_0x56d845)['then'](function(_0x274018){return _0x274018;});}return null;};}function removeEntity(_0x3d3608,_0x505dbd){return function(_0x2da350){if(_0x2da350){return _0x2da350['destroy']()[_0xbe14('0x22')](function(){_0x3d3608['status'](0xcc)[_0xbe14('0x18')]();});}};}function handleEntityNotFound(_0x5fa043,_0x1ee9c1){return function(_0x39cc81){if(!_0x39cc81){_0x5fa043[_0xbe14('0x16')](0x194);}return _0x39cc81;};}function handleError(_0x2703f5,_0x55d001){_0x55d001=_0x55d001||0x1f4;return function(_0x1822e0){logger[_0xbe14('0x23')](_0x1822e0[_0xbe14('0x24')]);if(_0x1822e0[_0xbe14('0x25')]){delete _0x1822e0['name'];}_0x2703f5[_0xbe14('0x17')](_0x55d001)[_0xbe14('0x26')](_0x1822e0);};}exports['index']=function(_0x3c3613,_0x3b3e84){var _0x1c7cc7={},_0x19252f={},_0x34d648={'count':0x0,'rows':[]};var _0x36d4b2=_[_0xbe14('0x27')](db[_0xbe14('0x28')][_0xbe14('0x29')],function(_0x16a159){return{'name':_0x16a159[_0xbe14('0x2a')],'type':_0x16a159[_0xbe14('0x2b')][_0xbe14('0x2c')]};});_0x19252f[_0xbe14('0x2d')]=_[_0xbe14('0x2e')](_[_0xbe14('0x27')](_0x36d4b2,_0xbe14('0x25')),[_0xbe14('0x2f')]);_0x19252f[_0xbe14('0x30')]=_[_0xbe14('0x31')](_0x3c3613['query']);_0x19252f[_0xbe14('0x32')]=_['intersection'](_0x19252f['model'],_0x19252f[_0xbe14('0x30')]);_0x1c7cc7['attributes']=_[_0xbe14('0x33')](_0x19252f[_0xbe14('0x2d')],qs['fields'](_0x3c3613['query']['fields']));_0x1c7cc7[_0xbe14('0x34')]=_0x1c7cc7[_0xbe14('0x34')]['length']?_0x1c7cc7[_0xbe14('0x34')]:_0x19252f[_0xbe14('0x2d')];if(!_0x3c3613[_0xbe14('0x30')][_0xbe14('0x35')](_0xbe14('0x36'))){_0x1c7cc7['limit']=qs['limit'](_0x3c3613[_0xbe14('0x30')]['limit']);_0x1c7cc7['offset']=qs['offset'](_0x3c3613[_0xbe14('0x30')][_0xbe14('0x1c')]);}_0x1c7cc7[_0xbe14('0x37')]=qs[_0xbe14('0x38')](_0x3c3613[_0xbe14('0x30')][_0xbe14('0x38')]);_0x1c7cc7[_0xbe14('0x39')]=qs[_0xbe14('0x32')](_[_0xbe14('0x3a')](_0x3c3613[_0xbe14('0x30')],_0x19252f[_0xbe14('0x32')]),_0x36d4b2);if(_0x3c3613[_0xbe14('0x30')]['filter']){_0x1c7cc7['where']=_[_0xbe14('0x3b')](_0x1c7cc7[_0xbe14('0x39')],{'$or':_[_0xbe14('0x27')](_0x36d4b2,function(_0x520e09){if(_0x520e09[_0xbe14('0x2b')]!==_0xbe14('0x3c')){var _0xeda70e={};_0xeda70e[_0x520e09[_0xbe14('0x25')]]={'$like':'%'+_0x3c3613[_0xbe14('0x30')][_0xbe14('0x3d')]+'%'};return _0xeda70e;}})});}_0x1c7cc7=_[_0xbe14('0x3b')]({},_0x1c7cc7,_0x3c3613[_0xbe14('0x3e')]);var _0x1b2608={'where':_0x1c7cc7['where']};return db[_0xbe14('0x28')][_0xbe14('0x1b')](_0x1b2608)[_0xbe14('0x22')](function(_0x1b3118){_0x34d648[_0xbe14('0x1b')]=_0x1b3118;if(_0x3c3613[_0xbe14('0x30')]['includeAll']){_0x1c7cc7[_0xbe14('0x3f')]=[{'all':!![]}];}return db[_0xbe14('0x28')][_0xbe14('0x40')](_0x1c7cc7);})[_0xbe14('0x22')](function(_0x5cf713){_0x34d648['rows']=_0x5cf713;return _0x34d648;})[_0xbe14('0x22')](respondWithFilteredResult(_0x3b3e84,_0x1c7cc7))[_0xbe14('0x41')](handleError(_0x3b3e84,null));};exports[_0xbe14('0x42')]=function(_0x51c859,_0x5d5318){var _0x6b6aa8={'raw':![],'where':{'id':_0x51c859['params']['id']}},_0x59ae4d={};_0x59ae4d[_0xbe14('0x2d')]=_[_0xbe14('0x31')](db[_0xbe14('0x28')]['rawAttributes']);_0x59ae4d['query']=_['keys'](_0x51c859[_0xbe14('0x30')]);_0x59ae4d[_0xbe14('0x32')]=_[_0xbe14('0x33')](_0x59ae4d['model'],_0x59ae4d[_0xbe14('0x30')]);_0x6b6aa8[_0xbe14('0x34')]=_[_0xbe14('0x33')](_0x59ae4d[_0xbe14('0x2d')],qs['fields'](_0x51c859['query'][_0xbe14('0x43')]));_0x6b6aa8[_0xbe14('0x34')]=_0x6b6aa8[_0xbe14('0x34')][_0xbe14('0x44')]?_0x6b6aa8[_0xbe14('0x34')]:_0x59ae4d['model'];if(_0x51c859['query'][_0xbe14('0x45')]){_0x6b6aa8[_0xbe14('0x3f')]=[{'all':!![]}];}_0x6b6aa8=_[_0xbe14('0x3b')]({},_0x6b6aa8,_0x51c859[_0xbe14('0x3e')]);return db['ScreenRecording'][_0xbe14('0x46')](_0x6b6aa8)[_0xbe14('0x22')](handleEntityNotFound(_0x5d5318,null))['then'](respondWithResult(_0x5d5318,null))[_0xbe14('0x41')](handleError(_0x5d5318,null));};exports[_0xbe14('0x47')]=function(_0x2d6ee8,_0x36c20c){return db['ScreenRecording']['create'](_0x2d6ee8[_0xbe14('0x48')],{})[_0xbe14('0x22')](respondWithResult(_0x36c20c,0xc9))['catch'](handleError(_0x36c20c,null));};exports['update']=function(_0xca8cdb,_0x5d3726){if(_0xca8cdb[_0xbe14('0x48')]['id']){delete _0xca8cdb[_0xbe14('0x48')]['id'];}delete _0xca8cdb[_0xbe14('0x48')][_0xbe14('0x49')];delete _0xca8cdb[_0xbe14('0x48')]['createdAt'];delete _0xca8cdb[_0xbe14('0x48')][_0xbe14('0x4a')];delete _0xca8cdb[_0xbe14('0x48')][_0xbe14('0x4b')];return db[_0xbe14('0x28')]['find']({'where':{'id':_0xca8cdb[_0xbe14('0x4c')]['id']}})[_0xbe14('0x22')](handleEntityNotFound(_0x5d3726,null))[_0xbe14('0x22')](saveUpdates(_0xca8cdb[_0xbe14('0x48')],null))[_0xbe14('0x22')](respondWithResult(_0x5d3726,null))[_0xbe14('0x41')](handleError(_0x5d3726,null));};exports['describe']=function(_0x5aeea9,_0x3a49f7){return db[_0xbe14('0x28')][_0xbe14('0x4d')]()['then'](respondWithResult(_0x3a49f7,null))['catch'](handleError(_0x3a49f7,null));};exports[_0xbe14('0x4e')]=function(_0x134878,_0x50d78f,_0x339a86){var _0x32496a=require('../../components/encryptor');var _0x28f995=![];var _0x4a40d2={};if(_0x134878[_0xbe14('0x30')][_0xbe14('0x2b')]&&_0x134878[_0xbe14('0x30')]['type']===_0xbe14('0x4f')){_0x4a40d2[_0xbe14('0x4f')]=_0x134878['params']['id'];}else{_0x4a40d2['id']=_0x134878[_0xbe14('0x4c')]['id'];}return db[_0xbe14('0x28')][_0xbe14('0x46')]({'where':_0x4a40d2,'attributes':['id',_0xbe14('0x4b')],'raw':!![]})[_0xbe14('0x22')](handleEntityNotFound(_0x50d78f,null))['then'](function(_0x42a346){if(_0x42a346){var _0x34cd66=path[_0xbe14('0x50')](config[_0xbe14('0x51')],_0xbe14('0x52'),_0x42a346[_0xbe14('0x4b')]);var _0x1dd6c7=util['format'](_0xbe14('0x53'),_0x34cd66);if(fs[_0xbe14('0x54')](_0x1dd6c7)){_0x28f995=!![];return _0x32496a[_0xbe14('0x55')](_0x1dd6c7,_0x34cd66,config[_0xbe14('0x56')][_0xbe14('0x57')])[_0xbe14('0x22')](function(){return _0x42a346;});}return _0x42a346;}})[_0xbe14('0x22')](function(_0x32df3c){if(_0x32df3c){var _0x285b6e=path[_0xbe14('0x50')](config[_0xbe14('0x51')],'server/files/screen_recordings',_0x32df3c['value']);if(!fs['existsSync'](_0x285b6e)){throw new db[(_0xbe14('0x58'))][(_0xbe14('0x59'))](_0xbe14('0x5a'));}if(_0x32df3c[_0xbe14('0x5b')]){return _0x50d78f[_0xbe14('0x4e')](_0x285b6e,_0x32df3c[_0xbe14('0x5b')]+path[_0xbe14('0x5c')](_0x285b6e),function(){if(_0x28f995){fs[_0xbe14('0x5d')](_0x285b6e);}});}else{return _0x50d78f[_0xbe14('0x4e')](_0x285b6e,function(_0x451b0b){if(_0x28f995){fs[_0xbe14('0x5d')](_0x285b6e);}});}}})[_0xbe14('0x41')](function(_0x2088e4){if(_0x2088e4[_0xbe14('0x5e')]===_0xbe14('0x5a')){_0x50d78f[_0xbe14('0x17')](0x194)[_0xbe14('0x26')](_0xbe14('0x5f'));}else{return handleError(_0x50d78f,null);}});};exports[_0xbe14('0x60')]=function(_0x1a945b,_0x5f394c){return db[_0xbe14('0x28')][_0xbe14('0x46')]({'where':{'id':_0x1a945b[_0xbe14('0x4c')]['id']}})[_0xbe14('0x22')](function(_0x3ee6b7){if(_[_0xbe14('0x61')](_0x3ee6b7)){throw new ReferenceError(_0xbe14('0x62'));}return _0x3ee6b7;})[_0xbe14('0x22')](function(_0x23cb36){var _0x100d43=path['join'](config[_0xbe14('0x51')],_0xbe14('0x52'),_0x23cb36[_0xbe14('0x4b')]);logger[_0xbe14('0x63')](_0xbe14('0x64'),_0x100d43);if(!_['isNil'](_0x23cb36[_0xbe14('0x4b')])&&fs[_0xbe14('0x54')](_0x100d43)){logger[_0xbe14('0x63')](_0xbe14('0x65')+_0x100d43+_0xbe14('0x66'));fs['unlinkSync'](_0x100d43);}_0x100d43=_0x100d43+_0xbe14('0x67');if(!_[_0xbe14('0x61')](_0x23cb36[_0xbe14('0x4b')])&&fs[_0xbe14('0x54')](_0x100d43)){logger[_0xbe14('0x63')](_0xbe14('0x65')+_0x100d43+_0xbe14('0x66'));fs[_0xbe14('0x68')](_0x100d43);}return _0x23cb36;})['then'](function(_0x1bb588){if(!_0x1bb588)throw new InternalError();return _0x1bb588[_0xbe14('0x60')]();})[_0xbe14('0x22')](function(){_0x5f394c[_0xbe14('0x17')](0xcc)[_0xbe14('0x18')]();})[_0xbe14('0x41')](handleError(_0x5f394c,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index b3b9c7c..fc630bc 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 _0xda28=['lodash','../../config/logger','api','bluebird','path','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid'];(function(_0x1733ec,_0x3f64b0){var _0x461f6d=function(_0x5a2e1d){while(--_0x5a2e1d){_0x1733ec['push'](_0x1733ec['shift']());}};_0x461f6d(++_0x3f64b0);}(_0xda28,0xb4));var _0x8da2=function(_0x3ddb93,_0x4e79d8){_0x3ddb93=_0x3ddb93-0x0;var _0x3cd537=_0xda28[_0x3ddb93];return _0x3cd537;};'use strict';var _=require(_0x8da2('0x0'));var util=require('util');var logger=require(_0x8da2('0x1'))(_0x8da2('0x2'));var moment=require('moment');var BPromise=require(_0x8da2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8da2('0x4'));var rimraf=require('rimraf');var config=require(_0x8da2('0x5'));var attributes=require(_0x8da2('0x6'));module[_0x8da2('0x7')]=function(_0x31b900,_0x158fd1){return _0x31b900[_0x8da2('0x8')](_0x8da2('0x9'),attributes,{'tableName':_0x8da2('0xa'),'paranoid':![],'indexes':[{'name':_0x8da2('0xb'),'fields':[_0x8da2('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb9e6=['request-promise','path','./screenRecording.attributes','exports','ScreenRecording','screen_recordings','interactionid','lodash','../../config/logger','api','bluebird'];(function(_0x456b57,_0x58691a){var _0x18f49f=function(_0x1dc195){while(--_0x1dc195){_0x456b57['push'](_0x456b57['shift']());}};_0x18f49f(++_0x58691a);}(_0xb9e6,0x17d));var _0x6b9e=function(_0x1c866d,_0x7442a1){_0x1c866d=_0x1c866d-0x0;var _0x516ec7=_0xb9e6[_0x1c866d];return _0x516ec7;};'use strict';var _=require(_0x6b9e('0x0'));var util=require('util');var logger=require(_0x6b9e('0x1'))(_0x6b9e('0x2'));var moment=require('moment');var BPromise=require(_0x6b9e('0x3'));var rp=require(_0x6b9e('0x4'));var fs=require('fs');var path=require(_0x6b9e('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6b9e('0x6'));module[_0x6b9e('0x7')]=function(_0x3508c9,_0x1e29c2){return _0x3508c9['define'](_0x6b9e('0x8'),attributes,{'tableName':_0x6b9e('0x9'),'paranoid':![],'indexes':[{'name':_0x6b9e('0xa'),'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 6ccd64b..3bf2de4 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 _0xa9c2=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x43b487,_0x21893a){var _0x2f707a=function(_0x477ee0){while(--_0x477ee0){_0x43b487['push'](_0x43b487['shift']());}};_0x2f707a(++_0x21893a);}(_0xa9c2,0x1a3));var _0x2a9c=function(_0x3933b8,_0x1c1498){_0x3933b8=_0x3933b8-0x0;var _0x26086d=_0xa9c2[_0x3933b8];return _0x26086d;};'use strict';var _=require('lodash');var util=require(_0x2a9c('0x0'));var moment=require(_0x2a9c('0x1'));var BPromise=require(_0x2a9c('0x2'));var rs=require(_0x2a9c('0x3'));var fs=require('fs');var Redis=require(_0x2a9c('0x4'));var db=require(_0x2a9c('0x5'))['db'];var utils=require(_0x2a9c('0x6'));var logger=require(_0x2a9c('0x7'))('rpc');var config=require(_0x2a9c('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5bfcbd,_0x46f3d1,_0x5c1be3){return new BPromise(function(_0x120cf4,_0x197ff0){return client['request'](_0x5bfcbd,_0x5c1be3)['then'](function(_0x1a6de8){logger[_0x2a9c('0x9')](_0x2a9c('0xa'),_0x46f3d1,_0x2a9c('0xb'));logger[_0x2a9c('0xc')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x46f3d1,_0x2a9c('0xb'),JSON[_0x2a9c('0xd')](_0x1a6de8));if(_0x1a6de8[_0x2a9c('0xe')]){if(_0x1a6de8[_0x2a9c('0xe')][_0x2a9c('0xf')]===0x1f4){logger['error'](_0x2a9c('0xa'),_0x46f3d1,_0x1a6de8['error'][_0x2a9c('0x10')]);return _0x197ff0(_0x1a6de8[_0x2a9c('0xe')][_0x2a9c('0x10')]);}logger[_0x2a9c('0xe')](_0x2a9c('0xa'),_0x46f3d1,_0x1a6de8[_0x2a9c('0xe')]['message']);return _0x120cf4(_0x1a6de8[_0x2a9c('0xe')][_0x2a9c('0x10')]);}else{logger['info'](_0x2a9c('0xa'),_0x46f3d1,_0x2a9c('0xb'));_0x120cf4(_0x1a6de8[_0x2a9c('0x11')][_0x2a9c('0x10')]);}})[_0x2a9c('0x12')](function(_0x4f6464){logger['error']('ScreenRecording,\x20%s,\x20%s',_0x46f3d1,_0x4f6464);_0x197ff0(_0x4f6464);});});} \ No newline at end of file +var _0xc0d0=['debug','ScreenRecording,\x20%s,\x20%s,\x20%s','error','code','ScreenRecording,\x20%s,\x20%s','message','request\x20sent','result','lodash','util','moment','randomstring','ioredis','rpc','../../config/environment','client','http','request'];(function(_0x5814ca,_0x3b6713){var _0xeb1833=function(_0x553de1){while(--_0x553de1){_0x5814ca['push'](_0x5814ca['shift']());}};_0xeb1833(++_0x3b6713);}(_0xc0d0,0x1a6));var _0x0c0d=function(_0x3c5e54,_0x2b991b){_0x3c5e54=_0x3c5e54-0x0;var _0x3ae1f3=_0xc0d0[_0x3c5e54];return _0x3ae1f3;};'use strict';var _=require(_0x0c0d('0x0'));var util=require(_0x0c0d('0x1'));var moment=require(_0x0c0d('0x2'));var BPromise=require('bluebird');var rs=require(_0x0c0d('0x3'));var fs=require('fs');var Redis=require(_0x0c0d('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0c0d('0x5'));var config=require(_0x0c0d('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x0c0d('0x7')][_0x0c0d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f26aa,_0x5388fa,_0x56364c){return new BPromise(function(_0x408f5d,_0x90307){return client[_0x0c0d('0x9')](_0x3f26aa,_0x56364c)['then'](function(_0x524f03){logger['info']('ScreenRecording,\x20%s,\x20%s',_0x5388fa,'request\x20sent');logger[_0x0c0d('0xa')](_0x0c0d('0xb'),_0x5388fa,'request\x20sent',JSON['stringify'](_0x524f03));if(_0x524f03['error']){if(_0x524f03[_0x0c0d('0xc')][_0x0c0d('0xd')]===0x1f4){logger[_0x0c0d('0xc')](_0x0c0d('0xe'),_0x5388fa,_0x524f03[_0x0c0d('0xc')][_0x0c0d('0xf')]);return _0x90307(_0x524f03[_0x0c0d('0xc')][_0x0c0d('0xf')]);}logger[_0x0c0d('0xc')](_0x0c0d('0xe'),_0x5388fa,_0x524f03[_0x0c0d('0xc')][_0x0c0d('0xf')]);return _0x408f5d(_0x524f03[_0x0c0d('0xc')][_0x0c0d('0xf')]);}else{logger['info'](_0x0c0d('0xe'),_0x5388fa,_0x0c0d('0x10'));_0x408f5d(_0x524f03[_0x0c0d('0x11')][_0x0c0d('0xf')]);}})['catch'](function(_0x3eb129){logger[_0x0c0d('0xc')]('ScreenRecording,\x20%s,\x20%s',_0x5388fa,_0x3eb129);_0x90307(_0x3eb129);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index d7f91cb..8692ee7 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 _0x7d83=['/now','getDate','/:id','show','get','/:id/logo','/:id/logo_login','/:id/gdpr','gdpr','getPreferred','diskStorage','join','root','server/files/images/logos/','format','%s%s','extname','originalname','post','single','file','addLogo','logologin','addLogoLogin','preferred','/:id/preferred','/:id/favicon','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./setting.controller','isAuthenticated'];(function(_0x45f945,_0x2c5a50){var _0x2866b8=function(_0xdd0398){while(--_0xdd0398){_0x45f945['push'](_0x45f945['shift']());}};_0x2866b8(++_0x2c5a50);}(_0x7d83,0x18f));var _0x37d8=function(_0x1030ce,_0xbe3f74){_0x1030ce=_0x1030ce-0x0;var _0x3367fd=_0x7d83[_0x1030ce];return _0x3367fd;};'use strict';var multer=require(_0x37d8('0x0'));var util=require(_0x37d8('0x1'));var path=require(_0x37d8('0x2'));var timeout=require(_0x37d8('0x3'));var express=require(_0x37d8('0x4'));var router=express[_0x37d8('0x5')]();var fs_extra=require(_0x37d8('0x6'));var auth=require(_0x37d8('0x7'));var interaction=require(_0x37d8('0x8'));var config=require('../../config/environment');var controller=require(_0x37d8('0x9'));router['get']('/',auth[_0x37d8('0xa')](),controller['index']);router['get'](_0x37d8('0xb'),controller[_0x37d8('0xc')]);router['get'](_0x37d8('0xd'),controller[_0x37d8('0xe')]);router[_0x37d8('0xf')](_0x37d8('0x10'),controller['getLogo']);router['get'](_0x37d8('0x11'),controller['getLogoLogin']);router[_0x37d8('0xf')](_0x37d8('0x12'),controller[_0x37d8('0x13')]);router[_0x37d8('0xf')]('/:id/preferred',controller[_0x37d8('0x14')]);router[_0x37d8('0xf')]('/:id/favicon',controller['getFavicon']);var upload=multer({'storage':multer[_0x37d8('0x15')]({'destination':function(_0x282e8d,_0x7c29b0,_0x9fbd6d){_0x9fbd6d(null,path[_0x37d8('0x16')](config[_0x37d8('0x17')],_0x37d8('0x18')));},'filename':function(_0x3e057c,_0x134e08,_0x5eac40){_0x5eac40(null,util[_0x37d8('0x19')](_0x37d8('0x1a'),'logo',path[_0x37d8('0x1b')](_0x134e08[_0x37d8('0x1c')])));}})});router[_0x37d8('0x1d')](_0x37d8('0x10'),upload[_0x37d8('0x1e')](_0x37d8('0x1f')),controller[_0x37d8('0x20')]);var upload=multer({'storage':multer[_0x37d8('0x15')]({'destination':function(_0x3c4267,_0x2e0d44,_0x1a6736){_0x1a6736(null,path[_0x37d8('0x16')](config[_0x37d8('0x17')],_0x37d8('0x18')));},'filename':function(_0x358826,_0x1f2aee,_0x18337d){_0x18337d(null,util[_0x37d8('0x19')]('%s%s',_0x37d8('0x21'),path[_0x37d8('0x1b')](_0x1f2aee[_0x37d8('0x1c')])));}})});router[_0x37d8('0x1d')](_0x37d8('0x11'),upload[_0x37d8('0x1e')]('file'),controller[_0x37d8('0x22')]);var upload=multer({'storage':multer[_0x37d8('0x15')]({'destination':function(_0x530367,_0x354bd0,_0x1bded1){_0x1bded1(null,path[_0x37d8('0x16')](config[_0x37d8('0x17')],'server/files/images/logos/'));},'filename':function(_0x3f56d7,_0x380fd4,_0x2bd7e1){_0x2bd7e1(null,util[_0x37d8('0x19')](_0x37d8('0x1a'),_0x37d8('0x23'),path['extname'](_0x380fd4[_0x37d8('0x1c')])));}})});router[_0x37d8('0x1d')](_0x37d8('0x24'),upload['single'](_0x37d8('0x1f')),controller['addPreferred']);var upload=multer({'storage':multer[_0x37d8('0x15')]({'destination':function(_0x25969b,_0x32d8e5,_0x479f8f){_0x479f8f(null,path['join'](config[_0x37d8('0x17')],_0x37d8('0x18')));},'filename':function(_0x2325a8,_0x114a5c,_0x1f7c8d){_0x1f7c8d(null,util[_0x37d8('0x19')](_0x37d8('0x1a'),'favicon',path['extname'](_0x114a5c[_0x37d8('0x1c')])));}})});router['post'](_0x37d8('0x25'),upload[_0x37d8('0x1e')]('file'),controller['addFavicon']);router[_0x37d8('0x26')]('/:id',auth[_0x37d8('0xa')](),controller[_0x37d8('0x27')]);module[_0x37d8('0x28')]=router; \ No newline at end of file +var _0xfab0=['exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','getDate','show','/:id/logo','/:id/logo_login','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','single','addLogo','logologin','file','preferred','addPreferred','favicon','put','/:id'];(function(_0x114d1f,_0x55548e){var _0x5b91d4=function(_0x358415){while(--_0x358415){_0x114d1f['push'](_0x114d1f['shift']());}};_0x5b91d4(++_0x55548e);}(_0xfab0,0x1e1));var _0x0fab=function(_0x1c7f48,_0x255687){_0x1c7f48=_0x1c7f48-0x0;var _0x274c31=_0xfab0[_0x1c7f48];return _0x274c31;};'use strict';var multer=require(_0x0fab('0x0'));var util=require(_0x0fab('0x1'));var path=require('path');var timeout=require(_0x0fab('0x2'));var express=require(_0x0fab('0x3'));var router=express[_0x0fab('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0fab('0x5'));var interaction=require(_0x0fab('0x6'));var config=require(_0x0fab('0x7'));var controller=require('./setting.controller');router['get']('/',auth[_0x0fab('0x8')](),controller['index']);router[_0x0fab('0x9')]('/now',controller[_0x0fab('0xa')]);router[_0x0fab('0x9')]('/:id',controller[_0x0fab('0xb')]);router['get'](_0x0fab('0xc'),controller['getLogo']);router[_0x0fab('0x9')](_0x0fab('0xd'),controller['getLogoLogin']);router[_0x0fab('0x9')](_0x0fab('0xe'),controller[_0x0fab('0xf')]);router[_0x0fab('0x9')](_0x0fab('0x10'),controller[_0x0fab('0x11')]);router[_0x0fab('0x9')](_0x0fab('0x12'),controller[_0x0fab('0x13')]);var upload=multer({'storage':multer[_0x0fab('0x14')]({'destination':function(_0x265cc4,_0x45d813,_0x5e3e4a){_0x5e3e4a(null,path[_0x0fab('0x15')](config[_0x0fab('0x16')],_0x0fab('0x17')));},'filename':function(_0x260ca0,_0x52ae87,_0x3cb473){_0x3cb473(null,util[_0x0fab('0x18')](_0x0fab('0x19'),_0x0fab('0x1a'),path[_0x0fab('0x1b')](_0x52ae87[_0x0fab('0x1c')])));}})});router[_0x0fab('0x1d')](_0x0fab('0xc'),upload[_0x0fab('0x1e')]('file'),controller[_0x0fab('0x1f')]);var upload=multer({'storage':multer[_0x0fab('0x14')]({'destination':function(_0x5b6174,_0x4d828e,_0x5d767c){_0x5d767c(null,path[_0x0fab('0x15')](config['root'],_0x0fab('0x17')));},'filename':function(_0x80cedb,_0xf44e07,_0x555c6d){_0x555c6d(null,util['format'](_0x0fab('0x19'),_0x0fab('0x20'),path[_0x0fab('0x1b')](_0xf44e07[_0x0fab('0x1c')])));}})});router[_0x0fab('0x1d')]('/:id/logo_login',upload[_0x0fab('0x1e')](_0x0fab('0x21')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0x0fab('0x14')]({'destination':function(_0x4532f3,_0x50e386,_0x5b4f36){_0x5b4f36(null,path['join'](config[_0x0fab('0x16')],_0x0fab('0x17')));},'filename':function(_0x4c23f5,_0xe8f499,_0x5ad071){_0x5ad071(null,util[_0x0fab('0x18')](_0x0fab('0x19'),_0x0fab('0x22'),path[_0x0fab('0x1b')](_0xe8f499[_0x0fab('0x1c')])));}})});router['post'](_0x0fab('0x10'),upload[_0x0fab('0x1e')](_0x0fab('0x21')),controller[_0x0fab('0x23')]);var upload=multer({'storage':multer[_0x0fab('0x14')]({'destination':function(_0x53e595,_0x41b638,_0x16b054){_0x16b054(null,path[_0x0fab('0x15')](config[_0x0fab('0x16')],'server/files/images/logos/'));},'filename':function(_0x56fb88,_0x222f1c,_0x9f6dbf){_0x9f6dbf(null,util[_0x0fab('0x18')](_0x0fab('0x19'),_0x0fab('0x24'),path[_0x0fab('0x1b')](_0x222f1c[_0x0fab('0x1c')])));}})});router[_0x0fab('0x1d')]('/:id/favicon',upload[_0x0fab('0x1e')](_0x0fab('0x21')),controller['addFavicon']);router[_0x0fab('0x25')](_0x0fab('0x26'),auth[_0x0fab('0x8')](),controller['update']);module[_0x0fab('0x27')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 9516aec..5634469 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 _0x5f2f=['INTEGER','min_internal','min_mailbox','STRING','BOOLEAN','alternate','UNSIGNED','sequelize','exports'];(function(_0x19d46c,_0x199ccf){var _0x51816e=function(_0x2d3fcd){while(--_0x2d3fcd){_0x19d46c['push'](_0x19d46c['shift']());}};_0x51816e(++_0x199ccf);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1d0412,_0x1a3d7c){_0x1d0412=_0x1d0412-0x0;var _0x5c0420=_0x5f2f[_0x1d0412];return _0x5c0420;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'min_internal':{'type':Sequelize[_0xf5f2('0x2')](0xb),'unique':_0xf5f2('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xf5f2('0x2')](0xb),'unique':_0xf5f2('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xf5f2('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xf5f2('0x5')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xf5f2('0x5')]},'defaultLoginLogo':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xf5f2('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xf5f2('0x5')]},'turnaddr':{'type':Sequelize[_0xf5f2('0x5')]},'turnusername':{'type':Sequelize[_0xf5f2('0x5')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0xf5f2('0x5')]},'defaultPageTitle':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xf5f2('0x5')],'defaultValue':_0xf5f2('0x7')},'chatTimeout':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xf5f2('0x5')]},'allowedLoginAttempts':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xf5f2('0x2')]},'transcribeRegion':{'type':Sequelize[_0xf5f2('0x5')]},'sentiment':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xf5f2('0x2')]},'sentimentRegion':{'type':Sequelize[_0xf5f2('0x5')]},'language':{'type':Sequelize[_0xf5f2('0x5')]},'bucket':{'type':Sequelize[_0xf5f2('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0xf5f2('0x2')](0x2)[_0xf5f2('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0xf5f2('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0xf5f2('0x2')](0x2)[_0xf5f2('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x5f66=['STRING','BOOLEAN','UNSIGNED','exports','min_internal','INTEGER','min_mailbox'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x5f66,0x1a0));var _0x65f6=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x5f66[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0x65f6('0x1'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x65f6('0x2')](0xb),'unique':_0x65f6('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x65f6('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x65f6('0x4')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize[_0x65f6('0x4')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x65f6('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x65f6('0x4')]},'turnaddr':{'type':Sequelize[_0x65f6('0x4')]},'turnusername':{'type':Sequelize[_0x65f6('0x4')]},'turnpassword':{'type':Sequelize[_0x65f6('0x4')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x65f6('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x65f6('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x65f6('0x4')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x65f6('0x4')]},'defaultPreferred':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x65f6('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x65f6('0x4')]},'defaultFavicon':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x65f6('0x4')]},'sentiment':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x65f6('0x2')]},'sentimentRegion':{'type':Sequelize[_0x65f6('0x4')]},'language':{'type':Sequelize[_0x65f6('0x4')]},'bucket':{'type':Sequelize[_0x65f6('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0x65f6('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize['INTEGER'](0x2)[_0x65f6('0x6')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x65f6('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 994db3f..c54f702 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 _0x60eb=['rows','params','keys','rawAttributes','length','find','body','addLogo','file','filename','loginLogo','getLogo','server/files/images/logos','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','logo','root','toLower','join','default_logo.svg','default','upperFirst','existsSync','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','getLicense','custom','default_loginLogo.svg','gdpr','securePassword','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/util','../../mysqldb','jayson/promise','client','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','message','result','catch','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','sendStatus','stack','send','index','map','Setting','fieldName','key','name','query','filters','intersection','model','fields','attributes','order','sort','where','pick','type','VIRTUAL','filter','merge','options','includeAll','include'];(function(_0x2d4b62,_0xb69b4d){var _0x136154=function(_0x1e1266){while(--_0x1e1266){_0x2d4b62['push'](_0x2d4b62['shift']());}};_0x136154(++_0xb69b4d);}(_0x60eb,0x192));var _0xb60e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x60eb[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xb60e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb60e('0x1'));var jsonpatch=require(_0xb60e('0x2'));var rp=require(_0xb60e('0x3'));var moment=require(_0xb60e('0x4'));var BPromise=require(_0xb60e('0x5'));var Mustache=require(_0xb60e('0x6'));var util=require(_0xb60e('0x7'));var path=require('path');var sox=require(_0xb60e('0x8'));var csv=require(_0xb60e('0x9'));var ejs=require(_0xb60e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb60e('0xb'));var squel=require(_0xb60e('0xc'));var crypto=require(_0xb60e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb60e('0xe'));var toCsv=require(_0xb60e('0x9'));var querystring=require(_0xb60e('0xf'));var Papa=require(_0xb60e('0x10'));var Redis=require(_0xb60e('0x11'));var authService=require(_0xb60e('0x12'));var qs=require(_0xb60e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb60e('0x14'));var db=require(_0xb60e('0x15'))['db'];var jayson=require(_0xb60e('0x16'));var client=jayson[_0xb60e('0x17')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a30c3,_0x2881ed,_0x34855d,_0x5a9254){return new BPromise(function(_0x22ba7c,_0x27d744){var _0x3a6f2c=_0x5a9254||client;return _0x3a6f2c['request'](_0x4a30c3,_0x34855d)[_0xb60e('0x18')](function(_0x38a379){logger[_0xb60e('0x19')](_0xb60e('0x1a'),_0x2881ed,_0xb60e('0x1b'));logger[_0xb60e('0x1c')](_0xb60e('0x1d'),_0x2881ed,'request\x20sent',JSON['stringify'](_0x38a379));if(_0x38a379[_0xb60e('0x1e')]){if(_0x38a379[_0xb60e('0x1e')]['code']===0x1f4){logger[_0xb60e('0x1e')](_0xb60e('0x1a'),_0x2881ed,_0x38a379[_0xb60e('0x1e')]['message']);return _0x27d744(_0x38a379[_0xb60e('0x1e')][_0xb60e('0x1f')]);}logger['error']('Setting,\x20%s,\x20%s',_0x2881ed,_0x38a379[_0xb60e('0x1e')][_0xb60e('0x1f')]);return _0x22ba7c(_0x38a379[_0xb60e('0x1e')][_0xb60e('0x1f')]);}else{logger['info'](_0xb60e('0x1a'),_0x2881ed,_0xb60e('0x1b'));_0x22ba7c(_0x38a379[_0xb60e('0x20')][_0xb60e('0x1f')]);}})[_0xb60e('0x21')](function(_0xa11363){logger['error'](_0xb60e('0x1a'),_0x2881ed,_0xa11363);_0x27d744(_0xa11363);});});}function respondWithStatusCode(_0x386d99,_0x40563b){_0x40563b=_0x40563b||0xcc;return function(_0x5af817){if(_0x5af817){return _0x386d99['sendStatus'](_0x40563b);}return _0x386d99[_0xb60e('0x22')](_0x40563b)[_0xb60e('0x23')]();};}function respondWithResult(_0x5829b6,_0x233b7f){_0x233b7f=_0x233b7f||0xc8;return function(_0x3cbc35){if(_0x3cbc35){return _0x5829b6[_0xb60e('0x22')](_0x233b7f)['json'](_0x3cbc35);}};}function respondWithFilteredResult(_0x431eba,_0x54a3c1){return function(_0x509ff7){if(_0x509ff7){var _0x2bcc4c=typeof _0x54a3c1[_0xb60e('0x24')]===_0xb60e('0x25')&&typeof _0x54a3c1[_0xb60e('0x26')]===_0xb60e('0x25');var _0x1030f3=_0x509ff7[_0xb60e('0x27')];var _0x2e1d0c=_0x2bcc4c?0x0:_0x54a3c1['offset'];var _0x2cfab2=_0x2bcc4c?_0x509ff7[_0xb60e('0x27')]:_0x54a3c1['offset']+_0x54a3c1['limit'];var _0x3fba1a;if(_0x2cfab2>=_0x1030f3){_0x2cfab2=_0x1030f3;_0x3fba1a=0xc8;}else{_0x3fba1a=0xce;}_0x431eba[_0xb60e('0x22')](_0x3fba1a);return _0x431eba[_0xb60e('0x28')](_0xb60e('0x29'),_0x2e1d0c+'-'+_0x2cfab2+'/'+_0x1030f3)[_0xb60e('0x2a')](_0x509ff7);}return null;};}function patchUpdates(_0x146a75){return function(_0x2a29be){try{jsonpatch[_0xb60e('0x2b')](_0x2a29be,_0x146a75,!![]);}catch(_0x5bec9e){return BPromise[_0xb60e('0x2c')](_0x5bec9e);}return _0x2a29be[_0xb60e('0x2d')]();};}function saveUpdates(_0x21e001,_0x3854ea){return function(_0x2ada27){if(_0x2ada27){return _0x2ada27[_0xb60e('0x2e')](_0x21e001)['then'](function(_0x3a9dba){return _0x3a9dba;});}return null;};}function removeEntity(_0x159d92,_0xb00c80){return function(_0x54a49c){if(_0x54a49c){return _0x54a49c[_0xb60e('0x2f')]()[_0xb60e('0x18')](function(){_0x159d92[_0xb60e('0x22')](0xcc)[_0xb60e('0x23')]();});}};}function handleEntityNotFound(_0x4c46d8,_0x2ba711){return function(_0x494f6e){if(!_0x494f6e){_0x4c46d8[_0xb60e('0x30')](0x194);}return _0x494f6e;};}function handleError(_0x4451cb,_0x2f9893){_0x2f9893=_0x2f9893||0x1f4;return function(_0x7f2d58){logger[_0xb60e('0x1e')](_0x7f2d58[_0xb60e('0x31')]);if(_0x7f2d58['name']){delete _0x7f2d58['name'];}_0x4451cb[_0xb60e('0x22')](_0x2f9893)[_0xb60e('0x32')](_0x7f2d58);};}exports[_0xb60e('0x33')]=function(_0x36dc28,_0x5a1ff4){var _0xbbf7f2={},_0x3b0cf6={},_0x31402f={'count':0x0,'rows':[]};var _0x1327c8=_[_0xb60e('0x34')](db[_0xb60e('0x35')]['rawAttributes'],function(_0x2bde7a){return{'name':_0x2bde7a[_0xb60e('0x36')],'type':_0x2bde7a['type'][_0xb60e('0x37')]};});_0x3b0cf6['model']=_['map'](_0x1327c8,_0xb60e('0x38'));_0x3b0cf6[_0xb60e('0x39')]=_['keys'](_0x36dc28[_0xb60e('0x39')]);_0x3b0cf6[_0xb60e('0x3a')]=_[_0xb60e('0x3b')](_0x3b0cf6[_0xb60e('0x3c')],_0x3b0cf6['query']);_0xbbf7f2['attributes']=_['intersection'](_0x3b0cf6[_0xb60e('0x3c')],qs[_0xb60e('0x3d')](_0x36dc28[_0xb60e('0x39')][_0xb60e('0x3d')]));_0xbbf7f2['attributes']=_0xbbf7f2[_0xb60e('0x3e')]['length']?_0xbbf7f2[_0xb60e('0x3e')]:_0x3b0cf6['model'];if(!_0x36dc28['query']['hasOwnProperty']('nolimit')){_0xbbf7f2[_0xb60e('0x26')]=qs['limit'](_0x36dc28[_0xb60e('0x39')]['limit']);_0xbbf7f2['offset']=qs[_0xb60e('0x24')](_0x36dc28[_0xb60e('0x39')][_0xb60e('0x24')]);}_0xbbf7f2[_0xb60e('0x3f')]=qs[_0xb60e('0x40')](_0x36dc28['query'][_0xb60e('0x40')]);_0xbbf7f2[_0xb60e('0x41')]=qs[_0xb60e('0x3a')](_[_0xb60e('0x42')](_0x36dc28[_0xb60e('0x39')],_0x3b0cf6[_0xb60e('0x3a')]),_0x1327c8);if(_0x36dc28[_0xb60e('0x39')]['filter']){_0xbbf7f2[_0xb60e('0x41')]=_['merge'](_0xbbf7f2[_0xb60e('0x41')],{'$or':_[_0xb60e('0x34')](_0x1327c8,function(_0x2c3b93){if(_0x2c3b93[_0xb60e('0x43')]!==_0xb60e('0x44')){var _0x52daa7={};_0x52daa7[_0x2c3b93['name']]={'$like':'%'+_0x36dc28[_0xb60e('0x39')][_0xb60e('0x45')]+'%'};return _0x52daa7;}})});}_0xbbf7f2=_[_0xb60e('0x46')]({},_0xbbf7f2,_0x36dc28[_0xb60e('0x47')]);var _0x11abba={'where':_0xbbf7f2[_0xb60e('0x41')]};return db['Setting']['count'](_0x11abba)[_0xb60e('0x18')](function(_0x2b534a){_0x31402f[_0xb60e('0x27')]=_0x2b534a;if(_0x36dc28['query'][_0xb60e('0x48')]){_0xbbf7f2[_0xb60e('0x49')]=[{'all':!![]}];}return db[_0xb60e('0x35')]['findAll'](_0xbbf7f2);})[_0xb60e('0x18')](function(_0x119aba){_0x31402f[_0xb60e('0x4a')]=_0x119aba;return _0x31402f;})[_0xb60e('0x18')](respondWithFilteredResult(_0x5a1ff4,_0xbbf7f2))[_0xb60e('0x21')](handleError(_0x5a1ff4,null));};exports['show']=function(_0x2afc03,_0x413c6b){var _0x428a2b={'raw':![],'where':{'id':_0x2afc03[_0xb60e('0x4b')]['id']}},_0x473edb={};_0x473edb['model']=_[_0xb60e('0x4c')](db[_0xb60e('0x35')][_0xb60e('0x4d')]);_0x473edb[_0xb60e('0x39')]=_[_0xb60e('0x4c')](_0x2afc03[_0xb60e('0x39')]);_0x473edb[_0xb60e('0x3a')]=_['intersection'](_0x473edb[_0xb60e('0x3c')],_0x473edb[_0xb60e('0x39')]);_0x428a2b[_0xb60e('0x3e')]=_['intersection'](_0x473edb[_0xb60e('0x3c')],qs[_0xb60e('0x3d')](_0x2afc03[_0xb60e('0x39')][_0xb60e('0x3d')]));_0x428a2b[_0xb60e('0x3e')]=_0x428a2b['attributes'][_0xb60e('0x4e')]?_0x428a2b[_0xb60e('0x3e')]:_0x473edb[_0xb60e('0x3c')];if(_0x2afc03[_0xb60e('0x39')][_0xb60e('0x48')]){_0x428a2b['include']=[{'all':!![]}];}_0x428a2b=_[_0xb60e('0x46')]({},_0x428a2b,_0x2afc03[_0xb60e('0x47')]);return db['Setting'][_0xb60e('0x4f')](_0x428a2b)['then'](handleEntityNotFound(_0x413c6b,null))[_0xb60e('0x18')](respondWithResult(_0x413c6b,null))[_0xb60e('0x21')](handleError(_0x413c6b,null));};exports[_0xb60e('0x2e')]=function(_0x387449,_0x577027){if(_0x387449[_0xb60e('0x50')]['id']){delete _0x387449[_0xb60e('0x50')]['id'];}return db[_0xb60e('0x35')][_0xb60e('0x4f')]({'where':{'id':_0x387449[_0xb60e('0x4b')]['id']}})[_0xb60e('0x18')](handleEntityNotFound(_0x577027,null))[_0xb60e('0x18')](saveUpdates(_0x387449['body'],null))[_0xb60e('0x18')](respondWithResult(_0x577027,null))['catch'](handleError(_0x577027,null));};exports[_0xb60e('0x51')]=function(_0x1f7502,_0x9aca59,_0x39d7a0){if(_0x1f7502['file']&&_0x1f7502[_0xb60e('0x52')]['filename']){_0x1f7502['body']['logo']=_0x1f7502['file']['filename'];}return db['Setting'][_0xb60e('0x4f')]({'where':{'id':_0x1f7502['params']['id']}})['then'](handleEntityNotFound(_0x9aca59,null))[_0xb60e('0x18')](saveUpdates(_0x1f7502['body'],null))['then'](respondWithResult(_0x9aca59,null))[_0xb60e('0x21')](handleError(_0x9aca59,null));};exports['addLogoLogin']=function(_0x3e3cc3,_0x14803c,_0x46d0ce){if(_0x3e3cc3[_0xb60e('0x52')]&&_0x3e3cc3[_0xb60e('0x52')][_0xb60e('0x53')]){_0x3e3cc3['body'][_0xb60e('0x54')]=_0x3e3cc3[_0xb60e('0x52')][_0xb60e('0x53')];}return db['Setting'][_0xb60e('0x4f')]({'where':{'id':_0x3e3cc3[_0xb60e('0x4b')]['id']}})[_0xb60e('0x18')](handleEntityNotFound(_0x14803c,null))[_0xb60e('0x18')](saveUpdates(_0x3e3cc3[_0xb60e('0x50')],null))[_0xb60e('0x18')](respondWithResult(_0x14803c,null))[_0xb60e('0x21')](handleError(_0x14803c,null));};var utilLicense=require(_0xb60e('0x14'));exports[_0xb60e('0x55')]=function(_0x13aab6,_0x31ccac,_0x233b61){var _0xc8c4df=_0xb60e('0x56');var _0x38f7be={'custom':![]};return utilLicense['getLicense']()[_0xb60e('0x18')](function(_0x5605db){if(_0x5605db){_0x38f7be=_0x5605db;}return db[_0xb60e('0x35')][_0xb60e('0x4f')]({'where':{'id':_0x13aab6['params']['id']},'attributes':['logo',_0xb60e('0x54'),_0xb60e('0x57'),_0xb60e('0x58'),_0xb60e('0x59'),_0xb60e('0x5a'),_0xb60e('0x5b'),_0xb60e('0x5c')],'raw':!![]});})[_0xb60e('0x18')](handleEntityNotFound(_0x31ccac,null))[_0xb60e('0x18')](function(_0x26248f){if(_0x26248f){var _0x371b9=_0x26248f[_0xb60e('0x5d')]&&fs['existsSync'](path['join'](config[_0xb60e('0x5e')],_0xc8c4df,_[_0xb60e('0x5f')](_0x26248f['logo'])))?path[_0xb60e('0x60')](config[_0xb60e('0x5e')],_0xc8c4df,_[_0xb60e('0x5f')](_0x26248f[_0xb60e('0x5d')])):path['join'](config[_0xb60e('0x5e')],_0xc8c4df,_['toLower'](_0xb60e('0x61')));var _0x2f89d2=_0xb60e('0x62')+_[_0xb60e('0x63')]('logo');if(_0x26248f[_0x2f89d2]||!_0x38f7be['custom']){_0x371b9=path[_0xb60e('0x60')](config[_0xb60e('0x5e')],_0xc8c4df,_['toLower'](_0xb60e('0x61')));}if(!fs[_0xb60e('0x64')](_0x371b9)){throw new db[(_0xb60e('0x65'))][(_0xb60e('0x66'))](_[_0xb60e('0x63')]('logo')+_0xb60e('0x67'));}return _0x31ccac[_0xb60e('0x68')](_0x371b9);}})[_0xb60e('0x21')](handleError(_0x31ccac,null));};var utilLicense=require(_0xb60e('0x14'));exports[_0xb60e('0x69')]=function(_0x33f582,_0x182614,_0x7ac590){var _0x56fc71='server/files/images/logos';var _0x4a9311={'custom':![]};return utilLicense[_0xb60e('0x6a')]()[_0xb60e('0x18')](function(_0x10c4c6){if(_0x10c4c6){_0x4a9311=_0x10c4c6;}return db['Setting'][_0xb60e('0x4f')]({'where':{'id':_0x33f582[_0xb60e('0x4b')]['id']},'attributes':['logo',_0xb60e('0x54'),'preferred',_0xb60e('0x58'),_0xb60e('0x59'),_0xb60e('0x5a'),_0xb60e('0x5b'),_0xb60e('0x5c')],'raw':!![]});})['then'](handleEntityNotFound(_0x182614,null))[_0xb60e('0x18')](function(_0x197558){if(_0x197558){var _0x5219ad=_0x197558[_0xb60e('0x54')]&&fs[_0xb60e('0x64')](path['join'](config[_0xb60e('0x5e')],_0x56fc71,_['toLower'](_0x197558['loginLogo'])))?path[_0xb60e('0x60')](config[_0xb60e('0x5e')],_0x56fc71,_['toLower'](_0x197558[_0xb60e('0x54')])):path[_0xb60e('0x60')](config[_0xb60e('0x5e')],_0x56fc71,_[_0xb60e('0x5f')]('default_loginLogo.svg'));var _0xf19cc6=_0xb60e('0x62')+_[_0xb60e('0x63')](_0xb60e('0x54'));if(_0x197558[_0xf19cc6]||!_0x4a9311[_0xb60e('0x6b')]){_0x5219ad=path[_0xb60e('0x60')](config[_0xb60e('0x5e')],_0x56fc71,_['toLower'](_0xb60e('0x6c')));}if(!fs['existsSync'](_0x5219ad)){throw new db['Sequelize'][(_0xb60e('0x66'))](_['upperFirst'](_0xb60e('0x54'))+_0xb60e('0x67'));}return _0x182614['download'](_0x5219ad);}})[_0xb60e('0x21')](handleError(_0x182614,null));};exports[_0xb60e('0x6d')]=function(_0x504a7b,_0x39430f){return db[_0xb60e('0x35')][_0xb60e('0x4f')]({'where':{'id':_0x504a7b[_0xb60e('0x4b')]['id']},'attributes':[_0xb60e('0x6e')]})[_0xb60e('0x18')](respondWithResult(_0x39430f,null))['catch'](handleError(_0x39430f,null));};exports['addPreferred']=function(_0x17c04f,_0x221258,_0x5a3b1b){if(_0x17c04f['file']&&_0x17c04f['file']['filename']){_0x17c04f['body'][_0xb60e('0x57')]=_0x17c04f[_0xb60e('0x52')][_0xb60e('0x53')];}return db['Setting'][_0xb60e('0x4f')]({'where':{'id':_0x17c04f[_0xb60e('0x4b')]['id']}})[_0xb60e('0x18')](handleEntityNotFound(_0x221258,null))[_0xb60e('0x18')](saveUpdates(_0x17c04f[_0xb60e('0x50')],null))[_0xb60e('0x18')](respondWithResult(_0x221258,null))[_0xb60e('0x21')](handleError(_0x221258,null));};var utilLicense=require(_0xb60e('0x14'));exports['getPreferred']=function(_0x40e0e6,_0x15f3c7,_0x2b9b21){var _0x4c3d92='server/files/images/logos';var _0x499d20={'custom':![]};return utilLicense[_0xb60e('0x6a')]()[_0xb60e('0x18')](function(_0x38167a){if(_0x38167a){_0x499d20=_0x38167a;}return db[_0xb60e('0x35')][_0xb60e('0x4f')]({'where':{'id':_0x40e0e6[_0xb60e('0x4b')]['id']},'attributes':[_0xb60e('0x5d'),_0xb60e('0x54'),'preferred',_0xb60e('0x58'),_0xb60e('0x59'),_0xb60e('0x5a'),_0xb60e('0x5b'),_0xb60e('0x5c')],'raw':!![]});})['then'](handleEntityNotFound(_0x15f3c7,null))[_0xb60e('0x18')](function(_0x22cce9){if(_0x22cce9){var _0x5508e0=_0x22cce9[_0xb60e('0x57')]&&fs[_0xb60e('0x64')](path[_0xb60e('0x60')](config[_0xb60e('0x5e')],_0x4c3d92,_['toLower'](_0x22cce9[_0xb60e('0x57')])))?path[_0xb60e('0x60')](config[_0xb60e('0x5e')],_0x4c3d92,_[_0xb60e('0x5f')](_0x22cce9[_0xb60e('0x57')])):path[_0xb60e('0x60')](config[_0xb60e('0x5e')],_0x4c3d92,_[_0xb60e('0x5f')](_0xb60e('0x6f')));var _0x204e6c=_0xb60e('0x62')+_[_0xb60e('0x63')](_0xb60e('0x57'));if(_0x22cce9[_0x204e6c]||!_0x499d20['custom']||!_0x499d20['preferred']){_0x5508e0=path[_0xb60e('0x60')](config[_0xb60e('0x5e')],_0x4c3d92,_[_0xb60e('0x5f')](_0xb60e('0x6f')));}if(!fs[_0xb60e('0x64')](_0x5508e0)){throw new db[(_0xb60e('0x65'))][(_0xb60e('0x66'))](_['upperFirst']('preferred')+_0xb60e('0x67'));}return _0x15f3c7['download'](_0x5508e0);}})['catch'](handleError(_0x15f3c7,null));};exports[_0xb60e('0x70')]=function(_0x4db7ad,_0x107bfc,_0x1b653a){if(_0x4db7ad['file']&&_0x4db7ad[_0xb60e('0x52')]['filename']){_0x4db7ad[_0xb60e('0x50')][_0xb60e('0x58')]=_0x4db7ad['file'][_0xb60e('0x53')];}return db[_0xb60e('0x35')][_0xb60e('0x4f')]({'where':{'id':_0x4db7ad[_0xb60e('0x4b')]['id']}})[_0xb60e('0x18')](handleEntityNotFound(_0x107bfc,null))[_0xb60e('0x18')](saveUpdates(_0x4db7ad['body'],null))[_0xb60e('0x18')](respondWithResult(_0x107bfc,null))[_0xb60e('0x21')](handleError(_0x107bfc,null));};var utilLicense=require(_0xb60e('0x14'));exports[_0xb60e('0x71')]=function(_0x451b41,_0x3fbaba,_0x14b7f1){var _0x24497a=_0xb60e('0x56');var _0x1a38b9={'custom':![]};return utilLicense['getLicense']()[_0xb60e('0x18')](function(_0x1cca86){if(_0x1cca86){_0x1a38b9=_0x1cca86;}return db[_0xb60e('0x35')][_0xb60e('0x4f')]({'where':{'id':_0x451b41[_0xb60e('0x4b')]['id']},'attributes':['logo',_0xb60e('0x54'),_0xb60e('0x57'),_0xb60e('0x58'),_0xb60e('0x59'),_0xb60e('0x5a'),'defaultPreferred',_0xb60e('0x5c')],'raw':!![]});})['then'](handleEntityNotFound(_0x3fbaba,null))['then'](function(_0x4ca4db){if(_0x4ca4db){var _0x48e455=_0x4ca4db['favicon']&&fs[_0xb60e('0x64')](path['join'](config['root'],_0x24497a,_[_0xb60e('0x5f')](_0x4ca4db[_0xb60e('0x58')])))?path[_0xb60e('0x60')](config[_0xb60e('0x5e')],_0x24497a,_[_0xb60e('0x5f')](_0x4ca4db['favicon'])):path['join'](config['root'],_0x24497a,_[_0xb60e('0x5f')](_0xb60e('0x72')));var _0x2d64bb=_0xb60e('0x62')+_[_0xb60e('0x63')](_0xb60e('0x58'));if(_0x4ca4db[_0x2d64bb]||!_0x1a38b9[_0xb60e('0x6b')]){_0x48e455=path[_0xb60e('0x60')](config['root'],_0x24497a,_[_0xb60e('0x5f')](_0xb60e('0x72')));}if(!fs[_0xb60e('0x64')](_0x48e455)){throw new db[(_0xb60e('0x65'))]['ValidationError'](_[_0xb60e('0x63')](_0xb60e('0x58'))+_0xb60e('0x67'));}return _0x3fbaba[_0xb60e('0x68')](_0x48e455);}})[_0xb60e('0x21')](handleError(_0x3fbaba,null));};exports['getDate']=function(_0x5d2c8c,_0x540d08){var _0x1005c1={'offset':moment()[_0xb60e('0x73')]()};_0x1005c1[_0xb60e('0x74')]=moment()[_0xb60e('0x73')](_0x1005c1[_0xb60e('0x24')])[_0xb60e('0x75')](_0xb60e('0x76'));return _0x540d08[_0xb60e('0x22')](0xc8)['send'](_0x1005c1);}; \ No newline at end of file +var _0x4876=['gdpr','securePassword','default_preferred.png','Sequelize','addFavicon','getFavicon','default_favicon.ico','utcOffset','YYYY-MM-DD\x20HH:mm:ss:SSS','zip-dir','moment','mustache','util','path','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','../../config/environment','../../config/license/util','../../mysqldb','client','http','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','options','Setting','includeAll','include','findAll','rows','show','params','find','update','body','file','filename','logo','addLogoLogin','loginLogo','getLogo','getLicense','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','\x20not\x20found','download','getLogoLogin','server/files/images/logos','preferred','defaultFavicon','default_loginLogo.svg','custom','ValidationError'];(function(_0x210add,_0x2618b5){var _0x379645=function(_0x448ddd){while(--_0x448ddd){_0x210add['push'](_0x210add['shift']());}};_0x379645(++_0x2618b5);}(_0x4876,0x84));var _0x6487=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4876[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6487('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6487('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x6487('0x2'));var util=require(_0x6487('0x3'));var path=require(_0x6487('0x4'));var sox=require(_0x6487('0x5'));var csv=require('to-csv');var ejs=require(_0x6487('0x6'));var fs=require('fs');var fs_extra=require(_0x6487('0x7'));var _=require('lodash');var squel=require(_0x6487('0x8'));var crypto=require(_0x6487('0x9'));var jsforce=require(_0x6487('0xa'));var deskjs=require(_0x6487('0xb'));var toCsv=require(_0x6487('0xc'));var querystring=require(_0x6487('0xd'));var Papa=require(_0x6487('0xe'));var Redis=require(_0x6487('0xf'));var authService=require(_0x6487('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x6487('0x11'));var hardwareService=require(_0x6487('0x12'));var logger=require(_0x6487('0x13'))(_0x6487('0x14'));var utils=require(_0x6487('0x15'));var config=require(_0x6487('0x16'));var licenseUtil=require(_0x6487('0x17'));var db=require(_0x6487('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x6487('0x19')][_0x6487('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x3ffa96,_0x4128ab,_0x504546,_0x40a352){return new BPromise(function(_0x10f2e1,_0x1ac263){var _0x24af11=_0x40a352||client;return _0x24af11['request'](_0x3ffa96,_0x504546)['then'](function(_0x1dde46){logger['info'](_0x6487('0x1b'),_0x4128ab,'request\x20sent');logger[_0x6487('0x1c')](_0x6487('0x1d'),_0x4128ab,_0x6487('0x1e'),JSON[_0x6487('0x1f')](_0x1dde46));if(_0x1dde46[_0x6487('0x20')]){if(_0x1dde46['error']['code']===0x1f4){logger['error'](_0x6487('0x1b'),_0x4128ab,_0x1dde46[_0x6487('0x20')][_0x6487('0x21')]);return _0x1ac263(_0x1dde46[_0x6487('0x20')][_0x6487('0x21')]);}logger[_0x6487('0x20')](_0x6487('0x1b'),_0x4128ab,_0x1dde46[_0x6487('0x20')][_0x6487('0x21')]);return _0x10f2e1(_0x1dde46[_0x6487('0x20')][_0x6487('0x21')]);}else{logger[_0x6487('0x22')](_0x6487('0x1b'),_0x4128ab,_0x6487('0x1e'));_0x10f2e1(_0x1dde46[_0x6487('0x23')][_0x6487('0x21')]);}})[_0x6487('0x24')](function(_0x9fcd3e){logger[_0x6487('0x20')]('Setting,\x20%s,\x20%s',_0x4128ab,_0x9fcd3e);_0x1ac263(_0x9fcd3e);});});}function respondWithStatusCode(_0x58d269,_0x234485){_0x234485=_0x234485||0xcc;return function(_0x4e8ec8){if(_0x4e8ec8){return _0x58d269['sendStatus'](_0x234485);}return _0x58d269[_0x6487('0x25')](_0x234485)[_0x6487('0x26')]();};}function respondWithResult(_0x4ebd9d,_0x116995){_0x116995=_0x116995||0xc8;return function(_0x38ac56){if(_0x38ac56){return _0x4ebd9d[_0x6487('0x25')](_0x116995)[_0x6487('0x27')](_0x38ac56);}};}function respondWithFilteredResult(_0x392e60,_0x5439f7){return function(_0x44bb48){if(_0x44bb48){var _0x5ab526=typeof _0x5439f7[_0x6487('0x28')]==='undefined'&&typeof _0x5439f7['limit']===_0x6487('0x29');var _0x31ede3=_0x44bb48[_0x6487('0x2a')];var _0x4c424a=_0x5ab526?0x0:_0x5439f7[_0x6487('0x28')];var _0x3c4411=_0x5ab526?_0x44bb48[_0x6487('0x2a')]:_0x5439f7[_0x6487('0x28')]+_0x5439f7[_0x6487('0x2b')];var _0x8b42e5;if(_0x3c4411>=_0x31ede3){_0x3c4411=_0x31ede3;_0x8b42e5=0xc8;}else{_0x8b42e5=0xce;}_0x392e60['status'](_0x8b42e5);return _0x392e60[_0x6487('0x2c')](_0x6487('0x2d'),_0x4c424a+'-'+_0x3c4411+'/'+_0x31ede3)['json'](_0x44bb48);}return null;};}function patchUpdates(_0x38126a){return function(_0x2920a9){try{jsonpatch[_0x6487('0x2e')](_0x2920a9,_0x38126a,!![]);}catch(_0x28880a){return BPromise[_0x6487('0x2f')](_0x28880a);}return _0x2920a9[_0x6487('0x30')]();};}function saveUpdates(_0x21aff9,_0x5d5bae){return function(_0x20b6d4){if(_0x20b6d4){return _0x20b6d4['update'](_0x21aff9)[_0x6487('0x31')](function(_0x4d5c04){return _0x4d5c04;});}return null;};}function removeEntity(_0x50085d,_0x4c2c75){return function(_0x50d88e){if(_0x50d88e){return _0x50d88e[_0x6487('0x32')]()[_0x6487('0x31')](function(){_0x50085d[_0x6487('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c9393,_0x5a31c5){return function(_0x1415b1){if(!_0x1415b1){_0x1c9393[_0x6487('0x33')](0x194);}return _0x1415b1;};}function handleError(_0x3d311f,_0x3e5174){_0x3e5174=_0x3e5174||0x1f4;return function(_0x1bbe0b){logger['error'](_0x1bbe0b[_0x6487('0x34')]);if(_0x1bbe0b['name']){delete _0x1bbe0b[_0x6487('0x35')];}_0x3d311f[_0x6487('0x25')](_0x3e5174)[_0x6487('0x36')](_0x1bbe0b);};}exports[_0x6487('0x37')]=function(_0x57d31b,_0x420516){var _0x30c609={},_0x1ec01b={},_0x530c21={'count':0x0,'rows':[]};var _0x53e715=_[_0x6487('0x38')](db['Setting'][_0x6487('0x39')],function(_0x175a9c){return{'name':_0x175a9c[_0x6487('0x3a')],'type':_0x175a9c['type'][_0x6487('0x3b')]};});_0x1ec01b[_0x6487('0x3c')]=_[_0x6487('0x38')](_0x53e715,_0x6487('0x35'));_0x1ec01b[_0x6487('0x3d')]=_[_0x6487('0x3e')](_0x57d31b[_0x6487('0x3d')]);_0x1ec01b['filters']=_[_0x6487('0x3f')](_0x1ec01b[_0x6487('0x3c')],_0x1ec01b[_0x6487('0x3d')]);_0x30c609['attributes']=_[_0x6487('0x3f')](_0x1ec01b['model'],qs[_0x6487('0x40')](_0x57d31b['query'][_0x6487('0x40')]));_0x30c609['attributes']=_0x30c609[_0x6487('0x41')][_0x6487('0x42')]?_0x30c609[_0x6487('0x41')]:_0x1ec01b[_0x6487('0x3c')];if(!_0x57d31b[_0x6487('0x3d')][_0x6487('0x43')](_0x6487('0x44'))){_0x30c609[_0x6487('0x2b')]=qs['limit'](_0x57d31b[_0x6487('0x3d')][_0x6487('0x2b')]);_0x30c609[_0x6487('0x28')]=qs[_0x6487('0x28')](_0x57d31b[_0x6487('0x3d')][_0x6487('0x28')]);}_0x30c609['order']=qs[_0x6487('0x45')](_0x57d31b[_0x6487('0x3d')]['sort']);_0x30c609[_0x6487('0x46')]=qs[_0x6487('0x47')](_[_0x6487('0x48')](_0x57d31b[_0x6487('0x3d')],_0x1ec01b[_0x6487('0x47')]),_0x53e715);if(_0x57d31b[_0x6487('0x3d')][_0x6487('0x49')]){_0x30c609[_0x6487('0x46')]=_[_0x6487('0x4a')](_0x30c609['where'],{'$or':_[_0x6487('0x38')](_0x53e715,function(_0x11b9c5){if(_0x11b9c5[_0x6487('0x4b')]!=='VIRTUAL'){var _0x497f46={};_0x497f46[_0x11b9c5[_0x6487('0x35')]]={'$like':'%'+_0x57d31b[_0x6487('0x3d')][_0x6487('0x49')]+'%'};return _0x497f46;}})});}_0x30c609=_[_0x6487('0x4a')]({},_0x30c609,_0x57d31b[_0x6487('0x4c')]);var _0x5e1193={'where':_0x30c609['where']};return db[_0x6487('0x4d')]['count'](_0x5e1193)[_0x6487('0x31')](function(_0x318db5){_0x530c21[_0x6487('0x2a')]=_0x318db5;if(_0x57d31b[_0x6487('0x3d')][_0x6487('0x4e')]){_0x30c609[_0x6487('0x4f')]=[{'all':!![]}];}return db[_0x6487('0x4d')][_0x6487('0x50')](_0x30c609);})[_0x6487('0x31')](function(_0x1e8ae7){_0x530c21[_0x6487('0x51')]=_0x1e8ae7;return _0x530c21;})[_0x6487('0x31')](respondWithFilteredResult(_0x420516,_0x30c609))['catch'](handleError(_0x420516,null));};exports[_0x6487('0x52')]=function(_0x5923f4,_0x3c5abe){var _0x2c4272={'raw':![],'where':{'id':_0x5923f4[_0x6487('0x53')]['id']}},_0x46c3dd={};_0x46c3dd[_0x6487('0x3c')]=_[_0x6487('0x3e')](db[_0x6487('0x4d')][_0x6487('0x39')]);_0x46c3dd[_0x6487('0x3d')]=_[_0x6487('0x3e')](_0x5923f4[_0x6487('0x3d')]);_0x46c3dd[_0x6487('0x47')]=_[_0x6487('0x3f')](_0x46c3dd[_0x6487('0x3c')],_0x46c3dd[_0x6487('0x3d')]);_0x2c4272[_0x6487('0x41')]=_[_0x6487('0x3f')](_0x46c3dd[_0x6487('0x3c')],qs[_0x6487('0x40')](_0x5923f4['query'][_0x6487('0x40')]));_0x2c4272[_0x6487('0x41')]=_0x2c4272['attributes'][_0x6487('0x42')]?_0x2c4272[_0x6487('0x41')]:_0x46c3dd[_0x6487('0x3c')];if(_0x5923f4[_0x6487('0x3d')]['includeAll']){_0x2c4272[_0x6487('0x4f')]=[{'all':!![]}];}_0x2c4272=_[_0x6487('0x4a')]({},_0x2c4272,_0x5923f4[_0x6487('0x4c')]);return db[_0x6487('0x4d')][_0x6487('0x54')](_0x2c4272)[_0x6487('0x31')](handleEntityNotFound(_0x3c5abe,null))[_0x6487('0x31')](respondWithResult(_0x3c5abe,null))['catch'](handleError(_0x3c5abe,null));};exports[_0x6487('0x55')]=function(_0x1ac358,_0x409ec9){if(_0x1ac358[_0x6487('0x56')]['id']){delete _0x1ac358[_0x6487('0x56')]['id'];}return db[_0x6487('0x4d')][_0x6487('0x54')]({'where':{'id':_0x1ac358[_0x6487('0x53')]['id']}})[_0x6487('0x31')](handleEntityNotFound(_0x409ec9,null))[_0x6487('0x31')](saveUpdates(_0x1ac358[_0x6487('0x56')],null))['then'](respondWithResult(_0x409ec9,null))[_0x6487('0x24')](handleError(_0x409ec9,null));};exports['addLogo']=function(_0xe1f349,_0x1b9151,_0x3cfbd2){if(_0xe1f349[_0x6487('0x57')]&&_0xe1f349[_0x6487('0x57')][_0x6487('0x58')]){_0xe1f349[_0x6487('0x56')][_0x6487('0x59')]=_0xe1f349['file']['filename'];}return db[_0x6487('0x4d')][_0x6487('0x54')]({'where':{'id':_0xe1f349['params']['id']}})[_0x6487('0x31')](handleEntityNotFound(_0x1b9151,null))[_0x6487('0x31')](saveUpdates(_0xe1f349[_0x6487('0x56')],null))[_0x6487('0x31')](respondWithResult(_0x1b9151,null))[_0x6487('0x24')](handleError(_0x1b9151,null));};exports[_0x6487('0x5a')]=function(_0x409ede,_0x5296dd,_0x52b944){if(_0x409ede['file']&&_0x409ede['file']['filename']){_0x409ede[_0x6487('0x56')][_0x6487('0x5b')]=_0x409ede[_0x6487('0x57')][_0x6487('0x58')];}return db[_0x6487('0x4d')][_0x6487('0x54')]({'where':{'id':_0x409ede[_0x6487('0x53')]['id']}})[_0x6487('0x31')](handleEntityNotFound(_0x5296dd,null))['then'](saveUpdates(_0x409ede['body'],null))[_0x6487('0x31')](respondWithResult(_0x5296dd,null))[_0x6487('0x24')](handleError(_0x5296dd,null));};var utilLicense=require(_0x6487('0x17'));exports[_0x6487('0x5c')]=function(_0x3b4130,_0x14ae3a,_0x2f90c9){var _0xce3a79='server/files/images/logos';var _0x221f57={'custom':![]};return utilLicense[_0x6487('0x5d')]()[_0x6487('0x31')](function(_0x124c19){if(_0x124c19){_0x221f57=_0x124c19;}return db[_0x6487('0x4d')][_0x6487('0x54')]({'where':{'id':_0x3b4130[_0x6487('0x53')]['id']},'attributes':[_0x6487('0x59'),'loginLogo','preferred',_0x6487('0x5e'),_0x6487('0x5f'),_0x6487('0x60'),_0x6487('0x61'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x14ae3a,null))[_0x6487('0x31')](function(_0x435fff){if(_0x435fff){var _0x4691e4=_0x435fff[_0x6487('0x59')]&&fs[_0x6487('0x62')](path[_0x6487('0x63')](config[_0x6487('0x64')],_0xce3a79,_[_0x6487('0x65')](_0x435fff[_0x6487('0x59')])))?path[_0x6487('0x63')](config['root'],_0xce3a79,_[_0x6487('0x65')](_0x435fff[_0x6487('0x59')])):path[_0x6487('0x63')](config[_0x6487('0x64')],_0xce3a79,_[_0x6487('0x65')](_0x6487('0x66')));var _0x34a484=_0x6487('0x67')+_['upperFirst'](_0x6487('0x59'));if(_0x435fff[_0x34a484]||!_0x221f57['custom']){_0x4691e4=path[_0x6487('0x63')](config[_0x6487('0x64')],_0xce3a79,_[_0x6487('0x65')](_0x6487('0x66')));}if(!fs[_0x6487('0x62')](_0x4691e4)){throw new db['Sequelize']['ValidationError'](_[_0x6487('0x68')](_0x6487('0x59'))+_0x6487('0x69'));}return _0x14ae3a[_0x6487('0x6a')](_0x4691e4);}})[_0x6487('0x24')](handleError(_0x14ae3a,null));};var utilLicense=require(_0x6487('0x17'));exports[_0x6487('0x6b')]=function(_0x374054,_0x168f0d,_0x395db7){var _0x2db80a=_0x6487('0x6c');var _0x2bedfe={'custom':![]};return utilLicense[_0x6487('0x5d')]()[_0x6487('0x31')](function(_0x49fe2c){if(_0x49fe2c){_0x2bedfe=_0x49fe2c;}return db[_0x6487('0x4d')][_0x6487('0x54')]({'where':{'id':_0x374054[_0x6487('0x53')]['id']},'attributes':[_0x6487('0x59'),'loginLogo',_0x6487('0x6d'),'favicon',_0x6487('0x5f'),_0x6487('0x60'),_0x6487('0x61'),_0x6487('0x6e')],'raw':!![]});})[_0x6487('0x31')](handleEntityNotFound(_0x168f0d,null))[_0x6487('0x31')](function(_0x1fa737){if(_0x1fa737){var _0x17aeb8=_0x1fa737[_0x6487('0x5b')]&&fs['existsSync'](path[_0x6487('0x63')](config['root'],_0x2db80a,_['toLower'](_0x1fa737[_0x6487('0x5b')])))?path[_0x6487('0x63')](config['root'],_0x2db80a,_[_0x6487('0x65')](_0x1fa737[_0x6487('0x5b')])):path['join'](config[_0x6487('0x64')],_0x2db80a,_[_0x6487('0x65')](_0x6487('0x6f')));var _0x2d6612='default'+_[_0x6487('0x68')]('loginLogo');if(_0x1fa737[_0x2d6612]||!_0x2bedfe[_0x6487('0x70')]){_0x17aeb8=path['join'](config[_0x6487('0x64')],_0x2db80a,_['toLower'](_0x6487('0x6f')));}if(!fs[_0x6487('0x62')](_0x17aeb8)){throw new db['Sequelize'][(_0x6487('0x71'))](_[_0x6487('0x68')](_0x6487('0x5b'))+'\x20not\x20found');}return _0x168f0d[_0x6487('0x6a')](_0x17aeb8);}})[_0x6487('0x24')](handleError(_0x168f0d,null));};exports[_0x6487('0x72')]=function(_0x55bd4f,_0x349aa0){return db[_0x6487('0x4d')][_0x6487('0x54')]({'where':{'id':_0x55bd4f[_0x6487('0x53')]['id']},'attributes':[_0x6487('0x73')]})[_0x6487('0x31')](respondWithResult(_0x349aa0,null))[_0x6487('0x24')](handleError(_0x349aa0,null));};exports['addPreferred']=function(_0x442006,_0x51d879,_0x326c45){if(_0x442006[_0x6487('0x57')]&&_0x442006[_0x6487('0x57')][_0x6487('0x58')]){_0x442006[_0x6487('0x56')][_0x6487('0x6d')]=_0x442006[_0x6487('0x57')][_0x6487('0x58')];}return db[_0x6487('0x4d')]['find']({'where':{'id':_0x442006[_0x6487('0x53')]['id']}})['then'](handleEntityNotFound(_0x51d879,null))[_0x6487('0x31')](saveUpdates(_0x442006[_0x6487('0x56')],null))['then'](respondWithResult(_0x51d879,null))[_0x6487('0x24')](handleError(_0x51d879,null));};var utilLicense=require(_0x6487('0x17'));exports['getPreferred']=function(_0x173337,_0x1d7152,_0x382250){var _0x9aa4c1=_0x6487('0x6c');var _0x35d782={'custom':![]};return utilLicense['getLicense']()[_0x6487('0x31')](function(_0x41853b){if(_0x41853b){_0x35d782=_0x41853b;}return db['Setting']['find']({'where':{'id':_0x173337['params']['id']},'attributes':['logo',_0x6487('0x5b'),_0x6487('0x6d'),_0x6487('0x5e'),_0x6487('0x5f'),'defaultLoginLogo',_0x6487('0x61'),_0x6487('0x6e')],'raw':!![]});})['then'](handleEntityNotFound(_0x1d7152,null))[_0x6487('0x31')](function(_0x49ecc2){if(_0x49ecc2){var _0x5118f0=_0x49ecc2['preferred']&&fs[_0x6487('0x62')](path['join'](config[_0x6487('0x64')],_0x9aa4c1,_['toLower'](_0x49ecc2[_0x6487('0x6d')])))?path['join'](config[_0x6487('0x64')],_0x9aa4c1,_[_0x6487('0x65')](_0x49ecc2[_0x6487('0x6d')])):path['join'](config[_0x6487('0x64')],_0x9aa4c1,_[_0x6487('0x65')]('default_preferred.png'));var _0x3029f9='default'+_[_0x6487('0x68')]('preferred');if(_0x49ecc2[_0x3029f9]||!_0x35d782[_0x6487('0x70')]||!_0x35d782[_0x6487('0x6d')]){_0x5118f0=path[_0x6487('0x63')](config[_0x6487('0x64')],_0x9aa4c1,_['toLower'](_0x6487('0x74')));}if(!fs[_0x6487('0x62')](_0x5118f0)){throw new db[(_0x6487('0x75'))]['ValidationError'](_['upperFirst'](_0x6487('0x6d'))+_0x6487('0x69'));}return _0x1d7152[_0x6487('0x6a')](_0x5118f0);}})['catch'](handleError(_0x1d7152,null));};exports[_0x6487('0x76')]=function(_0x2ad90e,_0x91ecac,_0x4d7e83){if(_0x2ad90e[_0x6487('0x57')]&&_0x2ad90e[_0x6487('0x57')][_0x6487('0x58')]){_0x2ad90e[_0x6487('0x56')][_0x6487('0x5e')]=_0x2ad90e[_0x6487('0x57')][_0x6487('0x58')];}return db[_0x6487('0x4d')]['find']({'where':{'id':_0x2ad90e[_0x6487('0x53')]['id']}})['then'](handleEntityNotFound(_0x91ecac,null))[_0x6487('0x31')](saveUpdates(_0x2ad90e[_0x6487('0x56')],null))[_0x6487('0x31')](respondWithResult(_0x91ecac,null))['catch'](handleError(_0x91ecac,null));};var utilLicense=require(_0x6487('0x17'));exports[_0x6487('0x77')]=function(_0x392455,_0x3d5adb,_0x5731ba){var _0x57fb13='server/files/images/logos';var _0x463cce={'custom':![]};return utilLicense[_0x6487('0x5d')]()['then'](function(_0x56bdfe){if(_0x56bdfe){_0x463cce=_0x56bdfe;}return db[_0x6487('0x4d')][_0x6487('0x54')]({'where':{'id':_0x392455[_0x6487('0x53')]['id']},'attributes':[_0x6487('0x59'),'loginLogo',_0x6487('0x6d'),'favicon',_0x6487('0x5f'),'defaultLoginLogo',_0x6487('0x61'),'defaultFavicon'],'raw':!![]});})[_0x6487('0x31')](handleEntityNotFound(_0x3d5adb,null))['then'](function(_0x57fce7){if(_0x57fce7){var _0x32b4e2=_0x57fce7[_0x6487('0x5e')]&&fs[_0x6487('0x62')](path[_0x6487('0x63')](config[_0x6487('0x64')],_0x57fb13,_[_0x6487('0x65')](_0x57fce7[_0x6487('0x5e')])))?path[_0x6487('0x63')](config[_0x6487('0x64')],_0x57fb13,_[_0x6487('0x65')](_0x57fce7['favicon'])):path[_0x6487('0x63')](config[_0x6487('0x64')],_0x57fb13,_['toLower'](_0x6487('0x78')));var _0x4b5930=_0x6487('0x67')+_[_0x6487('0x68')](_0x6487('0x5e'));if(_0x57fce7[_0x4b5930]||!_0x463cce[_0x6487('0x70')]){_0x32b4e2=path[_0x6487('0x63')](config[_0x6487('0x64')],_0x57fb13,_[_0x6487('0x65')](_0x6487('0x78')));}if(!fs['existsSync'](_0x32b4e2)){throw new db[(_0x6487('0x75'))][(_0x6487('0x71'))](_[_0x6487('0x68')](_0x6487('0x5e'))+_0x6487('0x69'));}return _0x3d5adb[_0x6487('0x6a')](_0x32b4e2);}})[_0x6487('0x24')](handleError(_0x3d5adb,null));};exports['getDate']=function(_0x3336fa,_0x22c1f6){var _0x565e78={'offset':moment()['utcOffset']()};_0x565e78['now']=moment()[_0x6487('0x79')](_0x565e78['offset'])['format'](_0x6487('0x7a'));return _0x22c1f6['status'](0xc8)[_0x6487('0x36')](_0x565e78);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 07a0e85..ba1647b 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(_0x40e071,_0x46e70d){var _0x445750=function(_0x34d471){while(--_0x34d471){_0x40e071['push'](_0x40e071['shift']());}};_0x445750(++_0x46e70d);}(_0xe14b,0x93));var _0xbe14=function(_0x1bb26e,_0x2de2e9){_0x1bb26e=_0x1bb26e-0x0;var _0x1866d0=_0xe14b[_0x1bb26e];return _0x1866d0;};'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 _0x9957=['exports','define','Setting','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./setting.attributes'];(function(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'settings','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 69b97b9..8c50464 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 _0x5be3=['Setting','options','raw','include','map','model','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowSetting'];(function(_0x3e6370,_0x72cdbe){var _0x349dd7=function(_0x223971){while(--_0x223971){_0x3e6370['push'](_0x3e6370['shift']());}};_0x349dd7(++_0x72cdbe);}(_0x5be3,0xe7));var _0x35be=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5be3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x35be('0x0'));var util=require(_0x35be('0x1'));var moment=require(_0x35be('0x2'));var BPromise=require(_0x35be('0x3'));var rs=require(_0x35be('0x4'));var fs=require('fs');var Redis=require(_0x35be('0x5'));var db=require(_0x35be('0x6'))['db'];var utils=require(_0x35be('0x7'));var logger=require(_0x35be('0x8'))(_0x35be('0x9'));var config=require(_0x35be('0xa'));var jayson=require(_0x35be('0xb'));var client=jayson['client'][_0x35be('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1af29f,_0x5174ad,_0x209038){return new BPromise(function(_0xa4240d,_0x2ece68){return client[_0x35be('0xd')](_0x1af29f,_0x209038)['then'](function(_0x113481){logger[_0x35be('0xe')](_0x35be('0xf'),_0x5174ad,_0x35be('0x10'));logger[_0x35be('0x11')](_0x35be('0x12'),_0x5174ad,_0x35be('0x10'),JSON[_0x35be('0x13')](_0x113481));if(_0x113481[_0x35be('0x14')]){if(_0x113481[_0x35be('0x14')]['code']===0x1f4){logger[_0x35be('0x14')](_0x35be('0xf'),_0x5174ad,_0x113481[_0x35be('0x14')][_0x35be('0x15')]);return _0x2ece68(_0x113481[_0x35be('0x14')]['message']);}logger[_0x35be('0x14')](_0x35be('0xf'),_0x5174ad,_0x113481[_0x35be('0x14')][_0x35be('0x15')]);return _0xa4240d(_0x113481[_0x35be('0x14')][_0x35be('0x15')]);}else{logger[_0x35be('0xe')](_0x35be('0xf'),_0x5174ad,'request\x20sent');_0xa4240d(_0x113481[_0x35be('0x16')]['message']);}})[_0x35be('0x17')](function(_0x5bd96a){logger[_0x35be('0x14')](_0x35be('0xf'),_0x5174ad,_0x5bd96a);_0x2ece68(_0x5bd96a);});});}exports[_0x35be('0x18')]=function(_0xd270e4){var _0x45a883=this;return new Promise(function(_0x2048e2,_0x48b309){return db[_0x35be('0x19')]['find']({'raw':_0xd270e4[_0x35be('0x1a')]?_0xd270e4[_0x35be('0x1a')][_0x35be('0x1b')]===undefined?!![]:![]:!![],'where':_0xd270e4[_0x35be('0x1a')]?_0xd270e4[_0x35be('0x1a')]['where']||null:null,'attributes':_0xd270e4[_0x35be('0x1a')]?_0xd270e4[_0x35be('0x1a')]['attributes']||null:null,'include':_0xd270e4[_0x35be('0x1a')]?_0xd270e4[_0x35be('0x1a')][_0x35be('0x1c')]?_[_0x35be('0x1d')](_0xd270e4['options'][_0x35be('0x1c')],function(_0x2af771){return{'model':db[_0x2af771[_0x35be('0x1e')]],'as':_0x2af771['as'],'attributes':_0x2af771['attributes'],'include':_0x2af771[_0x35be('0x1c')]?_['map'](_0x2af771[_0x35be('0x1c')],function(_0x332bd9){return{'model':db[_0x332bd9[_0x35be('0x1e')]],'as':_0x332bd9['as'],'attributes':_0x332bd9[_0x35be('0x1f')],'include':_0x332bd9[_0x35be('0x1c')]?_[_0x35be('0x1d')](_0x332bd9['include'],function(_0xb56b45){return{'model':db[_0xb56b45[_0x35be('0x1e')]],'as':_0xb56b45['as'],'attributes':_0xb56b45[_0x35be('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x501fdc){logger['info'](_0x35be('0x18'),_0xd270e4);logger[_0x35be('0x11')](_0x35be('0x18'),_0xd270e4,JSON[_0x35be('0x13')](_0x501fdc));_0x2048e2(_0x501fdc);})['catch'](function(_0x3e07d8){logger['error']('ShowSetting',_0x3e07d8[_0x35be('0x15')],_0xd270e4);_0x48b309(_0x45a883['error'](0x1f4,_0x3e07d8[_0x35be('0x15')]));});});}; \ No newline at end of file +var _0x4737=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','result','ShowSetting','Setting','find','options','where','attributes','include','map','model','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x5a79e2,_0x319b1a){var _0x266c45=function(_0x172478){while(--_0x172478){_0x5a79e2['push'](_0x5a79e2['shift']());}};_0x266c45(++_0x319b1a);}(_0x4737,0xe9));var _0x7473=function(_0x1b72f2,_0x858506){_0x1b72f2=_0x1b72f2-0x0;var _0x5a6ceb=_0x4737[_0x1b72f2];return _0x5a6ceb;};'use strict';var _=require(_0x7473('0x0'));var util=require(_0x7473('0x1'));var moment=require(_0x7473('0x2'));var BPromise=require(_0x7473('0x3'));var rs=require(_0x7473('0x4'));var fs=require('fs');var Redis=require(_0x7473('0x5'));var db=require(_0x7473('0x6'))['db'];var utils=require(_0x7473('0x7'));var logger=require(_0x7473('0x8'))(_0x7473('0x9'));var config=require(_0x7473('0xa'));var jayson=require(_0x7473('0xb'));var client=jayson[_0x7473('0xc')][_0x7473('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x468150,_0x674570,_0x287500){return new BPromise(function(_0x49f1a2,_0x2034bb){return client[_0x7473('0xe')](_0x468150,_0x287500)[_0x7473('0xf')](function(_0x4d415d){logger[_0x7473('0x10')](_0x7473('0x11'),_0x674570,'request\x20sent');logger[_0x7473('0x12')]('Setting,\x20%s,\x20%s,\x20%s',_0x674570,'request\x20sent',JSON[_0x7473('0x13')](_0x4d415d));if(_0x4d415d[_0x7473('0x14')]){if(_0x4d415d[_0x7473('0x14')]['code']===0x1f4){logger[_0x7473('0x14')]('Setting,\x20%s,\x20%s',_0x674570,_0x4d415d[_0x7473('0x14')]['message']);return _0x2034bb(_0x4d415d['error'][_0x7473('0x15')]);}logger[_0x7473('0x14')]('Setting,\x20%s,\x20%s',_0x674570,_0x4d415d[_0x7473('0x14')][_0x7473('0x15')]);return _0x49f1a2(_0x4d415d[_0x7473('0x14')][_0x7473('0x15')]);}else{logger[_0x7473('0x10')](_0x7473('0x11'),_0x674570,_0x7473('0x16'));_0x49f1a2(_0x4d415d[_0x7473('0x17')][_0x7473('0x15')]);}})['catch'](function(_0x4e06d8){logger['error']('Setting,\x20%s,\x20%s',_0x674570,_0x4e06d8);_0x2034bb(_0x4e06d8);});});}exports[_0x7473('0x18')]=function(_0x60c5ce){var _0xcc6263=this;return new Promise(function(_0x33b3c5,_0x121194){return db[_0x7473('0x19')][_0x7473('0x1a')]({'raw':_0x60c5ce[_0x7473('0x1b')]?_0x60c5ce[_0x7473('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x60c5ce['options']?_0x60c5ce[_0x7473('0x1b')][_0x7473('0x1c')]||null:null,'attributes':_0x60c5ce['options']?_0x60c5ce['options'][_0x7473('0x1d')]||null:null,'include':_0x60c5ce[_0x7473('0x1b')]?_0x60c5ce[_0x7473('0x1b')][_0x7473('0x1e')]?_[_0x7473('0x1f')](_0x60c5ce[_0x7473('0x1b')]['include'],function(_0xed4c4a){return{'model':db[_0xed4c4a[_0x7473('0x20')]],'as':_0xed4c4a['as'],'attributes':_0xed4c4a['attributes'],'include':_0xed4c4a[_0x7473('0x1e')]?_[_0x7473('0x1f')](_0xed4c4a['include'],function(_0x3a99d8){return{'model':db[_0x3a99d8[_0x7473('0x20')]],'as':_0x3a99d8['as'],'attributes':_0x3a99d8[_0x7473('0x1d')],'include':_0x3a99d8[_0x7473('0x1e')]?_['map'](_0x3a99d8[_0x7473('0x1e')],function(_0x5ec6c4){return{'model':db[_0x5ec6c4[_0x7473('0x20')]],'as':_0x5ec6c4['as'],'attributes':_0x5ec6c4[_0x7473('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7473('0xf')](function(_0x2c04d5){logger['info'](_0x7473('0x18'),_0x60c5ce);logger['debug']('ShowSetting',_0x60c5ce,JSON[_0x7473('0x13')](_0x2c04d5));_0x33b3c5(_0x2c04d5);})[_0x7473('0x21')](function(_0x148e14){logger['error'](_0x7473('0x18'),_0x148e14[_0x7473('0x15')],_0x60c5ce);_0x121194(_0xcc6263[_0x7473('0x14')](0x1f4,_0x148e14['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 599faba..f67c49e 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 _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(_0x36dd93,_0x369285){var _0x365304=function(_0x39d5ee){while(--_0x39d5ee){_0x36dd93['push'](_0x36dd93['shift']());}};_0x365304(++_0x369285);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0xc4aa[_0x4792c8];return _0x35edb1;};'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 +var _0xe14b=['./smsAccount.controller','get','isAuthenticated','index','/describe','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','/:id/send','send','put','update','/:id','destroy','removeDispositions','delete','/:id/users','removeAgents','multer','util','express','Router','../../components/auth/service'];(function(_0xd60ec9,_0x4c62fd){var _0x4a6c4b=function(_0x3d27cd){while(--_0x3d27cd){_0xd60ec9['push'](_0xd60ec9['shift']());}};_0x4a6c4b(++_0x4c62fd);}(_0xe14b,0x93));var _0xbe14=function(_0x4f0b8d,_0x388f85){_0x4f0b8d=_0x4f0b8d-0x0;var _0x16a1d2=_0xe14b[_0x4f0b8d];return _0x16a1d2;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['describe']);router['get']('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0x6')](_0xbe14('0xb'),auth['isAuthenticated'](),controller['getDispositions']);router[_0xbe14('0x6')](_0xbe14('0xc'),auth['isAuthenticated'](),controller[_0xbe14('0xd')]);router[_0xbe14('0x6')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xf')]);router[_0xbe14('0x6')](_0xbe14('0x10'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x11')]);router[_0xbe14('0x6')](_0xbe14('0x12'),controller[_0xbe14('0x13')]);router[_0xbe14('0x6')]('/:id/users',auth['isAuthenticated'](),controller[_0xbe14('0x14')]);router[_0xbe14('0x15')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x16')]);router['post'](_0xbe14('0xb'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x17')]);router[_0xbe14('0x15')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x18')]);router['post'](_0xbe14('0x19'),controller[_0xbe14('0x1a')]);router[_0xbe14('0x15')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x1b')]);router['post'](_0xbe14('0x1c'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x1d')]);router[_0xbe14('0x15')](_0xbe14('0x12'),controller['status']);router[_0xbe14('0x15')]('/:id/users',auth[_0xbe14('0x7')](),controller['addAgents']);router[_0xbe14('0x1e')]('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0x1f')]);router['delete'](_0xbe14('0x20'),auth['isAuthenticated'](),controller[_0xbe14('0x21')]);router['delete'](_0xbe14('0xb'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x22')]);router[_0xbe14('0x23')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller['removeAnswers']);router[_0xbe14('0x23')](_0xbe14('0x24'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x25')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index d3a016e..d03b88c 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 _0x7c27=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','STRING','name','generate','ENUM','twilio','skebby','clicksend','plivo','clickatell','bandwidth','csc','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x466aeb,_0x3a35bf){var _0x57818e=function(_0x28ac49){while(--_0x28ac49){_0x466aeb['push'](_0x466aeb['shift']());}};_0x57818e(++_0x3a35bf);}(_0x7c27,0x18f));var _0x77c2=function(_0x38b899,_0x569bf6){_0x38b899=_0x38b899-0x0;var _0x363231=_0x7c27[_0x38b899];return _0x363231;};'use strict';var Sequelize=require(_0x77c2('0x0'));var rs=require(_0x77c2('0x1'));module['exports']={'name':{'type':Sequelize[_0x77c2('0x2')],'unique':_0x77c2('0x3'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x77c2('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x77c2('0x2')],'defaultValue':function(){return rs[_0x77c2('0x4')]();}},'phone':{'type':Sequelize[_0x77c2('0x2')]},'type':{'type':Sequelize[_0x77c2('0x5')](_0x77c2('0x6'),_0x77c2('0x7'),'connectel',_0x77c2('0x8'),_0x77c2('0x9'),_0x77c2('0xa'),_0x77c2('0xb'),_0x77c2('0xc'),'infobip',_0x77c2('0xd'))},'accountSid':{'type':Sequelize[_0x77c2('0x2')]},'authId':{'type':Sequelize[_0x77c2('0x2')]},'authToken':{'type':Sequelize[_0x77c2('0x2')]},'smsMethod':{'type':Sequelize[_0x77c2('0x5')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x77c2('0x2')]},'applicationId':{'type':Sequelize[_0x77c2('0x2')]},'accountId':{'type':Sequelize[_0x77c2('0x2')]},'senderString':{'type':Sequelize[_0x77c2('0x2')]},'deliveryReport':{'type':Sequelize[_0x77c2('0xe')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x77c2('0xf')],'defaultValue':function(){return _0x77c2('0x10');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x77c2('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x77c2('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x77c2('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x77c2('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x77c2('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x77c2('0x11')],'comment':_0x77c2('0x12')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x503a15){if(!_0x503a15)this[_0x77c2('0x13')](_0x77c2('0x14'),null);this[_0x77c2('0x13')](_0x77c2('0x15'),_0x503a15);}}}; \ No newline at end of file +var _0xf943=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','generate','ENUM','twilio','skebby','clicksend','bandwidth','csc','infobip','intelepeer','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x1f44e4,_0x22d9fd){var _0x591989=function(_0x3aeb88){while(--_0x3aeb88){_0x1f44e4['push'](_0x1f44e4['shift']());}};_0x591989(++_0x22d9fd);}(_0xf943,0x1be));var _0x3f94=function(_0x279c63,_0x4af503){_0x279c63=_0x279c63-0x0;var _0x307571=_0xf943[_0x279c63];return _0x307571;};'use strict';var Sequelize=require(_0x3f94('0x0'));var rs=require('randomstring');module[_0x3f94('0x1')]={'name':{'type':Sequelize[_0x3f94('0x2')],'unique':_0x3f94('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x3f94('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x3f94('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x3f94('0x2')],'defaultValue':function(){return rs[_0x3f94('0x4')]();}},'phone':{'type':Sequelize[_0x3f94('0x2')]},'type':{'type':Sequelize[_0x3f94('0x5')](_0x3f94('0x6'),_0x3f94('0x7'),'connectel',_0x3f94('0x8'),'plivo','clickatell',_0x3f94('0x9'),_0x3f94('0xa'),_0x3f94('0xb'),_0x3f94('0xc'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0x3f94('0x2')]},'authToken':{'type':Sequelize[_0x3f94('0x2')]},'smsMethod':{'type':Sequelize[_0x3f94('0x5')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x3f94('0x2')]},'apiKey':{'type':Sequelize[_0x3f94('0x2')]},'applicationId':{'type':Sequelize[_0x3f94('0x2')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x3f94('0x2')]},'notificationTemplate':{'type':Sequelize[_0x3f94('0xd')],'defaultValue':function(){return _0x3f94('0xe');}},'notificationSound':{'type':Sequelize[_0x3f94('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x3f94('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x3f94('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3f94('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3f94('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3f94('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x3f94('0x11')},'mandatoryDisposition':{'type':Sequelize[_0x3f94('0xf')],'defaultValue':![],'comment':_0x3f94('0x12'),'set':function(_0x4c973d){if(!_0x4c973d)this[_0x3f94('0x13')](_0x3f94('0x14'),null);this[_0x3f94('0x13')](_0x3f94('0x15'),_0x4c973d);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 93fe7b4..95004db 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 _0x5e4a=['color','tag','List','out','user','SmsMessage','Messages','dataValues','received\x20delivery\x20report\x20from','skebby_dispatch_id','connectel','requestid','statusInt','status_code','DELIVERED','groupName','bandwidth','redif','inspect','RECEIVED_BY_RECIPIENT','message-delivered','ACCEPTD','statusGet','message-id','state','csc','addAgents','emit','userSmsAccount:save','removeAgents','isArray','getAgents','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','update','destroy','get','SmsAccounts','UserProfileResource','name','send','index','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','VIRTUAL','merge','options','includeAll','rows','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','Pause','describe','addDisposition','SmsAccountId','Disposition','include','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','pick','removeAnswers','notify','sms','SmsApplication','Applications','applications','orderBy','priority','account','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','mobile','type','twilio','From','messageId','MessageSid','skebby','from','text','clicksend','message_id','plivo','Text','MessageUUID','infobip','results','originatingAddress','clickatell','fromNumber','intelepeer','refid','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','Contacts','DESC','list','omit','defaults','contact','spread','interaction','created','autoclose','push','close','unmanaged','AttachmentId','UserId','unshift','Start','startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','set','Content-Type','text/xml','\x0a','bulkCreate','findAndCountAll','getApplications','getInteractions','SmsInteraction','User','Owner','internal','Tag','Tags'];(function(_0x19719c,_0x50fc6f){var _0x243084=function(_0x4fb6f3){while(--_0x4fb6f3){_0x19719c['push'](_0x19719c['shift']());}};_0x243084(++_0x50fc6f);}(_0x5e4a,0x100));var _0xa5e4=function(_0x55e6f5,_0x56849e){_0x55e6f5=_0x55e6f5-0x0;var _0x2f63d9=_0x5e4a[_0x55e6f5];return _0x2f63d9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa5e4('0x0'));var zipdir=require(_0xa5e4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa5e4('0x2'));var moment=require('moment');var BPromise=require(_0xa5e4('0x3'));var Mustache=require('mustache');var util=require(_0xa5e4('0x4'));var path=require(_0xa5e4('0x5'));var sox=require(_0xa5e4('0x6'));var csv=require(_0xa5e4('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa5e4('0x8'));var _=require('lodash');var squel=require(_0xa5e4('0x9'));var crypto=require(_0xa5e4('0xa'));var jsforce=require(_0xa5e4('0xb'));var deskjs=require(_0xa5e4('0xc'));var toCsv=require(_0xa5e4('0x7'));var querystring=require(_0xa5e4('0xd'));var Papa=require(_0xa5e4('0xe'));var Redis=require(_0xa5e4('0xf'));var authService=require(_0xa5e4('0x10'));var qs=require(_0xa5e4('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa5e4('0x12'));var logger=require(_0xa5e4('0x13'))(_0xa5e4('0x14'));var utils=require(_0xa5e4('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xa5e4('0x16'));var db=require(_0xa5e4('0x17'))['db'];config[_0xa5e4('0x18')]=_['defaults'](config[_0xa5e4('0x18')],{'host':_0xa5e4('0x19'),'port':0x18eb});var socket=require(_0xa5e4('0x1a'))(new Redis(config[_0xa5e4('0x18')]));require(_0xa5e4('0x1b'))[_0xa5e4('0x1c')](socket);var jayson=require(_0xa5e4('0x1d'));var client=jayson[_0xa5e4('0x1e')][_0xa5e4('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x4aabea,_0x51446a,_0x56692c,_0x21f33c){return new BPromise(function(_0x5c8f7b,_0x39bc37){var _0x1658df=_0x21f33c||client;return _0x1658df[_0xa5e4('0x20')](_0x4aabea,_0x56692c)[_0xa5e4('0x21')](function(_0x3f60aa){logger[_0xa5e4('0x22')](_0xa5e4('0x23'),_0x51446a,'request\x20sent');logger[_0xa5e4('0x24')](_0xa5e4('0x25'),_0x51446a,_0xa5e4('0x26'),JSON[_0xa5e4('0x27')](_0x3f60aa));if(_0x3f60aa[_0xa5e4('0x28')]){if(_0x3f60aa[_0xa5e4('0x28')][_0xa5e4('0x29')]===0x1f4){logger[_0xa5e4('0x28')](_0xa5e4('0x23'),_0x51446a,_0x3f60aa['error']['message']);return _0x39bc37(_0x3f60aa[_0xa5e4('0x28')]['message']);}logger['error']('SmsAccount,\x20%s,\x20%s',_0x51446a,_0x3f60aa[_0xa5e4('0x28')][_0xa5e4('0x2a')]);return _0x5c8f7b(_0x3f60aa['error'][_0xa5e4('0x2a')]);}else{logger[_0xa5e4('0x22')](_0xa5e4('0x23'),_0x51446a,'request\x20sent');_0x5c8f7b(_0x3f60aa[_0xa5e4('0x2b')][_0xa5e4('0x2a')]);}})[_0xa5e4('0x2c')](function(_0x525892){logger['error'](_0xa5e4('0x23'),_0x51446a,_0x525892);_0x39bc37(_0x525892);});});}function respondWithStatusCode(_0x41be59,_0x519d74){_0x519d74=_0x519d74||0xcc;return function(_0x514d35){if(_0x514d35){return _0x41be59[_0xa5e4('0x2d')](_0x519d74);}return _0x41be59[_0xa5e4('0x2e')](_0x519d74)[_0xa5e4('0x2f')]();};}function respondWithResult(_0x599e35,_0x9c107){_0x9c107=_0x9c107||0xc8;return function(_0x403ba7){if(_0x403ba7){return _0x599e35[_0xa5e4('0x2e')](_0x9c107)[_0xa5e4('0x30')](_0x403ba7);}};}function respondWithFilteredResult(_0x2176b7,_0x240cc3){return function(_0x1397c){if(_0x1397c){var _0x1c3e65=typeof _0x240cc3[_0xa5e4('0x31')]==='undefined'&&typeof _0x240cc3[_0xa5e4('0x32')]===_0xa5e4('0x33');var _0x494778=_0x1397c[_0xa5e4('0x34')];var _0x42e97b=_0x1c3e65?0x0:_0x240cc3[_0xa5e4('0x31')];var _0x318a20=_0x1c3e65?_0x1397c[_0xa5e4('0x34')]:_0x240cc3[_0xa5e4('0x31')]+_0x240cc3[_0xa5e4('0x32')];var _0x3c22a7;if(_0x318a20>=_0x494778){_0x318a20=_0x494778;_0x3c22a7=0xc8;}else{_0x3c22a7=0xce;}_0x2176b7[_0xa5e4('0x2e')](_0x3c22a7);return _0x2176b7['set'](_0xa5e4('0x35'),_0x42e97b+'-'+_0x318a20+'/'+_0x494778)[_0xa5e4('0x30')](_0x1397c);}return null;};}function patchUpdates(_0x463400){return function(_0x1194db){try{jsonpatch[_0xa5e4('0x36')](_0x1194db,_0x463400,!![]);}catch(_0x119704){return BPromise['reject'](_0x119704);}return _0x1194db['save']();};}function saveUpdates(_0x1c854a,_0x462c3e){return function(_0x1e0131){if(_0x1e0131){return _0x1e0131[_0xa5e4('0x37')](_0x1c854a)[_0xa5e4('0x21')](function(_0x4e0fd4){return _0x4e0fd4;});}return null;};}function removeEntity(_0x5b23f3,_0x49047e){return function(_0x51d18d){if(_0x51d18d){return _0x51d18d[_0xa5e4('0x38')]()[_0xa5e4('0x21')](function(){var _0x58bd68=_0x51d18d[_0xa5e4('0x39')]({'plain':!![]});var _0x3ad82d=_0xa5e4('0x3a');return db[_0xa5e4('0x3b')][_0xa5e4('0x38')]({'where':{'type':_0x3ad82d,'resourceId':_0x58bd68['id']}})[_0xa5e4('0x21')](function(){return _0x51d18d;});})[_0xa5e4('0x21')](function(){_0x5b23f3[_0xa5e4('0x2e')](0xcc)[_0xa5e4('0x2f')]();});}};}function handleEntityNotFound(_0x58c793,_0x64aebb){return function(_0xb70be9){if(!_0xb70be9){_0x58c793[_0xa5e4('0x2d')](0x194);}return _0xb70be9;};}function handleError(_0x30fb74,_0x4100a5){_0x4100a5=_0x4100a5||0x1f4;return function(_0x2a2540){logger['error'](_0x2a2540['stack']);if(_0x2a2540[_0xa5e4('0x3c')]){delete _0x2a2540['name'];}_0x30fb74[_0xa5e4('0x2e')](_0x4100a5)[_0xa5e4('0x3d')](_0x2a2540);};}exports[_0xa5e4('0x3e')]=function(_0x53461c,_0xc7e16e){var _0x31801f={'include':[{'model':db['Pause'],'as':_0xa5e4('0x3f')}]},_0x1dfced={},_0x411807={'count':0x0,'rows':[]};var _0xfaa408=_[_0xa5e4('0x40')](db[_0xa5e4('0x41')][_0xa5e4('0x42')],function(_0x597baf){return{'name':_0x597baf[_0xa5e4('0x43')],'type':_0x597baf['type'][_0xa5e4('0x44')]};});_0x1dfced[_0xa5e4('0x45')]=_[_0xa5e4('0x40')](_0xfaa408,_0xa5e4('0x3c'));_0x1dfced[_0xa5e4('0x46')]=_[_0xa5e4('0x47')](_0x53461c[_0xa5e4('0x46')]);_0x1dfced['filters']=_['intersection'](_0x1dfced[_0xa5e4('0x45')],_0x1dfced[_0xa5e4('0x46')]);_0x31801f[_0xa5e4('0x48')]=_[_0xa5e4('0x49')](_0x1dfced[_0xa5e4('0x45')],qs[_0xa5e4('0x4a')](_0x53461c[_0xa5e4('0x46')]['fields']));_0x31801f[_0xa5e4('0x48')]=_0x31801f[_0xa5e4('0x48')][_0xa5e4('0x4b')]?_0x31801f[_0xa5e4('0x48')]:_0x1dfced[_0xa5e4('0x45')];if(!_0x53461c['query'][_0xa5e4('0x4c')](_0xa5e4('0x4d'))){_0x31801f[_0xa5e4('0x32')]=qs[_0xa5e4('0x32')](_0x53461c['query'][_0xa5e4('0x32')]);_0x31801f[_0xa5e4('0x31')]=qs[_0xa5e4('0x31')](_0x53461c[_0xa5e4('0x46')][_0xa5e4('0x31')]);}_0x31801f[_0xa5e4('0x4e')]=qs[_0xa5e4('0x4f')](_0x53461c[_0xa5e4('0x46')][_0xa5e4('0x4f')]);_0x31801f['where']=qs[_0xa5e4('0x50')](_['pick'](_0x53461c['query'],_0x1dfced[_0xa5e4('0x50')]),_0xfaa408);if(_0x53461c['query'][_0xa5e4('0x51')]){_0x31801f[_0xa5e4('0x52')]=_['merge'](_0x31801f['where'],{'$or':_['map'](_0xfaa408,function(_0x290250){if(_0x290250['type']!==_0xa5e4('0x53')){var _0x6c5fcd={};_0x6c5fcd[_0x290250[_0xa5e4('0x3c')]]={'$like':'%'+_0x53461c['query'][_0xa5e4('0x51')]+'%'};return _0x6c5fcd;}})});}_0x31801f=_[_0xa5e4('0x54')]({},_0x31801f,_0x53461c[_0xa5e4('0x55')]);var _0x3b0749={'where':_0x31801f[_0xa5e4('0x52')]};return db['SmsAccount'][_0xa5e4('0x34')](_0x3b0749)['then'](function(_0x38f46d){_0x411807['count']=_0x38f46d;if(_0x53461c[_0xa5e4('0x46')][_0xa5e4('0x56')]){_0x31801f['include']=[{'all':!![]}];}return db[_0xa5e4('0x41')]['findAll'](_0x31801f);})[_0xa5e4('0x21')](function(_0xec1285){_0x411807[_0xa5e4('0x57')]=_0xec1285;return _0x411807;})[_0xa5e4('0x21')](respondWithFilteredResult(_0xc7e16e,_0x31801f))[_0xa5e4('0x2c')](handleError(_0xc7e16e,null));};exports['show']=function(_0x55f004,_0x1c718e){var _0x26ba1c={'raw':![],'where':{'id':_0x55f004[_0xa5e4('0x58')]['id']},'include':[{'model':db['Pause'],'as':_0xa5e4('0x3f')}]},_0xf692bb={};_0xf692bb[_0xa5e4('0x45')]=_[_0xa5e4('0x47')](db[_0xa5e4('0x41')][_0xa5e4('0x42')]);_0xf692bb[_0xa5e4('0x46')]=_[_0xa5e4('0x47')](_0x55f004[_0xa5e4('0x46')]);_0xf692bb[_0xa5e4('0x50')]=_['intersection'](_0xf692bb[_0xa5e4('0x45')],_0xf692bb[_0xa5e4('0x46')]);_0x26ba1c[_0xa5e4('0x48')]=_['intersection'](_0xf692bb[_0xa5e4('0x45')],qs[_0xa5e4('0x4a')](_0x55f004['query'][_0xa5e4('0x4a')]));_0x26ba1c[_0xa5e4('0x48')]=_0x26ba1c[_0xa5e4('0x48')]['length']?_0x26ba1c[_0xa5e4('0x48')]:_0xf692bb['model'];if(_0x55f004[_0xa5e4('0x46')][_0xa5e4('0x56')]){_0x26ba1c['include']=[{'all':!![]}];}_0x26ba1c=_['merge']({},_0x26ba1c,_0x55f004[_0xa5e4('0x55')]);return db[_0xa5e4('0x41')][_0xa5e4('0x59')](_0x26ba1c)[_0xa5e4('0x21')](handleEntityNotFound(_0x1c718e,null))[_0xa5e4('0x21')](respondWithResult(_0x1c718e,null))[_0xa5e4('0x2c')](handleError(_0x1c718e,null));};exports[_0xa5e4('0x5a')]=function(_0x5292d5,_0x52a0d5){return db[_0xa5e4('0x41')][_0xa5e4('0x5a')](_0x5292d5[_0xa5e4('0x5b')],{})[_0xa5e4('0x21')](function(_0x2db0e8){var _0x52011b=_0x5292d5['user'][_0xa5e4('0x39')]({'plain':!![]});if(!_0x52011b)throw new Error(_0xa5e4('0x5c'));if(_0x52011b[_0xa5e4('0x5d')]==='user'){var _0x37c2b4=_0x2db0e8[_0xa5e4('0x39')]({'plain':!![]});var _0xeefbf0=_0xa5e4('0x3a');return db[_0xa5e4('0x5e')][_0xa5e4('0x59')]({'where':{'name':_0xeefbf0,'userProfileId':_0x52011b[_0xa5e4('0x5f')]},'raw':!![]})[_0xa5e4('0x21')](function(_0x26f378){if(_0x26f378&&_0x26f378[_0xa5e4('0x60')]===0x0){return db[_0xa5e4('0x3b')]['create']({'name':_0x37c2b4[_0xa5e4('0x3c')],'resourceId':_0x37c2b4['id'],'type':_0x26f378[_0xa5e4('0x3c')],'sectionId':_0x26f378['id']},{})[_0xa5e4('0x21')](function(){return _0x2db0e8;});}else{return _0x2db0e8;}})[_0xa5e4('0x2c')](function(_0x2c5599){logger[_0xa5e4('0x28')](_0xa5e4('0x61'),_0x2c5599);throw _0x2c5599;});}return _0x2db0e8;})['then'](respondWithResult(_0x52a0d5,0xc9))[_0xa5e4('0x2c')](handleError(_0x52a0d5,null));};exports[_0xa5e4('0x37')]=function(_0x1e6834,_0x7fe0c9){if(_0x1e6834['body']['id']){delete _0x1e6834[_0xa5e4('0x5b')]['id'];}return db[_0xa5e4('0x41')]['find']({'where':{'id':_0x1e6834[_0xa5e4('0x58')]['id']},'include':[{'model':db[_0xa5e4('0x62')],'as':'mandatoryDispositionPause'}]})[_0xa5e4('0x21')](handleEntityNotFound(_0x7fe0c9,null))[_0xa5e4('0x21')](saveUpdates(_0x1e6834[_0xa5e4('0x5b')],null))[_0xa5e4('0x21')](respondWithResult(_0x7fe0c9,null))[_0xa5e4('0x2c')](handleError(_0x7fe0c9,null));};exports[_0xa5e4('0x38')]=function(_0xd180a,_0x560a24){return db[_0xa5e4('0x41')]['find']({'where':{'id':_0xd180a[_0xa5e4('0x58')]['id']}})[_0xa5e4('0x21')](handleEntityNotFound(_0x560a24,null))[_0xa5e4('0x21')](removeEntity(_0x560a24,null))[_0xa5e4('0x2c')](handleError(_0x560a24,null));};exports['describe']=function(_0x3be6c3,_0x3e3993){return db[_0xa5e4('0x41')][_0xa5e4('0x63')]()[_0xa5e4('0x21')](respondWithResult(_0x3e3993,null))[_0xa5e4('0x2c')](handleError(_0x3e3993,null));};exports[_0xa5e4('0x64')]=function(_0x54d971,_0x2e3dbc,_0x5b2f1e){if(_0x54d971[_0xa5e4('0x5b')]['id']){delete _0x54d971[_0xa5e4('0x5b')]['id'];}return db['SmsAccount'][_0xa5e4('0x59')]({'where':{'id':_0x54d971[_0xa5e4('0x58')]['id']}})[_0xa5e4('0x21')](handleEntityNotFound(_0x2e3dbc,null))['then'](function(_0x2183f3){if(_0x2183f3){_0x54d971[_0xa5e4('0x5b')][_0xa5e4('0x65')]=_0x2183f3['id'];return db[_0xa5e4('0x66')][_0xa5e4('0x5a')](_0x54d971[_0xa5e4('0x5b')]);}})[_0xa5e4('0x21')](respondWithResult(_0x2e3dbc,null))['catch'](handleError(_0x2e3dbc,null));};exports['getDispositions']=function(_0x519036,_0x21aa76,_0x2c9591){var _0x3097d4={'raw':![],'where':{}};var _0x107505={};var _0xe5762c={'count':0x0,'rows':[]};return db[_0xa5e4('0x41')]['findOne']({'where':{'id':_0x519036[_0xa5e4('0x58')]['id']}})[_0xa5e4('0x21')](handleEntityNotFound(_0x21aa76,null))[_0xa5e4('0x21')](function(_0x1b2c32){if(_0x1b2c32){_0x107505[_0xa5e4('0x45')]=_[_0xa5e4('0x47')](db['Disposition'][_0xa5e4('0x42')]);_0x107505[_0xa5e4('0x46')]=_['keys'](_0x519036[_0xa5e4('0x46')]);_0x107505['filters']=_[_0xa5e4('0x49')](_0x107505[_0xa5e4('0x45')],_0x107505[_0xa5e4('0x46')]);_0x3097d4['attributes']=_['intersection'](_0x107505[_0xa5e4('0x45')],qs[_0xa5e4('0x4a')](_0x519036[_0xa5e4('0x46')][_0xa5e4('0x4a')]));_0x3097d4['attributes']=_0x3097d4['attributes'][_0xa5e4('0x4b')]?_0x3097d4[_0xa5e4('0x48')]:_0x107505[_0xa5e4('0x45')];if(!_0x519036[_0xa5e4('0x46')][_0xa5e4('0x4c')]('nolimit')){_0x3097d4[_0xa5e4('0x32')]=qs[_0xa5e4('0x32')](_0x519036[_0xa5e4('0x46')]['limit']);_0x3097d4[_0xa5e4('0x31')]=qs['offset'](_0x519036[_0xa5e4('0x46')][_0xa5e4('0x31')]);}_0x3097d4[_0xa5e4('0x4e')]=qs[_0xa5e4('0x4f')](_0x519036[_0xa5e4('0x46')][_0xa5e4('0x4f')]);_0x3097d4[_0xa5e4('0x52')]=qs[_0xa5e4('0x50')](_['pick'](_0x519036[_0xa5e4('0x46')],_0x107505[_0xa5e4('0x50')]));_0x3097d4[_0xa5e4('0x52')]['SmsAccountId']=_0x1b2c32['id'];if(_0x519036[_0xa5e4('0x46')][_0xa5e4('0x51')]){_0x3097d4[_0xa5e4('0x52')]=_['merge'](_0x3097d4[_0xa5e4('0x52')],{'$or':_[_0xa5e4('0x40')](_0x3097d4[_0xa5e4('0x48')],function(_0x4c535c){var _0x1a3593={};_0x1a3593[_0x4c535c]={'$like':'%'+_0x519036['query'][_0xa5e4('0x51')]+'%'};return _0x1a3593;})});}_0x3097d4=_['merge']({},_0x3097d4,_0x519036[_0xa5e4('0x55')]);return db[_0xa5e4('0x66')][_0xa5e4('0x34')]({'where':_0x3097d4[_0xa5e4('0x52')]})[_0xa5e4('0x21')](function(_0x16d7d1){_0xe5762c['count']=_0x16d7d1;if(_0x519036[_0xa5e4('0x46')][_0xa5e4('0x56')]){_0x3097d4[_0xa5e4('0x67')]=[{'all':!![]}];}return db[_0xa5e4('0x66')][_0xa5e4('0x68')](_0x3097d4);})[_0xa5e4('0x21')](function(_0x1b6c93){_0xe5762c[_0xa5e4('0x57')]=_0x1b6c93;return _0xe5762c;});}})['then'](respondWithFilteredResult(_0x21aa76,_0x3097d4))[_0xa5e4('0x2c')](handleError(_0x21aa76,null));};exports['removeDispositions']=function(_0x5e205d,_0x45aae9,_0x5756c3){return db[_0xa5e4('0x41')][_0xa5e4('0x59')]({'where':{'id':_0x5e205d[_0xa5e4('0x58')]['id']}})[_0xa5e4('0x21')](handleEntityNotFound(_0x45aae9,null))[_0xa5e4('0x21')](function(_0x2282dd){if(_0x2282dd){return _0x2282dd[_0xa5e4('0x69')](_0x5e205d['query'][_0xa5e4('0x6a')]);}})['then'](respondWithStatusCode(_0x45aae9,null))[_0xa5e4('0x2c')](handleError(_0x45aae9,null));};exports[_0xa5e4('0x6b')]=function(_0x27d89c,_0x22d7cb,_0x303856){if(_0x27d89c['body']['id']){delete _0x27d89c['body']['id'];}return db[_0xa5e4('0x41')][_0xa5e4('0x59')]({'where':{'id':_0x27d89c[_0xa5e4('0x58')]['id']}})[_0xa5e4('0x21')](handleEntityNotFound(_0x22d7cb,null))[_0xa5e4('0x21')](function(_0x4208d4){if(_0x4208d4){_0x27d89c[_0xa5e4('0x5b')][_0xa5e4('0x65')]=_0x4208d4['id'];return db[_0xa5e4('0x6c')][_0xa5e4('0x5a')](_0x27d89c[_0xa5e4('0x5b')]);}})[_0xa5e4('0x21')](respondWithResult(_0x22d7cb,null))[_0xa5e4('0x2c')](handleError(_0x22d7cb,null));};exports[_0xa5e4('0x6d')]=function(_0x39a97b,_0x48145e,_0x9a45ba){var _0x5360ed={'raw':![],'where':{}};var _0x5407f3={};var _0x3d16d9={'count':0x0,'rows':[]};return db['SmsAccount'][_0xa5e4('0x6e')]({'where':{'id':_0x39a97b[_0xa5e4('0x58')]['id']}})['then'](handleEntityNotFound(_0x48145e,null))[_0xa5e4('0x21')](function(_0x25706c){if(_0x25706c){_0x5407f3[_0xa5e4('0x45')]=_['keys'](db[_0xa5e4('0x6c')][_0xa5e4('0x42')]);_0x5407f3['query']=_[_0xa5e4('0x47')](_0x39a97b[_0xa5e4('0x46')]);_0x5407f3[_0xa5e4('0x50')]=_['intersection'](_0x5407f3[_0xa5e4('0x45')],_0x5407f3[_0xa5e4('0x46')]);_0x5360ed[_0xa5e4('0x48')]=_['intersection'](_0x5407f3[_0xa5e4('0x45')],qs[_0xa5e4('0x4a')](_0x39a97b['query'][_0xa5e4('0x4a')]));_0x5360ed[_0xa5e4('0x48')]=_0x5360ed[_0xa5e4('0x48')][_0xa5e4('0x4b')]?_0x5360ed['attributes']:_0x5407f3[_0xa5e4('0x45')];if(!_0x39a97b[_0xa5e4('0x46')]['hasOwnProperty'](_0xa5e4('0x4d'))){_0x5360ed['limit']=qs[_0xa5e4('0x32')](_0x39a97b[_0xa5e4('0x46')][_0xa5e4('0x32')]);_0x5360ed[_0xa5e4('0x31')]=qs['offset'](_0x39a97b[_0xa5e4('0x46')][_0xa5e4('0x31')]);}_0x5360ed[_0xa5e4('0x4e')]=qs[_0xa5e4('0x4f')](_0x39a97b[_0xa5e4('0x46')][_0xa5e4('0x4f')]);_0x5360ed[_0xa5e4('0x52')]=qs[_0xa5e4('0x50')](_[_0xa5e4('0x6f')](_0x39a97b['query'],_0x5407f3[_0xa5e4('0x50')]));_0x5360ed[_0xa5e4('0x52')][_0xa5e4('0x65')]=_0x25706c['id'];if(_0x39a97b[_0xa5e4('0x46')][_0xa5e4('0x51')]){_0x5360ed[_0xa5e4('0x52')]=_[_0xa5e4('0x54')](_0x5360ed[_0xa5e4('0x52')],{'$or':_[_0xa5e4('0x40')](_0x5360ed[_0xa5e4('0x48')],function(_0x9c574a){var _0x6c193c={};_0x6c193c[_0x9c574a]={'$like':'%'+_0x39a97b['query']['filter']+'%'};return _0x6c193c;})});}_0x5360ed=_['merge']({},_0x5360ed,_0x39a97b[_0xa5e4('0x55')]);return db[_0xa5e4('0x6c')]['count']({'where':_0x5360ed[_0xa5e4('0x52')]})['then'](function(_0x3da621){_0x3d16d9[_0xa5e4('0x34')]=_0x3da621;if(_0x39a97b['query'][_0xa5e4('0x56')]){_0x5360ed[_0xa5e4('0x67')]=[{'all':!![]}];}return db[_0xa5e4('0x6c')][_0xa5e4('0x68')](_0x5360ed);})[_0xa5e4('0x21')](function(_0x29be2b){_0x3d16d9[_0xa5e4('0x57')]=_0x29be2b;return _0x3d16d9;});}})[_0xa5e4('0x21')](respondWithFilteredResult(_0x48145e,_0x5360ed))['catch'](handleError(_0x48145e,null));};exports[_0xa5e4('0x70')]=function(_0x3fdc7d,_0x188106,_0xd0bd6e){return db['SmsAccount'][_0xa5e4('0x59')]({'where':{'id':_0x3fdc7d[_0xa5e4('0x58')]['id']}})[_0xa5e4('0x21')](handleEntityNotFound(_0x188106,null))['then'](function(_0x274d27){if(_0x274d27){return _0x274d27[_0xa5e4('0x70')](_0x3fdc7d[_0xa5e4('0x46')][_0xa5e4('0x6a')]);}})[_0xa5e4('0x21')](respondWithStatusCode(_0x188106,null))[_0xa5e4('0x2c')](handleError(_0x188106,null));};exports[_0xa5e4('0x71')]=function(_0x403dcd,_0x43c91f,_0x1a4427){var _0x2a57be={'channel':_0xa5e4('0x72')};var _0x4aafeb=[];var _0x7fc4fe=[];var _0x1dd0ca={};return db['SmsAccount'][_0xa5e4('0x59')]({'where':{'id':_0x403dcd[_0xa5e4('0x58')]['id']},'include':[{'model':db[_0xa5e4('0x73')],'as':_0xa5e4('0x74')}]})[_0xa5e4('0x21')](handleEntityNotFound(_0x43c91f,null))[_0xa5e4('0x21')](function(_0x4ffc73){_0x2a57be['account']=_0x4ffc73;_0x2a57be[_0xa5e4('0x75')]=_[_0xa5e4('0x76')](_0x4ffc73[_0xa5e4('0x74')],[_0xa5e4('0x77')],['asc']);if(_0x2a57be[_0xa5e4('0x78')][_0xa5e4('0x74')]){delete _0x2a57be['account']['Applications'];}return db[_0xa5e4('0x79')]['describe']();})[_0xa5e4('0x21')](function(_0x39472e){if(!_0x39472e){throw new db[(_0xa5e4('0x7a'))][(_0xa5e4('0x7b'))](_0xa5e4('0x7c'));}_0x4aafeb=_[_0xa5e4('0x7d')](_[_0xa5e4('0x47')](_0x39472e),[_0xa5e4('0x7e'),_0xa5e4('0x7f')]);_0x7fc4fe=_[_0xa5e4('0x7d')](_[_0xa5e4('0x47')](_0x39472e),[_0xa5e4('0x7e'),_0xa5e4('0x7f'),_0xa5e4('0x80'),'ListId']);_0x2a57be[_0xa5e4('0x5b')]={'mapKey':_0xa5e4('0x81')};if(_0x2a57be[_0xa5e4('0x78')]['type']){switch(_0x2a57be[_0xa5e4('0x78')][_0xa5e4('0x82')]){case _0xa5e4('0x83'):_0x2a57be[_0xa5e4('0x5b')]['from']=_0x403dcd[_0xa5e4('0x5b')][_0xa5e4('0x84')];_0x2a57be[_0xa5e4('0x5b')][_0xa5e4('0x5b')]=_0x403dcd[_0xa5e4('0x5b')]['Body'];_0x2a57be['body'][_0xa5e4('0x85')]=_0x403dcd[_0xa5e4('0x5b')][_0xa5e4('0x86')];break;case _0xa5e4('0x87'):_0x2a57be[_0xa5e4('0x5b')][_0xa5e4('0x88')]='+'+_0x403dcd[_0xa5e4('0x5b')]['sender'];_0x2a57be[_0xa5e4('0x5b')][_0xa5e4('0x5b')]=_0x403dcd['body'][_0xa5e4('0x89')];break;case'connectel':_0x2a57be[_0xa5e4('0x5b')][_0xa5e4('0x88')]=_0x403dcd[_0xa5e4('0x5b')][_0xa5e4('0x88')];_0x2a57be[_0xa5e4('0x5b')][_0xa5e4('0x5b')]=_0x403dcd[_0xa5e4('0x5b')][_0xa5e4('0x2a')];break;case _0xa5e4('0x8a'):_0x2a57be[_0xa5e4('0x5b')][_0xa5e4('0x88')]=_0x403dcd[_0xa5e4('0x5b')]['from'];_0x2a57be[_0xa5e4('0x5b')][_0xa5e4('0x5b')]=_0x403dcd[_0xa5e4('0x5b')][_0xa5e4('0x5b')];_0x2a57be['body'][_0xa5e4('0x85')]=_0x403dcd[_0xa5e4('0x5b')][_0xa5e4('0x8b')];break;case _0xa5e4('0x8c'):_0x2a57be[_0xa5e4('0x5b')][_0xa5e4('0x88')]=_0x403dcd[_0xa5e4('0x5b')][_0xa5e4('0x84')];_0x2a57be[_0xa5e4('0x5b')][_0xa5e4('0x5b')]=_0x403dcd['body'][_0xa5e4('0x8d')];_0x2a57be[_0xa5e4('0x5b')]['messageId']=_0x403dcd[_0xa5e4('0x5b')][_0xa5e4('0x8e')];break;case _0xa5e4('0x8f'):_0x2a57be[_0xa5e4('0x5b')][_0xa5e4('0x88')]='+'+_0x403dcd[_0xa5e4('0x5b')][_0xa5e4('0x90')][0x0]['from'];_0x2a57be[_0xa5e4('0x5b')][_0xa5e4('0x5b')]=_0x403dcd['body'][_0xa5e4('0x90')][0x0][_0xa5e4('0x89')];_0x2a57be[_0xa5e4('0x5b')][_0xa5e4('0x85')]=_0x403dcd[_0xa5e4('0x5b')][_0xa5e4('0x90')][0x0][_0xa5e4('0x85')];break;case'csc':_0x2a57be['body'][_0xa5e4('0x88')]=_0x403dcd[_0xa5e4('0x5b')][_0xa5e4('0x91')];_0x2a57be[_0xa5e4('0x5b')][_0xa5e4('0x5b')]=_0x403dcd[_0xa5e4('0x5b')]['segmentedMessage']['message'];break;case _0xa5e4('0x92'):_0x2a57be[_0xa5e4('0x5b')][_0xa5e4('0x88')]=_0x403dcd[_0xa5e4('0x5b')][_0xa5e4('0x93')];_0x2a57be[_0xa5e4('0x5b')]['body']=_0x403dcd[_0xa5e4('0x5b')][_0xa5e4('0x89')];_0x2a57be[_0xa5e4('0x5b')]['messageId']=_0x403dcd[_0xa5e4('0x5b')]['replyMessageId'];break;case'bandwidth':_0x2a57be[_0xa5e4('0x5b')][_0xa5e4('0x85')]=_0x403dcd[_0xa5e4('0x5b')][0x0]['message']['id'];_0x2a57be['body'][_0xa5e4('0x88')]=_0x403dcd[_0xa5e4('0x5b')][0x0][_0xa5e4('0x2a')][_0xa5e4('0x88')];_0x2a57be[_0xa5e4('0x5b')][_0xa5e4('0x5b')]=_0x403dcd[_0xa5e4('0x5b')][0x0][_0xa5e4('0x2a')][_0xa5e4('0x89')];break;case _0xa5e4('0x94'):_0x2a57be[_0xa5e4('0x5b')][_0xa5e4('0x88')]=_0x403dcd['body'][_0xa5e4('0x88')];_0x2a57be[_0xa5e4('0x5b')][_0xa5e4('0x5b')]=_0x403dcd[_0xa5e4('0x5b')]['message'];_0x2a57be[_0xa5e4('0x5b')][_0xa5e4('0x85')]=_0x403dcd[_0xa5e4('0x5b')][_0xa5e4('0x95')];break;}}if(_0x2a57be[_0xa5e4('0x5b')]['id']){delete _0x2a57be['body']['id'];}if(_[_0xa5e4('0x96')](_0x2a57be[_0xa5e4('0x5b')]['from'])){throw new db[(_0xa5e4('0x7a'))][(_0xa5e4('0x7b'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x2a57be['body'][_0xa5e4('0x5b')])||_0x2a57be[_0xa5e4('0x5b')][_0xa5e4('0x5b')]===''){throw new db[(_0xa5e4('0x7a'))]['ValidationError'](_0xa5e4('0x97'));}if(_['isNil'](_0x2a57be['body'][_0xa5e4('0x98')])){throw new db[(_0xa5e4('0x7a'))][(_0xa5e4('0x7b'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x7fc4fe);}if(!_[_0xa5e4('0x99')](_0x7fc4fe,_0x2a57be[_0xa5e4('0x5b')][_0xa5e4('0x98')])){throw new db[(_0xa5e4('0x7a'))][(_0xa5e4('0x7b'))](_0xa5e4('0x9a')+_0x7fc4fe);}_0x1dd0ca[_0x2a57be[_0xa5e4('0x5b')]['mapKey']]=_0x2a57be[_0xa5e4('0x5b')][_0xa5e4('0x88')];return db[_0xa5e4('0x9b')][_0xa5e4('0x59')]({'where':{'id':_0x2a57be['account'][_0xa5e4('0x9c')]},'include':[{'model':db[_0xa5e4('0x79')],'as':_0xa5e4('0x9d'),'where':_0x1dd0ca,'limit':0x1,'order':[[_0xa5e4('0x7f'),_0xa5e4('0x9e')]]}]});})[_0xa5e4('0x21')](handleEntityNotFound(_0x43c91f,null))[_0xa5e4('0x21')](function(_0x4233aa){if(_0x4233aa){_0x2a57be[_0xa5e4('0x9f')]=_[_0xa5e4('0xa0')](_0x4233aa,[_0xa5e4('0x9d')]);if(_0x4233aa[_0xa5e4('0x9d')][_0xa5e4('0x4b')]){return _0x4233aa[_0xa5e4('0x9d')][0x0];}var _0x48557c=_[_0xa5e4('0xa1')](_0x2a57be[_0xa5e4('0x5b')],{'firstName':_0x2a57be[_0xa5e4('0x5b')]['from'],'ListId':_0x4233aa['id']});_0x48557c[_0x2a57be[_0xa5e4('0x5b')][_0xa5e4('0x98')]]=_0x2a57be['body'][_0xa5e4('0x88')];return db['CmContact'][_0xa5e4('0x5a')](_0x48557c,{'fields':_0x4aafeb,'raw':!![]});}})[_0xa5e4('0x21')](handleEntityNotFound(_0x43c91f,null))['then'](function(_0x44662a){if(_0x44662a){_0x2a57be[_0xa5e4('0xa2')]=_0x44662a;var _0x32b998={'ContactId':_0x44662a['id'],'phone':_0x2a57be[_0xa5e4('0x5b')]['from'],'SmsAccountId':_0x403dcd[_0xa5e4('0x58')]['id']};var _0x325756={'ContactId':_0x44662a['id'],'SmsAccountId':_0x403dcd[_0xa5e4('0x58')]['id'],'closed':![]};return db['SmsInteraction']['find']({'where':_0x325756})[_0xa5e4('0x21')](function(_0x953c45){if(_0x953c45){return[_0x953c45,![]];}return db['SmsInteraction'][_0xa5e4('0x5a')](_0x32b998)[_0xa5e4('0x21')](function(_0x26a5cd){return[_0x26a5cd,!![]];});});}})[_0xa5e4('0xa3')](function(_0x1626fb,_0x34c134){_0x2a57be[_0xa5e4('0xa4')]=_0x1626fb[_0xa5e4('0x39')]({'plain':!![]});_0x2a57be[_0xa5e4('0xa4')][_0xa5e4('0xa5')]=![];if(_0x34c134){if(_0x2a57be['account'][_0xa5e4('0xa6')]){_0x2a57be['applications'][_0xa5e4('0xa7')]({'id':0x0,'priority':_0x2a57be[_0xa5e4('0x75')][_0xa5e4('0x4b')]+0x1,'app':_0xa5e4('0xa8'),'appdata':_0xa5e4('0xa9'),'interval':'*,*,*,*'});}_0x2a57be['interaction'][_0xa5e4('0xa5')]=!![];}return db['SmsMessage']['create']({'phone':_0x2a57be['body'][_0xa5e4('0x88')],'messageId':_0x2a57be[_0xa5e4('0x5b')][_0xa5e4('0x85')],'body':_0x2a57be['body']['body'],'SmsAccountId':_0x403dcd['params']['id'],'SmsInteractionId':_0x1626fb['id'],'direction':'in','ContactId':_0x1626fb['ContactId'],'AttachmentId':_0x2a57be['body'][_0xa5e4('0xaa')]});})[_0xa5e4('0x21')](function(_0x273e09){_0x2a57be[_0xa5e4('0x2a')]=_0x273e09;if(_0x2a57be[_0xa5e4('0xa4')][_0xa5e4('0xab')]){return db['User'][_0xa5e4('0x59')]({'attributes':['id',_0xa5e4('0x3c')],'where':{'id':_0x2a57be[_0xa5e4('0xa4')][_0xa5e4('0xab')]}})[_0xa5e4('0x21')](function(_0x4e712a){if(_0x4e712a){_0x2a57be[_0xa5e4('0x75')][_0xa5e4('0xac')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4e712a[_0xa5e4('0x3c')]+','+(_0x2a57be[_0xa5e4('0x78')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xa5e4('0xad'),_0xa5e4('0xae'),_0x2a57be);});}return respondWithRpcPromise('Start',_0xa5e4('0xae'),_0x2a57be);})[_0xa5e4('0x21')](function(_0x1239aa){if(_0x1239aa){var _0x4d4e3a=0xc8;var _0x5b2b0e=_0xa5e4('0xaf');logger[_0xa5e4('0x22')](_0xa5e4('0x25'),_0x5b2b0e,_0x4d4e3a,'entity\x20found');logger[_0xa5e4('0x24')](_0xa5e4('0xb0'),_0x5b2b0e,_0x4d4e3a,_0xa5e4('0xb1'),JSON[_0xa5e4('0x27')](_0x1239aa));if(_0x2a57be[_0xa5e4('0x78')][_0xa5e4('0x82')]===_0xa5e4('0x83')){return _0x43c91f[_0xa5e4('0x2e')](_0x4d4e3a)[_0xa5e4('0xb2')](_0xa5e4('0xb3'),_0xa5e4('0xb4'))[_0xa5e4('0x3d')](_0xa5e4('0xb5'));}else{return _0x43c91f[_0xa5e4('0x2e')](_0x4d4e3a)[_0xa5e4('0x30')](_0x1239aa);}}})[_0xa5e4('0x2c')](handleError(_0x43c91f,null));};exports['addApplications']=function(_0x111158,_0xdd8d3,_0x44c09f){return db['SmsAccount']['findOne']({'where':{'id':_0x111158[_0xa5e4('0x58')]['id']}})[_0xa5e4('0x21')](handleEntityNotFound(_0xdd8d3,null))[_0xa5e4('0x21')](function(_0x431164){if(_0x431164){return db['sequelize']['transaction'](function(_0x1403a2){return db[_0xa5e4('0x73')]['destroy']({'where':{'SmsAccountId':_0x111158[_0xa5e4('0x58')]['id']},'transaction':_0x1403a2})[_0xa5e4('0x21')](function(_0x52b963){var _0xfe042b=_[_0xa5e4('0x40')](_0x111158[_0xa5e4('0x5b')],function(_0x280e23){_0x280e23[_0xa5e4('0x65')]=_0x111158[_0xa5e4('0x58')]['id'];return _0x280e23;});return db[_0xa5e4('0x73')][_0xa5e4('0xb6')](_0xfe042b,{'transaction':_0x1403a2});});})['then'](function(){return db[_0xa5e4('0x73')][_0xa5e4('0xb7')]({'where':{'SmsAccountId':_0x111158[_0xa5e4('0x58')]['id']},'order':_0xa5e4('0x77')});});}})[_0xa5e4('0x21')](respondWithResult(_0xdd8d3,null))[_0xa5e4('0x2c')](handleError(_0xdd8d3,null));};exports[_0xa5e4('0xb8')]=function(_0x3c00ff,_0x121163,_0x2d18c9){var _0x4ac5e1={};var _0x2ebb4c={};var _0x459034;var _0x27e90b;return db[_0xa5e4('0x41')][_0xa5e4('0x6e')]({'where':{'id':_0x3c00ff[_0xa5e4('0x58')]['id']}})[_0xa5e4('0x21')](handleEntityNotFound(_0x121163,null))['then'](function(_0x591cf9){if(_0x591cf9){_0x459034=_0x591cf9;_0x2ebb4c[_0xa5e4('0x45')]=_[_0xa5e4('0x47')](db[_0xa5e4('0x73')][_0xa5e4('0x42')]);_0x2ebb4c[_0xa5e4('0x46')]=_[_0xa5e4('0x47')](_0x3c00ff[_0xa5e4('0x46')]);_0x2ebb4c['filters']=_[_0xa5e4('0x49')](_0x2ebb4c[_0xa5e4('0x45')],_0x2ebb4c[_0xa5e4('0x46')]);_0x4ac5e1[_0xa5e4('0x48')]=_[_0xa5e4('0x49')](_0x2ebb4c[_0xa5e4('0x45')],qs['fields'](_0x3c00ff[_0xa5e4('0x46')][_0xa5e4('0x4a')]));_0x4ac5e1[_0xa5e4('0x48')]=_0x4ac5e1['attributes'][_0xa5e4('0x4b')]?_0x4ac5e1[_0xa5e4('0x48')]:_0x2ebb4c[_0xa5e4('0x45')];_0x4ac5e1[_0xa5e4('0x4e')]=qs[_0xa5e4('0x4f')](_0x3c00ff[_0xa5e4('0x46')]['sort']);_0x4ac5e1[_0xa5e4('0x52')]=qs[_0xa5e4('0x50')](_[_0xa5e4('0x6f')](_0x3c00ff[_0xa5e4('0x46')],_0x2ebb4c[_0xa5e4('0x50')]));if(_0x3c00ff['query'][_0xa5e4('0x51')]){_0x4ac5e1[_0xa5e4('0x52')]=_[_0xa5e4('0x54')](_0x4ac5e1['where'],{'$or':_[_0xa5e4('0x40')](_0x4ac5e1[_0xa5e4('0x48')],function(_0x71c847){var _0x12e55f={};_0x12e55f[_0x71c847]={'$like':'%'+_0x3c00ff[_0xa5e4('0x46')]['filter']+'%'};return _0x12e55f;})});}_0x4ac5e1=_[_0xa5e4('0x54')]({},_0x4ac5e1,_0x3c00ff['options']);return _0x459034[_0xa5e4('0xb8')](_0x4ac5e1);}})[_0xa5e4('0x21')](function(_0x1a1b7a){if(_0x1a1b7a){_0x27e90b=_0x1a1b7a['length'];if(!_0x3c00ff[_0xa5e4('0x46')][_0xa5e4('0x4c')]('nolimit')){_0x4ac5e1['limit']=qs[_0xa5e4('0x32')](_0x3c00ff[_0xa5e4('0x46')][_0xa5e4('0x32')]);_0x4ac5e1[_0xa5e4('0x31')]=qs[_0xa5e4('0x31')](_0x3c00ff[_0xa5e4('0x46')][_0xa5e4('0x31')]);}return _0x459034[_0xa5e4('0xb8')](_0x4ac5e1);}})[_0xa5e4('0x21')](function(_0x5943af){if(_0x5943af){return _0x5943af?{'count':_0x27e90b,'rows':_0x5943af}:null;}})['then'](respondWithResult(_0x121163,null))[_0xa5e4('0x2c')](handleError(_0x121163,null));};exports[_0xa5e4('0xb9')]=function(_0x21afd4,_0x5c638d,_0x2cc737){var _0x2f1a86={'raw':![],'where':{}};var _0x1b2fcd={};var _0x431fc8={'count':0x0,'rows':[]};return db[_0xa5e4('0x41')]['findOne']({'where':{'id':_0x21afd4[_0xa5e4('0x58')]['id']}})['then'](handleEntityNotFound(_0x5c638d,null))[_0xa5e4('0x21')](function(_0x2f5271){if(_0x2f5271){_0x1b2fcd['model']=_[_0xa5e4('0x47')](db['SmsInteraction'][_0xa5e4('0x42')]);_0x1b2fcd[_0xa5e4('0x46')]=_[_0xa5e4('0x47')](_0x21afd4[_0xa5e4('0x46')]);_0x1b2fcd[_0xa5e4('0x50')]=_[_0xa5e4('0x49')](_0x1b2fcd[_0xa5e4('0x45')],_0x1b2fcd[_0xa5e4('0x46')]);_0x2f1a86[_0xa5e4('0x48')]=_['intersection'](_0x1b2fcd[_0xa5e4('0x45')],qs['fields'](_0x21afd4[_0xa5e4('0x46')][_0xa5e4('0x4a')]));_0x2f1a86['attributes']=_0x2f1a86[_0xa5e4('0x48')]['length']?_0x2f1a86[_0xa5e4('0x48')]:_0x1b2fcd[_0xa5e4('0x45')];if(!_0x21afd4[_0xa5e4('0x46')][_0xa5e4('0x4c')](_0xa5e4('0x4d'))){_0x2f1a86['limit']=qs[_0xa5e4('0x32')](_0x21afd4[_0xa5e4('0x46')]['limit']);_0x2f1a86[_0xa5e4('0x31')]=qs['offset'](_0x21afd4[_0xa5e4('0x46')][_0xa5e4('0x31')]);}_0x2f1a86['order']=qs['sort'](_0x21afd4[_0xa5e4('0x46')][_0xa5e4('0x4f')]);_0x2f1a86[_0xa5e4('0x52')]=qs['filters'](_[_0xa5e4('0x6f')](_0x21afd4['query'],_0x1b2fcd['filters']));_0x2f1a86['where'][_0xa5e4('0x65')]=_0x2f5271['id'];if(_0x21afd4[_0xa5e4('0x46')]['filter']){_0x2f1a86['where']=_[_0xa5e4('0x54')](_0x2f1a86[_0xa5e4('0x52')],{'$or':_['map'](_0x2f1a86[_0xa5e4('0x48')],function(_0x53bbe6){var _0x20853c={};_0x20853c[_0x53bbe6]={'$like':'%'+_0x21afd4[_0xa5e4('0x46')][_0xa5e4('0x51')]+'%'};return _0x20853c;})});}_0x2f1a86=_['merge']({},_0x2f1a86,_0x21afd4['options']);return db[_0xa5e4('0xba')][_0xa5e4('0x34')]({'where':_0x2f1a86['where']})[_0xa5e4('0x21')](function(_0x27eb5f){_0x431fc8[_0xa5e4('0x34')]=_0x27eb5f;if(_0x21afd4[_0xa5e4('0x46')][_0xa5e4('0x56')]){_0x2f1a86[_0xa5e4('0x67')]=[{'model':db[_0xa5e4('0x79')],'as':'Contact','required':![]},{'model':db[_0xa5e4('0xbb')],'as':_0xa5e4('0xbc'),'attributes':[_0xa5e4('0x3c'),'fullname',_0xa5e4('0xbd')],'required':![]},{'model':db[_0xa5e4('0xbe')],'as':_0xa5e4('0xbf'),'attributes':['id',_0xa5e4('0x3c'),_0xa5e4('0xc0')],'where':_0x21afd4[_0xa5e4('0x46')]['tag']?{'id':_0x21afd4[_0xa5e4('0x46')]['tag']}:undefined,'required':_0x21afd4[_0xa5e4('0x46')][_0xa5e4('0xc1')]?!![]:![]}];}return db[_0xa5e4('0xba')][_0xa5e4('0x68')](_0x2f1a86);})[_0xa5e4('0x21')](function(_0x52d0b7){_0x431fc8['rows']=_0x52d0b7;return _0x431fc8;});}})[_0xa5e4('0x21')](respondWithFilteredResult(_0x5c638d,_0x2f1a86))[_0xa5e4('0x2c')](handleError(_0x5c638d,null));};exports[_0xa5e4('0x3d')]=function(_0x88fa8a,_0x4d0020,_0x1f3e6d){var _0x347ec2,_0x557488,_0x4e28ae;if(_[_0xa5e4('0x96')](_0x88fa8a[_0xa5e4('0x5b')][_0xa5e4('0x5b')])||_0x88fa8a[_0xa5e4('0x5b')][_0xa5e4('0x5b')]===''){throw new db[(_0xa5e4('0x7a'))]['ValidationError'](_0xa5e4('0x97'));}if(_[_0xa5e4('0x96')](_0x88fa8a[_0xa5e4('0x5b')]['to'])){throw new db[(_0xa5e4('0x7a'))][(_0xa5e4('0x7b'))]('to\x20is\x20mandatory');}_0x347ec2=_0x88fa8a[_0xa5e4('0x5b')]['to'];return db['SmsAccount'][_0xa5e4('0x59')]({'where':{'id':_0x88fa8a[_0xa5e4('0x58')]['id']},'include':[{'model':db[_0xa5e4('0x9b')],'as':_0xa5e4('0xc2'),'include':[{'model':db[_0xa5e4('0x79')],'as':_0xa5e4('0x9d'),'where':{'mobile':_0x347ec2},'limit':0x1,'order':[[_0xa5e4('0x7f'),_0xa5e4('0x9e')]]}]}]})[_0xa5e4('0x21')](handleEntityNotFound(_0x4d0020,null))[_0xa5e4('0x21')](function(_0x44ab92){if(_0x44ab92&&_0x44ab92[_0xa5e4('0xc2')]){_0x557488=_0x44ab92[_0xa5e4('0x39')]({'plain':!![]});if(_0x557488[_0xa5e4('0xc2')]&&_0x557488['List']['Contacts'][_0xa5e4('0x4b')]){return _0x557488[_0xa5e4('0xc2')][_0xa5e4('0x9d')][0x0];}return db['CmContact'][_0xa5e4('0x5a')](_['defaults'](_0x88fa8a[_0xa5e4('0x5b')],{'firstName':_0x347ec2,'mobile':_0x347ec2,'phone':_0x347ec2,'ListId':_0x557488[_0xa5e4('0x9c')]}));}})['then'](handleEntityNotFound(_0x4d0020,null))['then'](function(_0x57182c){if(_0x57182c){_0x4e28ae=_0x57182c;return db['SmsInteraction']['find']({'where':{'ContactId':_0x4e28ae['id'],'closed':![],'SmsAccountId':_0x557488['id']}})['then'](function(_0x5c017f){if(_0x5c017f){return[_0x5c017f,![]];}return db[_0xa5e4('0xba')]['create']({'UserId':_0x88fa8a['user']['id'],'ContactId':_0x4e28ae['id'],'SmsAccountId':_0x557488['id'],'phone':_0x347ec2,'firstMsgDirection':_0xa5e4('0xc3'),'Messages':[_['merge'](_0x88fa8a[_0xa5e4('0x5b')],{'read':![],'body':_0x88fa8a[_0xa5e4('0x5b')][_0xa5e4('0x5b')],'phone':_0x347ec2,'SmsAccountId':_0x557488['id'],'UserId':_0x88fa8a[_0xa5e4('0xc4')]['id'],'ContactId':_0x4e28ae['id']})]},{'include':[{'model':db[_0xa5e4('0xc5')],'as':_0xa5e4('0xc6')}]})[_0xa5e4('0x21')](function(_0x4821df){return[_0x4821df,!![]];});});}})[_0xa5e4('0xa3')](function(_0x4aaf9e,_0x10f261){if(_0x10f261){return _0x4aaf9e;}return db['SmsMessage'][_0xa5e4('0x5a')](_[_0xa5e4('0x54')](_0x88fa8a[_0xa5e4('0x5b')],{'read':![],'body':_0x88fa8a[_0xa5e4('0x5b')][_0xa5e4('0x5b')],'phone':_0x347ec2,'SmsAccountId':_0x557488['id'],'SmsInteractionId':_0x4aaf9e['id'],'UserId':_0x88fa8a['user']['id'],'ContactId':_0x4e28ae['id']}))[_0xa5e4('0x21')](function(_0x433b09){_0x4aaf9e[_0xa5e4('0xc7')]['Messages']=[];_0x4aaf9e[_0xa5e4('0xc7')][_0xa5e4('0xc6')]['push'](_0x433b09[_0xa5e4('0xc7')]);return _0x4aaf9e;});})[_0xa5e4('0x21')](respondWithResult(_0x4d0020,null))[_0xa5e4('0x2c')](handleError(_0x4d0020,null));};exports['status']=function(_0x84cfaa,_0x48a26c,_0x4f1b2b){if(_0x84cfaa['body']['id']){delete _0x84cfaa['body']['id'];}var _0x162e29,_0x5088f5,_0x3e0f6e;return db[_0xa5e4('0x41')]['find']({'where':{'id':_0x84cfaa[_0xa5e4('0x58')]['id']}})[_0xa5e4('0x21')](handleEntityNotFound(_0x48a26c,null))[_0xa5e4('0x21')](function(_0x2569e0){if(_0x2569e0){_0x3e0f6e=_0x2569e0;logger[_0xa5e4('0x24')](_0xa5e4('0x25'),_0xa5e4('0x2e'),_0xa5e4('0xc8'),_0x2569e0[_0xa5e4('0x82')],util['inspect'](_0x84cfaa['body'],{'showHidden':![],'depth':null}));switch(_0x2569e0[_0xa5e4('0x82')]){case'skebby':if(_0x84cfaa[_0xa5e4('0x5b')]['skebby_dispatch_id']&&_0x84cfaa[_0xa5e4('0x5b')][_0xa5e4('0x2e')]){_0x5088f5=_0x84cfaa[_0xa5e4('0x5b')][_0xa5e4('0x2e')];return db['SmsMessage'][_0xa5e4('0x59')]({'where':{'messageId':_0x84cfaa[_0xa5e4('0x5b')][_0xa5e4('0xc9')]}});}break;case _0xa5e4('0xca'):if(_0x84cfaa[_0xa5e4('0x5b')][_0xa5e4('0xcb')]&&_0x84cfaa['body']['statusInt']){_0x5088f5=_0x84cfaa[_0xa5e4('0x5b')][_0xa5e4('0xcc')];return db['SmsMessage'][_0xa5e4('0x59')]({'where':{'messageId':_0x84cfaa['body'][_0xa5e4('0xcb')]}});}break;case _0xa5e4('0x8a'):if(_0x84cfaa[_0xa5e4('0x5b')][_0xa5e4('0x8b')]&&_0x84cfaa['body'][_0xa5e4('0xcd')]){_0x5088f5=_0x84cfaa[_0xa5e4('0x5b')]['status_code'];return db['SmsMessage'][_0xa5e4('0x59')]({'where':{'messageId':_0x84cfaa['body'][_0xa5e4('0x8b')]}});}break;case _0xa5e4('0x8f'):var _0x48c17f=_0x84cfaa[_0xa5e4('0x5b')][_0xa5e4('0x90')][0x0];if(_0x48c17f[_0xa5e4('0x85')]&&_0x48c17f['status']['groupName']===_0xa5e4('0xce')){_0x5088f5=_0x48c17f[_0xa5e4('0x2e')][_0xa5e4('0xcf')];return db[_0xa5e4('0xc5')]['find']({'where':{'messageId':_0x48c17f[_0xa5e4('0x85')]}});}break;case'clickatell':if(_0x84cfaa[_0xa5e4('0x5b')]['messageId']&&_0x84cfaa['body'][_0xa5e4('0x2e')]){_0x5088f5=_0x84cfaa[_0xa5e4('0x5b')][_0xa5e4('0x2e')];return db['SmsMessage'][_0xa5e4('0x59')]({'where':{'messageId':_0x84cfaa[_0xa5e4('0x5b')]['messageId']}});}break;case _0xa5e4('0xd0'):if(_0x84cfaa['body'][0x0][_0xa5e4('0x2a')]['id']){_0x5088f5=_0x84cfaa[_0xa5e4('0x5b')][0x0][_0xa5e4('0x82')];return db['SmsMessage'][_0xa5e4('0x59')]({'where':{'messageId':_0x84cfaa[_0xa5e4('0x5b')][0x0][_0xa5e4('0x2a')]['id']}});}break;case _0xa5e4('0x94'):if(_0x84cfaa[_0xa5e4('0x5b')][_0xa5e4('0xd1')]&&_0x84cfaa['body'][_0xa5e4('0x2e')]){_0x5088f5=_0x84cfaa['body'][_0xa5e4('0x2e')];return db[_0xa5e4('0xc5')]['find']({'where':{'messageId':_0x84cfaa[_0xa5e4('0x5b')][_0xa5e4('0xd1')]}});}break;}}})['then'](handleEntityNotFound(_0x48a26c,null))['then'](function(_0x5511cc){if(_0x5511cc){_0x162e29=_0x5511cc;switch(_0x3e0f6e[_0xa5e4('0x82')]){case'skebby':if(_0x5088f5===_0xa5e4('0xce')){return _0x162e29[_0xa5e4('0x37')]({'read':!![]});}else{logger['error'](_0xa5e4('0x25'),_0xa5e4('0x2e'),_0xa5e4('0x87'),util['inspect'](_0x84cfaa[_0xa5e4('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xa5e4('0xca'):if(_0x5088f5==='1'){return _0x162e29[_0xa5e4('0x37')]({'read':!![]});}else{logger[_0xa5e4('0x28')](_0xa5e4('0x25'),_0xa5e4('0x2e'),_0xa5e4('0x87'),util[_0xa5e4('0xd2')](_0x84cfaa[_0xa5e4('0x5b')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x84cfaa[_0xa5e4('0x5b')]['error_code']&&_0x5088f5>=0xc8&&_0x5088f5<=0xce){return _0x162e29[_0xa5e4('0x37')]({'read':!![]});}else{logger[_0xa5e4('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xa5e4('0x2e'),'clicksend',util[_0xa5e4('0xd2')](_0x84cfaa[_0xa5e4('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xa5e4('0x8f'):var _0x3083d9=_0x84cfaa[_0xa5e4('0x5b')][_0xa5e4('0x90')][0x0];if(_0x3083d9[_0xa5e4('0x2e')][_0xa5e4('0xcf')]===_0xa5e4('0xce')){return _0x162e29[_0xa5e4('0x37')]({'read':!![]});}else{logger[_0xa5e4('0x28')](_0xa5e4('0x25'),'status',_0xa5e4('0x8f'),util[_0xa5e4('0xd2')](_0x84cfaa[_0xa5e4('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xa5e4('0x92'):if(_0x5088f5=='DELIVERED_TO_GATEWAY'||_0x5088f5==_0xa5e4('0xd3')){return _0x162e29['update']({'read':!![]});}else{logger['error'](_0xa5e4('0x25'),_0xa5e4('0x2e'),'clickatell',util[_0xa5e4('0xd2')](_0x84cfaa['body'],{'showHidden':![],'depth':null}));}break;case _0xa5e4('0xd0'):if(_0x5088f5==_0xa5e4('0xd4')){return _0x162e29[_0xa5e4('0x37')]({'read':!![]});}else{logger['error'](_0xa5e4('0x25'),'status',_0xa5e4('0xd0'),util[_0xa5e4('0xd2')](_0x84cfaa[_0xa5e4('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xa5e4('0x94'):if(_0x5088f5==='DELIVRD'||_0x5088f5===_0xa5e4('0xd5')){return _0x162e29[_0xa5e4('0x37')]({'read':!![]});}else{logger['error'](_0xa5e4('0x25'),_0xa5e4('0x2e'),_0xa5e4('0x94'),util[_0xa5e4('0xd2')](_0x84cfaa[_0xa5e4('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x162e29;}})[_0xa5e4('0x21')](respondWithResult(_0x48a26c,null))[_0xa5e4('0x2c')](handleError(_0x48a26c,null));};exports[_0xa5e4('0xd6')]=function(_0x1c22bf,_0x355b00,_0x32a7a0){var _0xb81932,_0x11e06a,_0x483c1c;return db['SmsAccount'][_0xa5e4('0x59')]({'where':{'id':_0x1c22bf['params']['id']}})[_0xa5e4('0x21')](handleEntityNotFound(_0x355b00,null))[_0xa5e4('0x21')](function(_0x315ad6){if(_0x315ad6){_0x483c1c=_0x315ad6;logger['debug'](_0xa5e4('0x25'),'status',_0xa5e4('0xc8'),_0x315ad6[_0xa5e4('0x82')],util[_0xa5e4('0xd2')](_0x1c22bf[_0xa5e4('0x46')],{'showHidden':![],'depth':null}));switch(_0x315ad6[_0xa5e4('0x82')]){case'csc':if(_0x1c22bf[_0xa5e4('0x46')][_0xa5e4('0xd7')]&&_0x1c22bf[_0xa5e4('0x46')][_0xa5e4('0xd8')]){_0x11e06a=_0x1c22bf[_0xa5e4('0x46')][_0xa5e4('0xd8')];return db[_0xa5e4('0xc5')][_0xa5e4('0x59')]({'where':{'messageId':_0x1c22bf[_0xa5e4('0x46')][_0xa5e4('0xd7')]}});}break;}}})['then'](handleEntityNotFound(_0x355b00,null))[_0xa5e4('0x21')](function(_0xf828d5){if(_0xf828d5){_0xb81932=_0xf828d5;switch(_0x483c1c[_0xa5e4('0x82')]){case _0xa5e4('0xd9'):if(_0x11e06a==='2'||_0x11e06a==='6'){return _0xb81932[_0xa5e4('0x37')]({'read':!![]});}else{logger['error'](_0xa5e4('0x25'),'status',_0xa5e4('0xd9'),util[_0xa5e4('0xd2')](_0x1c22bf[_0xa5e4('0x46')],{'showHidden':![],'depth':null}));};break;}return _0xb81932;}})['then'](respondWithResult(_0x355b00,null))[_0xa5e4('0x2c')](handleError(_0x355b00,null));};exports['addAgents']=function(_0x3c1db2,_0x3c1a39,_0x2bff2e){return db[_0xa5e4('0x41')][_0xa5e4('0x59')]({'where':{'id':_0x3c1db2[_0xa5e4('0x58')]['id']}})[_0xa5e4('0x21')](handleEntityNotFound(_0x3c1a39,null))[_0xa5e4('0x21')](function(_0x4785b0){if(_0x4785b0){return _0x4785b0[_0xa5e4('0xda')](_0x3c1db2[_0xa5e4('0x5b')][_0xa5e4('0x6a')],_[_0xa5e4('0xa0')](_0x3c1db2[_0xa5e4('0x5b')],['ids','id'])||{})['spread'](function(_0x7fae9){for(var _0x157e97=0x0;_0x157e97<_0x3c1db2[_0xa5e4('0x5b')]['ids'][_0xa5e4('0x4b')];_0x157e97+=0x1){socket[_0xa5e4('0xdb')](_0xa5e4('0xdc'),{'UserId':Number(_0x3c1db2[_0xa5e4('0x5b')][_0xa5e4('0x6a')][_0x157e97]),'SmsAccountId':Number(_0x3c1db2[_0xa5e4('0x58')]['id'])});}return _0x7fae9;});}})[_0xa5e4('0x21')](respondWithResult(_0x3c1a39,null))['catch'](handleError(_0x3c1a39,null));};exports['removeAgents']=function(_0x27cc2d,_0x1e4cd6,_0x134f73){return db['SmsAccount'][_0xa5e4('0x59')]({'where':{'id':_0x27cc2d[_0xa5e4('0x58')]['id']}})['then'](handleEntityNotFound(_0x1e4cd6,null))[_0xa5e4('0x21')](function(_0x23e27c){if(_0x23e27c){return _0x23e27c[_0xa5e4('0xdd')](_0x27cc2d[_0xa5e4('0x46')][_0xa5e4('0x6a')])['then'](function(){if(_[_0xa5e4('0xde')](_0x27cc2d[_0xa5e4('0x46')][_0xa5e4('0x6a')])){for(var _0x1394f6=0x0;_0x1394f6<_0x27cc2d[_0xa5e4('0x46')][_0xa5e4('0x6a')][_0xa5e4('0x4b')];_0x1394f6+=0x1){socket[_0xa5e4('0xdb')]('userSmsAccount:remove',{'UserId':Number(_0x27cc2d[_0xa5e4('0x46')]['ids'][_0x1394f6]),'SmsAccountId':Number(_0x27cc2d[_0xa5e4('0x58')]['id'])});}}else{socket['emit']('userSmsAccount:remove',{'UserId':Number(_0x27cc2d['query'][_0xa5e4('0x6a')]),'SmsAccountId':Number(_0x27cc2d[_0xa5e4('0x58')]['id'])});}});}})[_0xa5e4('0x21')](respondWithStatusCode(_0x1e4cd6,null))[_0xa5e4('0x2c')](handleError(_0x1e4cd6,null));};exports[_0xa5e4('0xdf')]=function(_0x22bc25,_0x2c27e0,_0x8b29e4){var _0x27a49a={};var _0x405884={};var _0x43f44f;var _0x15166f;return db[_0xa5e4('0x41')][_0xa5e4('0x6e')]({'where':{'id':_0x22bc25['params']['id']}})[_0xa5e4('0x21')](handleEntityNotFound(_0x2c27e0,null))[_0xa5e4('0x21')](function(_0x3ee028){if(_0x3ee028){_0x43f44f=_0x3ee028;_0x405884[_0xa5e4('0x45')]=_['keys'](db[_0xa5e4('0xbb')][_0xa5e4('0x42')]);_0x405884[_0xa5e4('0x46')]=_[_0xa5e4('0x47')](_0x22bc25[_0xa5e4('0x46')]);_0x405884[_0xa5e4('0x50')]=_['intersection'](_0x405884[_0xa5e4('0x45')],_0x405884[_0xa5e4('0x46')]);_0x27a49a[_0xa5e4('0x48')]=_[_0xa5e4('0x49')](_0x405884[_0xa5e4('0x45')],qs['fields'](_0x22bc25[_0xa5e4('0x46')][_0xa5e4('0x4a')]));_0x27a49a['attributes']=_0x27a49a['attributes'][_0xa5e4('0x4b')]?_0x27a49a[_0xa5e4('0x48')]:_0x405884['model'];_0x27a49a[_0xa5e4('0x4e')]=qs[_0xa5e4('0x4f')](_0x22bc25[_0xa5e4('0x46')]['sort']);_0x27a49a['where']=qs[_0xa5e4('0x50')](_[_0xa5e4('0x6f')](_0x22bc25[_0xa5e4('0x46')],_0x405884['filters']));if(_0x22bc25['query']['filter']){_0x27a49a['where']=_[_0xa5e4('0x54')](_0x27a49a['where'],{'$or':_['map'](_0x27a49a[_0xa5e4('0x48')],function(_0x302e5f){var _0x5176f2={};_0x5176f2[_0x302e5f]={'$like':'%'+_0x22bc25[_0xa5e4('0x46')][_0xa5e4('0x51')]+'%'};return _0x5176f2;})});}_0x27a49a=_['merge']({},_0x27a49a,_0x22bc25[_0xa5e4('0x55')]);return _0x43f44f[_0xa5e4('0xdf')](_0x27a49a);}})[_0xa5e4('0x21')](function(_0xe1ffe4){if(_0xe1ffe4){_0x15166f=_0xe1ffe4[_0xa5e4('0x4b')];if(!_0x22bc25['query'][_0xa5e4('0x4c')](_0xa5e4('0x4d'))){_0x27a49a[_0xa5e4('0x32')]=qs[_0xa5e4('0x32')](_0x22bc25[_0xa5e4('0x46')][_0xa5e4('0x32')]);_0x27a49a[_0xa5e4('0x31')]=qs[_0xa5e4('0x31')](_0x22bc25[_0xa5e4('0x46')][_0xa5e4('0x31')]);}return _0x43f44f[_0xa5e4('0xdf')](_0x27a49a);}})[_0xa5e4('0x21')](function(_0x227246){if(_0x227246){return _0x227246?{'count':_0x15166f,'rows':_0x227246}:null;}})[_0xa5e4('0x21')](respondWithResult(_0x2c27e0,null))['catch'](handleError(_0x2c27e0,null));}; \ No newline at end of file +var _0x0031=['transaction','bulkCreate','findAndCountAll','getApplications','getInteractions','SmsInteraction','hasOwnProperty','Contact','Owner','fullname','Tag','Tags','tag','send','to\x20is\x20mandatory','List','DESC','out','Messages','dataValues','debug','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','bandwidth','redif','connectel','error_code','inspect','DELIVERED_TO_GATEWAY','message-delivered','ACCEPTD','addAgents','removeAgents','isArray','userSmsAccount:remove','emit','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','destroy','get','end','stack','name','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','SmsAccounts','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','include','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','notify','sms','SmsApplication','account','applications','orderBy','priority','asc','Applications','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','from','From','Body','MessageSid','skebby','sender','text','message_id','plivo','Text','MessageUUID','infobip','results','csc','originatingAddress','clickatell','messageId','intelepeer','refid','isNil','from\x20is\x20mandatory','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','CmList','Contacts','omit','contact','spread','interaction','created','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','twilio','Content-Type','text/xml','\x0a','addApplications'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x0031,0x1e5));var _0x1003=function(_0x3327e2,_0x251554){_0x3327e2=_0x3327e2-0x0;var _0x59fb5c=_0x0031[_0x3327e2];return _0x59fb5c;};'use strict';var emlformat=require(_0x1003('0x0'));var rimraf=require(_0x1003('0x1'));var zipdir=require(_0x1003('0x2'));var jsonpatch=require(_0x1003('0x3'));var rp=require('request-promise');var moment=require(_0x1003('0x4'));var BPromise=require(_0x1003('0x5'));var Mustache=require('mustache');var util=require(_0x1003('0x6'));var path=require(_0x1003('0x7'));var sox=require(_0x1003('0x8'));var csv=require(_0x1003('0x9'));var ejs=require(_0x1003('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1003('0xb'));var squel=require('squel');var crypto=require(_0x1003('0xc'));var jsforce=require(_0x1003('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1003('0x9'));var querystring=require('querystring');var Papa=require(_0x1003('0xe'));var Redis=require(_0x1003('0xf'));var authService=require(_0x1003('0x10'));var qs=require(_0x1003('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1003('0x12'));var logger=require(_0x1003('0x13'))(_0x1003('0x14'));var utils=require(_0x1003('0x15'));var config=require(_0x1003('0x16'));var licenseUtil=require(_0x1003('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x1003('0x18')](config['redis'],{'host':_0x1003('0x19'),'port':0x18eb});var socket=require(_0x1003('0x1a'))(new Redis(config['redis']));require(_0x1003('0x1b'))[_0x1003('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x1003('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x3622d4,_0x66e857,_0x31c531,_0x3aaafb){return new BPromise(function(_0x56b5ba,_0x1df34f){var _0x44d7e4=_0x3aaafb||client;return _0x44d7e4[_0x1003('0x1e')](_0x3622d4,_0x31c531)[_0x1003('0x1f')](function(_0x13291d){logger[_0x1003('0x20')](_0x1003('0x21'),_0x66e857,_0x1003('0x22'));logger['debug'](_0x1003('0x23'),_0x66e857,_0x1003('0x22'),JSON[_0x1003('0x24')](_0x13291d));if(_0x13291d['error']){if(_0x13291d[_0x1003('0x25')]['code']===0x1f4){logger[_0x1003('0x25')](_0x1003('0x21'),_0x66e857,_0x13291d['error'][_0x1003('0x26')]);return _0x1df34f(_0x13291d['error'][_0x1003('0x26')]);}logger['error'](_0x1003('0x21'),_0x66e857,_0x13291d['error'][_0x1003('0x26')]);return _0x56b5ba(_0x13291d[_0x1003('0x25')][_0x1003('0x26')]);}else{logger[_0x1003('0x20')](_0x1003('0x21'),_0x66e857,_0x1003('0x22'));_0x56b5ba(_0x13291d[_0x1003('0x27')][_0x1003('0x26')]);}})[_0x1003('0x28')](function(_0x269b87){logger[_0x1003('0x25')](_0x1003('0x21'),_0x66e857,_0x269b87);_0x1df34f(_0x269b87);});});}function respondWithStatusCode(_0x3a2c4b,_0x3cab7c){_0x3cab7c=_0x3cab7c||0xcc;return function(_0x5339f7){if(_0x5339f7){return _0x3a2c4b[_0x1003('0x29')](_0x3cab7c);}return _0x3a2c4b[_0x1003('0x2a')](_0x3cab7c)['end']();};}function respondWithResult(_0x54d872,_0x4b5ee3){_0x4b5ee3=_0x4b5ee3||0xc8;return function(_0x566759){if(_0x566759){return _0x54d872[_0x1003('0x2a')](_0x4b5ee3)['json'](_0x566759);}};}function respondWithFilteredResult(_0x1c59b3,_0x141fe4){return function(_0x3f895e){if(_0x3f895e){var _0x106669=typeof _0x141fe4[_0x1003('0x2b')]===_0x1003('0x2c')&&typeof _0x141fe4[_0x1003('0x2d')]==='undefined';var _0x49c3a2=_0x3f895e[_0x1003('0x2e')];var _0x362512=_0x106669?0x0:_0x141fe4[_0x1003('0x2b')];var _0x1bbc54=_0x106669?_0x3f895e['count']:_0x141fe4[_0x1003('0x2b')]+_0x141fe4[_0x1003('0x2d')];var _0x4f59b4;if(_0x1bbc54>=_0x49c3a2){_0x1bbc54=_0x49c3a2;_0x4f59b4=0xc8;}else{_0x4f59b4=0xce;}_0x1c59b3[_0x1003('0x2a')](_0x4f59b4);return _0x1c59b3[_0x1003('0x2f')](_0x1003('0x30'),_0x362512+'-'+_0x1bbc54+'/'+_0x49c3a2)[_0x1003('0x31')](_0x3f895e);}return null;};}function patchUpdates(_0x1c1d99){return function(_0xb2a3e5){try{jsonpatch[_0x1003('0x32')](_0xb2a3e5,_0x1c1d99,!![]);}catch(_0xe7f5ab){return BPromise[_0x1003('0x33')](_0xe7f5ab);}return _0xb2a3e5['save']();};}function saveUpdates(_0x2d48f2,_0x164554){return function(_0x24cee6){if(_0x24cee6){return _0x24cee6[_0x1003('0x34')](_0x2d48f2)[_0x1003('0x1f')](function(_0x19a340){return _0x19a340;});}return null;};}function removeEntity(_0x2a625a,_0x25b3da){return function(_0x30f2dd){if(_0x30f2dd){return _0x30f2dd[_0x1003('0x35')]()[_0x1003('0x1f')](function(){var _0x49939c=_0x30f2dd[_0x1003('0x36')]({'plain':!![]});var _0xae7f44='SmsAccounts';return db['UserProfileResource'][_0x1003('0x35')]({'where':{'type':_0xae7f44,'resourceId':_0x49939c['id']}})['then'](function(){return _0x30f2dd;});})[_0x1003('0x1f')](function(){_0x2a625a[_0x1003('0x2a')](0xcc)[_0x1003('0x37')]();});}};}function handleEntityNotFound(_0x33daae,_0x1eba30){return function(_0xfc5426){if(!_0xfc5426){_0x33daae[_0x1003('0x29')](0x194);}return _0xfc5426;};}function handleError(_0x5ef09d,_0x2faa3e){_0x2faa3e=_0x2faa3e||0x1f4;return function(_0x50d762){logger[_0x1003('0x25')](_0x50d762[_0x1003('0x38')]);if(_0x50d762[_0x1003('0x39')]){delete _0x50d762[_0x1003('0x39')];}_0x5ef09d['status'](_0x2faa3e)['send'](_0x50d762);};}exports['index']=function(_0x58576b,_0x15770d){var _0x48bbce={'include':[{'model':db[_0x1003('0x3a')],'as':_0x1003('0x3b')}]},_0x56cb3f={},_0x49ad47={'count':0x0,'rows':[]};var _0x38f4db=_[_0x1003('0x3c')](db[_0x1003('0x3d')][_0x1003('0x3e')],function(_0x45c8c8){return{'name':_0x45c8c8[_0x1003('0x3f')],'type':_0x45c8c8[_0x1003('0x40')][_0x1003('0x41')]};});_0x56cb3f[_0x1003('0x42')]=_[_0x1003('0x3c')](_0x38f4db,_0x1003('0x39'));_0x56cb3f['query']=_[_0x1003('0x43')](_0x58576b[_0x1003('0x44')]);_0x56cb3f['filters']=_[_0x1003('0x45')](_0x56cb3f[_0x1003('0x42')],_0x56cb3f['query']);_0x48bbce['attributes']=_['intersection'](_0x56cb3f[_0x1003('0x42')],qs[_0x1003('0x46')](_0x58576b[_0x1003('0x44')][_0x1003('0x46')]));_0x48bbce[_0x1003('0x47')]=_0x48bbce[_0x1003('0x47')][_0x1003('0x48')]?_0x48bbce[_0x1003('0x47')]:_0x56cb3f[_0x1003('0x42')];if(!_0x58576b[_0x1003('0x44')]['hasOwnProperty'](_0x1003('0x49'))){_0x48bbce['limit']=qs[_0x1003('0x2d')](_0x58576b['query'][_0x1003('0x2d')]);_0x48bbce[_0x1003('0x2b')]=qs['offset'](_0x58576b[_0x1003('0x44')][_0x1003('0x2b')]);}_0x48bbce[_0x1003('0x4a')]=qs[_0x1003('0x4b')](_0x58576b[_0x1003('0x44')][_0x1003('0x4b')]);_0x48bbce[_0x1003('0x4c')]=qs[_0x1003('0x4d')](_[_0x1003('0x4e')](_0x58576b[_0x1003('0x44')],_0x56cb3f['filters']),_0x38f4db);if(_0x58576b[_0x1003('0x44')]['filter']){_0x48bbce[_0x1003('0x4c')]=_[_0x1003('0x4f')](_0x48bbce['where'],{'$or':_[_0x1003('0x3c')](_0x38f4db,function(_0x2ba0c6){if(_0x2ba0c6['type']!==_0x1003('0x50')){var _0x1e7f7e={};_0x1e7f7e[_0x2ba0c6['name']]={'$like':'%'+_0x58576b['query'][_0x1003('0x51')]+'%'};return _0x1e7f7e;}})});}_0x48bbce=_[_0x1003('0x4f')]({},_0x48bbce,_0x58576b[_0x1003('0x52')]);var _0x13c33c={'where':_0x48bbce[_0x1003('0x4c')]};return db[_0x1003('0x3d')][_0x1003('0x2e')](_0x13c33c)[_0x1003('0x1f')](function(_0x90c8db){_0x49ad47[_0x1003('0x2e')]=_0x90c8db;if(_0x58576b['query'][_0x1003('0x53')]){_0x48bbce['include']=[{'all':!![]}];}return db[_0x1003('0x3d')][_0x1003('0x54')](_0x48bbce);})[_0x1003('0x1f')](function(_0x4e952d){_0x49ad47[_0x1003('0x55')]=_0x4e952d;return _0x49ad47;})[_0x1003('0x1f')](respondWithFilteredResult(_0x15770d,_0x48bbce))[_0x1003('0x28')](handleError(_0x15770d,null));};exports['show']=function(_0x37de71,_0x4d0be7){var _0x125912={'raw':![],'where':{'id':_0x37de71['params']['id']},'include':[{'model':db[_0x1003('0x3a')],'as':_0x1003('0x3b')}]},_0x4f3777={};_0x4f3777[_0x1003('0x42')]=_['keys'](db[_0x1003('0x3d')][_0x1003('0x3e')]);_0x4f3777[_0x1003('0x44')]=_[_0x1003('0x43')](_0x37de71['query']);_0x4f3777['filters']=_[_0x1003('0x45')](_0x4f3777[_0x1003('0x42')],_0x4f3777[_0x1003('0x44')]);_0x125912[_0x1003('0x47')]=_[_0x1003('0x45')](_0x4f3777[_0x1003('0x42')],qs['fields'](_0x37de71[_0x1003('0x44')][_0x1003('0x46')]));_0x125912[_0x1003('0x47')]=_0x125912['attributes']['length']?_0x125912[_0x1003('0x47')]:_0x4f3777[_0x1003('0x42')];if(_0x37de71[_0x1003('0x44')]['includeAll']){_0x125912['include']=[{'all':!![]}];}_0x125912=_[_0x1003('0x4f')]({},_0x125912,_0x37de71['options']);return db[_0x1003('0x3d')]['find'](_0x125912)[_0x1003('0x1f')](handleEntityNotFound(_0x4d0be7,null))[_0x1003('0x1f')](respondWithResult(_0x4d0be7,null))['catch'](handleError(_0x4d0be7,null));};exports[_0x1003('0x56')]=function(_0x1bdc52,_0x14aef1){return db[_0x1003('0x3d')][_0x1003('0x56')](_0x1bdc52['body'],{})[_0x1003('0x1f')](function(_0x3bb12b){var _0x2d5e44=_0x1bdc52[_0x1003('0x57')][_0x1003('0x36')]({'plain':!![]});if(!_0x2d5e44)throw new Error(_0x1003('0x58'));if(_0x2d5e44['role']==='user'){var _0x221d51=_0x3bb12b['get']({'plain':!![]});var _0x21de75=_0x1003('0x59');return db['UserProfileSection'][_0x1003('0x5a')]({'where':{'name':_0x21de75,'userProfileId':_0x2d5e44[_0x1003('0x5b')]},'raw':!![]})[_0x1003('0x1f')](function(_0x2fcf2e){if(_0x2fcf2e&&_0x2fcf2e[_0x1003('0x5c')]===0x0){return db[_0x1003('0x5d')][_0x1003('0x56')]({'name':_0x221d51[_0x1003('0x39')],'resourceId':_0x221d51['id'],'type':_0x2fcf2e['name'],'sectionId':_0x2fcf2e['id']},{})[_0x1003('0x1f')](function(){return _0x3bb12b;});}else{return _0x3bb12b;}})[_0x1003('0x28')](function(_0x85eb09){logger[_0x1003('0x25')](_0x1003('0x5e'),_0x85eb09);throw _0x85eb09;});}return _0x3bb12b;})[_0x1003('0x1f')](respondWithResult(_0x14aef1,0xc9))[_0x1003('0x28')](handleError(_0x14aef1,null));};exports[_0x1003('0x34')]=function(_0x1bf54b,_0x5b4354){if(_0x1bf54b[_0x1003('0x5f')]['id']){delete _0x1bf54b[_0x1003('0x5f')]['id'];}return db[_0x1003('0x3d')][_0x1003('0x5a')]({'where':{'id':_0x1bf54b['params']['id']},'include':[{'model':db['Pause'],'as':_0x1003('0x3b')}]})[_0x1003('0x1f')](handleEntityNotFound(_0x5b4354,null))[_0x1003('0x1f')](saveUpdates(_0x1bf54b['body'],null))['then'](respondWithResult(_0x5b4354,null))[_0x1003('0x28')](handleError(_0x5b4354,null));};exports['destroy']=function(_0x4f3c8e,_0x5b47cd){return db[_0x1003('0x3d')]['find']({'where':{'id':_0x4f3c8e[_0x1003('0x60')]['id']}})[_0x1003('0x1f')](handleEntityNotFound(_0x5b47cd,null))['then'](removeEntity(_0x5b47cd,null))[_0x1003('0x28')](handleError(_0x5b47cd,null));};exports[_0x1003('0x61')]=function(_0x2413a0,_0x1db17c){return db['SmsAccount'][_0x1003('0x61')]()[_0x1003('0x1f')](respondWithResult(_0x1db17c,null))[_0x1003('0x28')](handleError(_0x1db17c,null));};exports[_0x1003('0x62')]=function(_0xeb7f9c,_0x2c51d6,_0x455c97){if(_0xeb7f9c['body']['id']){delete _0xeb7f9c[_0x1003('0x5f')]['id'];}return db[_0x1003('0x3d')][_0x1003('0x5a')]({'where':{'id':_0xeb7f9c[_0x1003('0x60')]['id']}})[_0x1003('0x1f')](handleEntityNotFound(_0x2c51d6,null))['then'](function(_0x36b35c){if(_0x36b35c){_0xeb7f9c[_0x1003('0x5f')][_0x1003('0x63')]=_0x36b35c['id'];return db[_0x1003('0x64')]['create'](_0xeb7f9c[_0x1003('0x5f')]);}})[_0x1003('0x1f')](respondWithResult(_0x2c51d6,null))[_0x1003('0x28')](handleError(_0x2c51d6,null));};exports[_0x1003('0x65')]=function(_0x30a41d,_0x54d34e,_0x4ac86){var _0x51f23e={'raw':![],'where':{}};var _0x3cdb7e={};var _0x5426c7={'count':0x0,'rows':[]};return db[_0x1003('0x3d')][_0x1003('0x66')]({'where':{'id':_0x30a41d[_0x1003('0x60')]['id']}})['then'](handleEntityNotFound(_0x54d34e,null))[_0x1003('0x1f')](function(_0x246659){if(_0x246659){_0x3cdb7e[_0x1003('0x42')]=_[_0x1003('0x43')](db[_0x1003('0x64')][_0x1003('0x3e')]);_0x3cdb7e[_0x1003('0x44')]=_['keys'](_0x30a41d['query']);_0x3cdb7e['filters']=_[_0x1003('0x45')](_0x3cdb7e[_0x1003('0x42')],_0x3cdb7e['query']);_0x51f23e[_0x1003('0x47')]=_[_0x1003('0x45')](_0x3cdb7e[_0x1003('0x42')],qs[_0x1003('0x46')](_0x30a41d['query'][_0x1003('0x46')]));_0x51f23e['attributes']=_0x51f23e['attributes'][_0x1003('0x48')]?_0x51f23e[_0x1003('0x47')]:_0x3cdb7e[_0x1003('0x42')];if(!_0x30a41d[_0x1003('0x44')]['hasOwnProperty'](_0x1003('0x49'))){_0x51f23e[_0x1003('0x2d')]=qs[_0x1003('0x2d')](_0x30a41d[_0x1003('0x44')][_0x1003('0x2d')]);_0x51f23e[_0x1003('0x2b')]=qs[_0x1003('0x2b')](_0x30a41d['query'][_0x1003('0x2b')]);}_0x51f23e['order']=qs[_0x1003('0x4b')](_0x30a41d[_0x1003('0x44')]['sort']);_0x51f23e[_0x1003('0x4c')]=qs['filters'](_[_0x1003('0x4e')](_0x30a41d[_0x1003('0x44')],_0x3cdb7e['filters']));_0x51f23e[_0x1003('0x4c')]['SmsAccountId']=_0x246659['id'];if(_0x30a41d[_0x1003('0x44')][_0x1003('0x51')]){_0x51f23e['where']=_[_0x1003('0x4f')](_0x51f23e['where'],{'$or':_[_0x1003('0x3c')](_0x51f23e['attributes'],function(_0xdf8024){var _0xcd71af={};_0xcd71af[_0xdf8024]={'$like':'%'+_0x30a41d['query']['filter']+'%'};return _0xcd71af;})});}_0x51f23e=_['merge']({},_0x51f23e,_0x30a41d['options']);return db[_0x1003('0x64')][_0x1003('0x2e')]({'where':_0x51f23e[_0x1003('0x4c')]})[_0x1003('0x1f')](function(_0x4e304b){_0x5426c7[_0x1003('0x2e')]=_0x4e304b;if(_0x30a41d['query'][_0x1003('0x53')]){_0x51f23e[_0x1003('0x67')]=[{'all':!![]}];}return db[_0x1003('0x64')][_0x1003('0x54')](_0x51f23e);})['then'](function(_0x58c828){_0x5426c7[_0x1003('0x55')]=_0x58c828;return _0x5426c7;});}})[_0x1003('0x1f')](respondWithFilteredResult(_0x54d34e,_0x51f23e))['catch'](handleError(_0x54d34e,null));};exports['removeDispositions']=function(_0x368013,_0x2beb70,_0x394ddd){return db[_0x1003('0x3d')]['find']({'where':{'id':_0x368013['params']['id']}})[_0x1003('0x1f')](handleEntityNotFound(_0x2beb70,null))[_0x1003('0x1f')](function(_0x3b53b6){if(_0x3b53b6){return _0x3b53b6[_0x1003('0x68')](_0x368013[_0x1003('0x44')]['ids']);}})['then'](respondWithStatusCode(_0x2beb70,null))[_0x1003('0x28')](handleError(_0x2beb70,null));};exports[_0x1003('0x69')]=function(_0x54f5e5,_0x1af02c,_0x186169){if(_0x54f5e5[_0x1003('0x5f')]['id']){delete _0x54f5e5[_0x1003('0x5f')]['id'];}return db[_0x1003('0x3d')][_0x1003('0x5a')]({'where':{'id':_0x54f5e5['params']['id']}})[_0x1003('0x1f')](handleEntityNotFound(_0x1af02c,null))['then'](function(_0x5d9c61){if(_0x5d9c61){_0x54f5e5['body'][_0x1003('0x63')]=_0x5d9c61['id'];return db[_0x1003('0x6a')][_0x1003('0x56')](_0x54f5e5[_0x1003('0x5f')]);}})[_0x1003('0x1f')](respondWithResult(_0x1af02c,null))[_0x1003('0x28')](handleError(_0x1af02c,null));};exports[_0x1003('0x6b')]=function(_0xae759d,_0x503f75,_0x351e8c){var _0xbbdbee={'raw':![],'where':{}};var _0x5b58c9={};var _0x46b9aa={'count':0x0,'rows':[]};return db['SmsAccount'][_0x1003('0x66')]({'where':{'id':_0xae759d[_0x1003('0x60')]['id']}})['then'](handleEntityNotFound(_0x503f75,null))[_0x1003('0x1f')](function(_0x488fc2){if(_0x488fc2){_0x5b58c9[_0x1003('0x42')]=_[_0x1003('0x43')](db[_0x1003('0x6a')][_0x1003('0x3e')]);_0x5b58c9[_0x1003('0x44')]=_[_0x1003('0x43')](_0xae759d[_0x1003('0x44')]);_0x5b58c9[_0x1003('0x4d')]=_['intersection'](_0x5b58c9['model'],_0x5b58c9[_0x1003('0x44')]);_0xbbdbee['attributes']=_['intersection'](_0x5b58c9['model'],qs[_0x1003('0x46')](_0xae759d[_0x1003('0x44')][_0x1003('0x46')]));_0xbbdbee[_0x1003('0x47')]=_0xbbdbee[_0x1003('0x47')][_0x1003('0x48')]?_0xbbdbee[_0x1003('0x47')]:_0x5b58c9[_0x1003('0x42')];if(!_0xae759d[_0x1003('0x44')]['hasOwnProperty'](_0x1003('0x49'))){_0xbbdbee[_0x1003('0x2d')]=qs[_0x1003('0x2d')](_0xae759d[_0x1003('0x44')][_0x1003('0x2d')]);_0xbbdbee[_0x1003('0x2b')]=qs[_0x1003('0x2b')](_0xae759d[_0x1003('0x44')][_0x1003('0x2b')]);}_0xbbdbee['order']=qs['sort'](_0xae759d[_0x1003('0x44')][_0x1003('0x4b')]);_0xbbdbee[_0x1003('0x4c')]=qs[_0x1003('0x4d')](_[_0x1003('0x4e')](_0xae759d[_0x1003('0x44')],_0x5b58c9[_0x1003('0x4d')]));_0xbbdbee['where'][_0x1003('0x63')]=_0x488fc2['id'];if(_0xae759d[_0x1003('0x44')][_0x1003('0x51')]){_0xbbdbee[_0x1003('0x4c')]=_[_0x1003('0x4f')](_0xbbdbee[_0x1003('0x4c')],{'$or':_['map'](_0xbbdbee[_0x1003('0x47')],function(_0x50d1ac){var _0x116365={};_0x116365[_0x50d1ac]={'$like':'%'+_0xae759d['query'][_0x1003('0x51')]+'%'};return _0x116365;})});}_0xbbdbee=_[_0x1003('0x4f')]({},_0xbbdbee,_0xae759d['options']);return db[_0x1003('0x6a')][_0x1003('0x2e')]({'where':_0xbbdbee['where']})['then'](function(_0x166eff){_0x46b9aa[_0x1003('0x2e')]=_0x166eff;if(_0xae759d[_0x1003('0x44')][_0x1003('0x53')]){_0xbbdbee[_0x1003('0x67')]=[{'all':!![]}];}return db[_0x1003('0x6a')][_0x1003('0x54')](_0xbbdbee);})[_0x1003('0x1f')](function(_0x49018d){_0x46b9aa[_0x1003('0x55')]=_0x49018d;return _0x46b9aa;});}})[_0x1003('0x1f')](respondWithFilteredResult(_0x503f75,_0xbbdbee))[_0x1003('0x28')](handleError(_0x503f75,null));};exports['removeAnswers']=function(_0x1b4f34,_0x1267d3,_0x1cba69){return db[_0x1003('0x3d')]['find']({'where':{'id':_0x1b4f34[_0x1003('0x60')]['id']}})[_0x1003('0x1f')](handleEntityNotFound(_0x1267d3,null))[_0x1003('0x1f')](function(_0x2f0c8a){if(_0x2f0c8a){return _0x2f0c8a[_0x1003('0x6c')](_0x1b4f34['query'][_0x1003('0x6d')]);}})[_0x1003('0x1f')](respondWithStatusCode(_0x1267d3,null))[_0x1003('0x28')](handleError(_0x1267d3,null));};exports[_0x1003('0x6e')]=function(_0x29b5a7,_0x4cefc0,_0x4678d0){var _0x2b3d6d={'channel':_0x1003('0x6f')};var _0x379f55=[];var _0x4c79d7=[];var _0x1269f3={};return db['SmsAccount'][_0x1003('0x5a')]({'where':{'id':_0x29b5a7[_0x1003('0x60')]['id']},'include':[{'model':db[_0x1003('0x70')],'as':'Applications'}]})[_0x1003('0x1f')](handleEntityNotFound(_0x4cefc0,null))[_0x1003('0x1f')](function(_0x4ffad2){_0x2b3d6d[_0x1003('0x71')]=_0x4ffad2;_0x2b3d6d[_0x1003('0x72')]=_[_0x1003('0x73')](_0x4ffad2['Applications'],[_0x1003('0x74')],[_0x1003('0x75')]);if(_0x2b3d6d[_0x1003('0x71')][_0x1003('0x76')]){delete _0x2b3d6d['account']['Applications'];}return db[_0x1003('0x77')][_0x1003('0x61')]();})['then'](function(_0x2f83ed){if(!_0x2f83ed){throw new db[(_0x1003('0x78'))]['ValidationError'](_0x1003('0x79'));}_0x379f55=_['difference'](_[_0x1003('0x43')](_0x2f83ed),['createdAt','updatedAt']);_0x4c79d7=_[_0x1003('0x7a')](_[_0x1003('0x43')](_0x2f83ed),[_0x1003('0x7b'),_0x1003('0x7c'),_0x1003('0x7d'),_0x1003('0x7e')]);_0x2b3d6d[_0x1003('0x5f')]={'mapKey':_0x1003('0x7f')};if(_0x2b3d6d['account'][_0x1003('0x40')]){switch(_0x2b3d6d[_0x1003('0x71')][_0x1003('0x40')]){case'twilio':_0x2b3d6d[_0x1003('0x5f')][_0x1003('0x80')]=_0x29b5a7[_0x1003('0x5f')][_0x1003('0x81')];_0x2b3d6d[_0x1003('0x5f')]['body']=_0x29b5a7[_0x1003('0x5f')][_0x1003('0x82')];_0x2b3d6d['body']['messageId']=_0x29b5a7[_0x1003('0x5f')][_0x1003('0x83')];break;case _0x1003('0x84'):_0x2b3d6d[_0x1003('0x5f')][_0x1003('0x80')]='+'+_0x29b5a7[_0x1003('0x5f')][_0x1003('0x85')];_0x2b3d6d[_0x1003('0x5f')]['body']=_0x29b5a7[_0x1003('0x5f')][_0x1003('0x86')];break;case'connectel':_0x2b3d6d[_0x1003('0x5f')]['from']=_0x29b5a7['body']['from'];_0x2b3d6d[_0x1003('0x5f')][_0x1003('0x5f')]=_0x29b5a7[_0x1003('0x5f')][_0x1003('0x26')];break;case'clicksend':_0x2b3d6d[_0x1003('0x5f')][_0x1003('0x80')]=_0x29b5a7['body'][_0x1003('0x80')];_0x2b3d6d['body']['body']=_0x29b5a7[_0x1003('0x5f')][_0x1003('0x5f')];_0x2b3d6d['body']['messageId']=_0x29b5a7[_0x1003('0x5f')][_0x1003('0x87')];break;case _0x1003('0x88'):_0x2b3d6d[_0x1003('0x5f')][_0x1003('0x80')]=_0x29b5a7[_0x1003('0x5f')][_0x1003('0x81')];_0x2b3d6d[_0x1003('0x5f')][_0x1003('0x5f')]=_0x29b5a7[_0x1003('0x5f')][_0x1003('0x89')];_0x2b3d6d[_0x1003('0x5f')]['messageId']=_0x29b5a7[_0x1003('0x5f')][_0x1003('0x8a')];break;case _0x1003('0x8b'):_0x2b3d6d['body'][_0x1003('0x80')]='+'+_0x29b5a7[_0x1003('0x5f')][_0x1003('0x8c')][0x0]['from'];_0x2b3d6d[_0x1003('0x5f')]['body']=_0x29b5a7[_0x1003('0x5f')][_0x1003('0x8c')][0x0]['text'];_0x2b3d6d['body']['messageId']=_0x29b5a7['body'][_0x1003('0x8c')][0x0]['messageId'];break;case _0x1003('0x8d'):_0x2b3d6d[_0x1003('0x5f')][_0x1003('0x80')]=_0x29b5a7['body'][_0x1003('0x8e')];_0x2b3d6d[_0x1003('0x5f')][_0x1003('0x5f')]=_0x29b5a7[_0x1003('0x5f')]['segmentedMessage'][_0x1003('0x26')];break;case _0x1003('0x8f'):_0x2b3d6d[_0x1003('0x5f')][_0x1003('0x80')]=_0x29b5a7['body']['fromNumber'];_0x2b3d6d[_0x1003('0x5f')][_0x1003('0x5f')]=_0x29b5a7[_0x1003('0x5f')][_0x1003('0x86')];_0x2b3d6d[_0x1003('0x5f')][_0x1003('0x90')]=_0x29b5a7[_0x1003('0x5f')]['replyMessageId'];break;case'bandwidth':_0x2b3d6d[_0x1003('0x5f')]['messageId']=_0x29b5a7['body'][0x0][_0x1003('0x26')]['id'];_0x2b3d6d[_0x1003('0x5f')][_0x1003('0x80')]=_0x29b5a7[_0x1003('0x5f')][0x0][_0x1003('0x26')]['from'];_0x2b3d6d['body'][_0x1003('0x5f')]=_0x29b5a7[_0x1003('0x5f')][0x0]['message'][_0x1003('0x86')];break;case _0x1003('0x91'):_0x2b3d6d[_0x1003('0x5f')]['from']=_0x29b5a7[_0x1003('0x5f')][_0x1003('0x80')];_0x2b3d6d[_0x1003('0x5f')][_0x1003('0x5f')]=_0x29b5a7['body'][_0x1003('0x26')];_0x2b3d6d[_0x1003('0x5f')][_0x1003('0x90')]=_0x29b5a7[_0x1003('0x5f')][_0x1003('0x92')];break;}}if(_0x2b3d6d[_0x1003('0x5f')]['id']){delete _0x2b3d6d[_0x1003('0x5f')]['id'];}if(_[_0x1003('0x93')](_0x2b3d6d['body']['from'])){throw new db['Sequelize']['ValidationError'](_0x1003('0x94'));}if(_[_0x1003('0x93')](_0x2b3d6d[_0x1003('0x5f')][_0x1003('0x5f')])||_0x2b3d6d[_0x1003('0x5f')]['body']===''){throw new db[(_0x1003('0x78'))][(_0x1003('0x95'))](_0x1003('0x96'));}if(_['isNil'](_0x2b3d6d[_0x1003('0x5f')][_0x1003('0x97')])){throw new db['Sequelize'][(_0x1003('0x95'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4c79d7);}if(!_[_0x1003('0x98')](_0x4c79d7,_0x2b3d6d[_0x1003('0x5f')][_0x1003('0x97')])){throw new db[(_0x1003('0x78'))][(_0x1003('0x95'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4c79d7);}_0x1269f3[_0x2b3d6d[_0x1003('0x5f')]['mapKey']]=_0x2b3d6d[_0x1003('0x5f')][_0x1003('0x80')];return db[_0x1003('0x99')][_0x1003('0x5a')]({'where':{'id':_0x2b3d6d[_0x1003('0x71')][_0x1003('0x7e')]},'include':[{'model':db[_0x1003('0x77')],'as':_0x1003('0x9a'),'where':_0x1269f3,'limit':0x1,'order':[[_0x1003('0x7c'),'DESC']]}]});})[_0x1003('0x1f')](handleEntityNotFound(_0x4cefc0,null))[_0x1003('0x1f')](function(_0x50afd1){if(_0x50afd1){_0x2b3d6d['list']=_[_0x1003('0x9b')](_0x50afd1,['Contacts']);if(_0x50afd1[_0x1003('0x9a')][_0x1003('0x48')]){return _0x50afd1[_0x1003('0x9a')][0x0];}var _0x4c3ae2=_['defaults'](_0x2b3d6d[_0x1003('0x5f')],{'firstName':_0x2b3d6d[_0x1003('0x5f')][_0x1003('0x80')],'ListId':_0x50afd1['id']});_0x4c3ae2[_0x2b3d6d['body'][_0x1003('0x97')]]=_0x2b3d6d[_0x1003('0x5f')][_0x1003('0x80')];return db[_0x1003('0x77')][_0x1003('0x56')](_0x4c3ae2,{'fields':_0x379f55,'raw':!![]});}})['then'](handleEntityNotFound(_0x4cefc0,null))['then'](function(_0x1b8214){if(_0x1b8214){_0x2b3d6d[_0x1003('0x9c')]=_0x1b8214;var _0xcf5888={'ContactId':_0x1b8214['id'],'phone':_0x2b3d6d[_0x1003('0x5f')][_0x1003('0x80')],'SmsAccountId':_0x29b5a7[_0x1003('0x60')]['id']};var _0x15aff3={'ContactId':_0x1b8214['id'],'SmsAccountId':_0x29b5a7[_0x1003('0x60')]['id'],'closed':![]};return db['SmsInteraction']['find']({'where':_0x15aff3})[_0x1003('0x1f')](function(_0x1ed379){if(_0x1ed379){return[_0x1ed379,![]];}return db['SmsInteraction']['create'](_0xcf5888)[_0x1003('0x1f')](function(_0x3b36cf){return[_0x3b36cf,!![]];});});}})[_0x1003('0x9d')](function(_0x4fdde8,_0x5ebee6){_0x2b3d6d[_0x1003('0x9e')]=_0x4fdde8[_0x1003('0x36')]({'plain':!![]});_0x2b3d6d[_0x1003('0x9e')][_0x1003('0x9f')]=![];if(_0x5ebee6){if(_0x2b3d6d['account']['autoclose']){_0x2b3d6d['applications']['push']({'id':0x0,'priority':_0x2b3d6d[_0x1003('0x72')][_0x1003('0x48')]+0x1,'app':_0x1003('0xa0'),'appdata':_0x1003('0xa1'),'interval':_0x1003('0xa2')});}_0x2b3d6d[_0x1003('0x9e')]['created']=!![];}return db[_0x1003('0xa3')]['create']({'phone':_0x2b3d6d[_0x1003('0x5f')][_0x1003('0x80')],'messageId':_0x2b3d6d[_0x1003('0x5f')][_0x1003('0x90')],'body':_0x2b3d6d['body'][_0x1003('0x5f')],'SmsAccountId':_0x29b5a7[_0x1003('0x60')]['id'],'SmsInteractionId':_0x4fdde8['id'],'direction':'in','ContactId':_0x4fdde8[_0x1003('0xa4')],'AttachmentId':_0x2b3d6d['body'][_0x1003('0xa5')]});})[_0x1003('0x1f')](function(_0x592d8d){_0x2b3d6d['message']=_0x592d8d;if(_0x2b3d6d[_0x1003('0x9e')][_0x1003('0xa6')]){return db[_0x1003('0xa7')][_0x1003('0x5a')]({'attributes':['id',_0x1003('0x39')],'where':{'id':_0x2b3d6d[_0x1003('0x9e')][_0x1003('0xa6')]}})[_0x1003('0x1f')](function(_0x243b28){if(_0x243b28){_0x2b3d6d[_0x1003('0x72')][_0x1003('0xa8')]({'id':0x0,'priority':0x0,'app':_0x1003('0xa9'),'appdata':_0x243b28[_0x1003('0x39')]+','+(_0x2b3d6d['account'][_0x1003('0xaa')]||0xa),'interval':_0x1003('0xa2')});}return respondWithRpcPromise(_0x1003('0xab'),_0x1003('0xac'),_0x2b3d6d);});}return respondWithRpcPromise(_0x1003('0xab'),_0x1003('0xac'),_0x2b3d6d);})['then'](function(_0x2617fb){if(_0x2617fb){var _0x2a3514=0xc8;var _0x5d77cd=_0x1003('0xad');logger[_0x1003('0x20')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5d77cd,_0x2a3514,'entity\x20found');logger['debug'](_0x1003('0xae'),_0x5d77cd,_0x2a3514,_0x1003('0xaf'),JSON['stringify'](_0x2617fb));if(_0x2b3d6d[_0x1003('0x71')]['type']===_0x1003('0xb0')){return _0x4cefc0['status'](_0x2a3514)[_0x1003('0x2f')](_0x1003('0xb1'),_0x1003('0xb2'))['send'](_0x1003('0xb3'));}else{return _0x4cefc0[_0x1003('0x2a')](_0x2a3514)[_0x1003('0x31')](_0x2617fb);}}})['catch'](handleError(_0x4cefc0,null));};exports[_0x1003('0xb4')]=function(_0x1530be,_0x4e03f9,_0x516f88){return db[_0x1003('0x3d')][_0x1003('0x66')]({'where':{'id':_0x1530be[_0x1003('0x60')]['id']}})[_0x1003('0x1f')](handleEntityNotFound(_0x4e03f9,null))['then'](function(_0x1fc08d){if(_0x1fc08d){return db['sequelize'][_0x1003('0xb5')](function(_0x1fd360){return db['SmsApplication'][_0x1003('0x35')]({'where':{'SmsAccountId':_0x1530be[_0x1003('0x60')]['id']},'transaction':_0x1fd360})[_0x1003('0x1f')](function(_0x303f54){var _0x49296f=_[_0x1003('0x3c')](_0x1530be['body'],function(_0x4a12ea){_0x4a12ea['SmsAccountId']=_0x1530be[_0x1003('0x60')]['id'];return _0x4a12ea;});return db[_0x1003('0x70')][_0x1003('0xb6')](_0x49296f,{'transaction':_0x1fd360});});})[_0x1003('0x1f')](function(){return db[_0x1003('0x70')][_0x1003('0xb7')]({'where':{'SmsAccountId':_0x1530be['params']['id']},'order':_0x1003('0x74')});});}})['then'](respondWithResult(_0x4e03f9,null))[_0x1003('0x28')](handleError(_0x4e03f9,null));};exports[_0x1003('0xb8')]=function(_0x92b274,_0x1b895e,_0x4390d6){var _0x11469b={};var _0xe62fe3={};var _0x4d0cf1;var _0x3fec4a;return db[_0x1003('0x3d')]['findOne']({'where':{'id':_0x92b274[_0x1003('0x60')]['id']}})[_0x1003('0x1f')](handleEntityNotFound(_0x1b895e,null))['then'](function(_0x29cad6){if(_0x29cad6){_0x4d0cf1=_0x29cad6;_0xe62fe3[_0x1003('0x42')]=_[_0x1003('0x43')](db[_0x1003('0x70')][_0x1003('0x3e')]);_0xe62fe3[_0x1003('0x44')]=_[_0x1003('0x43')](_0x92b274[_0x1003('0x44')]);_0xe62fe3[_0x1003('0x4d')]=_['intersection'](_0xe62fe3[_0x1003('0x42')],_0xe62fe3[_0x1003('0x44')]);_0x11469b[_0x1003('0x47')]=_[_0x1003('0x45')](_0xe62fe3[_0x1003('0x42')],qs[_0x1003('0x46')](_0x92b274[_0x1003('0x44')]['fields']));_0x11469b['attributes']=_0x11469b[_0x1003('0x47')][_0x1003('0x48')]?_0x11469b['attributes']:_0xe62fe3['model'];_0x11469b[_0x1003('0x4a')]=qs[_0x1003('0x4b')](_0x92b274['query'][_0x1003('0x4b')]);_0x11469b[_0x1003('0x4c')]=qs['filters'](_[_0x1003('0x4e')](_0x92b274['query'],_0xe62fe3[_0x1003('0x4d')]));if(_0x92b274[_0x1003('0x44')][_0x1003('0x51')]){_0x11469b['where']=_['merge'](_0x11469b[_0x1003('0x4c')],{'$or':_[_0x1003('0x3c')](_0x11469b['attributes'],function(_0x1b5c77){var _0xd6ad43={};_0xd6ad43[_0x1b5c77]={'$like':'%'+_0x92b274['query'][_0x1003('0x51')]+'%'};return _0xd6ad43;})});}_0x11469b=_['merge']({},_0x11469b,_0x92b274[_0x1003('0x52')]);return _0x4d0cf1['getApplications'](_0x11469b);}})[_0x1003('0x1f')](function(_0x46727d){if(_0x46727d){_0x3fec4a=_0x46727d[_0x1003('0x48')];if(!_0x92b274[_0x1003('0x44')]['hasOwnProperty'](_0x1003('0x49'))){_0x11469b[_0x1003('0x2d')]=qs[_0x1003('0x2d')](_0x92b274[_0x1003('0x44')]['limit']);_0x11469b['offset']=qs['offset'](_0x92b274[_0x1003('0x44')][_0x1003('0x2b')]);}return _0x4d0cf1[_0x1003('0xb8')](_0x11469b);}})[_0x1003('0x1f')](function(_0x3197e5){if(_0x3197e5){return _0x3197e5?{'count':_0x3fec4a,'rows':_0x3197e5}:null;}})[_0x1003('0x1f')](respondWithResult(_0x1b895e,null))[_0x1003('0x28')](handleError(_0x1b895e,null));};exports[_0x1003('0xb9')]=function(_0x856ceb,_0x4d7a9c,_0x13b2eb){var _0x211b80={'raw':![],'where':{}};var _0x342b5e={};var _0x1a8018={'count':0x0,'rows':[]};return db['SmsAccount'][_0x1003('0x66')]({'where':{'id':_0x856ceb[_0x1003('0x60')]['id']}})[_0x1003('0x1f')](handleEntityNotFound(_0x4d7a9c,null))['then'](function(_0x28cb76){if(_0x28cb76){_0x342b5e[_0x1003('0x42')]=_[_0x1003('0x43')](db[_0x1003('0xba')]['rawAttributes']);_0x342b5e[_0x1003('0x44')]=_[_0x1003('0x43')](_0x856ceb[_0x1003('0x44')]);_0x342b5e[_0x1003('0x4d')]=_[_0x1003('0x45')](_0x342b5e[_0x1003('0x42')],_0x342b5e['query']);_0x211b80[_0x1003('0x47')]=_[_0x1003('0x45')](_0x342b5e[_0x1003('0x42')],qs[_0x1003('0x46')](_0x856ceb[_0x1003('0x44')][_0x1003('0x46')]));_0x211b80[_0x1003('0x47')]=_0x211b80[_0x1003('0x47')][_0x1003('0x48')]?_0x211b80[_0x1003('0x47')]:_0x342b5e[_0x1003('0x42')];if(!_0x856ceb[_0x1003('0x44')][_0x1003('0xbb')](_0x1003('0x49'))){_0x211b80[_0x1003('0x2d')]=qs['limit'](_0x856ceb[_0x1003('0x44')]['limit']);_0x211b80[_0x1003('0x2b')]=qs[_0x1003('0x2b')](_0x856ceb[_0x1003('0x44')][_0x1003('0x2b')]);}_0x211b80[_0x1003('0x4a')]=qs[_0x1003('0x4b')](_0x856ceb['query'][_0x1003('0x4b')]);_0x211b80[_0x1003('0x4c')]=qs[_0x1003('0x4d')](_[_0x1003('0x4e')](_0x856ceb['query'],_0x342b5e[_0x1003('0x4d')]));_0x211b80[_0x1003('0x4c')][_0x1003('0x63')]=_0x28cb76['id'];if(_0x856ceb[_0x1003('0x44')][_0x1003('0x51')]){_0x211b80[_0x1003('0x4c')]=_[_0x1003('0x4f')](_0x211b80[_0x1003('0x4c')],{'$or':_[_0x1003('0x3c')](_0x211b80[_0x1003('0x47')],function(_0x4adf04){var _0x2cf0fb={};_0x2cf0fb[_0x4adf04]={'$like':'%'+_0x856ceb['query']['filter']+'%'};return _0x2cf0fb;})});}_0x211b80=_[_0x1003('0x4f')]({},_0x211b80,_0x856ceb[_0x1003('0x52')]);return db[_0x1003('0xba')][_0x1003('0x2e')]({'where':_0x211b80[_0x1003('0x4c')]})[_0x1003('0x1f')](function(_0x2d67d8){_0x1a8018[_0x1003('0x2e')]=_0x2d67d8;if(_0x856ceb[_0x1003('0x44')]['includeAll']){_0x211b80[_0x1003('0x67')]=[{'model':db[_0x1003('0x77')],'as':_0x1003('0xbc'),'required':![]},{'model':db[_0x1003('0xa7')],'as':_0x1003('0xbd'),'attributes':[_0x1003('0x39'),_0x1003('0xbe'),'internal'],'required':![]},{'model':db[_0x1003('0xbf')],'as':_0x1003('0xc0'),'attributes':['id','name','color'],'where':_0x856ceb['query'][_0x1003('0xc1')]?{'id':_0x856ceb[_0x1003('0x44')][_0x1003('0xc1')]}:undefined,'required':_0x856ceb[_0x1003('0x44')]['tag']?!![]:![]}];}return db['SmsInteraction'][_0x1003('0x54')](_0x211b80);})[_0x1003('0x1f')](function(_0x1068f9){_0x1a8018['rows']=_0x1068f9;return _0x1a8018;});}})[_0x1003('0x1f')](respondWithFilteredResult(_0x4d7a9c,_0x211b80))[_0x1003('0x28')](handleError(_0x4d7a9c,null));};exports[_0x1003('0xc2')]=function(_0xc8398f,_0x47615b,_0x30f5d5){var _0x5ecc6d,_0x5f3e63,_0x1553d2;if(_[_0x1003('0x93')](_0xc8398f[_0x1003('0x5f')][_0x1003('0x5f')])||_0xc8398f[_0x1003('0x5f')][_0x1003('0x5f')]===''){throw new db[(_0x1003('0x78'))]['ValidationError'](_0x1003('0x96'));}if(_[_0x1003('0x93')](_0xc8398f['body']['to'])){throw new db[(_0x1003('0x78'))][(_0x1003('0x95'))](_0x1003('0xc3'));}_0x5ecc6d=_0xc8398f[_0x1003('0x5f')]['to'];return db[_0x1003('0x3d')][_0x1003('0x5a')]({'where':{'id':_0xc8398f[_0x1003('0x60')]['id']},'include':[{'model':db[_0x1003('0x99')],'as':_0x1003('0xc4'),'include':[{'model':db[_0x1003('0x77')],'as':_0x1003('0x9a'),'where':{'mobile':_0x5ecc6d},'limit':0x1,'order':[[_0x1003('0x7c'),_0x1003('0xc5')]]}]}]})[_0x1003('0x1f')](handleEntityNotFound(_0x47615b,null))[_0x1003('0x1f')](function(_0x56e39d){if(_0x56e39d&&_0x56e39d[_0x1003('0xc4')]){_0x5f3e63=_0x56e39d[_0x1003('0x36')]({'plain':!![]});if(_0x5f3e63[_0x1003('0xc4')]&&_0x5f3e63[_0x1003('0xc4')][_0x1003('0x9a')][_0x1003('0x48')]){return _0x5f3e63[_0x1003('0xc4')]['Contacts'][0x0];}return db[_0x1003('0x77')][_0x1003('0x56')](_[_0x1003('0x18')](_0xc8398f[_0x1003('0x5f')],{'firstName':_0x5ecc6d,'mobile':_0x5ecc6d,'phone':_0x5ecc6d,'ListId':_0x5f3e63[_0x1003('0x7e')]}));}})['then'](handleEntityNotFound(_0x47615b,null))[_0x1003('0x1f')](function(_0x592dde){if(_0x592dde){_0x1553d2=_0x592dde;return db[_0x1003('0xba')][_0x1003('0x5a')]({'where':{'ContactId':_0x1553d2['id'],'closed':![],'SmsAccountId':_0x5f3e63['id']}})[_0x1003('0x1f')](function(_0x351268){if(_0x351268){return[_0x351268,![]];}return db[_0x1003('0xba')][_0x1003('0x56')]({'UserId':_0xc8398f[_0x1003('0x57')]['id'],'ContactId':_0x1553d2['id'],'SmsAccountId':_0x5f3e63['id'],'phone':_0x5ecc6d,'firstMsgDirection':_0x1003('0xc6'),'Messages':[_[_0x1003('0x4f')](_0xc8398f[_0x1003('0x5f')],{'read':![],'body':_0xc8398f['body']['body'],'phone':_0x5ecc6d,'SmsAccountId':_0x5f3e63['id'],'UserId':_0xc8398f[_0x1003('0x57')]['id'],'ContactId':_0x1553d2['id']})]},{'include':[{'model':db[_0x1003('0xa3')],'as':_0x1003('0xc7')}]})['then'](function(_0x40dceb){return[_0x40dceb,!![]];});});}})[_0x1003('0x9d')](function(_0x53442d,_0x2611a8){if(_0x2611a8){return _0x53442d;}return db[_0x1003('0xa3')]['create'](_['merge'](_0xc8398f[_0x1003('0x5f')],{'read':![],'body':_0xc8398f['body'][_0x1003('0x5f')],'phone':_0x5ecc6d,'SmsAccountId':_0x5f3e63['id'],'SmsInteractionId':_0x53442d['id'],'UserId':_0xc8398f[_0x1003('0x57')]['id'],'ContactId':_0x1553d2['id']}))[_0x1003('0x1f')](function(_0x315f10){_0x53442d['dataValues']['Messages']=[];_0x53442d[_0x1003('0xc8')]['Messages']['push'](_0x315f10[_0x1003('0xc8')]);return _0x53442d;});})[_0x1003('0x1f')](respondWithResult(_0x47615b,null))[_0x1003('0x28')](handleError(_0x47615b,null));};exports[_0x1003('0x2a')]=function(_0x4b257d,_0x45b043,_0x4484d7){if(_0x4b257d[_0x1003('0x5f')]['id']){delete _0x4b257d[_0x1003('0x5f')]['id'];}var _0x222f69,_0x296de2,_0x29f13e;return db['SmsAccount'][_0x1003('0x5a')]({'where':{'id':_0x4b257d[_0x1003('0x60')]['id']}})['then'](handleEntityNotFound(_0x45b043,null))[_0x1003('0x1f')](function(_0x466d2a){if(_0x466d2a){_0x29f13e=_0x466d2a;logger[_0x1003('0xc9')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','received\x20delivery\x20report\x20from',_0x466d2a[_0x1003('0x40')],util['inspect'](_0x4b257d[_0x1003('0x5f')],{'showHidden':![],'depth':null}));switch(_0x466d2a['type']){case _0x1003('0x84'):if(_0x4b257d[_0x1003('0x5f')][_0x1003('0xca')]&&_0x4b257d['body'][_0x1003('0x2a')]){_0x296de2=_0x4b257d[_0x1003('0x5f')][_0x1003('0x2a')];return db[_0x1003('0xa3')]['find']({'where':{'messageId':_0x4b257d['body'][_0x1003('0xca')]}});}break;case'connectel':if(_0x4b257d[_0x1003('0x5f')][_0x1003('0xcb')]&&_0x4b257d[_0x1003('0x5f')][_0x1003('0xcc')]){_0x296de2=_0x4b257d[_0x1003('0x5f')][_0x1003('0xcc')];return db['SmsMessage']['find']({'where':{'messageId':_0x4b257d[_0x1003('0x5f')]['requestid']}});}break;case'clicksend':if(_0x4b257d['body']['message_id']&&_0x4b257d[_0x1003('0x5f')][_0x1003('0xcd')]){_0x296de2=_0x4b257d['body'][_0x1003('0xcd')];return db[_0x1003('0xa3')][_0x1003('0x5a')]({'where':{'messageId':_0x4b257d['body']['message_id']}});}break;case'infobip':var _0x215bee=_0x4b257d[_0x1003('0x5f')][_0x1003('0x8c')][0x0];if(_0x215bee[_0x1003('0x90')]&&_0x215bee['status'][_0x1003('0xce')]===_0x1003('0xcf')){_0x296de2=_0x215bee[_0x1003('0x2a')]['groupName'];return db['SmsMessage'][_0x1003('0x5a')]({'where':{'messageId':_0x215bee[_0x1003('0x90')]}});}break;case _0x1003('0x8f'):if(_0x4b257d['body']['messageId']&&_0x4b257d['body'][_0x1003('0x2a')]){_0x296de2=_0x4b257d[_0x1003('0x5f')][_0x1003('0x2a')];return db[_0x1003('0xa3')][_0x1003('0x5a')]({'where':{'messageId':_0x4b257d[_0x1003('0x5f')][_0x1003('0x90')]}});}break;case _0x1003('0xd0'):if(_0x4b257d['body'][0x0][_0x1003('0x26')]['id']){_0x296de2=_0x4b257d[_0x1003('0x5f')][0x0][_0x1003('0x40')];return db['SmsMessage'][_0x1003('0x5a')]({'where':{'messageId':_0x4b257d['body'][0x0]['message']['id']}});}break;case'intelepeer':if(_0x4b257d['body'][_0x1003('0xd1')]&&_0x4b257d[_0x1003('0x5f')][_0x1003('0x2a')]){_0x296de2=_0x4b257d['body']['status'];return db['SmsMessage'][_0x1003('0x5a')]({'where':{'messageId':_0x4b257d[_0x1003('0x5f')][_0x1003('0xd1')]}});}break;}}})[_0x1003('0x1f')](handleEntityNotFound(_0x45b043,null))[_0x1003('0x1f')](function(_0x35c1ca){if(_0x35c1ca){_0x222f69=_0x35c1ca;switch(_0x29f13e['type']){case _0x1003('0x84'):if(_0x296de2===_0x1003('0xcf')){return _0x222f69[_0x1003('0x34')]({'read':!![]});}else{logger[_0x1003('0x25')](_0x1003('0x23'),'status',_0x1003('0x84'),util['inspect'](_0x4b257d[_0x1003('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x1003('0xd2'):if(_0x296de2==='1'){return _0x222f69[_0x1003('0x34')]({'read':!![]});}else{logger[_0x1003('0x25')](_0x1003('0x23'),_0x1003('0x2a'),_0x1003('0x84'),util['inspect'](_0x4b257d[_0x1003('0x5f')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x4b257d[_0x1003('0x5f')][_0x1003('0xd3')]&&_0x296de2>=0xc8&&_0x296de2<=0xce){return _0x222f69['update']({'read':!![]});}else{logger[_0x1003('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1003('0x2a'),'clicksend',util[_0x1003('0xd4')](_0x4b257d['body'],{'showHidden':![],'depth':null}));}break;case _0x1003('0x8b'):var _0x29884f=_0x4b257d[_0x1003('0x5f')][_0x1003('0x8c')][0x0];if(_0x29884f[_0x1003('0x2a')][_0x1003('0xce')]==='DELIVERED'){return _0x222f69[_0x1003('0x34')]({'read':!![]});}else{logger[_0x1003('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','infobip',util[_0x1003('0xd4')](_0x4b257d['body'],{'showHidden':![],'depth':null}));}break;case _0x1003('0x8f'):if(_0x296de2==_0x1003('0xd5')||_0x296de2=='RECEIVED_BY_RECIPIENT'){return _0x222f69[_0x1003('0x34')]({'read':!![]});}else{logger['error'](_0x1003('0x23'),_0x1003('0x2a'),_0x1003('0x8f'),util[_0x1003('0xd4')](_0x4b257d['body'],{'showHidden':![],'depth':null}));}break;case _0x1003('0xd0'):if(_0x296de2==_0x1003('0xd6')){return _0x222f69[_0x1003('0x34')]({'read':!![]});}else{logger[_0x1003('0x25')](_0x1003('0x23'),'status',_0x1003('0xd0'),util[_0x1003('0xd4')](_0x4b257d[_0x1003('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x1003('0x91'):if(_0x296de2==='DELIVRD'||_0x296de2===_0x1003('0xd7')){return _0x222f69[_0x1003('0x34')]({'read':!![]});}else{logger[_0x1003('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1003('0x2a'),_0x1003('0x91'),util[_0x1003('0xd4')](_0x4b257d['body'],{'showHidden':![],'depth':null}));}break;}return _0x222f69;}})[_0x1003('0x1f')](respondWithResult(_0x45b043,null))[_0x1003('0x28')](handleError(_0x45b043,null));};exports['statusGet']=function(_0x1d25b6,_0x1a1334,_0x6a3f0e){var _0x34fbd7,_0x1188a4,_0x3aa287;return db[_0x1003('0x3d')]['find']({'where':{'id':_0x1d25b6['params']['id']}})[_0x1003('0x1f')](handleEntityNotFound(_0x1a1334,null))[_0x1003('0x1f')](function(_0x5d56d3){if(_0x5d56d3){_0x3aa287=_0x5d56d3;logger['debug'](_0x1003('0x23'),_0x1003('0x2a'),'received\x20delivery\x20report\x20from',_0x5d56d3['type'],util[_0x1003('0xd4')](_0x1d25b6[_0x1003('0x44')],{'showHidden':![],'depth':null}));switch(_0x5d56d3[_0x1003('0x40')]){case _0x1003('0x8d'):if(_0x1d25b6[_0x1003('0x44')]['message-id']&&_0x1d25b6[_0x1003('0x44')]['state']){_0x1188a4=_0x1d25b6[_0x1003('0x44')]['state'];return db['SmsMessage'][_0x1003('0x5a')]({'where':{'messageId':_0x1d25b6[_0x1003('0x44')]['message-id']}});}break;}}})[_0x1003('0x1f')](handleEntityNotFound(_0x1a1334,null))[_0x1003('0x1f')](function(_0x30f494){if(_0x30f494){_0x34fbd7=_0x30f494;switch(_0x3aa287['type']){case _0x1003('0x8d'):if(_0x1188a4==='2'||_0x1188a4==='6'){return _0x34fbd7[_0x1003('0x34')]({'read':!![]});}else{logger[_0x1003('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','csc',util[_0x1003('0xd4')](_0x1d25b6[_0x1003('0x44')],{'showHidden':![],'depth':null}));};break;}return _0x34fbd7;}})[_0x1003('0x1f')](respondWithResult(_0x1a1334,null))[_0x1003('0x28')](handleError(_0x1a1334,null));};exports[_0x1003('0xd8')]=function(_0x464d80,_0x23fba7,_0x1b88b3){return db['SmsAccount'][_0x1003('0x5a')]({'where':{'id':_0x464d80[_0x1003('0x60')]['id']}})[_0x1003('0x1f')](handleEntityNotFound(_0x23fba7,null))['then'](function(_0x4e530e){if(_0x4e530e){return _0x4e530e[_0x1003('0xd8')](_0x464d80[_0x1003('0x5f')][_0x1003('0x6d')],_[_0x1003('0x9b')](_0x464d80['body'],[_0x1003('0x6d'),'id'])||{})[_0x1003('0x9d')](function(_0x428fc2){for(var _0x354a81=0x0;_0x354a81<_0x464d80['body'][_0x1003('0x6d')][_0x1003('0x48')];_0x354a81+=0x1){socket['emit']('userSmsAccount:save',{'UserId':Number(_0x464d80[_0x1003('0x5f')][_0x1003('0x6d')][_0x354a81]),'SmsAccountId':Number(_0x464d80['params']['id'])});}return _0x428fc2;});}})[_0x1003('0x1f')](respondWithResult(_0x23fba7,null))['catch'](handleError(_0x23fba7,null));};exports[_0x1003('0xd9')]=function(_0x2806d0,_0x1d6210,_0x92d2d2){return db['SmsAccount'][_0x1003('0x5a')]({'where':{'id':_0x2806d0[_0x1003('0x60')]['id']}})['then'](handleEntityNotFound(_0x1d6210,null))['then'](function(_0x313964){if(_0x313964){return _0x313964[_0x1003('0xd9')](_0x2806d0['query']['ids'])[_0x1003('0x1f')](function(){if(_[_0x1003('0xda')](_0x2806d0[_0x1003('0x44')]['ids'])){for(var _0x148cd1=0x0;_0x148cd1<_0x2806d0[_0x1003('0x44')][_0x1003('0x6d')]['length'];_0x148cd1+=0x1){socket['emit'](_0x1003('0xdb'),{'UserId':Number(_0x2806d0['query'][_0x1003('0x6d')][_0x148cd1]),'SmsAccountId':Number(_0x2806d0[_0x1003('0x60')]['id'])});}}else{socket[_0x1003('0xdc')]('userSmsAccount:remove',{'UserId':Number(_0x2806d0['query'][_0x1003('0x6d')]),'SmsAccountId':Number(_0x2806d0[_0x1003('0x60')]['id'])});}});}})['then'](respondWithStatusCode(_0x1d6210,null))[_0x1003('0x28')](handleError(_0x1d6210,null));};exports['getAgents']=function(_0x11fc97,_0x49ecfb,_0x12e18b){var _0x1d70f9={};var _0x5b29db={};var _0x2642c5;var _0x146577;return db[_0x1003('0x3d')][_0x1003('0x66')]({'where':{'id':_0x11fc97[_0x1003('0x60')]['id']}})['then'](handleEntityNotFound(_0x49ecfb,null))[_0x1003('0x1f')](function(_0xb043fb){if(_0xb043fb){_0x2642c5=_0xb043fb;_0x5b29db['model']=_['keys'](db[_0x1003('0xa7')][_0x1003('0x3e')]);_0x5b29db['query']=_[_0x1003('0x43')](_0x11fc97[_0x1003('0x44')]);_0x5b29db[_0x1003('0x4d')]=_[_0x1003('0x45')](_0x5b29db[_0x1003('0x42')],_0x5b29db[_0x1003('0x44')]);_0x1d70f9[_0x1003('0x47')]=_[_0x1003('0x45')](_0x5b29db['model'],qs[_0x1003('0x46')](_0x11fc97[_0x1003('0x44')][_0x1003('0x46')]));_0x1d70f9[_0x1003('0x47')]=_0x1d70f9[_0x1003('0x47')][_0x1003('0x48')]?_0x1d70f9['attributes']:_0x5b29db[_0x1003('0x42')];_0x1d70f9['order']=qs['sort'](_0x11fc97[_0x1003('0x44')]['sort']);_0x1d70f9[_0x1003('0x4c')]=qs[_0x1003('0x4d')](_[_0x1003('0x4e')](_0x11fc97['query'],_0x5b29db['filters']));if(_0x11fc97[_0x1003('0x44')]['filter']){_0x1d70f9[_0x1003('0x4c')]=_['merge'](_0x1d70f9['where'],{'$or':_[_0x1003('0x3c')](_0x1d70f9[_0x1003('0x47')],function(_0x1bf326){var _0x459cdd={};_0x459cdd[_0x1bf326]={'$like':'%'+_0x11fc97[_0x1003('0x44')][_0x1003('0x51')]+'%'};return _0x459cdd;})});}_0x1d70f9=_[_0x1003('0x4f')]({},_0x1d70f9,_0x11fc97[_0x1003('0x52')]);return _0x2642c5[_0x1003('0xdd')](_0x1d70f9);}})[_0x1003('0x1f')](function(_0x1b8e3a){if(_0x1b8e3a){_0x146577=_0x1b8e3a[_0x1003('0x48')];if(!_0x11fc97[_0x1003('0x44')][_0x1003('0xbb')](_0x1003('0x49'))){_0x1d70f9[_0x1003('0x2d')]=qs[_0x1003('0x2d')](_0x11fc97[_0x1003('0x44')][_0x1003('0x2d')]);_0x1d70f9[_0x1003('0x2b')]=qs['offset'](_0x11fc97[_0x1003('0x44')]['offset']);}return _0x2642c5['getAgents'](_0x1d70f9);}})[_0x1003('0x1f')](function(_0x30c1b0){if(_0x30c1b0){return _0x30c1b0?{'count':_0x146577,'rows':_0x30c1b0}:null;}})[_0x1003('0x1f')](respondWithResult(_0x49ecfb,null))['catch'](handleError(_0x49ecfb,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index d1a057e..fd03ed0 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 _0xe12f=['../../mysqldb','SmsAccount','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x4951d0,_0x5cad88){var _0x164fe3=function(_0x4dea28){while(--_0x4dea28){_0x4951d0['push'](_0x4951d0['shift']());}};_0x164fe3(++_0x5cad88);}(_0xe12f,0x99));var _0xfe12=function(_0x275251,_0x3f0c78){_0x275251=_0x275251-0x0;var _0x195d5e=_0xe12f[_0x275251];return _0x195d5e;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0xfe12('0x0'))['db'][_0xfe12('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xfe12('0x2')](0x0);var events={'afterCreate':_0xfe12('0x3'),'afterUpdate':_0xfe12('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1c70b7){return function(_0x1abb08,_0x4ad402,_0xa99418){SmsAccountEvents[_0xfe12('0x5')](_0x1c70b7+':'+_0x1abb08['id'],_0x1abb08);SmsAccountEvents[_0xfe12('0x5')](_0x1c70b7,_0x1abb08);_0xa99418(null);};}for(var e in events){if(events[_0xfe12('0x6')](e)){var event=events[e];SmsAccount[_0xfe12('0x7')](e,emitEvent(event));}}module[_0xfe12('0x8')]=SmsAccountEvents; \ No newline at end of file +var _0x5ae2=['hook','exports','events','../../mysqldb','SmsAccount','setMaxListeners','update','remove','emit'];(function(_0xdd02c2,_0x305981){var _0x32fa7c=function(_0x29a934){while(--_0x29a934){_0xdd02c2['push'](_0xdd02c2['shift']());}};_0x32fa7c(++_0x305981);}(_0x5ae2,0x1c4));var _0x25ae=function(_0x3c819c,_0x2ef9e9){_0x3c819c=_0x3c819c-0x0;var _0x304099=_0x5ae2[_0x3c819c];return _0x304099;};'use strict';var EventEmitter=require(_0x25ae('0x0'));var SmsAccount=require(_0x25ae('0x1'))['db'][_0x25ae('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x25ae('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x25ae('0x4'),'afterDestroy':_0x25ae('0x5')};function emitEvent(_0x1183de){return function(_0x3795e2,_0x5a9c3c,_0x2ca77d){SmsAccountEvents[_0x25ae('0x6')](_0x1183de+':'+_0x3795e2['id'],_0x3795e2);SmsAccountEvents['emit'](_0x1183de,_0x3795e2);_0x2ca77d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x25ae('0x7')](e,emitEvent(event));}}module[_0x25ae('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 34880ae..d6b8413 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 _0xdace=['../../config/logger','moment','bluebird','path','../../config/environment','./smsAccount.attributes','exports','define','sms_accounts','util'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0xdace,0x9f));var _0xedac=function(_0x37b7b6,_0x165a5c){_0x37b7b6=_0x37b7b6-0x0;var _0x10c4c3=_0xdace[_0x37b7b6];return _0x10c4c3;};'use strict';var _=require('lodash');var util=require(_0xedac('0x0'));var logger=require(_0xedac('0x1'))('api');var moment=require(_0xedac('0x2'));var BPromise=require(_0xedac('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xedac('0x4'));var rimraf=require('rimraf');var config=require(_0xedac('0x5'));var attributes=require(_0xedac('0x6'));module[_0xedac('0x7')]=function(_0x1bab6d,_0x4a2296){return _0x1bab6d[_0xedac('0x8')]('SmsAccount',attributes,{'tableName':_0xedac('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb75d=['rimraf','./smsAccount.attributes','exports','define','sms_accounts','lodash','moment','path'];(function(_0x41d4bf,_0x2004c8){var _0x1be817=function(_0x159a26){while(--_0x159a26){_0x41d4bf['push'](_0x41d4bf['shift']());}};_0x1be817(++_0x2004c8);}(_0xb75d,0x1ed));var _0xdb75=function(_0x154192,_0x2d360f){_0x154192=_0x154192-0x0;var _0x3c2792=_0xb75d[_0x154192];return _0x3c2792;};'use strict';var _=require(_0xdb75('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xdb75('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xdb75('0x2'));var rimraf=require(_0xdb75('0x3'));var config=require('../../config/environment');var attributes=require(_0xdb75('0x4'));module[_0xdb75('0x5')]=function(_0x56e455,_0x43dd59){return _0x56e455[_0xdb75('0x6')]('SmsAccount',attributes,{'tableName':_0xdb75('0x7'),'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 f47d008..3595a1b 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 _0x9ba4=['info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowSmsAccount','SmsAccount','find','options','include','map','model','attributes','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','defaults','localhost','socket.io-emitter','redis','./smsAccount.socket','register','then'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x9ba4,0x170));var _0x49ba=function(_0x5a0074,_0x2d589){_0x5a0074=_0x5a0074-0x0;var _0x22efb4=_0x9ba4[_0x5a0074];return _0x22efb4;};'use strict';var _=require(_0x49ba('0x0'));var util=require(_0x49ba('0x1'));var moment=require('moment');var BPromise=require(_0x49ba('0x2'));var rs=require(_0x49ba('0x3'));var fs=require('fs');var Redis=require(_0x49ba('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x49ba('0x5'));var logger=require('../../config/logger')(_0x49ba('0x6'));var config=require(_0x49ba('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x49ba('0x8')][_0x49ba('0x9')]({'port':0x232a});config['redis']=_[_0x49ba('0xa')](config['redis'],{'host':_0x49ba('0xb'),'port':0x18eb});var socket=require(_0x49ba('0xc'))(new Redis(config[_0x49ba('0xd')]));require(_0x49ba('0xe'))[_0x49ba('0xf')](socket);function respondWithRpcPromise(_0x1e5b14,_0x3c2f31,_0x43b4af){return new BPromise(function(_0x499d6b,_0x71db7c){return client['request'](_0x1e5b14,_0x43b4af)[_0x49ba('0x10')](function(_0x4d5fc6){logger[_0x49ba('0x11')](_0x49ba('0x12'),_0x3c2f31,_0x49ba('0x13'));logger[_0x49ba('0x14')](_0x49ba('0x15'),_0x3c2f31,_0x49ba('0x13'),JSON[_0x49ba('0x16')](_0x4d5fc6));if(_0x4d5fc6['error']){if(_0x4d5fc6[_0x49ba('0x17')][_0x49ba('0x18')]===0x1f4){logger[_0x49ba('0x17')](_0x49ba('0x12'),_0x3c2f31,_0x4d5fc6[_0x49ba('0x17')][_0x49ba('0x19')]);return _0x71db7c(_0x4d5fc6[_0x49ba('0x17')][_0x49ba('0x19')]);}logger[_0x49ba('0x17')](_0x49ba('0x12'),_0x3c2f31,_0x4d5fc6['error'][_0x49ba('0x19')]);return _0x499d6b(_0x4d5fc6['error'][_0x49ba('0x19')]);}else{logger[_0x49ba('0x11')](_0x49ba('0x12'),_0x3c2f31,'request\x20sent');_0x499d6b(_0x4d5fc6[_0x49ba('0x1a')][_0x49ba('0x19')]);}})['catch'](function(_0x21c7d5){logger[_0x49ba('0x17')](_0x49ba('0x12'),_0x3c2f31,_0x21c7d5);_0x71db7c(_0x21c7d5);});});}exports[_0x49ba('0x1b')]=function(_0x1df15b){var _0x2651c4=this;return new Promise(function(_0x437915,_0x353d0d){return db[_0x49ba('0x1c')][_0x49ba('0x1d')]({'raw':_0x1df15b[_0x49ba('0x1e')]?_0x1df15b[_0x49ba('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x1df15b['options']?_0x1df15b[_0x49ba('0x1e')]['where']||null:null,'attributes':_0x1df15b[_0x49ba('0x1e')]?_0x1df15b[_0x49ba('0x1e')]['attributes']||null:null,'include':_0x1df15b[_0x49ba('0x1e')]?_0x1df15b['options'][_0x49ba('0x1f')]?_[_0x49ba('0x20')](_0x1df15b['options'][_0x49ba('0x1f')],function(_0x49d94c){return{'model':db[_0x49d94c[_0x49ba('0x21')]],'as':_0x49d94c['as'],'attributes':_0x49d94c[_0x49ba('0x22')],'include':_0x49d94c[_0x49ba('0x1f')]?_['map'](_0x49d94c['include'],function(_0x2be8f8){return{'model':db[_0x2be8f8['model']],'as':_0x2be8f8['as'],'attributes':_0x2be8f8[_0x49ba('0x22')],'include':_0x2be8f8[_0x49ba('0x1f')]?_[_0x49ba('0x20')](_0x2be8f8[_0x49ba('0x1f')],function(_0xa94bb1){return{'model':db[_0xa94bb1[_0x49ba('0x21')]],'as':_0xa94bb1['as'],'attributes':_0xa94bb1[_0x49ba('0x22')]};}):[]};}):[]};}):[]:[]})[_0x49ba('0x10')](function(_0x3f1b3b){logger[_0x49ba('0x11')](_0x49ba('0x1b'),_0x1df15b);logger[_0x49ba('0x14')](_0x49ba('0x1b'),_0x1df15b,JSON['stringify'](_0x3f1b3b));_0x437915(_0x3f1b3b);})['catch'](function(_0x2448c1){logger[_0x49ba('0x17')](_0x49ba('0x1b'),_0x2448c1[_0x49ba('0x19')],_0x1df15b);_0x353d0d(_0x2651c4[_0x49ba('0x17')](0x1f4,_0x2448c1[_0x49ba('0x19')]));});});}; \ No newline at end of file +var _0xc84e=['SmsAccount','options','where','attributes','include','map','model','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowSmsAccount'];(function(_0xcf0d77,_0x2195aa){var _0x13b05f=function(_0x2e798b){while(--_0x2e798b){_0xcf0d77['push'](_0xcf0d77['shift']());}};_0x13b05f(++_0x2195aa);}(_0xc84e,0xd9));var _0xec84=function(_0x1bca34,_0x3ee8c3){_0x1bca34=_0x1bca34-0x0;var _0x4ecd21=_0xc84e[_0x1bca34];return _0x4ecd21;};'use strict';var _=require(_0xec84('0x0'));var util=require('util');var moment=require(_0xec84('0x1'));var BPromise=require('bluebird');var rs=require(_0xec84('0x2'));var fs=require('fs');var Redis=require(_0xec84('0x3'));var db=require(_0xec84('0x4'))['db'];var utils=require(_0xec84('0x5'));var logger=require(_0xec84('0x6'))(_0xec84('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xec84('0x8')][_0xec84('0x9')]({'port':0x232a});config['redis']=_[_0xec84('0xa')](config[_0xec84('0xb')],{'host':_0xec84('0xc'),'port':0x18eb});var socket=require(_0xec84('0xd'))(new Redis(config[_0xec84('0xb')]));require('./smsAccount.socket')[_0xec84('0xe')](socket);function respondWithRpcPromise(_0x15dcb0,_0x51231c,_0x181ce6){return new BPromise(function(_0x1a2a0e,_0x1afd9c){return client[_0xec84('0xf')](_0x15dcb0,_0x181ce6)[_0xec84('0x10')](function(_0x4c3c18){logger[_0xec84('0x11')](_0xec84('0x12'),_0x51231c,_0xec84('0x13'));logger[_0xec84('0x14')](_0xec84('0x15'),_0x51231c,_0xec84('0x13'),JSON[_0xec84('0x16')](_0x4c3c18));if(_0x4c3c18['error']){if(_0x4c3c18[_0xec84('0x17')]['code']===0x1f4){logger['error'](_0xec84('0x12'),_0x51231c,_0x4c3c18['error'][_0xec84('0x18')]);return _0x1afd9c(_0x4c3c18['error']['message']);}logger[_0xec84('0x17')](_0xec84('0x12'),_0x51231c,_0x4c3c18[_0xec84('0x17')][_0xec84('0x18')]);return _0x1a2a0e(_0x4c3c18[_0xec84('0x17')][_0xec84('0x18')]);}else{logger['info']('SmsAccount,\x20%s,\x20%s',_0x51231c,_0xec84('0x13'));_0x1a2a0e(_0x4c3c18[_0xec84('0x19')][_0xec84('0x18')]);}})[_0xec84('0x1a')](function(_0x29bc6c){logger['error'](_0xec84('0x12'),_0x51231c,_0x29bc6c);_0x1afd9c(_0x29bc6c);});});}exports[_0xec84('0x1b')]=function(_0x3d6e7e){var _0x4674b2=this;return new Promise(function(_0x5c28c7,_0x5b5ce0){return db[_0xec84('0x1c')]['find']({'raw':_0x3d6e7e['options']?_0x3d6e7e[_0xec84('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x3d6e7e[_0xec84('0x1d')]?_0x3d6e7e[_0xec84('0x1d')][_0xec84('0x1e')]||null:null,'attributes':_0x3d6e7e[_0xec84('0x1d')]?_0x3d6e7e['options'][_0xec84('0x1f')]||null:null,'include':_0x3d6e7e[_0xec84('0x1d')]?_0x3d6e7e[_0xec84('0x1d')][_0xec84('0x20')]?_[_0xec84('0x21')](_0x3d6e7e[_0xec84('0x1d')][_0xec84('0x20')],function(_0x24cc53){return{'model':db[_0x24cc53[_0xec84('0x22')]],'as':_0x24cc53['as'],'attributes':_0x24cc53[_0xec84('0x1f')],'include':_0x24cc53[_0xec84('0x20')]?_[_0xec84('0x21')](_0x24cc53[_0xec84('0x20')],function(_0x4b9c94){return{'model':db[_0x4b9c94[_0xec84('0x22')]],'as':_0x4b9c94['as'],'attributes':_0x4b9c94[_0xec84('0x1f')],'include':_0x4b9c94[_0xec84('0x20')]?_['map'](_0x4b9c94['include'],function(_0x2214f4){return{'model':db[_0x2214f4['model']],'as':_0x2214f4['as'],'attributes':_0x2214f4[_0xec84('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xec84('0x10')](function(_0x3cb7b8){logger[_0xec84('0x11')](_0xec84('0x1b'),_0x3d6e7e);logger['debug'](_0xec84('0x1b'),_0x3d6e7e,JSON[_0xec84('0x16')](_0x3cb7b8));_0x5c28c7(_0x3cb7b8);})['catch'](function(_0x4f4a77){logger[_0xec84('0x17')]('ShowSmsAccount',_0x4f4a77[_0xec84('0x18')],_0x3d6e7e);_0x5b5ce0(_0x4674b2[_0xec84('0x17')](0x1f4,_0x4f4a77[_0xec84('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 982b212..d143005 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'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 631d167..fb2c89a 100644 --- a/server/api/smsApplication/index.js +++ b/server/api/smsApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +var _0x3e74=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer'];(function(_0x249d7c,_0x17163a){var _0x20f24b=function(_0x5db7c4){while(--_0x5db7c4){_0x249d7c['push'](_0x249d7c['shift']());}};_0x20f24b(++_0x17163a);}(_0x3e74,0x175));var _0x43e7=function(_0x569570,_0x224c0d){_0x569570=_0x569570-0x0;var _0x3555ed=_0x3e74[_0x569570];return _0x3555ed;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0xc')]('/',auth[_0x43e7('0x8')](),controller['create']);router[_0x43e7('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router[_0x43e7('0xf')]('/:id',auth[_0x43e7('0x8')](),controller['destroy']);module[_0x43e7('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 0c5bb38..0ce6004 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 _0x55b5=['INTEGER','noop','STRING','exports'];(function(_0x52284f,_0xb0b798){var _0x2a5563=function(_0x364aac){while(--_0x364aac){_0x52284f['push'](_0x52284f['shift']());}};_0x2a5563(++_0xb0b798);}(_0x55b5,0x1c7));var _0x555b=function(_0x20034c,_0x20e668){_0x20034c=_0x20034c-0x0;var _0x45a0dc=_0x55b5[_0x20034c];return _0x45a0dc;};'use strict';var Sequelize=require('sequelize');module[_0x555b('0x0')]={'priority':{'type':Sequelize[_0x555b('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x555b('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x555b('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x7f27=['*,*,*,*','sequelize','STRING','noop','TEXT'];(function(_0xfe4906,_0xab4ccc){var _0x27afa2=function(_0xca437e){while(--_0xca437e){_0xfe4906['push'](_0xfe4906['shift']());}};_0x27afa2(++_0xab4ccc);}(_0x7f27,0x100));var _0x77f2=function(_0x18b99b,_0x58e229){_0x18b99b=_0x18b99b-0x0;var _0x3e55d6=_0x7f27[_0x18b99b];return _0x3e55d6;};'use strict';var Sequelize=require(_0x77f2('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x77f2('0x1')],'allowNull':![],'defaultValue':_0x77f2('0x2')},'appdata':{'type':Sequelize[_0x77f2('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x77f2('0x1')],'defaultValue':_0x77f2('0x4')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 85872bd..3458fb4 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 _0xae7b=['include','findAll','rows','show','params','length','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','path','sox','to-csv','ejs','lodash','squel','crypto','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','where','pick','filter','merge','type','VIRTUAL','SmsApplication','includeAll'];(function(_0x2181b1,_0x569637){var _0x530548=function(_0x4b31f1){while(--_0x4b31f1){_0x2181b1['push'](_0x2181b1['shift']());}};_0x530548(++_0x569637);}(_0xae7b,0x15a));var _0xbae7=function(_0x3bb46a,_0x4d3a51){_0x3bb46a=_0x3bb46a-0x0;var _0xf30f8f=_0xae7b[_0x3bb46a];return _0xf30f8f;};'use strict';var emlformat=require(_0xbae7('0x0'));var rimraf=require(_0xbae7('0x1'));var zipdir=require(_0xbae7('0x2'));var jsonpatch=require(_0xbae7('0x3'));var rp=require('request-promise');var moment=require(_0xbae7('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xbae7('0x5'));var sox=require(_0xbae7('0x6'));var csv=require(_0xbae7('0x7'));var ejs=require(_0xbae7('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbae7('0x9'));var squel=require(_0xbae7('0xa'));var crypto=require(_0xbae7('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbae7('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xbae7('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xbae7('0xd'));var as=require(_0xbae7('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbae7('0xf'))(_0xbae7('0x10'));var utils=require(_0xbae7('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x50b9e6,_0x35a1c9){_0x35a1c9=_0x35a1c9||0xcc;return function(_0x2d7dfe){if(_0x2d7dfe){return _0x50b9e6[_0xbae7('0x12')](_0x35a1c9);}return _0x50b9e6[_0xbae7('0x13')](_0x35a1c9)[_0xbae7('0x14')]();};}function respondWithResult(_0xe92fbb,_0x302178){_0x302178=_0x302178||0xc8;return function(_0x2c2eef){if(_0x2c2eef){return _0xe92fbb['status'](_0x302178)[_0xbae7('0x15')](_0x2c2eef);}};}function respondWithFilteredResult(_0x170284,_0x155082){return function(_0xa8476a){if(_0xa8476a){var _0x1d1765=typeof _0x155082[_0xbae7('0x16')]===_0xbae7('0x17')&&typeof _0x155082['limit']===_0xbae7('0x17');var _0x250730=_0xa8476a[_0xbae7('0x18')];var _0x52aa69=_0x1d1765?0x0:_0x155082[_0xbae7('0x16')];var _0x59dc93=_0x1d1765?_0xa8476a[_0xbae7('0x18')]:_0x155082[_0xbae7('0x16')]+_0x155082[_0xbae7('0x19')];var _0x4900da;if(_0x59dc93>=_0x250730){_0x59dc93=_0x250730;_0x4900da=0xc8;}else{_0x4900da=0xce;}_0x170284[_0xbae7('0x13')](_0x4900da);return _0x170284[_0xbae7('0x1a')](_0xbae7('0x1b'),_0x52aa69+'-'+_0x59dc93+'/'+_0x250730)[_0xbae7('0x15')](_0xa8476a);}return null;};}function patchUpdates(_0x27cd0e){return function(_0x409886){try{jsonpatch[_0xbae7('0x1c')](_0x409886,_0x27cd0e,!![]);}catch(_0x130173){return BPromise[_0xbae7('0x1d')](_0x130173);}return _0x409886['save']();};}function saveUpdates(_0x870230,_0x32f97c){return function(_0x250bde){if(_0x250bde){return _0x250bde['update'](_0x870230)[_0xbae7('0x1e')](function(_0x3840f9){return _0x3840f9;});}return null;};}function removeEntity(_0x3431b5,_0x5b0a9f){return function(_0x2a5bee){if(_0x2a5bee){return _0x2a5bee[_0xbae7('0x1f')]()['then'](function(){_0x3431b5[_0xbae7('0x13')](0xcc)[_0xbae7('0x14')]();});}};}function handleEntityNotFound(_0x5745ed,_0x19c453){return function(_0x5ee528){if(!_0x5ee528){_0x5745ed[_0xbae7('0x12')](0x194);}return _0x5ee528;};}function handleError(_0x4d0f10,_0x35f6d9){_0x35f6d9=_0x35f6d9||0x1f4;return function(_0x41ffda){logger[_0xbae7('0x20')](_0x41ffda[_0xbae7('0x21')]);if(_0x41ffda['name']){delete _0x41ffda[_0xbae7('0x22')];}_0x4d0f10['status'](_0x35f6d9)[_0xbae7('0x23')](_0x41ffda);};}exports['index']=function(_0x3f77c7,_0x4471c9){var _0x4617dd={},_0x59197e={},_0x37b51e={'count':0x0,'rows':[]};var _0xec2053=_[_0xbae7('0x24')](db['SmsApplication'][_0xbae7('0x25')],function(_0x41930a){return{'name':_0x41930a[_0xbae7('0x26')],'type':_0x41930a['type'][_0xbae7('0x27')]};});_0x59197e[_0xbae7('0x28')]=_[_0xbae7('0x24')](_0xec2053,_0xbae7('0x22'));_0x59197e[_0xbae7('0x29')]=_[_0xbae7('0x2a')](_0x3f77c7[_0xbae7('0x29')]);_0x59197e[_0xbae7('0x2b')]=_[_0xbae7('0x2c')](_0x59197e[_0xbae7('0x28')],_0x59197e[_0xbae7('0x29')]);_0x4617dd[_0xbae7('0x2d')]=_[_0xbae7('0x2c')](_0x59197e['model'],qs[_0xbae7('0x2e')](_0x3f77c7['query'][_0xbae7('0x2e')]));_0x4617dd[_0xbae7('0x2d')]=_0x4617dd[_0xbae7('0x2d')]['length']?_0x4617dd['attributes']:_0x59197e['model'];if(!_0x3f77c7[_0xbae7('0x29')][_0xbae7('0x2f')]('nolimit')){_0x4617dd[_0xbae7('0x19')]=qs[_0xbae7('0x19')](_0x3f77c7[_0xbae7('0x29')][_0xbae7('0x19')]);_0x4617dd[_0xbae7('0x16')]=qs[_0xbae7('0x16')](_0x3f77c7[_0xbae7('0x29')][_0xbae7('0x16')]);}_0x4617dd['order']=qs['sort'](_0x3f77c7[_0xbae7('0x29')]['sort']);_0x4617dd[_0xbae7('0x30')]=qs[_0xbae7('0x2b')](_[_0xbae7('0x31')](_0x3f77c7[_0xbae7('0x29')],_0x59197e[_0xbae7('0x2b')]),_0xec2053);if(_0x3f77c7[_0xbae7('0x29')][_0xbae7('0x32')]){_0x4617dd['where']=_[_0xbae7('0x33')](_0x4617dd[_0xbae7('0x30')],{'$or':_[_0xbae7('0x24')](_0xec2053,function(_0x58ef2e){if(_0x58ef2e[_0xbae7('0x34')]!==_0xbae7('0x35')){var _0x106e09={};_0x106e09[_0x58ef2e['name']]={'$like':'%'+_0x3f77c7[_0xbae7('0x29')][_0xbae7('0x32')]+'%'};return _0x106e09;}})});}_0x4617dd=_[_0xbae7('0x33')]({},_0x4617dd,_0x3f77c7['options']);var _0x4e7e89={'where':_0x4617dd['where']};return db[_0xbae7('0x36')]['count'](_0x4e7e89)[_0xbae7('0x1e')](function(_0x2667de){_0x37b51e['count']=_0x2667de;if(_0x3f77c7[_0xbae7('0x29')][_0xbae7('0x37')]){_0x4617dd[_0xbae7('0x38')]=[{'all':!![]}];}return db[_0xbae7('0x36')][_0xbae7('0x39')](_0x4617dd);})[_0xbae7('0x1e')](function(_0x29050d){_0x37b51e[_0xbae7('0x3a')]=_0x29050d;return _0x37b51e;})[_0xbae7('0x1e')](respondWithFilteredResult(_0x4471c9,_0x4617dd))['catch'](handleError(_0x4471c9,null));};exports[_0xbae7('0x3b')]=function(_0x208009,_0x5a11b6){var _0x12d270={'raw':!![],'where':{'id':_0x208009[_0xbae7('0x3c')]['id']}},_0x2e04bf={};_0x2e04bf['model']=_[_0xbae7('0x2a')](db[_0xbae7('0x36')]['rawAttributes']);_0x2e04bf['query']=_[_0xbae7('0x2a')](_0x208009[_0xbae7('0x29')]);_0x2e04bf[_0xbae7('0x2b')]=_[_0xbae7('0x2c')](_0x2e04bf['model'],_0x2e04bf[_0xbae7('0x29')]);_0x12d270[_0xbae7('0x2d')]=_['intersection'](_0x2e04bf['model'],qs[_0xbae7('0x2e')](_0x208009[_0xbae7('0x29')][_0xbae7('0x2e')]));_0x12d270[_0xbae7('0x2d')]=_0x12d270['attributes'][_0xbae7('0x3d')]?_0x12d270[_0xbae7('0x2d')]:_0x2e04bf[_0xbae7('0x28')];if(_0x208009[_0xbae7('0x29')]['includeAll']){_0x12d270[_0xbae7('0x38')]=[{'all':!![]}];}_0x12d270=_[_0xbae7('0x33')]({},_0x12d270,_0x208009[_0xbae7('0x3e')]);return db['SmsApplication'][_0xbae7('0x3f')](_0x12d270)[_0xbae7('0x1e')](handleEntityNotFound(_0x5a11b6,null))['then'](respondWithResult(_0x5a11b6,null))[_0xbae7('0x40')](handleError(_0x5a11b6,null));};exports[_0xbae7('0x41')]=function(_0x2bb799,_0x369bca){return db[_0xbae7('0x36')][_0xbae7('0x41')](_0x2bb799[_0xbae7('0x42')],{})[_0xbae7('0x1e')](respondWithResult(_0x369bca,0xc9))['catch'](handleError(_0x369bca,null));};exports['update']=function(_0x54d2fc,_0x542805){if(_0x54d2fc[_0xbae7('0x42')]['id']){delete _0x54d2fc['body']['id'];}return db[_0xbae7('0x36')]['find']({'where':{'id':_0x54d2fc[_0xbae7('0x3c')]['id']}})['then'](handleEntityNotFound(_0x542805,null))['then'](saveUpdates(_0x54d2fc[_0xbae7('0x42')],null))['then'](respondWithResult(_0x542805,null))['catch'](handleError(_0x542805,null));};exports[_0xbae7('0x1f')]=function(_0x464848,_0x5b7c4f){return db[_0xbae7('0x36')][_0xbae7('0x3f')]({'where':{'id':_0x464848[_0xbae7('0x3c')]['id']}})[_0xbae7('0x1e')](handleEntityNotFound(_0x5b7c4f,null))[_0xbae7('0x1e')](removeEntity(_0x5b7c4f,null))[_0xbae7('0x40')](handleError(_0x5b7c4f,null));}; \ No newline at end of file +var _0x0f55=['create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','sendStatus','error','stack','name','index','map','rawAttributes','type','key','query','model','attributes','intersection','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','SmsApplication','includeAll','include','findAll','rows','catch','params','keys','fields','find'];(function(_0x5f471e,_0x5c6594){var _0x61befc=function(_0x544f13){while(--_0x544f13){_0x5f471e['push'](_0x5f471e['shift']());}};_0x61befc(++_0x5c6594);}(_0x0f55,0x94));var _0x50f5=function(_0x5e5568,_0x300d0d){_0x5e5568=_0x5e5568-0x0;var _0x557045=_0x0f55[_0x5e5568];return _0x557045;};'use strict';var emlformat=require(_0x50f5('0x0'));var rimraf=require(_0x50f5('0x1'));var zipdir=require(_0x50f5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x50f5('0x3'));var moment=require(_0x50f5('0x4'));var BPromise=require(_0x50f5('0x5'));var Mustache=require(_0x50f5('0x6'));var util=require(_0x50f5('0x7'));var path=require(_0x50f5('0x8'));var sox=require(_0x50f5('0x9'));var csv=require(_0x50f5('0xa'));var ejs=require(_0x50f5('0xb'));var fs=require('fs');var fs_extra=require(_0x50f5('0xc'));var _=require(_0x50f5('0xd'));var squel=require(_0x50f5('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x50f5('0xf'));var toCsv=require(_0x50f5('0xa'));var querystring=require('querystring');var Papa=require(_0x50f5('0x10'));var Redis=require(_0x50f5('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x50f5('0x12'));var as=require(_0x50f5('0x13'));var hardwareService=require(_0x50f5('0x14'));var logger=require('../../config/logger')(_0x50f5('0x15'));var utils=require('../../config/utils');var config=require(_0x50f5('0x16'));var licenseUtil=require(_0x50f5('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b4f1a,_0x487210){_0x487210=_0x487210||0xcc;return function(_0x546319){if(_0x546319){return _0x2b4f1a['sendStatus'](_0x487210);}return _0x2b4f1a[_0x50f5('0x18')](_0x487210)[_0x50f5('0x19')]();};}function respondWithResult(_0x2e648d,_0x4680f1){_0x4680f1=_0x4680f1||0xc8;return function(_0xad8f54){if(_0xad8f54){return _0x2e648d['status'](_0x4680f1)[_0x50f5('0x1a')](_0xad8f54);}};}function respondWithFilteredResult(_0x101d44,_0xc335df){return function(_0x17a5eb){if(_0x17a5eb){var _0x11e684=typeof _0xc335df[_0x50f5('0x1b')]===_0x50f5('0x1c')&&typeof _0xc335df[_0x50f5('0x1d')]===_0x50f5('0x1c');var _0x500ab3=_0x17a5eb[_0x50f5('0x1e')];var _0x3056bc=_0x11e684?0x0:_0xc335df[_0x50f5('0x1b')];var _0x33497f=_0x11e684?_0x17a5eb[_0x50f5('0x1e')]:_0xc335df[_0x50f5('0x1b')]+_0xc335df['limit'];var _0x507d1d;if(_0x33497f>=_0x500ab3){_0x33497f=_0x500ab3;_0x507d1d=0xc8;}else{_0x507d1d=0xce;}_0x101d44['status'](_0x507d1d);return _0x101d44[_0x50f5('0x1f')](_0x50f5('0x20'),_0x3056bc+'-'+_0x33497f+'/'+_0x500ab3)[_0x50f5('0x1a')](_0x17a5eb);}return null;};}function patchUpdates(_0x338fe0){return function(_0x1ba5d5){try{jsonpatch['apply'](_0x1ba5d5,_0x338fe0,!![]);}catch(_0xe20026){return BPromise[_0x50f5('0x21')](_0xe20026);}return _0x1ba5d5[_0x50f5('0x22')]();};}function saveUpdates(_0x3a0743,_0x1c6d38){return function(_0x2aa09d){if(_0x2aa09d){return _0x2aa09d[_0x50f5('0x23')](_0x3a0743)['then'](function(_0x14983f){return _0x14983f;});}return null;};}function removeEntity(_0x4627b3,_0x117eaf){return function(_0x48eeab){if(_0x48eeab){return _0x48eeab['destroy']()[_0x50f5('0x24')](function(){_0x4627b3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e8a70,_0x5b15c5){return function(_0x29d4f4){if(!_0x29d4f4){_0x5e8a70[_0x50f5('0x25')](0x194);}return _0x29d4f4;};}function handleError(_0x2fd701,_0x53fd4c){_0x53fd4c=_0x53fd4c||0x1f4;return function(_0x3a9528){logger[_0x50f5('0x26')](_0x3a9528[_0x50f5('0x27')]);if(_0x3a9528['name']){delete _0x3a9528[_0x50f5('0x28')];}_0x2fd701[_0x50f5('0x18')](_0x53fd4c)['send'](_0x3a9528);};}exports[_0x50f5('0x29')]=function(_0xf7037e,_0x2a8b31){var _0x1e1d46={},_0x1ae66d={},_0x1fe3dd={'count':0x0,'rows':[]};var _0x235c8e=_[_0x50f5('0x2a')](db['SmsApplication'][_0x50f5('0x2b')],function(_0x511d8e){return{'name':_0x511d8e['fieldName'],'type':_0x511d8e[_0x50f5('0x2c')][_0x50f5('0x2d')]};});_0x1ae66d['model']=_['map'](_0x235c8e,_0x50f5('0x28'));_0x1ae66d[_0x50f5('0x2e')]=_['keys'](_0xf7037e[_0x50f5('0x2e')]);_0x1ae66d['filters']=_['intersection'](_0x1ae66d[_0x50f5('0x2f')],_0x1ae66d[_0x50f5('0x2e')]);_0x1e1d46[_0x50f5('0x30')]=_[_0x50f5('0x31')](_0x1ae66d['model'],qs['fields'](_0xf7037e['query']['fields']));_0x1e1d46['attributes']=_0x1e1d46[_0x50f5('0x30')][_0x50f5('0x32')]?_0x1e1d46[_0x50f5('0x30')]:_0x1ae66d['model'];if(!_0xf7037e[_0x50f5('0x2e')]['hasOwnProperty'](_0x50f5('0x33'))){_0x1e1d46[_0x50f5('0x1d')]=qs[_0x50f5('0x1d')](_0xf7037e[_0x50f5('0x2e')][_0x50f5('0x1d')]);_0x1e1d46[_0x50f5('0x1b')]=qs['offset'](_0xf7037e[_0x50f5('0x2e')][_0x50f5('0x1b')]);}_0x1e1d46[_0x50f5('0x34')]=qs[_0x50f5('0x35')](_0xf7037e[_0x50f5('0x2e')][_0x50f5('0x35')]);_0x1e1d46[_0x50f5('0x36')]=qs[_0x50f5('0x37')](_[_0x50f5('0x38')](_0xf7037e[_0x50f5('0x2e')],_0x1ae66d[_0x50f5('0x37')]),_0x235c8e);if(_0xf7037e[_0x50f5('0x2e')][_0x50f5('0x39')]){_0x1e1d46[_0x50f5('0x36')]=_[_0x50f5('0x3a')](_0x1e1d46[_0x50f5('0x36')],{'$or':_[_0x50f5('0x2a')](_0x235c8e,function(_0x50f16c){if(_0x50f16c[_0x50f5('0x2c')]!==_0x50f5('0x3b')){var _0x5387d6={};_0x5387d6[_0x50f16c[_0x50f5('0x28')]]={'$like':'%'+_0xf7037e['query'][_0x50f5('0x39')]+'%'};return _0x5387d6;}})});}_0x1e1d46=_[_0x50f5('0x3a')]({},_0x1e1d46,_0xf7037e[_0x50f5('0x3c')]);var _0x24c92d={'where':_0x1e1d46[_0x50f5('0x36')]};return db[_0x50f5('0x3d')]['count'](_0x24c92d)['then'](function(_0x8f7450){_0x1fe3dd[_0x50f5('0x1e')]=_0x8f7450;if(_0xf7037e['query'][_0x50f5('0x3e')]){_0x1e1d46[_0x50f5('0x3f')]=[{'all':!![]}];}return db[_0x50f5('0x3d')][_0x50f5('0x40')](_0x1e1d46);})[_0x50f5('0x24')](function(_0x21f6e3){_0x1fe3dd[_0x50f5('0x41')]=_0x21f6e3;return _0x1fe3dd;})[_0x50f5('0x24')](respondWithFilteredResult(_0x2a8b31,_0x1e1d46))[_0x50f5('0x42')](handleError(_0x2a8b31,null));};exports['show']=function(_0x5d5a61,_0x296a8c){var _0x15385f={'raw':!![],'where':{'id':_0x5d5a61[_0x50f5('0x43')]['id']}},_0x2168f2={};_0x2168f2[_0x50f5('0x2f')]=_[_0x50f5('0x44')](db[_0x50f5('0x3d')][_0x50f5('0x2b')]);_0x2168f2[_0x50f5('0x2e')]=_['keys'](_0x5d5a61[_0x50f5('0x2e')]);_0x2168f2['filters']=_[_0x50f5('0x31')](_0x2168f2[_0x50f5('0x2f')],_0x2168f2['query']);_0x15385f[_0x50f5('0x30')]=_[_0x50f5('0x31')](_0x2168f2[_0x50f5('0x2f')],qs[_0x50f5('0x45')](_0x5d5a61[_0x50f5('0x2e')][_0x50f5('0x45')]));_0x15385f[_0x50f5('0x30')]=_0x15385f['attributes'][_0x50f5('0x32')]?_0x15385f[_0x50f5('0x30')]:_0x2168f2[_0x50f5('0x2f')];if(_0x5d5a61['query'][_0x50f5('0x3e')]){_0x15385f[_0x50f5('0x3f')]=[{'all':!![]}];}_0x15385f=_[_0x50f5('0x3a')]({},_0x15385f,_0x5d5a61['options']);return db[_0x50f5('0x3d')][_0x50f5('0x46')](_0x15385f)[_0x50f5('0x24')](handleEntityNotFound(_0x296a8c,null))[_0x50f5('0x24')](respondWithResult(_0x296a8c,null))[_0x50f5('0x42')](handleError(_0x296a8c,null));};exports[_0x50f5('0x47')]=function(_0x2793c0,_0x50e489){return db['SmsApplication'][_0x50f5('0x47')](_0x2793c0['body'],{})['then'](respondWithResult(_0x50e489,0xc9))[_0x50f5('0x42')](handleError(_0x50e489,null));};exports[_0x50f5('0x23')]=function(_0x4b912d,_0x58de7b){if(_0x4b912d[_0x50f5('0x48')]['id']){delete _0x4b912d[_0x50f5('0x48')]['id'];}return db[_0x50f5('0x3d')][_0x50f5('0x46')]({'where':{'id':_0x4b912d[_0x50f5('0x43')]['id']}})['then'](handleEntityNotFound(_0x58de7b,null))[_0x50f5('0x24')](saveUpdates(_0x4b912d[_0x50f5('0x48')],null))['then'](respondWithResult(_0x58de7b,null))[_0x50f5('0x42')](handleError(_0x58de7b,null));};exports['destroy']=function(_0x53ca72,_0x45117f){return db[_0x50f5('0x3d')][_0x50f5('0x46')]({'where':{'id':_0x53ca72[_0x50f5('0x43')]['id']}})['then'](handleEntityNotFound(_0x45117f,null))['then'](removeEntity(_0x45117f,null))[_0x50f5('0x42')](handleError(_0x45117f,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 7e2babc..88dbdaa 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 _0x52fa=['../../config/logger','bluebird','request-promise','../../config/environment','./smsApplication.attributes','define','SmsApplication','sms_applications','utf8mb4','lodash','util'];(function(_0x51f7c0,_0x2a542d){var _0x1fe075=function(_0x69f5bf){while(--_0x69f5bf){_0x51f7c0['push'](_0x51f7c0['shift']());}};_0x1fe075(++_0x2a542d);}(_0x52fa,0x82));var _0xa52f=function(_0x3c7697,_0x414b70){_0x3c7697=_0x3c7697-0x0;var _0x4fd6c0=_0x52fa[_0x3c7697];return _0x4fd6c0;};'use strict';var _=require(_0xa52f('0x0'));var util=require(_0xa52f('0x1'));var logger=require(_0xa52f('0x2'))('api');var moment=require('moment');var BPromise=require(_0xa52f('0x3'));var rp=require(_0xa52f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa52f('0x5'));var attributes=require(_0xa52f('0x6'));module['exports']=function(_0x4aed0a,_0x16aa5a){return _0x4aed0a[_0xa52f('0x7')](_0xa52f('0x8'),attributes,{'tableName':_0xa52f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa52f('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x5249=['rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x537c82,_0x9805af){var _0xf18067=function(_0x3538d1){while(--_0x3538d1){_0x537c82['push'](_0x537c82['shift']());}};_0xf18067(++_0x9805af);}(_0x5249,0x8f));var _0x9524=function(_0x5a1552,_0x5478df){_0x5a1552=_0x5a1552-0x0;var _0x88e370=_0x5249[_0x5a1552];return _0x88e370;};'use strict';var _=require(_0x9524('0x0'));var util=require(_0x9524('0x1'));var logger=require(_0x9524('0x2'))(_0x9524('0x3'));var moment=require('moment');var BPromise=require(_0x9524('0x4'));var rp=require(_0x9524('0x5'));var fs=require('fs');var path=require(_0x9524('0x6'));var rimraf=require(_0x9524('0x7'));var config=require(_0x9524('0x8'));var attributes=require(_0x9524('0x9'));module[_0x9524('0xa')]=function(_0xe8e81b,_0x5d3710){return _0xe8e81b[_0x9524('0xb')](_0x9524('0xc'),attributes,{'tableName':_0x9524('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x9524('0xe')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 09860e1..6276e43 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 _0x352e=['client','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x5d72da,_0xb7ce32){var _0x43ebe7=function(_0x503755){while(--_0x503755){_0x5d72da['push'](_0x5d72da['shift']());}};_0x43ebe7(++_0xb7ce32);}(_0x352e,0x1a6));var _0xe352=function(_0x224deb,_0x1b1f44){_0x224deb=_0x224deb-0x0;var _0x4058fa=_0x352e[_0x224deb];return _0x4058fa;};'use strict';var _=require(_0xe352('0x0'));var util=require(_0xe352('0x1'));var moment=require(_0xe352('0x2'));var BPromise=require(_0xe352('0x3'));var rs=require(_0xe352('0x4'));var fs=require('fs');var Redis=require(_0xe352('0x5'));var db=require(_0xe352('0x6'))['db'];var utils=require(_0xe352('0x7'));var logger=require('../../config/logger')(_0xe352('0x8'));var config=require(_0xe352('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xe352('0xa')][_0xe352('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x32d7c6,_0x6549bb,_0x5b9266){return new BPromise(function(_0x2bd5e5,_0x3cfd5b){return client[_0xe352('0xc')](_0x32d7c6,_0x5b9266)[_0xe352('0xd')](function(_0x5b1b22){logger[_0xe352('0xe')](_0xe352('0xf'),_0x6549bb,_0xe352('0x10'));logger[_0xe352('0x11')](_0xe352('0x12'),_0x6549bb,_0xe352('0x10'),JSON['stringify'](_0x5b1b22));if(_0x5b1b22['error']){if(_0x5b1b22[_0xe352('0x13')][_0xe352('0x14')]===0x1f4){logger[_0xe352('0x13')](_0xe352('0xf'),_0x6549bb,_0x5b1b22[_0xe352('0x13')][_0xe352('0x15')]);return _0x3cfd5b(_0x5b1b22['error'][_0xe352('0x15')]);}logger[_0xe352('0x13')]('SmsApplication,\x20%s,\x20%s',_0x6549bb,_0x5b1b22[_0xe352('0x13')][_0xe352('0x15')]);return _0x2bd5e5(_0x5b1b22['error'][_0xe352('0x15')]);}else{logger[_0xe352('0xe')](_0xe352('0xf'),_0x6549bb,_0xe352('0x10'));_0x2bd5e5(_0x5b1b22[_0xe352('0x16')][_0xe352('0x15')]);}})[_0xe352('0x17')](function(_0x1fede5){logger['error'](_0xe352('0xf'),_0x6549bb,_0x1fede5);_0x3cfd5b(_0x1fede5);});});} \ No newline at end of file +var _0x32b6=['SmsApplication,\x20%s,\x20%s','message','info','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','request\x20sent','stringify','error','code'];(function(_0x371b05,_0x1d5dcb){var _0x170f16=function(_0x3d7a14){while(--_0x3d7a14){_0x371b05['push'](_0x371b05['shift']());}};_0x170f16(++_0x1d5dcb);}(_0x32b6,0x1d1));var _0x632b=function(_0x2915dc,_0x417277){_0x2915dc=_0x2915dc-0x0;var _0x382ed3=_0x32b6[_0x2915dc];return _0x382ed3;};'use strict';var _=require(_0x632b('0x0'));var util=require(_0x632b('0x1'));var moment=require('moment');var BPromise=require(_0x632b('0x2'));var rs=require(_0x632b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x632b('0x4'));var logger=require(_0x632b('0x5'))(_0x632b('0x6'));var config=require(_0x632b('0x7'));var jayson=require(_0x632b('0x8'));var client=jayson[_0x632b('0x9')][_0x632b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10458a,_0x3bbf43,_0x43d6c7){return new BPromise(function(_0x5128f5,_0x33d711){return client[_0x632b('0xb')](_0x10458a,_0x43d6c7)[_0x632b('0xc')](function(_0x174201){logger['info']('SmsApplication,\x20%s,\x20%s',_0x3bbf43,'request\x20sent');logger[_0x632b('0xd')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x3bbf43,_0x632b('0xe'),JSON[_0x632b('0xf')](_0x174201));if(_0x174201[_0x632b('0x10')]){if(_0x174201[_0x632b('0x10')][_0x632b('0x11')]===0x1f4){logger[_0x632b('0x10')](_0x632b('0x12'),_0x3bbf43,_0x174201[_0x632b('0x10')][_0x632b('0x13')]);return _0x33d711(_0x174201['error'][_0x632b('0x13')]);}logger[_0x632b('0x10')](_0x632b('0x12'),_0x3bbf43,_0x174201['error'][_0x632b('0x13')]);return _0x5128f5(_0x174201[_0x632b('0x10')][_0x632b('0x13')]);}else{logger[_0x632b('0x14')](_0x632b('0x12'),_0x3bbf43,_0x632b('0xe'));_0x5128f5(_0x174201['result'][_0x632b('0x13')]);}})['catch'](function(_0x4fdef2){logger[_0x632b('0x10')]('SmsApplication,\x20%s,\x20%s',_0x3bbf43,_0x4fdef2);_0x33d711(_0x4fdef2);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index c121ebc..8b5f7b3 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 _0xe511=['addTags','put','update','smsinteraction:destroy','destroy','delete','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','index','describe','show','/:id/messages','isAuthenticated','getMessages','download','post','create','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0xe511,0x16f));var _0x1e51=function(_0x59ff01,_0x295452){_0x59ff01=_0x59ff01-0x0;var _0x16cf73=_0xe511[_0x59ff01];return _0x16cf73;};'use strict';var multer=require(_0x1e51('0x0'));var util=require(_0x1e51('0x1'));var path=require('path');var timeout=require(_0x1e51('0x2'));var express=require('express');var router=express[_0x1e51('0x3')]();var fs_extra=require(_0x1e51('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1e51('0x5'));var config=require(_0x1e51('0x6'));var controller=require(_0x1e51('0x7'));router[_0x1e51('0x8')]('/',auth['isAuthenticated'](),controller[_0x1e51('0x9')]);router[_0x1e51('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x1e51('0xa')]);router[_0x1e51('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x1e51('0xb')]);router[_0x1e51('0x8')](_0x1e51('0xc'),auth[_0x1e51('0xd')](),controller[_0x1e51('0xe')]);router[_0x1e51('0x8')]('/:id/download',auth[_0x1e51('0xd')](),controller[_0x1e51('0xf')]);router[_0x1e51('0x10')]('/',auth[_0x1e51('0xd')](),controller[_0x1e51('0x11')]);router[_0x1e51('0x10')]('/:id/messages',auth[_0x1e51('0xd')](),controller[_0x1e51('0x12')]);router[_0x1e51('0x10')](_0x1e51('0x13'),auth[_0x1e51('0xd')](),interaction[_0x1e51('0x14')](_0x1e51('0x15'),_0x1e51('0x16')),controller[_0x1e51('0x17')]);router[_0x1e51('0x18')]('/:id',auth[_0x1e51('0xd')](),interaction[_0x1e51('0x14')](_0x1e51('0x15'),'smsinteraction:update'),controller[_0x1e51('0x19')]);router['delete']('/:id',auth[_0x1e51('0xd')](),interaction[_0x1e51('0x14')](_0x1e51('0x15'),_0x1e51('0x1a')),controller[_0x1e51('0x1b')]);router[_0x1e51('0x1c')]('/:id/tags',auth[_0x1e51('0xd')](),controller['removeTags']);module[_0x1e51('0x1d')]=router; \ No newline at end of file +var _0x2547=['/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','removeTags','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x16b35d,_0x4da596){var _0x55775b=function(_0x235dc0){while(--_0x235dc0){_0x16b35d['push'](_0x16b35d['shift']());}};_0x55775b(++_0x4da596);}(_0x2547,0x1cd));var _0x7254=function(_0x5a58a5,_0x6f5716){_0x5a58a5=_0x5a58a5-0x0;var _0x27e4c6=_0x2547[_0x5a58a5];return _0x27e4c6;};'use strict';var multer=require('multer');var util=require(_0x7254('0x0'));var path=require(_0x7254('0x1'));var timeout=require(_0x7254('0x2'));var express=require(_0x7254('0x3'));var router=express[_0x7254('0x4')]();var fs_extra=require(_0x7254('0x5'));var auth=require(_0x7254('0x6'));var interaction=require(_0x7254('0x7'));var config=require('../../config/environment');var controller=require(_0x7254('0x8'));router[_0x7254('0x9')]('/',auth[_0x7254('0xa')](),controller[_0x7254('0xb')]);router['get'](_0x7254('0xc'),auth[_0x7254('0xa')](),controller[_0x7254('0xd')]);router['get'](_0x7254('0xe'),auth['isAuthenticated'](),controller['show']);router['get'](_0x7254('0xf'),auth[_0x7254('0xa')](),controller[_0x7254('0x10')]);router[_0x7254('0x9')](_0x7254('0x11'),auth[_0x7254('0xa')](),controller['download']);router[_0x7254('0x12')]('/',auth['isAuthenticated'](),controller[_0x7254('0x13')]);router['post'](_0x7254('0xf'),auth[_0x7254('0xa')](),controller[_0x7254('0x14')]);router[_0x7254('0x12')](_0x7254('0x15'),auth[_0x7254('0xa')](),interaction[_0x7254('0x16')](_0x7254('0x17'),_0x7254('0x18')),controller[_0x7254('0x19')]);router[_0x7254('0x1a')](_0x7254('0xe'),auth[_0x7254('0xa')](),interaction['tracked'](_0x7254('0x17'),_0x7254('0x1b')),controller[_0x7254('0x1c')]);router[_0x7254('0x1d')](_0x7254('0xe'),auth[_0x7254('0xa')](),interaction[_0x7254('0x16')]('sms',_0x7254('0x1e')),controller[_0x7254('0x1f')]);router[_0x7254('0x1d')](_0x7254('0x15'),auth[_0x7254('0xa')](),controller[_0x7254('0x20')]);module[_0x7254('0x21')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 8fc34d1..e9f6552 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 _0x23ea=['STRING','out','ENUM','sequelize','moment','exports','BOOLEAN','DATE'];(function(_0x40fa00,_0x1fbb3f){var _0x2f2426=function(_0x18e6ee){while(--_0x18e6ee){_0x40fa00['push'](_0x40fa00['shift']());}};_0x2f2426(++_0x1fbb3f);}(_0x23ea,0xc3));var _0xa23e=function(_0x3cf4d3,_0x48065e){_0x3cf4d3=_0x3cf4d3-0x0;var _0x4e547b=_0x23ea[_0x3cf4d3];return _0x4e547b;};'use strict';var Sequelize=require(_0xa23e('0x0'));var moment=require(_0xa23e('0x1'));module[_0xa23e('0x2')]={'closed':{'type':Sequelize[_0xa23e('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa23e('0x4')]},'disposition':{'type':Sequelize[_0xa23e('0x5')]},'secondDisposition':{'type':Sequelize[_0xa23e('0x5')]},'thirdDisposition':{'type':Sequelize[_0xa23e('0x5')]},'note':{'type':Sequelize[_0xa23e('0x5')]},'phone':{'type':Sequelize[_0xa23e('0x5')]},'read1stAt':{'type':Sequelize[_0xa23e('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xa23e('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa23e('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xa23e('0x7')]('in',_0xa23e('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xa23e('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x291c=['DATE','STRING','out','sequelize','moment','exports','BOOLEAN'];(function(_0x5a082f,_0x168ca3){var _0x4e6c08=function(_0x4f4bf4){while(--_0x4f4bf4){_0x5a082f['push'](_0x5a082f['shift']());}};_0x4e6c08(++_0x168ca3);}(_0x291c,0x137));var _0xc291=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x291c[_0x4e676e];return _0x336a3c;};'use strict';var Sequelize=require(_0xc291('0x0'));var moment=require(_0xc291('0x1'));module[_0xc291('0x2')]={'closed':{'type':Sequelize[_0xc291('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc291('0x4')]},'disposition':{'type':Sequelize[_0xc291('0x5')]},'secondDisposition':{'type':Sequelize[_0xc291('0x5')]},'thirdDisposition':{'type':Sequelize[_0xc291('0x5')]},'note':{'type':Sequelize[_0xc291('0x5')]},'phone':{'type':Sequelize[_0xc291('0x5')]},'read1stAt':{'type':Sequelize[_0xc291('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xc291('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xc291('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xc291('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 91ce6d7..1d6bbd6 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 _0xc0e9=['rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsInteraction.socket','sendStatus','end','status','json','undefined','count','offset','limit','set','reject','update','destroy','then','error','name','send','Users','fullname','TagIds','Tags','push','catch','index','SmsInteraction','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','select','field','color','tools_tags','u.fullname','ui.SmsInteractionId','from','left_join','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','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?','UserId','text','body','keys','some','compact','SmsAccountId','i.SmsAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','forEach','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getSmsAccounts','isEmpty','i.SmsAccountId\x20IS\x20NULL','toString','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','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','sequelize','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','show','params','include','merge','create','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','split','format','YYYY-MM-DD\x20HH:mm:ss','options','findAll','rows','setTags','spread','emit','smsInteractionTags:save','removeTags','download','unix','root','server','files','join','attachments','CmContact','lastName','Messages','direction','SmsAccount','mkdirSync','Sms','Account','Owner','N.A.','closed','closedAt','out','firstName','secret','renderFile','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','err','unlinkSync','eml-format'];(function(_0x5945c5,_0x2c5371){var _0x49364b=function(_0x54442a){while(--_0x54442a){_0x5945c5['push'](_0x5945c5['shift']());}};_0x49364b(++_0x2c5371);}(_0xc0e9,0xe5));var _0x9c0e=function(_0x4a2432,_0x13d42b){_0x4a2432=_0x4a2432-0x0;var _0x23a89a=_0xc0e9[_0x4a2432];return _0x23a89a;};'use strict';var emlformat=require(_0x9c0e('0x0'));var rimraf=require(_0x9c0e('0x1'));var zipdir=require(_0x9c0e('0x2'));var jsonpatch=require(_0x9c0e('0x3'));var rp=require(_0x9c0e('0x4'));var moment=require(_0x9c0e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9c0e('0x6'));var util=require(_0x9c0e('0x7'));var path=require(_0x9c0e('0x8'));var sox=require(_0x9c0e('0x9'));var csv=require(_0x9c0e('0xa'));var ejs=require(_0x9c0e('0xb'));var fs=require('fs');var fs_extra=require(_0x9c0e('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9c0e('0xd'));var Redis=require(_0x9c0e('0xe'));var authService=require(_0x9c0e('0xf'));var qs=require(_0x9c0e('0x10'));var as=require(_0x9c0e('0x11'));var pdf=require(_0x9c0e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9c0e('0x13'));var utils=require(_0x9c0e('0x14'));var config=require(_0x9c0e('0x15'));var licenseUtil=require(_0x9c0e('0x16'));var db=require(_0x9c0e('0x17'))['db'];config[_0x9c0e('0x18')]=_[_0x9c0e('0x19')](config[_0x9c0e('0x18')],{'host':_0x9c0e('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9c0e('0x18')]));require(_0x9c0e('0x1b'))['register'](socket);function respondWithStatusCode(_0x12fe2c,_0x5d69a3){_0x5d69a3=_0x5d69a3||0xcc;return function(_0x12779b){if(_0x12779b){return _0x12fe2c[_0x9c0e('0x1c')](_0x5d69a3);}return _0x12fe2c['status'](_0x5d69a3)[_0x9c0e('0x1d')]();};}function respondWithResult(_0x58c76c,_0x288f2f){_0x288f2f=_0x288f2f||0xc8;return function(_0x2aab1b){if(_0x2aab1b){return _0x58c76c[_0x9c0e('0x1e')](_0x288f2f)[_0x9c0e('0x1f')](_0x2aab1b);}};}function respondWithFilteredResult(_0x183a00,_0x5ccc66){return function(_0x212ca8){if(_0x212ca8){var _0x1914e8=typeof _0x5ccc66['offset']===_0x9c0e('0x20')&&typeof _0x5ccc66['limit']==='undefined';var _0x506e7e=_0x212ca8[_0x9c0e('0x21')];var _0x5b75a5=_0x1914e8?0x0:_0x5ccc66[_0x9c0e('0x22')];var _0x416950=_0x1914e8?_0x212ca8[_0x9c0e('0x21')]:_0x5ccc66[_0x9c0e('0x22')]+_0x5ccc66[_0x9c0e('0x23')];var _0x672e89;if(_0x416950>=_0x506e7e){_0x416950=_0x506e7e;_0x672e89=0xc8;}else{_0x672e89=0xce;}_0x183a00['status'](_0x672e89);return _0x183a00[_0x9c0e('0x24')]('Content-Range',_0x5b75a5+'-'+_0x416950+'/'+_0x506e7e)[_0x9c0e('0x1f')](_0x212ca8);}return null;};}function patchUpdates(_0xde2e03){return function(_0x3e6de6){try{jsonpatch['apply'](_0x3e6de6,_0xde2e03,!![]);}catch(_0x54b14b){return BPromise[_0x9c0e('0x25')](_0x54b14b);}return _0x3e6de6['save']();};}function saveUpdates(_0x4c732f,_0x4a35c4){return function(_0x5e1c09){if(_0x5e1c09){return _0x5e1c09[_0x9c0e('0x26')](_0x4c732f)['then'](function(_0x4b62b5){return _0x4b62b5;});}return null;};}function removeEntity(_0x598afa,_0x2c79b5){return function(_0x25ac5f){if(_0x25ac5f){return _0x25ac5f[_0x9c0e('0x27')]()[_0x9c0e('0x28')](function(){_0x598afa[_0x9c0e('0x1e')](0xcc)[_0x9c0e('0x1d')]();});}};}function handleEntityNotFound(_0x38ecf7,_0x300a9d){return function(_0xac1d71){if(!_0xac1d71){_0x38ecf7['sendStatus'](0x194);}return _0xac1d71;};}function handleError(_0x266109,_0x5af60e){_0x5af60e=_0x5af60e||0x1f4;return function(_0x1e6dde){logger[_0x9c0e('0x29')](_0x1e6dde['stack']);if(_0x1e6dde[_0x9c0e('0x2a')]){delete _0x1e6dde[_0x9c0e('0x2a')];}_0x266109[_0x9c0e('0x1e')](_0x5af60e)[_0x9c0e('0x2b')](_0x1e6dde);};}function getInteractionUsers(_0x11e069,_0x5d0cbc){return new BPromise(function(_0xa675dc,_0x30a4be){try{if(_0x5d0cbc[_0x11e069['id']]){_0x11e069[_0x9c0e('0x2c')]=_['map'](_0x5d0cbc[_0x11e069['id']],function(_0x3829f1){return{'id':_0x3829f1['id'],'fullname':_0x3829f1[_0x9c0e('0x2d')]};});}}catch(_0x3174cb){_0x30a4be(_0x3174cb);}_0xa675dc(_0x11e069);});}function getInteractionTags(_0x1d40e6,_0x3f1206){return new BPromise(function(_0x23d3ea,_0x4da986){try{if(_0x1d40e6[_0x9c0e('0x2e')]){_0x1d40e6[_0x9c0e('0x2f')]=[];_0x1d40e6['TagIds']['split'](',')['forEach'](function(_0x5b5601){_0x1d40e6[_0x9c0e('0x2f')][_0x9c0e('0x30')](_0x3f1206[_0x5b5601]);});}delete _0x1d40e6[_0x9c0e('0x2e')];}catch(_0x501320){_0x4da986(_0x501320);}_0x23d3ea(_0x1d40e6);});}function updateSmsInteraction(_0x5e53fa,_0x2cda79,_0xcbe02f){return new BPromise(function(_0x865afb,_0x5bd939){return getInteractionUsers(_0x5e53fa,_0xcbe02f)['then'](function(_0x5cf2b4){return getInteractionTags(_0x5cf2b4,_0x2cda79);})['then'](function(_0x2d20b3){_0x865afb(_0x2d20b3);})[_0x9c0e('0x31')](function(_0x533dc8){_0x5bd939(_0x533dc8);});});}exports[_0x9c0e('0x32')]=function(_0x59be93,_0x5e936f){var _0x57817c={},_0x35e392={},_0xc8f233={'count':0x0,'rows':[]};var _0x10e020=_['map'](db[_0x9c0e('0x33')][_0x9c0e('0x34')],function(_0x8f3d90){return{'name':_0x8f3d90[_0x9c0e('0x35')],'type':_0x8f3d90[_0x9c0e('0x36')]['key']};});_0x35e392[_0x9c0e('0x37')]=_[_0x9c0e('0x38')](_0x10e020,'name');_0x35e392[_0x9c0e('0x39')]=_['keys'](_0x59be93[_0x9c0e('0x39')]);_0x35e392[_0x9c0e('0x3a')]=_[_0x9c0e('0x3b')](_0x35e392['model'],_0x35e392[_0x9c0e('0x39')]);_0x57817c[_0x9c0e('0x3c')]=_[_0x9c0e('0x3b')](_0x35e392[_0x9c0e('0x37')],qs['fields'](_0x59be93[_0x9c0e('0x39')][_0x9c0e('0x3d')]));_0x57817c['attributes']=_0x57817c[_0x9c0e('0x3c')][_0x9c0e('0x3e')]?_0x57817c[_0x9c0e('0x3c')]:_0x35e392['model'];if(!_0x59be93[_0x9c0e('0x39')][_0x9c0e('0x3f')](_0x9c0e('0x40'))){_0x57817c['limit']=qs['limit'](_0x59be93[_0x9c0e('0x39')][_0x9c0e('0x23')]);_0x57817c['offset']=qs[_0x9c0e('0x22')](_0x59be93[_0x9c0e('0x39')][_0x9c0e('0x22')]);}_0x57817c[_0x9c0e('0x41')]=qs[_0x9c0e('0x42')](_0x59be93[_0x9c0e('0x39')][_0x9c0e('0x42')]);_0x57817c[_0x9c0e('0x43')]=qs[_0x9c0e('0x3a')](_['pick'](_0x59be93[_0x9c0e('0x39')],_0x35e392[_0x9c0e('0x3a')]),_0x10e020);var _0x3b8f65=[];var _0x22670a=squel[_0x9c0e('0x44')]()[_0x9c0e('0x45')]('id')[_0x9c0e('0x45')]('name')['field'](_0x9c0e('0x46'))['from'](_0x9c0e('0x47'));var _0x4ed77c=squel[_0x9c0e('0x44')]()[_0x9c0e('0x45')]('u.id')[_0x9c0e('0x45')](_0x9c0e('0x48'))[_0x9c0e('0x45')](_0x9c0e('0x49'))[_0x9c0e('0x4a')]('user_has_sms_interactions','ui')[_0x9c0e('0x4b')]('users','u',_0x9c0e('0x4c'));var _0x4afe27=squel[_0x9c0e('0x44')]()['from']('sms_interactions','i')[_0x9c0e('0x4b')](_0x9c0e('0x4d'),'c',_0x9c0e('0x4e'))[_0x9c0e('0x4b')]('users','o',_0x9c0e('0x4f'))[_0x9c0e('0x4b')](_0x9c0e('0x50'),'a','a.id\x20=\x20i.SmsAccountId')[_0x9c0e('0x4b')]('sms_messages','me',_0x9c0e('0x51'))[_0x9c0e('0x4b')](_0x9c0e('0x52'),'it',_0x9c0e('0x53'))[_0x9c0e('0x4b')]('tools_tags','t',_0x9c0e('0x54'));var _0x3ed8f6=squel[_0x9c0e('0x55')]();var _0x42e6b5=[];var _0x622eed=squel['expr']();var _0x830be5;if(_0x59be93[_0x9c0e('0x39')][_0x9c0e('0x56')]){_0x830be5=as[_0x9c0e('0x57')](_0x59be93[_0x9c0e('0x39')][_0x9c0e('0x56')]);var _0x5ecae2=_0x830be5['sqlOperator'];for(var _0x5776b3=0x0;_0x5776b3<_0x830be5[_0x9c0e('0x58')][_0x9c0e('0x3e')];_0x5776b3++){var _0x30ec03=_0x830be5[_0x9c0e('0x58')][_0x5776b3];var _0x287d6a='i';var _0x26b8d7=_['find'](_0x10e020,[_0x9c0e('0x2a'),_0x30ec03['field']]);if(!_0x26b8d7){switch(_0x30ec03['field']){case _0x9c0e('0x59'):if(_0x30ec03[_0x9c0e('0x5a')]==0x1){_0x4afe27[_0x9c0e('0x5b')]('`'+_0x30ec03[_0x9c0e('0x45')]+_0x9c0e('0x5c'));}else{_0x4afe27['having']('`'+_0x30ec03['field']+_0x9c0e('0x5d'));}break;case _0x9c0e('0x5e'):if(_0x30ec03[_0x9c0e('0x5f')]===_0x9c0e('0x60')){if(_0x30ec03[_0x9c0e('0x5a')]['split']('\x20')[_0x9c0e('0x3e')]>0x1){_0x3ed8f6[_0x5ecae2](_0x9c0e('0x61'),qs[_0x9c0e('0x62')](_0x30ec03[_0x9c0e('0x5a')]),null);}else{var _0x25ad5e='%'+_0x30ec03[_0x9c0e('0x5a')]+'%';_0x3ed8f6[_0x5ecae2](_0x9c0e('0x63'),_0x25ad5e,_0x25ad5e,_0x25ad5e);}}else{_0x26b8d7=_[_0x9c0e('0x64')](_0x10e020,[_0x9c0e('0x2a'),_0x9c0e('0x65')]);_0x30ec03[_0x9c0e('0x45')]='ContactId';_0x1b8575=as[_0x9c0e('0x66')](_0x287d6a,_0x26b8d7[_0x9c0e('0x36')],_0x30ec03);_0x3ed8f6[_0x5ecae2](_0x1b8575['text'],_0x1b8575[_0x9c0e('0x5a')][_0x9c0e('0x67')],_0x1b8575[_0x9c0e('0x5a')][_0x9c0e('0x1d')]);}break;case _0x9c0e('0x68'):var _0x42fdfb=_0x30ec03[_0x9c0e('0x5a')]['split'](',')['map'](function(_0x46771c){return Number(_0x46771c);});_0x42fdfb['forEach'](function(_0x474475){_0x622eed['or'](_0x9c0e('0x69'),'%,'+_0x474475+',%');});_0x42e6b5=_[_0x9c0e('0x6a')](_0x42e6b5,_0x42fdfb);break;case _0x9c0e('0x6b'):if(_0x30ec03[_0x9c0e('0x5f')]===_0x9c0e('0x60')){_0x3ed8f6[_0x5ecae2](_0x9c0e('0x6c'),'%'+_0x30ec03[_0x9c0e('0x5a')]+'%',null);}else{_0x26b8d7=_[_0x9c0e('0x64')](_0x10e020,[_0x9c0e('0x2a'),_0x9c0e('0x6d')]);_0x30ec03['field']='UserId';_0x1b8575=as[_0x9c0e('0x66')](_0x287d6a,_0x26b8d7[_0x9c0e('0x36')],_0x30ec03);_0x3ed8f6[_0x5ecae2](_0x1b8575[_0x9c0e('0x6e')],_0x1b8575[_0x9c0e('0x5a')][_0x9c0e('0x67')],_0x1b8575[_0x9c0e('0x5a')][_0x9c0e('0x1d')]);}break;case _0x9c0e('0x6f'):_0x1b8575=as[_0x9c0e('0x66')]('me',null,_0x30ec03);_0x3ed8f6[_0x5ecae2](_0x1b8575[_0x9c0e('0x6e')],_0x1b8575['value'][_0x9c0e('0x67')],_0x1b8575[_0x9c0e('0x5a')][_0x9c0e('0x1d')]);break;}}else{var _0x1b8575=as[_0x9c0e('0x66')](_0x287d6a,_0x26b8d7[_0x9c0e('0x36')],_0x30ec03);_0x3ed8f6[_0x5ecae2](_0x1b8575['text'],_0x1b8575['value'][_0x9c0e('0x67')],_0x1b8575[_0x9c0e('0x5a')]['end']);}}}else{var _0x44aec8=_(_0x59be93['query'])[_0x9c0e('0x70')]()[_0x9c0e('0x38')](function(_0x162a47){return _[_0x9c0e('0x71')](_0x10e020,[_0x9c0e('0x2a'),_0x162a47])?_0x162a47:undefined;})[_0x9c0e('0x72')]()['value']();if(!_['isEmpty'](_0x44aec8)){_0x44aec8['forEach'](function(_0xa0561b){if(_0xa0561b===_0x9c0e('0x73')){_0x4afe27[_0x9c0e('0x43')](_0x9c0e('0x74'),[]['concat'](_0x59be93[_0x9c0e('0x39')][_0xa0561b]));}else if(_0xa0561b===_0x9c0e('0x75')){var _0x4a3ecf=JSON[_0x9c0e('0x76')](_0x59be93[_0x9c0e('0x39')][_0xa0561b])[_0x9c0e('0x77')];var _0xff28b1=JSON[_0x9c0e('0x76')](_0x59be93[_0x9c0e('0x39')][_0xa0561b])[_0x9c0e('0x78')];_0x4afe27[_0x9c0e('0x43')](_0x9c0e('0x79'),_0x4a3ecf,_0xff28b1);}else{if(_0x59be93['query'][_0xa0561b]===_0x9c0e('0x7a')){_0x4afe27['where']('i.'+_0xa0561b+'\x20IS\x20NULL');}else{_0x4afe27[_0x9c0e('0x43')]('i.'+_0xa0561b+_0x9c0e('0x7b'),_0x59be93[_0x9c0e('0x39')][_0xa0561b]);}}});}if(_0x59be93[_0x9c0e('0x39')][_0x9c0e('0x7c')]){if(_0x59be93[_0x9c0e('0x39')][_0x9c0e('0x7c')]==0x1){_0x4afe27[_0x9c0e('0x5b')]('`unreadMessages`\x20=\x200');}else{_0x4afe27[_0x9c0e('0x5b')](_0x9c0e('0x7d'));}}if(_0x59be93[_0x9c0e('0x39')][_0x9c0e('0x7e')]){_0x42e6b5=_[_0x9c0e('0x7f')](_0x59be93[_0x9c0e('0x39')][_0x9c0e('0x7e')])?_0x59be93[_0x9c0e('0x39')]['tag']:new Array(_0x59be93[_0x9c0e('0x39')][_0x9c0e('0x7e')]);_0x42e6b5[_0x9c0e('0x80')](function(_0x28a151){_0x622eed['or'](_0x9c0e('0x69'),'%,'+_0x28a151+',%');});}if(_0x59be93['query'][_0x9c0e('0x81')]){var _0x20f35a=_0x59be93[_0x9c0e('0x39')][_0x9c0e('0x81')][_0x9c0e('0x82')]('\x5c','\x5c\x5c')[_0x9c0e('0x82')](/'/g,'\x27\x27');if(qs[_0x9c0e('0x83')](_0x20f35a)){_0x3ed8f6['or'](_0x9c0e('0x84'),_0x20f35a+'%')['or'](_0x9c0e('0x85'),_0x20f35a+'%');}else{_0x3ed8f6['or'](_0x9c0e('0x86'),qs[_0x9c0e('0x62')](_0x20f35a))['or'](_0x9c0e('0x87'),_0x20f35a+'%');}}}_0x4afe27['where'](_0x3ed8f6);_0x4afe27[_0x9c0e('0x88')](_0x9c0e('0x89'));var _0x52df12={'type':db['Sequelize']['QueryTypes'][_0x9c0e('0x8a')],'raw':!![]};var _0x424e0a=_0x4afe27[_0x9c0e('0x8b')]();_0x424e0a[_0x9c0e('0x45')]('i.id');_0x424e0a[_0x9c0e('0x45')](_0x9c0e('0x8c'),_0x9c0e('0x59'));if(_0x57817c[_0x9c0e('0x41')]){_0x57817c[_0x9c0e('0x41')][_0x9c0e('0x80')](function(_0x1b1a90){var _0x2cc243=_0x1b1a90[0x0]===_0x9c0e('0x8d')?_0x1b1a90[0x0]:'i.'+_0x1b1a90[0x0];_0x4afe27['order'](_0x2cc243,_0x1b1a90[0x1]===_0x9c0e('0x8e')?![]:!![]);});}if(!_['isEmpty'](_0x42e6b5)){_0x4afe27[_0x9c0e('0x5b')](_0x622eed);_0x424e0a['where'](_0x9c0e('0x8f'),_0x42e6b5);}BPromise['resolve']()[_0x9c0e('0x28')](function(){if(!_0x830be5){if(_0x59be93[_0x9c0e('0x39')][_0x9c0e('0x73')])return;_0x424e0a[_0x9c0e('0x43')](_0x9c0e('0x90'));_0x4afe27[_0x9c0e('0x43')](_0x9c0e('0x90'));return;}if(_0x59be93[_0x9c0e('0x91')][_0x9c0e('0x92')]!==_0x9c0e('0x93'))return;return _0x59be93[_0x9c0e('0x91')][_0x9c0e('0x94')]({'attributes':['id'],'raw':!![]})[_0x9c0e('0x28')](function(_0x3c21a7){if(_[_0x9c0e('0x95')](_0x3c21a7)){_0x424e0a[_0x9c0e('0x43')](_0x9c0e('0x96'));_0x4afe27[_0x9c0e('0x43')]('i.SmsAccountId\x20IS\x20NULL');}else{_0x424e0a[_0x9c0e('0x43')](_0x9c0e('0x74'),_[_0x9c0e('0x38')](_0x3c21a7,'id'));_0x4afe27[_0x9c0e('0x43')](_0x9c0e('0x74'),_[_0x9c0e('0x38')](_0x3c21a7,'id'));}});})[_0x9c0e('0x28')](function(){if(_0x59be93[_0x9c0e('0x91')]['role']==='agent'&&!_0x830be5&&!_0x59be93[_0x9c0e('0x39')][_0x9c0e('0x73')])return[];return db['sequelize'][_0x9c0e('0x39')](_0x424e0a['toString'](),_0x52df12);})[_0x9c0e('0x28')](function(_0x57b5f0){_0xc8f233[_0x9c0e('0x21')]=_0x57b5f0[_0x9c0e('0x3e')];if(_0xc8f233[_0x9c0e('0x21')]===0x0)return[];return db['sequelize']['query'](_0x22670a[_0x9c0e('0x97')](),_0x52df12)[_0x9c0e('0x28')](function(_0xb3e0c7){_0x3b8f65=_['keyBy'](_0xb3e0c7,'id');_0x52df12=_['merge'](_0x52df12,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x59be93[_0x9c0e('0x39')]['fields']){_0x57817c[_0x9c0e('0x3c')][_0x9c0e('0x80')](function(_0x2204e5){_0x4afe27[_0x9c0e('0x45')]('i.'+_0x2204e5);});}else{_0x4afe27[_0x9c0e('0x45')](_0x9c0e('0x8c'),'unreadMessages');_0x4afe27[_0x9c0e('0x45')](_0x9c0e('0x98'),_0x9c0e('0x99'));_0x4afe27[_0x9c0e('0x45')](_0x9c0e('0x9a'),'Account.mandatoryDisposition');_0x4afe27[_0x9c0e('0x45')](_0x9c0e('0x9b'),'contactName');_0x4afe27[_0x9c0e('0x45')](_0x9c0e('0x9c'));_0x4afe27['field'](_0x9c0e('0x9d'),_0x9c0e('0x9e'));_0x4afe27['field'](_0x9c0e('0x9f'),_0x9c0e('0xa0'));_0x4afe27[_0x9c0e('0x45')](_0x9c0e('0xa1'),_0x9c0e('0xa2'));_0x4afe27['field'](_0x9c0e('0xa3'),_0x9c0e('0xa4'));_0x4afe27[_0x9c0e('0x45')](_0x9c0e('0xa5'),_0x9c0e('0xa6'));_0x4afe27[_0x9c0e('0x45')](_0x9c0e('0xa7'),'Contact.fax');_0x4afe27[_0x9c0e('0x45')](_0x9c0e('0xa8'),_0x9c0e('0xa9'));_0x4afe27[_0x9c0e('0x45')](_0x9c0e('0xaa'),_0x9c0e('0xab'));_0x4afe27[_0x9c0e('0x45')](_0x9c0e('0xac'),_0x9c0e('0x2e'));}if(_0x57817c[_0x9c0e('0x23')])_0x4afe27['limit'](_0x57817c[_0x9c0e('0x23')]);if(_0x57817c[_0x9c0e('0x22')])_0x4afe27[_0x9c0e('0x22')](_0x57817c[_0x9c0e('0x22')]);return db[_0x9c0e('0xad')][_0x9c0e('0x39')](_0x4afe27[_0x9c0e('0x97')](),_0x52df12);})[_0x9c0e('0x28')](function(_0x241bf6){if(_0x241bf6['length']>0x0)_0x4ed77c['where'](_0x9c0e('0xae'),_[_0x9c0e('0x38')](_0x241bf6,'id'));return db[_0x9c0e('0xad')][_0x9c0e('0x39')](_0x4ed77c[_0x9c0e('0x97')](),_0x52df12)[_0x9c0e('0x28')](function(_0x4525e6){var _0x5e73cc=_[_0x9c0e('0xaf')](_0x4525e6,_0x9c0e('0xb0'));var _0x3c5ba5=[];_0x241bf6[_0x9c0e('0x80')](function(_0x54b6e0){_0x3c5ba5[_0x9c0e('0x30')](updateSmsInteraction(_0x54b6e0,_0x3b8f65,_0x5e73cc));});return BPromise[_0x9c0e('0xb1')](_0x3c5ba5);});});})[_0x9c0e('0x28')](function(_0x3f5ea6){_0xc8f233['rows']=_0x3f5ea6;return _0xc8f233;})[_0x9c0e('0x28')](respondWithFilteredResult(_0x5e936f,_0x57817c))[_0x9c0e('0x31')](handleError(_0x5e936f,null));};exports[_0x9c0e('0xb2')]=function(_0x3cd10e,_0x3d8793){var _0x4e5e2d={'raw':![],'where':{'id':_0x3cd10e[_0x9c0e('0xb3')]['id']}},_0x538e01={};_0x538e01[_0x9c0e('0x37')]=_['keys'](db[_0x9c0e('0x33')][_0x9c0e('0x34')]);_0x538e01[_0x9c0e('0x39')]=_[_0x9c0e('0x70')](_0x3cd10e[_0x9c0e('0x39')]);_0x538e01[_0x9c0e('0x3a')]=_[_0x9c0e('0x3b')](_0x538e01['model'],_0x538e01['query']);_0x4e5e2d[_0x9c0e('0x3c')]=_[_0x9c0e('0x3b')](_0x538e01['model'],qs[_0x9c0e('0x3d')](_0x3cd10e[_0x9c0e('0x39')][_0x9c0e('0x3d')]));_0x4e5e2d[_0x9c0e('0x3c')]=_0x4e5e2d[_0x9c0e('0x3c')][_0x9c0e('0x3e')]?_0x4e5e2d[_0x9c0e('0x3c')]:_0x538e01[_0x9c0e('0x37')];if(_0x3cd10e['query']['includeAll']){_0x4e5e2d[_0x9c0e('0xb4')]=[{'all':!![]}];}_0x4e5e2d=_[_0x9c0e('0xb5')]({},_0x4e5e2d,_0x3cd10e['options']);return db[_0x9c0e('0x33')][_0x9c0e('0x64')](_0x4e5e2d)[_0x9c0e('0x28')](handleEntityNotFound(_0x3d8793,null))[_0x9c0e('0x28')](respondWithResult(_0x3d8793,null))[_0x9c0e('0x31')](handleError(_0x3d8793,null));};exports['create']=function(_0x4e0925,_0xcbcedd){return db[_0x9c0e('0x33')][_0x9c0e('0xb6')](_0x4e0925['body'],{})[_0x9c0e('0x28')](respondWithResult(_0xcbcedd,0xc9))['catch'](handleError(_0xcbcedd,null));};exports['update']=function(_0x5c7f53,_0x3b29c5){if(_0x5c7f53[_0x9c0e('0x6f')]['id']){delete _0x5c7f53[_0x9c0e('0x6f')]['id'];}return db[_0x9c0e('0x33')][_0x9c0e('0x64')]({'where':{'id':_0x5c7f53[_0x9c0e('0xb3')]['id']}})['then'](handleEntityNotFound(_0x3b29c5,null))[_0x9c0e('0x28')](saveUpdates(_0x5c7f53[_0x9c0e('0x6f')],null))[_0x9c0e('0x28')](respondWithResult(_0x3b29c5,null))[_0x9c0e('0x31')](handleError(_0x3b29c5,null));};exports['destroy']=function(_0xa789c2,_0x3d7160){return db[_0x9c0e('0x33')]['find']({'where':{'id':_0xa789c2[_0x9c0e('0xb3')]['id']}})['then'](handleEntityNotFound(_0x3d7160,null))[_0x9c0e('0x28')](removeEntity(_0x3d7160,null))['catch'](handleError(_0x3d7160,null));};exports['describe']=function(_0x34d570,_0x1a135b){return db[_0x9c0e('0x33')][_0x9c0e('0xb7')]()[_0x9c0e('0x28')](respondWithResult(_0x1a135b,null))[_0x9c0e('0x31')](handleError(_0x1a135b,null));};exports[_0x9c0e('0xb8')]=function(_0x5679f4,_0x3fc1cf,_0x50dfe0){return db[_0x9c0e('0xb9')][_0x9c0e('0x64')]({'where':{'id':_0x5679f4[_0x9c0e('0xb3')]['id']}})[_0x9c0e('0x28')](handleEntityNotFound(_0x3fc1cf,null))['then'](function(_0x5635d0){if(_0x5635d0){return _0x5635d0[_0x9c0e('0xb8')](_0x5679f4[_0x9c0e('0x6f')][_0x9c0e('0xba')],_[_0x9c0e('0xbb')](_0x5679f4[_0x9c0e('0x6f')],[_0x9c0e('0xba'),'id'])||{});}})['then'](respondWithResult(_0x3fc1cf,null))['catch'](handleError(_0x3fc1cf,null));};exports[_0x9c0e('0xbc')]=function(_0x5cc9ab,_0x55016e,_0x12aacc){var _0xd2786b={'raw':![],'where':{}};var _0x5b91f8={};var _0x2ea5f2={'count':0x0,'rows':[]};return db['SmsInteraction'][_0x9c0e('0xbd')]({'where':{'id':_0x5cc9ab[_0x9c0e('0xb3')]['id']}})['then'](handleEntityNotFound(_0x55016e,null))[_0x9c0e('0x28')](function(_0x2a926c){if(_0x2a926c){_0x5b91f8[_0x9c0e('0x37')]=_[_0x9c0e('0x70')](db['SmsMessage']['rawAttributes']);_0x5b91f8['query']=_[_0x9c0e('0x70')](_0x5cc9ab[_0x9c0e('0x39')]);_0x5b91f8[_0x9c0e('0x3a')]=_[_0x9c0e('0x3b')](_0x5b91f8['model'],_0x5b91f8[_0x9c0e('0x39')]);_0xd2786b[_0x9c0e('0x3c')]=_[_0x9c0e('0x3b')](_0x5b91f8['model'],qs[_0x9c0e('0x3d')](_0x5cc9ab['query'][_0x9c0e('0x3d')]));_0xd2786b['attributes']=_0xd2786b['attributes'][_0x9c0e('0x3e')]?_0xd2786b[_0x9c0e('0x3c')]:_0x5b91f8[_0x9c0e('0x37')];if(!_0x5cc9ab[_0x9c0e('0x39')]['hasOwnProperty'](_0x9c0e('0x40'))){_0xd2786b[_0x9c0e('0x23')]=qs[_0x9c0e('0x23')](_0x5cc9ab[_0x9c0e('0x39')][_0x9c0e('0x23')]);_0xd2786b[_0x9c0e('0x22')]=qs[_0x9c0e('0x22')](_0x5cc9ab[_0x9c0e('0x39')][_0x9c0e('0x22')]);}_0xd2786b[_0x9c0e('0x41')]=qs['sort'](_0x5cc9ab[_0x9c0e('0x39')][_0x9c0e('0x42')]);_0xd2786b[_0x9c0e('0x43')]=qs[_0x9c0e('0x3a')](_['pick'](_0x5cc9ab[_0x9c0e('0x39')],_0x5b91f8['filters']));_0xd2786b[_0x9c0e('0x43')][_0x9c0e('0xb0')]=_0x2a926c['id'];if(_0x5cc9ab[_0x9c0e('0x39')][_0x9c0e('0x81')]){_0xd2786b[_0x9c0e('0x43')]=_[_0x9c0e('0xb5')](_0xd2786b[_0x9c0e('0x43')],{'$or':_['map'](_0xd2786b[_0x9c0e('0x3c')],function(_0x434acb){var _0x1d8d9b={};_0x1d8d9b[_0x434acb]={'$like':'%'+_0x5cc9ab['query'][_0x9c0e('0x81')]+'%'};return _0x1d8d9b;})});}if(_0x5cc9ab[_0x9c0e('0x39')][_0x9c0e('0x77')]){var _0x14fa0e=_0x5cc9ab[_0x9c0e('0x39')]['$gte'][_0x9c0e('0xbe')](',');var _0xa1dd80={};_0xa1dd80[_0x14fa0e[0x0]]={'$gte':moment(_0x14fa0e[0x1])[_0x9c0e('0xbf')](_0x9c0e('0xc0'))};_0xd2786b['where']=_[_0x9c0e('0xb5')](_0xd2786b[_0x9c0e('0x43')],_0xa1dd80);}_0xd2786b=_['merge']({},_0xd2786b,_0x5cc9ab[_0x9c0e('0xc1')]);return db['SmsMessage']['count']({'where':_0xd2786b[_0x9c0e('0x43')]})[_0x9c0e('0x28')](function(_0x57f1eb){_0x2ea5f2[_0x9c0e('0x21')]=_0x57f1eb;if(_0x5cc9ab['query']['includeAll']){_0xd2786b['include']=[{'all':!![]}];}return db[_0x9c0e('0xb9')][_0x9c0e('0xc2')](_0xd2786b);})[_0x9c0e('0x28')](function(_0x3216cb){_0x2ea5f2[_0x9c0e('0xc3')]=_0x3216cb;return _0x2ea5f2;});}})[_0x9c0e('0x28')](respondWithFilteredResult(_0x55016e,_0xd2786b))['catch'](handleError(_0x55016e,null));};exports['addTags']=function(_0x33739c,_0x5af20c,_0x38f776){return db['SmsInteraction'][_0x9c0e('0x64')]({'where':{'id':_0x33739c['params']['id']}})[_0x9c0e('0x28')](handleEntityNotFound(_0x5af20c,null))[_0x9c0e('0x28')](function(_0x1f0741){if(_0x1f0741){return _0x1f0741[_0x9c0e('0xc4')](_0x33739c[_0x9c0e('0x6f')]['ids'],_['omit'](_0x33739c['body'],[_0x9c0e('0xba'),'id'])||{})[_0x9c0e('0xc5')](function(){return db[_0x9c0e('0x68')][_0x9c0e('0xc2')]({'attributes':['id',_0x9c0e('0x2a'),_0x9c0e('0x46')],'where':{'id':_0x33739c[_0x9c0e('0x6f')]['ids']}});})['then'](function(_0x11b143){socket[_0x9c0e('0xc6')](_0x9c0e('0xc7'),{'id':Number(_0x33739c[_0x9c0e('0xb3')]['id']),'tags':_0x11b143||[]});return{'id':Number(_0x33739c[_0x9c0e('0xb3')]['id']),'tags':_0x11b143||[]};});}})[_0x9c0e('0x28')](respondWithResult(_0x5af20c,null))[_0x9c0e('0x31')](handleError(_0x5af20c,null));};exports[_0x9c0e('0xc8')]=function(_0x3c7c39,_0x3a8b97,_0x5b6ff7){return db[_0x9c0e('0x33')][_0x9c0e('0x64')]({'where':{'id':_0x3c7c39[_0x9c0e('0xb3')]['id']}})[_0x9c0e('0x28')](handleEntityNotFound(_0x3a8b97,null))['then'](function(_0x54f616){if(_0x54f616){return _0x54f616[_0x9c0e('0xc8')](_0x3c7c39[_0x9c0e('0x39')]['ids']);}})['then'](respondWithStatusCode(_0x3a8b97,null))[_0x9c0e('0x31')](handleError(_0x3a8b97,null));};exports[_0x9c0e('0xc9')]=function(_0x7f1b25,_0x278229){var _0x16615a=moment()[_0x9c0e('0xca')]()[_0x9c0e('0x97')]();var _0x517ada=path['join'](config[_0x9c0e('0xcb')],_0x9c0e('0xcc'),_0x9c0e('0xcd'),'tmp');var _0x2e9fd5=path[_0x9c0e('0xce')](config[_0x9c0e('0xcb')],_0x9c0e('0xcc'),_0x9c0e('0xcd'),_0x9c0e('0xcf'));var _0x12b8d3=path[_0x9c0e('0xce')](_0x517ada,_0x16615a);var _0x2f20ea=util['format']('transcript-%d-%s.zip',_0x7f1b25[_0x9c0e('0xb3')]['id'],_0x16615a);var _0x503d62=path['join'](_0x517ada,_0x2f20ea);var _0x1a1594=[];_0x1a1594[_0x9c0e('0x30')]({'model':db[_0x9c0e('0x6b')],'as':'User','attributes':['id',_0x9c0e('0x2d')],'raw':!![]});_0x1a1594[_0x9c0e('0x30')]({'model':db[_0x9c0e('0xd0')],'as':_0x9c0e('0x5e'),'attributes':['id','firstName',_0x9c0e('0xd1')],'raw':!![]});var _0x175e0f=[{'model':db[_0x9c0e('0xb9')],'as':_0x9c0e('0xd2'),'attributes':['id','body',_0x9c0e('0x75'),_0x9c0e('0xd3'),'secret','read'],'include':_0x1a1594}];_0x175e0f[_0x9c0e('0x30')]({'model':db[_0x9c0e('0xd4')],'as':'Account','attributes':['id','name']});_0x175e0f[_0x9c0e('0x30')]({'model':db[_0x9c0e('0x6b')],'as':'Owner','attributes':['id',_0x9c0e('0x2d')]});return db[_0x9c0e('0x33')]['find']({'where':{'id':_0x7f1b25[_0x9c0e('0xb3')]['id']},'include':_0x175e0f})[_0x9c0e('0x28')](handleEntityNotFound(_0x278229,null))['then'](function(_0x1f4c7e){if(_0x1f4c7e){var _0x596cb1=_0x1f4c7e['get']({'plain':!![]});fs[_0x9c0e('0xd5')](_0x12b8d3);var _0x2a4b57={'channel':_0x9c0e('0xd6'),'account':_0x596cb1[_0x9c0e('0xd7')]['name'],'agent':_0x596cb1[_0x9c0e('0xd8')]?_0x596cb1[_0x9c0e('0xd8')][_0x9c0e('0x2d')]:_0x9c0e('0xd9'),'createdAt':moment(_0x596cb1[_0x9c0e('0x75')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x596cb1[_0x9c0e('0xda')]?moment(_0x596cb1[_0x9c0e('0xdb')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x9c0e('0x97')]():'','disposition':_0x596cb1['disposition'],'messages':_(_0x596cb1['Messages'])[_0x9c0e('0x81')]({'secret':![]})[_0x9c0e('0x38')](function(_0xa107e8){return{'date':moment(_0xa107e8['createdAt'])[_0x9c0e('0xbf')]('YYYY-MM-DD\x20HH:mm:ss')[_0x9c0e('0x97')](),'sender':_0xa107e8['direction']===_0x9c0e('0xdc')?_0xa107e8['User']?_0xa107e8[_0x9c0e('0x6b')][_0x9c0e('0x2d')]:'System':_0xa107e8['Contact'][_0x9c0e('0xdd')]+(_0xa107e8[_0x9c0e('0x5e')][_0x9c0e('0xd1')]?'\x20'+_0xa107e8['Contact'][_0x9c0e('0xd1')]:''),'body':_0xa107e8[_0x9c0e('0x6f')],'direction':_0xa107e8[_0x9c0e('0xd3')]==='out'?'A':'C','secret':_0xa107e8[_0x9c0e('0xde')],'read':_0xa107e8[_0x9c0e('0x7c')]};})['value']()};return ejs[_0x9c0e('0xdf')](path[_0x9c0e('0xce')](config[_0x9c0e('0xcb')],_0x9c0e('0xcc'),_0x9c0e('0xe0'),_0x9c0e('0xe1')),{'interaction':_0x2a4b57})[_0x9c0e('0x28')](function(_0x38b5db){var _0x31451f=path[_0x9c0e('0xce')](_0x12b8d3,'transcript-'+_0x596cb1['id']+'-'+_0x16615a+_0x9c0e('0xe2'));var _0x330912={'path':_0x31451f,'channel':_0x9c0e('0xd6'),'interactionId':_0x596cb1['id']};return pdf[_0x9c0e('0xe3')](_0x38b5db,_0x330912);})[_0x9c0e('0x28')](function(){return new BPromise(function(_0x202458,_0x458581){zipdir(_0x12b8d3,{'saveTo':_0x503d62},function(_0x5886bd,_0x15c34d){if(_0x5886bd)return _0x458581(_0x5886bd);return _0x202458(_0x15c34d);});})[_0x9c0e('0x28')](function(){return new BPromise(function(_0x1b7872,_0x1f70af){rimraf(_0x12b8d3,function(_0x5a2a95){if(_0x5a2a95)_0x1f70af(_0x5a2a95);return _0x1b7872();});});})[_0x9c0e('0x28')](function(){return _0x278229[_0x9c0e('0xc9')](_0x503d62,_0x2f20ea,function(_0x6d22a8){if(_0x6d22a8){console['log'](_0x9c0e('0xe4'),_0x6d22a8);}else{fs[_0x9c0e('0xe5')](_0x503d62);}});});});}else{return _0x278229['sendStatus'](0xc8);}})['catch'](handleError(_0x278229,null));}; \ No newline at end of file +var _0x48ac=['util','path','sox','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','./smsInteraction.socket','register','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','error','name','send','Users','fullname','TagIds','split','forEach','Tags','push','catch','index','SmsInteraction','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','sms_messages','me.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','length','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','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?','UserId','body','text','keys','compact','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','rows','show','params','rawAttributes','includeAll','options','create','describe','SmsMessage','addMessage','ids','omit','getMessages','findOne','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','addTags','setTags','spread','smsInteractionTags:save','removeTags','unix','join','server','files','tmp','attachments','transcript-%d-%s.zip','CmContact','Messages','direction','secret','SmsAccount','Account','get','mkdirSync','Sms','Owner','disposition','System','firstName','lastName','out','renderFile','root','views','transcript-','.pdf','createPdfFromHTML','download','log','unlinkSync','rimraf','fast-json-patch','request-promise','moment','mustache'];(function(_0x20e5e2,_0x57c3b1){var _0x803951=function(_0x314d88){while(--_0x314d88){_0x20e5e2['push'](_0x20e5e2['shift']());}};_0x803951(++_0x57c3b1);}(_0x48ac,0xe0));var _0xc48a=function(_0x2a33b9,_0x30ef31){_0x2a33b9=_0x2a33b9-0x0;var _0x162a2c=_0x48ac[_0x2a33b9];return _0x162a2c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc48a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc48a('0x1'));var rp=require(_0xc48a('0x2'));var moment=require(_0xc48a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc48a('0x4'));var util=require(_0xc48a('0x5'));var path=require(_0xc48a('0x6'));var sox=require(_0xc48a('0x7'));var csv=require(_0xc48a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xc48a('0x9'));var jsforce=require(_0xc48a('0xa'));var deskjs=require(_0xc48a('0xb'));var toCsv=require('to-csv');var querystring=require(_0xc48a('0xc'));var Papa=require(_0xc48a('0xd'));var Redis=require(_0xc48a('0xe'));var authService=require(_0xc48a('0xf'));var qs=require(_0xc48a('0x10'));var as=require(_0xc48a('0x11'));var pdf=require(_0xc48a('0x12'));var hardwareService=require(_0xc48a('0x13'));var logger=require(_0xc48a('0x14'))(_0xc48a('0x15'));var utils=require(_0xc48a('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xc48a('0x17'));var db=require(_0xc48a('0x18'))['db'];config[_0xc48a('0x19')]=_['defaults'](config[_0xc48a('0x19')],{'host':_0xc48a('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc48a('0x19')]));require(_0xc48a('0x1b'))[_0xc48a('0x1c')](socket);function respondWithStatusCode(_0x4e0d3c,_0x2e2bb0){_0x2e2bb0=_0x2e2bb0||0xcc;return function(_0x70c92f){if(_0x70c92f){return _0x4e0d3c[_0xc48a('0x1d')](_0x2e2bb0);}return _0x4e0d3c['status'](_0x2e2bb0)[_0xc48a('0x1e')]();};}function respondWithResult(_0x2172f5,_0x53bfc3){_0x53bfc3=_0x53bfc3||0xc8;return function(_0x5c319b){if(_0x5c319b){return _0x2172f5[_0xc48a('0x1f')](_0x53bfc3)['json'](_0x5c319b);}};}function respondWithFilteredResult(_0x632d0c,_0x29a1ad){return function(_0x188549){if(_0x188549){var _0x462102=typeof _0x29a1ad[_0xc48a('0x20')]===_0xc48a('0x21')&&typeof _0x29a1ad[_0xc48a('0x22')]==='undefined';var _0x308703=_0x188549[_0xc48a('0x23')];var _0x5b750c=_0x462102?0x0:_0x29a1ad[_0xc48a('0x20')];var _0x4e6e15=_0x462102?_0x188549[_0xc48a('0x23')]:_0x29a1ad['offset']+_0x29a1ad[_0xc48a('0x22')];var _0x382f69;if(_0x4e6e15>=_0x308703){_0x4e6e15=_0x308703;_0x382f69=0xc8;}else{_0x382f69=0xce;}_0x632d0c[_0xc48a('0x1f')](_0x382f69);return _0x632d0c[_0xc48a('0x24')](_0xc48a('0x25'),_0x5b750c+'-'+_0x4e6e15+'/'+_0x308703)[_0xc48a('0x26')](_0x188549);}return null;};}function patchUpdates(_0x248fdd){return function(_0x409ca0){try{jsonpatch[_0xc48a('0x27')](_0x409ca0,_0x248fdd,!![]);}catch(_0x3201bc){return BPromise[_0xc48a('0x28')](_0x3201bc);}return _0x409ca0['save']();};}function saveUpdates(_0x53fab0,_0x351b72){return function(_0x16d41a){if(_0x16d41a){return _0x16d41a[_0xc48a('0x29')](_0x53fab0)[_0xc48a('0x2a')](function(_0x5b63aa){return _0x5b63aa;});}return null;};}function removeEntity(_0x5c5d61,_0x34cad3){return function(_0xa8c195){if(_0xa8c195){return _0xa8c195[_0xc48a('0x2b')]()['then'](function(){_0x5c5d61[_0xc48a('0x1f')](0xcc)[_0xc48a('0x1e')]();});}};}function handleEntityNotFound(_0x23aa60,_0x281100){return function(_0x2516f3){if(!_0x2516f3){_0x23aa60[_0xc48a('0x1d')](0x194);}return _0x2516f3;};}function handleError(_0x1a2b28,_0x335532){_0x335532=_0x335532||0x1f4;return function(_0x3b75db){logger[_0xc48a('0x2c')](_0x3b75db['stack']);if(_0x3b75db['name']){delete _0x3b75db[_0xc48a('0x2d')];}_0x1a2b28['status'](_0x335532)[_0xc48a('0x2e')](_0x3b75db);};}function getInteractionUsers(_0x10e450,_0x5ae94f){return new BPromise(function(_0x2f69c7,_0x2ab3e1){try{if(_0x5ae94f[_0x10e450['id']]){_0x10e450[_0xc48a('0x2f')]=_['map'](_0x5ae94f[_0x10e450['id']],function(_0x81cd6e){return{'id':_0x81cd6e['id'],'fullname':_0x81cd6e[_0xc48a('0x30')]};});}}catch(_0x5da25c){_0x2ab3e1(_0x5da25c);}_0x2f69c7(_0x10e450);});}function getInteractionTags(_0x361d18,_0x3f1bef){return new BPromise(function(_0x14bdfc,_0x4db7e2){try{if(_0x361d18[_0xc48a('0x31')]){_0x361d18['Tags']=[];_0x361d18[_0xc48a('0x31')][_0xc48a('0x32')](',')[_0xc48a('0x33')](function(_0x2ad597){_0x361d18[_0xc48a('0x34')][_0xc48a('0x35')](_0x3f1bef[_0x2ad597]);});}delete _0x361d18[_0xc48a('0x31')];}catch(_0x26483b){_0x4db7e2(_0x26483b);}_0x14bdfc(_0x361d18);});}function updateSmsInteraction(_0x57d803,_0x44c7b3,_0x341b51){return new BPromise(function(_0x38ad22,_0x47c6e8){return getInteractionUsers(_0x57d803,_0x341b51)[_0xc48a('0x2a')](function(_0x35c259){return getInteractionTags(_0x35c259,_0x44c7b3);})[_0xc48a('0x2a')](function(_0x52b449){_0x38ad22(_0x52b449);})[_0xc48a('0x36')](function(_0xa26b55){_0x47c6e8(_0xa26b55);});});}exports[_0xc48a('0x37')]=function(_0x2288ce,_0x5473c1){var _0x36378a={},_0x3c0cdf={},_0x4b355c={'count':0x0,'rows':[]};var _0x2029cb=_['map'](db[_0xc48a('0x38')]['rawAttributes'],function(_0x547f6b){return{'name':_0x547f6b[_0xc48a('0x39')],'type':_0x547f6b[_0xc48a('0x3a')]['key']};});_0x3c0cdf[_0xc48a('0x3b')]=_[_0xc48a('0x3c')](_0x2029cb,_0xc48a('0x2d'));_0x3c0cdf[_0xc48a('0x3d')]=_['keys'](_0x2288ce[_0xc48a('0x3d')]);_0x3c0cdf[_0xc48a('0x3e')]=_[_0xc48a('0x3f')](_0x3c0cdf[_0xc48a('0x3b')],_0x3c0cdf['query']);_0x36378a[_0xc48a('0x40')]=_['intersection'](_0x3c0cdf[_0xc48a('0x3b')],qs[_0xc48a('0x41')](_0x2288ce[_0xc48a('0x3d')][_0xc48a('0x41')]));_0x36378a[_0xc48a('0x40')]=_0x36378a[_0xc48a('0x40')]['length']?_0x36378a[_0xc48a('0x40')]:_0x3c0cdf[_0xc48a('0x3b')];if(!_0x2288ce[_0xc48a('0x3d')][_0xc48a('0x42')](_0xc48a('0x43'))){_0x36378a['limit']=qs[_0xc48a('0x22')](_0x2288ce[_0xc48a('0x3d')][_0xc48a('0x22')]);_0x36378a['offset']=qs[_0xc48a('0x20')](_0x2288ce['query']['offset']);}_0x36378a[_0xc48a('0x44')]=qs[_0xc48a('0x45')](_0x2288ce[_0xc48a('0x3d')][_0xc48a('0x45')]);_0x36378a[_0xc48a('0x46')]=qs[_0xc48a('0x3e')](_[_0xc48a('0x47')](_0x2288ce['query'],_0x3c0cdf['filters']),_0x2029cb);var _0x551c5a=[];var _0x1ccb0a=squel[_0xc48a('0x48')]()[_0xc48a('0x49')]('id')[_0xc48a('0x49')](_0xc48a('0x2d'))[_0xc48a('0x49')](_0xc48a('0x4a'))[_0xc48a('0x4b')](_0xc48a('0x4c'));var _0x11cd25=squel[_0xc48a('0x48')]()['field'](_0xc48a('0x4d'))[_0xc48a('0x49')](_0xc48a('0x4e'))[_0xc48a('0x49')](_0xc48a('0x4f'))[_0xc48a('0x4b')](_0xc48a('0x50'),'ui')[_0xc48a('0x51')](_0xc48a('0x52'),'u','u.id\x20=\x20ui.UserId');var _0x16ee60=squel[_0xc48a('0x48')]()[_0xc48a('0x4b')](_0xc48a('0x53'),'i')['left_join'](_0xc48a('0x54'),'c',_0xc48a('0x55'))['left_join'](_0xc48a('0x52'),'o',_0xc48a('0x56'))[_0xc48a('0x51')](_0xc48a('0x57'),'a','a.id\x20=\x20i.SmsAccountId')[_0xc48a('0x51')](_0xc48a('0x58'),'me',_0xc48a('0x59'))[_0xc48a('0x51')]('sms_interaction_has_tags','it','it.SmsInteractionId\x20=\x20i.id')['left_join'](_0xc48a('0x4c'),'t',_0xc48a('0x5a'));var _0x546b69=squel[_0xc48a('0x5b')]();var _0x51ecf2=[];var _0x34e30d=squel[_0xc48a('0x5b')]();var _0x36b072;if(_0x2288ce[_0xc48a('0x3d')][_0xc48a('0x5c')]){_0x36b072=as[_0xc48a('0x5d')](_0x2288ce[_0xc48a('0x3d')][_0xc48a('0x5c')]);var _0x337a4e=_0x36b072['sqlOperator'];for(var _0x64ac6=0x0;_0x64ac6<_0x36b072['conditions'][_0xc48a('0x5e')];_0x64ac6++){var _0x40dc93=_0x36b072[_0xc48a('0x5f')][_0x64ac6];var _0x4503af='i';var _0x4678c8=_['find'](_0x2029cb,[_0xc48a('0x2d'),_0x40dc93['field']]);if(!_0x4678c8){switch(_0x40dc93[_0xc48a('0x49')]){case _0xc48a('0x60'):if(_0x40dc93[_0xc48a('0x61')]==0x1){_0x16ee60[_0xc48a('0x62')]('`'+_0x40dc93[_0xc48a('0x49')]+_0xc48a('0x63'));}else{_0x16ee60['having']('`'+_0x40dc93[_0xc48a('0x49')]+_0xc48a('0x64'));}break;case _0xc48a('0x65'):if(_0x40dc93['operator']===_0xc48a('0x66')){if(_0x40dc93[_0xc48a('0x61')][_0xc48a('0x32')]('\x20')['length']>0x1){_0x546b69[_0x337a4e](_0xc48a('0x67'),qs['getFullTextValue'](_0x40dc93[_0xc48a('0x61')]),null);}else{var _0x58d8a5='%'+_0x40dc93[_0xc48a('0x61')]+'%';_0x546b69[_0x337a4e](_0xc48a('0x68'),_0x58d8a5,_0x58d8a5,_0x58d8a5);}}else{_0x4678c8=_[_0xc48a('0x69')](_0x2029cb,[_0xc48a('0x2d'),_0xc48a('0x6a')]);_0x40dc93[_0xc48a('0x49')]=_0xc48a('0x6a');_0x2256f5=as[_0xc48a('0x6b')](_0x4503af,_0x4678c8[_0xc48a('0x3a')],_0x40dc93);_0x546b69[_0x337a4e](_0x2256f5['text'],_0x2256f5['value'][_0xc48a('0x6c')],_0x2256f5['value'][_0xc48a('0x1e')]);}break;case _0xc48a('0x6d'):var _0x319cbe=_0x40dc93[_0xc48a('0x61')]['split'](',')['map'](function(_0x155374){return Number(_0x155374);});_0x319cbe[_0xc48a('0x33')](function(_0x12c3f4){_0x34e30d['or'](_0xc48a('0x6e'),'%,'+_0x12c3f4+',%');});_0x51ecf2=_['union'](_0x51ecf2,_0x319cbe);break;case _0xc48a('0x6f'):if(_0x40dc93[_0xc48a('0x70')]==='$substring'){_0x546b69[_0x337a4e](_0xc48a('0x71'),'%'+_0x40dc93[_0xc48a('0x61')]+'%',null);}else{_0x4678c8=_[_0xc48a('0x69')](_0x2029cb,[_0xc48a('0x2d'),_0xc48a('0x72')]);_0x40dc93[_0xc48a('0x49')]=_0xc48a('0x72');_0x2256f5=as[_0xc48a('0x6b')](_0x4503af,_0x4678c8[_0xc48a('0x3a')],_0x40dc93);_0x546b69[_0x337a4e](_0x2256f5['text'],_0x2256f5['value'][_0xc48a('0x6c')],_0x2256f5[_0xc48a('0x61')][_0xc48a('0x1e')]);}break;case _0xc48a('0x73'):_0x2256f5=as[_0xc48a('0x6b')]('me',null,_0x40dc93);_0x546b69[_0x337a4e](_0x2256f5[_0xc48a('0x74')],_0x2256f5[_0xc48a('0x61')]['start'],_0x2256f5[_0xc48a('0x61')][_0xc48a('0x1e')]);break;}}else{var _0x2256f5=as[_0xc48a('0x6b')](_0x4503af,_0x4678c8[_0xc48a('0x3a')],_0x40dc93);_0x546b69[_0x337a4e](_0x2256f5[_0xc48a('0x74')],_0x2256f5[_0xc48a('0x61')]['start'],_0x2256f5[_0xc48a('0x61')][_0xc48a('0x1e')]);}}}else{var _0x4ea328=_(_0x2288ce[_0xc48a('0x3d')])[_0xc48a('0x75')]()[_0xc48a('0x3c')](function(_0x3620d2){return _['some'](_0x2029cb,[_0xc48a('0x2d'),_0x3620d2])?_0x3620d2:undefined;})[_0xc48a('0x76')]()[_0xc48a('0x61')]();if(!_[_0xc48a('0x77')](_0x4ea328)){_0x4ea328[_0xc48a('0x33')](function(_0x94bf8c){if(_0x94bf8c===_0xc48a('0x78')){_0x16ee60['where'](_0xc48a('0x79'),[][_0xc48a('0x7a')](_0x2288ce[_0xc48a('0x3d')][_0x94bf8c]));}else if(_0x94bf8c===_0xc48a('0x7b')){var _0x8ca726=JSON['parse'](_0x2288ce[_0xc48a('0x3d')][_0x94bf8c])[_0xc48a('0x7c')];var _0x545268=JSON[_0xc48a('0x7d')](_0x2288ce['query'][_0x94bf8c])[_0xc48a('0x7e')];_0x16ee60[_0xc48a('0x46')](_0xc48a('0x7f'),_0x8ca726,_0x545268);}else{if(_0x2288ce[_0xc48a('0x3d')][_0x94bf8c]===_0xc48a('0x80')){_0x16ee60[_0xc48a('0x46')]('i.'+_0x94bf8c+'\x20IS\x20NULL');}else{_0x16ee60['where']('i.'+_0x94bf8c+_0xc48a('0x81'),_0x2288ce['query'][_0x94bf8c]);}}});}if(_0x2288ce[_0xc48a('0x3d')][_0xc48a('0x82')]){if(_0x2288ce[_0xc48a('0x3d')][_0xc48a('0x82')]==0x1){_0x16ee60['having']('`unreadMessages`\x20=\x200');}else{_0x16ee60['having']('`unreadMessages`\x20>\x200');}}if(_0x2288ce['query'][_0xc48a('0x83')]){_0x51ecf2=_['isArray'](_0x2288ce[_0xc48a('0x3d')][_0xc48a('0x83')])?_0x2288ce[_0xc48a('0x3d')][_0xc48a('0x83')]:new Array(_0x2288ce[_0xc48a('0x3d')][_0xc48a('0x83')]);_0x51ecf2[_0xc48a('0x33')](function(_0x20c67b){_0x34e30d['or'](_0xc48a('0x6e'),'%,'+_0x20c67b+',%');});}if(_0x2288ce[_0xc48a('0x3d')][_0xc48a('0x84')]){var _0x4ca8e0=_0x2288ce[_0xc48a('0x3d')][_0xc48a('0x84')][_0xc48a('0x85')]('\x5c','\x5c\x5c')[_0xc48a('0x85')](/'/g,'\x27\x27');if(qs[_0xc48a('0x86')](_0x4ca8e0)){_0x546b69['or'](_0xc48a('0x87'),_0x4ca8e0+'%')['or'](_0xc48a('0x88'),_0x4ca8e0+'%');}else{_0x546b69['or'](_0xc48a('0x89'),qs[_0xc48a('0x8a')](_0x4ca8e0))['or'](_0xc48a('0x8b'),_0x4ca8e0+'%');}}}_0x16ee60[_0xc48a('0x46')](_0x546b69);_0x16ee60[_0xc48a('0x8c')](_0xc48a('0x8d'));var _0x5718bc={'type':db['Sequelize'][_0xc48a('0x8e')][_0xc48a('0x8f')],'raw':!![]};var _0x5b3b5e=_0x16ee60[_0xc48a('0x90')]();_0x5b3b5e['field'](_0xc48a('0x8d'));_0x5b3b5e[_0xc48a('0x49')](_0xc48a('0x91'),_0xc48a('0x60'));if(_0x36378a[_0xc48a('0x44')]){_0x36378a[_0xc48a('0x44')][_0xc48a('0x33')](function(_0x1c3bfc){var _0x4f1148=_0x1c3bfc[0x0]===_0xc48a('0x92')?_0x1c3bfc[0x0]:'i.'+_0x1c3bfc[0x0];_0x16ee60['order'](_0x4f1148,_0x1c3bfc[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x51ecf2)){_0x16ee60['having'](_0x34e30d);_0x5b3b5e[_0xc48a('0x46')](_0xc48a('0x93'),_0x51ecf2);}BPromise[_0xc48a('0x94')]()[_0xc48a('0x2a')](function(){if(!_0x36b072){if(_0x2288ce[_0xc48a('0x3d')][_0xc48a('0x78')])return;_0x5b3b5e['where']('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x16ee60[_0xc48a('0x46')](_0xc48a('0x95'));return;}if(_0x2288ce[_0xc48a('0x96')][_0xc48a('0x97')]!==_0xc48a('0x98'))return;return _0x2288ce['user'][_0xc48a('0x99')]({'attributes':['id'],'raw':!![]})[_0xc48a('0x2a')](function(_0x14a944){if(_['isEmpty'](_0x14a944)){_0x5b3b5e[_0xc48a('0x46')](_0xc48a('0x9a'));_0x16ee60[_0xc48a('0x46')](_0xc48a('0x9a'));}else{_0x5b3b5e['where'](_0xc48a('0x79'),_[_0xc48a('0x3c')](_0x14a944,'id'));_0x16ee60[_0xc48a('0x46')](_0xc48a('0x79'),_[_0xc48a('0x3c')](_0x14a944,'id'));}});})[_0xc48a('0x2a')](function(){if(_0x2288ce[_0xc48a('0x96')][_0xc48a('0x97')]===_0xc48a('0x98')&&!_0x36b072&&!_0x2288ce[_0xc48a('0x3d')][_0xc48a('0x78')])return[];return db[_0xc48a('0x9b')]['query'](_0x5b3b5e[_0xc48a('0x9c')](),_0x5718bc);})['then'](function(_0x280d5e){_0x4b355c[_0xc48a('0x23')]=_0x280d5e['length'];if(_0x4b355c['count']===0x0)return[];return db[_0xc48a('0x9b')][_0xc48a('0x3d')](_0x1ccb0a['toString'](),_0x5718bc)[_0xc48a('0x2a')](function(_0x36c35c){_0x551c5a=_[_0xc48a('0x9d')](_0x36c35c,'id');_0x5718bc=_[_0xc48a('0x9e')](_0x5718bc,{'model':db[_0xc48a('0x38')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2288ce['query'][_0xc48a('0x41')]){_0x36378a[_0xc48a('0x40')]['forEach'](function(_0x2afd3f){_0x16ee60[_0xc48a('0x49')]('i.'+_0x2afd3f);});}else{_0x16ee60[_0xc48a('0x49')](_0xc48a('0x91'),_0xc48a('0x60'));_0x16ee60[_0xc48a('0x49')](_0xc48a('0x9f'),'Account.key');_0x16ee60['field'](_0xc48a('0xa0'),_0xc48a('0xa1'));_0x16ee60[_0xc48a('0x49')](_0xc48a('0xa2'),_0xc48a('0x92'));_0x16ee60['field']('i.*');_0x16ee60[_0xc48a('0x49')]('c.firstName','Contact.firstName');_0x16ee60['field']('c.lastName','Contact.lastName');_0x16ee60[_0xc48a('0x49')]('c.email',_0xc48a('0xa3'));_0x16ee60[_0xc48a('0x49')](_0xc48a('0xa4'),_0xc48a('0xa5'));_0x16ee60['field'](_0xc48a('0xa6'),'Contact.mobile');_0x16ee60['field'](_0xc48a('0xa7'),_0xc48a('0xa8'));_0x16ee60[_0xc48a('0x49')](_0xc48a('0xa9'),_0xc48a('0xaa'));_0x16ee60[_0xc48a('0x49')]('o.internal',_0xc48a('0xab'));_0x16ee60[_0xc48a('0x49')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xc48a('0x31'));}if(_0x36378a[_0xc48a('0x22')])_0x16ee60['limit'](_0x36378a['limit']);if(_0x36378a[_0xc48a('0x20')])_0x16ee60['offset'](_0x36378a[_0xc48a('0x20')]);return db[_0xc48a('0x9b')][_0xc48a('0x3d')](_0x16ee60['toString'](),_0x5718bc);})['then'](function(_0x217054){if(_0x217054[_0xc48a('0x5e')]>0x0)_0x11cd25[_0xc48a('0x46')](_0xc48a('0xac'),_[_0xc48a('0x3c')](_0x217054,'id'));return db['sequelize'][_0xc48a('0x3d')](_0x11cd25[_0xc48a('0x9c')](),_0x5718bc)[_0xc48a('0x2a')](function(_0x2f10ba){var _0x47e79d=_[_0xc48a('0xad')](_0x2f10ba,_0xc48a('0xae'));var _0x3d1348=[];_0x217054['forEach'](function(_0x11c0cb){_0x3d1348[_0xc48a('0x35')](updateSmsInteraction(_0x11c0cb,_0x551c5a,_0x47e79d));});return BPromise['all'](_0x3d1348);});});})[_0xc48a('0x2a')](function(_0x78f98e){_0x4b355c[_0xc48a('0xaf')]=_0x78f98e;return _0x4b355c;})[_0xc48a('0x2a')](respondWithFilteredResult(_0x5473c1,_0x36378a))[_0xc48a('0x36')](handleError(_0x5473c1,null));};exports[_0xc48a('0xb0')]=function(_0x5322dd,_0x408eba){var _0x1e68ba={'raw':![],'where':{'id':_0x5322dd[_0xc48a('0xb1')]['id']}},_0x58afc0={};_0x58afc0['model']=_[_0xc48a('0x75')](db['SmsInteraction'][_0xc48a('0xb2')]);_0x58afc0[_0xc48a('0x3d')]=_[_0xc48a('0x75')](_0x5322dd['query']);_0x58afc0[_0xc48a('0x3e')]=_[_0xc48a('0x3f')](_0x58afc0['model'],_0x58afc0[_0xc48a('0x3d')]);_0x1e68ba[_0xc48a('0x40')]=_[_0xc48a('0x3f')](_0x58afc0['model'],qs[_0xc48a('0x41')](_0x5322dd['query'][_0xc48a('0x41')]));_0x1e68ba[_0xc48a('0x40')]=_0x1e68ba[_0xc48a('0x40')][_0xc48a('0x5e')]?_0x1e68ba['attributes']:_0x58afc0[_0xc48a('0x3b')];if(_0x5322dd[_0xc48a('0x3d')][_0xc48a('0xb3')]){_0x1e68ba['include']=[{'all':!![]}];}_0x1e68ba=_['merge']({},_0x1e68ba,_0x5322dd[_0xc48a('0xb4')]);return db[_0xc48a('0x38')][_0xc48a('0x69')](_0x1e68ba)['then'](handleEntityNotFound(_0x408eba,null))[_0xc48a('0x2a')](respondWithResult(_0x408eba,null))[_0xc48a('0x36')](handleError(_0x408eba,null));};exports[_0xc48a('0xb5')]=function(_0x387034,_0x3c8b22){return db['SmsInteraction'][_0xc48a('0xb5')](_0x387034[_0xc48a('0x73')],{})['then'](respondWithResult(_0x3c8b22,0xc9))[_0xc48a('0x36')](handleError(_0x3c8b22,null));};exports[_0xc48a('0x29')]=function(_0x26193d,_0x1e5a74){if(_0x26193d['body']['id']){delete _0x26193d['body']['id'];}return db[_0xc48a('0x38')]['find']({'where':{'id':_0x26193d[_0xc48a('0xb1')]['id']}})[_0xc48a('0x2a')](handleEntityNotFound(_0x1e5a74,null))[_0xc48a('0x2a')](saveUpdates(_0x26193d[_0xc48a('0x73')],null))['then'](respondWithResult(_0x1e5a74,null))[_0xc48a('0x36')](handleError(_0x1e5a74,null));};exports[_0xc48a('0x2b')]=function(_0x3256d3,_0x5187a5){return db[_0xc48a('0x38')][_0xc48a('0x69')]({'where':{'id':_0x3256d3['params']['id']}})[_0xc48a('0x2a')](handleEntityNotFound(_0x5187a5,null))[_0xc48a('0x2a')](removeEntity(_0x5187a5,null))[_0xc48a('0x36')](handleError(_0x5187a5,null));};exports[_0xc48a('0xb6')]=function(_0x4bab92,_0x10e7b9){return db['SmsInteraction'][_0xc48a('0xb6')]()['then'](respondWithResult(_0x10e7b9,null))[_0xc48a('0x36')](handleError(_0x10e7b9,null));};exports['addMessage']=function(_0x30ce1c,_0x5a0577,_0x47bed9){return db[_0xc48a('0xb7')][_0xc48a('0x69')]({'where':{'id':_0x30ce1c[_0xc48a('0xb1')]['id']}})[_0xc48a('0x2a')](handleEntityNotFound(_0x5a0577,null))[_0xc48a('0x2a')](function(_0x5cbac9){if(_0x5cbac9){return _0x5cbac9[_0xc48a('0xb8')](_0x30ce1c['body'][_0xc48a('0xb9')],_[_0xc48a('0xba')](_0x30ce1c['body'],[_0xc48a('0xb9'),'id'])||{});}})[_0xc48a('0x2a')](respondWithResult(_0x5a0577,null))[_0xc48a('0x36')](handleError(_0x5a0577,null));};exports[_0xc48a('0xbb')]=function(_0x482fa7,_0x5db687,_0xe08851){var _0x567e84={'raw':![],'where':{}};var _0x493cf0={};var _0x3c2f8d={'count':0x0,'rows':[]};return db[_0xc48a('0x38')][_0xc48a('0xbc')]({'where':{'id':_0x482fa7['params']['id']}})[_0xc48a('0x2a')](handleEntityNotFound(_0x5db687,null))['then'](function(_0x35b877){if(_0x35b877){_0x493cf0[_0xc48a('0x3b')]=_[_0xc48a('0x75')](db[_0xc48a('0xb7')][_0xc48a('0xb2')]);_0x493cf0[_0xc48a('0x3d')]=_[_0xc48a('0x75')](_0x482fa7['query']);_0x493cf0[_0xc48a('0x3e')]=_['intersection'](_0x493cf0[_0xc48a('0x3b')],_0x493cf0[_0xc48a('0x3d')]);_0x567e84['attributes']=_['intersection'](_0x493cf0[_0xc48a('0x3b')],qs['fields'](_0x482fa7[_0xc48a('0x3d')][_0xc48a('0x41')]));_0x567e84[_0xc48a('0x40')]=_0x567e84[_0xc48a('0x40')]['length']?_0x567e84['attributes']:_0x493cf0[_0xc48a('0x3b')];if(!_0x482fa7[_0xc48a('0x3d')]['hasOwnProperty'](_0xc48a('0x43'))){_0x567e84[_0xc48a('0x22')]=qs['limit'](_0x482fa7[_0xc48a('0x3d')]['limit']);_0x567e84['offset']=qs[_0xc48a('0x20')](_0x482fa7[_0xc48a('0x3d')][_0xc48a('0x20')]);}_0x567e84['order']=qs[_0xc48a('0x45')](_0x482fa7[_0xc48a('0x3d')][_0xc48a('0x45')]);_0x567e84[_0xc48a('0x46')]=qs['filters'](_[_0xc48a('0x47')](_0x482fa7[_0xc48a('0x3d')],_0x493cf0['filters']));_0x567e84[_0xc48a('0x46')][_0xc48a('0xae')]=_0x35b877['id'];if(_0x482fa7[_0xc48a('0x3d')][_0xc48a('0x84')]){_0x567e84[_0xc48a('0x46')]=_[_0xc48a('0x9e')](_0x567e84['where'],{'$or':_[_0xc48a('0x3c')](_0x567e84['attributes'],function(_0x5e24c0){var _0x2fabb0={};_0x2fabb0[_0x5e24c0]={'$like':'%'+_0x482fa7['query']['filter']+'%'};return _0x2fabb0;})});}if(_0x482fa7[_0xc48a('0x3d')]['$gte']){var _0x116c70=_0x482fa7[_0xc48a('0x3d')]['$gte'][_0xc48a('0x32')](',');var _0x192f2d={};_0x192f2d[_0x116c70[0x0]]={'$gte':moment(_0x116c70[0x1])[_0xc48a('0xbd')](_0xc48a('0xbe'))};_0x567e84[_0xc48a('0x46')]=_[_0xc48a('0x9e')](_0x567e84['where'],_0x192f2d);}_0x567e84=_['merge']({},_0x567e84,_0x482fa7[_0xc48a('0xb4')]);return db['SmsMessage'][_0xc48a('0x23')]({'where':_0x567e84[_0xc48a('0x46')]})[_0xc48a('0x2a')](function(_0x2d3dbc){_0x3c2f8d[_0xc48a('0x23')]=_0x2d3dbc;if(_0x482fa7[_0xc48a('0x3d')]['includeAll']){_0x567e84[_0xc48a('0xbf')]=[{'all':!![]}];}return db[_0xc48a('0xb7')][_0xc48a('0xc0')](_0x567e84);})[_0xc48a('0x2a')](function(_0x19c5ea){_0x3c2f8d[_0xc48a('0xaf')]=_0x19c5ea;return _0x3c2f8d;});}})['then'](respondWithFilteredResult(_0x5db687,_0x567e84))[_0xc48a('0x36')](handleError(_0x5db687,null));};exports[_0xc48a('0xc1')]=function(_0x207549,_0x4a8742,_0x5eb646){return db[_0xc48a('0x38')][_0xc48a('0x69')]({'where':{'id':_0x207549['params']['id']}})[_0xc48a('0x2a')](handleEntityNotFound(_0x4a8742,null))['then'](function(_0x14fb3b){if(_0x14fb3b){return _0x14fb3b[_0xc48a('0xc2')](_0x207549[_0xc48a('0x73')][_0xc48a('0xb9')],_[_0xc48a('0xba')](_0x207549[_0xc48a('0x73')],[_0xc48a('0xb9'),'id'])||{})[_0xc48a('0xc3')](function(){return db[_0xc48a('0x6d')][_0xc48a('0xc0')]({'attributes':['id',_0xc48a('0x2d'),_0xc48a('0x4a')],'where':{'id':_0x207549[_0xc48a('0x73')][_0xc48a('0xb9')]}});})['then'](function(_0x141a14){socket['emit'](_0xc48a('0xc4'),{'id':Number(_0x207549[_0xc48a('0xb1')]['id']),'tags':_0x141a14||[]});return{'id':Number(_0x207549[_0xc48a('0xb1')]['id']),'tags':_0x141a14||[]};});}})['then'](respondWithResult(_0x4a8742,null))[_0xc48a('0x36')](handleError(_0x4a8742,null));};exports[_0xc48a('0xc5')]=function(_0x3b1292,_0x50c285,_0x5bd66f){return db[_0xc48a('0x38')][_0xc48a('0x69')]({'where':{'id':_0x3b1292[_0xc48a('0xb1')]['id']}})['then'](handleEntityNotFound(_0x50c285,null))[_0xc48a('0x2a')](function(_0x5ba39e){if(_0x5ba39e){return _0x5ba39e[_0xc48a('0xc5')](_0x3b1292[_0xc48a('0x3d')][_0xc48a('0xb9')]);}})['then'](respondWithStatusCode(_0x50c285,null))[_0xc48a('0x36')](handleError(_0x50c285,null));};exports['download']=function(_0x5bdf45,_0x331f00){var _0x4c3d33=moment()[_0xc48a('0xc6')]()['toString']();var _0x497330=path[_0xc48a('0xc7')](config['root'],_0xc48a('0xc8'),_0xc48a('0xc9'),_0xc48a('0xca'));var _0x232c6f=path[_0xc48a('0xc7')](config['root'],_0xc48a('0xc8'),'files',_0xc48a('0xcb'));var _0x37c5de=path[_0xc48a('0xc7')](_0x497330,_0x4c3d33);var _0x5c5f7c=util[_0xc48a('0xbd')](_0xc48a('0xcc'),_0x5bdf45[_0xc48a('0xb1')]['id'],_0x4c3d33);var _0x4d91bd=path[_0xc48a('0xc7')](_0x497330,_0x5c5f7c);var _0x4cccb5=[];_0x4cccb5[_0xc48a('0x35')]({'model':db[_0xc48a('0x6f')],'as':_0xc48a('0x6f'),'attributes':['id',_0xc48a('0x30')],'raw':!![]});_0x4cccb5['push']({'model':db[_0xc48a('0xcd')],'as':_0xc48a('0x65'),'attributes':['id','firstName','lastName'],'raw':!![]});var _0x30dcbb=[{'model':db[_0xc48a('0xb7')],'as':_0xc48a('0xce'),'attributes':['id',_0xc48a('0x73'),'createdAt',_0xc48a('0xcf'),_0xc48a('0xd0'),_0xc48a('0x82')],'include':_0x4cccb5}];_0x30dcbb[_0xc48a('0x35')]({'model':db[_0xc48a('0xd1')],'as':_0xc48a('0xd2'),'attributes':['id',_0xc48a('0x2d')]});_0x30dcbb[_0xc48a('0x35')]({'model':db[_0xc48a('0x6f')],'as':'Owner','attributes':['id','fullname']});return db[_0xc48a('0x38')]['find']({'where':{'id':_0x5bdf45[_0xc48a('0xb1')]['id']},'include':_0x30dcbb})[_0xc48a('0x2a')](handleEntityNotFound(_0x331f00,null))[_0xc48a('0x2a')](function(_0x55034f){if(_0x55034f){var _0x229dd3=_0x55034f[_0xc48a('0xd3')]({'plain':!![]});fs[_0xc48a('0xd4')](_0x37c5de);var _0x230c03={'channel':_0xc48a('0xd5'),'account':_0x229dd3[_0xc48a('0xd2')]['name'],'agent':_0x229dd3[_0xc48a('0xd6')]?_0x229dd3[_0xc48a('0xd6')]['fullname']:'N.A.','createdAt':moment(_0x229dd3[_0xc48a('0x7b')])[_0xc48a('0xbd')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x229dd3['closed']?moment(_0x229dd3['closedAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x229dd3[_0xc48a('0xd7')],'messages':_(_0x229dd3[_0xc48a('0xce')])[_0xc48a('0x84')]({'secret':![]})[_0xc48a('0x3c')](function(_0x2463a8){return{'date':moment(_0x2463a8['createdAt'])['format'](_0xc48a('0xbe'))[_0xc48a('0x9c')](),'sender':_0x2463a8[_0xc48a('0xcf')]==='out'?_0x2463a8[_0xc48a('0x6f')]?_0x2463a8[_0xc48a('0x6f')][_0xc48a('0x30')]:_0xc48a('0xd8'):_0x2463a8[_0xc48a('0x65')][_0xc48a('0xd9')]+(_0x2463a8[_0xc48a('0x65')][_0xc48a('0xda')]?'\x20'+_0x2463a8['Contact'][_0xc48a('0xda')]:''),'body':_0x2463a8[_0xc48a('0x73')],'direction':_0x2463a8[_0xc48a('0xcf')]===_0xc48a('0xdb')?'A':'C','secret':_0x2463a8[_0xc48a('0xd0')],'read':_0x2463a8[_0xc48a('0x82')]};})['value']()};return ejs[_0xc48a('0xdc')](path[_0xc48a('0xc7')](config[_0xc48a('0xdd')],_0xc48a('0xc8'),_0xc48a('0xde'),'downloadInteraction.ejs'),{'interaction':_0x230c03})[_0xc48a('0x2a')](function(_0x4799ba){var _0x321424=path[_0xc48a('0xc7')](_0x37c5de,_0xc48a('0xdf')+_0x229dd3['id']+'-'+_0x4c3d33+_0xc48a('0xe0'));var _0x3190a3={'path':_0x321424,'channel':_0xc48a('0xd5'),'interactionId':_0x229dd3['id']};return pdf[_0xc48a('0xe1')](_0x4799ba,_0x3190a3);})[_0xc48a('0x2a')](function(){return new BPromise(function(_0x4aa65f,_0x19e967){zipdir(_0x37c5de,{'saveTo':_0x4d91bd},function(_0x2d678f,_0x84495f){if(_0x2d678f)return _0x19e967(_0x2d678f);return _0x4aa65f(_0x84495f);});})[_0xc48a('0x2a')](function(){return new BPromise(function(_0x51fced,_0x3d4013){rimraf(_0x37c5de,function(_0x29a673){if(_0x29a673)_0x3d4013(_0x29a673);return _0x51fced();});});})[_0xc48a('0x2a')](function(){return _0x331f00[_0xc48a('0xe2')](_0x4d91bd,_0x5c5f7c,function(_0x1bb029){if(_0x1bb029){console[_0xc48a('0xe3')]('err',_0x1bb029);}else{fs[_0xc48a('0xe4')](_0x4d91bd);}});});});}else{return _0x331f00[_0xc48a('0x1d')](0xc8);}})[_0xc48a('0x36')](handleError(_0x331f00,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 95d618f..cee1b8f 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 _0x5c3c=['events','../../mysqldb','SmsInteraction','setMaxListeners','save','update','remove','getUsers','Users','map','findAll','then','setDataValue','unreadMessages','emit','catch','hook','exports'];(function(_0x4ce612,_0x2da0ff){var _0x109457=function(_0x2ab698){while(--_0x2ab698){_0x4ce612['push'](_0x4ce612['shift']());}};_0x109457(++_0x2da0ff);}(_0x5c3c,0x132));var _0xc5c3=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x5c3c[_0x5d4607];return _0x5e4a86;};'use strict';var EventEmitter=require(_0xc5c3('0x0'));var SmsInteraction=require(_0xc5c3('0x1'))['db'][_0xc5c3('0x2')];var SmsMessage=require(_0xc5c3('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xc5c3('0x3')](0x0);var events={'afterCreate':_0xc5c3('0x4'),'afterUpdate':_0xc5c3('0x5'),'afterDestroy':_0xc5c3('0x6')};function emitEvent(_0x2535e0){return function(_0x36525d,_0xe85098,_0x23a6b5){_0x36525d[_0xc5c3('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4b8404){_0x36525d['setDataValue'](_0xc5c3('0x8'),_0x4b8404[_0xc5c3('0x9')](function(_0x593b35){return{'id':_0x593b35['id']};}));return SmsMessage[_0xc5c3('0xa')]({'where':{'SmsInteractionId':_0x36525d['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc5c3('0xb')](function(_0x52f3eb){_0x36525d[_0xc5c3('0xc')](_0xc5c3('0xd'),_0x52f3eb['length']);SmsInteractionEvents[_0xc5c3('0xe')](_0x2535e0+':'+_0x36525d['id'],_0x36525d);SmsInteractionEvents[_0xc5c3('0xe')](_0x2535e0,_0x36525d);_0x23a6b5(null);})[_0xc5c3('0xf')](_0x23a6b5(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0xc5c3('0x10')](e,emitEvent(event));}}module[_0xc5c3('0x11')]=SmsInteractionEvents; \ No newline at end of file +var _0x36ee=['getUsers','then','Users','findAll','setDataValue','length','emit','catch','hasOwnProperty','hook','exports','SmsInteraction','SmsMessage','setMaxListeners','save','update','remove'];(function(_0x4e6292,_0x7f410a){var _0x10ed2a=function(_0x46ed5a){while(--_0x46ed5a){_0x4e6292['push'](_0x4e6292['shift']());}};_0x10ed2a(++_0x7f410a);}(_0x36ee,0xe8));var _0xe36e=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x36ee[_0x397e5f];return _0x5302b8;};'use strict';var EventEmitter=require('events');var SmsInteraction=require('../../mysqldb')['db'][_0xe36e('0x0')];var SmsMessage=require('../../mysqldb')['db'][_0xe36e('0x1')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xe36e('0x2')](0x0);var events={'afterCreate':_0xe36e('0x3'),'afterUpdate':_0xe36e('0x4'),'afterDestroy':_0xe36e('0x5')};function emitEvent(_0x1118af){return function(_0x29e692,_0x3f29e1,_0x25a07d){_0x29e692[_0xe36e('0x6')]({'attributes':['id'],'raw':!![]})[_0xe36e('0x7')](function(_0x1aa596){_0x29e692['setDataValue'](_0xe36e('0x8'),_0x1aa596['map'](function(_0x2236e9){return{'id':_0x2236e9['id']};}));return SmsMessage[_0xe36e('0x9')]({'where':{'SmsInteractionId':_0x29e692['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe36e('0x7')](function(_0x47ce3a){_0x29e692[_0xe36e('0xa')]('unreadMessages',_0x47ce3a[_0xe36e('0xb')]);SmsInteractionEvents[_0xe36e('0xc')](_0x1118af+':'+_0x29e692['id'],_0x29e692);SmsInteractionEvents[_0xe36e('0xc')](_0x1118af,_0x29e692);_0x25a07d(null);})[_0xe36e('0xd')](_0x25a07d(null));};}for(var e in events){if(events[_0xe36e('0xe')](e)){var event=events[e];SmsInteraction[_0xe36e('0xf')](e,emitEvent(event));}}module[_0xe36e('0x10')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index f39fbb0..8035f86 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 _0x77b8=['bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment'];(function(_0x20b4c9,_0x2afe53){var _0x5116d0=function(_0x5007af){while(--_0x5007af){_0x20b4c9['push'](_0x20b4c9['shift']());}};_0x5116d0(++_0x2afe53);}(_0x77b8,0x83));var _0x877b=function(_0x1e818b,_0x5b4d11){_0x1e818b=_0x1e818b-0x0;var _0x3fb087=_0x77b8[_0x1e818b];return _0x3fb087;};'use strict';var _=require('lodash');var util=require(_0x877b('0x0'));var logger=require(_0x877b('0x1'))(_0x877b('0x2'));var moment=require(_0x877b('0x3'));var BPromise=require(_0x877b('0x4'));var rp=require(_0x877b('0x5'));var fs=require('fs');var path=require(_0x877b('0x6'));var rimraf=require(_0x877b('0x7'));var config=require(_0x877b('0x8'));var attributes=require(_0x877b('0x9'));module[_0x877b('0xa')]=function(_0x399029,_0x582d21){return _0x399029['define']('SmsInteraction',attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x45b0d9,_0x546b31,_0x1e2bfa){if(_0x45b0d9[_0x877b('0xb')]('closed')){_0x45b0d9[_0x877b('0xc')]=moment()[_0x877b('0xd')](_0x877b('0xe'));}_0x1e2bfa(null,_0x45b0d9);}}});}; \ No newline at end of file +var _0xee69=['api','moment','bluebird','request-promise','path','rimraf','./smsInteraction.attributes','exports','define','SmsInteraction','changed','closed','closedAt','format','../../config/logger'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0xee69,0xc2));var _0x9ee6=function(_0x258d12,_0x5f3f24){_0x258d12=_0x258d12-0x0;var _0x44c718=_0xee69[_0x258d12];return _0x44c718;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9ee6('0x0'))(_0x9ee6('0x1'));var moment=require(_0x9ee6('0x2'));var BPromise=require(_0x9ee6('0x3'));var rp=require(_0x9ee6('0x4'));var fs=require('fs');var path=require(_0x9ee6('0x5'));var rimraf=require(_0x9ee6('0x6'));var config=require('../../config/environment');var attributes=require(_0x9ee6('0x7'));module[_0x9ee6('0x8')]=function(_0x2f0b0a,_0x577480){return _0x2f0b0a[_0x9ee6('0x9')](_0x9ee6('0xa'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x19fc51,_0x50c2d4,_0x1a866d){if(_0x19fc51[_0x9ee6('0xb')](_0x9ee6('0xc'))){_0x19fc51[_0x9ee6('0xd')]=moment()[_0x9ee6('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x1a866d(null,_0x19fc51);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index cf94575..0df6d0d 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 _0x57c4=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','info','SmsInteraction,\x20%s,\x20%s','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','SmsInteraction','update','raw','options','where','attributes','UpdateSmsInteraction','debug','AddTagsToSmsInteraction','find','addTags','body','ids','omit','spread','AddTags','lodash'];(function(_0x448d1f,_0x4d00aa){var _0x13cbdb=function(_0x2a1bd5){while(--_0x2a1bd5){_0x448d1f['push'](_0x448d1f['shift']());}};_0x13cbdb(++_0x4d00aa);}(_0x57c4,0x182));var _0x457c=function(_0x5695dd,_0x5ad219){_0x5695dd=_0x5695dd-0x0;var _0x37b684=_0x57c4[_0x5695dd];return _0x37b684;};'use strict';var _=require(_0x457c('0x0'));var util=require(_0x457c('0x1'));var moment=require(_0x457c('0x2'));var BPromise=require(_0x457c('0x3'));var rs=require(_0x457c('0x4'));var fs=require('fs');var Redis=require(_0x457c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x457c('0x6'));var logger=require(_0x457c('0x7'))('rpc');var config=require(_0x457c('0x8'));var jayson=require(_0x457c('0x9'));var client=jayson[_0x457c('0xa')][_0x457c('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x457c('0xc')],{'host':_0x457c('0xd'),'port':0x18eb});var socket=require(_0x457c('0xe'))(new Redis(config[_0x457c('0xc')]));require('./smsInteraction.socket')[_0x457c('0xf')](socket);function respondWithRpcPromise(_0x26ebe9,_0x524eed,_0x304387){return new BPromise(function(_0x5bf57e,_0x11efa9){return client[_0x457c('0x10')](_0x26ebe9,_0x304387)[_0x457c('0x11')](function(_0x598717){logger[_0x457c('0x12')](_0x457c('0x13'),_0x524eed,'request\x20sent');logger['debug'](_0x457c('0x14'),_0x524eed,_0x457c('0x15'),JSON[_0x457c('0x16')](_0x598717));if(_0x598717[_0x457c('0x17')]){if(_0x598717[_0x457c('0x17')]['code']===0x1f4){logger[_0x457c('0x17')]('SmsInteraction,\x20%s,\x20%s',_0x524eed,_0x598717[_0x457c('0x17')][_0x457c('0x18')]);return _0x11efa9(_0x598717[_0x457c('0x17')][_0x457c('0x18')]);}logger['error']('SmsInteraction,\x20%s,\x20%s',_0x524eed,_0x598717[_0x457c('0x17')][_0x457c('0x18')]);return _0x5bf57e(_0x598717[_0x457c('0x17')][_0x457c('0x18')]);}else{logger[_0x457c('0x12')]('SmsInteraction,\x20%s,\x20%s',_0x524eed,_0x457c('0x15'));_0x5bf57e(_0x598717[_0x457c('0x19')]['message']);}})[_0x457c('0x1a')](function(_0x5ea97b){logger[_0x457c('0x17')](_0x457c('0x13'),_0x524eed,_0x5ea97b);_0x11efa9(_0x5ea97b);});});}exports['UpdateSmsInteraction']=function(_0x445636){var _0x3f22e3=this;return new Promise(function(_0x3baaab,_0x2a37dd){return db[_0x457c('0x1b')][_0x457c('0x1c')](_0x445636['body'],{'raw':_0x445636['options']?_0x445636['options'][_0x457c('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x445636[_0x457c('0x1e')]?_0x445636[_0x457c('0x1e')][_0x457c('0x1f')]||null:null,'attributes':_0x445636[_0x457c('0x1e')]?_0x445636[_0x457c('0x1e')][_0x457c('0x20')]||null:null,'limit':_0x445636[_0x457c('0x1e')]?_0x445636[_0x457c('0x1e')]['limit']||null:null})[_0x457c('0x11')](function(_0x5dc65a){logger[_0x457c('0x12')](_0x457c('0x21'),_0x445636);logger[_0x457c('0x22')](_0x457c('0x21'),_0x445636,JSON[_0x457c('0x16')](_0x5dc65a));_0x3baaab(_0x5dc65a);})[_0x457c('0x1a')](function(_0x254fd5){logger[_0x457c('0x17')]('UpdateSmsInteraction',_0x254fd5[_0x457c('0x18')],_0x445636);_0x2a37dd(_0x3f22e3[_0x457c('0x17')](0x1f4,_0x254fd5[_0x457c('0x18')]));});});};exports[_0x457c('0x23')]=function(_0x25a352){return new Promise(function(_0x4dfb06,_0x1bcc6a){return db[_0x457c('0x1b')][_0x457c('0x24')]({'where':_0x25a352[_0x457c('0x1e')]?_0x25a352[_0x457c('0x1e')][_0x457c('0x1f')]||null:null})[_0x457c('0x11')](function(_0x41e645){if(_0x41e645){return _0x41e645[_0x457c('0x25')](_0x25a352[_0x457c('0x26')][_0x457c('0x27')],_[_0x457c('0x28')](_0x25a352['body'],[_0x457c('0x27'),'id'])||{});}})[_0x457c('0x29')](function(_0x5da587){logger[_0x457c('0x12')](_0x457c('0x2a'),_0x25a352);logger['debug'](_0x457c('0x2a'),_0x25a352,JSON[_0x457c('0x16')](_0x5da587));_0x4dfb06(_0x5da587);})[_0x457c('0x1a')](function(_0x447225){logger[_0x457c('0x17')](_0x457c('0x2a'),_0x447225[_0x457c('0x18')],_0x25a352);_0x1bcc6a(_this[_0x457c('0x17')](0x1f4,_0x447225[_0x457c('0x18')]));});});}; \ No newline at end of file +var _0xfe7c=['code','message','info','UpdateSmsInteraction','SmsInteraction','body','options','attributes','catch','find','ids','spread','AddTags','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','then','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1e4a8e,_0x18022b){var _0x5408f9=function(_0x4ef2ed){while(--_0x4ef2ed){_0x1e4a8e['push'](_0x1e4a8e['shift']());}};_0x5408f9(++_0x18022b);}(_0xfe7c,0x1ed));var _0xcfe7=function(_0x6e14fd,_0x1c408f){_0x6e14fd=_0x6e14fd-0x0;var _0x4b024a=_0xfe7c[_0x6e14fd];return _0x4b024a;};'use strict';var _=require('lodash');var util=require(_0xcfe7('0x0'));var moment=require(_0xcfe7('0x1'));var BPromise=require(_0xcfe7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcfe7('0x3'));var db=require(_0xcfe7('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xcfe7('0x5'));var config=require(_0xcfe7('0x6'));var jayson=require(_0xcfe7('0x7'));var client=jayson[_0xcfe7('0x8')]['http']({'port':0x232a});config['redis']=_[_0xcfe7('0x9')](config[_0xcfe7('0xa')],{'host':_0xcfe7('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcfe7('0xa')]));require('./smsInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x57bde9,_0xc38188,_0x2a839f){return new BPromise(function(_0x29a2b1,_0x509171){return client['request'](_0x57bde9,_0x2a839f)[_0xcfe7('0xc')](function(_0x1e0510){logger['info'](_0xcfe7('0xd'),_0xc38188,_0xcfe7('0xe'));logger[_0xcfe7('0xf')](_0xcfe7('0x10'),_0xc38188,_0xcfe7('0xe'),JSON[_0xcfe7('0x11')](_0x1e0510));if(_0x1e0510['error']){if(_0x1e0510[_0xcfe7('0x12')][_0xcfe7('0x13')]===0x1f4){logger['error']('SmsInteraction,\x20%s,\x20%s',_0xc38188,_0x1e0510[_0xcfe7('0x12')]['message']);return _0x509171(_0x1e0510[_0xcfe7('0x12')][_0xcfe7('0x14')]);}logger[_0xcfe7('0x12')]('SmsInteraction,\x20%s,\x20%s',_0xc38188,_0x1e0510[_0xcfe7('0x12')][_0xcfe7('0x14')]);return _0x29a2b1(_0x1e0510[_0xcfe7('0x12')][_0xcfe7('0x14')]);}else{logger[_0xcfe7('0x15')](_0xcfe7('0xd'),_0xc38188,_0xcfe7('0xe'));_0x29a2b1(_0x1e0510['result'][_0xcfe7('0x14')]);}})['catch'](function(_0x312ad5){logger[_0xcfe7('0x12')](_0xcfe7('0xd'),_0xc38188,_0x312ad5);_0x509171(_0x312ad5);});});}exports[_0xcfe7('0x16')]=function(_0x4b3506){var _0x2fb0d8=this;return new Promise(function(_0x1e12af,_0x3793be){return db[_0xcfe7('0x17')]['update'](_0x4b3506[_0xcfe7('0x18')],{'raw':_0x4b3506[_0xcfe7('0x19')]?_0x4b3506['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b3506[_0xcfe7('0x19')]?_0x4b3506[_0xcfe7('0x19')]['where']||null:null,'attributes':_0x4b3506['options']?_0x4b3506[_0xcfe7('0x19')][_0xcfe7('0x1a')]||null:null,'limit':_0x4b3506[_0xcfe7('0x19')]?_0x4b3506['options']['limit']||null:null})['then'](function(_0x4c1b89){logger[_0xcfe7('0x15')]('UpdateSmsInteraction',_0x4b3506);logger[_0xcfe7('0xf')](_0xcfe7('0x16'),_0x4b3506,JSON[_0xcfe7('0x11')](_0x4c1b89));_0x1e12af(_0x4c1b89);})[_0xcfe7('0x1b')](function(_0x28d79a){logger[_0xcfe7('0x12')](_0xcfe7('0x16'),_0x28d79a[_0xcfe7('0x14')],_0x4b3506);_0x3793be(_0x2fb0d8[_0xcfe7('0x12')](0x1f4,_0x28d79a[_0xcfe7('0x14')]));});});};exports['AddTagsToSmsInteraction']=function(_0x2ffaf5){return new Promise(function(_0x172402,_0x2dca26){return db[_0xcfe7('0x17')][_0xcfe7('0x1c')]({'where':_0x2ffaf5[_0xcfe7('0x19')]?_0x2ffaf5[_0xcfe7('0x19')]['where']||null:null})[_0xcfe7('0xc')](function(_0x4b6c50){if(_0x4b6c50){return _0x4b6c50['addTags'](_0x2ffaf5[_0xcfe7('0x18')][_0xcfe7('0x1d')],_['omit'](_0x2ffaf5[_0xcfe7('0x18')],[_0xcfe7('0x1d'),'id'])||{});}})[_0xcfe7('0x1e')](function(_0x2adc8b){logger[_0xcfe7('0x15')](_0xcfe7('0x1f'),_0x2ffaf5);logger[_0xcfe7('0xf')]('AddTags',_0x2ffaf5,JSON[_0xcfe7('0x11')](_0x2adc8b));_0x172402(_0x2adc8b);})[_0xcfe7('0x1b')](function(_0x40d3da){logger[_0xcfe7('0x12')](_0xcfe7('0x1f'),_0x40d3da[_0xcfe7('0x14')],_0x2ffaf5);_0x2dca26(_this[_0xcfe7('0x12')](0x1f4,_0x40d3da[_0xcfe7('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index dfd2d4c..0dcb178 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 _0xed62=['update','emit','removeListener','register','length','./smsInteraction.events','save'];(function(_0x15a4bc,_0x59bd7a){var _0x206fb6=function(_0x232372){while(--_0x232372){_0x15a4bc['push'](_0x15a4bc['shift']());}};_0x206fb6(++_0x59bd7a);}(_0xed62,0x8a));var _0x2ed6=function(_0x3314aa,_0x40cdb5){_0x3314aa=_0x3314aa-0x0;var _0x34ed53=_0xed62[_0x3314aa];return _0x34ed53;};'use strict';var SmsInteractionEvents=require(_0x2ed6('0x0'));var events=[_0x2ed6('0x1'),'remove',_0x2ed6('0x2')];function createListener(_0x125c01,_0x25bb12){return function(_0x8483f4){_0x25bb12[_0x2ed6('0x3')](_0x125c01,_0x8483f4);};}function removeListener(_0x44dc01,_0x3b9d54){return function(){SmsInteractionEvents[_0x2ed6('0x4')](_0x44dc01,_0x3b9d54);};}exports[_0x2ed6('0x5')]=function(_0x732702){for(var _0x4378f9=0x0,_0x9092ef=events[_0x2ed6('0x6')];_0x4378f9<_0x9092ef;_0x4378f9++){var _0x5871f9=events[_0x4378f9];var _0x220488=createListener('smsInteraction:'+_0x5871f9,_0x732702);SmsInteractionEvents['on'](_0x5871f9,_0x220488);}}; \ No newline at end of file +var _0x1e7f=['length','smsInteraction:','./smsInteraction.events','save','remove','emit','removeListener'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x1e7f,0x64));var _0xf1e7=function(_0x1d8293,_0x18621a){_0x1d8293=_0x1d8293-0x0;var _0x6723fe=_0x1e7f[_0x1d8293];return _0x6723fe;};'use strict';var SmsInteractionEvents=require(_0xf1e7('0x0'));var events=[_0xf1e7('0x1'),_0xf1e7('0x2'),'update'];function createListener(_0x2b390a,_0x57ba6c){return function(_0x552633){_0x57ba6c[_0xf1e7('0x3')](_0x2b390a,_0x552633);};}function removeListener(_0x3d82a7,_0x5c2fbf){return function(){SmsInteractionEvents[_0xf1e7('0x4')](_0x3d82a7,_0x5c2fbf);};}exports['register']=function(_0x39a344){for(var _0x2536e8=0x0,_0x3736dc=events[_0xf1e7('0x5')];_0x2536e8<_0x3736dc;_0x2536e8++){var _0x3ae6aa=events[_0x2536e8];var _0x34d736=createListener(_0xf1e7('0x6')+_0x3ae6aa,_0x39a344);SmsInteractionEvents['on'](_0x3ae6aa,_0x34d736);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 552f10f..3302452 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 _0xf4d6=['index','get','/:id','show','post','tracked','smsmessage:create','create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','isAuthenticated'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0xf4d6,0xc6));var _0x6f4d=function(_0x2becd6,_0x2f2736){_0x2becd6=_0x2becd6-0x0;var _0x441866=_0xf4d6[_0x2becd6];return _0x441866;};'use strict';var multer=require(_0x6f4d('0x0'));var util=require(_0x6f4d('0x1'));var path=require(_0x6f4d('0x2'));var timeout=require(_0x6f4d('0x3'));var express=require(_0x6f4d('0x4'));var router=express[_0x6f4d('0x5')]();var fs_extra=require(_0x6f4d('0x6'));var auth=require(_0x6f4d('0x7'));var interaction=require(_0x6f4d('0x8'));var config=require(_0x6f4d('0x9'));var controller=require(_0x6f4d('0xa'));router['get']('/',auth[_0x6f4d('0xb')](),controller[_0x6f4d('0xc')]);router[_0x6f4d('0xd')]('/describe',auth[_0x6f4d('0xb')](),controller['describe']);router[_0x6f4d('0xd')](_0x6f4d('0xe'),auth[_0x6f4d('0xb')](),controller[_0x6f4d('0xf')]);router[_0x6f4d('0x10')]('/',auth[_0x6f4d('0xb')](),interaction[_0x6f4d('0x11')]('sms',_0x6f4d('0x12')),controller[_0x6f4d('0x13')]);router[_0x6f4d('0x10')](_0x6f4d('0x14'),controller[_0x6f4d('0x15')]);router[_0x6f4d('0x16')]('/:id',auth[_0x6f4d('0xb')](),controller[_0x6f4d('0x17')]);router[_0x6f4d('0x16')](_0x6f4d('0x18'),auth[_0x6f4d('0xb')](),controller[_0x6f4d('0x19')]);router[_0x6f4d('0x16')](_0x6f4d('0x1a'),auth[_0x6f4d('0xb')](),controller[_0x6f4d('0x1b')]);router['delete'](_0x6f4d('0xe'),auth[_0x6f4d('0xb')](),controller[_0x6f4d('0x1c')]);module[_0x6f4d('0x1d')]=router; \ No newline at end of file +var _0x5453=['accept','/:id/reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./smsMessage.controller','isAuthenticated','get','describe','/:id','show','post','tracked','sms','smsmessage:create','create','status','put'];(function(_0x2bb612,_0xaedf28){var _0x4ef64c=function(_0x45bcff){while(--_0x45bcff){_0x2bb612['push'](_0x2bb612['shift']());}};_0x4ef64c(++_0xaedf28);}(_0x5453,0x18b));var _0x3545=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x5453[_0x413feb];return _0x40ee88;};'use strict';var multer=require(_0x3545('0x0'));var util=require(_0x3545('0x1'));var path=require(_0x3545('0x2'));var timeout=require(_0x3545('0x3'));var express=require(_0x3545('0x4'));var router=express[_0x3545('0x5')]();var fs_extra=require(_0x3545('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3545('0x7'));var controller=require(_0x3545('0x8'));router['get']('/',auth[_0x3545('0x9')](),controller['index']);router[_0x3545('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x3545('0xb')]);router[_0x3545('0xa')](_0x3545('0xc'),auth['isAuthenticated'](),controller[_0x3545('0xd')]);router[_0x3545('0xe')]('/',auth[_0x3545('0x9')](),interaction[_0x3545('0xf')](_0x3545('0x10'),_0x3545('0x11')),controller[_0x3545('0x12')]);router['post']('/:id/status',controller[_0x3545('0x13')]);router[_0x3545('0x14')](_0x3545('0xc'),auth[_0x3545('0x9')](),controller['update']);router['put']('/:id/accept',auth[_0x3545('0x9')](),controller[_0x3545('0x15')]);router['put'](_0x3545('0x16'),auth['isAuthenticated'](),controller['reject']);router[_0x3545('0x17')](_0x3545('0xc'),auth['isAuthenticated'](),controller[_0x3545('0x18')]);module[_0x3545('0x19')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 47b5951..48c8633 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 _0x79e5=['sequelize','TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x4f096e,_0x30d3c3){var _0x4a33ce=function(_0x107ba6){while(--_0x107ba6){_0x4f096e['push'](_0x4f096e['shift']());}};_0x4a33ce(++_0x30d3c3);}(_0x79e5,0x170));var _0x579e=function(_0x497f2a,_0x563b7d){_0x497f2a=_0x497f2a-0x0;var _0x5359e4=_0x79e5[_0x497f2a];return _0x5359e4;};'use strict';var Sequelize=require(_0x579e('0x0'));module['exports']={'body':{'type':Sequelize[_0x579e('0x1')](_0x579e('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x579e('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x579e('0x4')]('in','out'),'defaultValue':_0x579e('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x579e('0x6')](0xbe)},'phone':{'type':Sequelize[_0x579e('0x6')]},'readAt':{'type':Sequelize[_0x579e('0x7')]},'secret':{'type':Sequelize[_0x579e('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x579e('0x1')]}}; \ No newline at end of file +var _0x475c=['STRING','DATE','sequelize','exports','TEXT','medium','BOOLEAN','out'];(function(_0x41d009,_0x12cbee){var _0x476bbc=function(_0x1e22ad){while(--_0x1e22ad){_0x41d009['push'](_0x41d009['shift']());}};_0x476bbc(++_0x12cbee);}(_0x475c,0x1da));var _0xc475=function(_0x1f0c3c,_0x3f22ac){_0x1f0c3c=_0x1f0c3c-0x0;var _0x123160=_0x475c[_0x1f0c3c];return _0x123160;};'use strict';var Sequelize=require(_0xc475('0x0'));module[_0xc475('0x1')]={'body':{'type':Sequelize[_0xc475('0x2')](_0xc475('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xc475('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xc475('0x5')),'defaultValue':_0xc475('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xc475('0x6')](0xbe)},'phone':{'type':Sequelize[_0xc475('0x6')]},'readAt':{'type':Sequelize[_0xc475('0x7')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0xc475('0x6')]},'providerResponse':{'type':Sequelize[_0xc475('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index d57130a..8597521 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 _0xa3be=['indexOf','sent','delivered','SmsAccount,\x20%s,\x20%s,\x20%s','infobip','results','eml-format','rimraf','zip-dir','moment','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','socket.io-emitter','./smsMessage.socket','jayson/promise','client','http','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','status','end','json','limit','undefined','count','offset','apply','reject','save','update','destroy','sendStatus','stack','name','send','map','SmsMessage','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL','include','rows','catch','show','params','rawAttributes','includeAll','options','find','create','body','describe','sms-interactions','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','SmsInteraction','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','User','fullname','email','internal','manual','interface','SIP/%s','channel','accept','EventManager','get','SmsInteractionId','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT','rejectmessage','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','plivo','MessageUUID'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0xa3be,0x97));var _0xea3b=function(_0x24cf30,_0x3ecf9d){_0x24cf30=_0x24cf30-0x0;var _0x4f9168=_0xa3be[_0x24cf30];return _0x4f9168;};'use strict';var emlformat=require(_0xea3b('0x0'));var rimraf=require(_0xea3b('0x1'));var zipdir=require(_0xea3b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xea3b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xea3b('0x4'));var util=require(_0xea3b('0x5'));var path=require('path');var sox=require(_0xea3b('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xea3b('0x7'));var _=require(_0xea3b('0x8'));var squel=require(_0xea3b('0x9'));var crypto=require(_0xea3b('0xa'));var jsforce=require(_0xea3b('0xb'));var deskjs=require(_0xea3b('0xc'));var toCsv=require(_0xea3b('0xd'));var querystring=require(_0xea3b('0xe'));var Papa=require(_0xea3b('0xf'));var Redis=require(_0xea3b('0x10'));var authService=require(_0xea3b('0x11'));var qs=require(_0xea3b('0x12'));var as=require(_0xea3b('0x13'));var hardwareService=require(_0xea3b('0x14'));var logger=require(_0xea3b('0x15'))(_0xea3b('0x16'));var utils=require(_0xea3b('0x17'));var config=require(_0xea3b('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xea3b('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xea3b('0x1a'))(new Redis(config[_0xea3b('0x19')]));require(_0xea3b('0x1b'))['register'](socket);var jayson=require(_0xea3b('0x1c'));var client=jayson[_0xea3b('0x1d')][_0xea3b('0x1e')]({'port':0x232c});var client9002=jayson[_0xea3b('0x1d')][_0xea3b('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x1e077f,_0x2f1454,_0x4a97eb,_0x53b974){return new BPromise(function(_0x2451fe,_0x5f1f65){var _0x4ed643=_0x53b974||client;return _0x4ed643['request'](_0x1e077f,_0x4a97eb)[_0xea3b('0x1f')](function(_0x2711c9){logger[_0xea3b('0x20')](_0xea3b('0x21'),_0x2f1454,_0xea3b('0x22'));logger[_0xea3b('0x23')](_0xea3b('0x24'),_0x2f1454,_0xea3b('0x22'),JSON[_0xea3b('0x25')](_0x2711c9));if(_0x2711c9['error']){if(_0x2711c9[_0xea3b('0x26')][_0xea3b('0x27')]===0x1f4){logger[_0xea3b('0x26')](_0xea3b('0x21'),_0x2f1454,_0x2711c9[_0xea3b('0x26')][_0xea3b('0x28')]);return _0x5f1f65(_0x2711c9['error'][_0xea3b('0x28')]);}logger['error'](_0xea3b('0x21'),_0x2f1454,_0x2711c9[_0xea3b('0x26')]['message']);return _0x2451fe(_0x2711c9[_0xea3b('0x26')][_0xea3b('0x28')]);}else{logger[_0xea3b('0x20')]('SmsMessage,\x20%s,\x20%s',_0x2f1454,_0xea3b('0x22'));_0x2451fe(_0x2711c9['result'][_0xea3b('0x28')]);}})['catch'](function(_0x2c0636){logger[_0xea3b('0x26')](_0xea3b('0x21'),_0x2f1454,_0x2c0636);_0x5f1f65(_0x2c0636);});});}function respondWithStatusCode(_0x10a1e2,_0x2452e2){_0x2452e2=_0x2452e2||0xcc;return function(_0x34f93a){if(_0x34f93a){return _0x10a1e2['sendStatus'](_0x2452e2);}return _0x10a1e2[_0xea3b('0x29')](_0x2452e2)[_0xea3b('0x2a')]();};}function respondWithResult(_0x3398de,_0x2aa263){_0x2aa263=_0x2aa263||0xc8;return function(_0x344292){if(_0x344292){return _0x3398de['status'](_0x2aa263)[_0xea3b('0x2b')](_0x344292);}};}function respondWithFilteredResult(_0x5cb762,_0x4551ad){return function(_0x35a837){if(_0x35a837){var _0x2ca480=typeof _0x4551ad['offset']==='undefined'&&typeof _0x4551ad[_0xea3b('0x2c')]===_0xea3b('0x2d');var _0x30e151=_0x35a837[_0xea3b('0x2e')];var _0x48e5f5=_0x2ca480?0x0:_0x4551ad[_0xea3b('0x2f')];var _0x4c154d=_0x2ca480?_0x35a837[_0xea3b('0x2e')]:_0x4551ad['offset']+_0x4551ad['limit'];var _0x3b6871;if(_0x4c154d>=_0x30e151){_0x4c154d=_0x30e151;_0x3b6871=0xc8;}else{_0x3b6871=0xce;}_0x5cb762[_0xea3b('0x29')](_0x3b6871);return _0x5cb762['set']('Content-Range',_0x48e5f5+'-'+_0x4c154d+'/'+_0x30e151)[_0xea3b('0x2b')](_0x35a837);}return null;};}function patchUpdates(_0x27e5fb){return function(_0x58c7e3){try{jsonpatch[_0xea3b('0x30')](_0x58c7e3,_0x27e5fb,!![]);}catch(_0x193a3a){return BPromise[_0xea3b('0x31')](_0x193a3a);}return _0x58c7e3[_0xea3b('0x32')]();};}function saveUpdates(_0x3fa321,_0x207f0c){return function(_0x354bb7){if(_0x354bb7){return _0x354bb7[_0xea3b('0x33')](_0x3fa321)[_0xea3b('0x1f')](function(_0x4b5673){return _0x4b5673;});}return null;};}function removeEntity(_0x49ee13,_0x24281b){return function(_0x2942d0){if(_0x2942d0){return _0x2942d0[_0xea3b('0x34')]()['then'](function(){_0x49ee13['status'](0xcc)[_0xea3b('0x2a')]();});}};}function handleEntityNotFound(_0x1c5520,_0x5e82ca){return function(_0xe410bf){if(!_0xe410bf){_0x1c5520[_0xea3b('0x35')](0x194);}return _0xe410bf;};}function handleError(_0x196187,_0x94e5cb){_0x94e5cb=_0x94e5cb||0x1f4;return function(_0x54132d){logger[_0xea3b('0x26')](_0x54132d[_0xea3b('0x36')]);if(_0x54132d[_0xea3b('0x37')]){delete _0x54132d[_0xea3b('0x37')];}_0x196187[_0xea3b('0x29')](_0x94e5cb)[_0xea3b('0x38')](_0x54132d);};}exports['index']=function(_0x4353c0,_0x1937e9){var _0x4dffe1={},_0x72de71={},_0x5e107a={'count':0x0,'rows':[]};var _0x1c4ba4=_[_0xea3b('0x39')](db[_0xea3b('0x3a')]['rawAttributes'],function(_0x1cc1ac){return{'name':_0x1cc1ac[_0xea3b('0x3b')],'type':_0x1cc1ac['type'][_0xea3b('0x3c')]};});_0x72de71[_0xea3b('0x3d')]=_['map'](_0x1c4ba4,'name');_0x72de71[_0xea3b('0x3e')]=_[_0xea3b('0x3f')](_0x4353c0[_0xea3b('0x3e')]);_0x72de71['filters']=_[_0xea3b('0x40')](_0x72de71[_0xea3b('0x3d')],_0x72de71[_0xea3b('0x3e')]);_0x4dffe1['attributes']=_[_0xea3b('0x40')](_0x72de71[_0xea3b('0x3d')],qs[_0xea3b('0x41')](_0x4353c0[_0xea3b('0x3e')][_0xea3b('0x41')]));_0x4dffe1[_0xea3b('0x42')]=_0x4dffe1[_0xea3b('0x42')][_0xea3b('0x43')]?_0x4dffe1[_0xea3b('0x42')]:_0x72de71[_0xea3b('0x3d')];if(!_0x4353c0[_0xea3b('0x3e')][_0xea3b('0x44')](_0xea3b('0x45'))){_0x4dffe1[_0xea3b('0x2c')]=qs[_0xea3b('0x2c')](_0x4353c0[_0xea3b('0x3e')][_0xea3b('0x2c')]);_0x4dffe1[_0xea3b('0x2f')]=qs['offset'](_0x4353c0[_0xea3b('0x3e')]['offset']);}_0x4dffe1[_0xea3b('0x46')]=qs[_0xea3b('0x47')](_0x4353c0[_0xea3b('0x3e')][_0xea3b('0x47')]);_0x4dffe1[_0xea3b('0x48')]=qs[_0xea3b('0x49')](_[_0xea3b('0x4a')](_0x4353c0[_0xea3b('0x3e')],_0x72de71['filters']),_0x1c4ba4);if(_0x4353c0[_0xea3b('0x3e')]['filter']){_0x4dffe1['where']=_[_0xea3b('0x4b')](_0x4dffe1['where'],{'$or':_[_0xea3b('0x39')](_0x1c4ba4,function(_0x3024ab){if(_0x3024ab[_0xea3b('0x4c')]!==_0xea3b('0x4d')){var _0x2e3eb0={};_0x2e3eb0[_0x3024ab[_0xea3b('0x37')]]={'$like':'%'+_0x4353c0[_0xea3b('0x3e')]['filter']+'%'};return _0x2e3eb0;}})});}_0x4dffe1=_[_0xea3b('0x4b')]({},_0x4dffe1,_0x4353c0['options']);var _0x5d72bc={'where':_0x4dffe1[_0xea3b('0x48')]};return db[_0xea3b('0x3a')]['count'](_0x5d72bc)[_0xea3b('0x1f')](function(_0x17703f){_0x5e107a[_0xea3b('0x2e')]=_0x17703f;if(_0x4353c0[_0xea3b('0x3e')]['includeAll']){_0x4dffe1[_0xea3b('0x4e')]=[{'all':!![]}];}return db[_0xea3b('0x3a')]['findAll'](_0x4dffe1);})[_0xea3b('0x1f')](function(_0x1a0b1b){_0x5e107a[_0xea3b('0x4f')]=_0x1a0b1b;return _0x5e107a;})[_0xea3b('0x1f')](respondWithFilteredResult(_0x1937e9,_0x4dffe1))[_0xea3b('0x50')](handleError(_0x1937e9,null));};exports[_0xea3b('0x51')]=function(_0x21a53f,_0x8dc462){var _0xe88787={'raw':!![],'where':{'id':_0x21a53f[_0xea3b('0x52')]['id']}},_0x379596={};_0x379596['model']=_[_0xea3b('0x3f')](db[_0xea3b('0x3a')][_0xea3b('0x53')]);_0x379596[_0xea3b('0x3e')]=_[_0xea3b('0x3f')](_0x21a53f['query']);_0x379596[_0xea3b('0x49')]=_[_0xea3b('0x40')](_0x379596['model'],_0x379596[_0xea3b('0x3e')]);_0xe88787['attributes']=_['intersection'](_0x379596[_0xea3b('0x3d')],qs[_0xea3b('0x41')](_0x21a53f[_0xea3b('0x3e')][_0xea3b('0x41')]));_0xe88787[_0xea3b('0x42')]=_0xe88787[_0xea3b('0x42')][_0xea3b('0x43')]?_0xe88787[_0xea3b('0x42')]:_0x379596[_0xea3b('0x3d')];if(_0x21a53f[_0xea3b('0x3e')][_0xea3b('0x54')]){_0xe88787[_0xea3b('0x4e')]=[{'all':!![]}];}_0xe88787=_[_0xea3b('0x4b')]({},_0xe88787,_0x21a53f[_0xea3b('0x55')]);return db[_0xea3b('0x3a')][_0xea3b('0x56')](_0xe88787)[_0xea3b('0x1f')](handleEntityNotFound(_0x8dc462,null))[_0xea3b('0x1f')](respondWithResult(_0x8dc462,null))[_0xea3b('0x50')](handleError(_0x8dc462,null));};exports[_0xea3b('0x57')]=function(_0x1c4fa4,_0xaf8b4b){return db[_0xea3b('0x3a')][_0xea3b('0x57')](_0x1c4fa4['body'],{})['then'](respondWithResult(_0xaf8b4b,0xc9))[_0xea3b('0x50')](handleError(_0xaf8b4b,null));};exports[_0xea3b('0x33')]=function(_0x5615f7,_0x5ac6c3){if(_0x5615f7[_0xea3b('0x58')]['id']){delete _0x5615f7[_0xea3b('0x58')]['id'];}return db['SmsMessage'][_0xea3b('0x56')]({'where':{'id':_0x5615f7[_0xea3b('0x52')]['id']}})[_0xea3b('0x1f')](handleEntityNotFound(_0x5ac6c3,null))[_0xea3b('0x1f')](saveUpdates(_0x5615f7[_0xea3b('0x58')],null))[_0xea3b('0x1f')](respondWithResult(_0x5ac6c3,null))[_0xea3b('0x50')](handleError(_0x5ac6c3,null));};exports[_0xea3b('0x34')]=function(_0x3dd5ff,_0x429cdd){return db[_0xea3b('0x3a')][_0xea3b('0x56')]({'where':{'id':_0x3dd5ff[_0xea3b('0x52')]['id']}})[_0xea3b('0x1f')](handleEntityNotFound(_0x429cdd,null))[_0xea3b('0x1f')](removeEntity(_0x429cdd,null))[_0xea3b('0x50')](handleError(_0x429cdd,null));};exports[_0xea3b('0x59')]=function(_0x3d604b,_0x4a159c){return db['SmsMessage']['describe']()[_0xea3b('0x1f')](respondWithResult(_0x4a159c,null))[_0xea3b('0x50')](handleError(_0x4a159c,null));};var interaction_log=require('../../config/logger')(_0xea3b('0x5a'));exports['accept']=function(_0x35e9bb,_0x44aa67,_0x27b8ef){var _0x8e6ce0={'agent':{},'channel':_0xea3b('0x5b')};if(_0x35e9bb['body']['id']){delete _0x35e9bb[_0xea3b('0x58')]['id'];}_0x35e9bb[_0xea3b('0x58')][_0xea3b('0x5c')]=!![];_0x35e9bb[_0xea3b('0x58')][_0xea3b('0x5d')]=moment()[_0xea3b('0x5e')](_0xea3b('0x5f'));_0x35e9bb[_0xea3b('0x58')][_0xea3b('0x60')]=_0x35e9bb[_0xea3b('0x58')][_0xea3b('0x60')]||_0x35e9bb[_0xea3b('0x61')]['id'];_0x8e6ce0[_0xea3b('0x62')]['id']=_0x35e9bb[_0xea3b('0x58')][_0xea3b('0x60')];return db[_0xea3b('0x3a')][_0xea3b('0x56')]({'where':{'id':_0x35e9bb[_0xea3b('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x44aa67,null))[_0xea3b('0x1f')](saveUpdates(_0x35e9bb['body'],null))[_0xea3b('0x1f')](function(_0x246527){if(_0x246527){_0x8e6ce0['message']=_0x246527['get']({'plain':!![]});return db[_0xea3b('0x63')][_0xea3b('0x56')]({'where':{'id':_0x246527['SmsInteractionId']}});}return null;})[_0xea3b('0x1f')](handleEntityNotFound(_0x44aa67,null))['then'](function(_0x524326){if(_0x524326){return _0x524326[_0xea3b('0x33')]({'UserId':_0x35e9bb[_0xea3b('0x58')]['UserId'],'read1stAt':_[_0xea3b('0x64')](_0x524326[_0xea3b('0x65')])?moment()[_0xea3b('0x5e')](_0xea3b('0x5f')):undefined});}return null;})[_0xea3b('0x1f')](function(_0x14b006){if(_0x14b006){_0x8e6ce0[_0xea3b('0x66')]=_0x14b006['get']({'plain':!![]});interaction_log['info'](_0xea3b('0x67'),_0x35e9bb[_0xea3b('0x61')]['id'],_0x35e9bb[_0xea3b('0x61')][_0xea3b('0x37')],_0x35e9bb[_0xea3b('0x61')][_0xea3b('0x68')],_0x8e6ce0[_0xea3b('0x66')]['id'],_0x35e9bb['body']?JSON[_0xea3b('0x25')](_0x35e9bb[_0xea3b('0x58')]):_0xea3b('0x69'));return respondWithRpcPromise(_0xea3b('0x6a'),_0xea3b('0x6b'),_0x8e6ce0);}return null;})['then'](function(_0xe7d2a3){var _0x4e28e7=_0xea3b('0x6c')+_0xe7d2a3[_0xea3b('0x28')][_0xea3b('0x6d')];return db[_0xea3b('0x6e')][_0xea3b('0x3e')](_0x4e28e7,{'type':db[_0xea3b('0x6f')][_0xea3b('0x70')]['SELECT'],'raw':!![]})[_0xea3b('0x1f')](function(_0x515fe9){return _0x515fe9;});})[_0xea3b('0x1f')](function(_0x47075b){if(_0x47075b){_0x8e6ce0[_0xea3b('0x28')][_0xea3b('0x71')]=_0x47075b[0x0];if(!_0x35e9bb[_0xea3b('0x58')][_0xea3b('0x60')])return;return db[_0xea3b('0x72')][_0xea3b('0x56')]({'where':{'id':_0x35e9bb[_0xea3b('0x58')][_0xea3b('0x60')],'role':_0xea3b('0x62')},'attributes':['id','name',_0xea3b('0x73'),_0xea3b('0x74'),_0xea3b('0x75')],'raw':!![]});}return null;})[_0xea3b('0x1f')](function(_0x48157a){if(!_0x48157a)return null;_0x8e6ce0[_0xea3b('0x28')][_0xea3b('0x62')]=_0x48157a;return _0x8e6ce0;})['then'](function(_0x4d76f8){if(_0x4d76f8){if(_0x35e9bb['body'][_0xea3b('0x76')]){_0x8e6ce0[_0xea3b('0x28')][_0xea3b('0x77')]=util['format'](_0xea3b('0x78'),_0x35e9bb[_0xea3b('0x61')]['name']);_0x8e6ce0[_0xea3b('0x28')]['channel']=_0x8e6ce0[_0xea3b('0x79')];_0x8e6ce0['message']['event']=_0xea3b('0x7a');return respondWithRpcPromise(_0xea3b('0x7b'),'EventManager',{'event':'acceptmessage','message':_0x8e6ce0['message']},client9002)[_0xea3b('0x1f')](function(){return _0x8e6ce0;});}return _0x8e6ce0;}return null;})['then'](respondWithResult(_0x44aa67,null))[_0xea3b('0x50')](handleError(_0x44aa67,null));};var interaction_log=require(_0xea3b('0x15'))(_0xea3b('0x5a'));exports[_0xea3b('0x31')]=function(_0x24d2c8,_0x4ffad3,_0x254bb8){var _0x4c79f6={'agent':{},'channel':_0xea3b('0x5b')};if(_0x24d2c8[_0xea3b('0x58')]['id']){delete _0x24d2c8[_0xea3b('0x58')]['id'];}_0x24d2c8[_0xea3b('0x58')][_0xea3b('0x60')]=_0x24d2c8[_0xea3b('0x58')]['UserId']||_0x24d2c8[_0xea3b('0x61')]['id'];_0x4c79f6['agent']['id']=_0x24d2c8[_0xea3b('0x58')]['UserId'];return db[_0xea3b('0x3a')][_0xea3b('0x56')]({'where':{'id':_0x24d2c8[_0xea3b('0x52')]['id'],'UserId':null}})[_0xea3b('0x1f')](handleEntityNotFound(_0x4ffad3,null))[_0xea3b('0x1f')](function(_0x4a4c03){if(_0x4a4c03){_0x4c79f6['message']=_0x4a4c03[_0xea3b('0x7c')]({'plain':!![]});return db[_0xea3b('0x63')][_0xea3b('0x56')]({'where':{'id':_0x4a4c03[_0xea3b('0x7d')]}});}return null;})['then'](handleEntityNotFound(_0x4ffad3,null))[_0xea3b('0x1f')](function(_0x186edb){if(_0x186edb){_0x4c79f6['interaction']=_0x186edb[_0xea3b('0x7c')]({'plain':!![]});interaction_log[_0xea3b('0x20')](_0xea3b('0x7e'),_0x24d2c8[_0xea3b('0x61')]['id'],_0x24d2c8[_0xea3b('0x61')]['name'],_0x24d2c8[_0xea3b('0x61')][_0xea3b('0x68')],_0x4c79f6[_0xea3b('0x66')]['id'],_0x24d2c8[_0xea3b('0x58')]?JSON[_0xea3b('0x25')](_0x24d2c8[_0xea3b('0x58')]):_0xea3b('0x69'));return respondWithRpcPromise(_0xea3b('0x7f'),_0xea3b('0x80'),_0x4c79f6);}return null;})['then'](function(_0x3ff38c){var _0x3cb581=_0xea3b('0x6c')+_0x3ff38c[_0xea3b('0x28')][_0xea3b('0x6d')];return db[_0xea3b('0x6e')][_0xea3b('0x3e')](_0x3cb581,{'type':db[_0xea3b('0x6f')][_0xea3b('0x70')][_0xea3b('0x81')],'raw':!![]})[_0xea3b('0x1f')](function(_0x264c11){return _0x264c11;});})[_0xea3b('0x1f')](function(_0x5b1c7d){if(_0x5b1c7d){_0x4c79f6[_0xea3b('0x28')][_0xea3b('0x71')]=_0x5b1c7d[0x0];if(!_0x24d2c8[_0xea3b('0x58')][_0xea3b('0x60')])return;return db[_0xea3b('0x72')][_0xea3b('0x56')]({'where':{'id':_0x24d2c8[_0xea3b('0x58')][_0xea3b('0x60')],'role':'agent'},'attributes':['id',_0xea3b('0x37'),_0xea3b('0x73'),_0xea3b('0x74'),_0xea3b('0x75')],'raw':!![]});}return null;})['then'](function(_0x127c24){if(!_0x127c24)return null;_0x4c79f6['message'][_0xea3b('0x62')]=_0x127c24;return _0x4c79f6;})['then'](function(_0xbc4925){if(_0xbc4925){_0xbc4925[_0xea3b('0x28')][_0xea3b('0x77')]=util[_0xea3b('0x5e')](_0xea3b('0x78'),_0x24d2c8[_0xea3b('0x61')][_0xea3b('0x37')]);_0xbc4925[_0xea3b('0x28')][_0xea3b('0x79')]=_0x4c79f6['channel'];_0xbc4925[_0xea3b('0x28')]['event']=_0xea3b('0x31');respondWithRpcPromise(_0xea3b('0x7b'),_0xea3b('0x7b'),{'event':_0xea3b('0x82'),'message':_0xbc4925[_0xea3b('0x28')]},client9002);return _0x4c79f6;}return null;})['then'](respondWithResult(_0x4ffad3,null))[_0xea3b('0x50')](handleError(_0x4ffad3,null));};exports['status']=function(_0x40e313,_0xd51666,_0x13683d){if(_0x40e313[_0xea3b('0x58')]['id']){delete _0x40e313[_0xea3b('0x58')]['id'];}var _0x4b5179;return db[_0xea3b('0x3a')][_0xea3b('0x56')]({'where':{'id':_0x40e313[_0xea3b('0x52')]['id']}})[_0xea3b('0x1f')](handleEntityNotFound(_0xd51666,null))[_0xea3b('0x1f')](function(_0x4c5a56){if(_0x4c5a56){_0x4b5179=_0x4c5a56;return db['SmsAccount'][_0xea3b('0x56')]({'where':{'id':_0x4c5a56[_0xea3b('0x83')]}});}})[_0xea3b('0x1f')](handleEntityNotFound(_0xd51666,null))['then'](function(_0xeded4a){if(_0xeded4a){logger[_0xea3b('0x23')]('SmsMessage,\x20%s,\x20%s,\x20%s','status',_0xea3b('0x84'),_0xeded4a[_0xea3b('0x4c')],util[_0xea3b('0x85')](_0x40e313[_0xea3b('0x58')],{'showHidden':![],'depth':null}));switch(_0xeded4a['type']){case _0xea3b('0x86'):if(_0x40e313['body']['MessageSid']&&_0x40e313['body'][_0xea3b('0x87')]===_0x4b5179[_0xea3b('0x88')]){return _0x4b5179[_0xea3b('0x33')]({'read':!![]});}else{logger[_0xea3b('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xea3b('0x29'),_0xea3b('0x86'),util[_0xea3b('0x85')](_0x40e313[_0xea3b('0x58')],{'showHidden':![],'depth':null}));}break;case _0xea3b('0x89'):if(_0x40e313[_0xea3b('0x58')][_0xea3b('0x8a')]&&_0x40e313[_0xea3b('0x58')][_0xea3b('0x8a')]===_0x4b5179[_0xea3b('0x88')]&&_[_0xea3b('0x8b')]([_0xea3b('0x8c'),_0xea3b('0x8d')],_0x40e313[_0xea3b('0x58')]['Status'])>=0x0){return _0x4b5179[_0xea3b('0x33')]({'read':!![]});}else{logger[_0xea3b('0x26')](_0xea3b('0x8e'),_0xea3b('0x29'),'plivio',util[_0xea3b('0x85')](_0x40e313[_0xea3b('0x58')],{'showHidden':![],'depth':null}));}break;case _0xea3b('0x8f'):var _0x44e58c=_0x40e313['body'][_0xea3b('0x90')][0x0];if(_0x44e58c['status']['groupName']==='DELIVERED'){return _0x4b5179['update']({'read':!![]});}else{logger[_0xea3b('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xea3b('0x29'),_0xea3b('0x8f'),util[_0xea3b('0x85')](_0x40e313[_0xea3b('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x4b5179;}})['then'](respondWithResult(_0xd51666,null))['catch'](handleError(_0xd51666,null));}; \ No newline at end of file +var _0xd869=['UserId','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','user','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','QueryTypes','SELECT','contact','User','agent','fullname','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','interaction','RejectMessage','rejectMessage','sequelize','rejectmessage','SmsAccount','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','messageId','indexOf','groupName','DELIVERED','infobip','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','destroy','stack','name','send','index','map','SmsMessage','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','rawAttributes','find','create','body','update','params','describe','sms-interactions','accept','sms','read','readAt','format'];(function(_0x272d18,_0xe8dad){var _0x311e22=function(_0x358535){while(--_0x358535){_0x272d18['push'](_0x272d18['shift']());}};_0x311e22(++_0xe8dad);}(_0xd869,0x1dd));var _0x9d86=function(_0x188888,_0x2a0a1c){_0x188888=_0x188888-0x0;var _0x1491a8=_0xd869[_0x188888];return _0x1491a8;};'use strict';var emlformat=require(_0x9d86('0x0'));var rimraf=require(_0x9d86('0x1'));var zipdir=require(_0x9d86('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9d86('0x3'));var moment=require(_0x9d86('0x4'));var BPromise=require(_0x9d86('0x5'));var Mustache=require(_0x9d86('0x6'));var util=require(_0x9d86('0x7'));var path=require('path');var sox=require(_0x9d86('0x8'));var csv=require(_0x9d86('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9d86('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9d86('0xb'));var jsforce=require(_0x9d86('0xc'));var deskjs=require(_0x9d86('0xd'));var toCsv=require(_0x9d86('0x9'));var querystring=require(_0x9d86('0xe'));var Papa=require(_0x9d86('0xf'));var Redis=require('ioredis');var authService=require(_0x9d86('0x10'));var qs=require(_0x9d86('0x11'));var as=require(_0x9d86('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9d86('0x13'))(_0x9d86('0x14'));var utils=require(_0x9d86('0x15'));var config=require(_0x9d86('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x9d86('0x17'))['db'];config[_0x9d86('0x18')]=_[_0x9d86('0x19')](config['redis'],{'host':_0x9d86('0x1a'),'port':0x18eb});var socket=require(_0x9d86('0x1b'))(new Redis(config[_0x9d86('0x18')]));require(_0x9d86('0x1c'))[_0x9d86('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x9d86('0x1e')]['http']({'port':0x232c});var client9002=jayson[_0x9d86('0x1e')][_0x9d86('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x205ce3,_0x296b82,_0x369bc4,_0x739518){return new BPromise(function(_0x1c87e3,_0x28ab91){var _0x56315f=_0x739518||client;return _0x56315f[_0x9d86('0x20')](_0x205ce3,_0x369bc4)[_0x9d86('0x21')](function(_0x4a928e){logger[_0x9d86('0x22')](_0x9d86('0x23'),_0x296b82,'request\x20sent');logger[_0x9d86('0x24')](_0x9d86('0x25'),_0x296b82,_0x9d86('0x26'),JSON[_0x9d86('0x27')](_0x4a928e));if(_0x4a928e[_0x9d86('0x28')]){if(_0x4a928e['error'][_0x9d86('0x29')]===0x1f4){logger['error'](_0x9d86('0x23'),_0x296b82,_0x4a928e[_0x9d86('0x28')]['message']);return _0x28ab91(_0x4a928e[_0x9d86('0x28')][_0x9d86('0x2a')]);}logger[_0x9d86('0x28')]('SmsMessage,\x20%s,\x20%s',_0x296b82,_0x4a928e[_0x9d86('0x28')][_0x9d86('0x2a')]);return _0x1c87e3(_0x4a928e['error'][_0x9d86('0x2a')]);}else{logger[_0x9d86('0x22')](_0x9d86('0x23'),_0x296b82,_0x9d86('0x26'));_0x1c87e3(_0x4a928e['result'][_0x9d86('0x2a')]);}})[_0x9d86('0x2b')](function(_0x4ada30){logger[_0x9d86('0x28')](_0x9d86('0x23'),_0x296b82,_0x4ada30);_0x28ab91(_0x4ada30);});});}function respondWithStatusCode(_0xf7578e,_0x35f8ad){_0x35f8ad=_0x35f8ad||0xcc;return function(_0x3fe727){if(_0x3fe727){return _0xf7578e[_0x9d86('0x2c')](_0x35f8ad);}return _0xf7578e[_0x9d86('0x2d')](_0x35f8ad)[_0x9d86('0x2e')]();};}function respondWithResult(_0x1aadbe,_0x3bac18){_0x3bac18=_0x3bac18||0xc8;return function(_0x243a34){if(_0x243a34){return _0x1aadbe[_0x9d86('0x2d')](_0x3bac18)[_0x9d86('0x2f')](_0x243a34);}};}function respondWithFilteredResult(_0x17b014,_0x6b111e){return function(_0x3b6ac1){if(_0x3b6ac1){var _0xe3174a=typeof _0x6b111e[_0x9d86('0x30')]===_0x9d86('0x31')&&typeof _0x6b111e[_0x9d86('0x32')]===_0x9d86('0x31');var _0x4a0561=_0x3b6ac1[_0x9d86('0x33')];var _0x5d0740=_0xe3174a?0x0:_0x6b111e[_0x9d86('0x30')];var _0x446b7d=_0xe3174a?_0x3b6ac1[_0x9d86('0x33')]:_0x6b111e['offset']+_0x6b111e[_0x9d86('0x32')];var _0x3e5de7;if(_0x446b7d>=_0x4a0561){_0x446b7d=_0x4a0561;_0x3e5de7=0xc8;}else{_0x3e5de7=0xce;}_0x17b014[_0x9d86('0x2d')](_0x3e5de7);return _0x17b014[_0x9d86('0x34')](_0x9d86('0x35'),_0x5d0740+'-'+_0x446b7d+'/'+_0x4a0561)[_0x9d86('0x2f')](_0x3b6ac1);}return null;};}function patchUpdates(_0x50393e){return function(_0x5a546e){try{jsonpatch['apply'](_0x5a546e,_0x50393e,!![]);}catch(_0x275211){return BPromise[_0x9d86('0x36')](_0x275211);}return _0x5a546e[_0x9d86('0x37')]();};}function saveUpdates(_0x41412a,_0x1dc7d6){return function(_0x5480db){if(_0x5480db){return _0x5480db['update'](_0x41412a)[_0x9d86('0x21')](function(_0x57a90b){return _0x57a90b;});}return null;};}function removeEntity(_0x1a341e,_0xf8e463){return function(_0x28c417){if(_0x28c417){return _0x28c417[_0x9d86('0x38')]()[_0x9d86('0x21')](function(){_0x1a341e['status'](0xcc)[_0x9d86('0x2e')]();});}};}function handleEntityNotFound(_0x5d5f97,_0x36dd3d){return function(_0x2544ea){if(!_0x2544ea){_0x5d5f97['sendStatus'](0x194);}return _0x2544ea;};}function handleError(_0x4f87f2,_0x1a467e){_0x1a467e=_0x1a467e||0x1f4;return function(_0x4d12ae){logger[_0x9d86('0x28')](_0x4d12ae[_0x9d86('0x39')]);if(_0x4d12ae[_0x9d86('0x3a')]){delete _0x4d12ae[_0x9d86('0x3a')];}_0x4f87f2[_0x9d86('0x2d')](_0x1a467e)[_0x9d86('0x3b')](_0x4d12ae);};}exports[_0x9d86('0x3c')]=function(_0xdcab70,_0xbcb6d3){var _0x262355={},_0x6e2401={},_0x571ba9={'count':0x0,'rows':[]};var _0x5697c3=_[_0x9d86('0x3d')](db[_0x9d86('0x3e')]['rawAttributes'],function(_0x3fe586){return{'name':_0x3fe586[_0x9d86('0x3f')],'type':_0x3fe586['type']['key']};});_0x6e2401[_0x9d86('0x40')]=_[_0x9d86('0x3d')](_0x5697c3,_0x9d86('0x3a'));_0x6e2401[_0x9d86('0x41')]=_[_0x9d86('0x42')](_0xdcab70[_0x9d86('0x41')]);_0x6e2401[_0x9d86('0x43')]=_[_0x9d86('0x44')](_0x6e2401[_0x9d86('0x40')],_0x6e2401[_0x9d86('0x41')]);_0x262355[_0x9d86('0x45')]=_[_0x9d86('0x44')](_0x6e2401['model'],qs[_0x9d86('0x46')](_0xdcab70[_0x9d86('0x41')][_0x9d86('0x46')]));_0x262355[_0x9d86('0x45')]=_0x262355[_0x9d86('0x45')][_0x9d86('0x47')]?_0x262355[_0x9d86('0x45')]:_0x6e2401[_0x9d86('0x40')];if(!_0xdcab70[_0x9d86('0x41')][_0x9d86('0x48')](_0x9d86('0x49'))){_0x262355[_0x9d86('0x32')]=qs[_0x9d86('0x32')](_0xdcab70['query'][_0x9d86('0x32')]);_0x262355[_0x9d86('0x30')]=qs[_0x9d86('0x30')](_0xdcab70['query']['offset']);}_0x262355[_0x9d86('0x4a')]=qs['sort'](_0xdcab70['query'][_0x9d86('0x4b')]);_0x262355[_0x9d86('0x4c')]=qs[_0x9d86('0x43')](_['pick'](_0xdcab70[_0x9d86('0x41')],_0x6e2401[_0x9d86('0x43')]),_0x5697c3);if(_0xdcab70[_0x9d86('0x41')][_0x9d86('0x4d')]){_0x262355[_0x9d86('0x4c')]=_[_0x9d86('0x4e')](_0x262355[_0x9d86('0x4c')],{'$or':_[_0x9d86('0x3d')](_0x5697c3,function(_0x31d586){if(_0x31d586[_0x9d86('0x4f')]!==_0x9d86('0x50')){var _0x2f5a21={};_0x2f5a21[_0x31d586[_0x9d86('0x3a')]]={'$like':'%'+_0xdcab70[_0x9d86('0x41')][_0x9d86('0x4d')]+'%'};return _0x2f5a21;}})});}_0x262355=_['merge']({},_0x262355,_0xdcab70[_0x9d86('0x51')]);var _0x4a9e15={'where':_0x262355[_0x9d86('0x4c')]};return db[_0x9d86('0x3e')]['count'](_0x4a9e15)['then'](function(_0x4f2190){_0x571ba9[_0x9d86('0x33')]=_0x4f2190;if(_0xdcab70['query'][_0x9d86('0x52')]){_0x262355[_0x9d86('0x53')]=[{'all':!![]}];}return db[_0x9d86('0x3e')][_0x9d86('0x54')](_0x262355);})[_0x9d86('0x21')](function(_0x138c4d){_0x571ba9[_0x9d86('0x55')]=_0x138c4d;return _0x571ba9;})['then'](respondWithFilteredResult(_0xbcb6d3,_0x262355))[_0x9d86('0x2b')](handleError(_0xbcb6d3,null));};exports['show']=function(_0xaed158,_0x5ca2fc){var _0x1bcaef={'raw':!![],'where':{'id':_0xaed158['params']['id']}},_0x176b9d={};_0x176b9d[_0x9d86('0x40')]=_[_0x9d86('0x42')](db['SmsMessage'][_0x9d86('0x56')]);_0x176b9d[_0x9d86('0x41')]=_[_0x9d86('0x42')](_0xaed158[_0x9d86('0x41')]);_0x176b9d['filters']=_[_0x9d86('0x44')](_0x176b9d[_0x9d86('0x40')],_0x176b9d[_0x9d86('0x41')]);_0x1bcaef['attributes']=_[_0x9d86('0x44')](_0x176b9d['model'],qs[_0x9d86('0x46')](_0xaed158['query'][_0x9d86('0x46')]));_0x1bcaef[_0x9d86('0x45')]=_0x1bcaef[_0x9d86('0x45')]['length']?_0x1bcaef[_0x9d86('0x45')]:_0x176b9d[_0x9d86('0x40')];if(_0xaed158[_0x9d86('0x41')][_0x9d86('0x52')]){_0x1bcaef[_0x9d86('0x53')]=[{'all':!![]}];}_0x1bcaef=_[_0x9d86('0x4e')]({},_0x1bcaef,_0xaed158[_0x9d86('0x51')]);return db[_0x9d86('0x3e')][_0x9d86('0x57')](_0x1bcaef)[_0x9d86('0x21')](handleEntityNotFound(_0x5ca2fc,null))[_0x9d86('0x21')](respondWithResult(_0x5ca2fc,null))[_0x9d86('0x2b')](handleError(_0x5ca2fc,null));};exports[_0x9d86('0x58')]=function(_0x22d99b,_0x30f829){return db[_0x9d86('0x3e')][_0x9d86('0x58')](_0x22d99b[_0x9d86('0x59')],{})[_0x9d86('0x21')](respondWithResult(_0x30f829,0xc9))['catch'](handleError(_0x30f829,null));};exports[_0x9d86('0x5a')]=function(_0x487cc8,_0x41f2b8){if(_0x487cc8['body']['id']){delete _0x487cc8[_0x9d86('0x59')]['id'];}return db[_0x9d86('0x3e')][_0x9d86('0x57')]({'where':{'id':_0x487cc8['params']['id']}})[_0x9d86('0x21')](handleEntityNotFound(_0x41f2b8,null))[_0x9d86('0x21')](saveUpdates(_0x487cc8[_0x9d86('0x59')],null))[_0x9d86('0x21')](respondWithResult(_0x41f2b8,null))[_0x9d86('0x2b')](handleError(_0x41f2b8,null));};exports[_0x9d86('0x38')]=function(_0x117568,_0xdc0c03){return db[_0x9d86('0x3e')]['find']({'where':{'id':_0x117568[_0x9d86('0x5b')]['id']}})[_0x9d86('0x21')](handleEntityNotFound(_0xdc0c03,null))[_0x9d86('0x21')](removeEntity(_0xdc0c03,null))[_0x9d86('0x2b')](handleError(_0xdc0c03,null));};exports['describe']=function(_0x3d98e7,_0xa7140c){return db[_0x9d86('0x3e')][_0x9d86('0x5c')]()['then'](respondWithResult(_0xa7140c,null))[_0x9d86('0x2b')](handleError(_0xa7140c,null));};var interaction_log=require(_0x9d86('0x13'))(_0x9d86('0x5d'));exports[_0x9d86('0x5e')]=function(_0x5c9b03,_0x237606,_0x373d9d){var _0x211b33={'agent':{},'channel':_0x9d86('0x5f')};if(_0x5c9b03['body']['id']){delete _0x5c9b03['body']['id'];}_0x5c9b03[_0x9d86('0x59')][_0x9d86('0x60')]=!![];_0x5c9b03[_0x9d86('0x59')][_0x9d86('0x61')]=moment()[_0x9d86('0x62')]('YYYY-MM-DD\x20HH:mm:ss');_0x5c9b03[_0x9d86('0x59')][_0x9d86('0x63')]=_0x5c9b03[_0x9d86('0x59')][_0x9d86('0x63')]||_0x5c9b03['user']['id'];_0x211b33['agent']['id']=_0x5c9b03['body'][_0x9d86('0x63')];return db[_0x9d86('0x3e')][_0x9d86('0x57')]({'where':{'id':_0x5c9b03[_0x9d86('0x5b')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x237606,null))[_0x9d86('0x21')](saveUpdates(_0x5c9b03[_0x9d86('0x59')],null))[_0x9d86('0x21')](function(_0x495b4e){if(_0x495b4e){_0x211b33[_0x9d86('0x2a')]=_0x495b4e[_0x9d86('0x64')]({'plain':!![]});return db[_0x9d86('0x65')]['find']({'where':{'id':_0x495b4e[_0x9d86('0x66')]}});}return null;})[_0x9d86('0x21')](handleEntityNotFound(_0x237606,null))['then'](function(_0x460454){if(_0x460454){return _0x460454[_0x9d86('0x5a')]({'UserId':_0x5c9b03[_0x9d86('0x59')]['UserId'],'read1stAt':_[_0x9d86('0x67')](_0x460454[_0x9d86('0x68')])?moment()['format'](_0x9d86('0x69')):undefined});}return null;})['then'](function(_0x43da6e){if(_0x43da6e){_0x211b33['interaction']=_0x43da6e['get']({'plain':!![]});interaction_log[_0x9d86('0x22')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5c9b03[_0x9d86('0x6a')]['id'],_0x5c9b03[_0x9d86('0x6a')][_0x9d86('0x3a')],_0x5c9b03[_0x9d86('0x6a')][_0x9d86('0x6b')],_0x211b33['interaction']['id'],_0x5c9b03[_0x9d86('0x59')]?JSON['stringify'](_0x5c9b03[_0x9d86('0x59')]):_0x9d86('0x6c'));return respondWithRpcPromise('AcceptMessage',_0x9d86('0x6d'),_0x211b33);}return null;})[_0x9d86('0x21')](function(_0x23592f){var _0x1a921f=_0x9d86('0x6e')+_0x23592f[_0x9d86('0x2a')]['ContactId'];return db['sequelize']['query'](_0x1a921f,{'type':db['Sequelize'][_0x9d86('0x6f')][_0x9d86('0x70')],'raw':!![]})[_0x9d86('0x21')](function(_0x2adbff){return _0x2adbff;});})[_0x9d86('0x21')](function(_0x29224){if(_0x29224){_0x211b33[_0x9d86('0x2a')][_0x9d86('0x71')]=_0x29224[0x0];if(!_0x5c9b03[_0x9d86('0x59')]['UserId'])return;return db[_0x9d86('0x72')][_0x9d86('0x57')]({'where':{'id':_0x5c9b03[_0x9d86('0x59')][_0x9d86('0x63')],'role':_0x9d86('0x73')},'attributes':['id','name',_0x9d86('0x74'),_0x9d86('0x75'),_0x9d86('0x76')],'raw':!![]});}return null;})[_0x9d86('0x21')](function(_0x4c86fd){if(!_0x4c86fd)return null;_0x211b33['message'][_0x9d86('0x73')]=_0x4c86fd;return _0x211b33;})[_0x9d86('0x21')](function(_0x1e341a){if(_0x1e341a){if(_0x5c9b03[_0x9d86('0x59')][_0x9d86('0x77')]){_0x211b33['message'][_0x9d86('0x78')]=util['format'](_0x9d86('0x79'),_0x5c9b03[_0x9d86('0x6a')][_0x9d86('0x3a')]);_0x211b33[_0x9d86('0x2a')][_0x9d86('0x7a')]=_0x211b33['channel'];_0x211b33['message'][_0x9d86('0x7b')]=_0x9d86('0x5e');return respondWithRpcPromise('EventManager',_0x9d86('0x7c'),{'event':_0x9d86('0x7d'),'message':_0x211b33[_0x9d86('0x2a')]},client9002)[_0x9d86('0x21')](function(){return _0x211b33;});}return _0x211b33;}return null;})[_0x9d86('0x21')](respondWithResult(_0x237606,null))[_0x9d86('0x2b')](handleError(_0x237606,null));};var interaction_log=require('../../config/logger')(_0x9d86('0x5d'));exports[_0x9d86('0x36')]=function(_0x47656f,_0x1250cb,_0x3c8fa4){var _0x4bc850={'agent':{},'channel':_0x9d86('0x5f')};if(_0x47656f[_0x9d86('0x59')]['id']){delete _0x47656f[_0x9d86('0x59')]['id'];}_0x47656f[_0x9d86('0x59')][_0x9d86('0x63')]=_0x47656f['body']['UserId']||_0x47656f[_0x9d86('0x6a')]['id'];_0x4bc850[_0x9d86('0x73')]['id']=_0x47656f['body']['UserId'];return db[_0x9d86('0x3e')][_0x9d86('0x57')]({'where':{'id':_0x47656f[_0x9d86('0x5b')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1250cb,null))[_0x9d86('0x21')](function(_0xc7044c){if(_0xc7044c){_0x4bc850[_0x9d86('0x2a')]=_0xc7044c[_0x9d86('0x64')]({'plain':!![]});return db[_0x9d86('0x65')]['find']({'where':{'id':_0xc7044c[_0x9d86('0x66')]}});}return null;})[_0x9d86('0x21')](handleEntityNotFound(_0x1250cb,null))[_0x9d86('0x21')](function(_0x3d88bf){if(_0x3d88bf){_0x4bc850[_0x9d86('0x7e')]=_0x3d88bf[_0x9d86('0x64')]({'plain':!![]});interaction_log[_0x9d86('0x22')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x47656f['user']['id'],_0x47656f[_0x9d86('0x6a')][_0x9d86('0x3a')],_0x47656f[_0x9d86('0x6a')][_0x9d86('0x6b')],_0x4bc850[_0x9d86('0x7e')]['id'],_0x47656f['body']?JSON['stringify'](_0x47656f[_0x9d86('0x59')]):'null');return respondWithRpcPromise(_0x9d86('0x7f'),_0x9d86('0x80'),_0x4bc850);}return null;})['then'](function(_0x2e162e){var _0x3bf62b=_0x9d86('0x6e')+_0x2e162e['message']['ContactId'];return db[_0x9d86('0x81')]['query'](_0x3bf62b,{'type':db['Sequelize']['QueryTypes'][_0x9d86('0x70')],'raw':!![]})['then'](function(_0x3765d6){return _0x3765d6;});})[_0x9d86('0x21')](function(_0xca122d){if(_0xca122d){_0x4bc850[_0x9d86('0x2a')][_0x9d86('0x71')]=_0xca122d[0x0];if(!_0x47656f[_0x9d86('0x59')]['UserId'])return;return db[_0x9d86('0x72')]['find']({'where':{'id':_0x47656f[_0x9d86('0x59')][_0x9d86('0x63')],'role':_0x9d86('0x73')},'attributes':['id',_0x9d86('0x3a'),_0x9d86('0x74'),'email',_0x9d86('0x76')],'raw':!![]});}return null;})['then'](function(_0x2ca07d){if(!_0x2ca07d)return null;_0x4bc850[_0x9d86('0x2a')][_0x9d86('0x73')]=_0x2ca07d;return _0x4bc850;})[_0x9d86('0x21')](function(_0x1ad2f4){if(_0x1ad2f4){_0x1ad2f4['message'][_0x9d86('0x78')]=util[_0x9d86('0x62')](_0x9d86('0x79'),_0x47656f[_0x9d86('0x6a')]['name']);_0x1ad2f4[_0x9d86('0x2a')][_0x9d86('0x7a')]=_0x4bc850[_0x9d86('0x7a')];_0x1ad2f4['message'][_0x9d86('0x7b')]=_0x9d86('0x36');respondWithRpcPromise('EventManager',_0x9d86('0x7c'),{'event':_0x9d86('0x82'),'message':_0x1ad2f4[_0x9d86('0x2a')]},client9002);return _0x4bc850;}return null;})[_0x9d86('0x21')](respondWithResult(_0x1250cb,null))[_0x9d86('0x2b')](handleError(_0x1250cb,null));};exports[_0x9d86('0x2d')]=function(_0x3bb2e7,_0x318373,_0x20bdd8){if(_0x3bb2e7[_0x9d86('0x59')]['id']){delete _0x3bb2e7[_0x9d86('0x59')]['id'];}var _0x59399e;return db[_0x9d86('0x3e')][_0x9d86('0x57')]({'where':{'id':_0x3bb2e7[_0x9d86('0x5b')]['id']}})[_0x9d86('0x21')](handleEntityNotFound(_0x318373,null))[_0x9d86('0x21')](function(_0x4b9c46){if(_0x4b9c46){_0x59399e=_0x4b9c46;return db[_0x9d86('0x83')][_0x9d86('0x57')]({'where':{'id':_0x4b9c46['SmsAccountId']}});}})[_0x9d86('0x21')](handleEntityNotFound(_0x318373,null))[_0x9d86('0x21')](function(_0x140a27){if(_0x140a27){logger[_0x9d86('0x24')](_0x9d86('0x25'),_0x9d86('0x2d'),_0x9d86('0x84'),_0x140a27['type'],util[_0x9d86('0x85')](_0x3bb2e7[_0x9d86('0x59')],{'showHidden':![],'depth':null}));switch(_0x140a27[_0x9d86('0x4f')]){case _0x9d86('0x86'):if(_0x3bb2e7[_0x9d86('0x59')][_0x9d86('0x87')]&&_0x3bb2e7[_0x9d86('0x59')]['MessageSid']===_0x59399e['messageId']){return _0x59399e[_0x9d86('0x5a')]({'read':!![]});}else{logger[_0x9d86('0x28')](_0x9d86('0x88'),'status',_0x9d86('0x86'),util['inspect'](_0x3bb2e7[_0x9d86('0x59')],{'showHidden':![],'depth':null}));}break;case _0x9d86('0x89'):if(_0x3bb2e7[_0x9d86('0x59')][_0x9d86('0x8a')]&&_0x3bb2e7[_0x9d86('0x59')][_0x9d86('0x8a')]===_0x59399e[_0x9d86('0x8b')]&&_[_0x9d86('0x8c')](['sent','delivered'],_0x3bb2e7[_0x9d86('0x59')]['Status'])>=0x0){return _0x59399e[_0x9d86('0x5a')]({'read':!![]});}else{logger[_0x9d86('0x28')](_0x9d86('0x88'),_0x9d86('0x2d'),'plivio',util[_0x9d86('0x85')](_0x3bb2e7[_0x9d86('0x59')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x1d9250=_0x3bb2e7['body']['results'][0x0];if(_0x1d9250[_0x9d86('0x2d')][_0x9d86('0x8d')]===_0x9d86('0x8e')){return _0x59399e[_0x9d86('0x5a')]({'read':!![]});}else{logger[_0x9d86('0x28')](_0x9d86('0x88'),_0x9d86('0x2d'),_0x9d86('0x8f'),util[_0x9d86('0x85')](_0x3bb2e7['body'],{'showHidden':![],'depth':null}));}break;}return _0x59399e;}})[_0x9d86('0x21')](respondWithResult(_0x318373,null))[_0x9d86('0x2b')](handleError(_0x318373,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 154c02c..9248d1a 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 _0xff67=['SmsMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','../../mysqldb'];(function(_0x28ff26,_0x1b940a){var _0xb5bc15=function(_0x90b43){while(--_0x90b43){_0x28ff26['push'](_0x28ff26['shift']());}};_0xb5bc15(++_0x1b940a);}(_0xff67,0x16f));var _0x7ff6=function(_0x215caa,_0x4ea394){_0x215caa=_0x215caa-0x0;var _0x22a519=_0xff67[_0x215caa];return _0x22a519;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0x7ff6('0x0'))['db'][_0x7ff6('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x7ff6('0x2')](0x0);var events={'afterCreate':_0x7ff6('0x3'),'afterUpdate':_0x7ff6('0x4'),'afterDestroy':_0x7ff6('0x5')};function emitEvent(_0x9907df){return function(_0x2c6157,_0xd003e2,_0x1b8aa4){SmsMessageEvents[_0x7ff6('0x6')](_0x9907df+':'+_0x2c6157['id'],_0x2c6157);SmsMessageEvents[_0x7ff6('0x6')](_0x9907df,_0x2c6157);_0x1b8aa4(null);};}for(var e in events){if(events[_0x7ff6('0x7')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0x3ac6=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage','save'];(function(_0x57c9ed,_0xd830a8){var _0x1dd31d=function(_0x4a1ccf){while(--_0x4a1ccf){_0x57c9ed['push'](_0x57c9ed['shift']());}};_0x1dd31d(++_0xd830a8);}(_0x3ac6,0x132));var _0x63ac=function(_0xd8fa86,_0x5721cd){_0xd8fa86=_0xd8fa86-0x0;var _0x264179=_0x3ac6[_0xd8fa86];return _0x264179;};'use strict';var EventEmitter=require(_0x63ac('0x0'));var SmsMessage=require(_0x63ac('0x1'))['db'][_0x63ac('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x63ac('0x3'),'afterUpdate':_0x63ac('0x4'),'afterDestroy':_0x63ac('0x5')};function emitEvent(_0x662642){return function(_0x5aea8c,_0x358c9f,_0xff1fa8){SmsMessageEvents[_0x63ac('0x6')](_0x662642+':'+_0x5aea8c['id'],_0x5aea8c);SmsMessageEvents[_0x63ac('0x6')](_0x662642,_0x5aea8c);_0xff1fa8(null);};}for(var e in events){if(events[_0x63ac('0x7')](e)){var event=events[e];SmsMessage[_0x63ac('0x8')](e,emitEvent(event));}}module[_0x63ac('0x9')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index d2a35e1..5eb0d6b 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 _0x6c50=['remote','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','timestamp','keys','sort','length','createHash','md5','digest','signature=','GET','/external/get/send.php?','id_sms','clickatell','apiMessageId','bandwidth','accountId','/messages','applicationId','toString','intelepeer','Bearer\x20','code','message','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','toLowerCase','out','secret','UserId','SmsInteraction','findOne','SmsInteractionId','update','createdAt','direction','catch','SmsAccount','find','SmsAccountId','then','type','twilio','accountSid','authToken','phone','messages','create','/api/sms/messages/','/status?token=','token','sid','inspect','error','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','smsMethod','sender','password','sms','session_key','total_sent','internal_order_id','read','Missing\x20parameters:\x20username,\x20password','senderString','POST','requestid','deliveryReport','connectel','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','base64','http_code','data','queued_count','head','message_id','clickSend','plivo','authId'];(function(_0x361d3f,_0x3be2aa){var _0x320229=function(_0x138319){while(--_0x138319){_0x361d3f['push'](_0x361d3f['shift']());}};_0x320229(++_0x3be2aa);}(_0x6c50,0xa4));var _0x06c5=function(_0xf7a2ff,_0xe15d5c){_0xf7a2ff=_0xf7a2ff-0x0;var _0x536f45=_0x6c50[_0xf7a2ff];return _0x536f45;};'use strict';var _=require(_0x06c5('0x0'));var util=require(_0x06c5('0x1'));var logger=require(_0x06c5('0x2'))(_0x06c5('0x3'));var moment=require('moment');var BPromise=require(_0x06c5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x06c5('0x5'));var rimraf=require(_0x06c5('0x6'));var config=require(_0x06c5('0x7'));var attributes=require(_0x06c5('0x8'));module[_0x06c5('0x9')]=function(_0x463f4f,_0x3f5b56){return _0x463f4f[_0x06c5('0xa')](_0x06c5('0xb'),attributes,{'tableName':_0x06c5('0xc'),'paranoid':![],'indexes':[{'name':_0x06c5('0xd'),'fields':['messageId']},{'name':_0x06c5('0xe'),'fields':[_0x06c5('0xf')],'type':_0x06c5('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x18f1e9,_0x4e863c,_0x510444){var _0x5ea57c=_0x463f4f[_0x06c5('0x11')];var _0x4a31d1=_0x18f1e9['get']({'plain':!![]});if(_0x4a31d1['direction'][_0x06c5('0x12')]()==='in'||_0x4a31d1['direction'][_0x06c5('0x12')]()===_0x06c5('0x13')&&!_0x4a31d1[_0x06c5('0x14')]&&!_['isNil'](_0x4a31d1[_0x06c5('0x15')])){_0x5ea57c[_0x06c5('0x16')][_0x06c5('0x17')]({'where':{'id':_0x4a31d1[_0x06c5('0x18')]}})['then'](function(_0x4e8669){if(_0x4e8669){_0x4e8669[_0x06c5('0x19')]({'lastMsgAt':_0x4a31d1[_0x06c5('0x1a')],'lastMsgDirection':_0x4a31d1[_0x06c5('0x1b')]['toLowerCase']()});}})[_0x06c5('0x1c')](function(_0x117371){console['error'](_0x117371);});}if(_0x4a31d1[_0x06c5('0x1b')]===_0x06c5('0x13')&&!_0x4a31d1[_0x06c5('0x14')]){var _0xb48b48;_0x5ea57c[_0x06c5('0x1d')][_0x06c5('0x1e')]({'where':{'id':_0x4a31d1[_0x06c5('0x1f')]},'raw':!![]})[_0x06c5('0x20')](function(_0x1393f5){_0xb48b48=_0x1393f5;if(_0xb48b48&&_0xb48b48[_0x06c5('0x21')]){switch(_0xb48b48[_0x06c5('0x21')]){case _0x06c5('0x22'):var _0x359dbe=require(_0x06c5('0x22'));if(_0xb48b48[_0x06c5('0x23')]&&_0xb48b48[_0x06c5('0x24')]&&_0xb48b48[_0x06c5('0x25')]){var _0x4ba7e9=new _0x359dbe(_0xb48b48[_0x06c5('0x23')],_0xb48b48[_0x06c5('0x24')]);_0x4ba7e9[_0x06c5('0x26')][_0x06c5('0x27')]({'body':_0x4a31d1[_0x06c5('0xf')],'to':_0x4a31d1[_0x06c5('0x25')],'from':_0xb48b48[_0x06c5('0x25')],'statusCallback':_0xb48b48['remote']+_0x06c5('0x28')+_0x4a31d1['id']+_0x06c5('0x29')+_0xb48b48[_0x06c5('0x2a')]})[_0x06c5('0x20')](function(_0x368e2f){if(_0x368e2f[_0x06c5('0x2b')]){return _0x18f1e9[_0x06c5('0x19')]({'messageId':_0x368e2f['sid']});}})[_0x06c5('0x1c')](function(_0x5aeb6c){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x06c5('0x22'),util[_0x06c5('0x2c')](_0x5aeb6c,{'showHidden':![],'depth':null}));});}else{logger[_0x06c5('0x2d')](_0x06c5('0x2e'),_0x06c5('0x2f'),'twilio',_0x06c5('0x30'));}break;case _0x06c5('0x31'):var _0x2731c7=_0x06c5('0x32');if(_0xb48b48[_0x06c5('0x33')]&&_0xb48b48['password']){var _0x38f6a7={'recipient':[_0x4a31d1[_0x06c5('0x25')]],'message':_0x4a31d1[_0x06c5('0xf')],'message_type':_0xb48b48['smsMethod']};if(_0xb48b48[_0x06c5('0x34')]&&_0xb48b48[_0x06c5('0x34')]!=='SI'){_0x38f6a7[_0x06c5('0x35')]=_0xb48b48['phone'];}var _0x548bd1={'url':_0x2731c7+'login?username='+_0xb48b48[_0x06c5('0x33')]+'&password='+_0xb48b48[_0x06c5('0x36')],'method':'GET'};rp(_0x548bd1)[_0x06c5('0x20')](function(_0x573011){var _0x270003=_0x573011['split'](';');var _0x5311d8={'user_key':_0x270003[0x0],'session_key':_0x270003[0x1]};_0x548bd1={'url':_0x2731c7+_0x06c5('0x37'),'method':'POST','headers':{'user_key':_0x5311d8['user_key'],'Session_key':_0x5311d8[_0x06c5('0x38')]},'json':!![],'body':_0x38f6a7};return rp(_0x548bd1);})[_0x06c5('0x20')](function(_0x2e40a4){if(_0x2e40a4[_0x06c5('0x39')]>=0x1){var _0x347e02={'messageId':_0x2e40a4[_0x06c5('0x3a')]};if(_0xb48b48[_0x06c5('0x34')]!=='GP'||!_0xb48b48['deliveryReport']){_0x347e02[_0x06c5('0x3b')]=!![];}return _0x18f1e9['update'](_0x347e02);}else{return logger['error'](_0x06c5('0x2e'),_0x06c5('0x2f'),_0x06c5('0x31'),util[_0x06c5('0x2c')](_0x2e40a4,{'showHidden':![],'depth':null}));}})[_0x06c5('0x1c')](function(_0x43ba11){return logger[_0x06c5('0x2d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x06c5('0x31'),util[_0x06c5('0x2c')](_0x43ba11,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x06c5('0x2f'),_0x06c5('0x31'),_0x06c5('0x3c'));}break;case'connectel':if(_0xb48b48[_0x06c5('0x24')]){var _0x4fedcd={'recipient':_0x4a31d1[_0x06c5('0x25')],'message':_0x4a31d1['body'],'sender':_0xb48b48[_0x06c5('0x3d')]||_0xb48b48[_0x06c5('0x25')],'authorization':_0xb48b48['authToken']};var _0x4e863c={'method':_0x06c5('0x3e'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x4fedcd,'json':!![]};rp(_0x4e863c)[_0x06c5('0x20')](function(_0x5c090d){var _0xf276d3={'messageId':_0x5c090d[_0x06c5('0x3f')]};if(!_0xb48b48[_0x06c5('0x40')]){_0xf276d3[_0x06c5('0x3b')]=!![];}return _0x18f1e9[_0x06c5('0x19')](_0xf276d3);})[_0x06c5('0x1c')](function(_0xffcf3d){logger['error'](_0x06c5('0x2e'),'afterCreate','connectel',util[_0x06c5('0x2c')](_0xffcf3d,{'showHidden':![],'depth':null}));});}else{logger[_0x06c5('0x2d')](_0x06c5('0x2e'),_0x06c5('0x2f'),_0x06c5('0x41'),_0x06c5('0x42'));}break;case _0x06c5('0x43'):if(_0xb48b48['username']&&_0xb48b48['password']){var _0x4fedcd={'messages':[{'source':_0x06c5('0x44'),'to':_0x4a31d1['phone'],'body':_0x4a31d1[_0x06c5('0xf')],'from':_0xb48b48[_0x06c5('0x3d')]||_0xb48b48[_0x06c5('0x25')]}]};var _0xbb5467=util[_0x06c5('0x45')](_0x06c5('0x46'),_0xb48b48[_0x06c5('0x33')],_0xb48b48[_0x06c5('0x36')]);var _0x4e863c={'method':'POST','uri':_0x06c5('0x47'),'body':_0x4fedcd,'headers':{'Authorization':util[_0x06c5('0x45')](_0x06c5('0x48'),new Buffer(_0xbb5467)['toString'](_0x06c5('0x49')))},'json':!![]};rp(_0x4e863c)[_0x06c5('0x20')](function(_0x560156){if(_0x560156[_0x06c5('0x4a')]>=0xc8&&_0x560156[_0x06c5('0x4a')]<=0xce){if(_0x560156[_0x06c5('0x4b')]&&_0x560156['data'][_0x06c5('0x4c')]>0x0){var _0xb07ec7=_[_0x06c5('0x4d')](_0x560156[_0x06c5('0x4b')][_0x06c5('0x26')]);var _0x51a807={'messageId':_0xb07ec7[_0x06c5('0x4e')]};if(!_0xb48b48[_0x06c5('0x40')]){_0x51a807[_0x06c5('0x3b')]=!![];}return _0x18f1e9[_0x06c5('0x19')](_0x51a807);}else{logger[_0x06c5('0x2d')](_0x06c5('0x2e'),'afterCreate',_0x06c5('0x4f'),util['inspect'](_0x560156,{'showHidden':![],'depth':null}));}}else{logger[_0x06c5('0x2d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x06c5('0x4f'),util[_0x06c5('0x2c')](_0x560156,{'showHidden':![],'depth':null}));}})['catch'](function(_0x129de6){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x06c5('0x2f'),_0x06c5('0x4f'),util[_0x06c5('0x2c')](_0x129de6,{'showHidden':![],'depth':null}));});}else{logger[_0x06c5('0x2d')](_0x06c5('0x2e'),_0x06c5('0x2f'),_0x06c5('0x4f'),_0x06c5('0x3c'));}break;case _0x06c5('0x50'):if(_0xb48b48[_0x06c5('0x51')]&&_0xb48b48[_0x06c5('0x24')]){var _0x4fedcd={'dst':_0x4a31d1[_0x06c5('0x25')],'text':_0x4a31d1[_0x06c5('0xf')],'src':_0xb48b48['senderString']||_0xb48b48[_0x06c5('0x25')],'url':_0xb48b48[_0x06c5('0x52')]+_0x06c5('0x28')+_0x4a31d1['id']+_0x06c5('0x29')+_0xb48b48['token']};var _0xbb5467=util['format'](_0x06c5('0x46'),_0xb48b48['authId'],_0xb48b48['authToken']);var _0x4e863c={'method':_0x06c5('0x3e'),'uri':util[_0x06c5('0x45')](_0x06c5('0x53'),_0xb48b48[_0x06c5('0x51')]),'body':_0x4fedcd,'headers':{'Authorization':util['format'](_0x06c5('0x48'),new Buffer(_0xbb5467)['toString']('base64'))},'json':!![]};rp(_0x4e863c)[_0x06c5('0x20')](function(_0x563931){var _0x105d09={'messageId':_0x563931[_0x06c5('0x54')][0x0]};return _0x18f1e9[_0x06c5('0x19')](_0x105d09);})['catch'](function(_0x42bc8b){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x06c5('0x2f'),_0x06c5('0x50'),util[_0x06c5('0x2c')](_0x42bc8b,{'showHidden':![],'depth':null}));});}else{logger[_0x06c5('0x2d')](_0x06c5('0x2e'),_0x06c5('0x2f'),_0x06c5('0x50'),_0x06c5('0x55'));}break;case _0x06c5('0x56'):if(_0xb48b48[_0x06c5('0x33')]&&_0xb48b48[_0x06c5('0x36')]){if(_0xb48b48[_0x06c5('0x57')]){var _0x4909b9={'method':_0x06c5('0x3e'),'uri':_0xb48b48[_0x06c5('0x57')]+'/auth/1/session','body':{'username':_0xb48b48[_0x06c5('0x33')],'password':_0xb48b48['password']},'json':!![]};return rp(_0x4909b9)[_0x06c5('0x20')](function(_0xa68091){var _0x537949={'method':_0x06c5('0x3e'),'uri':_0xb48b48['baseUrl']+_0x06c5('0x58'),'body':{'messages':[{'from':_0xb48b48[_0x06c5('0x25')],'destinations':[{'to':_0x4a31d1[_0x06c5('0x25')]}],'text':_0x4a31d1[_0x06c5('0xf')],'notifyUrl':_0xb48b48[_0x06c5('0x52')]+_0x06c5('0x28')+_0x4a31d1['id']+'/status?token='+_0xb48b48[_0x06c5('0x2a')],'notifyContentType':_0x06c5('0x59'),'callbackData':_0xb48b48['phone']+';'+_0x4a31d1['body']}]},'headers':{'Authorization':_0x06c5('0x5a')+_0xa68091[_0x06c5('0x2a')]},'json':!![]};return rp(_0x537949)['then'](function(_0x406661){if(_0x406661['messages']){var _0x5446c3={'messageId':_0x406661['messages'][0x0][_0x06c5('0xd')]};if(!_0xb48b48[_0x06c5('0x40')]){_0x5446c3[_0x06c5('0x3b')]=!![];}return _0x18f1e9['update'](_0x5446c3);}else{return logger[_0x06c5('0x2d')](_0x06c5('0x2e'),'afterCreate',_0x06c5('0x56'),util['inspect'](_0x406661,{'showHidden':![],'depth':null}));}});})[_0x06c5('0x1c')](function(_0x435e18){return logger[_0x06c5('0x2d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','infobip',util[_0x06c5('0x2c')](_0x435e18,{'showHidden':![],'depth':null}));});}else{logger[_0x06c5('0x2d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x06c5('0x2f'),_0x06c5('0x56'),_0x06c5('0x5b'));}}else{logger[_0x06c5('0x2d')](_0x06c5('0x2e'),'afterCreate',_0x06c5('0x56'),_0x06c5('0x3c'));}break;case _0x06c5('0x5c'):var _0xa2265d=require(_0x06c5('0x5d'));if(_0xb48b48[_0x06c5('0x5e')]){var _0xb05b9f={};_0xb05b9f['login']=_0xb48b48[_0x06c5('0x33')];_0xb05b9f[_0x06c5('0x25')]=_0x4a31d1[_0x06c5('0x25')];_0xb05b9f[_0x06c5('0x35')]=_0xb48b48['phone'];_0xb05b9f['text']=_0x4a31d1['body'];_0xb05b9f[_0x06c5('0x5f')]=+new Date();var _0x12975b='';var _0x577f2e='';var _0x36f7a3=Object[_0x06c5('0x60')](_0xb05b9f);_0x36f7a3[_0x06c5('0x61')]();for(var _0x510ba2=0x0;_0x510ba2<_0x36f7a3[_0x06c5('0x62')];_0x510ba2++){if(_0x12975b!=''){_0x12975b+='&';}_0x12975b+=_0x36f7a3[_0x510ba2]+'='+encodeURIComponent(_0xb05b9f[_0x36f7a3[_0x510ba2]]);_0x577f2e+=_0xb05b9f[_0x36f7a3[_0x510ba2]];}_0x577f2e+=_0xb48b48[_0x06c5('0x5e')];_0x577f2e=_0xa2265d[_0x06c5('0x63')](_0x06c5('0x64'))[_0x06c5('0x19')](_0x577f2e)[_0x06c5('0x65')]('hex');if(_0x12975b!==''){_0x12975b+='&';}_0x12975b+=_0x06c5('0x66')+_0x577f2e;var _0x548bd1={'method':_0x06c5('0x67'),'uri':_0xb48b48['baseUrl']+_0x06c5('0x68')+_0x12975b,'json':!![]};return rp(_0x548bd1)['then'](function(_0x1e7383){var _0x367b59=Object[_0x06c5('0x60')](_0x1e7383);if(_0x1e7383[_0x367b59[0x0]][_0x06c5('0x2d')]&&parseInt(_0x1e7383[_0x367b59[0x0]]['error'])===0x0){var _0x33328c={'messageId':_0x1e7383[_0x367b59[0x0]][_0x06c5('0x69')]};if(!_0xb48b48['deliveryReport']){_0x33328c['read']=!![];}return _0x18f1e9[_0x06c5('0x19')](_0x33328c);}else{return logger['error'](_0x06c5('0x2e'),_0x06c5('0x2f'),_0x06c5('0x5c'),util[_0x06c5('0x2c')](_0x1e7383[_0x06c5('0x2d')],{'showHidden':![],'depth':null}));}})[_0x06c5('0x1c')](function(_0x1a1daf){return logger[_0x06c5('0x2d')](_0x06c5('0x2e'),_0x06c5('0x2f'),'csc',util['inspect'](_0x1a1daf,{'showHidden':![],'depth':null}));});}else{logger[_0x06c5('0x2d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x06c5('0x2f'),_0x06c5('0x5c'),'Missing\x20parameters:\x20apiKey');}break;case _0x06c5('0x6a'):if(_0xb48b48[_0x06c5('0x5e')]){var _0x5854f1={'method':_0x06c5('0x3e'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0xb48b48[_0x06c5('0x5e')]},'body':{'content':_0x4a31d1[_0x06c5('0xf')],'to':[_0x4a31d1[_0x06c5('0x25')]],'from':_0xb48b48['phone'],'binary':![],'clientMessageId':'uuid','charset':'UTF-8'},'json':!![]};rp(_0x5854f1)[_0x06c5('0x20')](function(_0x1e3e0e){if(!_0x1e3e0e[_0x06c5('0x2d')]){var _0x25cb9c={'messageId':_0x1e3e0e[_0x06c5('0x26')][0x0][_0x06c5('0x6b')]};if(!_0xb48b48[_0x06c5('0x40')]){_0x25cb9c[_0x06c5('0x3b')]=!![];}return _0x18f1e9['update'](_0x25cb9c);}else{return logger[_0x06c5('0x2d')](_0x06c5('0x2e'),'afterCreate',_0x06c5('0x6a'),util[_0x06c5('0x2c')](_0x1e3e0e['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0x360ebb){return logger[_0x06c5('0x2d')](_0x06c5('0x2e'),_0x06c5('0x2f'),_0x06c5('0x6a'),util[_0x06c5('0x2c')](_0x360ebb,{'showHidden':![],'depth':null}));});}else{logger[_0x06c5('0x2d')](_0x06c5('0x2e'),'afterCreate',_0x06c5('0x6a'),'Missing\x20parameters:\x20apiKey');}break;case _0x06c5('0x6c'):if(_0xb48b48[_0x06c5('0x33')]&&_0xb48b48[_0x06c5('0x36')]){var _0xbb5467=util[_0x06c5('0x45')]('%s:%s',_0xb48b48[_0x06c5('0x33')],_0xb48b48[_0x06c5('0x36')]);var _0x4e863c={'method':_0x06c5('0x3e'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0xb48b48[_0x06c5('0x6d')]+_0x06c5('0x6e'),'body':{'to':[_0x4a31d1[_0x06c5('0x25')]],'text':_0x4a31d1['body'],'from':_0xb48b48[_0x06c5('0x25')],'applicationId':_0xb48b48[_0x06c5('0x6f')]},'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0xbb5467)[_0x06c5('0x70')](_0x06c5('0x49')))},'json':!![]};rp(_0x4e863c)[_0x06c5('0x20')](function(_0x52aeaf){if(_0x52aeaf['id']){var _0x222a84={'messageId':_0x52aeaf['id']};return _0x18f1e9[_0x06c5('0x19')](_0x222a84);}else{logger['error'](_0x06c5('0x2e'),_0x06c5('0x2f'),_0x06c5('0x6c'),util[_0x06c5('0x2c')](_0x52aeaf,{'showHidden':![],'depth':null}));}})[_0x06c5('0x1c')](function(_0x3f3221){logger[_0x06c5('0x2d')](_0x06c5('0x2e'),_0x06c5('0x2f'),_0x06c5('0x6c'),util[_0x06c5('0x2c')](_0x3f3221,{'showHidden':![],'depth':null}));});}else{logger[_0x06c5('0x2d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x06c5('0x2f'),_0x06c5('0x6c'),_0x06c5('0x3c'));}break;case _0x06c5('0x71'):if(_0xb48b48[_0x06c5('0x5e')]){var _0xa446de={};var _0x548bd1={'method':'POST','uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0x06c5('0x72')+_0xb48b48[_0x06c5('0x5e')],'Content-Type':_0x06c5('0x59')},'body':{'from':_0xb48b48[_0x06c5('0x25')],'to':_0x4a31d1[_0x06c5('0x25')],'text':_0x4a31d1[_0x06c5('0xf')]},'json':!![]};return rp(_0x548bd1)[_0x06c5('0x20')](function(_0x265334){if(_0x265334[_0x06c5('0x73')]==0xca){_0xa446de[_0x06c5('0x74')]=_0x265334;var _0x5aec42={'method':'POST','uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x06c5('0x72')+_0xb48b48[_0x06c5('0x5e')],'Content-Type':_0x06c5('0x59')},'body':{'refid':_0xa446de[_0x06c5('0x74')][_0x06c5('0x75')]},'json':!![]};return rp(_0x5aec42)['then'](function(_0x1e7937){_0xa446de[_0x06c5('0x76')]=_0x1e7937;var _0x375cc5={'messageId':_0xa446de['message'][_0x06c5('0x75')],'read':!![]};return _0x18f1e9['update'](_0x375cc5);});}else{return logger[_0x06c5('0x2d')](_0x06c5('0x2e'),'afterCreate',_0x06c5('0x71'),util[_0x06c5('0x2c')](_0x265334,{'showHidden':![],'depth':null}));}})[_0x06c5('0x1c')](function(_0x25b1b6){return logger[_0x06c5('0x2d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x06c5('0x71'),util[_0x06c5('0x2c')](_0x25b1b6,{'showHidden':![],'depth':null}));});}else{return logger[_0x06c5('0x2d')](_0x06c5('0x2e'),_0x06c5('0x2f'),_0x06c5('0x71'),_0x06c5('0x77'));}break;}}})[_0x06c5('0x78')](function(){_0x510444();});}else{_0x510444();}}},'charset':_0x06c5('0x79'),'collate':_0x06c5('0x7a')});}; \ No newline at end of file +var _0xd4b6=['skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','&password=','GET','split','POST','session_key','total_sent','read','Missing\x20parameters:\x20username,\x20password','authToken','senderString','https://smsapi.connectel.se/api/v2/send/','deliveryReport','connectel','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','data','queued_count','head','message_id','clickSend','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','base64','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','crypto','apiKey','login','text','timestamp','keys','sort','length','createHash','md5','signature=','/external/get/send.php?','id_sms','csc','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','accountId','applicationId','bandwidth','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','refid','Token\x20not\x20received','utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','SmsInteraction','findOne','SmsInteractionId','then','update','createdAt','SmsAccount','find','SmsAccountId','type','twilio','phone','accountSid','messages','create','remote','/api/sms/messages/','/status?token=','token','sid','catch','error','afterCreate','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken'];(function(_0x58b999,_0x15f187){var _0x377dda=function(_0x583925){while(--_0x583925){_0x58b999['push'](_0x58b999['shift']());}};_0x377dda(++_0x15f187);}(_0xd4b6,0x13f));var _0x6d4b=function(_0x236275,_0xf15e2d){_0x236275=_0x236275-0x0;var _0x34006f=_0xd4b6[_0x236275];return _0x34006f;};'use strict';var _=require(_0x6d4b('0x0'));var util=require(_0x6d4b('0x1'));var logger=require('../../config/logger')(_0x6d4b('0x2'));var moment=require(_0x6d4b('0x3'));var BPromise=require('bluebird');var rp=require(_0x6d4b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6d4b('0x5'));module[_0x6d4b('0x6')]=function(_0x442164,_0x5daf08){return _0x442164[_0x6d4b('0x7')](_0x6d4b('0x8'),attributes,{'tableName':_0x6d4b('0x9'),'paranoid':![],'indexes':[{'name':_0x6d4b('0xa'),'fields':['messageId']},{'name':_0x6d4b('0xb'),'fields':[_0x6d4b('0xc')],'type':_0x6d4b('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x379dd8,_0x559134,_0x19f8ef){var _0x396267=_0x442164[_0x6d4b('0xe')];var _0x2006a4=_0x379dd8[_0x6d4b('0xf')]({'plain':!![]});if(_0x2006a4[_0x6d4b('0x10')][_0x6d4b('0x11')]()==='in'||_0x2006a4['direction'][_0x6d4b('0x11')]()===_0x6d4b('0x12')&&!_0x2006a4[_0x6d4b('0x13')]&&!_['isNil'](_0x2006a4[_0x6d4b('0x14')])){_0x396267[_0x6d4b('0x15')][_0x6d4b('0x16')]({'where':{'id':_0x2006a4[_0x6d4b('0x17')]}})[_0x6d4b('0x18')](function(_0x2bca8b){if(_0x2bca8b){_0x2bca8b[_0x6d4b('0x19')]({'lastMsgAt':_0x2006a4[_0x6d4b('0x1a')],'lastMsgDirection':_0x2006a4[_0x6d4b('0x10')][_0x6d4b('0x11')]()});}})['catch'](function(_0x303f52){console['error'](_0x303f52);});}if(_0x2006a4[_0x6d4b('0x10')]===_0x6d4b('0x12')&&!_0x2006a4['secret']){var _0x53c61c;_0x396267[_0x6d4b('0x1b')][_0x6d4b('0x1c')]({'where':{'id':_0x2006a4[_0x6d4b('0x1d')]},'raw':!![]})[_0x6d4b('0x18')](function(_0xa2f130){_0x53c61c=_0xa2f130;if(_0x53c61c&&_0x53c61c[_0x6d4b('0x1e')]){switch(_0x53c61c[_0x6d4b('0x1e')]){case _0x6d4b('0x1f'):var _0x31cc24=require(_0x6d4b('0x1f'));if(_0x53c61c['accountSid']&&_0x53c61c['authToken']&&_0x53c61c[_0x6d4b('0x20')]){var _0x2bb3cf=new _0x31cc24(_0x53c61c[_0x6d4b('0x21')],_0x53c61c['authToken']);_0x2bb3cf[_0x6d4b('0x22')][_0x6d4b('0x23')]({'body':_0x2006a4[_0x6d4b('0xc')],'to':_0x2006a4[_0x6d4b('0x20')],'from':_0x53c61c['phone'],'statusCallback':_0x53c61c[_0x6d4b('0x24')]+_0x6d4b('0x25')+_0x2006a4['id']+_0x6d4b('0x26')+_0x53c61c[_0x6d4b('0x27')]})[_0x6d4b('0x18')](function(_0x479bf4){if(_0x479bf4[_0x6d4b('0x28')]){return _0x379dd8['update']({'messageId':_0x479bf4[_0x6d4b('0x28')]});}})[_0x6d4b('0x29')](function(_0x55c1ac){logger[_0x6d4b('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6d4b('0x2b'),_0x6d4b('0x1f'),util[_0x6d4b('0x2c')](_0x55c1ac,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x6d4b('0x2d'),'afterCreate',_0x6d4b('0x1f'),_0x6d4b('0x2e'));}break;case _0x6d4b('0x2f'):var _0x169fe3=_0x6d4b('0x30');if(_0x53c61c[_0x6d4b('0x31')]&&_0x53c61c[_0x6d4b('0x32')]){var _0x4d88fc={'recipient':[_0x2006a4[_0x6d4b('0x20')]],'message':_0x2006a4['body'],'message_type':_0x53c61c[_0x6d4b('0x33')]};if(_0x53c61c['smsMethod']&&_0x53c61c[_0x6d4b('0x33')]!=='SI'){_0x4d88fc[_0x6d4b('0x34')]=_0x53c61c[_0x6d4b('0x20')];}var _0x37f1f5={'url':_0x169fe3+'login?username='+_0x53c61c[_0x6d4b('0x31')]+_0x6d4b('0x35')+_0x53c61c[_0x6d4b('0x32')],'method':_0x6d4b('0x36')};rp(_0x37f1f5)[_0x6d4b('0x18')](function(_0x18ffc6){var _0xfdadd3=_0x18ffc6[_0x6d4b('0x37')](';');var _0x4d17b0={'user_key':_0xfdadd3[0x0],'session_key':_0xfdadd3[0x1]};_0x37f1f5={'url':_0x169fe3+'sms','method':_0x6d4b('0x38'),'headers':{'user_key':_0x4d17b0['user_key'],'Session_key':_0x4d17b0[_0x6d4b('0x39')]},'json':!![],'body':_0x4d88fc};return rp(_0x37f1f5);})[_0x6d4b('0x18')](function(_0x42c0c2){if(_0x42c0c2[_0x6d4b('0x3a')]>=0x1){var _0xa5ee73={'messageId':_0x42c0c2['internal_order_id']};if(_0x53c61c['smsMethod']!=='GP'||!_0x53c61c['deliveryReport']){_0xa5ee73[_0x6d4b('0x3b')]=!![];}return _0x379dd8['update'](_0xa5ee73);}else{return logger[_0x6d4b('0x2a')](_0x6d4b('0x2d'),'afterCreate','skebby',util['inspect'](_0x42c0c2,{'showHidden':![],'depth':null}));}})[_0x6d4b('0x29')](function(_0x435ff2){return logger['error'](_0x6d4b('0x2d'),'afterCreate',_0x6d4b('0x2f'),util[_0x6d4b('0x2c')](_0x435ff2,{'showHidden':![],'depth':null}));});}else{logger[_0x6d4b('0x2a')](_0x6d4b('0x2d'),'afterCreate',_0x6d4b('0x2f'),_0x6d4b('0x3c'));}break;case'connectel':if(_0x53c61c[_0x6d4b('0x3d')]){var _0x5449bb={'recipient':_0x2006a4['phone'],'message':_0x2006a4[_0x6d4b('0xc')],'sender':_0x53c61c[_0x6d4b('0x3e')]||_0x53c61c['phone'],'authorization':_0x53c61c[_0x6d4b('0x3d')]};var _0x559134={'method':_0x6d4b('0x38'),'uri':_0x6d4b('0x3f'),'body':_0x5449bb,'json':!![]};rp(_0x559134)['then'](function(_0x257fcc){var _0x357c01={'messageId':_0x257fcc['requestid']};if(!_0x53c61c[_0x6d4b('0x40')]){_0x357c01[_0x6d4b('0x3b')]=!![];}return _0x379dd8[_0x6d4b('0x19')](_0x357c01);})['catch'](function(_0x2b9f56){logger[_0x6d4b('0x2a')](_0x6d4b('0x2d'),_0x6d4b('0x2b'),_0x6d4b('0x41'),util[_0x6d4b('0x2c')](_0x2b9f56,{'showHidden':![],'depth':null}));});}else{logger[_0x6d4b('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x6d4b('0x41'),_0x6d4b('0x42'));}break;case _0x6d4b('0x43'):if(_0x53c61c[_0x6d4b('0x31')]&&_0x53c61c['password']){var _0x5449bb={'messages':[{'source':_0x6d4b('0x44'),'to':_0x2006a4[_0x6d4b('0x20')],'body':_0x2006a4['body'],'from':_0x53c61c[_0x6d4b('0x3e')]||_0x53c61c['phone']}]};var _0x46996d=util[_0x6d4b('0x45')](_0x6d4b('0x46'),_0x53c61c['username'],_0x53c61c[_0x6d4b('0x32')]);var _0x559134={'method':'POST','uri':_0x6d4b('0x47'),'body':_0x5449bb,'headers':{'Authorization':util[_0x6d4b('0x45')](_0x6d4b('0x48'),new Buffer(_0x46996d)[_0x6d4b('0x49')]('base64'))},'json':!![]};rp(_0x559134)[_0x6d4b('0x18')](function(_0x4ae997){if(_0x4ae997['http_code']>=0xc8&&_0x4ae997['http_code']<=0xce){if(_0x4ae997[_0x6d4b('0x4a')]&&_0x4ae997[_0x6d4b('0x4a')][_0x6d4b('0x4b')]>0x0){var _0x5476b4=_[_0x6d4b('0x4c')](_0x4ae997['data'][_0x6d4b('0x22')]);var _0x3a91fa={'messageId':_0x5476b4[_0x6d4b('0x4d')]};if(!_0x53c61c['deliveryReport']){_0x3a91fa[_0x6d4b('0x3b')]=!![];}return _0x379dd8[_0x6d4b('0x19')](_0x3a91fa);}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6d4b('0x2b'),_0x6d4b('0x4e'),util[_0x6d4b('0x2c')](_0x4ae997,{'showHidden':![],'depth':null}));}}else{logger[_0x6d4b('0x2a')](_0x6d4b('0x2d'),'afterCreate',_0x6d4b('0x4e'),util[_0x6d4b('0x2c')](_0x4ae997,{'showHidden':![],'depth':null}));}})['catch'](function(_0x223ecf){logger[_0x6d4b('0x2a')](_0x6d4b('0x2d'),_0x6d4b('0x2b'),_0x6d4b('0x4e'),util['inspect'](_0x223ecf,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x6d4b('0x2d'),_0x6d4b('0x2b'),_0x6d4b('0x4e'),_0x6d4b('0x3c'));}break;case _0x6d4b('0x4f'):if(_0x53c61c[_0x6d4b('0x50')]&&_0x53c61c[_0x6d4b('0x3d')]){var _0x5449bb={'dst':_0x2006a4[_0x6d4b('0x20')],'text':_0x2006a4[_0x6d4b('0xc')],'src':_0x53c61c[_0x6d4b('0x3e')]||_0x53c61c[_0x6d4b('0x20')],'url':_0x53c61c['remote']+_0x6d4b('0x25')+_0x2006a4['id']+_0x6d4b('0x26')+_0x53c61c['token']};var _0x46996d=util[_0x6d4b('0x45')](_0x6d4b('0x46'),_0x53c61c[_0x6d4b('0x50')],_0x53c61c[_0x6d4b('0x3d')]);var _0x559134={'method':_0x6d4b('0x38'),'uri':util[_0x6d4b('0x45')](_0x6d4b('0x51'),_0x53c61c[_0x6d4b('0x50')]),'body':_0x5449bb,'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x46996d)[_0x6d4b('0x49')](_0x6d4b('0x52')))},'json':!![]};rp(_0x559134)[_0x6d4b('0x18')](function(_0x40a991){var _0x3f879c={'messageId':_0x40a991['message_uuid'][0x0]};return _0x379dd8[_0x6d4b('0x19')](_0x3f879c);})[_0x6d4b('0x29')](function(_0x523138){logger[_0x6d4b('0x2a')](_0x6d4b('0x2d'),_0x6d4b('0x2b'),'plivo',util[_0x6d4b('0x2c')](_0x523138,{'showHidden':![],'depth':null}));});}else{logger[_0x6d4b('0x2a')](_0x6d4b('0x2d'),_0x6d4b('0x2b'),'plivo',_0x6d4b('0x53'));}break;case _0x6d4b('0x54'):if(_0x53c61c['username']&&_0x53c61c[_0x6d4b('0x32')]){if(_0x53c61c[_0x6d4b('0x55')]){var _0x1ab8ef={'method':_0x6d4b('0x38'),'uri':_0x53c61c[_0x6d4b('0x55')]+_0x6d4b('0x56'),'body':{'username':_0x53c61c['username'],'password':_0x53c61c[_0x6d4b('0x32')]},'json':!![]};return rp(_0x1ab8ef)['then'](function(_0x4f84b3){var _0x16f79b={'method':_0x6d4b('0x38'),'uri':_0x53c61c['baseUrl']+_0x6d4b('0x57'),'body':{'messages':[{'from':_0x53c61c[_0x6d4b('0x20')],'destinations':[{'to':_0x2006a4[_0x6d4b('0x20')]}],'text':_0x2006a4['body'],'notifyUrl':_0x53c61c[_0x6d4b('0x24')]+_0x6d4b('0x25')+_0x2006a4['id']+_0x6d4b('0x26')+_0x53c61c['token'],'notifyContentType':_0x6d4b('0x58'),'callbackData':_0x53c61c[_0x6d4b('0x20')]+';'+_0x2006a4[_0x6d4b('0xc')]}]},'headers':{'Authorization':_0x6d4b('0x59')+_0x4f84b3[_0x6d4b('0x27')]},'json':!![]};return rp(_0x16f79b)[_0x6d4b('0x18')](function(_0x559e2a){if(_0x559e2a[_0x6d4b('0x22')]){var _0x1810f3={'messageId':_0x559e2a['messages'][0x0][_0x6d4b('0xa')]};if(!_0x53c61c['deliveryReport']){_0x1810f3['read']=!![];}return _0x379dd8['update'](_0x1810f3);}else{return logger['error'](_0x6d4b('0x2d'),'afterCreate',_0x6d4b('0x54'),util[_0x6d4b('0x2c')](_0x559e2a,{'showHidden':![],'depth':null}));}});})[_0x6d4b('0x29')](function(_0x4bb608){return logger['error'](_0x6d4b('0x2d'),'afterCreate',_0x6d4b('0x54'),util[_0x6d4b('0x2c')](_0x4bb608,{'showHidden':![],'depth':null}));});}else{logger[_0x6d4b('0x2a')](_0x6d4b('0x2d'),_0x6d4b('0x2b'),_0x6d4b('0x54'),'Missing\x20parameters:\x20base_url');}}else{logger['error'](_0x6d4b('0x2d'),'afterCreate',_0x6d4b('0x54'),_0x6d4b('0x3c'));}break;case'csc':var _0x923d9c=require(_0x6d4b('0x5a'));if(_0x53c61c[_0x6d4b('0x5b')]){var _0x5caf64={};_0x5caf64[_0x6d4b('0x5c')]=_0x53c61c[_0x6d4b('0x31')];_0x5caf64[_0x6d4b('0x20')]=_0x2006a4[_0x6d4b('0x20')];_0x5caf64['sender']=_0x53c61c[_0x6d4b('0x20')];_0x5caf64[_0x6d4b('0x5d')]=_0x2006a4['body'];_0x5caf64[_0x6d4b('0x5e')]=+new Date();var _0x41d6c1='';var _0xb4b3c='';var _0xf620b8=Object[_0x6d4b('0x5f')](_0x5caf64);_0xf620b8[_0x6d4b('0x60')]();for(var _0x55f487=0x0;_0x55f487<_0xf620b8[_0x6d4b('0x61')];_0x55f487++){if(_0x41d6c1!=''){_0x41d6c1+='&';}_0x41d6c1+=_0xf620b8[_0x55f487]+'='+encodeURIComponent(_0x5caf64[_0xf620b8[_0x55f487]]);_0xb4b3c+=_0x5caf64[_0xf620b8[_0x55f487]];}_0xb4b3c+=_0x53c61c[_0x6d4b('0x5b')];_0xb4b3c=_0x923d9c[_0x6d4b('0x62')](_0x6d4b('0x63'))[_0x6d4b('0x19')](_0xb4b3c)['digest']('hex');if(_0x41d6c1!==''){_0x41d6c1+='&';}_0x41d6c1+=_0x6d4b('0x64')+_0xb4b3c;var _0x37f1f5={'method':_0x6d4b('0x36'),'uri':_0x53c61c[_0x6d4b('0x55')]+_0x6d4b('0x65')+_0x41d6c1,'json':!![]};return rp(_0x37f1f5)[_0x6d4b('0x18')](function(_0x192cca){var _0x1ad1cf=Object[_0x6d4b('0x5f')](_0x192cca);if(_0x192cca[_0x1ad1cf[0x0]][_0x6d4b('0x2a')]&&parseInt(_0x192cca[_0x1ad1cf[0x0]][_0x6d4b('0x2a')])===0x0){var _0x32a9b2={'messageId':_0x192cca[_0x1ad1cf[0x0]][_0x6d4b('0x66')]};if(!_0x53c61c[_0x6d4b('0x40')]){_0x32a9b2[_0x6d4b('0x3b')]=!![];}return _0x379dd8[_0x6d4b('0x19')](_0x32a9b2);}else{return logger[_0x6d4b('0x2a')](_0x6d4b('0x2d'),_0x6d4b('0x2b'),'csc',util[_0x6d4b('0x2c')](_0x192cca['error'],{'showHidden':![],'depth':null}));}})[_0x6d4b('0x29')](function(_0x1db85d){return logger[_0x6d4b('0x2a')](_0x6d4b('0x2d'),_0x6d4b('0x2b'),_0x6d4b('0x67'),util[_0x6d4b('0x2c')](_0x1db85d,{'showHidden':![],'depth':null}));});}else{logger[_0x6d4b('0x2a')](_0x6d4b('0x2d'),_0x6d4b('0x2b'),_0x6d4b('0x67'),_0x6d4b('0x68'));}break;case _0x6d4b('0x69'):if(_0x53c61c[_0x6d4b('0x5b')]){var _0x2ffc53={'method':'POST','uri':_0x6d4b('0x6a'),'headers':{'Authorization':_0x53c61c[_0x6d4b('0x5b')]},'body':{'content':_0x2006a4[_0x6d4b('0xc')],'to':[_0x2006a4[_0x6d4b('0x20')]],'from':_0x53c61c['phone'],'binary':![],'clientMessageId':_0x6d4b('0x6b'),'charset':_0x6d4b('0x6c')},'json':!![]};rp(_0x2ffc53)[_0x6d4b('0x18')](function(_0x28532b){if(!_0x28532b[_0x6d4b('0x2a')]){var _0x30ee22={'messageId':_0x28532b[_0x6d4b('0x22')][0x0][_0x6d4b('0x6d')]};if(!_0x53c61c['deliveryReport']){_0x30ee22[_0x6d4b('0x3b')]=!![];}return _0x379dd8[_0x6d4b('0x19')](_0x30ee22);}else{return logger[_0x6d4b('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6d4b('0x2b'),_0x6d4b('0x69'),util['inspect'](_0x28532b['error'],{'showHidden':![],'depth':null}));}})[_0x6d4b('0x29')](function(_0x2d1b66){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6d4b('0x2b'),'clickatell',util['inspect'](_0x2d1b66,{'showHidden':![],'depth':null}));});}else{logger[_0x6d4b('0x2a')](_0x6d4b('0x2d'),'afterCreate',_0x6d4b('0x69'),_0x6d4b('0x68'));}break;case'bandwidth':if(_0x53c61c[_0x6d4b('0x31')]&&_0x53c61c['password']){var _0x46996d=util[_0x6d4b('0x45')]('%s:%s',_0x53c61c[_0x6d4b('0x31')],_0x53c61c[_0x6d4b('0x32')]);var _0x559134={'method':'POST','uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x53c61c[_0x6d4b('0x6e')]+'/messages','body':{'to':[_0x2006a4[_0x6d4b('0x20')]],'text':_0x2006a4[_0x6d4b('0xc')],'from':_0x53c61c['phone'],'applicationId':_0x53c61c[_0x6d4b('0x6f')]},'headers':{'Authorization':util[_0x6d4b('0x45')](_0x6d4b('0x48'),new Buffer(_0x46996d)['toString'](_0x6d4b('0x52')))},'json':!![]};rp(_0x559134)[_0x6d4b('0x18')](function(_0x138be4){if(_0x138be4['id']){var _0xbdd64c={'messageId':_0x138be4['id']};return _0x379dd8[_0x6d4b('0x19')](_0xbdd64c);}else{logger[_0x6d4b('0x2a')](_0x6d4b('0x2d'),_0x6d4b('0x2b'),'bandwidth',util['inspect'](_0x138be4,{'showHidden':![],'depth':null}));}})[_0x6d4b('0x29')](function(_0x36117b){logger[_0x6d4b('0x2a')](_0x6d4b('0x2d'),_0x6d4b('0x2b'),_0x6d4b('0x70'),util['inspect'](_0x36117b,{'showHidden':![],'depth':null}));});}else{logger[_0x6d4b('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6d4b('0x2b'),_0x6d4b('0x70'),_0x6d4b('0x3c'));}break;case _0x6d4b('0x71'):if(_0x53c61c[_0x6d4b('0x5b')]){var _0x2694fc={};var _0x37f1f5={'method':_0x6d4b('0x38'),'uri':_0x6d4b('0x72'),'headers':{'Authorization':'Bearer\x20'+_0x53c61c[_0x6d4b('0x5b')],'Content-Type':_0x6d4b('0x58')},'body':{'from':_0x53c61c['phone'],'to':_0x2006a4[_0x6d4b('0x20')],'text':_0x2006a4[_0x6d4b('0xc')]},'json':!![]};return rp(_0x37f1f5)[_0x6d4b('0x18')](function(_0x52f294){if(_0x52f294[_0x6d4b('0x73')]==0xca){_0x2694fc[_0x6d4b('0x74')]=_0x52f294;var _0x5c6f41={'method':_0x6d4b('0x38'),'uri':_0x6d4b('0x75'),'headers':{'Authorization':_0x6d4b('0x76')+_0x53c61c[_0x6d4b('0x5b')],'Content-Type':_0x6d4b('0x58')},'body':{'refid':_0x2694fc[_0x6d4b('0x74')][_0x6d4b('0x77')]},'json':!![]};return rp(_0x5c6f41)[_0x6d4b('0x18')](function(_0x1adb44){_0x2694fc['status']=_0x1adb44;var _0x85c657={'messageId':_0x2694fc[_0x6d4b('0x74')][_0x6d4b('0x77')],'read':!![]};return _0x379dd8[_0x6d4b('0x19')](_0x85c657);});}else{return logger[_0x6d4b('0x2a')](_0x6d4b('0x2d'),_0x6d4b('0x2b'),_0x6d4b('0x71'),util[_0x6d4b('0x2c')](_0x52f294,{'showHidden':![],'depth':null}));}})[_0x6d4b('0x29')](function(_0x56cfcf){return logger[_0x6d4b('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x6d4b('0x71'),util['inspect'](_0x56cfcf,{'showHidden':![],'depth':null}));});}else{return logger[_0x6d4b('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x6d4b('0x71'),_0x6d4b('0x78'));}break;}}})['finally'](function(){_0x19f8ef();});}else{_0x19f8ef();}}},'charset':'utf8mb4','collate':_0x6d4b('0x79')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index fa73dc9..88525f8 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 _0x6dc9=['info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','body','options','raw','CreateSmsMessage','stringify','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','request','then'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x6dc9,0x140));var _0x96dc=function(_0xf9cdbe,_0x1a692c){_0xf9cdbe=_0xf9cdbe-0x0;var _0x47b102=_0x6dc9[_0xf9cdbe];return _0x47b102;};'use strict';var _=require('lodash');var util=require(_0x96dc('0x0'));var moment=require(_0x96dc('0x1'));var BPromise=require(_0x96dc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x96dc('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x96dc('0x4'))(_0x96dc('0x5'));var config=require(_0x96dc('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x96dc('0x7')]({'port':0x232a});config[_0x96dc('0x8')]=_[_0x96dc('0x9')](config['redis'],{'host':_0x96dc('0xa'),'port':0x18eb});var socket=require(_0x96dc('0xb'))(new Redis(config[_0x96dc('0x8')]));require(_0x96dc('0xc'))[_0x96dc('0xd')](socket);function respondWithRpcPromise(_0x45b7d5,_0x2c76af,_0x3fb33f){return new BPromise(function(_0x2a325c,_0x1a2ad1){return client[_0x96dc('0xe')](_0x45b7d5,_0x3fb33f)[_0x96dc('0xf')](function(_0x1d5607){logger[_0x96dc('0x10')](_0x96dc('0x11'),_0x2c76af,_0x96dc('0x12'));logger[_0x96dc('0x13')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2c76af,_0x96dc('0x12'),JSON['stringify'](_0x1d5607));if(_0x1d5607[_0x96dc('0x14')]){if(_0x1d5607[_0x96dc('0x14')]['code']===0x1f4){logger[_0x96dc('0x14')](_0x96dc('0x11'),_0x2c76af,_0x1d5607[_0x96dc('0x14')][_0x96dc('0x15')]);return _0x1a2ad1(_0x1d5607[_0x96dc('0x14')]['message']);}logger[_0x96dc('0x14')](_0x96dc('0x11'),_0x2c76af,_0x1d5607[_0x96dc('0x14')][_0x96dc('0x15')]);return _0x2a325c(_0x1d5607[_0x96dc('0x14')]['message']);}else{logger[_0x96dc('0x10')](_0x96dc('0x11'),_0x2c76af,'request\x20sent');_0x2a325c(_0x1d5607['result'][_0x96dc('0x15')]);}})[_0x96dc('0x16')](function(_0x2f2b18){logger['error']('SmsMessage,\x20%s,\x20%s',_0x2c76af,_0x2f2b18);_0x1a2ad1(_0x2f2b18);});});}exports['CreateSmsMessage']=function(_0x52011c){var _0x388309=this;return new Promise(function(_0x46043d,_0x50d8b1){return db['SmsMessage']['create'](_0x52011c[_0x96dc('0x17')],{'raw':_0x52011c[_0x96dc('0x18')]?_0x52011c['options'][_0x96dc('0x19')]===undefined?!![]:![]:!![]})[_0x96dc('0xf')](function(_0x42b43b){logger[_0x96dc('0x10')](_0x96dc('0x1a'),_0x52011c);logger[_0x96dc('0x13')](_0x96dc('0x1a'),_0x52011c,JSON[_0x96dc('0x1b')](_0x42b43b));_0x46043d(_0x42b43b);})[_0x96dc('0x16')](function(_0xef097a){logger[_0x96dc('0x14')]('CreateSmsMessage',_0xef097a[_0x96dc('0x15')],_0x52011c);_0x50d8b1(_0x388309['error'](0x1f4,_0xef097a[_0x96dc('0x15')]));});});}; \ No newline at end of file +var _0xabce=['message','result','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','redis','localhost','register','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x250ee7,_0x3a0308){var _0xa8b5a=function(_0x6a2495){while(--_0x6a2495){_0x250ee7['push'](_0x250ee7['shift']());}};_0xa8b5a(++_0x3a0308);}(_0xabce,0x15e));var _0xeabc=function(_0x5e36d1,_0x471178){_0x5e36d1=_0x5e36d1-0x0;var _0x950b9e=_0xabce[_0x5e36d1];return _0x950b9e;};'use strict';var _=require('lodash');var util=require(_0xeabc('0x0'));var moment=require(_0xeabc('0x1'));var BPromise=require(_0xeabc('0x2'));var rs=require(_0xeabc('0x3'));var fs=require('fs');var Redis=require(_0xeabc('0x4'));var db=require(_0xeabc('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xeabc('0x6'))('rpc');var config=require(_0xeabc('0x7'));var jayson=require(_0xeabc('0x8'));var client=jayson[_0xeabc('0x9')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0xeabc('0xa')],{'host':_0xeabc('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xeabc('0xa')]));require('./smsMessage.socket')[_0xeabc('0xc')](socket);function respondWithRpcPromise(_0x556fa2,_0x54f1b1,_0x3905b3){return new BPromise(function(_0x55d59a,_0x3176d1){return client['request'](_0x556fa2,_0x3905b3)[_0xeabc('0xd')](function(_0x3077eb){logger[_0xeabc('0xe')](_0xeabc('0xf'),_0x54f1b1,_0xeabc('0x10'));logger[_0xeabc('0x11')](_0xeabc('0x12'),_0x54f1b1,_0xeabc('0x10'),JSON[_0xeabc('0x13')](_0x3077eb));if(_0x3077eb[_0xeabc('0x14')]){if(_0x3077eb[_0xeabc('0x14')][_0xeabc('0x15')]===0x1f4){logger[_0xeabc('0x14')]('SmsMessage,\x20%s,\x20%s',_0x54f1b1,_0x3077eb[_0xeabc('0x14')][_0xeabc('0x16')]);return _0x3176d1(_0x3077eb['error']['message']);}logger[_0xeabc('0x14')]('SmsMessage,\x20%s,\x20%s',_0x54f1b1,_0x3077eb[_0xeabc('0x14')][_0xeabc('0x16')]);return _0x55d59a(_0x3077eb[_0xeabc('0x14')][_0xeabc('0x16')]);}else{logger[_0xeabc('0xe')]('SmsMessage,\x20%s,\x20%s',_0x54f1b1,_0xeabc('0x10'));_0x55d59a(_0x3077eb[_0xeabc('0x17')][_0xeabc('0x16')]);}})[_0xeabc('0x18')](function(_0x5538bb){logger[_0xeabc('0x14')]('SmsMessage,\x20%s,\x20%s',_0x54f1b1,_0x5538bb);_0x3176d1(_0x5538bb);});});}exports[_0xeabc('0x19')]=function(_0x2890f0){var _0x1016de=this;return new Promise(function(_0x3d79d8,_0x3c7f8e){return db[_0xeabc('0x1a')][_0xeabc('0x1b')](_0x2890f0[_0xeabc('0x1c')],{'raw':_0x2890f0[_0xeabc('0x1d')]?_0x2890f0[_0xeabc('0x1d')][_0xeabc('0x1e')]===undefined?!![]:![]:!![]})[_0xeabc('0xd')](function(_0x1a9294){logger['info'](_0xeabc('0x19'),_0x2890f0);logger[_0xeabc('0x11')](_0xeabc('0x19'),_0x2890f0,JSON[_0xeabc('0x13')](_0x1a9294));_0x3d79d8(_0x1a9294);})[_0xeabc('0x18')](function(_0x1432c3){logger[_0xeabc('0x14')](_0xeabc('0x19'),_0x1432c3[_0xeabc('0x16')],_0x2890f0);_0x3c7f8e(_0x1016de[_0xeabc('0x14')](0x1f4,_0x1432c3[_0xeabc('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 7c65755..f50dca1 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 _0xd7f8=['emit','removeListener','length','smsMessage:','./smsMessage.events','save','remove','update'];(function(_0x3e0a0e,_0x1ecf6d){var _0x8e0d0a=function(_0x521ce6){while(--_0x521ce6){_0x3e0a0e['push'](_0x3e0a0e['shift']());}};_0x8e0d0a(++_0x1ecf6d);}(_0xd7f8,0x13c));var _0x8d7f=function(_0x2d4686,_0x3d6dbb){_0x2d4686=_0x2d4686-0x0;var _0x16f68b=_0xd7f8[_0x2d4686];return _0x16f68b;};'use strict';var SmsMessageEvents=require(_0x8d7f('0x0'));var events=[_0x8d7f('0x1'),_0x8d7f('0x2'),_0x8d7f('0x3')];function createListener(_0x13008a,_0x575ae6){return function(_0x400b0a){_0x575ae6[_0x8d7f('0x4')](_0x13008a,_0x400b0a);};}function removeListener(_0x978c6d,_0x4ee446){return function(){SmsMessageEvents[_0x8d7f('0x5')](_0x978c6d,_0x4ee446);};}exports['register']=function(_0x2019f5){for(var _0x1cc9d9=0x0,_0x456795=events[_0x8d7f('0x6')];_0x1cc9d9<_0x456795;_0x1cc9d9++){var _0x47f80c=events[_0x1cc9d9];var _0x50fa95=createListener(_0x8d7f('0x7')+_0x47f80c,_0x2019f5);SmsMessageEvents['on'](_0x47f80c,_0x50fa95);}}; \ No newline at end of file +var _0x3a34=['emit','removeListener','register','length','save','remove','update'];(function(_0x1dff39,_0x1cf83c){var _0x18bc86=function(_0x4971cb){while(--_0x4971cb){_0x1dff39['push'](_0x1dff39['shift']());}};_0x18bc86(++_0x1cf83c);}(_0x3a34,0x123));var _0x43a3=function(_0x647508,_0x39d116){_0x647508=_0x647508-0x0;var _0x4c54b1=_0x3a34[_0x647508];return _0x4c54b1;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0x43a3('0x0'),_0x43a3('0x1'),_0x43a3('0x2')];function createListener(_0x7005d8,_0x355c8b){return function(_0x237972){_0x355c8b[_0x43a3('0x3')](_0x7005d8,_0x237972);};}function removeListener(_0x260196,_0x482690){return function(){SmsMessageEvents[_0x43a3('0x4')](_0x260196,_0x482690);};}exports[_0x43a3('0x5')]=function(_0xc4de9){for(var _0x1e0005=0x0,_0x33261d=events[_0x43a3('0x6')];_0x1e0005<_0x33261d;_0x1e0005++){var _0xa55023=events[_0x1e0005];var _0x1a3501=createListener('smsMessage:'+_0xa55023,_0xc4de9);SmsMessageEvents['on'](_0xa55023,_0x1a3501);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 12b273d..ad4324c 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 _0x9dbc=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','/:id','/:id/members','/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents','put','update','delete','destroy','removeAgents','multer','path'];(function(_0xd472f7,_0x4ccb2b){var _0x1a3dd7=function(_0x25665f){while(--_0x25665f){_0xd472f7['push'](_0xd472f7['shift']());}};_0x1a3dd7(++_0x4ccb2b);}(_0x9dbc,0xad));var _0xc9db=function(_0xcbeb21,_0x3901cf){_0xcbeb21=_0xcbeb21-0x0;var _0x258afd=_0x9dbc[_0xcbeb21];return _0x258afd;};'use strict';var multer=require(_0xc9db('0x0'));var util=require('util');var path=require(_0xc9db('0x1'));var timeout=require(_0xc9db('0x2'));var express=require(_0xc9db('0x3'));var router=express[_0xc9db('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc9db('0x5'));var interaction=require(_0xc9db('0x6'));var config=require(_0xc9db('0x7'));var controller=require(_0xc9db('0x8'));router[_0xc9db('0x9')]('/',auth[_0xc9db('0xa')](),controller['index']);router[_0xc9db('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xc9db('0x9')](_0xc9db('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xc9db('0x9')](_0xc9db('0xc'),auth[_0xc9db('0xa')](),controller['getMembers']);router[_0xc9db('0x9')]('/:id/teams',auth[_0xc9db('0xa')](),controller['getTeams']);router[_0xc9db('0x9')](_0xc9db('0xd'),auth['isAuthenticated'](),controller[_0xc9db('0xe')]);router[_0xc9db('0xf')]('/',auth[_0xc9db('0xa')](),controller[_0xc9db('0x10')]);router[_0xc9db('0xf')](_0xc9db('0x11'),auth[_0xc9db('0xa')](),controller[_0xc9db('0x12')]);router['post'](_0xc9db('0xd'),auth[_0xc9db('0xa')](),controller[_0xc9db('0x13')]);router[_0xc9db('0x14')](_0xc9db('0xb'),auth[_0xc9db('0xa')](),controller[_0xc9db('0x15')]);router[_0xc9db('0x16')](_0xc9db('0xb'),auth[_0xc9db('0xa')](),controller[_0xc9db('0x17')]);router['delete']('/:id/teams',auth['isAuthenticated'](),controller['removeTeams']);router[_0xc9db('0x16')]('/:id/users',auth[_0xc9db('0xa')](),controller[_0xc9db('0x18')]);module['exports']=router; \ No newline at end of file +var _0xecc8=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsQueue.controller','index','get','/describe','describe','/:id','isAuthenticated','show','getTeams','/:id/users','post','create','addAgents','put','delete','destroy','/:id/teams','removeTeams'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xecc8,0xea));var _0x8ecc=function(_0x39edad,_0x18b4d3){_0x39edad=_0x39edad-0x0;var _0x5038ae=_0xecc8[_0x39edad];return _0x5038ae;};'use strict';var multer=require(_0x8ecc('0x0'));var util=require(_0x8ecc('0x1'));var path=require('path');var timeout=require(_0x8ecc('0x2'));var express=require(_0x8ecc('0x3'));var router=express[_0x8ecc('0x4')]();var fs_extra=require(_0x8ecc('0x5'));var auth=require(_0x8ecc('0x6'));var interaction=require(_0x8ecc('0x7'));var config=require('../../config/environment');var controller=require(_0x8ecc('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x8ecc('0x9')]);router[_0x8ecc('0xa')](_0x8ecc('0xb'),auth['isAuthenticated'](),controller[_0x8ecc('0xc')]);router['get'](_0x8ecc('0xd'),auth[_0x8ecc('0xe')](),controller[_0x8ecc('0xf')]);router[_0x8ecc('0xa')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0x8ecc('0xa')]('/:id/teams',auth[_0x8ecc('0xe')](),controller[_0x8ecc('0x10')]);router['get'](_0x8ecc('0x11'),auth['isAuthenticated'](),controller['getAgents']);router[_0x8ecc('0x12')]('/',auth[_0x8ecc('0xe')](),controller[_0x8ecc('0x13')]);router[_0x8ecc('0x12')]('/:id/teams',auth['isAuthenticated'](),controller['addTeams']);router[_0x8ecc('0x12')]('/:id/users',auth['isAuthenticated'](),controller[_0x8ecc('0x14')]);router[_0x8ecc('0x15')](_0x8ecc('0xd'),auth[_0x8ecc('0xe')](),controller['update']);router[_0x8ecc('0x16')]('/:id',auth[_0x8ecc('0xe')](),controller[_0x8ecc('0x17')]);router[_0x8ecc('0x16')](_0x8ecc('0x18'),auth[_0x8ecc('0xe')](),controller[_0x8ecc('0x19')]);router[_0x8ecc('0x16')](_0x8ecc('0x11'),auth[_0x8ecc('0xe')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 3b5496b..2ee9b06 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 _0xe063=['STRING','INTEGER','rrmemory','beepall','sequelize','exports','name'];(function(_0x43305f,_0x320675){var _0x32a65f=function(_0x3497f9){while(--_0x3497f9){_0x43305f['push'](_0x43305f['shift']());}};_0x32a65f(++_0x320675);}(_0xe063,0x1af));var _0x3e06=function(_0x10c47c,_0x1cccf3){_0x10c47c=_0x10c47c-0x0;var _0x630c62=_0xe063[_0x10c47c];return _0x630c62;};'use strict';var Sequelize=require(_0x3e06('0x0'));module[_0x3e06('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x3e06('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3e06('0x3')]},'timeout':{'type':Sequelize[_0x3e06('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x3e06('0x5'),_0x3e06('0x6'),'roundrobin')}}; \ No newline at end of file +var _0x1c07=['name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x41f6d4,_0x255693){var _0x42a2a9=function(_0x1d0a8){while(--_0x1d0a8){_0x41f6d4['push'](_0x41f6d4['shift']());}};_0x42a2a9(++_0x255693);}(_0x1c07,0xf0));var _0x71c0=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x1c07[_0xa148b7];return _0x51efd3;};'use strict';var Sequelize=require(_0x71c0('0x0'));module[_0x71c0('0x1')]={'name':{'type':Sequelize[_0x71c0('0x2')],'unique':_0x71c0('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x71c0('0x2')]},'timeout':{'type':Sequelize[_0x71c0('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x71c0('0x5')](_0x71c0('0x6'),_0x71c0('0x7'),_0x71c0('0x8'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index cf64a4e..5790641 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 _0x939a=['createdAt','updatedAt','getTeams','Team','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','removeTeams','findAll','select','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','union','compact','value','isEmpty','removeAgents','omit','userSmsQueue:save','isArray','userSmsQueue:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','redis','./smsQueue.socket','register','sendStatus','status','json','undefined','limit','count','offset','Content-Range','reject','save','update','then','get','SmsQueues','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','SmsQueue','includeAll','include','rows','show','params','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','pick','User','findAndCountAll','agent','format','%s/%s','SIP','smsPause'];(function(_0x400ed9,_0x3e4e67){var _0x384bed=function(_0x406e07){while(--_0x406e07){_0x400ed9['push'](_0x400ed9['shift']());}};_0x384bed(++_0x3e4e67);}(_0x939a,0x1d7));var _0xa939=function(_0x6593ce,_0x36b00e){_0x6593ce=_0x6593ce-0x0;var _0x406a4e=_0x939a[_0x6593ce];return _0x406a4e;};'use strict';var emlformat=require(_0xa939('0x0'));var rimraf=require(_0xa939('0x1'));var zipdir=require(_0xa939('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa939('0x3'));var moment=require(_0xa939('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa939('0x5'));var util=require(_0xa939('0x6'));var path=require(_0xa939('0x7'));var sox=require(_0xa939('0x8'));var csv=require(_0xa939('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa939('0xa'));var squel=require(_0xa939('0xb'));var crypto=require(_0xa939('0xc'));var jsforce=require(_0xa939('0xd'));var deskjs=require(_0xa939('0xe'));var toCsv=require(_0xa939('0x9'));var querystring=require(_0xa939('0xf'));var Papa=require(_0xa939('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa939('0x11'));var hardwareService=require(_0xa939('0x12'));var logger=require(_0xa939('0x13'))(_0xa939('0x14'));var utils=require('../../config/utils');var config=require(_0xa939('0x15'));var licenseUtil=require(_0xa939('0x16'));var db=require(_0xa939('0x17'))['db'];config['redis']=_[_0xa939('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa939('0x19'))(new Redis(config[_0xa939('0x1a')]));require(_0xa939('0x1b'))[_0xa939('0x1c')](socket);function respondWithStatusCode(_0x298189,_0x34f1e5){_0x34f1e5=_0x34f1e5||0xcc;return function(_0x1aadc3){if(_0x1aadc3){return _0x298189[_0xa939('0x1d')](_0x34f1e5);}return _0x298189[_0xa939('0x1e')](_0x34f1e5)['end']();};}function respondWithResult(_0x8412a8,_0xce4403){_0xce4403=_0xce4403||0xc8;return function(_0x1b3195){if(_0x1b3195){return _0x8412a8['status'](_0xce4403)[_0xa939('0x1f')](_0x1b3195);}};}function respondWithFilteredResult(_0x5a94d7,_0x2c5f5a){return function(_0x5ed0c3){if(_0x5ed0c3){var _0xdd98e3=typeof _0x2c5f5a['offset']===_0xa939('0x20')&&typeof _0x2c5f5a[_0xa939('0x21')]===_0xa939('0x20');var _0x45c5b1=_0x5ed0c3['count'];var _0x36d224=_0xdd98e3?0x0:_0x2c5f5a['offset'];var _0x2c57c4=_0xdd98e3?_0x5ed0c3[_0xa939('0x22')]:_0x2c5f5a[_0xa939('0x23')]+_0x2c5f5a[_0xa939('0x21')];var _0x4378ef;if(_0x2c57c4>=_0x45c5b1){_0x2c57c4=_0x45c5b1;_0x4378ef=0xc8;}else{_0x4378ef=0xce;}_0x5a94d7[_0xa939('0x1e')](_0x4378ef);return _0x5a94d7['set'](_0xa939('0x24'),_0x36d224+'-'+_0x2c57c4+'/'+_0x45c5b1)[_0xa939('0x1f')](_0x5ed0c3);}return null;};}function patchUpdates(_0x4a9b99){return function(_0x53842f){try{jsonpatch['apply'](_0x53842f,_0x4a9b99,!![]);}catch(_0x5956d5){return BPromise[_0xa939('0x25')](_0x5956d5);}return _0x53842f[_0xa939('0x26')]();};}function saveUpdates(_0x17923d,_0x4d2d53){return function(_0x12673e){if(_0x12673e){return _0x12673e[_0xa939('0x27')](_0x17923d)['then'](function(_0x19bcd0){return _0x19bcd0;});}return null;};}function removeEntity(_0x504bea,_0x419f50){return function(_0x5b0417){if(_0x5b0417){return _0x5b0417['destroy']()[_0xa939('0x28')](function(){var _0x3bcef8=_0x5b0417[_0xa939('0x29')]({'plain':!![]});var _0x2bd8d9=_0xa939('0x2a');return db['UserProfileResource'][_0xa939('0x2b')]({'where':{'type':_0x2bd8d9,'resourceId':_0x3bcef8['id']}})[_0xa939('0x28')](function(){return _0x5b0417;});})[_0xa939('0x28')](function(){_0x504bea[_0xa939('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3762d0,_0x241459){return function(_0x3b2860){if(!_0x3b2860){_0x3762d0[_0xa939('0x1d')](0x194);}return _0x3b2860;};}function handleError(_0x526544,_0x1573a3){_0x1573a3=_0x1573a3||0x1f4;return function(_0x52799c){logger[_0xa939('0x2c')](_0x52799c[_0xa939('0x2d')]);if(_0x52799c[_0xa939('0x2e')]){delete _0x52799c[_0xa939('0x2e')];}_0x526544[_0xa939('0x1e')](_0x1573a3)['send'](_0x52799c);};}exports[_0xa939('0x2f')]=function(_0x40c5c3,_0x446b9b){var _0x2e7cb4={},_0x446a57={},_0x5ad629={'count':0x0,'rows':[]};var _0x4b7333=_[_0xa939('0x30')](db['SmsQueue'][_0xa939('0x31')],function(_0x5acddc){return{'name':_0x5acddc[_0xa939('0x32')],'type':_0x5acddc[_0xa939('0x33')][_0xa939('0x34')]};});_0x446a57[_0xa939('0x35')]=_['map'](_0x4b7333,_0xa939('0x2e'));_0x446a57['query']=_[_0xa939('0x36')](_0x40c5c3[_0xa939('0x37')]);_0x446a57[_0xa939('0x38')]=_['intersection'](_0x446a57[_0xa939('0x35')],_0x446a57[_0xa939('0x37')]);_0x2e7cb4[_0xa939('0x39')]=_[_0xa939('0x3a')](_0x446a57['model'],qs[_0xa939('0x3b')](_0x40c5c3[_0xa939('0x37')][_0xa939('0x3b')]));_0x2e7cb4[_0xa939('0x39')]=_0x2e7cb4[_0xa939('0x39')][_0xa939('0x3c')]?_0x2e7cb4[_0xa939('0x39')]:_0x446a57[_0xa939('0x35')];if(!_0x40c5c3[_0xa939('0x37')][_0xa939('0x3d')](_0xa939('0x3e'))){_0x2e7cb4[_0xa939('0x21')]=qs[_0xa939('0x21')](_0x40c5c3[_0xa939('0x37')][_0xa939('0x21')]);_0x2e7cb4[_0xa939('0x23')]=qs[_0xa939('0x23')](_0x40c5c3[_0xa939('0x37')]['offset']);}_0x2e7cb4[_0xa939('0x3f')]=qs[_0xa939('0x40')](_0x40c5c3['query'][_0xa939('0x40')]);_0x2e7cb4['where']=qs[_0xa939('0x38')](_['pick'](_0x40c5c3[_0xa939('0x37')],_0x446a57[_0xa939('0x38')]),_0x4b7333);if(_0x40c5c3['query']['filter']){_0x2e7cb4[_0xa939('0x41')]=_[_0xa939('0x42')](_0x2e7cb4[_0xa939('0x41')],{'$or':_[_0xa939('0x30')](_0x4b7333,function(_0x39febb){if(_0x39febb[_0xa939('0x33')]!=='VIRTUAL'){var _0x53e1f5={};_0x53e1f5[_0x39febb[_0xa939('0x2e')]]={'$like':'%'+_0x40c5c3[_0xa939('0x37')][_0xa939('0x43')]+'%'};return _0x53e1f5;}})});}_0x2e7cb4=_[_0xa939('0x42')]({},_0x2e7cb4,_0x40c5c3['options']);var _0x9255ae={'where':_0x2e7cb4['where']};return db[_0xa939('0x44')][_0xa939('0x22')](_0x9255ae)['then'](function(_0x401f15){_0x5ad629[_0xa939('0x22')]=_0x401f15;if(_0x40c5c3[_0xa939('0x37')][_0xa939('0x45')]){_0x2e7cb4[_0xa939('0x46')]=[{'all':!![]}];}return db[_0xa939('0x44')]['findAll'](_0x2e7cb4);})[_0xa939('0x28')](function(_0x4a2a87){_0x5ad629[_0xa939('0x47')]=_0x4a2a87;return _0x5ad629;})['then'](respondWithFilteredResult(_0x446b9b,_0x2e7cb4))['catch'](handleError(_0x446b9b,null));};exports[_0xa939('0x48')]=function(_0x259031,_0x30d3ea){var _0x4280f4={'raw':!![],'where':{'id':_0x259031[_0xa939('0x49')]['id']}},_0x452406={};_0x452406[_0xa939('0x35')]=_[_0xa939('0x36')](db[_0xa939('0x44')][_0xa939('0x31')]);_0x452406['query']=_[_0xa939('0x36')](_0x259031['query']);_0x452406[_0xa939('0x38')]=_[_0xa939('0x3a')](_0x452406[_0xa939('0x35')],_0x452406['query']);_0x4280f4[_0xa939('0x39')]=_[_0xa939('0x3a')](_0x452406['model'],qs['fields'](_0x259031[_0xa939('0x37')][_0xa939('0x3b')]));_0x4280f4[_0xa939('0x39')]=_0x4280f4[_0xa939('0x39')][_0xa939('0x3c')]?_0x4280f4['attributes']:_0x452406[_0xa939('0x35')];if(_0x259031[_0xa939('0x37')][_0xa939('0x45')]){_0x4280f4[_0xa939('0x46')]=[{'all':!![]}];}_0x4280f4=_['merge']({},_0x4280f4,_0x259031[_0xa939('0x4a')]);return db[_0xa939('0x44')][_0xa939('0x4b')](_0x4280f4)[_0xa939('0x28')](handleEntityNotFound(_0x30d3ea,null))[_0xa939('0x28')](respondWithResult(_0x30d3ea,null))[_0xa939('0x4c')](handleError(_0x30d3ea,null));};exports[_0xa939('0x4d')]=function(_0xac6fc6,_0x178a95){return db[_0xa939('0x44')]['create'](_0xac6fc6[_0xa939('0x4e')],{})[_0xa939('0x28')](function(_0x80025b){var _0x5ca5e3=_0xac6fc6[_0xa939('0x4f')]['get']({'plain':!![]});if(!_0x5ca5e3)throw new Error(_0xa939('0x50'));if(_0x5ca5e3['role']===_0xa939('0x4f')){var _0x2154d5=_0x80025b[_0xa939('0x29')]({'plain':!![]});var _0x2de58d=_0xa939('0x2a');return db[_0xa939('0x51')][_0xa939('0x4b')]({'where':{'name':_0x2de58d,'userProfileId':_0x5ca5e3[_0xa939('0x52')]},'raw':!![]})[_0xa939('0x28')](function(_0x444fae){if(_0x444fae&&_0x444fae['autoAssociation']===0x0){return db[_0xa939('0x53')][_0xa939('0x4d')]({'name':_0x2154d5[_0xa939('0x2e')],'resourceId':_0x2154d5['id'],'type':_0x444fae[_0xa939('0x2e')],'sectionId':_0x444fae['id']},{})['then'](function(){return _0x80025b;});}else{return _0x80025b;}})[_0xa939('0x4c')](function(_0x21abe9){logger['error'](_0xa939('0x54'),_0x21abe9);throw _0x21abe9;});}return _0x80025b;})[_0xa939('0x28')](respondWithResult(_0x178a95,0xc9))[_0xa939('0x4c')](handleError(_0x178a95,null));};exports[_0xa939('0x27')]=function(_0x1fa044,_0x2298a4){if(_0x1fa044[_0xa939('0x4e')]['id']){delete _0x1fa044[_0xa939('0x4e')]['id'];}return db[_0xa939('0x44')]['find']({'where':{'id':_0x1fa044[_0xa939('0x49')]['id']}})[_0xa939('0x28')](handleEntityNotFound(_0x2298a4,null))[_0xa939('0x28')](saveUpdates(_0x1fa044['body'],null))['then'](respondWithResult(_0x2298a4,null))[_0xa939('0x4c')](handleError(_0x2298a4,null));};exports[_0xa939('0x2b')]=function(_0x4a9b8c,_0x2b0c4c){return db[_0xa939('0x44')][_0xa939('0x4b')]({'where':{'id':_0x4a9b8c[_0xa939('0x49')]['id']}})['then'](handleEntityNotFound(_0x2b0c4c,null))['then'](removeEntity(_0x2b0c4c,null))[_0xa939('0x4c')](handleError(_0x2b0c4c,null));};exports['describe']=function(_0x4f36bb,_0x77a29){return db[_0xa939('0x44')][_0xa939('0x55')]()[_0xa939('0x28')](respondWithResult(_0x77a29,null))[_0xa939('0x4c')](handleError(_0x77a29,null));};exports[_0xa939('0x56')]=function(_0x404b08,_0x1cf9ad,_0x14705f){var _0x59a72a={'raw':!![],'where':{}},_0x2f3d30={},_0x5be5d4;return db[_0xa939('0x44')][_0xa939('0x57')]({'where':{'id':_0x404b08[_0xa939('0x49')]['id']}})[_0xa939('0x28')](handleEntityNotFound(_0x1cf9ad,null))[_0xa939('0x28')](function(_0x143a40){if(_0x143a40){_0x5be5d4=_0x143a40['get']({'plain':!![]});_0x2f3d30[_0xa939('0x35')]=_[_0xa939('0x36')](db[_0xa939('0x58')][_0xa939('0x31')]);_0x2f3d30['query']=_[_0xa939('0x36')](_0x404b08[_0xa939('0x37')]);_0x2f3d30[_0xa939('0x38')]=_[_0xa939('0x3a')](_0x2f3d30[_0xa939('0x35')],_0x2f3d30[_0xa939('0x37')]);_0x59a72a[_0xa939('0x39')]=_[_0xa939('0x3a')](_0x2f3d30['model'],qs[_0xa939('0x3b')](_0x404b08['query'][_0xa939('0x3b')]));_0x59a72a[_0xa939('0x39')]=_0x59a72a[_0xa939('0x39')][_0xa939('0x3c')]?_0x59a72a['attributes']:_0x2f3d30[_0xa939('0x35')];if(!_0x404b08[_0xa939('0x37')][_0xa939('0x3d')](_0xa939('0x3e'))){_0x59a72a['limit']=qs[_0xa939('0x21')](_0x404b08['query']['limit']);_0x59a72a[_0xa939('0x23')]=qs['offset'](_0x404b08[_0xa939('0x37')][_0xa939('0x23')]);}_0x59a72a['order']=qs[_0xa939('0x40')](_0x404b08[_0xa939('0x37')][_0xa939('0x40')]);_0x59a72a['where']=qs[_0xa939('0x38')](_[_0xa939('0x59')](_0x404b08[_0xa939('0x37')],_0x2f3d30[_0xa939('0x38')]));_0x59a72a[_0xa939('0x41')]['SmsQueueId']=_0x143a40['id'];if(_0x404b08[_0xa939('0x37')][_0xa939('0x43')]){_0x59a72a[_0xa939('0x41')]=_[_0xa939('0x42')](_0x59a72a[_0xa939('0x41')],{'$or':_[_0xa939('0x30')](_0x59a72a[_0xa939('0x39')],function(_0x5284b9){var _0x5af73d={};_0x5af73d[_0x5284b9]={'$like':'%'+_0x404b08[_0xa939('0x37')]['filter']+'%'};return _0x5af73d;})});}_0x59a72a=_[_0xa939('0x42')]({},_0x59a72a,_0x404b08[_0xa939('0x4a')]);return db['UserSmsQueue']['findAll'](_0x59a72a);}})[_0xa939('0x28')](function(_0x4ff9e8){if(_0x4ff9e8){return db[_0xa939('0x5a')][_0xa939('0x5b')]({'where':{'id':_[_0xa939('0x30')](_0x4ff9e8,'UserId'),'role':_0xa939('0x5c')},'attributes':['id',_0xa939('0x2e'),'smsPause','updatedAt','createdAt']});}})[_0xa939('0x28')](function(_0x4ddcee){if(_0x4ddcee){return{'count':_0x4ddcee['count'],'rows':_[_0xa939('0x30')](_0x4ddcee[_0xa939('0x47')],function(_0x37732a){return{'membername':_0x37732a['name'],'UserId':_0x37732a['id'],'queue_name':_0x5be5d4[_0xa939('0x2e')],'SmsQueueId':_0x5be5d4['id'],'interface':util[_0xa939('0x5d')](_0xa939('0x5e'),_0xa939('0x5f'),_0x37732a['name']),'penalty':0x0,'paused':_0x37732a[_0xa939('0x60')],'createdAt':_0x37732a[_0xa939('0x61')],'updatedAt':_0x37732a[_0xa939('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa939('0x28')](respondWithFilteredResult(_0x1cf9ad,_0x59a72a))['catch'](handleError(_0x1cf9ad,null));};exports[_0xa939('0x63')]=function(_0x2f01d3,_0x2cc387,_0x141b02){var _0x417553={};var _0x572bce={};var _0xd841a3;var _0xd23544;return db[_0xa939('0x44')][_0xa939('0x57')]({'where':{'id':_0x2f01d3[_0xa939('0x49')]['id']}})[_0xa939('0x28')](handleEntityNotFound(_0x2cc387,null))[_0xa939('0x28')](function(_0xf25a66){if(_0xf25a66){_0xd841a3=_0xf25a66;_0x572bce[_0xa939('0x35')]=_[_0xa939('0x36')](db[_0xa939('0x64')][_0xa939('0x31')]);_0x572bce['query']=_[_0xa939('0x36')](_0x2f01d3[_0xa939('0x37')]);_0x572bce[_0xa939('0x38')]=_['intersection'](_0x572bce[_0xa939('0x35')],_0x572bce['query']);_0x417553[_0xa939('0x39')]=_[_0xa939('0x3a')](_0x572bce['model'],qs[_0xa939('0x3b')](_0x2f01d3[_0xa939('0x37')][_0xa939('0x3b')]));_0x417553[_0xa939('0x39')]=_0x417553[_0xa939('0x39')][_0xa939('0x3c')]?_0x417553[_0xa939('0x39')]:_0x572bce[_0xa939('0x35')];_0x417553['order']=qs['sort'](_0x2f01d3[_0xa939('0x37')][_0xa939('0x40')]);_0x417553['where']=qs[_0xa939('0x38')](_[_0xa939('0x59')](_0x2f01d3[_0xa939('0x37')],_0x572bce[_0xa939('0x38')]));if(_0x2f01d3['query'][_0xa939('0x43')]){_0x417553['where']=_[_0xa939('0x42')](_0x417553[_0xa939('0x41')],{'$or':_['map'](_0x417553[_0xa939('0x39')],function(_0x152f01){var _0x517912={};_0x517912[_0x152f01]={'$like':'%'+_0x2f01d3['query'][_0xa939('0x43')]+'%'};return _0x517912;})});}_0x417553=_[_0xa939('0x42')]({},_0x417553,_0x2f01d3[_0xa939('0x4a')]);return _0xd841a3[_0xa939('0x63')](_0x417553);}})[_0xa939('0x28')](function(_0x167ae6){if(_0x167ae6){_0xd23544=_0x167ae6[_0xa939('0x3c')];if(!_0x2f01d3[_0xa939('0x37')][_0xa939('0x3d')]('nolimit')){_0x417553[_0xa939('0x21')]=qs['limit'](_0x2f01d3['query'][_0xa939('0x21')]);_0x417553[_0xa939('0x23')]=qs['offset'](_0x2f01d3[_0xa939('0x37')][_0xa939('0x23')]);}return _0xd841a3['getTeams'](_0x417553);}})[_0xa939('0x28')](function(_0x1efc98){if(_0x1efc98){return _0x1efc98?{'count':_0xd23544,'rows':_0x1efc98}:null;}})['then'](respondWithResult(_0x2cc387,null))[_0xa939('0x4c')](handleError(_0x2cc387,null));};exports['addTeams']=function(_0x310a8e,_0x481f47,_0x303373){var _0x3df7ba=_0x310a8e['body'][_0xa939('0x65')];return db[_0xa939('0x64')]['findAll']({'where':{'id':_0x3df7ba},'attributes':['id'],'include':[{'model':db[_0xa939('0x5a')],'as':_0xa939('0x66'),'attributes':['id',_0xa939('0x2e'),_0xa939('0x67'),_0xa939('0x68'),_0xa939('0x69')],'raw':!![]}]})[_0xa939('0x28')](function(_0x1f124b){if(_0x1f124b){var _0x879995=_[_0xa939('0x6a')](_0x1f124b,function(_0x2cd3c6){var _0x5145b3=_0x2cd3c6[_0xa939('0x29')]({'plain':!![]});return _0x5145b3[_0xa939('0x66')];});return db[_0xa939('0x44')]['find']({'where':{'id':_0x310a8e[_0xa939('0x49')]['id']}})[_0xa939('0x28')](function(_0x277b28){return db[_0xa939('0x6b')][_0xa939('0x6c')](function(_0x4e7ca7){return _0x277b28[_0xa939('0x6d')](_0x3df7ba,{'transaction':_0x4e7ca7})['then'](function(){return BPromise[_0xa939('0x6e')](_0x879995,function(_0xc75844){return db['UserSmsQueue'][_0xa939('0x6f')]({'where':{'UserId':_0xc75844['id'],'SmsQueueId':_0x310a8e[_0xa939('0x49')]['id']},'transaction':_0x4e7ca7});});})[_0xa939('0x28')](function(){_0x879995[_0xa939('0x70')](function(_0x5d4996){socket[_0xa939('0x71')]('userSmsQueue:save',{'UserId':_0x5d4996['id'],'SmsQueueId':_0x277b28['id']});});});});});}})[_0xa939('0x28')](respondWithStatusCode(_0x481f47,null))['catch'](handleError(_0x481f47,null));};exports[_0xa939('0x72')]=function(_0x50a3f1,_0x4b996f,_0x3121f7){return db[_0xa939('0x64')][_0xa939('0x73')]({'where':{'id':_0x50a3f1[_0xa939('0x37')][_0xa939('0x65')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xa939('0x66'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4b996f,null))[_0xa939('0x28')](function(_0x30a856){var _0x312db3=_[_0xa939('0x30')](_0x30a856,'id');var _0x54d82b=[];var _0x3a0420=[];var _0x1d0ec4=squel[_0xa939('0x74')]();_0x1d0ec4[_0xa939('0x75')](_0xa939('0x76'))[_0xa939('0x77')](_0xa939('0x78'),'tq')[_0xa939('0x79')](_0xa939('0x7a'),'ut',_0xa939('0x7b'))[_0xa939('0x41')]('SmsQueueId\x20=\x20?',_0x50a3f1[_0xa939('0x49')]['id']);for(var _0x4a9853=0x0;_0x4a9853<_0x30a856[_0xa939('0x3c')];_0x4a9853+=0x1){let _0x3e52fa=_0x30a856[_0x4a9853];for(var _0x32ba0a=0x0;_0x32ba0a<_0x3e52fa[_0xa939('0x66')][_0xa939('0x3c')];_0x32ba0a+=0x1){let _0x4c3b13=_0x3e52fa[_0xa939('0x66')][_0x32ba0a];var _0x176f7a=_0x1d0ec4[_0xa939('0x7c')]();_0x176f7a[_0xa939('0x41')](_0xa939('0x7d'),_0x4c3b13['id']);_0x3a0420[_0xa939('0x7e')](db['sequelize'][_0xa939('0x37')](_0x176f7a[_0xa939('0x7f')](),{'type':db[_0xa939('0x6b')][_0xa939('0x80')][_0xa939('0x81')]})[_0xa939('0x28')](function(_0x2d1b97){if(_0x2d1b97[_0xa939('0x3c')]===0x1){return _0x4c3b13['id'];}else{var _0x1d1061=_[_0xa939('0x82')](_[_0xa939('0x30')](_0x2d1b97,'TeamId'),function(_0x305152){return _[_0xa939('0x83')](_0x312db3,_0x305152);});if(_0x1d1061){return _0x4c3b13['id'];}}}));}}return BPromise['all'](_0x3a0420)[_0xa939('0x28')](function(_0x17276d){_0x54d82b=_(_0x54d82b)[_0xa939('0x84')](_0x17276d)[_0xa939('0x85')]()[_0xa939('0x86')]();return db[_0xa939('0x44')][_0xa939('0x4b')]({'where':{'id':_0x50a3f1[_0xa939('0x49')]['id']}})['then'](function(_0x88ce94){return db[_0xa939('0x6b')][_0xa939('0x6c')](function(_0x4caea8){return _0x88ce94[_0xa939('0x72')](_0x50a3f1[_0xa939('0x37')][_0xa939('0x65')],{'transaction':_0x4caea8})[_0xa939('0x28')](function(){if(!_[_0xa939('0x87')](_0x54d82b)){return _0x88ce94[_0xa939('0x88')](_0x54d82b,{'transaction':_0x4caea8});}})[_0xa939('0x28')](function(){_0x54d82b[_0xa939('0x70')](function(_0x3de222){socket['emit']('userSmsQueue:remove',{'UserId':_0x3de222,'SmsQueueId':_0x88ce94['id']});});});});});});})[_0xa939('0x28')](respondWithStatusCode(_0x4b996f,null))[_0xa939('0x4c')](handleError(_0x4b996f,null));};exports['addAgents']=function(_0x258e0b,_0x43f5df,_0x56f94a){return db[_0xa939('0x44')][_0xa939('0x4b')]({'where':{'id':_0x258e0b[_0xa939('0x49')]['id']}})['then'](handleEntityNotFound(_0x43f5df,null))['then'](function(_0x884e60){if(_0x884e60){return _0x884e60['addAgents'](_0x258e0b[_0xa939('0x4e')][_0xa939('0x65')],_[_0xa939('0x89')](_0x258e0b['body'],[_0xa939('0x65'),'id'])||{})['spread'](function(_0x1717f5){for(var _0x38e599=0x0;_0x38e599<_0x258e0b[_0xa939('0x4e')]['ids'][_0xa939('0x3c')];_0x38e599+=0x1){socket['emit'](_0xa939('0x8a'),{'UserId':Number(_0x258e0b['body']['ids'][_0x38e599]),'SmsQueueId':Number(_0x258e0b['params']['id'])});}return _0x1717f5;});}})[_0xa939('0x28')](respondWithResult(_0x43f5df,null))[_0xa939('0x4c')](handleError(_0x43f5df,null));};exports[_0xa939('0x88')]=function(_0x1a3108,_0x1deeeb,_0xe2e604){return db[_0xa939('0x44')][_0xa939('0x4b')]({'where':{'id':_0x1a3108[_0xa939('0x49')]['id']}})[_0xa939('0x28')](handleEntityNotFound(_0x1deeeb,null))['then'](function(_0x1077d5){if(_0x1077d5){return _0x1077d5['removeAgents'](_0x1a3108[_0xa939('0x37')][_0xa939('0x65')])['then'](function(){if(_[_0xa939('0x8b')](_0x1a3108['query'][_0xa939('0x65')])){for(var _0x1b80fe=0x0;_0x1b80fe<_0x1a3108['query'][_0xa939('0x65')][_0xa939('0x3c')];_0x1b80fe+=0x1){socket[_0xa939('0x71')]('userSmsQueue:remove',{'UserId':Number(_0x1a3108[_0xa939('0x37')][_0xa939('0x65')][_0x1b80fe]),'SmsQueueId':Number(_0x1a3108['params']['id'])});}}else{socket['emit'](_0xa939('0x8c'),{'UserId':Number(_0x1a3108[_0xa939('0x37')][_0xa939('0x65')]),'SmsQueueId':Number(_0x1a3108['params']['id'])});}});}})[_0xa939('0x28')](respondWithStatusCode(_0x1deeeb,null))[_0xa939('0x4c')](handleError(_0x1deeeb,null));};exports['getAgents']=function(_0x3be816,_0x2ae52d,_0x69c14a){var _0x1783a1={};var _0x45e0f8={};var _0x159e3f;var _0x50f45c;return db[_0xa939('0x44')][_0xa939('0x57')]({'where':{'id':_0x3be816[_0xa939('0x49')]['id']}})[_0xa939('0x28')](handleEntityNotFound(_0x2ae52d,null))[_0xa939('0x28')](function(_0x450c03){if(_0x450c03){_0x159e3f=_0x450c03;_0x45e0f8[_0xa939('0x35')]=_['keys'](db['User']['rawAttributes']);_0x45e0f8[_0xa939('0x37')]=_[_0xa939('0x36')](_0x3be816['query']);_0x45e0f8[_0xa939('0x38')]=_[_0xa939('0x3a')](_0x45e0f8[_0xa939('0x35')],_0x45e0f8[_0xa939('0x37')]);_0x1783a1[_0xa939('0x39')]=_[_0xa939('0x3a')](_0x45e0f8[_0xa939('0x35')],qs[_0xa939('0x3b')](_0x3be816[_0xa939('0x37')][_0xa939('0x3b')]));_0x1783a1[_0xa939('0x39')]=_0x1783a1[_0xa939('0x39')][_0xa939('0x3c')]?_0x1783a1[_0xa939('0x39')]:_0x45e0f8['model'];_0x1783a1[_0xa939('0x3f')]=qs[_0xa939('0x40')](_0x3be816[_0xa939('0x37')][_0xa939('0x40')]);_0x1783a1[_0xa939('0x41')]=qs['filters'](_['pick'](_0x3be816[_0xa939('0x37')],_0x45e0f8[_0xa939('0x38')]));if(_0x3be816[_0xa939('0x37')][_0xa939('0x43')]){_0x1783a1[_0xa939('0x41')]=_['merge'](_0x1783a1[_0xa939('0x41')],{'$or':_[_0xa939('0x30')](_0x1783a1['attributes'],function(_0x3f6044){var _0x3cb5ae={};_0x3cb5ae[_0x3f6044]={'$like':'%'+_0x3be816[_0xa939('0x37')][_0xa939('0x43')]+'%'};return _0x3cb5ae;})});}_0x1783a1=_[_0xa939('0x42')]({},_0x1783a1,_0x3be816[_0xa939('0x4a')]);return _0x159e3f['getAgents'](_0x1783a1);}})['then'](function(_0x29bef8){if(_0x29bef8){_0x50f45c=_0x29bef8['length'];if(!_0x3be816[_0xa939('0x37')][_0xa939('0x3d')](_0xa939('0x3e'))){_0x1783a1[_0xa939('0x21')]=qs['limit'](_0x3be816[_0xa939('0x37')]['limit']);_0x1783a1[_0xa939('0x23')]=qs['offset'](_0x3be816[_0xa939('0x37')][_0xa939('0x23')]);}return _0x159e3f[_0xa939('0x8d')](_0x1783a1);}})[_0xa939('0x28')](function(_0x4f3a0c){if(_0x4f3a0c){return _0x4f3a0c?{'count':_0x50f45c,'rows':_0x4f3a0c}:null;}})[_0xa939('0x28')](respondWithResult(_0x2ae52d,null))[_0xa939('0x4c')](handleError(_0x2ae52d,null));}; \ No newline at end of file +var _0x6ae6=['filter','type','VIRTUAL','merge','options','rows','catch','show','params','length','includeAll','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','SmsQueues','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','findOne','UserSmsQueue','nolimit','SmsQueueId','findAll','findAndCountAll','agent','smsPause','updatedAt','format','getTeams','addTeams','Team','User','Agents','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','ids','select','field','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','omit','spread','getAgents','rawAttributes','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','defaults','redis','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','UserProfileResource','error','stack','send','SmsQueue','fieldName','key','model','map','name','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick'];(function(_0x306626,_0x425e93){var _0x466728=function(_0x3b3478){while(--_0x3b3478){_0x306626['push'](_0x306626['shift']());}};_0x466728(++_0x425e93);}(_0x6ae6,0x15c));var _0x66ae=function(_0x277fa3,_0x3b2dde){_0x277fa3=_0x277fa3-0x0;var _0x2e4520=_0x6ae6[_0x277fa3];return _0x2e4520;};'use strict';var emlformat=require(_0x66ae('0x0'));var rimraf=require(_0x66ae('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x66ae('0x2'));var rp=require(_0x66ae('0x3'));var moment=require(_0x66ae('0x4'));var BPromise=require(_0x66ae('0x5'));var Mustache=require('mustache');var util=require(_0x66ae('0x6'));var path=require('path');var sox=require(_0x66ae('0x7'));var csv=require(_0x66ae('0x8'));var ejs=require(_0x66ae('0x9'));var fs=require('fs');var fs_extra=require(_0x66ae('0xa'));var _=require('lodash');var squel=require(_0x66ae('0xb'));var crypto=require(_0x66ae('0xc'));var jsforce=require(_0x66ae('0xd'));var deskjs=require(_0x66ae('0xe'));var toCsv=require('to-csv');var querystring=require(_0x66ae('0xf'));var Papa=require(_0x66ae('0x10'));var Redis=require(_0x66ae('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x66ae('0x12'));var hardwareService=require(_0x66ae('0x13'));var logger=require(_0x66ae('0x14'))(_0x66ae('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x66ae('0x16'))['db'];config['redis']=_[_0x66ae('0x17')](config[_0x66ae('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x66ae('0x19'))(new Redis(config[_0x66ae('0x18')]));require('./smsQueue.socket')[_0x66ae('0x1a')](socket);function respondWithStatusCode(_0x443390,_0x45b7fb){_0x45b7fb=_0x45b7fb||0xcc;return function(_0xb6538a){if(_0xb6538a){return _0x443390[_0x66ae('0x1b')](_0x45b7fb);}return _0x443390[_0x66ae('0x1c')](_0x45b7fb)[_0x66ae('0x1d')]();};}function respondWithResult(_0x280d32,_0x21d333){_0x21d333=_0x21d333||0xc8;return function(_0x5b35a6){if(_0x5b35a6){return _0x280d32['status'](_0x21d333)[_0x66ae('0x1e')](_0x5b35a6);}};}function respondWithFilteredResult(_0x3d4f2e,_0x17074e){return function(_0x560edc){if(_0x560edc){var _0x38588a=typeof _0x17074e[_0x66ae('0x1f')]===_0x66ae('0x20')&&typeof _0x17074e[_0x66ae('0x21')]===_0x66ae('0x20');var _0x334090=_0x560edc[_0x66ae('0x22')];var _0x1d74bb=_0x38588a?0x0:_0x17074e[_0x66ae('0x1f')];var _0x2cd5b4=_0x38588a?_0x560edc[_0x66ae('0x22')]:_0x17074e[_0x66ae('0x1f')]+_0x17074e[_0x66ae('0x21')];var _0x3ce534;if(_0x2cd5b4>=_0x334090){_0x2cd5b4=_0x334090;_0x3ce534=0xc8;}else{_0x3ce534=0xce;}_0x3d4f2e[_0x66ae('0x1c')](_0x3ce534);return _0x3d4f2e[_0x66ae('0x23')](_0x66ae('0x24'),_0x1d74bb+'-'+_0x2cd5b4+'/'+_0x334090)[_0x66ae('0x1e')](_0x560edc);}return null;};}function patchUpdates(_0x257175){return function(_0x2688e4){try{jsonpatch['apply'](_0x2688e4,_0x257175,!![]);}catch(_0x75402c){return BPromise[_0x66ae('0x25')](_0x75402c);}return _0x2688e4[_0x66ae('0x26')]();};}function saveUpdates(_0x5c69c5,_0x40d44d){return function(_0x1bc520){if(_0x1bc520){return _0x1bc520[_0x66ae('0x27')](_0x5c69c5)[_0x66ae('0x28')](function(_0x22870a){return _0x22870a;});}return null;};}function removeEntity(_0x3a3042,_0x41a4cc){return function(_0xe4ca81){if(_0xe4ca81){return _0xe4ca81[_0x66ae('0x29')]()[_0x66ae('0x28')](function(){var _0x3145c8=_0xe4ca81['get']({'plain':!![]});var _0x3b1489='SmsQueues';return db[_0x66ae('0x2a')][_0x66ae('0x29')]({'where':{'type':_0x3b1489,'resourceId':_0x3145c8['id']}})[_0x66ae('0x28')](function(){return _0xe4ca81;});})[_0x66ae('0x28')](function(){_0x3a3042[_0x66ae('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3eedcc,_0x192f05){return function(_0x2f734b){if(!_0x2f734b){_0x3eedcc[_0x66ae('0x1b')](0x194);}return _0x2f734b;};}function handleError(_0x38802e,_0x47eb48){_0x47eb48=_0x47eb48||0x1f4;return function(_0x1d42e3){logger[_0x66ae('0x2b')](_0x1d42e3[_0x66ae('0x2c')]);if(_0x1d42e3['name']){delete _0x1d42e3['name'];}_0x38802e[_0x66ae('0x1c')](_0x47eb48)[_0x66ae('0x2d')](_0x1d42e3);};}exports['index']=function(_0x4e533a,_0x19fe8e){var _0x284fc6={},_0x32361e={},_0x331f05={'count':0x0,'rows':[]};var _0x3774c6=_['map'](db[_0x66ae('0x2e')]['rawAttributes'],function(_0x49328b){return{'name':_0x49328b[_0x66ae('0x2f')],'type':_0x49328b['type'][_0x66ae('0x30')]};});_0x32361e[_0x66ae('0x31')]=_[_0x66ae('0x32')](_0x3774c6,_0x66ae('0x33'));_0x32361e[_0x66ae('0x34')]=_[_0x66ae('0x35')](_0x4e533a[_0x66ae('0x34')]);_0x32361e['filters']=_[_0x66ae('0x36')](_0x32361e[_0x66ae('0x31')],_0x32361e[_0x66ae('0x34')]);_0x284fc6[_0x66ae('0x37')]=_[_0x66ae('0x36')](_0x32361e[_0x66ae('0x31')],qs[_0x66ae('0x38')](_0x4e533a[_0x66ae('0x34')][_0x66ae('0x38')]));_0x284fc6[_0x66ae('0x37')]=_0x284fc6['attributes']['length']?_0x284fc6['attributes']:_0x32361e[_0x66ae('0x31')];if(!_0x4e533a[_0x66ae('0x34')][_0x66ae('0x39')]('nolimit')){_0x284fc6[_0x66ae('0x21')]=qs['limit'](_0x4e533a[_0x66ae('0x34')][_0x66ae('0x21')]);_0x284fc6[_0x66ae('0x1f')]=qs[_0x66ae('0x1f')](_0x4e533a[_0x66ae('0x34')][_0x66ae('0x1f')]);}_0x284fc6[_0x66ae('0x3a')]=qs['sort'](_0x4e533a[_0x66ae('0x34')][_0x66ae('0x3b')]);_0x284fc6[_0x66ae('0x3c')]=qs[_0x66ae('0x3d')](_[_0x66ae('0x3e')](_0x4e533a[_0x66ae('0x34')],_0x32361e[_0x66ae('0x3d')]),_0x3774c6);if(_0x4e533a[_0x66ae('0x34')][_0x66ae('0x3f')]){_0x284fc6[_0x66ae('0x3c')]=_['merge'](_0x284fc6['where'],{'$or':_[_0x66ae('0x32')](_0x3774c6,function(_0x18ffaa){if(_0x18ffaa[_0x66ae('0x40')]!==_0x66ae('0x41')){var _0x4538c5={};_0x4538c5[_0x18ffaa[_0x66ae('0x33')]]={'$like':'%'+_0x4e533a[_0x66ae('0x34')][_0x66ae('0x3f')]+'%'};return _0x4538c5;}})});}_0x284fc6=_[_0x66ae('0x42')]({},_0x284fc6,_0x4e533a[_0x66ae('0x43')]);var _0x27fa62={'where':_0x284fc6[_0x66ae('0x3c')]};return db[_0x66ae('0x2e')][_0x66ae('0x22')](_0x27fa62)[_0x66ae('0x28')](function(_0x355380){_0x331f05[_0x66ae('0x22')]=_0x355380;if(_0x4e533a[_0x66ae('0x34')]['includeAll']){_0x284fc6['include']=[{'all':!![]}];}return db[_0x66ae('0x2e')]['findAll'](_0x284fc6);})[_0x66ae('0x28')](function(_0x1418d8){_0x331f05[_0x66ae('0x44')]=_0x1418d8;return _0x331f05;})[_0x66ae('0x28')](respondWithFilteredResult(_0x19fe8e,_0x284fc6))[_0x66ae('0x45')](handleError(_0x19fe8e,null));};exports[_0x66ae('0x46')]=function(_0x1db7f2,_0x5f35ee){var _0x4ffb19={'raw':!![],'where':{'id':_0x1db7f2[_0x66ae('0x47')]['id']}},_0x3ac289={};_0x3ac289['model']=_[_0x66ae('0x35')](db[_0x66ae('0x2e')]['rawAttributes']);_0x3ac289['query']=_[_0x66ae('0x35')](_0x1db7f2[_0x66ae('0x34')]);_0x3ac289[_0x66ae('0x3d')]=_[_0x66ae('0x36')](_0x3ac289[_0x66ae('0x31')],_0x3ac289[_0x66ae('0x34')]);_0x4ffb19[_0x66ae('0x37')]=_[_0x66ae('0x36')](_0x3ac289[_0x66ae('0x31')],qs['fields'](_0x1db7f2[_0x66ae('0x34')][_0x66ae('0x38')]));_0x4ffb19[_0x66ae('0x37')]=_0x4ffb19[_0x66ae('0x37')][_0x66ae('0x48')]?_0x4ffb19['attributes']:_0x3ac289[_0x66ae('0x31')];if(_0x1db7f2[_0x66ae('0x34')][_0x66ae('0x49')]){_0x4ffb19['include']=[{'all':!![]}];}_0x4ffb19=_[_0x66ae('0x42')]({},_0x4ffb19,_0x1db7f2[_0x66ae('0x43')]);return db[_0x66ae('0x2e')]['find'](_0x4ffb19)[_0x66ae('0x28')](handleEntityNotFound(_0x5f35ee,null))[_0x66ae('0x28')](respondWithResult(_0x5f35ee,null))[_0x66ae('0x45')](handleError(_0x5f35ee,null));};exports[_0x66ae('0x4a')]=function(_0x4a0fcc,_0x115073){return db[_0x66ae('0x2e')][_0x66ae('0x4a')](_0x4a0fcc['body'],{})[_0x66ae('0x28')](function(_0x52b262){var _0x52f249=_0x4a0fcc['user']['get']({'plain':!![]});if(!_0x52f249)throw new Error(_0x66ae('0x4b'));if(_0x52f249[_0x66ae('0x4c')]===_0x66ae('0x4d')){var _0x1167a1=_0x52b262[_0x66ae('0x4e')]({'plain':!![]});var _0x5ae704=_0x66ae('0x4f');return db[_0x66ae('0x50')][_0x66ae('0x51')]({'where':{'name':_0x5ae704,'userProfileId':_0x52f249[_0x66ae('0x52')]},'raw':!![]})[_0x66ae('0x28')](function(_0x284237){if(_0x284237&&_0x284237['autoAssociation']===0x0){return db[_0x66ae('0x2a')][_0x66ae('0x4a')]({'name':_0x1167a1[_0x66ae('0x33')],'resourceId':_0x1167a1['id'],'type':_0x284237[_0x66ae('0x33')],'sectionId':_0x284237['id']},{})[_0x66ae('0x28')](function(){return _0x52b262;});}else{return _0x52b262;}})['catch'](function(_0x205d0a){logger[_0x66ae('0x2b')](_0x66ae('0x53'),_0x205d0a);throw _0x205d0a;});}return _0x52b262;})[_0x66ae('0x28')](respondWithResult(_0x115073,0xc9))[_0x66ae('0x45')](handleError(_0x115073,null));};exports[_0x66ae('0x27')]=function(_0x1a686d,_0x2ca349){if(_0x1a686d[_0x66ae('0x54')]['id']){delete _0x1a686d[_0x66ae('0x54')]['id'];}return db[_0x66ae('0x2e')][_0x66ae('0x51')]({'where':{'id':_0x1a686d[_0x66ae('0x47')]['id']}})[_0x66ae('0x28')](handleEntityNotFound(_0x2ca349,null))[_0x66ae('0x28')](saveUpdates(_0x1a686d[_0x66ae('0x54')],null))[_0x66ae('0x28')](respondWithResult(_0x2ca349,null))[_0x66ae('0x45')](handleError(_0x2ca349,null));};exports[_0x66ae('0x29')]=function(_0x3898bd,_0x515899){return db['SmsQueue'][_0x66ae('0x51')]({'where':{'id':_0x3898bd[_0x66ae('0x47')]['id']}})['then'](handleEntityNotFound(_0x515899,null))[_0x66ae('0x28')](removeEntity(_0x515899,null))[_0x66ae('0x45')](handleError(_0x515899,null));};exports[_0x66ae('0x55')]=function(_0x57b98d,_0x162ed6){return db[_0x66ae('0x2e')][_0x66ae('0x55')]()[_0x66ae('0x28')](respondWithResult(_0x162ed6,null))[_0x66ae('0x45')](handleError(_0x162ed6,null));};exports['getMembers']=function(_0x393ec8,_0x2cb9ef,_0x3ec66d){var _0x597749={'raw':!![],'where':{}},_0x3b0232={},_0x26fc8e;return db[_0x66ae('0x2e')][_0x66ae('0x56')]({'where':{'id':_0x393ec8[_0x66ae('0x47')]['id']}})[_0x66ae('0x28')](handleEntityNotFound(_0x2cb9ef,null))['then'](function(_0x5b96e7){if(_0x5b96e7){_0x26fc8e=_0x5b96e7[_0x66ae('0x4e')]({'plain':!![]});_0x3b0232[_0x66ae('0x31')]=_[_0x66ae('0x35')](db[_0x66ae('0x57')]['rawAttributes']);_0x3b0232[_0x66ae('0x34')]=_[_0x66ae('0x35')](_0x393ec8[_0x66ae('0x34')]);_0x3b0232[_0x66ae('0x3d')]=_[_0x66ae('0x36')](_0x3b0232[_0x66ae('0x31')],_0x3b0232[_0x66ae('0x34')]);_0x597749['attributes']=_[_0x66ae('0x36')](_0x3b0232[_0x66ae('0x31')],qs[_0x66ae('0x38')](_0x393ec8[_0x66ae('0x34')][_0x66ae('0x38')]));_0x597749[_0x66ae('0x37')]=_0x597749[_0x66ae('0x37')][_0x66ae('0x48')]?_0x597749[_0x66ae('0x37')]:_0x3b0232[_0x66ae('0x31')];if(!_0x393ec8[_0x66ae('0x34')][_0x66ae('0x39')](_0x66ae('0x58'))){_0x597749['limit']=qs[_0x66ae('0x21')](_0x393ec8[_0x66ae('0x34')]['limit']);_0x597749[_0x66ae('0x1f')]=qs[_0x66ae('0x1f')](_0x393ec8[_0x66ae('0x34')][_0x66ae('0x1f')]);}_0x597749[_0x66ae('0x3a')]=qs[_0x66ae('0x3b')](_0x393ec8[_0x66ae('0x34')][_0x66ae('0x3b')]);_0x597749[_0x66ae('0x3c')]=qs['filters'](_[_0x66ae('0x3e')](_0x393ec8[_0x66ae('0x34')],_0x3b0232[_0x66ae('0x3d')]));_0x597749[_0x66ae('0x3c')][_0x66ae('0x59')]=_0x5b96e7['id'];if(_0x393ec8[_0x66ae('0x34')][_0x66ae('0x3f')]){_0x597749['where']=_['merge'](_0x597749['where'],{'$or':_[_0x66ae('0x32')](_0x597749['attributes'],function(_0xbb432a){var _0x4ab6f9={};_0x4ab6f9[_0xbb432a]={'$like':'%'+_0x393ec8[_0x66ae('0x34')]['filter']+'%'};return _0x4ab6f9;})});}_0x597749=_[_0x66ae('0x42')]({},_0x597749,_0x393ec8[_0x66ae('0x43')]);return db[_0x66ae('0x57')][_0x66ae('0x5a')](_0x597749);}})[_0x66ae('0x28')](function(_0x8a032d){if(_0x8a032d){return db['User'][_0x66ae('0x5b')]({'where':{'id':_[_0x66ae('0x32')](_0x8a032d,'UserId'),'role':_0x66ae('0x5c')},'attributes':['id',_0x66ae('0x33'),_0x66ae('0x5d'),_0x66ae('0x5e'),'createdAt']});}})['then'](function(_0x29048a){if(_0x29048a){return{'count':_0x29048a['count'],'rows':_[_0x66ae('0x32')](_0x29048a['rows'],function(_0x380bc6){return{'membername':_0x380bc6[_0x66ae('0x33')],'UserId':_0x380bc6['id'],'queue_name':_0x26fc8e[_0x66ae('0x33')],'SmsQueueId':_0x26fc8e['id'],'interface':util[_0x66ae('0x5f')]('%s/%s','SIP',_0x380bc6[_0x66ae('0x33')]),'penalty':0x0,'paused':_0x380bc6[_0x66ae('0x5d')],'createdAt':_0x380bc6['createdAt'],'updatedAt':_0x380bc6[_0x66ae('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2cb9ef,_0x597749))[_0x66ae('0x45')](handleError(_0x2cb9ef,null));};exports[_0x66ae('0x60')]=function(_0x53701d,_0x3c4985,_0x576284){var _0x1acd85={};var _0x47cae3={};var _0x2ce1de;var _0x5b805a;return db['SmsQueue'][_0x66ae('0x56')]({'where':{'id':_0x53701d[_0x66ae('0x47')]['id']}})[_0x66ae('0x28')](handleEntityNotFound(_0x3c4985,null))[_0x66ae('0x28')](function(_0x256a2d){if(_0x256a2d){_0x2ce1de=_0x256a2d;_0x47cae3[_0x66ae('0x31')]=_['keys'](db['Team']['rawAttributes']);_0x47cae3[_0x66ae('0x34')]=_['keys'](_0x53701d['query']);_0x47cae3[_0x66ae('0x3d')]=_['intersection'](_0x47cae3[_0x66ae('0x31')],_0x47cae3[_0x66ae('0x34')]);_0x1acd85[_0x66ae('0x37')]=_[_0x66ae('0x36')](_0x47cae3[_0x66ae('0x31')],qs[_0x66ae('0x38')](_0x53701d['query'][_0x66ae('0x38')]));_0x1acd85[_0x66ae('0x37')]=_0x1acd85[_0x66ae('0x37')][_0x66ae('0x48')]?_0x1acd85[_0x66ae('0x37')]:_0x47cae3[_0x66ae('0x31')];_0x1acd85['order']=qs['sort'](_0x53701d[_0x66ae('0x34')]['sort']);_0x1acd85['where']=qs[_0x66ae('0x3d')](_[_0x66ae('0x3e')](_0x53701d['query'],_0x47cae3['filters']));if(_0x53701d['query']['filter']){_0x1acd85[_0x66ae('0x3c')]=_[_0x66ae('0x42')](_0x1acd85[_0x66ae('0x3c')],{'$or':_['map'](_0x1acd85[_0x66ae('0x37')],function(_0x242d3c){var _0xa99cbf={};_0xa99cbf[_0x242d3c]={'$like':'%'+_0x53701d[_0x66ae('0x34')][_0x66ae('0x3f')]+'%'};return _0xa99cbf;})});}_0x1acd85=_[_0x66ae('0x42')]({},_0x1acd85,_0x53701d['options']);return _0x2ce1de[_0x66ae('0x60')](_0x1acd85);}})['then'](function(_0x509c63){if(_0x509c63){_0x5b805a=_0x509c63[_0x66ae('0x48')];if(!_0x53701d[_0x66ae('0x34')][_0x66ae('0x39')](_0x66ae('0x58'))){_0x1acd85[_0x66ae('0x21')]=qs[_0x66ae('0x21')](_0x53701d[_0x66ae('0x34')][_0x66ae('0x21')]);_0x1acd85[_0x66ae('0x1f')]=qs[_0x66ae('0x1f')](_0x53701d[_0x66ae('0x34')][_0x66ae('0x1f')]);}return _0x2ce1de[_0x66ae('0x60')](_0x1acd85);}})[_0x66ae('0x28')](function(_0x716b4){if(_0x716b4){return _0x716b4?{'count':_0x5b805a,'rows':_0x716b4}:null;}})['then'](respondWithResult(_0x3c4985,null))['catch'](handleError(_0x3c4985,null));};exports[_0x66ae('0x61')]=function(_0x303f11,_0x2efb00,_0x451e41){var _0x53055d=_0x303f11[_0x66ae('0x54')]['ids'];return db[_0x66ae('0x62')][_0x66ae('0x5a')]({'where':{'id':_0x53055d},'attributes':['id'],'include':[{'model':db[_0x66ae('0x63')],'as':_0x66ae('0x64'),'attributes':['id',_0x66ae('0x33'),'online','voicePause','interface'],'raw':!![]}]})['then'](function(_0x4c65aa){if(_0x4c65aa){var _0x3939d4=_[_0x66ae('0x65')](_0x4c65aa,function(_0xa8bc0c){var _0x2082d9=_0xa8bc0c[_0x66ae('0x4e')]({'plain':!![]});return _0x2082d9[_0x66ae('0x64')];});return db[_0x66ae('0x2e')][_0x66ae('0x51')]({'where':{'id':_0x303f11['params']['id']}})[_0x66ae('0x28')](function(_0x3f97cb){return db[_0x66ae('0x66')][_0x66ae('0x67')](function(_0x124c66){return _0x3f97cb[_0x66ae('0x61')](_0x53055d,{'transaction':_0x124c66})[_0x66ae('0x28')](function(){return BPromise[_0x66ae('0x68')](_0x3939d4,function(_0x3fd499){return db['UserSmsQueue'][_0x66ae('0x69')]({'where':{'UserId':_0x3fd499['id'],'SmsQueueId':_0x303f11[_0x66ae('0x47')]['id']},'transaction':_0x124c66});});})[_0x66ae('0x28')](function(){_0x3939d4[_0x66ae('0x6a')](function(_0x4e5fe3){socket[_0x66ae('0x6b')](_0x66ae('0x6c'),{'UserId':_0x4e5fe3['id'],'SmsQueueId':_0x3f97cb['id']});});});});});}})[_0x66ae('0x28')](respondWithStatusCode(_0x2efb00,null))[_0x66ae('0x45')](handleError(_0x2efb00,null));};exports[_0x66ae('0x6d')]=function(_0x759bbb,_0x37e97f,_0x4af7d6){return db[_0x66ae('0x62')]['findAll']({'where':{'id':_0x759bbb['query'][_0x66ae('0x6e')]},'attributes':['id'],'include':[{'model':db[_0x66ae('0x63')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x37e97f,null))['then'](function(_0x287a42){var _0x30d1a0=_[_0x66ae('0x32')](_0x287a42,'id');var _0x192a1d=[];var _0x34dc1f=[];var _0x179c26=squel[_0x66ae('0x6f')]();_0x179c26[_0x66ae('0x70')]('tq.TeamId')[_0x66ae('0x71')](_0x66ae('0x72'),'tq')[_0x66ae('0x73')](_0x66ae('0x74'),'ut',_0x66ae('0x75'))[_0x66ae('0x3c')](_0x66ae('0x76'),_0x759bbb['params']['id']);for(var _0x9477f1=0x0;_0x9477f1<_0x287a42[_0x66ae('0x48')];_0x9477f1+=0x1){let _0x177fed=_0x287a42[_0x9477f1];for(var _0x1d7c01=0x0;_0x1d7c01<_0x177fed[_0x66ae('0x64')][_0x66ae('0x48')];_0x1d7c01+=0x1){let _0x57dcec=_0x177fed[_0x66ae('0x64')][_0x1d7c01];var _0x397288=_0x179c26[_0x66ae('0x77')]();_0x397288[_0x66ae('0x3c')]('ut.UserId\x20=\x20?',_0x57dcec['id']);_0x34dc1f[_0x66ae('0x78')](db['sequelize'][_0x66ae('0x34')](_0x397288[_0x66ae('0x79')](),{'type':db['sequelize'][_0x66ae('0x7a')][_0x66ae('0x7b')]})['then'](function(_0x8861fb){if(_0x8861fb['length']===0x1){return _0x57dcec['id'];}else{var _0x4b4c00=_[_0x66ae('0x7c')](_[_0x66ae('0x32')](_0x8861fb,_0x66ae('0x7d')),function(_0x1696af){return _[_0x66ae('0x7e')](_0x30d1a0,_0x1696af);});if(_0x4b4c00){return _0x57dcec['id'];}}}));}}return BPromise[_0x66ae('0x7f')](_0x34dc1f)[_0x66ae('0x28')](function(_0x50934a){_0x192a1d=_(_0x192a1d)[_0x66ae('0x80')](_0x50934a)[_0x66ae('0x81')]()[_0x66ae('0x82')]();return db['SmsQueue']['find']({'where':{'id':_0x759bbb[_0x66ae('0x47')]['id']}})['then'](function(_0x2e5fb2){return db['sequelize'][_0x66ae('0x67')](function(_0x4542af){return _0x2e5fb2['removeTeams'](_0x759bbb['query']['ids'],{'transaction':_0x4542af})[_0x66ae('0x28')](function(){if(!_[_0x66ae('0x83')](_0x192a1d)){return _0x2e5fb2[_0x66ae('0x84')](_0x192a1d,{'transaction':_0x4542af});}})[_0x66ae('0x28')](function(){_0x192a1d['forEach'](function(_0x3841df){socket['emit']('userSmsQueue:remove',{'UserId':_0x3841df,'SmsQueueId':_0x2e5fb2['id']});});});});});});})[_0x66ae('0x28')](respondWithStatusCode(_0x37e97f,null))[_0x66ae('0x45')](handleError(_0x37e97f,null));};exports['addAgents']=function(_0x1e8d6d,_0x10a058,_0x2d100e){return db['SmsQueue'][_0x66ae('0x51')]({'where':{'id':_0x1e8d6d['params']['id']}})['then'](handleEntityNotFound(_0x10a058,null))[_0x66ae('0x28')](function(_0x30050f){if(_0x30050f){return _0x30050f['addAgents'](_0x1e8d6d[_0x66ae('0x54')][_0x66ae('0x6e')],_[_0x66ae('0x85')](_0x1e8d6d[_0x66ae('0x54')],[_0x66ae('0x6e'),'id'])||{})[_0x66ae('0x86')](function(_0x237377){for(var _0x46bb6e=0x0;_0x46bb6e<_0x1e8d6d['body'][_0x66ae('0x6e')][_0x66ae('0x48')];_0x46bb6e+=0x1){socket[_0x66ae('0x6b')](_0x66ae('0x6c'),{'UserId':Number(_0x1e8d6d['body'][_0x66ae('0x6e')][_0x46bb6e]),'SmsQueueId':Number(_0x1e8d6d['params']['id'])});}return _0x237377;});}})[_0x66ae('0x28')](respondWithResult(_0x10a058,null))[_0x66ae('0x45')](handleError(_0x10a058,null));};exports[_0x66ae('0x84')]=function(_0x454828,_0x5ca190,_0x4e065e){return db['SmsQueue'][_0x66ae('0x51')]({'where':{'id':_0x454828[_0x66ae('0x47')]['id']}})[_0x66ae('0x28')](handleEntityNotFound(_0x5ca190,null))['then'](function(_0x543a4e){if(_0x543a4e){return _0x543a4e['removeAgents'](_0x454828['query']['ids'])['then'](function(){if(_['isArray'](_0x454828['query'][_0x66ae('0x6e')])){for(var _0x1f6d4a=0x0;_0x1f6d4a<_0x454828[_0x66ae('0x34')]['ids'][_0x66ae('0x48')];_0x1f6d4a+=0x1){socket[_0x66ae('0x6b')]('userSmsQueue:remove',{'UserId':Number(_0x454828[_0x66ae('0x34')][_0x66ae('0x6e')][_0x1f6d4a]),'SmsQueueId':Number(_0x454828[_0x66ae('0x47')]['id'])});}}else{socket[_0x66ae('0x6b')]('userSmsQueue:remove',{'UserId':Number(_0x454828[_0x66ae('0x34')][_0x66ae('0x6e')]),'SmsQueueId':Number(_0x454828[_0x66ae('0x47')]['id'])});}});}})[_0x66ae('0x28')](respondWithStatusCode(_0x5ca190,null))[_0x66ae('0x45')](handleError(_0x5ca190,null));};exports[_0x66ae('0x87')]=function(_0xe2d7db,_0x423353,_0x13b4a5){var _0x46d0c6={};var _0x586a1c={};var _0x26ed3f;var _0x26b862;return db[_0x66ae('0x2e')][_0x66ae('0x56')]({'where':{'id':_0xe2d7db['params']['id']}})[_0x66ae('0x28')](handleEntityNotFound(_0x423353,null))[_0x66ae('0x28')](function(_0x1f9f9e){if(_0x1f9f9e){_0x26ed3f=_0x1f9f9e;_0x586a1c[_0x66ae('0x31')]=_[_0x66ae('0x35')](db[_0x66ae('0x63')][_0x66ae('0x88')]);_0x586a1c[_0x66ae('0x34')]=_[_0x66ae('0x35')](_0xe2d7db[_0x66ae('0x34')]);_0x586a1c[_0x66ae('0x3d')]=_[_0x66ae('0x36')](_0x586a1c[_0x66ae('0x31')],_0x586a1c[_0x66ae('0x34')]);_0x46d0c6['attributes']=_[_0x66ae('0x36')](_0x586a1c[_0x66ae('0x31')],qs[_0x66ae('0x38')](_0xe2d7db[_0x66ae('0x34')][_0x66ae('0x38')]));_0x46d0c6[_0x66ae('0x37')]=_0x46d0c6['attributes'][_0x66ae('0x48')]?_0x46d0c6[_0x66ae('0x37')]:_0x586a1c[_0x66ae('0x31')];_0x46d0c6['order']=qs[_0x66ae('0x3b')](_0xe2d7db[_0x66ae('0x34')]['sort']);_0x46d0c6[_0x66ae('0x3c')]=qs[_0x66ae('0x3d')](_[_0x66ae('0x3e')](_0xe2d7db[_0x66ae('0x34')],_0x586a1c['filters']));if(_0xe2d7db[_0x66ae('0x34')][_0x66ae('0x3f')]){_0x46d0c6['where']=_['merge'](_0x46d0c6['where'],{'$or':_[_0x66ae('0x32')](_0x46d0c6[_0x66ae('0x37')],function(_0x1b5101){var _0x1e8a96={};_0x1e8a96[_0x1b5101]={'$like':'%'+_0xe2d7db[_0x66ae('0x34')][_0x66ae('0x3f')]+'%'};return _0x1e8a96;})});}_0x46d0c6=_[_0x66ae('0x42')]({},_0x46d0c6,_0xe2d7db['options']);return _0x26ed3f[_0x66ae('0x87')](_0x46d0c6);}})[_0x66ae('0x28')](function(_0x50db11){if(_0x50db11){_0x26b862=_0x50db11[_0x66ae('0x48')];if(!_0xe2d7db[_0x66ae('0x34')][_0x66ae('0x39')](_0x66ae('0x58'))){_0x46d0c6['limit']=qs['limit'](_0xe2d7db['query'][_0x66ae('0x21')]);_0x46d0c6[_0x66ae('0x1f')]=qs[_0x66ae('0x1f')](_0xe2d7db['query'][_0x66ae('0x1f')]);}return _0x26ed3f[_0x66ae('0x87')](_0x46d0c6);}})['then'](function(_0x399b49){if(_0x399b49){return _0x399b49?{'count':_0x26b862,'rows':_0x399b49}:null;}})[_0x66ae('0x28')](respondWithResult(_0x423353,null))[_0x66ae('0x45')](handleError(_0x423353,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 0ba91e6..e3a85dd 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 _0x60ce=['../../mysqldb','SmsQueue','setMaxListeners','save','update','emit'];(function(_0x5df100,_0x1e83ba){var _0x2d525d=function(_0x535c94){while(--_0x535c94){_0x5df100['push'](_0x5df100['shift']());}};_0x2d525d(++_0x1e83ba);}(_0x60ce,0xd8));var _0xe60c=function(_0x47b05a,_0x1c31d3){_0x47b05a=_0x47b05a-0x0;var _0x81470=_0x60ce[_0x47b05a];return _0x81470;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0xe60c('0x0'))['db'][_0xe60c('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xe60c('0x2')](0x0);var events={'afterCreate':_0xe60c('0x3'),'afterUpdate':_0xe60c('0x4'),'afterDestroy':'remove'};function emitEvent(_0x318d8e){return function(_0x3343fe,_0x14c4d5,_0x4260d1){SmsQueueEvents[_0xe60c('0x5')](_0x318d8e+':'+_0x3343fe['id'],_0x3343fe);SmsQueueEvents[_0xe60c('0x5')](_0x318d8e,_0x3343fe);_0x4260d1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0x543c=['setMaxListeners','save','remove','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x1423f3,_0x41e3fa){var _0x4ccede=function(_0x5bcf24){while(--_0x5bcf24){_0x1423f3['push'](_0x1423f3['shift']());}};_0x4ccede(++_0x41e3fa);}(_0x543c,0x10f));var _0xc543=function(_0x11309c,_0xe18a74){_0x11309c=_0x11309c-0x0;var _0x3fea9c=_0x543c[_0x11309c];return _0x3fea9c;};'use strict';var EventEmitter=require(_0xc543('0x0'));var SmsQueue=require(_0xc543('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xc543('0x2')](0x0);var events={'afterCreate':_0xc543('0x3'),'afterUpdate':'update','afterDestroy':_0xc543('0x4')};function emitEvent(_0x543562){return function(_0x58599f,_0x369169,_0x21719b){SmsQueueEvents['emit'](_0x543562+':'+_0x58599f['id'],_0x58599f);SmsQueueEvents['emit'](_0x543562,_0x58599f);_0x21719b(null);};}for(var e in events){if(events[_0xc543('0x5')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0xc543('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 68c241d..726eff7 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 _0xe4db=['bluebird','request-promise','path','rimraf','./smsQueue.attributes','exports','define','SmsQueue','lodash','util','../../config/logger'];(function(_0x4bfcbe,_0x4630f5){var _0x5b65e6=function(_0x5dcfc8){while(--_0x5dcfc8){_0x4bfcbe['push'](_0x4bfcbe['shift']());}};_0x5b65e6(++_0x4630f5);}(_0xe4db,0x173));var _0xbe4d=function(_0x4e398e,_0x46fa97){_0x4e398e=_0x4e398e-0x0;var _0x52b090=_0xe4db[_0x4e398e];return _0x52b090;};'use strict';var _=require(_0xbe4d('0x0'));var util=require(_0xbe4d('0x1'));var logger=require(_0xbe4d('0x2'))('api');var moment=require('moment');var BPromise=require(_0xbe4d('0x3'));var rp=require(_0xbe4d('0x4'));var fs=require('fs');var path=require(_0xbe4d('0x5'));var rimraf=require(_0xbe4d('0x6'));var config=require('../../config/environment');var attributes=require(_0xbe4d('0x7'));module[_0xbe4d('0x8')]=function(_0x1421d9,_0x315cc6){return _0x1421d9[_0xbe4d('0x9')](_0xbe4d('0xa'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x84c6=['../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','sms_queues'];(function(_0x18894b,_0xb20093){var _0x4b3230=function(_0x434091){while(--_0x434091){_0x18894b['push'](_0x18894b['shift']());}};_0x4b3230(++_0xb20093);}(_0x84c6,0xe7));var _0x684c=function(_0x3bf265,_0x24ebd6){_0x3bf265=_0x3bf265-0x0;var _0x40ef92=_0x84c6[_0x3bf265];return _0x40ef92;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x684c('0x0'))(_0x684c('0x1'));var moment=require(_0x684c('0x2'));var BPromise=require('bluebird');var rp=require(_0x684c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x684c('0x4'));var config=require(_0x684c('0x5'));var attributes=require(_0x684c('0x6'));module[_0x684c('0x7')]=function(_0x235995,_0x2765a8){return _0x235995[_0x684c('0x8')](_0x684c('0x9'),attributes,{'tableName':_0x684c('0xa'),'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 a7cd99b..bd1a0e6 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 _0xde78=['attributes','limit','include','map','model','ShowSmsQueue','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','socket.io-emitter','./smsQueue.socket','register','request','then','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetSmsQueue','SmsQueue','options','raw','where'];(function(_0x3e8a3d,_0x1d14c0){var _0xd88795=function(_0x45d2e5){while(--_0x45d2e5){_0x3e8a3d['push'](_0x3e8a3d['shift']());}};_0xd88795(++_0x1d14c0);}(_0xde78,0x13e));var _0x8de7=function(_0x3ce2c4,_0x4544c1){_0x3ce2c4=_0x3ce2c4-0x0;var _0x4047c1=_0xde78[_0x3ce2c4];return _0x4047c1;};'use strict';var _=require(_0x8de7('0x0'));var util=require(_0x8de7('0x1'));var moment=require(_0x8de7('0x2'));var BPromise=require(_0x8de7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8de7('0x4'))['db'];var utils=require(_0x8de7('0x5'));var logger=require(_0x8de7('0x6'))(_0x8de7('0x7'));var config=require('../../config/environment');var jayson=require(_0x8de7('0x8'));var client=jayson[_0x8de7('0x9')][_0x8de7('0xa')]({'port':0x232a});config[_0x8de7('0xb')]=_['defaults'](config[_0x8de7('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x8de7('0xc'))(new Redis(config['redis']));require(_0x8de7('0xd'))[_0x8de7('0xe')](socket);function respondWithRpcPromise(_0x51c20b,_0x27ddd6,_0x53bb62){return new BPromise(function(_0x22c306,_0x18c299){return client[_0x8de7('0xf')](_0x51c20b,_0x53bb62)[_0x8de7('0x10')](function(_0x166d68){logger['info'](_0x8de7('0x11'),_0x27ddd6,_0x8de7('0x12'));logger[_0x8de7('0x13')](_0x8de7('0x14'),_0x27ddd6,_0x8de7('0x12'),JSON[_0x8de7('0x15')](_0x166d68));if(_0x166d68[_0x8de7('0x16')]){if(_0x166d68[_0x8de7('0x16')][_0x8de7('0x17')]===0x1f4){logger['error'](_0x8de7('0x11'),_0x27ddd6,_0x166d68[_0x8de7('0x16')][_0x8de7('0x18')]);return _0x18c299(_0x166d68[_0x8de7('0x16')][_0x8de7('0x18')]);}logger[_0x8de7('0x16')](_0x8de7('0x11'),_0x27ddd6,_0x166d68[_0x8de7('0x16')][_0x8de7('0x18')]);return _0x22c306(_0x166d68[_0x8de7('0x16')][_0x8de7('0x18')]);}else{logger[_0x8de7('0x19')]('SmsQueue,\x20%s,\x20%s',_0x27ddd6,_0x8de7('0x12'));_0x22c306(_0x166d68[_0x8de7('0x1a')][_0x8de7('0x18')]);}})[_0x8de7('0x1b')](function(_0x37c32e){logger[_0x8de7('0x16')](_0x8de7('0x11'),_0x27ddd6,_0x37c32e);_0x18c299(_0x37c32e);});});}exports[_0x8de7('0x1c')]=function(_0x1aa58e){var _0x444f8e=this;return new Promise(function(_0x453a95,_0x1d8c87){return db[_0x8de7('0x1d')]['findAll']({'raw':_0x1aa58e[_0x8de7('0x1e')]?_0x1aa58e[_0x8de7('0x1e')][_0x8de7('0x1f')]===undefined?!![]:![]:!![],'where':_0x1aa58e[_0x8de7('0x1e')]?_0x1aa58e[_0x8de7('0x1e')][_0x8de7('0x20')]||null:null,'attributes':_0x1aa58e[_0x8de7('0x1e')]?_0x1aa58e[_0x8de7('0x1e')][_0x8de7('0x21')]||null:null,'limit':_0x1aa58e['options']?_0x1aa58e[_0x8de7('0x1e')][_0x8de7('0x22')]||null:null,'include':_0x1aa58e[_0x8de7('0x1e')]?_0x1aa58e[_0x8de7('0x1e')][_0x8de7('0x23')]?_[_0x8de7('0x24')](_0x1aa58e[_0x8de7('0x1e')]['include'],function(_0x388539){return{'model':db[_0x388539['model']],'as':_0x388539['as'],'attributes':_0x388539['attributes'],'include':_0x388539[_0x8de7('0x23')]?_['map'](_0x388539[_0x8de7('0x23')],function(_0xd85839){return{'model':db[_0xd85839[_0x8de7('0x25')]],'as':_0xd85839['as'],'attributes':_0xd85839[_0x8de7('0x21')],'include':_0xd85839['include']?_[_0x8de7('0x24')](_0xd85839[_0x8de7('0x23')],function(_0x9c33e7){return{'model':db[_0x9c33e7[_0x8de7('0x25')]],'as':_0x9c33e7['as'],'attributes':_0x9c33e7[_0x8de7('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x337409){logger[_0x8de7('0x19')](_0x8de7('0x1c'),_0x1aa58e);logger[_0x8de7('0x13')](_0x8de7('0x1c'),_0x1aa58e,JSON[_0x8de7('0x15')](_0x337409));_0x453a95(_0x337409);})[_0x8de7('0x1b')](function(_0x3bd8ca){logger['error'](_0x8de7('0x1c'),_0x3bd8ca[_0x8de7('0x18')],_0x1aa58e);_0x1d8c87(_0x444f8e[_0x8de7('0x16')](0x1f4,_0x3bd8ca['message']));});});};exports[_0x8de7('0x26')]=function(_0x3ac6ce){var _0x51656d=this;return new Promise(function(_0x2f39eb,_0x2ab372){return db[_0x8de7('0x1d')]['find']({'raw':_0x3ac6ce[_0x8de7('0x1e')]?_0x3ac6ce[_0x8de7('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x3ac6ce['options']?_0x3ac6ce[_0x8de7('0x1e')][_0x8de7('0x20')]||null:null,'attributes':_0x3ac6ce[_0x8de7('0x1e')]?_0x3ac6ce['options'][_0x8de7('0x21')]||null:null,'include':_0x3ac6ce[_0x8de7('0x1e')]?_0x3ac6ce['options'][_0x8de7('0x23')]?_[_0x8de7('0x24')](_0x3ac6ce[_0x8de7('0x1e')]['include'],function(_0x3903a6){return{'model':db[_0x3903a6[_0x8de7('0x25')]],'as':_0x3903a6['as'],'attributes':_0x3903a6[_0x8de7('0x21')],'include':_0x3903a6[_0x8de7('0x23')]?_[_0x8de7('0x24')](_0x3903a6[_0x8de7('0x23')],function(_0x38d464){return{'model':db[_0x38d464[_0x8de7('0x25')]],'as':_0x38d464['as'],'attributes':_0x38d464[_0x8de7('0x21')],'include':_0x38d464[_0x8de7('0x23')]?_[_0x8de7('0x24')](_0x38d464['include'],function(_0x3cafeb){return{'model':db[_0x3cafeb['model']],'as':_0x3cafeb['as'],'attributes':_0x3cafeb[_0x8de7('0x21')]};}):[]};}):[]};}):[]:[]})[_0x8de7('0x10')](function(_0x566ab6){logger['info'](_0x8de7('0x26'),_0x3ac6ce);logger[_0x8de7('0x13')](_0x8de7('0x26'),_0x3ac6ce,JSON['stringify'](_0x566ab6));_0x2f39eb(_0x566ab6);})[_0x8de7('0x1b')](function(_0x5d7932){logger['error'](_0x8de7('0x26'),_0x5d7932['message'],_0x3ac6ce);_0x2ab372(_0x51656d[_0x8de7('0x16')](0x1f4,_0x5d7932['message']));});});}; \ No newline at end of file +var _0x3827=['findAll','options','raw','where','limit','map','include','attributes','model','catch','ShowSmsQueue','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./smsQueue.socket','register','then','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','error','SmsQueue,\x20%s,\x20%s','message','info','result','GetSmsQueue','SmsQueue'];(function(_0x384e63,_0x3cdb06){var _0x163527=function(_0x3ba64c){while(--_0x3ba64c){_0x384e63['push'](_0x384e63['shift']());}};_0x163527(++_0x3cdb06);}(_0x3827,0x84));var _0x7382=function(_0x56916d,_0x37b935){_0x56916d=_0x56916d-0x0;var _0x2b7f1f=_0x3827[_0x56916d];return _0x2b7f1f;};'use strict';var _=require(_0x7382('0x0'));var util=require(_0x7382('0x1'));var moment=require(_0x7382('0x2'));var BPromise=require(_0x7382('0x3'));var rs=require(_0x7382('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7382('0x5'))['db'];var utils=require(_0x7382('0x6'));var logger=require(_0x7382('0x7'))(_0x7382('0x8'));var config=require(_0x7382('0x9'));var jayson=require(_0x7382('0xa'));var client=jayson[_0x7382('0xb')][_0x7382('0xc')]({'port':0x232a});config[_0x7382('0xd')]=_[_0x7382('0xe')](config[_0x7382('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7382('0xd')]));require(_0x7382('0xf'))[_0x7382('0x10')](socket);function respondWithRpcPromise(_0x2c9a13,_0x2cd29d,_0x28dab3){return new BPromise(function(_0x4d0793,_0xdf542b){return client['request'](_0x2c9a13,_0x28dab3)[_0x7382('0x11')](function(_0x29847e){logger['info']('SmsQueue,\x20%s,\x20%s',_0x2cd29d,_0x7382('0x12'));logger[_0x7382('0x13')](_0x7382('0x14'),_0x2cd29d,_0x7382('0x12'),JSON['stringify'](_0x29847e));if(_0x29847e[_0x7382('0x15')]){if(_0x29847e[_0x7382('0x15')]['code']===0x1f4){logger[_0x7382('0x15')](_0x7382('0x16'),_0x2cd29d,_0x29847e[_0x7382('0x15')][_0x7382('0x17')]);return _0xdf542b(_0x29847e[_0x7382('0x15')]['message']);}logger['error'](_0x7382('0x16'),_0x2cd29d,_0x29847e['error'][_0x7382('0x17')]);return _0x4d0793(_0x29847e[_0x7382('0x15')][_0x7382('0x17')]);}else{logger[_0x7382('0x18')]('SmsQueue,\x20%s,\x20%s',_0x2cd29d,'request\x20sent');_0x4d0793(_0x29847e[_0x7382('0x19')][_0x7382('0x17')]);}})['catch'](function(_0x3b8465){logger['error'](_0x7382('0x16'),_0x2cd29d,_0x3b8465);_0xdf542b(_0x3b8465);});});}exports[_0x7382('0x1a')]=function(_0x4693ec){var _0x30d96b=this;return new Promise(function(_0x2ebc08,_0x3cf4c1){return db[_0x7382('0x1b')][_0x7382('0x1c')]({'raw':_0x4693ec[_0x7382('0x1d')]?_0x4693ec[_0x7382('0x1d')][_0x7382('0x1e')]===undefined?!![]:![]:!![],'where':_0x4693ec[_0x7382('0x1d')]?_0x4693ec[_0x7382('0x1d')][_0x7382('0x1f')]||null:null,'attributes':_0x4693ec['options']?_0x4693ec[_0x7382('0x1d')]['attributes']||null:null,'limit':_0x4693ec['options']?_0x4693ec['options'][_0x7382('0x20')]||null:null,'include':_0x4693ec[_0x7382('0x1d')]?_0x4693ec[_0x7382('0x1d')]['include']?_[_0x7382('0x21')](_0x4693ec[_0x7382('0x1d')][_0x7382('0x22')],function(_0x237388){return{'model':db[_0x237388['model']],'as':_0x237388['as'],'attributes':_0x237388[_0x7382('0x23')],'include':_0x237388['include']?_[_0x7382('0x21')](_0x237388[_0x7382('0x22')],function(_0xd6629b){return{'model':db[_0xd6629b[_0x7382('0x24')]],'as':_0xd6629b['as'],'attributes':_0xd6629b[_0x7382('0x23')],'include':_0xd6629b[_0x7382('0x22')]?_[_0x7382('0x21')](_0xd6629b[_0x7382('0x22')],function(_0xaad5f8){return{'model':db[_0xaad5f8[_0x7382('0x24')]],'as':_0xaad5f8['as'],'attributes':_0xaad5f8[_0x7382('0x23')]};}):[]};}):[]};}):[]:[]})[_0x7382('0x11')](function(_0x56c04c){logger[_0x7382('0x18')](_0x7382('0x1a'),_0x4693ec);logger[_0x7382('0x13')]('GetSmsQueue',_0x4693ec,JSON['stringify'](_0x56c04c));_0x2ebc08(_0x56c04c);})[_0x7382('0x25')](function(_0x5e0891){logger[_0x7382('0x15')](_0x7382('0x1a'),_0x5e0891[_0x7382('0x17')],_0x4693ec);_0x3cf4c1(_0x30d96b[_0x7382('0x15')](0x1f4,_0x5e0891[_0x7382('0x17')]));});});};exports[_0x7382('0x26')]=function(_0x563e66){var _0x349858=this;return new Promise(function(_0x324d9b,_0x5e5208){return db['SmsQueue'][_0x7382('0x27')]({'raw':_0x563e66['options']?_0x563e66[_0x7382('0x1d')][_0x7382('0x1e')]===undefined?!![]:![]:!![],'where':_0x563e66['options']?_0x563e66['options'][_0x7382('0x1f')]||null:null,'attributes':_0x563e66[_0x7382('0x1d')]?_0x563e66['options'][_0x7382('0x23')]||null:null,'include':_0x563e66[_0x7382('0x1d')]?_0x563e66[_0x7382('0x1d')]['include']?_[_0x7382('0x21')](_0x563e66[_0x7382('0x1d')][_0x7382('0x22')],function(_0x37867d){return{'model':db[_0x37867d[_0x7382('0x24')]],'as':_0x37867d['as'],'attributes':_0x37867d[_0x7382('0x23')],'include':_0x37867d[_0x7382('0x22')]?_[_0x7382('0x21')](_0x37867d[_0x7382('0x22')],function(_0x24f74d){return{'model':db[_0x24f74d[_0x7382('0x24')]],'as':_0x24f74d['as'],'attributes':_0x24f74d[_0x7382('0x23')],'include':_0x24f74d['include']?_[_0x7382('0x21')](_0x24f74d[_0x7382('0x22')],function(_0x4b1055){return{'model':db[_0x4b1055[_0x7382('0x24')]],'as':_0x4b1055['as'],'attributes':_0x4b1055[_0x7382('0x23')]};}):[]};}):[]};}):[]:[]})[_0x7382('0x11')](function(_0x3bbe71){logger['info'](_0x7382('0x26'),_0x563e66);logger[_0x7382('0x13')](_0x7382('0x26'),_0x563e66,JSON['stringify'](_0x3bbe71));_0x324d9b(_0x3bbe71);})['catch'](function(_0x1b2d84){logger[_0x7382('0x15')](_0x7382('0x26'),_0x1b2d84[_0x7382('0x17')],_0x563e66);_0x5e5208(_0x349858[_0x7382('0x15')](0x1f4,_0x1b2d84[_0x7382('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index ece7251..9670737 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 _0x8ad9=['emit','removeListener','smsQueue:','./smsQueue.events','save','remove','update'];(function(_0x40911a,_0x55ec99){var _0x27e8e3=function(_0x2ba910){while(--_0x2ba910){_0x40911a['push'](_0x40911a['shift']());}};_0x27e8e3(++_0x55ec99);}(_0x8ad9,0x96));var _0x98ad=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x8ad9[_0x4a53d];return _0x27410e;};'use strict';var SmsQueueEvents=require(_0x98ad('0x0'));var events=[_0x98ad('0x1'),_0x98ad('0x2'),_0x98ad('0x3')];function createListener(_0x473c6e,_0x580ab6){return function(_0x3ce47c){_0x580ab6[_0x98ad('0x4')](_0x473c6e,_0x3ce47c);};}function removeListener(_0x540bb8,_0x1e7b04){return function(){SmsQueueEvents[_0x98ad('0x5')](_0x540bb8,_0x1e7b04);};}exports['register']=function(_0x1b8b77){for(var _0x4b8663=0x0,_0x25fb2b=events['length'];_0x4b8663<_0x25fb2b;_0x4b8663++){var _0x4046e0=events[_0x4b8663];var _0x45f288=createListener(_0x98ad('0x6')+_0x4046e0,_0x1b8b77);SmsQueueEvents['on'](_0x4046e0,_0x45f288);}}; \ No newline at end of file +var _0x1d2e=['removeListener','./smsQueue.events','remove','emit'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x1d2e,0x1c9));var _0xe1d2=function(_0x570a1e,_0x1ba7b5){_0x570a1e=_0x570a1e-0x0;var _0x469084=_0x1d2e[_0x570a1e];return _0x469084;};'use strict';var SmsQueueEvents=require(_0xe1d2('0x0'));var events=['save',_0xe1d2('0x1'),'update'];function createListener(_0x28b50a,_0x4d122c){return function(_0x593c14){_0x4d122c[_0xe1d2('0x2')](_0x28b50a,_0x593c14);};}function removeListener(_0x41daf7,_0x26ec16){return function(){SmsQueueEvents[_0xe1d2('0x3')](_0x41daf7,_0x26ec16);};}exports['register']=function(_0x5c76d6){for(var _0x4db5e2=0x0,_0x71dbbc=events['length'];_0x4db5e2<_0x71dbbc;_0x4db5e2++){var _0x1e2727=events[_0x4db5e2];var _0x26d8b3=createListener('smsQueue:'+_0x1e2727,_0x5c76d6);SmsQueueEvents['on'](_0x1e2727,_0x26d8b3);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 6a3310e..3c8d3eb 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 _0xb934=['post','create','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','/:id','show'];(function(_0x161281,_0x4478bf){var _0xc1e094=function(_0x4e2c24){while(--_0x4e2c24){_0x161281['push'](_0x161281['shift']());}};_0xc1e094(++_0x4478bf);}(_0xb934,0x92));var _0x4b93=function(_0x5866a3,_0x51a743){_0x5866a3=_0x5866a3-0x0;var _0x343140=_0xb934[_0x5866a3];return _0x343140;};'use strict';var multer=require(_0x4b93('0x0'));var util=require(_0x4b93('0x1'));var path=require(_0x4b93('0x2'));var timeout=require('connect-timeout');var express=require(_0x4b93('0x3'));var router=express[_0x4b93('0x4')]();var fs_extra=require(_0x4b93('0x5'));var auth=require(_0x4b93('0x6'));var interaction=require(_0x4b93('0x7'));var config=require('../../config/environment');var controller=require('./smsQueueReport.controller');router[_0x4b93('0x8')]('/',auth[_0x4b93('0x9')](),controller[_0x4b93('0xa')]);router[_0x4b93('0x8')]('/describe',auth[_0x4b93('0x9')](),controller[_0x4b93('0xb')]);router[_0x4b93('0x8')](_0x4b93('0xc'),auth[_0x4b93('0x9')](),controller[_0x4b93('0xd')]);router[_0x4b93('0xe')]('/',auth[_0x4b93('0x9')](),controller[_0x4b93('0xf')]);router['put'](_0x4b93('0xc'),auth[_0x4b93('0x9')](),controller[_0x4b93('0x10')]);router[_0x4b93('0x11')](_0x4b93('0xc'),auth[_0x4b93('0x9')](),controller[_0x4b93('0x12')]);module[_0x4b93('0x13')]=router; \ No newline at end of file +var _0xedf2=['fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','post','create','put','/:id','update','destroy','exports','util','path','connect-timeout','Router'];(function(_0x4fb28f,_0xda6962){var _0x2a2b51=function(_0x22d01f){while(--_0x22d01f){_0x4fb28f['push'](_0x4fb28f['shift']());}};_0x2a2b51(++_0xda6962);}(_0xedf2,0x1ac));var _0x2edf=function(_0x2f39f5,_0x572439){_0x2f39f5=_0x2f39f5-0x0;var _0x4c1592=_0xedf2[_0x2f39f5];return _0x4c1592;};'use strict';var multer=require('multer');var util=require(_0x2edf('0x0'));var path=require(_0x2edf('0x1'));var timeout=require(_0x2edf('0x2'));var express=require('express');var router=express[_0x2edf('0x3')]();var fs_extra=require(_0x2edf('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2edf('0x5'));var config=require(_0x2edf('0x6'));var controller=require('./smsQueueReport.controller');router['get']('/',auth[_0x2edf('0x7')](),controller[_0x2edf('0x8')]);router['get']('/describe',auth[_0x2edf('0x7')](),controller['describe']);router[_0x2edf('0x9')]('/:id',auth[_0x2edf('0x7')](),controller[_0x2edf('0xa')]);router[_0x2edf('0xb')]('/',auth[_0x2edf('0x7')](),controller[_0x2edf('0xc')]);router[_0x2edf('0xd')](_0x2edf('0xe'),auth[_0x2edf('0x7')](),controller[_0x2edf('0xf')]);router['delete'](_0x2edf('0xe'),auth[_0x2edf('0x7')](),controller[_0x2edf('0x10')]);module[_0x2edf('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 263e1e2..c1e2cfc 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 _0xab8f=['moment','sequelize','exports','STRING','DATE'];(function(_0x352d28,_0x444033){var _0x387d7e=function(_0x40be0e){while(--_0x40be0e){_0x352d28['push'](_0x352d28['shift']());}};_0x387d7e(++_0x444033);}(_0xab8f,0x7d));var _0xfab8=function(_0x50e267,_0x3c4d1d){_0x50e267=_0x50e267-0x0;var _0x2c203c=_0xab8f[_0x50e267];return _0x2c203c;};'use strict';var moment=require(_0xfab8('0x0'));var Sequelize=require(_0xfab8('0x1'));module[_0xfab8('0x2')]={'uniqueid':{'type':Sequelize[_0xfab8('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xfab8('0x4')]},'leaveAt':{'type':Sequelize[_0xfab8('0x4')]},'acceptAt':{'type':Sequelize[_0xfab8('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe48d=['exports','STRING','DATE','moment','sequelize'];(function(_0x52a9a7,_0x407004){var _0x16d0bf=function(_0x2395d7){while(--_0x2395d7){_0x52a9a7['push'](_0x52a9a7['shift']());}};_0x16d0bf(++_0x407004);}(_0xe48d,0x80));var _0xde48=function(_0x224ae5,_0x34c9da){_0x224ae5=_0x224ae5-0x0;var _0x1814a0=_0xe48d[_0x224ae5];return _0x1814a0;};'use strict';var moment=require(_0xde48('0x0'));var Sequelize=require(_0xde48('0x1'));module[_0xde48('0x2')]={'uniqueid':{'type':Sequelize[_0xde48('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xde48('0x3')]},'joinAt':{'type':Sequelize[_0xde48('0x4')]},'leaveAt':{'type':Sequelize[_0xde48('0x4')]},'acceptAt':{'type':Sequelize[_0xde48('0x4')]},'exitAt':{'type':Sequelize[_0xde48('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 1d02467..2e2488b 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 _0x844b=['nolimit','order','where','pick','merge','VIRTUAL','filter','includeAll','include','catch','show','options','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','fs-extra','lodash','crypto','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x844b,0x1cd));var _0xb844=function(_0xeff2c3,_0x3a5a82){_0xeff2c3=_0xeff2c3-0x0;var _0x2cade6=_0x844b[_0xeff2c3];return _0x2cade6;};'use strict';var emlformat=require(_0xb844('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb844('0x1'));var jsonpatch=require(_0xb844('0x2'));var rp=require(_0xb844('0x3'));var moment=require(_0xb844('0x4'));var BPromise=require(_0xb844('0x5'));var Mustache=require(_0xb844('0x6'));var util=require('util');var path=require(_0xb844('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb844('0x8'));var fs=require('fs');var fs_extra=require(_0xb844('0x9'));var _=require(_0xb844('0xa'));var squel=require('squel');var crypto=require(_0xb844('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb844('0xc'));var querystring=require(_0xb844('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb844('0xe'));var qs=require(_0xb844('0xf'));var as=require(_0xb844('0x10'));var hardwareService=require(_0xb844('0x11'));var logger=require(_0xb844('0x12'))(_0xb844('0x13'));var utils=require(_0xb844('0x14'));var config=require(_0xb844('0x15'));var licenseUtil=require(_0xb844('0x16'));var db=require(_0xb844('0x17'))['db'];function respondWithStatusCode(_0x21d966,_0x4e84bc){_0x4e84bc=_0x4e84bc||0xcc;return function(_0x2d8549){if(_0x2d8549){return _0x21d966[_0xb844('0x18')](_0x4e84bc);}return _0x21d966[_0xb844('0x19')](_0x4e84bc)[_0xb844('0x1a')]();};}function respondWithResult(_0x172d85,_0xac2dab){_0xac2dab=_0xac2dab||0xc8;return function(_0x4f7eac){if(_0x4f7eac){return _0x172d85['status'](_0xac2dab)[_0xb844('0x1b')](_0x4f7eac);}};}function respondWithFilteredResult(_0x1be386,_0x243dc5){return function(_0x166c48){if(_0x166c48){var _0x3d0d87=typeof _0x243dc5[_0xb844('0x1c')]===_0xb844('0x1d')&&typeof _0x243dc5[_0xb844('0x1e')]===_0xb844('0x1d');var _0x17b76c=_0x166c48['count'];var _0x3b4118=_0x3d0d87?0x0:_0x243dc5[_0xb844('0x1c')];var _0x4a2e3e=_0x3d0d87?_0x166c48[_0xb844('0x1f')]:_0x243dc5[_0xb844('0x1c')]+_0x243dc5['limit'];var _0x587917;if(_0x4a2e3e>=_0x17b76c){_0x4a2e3e=_0x17b76c;_0x587917=0xc8;}else{_0x587917=0xce;}_0x1be386['status'](_0x587917);return _0x1be386['set']('Content-Range',_0x3b4118+'-'+_0x4a2e3e+'/'+_0x17b76c)[_0xb844('0x1b')](_0x166c48);}return null;};}function patchUpdates(_0x51fc6e){return function(_0x2e21b7){try{jsonpatch[_0xb844('0x20')](_0x2e21b7,_0x51fc6e,!![]);}catch(_0x46d1fe){return BPromise[_0xb844('0x21')](_0x46d1fe);}return _0x2e21b7[_0xb844('0x22')]();};}function saveUpdates(_0x54a28c,_0x11c211){return function(_0x4576b5){if(_0x4576b5){return _0x4576b5[_0xb844('0x23')](_0x54a28c)[_0xb844('0x24')](function(_0x47c516){return _0x47c516;});}return null;};}function removeEntity(_0x4f5573,_0x4d8253){return function(_0x3e12d0){if(_0x3e12d0){return _0x3e12d0[_0xb844('0x25')]()[_0xb844('0x24')](function(){_0x4f5573[_0xb844('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x529861,_0xdb6d3b){return function(_0x309374){if(!_0x309374){_0x529861[_0xb844('0x18')](0x194);}return _0x309374;};}function handleError(_0x414e99,_0x5ba4da){_0x5ba4da=_0x5ba4da||0x1f4;return function(_0x452aac){logger[_0xb844('0x26')](_0x452aac[_0xb844('0x27')]);if(_0x452aac[_0xb844('0x28')]){delete _0x452aac[_0xb844('0x28')];}_0x414e99[_0xb844('0x19')](_0x5ba4da)[_0xb844('0x29')](_0x452aac);};}exports[_0xb844('0x2a')]=function(_0x27d2b1,_0x2554ad){var _0x2f997e={},_0x1a71bb={},_0x1530ee={'count':0x0,'rows':[]};var _0x58dffd=_[_0xb844('0x2b')](db[_0xb844('0x2c')][_0xb844('0x2d')],function(_0x396bbf){return{'name':_0x396bbf[_0xb844('0x2e')],'type':_0x396bbf[_0xb844('0x2f')][_0xb844('0x30')]};});_0x1a71bb[_0xb844('0x31')]=_[_0xb844('0x2b')](_0x58dffd,_0xb844('0x28'));_0x1a71bb[_0xb844('0x32')]=_[_0xb844('0x33')](_0x27d2b1[_0xb844('0x32')]);_0x1a71bb[_0xb844('0x34')]=_[_0xb844('0x35')](_0x1a71bb[_0xb844('0x31')],_0x1a71bb[_0xb844('0x32')]);_0x2f997e[_0xb844('0x36')]=_[_0xb844('0x35')](_0x1a71bb['model'],qs[_0xb844('0x37')](_0x27d2b1[_0xb844('0x32')][_0xb844('0x37')]));_0x2f997e[_0xb844('0x36')]=_0x2f997e['attributes'][_0xb844('0x38')]?_0x2f997e['attributes']:_0x1a71bb[_0xb844('0x31')];if(!_0x27d2b1[_0xb844('0x32')]['hasOwnProperty'](_0xb844('0x39'))){_0x2f997e['limit']=qs[_0xb844('0x1e')](_0x27d2b1[_0xb844('0x32')][_0xb844('0x1e')]);_0x2f997e['offset']=qs[_0xb844('0x1c')](_0x27d2b1[_0xb844('0x32')][_0xb844('0x1c')]);}_0x2f997e[_0xb844('0x3a')]=qs['sort'](_0x27d2b1[_0xb844('0x32')]['sort']);_0x2f997e[_0xb844('0x3b')]=qs[_0xb844('0x34')](_[_0xb844('0x3c')](_0x27d2b1[_0xb844('0x32')],_0x1a71bb[_0xb844('0x34')]),_0x58dffd);if(_0x27d2b1['query']['filter']){_0x2f997e['where']=_[_0xb844('0x3d')](_0x2f997e['where'],{'$or':_[_0xb844('0x2b')](_0x58dffd,function(_0x4f1f78){if(_0x4f1f78[_0xb844('0x2f')]!==_0xb844('0x3e')){var _0x622f24={};_0x622f24[_0x4f1f78[_0xb844('0x28')]]={'$like':'%'+_0x27d2b1[_0xb844('0x32')][_0xb844('0x3f')]+'%'};return _0x622f24;}})});}_0x2f997e=_[_0xb844('0x3d')]({},_0x2f997e,_0x27d2b1['options']);var _0xde0cd9={'where':_0x2f997e['where']};return db['SmsQueueReport'][_0xb844('0x1f')](_0xde0cd9)['then'](function(_0x237215){_0x1530ee[_0xb844('0x1f')]=_0x237215;if(_0x27d2b1[_0xb844('0x32')][_0xb844('0x40')]){_0x2f997e[_0xb844('0x41')]=[{'all':!![]}];}return db[_0xb844('0x2c')]['findAll'](_0x2f997e);})[_0xb844('0x24')](function(_0x20034){_0x1530ee['rows']=_0x20034;return _0x1530ee;})[_0xb844('0x24')](respondWithFilteredResult(_0x2554ad,_0x2f997e))[_0xb844('0x42')](handleError(_0x2554ad,null));};exports[_0xb844('0x43')]=function(_0x1a66db,_0x2cffa7){var _0x4a295f={'raw':!![],'where':{'id':_0x1a66db['params']['id']}},_0x258444={};_0x258444['model']=_[_0xb844('0x33')](db['SmsQueueReport'][_0xb844('0x2d')]);_0x258444[_0xb844('0x32')]=_[_0xb844('0x33')](_0x1a66db[_0xb844('0x32')]);_0x258444[_0xb844('0x34')]=_['intersection'](_0x258444[_0xb844('0x31')],_0x258444[_0xb844('0x32')]);_0x4a295f[_0xb844('0x36')]=_[_0xb844('0x35')](_0x258444[_0xb844('0x31')],qs[_0xb844('0x37')](_0x1a66db[_0xb844('0x32')][_0xb844('0x37')]));_0x4a295f[_0xb844('0x36')]=_0x4a295f['attributes'][_0xb844('0x38')]?_0x4a295f[_0xb844('0x36')]:_0x258444[_0xb844('0x31')];if(_0x1a66db[_0xb844('0x32')][_0xb844('0x40')]){_0x4a295f[_0xb844('0x41')]=[{'all':!![]}];}_0x4a295f=_['merge']({},_0x4a295f,_0x1a66db[_0xb844('0x44')]);return db[_0xb844('0x2c')][_0xb844('0x45')](_0x4a295f)[_0xb844('0x24')](handleEntityNotFound(_0x2cffa7,null))['then'](respondWithResult(_0x2cffa7,null))[_0xb844('0x42')](handleError(_0x2cffa7,null));};exports['create']=function(_0x4abaf7,_0x1181c6){return db[_0xb844('0x2c')][_0xb844('0x46')](_0x4abaf7[_0xb844('0x47')],{})['then'](respondWithResult(_0x1181c6,0xc9))['catch'](handleError(_0x1181c6,null));};exports[_0xb844('0x23')]=function(_0x39c726,_0x179018){if(_0x39c726[_0xb844('0x47')]['id']){delete _0x39c726[_0xb844('0x47')]['id'];}return db[_0xb844('0x2c')][_0xb844('0x45')]({'where':{'id':_0x39c726[_0xb844('0x48')]['id']}})['then'](handleEntityNotFound(_0x179018,null))['then'](saveUpdates(_0x39c726[_0xb844('0x47')],null))[_0xb844('0x24')](respondWithResult(_0x179018,null))['catch'](handleError(_0x179018,null));};exports[_0xb844('0x25')]=function(_0x532d2a,_0x2f5ece){return db[_0xb844('0x2c')]['find']({'where':{'id':_0x532d2a['params']['id']}})['then'](handleEntityNotFound(_0x2f5ece,null))[_0xb844('0x24')](removeEntity(_0x2f5ece,null))[_0xb844('0x42')](handleError(_0x2f5ece,null));};exports['describe']=function(_0x4aff31,_0x561121){return db[_0xb844('0x2c')][_0xb844('0x49')]()[_0xb844('0x24')](respondWithResult(_0x561121,null))['catch'](handleError(_0x561121,null));}; \ No newline at end of file +var _0xf2ab=['fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','then','name','send','map','SmsQueueReport','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','VIRTUAL','filter','includeAll','include','rows','catch','show','params','options','find','create','body','update','destroy','describe','eml-format','rimraf','zip-dir'];(function(_0x26920d,_0x21b4ab){var _0x3bec3f=function(_0x22fc0e){while(--_0x22fc0e){_0x26920d['push'](_0x26920d['shift']());}};_0x3bec3f(++_0x21b4ab);}(_0xf2ab,0x1d9));var _0xbf2a=function(_0x2487d0,_0x2384ce){_0x2487d0=_0x2487d0-0x0;var _0x4e2847=_0xf2ab[_0x2487d0];return _0x4e2847;};'use strict';var emlformat=require(_0xbf2a('0x0'));var rimraf=require(_0xbf2a('0x1'));var zipdir=require(_0xbf2a('0x2'));var jsonpatch=require(_0xbf2a('0x3'));var rp=require('request-promise');var moment=require(_0xbf2a('0x4'));var BPromise=require(_0xbf2a('0x5'));var Mustache=require(_0xbf2a('0x6'));var util=require(_0xbf2a('0x7'));var path=require(_0xbf2a('0x8'));var sox=require(_0xbf2a('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbf2a('0xa'));var _=require('lodash');var squel=require(_0xbf2a('0xb'));var crypto=require('crypto');var jsforce=require(_0xbf2a('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xbf2a('0xd'));var querystring=require(_0xbf2a('0xe'));var Papa=require('papaparse');var Redis=require(_0xbf2a('0xf'));var authService=require(_0xbf2a('0x10'));var qs=require(_0xbf2a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xbf2a('0x12'))(_0xbf2a('0x13'));var utils=require(_0xbf2a('0x14'));var config=require(_0xbf2a('0x15'));var licenseUtil=require(_0xbf2a('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x326009,_0x6d2fc){_0x6d2fc=_0x6d2fc||0xcc;return function(_0x3b1afc){if(_0x3b1afc){return _0x326009[_0xbf2a('0x17')](_0x6d2fc);}return _0x326009['status'](_0x6d2fc)[_0xbf2a('0x18')]();};}function respondWithResult(_0x24e2d2,_0xb0b392){_0xb0b392=_0xb0b392||0xc8;return function(_0x57756e){if(_0x57756e){return _0x24e2d2[_0xbf2a('0x19')](_0xb0b392)[_0xbf2a('0x1a')](_0x57756e);}};}function respondWithFilteredResult(_0x257ae6,_0x77e630){return function(_0x2594d5){if(_0x2594d5){var _0x43f8ce=typeof _0x77e630[_0xbf2a('0x1b')]===_0xbf2a('0x1c')&&typeof _0x77e630[_0xbf2a('0x1d')]===_0xbf2a('0x1c');var _0x17eec1=_0x2594d5['count'];var _0x54737c=_0x43f8ce?0x0:_0x77e630['offset'];var _0x75a1de=_0x43f8ce?_0x2594d5[_0xbf2a('0x1e')]:_0x77e630[_0xbf2a('0x1b')]+_0x77e630['limit'];var _0x5512af;if(_0x75a1de>=_0x17eec1){_0x75a1de=_0x17eec1;_0x5512af=0xc8;}else{_0x5512af=0xce;}_0x257ae6[_0xbf2a('0x19')](_0x5512af);return _0x257ae6[_0xbf2a('0x1f')](_0xbf2a('0x20'),_0x54737c+'-'+_0x75a1de+'/'+_0x17eec1)[_0xbf2a('0x1a')](_0x2594d5);}return null;};}function patchUpdates(_0x3ffe8e){return function(_0xd8994d){try{jsonpatch['apply'](_0xd8994d,_0x3ffe8e,!![]);}catch(_0x52903c){return BPromise[_0xbf2a('0x21')](_0x52903c);}return _0xd8994d['save']();};}function saveUpdates(_0x372f99,_0x32916b){return function(_0x3e6f65){if(_0x3e6f65){return _0x3e6f65['update'](_0x372f99)['then'](function(_0x157bad){return _0x157bad;});}return null;};}function removeEntity(_0x4eab6c,_0x2ba823){return function(_0x1a0c83){if(_0x1a0c83){return _0x1a0c83['destroy']()[_0xbf2a('0x22')](function(){_0x4eab6c[_0xbf2a('0x19')](0xcc)[_0xbf2a('0x18')]();});}};}function handleEntityNotFound(_0x57b0cb,_0x47e1e6){return function(_0xbd0d74){if(!_0xbd0d74){_0x57b0cb[_0xbf2a('0x17')](0x194);}return _0xbd0d74;};}function handleError(_0x185d49,_0x388fb0){_0x388fb0=_0x388fb0||0x1f4;return function(_0x425206){logger['error'](_0x425206['stack']);if(_0x425206[_0xbf2a('0x23')]){delete _0x425206[_0xbf2a('0x23')];}_0x185d49[_0xbf2a('0x19')](_0x388fb0)[_0xbf2a('0x24')](_0x425206);};}exports['index']=function(_0x2524cc,_0x406cf4){var _0x232452={},_0x2bc0e8={},_0x30f0f2={'count':0x0,'rows':[]};var _0x41e130=_[_0xbf2a('0x25')](db[_0xbf2a('0x26')]['rawAttributes'],function(_0x23be27){return{'name':_0x23be27['fieldName'],'type':_0x23be27['type'][_0xbf2a('0x27')]};});_0x2bc0e8[_0xbf2a('0x28')]=_[_0xbf2a('0x25')](_0x41e130,_0xbf2a('0x23'));_0x2bc0e8[_0xbf2a('0x29')]=_[_0xbf2a('0x2a')](_0x2524cc[_0xbf2a('0x29')]);_0x2bc0e8[_0xbf2a('0x2b')]=_[_0xbf2a('0x2c')](_0x2bc0e8[_0xbf2a('0x28')],_0x2bc0e8[_0xbf2a('0x29')]);_0x232452[_0xbf2a('0x2d')]=_[_0xbf2a('0x2c')](_0x2bc0e8[_0xbf2a('0x28')],qs[_0xbf2a('0x2e')](_0x2524cc[_0xbf2a('0x29')][_0xbf2a('0x2e')]));_0x232452[_0xbf2a('0x2d')]=_0x232452[_0xbf2a('0x2d')][_0xbf2a('0x2f')]?_0x232452['attributes']:_0x2bc0e8[_0xbf2a('0x28')];if(!_0x2524cc['query']['hasOwnProperty'](_0xbf2a('0x30'))){_0x232452['limit']=qs['limit'](_0x2524cc['query'][_0xbf2a('0x1d')]);_0x232452[_0xbf2a('0x1b')]=qs[_0xbf2a('0x1b')](_0x2524cc[_0xbf2a('0x29')][_0xbf2a('0x1b')]);}_0x232452[_0xbf2a('0x31')]=qs['sort'](_0x2524cc[_0xbf2a('0x29')][_0xbf2a('0x32')]);_0x232452[_0xbf2a('0x33')]=qs['filters'](_[_0xbf2a('0x34')](_0x2524cc[_0xbf2a('0x29')],_0x2bc0e8[_0xbf2a('0x2b')]),_0x41e130);if(_0x2524cc[_0xbf2a('0x29')]['filter']){_0x232452['where']=_['merge'](_0x232452['where'],{'$or':_['map'](_0x41e130,function(_0xef615){if(_0xef615['type']!==_0xbf2a('0x35')){var _0x542c78={};_0x542c78[_0xef615[_0xbf2a('0x23')]]={'$like':'%'+_0x2524cc[_0xbf2a('0x29')][_0xbf2a('0x36')]+'%'};return _0x542c78;}})});}_0x232452=_['merge']({},_0x232452,_0x2524cc['options']);var _0x2abd9f={'where':_0x232452[_0xbf2a('0x33')]};return db[_0xbf2a('0x26')][_0xbf2a('0x1e')](_0x2abd9f)[_0xbf2a('0x22')](function(_0x276179){_0x30f0f2[_0xbf2a('0x1e')]=_0x276179;if(_0x2524cc[_0xbf2a('0x29')][_0xbf2a('0x37')]){_0x232452[_0xbf2a('0x38')]=[{'all':!![]}];}return db[_0xbf2a('0x26')]['findAll'](_0x232452);})[_0xbf2a('0x22')](function(_0x3ae24c){_0x30f0f2[_0xbf2a('0x39')]=_0x3ae24c;return _0x30f0f2;})[_0xbf2a('0x22')](respondWithFilteredResult(_0x406cf4,_0x232452))[_0xbf2a('0x3a')](handleError(_0x406cf4,null));};exports[_0xbf2a('0x3b')]=function(_0x5cb2cd,_0x5e8c8e){var _0x1ee75e={'raw':!![],'where':{'id':_0x5cb2cd[_0xbf2a('0x3c')]['id']}},_0x31ab57={};_0x31ab57[_0xbf2a('0x28')]=_['keys'](db['SmsQueueReport']['rawAttributes']);_0x31ab57['query']=_[_0xbf2a('0x2a')](_0x5cb2cd[_0xbf2a('0x29')]);_0x31ab57[_0xbf2a('0x2b')]=_[_0xbf2a('0x2c')](_0x31ab57[_0xbf2a('0x28')],_0x31ab57[_0xbf2a('0x29')]);_0x1ee75e[_0xbf2a('0x2d')]=_[_0xbf2a('0x2c')](_0x31ab57[_0xbf2a('0x28')],qs['fields'](_0x5cb2cd[_0xbf2a('0x29')][_0xbf2a('0x2e')]));_0x1ee75e['attributes']=_0x1ee75e[_0xbf2a('0x2d')][_0xbf2a('0x2f')]?_0x1ee75e['attributes']:_0x31ab57[_0xbf2a('0x28')];if(_0x5cb2cd[_0xbf2a('0x29')]['includeAll']){_0x1ee75e[_0xbf2a('0x38')]=[{'all':!![]}];}_0x1ee75e=_['merge']({},_0x1ee75e,_0x5cb2cd[_0xbf2a('0x3d')]);return db[_0xbf2a('0x26')][_0xbf2a('0x3e')](_0x1ee75e)[_0xbf2a('0x22')](handleEntityNotFound(_0x5e8c8e,null))[_0xbf2a('0x22')](respondWithResult(_0x5e8c8e,null))[_0xbf2a('0x3a')](handleError(_0x5e8c8e,null));};exports[_0xbf2a('0x3f')]=function(_0xd022ba,_0x403b12){return db[_0xbf2a('0x26')][_0xbf2a('0x3f')](_0xd022ba[_0xbf2a('0x40')],{})[_0xbf2a('0x22')](respondWithResult(_0x403b12,0xc9))[_0xbf2a('0x3a')](handleError(_0x403b12,null));};exports[_0xbf2a('0x41')]=function(_0x103398,_0x518da4){if(_0x103398[_0xbf2a('0x40')]['id']){delete _0x103398[_0xbf2a('0x40')]['id'];}return db['SmsQueueReport'][_0xbf2a('0x3e')]({'where':{'id':_0x103398['params']['id']}})[_0xbf2a('0x22')](handleEntityNotFound(_0x518da4,null))['then'](saveUpdates(_0x103398[_0xbf2a('0x40')],null))[_0xbf2a('0x22')](respondWithResult(_0x518da4,null))['catch'](handleError(_0x518da4,null));};exports[_0xbf2a('0x42')]=function(_0x571e72,_0x4d5f78){return db[_0xbf2a('0x26')][_0xbf2a('0x3e')]({'where':{'id':_0x571e72[_0xbf2a('0x3c')]['id']}})[_0xbf2a('0x22')](handleEntityNotFound(_0x4d5f78,null))[_0xbf2a('0x22')](removeEntity(_0x4d5f78,null))[_0xbf2a('0x3a')](handleError(_0x4d5f78,null));};exports['describe']=function(_0x14a620,_0x63f664){return db[_0xbf2a('0x26')][_0xbf2a('0x43')]()[_0xbf2a('0x22')](respondWithResult(_0x63f664,null))['catch'](handleError(_0x63f664,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 077cf83..5df746e 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 _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid'];(function(_0x5224ba,_0x3fb4e1){var _0x459bd2=function(_0x61be43){while(--_0x61be43){_0x5224ba['push'](_0x5224ba['shift']());}};_0x459bd2(++_0x3fb4e1);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid'];(function(_0x1034bb,_0x4e20b3){var _0x453fdb=function(_0x455356){while(--_0x455356){_0x1034bb['push'](_0x1034bb['shift']());}};_0x453fdb(++_0x4e20b3);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index ae3a17b..6ee1fe1 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 _0xe19f=['catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','update','where','limit','UpdateSmsQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','then','info','SmsQueueReport,\x20%s,\x20%s','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result'];(function(_0x5621a9,_0x23e516){var _0x59712c=function(_0x3fb391){while(--_0x3fb391){_0x5621a9['push'](_0x5621a9['shift']());}};_0x59712c(++_0x23e516);}(_0xe19f,0x1d9));var _0xfe19=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xe19f[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xfe19('0x0'));var util=require(_0xfe19('0x1'));var moment=require(_0xfe19('0x2'));var BPromise=require(_0xfe19('0x3'));var rs=require(_0xfe19('0x4'));var fs=require('fs');var Redis=require(_0xfe19('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfe19('0x6'))(_0xfe19('0x7'));var config=require('../../config/environment');var jayson=require(_0xfe19('0x8'));var client=jayson[_0xfe19('0x9')][_0xfe19('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c664a,_0x1a2535,_0x4ed041){return new BPromise(function(_0x1510f9,_0x4b5b83){return client['request'](_0x1c664a,_0x4ed041)[_0xfe19('0xb')](function(_0x336603){logger[_0xfe19('0xc')](_0xfe19('0xd'),_0x1a2535,'request\x20sent');logger[_0xfe19('0xe')](_0xfe19('0xf'),_0x1a2535,'request\x20sent',JSON[_0xfe19('0x10')](_0x336603));if(_0x336603['error']){if(_0x336603[_0xfe19('0x11')][_0xfe19('0x12')]===0x1f4){logger[_0xfe19('0x11')](_0xfe19('0xd'),_0x1a2535,_0x336603[_0xfe19('0x11')][_0xfe19('0x13')]);return _0x4b5b83(_0x336603[_0xfe19('0x11')]['message']);}logger[_0xfe19('0x11')](_0xfe19('0xd'),_0x1a2535,_0x336603[_0xfe19('0x11')]['message']);return _0x1510f9(_0x336603[_0xfe19('0x11')][_0xfe19('0x13')]);}else{logger[_0xfe19('0xc')](_0xfe19('0xd'),_0x1a2535,_0xfe19('0x14'));_0x1510f9(_0x336603[_0xfe19('0x15')][_0xfe19('0x13')]);}})[_0xfe19('0x16')](function(_0x447c11){logger[_0xfe19('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0x1a2535,_0x447c11);_0x4b5b83(_0x447c11);});});}exports[_0xfe19('0x17')]=function(_0x4a3137){var _0x377915=this;return new Promise(function(_0x18d9c0,_0x5403a5){return db[_0xfe19('0x18')][_0xfe19('0x19')](_0x4a3137[_0xfe19('0x1a')],{'raw':_0x4a3137[_0xfe19('0x1b')]?_0x4a3137[_0xfe19('0x1b')][_0xfe19('0x1c')]===undefined?!![]:![]:!![]})[_0xfe19('0xb')](function(_0x29dee9){logger[_0xfe19('0xc')](_0xfe19('0x17'),_0x4a3137);logger[_0xfe19('0xe')](_0xfe19('0x17'),_0x4a3137,JSON[_0xfe19('0x10')](_0x29dee9));_0x18d9c0(_0x29dee9);})['catch'](function(_0x3c53d1){logger[_0xfe19('0x11')]('CreateSmsQueueReport',_0x3c53d1[_0xfe19('0x13')],_0x4a3137);_0x5403a5(_0x377915[_0xfe19('0x11')](0x1f4,_0x3c53d1['message']));});});};exports['UpdateSmsQueueReport']=function(_0x32277){var _0x55a336=this;return new Promise(function(_0xf7f598,_0x366d43){return db[_0xfe19('0x18')][_0xfe19('0x1d')](_0x32277[_0xfe19('0x1a')],{'raw':_0x32277['options']?_0x32277[_0xfe19('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32277[_0xfe19('0x1b')]?_0x32277[_0xfe19('0x1b')][_0xfe19('0x1e')]||null:null,'attributes':_0x32277[_0xfe19('0x1b')]?_0x32277['options']['attributes']||null:null,'limit':_0x32277[_0xfe19('0x1b')]?_0x32277[_0xfe19('0x1b')][_0xfe19('0x1f')]||null:null})['then'](function(_0x53bd1f){logger[_0xfe19('0xc')](_0xfe19('0x20'),_0x32277);logger[_0xfe19('0xe')]('UpdateSmsQueueReport',_0x32277,JSON['stringify'](_0x53bd1f));_0xf7f598(_0x53bd1f);})[_0xfe19('0x16')](function(_0x1b5b78){logger[_0xfe19('0x11')]('UpdateSmsQueueReport',_0x1b5b78['message'],_0x32277);_0x366d43(_0x55a336['error'](0x1f4,_0x1b5b78[_0xfe19('0x13')]));});});}; \ No newline at end of file +var _0x90ac=['limit','then','stringify','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','SmsQueueReport','create','body','options','raw','CreateSmsQueueReport','UpdateSmsQueueReport','update','where','attributes'];(function(_0x5caba7,_0x140b2f){var _0x4e83e9=function(_0x3883f7){while(--_0x3883f7){_0x5caba7['push'](_0x5caba7['shift']());}};_0x4e83e9(++_0x140b2f);}(_0x90ac,0x12c));var _0xc90a=function(_0x35f1ef,_0x136a66){_0x35f1ef=_0x35f1ef-0x0;var _0x2138f2=_0x90ac[_0x35f1ef];return _0x2138f2;};'use strict';var _=require(_0xc90a('0x0'));var util=require(_0xc90a('0x1'));var moment=require('moment');var BPromise=require(_0xc90a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc90a('0x3'));var db=require(_0xc90a('0x4'))['db'];var utils=require(_0xc90a('0x5'));var logger=require('../../config/logger')(_0xc90a('0x6'));var config=require(_0xc90a('0x7'));var jayson=require(_0xc90a('0x8'));var client=jayson['client'][_0xc90a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xfc0ba0,_0x53d2e4,_0x1b2470){return new BPromise(function(_0x35f6aa,_0xb11f8b){return client[_0xc90a('0xa')](_0xfc0ba0,_0x1b2470)['then'](function(_0x517ab7){logger[_0xc90a('0xb')](_0xc90a('0xc'),_0x53d2e4,_0xc90a('0xd'));logger[_0xc90a('0xe')](_0xc90a('0xf'),_0x53d2e4,'request\x20sent',JSON['stringify'](_0x517ab7));if(_0x517ab7[_0xc90a('0x10')]){if(_0x517ab7[_0xc90a('0x10')]['code']===0x1f4){logger[_0xc90a('0x10')](_0xc90a('0xc'),_0x53d2e4,_0x517ab7[_0xc90a('0x10')][_0xc90a('0x11')]);return _0xb11f8b(_0x517ab7[_0xc90a('0x10')][_0xc90a('0x11')]);}logger[_0xc90a('0x10')]('SmsQueueReport,\x20%s,\x20%s',_0x53d2e4,_0x517ab7[_0xc90a('0x10')][_0xc90a('0x11')]);return _0x35f6aa(_0x517ab7[_0xc90a('0x10')][_0xc90a('0x11')]);}else{logger[_0xc90a('0xb')]('SmsQueueReport,\x20%s,\x20%s',_0x53d2e4,_0xc90a('0xd'));_0x35f6aa(_0x517ab7[_0xc90a('0x12')][_0xc90a('0x11')]);}})[_0xc90a('0x13')](function(_0x51307a){logger['error'](_0xc90a('0xc'),_0x53d2e4,_0x51307a);_0xb11f8b(_0x51307a);});});}exports['CreateSmsQueueReport']=function(_0x1733d2){var _0xb4a28e=this;return new Promise(function(_0x4a7fe2,_0x2f2587){return db[_0xc90a('0x14')][_0xc90a('0x15')](_0x1733d2[_0xc90a('0x16')],{'raw':_0x1733d2[_0xc90a('0x17')]?_0x1733d2[_0xc90a('0x17')][_0xc90a('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x51c890){logger[_0xc90a('0xb')]('CreateSmsQueueReport',_0x1733d2);logger[_0xc90a('0xe')](_0xc90a('0x19'),_0x1733d2,JSON['stringify'](_0x51c890));_0x4a7fe2(_0x51c890);})[_0xc90a('0x13')](function(_0x56b4ef){logger[_0xc90a('0x10')](_0xc90a('0x19'),_0x56b4ef[_0xc90a('0x11')],_0x1733d2);_0x2f2587(_0xb4a28e[_0xc90a('0x10')](0x1f4,_0x56b4ef['message']));});});};exports[_0xc90a('0x1a')]=function(_0x5d7b94){var _0x3adfc8=this;return new Promise(function(_0x27df08,_0x231bb3){return db[_0xc90a('0x14')][_0xc90a('0x1b')](_0x5d7b94['body'],{'raw':_0x5d7b94[_0xc90a('0x17')]?_0x5d7b94[_0xc90a('0x17')][_0xc90a('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d7b94['options']?_0x5d7b94['options'][_0xc90a('0x1c')]||null:null,'attributes':_0x5d7b94[_0xc90a('0x17')]?_0x5d7b94[_0xc90a('0x17')][_0xc90a('0x1d')]||null:null,'limit':_0x5d7b94[_0xc90a('0x17')]?_0x5d7b94[_0xc90a('0x17')][_0xc90a('0x1e')]||null:null})[_0xc90a('0x1f')](function(_0x1d3458){logger[_0xc90a('0xb')](_0xc90a('0x1a'),_0x5d7b94);logger[_0xc90a('0xe')](_0xc90a('0x1a'),_0x5d7b94,JSON[_0xc90a('0x20')](_0x1d3458));_0x27df08(_0x1d3458);})['catch'](function(_0x2a490e){logger[_0xc90a('0x10')](_0xc90a('0x1a'),_0x2a490e['message'],_0x5d7b94);_0x231bb3(_0x3adfc8['error'](0x1f4,_0x2a490e['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 474153f..bbe66a4 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 _0xe181=['/describe','isAuthenticated','describe','show','post','create','put','update','delete','/:id','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsTransferReport.controller','index','get'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xe181,0x68));var _0x1e18=function(_0x2a8b5c,_0x429c22){_0x2a8b5c=_0x2a8b5c-0x0;var _0x3bbefe=_0xe181[_0x2a8b5c];return _0x3bbefe;};'use strict';var multer=require(_0x1e18('0x0'));var util=require('util');var path=require(_0x1e18('0x1'));var timeout=require(_0x1e18('0x2'));var express=require(_0x1e18('0x3'));var router=express[_0x1e18('0x4')]();var fs_extra=require(_0x1e18('0x5'));var auth=require(_0x1e18('0x6'));var interaction=require(_0x1e18('0x7'));var config=require('../../config/environment');var controller=require(_0x1e18('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x1e18('0x9')]);router[_0x1e18('0xa')](_0x1e18('0xb'),auth[_0x1e18('0xc')](),controller[_0x1e18('0xd')]);router[_0x1e18('0xa')]('/:id',auth[_0x1e18('0xc')](),controller[_0x1e18('0xe')]);router[_0x1e18('0xf')]('/',auth[_0x1e18('0xc')](),controller[_0x1e18('0x10')]);router[_0x1e18('0x11')]('/:id',auth[_0x1e18('0xc')](),controller[_0x1e18('0x12')]);router[_0x1e18('0x13')](_0x1e18('0x14'),auth[_0x1e18('0xc')](),controller[_0x1e18('0x15')]);module[_0x1e18('0x16')]=router; \ No newline at end of file +var _0x8819=['show','create','put','update','delete','/:id','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0x2ff039,_0x3bcbeb){var _0x44b542=function(_0x515ef5){while(--_0x515ef5){_0x2ff039['push'](_0x2ff039['shift']());}};_0x44b542(++_0x3bcbeb);}(_0x8819,0x94));var _0x9881=function(_0x2b163e,_0x54580b){_0x2b163e=_0x2b163e-0x0;var _0x31b7bc=_0x8819[_0x2b163e];return _0x31b7bc;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9881('0x0'));var timeout=require(_0x9881('0x1'));var express=require(_0x9881('0x2'));var router=express[_0x9881('0x3')]();var fs_extra=require(_0x9881('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9881('0x5'));var config=require(_0x9881('0x6'));var controller=require(_0x9881('0x7'));router[_0x9881('0x8')]('/',auth[_0x9881('0x9')](),controller[_0x9881('0xa')]);router['get'](_0x9881('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x9881('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x9881('0xc')]);router['post']('/',auth[_0x9881('0x9')](),controller[_0x9881('0xd')]);router[_0x9881('0xe')]('/:id',auth[_0x9881('0x9')](),controller[_0x9881('0xf')]);router[_0x9881('0x10')](_0x9881('0x11'),auth['isAuthenticated'](),controller[_0x9881('0x12')]);module[_0x9881('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 dab96b7..03690e6 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 _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0xf91841,_0x182ae3){var _0x4b9c44=function(_0x2e216e){while(--_0x2e216e){_0xf91841['push'](_0xf91841['shift']());}};_0x4b9c44(++_0x182ae3);}(_0x54ef,0x112));var _0xf54e=function(_0x3ec4bf,_0x5deddf){_0x3ec4bf=_0x3ec4bf-0x0;var _0xb83919=_0x54ef[_0x3ec4bf];return _0xb83919;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file +var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x598d47,_0x3f875f){var _0x46aa41=function(_0x3024e8){while(--_0x3024e8){_0x598d47['push'](_0x598d47['shift']());}};_0x46aa41(++_0x3f875f);}(_0xaa88,0x137));var _0x8aa8=function(_0x4a0f16,_0x21ba18){_0x4a0f16=_0x4a0f16-0x0;var _0x45d653=_0xaa88[_0x4a0f16];return _0x45d653;};'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 diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 51bb91f..c34959e 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 _0x058b=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','save','update','then','end','error','stack','name','index','map','SmsTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','catch','create','body','params','destroy','describe','rimraf','zip-dir','moment'];(function(_0x3232cd,_0x584ba4){var _0x1398cf=function(_0x64cc05){while(--_0x64cc05){_0x3232cd['push'](_0x3232cd['shift']());}};_0x1398cf(++_0x584ba4);}(_0x058b,0x1d1));var _0xb058=function(_0x3e6b2f,_0x1ffa07){_0x3e6b2f=_0x3e6b2f-0x0;var _0x323215=_0x058b[_0x3e6b2f];return _0x323215;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb058('0x0'));var zipdir=require(_0xb058('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb058('0x2'));var BPromise=require(_0xb058('0x3'));var Mustache=require(_0xb058('0x4'));var util=require(_0xb058('0x5'));var path=require(_0xb058('0x6'));var sox=require(_0xb058('0x7'));var csv=require(_0xb058('0x8'));var ejs=require(_0xb058('0x9'));var fs=require('fs');var fs_extra=require(_0xb058('0xa'));var _=require(_0xb058('0xb'));var squel=require('squel');var crypto=require(_0xb058('0xc'));var jsforce=require(_0xb058('0xd'));var deskjs=require(_0xb058('0xe'));var toCsv=require(_0xb058('0x8'));var querystring=require(_0xb058('0xf'));var Papa=require(_0xb058('0x10'));var Redis=require(_0xb058('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb058('0x12'));var as=require(_0xb058('0x13'));var hardwareService=require(_0xb058('0x14'));var logger=require(_0xb058('0x15'))('api');var utils=require(_0xb058('0x16'));var config=require(_0xb058('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xb058('0x18'))['db'];function respondWithStatusCode(_0x22a48f,_0x5dedd8){_0x5dedd8=_0x5dedd8||0xcc;return function(_0x5d5487){if(_0x5d5487){return _0x22a48f[_0xb058('0x19')](_0x5dedd8);}return _0x22a48f[_0xb058('0x1a')](_0x5dedd8)['end']();};}function respondWithResult(_0x5733d6,_0x21a1ce){_0x21a1ce=_0x21a1ce||0xc8;return function(_0x5341c9){if(_0x5341c9){return _0x5733d6[_0xb058('0x1a')](_0x21a1ce)[_0xb058('0x1b')](_0x5341c9);}};}function respondWithFilteredResult(_0x267cb8,_0x405d93){return function(_0x432a4b){if(_0x432a4b){var _0x372cca=typeof _0x405d93['offset']===_0xb058('0x1c')&&typeof _0x405d93[_0xb058('0x1d')]===_0xb058('0x1c');var _0x5609c5=_0x432a4b[_0xb058('0x1e')];var _0x526d73=_0x372cca?0x0:_0x405d93[_0xb058('0x1f')];var _0x3502f7=_0x372cca?_0x432a4b[_0xb058('0x1e')]:_0x405d93[_0xb058('0x1f')]+_0x405d93[_0xb058('0x1d')];var _0x16bb47;if(_0x3502f7>=_0x5609c5){_0x3502f7=_0x5609c5;_0x16bb47=0xc8;}else{_0x16bb47=0xce;}_0x267cb8[_0xb058('0x1a')](_0x16bb47);return _0x267cb8['set'](_0xb058('0x20'),_0x526d73+'-'+_0x3502f7+'/'+_0x5609c5)[_0xb058('0x1b')](_0x432a4b);}return null;};}function patchUpdates(_0x11c1a7){return function(_0x37b2af){try{jsonpatch[_0xb058('0x21')](_0x37b2af,_0x11c1a7,!![]);}catch(_0x59cbe2){return BPromise['reject'](_0x59cbe2);}return _0x37b2af[_0xb058('0x22')]();};}function saveUpdates(_0x1bd81a,_0x4b0c5f){return function(_0x34c0f6){if(_0x34c0f6){return _0x34c0f6[_0xb058('0x23')](_0x1bd81a)[_0xb058('0x24')](function(_0x2f4289){return _0x2f4289;});}return null;};}function removeEntity(_0x375700,_0x481f68){return function(_0x1aa76c){if(_0x1aa76c){return _0x1aa76c['destroy']()[_0xb058('0x24')](function(){_0x375700[_0xb058('0x1a')](0xcc)[_0xb058('0x25')]();});}};}function handleEntityNotFound(_0x28c744,_0x10823c){return function(_0x1e54db){if(!_0x1e54db){_0x28c744['sendStatus'](0x194);}return _0x1e54db;};}function handleError(_0x503c48,_0x21a512){_0x21a512=_0x21a512||0x1f4;return function(_0x87ada0){logger[_0xb058('0x26')](_0x87ada0[_0xb058('0x27')]);if(_0x87ada0[_0xb058('0x28')]){delete _0x87ada0[_0xb058('0x28')];}_0x503c48['status'](_0x21a512)['send'](_0x87ada0);};}exports[_0xb058('0x29')]=function(_0x53f39b,_0x206386){var _0x19fe25={},_0x1dfaee={},_0x5273d0={'count':0x0,'rows':[]};var _0x4f8181=_[_0xb058('0x2a')](db[_0xb058('0x2b')][_0xb058('0x2c')],function(_0xe74df4){return{'name':_0xe74df4[_0xb058('0x2d')],'type':_0xe74df4[_0xb058('0x2e')][_0xb058('0x2f')]};});_0x1dfaee[_0xb058('0x30')]=_[_0xb058('0x2a')](_0x4f8181,_0xb058('0x28'));_0x1dfaee[_0xb058('0x31')]=_[_0xb058('0x32')](_0x53f39b[_0xb058('0x31')]);_0x1dfaee[_0xb058('0x33')]=_[_0xb058('0x34')](_0x1dfaee[_0xb058('0x30')],_0x1dfaee[_0xb058('0x31')]);_0x19fe25['attributes']=_[_0xb058('0x34')](_0x1dfaee['model'],qs[_0xb058('0x35')](_0x53f39b[_0xb058('0x31')][_0xb058('0x35')]));_0x19fe25['attributes']=_0x19fe25[_0xb058('0x36')][_0xb058('0x37')]?_0x19fe25['attributes']:_0x1dfaee[_0xb058('0x30')];if(!_0x53f39b[_0xb058('0x31')][_0xb058('0x38')](_0xb058('0x39'))){_0x19fe25[_0xb058('0x1d')]=qs[_0xb058('0x1d')](_0x53f39b[_0xb058('0x31')][_0xb058('0x1d')]);_0x19fe25[_0xb058('0x1f')]=qs[_0xb058('0x1f')](_0x53f39b[_0xb058('0x31')][_0xb058('0x1f')]);}_0x19fe25[_0xb058('0x3a')]=qs[_0xb058('0x3b')](_0x53f39b[_0xb058('0x31')][_0xb058('0x3b')]);_0x19fe25[_0xb058('0x3c')]=qs[_0xb058('0x33')](_[_0xb058('0x3d')](_0x53f39b[_0xb058('0x31')],_0x1dfaee[_0xb058('0x33')]),_0x4f8181);if(_0x53f39b[_0xb058('0x31')][_0xb058('0x3e')]){_0x19fe25[_0xb058('0x3c')]=_[_0xb058('0x3f')](_0x19fe25[_0xb058('0x3c')],{'$or':_[_0xb058('0x2a')](_0x4f8181,function(_0x49e1b5){if(_0x49e1b5['type']!==_0xb058('0x40')){var _0x137381={};_0x137381[_0x49e1b5['name']]={'$like':'%'+_0x53f39b[_0xb058('0x31')]['filter']+'%'};return _0x137381;}})});}_0x19fe25=_[_0xb058('0x3f')]({},_0x19fe25,_0x53f39b[_0xb058('0x41')]);var _0x5b11bb={'where':_0x19fe25[_0xb058('0x3c')]};return db['SmsTransferReport'][_0xb058('0x1e')](_0x5b11bb)[_0xb058('0x24')](function(_0x11ea29){_0x5273d0[_0xb058('0x1e')]=_0x11ea29;if(_0x53f39b[_0xb058('0x31')][_0xb058('0x42')]){_0x19fe25[_0xb058('0x43')]=[{'all':!![]}];}return db[_0xb058('0x2b')][_0xb058('0x44')](_0x19fe25);})[_0xb058('0x24')](function(_0x41e69d){_0x5273d0[_0xb058('0x45')]=_0x41e69d;return _0x5273d0;})['then'](respondWithFilteredResult(_0x206386,_0x19fe25))['catch'](handleError(_0x206386,null));};exports[_0xb058('0x46')]=function(_0x486659,_0x17fb78){var _0x20f7d9={'raw':!![],'where':{'id':_0x486659['params']['id']}},_0x175e7d={};_0x175e7d[_0xb058('0x30')]=_['keys'](db[_0xb058('0x2b')][_0xb058('0x2c')]);_0x175e7d[_0xb058('0x31')]=_['keys'](_0x486659['query']);_0x175e7d[_0xb058('0x33')]=_[_0xb058('0x34')](_0x175e7d[_0xb058('0x30')],_0x175e7d['query']);_0x20f7d9['attributes']=_['intersection'](_0x175e7d['model'],qs[_0xb058('0x35')](_0x486659[_0xb058('0x31')][_0xb058('0x35')]));_0x20f7d9[_0xb058('0x36')]=_0x20f7d9['attributes'][_0xb058('0x37')]?_0x20f7d9[_0xb058('0x36')]:_0x175e7d['model'];if(_0x486659[_0xb058('0x31')][_0xb058('0x42')]){_0x20f7d9['include']=[{'all':!![]}];}_0x20f7d9=_[_0xb058('0x3f')]({},_0x20f7d9,_0x486659['options']);return db['SmsTransferReport'][_0xb058('0x47')](_0x20f7d9)[_0xb058('0x24')](handleEntityNotFound(_0x17fb78,null))[_0xb058('0x24')](respondWithResult(_0x17fb78,null))[_0xb058('0x48')](handleError(_0x17fb78,null));};exports['create']=function(_0x593bf1,_0x4edd8c){return db[_0xb058('0x2b')][_0xb058('0x49')](_0x593bf1[_0xb058('0x4a')],{})[_0xb058('0x24')](respondWithResult(_0x4edd8c,0xc9))['catch'](handleError(_0x4edd8c,null));};exports['update']=function(_0x29ae35,_0x21e3d2){if(_0x29ae35[_0xb058('0x4a')]['id']){delete _0x29ae35[_0xb058('0x4a')]['id'];}return db[_0xb058('0x2b')][_0xb058('0x47')]({'where':{'id':_0x29ae35[_0xb058('0x4b')]['id']}})[_0xb058('0x24')](handleEntityNotFound(_0x21e3d2,null))[_0xb058('0x24')](saveUpdates(_0x29ae35[_0xb058('0x4a')],null))[_0xb058('0x24')](respondWithResult(_0x21e3d2,null))[_0xb058('0x48')](handleError(_0x21e3d2,null));};exports[_0xb058('0x4c')]=function(_0x367ae6,_0x181838){return db[_0xb058('0x2b')][_0xb058('0x47')]({'where':{'id':_0x367ae6[_0xb058('0x4b')]['id']}})[_0xb058('0x24')](handleEntityNotFound(_0x181838,null))[_0xb058('0x24')](removeEntity(_0x181838,null))['catch'](handleError(_0x181838,null));};exports[_0xb058('0x4d')]=function(_0x587b17,_0x4fc4f7){return db[_0xb058('0x2b')]['describe']()[_0xb058('0x24')](respondWithResult(_0x4fc4f7,null))[_0xb058('0x48')](handleError(_0x4fc4f7,null));}; \ No newline at end of file +var _0x5715=['destroy','sendStatus','error','name','index','map','SmsTransferReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','update','find','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then'];(function(_0x57e28e,_0x51d542){var _0x38e201=function(_0x33658f){while(--_0x33658f){_0x57e28e['push'](_0x57e28e['shift']());}};_0x38e201(++_0x51d542);}(_0x5715,0x196));var _0x5571=function(_0x3e182f,_0x380ec7){_0x3e182f=_0x3e182f-0x0;var _0x23edc9=_0x5715[_0x3e182f];return _0x23edc9;};'use strict';var emlformat=require(_0x5571('0x0'));var rimraf=require(_0x5571('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5571('0x2'));var rp=require('request-promise');var moment=require(_0x5571('0x3'));var BPromise=require(_0x5571('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5571('0x5'));var sox=require(_0x5571('0x6'));var csv=require(_0x5571('0x7'));var ejs=require(_0x5571('0x8'));var fs=require('fs');var fs_extra=require(_0x5571('0x9'));var _=require(_0x5571('0xa'));var squel=require(_0x5571('0xb'));var crypto=require(_0x5571('0xc'));var jsforce=require(_0x5571('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5571('0x7'));var querystring=require(_0x5571('0xe'));var Papa=require(_0x5571('0xf'));var Redis=require(_0x5571('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5571('0x11'));var as=require(_0x5571('0x12'));var hardwareService=require(_0x5571('0x13'));var logger=require(_0x5571('0x14'))(_0x5571('0x15'));var utils=require(_0x5571('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5571('0x17'));var db=require(_0x5571('0x18'))['db'];function respondWithStatusCode(_0x493bb8,_0x1501ca){_0x1501ca=_0x1501ca||0xcc;return function(_0x30c010){if(_0x30c010){return _0x493bb8['sendStatus'](_0x1501ca);}return _0x493bb8[_0x5571('0x19')](_0x1501ca)[_0x5571('0x1a')]();};}function respondWithResult(_0x27c51b,_0x3c1ce6){_0x3c1ce6=_0x3c1ce6||0xc8;return function(_0x3b6a8f){if(_0x3b6a8f){return _0x27c51b[_0x5571('0x19')](_0x3c1ce6)[_0x5571('0x1b')](_0x3b6a8f);}};}function respondWithFilteredResult(_0x502db0,_0x2f30f3){return function(_0x1b0c12){if(_0x1b0c12){var _0x456e29=typeof _0x2f30f3[_0x5571('0x1c')]==='undefined'&&typeof _0x2f30f3[_0x5571('0x1d')]===_0x5571('0x1e');var _0xf9abe5=_0x1b0c12[_0x5571('0x1f')];var _0x500931=_0x456e29?0x0:_0x2f30f3['offset'];var _0x35a690=_0x456e29?_0x1b0c12[_0x5571('0x1f')]:_0x2f30f3[_0x5571('0x1c')]+_0x2f30f3['limit'];var _0x1646e8;if(_0x35a690>=_0xf9abe5){_0x35a690=_0xf9abe5;_0x1646e8=0xc8;}else{_0x1646e8=0xce;}_0x502db0['status'](_0x1646e8);return _0x502db0[_0x5571('0x20')](_0x5571('0x21'),_0x500931+'-'+_0x35a690+'/'+_0xf9abe5)[_0x5571('0x1b')](_0x1b0c12);}return null;};}function patchUpdates(_0x2aaf05){return function(_0x492472){try{jsonpatch[_0x5571('0x22')](_0x492472,_0x2aaf05,!![]);}catch(_0x1f94bb){return BPromise[_0x5571('0x23')](_0x1f94bb);}return _0x492472[_0x5571('0x24')]();};}function saveUpdates(_0x14512a,_0x3593af){return function(_0x451686){if(_0x451686){return _0x451686['update'](_0x14512a)[_0x5571('0x25')](function(_0x395a04){return _0x395a04;});}return null;};}function removeEntity(_0x837dd4,_0x465e19){return function(_0x344535){if(_0x344535){return _0x344535[_0x5571('0x26')]()[_0x5571('0x25')](function(){_0x837dd4[_0x5571('0x19')](0xcc)[_0x5571('0x1a')]();});}};}function handleEntityNotFound(_0xa72212,_0x2c4a1d){return function(_0x678d45){if(!_0x678d45){_0xa72212[_0x5571('0x27')](0x194);}return _0x678d45;};}function handleError(_0x4189e7,_0x5d2a89){_0x5d2a89=_0x5d2a89||0x1f4;return function(_0x30b0d4){logger[_0x5571('0x28')](_0x30b0d4['stack']);if(_0x30b0d4[_0x5571('0x29')]){delete _0x30b0d4[_0x5571('0x29')];}_0x4189e7[_0x5571('0x19')](_0x5d2a89)['send'](_0x30b0d4);};}exports[_0x5571('0x2a')]=function(_0x69c043,_0x5f15ad){var _0x205614={},_0x2d7761={},_0x239db5={'count':0x0,'rows':[]};var _0x9d72b=_[_0x5571('0x2b')](db[_0x5571('0x2c')][_0x5571('0x2d')],function(_0x3eab5d){return{'name':_0x3eab5d['fieldName'],'type':_0x3eab5d[_0x5571('0x2e')][_0x5571('0x2f')]};});_0x2d7761[_0x5571('0x30')]=_['map'](_0x9d72b,_0x5571('0x29'));_0x2d7761[_0x5571('0x31')]=_[_0x5571('0x32')](_0x69c043[_0x5571('0x31')]);_0x2d7761[_0x5571('0x33')]=_[_0x5571('0x34')](_0x2d7761[_0x5571('0x30')],_0x2d7761[_0x5571('0x31')]);_0x205614[_0x5571('0x35')]=_[_0x5571('0x34')](_0x2d7761[_0x5571('0x30')],qs[_0x5571('0x36')](_0x69c043['query'][_0x5571('0x36')]));_0x205614[_0x5571('0x35')]=_0x205614['attributes']['length']?_0x205614['attributes']:_0x2d7761[_0x5571('0x30')];if(!_0x69c043[_0x5571('0x31')]['hasOwnProperty']('nolimit')){_0x205614[_0x5571('0x1d')]=qs['limit'](_0x69c043[_0x5571('0x31')][_0x5571('0x1d')]);_0x205614[_0x5571('0x1c')]=qs[_0x5571('0x1c')](_0x69c043[_0x5571('0x31')][_0x5571('0x1c')]);}_0x205614[_0x5571('0x37')]=qs[_0x5571('0x38')](_0x69c043['query']['sort']);_0x205614[_0x5571('0x39')]=qs[_0x5571('0x33')](_['pick'](_0x69c043[_0x5571('0x31')],_0x2d7761[_0x5571('0x33')]),_0x9d72b);if(_0x69c043[_0x5571('0x31')][_0x5571('0x3a')]){_0x205614[_0x5571('0x39')]=_['merge'](_0x205614[_0x5571('0x39')],{'$or':_['map'](_0x9d72b,function(_0x27f09b){if(_0x27f09b[_0x5571('0x2e')]!==_0x5571('0x3b')){var _0x34a52d={};_0x34a52d[_0x27f09b['name']]={'$like':'%'+_0x69c043[_0x5571('0x31')][_0x5571('0x3a')]+'%'};return _0x34a52d;}})});}_0x205614=_[_0x5571('0x3c')]({},_0x205614,_0x69c043[_0x5571('0x3d')]);var _0x5e7c58={'where':_0x205614[_0x5571('0x39')]};return db[_0x5571('0x2c')][_0x5571('0x1f')](_0x5e7c58)['then'](function(_0x10b125){_0x239db5[_0x5571('0x1f')]=_0x10b125;if(_0x69c043[_0x5571('0x31')][_0x5571('0x3e')]){_0x205614[_0x5571('0x3f')]=[{'all':!![]}];}return db[_0x5571('0x2c')][_0x5571('0x40')](_0x205614);})[_0x5571('0x25')](function(_0x2f2a2e){_0x239db5[_0x5571('0x41')]=_0x2f2a2e;return _0x239db5;})[_0x5571('0x25')](respondWithFilteredResult(_0x5f15ad,_0x205614))[_0x5571('0x42')](handleError(_0x5f15ad,null));};exports[_0x5571('0x43')]=function(_0x246e74,_0x454332){var _0x238ab6={'raw':!![],'where':{'id':_0x246e74[_0x5571('0x44')]['id']}},_0x5c6d70={};_0x5c6d70[_0x5571('0x30')]=_[_0x5571('0x32')](db[_0x5571('0x2c')]['rawAttributes']);_0x5c6d70[_0x5571('0x31')]=_[_0x5571('0x32')](_0x246e74[_0x5571('0x31')]);_0x5c6d70['filters']=_[_0x5571('0x34')](_0x5c6d70[_0x5571('0x30')],_0x5c6d70[_0x5571('0x31')]);_0x238ab6[_0x5571('0x35')]=_[_0x5571('0x34')](_0x5c6d70[_0x5571('0x30')],qs[_0x5571('0x36')](_0x246e74[_0x5571('0x31')][_0x5571('0x36')]));_0x238ab6['attributes']=_0x238ab6[_0x5571('0x35')]['length']?_0x238ab6[_0x5571('0x35')]:_0x5c6d70['model'];if(_0x246e74['query'][_0x5571('0x3e')]){_0x238ab6['include']=[{'all':!![]}];}_0x238ab6=_[_0x5571('0x3c')]({},_0x238ab6,_0x246e74[_0x5571('0x3d')]);return db[_0x5571('0x2c')]['find'](_0x238ab6)['then'](handleEntityNotFound(_0x454332,null))[_0x5571('0x25')](respondWithResult(_0x454332,null))[_0x5571('0x42')](handleError(_0x454332,null));};exports[_0x5571('0x45')]=function(_0x2784cd,_0x132821){return db[_0x5571('0x2c')][_0x5571('0x45')](_0x2784cd[_0x5571('0x46')],{})[_0x5571('0x25')](respondWithResult(_0x132821,0xc9))[_0x5571('0x42')](handleError(_0x132821,null));};exports[_0x5571('0x47')]=function(_0xf7a159,_0x33987a){if(_0xf7a159[_0x5571('0x46')]['id']){delete _0xf7a159[_0x5571('0x46')]['id'];}return db[_0x5571('0x2c')][_0x5571('0x48')]({'where':{'id':_0xf7a159[_0x5571('0x44')]['id']}})[_0x5571('0x25')](handleEntityNotFound(_0x33987a,null))[_0x5571('0x25')](saveUpdates(_0xf7a159['body'],null))[_0x5571('0x25')](respondWithResult(_0x33987a,null))['catch'](handleError(_0x33987a,null));};exports[_0x5571('0x26')]=function(_0x1cd1b6,_0x765a82){return db['SmsTransferReport'][_0x5571('0x48')]({'where':{'id':_0x1cd1b6[_0x5571('0x44')]['id']}})['then'](handleEntityNotFound(_0x765a82,null))[_0x5571('0x25')](removeEntity(_0x765a82,null))[_0x5571('0x42')](handleError(_0x765a82,null));};exports[_0x5571('0x49')]=function(_0x3001f5,_0x230aaf){return db[_0x5571('0x2c')][_0x5571('0x49')]()['then'](respondWithResult(_0x230aaf,null))[_0x5571('0x42')](handleError(_0x230aaf,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 42e33e5..2a43afe 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 _0x84e6=['exports','SmsTransferReport','uniqueid','lodash','util','../../config/logger','api','request-promise','../../config/environment','./smsTransferReport.attributes'];(function(_0x4d2a06,_0x540d6e){var _0x139f1b=function(_0x253c39){while(--_0x253c39){_0x4d2a06['push'](_0x4d2a06['shift']());}};_0x139f1b(++_0x540d6e);}(_0x84e6,0x8f));var _0x684e=function(_0x5b2028,_0x1105d4){_0x5b2028=_0x5b2028-0x0;var _0x347c35=_0x84e6[_0x5b2028];return _0x347c35;};'use strict';var _=require(_0x684e('0x0'));var util=require(_0x684e('0x1'));var logger=require(_0x684e('0x2'))(_0x684e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x684e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x684e('0x5'));var attributes=require(_0x684e('0x6'));module[_0x684e('0x7')]=function(_0x58d742,_0x1dfb0b){return _0x58d742['define'](_0x684e('0x8'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x684e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x14b3=['uniqueid','lodash','util','../../config/logger','moment','bluebird','rimraf','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer'];(function(_0x463730,_0x4b4a9a){var _0x57fb44=function(_0x194d8e){while(--_0x194d8e){_0x463730['push'](_0x463730['shift']());}};_0x57fb44(++_0x4b4a9a);}(_0x14b3,0xcd));var _0x314b=function(_0x30cb96,_0x31b9e1){_0x30cb96=_0x30cb96-0x0;var _0xeff506=_0x14b3[_0x30cb96];return _0xeff506;};'use strict';var _=require(_0x314b('0x0'));var util=require(_0x314b('0x1'));var logger=require(_0x314b('0x2'))('api');var moment=require(_0x314b('0x3'));var BPromise=require(_0x314b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x314b('0x5'));var config=require('../../config/environment');var attributes=require(_0x314b('0x6'));module[_0x314b('0x7')]=function(_0x5132e2,_0x215354){return _0x5132e2[_0x314b('0x8')](_0x314b('0x9'),attributes,{'tableName':_0x314b('0xa'),'paranoid':![],'indexes':[{'name':_0x314b('0xb'),'fields':[_0x314b('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 01b8eb3..aea92ca 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 _0x212b=['jayson/promise','client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x52cb1d,_0x51820a){var _0x153b2e=function(_0x11a82f){while(--_0x11a82f){_0x52cb1d['push'](_0x52cb1d['shift']());}};_0x153b2e(++_0x51820a);}(_0x212b,0x148));var _0xb212=function(_0x5614fa,_0x3fa655){_0x5614fa=_0x5614fa-0x0;var _0x46c174=_0x212b[_0x5614fa];return _0x46c174;};'use strict';var _=require(_0xb212('0x0'));var util=require('util');var moment=require(_0xb212('0x1'));var BPromise=require(_0xb212('0x2'));var rs=require(_0xb212('0x3'));var fs=require('fs');var Redis=require(_0xb212('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb212('0x5'));var logger=require(_0xb212('0x6'))(_0xb212('0x7'));var config=require('../../config/environment');var jayson=require(_0xb212('0x8'));var client=jayson[_0xb212('0x9')][_0xb212('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x51f604,_0x15a5a5,_0x3839e0){return new BPromise(function(_0x5c1000,_0x4cf8f7){return client[_0xb212('0xb')](_0x51f604,_0x3839e0)[_0xb212('0xc')](function(_0x5b6886){logger[_0xb212('0xd')](_0xb212('0xe'),_0x15a5a5,'request\x20sent');logger['debug']('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x15a5a5,_0xb212('0xf'),JSON['stringify'](_0x5b6886));if(_0x5b6886[_0xb212('0x10')]){if(_0x5b6886[_0xb212('0x10')][_0xb212('0x11')]===0x1f4){logger[_0xb212('0x10')](_0xb212('0xe'),_0x15a5a5,_0x5b6886[_0xb212('0x10')][_0xb212('0x12')]);return _0x4cf8f7(_0x5b6886[_0xb212('0x10')][_0xb212('0x12')]);}logger[_0xb212('0x10')](_0xb212('0xe'),_0x15a5a5,_0x5b6886[_0xb212('0x10')]['message']);return _0x5c1000(_0x5b6886['error']['message']);}else{logger['info'](_0xb212('0xe'),_0x15a5a5,_0xb212('0xf'));_0x5c1000(_0x5b6886[_0xb212('0x13')]['message']);}})[_0xb212('0x14')](function(_0x285ef6){logger[_0xb212('0x10')](_0xb212('0xe'),_0x15a5a5,_0x285ef6);_0x4cf8f7(_0x285ef6);});});} \ No newline at end of file +var _0x8b2d=['request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','code','error','message','info','result','catch','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','SmsTransferReport,\x20%s,\x20%s'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x8b2d,0xe5));var _0xd8b2=function(_0x4ec69a,_0x2826de){_0x4ec69a=_0x4ec69a-0x0;var _0x280921=_0x8b2d[_0x4ec69a];return _0x280921;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd8b2('0x0'));var BPromise=require('bluebird');var rs=require(_0xd8b2('0x1'));var fs=require('fs');var Redis=require(_0xd8b2('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xd8b2('0x3'));var logger=require(_0xd8b2('0x4'))('rpc');var config=require(_0xd8b2('0x5'));var jayson=require(_0xd8b2('0x6'));var client=jayson[_0xd8b2('0x7')][_0xd8b2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1c78f6,_0x1b35db,_0x42fe49){return new BPromise(function(_0x210fe2,_0x138995){return client[_0xd8b2('0x9')](_0x1c78f6,_0x42fe49)['then'](function(_0x2ac547){logger['info'](_0xd8b2('0xa'),_0x1b35db,_0xd8b2('0xb'));logger[_0xd8b2('0xc')](_0xd8b2('0xd'),_0x1b35db,_0xd8b2('0xb'),JSON['stringify'](_0x2ac547));if(_0x2ac547['error']){if(_0x2ac547['error'][_0xd8b2('0xe')]===0x1f4){logger[_0xd8b2('0xf')](_0xd8b2('0xa'),_0x1b35db,_0x2ac547['error'][_0xd8b2('0x10')]);return _0x138995(_0x2ac547[_0xd8b2('0xf')][_0xd8b2('0x10')]);}logger[_0xd8b2('0xf')]('SmsTransferReport,\x20%s,\x20%s',_0x1b35db,_0x2ac547[_0xd8b2('0xf')]['message']);return _0x210fe2(_0x2ac547['error'][_0xd8b2('0x10')]);}else{logger[_0xd8b2('0x11')](_0xd8b2('0xa'),_0x1b35db,_0xd8b2('0xb'));_0x210fe2(_0x2ac547[_0xd8b2('0x12')][_0xd8b2('0x10')]);}})[_0xd8b2('0x13')](function(_0x4bf135){logger['error'](_0xd8b2('0xa'),_0x1b35db,_0x4bf135);_0x138995(_0x4bf135);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 97bf7cb..f7c782f 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 _0xb9b6=['delete','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','index','/:id','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','now','extname','post','file','create','put','isAuthenticated','update'];(function(_0x4127cd,_0x29beaf){var _0x3b8888=function(_0x4ab864){while(--_0x4ab864){_0x4127cd['push'](_0x4127cd['shift']());}};_0x3b8888(++_0x29beaf);}(_0xb9b6,0xbc));var _0x6b9b=function(_0xf26d40,_0x2f4f46){_0xf26d40=_0xf26d40-0x0;var _0x50b68c=_0xb9b6[_0xf26d40];return _0x50b68c;};'use strict';var multer=require('multer');var util=require(_0x6b9b('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6b9b('0x1'));var router=express[_0x6b9b('0x2')]();var fs_extra=require(_0x6b9b('0x3'));var auth=require(_0x6b9b('0x4'));var interaction=require(_0x6b9b('0x5'));var config=require(_0x6b9b('0x6'));var controller=require(_0x6b9b('0x7'));router[_0x6b9b('0x8')]('/',auth['isAuthenticated'](),controller[_0x6b9b('0x9')]);router[_0x6b9b('0x8')](_0x6b9b('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x6b9b('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x6b9b('0xb')]);var upload=multer({'storage':multer[_0x6b9b('0xc')]({'destination':function(_0x43cf42,_0x2fb448,_0x3c5403){_0x3c5403(null,path[_0x6b9b('0xd')](config[_0x6b9b('0xe')],_0x6b9b('0xf')));},'filename':function(_0x28c110,_0x313768,_0x56421d){_0x313768[_0x6b9b('0x10')]=_0x313768[_0x6b9b('0x10')][_0x6b9b('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x56421d(null,util[_0x6b9b('0x12')](_0x6b9b('0x13'),path[_0x6b9b('0x14')](_0x313768['originalname'],path['extname'](_0x313768[_0x6b9b('0x10')])),Date[_0x6b9b('0x15')](),path[_0x6b9b('0x16')](_0x313768['originalname'])));}})});router[_0x6b9b('0x17')]('/',upload['single'](_0x6b9b('0x18')),controller[_0x6b9b('0x19')]);router[_0x6b9b('0x1a')](_0x6b9b('0xa'),auth[_0x6b9b('0x1b')](),controller[_0x6b9b('0x1c')]);router[_0x6b9b('0x1d')](_0x6b9b('0xa'),auth['isAuthenticated'](),controller['delete']);module[_0x6b9b('0x1e')]=router; \ No newline at end of file +var _0x8414=['single','file','create','put','update','delete','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','./sound.controller','isAuthenticated','index','get','/:id','show','/:id/download','download','diskStorage','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','extname','now','post'];(function(_0x3cff3a,_0x2dcc6b){var _0x31d709=function(_0x4471f1){while(--_0x4471f1){_0x3cff3a['push'](_0x3cff3a['shift']());}};_0x31d709(++_0x2dcc6b);}(_0x8414,0x1a7));var _0x4841=function(_0xb43d1b,_0x3935cf){_0xb43d1b=_0xb43d1b-0x0;var _0x4aafca=_0x8414[_0xb43d1b];return _0x4aafca;};'use strict';var multer=require(_0x4841('0x0'));var util=require(_0x4841('0x1'));var path=require(_0x4841('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4841('0x3')]();var fs_extra=require(_0x4841('0x4'));var auth=require(_0x4841('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4841('0x6'));var controller=require(_0x4841('0x7'));router['get']('/',auth[_0x4841('0x8')](),controller[_0x4841('0x9')]);router[_0x4841('0xa')](_0x4841('0xb'),auth[_0x4841('0x8')](),controller[_0x4841('0xc')]);router[_0x4841('0xa')](_0x4841('0xd'),auth[_0x4841('0x8')](),controller[_0x4841('0xe')]);var upload=multer({'storage':multer[_0x4841('0xf')]({'destination':function(_0x102adf,_0x45e8da,_0x347e0b){_0x347e0b(null,path['join'](config[_0x4841('0x10')],_0x4841('0x11')));},'filename':function(_0x1e19be,_0x2f8b8f,_0x196bf3){_0x2f8b8f[_0x4841('0x12')]=_0x2f8b8f['originalname'][_0x4841('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x196bf3(null,util[_0x4841('0x14')](_0x4841('0x15'),path['basename'](_0x2f8b8f[_0x4841('0x12')],path[_0x4841('0x16')](_0x2f8b8f[_0x4841('0x12')])),Date[_0x4841('0x17')](),path['extname'](_0x2f8b8f['originalname'])));}})});router[_0x4841('0x18')]('/',upload[_0x4841('0x19')](_0x4841('0x1a')),controller[_0x4841('0x1b')]);router[_0x4841('0x1c')](_0x4841('0xb'),auth[_0x4841('0x8')](),controller[_0x4841('0x1d')]);router[_0x4841('0x1e')](_0x4841('0xb'),auth[_0x4841('0x8')](),controller['delete']);module[_0x4841('0x1f')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 36407c0..927207c 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 _0x2df8=['INTEGER','exports','STRING','name','FLOAT','BIGINT'];(function(_0x1b563d,_0x51bf87){var _0x4a31a0=function(_0x579b06){while(--_0x579b06){_0x1b563d['push'](_0x1b563d['shift']());}};_0x4a31a0(++_0x51bf87);}(_0x2df8,0x15d));var _0x82df=function(_0x1144cf,_0x18f0d1){_0x1144cf=_0x1144cf-0x0;var _0x564dcb=_0x2df8[_0x1144cf];return _0x564dcb;};'use strict';var Sequelize=require('sequelize');module[_0x82df('0x0')]={'name':{'type':Sequelize[_0x82df('0x1')],'unique':_0x82df('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x82df('0x1')]},'display_name':{'type':Sequelize[_0x82df('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x82df('0x1')]},'original_format':{'type':Sequelize[_0x82df('0x1')]},'original_duration':{'type':Sequelize[_0x82df('0x3')]},'original_sampleCount':{'type':Sequelize[_0x82df('0x4')]},'original_channelCount':{'type':Sequelize[_0x82df('0x5')]},'original_bitRate':{'type':Sequelize[_0x82df('0x4')]},'original_sampleRate':{'type':Sequelize[_0x82df('0x5')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0x82df('0x4')]},'converted_channelCount':{'type':Sequelize[_0x82df('0x5')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x3294=['name','FLOAT','BIGINT','INTEGER','exports','STRING'];(function(_0x905d86,_0x3cb8c5){var _0x35793c=function(_0x3c8f0b){while(--_0x3c8f0b){_0x905d86['push'](_0x905d86['shift']());}};_0x35793c(++_0x3cb8c5);}(_0x3294,0x1ba));var _0x4329=function(_0x4df440,_0x270d2b){_0x4df440=_0x4df440-0x0;var _0x55288e=_0x3294[_0x4df440];return _0x55288e;};'use strict';var Sequelize=require('sequelize');module[_0x4329('0x0')]={'name':{'type':Sequelize[_0x4329('0x1')],'unique':_0x4329('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x4329('0x1')]},'display_name':{'type':Sequelize[_0x4329('0x1')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0x4329('0x1')]},'original_duration':{'type':Sequelize[_0x4329('0x3')]},'original_sampleCount':{'type':Sequelize[_0x4329('0x4')]},'original_channelCount':{'type':Sequelize[_0x4329('0x5')]},'original_bitRate':{'type':Sequelize[_0x4329('0x4')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0x4329('0x3')]},'converted_sampleCount':{'type':Sequelize[_0x4329('0x4')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0x4329('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x4329('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 07684af..ef67a1a 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 _0x5bb7=['format','create','basename','file','originalname','filename','extname','substring','wav','server/files/sounds/original','info','chmodSync','0777','unlinkSync','send','src','original_duration','duration','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','sampleRate','role','body','userProfileId','user','UserProfileSection','autoAssociation','error','start','description','original_format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','Content-Range','json','apply','reject','update','then','Sounds','destroy','sendStatus','name','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','Sound','includeAll','include','findAll','rows','show','params','find','catch','save_name','converted_format','existsSync','join','root','Sequelize','ValidationError','server/files/sounds/converted','%s.%s'];(function(_0x1f2475,_0x149b0b){var _0x438a1e=function(_0x39872d){while(--_0x39872d){_0x1f2475['push'](_0x1f2475['shift']());}};_0x438a1e(++_0x149b0b);}(_0x5bb7,0x11b));var _0x75bb=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5bb7[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x75bb('0x0'));var zipdir=require(_0x75bb('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x75bb('0x2'));var moment=require(_0x75bb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x75bb('0x4'));var util=require(_0x75bb('0x5'));var path=require(_0x75bb('0x6'));var sox=require(_0x75bb('0x7'));var csv=require(_0x75bb('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x75bb('0x9'));var _=require(_0x75bb('0xa'));var squel=require(_0x75bb('0xb'));var crypto=require(_0x75bb('0xc'));var jsforce=require(_0x75bb('0xd'));var deskjs=require(_0x75bb('0xe'));var toCsv=require(_0x75bb('0x8'));var querystring=require(_0x75bb('0xf'));var Papa=require(_0x75bb('0x10'));var Redis=require(_0x75bb('0x11'));var authService=require(_0x75bb('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x75bb('0x13'));var hardwareService=require(_0x75bb('0x14'));var logger=require('../../config/logger')(_0x75bb('0x15'));var utils=require(_0x75bb('0x16'));var config=require(_0x75bb('0x17'));var licenseUtil=require(_0x75bb('0x18'));var db=require(_0x75bb('0x19'))['db'];function respondWithStatusCode(_0x288733,_0x257578){_0x257578=_0x257578||0xcc;return function(_0x4f894e){if(_0x4f894e){return _0x288733['sendStatus'](_0x257578);}return _0x288733[_0x75bb('0x1a')](_0x257578)[_0x75bb('0x1b')]();};}function respondWithResult(_0x551e23,_0xdb23cf){_0xdb23cf=_0xdb23cf||0xc8;return function(_0x2f4ffe){if(_0x2f4ffe){return _0x551e23[_0x75bb('0x1a')](_0xdb23cf)['json'](_0x2f4ffe);}};}function respondWithFilteredResult(_0x43caee,_0x820373){return function(_0x5ac4b5){if(_0x5ac4b5){var _0x412df5=typeof _0x820373[_0x75bb('0x1c')]==='undefined'&&typeof _0x820373['limit']===_0x75bb('0x1d');var _0x4a9f63=_0x5ac4b5[_0x75bb('0x1e')];var _0x1711a4=_0x412df5?0x0:_0x820373[_0x75bb('0x1c')];var _0x341a40=_0x412df5?_0x5ac4b5[_0x75bb('0x1e')]:_0x820373[_0x75bb('0x1c')]+_0x820373['limit'];var _0x56d932;if(_0x341a40>=_0x4a9f63){_0x341a40=_0x4a9f63;_0x56d932=0xc8;}else{_0x56d932=0xce;}_0x43caee[_0x75bb('0x1a')](_0x56d932);return _0x43caee['set'](_0x75bb('0x1f'),_0x1711a4+'-'+_0x341a40+'/'+_0x4a9f63)[_0x75bb('0x20')](_0x5ac4b5);}return null;};}function patchUpdates(_0x36d186){return function(_0x4cf7de){try{jsonpatch[_0x75bb('0x21')](_0x4cf7de,_0x36d186,!![]);}catch(_0x44eea2){return BPromise[_0x75bb('0x22')](_0x44eea2);}return _0x4cf7de['save']();};}function saveUpdates(_0x15fc2f,_0x18d9b2){return function(_0x53b984){if(_0x53b984){return _0x53b984[_0x75bb('0x23')](_0x15fc2f)['then'](function(_0x244130){return _0x244130;});}return null;};}function removeEntity(_0x21b54b,_0x338e70){return function(_0x17f97e){if(_0x17f97e){return _0x17f97e['destroy']()[_0x75bb('0x24')](function(){var _0x51800e=_0x17f97e['get']({'plain':!![]});var _0x61052d=_0x75bb('0x25');return db['UserProfileResource'][_0x75bb('0x26')]({'where':{'type':_0x61052d,'resourceId':_0x51800e['id']}})[_0x75bb('0x24')](function(){return _0x17f97e;});})[_0x75bb('0x24')](function(){_0x21b54b[_0x75bb('0x1a')](0xcc)[_0x75bb('0x1b')]();});}};}function handleEntityNotFound(_0xeec298,_0x3258a6){return function(_0x99d9b4){if(!_0x99d9b4){_0xeec298[_0x75bb('0x27')](0x194);}return _0x99d9b4;};}function handleError(_0x48a0bb,_0x5d6062){_0x5d6062=_0x5d6062||0x1f4;return function(_0x3d819a){logger['error'](_0x3d819a['stack']);if(_0x3d819a['name']){delete _0x3d819a[_0x75bb('0x28')];}_0x48a0bb[_0x75bb('0x1a')](_0x5d6062)['send'](_0x3d819a);};}exports['index']=function(_0x4490b4,_0x1121ca){var _0x4b65f6={},_0x3b3454={},_0x1bc8a7={'count':0x0,'rows':[]};var _0x118251=_[_0x75bb('0x29')](db['Sound'][_0x75bb('0x2a')],function(_0x102754){return{'name':_0x102754[_0x75bb('0x2b')],'type':_0x102754[_0x75bb('0x2c')][_0x75bb('0x2d')]};});_0x3b3454[_0x75bb('0x2e')]=_[_0x75bb('0x29')](_0x118251,_0x75bb('0x28'));_0x3b3454[_0x75bb('0x2f')]=_[_0x75bb('0x30')](_0x4490b4[_0x75bb('0x2f')]);_0x3b3454['filters']=_[_0x75bb('0x31')](_0x3b3454[_0x75bb('0x2e')],_0x3b3454[_0x75bb('0x2f')]);_0x4b65f6[_0x75bb('0x32')]=_['intersection'](_0x3b3454[_0x75bb('0x2e')],qs['fields'](_0x4490b4[_0x75bb('0x2f')][_0x75bb('0x33')]));_0x4b65f6[_0x75bb('0x32')]=_0x4b65f6['attributes'][_0x75bb('0x34')]?_0x4b65f6['attributes']:_0x3b3454[_0x75bb('0x2e')];if(!_0x4490b4['query'][_0x75bb('0x35')](_0x75bb('0x36'))){_0x4b65f6[_0x75bb('0x37')]=qs[_0x75bb('0x37')](_0x4490b4['query'][_0x75bb('0x37')]);_0x4b65f6[_0x75bb('0x1c')]=qs[_0x75bb('0x1c')](_0x4490b4[_0x75bb('0x2f')][_0x75bb('0x1c')]);}_0x4b65f6[_0x75bb('0x38')]=qs[_0x75bb('0x39')](_0x4490b4[_0x75bb('0x2f')][_0x75bb('0x39')]);_0x4b65f6[_0x75bb('0x3a')]=qs[_0x75bb('0x3b')](_[_0x75bb('0x3c')](_0x4490b4[_0x75bb('0x2f')],_0x3b3454[_0x75bb('0x3b')]),_0x118251);if(_0x4490b4[_0x75bb('0x2f')][_0x75bb('0x3d')]){_0x4b65f6[_0x75bb('0x3a')]=_[_0x75bb('0x3e')](_0x4b65f6[_0x75bb('0x3a')],{'$or':_[_0x75bb('0x29')](_0x118251,function(_0x2a2a6e){if(_0x2a2a6e['type']!==_0x75bb('0x3f')){var _0x52f6a9={};_0x52f6a9[_0x2a2a6e[_0x75bb('0x28')]]={'$like':'%'+_0x4490b4[_0x75bb('0x2f')][_0x75bb('0x3d')]+'%'};return _0x52f6a9;}})});}_0x4b65f6=_['merge']({},_0x4b65f6,_0x4490b4[_0x75bb('0x40')]);var _0x26e851={'where':_0x4b65f6[_0x75bb('0x3a')]};return db[_0x75bb('0x41')][_0x75bb('0x1e')](_0x26e851)[_0x75bb('0x24')](function(_0x19ad63){_0x1bc8a7[_0x75bb('0x1e')]=_0x19ad63;if(_0x4490b4[_0x75bb('0x2f')][_0x75bb('0x42')]){_0x4b65f6[_0x75bb('0x43')]=[{'all':!![]}];}return db[_0x75bb('0x41')][_0x75bb('0x44')](_0x4b65f6);})['then'](function(_0x4fc9da){_0x1bc8a7[_0x75bb('0x45')]=_0x4fc9da;return _0x1bc8a7;})['then'](respondWithFilteredResult(_0x1121ca,_0x4b65f6))['catch'](handleError(_0x1121ca,null));};exports[_0x75bb('0x46')]=function(_0x2cc2f2,_0x5ddba9){var _0x458666={'raw':!![],'where':{'id':_0x2cc2f2[_0x75bb('0x47')]['id']}},_0x3e5176={};_0x3e5176[_0x75bb('0x2e')]=_[_0x75bb('0x30')](db[_0x75bb('0x41')][_0x75bb('0x2a')]);_0x3e5176[_0x75bb('0x2f')]=_[_0x75bb('0x30')](_0x2cc2f2[_0x75bb('0x2f')]);_0x3e5176[_0x75bb('0x3b')]=_[_0x75bb('0x31')](_0x3e5176[_0x75bb('0x2e')],_0x3e5176[_0x75bb('0x2f')]);_0x458666[_0x75bb('0x32')]=_['intersection'](_0x3e5176[_0x75bb('0x2e')],qs[_0x75bb('0x33')](_0x2cc2f2[_0x75bb('0x2f')]['fields']));_0x458666['attributes']=_0x458666[_0x75bb('0x32')][_0x75bb('0x34')]?_0x458666['attributes']:_0x3e5176[_0x75bb('0x2e')];if(_0x2cc2f2['query'][_0x75bb('0x42')]){_0x458666['include']=[{'all':!![]}];}_0x458666=_[_0x75bb('0x3e')]({},_0x458666,_0x2cc2f2[_0x75bb('0x40')]);return db[_0x75bb('0x41')][_0x75bb('0x48')](_0x458666)[_0x75bb('0x24')](handleEntityNotFound(_0x5ddba9,null))['then'](respondWithResult(_0x5ddba9,null))[_0x75bb('0x49')](handleError(_0x5ddba9,null));};exports['download']=function(_0x2acfc7,_0x3c8a1b,_0x42bac9){return db[_0x75bb('0x41')]['find']({'where':{'id':_0x2acfc7[_0x75bb('0x47')]['id']},'attributes':['name',_0x75bb('0x4a'),_0x75bb('0x4b')],'raw':!![]})[_0x75bb('0x24')](handleEntityNotFound(_0x3c8a1b,null))[_0x75bb('0x24')](function(_0x4381eb){if(_0x4381eb){if(!fs[_0x75bb('0x4c')](path[_0x75bb('0x4d')](config[_0x75bb('0x4e')],'server/files/sounds/converted',_0x4381eb[_0x75bb('0x4a')]+'.'+_0x4381eb[_0x75bb('0x4b')]))){throw new db[(_0x75bb('0x4f'))][(_0x75bb('0x50'))]('Sound\x20not\x20found');}return _0x3c8a1b['download'](path['join'](config[_0x75bb('0x4e')],_0x75bb('0x51'),util['format'](_0x75bb('0x52'),_0x4381eb['save_name'],_0x4381eb[_0x75bb('0x4b')])),util[_0x75bb('0x53')](_0x75bb('0x52'),_0x4381eb[_0x75bb('0x28')],_0x4381eb[_0x75bb('0x4b')]));}return null;})[_0x75bb('0x49')](handleError(_0x3c8a1b,null));};exports[_0x75bb('0x54')]=function(_0x3f20b8,_0x41ad0e,_0x4434af){var _0x1e31b9={'name':path[_0x75bb('0x55')](_0x3f20b8[_0x75bb('0x56')][_0x75bb('0x57')],path['extname'](_0x3f20b8['file']['originalname'])),'save_name':path[_0x75bb('0x55')](_0x3f20b8['file'][_0x75bb('0x58')],path[_0x75bb('0x59')](_0x3f20b8[_0x75bb('0x56')]['filename'])),'original_format':path[_0x75bb('0x59')](_0x3f20b8[_0x75bb('0x56')][_0x75bb('0x57')])[_0x75bb('0x5a')](0x1),'converted_format':_0x75bb('0x5b')};var _0x453d3e=path['join'](config['root'],_0x75bb('0x5c'),_0x3f20b8['file']['filename']);var _0x4f408c=path[_0x75bb('0x4d')](config[_0x75bb('0x4e')],_0x75bb('0x51'),util['format'](_0x75bb('0x52'),path[_0x75bb('0x55')](_0x3f20b8[_0x75bb('0x56')][_0x75bb('0x58')],path['extname'](_0x3f20b8[_0x75bb('0x56')]['filename'])),_0x1e31b9[_0x75bb('0x4b')]));logger[_0x75bb('0x5d')]('Sound\x20upload\x20filepath:\x20%s',_0x453d3e);logger['info']('Sound\x20upload\x20destination:\x20%s',_0x4f408c);try{fs[_0x75bb('0x5e')](_0x453d3e,parseInt(_0x75bb('0x5f'),0x8));var _0x49356=sox['transcode'](_0x453d3e,_0x4f408c,{'sampleRate':0x1f40,'format':_0x75bb('0x5b'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x49356['on']('error',function(_0x4fa7d1){fs[_0x75bb('0x60')](_0x453d3e);_0x41ad0e[_0x75bb('0x1a')](0x1f4)[_0x75bb('0x61')](_0x4fa7d1);});_0x49356['on'](_0x75bb('0x62'),function(_0x54d2da){_0x1e31b9[_0x75bb('0x63')]=isNaN(_0x54d2da['duration'])?null:_0x54d2da[_0x75bb('0x64')]*0x3e8;_0x1e31b9['original_sampleCount']=isNaN(_0x54d2da['sampleCount'])?null:_0x54d2da[_0x75bb('0x65')];_0x1e31b9[_0x75bb('0x66')]=isNaN(_0x54d2da['channelCount'])?null:_0x54d2da[_0x75bb('0x67')];_0x1e31b9[_0x75bb('0x68')]=isNaN(_0x54d2da[_0x75bb('0x69')])?null:_0x54d2da[_0x75bb('0x69')];_0x1e31b9[_0x75bb('0x6a')]=isNaN(_0x54d2da['sampleRate'])?null:_0x54d2da['sampleRate'];});_0x49356['on']('dest',function(_0x527375){_0x1e31b9[_0x75bb('0x6b')]=isNaN(_0x527375[_0x75bb('0x64')])?null:_0x527375[_0x75bb('0x64')]*0x3e8;_0x1e31b9[_0x75bb('0x6c')]=isNaN(_0x527375[_0x75bb('0x65')])?null:_0x527375[_0x75bb('0x65')];_0x1e31b9[_0x75bb('0x6d')]=isNaN(_0x527375['channelCount'])?null:_0x527375[_0x75bb('0x67')];_0x1e31b9[_0x75bb('0x6e')]=isNaN(_0x527375[_0x75bb('0x69')])?null:_0x527375[_0x75bb('0x69')];_0x1e31b9['converted_sampleRate']=isNaN(_0x527375[_0x75bb('0x6f')])?null:_0x527375[_0x75bb('0x6f')];});_0x49356['on'](_0x75bb('0x1b'),function(){fs[_0x75bb('0x5e')](_0x4f408c,parseInt('0777',0x8));return db[_0x75bb('0x41')][_0x75bb('0x54')](_0x1e31b9)[_0x75bb('0x24')](function(_0x248173){var _0x45f25e={'role':_0x3f20b8['body'][_0x75bb('0x70')],'userProfileId':_0x3f20b8[_0x75bb('0x71')][_0x75bb('0x72')]};if(!_0x45f25e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x45f25e[_0x75bb('0x70')]===_0x75bb('0x73')){var _0x47ecda=_0x248173['get']({'plain':!![]});return db[_0x75bb('0x74')][_0x75bb('0x48')]({'where':{'name':_0x75bb('0x25'),'userProfileId':_0x45f25e[_0x75bb('0x72')]},'raw':!![]})[_0x75bb('0x24')](function(_0x32233f){if(_0x32233f&&_0x32233f[_0x75bb('0x75')]===0x0){return db['UserProfileResource'][_0x75bb('0x54')]({'name':_0x47ecda[_0x75bb('0x28')],'resourceId':_0x47ecda['id'],'type':_0x32233f[_0x75bb('0x28')],'sectionId':_0x32233f['id']},{})[_0x75bb('0x24')](function(){return _0x248173;});}else{return _0x248173;}})[_0x75bb('0x49')](function(_0x26fe52){logger[_0x75bb('0x76')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x26fe52);throw _0x26fe52;});}return _0x248173;})[_0x75bb('0x24')](respondWithResult(_0x41ad0e,null))[_0x75bb('0x49')](handleError(_0x41ad0e,null));});_0x49356[_0x75bb('0x77')]();}catch(_0x2e16ce){_0x41ad0e[_0x75bb('0x1a')](0x1f4)[_0x75bb('0x61')](_0x2e16ce);}};exports[_0x75bb('0x23')]=function(_0x873509,_0x6b66e4,_0x1f02d1){return db[_0x75bb('0x41')]['find']({'where':{'id':_0x873509['params']['id']}})['then'](handleEntityNotFound(_0x6b66e4,null))[_0x75bb('0x24')](saveUpdates(_[_0x75bb('0x3c')](_0x873509['body'],['name',_0x75bb('0x78')]),null))[_0x75bb('0x24')](respondWithResult(_0x6b66e4,null))[_0x75bb('0x49')](handleError(_0x6b66e4,null));};exports['delete']=function(_0x3ea51d,_0x156010,_0x52d31c){return db[_0x75bb('0x41')]['find']({'where':{'id':_0x3ea51d['params']['id']}})[_0x75bb('0x24')](function(_0x15704f){if(_0x15704f){return _0x15704f[_0x75bb('0x26')]();}})[_0x75bb('0x24')](function(_0x123b21){var _0x8f5524=path['join'](config[_0x75bb('0x4e')],'server/files/sounds/original',util[_0x75bb('0x53')]('%s.%s',_0x123b21[_0x75bb('0x4a')],_0x123b21[_0x75bb('0x79')]));var _0x3d6880=path[_0x75bb('0x4d')](config[_0x75bb('0x4e')],'server/files/sounds/converted',util[_0x75bb('0x53')](_0x75bb('0x52'),_0x123b21['save_name'],_0x123b21[_0x75bb('0x4b')]));fs[_0x75bb('0x60')](_0x8f5524);fs[_0x75bb('0x60')](_0x3d6880);return _0x123b21;})[_0x75bb('0x24')](function(_0x5c12d8){if(_0x5c12d8){return _0x156010[_0x75bb('0x1a')](0xcc)[_0x75bb('0x1b')]();}})[_0x75bb('0x24')](handleEntityNotFound(_0x156010,null))[_0x75bb('0x49')](handleError(_0x156010,null));}; \ No newline at end of file +var _0xa4da=['end','error','name','send','index','map','Sound','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','download','save_name','converted_format','existsSync','root','Sequelize','ValidationError','server/files/sounds/converted','format','%s.%s','create','basename','file','extname','filename','substring','wav','server/files/sounds/original','join','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Sounds','autoAssociation','start','delete','original_format','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','apply','save','update','then','destroy','get','UserProfileResource'];(function(_0x526a46,_0x2b4841){var _0x2c5b48=function(_0x4116d9){while(--_0x4116d9){_0x526a46['push'](_0x526a46['shift']());}};_0x2c5b48(++_0x2b4841);}(_0xa4da,0x156));var _0xaa4d=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa4da[_0x56482c];return _0x5aae7a;};'use strict';var emlformat=require(_0xaa4d('0x0'));var rimraf=require(_0xaa4d('0x1'));var zipdir=require(_0xaa4d('0x2'));var jsonpatch=require(_0xaa4d('0x3'));var rp=require(_0xaa4d('0x4'));var moment=require(_0xaa4d('0x5'));var BPromise=require(_0xaa4d('0x6'));var Mustache=require('mustache');var util=require(_0xaa4d('0x7'));var path=require(_0xaa4d('0x8'));var sox=require(_0xaa4d('0x9'));var csv=require(_0xaa4d('0xa'));var ejs=require(_0xaa4d('0xb'));var fs=require('fs');var fs_extra=require(_0xaa4d('0xc'));var _=require(_0xaa4d('0xd'));var squel=require(_0xaa4d('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xaa4d('0xf'));var toCsv=require('to-csv');var querystring=require(_0xaa4d('0x10'));var Papa=require('papaparse');var Redis=require(_0xaa4d('0x11'));var authService=require(_0xaa4d('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xaa4d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xaa4d('0x14'));var utils=require(_0xaa4d('0x15'));var config=require(_0xaa4d('0x16'));var licenseUtil=require(_0xaa4d('0x17'));var db=require(_0xaa4d('0x18'))['db'];function respondWithStatusCode(_0x253020,_0x4d1036){_0x4d1036=_0x4d1036||0xcc;return function(_0xdf26a7){if(_0xdf26a7){return _0x253020[_0xaa4d('0x19')](_0x4d1036);}return _0x253020[_0xaa4d('0x1a')](_0x4d1036)['end']();};}function respondWithResult(_0x349a20,_0x87fc45){_0x87fc45=_0x87fc45||0xc8;return function(_0x193d7c){if(_0x193d7c){return _0x349a20[_0xaa4d('0x1a')](_0x87fc45)[_0xaa4d('0x1b')](_0x193d7c);}};}function respondWithFilteredResult(_0x59fa3c,_0x4838c4){return function(_0x3f2062){if(_0x3f2062){var _0x4561d3=typeof _0x4838c4[_0xaa4d('0x1c')]===_0xaa4d('0x1d')&&typeof _0x4838c4[_0xaa4d('0x1e')]===_0xaa4d('0x1d');var _0x483f0f=_0x3f2062['count'];var _0x1df625=_0x4561d3?0x0:_0x4838c4['offset'];var _0x4f0b20=_0x4561d3?_0x3f2062[_0xaa4d('0x1f')]:_0x4838c4[_0xaa4d('0x1c')]+_0x4838c4['limit'];var _0x272412;if(_0x4f0b20>=_0x483f0f){_0x4f0b20=_0x483f0f;_0x272412=0xc8;}else{_0x272412=0xce;}_0x59fa3c[_0xaa4d('0x1a')](_0x272412);return _0x59fa3c['set']('Content-Range',_0x1df625+'-'+_0x4f0b20+'/'+_0x483f0f)['json'](_0x3f2062);}return null;};}function patchUpdates(_0xab3c8e){return function(_0x67d16d){try{jsonpatch[_0xaa4d('0x20')](_0x67d16d,_0xab3c8e,!![]);}catch(_0x4dacc4){return BPromise['reject'](_0x4dacc4);}return _0x67d16d[_0xaa4d('0x21')]();};}function saveUpdates(_0x1c68a3,_0x4c6f93){return function(_0x56185b){if(_0x56185b){return _0x56185b[_0xaa4d('0x22')](_0x1c68a3)[_0xaa4d('0x23')](function(_0x1d888b){return _0x1d888b;});}return null;};}function removeEntity(_0x36e13b,_0x5f62ff){return function(_0x68e06f){if(_0x68e06f){return _0x68e06f[_0xaa4d('0x24')]()[_0xaa4d('0x23')](function(){var _0xff6aac=_0x68e06f[_0xaa4d('0x25')]({'plain':!![]});var _0x4ab428='Sounds';return db[_0xaa4d('0x26')][_0xaa4d('0x24')]({'where':{'type':_0x4ab428,'resourceId':_0xff6aac['id']}})[_0xaa4d('0x23')](function(){return _0x68e06f;});})[_0xaa4d('0x23')](function(){_0x36e13b[_0xaa4d('0x1a')](0xcc)[_0xaa4d('0x27')]();});}};}function handleEntityNotFound(_0x5c7a3f,_0x4343c7){return function(_0x1fcca3){if(!_0x1fcca3){_0x5c7a3f[_0xaa4d('0x19')](0x194);}return _0x1fcca3;};}function handleError(_0x4fa5cd,_0x45aab3){_0x45aab3=_0x45aab3||0x1f4;return function(_0xd34532){logger[_0xaa4d('0x28')](_0xd34532['stack']);if(_0xd34532[_0xaa4d('0x29')]){delete _0xd34532[_0xaa4d('0x29')];}_0x4fa5cd[_0xaa4d('0x1a')](_0x45aab3)[_0xaa4d('0x2a')](_0xd34532);};}exports[_0xaa4d('0x2b')]=function(_0x55cbec,_0x26ee77){var _0x127c23={},_0x2bcdf9={},_0x149508={'count':0x0,'rows':[]};var _0x59861c=_[_0xaa4d('0x2c')](db[_0xaa4d('0x2d')][_0xaa4d('0x2e')],function(_0x30b010){return{'name':_0x30b010[_0xaa4d('0x2f')],'type':_0x30b010[_0xaa4d('0x30')]['key']};});_0x2bcdf9[_0xaa4d('0x31')]=_['map'](_0x59861c,'name');_0x2bcdf9[_0xaa4d('0x32')]=_[_0xaa4d('0x33')](_0x55cbec[_0xaa4d('0x32')]);_0x2bcdf9[_0xaa4d('0x34')]=_[_0xaa4d('0x35')](_0x2bcdf9['model'],_0x2bcdf9[_0xaa4d('0x32')]);_0x127c23[_0xaa4d('0x36')]=_['intersection'](_0x2bcdf9[_0xaa4d('0x31')],qs[_0xaa4d('0x37')](_0x55cbec['query'][_0xaa4d('0x37')]));_0x127c23['attributes']=_0x127c23[_0xaa4d('0x36')][_0xaa4d('0x38')]?_0x127c23[_0xaa4d('0x36')]:_0x2bcdf9[_0xaa4d('0x31')];if(!_0x55cbec['query'][_0xaa4d('0x39')]('nolimit')){_0x127c23[_0xaa4d('0x1e')]=qs[_0xaa4d('0x1e')](_0x55cbec[_0xaa4d('0x32')][_0xaa4d('0x1e')]);_0x127c23[_0xaa4d('0x1c')]=qs[_0xaa4d('0x1c')](_0x55cbec['query'][_0xaa4d('0x1c')]);}_0x127c23['order']=qs[_0xaa4d('0x3a')](_0x55cbec[_0xaa4d('0x32')]['sort']);_0x127c23[_0xaa4d('0x3b')]=qs[_0xaa4d('0x34')](_[_0xaa4d('0x3c')](_0x55cbec[_0xaa4d('0x32')],_0x2bcdf9['filters']),_0x59861c);if(_0x55cbec[_0xaa4d('0x32')][_0xaa4d('0x3d')]){_0x127c23[_0xaa4d('0x3b')]=_[_0xaa4d('0x3e')](_0x127c23[_0xaa4d('0x3b')],{'$or':_[_0xaa4d('0x2c')](_0x59861c,function(_0x58ffcf){if(_0x58ffcf[_0xaa4d('0x30')]!==_0xaa4d('0x3f')){var _0xa089f3={};_0xa089f3[_0x58ffcf[_0xaa4d('0x29')]]={'$like':'%'+_0x55cbec[_0xaa4d('0x32')][_0xaa4d('0x3d')]+'%'};return _0xa089f3;}})});}_0x127c23=_[_0xaa4d('0x3e')]({},_0x127c23,_0x55cbec[_0xaa4d('0x40')]);var _0x2ff5d8={'where':_0x127c23[_0xaa4d('0x3b')]};return db[_0xaa4d('0x2d')][_0xaa4d('0x1f')](_0x2ff5d8)['then'](function(_0x9357ed){_0x149508[_0xaa4d('0x1f')]=_0x9357ed;if(_0x55cbec['query'][_0xaa4d('0x41')]){_0x127c23[_0xaa4d('0x42')]=[{'all':!![]}];}return db[_0xaa4d('0x2d')][_0xaa4d('0x43')](_0x127c23);})[_0xaa4d('0x23')](function(_0x48bad6){_0x149508[_0xaa4d('0x44')]=_0x48bad6;return _0x149508;})[_0xaa4d('0x23')](respondWithFilteredResult(_0x26ee77,_0x127c23))[_0xaa4d('0x45')](handleError(_0x26ee77,null));};exports[_0xaa4d('0x46')]=function(_0x378bb1,_0x2845af){var _0x41d88a={'raw':!![],'where':{'id':_0x378bb1[_0xaa4d('0x47')]['id']}},_0x73cdfd={};_0x73cdfd[_0xaa4d('0x31')]=_[_0xaa4d('0x33')](db[_0xaa4d('0x2d')][_0xaa4d('0x2e')]);_0x73cdfd[_0xaa4d('0x32')]=_[_0xaa4d('0x33')](_0x378bb1[_0xaa4d('0x32')]);_0x73cdfd[_0xaa4d('0x34')]=_[_0xaa4d('0x35')](_0x73cdfd['model'],_0x73cdfd[_0xaa4d('0x32')]);_0x41d88a[_0xaa4d('0x36')]=_['intersection'](_0x73cdfd['model'],qs[_0xaa4d('0x37')](_0x378bb1[_0xaa4d('0x32')][_0xaa4d('0x37')]));_0x41d88a[_0xaa4d('0x36')]=_0x41d88a['attributes']['length']?_0x41d88a['attributes']:_0x73cdfd[_0xaa4d('0x31')];if(_0x378bb1[_0xaa4d('0x32')]['includeAll']){_0x41d88a[_0xaa4d('0x42')]=[{'all':!![]}];}_0x41d88a=_[_0xaa4d('0x3e')]({},_0x41d88a,_0x378bb1[_0xaa4d('0x40')]);return db[_0xaa4d('0x2d')][_0xaa4d('0x48')](_0x41d88a)[_0xaa4d('0x23')](handleEntityNotFound(_0x2845af,null))[_0xaa4d('0x23')](respondWithResult(_0x2845af,null))[_0xaa4d('0x45')](handleError(_0x2845af,null));};exports[_0xaa4d('0x49')]=function(_0x31aa72,_0x27fb49,_0xb3731e){return db[_0xaa4d('0x2d')][_0xaa4d('0x48')]({'where':{'id':_0x31aa72['params']['id']},'attributes':['name',_0xaa4d('0x4a'),_0xaa4d('0x4b')],'raw':!![]})[_0xaa4d('0x23')](handleEntityNotFound(_0x27fb49,null))['then'](function(_0x3217a1){if(_0x3217a1){if(!fs[_0xaa4d('0x4c')](path['join'](config[_0xaa4d('0x4d')],'server/files/sounds/converted',_0x3217a1[_0xaa4d('0x4a')]+'.'+_0x3217a1[_0xaa4d('0x4b')]))){throw new db[(_0xaa4d('0x4e'))][(_0xaa4d('0x4f'))]('Sound\x20not\x20found');}return _0x27fb49[_0xaa4d('0x49')](path['join'](config['root'],_0xaa4d('0x50'),util[_0xaa4d('0x51')](_0xaa4d('0x52'),_0x3217a1[_0xaa4d('0x4a')],_0x3217a1['converted_format'])),util['format'](_0xaa4d('0x52'),_0x3217a1['name'],_0x3217a1[_0xaa4d('0x4b')]));}return null;})[_0xaa4d('0x45')](handleError(_0x27fb49,null));};exports[_0xaa4d('0x53')]=function(_0x577dcf,_0x234e4a,_0x44e3b6){var _0x2fc5eb={'name':path[_0xaa4d('0x54')](_0x577dcf[_0xaa4d('0x55')]['originalname'],path[_0xaa4d('0x56')](_0x577dcf[_0xaa4d('0x55')]['originalname'])),'save_name':path[_0xaa4d('0x54')](_0x577dcf[_0xaa4d('0x55')]['filename'],path['extname'](_0x577dcf[_0xaa4d('0x55')][_0xaa4d('0x57')])),'original_format':path['extname'](_0x577dcf[_0xaa4d('0x55')]['originalname'])[_0xaa4d('0x58')](0x1),'converted_format':_0xaa4d('0x59')};var _0x3dc8b0=path['join'](config[_0xaa4d('0x4d')],_0xaa4d('0x5a'),_0x577dcf[_0xaa4d('0x55')][_0xaa4d('0x57')]);var _0x1bcfe0=path[_0xaa4d('0x5b')](config[_0xaa4d('0x4d')],'server/files/sounds/converted',util[_0xaa4d('0x51')](_0xaa4d('0x52'),path[_0xaa4d('0x54')](_0x577dcf[_0xaa4d('0x55')][_0xaa4d('0x57')],path[_0xaa4d('0x56')](_0x577dcf[_0xaa4d('0x55')][_0xaa4d('0x57')])),_0x2fc5eb[_0xaa4d('0x4b')]));logger[_0xaa4d('0x5c')](_0xaa4d('0x5d'),_0x3dc8b0);logger['info'](_0xaa4d('0x5e'),_0x1bcfe0);try{fs[_0xaa4d('0x5f')](_0x3dc8b0,parseInt(_0xaa4d('0x60'),0x8));var _0x7215e5=sox[_0xaa4d('0x61')](_0x3dc8b0,_0x1bcfe0,{'sampleRate':0x1f40,'format':_0xaa4d('0x59'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x7215e5['on'](_0xaa4d('0x28'),function(_0x349d94){fs['unlinkSync'](_0x3dc8b0);_0x234e4a['status'](0x1f4)[_0xaa4d('0x2a')](_0x349d94);});_0x7215e5['on'](_0xaa4d('0x62'),function(_0x3932f6){_0x2fc5eb[_0xaa4d('0x63')]=isNaN(_0x3932f6[_0xaa4d('0x64')])?null:_0x3932f6[_0xaa4d('0x64')]*0x3e8;_0x2fc5eb[_0xaa4d('0x65')]=isNaN(_0x3932f6[_0xaa4d('0x66')])?null:_0x3932f6[_0xaa4d('0x66')];_0x2fc5eb[_0xaa4d('0x67')]=isNaN(_0x3932f6[_0xaa4d('0x68')])?null:_0x3932f6[_0xaa4d('0x68')];_0x2fc5eb[_0xaa4d('0x69')]=isNaN(_0x3932f6[_0xaa4d('0x6a')])?null:_0x3932f6[_0xaa4d('0x6a')];_0x2fc5eb[_0xaa4d('0x6b')]=isNaN(_0x3932f6[_0xaa4d('0x6c')])?null:_0x3932f6[_0xaa4d('0x6c')];});_0x7215e5['on'](_0xaa4d('0x6d'),function(_0x2f8ae0){_0x2fc5eb[_0xaa4d('0x6e')]=isNaN(_0x2f8ae0[_0xaa4d('0x64')])?null:_0x2f8ae0[_0xaa4d('0x64')]*0x3e8;_0x2fc5eb[_0xaa4d('0x6f')]=isNaN(_0x2f8ae0['sampleCount'])?null:_0x2f8ae0['sampleCount'];_0x2fc5eb[_0xaa4d('0x70')]=isNaN(_0x2f8ae0[_0xaa4d('0x68')])?null:_0x2f8ae0[_0xaa4d('0x68')];_0x2fc5eb[_0xaa4d('0x71')]=isNaN(_0x2f8ae0[_0xaa4d('0x6a')])?null:_0x2f8ae0[_0xaa4d('0x6a')];_0x2fc5eb[_0xaa4d('0x72')]=isNaN(_0x2f8ae0['sampleRate'])?null:_0x2f8ae0[_0xaa4d('0x6c')];});_0x7215e5['on'](_0xaa4d('0x27'),function(){fs[_0xaa4d('0x5f')](_0x1bcfe0,parseInt(_0xaa4d('0x60'),0x8));return db[_0xaa4d('0x2d')][_0xaa4d('0x53')](_0x2fc5eb)['then'](function(_0x2e88aa){var _0x112c38={'role':_0x577dcf[_0xaa4d('0x73')][_0xaa4d('0x74')],'userProfileId':_0x577dcf[_0xaa4d('0x73')][_0xaa4d('0x75')]};if(!_0x112c38)throw new Error(_0xaa4d('0x76'));if(_0x112c38[_0xaa4d('0x74')]===_0xaa4d('0x77')){var _0x50b742=_0x2e88aa[_0xaa4d('0x25')]({'plain':!![]});return db[_0xaa4d('0x78')][_0xaa4d('0x48')]({'where':{'name':_0xaa4d('0x79'),'userProfileId':_0x112c38[_0xaa4d('0x75')]},'raw':!![]})[_0xaa4d('0x23')](function(_0x38442b){if(_0x38442b&&_0x38442b[_0xaa4d('0x7a')]===0x0){return db[_0xaa4d('0x26')][_0xaa4d('0x53')]({'name':_0x50b742[_0xaa4d('0x29')],'resourceId':_0x50b742['id'],'type':_0x38442b[_0xaa4d('0x29')],'sectionId':_0x38442b['id']},{})[_0xaa4d('0x23')](function(){return _0x2e88aa;});}else{return _0x2e88aa;}})[_0xaa4d('0x45')](function(_0x36c113){logger[_0xaa4d('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x36c113);throw _0x36c113;});}return _0x2e88aa;})[_0xaa4d('0x23')](respondWithResult(_0x234e4a,null))[_0xaa4d('0x45')](handleError(_0x234e4a,null));});_0x7215e5[_0xaa4d('0x7b')]();}catch(_0x5ef2da){_0x234e4a['status'](0x1f4)[_0xaa4d('0x2a')](_0x5ef2da);}};exports[_0xaa4d('0x22')]=function(_0x4d3dcb,_0x2cc144,_0x502c16){return db[_0xaa4d('0x2d')][_0xaa4d('0x48')]({'where':{'id':_0x4d3dcb['params']['id']}})[_0xaa4d('0x23')](handleEntityNotFound(_0x2cc144,null))['then'](saveUpdates(_[_0xaa4d('0x3c')](_0x4d3dcb['body'],[_0xaa4d('0x29'),'description']),null))[_0xaa4d('0x23')](respondWithResult(_0x2cc144,null))[_0xaa4d('0x45')](handleError(_0x2cc144,null));};exports[_0xaa4d('0x7c')]=function(_0x54250a,_0x86878f,_0x244478){return db[_0xaa4d('0x2d')][_0xaa4d('0x48')]({'where':{'id':_0x54250a['params']['id']}})[_0xaa4d('0x23')](function(_0x282028){if(_0x282028){return _0x282028[_0xaa4d('0x24')]();}})[_0xaa4d('0x23')](function(_0x3f7b13){var _0x3d848a=path['join'](config[_0xaa4d('0x4d')],_0xaa4d('0x5a'),util[_0xaa4d('0x51')](_0xaa4d('0x52'),_0x3f7b13['save_name'],_0x3f7b13[_0xaa4d('0x7d')]));var _0x2199e0=path[_0xaa4d('0x5b')](config[_0xaa4d('0x4d')],'server/files/sounds/converted',util[_0xaa4d('0x51')]('%s.%s',_0x3f7b13[_0xaa4d('0x4a')],_0x3f7b13[_0xaa4d('0x4b')]));fs[_0xaa4d('0x7e')](_0x3d848a);fs[_0xaa4d('0x7e')](_0x2199e0);return _0x3f7b13;})[_0xaa4d('0x23')](function(_0x270d41){if(_0x270d41){return _0x86878f[_0xaa4d('0x1a')](0xcc)['end']();}})[_0xaa4d('0x23')](handleEntityNotFound(_0x86878f,null))[_0xaa4d('0x45')](handleError(_0x86878f,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 06d94f8..be982e5 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 _0xe6fb=['bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','define','Sound','tools_sounds','util','../../config/logger','api','moment'];(function(_0x14d896,_0x53578b){var _0x28679a=function(_0x14921f){while(--_0x14921f){_0x14d896['push'](_0x14d896['shift']());}};_0x28679a(++_0x53578b);}(_0xe6fb,0xdc));var _0xbe6f=function(_0x4de2c5,_0x21aeb7){_0x4de2c5=_0x4de2c5-0x0;var _0x4ef52b=_0xe6fb[_0x4de2c5];return _0x4ef52b;};'use strict';var _=require('lodash');var util=require(_0xbe6f('0x0'));var logger=require(_0xbe6f('0x1'))(_0xbe6f('0x2'));var moment=require(_0xbe6f('0x3'));var BPromise=require(_0xbe6f('0x4'));var rp=require(_0xbe6f('0x5'));var fs=require('fs');var path=require(_0xbe6f('0x6'));var rimraf=require(_0xbe6f('0x7'));var config=require(_0xbe6f('0x8'));var attributes=require(_0xbe6f('0x9'));module[_0xbe6f('0xa')]=function(_0x25fe5e,_0x1b67fc){return _0x25fe5e[_0xbe6f('0xb')](_0xbe6f('0xc'),attributes,{'tableName':_0xbe6f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf069=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','define','Sound','tools_sounds','lodash'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xf069,0x109));var _0x9f06=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf069[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9f06('0x0'));var util=require(_0x9f06('0x1'));var logger=require(_0x9f06('0x2'))(_0x9f06('0x3'));var moment=require(_0x9f06('0x4'));var BPromise=require('bluebird');var rp=require(_0x9f06('0x5'));var fs=require('fs');var path=require(_0x9f06('0x6'));var rimraf=require(_0x9f06('0x7'));var config=require(_0x9f06('0x8'));var attributes=require(_0x9f06('0x9'));module[_0x9f06('0xa')]=function(_0x51231d,_0x39318d){return _0x51231d[_0x9f06('0xb')](_0x9f06('0xc'),attributes,{'tableName':_0x9f06('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 2ebf50d..3c8e624 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 _0x9329=['../../config/logger','../../config/environment','jayson/promise','client','http','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSound','Sound','options','where','include','model','map','attributes','then','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x498889,_0x547993){var _0xd6cb2d=function(_0x50b51a){while(--_0x50b51a){_0x498889['push'](_0x498889['shift']());}};_0xd6cb2d(++_0x547993);}(_0x9329,0x111));var _0x9932=function(_0x435630,_0x271b45){_0x435630=_0x435630-0x0;var _0x486a0e=_0x9329[_0x435630];return _0x486a0e;};'use strict';var _=require(_0x9932('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9932('0x1'));var rs=require(_0x9932('0x2'));var fs=require('fs');var Redis=require(_0x9932('0x3'));var db=require(_0x9932('0x4'))['db'];var utils=require(_0x9932('0x5'));var logger=require(_0x9932('0x6'))('rpc');var config=require(_0x9932('0x7'));var jayson=require(_0x9932('0x8'));var client=jayson[_0x9932('0x9')][_0x9932('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d47b3,_0x50dd10,_0x27a1a4){return new BPromise(function(_0x33df65,_0x1ee1c5){return client['request'](_0x4d47b3,_0x27a1a4)['then'](function(_0x1b608a){logger[_0x9932('0xb')](_0x9932('0xc'),_0x50dd10,_0x9932('0xd'));logger[_0x9932('0xe')](_0x9932('0xf'),_0x50dd10,_0x9932('0xd'),JSON[_0x9932('0x10')](_0x1b608a));if(_0x1b608a[_0x9932('0x11')]){if(_0x1b608a[_0x9932('0x11')][_0x9932('0x12')]===0x1f4){logger['error'](_0x9932('0xc'),_0x50dd10,_0x1b608a['error'][_0x9932('0x13')]);return _0x1ee1c5(_0x1b608a['error'][_0x9932('0x13')]);}logger[_0x9932('0x11')](_0x9932('0xc'),_0x50dd10,_0x1b608a[_0x9932('0x11')][_0x9932('0x13')]);return _0x33df65(_0x1b608a[_0x9932('0x11')][_0x9932('0x13')]);}else{logger[_0x9932('0xb')]('Sound,\x20%s,\x20%s',_0x50dd10,_0x9932('0xd'));_0x33df65(_0x1b608a[_0x9932('0x14')][_0x9932('0x13')]);}})[_0x9932('0x15')](function(_0x130a6f){logger[_0x9932('0x11')](_0x9932('0xc'),_0x50dd10,_0x130a6f);_0x1ee1c5(_0x130a6f);});});}exports[_0x9932('0x16')]=function(_0x18cf69){var _0x1a9155=this;return new Promise(function(_0x1d95b3,_0x1ccc91){return db[_0x9932('0x17')]['find']({'raw':_0x18cf69[_0x9932('0x18')]?_0x18cf69[_0x9932('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x18cf69[_0x9932('0x18')]?_0x18cf69[_0x9932('0x18')][_0x9932('0x19')]||null:null,'attributes':_0x18cf69[_0x9932('0x18')]?_0x18cf69['options']['attributes']||null:null,'include':_0x18cf69['options']?_0x18cf69[_0x9932('0x18')]['include']?_['map'](_0x18cf69['options'][_0x9932('0x1a')],function(_0xe65124){return{'model':db[_0xe65124[_0x9932('0x1b')]],'as':_0xe65124['as'],'attributes':_0xe65124['attributes'],'include':_0xe65124['include']?_[_0x9932('0x1c')](_0xe65124[_0x9932('0x1a')],function(_0x1e119d){return{'model':db[_0x1e119d[_0x9932('0x1b')]],'as':_0x1e119d['as'],'attributes':_0x1e119d[_0x9932('0x1d')],'include':_0x1e119d['include']?_[_0x9932('0x1c')](_0x1e119d[_0x9932('0x1a')],function(_0x316bd1){return{'model':db[_0x316bd1['model']],'as':_0x316bd1['as'],'attributes':_0x316bd1[_0x9932('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x9932('0x1e')](function(_0x2ff4fc){logger[_0x9932('0xb')](_0x9932('0x16'),_0x18cf69);logger['debug'](_0x9932('0x16'),_0x18cf69,JSON[_0x9932('0x10')](_0x2ff4fc));_0x1d95b3(_0x2ff4fc);})['catch'](function(_0x81d12e){logger[_0x9932('0x11')](_0x9932('0x16'),_0x81d12e[_0x9932('0x13')],_0x18cf69);_0x1ccc91(_0x1a9155['error'](0x1f4,_0x81d12e[_0x9932('0x13')]));});});}; \ No newline at end of file +var _0xc56a=['../../config/utils','rpc','jayson/promise','client','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSound','Sound','find','options','raw','where','attributes','include','map','model','lodash','moment','randomstring','ioredis','../../mysqldb'];(function(_0x18ceb5,_0x500a4e){var _0x5cc27a=function(_0x6f9c37){while(--_0x6f9c37){_0x18ceb5['push'](_0x18ceb5['shift']());}};_0x5cc27a(++_0x500a4e);}(_0xc56a,0x13b));var _0xac56=function(_0x2ef5d7,_0x393ca8){_0x2ef5d7=_0x2ef5d7-0x0;var _0x48f8f8=_0xc56a[_0x2ef5d7];return _0x48f8f8;};'use strict';var _=require(_0xac56('0x0'));var util=require('util');var moment=require(_0xac56('0x1'));var BPromise=require('bluebird');var rs=require(_0xac56('0x2'));var fs=require('fs');var Redis=require(_0xac56('0x3'));var db=require(_0xac56('0x4'))['db'];var utils=require(_0xac56('0x5'));var logger=require('../../config/logger')(_0xac56('0x6'));var config=require('../../config/environment');var jayson=require(_0xac56('0x7'));var client=jayson[_0xac56('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41a421,_0x4ec638,_0x3b0a43){return new BPromise(function(_0x273431,_0xdb188e){return client[_0xac56('0x9')](_0x41a421,_0x3b0a43)[_0xac56('0xa')](function(_0x1a995c){logger[_0xac56('0xb')](_0xac56('0xc'),_0x4ec638,_0xac56('0xd'));logger[_0xac56('0xe')](_0xac56('0xf'),_0x4ec638,_0xac56('0xd'),JSON[_0xac56('0x10')](_0x1a995c));if(_0x1a995c[_0xac56('0x11')]){if(_0x1a995c['error'][_0xac56('0x12')]===0x1f4){logger[_0xac56('0x11')]('Sound,\x20%s,\x20%s',_0x4ec638,_0x1a995c[_0xac56('0x11')][_0xac56('0x13')]);return _0xdb188e(_0x1a995c[_0xac56('0x11')]['message']);}logger['error']('Sound,\x20%s,\x20%s',_0x4ec638,_0x1a995c[_0xac56('0x11')][_0xac56('0x13')]);return _0x273431(_0x1a995c[_0xac56('0x11')][_0xac56('0x13')]);}else{logger[_0xac56('0xb')]('Sound,\x20%s,\x20%s',_0x4ec638,_0xac56('0xd'));_0x273431(_0x1a995c[_0xac56('0x14')]['message']);}})[_0xac56('0x15')](function(_0x5c0601){logger[_0xac56('0x11')](_0xac56('0xc'),_0x4ec638,_0x5c0601);_0xdb188e(_0x5c0601);});});}exports[_0xac56('0x16')]=function(_0x43adaf){var _0x1b185a=this;return new Promise(function(_0x4c4471,_0x64954a){return db[_0xac56('0x17')][_0xac56('0x18')]({'raw':_0x43adaf[_0xac56('0x19')]?_0x43adaf['options'][_0xac56('0x1a')]===undefined?!![]:![]:!![],'where':_0x43adaf[_0xac56('0x19')]?_0x43adaf['options'][_0xac56('0x1b')]||null:null,'attributes':_0x43adaf[_0xac56('0x19')]?_0x43adaf['options'][_0xac56('0x1c')]||null:null,'include':_0x43adaf[_0xac56('0x19')]?_0x43adaf[_0xac56('0x19')][_0xac56('0x1d')]?_[_0xac56('0x1e')](_0x43adaf[_0xac56('0x19')][_0xac56('0x1d')],function(_0x4ee81d){return{'model':db[_0x4ee81d[_0xac56('0x1f')]],'as':_0x4ee81d['as'],'attributes':_0x4ee81d[_0xac56('0x1c')],'include':_0x4ee81d[_0xac56('0x1d')]?_[_0xac56('0x1e')](_0x4ee81d['include'],function(_0x360904){return{'model':db[_0x360904['model']],'as':_0x360904['as'],'attributes':_0x360904[_0xac56('0x1c')],'include':_0x360904['include']?_[_0xac56('0x1e')](_0x360904[_0xac56('0x1d')],function(_0x19d398){return{'model':db[_0x19d398[_0xac56('0x1f')]],'as':_0x19d398['as'],'attributes':_0x19d398[_0xac56('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xac56('0xa')](function(_0x2483ac){logger[_0xac56('0xb')]('ShowSound',_0x43adaf);logger['debug']('ShowSound',_0x43adaf,JSON['stringify'](_0x2483ac));_0x4c4471(_0x2483ac);})[_0xac56('0x15')](function(_0x51ebc6){logger[_0xac56('0x11')]('ShowSound',_0x51ebc6[_0xac56('0x13')],_0x43adaf);_0x64954a(_0x1b185a['error'](0x1f4,_0x51ebc6[_0xac56('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index ff4dcd9..cc47695 100644 --- a/server/api/squareMessage/index.js +++ b/server/api/squareMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['./squareMessage.controller','get','isAuthenticated','index','show','post','create','/:id','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3a5df2,_0x2b5517){var _0x3a65b6=function(_0x4e14db){while(--_0x4e14db){_0x3a5df2['push'](_0x3a5df2['shift']());}};_0x3a65b6(++_0x2b5517);}(_0x0b0e,0x187));var _0xe0b0=function(_0x39e283,_0x247e6b){_0x39e283=_0x39e283-0x0;var _0x7de89f=_0x0b0e[_0x39e283];return _0x7de89f;};'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 _0xd8b0=['update','delete','destroy','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','create','put','/:id'];(function(_0x3cec21,_0x1765b2){var _0x409767=function(_0x2db505){while(--_0x2db505){_0x3cec21['push'](_0x3cec21['shift']());}};_0x409767(++_0x1765b2);}(_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('./squareMessage.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['post']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xb')]);router[_0x0d8b('0xc')](_0x0d8b('0xd'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xd'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 45897ae..8419402 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 _0x1148=['medium','ENUM','out','sequelize','exports','STRING','TEXT'];(function(_0x12c54f,_0x1fac47){var _0x313f50=function(_0x19aa67){while(--_0x19aa67){_0x12c54f['push'](_0x12c54f['shift']());}};_0x313f50(++_0x1fac47);}(_0x1148,0x1ae));var _0x8114=function(_0x290748,_0x26ba2d){_0x290748=_0x290748-0x0;var _0x2df13a=_0x1148[_0x290748];return _0x2df13a;};'use strict';var Sequelize=require(_0x8114('0x0'));module[_0x8114('0x1')]={'uniqueid':{'type':Sequelize[_0x8114('0x2')]},'body':{'type':Sequelize[_0x8114('0x3')](_0x8114('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0x8114('0x5')]('in',_0x8114('0x6')),'defaultValue':_0x8114('0x6'),'allowNull':![]},'providerName':{'type':Sequelize[_0x8114('0x2')]},'providerResponse':{'type':Sequelize[_0x8114('0x3')]}}; \ No newline at end of file +var _0x0686=['exports','STRING','TEXT','medium','ENUM','out'];(function(_0x56a636,_0x3e2c53){var _0x6acd29=function(_0x4b6dfa){while(--_0x4b6dfa){_0x56a636['push'](_0x56a636['shift']());}};_0x6acd29(++_0x3e2c53);}(_0x0686,0x19e));var _0x6068=function(_0x4a5ada,_0x3e243d){_0x4a5ada=_0x4a5ada-0x0;var _0x10ad20=_0x0686[_0x4a5ada];return _0x10ad20;};'use strict';var Sequelize=require('sequelize');module[_0x6068('0x0')]={'uniqueid':{'type':Sequelize[_0x6068('0x1')]},'body':{'type':Sequelize[_0x6068('0x2')](_0x6068('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x6068('0x4')]('in',_0x6068('0x5')),'defaultValue':_0x6068('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x6068('0x1')]},'providerResponse':{'type':Sequelize[_0x6068('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index eb4820e..46f8c0b 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 _0x9666=['zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','undefined','limit','count','offset','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','SquareMessage','includeAll','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf'];(function(_0x3ae2b2,_0x2d936f){var _0x1dbf00=function(_0x4072e9){while(--_0x4072e9){_0x3ae2b2['push'](_0x3ae2b2['shift']());}};_0x1dbf00(++_0x2d936f);}(_0x9666,0x17a));var _0x6966=function(_0x124474,_0x3a3892){_0x124474=_0x124474-0x0;var _0x34cb84=_0x9666[_0x124474];return _0x34cb84;};'use strict';var emlformat=require(_0x6966('0x0'));var rimraf=require(_0x6966('0x1'));var zipdir=require(_0x6966('0x2'));var jsonpatch=require(_0x6966('0x3'));var rp=require('request-promise');var moment=require(_0x6966('0x4'));var BPromise=require(_0x6966('0x5'));var Mustache=require(_0x6966('0x6'));var util=require('util');var path=require('path');var sox=require(_0x6966('0x7'));var csv=require(_0x6966('0x8'));var ejs=require(_0x6966('0x9'));var fs=require('fs');var fs_extra=require(_0x6966('0xa'));var _=require(_0x6966('0xb'));var squel=require(_0x6966('0xc'));var crypto=require('crypto');var jsforce=require(_0x6966('0xd'));var deskjs=require(_0x6966('0xe'));var toCsv=require(_0x6966('0x8'));var querystring=require('querystring');var Papa=require(_0x6966('0xf'));var Redis=require(_0x6966('0x10'));var authService=require(_0x6966('0x11'));var qs=require(_0x6966('0x12'));var as=require(_0x6966('0x13'));var hardwareService=require(_0x6966('0x14'));var logger=require(_0x6966('0x15'))(_0x6966('0x16'));var utils=require(_0x6966('0x17'));var config=require(_0x6966('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c5272,_0x154c15){_0x154c15=_0x154c15||0xcc;return function(_0x2ce913){if(_0x2ce913){return _0x4c5272[_0x6966('0x19')](_0x154c15);}return _0x4c5272['status'](_0x154c15)['end']();};}function respondWithResult(_0x584bf2,_0x235ba3){_0x235ba3=_0x235ba3||0xc8;return function(_0xbd4ea2){if(_0xbd4ea2){return _0x584bf2[_0x6966('0x1a')](_0x235ba3)[_0x6966('0x1b')](_0xbd4ea2);}};}function respondWithFilteredResult(_0x19428c,_0x48d414){return function(_0x204200){if(_0x204200){var _0x1bf59d=typeof _0x48d414['offset']===_0x6966('0x1c')&&typeof _0x48d414[_0x6966('0x1d')]===_0x6966('0x1c');var _0x529dbd=_0x204200[_0x6966('0x1e')];var _0x4bf5b8=_0x1bf59d?0x0:_0x48d414[_0x6966('0x1f')];var _0x519049=_0x1bf59d?_0x204200['count']:_0x48d414['offset']+_0x48d414[_0x6966('0x1d')];var _0x5eef44;if(_0x519049>=_0x529dbd){_0x519049=_0x529dbd;_0x5eef44=0xc8;}else{_0x5eef44=0xce;}_0x19428c['status'](_0x5eef44);return _0x19428c['set']('Content-Range',_0x4bf5b8+'-'+_0x519049+'/'+_0x529dbd)['json'](_0x204200);}return null;};}function patchUpdates(_0x197c2c){return function(_0x247570){try{jsonpatch[_0x6966('0x20')](_0x247570,_0x197c2c,!![]);}catch(_0x4e8342){return BPromise[_0x6966('0x21')](_0x4e8342);}return _0x247570[_0x6966('0x22')]();};}function saveUpdates(_0x43349b,_0x8c7833){return function(_0x33fc7f){if(_0x33fc7f){return _0x33fc7f[_0x6966('0x23')](_0x43349b)[_0x6966('0x24')](function(_0x2af0b7){return _0x2af0b7;});}return null;};}function removeEntity(_0x3772d7,_0x509631){return function(_0x24af6a){if(_0x24af6a){return _0x24af6a[_0x6966('0x25')]()[_0x6966('0x24')](function(){_0x3772d7[_0x6966('0x1a')](0xcc)[_0x6966('0x26')]();});}};}function handleEntityNotFound(_0x27db0e,_0x44a5df){return function(_0x4e4c30){if(!_0x4e4c30){_0x27db0e[_0x6966('0x19')](0x194);}return _0x4e4c30;};}function handleError(_0x5a7f85,_0x433601){_0x433601=_0x433601||0x1f4;return function(_0x4f7aa2){logger[_0x6966('0x27')](_0x4f7aa2[_0x6966('0x28')]);if(_0x4f7aa2[_0x6966('0x29')]){delete _0x4f7aa2[_0x6966('0x29')];}_0x5a7f85[_0x6966('0x1a')](_0x433601)[_0x6966('0x2a')](_0x4f7aa2);};}exports[_0x6966('0x2b')]=function(_0x1b86a7,_0x2c9fbb){var _0x4a85c7={},_0x270919={},_0x35fdb4={'count':0x0,'rows':[]};var _0x59a8d6=_[_0x6966('0x2c')](db['SquareMessage'][_0x6966('0x2d')],function(_0x297c21){return{'name':_0x297c21[_0x6966('0x2e')],'type':_0x297c21[_0x6966('0x2f')][_0x6966('0x30')]};});_0x270919[_0x6966('0x31')]=_[_0x6966('0x2c')](_0x59a8d6,_0x6966('0x29'));_0x270919[_0x6966('0x32')]=_[_0x6966('0x33')](_0x1b86a7[_0x6966('0x32')]);_0x270919[_0x6966('0x34')]=_[_0x6966('0x35')](_0x270919[_0x6966('0x31')],_0x270919[_0x6966('0x32')]);_0x4a85c7[_0x6966('0x36')]=_['intersection'](_0x270919[_0x6966('0x31')],qs['fields'](_0x1b86a7[_0x6966('0x32')][_0x6966('0x37')]));_0x4a85c7[_0x6966('0x36')]=_0x4a85c7[_0x6966('0x36')][_0x6966('0x38')]?_0x4a85c7[_0x6966('0x36')]:_0x270919[_0x6966('0x31')];if(!_0x1b86a7[_0x6966('0x32')][_0x6966('0x39')](_0x6966('0x3a'))){_0x4a85c7['limit']=qs[_0x6966('0x1d')](_0x1b86a7[_0x6966('0x32')][_0x6966('0x1d')]);_0x4a85c7['offset']=qs['offset'](_0x1b86a7[_0x6966('0x32')][_0x6966('0x1f')]);}_0x4a85c7['order']=qs[_0x6966('0x3b')](_0x1b86a7['query']['sort']);_0x4a85c7[_0x6966('0x3c')]=qs[_0x6966('0x34')](_[_0x6966('0x3d')](_0x1b86a7[_0x6966('0x32')],_0x270919['filters']),_0x59a8d6);if(_0x1b86a7[_0x6966('0x32')][_0x6966('0x3e')]){_0x4a85c7[_0x6966('0x3c')]=_[_0x6966('0x3f')](_0x4a85c7[_0x6966('0x3c')],{'$or':_[_0x6966('0x2c')](_0x59a8d6,function(_0x3cb629){if(_0x3cb629[_0x6966('0x2f')]!==_0x6966('0x40')){var _0x112bff={};_0x112bff[_0x3cb629[_0x6966('0x29')]]={'$like':'%'+_0x1b86a7[_0x6966('0x32')][_0x6966('0x3e')]+'%'};return _0x112bff;}})});}_0x4a85c7=_['merge']({},_0x4a85c7,_0x1b86a7[_0x6966('0x41')]);var _0x5c9590={'where':_0x4a85c7['where']};return db[_0x6966('0x42')][_0x6966('0x1e')](_0x5c9590)['then'](function(_0x57949e){_0x35fdb4[_0x6966('0x1e')]=_0x57949e;if(_0x1b86a7[_0x6966('0x32')][_0x6966('0x43')]){_0x4a85c7['include']=[{'all':!![]}];}return db[_0x6966('0x42')][_0x6966('0x44')](_0x4a85c7);})[_0x6966('0x24')](function(_0x6af6a8){_0x35fdb4[_0x6966('0x45')]=_0x6af6a8;return _0x35fdb4;})[_0x6966('0x24')](respondWithFilteredResult(_0x2c9fbb,_0x4a85c7))[_0x6966('0x46')](handleError(_0x2c9fbb,null));};exports[_0x6966('0x47')]=function(_0x1df2cb,_0x5356fc){var _0x49be81={'raw':!![],'where':{'id':_0x1df2cb[_0x6966('0x48')]['id']}},_0x50ec04={};_0x50ec04['model']=_[_0x6966('0x33')](db[_0x6966('0x42')]['rawAttributes']);_0x50ec04[_0x6966('0x32')]=_['keys'](_0x1df2cb[_0x6966('0x32')]);_0x50ec04[_0x6966('0x34')]=_[_0x6966('0x35')](_0x50ec04[_0x6966('0x31')],_0x50ec04[_0x6966('0x32')]);_0x49be81[_0x6966('0x36')]=_[_0x6966('0x35')](_0x50ec04[_0x6966('0x31')],qs[_0x6966('0x37')](_0x1df2cb[_0x6966('0x32')][_0x6966('0x37')]));_0x49be81['attributes']=_0x49be81[_0x6966('0x36')][_0x6966('0x38')]?_0x49be81[_0x6966('0x36')]:_0x50ec04['model'];if(_0x1df2cb[_0x6966('0x32')][_0x6966('0x43')]){_0x49be81['include']=[{'all':!![]}];}_0x49be81=_[_0x6966('0x3f')]({},_0x49be81,_0x1df2cb[_0x6966('0x41')]);return db[_0x6966('0x42')][_0x6966('0x49')](_0x49be81)[_0x6966('0x24')](handleEntityNotFound(_0x5356fc,null))[_0x6966('0x24')](respondWithResult(_0x5356fc,null))[_0x6966('0x46')](handleError(_0x5356fc,null));};exports[_0x6966('0x4a')]=function(_0x3635b8,_0x154d3e){return db['SquareMessage'][_0x6966('0x4a')](_0x3635b8['body'],{})[_0x6966('0x24')](respondWithResult(_0x154d3e,0xc9))[_0x6966('0x46')](handleError(_0x154d3e,null));};exports['update']=function(_0x301555,_0x4955b8){if(_0x301555[_0x6966('0x4b')]['id']){delete _0x301555[_0x6966('0x4b')]['id'];}return db[_0x6966('0x42')]['find']({'where':{'id':_0x301555[_0x6966('0x48')]['id']}})['then'](handleEntityNotFound(_0x4955b8,null))[_0x6966('0x24')](saveUpdates(_0x301555[_0x6966('0x4b')],null))[_0x6966('0x24')](respondWithResult(_0x4955b8,null))['catch'](handleError(_0x4955b8,null));};exports['destroy']=function(_0x3422fe,_0x40175c){return db[_0x6966('0x42')][_0x6966('0x49')]({'where':{'id':_0x3422fe[_0x6966('0x48')]['id']}})['then'](handleEntityNotFound(_0x40175c,null))[_0x6966('0x24')](removeEntity(_0x40175c,null))[_0x6966('0x46')](handleError(_0x40175c,null));}; \ No newline at end of file +var _0x5085=['model','fields','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','length','create','body','find','params','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','crypto','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','sendStatus','error','name','send','index','map','SquareMessage','rawAttributes','type','key','query','keys','filters','intersection','attributes'];(function(_0x8ec947,_0x444fa2){var _0x115d2b=function(_0x4cbd1a){while(--_0x4cbd1a){_0x8ec947['push'](_0x8ec947['shift']());}};_0x115d2b(++_0x444fa2);}(_0x5085,0xe3));var _0x5508=function(_0x994416,_0x288d86){_0x994416=_0x994416-0x0;var _0x3c4115=_0x5085[_0x994416];return _0x3c4115;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5508('0x0'));var zipdir=require(_0x5508('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5508('0x2'));var moment=require(_0x5508('0x3'));var BPromise=require(_0x5508('0x4'));var Mustache=require(_0x5508('0x5'));var util=require(_0x5508('0x6'));var path=require('path');var sox=require(_0x5508('0x7'));var csv=require('to-csv');var ejs=require(_0x5508('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5508('0x9'));var squel=require('squel');var crypto=require(_0x5508('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x5508('0xb'));var toCsv=require(_0x5508('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5508('0xd'));var authService=require(_0x5508('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x5508('0xf'));var hardwareService=require(_0x5508('0x10'));var logger=require(_0x5508('0x11'))(_0x5508('0x12'));var utils=require('../../config/utils');var config=require(_0x5508('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x124c55,_0x155521){_0x155521=_0x155521||0xcc;return function(_0x42f16d){if(_0x42f16d){return _0x124c55['sendStatus'](_0x155521);}return _0x124c55['status'](_0x155521)['end']();};}function respondWithResult(_0x3e4d0d,_0x4410ac){_0x4410ac=_0x4410ac||0xc8;return function(_0x1a92ac){if(_0x1a92ac){return _0x3e4d0d[_0x5508('0x14')](_0x4410ac)[_0x5508('0x15')](_0x1a92ac);}};}function respondWithFilteredResult(_0x28c7b5,_0x43b5b3){return function(_0x4ef95a){if(_0x4ef95a){var _0x428291=typeof _0x43b5b3[_0x5508('0x16')]===_0x5508('0x17')&&typeof _0x43b5b3[_0x5508('0x18')]===_0x5508('0x17');var _0x734f29=_0x4ef95a['count'];var _0xd80f9b=_0x428291?0x0:_0x43b5b3[_0x5508('0x16')];var _0x2558a7=_0x428291?_0x4ef95a[_0x5508('0x19')]:_0x43b5b3[_0x5508('0x16')]+_0x43b5b3[_0x5508('0x18')];var _0x181228;if(_0x2558a7>=_0x734f29){_0x2558a7=_0x734f29;_0x181228=0xc8;}else{_0x181228=0xce;}_0x28c7b5[_0x5508('0x14')](_0x181228);return _0x28c7b5[_0x5508('0x1a')](_0x5508('0x1b'),_0xd80f9b+'-'+_0x2558a7+'/'+_0x734f29)[_0x5508('0x15')](_0x4ef95a);}return null;};}function patchUpdates(_0x18333b){return function(_0x5dc78d){try{jsonpatch[_0x5508('0x1c')](_0x5dc78d,_0x18333b,!![]);}catch(_0x25d22e){return BPromise[_0x5508('0x1d')](_0x25d22e);}return _0x5dc78d['save']();};}function saveUpdates(_0x2f7811,_0x3f693f){return function(_0xe77339){if(_0xe77339){return _0xe77339[_0x5508('0x1e')](_0x2f7811)[_0x5508('0x1f')](function(_0x164ca2){return _0x164ca2;});}return null;};}function removeEntity(_0x4f1eb4,_0x54724b){return function(_0x220874){if(_0x220874){return _0x220874[_0x5508('0x20')]()[_0x5508('0x1f')](function(){_0x4f1eb4[_0x5508('0x14')](0xcc)[_0x5508('0x21')]();});}};}function handleEntityNotFound(_0x7696af,_0x265a47){return function(_0x437c69){if(!_0x437c69){_0x7696af[_0x5508('0x22')](0x194);}return _0x437c69;};}function handleError(_0x9d13ad,_0x1f553e){_0x1f553e=_0x1f553e||0x1f4;return function(_0x45f9a1){logger[_0x5508('0x23')](_0x45f9a1['stack']);if(_0x45f9a1[_0x5508('0x24')]){delete _0x45f9a1['name'];}_0x9d13ad[_0x5508('0x14')](_0x1f553e)[_0x5508('0x25')](_0x45f9a1);};}exports[_0x5508('0x26')]=function(_0xa0d1a6,_0x5019e6){var _0x10cccd={},_0x289e3c={},_0x47e878={'count':0x0,'rows':[]};var _0x2bef93=_[_0x5508('0x27')](db[_0x5508('0x28')][_0x5508('0x29')],function(_0x25fd9f){return{'name':_0x25fd9f['fieldName'],'type':_0x25fd9f[_0x5508('0x2a')][_0x5508('0x2b')]};});_0x289e3c['model']=_[_0x5508('0x27')](_0x2bef93,_0x5508('0x24'));_0x289e3c[_0x5508('0x2c')]=_[_0x5508('0x2d')](_0xa0d1a6[_0x5508('0x2c')]);_0x289e3c[_0x5508('0x2e')]=_[_0x5508('0x2f')](_0x289e3c['model'],_0x289e3c[_0x5508('0x2c')]);_0x10cccd[_0x5508('0x30')]=_[_0x5508('0x2f')](_0x289e3c[_0x5508('0x31')],qs[_0x5508('0x32')](_0xa0d1a6[_0x5508('0x2c')]['fields']));_0x10cccd['attributes']=_0x10cccd[_0x5508('0x30')]['length']?_0x10cccd[_0x5508('0x30')]:_0x289e3c[_0x5508('0x31')];if(!_0xa0d1a6['query'][_0x5508('0x33')]('nolimit')){_0x10cccd[_0x5508('0x18')]=qs[_0x5508('0x18')](_0xa0d1a6[_0x5508('0x2c')][_0x5508('0x18')]);_0x10cccd[_0x5508('0x16')]=qs['offset'](_0xa0d1a6['query']['offset']);}_0x10cccd[_0x5508('0x34')]=qs[_0x5508('0x35')](_0xa0d1a6[_0x5508('0x2c')]['sort']);_0x10cccd[_0x5508('0x36')]=qs[_0x5508('0x2e')](_[_0x5508('0x37')](_0xa0d1a6[_0x5508('0x2c')],_0x289e3c['filters']),_0x2bef93);if(_0xa0d1a6['query'][_0x5508('0x38')]){_0x10cccd['where']=_['merge'](_0x10cccd[_0x5508('0x36')],{'$or':_['map'](_0x2bef93,function(_0x29dabc){if(_0x29dabc[_0x5508('0x2a')]!==_0x5508('0x39')){var _0x59d0aa={};_0x59d0aa[_0x29dabc[_0x5508('0x24')]]={'$like':'%'+_0xa0d1a6['query']['filter']+'%'};return _0x59d0aa;}})});}_0x10cccd=_[_0x5508('0x3a')]({},_0x10cccd,_0xa0d1a6[_0x5508('0x3b')]);var _0x125634={'where':_0x10cccd[_0x5508('0x36')]};return db[_0x5508('0x28')][_0x5508('0x19')](_0x125634)['then'](function(_0x517d47){_0x47e878[_0x5508('0x19')]=_0x517d47;if(_0xa0d1a6['query'][_0x5508('0x3c')]){_0x10cccd[_0x5508('0x3d')]=[{'all':!![]}];}return db[_0x5508('0x28')][_0x5508('0x3e')](_0x10cccd);})[_0x5508('0x1f')](function(_0x4beaa5){_0x47e878['rows']=_0x4beaa5;return _0x47e878;})[_0x5508('0x1f')](respondWithFilteredResult(_0x5019e6,_0x10cccd))[_0x5508('0x3f')](handleError(_0x5019e6,null));};exports['show']=function(_0xd26991,_0x15160f){var _0x3e233b={'raw':!![],'where':{'id':_0xd26991['params']['id']}},_0x4ecd92={};_0x4ecd92[_0x5508('0x31')]=_[_0x5508('0x2d')](db[_0x5508('0x28')][_0x5508('0x29')]);_0x4ecd92[_0x5508('0x2c')]=_[_0x5508('0x2d')](_0xd26991['query']);_0x4ecd92['filters']=_['intersection'](_0x4ecd92[_0x5508('0x31')],_0x4ecd92[_0x5508('0x2c')]);_0x3e233b[_0x5508('0x30')]=_[_0x5508('0x2f')](_0x4ecd92[_0x5508('0x31')],qs[_0x5508('0x32')](_0xd26991[_0x5508('0x2c')][_0x5508('0x32')]));_0x3e233b['attributes']=_0x3e233b[_0x5508('0x30')][_0x5508('0x40')]?_0x3e233b['attributes']:_0x4ecd92['model'];if(_0xd26991[_0x5508('0x2c')]['includeAll']){_0x3e233b[_0x5508('0x3d')]=[{'all':!![]}];}_0x3e233b=_['merge']({},_0x3e233b,_0xd26991['options']);return db[_0x5508('0x28')]['find'](_0x3e233b)[_0x5508('0x1f')](handleEntityNotFound(_0x15160f,null))[_0x5508('0x1f')](respondWithResult(_0x15160f,null))['catch'](handleError(_0x15160f,null));};exports[_0x5508('0x41')]=function(_0x111a96,_0x5064cc){return db[_0x5508('0x28')][_0x5508('0x41')](_0x111a96[_0x5508('0x42')],{})['then'](respondWithResult(_0x5064cc,0xc9))[_0x5508('0x3f')](handleError(_0x5064cc,null));};exports[_0x5508('0x1e')]=function(_0x45b1b1,_0x2aac3f){if(_0x45b1b1[_0x5508('0x42')]['id']){delete _0x45b1b1[_0x5508('0x42')]['id'];}return db[_0x5508('0x28')][_0x5508('0x43')]({'where':{'id':_0x45b1b1[_0x5508('0x44')]['id']}})[_0x5508('0x1f')](handleEntityNotFound(_0x2aac3f,null))[_0x5508('0x1f')](saveUpdates(_0x45b1b1[_0x5508('0x42')],null))['then'](respondWithResult(_0x2aac3f,null))[_0x5508('0x3f')](handleError(_0x2aac3f,null));};exports[_0x5508('0x20')]=function(_0x242219,_0x4fab07){return db[_0x5508('0x28')][_0x5508('0x43')]({'where':{'id':_0x242219[_0x5508('0x44')]['id']}})[_0x5508('0x1f')](handleEntityNotFound(_0x4fab07,null))[_0x5508('0x1f')](removeEntity(_0x4fab07,null))[_0x5508('0x3f')](handleError(_0x4fab07,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index de0f818..d0b10a9 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 _0xc524=['../../config/environment','./squareMessage.attributes','exports','define','square_messages','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x57ab79,_0x4ecf82){var _0x3498a9=function(_0xb099c7){while(--_0xb099c7){_0x57ab79['push'](_0x57ab79['shift']());}};_0x3498a9(++_0x4ecf82);}(_0xc524,0x73));var _0x4c52=function(_0x596c42,_0x4478c5){_0x596c42=_0x596c42-0x0;var _0x460752=_0xc524[_0x596c42];return _0x460752;};'use strict';var _=require(_0x4c52('0x0'));var util=require('util');var logger=require(_0x4c52('0x1'))(_0x4c52('0x2'));var moment=require(_0x4c52('0x3'));var BPromise=require(_0x4c52('0x4'));var rp=require(_0x4c52('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4c52('0x6'));var attributes=require(_0x4c52('0x7'));module[_0x4c52('0x8')]=function(_0x9d4232,_0x60f1ab){return _0x9d4232[_0x4c52('0x9')]('SquareMessage',attributes,{'tableName':_0x4c52('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x348a=['rimraf','../../config/environment','./squareMessage.attributes','exports','define','square_messages','lodash','../../config/logger','bluebird','request-promise','path'];(function(_0x2ecf53,_0x5391d2){var _0x4fe4f0=function(_0x1735c8){while(--_0x1735c8){_0x2ecf53['push'](_0x2ecf53['shift']());}};_0x4fe4f0(++_0x5391d2);}(_0x348a,0x8a));var _0xa348=function(_0xa7b401,_0x3f9109){_0xa7b401=_0xa7b401-0x0;var _0x5326ef=_0x348a[_0xa7b401];return _0x5326ef;};'use strict';var _=require(_0xa348('0x0'));var util=require('util');var logger=require(_0xa348('0x1'))('api');var moment=require('moment');var BPromise=require(_0xa348('0x2'));var rp=require(_0xa348('0x3'));var fs=require('fs');var path=require(_0xa348('0x4'));var rimraf=require(_0xa348('0x5'));var config=require(_0xa348('0x6'));var attributes=require(_0xa348('0x7'));module[_0xa348('0x8')]=function(_0x5519f6,_0x31ee1a){return _0x5519f6[_0xa348('0x9')]('SquareMessage',attributes,{'tableName':_0xa348('0xa'),'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 e0c40e8..0b8d001 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 _0xd835=['moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','util'];(function(_0x12af72,_0x16c27e){var _0x393472=function(_0x2009c3){while(--_0x2009c3){_0x12af72['push'](_0x12af72['shift']());}};_0x393472(++_0x16c27e);}(_0xd835,0x1ed));var _0x5d83=function(_0x31bab3,_0x44554f){_0x31bab3=_0x31bab3-0x0;var _0x4fd382=_0xd835[_0x31bab3];return _0x4fd382;};'use strict';var _=require('lodash');var util=require(_0x5d83('0x0'));var moment=require(_0x5d83('0x1'));var BPromise=require('bluebird');var rs=require(_0x5d83('0x2'));var fs=require('fs');var Redis=require(_0x5d83('0x3'));var db=require(_0x5d83('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5d83('0x5'))(_0x5d83('0x6'));var config=require('../../config/environment');var jayson=require(_0x5d83('0x7'));var client=jayson[_0x5d83('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x49603e,_0x3ea6bb,_0x211882){return new BPromise(function(_0x51370b,_0x39c1eb){return client[_0x5d83('0x9')](_0x49603e,_0x211882)['then'](function(_0x2c98b3){logger[_0x5d83('0xa')](_0x5d83('0xb'),_0x3ea6bb,_0x5d83('0xc'));logger[_0x5d83('0xd')](_0x5d83('0xe'),_0x3ea6bb,_0x5d83('0xc'),JSON[_0x5d83('0xf')](_0x2c98b3));if(_0x2c98b3['error']){if(_0x2c98b3[_0x5d83('0x10')]['code']===0x1f4){logger[_0x5d83('0x10')](_0x5d83('0xb'),_0x3ea6bb,_0x2c98b3['error']['message']);return _0x39c1eb(_0x2c98b3[_0x5d83('0x10')][_0x5d83('0x11')]);}logger[_0x5d83('0x10')](_0x5d83('0xb'),_0x3ea6bb,_0x2c98b3[_0x5d83('0x10')][_0x5d83('0x11')]);return _0x51370b(_0x2c98b3[_0x5d83('0x10')]['message']);}else{logger[_0x5d83('0xa')]('SquareMessage,\x20%s,\x20%s',_0x3ea6bb,'request\x20sent');_0x51370b(_0x2c98b3[_0x5d83('0x12')]['message']);}})[_0x5d83('0x13')](function(_0x4fc2d7){logger[_0x5d83('0x10')](_0x5d83('0xb'),_0x3ea6bb,_0x4fc2d7);_0x39c1eb(_0x4fc2d7);});});}exports[_0x5d83('0x14')]=function(_0x20ca75){var _0x2e2477=this;return new Promise(function(_0x58fabd,_0x127074){return db[_0x5d83('0x15')][_0x5d83('0x16')](_0x20ca75[_0x5d83('0x17')],{'raw':_0x20ca75[_0x5d83('0x18')]?_0x20ca75[_0x5d83('0x18')][_0x5d83('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x3aa486){logger[_0x5d83('0xa')](_0x5d83('0x14'),_0x20ca75);logger[_0x5d83('0xd')]('CreateSquareMessage',_0x20ca75,JSON['stringify'](_0x3aa486));_0x58fabd(_0x3aa486);})[_0x5d83('0x13')](function(_0x229dc9){logger[_0x5d83('0x10')](_0x5d83('0x14'),_0x229dc9[_0x5d83('0x11')],_0x20ca75);_0x127074(_0x2e2477[_0x5d83('0x10')](0x1f4,_0x229dc9[_0x5d83('0x11')]));});});}; \ No newline at end of file +var _0xb234=['jayson/promise','client','http','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc'];(function(_0x14b2e6,_0x5e328b){var _0x2c3eaa=function(_0xed1ae5){while(--_0xed1ae5){_0x14b2e6['push'](_0x14b2e6['shift']());}};_0x2c3eaa(++_0x5e328b);}(_0xb234,0x181));var _0x4b23=function(_0x396783,_0x18d225){_0x396783=_0x396783-0x0;var _0x375b92=_0xb234[_0x396783];return _0x375b92;};'use strict';var _=require(_0x4b23('0x0'));var util=require(_0x4b23('0x1'));var moment=require('moment');var BPromise=require(_0x4b23('0x2'));var rs=require(_0x4b23('0x3'));var fs=require('fs');var Redis=require(_0x4b23('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4b23('0x5'));var logger=require('../../config/logger')(_0x4b23('0x6'));var config=require('../../config/environment');var jayson=require(_0x4b23('0x7'));var client=jayson[_0x4b23('0x8')][_0x4b23('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1033af,_0x3aad2a,_0x4fbd20){return new BPromise(function(_0x3db62e,_0x5c8827){return client['request'](_0x1033af,_0x4fbd20)[_0x4b23('0xa')](function(_0x4df132){logger[_0x4b23('0xb')](_0x4b23('0xc'),_0x3aad2a,_0x4b23('0xd'));logger[_0x4b23('0xe')](_0x4b23('0xf'),_0x3aad2a,_0x4b23('0xd'),JSON[_0x4b23('0x10')](_0x4df132));if(_0x4df132[_0x4b23('0x11')]){if(_0x4df132[_0x4b23('0x11')][_0x4b23('0x12')]===0x1f4){logger[_0x4b23('0x11')](_0x4b23('0xc'),_0x3aad2a,_0x4df132[_0x4b23('0x11')][_0x4b23('0x13')]);return _0x5c8827(_0x4df132[_0x4b23('0x11')]['message']);}logger['error'](_0x4b23('0xc'),_0x3aad2a,_0x4df132[_0x4b23('0x11')][_0x4b23('0x13')]);return _0x3db62e(_0x4df132[_0x4b23('0x11')][_0x4b23('0x13')]);}else{logger[_0x4b23('0xb')](_0x4b23('0xc'),_0x3aad2a,_0x4b23('0xd'));_0x3db62e(_0x4df132[_0x4b23('0x14')][_0x4b23('0x13')]);}})[_0x4b23('0x15')](function(_0x2c334f){logger['error'](_0x4b23('0xc'),_0x3aad2a,_0x2c334f);_0x5c8827(_0x2c334f);});});}exports[_0x4b23('0x16')]=function(_0x521d73){var _0x1819c1=this;return new Promise(function(_0x4d5cd2,_0x2b7e5b){return db[_0x4b23('0x17')][_0x4b23('0x18')](_0x521d73[_0x4b23('0x19')],{'raw':_0x521d73[_0x4b23('0x1a')]?_0x521d73['options'][_0x4b23('0x1b')]===undefined?!![]:![]:!![]})[_0x4b23('0xa')](function(_0x5bd8a3){logger[_0x4b23('0xb')]('CreateSquareMessage',_0x521d73);logger[_0x4b23('0xe')]('CreateSquareMessage',_0x521d73,JSON[_0x4b23('0x10')](_0x5bd8a3));_0x4d5cd2(_0x5bd8a3);})['catch'](function(_0x363d9c){logger[_0x4b23('0x11')]('CreateSquareMessage',_0x363d9c[_0x4b23('0x13')],_0x521d73);_0x2b7e5b(_0x1819c1['error'](0x1f4,_0x363d9c[_0x4b23('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index c1d4c0b..ebe63c7 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 _0xef0a=['exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','/:id/test','15s','test','post','create','put','destroy'];(function(_0x1e0bfe,_0x19a453){var _0xb3a289=function(_0x541221){while(--_0x541221){_0x1e0bfe['push'](_0x1e0bfe['shift']());}};_0xb3a289(++_0x19a453);}(_0xef0a,0xe8));var _0xaef0=function(_0x4b0b08,_0x3944c8){_0x4b0b08=_0x4b0b08-0x0;var _0x4ecb99=_0xef0a[_0x4b0b08];return _0x4ecb99;};'use strict';var multer=require(_0xaef0('0x0'));var util=require(_0xaef0('0x1'));var path=require(_0xaef0('0x2'));var timeout=require('connect-timeout');var express=require(_0xaef0('0x3'));var router=express[_0xaef0('0x4')]();var fs_extra=require(_0xaef0('0x5'));var auth=require(_0xaef0('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xaef0('0x7'));var controller=require(_0xaef0('0x8'));router[_0xaef0('0x9')]('/',auth[_0xaef0('0xa')](),controller[_0xaef0('0xb')]);router[_0xaef0('0x9')](_0xaef0('0xc'),auth[_0xaef0('0xa')](),controller['show']);router['get'](_0xaef0('0xd'),auth[_0xaef0('0xa')](),timeout(_0xaef0('0xe')),controller[_0xaef0('0xf')]);router[_0xaef0('0x10')]('/',auth[_0xaef0('0xa')](),controller[_0xaef0('0x11')]);router[_0xaef0('0x12')]('/:id',auth[_0xaef0('0xa')](),controller['update']);router['delete']('/:id',auth[_0xaef0('0xa')](),controller[_0xaef0('0x13')]);module[_0xaef0('0x14')]=router; \ No newline at end of file +var _0x5d81=['Router','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','index','/:id','isAuthenticated','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x2b524c,_0x27991f){var _0x1485da=function(_0x1f0273){while(--_0x1f0273){_0x2b524c['push'](_0x2b524c['shift']());}};_0x1485da(++_0x27991f);}(_0x5d81,0x127));var _0x15d8=function(_0x369151,_0x179f72){_0x369151=_0x369151-0x0;var _0x4292d5=_0x5d81[_0x369151];return _0x4292d5;};'use strict';var multer=require(_0x15d8('0x0'));var util=require(_0x15d8('0x1'));var path=require(_0x15d8('0x2'));var timeout=require(_0x15d8('0x3'));var express=require(_0x15d8('0x4'));var router=express[_0x15d8('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x15d8('0x6'));var config=require(_0x15d8('0x7'));var controller=require(_0x15d8('0x8'));router[_0x15d8('0x9')]('/',auth['isAuthenticated'](),controller[_0x15d8('0xa')]);router[_0x15d8('0x9')](_0x15d8('0xb'),auth[_0x15d8('0xc')](),controller[_0x15d8('0xd')]);router[_0x15d8('0x9')]('/:id/test',auth[_0x15d8('0xc')](),timeout('15s'),controller['test']);router[_0x15d8('0xe')]('/',auth[_0x15d8('0xc')](),controller[_0x15d8('0xf')]);router['put'](_0x15d8('0xb'),auth[_0x15d8('0xc')](),controller[_0x15d8('0x10')]);router[_0x15d8('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x15d8('0x12')]);module[_0x15d8('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 326841a..7d8cf4d 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 _0x18ce=['STRING','exports'];(function(_0x208622,_0x39bc78){var _0x17e1e4=function(_0x187e16){while(--_0x187e16){_0x208622['push'](_0x208622['shift']());}};_0x17e1e4(++_0x39bc78);}(_0x18ce,0x85));var _0xe18c=function(_0x5afd67,_0x7d5c97){_0x5afd67=_0x5afd67-0x0;var _0x4f89e0=_0x18ce[_0x5afd67];return _0x4f89e0;};'use strict';var Sequelize=require('sequelize');module[_0xe18c('0x0')]={'name':{'type':Sequelize[_0xe18c('0x1')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0xe18c('0x1')]},'description':{'type':Sequelize[_0xe18c('0x1')]}}; \ No newline at end of file +var _0x2a79=['sequelize','STRING','name'];(function(_0x551b1c,_0x3584f9){var _0x131273=function(_0x553185){while(--_0x553185){_0x551b1c['push'](_0x551b1c['shift']());}};_0x131273(++_0x3584f9);}(_0x2a79,0x7e));var _0x92a7=function(_0x3f1188,_0x5e1fbb){_0x3f1188=_0x3f1188-0x0;var _0x4dfecf=_0x2a79[_0x3f1188];return _0x4dfecf;};'use strict';var Sequelize=require(_0x92a7('0x0'));module['exports']={'name':{'type':Sequelize[_0x92a7('0x1')],'unique':_0x92a7('0x2'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x92a7('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 89e9d35..c9a0997 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 _0x2ecb=['test','dsn','odbc','openSync','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','offset','undefined','limit','count','status','Content-Range','json','apply','reject','update','destroy','ODBC','UserProfileResource','then','end','error','stack','name','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','include','SquareOdbc','findAll','rows','catch','show','params','includeAll','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x27277a,_0x253e71){var _0x20d964=function(_0x1415d4){while(--_0x1415d4){_0x27277a['push'](_0x27277a['shift']());}};_0x20d964(++_0x253e71);}(_0x2ecb,0xb2));var _0xb2ec=function(_0x2197c3,_0x310b38){_0x2197c3=_0x2197c3-0x0;var _0x120c87=_0x2ecb[_0x2197c3];return _0x120c87;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb2ec('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb2ec('0x1'));var moment=require(_0xb2ec('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xb2ec('0x3'));var util=require('util');var path=require(_0xb2ec('0x4'));var sox=require(_0xb2ec('0x5'));var csv=require(_0xb2ec('0x6'));var ejs=require(_0xb2ec('0x7'));var fs=require('fs');var fs_extra=require(_0xb2ec('0x8'));var _=require(_0xb2ec('0x9'));var squel=require(_0xb2ec('0xa'));var crypto=require(_0xb2ec('0xb'));var jsforce=require(_0xb2ec('0xc'));var deskjs=require(_0xb2ec('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb2ec('0xe'));var Papa=require(_0xb2ec('0xf'));var Redis=require(_0xb2ec('0x10'));var authService=require(_0xb2ec('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb2ec('0x12'));var hardwareService=require(_0xb2ec('0x13'));var logger=require(_0xb2ec('0x14'))(_0xb2ec('0x15'));var utils=require(_0xb2ec('0x16'));var config=require(_0xb2ec('0x17'));var licenseUtil=require(_0xb2ec('0x18'));var db=require(_0xb2ec('0x19'))['db'];function respondWithStatusCode(_0x2ba21f,_0x463a3f){_0x463a3f=_0x463a3f||0xcc;return function(_0x3e8aa9){if(_0x3e8aa9){return _0x2ba21f[_0xb2ec('0x1a')](_0x463a3f);}return _0x2ba21f['status'](_0x463a3f)['end']();};}function respondWithResult(_0x4bdbc9,_0x23f8e3){_0x23f8e3=_0x23f8e3||0xc8;return function(_0x4cfa37){if(_0x4cfa37){return _0x4bdbc9['status'](_0x23f8e3)['json'](_0x4cfa37);}};}function respondWithFilteredResult(_0x5100bd,_0x29e92d){return function(_0x3b2762){if(_0x3b2762){var _0x50a3a7=typeof _0x29e92d[_0xb2ec('0x1b')]===_0xb2ec('0x1c')&&typeof _0x29e92d[_0xb2ec('0x1d')]===_0xb2ec('0x1c');var _0x587f7b=_0x3b2762[_0xb2ec('0x1e')];var _0x3c618a=_0x50a3a7?0x0:_0x29e92d[_0xb2ec('0x1b')];var _0x10a6b6=_0x50a3a7?_0x3b2762[_0xb2ec('0x1e')]:_0x29e92d[_0xb2ec('0x1b')]+_0x29e92d['limit'];var _0x39dc50;if(_0x10a6b6>=_0x587f7b){_0x10a6b6=_0x587f7b;_0x39dc50=0xc8;}else{_0x39dc50=0xce;}_0x5100bd[_0xb2ec('0x1f')](_0x39dc50);return _0x5100bd['set'](_0xb2ec('0x20'),_0x3c618a+'-'+_0x10a6b6+'/'+_0x587f7b)[_0xb2ec('0x21')](_0x3b2762);}return null;};}function patchUpdates(_0x47a639){return function(_0x40c0be){try{jsonpatch[_0xb2ec('0x22')](_0x40c0be,_0x47a639,!![]);}catch(_0x2cb439){return BPromise[_0xb2ec('0x23')](_0x2cb439);}return _0x40c0be['save']();};}function saveUpdates(_0x6e49c2,_0x88dca9){return function(_0x4a1480){if(_0x4a1480){return _0x4a1480[_0xb2ec('0x24')](_0x6e49c2)['then'](function(_0x224d2a){return _0x224d2a;});}return null;};}function removeEntity(_0x4b25e7,_0x1aeff4){return function(_0x9237f3){if(_0x9237f3){return _0x9237f3[_0xb2ec('0x25')]()['then'](function(){var _0x387ac2=_0x9237f3['get']({'plain':!![]});var _0x58c0ae=_0xb2ec('0x26');return db[_0xb2ec('0x27')][_0xb2ec('0x25')]({'where':{'type':_0x58c0ae,'resourceId':_0x387ac2['id']}})[_0xb2ec('0x28')](function(){return _0x9237f3;});})[_0xb2ec('0x28')](function(){_0x4b25e7[_0xb2ec('0x1f')](0xcc)[_0xb2ec('0x29')]();});}};}function handleEntityNotFound(_0x428606,_0xce97da){return function(_0x14cb2b){if(!_0x14cb2b){_0x428606['sendStatus'](0x194);}return _0x14cb2b;};}function handleError(_0x297ea7,_0x336255){_0x336255=_0x336255||0x1f4;return function(_0x4d09ae){logger[_0xb2ec('0x2a')](_0x4d09ae[_0xb2ec('0x2b')]);if(_0x4d09ae['name']){delete _0x4d09ae[_0xb2ec('0x2c')];}_0x297ea7[_0xb2ec('0x1f')](_0x336255)['send'](_0x4d09ae);};}exports[_0xb2ec('0x2d')]=function(_0x5822d4,_0x137059){var _0x129d1c={},_0xc44be4={},_0xfbbf2a={'count':0x0,'rows':[]};var _0x4f081b=_['map'](db['SquareOdbc'][_0xb2ec('0x2e')],function(_0x21b8b0){return{'name':_0x21b8b0[_0xb2ec('0x2f')],'type':_0x21b8b0[_0xb2ec('0x30')][_0xb2ec('0x31')]};});_0xc44be4[_0xb2ec('0x32')]=_[_0xb2ec('0x33')](_0x4f081b,_0xb2ec('0x2c'));_0xc44be4[_0xb2ec('0x34')]=_[_0xb2ec('0x35')](_0x5822d4[_0xb2ec('0x34')]);_0xc44be4[_0xb2ec('0x36')]=_[_0xb2ec('0x37')](_0xc44be4[_0xb2ec('0x32')],_0xc44be4['query']);_0x129d1c[_0xb2ec('0x38')]=_[_0xb2ec('0x37')](_0xc44be4[_0xb2ec('0x32')],qs['fields'](_0x5822d4[_0xb2ec('0x34')][_0xb2ec('0x39')]));_0x129d1c['attributes']=_0x129d1c[_0xb2ec('0x38')][_0xb2ec('0x3a')]?_0x129d1c[_0xb2ec('0x38')]:_0xc44be4[_0xb2ec('0x32')];if(!_0x5822d4[_0xb2ec('0x34')][_0xb2ec('0x3b')]('nolimit')){_0x129d1c['limit']=qs['limit'](_0x5822d4[_0xb2ec('0x34')][_0xb2ec('0x1d')]);_0x129d1c[_0xb2ec('0x1b')]=qs[_0xb2ec('0x1b')](_0x5822d4[_0xb2ec('0x34')][_0xb2ec('0x1b')]);}_0x129d1c[_0xb2ec('0x3c')]=qs[_0xb2ec('0x3d')](_0x5822d4[_0xb2ec('0x34')][_0xb2ec('0x3d')]);_0x129d1c[_0xb2ec('0x3e')]=qs[_0xb2ec('0x36')](_[_0xb2ec('0x3f')](_0x5822d4['query'],_0xc44be4[_0xb2ec('0x36')]),_0x4f081b);if(_0x5822d4[_0xb2ec('0x34')][_0xb2ec('0x40')]){_0x129d1c[_0xb2ec('0x3e')]=_[_0xb2ec('0x41')](_0x129d1c['where'],{'$or':_[_0xb2ec('0x33')](_0x4f081b,function(_0x11a8b7){if(_0x11a8b7['type']!==_0xb2ec('0x42')){var _0x5681c1={};_0x5681c1[_0x11a8b7[_0xb2ec('0x2c')]]={'$like':'%'+_0x5822d4[_0xb2ec('0x34')][_0xb2ec('0x40')]+'%'};return _0x5681c1;}})});}_0x129d1c=_[_0xb2ec('0x41')]({},_0x129d1c,_0x5822d4['options']);var _0x57eb6a={'where':_0x129d1c[_0xb2ec('0x3e')]};return db['SquareOdbc']['count'](_0x57eb6a)[_0xb2ec('0x28')](function(_0x5552dc){_0xfbbf2a[_0xb2ec('0x1e')]=_0x5552dc;if(_0x5822d4['query']['includeAll']){_0x129d1c[_0xb2ec('0x43')]=[{'all':!![]}];}return db[_0xb2ec('0x44')][_0xb2ec('0x45')](_0x129d1c);})[_0xb2ec('0x28')](function(_0x1476e2){_0xfbbf2a[_0xb2ec('0x46')]=_0x1476e2;return _0xfbbf2a;})[_0xb2ec('0x28')](respondWithFilteredResult(_0x137059,_0x129d1c))[_0xb2ec('0x47')](handleError(_0x137059,null));};exports[_0xb2ec('0x48')]=function(_0x9d092f,_0x23a3a1){var _0xc63aba={'raw':!![],'where':{'id':_0x9d092f[_0xb2ec('0x49')]['id']}},_0x58dfec={};_0x58dfec['model']=_['keys'](db[_0xb2ec('0x44')][_0xb2ec('0x2e')]);_0x58dfec[_0xb2ec('0x34')]=_[_0xb2ec('0x35')](_0x9d092f[_0xb2ec('0x34')]);_0x58dfec['filters']=_[_0xb2ec('0x37')](_0x58dfec[_0xb2ec('0x32')],_0x58dfec[_0xb2ec('0x34')]);_0xc63aba[_0xb2ec('0x38')]=_[_0xb2ec('0x37')](_0x58dfec[_0xb2ec('0x32')],qs[_0xb2ec('0x39')](_0x9d092f[_0xb2ec('0x34')][_0xb2ec('0x39')]));_0xc63aba[_0xb2ec('0x38')]=_0xc63aba['attributes']['length']?_0xc63aba[_0xb2ec('0x38')]:_0x58dfec[_0xb2ec('0x32')];if(_0x9d092f['query'][_0xb2ec('0x4a')]){_0xc63aba['include']=[{'all':!![]}];}_0xc63aba=_[_0xb2ec('0x41')]({},_0xc63aba,_0x9d092f['options']);return db[_0xb2ec('0x44')]['find'](_0xc63aba)[_0xb2ec('0x28')](handleEntityNotFound(_0x23a3a1,null))[_0xb2ec('0x28')](respondWithResult(_0x23a3a1,null))[_0xb2ec('0x47')](handleError(_0x23a3a1,null));};exports[_0xb2ec('0x4b')]=function(_0x104ba9,_0x1dcd3d){return db['SquareOdbc']['create'](_0x104ba9[_0xb2ec('0x4c')],{})['then'](function(_0x28fc66){var _0x4da594=_0x104ba9['user'][_0xb2ec('0x4d')]({'plain':!![]});if(!_0x4da594)throw new Error(_0xb2ec('0x4e'));if(_0x4da594[_0xb2ec('0x4f')]==='user'){var _0x59f2a4=_0x28fc66[_0xb2ec('0x4d')]({'plain':!![]});var _0x2c53dd=_0xb2ec('0x26');return db['UserProfileSection'][_0xb2ec('0x50')]({'where':{'name':_0x2c53dd,'userProfileId':_0x4da594[_0xb2ec('0x51')]},'raw':!![]})[_0xb2ec('0x28')](function(_0x19cfdc){if(_0x19cfdc&&_0x19cfdc['autoAssociation']===0x0){return db[_0xb2ec('0x27')][_0xb2ec('0x4b')]({'name':_0x59f2a4[_0xb2ec('0x2c')],'resourceId':_0x59f2a4['id'],'type':_0x19cfdc[_0xb2ec('0x2c')],'sectionId':_0x19cfdc['id']},{})['then'](function(){return _0x28fc66;});}else{return _0x28fc66;}})[_0xb2ec('0x47')](function(_0x31ac59){logger[_0xb2ec('0x2a')](_0xb2ec('0x52'),_0x31ac59);throw _0x31ac59;});}return _0x28fc66;})[_0xb2ec('0x28')](respondWithResult(_0x1dcd3d,0xc9))[_0xb2ec('0x47')](handleError(_0x1dcd3d,null));};exports[_0xb2ec('0x24')]=function(_0x5df76e,_0x4891c5){if(_0x5df76e[_0xb2ec('0x4c')]['id']){delete _0x5df76e[_0xb2ec('0x4c')]['id'];}return db[_0xb2ec('0x44')][_0xb2ec('0x50')]({'where':{'id':_0x5df76e[_0xb2ec('0x49')]['id']}})[_0xb2ec('0x28')](handleEntityNotFound(_0x4891c5,null))['then'](saveUpdates(_0x5df76e[_0xb2ec('0x4c')],null))[_0xb2ec('0x28')](respondWithResult(_0x4891c5,null))[_0xb2ec('0x47')](handleError(_0x4891c5,null));};exports[_0xb2ec('0x25')]=function(_0x5021d1,_0x32d09b){return db['SquareOdbc'][_0xb2ec('0x50')]({'where':{'id':_0x5021d1[_0xb2ec('0x49')]['id']}})[_0xb2ec('0x28')](handleEntityNotFound(_0x32d09b,null))['then'](removeEntity(_0x32d09b,null))[_0xb2ec('0x47')](handleError(_0x32d09b,null));};exports[_0xb2ec('0x53')]=function(_0x32ebf2,_0x15d8d1,_0x5b46a3){var _0xa50c3b;return db['SquareOdbc'][_0xb2ec('0x50')]({'where':{'id':_0x32ebf2['params']['id']},'attributes':['id',_0xb2ec('0x54')]})[_0xb2ec('0x28')](handleEntityNotFound(_0x15d8d1,null))[_0xb2ec('0x28')](function(_0x1dedb1){if(_0x1dedb1){var _0x4c373f=require(_0xb2ec('0x55'))();_0x4c373f[_0xb2ec('0x56')](_0x1dedb1[_0xb2ec('0x54')]);_0x4c373f['closeSync']();return _0x1dedb1;}})['then'](respondWithResult(_0x15d8d1,null))['catch'](handleError(_0x15d8d1,null));}; \ No newline at end of file +var _0x026c=['intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','SquareOdbc','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','user','role','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','dsn','odbc','openSync','closeSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','offset','count','limit','Content-Range','update','then','destroy','get','ODBC','stack','send','index','map','fieldName','key','name','query','keys','filters'];(function(_0x455150,_0x274121){var _0x12ca9c=function(_0x47eb22){while(--_0x47eb22){_0x455150['push'](_0x455150['shift']());}};_0x12ca9c(++_0x274121);}(_0x026c,0xc7));var _0xc026=function(_0x573325,_0x2f2fa5){_0x573325=_0x573325-0x0;var _0x1987bb=_0x026c[_0x573325];return _0x1987bb;};'use strict';var emlformat=require(_0xc026('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc026('0x1'));var jsonpatch=require(_0xc026('0x2'));var rp=require(_0xc026('0x3'));var moment=require(_0xc026('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc026('0x5'));var path=require(_0xc026('0x6'));var sox=require(_0xc026('0x7'));var csv=require(_0xc026('0x8'));var ejs=require(_0xc026('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc026('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc026('0xb'));var Redis=require(_0xc026('0xc'));var authService=require(_0xc026('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xc026('0xe'));var hardwareService=require(_0xc026('0xf'));var logger=require(_0xc026('0x10'))(_0xc026('0x11'));var utils=require('../../config/utils');var config=require(_0xc026('0x12'));var licenseUtil=require(_0xc026('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x597c69,_0x159bb1){_0x159bb1=_0x159bb1||0xcc;return function(_0x384908){if(_0x384908){return _0x597c69[_0xc026('0x14')](_0x159bb1);}return _0x597c69[_0xc026('0x15')](_0x159bb1)[_0xc026('0x16')]();};}function respondWithResult(_0x485989,_0x156707){_0x156707=_0x156707||0xc8;return function(_0x1b1e07){if(_0x1b1e07){return _0x485989[_0xc026('0x15')](_0x156707)[_0xc026('0x17')](_0x1b1e07);}};}function respondWithFilteredResult(_0xb34866,_0x17134e){return function(_0x4d91c9){if(_0x4d91c9){var _0x2c7ea2=typeof _0x17134e['offset']===_0xc026('0x18')&&typeof _0x17134e['limit']===_0xc026('0x18');var _0x100bd7=_0x4d91c9['count'];var _0x5063a8=_0x2c7ea2?0x0:_0x17134e[_0xc026('0x19')];var _0x4facef=_0x2c7ea2?_0x4d91c9[_0xc026('0x1a')]:_0x17134e[_0xc026('0x19')]+_0x17134e[_0xc026('0x1b')];var _0x4bb30d;if(_0x4facef>=_0x100bd7){_0x4facef=_0x100bd7;_0x4bb30d=0xc8;}else{_0x4bb30d=0xce;}_0xb34866['status'](_0x4bb30d);return _0xb34866['set'](_0xc026('0x1c'),_0x5063a8+'-'+_0x4facef+'/'+_0x100bd7)[_0xc026('0x17')](_0x4d91c9);}return null;};}function patchUpdates(_0x1d95f9){return function(_0x5ae759){try{jsonpatch['apply'](_0x5ae759,_0x1d95f9,!![]);}catch(_0x2588a2){return BPromise['reject'](_0x2588a2);}return _0x5ae759['save']();};}function saveUpdates(_0x39770b,_0x384654){return function(_0x40aa6a){if(_0x40aa6a){return _0x40aa6a[_0xc026('0x1d')](_0x39770b)[_0xc026('0x1e')](function(_0x11c2cd){return _0x11c2cd;});}return null;};}function removeEntity(_0x33194c,_0x9cbdd2){return function(_0x206f71){if(_0x206f71){return _0x206f71[_0xc026('0x1f')]()['then'](function(){var _0x298675=_0x206f71[_0xc026('0x20')]({'plain':!![]});var _0x2d36d1=_0xc026('0x21');return db['UserProfileResource']['destroy']({'where':{'type':_0x2d36d1,'resourceId':_0x298675['id']}})[_0xc026('0x1e')](function(){return _0x206f71;});})['then'](function(){_0x33194c['status'](0xcc)[_0xc026('0x16')]();});}};}function handleEntityNotFound(_0x3ff43b,_0x2ddba7){return function(_0x25faa6){if(!_0x25faa6){_0x3ff43b[_0xc026('0x14')](0x194);}return _0x25faa6;};}function handleError(_0x2b3203,_0x2ae219){_0x2ae219=_0x2ae219||0x1f4;return function(_0x5e0e6c){logger['error'](_0x5e0e6c[_0xc026('0x22')]);if(_0x5e0e6c['name']){delete _0x5e0e6c['name'];}_0x2b3203[_0xc026('0x15')](_0x2ae219)[_0xc026('0x23')](_0x5e0e6c);};}exports[_0xc026('0x24')]=function(_0x3e0fad,_0x38910d){var _0x466228={},_0x130812={},_0x31734a={'count':0x0,'rows':[]};var _0x1626f7=_[_0xc026('0x25')](db['SquareOdbc']['rawAttributes'],function(_0x323c73){return{'name':_0x323c73[_0xc026('0x26')],'type':_0x323c73['type'][_0xc026('0x27')]};});_0x130812['model']=_['map'](_0x1626f7,_0xc026('0x28'));_0x130812[_0xc026('0x29')]=_[_0xc026('0x2a')](_0x3e0fad[_0xc026('0x29')]);_0x130812[_0xc026('0x2b')]=_[_0xc026('0x2c')](_0x130812['model'],_0x130812[_0xc026('0x29')]);_0x466228['attributes']=_[_0xc026('0x2c')](_0x130812[_0xc026('0x2d')],qs['fields'](_0x3e0fad[_0xc026('0x29')][_0xc026('0x2e')]));_0x466228['attributes']=_0x466228[_0xc026('0x2f')][_0xc026('0x30')]?_0x466228[_0xc026('0x2f')]:_0x130812[_0xc026('0x2d')];if(!_0x3e0fad[_0xc026('0x29')][_0xc026('0x31')](_0xc026('0x32'))){_0x466228[_0xc026('0x1b')]=qs[_0xc026('0x1b')](_0x3e0fad[_0xc026('0x29')][_0xc026('0x1b')]);_0x466228[_0xc026('0x19')]=qs[_0xc026('0x19')](_0x3e0fad[_0xc026('0x29')]['offset']);}_0x466228[_0xc026('0x33')]=qs[_0xc026('0x34')](_0x3e0fad[_0xc026('0x29')][_0xc026('0x34')]);_0x466228[_0xc026('0x35')]=qs[_0xc026('0x2b')](_[_0xc026('0x36')](_0x3e0fad[_0xc026('0x29')],_0x130812['filters']),_0x1626f7);if(_0x3e0fad['query'][_0xc026('0x37')]){_0x466228[_0xc026('0x35')]=_['merge'](_0x466228[_0xc026('0x35')],{'$or':_[_0xc026('0x25')](_0x1626f7,function(_0x5d5bf5){if(_0x5d5bf5['type']!==_0xc026('0x38')){var _0x5005d1={};_0x5005d1[_0x5d5bf5[_0xc026('0x28')]]={'$like':'%'+_0x3e0fad['query'][_0xc026('0x37')]+'%'};return _0x5005d1;}})});}_0x466228=_[_0xc026('0x39')]({},_0x466228,_0x3e0fad[_0xc026('0x3a')]);var _0x1710b3={'where':_0x466228[_0xc026('0x35')]};return db[_0xc026('0x3b')][_0xc026('0x1a')](_0x1710b3)['then'](function(_0x2e1244){_0x31734a[_0xc026('0x1a')]=_0x2e1244;if(_0x3e0fad['query'][_0xc026('0x3c')]){_0x466228[_0xc026('0x3d')]=[{'all':!![]}];}return db[_0xc026('0x3b')][_0xc026('0x3e')](_0x466228);})[_0xc026('0x1e')](function(_0x31a0b1){_0x31734a[_0xc026('0x3f')]=_0x31a0b1;return _0x31734a;})[_0xc026('0x1e')](respondWithFilteredResult(_0x38910d,_0x466228))[_0xc026('0x40')](handleError(_0x38910d,null));};exports[_0xc026('0x41')]=function(_0x39f7cb,_0x156189){var _0xd2d8f6={'raw':!![],'where':{'id':_0x39f7cb[_0xc026('0x42')]['id']}},_0x7262d4={};_0x7262d4['model']=_[_0xc026('0x2a')](db[_0xc026('0x3b')][_0xc026('0x43')]);_0x7262d4[_0xc026('0x29')]=_[_0xc026('0x2a')](_0x39f7cb['query']);_0x7262d4[_0xc026('0x2b')]=_[_0xc026('0x2c')](_0x7262d4[_0xc026('0x2d')],_0x7262d4[_0xc026('0x29')]);_0xd2d8f6[_0xc026('0x2f')]=_[_0xc026('0x2c')](_0x7262d4[_0xc026('0x2d')],qs[_0xc026('0x2e')](_0x39f7cb[_0xc026('0x29')][_0xc026('0x2e')]));_0xd2d8f6['attributes']=_0xd2d8f6[_0xc026('0x2f')][_0xc026('0x30')]?_0xd2d8f6['attributes']:_0x7262d4[_0xc026('0x2d')];if(_0x39f7cb[_0xc026('0x29')]['includeAll']){_0xd2d8f6['include']=[{'all':!![]}];}_0xd2d8f6=_['merge']({},_0xd2d8f6,_0x39f7cb['options']);return db[_0xc026('0x3b')]['find'](_0xd2d8f6)[_0xc026('0x1e')](handleEntityNotFound(_0x156189,null))[_0xc026('0x1e')](respondWithResult(_0x156189,null))['catch'](handleError(_0x156189,null));};exports[_0xc026('0x44')]=function(_0x567f01,_0x1877c5){return db['SquareOdbc'][_0xc026('0x44')](_0x567f01[_0xc026('0x45')],{})[_0xc026('0x1e')](function(_0x478bcc){var _0xaa912f=_0x567f01[_0xc026('0x46')][_0xc026('0x20')]({'plain':!![]});if(!_0xaa912f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xaa912f[_0xc026('0x47')]==='user'){var _0x41864e=_0x478bcc[_0xc026('0x20')]({'plain':!![]});var _0x4d0054=_0xc026('0x21');return db['UserProfileSection']['find']({'where':{'name':_0x4d0054,'userProfileId':_0xaa912f['userProfileId']},'raw':!![]})['then'](function(_0x161711){if(_0x161711&&_0x161711[_0xc026('0x48')]===0x0){return db[_0xc026('0x49')][_0xc026('0x44')]({'name':_0x41864e[_0xc026('0x28')],'resourceId':_0x41864e['id'],'type':_0x161711['name'],'sectionId':_0x161711['id']},{})[_0xc026('0x1e')](function(){return _0x478bcc;});}else{return _0x478bcc;}})[_0xc026('0x40')](function(_0x2e0742){logger[_0xc026('0x4a')](_0xc026('0x4b'),_0x2e0742);throw _0x2e0742;});}return _0x478bcc;})[_0xc026('0x1e')](respondWithResult(_0x1877c5,0xc9))[_0xc026('0x40')](handleError(_0x1877c5,null));};exports[_0xc026('0x1d')]=function(_0x1e922b,_0x3262cb){if(_0x1e922b[_0xc026('0x45')]['id']){delete _0x1e922b[_0xc026('0x45')]['id'];}return db[_0xc026('0x3b')][_0xc026('0x4c')]({'where':{'id':_0x1e922b[_0xc026('0x42')]['id']}})[_0xc026('0x1e')](handleEntityNotFound(_0x3262cb,null))[_0xc026('0x1e')](saveUpdates(_0x1e922b[_0xc026('0x45')],null))['then'](respondWithResult(_0x3262cb,null))[_0xc026('0x40')](handleError(_0x3262cb,null));};exports[_0xc026('0x1f')]=function(_0x20cbf1,_0x3b4f8d){return db[_0xc026('0x3b')]['find']({'where':{'id':_0x20cbf1['params']['id']}})[_0xc026('0x1e')](handleEntityNotFound(_0x3b4f8d,null))[_0xc026('0x1e')](removeEntity(_0x3b4f8d,null))[_0xc026('0x40')](handleError(_0x3b4f8d,null));};exports['test']=function(_0x3cbbea,_0x47f6dc,_0x383000){var _0x471eb7;return db[_0xc026('0x3b')]['find']({'where':{'id':_0x3cbbea['params']['id']},'attributes':['id',_0xc026('0x4d')]})[_0xc026('0x1e')](handleEntityNotFound(_0x47f6dc,null))['then'](function(_0x50d7e9){if(_0x50d7e9){var _0x1b876d=require(_0xc026('0x4e'))();_0x1b876d[_0xc026('0x4f')](_0x50d7e9[_0xc026('0x4d')]);_0x1b876d[_0xc026('0x50')]();return _0x50d7e9;}})['then'](respondWithResult(_0x47f6dc,null))['catch'](handleError(_0x47f6dc,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 0d19896..ee25cc9 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 _0xce88=['lodash','util','path','rimraf','../../config/environment','exports','define','SquareOdbc','square_odbc'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xce88,0x17a));var _0x8ce8=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0xce88[_0x3b0731];return _0x4204d7;};'use strict';var _=require(_0x8ce8('0x0'));var util=require(_0x8ce8('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8ce8('0x2'));var rimraf=require(_0x8ce8('0x3'));var config=require(_0x8ce8('0x4'));var attributes=require('./squareOdbc.attributes');module[_0x8ce8('0x5')]=function(_0x2e64a8,_0x531b4c){return _0x2e64a8[_0x8ce8('0x6')](_0x8ce8('0x7'),attributes,{'tableName':_0x8ce8('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x29ca=['square_odbc','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes','define','SquareOdbc'];(function(_0xb61fa6,_0x580145){var _0x227190=function(_0x4fdaa2){while(--_0x4fdaa2){_0xb61fa6['push'](_0xb61fa6['shift']());}};_0x227190(++_0x580145);}(_0x29ca,0x1a5));var _0xa29c=function(_0x26a4ea,_0xa72fb8){_0x26a4ea=_0x26a4ea-0x0;var _0x1b669e=_0x29ca[_0x26a4ea];return _0x1b669e;};'use strict';var _=require(_0xa29c('0x0'));var util=require('util');var logger=require(_0xa29c('0x1'))(_0xa29c('0x2'));var moment=require(_0xa29c('0x3'));var BPromise=require('bluebird');var rp=require(_0xa29c('0x4'));var fs=require('fs');var path=require(_0xa29c('0x5'));var rimraf=require(_0xa29c('0x6'));var config=require(_0xa29c('0x7'));var attributes=require(_0xa29c('0x8'));module['exports']=function(_0x4fec03,_0x41e5e8){return _0x4fec03[_0xa29c('0x9')](_0xa29c('0xa'),attributes,{'tableName':_0xa29c('0xb'),'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 235781f..ae33d66 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 _0xac25=['error','code','message','result','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','where','attributes','include','model','map','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x359433,_0x2398b0){var _0x2db8ab=function(_0xefac8f){while(--_0xefac8f){_0x359433['push'](_0x359433['shift']());}};_0x2db8ab(++_0x2398b0);}(_0xac25,0x107));var _0x5ac2=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xac25[_0x8de54f];return _0x14cba4;};'use strict';var _=require(_0x5ac2('0x0'));var util=require('util');var moment=require(_0x5ac2('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5ac2('0x2'));var db=require(_0x5ac2('0x3'))['db'];var utils=require(_0x5ac2('0x4'));var logger=require(_0x5ac2('0x5'))(_0x5ac2('0x6'));var config=require('../../config/environment');var jayson=require(_0x5ac2('0x7'));var client=jayson['client'][_0x5ac2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x18f10c,_0x564e63,_0x4201b2){return new BPromise(function(_0x5376a3,_0x202bc2){return client[_0x5ac2('0x9')](_0x18f10c,_0x4201b2)[_0x5ac2('0xa')](function(_0x2eb30d){logger[_0x5ac2('0xb')](_0x5ac2('0xc'),_0x564e63,_0x5ac2('0xd'));logger[_0x5ac2('0xe')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x564e63,_0x5ac2('0xd'),JSON[_0x5ac2('0xf')](_0x2eb30d));if(_0x2eb30d[_0x5ac2('0x10')]){if(_0x2eb30d['error'][_0x5ac2('0x11')]===0x1f4){logger[_0x5ac2('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x564e63,_0x2eb30d[_0x5ac2('0x10')]['message']);return _0x202bc2(_0x2eb30d[_0x5ac2('0x10')][_0x5ac2('0x12')]);}logger['error']('SquareOdbc,\x20%s,\x20%s',_0x564e63,_0x2eb30d[_0x5ac2('0x10')]['message']);return _0x5376a3(_0x2eb30d[_0x5ac2('0x10')][_0x5ac2('0x12')]);}else{logger[_0x5ac2('0xb')](_0x5ac2('0xc'),_0x564e63,_0x5ac2('0xd'));_0x5376a3(_0x2eb30d[_0x5ac2('0x13')][_0x5ac2('0x12')]);}})[_0x5ac2('0x14')](function(_0x5017d2){logger[_0x5ac2('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x564e63,_0x5017d2);_0x202bc2(_0x5017d2);});});}exports[_0x5ac2('0x15')]=function(_0x3ae29f){var _0x3501fb=this;return new Promise(function(_0x95057d,_0x6b9cf1){return db[_0x5ac2('0x16')][_0x5ac2('0x17')]({'raw':_0x3ae29f[_0x5ac2('0x18')]?_0x3ae29f[_0x5ac2('0x18')][_0x5ac2('0x19')]===undefined?!![]:![]:!![],'where':_0x3ae29f['options']?_0x3ae29f[_0x5ac2('0x18')][_0x5ac2('0x1a')]||null:null,'attributes':_0x3ae29f[_0x5ac2('0x18')]?_0x3ae29f[_0x5ac2('0x18')][_0x5ac2('0x1b')]||null:null,'include':_0x3ae29f[_0x5ac2('0x18')]?_0x3ae29f[_0x5ac2('0x18')][_0x5ac2('0x1c')]?_['map'](_0x3ae29f['options'][_0x5ac2('0x1c')],function(_0x10a59c){return{'model':db[_0x10a59c[_0x5ac2('0x1d')]],'as':_0x10a59c['as'],'attributes':_0x10a59c[_0x5ac2('0x1b')],'include':_0x10a59c[_0x5ac2('0x1c')]?_[_0x5ac2('0x1e')](_0x10a59c['include'],function(_0x127be7){return{'model':db[_0x127be7[_0x5ac2('0x1d')]],'as':_0x127be7['as'],'attributes':_0x127be7[_0x5ac2('0x1b')],'include':_0x127be7[_0x5ac2('0x1c')]?_[_0x5ac2('0x1e')](_0x127be7[_0x5ac2('0x1c')],function(_0x5c6071){return{'model':db[_0x5c6071['model']],'as':_0x5c6071['as'],'attributes':_0x5c6071['attributes']};}):[]};}):[]};}):[]:[]})[_0x5ac2('0xa')](function(_0x52610a){logger[_0x5ac2('0xb')](_0x5ac2('0x15'),_0x3ae29f);logger[_0x5ac2('0xe')]('ShowSquareOdbc',_0x3ae29f,JSON['stringify'](_0x52610a));_0x95057d(_0x52610a);})['catch'](function(_0x5a6e74){logger[_0x5ac2('0x10')](_0x5ac2('0x15'),_0x5a6e74['message'],_0x3ae29f);_0x6b9cf1(_0x3501fb['error'](0x1f4,_0x5a6e74[_0x5ac2('0x12')]));});});}; \ No newline at end of file +var _0x8c95=['catch','ShowSquareOdbc','SquareOdbc','find','options','raw','where','attributes','include','map','model','then','lodash','util','moment','../../config/utils','rpc','../../config/environment','client','http','request','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x487164,_0x54cbdc){var _0x98a9e1=function(_0x2b1b4c){while(--_0x2b1b4c){_0x487164['push'](_0x487164['shift']());}};_0x98a9e1(++_0x54cbdc);}(_0x8c95,0x185));var _0x58c9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8c95[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x58c9('0x0'));var util=require(_0x58c9('0x1'));var moment=require(_0x58c9('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x58c9('0x3'));var logger=require('../../config/logger')(_0x58c9('0x4'));var config=require(_0x58c9('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x58c9('0x6')][_0x58c9('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2e88d6,_0x3bfccc,_0x5bdbdc){return new BPromise(function(_0x4f77e3,_0x40f3e4){return client[_0x58c9('0x8')](_0x2e88d6,_0x5bdbdc)['then'](function(_0x4fec7b){logger[_0x58c9('0x9')](_0x58c9('0xa'),_0x3bfccc,_0x58c9('0xb'));logger[_0x58c9('0xc')](_0x58c9('0xd'),_0x3bfccc,_0x58c9('0xb'),JSON[_0x58c9('0xe')](_0x4fec7b));if(_0x4fec7b[_0x58c9('0xf')]){if(_0x4fec7b[_0x58c9('0xf')]['code']===0x1f4){logger[_0x58c9('0xf')](_0x58c9('0xa'),_0x3bfccc,_0x4fec7b[_0x58c9('0xf')][_0x58c9('0x10')]);return _0x40f3e4(_0x4fec7b[_0x58c9('0xf')]['message']);}logger[_0x58c9('0xf')](_0x58c9('0xa'),_0x3bfccc,_0x4fec7b[_0x58c9('0xf')][_0x58c9('0x10')]);return _0x4f77e3(_0x4fec7b[_0x58c9('0xf')]['message']);}else{logger[_0x58c9('0x9')]('SquareOdbc,\x20%s,\x20%s',_0x3bfccc,'request\x20sent');_0x4f77e3(_0x4fec7b['result']['message']);}})[_0x58c9('0x11')](function(_0x49487f){logger[_0x58c9('0xf')](_0x58c9('0xa'),_0x3bfccc,_0x49487f);_0x40f3e4(_0x49487f);});});}exports[_0x58c9('0x12')]=function(_0x486fce){var _0xf167a8=this;return new Promise(function(_0x4b0e92,_0x3d0d3b){return db[_0x58c9('0x13')][_0x58c9('0x14')]({'raw':_0x486fce[_0x58c9('0x15')]?_0x486fce[_0x58c9('0x15')][_0x58c9('0x16')]===undefined?!![]:![]:!![],'where':_0x486fce['options']?_0x486fce['options'][_0x58c9('0x17')]||null:null,'attributes':_0x486fce[_0x58c9('0x15')]?_0x486fce[_0x58c9('0x15')][_0x58c9('0x18')]||null:null,'include':_0x486fce[_0x58c9('0x15')]?_0x486fce[_0x58c9('0x15')][_0x58c9('0x19')]?_[_0x58c9('0x1a')](_0x486fce[_0x58c9('0x15')][_0x58c9('0x19')],function(_0x1d1cf3){return{'model':db[_0x1d1cf3['model']],'as':_0x1d1cf3['as'],'attributes':_0x1d1cf3['attributes'],'include':_0x1d1cf3[_0x58c9('0x19')]?_[_0x58c9('0x1a')](_0x1d1cf3[_0x58c9('0x19')],function(_0x5bd808){return{'model':db[_0x5bd808[_0x58c9('0x1b')]],'as':_0x5bd808['as'],'attributes':_0x5bd808[_0x58c9('0x18')],'include':_0x5bd808['include']?_[_0x58c9('0x1a')](_0x5bd808[_0x58c9('0x19')],function(_0x340ade){return{'model':db[_0x340ade['model']],'as':_0x340ade['as'],'attributes':_0x340ade[_0x58c9('0x18')]};}):[]};}):[]};}):[]:[]})[_0x58c9('0x1c')](function(_0x29e727){logger[_0x58c9('0x9')](_0x58c9('0x12'),_0x486fce);logger[_0x58c9('0xc')](_0x58c9('0x12'),_0x486fce,JSON[_0x58c9('0xe')](_0x29e727));_0x4b0e92(_0x29e727);})[_0x58c9('0x11')](function(_0x1f9055){logger[_0x58c9('0xf')]('ShowSquareOdbc',_0x1f9055[_0x58c9('0x10')],_0x486fce);_0x3d0d3b(_0xf167a8['error'](0x1f4,_0x1f9055[_0x58c9('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 15b7da4..ee4fc48 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 _0x95c3=['destroy','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','isAuthenticated','index','get','/:id','show','/:id/users','getUsers','post','addUsers','delete'];(function(_0x20f13a,_0x466089){var _0x437a36=function(_0x392e1f){while(--_0x392e1f){_0x20f13a['push'](_0x20f13a['shift']());}};_0x437a36(++_0x466089);}(_0x95c3,0x6d));var _0x395c=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x95c3[_0x565c49];return _0x20ca34;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x395c('0x0'));var timeout=require(_0x395c('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x395c('0x2'));var auth=require(_0x395c('0x3'));var interaction=require(_0x395c('0x4'));var config=require(_0x395c('0x5'));var controller=require(_0x395c('0x6'));router['get']('/',auth[_0x395c('0x7')](),controller[_0x395c('0x8')]);router[_0x395c('0x9')](_0x395c('0xa'),auth[_0x395c('0x7')](),controller[_0x395c('0xb')]);router[_0x395c('0x9')](_0x395c('0xc'),auth[_0x395c('0x7')](),controller[_0x395c('0xd')]);router[_0x395c('0xe')]('/',auth[_0x395c('0x7')](),controller['create']);router[_0x395c('0xe')](_0x395c('0xc'),auth[_0x395c('0x7')](),controller[_0x395c('0xf')]);router['put'](_0x395c('0xa'),auth[_0x395c('0x7')](),controller['update']);router[_0x395c('0x10')](_0x395c('0xa'),auth[_0x395c('0x7')](),controller[_0x395c('0x11')]);router['delete'](_0x395c('0xc'),auth['isAuthenticated'](),controller['removeUsers']);module['exports']=router; \ No newline at end of file +var _0x09b0=['path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/users','getUsers','post','create','addUsers','update','delete','destroy','removeUsers','exports','multer'];(function(_0x191d36,_0x5a4c73){var _0x344910=function(_0x142885){while(--_0x142885){_0x191d36['push'](_0x191d36['shift']());}};_0x344910(++_0x5a4c73);}(_0x09b0,0x1f3));var _0x009b=function(_0x40cff9,_0x7f2b54){_0x40cff9=_0x40cff9-0x0;var _0x549b5b=_0x09b0[_0x40cff9];return _0x549b5b;};'use strict';var multer=require(_0x009b('0x0'));var util=require('util');var path=require(_0x009b('0x1'));var timeout=require('connect-timeout');var express=require(_0x009b('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x009b('0x3'));var interaction=require(_0x009b('0x4'));var config=require(_0x009b('0x5'));var controller=require('./squareProject.controller');router[_0x009b('0x6')]('/',auth[_0x009b('0x7')](),controller['index']);router[_0x009b('0x6')](_0x009b('0x8'),auth[_0x009b('0x7')](),controller[_0x009b('0x9')]);router[_0x009b('0x6')](_0x009b('0xa'),auth[_0x009b('0x7')](),controller[_0x009b('0xb')]);router[_0x009b('0xc')]('/',auth[_0x009b('0x7')](),controller[_0x009b('0xd')]);router[_0x009b('0xc')](_0x009b('0xa'),auth[_0x009b('0x7')](),controller[_0x009b('0xe')]);router['put'](_0x009b('0x8'),auth[_0x009b('0x7')](),controller[_0x009b('0xf')]);router[_0x009b('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x009b('0x11')]);router[_0x009b('0x10')](_0x009b('0xa'),auth[_0x009b('0x7')](),controller[_0x009b('0x12')]);module[_0x009b('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 fa59be5..1028c50 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 _0x28a0=['getDataValue','utf8','production','toString','DATE','sequelize','STRING','name','TEXT','BLOB','long','preproduction'];(function(_0x305681,_0x2230c8){var _0xfcf133=function(_0x266e3f){while(--_0x266e3f){_0x305681['push'](_0x305681['shift']());}};_0xfcf133(++_0x2230c8);}(_0x28a0,0x155));var _0x028a=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x28a0[_0x432682];return _0x463d05;};'use strict';var Sequelize=require(_0x028a('0x0'));module['exports']={'name':{'type':Sequelize[_0x028a('0x1')],'unique':_0x028a('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x028a('0x1')]},'notes':{'type':Sequelize[_0x028a('0x3')]},'preproduction':{'type':Sequelize[_0x028a('0x4')](_0x028a('0x5')),'get':function(){if(this['getDataValue'](_0x028a('0x6'))){return this[_0x028a('0x7')]('preproduction')['toString'](_0x028a('0x8'));}}},'production':{'type':Sequelize[_0x028a('0x4')]('long'),'get':function(){if(this[_0x028a('0x7')]('production')){return this[_0x028a('0x7')](_0x028a('0x9'))[_0x028a('0xa')](_0x028a('0x8'));}}},'savedAt':{'type':Sequelize[_0x028a('0xb')]},'publishedAt':{'type':Sequelize[_0x028a('0xb')]}}; \ No newline at end of file +var _0x3a6d=['name','STRING','TEXT','BLOB','long','preproduction','getDataValue','toString','utf8','production','DATE','sequelize','exports'];(function(_0x2283dc,_0x2fcfc5){var _0x16db90=function(_0x376c35){while(--_0x376c35){_0x2283dc['push'](_0x2283dc['shift']());}};_0x16db90(++_0x2fcfc5);}(_0x3a6d,0x143));var _0xd3a6=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x3a6d[_0x209941];return _0x1e8729;};'use strict';var Sequelize=require(_0xd3a6('0x0'));module[_0xd3a6('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xd3a6('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xd3a6('0x3')]},'notes':{'type':Sequelize[_0xd3a6('0x4')]},'preproduction':{'type':Sequelize[_0xd3a6('0x5')](_0xd3a6('0x6')),'get':function(){if(this['getDataValue'](_0xd3a6('0x7'))){return this[_0xd3a6('0x8')](_0xd3a6('0x7'))[_0xd3a6('0x9')](_0xd3a6('0xa'));}}},'production':{'type':Sequelize[_0xd3a6('0x5')]('long'),'get':function(){if(this[_0xd3a6('0x8')](_0xd3a6('0xb'))){return this[_0xd3a6('0x8')](_0xd3a6('0xb'))[_0xd3a6('0x9')](_0xd3a6('0xa'));}}},'savedAt':{'type':Sequelize[_0xd3a6('0xc')]},'publishedAt':{'type':Sequelize[_0xd3a6('0xc')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 5479f3b..364c25b 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 _0xbc17=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','destroy','then','SquareProjects','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','SquareProject','includeAll','rows','catch','params','keys','include','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','ids','omit','removeUsers','length','emit','userSquareProject:remove','getUsers','findOne','User','eml-format'];(function(_0x31c451,_0x266a84){var _0x2fe415=function(_0x5d3fde){while(--_0x5d3fde){_0x31c451['push'](_0x31c451['shift']());}};_0x2fe415(++_0x266a84);}(_0xbc17,0x122));var _0x7bc1=function(_0x3f0d76,_0x378fed){_0x3f0d76=_0x3f0d76-0x0;var _0x12c12e=_0xbc17[_0x3f0d76];return _0x12c12e;};'use strict';var emlformat=require(_0x7bc1('0x0'));var rimraf=require(_0x7bc1('0x1'));var zipdir=require(_0x7bc1('0x2'));var jsonpatch=require(_0x7bc1('0x3'));var rp=require(_0x7bc1('0x4'));var moment=require(_0x7bc1('0x5'));var BPromise=require(_0x7bc1('0x6'));var Mustache=require(_0x7bc1('0x7'));var util=require(_0x7bc1('0x8'));var path=require(_0x7bc1('0x9'));var sox=require(_0x7bc1('0xa'));var csv=require('to-csv');var ejs=require(_0x7bc1('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7bc1('0xc'));var squel=require('squel');var crypto=require(_0x7bc1('0xd'));var jsforce=require(_0x7bc1('0xe'));var deskjs=require(_0x7bc1('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7bc1('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7bc1('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7bc1('0x12'));var hardwareService=require(_0x7bc1('0x13'));var logger=require(_0x7bc1('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x7bc1('0x15'));var licenseUtil=require(_0x7bc1('0x16'));var db=require(_0x7bc1('0x17'))['db'];config[_0x7bc1('0x18')]=_[_0x7bc1('0x19')](config[_0x7bc1('0x18')],{'host':_0x7bc1('0x1a'),'port':0x18eb});var socket=require(_0x7bc1('0x1b'))(new Redis(config[_0x7bc1('0x18')]));require(_0x7bc1('0x1c'))['register'](socket);function respondWithStatusCode(_0x31dbb0,_0x4cc8bb){_0x4cc8bb=_0x4cc8bb||0xcc;return function(_0x5ded01){if(_0x5ded01){return _0x31dbb0[_0x7bc1('0x1d')](_0x4cc8bb);}return _0x31dbb0[_0x7bc1('0x1e')](_0x4cc8bb)[_0x7bc1('0x1f')]();};}function respondWithResult(_0xe8f0b2,_0x2a33a0){_0x2a33a0=_0x2a33a0||0xc8;return function(_0xfa1307){if(_0xfa1307){return _0xe8f0b2[_0x7bc1('0x1e')](_0x2a33a0)[_0x7bc1('0x20')](_0xfa1307);}};}function respondWithFilteredResult(_0x1badd3,_0x43616b){return function(_0x1f4ea9){if(_0x1f4ea9){var _0x590586=typeof _0x43616b['offset']===_0x7bc1('0x21')&&typeof _0x43616b[_0x7bc1('0x22')]===_0x7bc1('0x21');var _0x56dda1=_0x1f4ea9[_0x7bc1('0x23')];var _0x44f96b=_0x590586?0x0:_0x43616b[_0x7bc1('0x24')];var _0x4423cd=_0x590586?_0x1f4ea9['count']:_0x43616b[_0x7bc1('0x24')]+_0x43616b['limit'];var _0x507c6b;if(_0x4423cd>=_0x56dda1){_0x4423cd=_0x56dda1;_0x507c6b=0xc8;}else{_0x507c6b=0xce;}_0x1badd3['status'](_0x507c6b);return _0x1badd3['set'](_0x7bc1('0x25'),_0x44f96b+'-'+_0x4423cd+'/'+_0x56dda1)[_0x7bc1('0x20')](_0x1f4ea9);}return null;};}function patchUpdates(_0x1c11c4){return function(_0x186119){try{jsonpatch[_0x7bc1('0x26')](_0x186119,_0x1c11c4,!![]);}catch(_0x34b1b4){return BPromise[_0x7bc1('0x27')](_0x34b1b4);}return _0x186119[_0x7bc1('0x28')]();};}function saveUpdates(_0xd2a66b,_0x17f69a){return function(_0x42d856){if(_0x42d856){return _0x42d856[_0x7bc1('0x29')](_0xd2a66b)['then'](function(_0x2c150c){return _0x2c150c;});}return null;};}function removeEntity(_0x1a7a86,_0x148aa8){return function(_0x46f060){if(_0x46f060){return _0x46f060[_0x7bc1('0x2a')]()[_0x7bc1('0x2b')](function(){var _0x27643f=_0x46f060['get']({'plain':!![]});var _0xa1b822=_0x7bc1('0x2c');return db[_0x7bc1('0x2d')]['destroy']({'where':{'type':_0xa1b822,'resourceId':_0x27643f['id']}})[_0x7bc1('0x2b')](function(){return _0x46f060;});})[_0x7bc1('0x2b')](function(){_0x1a7a86['status'](0xcc)[_0x7bc1('0x1f')]();});}};}function handleEntityNotFound(_0x20948a,_0x54bd1a){return function(_0x1ff457){if(!_0x1ff457){_0x20948a[_0x7bc1('0x1d')](0x194);}return _0x1ff457;};}function handleError(_0x504134,_0x25c6bc){_0x25c6bc=_0x25c6bc||0x1f4;return function(_0x5263aa){logger[_0x7bc1('0x2e')](_0x5263aa[_0x7bc1('0x2f')]);if(_0x5263aa['name']){delete _0x5263aa[_0x7bc1('0x30')];}_0x504134['status'](_0x25c6bc)[_0x7bc1('0x31')](_0x5263aa);};}exports[_0x7bc1('0x32')]=function(_0x1907ca,_0x3b00be){var _0x21e1d2={},_0x31c8f1={},_0x24942f={'count':0x0,'rows':[]};var _0xd99367=_[_0x7bc1('0x33')](db['SquareProject'][_0x7bc1('0x34')],function(_0x2ddb70){return{'name':_0x2ddb70[_0x7bc1('0x35')],'type':_0x2ddb70['type'][_0x7bc1('0x36')]};});_0x31c8f1[_0x7bc1('0x37')]=_[_0x7bc1('0x33')](_0xd99367,'name');_0x31c8f1[_0x7bc1('0x38')]=_['keys'](_0x1907ca[_0x7bc1('0x38')]);_0x31c8f1['filters']=_[_0x7bc1('0x39')](_0x31c8f1[_0x7bc1('0x37')],_0x31c8f1['query']);_0x21e1d2[_0x7bc1('0x3a')]=_['intersection'](_0x31c8f1['model'],qs[_0x7bc1('0x3b')](_0x1907ca['query'][_0x7bc1('0x3b')]));_0x21e1d2[_0x7bc1('0x3a')]=_0x21e1d2['attributes']['length']?_0x21e1d2[_0x7bc1('0x3a')]:_0x31c8f1[_0x7bc1('0x37')];if(!_0x1907ca[_0x7bc1('0x38')][_0x7bc1('0x3c')](_0x7bc1('0x3d'))){_0x21e1d2[_0x7bc1('0x22')]=qs[_0x7bc1('0x22')](_0x1907ca[_0x7bc1('0x38')][_0x7bc1('0x22')]);_0x21e1d2['offset']=qs['offset'](_0x1907ca[_0x7bc1('0x38')]['offset']);}_0x21e1d2[_0x7bc1('0x3e')]=qs[_0x7bc1('0x3f')](_0x1907ca[_0x7bc1('0x38')]['sort']);_0x21e1d2[_0x7bc1('0x40')]=qs[_0x7bc1('0x41')](_[_0x7bc1('0x42')](_0x1907ca[_0x7bc1('0x38')],_0x31c8f1[_0x7bc1('0x41')]),_0xd99367);if(_0x1907ca[_0x7bc1('0x38')][_0x7bc1('0x43')]){_0x21e1d2[_0x7bc1('0x40')]=_[_0x7bc1('0x44')](_0x21e1d2[_0x7bc1('0x40')],{'$or':_[_0x7bc1('0x33')](_0xd99367,function(_0x341265){if(_0x341265[_0x7bc1('0x45')]!==_0x7bc1('0x46')){var _0x563e56={};_0x563e56[_0x341265[_0x7bc1('0x30')]]={'$like':'%'+_0x1907ca[_0x7bc1('0x38')]['filter']+'%'};return _0x563e56;}})});}_0x21e1d2=_[_0x7bc1('0x44')]({},_0x21e1d2,_0x1907ca[_0x7bc1('0x47')]);var _0x105cb3={'where':_0x21e1d2[_0x7bc1('0x40')]};return db[_0x7bc1('0x48')][_0x7bc1('0x23')](_0x105cb3)[_0x7bc1('0x2b')](function(_0x9e25e0){_0x24942f['count']=_0x9e25e0;if(_0x1907ca[_0x7bc1('0x38')][_0x7bc1('0x49')]){_0x21e1d2['include']=[{'all':!![]}];}return db[_0x7bc1('0x48')]['findAll'](_0x21e1d2);})['then'](function(_0x28ab12){_0x24942f[_0x7bc1('0x4a')]=_0x28ab12;return _0x24942f;})[_0x7bc1('0x2b')](respondWithFilteredResult(_0x3b00be,_0x21e1d2))[_0x7bc1('0x4b')](handleError(_0x3b00be,null));};exports['show']=function(_0x298e86,_0x5633de){var _0x2b3634={'raw':![],'where':{'id':_0x298e86[_0x7bc1('0x4c')]['id']}},_0x18b6a0={};_0x18b6a0[_0x7bc1('0x37')]=_[_0x7bc1('0x4d')](db[_0x7bc1('0x48')][_0x7bc1('0x34')]);_0x18b6a0['query']=_['keys'](_0x298e86['query']);_0x18b6a0[_0x7bc1('0x41')]=_['intersection'](_0x18b6a0[_0x7bc1('0x37')],_0x18b6a0[_0x7bc1('0x38')]);_0x2b3634['attributes']=_[_0x7bc1('0x39')](_0x18b6a0[_0x7bc1('0x37')],qs[_0x7bc1('0x3b')](_0x298e86[_0x7bc1('0x38')][_0x7bc1('0x3b')]));_0x2b3634[_0x7bc1('0x3a')]=_0x2b3634[_0x7bc1('0x3a')]['length']?_0x2b3634[_0x7bc1('0x3a')]:_0x18b6a0[_0x7bc1('0x37')];if(_0x298e86['query'][_0x7bc1('0x49')]){_0x2b3634[_0x7bc1('0x4e')]=[{'all':!![]}];}_0x2b3634=_[_0x7bc1('0x44')]({},_0x2b3634,_0x298e86[_0x7bc1('0x47')]);return db[_0x7bc1('0x48')]['find'](_0x2b3634)['then'](handleEntityNotFound(_0x5633de,null))[_0x7bc1('0x2b')](respondWithResult(_0x5633de,null))[_0x7bc1('0x4b')](handleError(_0x5633de,null));};exports[_0x7bc1('0x4f')]=function(_0xfc2db6,_0x23d071){return db[_0x7bc1('0x48')]['create'](_0xfc2db6[_0x7bc1('0x50')],{})['then'](function(_0x36483a){var _0x415137=_0xfc2db6[_0x7bc1('0x51')][_0x7bc1('0x52')]({'plain':!![]});if(!_0x415137)throw new Error(_0x7bc1('0x53'));if(_0x415137[_0x7bc1('0x54')]===_0x7bc1('0x51')){var _0x4ff0bf=_0x36483a[_0x7bc1('0x52')]({'plain':!![]});var _0x3d6ed9='SquareProjects';return db[_0x7bc1('0x55')][_0x7bc1('0x56')]({'where':{'name':_0x3d6ed9,'userProfileId':_0x415137['userProfileId']},'raw':!![]})[_0x7bc1('0x2b')](function(_0x58ef8b){if(_0x58ef8b&&_0x58ef8b[_0x7bc1('0x57')]===0x0){return db[_0x7bc1('0x2d')][_0x7bc1('0x4f')]({'name':_0x4ff0bf[_0x7bc1('0x30')],'resourceId':_0x4ff0bf['id'],'type':_0x58ef8b['name'],'sectionId':_0x58ef8b['id']},{})[_0x7bc1('0x2b')](function(){return _0x36483a;});}else{return _0x36483a;}})[_0x7bc1('0x4b')](function(_0x5aca4e){logger[_0x7bc1('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5aca4e);throw _0x5aca4e;});}return _0x36483a;})[_0x7bc1('0x2b')](respondWithResult(_0x23d071,0xc9))[_0x7bc1('0x4b')](handleError(_0x23d071,null));};exports[_0x7bc1('0x29')]=function(_0x5abedf,_0x3fc3bf){if(_0x5abedf[_0x7bc1('0x50')]['id']){delete _0x5abedf[_0x7bc1('0x50')]['id'];}return db[_0x7bc1('0x48')][_0x7bc1('0x56')]({'where':{'id':_0x5abedf['params']['id']}})['then'](handleEntityNotFound(_0x3fc3bf,null))[_0x7bc1('0x2b')](saveUpdates(_0x5abedf[_0x7bc1('0x50')],null))[_0x7bc1('0x2b')](respondWithResult(_0x3fc3bf,null))[_0x7bc1('0x4b')](handleError(_0x3fc3bf,null));};exports[_0x7bc1('0x2a')]=function(_0x35fddb,_0x4c0c15){return db[_0x7bc1('0x48')]['find']({'where':{'id':_0x35fddb[_0x7bc1('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4c0c15,null))[_0x7bc1('0x2b')](removeEntity(_0x4c0c15,null))[_0x7bc1('0x4b')](handleError(_0x4c0c15,null));};exports['addUsers']=function(_0x157a4e,_0x3f828f,_0x54cced){return db['SquareProject']['find']({'where':{'id':_0x157a4e[_0x7bc1('0x4c')]['id']}})[_0x7bc1('0x2b')](handleEntityNotFound(_0x3f828f,null))[_0x7bc1('0x2b')](function(_0x3e7f6f){if(_0x3e7f6f){return _0x3e7f6f['addUsers'](_0x157a4e['body'][_0x7bc1('0x58')],_[_0x7bc1('0x59')](_0x157a4e['body'],[_0x7bc1('0x58'),'id'])||{});}})[_0x7bc1('0x2b')](respondWithResult(_0x3f828f,null))[_0x7bc1('0x4b')](handleError(_0x3f828f,null));};exports['removeUsers']=function(_0x447a03,_0x3eebfd,_0x19234d){return db[_0x7bc1('0x48')]['find']({'where':{'id':_0x447a03[_0x7bc1('0x4c')]['id']}})[_0x7bc1('0x2b')](handleEntityNotFound(_0x3eebfd,null))[_0x7bc1('0x2b')](function(_0x57057e){if(_0x57057e){return _0x57057e[_0x7bc1('0x5a')](_0x447a03['query'][_0x7bc1('0x58')])[_0x7bc1('0x2b')](function(){if(_['isArray'](_0x447a03['query'][_0x7bc1('0x58')])){for(var _0x3a0be0=0x0;_0x3a0be0<_0x447a03[_0x7bc1('0x38')][_0x7bc1('0x58')][_0x7bc1('0x5b')];_0x3a0be0+=0x1){socket[_0x7bc1('0x5c')](_0x7bc1('0x5d'),{'UserId':Number(_0x447a03[_0x7bc1('0x38')][_0x7bc1('0x58')][_0x3a0be0]),'SquareProjectId':Number(_0x447a03['params']['id'])});}}else{socket[_0x7bc1('0x5c')]('userSquareProject:remove',{'UserId':Number(_0x447a03[_0x7bc1('0x38')][_0x7bc1('0x58')]),'SquareProjectId':Number(_0x447a03[_0x7bc1('0x4c')]['id'])});}});}})[_0x7bc1('0x2b')](respondWithStatusCode(_0x3eebfd,null))[_0x7bc1('0x4b')](handleError(_0x3eebfd,null));};exports[_0x7bc1('0x5e')]=function(_0x377152,_0x56374b,_0x56c392){var _0x462d91={};var _0x3b9319={};var _0x576268;var _0x2291aa;return db[_0x7bc1('0x48')][_0x7bc1('0x5f')]({'where':{'id':_0x377152[_0x7bc1('0x4c')]['id']}})['then'](handleEntityNotFound(_0x56374b,null))[_0x7bc1('0x2b')](function(_0x55dd43){if(_0x55dd43){_0x576268=_0x55dd43;_0x3b9319[_0x7bc1('0x37')]=_[_0x7bc1('0x4d')](db[_0x7bc1('0x60')]['rawAttributes']);_0x3b9319['query']=_[_0x7bc1('0x4d')](_0x377152[_0x7bc1('0x38')]);_0x3b9319[_0x7bc1('0x41')]=_['intersection'](_0x3b9319[_0x7bc1('0x37')],_0x3b9319[_0x7bc1('0x38')]);_0x462d91[_0x7bc1('0x3a')]=_['intersection'](_0x3b9319[_0x7bc1('0x37')],qs['fields'](_0x377152['query'][_0x7bc1('0x3b')]));_0x462d91[_0x7bc1('0x3a')]=_0x462d91[_0x7bc1('0x3a')]['length']?_0x462d91[_0x7bc1('0x3a')]:_0x3b9319['model'];_0x462d91[_0x7bc1('0x3e')]=qs['sort'](_0x377152[_0x7bc1('0x38')][_0x7bc1('0x3f')]);_0x462d91[_0x7bc1('0x40')]=qs[_0x7bc1('0x41')](_[_0x7bc1('0x42')](_0x377152[_0x7bc1('0x38')],_0x3b9319[_0x7bc1('0x41')]));if(_0x377152[_0x7bc1('0x38')]['filter']){_0x462d91['where']=_[_0x7bc1('0x44')](_0x462d91[_0x7bc1('0x40')],{'$or':_[_0x7bc1('0x33')](_0x462d91[_0x7bc1('0x3a')],function(_0xa60bfa){var _0x57615e={};_0x57615e[_0xa60bfa]={'$like':'%'+_0x377152[_0x7bc1('0x38')]['filter']+'%'};return _0x57615e;})});}_0x462d91=_[_0x7bc1('0x44')]({},_0x462d91,_0x377152['options']);return _0x576268[_0x7bc1('0x5e')](_0x462d91);}})[_0x7bc1('0x2b')](function(_0x674854){if(_0x674854){_0x2291aa=_0x674854[_0x7bc1('0x5b')];if(!_0x377152[_0x7bc1('0x38')][_0x7bc1('0x3c')](_0x7bc1('0x3d'))){_0x462d91[_0x7bc1('0x22')]=qs[_0x7bc1('0x22')](_0x377152[_0x7bc1('0x38')][_0x7bc1('0x22')]);_0x462d91['offset']=qs[_0x7bc1('0x24')](_0x377152['query']['offset']);}return _0x576268[_0x7bc1('0x5e')](_0x462d91);}})['then'](function(_0x125df5){if(_0x125df5){return _0x125df5?{'count':_0x2291aa,'rows':_0x125df5}:null;}})['then'](respondWithResult(_0x56374b,null))['catch'](handleError(_0x56374b,null));}; \ No newline at end of file +var _0x44a7=['socket.io-emitter','sendStatus','end','status','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','get','SquareProjects','UserProfileResource','error','name','send','index','map','SquareProject','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','include','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addUsers','params','ids','omit','removeUsers','isArray','userSquareProject:remove','emit','User','order','getUsers','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','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'];(function(_0x2f6e3d,_0x4b97fe){var _0x231c17=function(_0x29c2eb){while(--_0x29c2eb){_0x2f6e3d['push'](_0x2f6e3d['shift']());}};_0x231c17(++_0x4b97fe);}(_0x44a7,0x1cf));var _0x744a=function(_0x403c8d,_0x5e3825){_0x403c8d=_0x403c8d-0x0;var _0x4ca60d=_0x44a7[_0x403c8d];return _0x4ca60d;};'use strict';var emlformat=require(_0x744a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x744a('0x1'));var jsonpatch=require(_0x744a('0x2'));var rp=require(_0x744a('0x3'));var moment=require(_0x744a('0x4'));var BPromise=require(_0x744a('0x5'));var Mustache=require('mustache');var util=require(_0x744a('0x6'));var path=require(_0x744a('0x7'));var sox=require('sox');var csv=require(_0x744a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x744a('0x9'));var squel=require(_0x744a('0xa'));var crypto=require('crypto');var jsforce=require(_0x744a('0xb'));var deskjs=require(_0x744a('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x744a('0xd'));var Redis=require(_0x744a('0xe'));var authService=require(_0x744a('0xf'));var qs=require(_0x744a('0x10'));var as=require(_0x744a('0x11'));var hardwareService=require(_0x744a('0x12'));var logger=require(_0x744a('0x13'))(_0x744a('0x14'));var utils=require('../../config/utils');var config=require(_0x744a('0x15'));var licenseUtil=require(_0x744a('0x16'));var db=require(_0x744a('0x17'))['db'];config[_0x744a('0x18')]=_[_0x744a('0x19')](config[_0x744a('0x18')],{'host':_0x744a('0x1a'),'port':0x18eb});var socket=require(_0x744a('0x1b'))(new Redis(config['redis']));require('./squareProject.socket')['register'](socket);function respondWithStatusCode(_0x3f43aa,_0x6d8c40){_0x6d8c40=_0x6d8c40||0xcc;return function(_0x449060){if(_0x449060){return _0x3f43aa[_0x744a('0x1c')](_0x6d8c40);}return _0x3f43aa['status'](_0x6d8c40)[_0x744a('0x1d')]();};}function respondWithResult(_0x35c2b6,_0x1f5823){_0x1f5823=_0x1f5823||0xc8;return function(_0x5ca706){if(_0x5ca706){return _0x35c2b6[_0x744a('0x1e')](_0x1f5823)[_0x744a('0x1f')](_0x5ca706);}};}function respondWithFilteredResult(_0x456744,_0xc90fbb){return function(_0x4396e2){if(_0x4396e2){var _0x48bb6f=typeof _0xc90fbb[_0x744a('0x20')]==='undefined'&&typeof _0xc90fbb[_0x744a('0x21')]===_0x744a('0x22');var _0x40674c=_0x4396e2[_0x744a('0x23')];var _0x5195fc=_0x48bb6f?0x0:_0xc90fbb[_0x744a('0x20')];var _0x4927b3=_0x48bb6f?_0x4396e2['count']:_0xc90fbb[_0x744a('0x20')]+_0xc90fbb[_0x744a('0x21')];var _0x595e7d;if(_0x4927b3>=_0x40674c){_0x4927b3=_0x40674c;_0x595e7d=0xc8;}else{_0x595e7d=0xce;}_0x456744[_0x744a('0x1e')](_0x595e7d);return _0x456744[_0x744a('0x24')]('Content-Range',_0x5195fc+'-'+_0x4927b3+'/'+_0x40674c)[_0x744a('0x1f')](_0x4396e2);}return null;};}function patchUpdates(_0x164429){return function(_0x1c2ccf){try{jsonpatch[_0x744a('0x25')](_0x1c2ccf,_0x164429,!![]);}catch(_0x526c38){return BPromise[_0x744a('0x26')](_0x526c38);}return _0x1c2ccf[_0x744a('0x27')]();};}function saveUpdates(_0x527f02,_0x2bafbf){return function(_0x39ba57){if(_0x39ba57){return _0x39ba57[_0x744a('0x28')](_0x527f02)[_0x744a('0x29')](function(_0x52c27a){return _0x52c27a;});}return null;};}function removeEntity(_0x33fecf,_0x93c510){return function(_0x545506){if(_0x545506){return _0x545506[_0x744a('0x2a')]()['then'](function(){var _0x8f15c8=_0x545506[_0x744a('0x2b')]({'plain':!![]});var _0x556a9f=_0x744a('0x2c');return db[_0x744a('0x2d')][_0x744a('0x2a')]({'where':{'type':_0x556a9f,'resourceId':_0x8f15c8['id']}})[_0x744a('0x29')](function(){return _0x545506;});})['then'](function(){_0x33fecf[_0x744a('0x1e')](0xcc)[_0x744a('0x1d')]();});}};}function handleEntityNotFound(_0x454bc2,_0x1609fb){return function(_0x97de9a){if(!_0x97de9a){_0x454bc2[_0x744a('0x1c')](0x194);}return _0x97de9a;};}function handleError(_0x44d300,_0xeb056f){_0xeb056f=_0xeb056f||0x1f4;return function(_0x565629){logger[_0x744a('0x2e')](_0x565629['stack']);if(_0x565629[_0x744a('0x2f')]){delete _0x565629['name'];}_0x44d300['status'](_0xeb056f)[_0x744a('0x30')](_0x565629);};}exports[_0x744a('0x31')]=function(_0x37fa41,_0x2e8d05){var _0x541a93={},_0x4185a6={},_0x193303={'count':0x0,'rows':[]};var _0x226c2a=_[_0x744a('0x32')](db[_0x744a('0x33')][_0x744a('0x34')],function(_0x3f7b9a){return{'name':_0x3f7b9a['fieldName'],'type':_0x3f7b9a[_0x744a('0x35')][_0x744a('0x36')]};});_0x4185a6[_0x744a('0x37')]=_[_0x744a('0x32')](_0x226c2a,_0x744a('0x2f'));_0x4185a6[_0x744a('0x38')]=_[_0x744a('0x39')](_0x37fa41[_0x744a('0x38')]);_0x4185a6[_0x744a('0x3a')]=_[_0x744a('0x3b')](_0x4185a6['model'],_0x4185a6[_0x744a('0x38')]);_0x541a93[_0x744a('0x3c')]=_[_0x744a('0x3b')](_0x4185a6[_0x744a('0x37')],qs['fields'](_0x37fa41[_0x744a('0x38')][_0x744a('0x3d')]));_0x541a93[_0x744a('0x3c')]=_0x541a93['attributes'][_0x744a('0x3e')]?_0x541a93['attributes']:_0x4185a6['model'];if(!_0x37fa41['query'][_0x744a('0x3f')](_0x744a('0x40'))){_0x541a93[_0x744a('0x21')]=qs[_0x744a('0x21')](_0x37fa41[_0x744a('0x38')]['limit']);_0x541a93[_0x744a('0x20')]=qs['offset'](_0x37fa41[_0x744a('0x38')][_0x744a('0x20')]);}_0x541a93['order']=qs[_0x744a('0x41')](_0x37fa41[_0x744a('0x38')]['sort']);_0x541a93[_0x744a('0x42')]=qs[_0x744a('0x3a')](_[_0x744a('0x43')](_0x37fa41[_0x744a('0x38')],_0x4185a6[_0x744a('0x3a')]),_0x226c2a);if(_0x37fa41['query'][_0x744a('0x44')]){_0x541a93[_0x744a('0x42')]=_[_0x744a('0x45')](_0x541a93[_0x744a('0x42')],{'$or':_[_0x744a('0x32')](_0x226c2a,function(_0x425ace){if(_0x425ace[_0x744a('0x35')]!==_0x744a('0x46')){var _0x196062={};_0x196062[_0x425ace[_0x744a('0x2f')]]={'$like':'%'+_0x37fa41[_0x744a('0x38')][_0x744a('0x44')]+'%'};return _0x196062;}})});}_0x541a93=_['merge']({},_0x541a93,_0x37fa41[_0x744a('0x47')]);var _0x4ccd3d={'where':_0x541a93[_0x744a('0x42')]};return db['SquareProject'][_0x744a('0x23')](_0x4ccd3d)[_0x744a('0x29')](function(_0xffb98b){_0x193303[_0x744a('0x23')]=_0xffb98b;if(_0x37fa41[_0x744a('0x38')][_0x744a('0x48')]){_0x541a93['include']=[{'all':!![]}];}return db[_0x744a('0x33')][_0x744a('0x49')](_0x541a93);})[_0x744a('0x29')](function(_0x5d9404){_0x193303[_0x744a('0x4a')]=_0x5d9404;return _0x193303;})[_0x744a('0x29')](respondWithFilteredResult(_0x2e8d05,_0x541a93))[_0x744a('0x4b')](handleError(_0x2e8d05,null));};exports[_0x744a('0x4c')]=function(_0x30ea5e,_0x4e72f1){var _0xba993={'raw':![],'where':{'id':_0x30ea5e['params']['id']}},_0x274005={};_0x274005[_0x744a('0x37')]=_['keys'](db[_0x744a('0x33')][_0x744a('0x34')]);_0x274005[_0x744a('0x38')]=_[_0x744a('0x39')](_0x30ea5e['query']);_0x274005['filters']=_[_0x744a('0x3b')](_0x274005[_0x744a('0x37')],_0x274005['query']);_0xba993[_0x744a('0x3c')]=_[_0x744a('0x3b')](_0x274005['model'],qs['fields'](_0x30ea5e[_0x744a('0x38')]['fields']));_0xba993[_0x744a('0x3c')]=_0xba993[_0x744a('0x3c')][_0x744a('0x3e')]?_0xba993[_0x744a('0x3c')]:_0x274005[_0x744a('0x37')];if(_0x30ea5e[_0x744a('0x38')][_0x744a('0x48')]){_0xba993[_0x744a('0x4d')]=[{'all':!![]}];}_0xba993=_['merge']({},_0xba993,_0x30ea5e[_0x744a('0x47')]);return db[_0x744a('0x33')][_0x744a('0x4e')](_0xba993)[_0x744a('0x29')](handleEntityNotFound(_0x4e72f1,null))['then'](respondWithResult(_0x4e72f1,null))[_0x744a('0x4b')](handleError(_0x4e72f1,null));};exports[_0x744a('0x4f')]=function(_0x52eedb,_0x150ce2){return db['SquareProject']['create'](_0x52eedb[_0x744a('0x50')],{})['then'](function(_0x352bab){var _0x554087=_0x52eedb[_0x744a('0x51')][_0x744a('0x2b')]({'plain':!![]});if(!_0x554087)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x554087[_0x744a('0x52')]==='user'){var _0x2b95a0=_0x352bab[_0x744a('0x2b')]({'plain':!![]});var _0x48a676=_0x744a('0x2c');return db[_0x744a('0x53')][_0x744a('0x4e')]({'where':{'name':_0x48a676,'userProfileId':_0x554087[_0x744a('0x54')]},'raw':!![]})[_0x744a('0x29')](function(_0x1f072b){if(_0x1f072b&&_0x1f072b[_0x744a('0x55')]===0x0){return db['UserProfileResource'][_0x744a('0x4f')]({'name':_0x2b95a0[_0x744a('0x2f')],'resourceId':_0x2b95a0['id'],'type':_0x1f072b['name'],'sectionId':_0x1f072b['id']},{})[_0x744a('0x29')](function(){return _0x352bab;});}else{return _0x352bab;}})[_0x744a('0x4b')](function(_0x46410c){logger[_0x744a('0x2e')](_0x744a('0x56'),_0x46410c);throw _0x46410c;});}return _0x352bab;})[_0x744a('0x29')](respondWithResult(_0x150ce2,0xc9))[_0x744a('0x4b')](handleError(_0x150ce2,null));};exports[_0x744a('0x28')]=function(_0x564df9,_0x270c13){if(_0x564df9['body']['id']){delete _0x564df9[_0x744a('0x50')]['id'];}return db[_0x744a('0x33')]['find']({'where':{'id':_0x564df9['params']['id']}})[_0x744a('0x29')](handleEntityNotFound(_0x270c13,null))['then'](saveUpdates(_0x564df9[_0x744a('0x50')],null))[_0x744a('0x29')](respondWithResult(_0x270c13,null))[_0x744a('0x4b')](handleError(_0x270c13,null));};exports[_0x744a('0x2a')]=function(_0xc0394a,_0x2f5902){return db['SquareProject'][_0x744a('0x4e')]({'where':{'id':_0xc0394a['params']['id']}})[_0x744a('0x29')](handleEntityNotFound(_0x2f5902,null))['then'](removeEntity(_0x2f5902,null))[_0x744a('0x4b')](handleError(_0x2f5902,null));};exports[_0x744a('0x57')]=function(_0x468053,_0x2aa518,_0x156c8d){return db['SquareProject'][_0x744a('0x4e')]({'where':{'id':_0x468053[_0x744a('0x58')]['id']}})['then'](handleEntityNotFound(_0x2aa518,null))[_0x744a('0x29')](function(_0x687477){if(_0x687477){return _0x687477[_0x744a('0x57')](_0x468053['body'][_0x744a('0x59')],_[_0x744a('0x5a')](_0x468053[_0x744a('0x50')],[_0x744a('0x59'),'id'])||{});}})[_0x744a('0x29')](respondWithResult(_0x2aa518,null))[_0x744a('0x4b')](handleError(_0x2aa518,null));};exports[_0x744a('0x5b')]=function(_0x12b4b6,_0x24cf81,_0x1dc5e0){return db[_0x744a('0x33')]['find']({'where':{'id':_0x12b4b6[_0x744a('0x58')]['id']}})[_0x744a('0x29')](handleEntityNotFound(_0x24cf81,null))[_0x744a('0x29')](function(_0x28027f){if(_0x28027f){return _0x28027f['removeUsers'](_0x12b4b6[_0x744a('0x38')][_0x744a('0x59')])['then'](function(){if(_[_0x744a('0x5c')](_0x12b4b6[_0x744a('0x38')][_0x744a('0x59')])){for(var _0x565e06=0x0;_0x565e06<_0x12b4b6['query'][_0x744a('0x59')][_0x744a('0x3e')];_0x565e06+=0x1){socket['emit'](_0x744a('0x5d'),{'UserId':Number(_0x12b4b6['query'][_0x744a('0x59')][_0x565e06]),'SquareProjectId':Number(_0x12b4b6[_0x744a('0x58')]['id'])});}}else{socket[_0x744a('0x5e')](_0x744a('0x5d'),{'UserId':Number(_0x12b4b6['query'][_0x744a('0x59')]),'SquareProjectId':Number(_0x12b4b6['params']['id'])});}});}})[_0x744a('0x29')](respondWithStatusCode(_0x24cf81,null))[_0x744a('0x4b')](handleError(_0x24cf81,null));};exports['getUsers']=function(_0x1af982,_0x56ddd2,_0x1882e2){var _0x46fec4={};var _0x525a48={};var _0x59ad8a;var _0x4637f5;return db[_0x744a('0x33')]['findOne']({'where':{'id':_0x1af982['params']['id']}})[_0x744a('0x29')](handleEntityNotFound(_0x56ddd2,null))[_0x744a('0x29')](function(_0x3e7599){if(_0x3e7599){_0x59ad8a=_0x3e7599;_0x525a48['model']=_[_0x744a('0x39')](db[_0x744a('0x5f')][_0x744a('0x34')]);_0x525a48[_0x744a('0x38')]=_[_0x744a('0x39')](_0x1af982[_0x744a('0x38')]);_0x525a48[_0x744a('0x3a')]=_['intersection'](_0x525a48[_0x744a('0x37')],_0x525a48['query']);_0x46fec4[_0x744a('0x3c')]=_[_0x744a('0x3b')](_0x525a48['model'],qs[_0x744a('0x3d')](_0x1af982[_0x744a('0x38')][_0x744a('0x3d')]));_0x46fec4['attributes']=_0x46fec4['attributes'][_0x744a('0x3e')]?_0x46fec4[_0x744a('0x3c')]:_0x525a48['model'];_0x46fec4[_0x744a('0x60')]=qs[_0x744a('0x41')](_0x1af982['query'][_0x744a('0x41')]);_0x46fec4[_0x744a('0x42')]=qs[_0x744a('0x3a')](_[_0x744a('0x43')](_0x1af982[_0x744a('0x38')],_0x525a48[_0x744a('0x3a')]));if(_0x1af982[_0x744a('0x38')][_0x744a('0x44')]){_0x46fec4[_0x744a('0x42')]=_['merge'](_0x46fec4[_0x744a('0x42')],{'$or':_['map'](_0x46fec4[_0x744a('0x3c')],function(_0xbd7ce8){var _0x458856={};_0x458856[_0xbd7ce8]={'$like':'%'+_0x1af982[_0x744a('0x38')][_0x744a('0x44')]+'%'};return _0x458856;})});}_0x46fec4=_[_0x744a('0x45')]({},_0x46fec4,_0x1af982[_0x744a('0x47')]);return _0x59ad8a[_0x744a('0x61')](_0x46fec4);}})[_0x744a('0x29')](function(_0x47c774){if(_0x47c774){_0x4637f5=_0x47c774[_0x744a('0x3e')];if(!_0x1af982['query']['hasOwnProperty'](_0x744a('0x40'))){_0x46fec4['limit']=qs['limit'](_0x1af982['query'][_0x744a('0x21')]);_0x46fec4[_0x744a('0x20')]=qs['offset'](_0x1af982[_0x744a('0x38')]['offset']);}return _0x59ad8a[_0x744a('0x61')](_0x46fec4);}})['then'](function(_0x1f1957){if(_0x1f1957){return _0x1f1957?{'count':_0x4637f5,'rows':_0x1f1957}:null;}})[_0x744a('0x29')](respondWithResult(_0x56ddd2,null))[_0x744a('0x4b')](handleError(_0x56ddd2,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index a18e76a..b45809d 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 _0x205b=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','SquareProject','setMaxListeners','update'];(function(_0x46b1ce,_0x2f0c93){var _0x23524b=function(_0x38e2d8){while(--_0x38e2d8){_0x46b1ce['push'](_0x46b1ce['shift']());}};_0x23524b(++_0x2f0c93);}(_0x205b,0x82));var _0xb205=function(_0x29b17e,_0x45fac6){_0x29b17e=_0x29b17e-0x0;var _0x3452e9=_0x205b[_0x29b17e];return _0x3452e9;};'use strict';var EventEmitter=require(_0xb205('0x0'));var SquareProject=require(_0xb205('0x1'))['db'][_0xb205('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xb205('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb205('0x4'),'afterDestroy':'remove'};function emitEvent(_0x180b6c){return function(_0x25a07c,_0x334baa,_0x3fd73b){SquareProjectEvents['emit'](_0x180b6c+':'+_0x25a07c['id'],_0x25a07c);SquareProjectEvents[_0xb205('0x5')](_0x180b6c,_0x25a07c);_0x3fd73b(null);};}for(var e in events){if(events[_0xb205('0x6')](e)){var event=events[e];SquareProject[_0xb205('0x7')](e,emitEvent(event));}}module[_0xb205('0x8')]=SquareProjectEvents; \ No newline at end of file +var _0xf11d=['SquareProject','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0xf11d,0xd8));var _0xdf11=function(_0x1afe2d,_0x4c92b2){_0x1afe2d=_0x1afe2d-0x0;var _0x26aa61=_0xf11d[_0x1afe2d];return _0x26aa61;};'use strict';var EventEmitter=require('events');var SquareProject=require('../../mysqldb')['db'][_0xdf11('0x0')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xdf11('0x1')](0x0);var events={'afterCreate':_0xdf11('0x2'),'afterUpdate':_0xdf11('0x3'),'afterDestroy':_0xdf11('0x4')};function emitEvent(_0x1d44ed){return function(_0x410bd4,_0x210bef,_0x3f345a){SquareProjectEvents[_0xdf11('0x5')](_0x1d44ed+':'+_0x410bd4['id'],_0x410bd4);SquareProjectEvents['emit'](_0x1d44ed,_0x410bd4);_0x3f345a(null);};}for(var e in events){if(events[_0xdf11('0x6')](e)){var event=events[e];SquareProject[_0xdf11('0x7')](e,emitEvent(event));}}module[_0xdf11('0x8')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 179a77c..9971e5b 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 _0x3e05=['request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports','define','SquareProject','square_projects','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','publishedAt','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x38a9f7,_0x247c7a){var _0x1e6840=function(_0x32b4d1){while(--_0x32b4d1){_0x38a9f7['push'](_0x38a9f7['shift']());}};_0x1e6840(++_0x247c7a);}(_0x3e05,0x1b3));var _0x53e0=function(_0x2ce26c,_0xb2e54c){_0x2ce26c=_0x2ce26c-0x0;var _0x28155f=_0x3e05[_0x2ce26c];return _0x28155f;};'use strict';var _=require(_0x53e0('0x0'));var util=require(_0x53e0('0x1'));var logger=require(_0x53e0('0x2'))(_0x53e0('0x3'));var moment=require(_0x53e0('0x4'));var BPromise=require(_0x53e0('0x5'));var rp=require(_0x53e0('0x6'));var fs=require('fs');var path=require(_0x53e0('0x7'));var rimraf=require(_0x53e0('0x8'));var config=require(_0x53e0('0x9'));var attributes=require(_0x53e0('0xa'));module[_0x53e0('0xb')]=function(_0x535610,_0x106646){return _0x535610[_0x53e0('0xc')](_0x53e0('0xd'),attributes,{'tableName':_0x53e0('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x8d7e3e,_0x47d36c,_0x1b3d11){if(_0x8d7e3e[_0x53e0('0xf')](_0x53e0('0x10'))){_0x8d7e3e[_0x53e0('0x11')]=moment()[_0x53e0('0x12')](_0x53e0('0x13'));}if(_0x8d7e3e[_0x53e0('0xf')]('production')){_0x8d7e3e[_0x53e0('0x14')]=moment()[_0x53e0('0x12')](_0x53e0('0x13'));}_0x1b3d11(null,_0x8d7e3e);}}});}; \ No newline at end of file +var _0xd2f7=['savedAt','YYYY-MM-DD\x20HH:mm:ss','production','format','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','exports','SquareProject','square_projects','preproduction'];(function(_0x3ea0bf,_0x328f0d){var _0x96c0a6=function(_0x2fe524){while(--_0x2fe524){_0x3ea0bf['push'](_0x3ea0bf['shift']());}};_0x96c0a6(++_0x328f0d);}(_0xd2f7,0x1b4));var _0x7d2f=function(_0x135a1c,_0x28b5f6){_0x135a1c=_0x135a1c-0x0;var _0x295c98=_0xd2f7[_0x135a1c];return _0x295c98;};'use strict';var _=require(_0x7d2f('0x0'));var util=require(_0x7d2f('0x1'));var logger=require(_0x7d2f('0x2'))(_0x7d2f('0x3'));var moment=require(_0x7d2f('0x4'));var BPromise=require(_0x7d2f('0x5'));var rp=require(_0x7d2f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7d2f('0x7'));var config=require('../../config/environment');var attributes=require('./squareProject.attributes');module[_0x7d2f('0x8')]=function(_0x318efa,_0x50902c){return _0x318efa['define'](_0x7d2f('0x9'),attributes,{'tableName':_0x7d2f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x680167,_0x3600bf,_0x196815){if(_0x680167['changed'](_0x7d2f('0xb'))){_0x680167[_0x7d2f('0xc')]=moment()['format'](_0x7d2f('0xd'));}if(_0x680167['changed'](_0x7d2f('0xe'))){_0x680167['publishedAt']=moment()[_0x7d2f('0xf')](_0x7d2f('0xd'));}_0x196815(null,_0x680167);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index c3cef3e..6d1a6e1 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 _0x3728=['code','message','catch','ShowSquareProject','options','raw','where','attributes','include','map','model','then','debug','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','info','SquareProject,\x20%s,\x20%s','request\x20sent','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x3728,0x125));var _0x8372=function(_0x55737d,_0x51e0d9){_0x55737d=_0x55737d-0x0;var _0x103b90=_0x3728[_0x55737d];return _0x103b90;};'use strict';var _=require('lodash');var util=require(_0x8372('0x0'));var moment=require('moment');var BPromise=require(_0x8372('0x1'));var rs=require(_0x8372('0x2'));var fs=require('fs');var Redis=require(_0x8372('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8372('0x4'));var logger=require(_0x8372('0x5'))('rpc');var config=require(_0x8372('0x6'));var jayson=require(_0x8372('0x7'));var client=jayson[_0x8372('0x8')][_0x8372('0x9')]({'port':0x232a});config[_0x8372('0xa')]=_[_0x8372('0xb')](config[_0x8372('0xa')],{'host':_0x8372('0xc'),'port':0x18eb});var socket=require(_0x8372('0xd'))(new Redis(config[_0x8372('0xa')]));require(_0x8372('0xe'))[_0x8372('0xf')](socket);function respondWithRpcPromise(_0x5cc26e,_0x1cbd43,_0x2cd0a1){return new BPromise(function(_0x1e71de,_0x10793e){return client['request'](_0x5cc26e,_0x2cd0a1)['then'](function(_0x5dd976){logger[_0x8372('0x10')](_0x8372('0x11'),_0x1cbd43,_0x8372('0x12'));logger['debug'](_0x8372('0x13'),_0x1cbd43,_0x8372('0x12'),JSON[_0x8372('0x14')](_0x5dd976));if(_0x5dd976[_0x8372('0x15')]){if(_0x5dd976[_0x8372('0x15')][_0x8372('0x16')]===0x1f4){logger['error'](_0x8372('0x11'),_0x1cbd43,_0x5dd976[_0x8372('0x15')][_0x8372('0x17')]);return _0x10793e(_0x5dd976[_0x8372('0x15')][_0x8372('0x17')]);}logger[_0x8372('0x15')]('SquareProject,\x20%s,\x20%s',_0x1cbd43,_0x5dd976['error']['message']);return _0x1e71de(_0x5dd976['error'][_0x8372('0x17')]);}else{logger[_0x8372('0x10')](_0x8372('0x11'),_0x1cbd43,_0x8372('0x12'));_0x1e71de(_0x5dd976['result'][_0x8372('0x17')]);}})[_0x8372('0x18')](function(_0x458d45){logger[_0x8372('0x15')](_0x8372('0x11'),_0x1cbd43,_0x458d45);_0x10793e(_0x458d45);});});}exports[_0x8372('0x19')]=function(_0x111aad){var _0x2b5724=this;return new Promise(function(_0x1fcc3d,_0xa8589e){return db['SquareProject']['find']({'raw':_0x111aad[_0x8372('0x1a')]?_0x111aad[_0x8372('0x1a')][_0x8372('0x1b')]===undefined?!![]:![]:!![],'where':_0x111aad[_0x8372('0x1a')]?_0x111aad[_0x8372('0x1a')][_0x8372('0x1c')]||null:null,'attributes':_0x111aad[_0x8372('0x1a')]?_0x111aad[_0x8372('0x1a')][_0x8372('0x1d')]||null:null,'include':_0x111aad[_0x8372('0x1a')]?_0x111aad[_0x8372('0x1a')][_0x8372('0x1e')]?_['map'](_0x111aad['options']['include'],function(_0x23167b){return{'model':db[_0x23167b['model']],'as':_0x23167b['as'],'attributes':_0x23167b[_0x8372('0x1d')],'include':_0x23167b[_0x8372('0x1e')]?_[_0x8372('0x1f')](_0x23167b['include'],function(_0x1b665d){return{'model':db[_0x1b665d[_0x8372('0x20')]],'as':_0x1b665d['as'],'attributes':_0x1b665d[_0x8372('0x1d')],'include':_0x1b665d[_0x8372('0x1e')]?_[_0x8372('0x1f')](_0x1b665d[_0x8372('0x1e')],function(_0x4c4943){return{'model':db[_0x4c4943[_0x8372('0x20')]],'as':_0x4c4943['as'],'attributes':_0x4c4943[_0x8372('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8372('0x21')](function(_0x7f3e){logger[_0x8372('0x10')]('ShowSquareProject',_0x111aad);logger[_0x8372('0x22')](_0x8372('0x19'),_0x111aad,JSON[_0x8372('0x14')](_0x7f3e));_0x1fcc3d(_0x7f3e);})[_0x8372('0x18')](function(_0x4300e6){logger[_0x8372('0x15')](_0x8372('0x19'),_0x4300e6[_0x8372('0x17')],_0x111aad);_0xa8589e(_0x2b5724[_0x8372('0x15')](0x1f4,_0x4300e6['message']));});});}; \ No newline at end of file +var _0x99fb=['register','request','SquareProject,\x20%s,\x20%s','SquareProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','ShowSquareProject','SquareProject','find','options','attributes','include','map','model','then','debug','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./squareProject.socket'];(function(_0x24a48a,_0x3843a5){var _0x2f9b60=function(_0x3b38ea){while(--_0x3b38ea){_0x24a48a['push'](_0x24a48a['shift']());}};_0x2f9b60(++_0x3843a5);}(_0x99fb,0x1d2));var _0xb99f=function(_0x31d0cc,_0x4a6890){_0x31d0cc=_0x31d0cc-0x0;var _0x1ed895=_0x99fb[_0x31d0cc];return _0x1ed895;};'use strict';var _=require('lodash');var util=require(_0xb99f('0x0'));var moment=require(_0xb99f('0x1'));var BPromise=require(_0xb99f('0x2'));var rs=require(_0xb99f('0x3'));var fs=require('fs');var Redis=require(_0xb99f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb99f('0x5'));var logger=require('../../config/logger')(_0xb99f('0x6'));var config=require(_0xb99f('0x7'));var jayson=require(_0xb99f('0x8'));var client=jayson[_0xb99f('0x9')][_0xb99f('0xa')]({'port':0x232a});config[_0xb99f('0xb')]=_[_0xb99f('0xc')](config[_0xb99f('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xb99f('0xd'))(new Redis(config[_0xb99f('0xb')]));require(_0xb99f('0xe'))[_0xb99f('0xf')](socket);function respondWithRpcPromise(_0x2739e0,_0x3ddc18,_0x26e016){return new BPromise(function(_0x8da54c,_0x13e695){return client[_0xb99f('0x10')](_0x2739e0,_0x26e016)['then'](function(_0x5dbfd5){logger['info'](_0xb99f('0x11'),_0x3ddc18,'request\x20sent');logger['debug'](_0xb99f('0x12'),_0x3ddc18,_0xb99f('0x13'),JSON[_0xb99f('0x14')](_0x5dbfd5));if(_0x5dbfd5['error']){if(_0x5dbfd5[_0xb99f('0x15')][_0xb99f('0x16')]===0x1f4){logger[_0xb99f('0x15')](_0xb99f('0x11'),_0x3ddc18,_0x5dbfd5[_0xb99f('0x15')]['message']);return _0x13e695(_0x5dbfd5[_0xb99f('0x15')][_0xb99f('0x17')]);}logger[_0xb99f('0x15')](_0xb99f('0x11'),_0x3ddc18,_0x5dbfd5['error']['message']);return _0x8da54c(_0x5dbfd5['error']['message']);}else{logger[_0xb99f('0x18')](_0xb99f('0x11'),_0x3ddc18,_0xb99f('0x13'));_0x8da54c(_0x5dbfd5[_0xb99f('0x19')][_0xb99f('0x17')]);}})[_0xb99f('0x1a')](function(_0x3a0715){logger['error'](_0xb99f('0x11'),_0x3ddc18,_0x3a0715);_0x13e695(_0x3a0715);});});}exports[_0xb99f('0x1b')]=function(_0x2f6898){var _0x575aa2=this;return new Promise(function(_0x589194,_0x34b637){return db[_0xb99f('0x1c')][_0xb99f('0x1d')]({'raw':_0x2f6898[_0xb99f('0x1e')]?_0x2f6898['options']['raw']===undefined?!![]:![]:!![],'where':_0x2f6898[_0xb99f('0x1e')]?_0x2f6898['options']['where']||null:null,'attributes':_0x2f6898[_0xb99f('0x1e')]?_0x2f6898[_0xb99f('0x1e')][_0xb99f('0x1f')]||null:null,'include':_0x2f6898[_0xb99f('0x1e')]?_0x2f6898['options'][_0xb99f('0x20')]?_[_0xb99f('0x21')](_0x2f6898[_0xb99f('0x1e')][_0xb99f('0x20')],function(_0x5184f5){return{'model':db[_0x5184f5[_0xb99f('0x22')]],'as':_0x5184f5['as'],'attributes':_0x5184f5['attributes'],'include':_0x5184f5[_0xb99f('0x20')]?_[_0xb99f('0x21')](_0x5184f5[_0xb99f('0x20')],function(_0x4b345d){return{'model':db[_0x4b345d['model']],'as':_0x4b345d['as'],'attributes':_0x4b345d[_0xb99f('0x1f')],'include':_0x4b345d[_0xb99f('0x20')]?_[_0xb99f('0x21')](_0x4b345d[_0xb99f('0x20')],function(_0x5b7499){return{'model':db[_0x5b7499[_0xb99f('0x22')]],'as':_0x5b7499['as'],'attributes':_0x5b7499[_0xb99f('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xb99f('0x23')](function(_0x193104){logger[_0xb99f('0x18')](_0xb99f('0x1b'),_0x2f6898);logger[_0xb99f('0x24')](_0xb99f('0x1b'),_0x2f6898,JSON[_0xb99f('0x14')](_0x193104));_0x589194(_0x193104);})['catch'](function(_0x2c6600){logger['error'](_0xb99f('0x1b'),_0x2c6600['message'],_0x2f6898);_0x34b637(_0x575aa2[_0xb99f('0x15')](0x1f4,_0x2c6600[_0xb99f('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 3be6a48..81d010e 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 _0xeca3=['remove','update','emit','length','./squareProject.events','save'];(function(_0xd2f4f5,_0x341930){var _0x41fc10=function(_0x496824){while(--_0x496824){_0xd2f4f5['push'](_0xd2f4f5['shift']());}};_0x41fc10(++_0x341930);}(_0xeca3,0x112));var _0x3eca=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xeca3[_0xfae23b];return _0x200640;};'use strict';var SquareProjectEvents=require(_0x3eca('0x0'));var events=[_0x3eca('0x1'),_0x3eca('0x2'),_0x3eca('0x3')];function createListener(_0x2ff8a9,_0x3d890b){return function(_0x123144){_0x3d890b[_0x3eca('0x4')](_0x2ff8a9,_0x123144);};}function removeListener(_0x244d2b,_0x39b271){return function(){SquareProjectEvents['removeListener'](_0x244d2b,_0x39b271);};}exports['register']=function(_0x5f313c){for(var _0x26482d=0x0,_0x5c6d7b=events[_0x3eca('0x5')];_0x26482d<_0x5c6d7b;_0x26482d++){var _0x575209=events[_0x26482d];var _0x3046bc=createListener('squareProject:'+_0x575209,_0x5f313c);SquareProjectEvents['on'](_0x575209,_0x3046bc);}}; \ No newline at end of file +var _0x051d=['squareProject:','save','remove','update','removeListener'];(function(_0x51b169,_0x5efbc2){var _0x12605a=function(_0x570f5e){while(--_0x570f5e){_0x51b169['push'](_0x51b169['shift']());}};_0x12605a(++_0x5efbc2);}(_0x051d,0x1c8));var _0xd051=function(_0xa990b7,_0x26c527){_0xa990b7=_0xa990b7-0x0;var _0x52c99c=_0x051d[_0xa990b7];return _0x52c99c;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0xd051('0x0'),_0xd051('0x1'),_0xd051('0x2')];function createListener(_0x19e5ca,_0xa11d84){return function(_0x466d1d){_0xa11d84['emit'](_0x19e5ca,_0x466d1d);};}function removeListener(_0x1bb6e6,_0x4d5109){return function(){SquareProjectEvents[_0xd051('0x3')](_0x1bb6e6,_0x4d5109);};}exports['register']=function(_0x3ef4b0){for(var _0x251c4b=0x0,_0x28a352=events['length'];_0x251c4b<_0x28a352;_0x251c4b++){var _0x463179=events[_0x251c4b];var _0x3df07b=createListener(_0xd051('0x4')+_0x463179,_0x3ef4b0);SquareProjectEvents['on'](_0x463179,_0x3df07b);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index be33189..7928a32 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 _0x0295=['isAuthenticated','index','post','create','put','/:id','update','delete','destroy','exports','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0x0295,0x1f0));var _0x5029=function(_0x33c663,_0x4416ed){_0x33c663=_0x33c663-0x0;var _0x4c6299=_0x0295[_0x33c663];return _0x4c6299;};'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')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x5029('0x7')]('/:id/download',auth[_0x5029('0x8')](),controller['download']);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 _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(_0xcdac34,_0x43f665){var _0x269d23=function(_0x3f2d6f){while(--_0x3f2d6f){_0xcdac34['push'](_0xcdac34['shift']());}};_0x269d23(++_0x43f665);}(_0x326f,0xd1));var _0xf326=function(_0x1fa74c,_0xde3fb8){_0x1fa74c=_0x1fa74c-0x0;var _0x3e3aaa=_0x326f[_0x1fa74c];return _0x3e3aaa;};'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 diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 07732b2..de960b3 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 _0x8d0e=['exports','STRING','VIRTUAL','getDataValue','savePath','substring','lastIndexOf','sequelize'];(function(_0x15747a,_0x2214b5){var _0x10f075=function(_0x1fa068){while(--_0x1fa068){_0x15747a['push'](_0x15747a['shift']());}};_0x10f075(++_0x2214b5);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x4f03f1,_0x10b972){_0x4f03f1=_0x4f03f1-0x0;var _0x378797=_0x8d0e[_0x4f03f1];return _0x378797;};'use strict';var Sequelize=require(_0xe8d0('0x0'));module[_0xe8d0('0x1')]={'uniqueid':{'type':Sequelize[_0xe8d0('0x2')]},'callerid':{'type':Sequelize[_0xe8d0('0x2')]},'calleridname':{'type':Sequelize[_0xe8d0('0x2')]},'context':{'type':Sequelize[_0xe8d0('0x2')]},'extension':{'type':Sequelize[_0xe8d0('0x2')]},'priority':{'type':Sequelize[_0xe8d0('0x2')]},'accountcode':{'type':Sequelize[_0xe8d0('0x2')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0xe8d0('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0xe8d0('0x2')]},'format':{'type':Sequelize[_0xe8d0('0x3')],'get':function(){var _0x469d37='';var _0xcc03d0=this[_0xe8d0('0x4')](_0xe8d0('0x5'));if(_0xcc03d0){_0x469d37=_0xcc03d0[_0xe8d0('0x6')](_0xcc03d0[_0xe8d0('0x7')]('.'));}return _0x469d37;}}}; \ No newline at end of file +var _0x7c09=['exports','STRING','VIRTUAL','getDataValue','savePath','lastIndexOf'];(function(_0x273a1b,_0x2f0b1f){var _0x199338=function(_0x2c2fb2){while(--_0x2c2fb2){_0x273a1b['push'](_0x273a1b['shift']());}};_0x199338(++_0x2f0b1f);}(_0x7c09,0x102));var _0x97c0=function(_0x3abffe,_0x233e25){_0x3abffe=_0x3abffe-0x0;var _0x5e4753=_0x7c09[_0x3abffe];return _0x5e4753;};'use strict';var Sequelize=require('sequelize');module[_0x97c0('0x0')]={'uniqueid':{'type':Sequelize[_0x97c0('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x97c0('0x1')]},'context':{'type':Sequelize[_0x97c0('0x1')]},'extension':{'type':Sequelize[_0x97c0('0x1')]},'priority':{'type':Sequelize[_0x97c0('0x1')]},'accountcode':{'type':Sequelize[_0x97c0('0x1')]},'dnid':{'type':Sequelize[_0x97c0('0x1')]},'projectName':{'type':Sequelize[_0x97c0('0x1')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x97c0('0x2')],'get':function(){var _0x42c6c7='';var _0x2c19fa=this[_0x97c0('0x3')](_0x97c0('0x4'));if(_0x2c19fa){_0x42c6c7=_0x2c19fa['substring'](_0x2c19fa[_0x97c0('0x5')]('.'));}return _0x42c6c7;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 68674ab..a23d81e 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 _0xcbc7=['File:\x20\x22','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','SquareRecording','type','key','map','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','include','rows','catch','show','params','rawAttributes','keys','includeAll','options','find','create','body','download','../../components/encryptor','uniqueid','savePath','format','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','filename','extname','send','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','existsSync','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher'];(function(_0x23e6bb,_0x5c2d69){var _0x1e3b4c=function(_0x1afc46){while(--_0x1afc46){_0x23e6bb['push'](_0x23e6bb['shift']());}};_0x1e3b4c(++_0x5c2d69);}(_0xcbc7,0x1e6));var _0x7cbc=function(_0x579175,_0x1ef0f0){_0x579175=_0x579175-0x0;var _0x3b8135=_0xcbc7[_0x579175];return _0x3b8135;};'use strict';var emlformat=require(_0x7cbc('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7cbc('0x1'));var rp=require(_0x7cbc('0x2'));var moment=require(_0x7cbc('0x3'));var BPromise=require(_0x7cbc('0x4'));var Mustache=require('mustache');var util=require(_0x7cbc('0x5'));var path=require(_0x7cbc('0x6'));var sox=require(_0x7cbc('0x7'));var csv=require(_0x7cbc('0x8'));var ejs=require(_0x7cbc('0x9'));var fs=require('fs');var fs_extra=require(_0x7cbc('0xa'));var _=require('lodash');var squel=require(_0x7cbc('0xb'));var crypto=require('crypto');var jsforce=require(_0x7cbc('0xc'));var deskjs=require(_0x7cbc('0xd'));var toCsv=require(_0x7cbc('0x8'));var querystring=require('querystring');var Papa=require(_0x7cbc('0xe'));var Redis=require('ioredis');var authService=require(_0x7cbc('0xf'));var qs=require(_0x7cbc('0x10'));var as=require(_0x7cbc('0x11'));var hardwareService=require(_0x7cbc('0x12'));var logger=require(_0x7cbc('0x13'))(_0x7cbc('0x14'));var utils=require(_0x7cbc('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x7cbc('0x16'));var db=require(_0x7cbc('0x17'))['db'];function respondWithStatusCode(_0x52aece,_0x27d9fd){_0x27d9fd=_0x27d9fd||0xcc;return function(_0x49d0d4){if(_0x49d0d4){return _0x52aece['sendStatus'](_0x27d9fd);}return _0x52aece[_0x7cbc('0x18')](_0x27d9fd)[_0x7cbc('0x19')]();};}function respondWithResult(_0xbeca3a,_0x13fdb1){_0x13fdb1=_0x13fdb1||0xc8;return function(_0x53f791){if(_0x53f791){return _0xbeca3a[_0x7cbc('0x18')](_0x13fdb1)[_0x7cbc('0x1a')](_0x53f791);}};}function respondWithFilteredResult(_0x26cfe1,_0x13aec8){return function(_0x3e5844){if(_0x3e5844){var _0x466980=typeof _0x13aec8[_0x7cbc('0x1b')]===_0x7cbc('0x1c')&&typeof _0x13aec8['limit']===_0x7cbc('0x1c');var _0x5b0a4f=_0x3e5844[_0x7cbc('0x1d')];var _0x225475=_0x466980?0x0:_0x13aec8[_0x7cbc('0x1b')];var _0x46c480=_0x466980?_0x3e5844['count']:_0x13aec8[_0x7cbc('0x1b')]+_0x13aec8[_0x7cbc('0x1e')];var _0x1c3e97;if(_0x46c480>=_0x5b0a4f){_0x46c480=_0x5b0a4f;_0x1c3e97=0xc8;}else{_0x1c3e97=0xce;}_0x26cfe1['status'](_0x1c3e97);return _0x26cfe1[_0x7cbc('0x1f')](_0x7cbc('0x20'),_0x225475+'-'+_0x46c480+'/'+_0x5b0a4f)[_0x7cbc('0x1a')](_0x3e5844);}return null;};}function patchUpdates(_0x557764){return function(_0x1bb498){try{jsonpatch[_0x7cbc('0x21')](_0x1bb498,_0x557764,!![]);}catch(_0x133c98){return BPromise[_0x7cbc('0x22')](_0x133c98);}return _0x1bb498[_0x7cbc('0x23')]();};}function saveUpdates(_0x289956,_0x485ce6){return function(_0x3d094f){if(_0x3d094f){return _0x3d094f[_0x7cbc('0x24')](_0x289956)[_0x7cbc('0x25')](function(_0x3a0d80){return _0x3a0d80;});}return null;};}function removeEntity(_0x90aaf7,_0x6e6b82){return function(_0x4ba166){if(_0x4ba166){return _0x4ba166[_0x7cbc('0x26')]()[_0x7cbc('0x25')](function(){_0x90aaf7[_0x7cbc('0x18')](0xcc)[_0x7cbc('0x19')]();});}};}function handleEntityNotFound(_0x3b32e5,_0x13db96){return function(_0xb71342){if(!_0xb71342){_0x3b32e5[_0x7cbc('0x27')](0x194);}return _0xb71342;};}function handleError(_0x3a63b6,_0x4c53a3){_0x4c53a3=_0x4c53a3||0x1f4;return function(_0x37537a){logger['error'](_0x37537a[_0x7cbc('0x28')]);if(_0x37537a[_0x7cbc('0x29')]){delete _0x37537a[_0x7cbc('0x29')];}_0x3a63b6[_0x7cbc('0x18')](_0x4c53a3)['send'](_0x37537a);};}exports['index']=function(_0x12fc88,_0x4929eb){var _0x2a9059={},_0x8e1109={},_0x47eac0={'count':0x0,'rows':[]};var _0x3271d7=_['map'](db[_0x7cbc('0x2a')]['rawAttributes'],function(_0xb0ccfa){return{'name':_0xb0ccfa['fieldName'],'type':_0xb0ccfa[_0x7cbc('0x2b')][_0x7cbc('0x2c')]};});_0x8e1109['model']=_[_0x7cbc('0x2d')](_0x3271d7,'name');_0x8e1109['query']=_['keys'](_0x12fc88[_0x7cbc('0x2e')]);_0x8e1109[_0x7cbc('0x2f')]=_[_0x7cbc('0x30')](_0x8e1109['model'],_0x8e1109['query']);_0x2a9059[_0x7cbc('0x31')]=_[_0x7cbc('0x30')](_0x8e1109[_0x7cbc('0x32')],qs[_0x7cbc('0x33')](_0x12fc88['query'][_0x7cbc('0x33')]));_0x2a9059['attributes']=_0x2a9059['attributes'][_0x7cbc('0x34')]?_0x2a9059[_0x7cbc('0x31')]:_0x8e1109['model'];if(!_0x12fc88[_0x7cbc('0x2e')][_0x7cbc('0x35')](_0x7cbc('0x36'))){_0x2a9059[_0x7cbc('0x1e')]=qs[_0x7cbc('0x1e')](_0x12fc88['query'][_0x7cbc('0x1e')]);_0x2a9059['offset']=qs['offset'](_0x12fc88[_0x7cbc('0x2e')][_0x7cbc('0x1b')]);}_0x2a9059[_0x7cbc('0x37')]=qs[_0x7cbc('0x38')](_0x12fc88[_0x7cbc('0x2e')][_0x7cbc('0x38')]);_0x2a9059[_0x7cbc('0x39')]=qs[_0x7cbc('0x2f')](_[_0x7cbc('0x3a')](_0x12fc88[_0x7cbc('0x2e')],_0x8e1109['filters']),_0x3271d7);if(_0x12fc88[_0x7cbc('0x2e')]['filter']){_0x2a9059[_0x7cbc('0x39')]=_[_0x7cbc('0x3b')](_0x2a9059[_0x7cbc('0x39')],{'$or':_[_0x7cbc('0x2d')](_0x3271d7,function(_0x205409){if(_0x205409[_0x7cbc('0x2b')]!==_0x7cbc('0x3c')){var _0x61aa43={};_0x61aa43[_0x205409[_0x7cbc('0x29')]]={'$like':'%'+_0x12fc88[_0x7cbc('0x2e')][_0x7cbc('0x3d')]+'%'};return _0x61aa43;}})});}_0x2a9059=_[_0x7cbc('0x3b')]({},_0x2a9059,_0x12fc88['options']);var _0x3f1d12={'where':_0x2a9059[_0x7cbc('0x39')]};return db[_0x7cbc('0x2a')][_0x7cbc('0x1d')](_0x3f1d12)['then'](function(_0x5d824e){_0x47eac0[_0x7cbc('0x1d')]=_0x5d824e;if(_0x12fc88[_0x7cbc('0x2e')]['includeAll']){_0x2a9059[_0x7cbc('0x3e')]=[{'all':!![]}];}return db[_0x7cbc('0x2a')]['findAll'](_0x2a9059);})['then'](function(_0x469017){_0x47eac0[_0x7cbc('0x3f')]=_0x469017;return _0x47eac0;})[_0x7cbc('0x25')](respondWithFilteredResult(_0x4929eb,_0x2a9059))[_0x7cbc('0x40')](handleError(_0x4929eb,null));};exports[_0x7cbc('0x41')]=function(_0x2acff4,_0x890671){var _0x4d8cd7={'raw':!![],'where':{'id':_0x2acff4[_0x7cbc('0x42')]['id']}},_0x44209a={};_0x44209a[_0x7cbc('0x32')]=_['keys'](db[_0x7cbc('0x2a')][_0x7cbc('0x43')]);_0x44209a[_0x7cbc('0x2e')]=_[_0x7cbc('0x44')](_0x2acff4[_0x7cbc('0x2e')]);_0x44209a[_0x7cbc('0x2f')]=_[_0x7cbc('0x30')](_0x44209a[_0x7cbc('0x32')],_0x44209a[_0x7cbc('0x2e')]);_0x4d8cd7['attributes']=_[_0x7cbc('0x30')](_0x44209a[_0x7cbc('0x32')],qs[_0x7cbc('0x33')](_0x2acff4[_0x7cbc('0x2e')]['fields']));_0x4d8cd7[_0x7cbc('0x31')]=_0x4d8cd7['attributes'][_0x7cbc('0x34')]?_0x4d8cd7[_0x7cbc('0x31')]:_0x44209a['model'];if(_0x2acff4[_0x7cbc('0x2e')][_0x7cbc('0x45')]){_0x4d8cd7[_0x7cbc('0x3e')]=[{'all':!![]}];}_0x4d8cd7=_[_0x7cbc('0x3b')]({},_0x4d8cd7,_0x2acff4[_0x7cbc('0x46')]);return db[_0x7cbc('0x2a')][_0x7cbc('0x47')](_0x4d8cd7)[_0x7cbc('0x25')](handleEntityNotFound(_0x890671,null))['then'](respondWithResult(_0x890671,null))['catch'](handleError(_0x890671,null));};exports[_0x7cbc('0x48')]=function(_0x21d5f2,_0x120016){return db[_0x7cbc('0x2a')][_0x7cbc('0x48')](_0x21d5f2[_0x7cbc('0x49')],{})['then'](respondWithResult(_0x120016,0xc9))[_0x7cbc('0x40')](handleError(_0x120016,null));};exports['update']=function(_0x510eeb,_0x320608){if(_0x510eeb['body']['id']){delete _0x510eeb[_0x7cbc('0x49')]['id'];}return db[_0x7cbc('0x2a')]['find']({'where':{'id':_0x510eeb[_0x7cbc('0x42')]['id']}})[_0x7cbc('0x25')](handleEntityNotFound(_0x320608,null))[_0x7cbc('0x25')](saveUpdates(_0x510eeb[_0x7cbc('0x49')],null))['then'](respondWithResult(_0x320608,null))['catch'](handleError(_0x320608,null));};exports[_0x7cbc('0x4a')]=function(_0x3e9e48,_0x3bdcb9,_0x54b529){var _0x358e0c=require(_0x7cbc('0x4b'));var _0x341d19=![];var _0x4f70d4={};if(_0x3e9e48[_0x7cbc('0x2e')][_0x7cbc('0x2b')]&&_0x3e9e48[_0x7cbc('0x2e')][_0x7cbc('0x2b')]===_0x7cbc('0x4c')){_0x4f70d4[_0x7cbc('0x4c')]=_0x3e9e48[_0x7cbc('0x42')]['id'];}else{_0x4f70d4['id']=_0x3e9e48[_0x7cbc('0x42')]['id'];}return db[_0x7cbc('0x2a')][_0x7cbc('0x47')]({'where':_0x4f70d4,'attributes':['id','savePath','filename'],'raw':!![]})[_0x7cbc('0x25')](handleEntityNotFound(_0x3bdcb9,null))[_0x7cbc('0x25')](function(_0x166dda){if(_0x166dda){var _0x469c07=_0x166dda[_0x7cbc('0x4d')];var _0x1b62a7=util[_0x7cbc('0x4e')]('%s.cypher',_0x469c07);if(fs['existsSync'](_0x1b62a7)){_0x341d19=!![];return _0x358e0c['decryptFile'](_0x1b62a7,_0x469c07,config[_0x7cbc('0x4f')][_0x7cbc('0x50')])[_0x7cbc('0x25')](function(){return _0x166dda;});}return _0x166dda;}})[_0x7cbc('0x25')](function(_0x5a2f96){if(_0x5a2f96){var _0x28668c=_0x5a2f96[_0x7cbc('0x4d')];if(!fs['existsSync'](_0x28668c)){throw new db[(_0x7cbc('0x51'))][(_0x7cbc('0x52'))](_0x7cbc('0x53'));}if(_0x5a2f96[_0x7cbc('0x54')]){return _0x3bdcb9[_0x7cbc('0x4a')](_0x28668c,_0x5a2f96[_0x7cbc('0x54')]+path[_0x7cbc('0x55')](_0x28668c),function(){if(_0x341d19){fs['unlink'](_0x28668c);}});}else{return _0x3bdcb9[_0x7cbc('0x4a')](_0x28668c,function(_0x8de560){if(_0x341d19){fs['unlink'](_0x28668c);}});}}})['catch'](function(_0x3c11e0){if(_0x3c11e0['message']===_0x7cbc('0x53')){_0x3bdcb9[_0x7cbc('0x18')](0x194)[_0x7cbc('0x56')](_0x7cbc('0x57'));}else{return handleError(_0x3bdcb9,null);}});};exports['destroy']=function(_0x57c28d,_0x20724f){return db[_0x7cbc('0x2a')][_0x7cbc('0x47')]({'where':{'id':_0x57c28d[_0x7cbc('0x42')]['id']}})[_0x7cbc('0x25')](function(_0x55c801){if(_['isNil'](_0x55c801)){throw new ReferenceError(_0x7cbc('0x58'));}return _0x55c801;})['then'](function(_0x197143){var _0x317fbe=_0x197143['savePath'];logger[_0x7cbc('0x59')](_0x7cbc('0x5a'),_0x317fbe);if(!_[_0x7cbc('0x5b')](_0x197143[_0x7cbc('0x4d')])&&fs[_0x7cbc('0x5c')](_0x317fbe)){logger[_0x7cbc('0x59')]('File:\x20\x22'+_0x317fbe+_0x7cbc('0x5d'));fs[_0x7cbc('0x5e')](_0x317fbe);}_0x317fbe=_0x317fbe+_0x7cbc('0x5f');if(!_[_0x7cbc('0x5b')](_0x197143['savePath'])&&fs['existsSync'](_0x317fbe)){logger[_0x7cbc('0x59')](_0x7cbc('0x60')+_0x317fbe+_0x7cbc('0x5d'));fs[_0x7cbc('0x5e')](_0x317fbe);}return _0x197143;})[_0x7cbc('0x25')](function(_0x21ff57){if(!_0x21ff57)throw new InternalError();return _0x21ff57[_0x7cbc('0x26')]();})[_0x7cbc('0x25')](function(){_0x20724f[_0x7cbc('0x18')](0xcc)['end']();})[_0x7cbc('0x40')](handleError(_0x20724f,null));}; \ No newline at end of file +var _0xb4d4=['filters','pick','filter','merge','includeAll','include','catch','show','params','length','options','create','body','download','../../components/encryptor','uniqueid','find','savePath','filename','format','existsSync','recording','Sequelize','SquareRecording\x20not\x20found','extname','Not\x20found','isNil','info','cancellazione\x20fisica\x20documento\x20%s','unlinkSync','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','hasOwnProperty','order','sort','where'];(function(_0x2261ce,_0x9ed8b6){var _0x524640=function(_0x3cbb90){while(--_0x3cbb90){_0x2261ce['push'](_0x2261ce['shift']());}};_0x524640(++_0x9ed8b6);}(_0xb4d4,0x75));var _0x4b4d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb4d4[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4b4d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4b4d('0x1'));var rp=require('request-promise');var moment=require(_0x4b4d('0x2'));var BPromise=require(_0x4b4d('0x3'));var Mustache=require(_0x4b4d('0x4'));var util=require(_0x4b4d('0x5'));var path=require(_0x4b4d('0x6'));var sox=require(_0x4b4d('0x7'));var csv=require(_0x4b4d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4b4d('0x9'));var _=require(_0x4b4d('0xa'));var squel=require(_0x4b4d('0xb'));var crypto=require(_0x4b4d('0xc'));var jsforce=require(_0x4b4d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4b4d('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4b4d('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4b4d('0xf'));var logger=require(_0x4b4d('0x10'))('api');var utils=require(_0x4b4d('0x11'));var config=require(_0x4b4d('0x12'));var licenseUtil=require(_0x4b4d('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f6e03,_0x382858){_0x382858=_0x382858||0xcc;return function(_0x4a2fb5){if(_0x4a2fb5){return _0x1f6e03[_0x4b4d('0x14')](_0x382858);}return _0x1f6e03[_0x4b4d('0x15')](_0x382858)[_0x4b4d('0x16')]();};}function respondWithResult(_0x3028cf,_0x1ab3ad){_0x1ab3ad=_0x1ab3ad||0xc8;return function(_0x14d0b1){if(_0x14d0b1){return _0x3028cf[_0x4b4d('0x15')](_0x1ab3ad)[_0x4b4d('0x17')](_0x14d0b1);}};}function respondWithFilteredResult(_0x2b585b,_0x3cbc41){return function(_0x39cef6){if(_0x39cef6){var _0xeadc98=typeof _0x3cbc41[_0x4b4d('0x18')]===_0x4b4d('0x19')&&typeof _0x3cbc41[_0x4b4d('0x1a')]==='undefined';var _0x2b568a=_0x39cef6[_0x4b4d('0x1b')];var _0x3a6b2b=_0xeadc98?0x0:_0x3cbc41[_0x4b4d('0x18')];var _0x5b03c4=_0xeadc98?_0x39cef6[_0x4b4d('0x1b')]:_0x3cbc41['offset']+_0x3cbc41[_0x4b4d('0x1a')];var _0x2951ac;if(_0x5b03c4>=_0x2b568a){_0x5b03c4=_0x2b568a;_0x2951ac=0xc8;}else{_0x2951ac=0xce;}_0x2b585b[_0x4b4d('0x15')](_0x2951ac);return _0x2b585b['set'](_0x4b4d('0x1c'),_0x3a6b2b+'-'+_0x5b03c4+'/'+_0x2b568a)['json'](_0x39cef6);}return null;};}function patchUpdates(_0x2581cf){return function(_0x339900){try{jsonpatch['apply'](_0x339900,_0x2581cf,!![]);}catch(_0x276850){return BPromise[_0x4b4d('0x1d')](_0x276850);}return _0x339900[_0x4b4d('0x1e')]();};}function saveUpdates(_0x217023,_0x46a584){return function(_0x27f137){if(_0x27f137){return _0x27f137[_0x4b4d('0x1f')](_0x217023)[_0x4b4d('0x20')](function(_0x5284b1){return _0x5284b1;});}return null;};}function removeEntity(_0x5bf14d,_0xbfb0c9){return function(_0x13233a){if(_0x13233a){return _0x13233a[_0x4b4d('0x21')]()[_0x4b4d('0x20')](function(){_0x5bf14d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4dc187,_0x6d45d3){return function(_0x832fd8){if(!_0x832fd8){_0x4dc187[_0x4b4d('0x14')](0x194);}return _0x832fd8;};}function handleError(_0x465ab8,_0x59f981){_0x59f981=_0x59f981||0x1f4;return function(_0x20f139){logger['error'](_0x20f139['stack']);if(_0x20f139[_0x4b4d('0x22')]){delete _0x20f139[_0x4b4d('0x22')];}_0x465ab8[_0x4b4d('0x15')](_0x59f981)[_0x4b4d('0x23')](_0x20f139);};}exports[_0x4b4d('0x24')]=function(_0x5aacb6,_0x5eb1c6){var _0x333d90={},_0x3d5b72={},_0x9e3e06={'count':0x0,'rows':[]};var _0x25d850=_[_0x4b4d('0x25')](db[_0x4b4d('0x26')][_0x4b4d('0x27')],function(_0x365142){return{'name':_0x365142[_0x4b4d('0x28')],'type':_0x365142[_0x4b4d('0x29')][_0x4b4d('0x2a')]};});_0x3d5b72[_0x4b4d('0x2b')]=_[_0x4b4d('0x25')](_0x25d850,_0x4b4d('0x22'));_0x3d5b72['query']=_[_0x4b4d('0x2c')](_0x5aacb6[_0x4b4d('0x2d')]);_0x3d5b72['filters']=_['intersection'](_0x3d5b72[_0x4b4d('0x2b')],_0x3d5b72[_0x4b4d('0x2d')]);_0x333d90['attributes']=_[_0x4b4d('0x2e')](_0x3d5b72[_0x4b4d('0x2b')],qs['fields'](_0x5aacb6['query'][_0x4b4d('0x2f')]));_0x333d90[_0x4b4d('0x30')]=_0x333d90[_0x4b4d('0x30')]['length']?_0x333d90[_0x4b4d('0x30')]:_0x3d5b72[_0x4b4d('0x2b')];if(!_0x5aacb6[_0x4b4d('0x2d')][_0x4b4d('0x31')]('nolimit')){_0x333d90[_0x4b4d('0x1a')]=qs[_0x4b4d('0x1a')](_0x5aacb6[_0x4b4d('0x2d')]['limit']);_0x333d90['offset']=qs[_0x4b4d('0x18')](_0x5aacb6[_0x4b4d('0x2d')][_0x4b4d('0x18')]);}_0x333d90[_0x4b4d('0x32')]=qs[_0x4b4d('0x33')](_0x5aacb6['query'][_0x4b4d('0x33')]);_0x333d90[_0x4b4d('0x34')]=qs[_0x4b4d('0x35')](_[_0x4b4d('0x36')](_0x5aacb6[_0x4b4d('0x2d')],_0x3d5b72[_0x4b4d('0x35')]),_0x25d850);if(_0x5aacb6[_0x4b4d('0x2d')][_0x4b4d('0x37')]){_0x333d90[_0x4b4d('0x34')]=_[_0x4b4d('0x38')](_0x333d90[_0x4b4d('0x34')],{'$or':_[_0x4b4d('0x25')](_0x25d850,function(_0x3e0f4c){if(_0x3e0f4c[_0x4b4d('0x29')]!=='VIRTUAL'){var _0x5e69e6={};_0x5e69e6[_0x3e0f4c['name']]={'$like':'%'+_0x5aacb6['query']['filter']+'%'};return _0x5e69e6;}})});}_0x333d90=_[_0x4b4d('0x38')]({},_0x333d90,_0x5aacb6['options']);var _0x39ed66={'where':_0x333d90[_0x4b4d('0x34')]};return db['SquareRecording'][_0x4b4d('0x1b')](_0x39ed66)[_0x4b4d('0x20')](function(_0xfa8bf3){_0x9e3e06[_0x4b4d('0x1b')]=_0xfa8bf3;if(_0x5aacb6['query'][_0x4b4d('0x39')]){_0x333d90[_0x4b4d('0x3a')]=[{'all':!![]}];}return db[_0x4b4d('0x26')]['findAll'](_0x333d90);})['then'](function(_0x1eb915){_0x9e3e06['rows']=_0x1eb915;return _0x9e3e06;})[_0x4b4d('0x20')](respondWithFilteredResult(_0x5eb1c6,_0x333d90))[_0x4b4d('0x3b')](handleError(_0x5eb1c6,null));};exports[_0x4b4d('0x3c')]=function(_0x46efb7,_0x116225){var _0x334849={'raw':!![],'where':{'id':_0x46efb7[_0x4b4d('0x3d')]['id']}},_0x540fa3={};_0x540fa3['model']=_['keys'](db[_0x4b4d('0x26')][_0x4b4d('0x27')]);_0x540fa3[_0x4b4d('0x2d')]=_[_0x4b4d('0x2c')](_0x46efb7[_0x4b4d('0x2d')]);_0x540fa3[_0x4b4d('0x35')]=_[_0x4b4d('0x2e')](_0x540fa3[_0x4b4d('0x2b')],_0x540fa3[_0x4b4d('0x2d')]);_0x334849['attributes']=_[_0x4b4d('0x2e')](_0x540fa3[_0x4b4d('0x2b')],qs[_0x4b4d('0x2f')](_0x46efb7['query']['fields']));_0x334849['attributes']=_0x334849[_0x4b4d('0x30')][_0x4b4d('0x3e')]?_0x334849['attributes']:_0x540fa3[_0x4b4d('0x2b')];if(_0x46efb7[_0x4b4d('0x2d')]['includeAll']){_0x334849['include']=[{'all':!![]}];}_0x334849=_['merge']({},_0x334849,_0x46efb7[_0x4b4d('0x3f')]);return db[_0x4b4d('0x26')]['find'](_0x334849)['then'](handleEntityNotFound(_0x116225,null))[_0x4b4d('0x20')](respondWithResult(_0x116225,null))['catch'](handleError(_0x116225,null));};exports['create']=function(_0x339709,_0x552c92){return db['SquareRecording'][_0x4b4d('0x40')](_0x339709[_0x4b4d('0x41')],{})[_0x4b4d('0x20')](respondWithResult(_0x552c92,0xc9))['catch'](handleError(_0x552c92,null));};exports['update']=function(_0x32f953,_0x46df86){if(_0x32f953[_0x4b4d('0x41')]['id']){delete _0x32f953['body']['id'];}return db[_0x4b4d('0x26')]['find']({'where':{'id':_0x32f953[_0x4b4d('0x3d')]['id']}})['then'](handleEntityNotFound(_0x46df86,null))[_0x4b4d('0x20')](saveUpdates(_0x32f953[_0x4b4d('0x41')],null))['then'](respondWithResult(_0x46df86,null))[_0x4b4d('0x3b')](handleError(_0x46df86,null));};exports[_0x4b4d('0x42')]=function(_0x467637,_0x57512e,_0xd3e1de){var _0x2a1557=require(_0x4b4d('0x43'));var _0x56bcac=![];var _0xcc47d2={};if(_0x467637[_0x4b4d('0x2d')][_0x4b4d('0x29')]&&_0x467637[_0x4b4d('0x2d')]['type']===_0x4b4d('0x44')){_0xcc47d2['uniqueid']=_0x467637['params']['id'];}else{_0xcc47d2['id']=_0x467637[_0x4b4d('0x3d')]['id'];}return db['SquareRecording'][_0x4b4d('0x45')]({'where':_0xcc47d2,'attributes':['id',_0x4b4d('0x46'),_0x4b4d('0x47')],'raw':!![]})[_0x4b4d('0x20')](handleEntityNotFound(_0x57512e,null))[_0x4b4d('0x20')](function(_0x16032b){if(_0x16032b){var _0x1cd255=_0x16032b[_0x4b4d('0x46')];var _0x27e0a6=util[_0x4b4d('0x48')]('%s.cypher',_0x1cd255);if(fs[_0x4b4d('0x49')](_0x27e0a6)){_0x56bcac=!![];return _0x2a1557['decryptFile'](_0x27e0a6,_0x1cd255,config['secrets'][_0x4b4d('0x4a')])['then'](function(){return _0x16032b;});}return _0x16032b;}})[_0x4b4d('0x20')](function(_0x528a6c){if(_0x528a6c){var _0x52373a=_0x528a6c[_0x4b4d('0x46')];if(!fs[_0x4b4d('0x49')](_0x52373a)){throw new db[(_0x4b4d('0x4b'))]['ValidationError'](_0x4b4d('0x4c'));}if(_0x528a6c[_0x4b4d('0x47')]){return _0x57512e[_0x4b4d('0x42')](_0x52373a,_0x528a6c['filename']+path[_0x4b4d('0x4d')](_0x52373a),function(){if(_0x56bcac){fs['unlink'](_0x52373a);}});}else{return _0x57512e[_0x4b4d('0x42')](_0x52373a,function(_0x538755){if(_0x56bcac){fs['unlink'](_0x52373a);}});}}})[_0x4b4d('0x3b')](function(_0x5eee91){if(_0x5eee91['message']===_0x4b4d('0x4c')){_0x57512e[_0x4b4d('0x15')](0x194)[_0x4b4d('0x23')](_0x4b4d('0x4e'));}else{return handleError(_0x57512e,null);}});};exports[_0x4b4d('0x21')]=function(_0x1e02ab,_0x571d93){return db[_0x4b4d('0x26')]['find']({'where':{'id':_0x1e02ab[_0x4b4d('0x3d')]['id']}})[_0x4b4d('0x20')](function(_0x281f39){if(_[_0x4b4d('0x4f')](_0x281f39)){throw new ReferenceError('Entity\x20not\x20found');}return _0x281f39;})[_0x4b4d('0x20')](function(_0x49baeb){var _0xd9b7f5=_0x49baeb[_0x4b4d('0x46')];logger[_0x4b4d('0x50')](_0x4b4d('0x51'),_0xd9b7f5);if(!_[_0x4b4d('0x4f')](_0x49baeb[_0x4b4d('0x46')])&&fs[_0x4b4d('0x49')](_0xd9b7f5)){logger[_0x4b4d('0x50')]('File:\x20\x22'+_0xd9b7f5+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x4b4d('0x52')](_0xd9b7f5);}_0xd9b7f5=_0xd9b7f5+'.cypher';if(!_[_0x4b4d('0x4f')](_0x49baeb['savePath'])&&fs[_0x4b4d('0x49')](_0xd9b7f5)){logger[_0x4b4d('0x50')](_0x4b4d('0x53')+_0xd9b7f5+_0x4b4d('0x54'));fs['unlinkSync'](_0xd9b7f5);}return _0x49baeb;})[_0x4b4d('0x20')](function(_0x34fe64){if(!_0x34fe64)throw new InternalError();return _0x34fe64[_0x4b4d('0x21')]();})['then'](function(){_0x571d93[_0x4b4d('0x15')](0xcc)[_0x4b4d('0x16')]();})[_0x4b4d('0x3b')](handleError(_0x571d93,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 70eedb2..9cd0628 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 _0x084b=['path','rimraf','../../config/environment','exports','define','SquareRecording','lodash','moment','bluebird'];(function(_0x295849,_0x42b3eb){var _0x27d8d4=function(_0x375ae0){while(--_0x375ae0){_0x295849['push'](_0x295849['shift']());}};_0x27d8d4(++_0x42b3eb);}(_0x084b,0xd5));var _0xb084=function(_0x2175a3,_0x426e08){_0x2175a3=_0x2175a3-0x0;var _0x3d308b=_0x084b[_0x2175a3];return _0x3d308b;};'use strict';var _=require(_0xb084('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xb084('0x1'));var BPromise=require(_0xb084('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb084('0x3'));var rimraf=require(_0xb084('0x4'));var config=require(_0xb084('0x5'));var attributes=require('./squareRecording.attributes');module[_0xb084('0x6')]=function(_0x50f465,_0x33728d){return _0x50f465[_0xb084('0x7')](_0xb084('0x8'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1a85=['moment','path','rimraf','../../config/environment','exports','SquareRecording','square_recordings','../../config/logger','api'];(function(_0x28faa8,_0x2f675f){var _0x1b8aa7=function(_0x4721fb){while(--_0x4721fb){_0x28faa8['push'](_0x28faa8['shift']());}};_0x1b8aa7(++_0x2f675f);}(_0x1a85,0x178));var _0x51a8=function(_0x553a72,_0x120470){_0x553a72=_0x553a72-0x0;var _0x410e05=_0x1a85[_0x553a72];return _0x410e05;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x51a8('0x0'))(_0x51a8('0x1'));var moment=require(_0x51a8('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x51a8('0x3'));var rimraf=require(_0x51a8('0x4'));var config=require(_0x51a8('0x5'));var attributes=require('./squareRecording.attributes');module[_0x51a8('0x6')]=function(_0x4b76a8,_0x2c1180){return _0x4b76a8['define'](_0x51a8('0x7'),attributes,{'tableName':_0x51a8('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index 36c7a45..f6ba4ac 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 _0x0ad0=['SquareRecording','create','options','raw','info','CreateSquareRecording','stringify','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','SquareRecording,\x20%s,\x20%s','debug','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x5b2e19,_0xcb6e08){var _0x1d949e=function(_0x45842a){while(--_0x45842a){_0x5b2e19['push'](_0x5b2e19['shift']());}};_0x1d949e(++_0xcb6e08);}(_0x0ad0,0xa4));var _0x00ad=function(_0x2c5032,_0x466e24){_0x2c5032=_0x2c5032-0x0;var _0x1bc2ba=_0x0ad0[_0x2c5032];return _0x1bc2ba;};'use strict';var _=require(_0x00ad('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x00ad('0x1'));var rs=require(_0x00ad('0x2'));var fs=require('fs');var Redis=require(_0x00ad('0x3'));var db=require(_0x00ad('0x4'))['db'];var utils=require(_0x00ad('0x5'));var logger=require(_0x00ad('0x6'))(_0x00ad('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x00ad('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23c8eb,_0x14085b,_0x524f51){return new BPromise(function(_0x264e07,_0x182adf){return client[_0x00ad('0x9')](_0x23c8eb,_0x524f51)[_0x00ad('0xa')](function(_0xc9c03e){logger['info'](_0x00ad('0xb'),_0x14085b,'request\x20sent');logger[_0x00ad('0xc')](_0x00ad('0xd'),_0x14085b,_0x00ad('0xe'),JSON['stringify'](_0xc9c03e));if(_0xc9c03e[_0x00ad('0xf')]){if(_0xc9c03e[_0x00ad('0xf')][_0x00ad('0x10')]===0x1f4){logger[_0x00ad('0xf')](_0x00ad('0xb'),_0x14085b,_0xc9c03e[_0x00ad('0xf')]['message']);return _0x182adf(_0xc9c03e['error'][_0x00ad('0x11')]);}logger['error'](_0x00ad('0xb'),_0x14085b,_0xc9c03e[_0x00ad('0xf')][_0x00ad('0x11')]);return _0x264e07(_0xc9c03e[_0x00ad('0xf')][_0x00ad('0x11')]);}else{logger['info'](_0x00ad('0xb'),_0x14085b,_0x00ad('0xe'));_0x264e07(_0xc9c03e['result'][_0x00ad('0x11')]);}})['catch'](function(_0x3edd5d){logger[_0x00ad('0xf')]('SquareRecording,\x20%s,\x20%s',_0x14085b,_0x3edd5d);_0x182adf(_0x3edd5d);});});}exports['CreateSquareRecording']=function(_0x391f56){var _0x5a7c5f=this;return new Promise(function(_0x1c05bb,_0x104e9e){return db[_0x00ad('0x12')][_0x00ad('0x13')](_0x391f56['body'],{'raw':_0x391f56[_0x00ad('0x14')]?_0x391f56['options'][_0x00ad('0x15')]===undefined?!![]:![]:!![]})['then'](function(_0x4c888b){logger[_0x00ad('0x16')](_0x00ad('0x17'),_0x391f56);logger[_0x00ad('0xc')](_0x00ad('0x17'),_0x391f56,JSON[_0x00ad('0x18')](_0x4c888b));_0x1c05bb(_0x4c888b);})[_0x00ad('0x19')](function(_0xf53e62){logger[_0x00ad('0xf')](_0x00ad('0x17'),_0xf53e62[_0x00ad('0x11')],_0x391f56);_0x104e9e(_0x5a7c5f[_0x00ad('0xf')](0x1f4,_0xf53e62[_0x00ad('0x11')]));});});}; \ No newline at end of file +var _0x2575=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','CreateSquareRecording','options','raw','lodash','util','moment','randomstring'];(function(_0x21b2ea,_0x3c4ed5){var _0x8ff7a=function(_0x5df763){while(--_0x5df763){_0x21b2ea['push'](_0x21b2ea['shift']());}};_0x8ff7a(++_0x3c4ed5);}(_0x2575,0x128));var _0x5257=function(_0x344db1,_0x70a1cc){_0x344db1=_0x344db1-0x0;var _0x202280=_0x2575[_0x344db1];return _0x202280;};'use strict';var _=require(_0x5257('0x0'));var util=require(_0x5257('0x1'));var moment=require(_0x5257('0x2'));var BPromise=require('bluebird');var rs=require(_0x5257('0x3'));var fs=require('fs');var Redis=require(_0x5257('0x4'));var db=require(_0x5257('0x5'))['db'];var utils=require(_0x5257('0x6'));var logger=require(_0x5257('0x7'))('rpc');var config=require(_0x5257('0x8'));var jayson=require(_0x5257('0x9'));var client=jayson['client'][_0x5257('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c6fdd,_0x1576b3,_0x4c2d70){return new BPromise(function(_0x2e14c0,_0x246cf4){return client[_0x5257('0xb')](_0x2c6fdd,_0x4c2d70)[_0x5257('0xc')](function(_0x509a34){logger[_0x5257('0xd')](_0x5257('0xe'),_0x1576b3,_0x5257('0xf'));logger[_0x5257('0x10')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x1576b3,_0x5257('0xf'),JSON[_0x5257('0x11')](_0x509a34));if(_0x509a34[_0x5257('0x12')]){if(_0x509a34[_0x5257('0x12')]['code']===0x1f4){logger['error'](_0x5257('0xe'),_0x1576b3,_0x509a34[_0x5257('0x12')][_0x5257('0x13')]);return _0x246cf4(_0x509a34[_0x5257('0x12')][_0x5257('0x13')]);}logger[_0x5257('0x12')](_0x5257('0xe'),_0x1576b3,_0x509a34[_0x5257('0x12')][_0x5257('0x13')]);return _0x2e14c0(_0x509a34['error'][_0x5257('0x13')]);}else{logger[_0x5257('0xd')](_0x5257('0xe'),_0x1576b3,_0x5257('0xf'));_0x2e14c0(_0x509a34[_0x5257('0x14')]['message']);}})[_0x5257('0x15')](function(_0x36adc1){logger[_0x5257('0x12')](_0x5257('0xe'),_0x1576b3,_0x36adc1);_0x246cf4(_0x36adc1);});});}exports[_0x5257('0x16')]=function(_0x163181){var _0x5d7c6a=this;return new Promise(function(_0x277a2e,_0x4440d7){return db['SquareRecording']['create'](_0x163181['body'],{'raw':_0x163181['options']?_0x163181[_0x5257('0x17')][_0x5257('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x4bd0f3){logger[_0x5257('0xd')](_0x5257('0x16'),_0x163181);logger['debug']('CreateSquareRecording',_0x163181,JSON[_0x5257('0x11')](_0x4bd0f3));_0x277a2e(_0x4bd0f3);})['catch'](function(_0x1a3ba6){logger[_0x5257('0x12')](_0x5257('0x16'),_0x1a3ba6[_0x5257('0x13')],_0x163181);_0x4440d7(_0x5d7c6a[_0x5257('0x12')](0x1f4,_0x1a3ba6[_0x5257('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index a4d8aad..8fa78a1 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x523267,_0xb2e276){var _0x290a95=function(_0x16fe9b){while(--_0x16fe9b){_0x523267['push'](_0x523267['shift']());}};_0x290a95(++_0xb2e276);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file +var _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x34d3cd,_0xefd8e9){var _0x9fc58d=function(_0x5cb2fd){while(--_0x5cb2fd){_0x34d3cd['push'](_0x34d3cd['shift']());}};_0x9fc58d(++_0xefd8e9);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 1dff2c4..0d3c89e 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 _0x6344=['STRING','BOOLEAN','sequelize','exports'];(function(_0x3d6b76,_0x17d6d3){var _0x15fa9a=function(_0x4c2933){while(--_0x4c2933){_0x3d6b76['push'](_0x3d6b76['shift']());}};_0x15fa9a(++_0x17d6d3);}(_0x6344,0x196));var _0x4634=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x6344[_0x2b7764];return _0x848dcb;};'use strict';var Sequelize=require(_0x4634('0x0'));module[_0x4634('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x4634('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x4634('0x2')]},'language':{'type':Sequelize[_0x4634('0x2')]},'type':{'type':Sequelize[_0x4634('0x2')]},'uniqueid':{'type':Sequelize[_0x4634('0x2')]},'version':{'type':Sequelize[_0x4634('0x2')]},'callerid':{'type':Sequelize[_0x4634('0x2')]},'calleridname':{'type':Sequelize[_0x4634('0x2')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0x4634('0x2')]},'callington':{'type':Sequelize[_0x4634('0x2')]},'callingtns':{'type':Sequelize[_0x4634('0x2')]},'dnid':{'type':Sequelize[_0x4634('0x2')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x4634('0x2')]},'extension':{'type':Sequelize[_0x4634('0x2')]},'priority':{'type':Sequelize[_0x4634('0x2')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x4634('0x2')]},'threadid':{'type':Sequelize[_0x4634('0x2')]},'project_name':{'type':Sequelize[_0x4634('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x4634('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xbc91=['sequelize','exports','STRING','DATE','BOOLEAN'];(function(_0x5e5eed,_0x54fc17){var _0x485882=function(_0x39ad0f){while(--_0x39ad0f){_0x5e5eed['push'](_0x5e5eed['shift']());}};_0x485882(++_0x54fc17);}(_0xbc91,0xd2));var _0x1bc9=function(_0x484cac,_0x30ad3a){_0x484cac=_0x484cac-0x0;var _0x1d6e77=_0xbc91[_0x484cac];return _0x1d6e77;};'use strict';var Sequelize=require(_0x1bc9('0x0'));module[_0x1bc9('0x1')]={'network':{'type':Sequelize[_0x1bc9('0x2')]},'network_script':{'type':Sequelize[_0x1bc9('0x2')]},'request':{'type':Sequelize[_0x1bc9('0x2')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x1bc9('0x2')]},'type':{'type':Sequelize[_0x1bc9('0x2')]},'uniqueid':{'type':Sequelize[_0x1bc9('0x2')]},'version':{'type':Sequelize[_0x1bc9('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x1bc9('0x2')]},'callingani2':{'type':Sequelize[_0x1bc9('0x2')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0x1bc9('0x2')]},'dnid':{'type':Sequelize[_0x1bc9('0x2')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x1bc9('0x2')]},'extension':{'type':Sequelize[_0x1bc9('0x2')]},'priority':{'type':Sequelize[_0x1bc9('0x2')]},'enhanced':{'type':Sequelize[_0x1bc9('0x2')]},'accountcode':{'type':Sequelize[_0x1bc9('0x2')]},'threadid':{'type':Sequelize[_0x1bc9('0x2')]},'project_name':{'type':Sequelize[_0x1bc9('0x2')]},'joinAt':{'type':Sequelize[_0x1bc9('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x1bc9('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 4829a5a..69d584f 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 _0x466b=['order','pick','filters','where','merge','type','VIRTUAL','filter','options','includeAll','findAll','catch','show','params','include','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','SquareReport','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x5f348b,_0x3f2048){var _0x3623e1=function(_0x6cea66){while(--_0x6cea66){_0x5f348b['push'](_0x5f348b['shift']());}};_0x3623e1(++_0x3f2048);}(_0x466b,0x100));var _0xb466=function(_0x2a1f84,_0x2e9cf5){_0x2a1f84=_0x2a1f84-0x0;var _0x5aa4a4=_0x466b[_0x2a1f84];return _0x5aa4a4;};'use strict';var emlformat=require(_0xb466('0x0'));var rimraf=require(_0xb466('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb466('0x2'));var rp=require(_0xb466('0x3'));var moment=require(_0xb466('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb466('0x5'));var util=require('util');var path=require(_0xb466('0x6'));var sox=require('sox');var csv=require(_0xb466('0x7'));var ejs=require(_0xb466('0x8'));var fs=require('fs');var fs_extra=require(_0xb466('0x9'));var _=require(_0xb466('0xa'));var squel=require(_0xb466('0xb'));var crypto=require(_0xb466('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb466('0xd'));var toCsv=require(_0xb466('0x7'));var querystring=require(_0xb466('0xe'));var Papa=require(_0xb466('0xf'));var Redis=require(_0xb466('0x10'));var authService=require(_0xb466('0x11'));var qs=require(_0xb466('0x12'));var as=require(_0xb466('0x13'));var hardwareService=require(_0xb466('0x14'));var logger=require(_0xb466('0x15'))(_0xb466('0x16'));var utils=require(_0xb466('0x17'));var config=require(_0xb466('0x18'));var licenseUtil=require(_0xb466('0x19'));var db=require(_0xb466('0x1a'))['db'];function respondWithStatusCode(_0x2b0a0d,_0x5b5656){_0x5b5656=_0x5b5656||0xcc;return function(_0x3a1c5c){if(_0x3a1c5c){return _0x2b0a0d[_0xb466('0x1b')](_0x5b5656);}return _0x2b0a0d[_0xb466('0x1c')](_0x5b5656)['end']();};}function respondWithResult(_0x518a28,_0xa7a867){_0xa7a867=_0xa7a867||0xc8;return function(_0x51b155){if(_0x51b155){return _0x518a28[_0xb466('0x1c')](_0xa7a867)[_0xb466('0x1d')](_0x51b155);}};}function respondWithFilteredResult(_0x5723ec,_0x34fcb5){return function(_0x2bf1d8){if(_0x2bf1d8){var _0x5e2446=typeof _0x34fcb5[_0xb466('0x1e')]===_0xb466('0x1f')&&typeof _0x34fcb5['limit']===_0xb466('0x1f');var _0x329731=_0x2bf1d8[_0xb466('0x20')];var _0x224e55=_0x5e2446?0x0:_0x34fcb5['offset'];var _0x4b73cf=_0x5e2446?_0x2bf1d8['count']:_0x34fcb5['offset']+_0x34fcb5[_0xb466('0x21')];var _0x19f807;if(_0x4b73cf>=_0x329731){_0x4b73cf=_0x329731;_0x19f807=0xc8;}else{_0x19f807=0xce;}_0x5723ec[_0xb466('0x1c')](_0x19f807);return _0x5723ec[_0xb466('0x22')]('Content-Range',_0x224e55+'-'+_0x4b73cf+'/'+_0x329731)[_0xb466('0x1d')](_0x2bf1d8);}return null;};}function patchUpdates(_0x1753fb){return function(_0x50fc82){try{jsonpatch[_0xb466('0x23')](_0x50fc82,_0x1753fb,!![]);}catch(_0x1a69fa){return BPromise[_0xb466('0x24')](_0x1a69fa);}return _0x50fc82['save']();};}function saveUpdates(_0x355f84,_0x5afece){return function(_0x127b02){if(_0x127b02){return _0x127b02[_0xb466('0x25')](_0x355f84)[_0xb466('0x26')](function(_0x57e3b7){return _0x57e3b7;});}return null;};}function removeEntity(_0x5a85a3,_0x24f688){return function(_0x15d522){if(_0x15d522){return _0x15d522[_0xb466('0x27')]()[_0xb466('0x26')](function(){_0x5a85a3[_0xb466('0x1c')](0xcc)[_0xb466('0x28')]();});}};}function handleEntityNotFound(_0x3ce683,_0x4d7940){return function(_0x16625e){if(!_0x16625e){_0x3ce683[_0xb466('0x1b')](0x194);}return _0x16625e;};}function handleError(_0xb79e70,_0x5972fd){_0x5972fd=_0x5972fd||0x1f4;return function(_0x4cb31e){logger[_0xb466('0x29')](_0x4cb31e[_0xb466('0x2a')]);if(_0x4cb31e[_0xb466('0x2b')]){delete _0x4cb31e[_0xb466('0x2b')];}_0xb79e70[_0xb466('0x1c')](_0x5972fd)[_0xb466('0x2c')](_0x4cb31e);};}exports[_0xb466('0x2d')]=function(_0x38bac9,_0x12ef67){var _0x5e2079={},_0xb7af93={},_0x34ebf0={'count':0x0,'rows':[]};var _0x368fe9=_[_0xb466('0x2e')](db[_0xb466('0x2f')][_0xb466('0x30')],function(_0x3507e2){return{'name':_0x3507e2[_0xb466('0x31')],'type':_0x3507e2['type'][_0xb466('0x32')]};});_0xb7af93[_0xb466('0x33')]=_[_0xb466('0x2e')](_0x368fe9,_0xb466('0x2b'));_0xb7af93[_0xb466('0x34')]=_[_0xb466('0x35')](_0x38bac9[_0xb466('0x34')]);_0xb7af93['filters']=_[_0xb466('0x36')](_0xb7af93[_0xb466('0x33')],_0xb7af93[_0xb466('0x34')]);_0x5e2079[_0xb466('0x37')]=_[_0xb466('0x36')](_0xb7af93[_0xb466('0x33')],qs['fields'](_0x38bac9[_0xb466('0x34')][_0xb466('0x38')]));_0x5e2079[_0xb466('0x37')]=_0x5e2079[_0xb466('0x37')][_0xb466('0x39')]?_0x5e2079[_0xb466('0x37')]:_0xb7af93[_0xb466('0x33')];if(!_0x38bac9['query'][_0xb466('0x3a')](_0xb466('0x3b'))){_0x5e2079[_0xb466('0x21')]=qs[_0xb466('0x21')](_0x38bac9[_0xb466('0x34')][_0xb466('0x21')]);_0x5e2079[_0xb466('0x1e')]=qs[_0xb466('0x1e')](_0x38bac9['query']['offset']);}_0x5e2079[_0xb466('0x3c')]=qs['sort'](_0x38bac9[_0xb466('0x34')]['sort']);_0x5e2079['where']=qs['filters'](_[_0xb466('0x3d')](_0x38bac9[_0xb466('0x34')],_0xb7af93[_0xb466('0x3e')]),_0x368fe9);if(_0x38bac9[_0xb466('0x34')]['filter']){_0x5e2079[_0xb466('0x3f')]=_[_0xb466('0x40')](_0x5e2079[_0xb466('0x3f')],{'$or':_['map'](_0x368fe9,function(_0x4bbbe4){if(_0x4bbbe4[_0xb466('0x41')]!==_0xb466('0x42')){var _0x2dfa3={};_0x2dfa3[_0x4bbbe4[_0xb466('0x2b')]]={'$like':'%'+_0x38bac9[_0xb466('0x34')][_0xb466('0x43')]+'%'};return _0x2dfa3;}})});}_0x5e2079=_['merge']({},_0x5e2079,_0x38bac9[_0xb466('0x44')]);var _0x24c9cd={'where':_0x5e2079[_0xb466('0x3f')]};return db[_0xb466('0x2f')]['count'](_0x24c9cd)[_0xb466('0x26')](function(_0x202a04){_0x34ebf0[_0xb466('0x20')]=_0x202a04;if(_0x38bac9[_0xb466('0x34')][_0xb466('0x45')]){_0x5e2079['include']=[{'all':!![]}];}return db[_0xb466('0x2f')][_0xb466('0x46')](_0x5e2079);})['then'](function(_0x7e614b){_0x34ebf0['rows']=_0x7e614b;return _0x34ebf0;})[_0xb466('0x26')](respondWithFilteredResult(_0x12ef67,_0x5e2079))[_0xb466('0x47')](handleError(_0x12ef67,null));};exports[_0xb466('0x48')]=function(_0x1e9189,_0x4b8491){var _0x9262b9={'raw':!![],'where':{'id':_0x1e9189[_0xb466('0x49')]['id']}},_0x179de7={};_0x179de7[_0xb466('0x33')]=_[_0xb466('0x35')](db[_0xb466('0x2f')][_0xb466('0x30')]);_0x179de7[_0xb466('0x34')]=_[_0xb466('0x35')](_0x1e9189[_0xb466('0x34')]);_0x179de7[_0xb466('0x3e')]=_[_0xb466('0x36')](_0x179de7[_0xb466('0x33')],_0x179de7['query']);_0x9262b9['attributes']=_['intersection'](_0x179de7[_0xb466('0x33')],qs['fields'](_0x1e9189['query'][_0xb466('0x38')]));_0x9262b9[_0xb466('0x37')]=_0x9262b9[_0xb466('0x37')]['length']?_0x9262b9['attributes']:_0x179de7[_0xb466('0x33')];if(_0x1e9189['query']['includeAll']){_0x9262b9[_0xb466('0x4a')]=[{'all':!![]}];}_0x9262b9=_[_0xb466('0x40')]({},_0x9262b9,_0x1e9189[_0xb466('0x44')]);return db['SquareReport'][_0xb466('0x4b')](_0x9262b9)['then'](handleEntityNotFound(_0x4b8491,null))['then'](respondWithResult(_0x4b8491,null))[_0xb466('0x47')](handleError(_0x4b8491,null));};exports[_0xb466('0x4c')]=function(_0xd34ab6,_0x6be2e4){return db[_0xb466('0x2f')][_0xb466('0x4c')](_0xd34ab6[_0xb466('0x4d')],{})[_0xb466('0x26')](respondWithResult(_0x6be2e4,0xc9))[_0xb466('0x47')](handleError(_0x6be2e4,null));};exports[_0xb466('0x25')]=function(_0x1629d8,_0x28be86){if(_0x1629d8[_0xb466('0x4d')]['id']){delete _0x1629d8['body']['id'];}return db[_0xb466('0x2f')][_0xb466('0x4b')]({'where':{'id':_0x1629d8[_0xb466('0x49')]['id']}})[_0xb466('0x26')](handleEntityNotFound(_0x28be86,null))[_0xb466('0x26')](saveUpdates(_0x1629d8[_0xb466('0x4d')],null))['then'](respondWithResult(_0x28be86,null))['catch'](handleError(_0x28be86,null));};exports[_0xb466('0x27')]=function(_0x3602ec,_0x50508e){return db[_0xb466('0x2f')][_0xb466('0x4b')]({'where':{'id':_0x3602ec[_0xb466('0x49')]['id']}})[_0xb466('0x26')](handleEntityNotFound(_0x50508e,null))[_0xb466('0x26')](removeEntity(_0x50508e,null))[_0xb466('0x47')](handleError(_0x50508e,null));};exports[_0xb466('0x4e')]=function(_0xf748a5,_0x38b6ea){return db['SquareReport'][_0xb466('0x4e')]()[_0xb466('0x26')](respondWithResult(_0x38b6ea,null))[_0xb466('0x47')](handleError(_0x38b6ea,null));}; \ No newline at end of file +var _0x4257=['request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','name','options','SquareReport','include','findAll','catch','show','params','includeAll','find','create','body','destroy','describe','eml-format','rimraf','zip-dir'];(function(_0x5be658,_0x35d76d){var _0x373777=function(_0x126769){while(--_0x126769){_0x5be658['push'](_0x5be658['shift']());}};_0x373777(++_0x35d76d);}(_0x4257,0x1dd));var _0x7425=function(_0x16383a,_0x2d9b36){_0x16383a=_0x16383a-0x0;var _0x5e92e1=_0x4257[_0x16383a];return _0x5e92e1;};'use strict';var emlformat=require(_0x7425('0x0'));var rimraf=require(_0x7425('0x1'));var zipdir=require(_0x7425('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7425('0x3'));var moment=require(_0x7425('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7425('0x5'));var util=require(_0x7425('0x6'));var path=require(_0x7425('0x7'));var sox=require(_0x7425('0x8'));var csv=require(_0x7425('0x9'));var ejs=require(_0x7425('0xa'));var fs=require('fs');var fs_extra=require(_0x7425('0xb'));var _=require(_0x7425('0xc'));var squel=require('squel');var crypto=require(_0x7425('0xd'));var jsforce=require(_0x7425('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7425('0x9'));var querystring=require(_0x7425('0xf'));var Papa=require(_0x7425('0x10'));var Redis=require(_0x7425('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x7425('0x12'));var as=require(_0x7425('0x13'));var hardwareService=require(_0x7425('0x14'));var logger=require(_0x7425('0x15'))(_0x7425('0x16'));var utils=require('../../config/utils');var config=require(_0x7425('0x17'));var licenseUtil=require(_0x7425('0x18'));var db=require(_0x7425('0x19'))['db'];function respondWithStatusCode(_0x2858b9,_0x3858e4){_0x3858e4=_0x3858e4||0xcc;return function(_0x37fe09){if(_0x37fe09){return _0x2858b9[_0x7425('0x1a')](_0x3858e4);}return _0x2858b9[_0x7425('0x1b')](_0x3858e4)[_0x7425('0x1c')]();};}function respondWithResult(_0x561f93,_0xb4d0f3){_0xb4d0f3=_0xb4d0f3||0xc8;return function(_0x2ab3fb){if(_0x2ab3fb){return _0x561f93[_0x7425('0x1b')](_0xb4d0f3)[_0x7425('0x1d')](_0x2ab3fb);}};}function respondWithFilteredResult(_0x58be0f,_0x5e64f1){return function(_0x4ac24d){if(_0x4ac24d){var _0x4aacb4=typeof _0x5e64f1[_0x7425('0x1e')]===_0x7425('0x1f')&&typeof _0x5e64f1[_0x7425('0x20')]===_0x7425('0x1f');var _0x292095=_0x4ac24d[_0x7425('0x21')];var _0x3f07ba=_0x4aacb4?0x0:_0x5e64f1[_0x7425('0x1e')];var _0x1e7b23=_0x4aacb4?_0x4ac24d[_0x7425('0x21')]:_0x5e64f1[_0x7425('0x1e')]+_0x5e64f1[_0x7425('0x20')];var _0xe5653a;if(_0x1e7b23>=_0x292095){_0x1e7b23=_0x292095;_0xe5653a=0xc8;}else{_0xe5653a=0xce;}_0x58be0f['status'](_0xe5653a);return _0x58be0f[_0x7425('0x22')](_0x7425('0x23'),_0x3f07ba+'-'+_0x1e7b23+'/'+_0x292095)[_0x7425('0x1d')](_0x4ac24d);}return null;};}function patchUpdates(_0x25332b){return function(_0x4530f6){try{jsonpatch[_0x7425('0x24')](_0x4530f6,_0x25332b,!![]);}catch(_0x20ef48){return BPromise[_0x7425('0x25')](_0x20ef48);}return _0x4530f6[_0x7425('0x26')]();};}function saveUpdates(_0x3319f6,_0x4bac08){return function(_0x4538fa){if(_0x4538fa){return _0x4538fa[_0x7425('0x27')](_0x3319f6)['then'](function(_0x5138a2){return _0x5138a2;});}return null;};}function removeEntity(_0x49c896,_0xfb5a4){return function(_0xbdf051){if(_0xbdf051){return _0xbdf051['destroy']()[_0x7425('0x28')](function(){_0x49c896[_0x7425('0x1b')](0xcc)[_0x7425('0x1c')]();});}};}function handleEntityNotFound(_0x3d9a44,_0x42f77c){return function(_0xa85571){if(!_0xa85571){_0x3d9a44[_0x7425('0x1a')](0x194);}return _0xa85571;};}function handleError(_0x38c9ee,_0x3d34ad){_0x3d34ad=_0x3d34ad||0x1f4;return function(_0x22a1ad){logger[_0x7425('0x29')](_0x22a1ad[_0x7425('0x2a')]);if(_0x22a1ad['name']){delete _0x22a1ad['name'];}_0x38c9ee[_0x7425('0x1b')](_0x3d34ad)[_0x7425('0x2b')](_0x22a1ad);};}exports[_0x7425('0x2c')]=function(_0x477e82,_0x199daa){var _0x179851={},_0x5b6c26={},_0x3d284e={'count':0x0,'rows':[]};var _0x420174=_[_0x7425('0x2d')](db['SquareReport'][_0x7425('0x2e')],function(_0x184ba8){return{'name':_0x184ba8[_0x7425('0x2f')],'type':_0x184ba8[_0x7425('0x30')][_0x7425('0x31')]};});_0x5b6c26[_0x7425('0x32')]=_[_0x7425('0x2d')](_0x420174,'name');_0x5b6c26[_0x7425('0x33')]=_[_0x7425('0x34')](_0x477e82[_0x7425('0x33')]);_0x5b6c26[_0x7425('0x35')]=_[_0x7425('0x36')](_0x5b6c26[_0x7425('0x32')],_0x5b6c26[_0x7425('0x33')]);_0x179851['attributes']=_['intersection'](_0x5b6c26[_0x7425('0x32')],qs[_0x7425('0x37')](_0x477e82['query'][_0x7425('0x37')]));_0x179851[_0x7425('0x38')]=_0x179851[_0x7425('0x38')][_0x7425('0x39')]?_0x179851[_0x7425('0x38')]:_0x5b6c26[_0x7425('0x32')];if(!_0x477e82[_0x7425('0x33')]['hasOwnProperty'](_0x7425('0x3a'))){_0x179851[_0x7425('0x20')]=qs[_0x7425('0x20')](_0x477e82['query'][_0x7425('0x20')]);_0x179851[_0x7425('0x1e')]=qs[_0x7425('0x1e')](_0x477e82[_0x7425('0x33')][_0x7425('0x1e')]);}_0x179851[_0x7425('0x3b')]=qs[_0x7425('0x3c')](_0x477e82[_0x7425('0x33')][_0x7425('0x3c')]);_0x179851[_0x7425('0x3d')]=qs[_0x7425('0x35')](_[_0x7425('0x3e')](_0x477e82[_0x7425('0x33')],_0x5b6c26[_0x7425('0x35')]),_0x420174);if(_0x477e82[_0x7425('0x33')][_0x7425('0x3f')]){_0x179851[_0x7425('0x3d')]=_[_0x7425('0x40')](_0x179851[_0x7425('0x3d')],{'$or':_['map'](_0x420174,function(_0x4df034){if(_0x4df034[_0x7425('0x30')]!==_0x7425('0x41')){var _0x37a446={};_0x37a446[_0x4df034[_0x7425('0x42')]]={'$like':'%'+_0x477e82[_0x7425('0x33')][_0x7425('0x3f')]+'%'};return _0x37a446;}})});}_0x179851=_[_0x7425('0x40')]({},_0x179851,_0x477e82[_0x7425('0x43')]);var _0x27c7b3={'where':_0x179851[_0x7425('0x3d')]};return db[_0x7425('0x44')]['count'](_0x27c7b3)[_0x7425('0x28')](function(_0x5c29e4){_0x3d284e[_0x7425('0x21')]=_0x5c29e4;if(_0x477e82[_0x7425('0x33')]['includeAll']){_0x179851[_0x7425('0x45')]=[{'all':!![]}];}return db[_0x7425('0x44')][_0x7425('0x46')](_0x179851);})['then'](function(_0xf62653){_0x3d284e['rows']=_0xf62653;return _0x3d284e;})[_0x7425('0x28')](respondWithFilteredResult(_0x199daa,_0x179851))[_0x7425('0x47')](handleError(_0x199daa,null));};exports[_0x7425('0x48')]=function(_0x5f049e,_0x1066c4){var _0x3b0fa0={'raw':!![],'where':{'id':_0x5f049e[_0x7425('0x49')]['id']}},_0x3f74da={};_0x3f74da[_0x7425('0x32')]=_['keys'](db[_0x7425('0x44')][_0x7425('0x2e')]);_0x3f74da[_0x7425('0x33')]=_['keys'](_0x5f049e['query']);_0x3f74da[_0x7425('0x35')]=_[_0x7425('0x36')](_0x3f74da['model'],_0x3f74da[_0x7425('0x33')]);_0x3b0fa0[_0x7425('0x38')]=_[_0x7425('0x36')](_0x3f74da[_0x7425('0x32')],qs[_0x7425('0x37')](_0x5f049e[_0x7425('0x33')]['fields']));_0x3b0fa0[_0x7425('0x38')]=_0x3b0fa0[_0x7425('0x38')][_0x7425('0x39')]?_0x3b0fa0[_0x7425('0x38')]:_0x3f74da[_0x7425('0x32')];if(_0x5f049e[_0x7425('0x33')][_0x7425('0x4a')]){_0x3b0fa0[_0x7425('0x45')]=[{'all':!![]}];}_0x3b0fa0=_['merge']({},_0x3b0fa0,_0x5f049e[_0x7425('0x43')]);return db[_0x7425('0x44')][_0x7425('0x4b')](_0x3b0fa0)[_0x7425('0x28')](handleEntityNotFound(_0x1066c4,null))['then'](respondWithResult(_0x1066c4,null))[_0x7425('0x47')](handleError(_0x1066c4,null));};exports[_0x7425('0x4c')]=function(_0x5302f5,_0x38c0ca){return db[_0x7425('0x44')][_0x7425('0x4c')](_0x5302f5[_0x7425('0x4d')],{})[_0x7425('0x28')](respondWithResult(_0x38c0ca,0xc9))[_0x7425('0x47')](handleError(_0x38c0ca,null));};exports[_0x7425('0x27')]=function(_0x17e47f,_0x2ed27e){if(_0x17e47f[_0x7425('0x4d')]['id']){delete _0x17e47f[_0x7425('0x4d')]['id'];}return db[_0x7425('0x44')][_0x7425('0x4b')]({'where':{'id':_0x17e47f[_0x7425('0x49')]['id']}})[_0x7425('0x28')](handleEntityNotFound(_0x2ed27e,null))[_0x7425('0x28')](saveUpdates(_0x17e47f[_0x7425('0x4d')],null))[_0x7425('0x28')](respondWithResult(_0x2ed27e,null))[_0x7425('0x47')](handleError(_0x2ed27e,null));};exports[_0x7425('0x4e')]=function(_0x1de922,_0x1101db){return db['SquareReport']['find']({'where':{'id':_0x1de922[_0x7425('0x49')]['id']}})[_0x7425('0x28')](handleEntityNotFound(_0x1101db,null))[_0x7425('0x28')](removeEntity(_0x1101db,null))['catch'](handleError(_0x1101db,null));};exports[_0x7425('0x4f')]=function(_0x18f36a,_0x231b9d){return db['SquareReport'][_0x7425('0x4f')]()[_0x7425('0x28')](respondWithResult(_0x231b9d,null))[_0x7425('0x47')](handleError(_0x231b9d,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index f9233e7..65575ba 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 _0x0695=['rimraf','../../config/environment','./squareReport.attributes','exports','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','util','api','moment','bluebird','request-promise'];(function(_0xd8a8af,_0x1e93f0){var _0x5b7278=function(_0x458800){while(--_0x458800){_0xd8a8af['push'](_0xd8a8af['shift']());}};_0x5b7278(++_0x1e93f0);}(_0x0695,0x12a));var _0x5069=function(_0x5876de,_0xacce42){_0x5876de=_0x5876de-0x0;var _0x232bf8=_0x0695[_0x5876de];return _0x232bf8;};'use strict';var _=require(_0x5069('0x0'));var util=require(_0x5069('0x1'));var logger=require('../../config/logger')(_0x5069('0x2'));var moment=require(_0x5069('0x3'));var BPromise=require(_0x5069('0x4'));var rp=require(_0x5069('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5069('0x6'));var config=require(_0x5069('0x7'));var attributes=require(_0x5069('0x8'));module[_0x5069('0x9')]=function(_0x419588,_0x1be77b){return _0x419588['define'](_0x5069('0xa'),attributes,{'tableName':_0x5069('0xb'),'paranoid':![],'indexes':[{'name':_0x5069('0xc'),'fields':[_0x5069('0xd'),_0x5069('0xe')]},{'name':_0x5069('0xf'),'fields':[_0x5069('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc6f4=['./squareReport.attributes','exports','define','SquareReport','report_square','uid_pname','uniqueid','leaveAt','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x235275,_0x58420b){var _0x3c80cc=function(_0x28644d){while(--_0x28644d){_0x235275['push'](_0x235275['shift']());}};_0x3c80cc(++_0x58420b);}(_0xc6f4,0x78));var _0x4c6f=function(_0x1812dc,_0x2c464c){_0x1812dc=_0x1812dc-0x0;var _0xc26dcc=_0xc6f4[_0x1812dc];return _0xc26dcc;};'use strict';var _=require(_0x4c6f('0x0'));var util=require('util');var logger=require(_0x4c6f('0x1'))(_0x4c6f('0x2'));var moment=require(_0x4c6f('0x3'));var BPromise=require(_0x4c6f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4c6f('0x5'));var rimraf=require(_0x4c6f('0x6'));var config=require(_0x4c6f('0x7'));var attributes=require(_0x4c6f('0x8'));module[_0x4c6f('0x9')]=function(_0x16f58d,_0x221dbe){return _0x16f58d[_0x4c6f('0xa')](_0x4c6f('0xb'),attributes,{'tableName':_0x4c6f('0xc'),'paranoid':![],'indexes':[{'name':_0x4c6f('0xd'),'fields':[_0x4c6f('0xe'),'project_name']},{'name':_0x4c6f('0xf'),'fields':[_0x4c6f('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index a31dfd4..eecf079 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 _0xf399=['error','message','result','catch','CreateSquareReport','options','UpdateSquareReport','SquareReport','update','body','raw','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','SquareReport,\x20%s,\x20%s','debug','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x522302,_0x6cf3d1){var _0x1248b7=function(_0xa5e55){while(--_0xa5e55){_0x522302['push'](_0x522302['shift']());}};_0x1248b7(++_0x6cf3d1);}(_0xf399,0x18d));var _0x9f39=function(_0x53d8ad,_0x416a34){_0x53d8ad=_0x53d8ad-0x0;var _0x555e62=_0xf399[_0x53d8ad];return _0x555e62;};'use strict';var _=require(_0x9f39('0x0'));var util=require(_0x9f39('0x1'));var moment=require(_0x9f39('0x2'));var BPromise=require(_0x9f39('0x3'));var rs=require(_0x9f39('0x4'));var fs=require('fs');var Redis=require(_0x9f39('0x5'));var db=require(_0x9f39('0x6'))['db'];var utils=require(_0x9f39('0x7'));var logger=require(_0x9f39('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9f39('0x9'));var client=jayson[_0x9f39('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2845d2,_0x138893,_0x304b50){return new BPromise(function(_0x4ec7ae,_0x4eedb2){return client[_0x9f39('0xb')](_0x2845d2,_0x304b50)[_0x9f39('0xc')](function(_0xe10591){logger[_0x9f39('0xd')](_0x9f39('0xe'),_0x138893,'request\x20sent');logger[_0x9f39('0xf')](_0x9f39('0x10'),_0x138893,_0x9f39('0x11'),JSON[_0x9f39('0x12')](_0xe10591));if(_0xe10591['error']){if(_0xe10591['error']['code']===0x1f4){logger[_0x9f39('0x13')](_0x9f39('0xe'),_0x138893,_0xe10591[_0x9f39('0x13')][_0x9f39('0x14')]);return _0x4eedb2(_0xe10591[_0x9f39('0x13')][_0x9f39('0x14')]);}logger[_0x9f39('0x13')](_0x9f39('0xe'),_0x138893,_0xe10591[_0x9f39('0x13')]['message']);return _0x4ec7ae(_0xe10591[_0x9f39('0x13')]['message']);}else{logger[_0x9f39('0xd')](_0x9f39('0xe'),_0x138893,_0x9f39('0x11'));_0x4ec7ae(_0xe10591[_0x9f39('0x15')][_0x9f39('0x14')]);}})[_0x9f39('0x16')](function(_0xe5821b){logger['error']('SquareReport,\x20%s,\x20%s',_0x138893,_0xe5821b);_0x4eedb2(_0xe5821b);});});}exports[_0x9f39('0x17')]=function(_0x32ebcd){var _0x5cf567=this;return new Promise(function(_0x4c2e9b,_0x598e0f){return db['SquareReport']['create'](_0x32ebcd['body'],{'raw':_0x32ebcd[_0x9f39('0x18')]?_0x32ebcd[_0x9f39('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x9f39('0xc')](function(_0x119232){logger[_0x9f39('0xd')]('CreateSquareReport',_0x32ebcd);logger['debug'](_0x9f39('0x17'),_0x32ebcd,JSON['stringify'](_0x119232));_0x4c2e9b(_0x119232);})[_0x9f39('0x16')](function(_0x50f66a){logger[_0x9f39('0x13')](_0x9f39('0x17'),_0x50f66a['message'],_0x32ebcd);_0x598e0f(_0x5cf567[_0x9f39('0x13')](0x1f4,_0x50f66a[_0x9f39('0x14')]));});});};exports[_0x9f39('0x19')]=function(_0x2d20d7){var _0x32fde4=this;return new Promise(function(_0x1082a4,_0x47f67e){return db[_0x9f39('0x1a')][_0x9f39('0x1b')](_0x2d20d7[_0x9f39('0x1c')],{'raw':_0x2d20d7['options']?_0x2d20d7[_0x9f39('0x18')][_0x9f39('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d20d7[_0x9f39('0x18')]?_0x2d20d7[_0x9f39('0x18')][_0x9f39('0x1e')]||null:null,'attributes':_0x2d20d7['options']?_0x2d20d7[_0x9f39('0x18')][_0x9f39('0x1f')]||null:null,'limit':_0x2d20d7[_0x9f39('0x18')]?_0x2d20d7[_0x9f39('0x18')]['limit']||null:null})[_0x9f39('0xc')](function(_0x5000ce){logger['info'](_0x9f39('0x19'),_0x2d20d7);logger[_0x9f39('0xf')](_0x9f39('0x19'),_0x2d20d7,JSON[_0x9f39('0x12')](_0x5000ce));_0x1082a4(_0x5000ce);})['catch'](function(_0x5cc5fc){logger[_0x9f39('0x13')](_0x9f39('0x19'),_0x5cc5fc[_0x9f39('0x14')],_0x2d20d7);_0x47f67e(_0x32fde4[_0x9f39('0x13')](0x1f4,_0x5cc5fc['message']));});});}; \ No newline at end of file +var _0xa86c=['SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareReport','SquareReport','create','options','raw','debug','UpdateSquareReport','body','where','attributes','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent'];(function(_0x36eb7d,_0x52cdcb){var _0x5eb32a=function(_0x15c9ad){while(--_0x15c9ad){_0x36eb7d['push'](_0x36eb7d['shift']());}};_0x5eb32a(++_0x52cdcb);}(_0xa86c,0xea));var _0xca86=function(_0x32d32c,_0xc29035){_0x32d32c=_0x32d32c-0x0;var _0x1e05ff=_0xa86c[_0x32d32c];return _0x1e05ff;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xca86('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xca86('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0xca86('0x2'));var logger=require(_0xca86('0x3'))(_0xca86('0x4'));var config=require(_0xca86('0x5'));var jayson=require(_0xca86('0x6'));var client=jayson[_0xca86('0x7')][_0xca86('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5799cd,_0x2d1c75,_0x288d19){return new BPromise(function(_0x4c0d02,_0x4fce97){return client[_0xca86('0x9')](_0x5799cd,_0x288d19)[_0xca86('0xa')](function(_0x1d2fd7){logger[_0xca86('0xb')](_0xca86('0xc'),_0x2d1c75,_0xca86('0xd'));logger['debug'](_0xca86('0xe'),_0x2d1c75,_0xca86('0xd'),JSON[_0xca86('0xf')](_0x1d2fd7));if(_0x1d2fd7[_0xca86('0x10')]){if(_0x1d2fd7[_0xca86('0x10')][_0xca86('0x11')]===0x1f4){logger['error']('SquareReport,\x20%s,\x20%s',_0x2d1c75,_0x1d2fd7[_0xca86('0x10')][_0xca86('0x12')]);return _0x4fce97(_0x1d2fd7['error'][_0xca86('0x12')]);}logger[_0xca86('0x10')](_0xca86('0xc'),_0x2d1c75,_0x1d2fd7[_0xca86('0x10')][_0xca86('0x12')]);return _0x4c0d02(_0x1d2fd7['error'][_0xca86('0x12')]);}else{logger[_0xca86('0xb')](_0xca86('0xc'),_0x2d1c75,'request\x20sent');_0x4c0d02(_0x1d2fd7[_0xca86('0x13')][_0xca86('0x12')]);}})[_0xca86('0x14')](function(_0x4379de){logger['error'](_0xca86('0xc'),_0x2d1c75,_0x4379de);_0x4fce97(_0x4379de);});});}exports[_0xca86('0x15')]=function(_0x4a0056){var _0x393045=this;return new Promise(function(_0x579889,_0x49ecd2){return db[_0xca86('0x16')][_0xca86('0x17')](_0x4a0056['body'],{'raw':_0x4a0056[_0xca86('0x18')]?_0x4a0056[_0xca86('0x18')][_0xca86('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x4bead9){logger[_0xca86('0xb')](_0xca86('0x15'),_0x4a0056);logger[_0xca86('0x1a')](_0xca86('0x15'),_0x4a0056,JSON['stringify'](_0x4bead9));_0x579889(_0x4bead9);})['catch'](function(_0xda4429){logger['error'](_0xca86('0x15'),_0xda4429[_0xca86('0x12')],_0x4a0056);_0x49ecd2(_0x393045['error'](0x1f4,_0xda4429[_0xca86('0x12')]));});});};exports[_0xca86('0x1b')]=function(_0x345eca){var _0xcb7818=this;return new Promise(function(_0x5c3146,_0x216690){return db['SquareReport']['update'](_0x345eca[_0xca86('0x1c')],{'raw':_0x345eca[_0xca86('0x18')]?_0x345eca[_0xca86('0x18')][_0xca86('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x345eca[_0xca86('0x18')]?_0x345eca[_0xca86('0x18')][_0xca86('0x1d')]||null:null,'attributes':_0x345eca['options']?_0x345eca[_0xca86('0x18')][_0xca86('0x1e')]||null:null,'limit':_0x345eca['options']?_0x345eca[_0xca86('0x18')]['limit']||null:null})[_0xca86('0xa')](function(_0x4f7c0f){logger[_0xca86('0xb')](_0xca86('0x1b'),_0x345eca);logger['debug']('UpdateSquareReport',_0x345eca,JSON['stringify'](_0x4f7c0f));_0x5c3146(_0x4f7c0f);})[_0xca86('0x14')](function(_0x5d5524){logger['error']('UpdateSquareReport',_0x5d5524['message'],_0x345eca);_0x216690(_0xcb7818[_0xca86('0x10')](0x1f4,_0x5d5524[_0xca86('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 58608f1..836bb45 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 _0xde16=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./squareReportDetail.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','delete','destroy','exports','multer','util'];(function(_0x4f7519,_0x457a82){var _0x1d66be=function(_0x463058){while(--_0x463058){_0x4f7519['push'](_0x4f7519['shift']());}};_0x1d66be(++_0x457a82);}(_0xde16,0x106));var _0x6de1=function(_0x423fae,_0x4db1ed){_0x423fae=_0x423fae-0x0;var _0x915f4d=_0xde16[_0x423fae];return _0x915f4d;};'use strict';var multer=require(_0x6de1('0x0'));var util=require(_0x6de1('0x1'));var path=require(_0x6de1('0x2'));var timeout=require(_0x6de1('0x3'));var express=require('express');var router=express[_0x6de1('0x4')]();var fs_extra=require(_0x6de1('0x5'));var auth=require(_0x6de1('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6de1('0x7'));var controller=require(_0x6de1('0x8'));router[_0x6de1('0x9')]('/',auth['isAuthenticated'](),controller[_0x6de1('0xa')]);router[_0x6de1('0x9')](_0x6de1('0xb'),auth[_0x6de1('0xc')](),controller[_0x6de1('0xd')]);router[_0x6de1('0x9')](_0x6de1('0xe'),auth[_0x6de1('0xc')](),controller[_0x6de1('0xf')]);router[_0x6de1('0x10')]('/',auth[_0x6de1('0xc')](),controller[_0x6de1('0x11')]);router[_0x6de1('0x12')]('/:id',auth[_0x6de1('0xc')](),controller['update']);router[_0x6de1('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x6de1('0x14')]);module[_0x6de1('0x15')]=router; \ No newline at end of file +var _0x02a1=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','delete','destroy','util','path','connect-timeout','express'];(function(_0xa9d072,_0x3a8fce){var _0x3c4652=function(_0x8a53f4){while(--_0x8a53f4){_0xa9d072['push'](_0xa9d072['shift']());}};_0x3c4652(++_0x3a8fce);}(_0x02a1,0x164));var _0x102a=function(_0x2f1351,_0x4838fe){_0x2f1351=_0x2f1351-0x0;var _0x2af409=_0x02a1[_0x2f1351];return _0x2af409;};'use strict';var multer=require('multer');var util=require(_0x102a('0x0'));var path=require(_0x102a('0x1'));var timeout=require(_0x102a('0x2'));var express=require(_0x102a('0x3'));var router=express['Router']();var fs_extra=require(_0x102a('0x4'));var auth=require(_0x102a('0x5'));var interaction=require(_0x102a('0x6'));var config=require(_0x102a('0x7'));var controller=require(_0x102a('0x8'));router[_0x102a('0x9')]('/',auth[_0x102a('0xa')](),controller[_0x102a('0xb')]);router['get'](_0x102a('0xc'),auth[_0x102a('0xa')](),controller[_0x102a('0xd')]);router[_0x102a('0x9')](_0x102a('0xe'),auth[_0x102a('0xa')](),controller[_0x102a('0xf')]);router['post']('/',auth[_0x102a('0xa')](),controller[_0x102a('0x10')]);router[_0x102a('0x11')](_0x102a('0xe'),auth[_0x102a('0xa')](),controller['update']);router[_0x102a('0x12')](_0x102a('0xe'),auth[_0x102a('0xa')](),controller[_0x102a('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 064c79b..dda3467 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 _0x9935=['exports','STRING','TEXT','sequelize'];(function(_0x459ebb,_0x1515a0){var _0x20a740=function(_0x5d7c79){while(--_0x5d7c79){_0x459ebb['push'](_0x459ebb['shift']());}};_0x20a740(++_0x1515a0);}(_0x9935,0xd7));var _0x5993=function(_0x7ffcc7,_0x42df63){_0x7ffcc7=_0x7ffcc7-0x0;var _0x3bda64=_0x9935[_0x7ffcc7];return _0x3bda64;};'use strict';var Sequelize=require(_0x5993('0x0'));module[_0x5993('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x5993('0x2')]},'application':{'type':Sequelize[_0x5993('0x2')]},'data':{'type':Sequelize[_0x5993('0x3')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x5993('0x2')]}}; \ No newline at end of file +var _0xa2d9=['sequelize','STRING','TEXT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa2d9,0x1da));var _0x9a2d=function(_0x3a4a4b,_0x307f30){_0x3a4a4b=_0x3a4a4b-0x0;var _0x17c50a=_0xa2d9[_0x3a4a4b];return _0x17c50a;};'use strict';var Sequelize=require(_0x9a2d('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x9a2d('0x1')]},'node':{'type':Sequelize[_0x9a2d('0x1')]},'application':{'type':Sequelize[_0x9a2d('0x1')]},'data':{'type':Sequelize[_0x9a2d('0x2')]},'project_name':{'type':Sequelize[_0x9a2d('0x1')]},'callerid':{'type':Sequelize[_0x9a2d('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 6341e88..5f48682 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 _0x6eb6=['save','update','destroy','then','sendStatus','error','stack','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','findAll','rows','catch','show','keys','includeAll','include','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x6eb6,0x115));var _0x66eb=function(_0x1283b5,_0x2dfae3){_0x1283b5=_0x1283b5-0x0;var _0x176d03=_0x6eb6[_0x1283b5];return _0x176d03;};'use strict';var emlformat=require(_0x66eb('0x0'));var rimraf=require(_0x66eb('0x1'));var zipdir=require(_0x66eb('0x2'));var jsonpatch=require(_0x66eb('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x66eb('0x4'));var util=require(_0x66eb('0x5'));var path=require(_0x66eb('0x6'));var sox=require(_0x66eb('0x7'));var csv=require(_0x66eb('0x8'));var ejs=require(_0x66eb('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x66eb('0xa'));var jsforce=require(_0x66eb('0xb'));var deskjs=require(_0x66eb('0xc'));var toCsv=require('to-csv');var querystring=require(_0x66eb('0xd'));var Papa=require(_0x66eb('0xe'));var Redis=require(_0x66eb('0xf'));var authService=require(_0x66eb('0x10'));var qs=require(_0x66eb('0x11'));var as=require(_0x66eb('0x12'));var hardwareService=require(_0x66eb('0x13'));var logger=require('../../config/logger')(_0x66eb('0x14'));var utils=require(_0x66eb('0x15'));var config=require(_0x66eb('0x16'));var licenseUtil=require(_0x66eb('0x17'));var db=require(_0x66eb('0x18'))['db'];function respondWithStatusCode(_0x4b1be7,_0x146e30){_0x146e30=_0x146e30||0xcc;return function(_0x4188af){if(_0x4188af){return _0x4b1be7['sendStatus'](_0x146e30);}return _0x4b1be7[_0x66eb('0x19')](_0x146e30)[_0x66eb('0x1a')]();};}function respondWithResult(_0x53feb6,_0x1dcdf4){_0x1dcdf4=_0x1dcdf4||0xc8;return function(_0x2e9f18){if(_0x2e9f18){return _0x53feb6[_0x66eb('0x19')](_0x1dcdf4)[_0x66eb('0x1b')](_0x2e9f18);}};}function respondWithFilteredResult(_0x529de3,_0x5eb5a3){return function(_0x123fa9){if(_0x123fa9){var _0x4e4b56=typeof _0x5eb5a3['offset']===_0x66eb('0x1c')&&typeof _0x5eb5a3[_0x66eb('0x1d')]===_0x66eb('0x1c');var _0x41a0fe=_0x123fa9[_0x66eb('0x1e')];var _0x51fd63=_0x4e4b56?0x0:_0x5eb5a3[_0x66eb('0x1f')];var _0x49ff63=_0x4e4b56?_0x123fa9[_0x66eb('0x1e')]:_0x5eb5a3[_0x66eb('0x1f')]+_0x5eb5a3[_0x66eb('0x1d')];var _0xe8db5f;if(_0x49ff63>=_0x41a0fe){_0x49ff63=_0x41a0fe;_0xe8db5f=0xc8;}else{_0xe8db5f=0xce;}_0x529de3[_0x66eb('0x19')](_0xe8db5f);return _0x529de3['set'](_0x66eb('0x20'),_0x51fd63+'-'+_0x49ff63+'/'+_0x41a0fe)[_0x66eb('0x1b')](_0x123fa9);}return null;};}function patchUpdates(_0x44dc11){return function(_0x4951bf){try{jsonpatch[_0x66eb('0x21')](_0x4951bf,_0x44dc11,!![]);}catch(_0x37355b){return BPromise[_0x66eb('0x22')](_0x37355b);}return _0x4951bf[_0x66eb('0x23')]();};}function saveUpdates(_0x574eb5,_0x5a247c){return function(_0x1f0f44){if(_0x1f0f44){return _0x1f0f44[_0x66eb('0x24')](_0x574eb5)['then'](function(_0x127670){return _0x127670;});}return null;};}function removeEntity(_0x3f1a5a,_0x3e5fc7){return function(_0xa57861){if(_0xa57861){return _0xa57861[_0x66eb('0x25')]()[_0x66eb('0x26')](function(){_0x3f1a5a[_0x66eb('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f8b50,_0x2cc089){return function(_0x3eb863){if(!_0x3eb863){_0x1f8b50[_0x66eb('0x27')](0x194);}return _0x3eb863;};}function handleError(_0x571674,_0xd2dfc0){_0xd2dfc0=_0xd2dfc0||0x1f4;return function(_0x303f51){logger[_0x66eb('0x28')](_0x303f51[_0x66eb('0x29')]);if(_0x303f51[_0x66eb('0x2a')]){delete _0x303f51[_0x66eb('0x2a')];}_0x571674[_0x66eb('0x19')](_0xd2dfc0)[_0x66eb('0x2b')](_0x303f51);};}exports[_0x66eb('0x2c')]=function(_0x44f31a,_0x41e20a){var _0x3309d4={},_0x41e529={},_0x1eaf17={'count':0x0,'rows':[]};var _0x596d23=_[_0x66eb('0x2d')](db[_0x66eb('0x2e')][_0x66eb('0x2f')],function(_0x3e8a90){return{'name':_0x3e8a90[_0x66eb('0x30')],'type':_0x3e8a90[_0x66eb('0x31')][_0x66eb('0x32')]};});_0x41e529[_0x66eb('0x33')]=_['map'](_0x596d23,_0x66eb('0x2a'));_0x41e529['query']=_['keys'](_0x44f31a[_0x66eb('0x34')]);_0x41e529[_0x66eb('0x35')]=_[_0x66eb('0x36')](_0x41e529['model'],_0x41e529[_0x66eb('0x34')]);_0x3309d4[_0x66eb('0x37')]=_[_0x66eb('0x36')](_0x41e529[_0x66eb('0x33')],qs[_0x66eb('0x38')](_0x44f31a[_0x66eb('0x34')][_0x66eb('0x38')]));_0x3309d4[_0x66eb('0x37')]=_0x3309d4[_0x66eb('0x37')][_0x66eb('0x39')]?_0x3309d4[_0x66eb('0x37')]:_0x41e529[_0x66eb('0x33')];if(!_0x44f31a[_0x66eb('0x34')][_0x66eb('0x3a')](_0x66eb('0x3b'))){_0x3309d4[_0x66eb('0x1d')]=qs[_0x66eb('0x1d')](_0x44f31a[_0x66eb('0x34')]['limit']);_0x3309d4[_0x66eb('0x1f')]=qs[_0x66eb('0x1f')](_0x44f31a[_0x66eb('0x34')][_0x66eb('0x1f')]);}_0x3309d4[_0x66eb('0x3c')]=qs[_0x66eb('0x3d')](_0x44f31a[_0x66eb('0x34')][_0x66eb('0x3d')]);_0x3309d4['where']=qs['filters'](_['pick'](_0x44f31a[_0x66eb('0x34')],_0x41e529[_0x66eb('0x35')]),_0x596d23);if(_0x44f31a[_0x66eb('0x34')][_0x66eb('0x3e')]){_0x3309d4[_0x66eb('0x3f')]=_[_0x66eb('0x40')](_0x3309d4[_0x66eb('0x3f')],{'$or':_[_0x66eb('0x2d')](_0x596d23,function(_0x484c8a){if(_0x484c8a[_0x66eb('0x31')]!=='VIRTUAL'){var _0x122fb4={};_0x122fb4[_0x484c8a['name']]={'$like':'%'+_0x44f31a[_0x66eb('0x34')][_0x66eb('0x3e')]+'%'};return _0x122fb4;}})});}_0x3309d4=_[_0x66eb('0x40')]({},_0x3309d4,_0x44f31a[_0x66eb('0x41')]);var _0x100091={'where':_0x3309d4[_0x66eb('0x3f')]};return db[_0x66eb('0x2e')][_0x66eb('0x1e')](_0x100091)[_0x66eb('0x26')](function(_0x4e5719){_0x1eaf17[_0x66eb('0x1e')]=_0x4e5719;if(_0x44f31a['query']['includeAll']){_0x3309d4['include']=[{'all':!![]}];}return db[_0x66eb('0x2e')][_0x66eb('0x42')](_0x3309d4);})[_0x66eb('0x26')](function(_0x12866a){_0x1eaf17[_0x66eb('0x43')]=_0x12866a;return _0x1eaf17;})[_0x66eb('0x26')](respondWithFilteredResult(_0x41e20a,_0x3309d4))[_0x66eb('0x44')](handleError(_0x41e20a,null));};exports[_0x66eb('0x45')]=function(_0x5e5eb8,_0x5b297e){var _0x43d9a6={'raw':!![],'where':{'id':_0x5e5eb8['params']['id']}},_0x3d6964={};_0x3d6964[_0x66eb('0x33')]=_[_0x66eb('0x46')](db['SquareDetailsReport'][_0x66eb('0x2f')]);_0x3d6964[_0x66eb('0x34')]=_[_0x66eb('0x46')](_0x5e5eb8[_0x66eb('0x34')]);_0x3d6964[_0x66eb('0x35')]=_[_0x66eb('0x36')](_0x3d6964['model'],_0x3d6964['query']);_0x43d9a6['attributes']=_[_0x66eb('0x36')](_0x3d6964[_0x66eb('0x33')],qs[_0x66eb('0x38')](_0x5e5eb8[_0x66eb('0x34')]['fields']));_0x43d9a6[_0x66eb('0x37')]=_0x43d9a6[_0x66eb('0x37')][_0x66eb('0x39')]?_0x43d9a6[_0x66eb('0x37')]:_0x3d6964[_0x66eb('0x33')];if(_0x5e5eb8[_0x66eb('0x34')][_0x66eb('0x47')]){_0x43d9a6[_0x66eb('0x48')]=[{'all':!![]}];}_0x43d9a6=_[_0x66eb('0x40')]({},_0x43d9a6,_0x5e5eb8[_0x66eb('0x41')]);return db['SquareDetailsReport'][_0x66eb('0x49')](_0x43d9a6)[_0x66eb('0x26')](handleEntityNotFound(_0x5b297e,null))[_0x66eb('0x26')](respondWithResult(_0x5b297e,null))['catch'](handleError(_0x5b297e,null));};exports[_0x66eb('0x4a')]=function(_0x12140c,_0x5ae2a2){return db[_0x66eb('0x2e')][_0x66eb('0x4a')](_0x12140c[_0x66eb('0x4b')],{})[_0x66eb('0x26')](respondWithResult(_0x5ae2a2,0xc9))[_0x66eb('0x44')](handleError(_0x5ae2a2,null));};exports['update']=function(_0x2cce1d,_0x3798ef){if(_0x2cce1d[_0x66eb('0x4b')]['id']){delete _0x2cce1d[_0x66eb('0x4b')]['id'];}return db['SquareDetailsReport'][_0x66eb('0x49')]({'where':{'id':_0x2cce1d[_0x66eb('0x4c')]['id']}})[_0x66eb('0x26')](handleEntityNotFound(_0x3798ef,null))[_0x66eb('0x26')](saveUpdates(_0x2cce1d['body'],null))['then'](respondWithResult(_0x3798ef,null))[_0x66eb('0x44')](handleError(_0x3798ef,null));};exports[_0x66eb('0x25')]=function(_0x58efe6,_0x3723dc){return db[_0x66eb('0x2e')][_0x66eb('0x49')]({'where':{'id':_0x58efe6[_0x66eb('0x4c')]['id']}})[_0x66eb('0x26')](handleEntityNotFound(_0x3723dc,null))[_0x66eb('0x26')](removeEntity(_0x3723dc,null))[_0x66eb('0x44')](handleError(_0x3723dc,null));};exports[_0x66eb('0x4d')]=function(_0x45ea3b,_0x40fc04){return db[_0x66eb('0x2e')]['describe']()[_0x66eb('0x26')](respondWithResult(_0x40fc04,null))[_0x66eb('0x44')](handleError(_0x40fc04,null));}; \ No newline at end of file +var _0xfa8c=['merge','where','VIRTUAL','options','SquareDetailsReport','includeAll','include','findAll','rows','show','params','intersection','find','create','catch','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','filter'];(function(_0x542989,_0x555e63){var _0xeeaf15=function(_0x1d271a){while(--_0x1d271a){_0x542989['push'](_0x542989['shift']());}};_0xeeaf15(++_0x555e63);}(_0xfa8c,0xb1));var _0xcfa8=function(_0xb5bc4,_0x1e1e02){_0xb5bc4=_0xb5bc4-0x0;var _0x3885ce=_0xfa8c[_0xb5bc4];return _0x3885ce;};'use strict';var emlformat=require(_0xcfa8('0x0'));var rimraf=require(_0xcfa8('0x1'));var zipdir=require(_0xcfa8('0x2'));var jsonpatch=require(_0xcfa8('0x3'));var rp=require(_0xcfa8('0x4'));var moment=require(_0xcfa8('0x5'));var BPromise=require(_0xcfa8('0x6'));var Mustache=require('mustache');var util=require(_0xcfa8('0x7'));var path=require('path');var sox=require(_0xcfa8('0x8'));var csv=require(_0xcfa8('0x9'));var ejs=require(_0xcfa8('0xa'));var fs=require('fs');var fs_extra=require(_0xcfa8('0xb'));var _=require(_0xcfa8('0xc'));var squel=require(_0xcfa8('0xd'));var crypto=require(_0xcfa8('0xe'));var jsforce=require(_0xcfa8('0xf'));var deskjs=require(_0xcfa8('0x10'));var toCsv=require(_0xcfa8('0x9'));var querystring=require(_0xcfa8('0x11'));var Papa=require('papaparse');var Redis=require(_0xcfa8('0x12'));var authService=require(_0xcfa8('0x13'));var qs=require(_0xcfa8('0x14'));var as=require(_0xcfa8('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcfa8('0x16'))(_0xcfa8('0x17'));var utils=require(_0xcfa8('0x18'));var config=require(_0xcfa8('0x19'));var licenseUtil=require(_0xcfa8('0x1a'));var db=require(_0xcfa8('0x1b'))['db'];function respondWithStatusCode(_0x288f70,_0x598f5b){_0x598f5b=_0x598f5b||0xcc;return function(_0x46c5a7){if(_0x46c5a7){return _0x288f70[_0xcfa8('0x1c')](_0x598f5b);}return _0x288f70[_0xcfa8('0x1d')](_0x598f5b)[_0xcfa8('0x1e')]();};}function respondWithResult(_0x42c1e4,_0x26a945){_0x26a945=_0x26a945||0xc8;return function(_0x228f10){if(_0x228f10){return _0x42c1e4[_0xcfa8('0x1d')](_0x26a945)[_0xcfa8('0x1f')](_0x228f10);}};}function respondWithFilteredResult(_0xd58a5a,_0x5ae498){return function(_0x57bc68){if(_0x57bc68){var _0x1defed=typeof _0x5ae498['offset']===_0xcfa8('0x20')&&typeof _0x5ae498[_0xcfa8('0x21')]===_0xcfa8('0x20');var _0x2f9afd=_0x57bc68['count'];var _0x19773b=_0x1defed?0x0:_0x5ae498[_0xcfa8('0x22')];var _0x250d61=_0x1defed?_0x57bc68[_0xcfa8('0x23')]:_0x5ae498[_0xcfa8('0x22')]+_0x5ae498[_0xcfa8('0x21')];var _0x418124;if(_0x250d61>=_0x2f9afd){_0x250d61=_0x2f9afd;_0x418124=0xc8;}else{_0x418124=0xce;}_0xd58a5a[_0xcfa8('0x1d')](_0x418124);return _0xd58a5a[_0xcfa8('0x24')](_0xcfa8('0x25'),_0x19773b+'-'+_0x250d61+'/'+_0x2f9afd)[_0xcfa8('0x1f')](_0x57bc68);}return null;};}function patchUpdates(_0x387bc5){return function(_0x41f79b){try{jsonpatch[_0xcfa8('0x26')](_0x41f79b,_0x387bc5,!![]);}catch(_0x26915f){return BPromise[_0xcfa8('0x27')](_0x26915f);}return _0x41f79b[_0xcfa8('0x28')]();};}function saveUpdates(_0xc362c1,_0x30ca01){return function(_0x440cb0){if(_0x440cb0){return _0x440cb0[_0xcfa8('0x29')](_0xc362c1)[_0xcfa8('0x2a')](function(_0x3bab2c){return _0x3bab2c;});}return null;};}function removeEntity(_0xdc2833,_0x5d6c65){return function(_0x39fcec){if(_0x39fcec){return _0x39fcec[_0xcfa8('0x2b')]()[_0xcfa8('0x2a')](function(){_0xdc2833[_0xcfa8('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48cd94,_0x464b5d){return function(_0x118366){if(!_0x118366){_0x48cd94[_0xcfa8('0x1c')](0x194);}return _0x118366;};}function handleError(_0x1c7135,_0x416b16){_0x416b16=_0x416b16||0x1f4;return function(_0x5595bf){logger[_0xcfa8('0x2c')](_0x5595bf[_0xcfa8('0x2d')]);if(_0x5595bf['name']){delete _0x5595bf['name'];}_0x1c7135[_0xcfa8('0x1d')](_0x416b16)['send'](_0x5595bf);};}exports[_0xcfa8('0x2e')]=function(_0x5e7037,_0x39b6a3){var _0x4f703e={},_0x2d12df={},_0x2cb905={'count':0x0,'rows':[]};var _0xe1fc1a=_[_0xcfa8('0x2f')](db['SquareDetailsReport'][_0xcfa8('0x30')],function(_0xb01800){return{'name':_0xb01800[_0xcfa8('0x31')],'type':_0xb01800[_0xcfa8('0x32')][_0xcfa8('0x33')]};});_0x2d12df[_0xcfa8('0x34')]=_[_0xcfa8('0x2f')](_0xe1fc1a,'name');_0x2d12df[_0xcfa8('0x35')]=_[_0xcfa8('0x36')](_0x5e7037[_0xcfa8('0x35')]);_0x2d12df[_0xcfa8('0x37')]=_['intersection'](_0x2d12df[_0xcfa8('0x34')],_0x2d12df['query']);_0x4f703e[_0xcfa8('0x38')]=_['intersection'](_0x2d12df[_0xcfa8('0x34')],qs[_0xcfa8('0x39')](_0x5e7037['query'][_0xcfa8('0x39')]));_0x4f703e[_0xcfa8('0x38')]=_0x4f703e['attributes'][_0xcfa8('0x3a')]?_0x4f703e[_0xcfa8('0x38')]:_0x2d12df[_0xcfa8('0x34')];if(!_0x5e7037['query'][_0xcfa8('0x3b')](_0xcfa8('0x3c'))){_0x4f703e[_0xcfa8('0x21')]=qs['limit'](_0x5e7037['query'][_0xcfa8('0x21')]);_0x4f703e[_0xcfa8('0x22')]=qs[_0xcfa8('0x22')](_0x5e7037['query'][_0xcfa8('0x22')]);}_0x4f703e[_0xcfa8('0x3d')]=qs['sort'](_0x5e7037['query']['sort']);_0x4f703e['where']=qs[_0xcfa8('0x37')](_['pick'](_0x5e7037[_0xcfa8('0x35')],_0x2d12df['filters']),_0xe1fc1a);if(_0x5e7037[_0xcfa8('0x35')][_0xcfa8('0x3e')]){_0x4f703e['where']=_[_0xcfa8('0x3f')](_0x4f703e[_0xcfa8('0x40')],{'$or':_[_0xcfa8('0x2f')](_0xe1fc1a,function(_0x384627){if(_0x384627[_0xcfa8('0x32')]!==_0xcfa8('0x41')){var _0x371754={};_0x371754[_0x384627['name']]={'$like':'%'+_0x5e7037[_0xcfa8('0x35')]['filter']+'%'};return _0x371754;}})});}_0x4f703e=_[_0xcfa8('0x3f')]({},_0x4f703e,_0x5e7037[_0xcfa8('0x42')]);var _0x300333={'where':_0x4f703e[_0xcfa8('0x40')]};return db[_0xcfa8('0x43')][_0xcfa8('0x23')](_0x300333)['then'](function(_0xec65a){_0x2cb905[_0xcfa8('0x23')]=_0xec65a;if(_0x5e7037['query'][_0xcfa8('0x44')]){_0x4f703e[_0xcfa8('0x45')]=[{'all':!![]}];}return db[_0xcfa8('0x43')][_0xcfa8('0x46')](_0x4f703e);})[_0xcfa8('0x2a')](function(_0x202a1f){_0x2cb905[_0xcfa8('0x47')]=_0x202a1f;return _0x2cb905;})[_0xcfa8('0x2a')](respondWithFilteredResult(_0x39b6a3,_0x4f703e))['catch'](handleError(_0x39b6a3,null));};exports[_0xcfa8('0x48')]=function(_0x481d90,_0xc0227c){var _0x582a38={'raw':!![],'where':{'id':_0x481d90[_0xcfa8('0x49')]['id']}},_0xfc0787={};_0xfc0787['model']=_['keys'](db['SquareDetailsReport'][_0xcfa8('0x30')]);_0xfc0787[_0xcfa8('0x35')]=_[_0xcfa8('0x36')](_0x481d90[_0xcfa8('0x35')]);_0xfc0787[_0xcfa8('0x37')]=_['intersection'](_0xfc0787[_0xcfa8('0x34')],_0xfc0787['query']);_0x582a38['attributes']=_[_0xcfa8('0x4a')](_0xfc0787[_0xcfa8('0x34')],qs[_0xcfa8('0x39')](_0x481d90[_0xcfa8('0x35')][_0xcfa8('0x39')]));_0x582a38[_0xcfa8('0x38')]=_0x582a38[_0xcfa8('0x38')][_0xcfa8('0x3a')]?_0x582a38[_0xcfa8('0x38')]:_0xfc0787[_0xcfa8('0x34')];if(_0x481d90[_0xcfa8('0x35')][_0xcfa8('0x44')]){_0x582a38[_0xcfa8('0x45')]=[{'all':!![]}];}_0x582a38=_[_0xcfa8('0x3f')]({},_0x582a38,_0x481d90['options']);return db['SquareDetailsReport'][_0xcfa8('0x4b')](_0x582a38)[_0xcfa8('0x2a')](handleEntityNotFound(_0xc0227c,null))[_0xcfa8('0x2a')](respondWithResult(_0xc0227c,null))['catch'](handleError(_0xc0227c,null));};exports[_0xcfa8('0x4c')]=function(_0x2a6ea5,_0x8b444a){return db[_0xcfa8('0x43')][_0xcfa8('0x4c')](_0x2a6ea5['body'],{})[_0xcfa8('0x2a')](respondWithResult(_0x8b444a,0xc9))[_0xcfa8('0x4d')](handleError(_0x8b444a,null));};exports['update']=function(_0x52f323,_0x5195d0){if(_0x52f323[_0xcfa8('0x4e')]['id']){delete _0x52f323[_0xcfa8('0x4e')]['id'];}return db[_0xcfa8('0x43')][_0xcfa8('0x4b')]({'where':{'id':_0x52f323[_0xcfa8('0x49')]['id']}})[_0xcfa8('0x2a')](handleEntityNotFound(_0x5195d0,null))['then'](saveUpdates(_0x52f323[_0xcfa8('0x4e')],null))[_0xcfa8('0x2a')](respondWithResult(_0x5195d0,null))[_0xcfa8('0x4d')](handleError(_0x5195d0,null));};exports[_0xcfa8('0x2b')]=function(_0x4df8a2,_0xb6df3){return db['SquareDetailsReport'][_0xcfa8('0x4b')]({'where':{'id':_0x4df8a2[_0xcfa8('0x49')]['id']}})[_0xcfa8('0x2a')](handleEntityNotFound(_0xb6df3,null))['then'](removeEntity(_0xb6df3,null))[_0xcfa8('0x4d')](handleError(_0xb6df3,null));};exports[_0xcfa8('0x4f')]=function(_0x2fe852,_0x371b90){return db[_0xcfa8('0x43')][_0xcfa8('0x4f')]()[_0xcfa8('0x2a')](respondWithResult(_0x371b90,null))[_0xcfa8('0x4d')](handleError(_0x371b90,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 23f50d7..b837a3b 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 _0x142b=['exports','define','report_square_details','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','./squareReportDetail.attributes'];(function(_0x243cdc,_0x5e20dc){var _0x44af44=function(_0x3cf27e){while(--_0x3cf27e){_0x243cdc['push'](_0x243cdc['shift']());}};_0x44af44(++_0x5e20dc);}(_0x142b,0xbe));var _0xb142=function(_0x2dc063,_0x368d5f){_0x2dc063=_0x2dc063-0x0;var _0x435a29=_0x142b[_0x2dc063];return _0x435a29;};'use strict';var _=require(_0xb142('0x0'));var util=require('util');var logger=require(_0xb142('0x1'))('api');var moment=require(_0xb142('0x2'));var BPromise=require(_0xb142('0x3'));var rp=require(_0xb142('0x4'));var fs=require('fs');var path=require(_0xb142('0x5'));var rimraf=require(_0xb142('0x6'));var config=require('../../config/environment');var attributes=require(_0xb142('0x7'));module[_0xb142('0x8')]=function(_0x47d4a4,_0x4c30ce){return _0x47d4a4[_0xb142('0x9')]('SquareDetailsReport',attributes,{'tableName':_0xb142('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x61cb=['path','rimraf','../../config/environment','./squareReportDetail.attributes','define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','api','bluebird'];(function(_0x5e92b7,_0x47623){var _0x2554d0=function(_0x15905b){while(--_0x15905b){_0x5e92b7['push'](_0x5e92b7['shift']());}};_0x2554d0(++_0x47623);}(_0x61cb,0x1ab));var _0xb61c=function(_0x5bf35e,_0x4ccc17){_0x5bf35e=_0x5bf35e-0x0;var _0x35b3d7=_0x61cb[_0x5bf35e];return _0x35b3d7;};'use strict';var _=require(_0xb61c('0x0'));var util=require(_0xb61c('0x1'));var logger=require(_0xb61c('0x2'))(_0xb61c('0x3'));var moment=require('moment');var BPromise=require(_0xb61c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb61c('0x5'));var rimraf=require(_0xb61c('0x6'));var config=require(_0xb61c('0x7'));var attributes=require(_0xb61c('0x8'));module['exports']=function(_0x6ba95,_0x44d7f3){return _0x6ba95[_0xb61c('0x9')](_0xb61c('0xa'),attributes,{'tableName':_0xb61c('0xb'),'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 1b225ad..ea447ac 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 _0xa7fa=['SquareDetailsReport,\x20%s,\x20%s','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','CreateSquareDetailsReport','SquareDetailsReport','create','options','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x21de89,_0x367053){var _0x290b7e=function(_0x540704){while(--_0x540704){_0x21de89['push'](_0x21de89['shift']());}};_0x290b7e(++_0x367053);}(_0xa7fa,0xfc));var _0xaa7f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa7fa[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xaa7f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xaa7f('0x1'));var rs=require(_0xaa7f('0x2'));var fs=require('fs');var Redis=require(_0xaa7f('0x3'));var db=require(_0xaa7f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xaa7f('0x5'))(_0xaa7f('0x6'));var config=require(_0xaa7f('0x7'));var jayson=require(_0xaa7f('0x8'));var client=jayson['client'][_0xaa7f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x48105b,_0x50bab6,_0x3898a3){return new BPromise(function(_0x506a91,_0x3ac236){return client[_0xaa7f('0xa')](_0x48105b,_0x3898a3)[_0xaa7f('0xb')](function(_0x2dbcb6){logger['info'](_0xaa7f('0xc'),_0x50bab6,_0xaa7f('0xd'));logger['debug'](_0xaa7f('0xe'),_0x50bab6,_0xaa7f('0xd'),JSON[_0xaa7f('0xf')](_0x2dbcb6));if(_0x2dbcb6[_0xaa7f('0x10')]){if(_0x2dbcb6['error']['code']===0x1f4){logger[_0xaa7f('0x10')](_0xaa7f('0xc'),_0x50bab6,_0x2dbcb6[_0xaa7f('0x10')][_0xaa7f('0x11')]);return _0x3ac236(_0x2dbcb6[_0xaa7f('0x10')][_0xaa7f('0x11')]);}logger[_0xaa7f('0x10')](_0xaa7f('0xc'),_0x50bab6,_0x2dbcb6[_0xaa7f('0x10')]['message']);return _0x506a91(_0x2dbcb6[_0xaa7f('0x10')]['message']);}else{logger[_0xaa7f('0x12')](_0xaa7f('0xc'),_0x50bab6,_0xaa7f('0xd'));_0x506a91(_0x2dbcb6['result'][_0xaa7f('0x11')]);}})[_0xaa7f('0x13')](function(_0x1bd3f9){logger[_0xaa7f('0x10')](_0xaa7f('0xc'),_0x50bab6,_0x1bd3f9);_0x3ac236(_0x1bd3f9);});});}exports[_0xaa7f('0x14')]=function(_0x2c17c4){var _0x4fbd09=this;return new Promise(function(_0x90863a,_0x1e18a6){return db[_0xaa7f('0x15')][_0xaa7f('0x16')](_0x2c17c4['body'],{'raw':_0x2c17c4['options']?_0x2c17c4[_0xaa7f('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xaa7f('0xb')](function(_0x21e870){logger['info'](_0xaa7f('0x14'),_0x2c17c4);logger['debug'](_0xaa7f('0x14'),_0x2c17c4,JSON[_0xaa7f('0xf')](_0x21e870));_0x90863a(_0x21e870);})[_0xaa7f('0x13')](function(_0x516d7e){logger[_0xaa7f('0x10')](_0xaa7f('0x14'),_0x516d7e[_0xaa7f('0x11')],_0x2c17c4);_0x1e18a6(_0x4fbd09[_0xaa7f('0x10')](0x1f4,_0x516d7e['message']));});});}; \ No newline at end of file +var _0x3de3=['../../config/logger','../../config/environment','jayson/promise','http','request','then','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','CreateSquareDetailsReport','create','options','raw','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x37ae7d,_0x35077c){var _0x334fa8=function(_0x5b9995){while(--_0x5b9995){_0x37ae7d['push'](_0x37ae7d['shift']());}};_0x334fa8(++_0x35077c);}(_0x3de3,0x1ce));var _0x33de=function(_0x5c01f8,_0x12529e){_0x5c01f8=_0x5c01f8-0x0;var _0x2973b9=_0x3de3[_0x5c01f8];return _0x2973b9;};'use strict';var _=require(_0x33de('0x0'));var util=require('util');var moment=require(_0x33de('0x1'));var BPromise=require(_0x33de('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x33de('0x3'));var db=require(_0x33de('0x4'))['db'];var utils=require(_0x33de('0x5'));var logger=require(_0x33de('0x6'))('rpc');var config=require(_0x33de('0x7'));var jayson=require(_0x33de('0x8'));var client=jayson['client'][_0x33de('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x587be8,_0x13afea,_0x35ee93){return new BPromise(function(_0x7ceca6,_0x486ab6){return client[_0x33de('0xa')](_0x587be8,_0x35ee93)[_0x33de('0xb')](function(_0x2e0419){logger['info'](_0x33de('0xc'),_0x13afea,_0x33de('0xd'));logger[_0x33de('0xe')](_0x33de('0xf'),_0x13afea,_0x33de('0xd'),JSON[_0x33de('0x10')](_0x2e0419));if(_0x2e0419[_0x33de('0x11')]){if(_0x2e0419[_0x33de('0x11')][_0x33de('0x12')]===0x1f4){logger[_0x33de('0x11')](_0x33de('0xc'),_0x13afea,_0x2e0419['error'][_0x33de('0x13')]);return _0x486ab6(_0x2e0419[_0x33de('0x11')]['message']);}logger['error'](_0x33de('0xc'),_0x13afea,_0x2e0419[_0x33de('0x11')][_0x33de('0x13')]);return _0x7ceca6(_0x2e0419[_0x33de('0x11')]['message']);}else{logger[_0x33de('0x14')](_0x33de('0xc'),_0x13afea,'request\x20sent');_0x7ceca6(_0x2e0419['result'][_0x33de('0x13')]);}})[_0x33de('0x15')](function(_0x13e832){logger['error'](_0x33de('0xc'),_0x13afea,_0x13e832);_0x486ab6(_0x13e832);});});}exports[_0x33de('0x16')]=function(_0x52cfa0){var _0x2815a7=this;return new Promise(function(_0x201ff3,_0x482667){return db['SquareDetailsReport'][_0x33de('0x17')](_0x52cfa0['body'],{'raw':_0x52cfa0[_0x33de('0x18')]?_0x52cfa0[_0x33de('0x18')][_0x33de('0x19')]===undefined?!![]:![]:!![]})[_0x33de('0xb')](function(_0xc4f1a4){logger[_0x33de('0x14')](_0x33de('0x16'),_0x52cfa0);logger['debug']('CreateSquareDetailsReport',_0x52cfa0,JSON[_0x33de('0x10')](_0xc4f1a4));_0x201ff3(_0xc4f1a4);})['catch'](function(_0x8acd8d){logger['error'](_0x33de('0x16'),_0x8acd8d[_0x33de('0x13')],_0x52cfa0);_0x482667(_0x2815a7['error'](0x1f4,_0x8acd8d[_0x33de('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 7b5a5c5..7122d1d 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 _0x06bf=['get','isAuthenticated','index','/process/:pid/kill','killProcess','exports','../../components/auth/service','./system.controller'];(function(_0x316a1f,_0x329415){var _0x6495eb=function(_0x235c3c){while(--_0x235c3c){_0x316a1f['push'](_0x316a1f['shift']());}};_0x6495eb(++_0x329415);}(_0x06bf,0xa6));var _0xf06b=function(_0x1fe57a,_0x47effd){_0x1fe57a=_0x1fe57a-0x0;var _0x2d510b=_0x06bf[_0x1fe57a];return _0x2d510b;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0xf06b('0x0'));var controller=require(_0xf06b('0x1'));router[_0xf06b('0x2')]('/',auth[_0xf06b('0x3')](),controller[_0xf06b('0x4')]);router[_0xf06b('0x2')](_0xf06b('0x5'),auth['isAuthenticated'](),controller[_0xf06b('0x6')]);module[_0xf06b('0x7')]=router; \ No newline at end of file +var _0xdca9=['isAuthenticated','index','killProcess','express','Router','./system.controller','get'];(function(_0xd7e544,_0x4811bf){var _0x3dbcf7=function(_0x1641e0){while(--_0x1641e0){_0xd7e544['push'](_0xd7e544['shift']());}};_0x3dbcf7(++_0x4811bf);}(_0xdca9,0x184));var _0x9dca=function(_0x3ce5d9,_0x53c843){_0x3ce5d9=_0x3ce5d9-0x0;var _0xe2b303=_0xdca9[_0x3ce5d9];return _0xe2b303;};'use strict';var express=require(_0x9dca('0x0'));var router=express[_0x9dca('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x9dca('0x2'));router[_0x9dca('0x3')]('/',auth[_0x9dca('0x4')](),controller[_0x9dca('0x5')]);router['get']('/process/:pid/kill',auth[_0x9dca('0x4')](),controller[_0x9dca('0x6')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 54a3971..b7010fe 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 _0xfffb=['send','index','getAllData','then','json','catch','killProcess','components/import/cm','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf','format','kill','SIGINT','systeminformation','child_process','exec','../../config/logger','api','util','bluebird','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status'];(function(_0xb1167f,_0x2772ba){var _0xfa37a1=function(_0xb6e24d){while(--_0xb6e24d){_0xb1167f['push'](_0xb1167f['shift']());}};_0xfa37a1(++_0x2772ba);}(_0xfffb,0x85));var _0xbfff=function(_0x27ca04,_0x49e29e){_0x27ca04=_0x27ca04-0x0;var _0x241f0f=_0xfffb[_0x27ca04];return _0x241f0f;};'use strict';var info=require(_0xbfff('0x0'));var exec=require(_0xbfff('0x1'))[_0xbfff('0x2')];var logger=require(_0xbfff('0x3'))(_0xbfff('0x4'));var util=require(_0xbfff('0x5'));var BPromise=require(_0xbfff('0x6'));var _=require('lodash');function handleError(_0x527ec7,_0x1e0c3a,_0x46ccec){_0x1e0c3a=_0x1e0c3a||0x1f4;return function(_0x4f51d8){logger[_0xbfff('0x7')](_0xbfff('0x8'),_0x46ccec,_0x1e0c3a,util[_0xbfff('0x9')](_0x4f51d8,{'showHidden':![],'depth':null}));delete _0x4f51d8[_0xbfff('0xa')];_0x527ec7[_0xbfff('0xb')](_0x1e0c3a)[_0xbfff('0xc')](_0x4f51d8);};}exports[_0xbfff('0xd')]=function(_0x570750,_0x517f79){return info[_0xbfff('0xe')]()[_0xbfff('0xf')](function(_0x324dba){return _0x517f79['status'](0xc8)[_0xbfff('0x10')](_0x324dba);})[_0xbfff('0x11')](function(_0x81635e){return _0x517f79[_0xbfff('0xb')](0x1f4)[_0xbfff('0x10')](_0x81635e);});};exports[_0xbfff('0x12')]=function(_0x4666cc,_0x20784c){var _0x4ac1e9=[_0xbfff('0x13')];return new BPromise(function(_0x25bee9,_0x3dffb9){return exec(util['format'](_0xbfff('0x14'),_0x4666cc[_0xbfff('0x15')][_0xbfff('0x16')]),function(_0x359c04,_0x48f056,_0x500c05){if(_0x359c04){return _0x3dffb9(_0x359c04);}return _0x25bee9(_0x48f056);});})[_0xbfff('0xf')](function(_0x24b658){var _0x2b3f74=![];var _0x1ff725=_0x24b658[_0xbfff('0x17')](/\n/);for(var _0x637c48=0x0,_0x1c3c93=_0x4ac1e9[_0xbfff('0x18')];_0x637c48<_0x1c3c93,_0x2b3f74===![];_0x637c48+=0x1){if(_0x24b658[_0xbfff('0x19')](_0x4ac1e9[_0x637c48])>=0x0){_0x2b3f74=!![];}}if(!_0x2b3f74){throw new Error(util[_0xbfff('0x1a')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x4666cc['params'][_0xbfff('0x16')]));}process[_0xbfff('0x1b')](_0x4666cc[_0xbfff('0x15')][_0xbfff('0x16')],_0xbfff('0x1c'));return _0x20784c['status'](0xc8)[_0xbfff('0x10')]({'message':util['format']('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x4666cc[_0xbfff('0x15')][_0xbfff('0x16')])});})['catch'](handleError(_0x20784c,null,_0xbfff('0x12')));}; \ No newline at end of file +var _0x0ca8=['name','status','send','getAllData','then','json','catch','killProcess','params','split','length','indexOf','format','Process\x20with\x20pid\x20%s\x20not\x20found!','pid','Process\x20with\x20pid\x20%s\x20killed\x20correctly','exec','../../config/logger','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0ca8,0x16e));var _0x80ca=function(_0x1444e7,_0x35b08c){_0x1444e7=_0x1444e7-0x0;var _0x195cc3=_0x0ca8[_0x1444e7];return _0x195cc3;};'use strict';var info=require('systeminformation');var exec=require('child_process')[_0x80ca('0x0')];var logger=require(_0x80ca('0x1'))(_0x80ca('0x2'));var util=require(_0x80ca('0x3'));var BPromise=require(_0x80ca('0x4'));var _=require(_0x80ca('0x5'));function handleError(_0x115f3b,_0x1626c5,_0x15e564){_0x1626c5=_0x1626c5||0x1f4;return function(_0xb9759a){logger[_0x80ca('0x6')](_0x80ca('0x7'),_0x15e564,_0x1626c5,util[_0x80ca('0x8')](_0xb9759a,{'showHidden':![],'depth':null}));delete _0xb9759a[_0x80ca('0x9')];_0x115f3b[_0x80ca('0xa')](_0x1626c5)[_0x80ca('0xb')](_0xb9759a);};}exports['index']=function(_0x4f6453,_0x5c1737){return info[_0x80ca('0xc')]()[_0x80ca('0xd')](function(_0x356bcf){return _0x5c1737[_0x80ca('0xa')](0xc8)[_0x80ca('0xe')](_0x356bcf);})[_0x80ca('0xf')](function(_0x4254eb){return _0x5c1737[_0x80ca('0xa')](0x1f4)['json'](_0x4254eb);});};exports[_0x80ca('0x10')]=function(_0x4f4e06,_0x1c4546){var _0x350fe4=['components/import/cm'];return new BPromise(function(_0x18cb57,_0x4d5475){return exec(util['format']('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x4f4e06[_0x80ca('0x11')]['pid']),function(_0x34d2b0,_0x267f0d,_0x247957){if(_0x34d2b0){return _0x4d5475(_0x34d2b0);}return _0x18cb57(_0x267f0d);});})['then'](function(_0x59cf71){var _0x4ec070=![];var _0x54bf5c=_0x59cf71[_0x80ca('0x12')](/\n/);for(var _0x231539=0x0,_0x80da9b=_0x350fe4[_0x80ca('0x13')];_0x231539<_0x80da9b,_0x4ec070===![];_0x231539+=0x1){if(_0x59cf71[_0x80ca('0x14')](_0x350fe4[_0x231539])>=0x0){_0x4ec070=!![];}}if(!_0x4ec070){throw new Error(util[_0x80ca('0x15')](_0x80ca('0x16'),_0x4f4e06['params']['pid']));}process['kill'](_0x4f4e06['params'][_0x80ca('0x17')],'SIGINT');return _0x1c4546[_0x80ca('0xa')](0xc8)[_0x80ca('0xe')]({'message':util[_0x80ca('0x15')](_0x80ca('0x18'),_0x4f4e06[_0x80ca('0x11')][_0x80ca('0x17')])});})[_0x80ca('0xf')](handleError(_0x1c4546,null,_0x80ca('0x10')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index c44b2c2..48ad294 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 _0x0ad2=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index','/:id','post','put','update','delete'];(function(_0x1f3570,_0x561ca6){var _0x2bcd0a=function(_0xa7ac87){while(--_0xa7ac87){_0x1f3570['push'](_0x1f3570['shift']());}};_0x2bcd0a(++_0x561ca6);}(_0x0ad2,0xa1));var _0x20ad=function(_0x3212b5,_0xe27e38){_0x3212b5=_0x3212b5-0x0;var _0x1130fd=_0x0ad2[_0x3212b5];return _0x1130fd;};'use strict';var multer=require(_0x20ad('0x0'));var util=require(_0x20ad('0x1'));var path=require(_0x20ad('0x2'));var timeout=require(_0x20ad('0x3'));var express=require(_0x20ad('0x4'));var router=express[_0x20ad('0x5')]();var fs_extra=require(_0x20ad('0x6'));var auth=require(_0x20ad('0x7'));var interaction=require(_0x20ad('0x8'));var config=require(_0x20ad('0x9'));var controller=require(_0x20ad('0xa'));router[_0x20ad('0xb')]('/',auth[_0x20ad('0xc')](),controller[_0x20ad('0xd')]);router[_0x20ad('0xb')](_0x20ad('0xe'),auth[_0x20ad('0xc')](),controller['show']);router[_0x20ad('0xf')]('/',auth[_0x20ad('0xc')](),controller['create']);router[_0x20ad('0x10')](_0x20ad('0xe'),auth[_0x20ad('0xc')](),controller[_0x20ad('0x11')]);router[_0x20ad('0x12')](_0x20ad('0xe'),auth[_0x20ad('0xc')](),controller['destroy']);module[_0x20ad('0x13')]=router; \ No newline at end of file +var _0x1c29=['util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','put','update','delete','exports','multer'];(function(_0x6315b7,_0x3a45b0){var _0x1bcd83=function(_0x126488){while(--_0x126488){_0x6315b7['push'](_0x6315b7['shift']());}};_0x1bcd83(++_0x3a45b0);}(_0x1c29,0xed));var _0x91c2=function(_0x946715,_0x621d33){_0x946715=_0x946715-0x0;var _0x1a8c13=_0x1c29[_0x946715];return _0x1a8c13;};'use strict';var multer=require(_0x91c2('0x0'));var util=require(_0x91c2('0x1'));var path=require('path');var timeout=require(_0x91c2('0x2'));var express=require(_0x91c2('0x3'));var router=express['Router']();var fs_extra=require(_0x91c2('0x4'));var auth=require(_0x91c2('0x5'));var interaction=require(_0x91c2('0x6'));var config=require(_0x91c2('0x7'));var controller=require('./tag.controller');router[_0x91c2('0x8')]('/',auth[_0x91c2('0x9')](),controller['index']);router[_0x91c2('0x8')](_0x91c2('0xa'),auth[_0x91c2('0x9')](),controller[_0x91c2('0xb')]);router[_0x91c2('0xc')]('/',auth[_0x91c2('0x9')](),controller['create']);router[_0x91c2('0xd')]('/:id',auth[_0x91c2('0x9')](),controller[_0x91c2('0xe')]);router[_0x91c2('0xf')](_0x91c2('0xa'),auth[_0x91c2('0x9')](),controller['destroy']);module[_0x91c2('0x10')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index a6a22f0..24c81af 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 _0x4d6e=['exports','STRING','name','sequelize'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x4d6e,0x77));var _0xe4d6=function(_0x24f326,_0x616a7){_0x24f326=_0x24f326-0x0;var _0x488e2d=_0x4d6e[_0x24f326];return _0x488e2d;};'use strict';var Sequelize=require(_0xe4d6('0x0'));module[_0xe4d6('0x1')]={'name':{'type':Sequelize[_0xe4d6('0x2')],'unique':_0xe4d6('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xe4d6('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0xe4d6('0x2')]}}; \ No newline at end of file +var _0x90db=['name','exports','STRING'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x90db,0x1c0));var _0xb90d=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x90db[_0xefd519];return _0x4bb882;};'use strict';var Sequelize=require('sequelize');module[_0xb90d('0x0')]={'name':{'type':Sequelize[_0xb90d('0x1')],'unique':_0xb90d('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':'#0091EA'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 0f5104c..050c2ec 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 _0xedd9=['userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','then','get','Tags','end','error','stack','name','send','index','map','Tag','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','includeAll','rows','catch','show','params','keys','include','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection'];(function(_0x5667b6,_0x491737){var _0x35a034=function(_0x443e42){while(--_0x443e42){_0x5667b6['push'](_0x5667b6['shift']());}};_0x35a034(++_0x491737);}(_0xedd9,0xfc));var _0x9edd=function(_0x291956,_0xee9f9d){_0x291956=_0x291956-0x0;var _0x4b874a=_0xedd9[_0x291956];return _0x4b874a;};'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(){var _0xeaf55a=_0x339a0d[_0x9edd('0x22')]({'plain':!![]});var _0x2f9f86=_0x9edd('0x23');return db['UserProfileResource']['destroy']({'where':{'type':_0x2f9f86,'resourceId':_0xeaf55a['id']}})[_0x9edd('0x21')](function(){return _0x339a0d;});})[_0x9edd('0x21')](function(){_0x44a6c1[_0x9edd('0x19')](0xcc)[_0x9edd('0x24')]();});}};}function handleEntityNotFound(_0x3c2227,_0x4fe471){return function(_0x57a2cc){if(!_0x57a2cc){_0x3c2227[_0x9edd('0x18')](0x194);}return _0x57a2cc;};}function handleError(_0x257a26,_0x1c762c){_0x1c762c=_0x1c762c||0x1f4;return function(_0x52746a){logger[_0x9edd('0x25')](_0x52746a[_0x9edd('0x26')]);if(_0x52746a[_0x9edd('0x27')]){delete _0x52746a[_0x9edd('0x27')];}_0x257a26['status'](_0x1c762c)[_0x9edd('0x28')](_0x52746a);};}exports[_0x9edd('0x29')]=function(_0xbe87e1,_0x12c1bc){var _0xbbf08f={},_0x42e664={},_0x209aba={'count':0x0,'rows':[]};var _0x1fba7b=_[_0x9edd('0x2a')](db[_0x9edd('0x2b')][_0x9edd('0x2c')],function(_0x138002){return{'name':_0x138002[_0x9edd('0x2d')],'type':_0x138002[_0x9edd('0x2e')][_0x9edd('0x2f')]};});_0x42e664['model']=_[_0x9edd('0x2a')](_0x1fba7b,_0x9edd('0x27'));_0x42e664[_0x9edd('0x30')]=_['keys'](_0xbe87e1[_0x9edd('0x30')]);_0x42e664[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x42e664[_0x9edd('0x33')],_0x42e664[_0x9edd('0x30')]);_0xbbf08f[_0x9edd('0x34')]=_[_0x9edd('0x32')](_0x42e664[_0x9edd('0x33')],qs[_0x9edd('0x35')](_0xbe87e1[_0x9edd('0x30')][_0x9edd('0x35')]));_0xbbf08f[_0x9edd('0x34')]=_0xbbf08f[_0x9edd('0x34')][_0x9edd('0x36')]?_0xbbf08f['attributes']:_0x42e664[_0x9edd('0x33')];if(!_0xbe87e1['query'][_0x9edd('0x37')](_0x9edd('0x38'))){_0xbbf08f[_0x9edd('0x1d')]=qs[_0x9edd('0x1d')](_0xbe87e1[_0x9edd('0x30')]['limit']);_0xbbf08f[_0x9edd('0x1b')]=qs[_0x9edd('0x1b')](_0xbe87e1[_0x9edd('0x30')][_0x9edd('0x1b')]);}_0xbbf08f[_0x9edd('0x39')]=qs[_0x9edd('0x3a')](_0xbe87e1[_0x9edd('0x30')][_0x9edd('0x3a')]);_0xbbf08f[_0x9edd('0x3b')]=qs[_0x9edd('0x31')](_['pick'](_0xbe87e1[_0x9edd('0x30')],_0x42e664['filters']),_0x1fba7b);if(_0xbe87e1[_0x9edd('0x30')]['filter']){_0xbbf08f[_0x9edd('0x3b')]=_[_0x9edd('0x3c')](_0xbbf08f[_0x9edd('0x3b')],{'$or':_['map'](_0x1fba7b,function(_0x2e85aa){if(_0x2e85aa[_0x9edd('0x2e')]!==_0x9edd('0x3d')){var _0x48958a={};_0x48958a[_0x2e85aa[_0x9edd('0x27')]]={'$like':'%'+_0xbe87e1['query'][_0x9edd('0x3e')]+'%'};return _0x48958a;}})});}_0xbbf08f=_[_0x9edd('0x3c')]({},_0xbbf08f,_0xbe87e1['options']);var _0x315f52={'where':_0xbbf08f[_0x9edd('0x3b')]};return db[_0x9edd('0x2b')][_0x9edd('0x1e')](_0x315f52)['then'](function(_0x449f01){_0x209aba['count']=_0x449f01;if(_0xbe87e1[_0x9edd('0x30')][_0x9edd('0x3f')]){_0xbbf08f['include']=[{'all':!![]}];}return db[_0x9edd('0x2b')]['findAll'](_0xbbf08f);})['then'](function(_0x369b69){_0x209aba[_0x9edd('0x40')]=_0x369b69;return _0x209aba;})[_0x9edd('0x21')](respondWithFilteredResult(_0x12c1bc,_0xbbf08f))[_0x9edd('0x41')](handleError(_0x12c1bc,null));};exports[_0x9edd('0x42')]=function(_0x4737ae,_0x3ff512){var _0x75efbe={'raw':!![],'where':{'id':_0x4737ae[_0x9edd('0x43')]['id']}},_0x18c149={};_0x18c149[_0x9edd('0x33')]=_[_0x9edd('0x44')](db[_0x9edd('0x2b')][_0x9edd('0x2c')]);_0x18c149[_0x9edd('0x30')]=_['keys'](_0x4737ae[_0x9edd('0x30')]);_0x18c149[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x18c149[_0x9edd('0x33')],_0x18c149[_0x9edd('0x30')]);_0x75efbe[_0x9edd('0x34')]=_[_0x9edd('0x32')](_0x18c149['model'],qs['fields'](_0x4737ae['query'][_0x9edd('0x35')]));_0x75efbe['attributes']=_0x75efbe[_0x9edd('0x34')][_0x9edd('0x36')]?_0x75efbe[_0x9edd('0x34')]:_0x18c149[_0x9edd('0x33')];if(_0x4737ae[_0x9edd('0x30')]['includeAll']){_0x75efbe[_0x9edd('0x45')]=[{'all':!![]}];}_0x75efbe=_[_0x9edd('0x3c')]({},_0x75efbe,_0x4737ae[_0x9edd('0x46')]);return db['Tag'][_0x9edd('0x47')](_0x75efbe)[_0x9edd('0x21')](handleEntityNotFound(_0x3ff512,null))[_0x9edd('0x21')](respondWithResult(_0x3ff512,null))[_0x9edd('0x41')](handleError(_0x3ff512,null));};exports[_0x9edd('0x48')]=function(_0x35bdec,_0x4d4f33){return db[_0x9edd('0x2b')][_0x9edd('0x48')](_0x35bdec['body'],{})[_0x9edd('0x21')](function(_0x8d8701){var _0x4bb324=_0x35bdec[_0x9edd('0x49')][_0x9edd('0x22')]({'plain':!![]});if(!_0x4bb324)throw new Error(_0x9edd('0x4a'));if(_0x4bb324['role']===_0x9edd('0x49')){var _0x151157=_0x8d8701[_0x9edd('0x22')]({'plain':!![]});var _0x28c7bd='Tags';return db[_0x9edd('0x4b')][_0x9edd('0x47')]({'where':{'name':_0x28c7bd,'userProfileId':_0x4bb324[_0x9edd('0x4c')]},'raw':!![]})['then'](function(_0x16951a){if(_0x16951a&&_0x16951a[_0x9edd('0x4d')]===0x0){return db['UserProfileResource'][_0x9edd('0x48')]({'name':_0x151157['name'],'resourceId':_0x151157['id'],'type':_0x16951a[_0x9edd('0x27')],'sectionId':_0x16951a['id']},{})[_0x9edd('0x21')](function(){return _0x8d8701;});}else{return _0x8d8701;}})[_0x9edd('0x41')](function(_0x3fcdf5){logger[_0x9edd('0x25')](_0x9edd('0x4e'),_0x3fcdf5);throw _0x3fcdf5;});}return _0x8d8701;})[_0x9edd('0x21')](respondWithResult(_0x4d4f33,0xc9))[_0x9edd('0x41')](handleError(_0x4d4f33,null));};exports[_0x9edd('0x4f')]=function(_0x25d9cc,_0x31272d){if(_0x25d9cc['body']['id']){delete _0x25d9cc[_0x9edd('0x50')]['id'];}return db[_0x9edd('0x2b')][_0x9edd('0x47')]({'where':{'id':_0x25d9cc['params']['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x31272d,null))['then'](saveUpdates(_0x25d9cc['body'],null))['then'](respondWithResult(_0x31272d,null))[_0x9edd('0x41')](handleError(_0x31272d,null));};exports[_0x9edd('0x51')]=function(_0x366316,_0x35ddb3){return db['Tag']['find']({'where':{'id':_0x366316['params']['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x35ddb3,null))[_0x9edd('0x21')](removeEntity(_0x35ddb3,null))[_0x9edd('0x41')](handleError(_0x35ddb3,null));}; \ No newline at end of file +var _0x049e=['map','rawAttributes','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','Tag','includeAll','include','rows','catch','show','params','options','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','Content-Range','json','reject','save','update','then','Tags','destroy','end','error','stack','name','send','index'];(function(_0x54381d,_0x247b2c){var _0x5308a7=function(_0x3ef056){while(--_0x3ef056){_0x54381d['push'](_0x54381d['shift']());}};_0x5308a7(++_0x247b2c);}(_0x049e,0x16a));var _0xe049=function(_0x3bef2c,_0x5a86fd){_0x3bef2c=_0x3bef2c-0x0;var _0x331503=_0x049e[_0x3bef2c];return _0x331503;};'use strict';var emlformat=require(_0xe049('0x0'));var rimraf=require(_0xe049('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe049('0x2'));var rp=require('request-promise');var moment=require(_0xe049('0x3'));var BPromise=require(_0xe049('0x4'));var Mustache=require(_0xe049('0x5'));var util=require(_0xe049('0x6'));var path=require(_0xe049('0x7'));var sox=require('sox');var csv=require(_0xe049('0x8'));var ejs=require(_0xe049('0x9'));var fs=require('fs');var fs_extra=require(_0xe049('0xa'));var _=require(_0xe049('0xb'));var squel=require(_0xe049('0xc'));var crypto=require(_0xe049('0xd'));var jsforce=require(_0xe049('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe049('0x8'));var querystring=require(_0xe049('0xf'));var Papa=require(_0xe049('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe049('0x11'));var as=require(_0xe049('0x12'));var hardwareService=require(_0xe049('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xe049('0x14'));var licenseUtil=require(_0xe049('0x15'));var db=require(_0xe049('0x16'))['db'];function respondWithStatusCode(_0x359931,_0x301c7e){_0x301c7e=_0x301c7e||0xcc;return function(_0x1021e7){if(_0x1021e7){return _0x359931[_0xe049('0x17')](_0x301c7e);}return _0x359931[_0xe049('0x18')](_0x301c7e)['end']();};}function respondWithResult(_0x20c286,_0x3f4a57){_0x3f4a57=_0x3f4a57||0xc8;return function(_0x3924a4){if(_0x3924a4){return _0x20c286[_0xe049('0x18')](_0x3f4a57)['json'](_0x3924a4);}};}function respondWithFilteredResult(_0x3a539b,_0xcc35b6){return function(_0x5c90fd){if(_0x5c90fd){var _0x388be0=typeof _0xcc35b6[_0xe049('0x19')]==='undefined'&&typeof _0xcc35b6[_0xe049('0x1a')]===_0xe049('0x1b');var _0x5d435b=_0x5c90fd[_0xe049('0x1c')];var _0x54c303=_0x388be0?0x0:_0xcc35b6['offset'];var _0x3cbbeb=_0x388be0?_0x5c90fd['count']:_0xcc35b6['offset']+_0xcc35b6[_0xe049('0x1a')];var _0x1092ec;if(_0x3cbbeb>=_0x5d435b){_0x3cbbeb=_0x5d435b;_0x1092ec=0xc8;}else{_0x1092ec=0xce;}_0x3a539b['status'](_0x1092ec);return _0x3a539b['set'](_0xe049('0x1d'),_0x54c303+'-'+_0x3cbbeb+'/'+_0x5d435b)[_0xe049('0x1e')](_0x5c90fd);}return null;};}function patchUpdates(_0x1d2f5b){return function(_0x430421){try{jsonpatch['apply'](_0x430421,_0x1d2f5b,!![]);}catch(_0x572f29){return BPromise[_0xe049('0x1f')](_0x572f29);}return _0x430421[_0xe049('0x20')]();};}function saveUpdates(_0x572a80,_0x36a03b){return function(_0x3f14eb){if(_0x3f14eb){return _0x3f14eb[_0xe049('0x21')](_0x572a80)['then'](function(_0x197358){return _0x197358;});}return null;};}function removeEntity(_0x3b0f54,_0x4c7492){return function(_0x4848c9){if(_0x4848c9){return _0x4848c9['destroy']()[_0xe049('0x22')](function(){var _0x5954c0=_0x4848c9['get']({'plain':!![]});var _0x1aafd1=_0xe049('0x23');return db['UserProfileResource'][_0xe049('0x24')]({'where':{'type':_0x1aafd1,'resourceId':_0x5954c0['id']}})[_0xe049('0x22')](function(){return _0x4848c9;});})[_0xe049('0x22')](function(){_0x3b0f54[_0xe049('0x18')](0xcc)[_0xe049('0x25')]();});}};}function handleEntityNotFound(_0x1843b8,_0x5b0e64){return function(_0x50552d){if(!_0x50552d){_0x1843b8[_0xe049('0x17')](0x194);}return _0x50552d;};}function handleError(_0x542c7c,_0x38ff5b){_0x38ff5b=_0x38ff5b||0x1f4;return function(_0x495d33){logger[_0xe049('0x26')](_0x495d33[_0xe049('0x27')]);if(_0x495d33['name']){delete _0x495d33[_0xe049('0x28')];}_0x542c7c[_0xe049('0x18')](_0x38ff5b)[_0xe049('0x29')](_0x495d33);};}exports[_0xe049('0x2a')]=function(_0x4464b2,_0x4055fc){var _0x123d2e={},_0x44faff={},_0x4038f0={'count':0x0,'rows':[]};var _0x1a4b97=_[_0xe049('0x2b')](db['Tag'][_0xe049('0x2c')],function(_0x1e99c8){return{'name':_0x1e99c8['fieldName'],'type':_0x1e99c8['type']['key']};});_0x44faff['model']=_[_0xe049('0x2b')](_0x1a4b97,_0xe049('0x28'));_0x44faff[_0xe049('0x2d')]=_[_0xe049('0x2e')](_0x4464b2[_0xe049('0x2d')]);_0x44faff['filters']=_[_0xe049('0x2f')](_0x44faff[_0xe049('0x30')],_0x44faff[_0xe049('0x2d')]);_0x123d2e[_0xe049('0x31')]=_[_0xe049('0x2f')](_0x44faff['model'],qs[_0xe049('0x32')](_0x4464b2['query'][_0xe049('0x32')]));_0x123d2e['attributes']=_0x123d2e[_0xe049('0x31')][_0xe049('0x33')]?_0x123d2e[_0xe049('0x31')]:_0x44faff[_0xe049('0x30')];if(!_0x4464b2[_0xe049('0x2d')][_0xe049('0x34')](_0xe049('0x35'))){_0x123d2e[_0xe049('0x1a')]=qs[_0xe049('0x1a')](_0x4464b2[_0xe049('0x2d')][_0xe049('0x1a')]);_0x123d2e['offset']=qs[_0xe049('0x19')](_0x4464b2[_0xe049('0x2d')][_0xe049('0x19')]);}_0x123d2e[_0xe049('0x36')]=qs[_0xe049('0x37')](_0x4464b2[_0xe049('0x2d')][_0xe049('0x37')]);_0x123d2e[_0xe049('0x38')]=qs['filters'](_[_0xe049('0x39')](_0x4464b2[_0xe049('0x2d')],_0x44faff[_0xe049('0x3a')]),_0x1a4b97);if(_0x4464b2[_0xe049('0x2d')][_0xe049('0x3b')]){_0x123d2e[_0xe049('0x38')]=_[_0xe049('0x3c')](_0x123d2e[_0xe049('0x38')],{'$or':_[_0xe049('0x2b')](_0x1a4b97,function(_0x3d6a4b){if(_0x3d6a4b['type']!==_0xe049('0x3d')){var _0x176374={};_0x176374[_0x3d6a4b[_0xe049('0x28')]]={'$like':'%'+_0x4464b2['query'][_0xe049('0x3b')]+'%'};return _0x176374;}})});}_0x123d2e=_['merge']({},_0x123d2e,_0x4464b2['options']);var _0x19dbc4={'where':_0x123d2e['where']};return db[_0xe049('0x3e')][_0xe049('0x1c')](_0x19dbc4)[_0xe049('0x22')](function(_0xe4f184){_0x4038f0[_0xe049('0x1c')]=_0xe4f184;if(_0x4464b2['query'][_0xe049('0x3f')]){_0x123d2e[_0xe049('0x40')]=[{'all':!![]}];}return db['Tag']['findAll'](_0x123d2e);})[_0xe049('0x22')](function(_0x20d264){_0x4038f0[_0xe049('0x41')]=_0x20d264;return _0x4038f0;})[_0xe049('0x22')](respondWithFilteredResult(_0x4055fc,_0x123d2e))[_0xe049('0x42')](handleError(_0x4055fc,null));};exports[_0xe049('0x43')]=function(_0x56a309,_0x1a4707){var _0x3f92ee={'raw':!![],'where':{'id':_0x56a309[_0xe049('0x44')]['id']}},_0x5c04f6={};_0x5c04f6[_0xe049('0x30')]=_[_0xe049('0x2e')](db[_0xe049('0x3e')][_0xe049('0x2c')]);_0x5c04f6['query']=_['keys'](_0x56a309[_0xe049('0x2d')]);_0x5c04f6[_0xe049('0x3a')]=_[_0xe049('0x2f')](_0x5c04f6[_0xe049('0x30')],_0x5c04f6[_0xe049('0x2d')]);_0x3f92ee[_0xe049('0x31')]=_['intersection'](_0x5c04f6[_0xe049('0x30')],qs[_0xe049('0x32')](_0x56a309['query'][_0xe049('0x32')]));_0x3f92ee['attributes']=_0x3f92ee[_0xe049('0x31')]['length']?_0x3f92ee[_0xe049('0x31')]:_0x5c04f6['model'];if(_0x56a309[_0xe049('0x2d')][_0xe049('0x3f')]){_0x3f92ee[_0xe049('0x40')]=[{'all':!![]}];}_0x3f92ee=_[_0xe049('0x3c')]({},_0x3f92ee,_0x56a309[_0xe049('0x45')]);return db['Tag'][_0xe049('0x46')](_0x3f92ee)[_0xe049('0x22')](handleEntityNotFound(_0x1a4707,null))[_0xe049('0x22')](respondWithResult(_0x1a4707,null))[_0xe049('0x42')](handleError(_0x1a4707,null));};exports[_0xe049('0x47')]=function(_0x3c15a2,_0x12f9b8){return db[_0xe049('0x3e')][_0xe049('0x47')](_0x3c15a2['body'],{})['then'](function(_0x478387){var _0xd1beaf=_0x3c15a2[_0xe049('0x48')][_0xe049('0x49')]({'plain':!![]});if(!_0xd1beaf)throw new Error(_0xe049('0x4a'));if(_0xd1beaf[_0xe049('0x4b')]===_0xe049('0x48')){var _0x2e4dce=_0x478387[_0xe049('0x49')]({'plain':!![]});var _0x23da27=_0xe049('0x23');return db['UserProfileSection'][_0xe049('0x46')]({'where':{'name':_0x23da27,'userProfileId':_0xd1beaf[_0xe049('0x4c')]},'raw':!![]})[_0xe049('0x22')](function(_0x4710ae){if(_0x4710ae&&_0x4710ae[_0xe049('0x4d')]===0x0){return db[_0xe049('0x4e')][_0xe049('0x47')]({'name':_0x2e4dce['name'],'resourceId':_0x2e4dce['id'],'type':_0x4710ae['name'],'sectionId':_0x4710ae['id']},{})['then'](function(){return _0x478387;});}else{return _0x478387;}})[_0xe049('0x42')](function(_0x2e508e){logger['error'](_0xe049('0x4f'),_0x2e508e);throw _0x2e508e;});}return _0x478387;})[_0xe049('0x22')](respondWithResult(_0x12f9b8,0xc9))[_0xe049('0x42')](handleError(_0x12f9b8,null));};exports[_0xe049('0x21')]=function(_0x4c3ba3,_0x5b0155){if(_0x4c3ba3[_0xe049('0x50')]['id']){delete _0x4c3ba3[_0xe049('0x50')]['id'];}return db['Tag']['find']({'where':{'id':_0x4c3ba3[_0xe049('0x44')]['id']}})['then'](handleEntityNotFound(_0x5b0155,null))[_0xe049('0x22')](saveUpdates(_0x4c3ba3[_0xe049('0x50')],null))['then'](respondWithResult(_0x5b0155,null))[_0xe049('0x42')](handleError(_0x5b0155,null));};exports['destroy']=function(_0x356605,_0x3ec963){return db['Tag'][_0xe049('0x46')]({'where':{'id':_0x356605[_0xe049('0x44')]['id']}})[_0xe049('0x22')](handleEntityNotFound(_0x3ec963,null))[_0xe049('0x22')](removeEntity(_0x3ec963,null))[_0xe049('0x42')](handleError(_0x3ec963,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index d493c07..1f0bd38 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 _0x502a=['path','../../config/environment','./tag.attributes','exports','Tag','tools_tags','lodash','util','api','moment'];(function(_0xe6066,_0x346433){var _0x32c48a=function(_0x4cbc37){while(--_0x4cbc37){_0xe6066['push'](_0xe6066['shift']());}};_0x32c48a(++_0x346433);}(_0x502a,0xd8));var _0xa502=function(_0x574fc4,_0x53dbd1){_0x574fc4=_0x574fc4-0x0;var _0x12195e=_0x502a[_0x574fc4];return _0x12195e;};'use strict';var _=require(_0xa502('0x0'));var util=require(_0xa502('0x1'));var logger=require('../../config/logger')(_0xa502('0x2'));var moment=require(_0xa502('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa502('0x4'));var rimraf=require('rimraf');var config=require(_0xa502('0x5'));var attributes=require(_0xa502('0x6'));module[_0xa502('0x7')]=function(_0x1cb2e4,_0x136d51){return _0x1cb2e4['define'](_0xa502('0x8'),attributes,{'tableName':_0xa502('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xef1a=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./tag.attributes','exports','define','Tag','tools_tags'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xef1a,0xee));var _0xaef1=function(_0x52b86f,_0x153496){_0x52b86f=_0x52b86f-0x0;var _0x2d2271=_0xef1a[_0x52b86f];return _0x2d2271;};'use strict';var _=require(_0xaef1('0x0'));var util=require(_0xaef1('0x1'));var logger=require(_0xaef1('0x2'))(_0xaef1('0x3'));var moment=require(_0xaef1('0x4'));var BPromise=require(_0xaef1('0x5'));var rp=require(_0xaef1('0x6'));var fs=require('fs');var path=require(_0xaef1('0x7'));var rimraf=require(_0xaef1('0x8'));var config=require('../../config/environment');var attributes=require(_0xaef1('0x9'));module[_0xaef1('0xa')]=function(_0x5a639b,_0x47311c){return _0x5a639b[_0xaef1('0xb')](_0xaef1('0xc'),attributes,{'tableName':_0xaef1('0xd'),'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 e6b51ad..9e42498 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 _0x0207=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','Tag,\x20%s,\x20%s','request\x20sent','Tag,\x20%s,\x20%s,\x20%s','error','code','message','util','randomstring','ioredis'];(function(_0x3e37c0,_0x549673){var _0xaa21a=function(_0x312a31){while(--_0x312a31){_0x3e37c0['push'](_0x3e37c0['shift']());}};_0xaa21a(++_0x549673);}(_0x0207,0x162));var _0x7020=function(_0x4b2975,_0x2be462){_0x4b2975=_0x4b2975-0x0;var _0x3bc9e8=_0x0207[_0x4b2975];return _0x3bc9e8;};'use strict';var _=require('lodash');var util=require(_0x7020('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7020('0x1'));var fs=require('fs');var Redis=require(_0x7020('0x2'));var db=require(_0x7020('0x3'))['db'];var utils=require(_0x7020('0x4'));var logger=require(_0x7020('0x5'))(_0x7020('0x6'));var config=require(_0x7020('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7020('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39263c,_0x3c6c11,_0x17deac){return new BPromise(function(_0x42bc79,_0x22ba3e){return client[_0x7020('0x9')](_0x39263c,_0x17deac)['then'](function(_0x5e86b5){logger[_0x7020('0xa')](_0x7020('0xb'),_0x3c6c11,_0x7020('0xc'));logger['debug'](_0x7020('0xd'),_0x3c6c11,_0x7020('0xc'),JSON['stringify'](_0x5e86b5));if(_0x5e86b5[_0x7020('0xe')]){if(_0x5e86b5[_0x7020('0xe')][_0x7020('0xf')]===0x1f4){logger['error'](_0x7020('0xb'),_0x3c6c11,_0x5e86b5[_0x7020('0xe')][_0x7020('0x10')]);return _0x22ba3e(_0x5e86b5[_0x7020('0xe')][_0x7020('0x10')]);}logger['error'](_0x7020('0xb'),_0x3c6c11,_0x5e86b5['error'][_0x7020('0x10')]);return _0x42bc79(_0x5e86b5[_0x7020('0xe')][_0x7020('0x10')]);}else{logger[_0x7020('0xa')](_0x7020('0xb'),_0x3c6c11,_0x7020('0xc'));_0x42bc79(_0x5e86b5['result'][_0x7020('0x10')]);}})['catch'](function(_0x2f4db5){logger[_0x7020('0xe')](_0x7020('0xb'),_0x3c6c11,_0x2f4db5);_0x22ba3e(_0x2f4db5);});});} \ No newline at end of file +var _0xdb94=['request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Tag,\x20%s,\x20%s','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0xdb94,0xe5));var _0x4db9=function(_0x5451a3,_0x24d7cf){_0x5451a3=_0x5451a3-0x0;var _0x3b9754=_0xdb94[_0x5451a3];return _0x3b9754;};'use strict';var _=require('lodash');var util=require(_0x4db9('0x0'));var moment=require(_0x4db9('0x1'));var BPromise=require('bluebird');var rs=require(_0x4db9('0x2'));var fs=require('fs');var Redis=require(_0x4db9('0x3'));var db=require(_0x4db9('0x4'))['db'];var utils=require(_0x4db9('0x5'));var logger=require(_0x4db9('0x6'))('rpc');var config=require(_0x4db9('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4db9('0x8')][_0x4db9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1dddb9,_0x3404f6,_0x42a857){return new BPromise(function(_0x57c701,_0x45d5a3){return client[_0x4db9('0xa')](_0x1dddb9,_0x42a857)[_0x4db9('0xb')](function(_0x3501f9){logger[_0x4db9('0xc')]('Tag,\x20%s,\x20%s',_0x3404f6,_0x4db9('0xd'));logger[_0x4db9('0xe')](_0x4db9('0xf'),_0x3404f6,_0x4db9('0xd'),JSON[_0x4db9('0x10')](_0x3501f9));if(_0x3501f9[_0x4db9('0x11')]){if(_0x3501f9['error'][_0x4db9('0x12')]===0x1f4){logger[_0x4db9('0x11')]('Tag,\x20%s,\x20%s',_0x3404f6,_0x3501f9['error'][_0x4db9('0x13')]);return _0x45d5a3(_0x3501f9[_0x4db9('0x11')][_0x4db9('0x13')]);}logger['error'](_0x4db9('0x14'),_0x3404f6,_0x3501f9[_0x4db9('0x11')][_0x4db9('0x13')]);return _0x57c701(_0x3501f9[_0x4db9('0x11')][_0x4db9('0x13')]);}else{logger['info'](_0x4db9('0x14'),_0x3404f6,_0x4db9('0xd'));_0x57c701(_0x3501f9['result'][_0x4db9('0x13')]);}})[_0x4db9('0x15')](function(_0x42fbb8){logger['error'](_0x4db9('0x14'),_0x3404f6,_0x42fbb8);_0x45d5a3(_0x42fbb8);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 79e9a3d..48816be 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(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/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 49d5ca1..84973f5 100644 --- a/server/api/team/team.attributes.js +++ b/server/api/team/team.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['name','sequelize','STRING'];(function(_0x2c775a,_0x45664d){var _0x53f71d=function(_0x4cae6c){while(--_0x4cae6c){_0x2c775a['push'](_0x2c775a['shift']());}};_0x53f71d(++_0x45664d);}(_0xb10b,0x12a));var _0xbb10=function(_0x27e2bc,_0x1f5bb1){_0x27e2bc=_0x27e2bc-0x0;var _0x303eed=_0xb10b[_0x27e2bc];return _0x303eed;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x39ad4b,_0xf52d49){var _0x48993a=function(_0x16ef17){while(--_0x16ef17){_0x39ad4b['push'](_0x39ad4b['shift']());}};_0x48993a(++_0xf52d49);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 23bef8c..e853d3c 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 _0x471a=['penalty','QueueId','TeamVoiceQueue','findOrCreate','emit','user','Queue:save','User','online','interface','upsert','format','SIP/%s','all','removeAgents','Openchannel','parse','Queue:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','to-csv','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','redis','./team.socket','register','status','end','json','offset','limit','count','set','Content-Range','apply','save','destroy','then','get','Teams','UserProfileResource','stack','name','send','map','Team','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','include','findAll','rows','catch','show','params','length','includeAll','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','findOne','channel','isValidChannel','Sequelize','ValidationError','Unknown\x20channel','Queue','capitalize','Queues','addQueues','add','toLowerCase','ids','remove','addAgents','Voice','Chat','Mail','Sms','Fax','Whatsapp','sequelize','transaction'];(function(_0x142bf3,_0xfd3b05){var _0x1663ae=function(_0x667e0f){while(--_0x667e0f){_0x142bf3['push'](_0x142bf3['shift']());}};_0x1663ae(++_0xfd3b05);}(_0x471a,0x18d));var _0xa471=function(_0x57d6b6,_0x57af69){_0x57d6b6=_0x57d6b6-0x0;var _0x4f18e0=_0x471a[_0x57d6b6];return _0x4f18e0;};'use strict';var emlformat=require(_0xa471('0x0'));var rimraf=require(_0xa471('0x1'));var zipdir=require(_0xa471('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa471('0x3'));var moment=require(_0xa471('0x4'));var BPromise=require(_0xa471('0x5'));var Mustache=require(_0xa471('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xa471('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa471('0x8'));var crypto=require(_0xa471('0x9'));var jsforce=require(_0xa471('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xa471('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa471('0xb'));var authService=require(_0xa471('0xc'));var qs=require(_0xa471('0xd'));var as=require(_0xa471('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa471('0xf'))(_0xa471('0x10'));var utils=require(_0xa471('0x11'));var config=require(_0xa471('0x12'));var licenseUtil=require(_0xa471('0x13'));var db=require(_0xa471('0x14'))['db'];config['redis']=_[_0xa471('0x15')](config['redis'],{'host':_0xa471('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa471('0x17')]));require(_0xa471('0x18'))[_0xa471('0x19')](socket);function respondWithStatusCode(_0x39c025,_0x45ef67){_0x45ef67=_0x45ef67||0xcc;return function(_0x25f5f5){if(_0x25f5f5){return _0x39c025['sendStatus'](_0x45ef67);}return _0x39c025[_0xa471('0x1a')](_0x45ef67)[_0xa471('0x1b')]();};}function respondWithResult(_0x16e5bf,_0x4297a7){_0x4297a7=_0x4297a7||0xc8;return function(_0x74b90e){if(_0x74b90e){return _0x16e5bf['status'](_0x4297a7)[_0xa471('0x1c')](_0x74b90e);}};}function respondWithFilteredResult(_0x35f2f3,_0x3ff7be){return function(_0x5e5225){if(_0x5e5225){var _0x57a8a2=typeof _0x3ff7be[_0xa471('0x1d')]==='undefined'&&typeof _0x3ff7be[_0xa471('0x1e')]==='undefined';var _0x5e56dc=_0x5e5225[_0xa471('0x1f')];var _0x3172d3=_0x57a8a2?0x0:_0x3ff7be[_0xa471('0x1d')];var _0x1952a0=_0x57a8a2?_0x5e5225[_0xa471('0x1f')]:_0x3ff7be[_0xa471('0x1d')]+_0x3ff7be[_0xa471('0x1e')];var _0x554610;if(_0x1952a0>=_0x5e56dc){_0x1952a0=_0x5e56dc;_0x554610=0xc8;}else{_0x554610=0xce;}_0x35f2f3[_0xa471('0x1a')](_0x554610);return _0x35f2f3[_0xa471('0x20')](_0xa471('0x21'),_0x3172d3+'-'+_0x1952a0+'/'+_0x5e56dc)['json'](_0x5e5225);}return null;};}function patchUpdates(_0x3e0972){return function(_0x5568c9){try{jsonpatch[_0xa471('0x22')](_0x5568c9,_0x3e0972,!![]);}catch(_0x2b7755){return BPromise['reject'](_0x2b7755);}return _0x5568c9[_0xa471('0x23')]();};}function saveUpdates(_0x41a855,_0x4debbe){return function(_0x109135){if(_0x109135){return _0x109135['update'](_0x41a855)['then'](function(_0x188d6a){return _0x188d6a;});}return null;};}function removeEntity(_0x2b1d3c,_0x56682a){return function(_0x5378d0){if(_0x5378d0){return _0x5378d0[_0xa471('0x24')]()[_0xa471('0x25')](function(){var _0x5009cf=_0x5378d0[_0xa471('0x26')]({'plain':!![]});var _0x1c6d6e=_0xa471('0x27');return db[_0xa471('0x28')]['destroy']({'where':{'type':_0x1c6d6e,'resourceId':_0x5009cf['id']}})[_0xa471('0x25')](function(){return _0x5378d0;});})[_0xa471('0x25')](function(){_0x2b1d3c['status'](0xcc)[_0xa471('0x1b')]();});}};}function handleEntityNotFound(_0x3bb318,_0x469b08){return function(_0x3961b5){if(!_0x3961b5){_0x3bb318['sendStatus'](0x194);}return _0x3961b5;};}function handleError(_0x1f309b,_0x82a9f6){_0x82a9f6=_0x82a9f6||0x1f4;return function(_0x58dbb3){logger['error'](_0x58dbb3[_0xa471('0x29')]);if(_0x58dbb3[_0xa471('0x2a')]){delete _0x58dbb3[_0xa471('0x2a')];}_0x1f309b[_0xa471('0x1a')](_0x82a9f6)[_0xa471('0x2b')](_0x58dbb3);};}exports['index']=function(_0x246db2,_0x12c68e){var _0x1bfb14={},_0x1343e9={},_0x2a9203={'count':0x0,'rows':[]};var _0xd7e5d9=_[_0xa471('0x2c')](db[_0xa471('0x2d')][_0xa471('0x2e')],function(_0x556888){return{'name':_0x556888[_0xa471('0x2f')],'type':_0x556888[_0xa471('0x30')][_0xa471('0x31')]};});_0x1343e9[_0xa471('0x32')]=_[_0xa471('0x2c')](_0xd7e5d9,'name');_0x1343e9[_0xa471('0x33')]=_[_0xa471('0x34')](_0x246db2[_0xa471('0x33')]);_0x1343e9[_0xa471('0x35')]=_[_0xa471('0x36')](_0x1343e9[_0xa471('0x32')],_0x1343e9['query']);_0x1bfb14[_0xa471('0x37')]=_[_0xa471('0x36')](_0x1343e9[_0xa471('0x32')],qs[_0xa471('0x38')](_0x246db2[_0xa471('0x33')][_0xa471('0x38')]));_0x1bfb14['attributes']=_0x1bfb14[_0xa471('0x37')]['length']?_0x1bfb14['attributes']:_0x1343e9[_0xa471('0x32')];if(!_0x246db2[_0xa471('0x33')][_0xa471('0x39')](_0xa471('0x3a'))){_0x1bfb14[_0xa471('0x1e')]=qs['limit'](_0x246db2[_0xa471('0x33')][_0xa471('0x1e')]);_0x1bfb14[_0xa471('0x1d')]=qs[_0xa471('0x1d')](_0x246db2[_0xa471('0x33')][_0xa471('0x1d')]);}_0x1bfb14[_0xa471('0x3b')]=qs['sort'](_0x246db2[_0xa471('0x33')][_0xa471('0x3c')]);_0x1bfb14['where']=qs['filters'](_[_0xa471('0x3d')](_0x246db2[_0xa471('0x33')],_0x1343e9[_0xa471('0x35')]),_0xd7e5d9);if(_0x246db2[_0xa471('0x33')][_0xa471('0x3e')]){_0x1bfb14[_0xa471('0x3f')]=_[_0xa471('0x40')](_0x1bfb14[_0xa471('0x3f')],{'$or':_[_0xa471('0x2c')](_0xd7e5d9,function(_0x5230a7){if(_0x5230a7[_0xa471('0x30')]!=='VIRTUAL'){var _0x29dd78={};_0x29dd78[_0x5230a7[_0xa471('0x2a')]]={'$like':'%'+_0x246db2[_0xa471('0x33')][_0xa471('0x3e')]+'%'};return _0x29dd78;}})});}_0x1bfb14=_[_0xa471('0x40')]({},_0x1bfb14,_0x246db2[_0xa471('0x41')]);var _0x2a1a78={'where':_0x1bfb14['where']};return db[_0xa471('0x2d')][_0xa471('0x1f')](_0x2a1a78)['then'](function(_0x38ec90){_0x2a9203[_0xa471('0x1f')]=_0x38ec90;if(_0x246db2['query']['includeAll']){_0x1bfb14[_0xa471('0x42')]=[{'all':!![]}];}return db[_0xa471('0x2d')][_0xa471('0x43')](_0x1bfb14);})[_0xa471('0x25')](function(_0x109411){_0x2a9203[_0xa471('0x44')]=_0x109411;return _0x2a9203;})[_0xa471('0x25')](respondWithFilteredResult(_0x12c68e,_0x1bfb14))[_0xa471('0x45')](handleError(_0x12c68e,null));};exports[_0xa471('0x46')]=function(_0x2798e7,_0x134d23){var _0x14affb={'raw':![],'where':{'id':_0x2798e7[_0xa471('0x47')]['id']}},_0x5c6c6c={};_0x5c6c6c[_0xa471('0x32')]=_[_0xa471('0x34')](db[_0xa471('0x2d')][_0xa471('0x2e')]);_0x5c6c6c['query']=_[_0xa471('0x34')](_0x2798e7['query']);_0x5c6c6c[_0xa471('0x35')]=_['intersection'](_0x5c6c6c[_0xa471('0x32')],_0x5c6c6c[_0xa471('0x33')]);_0x14affb[_0xa471('0x37')]=_[_0xa471('0x36')](_0x5c6c6c[_0xa471('0x32')],qs['fields'](_0x2798e7[_0xa471('0x33')]['fields']));_0x14affb[_0xa471('0x37')]=_0x14affb[_0xa471('0x37')][_0xa471('0x48')]?_0x14affb[_0xa471('0x37')]:_0x5c6c6c[_0xa471('0x32')];if(_0x2798e7['query'][_0xa471('0x49')]){_0x14affb['include']=[{'all':!![]}];}_0x14affb=_[_0xa471('0x40')]({},_0x14affb,_0x2798e7[_0xa471('0x41')]);return db['Team']['find'](_0x14affb)[_0xa471('0x25')](handleEntityNotFound(_0x134d23,null))['then'](respondWithResult(_0x134d23,null))[_0xa471('0x45')](handleError(_0x134d23,null));};exports[_0xa471('0x4a')]=function(_0x47b623,_0x44a15c){return db[_0xa471('0x2d')][_0xa471('0x4a')](_0x47b623[_0xa471('0x4b')],{})[_0xa471('0x25')](function(_0x21323b){var _0x33af2f=_0x47b623['user'][_0xa471('0x26')]({'plain':!![]});if(!_0x33af2f)throw new Error(_0xa471('0x4c'));if(_0x33af2f[_0xa471('0x4d')]==='user'){var _0x1ec159=_0x21323b[_0xa471('0x26')]({'plain':!![]});var _0x537b58=_0xa471('0x27');return db[_0xa471('0x4e')][_0xa471('0x4f')]({'where':{'name':_0x537b58,'userProfileId':_0x33af2f['userProfileId']},'raw':!![]})[_0xa471('0x25')](function(_0x10707a){if(_0x10707a&&_0x10707a[_0xa471('0x50')]===0x0){return db[_0xa471('0x28')][_0xa471('0x4a')]({'name':_0x1ec159['name'],'resourceId':_0x1ec159['id'],'type':_0x10707a[_0xa471('0x2a')],'sectionId':_0x10707a['id']},{})[_0xa471('0x25')](function(){return _0x21323b;});}else{return _0x21323b;}})['catch'](function(_0x3ca38b){logger[_0xa471('0x51')](_0xa471('0x52'),_0x3ca38b);throw _0x3ca38b;});}return _0x21323b;})[_0xa471('0x25')](respondWithResult(_0x44a15c,0xc9))[_0xa471('0x45')](handleError(_0x44a15c,null));};exports[_0xa471('0x53')]=function(_0x2aa1c7,_0xeb3bf5){if(_0x2aa1c7[_0xa471('0x4b')]['id']){delete _0x2aa1c7[_0xa471('0x4b')]['id'];}return db[_0xa471('0x2d')][_0xa471('0x4f')]({'where':{'id':_0x2aa1c7['params']['id']}})[_0xa471('0x25')](handleEntityNotFound(_0xeb3bf5,null))['then'](saveUpdates(_0x2aa1c7[_0xa471('0x4b')],null))['then'](respondWithResult(_0xeb3bf5,null))[_0xa471('0x45')](handleError(_0xeb3bf5,null));};exports[_0xa471('0x24')]=function(_0x5c4ce6,_0x5e4fb2){return db[_0xa471('0x2d')][_0xa471('0x4f')]({'where':{'id':_0x5c4ce6[_0xa471('0x47')]['id']}})[_0xa471('0x25')](handleEntityNotFound(_0x5e4fb2,null))[_0xa471('0x25')](removeEntity(_0x5e4fb2,null))['catch'](handleError(_0x5e4fb2,null));};exports['getQueues']=function(_0x1496fd,_0x4492cb,_0x177412){return db[_0xa471('0x2d')][_0xa471('0x54')]({'where':{'id':_0x1496fd[_0xa471('0x47')]['id']}})[_0xa471('0x25')](handleEntityNotFound(_0x4492cb,null))[_0xa471('0x25')](function(_0x1decb5){if(!_0x1496fd[_0xa471('0x33')][_0xa471('0x55')]||!utils[_0xa471('0x56')](_0x1496fd[_0xa471('0x33')][_0xa471('0x55')])){throw new db[(_0xa471('0x57'))][(_0xa471('0x58'))](_0xa471('0x59'));}var _0xaba23={};var _0x28856f={};_0x28856f[_0xa471('0x32')]=_[_0xa471('0x34')](db[_['capitalize'](_0x1496fd[_0xa471('0x33')]['channel']['toLowerCase']())+_0xa471('0x5a')]['rawAttributes']);_0x28856f[_0xa471('0x33')]=_[_0xa471('0x34')](_0x1496fd[_0xa471('0x33')]);_0x28856f[_0xa471('0x35')]=_[_0xa471('0x36')](_0x28856f[_0xa471('0x32')],_0x28856f[_0xa471('0x33')]);_0xaba23[_0xa471('0x37')]=_[_0xa471('0x36')](_0x28856f['model'],qs['fields'](_0x1496fd[_0xa471('0x33')][_0xa471('0x38')]));_0xaba23[_0xa471('0x37')]=_0xaba23[_0xa471('0x37')]['length']?_0xaba23[_0xa471('0x37')]:_0x28856f[_0xa471('0x32')];_0xaba23[_0xa471('0x1e')]=qs[_0xa471('0x1e')](_0x1496fd[_0xa471('0x33')][_0xa471('0x1e')]);_0xaba23[_0xa471('0x1d')]=qs[_0xa471('0x1d')](_0x1496fd[_0xa471('0x33')][_0xa471('0x1d')]);_0xaba23[_0xa471('0x3b')]=qs['sort'](_0x1496fd['query'][_0xa471('0x3c')]);_0xaba23[_0xa471('0x3f')]=qs['filters'](_[_0xa471('0x3d')](_0x1496fd[_0xa471('0x33')],_0x28856f['filters']));_0xaba23=_[_0xa471('0x40')]({},_0xaba23,_0x1496fd[_0xa471('0x41')]);return _0x1decb5[_0xa471('0x26')+_[_0xa471('0x5b')](_0x1496fd['query'][_0xa471('0x55')]['toLowerCase']())+_0xa471('0x5c')](_0xaba23);})[_0xa471('0x25')](respondWithResult(_0x4492cb,null))['catch'](handleError(_0x4492cb,null));};exports[_0xa471('0x5d')]=function(_0x1bd397,_0x54e10d,_0x6fe8b9){return db[_0xa471('0x2d')][_0xa471('0x54')]({'where':{'id':_0x1bd397[_0xa471('0x47')]['id']}})[_0xa471('0x25')](function(_0x5bad1d){if(_0x5bad1d){if(!_0x1bd397[_0xa471('0x4b')][_0xa471('0x55')]||!utils[_0xa471('0x56')](_0x1bd397['body'][_0xa471('0x55')])){throw new db[(_0xa471('0x57'))]['ValidationError'](_0xa471('0x59'));}return _0x5bad1d[_0xa471('0x5e')+_[_0xa471('0x5b')](_0x1bd397[_0xa471('0x4b')][_0xa471('0x55')][_0xa471('0x5f')]())+'Queues'](_0x1bd397[_0xa471('0x4b')][_0xa471('0x60')]);}return null;})[_0xa471('0x25')](handleEntityNotFound(_0x54e10d,null))[_0xa471('0x25')](respondWithStatusCode(_0x54e10d,null))[_0xa471('0x45')](handleError(_0x54e10d,null));};exports['removeQueues']=function(_0x2edd6a,_0x5a1be3,_0x108186){return db[_0xa471('0x2d')][_0xa471('0x54')]({'where':{'id':_0x2edd6a[_0xa471('0x47')]['id']}})['then'](function(_0x300df1){if(_0x300df1){if(!_0x2edd6a[_0xa471('0x33')][_0xa471('0x55')]||!utils['isValidChannel'](_0x2edd6a['query'][_0xa471('0x55')])){throw new db[(_0xa471('0x57'))][(_0xa471('0x58'))](_0xa471('0x59'));}return _0x300df1[_0xa471('0x61')+_[_0xa471('0x5b')](_0x2edd6a[_0xa471('0x33')][_0xa471('0x55')][_0xa471('0x5f')]())+_0xa471('0x5c')](_0x2edd6a[_0xa471('0x33')][_0xa471('0x60')]);}return null;})['then'](handleEntityNotFound(_0x5a1be3,null))[_0xa471('0x25')](respondWithStatusCode(_0x5a1be3,null))[_0xa471('0x45')](handleError(_0x5a1be3,null));};exports[_0xa471('0x62')]=function(_0x2c9df1,_0x16eb50){return db[_0xa471('0x2d')][_0xa471('0x4f')]({'where':{'id':_0x2c9df1['params']['id']}})[_0xa471('0x25')](handleEntityNotFound(_0x16eb50,null))[_0xa471('0x25')](function(_0x581a2a){if(_0x581a2a){var _0x120556=[_0xa471('0x63'),_0xa471('0x64'),_0xa471('0x65'),_0xa471('0x66'),_0xa471('0x67'),'Openchannel',_0xa471('0x68')];return db[_0xa471('0x69')][_0xa471('0x6a')](function(_0xb0d451){var _0xe2fa35=_['map'](_0x120556,function(_0x250748){var _0x4da330={'attributes':['id',_0xa471('0x2a')]};if(_0x250748==='Voice'){_0x4da330['through']={'attributes':[_0xa471('0x6b')]};}return _0x581a2a[_0xa471('0x26')+_0x250748+'Queues'](_0x4da330)[_0xa471('0x25')](function(_0x125ef8){var _0x5d607f=_[_0xa471('0x2c')](_0x125ef8,function(_0x441bd4){var _0x181af0=_[_0xa471('0x2c')](_0x2c9df1[_0xa471('0x4b')][_0xa471('0x60')],function(_0x35e32b){var _0x2c83a6={'where':{'UserId':_0x35e32b,[_0x250748+_0xa471('0x6c')]:_0x441bd4['id']},'transaction':_0xb0d451};if(_0x250748===_0xa471('0x63')){_0x2c83a6['defaults']={'penalty':_0x441bd4[_0xa471('0x6d')][_0xa471('0x6b')]};}return db['User'+_0x250748+'Queue'][_0xa471('0x6e')](_0x2c83a6)[_0xa471('0x25')](function(){socket[_0xa471('0x6f')](_0xa471('0x70')+_0x250748+_0xa471('0x71'),{'UserId':_0x35e32b,[_0x250748+'QueueId']:_0x441bd4['id']});if(_0x250748!==_0xa471('0x63'))return;return db[_0xa471('0x72')]['findAll']({'where':{'id':_0x2c9df1['body'][_0xa471('0x60')],'online':0x1},'attributes':['id','name',_0xa471('0x73'),'voicePause',_0xa471('0x74')],'raw':!![]})[_0xa471('0x25')](function(_0x56d7ff){var _0x152e0a=_[_0xa471('0x2c')](_0x56d7ff,function(_0xcdd7a4){return db['UserVoiceQueueRt'][_0xa471('0x75')]({'membername':_0xcdd7a4['name'],'UserId':_0xcdd7a4['id'],'queue_name':_0x441bd4[_0xa471('0x2a')],'VoiceQueueId':_0x441bd4['id'],'interface':_['isNil'](_0xcdd7a4[_0xa471('0x74')])?util[_0xa471('0x76')](_0xa471('0x77'),_0xcdd7a4[_0xa471('0x2a')]):_0xcdd7a4[_0xa471('0x74')],'paused':_0xcdd7a4['voicePause']||![],'penalty':_0x441bd4[_0xa471('0x6d')][_0xa471('0x6b')]},{'transaction':_0xb0d451});});return Promise[_0xa471('0x78')](_0x152e0a);});});});return Promise[_0xa471('0x78')](_0x181af0);});return Promise['all'](_0x5d607f);});});return Promise[_0xa471('0x78')](_0xe2fa35)[_0xa471('0x25')](function(){return _0x581a2a[_0xa471('0x62')](_0x2c9df1['body'][_0xa471('0x60')],{'transaction':_0xb0d451})['spread'](function(_0x1521ca){return _0x1521ca;});});});}})[_0xa471('0x25')](respondWithResult(_0x16eb50,null))[_0xa471('0x45')](handleError(_0x16eb50,null));};exports[_0xa471('0x79')]=function(_0x2d5fe1,_0x37d4fc){return db[_0xa471('0x2d')][_0xa471('0x4f')]({'where':{'id':_0x2d5fe1[_0xa471('0x47')]['id']}})['then'](handleEntityNotFound(_0x37d4fc,null))[_0xa471('0x25')](function(_0x53d18e){if(_0x53d18e){var _0x1eb97c=[_0xa471('0x63'),_0xa471('0x64'),_0xa471('0x65'),_0xa471('0x66'),'Fax',_0xa471('0x7a'),_0xa471('0x68')];return db[_0xa471('0x69')][_0xa471('0x6a')](function(_0x1a967f){var _0x330f69=_[_0xa471('0x2c')](_0x1eb97c,function(_0x49bbc8){var _0x645a78={'attributes':['id','name']};return _0x53d18e[_0xa471('0x26')+_0x49bbc8+_0xa471('0x5c')](_0x645a78)[_0xa471('0x25')](function(_0x5e5603){var _0x2db7f5=_[_0xa471('0x2c')](_0x5e5603,function(_0x712e0f){return _0x712e0f[_0xa471('0x79')](_0x2d5fe1[_0xa471('0x33')][_0xa471('0x60')],{'transaction':_0x1a967f})['then'](function(){var _0x4e452e=JSON[_0xa471('0x7b')]('['+_0x2d5fe1[_0xa471('0x33')][_0xa471('0x60')]+']');var _0x2e0818=_['map'](_0x4e452e,function(_0x3b0811){socket[_0xa471('0x6f')](_0xa471('0x70')+_0x49bbc8+_0xa471('0x7c'),{'UserId':Number(_0x3b0811),[_0x49bbc8+_0xa471('0x6c')]:_0x712e0f['id']});if(_0x49bbc8!==_0xa471('0x63'))return;return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x712e0f['id'],'UserId':_0x3b0811},'transaction':_0x1a967f});});return Promise['all'](_0x2e0818);});});return Promise[_0xa471('0x78')](_0x2db7f5);});});return Promise[_0xa471('0x78')](_0x330f69)[_0xa471('0x25')](function(){return _0x53d18e[_0xa471('0x79')](_0x2d5fe1[_0xa471('0x33')]['ids'],{'transaction':_0x1a967f});});});}})[_0xa471('0x25')](respondWithStatusCode(_0x37d4fc,null))['catch'](handleError(_0x37d4fc,null));};exports[_0xa471('0x7d')]=function(_0x251a69,_0x3b8032,_0x4a6a04){var _0x253f8a={};var _0x4f1d35={};var _0x54e6be;var _0x2e5551;return db[_0xa471('0x2d')][_0xa471('0x54')]({'where':{'id':_0x251a69[_0xa471('0x47')]['id']}})[_0xa471('0x25')](handleEntityNotFound(_0x3b8032,null))[_0xa471('0x25')](function(_0x156333){if(_0x156333){_0x54e6be=_0x156333;_0x4f1d35[_0xa471('0x32')]=_[_0xa471('0x34')](db[_0xa471('0x72')][_0xa471('0x2e')]);_0x4f1d35[_0xa471('0x33')]=_[_0xa471('0x34')](_0x251a69[_0xa471('0x33')]);_0x4f1d35[_0xa471('0x35')]=_[_0xa471('0x36')](_0x4f1d35[_0xa471('0x32')],_0x4f1d35[_0xa471('0x33')]);_0x253f8a[_0xa471('0x37')]=_[_0xa471('0x36')](_0x4f1d35[_0xa471('0x32')],qs[_0xa471('0x38')](_0x251a69['query'][_0xa471('0x38')]));_0x253f8a[_0xa471('0x37')]=_0x253f8a[_0xa471('0x37')]['length']?_0x253f8a[_0xa471('0x37')]:_0x4f1d35['model'];_0x253f8a[_0xa471('0x3b')]=qs[_0xa471('0x3c')](_0x251a69['query']['sort']);_0x253f8a[_0xa471('0x3f')]=qs[_0xa471('0x35')](_[_0xa471('0x3d')](_0x251a69['query'],_0x4f1d35[_0xa471('0x35')]));if(_0x251a69['query'][_0xa471('0x3e')]){_0x253f8a[_0xa471('0x3f')]=_[_0xa471('0x40')](_0x253f8a[_0xa471('0x3f')],{'$or':_[_0xa471('0x2c')](_0x253f8a[_0xa471('0x37')],function(_0x34b67a){var _0x4d62df={};_0x4d62df[_0x34b67a]={'$like':'%'+_0x251a69['query'][_0xa471('0x3e')]+'%'};return _0x4d62df;})});}_0x253f8a=_[_0xa471('0x40')]({},_0x253f8a,_0x251a69[_0xa471('0x41')]);return _0x54e6be[_0xa471('0x7d')](_0x253f8a);}})[_0xa471('0x25')](function(_0x358bce){if(_0x358bce){_0x2e5551=_0x358bce['length'];if(!_0x251a69[_0xa471('0x33')][_0xa471('0x39')](_0xa471('0x3a'))){_0x253f8a[_0xa471('0x1e')]=qs['limit'](_0x251a69['query'][_0xa471('0x1e')]);_0x253f8a['offset']=qs[_0xa471('0x1d')](_0x251a69[_0xa471('0x33')][_0xa471('0x1d')]);}return _0x54e6be[_0xa471('0x7d')](_0x253f8a);}})[_0xa471('0x25')](function(_0x204bde){if(_0x204bde){return _0x204bde?{'count':_0x2e5551,'rows':_0x204bde}:null;}})[_0xa471('0x25')](respondWithResult(_0x3b8032,null))[_0xa471('0x45')](handleError(_0x3b8032,null));}; \ No newline at end of file +var _0x7d14=['localhost','socket.io-emitter','./team.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','get','Teams','UserProfileResource','destroy','error','name','send','map','Team','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','rows','catch','params','keys','fields','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getQueues','findOne','channel','isValidChannel','Sequelize','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','options','Queues','add','ids','removeQueues','remove','addAgents','Voice','Chat','Mail','Sms','Fax','Whatsapp','sequelize','through','QueueId','TeamVoiceQueue','penalty','User','findOrCreate','emit','Queue:save','findAll','online','interface','UserVoiceQueueRt','upsert','format','SIP/%s','all','spread','removeAgents','Openchannel','transaction','parse','Queue:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','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','../../mysqldb','redis','defaults'];(function(_0x45a099,_0x20ea5c){var _0x557e01=function(_0x548418){while(--_0x548418){_0x45a099['push'](_0x45a099['shift']());}};_0x557e01(++_0x20ea5c);}(_0x7d14,0x6d));var _0x47d1=function(_0x598e9b,_0x2c36c0){_0x598e9b=_0x598e9b-0x0;var _0x3d8555=_0x7d14[_0x598e9b];return _0x3d8555;};'use strict';var emlformat=require(_0x47d1('0x0'));var rimraf=require(_0x47d1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47d1('0x2'));var rp=require(_0x47d1('0x3'));var moment=require(_0x47d1('0x4'));var BPromise=require(_0x47d1('0x5'));var Mustache=require('mustache');var util=require(_0x47d1('0x6'));var path=require(_0x47d1('0x7'));var sox=require(_0x47d1('0x8'));var csv=require(_0x47d1('0x9'));var ejs=require(_0x47d1('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x47d1('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x47d1('0xc'));var toCsv=require(_0x47d1('0x9'));var querystring=require(_0x47d1('0xd'));var Papa=require(_0x47d1('0xe'));var Redis=require(_0x47d1('0xf'));var authService=require(_0x47d1('0x10'));var qs=require(_0x47d1('0x11'));var as=require(_0x47d1('0x12'));var hardwareService=require(_0x47d1('0x13'));var logger=require(_0x47d1('0x14'))(_0x47d1('0x15'));var utils=require(_0x47d1('0x16'));var config=require(_0x47d1('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x47d1('0x18'))['db'];config[_0x47d1('0x19')]=_[_0x47d1('0x1a')](config[_0x47d1('0x19')],{'host':_0x47d1('0x1b'),'port':0x18eb});var socket=require(_0x47d1('0x1c'))(new Redis(config[_0x47d1('0x19')]));require(_0x47d1('0x1d'))[_0x47d1('0x1e')](socket);function respondWithStatusCode(_0x1e3895,_0x341b66){_0x341b66=_0x341b66||0xcc;return function(_0x2ff94f){if(_0x2ff94f){return _0x1e3895[_0x47d1('0x1f')](_0x341b66);}return _0x1e3895[_0x47d1('0x20')](_0x341b66)[_0x47d1('0x21')]();};}function respondWithResult(_0x22a2c7,_0x596804){_0x596804=_0x596804||0xc8;return function(_0x54ff98){if(_0x54ff98){return _0x22a2c7[_0x47d1('0x20')](_0x596804)[_0x47d1('0x22')](_0x54ff98);}};}function respondWithFilteredResult(_0x54ccc5,_0x3235e6){return function(_0x540a61){if(_0x540a61){var _0x55b0a8=typeof _0x3235e6[_0x47d1('0x23')]===_0x47d1('0x24')&&typeof _0x3235e6[_0x47d1('0x25')]===_0x47d1('0x24');var _0x54ca37=_0x540a61[_0x47d1('0x26')];var _0x58452c=_0x55b0a8?0x0:_0x3235e6[_0x47d1('0x23')];var _0x5fbdff=_0x55b0a8?_0x540a61[_0x47d1('0x26')]:_0x3235e6['offset']+_0x3235e6[_0x47d1('0x25')];var _0x4260a0;if(_0x5fbdff>=_0x54ca37){_0x5fbdff=_0x54ca37;_0x4260a0=0xc8;}else{_0x4260a0=0xce;}_0x54ccc5[_0x47d1('0x20')](_0x4260a0);return _0x54ccc5[_0x47d1('0x27')]('Content-Range',_0x58452c+'-'+_0x5fbdff+'/'+_0x54ca37)[_0x47d1('0x22')](_0x540a61);}return null;};}function patchUpdates(_0x474911){return function(_0x2d8e1a){try{jsonpatch[_0x47d1('0x28')](_0x2d8e1a,_0x474911,!![]);}catch(_0x5de4d1){return BPromise[_0x47d1('0x29')](_0x5de4d1);}return _0x2d8e1a[_0x47d1('0x2a')]();};}function saveUpdates(_0x4e6ed3,_0x10bfe6){return function(_0x43bbed){if(_0x43bbed){return _0x43bbed[_0x47d1('0x2b')](_0x4e6ed3)[_0x47d1('0x2c')](function(_0x244038){return _0x244038;});}return null;};}function removeEntity(_0x4aece8,_0x4710bd){return function(_0x4a0871){if(_0x4a0871){return _0x4a0871['destroy']()[_0x47d1('0x2c')](function(){var _0x3e07f7=_0x4a0871[_0x47d1('0x2d')]({'plain':!![]});var _0x4671f0=_0x47d1('0x2e');return db[_0x47d1('0x2f')][_0x47d1('0x30')]({'where':{'type':_0x4671f0,'resourceId':_0x3e07f7['id']}})[_0x47d1('0x2c')](function(){return _0x4a0871;});})['then'](function(){_0x4aece8[_0x47d1('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ce24e,_0x3d3573){return function(_0x172307){if(!_0x172307){_0x3ce24e[_0x47d1('0x1f')](0x194);}return _0x172307;};}function handleError(_0x445f39,_0x1009f7){_0x1009f7=_0x1009f7||0x1f4;return function(_0x31d56b){logger[_0x47d1('0x31')](_0x31d56b['stack']);if(_0x31d56b['name']){delete _0x31d56b[_0x47d1('0x32')];}_0x445f39[_0x47d1('0x20')](_0x1009f7)[_0x47d1('0x33')](_0x31d56b);};}exports['index']=function(_0x9efd5d,_0x45a77d){var _0x368d36={},_0x46b236={},_0x17c8e7={'count':0x0,'rows':[]};var _0x5b7229=_[_0x47d1('0x34')](db[_0x47d1('0x35')][_0x47d1('0x36')],function(_0x55ebe1){return{'name':_0x55ebe1[_0x47d1('0x37')],'type':_0x55ebe1[_0x47d1('0x38')][_0x47d1('0x39')]};});_0x46b236[_0x47d1('0x3a')]=_[_0x47d1('0x34')](_0x5b7229,_0x47d1('0x32'));_0x46b236['query']=_['keys'](_0x9efd5d['query']);_0x46b236[_0x47d1('0x3b')]=_[_0x47d1('0x3c')](_0x46b236[_0x47d1('0x3a')],_0x46b236[_0x47d1('0x3d')]);_0x368d36['attributes']=_[_0x47d1('0x3c')](_0x46b236[_0x47d1('0x3a')],qs['fields'](_0x9efd5d[_0x47d1('0x3d')]['fields']));_0x368d36[_0x47d1('0x3e')]=_0x368d36[_0x47d1('0x3e')]['length']?_0x368d36[_0x47d1('0x3e')]:_0x46b236[_0x47d1('0x3a')];if(!_0x9efd5d[_0x47d1('0x3d')][_0x47d1('0x3f')](_0x47d1('0x40'))){_0x368d36['limit']=qs[_0x47d1('0x25')](_0x9efd5d['query'][_0x47d1('0x25')]);_0x368d36[_0x47d1('0x23')]=qs[_0x47d1('0x23')](_0x9efd5d[_0x47d1('0x3d')][_0x47d1('0x23')]);}_0x368d36[_0x47d1('0x41')]=qs[_0x47d1('0x42')](_0x9efd5d[_0x47d1('0x3d')][_0x47d1('0x42')]);_0x368d36[_0x47d1('0x43')]=qs[_0x47d1('0x3b')](_[_0x47d1('0x44')](_0x9efd5d[_0x47d1('0x3d')],_0x46b236[_0x47d1('0x3b')]),_0x5b7229);if(_0x9efd5d[_0x47d1('0x3d')][_0x47d1('0x45')]){_0x368d36[_0x47d1('0x43')]=_[_0x47d1('0x46')](_0x368d36[_0x47d1('0x43')],{'$or':_[_0x47d1('0x34')](_0x5b7229,function(_0xde6a84){if(_0xde6a84[_0x47d1('0x38')]!==_0x47d1('0x47')){var _0x623a57={};_0x623a57[_0xde6a84[_0x47d1('0x32')]]={'$like':'%'+_0x9efd5d[_0x47d1('0x3d')][_0x47d1('0x45')]+'%'};return _0x623a57;}})});}_0x368d36=_[_0x47d1('0x46')]({},_0x368d36,_0x9efd5d['options']);var _0x47fc1a={'where':_0x368d36[_0x47d1('0x43')]};return db[_0x47d1('0x35')][_0x47d1('0x26')](_0x47fc1a)['then'](function(_0x3906fb){_0x17c8e7[_0x47d1('0x26')]=_0x3906fb;if(_0x9efd5d[_0x47d1('0x3d')][_0x47d1('0x48')]){_0x368d36['include']=[{'all':!![]}];}return db[_0x47d1('0x35')]['findAll'](_0x368d36);})['then'](function(_0x990855){_0x17c8e7[_0x47d1('0x49')]=_0x990855;return _0x17c8e7;})[_0x47d1('0x2c')](respondWithFilteredResult(_0x45a77d,_0x368d36))[_0x47d1('0x4a')](handleError(_0x45a77d,null));};exports['show']=function(_0x3bcbee,_0x326343){var _0x11efc0={'raw':![],'where':{'id':_0x3bcbee[_0x47d1('0x4b')]['id']}},_0x5ca38f={};_0x5ca38f[_0x47d1('0x3a')]=_[_0x47d1('0x4c')](db['Team']['rawAttributes']);_0x5ca38f[_0x47d1('0x3d')]=_[_0x47d1('0x4c')](_0x3bcbee[_0x47d1('0x3d')]);_0x5ca38f[_0x47d1('0x3b')]=_['intersection'](_0x5ca38f[_0x47d1('0x3a')],_0x5ca38f['query']);_0x11efc0['attributes']=_[_0x47d1('0x3c')](_0x5ca38f['model'],qs['fields'](_0x3bcbee['query'][_0x47d1('0x4d')]));_0x11efc0[_0x47d1('0x3e')]=_0x11efc0[_0x47d1('0x3e')][_0x47d1('0x4e')]?_0x11efc0[_0x47d1('0x3e')]:_0x5ca38f[_0x47d1('0x3a')];if(_0x3bcbee['query'][_0x47d1('0x48')]){_0x11efc0[_0x47d1('0x4f')]=[{'all':!![]}];}_0x11efc0=_[_0x47d1('0x46')]({},_0x11efc0,_0x3bcbee['options']);return db[_0x47d1('0x35')][_0x47d1('0x50')](_0x11efc0)['then'](handleEntityNotFound(_0x326343,null))[_0x47d1('0x2c')](respondWithResult(_0x326343,null))[_0x47d1('0x4a')](handleError(_0x326343,null));};exports['create']=function(_0x1039c3,_0x5666e6){return db[_0x47d1('0x35')][_0x47d1('0x51')](_0x1039c3[_0x47d1('0x52')],{})[_0x47d1('0x2c')](function(_0x51e4bf){var _0x272ff8=_0x1039c3[_0x47d1('0x53')][_0x47d1('0x2d')]({'plain':!![]});if(!_0x272ff8)throw new Error(_0x47d1('0x54'));if(_0x272ff8[_0x47d1('0x55')]===_0x47d1('0x53')){var _0x2d5647=_0x51e4bf[_0x47d1('0x2d')]({'plain':!![]});var _0x28b9eb=_0x47d1('0x2e');return db['UserProfileSection'][_0x47d1('0x50')]({'where':{'name':_0x28b9eb,'userProfileId':_0x272ff8[_0x47d1('0x56')]},'raw':!![]})['then'](function(_0x2609ac){if(_0x2609ac&&_0x2609ac[_0x47d1('0x57')]===0x0){return db[_0x47d1('0x2f')][_0x47d1('0x51')]({'name':_0x2d5647[_0x47d1('0x32')],'resourceId':_0x2d5647['id'],'type':_0x2609ac['name'],'sectionId':_0x2609ac['id']},{})[_0x47d1('0x2c')](function(){return _0x51e4bf;});}else{return _0x51e4bf;}})[_0x47d1('0x4a')](function(_0x2d4ad8){logger['error'](_0x47d1('0x58'),_0x2d4ad8);throw _0x2d4ad8;});}return _0x51e4bf;})[_0x47d1('0x2c')](respondWithResult(_0x5666e6,0xc9))[_0x47d1('0x4a')](handleError(_0x5666e6,null));};exports['update']=function(_0x240490,_0x2512fb){if(_0x240490[_0x47d1('0x52')]['id']){delete _0x240490[_0x47d1('0x52')]['id'];}return db[_0x47d1('0x35')]['find']({'where':{'id':_0x240490['params']['id']}})[_0x47d1('0x2c')](handleEntityNotFound(_0x2512fb,null))[_0x47d1('0x2c')](saveUpdates(_0x240490[_0x47d1('0x52')],null))[_0x47d1('0x2c')](respondWithResult(_0x2512fb,null))['catch'](handleError(_0x2512fb,null));};exports['destroy']=function(_0x173a18,_0x12fa78){return db[_0x47d1('0x35')][_0x47d1('0x50')]({'where':{'id':_0x173a18[_0x47d1('0x4b')]['id']}})[_0x47d1('0x2c')](handleEntityNotFound(_0x12fa78,null))['then'](removeEntity(_0x12fa78,null))['catch'](handleError(_0x12fa78,null));};exports[_0x47d1('0x59')]=function(_0x588a76,_0x6a5981,_0x29a39c){return db[_0x47d1('0x35')][_0x47d1('0x5a')]({'where':{'id':_0x588a76[_0x47d1('0x4b')]['id']}})[_0x47d1('0x2c')](handleEntityNotFound(_0x6a5981,null))[_0x47d1('0x2c')](function(_0x2ce0a7){if(!_0x588a76['query'][_0x47d1('0x5b')]||!utils[_0x47d1('0x5c')](_0x588a76[_0x47d1('0x3d')][_0x47d1('0x5b')])){throw new db[(_0x47d1('0x5d'))][(_0x47d1('0x5e'))](_0x47d1('0x5f'));}var _0x3b47e3={};var _0x2136cf={};_0x2136cf['model']=_['keys'](db[_[_0x47d1('0x60')](_0x588a76[_0x47d1('0x3d')][_0x47d1('0x5b')][_0x47d1('0x61')]())+_0x47d1('0x62')][_0x47d1('0x36')]);_0x2136cf[_0x47d1('0x3d')]=_[_0x47d1('0x4c')](_0x588a76[_0x47d1('0x3d')]);_0x2136cf[_0x47d1('0x3b')]=_[_0x47d1('0x3c')](_0x2136cf[_0x47d1('0x3a')],_0x2136cf[_0x47d1('0x3d')]);_0x3b47e3[_0x47d1('0x3e')]=_[_0x47d1('0x3c')](_0x2136cf['model'],qs[_0x47d1('0x4d')](_0x588a76[_0x47d1('0x3d')][_0x47d1('0x4d')]));_0x3b47e3[_0x47d1('0x3e')]=_0x3b47e3['attributes'][_0x47d1('0x4e')]?_0x3b47e3[_0x47d1('0x3e')]:_0x2136cf[_0x47d1('0x3a')];_0x3b47e3['limit']=qs[_0x47d1('0x25')](_0x588a76[_0x47d1('0x3d')][_0x47d1('0x25')]);_0x3b47e3[_0x47d1('0x23')]=qs[_0x47d1('0x23')](_0x588a76[_0x47d1('0x3d')][_0x47d1('0x23')]);_0x3b47e3[_0x47d1('0x41')]=qs[_0x47d1('0x42')](_0x588a76[_0x47d1('0x3d')][_0x47d1('0x42')]);_0x3b47e3['where']=qs[_0x47d1('0x3b')](_[_0x47d1('0x44')](_0x588a76[_0x47d1('0x3d')],_0x2136cf[_0x47d1('0x3b')]));_0x3b47e3=_[_0x47d1('0x46')]({},_0x3b47e3,_0x588a76[_0x47d1('0x63')]);return _0x2ce0a7[_0x47d1('0x2d')+_[_0x47d1('0x60')](_0x588a76[_0x47d1('0x3d')][_0x47d1('0x5b')]['toLowerCase']())+_0x47d1('0x64')](_0x3b47e3);})['then'](respondWithResult(_0x6a5981,null))['catch'](handleError(_0x6a5981,null));};exports['addQueues']=function(_0x3ae427,_0x2a6cce,_0x134d3e){return db[_0x47d1('0x35')]['findOne']({'where':{'id':_0x3ae427[_0x47d1('0x4b')]['id']}})[_0x47d1('0x2c')](function(_0x299043){if(_0x299043){if(!_0x3ae427[_0x47d1('0x52')][_0x47d1('0x5b')]||!utils[_0x47d1('0x5c')](_0x3ae427['body'][_0x47d1('0x5b')])){throw new db[(_0x47d1('0x5d'))][(_0x47d1('0x5e'))](_0x47d1('0x5f'));}return _0x299043[_0x47d1('0x65')+_[_0x47d1('0x60')](_0x3ae427[_0x47d1('0x52')]['channel'][_0x47d1('0x61')]())+'Queues'](_0x3ae427[_0x47d1('0x52')][_0x47d1('0x66')]);}return null;})[_0x47d1('0x2c')](handleEntityNotFound(_0x2a6cce,null))[_0x47d1('0x2c')](respondWithStatusCode(_0x2a6cce,null))[_0x47d1('0x4a')](handleError(_0x2a6cce,null));};exports[_0x47d1('0x67')]=function(_0x53b12e,_0x5abb8d,_0x478ea4){return db['Team'][_0x47d1('0x5a')]({'where':{'id':_0x53b12e[_0x47d1('0x4b')]['id']}})['then'](function(_0x1290f4){if(_0x1290f4){if(!_0x53b12e['query'][_0x47d1('0x5b')]||!utils['isValidChannel'](_0x53b12e[_0x47d1('0x3d')]['channel'])){throw new db[(_0x47d1('0x5d'))][(_0x47d1('0x5e'))](_0x47d1('0x5f'));}return _0x1290f4[_0x47d1('0x68')+_[_0x47d1('0x60')](_0x53b12e['query'][_0x47d1('0x5b')][_0x47d1('0x61')]())+_0x47d1('0x64')](_0x53b12e[_0x47d1('0x3d')][_0x47d1('0x66')]);}return null;})[_0x47d1('0x2c')](handleEntityNotFound(_0x5abb8d,null))[_0x47d1('0x2c')](respondWithStatusCode(_0x5abb8d,null))[_0x47d1('0x4a')](handleError(_0x5abb8d,null));};exports[_0x47d1('0x69')]=function(_0x4ed93a,_0x16bd4f){return db[_0x47d1('0x35')]['find']({'where':{'id':_0x4ed93a['params']['id']}})[_0x47d1('0x2c')](handleEntityNotFound(_0x16bd4f,null))['then'](function(_0x237654){if(_0x237654){var _0x544e7c=[_0x47d1('0x6a'),_0x47d1('0x6b'),_0x47d1('0x6c'),_0x47d1('0x6d'),_0x47d1('0x6e'),'Openchannel',_0x47d1('0x6f')];return db[_0x47d1('0x70')]['transaction'](function(_0x3e696b){var _0x1ebc9d=_['map'](_0x544e7c,function(_0x4ed570){var _0x233d28={'attributes':['id',_0x47d1('0x32')]};if(_0x4ed570===_0x47d1('0x6a')){_0x233d28[_0x47d1('0x71')]={'attributes':['penalty']};}return _0x237654[_0x47d1('0x2d')+_0x4ed570+_0x47d1('0x64')](_0x233d28)['then'](function(_0x60f45){var _0x1fd95b=_[_0x47d1('0x34')](_0x60f45,function(_0x33db32){var _0x541859=_[_0x47d1('0x34')](_0x4ed93a[_0x47d1('0x52')][_0x47d1('0x66')],function(_0x3e859c){var _0x1c95de={'where':{'UserId':_0x3e859c,[_0x4ed570+_0x47d1('0x72')]:_0x33db32['id']},'transaction':_0x3e696b};if(_0x4ed570===_0x47d1('0x6a')){_0x1c95de[_0x47d1('0x1a')]={'penalty':_0x33db32[_0x47d1('0x73')][_0x47d1('0x74')]};}return db[_0x47d1('0x75')+_0x4ed570+_0x47d1('0x62')][_0x47d1('0x76')](_0x1c95de)[_0x47d1('0x2c')](function(){socket[_0x47d1('0x77')](_0x47d1('0x53')+_0x4ed570+_0x47d1('0x78'),{'UserId':_0x3e859c,[_0x4ed570+'QueueId']:_0x33db32['id']});if(_0x4ed570!=='Voice')return;return db[_0x47d1('0x75')][_0x47d1('0x79')]({'where':{'id':_0x4ed93a[_0x47d1('0x52')][_0x47d1('0x66')],'online':0x1},'attributes':['id','name',_0x47d1('0x7a'),'voicePause',_0x47d1('0x7b')],'raw':!![]})['then'](function(_0x1cb27d){var _0x5e92a5=_[_0x47d1('0x34')](_0x1cb27d,function(_0x3ee350){return db[_0x47d1('0x7c')][_0x47d1('0x7d')]({'membername':_0x3ee350[_0x47d1('0x32')],'UserId':_0x3ee350['id'],'queue_name':_0x33db32[_0x47d1('0x32')],'VoiceQueueId':_0x33db32['id'],'interface':_['isNil'](_0x3ee350[_0x47d1('0x7b')])?util[_0x47d1('0x7e')](_0x47d1('0x7f'),_0x3ee350[_0x47d1('0x32')]):_0x3ee350[_0x47d1('0x7b')],'paused':_0x3ee350['voicePause']||![],'penalty':_0x33db32[_0x47d1('0x73')][_0x47d1('0x74')]},{'transaction':_0x3e696b});});return Promise[_0x47d1('0x80')](_0x5e92a5);});});});return Promise[_0x47d1('0x80')](_0x541859);});return Promise[_0x47d1('0x80')](_0x1fd95b);});});return Promise['all'](_0x1ebc9d)['then'](function(){return _0x237654[_0x47d1('0x69')](_0x4ed93a[_0x47d1('0x52')][_0x47d1('0x66')],{'transaction':_0x3e696b})[_0x47d1('0x81')](function(_0x298102){return _0x298102;});});});}})[_0x47d1('0x2c')](respondWithResult(_0x16bd4f,null))[_0x47d1('0x4a')](handleError(_0x16bd4f,null));};exports[_0x47d1('0x82')]=function(_0x57d722,_0x51a6f5){return db[_0x47d1('0x35')]['find']({'where':{'id':_0x57d722[_0x47d1('0x4b')]['id']}})['then'](handleEntityNotFound(_0x51a6f5,null))[_0x47d1('0x2c')](function(_0xe7802){if(_0xe7802){var _0xed605f=[_0x47d1('0x6a'),_0x47d1('0x6b'),_0x47d1('0x6c'),_0x47d1('0x6d'),_0x47d1('0x6e'),_0x47d1('0x83'),_0x47d1('0x6f')];return db[_0x47d1('0x70')][_0x47d1('0x84')](function(_0x1b994f){var _0x2a670f=_['map'](_0xed605f,function(_0x330260){var _0x4c6ce5={'attributes':['id','name']};return _0xe7802['get'+_0x330260+'Queues'](_0x4c6ce5)[_0x47d1('0x2c')](function(_0x480b0c){var _0x20e8b5=_[_0x47d1('0x34')](_0x480b0c,function(_0x164e34){return _0x164e34[_0x47d1('0x82')](_0x57d722['query'][_0x47d1('0x66')],{'transaction':_0x1b994f})['then'](function(){var _0x35fc56=JSON[_0x47d1('0x85')]('['+_0x57d722[_0x47d1('0x3d')]['ids']+']');var _0x1631eb=_[_0x47d1('0x34')](_0x35fc56,function(_0x4b1d8a){socket[_0x47d1('0x77')](_0x47d1('0x53')+_0x330260+_0x47d1('0x86'),{'UserId':Number(_0x4b1d8a),[_0x330260+_0x47d1('0x72')]:_0x164e34['id']});if(_0x330260!==_0x47d1('0x6a'))return;return db['UserVoiceQueueRt'][_0x47d1('0x30')]({'where':{'VoiceQueueId':_0x164e34['id'],'UserId':_0x4b1d8a},'transaction':_0x1b994f});});return Promise[_0x47d1('0x80')](_0x1631eb);});});return Promise['all'](_0x20e8b5);});});return Promise[_0x47d1('0x80')](_0x2a670f)['then'](function(){return _0xe7802[_0x47d1('0x82')](_0x57d722[_0x47d1('0x3d')][_0x47d1('0x66')],{'transaction':_0x1b994f});});});}})[_0x47d1('0x2c')](respondWithStatusCode(_0x51a6f5,null))[_0x47d1('0x4a')](handleError(_0x51a6f5,null));};exports[_0x47d1('0x87')]=function(_0x4478a9,_0x5a2301,_0x9b53f2){var _0x5ac9b5={};var _0x53e694={};var _0x45bc79;var _0x25c2be;return db[_0x47d1('0x35')][_0x47d1('0x5a')]({'where':{'id':_0x4478a9[_0x47d1('0x4b')]['id']}})[_0x47d1('0x2c')](handleEntityNotFound(_0x5a2301,null))[_0x47d1('0x2c')](function(_0x3702e0){if(_0x3702e0){_0x45bc79=_0x3702e0;_0x53e694[_0x47d1('0x3a')]=_[_0x47d1('0x4c')](db[_0x47d1('0x75')][_0x47d1('0x36')]);_0x53e694[_0x47d1('0x3d')]=_[_0x47d1('0x4c')](_0x4478a9[_0x47d1('0x3d')]);_0x53e694['filters']=_[_0x47d1('0x3c')](_0x53e694[_0x47d1('0x3a')],_0x53e694[_0x47d1('0x3d')]);_0x5ac9b5[_0x47d1('0x3e')]=_['intersection'](_0x53e694[_0x47d1('0x3a')],qs[_0x47d1('0x4d')](_0x4478a9[_0x47d1('0x3d')][_0x47d1('0x4d')]));_0x5ac9b5[_0x47d1('0x3e')]=_0x5ac9b5[_0x47d1('0x3e')][_0x47d1('0x4e')]?_0x5ac9b5['attributes']:_0x53e694['model'];_0x5ac9b5[_0x47d1('0x41')]=qs[_0x47d1('0x42')](_0x4478a9[_0x47d1('0x3d')][_0x47d1('0x42')]);_0x5ac9b5[_0x47d1('0x43')]=qs[_0x47d1('0x3b')](_[_0x47d1('0x44')](_0x4478a9['query'],_0x53e694[_0x47d1('0x3b')]));if(_0x4478a9[_0x47d1('0x3d')][_0x47d1('0x45')]){_0x5ac9b5[_0x47d1('0x43')]=_[_0x47d1('0x46')](_0x5ac9b5[_0x47d1('0x43')],{'$or':_[_0x47d1('0x34')](_0x5ac9b5[_0x47d1('0x3e')],function(_0x48ba1d){var _0x483c8d={};_0x483c8d[_0x48ba1d]={'$like':'%'+_0x4478a9[_0x47d1('0x3d')][_0x47d1('0x45')]+'%'};return _0x483c8d;})});}_0x5ac9b5=_[_0x47d1('0x46')]({},_0x5ac9b5,_0x4478a9[_0x47d1('0x63')]);return _0x45bc79[_0x47d1('0x87')](_0x5ac9b5);}})['then'](function(_0xbc71af){if(_0xbc71af){_0x25c2be=_0xbc71af[_0x47d1('0x4e')];if(!_0x4478a9['query'][_0x47d1('0x3f')](_0x47d1('0x40'))){_0x5ac9b5[_0x47d1('0x25')]=qs[_0x47d1('0x25')](_0x4478a9[_0x47d1('0x3d')][_0x47d1('0x25')]);_0x5ac9b5['offset']=qs[_0x47d1('0x23')](_0x4478a9[_0x47d1('0x3d')][_0x47d1('0x23')]);}return _0x45bc79[_0x47d1('0x87')](_0x5ac9b5);}})[_0x47d1('0x2c')](function(_0x28f98e){if(_0x28f98e){return _0x28f98e?{'count':_0x25c2be,'rows':_0x28f98e}:null;}})['then'](respondWithResult(_0x5a2301,null))[_0x47d1('0x4a')](handleError(_0x5a2301,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index e552b4b..5c5c415 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 _0xd8d1=['hook','exports','events','../../mysqldb','Team','save','update','emit','hasOwnProperty'];(function(_0x102efd,_0x58d7ed){var _0x216daa=function(_0x1bdfb1){while(--_0x1bdfb1){_0x102efd['push'](_0x102efd['shift']());}};_0x216daa(++_0x58d7ed);}(_0xd8d1,0xc8));var _0x1d8d=function(_0x354173,_0x496194){_0x354173=_0x354173-0x0;var _0x25675f=_0xd8d1[_0x354173];return _0x25675f;};'use strict';var EventEmitter=require(_0x1d8d('0x0'));var Team=require(_0x1d8d('0x1'))['db'][_0x1d8d('0x2')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1d8d('0x3'),'afterUpdate':_0x1d8d('0x4'),'afterDestroy':'remove'};function emitEvent(_0x233e04){return function(_0x988cca,_0xe409e7,_0x481efd){TeamEvents[_0x1d8d('0x5')](_0x233e04+':'+_0x988cca['id'],_0x988cca);TeamEvents[_0x1d8d('0x5')](_0x233e04,_0x988cca);_0x481efd(null);};}for(var e in events){if(events[_0x1d8d('0x6')](e)){var event=events[e];Team[_0x1d8d('0x7')](e,emitEvent(event));}}module[_0x1d8d('0x8')]=TeamEvents; \ No newline at end of file +var _0x49fe=['hook','exports','events','../../mysqldb','Team','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x1a33f0,_0x288a63){var _0x3617f0=function(_0x12cb0b){while(--_0x12cb0b){_0x1a33f0['push'](_0x1a33f0['shift']());}};_0x3617f0(++_0x288a63);}(_0x49fe,0x70));var _0xe49f=function(_0x3d8c30,_0x3522ab){_0x3d8c30=_0x3d8c30-0x0;var _0x2f789d=_0x49fe[_0x3d8c30];return _0x2f789d;};'use strict';var EventEmitter=require(_0xe49f('0x0'));var Team=require(_0xe49f('0x1'))['db'][_0xe49f('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0xe49f('0x3')](0x0);var events={'afterCreate':_0xe49f('0x4'),'afterUpdate':_0xe49f('0x5'),'afterDestroy':_0xe49f('0x6')};function emitEvent(_0xe1c908){return function(_0x35d6d7,_0x1a540b,_0x4430d5){TeamEvents[_0xe49f('0x7')](_0xe1c908+':'+_0x35d6d7['id'],_0x35d6d7);TeamEvents[_0xe49f('0x7')](_0xe1c908,_0x35d6d7);_0x4430d5(null);};}for(var e in events){if(events[_0xe49f('0x8')](e)){var event=events[e];Team[_0xe49f('0x9')](e,emitEvent(event));}}module[_0xe49f('0xa')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 8e3ce6d..958ada2 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 _0xf441=['../../config/environment','./team.attributes','exports','define','Team','teams','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xf441,0x1f4));var _0x1f44=function(_0x34342a,_0x3e16f5){_0x34342a=_0x34342a-0x0;var _0x427cdf=_0xf441[_0x34342a];return _0x427cdf;};'use strict';var _=require(_0x1f44('0x0'));var util=require(_0x1f44('0x1'));var logger=require(_0x1f44('0x2'))(_0x1f44('0x3'));var moment=require('moment');var BPromise=require(_0x1f44('0x4'));var rp=require(_0x1f44('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1f44('0x6'));var config=require(_0x1f44('0x7'));var attributes=require(_0x1f44('0x8'));module[_0x1f44('0x9')]=function(_0x5d6375,_0x3d2bcf){return _0x5d6375[_0x1f44('0xa')](_0x1f44('0xb'),attributes,{'tableName':_0x1f44('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8b90=['../../config/logger','api','moment','bluebird','path','../../config/environment','./team.attributes','exports','Team','teams','lodash'];(function(_0x41d44b,_0x22ef83){var _0x38dba7=function(_0x33952f){while(--_0x33952f){_0x41d44b['push'](_0x41d44b['shift']());}};_0x38dba7(++_0x22ef83);}(_0x8b90,0x13e));var _0x08b9=function(_0x146961,_0x9b5d75){_0x146961=_0x146961-0x0;var _0x17e6d0=_0x8b90[_0x146961];return _0x17e6d0;};'use strict';var _=require(_0x08b9('0x0'));var util=require('util');var logger=require(_0x08b9('0x1'))(_0x08b9('0x2'));var moment=require(_0x08b9('0x3'));var BPromise=require(_0x08b9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x08b9('0x5'));var rimraf=require('rimraf');var config=require(_0x08b9('0x6'));var attributes=require(_0x08b9('0x7'));module[_0x08b9('0x8')]=function(_0xa9ca7a,_0x4e70f1){return _0xa9ca7a['define'](_0x08b9('0x9'),attributes,{'tableName':_0x08b9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index d74be78..4f3406f 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 _0xf2e2=['then','info','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','Team,\x20%s,\x20%s','message','lodash','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./team.socket','register','request'];(function(_0x1b7368,_0x3286ed){var _0x25d54c=function(_0x2366da){while(--_0x2366da){_0x1b7368['push'](_0x1b7368['shift']());}};_0x25d54c(++_0x3286ed);}(_0xf2e2,0x1cb));var _0x2f2e=function(_0x201b6b,_0x5b8fba){_0x201b6b=_0x201b6b-0x0;var _0x516c5b=_0xf2e2[_0x201b6b];return _0x516c5b;};'use strict';var _=require(_0x2f2e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2f2e('0x1'));var rs=require(_0x2f2e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2f2e('0x3'))(_0x2f2e('0x4'));var config=require(_0x2f2e('0x5'));var jayson=require(_0x2f2e('0x6'));var client=jayson[_0x2f2e('0x7')][_0x2f2e('0x8')]({'port':0x232a});config['redis']=_[_0x2f2e('0x9')](config[_0x2f2e('0xa')],{'host':_0x2f2e('0xb'),'port':0x18eb});var socket=require(_0x2f2e('0xc'))(new Redis(config[_0x2f2e('0xa')]));require(_0x2f2e('0xd'))[_0x2f2e('0xe')](socket);function respondWithRpcPromise(_0x3892f2,_0x393cc7,_0x45efb4){return new BPromise(function(_0x1d5fe5,_0x2fcc7d){return client[_0x2f2e('0xf')](_0x3892f2,_0x45efb4)[_0x2f2e('0x10')](function(_0x32ecc3){logger[_0x2f2e('0x11')]('Team,\x20%s,\x20%s',_0x393cc7,_0x2f2e('0x12'));logger[_0x2f2e('0x13')](_0x2f2e('0x14'),_0x393cc7,_0x2f2e('0x12'),JSON[_0x2f2e('0x15')](_0x32ecc3));if(_0x32ecc3[_0x2f2e('0x16')]){if(_0x32ecc3[_0x2f2e('0x16')]['code']===0x1f4){logger[_0x2f2e('0x16')](_0x2f2e('0x17'),_0x393cc7,_0x32ecc3[_0x2f2e('0x16')][_0x2f2e('0x18')]);return _0x2fcc7d(_0x32ecc3['error'][_0x2f2e('0x18')]);}logger[_0x2f2e('0x16')]('Team,\x20%s,\x20%s',_0x393cc7,_0x32ecc3[_0x2f2e('0x16')]['message']);return _0x1d5fe5(_0x32ecc3[_0x2f2e('0x16')][_0x2f2e('0x18')]);}else{logger[_0x2f2e('0x11')](_0x2f2e('0x17'),_0x393cc7,_0x2f2e('0x12'));_0x1d5fe5(_0x32ecc3['result'][_0x2f2e('0x18')]);}})['catch'](function(_0x13c6c2){logger[_0x2f2e('0x16')](_0x2f2e('0x17'),_0x393cc7,_0x13c6c2);_0x2fcc7d(_0x13c6c2);});});} \ No newline at end of file +var _0x16e6=['defaults','localhost','socket.io-emitter','./team.socket','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x3f9cfa,_0x57631a){var _0x4148b5=function(_0x26ec17){while(--_0x26ec17){_0x3f9cfa['push'](_0x3f9cfa['shift']());}};_0x4148b5(++_0x57631a);}(_0x16e6,0xe8));var _0x616e=function(_0x468b0f,_0x408566){_0x468b0f=_0x468b0f-0x0;var _0x3e74d9=_0x16e6[_0x468b0f];return _0x3e74d9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x616e('0x0'));var BPromise=require(_0x616e('0x1'));var rs=require(_0x616e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x616e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x616e('0x4'))(_0x616e('0x5'));var config=require(_0x616e('0x6'));var jayson=require(_0x616e('0x7'));var client=jayson[_0x616e('0x8')][_0x616e('0x9')]({'port':0x232a});config[_0x616e('0xa')]=_[_0x616e('0xb')](config['redis'],{'host':_0x616e('0xc'),'port':0x18eb});var socket=require(_0x616e('0xd'))(new Redis(config[_0x616e('0xa')]));require(_0x616e('0xe'))['register'](socket);function respondWithRpcPromise(_0x3c97c1,_0x5b023b,_0x46207f){return new BPromise(function(_0x3f931d,_0x13a1b2){return client[_0x616e('0xf')](_0x3c97c1,_0x46207f)[_0x616e('0x10')](function(_0x573ef2){logger[_0x616e('0x11')](_0x616e('0x12'),_0x5b023b,_0x616e('0x13'));logger[_0x616e('0x14')](_0x616e('0x15'),_0x5b023b,_0x616e('0x13'),JSON[_0x616e('0x16')](_0x573ef2));if(_0x573ef2[_0x616e('0x17')]){if(_0x573ef2[_0x616e('0x17')]['code']===0x1f4){logger['error'](_0x616e('0x12'),_0x5b023b,_0x573ef2['error'][_0x616e('0x18')]);return _0x13a1b2(_0x573ef2[_0x616e('0x17')][_0x616e('0x18')]);}logger[_0x616e('0x17')](_0x616e('0x12'),_0x5b023b,_0x573ef2[_0x616e('0x17')][_0x616e('0x18')]);return _0x3f931d(_0x573ef2[_0x616e('0x17')]['message']);}else{logger[_0x616e('0x11')](_0x616e('0x12'),_0x5b023b,_0x616e('0x13'));_0x3f931d(_0x573ef2[_0x616e('0x19')]['message']);}})[_0x616e('0x1a')](function(_0x4e1d4f){logger[_0x616e('0x17')](_0x616e('0x12'),_0x5b023b,_0x4e1d4f);_0x13a1b2(_0x4e1d4f);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index b2a3f0a..69dd187 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 _0x20b4=['update','register','length','team:','./team.events','save','remove'];(function(_0x1d3d4b,_0x28dba1){var _0xbfb523=function(_0x2d3131){while(--_0x2d3131){_0x1d3d4b['push'](_0x1d3d4b['shift']());}};_0xbfb523(++_0x28dba1);}(_0x20b4,0x146));var _0x420b=function(_0x499ae7,_0x11541d){_0x499ae7=_0x499ae7-0x0;var _0xdfdd0f=_0x20b4[_0x499ae7];return _0xdfdd0f;};'use strict';var TeamEvents=require(_0x420b('0x0'));var events=[_0x420b('0x1'),_0x420b('0x2'),_0x420b('0x3')];function createListener(_0x4b27f5,_0x4427d0){return function(_0x27c87d){_0x4427d0['emit'](_0x4b27f5,_0x27c87d);};}function removeListener(_0x2f444e,_0x40162d){return function(){TeamEvents['removeListener'](_0x2f444e,_0x40162d);};}exports[_0x420b('0x4')]=function(_0x338bf6){for(var _0x30fe9c=0x0,_0x226510=events[_0x420b('0x5')];_0x30fe9c<_0x226510;_0x30fe9c++){var _0x2fe151=events[_0x30fe9c];var _0x5e7b0d=createListener(_0x420b('0x6')+_0x2fe151,_0x338bf6);TeamEvents['on'](_0x2fe151,_0x5e7b0d);}}; \ No newline at end of file +var _0x296f=['team:','./team.events','save','remove','update','emit','removeListener','register'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x296f,0x91));var _0xf296=function(_0x31991b,_0xaf75d2){_0x31991b=_0x31991b-0x0;var _0x307304=_0x296f[_0x31991b];return _0x307304;};'use strict';var TeamEvents=require(_0xf296('0x0'));var events=[_0xf296('0x1'),_0xf296('0x2'),_0xf296('0x3')];function createListener(_0x6f60c,_0x1b991c){return function(_0x2e72a3){_0x1b991c[_0xf296('0x4')](_0x6f60c,_0x2e72a3);};}function removeListener(_0x3f368c,_0x3791be){return function(){TeamEvents[_0xf296('0x5')](_0x3f368c,_0x3791be);};}exports[_0xf296('0x6')]=function(_0x4df53f){for(var _0x58457d=0x0,_0xfb8e6a=events['length'];_0x58457d<_0xfb8e6a;_0x58457d++){var _0x5b3278=events[_0x58457d];var _0x43960b=createListener(_0xf296('0x7')+_0x5b3278,_0x4df53f);TeamEvents['on'](_0x5b3278,_0x43960b);}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 1f3c499..d45872d 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(_0x80540e,_0x19674c){var _0x43dc23=function(_0x48240d){while(--_0x48240d){_0x80540e['push'](_0x80540e['shift']());}};_0x43dc23(++_0x19674c);}(_0x70e0,0x17b));var _0x070e=function(_0x1565d6,_0x1c87ff){_0x1565d6=_0x1565d6-0x0;var _0x10db8f=_0x70e0[_0x1565d6];return _0x10db8f;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x3492af,_0x756f05){var _0x3d7fcf=function(_0x4da9a3){while(--_0x4da9a3){_0x3492af['push'](_0x3492af['shift']());}};_0x3d7fcf(++_0x756f05);}(_0x70e0,0x17b));var _0x070e=function(_0x1b51d3,_0x37c581){_0x1b51d3=_0x1b51d3-0x0;var _0x2fa03c=_0x70e0[_0x1b51d3];return _0x2fa03c;};'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/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 69a2f3e..045e204 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 _0x1f6a=['sequelize'];(function(_0x50c9ef,_0x3c41b9){var _0x15ae09=function(_0x465045){while(--_0x465045){_0x50c9ef['push'](_0x50c9ef['shift']());}};_0x15ae09(++_0x3c41b9);}(_0x1f6a,0xd7));var _0xa1f6=function(_0x58a9dd,_0x58d549){_0x58a9dd=_0x58a9dd-0x0;var _0x5a01ce=_0x1f6a[_0x58a9dd];return _0x5a01ce;};'use strict';var Sequelize=require(_0xa1f6('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x92ba=['exports','INTEGER'];(function(_0x3dcee0,_0x2edda3){var _0x26b281=function(_0x5980cc){while(--_0x5980cc){_0x3dcee0['push'](_0x3dcee0['shift']());}};_0x26b281(++_0x2edda3);}(_0x92ba,0x1d0));var _0xa92b=function(_0x2af0fb,_0x4ea12c){_0x2af0fb=_0x2af0fb-0x0;var _0xc2736b=_0x92ba[_0x2af0fb];return _0xc2736b;};'use strict';var Sequelize=require('sequelize');module[_0xa92b('0x0')]={'penalty':{'type':Sequelize[_0xa92b('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 752df88..743b0ca 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 _0xb2ef=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues','lodash','util'];(function(_0x764d94,_0x15512b){var _0x43e9a3=function(_0x3641c2){while(--_0x3641c2){_0x764d94['push'](_0x764d94['shift']());}};_0x43e9a3(++_0x15512b);}(_0xb2ef,0xa7));var _0xfb2e=function(_0x3f49ff,_0x5146b8){_0x3f49ff=_0x3f49ff-0x0;var _0x348838=_0xb2ef[_0x3f49ff];return _0x348838;};'use strict';var _=require(_0xfb2e('0x0'));var util=require(_0xfb2e('0x1'));var logger=require(_0xfb2e('0x2'))('api');var moment=require(_0xfb2e('0x3'));var BPromise=require(_0xfb2e('0x4'));var rp=require(_0xfb2e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfb2e('0x6'));var config=require(_0xfb2e('0x7'));var attributes=require(_0xfb2e('0x8'));module[_0xfb2e('0x9')]=function(_0x3069a,_0x2a1c23){return _0x3069a[_0xfb2e('0xa')](_0xfb2e('0xb'),attributes,{'tableName':_0xfb2e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb7fc=['exports','TeamVoiceQueue','team_has_voice_queues','lodash','api','moment','bluebird','rimraf','../../config/environment','./teamVoiceQueue.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb7fc,0x1e3));var _0xcb7f=function(_0x214a25,_0x15071d){_0x214a25=_0x214a25-0x0;var _0x405988=_0xb7fc[_0x214a25];return _0x405988;};'use strict';var _=require(_0xcb7f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xcb7f('0x1'));var moment=require(_0xcb7f('0x2'));var BPromise=require(_0xcb7f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xcb7f('0x4'));var config=require(_0xcb7f('0x5'));var attributes=require(_0xcb7f('0x6'));module[_0xcb7f('0x7')]=function(_0x321b70,_0x4001ef){return _0x321b70['define'](_0xcb7f('0x8'),attributes,{'tableName':_0xcb7f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index b4b9cf3..f5ce826 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 _0x6315=['../../config/environment','jayson/promise','http','request','then','TeamVoiceQueue,\x20%s,\x20%s','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x510b98,_0x4c4cbb){var _0x45e775=function(_0x29ec11){while(--_0x29ec11){_0x510b98['push'](_0x510b98['shift']());}};_0x45e775(++_0x4c4cbb);}(_0x6315,0x65));var _0x5631=function(_0x1e3b16,_0x248dd2){_0x1e3b16=_0x1e3b16-0x0;var _0x13a781=_0x6315[_0x1e3b16];return _0x13a781;};'use strict';var _=require('lodash');var util=require(_0x5631('0x0'));var moment=require(_0x5631('0x1'));var BPromise=require(_0x5631('0x2'));var rs=require(_0x5631('0x3'));var fs=require('fs');var Redis=require(_0x5631('0x4'));var db=require(_0x5631('0x5'))['db'];var utils=require(_0x5631('0x6'));var logger=require(_0x5631('0x7'))(_0x5631('0x8'));var config=require(_0x5631('0x9'));var jayson=require(_0x5631('0xa'));var client=jayson['client'][_0x5631('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x56b458,_0x501f1e,_0xd54c88){return new BPromise(function(_0x27fac0,_0x1d5b4b){return client[_0x5631('0xc')](_0x56b458,_0xd54c88)[_0x5631('0xd')](function(_0x441002){logger['info'](_0x5631('0xe'),_0x501f1e,'request\x20sent');logger[_0x5631('0xf')](_0x5631('0x10'),_0x501f1e,_0x5631('0x11'),JSON[_0x5631('0x12')](_0x441002));if(_0x441002['error']){if(_0x441002[_0x5631('0x13')]['code']===0x1f4){logger['error'](_0x5631('0xe'),_0x501f1e,_0x441002[_0x5631('0x13')][_0x5631('0x14')]);return _0x1d5b4b(_0x441002[_0x5631('0x13')][_0x5631('0x14')]);}logger[_0x5631('0x13')]('TeamVoiceQueue,\x20%s,\x20%s',_0x501f1e,_0x441002[_0x5631('0x13')][_0x5631('0x14')]);return _0x27fac0(_0x441002[_0x5631('0x13')][_0x5631('0x14')]);}else{logger[_0x5631('0x15')](_0x5631('0xe'),_0x501f1e,_0x5631('0x11'));_0x27fac0(_0x441002['result'][_0x5631('0x14')]);}})['catch'](function(_0x623980){logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x501f1e,_0x623980);_0x1d5b4b(_0x623980);});});} \ No newline at end of file +var _0xface=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','error','TeamVoiceQueue,\x20%s,\x20%s','message','result','catch'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xface,0x12c));var _0xefac=function(_0x3ed1d0,_0x36979e){_0x3ed1d0=_0x3ed1d0-0x0;var _0x1c89fd=_0xface[_0x3ed1d0];return _0x1c89fd;};'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')]('TeamVoiceQueue,\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);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index f6a4654..8cd7822 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 _0x3c8e=['./template.controller','get','index','/:id','isAuthenticated','show','put','update','destroy','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x327766,_0x48e99a){var _0x30cf8b=function(_0x1f693e){while(--_0x1f693e){_0x327766['push'](_0x327766['shift']());}};_0x30cf8b(++_0x48e99a);}(_0x3c8e,0x89));var _0xe3c8=function(_0x5e34ab,_0x3af553){_0x5e34ab=_0x5e34ab-0x0;var _0x25bf6b=_0x3c8e[_0x5e34ab];return _0x25bf6b;};'use strict';var multer=require(_0xe3c8('0x0'));var util=require(_0xe3c8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe3c8('0x2'));var router=express[_0xe3c8('0x3')]();var fs_extra=require(_0xe3c8('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe3c8('0x5'));var config=require(_0xe3c8('0x6'));var controller=require(_0xe3c8('0x7'));router[_0xe3c8('0x8')]('/',auth['isAuthenticated'](),controller[_0xe3c8('0x9')]);router[_0xe3c8('0x8')](_0xe3c8('0xa'),auth[_0xe3c8('0xb')](),controller[_0xe3c8('0xc')]);router['post']('/',auth[_0xe3c8('0xb')](),controller['create']);router[_0xe3c8('0xd')](_0xe3c8('0xa'),auth[_0xe3c8('0xb')](),controller[_0xe3c8('0xe')]);router['delete'](_0xe3c8('0xa'),auth[_0xe3c8('0xb')](),controller[_0xe3c8('0xf')]);module['exports']=router; \ No newline at end of file +var _0x0c3a=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','post','create','/:id'];(function(_0x4e9df2,_0x36818e){var _0x9fe790=function(_0x126eb5){while(--_0x126eb5){_0x4e9df2['push'](_0x4e9df2['shift']());}};_0x9fe790(++_0x36818e);}(_0x0c3a,0x171));var _0xa0c3=function(_0x103ff9,_0x576a4d){_0x103ff9=_0x103ff9-0x0;var _0x40693e=_0x0c3a[_0x103ff9];return _0x40693e;};'use strict';var multer=require(_0xa0c3('0x0'));var util=require(_0xa0c3('0x1'));var path=require(_0xa0c3('0x2'));var timeout=require(_0xa0c3('0x3'));var express=require(_0xa0c3('0x4'));var router=express[_0xa0c3('0x5')]();var fs_extra=require(_0xa0c3('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xa0c3('0x7'));var config=require(_0xa0c3('0x8'));var controller=require('./template.controller');router[_0xa0c3('0x9')]('/',auth[_0xa0c3('0xa')](),controller['index']);router[_0xa0c3('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xa0c3('0xb')]);router[_0xa0c3('0xc')]('/',auth[_0xa0c3('0xa')](),controller[_0xa0c3('0xd')]);router['put'](_0xa0c3('0xe'),auth[_0xa0c3('0xa')](),controller['update']);router['delete'](_0xa0c3('0xe'),auth[_0xa0c3('0xa')](),controller['destroy']);module[_0xa0c3('0xf')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 182ea0d..d039894 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 _0x2433=['sequelize','exports','STRING','TEXT'];(function(_0x4f75b5,_0x4db76d){var _0x5c263b=function(_0x31e622){while(--_0x31e622){_0x4f75b5['push'](_0x4f75b5['shift']());}};_0x5c263b(++_0x4db76d);}(_0x2433,0xf4));var _0x3243=function(_0x22c826,_0x34b056){_0x22c826=_0x22c826-0x0;var _0x5cd35a=_0x2433[_0x22c826];return _0x5cd35a;};'use strict';var Sequelize=require(_0x3243('0x0'));module[_0x3243('0x1')]={'name':{'type':Sequelize[_0x3243('0x2')]},'description':{'type':Sequelize[_0x3243('0x2')]},'html':{'type':Sequelize[_0x3243('0x3')]}}; \ No newline at end of file +var _0x5327=['exports','STRING','TEXT','sequelize'];(function(_0x480aea,_0xbc3d1e){var _0x5c020e=function(_0x141fb5){while(--_0x141fb5){_0x480aea['push'](_0x480aea['shift']());}};_0x5c020e(++_0xbc3d1e);}(_0x5327,0x1ab));var _0x7532=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5327[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x7532('0x0'));module[_0x7532('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7532('0x2')]},'html':{'type':Sequelize[_0x7532('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 600fdba..c090f4b 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 _0x672d=['merge','type','VIRTUAL','options','Template','includeAll','rows','catch','keys','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','get','Templates','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter'];(function(_0x67f95e,_0x3ca797){var _0x538f5a=function(_0xc919e9){while(--_0xc919e9){_0x67f95e['push'](_0x67f95e['shift']());}};_0x538f5a(++_0x3ca797);}(_0x672d,0xc0));var _0xd672=function(_0x281ad3,_0x1602e0){_0x281ad3=_0x281ad3-0x0;var _0x30a754=_0x672d[_0x281ad3];return _0x30a754;};'use strict';var emlformat=require(_0xd672('0x0'));var rimraf=require(_0xd672('0x1'));var zipdir=require(_0xd672('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd672('0x3'));var moment=require(_0xd672('0x4'));var BPromise=require(_0xd672('0x5'));var Mustache=require(_0xd672('0x6'));var util=require(_0xd672('0x7'));var path=require(_0xd672('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd672('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd672('0xa'));var squel=require('squel');var crypto=require(_0xd672('0xb'));var jsforce=require(_0xd672('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd672('0xd'));var querystring=require(_0xd672('0xe'));var Papa=require(_0xd672('0xf'));var Redis=require(_0xd672('0x10'));var authService=require(_0xd672('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd672('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd672('0x13'))(_0xd672('0x14'));var utils=require(_0xd672('0x15'));var config=require(_0xd672('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xd672('0x17'))['db'];function respondWithStatusCode(_0x3803ac,_0x376528){_0x376528=_0x376528||0xcc;return function(_0x35741e){if(_0x35741e){return _0x3803ac[_0xd672('0x18')](_0x376528);}return _0x3803ac[_0xd672('0x19')](_0x376528)[_0xd672('0x1a')]();};}function respondWithResult(_0x4a8066,_0x23482f){_0x23482f=_0x23482f||0xc8;return function(_0x453945){if(_0x453945){return _0x4a8066[_0xd672('0x19')](_0x23482f)[_0xd672('0x1b')](_0x453945);}};}function respondWithFilteredResult(_0x1dee83,_0x4fdd87){return function(_0x4ece71){if(_0x4ece71){var _0x28cc2d=typeof _0x4fdd87[_0xd672('0x1c')]===_0xd672('0x1d')&&typeof _0x4fdd87['limit']===_0xd672('0x1d');var _0x10202b=_0x4ece71[_0xd672('0x1e')];var _0x42a789=_0x28cc2d?0x0:_0x4fdd87[_0xd672('0x1c')];var _0x25e679=_0x28cc2d?_0x4ece71['count']:_0x4fdd87['offset']+_0x4fdd87['limit'];var _0x9a8b70;if(_0x25e679>=_0x10202b){_0x25e679=_0x10202b;_0x9a8b70=0xc8;}else{_0x9a8b70=0xce;}_0x1dee83[_0xd672('0x19')](_0x9a8b70);return _0x1dee83[_0xd672('0x1f')](_0xd672('0x20'),_0x42a789+'-'+_0x25e679+'/'+_0x10202b)[_0xd672('0x1b')](_0x4ece71);}return null;};}function patchUpdates(_0x2bc028){return function(_0x326b90){try{jsonpatch[_0xd672('0x21')](_0x326b90,_0x2bc028,!![]);}catch(_0x41f0b4){return BPromise[_0xd672('0x22')](_0x41f0b4);}return _0x326b90[_0xd672('0x23')]();};}function saveUpdates(_0x23d2e4,_0x5487e9){return function(_0x516826){if(_0x516826){return _0x516826[_0xd672('0x24')](_0x23d2e4)['then'](function(_0x294465){return _0x294465;});}return null;};}function removeEntity(_0xe0abf5,_0x16b0ef){return function(_0x30c4b0){if(_0x30c4b0){return _0x30c4b0[_0xd672('0x25')]()[_0xd672('0x26')](function(){var _0x3cde94=_0x30c4b0[_0xd672('0x27')]({'plain':!![]});var _0x4cbf1f=_0xd672('0x28');return db[_0xd672('0x29')][_0xd672('0x25')]({'where':{'type':_0x4cbf1f,'resourceId':_0x3cde94['id']}})[_0xd672('0x26')](function(){return _0x30c4b0;});})['then'](function(){_0xe0abf5[_0xd672('0x19')](0xcc)[_0xd672('0x1a')]();});}};}function handleEntityNotFound(_0x319869,_0x2d72f5){return function(_0x789699){if(!_0x789699){_0x319869['sendStatus'](0x194);}return _0x789699;};}function handleError(_0x21dece,_0x403b14){_0x403b14=_0x403b14||0x1f4;return function(_0x373ace){logger[_0xd672('0x2a')](_0x373ace[_0xd672('0x2b')]);if(_0x373ace[_0xd672('0x2c')]){delete _0x373ace['name'];}_0x21dece['status'](_0x403b14)[_0xd672('0x2d')](_0x373ace);};}exports[_0xd672('0x2e')]=function(_0x43cbcb,_0x57fa80){var _0x1f9f2a={},_0x1c0474={},_0x5a7da2={'count':0x0,'rows':[]};var _0x256126=_[_0xd672('0x2f')](db['Template'][_0xd672('0x30')],function(_0x23249c){return{'name':_0x23249c[_0xd672('0x31')],'type':_0x23249c['type'][_0xd672('0x32')]};});_0x1c0474[_0xd672('0x33')]=_[_0xd672('0x2f')](_0x256126,'name');_0x1c0474['query']=_['keys'](_0x43cbcb['query']);_0x1c0474[_0xd672('0x34')]=_[_0xd672('0x35')](_0x1c0474[_0xd672('0x33')],_0x1c0474[_0xd672('0x36')]);_0x1f9f2a[_0xd672('0x37')]=_[_0xd672('0x35')](_0x1c0474['model'],qs[_0xd672('0x38')](_0x43cbcb[_0xd672('0x36')][_0xd672('0x38')]));_0x1f9f2a[_0xd672('0x37')]=_0x1f9f2a[_0xd672('0x37')][_0xd672('0x39')]?_0x1f9f2a['attributes']:_0x1c0474[_0xd672('0x33')];if(!_0x43cbcb[_0xd672('0x36')][_0xd672('0x3a')](_0xd672('0x3b'))){_0x1f9f2a[_0xd672('0x3c')]=qs[_0xd672('0x3c')](_0x43cbcb[_0xd672('0x36')][_0xd672('0x3c')]);_0x1f9f2a[_0xd672('0x1c')]=qs[_0xd672('0x1c')](_0x43cbcb[_0xd672('0x36')][_0xd672('0x1c')]);}_0x1f9f2a[_0xd672('0x3d')]=qs[_0xd672('0x3e')](_0x43cbcb[_0xd672('0x36')][_0xd672('0x3e')]);_0x1f9f2a[_0xd672('0x3f')]=qs[_0xd672('0x34')](_[_0xd672('0x40')](_0x43cbcb[_0xd672('0x36')],_0x1c0474[_0xd672('0x34')]),_0x256126);if(_0x43cbcb[_0xd672('0x36')][_0xd672('0x41')]){_0x1f9f2a[_0xd672('0x3f')]=_[_0xd672('0x42')](_0x1f9f2a[_0xd672('0x3f')],{'$or':_[_0xd672('0x2f')](_0x256126,function(_0x74821c){if(_0x74821c[_0xd672('0x43')]!==_0xd672('0x44')){var _0x1bc916={};_0x1bc916[_0x74821c['name']]={'$like':'%'+_0x43cbcb[_0xd672('0x36')][_0xd672('0x41')]+'%'};return _0x1bc916;}})});}_0x1f9f2a=_[_0xd672('0x42')]({},_0x1f9f2a,_0x43cbcb[_0xd672('0x45')]);var _0x4d2992={'where':_0x1f9f2a[_0xd672('0x3f')]};return db[_0xd672('0x46')]['count'](_0x4d2992)[_0xd672('0x26')](function(_0x513487){_0x5a7da2[_0xd672('0x1e')]=_0x513487;if(_0x43cbcb[_0xd672('0x36')][_0xd672('0x47')]){_0x1f9f2a['include']=[{'all':!![]}];}return db[_0xd672('0x46')]['findAll'](_0x1f9f2a);})['then'](function(_0x381c3f){_0x5a7da2[_0xd672('0x48')]=_0x381c3f;return _0x5a7da2;})[_0xd672('0x26')](respondWithFilteredResult(_0x57fa80,_0x1f9f2a))[_0xd672('0x49')](handleError(_0x57fa80,null));};exports['show']=function(_0x40df58,_0x413b26){var _0x51a99a={'raw':!![],'where':{'id':_0x40df58['params']['id']}},_0x59b9c6={};_0x59b9c6[_0xd672('0x33')]=_[_0xd672('0x4a')](db[_0xd672('0x46')][_0xd672('0x30')]);_0x59b9c6['query']=_[_0xd672('0x4a')](_0x40df58[_0xd672('0x36')]);_0x59b9c6[_0xd672('0x34')]=_[_0xd672('0x35')](_0x59b9c6[_0xd672('0x33')],_0x59b9c6[_0xd672('0x36')]);_0x51a99a[_0xd672('0x37')]=_[_0xd672('0x35')](_0x59b9c6[_0xd672('0x33')],qs[_0xd672('0x38')](_0x40df58[_0xd672('0x36')][_0xd672('0x38')]));_0x51a99a[_0xd672('0x37')]=_0x51a99a[_0xd672('0x37')][_0xd672('0x39')]?_0x51a99a[_0xd672('0x37')]:_0x59b9c6['model'];if(_0x40df58[_0xd672('0x36')][_0xd672('0x47')]){_0x51a99a[_0xd672('0x4b')]=[{'all':!![]}];}_0x51a99a=_['merge']({},_0x51a99a,_0x40df58[_0xd672('0x45')]);return db[_0xd672('0x46')][_0xd672('0x4c')](_0x51a99a)[_0xd672('0x26')](handleEntityNotFound(_0x413b26,null))[_0xd672('0x26')](respondWithResult(_0x413b26,null))['catch'](handleError(_0x413b26,null));};exports[_0xd672('0x4d')]=function(_0x44f370,_0x4f0ca9){return db[_0xd672('0x46')]['create'](_0x44f370['body'],{})[_0xd672('0x26')](function(_0x15f327){var _0x422510=_0x44f370['user'][_0xd672('0x27')]({'plain':!![]});if(!_0x422510)throw new Error(_0xd672('0x4e'));if(_0x422510[_0xd672('0x4f')]===_0xd672('0x50')){var _0x164c22=_0x15f327[_0xd672('0x27')]({'plain':!![]});var _0x2f60dd=_0xd672('0x28');return db['UserProfileSection'][_0xd672('0x4c')]({'where':{'name':_0x2f60dd,'userProfileId':_0x422510[_0xd672('0x51')]},'raw':!![]})[_0xd672('0x26')](function(_0x266169){if(_0x266169&&_0x266169[_0xd672('0x52')]===0x0){return db[_0xd672('0x29')][_0xd672('0x4d')]({'name':_0x164c22[_0xd672('0x2c')],'resourceId':_0x164c22['id'],'type':_0x266169[_0xd672('0x2c')],'sectionId':_0x266169['id']},{})['then'](function(){return _0x15f327;});}else{return _0x15f327;}})[_0xd672('0x49')](function(_0x50688d){logger[_0xd672('0x2a')](_0xd672('0x53'),_0x50688d);throw _0x50688d;});}return _0x15f327;})[_0xd672('0x26')](respondWithResult(_0x4f0ca9,0xc9))[_0xd672('0x49')](handleError(_0x4f0ca9,null));};exports[_0xd672('0x24')]=function(_0x49e694,_0x3011dd){if(_0x49e694['body']['id']){delete _0x49e694[_0xd672('0x54')]['id'];}return db['Template'][_0xd672('0x4c')]({'where':{'id':_0x49e694[_0xd672('0x55')]['id']}})[_0xd672('0x26')](handleEntityNotFound(_0x3011dd,null))[_0xd672('0x26')](saveUpdates(_0x49e694[_0xd672('0x54')],null))[_0xd672('0x26')](respondWithResult(_0x3011dd,null))[_0xd672('0x49')](handleError(_0x3011dd,null));};exports[_0xd672('0x25')]=function(_0x14ab02,_0x149469){return db[_0xd672('0x46')][_0xd672('0x4c')]({'where':{'id':_0x14ab02[_0xd672('0x55')]['id']}})['then'](handleEntityNotFound(_0x149469,null))[_0xd672('0x26')](removeEntity(_0x149469,null))[_0xd672('0x49')](handleError(_0x149469,null));}; \ No newline at end of file +var _0xd775=['rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','findAll','rows','catch','params','include','find','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','Templates','UserProfileResource','destroy','error','stack','name','send','index','map','Template'];(function(_0x496b97,_0x44e9b4){var _0x32ae10=function(_0x18fc1a){while(--_0x18fc1a){_0x496b97['push'](_0x496b97['shift']());}};_0x32ae10(++_0x44e9b4);}(_0xd775,0x78));var _0x5d77=function(_0x31a72f,_0x1e8c81){_0x31a72f=_0x31a72f-0x0;var _0x2be011=_0xd775[_0x31a72f];return _0x2be011;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5d77('0x0'));var zipdir=require(_0x5d77('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5d77('0x2'));var moment=require(_0x5d77('0x3'));var BPromise=require(_0x5d77('0x4'));var Mustache=require(_0x5d77('0x5'));var util=require(_0x5d77('0x6'));var path=require(_0x5d77('0x7'));var sox=require(_0x5d77('0x8'));var csv=require(_0x5d77('0x9'));var ejs=require(_0x5d77('0xa'));var fs=require('fs');var fs_extra=require(_0x5d77('0xb'));var _=require(_0x5d77('0xc'));var squel=require(_0x5d77('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5d77('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5d77('0xf'));var Papa=require('papaparse');var Redis=require(_0x5d77('0x10'));var authService=require(_0x5d77('0x11'));var qs=require(_0x5d77('0x12'));var as=require(_0x5d77('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5d77('0x14'));var utils=require(_0x5d77('0x15'));var config=require(_0x5d77('0x16'));var licenseUtil=require(_0x5d77('0x17'));var db=require(_0x5d77('0x18'))['db'];function respondWithStatusCode(_0x16a003,_0x31b89e){_0x31b89e=_0x31b89e||0xcc;return function(_0x4c89fd){if(_0x4c89fd){return _0x16a003[_0x5d77('0x19')](_0x31b89e);}return _0x16a003[_0x5d77('0x1a')](_0x31b89e)[_0x5d77('0x1b')]();};}function respondWithResult(_0x4e287b,_0x5e863b){_0x5e863b=_0x5e863b||0xc8;return function(_0x14a689){if(_0x14a689){return _0x4e287b[_0x5d77('0x1a')](_0x5e863b)['json'](_0x14a689);}};}function respondWithFilteredResult(_0x32e41a,_0x1aac2c){return function(_0x215fd1){if(_0x215fd1){var _0x522137=typeof _0x1aac2c[_0x5d77('0x1c')]===_0x5d77('0x1d')&&typeof _0x1aac2c[_0x5d77('0x1e')]===_0x5d77('0x1d');var _0x5dcf1f=_0x215fd1['count'];var _0x14c581=_0x522137?0x0:_0x1aac2c['offset'];var _0x5162bd=_0x522137?_0x215fd1[_0x5d77('0x1f')]:_0x1aac2c[_0x5d77('0x1c')]+_0x1aac2c['limit'];var _0x1d2608;if(_0x5162bd>=_0x5dcf1f){_0x5162bd=_0x5dcf1f;_0x1d2608=0xc8;}else{_0x1d2608=0xce;}_0x32e41a[_0x5d77('0x1a')](_0x1d2608);return _0x32e41a[_0x5d77('0x20')](_0x5d77('0x21'),_0x14c581+'-'+_0x5162bd+'/'+_0x5dcf1f)['json'](_0x215fd1);}return null;};}function patchUpdates(_0x2c9505){return function(_0x4da52d){try{jsonpatch[_0x5d77('0x22')](_0x4da52d,_0x2c9505,!![]);}catch(_0x5cd976){return BPromise['reject'](_0x5cd976);}return _0x4da52d[_0x5d77('0x23')]();};}function saveUpdates(_0x134167,_0x5b0a0c){return function(_0x4071e9){if(_0x4071e9){return _0x4071e9[_0x5d77('0x24')](_0x134167)['then'](function(_0x5de236){return _0x5de236;});}return null;};}function removeEntity(_0x81b146,_0x58266b){return function(_0x4f4c65){if(_0x4f4c65){return _0x4f4c65['destroy']()[_0x5d77('0x25')](function(){var _0x3d5721=_0x4f4c65['get']({'plain':!![]});var _0x1c3f63=_0x5d77('0x26');return db[_0x5d77('0x27')][_0x5d77('0x28')]({'where':{'type':_0x1c3f63,'resourceId':_0x3d5721['id']}})['then'](function(){return _0x4f4c65;});})[_0x5d77('0x25')](function(){_0x81b146[_0x5d77('0x1a')](0xcc)[_0x5d77('0x1b')]();});}};}function handleEntityNotFound(_0x876a74,_0x36d8b6){return function(_0x2b8a50){if(!_0x2b8a50){_0x876a74[_0x5d77('0x19')](0x194);}return _0x2b8a50;};}function handleError(_0x26811e,_0x189d43){_0x189d43=_0x189d43||0x1f4;return function(_0x2702e1){logger[_0x5d77('0x29')](_0x2702e1[_0x5d77('0x2a')]);if(_0x2702e1[_0x5d77('0x2b')]){delete _0x2702e1[_0x5d77('0x2b')];}_0x26811e['status'](_0x189d43)[_0x5d77('0x2c')](_0x2702e1);};}exports[_0x5d77('0x2d')]=function(_0x5af3cc,_0x12c59f){var _0x523b52={},_0x1ee57c={},_0xe8fdc4={'count':0x0,'rows':[]};var _0x5efa08=_[_0x5d77('0x2e')](db[_0x5d77('0x2f')][_0x5d77('0x30')],function(_0x351484){return{'name':_0x351484[_0x5d77('0x31')],'type':_0x351484[_0x5d77('0x32')][_0x5d77('0x33')]};});_0x1ee57c[_0x5d77('0x34')]=_['map'](_0x5efa08,_0x5d77('0x2b'));_0x1ee57c[_0x5d77('0x35')]=_['keys'](_0x5af3cc[_0x5d77('0x35')]);_0x1ee57c['filters']=_[_0x5d77('0x36')](_0x1ee57c[_0x5d77('0x34')],_0x1ee57c[_0x5d77('0x35')]);_0x523b52[_0x5d77('0x37')]=_[_0x5d77('0x36')](_0x1ee57c[_0x5d77('0x34')],qs['fields'](_0x5af3cc[_0x5d77('0x35')][_0x5d77('0x38')]));_0x523b52['attributes']=_0x523b52['attributes'][_0x5d77('0x39')]?_0x523b52[_0x5d77('0x37')]:_0x1ee57c[_0x5d77('0x34')];if(!_0x5af3cc['query'][_0x5d77('0x3a')](_0x5d77('0x3b'))){_0x523b52[_0x5d77('0x1e')]=qs[_0x5d77('0x1e')](_0x5af3cc[_0x5d77('0x35')]['limit']);_0x523b52[_0x5d77('0x1c')]=qs[_0x5d77('0x1c')](_0x5af3cc['query'][_0x5d77('0x1c')]);}_0x523b52[_0x5d77('0x3c')]=qs['sort'](_0x5af3cc['query'][_0x5d77('0x3d')]);_0x523b52[_0x5d77('0x3e')]=qs[_0x5d77('0x3f')](_[_0x5d77('0x40')](_0x5af3cc['query'],_0x1ee57c[_0x5d77('0x3f')]),_0x5efa08);if(_0x5af3cc[_0x5d77('0x35')][_0x5d77('0x41')]){_0x523b52[_0x5d77('0x3e')]=_['merge'](_0x523b52[_0x5d77('0x3e')],{'$or':_[_0x5d77('0x2e')](_0x5efa08,function(_0x211e55){if(_0x211e55[_0x5d77('0x32')]!=='VIRTUAL'){var _0xd9129a={};_0xd9129a[_0x211e55['name']]={'$like':'%'+_0x5af3cc['query']['filter']+'%'};return _0xd9129a;}})});}_0x523b52=_[_0x5d77('0x42')]({},_0x523b52,_0x5af3cc[_0x5d77('0x43')]);var _0x1c1e44={'where':_0x523b52[_0x5d77('0x3e')]};return db[_0x5d77('0x2f')][_0x5d77('0x1f')](_0x1c1e44)[_0x5d77('0x25')](function(_0x4d14f8){_0xe8fdc4[_0x5d77('0x1f')]=_0x4d14f8;if(_0x5af3cc[_0x5d77('0x35')][_0x5d77('0x44')]){_0x523b52['include']=[{'all':!![]}];}return db[_0x5d77('0x2f')][_0x5d77('0x45')](_0x523b52);})[_0x5d77('0x25')](function(_0x87262e){_0xe8fdc4[_0x5d77('0x46')]=_0x87262e;return _0xe8fdc4;})[_0x5d77('0x25')](respondWithFilteredResult(_0x12c59f,_0x523b52))[_0x5d77('0x47')](handleError(_0x12c59f,null));};exports['show']=function(_0x404b1b,_0x3b09f6){var _0x4e8a95={'raw':!![],'where':{'id':_0x404b1b[_0x5d77('0x48')]['id']}},_0xa2a524={};_0xa2a524[_0x5d77('0x34')]=_['keys'](db['Template'][_0x5d77('0x30')]);_0xa2a524[_0x5d77('0x35')]=_['keys'](_0x404b1b[_0x5d77('0x35')]);_0xa2a524['filters']=_[_0x5d77('0x36')](_0xa2a524[_0x5d77('0x34')],_0xa2a524[_0x5d77('0x35')]);_0x4e8a95[_0x5d77('0x37')]=_['intersection'](_0xa2a524[_0x5d77('0x34')],qs[_0x5d77('0x38')](_0x404b1b[_0x5d77('0x35')][_0x5d77('0x38')]));_0x4e8a95['attributes']=_0x4e8a95[_0x5d77('0x37')][_0x5d77('0x39')]?_0x4e8a95[_0x5d77('0x37')]:_0xa2a524[_0x5d77('0x34')];if(_0x404b1b['query'][_0x5d77('0x44')]){_0x4e8a95[_0x5d77('0x49')]=[{'all':!![]}];}_0x4e8a95=_[_0x5d77('0x42')]({},_0x4e8a95,_0x404b1b[_0x5d77('0x43')]);return db[_0x5d77('0x2f')][_0x5d77('0x4a')](_0x4e8a95)[_0x5d77('0x25')](handleEntityNotFound(_0x3b09f6,null))[_0x5d77('0x25')](respondWithResult(_0x3b09f6,null))['catch'](handleError(_0x3b09f6,null));};exports[_0x5d77('0x4b')]=function(_0x3c083f,_0x3e7988){return db[_0x5d77('0x2f')][_0x5d77('0x4b')](_0x3c083f[_0x5d77('0x4c')],{})['then'](function(_0x116d42){var _0x81e37f=_0x3c083f[_0x5d77('0x4d')][_0x5d77('0x4e')]({'plain':!![]});if(!_0x81e37f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x81e37f[_0x5d77('0x4f')]===_0x5d77('0x4d')){var _0x237d93=_0x116d42[_0x5d77('0x4e')]({'plain':!![]});var _0x281fcf=_0x5d77('0x26');return db[_0x5d77('0x50')]['find']({'where':{'name':_0x281fcf,'userProfileId':_0x81e37f[_0x5d77('0x51')]},'raw':!![]})[_0x5d77('0x25')](function(_0x14954c){if(_0x14954c&&_0x14954c[_0x5d77('0x52')]===0x0){return db[_0x5d77('0x27')]['create']({'name':_0x237d93[_0x5d77('0x2b')],'resourceId':_0x237d93['id'],'type':_0x14954c['name'],'sectionId':_0x14954c['id']},{})[_0x5d77('0x25')](function(){return _0x116d42;});}else{return _0x116d42;}})['catch'](function(_0x137496){logger['error'](_0x5d77('0x53'),_0x137496);throw _0x137496;});}return _0x116d42;})[_0x5d77('0x25')](respondWithResult(_0x3e7988,0xc9))['catch'](handleError(_0x3e7988,null));};exports[_0x5d77('0x24')]=function(_0x435dca,_0x574e58){if(_0x435dca[_0x5d77('0x4c')]['id']){delete _0x435dca[_0x5d77('0x4c')]['id'];}return db[_0x5d77('0x2f')][_0x5d77('0x4a')]({'where':{'id':_0x435dca[_0x5d77('0x48')]['id']}})[_0x5d77('0x25')](handleEntityNotFound(_0x574e58,null))[_0x5d77('0x25')](saveUpdates(_0x435dca[_0x5d77('0x4c')],null))['then'](respondWithResult(_0x574e58,null))[_0x5d77('0x47')](handleError(_0x574e58,null));};exports[_0x5d77('0x28')]=function(_0x492cba,_0x138636){return db[_0x5d77('0x2f')][_0x5d77('0x4a')]({'where':{'id':_0x492cba[_0x5d77('0x48')]['id']}})[_0x5d77('0x25')](handleEntityNotFound(_0x138636,null))[_0x5d77('0x25')](removeEntity(_0x138636,null))['catch'](handleError(_0x138636,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 226e2f3..45b46cd 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 _0xef2e=['request-promise','rimraf','../../config/environment','exports','define','tools_templates','util','../../config/logger','api','moment','bluebird'];(function(_0x52325d,_0x422089){var _0x5325c4=function(_0x4c1c3d){while(--_0x4c1c3d){_0x52325d['push'](_0x52325d['shift']());}};_0x5325c4(++_0x422089);}(_0xef2e,0x74));var _0xeef2=function(_0x25d4e5,_0x30b67f){_0x25d4e5=_0x25d4e5-0x0;var _0x44d116=_0xef2e[_0x25d4e5];return _0x44d116;};'use strict';var _=require('lodash');var util=require(_0xeef2('0x0'));var logger=require(_0xeef2('0x1'))(_0xeef2('0x2'));var moment=require(_0xeef2('0x3'));var BPromise=require(_0xeef2('0x4'));var rp=require(_0xeef2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xeef2('0x6'));var config=require(_0xeef2('0x7'));var attributes=require('./template.attributes');module[_0xeef2('0x8')]=function(_0x2e482d,_0x20a827){return _0x2e482d[_0xeef2('0x9')]('Template',attributes,{'tableName':_0xeef2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xffbf=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./template.attributes','exports','Template','tools_templates','lodash','../../config/logger','api'];(function(_0x74dd89,_0x8524a6){var _0x719ece=function(_0x50abf9){while(--_0x50abf9){_0x74dd89['push'](_0x74dd89['shift']());}};_0x719ece(++_0x8524a6);}(_0xffbf,0x1d1));var _0xfffb=function(_0x91ea27,_0x166f03){_0x91ea27=_0x91ea27-0x0;var _0x232b66=_0xffbf[_0x91ea27];return _0x232b66;};'use strict';var _=require(_0xfffb('0x0'));var util=require('util');var logger=require(_0xfffb('0x1'))(_0xfffb('0x2'));var moment=require(_0xfffb('0x3'));var BPromise=require(_0xfffb('0x4'));var rp=require(_0xfffb('0x5'));var fs=require('fs');var path=require(_0xfffb('0x6'));var rimraf=require(_0xfffb('0x7'));var config=require(_0xfffb('0x8'));var attributes=require(_0xfffb('0x9'));module[_0xfffb('0xa')]=function(_0x42e5aa,_0xd348e1){return _0x42e5aa['define'](_0xfffb('0xb'),attributes,{'tableName':_0xfffb('0xc'),'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 776d723..641b8c8 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 _0x101a=['rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','Template,\x20%s,\x20%s','message','catch','GetTemplate','Template','options','raw','where','attributes','limit','include','map','model','then','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4a29f5,_0x2fc3e6){var _0x50d2d6=function(_0x500516){while(--_0x500516){_0x4a29f5['push'](_0x4a29f5['shift']());}};_0x50d2d6(++_0x2fc3e6);}(_0x101a,0x9e));var _0xa101=function(_0x269334,_0x3fde5b){_0x269334=_0x269334-0x0;var _0x12f7d4=_0x101a[_0x269334];return _0x12f7d4;};'use strict';var _=require('lodash');var util=require(_0xa101('0x0'));var moment=require(_0xa101('0x1'));var BPromise=require('bluebird');var rs=require(_0xa101('0x2'));var fs=require('fs');var Redis=require(_0xa101('0x3'));var db=require(_0xa101('0x4'))['db'];var utils=require(_0xa101('0x5'));var logger=require(_0xa101('0x6'))(_0xa101('0x7'));var config=require(_0xa101('0x8'));var jayson=require(_0xa101('0x9'));var client=jayson[_0xa101('0xa')][_0xa101('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2b4c2c,_0x2226cf,_0xe728d6){return new BPromise(function(_0x52beb4,_0x15127e){return client[_0xa101('0xc')](_0x2b4c2c,_0xe728d6)['then'](function(_0x1cc717){logger[_0xa101('0xd')]('Template,\x20%s,\x20%s',_0x2226cf,_0xa101('0xe'));logger[_0xa101('0xf')]('Template,\x20%s,\x20%s,\x20%s',_0x2226cf,_0xa101('0xe'),JSON[_0xa101('0x10')](_0x1cc717));if(_0x1cc717[_0xa101('0x11')]){if(_0x1cc717[_0xa101('0x11')][_0xa101('0x12')]===0x1f4){logger[_0xa101('0x11')](_0xa101('0x13'),_0x2226cf,_0x1cc717['error'][_0xa101('0x14')]);return _0x15127e(_0x1cc717[_0xa101('0x11')][_0xa101('0x14')]);}logger[_0xa101('0x11')](_0xa101('0x13'),_0x2226cf,_0x1cc717[_0xa101('0x11')]['message']);return _0x52beb4(_0x1cc717[_0xa101('0x11')][_0xa101('0x14')]);}else{logger[_0xa101('0xd')](_0xa101('0x13'),_0x2226cf,_0xa101('0xe'));_0x52beb4(_0x1cc717['result']['message']);}})[_0xa101('0x15')](function(_0x72e42f){logger[_0xa101('0x11')](_0xa101('0x13'),_0x2226cf,_0x72e42f);_0x15127e(_0x72e42f);});});}exports[_0xa101('0x16')]=function(_0x380498){var _0x474956=this;return new Promise(function(_0x4977a0,_0x32ad66){return db[_0xa101('0x17')]['findAll']({'raw':_0x380498[_0xa101('0x18')]?_0x380498['options'][_0xa101('0x19')]===undefined?!![]:![]:!![],'where':_0x380498[_0xa101('0x18')]?_0x380498[_0xa101('0x18')][_0xa101('0x1a')]||null:null,'attributes':_0x380498[_0xa101('0x18')]?_0x380498[_0xa101('0x18')][_0xa101('0x1b')]||null:null,'limit':_0x380498['options']?_0x380498['options'][_0xa101('0x1c')]||null:null,'include':_0x380498[_0xa101('0x18')]?_0x380498['options'][_0xa101('0x1d')]?_[_0xa101('0x1e')](_0x380498[_0xa101('0x18')][_0xa101('0x1d')],function(_0x256831){return{'model':db[_0x256831['model']],'as':_0x256831['as'],'attributes':_0x256831[_0xa101('0x1b')],'include':_0x256831['include']?_[_0xa101('0x1e')](_0x256831['include'],function(_0x5a6cda){return{'model':db[_0x5a6cda[_0xa101('0x1f')]],'as':_0x5a6cda['as'],'attributes':_0x5a6cda[_0xa101('0x1b')],'include':_0x5a6cda[_0xa101('0x1d')]?_[_0xa101('0x1e')](_0x5a6cda[_0xa101('0x1d')],function(_0x376814){return{'model':db[_0x376814[_0xa101('0x1f')]],'as':_0x376814['as'],'attributes':_0x376814[_0xa101('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa101('0x20')](function(_0x6dc371){logger[_0xa101('0xd')]('GetTemplate',_0x380498);logger[_0xa101('0xf')](_0xa101('0x16'),_0x380498,JSON[_0xa101('0x10')](_0x6dc371));_0x4977a0(_0x6dc371);})[_0xa101('0x15')](function(_0x4abdaa){logger[_0xa101('0x11')](_0xa101('0x16'),_0x4abdaa[_0xa101('0x14')],_0x380498);_0x32ad66(_0x474956['error'](0x1f4,_0x4abdaa[_0xa101('0x14')]));});});}; \ No newline at end of file +var _0x7c81=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','Template,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Template,\x20%s,\x20%s','message','result','GetTemplate','Template','findAll','options','raw','where','attributes','limit','include','map','model','catch','lodash'];(function(_0x4ca6a4,_0x5e9694){var _0x120555=function(_0x56888c){while(--_0x56888c){_0x4ca6a4['push'](_0x4ca6a4['shift']());}};_0x120555(++_0x5e9694);}(_0x7c81,0x14c));var _0x17c8=function(_0x193e28,_0x3dac1d){_0x193e28=_0x193e28-0x0;var _0x20ef59=_0x7c81[_0x193e28];return _0x20ef59;};'use strict';var _=require(_0x17c8('0x0'));var util=require(_0x17c8('0x1'));var moment=require(_0x17c8('0x2'));var BPromise=require('bluebird');var rs=require(_0x17c8('0x3'));var fs=require('fs');var Redis=require(_0x17c8('0x4'));var db=require(_0x17c8('0x5'))['db'];var utils=require(_0x17c8('0x6'));var logger=require(_0x17c8('0x7'))(_0x17c8('0x8'));var config=require(_0x17c8('0x9'));var jayson=require(_0x17c8('0xa'));var client=jayson[_0x17c8('0xb')][_0x17c8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1140ac,_0x11f77a,_0x39a318){return new BPromise(function(_0x354762,_0x326cf2){return client[_0x17c8('0xd')](_0x1140ac,_0x39a318)[_0x17c8('0xe')](function(_0x4322eb){logger[_0x17c8('0xf')]('Template,\x20%s,\x20%s',_0x11f77a,'request\x20sent');logger[_0x17c8('0x10')](_0x17c8('0x11'),_0x11f77a,_0x17c8('0x12'),JSON[_0x17c8('0x13')](_0x4322eb));if(_0x4322eb['error']){if(_0x4322eb[_0x17c8('0x14')][_0x17c8('0x15')]===0x1f4){logger['error'](_0x17c8('0x16'),_0x11f77a,_0x4322eb['error'][_0x17c8('0x17')]);return _0x326cf2(_0x4322eb[_0x17c8('0x14')][_0x17c8('0x17')]);}logger[_0x17c8('0x14')]('Template,\x20%s,\x20%s',_0x11f77a,_0x4322eb[_0x17c8('0x14')][_0x17c8('0x17')]);return _0x354762(_0x4322eb[_0x17c8('0x14')]['message']);}else{logger[_0x17c8('0xf')](_0x17c8('0x16'),_0x11f77a,_0x17c8('0x12'));_0x354762(_0x4322eb[_0x17c8('0x18')]['message']);}})['catch'](function(_0xa2807d){logger['error'](_0x17c8('0x16'),_0x11f77a,_0xa2807d);_0x326cf2(_0xa2807d);});});}exports[_0x17c8('0x19')]=function(_0x151aa4){var _0x442765=this;return new Promise(function(_0x51f5e3,_0x580e58){return db[_0x17c8('0x1a')][_0x17c8('0x1b')]({'raw':_0x151aa4[_0x17c8('0x1c')]?_0x151aa4['options'][_0x17c8('0x1d')]===undefined?!![]:![]:!![],'where':_0x151aa4[_0x17c8('0x1c')]?_0x151aa4['options'][_0x17c8('0x1e')]||null:null,'attributes':_0x151aa4[_0x17c8('0x1c')]?_0x151aa4['options'][_0x17c8('0x1f')]||null:null,'limit':_0x151aa4[_0x17c8('0x1c')]?_0x151aa4[_0x17c8('0x1c')][_0x17c8('0x20')]||null:null,'include':_0x151aa4[_0x17c8('0x1c')]?_0x151aa4['options'][_0x17c8('0x21')]?_[_0x17c8('0x22')](_0x151aa4[_0x17c8('0x1c')][_0x17c8('0x21')],function(_0x27890f){return{'model':db[_0x27890f[_0x17c8('0x23')]],'as':_0x27890f['as'],'attributes':_0x27890f[_0x17c8('0x1f')],'include':_0x27890f[_0x17c8('0x21')]?_['map'](_0x27890f[_0x17c8('0x21')],function(_0x542803){return{'model':db[_0x542803[_0x17c8('0x23')]],'as':_0x542803['as'],'attributes':_0x542803[_0x17c8('0x1f')],'include':_0x542803[_0x17c8('0x21')]?_[_0x17c8('0x22')](_0x542803['include'],function(_0x29c77a){return{'model':db[_0x29c77a[_0x17c8('0x23')]],'as':_0x29c77a['as'],'attributes':_0x29c77a['attributes']};}):[]};}):[]};}):[]:[]})[_0x17c8('0xe')](function(_0x4e783c){logger[_0x17c8('0xf')](_0x17c8('0x19'),_0x151aa4);logger['debug'](_0x17c8('0x19'),_0x151aa4,JSON[_0x17c8('0x13')](_0x4e783c));_0x51f5e3(_0x4e783c);})[_0x17c8('0x24')](function(_0x3e2218){logger[_0x17c8('0x14')](_0x17c8('0x19'),_0x3e2218[_0x17c8('0x17')],_0x151aa4);_0x580e58(_0x442765[_0x17c8('0x14')](0x1f4,_0x3e2218['message']));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 1af788f..3db692a 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 _0x9a69=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/all_conditions','/:id/any_conditions','getAnyConditions','/:id/actions','post','create','addAllCondition','addAnyCondition','addAction','put'];(function(_0x453e45,_0x526dce){var _0x5c9031=function(_0x84506){while(--_0x84506){_0x453e45['push'](_0x453e45['shift']());}};_0x5c9031(++_0x526dce);}(_0x9a69,0x9e));var _0x99a6=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x9a69[_0x19950b];return _0x3c6b41;};'use strict';var multer=require(_0x99a6('0x0'));var util=require(_0x99a6('0x1'));var path=require(_0x99a6('0x2'));var timeout=require(_0x99a6('0x3'));var express=require(_0x99a6('0x4'));var router=express[_0x99a6('0x5')]();var fs_extra=require(_0x99a6('0x6'));var auth=require(_0x99a6('0x7'));var interaction=require(_0x99a6('0x8'));var config=require(_0x99a6('0x9'));var controller=require('./trigger.controller');router[_0x99a6('0xa')]('/',auth[_0x99a6('0xb')](),controller['index']);router['get'](_0x99a6('0xc'),auth[_0x99a6('0xb')](),controller[_0x99a6('0xd')]);router[_0x99a6('0xa')](_0x99a6('0xe'),auth[_0x99a6('0xb')](),controller['getAllConditions']);router['get'](_0x99a6('0xf'),auth[_0x99a6('0xb')](),controller[_0x99a6('0x10')]);router[_0x99a6('0xa')](_0x99a6('0x11'),auth[_0x99a6('0xb')](),controller['getActions']);router[_0x99a6('0x12')]('/',auth['isAuthenticated'](),controller[_0x99a6('0x13')]);router[_0x99a6('0x12')](_0x99a6('0xe'),auth[_0x99a6('0xb')](),controller[_0x99a6('0x14')]);router['post']('/:id/any_conditions',auth[_0x99a6('0xb')](),controller[_0x99a6('0x15')]);router[_0x99a6('0x12')](_0x99a6('0x11'),auth[_0x99a6('0xb')](),controller[_0x99a6('0x16')]);router[_0x99a6('0x17')](_0x99a6('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x99a6('0xc'),auth[_0x99a6('0xb')](),controller[_0x99a6('0x18')]);module[_0x99a6('0x19')]=router; \ No newline at end of file +var _0x4c8a=['../../components/interaction/service','../../config/environment','./trigger.controller','get','index','/:id','isAuthenticated','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','getActions','post','create','addAllCondition','addAnyCondition','/:id/actions','addAction','put','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4c8a,0x1d9));var _0xa4c8=function(_0x4e0065,_0x9bbc5c){_0x4e0065=_0x4e0065-0x0;var _0x3afce6=_0x4c8a[_0x4e0065];return _0x3afce6;};'use strict';var multer=require(_0xa4c8('0x0'));var util=require('util');var path=require(_0xa4c8('0x1'));var timeout=require(_0xa4c8('0x2'));var express=require(_0xa4c8('0x3'));var router=express[_0xa4c8('0x4')]();var fs_extra=require(_0xa4c8('0x5'));var auth=require(_0xa4c8('0x6'));var interaction=require(_0xa4c8('0x7'));var config=require(_0xa4c8('0x8'));var controller=require(_0xa4c8('0x9'));router[_0xa4c8('0xa')]('/',auth['isAuthenticated'](),controller[_0xa4c8('0xb')]);router[_0xa4c8('0xa')](_0xa4c8('0xc'),auth[_0xa4c8('0xd')](),controller[_0xa4c8('0xe')]);router['get'](_0xa4c8('0xf'),auth[_0xa4c8('0xd')](),controller[_0xa4c8('0x10')]);router[_0xa4c8('0xa')](_0xa4c8('0x11'),auth[_0xa4c8('0xd')](),controller[_0xa4c8('0x12')]);router[_0xa4c8('0xa')]('/:id/actions',auth[_0xa4c8('0xd')](),controller[_0xa4c8('0x13')]);router[_0xa4c8('0x14')]('/',auth[_0xa4c8('0xd')](),controller[_0xa4c8('0x15')]);router[_0xa4c8('0x14')](_0xa4c8('0xf'),auth['isAuthenticated'](),controller[_0xa4c8('0x16')]);router[_0xa4c8('0x14')]('/:id/any_conditions',auth[_0xa4c8('0xd')](),controller[_0xa4c8('0x17')]);router[_0xa4c8('0x14')](_0xa4c8('0x18'),auth[_0xa4c8('0xd')](),controller[_0xa4c8('0x19')]);router[_0xa4c8('0x1a')](_0xa4c8('0xc'),auth[_0xa4c8('0xd')](),controller[_0xa4c8('0x1b')]);router['delete'](_0xa4c8('0xc'),auth['isAuthenticated'](),controller[_0xa4c8('0x1c')]);module[_0xa4c8('0x1d')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 191de8b..dc7a4f3 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 _0x0b24=['STRING','exports'];(function(_0x436adc,_0x5c9ae1){var _0x421a87=function(_0x29c7b9){while(--_0x29c7b9){_0x436adc['push'](_0x436adc['shift']());}};_0x421a87(++_0x5c9ae1);}(_0x0b24,0x19b));var _0x40b2=function(_0x17012b,_0x38c627){_0x17012b=_0x17012b-0x0;var _0x4735a9=_0x0b24[_0x17012b];return _0x4735a9;};'use strict';var Sequelize=require('sequelize');module[_0x40b2('0x0')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x40b2('0x1')]},'description':{'type':Sequelize[_0x40b2('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x921d=['BOOLEAN','STRING'];(function(_0x5ebed9,_0x406655){var _0x89e5e8=function(_0x8fe5ba){while(--_0x8fe5ba){_0x5ebed9['push'](_0x5ebed9['shift']());}};_0x89e5e8(++_0x406655);}(_0x921d,0xf3));var _0xd921=function(_0x469181,_0x1445de){_0x469181=_0x469181-0x0;var _0x39899d=_0x921d[_0x469181];return _0x39899d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xd921('0x0')]},'description':{'type':Sequelize[_0xd921('0x0')]},'status':{'type':Sequelize[_0xd921('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 56813e6..3f18518 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 _0xf755=['desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','limit','count','offset','status','set','apply','reject','save','update','destroy','then','get','Triggers','UserProfileResource','error','stack','send','map','Trigger','rawAttributes','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','order','where','filters','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','findOne','sort','filter','nolimit','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','zip-dir','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce'];(function(_0x532828,_0x5d68b1){var _0x42021a=function(_0x370933){while(--_0x370933){_0x532828['push'](_0x532828['shift']());}};_0x42021a(++_0x5d68b1);}(_0xf755,0xb3));var _0x5f75=function(_0x5979f5,_0x3167e5){_0x5979f5=_0x5979f5-0x0;var _0x42699e=_0xf755[_0x5979f5];return _0x42699e;};'use strict';var emlformat=require(_0x5f75('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5f75('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5f75('0x2'));var Mustache=require('mustache');var util=require(_0x5f75('0x3'));var path=require(_0x5f75('0x4'));var sox=require(_0x5f75('0x5'));var csv=require(_0x5f75('0x6'));var ejs=require(_0x5f75('0x7'));var fs=require('fs');var fs_extra=require(_0x5f75('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5f75('0x9'));var jsforce=require(_0x5f75('0xa'));var deskjs=require(_0x5f75('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5f75('0xc'));var Papa=require(_0x5f75('0xd'));var Redis=require(_0x5f75('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x5f75('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5f75('0x10'));var logger=require(_0x5f75('0x11'))(_0x5f75('0x12'));var utils=require(_0x5f75('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x5f75('0x14'));var db=require(_0x5f75('0x15'))['db'];function respondWithStatusCode(_0x481bf9,_0x5d8689){_0x5d8689=_0x5d8689||0xcc;return function(_0x47965a){if(_0x47965a){return _0x481bf9[_0x5f75('0x16')](_0x5d8689);}return _0x481bf9['status'](_0x5d8689)[_0x5f75('0x17')]();};}function respondWithResult(_0x4a5681,_0x355398){_0x355398=_0x355398||0xc8;return function(_0x2efffd){if(_0x2efffd){return _0x4a5681['status'](_0x355398)[_0x5f75('0x18')](_0x2efffd);}};}function respondWithFilteredResult(_0x301445,_0x1f9bd2){return function(_0x466b52){if(_0x466b52){var _0x264b22=typeof _0x1f9bd2['offset']===_0x5f75('0x19')&&typeof _0x1f9bd2[_0x5f75('0x1a')]===_0x5f75('0x19');var _0x434eb2=_0x466b52[_0x5f75('0x1b')];var _0x1506a7=_0x264b22?0x0:_0x1f9bd2['offset'];var _0x144a80=_0x264b22?_0x466b52[_0x5f75('0x1b')]:_0x1f9bd2[_0x5f75('0x1c')]+_0x1f9bd2[_0x5f75('0x1a')];var _0x15a2f1;if(_0x144a80>=_0x434eb2){_0x144a80=_0x434eb2;_0x15a2f1=0xc8;}else{_0x15a2f1=0xce;}_0x301445[_0x5f75('0x1d')](_0x15a2f1);return _0x301445[_0x5f75('0x1e')]('Content-Range',_0x1506a7+'-'+_0x144a80+'/'+_0x434eb2)['json'](_0x466b52);}return null;};}function patchUpdates(_0x1c418d){return function(_0x26d948){try{jsonpatch[_0x5f75('0x1f')](_0x26d948,_0x1c418d,!![]);}catch(_0x3eeb65){return BPromise[_0x5f75('0x20')](_0x3eeb65);}return _0x26d948[_0x5f75('0x21')]();};}function saveUpdates(_0x51428e,_0x23eacf){return function(_0x1f242c){if(_0x1f242c){return _0x1f242c[_0x5f75('0x22')](_0x51428e)['then'](function(_0x375649){return _0x375649;});}return null;};}function removeEntity(_0x5b8373,_0x3662ae){return function(_0x3b5302){if(_0x3b5302){return _0x3b5302[_0x5f75('0x23')]()[_0x5f75('0x24')](function(){var _0x7a819a=_0x3b5302[_0x5f75('0x25')]({'plain':!![]});var _0x2e0cb6=_0x5f75('0x26');return db[_0x5f75('0x27')][_0x5f75('0x23')]({'where':{'type':_0x2e0cb6,'resourceId':_0x7a819a['id']}})[_0x5f75('0x24')](function(){return _0x3b5302;});})[_0x5f75('0x24')](function(){_0x5b8373[_0x5f75('0x1d')](0xcc)[_0x5f75('0x17')]();});}};}function handleEntityNotFound(_0x4f2f41,_0x10aad5){return function(_0x4a2159){if(!_0x4a2159){_0x4f2f41[_0x5f75('0x16')](0x194);}return _0x4a2159;};}function handleError(_0x5cc387,_0x518ded){_0x518ded=_0x518ded||0x1f4;return function(_0x45f25f){logger[_0x5f75('0x28')](_0x45f25f[_0x5f75('0x29')]);if(_0x45f25f['name']){delete _0x45f25f['name'];}_0x5cc387[_0x5f75('0x1d')](_0x518ded)[_0x5f75('0x2a')](_0x45f25f);};}exports['index']=function(_0x77dc76,_0x15915b){var _0x2a9ce6={},_0x1db9f7={},_0x5f1d92={'count':0x0,'rows':[]};var _0x26d35c=_[_0x5f75('0x2b')](db[_0x5f75('0x2c')][_0x5f75('0x2d')],function(_0x5d52e1){return{'name':_0x5d52e1['fieldName'],'type':_0x5d52e1[_0x5f75('0x2e')][_0x5f75('0x2f')]};});_0x1db9f7[_0x5f75('0x30')]=_[_0x5f75('0x2b')](_0x26d35c,'name');_0x1db9f7[_0x5f75('0x31')]=_['keys'](_0x77dc76[_0x5f75('0x31')]);_0x1db9f7['filters']=_['intersection'](_0x1db9f7[_0x5f75('0x30')],_0x1db9f7[_0x5f75('0x31')]);_0x2a9ce6['attributes']=_[_0x5f75('0x32')](_0x1db9f7[_0x5f75('0x30')],qs[_0x5f75('0x33')](_0x77dc76[_0x5f75('0x31')][_0x5f75('0x33')]));_0x2a9ce6[_0x5f75('0x34')]=_0x2a9ce6[_0x5f75('0x34')][_0x5f75('0x35')]?_0x2a9ce6[_0x5f75('0x34')]:_0x1db9f7[_0x5f75('0x30')];if(!_0x77dc76['query'][_0x5f75('0x36')]('nolimit')){_0x2a9ce6['limit']=qs[_0x5f75('0x1a')](_0x77dc76[_0x5f75('0x31')][_0x5f75('0x1a')]);_0x2a9ce6[_0x5f75('0x1c')]=qs[_0x5f75('0x1c')](_0x77dc76[_0x5f75('0x31')]['offset']);}_0x2a9ce6[_0x5f75('0x37')]=qs['sort'](_0x77dc76[_0x5f75('0x31')]['sort']);_0x2a9ce6[_0x5f75('0x38')]=qs[_0x5f75('0x39')](_[_0x5f75('0x3a')](_0x77dc76[_0x5f75('0x31')],_0x1db9f7[_0x5f75('0x39')]),_0x26d35c);if(_0x77dc76['query']['filter']){_0x2a9ce6[_0x5f75('0x38')]=_[_0x5f75('0x3b')](_0x2a9ce6[_0x5f75('0x38')],{'$or':_[_0x5f75('0x2b')](_0x26d35c,function(_0x3eda8a){if(_0x3eda8a[_0x5f75('0x2e')]!==_0x5f75('0x3c')){var _0x279462={};_0x279462[_0x3eda8a['name']]={'$like':'%'+_0x77dc76[_0x5f75('0x31')]['filter']+'%'};return _0x279462;}})});}_0x2a9ce6=_[_0x5f75('0x3b')]({},_0x2a9ce6,_0x77dc76[_0x5f75('0x3d')]);var _0x453e77={'where':_0x2a9ce6['where']};return db[_0x5f75('0x2c')][_0x5f75('0x1b')](_0x453e77)[_0x5f75('0x24')](function(_0x21b1c2){_0x5f1d92['count']=_0x21b1c2;if(_0x77dc76[_0x5f75('0x31')][_0x5f75('0x3e')]){_0x2a9ce6[_0x5f75('0x3f')]=[{'all':!![]}];}return db['Trigger'][_0x5f75('0x40')](_0x2a9ce6);})[_0x5f75('0x24')](function(_0x541455){_0x5f1d92[_0x5f75('0x41')]=_0x541455;return _0x5f1d92;})[_0x5f75('0x24')](respondWithFilteredResult(_0x15915b,_0x2a9ce6))[_0x5f75('0x42')](handleError(_0x15915b,null));};exports[_0x5f75('0x43')]=function(_0x50ce59,_0x5828b3){var _0x3ae2e3={'raw':![],'where':{'id':_0x50ce59[_0x5f75('0x44')]['id']}},_0x53611e={};_0x53611e[_0x5f75('0x30')]=_['keys'](db['Trigger'][_0x5f75('0x2d')]);_0x53611e[_0x5f75('0x31')]=_[_0x5f75('0x45')](_0x50ce59[_0x5f75('0x31')]);_0x53611e[_0x5f75('0x39')]=_[_0x5f75('0x32')](_0x53611e['model'],_0x53611e['query']);_0x3ae2e3['attributes']=_['intersection'](_0x53611e[_0x5f75('0x30')],qs[_0x5f75('0x33')](_0x50ce59[_0x5f75('0x31')][_0x5f75('0x33')]));_0x3ae2e3['attributes']=_0x3ae2e3[_0x5f75('0x34')][_0x5f75('0x35')]?_0x3ae2e3[_0x5f75('0x34')]:_0x53611e[_0x5f75('0x30')];if(_0x50ce59['query'][_0x5f75('0x3e')]){_0x3ae2e3[_0x5f75('0x3f')]=[{'all':!![]}];}_0x3ae2e3=_[_0x5f75('0x3b')]({},_0x3ae2e3,_0x50ce59[_0x5f75('0x3d')]);return db[_0x5f75('0x2c')]['find'](_0x3ae2e3)[_0x5f75('0x24')](handleEntityNotFound(_0x5828b3,null))[_0x5f75('0x24')](respondWithResult(_0x5828b3,null))['catch'](handleError(_0x5828b3,null));};exports[_0x5f75('0x46')]=function(_0x405d55,_0xa2597){return db['Trigger']['create'](_0x405d55[_0x5f75('0x47')],{})[_0x5f75('0x24')](function(_0x447160){var _0x2de60f=_0x405d55[_0x5f75('0x48')][_0x5f75('0x25')]({'plain':!![]});if(!_0x2de60f)throw new Error(_0x5f75('0x49'));if(_0x2de60f[_0x5f75('0x4a')]==='user'){var _0x34b9ff=_0x447160['get']({'plain':!![]});var _0x3001a3=_0x5f75('0x26');return db[_0x5f75('0x4b')][_0x5f75('0x4c')]({'where':{'name':_0x3001a3,'userProfileId':_0x2de60f[_0x5f75('0x4d')]},'raw':!![]})[_0x5f75('0x24')](function(_0x24e5f8){if(_0x24e5f8&&_0x24e5f8[_0x5f75('0x4e')]===0x0){return db[_0x5f75('0x27')][_0x5f75('0x46')]({'name':_0x34b9ff[_0x5f75('0x4f')],'resourceId':_0x34b9ff['id'],'type':_0x24e5f8[_0x5f75('0x4f')],'sectionId':_0x24e5f8['id']},{})[_0x5f75('0x24')](function(){return _0x447160;});}else{return _0x447160;}})[_0x5f75('0x42')](function(_0xdd5edb){logger[_0x5f75('0x28')](_0x5f75('0x50'),_0xdd5edb);throw _0xdd5edb;});}return _0x447160;})[_0x5f75('0x24')](respondWithResult(_0xa2597,0xc9))['catch'](handleError(_0xa2597,null));};exports['update']=function(_0x173e7a,_0x4661b6){if(_0x173e7a[_0x5f75('0x47')]['id']){delete _0x173e7a[_0x5f75('0x47')]['id'];}return db['Trigger']['find']({'where':{'id':_0x173e7a[_0x5f75('0x44')]['id']}})['then'](handleEntityNotFound(_0x4661b6,null))['then'](saveUpdates(_0x173e7a[_0x5f75('0x47')],null))[_0x5f75('0x24')](respondWithResult(_0x4661b6,null))[_0x5f75('0x42')](handleError(_0x4661b6,null));};exports[_0x5f75('0x23')]=function(_0x25c523,_0x3a10fd){return db[_0x5f75('0x2c')]['find']({'where':{'id':_0x25c523[_0x5f75('0x44')]['id']}})[_0x5f75('0x24')](handleEntityNotFound(_0x3a10fd,null))[_0x5f75('0x24')](removeEntity(_0x3a10fd,null))['catch'](handleError(_0x3a10fd,null));};exports[_0x5f75('0x51')]=function(_0x59e57b,_0x536769,_0x20e864){if(_0x59e57b[_0x5f75('0x47')]['id']){delete _0x59e57b[_0x5f75('0x47')]['id'];}return db[_0x5f75('0x2c')]['find']({'where':{'id':_0x59e57b[_0x5f75('0x44')]['id']}})[_0x5f75('0x24')](handleEntityNotFound(_0x536769,null))['then'](function(_0x6b32e6){if(_0x6b32e6){_0x59e57b[_0x5f75('0x47')][_0x5f75('0x52')]=_0x6b32e6['id'];return db[_0x5f75('0x53')]['create'](_0x59e57b[_0x5f75('0x47')]);}})[_0x5f75('0x24')](respondWithResult(_0x536769,null))[_0x5f75('0x42')](handleError(_0x536769,null));};exports[_0x5f75('0x54')]=function(_0x4c623a,_0x16bebd,_0xd09446){if(_0x4c623a[_0x5f75('0x47')]['id']){delete _0x4c623a[_0x5f75('0x47')]['id'];}return db['Trigger'][_0x5f75('0x4c')]({'where':{'id':_0x4c623a['params']['id']}})['then'](handleEntityNotFound(_0x16bebd,null))[_0x5f75('0x24')](function(_0x5754a8){if(_0x5754a8){_0x4c623a[_0x5f75('0x47')][_0x5f75('0x55')]=_0x5754a8['id'];return db['Condition']['create'](_0x4c623a[_0x5f75('0x47')]);}})[_0x5f75('0x24')](respondWithResult(_0x16bebd,null))[_0x5f75('0x42')](handleError(_0x16bebd,null));};exports['getAllConditions']=function(_0xd97033,_0x17548b,_0x2599f3){var _0x1238bb={};var _0x3fa85d={};var _0x3654f9;var _0xcdf07;return db['Trigger'][_0x5f75('0x56')]({'where':{'id':_0xd97033[_0x5f75('0x44')]['id']}})[_0x5f75('0x24')](handleEntityNotFound(_0x17548b,null))[_0x5f75('0x24')](function(_0x50f0f5){if(_0x50f0f5){_0x3654f9=_0x50f0f5;_0x3fa85d[_0x5f75('0x30')]=_[_0x5f75('0x45')](db[_0x5f75('0x53')]['rawAttributes']);_0x3fa85d[_0x5f75('0x31')]=_[_0x5f75('0x45')](_0xd97033['query']);_0x3fa85d[_0x5f75('0x39')]=_[_0x5f75('0x32')](_0x3fa85d[_0x5f75('0x30')],_0x3fa85d[_0x5f75('0x31')]);_0x1238bb['attributes']=_['intersection'](_0x3fa85d[_0x5f75('0x30')],qs[_0x5f75('0x33')](_0xd97033['query']['fields']));_0x1238bb[_0x5f75('0x34')]=_0x1238bb[_0x5f75('0x34')][_0x5f75('0x35')]?_0x1238bb[_0x5f75('0x34')]:_0x3fa85d[_0x5f75('0x30')];_0x1238bb[_0x5f75('0x37')]=qs[_0x5f75('0x57')](_0xd97033['query'][_0x5f75('0x57')]);_0x1238bb[_0x5f75('0x38')]=qs[_0x5f75('0x39')](_[_0x5f75('0x3a')](_0xd97033[_0x5f75('0x31')],_0x3fa85d[_0x5f75('0x39')]));if(_0xd97033[_0x5f75('0x31')][_0x5f75('0x58')]){_0x1238bb['where']=_['merge'](_0x1238bb[_0x5f75('0x38')],{'$or':_[_0x5f75('0x2b')](_0x1238bb[_0x5f75('0x34')],function(_0x49f25d){var _0x37d7b0={};_0x37d7b0[_0x49f25d]={'$like':'%'+_0xd97033[_0x5f75('0x31')][_0x5f75('0x58')]+'%'};return _0x37d7b0;})});}_0x1238bb=_['merge']({},_0x1238bb,_0xd97033[_0x5f75('0x3d')]);return _0x3654f9['getAllConditions'](_0x1238bb);}})[_0x5f75('0x24')](function(_0x308edd){if(_0x308edd){_0xcdf07=_0x308edd['length'];if(!_0xd97033['query'][_0x5f75('0x36')](_0x5f75('0x59'))){_0x1238bb[_0x5f75('0x1a')]=qs[_0x5f75('0x1a')](_0xd97033[_0x5f75('0x31')]['limit']);_0x1238bb['offset']=qs['offset'](_0xd97033[_0x5f75('0x31')][_0x5f75('0x1c')]);}return _0x3654f9['getAllConditions'](_0x1238bb);}})[_0x5f75('0x24')](function(_0x552822){if(_0x552822){return _0x552822?{'count':_0xcdf07,'rows':_0x552822}:null;}})['then'](respondWithResult(_0x17548b,null))[_0x5f75('0x42')](handleError(_0x17548b,null));};exports['getAnyConditions']=function(_0xab9198,_0x23e36c,_0x2f1e0b){var _0x542dd7={};var _0x43ed53={};var _0x2e5f42;var _0x3efed6;return db[_0x5f75('0x2c')]['findOne']({'where':{'id':_0xab9198[_0x5f75('0x44')]['id']}})[_0x5f75('0x24')](handleEntityNotFound(_0x23e36c,null))[_0x5f75('0x24')](function(_0x2d869a){if(_0x2d869a){_0x2e5f42=_0x2d869a;_0x43ed53[_0x5f75('0x30')]=_[_0x5f75('0x45')](db['Condition'][_0x5f75('0x2d')]);_0x43ed53[_0x5f75('0x31')]=_[_0x5f75('0x45')](_0xab9198[_0x5f75('0x31')]);_0x43ed53[_0x5f75('0x39')]=_[_0x5f75('0x32')](_0x43ed53[_0x5f75('0x30')],_0x43ed53[_0x5f75('0x31')]);_0x542dd7[_0x5f75('0x34')]=_['intersection'](_0x43ed53[_0x5f75('0x30')],qs[_0x5f75('0x33')](_0xab9198[_0x5f75('0x31')][_0x5f75('0x33')]));_0x542dd7[_0x5f75('0x34')]=_0x542dd7[_0x5f75('0x34')][_0x5f75('0x35')]?_0x542dd7[_0x5f75('0x34')]:_0x43ed53[_0x5f75('0x30')];_0x542dd7[_0x5f75('0x37')]=qs[_0x5f75('0x57')](_0xab9198['query'][_0x5f75('0x57')]);_0x542dd7[_0x5f75('0x38')]=qs[_0x5f75('0x39')](_['pick'](_0xab9198['query'],_0x43ed53[_0x5f75('0x39')]));if(_0xab9198[_0x5f75('0x31')][_0x5f75('0x58')]){_0x542dd7[_0x5f75('0x38')]=_[_0x5f75('0x3b')](_0x542dd7[_0x5f75('0x38')],{'$or':_[_0x5f75('0x2b')](_0x542dd7['attributes'],function(_0x15e18e){var _0x1023e5={};_0x1023e5[_0x15e18e]={'$like':'%'+_0xab9198[_0x5f75('0x31')][_0x5f75('0x58')]+'%'};return _0x1023e5;})});}_0x542dd7=_[_0x5f75('0x3b')]({},_0x542dd7,_0xab9198[_0x5f75('0x3d')]);return _0x2e5f42[_0x5f75('0x5a')](_0x542dd7);}})['then'](function(_0x42ca06){if(_0x42ca06){_0x3efed6=_0x42ca06[_0x5f75('0x35')];if(!_0xab9198[_0x5f75('0x31')][_0x5f75('0x36')](_0x5f75('0x59'))){_0x542dd7[_0x5f75('0x1a')]=qs['limit'](_0xab9198['query']['limit']);_0x542dd7[_0x5f75('0x1c')]=qs['offset'](_0xab9198[_0x5f75('0x31')]['offset']);}return _0x2e5f42[_0x5f75('0x5a')](_0x542dd7);}})['then'](function(_0x4782cd){if(_0x4782cd){return _0x4782cd?{'count':_0x3efed6,'rows':_0x4782cd}:null;}})['then'](respondWithResult(_0x23e36c,null))['catch'](handleError(_0x23e36c,null));};exports[_0x5f75('0x5b')]=function(_0x3b5b34,_0x301606,_0x1adc2f){if(_0x3b5b34[_0x5f75('0x47')]['id']){delete _0x3b5b34[_0x5f75('0x47')]['id'];}return db[_0x5f75('0x2c')]['find']({'where':{'id':_0x3b5b34['params']['id']}})[_0x5f75('0x24')](handleEntityNotFound(_0x301606,null))[_0x5f75('0x24')](function(_0x5e6c9f){if(_0x5e6c9f){_0x3b5b34[_0x5f75('0x47')][_0x5f75('0x5c')]=_0x5e6c9f['id'];return db[_0x5f75('0x5d')]['create'](_0x3b5b34[_0x5f75('0x47')]);}})[_0x5f75('0x24')](respondWithResult(_0x301606,null))[_0x5f75('0x42')](handleError(_0x301606,null));};exports[_0x5f75('0x5e')]=function(_0x34a47e,_0x54dcf9,_0xac9c7){var _0x2d1be3={};var _0x35bc52={};var _0x15499b;var _0x19439d;return db[_0x5f75('0x2c')][_0x5f75('0x56')]({'where':{'id':_0x34a47e['params']['id']}})[_0x5f75('0x24')](handleEntityNotFound(_0x54dcf9,null))[_0x5f75('0x24')](function(_0x25c621){if(_0x25c621){_0x15499b=_0x25c621;_0x35bc52[_0x5f75('0x30')]=_['keys'](db['Action'][_0x5f75('0x2d')]);_0x35bc52[_0x5f75('0x31')]=_[_0x5f75('0x45')](_0x34a47e[_0x5f75('0x31')]);_0x35bc52[_0x5f75('0x39')]=_['intersection'](_0x35bc52[_0x5f75('0x30')],_0x35bc52[_0x5f75('0x31')]);_0x2d1be3[_0x5f75('0x34')]=_['intersection'](_0x35bc52[_0x5f75('0x30')],qs[_0x5f75('0x33')](_0x34a47e[_0x5f75('0x31')][_0x5f75('0x33')]));_0x2d1be3[_0x5f75('0x34')]=_0x2d1be3['attributes'][_0x5f75('0x35')]?_0x2d1be3[_0x5f75('0x34')]:_0x35bc52[_0x5f75('0x30')];_0x2d1be3[_0x5f75('0x37')]=qs['sort'](_0x34a47e['query'][_0x5f75('0x57')]);_0x2d1be3[_0x5f75('0x38')]=qs[_0x5f75('0x39')](_['pick'](_0x34a47e[_0x5f75('0x31')],_0x35bc52[_0x5f75('0x39')]));if(_0x34a47e[_0x5f75('0x31')][_0x5f75('0x58')]){_0x2d1be3[_0x5f75('0x38')]=_[_0x5f75('0x3b')](_0x2d1be3[_0x5f75('0x38')],{'$or':_['map'](_0x2d1be3[_0x5f75('0x34')],function(_0x28f2ba){var _0x152e8f={};_0x152e8f[_0x28f2ba]={'$like':'%'+_0x34a47e['query'][_0x5f75('0x58')]+'%'};return _0x152e8f;})});}_0x2d1be3=_[_0x5f75('0x3b')]({},_0x2d1be3,_0x34a47e[_0x5f75('0x3d')]);return _0x15499b[_0x5f75('0x5e')](_0x2d1be3);}})[_0x5f75('0x24')](function(_0x5490a4){if(_0x5490a4){_0x19439d=_0x5490a4['length'];if(!_0x34a47e[_0x5f75('0x31')][_0x5f75('0x36')]('nolimit')){_0x2d1be3[_0x5f75('0x1a')]=qs[_0x5f75('0x1a')](_0x34a47e[_0x5f75('0x31')][_0x5f75('0x1a')]);_0x2d1be3['offset']=qs[_0x5f75('0x1c')](_0x34a47e[_0x5f75('0x31')][_0x5f75('0x1c')]);}return _0x15499b[_0x5f75('0x5e')](_0x2d1be3);}})[_0x5f75('0x24')](function(_0x1a2803){if(_0x1a2803){return _0x1a2803?{'count':_0x19439d,'rows':_0x1a2803}:null;}})[_0x5f75('0x24')](respondWithResult(_0x54dcf9,null))['catch'](handleError(_0x54dcf9,null));}; \ No newline at end of file +var _0xf089=['../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','get','Triggers','UserProfileResource','error','stack','name','send','map','Trigger','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','rawAttributes','length','find','create','body','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','TriggerAnyId','findOne','getAllConditions','getAnyConditions','addAction','TriggerId','Action','getActions','request-promise','bluebird','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'];(function(_0x42db32,_0x5a5f53){var _0x5cca0c=function(_0x2a349d){while(--_0x2a349d){_0x42db32['push'](_0x42db32['shift']());}};_0x5cca0c(++_0x5a5f53);}(_0xf089,0xff));var _0x9f08=function(_0x5de0e9,_0x99829f){_0x5de0e9=_0x5de0e9-0x0;var _0x82f695=_0xf089[_0x5de0e9];return _0x82f695;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9f08('0x0'));var moment=require('moment');var BPromise=require(_0x9f08('0x1'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x9f08('0x2'));var ejs=require(_0x9f08('0x3'));var fs=require('fs');var fs_extra=require(_0x9f08('0x4'));var _=require(_0x9f08('0x5'));var squel=require(_0x9f08('0x6'));var crypto=require(_0x9f08('0x7'));var jsforce=require(_0x9f08('0x8'));var deskjs=require(_0x9f08('0x9'));var toCsv=require('to-csv');var querystring=require(_0x9f08('0xa'));var Papa=require(_0x9f08('0xb'));var Redis=require(_0x9f08('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9f08('0xd'));var hardwareService=require(_0x9f08('0xe'));var logger=require(_0x9f08('0xf'))(_0x9f08('0x10'));var utils=require(_0x9f08('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x9f08('0x12'));var db=require(_0x9f08('0x13'))['db'];function respondWithStatusCode(_0x293bea,_0x1a0aed){_0x1a0aed=_0x1a0aed||0xcc;return function(_0x2b6e12){if(_0x2b6e12){return _0x293bea[_0x9f08('0x14')](_0x1a0aed);}return _0x293bea['status'](_0x1a0aed)[_0x9f08('0x15')]();};}function respondWithResult(_0x1dd10e,_0x44ab2e){_0x44ab2e=_0x44ab2e||0xc8;return function(_0x20fe8e){if(_0x20fe8e){return _0x1dd10e[_0x9f08('0x16')](_0x44ab2e)[_0x9f08('0x17')](_0x20fe8e);}};}function respondWithFilteredResult(_0x19ee41,_0x3a4233){return function(_0xd3e9fd){if(_0xd3e9fd){var _0x1411e1=typeof _0x3a4233[_0x9f08('0x18')]==='undefined'&&typeof _0x3a4233[_0x9f08('0x19')]===_0x9f08('0x1a');var _0x1b95b6=_0xd3e9fd[_0x9f08('0x1b')];var _0x48ea8d=_0x1411e1?0x0:_0x3a4233[_0x9f08('0x18')];var _0xc9bd13=_0x1411e1?_0xd3e9fd[_0x9f08('0x1b')]:_0x3a4233[_0x9f08('0x18')]+_0x3a4233[_0x9f08('0x19')];var _0x30dcd1;if(_0xc9bd13>=_0x1b95b6){_0xc9bd13=_0x1b95b6;_0x30dcd1=0xc8;}else{_0x30dcd1=0xce;}_0x19ee41[_0x9f08('0x16')](_0x30dcd1);return _0x19ee41['set'](_0x9f08('0x1c'),_0x48ea8d+'-'+_0xc9bd13+'/'+_0x1b95b6)[_0x9f08('0x17')](_0xd3e9fd);}return null;};}function patchUpdates(_0x54d261){return function(_0x5b67c9){try{jsonpatch[_0x9f08('0x1d')](_0x5b67c9,_0x54d261,!![]);}catch(_0x52daac){return BPromise[_0x9f08('0x1e')](_0x52daac);}return _0x5b67c9[_0x9f08('0x1f')]();};}function saveUpdates(_0x18ffef,_0x457629){return function(_0x1ce9ba){if(_0x1ce9ba){return _0x1ce9ba[_0x9f08('0x20')](_0x18ffef)[_0x9f08('0x21')](function(_0x3e111b){return _0x3e111b;});}return null;};}function removeEntity(_0x362a47,_0xe361f1){return function(_0x1ae1f0){if(_0x1ae1f0){return _0x1ae1f0[_0x9f08('0x22')]()[_0x9f08('0x21')](function(){var _0x423f4a=_0x1ae1f0[_0x9f08('0x23')]({'plain':!![]});var _0x417b8a=_0x9f08('0x24');return db[_0x9f08('0x25')][_0x9f08('0x22')]({'where':{'type':_0x417b8a,'resourceId':_0x423f4a['id']}})[_0x9f08('0x21')](function(){return _0x1ae1f0;});})['then'](function(){_0x362a47[_0x9f08('0x16')](0xcc)[_0x9f08('0x15')]();});}};}function handleEntityNotFound(_0x3cc523,_0x4c5040){return function(_0x37fc25){if(!_0x37fc25){_0x3cc523[_0x9f08('0x14')](0x194);}return _0x37fc25;};}function handleError(_0xd9bd45,_0x4929f8){_0x4929f8=_0x4929f8||0x1f4;return function(_0x20911b){logger[_0x9f08('0x26')](_0x20911b[_0x9f08('0x27')]);if(_0x20911b[_0x9f08('0x28')]){delete _0x20911b[_0x9f08('0x28')];}_0xd9bd45[_0x9f08('0x16')](_0x4929f8)[_0x9f08('0x29')](_0x20911b);};}exports['index']=function(_0x3a86e5,_0x4fda66){var _0x4b9d36={},_0x55d617={},_0x36a84d={'count':0x0,'rows':[]};var _0x5d5fce=_[_0x9f08('0x2a')](db[_0x9f08('0x2b')]['rawAttributes'],function(_0x226d1b){return{'name':_0x226d1b[_0x9f08('0x2c')],'type':_0x226d1b[_0x9f08('0x2d')][_0x9f08('0x2e')]};});_0x55d617[_0x9f08('0x2f')]=_[_0x9f08('0x2a')](_0x5d5fce,_0x9f08('0x28'));_0x55d617[_0x9f08('0x30')]=_['keys'](_0x3a86e5['query']);_0x55d617['filters']=_[_0x9f08('0x31')](_0x55d617['model'],_0x55d617[_0x9f08('0x30')]);_0x4b9d36[_0x9f08('0x32')]=_[_0x9f08('0x31')](_0x55d617[_0x9f08('0x2f')],qs[_0x9f08('0x33')](_0x3a86e5[_0x9f08('0x30')][_0x9f08('0x33')]));_0x4b9d36['attributes']=_0x4b9d36[_0x9f08('0x32')]['length']?_0x4b9d36[_0x9f08('0x32')]:_0x55d617['model'];if(!_0x3a86e5['query'][_0x9f08('0x34')](_0x9f08('0x35'))){_0x4b9d36[_0x9f08('0x19')]=qs[_0x9f08('0x19')](_0x3a86e5[_0x9f08('0x30')]['limit']);_0x4b9d36[_0x9f08('0x18')]=qs[_0x9f08('0x18')](_0x3a86e5[_0x9f08('0x30')][_0x9f08('0x18')]);}_0x4b9d36[_0x9f08('0x36')]=qs[_0x9f08('0x37')](_0x3a86e5['query'][_0x9f08('0x37')]);_0x4b9d36[_0x9f08('0x38')]=qs[_0x9f08('0x39')](_[_0x9f08('0x3a')](_0x3a86e5[_0x9f08('0x30')],_0x55d617['filters']),_0x5d5fce);if(_0x3a86e5[_0x9f08('0x30')][_0x9f08('0x3b')]){_0x4b9d36['where']=_[_0x9f08('0x3c')](_0x4b9d36[_0x9f08('0x38')],{'$or':_[_0x9f08('0x2a')](_0x5d5fce,function(_0x4e40ef){if(_0x4e40ef[_0x9f08('0x2d')]!==_0x9f08('0x3d')){var _0x1c1089={};_0x1c1089[_0x4e40ef[_0x9f08('0x28')]]={'$like':'%'+_0x3a86e5[_0x9f08('0x30')][_0x9f08('0x3b')]+'%'};return _0x1c1089;}})});}_0x4b9d36=_[_0x9f08('0x3c')]({},_0x4b9d36,_0x3a86e5[_0x9f08('0x3e')]);var _0x1f52ad={'where':_0x4b9d36[_0x9f08('0x38')]};return db[_0x9f08('0x2b')]['count'](_0x1f52ad)[_0x9f08('0x21')](function(_0x5c8014){_0x36a84d[_0x9f08('0x1b')]=_0x5c8014;if(_0x3a86e5[_0x9f08('0x30')][_0x9f08('0x3f')]){_0x4b9d36[_0x9f08('0x40')]=[{'all':!![]}];}return db[_0x9f08('0x2b')][_0x9f08('0x41')](_0x4b9d36);})[_0x9f08('0x21')](function(_0x39d659){_0x36a84d['rows']=_0x39d659;return _0x36a84d;})[_0x9f08('0x21')](respondWithFilteredResult(_0x4fda66,_0x4b9d36))[_0x9f08('0x42')](handleError(_0x4fda66,null));};exports[_0x9f08('0x43')]=function(_0x380ed0,_0x1a130b){var _0x230df1={'raw':![],'where':{'id':_0x380ed0[_0x9f08('0x44')]['id']}},_0x55faa7={};_0x55faa7[_0x9f08('0x2f')]=_[_0x9f08('0x45')](db[_0x9f08('0x2b')][_0x9f08('0x46')]);_0x55faa7['query']=_['keys'](_0x380ed0[_0x9f08('0x30')]);_0x55faa7[_0x9f08('0x39')]=_[_0x9f08('0x31')](_0x55faa7[_0x9f08('0x2f')],_0x55faa7['query']);_0x230df1[_0x9f08('0x32')]=_[_0x9f08('0x31')](_0x55faa7['model'],qs[_0x9f08('0x33')](_0x380ed0['query']['fields']));_0x230df1['attributes']=_0x230df1[_0x9f08('0x32')][_0x9f08('0x47')]?_0x230df1['attributes']:_0x55faa7[_0x9f08('0x2f')];if(_0x380ed0[_0x9f08('0x30')]['includeAll']){_0x230df1[_0x9f08('0x40')]=[{'all':!![]}];}_0x230df1=_[_0x9f08('0x3c')]({},_0x230df1,_0x380ed0[_0x9f08('0x3e')]);return db[_0x9f08('0x2b')][_0x9f08('0x48')](_0x230df1)['then'](handleEntityNotFound(_0x1a130b,null))[_0x9f08('0x21')](respondWithResult(_0x1a130b,null))[_0x9f08('0x42')](handleError(_0x1a130b,null));};exports['create']=function(_0x19497b,_0x24f3f1){return db[_0x9f08('0x2b')][_0x9f08('0x49')](_0x19497b[_0x9f08('0x4a')],{})[_0x9f08('0x21')](function(_0x1f1773){var _0x3ba0d2=_0x19497b[_0x9f08('0x4b')][_0x9f08('0x23')]({'plain':!![]});if(!_0x3ba0d2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3ba0d2[_0x9f08('0x4c')]===_0x9f08('0x4b')){var _0x5716e9=_0x1f1773[_0x9f08('0x23')]({'plain':!![]});var _0x31e38b='Triggers';return db[_0x9f08('0x4d')][_0x9f08('0x48')]({'where':{'name':_0x31e38b,'userProfileId':_0x3ba0d2['userProfileId']},'raw':!![]})[_0x9f08('0x21')](function(_0x4c81af){if(_0x4c81af&&_0x4c81af[_0x9f08('0x4e')]===0x0){return db['UserProfileResource'][_0x9f08('0x49')]({'name':_0x5716e9[_0x9f08('0x28')],'resourceId':_0x5716e9['id'],'type':_0x4c81af[_0x9f08('0x28')],'sectionId':_0x4c81af['id']},{})[_0x9f08('0x21')](function(){return _0x1f1773;});}else{return _0x1f1773;}})[_0x9f08('0x42')](function(_0x280a4c){logger[_0x9f08('0x26')](_0x9f08('0x4f'),_0x280a4c);throw _0x280a4c;});}return _0x1f1773;})[_0x9f08('0x21')](respondWithResult(_0x24f3f1,0xc9))[_0x9f08('0x42')](handleError(_0x24f3f1,null));};exports[_0x9f08('0x20')]=function(_0x36910d,_0x2b9bcb){if(_0x36910d[_0x9f08('0x4a')]['id']){delete _0x36910d[_0x9f08('0x4a')]['id'];}return db[_0x9f08('0x2b')]['find']({'where':{'id':_0x36910d[_0x9f08('0x44')]['id']}})[_0x9f08('0x21')](handleEntityNotFound(_0x2b9bcb,null))[_0x9f08('0x21')](saveUpdates(_0x36910d[_0x9f08('0x4a')],null))[_0x9f08('0x21')](respondWithResult(_0x2b9bcb,null))[_0x9f08('0x42')](handleError(_0x2b9bcb,null));};exports['destroy']=function(_0x4165fb,_0xbea7ff){return db[_0x9f08('0x2b')][_0x9f08('0x48')]({'where':{'id':_0x4165fb[_0x9f08('0x44')]['id']}})[_0x9f08('0x21')](handleEntityNotFound(_0xbea7ff,null))[_0x9f08('0x21')](removeEntity(_0xbea7ff,null))[_0x9f08('0x42')](handleError(_0xbea7ff,null));};exports[_0x9f08('0x50')]=function(_0x1b9b14,_0x11b0f2,_0x1d352c){if(_0x1b9b14['body']['id']){delete _0x1b9b14['body']['id'];}return db[_0x9f08('0x2b')][_0x9f08('0x48')]({'where':{'id':_0x1b9b14[_0x9f08('0x44')]['id']}})[_0x9f08('0x21')](handleEntityNotFound(_0x11b0f2,null))[_0x9f08('0x21')](function(_0xd73a17){if(_0xd73a17){_0x1b9b14[_0x9f08('0x4a')][_0x9f08('0x51')]=_0xd73a17['id'];return db[_0x9f08('0x52')][_0x9f08('0x49')](_0x1b9b14['body']);}})[_0x9f08('0x21')](respondWithResult(_0x11b0f2,null))[_0x9f08('0x42')](handleError(_0x11b0f2,null));};exports['addAnyCondition']=function(_0x170147,_0x3c4c66,_0x2e8186){if(_0x170147[_0x9f08('0x4a')]['id']){delete _0x170147[_0x9f08('0x4a')]['id'];}return db[_0x9f08('0x2b')][_0x9f08('0x48')]({'where':{'id':_0x170147[_0x9f08('0x44')]['id']}})[_0x9f08('0x21')](handleEntityNotFound(_0x3c4c66,null))['then'](function(_0x2017d0){if(_0x2017d0){_0x170147[_0x9f08('0x4a')][_0x9f08('0x53')]=_0x2017d0['id'];return db[_0x9f08('0x52')]['create'](_0x170147[_0x9f08('0x4a')]);}})[_0x9f08('0x21')](respondWithResult(_0x3c4c66,null))[_0x9f08('0x42')](handleError(_0x3c4c66,null));};exports['getAllConditions']=function(_0x2dc1cd,_0x326556,_0x2582e9){var _0x4143b5={};var _0x3fc7e2={};var _0x5e43ca;var _0x2231ce;return db[_0x9f08('0x2b')][_0x9f08('0x54')]({'where':{'id':_0x2dc1cd[_0x9f08('0x44')]['id']}})[_0x9f08('0x21')](handleEntityNotFound(_0x326556,null))[_0x9f08('0x21')](function(_0x3f0087){if(_0x3f0087){_0x5e43ca=_0x3f0087;_0x3fc7e2['model']=_[_0x9f08('0x45')](db[_0x9f08('0x52')][_0x9f08('0x46')]);_0x3fc7e2['query']=_[_0x9f08('0x45')](_0x2dc1cd[_0x9f08('0x30')]);_0x3fc7e2[_0x9f08('0x39')]=_[_0x9f08('0x31')](_0x3fc7e2['model'],_0x3fc7e2[_0x9f08('0x30')]);_0x4143b5[_0x9f08('0x32')]=_[_0x9f08('0x31')](_0x3fc7e2[_0x9f08('0x2f')],qs[_0x9f08('0x33')](_0x2dc1cd[_0x9f08('0x30')][_0x9f08('0x33')]));_0x4143b5['attributes']=_0x4143b5[_0x9f08('0x32')][_0x9f08('0x47')]?_0x4143b5[_0x9f08('0x32')]:_0x3fc7e2['model'];_0x4143b5[_0x9f08('0x36')]=qs['sort'](_0x2dc1cd[_0x9f08('0x30')][_0x9f08('0x37')]);_0x4143b5[_0x9f08('0x38')]=qs[_0x9f08('0x39')](_[_0x9f08('0x3a')](_0x2dc1cd[_0x9f08('0x30')],_0x3fc7e2[_0x9f08('0x39')]));if(_0x2dc1cd[_0x9f08('0x30')]['filter']){_0x4143b5[_0x9f08('0x38')]=_[_0x9f08('0x3c')](_0x4143b5[_0x9f08('0x38')],{'$or':_[_0x9f08('0x2a')](_0x4143b5['attributes'],function(_0x3b5a0d){var _0x3c25ed={};_0x3c25ed[_0x3b5a0d]={'$like':'%'+_0x2dc1cd['query'][_0x9f08('0x3b')]+'%'};return _0x3c25ed;})});}_0x4143b5=_[_0x9f08('0x3c')]({},_0x4143b5,_0x2dc1cd[_0x9f08('0x3e')]);return _0x5e43ca['getAllConditions'](_0x4143b5);}})['then'](function(_0x518850){if(_0x518850){_0x2231ce=_0x518850['length'];if(!_0x2dc1cd['query']['hasOwnProperty']('nolimit')){_0x4143b5[_0x9f08('0x19')]=qs[_0x9f08('0x19')](_0x2dc1cd[_0x9f08('0x30')]['limit']);_0x4143b5[_0x9f08('0x18')]=qs[_0x9f08('0x18')](_0x2dc1cd[_0x9f08('0x30')][_0x9f08('0x18')]);}return _0x5e43ca[_0x9f08('0x55')](_0x4143b5);}})[_0x9f08('0x21')](function(_0x196298){if(_0x196298){return _0x196298?{'count':_0x2231ce,'rows':_0x196298}:null;}})[_0x9f08('0x21')](respondWithResult(_0x326556,null))[_0x9f08('0x42')](handleError(_0x326556,null));};exports[_0x9f08('0x56')]=function(_0xfa4072,_0x521ce7,_0x47c618){var _0x2751c6={};var _0x18a06b={};var _0xfd4613;var _0x36bbba;return db[_0x9f08('0x2b')][_0x9f08('0x54')]({'where':{'id':_0xfa4072[_0x9f08('0x44')]['id']}})[_0x9f08('0x21')](handleEntityNotFound(_0x521ce7,null))[_0x9f08('0x21')](function(_0x40baba){if(_0x40baba){_0xfd4613=_0x40baba;_0x18a06b[_0x9f08('0x2f')]=_[_0x9f08('0x45')](db[_0x9f08('0x52')][_0x9f08('0x46')]);_0x18a06b[_0x9f08('0x30')]=_[_0x9f08('0x45')](_0xfa4072[_0x9f08('0x30')]);_0x18a06b[_0x9f08('0x39')]=_['intersection'](_0x18a06b[_0x9f08('0x2f')],_0x18a06b[_0x9f08('0x30')]);_0x2751c6['attributes']=_[_0x9f08('0x31')](_0x18a06b[_0x9f08('0x2f')],qs[_0x9f08('0x33')](_0xfa4072[_0x9f08('0x30')][_0x9f08('0x33')]));_0x2751c6[_0x9f08('0x32')]=_0x2751c6[_0x9f08('0x32')][_0x9f08('0x47')]?_0x2751c6[_0x9f08('0x32')]:_0x18a06b[_0x9f08('0x2f')];_0x2751c6[_0x9f08('0x36')]=qs[_0x9f08('0x37')](_0xfa4072[_0x9f08('0x30')][_0x9f08('0x37')]);_0x2751c6[_0x9f08('0x38')]=qs[_0x9f08('0x39')](_[_0x9f08('0x3a')](_0xfa4072['query'],_0x18a06b[_0x9f08('0x39')]));if(_0xfa4072[_0x9f08('0x30')]['filter']){_0x2751c6[_0x9f08('0x38')]=_['merge'](_0x2751c6['where'],{'$or':_['map'](_0x2751c6[_0x9f08('0x32')],function(_0x151b99){var _0xd4c5ed={};_0xd4c5ed[_0x151b99]={'$like':'%'+_0xfa4072[_0x9f08('0x30')][_0x9f08('0x3b')]+'%'};return _0xd4c5ed;})});}_0x2751c6=_[_0x9f08('0x3c')]({},_0x2751c6,_0xfa4072['options']);return _0xfd4613['getAnyConditions'](_0x2751c6);}})[_0x9f08('0x21')](function(_0x31fa4){if(_0x31fa4){_0x36bbba=_0x31fa4[_0x9f08('0x47')];if(!_0xfa4072[_0x9f08('0x30')][_0x9f08('0x34')](_0x9f08('0x35'))){_0x2751c6[_0x9f08('0x19')]=qs[_0x9f08('0x19')](_0xfa4072['query']['limit']);_0x2751c6[_0x9f08('0x18')]=qs[_0x9f08('0x18')](_0xfa4072[_0x9f08('0x30')]['offset']);}return _0xfd4613['getAnyConditions'](_0x2751c6);}})[_0x9f08('0x21')](function(_0x5b9161){if(_0x5b9161){return _0x5b9161?{'count':_0x36bbba,'rows':_0x5b9161}:null;}})[_0x9f08('0x21')](respondWithResult(_0x521ce7,null))[_0x9f08('0x42')](handleError(_0x521ce7,null));};exports[_0x9f08('0x57')]=function(_0x3b3588,_0x1e8357,_0xbfb1d8){if(_0x3b3588['body']['id']){delete _0x3b3588['body']['id'];}return db[_0x9f08('0x2b')][_0x9f08('0x48')]({'where':{'id':_0x3b3588[_0x9f08('0x44')]['id']}})[_0x9f08('0x21')](handleEntityNotFound(_0x1e8357,null))[_0x9f08('0x21')](function(_0xf3150){if(_0xf3150){_0x3b3588[_0x9f08('0x4a')][_0x9f08('0x58')]=_0xf3150['id'];return db[_0x9f08('0x59')]['create'](_0x3b3588[_0x9f08('0x4a')]);}})[_0x9f08('0x21')](respondWithResult(_0x1e8357,null))['catch'](handleError(_0x1e8357,null));};exports[_0x9f08('0x5a')]=function(_0x2538a9,_0x45a85f,_0x4a8a67){var _0x48c1dd={};var _0x42abd5={};var _0xeac602;var _0x3a317e;return db[_0x9f08('0x2b')][_0x9f08('0x54')]({'where':{'id':_0x2538a9['params']['id']}})[_0x9f08('0x21')](handleEntityNotFound(_0x45a85f,null))['then'](function(_0x5e7704){if(_0x5e7704){_0xeac602=_0x5e7704;_0x42abd5[_0x9f08('0x2f')]=_['keys'](db['Action'][_0x9f08('0x46')]);_0x42abd5[_0x9f08('0x30')]=_['keys'](_0x2538a9[_0x9f08('0x30')]);_0x42abd5[_0x9f08('0x39')]=_[_0x9f08('0x31')](_0x42abd5[_0x9f08('0x2f')],_0x42abd5[_0x9f08('0x30')]);_0x48c1dd[_0x9f08('0x32')]=_['intersection'](_0x42abd5['model'],qs[_0x9f08('0x33')](_0x2538a9['query'][_0x9f08('0x33')]));_0x48c1dd[_0x9f08('0x32')]=_0x48c1dd[_0x9f08('0x32')]['length']?_0x48c1dd['attributes']:_0x42abd5[_0x9f08('0x2f')];_0x48c1dd[_0x9f08('0x36')]=qs[_0x9f08('0x37')](_0x2538a9[_0x9f08('0x30')]['sort']);_0x48c1dd[_0x9f08('0x38')]=qs[_0x9f08('0x39')](_[_0x9f08('0x3a')](_0x2538a9['query'],_0x42abd5[_0x9f08('0x39')]));if(_0x2538a9[_0x9f08('0x30')][_0x9f08('0x3b')]){_0x48c1dd[_0x9f08('0x38')]=_[_0x9f08('0x3c')](_0x48c1dd[_0x9f08('0x38')],{'$or':_[_0x9f08('0x2a')](_0x48c1dd[_0x9f08('0x32')],function(_0x218a8d){var _0x23db5e={};_0x23db5e[_0x218a8d]={'$like':'%'+_0x2538a9[_0x9f08('0x30')]['filter']+'%'};return _0x23db5e;})});}_0x48c1dd=_[_0x9f08('0x3c')]({},_0x48c1dd,_0x2538a9[_0x9f08('0x3e')]);return _0xeac602[_0x9f08('0x5a')](_0x48c1dd);}})[_0x9f08('0x21')](function(_0x14cd95){if(_0x14cd95){_0x3a317e=_0x14cd95[_0x9f08('0x47')];if(!_0x2538a9[_0x9f08('0x30')]['hasOwnProperty'](_0x9f08('0x35'))){_0x48c1dd[_0x9f08('0x19')]=qs[_0x9f08('0x19')](_0x2538a9[_0x9f08('0x30')]['limit']);_0x48c1dd['offset']=qs[_0x9f08('0x18')](_0x2538a9[_0x9f08('0x30')][_0x9f08('0x18')]);}return _0xeac602[_0x9f08('0x5a')](_0x48c1dd);}})[_0x9f08('0x21')](function(_0x54d007){if(_0x54d007){return _0x54d007?{'count':_0x3a317e,'rows':_0x54d007}:null;}})[_0x9f08('0x21')](respondWithResult(_0x45a85f,null))[_0x9f08('0x42')](handleError(_0x45a85f,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 2d927fc..c709f92 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 _0xde9d=['exports','define','Trigger','tools_triggers','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./trigger.attributes'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0xde9d,0x156));var _0xdde9=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xde9d[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xdde9('0x0'));var util=require(_0xdde9('0x1'));var logger=require(_0xdde9('0x2'))(_0xdde9('0x3'));var moment=require(_0xdde9('0x4'));var BPromise=require('bluebird');var rp=require(_0xdde9('0x5'));var fs=require('fs');var path=require(_0xdde9('0x6'));var rimraf=require(_0xdde9('0x7'));var config=require('../../config/environment');var attributes=require(_0xdde9('0x8'));module[_0xdde9('0x9')]=function(_0x1ea43e,_0x4c10e9){return _0x1ea43e[_0xdde9('0xa')](_0xdde9('0xb'),attributes,{'tableName':_0xdde9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xee14=['Trigger','tools_triggers','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./trigger.attributes','define'];(function(_0x212494,_0x279e11){var _0x2bab22=function(_0x4c3dca){while(--_0x4c3dca){_0x212494['push'](_0x212494['shift']());}};_0x2bab22(++_0x279e11);}(_0xee14,0x13a));var _0x4ee1=function(_0x4b38bf,_0x1bddc1){_0x4b38bf=_0x4b38bf-0x0;var _0x4c4613=_0xee14[_0x4b38bf];return _0x4c4613;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4ee1('0x0'))(_0x4ee1('0x1'));var moment=require(_0x4ee1('0x2'));var BPromise=require(_0x4ee1('0x3'));var rp=require(_0x4ee1('0x4'));var fs=require('fs');var path=require(_0x4ee1('0x5'));var rimraf=require(_0x4ee1('0x6'));var config=require(_0x4ee1('0x7'));var attributes=require(_0x4ee1('0x8'));module['exports']=function(_0xba6d36,_0x573700){return _0xba6d36[_0x4ee1('0x9')](_0x4ee1('0xa'),attributes,{'tableName':_0x4ee1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index b153956..e8f0b0f 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 _0x0cdc=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','info','Trigger,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','Trigger','findAll','options','raw','where','attributes','limit','map','include','model','then','GetTrigger','find','ShowTrigger','lodash','moment','bluebird','randomstring','ioredis'];(function(_0xf89d06,_0x54c9dd){var _0x332333=function(_0x410806){while(--_0x410806){_0xf89d06['push'](_0xf89d06['shift']());}};_0x332333(++_0x54c9dd);}(_0x0cdc,0x113));var _0xc0cd=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0x0cdc[_0x13ce0c];return _0x4388fb;};'use strict';var _=require(_0xc0cd('0x0'));var util=require('util');var moment=require(_0xc0cd('0x1'));var BPromise=require(_0xc0cd('0x2'));var rs=require(_0xc0cd('0x3'));var fs=require('fs');var Redis=require(_0xc0cd('0x4'));var db=require(_0xc0cd('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc0cd('0x6'))('rpc');var config=require(_0xc0cd('0x7'));var jayson=require(_0xc0cd('0x8'));var client=jayson[_0xc0cd('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53bf3e,_0x538713,_0x3a6ff1){return new BPromise(function(_0x2b0f78,_0x2a21bd){return client[_0xc0cd('0xa')](_0x53bf3e,_0x3a6ff1)['then'](function(_0x3b369a){logger[_0xc0cd('0xb')](_0xc0cd('0xc'),_0x538713,'request\x20sent');logger[_0xc0cd('0xd')]('Trigger,\x20%s,\x20%s,\x20%s',_0x538713,_0xc0cd('0xe'),JSON[_0xc0cd('0xf')](_0x3b369a));if(_0x3b369a['error']){if(_0x3b369a[_0xc0cd('0x10')][_0xc0cd('0x11')]===0x1f4){logger['error']('Trigger,\x20%s,\x20%s',_0x538713,_0x3b369a[_0xc0cd('0x10')][_0xc0cd('0x12')]);return _0x2a21bd(_0x3b369a[_0xc0cd('0x10')][_0xc0cd('0x12')]);}logger[_0xc0cd('0x10')]('Trigger,\x20%s,\x20%s',_0x538713,_0x3b369a[_0xc0cd('0x10')]['message']);return _0x2b0f78(_0x3b369a[_0xc0cd('0x10')]['message']);}else{logger['info'](_0xc0cd('0xc'),_0x538713,_0xc0cd('0xe'));_0x2b0f78(_0x3b369a[_0xc0cd('0x13')][_0xc0cd('0x12')]);}})[_0xc0cd('0x14')](function(_0x3e56e9){logger['error']('Trigger,\x20%s,\x20%s',_0x538713,_0x3e56e9);_0x2a21bd(_0x3e56e9);});});}exports['GetTrigger']=function(_0x12c87c){var _0x2bf902=this;return new Promise(function(_0x15236b,_0x2ebd25){return db[_0xc0cd('0x15')][_0xc0cd('0x16')]({'raw':_0x12c87c[_0xc0cd('0x17')]?_0x12c87c['options'][_0xc0cd('0x18')]===undefined?!![]:![]:!![],'where':_0x12c87c['options']?_0x12c87c['options'][_0xc0cd('0x19')]||null:null,'attributes':_0x12c87c[_0xc0cd('0x17')]?_0x12c87c[_0xc0cd('0x17')][_0xc0cd('0x1a')]||null:null,'limit':_0x12c87c[_0xc0cd('0x17')]?_0x12c87c[_0xc0cd('0x17')][_0xc0cd('0x1b')]||null:null,'include':_0x12c87c[_0xc0cd('0x17')]?_0x12c87c[_0xc0cd('0x17')]['include']?_[_0xc0cd('0x1c')](_0x12c87c[_0xc0cd('0x17')][_0xc0cd('0x1d')],function(_0x167b89){return{'model':db[_0x167b89['model']],'as':_0x167b89['as'],'attributes':_0x167b89['attributes'],'include':_0x167b89[_0xc0cd('0x1d')]?_['map'](_0x167b89[_0xc0cd('0x1d')],function(_0x4ffd6d){return{'model':db[_0x4ffd6d[_0xc0cd('0x1e')]],'as':_0x4ffd6d['as'],'attributes':_0x4ffd6d['attributes'],'include':_0x4ffd6d[_0xc0cd('0x1d')]?_[_0xc0cd('0x1c')](_0x4ffd6d['include'],function(_0x37ab98){return{'model':db[_0x37ab98['model']],'as':_0x37ab98['as'],'attributes':_0x37ab98[_0xc0cd('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xc0cd('0x1f')](function(_0x320ea8){logger[_0xc0cd('0xb')](_0xc0cd('0x20'),_0x12c87c);logger[_0xc0cd('0xd')](_0xc0cd('0x20'),_0x12c87c,JSON[_0xc0cd('0xf')](_0x320ea8));_0x15236b(_0x320ea8);})['catch'](function(_0x87cb4b){logger[_0xc0cd('0x10')]('GetTrigger',_0x87cb4b[_0xc0cd('0x12')],_0x12c87c);_0x2ebd25(_0x2bf902[_0xc0cd('0x10')](0x1f4,_0x87cb4b['message']));});});};exports['ShowTrigger']=function(_0x22d308){var _0x199d6c=this;return new Promise(function(_0x2c9131,_0x1adfe0){return db[_0xc0cd('0x15')][_0xc0cd('0x21')]({'raw':_0x22d308[_0xc0cd('0x17')]?_0x22d308[_0xc0cd('0x17')][_0xc0cd('0x18')]===undefined?!![]:![]:!![],'where':_0x22d308['options']?_0x22d308[_0xc0cd('0x17')][_0xc0cd('0x19')]||null:null,'attributes':_0x22d308[_0xc0cd('0x17')]?_0x22d308[_0xc0cd('0x17')][_0xc0cd('0x1a')]||null:null,'include':_0x22d308[_0xc0cd('0x17')]?_0x22d308[_0xc0cd('0x17')][_0xc0cd('0x1d')]?_[_0xc0cd('0x1c')](_0x22d308['options'][_0xc0cd('0x1d')],function(_0x2523b3){return{'model':db[_0x2523b3['model']],'as':_0x2523b3['as'],'attributes':_0x2523b3['attributes'],'include':_0x2523b3[_0xc0cd('0x1d')]?_['map'](_0x2523b3['include'],function(_0x5cc42e){return{'model':db[_0x5cc42e[_0xc0cd('0x1e')]],'as':_0x5cc42e['as'],'attributes':_0x5cc42e[_0xc0cd('0x1a')],'include':_0x5cc42e[_0xc0cd('0x1d')]?_['map'](_0x5cc42e[_0xc0cd('0x1d')],function(_0x4e8571){return{'model':db[_0x4e8571[_0xc0cd('0x1e')]],'as':_0x4e8571['as'],'attributes':_0x4e8571[_0xc0cd('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x581553){logger[_0xc0cd('0xb')](_0xc0cd('0x22'),_0x22d308);logger[_0xc0cd('0xd')](_0xc0cd('0x22'),_0x22d308,JSON[_0xc0cd('0xf')](_0x581553));_0x2c9131(_0x581553);})[_0xc0cd('0x14')](function(_0x44c04e){logger[_0xc0cd('0x10')](_0xc0cd('0x22'),_0x44c04e[_0xc0cd('0x12')],_0x22d308);_0x1adfe0(_0x199d6c[_0xc0cd('0x10')](0x1f4,_0x44c04e['message']));});});}; \ No newline at end of file +var _0x7506=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','options','raw','where','attributes','limit','include','map','model','GetTrigger','ShowTrigger','find','lodash'];(function(_0x8253cc,_0x56e7c8){var _0x2f8216=function(_0x840ea9){while(--_0x840ea9){_0x8253cc['push'](_0x8253cc['shift']());}};_0x2f8216(++_0x56e7c8);}(_0x7506,0x13a));var _0x6750=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x7506[_0x47aa64];return _0x549c7a;};'use strict';var _=require(_0x6750('0x0'));var util=require('util');var moment=require(_0x6750('0x1'));var BPromise=require(_0x6750('0x2'));var rs=require(_0x6750('0x3'));var fs=require('fs');var Redis=require(_0x6750('0x4'));var db=require(_0x6750('0x5'))['db'];var utils=require(_0x6750('0x6'));var logger=require(_0x6750('0x7'))(_0x6750('0x8'));var config=require(_0x6750('0x9'));var jayson=require(_0x6750('0xa'));var client=jayson[_0x6750('0xb')][_0x6750('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3a5662,_0x244a0c,_0x53b978){return new BPromise(function(_0x27fdf4,_0x5af74a){return client[_0x6750('0xd')](_0x3a5662,_0x53b978)['then'](function(_0x18cb72){logger[_0x6750('0xe')](_0x6750('0xf'),_0x244a0c,_0x6750('0x10'));logger[_0x6750('0x11')]('Trigger,\x20%s,\x20%s,\x20%s',_0x244a0c,_0x6750('0x10'),JSON[_0x6750('0x12')](_0x18cb72));if(_0x18cb72['error']){if(_0x18cb72['error'][_0x6750('0x13')]===0x1f4){logger[_0x6750('0x14')](_0x6750('0xf'),_0x244a0c,_0x18cb72[_0x6750('0x14')][_0x6750('0x15')]);return _0x5af74a(_0x18cb72[_0x6750('0x14')][_0x6750('0x15')]);}logger[_0x6750('0x14')](_0x6750('0xf'),_0x244a0c,_0x18cb72[_0x6750('0x14')][_0x6750('0x15')]);return _0x27fdf4(_0x18cb72['error'][_0x6750('0x15')]);}else{logger['info'](_0x6750('0xf'),_0x244a0c,_0x6750('0x10'));_0x27fdf4(_0x18cb72[_0x6750('0x16')][_0x6750('0x15')]);}})[_0x6750('0x17')](function(_0x178dac){logger[_0x6750('0x14')](_0x6750('0xf'),_0x244a0c,_0x178dac);_0x5af74a(_0x178dac);});});}exports['GetTrigger']=function(_0xb7cca7){var _0x411eea=this;return new Promise(function(_0xb914e8,_0x41ee1a){return db['Trigger']['findAll']({'raw':_0xb7cca7[_0x6750('0x18')]?_0xb7cca7[_0x6750('0x18')][_0x6750('0x19')]===undefined?!![]:![]:!![],'where':_0xb7cca7['options']?_0xb7cca7['options'][_0x6750('0x1a')]||null:null,'attributes':_0xb7cca7[_0x6750('0x18')]?_0xb7cca7[_0x6750('0x18')][_0x6750('0x1b')]||null:null,'limit':_0xb7cca7['options']?_0xb7cca7[_0x6750('0x18')][_0x6750('0x1c')]||null:null,'include':_0xb7cca7[_0x6750('0x18')]?_0xb7cca7[_0x6750('0x18')][_0x6750('0x1d')]?_[_0x6750('0x1e')](_0xb7cca7['options'][_0x6750('0x1d')],function(_0x595557){return{'model':db[_0x595557[_0x6750('0x1f')]],'as':_0x595557['as'],'attributes':_0x595557['attributes'],'include':_0x595557['include']?_[_0x6750('0x1e')](_0x595557[_0x6750('0x1d')],function(_0x17b701){return{'model':db[_0x17b701[_0x6750('0x1f')]],'as':_0x17b701['as'],'attributes':_0x17b701[_0x6750('0x1b')],'include':_0x17b701[_0x6750('0x1d')]?_[_0x6750('0x1e')](_0x17b701[_0x6750('0x1d')],function(_0x185c76){return{'model':db[_0x185c76[_0x6750('0x1f')]],'as':_0x185c76['as'],'attributes':_0x185c76[_0x6750('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x383665){logger[_0x6750('0xe')](_0x6750('0x20'),_0xb7cca7);logger[_0x6750('0x11')]('GetTrigger',_0xb7cca7,JSON['stringify'](_0x383665));_0xb914e8(_0x383665);})[_0x6750('0x17')](function(_0x35f68f){logger[_0x6750('0x14')]('GetTrigger',_0x35f68f[_0x6750('0x15')],_0xb7cca7);_0x41ee1a(_0x411eea['error'](0x1f4,_0x35f68f[_0x6750('0x15')]));});});};exports[_0x6750('0x21')]=function(_0x217e94){var _0x577524=this;return new Promise(function(_0x4b6275,_0x25149d){return db['Trigger'][_0x6750('0x22')]({'raw':_0x217e94[_0x6750('0x18')]?_0x217e94[_0x6750('0x18')][_0x6750('0x19')]===undefined?!![]:![]:!![],'where':_0x217e94[_0x6750('0x18')]?_0x217e94['options']['where']||null:null,'attributes':_0x217e94[_0x6750('0x18')]?_0x217e94[_0x6750('0x18')][_0x6750('0x1b')]||null:null,'include':_0x217e94[_0x6750('0x18')]?_0x217e94[_0x6750('0x18')][_0x6750('0x1d')]?_[_0x6750('0x1e')](_0x217e94[_0x6750('0x18')]['include'],function(_0x20feb6){return{'model':db[_0x20feb6[_0x6750('0x1f')]],'as':_0x20feb6['as'],'attributes':_0x20feb6[_0x6750('0x1b')],'include':_0x20feb6['include']?_['map'](_0x20feb6[_0x6750('0x1d')],function(_0x4e360c){return{'model':db[_0x4e360c[_0x6750('0x1f')]],'as':_0x4e360c['as'],'attributes':_0x4e360c['attributes'],'include':_0x4e360c[_0x6750('0x1d')]?_['map'](_0x4e360c[_0x6750('0x1d')],function(_0x282b63){return{'model':db[_0x282b63[_0x6750('0x1f')]],'as':_0x282b63['as'],'attributes':_0x282b63[_0x6750('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4901ce){logger['info'](_0x6750('0x21'),_0x217e94);logger[_0x6750('0x11')](_0x6750('0x21'),_0x217e94,JSON['stringify'](_0x4901ce));_0x4b6275(_0x4901ce);})[_0x6750('0x17')](function(_0x1a3e9f){logger['error'](_0x6750('0x21'),_0x1a3e9f[_0x6750('0x15')],_0x217e94);_0x25149d(_0x577524['error'](0x1f4,_0x1a3e9f[_0x6750('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 33dab65..5f74c61 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 _0xae4d=['/:id','isAuthenticated','show','/:id/clone','clone','post','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./trunk.controller','get'];(function(_0x23cfae,_0x2ee6b3){var _0x2c8e9b=function(_0xa1e65c){while(--_0xa1e65c){_0x23cfae['push'](_0x23cfae['shift']());}};_0x2c8e9b(++_0x2ee6b3);}(_0xae4d,0x195));var _0xdae4=function(_0x3d89dc,_0x5afe5f){_0x3d89dc=_0x3d89dc-0x0;var _0x20eb03=_0xae4d[_0x3d89dc];return _0x20eb03;};'use strict';var multer=require(_0xdae4('0x0'));var util=require('util');var path=require(_0xdae4('0x1'));var timeout=require('connect-timeout');var express=require(_0xdae4('0x2'));var router=express[_0xdae4('0x3')]();var fs_extra=require(_0xdae4('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xdae4('0x5'));var config=require(_0xdae4('0x6'));var controller=require(_0xdae4('0x7'));router[_0xdae4('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xdae4('0x8')](_0xdae4('0x9'),auth[_0xdae4('0xa')](),controller[_0xdae4('0xb')]);router['post'](_0xdae4('0xc'),auth['isAuthenticated'](),controller[_0xdae4('0xd')]);router[_0xdae4('0xe')]('/',auth[_0xdae4('0xa')](),controller['create']);router['put']('/:id',auth[_0xdae4('0xa')](),controller['update']);router[_0xdae4('0xf')](_0xdae4('0x9'),auth['isAuthenticated'](),controller[_0xdae4('0x10')]);module[_0xdae4('0x11')]=router; \ No newline at end of file +var _0xcd73=['../../components/interaction/service','../../config/environment','./trunk.controller','get','index','/:id','isAuthenticated','post','clone','create','put','update','delete','multer','util','path','express','Router','fs-extra'];(function(_0x7185f7,_0x37065){var _0x182e45=function(_0x519e0d){while(--_0x519e0d){_0x7185f7['push'](_0x7185f7['shift']());}};_0x182e45(++_0x37065);}(_0xcd73,0x1af));var _0x3cd7=function(_0x45a27f,_0x27c54f){_0x45a27f=_0x45a27f-0x0;var _0x46c5cb=_0xcd73[_0x45a27f];return _0x46c5cb;};'use strict';var multer=require(_0x3cd7('0x0'));var util=require(_0x3cd7('0x1'));var path=require(_0x3cd7('0x2'));var timeout=require('connect-timeout');var express=require(_0x3cd7('0x3'));var router=express[_0x3cd7('0x4')]();var fs_extra=require(_0x3cd7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3cd7('0x6'));var config=require(_0x3cd7('0x7'));var controller=require(_0x3cd7('0x8'));router[_0x3cd7('0x9')]('/',auth['isAuthenticated'](),controller[_0x3cd7('0xa')]);router[_0x3cd7('0x9')](_0x3cd7('0xb'),auth[_0x3cd7('0xc')](),controller['show']);router[_0x3cd7('0xd')]('/:id/clone',auth['isAuthenticated'](),controller[_0x3cd7('0xe')]);router['post']('/',auth[_0x3cd7('0xc')](),controller[_0x3cd7('0xf')]);router[_0x3cd7('0x10')](_0x3cd7('0xb'),auth['isAuthenticated'](),controller[_0x3cd7('0x11')]);router[_0x3cd7('0x12')](_0x3cd7('0xb'),auth[_0x3cd7('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index e631a61..b4069d7 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 _0x7e14=['ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','never','\x22\x22\x20<>','INTEGER','always','originate','uac','pai','fingerprint','certificate','active','passive','actpass','dynamic','update,nonat','sequelize','exports','STRING','name','ENUM','friend','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','nonat','update','outgoing','yes','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'];(function(_0x2ddef5,_0x4f54da){var _0xd2eb5b=function(_0x2a5ab8){while(--_0x2a5ab8){_0x2ddef5['push'](_0x2ddef5['shift']());}};_0xd2eb5b(++_0x4f54da);}(_0x7e14,0x18b));var _0x47e1=function(_0x2bc375,_0x1fb66d){_0x2bc375=_0x2bc375-0x0;var _0x516311=_0x7e14[_0x2bc375];return _0x516311;};'use strict';var Sequelize=require(_0x47e1('0x0'));module[_0x47e1('0x1')]={'name':{'type':Sequelize[_0x47e1('0x2')],'allowNull':![],'unique':_0x47e1('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x47e1('0x4')](_0x47e1('0x5'),'user','peer'),'allowNull':![],'defaultValue':_0x47e1('0x5')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x47e1('0x6')},'callingpres':{'type':Sequelize[_0x47e1('0x4')](_0x47e1('0x7'),'ALLOWED_PASSED_SCREEN',_0x47e1('0x8'),_0x47e1('0x9'),_0x47e1('0xa'),_0x47e1('0xb'),'PROHIB_FAILED_SCREEN','PROHIB')},'deny':{'type':Sequelize[_0x47e1('0x2')]},'permit':{'type':Sequelize[_0x47e1('0x2')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x47e1('0x2')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x47e1('0x2')],'defaultValue':'udp','set':function(_0x8af426){this[_0x47e1('0xc')](_0x47e1('0xd'),_0x8af426?_0x8af426[_0x47e1('0xe')](','):null);},'get':function(){return this[_0x47e1('0xf')](_0x47e1('0xd'))?this['getDataValue'](_0x47e1('0xd'))[_0x47e1('0x10')](','):null;},'comment':_0x47e1('0x11')},'dtmfmode':{'type':Sequelize['ENUM'](_0x47e1('0x12'),_0x47e1('0x13'),_0x47e1('0x14'),'inband','auto'),'defaultValue':_0x47e1('0x12')},'directmedia':{'type':Sequelize[_0x47e1('0x4')]('yes','no',_0x47e1('0x15'),_0x47e1('0x16'),_0x47e1('0x17')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x47e1('0x4')](_0x47e1('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x47e1('0x2')]},'directmediadeny':{'type':Sequelize[_0x47e1('0x2')]},'nat':{'type':Sequelize[_0x47e1('0x2')],'defaultValue':_0x47e1('0x19'),'set':function(_0x85a6ea){this[_0x47e1('0xc')](_0x47e1('0x1a'),_0x85a6ea?_0x85a6ea['join'](','):null);},'get':function(){return this[_0x47e1('0xf')](_0x47e1('0x1a'))?this[_0x47e1('0xf')](_0x47e1('0x1a'))['split'](','):null;},'comment':_0x47e1('0x1b')},'callgroup':{'type':Sequelize[_0x47e1('0x2')]},'namedcallgroup':{'type':Sequelize[_0x47e1('0x2')]},'pickupgroup':{'type':Sequelize[_0x47e1('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x47e1('0x2')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x47e1('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x47e1('0x2')],'defaultValue':'all'},'allow':{'type':Sequelize[_0x47e1('0x2')],'allowNull':![],'defaultValue':_0x47e1('0x1c'),'set':function(_0x210825){this[_0x47e1('0xc')](_0x47e1('0x1d'),_0x210825?_0x210825[_0x47e1('0xe')](';'):_0x47e1('0x1c'));},'get':function(){return this['getDataValue']('allow')?this[_0x47e1('0xf')](_0x47e1('0x1d'))['split'](';'):null;},'comment':_0x47e1('0x1e')},'autoframing':{'type':Sequelize[_0x47e1('0x4')](_0x47e1('0x18'),'no')},'insecure':{'type':Sequelize[_0x47e1('0x2')],'defaultValue':_0x47e1('0x1f'),'set':function(_0x3976a4){this['setDataValue'](_0x47e1('0x20'),_0x3976a4?_0x3976a4['join'](','):null);},'get':function(){return this[_0x47e1('0xf')](_0x47e1('0x20'))?this['getDataValue'](_0x47e1('0x20'))[_0x47e1('0x10')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x47e1('0x4')](_0x47e1('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x47e1('0x4')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x47e1('0x4')](_0x47e1('0x18'),'no',_0x47e1('0x21'))},'promiscredir':{'type':Sequelize['ENUM'](_0x47e1('0x18'),'no')},'useclientcode':{'type':Sequelize[_0x47e1('0x4')](_0x47e1('0x18'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x47e1('0x2')],'defaultValue':_0x47e1('0x22')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x47e1('0x23')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0x47e1('0x18'),'no')},'allowsubscribe':{'type':Sequelize[_0x47e1('0x4')](_0x47e1('0x18'),'no')},'allowtransfer':{'type':Sequelize[_0x47e1('0x4')]('yes','no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x47e1('0x18'),'no')},'subscribecontext':{'type':Sequelize[_0x47e1('0x2')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x47e1('0x4')](_0x47e1('0x18'),'no',_0x47e1('0x24')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x47e1('0x23')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x47e1('0x18'),'no')},'mailbox':{'type':Sequelize[_0x47e1('0x2')]},'session_timers':{'type':Sequelize[_0x47e1('0x4')]('accept','refuse',_0x47e1('0x25'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0x47e1('0x4')](_0x47e1('0x26'),'uas'),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0x47e1('0x2')]},'port':{'type':Sequelize[_0x47e1('0x23')](0x5)},'qualify':{'type':Sequelize[_0x47e1('0x4')](_0x47e1('0x18'),'no'),'defaultValue':_0x47e1('0x18')},'keepalive':{'type':Sequelize[_0x47e1('0x23')](0xb)},'defaultip':{'type':Sequelize[_0x47e1('0x2')]},'defaultuser':{'type':Sequelize[_0x47e1('0x2')]},'rtptimeout':{'type':Sequelize[_0x47e1('0x23')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x47e1('0x23')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0x47e1('0x18'),'no',_0x47e1('0x27')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x47e1('0x2')]},'callbackextension':{'type':Sequelize[_0x47e1('0x2')]},'timert1':{'type':Sequelize[_0x47e1('0x23')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x47e1('0x23')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x47e1('0x2')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0x47e1('0x2')]},'maxforwards':{'type':Sequelize[_0x47e1('0x23')](0xb)},'encryption':{'type':Sequelize[_0x47e1('0x4')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x47e1('0x4')](_0x47e1('0x18'),'no')},'force_avp':{'type':Sequelize[_0x47e1('0x4')](_0x47e1('0x18'),'no')},'icesupport':{'type':Sequelize[_0x47e1('0x4')](_0x47e1('0x18'),'no')},'dtlsenable':{'type':Sequelize[_0x47e1('0x4')]('yes','no')},'dtlsverify':{'type':Sequelize['ENUM'](_0x47e1('0x18'),'no',_0x47e1('0x28'),_0x47e1('0x29'))},'dtlsrekey':{'type':Sequelize[_0x47e1('0x23')](0xb)},'dtlscertfile':{'type':Sequelize[_0x47e1('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x47e1('0x2')]},'dtlscipher':{'type':Sequelize[_0x47e1('0x2')]},'dtlscafile':{'type':Sequelize[_0x47e1('0x2')]},'dtlscapath':{'type':Sequelize[_0x47e1('0x2')]},'dtlssetup':{'type':Sequelize['ENUM'](_0x47e1('0x2a'),_0x47e1('0x2b'),_0x47e1('0x2c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x47e1('0x4')](_0x47e1('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x47e1('0x2')]},'recordofffeature':{'type':Sequelize[_0x47e1('0x2')]},'call_limit':{'type':Sequelize[_0x47e1('0x23')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x47e1('0x4')](_0x47e1('0x18'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x47e1('0x18'),'no')},'vmexten':{'type':Sequelize[_0x47e1('0x2')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x47e1('0x2')],'defaultValue':_0x47e1('0x2d')},'canreinvite':{'type':Sequelize[_0x47e1('0x4')](_0x47e1('0x18'),'no',_0x47e1('0x15'),_0x47e1('0x16'),_0x47e1('0x2e')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x47e1('0x2')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x47e1('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0xb268=['inband','auto','nonat','outgoing','force_rport,comedia','setDataValue','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','yes','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','\x22\x22\x20<>','refuse','originate','uac','uas','pai','actpass','update,nonat','BOOLEAN','sequelize','exports','STRING','name','friend','user','peer','from-voip-provider','ENUM','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo'];(function(_0x148206,_0x46b8c4){var _0x56a558=function(_0x3b05fa){while(--_0x3b05fa){_0x148206['push'](_0x148206['shift']());}};_0x56a558(++_0x46b8c4);}(_0xb268,0x171));var _0x8b26=function(_0x5c0301,_0x1cea32){_0x5c0301=_0x5c0301-0x0;var _0x44b0e9=_0xb268[_0x5c0301];return _0x44b0e9;};'use strict';var Sequelize=require(_0x8b26('0x0'));module[_0x8b26('0x1')]={'name':{'type':Sequelize[_0x8b26('0x2')],'allowNull':![],'unique':_0x8b26('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x8b26('0x4'),_0x8b26('0x5'),_0x8b26('0x6')),'allowNull':![],'defaultValue':_0x8b26('0x4')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8b26('0x7')},'callingpres':{'type':Sequelize[_0x8b26('0x8')]('ALLOWED_NOT_SCREENED',_0x8b26('0x9'),_0x8b26('0xa'),'ALLOWED','PROHIB_NOT_SCREENED',_0x8b26('0xb'),_0x8b26('0xc'),_0x8b26('0xd'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x8b26('0x2')]},'secret':{'type':Sequelize[_0x8b26('0x2')]},'md5secret':{'type':Sequelize[_0x8b26('0x2')]},'remotesecret':{'type':Sequelize[_0x8b26('0x2')]},'transport':{'type':Sequelize[_0x8b26('0x2')],'defaultValue':_0x8b26('0xe'),'set':function(_0x11a457){this['setDataValue'](_0x8b26('0xf'),_0x11a457?_0x11a457[_0x8b26('0x10')](','):null);},'get':function(){return this[_0x8b26('0x11')](_0x8b26('0xf'))?this[_0x8b26('0x11')](_0x8b26('0xf'))[_0x8b26('0x12')](','):null;},'comment':_0x8b26('0x13')},'dtmfmode':{'type':Sequelize[_0x8b26('0x8')](_0x8b26('0x14'),_0x8b26('0x15'),_0x8b26('0x16'),_0x8b26('0x17'),_0x8b26('0x18')),'defaultValue':_0x8b26('0x14')},'directmedia':{'type':Sequelize['ENUM']('yes','no',_0x8b26('0x19'),'update',_0x8b26('0x1a')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x8b26('0x8')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x8b26('0x2')]},'nat':{'type':Sequelize[_0x8b26('0x2')],'defaultValue':_0x8b26('0x1b'),'set':function(_0x426642){this[_0x8b26('0x1c')](_0x8b26('0x1d'),_0x426642?_0x426642[_0x8b26('0x10')](','):null);},'get':function(){return this[_0x8b26('0x11')](_0x8b26('0x1d'))?this[_0x8b26('0x11')](_0x8b26('0x1d'))[_0x8b26('0x12')](','):null;},'comment':_0x8b26('0x1e')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x8b26('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x8b26('0x2')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x8b26('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x8b26('0x2')],'defaultValue':_0x8b26('0x1f')},'allow':{'type':Sequelize[_0x8b26('0x2')],'allowNull':![],'defaultValue':_0x8b26('0x20'),'set':function(_0xd61f09){this[_0x8b26('0x1c')](_0x8b26('0x21'),_0xd61f09?_0xd61f09[_0x8b26('0x10')](';'):_0x8b26('0x20'));},'get':function(){return this['getDataValue'](_0x8b26('0x21'))?this[_0x8b26('0x11')](_0x8b26('0x21'))['split'](';'):null;},'comment':_0x8b26('0x22')},'autoframing':{'type':Sequelize['ENUM'](_0x8b26('0x23'),'no')},'insecure':{'type':Sequelize[_0x8b26('0x2')],'defaultValue':_0x8b26('0x24'),'set':function(_0x4c1542){this[_0x8b26('0x1c')](_0x8b26('0x25'),_0x4c1542?_0x4c1542[_0x8b26('0x10')](','):null);},'get':function(){return this[_0x8b26('0x11')](_0x8b26('0x25'))?this[_0x8b26('0x11')](_0x8b26('0x25'))[_0x8b26('0x12')](','):null;},'comment':_0x8b26('0x26')},'trustrpid':{'type':Sequelize[_0x8b26('0x8')](_0x8b26('0x23'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x8b26('0x8')](_0x8b26('0x23'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x8b26('0x8')](_0x8b26('0x23'),'no','never')},'promiscredir':{'type':Sequelize['ENUM'](_0x8b26('0x23'),'no')},'useclientcode':{'type':Sequelize['ENUM']('yes','no')},'accountcode':{'type':Sequelize[_0x8b26('0x27')](0xb)},'setvar':{'type':Sequelize[_0x8b26('0x2')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x8b26('0x28')},'amaflags':{'type':Sequelize[_0x8b26('0x2')]},'callcounter':{'type':Sequelize['ENUM'](_0x8b26('0x23'),'no'),'defaultValue':_0x8b26('0x23')},'busylevel':{'type':Sequelize[_0x8b26('0x27')](0xb)},'allowoverlap':{'type':Sequelize[_0x8b26('0x8')](_0x8b26('0x23'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0x8b26('0x23'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0x8b26('0x23'),'no')},'ignoresdpversion':{'type':Sequelize[_0x8b26('0x8')](_0x8b26('0x23'),'no')},'subscribecontext':{'type':Sequelize[_0x8b26('0x2')]},'template':{'type':Sequelize[_0x8b26('0x2')]},'videosupport':{'type':Sequelize['ENUM'](_0x8b26('0x23'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0x8b26('0x8')](_0x8b26('0x23'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize['ENUM']('accept',_0x8b26('0x29'),_0x8b26('0x2a'))},'session_expires':{'type':Sequelize[_0x8b26('0x27')](0xb)},'session_minse':{'type':Sequelize[_0x8b26('0x27')](0xb)},'session_refresher':{'type':Sequelize[_0x8b26('0x8')](_0x8b26('0x2b'),_0x8b26('0x2c')),'defaultValue':_0x8b26('0x2c')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0x8b26('0x2')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0x8b26('0x2')]},'port':{'type':Sequelize[_0x8b26('0x27')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x8b26('0x23'),'no'),'defaultValue':_0x8b26('0x23')},'keepalive':{'type':Sequelize[_0x8b26('0x27')](0xb)},'defaultip':{'type':Sequelize[_0x8b26('0x2')]},'defaultuser':{'type':Sequelize[_0x8b26('0x2')]},'rtptimeout':{'type':Sequelize[_0x8b26('0x27')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x8b26('0x27')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0x8b26('0x23'),'no',_0x8b26('0x2d')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x8b26('0x2')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x8b26('0x27')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x8b26('0x27')](0xb)},'contactpermit':{'type':Sequelize[_0x8b26('0x2')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x8b26('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x8b26('0x2')]},'use_q850_reason':{'type':Sequelize[_0x8b26('0x2')]},'maxforwards':{'type':Sequelize[_0x8b26('0x27')](0xb)},'encryption':{'type':Sequelize[_0x8b26('0x8')](_0x8b26('0x23'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x8b26('0x8')](_0x8b26('0x23'),'no')},'force_avp':{'type':Sequelize[_0x8b26('0x8')](_0x8b26('0x23'),'no')},'icesupport':{'type':Sequelize[_0x8b26('0x8')](_0x8b26('0x23'),'no')},'dtlsenable':{'type':Sequelize[_0x8b26('0x8')](_0x8b26('0x23'),'no')},'dtlsverify':{'type':Sequelize['ENUM']('yes','no','fingerprint','certificate')},'dtlsrekey':{'type':Sequelize[_0x8b26('0x27')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0x8b26('0x2')]},'dtlscipher':{'type':Sequelize[_0x8b26('0x2')]},'dtlscafile':{'type':Sequelize[_0x8b26('0x2')]},'dtlscapath':{'type':Sequelize[_0x8b26('0x2')]},'dtlssetup':{'type':Sequelize[_0x8b26('0x8')]('active','passive',_0x8b26('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x8b26('0x2')]},'usereqphone':{'type':Sequelize['ENUM'](_0x8b26('0x23'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x8b26('0x2')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0x8b26('0x27')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x8b26('0x8')](_0x8b26('0x23'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x8b26('0x23'),'no')},'vmexten':{'type':Sequelize[_0x8b26('0x2')]},'mohinterpret':{'type':Sequelize[_0x8b26('0x2')]},'mohsuggest':{'type':Sequelize[_0x8b26('0x2')]},'parkinglot':{'type':Sequelize[_0x8b26('0x2')]},'description':{'type':Sequelize[_0x8b26('0x2')]},'host':{'type':Sequelize[_0x8b26('0x2')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0x8b26('0x8')]('yes','no','nonat','update',_0x8b26('0x2f')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0x8b26('0x2')]},'active':{'type':Sequelize[_0x8b26('0x30')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x8b26('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 cb30f11..3848a03 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 _0x98a8=['../../mysqldb','jayson/promise','client','request','Trunk,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','get','Trunks','UserProfileResource','stack','name','map','fieldName','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','Trunk','include','show','params','keys','rawAttributes','includeAll','clone','find','createdAt','updatedAt','body','omit','create','user','role','UserProfileSection','userProfileId','autoAssociation','findAll','readFileSync','root','server/files/templates/trunk.ejs','join','server/files/templates/registry.ejs','utf8','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','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment'];(function(_0x30e550,_0x5a7d0b){var _0x107db3=function(_0x28a0af){while(--_0x28a0af){_0x30e550['push'](_0x30e550['shift']());}};_0x107db3(++_0x5a7d0b);}(_0x98a8,0x12c));var _0x898a=function(_0x55e6b,_0x4f48ed){_0x55e6b=_0x55e6b-0x0;var _0x179ed9=_0x98a8[_0x55e6b];return _0x179ed9;};'use strict';var emlformat=require(_0x898a('0x0'));var rimraf=require(_0x898a('0x1'));var zipdir=require(_0x898a('0x2'));var jsonpatch=require(_0x898a('0x3'));var rp=require(_0x898a('0x4'));var moment=require(_0x898a('0x5'));var BPromise=require(_0x898a('0x6'));var Mustache=require('mustache');var util=require(_0x898a('0x7'));var path=require(_0x898a('0x8'));var sox=require(_0x898a('0x9'));var csv=require(_0x898a('0xa'));var ejs=require(_0x898a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x898a('0xc'));var squel=require('squel');var crypto=require(_0x898a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x898a('0xe'));var toCsv=require(_0x898a('0xa'));var querystring=require(_0x898a('0xf'));var Papa=require(_0x898a('0x10'));var Redis=require(_0x898a('0x11'));var authService=require(_0x898a('0x12'));var qs=require(_0x898a('0x13'));var as=require(_0x898a('0x14'));var hardwareService=require(_0x898a('0x15'));var logger=require('../../config/logger')(_0x898a('0x16'));var utils=require('../../config/utils');var config=require(_0x898a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x898a('0x18'))['db'];var jayson=require(_0x898a('0x19'));var client=jayson[_0x898a('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5bfded,_0x5b5c9c,_0x373d53,_0x1f5be4){return new BPromise(function(_0xb24335,_0x116fbe){var _0x1873e9=_0x1f5be4||client;return _0x1873e9[_0x898a('0x1b')](_0x5bfded,_0x373d53)['then'](function(_0x47033c){logger['info'](_0x898a('0x1c'),_0x5b5c9c,'request\x20sent');logger[_0x898a('0x1d')]('Trunk,\x20%s,\x20%s,\x20%s',_0x5b5c9c,_0x898a('0x1e'),JSON['stringify'](_0x47033c));if(_0x47033c[_0x898a('0x1f')]){if(_0x47033c[_0x898a('0x1f')][_0x898a('0x20')]===0x1f4){logger['error'](_0x898a('0x1c'),_0x5b5c9c,_0x47033c['error']['message']);return _0x116fbe(_0x47033c[_0x898a('0x1f')][_0x898a('0x21')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x5b5c9c,_0x47033c[_0x898a('0x1f')][_0x898a('0x21')]);return _0xb24335(_0x47033c[_0x898a('0x1f')][_0x898a('0x21')]);}else{logger[_0x898a('0x22')](_0x898a('0x1c'),_0x5b5c9c,_0x898a('0x1e'));_0xb24335(_0x47033c['result'][_0x898a('0x21')]);}})[_0x898a('0x23')](function(_0x11cae2){logger[_0x898a('0x1f')](_0x898a('0x1c'),_0x5b5c9c,_0x11cae2);_0x116fbe(_0x11cae2);});});}function respondWithStatusCode(_0x310bfa,_0x4e254d){_0x4e254d=_0x4e254d||0xcc;return function(_0x274cdf){if(_0x274cdf){return _0x310bfa[_0x898a('0x24')](_0x4e254d);}return _0x310bfa[_0x898a('0x25')](_0x4e254d)[_0x898a('0x26')]();};}function respondWithResult(_0x3901ab,_0x1426e3){_0x1426e3=_0x1426e3||0xc8;return function(_0x5b7719){if(_0x5b7719){return _0x3901ab[_0x898a('0x25')](_0x1426e3)['json'](_0x5b7719);}};}function respondWithFilteredResult(_0x513c6b,_0x53ddb2){return function(_0x3678be){if(_0x3678be){var _0x1f4d86=typeof _0x53ddb2[_0x898a('0x27')]===_0x898a('0x28')&&typeof _0x53ddb2[_0x898a('0x29')]===_0x898a('0x28');var _0x398e98=_0x3678be[_0x898a('0x2a')];var _0xd31922=_0x1f4d86?0x0:_0x53ddb2['offset'];var _0x4b3e68=_0x1f4d86?_0x3678be['count']:_0x53ddb2[_0x898a('0x27')]+_0x53ddb2[_0x898a('0x29')];var _0x3b7704;if(_0x4b3e68>=_0x398e98){_0x4b3e68=_0x398e98;_0x3b7704=0xc8;}else{_0x3b7704=0xce;}_0x513c6b[_0x898a('0x25')](_0x3b7704);return _0x513c6b[_0x898a('0x2b')](_0x898a('0x2c'),_0xd31922+'-'+_0x4b3e68+'/'+_0x398e98)[_0x898a('0x2d')](_0x3678be);}return null;};}function patchUpdates(_0xf74645){return function(_0x18773a){try{jsonpatch[_0x898a('0x2e')](_0x18773a,_0xf74645,!![]);}catch(_0x44c5d2){return BPromise[_0x898a('0x2f')](_0x44c5d2);}return _0x18773a['save']();};}function saveUpdates(_0x7a1eb5,_0x17a5f3){return function(_0x26eead){if(_0x26eead){return _0x26eead[_0x898a('0x30')](_0x7a1eb5)[_0x898a('0x31')](function(_0x47af5b){return _0x47af5b;});}return null;};}function removeEntity(_0x48cefb,_0x20a3fe){return function(_0x1e2fd4){if(_0x1e2fd4){return _0x1e2fd4[_0x898a('0x32')]()['then'](function(){var _0x105477=_0x1e2fd4[_0x898a('0x33')]({'plain':!![]});var _0x5eafc7=_0x898a('0x34');return db[_0x898a('0x35')][_0x898a('0x32')]({'where':{'type':_0x5eafc7,'resourceId':_0x105477['id']}})[_0x898a('0x31')](function(){return _0x1e2fd4;});})[_0x898a('0x31')](function(){_0x48cefb['status'](0xcc)[_0x898a('0x26')]();});}};}function handleEntityNotFound(_0x5baf5b,_0x573eb3){return function(_0x14e2dc){if(!_0x14e2dc){_0x5baf5b['sendStatus'](0x194);}return _0x14e2dc;};}function handleError(_0x3c9588,_0x4b3aac){_0x4b3aac=_0x4b3aac||0x1f4;return function(_0x37cb11){logger['error'](_0x37cb11[_0x898a('0x36')]);if(_0x37cb11[_0x898a('0x37')]){delete _0x37cb11[_0x898a('0x37')];}_0x3c9588['status'](_0x4b3aac)['send'](_0x37cb11);};}exports['index']=function(_0x1575d2,_0x429c32){var _0x5a228f={},_0xdd019d={},_0x3d3463={'count':0x0,'rows':[]};var _0xe84f7e=_[_0x898a('0x38')](db['Trunk']['rawAttributes'],function(_0x3aed01){return{'name':_0x3aed01[_0x898a('0x39')],'type':_0x3aed01['type']['key']};});_0xdd019d[_0x898a('0x3a')]=_[_0x898a('0x38')](_0xe84f7e,_0x898a('0x37'));_0xdd019d[_0x898a('0x3b')]=_['keys'](_0x1575d2[_0x898a('0x3b')]);_0xdd019d[_0x898a('0x3c')]=_['intersection'](_0xdd019d['model'],_0xdd019d['query']);_0x5a228f[_0x898a('0x3d')]=_[_0x898a('0x3e')](_0xdd019d[_0x898a('0x3a')],qs[_0x898a('0x3f')](_0x1575d2[_0x898a('0x3b')][_0x898a('0x3f')]));_0x5a228f[_0x898a('0x3d')]=_0x5a228f[_0x898a('0x3d')][_0x898a('0x40')]?_0x5a228f[_0x898a('0x3d')]:_0xdd019d[_0x898a('0x3a')];if(!_0x1575d2[_0x898a('0x3b')][_0x898a('0x41')](_0x898a('0x42'))){_0x5a228f[_0x898a('0x29')]=qs['limit'](_0x1575d2[_0x898a('0x3b')][_0x898a('0x29')]);_0x5a228f[_0x898a('0x27')]=qs['offset'](_0x1575d2[_0x898a('0x3b')][_0x898a('0x27')]);}_0x5a228f[_0x898a('0x43')]=qs[_0x898a('0x44')](_0x1575d2[_0x898a('0x3b')][_0x898a('0x44')]);_0x5a228f[_0x898a('0x45')]=qs[_0x898a('0x3c')](_['pick'](_0x1575d2[_0x898a('0x3b')],_0xdd019d[_0x898a('0x3c')]),_0xe84f7e);if(_0x1575d2[_0x898a('0x3b')][_0x898a('0x46')]){_0x5a228f['where']=_[_0x898a('0x47')](_0x5a228f[_0x898a('0x45')],{'$or':_['map'](_0xe84f7e,function(_0x241677){if(_0x241677['type']!==_0x898a('0x48')){var _0x5137c4={};_0x5137c4[_0x241677['name']]={'$like':'%'+_0x1575d2[_0x898a('0x3b')]['filter']+'%'};return _0x5137c4;}})});}_0x5a228f=_[_0x898a('0x47')]({},_0x5a228f,_0x1575d2[_0x898a('0x49')]);var _0x4d6ac0={'where':_0x5a228f[_0x898a('0x45')]};return db[_0x898a('0x4a')]['count'](_0x4d6ac0)[_0x898a('0x31')](function(_0x199437){_0x3d3463[_0x898a('0x2a')]=_0x199437;if(_0x1575d2[_0x898a('0x3b')]['includeAll']){_0x5a228f[_0x898a('0x4b')]=[{'all':!![]}];}return db[_0x898a('0x4a')]['findAll'](_0x5a228f);})[_0x898a('0x31')](function(_0x1d8c16){_0x3d3463['rows']=_0x1d8c16;return _0x3d3463;})[_0x898a('0x31')](respondWithFilteredResult(_0x429c32,_0x5a228f))['catch'](handleError(_0x429c32,null));};exports[_0x898a('0x4c')]=function(_0x41f291,_0x32ccb9){var _0x50f9e3={'raw':![],'where':{'id':_0x41f291[_0x898a('0x4d')]['id']}},_0x2f6cb3={};_0x2f6cb3[_0x898a('0x3a')]=_[_0x898a('0x4e')](db['Trunk'][_0x898a('0x4f')]);_0x2f6cb3['query']=_[_0x898a('0x4e')](_0x41f291[_0x898a('0x3b')]);_0x2f6cb3[_0x898a('0x3c')]=_['intersection'](_0x2f6cb3[_0x898a('0x3a')],_0x2f6cb3[_0x898a('0x3b')]);_0x50f9e3[_0x898a('0x3d')]=_['intersection'](_0x2f6cb3['model'],qs[_0x898a('0x3f')](_0x41f291[_0x898a('0x3b')][_0x898a('0x3f')]));_0x50f9e3[_0x898a('0x3d')]=_0x50f9e3[_0x898a('0x3d')][_0x898a('0x40')]?_0x50f9e3[_0x898a('0x3d')]:_0x2f6cb3[_0x898a('0x3a')];if(_0x41f291[_0x898a('0x3b')][_0x898a('0x50')]){_0x50f9e3[_0x898a('0x4b')]=[{'all':!![]}];}_0x50f9e3=_['merge']({},_0x50f9e3,_0x41f291[_0x898a('0x49')]);return db[_0x898a('0x4a')]['find'](_0x50f9e3)[_0x898a('0x31')](handleEntityNotFound(_0x32ccb9,null))['then'](respondWithResult(_0x32ccb9,null))['catch'](handleError(_0x32ccb9,null));};exports[_0x898a('0x51')]=function(_0x124f9b,_0x209529){var _0x5bfd61={'where':{'id':_0x124f9b[_0x898a('0x4d')]['id']}},_0x556fd8={};_0x556fd8[_0x898a('0x3a')]=_['keys'](db[_0x898a('0x4a')][_0x898a('0x4f')]);_0x5bfd61['attributes']=_[_0x898a('0x3e')](_0x556fd8[_0x898a('0x3a')],qs[_0x898a('0x3f')](_0x124f9b['query'][_0x898a('0x3f')]));_0x5bfd61[_0x898a('0x3d')]=_0x5bfd61[_0x898a('0x3d')][_0x898a('0x40')]?_0x5bfd61[_0x898a('0x3d')]:_0x556fd8[_0x898a('0x3a')];if(_0x124f9b['query'][_0x898a('0x50')]){_0x5bfd61['include']=[{'all':!![]}];}_0x5bfd61=_[_0x898a('0x47')]({},_0x5bfd61,_0x124f9b[_0x898a('0x49')]);return db[_0x898a('0x4a')][_0x898a('0x52')](_0x5bfd61)[_0x898a('0x31')](handleEntityNotFound(_0x209529,null))[_0x898a('0x31')](function(_0x2486a5){if(_0x2486a5){var _0x75ff57=_0x2486a5[_0x898a('0x33')]({'plain':!![]});_0x75ff57=qs['omit'](_0x75ff57,['id',_0x898a('0x53'),_0x898a('0x54')]);_0x124f9b[_0x898a('0x55')]=_[_0x898a('0x56')](_0x124f9b[_0x898a('0x55')],['id',_0x898a('0x53'),_0x898a('0x54')]);return db[_0x898a('0x4a')][_0x898a('0x57')](_[_0x898a('0x47')](_0x75ff57,_0x124f9b[_0x898a('0x55')]),{'include':_0x124f9b[_0x898a('0x3b')][_0x898a('0x50')]?[{'all':!![]}]:undefined})[_0x898a('0x31')](function(_0x22f9ba){var _0x5f42ae=_0x124f9b[_0x898a('0x58')][_0x898a('0x33')]({'plain':!![]});if(!_0x5f42ae)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5f42ae[_0x898a('0x59')]===_0x898a('0x58')){var _0x5f0944=_0x22f9ba[_0x898a('0x33')]({'plain':!![]});var _0x1daecd=_0x898a('0x34');return db[_0x898a('0x5a')]['find']({'where':{'name':_0x1daecd,'userProfileId':_0x5f42ae[_0x898a('0x5b')]},'raw':!![]})[_0x898a('0x31')](function(_0x137935){if(_0x137935&&_0x137935[_0x898a('0x5c')]===0x0){return db['UserProfileResource'][_0x898a('0x57')]({'name':_0x5f0944[_0x898a('0x37')],'resourceId':_0x5f0944['id'],'type':_0x137935['name'],'sectionId':_0x137935['id']},{})[_0x898a('0x31')](function(){return _0x22f9ba;});}else{return _0x22f9ba;}})[_0x898a('0x23')](function(_0x5b7019){logger[_0x898a('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b7019);throw _0x5b7019;});}return _0x22f9ba;});}})[_0x898a('0x31')](respondWithResult(_0x209529,0xc9))['catch'](handleError(_0x209529,null));};exports['create']=function(_0x5ed35e,_0xfdd6d8,_0x473f5c){var _0x3909c5;return db[_0x898a('0x4a')]['create'](_0x5ed35e['body'],{'raw':!![]})[_0x898a('0x31')](function(_0x232be0){_0x3909c5=_0x232be0;return db[_0x898a('0x4a')][_0x898a('0x5d')]({'raw':!![]});})[_0x898a('0x31')](function(_0x41cf94){var _0x30051d=fs[_0x898a('0x5e')](path['join'](config[_0x898a('0x5f')],_0x898a('0x60')),'utf8');var _0x42fda8=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config[_0x898a('0x5f')],_0x898a('0x62')),_0x898a('0x63'));var _0x3bcc3d=ejs[_0x898a('0x64')](_0x30051d,{'trunks':_0x41cf94||[]});fs[_0x898a('0x65')](_0x898a('0x66'),_0x3bcc3d);if(_0x3909c5[_0x898a('0x67')]){var _0x307849=ejs[_0x898a('0x64')](_0x42fda8,{'trunks':_0x41cf94||[]});fs['writeFileSync'](_0x898a('0x68'),_0x307849);}})['then'](function(){return respondWithRpcPromise(_0x898a('0x69'),_0x898a('0x57'),{'module':_0x898a('0x6a')});})['then'](function(){var _0x31102d=_0x5ed35e[_0x898a('0x58')][_0x898a('0x33')]({'plain':!![]});if(!_0x31102d)throw new Error(_0x898a('0x6b'));if(_0x31102d[_0x898a('0x59')]==='user'){var _0x4b9487=_0x3909c5[_0x898a('0x33')]({'plain':!![]});return db[_0x898a('0x5a')][_0x898a('0x52')]({'where':{'name':_0x898a('0x34'),'userProfileId':_0x31102d['userProfileId']},'raw':!![]})[_0x898a('0x31')](function(_0x3d3451){if(_0x3d3451&&_0x3d3451[_0x898a('0x5c')]===0x0){return db[_0x898a('0x35')][_0x898a('0x57')]({'name':_0x4b9487[_0x898a('0x37')],'resourceId':_0x4b9487['id'],'type':_0x3d3451[_0x898a('0x37')],'sectionId':_0x3d3451['id']},{})[_0x898a('0x31')](function(){return _0x3909c5;});}else{return _0x3909c5;}})['catch'](function(_0x32a207){logger[_0x898a('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32a207);throw _0x32a207;});}return _0x3909c5;})[_0x898a('0x31')](respondWithResult(_0xfdd6d8,0xc9))['catch'](handleError(_0xfdd6d8,null));};exports[_0x898a('0x30')]=function(_0x4b2575,_0x2471d8,_0x387f2c){var _0x3b07dc;return db[_0x898a('0x4a')][_0x898a('0x52')]({'where':{'id':_0x4b2575[_0x898a('0x4d')]['id']}})[_0x898a('0x31')](handleEntityNotFound(_0x2471d8,null))[_0x898a('0x31')](saveUpdates(_0x4b2575[_0x898a('0x55')],null))['then'](function(_0x3fe54b){if(_0x3fe54b){_0x3b07dc=_0x3fe54b;return db[_0x898a('0x4a')][_0x898a('0x5d')]({'raw':!![]});}})[_0x898a('0x31')](function(_0x290972){if(_0x290972){var _0x1d594b=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config[_0x898a('0x5f')],_0x898a('0x60')),'utf8');var _0x4fad03=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config['root'],'server/files/templates/registry.ejs'),_0x898a('0x63'));var _0x4a79a4=ejs[_0x898a('0x64')](_0x1d594b,{'trunks':_0x290972||[]});fs[_0x898a('0x65')]('/etc/asterisk/sip_xcally_trunks.conf',_0x4a79a4);var _0x3f6815=ejs[_0x898a('0x64')](_0x4fad03,{'trunks':_0x290972||[]});fs[_0x898a('0x65')](_0x898a('0x68'),_0x3f6815);return respondWithRpcPromise(_0x898a('0x69'),_0x898a('0x30'),{'module':_0x898a('0x6a')});}return null;})['then'](function(_0x3237e8){if(_0x3237e8){return _0x3b07dc;}})[_0x898a('0x31')](respondWithResult(_0x2471d8,null))[_0x898a('0x23')](handleError(_0x2471d8,null));};exports['destroy']=function(_0x27560f,_0x61247c,_0x5c6247){var _0x39e917;return db['Trunk']['find']({'where':{'id':_0x27560f['params']['id']}})[_0x898a('0x31')](handleEntityNotFound(_0x61247c,null))[_0x898a('0x31')](removeEntity(_0x61247c,null))[_0x898a('0x31')](function(){return db[_0x898a('0x4a')][_0x898a('0x5d')]({'raw':!![]});})[_0x898a('0x31')](function(_0x12e54b){var _0x50dd52=fs[_0x898a('0x5e')](path['join'](config[_0x898a('0x5f')],_0x898a('0x60')),'utf8');var _0x24670c=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config[_0x898a('0x5f')],_0x898a('0x62')),'utf8');var _0x5847cb=ejs['render'](_0x50dd52,{'trunks':_0x12e54b});var _0x3b8fb5=ejs[_0x898a('0x64')](_0x24670c,{'trunks':_0x12e54b});fs[_0x898a('0x65')]('/etc/asterisk/sip_xcally_trunks.conf',_0x5847cb);fs[_0x898a('0x65')]('/etc/asterisk/sip_xcally_registers.conf',_0x3b8fb5);return respondWithRpcPromise('Reload',_0x898a('0x32'),{'module':_0x898a('0x6a')});})[_0x898a('0x23')](handleError(_0x61247c,null));}; \ No newline at end of file +var _0x9a19=['query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','show','include','find','clone','params','omit','updatedAt','body','createdAt','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','/etc/asterisk/sip_xcally_trunks.conf','registry','render','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','role','autoAssociation','findAll','readFileSync','writeFileSync','Reload','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','jayson/promise','client','http','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','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','get','Trunks','UserProfileResource','stack','name','index','map','Trunk','rawAttributes','fieldName','type'];(function(_0x2821cc,_0x3e5758){var _0x4e2412=function(_0x966800){while(--_0x966800){_0x2821cc['push'](_0x2821cc['shift']());}};_0x4e2412(++_0x3e5758);}(_0x9a19,0x114));var _0x99a1=function(_0x1b1a3b,_0x52a88a){_0x1b1a3b=_0x1b1a3b-0x0;var _0x385347=_0x9a19[_0x1b1a3b];return _0x385347;};'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'];var jayson=require(_0x99a1('0x19'));var client=jayson[_0x99a1('0x1a')][_0x99a1('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0xf713b9,_0x40c19c,_0x3a865c,_0x47815e){return new BPromise(function(_0xe1a1f,_0x3c9ef4){var _0x39ee55=_0x47815e||client;return _0x39ee55['request'](_0xf713b9,_0x3a865c)[_0x99a1('0x1c')](function(_0x3e45d4){logger[_0x99a1('0x1d')](_0x99a1('0x1e'),_0x40c19c,_0x99a1('0x1f'));logger[_0x99a1('0x20')](_0x99a1('0x21'),_0x40c19c,'request\x20sent',JSON['stringify'](_0x3e45d4));if(_0x3e45d4[_0x99a1('0x22')]){if(_0x3e45d4[_0x99a1('0x22')][_0x99a1('0x23')]===0x1f4){logger[_0x99a1('0x22')](_0x99a1('0x1e'),_0x40c19c,_0x3e45d4[_0x99a1('0x22')][_0x99a1('0x24')]);return _0x3c9ef4(_0x3e45d4[_0x99a1('0x22')][_0x99a1('0x24')]);}logger[_0x99a1('0x22')](_0x99a1('0x1e'),_0x40c19c,_0x3e45d4['error'][_0x99a1('0x24')]);return _0xe1a1f(_0x3e45d4[_0x99a1('0x22')]['message']);}else{logger[_0x99a1('0x1d')]('Trunk,\x20%s,\x20%s',_0x40c19c,_0x99a1('0x1f'));_0xe1a1f(_0x3e45d4[_0x99a1('0x25')][_0x99a1('0x24')]);}})[_0x99a1('0x26')](function(_0x5a88c6){logger[_0x99a1('0x22')](_0x99a1('0x1e'),_0x40c19c,_0x5a88c6);_0x3c9ef4(_0x5a88c6);});});}function respondWithStatusCode(_0x483c17,_0x44df2d){_0x44df2d=_0x44df2d||0xcc;return function(_0x5b5dfa){if(_0x5b5dfa){return _0x483c17[_0x99a1('0x27')](_0x44df2d);}return _0x483c17[_0x99a1('0x28')](_0x44df2d)[_0x99a1('0x29')]();};}function respondWithResult(_0xdaa27d,_0x3c813){_0x3c813=_0x3c813||0xc8;return function(_0x491341){if(_0x491341){return _0xdaa27d['status'](_0x3c813)[_0x99a1('0x2a')](_0x491341);}};}function respondWithFilteredResult(_0x5dabd9,_0x5dc733){return function(_0xafea84){if(_0xafea84){var _0x440879=typeof _0x5dc733[_0x99a1('0x2b')]===_0x99a1('0x2c')&&typeof _0x5dc733[_0x99a1('0x2d')]===_0x99a1('0x2c');var _0x183037=_0xafea84['count'];var _0xf41b0d=_0x440879?0x0:_0x5dc733['offset'];var _0x255197=_0x440879?_0xafea84[_0x99a1('0x2e')]:_0x5dc733[_0x99a1('0x2b')]+_0x5dc733['limit'];var _0x371edf;if(_0x255197>=_0x183037){_0x255197=_0x183037;_0x371edf=0xc8;}else{_0x371edf=0xce;}_0x5dabd9[_0x99a1('0x28')](_0x371edf);return _0x5dabd9['set'](_0x99a1('0x2f'),_0xf41b0d+'-'+_0x255197+'/'+_0x183037)[_0x99a1('0x2a')](_0xafea84);}return null;};}function patchUpdates(_0x36aa34){return function(_0x303d1e){try{jsonpatch[_0x99a1('0x30')](_0x303d1e,_0x36aa34,!![]);}catch(_0x969f6e){return BPromise[_0x99a1('0x31')](_0x969f6e);}return _0x303d1e[_0x99a1('0x32')]();};}function saveUpdates(_0x52da8d,_0x4960e4){return function(_0x3fa342){if(_0x3fa342){return _0x3fa342['update'](_0x52da8d)[_0x99a1('0x1c')](function(_0x400581){return _0x400581;});}return null;};}function removeEntity(_0x5b1a79,_0xa5972b){return function(_0x3503d5){if(_0x3503d5){return _0x3503d5[_0x99a1('0x33')]()[_0x99a1('0x1c')](function(){var _0x13f4db=_0x3503d5[_0x99a1('0x34')]({'plain':!![]});var _0x3081cd=_0x99a1('0x35');return db[_0x99a1('0x36')][_0x99a1('0x33')]({'where':{'type':_0x3081cd,'resourceId':_0x13f4db['id']}})[_0x99a1('0x1c')](function(){return _0x3503d5;});})[_0x99a1('0x1c')](function(){_0x5b1a79[_0x99a1('0x28')](0xcc)[_0x99a1('0x29')]();});}};}function handleEntityNotFound(_0x55005e,_0x53fed5){return function(_0x46e3f2){if(!_0x46e3f2){_0x55005e[_0x99a1('0x27')](0x194);}return _0x46e3f2;};}function handleError(_0x416a36,_0x4131e0){_0x4131e0=_0x4131e0||0x1f4;return function(_0x2690bd){logger[_0x99a1('0x22')](_0x2690bd[_0x99a1('0x37')]);if(_0x2690bd['name']){delete _0x2690bd[_0x99a1('0x38')];}_0x416a36[_0x99a1('0x28')](_0x4131e0)['send'](_0x2690bd);};}exports[_0x99a1('0x39')]=function(_0x2d328c,_0x391afa){var _0x3cd1a0={},_0x430cbc={},_0x399fd4={'count':0x0,'rows':[]};var _0x30e8a9=_[_0x99a1('0x3a')](db[_0x99a1('0x3b')][_0x99a1('0x3c')],function(_0x1da3e7){return{'name':_0x1da3e7[_0x99a1('0x3d')],'type':_0x1da3e7[_0x99a1('0x3e')]['key']};});_0x430cbc['model']=_['map'](_0x30e8a9,_0x99a1('0x38'));_0x430cbc[_0x99a1('0x3f')]=_[_0x99a1('0x40')](_0x2d328c[_0x99a1('0x3f')]);_0x430cbc[_0x99a1('0x41')]=_['intersection'](_0x430cbc[_0x99a1('0x42')],_0x430cbc[_0x99a1('0x3f')]);_0x3cd1a0[_0x99a1('0x43')]=_['intersection'](_0x430cbc['model'],qs[_0x99a1('0x44')](_0x2d328c[_0x99a1('0x3f')][_0x99a1('0x44')]));_0x3cd1a0['attributes']=_0x3cd1a0[_0x99a1('0x43')][_0x99a1('0x45')]?_0x3cd1a0[_0x99a1('0x43')]:_0x430cbc[_0x99a1('0x42')];if(!_0x2d328c[_0x99a1('0x3f')][_0x99a1('0x46')](_0x99a1('0x47'))){_0x3cd1a0[_0x99a1('0x2d')]=qs[_0x99a1('0x2d')](_0x2d328c[_0x99a1('0x3f')]['limit']);_0x3cd1a0[_0x99a1('0x2b')]=qs[_0x99a1('0x2b')](_0x2d328c[_0x99a1('0x3f')]['offset']);}_0x3cd1a0[_0x99a1('0x48')]=qs['sort'](_0x2d328c[_0x99a1('0x3f')][_0x99a1('0x49')]);_0x3cd1a0[_0x99a1('0x4a')]=qs[_0x99a1('0x41')](_[_0x99a1('0x4b')](_0x2d328c[_0x99a1('0x3f')],_0x430cbc['filters']),_0x30e8a9);if(_0x2d328c[_0x99a1('0x3f')]['filter']){_0x3cd1a0[_0x99a1('0x4a')]=_[_0x99a1('0x4c')](_0x3cd1a0[_0x99a1('0x4a')],{'$or':_[_0x99a1('0x3a')](_0x30e8a9,function(_0x3a0b44){if(_0x3a0b44[_0x99a1('0x3e')]!==_0x99a1('0x4d')){var _0x3861b6={};_0x3861b6[_0x3a0b44[_0x99a1('0x38')]]={'$like':'%'+_0x2d328c[_0x99a1('0x3f')][_0x99a1('0x4e')]+'%'};return _0x3861b6;}})});}_0x3cd1a0=_['merge']({},_0x3cd1a0,_0x2d328c[_0x99a1('0x4f')]);var _0x330e3b={'where':_0x3cd1a0['where']};return db[_0x99a1('0x3b')][_0x99a1('0x2e')](_0x330e3b)[_0x99a1('0x1c')](function(_0x2e377b){_0x399fd4[_0x99a1('0x2e')]=_0x2e377b;if(_0x2d328c[_0x99a1('0x3f')][_0x99a1('0x50')]){_0x3cd1a0['include']=[{'all':!![]}];}return db[_0x99a1('0x3b')]['findAll'](_0x3cd1a0);})[_0x99a1('0x1c')](function(_0x269798){_0x399fd4['rows']=_0x269798;return _0x399fd4;})['then'](respondWithFilteredResult(_0x391afa,_0x3cd1a0))[_0x99a1('0x26')](handleError(_0x391afa,null));};exports[_0x99a1('0x51')]=function(_0x462c15,_0x4519fb){var _0xee2b1b={'raw':![],'where':{'id':_0x462c15['params']['id']}},_0x597836={};_0x597836['model']=_[_0x99a1('0x40')](db[_0x99a1('0x3b')][_0x99a1('0x3c')]);_0x597836[_0x99a1('0x3f')]=_[_0x99a1('0x40')](_0x462c15[_0x99a1('0x3f')]);_0x597836[_0x99a1('0x41')]=_['intersection'](_0x597836[_0x99a1('0x42')],_0x597836[_0x99a1('0x3f')]);_0xee2b1b[_0x99a1('0x43')]=_['intersection'](_0x597836[_0x99a1('0x42')],qs['fields'](_0x462c15['query'][_0x99a1('0x44')]));_0xee2b1b[_0x99a1('0x43')]=_0xee2b1b[_0x99a1('0x43')][_0x99a1('0x45')]?_0xee2b1b[_0x99a1('0x43')]:_0x597836[_0x99a1('0x42')];if(_0x462c15[_0x99a1('0x3f')][_0x99a1('0x50')]){_0xee2b1b[_0x99a1('0x52')]=[{'all':!![]}];}_0xee2b1b=_['merge']({},_0xee2b1b,_0x462c15[_0x99a1('0x4f')]);return db['Trunk'][_0x99a1('0x53')](_0xee2b1b)[_0x99a1('0x1c')](handleEntityNotFound(_0x4519fb,null))['then'](respondWithResult(_0x4519fb,null))[_0x99a1('0x26')](handleError(_0x4519fb,null));};exports[_0x99a1('0x54')]=function(_0x469e10,_0x2b2d63){var _0x2800d5={'where':{'id':_0x469e10[_0x99a1('0x55')]['id']}},_0x1bff78={};_0x1bff78[_0x99a1('0x42')]=_[_0x99a1('0x40')](db[_0x99a1('0x3b')][_0x99a1('0x3c')]);_0x2800d5[_0x99a1('0x43')]=_['intersection'](_0x1bff78['model'],qs[_0x99a1('0x44')](_0x469e10[_0x99a1('0x3f')][_0x99a1('0x44')]));_0x2800d5[_0x99a1('0x43')]=_0x2800d5[_0x99a1('0x43')]['length']?_0x2800d5[_0x99a1('0x43')]:_0x1bff78[_0x99a1('0x42')];if(_0x469e10['query'][_0x99a1('0x50')]){_0x2800d5[_0x99a1('0x52')]=[{'all':!![]}];}_0x2800d5=_[_0x99a1('0x4c')]({},_0x2800d5,_0x469e10[_0x99a1('0x4f')]);return db[_0x99a1('0x3b')]['find'](_0x2800d5)[_0x99a1('0x1c')](handleEntityNotFound(_0x2b2d63,null))[_0x99a1('0x1c')](function(_0x1bb1cb){if(_0x1bb1cb){var _0x22811f=_0x1bb1cb[_0x99a1('0x34')]({'plain':!![]});_0x22811f=qs[_0x99a1('0x56')](_0x22811f,['id','createdAt',_0x99a1('0x57')]);_0x469e10[_0x99a1('0x58')]=_['omit'](_0x469e10[_0x99a1('0x58')],['id',_0x99a1('0x59'),_0x99a1('0x57')]);return db[_0x99a1('0x3b')][_0x99a1('0x5a')](_['merge'](_0x22811f,_0x469e10[_0x99a1('0x58')]),{'include':_0x469e10['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x38ce3c){var _0x3f7c16=_0x469e10['user']['get']({'plain':!![]});if(!_0x3f7c16)throw new Error(_0x99a1('0x5b'));if(_0x3f7c16['role']===_0x99a1('0x5c')){var _0x263db3=_0x38ce3c[_0x99a1('0x34')]({'plain':!![]});var _0x180c1e='Trunks';return db[_0x99a1('0x5d')][_0x99a1('0x53')]({'where':{'name':_0x180c1e,'userProfileId':_0x3f7c16[_0x99a1('0x5e')]},'raw':!![]})['then'](function(_0x3a62c6){if(_0x3a62c6&&_0x3a62c6['autoAssociation']===0x0){return db[_0x99a1('0x36')][_0x99a1('0x5a')]({'name':_0x263db3[_0x99a1('0x38')],'resourceId':_0x263db3['id'],'type':_0x3a62c6[_0x99a1('0x38')],'sectionId':_0x3a62c6['id']},{})[_0x99a1('0x1c')](function(){return _0x38ce3c;});}else{return _0x38ce3c;}})['catch'](function(_0x4d37f8){logger['error'](_0x99a1('0x5f'),_0x4d37f8);throw _0x4d37f8;});}return _0x38ce3c;});}})[_0x99a1('0x1c')](respondWithResult(_0x2b2d63,0xc9))['catch'](handleError(_0x2b2d63,null));};exports['create']=function(_0x1fe7af,_0x2f5587,_0x401c8f){var _0x509d4f;return db['Trunk'][_0x99a1('0x5a')](_0x1fe7af['body'],{'raw':!![]})[_0x99a1('0x1c')](function(_0x129690){_0x509d4f=_0x129690;return db[_0x99a1('0x3b')]['findAll']({'raw':!![]});})[_0x99a1('0x1c')](function(_0x28c7d8){var _0x4ac99e=fs['readFileSync'](path[_0x99a1('0x60')](config['root'],_0x99a1('0x61')),_0x99a1('0x62'));var _0x30a0a5=fs['readFileSync'](path[_0x99a1('0x60')](config[_0x99a1('0x63')],_0x99a1('0x64')),_0x99a1('0x62'));var _0x3d0ff6=ejs['render'](_0x4ac99e,{'trunks':_0x28c7d8||[]});fs['writeFileSync'](_0x99a1('0x65'),_0x3d0ff6);if(_0x509d4f[_0x99a1('0x66')]){var _0x1750d5=ejs[_0x99a1('0x67')](_0x30a0a5,{'trunks':_0x28c7d8||[]});fs['writeFileSync'](_0x99a1('0x68'),_0x1750d5);}})['then'](function(){return respondWithRpcPromise('Reload',_0x99a1('0x5a'),{'module':_0x99a1('0x69')});})[_0x99a1('0x1c')](function(){var _0x525969=_0x1fe7af[_0x99a1('0x5c')][_0x99a1('0x34')]({'plain':!![]});if(!_0x525969)throw new Error(_0x99a1('0x5b'));if(_0x525969[_0x99a1('0x6a')]===_0x99a1('0x5c')){var _0x4ae313=_0x509d4f[_0x99a1('0x34')]({'plain':!![]});return db[_0x99a1('0x5d')][_0x99a1('0x53')]({'where':{'name':_0x99a1('0x35'),'userProfileId':_0x525969[_0x99a1('0x5e')]},'raw':!![]})[_0x99a1('0x1c')](function(_0x5e42be){if(_0x5e42be&&_0x5e42be[_0x99a1('0x6b')]===0x0){return db[_0x99a1('0x36')][_0x99a1('0x5a')]({'name':_0x4ae313[_0x99a1('0x38')],'resourceId':_0x4ae313['id'],'type':_0x5e42be[_0x99a1('0x38')],'sectionId':_0x5e42be['id']},{})['then'](function(){return _0x509d4f;});}else{return _0x509d4f;}})[_0x99a1('0x26')](function(_0x68c944){logger[_0x99a1('0x22')](_0x99a1('0x5f'),_0x68c944);throw _0x68c944;});}return _0x509d4f;})[_0x99a1('0x1c')](respondWithResult(_0x2f5587,0xc9))[_0x99a1('0x26')](handleError(_0x2f5587,null));};exports['update']=function(_0xaa953e,_0x33d96b,_0x4a5617){var _0x56716a;return db[_0x99a1('0x3b')][_0x99a1('0x53')]({'where':{'id':_0xaa953e['params']['id']}})[_0x99a1('0x1c')](handleEntityNotFound(_0x33d96b,null))[_0x99a1('0x1c')](saveUpdates(_0xaa953e[_0x99a1('0x58')],null))[_0x99a1('0x1c')](function(_0x43156f){if(_0x43156f){_0x56716a=_0x43156f;return db[_0x99a1('0x3b')][_0x99a1('0x6c')]({'raw':!![]});}})[_0x99a1('0x1c')](function(_0x4260d7){if(_0x4260d7){var _0x3e099c=fs[_0x99a1('0x6d')](path[_0x99a1('0x60')](config[_0x99a1('0x63')],'server/files/templates/trunk.ejs'),_0x99a1('0x62'));var _0x5a9a7d=fs['readFileSync'](path[_0x99a1('0x60')](config[_0x99a1('0x63')],_0x99a1('0x64')),_0x99a1('0x62'));var _0xbbbe26=ejs[_0x99a1('0x67')](_0x3e099c,{'trunks':_0x4260d7||[]});fs[_0x99a1('0x6e')](_0x99a1('0x65'),_0xbbbe26);var _0x361ce6=ejs['render'](_0x5a9a7d,{'trunks':_0x4260d7||[]});fs[_0x99a1('0x6e')](_0x99a1('0x68'),_0x361ce6);return respondWithRpcPromise(_0x99a1('0x6f'),_0x99a1('0x70'),{'module':_0x99a1('0x69')});}return null;})[_0x99a1('0x1c')](function(_0x6dab29){if(_0x6dab29){return _0x56716a;}})[_0x99a1('0x1c')](respondWithResult(_0x33d96b,null))['catch'](handleError(_0x33d96b,null));};exports['destroy']=function(_0x51c289,_0x2dd29b,_0x353f25){var _0x53cdb3;return db[_0x99a1('0x3b')][_0x99a1('0x53')]({'where':{'id':_0x51c289[_0x99a1('0x55')]['id']}})[_0x99a1('0x1c')](handleEntityNotFound(_0x2dd29b,null))['then'](removeEntity(_0x2dd29b,null))[_0x99a1('0x1c')](function(){return db[_0x99a1('0x3b')][_0x99a1('0x6c')]({'raw':!![]});})[_0x99a1('0x1c')](function(_0x4e9fe9){var _0x24aa05=fs['readFileSync'](path['join'](config['root'],_0x99a1('0x61')),'utf8');var _0xb7744c=fs[_0x99a1('0x6d')](path[_0x99a1('0x60')](config[_0x99a1('0x63')],_0x99a1('0x64')),_0x99a1('0x62'));var _0x444e43=ejs['render'](_0x24aa05,{'trunks':_0x4e9fe9});var _0x4fcd65=ejs[_0x99a1('0x67')](_0xb7744c,{'trunks':_0x4e9fe9});fs[_0x99a1('0x6e')](_0x99a1('0x65'),_0x444e43);fs['writeFileSync'](_0x99a1('0x68'),_0x4fcd65);return respondWithRpcPromise(_0x99a1('0x6f'),_0x99a1('0x33'),{'module':'chan_sip.so'});})[_0x99a1('0x26')](handleError(_0x2dd29b,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index c4eb7dd..38e10d0 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 _0x14ce=['request-promise','rimraf','../../config/environment','./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','../../config/logger','moment','bluebird'];(function(_0x36784c,_0x2e8bb7){var _0x61181e=function(_0x294ce8){while(--_0x294ce8){_0x36784c['push'](_0x36784c['shift']());}};_0x61181e(++_0x2e8bb7);}(_0x14ce,0x194));var _0xe14c=function(_0x1fadb7,_0x414d9c){_0x1fadb7=_0x1fadb7-0x0;var _0x2a0e56=_0x14ce[_0x1fadb7];return _0x2a0e56;};'use strict';var _=require(_0xe14c('0x0'));var util=require('util');var logger=require(_0xe14c('0x1'))('api');var moment=require(_0xe14c('0x2'));var BPromise=require(_0xe14c('0x3'));var rp=require(_0xe14c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe14c('0x5'));var config=require(_0xe14c('0x6'));var attributes=require(_0xe14c('0x7'));module[_0xe14c('0x8')]=function(_0x34812a,_0x1febb3){return _0x34812a[_0xe14c('0x9')](_0xe14c('0xa'),attributes,{'tableName':_0xe14c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbe7e=['bluebird','rimraf','../../config/environment','./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','moment'];(function(_0x1a89cd,_0x44338f){var _0x1023d0=function(_0x10d656){while(--_0x10d656){_0x1a89cd['push'](_0x1a89cd['shift']());}};_0x1023d0(++_0x44338f);}(_0xbe7e,0x15c));var _0xebe7=function(_0x4baf29,_0x30b3f9){_0x4baf29=_0x4baf29-0x0;var _0x3db762=_0xbe7e[_0x4baf29];return _0x3db762;};'use strict';var _=require(_0xebe7('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xebe7('0x1'));var BPromise=require(_0xebe7('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xebe7('0x3'));var config=require(_0xebe7('0x4'));var attributes=require(_0xebe7('0x5'));module[_0xebe7('0x6')]=function(_0x4adab3,_0x4e2b76){return _0x4adab3[_0xebe7('0x7')](_0xebe7('0x8'),attributes,{'tableName':_0xebe7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index ec06708..2db6f88 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 _0xe2fa=['ShowTrunk','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','result','catch','GetTrunk','Trunk','where','options','attributes','limit','include','map','model'];(function(_0xe67b1a,_0x4e64c9){var _0x1492ff=function(_0x435613){while(--_0x435613){_0xe67b1a['push'](_0xe67b1a['shift']());}};_0x1492ff(++_0x4e64c9);}(_0xe2fa,0x123));var _0xae2f=function(_0x3d2a82,_0x596850){_0x3d2a82=_0x3d2a82-0x0;var _0x35730b=_0xe2fa[_0x3d2a82];return _0x35730b;};'use strict';var _=require(_0xae2f('0x0'));var util=require(_0xae2f('0x1'));var moment=require(_0xae2f('0x2'));var BPromise=require(_0xae2f('0x3'));var rs=require(_0xae2f('0x4'));var fs=require('fs');var Redis=require(_0xae2f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xae2f('0x6'));var logger=require(_0xae2f('0x7'))('rpc');var config=require(_0xae2f('0x8'));var jayson=require(_0xae2f('0x9'));var client=jayson[_0xae2f('0xa')][_0xae2f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x42393b,_0x594f7b,_0x54e2b5){return new BPromise(function(_0x4ab145,_0x5977b4){return client[_0xae2f('0xc')](_0x42393b,_0x54e2b5)[_0xae2f('0xd')](function(_0x3afc96){logger['info'](_0xae2f('0xe'),_0x594f7b,'request\x20sent');logger[_0xae2f('0xf')](_0xae2f('0x10'),_0x594f7b,'request\x20sent',JSON[_0xae2f('0x11')](_0x3afc96));if(_0x3afc96[_0xae2f('0x12')]){if(_0x3afc96['error']['code']===0x1f4){logger[_0xae2f('0x12')](_0xae2f('0xe'),_0x594f7b,_0x3afc96['error'][_0xae2f('0x13')]);return _0x5977b4(_0x3afc96[_0xae2f('0x12')][_0xae2f('0x13')]);}logger[_0xae2f('0x12')]('Trunk,\x20%s,\x20%s',_0x594f7b,_0x3afc96[_0xae2f('0x12')][_0xae2f('0x13')]);return _0x4ab145(_0x3afc96['error'][_0xae2f('0x13')]);}else{logger[_0xae2f('0x14')](_0xae2f('0xe'),_0x594f7b,_0xae2f('0x15'));_0x4ab145(_0x3afc96[_0xae2f('0x16')][_0xae2f('0x13')]);}})[_0xae2f('0x17')](function(_0x20deca){logger['error'](_0xae2f('0xe'),_0x594f7b,_0x20deca);_0x5977b4(_0x20deca);});});}exports[_0xae2f('0x18')]=function(_0x327c1f){var _0x218103=this;return new Promise(function(_0x558eaa,_0x18c5d4){return db[_0xae2f('0x19')]['findAll']({'raw':_0x327c1f['options']?_0x327c1f['options']['raw']===undefined?!![]:![]:!![],'where':_0x327c1f['options']?_0x327c1f['options'][_0xae2f('0x1a')]||null:null,'attributes':_0x327c1f[_0xae2f('0x1b')]?_0x327c1f['options'][_0xae2f('0x1c')]||null:null,'limit':_0x327c1f[_0xae2f('0x1b')]?_0x327c1f[_0xae2f('0x1b')][_0xae2f('0x1d')]||null:null,'include':_0x327c1f[_0xae2f('0x1b')]?_0x327c1f['options'][_0xae2f('0x1e')]?_[_0xae2f('0x1f')](_0x327c1f[_0xae2f('0x1b')]['include'],function(_0x575bb5){return{'model':db[_0x575bb5[_0xae2f('0x20')]],'as':_0x575bb5['as'],'attributes':_0x575bb5[_0xae2f('0x1c')],'include':_0x575bb5[_0xae2f('0x1e')]?_[_0xae2f('0x1f')](_0x575bb5[_0xae2f('0x1e')],function(_0x343efd){return{'model':db[_0x343efd['model']],'as':_0x343efd['as'],'attributes':_0x343efd[_0xae2f('0x1c')],'include':_0x343efd['include']?_[_0xae2f('0x1f')](_0x343efd[_0xae2f('0x1e')],function(_0x1d3b34){return{'model':db[_0x1d3b34[_0xae2f('0x20')]],'as':_0x1d3b34['as'],'attributes':_0x1d3b34[_0xae2f('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2b7666){logger[_0xae2f('0x14')](_0xae2f('0x18'),_0x327c1f);logger[_0xae2f('0xf')](_0xae2f('0x18'),_0x327c1f,JSON['stringify'](_0x2b7666));_0x558eaa(_0x2b7666);})[_0xae2f('0x17')](function(_0x4b22c0){logger[_0xae2f('0x12')](_0xae2f('0x18'),_0x4b22c0[_0xae2f('0x13')],_0x327c1f);_0x18c5d4(_0x218103[_0xae2f('0x12')](0x1f4,_0x4b22c0[_0xae2f('0x13')]));});});};exports[_0xae2f('0x21')]=function(_0x316b7e){var _0x5dd3a9=this;return new Promise(function(_0x27bc96,_0x516132){return db[_0xae2f('0x19')][_0xae2f('0x22')]({'raw':_0x316b7e[_0xae2f('0x1b')]?_0x316b7e['options'][_0xae2f('0x23')]===undefined?!![]:![]:!![],'where':_0x316b7e['options']?_0x316b7e[_0xae2f('0x1b')][_0xae2f('0x1a')]||null:null,'attributes':_0x316b7e['options']?_0x316b7e[_0xae2f('0x1b')]['attributes']||null:null,'include':_0x316b7e[_0xae2f('0x1b')]?_0x316b7e[_0xae2f('0x1b')][_0xae2f('0x1e')]?_[_0xae2f('0x1f')](_0x316b7e[_0xae2f('0x1b')]['include'],function(_0x3ce4fb){return{'model':db[_0x3ce4fb[_0xae2f('0x20')]],'as':_0x3ce4fb['as'],'attributes':_0x3ce4fb['attributes'],'include':_0x3ce4fb[_0xae2f('0x1e')]?_[_0xae2f('0x1f')](_0x3ce4fb[_0xae2f('0x1e')],function(_0x3a1c02){return{'model':db[_0x3a1c02[_0xae2f('0x20')]],'as':_0x3a1c02['as'],'attributes':_0x3a1c02[_0xae2f('0x1c')],'include':_0x3a1c02['include']?_[_0xae2f('0x1f')](_0x3a1c02[_0xae2f('0x1e')],function(_0x43dda9){return{'model':db[_0x43dda9[_0xae2f('0x20')]],'as':_0x43dda9['as'],'attributes':_0x43dda9['attributes']};}):[]};}):[]};}):[]:[]})[_0xae2f('0xd')](function(_0x3cf309){logger[_0xae2f('0x14')](_0xae2f('0x21'),_0x316b7e);logger[_0xae2f('0xf')](_0xae2f('0x21'),_0x316b7e,JSON[_0xae2f('0x11')](_0x3cf309));_0x27bc96(_0x3cf309);})[_0xae2f('0x17')](function(_0x5a523e){logger[_0xae2f('0x12')]('ShowTrunk',_0x5a523e[_0xae2f('0x13')],_0x316b7e);_0x516132(_0x5dd3a9['error'](0x1f4,_0x5a523e['message']));});});}; \ No newline at end of file +var _0xa2f8=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTrunk','Trunk','findAll','options','raw','attributes','include','map','model','find','where','ShowTrunk','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3cae67,_0x310a88){var _0xef0e05=function(_0x4a93a7){while(--_0x4a93a7){_0x3cae67['push'](_0x3cae67['shift']());}};_0xef0e05(++_0x310a88);}(_0xa2f8,0x19b));var _0x8a2f=function(_0x133114,_0x5e1b12){_0x133114=_0x133114-0x0;var _0x191d9b=_0xa2f8[_0x133114];return _0x191d9b;};'use strict';var _=require(_0x8a2f('0x0'));var util=require(_0x8a2f('0x1'));var moment=require(_0x8a2f('0x2'));var BPromise=require(_0x8a2f('0x3'));var rs=require(_0x8a2f('0x4'));var fs=require('fs');var Redis=require(_0x8a2f('0x5'));var db=require(_0x8a2f('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x8a2f('0x7'))(_0x8a2f('0x8'));var config=require(_0x8a2f('0x9'));var jayson=require(_0x8a2f('0xa'));var client=jayson[_0x8a2f('0xb')][_0x8a2f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x59edf0,_0x335506,_0x315e3d){return new BPromise(function(_0x32230e,_0x24801e){return client[_0x8a2f('0xd')](_0x59edf0,_0x315e3d)[_0x8a2f('0xe')](function(_0xed93e2){logger[_0x8a2f('0xf')](_0x8a2f('0x10'),_0x335506,_0x8a2f('0x11'));logger[_0x8a2f('0x12')](_0x8a2f('0x13'),_0x335506,_0x8a2f('0x11'),JSON[_0x8a2f('0x14')](_0xed93e2));if(_0xed93e2[_0x8a2f('0x15')]){if(_0xed93e2[_0x8a2f('0x15')][_0x8a2f('0x16')]===0x1f4){logger[_0x8a2f('0x15')](_0x8a2f('0x10'),_0x335506,_0xed93e2[_0x8a2f('0x15')][_0x8a2f('0x17')]);return _0x24801e(_0xed93e2['error'][_0x8a2f('0x17')]);}logger[_0x8a2f('0x15')](_0x8a2f('0x10'),_0x335506,_0xed93e2[_0x8a2f('0x15')][_0x8a2f('0x17')]);return _0x32230e(_0xed93e2[_0x8a2f('0x15')][_0x8a2f('0x17')]);}else{logger[_0x8a2f('0xf')](_0x8a2f('0x10'),_0x335506,_0x8a2f('0x11'));_0x32230e(_0xed93e2[_0x8a2f('0x18')]['message']);}})[_0x8a2f('0x19')](function(_0xfd607){logger['error'](_0x8a2f('0x10'),_0x335506,_0xfd607);_0x24801e(_0xfd607);});});}exports[_0x8a2f('0x1a')]=function(_0xe2f161){var _0x5901f7=this;return new Promise(function(_0x484a38,_0x3fd182){return db[_0x8a2f('0x1b')][_0x8a2f('0x1c')]({'raw':_0xe2f161[_0x8a2f('0x1d')]?_0xe2f161[_0x8a2f('0x1d')][_0x8a2f('0x1e')]===undefined?!![]:![]:!![],'where':_0xe2f161[_0x8a2f('0x1d')]?_0xe2f161[_0x8a2f('0x1d')]['where']||null:null,'attributes':_0xe2f161['options']?_0xe2f161[_0x8a2f('0x1d')][_0x8a2f('0x1f')]||null:null,'limit':_0xe2f161['options']?_0xe2f161[_0x8a2f('0x1d')]['limit']||null:null,'include':_0xe2f161[_0x8a2f('0x1d')]?_0xe2f161[_0x8a2f('0x1d')][_0x8a2f('0x20')]?_[_0x8a2f('0x21')](_0xe2f161[_0x8a2f('0x1d')][_0x8a2f('0x20')],function(_0x2ab258){return{'model':db[_0x2ab258[_0x8a2f('0x22')]],'as':_0x2ab258['as'],'attributes':_0x2ab258[_0x8a2f('0x1f')],'include':_0x2ab258['include']?_[_0x8a2f('0x21')](_0x2ab258[_0x8a2f('0x20')],function(_0x276c2f){return{'model':db[_0x276c2f[_0x8a2f('0x22')]],'as':_0x276c2f['as'],'attributes':_0x276c2f[_0x8a2f('0x1f')],'include':_0x276c2f[_0x8a2f('0x20')]?_['map'](_0x276c2f['include'],function(_0x37cac8){return{'model':db[_0x37cac8[_0x8a2f('0x22')]],'as':_0x37cac8['as'],'attributes':_0x37cac8[_0x8a2f('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x342083){logger[_0x8a2f('0xf')](_0x8a2f('0x1a'),_0xe2f161);logger['debug'](_0x8a2f('0x1a'),_0xe2f161,JSON['stringify'](_0x342083));_0x484a38(_0x342083);})[_0x8a2f('0x19')](function(_0x2b4762){logger[_0x8a2f('0x15')]('GetTrunk',_0x2b4762[_0x8a2f('0x17')],_0xe2f161);_0x3fd182(_0x5901f7[_0x8a2f('0x15')](0x1f4,_0x2b4762['message']));});});};exports['ShowTrunk']=function(_0xcf0cf3){var _0x44aa83=this;return new Promise(function(_0x1b43d8,_0x4152ad){return db[_0x8a2f('0x1b')][_0x8a2f('0x23')]({'raw':_0xcf0cf3[_0x8a2f('0x1d')]?_0xcf0cf3['options']['raw']===undefined?!![]:![]:!![],'where':_0xcf0cf3[_0x8a2f('0x1d')]?_0xcf0cf3[_0x8a2f('0x1d')][_0x8a2f('0x24')]||null:null,'attributes':_0xcf0cf3[_0x8a2f('0x1d')]?_0xcf0cf3['options']['attributes']||null:null,'include':_0xcf0cf3[_0x8a2f('0x1d')]?_0xcf0cf3[_0x8a2f('0x1d')]['include']?_[_0x8a2f('0x21')](_0xcf0cf3[_0x8a2f('0x1d')][_0x8a2f('0x20')],function(_0x41479b){return{'model':db[_0x41479b[_0x8a2f('0x22')]],'as':_0x41479b['as'],'attributes':_0x41479b[_0x8a2f('0x1f')],'include':_0x41479b[_0x8a2f('0x20')]?_[_0x8a2f('0x21')](_0x41479b[_0x8a2f('0x20')],function(_0x39a4ce){return{'model':db[_0x39a4ce['model']],'as':_0x39a4ce['as'],'attributes':_0x39a4ce['attributes'],'include':_0x39a4ce[_0x8a2f('0x20')]?_['map'](_0x39a4ce[_0x8a2f('0x20')],function(_0x1446df){return{'model':db[_0x1446df[_0x8a2f('0x22')]],'as':_0x1446df['as'],'attributes':_0x1446df[_0x8a2f('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x8a2f('0xe')](function(_0x3a075f){logger[_0x8a2f('0xf')](_0x8a2f('0x25'),_0xcf0cf3);logger[_0x8a2f('0x12')](_0x8a2f('0x25'),_0xcf0cf3,JSON['stringify'](_0x3a075f));_0x1b43d8(_0x3a075f);})[_0x8a2f('0x19')](function(_0x5e3130){logger[_0x8a2f('0x15')](_0x8a2f('0x25'),_0x5e3130[_0x8a2f('0x17')],_0xcf0cf3);_0x4152ad(_0x44aa83[_0x8a2f('0x15')](0x1f4,_0x5e3130['message']));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 03e8e88..d55ede3 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 _0xbe33=['/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeSmsInteractions','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','describe','whoami','/presence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','/:id/contacts','/:id/queues','getQueues','getVoiceQueuesRt','/:id/recordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/fax/interactions','/:id/whatsapp/interactions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','bulkCreate','addQueues','join','root','format','%s-%s','now','originalname','single','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','/:id/mail_accounts','addMailAccounts','addOpenchannelAccounts','/:id/sms_accounts','addChatWebsites','addWhatsappAccounts','createApiKey','put','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbe33,0x1dc));var _0x3be3=function(_0x13ae66,_0x2f8ada){_0x13ae66=_0x13ae66-0x0;var _0x2688b8=_0xbe33[_0x13ae66];return _0x2688b8;};'use strict';var multer=require(_0x3be3('0x0'));var util=require(_0x3be3('0x1'));var path=require(_0x3be3('0x2'));var timeout=require('connect-timeout');var express=require(_0x3be3('0x3'));var router=express[_0x3be3('0x4')]();var fs_extra=require(_0x3be3('0x5'));var auth=require(_0x3be3('0x6'));var interaction=require(_0x3be3('0x7'));var config=require(_0x3be3('0x8'));var controller=require(_0x3be3('0x9'));router[_0x3be3('0xa')]('/',auth[_0x3be3('0xb')](),controller['index']);router[_0x3be3('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x3be3('0xc')]);router['get']('/whoami',auth[_0x3be3('0xb')](),controller[_0x3be3('0xd')]);router[_0x3be3('0xa')](_0x3be3('0xe'),auth[_0x3be3('0xb')](),controller['getPresence']);router[_0x3be3('0xa')](_0x3be3('0xf'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x10')]);router[_0x3be3('0xa')](_0x3be3('0x11'),controller[_0x3be3('0x12')]);router['get'](_0x3be3('0x13'),auth[_0x3be3('0xb')](),controller['getOpenTabs']);router[_0x3be3('0xa')](_0x3be3('0x14'),auth[_0x3be3('0xb')](),controller['getContacts']);router[_0x3be3('0xa')](_0x3be3('0x15'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x16')]);router[_0x3be3('0xa')]('/:id/queues_rt',auth[_0x3be3('0xb')](),controller[_0x3be3('0x17')]);router[_0x3be3('0xa')]('/:id/groups',auth[_0x3be3('0xb')](),controller['getGroups']);router['get'](_0x3be3('0x18'),auth[_0x3be3('0xb')](),controller['getRecordings']);router[_0x3be3('0xa')](_0x3be3('0x19'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x1a')]);router[_0x3be3('0xa')](_0x3be3('0x1b'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x1c')]);router[_0x3be3('0xa')](_0x3be3('0x1d'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x1e')]);router[_0x3be3('0xa')](_0x3be3('0x1f'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x20')]);router['get']('/:id/sms/interactions',auth[_0x3be3('0xb')](),controller['getSmsInteractions']);router['get'](_0x3be3('0x21'),auth[_0x3be3('0xb')](),controller['getFaxInteractions']);router[_0x3be3('0xa')](_0x3be3('0x22'),auth[_0x3be3('0xb')](),controller['getWhatsappInteractions']);router[_0x3be3('0xa')](_0x3be3('0x23'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x24')]);router[_0x3be3('0xa')](_0x3be3('0x25'),auth['isAuthenticated'](),controller[_0x3be3('0x26')]);router['get'](_0x3be3('0x27'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x28')]);router[_0x3be3('0xa')]('/:id/prefixes',auth['isAuthenticated'](),controller[_0x3be3('0x29')]);router[_0x3be3('0xa')](_0x3be3('0x2a'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x2b')]);router[_0x3be3('0xa')]('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0x3be3('0x2c')]);router[_0x3be3('0xa')](_0x3be3('0x2d'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x2e')]);router[_0x3be3('0xa')]('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0x3be3('0x2f')]);router[_0x3be3('0xa')](_0x3be3('0x30'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x31')]);router['get'](_0x3be3('0x32'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x33')]);router['get'](_0x3be3('0x34'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x35')]);router[_0x3be3('0xa')]('/:id/scheduled_calls',auth[_0x3be3('0xb')](),controller[_0x3be3('0x36')]);router[_0x3be3('0xa')](_0x3be3('0x37'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x38')]);router[_0x3be3('0x39')](_0x3be3('0x14'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x3a')]);router[_0x3be3('0x39')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3be3('0x39')]('/create_many',auth[_0x3be3('0xb')](),controller[_0x3be3('0x3b')]);router['post'](_0x3be3('0x15'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x3c')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x337c96,_0x207da9,_0xbe3464){_0xbe3464(null,path[_0x3be3('0x3d')](config[_0x3be3('0x3e')],'server/files/images/'));},'filename':function(_0x1e2349,_0x1795c8,_0x28a7d7){_0x28a7d7(null,util[_0x3be3('0x3f')](_0x3be3('0x40'),Date[_0x3be3('0x41')](),_0x1795c8[_0x3be3('0x42')]));}})});router['post'](_0x3be3('0x11'),upload[_0x3be3('0x43')](_0x3be3('0x44')),controller[_0x3be3('0x45')]);router[_0x3be3('0x39')](_0x3be3('0x46'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x47')]);router[_0x3be3('0x39')](_0x3be3('0x48'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x49')]);router[_0x3be3('0x39')](_0x3be3('0x4a'),auth['isAuthenticated'](),controller['pause']);router[_0x3be3('0x39')](_0x3be3('0x4b'),auth['isAuthenticated'](),controller[_0x3be3('0x4c')]);router['post'](_0x3be3('0x23'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x4d')]);router[_0x3be3('0x39')](_0x3be3('0x4e'),auth[_0x3be3('0xb')](),controller['addChatInteractions']);router[_0x3be3('0x39')](_0x3be3('0x4f'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x50')]);router['post'](_0x3be3('0x51'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x52')]);router[_0x3be3('0x39')](_0x3be3('0x53'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x54')]);router[_0x3be3('0x39')](_0x3be3('0x55'),auth['isAuthenticated'](),controller[_0x3be3('0x56')]);router[_0x3be3('0x39')](_0x3be3('0x57'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x58')]);router[_0x3be3('0x39')](_0x3be3('0x2a'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x59')]);router[_0x3be3('0x39')](_0x3be3('0x5a'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x5b')]);router[_0x3be3('0x39')](_0x3be3('0x2d'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x5c')]);router[_0x3be3('0x39')](_0x3be3('0x5d'),auth[_0x3be3('0xb')](),controller['addSmsAccounts']);router[_0x3be3('0x39')](_0x3be3('0x30'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x5e')]);router[_0x3be3('0x39')](_0x3be3('0x32'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x5f')]);router[_0x3be3('0x39')](_0x3be3('0x34'),auth[_0x3be3('0xb')](),controller['addSquareProjects']);router[_0x3be3('0x39')](_0x3be3('0x37'),auth['isAuthenticated'](),controller[_0x3be3('0x60')]);router[_0x3be3('0x61')](_0x3be3('0xf'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x62')]);router[_0x3be3('0x61')](_0x3be3('0x63'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x64')]);router[_0x3be3('0x65')]('/:id/queues',auth[_0x3be3('0xb')](),controller[_0x3be3('0x66')]);router['delete'](_0x3be3('0x23'),auth['isAuthenticated'](),controller[_0x3be3('0x67')]);router[_0x3be3('0x65')](_0x3be3('0xf'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x68')]);router[_0x3be3('0x65')](_0x3be3('0x4e'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x69')]);router['delete'](_0x3be3('0x4f'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x6a')]);router[_0x3be3('0x65')](_0x3be3('0x51'),auth[_0x3be3('0xb')](),controller['removeFaxInteractions']);router[_0x3be3('0x65')](_0x3be3('0x53'),auth['isAuthenticated'](),controller[_0x3be3('0x6b')]);router[_0x3be3('0x65')]('/:id/openchannel_interactions',auth[_0x3be3('0xb')](),controller['removeOpenchannelInteractions']);router['delete'](_0x3be3('0x57'),auth[_0x3be3('0xb')](),controller['removeWhatsappInteractions']);router[_0x3be3('0x65')](_0x3be3('0x2a'),auth[_0x3be3('0xb')](),controller['removeFaxAccounts']);router[_0x3be3('0x65')](_0x3be3('0x5a'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x6c')]);router[_0x3be3('0x65')](_0x3be3('0x2d'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x6d')]);router[_0x3be3('0x65')](_0x3be3('0x5d'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x6e')]);router[_0x3be3('0x65')](_0x3be3('0x30'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x6f')]);router[_0x3be3('0x65')](_0x3be3('0x32'),auth['isAuthenticated'](),controller[_0x3be3('0x70')]);router['delete']('/:id/square_projects',auth[_0x3be3('0xb')](),controller[_0x3be3('0x71')]);router[_0x3be3('0x65')]('/:id/api_key',auth[_0x3be3('0xb')](),controller[_0x3be3('0x72')]);module['exports']=router; \ No newline at end of file +var _0x22af=['getTeams','/:id/lists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','/:id/sms_accounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getApiKey','addContacts','post','/create_many','bulkCreate','/:id/queues','diskStorage','join','root','server/files/images/','now','originalname','single','file','addAvatar','login','/:id/logout','logout','/:id/pause','/:id/unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','/:id/sms_interactions','addSmsInteractions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','/:id/api_key','createApiKey','update','changePassword','delete','destroy','removeChatInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./user.controller','get','index','/describe','isAuthenticated','describe','/whoami','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','/:id/contacts','getContacts','getQueues','/:id/queues_rt','getVoiceQueuesRt','getGroups','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/sms/interactions','/:id/fax/interactions','getFaxInteractions','getWhatsappInteractions','/:id/teams'];(function(_0x377cbf,_0x122de4){var _0x52cd08=function(_0x5aa420){while(--_0x5aa420){_0x377cbf['push'](_0x377cbf['shift']());}};_0x52cd08(++_0x122de4);}(_0x22af,0xb0));var _0xf22a=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x22af[_0x5b561d];return _0x431060;};'use strict';var multer=require('multer');var util=require(_0xf22a('0x0'));var path=require(_0xf22a('0x1'));var timeout=require(_0xf22a('0x2'));var express=require('express');var router=express[_0xf22a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf22a('0x4'));var interaction=require(_0xf22a('0x5'));var config=require('../../config/environment');var controller=require(_0xf22a('0x6'));router[_0xf22a('0x7')]('/',auth['isAuthenticated'](),controller[_0xf22a('0x8')]);router['get'](_0xf22a('0x9'),auth[_0xf22a('0xa')](),controller[_0xf22a('0xb')]);router[_0xf22a('0x7')](_0xf22a('0xc'),auth[_0xf22a('0xa')](),controller['whoami']);router[_0xf22a('0x7')]('/presence',auth[_0xf22a('0xa')](),controller['getPresence']);router[_0xf22a('0x7')](_0xf22a('0xd'),auth[_0xf22a('0xa')](),controller[_0xf22a('0xe')]);router[_0xf22a('0x7')](_0xf22a('0xf'),controller[_0xf22a('0x10')]);router[_0xf22a('0x7')](_0xf22a('0x11'),auth['isAuthenticated'](),controller['getOpenTabs']);router[_0xf22a('0x7')](_0xf22a('0x12'),auth[_0xf22a('0xa')](),controller[_0xf22a('0x13')]);router['get']('/:id/queues',auth[_0xf22a('0xa')](),controller[_0xf22a('0x14')]);router[_0xf22a('0x7')](_0xf22a('0x15'),auth[_0xf22a('0xa')](),controller[_0xf22a('0x16')]);router[_0xf22a('0x7')]('/:id/groups',auth[_0xf22a('0xa')](),controller[_0xf22a('0x17')]);router[_0xf22a('0x7')]('/:id/recordings',auth['isAuthenticated'](),controller[_0xf22a('0x18')]);router[_0xf22a('0x7')](_0xf22a('0x19'),auth[_0xf22a('0xa')](),controller[_0xf22a('0x1a')]);router[_0xf22a('0x7')](_0xf22a('0x1b'),auth[_0xf22a('0xa')](),controller[_0xf22a('0x1c')]);router[_0xf22a('0x7')](_0xf22a('0x1d'),auth[_0xf22a('0xa')](),controller[_0xf22a('0x1e')]);router[_0xf22a('0x7')]('/:id/mail/interactions',auth[_0xf22a('0xa')](),controller['getMailInteractions']);router[_0xf22a('0x7')](_0xf22a('0x1f'),auth[_0xf22a('0xa')](),controller['getSmsInteractions']);router[_0xf22a('0x7')](_0xf22a('0x20'),auth[_0xf22a('0xa')](),controller[_0xf22a('0x21')]);router[_0xf22a('0x7')]('/:id/whatsapp/interactions',auth[_0xf22a('0xa')](),controller[_0xf22a('0x22')]);router['get'](_0xf22a('0x23'),auth[_0xf22a('0xa')](),controller[_0xf22a('0x24')]);router[_0xf22a('0x7')](_0xf22a('0x25'),auth[_0xf22a('0xa')](),controller['getLists']);router['get'](_0xf22a('0x26'),auth[_0xf22a('0xa')](),controller[_0xf22a('0x27')]);router[_0xf22a('0x7')](_0xf22a('0x28'),auth['isAuthenticated'](),controller[_0xf22a('0x29')]);router['get'](_0xf22a('0x2a'),auth['isAuthenticated'](),controller['getFaxAccounts']);router[_0xf22a('0x7')](_0xf22a('0x2b'),auth['isAuthenticated'](),controller[_0xf22a('0x2c')]);router[_0xf22a('0x7')](_0xf22a('0x2d'),auth['isAuthenticated'](),controller['getOpenchannelAccounts']);router['get'](_0xf22a('0x2e'),auth[_0xf22a('0xa')](),controller['getSmsAccounts']);router['get'](_0xf22a('0x2f'),auth[_0xf22a('0xa')](),controller[_0xf22a('0x30')]);router[_0xf22a('0x7')](_0xf22a('0x31'),auth['isAuthenticated'](),controller[_0xf22a('0x32')]);router[_0xf22a('0x7')](_0xf22a('0x33'),auth['isAuthenticated'](),controller[_0xf22a('0x34')]);router['get'](_0xf22a('0x35'),auth['isAuthenticated'](),controller['getScheduledCalls']);router[_0xf22a('0x7')]('/:id/api_key',auth[_0xf22a('0xa')](),controller[_0xf22a('0x36')]);router['post'](_0xf22a('0x12'),auth['isAuthenticated'](),controller[_0xf22a('0x37')]);router[_0xf22a('0x38')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf22a('0x38')](_0xf22a('0x39'),auth['isAuthenticated'](),controller[_0xf22a('0x3a')]);router[_0xf22a('0x38')](_0xf22a('0x3b'),auth[_0xf22a('0xa')](),controller['addQueues']);var upload=multer({'storage':multer[_0xf22a('0x3c')]({'destination':function(_0xa718a0,_0x1f85a9,_0x5b5a78){_0x5b5a78(null,path[_0xf22a('0x3d')](config[_0xf22a('0x3e')],_0xf22a('0x3f')));},'filename':function(_0x514eb2,_0x356cc9,_0x28f25e){_0x28f25e(null,util['format']('%s-%s',Date[_0xf22a('0x40')](),_0x356cc9[_0xf22a('0x41')]));}})});router[_0xf22a('0x38')](_0xf22a('0xf'),upload[_0xf22a('0x42')](_0xf22a('0x43')),controller[_0xf22a('0x44')]);router['post']('/:id/login',auth[_0xf22a('0xa')](),controller[_0xf22a('0x45')]);router[_0xf22a('0x38')](_0xf22a('0x46'),auth[_0xf22a('0xa')](),controller[_0xf22a('0x47')]);router['post'](_0xf22a('0x48'),auth['isAuthenticated'](),controller['pause']);router[_0xf22a('0x38')](_0xf22a('0x49'),auth[_0xf22a('0xa')](),controller['unpause']);router[_0xf22a('0x38')](_0xf22a('0x23'),auth[_0xf22a('0xa')](),controller[_0xf22a('0x4a')]);router['post'](_0xf22a('0x4b'),auth['isAuthenticated'](),controller[_0xf22a('0x4c')]);router[_0xf22a('0x38')](_0xf22a('0x4d'),auth['isAuthenticated'](),controller[_0xf22a('0x4e')]);router[_0xf22a('0x38')](_0xf22a('0x4f'),auth[_0xf22a('0xa')](),controller['addFaxInteractions']);router[_0xf22a('0x38')](_0xf22a('0x50'),auth[_0xf22a('0xa')](),controller[_0xf22a('0x51')]);router[_0xf22a('0x38')]('/:id/openchannel_interactions',auth[_0xf22a('0xa')](),controller[_0xf22a('0x52')]);router[_0xf22a('0x38')](_0xf22a('0x53'),auth[_0xf22a('0xa')](),controller[_0xf22a('0x54')]);router[_0xf22a('0x38')]('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0xf22a('0x55')]);router['post']('/:id/mail_accounts',auth[_0xf22a('0xa')](),controller['addMailAccounts']);router[_0xf22a('0x38')](_0xf22a('0x2d'),auth[_0xf22a('0xa')](),controller['addOpenchannelAccounts']);router['post'](_0xf22a('0x2e'),auth['isAuthenticated'](),controller['addSmsAccounts']);router[_0xf22a('0x38')](_0xf22a('0x2f'),auth[_0xf22a('0xa')](),controller[_0xf22a('0x56')]);router[_0xf22a('0x38')](_0xf22a('0x31'),auth[_0xf22a('0xa')](),controller[_0xf22a('0x57')]);router[_0xf22a('0x38')](_0xf22a('0x33'),auth[_0xf22a('0xa')](),controller[_0xf22a('0x58')]);router[_0xf22a('0x38')](_0xf22a('0x59'),auth[_0xf22a('0xa')](),controller[_0xf22a('0x5a')]);router['put']('/:id',auth[_0xf22a('0xa')](),controller[_0xf22a('0x5b')]);router['put']('/:id/password',auth['isAuthenticated'](),controller[_0xf22a('0x5c')]);router[_0xf22a('0x5d')](_0xf22a('0x3b'),auth[_0xf22a('0xa')](),controller['removeQueues']);router[_0xf22a('0x5d')](_0xf22a('0x23'),auth[_0xf22a('0xa')](),controller['removeTeams']);router[_0xf22a('0x5d')](_0xf22a('0xd'),auth[_0xf22a('0xa')](),controller[_0xf22a('0x5e')]);router[_0xf22a('0x5d')](_0xf22a('0x4b'),auth[_0xf22a('0xa')](),controller[_0xf22a('0x5f')]);router[_0xf22a('0x5d')](_0xf22a('0x4d'),auth[_0xf22a('0xa')](),controller['removeMailInteractions']);router[_0xf22a('0x5d')](_0xf22a('0x4f'),auth[_0xf22a('0xa')](),controller['removeFaxInteractions']);router[_0xf22a('0x5d')](_0xf22a('0x50'),auth['isAuthenticated'](),controller[_0xf22a('0x60')]);router[_0xf22a('0x5d')]('/:id/openchannel_interactions',auth[_0xf22a('0xa')](),controller[_0xf22a('0x61')]);router[_0xf22a('0x5d')]('/:id/whatsapp_interactions',auth['isAuthenticated'](),controller[_0xf22a('0x62')]);router[_0xf22a('0x5d')](_0xf22a('0x2a'),auth[_0xf22a('0xa')](),controller[_0xf22a('0x63')]);router[_0xf22a('0x5d')]('/:id/mail_accounts',auth[_0xf22a('0xa')](),controller['removeMailAccounts']);router[_0xf22a('0x5d')](_0xf22a('0x2d'),auth['isAuthenticated'](),controller[_0xf22a('0x64')]);router[_0xf22a('0x5d')](_0xf22a('0x2e'),auth[_0xf22a('0xa')](),controller[_0xf22a('0x65')]);router[_0xf22a('0x5d')](_0xf22a('0x2f'),auth[_0xf22a('0xa')](),controller['removeChatWebsites']);router[_0xf22a('0x5d')]('/:id/whatsapp_accounts',auth[_0xf22a('0xa')](),controller[_0xf22a('0x66')]);router[_0xf22a('0x5d')](_0xf22a('0x33'),auth[_0xf22a('0xa')](),controller[_0xf22a('0x67')]);router['delete']('/:id/api_key',auth[_0xf22a('0xa')](),controller[_0xf22a('0x68')]);module[_0xf22a('0x69')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index b56afa7..8decb99 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 _0x2f74=['originate','uac','uas','fingerprint','certificate','passive','actpass','update,nonat','TEXT','showWebBar','wss','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','rtcp_mux','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','loginAttempts','blockedAt','sequelize','util','lodash','exports','STRING','name','setDataValue','fullname','callerid','format','\x22%s\x22\x20<%s>','internal','email','toLowerCase','ENUM','admin','user','agent','telephone','getDataValue','BOOLEAN','DATE','INTEGER','dynamic','peer','friend','from-sip','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','join','transport','split','rfc2833','info','shortinfo','inband','auto','nonat','update','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','yes','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','always','accept','refuse'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2f74,0x7b));var _0x42f7=function(_0x2fb16e,_0x161667){_0x2fb16e=_0x2fb16e-0x0;var _0x5e0882=_0x2f74[_0x2fb16e];return _0x5e0882;};'use strict';var Sequelize=require(_0x42f7('0x0'));var moment=require('moment');var util=require(_0x42f7('0x1'));var _=require(_0x42f7('0x2'));module[_0x42f7('0x3')]={'name':{'type':Sequelize[_0x42f7('0x4')],'allowNull':![],'unique':_0x42f7('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x3fcf64){this[_0x42f7('0x6')](_0x42f7('0x5'),_0x3fcf64);this['setDataValue']('defaultuser',_0x3fcf64);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x42f7('0x4')],'allowNull':![],'set':function(_0x1cb6e0){this[_0x42f7('0x6')](_0x42f7('0x7'),_0x1cb6e0);this[_0x42f7('0x6')](_0x42f7('0x8'),util[_0x42f7('0x9')](_0x42f7('0xa'),_0x1cb6e0,this['getDataValue'](_0x42f7('0xb'))));}},'alias':{'type':Sequelize[_0x42f7('0x4')]},'email':{'type':Sequelize[_0x42f7('0x4')],'allowNull':![],'unique':_0x42f7('0xc'),'validate':{'isEmail':!![]},'set':function(_0x1f56d2){if(_0x1f56d2){this[_0x42f7('0x6')]('email',_0x1f56d2[_0x42f7('0xd')]());}}},'role':{'type':Sequelize[_0x42f7('0xe')](_0x42f7('0xf'),_0x42f7('0x10'),_0x42f7('0x11'),_0x42f7('0x12')),'allowNull':![]},'password':{'type':Sequelize[_0x42f7('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x42f7('0x4')],'defaultValue':'local'},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0x42f7('0xb'),'set':function(_0xc274ff){this[_0x42f7('0x6')](_0x42f7('0xb'),_0xc274ff);this[_0x42f7('0x6')]('accountcode',_0xc274ff);this[_0x42f7('0x6')]('callerid',util[_0x42f7('0x9')](_0x42f7('0xa'),this[_0x42f7('0x13')](_0x42f7('0x7')),_0xc274ff));}},'salt':{'type':Sequelize[_0x42f7('0x4')]},'phone':{'type':Sequelize[_0x42f7('0x4')]},'mobile':{'type':Sequelize[_0x42f7('0x4')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0x42f7('0x4')]},'userpic':{'type':Sequelize[_0x42f7('0x4')]},'city':{'type':Sequelize[_0x42f7('0x4')]},'country':{'type':Sequelize[_0x42f7('0x4')]},'online':{'type':Sequelize[_0x42f7('0x14')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x42f7('0x15')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x42f7('0x14')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x42f7('0x14')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x42f7('0x14')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x42f7('0x15')]},'chatCapacity':{'type':Sequelize[_0x42f7('0x16')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x42f7('0x16')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x42f7('0x16')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x42f7('0x16')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x42f7('0x16')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x42f7('0x16')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x42f7('0x14')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x42f7('0x14')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x42f7('0x16')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x42f7('0x16')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x42f7('0x14')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x42f7('0x16')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x42f7('0x14')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![]},'host':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![],'defaultValue':_0x42f7('0x17')},'ipaddr':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0x42f7('0x16')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x42f7('0x16')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x42f7('0x16')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM']('friend',_0x42f7('0x10'),_0x42f7('0x18')),'allowNull':!![],'defaultValue':_0x42f7('0x19')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x42f7('0x1a')},'callingpres':{'type':Sequelize[_0x42f7('0xe')]('ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN',_0x42f7('0x1b'),_0x42f7('0x1c'),_0x42f7('0x1d'),_0x42f7('0x1e'),_0x42f7('0x1f'),_0x42f7('0x20')),'allowNull':!![]},'deny':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![]},'permit':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![]},'secret':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![],'defaultValue':_0x42f7('0x21'),'set':function(_0xd26ccf){this[_0x42f7('0x6')]('transport',_0xd26ccf?_0xd26ccf[_0x42f7('0x22')](','):null);},'get':function(){return this[_0x42f7('0x13')](_0x42f7('0x23'))?this[_0x42f7('0x13')]('transport')[_0x42f7('0x24')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x42f7('0xe')](_0x42f7('0x25'),_0x42f7('0x26'),_0x42f7('0x27'),_0x42f7('0x28'),_0x42f7('0x29')),'allowNull':!![],'defaultValue':_0x42f7('0x25')},'directmedia':{'type':Sequelize['ENUM']('yes','no',_0x42f7('0x2a'),_0x42f7('0x2b'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x42f7('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x48b79e){this[_0x42f7('0x6')]('nat',_0x48b79e?_0x48b79e[_0x42f7('0x22')](','):null);},'get':function(){return this[_0x42f7('0x13')](_0x42f7('0x2c'))?this[_0x42f7('0x13')](_0x42f7('0x2c'))['split'](','):null;},'comment':_0x42f7('0x2d')},'callgroup':{'type':Sequelize[_0x42f7('0x4')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x42f7('0x4')]},'language':{'type':Sequelize[_0x42f7('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x42f7('0x4')]},'disallow':{'type':Sequelize[_0x42f7('0x4')],'allowNull':![],'defaultValue':_0x42f7('0x2e')},'allow':{'type':Sequelize[_0x42f7('0x4')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x3037f8){this['setDataValue'](_0x42f7('0x2f'),_0x3037f8?_0x3037f8[_0x42f7('0x22')](';'):_0x42f7('0x30'));},'get':function(){return this['getDataValue'](_0x42f7('0x2f'))?this['getDataValue'](_0x42f7('0x2f'))[_0x42f7('0x24')](';'):null;},'comment':_0x42f7('0x31')},'autoframing':{'type':Sequelize['ENUM'](_0x42f7('0x32'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![],'set':function(_0x5f2365){this[_0x42f7('0x6')]('insecure',_0x5f2365?_0x5f2365[_0x42f7('0x22')](','):null);},'get':function(){return this['getDataValue'](_0x42f7('0x33'))?this[_0x42f7('0x13')]('insecure')[_0x42f7('0x24')](','):null;},'comment':_0x42f7('0x34')},'trustrpid':{'type':Sequelize['ENUM'](_0x42f7('0x32'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x42f7('0xe')](_0x42f7('0x32'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x42f7('0xe')](_0x42f7('0x32'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x42f7('0xe')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x42f7('0xe')](_0x42f7('0x32'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x42f7('0x16')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x42f7('0x35')},'amaflags':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x42f7('0xe')](_0x42f7('0x32'),'no'),'allowNull':!![],'defaultValue':_0x42f7('0x32')},'busylevel':{'type':Sequelize[_0x42f7('0x16')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x42f7('0xe')](_0x42f7('0x32'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x42f7('0x32'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x42f7('0xe')](_0x42f7('0x32'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x42f7('0xe')](_0x42f7('0x32'),'no',_0x42f7('0x36')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x42f7('0x16')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x42f7('0x32'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x42f7('0xe')](_0x42f7('0x37'),_0x42f7('0x38'),_0x42f7('0x39')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x42f7('0x16')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x42f7('0x16')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x42f7('0x3a'),_0x42f7('0x3b')),'allowNull':!![],'defaultValue':_0x42f7('0x3b')},'t38pt_usertpsource':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0x42f7('0xe')](_0x42f7('0x32'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x42f7('0x16')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x42f7('0x16')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x42f7('0x16')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x42f7('0xe')](_0x42f7('0x32'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x42f7('0x16')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x42f7('0x16')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x42f7('0x16')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x42f7('0x16')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x42f7('0xe')](_0x42f7('0x32'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x42f7('0xe')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x42f7('0xe')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x42f7('0xe')](_0x42f7('0x32'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x42f7('0xe')](_0x42f7('0x32'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x42f7('0xe')](_0x42f7('0x32'),'no',_0x42f7('0x3c'),_0x42f7('0x3d')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM']('active',_0x42f7('0x3e'),_0x42f7('0x3f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0x42f7('0x32'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x42f7('0x32'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x42f7('0xe')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x42f7('0xe')](_0x42f7('0x32'),'no',_0x42f7('0x2a'),_0x42f7('0x2b'),_0x42f7('0x40')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x42f7('0x4')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x42f7('0x15')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x42f7('0x41')]},'showWebBar':{'type':Sequelize[_0x42f7('0x16')],'defaultValue':0x0,'set':function(_0x98a670){this[_0x42f7('0x6')](_0x42f7('0x42'),_0x98a670);var _0x3affa4=this['get']({'plain':!![]});switch(_0x98a670){case 0x0:case 0x1:var _0x419be3=_0x3affa4[_0x42f7('0x23')]?_['isArray'](_0x3affa4[_0x42f7('0x23')])?_0x3affa4[_0x42f7('0x23')][_0x42f7('0x22')]():_0x3affa4[_0x42f7('0x23')]:'udp';if(_0x419be3===_0x42f7('0x43')){_0x419be3='udp';}this[_0x42f7('0x6')](_0x42f7('0x23'),_0x419be3);this['setDataValue'](_0x42f7('0x44'),'no');this[_0x42f7('0x6')](_0x42f7('0x45'),null);this[_0x42f7('0x6')](_0x42f7('0x46'),null);this[_0x42f7('0x6')](_0x42f7('0x47'),null);this['setDataValue'](_0x42f7('0x48'),null);this[_0x42f7('0x6')](_0x42f7('0x49'),null);this['setDataValue'](_0x42f7('0x4a'),null);this['setDataValue'](_0x42f7('0x4b'),null);this['setDataValue']('dtlsprivatekey',null);this['setDataValue'](_0x42f7('0x4c'),'no');break;case 0x2:this['setDataValue'](_0x42f7('0x23'),_0x42f7('0x43'));this['setDataValue']('encryption',_0x42f7('0x32'));this['setDataValue'](_0x42f7('0x45'),'yes');this[_0x42f7('0x6')]('force_avp',_0x42f7('0x32'));this[_0x42f7('0x6')](_0x42f7('0x47'),_0x42f7('0x32'));this[_0x42f7('0x6')](_0x42f7('0x48'),_0x42f7('0x32'));this['setDataValue'](_0x42f7('0x49'),'no');this[_0x42f7('0x6')](_0x42f7('0x4a'),_0x42f7('0x3f'));this['setDataValue'](_0x42f7('0x4b'),_0x3affa4[_0x42f7('0x4b')]||_0x42f7('0x4d'));this['setDataValue'](_0x42f7('0x4e'),_0x3affa4[_0x42f7('0x4e')]||_0x42f7('0x4f'));this['setDataValue'](_0x42f7('0x4c'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0x42f7('0x41')],'set':function(_0x390f27){this[_0x42f7('0x6')](_0x42f7('0x50'),_0x390f27?_0x390f27[_0x42f7('0x22')](','):[]);},'get':function(){return this[_0x42f7('0x13')](_0x42f7('0x50'))?_[_0x42f7('0x51')](this[_0x42f7('0x13')]('permissions')['split'](','),function(_0x42259e){return parseInt(_0x42259e,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x42f7('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0x42f7('0x4')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x42f7('0x14')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x42f7('0x14')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x42f7('0x14')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x42f7('0x16')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0x42f7('0x32'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x42f7('0x14')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x42f7('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0x42f7('0x14')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x42f7('0x14')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x42f7('0x52')],'get':function(){return this[_0x42f7('0x13')](_0x42f7('0x53'))?this['getDataValue'](_0x42f7('0x53')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x42f7('0x14')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x42f7('0x14')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x42f7('0x14')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x42f7('0x14')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x42f7('0x14')],'defaultValue':![],'set':function(_0x28643d){if(typeof _0x28643d===_0x42f7('0x54')){var _0x53d029=_0x28643d==='1'?!![]:_0x28643d==='0'?![]:_0x28643d===_0x42f7('0x55')?!![]:_0x28643d===_0x42f7('0x56')?![]:![];this[_0x42f7('0x6')](_0x42f7('0x57'),_0x53d029);}else{this[_0x42f7('0x6')](_0x42f7('0x57'),_0x28643d);}}},'blocked':{'type':Sequelize[_0x42f7('0x14')],'defaultValue':![],'set':function(_0x3e3b1e){this[_0x42f7('0x6')]('blocked',_0x3e3b1e);if(_0x3e3b1e===!![]){this[_0x42f7('0x6')]('blockedAt',moment());this[_0x42f7('0x6')](_0x42f7('0x58'),0x0);}else{this[_0x42f7('0x6')](_0x42f7('0x59'),null);}}},'blockedAt':{'type':Sequelize[_0x42f7('0x15')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x42f7('0x16')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x42f7('0x14')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x42f7('0x14')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x42f7('0x16')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x42f7('0x14')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x42f7('0x14')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x42f7('0x14')],'defaultValue':!![]}}; \ No newline at end of file +var _0xa6ce=['blockedAt','loginAttempts','sequelize','util','lodash','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','admin','user','agent','INTEGER','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','ENUM','friend','peer','ALLOWED_NOT_SCREENED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','yes','nonat','update','force_rport,comedia','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','uac','uas','fingerprint','active','passive','actpass','TEXT','showWebBar','get','isArray','wss','encryption','avpf','force_avp','dtlsverify','dtlssetup','dtlscertfile','rtcp_mux','icesupport','dtlsenable','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked'];(function(_0x5440d3,_0x68412d){var _0x49b20a=function(_0x328c52){while(--_0x328c52){_0x5440d3['push'](_0x5440d3['shift']());}};_0x49b20a(++_0x68412d);}(_0xa6ce,0x15e));var _0xea6c=function(_0x999b85,_0x1edc2b){_0x999b85=_0x999b85-0x0;var _0x1d7124=_0xa6ce[_0x999b85];return _0x1d7124;};'use strict';var Sequelize=require(_0xea6c('0x0'));var moment=require('moment');var util=require(_0xea6c('0x1'));var _=require(_0xea6c('0x2'));module['exports']={'name':{'type':Sequelize[_0xea6c('0x3')],'allowNull':![],'unique':_0xea6c('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x4c45ad){this['setDataValue'](_0xea6c('0x4'),_0x4c45ad);this[_0xea6c('0x5')](_0xea6c('0x6'),_0x4c45ad);},'comment':_0xea6c('0x7')},'fullname':{'type':Sequelize[_0xea6c('0x3')],'allowNull':![],'set':function(_0x8a751f){this['setDataValue'](_0xea6c('0x8'),_0x8a751f);this[_0xea6c('0x5')](_0xea6c('0x9'),util[_0xea6c('0xa')](_0xea6c('0xb'),_0x8a751f,this[_0xea6c('0xc')](_0xea6c('0xd'))));}},'alias':{'type':Sequelize[_0xea6c('0x3')]},'email':{'type':Sequelize[_0xea6c('0x3')],'allowNull':![],'unique':_0xea6c('0xe'),'validate':{'isEmail':!![]},'set':function(_0x2def55){if(_0x2def55){this[_0xea6c('0x5')](_0xea6c('0xe'),_0x2def55[_0xea6c('0xf')]());}}},'role':{'type':Sequelize['ENUM'](_0xea6c('0x10'),_0xea6c('0x11'),_0xea6c('0x12'),'telephone'),'allowNull':![]},'password':{'type':Sequelize[_0xea6c('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xea6c('0x3')],'defaultValue':'local'},'internal':{'type':Sequelize[_0xea6c('0x13')](0xb),'allowNull':![],'unique':_0xea6c('0xd'),'set':function(_0x13fd94){this[_0xea6c('0x5')](_0xea6c('0xd'),_0x13fd94);this[_0xea6c('0x5')]('accountcode',_0x13fd94);this[_0xea6c('0x5')]('callerid',util[_0xea6c('0xa')](_0xea6c('0xb'),this[_0xea6c('0xc')](_0xea6c('0x8')),_0x13fd94));}},'salt':{'type':Sequelize[_0xea6c('0x3')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0xea6c('0x3')]},'address':{'type':Sequelize[_0xea6c('0x3')]},'zipcode':{'type':Sequelize[_0xea6c('0x3')]},'userpic':{'type':Sequelize[_0xea6c('0x3')]},'city':{'type':Sequelize[_0xea6c('0x3')]},'country':{'type':Sequelize[_0xea6c('0x3')]},'online':{'type':Sequelize[_0xea6c('0x14')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xea6c('0x15')]},'voicePause':{'type':Sequelize[_0xea6c('0x14')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xea6c('0x14')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xea6c('0x14')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xea6c('0x14')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xea6c('0x3')],'defaultValue':_0xea6c('0x16')},'lastPauseAt':{'type':Sequelize[_0xea6c('0x15')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xea6c('0x13')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xea6c('0x13')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xea6c('0x13')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xea6c('0x13')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xea6c('0x13')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xea6c('0x14')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xea6c('0x13')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xea6c('0x14')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xea6c('0x14')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xea6c('0x17')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0xea6c('0x13')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xea6c('0x13')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xea6c('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xea6c('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xea6c('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xea6c('0x13')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xea6c('0x18')](_0xea6c('0x19'),_0xea6c('0x11'),_0xea6c('0x1a')),'allowNull':!![],'defaultValue':_0xea6c('0x19')},'context':{'type':Sequelize[_0xea6c('0x3')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0xea6c('0x18')](_0xea6c('0x1b'),'ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED',_0xea6c('0x1c'),_0xea6c('0x1d'),_0xea6c('0x1e'),_0xea6c('0x1f')),'allowNull':!![]},'deny':{'type':Sequelize[_0xea6c('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0xea6c('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0xea6c('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xea6c('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xea6c('0x3')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xea6c('0x20'),'set':function(_0xf7b677){this[_0xea6c('0x5')](_0xea6c('0x21'),_0xf7b677?_0xf7b677[_0xea6c('0x22')](','):null);},'get':function(){return this[_0xea6c('0xc')]('transport')?this[_0xea6c('0xc')](_0xea6c('0x21'))['split'](','):null;},'comment':_0xea6c('0x23')},'dtmfmode':{'type':Sequelize[_0xea6c('0x18')](_0xea6c('0x24'),'info','shortinfo','inband','auto'),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xea6c('0x18')](_0xea6c('0x25'),'no',_0xea6c('0x26'),_0xea6c('0x27'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xea6c('0x18')](_0xea6c('0x25'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xea6c('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0xea6c('0x3')],'allowNull':!![],'defaultValue':_0xea6c('0x28'),'set':function(_0x4dcbc1){this[_0xea6c('0x5')](_0xea6c('0x29'),_0x4dcbc1?_0x4dcbc1[_0xea6c('0x22')](','):null);},'get':function(){return this[_0xea6c('0xc')](_0xea6c('0x29'))?this[_0xea6c('0xc')](_0xea6c('0x29'))[_0xea6c('0x2a')](','):null;},'comment':_0xea6c('0x2b')},'callgroup':{'type':Sequelize[_0xea6c('0x3')]},'namedcallgroup':{'type':Sequelize[_0xea6c('0x3')]},'pickupgroup':{'type':Sequelize[_0xea6c('0x3')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xea6c('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0xea6c('0x3')],'allowNull':![],'defaultValue':_0xea6c('0x2c')},'allow':{'type':Sequelize[_0xea6c('0x3')],'allowNull':![],'defaultValue':_0xea6c('0x2d'),'set':function(_0x2804ed){this['setDataValue'](_0xea6c('0x2e'),_0x2804ed?_0x2804ed[_0xea6c('0x22')](';'):_0xea6c('0x2d'));},'get':function(){return this['getDataValue']('allow')?this[_0xea6c('0xc')]('allow')[_0xea6c('0x2a')](';'):null;},'comment':_0xea6c('0x2f')},'autoframing':{'type':Sequelize[_0xea6c('0x18')](_0xea6c('0x25'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x7440eb){this[_0xea6c('0x5')](_0xea6c('0x30'),_0x7440eb?_0x7440eb['join'](','):null);},'get':function(){return this[_0xea6c('0xc')]('insecure')?this[_0xea6c('0xc')](_0xea6c('0x30'))['split'](','):null;},'comment':_0xea6c('0x31')},'trustrpid':{'type':Sequelize[_0xea6c('0x18')](_0xea6c('0x25'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xea6c('0x18')](_0xea6c('0x25'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xea6c('0x18')]('yes','no',_0xea6c('0x32')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xea6c('0x18')](_0xea6c('0x25'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xea6c('0x18')](_0xea6c('0x25'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xea6c('0x13')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xea6c('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xea6c('0x3')],'allowNull':!![],'defaultValue':_0xea6c('0x33')},'amaflags':{'type':Sequelize[_0xea6c('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xea6c('0x18')](_0xea6c('0x25'),'no'),'allowNull':!![],'defaultValue':_0xea6c('0x25')},'busylevel':{'type':Sequelize[_0xea6c('0x13')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0xea6c('0x25'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xea6c('0x18')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0xea6c('0x25'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xea6c('0x18')](_0xea6c('0x25'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xea6c('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0xea6c('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xea6c('0x18')](_0xea6c('0x25'),'no',_0xea6c('0x34')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xea6c('0x13')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xea6c('0x18')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xea6c('0x18')](_0xea6c('0x35'),_0xea6c('0x36'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xea6c('0x13')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xea6c('0x18')](_0xea6c('0x37'),_0xea6c('0x38')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0xea6c('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xea6c('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xea6c('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xea6c('0x18')](_0xea6c('0x25'),'no'),'allowNull':!![],'defaultValue':_0xea6c('0x25')},'keepalive':{'type':Sequelize[_0xea6c('0x13')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xea6c('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xea6c('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xea6c('0x13')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xea6c('0x13')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xea6c('0x13')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xea6c('0x18')](_0xea6c('0x25'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xea6c('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xea6c('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xea6c('0x13')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xea6c('0x13')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xea6c('0x13')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xea6c('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xea6c('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xea6c('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xea6c('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xea6c('0x13')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xea6c('0x18')](_0xea6c('0x25'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xea6c('0x18')](_0xea6c('0x25'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0xea6c('0x25'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xea6c('0x18')](_0xea6c('0x25'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xea6c('0x18')](_0xea6c('0x25'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xea6c('0x18')]('yes','no',_0xea6c('0x39'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xea6c('0x13')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xea6c('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xea6c('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xea6c('0x18')](_0xea6c('0x3a'),_0xea6c('0x3b'),_0xea6c('0x3c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xea6c('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xea6c('0x18')](_0xea6c('0x25'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xea6c('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0xea6c('0x25'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xea6c('0x18')](_0xea6c('0x25'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xea6c('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xea6c('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xea6c('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xea6c('0x18')](_0xea6c('0x25'),'no',_0xea6c('0x26'),_0xea6c('0x27'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xea6c('0x14')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xea6c('0x3')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xea6c('0x3d')]},'showWebBar':{'type':Sequelize[_0xea6c('0x13')],'defaultValue':0x0,'set':function(_0x677b50){this[_0xea6c('0x5')](_0xea6c('0x3e'),_0x677b50);var _0x46079e=this[_0xea6c('0x3f')]({'plain':!![]});switch(_0x677b50){case 0x0:case 0x1:var _0xb93247=_0x46079e[_0xea6c('0x21')]?_[_0xea6c('0x40')](_0x46079e[_0xea6c('0x21')])?_0x46079e[_0xea6c('0x21')][_0xea6c('0x22')]():_0x46079e[_0xea6c('0x21')]:'udp';if(_0xb93247===_0xea6c('0x41')){_0xb93247=_0xea6c('0x20');}this['setDataValue'](_0xea6c('0x21'),_0xb93247);this['setDataValue'](_0xea6c('0x42'),'no');this['setDataValue'](_0xea6c('0x43'),null);this['setDataValue'](_0xea6c('0x44'),null);this[_0xea6c('0x5')]('icesupport',null);this[_0xea6c('0x5')]('dtlsenable',null);this[_0xea6c('0x5')](_0xea6c('0x45'),null);this['setDataValue'](_0xea6c('0x46'),null);this[_0xea6c('0x5')](_0xea6c('0x47'),null);this[_0xea6c('0x5')]('dtlsprivatekey',null);this[_0xea6c('0x5')](_0xea6c('0x48'),'no');break;case 0x2:this[_0xea6c('0x5')](_0xea6c('0x21'),_0xea6c('0x41'));this['setDataValue'](_0xea6c('0x42'),_0xea6c('0x25'));this[_0xea6c('0x5')](_0xea6c('0x43'),_0xea6c('0x25'));this[_0xea6c('0x5')]('force_avp',_0xea6c('0x25'));this[_0xea6c('0x5')](_0xea6c('0x49'),_0xea6c('0x25'));this[_0xea6c('0x5')](_0xea6c('0x4a'),'yes');this['setDataValue'](_0xea6c('0x45'),'no');this[_0xea6c('0x5')](_0xea6c('0x46'),_0xea6c('0x3c'));this[_0xea6c('0x5')](_0xea6c('0x47'),_0x46079e['dtlscertfile']||_0xea6c('0x4b'));this[_0xea6c('0x5')](_0xea6c('0x4c'),_0x46079e[_0xea6c('0x4c')]||_0xea6c('0x4d'));this['setDataValue'](_0xea6c('0x48'),'yes');break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x1e9655){this[_0xea6c('0x5')]('permissions',_0x1e9655?_0x1e9655['join'](','):[]);},'get':function(){return this[_0xea6c('0xc')]('permissions')?_[_0xea6c('0x4e')](this[_0xea6c('0xc')]('permissions')[_0xea6c('0x2a')](','),function(_0x2c16f8){return parseInt(_0x2c16f8,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xea6c('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0xea6c('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0xea6c('0x14')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xea6c('0x14')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xea6c('0x14')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xea6c('0x14')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xea6c('0x14')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xea6c('0x13')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xea6c('0x18')](_0xea6c('0x25'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xea6c('0x14')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xea6c('0x3')]},'phoneBarEnableJaws':{'type':Sequelize[_0xea6c('0x14')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xea6c('0x14')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xea6c('0x4f')],'get':function(){return this['getDataValue'](_0xea6c('0x50'))?this[_0xea6c('0xc')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xea6c('0x14')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0xea6c('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xea6c('0x14')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xea6c('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xea6c('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xea6c('0x14')],'defaultValue':![],'set':function(_0x18002c){if(typeof _0x18002c==='string'){var _0x2a755a=_0x18002c==='1'?!![]:_0x18002c==='0'?![]:_0x18002c===_0xea6c('0x51')?!![]:_0x18002c===_0xea6c('0x52')?![]:![];this[_0xea6c('0x5')](_0xea6c('0x53'),_0x2a755a);}else{this[_0xea6c('0x5')](_0xea6c('0x53'),_0x18002c);}}},'blocked':{'type':Sequelize[_0xea6c('0x14')],'defaultValue':![],'set':function(_0x373656){this[_0xea6c('0x5')](_0xea6c('0x54'),_0x373656);if(_0x373656===!![]){this[_0xea6c('0x5')](_0xea6c('0x55'),moment());this['setDataValue'](_0xea6c('0x56'),0x0);}else{this[_0xea6c('0x5')](_0xea6c('0x55'),null);}}},'blockedAt':{'type':Sequelize[_0xea6c('0x15')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xea6c('0x14')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xea6c('0x14')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xea6c('0x13')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xea6c('0x14')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xea6c('0x14')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index de8f497..9c72b25 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 _0xd0e4=['CmHopper','firstName','lastName','CmContact','Contact','dialActive','getApiKey','retrieveApiKey','token','generateApiKey','iat','nonce','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','removeApiKey','apiKeyNonce','apiKeyIat','Unable\x20to\x20retrieve\x20the\x20current\x20user','getPresence','resolve','teams','queues','VoiceQueue','inbound','flatten','getAgents','lower','toString','asc','desc','substring','orderBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','idle','unknown','unavailable','ringing','voiceStatus','busy','slice','charAt','toUpperCase','SELECT','field','ui.','InteractionId','_interactions','OpenTabs','moment','bluebird','util','path','jayson/promise','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/license/util','../../mysqldb','redis','./user.socket','defaults','localhost','client','http','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','end','status','json','offset','undefined','limit','count','update','destroy','get','role','admin','Users','user','agent','Telephones','telephone','ignore','map','value','includes','UserProfileResource','sendStatus','stack','name','index','User','fieldName','key','filter','salt','getOptions','where','query','includeAll','include','attributes','push','openTabs','true','length','chat','rows','dataValues','sms','fax','mail','whatsapp','all','params','differenceBy','keys','rawAttributes','password','filters','intersection','model','fields','options','find','openchannel','body','describe','addContacts','ids','omit','internal','Setting','findById','securePassword','validatePasswordPattern','max','isNil','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','from','voicemail','mailbox','fullname','permissions','101','102','103','113','110','104','105','106','107','108','100','111','114','create','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','checkUserLimits','settingsEnabled','userProfileId','VoiceMail','Agents','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','each','UserProfileSection','findAll','isEmpty','compact','changePassword','oldPassword','newPassword','Sequelize','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','ValidationError','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','updatePasswordsHistory','addQueues','channel','online','loginInPause','voicePause','interface','add','capitalize','Queues','penalty','spread','QueueId','Queue:save','voice','UserVoiceQueueRt','upsert','isValidChannel','Unknown\x20channel','isArray','toLowerCase','emit','Queue:remove','userpic','file','filename','getAvatar','join','server/files/images/logos/default_profile.png','download','existsSync','server/files/images/','root','getOpenTabs','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','getContacts','sort','pick','merge','hasOwnProperty','CmList','List','Tag','Tags','color','tag','nolimit','getQueues','Queue','order','Unknown\x20role','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','VoiceRecording','UserId','ScreenRecording','ChatInteraction','getChatInteractions','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','login','phone','mobile','format','LOCAL/%s@from-sip/n','SIP/%s','user:%s','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','socket','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','PAUSE','LOGININPAUSE','concat','logout','pause','QueuePause','updateAttributes','type','DEFAULT\x20PAUSE','unpause','mailPause','faxPause','smsPause','pauseType','lastPauseAt','manual','set','%s%s','Pause','Team','getTeams','addTeams','setDataValue','Voice','Chat','Mail','getSmsQueues','Sms','getWhatsappQueues','getFaxQueues','Fax','Openchannel','transaction','addAgent','getDataValue','removeTeams','getChatQueues','getMailQueues','Whatsapp','getOpenchannelQueues','removeAgent','getLists','values','send','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','SmsAccount','getSmsAccounts','addSmsAccounts','removeSmsAccounts','ChatWebsite','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','addSquareProjects','removeSquareProjects','getScheduledCalls','$and','$or','$gt','$gte','$lt','$ne','$eq','$not','$between','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any'];(function(_0x3e29a4,_0x3503b3){var _0x135be5=function(_0x4c2a85){while(--_0x4c2a85){_0x3e29a4['push'](_0x3e29a4['shift']());}};_0x135be5(++_0x3503b3);}(_0xd0e4,0x1d3));var _0x4d0e=function(_0x4a528c,_0x53cdc1){_0x4a528c=_0x4a528c-0x0;var _0xa16b98=_0xd0e4[_0x4a528c];return _0xa16b98;};'use strict';var moment=require(_0x4d0e('0x0'));var BPromise=require(_0x4d0e('0x1'));var util=require(_0x4d0e('0x2'));var path=require(_0x4d0e('0x3'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var jayson=require(_0x4d0e('0x4'));var Redis=require(_0x4d0e('0x5'));var authService=require(_0x4d0e('0x6'));var qs=require(_0x4d0e('0x7'));var logger=require(_0x4d0e('0x8'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4d0e('0x9'));var db=require(_0x4d0e('0xa'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0x4d0e('0xb')]));require(_0x4d0e('0xc'))['register'](socket);config['redis']=_[_0x4d0e('0xd')](config['redis'],{'host':_0x4d0e('0xe'),'port':0x18eb});var client=jayson[_0x4d0e('0xf')][_0x4d0e('0x10')]({'port':0x232a});var values;function respondWithRpcPromise(_0x50373d,_0x1755c9,_0x2e0d93,_0x585fc1){return new BPromise(function(_0x49ce6a,_0x3a8b51){var _0x345df2=_0x585fc1||client;return _0x345df2[_0x4d0e('0x11')](_0x50373d,_0x2e0d93)[_0x4d0e('0x12')](function(_0x43594b){logger[_0x4d0e('0x13')](_0x4d0e('0x14'),_0x1755c9,_0x4d0e('0x15'));logger[_0x4d0e('0x16')]('User,\x20%s,\x20%s,\x20%s',_0x1755c9,_0x4d0e('0x15'),JSON[_0x4d0e('0x17')](_0x43594b));if(_0x43594b[_0x4d0e('0x18')]){if(_0x43594b['error'][_0x4d0e('0x19')]===0x1f4){logger['error'](_0x4d0e('0x14'),_0x1755c9,_0x43594b[_0x4d0e('0x18')][_0x4d0e('0x1a')]);return _0x3a8b51(_0x43594b[_0x4d0e('0x18')][_0x4d0e('0x1a')]);}logger[_0x4d0e('0x18')](_0x4d0e('0x14'),_0x1755c9,_0x43594b['error'][_0x4d0e('0x1a')]);return _0x49ce6a(_0x43594b[_0x4d0e('0x18')][_0x4d0e('0x1a')]);}else{logger['info'](_0x4d0e('0x14'),_0x1755c9,_0x4d0e('0x15'));_0x49ce6a(_0x43594b[_0x4d0e('0x1b')][_0x4d0e('0x1a')]);}})[_0x4d0e('0x1c')](function(_0x970861){logger[_0x4d0e('0x18')](_0x4d0e('0x14'),_0x1755c9,_0x970861);_0x3a8b51(_0x970861);});});}function respondWithStatusCode(_0x40c2f8,_0x240a4c){_0x240a4c=_0x240a4c||0xcc;return function(_0x40f326){if(_0x40f326){return _0x40c2f8['sendStatus'](_0x240a4c);}return _0x40c2f8['status'](_0x240a4c)[_0x4d0e('0x1d')]();};}function respondWithResult(_0x1a1a3d,_0x52dc71){_0x52dc71=_0x52dc71||0xc8;return function(_0x5ac296){if(_0x5ac296){return _0x1a1a3d[_0x4d0e('0x1e')](_0x52dc71)[_0x4d0e('0x1f')](_0x5ac296);}};}function respondWithFilteredResult(_0x3092e1,_0x13e74f){return function(_0x370aab){if(_0x370aab){var _0x1f6997=typeof _0x13e74f[_0x4d0e('0x20')]===_0x4d0e('0x21')&&typeof _0x13e74f[_0x4d0e('0x22')]==='undefined';var _0x35f58a=_0x370aab[_0x4d0e('0x23')];var _0x1a237f=_0x1f6997?0x0:_0x13e74f[_0x4d0e('0x20')];var _0x25043b=_0x1f6997?_0x370aab['count']:_0x13e74f[_0x4d0e('0x20')]+_0x13e74f[_0x4d0e('0x22')];var _0x493a65;if(_0x25043b>=_0x35f58a){_0x25043b=_0x35f58a;_0x493a65=0xc8;}else{_0x493a65=0xce;}_0x3092e1[_0x4d0e('0x1e')](_0x493a65);return _0x3092e1['set']('Content-Range',_0x1a237f+'-'+_0x25043b+'/'+_0x35f58a)[_0x4d0e('0x1f')](_0x370aab);}return null;};}function saveUpdates(_0x1073c6){return function(_0x427582){if(_0x427582){return _0x427582[_0x4d0e('0x24')](_0x1073c6)[_0x4d0e('0x12')](function(_0x7e551d){return _0x7e551d;});}return null;};}function removeEntity(_0x39cdb8){return function(_0x4f876a){if(_0x4f876a){return _0x4f876a[_0x4d0e('0x25')]()['then'](function(){var _0x487249=_0x4f876a[_0x4d0e('0x26')]({'plain':!![]});if(_0x487249[_0x4d0e('0x27')]===_0x4d0e('0x28'))return;var _0x3311c3=[{'name':_0x4d0e('0x29'),'value':_0x4d0e('0x2a'),'ignore':!![]},{'name':'Agents','value':_0x4d0e('0x2b'),'ignore':![]},{'name':_0x4d0e('0x2c'),'value':_0x4d0e('0x2d'),'ignore':![]}];var _0xff86c=_(_0x3311c3)['filter'](_0x4d0e('0x2e'))[_0x4d0e('0x2f')](_0x4d0e('0x30'))[_0x4d0e('0x30')]();if(_[_0x4d0e('0x31')](_0xff86c,_0x487249[_0x4d0e('0x27')])){return;}var _0x15c89b=_['find'](_0x3311c3,[_0x4d0e('0x30'),_0x487249[_0x4d0e('0x27')]])['name'];return db[_0x4d0e('0x32')][_0x4d0e('0x25')]({'where':{'type':_0x15c89b,'resourceId':_0x487249['id']}})[_0x4d0e('0x12')](function(){return _0x4f876a;});})[_0x4d0e('0x12')](function(){_0x39cdb8[_0x4d0e('0x1e')](0xcc)[_0x4d0e('0x1d')]();});}};}function handleEntityNotFound(_0x40ece3){return function(_0x3caa66){if(!_0x3caa66){_0x40ece3[_0x4d0e('0x33')](0x194);}return _0x3caa66;};}function handleError(_0x122d7f,_0x74305e){_0x74305e=_0x74305e||0x1f4;return function(_0x1cbcc7){logger[_0x4d0e('0x18')](_0x1cbcc7[_0x4d0e('0x34')]);if(_0x1cbcc7[_0x4d0e('0x35')]){delete _0x1cbcc7[_0x4d0e('0x35')];}_0x122d7f['status'](_0x74305e)['send'](_0x1cbcc7);};}exports[_0x4d0e('0x36')]=function(_0x2faaaf,_0xd21bfe){var _0x19774a={},_0x2c5b83={'count':0x0,'rows':[]};var _0x2cd14b=_(db[_0x4d0e('0x37')]['rawAttributes'])[_0x4d0e('0x2f')](function(_0x1fe040){return{'name':_0x1fe040[_0x4d0e('0x38')],'type':_0x1fe040['type'][_0x4d0e('0x39')]};})[_0x4d0e('0x3a')](function(_0x4a576b){return!_[_0x4d0e('0x31')](['password',_0x4d0e('0x3b')],_0x4a576b['name']);})[_0x4d0e('0x30')]();_0x19774a=qs[_0x4d0e('0x3c')](_0x2cd14b,_0x2faaaf);var _0x4fdfe0={'where':_0x19774a[_0x4d0e('0x3d')]};return db[_0x4d0e('0x37')][_0x4d0e('0x23')](_0x4fdfe0)['then'](function(_0x43819b){_0x2c5b83['count']=_0x43819b;if(_0x2faaaf[_0x4d0e('0x3e')][_0x4d0e('0x3f')]){_0x19774a[_0x4d0e('0x40')]=[{'all':!![]}];}if(!_['includes'](_0x19774a['attributes'],'id')){_0x19774a[_0x4d0e('0x41')][_0x4d0e('0x42')]('id');}return db[_0x4d0e('0x37')]['findAll'](_0x19774a);})[_0x4d0e('0x12')](function(_0x1a7b57){_0x2c5b83['rows']=_0x1a7b57;if(_0x2faaaf[_0x4d0e('0x3e')][_0x4d0e('0x43')]===_0x4d0e('0x44')){var _0x4ecb8f=[];for(var _0x36f453=0x0;_0x36f453<_0x2c5b83['rows'][_0x4d0e('0x45')];_0x36f453++){_0x4ecb8f['push'](get_open_tabs(_0x4d0e('0x46'),_0x2c5b83[_0x4d0e('0x47')][_0x36f453][_0x4d0e('0x48')]));_0x4ecb8f[_0x4d0e('0x42')](get_open_tabs(_0x4d0e('0x49'),_0x2c5b83[_0x4d0e('0x47')][_0x36f453][_0x4d0e('0x48')]));_0x4ecb8f[_0x4d0e('0x42')](get_open_tabs(_0x4d0e('0x4a'),_0x2c5b83[_0x4d0e('0x47')][_0x36f453][_0x4d0e('0x48')]));_0x4ecb8f[_0x4d0e('0x42')](get_open_tabs(_0x4d0e('0x4b'),_0x2c5b83[_0x4d0e('0x47')][_0x36f453][_0x4d0e('0x48')]));_0x4ecb8f['push'](get_open_tabs('openchannel',_0x2c5b83[_0x4d0e('0x47')][_0x36f453][_0x4d0e('0x48')]));_0x4ecb8f[_0x4d0e('0x42')](get_open_tabs(_0x4d0e('0x4c'),_0x2c5b83[_0x4d0e('0x47')][_0x36f453][_0x4d0e('0x48')]));}return BPromise[_0x4d0e('0x4d')](_0x4ecb8f)[_0x4d0e('0x12')](function(_0x2a8bd9){return _0x2c5b83;});}else{return _0x2c5b83;}})[_0x4d0e('0x12')](respondWithFilteredResult(_0xd21bfe,_0x19774a))[_0x4d0e('0x1c')](handleError(_0xd21bfe,null));};exports['show']=function(_0x28c5ba,_0x18da15){var _0x3a7ccb={'raw':![],'where':{'id':_0x28c5ba[_0x4d0e('0x4e')]['id']}},_0x1521bf={};_0x1521bf['model']=_[_0x4d0e('0x4f')](_[_0x4d0e('0x50')](db[_0x4d0e('0x37')][_0x4d0e('0x51')]),[_0x4d0e('0x52'),_0x4d0e('0x3b')]);_0x1521bf['query']=_[_0x4d0e('0x50')](_0x28c5ba['query']);_0x1521bf[_0x4d0e('0x53')]=_[_0x4d0e('0x54')](_0x1521bf[_0x4d0e('0x55')],_0x1521bf[_0x4d0e('0x3e')]);_0x3a7ccb['attributes']=_[_0x4d0e('0x54')](_0x1521bf[_0x4d0e('0x55')],qs[_0x4d0e('0x56')](_0x28c5ba[_0x4d0e('0x3e')][_0x4d0e('0x56')]));_0x3a7ccb[_0x4d0e('0x41')]=_0x3a7ccb['attributes'][_0x4d0e('0x45')]?_0x3a7ccb[_0x4d0e('0x41')]:_0x1521bf[_0x4d0e('0x55')];if(_0x28c5ba['query'][_0x4d0e('0x3f')]){_0x3a7ccb[_0x4d0e('0x40')]=[{'all':!![]}];}_0x3a7ccb=_['merge']({},_0x3a7ccb,_0x28c5ba[_0x4d0e('0x57')]);if(!_[_0x4d0e('0x31')](_0x3a7ccb[_0x4d0e('0x41')],'id')){_0x3a7ccb[_0x4d0e('0x41')][_0x4d0e('0x42')]('id');}return db[_0x4d0e('0x37')][_0x4d0e('0x58')](_0x3a7ccb)['then'](handleEntityNotFound(_0x18da15,null))[_0x4d0e('0x12')](function(_0x136bc){var _0x4b9839=[];values=_0x136bc;if(_0x28c5ba['query'][_0x4d0e('0x43')]==='true'){_0x4b9839['push'](get_open_tabs('chat',_0x136bc[_0x4d0e('0x48')]));_0x4b9839[_0x4d0e('0x42')](get_open_tabs('sms',_0x136bc[_0x4d0e('0x48')]));_0x4b9839[_0x4d0e('0x42')](get_open_tabs(_0x4d0e('0x59'),_0x136bc[_0x4d0e('0x48')]));_0x4b9839['push'](get_open_tabs('whatsapp',_0x136bc[_0x4d0e('0x48')]));_0x4b9839[_0x4d0e('0x42')](get_open_tabs(_0x4d0e('0x4a'),_0x136bc[_0x4d0e('0x48')]));_0x4b9839[_0x4d0e('0x42')](get_open_tabs(_0x4d0e('0x4b'),_0x136bc[_0x4d0e('0x48')]));return BPromise[_0x4d0e('0x4d')](_0x4b9839);}else{return values;}})[_0x4d0e('0x12')](function(_0x2e26c9){return values;})[_0x4d0e('0x12')](respondWithResult(_0x18da15,null))[_0x4d0e('0x1c')](handleError(_0x18da15,null));};exports[_0x4d0e('0x24')]=function(_0x25e67e,_0x74b346){if(_0x25e67e[_0x4d0e('0x5a')]['id']){delete _0x25e67e[_0x4d0e('0x5a')]['id'];}delete _0x25e67e[_0x4d0e('0x5a')][_0x4d0e('0x27')];return db['User'][_0x4d0e('0x58')]({'where':{'id':_0x25e67e[_0x4d0e('0x4e')]['id']}})[_0x4d0e('0x12')](handleEntityNotFound(_0x74b346,null))[_0x4d0e('0x12')](saveUpdates(_0x25e67e[_0x4d0e('0x5a')],null))[_0x4d0e('0x12')](respondWithResult(_0x74b346,null))['catch'](handleError(_0x74b346,null));};exports['describe']=function(_0x2dace8,_0x43efc8){return db[_0x4d0e('0x37')][_0x4d0e('0x5b')]()['then'](respondWithResult(_0x43efc8,null))[_0x4d0e('0x1c')](handleError(_0x43efc8,null));};exports[_0x4d0e('0x5c')]=function(_0x1789ad,_0x14f8b1){return db[_0x4d0e('0x37')][_0x4d0e('0x58')]({'where':{'id':_0x1789ad[_0x4d0e('0x4e')]['id']}})[_0x4d0e('0x12')](handleEntityNotFound(_0x14f8b1,null))['then'](function(_0x4aae9e){if(_0x4aae9e){return _0x4aae9e[_0x4d0e('0x5c')](_0x1789ad[_0x4d0e('0x5a')][_0x4d0e('0x5d')],_[_0x4d0e('0x5e')](_0x1789ad[_0x4d0e('0x5a')],['ids','id'])||{});}})[_0x4d0e('0x12')](respondWithResult(_0x14f8b1,null))[_0x4d0e('0x1c')](handleError(_0x14f8b1,null));};function validateUser(_0x34ea7c){return new BPromise(function(_0x3a06bd,_0x108e0d){if(_0x34ea7c[_0x4d0e('0x5f')])return _0x3a06bd(_0x34ea7c);return db[_0x4d0e('0x60')][_0x4d0e('0x61')](0x1)[_0x4d0e('0x12')](function(_0x68dc3c){if(_0x68dc3c[_0x4d0e('0x62')])authService[_0x4d0e('0x63')](_0x34ea7c[_0x4d0e('0x52')]);db[_0x4d0e('0x37')][_0x4d0e('0x64')](_0x4d0e('0x5f'))[_0x4d0e('0x12')](function(_0x32b920){if(_[_0x4d0e('0x65')](_0x32b920)){_0x34ea7c[_0x4d0e('0x5f')]=_0x68dc3c['min_internal']||0x1;return;}if(_[_0x4d0e('0x65')](_0x68dc3c[_0x4d0e('0x66')])||_0x68dc3c[_0x4d0e('0x66')]===_0x32b920){_0x34ea7c[_0x4d0e('0x5f')]=_0x32b920+0x1;return;}if(_0x68dc3c['min_internal']>_0x32b920){_0x34ea7c[_0x4d0e('0x5f')]=_0x68dc3c[_0x4d0e('0x66')];return;}return db[_0x4d0e('0x67')][_0x4d0e('0x3e')](_0x4d0e('0x68'),{'type':db['sequelize'][_0x4d0e('0x69')]['SELECT']})[_0x4d0e('0x12')](function(_0x16b7d7){if(_0x16b7d7&&_0x16b7d7['length']){for(var _0x45bc03=0x0,_0x48e62f=_0x16b7d7['length'];_0x45bc03<_0x48e62f&&_[_0x4d0e('0x65')](_0x34ea7c[_0x4d0e('0x5f')]);_0x45bc03++){if(_0x68dc3c[_0x4d0e('0x66')]<=_0x16b7d7[_0x45bc03][_0x4d0e('0x6a')]){_0x34ea7c[_0x4d0e('0x5f')]=_0x16b7d7[_0x45bc03][_0x4d0e('0x6a')];}else if(_0x68dc3c[_0x4d0e('0x66')]>_0x16b7d7[_0x45bc03][_0x4d0e('0x6a')]&&_0x68dc3c[_0x4d0e('0x66')]<=_0x16b7d7[_0x45bc03]['to']){_0x34ea7c[_0x4d0e('0x5f')]=_0x68dc3c['min_internal'];}}}if(_[_0x4d0e('0x65')](_0x34ea7c['internal'])){_0x34ea7c[_0x4d0e('0x5f')]=_0x32b920+0x1;}return _0x3a06bd(_0x34ea7c);});});})[_0x4d0e('0x1c')](function(_0xaaeb6a){_0x108e0d(_0xaaeb6a);});});}function updateUser(_0x491698){return new BPromise(function(_0x9502ba,_0x4a58b4){try{if(_0x491698[_0x4d0e('0x6b')]){_0x491698[_0x4d0e('0x6c')]=_0x491698[_0x4d0e('0x5f')];_0x491698['VoiceMail']={'mailbox':_0x491698[_0x4d0e('0x5f')],'password':_0x491698[_0x4d0e('0x52')],'fullname':_0x491698[_0x4d0e('0x6d')],'email':_0x491698['email']};}if(_0x491698[_0x4d0e('0x27')]===_0x4d0e('0x2b')){if(!_0x491698[_0x4d0e('0x6e')])_0x491698[_0x4d0e('0x6e')]=[_0x4d0e('0x6f'),_0x4d0e('0x70'),_0x4d0e('0x71'),_0x4d0e('0x72'),_0x4d0e('0x73'),_0x4d0e('0x74'),_0x4d0e('0x75'),_0x4d0e('0x76'),_0x4d0e('0x77'),_0x4d0e('0x78'),'109',_0x4d0e('0x79'),_0x4d0e('0x7a'),_0x4d0e('0x7b'),'115'];}_0x9502ba(_0x491698);}catch(_0x10017e){_0x4a58b4(_0x10017e);}});}exports[_0x4d0e('0x7c')]=function(_0x45d4b9,_0x5531cd){if(_0x45d4b9[_0x4d0e('0x2a')][_0x4d0e('0x27')]===_0x4d0e('0x2b'))throw new Error(_0x4d0e('0x7d'));if(_0x45d4b9['body'][_0x4d0e('0x27')]===_0x4d0e('0x2a')&&_0x45d4b9[_0x4d0e('0x2a')][_0x4d0e('0x27')]!==_0x4d0e('0x28')){throw new Error(_0x4d0e('0x7e'));}if(_0x45d4b9[_0x4d0e('0x5a')][_0x4d0e('0x27')]==='admin'&&_0x45d4b9['user'][_0x4d0e('0x27')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0x4d0e('0x7f')]([_0x45d4b9['body']])[_0x4d0e('0x12')](function(){return validateUser(_0x45d4b9[_0x4d0e('0x5a')]);})[_0x4d0e('0x12')](function(_0x52242d){return updateUser(_0x52242d)['then'](function(_0x1e16ff){if(_0x1e16ff[_0x4d0e('0x27')]===_0x4d0e('0x28')){_0x1e16ff[_0x4d0e('0x80')]=_0x45d4b9['user']['settingsEnabled'];delete _0x1e16ff[_0x4d0e('0x81')];}return _0x1e16ff;});})[_0x4d0e('0x12')](function(_0x25536f){return db[_0x4d0e('0x37')]['create'](_0x25536f,{'include':[{'model':db[_0x4d0e('0x82')],'as':_0x4d0e('0x82')}]});})[_0x4d0e('0x12')](function(_0x207201){if(_0x45d4b9['body'][_0x4d0e('0x27')]===_0x4d0e('0x2a'))return _0x207201;if(_0x45d4b9[_0x4d0e('0x2a')][_0x4d0e('0x27')]!==_0x4d0e('0x2a'))return _0x207201;return db['UserProfileSection'][_0x4d0e('0x58')]({'where':{'name':_0x207201[_0x4d0e('0x27')]===_0x4d0e('0x2b')?_0x4d0e('0x83'):'Telephones','userProfileId':_0x45d4b9['user'][_0x4d0e('0x81')]},'raw':!![]})['then'](function(_0x34ad3b){if(!_0x34ad3b||_0x34ad3b[_0x4d0e('0x84')]!=0x0)return _0x207201;return db[_0x4d0e('0x32')][_0x4d0e('0x7c')]({'name':_0x207201[_0x4d0e('0x35')],'resourceId':_0x207201['id'],'type':_0x34ad3b[_0x4d0e('0x35')],'sectionId':_0x34ad3b['id']},{})[_0x4d0e('0x12')](function(){return _0x207201;});})['catch'](function(_0x5d58af){logger[_0x4d0e('0x18')](_0x4d0e('0x85'),_0x5d58af);throw _0x5d58af;});})[_0x4d0e('0x12')](respondWithResult(_0x5531cd,0xc9))[_0x4d0e('0x1c')](handleError(_0x5531cd,null));};exports[_0x4d0e('0x86')]=function(_0x52a42d,_0x42b673){var _0x1b46f3=_0x52a42d[_0x4d0e('0x5a')];var _0x114a79=[];if(_0x52a42d['user'][_0x4d0e('0x27')]==='agent')throw new Error(_0x4d0e('0x7d'));if(_[_0x4d0e('0x87')](_0x1b46f3,[_0x4d0e('0x27'),_0x4d0e('0x2a')])&&_0x52a42d[_0x4d0e('0x2a')][_0x4d0e('0x27')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0x4d0e('0x87')](_0x1b46f3,[_0x4d0e('0x27'),_0x4d0e('0x28')])&&_0x52a42d[_0x4d0e('0x2a')][_0x4d0e('0x27')]!==_0x4d0e('0x28')){throw new Error(_0x4d0e('0x88'));}return licenseUtil[_0x4d0e('0x7f')](_0x1b46f3)[_0x4d0e('0x12')](function(){return validateUser(_0x1b46f3[0x0]);})[_0x4d0e('0x12')](function(){for(var _0x4f9da8=0x1;_0x4f9da8<_0x1b46f3[_0x4d0e('0x45')];_0x4f9da8++){var _0x4d482b=_0x1b46f3[_0x4f9da8-0x1][_0x4d0e('0x5f')];if(!_0x1b46f3[_0x4f9da8][_0x4d0e('0x5f')])_0x1b46f3[_0x4f9da8][_0x4d0e('0x5f')]=_0x4d482b+0x1;_0x114a79[_0x4d0e('0x42')](validateUser(_0x1b46f3[_0x4f9da8]));}return BPromise[_0x4d0e('0x4d')](_0x114a79);})[_0x4d0e('0x12')](function(){_0x114a79=[];for(var _0x3f2bf6=0x0;_0x3f2bf6<_0x1b46f3['length'];_0x3f2bf6++){_0x114a79[_0x4d0e('0x42')](updateUser(_0x1b46f3[_0x3f2bf6]));}return BPromise[_0x4d0e('0x4d')](_0x114a79);})[_0x4d0e('0x12')](function(){return BPromise[_0x4d0e('0x89')](_0x1b46f3,function(_0x4906c2){return db[_0x4d0e('0x37')][_0x4d0e('0x7c')](_0x4906c2,{'include':[{'model':db['VoiceMail'],'as':_0x4d0e('0x82')}]})[_0x4d0e('0x12')](function(_0x1837d5){_0x4906c2['id']=_0x1837d5['id'];return _0x4906c2;});});})['then'](function(_0x59f591){if(_0x52a42d[_0x4d0e('0x5a')][_0x4d0e('0x27')]===_0x4d0e('0x2a'))return _0x59f591;if(_0x52a42d[_0x4d0e('0x2a')]['role']!==_0x4d0e('0x2a'))return _0x59f591;var _0xc9537a=_[_0x4d0e('0x87')](_0x59f591,function(_0x3e5792){return _0x3e5792[_0x4d0e('0x27')]===_0x4d0e('0x2b')||_0x3e5792[_0x4d0e('0x27')]===_0x4d0e('0x2d');});if(!_0xc9537a)return _0x59f591;return db[_0x4d0e('0x8a')][_0x4d0e('0x8b')]({'where':{'name':{'$or':['Agents',_0x4d0e('0x2c')]},'userProfileId':_0x52a42d[_0x4d0e('0x2a')][_0x4d0e('0x81')]},'raw':!![]})[_0x4d0e('0x12')](function(_0x490f1c){if(_[_0x4d0e('0x8c')](_0x490f1c)||!_[_0x4d0e('0x87')](_0x490f1c,['autoAssociation',0x0]))return _0x59f591;_0x114a79=[];var _0x329e3b=_(_0x490f1c)[_0x4d0e('0x2f')](function(_0x3f6df7){if(_0x3f6df7['autoAssociation']===0x1)return;return _0x3f6df7[_0x4d0e('0x35')]===_0x4d0e('0x83')?_0x4d0e('0x2b'):'telephone';})[_0x4d0e('0x8d')]()['value']();for(var _0x373e1a=0x0;_0x373e1a<_0x59f591[_0x4d0e('0x45')];_0x373e1a++){if(!_[_0x4d0e('0x31')](_0x329e3b,_0x59f591[_0x373e1a][_0x4d0e('0x27')]))return;var _0x567e47=_0x59f591[_0x373e1a][_0x4d0e('0x27')]===_0x4d0e('0x2b')?_0x4d0e('0x83'):'Telephones';_0x114a79[_0x4d0e('0x42')](db[_0x4d0e('0x32')][_0x4d0e('0x7c')]({'name':_0x59f591[_0x373e1a][_0x4d0e('0x35')],'resourceId':_0x59f591[_0x373e1a]['id'],'type':_0x567e47,'sectionId':_['find'](_0x490f1c,[_0x4d0e('0x35'),_0x567e47])['id']},{}));}return BPromise[_0x4d0e('0x4d')](_0x114a79);});})[_0x4d0e('0x12')](respondWithResult(_0x42b673,0xc9))[_0x4d0e('0x1c')](handleError(_0x42b673,null));};exports[_0x4d0e('0x8e')]=function(_0x4fb73b,_0x528977){if(_0x4fb73b['body']['id']){delete _0x4fb73b['body']['id'];}return db[_0x4d0e('0x37')][_0x4d0e('0x58')]({'where':{'id':_0x4fb73b[_0x4d0e('0x4e')]['id']}})[_0x4d0e('0x12')](function(_0x3b33b9){if(!_0x3b33b9)return null;if(_0x3b33b9['id']===_0x4fb73b[_0x4d0e('0x2a')]['id']){if(!_0x4fb73b[_0x4d0e('0x5a')][_0x4d0e('0x8f')]||!_0x4fb73b[_0x4d0e('0x5a')][_0x4d0e('0x90')]){throw new db[(_0x4d0e('0x91'))]['ValidationError'](_0x4d0e('0x92'));}if(!_0x3b33b9[_0x4d0e('0x93')](_0x4fb73b['body'][_0x4d0e('0x8f')])){throw new db[(_0x4d0e('0x91'))][(_0x4d0e('0x94'))]('Wrong\x20credentials');}if(_0x4fb73b['body'][_0x4d0e('0x8f')]===_0x4fb73b[_0x4d0e('0x5a')][_0x4d0e('0x90')]){throw new db[(_0x4d0e('0x91'))][(_0x4d0e('0x94'))](_0x4d0e('0x95'));}}else if(_0x4fb73b[_0x4d0e('0x2a')][_0x4d0e('0x27')]===_0x4d0e('0x28')){if(!_0x4fb73b[_0x4d0e('0x5a')][_0x4d0e('0x90')]){throw new db['Sequelize'][(_0x4d0e('0x94'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x4fb73b[_0x4d0e('0x2a')]['role']===_0x4d0e('0x2a')){if(!_0x4fb73b[_0x4d0e('0x5a')][_0x4d0e('0x90')]){throw new db['Sequelize'][(_0x4d0e('0x94'))](_0x4d0e('0x96'));}if(_0x3b33b9[_0x4d0e('0x27')]!=='agent'){throw new db[(_0x4d0e('0x91'))]['ValidationError'](_0x4d0e('0x7d'));}}else{throw new db[(_0x4d0e('0x91'))]['ValidationError'](_0x4d0e('0x7d'));}return _0x3b33b9;})[_0x4d0e('0x12')](handleEntityNotFound(_0x528977,null))[_0x4d0e('0x12')](function(_0x1f43eb){return db[_0x4d0e('0x60')][_0x4d0e('0x97')]({'attributes':['id',_0x4d0e('0x62'),_0x4d0e('0x98'),_0x4d0e('0x99')]})[_0x4d0e('0x12')](function(_0x54585a){if(_0x54585a['securePassword'])authService[_0x4d0e('0x63')](_0x4fb73b[_0x4d0e('0x5a')][_0x4d0e('0x90')]);if(!_0x54585a[_0x4d0e('0x98')]||!_0x1f43eb['previousPasswords'])return _0x1f43eb;authService['validatePasswordHistory'](_0x4fb73b[_0x4d0e('0x5a')][_0x4d0e('0x90')],_0x1f43eb[_0x4d0e('0x9a')],_0x54585a['passwordHistoryLimit']);return _0x1f43eb;})[_0x4d0e('0x12')](saveUpdates({'password':_0x4fb73b[_0x4d0e('0x5a')]['newPassword'],'passwordResetAt':_0x4fb73b[_0x4d0e('0x2a')]['id']==_0x4fb73b['params']['id']?moment():null,'previousPasswords':authService[_0x4d0e('0x9b')](_0x4fb73b[_0x4d0e('0x5a')][_0x4d0e('0x90')],_0x1f43eb[_0x4d0e('0x9a')])},null));})['then'](respondWithResult(_0x528977,null))['catch'](handleError(_0x528977,null));};exports[_0x4d0e('0x9c')]=function(_0x5bbd42,_0x1c949c){var _0x494e10=_0x5bbd42[_0x4d0e('0x5a')][_0x4d0e('0x9d')];return db[_0x4d0e('0x37')][_0x4d0e('0x58')]({'where':{'id':_0x5bbd42['params']['id']},'attributes':['id','name',_0x4d0e('0x27'),_0x4d0e('0x9e'),_0x4d0e('0x9f'),_0x4d0e('0xa0'),_0x4d0e('0xa1')]})[_0x4d0e('0x12')](handleEntityNotFound(_0x1c949c,null))[_0x4d0e('0x12')](function(_0x4f4c23){if(_0x4f4c23){if(!utils['isValidChannel'](_0x494e10)){throw new db[(_0x4d0e('0x91'))][(_0x4d0e('0x94'))]('Unknown\x20channel');}return _0x4f4c23[_0x4d0e('0xa2')+_[_0x4d0e('0xa3')](_0x494e10['toLowerCase']())+_0x4d0e('0xa4')](_0x5bbd42[_0x4d0e('0x5a')]['ids'],{'penalty':_0x5bbd42['body'][_0x4d0e('0xa5')]||0x0})[_0x4d0e('0xa6')](function(_0x5a0a87){for(var _0x538b89=0x0;_0x538b89<_0x5bbd42[_0x4d0e('0x5a')][_0x4d0e('0x5d')][_0x4d0e('0x45')];_0x538b89+=0x1){var _0x14f6fb={'UserId':Number(_0x5bbd42[_0x4d0e('0x4e')]['id'])};_0x14f6fb[_['capitalize'](_0x494e10['toLowerCase']())+_0x4d0e('0xa7')]=Number(_0x5bbd42['body'][_0x4d0e('0x5d')][_0x538b89]);socket['emit'](_0x4d0e('0x2a')+_[_0x4d0e('0xa3')](_0x494e10['toLowerCase']())+_0x4d0e('0xa8'),_0x14f6fb);}return _0x5a0a87;})[_0x4d0e('0x12')](function(){if(_0x494e10==='voice'){return db['VoiceQueue'][_0x4d0e('0x8b')]({'where':{'id':_0x5bbd42['body'][_0x4d0e('0x5d')]||[]},'raw':!![],'attributes':['id','name']});}})[_0x4d0e('0x12')](function(_0xa83856){var _0x5a1491=_0x4f4c23[_0x4d0e('0x26')]({'plain':!![]});var _0x47b20a=[];if(_0x494e10===_0x4d0e('0xa9')&&_0x5a1491[_0x4d0e('0x27')]===_0x4d0e('0x2b')&&_0x5a1491[_0x4d0e('0x9e')]){for(var _0x2b14c9=0x0;_0x2b14c9<_0xa83856[_0x4d0e('0x45')];_0x2b14c9+=0x1){_0x47b20a[_0x4d0e('0x42')]({'membername':_0x5a1491['name'],'UserId':_0x5a1491['id'],'queue_name':_0xa83856[_0x2b14c9][_0x4d0e('0x35')],'VoiceQueueId':_0xa83856[_0x2b14c9]['id'],'interface':_['isNil'](_0x5a1491[_0x4d0e('0xa1')])?util['format']('SIP/%s',_0x5a1491[_0x4d0e('0x35')]):_0x5a1491['interface'],'paused':_0x5a1491[_0x4d0e('0xa0')]||![],'penalty':_0x5bbd42[_0x4d0e('0x5a')]['penalty']||0x0});}return BPromise[_0x4d0e('0x89')](_0x47b20a,function(_0x14fa2c){return db[_0x4d0e('0xaa')][_0x4d0e('0xab')](_0x14fa2c);});}return _0x4f4c23;});}})['then'](respondWithStatusCode(_0x1c949c,null))[_0x4d0e('0x1c')](handleError(_0x1c949c,null));};exports['removeQueues']=function(_0x47e59e,_0x55cf54){var _0x422550;return db[_0x4d0e('0x37')][_0x4d0e('0x58')]({'where':{'id':_0x47e59e['params']['id']},'attributes':['id','name','role']})[_0x4d0e('0x12')](handleEntityNotFound(_0x55cf54,null))[_0x4d0e('0x12')](function(_0x2d3eab){if(_0x2d3eab){_0x422550=_0x2d3eab;if(!_0x47e59e[_0x4d0e('0x3e')]['channel']||!utils[_0x4d0e('0xac')](_0x47e59e['query'][_0x4d0e('0x9d')])){throw new db['Sequelize'][(_0x4d0e('0x94'))](_0x4d0e('0xad'));}return _0x2d3eab['remove'+_[_0x4d0e('0xa3')](_0x47e59e[_0x4d0e('0x3e')][_0x4d0e('0x9d')]['toLowerCase']())+'Queues'](_0x47e59e['query']['ids']);}})[_0x4d0e('0x12')](function(_0x457f98){if(_[_0x4d0e('0xae')](_0x47e59e[_0x4d0e('0x3e')]['ids'])){for(var _0x3dcc81=0x0;_0x3dcc81<_0x47e59e[_0x4d0e('0x3e')][_0x4d0e('0x5d')]['length'];_0x3dcc81+=0x1){var _0x407cda={'UserId':Number(_0x47e59e['params']['id'])};_0x407cda[_[_0x4d0e('0xa3')](_0x47e59e[_0x4d0e('0x3e')][_0x4d0e('0x9d')][_0x4d0e('0xaf')]())+_0x4d0e('0xa7')]=Number(_0x47e59e[_0x4d0e('0x3e')][_0x4d0e('0x5d')][_0x3dcc81]);socket[_0x4d0e('0xb0')](_0x4d0e('0x2a')+_['capitalize'](_0x47e59e[_0x4d0e('0x3e')][_0x4d0e('0x9d')][_0x4d0e('0xaf')]())+_0x4d0e('0xb1'),_0x407cda);}}else{var _0x407cda={'UserId':Number(_0x47e59e[_0x4d0e('0x4e')]['id'])};_0x407cda[_[_0x4d0e('0xa3')](_0x47e59e[_0x4d0e('0x3e')]['channel'][_0x4d0e('0xaf')]())+_0x4d0e('0xa7')]=Number(_0x47e59e[_0x4d0e('0x3e')]['ids']);socket[_0x4d0e('0xb0')](_0x4d0e('0x2a')+_['capitalize'](_0x47e59e[_0x4d0e('0x3e')]['channel'][_0x4d0e('0xaf')]())+_0x4d0e('0xb1'),_0x407cda);}return _0x457f98;})[_0x4d0e('0x12')](function(){if(_0x47e59e[_0x4d0e('0x3e')]['channel']==='voice'){return db[_0x4d0e('0xaa')][_0x4d0e('0x25')]({'where':{'UserId':_0x47e59e['params']['id'],'VoiceQueueId':_0x47e59e[_0x4d0e('0x3e')][_0x4d0e('0x5d')]},'individualHooks':!![]})['then'](function(){return _0x422550;});}return _0x422550;})['then'](respondWithStatusCode(_0x55cf54,null))[_0x4d0e('0x1c')](handleError(_0x55cf54,null));};exports['addAvatar']=function(_0x100c83,_0x236626){_0x100c83[_0x4d0e('0x5a')][_0x4d0e('0xb2')]=_0x100c83[_0x4d0e('0xb3')][_0x4d0e('0xb4')];return db[_0x4d0e('0x37')]['find']({'where':{'id':_0x100c83[_0x4d0e('0x4e')]['id']}})[_0x4d0e('0x12')](handleEntityNotFound(_0x236626,null))[_0x4d0e('0x12')](saveUpdates(_0x100c83[_0x4d0e('0x5a')],null))[_0x4d0e('0x12')](respondWithResult(_0x236626,null))['catch'](handleError(_0x236626,null));};exports[_0x4d0e('0xb5')]=function(_0x18bbd3,_0x1681b7){var _0x403acf=path[_0x4d0e('0xb6')](config['root'],_0x4d0e('0xb7'));return db[_0x4d0e('0x37')][_0x4d0e('0x58')]({'where':{'id':_0x18bbd3[_0x4d0e('0x4e')]['id']},'attributes':['id',_0x4d0e('0xb2')],'raw':!![]})[_0x4d0e('0x12')](handleEntityNotFound(_0x1681b7,null))[_0x4d0e('0x12')](function(_0x49d224){if(_0x49d224){if(_[_0x4d0e('0x65')](_0x49d224[_0x4d0e('0xb2')])){return _0x1681b7[_0x4d0e('0xb8')](_0x403acf);}else{if(!fs[_0x4d0e('0xb9')](path[_0x4d0e('0xb6')](config['root'],_0x4d0e('0xba'),_0x49d224[_0x4d0e('0xb2')]))){return _0x1681b7[_0x4d0e('0xb8')](_0x403acf);}return _0x1681b7[_0x4d0e('0xb8')](path['join'](config[_0x4d0e('0xbb')],_0x4d0e('0xba'),_0x49d224[_0x4d0e('0xb2')]));}}})[_0x4d0e('0x1c')](handleError(_0x1681b7,null));};exports[_0x4d0e('0xbc')]=function(_0x12b88f,_0x1e7bdd){return db['User'][_0x4d0e('0x58')]({'where':{'id':_0x12b88f['params']['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x1e7bdd,null))[_0x4d0e('0x12')](function(_0x57bfdd){var _0x2aa4e3=[];values=_0x57bfdd['dataValues'];_0x2aa4e3[_0x4d0e('0x42')](get_open_tabs(_0x4d0e('0x46'),_0x57bfdd[_0x4d0e('0x48')]));_0x2aa4e3[_0x4d0e('0x42')](get_open_tabs('sms',_0x57bfdd[_0x4d0e('0x48')]));_0x2aa4e3[_0x4d0e('0x42')](get_open_tabs(_0x4d0e('0x59'),_0x57bfdd[_0x4d0e('0x48')]));_0x2aa4e3['push'](get_open_tabs(_0x4d0e('0x4c'),_0x57bfdd[_0x4d0e('0x48')]));_0x2aa4e3[_0x4d0e('0x42')](get_open_tabs(_0x4d0e('0x4a'),_0x57bfdd['dataValues']));_0x2aa4e3[_0x4d0e('0x42')](get_open_tabs(_0x4d0e('0x4b'),_0x57bfdd[_0x4d0e('0x48')]));return BPromise[_0x4d0e('0x4d')](_0x2aa4e3);})['then'](function(_0x4cefe7){var _0x5df2a2=[];if(_0x4cefe7){for(var _0x336afa=0x0;_0x336afa=_0x2f8268){_0x2c88ad=_0x2f8268;_0x192471=0xc8;}else{_0x192471=0xce;}_0x538b00[_0xfdd4('0x1c')](_0x192471);return _0x538b00[_0xfdd4('0x23')]('Content-Range',_0x4a8790+'-'+_0x2c88ad+'/'+_0x2f8268)[_0xfdd4('0x1e')](_0x1112e8);}return null;};}function saveUpdates(_0x39981f){return function(_0x385a68){if(_0x385a68){return _0x385a68[_0xfdd4('0x24')](_0x39981f)[_0xfdd4('0x11')](function(_0x4a36a2){return _0x4a36a2;});}return null;};}function removeEntity(_0xd127b1){return function(_0x3372d2){if(_0x3372d2){return _0x3372d2[_0xfdd4('0x25')]()[_0xfdd4('0x11')](function(){var _0x13cc5e=_0x3372d2['get']({'plain':!![]});if(_0x13cc5e[_0xfdd4('0x26')]===_0xfdd4('0x27'))return;var _0x2ab99e=[{'name':'Users','value':_0xfdd4('0x28'),'ignore':!![]},{'name':'Agents','value':_0xfdd4('0x29'),'ignore':![]},{'name':_0xfdd4('0x2a'),'value':'telephone','ignore':![]}];var _0x50b748=_(_0x2ab99e)[_0xfdd4('0x2b')](_0xfdd4('0x2c'))['map']('value')[_0xfdd4('0x2d')]();if(_[_0xfdd4('0x2e')](_0x50b748,_0x13cc5e[_0xfdd4('0x26')])){return;}var _0x24b1fa=_[_0xfdd4('0x2f')](_0x2ab99e,[_0xfdd4('0x2d'),_0x13cc5e[_0xfdd4('0x26')]])[_0xfdd4('0x30')];return db[_0xfdd4('0x31')][_0xfdd4('0x25')]({'where':{'type':_0x24b1fa,'resourceId':_0x13cc5e['id']}})[_0xfdd4('0x11')](function(){return _0x3372d2;});})[_0xfdd4('0x11')](function(){_0xd127b1[_0xfdd4('0x1c')](0xcc)[_0xfdd4('0x1d')]();});}};}function handleEntityNotFound(_0x2cd168){return function(_0x3f5c5a){if(!_0x3f5c5a){_0x2cd168[_0xfdd4('0x1b')](0x194);}return _0x3f5c5a;};}function handleError(_0x3a0102,_0x2abe77){_0x2abe77=_0x2abe77||0x1f4;return function(_0x4037c4){logger[_0xfdd4('0x15')](_0x4037c4[_0xfdd4('0x32')]);if(_0x4037c4[_0xfdd4('0x30')]){delete _0x4037c4[_0xfdd4('0x30')];}_0x3a0102[_0xfdd4('0x1c')](_0x2abe77)[_0xfdd4('0x33')](_0x4037c4);};}exports['index']=function(_0x2b6c87,_0x3716da){var _0x42dc1a={},_0x439389={'count':0x0,'rows':[]};var _0x2850f5=_(db[_0xfdd4('0x34')]['rawAttributes'])[_0xfdd4('0x35')](function(_0x4c8602){return{'name':_0x4c8602[_0xfdd4('0x36')],'type':_0x4c8602[_0xfdd4('0x37')][_0xfdd4('0x38')]};})[_0xfdd4('0x2b')](function(_0x4cccab){return!_[_0xfdd4('0x2e')]([_0xfdd4('0x39'),_0xfdd4('0x3a')],_0x4cccab[_0xfdd4('0x30')]);})[_0xfdd4('0x2d')]();_0x42dc1a=qs[_0xfdd4('0x3b')](_0x2850f5,_0x2b6c87);var _0x28e5e2={'where':_0x42dc1a[_0xfdd4('0x3c')]};return db[_0xfdd4('0x34')][_0xfdd4('0x21')](_0x28e5e2)['then'](function(_0xa7d254){_0x439389[_0xfdd4('0x21')]=_0xa7d254;if(_0x2b6c87[_0xfdd4('0x3d')][_0xfdd4('0x3e')]){_0x42dc1a['include']=[{'all':!![]}];}if(!_[_0xfdd4('0x2e')](_0x42dc1a[_0xfdd4('0x3f')],'id')){_0x42dc1a[_0xfdd4('0x3f')][_0xfdd4('0x40')]('id');}return db[_0xfdd4('0x34')]['findAll'](_0x42dc1a);})[_0xfdd4('0x11')](function(_0x23af2a){_0x439389[_0xfdd4('0x41')]=_0x23af2a;if(_0x2b6c87[_0xfdd4('0x3d')][_0xfdd4('0x42')]===_0xfdd4('0x43')){var _0x3d1051=[];for(var _0x484cb6=0x0;_0x484cb6<_0x439389[_0xfdd4('0x41')]['length'];_0x484cb6++){_0x3d1051[_0xfdd4('0x40')](get_open_tabs(_0xfdd4('0x44'),_0x439389[_0xfdd4('0x41')][_0x484cb6][_0xfdd4('0x45')]));_0x3d1051['push'](get_open_tabs(_0xfdd4('0x46'),_0x439389[_0xfdd4('0x41')][_0x484cb6]['dataValues']));_0x3d1051[_0xfdd4('0x40')](get_open_tabs(_0xfdd4('0x47'),_0x439389['rows'][_0x484cb6][_0xfdd4('0x45')]));_0x3d1051['push'](get_open_tabs('mail',_0x439389['rows'][_0x484cb6][_0xfdd4('0x45')]));_0x3d1051[_0xfdd4('0x40')](get_open_tabs(_0xfdd4('0x48'),_0x439389['rows'][_0x484cb6][_0xfdd4('0x45')]));_0x3d1051[_0xfdd4('0x40')](get_open_tabs('whatsapp',_0x439389[_0xfdd4('0x41')][_0x484cb6][_0xfdd4('0x45')]));}return BPromise[_0xfdd4('0x49')](_0x3d1051)[_0xfdd4('0x11')](function(_0x746f6a){return _0x439389;});}else{return _0x439389;}})[_0xfdd4('0x11')](respondWithFilteredResult(_0x3716da,_0x42dc1a))[_0xfdd4('0x1a')](handleError(_0x3716da,null));};exports[_0xfdd4('0x4a')]=function(_0x393c11,_0xe82eff){var _0x367f51={'raw':![],'where':{'id':_0x393c11[_0xfdd4('0x4b')]['id']}},_0x2aab84={};_0x2aab84[_0xfdd4('0x4c')]=_['differenceBy'](_['keys'](db[_0xfdd4('0x34')][_0xfdd4('0x4d')]),[_0xfdd4('0x39'),_0xfdd4('0x3a')]);_0x2aab84['query']=_[_0xfdd4('0x4e')](_0x393c11[_0xfdd4('0x3d')]);_0x2aab84['filters']=_['intersection'](_0x2aab84['model'],_0x2aab84['query']);_0x367f51['attributes']=_[_0xfdd4('0x4f')](_0x2aab84[_0xfdd4('0x4c')],qs[_0xfdd4('0x50')](_0x393c11[_0xfdd4('0x3d')][_0xfdd4('0x50')]));_0x367f51[_0xfdd4('0x3f')]=_0x367f51['attributes'][_0xfdd4('0x51')]?_0x367f51[_0xfdd4('0x3f')]:_0x2aab84[_0xfdd4('0x4c')];if(_0x393c11[_0xfdd4('0x3d')]['includeAll']){_0x367f51[_0xfdd4('0x52')]=[{'all':!![]}];}_0x367f51=_[_0xfdd4('0x53')]({},_0x367f51,_0x393c11['options']);if(!_[_0xfdd4('0x2e')](_0x367f51[_0xfdd4('0x3f')],'id')){_0x367f51['attributes']['push']('id');}return db[_0xfdd4('0x34')][_0xfdd4('0x2f')](_0x367f51)[_0xfdd4('0x11')](handleEntityNotFound(_0xe82eff,null))[_0xfdd4('0x11')](function(_0xce9f02){var _0x1b9979=[];values=_0xce9f02;if(_0x393c11[_0xfdd4('0x3d')][_0xfdd4('0x42')]==='true'){_0x1b9979[_0xfdd4('0x40')](get_open_tabs('chat',_0xce9f02['dataValues']));_0x1b9979[_0xfdd4('0x40')](get_open_tabs(_0xfdd4('0x46'),_0xce9f02['dataValues']));_0x1b9979['push'](get_open_tabs('openchannel',_0xce9f02[_0xfdd4('0x45')]));_0x1b9979[_0xfdd4('0x40')](get_open_tabs('whatsapp',_0xce9f02[_0xfdd4('0x45')]));_0x1b9979[_0xfdd4('0x40')](get_open_tabs(_0xfdd4('0x47'),_0xce9f02[_0xfdd4('0x45')]));_0x1b9979[_0xfdd4('0x40')](get_open_tabs('mail',_0xce9f02['dataValues']));return BPromise['all'](_0x1b9979);}else{return values;}})['then'](function(_0x3e5cb0){return values;})[_0xfdd4('0x11')](respondWithResult(_0xe82eff,null))['catch'](handleError(_0xe82eff,null));};exports[_0xfdd4('0x24')]=function(_0x2abe50,_0x4d4304){if(_0x2abe50[_0xfdd4('0x54')]['id']){delete _0x2abe50[_0xfdd4('0x54')]['id'];}delete _0x2abe50['body'][_0xfdd4('0x26')];return db[_0xfdd4('0x34')][_0xfdd4('0x2f')]({'where':{'id':_0x2abe50['params']['id']}})[_0xfdd4('0x11')](handleEntityNotFound(_0x4d4304,null))[_0xfdd4('0x11')](saveUpdates(_0x2abe50[_0xfdd4('0x54')],null))[_0xfdd4('0x11')](respondWithResult(_0x4d4304,null))[_0xfdd4('0x1a')](handleError(_0x4d4304,null));};exports['describe']=function(_0x2cc3e2,_0x2ee4b6){return db[_0xfdd4('0x34')][_0xfdd4('0x55')]()[_0xfdd4('0x11')](respondWithResult(_0x2ee4b6,null))[_0xfdd4('0x1a')](handleError(_0x2ee4b6,null));};exports[_0xfdd4('0x56')]=function(_0x30e9c0,_0x38b58b){return db['User'][_0xfdd4('0x2f')]({'where':{'id':_0x30e9c0[_0xfdd4('0x4b')]['id']}})[_0xfdd4('0x11')](handleEntityNotFound(_0x38b58b,null))[_0xfdd4('0x11')](function(_0x3096fa){if(_0x3096fa){return _0x3096fa['addContacts'](_0x30e9c0[_0xfdd4('0x54')][_0xfdd4('0x57')],_[_0xfdd4('0x58')](_0x30e9c0[_0xfdd4('0x54')],[_0xfdd4('0x57'),'id'])||{});}})[_0xfdd4('0x11')](respondWithResult(_0x38b58b,null))[_0xfdd4('0x1a')](handleError(_0x38b58b,null));};function validateUser(_0x276e9){return new BPromise(function(_0x35c7ab,_0x2a0dd8){if(_0x276e9[_0xfdd4('0x59')])return _0x35c7ab(_0x276e9);return db[_0xfdd4('0x5a')][_0xfdd4('0x5b')](0x1)['then'](function(_0xb9d86a){if(_0xb9d86a['securePassword'])authService[_0xfdd4('0x5c')](_0x276e9[_0xfdd4('0x39')]);db[_0xfdd4('0x34')][_0xfdd4('0x5d')](_0xfdd4('0x59'))[_0xfdd4('0x11')](function(_0xea89a1){if(_[_0xfdd4('0x5e')](_0xea89a1)){_0x276e9[_0xfdd4('0x59')]=_0xb9d86a[_0xfdd4('0x5f')]||0x1;return;}if(_[_0xfdd4('0x5e')](_0xb9d86a[_0xfdd4('0x5f')])||_0xb9d86a['min_internal']===_0xea89a1){_0x276e9['internal']=_0xea89a1+0x1;return;}if(_0xb9d86a['min_internal']>_0xea89a1){_0x276e9[_0xfdd4('0x59')]=_0xb9d86a[_0xfdd4('0x5f')];return;}return db['sequelize'][_0xfdd4('0x3d')](_0xfdd4('0x60'),{'type':db[_0xfdd4('0x61')][_0xfdd4('0x62')][_0xfdd4('0x63')]})['then'](function(_0x150537){if(_0x150537&&_0x150537[_0xfdd4('0x51')]){for(var _0x3958cd=0x0,_0x523085=_0x150537[_0xfdd4('0x51')];_0x3958cd<_0x523085&&_['isNil'](_0x276e9[_0xfdd4('0x59')]);_0x3958cd++){if(_0xb9d86a[_0xfdd4('0x5f')]<=_0x150537[_0x3958cd][_0xfdd4('0x64')]){_0x276e9[_0xfdd4('0x59')]=_0x150537[_0x3958cd]['from'];}else if(_0xb9d86a[_0xfdd4('0x5f')]>_0x150537[_0x3958cd][_0xfdd4('0x64')]&&_0xb9d86a['min_internal']<=_0x150537[_0x3958cd]['to']){_0x276e9[_0xfdd4('0x59')]=_0xb9d86a[_0xfdd4('0x5f')];}}}if(_[_0xfdd4('0x5e')](_0x276e9['internal'])){_0x276e9[_0xfdd4('0x59')]=_0xea89a1+0x1;}return _0x35c7ab(_0x276e9);});});})[_0xfdd4('0x1a')](function(_0x20364c){_0x2a0dd8(_0x20364c);});});}function updateUser(_0x535b07){return new BPromise(function(_0x3f4337,_0x1ea422){try{if(_0x535b07[_0xfdd4('0x65')]){_0x535b07[_0xfdd4('0x66')]=_0x535b07[_0xfdd4('0x59')];_0x535b07[_0xfdd4('0x67')]={'mailbox':_0x535b07[_0xfdd4('0x59')],'password':_0x535b07['password'],'fullname':_0x535b07[_0xfdd4('0x68')],'email':_0x535b07[_0xfdd4('0x69')]};}if(_0x535b07[_0xfdd4('0x26')]===_0xfdd4('0x29')){if(!_0x535b07[_0xfdd4('0x6a')])_0x535b07[_0xfdd4('0x6a')]=[_0xfdd4('0x6b'),_0xfdd4('0x6c'),'103',_0xfdd4('0x6d'),'110','104',_0xfdd4('0x6e'),'106',_0xfdd4('0x6f'),'108',_0xfdd4('0x70'),_0xfdd4('0x71'),_0xfdd4('0x72'),_0xfdd4('0x73'),_0xfdd4('0x74')];}_0x3f4337(_0x535b07);}catch(_0x35ba83){_0x1ea422(_0x35ba83);}});}exports[_0xfdd4('0x75')]=function(_0x48c8dd,_0x588a18){if(_0x48c8dd[_0xfdd4('0x28')]['role']===_0xfdd4('0x29'))throw new Error(_0xfdd4('0x76'));if(_0x48c8dd[_0xfdd4('0x54')][_0xfdd4('0x26')]===_0xfdd4('0x28')&&_0x48c8dd[_0xfdd4('0x28')][_0xfdd4('0x26')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x48c8dd[_0xfdd4('0x54')][_0xfdd4('0x26')]===_0xfdd4('0x27')&&_0x48c8dd[_0xfdd4('0x28')][_0xfdd4('0x26')]!==_0xfdd4('0x27')){throw new Error(_0xfdd4('0x77'));}return licenseUtil[_0xfdd4('0x78')]([_0x48c8dd[_0xfdd4('0x54')]])[_0xfdd4('0x11')](function(){return validateUser(_0x48c8dd[_0xfdd4('0x54')]);})[_0xfdd4('0x11')](function(_0x256ce8){return updateUser(_0x256ce8)['then'](function(_0x4bb814){if(_0x4bb814[_0xfdd4('0x26')]===_0xfdd4('0x27')){_0x4bb814['settingsEnabled']=_0x48c8dd['user'][_0xfdd4('0x79')];delete _0x4bb814[_0xfdd4('0x7a')];}return _0x4bb814;});})['then'](function(_0x3ea3e9){return db[_0xfdd4('0x34')][_0xfdd4('0x75')](_0x3ea3e9,{'include':[{'model':db[_0xfdd4('0x67')],'as':_0xfdd4('0x67')}]});})[_0xfdd4('0x11')](function(_0x5d356c){if(_0x48c8dd[_0xfdd4('0x54')][_0xfdd4('0x26')]===_0xfdd4('0x28'))return _0x5d356c;if(_0x48c8dd[_0xfdd4('0x28')][_0xfdd4('0x26')]!==_0xfdd4('0x28'))return _0x5d356c;return db[_0xfdd4('0x7b')][_0xfdd4('0x2f')]({'where':{'name':_0x5d356c['role']==='agent'?_0xfdd4('0x7c'):'Telephones','userProfileId':_0x48c8dd[_0xfdd4('0x28')][_0xfdd4('0x7a')]},'raw':!![]})[_0xfdd4('0x11')](function(_0x2ea155){if(!_0x2ea155||_0x2ea155[_0xfdd4('0x7d')]!=0x0)return _0x5d356c;return db['UserProfileResource']['create']({'name':_0x5d356c[_0xfdd4('0x30')],'resourceId':_0x5d356c['id'],'type':_0x2ea155['name'],'sectionId':_0x2ea155['id']},{})[_0xfdd4('0x11')](function(){return _0x5d356c;});})['catch'](function(_0xd24633){logger[_0xfdd4('0x15')](_0xfdd4('0x7e'),_0xd24633);throw _0xd24633;});})[_0xfdd4('0x11')](respondWithResult(_0x588a18,0xc9))[_0xfdd4('0x1a')](handleError(_0x588a18,null));};exports[_0xfdd4('0x7f')]=function(_0x1823e1,_0x18ae9e){var _0x3d23df=_0x1823e1[_0xfdd4('0x54')];var _0xf577e4=[];if(_0x1823e1['user'][_0xfdd4('0x26')]===_0xfdd4('0x29'))throw new Error(_0xfdd4('0x76'));if(_[_0xfdd4('0x80')](_0x3d23df,[_0xfdd4('0x26'),_0xfdd4('0x28')])&&_0x1823e1[_0xfdd4('0x28')][_0xfdd4('0x26')]!==_0xfdd4('0x27')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_['some'](_0x3d23df,[_0xfdd4('0x26'),_0xfdd4('0x27')])&&_0x1823e1[_0xfdd4('0x28')]['role']!==_0xfdd4('0x27')){throw new Error(_0xfdd4('0x81'));}return licenseUtil[_0xfdd4('0x78')](_0x3d23df)[_0xfdd4('0x11')](function(){return validateUser(_0x3d23df[0x0]);})['then'](function(){for(var _0x5868e6=0x1;_0x5868e6<_0x3d23df[_0xfdd4('0x51')];_0x5868e6++){var _0xea95b6=_0x3d23df[_0x5868e6-0x1][_0xfdd4('0x59')];if(!_0x3d23df[_0x5868e6]['internal'])_0x3d23df[_0x5868e6][_0xfdd4('0x59')]=_0xea95b6+0x1;_0xf577e4[_0xfdd4('0x40')](validateUser(_0x3d23df[_0x5868e6]));}return BPromise[_0xfdd4('0x49')](_0xf577e4);})[_0xfdd4('0x11')](function(){_0xf577e4=[];for(var _0x11e70e=0x0;_0x11e70e<_0x3d23df[_0xfdd4('0x51')];_0x11e70e++){_0xf577e4['push'](updateUser(_0x3d23df[_0x11e70e]));}return BPromise['all'](_0xf577e4);})[_0xfdd4('0x11')](function(){return BPromise[_0xfdd4('0x82')](_0x3d23df,function(_0x6a1410){return db[_0xfdd4('0x34')][_0xfdd4('0x75')](_0x6a1410,{'include':[{'model':db[_0xfdd4('0x67')],'as':_0xfdd4('0x67')}]})[_0xfdd4('0x11')](function(_0x5d1a3f){_0x6a1410['id']=_0x5d1a3f['id'];return _0x6a1410;});});})[_0xfdd4('0x11')](function(_0x547c4c){if(_0x1823e1[_0xfdd4('0x54')][_0xfdd4('0x26')]==='user')return _0x547c4c;if(_0x1823e1[_0xfdd4('0x28')][_0xfdd4('0x26')]!==_0xfdd4('0x28'))return _0x547c4c;var _0x2e0001=_[_0xfdd4('0x80')](_0x547c4c,function(_0xd5d8cb){return _0xd5d8cb[_0xfdd4('0x26')]===_0xfdd4('0x29')||_0xd5d8cb[_0xfdd4('0x26')]==='telephone';});if(!_0x2e0001)return _0x547c4c;return db[_0xfdd4('0x7b')]['findAll']({'where':{'name':{'$or':[_0xfdd4('0x7c'),'Telephones']},'userProfileId':_0x1823e1['user'][_0xfdd4('0x7a')]},'raw':!![]})[_0xfdd4('0x11')](function(_0x37cee9){if(_[_0xfdd4('0x83')](_0x37cee9)||!_[_0xfdd4('0x80')](_0x37cee9,['autoAssociation',0x0]))return _0x547c4c;_0xf577e4=[];var _0x45dccd=_(_0x37cee9)[_0xfdd4('0x35')](function(_0x15cc64){if(_0x15cc64[_0xfdd4('0x7d')]===0x1)return;return _0x15cc64[_0xfdd4('0x30')]===_0xfdd4('0x7c')?'agent':_0xfdd4('0x84');})[_0xfdd4('0x85')]()['value']();for(var _0x4bc30f=0x0;_0x4bc30f<_0x547c4c[_0xfdd4('0x51')];_0x4bc30f++){if(!_[_0xfdd4('0x2e')](_0x45dccd,_0x547c4c[_0x4bc30f][_0xfdd4('0x26')]))return;var _0x4f38c0=_0x547c4c[_0x4bc30f]['role']===_0xfdd4('0x29')?_0xfdd4('0x7c'):_0xfdd4('0x2a');_0xf577e4['push'](db['UserProfileResource'][_0xfdd4('0x75')]({'name':_0x547c4c[_0x4bc30f][_0xfdd4('0x30')],'resourceId':_0x547c4c[_0x4bc30f]['id'],'type':_0x4f38c0,'sectionId':_[_0xfdd4('0x2f')](_0x37cee9,['name',_0x4f38c0])['id']},{}));}return BPromise[_0xfdd4('0x49')](_0xf577e4);});})['then'](respondWithResult(_0x18ae9e,0xc9))[_0xfdd4('0x1a')](handleError(_0x18ae9e,null));};exports[_0xfdd4('0x86')]=function(_0x3a237f,_0x4e1dbc){if(_0x3a237f[_0xfdd4('0x54')]['id']){delete _0x3a237f[_0xfdd4('0x54')]['id'];}return db[_0xfdd4('0x34')][_0xfdd4('0x2f')]({'where':{'id':_0x3a237f[_0xfdd4('0x4b')]['id']}})['then'](function(_0x19de84){if(!_0x19de84)return null;if(_0x19de84['id']===_0x3a237f[_0xfdd4('0x28')]['id']){if(!_0x3a237f[_0xfdd4('0x54')]['oldPassword']||!_0x3a237f[_0xfdd4('0x54')][_0xfdd4('0x87')]){throw new db[(_0xfdd4('0x88'))][(_0xfdd4('0x89'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x19de84[_0xfdd4('0x8a')](_0x3a237f['body']['oldPassword'])){throw new db['Sequelize'][(_0xfdd4('0x89'))]('Wrong\x20credentials');}if(_0x3a237f['body']['oldPassword']===_0x3a237f[_0xfdd4('0x54')][_0xfdd4('0x87')]){throw new db[(_0xfdd4('0x88'))][(_0xfdd4('0x89'))](_0xfdd4('0x8b'));}}else if(_0x3a237f[_0xfdd4('0x28')][_0xfdd4('0x26')]===_0xfdd4('0x27')){if(!_0x3a237f[_0xfdd4('0x54')][_0xfdd4('0x87')]){throw new db[(_0xfdd4('0x88'))][(_0xfdd4('0x89'))](_0xfdd4('0x8c'));}}else if(_0x3a237f[_0xfdd4('0x28')][_0xfdd4('0x26')]===_0xfdd4('0x28')){if(!_0x3a237f[_0xfdd4('0x54')][_0xfdd4('0x87')]){throw new db[(_0xfdd4('0x88'))][(_0xfdd4('0x89'))](_0xfdd4('0x8c'));}if(_0x19de84[_0xfdd4('0x26')]!==_0xfdd4('0x29')){throw new db[(_0xfdd4('0x88'))][(_0xfdd4('0x89'))](_0xfdd4('0x76'));}}else{throw new db['Sequelize'][(_0xfdd4('0x89'))](_0xfdd4('0x76'));}return _0x19de84;})[_0xfdd4('0x11')](handleEntityNotFound(_0x4e1dbc,null))[_0xfdd4('0x11')](function(_0x1b5134){return db['Setting'][_0xfdd4('0x8d')]({'attributes':['id',_0xfdd4('0x8e'),_0xfdd4('0x8f'),_0xfdd4('0x90')]})[_0xfdd4('0x11')](function(_0x2ebc63){if(_0x2ebc63['securePassword'])authService[_0xfdd4('0x5c')](_0x3a237f[_0xfdd4('0x54')][_0xfdd4('0x87')]);if(!_0x2ebc63[_0xfdd4('0x8f')]||!_0x1b5134[_0xfdd4('0x91')])return _0x1b5134;authService[_0xfdd4('0x92')](_0x3a237f['body'][_0xfdd4('0x87')],_0x1b5134[_0xfdd4('0x91')],_0x2ebc63[_0xfdd4('0x90')]);return _0x1b5134;})['then'](saveUpdates({'password':_0x3a237f[_0xfdd4('0x54')][_0xfdd4('0x87')],'passwordResetAt':_0x3a237f['user']['id']==_0x3a237f['params']['id']?moment():null,'previousPasswords':authService[_0xfdd4('0x93')](_0x3a237f[_0xfdd4('0x54')][_0xfdd4('0x87')],_0x1b5134[_0xfdd4('0x91')])},null));})['then'](respondWithResult(_0x4e1dbc,null))[_0xfdd4('0x1a')](handleError(_0x4e1dbc,null));};exports['addQueues']=function(_0xc9955e,_0x42204a){var _0x26d5ea=_0xc9955e[_0xfdd4('0x54')][_0xfdd4('0x94')];return db[_0xfdd4('0x34')][_0xfdd4('0x2f')]({'where':{'id':_0xc9955e[_0xfdd4('0x4b')]['id']},'attributes':['id',_0xfdd4('0x30'),_0xfdd4('0x26'),_0xfdd4('0x95'),'loginInPause',_0xfdd4('0x96'),_0xfdd4('0x97')]})[_0xfdd4('0x11')](handleEntityNotFound(_0x42204a,null))[_0xfdd4('0x11')](function(_0x1e7bbb){if(_0x1e7bbb){if(!utils[_0xfdd4('0x98')](_0x26d5ea)){throw new db['Sequelize'][(_0xfdd4('0x89'))](_0xfdd4('0x99'));}return _0x1e7bbb[_0xfdd4('0x9a')+_[_0xfdd4('0x9b')](_0x26d5ea['toLowerCase']())+_0xfdd4('0x9c')](_0xc9955e[_0xfdd4('0x54')]['ids'],{'penalty':_0xc9955e[_0xfdd4('0x54')][_0xfdd4('0x9d')]||0x0})[_0xfdd4('0x9e')](function(_0x204975){for(var _0x3eab2e=0x0;_0x3eab2e<_0xc9955e[_0xfdd4('0x54')][_0xfdd4('0x57')][_0xfdd4('0x51')];_0x3eab2e+=0x1){var _0x1d460f={'UserId':Number(_0xc9955e[_0xfdd4('0x4b')]['id'])};_0x1d460f[_[_0xfdd4('0x9b')](_0x26d5ea[_0xfdd4('0x9f')]())+_0xfdd4('0xa0')]=Number(_0xc9955e[_0xfdd4('0x54')]['ids'][_0x3eab2e]);socket[_0xfdd4('0xa1')](_0xfdd4('0x28')+_[_0xfdd4('0x9b')](_0x26d5ea[_0xfdd4('0x9f')]())+'Queue:save',_0x1d460f);}return _0x204975;})[_0xfdd4('0x11')](function(){if(_0x26d5ea===_0xfdd4('0xa2')){return db['VoiceQueue'][_0xfdd4('0xa3')]({'where':{'id':_0xc9955e[_0xfdd4('0x54')][_0xfdd4('0x57')]||[]},'raw':!![],'attributes':['id',_0xfdd4('0x30')]});}})['then'](function(_0x227fcf){var _0x4e5610=_0x1e7bbb[_0xfdd4('0xa4')]({'plain':!![]});var _0x121654=[];if(_0x26d5ea==='voice'&&_0x4e5610[_0xfdd4('0x26')]==='agent'&&_0x4e5610['online']){for(var _0x10a396=0x0;_0x10a396<_0x227fcf[_0xfdd4('0x51')];_0x10a396+=0x1){_0x121654[_0xfdd4('0x40')]({'membername':_0x4e5610[_0xfdd4('0x30')],'UserId':_0x4e5610['id'],'queue_name':_0x227fcf[_0x10a396]['name'],'VoiceQueueId':_0x227fcf[_0x10a396]['id'],'interface':_['isNil'](_0x4e5610[_0xfdd4('0x97')])?util[_0xfdd4('0xa5')]('SIP/%s',_0x4e5610['name']):_0x4e5610[_0xfdd4('0x97')],'paused':_0x4e5610[_0xfdd4('0x96')]||![],'penalty':_0xc9955e[_0xfdd4('0x54')]['penalty']||0x0});}return BPromise[_0xfdd4('0x82')](_0x121654,function(_0x33c463){return db[_0xfdd4('0xa6')][_0xfdd4('0xa7')](_0x33c463);});}return _0x1e7bbb;});}})['then'](respondWithStatusCode(_0x42204a,null))[_0xfdd4('0x1a')](handleError(_0x42204a,null));};exports[_0xfdd4('0xa8')]=function(_0x23dd10,_0x23746f){var _0x2bc7f7;return db['User'][_0xfdd4('0x2f')]({'where':{'id':_0x23dd10[_0xfdd4('0x4b')]['id']},'attributes':['id','name',_0xfdd4('0x26')]})[_0xfdd4('0x11')](handleEntityNotFound(_0x23746f,null))[_0xfdd4('0x11')](function(_0x364a10){if(_0x364a10){_0x2bc7f7=_0x364a10;if(!_0x23dd10[_0xfdd4('0x3d')][_0xfdd4('0x94')]||!utils[_0xfdd4('0x98')](_0x23dd10[_0xfdd4('0x3d')][_0xfdd4('0x94')])){throw new db[(_0xfdd4('0x88'))][(_0xfdd4('0x89'))](_0xfdd4('0x99'));}return _0x364a10[_0xfdd4('0xa9')+_[_0xfdd4('0x9b')](_0x23dd10[_0xfdd4('0x3d')]['channel']['toLowerCase']())+_0xfdd4('0x9c')](_0x23dd10['query']['ids']);}})[_0xfdd4('0x11')](function(_0x3e09bc){if(_[_0xfdd4('0xaa')](_0x23dd10[_0xfdd4('0x3d')][_0xfdd4('0x57')])){for(var _0x2f847f=0x0;_0x2f847f<_0x23dd10[_0xfdd4('0x3d')]['ids'][_0xfdd4('0x51')];_0x2f847f+=0x1){var _0x17f504={'UserId':Number(_0x23dd10['params']['id'])};_0x17f504[_['capitalize'](_0x23dd10['query'][_0xfdd4('0x94')]['toLowerCase']())+_0xfdd4('0xa0')]=Number(_0x23dd10['query']['ids'][_0x2f847f]);socket[_0xfdd4('0xa1')](_0xfdd4('0x28')+_[_0xfdd4('0x9b')](_0x23dd10[_0xfdd4('0x3d')][_0xfdd4('0x94')][_0xfdd4('0x9f')]())+_0xfdd4('0xab'),_0x17f504);}}else{var _0x17f504={'UserId':Number(_0x23dd10[_0xfdd4('0x4b')]['id'])};_0x17f504[_['capitalize'](_0x23dd10[_0xfdd4('0x3d')][_0xfdd4('0x94')]['toLowerCase']())+_0xfdd4('0xa0')]=Number(_0x23dd10[_0xfdd4('0x3d')]['ids']);socket['emit']('user'+_['capitalize'](_0x23dd10[_0xfdd4('0x3d')][_0xfdd4('0x94')]['toLowerCase']())+_0xfdd4('0xab'),_0x17f504);}return _0x3e09bc;})['then'](function(){if(_0x23dd10[_0xfdd4('0x3d')][_0xfdd4('0x94')]===_0xfdd4('0xa2')){return db[_0xfdd4('0xa6')][_0xfdd4('0x25')]({'where':{'UserId':_0x23dd10[_0xfdd4('0x4b')]['id'],'VoiceQueueId':_0x23dd10[_0xfdd4('0x3d')]['ids']},'individualHooks':!![]})['then'](function(){return _0x2bc7f7;});}return _0x2bc7f7;})[_0xfdd4('0x11')](respondWithStatusCode(_0x23746f,null))[_0xfdd4('0x1a')](handleError(_0x23746f,null));};exports[_0xfdd4('0xac')]=function(_0x1c1daa,_0x3a6bd8){_0x1c1daa['body'][_0xfdd4('0xad')]=_0x1c1daa[_0xfdd4('0xae')][_0xfdd4('0xaf')];return db['User']['find']({'where':{'id':_0x1c1daa[_0xfdd4('0x4b')]['id']}})[_0xfdd4('0x11')](handleEntityNotFound(_0x3a6bd8,null))[_0xfdd4('0x11')](saveUpdates(_0x1c1daa[_0xfdd4('0x54')],null))[_0xfdd4('0x11')](respondWithResult(_0x3a6bd8,null))[_0xfdd4('0x1a')](handleError(_0x3a6bd8,null));};exports['getAvatar']=function(_0x4cc872,_0xd1ee84){var _0x2600d4=path[_0xfdd4('0xb0')](config['root'],_0xfdd4('0xb1'));return db['User'][_0xfdd4('0x2f')]({'where':{'id':_0x4cc872['params']['id']},'attributes':['id',_0xfdd4('0xad')],'raw':!![]})[_0xfdd4('0x11')](handleEntityNotFound(_0xd1ee84,null))['then'](function(_0x2d1810){if(_0x2d1810){if(_[_0xfdd4('0x5e')](_0x2d1810[_0xfdd4('0xad')])){return _0xd1ee84[_0xfdd4('0xb2')](_0x2600d4);}else{if(!fs['existsSync'](path[_0xfdd4('0xb0')](config[_0xfdd4('0xb3')],_0xfdd4('0xb4'),_0x2d1810[_0xfdd4('0xad')]))){return _0xd1ee84[_0xfdd4('0xb2')](_0x2600d4);}return _0xd1ee84[_0xfdd4('0xb2')](path['join'](config[_0xfdd4('0xb3')],'server/files/images/',_0x2d1810[_0xfdd4('0xad')]));}}})[_0xfdd4('0x1a')](handleError(_0xd1ee84,null));};exports[_0xfdd4('0xb5')]=function(_0x21b78b,_0x27eb23){return db[_0xfdd4('0x34')][_0xfdd4('0x2f')]({'where':{'id':_0x21b78b[_0xfdd4('0x4b')]['id']},'attributes':['id']})[_0xfdd4('0x11')](handleEntityNotFound(_0x27eb23,null))[_0xfdd4('0x11')](function(_0x16870e){var _0x27eb5e=[];values=_0x16870e['dataValues'];_0x27eb5e[_0xfdd4('0x40')](get_open_tabs('chat',_0x16870e[_0xfdd4('0x45')]));_0x27eb5e['push'](get_open_tabs('sms',_0x16870e[_0xfdd4('0x45')]));_0x27eb5e[_0xfdd4('0x40')](get_open_tabs(_0xfdd4('0x48'),_0x16870e[_0xfdd4('0x45')]));_0x27eb5e[_0xfdd4('0x40')](get_open_tabs(_0xfdd4('0xb6'),_0x16870e[_0xfdd4('0x45')]));_0x27eb5e['push'](get_open_tabs(_0xfdd4('0x47'),_0x16870e[_0xfdd4('0x45')]));_0x27eb5e[_0xfdd4('0x40')](get_open_tabs('mail',_0x16870e[_0xfdd4('0x45')]));return BPromise[_0xfdd4('0x49')](_0x27eb5e);})[_0xfdd4('0x11')](function(_0xc2ded3){var _0x3980ed=[];if(_0xc2ded3){for(var _0x305276=0x0;_0x305276=_0x6175c0[_0x23e9('0x53')]){throw new Error(_0x23e9('0x54'));}})[_0x23e9('0x24')](function(){if(_0x20ba98){return db[_0x23e9('0x3c')][_0x23e9('0x4a')]({'where':{'membername':_0x20ba98[_0x23e9('0x26')]},'individualHooks':!![]});}})[_0x23e9('0x24')](function(){if(_0x20ba98){return _0x20ba98['getVoiceQueues']({'raw':!![]});}})[_0x23e9('0x24')](function(_0x4e4799){if(_0x20ba98){if(_0x4e4799){var _0x16f68a=[];_0x2ebb46=_0x4e4799;if(_0x2ebb46['length']){for(var _0x2ab6f4=0x0;_0x2ab6f4<_0x2ebb46[_0x23e9('0x2e')];_0x2ab6f4++){_0x16f68a[_0x23e9('0x48')](db[_0x23e9('0x3c')][_0x23e9('0x55')]({'membername':_0x20ba98[_0x23e9('0x26')],'UserId':_0x20ba98['id'],'queue_name':_0x2ebb46[_0x2ab6f4]['name'],'VoiceQueueId':_0x2ebb46[_0x2ab6f4]['id'],'interface':_0x3fbc79,'paused':_0x20ba98[_0x23e9('0x56')]||![],'penalty':_0x2ebb46[_0x2ab6f4][_0x23e9('0x57')]||0x0}));}return BPromise[_0x23e9('0x4b')](_0x16f68a);}}}})[_0x23e9('0x24')](function(){if(_0x20ba98){return db[_0x23e9('0x3d')][_0x23e9('0x1a')]({'where':{'membername':_0x20ba98[_0x23e9('0x26')],'exitAt':null}});}})[_0x23e9('0x24')](function(_0x19c76e){if(_0x20ba98){if(_0x19c76e&&_0x19c76e[_0x23e9('0x2e')]){var _0x1adb79=[];_0x19c76e[_0x23e9('0x30')](function(_0x4656b3){_0x1adb79[_0x23e9('0x48')](_0x4656b3['update']({'exitAt':moment()[_0x23e9('0x2c')](_0x23e9('0x2d'))}));});return BPromise[_0x23e9('0x4b')](_0x1adb79);}}})[_0x23e9('0x24')](function(_0x12d917){if(_0x20ba98){var _0x2985b0=[];var _0x24f8c0=[];var _0x331f00=utils[_0x23e9('0x2f')]();var _0x5880ed={'membername':_0x20ba98[_0x23e9('0x26')],'interface':_0x3fbc79,'enterAt':moment()[_0x23e9('0x2c')](_0x23e9('0x2d')),'role':_0x20ba98[_0x23e9('0x27')],'internal':_0x20ba98[_0x23e9('0x28')]};_0x331f00[_0x23e9('0x30')](function(_0x48a94a){_0x2985b0[_0x23e9('0x48')](_[_0x23e9('0x58')]({'channel':_0x48a94a,'type':_0x23e9('0x59'),'data1':'callysquare','data2':_0x3fbc79},_0x5880ed));if(_0x20ba98[_0x23e9('0x56')]){_0x24f8c0[_0x23e9('0x48')](_[_0x23e9('0x58')]({'channel':_0x48a94a,'type':'PAUSE','data1':_0x23e9('0x5a')},_0x5880ed));}});return db['MemberReport'][_0x23e9('0x36')](_0x2985b0[_0x23e9('0x5b')](_0x24f8c0),{'individualHooks':!![]});}})[_0x23e9('0x24')](function(){if(_0x20ba98){return _0x20ba98[_0x23e9('0x2a')]({'online':!![],'lastLoginAt':moment()[_0x23e9('0x2c')](_0x23e9('0x2d')),'voicePause':_0x20ba98['loginInPause']||![],'mailPause':_0x20ba98[_0x23e9('0x56')]||![],'chatPause':_0x20ba98[_0x23e9('0x56')]||![],'faxPause':_0x20ba98[_0x23e9('0x56')]||![],'smsPause':_0x20ba98['loginInPause']||![],'openchannelPause':_0x20ba98[_0x23e9('0x56')]||![],'pauseType':_0x20ba98[_0x23e9('0x56')]?_0x23e9('0x5a'):null,'lastPauseAt':moment()[_0x23e9('0x2c')](_0x23e9('0x2d')),'interface':_0x3fbc79});}})[_0x23e9('0x24')](function(_0x5e7845){_0x28b0ff(_0x5e7845);})[_0x23e9('0x17')](function(_0x198d80){_0x545048(_0x11f236[_0x23e9('0x14')](0x1f4,_0x198d80[_0x23e9('0x16')]));});});}; \ No newline at end of file +var _0xf914=['agents','getVoiceQueues','upsert','UserVoiceQueue.penalty','merge','LOGIN','callysquare','concat','LOGININPAUSE','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./user.socket','register','request','then','info','request\x20sent','debug','stringify','code','error','User,\x20%s,\x20%s','message','result','catch','GetUser','User','findAll','options','where','attributes','include','map','model','find','raw','ShowUser','PauseUser','name','internal','interface','UserVoiceQueueRt','update','MemberReport','PAUSE','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','push','isNil','body','type','DEFAULT\x20PAUSE','role','uniqueid','bulkCreate','UnpauseUser','findOne','channel','Unknown\x20channel','voice','mail','chat','fax','sms','openchannel','whatsapp','system','set','%s%s','Pause','all','LogoutUser','destroy','LoginUser','mobile','phone','loginInPause','SIP/%s','../../config/license/util'];(function(_0x3d5ad8,_0x338d1c){var _0x40bf6a=function(_0x4be312){while(--_0x4be312){_0x3d5ad8['push'](_0x3d5ad8['shift']());}};_0x40bf6a(++_0x338d1c);}(_0xf914,0x1df));var _0x4f91=function(_0x1d98da,_0x532964){_0x1d98da=_0x1d98da-0x0;var _0x2a56f2=_0xf914[_0x1d98da];return _0x2a56f2;};'use strict';var _=require('lodash');var util=require(_0x4f91('0x0'));var moment=require(_0x4f91('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4f91('0x2'))['db'];var utils=require(_0x4f91('0x3'));var logger=require(_0x4f91('0x4'))(_0x4f91('0x5'));var config=require(_0x4f91('0x6'));var jayson=require(_0x4f91('0x7'));var client=jayson[_0x4f91('0x8')]['http']({'port':0x232a});config[_0x4f91('0x9')]=_[_0x4f91('0xa')](config['redis'],{'host':_0x4f91('0xb'),'port':0x18eb});var socket=require(_0x4f91('0xc'))(new Redis(config[_0x4f91('0x9')]));require(_0x4f91('0xd'))[_0x4f91('0xe')](socket);function respondWithRpcPromise(_0x2e7a6d,_0x392ac3,_0x5d802c){return new BPromise(function(_0x4913d7,_0x3d36e8){return client[_0x4f91('0xf')](_0x2e7a6d,_0x5d802c)[_0x4f91('0x10')](function(_0x7bd8aa){logger[_0x4f91('0x11')]('User,\x20%s,\x20%s',_0x392ac3,_0x4f91('0x12'));logger[_0x4f91('0x13')]('User,\x20%s,\x20%s,\x20%s',_0x392ac3,_0x4f91('0x12'),JSON[_0x4f91('0x14')](_0x7bd8aa));if(_0x7bd8aa['error']){if(_0x7bd8aa['error'][_0x4f91('0x15')]===0x1f4){logger[_0x4f91('0x16')](_0x4f91('0x17'),_0x392ac3,_0x7bd8aa[_0x4f91('0x16')][_0x4f91('0x18')]);return _0x3d36e8(_0x7bd8aa['error'][_0x4f91('0x18')]);}logger[_0x4f91('0x16')](_0x4f91('0x17'),_0x392ac3,_0x7bd8aa[_0x4f91('0x16')][_0x4f91('0x18')]);return _0x4913d7(_0x7bd8aa[_0x4f91('0x16')][_0x4f91('0x18')]);}else{logger[_0x4f91('0x11')](_0x4f91('0x17'),_0x392ac3,_0x4f91('0x12'));_0x4913d7(_0x7bd8aa[_0x4f91('0x19')][_0x4f91('0x18')]);}})[_0x4f91('0x1a')](function(_0x1a836b){logger[_0x4f91('0x16')](_0x4f91('0x17'),_0x392ac3,_0x1a836b);_0x3d36e8(_0x1a836b);});});}exports[_0x4f91('0x1b')]=function(_0x689357){var _0x2f052e=this;return new Promise(function(_0x3a4a41,_0x11617d){return db[_0x4f91('0x1c')][_0x4f91('0x1d')]({'raw':_0x689357[_0x4f91('0x1e')]?_0x689357[_0x4f91('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x689357[_0x4f91('0x1e')]?_0x689357['options'][_0x4f91('0x1f')]||null:null,'attributes':_0x689357[_0x4f91('0x1e')]?_0x689357[_0x4f91('0x1e')][_0x4f91('0x20')]||null:null,'limit':_0x689357[_0x4f91('0x1e')]?_0x689357[_0x4f91('0x1e')]['limit']||null:null,'include':_0x689357['options']?_0x689357[_0x4f91('0x1e')][_0x4f91('0x21')]?_[_0x4f91('0x22')](_0x689357['options'][_0x4f91('0x21')],function(_0x21cbb3){return{'model':db[_0x21cbb3[_0x4f91('0x23')]],'as':_0x21cbb3['as'],'attributes':_0x21cbb3[_0x4f91('0x20')],'include':_0x21cbb3[_0x4f91('0x21')]?_[_0x4f91('0x22')](_0x21cbb3['include'],function(_0x992d35){return{'model':db[_0x992d35[_0x4f91('0x23')]],'as':_0x992d35['as'],'attributes':_0x992d35['attributes'],'include':_0x992d35['include']?_[_0x4f91('0x22')](_0x992d35[_0x4f91('0x21')],function(_0x51b57b){return{'model':db[_0x51b57b[_0x4f91('0x23')]],'as':_0x51b57b['as'],'attributes':_0x51b57b[_0x4f91('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x329a1d){logger[_0x4f91('0x11')](_0x4f91('0x1b'),_0x689357);logger[_0x4f91('0x13')](_0x4f91('0x1b'),_0x689357,JSON['stringify'](_0x329a1d));_0x3a4a41(_0x329a1d);})[_0x4f91('0x1a')](function(_0x49efa6){logger[_0x4f91('0x16')]('GetUser',_0x49efa6[_0x4f91('0x18')],_0x689357);_0x11617d(_0x2f052e[_0x4f91('0x16')](0x1f4,_0x49efa6[_0x4f91('0x18')]));});});};exports['ShowUser']=function(_0x32ea52){var _0x35f95e=this;return new Promise(function(_0x2db4d9,_0xea5dc0){return db[_0x4f91('0x1c')][_0x4f91('0x24')]({'raw':_0x32ea52[_0x4f91('0x1e')]?_0x32ea52[_0x4f91('0x1e')][_0x4f91('0x25')]===undefined?!![]:![]:!![],'where':_0x32ea52[_0x4f91('0x1e')]?_0x32ea52[_0x4f91('0x1e')][_0x4f91('0x1f')]||null:null,'attributes':_0x32ea52[_0x4f91('0x1e')]?_0x32ea52[_0x4f91('0x1e')][_0x4f91('0x20')]||null:null,'include':_0x32ea52[_0x4f91('0x1e')]?_0x32ea52[_0x4f91('0x1e')][_0x4f91('0x21')]?_[_0x4f91('0x22')](_0x32ea52[_0x4f91('0x1e')]['include'],function(_0x326cd4){return{'model':db[_0x326cd4[_0x4f91('0x23')]],'as':_0x326cd4['as'],'attributes':_0x326cd4[_0x4f91('0x20')],'include':_0x326cd4[_0x4f91('0x21')]?_[_0x4f91('0x22')](_0x326cd4[_0x4f91('0x21')],function(_0xcdeefa){return{'model':db[_0xcdeefa[_0x4f91('0x23')]],'as':_0xcdeefa['as'],'attributes':_0xcdeefa[_0x4f91('0x20')],'include':_0xcdeefa[_0x4f91('0x21')]?_[_0x4f91('0x22')](_0xcdeefa[_0x4f91('0x21')],function(_0x290d9d){return{'model':db[_0x290d9d[_0x4f91('0x23')]],'as':_0x290d9d['as'],'attributes':_0x290d9d[_0x4f91('0x20')]};}):[]};}):[]};}):[]:[]})[_0x4f91('0x10')](function(_0x4d3bd8){logger[_0x4f91('0x11')](_0x4f91('0x26'),_0x32ea52);logger[_0x4f91('0x13')](_0x4f91('0x26'),_0x32ea52,JSON[_0x4f91('0x14')](_0x4d3bd8));_0x2db4d9(_0x4d3bd8);})['catch'](function(_0x59f0cd){logger[_0x4f91('0x16')]('ShowUser',_0x59f0cd[_0x4f91('0x18')],_0x32ea52);_0xea5dc0(_0x35f95e[_0x4f91('0x16')](0x1f4,_0x59f0cd[_0x4f91('0x18')]));});});};exports[_0x4f91('0x27')]=function(_0x38ce64){var _0x492ba6=this;return new Promise(function(_0x3156e6,_0x67e9f0){var _0x14aa98;return db[_0x4f91('0x1c')][_0x4f91('0x24')]({'where':_0x38ce64['options'][_0x4f91('0x1f')]||{},'attributes':['id',_0x4f91('0x28'),'role',_0x4f91('0x29'),_0x4f91('0x2a')]})['then'](function(_0x42ceac){if(_0x42ceac){_0x14aa98=_0x42ceac;return db[_0x4f91('0x2b')][_0x4f91('0x2c')]({'paused':0x1},{'where':{'UserId':_0x14aa98['id']},'individualHooks':!![]});}})['then'](function(){if(_0x14aa98){return db[_0x4f91('0x2d')][_0x4f91('0x1d')]({'where':{'membername':_0x14aa98[_0x4f91('0x28')],'type':_0x4f91('0x2e'),'exitAt':null}});}})[_0x4f91('0x10')](function(_0x55b549){if(_0x14aa98){if(_0x55b549&&_0x55b549[_0x4f91('0x2f')]){var _0x3f1d9e=moment()[_0x4f91('0x30')](_0x4f91('0x31'));for(var _0x105f3f=0x0,_0x5f407d=_0x55b549[_0x4f91('0x2f')];_0x105f3f<_0x5f407d;_0x105f3f++){_0x55b549[_0x105f3f][_0x4f91('0x32')]({'exitAt':_0x3f1d9e});}}}})['then'](function(){if(_0x14aa98){var _0x31591b=[];var _0x78670=utils[_0x4f91('0x33')]();_0x78670[_0x4f91('0x34')](function(_0x233ef1){_0x31591b[_0x4f91('0x35')]({'channel':_0x233ef1,'membername':_0x14aa98[_0x4f91('0x28')],'interface':_[_0x4f91('0x36')](_0x14aa98[_0x4f91('0x2a')])?util[_0x4f91('0x30')]('SIP/%s',_0x14aa98[_0x4f91('0x28')]):_0x14aa98[_0x4f91('0x2a')],'type':_0x4f91('0x2e'),'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x38ce64[_0x4f91('0x37')][_0x4f91('0x38')]||_0x4f91('0x39'),'role':_0x14aa98[_0x4f91('0x3a')],'internal':_0x14aa98[_0x4f91('0x29')],'uniqueid':_0x38ce64[_0x4f91('0x37')][_0x4f91('0x3b')]||null});});return db[_0x4f91('0x2d')][_0x4f91('0x3c')](_0x31591b,{'individualHooks':!![]});}})['then'](function(){if(_0x14aa98){return _0x14aa98[_0x4f91('0x2c')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x38ce64['body'][_0x4f91('0x38')]||_0x4f91('0x39'),'lastPauseAt':moment()[_0x4f91('0x30')](_0x4f91('0x31'))});}})[_0x4f91('0x10')](function(_0x2278d8){_0x3156e6(_0x2278d8);})[_0x4f91('0x1a')](function(_0x5dfc81){_0x67e9f0(_0x492ba6['error'](0x1f4,_0x5dfc81[_0x4f91('0x18')]));});});};exports[_0x4f91('0x3d')]=function(_0x1fa3f5){var _0x25e8d4=this;return new Promise(function(_0x16cd02,_0x1ba5d0){var _0x3f7c6c;return db[_0x4f91('0x1c')][_0x4f91('0x3e')]({'where':_0x1fa3f5['options'][_0x4f91('0x1f')]||{},'attributes':['id',_0x4f91('0x28')]})['then'](function(_0x565029){if(_0x565029){_0x3f7c6c=_0x565029;if(_0x1fa3f5[_0x4f91('0x37')][_0x4f91('0x3f')]&&!utils['isValidChannel'](_0x1fa3f5[_0x4f91('0x37')][_0x4f91('0x3f')])){throw new Error(_0x4f91('0x40'));}switch(_0x1fa3f5['body'][_0x4f91('0x3f')]){case _0x4f91('0x41'):return db[_0x4f91('0x2b')][_0x4f91('0x2c')]({'paused':0x0},{'where':{'UserId':_0x3f7c6c['id']}})[_0x4f91('0x10')](function(){return db['MemberReport'][_0x4f91('0x24')]({'where':{'channel':_0x1fa3f5[_0x4f91('0x37')]['channel'],'membername':_0x3f7c6c[_0x4f91('0x28')],'type':_0x4f91('0x2e'),'exitAt':null}});})['then'](function(_0xc0a46c){if(_0xc0a46c){return _0xc0a46c[_0x4f91('0x2c')]({'exitAt':moment()[_0x4f91('0x30')](_0x4f91('0x31')),'data2':'system'},{'individualHooks':!![]});}return null;})[_0x4f91('0x10')](function(){return _0x3f7c6c[_0x4f91('0x2c')]({'voicePause':![]});});case _0x4f91('0x42'):case _0x4f91('0x43'):case _0x4f91('0x44'):case _0x4f91('0x45'):case _0x4f91('0x46'):case _0x4f91('0x47'):return db[_0x4f91('0x2d')][_0x4f91('0x24')]({'where':{'channel':_0x1fa3f5[_0x4f91('0x37')][_0x4f91('0x3f')],'membername':_0x3f7c6c[_0x4f91('0x28')],'type':_0x4f91('0x2e'),'exitAt':null}})[_0x4f91('0x10')](function(_0x39b7ca){return _0x39b7ca[_0x4f91('0x2c')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x4f91('0x48')},{'individualHooks':!![]});})[_0x4f91('0x10')](function(){var _0x1deaed={};_[_0x4f91('0x49')](_0x1deaed,util[_0x4f91('0x30')](_0x4f91('0x4a'),_0x1fa3f5['body']['channel'],_0x4f91('0x4b')),![]);return _0x3f7c6c[_0x4f91('0x2c')](_0x1deaed);});default:return db['UserVoiceQueueRt'][_0x4f91('0x2c')]({'paused':0x0},{'where':{'UserId':_0x3f7c6c['id']}})[_0x4f91('0x10')](function(){return db[_0x4f91('0x2d')][_0x4f91('0x1d')]({'where':{'membername':_0x3f7c6c['name'],'type':_0x4f91('0x2e'),'exitAt':null}});})[_0x4f91('0x10')](function(_0x183d88){var _0x391421=[];_0x183d88[_0x4f91('0x34')](function(_0x3ce5b8){_0x391421[_0x4f91('0x35')](_0x3ce5b8[_0x4f91('0x2c')]({'exitAt':moment()[_0x4f91('0x30')](_0x4f91('0x31')),'data2':_0x4f91('0x48')}));});return BPromise[_0x4f91('0x4c')](_0x391421);})[_0x4f91('0x10')](function(){return _0x3f7c6c[_0x4f91('0x2c')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0x4f91('0x10')](function(_0x5a0171){_0x16cd02(_0x5a0171);})['catch'](function(_0x4d5ec4){_0x1ba5d0(_0x25e8d4[_0x4f91('0x16')](0x1f4,_0x4d5ec4[_0x4f91('0x18')]));});});};exports[_0x4f91('0x4d')]=function(_0xd8feb4){var _0x2a1eac=this;return new Promise(function(_0x473552,_0x4d4feb){var _0x43ba2c;return db[_0x4f91('0x1c')][_0x4f91('0x3e')]({'where':_0xd8feb4[_0x4f91('0x1e')][_0x4f91('0x1f')]||{},'attributes':['id','name']})[_0x4f91('0x10')](function(_0x1bf22b){if(_0x1bf22b){_0x43ba2c=_0x1bf22b;return db[_0x4f91('0x2b')][_0x4f91('0x4e')]({'where':{'membername':_0x43ba2c[_0x4f91('0x28')]},'individualHooks':!![]});}})[_0x4f91('0x10')](function(){if(_0x43ba2c){return db[_0x4f91('0x2d')][_0x4f91('0x1d')]({'where':{'membername':_0x43ba2c['name'],'exitAt':null}});}})[_0x4f91('0x10')](function(_0x1b1966){if(_0x43ba2c){if(_0x1b1966&&_0x1b1966[_0x4f91('0x2f')]){var _0x3ced0e=[];_0x1b1966['forEach'](function(_0x4e8151){_0x3ced0e[_0x4f91('0x35')](_0x4e8151[_0x4f91('0x2c')]({'exitAt':moment()['format'](_0x4f91('0x31'))}));});return BPromise[_0x4f91('0x4c')](_0x3ced0e);}}})[_0x4f91('0x10')](function(){if(_0x43ba2c){return _0x43ba2c['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0x6643a3){_0x473552(_0x6643a3);})[_0x4f91('0x1a')](function(_0x325972){_0x4d4feb(_0x2a1eac['error'](0x1f4,_0x325972[_0x4f91('0x18')]));});});};exports[_0x4f91('0x4f')]=function(_0x42a329){var _0x2b5891=this;return new Promise(function(_0x54e36f,_0x4311a5){var _0x499414;var _0x16477e;var _0x5522ea;var _0x37cfba;return db['User']['findOne']({'where':_0x42a329[_0x4f91('0x1e')][_0x4f91('0x1f')]||{},'attributes':['id',_0x4f91('0x28'),_0x4f91('0x3a'),_0x4f91('0x50'),_0x4f91('0x51'),_0x4f91('0x29'),_0x4f91('0x52'),_0x4f91('0x2a')]})['then'](function(_0x53287a){if(_0x53287a){_0x499414=_0x53287a;_0x37cfba=_0x42a329['body']['interface']?_0x42a329[_0x4f91('0x37')][_0x4f91('0x2a')]:util['format'](_0x4f91('0x53'),_0x499414[_0x4f91('0x28')]);return db['User']['count']({'where':{'role':'agent','online':!![],'id':{'$ne':_0x499414['id']}}});}})[_0x4f91('0x10')](function(_0x50ea41){if(_0x50ea41){_0x5522ea=_0x50ea41;return require(_0x4f91('0x54'))['getLicense']();}})[_0x4f91('0x10')](function(_0x1fe06b){if(_0x1fe06b&&_0x1fe06b[_0x4f91('0x55')]&&_0x5522ea>=_0x1fe06b['agents']){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x4f91('0x10')](function(){if(_0x499414){return db[_0x4f91('0x2b')][_0x4f91('0x4e')]({'where':{'membername':_0x499414[_0x4f91('0x28')]},'individualHooks':!![]});}})[_0x4f91('0x10')](function(){if(_0x499414){return _0x499414[_0x4f91('0x56')]({'raw':!![]});}})['then'](function(_0x1f77d9){if(_0x499414){if(_0x1f77d9){var _0xff2db=[];_0x16477e=_0x1f77d9;if(_0x16477e[_0x4f91('0x2f')]){for(var _0x50c3da=0x0;_0x50c3da<_0x16477e[_0x4f91('0x2f')];_0x50c3da++){_0xff2db[_0x4f91('0x35')](db[_0x4f91('0x2b')][_0x4f91('0x57')]({'membername':_0x499414['name'],'UserId':_0x499414['id'],'queue_name':_0x16477e[_0x50c3da][_0x4f91('0x28')],'VoiceQueueId':_0x16477e[_0x50c3da]['id'],'interface':_0x37cfba,'paused':_0x499414[_0x4f91('0x52')]||![],'penalty':_0x16477e[_0x50c3da][_0x4f91('0x58')]||0x0}));}return BPromise[_0x4f91('0x4c')](_0xff2db);}}}})[_0x4f91('0x10')](function(){if(_0x499414){return db[_0x4f91('0x2d')][_0x4f91('0x1d')]({'where':{'membername':_0x499414['name'],'exitAt':null}});}})[_0x4f91('0x10')](function(_0x435f8d){if(_0x499414){if(_0x435f8d&&_0x435f8d[_0x4f91('0x2f')]){var _0x53abc4=[];_0x435f8d[_0x4f91('0x34')](function(_0x349913){_0x53abc4['push'](_0x349913[_0x4f91('0x2c')]({'exitAt':moment()[_0x4f91('0x30')](_0x4f91('0x31'))}));});return BPromise[_0x4f91('0x4c')](_0x53abc4);}}})[_0x4f91('0x10')](function(_0x2be826){if(_0x499414){var _0xa33b04=[];var _0x236231=[];var _0x230a63=utils[_0x4f91('0x33')]();var _0x1687df={'membername':_0x499414['name'],'interface':_0x37cfba,'enterAt':moment()[_0x4f91('0x30')](_0x4f91('0x31')),'role':_0x499414['role'],'internal':_0x499414[_0x4f91('0x29')]};_0x230a63[_0x4f91('0x34')](function(_0x19d753){_0xa33b04[_0x4f91('0x35')](_[_0x4f91('0x59')]({'channel':_0x19d753,'type':_0x4f91('0x5a'),'data1':_0x4f91('0x5b'),'data2':_0x37cfba},_0x1687df));if(_0x499414['loginInPause']){_0x236231[_0x4f91('0x35')](_[_0x4f91('0x59')]({'channel':_0x19d753,'type':'PAUSE','data1':'LOGININPAUSE'},_0x1687df));}});return db[_0x4f91('0x2d')][_0x4f91('0x3c')](_0xa33b04[_0x4f91('0x5c')](_0x236231),{'individualHooks':!![]});}})[_0x4f91('0x10')](function(){if(_0x499414){return _0x499414['update']({'online':!![],'lastLoginAt':moment()[_0x4f91('0x30')](_0x4f91('0x31')),'voicePause':_0x499414['loginInPause']||![],'mailPause':_0x499414['loginInPause']||![],'chatPause':_0x499414[_0x4f91('0x52')]||![],'faxPause':_0x499414[_0x4f91('0x52')]||![],'smsPause':_0x499414[_0x4f91('0x52')]||![],'openchannelPause':_0x499414[_0x4f91('0x52')]||![],'pauseType':_0x499414[_0x4f91('0x52')]?_0x4f91('0x5d'):null,'lastPauseAt':moment()[_0x4f91('0x30')](_0x4f91('0x31')),'interface':_0x37cfba});}})[_0x4f91('0x10')](function(_0xad2d8b){_0x54e36f(_0xad2d8b);})[_0x4f91('0x1a')](function(_0x1664d3){_0x4311a5(_0x2b5891[_0x4f91('0x16')](0x1f4,_0x1664d3[_0x4f91('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index b490c2f..9360564 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 _0x4329=['user:','save','remove','update','removeListener','register'];(function(_0x34102a,_0x2e6ac0){var _0x847099=function(_0x3178de){while(--_0x3178de){_0x34102a['push'](_0x34102a['shift']());}};_0x847099(++_0x2e6ac0);}(_0x4329,0xfd));var _0x9432=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x4329[_0x40ac5e];return _0x2839d6;};'use strict';var UserEvents=require('./user.events');var events=[_0x9432('0x0'),_0x9432('0x1'),_0x9432('0x2')];function createListener(_0x63f9fd,_0x1d096e){return function(_0x14dfb8){_0x1d096e['emit'](_0x63f9fd,_0x14dfb8);};}function removeListener(_0x2c5991,_0x581f81){return function(){UserEvents[_0x9432('0x3')](_0x2c5991,_0x581f81);};}exports[_0x9432('0x4')]=function(_0x25578b){for(var _0x21883c=0x0,_0x2fbe74=events['length'];_0x21883c<_0x2fbe74;_0x21883c++){var _0x39d112=events[_0x21883c];var _0x5480da=createListener(_0x9432('0x5')+_0x39d112,_0x25578b);UserEvents['on'](_0x39d112,_0x5480da);}}; \ No newline at end of file +var _0x01a7=['length','user:','save','remove','update'];(function(_0x2d98f1,_0x21174b){var _0x701cc7=function(_0x24dd62){while(--_0x24dd62){_0x2d98f1['push'](_0x2d98f1['shift']());}};_0x701cc7(++_0x21174b);}(_0x01a7,0x1e2));var _0x701a=function(_0x2937ea,_0x43a2a9){_0x2937ea=_0x2937ea-0x0;var _0x40b81b=_0x01a7[_0x2937ea];return _0x40b81b;};'use strict';var UserEvents=require('./user.events');var events=[_0x701a('0x0'),_0x701a('0x1'),_0x701a('0x2')];function createListener(_0x274b92,_0x58fb84){return function(_0x19ad9c){_0x58fb84['emit'](_0x274b92,_0x19ad9c);};}function removeListener(_0x4937cb,_0x383fd0){return function(){UserEvents['removeListener'](_0x4937cb,_0x383fd0);};}exports['register']=function(_0x1d3a8f){for(var _0x599c01=0x0,_0x450bd2=events[_0x701a('0x3')];_0x599c01<_0x450bd2;_0x599c01++){var _0x44f3f7=events[_0x599c01];var _0x341b14=createListener(_0x701a('0x4')+_0x44f3f7,_0x1d3a8f);UserEvents['on'](_0x44f3f7,_0x341b14);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 8237f83..640ed06 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(_0x1f16ea,_0x599779){var _0x479f21=function(_0x510bcc){while(--_0x510bcc){_0x1f16ea['push'](_0x1f16ea['shift']());}};_0x479f21(++_0x599779);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x378727,_0x4bd0fd){var _0x1bf63a=function(_0x55420d){while(--_0x55420d){_0x378727['push'](_0x378727['shift']());}};_0x1bf63a(++_0x4bd0fd);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5cb97e,_0x132a39){_0x5cb97e=_0x5cb97e-0x0;var _0x1714b4=_0xcb91[_0x5cb97e];return _0x1714b4;};'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/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 9006424..574ca60 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. * // * * // ************************************************************************* -'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xc43d=['INTEGER','sequelize','exports'];(function(_0x3e0816,_0x18d9d3){var _0x4386f2=function(_0x349e3b){while(--_0x349e3b){_0x3e0816['push'](_0x3e0816['shift']());}};_0x4386f2(++_0x18d9d3);}(_0xc43d,0xb2));var _0xdc43=function(_0x382e89,_0x4768c0){_0x382e89=_0x382e89-0x0;var _0x3a1318=_0xc43d[_0x382e89];return _0x3a1318;};'use strict';var Sequelize=require(_0xdc43('0x0'));module[_0xdc43('0x1')]={'penalty':{'type':Sequelize[_0xdc43('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index b2943ed..e309db3 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 _0x5fd5=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','UserChatQueue','user_has_chat_queues'];(function(_0xa1d28a,_0x4a7680){var _0x4a2353=function(_0x454d39){while(--_0x454d39){_0xa1d28a['push'](_0xa1d28a['shift']());}};_0x4a2353(++_0x4a7680);}(_0x5fd5,0x1e1));var _0x55fd=function(_0x5e7832,_0xbd5e51){_0x5e7832=_0x5e7832-0x0;var _0x3abae7=_0x5fd5[_0x5e7832];return _0x3abae7;};'use strict';var _=require(_0x55fd('0x0'));var util=require(_0x55fd('0x1'));var logger=require(_0x55fd('0x2'))(_0x55fd('0x3'));var moment=require(_0x55fd('0x4'));var BPromise=require(_0x55fd('0x5'));var rp=require(_0x55fd('0x6'));var fs=require('fs');var path=require(_0x55fd('0x7'));var rimraf=require(_0x55fd('0x8'));var config=require(_0x55fd('0x9'));var attributes=require(_0x55fd('0xa'));module['exports']=function(_0xa25984,_0x4c2f39){return _0xa25984['define'](_0x55fd('0xb'),attributes,{'tableName':_0x55fd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb507=['path','rimraf','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','moment','bluebird'];(function(_0x4e5ff5,_0x2e6959){var _0x3a84c6=function(_0x1d02ff){while(--_0x1d02ff){_0x4e5ff5['push'](_0x4e5ff5['shift']());}};_0x3a84c6(++_0x2e6959);}(_0xb507,0xa3));var _0x7b50=function(_0x30d87a,_0xf3a07f){_0x30d87a=_0x30d87a-0x0;var _0x48f64b=_0xb507[_0x30d87a];return _0x48f64b;};'use strict';var _=require(_0x7b50('0x0'));var util=require(_0x7b50('0x1'));var logger=require(_0x7b50('0x2'))('api');var moment=require(_0x7b50('0x3'));var BPromise=require(_0x7b50('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7b50('0x5'));var rimraf=require(_0x7b50('0x6'));var config=require('../../config/environment');var attributes=require(_0x7b50('0x7'));module[_0x7b50('0x8')]=function(_0x35b1be,_0xe5a6fa){return _0x35b1be[_0x7b50('0x9')](_0x7b50('0xa'),attributes,{'tableName':_0x7b50('0xb'),'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 a16e4ad..b7cc025 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 _0x7f8d=['error','code','message','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s'];(function(_0x5d4071,_0x226b8f){var _0x1e0f57=function(_0x38d286){while(--_0x38d286){_0x5d4071['push'](_0x5d4071['shift']());}};_0x1e0f57(++_0x226b8f);}(_0x7f8d,0x193));var _0xd7f8=function(_0x42109d,_0xb5c200){_0x42109d=_0x42109d-0x0;var _0x479dc3=_0x7f8d[_0x42109d];return _0x479dc3;};'use strict';var _=require('lodash');var util=require(_0xd7f8('0x0'));var moment=require('moment');var BPromise=require(_0xd7f8('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd7f8('0x2'));var db=require(_0xd7f8('0x3'))['db'];var utils=require(_0xd7f8('0x4'));var logger=require(_0xd7f8('0x5'))(_0xd7f8('0x6'));var config=require(_0xd7f8('0x7'));var jayson=require(_0xd7f8('0x8'));var client=jayson['client'][_0xd7f8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2764f9,_0x48cb7e,_0x34ca8d){return new BPromise(function(_0x4b4fbb,_0x362b82){return client[_0xd7f8('0xa')](_0x2764f9,_0x34ca8d)[_0xd7f8('0xb')](function(_0x50a478){logger[_0xd7f8('0xc')](_0xd7f8('0xd'),_0x48cb7e,_0xd7f8('0xe'));logger[_0xd7f8('0xf')](_0xd7f8('0x10'),_0x48cb7e,'request\x20sent',JSON['stringify'](_0x50a478));if(_0x50a478['error']){if(_0x50a478[_0xd7f8('0x11')][_0xd7f8('0x12')]===0x1f4){logger[_0xd7f8('0x11')](_0xd7f8('0xd'),_0x48cb7e,_0x50a478['error'][_0xd7f8('0x13')]);return _0x362b82(_0x50a478[_0xd7f8('0x11')]['message']);}logger['error'](_0xd7f8('0xd'),_0x48cb7e,_0x50a478[_0xd7f8('0x11')][_0xd7f8('0x13')]);return _0x4b4fbb(_0x50a478[_0xd7f8('0x11')][_0xd7f8('0x13')]);}else{logger[_0xd7f8('0xc')](_0xd7f8('0xd'),_0x48cb7e,_0xd7f8('0xe'));_0x4b4fbb(_0x50a478['result'][_0xd7f8('0x13')]);}})['catch'](function(_0x765a98){logger[_0xd7f8('0x11')](_0xd7f8('0xd'),_0x48cb7e,_0x765a98);_0x362b82(_0x765a98);});});} \ No newline at end of file +var _0xe5e0=['client','http','request','then','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserChatQueue,\x20%s,\x20%s','message','info','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xe5e0,0xea));var _0x0e5e=function(_0x39d678,_0x407c41){_0x39d678=_0x39d678-0x0;var _0x25a94d=_0xe5e0[_0x39d678];return _0x25a94d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0e5e('0x0'));var BPromise=require(_0x0e5e('0x1'));var rs=require(_0x0e5e('0x2'));var fs=require('fs');var Redis=require(_0x0e5e('0x3'));var db=require(_0x0e5e('0x4'))['db'];var utils=require(_0x0e5e('0x5'));var logger=require(_0x0e5e('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0e5e('0x7'));var client=jayson[_0x0e5e('0x8')][_0x0e5e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x85c636,_0xef34dd,_0x2ccd2b){return new BPromise(function(_0x3260fa,_0x5bb7fb){return client[_0x0e5e('0xa')](_0x85c636,_0x2ccd2b)[_0x0e5e('0xb')](function(_0x4d4767){logger['info']('UserChatQueue,\x20%s,\x20%s',_0xef34dd,_0x0e5e('0xc'));logger[_0x0e5e('0xd')](_0x0e5e('0xe'),_0xef34dd,'request\x20sent',JSON[_0x0e5e('0xf')](_0x4d4767));if(_0x4d4767[_0x0e5e('0x10')]){if(_0x4d4767[_0x0e5e('0x10')][_0x0e5e('0x11')]===0x1f4){logger[_0x0e5e('0x10')](_0x0e5e('0x12'),_0xef34dd,_0x4d4767[_0x0e5e('0x10')][_0x0e5e('0x13')]);return _0x5bb7fb(_0x4d4767['error'][_0x0e5e('0x13')]);}logger[_0x0e5e('0x10')](_0x0e5e('0x12'),_0xef34dd,_0x4d4767['error']['message']);return _0x3260fa(_0x4d4767[_0x0e5e('0x10')]['message']);}else{logger[_0x0e5e('0x14')]('UserChatQueue,\x20%s,\x20%s',_0xef34dd,'request\x20sent');_0x3260fa(_0x4d4767[_0x0e5e('0x15')][_0x0e5e('0x13')]);}})['catch'](function(_0x6bd02c){logger[_0x0e5e('0x10')](_0x0e5e('0x12'),_0xef34dd,_0x6bd02c);_0x5bb7fb(_0x6bd02c);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 9bdf618..493be7a 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x276468,_0x29685a){var _0x36dc3a=function(_0x291f0a){while(--_0x291f0a){_0x276468['push'](_0x276468['shift']());}};_0x36dc3a(++_0x29685a);}(_0x9c44,0x178));var _0x49c4=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x9c44[_0x3b0731];return _0x4204d7;};'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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x13cc27,_0x3ced55){var _0x533dfa=function(_0x2d30da){while(--_0x2d30da){_0x13cc27['push'](_0x13cc27['shift']());}};_0x533dfa(++_0x3ced55);}(_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/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index d8af06b..a78ac4d 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 _0x9944=['INTEGER','STRING','sequelize'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x9944,0xb9));var _0x4994=function(_0x4f5495,_0x3fc61c){_0x4f5495=_0x4f5495-0x0;var _0x26f9bc=_0x9944[_0x4f5495];return _0x26f9bc;};'use strict';var Sequelize=require(_0x4994('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x4994('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x4994('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x4994('0x2')]}}; \ No newline at end of file +var _0x4220=['exports','INTEGER','STRING'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x4220,0x138));var _0x0422=function(_0xc9383c,_0x2d3ba8){_0xc9383c=_0xc9383c-0x0;var _0x4731a1=_0x4220[_0xc9383c];return _0x4731a1;};'use strict';var Sequelize=require('sequelize');module[_0x0422('0x0')]={'penalty':{'type':Sequelize[_0x0422('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x0422('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x0422('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index c6b7f2b..b8f8265 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 _0xafbc=['request-promise','path','rimraf','./userFaxQueue.attributes','define','UserFaxQueue','lodash','util','../../config/logger','moment'];(function(_0x31eca3,_0x1546d9){var _0x5e01cc=function(_0xbc6d8c){while(--_0xbc6d8c){_0x31eca3['push'](_0x31eca3['shift']());}};_0x5e01cc(++_0x1546d9);}(_0xafbc,0x1aa));var _0xcafb=function(_0x4bf8be,_0x559004){_0x4bf8be=_0x4bf8be-0x0;var _0x1219d8=_0xafbc[_0x4bf8be];return _0x1219d8;};'use strict';var _=require(_0xcafb('0x0'));var util=require(_0xcafb('0x1'));var logger=require(_0xcafb('0x2'))('api');var moment=require(_0xcafb('0x3'));var BPromise=require('bluebird');var rp=require(_0xcafb('0x4'));var fs=require('fs');var path=require(_0xcafb('0x5'));var rimraf=require(_0xcafb('0x6'));var config=require('../../config/environment');var attributes=require(_0xcafb('0x7'));module['exports']=function(_0x48c90d,_0x17909a){return _0x48c90d[_0xcafb('0x8')](_0xcafb('0x9'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x559c=['path','rimraf','./userFaxQueue.attributes','UserFaxQueue','user_has_fax_queues','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x598915,_0x2b8d26){var _0x4981ba=function(_0x2b1d8e){while(--_0x2b1d8e){_0x598915['push'](_0x598915['shift']());}};_0x4981ba(++_0x2b8d26);}(_0x559c,0x7e));var _0xc559=function(_0x2de4e6,_0x2dbab4){_0x2de4e6=_0x2de4e6-0x0;var _0x156984=_0x559c[_0x2de4e6];return _0x156984;};'use strict';var _=require('lodash');var util=require(_0xc559('0x0'));var logger=require(_0xc559('0x1'))(_0xc559('0x2'));var moment=require(_0xc559('0x3'));var BPromise=require(_0xc559('0x4'));var rp=require(_0xc559('0x5'));var fs=require('fs');var path=require(_0xc559('0x6'));var rimraf=require(_0xc559('0x7'));var config=require('../../config/environment');var attributes=require(_0xc559('0x8'));module['exports']=function(_0x4ea0bc,_0xf77a6){return _0x4ea0bc['define'](_0xc559('0x9'),attributes,{'tableName':_0xc559('0xa'),'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 ddbda6d..caac894 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 _0xe06b=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x2f2632,_0x1e4404){var _0xadf4a7=function(_0x36c5e9){while(--_0x36c5e9){_0x2f2632['push'](_0x2f2632['shift']());}};_0xadf4a7(++_0x1e4404);}(_0xe06b,0x65));var _0xbe06=function(_0x9981c0,_0x38cae0){_0x9981c0=_0x9981c0-0x0;var _0xaad355=_0xe06b[_0x9981c0];return _0xaad355;};'use strict';var _=require(_0xbe06('0x0'));var util=require(_0xbe06('0x1'));var moment=require(_0xbe06('0x2'));var BPromise=require(_0xbe06('0x3'));var rs=require(_0xbe06('0x4'));var fs=require('fs');var Redis=require(_0xbe06('0x5'));var db=require(_0xbe06('0x6'))['db'];var utils=require(_0xbe06('0x7'));var logger=require(_0xbe06('0x8'))(_0xbe06('0x9'));var config=require(_0xbe06('0xa'));var jayson=require(_0xbe06('0xb'));var client=jayson[_0xbe06('0xc')][_0xbe06('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1ee655,_0x2902d4,_0x33515f){return new BPromise(function(_0x47a392,_0x511a76){return client[_0xbe06('0xe')](_0x1ee655,_0x33515f)[_0xbe06('0xf')](function(_0x53a1ca){logger[_0xbe06('0x10')](_0xbe06('0x11'),_0x2902d4,_0xbe06('0x12'));logger[_0xbe06('0x13')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x2902d4,'request\x20sent',JSON[_0xbe06('0x14')](_0x53a1ca));if(_0x53a1ca['error']){if(_0x53a1ca[_0xbe06('0x15')][_0xbe06('0x16')]===0x1f4){logger[_0xbe06('0x15')](_0xbe06('0x11'),_0x2902d4,_0x53a1ca[_0xbe06('0x15')]['message']);return _0x511a76(_0x53a1ca[_0xbe06('0x15')][_0xbe06('0x17')]);}logger[_0xbe06('0x15')](_0xbe06('0x11'),_0x2902d4,_0x53a1ca['error'][_0xbe06('0x17')]);return _0x47a392(_0x53a1ca[_0xbe06('0x15')][_0xbe06('0x17')]);}else{logger[_0xbe06('0x10')]('UserFaxQueue,\x20%s,\x20%s',_0x2902d4,_0xbe06('0x12'));_0x47a392(_0x53a1ca[_0xbe06('0x18')][_0xbe06('0x17')]);}})[_0xbe06('0x19')](function(_0x413b95){logger[_0xbe06('0x15')](_0xbe06('0x11'),_0x2902d4,_0x413b95);_0x511a76(_0x413b95);});});} \ No newline at end of file +var _0x5ff2=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x446cd,_0x37682f){var _0x3ca453=function(_0x4ecb28){while(--_0x4ecb28){_0x446cd['push'](_0x446cd['shift']());}};_0x3ca453(++_0x37682f);}(_0x5ff2,0x107));var _0x25ff=function(_0x3817a9,_0x29e215){_0x3817a9=_0x3817a9-0x0;var _0x443f30=_0x5ff2[_0x3817a9];return _0x443f30;};'use strict';var _=require(_0x25ff('0x0'));var util=require(_0x25ff('0x1'));var moment=require(_0x25ff('0x2'));var BPromise=require(_0x25ff('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x25ff('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x25ff('0x5'));var logger=require(_0x25ff('0x6'))(_0x25ff('0x7'));var config=require('../../config/environment');var jayson=require(_0x25ff('0x8'));var client=jayson['client'][_0x25ff('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x54e644,_0x22a30c,_0x453477){return new BPromise(function(_0x3faa68,_0x77209c){return client['request'](_0x54e644,_0x453477)['then'](function(_0x422a73){logger[_0x25ff('0xa')](_0x25ff('0xb'),_0x22a30c,_0x25ff('0xc'));logger['debug'](_0x25ff('0xd'),_0x22a30c,_0x25ff('0xc'),JSON[_0x25ff('0xe')](_0x422a73));if(_0x422a73[_0x25ff('0xf')]){if(_0x422a73[_0x25ff('0xf')][_0x25ff('0x10')]===0x1f4){logger[_0x25ff('0xf')](_0x25ff('0xb'),_0x22a30c,_0x422a73[_0x25ff('0xf')][_0x25ff('0x11')]);return _0x77209c(_0x422a73[_0x25ff('0xf')][_0x25ff('0x11')]);}logger[_0x25ff('0xf')](_0x25ff('0xb'),_0x22a30c,_0x422a73[_0x25ff('0xf')]['message']);return _0x3faa68(_0x422a73[_0x25ff('0xf')]['message']);}else{logger[_0x25ff('0xa')](_0x25ff('0xb'),_0x22a30c,_0x25ff('0xc'));_0x3faa68(_0x422a73[_0x25ff('0x12')]['message']);}})[_0x25ff('0x13')](function(_0x4ea97c){logger['error'](_0x25ff('0xb'),_0x22a30c,_0x4ea97c);_0x77209c(_0x4ea97c);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 95eb08e..d2831f0 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0xce754,_0x597abb){var _0x53e1e1=function(_0x2fb554){while(--_0x2fb554){_0xce754['push'](_0xce754['shift']());}};_0x53e1e1(++_0x597abb);}(_0x9c44,0x178));var _0x49c4=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x9c44[_0xdea41a];return _0x15d0d8;};'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(_0x108b6d,_0x5c6a3a){var _0x278905=function(_0x3c46ce){while(--_0x3c46ce){_0x108b6d['push'](_0x108b6d['shift']());}};_0x278905(++_0x5c6a3a);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xcb91[_0x17b6e3];return _0x3906f3;};'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 664d394..f841e12 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 _0x531f=['exports','INTEGER','sequelize'];(function(_0x2acec0,_0x42a0f2){var _0x2ca97e=function(_0x522776){while(--_0x522776){_0x2acec0['push'](_0x2acec0['shift']());}};_0x2ca97e(++_0x42a0f2);}(_0x531f,0x16a));var _0xf531=function(_0x11f4b5,_0x279f0d){_0x11f4b5=_0x11f4b5-0x0;var _0x59d5e0=_0x531f[_0x11f4b5];return _0x59d5e0;};'use strict';var Sequelize=require(_0xf531('0x0'));module[_0xf531('0x1')]={'penalty':{'type':Sequelize[_0xf531('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6d19=['INTEGER','sequelize','exports'];(function(_0x5b4bb8,_0x2c2788){var _0x52cc5b=function(_0x2e1a1e){while(--_0x2e1a1e){_0x5b4bb8['push'](_0x5b4bb8['shift']());}};_0x52cc5b(++_0x2c2788);}(_0x6d19,0x160));var _0x96d1=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0x6d19[_0x26462c];return _0x509a42;};'use strict';var Sequelize=require(_0x96d1('0x0'));module[_0x96d1('0x1')]={'penalty':{'type':Sequelize[_0x96d1('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 143db48..b5611f9 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 _0x0a85=['api','bluebird','path','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger'];(function(_0xd8a8af,_0x1e93f0){var _0x5b7278=function(_0x458800){while(--_0x458800){_0xd8a8af['push'](_0xd8a8af['shift']());}};_0x5b7278(++_0x1e93f0);}(_0x0a85,0x1b9));var _0x50a8=function(_0x2a4218,_0x5adfdf){_0x2a4218=_0x2a4218-0x0;var _0x101111=_0x0a85[_0x2a4218];return _0x101111;};'use strict';var _=require(_0x50a8('0x0'));var util=require(_0x50a8('0x1'));var logger=require(_0x50a8('0x2'))(_0x50a8('0x3'));var moment=require('moment');var BPromise=require(_0x50a8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x50a8('0x5'));var rimraf=require('rimraf');var config=require(_0x50a8('0x6'));var attributes=require(_0x50a8('0x7'));module[_0x50a8('0x8')]=function(_0x54dd7e,_0x9a4956){return _0x54dd7e[_0x50a8('0x9')](_0x50a8('0xa'),attributes,{'tableName':_0x50a8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x292d=['request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','util','../../config/logger','api','bluebird'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x292d,0x1ea));var _0xd292=function(_0x310a1b,_0x4c9129){_0x310a1b=_0x310a1b-0x0;var _0xdea206=_0x292d[_0x310a1b];return _0xdea206;};'use strict';var _=require('lodash');var util=require(_0xd292('0x0'));var logger=require(_0xd292('0x1'))(_0xd292('0x2'));var moment=require('moment');var BPromise=require(_0xd292('0x3'));var rp=require(_0xd292('0x4'));var fs=require('fs');var path=require(_0xd292('0x5'));var rimraf=require(_0xd292('0x6'));var config=require(_0xd292('0x7'));var attributes=require(_0xd292('0x8'));module[_0xd292('0x9')]=function(_0x287928,_0x567c10){return _0x287928[_0xd292('0xa')](_0xd292('0xb'),attributes,{'tableName':_0xd292('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 8797d47..57b087d 100644 --- a/server/api/userMailQueue/userMailQueue.rpc.js +++ b/server/api/userMailQueue/userMailQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x300a1d,_0x362118){var _0x5e8b8a=function(_0x3dcc3b){while(--_0x3dcc3b){_0x300a1d['push'](_0x300a1d['shift']());}};_0x5e8b8a(++_0x362118);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('UserMailQueue,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _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(_0x167fbd,_0x4863c5){var _0x177eb1=function(_0x49eedf){while(--_0x49eedf){_0x167fbd['push'](_0x167fbd['shift']());}};_0x177eb1(++_0x4863c5);}(_0x55ca,0x126));var _0xa55c=function(_0x205a12,_0x5d1d07){_0x205a12=_0x205a12-0x0;var _0x2ae9cc=_0x55ca[_0x205a12];return _0x2ae9cc;};'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 diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 95d2c05..9742467 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 _0x1320=['isAuthenticated','sendUserNotification','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./userNotification.controller','post'];(function(_0x32b2d9,_0x335b67){var _0x486078=function(_0x311fd8){while(--_0x311fd8){_0x32b2d9['push'](_0x32b2d9['shift']());}};_0x486078(++_0x335b67);}(_0x1320,0x1cb));var _0x0132=function(_0x1fe636,_0x4def4e){_0x1fe636=_0x1fe636-0x0;var _0xbd1ef0=_0x1320[_0x1fe636];return _0xbd1ef0;};'use strict';var multer=require(_0x0132('0x0'));var util=require(_0x0132('0x1'));var path=require(_0x0132('0x2'));var timeout=require(_0x0132('0x3'));var express=require('express');var router=express[_0x0132('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0132('0x5'));var interaction=require(_0x0132('0x6'));var config=require('../../config/environment');var controller=require(_0x0132('0x7'));router[_0x0132('0x8')]('/',auth[_0x0132('0x9')](),controller[_0x0132('0xa')]);module[_0x0132('0xb')]=router; \ No newline at end of file +var _0x6bcb=['isAuthenticated','sendUserNotification','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./userNotification.controller','post'];(function(_0x40606d,_0x2eca8e){var _0x54a585=function(_0x2d8b4f){while(--_0x2d8b4f){_0x40606d['push'](_0x40606d['shift']());}};_0x54a585(++_0x2eca8e);}(_0x6bcb,0xaa));var _0xb6bc=function(_0x2f62aa,_0x108e95){_0x2f62aa=_0x2f62aa-0x0;var _0x1a341f=_0x6bcb[_0x2f62aa];return _0x1a341f;};'use strict';var multer=require(_0xb6bc('0x0'));var util=require(_0xb6bc('0x1'));var path=require(_0xb6bc('0x2'));var timeout=require(_0xb6bc('0x3'));var express=require('express');var router=express[_0xb6bc('0x4')]();var fs_extra=require(_0xb6bc('0x5'));var auth=require(_0xb6bc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb6bc('0x7'));var controller=require(_0xb6bc('0x8'));router[_0xb6bc('0x9')]('/',auth[_0xb6bc('0xa')](),controller[_0xb6bc('0xb')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 81c138d..cab8651 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 _0x856e=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x3be1e3,_0x56b8f9){var _0x1d7309=function(_0x15b170){while(--_0x15b170){_0x3be1e3['push'](_0x3be1e3['shift']());}};_0x1d7309(++_0x56b8f9);}(_0x856e,0xc0));var _0xe856=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0x856e[_0x45b034];return _0x509cb0;};'use strict';var Sequelize=require(_0xe856('0x0'));module[_0xe856('0x1')]={'body':{'type':Sequelize[_0xe856('0x2')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0xe856('0x2')]},'recipientsDescription':{'type':Sequelize[_0xe856('0x3')]},'beep':{'type':Sequelize[_0xe856('0x4')]}}; \ No newline at end of file +var _0x3723=['STRING','exports','TEXT'];(function(_0x37930f,_0x460022){var _0x565495=function(_0x21840a){while(--_0x21840a){_0x37930f['push'](_0x37930f['shift']());}};_0x565495(++_0x460022);}(_0x3723,0xe2));var _0x3372=function(_0x4ad339,_0x191d38){_0x4ad339=_0x4ad339-0x0;var _0x498077=_0x3723[_0x4ad339];return _0x498077;};'use strict';var Sequelize=require('sequelize');module[_0x3372('0x0')]={'body':{'type':Sequelize[_0x3372('0x1')]},'senderName':{'type':Sequelize[_0x3372('0x2')]},'recipientsId':{'type':Sequelize[_0x3372('0x1')]},'recipientsDescription':{'type':Sequelize[_0x3372('0x2')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index d8f1573..197e789 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 _0x3f1b=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','redis','defaults','./userNotification.socket','register','sendStatus','end','json','offset','limit','count','Content-Range','apply','save','then','error','stack','name','send','sendUserNotification','body','text','hasOwnProperty','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','Sequelize','Missing\x20\x27view\x27\x20parameter','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','voicequeue','whatsappqueue','team','user','some','includes','toLowerCase','senderName','fullname','recipientsDescription','isEmpty','beep','sortBy','join','sequelize','transaction','UserNotification','create','recipient','emit','userNotification:send','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','model','User','ids','queue','push','flatten','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x29b28e,_0x5e6732){var _0x3ab6fc=function(_0x236d0e){while(--_0x236d0e){_0x29b28e['push'](_0x29b28e['shift']());}};_0x3ab6fc(++_0x5e6732);}(_0x3f1b,0xab));var _0xb3f1=function(_0x4e2004,_0x541c1e){_0x4e2004=_0x4e2004-0x0;var _0xfb32ad=_0x3f1b[_0x4e2004];return _0xfb32ad;};'use strict';var emlformat=require(_0xb3f1('0x0'));var rimraf=require(_0xb3f1('0x1'));var zipdir=require(_0xb3f1('0x2'));var jsonpatch=require(_0xb3f1('0x3'));var rp=require(_0xb3f1('0x4'));var moment=require(_0xb3f1('0x5'));var BPromise=require(_0xb3f1('0x6'));var Mustache=require(_0xb3f1('0x7'));var util=require(_0xb3f1('0x8'));var path=require(_0xb3f1('0x9'));var sox=require('sox');var csv=require(_0xb3f1('0xa'));var ejs=require(_0xb3f1('0xb'));var fs=require('fs');var fs_extra=require(_0xb3f1('0xc'));var _=require(_0xb3f1('0xd'));var squel=require(_0xb3f1('0xe'));var crypto=require(_0xb3f1('0xf'));var jsforce=require(_0xb3f1('0x10'));var deskjs=require(_0xb3f1('0x11'));var toCsv=require(_0xb3f1('0xa'));var querystring=require(_0xb3f1('0x12'));var Papa=require(_0xb3f1('0x13'));var Redis=require(_0xb3f1('0x14'));var authService=require(_0xb3f1('0x15'));var qs=require(_0xb3f1('0x16'));var as=require(_0xb3f1('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xb3f1('0x18'));var config=require(_0xb3f1('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xb3f1('0x1a')]=_[_0xb3f1('0x1b')](config[_0xb3f1('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb3f1('0x1a')]));require(_0xb3f1('0x1c'))[_0xb3f1('0x1d')](socket);function respondWithStatusCode(_0x574d85,_0x39ebfc){_0x39ebfc=_0x39ebfc||0xcc;return function(_0x6b5959){if(_0x6b5959){return _0x574d85[_0xb3f1('0x1e')](_0x39ebfc);}return _0x574d85['status'](_0x39ebfc)[_0xb3f1('0x1f')]();};}function respondWithResult(_0x5553f1,_0x5a4587){_0x5a4587=_0x5a4587||0xc8;return function(_0x2a09c9){if(_0x2a09c9){return _0x5553f1['status'](_0x5a4587)[_0xb3f1('0x20')](_0x2a09c9);}};}function respondWithFilteredResult(_0xd1d300,_0x383c26){return function(_0x4027b2){if(_0x4027b2){var _0x16bc16=typeof _0x383c26[_0xb3f1('0x21')]==='undefined'&&typeof _0x383c26[_0xb3f1('0x22')]==='undefined';var _0x478000=_0x4027b2[_0xb3f1('0x23')];var _0x595509=_0x16bc16?0x0:_0x383c26['offset'];var _0x3562e7=_0x16bc16?_0x4027b2[_0xb3f1('0x23')]:_0x383c26[_0xb3f1('0x21')]+_0x383c26[_0xb3f1('0x22')];var _0x549c15;if(_0x3562e7>=_0x478000){_0x3562e7=_0x478000;_0x549c15=0xc8;}else{_0x549c15=0xce;}_0xd1d300['status'](_0x549c15);return _0xd1d300['set'](_0xb3f1('0x24'),_0x595509+'-'+_0x3562e7+'/'+_0x478000)[_0xb3f1('0x20')](_0x4027b2);}return null;};}function patchUpdates(_0x27c4c9){return function(_0x533dab){try{jsonpatch[_0xb3f1('0x25')](_0x533dab,_0x27c4c9,!![]);}catch(_0x324b60){return BPromise['reject'](_0x324b60);}return _0x533dab[_0xb3f1('0x26')]();};}function saveUpdates(_0x2caab4,_0xc917ce){return function(_0x151084){if(_0x151084){return _0x151084['update'](_0x2caab4)[_0xb3f1('0x27')](function(_0x549118){return _0x549118;});}return null;};}function removeEntity(_0x2da087,_0x3ef851){return function(_0x2c60ee){if(_0x2c60ee){return _0x2c60ee['destroy']()[_0xb3f1('0x27')](function(){_0x2da087['status'](0xcc)[_0xb3f1('0x1f')]();});}};}function handleEntityNotFound(_0x16b3dc,_0x475fd4){return function(_0x2f6887){if(!_0x2f6887){_0x16b3dc['sendStatus'](0x194);}return _0x2f6887;};}function handleError(_0x325462,_0x26533f){_0x26533f=_0x26533f||0x1f4;return function(_0x440bd1){logger[_0xb3f1('0x28')](_0x440bd1[_0xb3f1('0x29')]);if(_0x440bd1['name']){delete _0x440bd1[_0xb3f1('0x2a')];}_0x325462['status'](_0x26533f)[_0xb3f1('0x2b')](_0x440bd1);};}exports[_0xb3f1('0x2c')]=function(_0x1cec56,_0x558120,_0x53d737){if(!_0x1cec56[_0xb3f1('0x2d')]['hasOwnProperty'](_0xb3f1('0x2e'))&&!_0x1cec56[_0xb3f1('0x2d')][_0xb3f1('0x2f')](_0xb3f1('0x30'))){throw new db['Sequelize'][(_0xb3f1('0x31'))](_0xb3f1('0x32'));}else{if(_0x1cec56[_0xb3f1('0x2d')]['hasOwnProperty'](_0xb3f1('0x30'))&&!_0x1cec56[_0xb3f1('0x2d')][_0xb3f1('0x2f')]('view')){throw new db[(_0xb3f1('0x33'))]['ValidationError'](_0xb3f1('0x34'));}if(!_0x1cec56[_0xb3f1('0x2d')][_0xb3f1('0x2f')]('recipients')){throw new db[(_0xb3f1('0x33'))][(_0xb3f1('0x31'))](_0xb3f1('0x35'));}else{try{var _0xb69913=JSON[_0xb3f1('0x36')](_0x1cec56[_0xb3f1('0x2d')]['recipients']);}catch(_0x5c0634){logger[_0xb3f1('0x28')](_0x5c0634);throw new db[(_0xb3f1('0x33'))][(_0xb3f1('0x31'))](_0xb3f1('0x37'));}var _0x3b8280=[_0xb3f1('0x38'),_0xb3f1('0x39'),_0xb3f1('0x3a'),_0xb3f1('0x3b'),'smsqueue',_0xb3f1('0x3c'),_0xb3f1('0x3d'),_0xb3f1('0x3e'),_0xb3f1('0x3f')];if(_[_0xb3f1('0x40')](_0xb69913,function(_0x31b2c9){return!_[_0xb3f1('0x41')](_0x3b8280,_0x31b2c9['model'][_0xb3f1('0x42')]());})){throw new db[(_0xb3f1('0x33'))][(_0xb3f1('0x31'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x4d121a={};_0x4d121a[_0xb3f1('0x43')]=_0x1cec56[_0xb3f1('0x2d')][_0xb3f1('0x2f')]('senderName')?_0x1cec56[_0xb3f1('0x2d')][_0xb3f1('0x43')]:_0x1cec56[_0xb3f1('0x3f')][_0xb3f1('0x44')];_0x4d121a[_0xb3f1('0x45')]=_[_0xb3f1('0x46')](_0x1cec56['body'][_0xb3f1('0x45')])?null:_0x1cec56[_0xb3f1('0x2d')][_0xb3f1('0x45')];_0x4d121a[_0xb3f1('0x47')]=_0x1cec56[_0xb3f1('0x2d')]['beep']||![];_0x4d121a['SenderId']=_0x1cec56['user']['id'];return getContent(_0x1cec56[_0xb3f1('0x2d')])[_0xb3f1('0x27')](function(_0x4b7cf6){_0x4d121a[_0xb3f1('0x2d')]=_0x4b7cf6;return getRecipients(_0xb69913);})[_0xb3f1('0x27')](function(_0x5a3ba9){_0x4d121a['recipientsId']=_[_0xb3f1('0x48')](_0x5a3ba9)[_0xb3f1('0x49')](',');return db[_0xb3f1('0x4a')][_0xb3f1('0x4b')](function(_0xae341b){return db[_0xb3f1('0x4c')][_0xb3f1('0x4d')](_0x4d121a,{'raw':!![],'transaction':_0xae341b})[_0xb3f1('0x27')](function(_0x26846f){var _0x4be253={'sender':_0x4d121a[_0xb3f1('0x43')],'description':_0x4d121a['recipientsDescription'],'content':_0x4d121a[_0xb3f1('0x2d')],'beep':_0x4d121a[_0xb3f1('0x47')]};_0x5a3ba9['forEach'](function(_0x36d1a5){_0x4be253[_0xb3f1('0x4e')]=_0x36d1a5;socket[_0xb3f1('0x4f')](_0xb3f1('0x50'),_0x4be253);});return _0x26846f;});});})[_0xb3f1('0x27')](respondWithResult(_0x558120,0xc9))[_0xb3f1('0x51')](handleError(_0x558120,null));};function getContent(_0xc09050){return new BPromise(function(_0x2d3e21,_0x148e8f){if(_0xc09050[_0xb3f1('0x2e')]){_0x2d3e21(_0xc09050['text']);return;}return db[_0xb3f1('0x52')][_0xb3f1('0x53')]({'attributes':[_0xb3f1('0x54')],'where':{'id':_0xc09050[_0xb3f1('0x30')]},'raw':!![]})[_0xb3f1('0x27')](function(_0x2bdbbc){if(!_0x2bdbbc)throw new db[(_0xb3f1('0x33'))][(_0xb3f1('0x31'))](_0xb3f1('0x55'));var _0x1c9ef6=Mustache[_0xb3f1('0x56')](_0x2bdbbc[_0xb3f1('0x54')],_0xc09050['view']);_0x2d3e21(_0x1c9ef6);})[_0xb3f1('0x51')](function(_0x509457){_0x148e8f(_0x509457);});});}function getRecipients(_0x16ccee){return new BPromise(function(_0x24020c,_0x75b28e){var _0x5bb555=[];var _0x57cbc6=[];_0x16ccee['forEach'](function(_0x5d84f5){var _0x5696e6=_[_0xb3f1('0x57')](_0x5d84f5[_0xb3f1('0x58')]['toLowerCase']());if(_0x5696e6===_0xb3f1('0x59')){_0x5bb555=_['union'](_0x5bb555,_0x5d84f5[_0xb3f1('0x5a')]);}else{if(_['includes'](_0x5696e6,_0xb3f1('0x5b')))_0x5696e6=_0x5696e6['replace'](_0xb3f1('0x5b'),'Queue');_0x5d84f5['ids']['forEach'](function(_0x49ac1b){_0x57cbc6[_0xb3f1('0x5c')](getAgents(_0x5696e6,_0x49ac1b));});}});return BPromise['all'](_0x57cbc6)[_0xb3f1('0x27')](function(_0x41c5df){_0x5bb555=_['union'](_0x5bb555,_[_0xb3f1('0x5d')](_0x41c5df));_0x24020c(_0x5bb555);})[_0xb3f1('0x51')](function(_0x4a069d){_0x75b28e(_0x4a069d);});});}function getAgents(_0x19f616,_0x574fe3){return new BPromise(function(_0x5e1fc9,_0x42251d){return db[_0x19f616][_0xb3f1('0x53')]({'where':{'id':_0x574fe3}})['then'](function(_0x142d8f){return _0x142d8f[_0xb3f1('0x5e')]({'attributes':['id'],'raw':!![]})[_0xb3f1('0x27')](function(_0x17ac5e){var _0x475aec=_['map'](_0x17ac5e,'id');_0x5e1fc9(_0x475aec);});})[_0xb3f1('0x51')](function(_0x1ad360){_0x42251d(_0x1ad360);});});} \ No newline at end of file +var _0xe584=['Sequelize','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','some','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','fullname','recipientsDescription','isEmpty','SenderId','recipientsId','sortBy','join','transaction','UserNotification','forEach','emit','userNotification:send','catch','Template','html','render','view','startCase','model','User','union','ids','includes','queue','Queue','flatten','findOne','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','redis','defaults','localhost','./userNotification.socket','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','body','hasOwnProperty','text','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27'];(function(_0x4e4be0,_0x4b1549){var _0x4c0efd=function(_0x4eb504){while(--_0x4eb504){_0x4e4be0['push'](_0x4e4be0['shift']());}};_0x4c0efd(++_0x4b1549);}(_0xe584,0x15c));var _0x4e58=function(_0x35d586,_0x43094a){_0x35d586=_0x35d586-0x0;var _0x4288ae=_0xe584[_0x35d586];return _0x4288ae;};'use strict';var emlformat=require(_0x4e58('0x0'));var rimraf=require(_0x4e58('0x1'));var zipdir=require(_0x4e58('0x2'));var jsonpatch=require(_0x4e58('0x3'));var rp=require(_0x4e58('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4e58('0x5'));var util=require('util');var path=require(_0x4e58('0x6'));var sox=require(_0x4e58('0x7'));var csv=require(_0x4e58('0x8'));var ejs=require(_0x4e58('0x9'));var fs=require('fs');var fs_extra=require(_0x4e58('0xa'));var _=require('lodash');var squel=require(_0x4e58('0xb'));var crypto=require('crypto');var jsforce=require(_0x4e58('0xc'));var deskjs=require(_0x4e58('0xd'));var toCsv=require(_0x4e58('0x8'));var querystring=require(_0x4e58('0xe'));var Papa=require(_0x4e58('0xf'));var Redis=require(_0x4e58('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4e58('0x11'));var hardwareService=require(_0x4e58('0x12'));var logger=require('../../config/logger')(_0x4e58('0x13'));var utils=require(_0x4e58('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x4e58('0x15'));var db=require('../../mysqldb')['db'];config[_0x4e58('0x16')]=_[_0x4e58('0x17')](config[_0x4e58('0x16')],{'host':_0x4e58('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4e58('0x16')]));require(_0x4e58('0x19'))['register'](socket);function respondWithStatusCode(_0x20dd96,_0x4652f7){_0x4652f7=_0x4652f7||0xcc;return function(_0x4358f7){if(_0x4358f7){return _0x20dd96[_0x4e58('0x1a')](_0x4652f7);}return _0x20dd96[_0x4e58('0x1b')](_0x4652f7)[_0x4e58('0x1c')]();};}function respondWithResult(_0x3898fb,_0x270b97){_0x270b97=_0x270b97||0xc8;return function(_0x59b45b){if(_0x59b45b){return _0x3898fb[_0x4e58('0x1b')](_0x270b97)[_0x4e58('0x1d')](_0x59b45b);}};}function respondWithFilteredResult(_0x6f1c83,_0x47c8f9){return function(_0x2cfbe6){if(_0x2cfbe6){var _0xf8423b=typeof _0x47c8f9[_0x4e58('0x1e')]==='undefined'&&typeof _0x47c8f9[_0x4e58('0x1f')]===_0x4e58('0x20');var _0x1f220e=_0x2cfbe6[_0x4e58('0x21')];var _0x5dac46=_0xf8423b?0x0:_0x47c8f9[_0x4e58('0x1e')];var _0xe3e6ea=_0xf8423b?_0x2cfbe6[_0x4e58('0x21')]:_0x47c8f9[_0x4e58('0x1e')]+_0x47c8f9[_0x4e58('0x1f')];var _0x25e714;if(_0xe3e6ea>=_0x1f220e){_0xe3e6ea=_0x1f220e;_0x25e714=0xc8;}else{_0x25e714=0xce;}_0x6f1c83['status'](_0x25e714);return _0x6f1c83[_0x4e58('0x22')](_0x4e58('0x23'),_0x5dac46+'-'+_0xe3e6ea+'/'+_0x1f220e)[_0x4e58('0x1d')](_0x2cfbe6);}return null;};}function patchUpdates(_0x4ad79b){return function(_0x3c3a38){try{jsonpatch[_0x4e58('0x24')](_0x3c3a38,_0x4ad79b,!![]);}catch(_0xe76f19){return BPromise[_0x4e58('0x25')](_0xe76f19);}return _0x3c3a38[_0x4e58('0x26')]();};}function saveUpdates(_0x25c870,_0x13c069){return function(_0xd5d7cf){if(_0xd5d7cf){return _0xd5d7cf[_0x4e58('0x27')](_0x25c870)[_0x4e58('0x28')](function(_0x5141d5){return _0x5141d5;});}return null;};}function removeEntity(_0x27cf65,_0x592d3b){return function(_0x21e95f){if(_0x21e95f){return _0x21e95f[_0x4e58('0x29')]()[_0x4e58('0x28')](function(){_0x27cf65['status'](0xcc)[_0x4e58('0x1c')]();});}};}function handleEntityNotFound(_0x103e02,_0x3d3d4e){return function(_0x2f2a2c){if(!_0x2f2a2c){_0x103e02[_0x4e58('0x1a')](0x194);}return _0x2f2a2c;};}function handleError(_0x36ca0,_0x4fa957){_0x4fa957=_0x4fa957||0x1f4;return function(_0x59bdc5){logger[_0x4e58('0x2a')](_0x59bdc5[_0x4e58('0x2b')]);if(_0x59bdc5[_0x4e58('0x2c')]){delete _0x59bdc5[_0x4e58('0x2c')];}_0x36ca0[_0x4e58('0x1b')](_0x4fa957)[_0x4e58('0x2d')](_0x59bdc5);};}exports['sendUserNotification']=function(_0x1a7463,_0x34c31a,_0x21d0f4){if(!_0x1a7463[_0x4e58('0x2e')][_0x4e58('0x2f')](_0x4e58('0x30'))&&!_0x1a7463['body'][_0x4e58('0x2f')](_0x4e58('0x31'))){throw new db['Sequelize'][(_0x4e58('0x32'))](_0x4e58('0x33'));}else{if(_0x1a7463[_0x4e58('0x2e')][_0x4e58('0x2f')](_0x4e58('0x31'))&&!_0x1a7463['body'][_0x4e58('0x2f')]('view')){throw new db[(_0x4e58('0x34'))][(_0x4e58('0x32'))](_0x4e58('0x35'));}if(!_0x1a7463[_0x4e58('0x2e')][_0x4e58('0x2f')](_0x4e58('0x36'))){throw new db[(_0x4e58('0x34'))][(_0x4e58('0x32'))](_0x4e58('0x37'));}else{try{var _0x2f0529=JSON[_0x4e58('0x38')](_0x1a7463[_0x4e58('0x2e')][_0x4e58('0x36')]);}catch(_0x686bb6){logger[_0x4e58('0x2a')](_0x686bb6);throw new db['Sequelize']['ValidationError'](_0x4e58('0x39'));}var _0x438d78=[_0x4e58('0x3a'),_0x4e58('0x3b'),_0x4e58('0x3c'),_0x4e58('0x3d'),_0x4e58('0x3e'),_0x4e58('0x3f'),_0x4e58('0x40'),_0x4e58('0x41'),'user'];if(_[_0x4e58('0x42')](_0x2f0529,function(_0x1c73f6){return!_['includes'](_0x438d78,_0x1c73f6['model'][_0x4e58('0x43')]());})){throw new db[(_0x4e58('0x34'))][(_0x4e58('0x32'))](_0x4e58('0x44'));}}}var _0x1a2cca={};_0x1a2cca[_0x4e58('0x45')]=_0x1a7463[_0x4e58('0x2e')][_0x4e58('0x2f')](_0x4e58('0x45'))?_0x1a7463[_0x4e58('0x2e')][_0x4e58('0x45')]:_0x1a7463[_0x4e58('0x46')][_0x4e58('0x47')];_0x1a2cca[_0x4e58('0x48')]=_[_0x4e58('0x49')](_0x1a7463[_0x4e58('0x2e')][_0x4e58('0x48')])?null:_0x1a7463[_0x4e58('0x2e')]['recipientsDescription'];_0x1a2cca['beep']=_0x1a7463['body']['beep']||![];_0x1a2cca[_0x4e58('0x4a')]=_0x1a7463['user']['id'];return getContent(_0x1a7463[_0x4e58('0x2e')])['then'](function(_0x49fa20){_0x1a2cca['body']=_0x49fa20;return getRecipients(_0x2f0529);})['then'](function(_0x51a71e){_0x1a2cca[_0x4e58('0x4b')]=_[_0x4e58('0x4c')](_0x51a71e)[_0x4e58('0x4d')](',');return db['sequelize'][_0x4e58('0x4e')](function(_0x342d47){return db[_0x4e58('0x4f')]['create'](_0x1a2cca,{'raw':!![],'transaction':_0x342d47})['then'](function(_0xd8e6a1){var _0x2078ad={'sender':_0x1a2cca[_0x4e58('0x45')],'description':_0x1a2cca[_0x4e58('0x48')],'content':_0x1a2cca[_0x4e58('0x2e')],'beep':_0x1a2cca['beep']};_0x51a71e[_0x4e58('0x50')](function(_0x29d0b7){_0x2078ad['recipient']=_0x29d0b7;socket[_0x4e58('0x51')](_0x4e58('0x52'),_0x2078ad);});return _0xd8e6a1;});});})[_0x4e58('0x28')](respondWithResult(_0x34c31a,0xc9))[_0x4e58('0x53')](handleError(_0x34c31a,null));};function getContent(_0x4fc1a9){return new BPromise(function(_0x4250b3,_0x517566){if(_0x4fc1a9[_0x4e58('0x30')]){_0x4250b3(_0x4fc1a9[_0x4e58('0x30')]);return;}return db[_0x4e58('0x54')]['findOne']({'attributes':[_0x4e58('0x55')],'where':{'id':_0x4fc1a9[_0x4e58('0x31')]},'raw':!![]})[_0x4e58('0x28')](function(_0x314423){if(!_0x314423)throw new db[(_0x4e58('0x34'))][(_0x4e58('0x32'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x1edb0a=Mustache[_0x4e58('0x56')](_0x314423[_0x4e58('0x55')],_0x4fc1a9[_0x4e58('0x57')]);_0x4250b3(_0x1edb0a);})[_0x4e58('0x53')](function(_0x54c1c3){_0x517566(_0x54c1c3);});});}function getRecipients(_0xa2b401){return new BPromise(function(_0x35e390,_0x24c675){var _0x5994d7=[];var _0x5b0b8f=[];_0xa2b401['forEach'](function(_0x15099e){var _0x6dde52=_[_0x4e58('0x58')](_0x15099e[_0x4e58('0x59')][_0x4e58('0x43')]());if(_0x6dde52===_0x4e58('0x5a')){_0x5994d7=_[_0x4e58('0x5b')](_0x5994d7,_0x15099e[_0x4e58('0x5c')]);}else{if(_[_0x4e58('0x5d')](_0x6dde52,_0x4e58('0x5e')))_0x6dde52=_0x6dde52['replace']('queue',_0x4e58('0x5f'));_0x15099e[_0x4e58('0x5c')]['forEach'](function(_0x500df4){_0x5b0b8f['push'](getAgents(_0x6dde52,_0x500df4));});}});return BPromise['all'](_0x5b0b8f)[_0x4e58('0x28')](function(_0x227707){_0x5994d7=_[_0x4e58('0x5b')](_0x5994d7,_[_0x4e58('0x60')](_0x227707));_0x35e390(_0x5994d7);})[_0x4e58('0x53')](function(_0x220af5){_0x24c675(_0x220af5);});});}function getAgents(_0x13ac41,_0x523bf2){return new BPromise(function(_0x44c541,_0x108896){return db[_0x13ac41][_0x4e58('0x61')]({'where':{'id':_0x523bf2}})[_0x4e58('0x28')](function(_0xca1f51){return _0xca1f51[_0x4e58('0x62')]({'attributes':['id'],'raw':!![]})['then'](function(_0x297119){var _0x23bbd4=_[_0x4e58('0x63')](_0x297119,'id');_0x44c541(_0x23bbd4);});})[_0x4e58('0x53')](function(_0x163603){_0x108896(_0x163603);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 7cfccaa..5b4b76e 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 _0x4569=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x5992c9,_0x2a20a4){var _0x1e8945=function(_0x2aa57c){while(--_0x2aa57c){_0x5992c9['push'](_0x5992c9['shift']());}};_0x1e8945(++_0x2a20a4);}(_0x4569,0xdd));var _0x9456=function(_0x256995,_0xa90e79){_0x256995=_0x256995-0x0;var _0x49de4e=_0x4569[_0x256995];return _0x49de4e;};'use strict';var EventEmitter=require(_0x9456('0x0'));var UserNotification=require(_0x9456('0x1'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x9456('0x2')](0x0);var events={'afterCreate':_0x9456('0x3'),'afterUpdate':_0x9456('0x4'),'afterDestroy':'remove'};function emitEvent(_0x18be71){return function(_0x977e9d,_0x126892,_0x3887c8){UserNotificationEvents['emit'](_0x18be71+':'+_0x977e9d['id'],_0x977e9d);UserNotificationEvents[_0x9456('0x5')](_0x18be71,_0x977e9d);_0x3887c8(null);};}for(var e in events){if(events[_0x9456('0x6')](e)){var event=events[e];UserNotification[_0x9456('0x7')](e,emitEvent(event));}}module[_0x9456('0x8')]=UserNotificationEvents; \ No newline at end of file +var _0x31bf=['events','setMaxListeners','remove','emit','hasOwnProperty','hook','exports'];(function(_0x3e9187,_0x5ae976){var _0x555044=function(_0x4fec77){while(--_0x4fec77){_0x3e9187['push'](_0x3e9187['shift']());}};_0x555044(++_0x5ae976);}(_0x31bf,0x8c));var _0xf31b=function(_0x307f3a,_0x7a0fa6){_0x307f3a=_0x307f3a-0x0;var _0x3e2575=_0x31bf[_0x307f3a];return _0x3e2575;};'use strict';var EventEmitter=require(_0xf31b('0x0'));var UserNotification=require('../../mysqldb')['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xf31b('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xf31b('0x2')};function emitEvent(_0x2cf08d){return function(_0x431f0e,_0x1fb2ef,_0x20401a){UserNotificationEvents[_0xf31b('0x3')](_0x2cf08d+':'+_0x431f0e['id'],_0x431f0e);UserNotificationEvents[_0xf31b('0x3')](_0x2cf08d,_0x431f0e);_0x20401a(null);};}for(var e in events){if(events[_0xf31b('0x4')](e)){var event=events[e];UserNotification[_0xf31b('0x5')](e,emitEvent(event));}}module[_0xf31b('0x6')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index a32fe2e..ae0d2b3 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 _0x47ce=['exports','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise','path','../../config/environment'];(function(_0x178ada,_0x24ccfa){var _0x337249=function(_0x41b79a){while(--_0x41b79a){_0x178ada['push'](_0x178ada['shift']());}};_0x337249(++_0x24ccfa);}(_0x47ce,0x165));var _0xe47c=function(_0x288d60,_0x297668){_0x288d60=_0x288d60-0x0;var _0x10999a=_0x47ce[_0x288d60];return _0x10999a;};'use strict';var _=require(_0xe47c('0x0'));var util=require(_0xe47c('0x1'));var logger=require(_0xe47c('0x2'))(_0xe47c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe47c('0x4'));var fs=require('fs');var path=require(_0xe47c('0x5'));var rimraf=require('rimraf');var config=require(_0xe47c('0x6'));var attributes=require('./userNotification.attributes');module[_0xe47c('0x7')]=function(_0x2c64ca,_0x499070){return _0x2c64ca[_0xe47c('0x8')](_0xe47c('0x9'),attributes,{'tableName':_0xe47c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe47c('0xb'),'collate':_0xe47c('0xc')});}; \ No newline at end of file +var _0xc175=['../../config/environment','./userNotification.attributes','exports','define','userNotifications','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x4c1bf9,_0x1e4f68){var _0x3bde0d=function(_0x5b7fb1){while(--_0x5b7fb1){_0x4c1bf9['push'](_0x4c1bf9['shift']());}};_0x3bde0d(++_0x1e4f68);}(_0xc175,0x1f3));var _0x5c17=function(_0x2e174f,_0x2464d7){_0x2e174f=_0x2e174f-0x0;var _0x54817a=_0xc175[_0x2e174f];return _0x54817a;};'use strict';var _=require(_0x5c17('0x0'));var util=require(_0x5c17('0x1'));var logger=require(_0x5c17('0x2'))('api');var moment=require(_0x5c17('0x3'));var BPromise=require(_0x5c17('0x4'));var rp=require(_0x5c17('0x5'));var fs=require('fs');var path=require(_0x5c17('0x6'));var rimraf=require(_0x5c17('0x7'));var config=require(_0x5c17('0x8'));var attributes=require(_0x5c17('0x9'));module[_0x5c17('0xa')]=function(_0x2f803e,_0x18c0ce){return _0x2f803e[_0x5c17('0xb')]('UserNotification',attributes,{'tableName':_0x5c17('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index de18397..542122c 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 _0xa371=['jayson/promise','client','http','redis','defaults','localhost','./userNotification.socket','register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0xa371,0xbc));var _0x1a37=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0xa371[_0x263a74];return _0x2aa86c;};'use strict';var _=require('lodash');var util=require(_0x1a37('0x0'));var moment=require(_0x1a37('0x1'));var BPromise=require(_0x1a37('0x2'));var rs=require(_0x1a37('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1a37('0x4'))['db'];var utils=require(_0x1a37('0x5'));var logger=require('../../config/logger')(_0x1a37('0x6'));var config=require(_0x1a37('0x7'));var jayson=require(_0x1a37('0x8'));var client=jayson[_0x1a37('0x9')][_0x1a37('0xa')]({'port':0x232a});config[_0x1a37('0xb')]=_[_0x1a37('0xc')](config['redis'],{'host':_0x1a37('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1a37('0xb')]));require(_0x1a37('0xe'))[_0x1a37('0xf')](socket);function respondWithRpcPromise(_0x3f48d1,_0x541ffa,_0x5db644){return new BPromise(function(_0x55dd67,_0x5ea23b){return client[_0x1a37('0x10')](_0x3f48d1,_0x5db644)[_0x1a37('0x11')](function(_0x2d489f){logger[_0x1a37('0x12')](_0x1a37('0x13'),_0x541ffa,_0x1a37('0x14'));logger[_0x1a37('0x15')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x541ffa,_0x1a37('0x14'),JSON[_0x1a37('0x16')](_0x2d489f));if(_0x2d489f[_0x1a37('0x17')]){if(_0x2d489f[_0x1a37('0x17')][_0x1a37('0x18')]===0x1f4){logger[_0x1a37('0x17')]('UserNotification,\x20%s,\x20%s',_0x541ffa,_0x2d489f[_0x1a37('0x17')][_0x1a37('0x19')]);return _0x5ea23b(_0x2d489f[_0x1a37('0x17')]['message']);}logger[_0x1a37('0x17')](_0x1a37('0x13'),_0x541ffa,_0x2d489f[_0x1a37('0x17')][_0x1a37('0x19')]);return _0x55dd67(_0x2d489f['error'][_0x1a37('0x19')]);}else{logger['info'](_0x1a37('0x13'),_0x541ffa,_0x1a37('0x14'));_0x55dd67(_0x2d489f[_0x1a37('0x1a')]['message']);}})[_0x1a37('0x1b')](function(_0x553aca){logger[_0x1a37('0x17')]('UserNotification,\x20%s,\x20%s',_0x541ffa,_0x553aca);_0x5ea23b(_0x553aca);});});} \ No newline at end of file +var _0xbf29=['redis','defaults','localhost','./userNotification.socket','register','request','then','info','UserNotification,\x20%s,\x20%s','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x5ce17e,_0x1a6dd4){var _0x2ed753=function(_0x4bd044){while(--_0x4bd044){_0x5ce17e['push'](_0x5ce17e['shift']());}};_0x2ed753(++_0x1a6dd4);}(_0xbf29,0x154));var _0x9bf2=function(_0x47b54c,_0x47fa60){_0x47b54c=_0x47b54c-0x0;var _0x2b2df6=_0xbf29[_0x47b54c];return _0x2b2df6;};'use strict';var _=require(_0x9bf2('0x0'));var util=require(_0x9bf2('0x1'));var moment=require(_0x9bf2('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9bf2('0x3'));var db=require(_0x9bf2('0x4'))['db'];var utils=require(_0x9bf2('0x5'));var logger=require(_0x9bf2('0x6'))(_0x9bf2('0x7'));var config=require(_0x9bf2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9bf2('0x9')]['http']({'port':0x232a});config[_0x9bf2('0xa')]=_[_0x9bf2('0xb')](config[_0x9bf2('0xa')],{'host':_0x9bf2('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9bf2('0xd'))[_0x9bf2('0xe')](socket);function respondWithRpcPromise(_0x19d3da,_0x3b6066,_0x58dd8a){return new BPromise(function(_0x16bcff,_0xb652d4){return client[_0x9bf2('0xf')](_0x19d3da,_0x58dd8a)[_0x9bf2('0x10')](function(_0x924085){logger[_0x9bf2('0x11')](_0x9bf2('0x12'),_0x3b6066,'request\x20sent');logger['debug'](_0x9bf2('0x13'),_0x3b6066,'request\x20sent',JSON[_0x9bf2('0x14')](_0x924085));if(_0x924085[_0x9bf2('0x15')]){if(_0x924085[_0x9bf2('0x15')][_0x9bf2('0x16')]===0x1f4){logger['error']('UserNotification,\x20%s,\x20%s',_0x3b6066,_0x924085['error']['message']);return _0xb652d4(_0x924085[_0x9bf2('0x15')][_0x9bf2('0x17')]);}logger[_0x9bf2('0x15')]('UserNotification,\x20%s,\x20%s',_0x3b6066,_0x924085[_0x9bf2('0x15')][_0x9bf2('0x17')]);return _0x16bcff(_0x924085['error'][_0x9bf2('0x17')]);}else{logger[_0x9bf2('0x11')](_0x9bf2('0x12'),_0x3b6066,'request\x20sent');_0x16bcff(_0x924085[_0x9bf2('0x18')][_0x9bf2('0x17')]);}})['catch'](function(_0x125eb5){logger['error'](_0x9bf2('0x12'),_0x3b6066,_0x125eb5);_0xb652d4(_0x125eb5);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 508cb23..472b3e6 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 _0x8a5e=['length','userNotification:','save','remove','emit','register'];(function(_0x478829,_0x4ef2bb){var _0x59a14a=function(_0x11e88c){while(--_0x11e88c){_0x478829['push'](_0x478829['shift']());}};_0x59a14a(++_0x4ef2bb);}(_0x8a5e,0x1e8));var _0xe8a5=function(_0x4f72e5,_0x596b63){_0x4f72e5=_0x4f72e5-0x0;var _0x589a9d=_0x8a5e[_0x4f72e5];return _0x589a9d;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0xe8a5('0x0'),_0xe8a5('0x1'),'update'];function createListener(_0x3a2c2a,_0x367f88){return function(_0x298394){_0x367f88[_0xe8a5('0x2')](_0x3a2c2a,_0x298394);};}function removeListener(_0xfcbfcf,_0xbc2498){return function(){UserNotificationEvents['removeListener'](_0xfcbfcf,_0xbc2498);};}exports[_0xe8a5('0x3')]=function(_0x953844){for(var _0x3018d8=0x0,_0x11b27b=events[_0xe8a5('0x4')];_0x3018d8<_0x11b27b;_0x3018d8++){var _0x4cd27f=events[_0x3018d8];var _0x393207=createListener(_0xe8a5('0x5')+_0x4cd27f,_0x953844);UserNotificationEvents['on'](_0x4cd27f,_0x393207);}}; \ No newline at end of file +var _0x60f5=['update','emit','length','userNotification:','save','remove'];(function(_0x2b40e1,_0x15f075){var _0x188b17=function(_0x9d297b){while(--_0x9d297b){_0x2b40e1['push'](_0x2b40e1['shift']());}};_0x188b17(++_0x15f075);}(_0x60f5,0xe2));var _0x560f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x60f5[_0x3dd15e];return _0x231fd0;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0x560f('0x0'),_0x560f('0x1'),_0x560f('0x2')];function createListener(_0x53f2c0,_0x1c02f6){return function(_0x4167c0){_0x1c02f6[_0x560f('0x3')](_0x53f2c0,_0x4167c0);};}function removeListener(_0x27c46b,_0xa77623){return function(){UserNotificationEvents['removeListener'](_0x27c46b,_0xa77623);};}exports['register']=function(_0x2faa56){for(var _0x2c8c3d=0x0,_0x5a304f=events[_0x560f('0x4')];_0x2c8c3d<_0x5a304f;_0x2c8c3d++){var _0x5195e8=events[_0x2c8c3d];var _0x230e8c=createListener(_0x560f('0x5')+_0x5195e8,_0x2faa56);UserNotificationEvents['on'](_0x5195e8,_0x230e8c);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index fddbeec..3a964e0 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x51e5a1,_0x34f48b){var _0x105f97=function(_0x111524){while(--_0x111524){_0x51e5a1['push'](_0x51e5a1['shift']());}};_0x105f97(++_0x34f48b);}(_0x70e0,0x17b));var _0x070e=function(_0x34df4e,_0x2f8cfd){_0x34df4e=_0x34df4e-0x0;var _0x11dedd=_0x70e0[_0x34df4e];return _0x11dedd;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x46ee3c,_0x1c08f0){var _0x530a97=function(_0x194bba){while(--_0x194bba){_0x46ee3c['push'](_0x46ee3c['shift']());}};_0x530a97(++_0x1c08f0);}(_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'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 2a96f6b..11c6a21 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 _0x4310=['exports','INTEGER','sequelize'];(function(_0x547842,_0x1c61e8){var _0x540258=function(_0x5da6ae){while(--_0x5da6ae){_0x547842['push'](_0x547842['shift']());}};_0x540258(++_0x1c61e8);}(_0x4310,0x110));var _0x0431=function(_0x2b439e,_0x21ce5e){_0x2b439e=_0x2b439e-0x0;var _0x189dd0=_0x4310[_0x2b439e];return _0x189dd0;};'use strict';var Sequelize=require(_0x0431('0x0'));module[_0x0431('0x1')]={'penalty':{'type':Sequelize[_0x0431('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7d28=['sequelize'];(function(_0x39d544,_0x35c14f){var _0x5a5ff2=function(_0x2271fb){while(--_0x2271fb){_0x39d544['push'](_0x39d544['shift']());}};_0x5a5ff2(++_0x35c14f);}(_0x7d28,0x73));var _0x87d2=function(_0x39026e,_0x22d113){_0x39026e=_0x39026e-0x0;var _0x23a088=_0x7d28[_0x39026e];return _0x23a088;};'use strict';var Sequelize=require(_0x87d2('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'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 c0540fc..d3db7bf 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 _0x2fd5=['UserOpenchannelQueue','user_has_openchannel_queues','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','define'];(function(_0x23ce99,_0x1602e0){var _0x40ef15=function(_0xf47b3d){while(--_0xf47b3d){_0x23ce99['push'](_0x23ce99['shift']());}};_0x40ef15(++_0x1602e0);}(_0x2fd5,0x157));var _0x52fd=function(_0x59fa74,_0x132dcd){_0x59fa74=_0x59fa74-0x0;var _0x4401cd=_0x2fd5[_0x59fa74];return _0x4401cd;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x52fd('0x0'))(_0x52fd('0x1'));var moment=require(_0x52fd('0x2'));var BPromise=require(_0x52fd('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x52fd('0x4'));var rimraf=require(_0x52fd('0x5'));var config=require(_0x52fd('0x6'));var attributes=require(_0x52fd('0x7'));module['exports']=function(_0x4eeaf3,_0x280f7b){return _0x4eeaf3[_0x52fd('0x8')](_0x52fd('0x9'),attributes,{'tableName':_0x52fd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2592=['exports','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes'];(function(_0x34c0af,_0xc73d6e){var _0x5d1ad2=function(_0x434abd){while(--_0x434abd){_0x34c0af['push'](_0x34c0af['shift']());}};_0x5d1ad2(++_0xc73d6e);}(_0x2592,0x1df));var _0x2259=function(_0x315002,_0x4ee032){_0x315002=_0x315002-0x0;var _0x54e480=_0x2592[_0x315002];return _0x54e480;};'use strict';var _=require(_0x2259('0x0'));var util=require(_0x2259('0x1'));var logger=require(_0x2259('0x2'))(_0x2259('0x3'));var moment=require(_0x2259('0x4'));var BPromise=require(_0x2259('0x5'));var rp=require(_0x2259('0x6'));var fs=require('fs');var path=require(_0x2259('0x7'));var rimraf=require(_0x2259('0x8'));var config=require(_0x2259('0x9'));var attributes=require(_0x2259('0xa'));module[_0x2259('0xb')]=function(_0x47d2c5,_0x214965){return _0x47d2c5['define'](_0x2259('0xc'),attributes,{'tableName':_0x2259('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 e1ec7a8..c1014fb 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 _0xd73f=['UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserOpenchannelQueue,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','debug'];(function(_0x1c5bdb,_0x44bf0e){var _0x4988a1=function(_0x1db1da){while(--_0x1db1da){_0x1c5bdb['push'](_0x1c5bdb['shift']());}};_0x4988a1(++_0x44bf0e);}(_0xd73f,0x152));var _0xfd73=function(_0x3f0406,_0x3d338d){_0x3f0406=_0x3f0406-0x0;var _0x667f30=_0xd73f[_0x3f0406];return _0x667f30;};'use strict';var _=require(_0xfd73('0x0'));var util=require('util');var moment=require(_0xfd73('0x1'));var BPromise=require('bluebird');var rs=require(_0xfd73('0x2'));var fs=require('fs');var Redis=require(_0xfd73('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfd73('0x4'));var logger=require(_0xfd73('0x5'))(_0xfd73('0x6'));var config=require(_0xfd73('0x7'));var jayson=require(_0xfd73('0x8'));var client=jayson[_0xfd73('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3fe270,_0x46b9e3,_0x29bdaf){return new BPromise(function(_0x5fd33b,_0x475b1a){return client[_0xfd73('0xa')](_0x3fe270,_0x29bdaf)['then'](function(_0x34a413){logger[_0xfd73('0xb')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x46b9e3,_0xfd73('0xc'));logger[_0xfd73('0xd')](_0xfd73('0xe'),_0x46b9e3,_0xfd73('0xc'),JSON[_0xfd73('0xf')](_0x34a413));if(_0x34a413[_0xfd73('0x10')]){if(_0x34a413[_0xfd73('0x10')][_0xfd73('0x11')]===0x1f4){logger[_0xfd73('0x10')](_0xfd73('0x12'),_0x46b9e3,_0x34a413['error']['message']);return _0x475b1a(_0x34a413[_0xfd73('0x10')][_0xfd73('0x13')]);}logger[_0xfd73('0x10')](_0xfd73('0x12'),_0x46b9e3,_0x34a413['error'][_0xfd73('0x13')]);return _0x5fd33b(_0x34a413[_0xfd73('0x10')][_0xfd73('0x13')]);}else{logger['info'](_0xfd73('0x12'),_0x46b9e3,_0xfd73('0xc'));_0x5fd33b(_0x34a413[_0xfd73('0x14')][_0xfd73('0x13')]);}})[_0xfd73('0x15')](function(_0x2ec286){logger['error'](_0xfd73('0x12'),_0x46b9e3,_0x2ec286);_0x475b1a(_0x2ec286);});});} \ No newline at end of file +var _0x2a7d=['jayson/promise','client','http','info','UserOpenchannelQueue,\x20%s,\x20%s','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','randomstring','../../config/utils'];(function(_0x56f7e2,_0x145392){var _0x36240b=function(_0x216ff7){while(--_0x216ff7){_0x56f7e2['push'](_0x56f7e2['shift']());}};_0x36240b(++_0x145392);}(_0x2a7d,0x174));var _0xd2a7=function(_0x474313,_0x39bfa1){_0x474313=_0x474313-0x0;var _0x212a22=_0x2a7d[_0x474313];return _0x212a22;};'use strict';var _=require(_0xd2a7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd2a7('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd2a7('0x2'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xd2a7('0x3'));var client=jayson[_0xd2a7('0x4')][_0xd2a7('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x20a310,_0x1bb8ee,_0x2a3b9b){return new BPromise(function(_0x1af456,_0x1c6a8f){return client['request'](_0x20a310,_0x2a3b9b)['then'](function(_0x53a746){logger[_0xd2a7('0x6')](_0xd2a7('0x7'),_0x1bb8ee,'request\x20sent');logger['debug'](_0xd2a7('0x8'),_0x1bb8ee,_0xd2a7('0x9'),JSON[_0xd2a7('0xa')](_0x53a746));if(_0x53a746[_0xd2a7('0xb')]){if(_0x53a746[_0xd2a7('0xb')][_0xd2a7('0xc')]===0x1f4){logger[_0xd2a7('0xb')](_0xd2a7('0x7'),_0x1bb8ee,_0x53a746['error'][_0xd2a7('0xd')]);return _0x1c6a8f(_0x53a746['error'][_0xd2a7('0xd')]);}logger[_0xd2a7('0xb')](_0xd2a7('0x7'),_0x1bb8ee,_0x53a746[_0xd2a7('0xb')][_0xd2a7('0xd')]);return _0x1af456(_0x53a746['error'][_0xd2a7('0xd')]);}else{logger['info'](_0xd2a7('0x7'),_0x1bb8ee,_0xd2a7('0x9'));_0x1af456(_0x53a746[_0xd2a7('0xe')][_0xd2a7('0xd')]);}})['catch'](function(_0x4e8e8b){logger[_0xd2a7('0xb')](_0xd2a7('0x7'),_0x1bb8ee,_0x4e8e8b);_0x1c6a8f(_0x4e8e8b);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index de6f2aa..20a31e2 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 _0x1d32=['path','connect-timeout','express','Router','fs-extra','../../config/environment','./userProfile.controller','get','index','isAuthenticated','describe','/:id','show','/:id/sections','getSections','getResources','post','create','clone','addResources','put','delete','destroy','/:id/resources','removeResources','exports','multer'];(function(_0x42bceb,_0x5a8dc7){var _0xf9143b=function(_0xc5afca){while(--_0xc5afca){_0x42bceb['push'](_0x42bceb['shift']());}};_0xf9143b(++_0x5a8dc7);}(_0x1d32,0x128));var _0x21d3=function(_0xba113,_0x104772){_0xba113=_0xba113-0x0;var _0x17e4b7=_0x1d32[_0xba113];return _0x17e4b7;};'use strict';var multer=require(_0x21d3('0x0'));var util=require('util');var path=require(_0x21d3('0x1'));var timeout=require(_0x21d3('0x2'));var express=require(_0x21d3('0x3'));var router=express[_0x21d3('0x4')]();var fs_extra=require(_0x21d3('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x21d3('0x6'));var controller=require(_0x21d3('0x7'));router[_0x21d3('0x8')]('/',auth['isAuthenticated'](),controller[_0x21d3('0x9')]);router[_0x21d3('0x8')]('/describe',auth[_0x21d3('0xa')](),controller[_0x21d3('0xb')]);router['get'](_0x21d3('0xc'),auth[_0x21d3('0xa')](),controller[_0x21d3('0xd')]);router[_0x21d3('0x8')](_0x21d3('0xe'),auth[_0x21d3('0xa')](),controller[_0x21d3('0xf')]);router[_0x21d3('0x8')]('/:id/resources',auth[_0x21d3('0xa')](),controller[_0x21d3('0x10')]);router[_0x21d3('0x11')]('/',auth['isAuthenticated'](),controller[_0x21d3('0x12')]);router[_0x21d3('0x11')]('/:id/clone',auth[_0x21d3('0xa')](),controller[_0x21d3('0x13')]);router['post'](_0x21d3('0xe'),auth[_0x21d3('0xa')](),controller['addSections']);router[_0x21d3('0x11')]('/:id/resources',auth[_0x21d3('0xa')](),controller[_0x21d3('0x14')]);router[_0x21d3('0x15')](_0x21d3('0xc'),auth[_0x21d3('0xa')](),controller['update']);router[_0x21d3('0x16')]('/:id',auth[_0x21d3('0xa')](),controller[_0x21d3('0x17')]);router[_0x21d3('0x16')](_0x21d3('0xe'),auth[_0x21d3('0xa')](),controller['removeSections']);router[_0x21d3('0x16')](_0x21d3('0x18'),auth['isAuthenticated'](),controller[_0x21d3('0x19')]);module[_0x21d3('0x1a')]=router; \ No newline at end of file +var _0x98d5=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','isAuthenticated','get','describe','show','/:id/sections','getSections','getResources','post','create','/:id/clone','clone','addResources','put','/:id','delete','destroy','removeSections','removeResources','exports','multer'];(function(_0x5c8827,_0x5bc5d7){var _0x50ffd5=function(_0x4121bc){while(--_0x4121bc){_0x5c8827['push'](_0x5c8827['shift']());}};_0x50ffd5(++_0x5bc5d7);}(_0x98d5,0xfb));var _0x598d=function(_0x3b71fa,_0xe75ad8){_0x3b71fa=_0x3b71fa-0x0;var _0x340ba2=_0x98d5[_0x3b71fa];return _0x340ba2;};'use strict';var multer=require(_0x598d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x598d('0x1'));var express=require(_0x598d('0x2'));var router=express[_0x598d('0x3')]();var fs_extra=require(_0x598d('0x4'));var auth=require(_0x598d('0x5'));var interaction=require(_0x598d('0x6'));var config=require(_0x598d('0x7'));var controller=require(_0x598d('0x8'));router['get']('/',auth[_0x598d('0x9')](),controller['index']);router[_0x598d('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x598d('0xb')]);router[_0x598d('0xa')]('/:id',auth[_0x598d('0x9')](),controller[_0x598d('0xc')]);router[_0x598d('0xa')](_0x598d('0xd'),auth[_0x598d('0x9')](),controller[_0x598d('0xe')]);router['get']('/:id/resources',auth[_0x598d('0x9')](),controller[_0x598d('0xf')]);router[_0x598d('0x10')]('/',auth[_0x598d('0x9')](),controller[_0x598d('0x11')]);router[_0x598d('0x10')](_0x598d('0x12'),auth[_0x598d('0x9')](),controller[_0x598d('0x13')]);router[_0x598d('0x10')](_0x598d('0xd'),auth[_0x598d('0x9')](),controller['addSections']);router[_0x598d('0x10')]('/:id/resources',auth[_0x598d('0x9')](),controller[_0x598d('0x14')]);router[_0x598d('0x15')](_0x598d('0x16'),auth[_0x598d('0x9')](),controller['update']);router[_0x598d('0x17')](_0x598d('0x16'),auth['isAuthenticated'](),controller[_0x598d('0x18')]);router[_0x598d('0x17')]('/:id/sections',auth[_0x598d('0x9')](),controller[_0x598d('0x19')]);router[_0x598d('0x17')]('/:id/resources',auth['isAuthenticated'](),controller[_0x598d('0x1a')]);module[_0x598d('0x1b')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 83f9966..73ac9fe 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 _0x9032=['sequelize','exports','name','STRING','setDataValue','crudPermissions','join','getDataValue','split','BOOLEAN'];(function(_0x51f67a,_0x1b79a8){var _0x25f7c3=function(_0x442501){while(--_0x442501){_0x51f67a['push'](_0x51f67a['shift']());}};_0x25f7c3(++_0x1b79a8);}(_0x9032,0xe6));var _0x2903=function(_0x5afe2d,_0x3a9915){_0x5afe2d=_0x5afe2d-0x0;var _0x153e43=_0x9032[_0x5afe2d];return _0x153e43;};'use strict';var Sequelize=require(_0x2903('0x0'));module[_0x2903('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x2903('0x2')},'crudPermissions':{'type':Sequelize[_0x2903('0x3')],'set':function(_0x1adfe4){this[_0x2903('0x4')](_0x2903('0x5'),_0x1adfe4?_0x1adfe4[_0x2903('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0x2903('0x5'))?this[_0x2903('0x7')](_0x2903('0x5'))[_0x2903('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x2903('0x3')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x2903('0x9')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x2903('0x9')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x2903('0x9')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x2903('0x9')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x2903('0x9')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x2903('0x9')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x2903('0x9')],'defaultValue':!![]}}; \ No newline at end of file +var _0xdeac=['exports','STRING','setDataValue','crudPermissions','join','getDataValue','split','BOOLEAN'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xdeac,0xd0));var _0xcdea=function(_0x488c22,_0x29e423){_0x488c22=_0x488c22-0x0;var _0x1972d7=_0xdeac[_0x488c22];return _0x1972d7;};'use strict';var Sequelize=require('sequelize');module[_0xcdea('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0xcdea('0x1')],'set':function(_0x17a04a){this[_0xcdea('0x2')](_0xcdea('0x3'),_0x17a04a?_0x17a04a[_0xcdea('0x4')](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this[_0xcdea('0x5')](_0xcdea('0x3'))[_0xcdea('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xcdea('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xcdea('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xcdea('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xcdea('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index e6d314c..9ac97e1 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 _0x6ac2=['findAll','rows','catch','params','options','find','create','clone','get','omit','createdAt','updatedAt','body','transaction','each','autoAssociation','userProfileId','UserProfileSection','UserProfileResource','Resources','describe','addSections','sequelize','sectionId','push','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','forEach','Plugin','resourceId','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','hasOwnProperty','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','undefined','limit','offset','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','send','index','map','UserProfile','rawAttributes','fieldName','type','key','name','keys','query','filters','intersection','model','attributes','fields','length','nolimit','sort','filter','where','merge','VIRTUAL','count','includeAll','include'];(function(_0x68e76f,_0x54cc6e){var _0x405413=function(_0x4eda31){while(--_0x4eda31){_0x68e76f['push'](_0x68e76f['shift']());}};_0x405413(++_0x54cc6e);}(_0x6ac2,0x184));var _0x26ac=function(_0x3cb0d3,_0x46d530){_0x3cb0d3=_0x3cb0d3-0x0;var _0xae89da=_0x6ac2[_0x3cb0d3];return _0xae89da;};'use strict';var emlformat=require(_0x26ac('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x26ac('0x1'));var jsonpatch=require(_0x26ac('0x2'));var rp=require(_0x26ac('0x3'));var moment=require(_0x26ac('0x4'));var BPromise=require(_0x26ac('0x5'));var Mustache=require(_0x26ac('0x6'));var util=require('util');var path=require(_0x26ac('0x7'));var sox=require('sox');var csv=require(_0x26ac('0x8'));var ejs=require(_0x26ac('0x9'));var fs=require('fs');var fs_extra=require(_0x26ac('0xa'));var _=require(_0x26ac('0xb'));var squel=require(_0x26ac('0xc'));var crypto=require(_0x26ac('0xd'));var jsforce=require(_0x26ac('0xe'));var deskjs=require(_0x26ac('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x26ac('0x10'));var Redis=require(_0x26ac('0x11'));var authService=require(_0x26ac('0x12'));var qs=require(_0x26ac('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x26ac('0x14'));var logger=require(_0x26ac('0x15'))(_0x26ac('0x16'));var utils=require(_0x26ac('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x26ac('0x18'))['db'];config[_0x26ac('0x19')]=_[_0x26ac('0x1a')](config[_0x26ac('0x19')],{'host':_0x26ac('0x1b'),'port':0x18eb});var socket=require(_0x26ac('0x1c'))(new Redis(config[_0x26ac('0x19')]));require('./userProfile.socket')[_0x26ac('0x1d')](socket);function respondWithStatusCode(_0x3ec6e6,_0x290cc8){_0x290cc8=_0x290cc8||0xcc;return function(_0x142596){if(_0x142596){return _0x3ec6e6['sendStatus'](_0x290cc8);}return _0x3ec6e6[_0x26ac('0x1e')](_0x290cc8)[_0x26ac('0x1f')]();};}function respondWithResult(_0x4b2d19,_0x3dca1f){_0x3dca1f=_0x3dca1f||0xc8;return function(_0x3b1300){if(_0x3b1300){return _0x4b2d19[_0x26ac('0x1e')](_0x3dca1f)[_0x26ac('0x20')](_0x3b1300);}};}function respondWithFilteredResult(_0x5642b7,_0xfb304b){return function(_0xb03bbc){if(_0xb03bbc){var _0x5cd737=typeof _0xfb304b['offset']===_0x26ac('0x21')&&typeof _0xfb304b[_0x26ac('0x22')]==='undefined';var _0x754fce=_0xb03bbc['count'];var _0x54e0dd=_0x5cd737?0x0:_0xfb304b['offset'];var _0x21e456=_0x5cd737?_0xb03bbc['count']:_0xfb304b[_0x26ac('0x23')]+_0xfb304b[_0x26ac('0x22')];var _0x3c75c1;if(_0x21e456>=_0x754fce){_0x21e456=_0x754fce;_0x3c75c1=0xc8;}else{_0x3c75c1=0xce;}_0x5642b7[_0x26ac('0x1e')](_0x3c75c1);return _0x5642b7[_0x26ac('0x24')](_0x26ac('0x25'),_0x54e0dd+'-'+_0x21e456+'/'+_0x754fce)[_0x26ac('0x20')](_0xb03bbc);}return null;};}function patchUpdates(_0x147721){return function(_0x27765e){try{jsonpatch['apply'](_0x27765e,_0x147721,!![]);}catch(_0x43bce8){return BPromise[_0x26ac('0x26')](_0x43bce8);}return _0x27765e[_0x26ac('0x27')]();};}function saveUpdates(_0x1885f7,_0x346001){return function(_0x268200){if(_0x268200){return _0x268200[_0x26ac('0x28')](_0x1885f7)[_0x26ac('0x29')](function(_0x4172c2){return _0x4172c2;});}return null;};}function removeEntity(_0x2a5ceb,_0x4f752c){return function(_0x4cb76e){if(_0x4cb76e){return _0x4cb76e[_0x26ac('0x2a')]()['then'](function(){_0x2a5ceb[_0x26ac('0x1e')](0xcc)[_0x26ac('0x1f')]();});}};}function handleEntityNotFound(_0xb09d8d,_0x591949){return function(_0x31cb17){if(!_0x31cb17){_0xb09d8d[_0x26ac('0x2b')](0x194);}return _0x31cb17;};}function handleError(_0x53b73f,_0x4d75e2){_0x4d75e2=_0x4d75e2||0x1f4;return function(_0x15bad7){logger[_0x26ac('0x2c')](_0x15bad7[_0x26ac('0x2d')]);if(_0x15bad7['name']){delete _0x15bad7['name'];}_0x53b73f[_0x26ac('0x1e')](_0x4d75e2)[_0x26ac('0x2e')](_0x15bad7);};}exports[_0x26ac('0x2f')]=function(_0x325818,_0x47b7c8){var _0x5e1cbc={},_0x3ea2f0={},_0x3e2148={'count':0x0,'rows':[]};var _0x17691a=_[_0x26ac('0x30')](db[_0x26ac('0x31')][_0x26ac('0x32')],function(_0x58ec04){return{'name':_0x58ec04[_0x26ac('0x33')],'type':_0x58ec04[_0x26ac('0x34')][_0x26ac('0x35')]};});_0x3ea2f0['model']=_[_0x26ac('0x30')](_0x17691a,_0x26ac('0x36'));_0x3ea2f0['query']=_[_0x26ac('0x37')](_0x325818[_0x26ac('0x38')]);_0x3ea2f0[_0x26ac('0x39')]=_[_0x26ac('0x3a')](_0x3ea2f0[_0x26ac('0x3b')],_0x3ea2f0[_0x26ac('0x38')]);_0x5e1cbc[_0x26ac('0x3c')]=_[_0x26ac('0x3a')](_0x3ea2f0[_0x26ac('0x3b')],qs[_0x26ac('0x3d')](_0x325818[_0x26ac('0x38')][_0x26ac('0x3d')]));_0x5e1cbc['attributes']=_0x5e1cbc[_0x26ac('0x3c')][_0x26ac('0x3e')]?_0x5e1cbc[_0x26ac('0x3c')]:_0x3ea2f0['model'];if(!_0x325818[_0x26ac('0x38')]['hasOwnProperty'](_0x26ac('0x3f'))){_0x5e1cbc[_0x26ac('0x22')]=qs['limit'](_0x325818[_0x26ac('0x38')][_0x26ac('0x22')]);_0x5e1cbc[_0x26ac('0x23')]=qs[_0x26ac('0x23')](_0x325818[_0x26ac('0x38')][_0x26ac('0x23')]);}_0x5e1cbc['order']=qs[_0x26ac('0x40')](_0x325818['query'][_0x26ac('0x40')]);_0x5e1cbc['where']=qs[_0x26ac('0x39')](_['pick'](_0x325818['query'],_0x3ea2f0[_0x26ac('0x39')]),_0x17691a);if(_0x325818[_0x26ac('0x38')][_0x26ac('0x41')]){_0x5e1cbc[_0x26ac('0x42')]=_[_0x26ac('0x43')](_0x5e1cbc[_0x26ac('0x42')],{'$or':_['map'](_0x17691a,function(_0x5c89bb){if(_0x5c89bb[_0x26ac('0x34')]!==_0x26ac('0x44')){var _0x2aafa5={};_0x2aafa5[_0x5c89bb['name']]={'$like':'%'+_0x325818['query'][_0x26ac('0x41')]+'%'};return _0x2aafa5;}})});}_0x5e1cbc=_[_0x26ac('0x43')]({},_0x5e1cbc,_0x325818['options']);var _0x5ae9fe={'where':_0x5e1cbc[_0x26ac('0x42')]};return db[_0x26ac('0x31')][_0x26ac('0x45')](_0x5ae9fe)['then'](function(_0x485258){_0x3e2148['count']=_0x485258;if(_0x325818['query'][_0x26ac('0x46')]){_0x5e1cbc[_0x26ac('0x47')]=[{'all':!![]}];}return db[_0x26ac('0x31')][_0x26ac('0x48')](_0x5e1cbc);})[_0x26ac('0x29')](function(_0x13b2af){_0x3e2148[_0x26ac('0x49')]=_0x13b2af;return _0x3e2148;})[_0x26ac('0x29')](respondWithFilteredResult(_0x47b7c8,_0x5e1cbc))[_0x26ac('0x4a')](handleError(_0x47b7c8,null));};exports['show']=function(_0x26a3b3,_0xc6aeb3){var _0xfb928b={'raw':![],'where':{'id':_0x26a3b3[_0x26ac('0x4b')]['id']}},_0x36f95f={};_0x36f95f[_0x26ac('0x3b')]=_[_0x26ac('0x37')](db[_0x26ac('0x31')][_0x26ac('0x32')]);_0x36f95f[_0x26ac('0x38')]=_[_0x26ac('0x37')](_0x26a3b3[_0x26ac('0x38')]);_0x36f95f[_0x26ac('0x39')]=_[_0x26ac('0x3a')](_0x36f95f['model'],_0x36f95f[_0x26ac('0x38')]);_0xfb928b[_0x26ac('0x3c')]=_[_0x26ac('0x3a')](_0x36f95f['model'],qs[_0x26ac('0x3d')](_0x26a3b3[_0x26ac('0x38')][_0x26ac('0x3d')]));_0xfb928b[_0x26ac('0x3c')]=_0xfb928b[_0x26ac('0x3c')][_0x26ac('0x3e')]?_0xfb928b['attributes']:_0x36f95f['model'];if(_0x26a3b3[_0x26ac('0x38')][_0x26ac('0x46')]){_0xfb928b[_0x26ac('0x47')]=[{'all':!![]}];}_0xfb928b=_[_0x26ac('0x43')]({},_0xfb928b,_0x26a3b3[_0x26ac('0x4c')]);return db[_0x26ac('0x31')][_0x26ac('0x4d')](_0xfb928b)[_0x26ac('0x29')](handleEntityNotFound(_0xc6aeb3,null))[_0x26ac('0x29')](respondWithResult(_0xc6aeb3,null))[_0x26ac('0x4a')](handleError(_0xc6aeb3,null));};exports['create']=function(_0x547ff1,_0x324a5f){return db[_0x26ac('0x31')][_0x26ac('0x4e')](_0x547ff1['body'],{})[_0x26ac('0x29')](respondWithResult(_0x324a5f,0xc9))[_0x26ac('0x4a')](handleError(_0x324a5f,null));};exports[_0x26ac('0x4f')]=function(_0x3cec09,_0x5d27b){var _0x3e8c97={'where':{'id':_0x3cec09[_0x26ac('0x4b')]['id']}},_0x1a9f0d={};_0x1a9f0d[_0x26ac('0x3b')]=_[_0x26ac('0x37')](db[_0x26ac('0x31')][_0x26ac('0x32')]);_0x3e8c97[_0x26ac('0x3c')]=_[_0x26ac('0x3a')](_0x1a9f0d['model'],qs['fields'](_0x3cec09[_0x26ac('0x38')][_0x26ac('0x3d')]));_0x3e8c97[_0x26ac('0x3c')]=_0x3e8c97['attributes'][_0x26ac('0x3e')]?_0x3e8c97[_0x26ac('0x3c')]:_0x1a9f0d[_0x26ac('0x3b')];if(_0x3cec09[_0x26ac('0x38')][_0x26ac('0x46')]){_0x3e8c97[_0x26ac('0x47')]=[{'all':!![]}];}_0x3e8c97=_[_0x26ac('0x43')]({},_0x3e8c97,_0x3cec09[_0x26ac('0x4c')]);return db[_0x26ac('0x31')][_0x26ac('0x4d')](_0x3e8c97)[_0x26ac('0x29')](handleEntityNotFound(_0x5d27b,null))[_0x26ac('0x29')](function(_0xe67cf1){if(_0xe67cf1){var _0x438e34=_0xe67cf1[_0x26ac('0x50')]({'plain':!![]});_0x438e34=qs[_0x26ac('0x51')](_0x438e34,['id',_0x26ac('0x52'),_0x26ac('0x53'),'crudPermissions']);_0x3cec09['body']=_[_0x26ac('0x51')](_0x3cec09[_0x26ac('0x54')],['id',_0x26ac('0x52'),_0x26ac('0x53')]);return db['sequelize'][_0x26ac('0x55')](function(_0x547a28){return db[_0x26ac('0x31')]['create'](_[_0x26ac('0x43')](_0x438e34,_0x3cec09[_0x26ac('0x54')]),{'include':_0x3cec09['query'][_0x26ac('0x46')]?[{'all':!![]}]:undefined,'transaction':_0x547a28})['then'](function(_0x319418){var _0x3a16bc=_0x319418[_0x26ac('0x50')]({'plain':!![]});return db['UserProfileSection'][_0x26ac('0x48')]({'where':{'userProfileId':_0x3cec09[_0x26ac('0x4b')]['id']},'raw':!![]})[_0x26ac('0x29')](function(_0x4b4524){if(_0x4b4524){return BPromise[_0x26ac('0x56')](_0x4b4524,function(_0x51dbd0){return new BPromise(function(_0x472a89,_0x305dc4){if(_0x51dbd0['autoAssociation']===null||_0x51dbd0[_0x26ac('0x57')]===0x1)_0x472a89(null);return db['UserProfileResource'][_0x26ac('0x48')]({'where':{'sectionId':_0x51dbd0['id']},'raw':!![]})['then'](function(_0x25e314){var _0x56502c=_[_0x26ac('0x30')](_0x25e314,function(_0x5c8fbf){return qs[_0x26ac('0x51')](_0x5c8fbf,['id','createdAt',_0x26ac('0x53'),'sectionId']);});_0x472a89(_0x56502c);})[_0x26ac('0x4a')](function(_0x4f56f4){_0x305dc4(_0x4f56f4);});})[_0x26ac('0x29')](function(_0x322c03){var _0x812058=qs[_0x26ac('0x51')](_0x51dbd0,['id','createdAt',_0x26ac('0x53')]);_0x812058[_0x26ac('0x58')]=_0x3a16bc['id'];if(_0x322c03)_0x812058['Resources']=_0x322c03;return _0x812058;})['then'](function(_0x5900f1){return db[_0x26ac('0x59')][_0x26ac('0x4e')](_0x5900f1,{'include':[{'model':db[_0x26ac('0x5a')],'as':_0x26ac('0x5b')}],'raw':!![],'transaction':_0x547a28});});})[_0x26ac('0x29')](function(){return _0x3a16bc;});}});});});}})[_0x26ac('0x29')](respondWithResult(_0x5d27b,0xc9))['catch'](handleError(_0x5d27b,null));};exports[_0x26ac('0x28')]=function(_0x58a7ee,_0x5dd26c){if(_0x58a7ee['body']['id']){delete _0x58a7ee[_0x26ac('0x54')]['id'];}return db[_0x26ac('0x31')][_0x26ac('0x4d')]({'where':{'id':_0x58a7ee[_0x26ac('0x4b')]['id']}})[_0x26ac('0x29')](handleEntityNotFound(_0x5dd26c,null))[_0x26ac('0x29')](saveUpdates(_0x58a7ee[_0x26ac('0x54')],null))[_0x26ac('0x29')](respondWithResult(_0x5dd26c,null))[_0x26ac('0x4a')](handleError(_0x5dd26c,null));};exports[_0x26ac('0x2a')]=function(_0x5d76d2,_0x4d46ce){return db[_0x26ac('0x31')][_0x26ac('0x4d')]({'where':{'id':_0x5d76d2['params']['id']}})[_0x26ac('0x29')](handleEntityNotFound(_0x4d46ce,null))[_0x26ac('0x29')](removeEntity(_0x4d46ce,null))[_0x26ac('0x4a')](handleError(_0x4d46ce,null));};exports[_0x26ac('0x5c')]=function(_0x5ccc0c,_0x3d7718){return db[_0x26ac('0x31')][_0x26ac('0x5c')]()[_0x26ac('0x29')](respondWithResult(_0x3d7718,null))[_0x26ac('0x4a')](handleError(_0x3d7718,null));};exports[_0x26ac('0x5d')]=function(_0x1d6262,_0x384f03){var _0x436506=_0x1d6262[_0x26ac('0x54')];return db[_0x26ac('0x31')][_0x26ac('0x4d')]({'where':{'id':_0x1d6262['params']['id']}})[_0x26ac('0x29')](handleEntityNotFound(_0x384f03,null))[_0x26ac('0x29')](function(_0x56759d){if(_0x56759d){return db[_0x26ac('0x5e')][_0x26ac('0x55')](function(_0x440691){return db[_0x26ac('0x59')][_0x26ac('0x2a')]({'where':{'userProfileId':_0x1d6262[_0x26ac('0x4b')]['id'],'sectionId':_[_0x26ac('0x30')](_0x436506,function(_0x562cbe){return _0x562cbe[_0x26ac('0x5f')];})},'transaction':_0x440691})[_0x26ac('0x29')](function(){var _0x10f786=_[_0x26ac('0x30')](_0x436506,function(_0x497793){_0x497793[_0x26ac('0x58')]=_0x1d6262[_0x26ac('0x4b')]['id'];return _0x497793;});var _0x23d916=[];return BPromise['each'](_0x10f786,function(_0x20fcde){return db[_0x26ac('0x59')][_0x26ac('0x4e')](_0x20fcde,{'include':[{'model':db[_0x26ac('0x5a')],'as':_0x26ac('0x5b')}],'raw':!![],'transaction':_0x440691})[_0x26ac('0x29')](function(_0x48f5c0){_0x23d916[_0x26ac('0x60')](_0x48f5c0[_0x26ac('0x50')]({'plain':!![]}));});})[_0x26ac('0x29')](function(){return _0x23d916;});});});}})[_0x26ac('0x29')](function(_0x28ff63){return _0x28ff63;})[_0x26ac('0x29')](respondWithResult(_0x384f03,null))[_0x26ac('0x4a')](handleError(_0x384f03,null));};exports[_0x26ac('0x61')]=function(_0x1a727a,_0x168d75){var _0x417cf8;return db[_0x26ac('0x31')][_0x26ac('0x4d')]({'where':{'id':_0x1a727a['params']['id']},'attributes':['id','name']})[_0x26ac('0x29')](handleEntityNotFound(_0x168d75,null))[_0x26ac('0x29')](function(_0x597259){if(_0x597259){_0x417cf8=_0x597259;return db[_0x26ac('0x59')][_0x26ac('0x2a')]({'where':{'userProfileId':_0x1a727a[_0x26ac('0x4b')]['id'],'sectionId':_0x1a727a[_0x26ac('0x38')][_0x26ac('0x62')]}});}})[_0x26ac('0x29')](function(){return _0x417cf8;})[_0x26ac('0x29')](respondWithStatusCode(_0x168d75,null))[_0x26ac('0x4a')](handleError(_0x168d75,null));};exports[_0x26ac('0x63')]=function(_0x467ea3,_0x5d917c){var _0x502d48=[];var _0x4e0eba=[];return db[_0x26ac('0x59')][_0x26ac('0x48')]({'where':{'userProfileId':_0x467ea3[_0x26ac('0x4b')]['id']},'raw':!![]})[_0x26ac('0x29')](function(_0x3901f5){_0x502d48=_['filter'](_0x3901f5,function(_0x26efef){return _0x26efef[_0x26ac('0x64')]===0x1||_[_0x26ac('0x65')]([0x3eb,0x709],_0x26efef[_0x26ac('0x5f')]);});if(!_[_0x26ac('0x66')](_0x502d48)){return _[_0x26ac('0x30')](_0x502d48,function(_0x220b5f){return _0x220b5f[_0x26ac('0x5f')];});}else{return;}})[_0x26ac('0x29')](function(_0x4a8eb7){if(_0x4a8eb7)_0x4e0eba=_0x4a8eb7;if(_['includes'](_0x4e0eba,0x64)){var _0x4d2f09=_['find'](_0x502d48,{'sectionId':0x64});return hasDefaultDashboard(_0x4d2f09)[_0x26ac('0x29')](function(_0x1c9cb3){return _[_0x26ac('0x30')](_0x502d48,function(_0x125186){if(_0x125186[_0x26ac('0x5f')]===0x64){_0x125186['subsections']=_0x1c9cb3;}return _0x125186;});});}else{return;}})['then'](function(_0x3ccc10){if(_0x3ccc10)_0x502d48=_0x3ccc10;if(_[_0x26ac('0x65')](_0x4e0eba,0x3eb)){var _0x42a693=_[_0x26ac('0x4d')](_0x502d48,{'sectionId':0x3eb});return getCustomDashboards(_0x42a693)[_0x26ac('0x29')](function(_0x548ddf){return _[_0x26ac('0x30')](_0x502d48,function(_0xa54913){if(_0x42a693[_0x26ac('0x64')]){if(_0xa54913['sectionId']===0x3eb){_0xa54913[_0x26ac('0x67')]=_0x548ddf;}}else{if(_0xa54913[_0x26ac('0x5f')]===0x64){_0xa54913[_0x26ac('0x67')]=_0x548ddf;}}return _0xa54913;});});}else{return;}})[_0x26ac('0x29')](function(_0x65ebfd){if(_0x65ebfd)_0x502d48=_0x65ebfd;if(_[_0x26ac('0x65')](_0x4e0eba,0x709)){var _0x116ef1=_[_0x26ac('0x4d')](_0x502d48,{'sectionId':0x709});return getPlugins(_0x116ef1)[_0x26ac('0x29')](function(_0x51ec8c){if(_0x116ef1[_0x26ac('0x64')]){return _[_0x26ac('0x30')](_0x502d48,function(_0x4cd62b){if(_0x4cd62b[_0x26ac('0x5f')]===0x709){_0x4cd62b[_0x26ac('0x67')]=_0x51ec8c;}return _0x4cd62b;});}else{var _0x451185={'sectionId':0x76c,'enabled':0x1,'subsections':_0x51ec8c};var _0x309efa=_[_0x26ac('0x30')](_0x502d48);_0x309efa[_0x26ac('0x60')](_0x451185);return _0x309efa;}});}else{return;}})[_0x26ac('0x29')](function(_0x276ad0){if(_0x276ad0)_0x502d48=_0x276ad0;return _[_0x26ac('0x41')](_0x502d48,['enabled',0x1]);})['then'](respondWithResult(_0x5d917c,null))[_0x26ac('0x4a')](handleError(_0x5d917c,null));};function hasDefaultDashboard(_0x8f0e7d){var _0x41339d=[0x65];return new BPromise(function(_0x2a5f33,_0x495568){try{if(_0x8f0e7d['autoAssociation']){_0x2a5f33(_0x41339d);}else{return db[_0x26ac('0x5a')]['findOne']({'where':{'sectionId':_0x8f0e7d['id']},'raw':!![]})['then'](function(_0x5d7a48){_0x5d7a48?_0x2a5f33(_0x41339d):_0x2a5f33();});}}catch(_0x353e10){_0x495568(_0x353e10);}});}function getCustomDashboards(_0x1fa9b3){var _0x338ac1=[];return new BPromise(function(_0x2a3a46,_0x328710){try{if(_0x1fa9b3[_0x26ac('0x57')]){return db['Dashboard'][_0x26ac('0x48')]({'raw':!![]})['then'](function(_0x2ea336){_0x2ea336['forEach'](function(_0x5e3fbc){_0x338ac1[_0x26ac('0x60')](_0x5e3fbc['id']+0x1869f);});_0x2a3a46(_0x338ac1);});}else{return db[_0x26ac('0x5a')]['findAll']({'where':{'sectionId':_0x1fa9b3['id']},'raw':!![]})[_0x26ac('0x29')](function(_0x20f736){_0x20f736[_0x26ac('0x68')](function(_0x3ba1cc){_0x338ac1[_0x26ac('0x60')](_0x3ba1cc['resourceId']+0x1869f);});_0x2a3a46(_0x338ac1);});}}catch(_0x29684c){_0x328710(_0x29684c);}});}function getPlugins(_0x41144b){var _0x4d0c98=[];return new BPromise(function(_0x2c1239,_0x4bb7a9){try{if(_0x41144b[_0x26ac('0x57')]){return db[_0x26ac('0x69')]['findAll']({'raw':!![]})['then'](function(_0xc9296){_0xc9296['forEach'](function(_0x3dc1f4){_0x4d0c98[_0x26ac('0x60')](_0x3dc1f4['id']+0x15b38);});_0x2c1239(_0x4d0c98);});}else{return db[_0x26ac('0x5a')][_0x26ac('0x48')]({'where':{'sectionId':_0x41144b['id']},'raw':!![]})[_0x26ac('0x29')](function(_0x4e5918){_0x4e5918['forEach'](function(_0x594e79){_0x4d0c98[_0x26ac('0x60')](_0x594e79[_0x26ac('0x6a')]+0x15b38);});_0x2c1239(_0x4d0c98);});}}catch(_0x1538ec){_0x4bb7a9(_0x1538ec);}});}exports[_0x26ac('0x6b')]=function(_0x3309c0,_0x37c8e8){return db[_0x26ac('0x31')]['find']({'where':{'id':_0x3309c0[_0x26ac('0x4b')]['id']}})['then'](handleEntityNotFound(_0x37c8e8,null))['then'](function(_0x3aff3a){if(_0x3aff3a){return db[_0x26ac('0x5e')][_0x26ac('0x55')](function(_0x2d26c3){return db[_0x26ac('0x59')][_0x26ac('0x48')]({'where':{'userProfileId':_0x3309c0[_0x26ac('0x4b')]['id']},'attributes':['id'],'raw':!![]})[_0x26ac('0x29')](function(_0x1acc6a){if(_0x1acc6a){return db['UserProfileSection'][_0x26ac('0x2a')]({'where':{'userProfileId':_0x3309c0['params']['id'],'id':_[_0x26ac('0x30')](_0x1acc6a,function(_0x33c8f6){return _0x33c8f6['id'];})},'transaction':_0x2d26c3});}})[_0x26ac('0x29')](function(_0x2c06ef){var _0x1e9e74=_[_0x26ac('0x30')](_0x3309c0['body'],function(_0x2f1ecc){_0x2f1ecc['userProfileId']=_0x3309c0[_0x26ac('0x4b')]['id'];return _0x2f1ecc;});return db[_0x26ac('0x59')]['bulkCreate'](_0x1e9e74,{'raw':!![],'transaction':_0x2d26c3});})[_0x26ac('0x29')](function(_0x399ab4){var _0x2bdc08=_['filter'](_[_0x26ac('0x30')](_0x399ab4,function(_0x415559){return _0x415559[_0x26ac('0x50')]({'plain':!![]});}),{'includeAll':![]});if(_0x2bdc08){return db[_0x26ac('0x59')][_0x26ac('0x48')]({'where':{'userProfileId':_0x3309c0[_0x26ac('0x4b')]['id'],'sectionId':_[_0x26ac('0x30')](_0x2bdc08,function(_0x382da4){return _0x382da4[_0x26ac('0x5f')];})},'attributes':['id','sectionId'],'raw':!![]})[_0x26ac('0x29')](function(_0x317caf){var _0x1f0890=_['map'](_0x3309c0['body'],function(_0x32d4ae){_0x32d4ae[_0x26ac('0x58')]=_0x3309c0[_0x26ac('0x4b')]['id'];return _0x32d4ae;});return db[_0x26ac('0x5a')][_0x26ac('0x6c')](_0x1f0890,{'raw':!![],'transaction':_0x2d26c3});});}})[_0x26ac('0x4a')](handleError(_0x37c8e8,null));});}})[_0x26ac('0x29')](function(_0x3f3ec){var _0x497760=_[_0x26ac('0x30')](_0x3f3ec,function(_0x240b94){return _0x240b94[_0x26ac('0x50')]({'plain':!![]});});})['then'](respondWithResult(_0x37c8e8,null))[_0x26ac('0x4a')](handleError(_0x37c8e8,null));};exports[_0x26ac('0x6d')]=function(_0x49d6f3,_0x4d3028,_0x220ac0){return db[_0x26ac('0x31')][_0x26ac('0x4d')]({'where':{'id':_0x49d6f3['params']['id']}})['then'](handleEntityNotFound(_0x4d3028,null))[_0x26ac('0x29')](function(_0x4f6a59){if(_0x4f6a59){return _0x4f6a59[_0x26ac('0x6d')](_0x49d6f3[_0x26ac('0x38')][_0x26ac('0x62')]);}})[_0x26ac('0x29')](respondWithStatusCode(_0x4d3028,null))['catch'](handleError(_0x4d3028,null));};exports[_0x26ac('0x6e')]=function(_0x5f13d6,_0x240b3a){var _0x30a0d3={};if(!_0x5f13d6[_0x26ac('0x38')][_0x26ac('0x6f')])throw new Error(_0x26ac('0x70'));if(!_0x5f13d6[_0x26ac('0x38')][_0x26ac('0x71')](_0x26ac('0x3f'))){_0x30a0d3[_0x26ac('0x22')]=qs[_0x26ac('0x22')](_0x5f13d6['query'][_0x26ac('0x22')]);_0x30a0d3[_0x26ac('0x23')]=qs['offset'](_0x5f13d6['query']['offset']);}return db[_0x26ac('0x31')]['find']({'where':{'id':_0x5f13d6[_0x26ac('0x4b')]['id']}})[_0x26ac('0x29')](function(_0x47c8d9){if(!_0x47c8d9)throw new Error(_0x26ac('0x72')+_0x5f13d6[_0x26ac('0x4b')]['id']);return db['UserProfile']['getResources'](_0x5f13d6);})[_0x26ac('0x29')](respondWithFilteredResult(_0x240b3a,_0x30a0d3))[_0x26ac('0x4a')](handleError(_0x240b3a,null));}; \ No newline at end of file +var _0x2b47=['get','UserProfileSection','autoAssociation','UserProfileResource','userProfileId','Resources','update','find','describe','addSections','each','push','removeSections','ids','getSections','sectionId','subsections','includes','enabled','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','section','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','status','json','offset','undefined','limit','count','set','apply','reject','then','destroy','end','sendStatus','stack','name','send','index','map','UserProfile','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','where','pick','filter','merge','VIRTUAL','options','findAll','params','includeAll','catch','body','clone','include','createdAt','updatedAt','omit','sequelize','transaction','create'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2b47,0x177));var _0x72b4=function(_0x362d3d,_0x4da2fb){_0x362d3d=_0x362d3d-0x0;var _0x3cef9c=_0x2b47[_0x362d3d];return _0x3cef9c;};'use strict';var emlformat=require(_0x72b4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x72b4('0x1'));var jsonpatch=require(_0x72b4('0x2'));var rp=require(_0x72b4('0x3'));var moment=require('moment');var BPromise=require(_0x72b4('0x4'));var Mustache=require(_0x72b4('0x5'));var util=require(_0x72b4('0x6'));var path=require(_0x72b4('0x7'));var sox=require(_0x72b4('0x8'));var csv=require(_0x72b4('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x72b4('0xa'));var _=require('lodash');var squel=require(_0x72b4('0xb'));var crypto=require(_0x72b4('0xc'));var jsforce=require(_0x72b4('0xd'));var deskjs=require(_0x72b4('0xe'));var toCsv=require(_0x72b4('0x9'));var querystring=require(_0x72b4('0xf'));var Papa=require(_0x72b4('0x10'));var Redis=require(_0x72b4('0x11'));var authService=require(_0x72b4('0x12'));var qs=require(_0x72b4('0x13'));var as=require(_0x72b4('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x72b4('0x15'))(_0x72b4('0x16'));var utils=require(_0x72b4('0x17'));var config=require(_0x72b4('0x18'));var licenseUtil=require(_0x72b4('0x19'));var db=require(_0x72b4('0x1a'))['db'];config[_0x72b4('0x1b')]=_[_0x72b4('0x1c')](config[_0x72b4('0x1b')],{'host':_0x72b4('0x1d'),'port':0x18eb});var socket=require(_0x72b4('0x1e'))(new Redis(config['redis']));require(_0x72b4('0x1f'))[_0x72b4('0x20')](socket);function respondWithStatusCode(_0x28ae3c,_0x46eb8f){_0x46eb8f=_0x46eb8f||0xcc;return function(_0x5cd685){if(_0x5cd685){return _0x28ae3c['sendStatus'](_0x46eb8f);}return _0x28ae3c[_0x72b4('0x21')](_0x46eb8f)['end']();};}function respondWithResult(_0x21ff7d,_0x2d4fd0){_0x2d4fd0=_0x2d4fd0||0xc8;return function(_0x5ac4fc){if(_0x5ac4fc){return _0x21ff7d[_0x72b4('0x21')](_0x2d4fd0)[_0x72b4('0x22')](_0x5ac4fc);}};}function respondWithFilteredResult(_0x3318fc,_0x144fe2){return function(_0x139d30){if(_0x139d30){var _0x334910=typeof _0x144fe2[_0x72b4('0x23')]===_0x72b4('0x24')&&typeof _0x144fe2[_0x72b4('0x25')]==='undefined';var _0x9b4e7a=_0x139d30['count'];var _0x22dab0=_0x334910?0x0:_0x144fe2[_0x72b4('0x23')];var _0x518fda=_0x334910?_0x139d30[_0x72b4('0x26')]:_0x144fe2[_0x72b4('0x23')]+_0x144fe2['limit'];var _0x2d0e1f;if(_0x518fda>=_0x9b4e7a){_0x518fda=_0x9b4e7a;_0x2d0e1f=0xc8;}else{_0x2d0e1f=0xce;}_0x3318fc['status'](_0x2d0e1f);return _0x3318fc[_0x72b4('0x27')]('Content-Range',_0x22dab0+'-'+_0x518fda+'/'+_0x9b4e7a)['json'](_0x139d30);}return null;};}function patchUpdates(_0x1f0986){return function(_0x5966f5){try{jsonpatch[_0x72b4('0x28')](_0x5966f5,_0x1f0986,!![]);}catch(_0x8e0277){return BPromise[_0x72b4('0x29')](_0x8e0277);}return _0x5966f5['save']();};}function saveUpdates(_0x3a21d6,_0x24921b){return function(_0x355d21){if(_0x355d21){return _0x355d21['update'](_0x3a21d6)[_0x72b4('0x2a')](function(_0x10df07){return _0x10df07;});}return null;};}function removeEntity(_0x15f819,_0x273aa3){return function(_0x393eef){if(_0x393eef){return _0x393eef[_0x72b4('0x2b')]()[_0x72b4('0x2a')](function(){_0x15f819['status'](0xcc)[_0x72b4('0x2c')]();});}};}function handleEntityNotFound(_0x5d0d20,_0x32c0ab){return function(_0x20bcb0){if(!_0x20bcb0){_0x5d0d20[_0x72b4('0x2d')](0x194);}return _0x20bcb0;};}function handleError(_0x464a4d,_0x4785b9){_0x4785b9=_0x4785b9||0x1f4;return function(_0x3c7167){logger['error'](_0x3c7167[_0x72b4('0x2e')]);if(_0x3c7167[_0x72b4('0x2f')]){delete _0x3c7167[_0x72b4('0x2f')];}_0x464a4d[_0x72b4('0x21')](_0x4785b9)[_0x72b4('0x30')](_0x3c7167);};}exports[_0x72b4('0x31')]=function(_0x28c7ce,_0x12291d){var _0x5554cb={},_0x256e14={},_0x16eef5={'count':0x0,'rows':[]};var _0x5b0169=_[_0x72b4('0x32')](db[_0x72b4('0x33')][_0x72b4('0x34')],function(_0x2f9fe7){return{'name':_0x2f9fe7[_0x72b4('0x35')],'type':_0x2f9fe7[_0x72b4('0x36')][_0x72b4('0x37')]};});_0x256e14[_0x72b4('0x38')]=_[_0x72b4('0x32')](_0x5b0169,_0x72b4('0x2f'));_0x256e14[_0x72b4('0x39')]=_[_0x72b4('0x3a')](_0x28c7ce[_0x72b4('0x39')]);_0x256e14[_0x72b4('0x3b')]=_[_0x72b4('0x3c')](_0x256e14[_0x72b4('0x38')],_0x256e14['query']);_0x5554cb['attributes']=_[_0x72b4('0x3c')](_0x256e14['model'],qs[_0x72b4('0x3d')](_0x28c7ce['query'][_0x72b4('0x3d')]));_0x5554cb[_0x72b4('0x3e')]=_0x5554cb[_0x72b4('0x3e')][_0x72b4('0x3f')]?_0x5554cb['attributes']:_0x256e14[_0x72b4('0x38')];if(!_0x28c7ce[_0x72b4('0x39')][_0x72b4('0x40')](_0x72b4('0x41'))){_0x5554cb[_0x72b4('0x25')]=qs[_0x72b4('0x25')](_0x28c7ce[_0x72b4('0x39')][_0x72b4('0x25')]);_0x5554cb[_0x72b4('0x23')]=qs['offset'](_0x28c7ce['query'][_0x72b4('0x23')]);}_0x5554cb['order']=qs['sort'](_0x28c7ce[_0x72b4('0x39')]['sort']);_0x5554cb[_0x72b4('0x42')]=qs[_0x72b4('0x3b')](_[_0x72b4('0x43')](_0x28c7ce[_0x72b4('0x39')],_0x256e14[_0x72b4('0x3b')]),_0x5b0169);if(_0x28c7ce[_0x72b4('0x39')][_0x72b4('0x44')]){_0x5554cb[_0x72b4('0x42')]=_[_0x72b4('0x45')](_0x5554cb[_0x72b4('0x42')],{'$or':_[_0x72b4('0x32')](_0x5b0169,function(_0x40f0b9){if(_0x40f0b9[_0x72b4('0x36')]!==_0x72b4('0x46')){var _0x4d8660={};_0x4d8660[_0x40f0b9[_0x72b4('0x2f')]]={'$like':'%'+_0x28c7ce[_0x72b4('0x39')]['filter']+'%'};return _0x4d8660;}})});}_0x5554cb=_[_0x72b4('0x45')]({},_0x5554cb,_0x28c7ce[_0x72b4('0x47')]);var _0x1a4b21={'where':_0x5554cb[_0x72b4('0x42')]};return db['UserProfile'][_0x72b4('0x26')](_0x1a4b21)[_0x72b4('0x2a')](function(_0x46d043){_0x16eef5[_0x72b4('0x26')]=_0x46d043;if(_0x28c7ce[_0x72b4('0x39')]['includeAll']){_0x5554cb['include']=[{'all':!![]}];}return db[_0x72b4('0x33')][_0x72b4('0x48')](_0x5554cb);})['then'](function(_0x4bd077){_0x16eef5['rows']=_0x4bd077;return _0x16eef5;})[_0x72b4('0x2a')](respondWithFilteredResult(_0x12291d,_0x5554cb))['catch'](handleError(_0x12291d,null));};exports['show']=function(_0x1807ee,_0x16e0b7){var _0x5ab64e={'raw':![],'where':{'id':_0x1807ee[_0x72b4('0x49')]['id']}},_0x46557f={};_0x46557f['model']=_[_0x72b4('0x3a')](db[_0x72b4('0x33')][_0x72b4('0x34')]);_0x46557f[_0x72b4('0x39')]=_[_0x72b4('0x3a')](_0x1807ee['query']);_0x46557f['filters']=_[_0x72b4('0x3c')](_0x46557f[_0x72b4('0x38')],_0x46557f[_0x72b4('0x39')]);_0x5ab64e[_0x72b4('0x3e')]=_[_0x72b4('0x3c')](_0x46557f['model'],qs['fields'](_0x1807ee[_0x72b4('0x39')][_0x72b4('0x3d')]));_0x5ab64e[_0x72b4('0x3e')]=_0x5ab64e[_0x72b4('0x3e')]['length']?_0x5ab64e[_0x72b4('0x3e')]:_0x46557f[_0x72b4('0x38')];if(_0x1807ee[_0x72b4('0x39')][_0x72b4('0x4a')]){_0x5ab64e['include']=[{'all':!![]}];}_0x5ab64e=_[_0x72b4('0x45')]({},_0x5ab64e,_0x1807ee[_0x72b4('0x47')]);return db[_0x72b4('0x33')]['find'](_0x5ab64e)[_0x72b4('0x2a')](handleEntityNotFound(_0x16e0b7,null))[_0x72b4('0x2a')](respondWithResult(_0x16e0b7,null))[_0x72b4('0x4b')](handleError(_0x16e0b7,null));};exports['create']=function(_0x5f29d0,_0x216b5a){return db[_0x72b4('0x33')]['create'](_0x5f29d0[_0x72b4('0x4c')],{})[_0x72b4('0x2a')](respondWithResult(_0x216b5a,0xc9))[_0x72b4('0x4b')](handleError(_0x216b5a,null));};exports[_0x72b4('0x4d')]=function(_0xd6edfe,_0x515bcf){var _0xe177f={'where':{'id':_0xd6edfe[_0x72b4('0x49')]['id']}},_0x4cb9be={};_0x4cb9be['model']=_['keys'](db[_0x72b4('0x33')]['rawAttributes']);_0xe177f[_0x72b4('0x3e')]=_['intersection'](_0x4cb9be[_0x72b4('0x38')],qs[_0x72b4('0x3d')](_0xd6edfe[_0x72b4('0x39')][_0x72b4('0x3d')]));_0xe177f[_0x72b4('0x3e')]=_0xe177f[_0x72b4('0x3e')][_0x72b4('0x3f')]?_0xe177f['attributes']:_0x4cb9be[_0x72b4('0x38')];if(_0xd6edfe[_0x72b4('0x39')]['includeAll']){_0xe177f[_0x72b4('0x4e')]=[{'all':!![]}];}_0xe177f=_['merge']({},_0xe177f,_0xd6edfe[_0x72b4('0x47')]);return db[_0x72b4('0x33')]['find'](_0xe177f)['then'](handleEntityNotFound(_0x515bcf,null))[_0x72b4('0x2a')](function(_0x5ae0fd){if(_0x5ae0fd){var _0xce0288=_0x5ae0fd['get']({'plain':!![]});_0xce0288=qs['omit'](_0xce0288,['id',_0x72b4('0x4f'),_0x72b4('0x50'),'crudPermissions']);_0xd6edfe[_0x72b4('0x4c')]=_[_0x72b4('0x51')](_0xd6edfe[_0x72b4('0x4c')],['id',_0x72b4('0x4f'),_0x72b4('0x50')]);return db[_0x72b4('0x52')][_0x72b4('0x53')](function(_0xa1ecbd){return db[_0x72b4('0x33')][_0x72b4('0x54')](_['merge'](_0xce0288,_0xd6edfe['body']),{'include':_0xd6edfe[_0x72b4('0x39')][_0x72b4('0x4a')]?[{'all':!![]}]:undefined,'transaction':_0xa1ecbd})['then'](function(_0x18760e){var _0x5611ae=_0x18760e[_0x72b4('0x55')]({'plain':!![]});return db[_0x72b4('0x56')][_0x72b4('0x48')]({'where':{'userProfileId':_0xd6edfe[_0x72b4('0x49')]['id']},'raw':!![]})[_0x72b4('0x2a')](function(_0xe26404){if(_0xe26404){return BPromise['each'](_0xe26404,function(_0x2c0df3){return new BPromise(function(_0x3cebc1,_0x355399){if(_0x2c0df3[_0x72b4('0x57')]===null||_0x2c0df3[_0x72b4('0x57')]===0x1)_0x3cebc1(null);return db[_0x72b4('0x58')][_0x72b4('0x48')]({'where':{'sectionId':_0x2c0df3['id']},'raw':!![]})[_0x72b4('0x2a')](function(_0x20011d){var _0x1f48d2=_[_0x72b4('0x32')](_0x20011d,function(_0x10a6ec){return qs[_0x72b4('0x51')](_0x10a6ec,['id','createdAt',_0x72b4('0x50'),'sectionId']);});_0x3cebc1(_0x1f48d2);})[_0x72b4('0x4b')](function(_0x520da2){_0x355399(_0x520da2);});})['then'](function(_0x3c6819){var _0x1dd783=qs['omit'](_0x2c0df3,['id',_0x72b4('0x4f'),_0x72b4('0x50')]);_0x1dd783[_0x72b4('0x59')]=_0x5611ae['id'];if(_0x3c6819)_0x1dd783[_0x72b4('0x5a')]=_0x3c6819;return _0x1dd783;})[_0x72b4('0x2a')](function(_0x3a91bb){return db[_0x72b4('0x56')][_0x72b4('0x54')](_0x3a91bb,{'include':[{'model':db[_0x72b4('0x58')],'as':_0x72b4('0x5a')}],'raw':!![],'transaction':_0xa1ecbd});});})['then'](function(){return _0x5611ae;});}});});});}})['then'](respondWithResult(_0x515bcf,0xc9))[_0x72b4('0x4b')](handleError(_0x515bcf,null));};exports[_0x72b4('0x5b')]=function(_0x2602ef,_0x309db6){if(_0x2602ef[_0x72b4('0x4c')]['id']){delete _0x2602ef[_0x72b4('0x4c')]['id'];}return db['UserProfile']['find']({'where':{'id':_0x2602ef['params']['id']}})[_0x72b4('0x2a')](handleEntityNotFound(_0x309db6,null))['then'](saveUpdates(_0x2602ef[_0x72b4('0x4c')],null))[_0x72b4('0x2a')](respondWithResult(_0x309db6,null))[_0x72b4('0x4b')](handleError(_0x309db6,null));};exports['destroy']=function(_0x58edff,_0x4bb94c){return db['UserProfile'][_0x72b4('0x5c')]({'where':{'id':_0x58edff[_0x72b4('0x49')]['id']}})[_0x72b4('0x2a')](handleEntityNotFound(_0x4bb94c,null))[_0x72b4('0x2a')](removeEntity(_0x4bb94c,null))[_0x72b4('0x4b')](handleError(_0x4bb94c,null));};exports[_0x72b4('0x5d')]=function(_0x440fde,_0x4d6889){return db[_0x72b4('0x33')][_0x72b4('0x5d')]()[_0x72b4('0x2a')](respondWithResult(_0x4d6889,null))[_0x72b4('0x4b')](handleError(_0x4d6889,null));};exports[_0x72b4('0x5e')]=function(_0x1bbe16,_0x5aea4b){var _0x1ca7ca=_0x1bbe16[_0x72b4('0x4c')];return db['UserProfile']['find']({'where':{'id':_0x1bbe16[_0x72b4('0x49')]['id']}})[_0x72b4('0x2a')](handleEntityNotFound(_0x5aea4b,null))[_0x72b4('0x2a')](function(_0x4b9862){if(_0x4b9862){return db[_0x72b4('0x52')][_0x72b4('0x53')](function(_0x18aa05){return db[_0x72b4('0x56')][_0x72b4('0x2b')]({'where':{'userProfileId':_0x1bbe16['params']['id'],'sectionId':_[_0x72b4('0x32')](_0x1ca7ca,function(_0x96c192){return _0x96c192['sectionId'];})},'transaction':_0x18aa05})[_0x72b4('0x2a')](function(){var _0x2c7034=_[_0x72b4('0x32')](_0x1ca7ca,function(_0x75c77c){_0x75c77c[_0x72b4('0x59')]=_0x1bbe16[_0x72b4('0x49')]['id'];return _0x75c77c;});var _0x1a7393=[];return BPromise[_0x72b4('0x5f')](_0x2c7034,function(_0x4fb9b5){return db[_0x72b4('0x56')][_0x72b4('0x54')](_0x4fb9b5,{'include':[{'model':db['UserProfileResource'],'as':_0x72b4('0x5a')}],'raw':!![],'transaction':_0x18aa05})[_0x72b4('0x2a')](function(_0x4f6856){_0x1a7393[_0x72b4('0x60')](_0x4f6856[_0x72b4('0x55')]({'plain':!![]}));});})[_0x72b4('0x2a')](function(){return _0x1a7393;});});});}})[_0x72b4('0x2a')](function(_0x51f331){return _0x51f331;})[_0x72b4('0x2a')](respondWithResult(_0x5aea4b,null))[_0x72b4('0x4b')](handleError(_0x5aea4b,null));};exports[_0x72b4('0x61')]=function(_0x47927c,_0x4d7462){var _0x43e064;return db[_0x72b4('0x33')][_0x72b4('0x5c')]({'where':{'id':_0x47927c[_0x72b4('0x49')]['id']},'attributes':['id',_0x72b4('0x2f')]})['then'](handleEntityNotFound(_0x4d7462,null))[_0x72b4('0x2a')](function(_0x10f3b0){if(_0x10f3b0){_0x43e064=_0x10f3b0;return db[_0x72b4('0x56')][_0x72b4('0x2b')]({'where':{'userProfileId':_0x47927c['params']['id'],'sectionId':_0x47927c[_0x72b4('0x39')][_0x72b4('0x62')]}});}})[_0x72b4('0x2a')](function(){return _0x43e064;})[_0x72b4('0x2a')](respondWithStatusCode(_0x4d7462,null))['catch'](handleError(_0x4d7462,null));};exports[_0x72b4('0x63')]=function(_0xd5dca3,_0x4d4133){var _0x32d29d=[];var _0x41026a=[];return db['UserProfileSection'][_0x72b4('0x48')]({'where':{'userProfileId':_0xd5dca3[_0x72b4('0x49')]['id']},'raw':!![]})[_0x72b4('0x2a')](function(_0x1f8095){_0x32d29d=_[_0x72b4('0x44')](_0x1f8095,function(_0x4249ca){return _0x4249ca['enabled']===0x1||_['includes']([0x3eb,0x709],_0x4249ca[_0x72b4('0x64')]);});if(!_['isEmpty'](_0x32d29d)){return _[_0x72b4('0x32')](_0x32d29d,function(_0x18d5dc){return _0x18d5dc[_0x72b4('0x64')];});}else{return;}})[_0x72b4('0x2a')](function(_0xd48642){if(_0xd48642)_0x41026a=_0xd48642;if(_['includes'](_0x41026a,0x64)){var _0x327b81=_[_0x72b4('0x5c')](_0x32d29d,{'sectionId':0x64});return hasDefaultDashboard(_0x327b81)[_0x72b4('0x2a')](function(_0x38111f){return _[_0x72b4('0x32')](_0x32d29d,function(_0x596ed0){if(_0x596ed0[_0x72b4('0x64')]===0x64){_0x596ed0[_0x72b4('0x65')]=_0x38111f;}return _0x596ed0;});});}else{return;}})[_0x72b4('0x2a')](function(_0x8e633b){if(_0x8e633b)_0x32d29d=_0x8e633b;if(_[_0x72b4('0x66')](_0x41026a,0x3eb)){var _0x58edcf=_[_0x72b4('0x5c')](_0x32d29d,{'sectionId':0x3eb});return getCustomDashboards(_0x58edcf)[_0x72b4('0x2a')](function(_0x20462b){return _['map'](_0x32d29d,function(_0xbe220c){if(_0x58edcf[_0x72b4('0x67')]){if(_0xbe220c[_0x72b4('0x64')]===0x3eb){_0xbe220c[_0x72b4('0x65')]=_0x20462b;}}else{if(_0xbe220c[_0x72b4('0x64')]===0x64){_0xbe220c[_0x72b4('0x65')]=_0x20462b;}}return _0xbe220c;});});}else{return;}})[_0x72b4('0x2a')](function(_0x20580d){if(_0x20580d)_0x32d29d=_0x20580d;if(_[_0x72b4('0x66')](_0x41026a,0x709)){var _0x197e6c=_['find'](_0x32d29d,{'sectionId':0x709});return getPlugins(_0x197e6c)[_0x72b4('0x2a')](function(_0x25e0f8){if(_0x197e6c[_0x72b4('0x67')]){return _['map'](_0x32d29d,function(_0x4a5f9d){if(_0x4a5f9d[_0x72b4('0x64')]===0x709){_0x4a5f9d[_0x72b4('0x65')]=_0x25e0f8;}return _0x4a5f9d;});}else{var _0x4c8e68={'sectionId':0x76c,'enabled':0x1,'subsections':_0x25e0f8};var _0x2c5d7c=_[_0x72b4('0x32')](_0x32d29d);_0x2c5d7c['push'](_0x4c8e68);return _0x2c5d7c;}});}else{return;}})['then'](function(_0x11cc95){if(_0x11cc95)_0x32d29d=_0x11cc95;return _[_0x72b4('0x44')](_0x32d29d,[_0x72b4('0x67'),0x1]);})['then'](respondWithResult(_0x4d4133,null))[_0x72b4('0x4b')](handleError(_0x4d4133,null));};function hasDefaultDashboard(_0x460996){var _0x348d13=[0x65];return new BPromise(function(_0x2162c7,_0x2b103a){try{if(_0x460996[_0x72b4('0x57')]){_0x2162c7(_0x348d13);}else{return db[_0x72b4('0x58')][_0x72b4('0x68')]({'where':{'sectionId':_0x460996['id']},'raw':!![]})['then'](function(_0x5e3aab){_0x5e3aab?_0x2162c7(_0x348d13):_0x2162c7();});}}catch(_0x42df2a){_0x2b103a(_0x42df2a);}});}function getCustomDashboards(_0x25b6d1){var _0x26b600=[];return new BPromise(function(_0x2a7a1f,_0x4b7c59){try{if(_0x25b6d1[_0x72b4('0x57')]){return db[_0x72b4('0x69')][_0x72b4('0x48')]({'raw':!![]})[_0x72b4('0x2a')](function(_0x61320){_0x61320[_0x72b4('0x6a')](function(_0xaf6b72){_0x26b600[_0x72b4('0x60')](_0xaf6b72['id']+0x1869f);});_0x2a7a1f(_0x26b600);});}else{return db[_0x72b4('0x58')][_0x72b4('0x48')]({'where':{'sectionId':_0x25b6d1['id']},'raw':!![]})[_0x72b4('0x2a')](function(_0x24c994){_0x24c994['forEach'](function(_0x32320c){_0x26b600[_0x72b4('0x60')](_0x32320c[_0x72b4('0x6b')]+0x1869f);});_0x2a7a1f(_0x26b600);});}}catch(_0x3db729){_0x4b7c59(_0x3db729);}});}function getPlugins(_0x255186){var _0x32cac7=[];return new BPromise(function(_0x53a6fa,_0x1e8667){try{if(_0x255186[_0x72b4('0x57')]){return db[_0x72b4('0x6c')]['findAll']({'raw':!![]})[_0x72b4('0x2a')](function(_0xf6667d){_0xf6667d['forEach'](function(_0x300fc1){_0x32cac7['push'](_0x300fc1['id']+0x15b38);});_0x53a6fa(_0x32cac7);});}else{return db[_0x72b4('0x58')][_0x72b4('0x48')]({'where':{'sectionId':_0x255186['id']},'raw':!![]})[_0x72b4('0x2a')](function(_0x41e09a){_0x41e09a[_0x72b4('0x6a')](function(_0x5f1cdd){_0x32cac7[_0x72b4('0x60')](_0x5f1cdd['resourceId']+0x15b38);});_0x53a6fa(_0x32cac7);});}}catch(_0x104ba8){_0x1e8667(_0x104ba8);}});}exports[_0x72b4('0x6d')]=function(_0x5e4212,_0x3e19f8){return db[_0x72b4('0x33')][_0x72b4('0x5c')]({'where':{'id':_0x5e4212[_0x72b4('0x49')]['id']}})[_0x72b4('0x2a')](handleEntityNotFound(_0x3e19f8,null))[_0x72b4('0x2a')](function(_0x3f1c60){if(_0x3f1c60){return db[_0x72b4('0x52')][_0x72b4('0x53')](function(_0x3cc5df){return db[_0x72b4('0x56')]['findAll']({'where':{'userProfileId':_0x5e4212[_0x72b4('0x49')]['id']},'attributes':['id'],'raw':!![]})[_0x72b4('0x2a')](function(_0xa8f955){if(_0xa8f955){return db[_0x72b4('0x56')]['destroy']({'where':{'userProfileId':_0x5e4212[_0x72b4('0x49')]['id'],'id':_['map'](_0xa8f955,function(_0x18b0ac){return _0x18b0ac['id'];})},'transaction':_0x3cc5df});}})[_0x72b4('0x2a')](function(_0x289696){var _0x2246e7=_['map'](_0x5e4212[_0x72b4('0x4c')],function(_0x2a8002){_0x2a8002[_0x72b4('0x59')]=_0x5e4212[_0x72b4('0x49')]['id'];return _0x2a8002;});return db['UserProfileSection'][_0x72b4('0x6e')](_0x2246e7,{'raw':!![],'transaction':_0x3cc5df});})[_0x72b4('0x2a')](function(_0x1a93e4){var _0x147346=_[_0x72b4('0x44')](_[_0x72b4('0x32')](_0x1a93e4,function(_0x10a9da){return _0x10a9da[_0x72b4('0x55')]({'plain':!![]});}),{'includeAll':![]});if(_0x147346){return db[_0x72b4('0x56')]['findAll']({'where':{'userProfileId':_0x5e4212[_0x72b4('0x49')]['id'],'sectionId':_['map'](_0x147346,function(_0x1cb69c){return _0x1cb69c['sectionId'];})},'attributes':['id',_0x72b4('0x64')],'raw':!![]})[_0x72b4('0x2a')](function(_0x8b69c5){var _0x2e24b4=_[_0x72b4('0x32')](_0x5e4212[_0x72b4('0x4c')],function(_0x3c8367){_0x3c8367[_0x72b4('0x59')]=_0x5e4212[_0x72b4('0x49')]['id'];return _0x3c8367;});return db[_0x72b4('0x58')][_0x72b4('0x6e')](_0x2e24b4,{'raw':!![],'transaction':_0x3cc5df});});}})[_0x72b4('0x4b')](handleError(_0x3e19f8,null));});}})['then'](function(_0x29fde5){var _0x11bdf8=_[_0x72b4('0x32')](_0x29fde5,function(_0x4954b3){return _0x4954b3[_0x72b4('0x55')]({'plain':!![]});});})[_0x72b4('0x2a')](respondWithResult(_0x3e19f8,null))[_0x72b4('0x4b')](handleError(_0x3e19f8,null));};exports['removeResources']=function(_0x3b4f1f,_0x56a39b,_0x4117c1){return db[_0x72b4('0x33')][_0x72b4('0x5c')]({'where':{'id':_0x3b4f1f['params']['id']}})['then'](handleEntityNotFound(_0x56a39b,null))['then'](function(_0x221bb7){if(_0x221bb7){return _0x221bb7[_0x72b4('0x6f')](_0x3b4f1f['query'][_0x72b4('0x62')]);}})[_0x72b4('0x2a')](respondWithStatusCode(_0x56a39b,null))[_0x72b4('0x4b')](handleError(_0x56a39b,null));};exports[_0x72b4('0x70')]=function(_0x3ef056,_0x16a691){var _0x504798={};if(!_0x3ef056[_0x72b4('0x39')][_0x72b4('0x71')])throw new Error('Missing\x20section\x20parameter');if(!_0x3ef056[_0x72b4('0x39')]['hasOwnProperty'](_0x72b4('0x41'))){_0x504798[_0x72b4('0x25')]=qs['limit'](_0x3ef056[_0x72b4('0x39')][_0x72b4('0x25')]);_0x504798['offset']=qs[_0x72b4('0x23')](_0x3ef056['query']['offset']);}return db[_0x72b4('0x33')][_0x72b4('0x5c')]({'where':{'id':_0x3ef056[_0x72b4('0x49')]['id']}})[_0x72b4('0x2a')](function(_0x2249b7){if(!_0x2249b7)throw new Error(_0x72b4('0x72')+_0x3ef056[_0x72b4('0x49')]['id']);return db[_0x72b4('0x33')][_0x72b4('0x70')](_0x3ef056);})['then'](respondWithFilteredResult(_0x16a691,_0x504798))[_0x72b4('0x4b')](handleError(_0x16a691,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 1e35b50..fd1018b 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 _0x7a12=['hasOwnProperty','hook','events','../../mysqldb','UserProfile','setMaxListeners','save','update','remove','emit'];(function(_0x2a1e2d,_0x195473){var _0x32b8cc=function(_0x57582d){while(--_0x57582d){_0x2a1e2d['push'](_0x2a1e2d['shift']());}};_0x32b8cc(++_0x195473);}(_0x7a12,0xe8));var _0x27a1=function(_0x1cade2,_0x2982b8){_0x1cade2=_0x1cade2-0x0;var _0x30f248=_0x7a12[_0x1cade2];return _0x30f248;};'use strict';var EventEmitter=require(_0x27a1('0x0'));var UserProfile=require(_0x27a1('0x1'))['db'][_0x27a1('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x27a1('0x3')](0x0);var events={'afterCreate':_0x27a1('0x4'),'afterUpdate':_0x27a1('0x5'),'afterDestroy':_0x27a1('0x6')};function emitEvent(_0x3f44b6){return function(_0x516239,_0x8b00f8,_0x3872af){UserProfileEvents[_0x27a1('0x7')](_0x3f44b6+':'+_0x516239['id'],_0x516239);UserProfileEvents[_0x27a1('0x7')](_0x3f44b6,_0x516239);_0x3872af(null);};}for(var e in events){if(events[_0x27a1('0x8')](e)){var event=events[e];UserProfile[_0x27a1('0x9')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file +var _0x1c77=['UserProfile','setMaxListeners','save','update','emit','hasOwnProperty','../../mysqldb'];(function(_0x26c3b9,_0x2f7830){var _0x1c6818=function(_0x14014a){while(--_0x14014a){_0x26c3b9['push'](_0x26c3b9['shift']());}};_0x1c6818(++_0x2f7830);}(_0x1c77,0xed));var _0x71c7=function(_0x2283dc,_0x2fcfc5){_0x2283dc=_0x2283dc-0x0;var _0x16db90=_0x1c77[_0x2283dc];return _0x16db90;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x71c7('0x0'))['db'][_0x71c7('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x71c7('0x2')](0x0);var events={'afterCreate':_0x71c7('0x3'),'afterUpdate':_0x71c7('0x4'),'afterDestroy':'remove'};function emitEvent(_0x29ab58){return function(_0x37620a,_0x1f314c,_0x305ff7){UserProfileEvents[_0x71c7('0x5')](_0x29ab58+':'+_0x37620a['id'],_0x37620a);UserProfileEvents[_0x71c7('0x5')](_0x29ab58,_0x37620a);_0x305ff7(null);};}for(var e in events){if(events[_0x71c7('0x6')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index e748bed..13c2436 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 _0x2ef3=['squel','exports','models','filter','field','value','findAll','then','associatedResources','map','name','UserProfileResource','AnalyticExtractedReport','type','resourceId','catch','childModel','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','projects','JscriptyProject','CmContact','Lists','ListId','lists','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','ChatWebsite','FaxQueue','faxaccounts','FaxAccount','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceRecording','Agents','User','role','agent','membername','telephone','VoiceQueues','queue','VoiceQueue','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','MailSubstatus','openchannelqueues','OpenchannelQueue','OpenchannelAccount','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','queuecampaigns','users','agents','telephones','admin','user','Telephones','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','Dashboard','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','Tag','templates','triggers','Trigger','variables','plugins','Plugin','extractedreports','Reports','reportId','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','QueryTypes','SELECT','select','InteractionId','ui.createdAt','user_has_','_interactions','where','query','define','user_profiles','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','all','ignore','union','autoAssociation','rawAttributes','model','keys','filters','attributes','intersection','hasOwnProperty','limit','order','sort','merge','key','VIRTUAL','foreignKey','forEach','options','includeAll','reportType','DefaultReports','custom','CustomReports','rows','count','include','color','tag','ThroughTags','openTabs','true','chat','dataValues','sms','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs'];(function(_0x5e2cf6,_0x25a693){var _0x39b25f=function(_0x1ad12){while(--_0x1ad12){_0x5e2cf6['push'](_0x5e2cf6['shift']());}};_0x39b25f(++_0x25a693);}(_0x2ef3,0xba));var _0x32ef=function(_0x1d1479,_0x27dbf2){_0x1d1479=_0x1d1479-0x0;var _0x30da3d=_0x2ef3[_0x1d1479];return _0x30da3d;};'use strict';var _=require(_0x32ef('0x0'));var attributes=require(_0x32ef('0x1'));var qs=require(_0x32ef('0x2'));var squel=require(_0x32ef('0x3'));module[_0x32ef('0x4')]=function(_0x38047b){var _0x48106c=_0x38047b[_0x32ef('0x5')];function _0x38b7f3(_0x524ab6,_0x402857){return new Promise(function(_0x37dd1d,_0x4c8104){if(!_0x402857)return _0x37dd1d(null);var _0x5dfa09=_0x402857[_0x32ef('0x6')]?{[_0x402857[_0x32ef('0x6')][_0x32ef('0x7')]]:_0x402857[_0x32ef('0x6')][_0x32ef('0x8')]}:undefined;return _0x48106c[_0x524ab6][_0x32ef('0x9')]({'where':_0x5dfa09,'raw':!![]})[_0x32ef('0xa')](function(_0x2bbb50){_0x402857[_0x32ef('0xb')]=_[_0x32ef('0xc')](_0x2bbb50,'id');_0x37dd1d(_0x402857);})['catch'](function(_0x5780e9){_0x4c8104(_0x5780e9);});});}function _0x401d0b(_0x33281d,_0x45bfd5){return new Promise(function(_0x1499c2,_0x5af651){var _0x193714=_0x33281d['filter']?{[_0x33281d[_0x32ef('0x6')]['field']]:_0x33281d[_0x32ef('0x6')][_0x32ef('0x8')]}:undefined;return _0x48106c[_0x33281d['model']]['findAll']({'where':_0x193714,'raw':!![]})[_0x32ef('0xa')](function(_0x4d8009){_0x45bfd5[_0x32ef('0xb')]=_[_0x32ef('0xc')](_0x4d8009,function(_0x93d492){return _0x93d492[_0x32ef('0xd')];});_0x1499c2(_0x45bfd5);})['catch'](function(_0x55bf0b){_0x5af651(_0x55bf0b);});});}function _0x531e30(_0x13db1a,_0x3950e6,_0xb5aed2){if(!_0x3950e6)return Promise['resolve'](null);return new Promise(function(_0x5d559b,_0x1eb468){return _0x48106c[_0x32ef('0xe')][_0x32ef('0x9')]({'where':{'sectionId':_0x3950e6['id']},'raw':!![]})['then'](function(_0xbe37f6){if(_0x13db1a[_0x32ef('0x7')]&&_0x13db1a['field']!=='id'){_0x3950e6[_0x32ef('0xb')]=_[_0x32ef('0xc')](_0xbe37f6,function(_0x26aff3){return _0x26aff3[_0x13db1a[_0x32ef('0x7')]];});}else{if(_0xb5aed2===_0x32ef('0xf')){_0x3950e6[_0x32ef('0xb')]=_['map'](_0xbe37f6,function(_0x3c5b78){return{'id':_0x3c5b78['resourceId'],'type':_0x3c5b78[_0x32ef('0x10')]};});}else{_0x3950e6[_0x32ef('0xb')]=_['map'](_0xbe37f6,function(_0x1af371){return _0x1af371[_0x32ef('0x11')];});}}_0x5d559b(_0x3950e6);})[_0x32ef('0x12')](function(_0x55f7f2){_0x1eb468(_0x55f7f2);});});}function _0x57f5e5(_0x22f2d7,_0xb30fab){var _0x225feb={'parentSections':[]};switch(_0x22f2d7['toLowerCase']()){case'squareprojects':_0x225feb[_0x32ef('0x13')]='SquareProject';break;case'odbc':_0x225feb[_0x32ef('0x13')]=_0x32ef('0x14');break;case _0x32ef('0x15'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x16');_0x225feb[_0x32ef('0x17')]=[{'name':_0x32ef('0x18'),'field':_0x32ef('0xd'),'foreignKey':_0x32ef('0x19')}];break;case _0x32ef('0x1a'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x1b');break;case'contacts':_0x225feb[_0x32ef('0x13')]=_0x32ef('0x1c');_0x225feb['parentSections']=[{'name':_0x32ef('0x1d'),'field':'id','foreignKey':_0x32ef('0x1e')}];break;case _0x32ef('0x1f'):_0x225feb[_0x32ef('0x13')]='CmList';break;case _0x32ef('0x20'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x21');break;case _0x32ef('0x22'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x23');break;case _0x32ef('0x24'):_0x225feb['childModel']=_0x32ef('0x25');break;case'chatwebsites':_0x225feb[_0x32ef('0x13')]=_0x32ef('0x26');break;case'faxqueues':_0x225feb[_0x32ef('0x13')]=_0x32ef('0x27');break;case _0x32ef('0x28'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x29');break;case'inboundroutes':case'internalroutes':case _0x32ef('0x2a'):_0x225feb['childModel']=_0x32ef('0x2b');break;case _0x32ef('0x2c'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x2d');break;case _0x32ef('0x2e'):_0x225feb[_0x32ef('0x13')]='VoiceMail';break;case'voicerecordings':_0x225feb['childModel']=_0x32ef('0x2f');_0x225feb[_0x32ef('0x17')]=[{'name':_0x32ef('0x30'),'field':'name','foreignKey':'membername','model':_0x32ef('0x31'),'filter':{'field':_0x32ef('0x32'),'value':[_0x32ef('0x33')]}},{'name':'Telephones','field':'name','foreignKey':_0x32ef('0x34'),'model':_0x32ef('0x31'),'filter':{'field':_0x32ef('0x32'),'value':[_0x32ef('0x35')]}},{'name':_0x32ef('0x36'),'field':_0x32ef('0xd'),'foreignKey':_0x32ef('0x37'),'model':_0x32ef('0x38'),'filter':{'field':_0x32ef('0x10'),'value':['inbound']}},{'name':_0x32ef('0x39'),'field':_0x32ef('0xd'),'foreignKey':_0x32ef('0x37'),'model':'VoiceQueue','filter':{'field':_0x32ef('0x10'),'value':[_0x32ef('0x3a')]}}];break;case _0x32ef('0x3b'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x3c');break;case _0x32ef('0x3d'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x3e');break;case _0x32ef('0x3f'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x40');break;case _0x32ef('0x41'):_0x225feb['childModel']=_0x32ef('0x42');break;case _0x32ef('0x43'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x44');break;case _0x32ef('0x45'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x46');break;case'mailsubstatuses':_0x225feb['childModel']=_0x32ef('0x47');break;case _0x32ef('0x48'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x49');break;case'openchannelaccounts':_0x225feb[_0x32ef('0x13')]=_0x32ef('0x4a');break;case'smsqueues':_0x225feb[_0x32ef('0x13')]='SmsQueue';break;case _0x32ef('0x4b'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x4c');break;case _0x32ef('0x4d'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x4e');break;case _0x32ef('0x4f'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x50');break;case _0x32ef('0x51'):_0x225feb['childModel']=_0x32ef('0x52');break;case'voicequeues':case _0x32ef('0x53'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x38');if(_0xb30fab){_0x225feb['parentSections']=[{'name':_0x32ef('0x36')},{'name':_0x32ef('0x39')}];}break;case _0x32ef('0x54'):case _0x32ef('0x55'):case _0x32ef('0x56'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x31');if(_0xb30fab){_0x225feb['parentSections']=[{'name':'Users','filter':{'field':_0x32ef('0x32'),'value':[_0x32ef('0x57'),_0x32ef('0x58')]},'ignore':!![]},{'name':_0x32ef('0x30')},{'name':_0x32ef('0x59')}];}break;case _0x32ef('0x5a'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x5b');break;case _0x32ef('0x5c'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x5d');break;case _0x32ef('0x5e'):_0x225feb[_0x32ef('0x13')]='FreshdeskAccount';break;case _0x32ef('0x5f'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x60');break;case _0x32ef('0x61'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x62');break;case _0x32ef('0x63'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x64');break;case _0x32ef('0x65'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x31');break;case _0x32ef('0x66'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x67');break;case _0x32ef('0x68'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x69');break;case'customdashboards':_0x225feb['childModel']=_0x32ef('0x6a');break;case _0x32ef('0x6b'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x6c');break;case _0x32ef('0x6d'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x6e');break;case _0x32ef('0x6f'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x70');break;case _0x32ef('0x71'):_0x225feb['childModel']=_0x32ef('0x72');break;case _0x32ef('0x73'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x74');break;case _0x32ef('0x75'):_0x225feb[_0x32ef('0x13')]='Template';break;case _0x32ef('0x76'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x77');break;case'trunks':_0x225feb[_0x32ef('0x13')]='Trunk';break;case _0x32ef('0x78'):_0x225feb[_0x32ef('0x13')]='Variable';break;case _0x32ef('0x79'):_0x225feb['childModel']=_0x32ef('0x7a');break;case _0x32ef('0x7b'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0xf');_0x225feb[_0x32ef('0x17')]=[{'name':_0x32ef('0x7c'),'field':'id','foreignKey':_0x32ef('0x7d')}];break;case'metrics':_0x225feb['childModel']=_0x32ef('0x7e');break;}return _0x225feb;}function _0x52232a(_0x4fbab6,_0xb519e9){var _0x89d0b3=_0x4fbab6[_0x32ef('0x7f')](0x0)[_0x32ef('0x80')]()+_0x4fbab6[_0x32ef('0x81')](0x1);var _0x356704={'type':_0x48106c[_0x32ef('0x82')][_0x32ef('0x83')][_0x32ef('0x84')],'raw':!![]};return new Promise(function(_0x123571,_0x4c125c){var _0x518ee1=squel[_0x32ef('0x85')]()[_0x32ef('0x7')]('ui.'+_0x89d0b3+_0x32ef('0x86'),'id')[_0x32ef('0x7')](_0x32ef('0x87'))['from'](_0x32ef('0x88')+_0x4fbab6+_0x32ef('0x89'),'ui')[_0x32ef('0x8a')]('ui.UserId\x20=\x20?',_0xb519e9['id']);return _0x48106c['sequelize'][_0x32ef('0x8b')](_0x518ee1['toString'](),_0x356704)[_0x32ef('0xa')](function(_0x5bb114){_0xb519e9[_0x89d0b3+'OpenTabs']=_0x5bb114;_0x123571(_0x5bb114);})[_0x32ef('0x12')](function(_0x208989){_0x4c125c(_0x208989);});});}return _0x38047b[_0x32ef('0x8c')]('UserProfile',attributes,{'tableName':_0x32ef('0x8d'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x222b24){var _0x5f9da7={'raw':![],'where':{}};var _0x58ecbb={};var _0x4557ce={'count':0x0,'rows':[]};var _0x12b7f8=_0x222b24['query']['section'];var _0x2e20dc=_0x222b24[_0x32ef('0x8b')][_0x32ef('0x8e')]||![];var _0x339625=_0x57f5e5(_0x12b7f8,_0x2e20dc);if(!_0x339625[_0x32ef('0x13')])throw new Error(_0x32ef('0x8f')+_0x12b7f8+'\x27');var _0x4c89e8=[{'name':_0x12b7f8}];if(!_[_0x32ef('0x90')](_0x339625[_0x32ef('0x17')]))_0x4c89e8=_0x339625[_0x32ef('0x17')];var _0x36ed97=[];for(var _0x21e930=0x0;_0x21e930<_0x4c89e8[_0x32ef('0x91')];_0x21e930++){_0x36ed97[_0x32ef('0x92')](_0x48106c[_0x32ef('0x93')][_0x32ef('0x94')]({'where':{'userProfileId':_0x222b24['params']['id'],'name':_0x4c89e8[_0x21e930][_0x32ef('0xd')]},'raw':!![]}));}return Promise[_0x32ef('0x95')](_0x36ed97)[_0x32ef('0xa')](function(_0x1c629d){var _0x79ae28=_['filter'](_0x1c629d,function(_0x47c0ed){return _0x47c0ed?_0x47c0ed:undefined;});var _0x2125de=_[_0x32ef('0x6')](_0x4c89e8,[_0x32ef('0x96'),!![]]);var _0x334ca6=_[_0x32ef('0x90')](_0x79ae28)&&_['isEmpty'](_0x2125de)?null:_[_0x32ef('0x97')](_0x2125de,_0x79ae28);if(!_0x334ca6)return null;var _0x544045=[];for(var _0x216e2f=0x0;_0x216e2f<_0x334ca6[_0x32ef('0x91')];_0x216e2f++){var _0x48b6f4=_['find'](_0x4c89e8,function(_0x2c9f7a){return _0x334ca6[_0x216e2f]?_0x2c9f7a[_0x32ef('0xd')]===_0x334ca6[_0x216e2f][_0x32ef('0xd')]:null;});if(_0x48b6f4){if(_0x334ca6[_0x216e2f]['ignore']){_0x544045['push'](_0x38b7f3(_0x339625[_0x32ef('0x13')],_0x334ca6[_0x216e2f]));}else{if(!_0x334ca6[_0x216e2f][_0x32ef('0x98')]){_0x544045[_0x32ef('0x92')](_0x531e30(_0x48b6f4,_0x334ca6[_0x216e2f],_0x339625[_0x32ef('0x13')]));}else{if(_0x48b6f4['model']){_0x544045[_0x32ef('0x92')](_0x401d0b(_0x48b6f4,_0x334ca6[_0x216e2f]));}}}}}return Promise[_0x32ef('0x95')](_0x544045);})[_0x32ef('0xa')](function(_0xd7a78){var _0x9df27c=_0xd7a78;var _0x268dcd=null;if(_0x9df27c){_0x268dcd=_0x9df27c[_0x32ef('0x91')]===0x1?_0x9df27c[0x0]:null;}if(!_0x268dcd&&!_0x9df27c)return _0x4557ce;var _0x44e23e=_0x48106c[_0x339625[_0x32ef('0x13')]][_0x32ef('0x99')];_0x58ecbb[_0x32ef('0x9a')]=_[_0x32ef('0x9b')](_0x44e23e);_0x58ecbb['query']=_['keys'](_0x222b24[_0x32ef('0x8b')]);_0x58ecbb[_0x32ef('0x9c')]=_['intersection'](_0x58ecbb[_0x32ef('0x9a')],_0x58ecbb['query']);_0x5f9da7[_0x32ef('0x9d')]=_[_0x32ef('0x9e')](_0x58ecbb[_0x32ef('0x9a')],qs['fields'](_0x222b24[_0x32ef('0x8b')]['fields']));_0x5f9da7[_0x32ef('0x9d')]=_0x5f9da7[_0x32ef('0x9d')]['length']?_0x5f9da7['attributes']:_0x58ecbb[_0x32ef('0x9a')];if(!_0x222b24['query'][_0x32ef('0x9f')]('nolimit')){_0x5f9da7[_0x32ef('0xa0')]=qs[_0x32ef('0xa0')](_0x222b24[_0x32ef('0x8b')]['limit']);_0x5f9da7['offset']=qs['offset'](_0x222b24[_0x32ef('0x8b')]['offset']);}_0x5f9da7[_0x32ef('0xa1')]=qs[_0x32ef('0xa2')](_0x222b24[_0x32ef('0x8b')][_0x32ef('0xa2')]);_0x5f9da7[_0x32ef('0x8a')]=qs[_0x32ef('0x9c')](_['pick'](_0x222b24[_0x32ef('0x8b')],_0x58ecbb['filters']));if(_0x222b24['query'][_0x32ef('0x6')]){_0x5f9da7['where']=_[_0x32ef('0xa3')](_0x5f9da7[_0x32ef('0x8a')],{'$or':_['map'](_0x44e23e,function(_0x232b40){if(_0x232b40[_0x32ef('0x10')][_0x32ef('0xa4')]!==_0x32ef('0xa5')){var _0x1fa36d={};_0x1fa36d[_0x232b40[_0x32ef('0x7')]]={'$like':'%'+_0x222b24['query']['filter']+'%'};return _0x1fa36d;}})});}var _0x35b10d=[];var _0x5e0b55=null;var _0x41bbe1={};if(_0x268dcd){_0x5e0b55=_[_0x32ef('0x94')](_0x4c89e8,[_0x32ef('0xd'),_0x268dcd[_0x32ef('0xd')]]);if(_0x5e0b55[_0x32ef('0x7')]){_0x41bbe1={};if(_0x339625[_0x32ef('0x13')]==='AnalyticExtractedReport'){_0x41bbe1[_0x5e0b55[_0x32ef('0xa6')]]=_[_0x32ef('0xc')](_0x268dcd[_0x32ef('0xb')],'id');}else{_0x41bbe1[_0x5e0b55[_0x32ef('0xa6')]]=_0x268dcd[_0x32ef('0xb')];}_0x35b10d['push'](_0x41bbe1);}else{_0x5f9da7['where']['id']=_0x268dcd[_0x32ef('0xb')];}}else{for(var _0x904a4f=0x0;_0x904a4f<_0x9df27c['length'];_0x904a4f++){_0x5e0b55=_[_0x32ef('0x94')](_0x4c89e8,[_0x32ef('0xd'),_0x9df27c[_0x904a4f][_0x32ef('0xd')]]);if(_0x5e0b55[_0x32ef('0x7')]){_0x41bbe1={};_0x41bbe1[_0x5e0b55[_0x32ef('0xa6')]]=_0x9df27c[_0x904a4f][_0x32ef('0xb')];_0x35b10d[_0x32ef('0x92')](_0x41bbe1);}else{if(!_0x5f9da7[_0x32ef('0x8a')]['id'])_0x5f9da7[_0x32ef('0x8a')]['id']=[];_0x9df27c[_0x904a4f]['associatedResources'][_0x32ef('0xa7')](function(_0xefbbf2){_0x5f9da7['where']['id'][_0x32ef('0x92')](_0xefbbf2);});}}}if(!_['isEmpty'](_0x35b10d)){_0x5f9da7[_0x32ef('0x8a')]=_['merge'](_0x5f9da7[_0x32ef('0x8a')],{'$and':{'$or':_0x35b10d}});}_0x5f9da7=_[_0x32ef('0xa3')]({},_0x5f9da7,_0x222b24[_0x32ef('0xa8')]);if(_0x268dcd&&!_0x268dcd[_0x32ef('0x98')]&&_0x339625['childModel']===_0x32ef('0xf')){if(_0x222b24[_0x32ef('0x8b')][_0x32ef('0xa9')]){_0x5f9da7['include']=[{'all':!![]}];}return _0x48106c[_0x339625['childModel']]['findAll'](_0x5f9da7)[_0x32ef('0xa')](function(_0x12f5ef){var _0x1ec12d=[];_0x12f5ef[_0x32ef('0xa7')](function(_0x3cc90c){var _0x5a1696;switch(_0x3cc90c[_0x32ef('0xaa')]){case'default':_0x5a1696=_[_0x32ef('0x94')](_0x268dcd[_0x32ef('0xb')],function(_0xc43e1){return _0xc43e1['id']===_0x3cc90c['reportId']&&_0xc43e1[_0x32ef('0x10')]===_0x32ef('0xab');});break;case _0x32ef('0xac'):_0x5a1696=_[_0x32ef('0x94')](_0x268dcd[_0x32ef('0xb')],function(_0x4d4b5f){return _0x4d4b5f['id']===_0x3cc90c[_0x32ef('0x7d')]&&_0x4d4b5f['type']===_0x32ef('0xad');});break;}if(_0x5a1696)_0x1ec12d[_0x32ef('0x92')](_0x3cc90c);});_0x4557ce['count']=_0x1ec12d['length'];_0x4557ce[_0x32ef('0xae')]=_0x1ec12d;return _0x4557ce;});}else{return _0x48106c[_0x339625[_0x32ef('0x13')]][_0x32ef('0xaf')]({'where':_0x5f9da7[_0x32ef('0x8a')]})['then'](function(_0x356fd4){_0x4557ce['count']=_0x356fd4;if(_0x222b24['query'][_0x32ef('0xa9')]){if(_0x339625['childModel']===_0x32ef('0x1c')){_0x5f9da7[_0x32ef('0xb0')]=[{'model':_0x48106c[_0x32ef('0x74')],'as':'Tags','attributes':['id','name',_0x32ef('0xb1')],'required':_0x222b24[_0x32ef('0x8b')][_0x32ef('0xb2')]?!![]:![]},{'model':_0x48106c[_0x32ef('0x74')],'as':_0x32ef('0xb3'),'attributes':['id',_0x32ef('0xd'),_0x32ef('0xb1')],'through':_0x222b24['query'][_0x32ef('0xb2')]?{'attributes':[],'where':{'TagId':_0x222b24[_0x32ef('0x8b')][_0x32ef('0xb2')]||undefined}}:{},'required':_0x222b24[_0x32ef('0x8b')]['tag']?!![]:![]}];}else{_0x5f9da7['include']=[{'all':!![]}];}}return _0x48106c[_0x339625[_0x32ef('0x13')]]['findAll'](_0x5f9da7);})[_0x32ef('0xa')](function(_0x1d3a37){_0x4557ce['rows']=_0x1d3a37;if(_0x12b7f8==='Agents'&&_0x222b24['query'][_0x32ef('0xb4')]===_0x32ef('0xb5')){var _0xa53375=[];for(var _0x275995=0x0;_0x275995<_0x4557ce['rows'][_0x32ef('0x91')];_0x275995++){_0xa53375[_0x32ef('0x92')](_0x52232a(_0x32ef('0xb6'),_0x4557ce['rows'][_0x275995][_0x32ef('0xb7')]));_0xa53375['push'](_0x52232a(_0x32ef('0xb8'),_0x4557ce[_0x32ef('0xae')][_0x275995]['dataValues']));_0xa53375['push'](_0x52232a(_0x32ef('0xb9'),_0x4557ce[_0x32ef('0xae')][_0x275995][_0x32ef('0xb7')]));_0xa53375[_0x32ef('0x92')](_0x52232a(_0x32ef('0xba'),_0x4557ce[_0x32ef('0xae')][_0x275995][_0x32ef('0xb7')]));_0xa53375[_0x32ef('0x92')](_0x52232a(_0x32ef('0xbb'),_0x4557ce['rows'][_0x275995][_0x32ef('0xb7')]));_0xa53375['push'](_0x52232a(_0x32ef('0xbc'),_0x4557ce[_0x32ef('0xae')][_0x275995][_0x32ef('0xb7')]));}return Promise[_0x32ef('0x95')](_0xa53375)[_0x32ef('0xa')](function(){return _0x4557ce;});}return _0x4557ce;});}});}}});}; \ No newline at end of file +var _0x7bd0=['sounds','tags','Tag','templates','Template','Trigger','Trunk','variables','plugins','Plugin','extractedreports','Reports','reportId','charAt','slice','Sequelize','QueryTypes','select','ui.','InteractionId','ui.createdAt','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','toString','define','UserProfile','query','mergeResources','isEmpty','length','push','UserProfileSection','find','params','all','ignore','union','autoAssociation','rawAttributes','model','keys','filters','intersection','attributes','fields','nolimit','limit','offset','sort','merge','key','VIRTUAL','foreignKey','options','includeAll','include','forEach','reportType','default','DefaultReports','custom','CustomReports','count','rows','Tags','color','tag','ThroughTags','openTabs','true','chat','dataValues','sms','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','squel','exports','models','filter','findAll','then','map','catch','field','associatedResources','name','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','JscriptyProject','contacts','CmContact','Lists','ListId','lists','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatWebsite','faxqueues','FaxQueue','faxaccounts','internalroutes','outboundroutes','VoiceExtension','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','role','Telephones','membername','User','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','VoiceMusicOnHold','chanspies','VoiceChanSpy','VoicePrefix','ivrcampaigns','Campaign','MailQueue','mailaccounts','MailAccount','mailsubstatuses','openchannelqueues','OpenchannelQueue','openchannelaccounts','smsqueues','SmsQueue','smsaccounts','whatsappqueues','WhatsappQueue','whatsappaccounts','teams','Team','voicequeues','queuecampaigns','agents','telephones','Users','admin','user','zendeskaccounts','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Schedule'];(function(_0x461199,_0xb55b17){var _0x2aaa7b=function(_0x4cd609){while(--_0x4cd609){_0x461199['push'](_0x461199['shift']());}};_0x2aaa7b(++_0xb55b17);}(_0x7bd0,0x111));var _0x07bd=function(_0x1857d0,_0x6eade0){_0x1857d0=_0x1857d0-0x0;var _0x3e3c46=_0x7bd0[_0x1857d0];return _0x3e3c46;};'use strict';var _=require(_0x07bd('0x0'));var attributes=require(_0x07bd('0x1'));var qs=require(_0x07bd('0x2'));var squel=require(_0x07bd('0x3'));module[_0x07bd('0x4')]=function(_0x1b76fd){var _0x38f4d1=_0x1b76fd[_0x07bd('0x5')];function _0x5beba7(_0x2d7245,_0x3b4f4f){return new Promise(function(_0x38f3f1,_0x313548){if(!_0x3b4f4f)return _0x38f3f1(null);var _0x3e8349=_0x3b4f4f[_0x07bd('0x6')]?{[_0x3b4f4f[_0x07bd('0x6')]['field']]:_0x3b4f4f[_0x07bd('0x6')]['value']}:undefined;return _0x38f4d1[_0x2d7245][_0x07bd('0x7')]({'where':_0x3e8349,'raw':!![]})[_0x07bd('0x8')](function(_0x323724){_0x3b4f4f['associatedResources']=_[_0x07bd('0x9')](_0x323724,'id');_0x38f3f1(_0x3b4f4f);})[_0x07bd('0xa')](function(_0x324a46){_0x313548(_0x324a46);});});}function _0x169b07(_0x489311,_0x3a45f3){return new Promise(function(_0x313ca5,_0x1b067a){var _0x222efa=_0x489311[_0x07bd('0x6')]?{[_0x489311[_0x07bd('0x6')][_0x07bd('0xb')]]:_0x489311[_0x07bd('0x6')]['value']}:undefined;return _0x38f4d1[_0x489311['model']][_0x07bd('0x7')]({'where':_0x222efa,'raw':!![]})[_0x07bd('0x8')](function(_0x1c59c2){_0x3a45f3[_0x07bd('0xc')]=_[_0x07bd('0x9')](_0x1c59c2,function(_0x2406b0){return _0x2406b0[_0x07bd('0xd')];});_0x313ca5(_0x3a45f3);})['catch'](function(_0x418444){_0x1b067a(_0x418444);});});}function _0x505839(_0x229bf1,_0x2dd97b,_0x31655a){if(!_0x2dd97b)return Promise[_0x07bd('0xe')](null);return new Promise(function(_0x8aa645,_0x4929d6){return _0x38f4d1[_0x07bd('0xf')][_0x07bd('0x7')]({'where':{'sectionId':_0x2dd97b['id']},'raw':!![]})['then'](function(_0x3e8ec4){if(_0x229bf1[_0x07bd('0xb')]&&_0x229bf1[_0x07bd('0xb')]!=='id'){_0x2dd97b[_0x07bd('0xc')]=_[_0x07bd('0x9')](_0x3e8ec4,function(_0x109dbc){return _0x109dbc[_0x229bf1[_0x07bd('0xb')]];});}else{if(_0x31655a===_0x07bd('0x10')){_0x2dd97b[_0x07bd('0xc')]=_['map'](_0x3e8ec4,function(_0x15c0b8){return{'id':_0x15c0b8[_0x07bd('0x11')],'type':_0x15c0b8[_0x07bd('0x12')]};});}else{_0x2dd97b[_0x07bd('0xc')]=_[_0x07bd('0x9')](_0x3e8ec4,function(_0x47bd50){return _0x47bd50['resourceId'];});}}_0x8aa645(_0x2dd97b);})[_0x07bd('0xa')](function(_0x51ca22){_0x4929d6(_0x51ca22);});});}function _0x2b0dee(_0x480c9c,_0x50bd12){var _0x4165bc={'parentSections':[]};switch(_0x480c9c[_0x07bd('0x13')]()){case _0x07bd('0x14'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x16');break;case _0x07bd('0x17'):_0x4165bc['childModel']=_0x07bd('0x18');break;case _0x07bd('0x19'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x1a');_0x4165bc[_0x07bd('0x1b')]=[{'name':_0x07bd('0x1c'),'field':'name','foreignKey':'projectName'}];break;case'projects':_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x1d');break;case _0x07bd('0x1e'):_0x4165bc['childModel']=_0x07bd('0x1f');_0x4165bc[_0x07bd('0x1b')]=[{'name':_0x07bd('0x20'),'field':'id','foreignKey':_0x07bd('0x21')}];break;case _0x07bd('0x22'):_0x4165bc[_0x07bd('0x15')]='CmList';break;case _0x07bd('0x23'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x24');break;case _0x07bd('0x25'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x26');break;case _0x07bd('0x27'):_0x4165bc[_0x07bd('0x15')]='ChatQueue';break;case'chatwebsites':_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x28');break;case _0x07bd('0x29'):_0x4165bc['childModel']=_0x07bd('0x2a');break;case _0x07bd('0x2b'):_0x4165bc[_0x07bd('0x15')]='FaxAccount';break;case'inboundroutes':case _0x07bd('0x2c'):case _0x07bd('0x2d'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x2e');break;case'contexts':_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x2f');break;case _0x07bd('0x30'):_0x4165bc['childModel']=_0x07bd('0x31');break;case _0x07bd('0x32'):_0x4165bc['childModel']=_0x07bd('0x33');_0x4165bc[_0x07bd('0x1b')]=[{'name':_0x07bd('0x34'),'field':_0x07bd('0xd'),'foreignKey':'membername','model':'User','filter':{'field':_0x07bd('0x35'),'value':['agent']}},{'name':_0x07bd('0x36'),'field':_0x07bd('0xd'),'foreignKey':_0x07bd('0x37'),'model':_0x07bd('0x38'),'filter':{'field':_0x07bd('0x35'),'value':[_0x07bd('0x39')]}},{'name':_0x07bd('0x3a'),'field':_0x07bd('0xd'),'foreignKey':_0x07bd('0x3b'),'model':_0x07bd('0x3c'),'filter':{'field':_0x07bd('0x12'),'value':[_0x07bd('0x3d')]}},{'name':_0x07bd('0x3e'),'field':'name','foreignKey':_0x07bd('0x3b'),'model':_0x07bd('0x3c'),'filter':{'field':_0x07bd('0x12'),'value':[_0x07bd('0x3f')]}}];break;case'musiconholds':_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x40');break;case _0x07bd('0x41'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x42');break;case'voiceprefixes':_0x4165bc['childModel']=_0x07bd('0x43');break;case _0x07bd('0x44'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x45');break;case'mailqueues':_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x46');break;case _0x07bd('0x47'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x48');break;case _0x07bd('0x49'):_0x4165bc[_0x07bd('0x15')]='MailSubstatus';break;case _0x07bd('0x4a'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x4b');break;case _0x07bd('0x4c'):_0x4165bc[_0x07bd('0x15')]='OpenchannelAccount';break;case _0x07bd('0x4d'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x4e');break;case _0x07bd('0x4f'):_0x4165bc[_0x07bd('0x15')]='SmsAccount';break;case _0x07bd('0x50'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x51');break;case _0x07bd('0x52'):_0x4165bc['childModel']='WhatsappAccount';break;case _0x07bd('0x53'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x54');break;case _0x07bd('0x55'):case _0x07bd('0x56'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x3c');if(_0x50bd12){_0x4165bc[_0x07bd('0x1b')]=[{'name':_0x07bd('0x3a')},{'name':'QueueCampaigns'}];}break;case'users':case _0x07bd('0x57'):case _0x07bd('0x58'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x38');if(_0x50bd12){_0x4165bc[_0x07bd('0x1b')]=[{'name':_0x07bd('0x59'),'filter':{'field':'role','value':[_0x07bd('0x5a'),_0x07bd('0x5b')]},'ignore':!![]},{'name':_0x07bd('0x34')},{'name':_0x07bd('0x36')}];}break;case _0x07bd('0x5c'):_0x4165bc[_0x07bd('0x15')]='ZendeskAccount';break;case _0x07bd('0x5d'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x5e');break;case _0x07bd('0x5f'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x60');break;case _0x07bd('0x61'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x62');break;case _0x07bd('0x63'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x64');break;case'zohoaccounts':_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x65');break;case _0x07bd('0x66'):_0x4165bc['childModel']='User';break;case _0x07bd('0x67'):_0x4165bc['childModel']=_0x07bd('0x68');break;case _0x07bd('0x69'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x6a');break;case _0x07bd('0x6b'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x6c');break;case _0x07bd('0x6d'):_0x4165bc['childModel']=_0x07bd('0x6e');break;case _0x07bd('0x6f'):_0x4165bc[_0x07bd('0x15')]='Pause';break;case'scheduler':_0x4165bc['childModel']=_0x07bd('0x70');break;case _0x07bd('0x71'):_0x4165bc[_0x07bd('0x15')]='Sound';break;case _0x07bd('0x72'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x73');break;case _0x07bd('0x74'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x75');break;case'triggers':_0x4165bc['childModel']=_0x07bd('0x76');break;case'trunks':_0x4165bc['childModel']=_0x07bd('0x77');break;case _0x07bd('0x78'):_0x4165bc[_0x07bd('0x15')]='Variable';break;case _0x07bd('0x79'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x7a');break;case _0x07bd('0x7b'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x10');_0x4165bc[_0x07bd('0x1b')]=[{'name':_0x07bd('0x7c'),'field':'id','foreignKey':_0x07bd('0x7d')}];break;case'metrics':_0x4165bc[_0x07bd('0x15')]='AnalyticMetric';break;}return _0x4165bc;}function _0x304796(_0x41fa36,_0x2b7907){var _0x4944e3=_0x41fa36[_0x07bd('0x7e')](0x0)['toUpperCase']()+_0x41fa36[_0x07bd('0x7f')](0x1);var _0x2ff31c={'type':_0x38f4d1[_0x07bd('0x80')][_0x07bd('0x81')]['SELECT'],'raw':!![]};return new Promise(function(_0x5dc6f6,_0x135e4e){var _0x5e4670=squel[_0x07bd('0x82')]()[_0x07bd('0xb')](_0x07bd('0x83')+_0x4944e3+_0x07bd('0x84'),'id')[_0x07bd('0xb')](_0x07bd('0x85'))['from'](_0x07bd('0x86')+_0x41fa36+_0x07bd('0x87'),'ui')[_0x07bd('0x88')](_0x07bd('0x89'),_0x2b7907['id']);return _0x38f4d1[_0x07bd('0x8a')]['query'](_0x5e4670[_0x07bd('0x8b')](),_0x2ff31c)[_0x07bd('0x8')](function(_0x278df2){_0x2b7907[_0x4944e3+'OpenTabs']=_0x278df2;_0x5dc6f6(_0x278df2);})[_0x07bd('0xa')](function(_0x585f90){_0x135e4e(_0x585f90);});});}return _0x1b76fd[_0x07bd('0x8c')](_0x07bd('0x8d'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x598367){var _0x34005e={'raw':![],'where':{}};var _0x1b5b4b={};var _0x2986c2={'count':0x0,'rows':[]};var _0x7c7408=_0x598367[_0x07bd('0x8e')]['section'];var _0x145482=_0x598367['query'][_0x07bd('0x8f')]||![];var _0x53b975=_0x2b0dee(_0x7c7408,_0x145482);if(!_0x53b975[_0x07bd('0x15')])throw new Error('Invalid\x20section\x20\x27'+_0x7c7408+'\x27');var _0x5419d1=[{'name':_0x7c7408}];if(!_[_0x07bd('0x90')](_0x53b975[_0x07bd('0x1b')]))_0x5419d1=_0x53b975[_0x07bd('0x1b')];var _0x14bcaf=[];for(var _0x475039=0x0;_0x475039<_0x5419d1[_0x07bd('0x91')];_0x475039++){_0x14bcaf[_0x07bd('0x92')](_0x38f4d1[_0x07bd('0x93')][_0x07bd('0x94')]({'where':{'userProfileId':_0x598367[_0x07bd('0x95')]['id'],'name':_0x5419d1[_0x475039]['name']},'raw':!![]}));}return Promise[_0x07bd('0x96')](_0x14bcaf)['then'](function(_0x43bcec){var _0x39360b=_[_0x07bd('0x6')](_0x43bcec,function(_0x5855e7){return _0x5855e7?_0x5855e7:undefined;});var _0x523cb0=_[_0x07bd('0x6')](_0x5419d1,[_0x07bd('0x97'),!![]]);var _0x3f7194=_[_0x07bd('0x90')](_0x39360b)&&_[_0x07bd('0x90')](_0x523cb0)?null:_[_0x07bd('0x98')](_0x523cb0,_0x39360b);if(!_0x3f7194)return null;var _0x4e630c=[];for(var _0xf256e1=0x0;_0xf256e1<_0x3f7194[_0x07bd('0x91')];_0xf256e1++){var _0x6bf34b=_['find'](_0x5419d1,function(_0x29a452){return _0x3f7194[_0xf256e1]?_0x29a452[_0x07bd('0xd')]===_0x3f7194[_0xf256e1][_0x07bd('0xd')]:null;});if(_0x6bf34b){if(_0x3f7194[_0xf256e1][_0x07bd('0x97')]){_0x4e630c['push'](_0x5beba7(_0x53b975[_0x07bd('0x15')],_0x3f7194[_0xf256e1]));}else{if(!_0x3f7194[_0xf256e1][_0x07bd('0x99')]){_0x4e630c[_0x07bd('0x92')](_0x505839(_0x6bf34b,_0x3f7194[_0xf256e1],_0x53b975[_0x07bd('0x15')]));}else{if(_0x6bf34b['model']){_0x4e630c[_0x07bd('0x92')](_0x169b07(_0x6bf34b,_0x3f7194[_0xf256e1]));}}}}}return Promise['all'](_0x4e630c);})[_0x07bd('0x8')](function(_0x15be68){var _0x128c30=_0x15be68;var _0x1968cd=null;if(_0x128c30){_0x1968cd=_0x128c30['length']===0x1?_0x128c30[0x0]:null;}if(!_0x1968cd&&!_0x128c30)return _0x2986c2;var _0x3e512e=_0x38f4d1[_0x53b975[_0x07bd('0x15')]][_0x07bd('0x9a')];_0x1b5b4b[_0x07bd('0x9b')]=_[_0x07bd('0x9c')](_0x3e512e);_0x1b5b4b[_0x07bd('0x8e')]=_[_0x07bd('0x9c')](_0x598367['query']);_0x1b5b4b[_0x07bd('0x9d')]=_[_0x07bd('0x9e')](_0x1b5b4b[_0x07bd('0x9b')],_0x1b5b4b[_0x07bd('0x8e')]);_0x34005e[_0x07bd('0x9f')]=_['intersection'](_0x1b5b4b[_0x07bd('0x9b')],qs[_0x07bd('0xa0')](_0x598367[_0x07bd('0x8e')]['fields']));_0x34005e[_0x07bd('0x9f')]=_0x34005e[_0x07bd('0x9f')][_0x07bd('0x91')]?_0x34005e[_0x07bd('0x9f')]:_0x1b5b4b[_0x07bd('0x9b')];if(!_0x598367['query']['hasOwnProperty'](_0x07bd('0xa1'))){_0x34005e[_0x07bd('0xa2')]=qs[_0x07bd('0xa2')](_0x598367[_0x07bd('0x8e')][_0x07bd('0xa2')]);_0x34005e[_0x07bd('0xa3')]=qs[_0x07bd('0xa3')](_0x598367[_0x07bd('0x8e')][_0x07bd('0xa3')]);}_0x34005e['order']=qs[_0x07bd('0xa4')](_0x598367[_0x07bd('0x8e')][_0x07bd('0xa4')]);_0x34005e[_0x07bd('0x88')]=qs[_0x07bd('0x9d')](_['pick'](_0x598367[_0x07bd('0x8e')],_0x1b5b4b['filters']));if(_0x598367[_0x07bd('0x8e')][_0x07bd('0x6')]){_0x34005e['where']=_[_0x07bd('0xa5')](_0x34005e['where'],{'$or':_['map'](_0x3e512e,function(_0x18a2b0){if(_0x18a2b0[_0x07bd('0x12')][_0x07bd('0xa6')]!==_0x07bd('0xa7')){var _0x1d64b0={};_0x1d64b0[_0x18a2b0['field']]={'$like':'%'+_0x598367[_0x07bd('0x8e')][_0x07bd('0x6')]+'%'};return _0x1d64b0;}})});}var _0x193c87=[];var _0x591fc3=null;var _0x9b9402={};if(_0x1968cd){_0x591fc3=_[_0x07bd('0x94')](_0x5419d1,['name',_0x1968cd[_0x07bd('0xd')]]);if(_0x591fc3[_0x07bd('0xb')]){_0x9b9402={};if(_0x53b975['childModel']===_0x07bd('0x10')){_0x9b9402[_0x591fc3[_0x07bd('0xa8')]]=_[_0x07bd('0x9')](_0x1968cd[_0x07bd('0xc')],'id');}else{_0x9b9402[_0x591fc3[_0x07bd('0xa8')]]=_0x1968cd[_0x07bd('0xc')];}_0x193c87[_0x07bd('0x92')](_0x9b9402);}else{_0x34005e[_0x07bd('0x88')]['id']=_0x1968cd['associatedResources'];}}else{for(var _0x780517=0x0;_0x780517<_0x128c30[_0x07bd('0x91')];_0x780517++){_0x591fc3=_['find'](_0x5419d1,[_0x07bd('0xd'),_0x128c30[_0x780517][_0x07bd('0xd')]]);if(_0x591fc3[_0x07bd('0xb')]){_0x9b9402={};_0x9b9402[_0x591fc3[_0x07bd('0xa8')]]=_0x128c30[_0x780517]['associatedResources'];_0x193c87[_0x07bd('0x92')](_0x9b9402);}else{if(!_0x34005e[_0x07bd('0x88')]['id'])_0x34005e[_0x07bd('0x88')]['id']=[];_0x128c30[_0x780517][_0x07bd('0xc')]['forEach'](function(_0x15a175){_0x34005e[_0x07bd('0x88')]['id'][_0x07bd('0x92')](_0x15a175);});}}}if(!_[_0x07bd('0x90')](_0x193c87)){_0x34005e[_0x07bd('0x88')]=_[_0x07bd('0xa5')](_0x34005e[_0x07bd('0x88')],{'$and':{'$or':_0x193c87}});}_0x34005e=_[_0x07bd('0xa5')]({},_0x34005e,_0x598367[_0x07bd('0xa9')]);if(_0x1968cd&&!_0x1968cd[_0x07bd('0x99')]&&_0x53b975[_0x07bd('0x15')]===_0x07bd('0x10')){if(_0x598367[_0x07bd('0x8e')][_0x07bd('0xaa')]){_0x34005e[_0x07bd('0xab')]=[{'all':!![]}];}return _0x38f4d1[_0x53b975[_0x07bd('0x15')]][_0x07bd('0x7')](_0x34005e)[_0x07bd('0x8')](function(_0x5811ef){var _0x578808=[];_0x5811ef[_0x07bd('0xac')](function(_0x2aeceb){var _0x2704c7;switch(_0x2aeceb[_0x07bd('0xad')]){case _0x07bd('0xae'):_0x2704c7=_[_0x07bd('0x94')](_0x1968cd[_0x07bd('0xc')],function(_0x3727d7){return _0x3727d7['id']===_0x2aeceb[_0x07bd('0x7d')]&&_0x3727d7['type']===_0x07bd('0xaf');});break;case _0x07bd('0xb0'):_0x2704c7=_[_0x07bd('0x94')](_0x1968cd[_0x07bd('0xc')],function(_0x25658e){return _0x25658e['id']===_0x2aeceb[_0x07bd('0x7d')]&&_0x25658e[_0x07bd('0x12')]===_0x07bd('0xb1');});break;}if(_0x2704c7)_0x578808[_0x07bd('0x92')](_0x2aeceb);});_0x2986c2[_0x07bd('0xb2')]=_0x578808[_0x07bd('0x91')];_0x2986c2[_0x07bd('0xb3')]=_0x578808;return _0x2986c2;});}else{return _0x38f4d1[_0x53b975[_0x07bd('0x15')]][_0x07bd('0xb2')]({'where':_0x34005e[_0x07bd('0x88')]})[_0x07bd('0x8')](function(_0x28b036){_0x2986c2[_0x07bd('0xb2')]=_0x28b036;if(_0x598367[_0x07bd('0x8e')][_0x07bd('0xaa')]){if(_0x53b975[_0x07bd('0x15')]===_0x07bd('0x1f')){_0x34005e['include']=[{'model':_0x38f4d1[_0x07bd('0x73')],'as':_0x07bd('0xb4'),'attributes':['id','name',_0x07bd('0xb5')],'required':_0x598367['query'][_0x07bd('0xb6')]?!![]:![]},{'model':_0x38f4d1['Tag'],'as':_0x07bd('0xb7'),'attributes':['id',_0x07bd('0xd'),'color'],'through':_0x598367[_0x07bd('0x8e')][_0x07bd('0xb6')]?{'attributes':[],'where':{'TagId':_0x598367['query'][_0x07bd('0xb6')]||undefined}}:{},'required':_0x598367['query'][_0x07bd('0xb6')]?!![]:![]}];}else{_0x34005e[_0x07bd('0xab')]=[{'all':!![]}];}}return _0x38f4d1[_0x53b975[_0x07bd('0x15')]][_0x07bd('0x7')](_0x34005e);})[_0x07bd('0x8')](function(_0x3f8539){_0x2986c2[_0x07bd('0xb3')]=_0x3f8539;if(_0x7c7408==='Agents'&&_0x598367['query'][_0x07bd('0xb8')]===_0x07bd('0xb9')){var _0x3bf215=[];for(var _0x1c2766=0x0;_0x1c2766<_0x2986c2[_0x07bd('0xb3')][_0x07bd('0x91')];_0x1c2766++){_0x3bf215['push'](_0x304796(_0x07bd('0xba'),_0x2986c2['rows'][_0x1c2766][_0x07bd('0xbb')]));_0x3bf215['push'](_0x304796(_0x07bd('0xbc'),_0x2986c2[_0x07bd('0xb3')][_0x1c2766][_0x07bd('0xbb')]));_0x3bf215[_0x07bd('0x92')](_0x304796(_0x07bd('0xbd'),_0x2986c2['rows'][_0x1c2766][_0x07bd('0xbb')]));_0x3bf215[_0x07bd('0x92')](_0x304796(_0x07bd('0xbe'),_0x2986c2[_0x07bd('0xb3')][_0x1c2766][_0x07bd('0xbb')]));_0x3bf215[_0x07bd('0x92')](_0x304796(_0x07bd('0xbf'),_0x2986c2[_0x07bd('0xb3')][_0x1c2766][_0x07bd('0xbb')]));_0x3bf215['push'](_0x304796(_0x07bd('0xc0'),_0x2986c2[_0x07bd('0xb3')][_0x1c2766][_0x07bd('0xbb')]));}return Promise['all'](_0x3bf215)[_0x07bd('0x8')](function(){return _0x2986c2;});}return _0x2986c2;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index db780d0..389f495 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 _0x044a=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','info','debug','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserProfile,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x1ddd0,_0x15f9f4){var _0x4d86d0=function(_0x3173d7){while(--_0x3173d7){_0x1ddd0['push'](_0x1ddd0['shift']());}};_0x4d86d0(++_0x15f9f4);}(_0x044a,0x173));var _0xa044=function(_0x9b61a7,_0x440184){_0x9b61a7=_0x9b61a7-0x0;var _0xa5fdc1=_0x044a[_0x9b61a7];return _0xa5fdc1;};'use strict';var _=require(_0xa044('0x0'));var util=require(_0xa044('0x1'));var moment=require(_0xa044('0x2'));var BPromise=require(_0xa044('0x3'));var rs=require(_0xa044('0x4'));var fs=require('fs');var Redis=require(_0xa044('0x5'));var db=require(_0xa044('0x6'))['db'];var utils=require(_0xa044('0x7'));var logger=require(_0xa044('0x8'))(_0xa044('0x9'));var config=require('../../config/environment');var jayson=require(_0xa044('0xa'));var client=jayson[_0xa044('0xb')][_0xa044('0xc')]({'port':0x232a});config[_0xa044('0xd')]=_['defaults'](config[_0xa044('0xd')],{'host':_0xa044('0xe'),'port':0x18eb});var socket=require(_0xa044('0xf'))(new Redis(config[_0xa044('0xd')]));require('./userProfile.socket')[_0xa044('0x10')](socket);function respondWithRpcPromise(_0x9dec14,_0x3f170b,_0x47a9dc){return new BPromise(function(_0xdf14f6,_0xa3b07f){return client[_0xa044('0x11')](_0x9dec14,_0x47a9dc)[_0xa044('0x12')](function(_0x5e203d){logger[_0xa044('0x13')]('UserProfile,\x20%s,\x20%s',_0x3f170b,'request\x20sent');logger[_0xa044('0x14')](_0xa044('0x15'),_0x3f170b,_0xa044('0x16'),JSON[_0xa044('0x17')](_0x5e203d));if(_0x5e203d[_0xa044('0x18')]){if(_0x5e203d[_0xa044('0x18')][_0xa044('0x19')]===0x1f4){logger['error'](_0xa044('0x1a'),_0x3f170b,_0x5e203d['error'][_0xa044('0x1b')]);return _0xa3b07f(_0x5e203d[_0xa044('0x18')][_0xa044('0x1b')]);}logger[_0xa044('0x18')](_0xa044('0x1a'),_0x3f170b,_0x5e203d['error']['message']);return _0xdf14f6(_0x5e203d[_0xa044('0x18')]['message']);}else{logger[_0xa044('0x13')](_0xa044('0x1a'),_0x3f170b,_0xa044('0x16'));_0xdf14f6(_0x5e203d[_0xa044('0x1c')][_0xa044('0x1b')]);}})['catch'](function(_0x567124){logger['error'](_0xa044('0x1a'),_0x3f170b,_0x567124);_0xa3b07f(_0x567124);});});} \ No newline at end of file +var _0xaee6=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','./userProfile.socket','request','then','UserProfile,\x20%s,\x20%s','debug','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','lodash'];(function(_0x10ff2b,_0x450491){var _0x1cfc25=function(_0x2b9be3){while(--_0x2b9be3){_0x10ff2b['push'](_0x10ff2b['shift']());}};_0x1cfc25(++_0x450491);}(_0xaee6,0x187));var _0x6aee=function(_0x369048,_0x36e733){_0x369048=_0x369048-0x0;var _0x5404dc=_0xaee6[_0x369048];return _0x5404dc;};'use strict';var _=require(_0x6aee('0x0'));var util=require(_0x6aee('0x1'));var moment=require(_0x6aee('0x2'));var BPromise=require(_0x6aee('0x3'));var rs=require(_0x6aee('0x4'));var fs=require('fs');var Redis=require(_0x6aee('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6aee('0x6'));var logger=require(_0x6aee('0x7'))(_0x6aee('0x8'));var config=require('../../config/environment');var jayson=require(_0x6aee('0x9'));var client=jayson[_0x6aee('0xa')][_0x6aee('0xb')]({'port':0x232a});config[_0x6aee('0xc')]=_[_0x6aee('0xd')](config[_0x6aee('0xc')],{'host':_0x6aee('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6aee('0xf'))['register'](socket);function respondWithRpcPromise(_0x27a179,_0x2552ec,_0x1f81fa){return new BPromise(function(_0x57e596,_0xd99e94){return client[_0x6aee('0x10')](_0x27a179,_0x1f81fa)[_0x6aee('0x11')](function(_0x1092d9){logger['info'](_0x6aee('0x12'),_0x2552ec,'request\x20sent');logger[_0x6aee('0x13')](_0x6aee('0x14'),_0x2552ec,_0x6aee('0x15'),JSON[_0x6aee('0x16')](_0x1092d9));if(_0x1092d9[_0x6aee('0x17')]){if(_0x1092d9['error'][_0x6aee('0x18')]===0x1f4){logger[_0x6aee('0x17')]('UserProfile,\x20%s,\x20%s',_0x2552ec,_0x1092d9['error'][_0x6aee('0x19')]);return _0xd99e94(_0x1092d9[_0x6aee('0x17')][_0x6aee('0x19')]);}logger[_0x6aee('0x17')](_0x6aee('0x12'),_0x2552ec,_0x1092d9[_0x6aee('0x17')][_0x6aee('0x19')]);return _0x57e596(_0x1092d9[_0x6aee('0x17')]['message']);}else{logger[_0x6aee('0x1a')](_0x6aee('0x12'),_0x2552ec,'request\x20sent');_0x57e596(_0x1092d9[_0x6aee('0x1b')][_0x6aee('0x19')]);}})['catch'](function(_0x1848a9){logger[_0x6aee('0x17')](_0x6aee('0x12'),_0x2552ec,_0x1848a9);_0xd99e94(_0x1848a9);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 890569d..44478c7 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 _0x5f27=['userProfile:','./userProfile.events','save','update','emit','length'];(function(_0x339648,_0x3d19ab){var _0x300e96=function(_0x8c3d6d){while(--_0x8c3d6d){_0x339648['push'](_0x339648['shift']());}};_0x300e96(++_0x3d19ab);}(_0x5f27,0xb5));var _0x75f2=function(_0x4a951c,_0x128756){_0x4a951c=_0x4a951c-0x0;var _0x457882=_0x5f27[_0x4a951c];return _0x457882;};'use strict';var UserProfileEvents=require(_0x75f2('0x0'));var events=[_0x75f2('0x1'),'remove',_0x75f2('0x2')];function createListener(_0x1cd366,_0x832591){return function(_0x211cf4){_0x832591[_0x75f2('0x3')](_0x1cd366,_0x211cf4);};}function removeListener(_0x19870b,_0x9753fa){return function(){UserProfileEvents['removeListener'](_0x19870b,_0x9753fa);};}exports['register']=function(_0x522f9f){for(var _0x5a6dae=0x0,_0x33b027=events[_0x75f2('0x4')];_0x5a6dae<_0x33b027;_0x5a6dae++){var _0x297071=events[_0x5a6dae];var _0x4169c3=createListener(_0x75f2('0x5')+_0x297071,_0x522f9f);UserProfileEvents['on'](_0x297071,_0x4169c3);}}; \ No newline at end of file +var _0x1063=['register','./userProfile.events','save','remove','update','removeListener'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1063,0x97));var _0x3106=function(_0x480190,_0x1caae1){_0x480190=_0x480190-0x0;var _0x331c2f=_0x1063[_0x480190];return _0x331c2f;};'use strict';var UserProfileEvents=require(_0x3106('0x0'));var events=[_0x3106('0x1'),_0x3106('0x2'),_0x3106('0x3')];function createListener(_0x359745,_0x1ce2b7){return function(_0x14cdee){_0x1ce2b7['emit'](_0x359745,_0x14cdee);};}function removeListener(_0x4bd4ba,_0x4268a8){return function(){UserProfileEvents[_0x3106('0x4')](_0x4bd4ba,_0x4268a8);};}exports[_0x3106('0x5')]=function(_0x18c5c4){for(var _0x4b950e=0x0,_0x57d9bd=events['length'];_0x4b950e<_0x57d9bd;_0x4b950e++){var _0x4778ff=events[_0x4b950e];var _0x293e0c=createListener('userProfile:'+_0x4778ff,_0x18c5c4);UserProfileEvents['on'](_0x4778ff,_0x293e0c);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index cecf1e5..169fdb4 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 _0x8caf=['get','index','/describe','describe','show','post','isAuthenticated','create','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./userProfileResource.controller'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x8caf,0xdf));var _0xf8ca=function(_0x5d2f0c,_0x2d0172){_0x5d2f0c=_0x5d2f0c-0x0;var _0xa5f33f=_0x8caf[_0x5d2f0c];return _0xa5f33f;};'use strict';var multer=require('multer');var util=require(_0xf8ca('0x0'));var path=require(_0xf8ca('0x1'));var timeout=require(_0xf8ca('0x2'));var express=require(_0xf8ca('0x3'));var router=express[_0xf8ca('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf8ca('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf8ca('0x6'));var controller=require(_0xf8ca('0x7'));router[_0xf8ca('0x8')]('/',auth['isAuthenticated'](),controller[_0xf8ca('0x9')]);router[_0xf8ca('0x8')](_0xf8ca('0xa'),auth['isAuthenticated'](),controller[_0xf8ca('0xb')]);router[_0xf8ca('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xf8ca('0xc')]);router[_0xf8ca('0xd')]('/',auth[_0xf8ca('0xe')](),controller[_0xf8ca('0xf')]);router['put'](_0xf8ca('0x10'),auth[_0xf8ca('0xe')](),controller[_0xf8ca('0x11')]);router[_0xf8ca('0x12')](_0xf8ca('0x10'),auth['isAuthenticated'](),controller[_0xf8ca('0x13')]);module[_0xf8ca('0x14')]=router; \ No newline at end of file +var _0x47d2=['destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','index','get','/describe','describe','/:id','isAuthenticated','post','create','put','update','delete'];(function(_0x497579,_0xeb994e){var _0x400c22=function(_0x541f0e){while(--_0x541f0e){_0x497579['push'](_0x497579['shift']());}};_0x400c22(++_0xeb994e);}(_0x47d2,0x11a));var _0x247d=function(_0x58775a,_0x34c02e){_0x58775a=_0x58775a-0x0;var _0x25c0b0=_0x47d2[_0x58775a];return _0x25c0b0;};'use strict';var multer=require(_0x247d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x247d('0x1'));var express=require(_0x247d('0x2'));var router=express[_0x247d('0x3')]();var fs_extra=require(_0x247d('0x4'));var auth=require(_0x247d('0x5'));var interaction=require(_0x247d('0x6'));var config=require('../../config/environment');var controller=require('./userProfileResource.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x247d('0x7')]);router[_0x247d('0x8')](_0x247d('0x9'),auth['isAuthenticated'](),controller[_0x247d('0xa')]);router[_0x247d('0x8')](_0x247d('0xb'),auth[_0x247d('0xc')](),controller['show']);router[_0x247d('0xd')]('/',auth[_0x247d('0xc')](),controller[_0x247d('0xe')]);router[_0x247d('0xf')](_0x247d('0xb'),auth['isAuthenticated'](),controller[_0x247d('0x10')]);router[_0x247d('0x11')](_0x247d('0xb'),auth['isAuthenticated'](),controller[_0x247d('0x12')]);module[_0x247d('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 752d53d..45ca844 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 _0xeb54=['STRING','sequelize'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0xeb54,0x97));var _0x4eb5=function(_0x447689,_0x3bb340){_0x447689=_0x447689-0x0;var _0x4faee1=_0xeb54[_0x447689];return _0x4faee1;};'use strict';var Sequelize=require(_0x4eb5('0x0'));module['exports']={'name':{'type':Sequelize[_0x4eb5('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x7b80=['exports','STRING','sequelize'];(function(_0x3731c9,_0x3eda17){var _0x18aac2=function(_0x55aaf3){while(--_0x55aaf3){_0x3731c9['push'](_0x3731c9['shift']());}};_0x18aac2(++_0x3eda17);}(_0x7b80,0x116));var _0x07b8=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x7b80[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0x07b8('0x0'));module[_0x07b8('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0x07b8('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index a417692..f110cb5 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 _0x9536=['rawAttributes','intersection','length','options','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','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','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','error','stack','name','index','map','UserProfileResource','fieldName','model','query','keys','filters','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','then','includeAll','include','findAll','rows','catch','params'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x9536,0x179));var _0x6953=function(_0x4a599b,_0x1d2125){_0x4a599b=_0x4a599b-0x0;var _0x2d53d3=_0x9536[_0x4a599b];return _0x2d53d3;};'use strict';var emlformat=require(_0x6953('0x0'));var rimraf=require(_0x6953('0x1'));var zipdir=require(_0x6953('0x2'));var jsonpatch=require(_0x6953('0x3'));var rp=require('request-promise');var moment=require(_0x6953('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6953('0x5'));var util=require(_0x6953('0x6'));var path=require(_0x6953('0x7'));var sox=require(_0x6953('0x8'));var csv=require(_0x6953('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6953('0xa'));var _=require(_0x6953('0xb'));var squel=require(_0x6953('0xc'));var crypto=require(_0x6953('0xd'));var jsforce=require(_0x6953('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6953('0x9'));var querystring=require(_0x6953('0xf'));var Papa=require(_0x6953('0x10'));var Redis=require('ioredis');var authService=require(_0x6953('0x11'));var qs=require(_0x6953('0x12'));var as=require(_0x6953('0x13'));var hardwareService=require(_0x6953('0x14'));var logger=require(_0x6953('0x15'))(_0x6953('0x16'));var utils=require(_0x6953('0x17'));var config=require(_0x6953('0x18'));var licenseUtil=require(_0x6953('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x358388,_0x513dd0){_0x513dd0=_0x513dd0||0xcc;return function(_0x8de91e){if(_0x8de91e){return _0x358388[_0x6953('0x1a')](_0x513dd0);}return _0x358388[_0x6953('0x1b')](_0x513dd0)[_0x6953('0x1c')]();};}function respondWithResult(_0x1b5221,_0x244713){_0x244713=_0x244713||0xc8;return function(_0x175fa9){if(_0x175fa9){return _0x1b5221[_0x6953('0x1b')](_0x244713)[_0x6953('0x1d')](_0x175fa9);}};}function respondWithFilteredResult(_0x31d182,_0xae5515){return function(_0x548473){if(_0x548473){var _0x5f49db=typeof _0xae5515[_0x6953('0x1e')]===_0x6953('0x1f')&&typeof _0xae5515[_0x6953('0x20')]===_0x6953('0x1f');var _0x510d46=_0x548473[_0x6953('0x21')];var _0x2da771=_0x5f49db?0x0:_0xae5515['offset'];var _0x10858a=_0x5f49db?_0x548473[_0x6953('0x21')]:_0xae5515[_0x6953('0x1e')]+_0xae5515[_0x6953('0x20')];var _0xc714d3;if(_0x10858a>=_0x510d46){_0x10858a=_0x510d46;_0xc714d3=0xc8;}else{_0xc714d3=0xce;}_0x31d182['status'](_0xc714d3);return _0x31d182[_0x6953('0x22')](_0x6953('0x23'),_0x2da771+'-'+_0x10858a+'/'+_0x510d46)[_0x6953('0x1d')](_0x548473);}return null;};}function patchUpdates(_0x2ba433){return function(_0x41f021){try{jsonpatch['apply'](_0x41f021,_0x2ba433,!![]);}catch(_0xf96d07){return BPromise[_0x6953('0x24')](_0xf96d07);}return _0x41f021['save']();};}function saveUpdates(_0x317979,_0x40c9d1){return function(_0xb92529){if(_0xb92529){return _0xb92529[_0x6953('0x25')](_0x317979)['then'](function(_0x37f339){return _0x37f339;});}return null;};}function removeEntity(_0x231cb2,_0x2a7f6a){return function(_0x508ea7){if(_0x508ea7){return _0x508ea7['destroy']()['then'](function(){_0x231cb2[_0x6953('0x1b')](0xcc)[_0x6953('0x1c')]();});}};}function handleEntityNotFound(_0x550be4,_0x1a32f4){return function(_0x587df0){if(!_0x587df0){_0x550be4[_0x6953('0x1a')](0x194);}return _0x587df0;};}function handleError(_0x2bf39b,_0xcdbce8){_0xcdbce8=_0xcdbce8||0x1f4;return function(_0x2cc01e){logger[_0x6953('0x26')](_0x2cc01e[_0x6953('0x27')]);if(_0x2cc01e['name']){delete _0x2cc01e[_0x6953('0x28')];}_0x2bf39b[_0x6953('0x1b')](_0xcdbce8)['send'](_0x2cc01e);};}exports[_0x6953('0x29')]=function(_0x4af39d,_0x173b3c){var _0x3b1175={},_0x426c7c={},_0x4b0325={'count':0x0,'rows':[]};var _0x131992=_[_0x6953('0x2a')](db[_0x6953('0x2b')]['rawAttributes'],function(_0x4c49fc){return{'name':_0x4c49fc[_0x6953('0x2c')],'type':_0x4c49fc['type']['key']};});_0x426c7c[_0x6953('0x2d')]=_[_0x6953('0x2a')](_0x131992,_0x6953('0x28'));_0x426c7c[_0x6953('0x2e')]=_[_0x6953('0x2f')](_0x4af39d['query']);_0x426c7c[_0x6953('0x30')]=_['intersection'](_0x426c7c[_0x6953('0x2d')],_0x426c7c[_0x6953('0x2e')]);_0x3b1175['attributes']=_['intersection'](_0x426c7c[_0x6953('0x2d')],qs[_0x6953('0x31')](_0x4af39d[_0x6953('0x2e')]['fields']));_0x3b1175[_0x6953('0x32')]=_0x3b1175['attributes']['length']?_0x3b1175['attributes']:_0x426c7c['model'];if(!_0x4af39d[_0x6953('0x2e')][_0x6953('0x33')](_0x6953('0x34'))){_0x3b1175[_0x6953('0x20')]=qs[_0x6953('0x20')](_0x4af39d[_0x6953('0x2e')]['limit']);_0x3b1175[_0x6953('0x1e')]=qs['offset'](_0x4af39d[_0x6953('0x2e')]['offset']);}_0x3b1175[_0x6953('0x35')]=qs[_0x6953('0x36')](_0x4af39d[_0x6953('0x2e')][_0x6953('0x36')]);_0x3b1175['where']=qs[_0x6953('0x30')](_[_0x6953('0x37')](_0x4af39d[_0x6953('0x2e')],_0x426c7c[_0x6953('0x30')]),_0x131992);if(_0x4af39d[_0x6953('0x2e')][_0x6953('0x38')]){_0x3b1175[_0x6953('0x39')]=_[_0x6953('0x3a')](_0x3b1175[_0x6953('0x39')],{'$or':_[_0x6953('0x2a')](_0x131992,function(_0x2d9d81){if(_0x2d9d81['type']!==_0x6953('0x3b')){var _0x3c03ab={};_0x3c03ab[_0x2d9d81[_0x6953('0x28')]]={'$like':'%'+_0x4af39d['query']['filter']+'%'};return _0x3c03ab;}})});}_0x3b1175=_[_0x6953('0x3a')]({},_0x3b1175,_0x4af39d['options']);var _0x5abaf2={'where':_0x3b1175[_0x6953('0x39')]};return db[_0x6953('0x2b')]['count'](_0x5abaf2)[_0x6953('0x3c')](function(_0x263728){_0x4b0325[_0x6953('0x21')]=_0x263728;if(_0x4af39d[_0x6953('0x2e')][_0x6953('0x3d')]){_0x3b1175[_0x6953('0x3e')]=[{'all':!![]}];}return db['UserProfileResource'][_0x6953('0x3f')](_0x3b1175);})[_0x6953('0x3c')](function(_0x30a27a){_0x4b0325[_0x6953('0x40')]=_0x30a27a;return _0x4b0325;})[_0x6953('0x3c')](respondWithFilteredResult(_0x173b3c,_0x3b1175))[_0x6953('0x41')](handleError(_0x173b3c,null));};exports['show']=function(_0x5a40de,_0xeef91a){var _0x54d7c2={'raw':![],'where':{'id':_0x5a40de[_0x6953('0x42')]['id']}},_0x588ff8={};_0x588ff8[_0x6953('0x2d')]=_[_0x6953('0x2f')](db[_0x6953('0x2b')][_0x6953('0x43')]);_0x588ff8['query']=_['keys'](_0x5a40de[_0x6953('0x2e')]);_0x588ff8[_0x6953('0x30')]=_['intersection'](_0x588ff8[_0x6953('0x2d')],_0x588ff8['query']);_0x54d7c2[_0x6953('0x32')]=_[_0x6953('0x44')](_0x588ff8[_0x6953('0x2d')],qs[_0x6953('0x31')](_0x5a40de['query'][_0x6953('0x31')]));_0x54d7c2[_0x6953('0x32')]=_0x54d7c2['attributes'][_0x6953('0x45')]?_0x54d7c2[_0x6953('0x32')]:_0x588ff8[_0x6953('0x2d')];if(_0x5a40de[_0x6953('0x2e')][_0x6953('0x3d')]){_0x54d7c2[_0x6953('0x3e')]=[{'all':!![]}];}_0x54d7c2=_[_0x6953('0x3a')]({},_0x54d7c2,_0x5a40de[_0x6953('0x46')]);return db[_0x6953('0x2b')][_0x6953('0x47')](_0x54d7c2)[_0x6953('0x3c')](handleEntityNotFound(_0xeef91a,null))['then'](respondWithResult(_0xeef91a,null))[_0x6953('0x41')](handleError(_0xeef91a,null));};exports['create']=function(_0x15c142,_0x1d5979){return db[_0x6953('0x2b')]['create'](_0x15c142[_0x6953('0x48')],{})[_0x6953('0x3c')](respondWithResult(_0x1d5979,0xc9))['catch'](handleError(_0x1d5979,null));};exports['update']=function(_0xbf5b61,_0x265b44){if(_0xbf5b61[_0x6953('0x48')]['id']){delete _0xbf5b61[_0x6953('0x48')]['id'];}return db[_0x6953('0x2b')][_0x6953('0x47')]({'where':{'id':_0xbf5b61[_0x6953('0x42')]['id']}})[_0x6953('0x3c')](handleEntityNotFound(_0x265b44,null))[_0x6953('0x3c')](saveUpdates(_0xbf5b61[_0x6953('0x48')],null))[_0x6953('0x3c')](respondWithResult(_0x265b44,null))['catch'](handleError(_0x265b44,null));};exports['destroy']=function(_0x14a7bf,_0x38e3e8){return db[_0x6953('0x2b')][_0x6953('0x47')]({'where':{'id':_0x14a7bf[_0x6953('0x42')]['id']}})[_0x6953('0x3c')](handleEntityNotFound(_0x38e3e8,null))[_0x6953('0x3c')](removeEntity(_0x38e3e8,null))[_0x6953('0x41')](handleError(_0x38e3e8,null));};exports[_0x6953('0x49')]=function(_0x50b962,_0x5f15b0){return db['UserProfileResource']['describe']()[_0x6953('0x3c')](respondWithResult(_0x5f15b0,null))[_0x6953('0x41')](handleError(_0x5f15b0,null));}; \ No newline at end of file +var _0xe3da=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','UserProfileResource','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','order','sort','where','pick','map','VIRTUAL','filter','merge','options','count','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x5be3d5,_0x587c15){var _0x170d46=function(_0x42bca3){while(--_0x42bca3){_0x5be3d5['push'](_0x5be3d5['shift']());}};_0x170d46(++_0x587c15);}(_0xe3da,0x1cd));var _0xae3d=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xe3da[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require(_0xae3d('0x0'));var rimraf=require(_0xae3d('0x1'));var zipdir=require(_0xae3d('0x2'));var jsonpatch=require(_0xae3d('0x3'));var rp=require(_0xae3d('0x4'));var moment=require(_0xae3d('0x5'));var BPromise=require(_0xae3d('0x6'));var Mustache=require(_0xae3d('0x7'));var util=require(_0xae3d('0x8'));var path=require(_0xae3d('0x9'));var sox=require(_0xae3d('0xa'));var csv=require(_0xae3d('0xb'));var ejs=require(_0xae3d('0xc'));var fs=require('fs');var fs_extra=require(_0xae3d('0xd'));var _=require(_0xae3d('0xe'));var squel=require(_0xae3d('0xf'));var crypto=require('crypto');var jsforce=require(_0xae3d('0x10'));var deskjs=require(_0xae3d('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xae3d('0x12'));var Redis=require(_0xae3d('0x13'));var authService=require(_0xae3d('0x14'));var qs=require(_0xae3d('0x15'));var as=require(_0xae3d('0x16'));var hardwareService=require(_0xae3d('0x17'));var logger=require('../../config/logger')(_0xae3d('0x18'));var utils=require('../../config/utils');var config=require(_0xae3d('0x19'));var licenseUtil=require(_0xae3d('0x1a'));var db=require(_0xae3d('0x1b'))['db'];function respondWithStatusCode(_0x172f7a,_0x48aa74){_0x48aa74=_0x48aa74||0xcc;return function(_0xfb7869){if(_0xfb7869){return _0x172f7a[_0xae3d('0x1c')](_0x48aa74);}return _0x172f7a[_0xae3d('0x1d')](_0x48aa74)[_0xae3d('0x1e')]();};}function respondWithResult(_0x2afdd3,_0x430659){_0x430659=_0x430659||0xc8;return function(_0x31498d){if(_0x31498d){return _0x2afdd3['status'](_0x430659)[_0xae3d('0x1f')](_0x31498d);}};}function respondWithFilteredResult(_0x42f4b4,_0x46295b){return function(_0x230afb){if(_0x230afb){var _0x192c13=typeof _0x46295b[_0xae3d('0x20')]==='undefined'&&typeof _0x46295b[_0xae3d('0x21')]===_0xae3d('0x22');var _0x2e31f1=_0x230afb['count'];var _0x3f8cf9=_0x192c13?0x0:_0x46295b[_0xae3d('0x20')];var _0x558e42=_0x192c13?_0x230afb['count']:_0x46295b[_0xae3d('0x20')]+_0x46295b[_0xae3d('0x21')];var _0x19c44d;if(_0x558e42>=_0x2e31f1){_0x558e42=_0x2e31f1;_0x19c44d=0xc8;}else{_0x19c44d=0xce;}_0x42f4b4[_0xae3d('0x1d')](_0x19c44d);return _0x42f4b4[_0xae3d('0x23')]('Content-Range',_0x3f8cf9+'-'+_0x558e42+'/'+_0x2e31f1)[_0xae3d('0x1f')](_0x230afb);}return null;};}function patchUpdates(_0x48f00e){return function(_0x4a09c2){try{jsonpatch[_0xae3d('0x24')](_0x4a09c2,_0x48f00e,!![]);}catch(_0x1415e8){return BPromise[_0xae3d('0x25')](_0x1415e8);}return _0x4a09c2[_0xae3d('0x26')]();};}function saveUpdates(_0x3e7afc,_0x26c419){return function(_0x155099){if(_0x155099){return _0x155099[_0xae3d('0x27')](_0x3e7afc)[_0xae3d('0x28')](function(_0x300be8){return _0x300be8;});}return null;};}function removeEntity(_0x9bf34a,_0x37f5ff){return function(_0x1b2acb){if(_0x1b2acb){return _0x1b2acb[_0xae3d('0x29')]()[_0xae3d('0x28')](function(){_0x9bf34a[_0xae3d('0x1d')](0xcc)[_0xae3d('0x1e')]();});}};}function handleEntityNotFound(_0x2131e9,_0x1b1217){return function(_0x5d45db){if(!_0x5d45db){_0x2131e9[_0xae3d('0x1c')](0x194);}return _0x5d45db;};}function handleError(_0x185e71,_0xb5940){_0xb5940=_0xb5940||0x1f4;return function(_0x52df0f){logger[_0xae3d('0x2a')](_0x52df0f[_0xae3d('0x2b')]);if(_0x52df0f[_0xae3d('0x2c')]){delete _0x52df0f['name'];}_0x185e71['status'](_0xb5940)[_0xae3d('0x2d')](_0x52df0f);};}exports[_0xae3d('0x2e')]=function(_0x3a5840,_0x3114f9){var _0xb69ec9={},_0x561371={},_0x1d1483={'count':0x0,'rows':[]};var _0x3a2434=_['map'](db[_0xae3d('0x2f')][_0xae3d('0x30')],function(_0x2cf750){return{'name':_0x2cf750[_0xae3d('0x31')],'type':_0x2cf750[_0xae3d('0x32')][_0xae3d('0x33')]};});_0x561371['model']=_['map'](_0x3a2434,'name');_0x561371[_0xae3d('0x34')]=_[_0xae3d('0x35')](_0x3a5840[_0xae3d('0x34')]);_0x561371[_0xae3d('0x36')]=_['intersection'](_0x561371[_0xae3d('0x37')],_0x561371[_0xae3d('0x34')]);_0xb69ec9[_0xae3d('0x38')]=_[_0xae3d('0x39')](_0x561371[_0xae3d('0x37')],qs[_0xae3d('0x3a')](_0x3a5840[_0xae3d('0x34')]['fields']));_0xb69ec9[_0xae3d('0x38')]=_0xb69ec9['attributes']['length']?_0xb69ec9[_0xae3d('0x38')]:_0x561371['model'];if(!_0x3a5840[_0xae3d('0x34')]['hasOwnProperty']('nolimit')){_0xb69ec9[_0xae3d('0x21')]=qs[_0xae3d('0x21')](_0x3a5840[_0xae3d('0x34')]['limit']);_0xb69ec9[_0xae3d('0x20')]=qs['offset'](_0x3a5840[_0xae3d('0x34')][_0xae3d('0x20')]);}_0xb69ec9[_0xae3d('0x3b')]=qs[_0xae3d('0x3c')](_0x3a5840[_0xae3d('0x34')][_0xae3d('0x3c')]);_0xb69ec9[_0xae3d('0x3d')]=qs[_0xae3d('0x36')](_[_0xae3d('0x3e')](_0x3a5840[_0xae3d('0x34')],_0x561371[_0xae3d('0x36')]),_0x3a2434);if(_0x3a5840['query']['filter']){_0xb69ec9[_0xae3d('0x3d')]=_['merge'](_0xb69ec9[_0xae3d('0x3d')],{'$or':_[_0xae3d('0x3f')](_0x3a2434,function(_0x1db3c1){if(_0x1db3c1[_0xae3d('0x32')]!==_0xae3d('0x40')){var _0x35db44={};_0x35db44[_0x1db3c1[_0xae3d('0x2c')]]={'$like':'%'+_0x3a5840[_0xae3d('0x34')][_0xae3d('0x41')]+'%'};return _0x35db44;}})});}_0xb69ec9=_[_0xae3d('0x42')]({},_0xb69ec9,_0x3a5840[_0xae3d('0x43')]);var _0x549db8={'where':_0xb69ec9[_0xae3d('0x3d')]};return db[_0xae3d('0x2f')][_0xae3d('0x44')](_0x549db8)['then'](function(_0x4df102){_0x1d1483[_0xae3d('0x44')]=_0x4df102;if(_0x3a5840[_0xae3d('0x34')]['includeAll']){_0xb69ec9[_0xae3d('0x45')]=[{'all':!![]}];}return db[_0xae3d('0x2f')][_0xae3d('0x46')](_0xb69ec9);})[_0xae3d('0x28')](function(_0x436a04){_0x1d1483[_0xae3d('0x47')]=_0x436a04;return _0x1d1483;})['then'](respondWithFilteredResult(_0x3114f9,_0xb69ec9))[_0xae3d('0x48')](handleError(_0x3114f9,null));};exports[_0xae3d('0x49')]=function(_0xce7f34,_0x938811){var _0x1fef90={'raw':![],'where':{'id':_0xce7f34[_0xae3d('0x4a')]['id']}},_0x515220={};_0x515220['model']=_[_0xae3d('0x35')](db[_0xae3d('0x2f')][_0xae3d('0x30')]);_0x515220[_0xae3d('0x34')]=_['keys'](_0xce7f34['query']);_0x515220['filters']=_[_0xae3d('0x39')](_0x515220[_0xae3d('0x37')],_0x515220['query']);_0x1fef90['attributes']=_['intersection'](_0x515220[_0xae3d('0x37')],qs[_0xae3d('0x3a')](_0xce7f34[_0xae3d('0x34')][_0xae3d('0x3a')]));_0x1fef90[_0xae3d('0x38')]=_0x1fef90[_0xae3d('0x38')][_0xae3d('0x4b')]?_0x1fef90['attributes']:_0x515220['model'];if(_0xce7f34['query'][_0xae3d('0x4c')]){_0x1fef90['include']=[{'all':!![]}];}_0x1fef90=_[_0xae3d('0x42')]({},_0x1fef90,_0xce7f34[_0xae3d('0x43')]);return db[_0xae3d('0x2f')][_0xae3d('0x4d')](_0x1fef90)[_0xae3d('0x28')](handleEntityNotFound(_0x938811,null))[_0xae3d('0x28')](respondWithResult(_0x938811,null))[_0xae3d('0x48')](handleError(_0x938811,null));};exports[_0xae3d('0x4e')]=function(_0x38f92d,_0x4ed0f9){return db[_0xae3d('0x2f')]['create'](_0x38f92d['body'],{})['then'](respondWithResult(_0x4ed0f9,0xc9))[_0xae3d('0x48')](handleError(_0x4ed0f9,null));};exports[_0xae3d('0x27')]=function(_0x39f213,_0x6fa6c){if(_0x39f213['body']['id']){delete _0x39f213['body']['id'];}return db[_0xae3d('0x2f')][_0xae3d('0x4d')]({'where':{'id':_0x39f213[_0xae3d('0x4a')]['id']}})[_0xae3d('0x28')](handleEntityNotFound(_0x6fa6c,null))['then'](saveUpdates(_0x39f213[_0xae3d('0x4f')],null))[_0xae3d('0x28')](respondWithResult(_0x6fa6c,null))[_0xae3d('0x48')](handleError(_0x6fa6c,null));};exports[_0xae3d('0x29')]=function(_0x2a6a24,_0x38ccf1){return db[_0xae3d('0x2f')][_0xae3d('0x4d')]({'where':{'id':_0x2a6a24[_0xae3d('0x4a')]['id']}})[_0xae3d('0x28')](handleEntityNotFound(_0x38ccf1,null))[_0xae3d('0x28')](removeEntity(_0x38ccf1,null))[_0xae3d('0x48')](handleError(_0x38ccf1,null));};exports['describe']=function(_0x4f4694,_0x4c6dab){return db[_0xae3d('0x2f')][_0xae3d('0x50')]()['then'](respondWithResult(_0x4c6dab,null))[_0xae3d('0x48')](handleError(_0x4c6dab,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 50fffbb..b00e6de 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 _0xdc00=['exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes'];(function(_0x3de218,_0x51b13){var _0x12f582=function(_0x2e4b7e){while(--_0x2e4b7e){_0x3de218['push'](_0x3de218['shift']());}};_0x12f582(++_0x51b13);}(_0xdc00,0xd7));var _0x0dc0=function(_0x5ae671,_0x53e18d){_0x5ae671=_0x5ae671-0x0;var _0x48c8df=_0xdc00[_0x5ae671];return _0x48c8df;};'use strict';var _=require(_0x0dc0('0x0'));var util=require(_0x0dc0('0x1'));var logger=require(_0x0dc0('0x2'))(_0x0dc0('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0dc0('0x4'));var fs=require('fs');var path=require(_0x0dc0('0x5'));var rimraf=require(_0x0dc0('0x6'));var config=require(_0x0dc0('0x7'));var attributes=require(_0x0dc0('0x8'));module[_0x0dc0('0x9')]=function(_0x5f4ab4,_0x4e70f6){return _0x5f4ab4[_0x0dc0('0xa')](_0x0dc0('0xb'),attributes,{'tableName':_0x0dc0('0xc'),'paranoid':![],'indexes':[{'name':_0x0dc0('0xd'),'fields':[_0x0dc0('0xe'),_0x0dc0('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x47ec=['../../config/environment','./userProfileResource.attributes','define','UserProfileResource','user_profile_has_resources','resourceId','sectionId','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x58da8a,_0x1c0584){var _0x5ba3a3=function(_0x31552b){while(--_0x31552b){_0x58da8a['push'](_0x58da8a['shift']());}};_0x5ba3a3(++_0x1c0584);}(_0x47ec,0x173));var _0xc47e=function(_0x898251,_0x14a605){_0x898251=_0x898251-0x0;var _0x4597d7=_0x47ec[_0x898251];return _0x4597d7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc47e('0x0'))(_0xc47e('0x1'));var moment=require(_0xc47e('0x2'));var BPromise=require(_0xc47e('0x3'));var rp=require(_0xc47e('0x4'));var fs=require('fs');var path=require(_0xc47e('0x5'));var rimraf=require(_0xc47e('0x6'));var config=require(_0xc47e('0x7'));var attributes=require(_0xc47e('0x8'));module['exports']=function(_0x40c9c2,_0x529753){return _0x40c9c2[_0xc47e('0x9')](_0xc47e('0xa'),attributes,{'tableName':_0xc47e('0xb'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xc47e('0xc'),_0xc47e('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index f82f222..f70dd9b 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 _0x677d=['request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http'];(function(_0x457b96,_0x4d9f45){var _0x515215=function(_0x39e1be){while(--_0x39e1be){_0x457b96['push'](_0x457b96['shift']());}};_0x515215(++_0x4d9f45);}(_0x677d,0x9f));var _0xd677=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x677d[_0xc6be3a];return _0x56a310;};'use strict';var _=require('lodash');var util=require(_0xd677('0x0'));var moment=require(_0xd677('0x1'));var BPromise=require(_0xd677('0x2'));var rs=require(_0xd677('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd677('0x4'))['db'];var utils=require(_0xd677('0x5'));var logger=require(_0xd677('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd677('0x7')][_0xd677('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xdd06d,_0x9a982b,_0xdb4cba){return new BPromise(function(_0x350013,_0x3084d6){return client[_0xd677('0x9')](_0xdd06d,_0xdb4cba)[_0xd677('0xa')](function(_0x1adb6e){logger[_0xd677('0xb')](_0xd677('0xc'),_0x9a982b,_0xd677('0xd'));logger[_0xd677('0xe')](_0xd677('0xf'),_0x9a982b,_0xd677('0xd'),JSON[_0xd677('0x10')](_0x1adb6e));if(_0x1adb6e[_0xd677('0x11')]){if(_0x1adb6e[_0xd677('0x11')][_0xd677('0x12')]===0x1f4){logger[_0xd677('0x11')](_0xd677('0xc'),_0x9a982b,_0x1adb6e['error'][_0xd677('0x13')]);return _0x3084d6(_0x1adb6e[_0xd677('0x11')][_0xd677('0x13')]);}logger[_0xd677('0x11')]('UserProfileResource,\x20%s,\x20%s',_0x9a982b,_0x1adb6e[_0xd677('0x11')][_0xd677('0x13')]);return _0x350013(_0x1adb6e['error'][_0xd677('0x13')]);}else{logger[_0xd677('0xb')](_0xd677('0xc'),_0x9a982b,'request\x20sent');_0x350013(_0x1adb6e[_0xd677('0x14')][_0xd677('0x13')]);}})['catch'](function(_0x1469b1){logger[_0xd677('0x11')](_0xd677('0xc'),_0x9a982b,_0x1469b1);_0x3084d6(_0x1469b1);});});} \ No newline at end of file +var _0xd8ff=['http','then','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client'];(function(_0x4910aa,_0x3322c2){var _0x3bafcb=function(_0x20961f){while(--_0x20961f){_0x4910aa['push'](_0x4910aa['shift']());}};_0x3bafcb(++_0x3322c2);}(_0xd8ff,0xfe));var _0xfd8f=function(_0x16f88c,_0x2aad29){_0x16f88c=_0x16f88c-0x0;var _0x20ab2e=_0xd8ff[_0x16f88c];return _0x20ab2e;};'use strict';var _=require(_0xfd8f('0x0'));var util=require(_0xfd8f('0x1'));var moment=require(_0xfd8f('0x2'));var BPromise=require(_0xfd8f('0x3'));var rs=require(_0xfd8f('0x4'));var fs=require('fs');var Redis=require(_0xfd8f('0x5'));var db=require(_0xfd8f('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xfd8f('0x7'));var jayson=require(_0xfd8f('0x8'));var client=jayson[_0xfd8f('0x9')][_0xfd8f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x24aa89,_0x9d4d5e,_0x4051e8){return new BPromise(function(_0x447e4e,_0x372052){return client['request'](_0x24aa89,_0x4051e8)[_0xfd8f('0xb')](function(_0x14fdc2){logger['info'](_0xfd8f('0xc'),_0x9d4d5e,_0xfd8f('0xd'));logger[_0xfd8f('0xe')](_0xfd8f('0xf'),_0x9d4d5e,_0xfd8f('0xd'),JSON['stringify'](_0x14fdc2));if(_0x14fdc2[_0xfd8f('0x10')]){if(_0x14fdc2[_0xfd8f('0x10')][_0xfd8f('0x11')]===0x1f4){logger['error'](_0xfd8f('0xc'),_0x9d4d5e,_0x14fdc2[_0xfd8f('0x10')][_0xfd8f('0x12')]);return _0x372052(_0x14fdc2['error'][_0xfd8f('0x12')]);}logger[_0xfd8f('0x10')]('UserProfileResource,\x20%s,\x20%s',_0x9d4d5e,_0x14fdc2[_0xfd8f('0x10')][_0xfd8f('0x12')]);return _0x447e4e(_0x14fdc2[_0xfd8f('0x10')][_0xfd8f('0x12')]);}else{logger[_0xfd8f('0x13')](_0xfd8f('0xc'),_0x9d4d5e,_0xfd8f('0xd'));_0x447e4e(_0x14fdc2[_0xfd8f('0x14')]['message']);}})[_0xfd8f('0x15')](function(_0x273bb9){logger[_0xfd8f('0x10')](_0xfd8f('0xc'),_0x9d4d5e,_0x273bb9);_0x372052(_0x273bb9);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index d080283..83e48dc 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 _0xe43a=['put','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./userProfileSection.controller','get','/describe','isAuthenticated','/:id','create'];(function(_0x66cc59,_0x3b06cc){var _0x1ab3f8=function(_0x5c6aa6){while(--_0x5c6aa6){_0x66cc59['push'](_0x66cc59['shift']());}};_0x1ab3f8(++_0x3b06cc);}(_0xe43a,0x193));var _0xae43=function(_0x1b6aab,_0x5683f0){_0x1b6aab=_0x1b6aab-0x0;var _0x181f68=_0xe43a[_0x1b6aab];return _0x181f68;};'use strict';var multer=require(_0xae43('0x0'));var util=require('util');var path=require(_0xae43('0x1'));var timeout=require(_0xae43('0x2'));var express=require(_0xae43('0x3'));var router=express[_0xae43('0x4')]();var fs_extra=require(_0xae43('0x5'));var auth=require(_0xae43('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xae43('0x7'));router[_0xae43('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xae43('0x8')](_0xae43('0x9'),auth[_0xae43('0xa')](),controller['describe']);router[_0xae43('0x8')](_0xae43('0xb'),auth[_0xae43('0xa')](),controller['show']);router['post']('/',auth[_0xae43('0xa')](),controller[_0xae43('0xc')]);router[_0xae43('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xae43('0xe')](_0xae43('0xb'),auth[_0xae43('0xa')](),controller['destroy']);module[_0xae43('0xf')]=router; \ No newline at end of file +var _0x70b2=['../../components/auth/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x70b2,0xba));var _0x270b=function(_0x50eb1b,_0x255fb1){_0x50eb1b=_0x50eb1b-0x0;var _0x1b7629=_0x70b2[_0x50eb1b];return _0x1b7629;};'use strict';var multer=require(_0x270b('0x0'));var util=require(_0x270b('0x1'));var path=require(_0x270b('0x2'));var timeout=require(_0x270b('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x270b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x270b('0x5'));var controller=require('./userProfileSection.controller');router['get']('/',auth[_0x270b('0x6')](),controller[_0x270b('0x7')]);router[_0x270b('0x8')](_0x270b('0x9'),auth[_0x270b('0x6')](),controller[_0x270b('0xa')]);router['get'](_0x270b('0xb'),auth[_0x270b('0x6')](),controller[_0x270b('0xc')]);router[_0x270b('0xd')]('/',auth['isAuthenticated'](),controller[_0x270b('0xe')]);router['put']('/:id',auth[_0x270b('0x6')](),controller[_0x270b('0xf')]);router[_0x270b('0x10')](_0x270b('0xb'),auth[_0x270b('0x6')](),controller[_0x270b('0x11')]);module[_0x270b('0x12')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 76777ce..ed64b04 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 _0xea28=['crudPermissions','join','getDataValue','split','sequelize','exports','STRING','INTEGER','BOOLEAN','setDataValue'];(function(_0x496a1f,_0x5558b4){var _0x1a7452=function(_0xded5d9){while(--_0xded5d9){_0x496a1f['push'](_0x496a1f['shift']());}};_0x1a7452(++_0x5558b4);}(_0xea28,0x13a));var _0x8ea2=function(_0x46bb81,_0x3b5cf9){_0x46bb81=_0x46bb81-0x0;var _0x1fa099=_0xea28[_0x46bb81];return _0x1fa099;};'use strict';var Sequelize=require(_0x8ea2('0x0'));module[_0x8ea2('0x1')]={'name':{'type':Sequelize[_0x8ea2('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x8ea2('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x8ea2('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x8ea2('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x8ea2('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x8ea2('0x2')],'set':function(_0x4b7cda){this[_0x8ea2('0x5')](_0x8ea2('0x6'),_0x4b7cda?_0x4b7cda[_0x8ea2('0x7')](''):[]);},'get':function(){return this['getDataValue'](_0x8ea2('0x6'))?this[_0x8ea2('0x8')](_0x8ea2('0x6'))[_0x8ea2('0x9')](''):[];}}}; \ No newline at end of file +var _0x8603=['BOOLEAN','crudPermissions','getDataValue','split','exports','STRING'];(function(_0x466994,_0x29ebad){var _0x5157de=function(_0x37bf97){while(--_0x37bf97){_0x466994['push'](_0x466994['shift']());}};_0x5157de(++_0x29ebad);}(_0x8603,0x190));var _0x3860=function(_0x53e3de,_0x13da7b){_0x53e3de=_0x53e3de-0x0;var _0x7b905b=_0x8603[_0x53e3de];return _0x7b905b;};'use strict';var Sequelize=require('sequelize');module[_0x3860('0x0')]={'name':{'type':Sequelize[_0x3860('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x3860('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x3860('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x3860('0x1')],'set':function(_0x2f56a3){this['setDataValue'](_0x3860('0x3'),_0x2f56a3?_0x2f56a3['join'](''):[]);},'get':function(){return this[_0x3860('0x4')](_0x3860('0x3'))?this[_0x3860('0x4')](_0x3860('0x3'))[_0x3860('0x5')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 64846f2..6d5b526 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 _0xb081=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','count','limit','set','apply','reject','update','then','sendStatus','error','stack','name','send','index','map','UserProfileSection','rawAttributes','fieldName','model','query','keys','filters','attributes','fields','hasOwnProperty','order','where','pick','filter','merge','type','options','includeAll','include','rows','catch','params','intersection','length','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xb081,0x14a));var _0x1b08=function(_0x608e20,_0x2c546d){_0x608e20=_0x608e20-0x0;var _0x5f498a=_0xb081[_0x608e20];return _0x5f498a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1b08('0x0'));var zipdir=require(_0x1b08('0x1'));var jsonpatch=require(_0x1b08('0x2'));var rp=require(_0x1b08('0x3'));var moment=require(_0x1b08('0x4'));var BPromise=require(_0x1b08('0x5'));var Mustache=require(_0x1b08('0x6'));var util=require(_0x1b08('0x7'));var path=require(_0x1b08('0x8'));var sox=require(_0x1b08('0x9'));var csv=require(_0x1b08('0xa'));var ejs=require(_0x1b08('0xb'));var fs=require('fs');var fs_extra=require(_0x1b08('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1b08('0xa'));var querystring=require('querystring');var Papa=require(_0x1b08('0xd'));var Redis=require('ioredis');var authService=require(_0x1b08('0xe'));var qs=require(_0x1b08('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1b08('0x10'))(_0x1b08('0x11'));var utils=require(_0x1b08('0x12'));var config=require(_0x1b08('0x13'));var licenseUtil=require(_0x1b08('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e7c89,_0x49705c){_0x49705c=_0x49705c||0xcc;return function(_0x12d32a){if(_0x12d32a){return _0x3e7c89['sendStatus'](_0x49705c);}return _0x3e7c89[_0x1b08('0x15')](_0x49705c)['end']();};}function respondWithResult(_0x36faaf,_0x2f553e){_0x2f553e=_0x2f553e||0xc8;return function(_0x447e3b){if(_0x447e3b){return _0x36faaf['status'](_0x2f553e)[_0x1b08('0x16')](_0x447e3b);}};}function respondWithFilteredResult(_0x599b1f,_0x321a48){return function(_0x34decf){if(_0x34decf){var _0x22c971=typeof _0x321a48[_0x1b08('0x17')]==='undefined'&&typeof _0x321a48['limit']===_0x1b08('0x18');var _0x51b7ba=_0x34decf[_0x1b08('0x19')];var _0x51e178=_0x22c971?0x0:_0x321a48[_0x1b08('0x17')];var _0xfcb75c=_0x22c971?_0x34decf['count']:_0x321a48['offset']+_0x321a48[_0x1b08('0x1a')];var _0x187ef8;if(_0xfcb75c>=_0x51b7ba){_0xfcb75c=_0x51b7ba;_0x187ef8=0xc8;}else{_0x187ef8=0xce;}_0x599b1f[_0x1b08('0x15')](_0x187ef8);return _0x599b1f[_0x1b08('0x1b')]('Content-Range',_0x51e178+'-'+_0xfcb75c+'/'+_0x51b7ba)[_0x1b08('0x16')](_0x34decf);}return null;};}function patchUpdates(_0x263ba6){return function(_0x345dcb){try{jsonpatch[_0x1b08('0x1c')](_0x345dcb,_0x263ba6,!![]);}catch(_0x144222){return BPromise[_0x1b08('0x1d')](_0x144222);}return _0x345dcb['save']();};}function saveUpdates(_0x2d692c,_0x1fb91a){return function(_0x223e36){if(_0x223e36){return _0x223e36[_0x1b08('0x1e')](_0x2d692c)[_0x1b08('0x1f')](function(_0xec96f0){return _0xec96f0;});}return null;};}function removeEntity(_0x53650b,_0xb9e026){return function(_0x2101fe){if(_0x2101fe){return _0x2101fe['destroy']()[_0x1b08('0x1f')](function(){_0x53650b[_0x1b08('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x244c7c,_0x46f517){return function(_0x2edd9c){if(!_0x2edd9c){_0x244c7c[_0x1b08('0x20')](0x194);}return _0x2edd9c;};}function handleError(_0x393454,_0x55f370){_0x55f370=_0x55f370||0x1f4;return function(_0x318ded){logger[_0x1b08('0x21')](_0x318ded[_0x1b08('0x22')]);if(_0x318ded[_0x1b08('0x23')]){delete _0x318ded[_0x1b08('0x23')];}_0x393454[_0x1b08('0x15')](_0x55f370)[_0x1b08('0x24')](_0x318ded);};}exports[_0x1b08('0x25')]=function(_0x534301,_0x1a96f4){var _0x515456={},_0x2be5c9={},_0xa599f3={'count':0x0,'rows':[]};var _0x43f45f=_[_0x1b08('0x26')](db[_0x1b08('0x27')][_0x1b08('0x28')],function(_0xaeb8ce){return{'name':_0xaeb8ce[_0x1b08('0x29')],'type':_0xaeb8ce['type']['key']};});_0x2be5c9[_0x1b08('0x2a')]=_['map'](_0x43f45f,_0x1b08('0x23'));_0x2be5c9[_0x1b08('0x2b')]=_[_0x1b08('0x2c')](_0x534301[_0x1b08('0x2b')]);_0x2be5c9[_0x1b08('0x2d')]=_['intersection'](_0x2be5c9['model'],_0x2be5c9[_0x1b08('0x2b')]);_0x515456[_0x1b08('0x2e')]=_['intersection'](_0x2be5c9['model'],qs['fields'](_0x534301['query'][_0x1b08('0x2f')]));_0x515456['attributes']=_0x515456[_0x1b08('0x2e')]['length']?_0x515456[_0x1b08('0x2e')]:_0x2be5c9[_0x1b08('0x2a')];if(!_0x534301[_0x1b08('0x2b')][_0x1b08('0x30')]('nolimit')){_0x515456[_0x1b08('0x1a')]=qs[_0x1b08('0x1a')](_0x534301[_0x1b08('0x2b')]['limit']);_0x515456['offset']=qs['offset'](_0x534301[_0x1b08('0x2b')][_0x1b08('0x17')]);}_0x515456[_0x1b08('0x31')]=qs['sort'](_0x534301[_0x1b08('0x2b')]['sort']);_0x515456[_0x1b08('0x32')]=qs[_0x1b08('0x2d')](_[_0x1b08('0x33')](_0x534301['query'],_0x2be5c9[_0x1b08('0x2d')]),_0x43f45f);if(_0x534301[_0x1b08('0x2b')][_0x1b08('0x34')]){_0x515456[_0x1b08('0x32')]=_[_0x1b08('0x35')](_0x515456[_0x1b08('0x32')],{'$or':_[_0x1b08('0x26')](_0x43f45f,function(_0x5e06cb){if(_0x5e06cb[_0x1b08('0x36')]!=='VIRTUAL'){var _0x1658a6={};_0x1658a6[_0x5e06cb[_0x1b08('0x23')]]={'$like':'%'+_0x534301[_0x1b08('0x2b')][_0x1b08('0x34')]+'%'};return _0x1658a6;}})});}_0x515456=_[_0x1b08('0x35')]({},_0x515456,_0x534301[_0x1b08('0x37')]);var _0x380fc4={'where':_0x515456['where']};return db[_0x1b08('0x27')][_0x1b08('0x19')](_0x380fc4)[_0x1b08('0x1f')](function(_0xc46959){_0xa599f3['count']=_0xc46959;if(_0x534301['query'][_0x1b08('0x38')]){_0x515456[_0x1b08('0x39')]=[{'all':!![]}];}return db[_0x1b08('0x27')]['findAll'](_0x515456);})[_0x1b08('0x1f')](function(_0x24c52a){_0xa599f3[_0x1b08('0x3a')]=_0x24c52a;return _0xa599f3;})[_0x1b08('0x1f')](respondWithFilteredResult(_0x1a96f4,_0x515456))[_0x1b08('0x3b')](handleError(_0x1a96f4,null));};exports['show']=function(_0x5beeb0,_0x2ff577){var _0x220e24={'raw':![],'where':{'id':_0x5beeb0[_0x1b08('0x3c')]['id']}},_0x12cb24={};_0x12cb24['model']=_[_0x1b08('0x2c')](db[_0x1b08('0x27')][_0x1b08('0x28')]);_0x12cb24[_0x1b08('0x2b')]=_[_0x1b08('0x2c')](_0x5beeb0[_0x1b08('0x2b')]);_0x12cb24['filters']=_[_0x1b08('0x3d')](_0x12cb24[_0x1b08('0x2a')],_0x12cb24[_0x1b08('0x2b')]);_0x220e24[_0x1b08('0x2e')]=_[_0x1b08('0x3d')](_0x12cb24[_0x1b08('0x2a')],qs['fields'](_0x5beeb0['query'][_0x1b08('0x2f')]));_0x220e24[_0x1b08('0x2e')]=_0x220e24['attributes'][_0x1b08('0x3e')]?_0x220e24['attributes']:_0x12cb24[_0x1b08('0x2a')];if(_0x5beeb0[_0x1b08('0x2b')]['includeAll']){_0x220e24[_0x1b08('0x39')]=[{'all':!![]}];}_0x220e24=_[_0x1b08('0x35')]({},_0x220e24,_0x5beeb0['options']);return db[_0x1b08('0x27')][_0x1b08('0x3f')](_0x220e24)['then'](handleEntityNotFound(_0x2ff577,null))['then'](respondWithResult(_0x2ff577,null))[_0x1b08('0x3b')](handleError(_0x2ff577,null));};exports[_0x1b08('0x40')]=function(_0x3afa7b,_0x188896){return db[_0x1b08('0x27')][_0x1b08('0x40')](_0x3afa7b[_0x1b08('0x41')],{})['then'](respondWithResult(_0x188896,0xc9))[_0x1b08('0x3b')](handleError(_0x188896,null));};exports[_0x1b08('0x1e')]=function(_0x277854,_0x58367b){if(_0x277854[_0x1b08('0x41')]['id']){delete _0x277854[_0x1b08('0x41')]['id'];}return db['UserProfileSection'][_0x1b08('0x3f')]({'where':{'id':_0x277854[_0x1b08('0x3c')]['id']}})[_0x1b08('0x1f')](handleEntityNotFound(_0x58367b,null))[_0x1b08('0x1f')](saveUpdates(_0x277854['body'],null))[_0x1b08('0x1f')](respondWithResult(_0x58367b,null))[_0x1b08('0x3b')](handleError(_0x58367b,null));};exports['destroy']=function(_0x60f774,_0x5841e9){return db['UserProfileSection'][_0x1b08('0x3f')]({'where':{'id':_0x60f774[_0x1b08('0x3c')]['id']}})[_0x1b08('0x1f')](handleEntityNotFound(_0x5841e9,null))[_0x1b08('0x1f')](removeEntity(_0x5841e9,null))['catch'](handleError(_0x5841e9,null));};exports[_0x1b08('0x42')]=function(_0x7bd774,_0x2ecbe9){return db[_0x1b08('0x27')][_0x1b08('0x42')]()[_0x1b08('0x1f')](respondWithResult(_0x2ecbe9,null))['catch'](handleError(_0x2ecbe9,null));}; \ No newline at end of file +var _0x300c=['destroy','error','stack','name','index','UserProfileSection','rawAttributes','fieldName','type','key','map','query','keys','model','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','find','create','update','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','then'];(function(_0x371e4d,_0x1ad84e){var _0x197037=function(_0x517c16){while(--_0x517c16){_0x371e4d['push'](_0x371e4d['shift']());}};_0x197037(++_0x1ad84e);}(_0x300c,0x146));var _0xc300=function(_0x3cb16b,_0xea91a0){_0x3cb16b=_0x3cb16b-0x0;var _0x1a407e=_0x300c[_0x3cb16b];return _0x1a407e;};'use strict';var emlformat=require(_0xc300('0x0'));var rimraf=require(_0xc300('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc300('0x2'));var rp=require(_0xc300('0x3'));var moment=require(_0xc300('0x4'));var BPromise=require(_0xc300('0x5'));var Mustache=require(_0xc300('0x6'));var util=require(_0xc300('0x7'));var path=require(_0xc300('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc300('0x9'));var fs=require('fs');var fs_extra=require(_0xc300('0xa'));var _=require(_0xc300('0xb'));var squel=require(_0xc300('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc300('0xd'));var toCsv=require(_0xc300('0xe'));var querystring=require(_0xc300('0xf'));var Papa=require('papaparse');var Redis=require(_0xc300('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc300('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc300('0x12'))(_0xc300('0x13'));var utils=require(_0xc300('0x14'));var config=require(_0xc300('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xc300('0x16'))['db'];function respondWithStatusCode(_0x3a51c0,_0x1eeebf){_0x1eeebf=_0x1eeebf||0xcc;return function(_0x3338cd){if(_0x3338cd){return _0x3a51c0['sendStatus'](_0x1eeebf);}return _0x3a51c0[_0xc300('0x17')](_0x1eeebf)[_0xc300('0x18')]();};}function respondWithResult(_0x47b84d,_0xd695fd){_0xd695fd=_0xd695fd||0xc8;return function(_0x41ed6a){if(_0x41ed6a){return _0x47b84d['status'](_0xd695fd)[_0xc300('0x19')](_0x41ed6a);}};}function respondWithFilteredResult(_0x16aea9,_0x38d92a){return function(_0x5dfd37){if(_0x5dfd37){var _0x5cdb43=typeof _0x38d92a['offset']===_0xc300('0x1a')&&typeof _0x38d92a[_0xc300('0x1b')]==='undefined';var _0x427b61=_0x5dfd37[_0xc300('0x1c')];var _0x1ee053=_0x5cdb43?0x0:_0x38d92a[_0xc300('0x1d')];var _0xad1776=_0x5cdb43?_0x5dfd37['count']:_0x38d92a['offset']+_0x38d92a[_0xc300('0x1b')];var _0x1a2c49;if(_0xad1776>=_0x427b61){_0xad1776=_0x427b61;_0x1a2c49=0xc8;}else{_0x1a2c49=0xce;}_0x16aea9[_0xc300('0x17')](_0x1a2c49);return _0x16aea9[_0xc300('0x1e')](_0xc300('0x1f'),_0x1ee053+'-'+_0xad1776+'/'+_0x427b61)[_0xc300('0x19')](_0x5dfd37);}return null;};}function patchUpdates(_0x35b20f){return function(_0x614b5b){try{jsonpatch[_0xc300('0x20')](_0x614b5b,_0x35b20f,!![]);}catch(_0x2af8d4){return BPromise['reject'](_0x2af8d4);}return _0x614b5b['save']();};}function saveUpdates(_0x7b397a,_0x15d82f){return function(_0x5ad172){if(_0x5ad172){return _0x5ad172['update'](_0x7b397a)[_0xc300('0x21')](function(_0x407ed1){return _0x407ed1;});}return null;};}function removeEntity(_0x273548,_0x2a7ebf){return function(_0x4307ac){if(_0x4307ac){return _0x4307ac[_0xc300('0x22')]()[_0xc300('0x21')](function(){_0x273548[_0xc300('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e818e,_0x4216a0){return function(_0x137aa5){if(!_0x137aa5){_0x1e818e['sendStatus'](0x194);}return _0x137aa5;};}function handleError(_0xe70c2e,_0x2cc707){_0x2cc707=_0x2cc707||0x1f4;return function(_0x1b2f4c){logger[_0xc300('0x23')](_0x1b2f4c[_0xc300('0x24')]);if(_0x1b2f4c['name']){delete _0x1b2f4c[_0xc300('0x25')];}_0xe70c2e[_0xc300('0x17')](_0x2cc707)['send'](_0x1b2f4c);};}exports[_0xc300('0x26')]=function(_0x4dc3e3,_0x3c0bdb){var _0x1e542b={},_0x1c5004={},_0x32ffee={'count':0x0,'rows':[]};var _0xaa8aff=_['map'](db[_0xc300('0x27')][_0xc300('0x28')],function(_0x5140af){return{'name':_0x5140af[_0xc300('0x29')],'type':_0x5140af[_0xc300('0x2a')][_0xc300('0x2b')]};});_0x1c5004['model']=_[_0xc300('0x2c')](_0xaa8aff,_0xc300('0x25'));_0x1c5004[_0xc300('0x2d')]=_[_0xc300('0x2e')](_0x4dc3e3['query']);_0x1c5004['filters']=_['intersection'](_0x1c5004[_0xc300('0x2f')],_0x1c5004[_0xc300('0x2d')]);_0x1e542b[_0xc300('0x30')]=_[_0xc300('0x31')](_0x1c5004[_0xc300('0x2f')],qs['fields'](_0x4dc3e3[_0xc300('0x2d')][_0xc300('0x32')]));_0x1e542b[_0xc300('0x30')]=_0x1e542b[_0xc300('0x30')][_0xc300('0x33')]?_0x1e542b[_0xc300('0x30')]:_0x1c5004['model'];if(!_0x4dc3e3[_0xc300('0x2d')]['hasOwnProperty'](_0xc300('0x34'))){_0x1e542b[_0xc300('0x1b')]=qs['limit'](_0x4dc3e3['query'][_0xc300('0x1b')]);_0x1e542b[_0xc300('0x1d')]=qs[_0xc300('0x1d')](_0x4dc3e3[_0xc300('0x2d')][_0xc300('0x1d')]);}_0x1e542b[_0xc300('0x35')]=qs[_0xc300('0x36')](_0x4dc3e3[_0xc300('0x2d')]['sort']);_0x1e542b[_0xc300('0x37')]=qs[_0xc300('0x38')](_[_0xc300('0x39')](_0x4dc3e3[_0xc300('0x2d')],_0x1c5004[_0xc300('0x38')]),_0xaa8aff);if(_0x4dc3e3[_0xc300('0x2d')][_0xc300('0x3a')]){_0x1e542b['where']=_[_0xc300('0x3b')](_0x1e542b[_0xc300('0x37')],{'$or':_[_0xc300('0x2c')](_0xaa8aff,function(_0x3a9459){if(_0x3a9459[_0xc300('0x2a')]!=='VIRTUAL'){var _0x6827f6={};_0x6827f6[_0x3a9459[_0xc300('0x25')]]={'$like':'%'+_0x4dc3e3[_0xc300('0x2d')]['filter']+'%'};return _0x6827f6;}})});}_0x1e542b=_[_0xc300('0x3b')]({},_0x1e542b,_0x4dc3e3[_0xc300('0x3c')]);var _0x5bc485={'where':_0x1e542b[_0xc300('0x37')]};return db[_0xc300('0x27')][_0xc300('0x1c')](_0x5bc485)[_0xc300('0x21')](function(_0x33b3fd){_0x32ffee[_0xc300('0x1c')]=_0x33b3fd;if(_0x4dc3e3[_0xc300('0x2d')][_0xc300('0x3d')]){_0x1e542b[_0xc300('0x3e')]=[{'all':!![]}];}return db[_0xc300('0x27')][_0xc300('0x3f')](_0x1e542b);})[_0xc300('0x21')](function(_0x2589bb){_0x32ffee[_0xc300('0x40')]=_0x2589bb;return _0x32ffee;})[_0xc300('0x21')](respondWithFilteredResult(_0x3c0bdb,_0x1e542b))[_0xc300('0x41')](handleError(_0x3c0bdb,null));};exports[_0xc300('0x42')]=function(_0x5059bf,_0x278497){var _0x5486d7={'raw':![],'where':{'id':_0x5059bf['params']['id']}},_0x38e23d={};_0x38e23d[_0xc300('0x2f')]=_[_0xc300('0x2e')](db[_0xc300('0x27')]['rawAttributes']);_0x38e23d[_0xc300('0x2d')]=_['keys'](_0x5059bf[_0xc300('0x2d')]);_0x38e23d[_0xc300('0x38')]=_[_0xc300('0x31')](_0x38e23d[_0xc300('0x2f')],_0x38e23d[_0xc300('0x2d')]);_0x5486d7[_0xc300('0x30')]=_[_0xc300('0x31')](_0x38e23d[_0xc300('0x2f')],qs[_0xc300('0x32')](_0x5059bf[_0xc300('0x2d')][_0xc300('0x32')]));_0x5486d7[_0xc300('0x30')]=_0x5486d7['attributes']['length']?_0x5486d7[_0xc300('0x30')]:_0x38e23d['model'];if(_0x5059bf[_0xc300('0x2d')][_0xc300('0x3d')]){_0x5486d7[_0xc300('0x3e')]=[{'all':!![]}];}_0x5486d7=_[_0xc300('0x3b')]({},_0x5486d7,_0x5059bf[_0xc300('0x3c')]);return db[_0xc300('0x27')][_0xc300('0x43')](_0x5486d7)['then'](handleEntityNotFound(_0x278497,null))[_0xc300('0x21')](respondWithResult(_0x278497,null))[_0xc300('0x41')](handleError(_0x278497,null));};exports['create']=function(_0x5c5d3b,_0x4ab839){return db['UserProfileSection'][_0xc300('0x44')](_0x5c5d3b['body'],{})[_0xc300('0x21')](respondWithResult(_0x4ab839,0xc9))[_0xc300('0x41')](handleError(_0x4ab839,null));};exports[_0xc300('0x45')]=function(_0x524ed6,_0x4d8621){if(_0x524ed6[_0xc300('0x46')]['id']){delete _0x524ed6[_0xc300('0x46')]['id'];}return db[_0xc300('0x27')]['find']({'where':{'id':_0x524ed6[_0xc300('0x47')]['id']}})[_0xc300('0x21')](handleEntityNotFound(_0x4d8621,null))[_0xc300('0x21')](saveUpdates(_0x524ed6[_0xc300('0x46')],null))['then'](respondWithResult(_0x4d8621,null))[_0xc300('0x41')](handleError(_0x4d8621,null));};exports['destroy']=function(_0x184ad2,_0x5c7b86){return db[_0xc300('0x27')][_0xc300('0x43')]({'where':{'id':_0x184ad2[_0xc300('0x47')]['id']}})[_0xc300('0x21')](handleEntityNotFound(_0x5c7b86,null))[_0xc300('0x21')](removeEntity(_0x5c7b86,null))[_0xc300('0x41')](handleError(_0x5c7b86,null));};exports['describe']=function(_0x3ee9cd,_0x102f8d){return db['UserProfileSection']['describe']()[_0xc300('0x21')](respondWithResult(_0x102f8d,null))[_0xc300('0x41')](handleError(_0x102f8d,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index f78b485..47a0e48 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 _0x1f57=['moment','bluebird','path','rimraf','../../config/environment','./userProfileSection.attributes','exports','UserProfileSection','user_profile_has_sections','compositeIndex','userProfileId','lodash','util','../../config/logger'];(function(_0xa37354,_0x2561c9){var _0x4f1396=function(_0x2bb57b){while(--_0x2bb57b){_0xa37354['push'](_0xa37354['shift']());}};_0x4f1396(++_0x2561c9);}(_0x1f57,0x131));var _0x71f5=function(_0x1d6272,_0x544701){_0x1d6272=_0x1d6272-0x0;var _0x1d352c=_0x1f57[_0x1d6272];return _0x1d352c;};'use strict';var _=require(_0x71f5('0x0'));var util=require(_0x71f5('0x1'));var logger=require(_0x71f5('0x2'))('api');var moment=require(_0x71f5('0x3'));var BPromise=require(_0x71f5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x71f5('0x5'));var rimraf=require(_0x71f5('0x6'));var config=require(_0x71f5('0x7'));var attributes=require(_0x71f5('0x8'));module[_0x71f5('0x9')]=function(_0x243d80,_0x20575f){return _0x243d80['define'](_0x71f5('0xa'),attributes,{'tableName':_0x71f5('0xb'),'paranoid':![],'indexes':[{'name':_0x71f5('0xc'),'fields':['sectionId',_0x71f5('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcecd=['api','moment','bluebird','request-promise','path','rimraf','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','util','../../config/logger'];(function(_0x3c76f3,_0x1b03f7){var _0xe128c4=function(_0x180e71){while(--_0x180e71){_0x3c76f3['push'](_0x3c76f3['shift']());}};_0xe128c4(++_0x1b03f7);}(_0xcecd,0x162));var _0xdcec=function(_0x384b60,_0x3cf70e){_0x384b60=_0x384b60-0x0;var _0x3151d3=_0xcecd[_0x384b60];return _0x3151d3;};'use strict';var _=require(_0xdcec('0x0'));var util=require(_0xdcec('0x1'));var logger=require(_0xdcec('0x2'))(_0xdcec('0x3'));var moment=require(_0xdcec('0x4'));var BPromise=require(_0xdcec('0x5'));var rp=require(_0xdcec('0x6'));var fs=require('fs');var path=require(_0xdcec('0x7'));var rimraf=require(_0xdcec('0x8'));var config=require('../../config/environment');var attributes=require(_0xdcec('0x9'));module[_0xdcec('0xa')]=function(_0x388dcf,_0x5d4370){return _0x388dcf[_0xdcec('0xb')](_0xdcec('0xc'),attributes,{'tableName':_0xdcec('0xd'),'paranoid':![],'indexes':[{'name':_0xdcec('0xe'),'fields':[_0xdcec('0xf'),_0xdcec('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index f127e07..56d5f9a 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 _0x446e=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','UserProfileSection,\x20%s,\x20%s','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x1558ab,_0x39d1de){var _0x53b64a=function(_0x4771ed){while(--_0x4771ed){_0x1558ab['push'](_0x1558ab['shift']());}};_0x53b64a(++_0x39d1de);}(_0x446e,0x1f0));var _0xe446=function(_0x56935e,_0x5051a1){_0x56935e=_0x56935e-0x0;var _0x4c25d2=_0x446e[_0x56935e];return _0x4c25d2;};'use strict';var _=require(_0xe446('0x0'));var util=require(_0xe446('0x1'));var moment=require('moment');var BPromise=require(_0xe446('0x2'));var rs=require(_0xe446('0x3'));var fs=require('fs');var Redis=require(_0xe446('0x4'));var db=require(_0xe446('0x5'))['db'];var utils=require(_0xe446('0x6'));var logger=require(_0xe446('0x7'))(_0xe446('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xe446('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5db313,_0x2b73dc,_0x18ca2a){return new BPromise(function(_0x37455e,_0x1dad4a){return client[_0xe446('0xa')](_0x5db313,_0x18ca2a)['then'](function(_0x435e49){logger['info'](_0xe446('0xb'),_0x2b73dc,_0xe446('0xc'));logger['debug'](_0xe446('0xd'),_0x2b73dc,'request\x20sent',JSON[_0xe446('0xe')](_0x435e49));if(_0x435e49[_0xe446('0xf')]){if(_0x435e49['error']['code']===0x1f4){logger[_0xe446('0xf')]('UserProfileSection,\x20%s,\x20%s',_0x2b73dc,_0x435e49[_0xe446('0xf')]['message']);return _0x1dad4a(_0x435e49[_0xe446('0xf')][_0xe446('0x10')]);}logger[_0xe446('0xf')](_0xe446('0xb'),_0x2b73dc,_0x435e49[_0xe446('0xf')]['message']);return _0x37455e(_0x435e49[_0xe446('0xf')][_0xe446('0x10')]);}else{logger['info'](_0xe446('0xb'),_0x2b73dc,'request\x20sent');_0x37455e(_0x435e49[_0xe446('0x11')][_0xe446('0x10')]);}})[_0xe446('0x12')](function(_0x213f36){logger[_0xe446('0xf')](_0xe446('0xb'),_0x2b73dc,_0x213f36);_0x1dad4a(_0x213f36);});});} \ No newline at end of file +var _0x8911=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','moment'];(function(_0x1cfde4,_0xc75838){var _0x5be77f=function(_0x27d04d){while(--_0x27d04d){_0x1cfde4['push'](_0x1cfde4['shift']());}};_0x5be77f(++_0xc75838);}(_0x8911,0x1de));var _0x1891=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8911[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x1891('0x0'));var moment=require(_0x1891('0x1'));var BPromise=require(_0x1891('0x2'));var rs=require(_0x1891('0x3'));var fs=require('fs');var Redis=require(_0x1891('0x4'));var db=require(_0x1891('0x5'))['db'];var utils=require(_0x1891('0x6'));var logger=require(_0x1891('0x7'))(_0x1891('0x8'));var config=require(_0x1891('0x9'));var jayson=require(_0x1891('0xa'));var client=jayson[_0x1891('0xb')][_0x1891('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x531a48,_0x4baba8,_0x44abc4){return new BPromise(function(_0x595f0e,_0x3f2b15){return client[_0x1891('0xd')](_0x531a48,_0x44abc4)[_0x1891('0xe')](function(_0x277665){logger['info'](_0x1891('0xf'),_0x4baba8,_0x1891('0x10'));logger[_0x1891('0x11')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x4baba8,_0x1891('0x10'),JSON[_0x1891('0x12')](_0x277665));if(_0x277665[_0x1891('0x13')]){if(_0x277665[_0x1891('0x13')][_0x1891('0x14')]===0x1f4){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x4baba8,_0x277665[_0x1891('0x13')][_0x1891('0x15')]);return _0x3f2b15(_0x277665[_0x1891('0x13')]['message']);}logger[_0x1891('0x13')](_0x1891('0xf'),_0x4baba8,_0x277665['error'][_0x1891('0x15')]);return _0x595f0e(_0x277665[_0x1891('0x13')][_0x1891('0x15')]);}else{logger['info'](_0x1891('0xf'),_0x4baba8,'request\x20sent');_0x595f0e(_0x277665[_0x1891('0x16')][_0x1891('0x15')]);}})[_0x1891('0x17')](function(_0x1f34a2){logger['error'](_0x1891('0xf'),_0x4baba8,_0x1f34a2);_0x3f2b15(_0x1f34a2);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 578906a..b905344 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x41c445,_0x3c8bd0){var _0x607bb6=function(_0x742ae4){while(--_0x742ae4){_0x41c445['push'](_0x41c445['shift']());}};_0x607bb6(++_0x3c8bd0);}(_0x70e0,0x17b));var _0x070e=function(_0x5b3530,_0x551156){_0x5b3530=_0x5b3530-0x0;var _0x2dcbfe=_0x70e0[_0x5b3530];return _0x2dcbfe;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x1145a7,_0x28c9ae){var _0x1f4fe0=function(_0x257eee){while(--_0x257eee){_0x1145a7['push'](_0x1145a7['shift']());}};_0x1f4fe0(++_0x28c9ae);}(_0x70e0,0x17b));var _0x070e=function(_0x5e667a,_0x22d0e0){_0x5e667a=_0x5e667a-0x0;var _0x1c972e=_0x70e0[_0x5e667a];return _0x1c972e;};'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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 9006424..f10226a 100644 --- a/server/api/userSmsQueue/userSmsQueue.attributes.js +++ b/server/api/userSmsQueue/userSmsQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x9fdc=['sequelize','exports'];(function(_0x4773dc,_0x1737fb){var _0x5792d7=function(_0x486674){while(--_0x486674){_0x4773dc['push'](_0x4773dc['shift']());}};_0x5792d7(++_0x1737fb);}(_0x9fdc,0x18e));var _0xc9fd=function(_0x4cce65,_0x40021e){_0x4cce65=_0x4cce65-0x0;var _0x4d1b45=_0x9fdc[_0x4cce65];return _0x4d1b45;};'use strict';var Sequelize=require(_0xc9fd('0x0'));module[_0xc9fd('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 64ffffe..5f3b10c 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 _0x444e=['moment','request-promise','rimraf','../../config/environment','./userSmsQueue.attributes','exports','UserSmsQueue','lodash','../../config/logger'];(function(_0xa14d8c,_0x14759b){var _0x3facda=function(_0x13c866){while(--_0x13c866){_0xa14d8c['push'](_0xa14d8c['shift']());}};_0x3facda(++_0x14759b);}(_0x444e,0xe8));var _0xe444=function(_0x4cc8f4,_0x4ecf9b){_0x4cc8f4=_0x4cc8f4-0x0;var _0x232089=_0x444e[_0x4cc8f4];return _0x232089;};'use strict';var _=require(_0xe444('0x0'));var util=require('util');var logger=require(_0xe444('0x1'))('api');var moment=require(_0xe444('0x2'));var BPromise=require('bluebird');var rp=require(_0xe444('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe444('0x4'));var config=require(_0xe444('0x5'));var attributes=require(_0xe444('0x6'));module[_0xe444('0x7')]=function(_0x36ac3b,_0x1ddb27){return _0x36ac3b['define'](_0xe444('0x8'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xce68=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./userSmsQueue.attributes','user_has_sms_queues','lodash','../../config/logger'];(function(_0x589ae0,_0x153ea6){var _0x9670f5=function(_0xc3ac53){while(--_0xc3ac53){_0x589ae0['push'](_0x589ae0['shift']());}};_0x9670f5(++_0x153ea6);}(_0xce68,0x10c));var _0x8ce6=function(_0x487b52,_0x1c8fd2){_0x487b52=_0x487b52-0x0;var _0x570c0f=_0xce68[_0x487b52];return _0x570c0f;};'use strict';var _=require(_0x8ce6('0x0'));var util=require('util');var logger=require(_0x8ce6('0x1'))(_0x8ce6('0x2'));var moment=require(_0x8ce6('0x3'));var BPromise=require(_0x8ce6('0x4'));var rp=require(_0x8ce6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8ce6('0x6'));var config=require(_0x8ce6('0x7'));var attributes=require(_0x8ce6('0x8'));module['exports']=function(_0x116e0a,_0x10b3ca){return _0x116e0a['define']('UserSmsQueue',attributes,{'tableName':_0x8ce6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index dd793d3..85de3d6 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 _0x8894=['../../config/environment','jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x1ccbcc,_0x5c948b){var _0x1e873f=function(_0x4f232e){while(--_0x4f232e){_0x1ccbcc['push'](_0x1ccbcc['shift']());}};_0x1e873f(++_0x5c948b);}(_0x8894,0x17f));var _0x4889=function(_0x23e20b,_0xce166d){_0x23e20b=_0x23e20b-0x0;var _0x2c58ed=_0x8894[_0x23e20b];return _0x2c58ed;};'use strict';var _=require(_0x4889('0x0'));var util=require(_0x4889('0x1'));var moment=require('moment');var BPromise=require(_0x4889('0x2'));var rs=require(_0x4889('0x3'));var fs=require('fs');var Redis=require(_0x4889('0x4'));var db=require(_0x4889('0x5'))['db'];var utils=require(_0x4889('0x6'));var logger=require('../../config/logger')(_0x4889('0x7'));var config=require(_0x4889('0x8'));var jayson=require(_0x4889('0x9'));var client=jayson[_0x4889('0xa')][_0x4889('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x34c08b,_0x25f55c,_0x4097fe){return new BPromise(function(_0x1c0664,_0x18246d){return client[_0x4889('0xc')](_0x34c08b,_0x4097fe)[_0x4889('0xd')](function(_0x3c6efd){logger[_0x4889('0xe')](_0x4889('0xf'),_0x25f55c,_0x4889('0x10'));logger[_0x4889('0x11')](_0x4889('0x12'),_0x25f55c,_0x4889('0x10'),JSON['stringify'](_0x3c6efd));if(_0x3c6efd[_0x4889('0x13')]){if(_0x3c6efd[_0x4889('0x13')]['code']===0x1f4){logger[_0x4889('0x13')](_0x4889('0xf'),_0x25f55c,_0x3c6efd[_0x4889('0x13')][_0x4889('0x14')]);return _0x18246d(_0x3c6efd[_0x4889('0x13')]['message']);}logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x25f55c,_0x3c6efd[_0x4889('0x13')][_0x4889('0x14')]);return _0x1c0664(_0x3c6efd[_0x4889('0x13')][_0x4889('0x14')]);}else{logger[_0x4889('0xe')](_0x4889('0xf'),_0x25f55c,_0x4889('0x10'));_0x1c0664(_0x3c6efd[_0x4889('0x15')][_0x4889('0x14')]);}})[_0x4889('0x16')](function(_0x2621dc){logger['error'](_0x4889('0xf'),_0x25f55c,_0x2621dc);_0x18246d(_0x2621dc);});});} \ No newline at end of file +var _0xd680=['http','request','info','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','error','code','UserSmsQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x16570a,_0x4047b1){var _0x160d4f=function(_0x2b50ea){while(--_0x2b50ea){_0x16570a['push'](_0x16570a['shift']());}};_0x160d4f(++_0x4047b1);}(_0xd680,0x7a));var _0x0d68=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd680[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0d68('0x0'));var util=require(_0x0d68('0x1'));var moment=require(_0x0d68('0x2'));var BPromise=require(_0x0d68('0x3'));var rs=require(_0x0d68('0x4'));var fs=require('fs');var Redis=require(_0x0d68('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0d68('0x6'));var logger=require(_0x0d68('0x7'))('rpc');var config=require(_0x0d68('0x8'));var jayson=require(_0x0d68('0x9'));var client=jayson['client'][_0x0d68('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x399fb9,_0x13ddac,_0x91eff9){return new BPromise(function(_0x35efd8,_0x471809){return client[_0x0d68('0xb')](_0x399fb9,_0x91eff9)['then'](function(_0x4aef0c){logger[_0x0d68('0xc')]('UserSmsQueue,\x20%s,\x20%s',_0x13ddac,_0x0d68('0xd'));logger[_0x0d68('0xe')](_0x0d68('0xf'),_0x13ddac,_0x0d68('0xd'),JSON['stringify'](_0x4aef0c));if(_0x4aef0c['error']){if(_0x4aef0c[_0x0d68('0x10')][_0x0d68('0x11')]===0x1f4){logger[_0x0d68('0x10')](_0x0d68('0x12'),_0x13ddac,_0x4aef0c[_0x0d68('0x10')][_0x0d68('0x13')]);return _0x471809(_0x4aef0c[_0x0d68('0x10')][_0x0d68('0x13')]);}logger[_0x0d68('0x10')](_0x0d68('0x12'),_0x13ddac,_0x4aef0c[_0x0d68('0x10')][_0x0d68('0x13')]);return _0x35efd8(_0x4aef0c['error'][_0x0d68('0x13')]);}else{logger['info'](_0x0d68('0x12'),_0x13ddac,_0x0d68('0xd'));_0x35efd8(_0x4aef0c[_0x0d68('0x14')][_0x0d68('0x13')]);}})[_0x0d68('0x15')](function(_0x1fb7d5){logger[_0x0d68('0x10')]('UserSmsQueue,\x20%s,\x20%s',_0x13ddac,_0x1fb7d5);_0x471809(_0x1fb7d5);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 6b552a9..83c2e37 100644 --- a/server/api/userVoiceQueue/index.js +++ b/server/api/userVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x98437e,_0xb36d0f){var _0x1c044c=function(_0x814fa4){while(--_0x814fa4){_0x98437e['push'](_0x98437e['shift']());}};_0x1c044c(++_0xb36d0f);}(_0xe706,0xa3));var _0x6e70=function(_0x32f845,_0x335cb9){_0x32f845=_0x32f845-0x0;var _0x3c0de4=_0xe706[_0x32f845];return _0x3c0de4;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0xe23de1,_0x2cd4b9){var _0x59d143=function(_0x5039b8){while(--_0x5039b8){_0xe23de1['push'](_0xe23de1['shift']());}};_0x59d143(++_0x2cd4b9);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 489fed9..1ee195b 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 _0x7ca3=['INTEGER'];(function(_0x3d9176,_0x399d6f){var _0x12adc5=function(_0x700b01){while(--_0x700b01){_0x3d9176['push'](_0x3d9176['shift']());}};_0x12adc5(++_0x399d6f);}(_0x7ca3,0xa3));var _0x37ca=function(_0x3d6db1,_0x4358f8){_0x3d6db1=_0x3d6db1-0x0;var _0x5e1cc3=_0x7ca3[_0x3d6db1];return _0x5e1cc3;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x37ca('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf1c6=['INTEGER'];(function(_0xf8f609,_0x104929){var _0xeb9b60=function(_0x5b1d3d){while(--_0x5b1d3d){_0xf8f609['push'](_0xf8f609['shift']());}};_0xeb9b60(++_0x104929);}(_0xf1c6,0x145));var _0x6f1c=function(_0x2d6e69,_0x1932da){_0x2d6e69=_0x2d6e69-0x0;var _0xc3c3c0=_0xf1c6[_0x2d6e69];return _0xc3c3c0;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x6f1c('0x0')],'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 c076420..f9293c2 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 _0x4542=['define','UserVoiceQueue','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports'];(function(_0x7afdbb,_0x151626){var _0x307cb8=function(_0x42c612){while(--_0x42c612){_0x7afdbb['push'](_0x7afdbb['shift']());}};_0x307cb8(++_0x151626);}(_0x4542,0x1f0));var _0x2454=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4542[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x2454('0x0'));var util=require(_0x2454('0x1'));var logger=require(_0x2454('0x2'))('api');var moment=require(_0x2454('0x3'));var BPromise=require(_0x2454('0x4'));var rp=require(_0x2454('0x5'));var fs=require('fs');var path=require(_0x2454('0x6'));var rimraf=require(_0x2454('0x7'));var config=require(_0x2454('0x8'));var attributes=require(_0x2454('0x9'));module[_0x2454('0xa')]=function(_0x554c0b,_0x49d22c){return _0x554c0b[_0x2454('0xb')](_0x2454('0xc'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf9af=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','UserVoiceQueue'];(function(_0x348089,_0x165ed7){var _0x34762d=function(_0x5a2073){while(--_0x5a2073){_0x348089['push'](_0x348089['shift']());}};_0x34762d(++_0x165ed7);}(_0xf9af,0x1c2));var _0xff9a=function(_0x5ba334,_0x53ce07){_0x5ba334=_0x5ba334-0x0;var _0x2b4aab=_0xf9af[_0x5ba334];return _0x2b4aab;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xff9a('0x0'))(_0xff9a('0x1'));var moment=require(_0xff9a('0x2'));var BPromise=require(_0xff9a('0x3'));var rp=require(_0xff9a('0x4'));var fs=require('fs');var path=require(_0xff9a('0x5'));var rimraf=require(_0xff9a('0x6'));var config=require('../../config/environment');var attributes=require('./userVoiceQueue.attributes');module[_0xff9a('0x7')]=function(_0x3e2e59,_0x3a7357){return _0x3e2e59[_0xff9a('0x8')](_0xff9a('0x9'),attributes,{'tableName':'user_has_voice_queues','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 e54cbb0..22b7367 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 _0x6481=['request','info','UserVoiceQueue,\x20%s,\x20%s','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x35b195,_0x8893d5){var _0x2433bf=function(_0x22be07){while(--_0x22be07){_0x35b195['push'](_0x35b195['shift']());}};_0x2433bf(++_0x8893d5);}(_0x6481,0x1c2));var _0x1648=function(_0x3a3125,_0x352202){_0x3a3125=_0x3a3125-0x0;var _0x2bb9e9=_0x6481[_0x3a3125];return _0x2bb9e9;};'use strict';var _=require(_0x1648('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1648('0x1'));var rs=require(_0x1648('0x2'));var fs=require('fs');var Redis=require(_0x1648('0x3'));var db=require(_0x1648('0x4'))['db'];var utils=require(_0x1648('0x5'));var logger=require(_0x1648('0x6'))(_0x1648('0x7'));var config=require(_0x1648('0x8'));var jayson=require(_0x1648('0x9'));var client=jayson[_0x1648('0xa')][_0x1648('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x7ebc4d,_0x134d2c,_0x1c6ae5){return new BPromise(function(_0x30d33a,_0x487836){return client[_0x1648('0xc')](_0x7ebc4d,_0x1c6ae5)['then'](function(_0x5d87cb){logger[_0x1648('0xd')](_0x1648('0xe'),_0x134d2c,'request\x20sent');logger[_0x1648('0xf')](_0x1648('0x10'),_0x134d2c,_0x1648('0x11'),JSON['stringify'](_0x5d87cb));if(_0x5d87cb[_0x1648('0x12')]){if(_0x5d87cb[_0x1648('0x12')]['code']===0x1f4){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x134d2c,_0x5d87cb[_0x1648('0x12')]['message']);return _0x487836(_0x5d87cb[_0x1648('0x12')]['message']);}logger['error'](_0x1648('0xe'),_0x134d2c,_0x5d87cb[_0x1648('0x12')][_0x1648('0x13')]);return _0x30d33a(_0x5d87cb['error'][_0x1648('0x13')]);}else{logger[_0x1648('0xd')]('UserVoiceQueue,\x20%s,\x20%s',_0x134d2c,_0x1648('0x11'));_0x30d33a(_0x5d87cb[_0x1648('0x14')]['message']);}})['catch'](function(_0x5a4b80){logger['error'](_0x1648('0xe'),_0x134d2c,_0x5a4b80);_0x487836(_0x5a4b80);});});} \ No newline at end of file +var _0x41c8=['request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserVoiceQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x3e9903,_0x3ec512){var _0xcab758=function(_0x4277dc){while(--_0x4277dc){_0x3e9903['push'](_0x3e9903['shift']());}};_0xcab758(++_0x3ec512);}(_0x41c8,0xd8));var _0x841c=function(_0x3f0d15,_0x487214){_0x3f0d15=_0x3f0d15-0x0;var _0x46f2f=_0x41c8[_0x3f0d15];return _0x46f2f;};'use strict';var _=require(_0x841c('0x0'));var util=require(_0x841c('0x1'));var moment=require(_0x841c('0x2'));var BPromise=require('bluebird');var rs=require(_0x841c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x841c('0x4'))['db'];var utils=require(_0x841c('0x5'));var logger=require(_0x841c('0x6'))(_0x841c('0x7'));var config=require(_0x841c('0x8'));var jayson=require(_0x841c('0x9'));var client=jayson[_0x841c('0xa')][_0x841c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x31547f,_0x339aba,_0x5731cf){return new BPromise(function(_0x31ce9c,_0x159bd5){return client['request'](_0x31547f,_0x5731cf)[_0x841c('0xc')](function(_0x5cb707){logger[_0x841c('0xd')]('UserVoiceQueue,\x20%s,\x20%s',_0x339aba,_0x841c('0xe'));logger[_0x841c('0xf')](_0x841c('0x10'),_0x339aba,_0x841c('0xe'),JSON[_0x841c('0x11')](_0x5cb707));if(_0x5cb707['error']){if(_0x5cb707[_0x841c('0x12')]['code']===0x1f4){logger['error'](_0x841c('0x13'),_0x339aba,_0x5cb707['error'][_0x841c('0x14')]);return _0x159bd5(_0x5cb707['error'][_0x841c('0x14')]);}logger['error'](_0x841c('0x13'),_0x339aba,_0x5cb707[_0x841c('0x12')][_0x841c('0x14')]);return _0x31ce9c(_0x5cb707['error'][_0x841c('0x14')]);}else{logger[_0x841c('0xd')](_0x841c('0x13'),_0x339aba,'request\x20sent');_0x31ce9c(_0x5cb707[_0x841c('0x15')][_0x841c('0x14')]);}})[_0x841c('0x16')](function(_0x4717ae){logger[_0x841c('0x12')](_0x841c('0x13'),_0x339aba,_0x4717ae);_0x159bd5(_0x4717ae);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 1ea27f9..3f01fbd 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0xf868ee,_0x15368a){var _0x4d3c3d=function(_0x28c44c){while(--_0x28c44c){_0xf868ee['push'](_0xf868ee['shift']());}};_0x4d3c3d(++_0x15368a);}(_0xe706,0xa3));var _0x6e70=function(_0x41f02b,_0x2ca2f0){_0x41f02b=_0x41f02b-0x0;var _0x3411eb=_0xe706[_0x41f02b];return _0x3411eb;};'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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x2df0a4,_0x2613ba){var _0x4b3409=function(_0x1c067d){while(--_0x1c067d){_0x2df0a4['push'](_0x2df0a4['shift']());}};_0x4b3409(++_0x2613ba);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 8113fc3..cd4afae 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 _0xf34f=['Required\x20by\x20Asterisk','STRING','queue_interface','sequelize','INTEGER'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xf34f,0x16b));var _0xff34=function(_0x452e70,_0x1c452f){_0x452e70=_0x452e70-0x0;var _0x1ef15c=_0xf34f[_0x452e70];return _0x1ef15c;};'use strict';var Sequelize=require(_0xff34('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xff34('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xff34('0x2')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0xff34('0x2')},'UserId':{'type':Sequelize[_0xff34('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xff34('0x3')],'allowNull':![],'unique':_0xff34('0x4'),'comment':_0xff34('0x2')},'VoiceQueueId':{'type':Sequelize[_0xff34('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0xff34('0x3')],'allowNull':![],'unique':_0xff34('0x4'),'comment':_0xff34('0x2')},'penalty':{'type':Sequelize[_0xff34('0x1')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0x5228=['sequelize','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface'];(function(_0x546539,_0x44e2b2){var _0x3b2235=function(_0x30f397){while(--_0x30f397){_0x546539['push'](_0x546539['shift']());}};_0x3b2235(++_0x44e2b2);}(_0x5228,0x10e));var _0x8522=function(_0x343238,_0x47c650){_0x343238=_0x343238-0x0;var _0x494ade=_0x5228[_0x343238];return _0x494ade;};'use strict';var Sequelize=require(_0x8522('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x8522('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x8522('0x2')},'membername':{'type':Sequelize[_0x8522('0x3')],'allowNull':![],'comment':_0x8522('0x2')},'UserId':{'type':Sequelize[_0x8522('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x8522('0x3')],'allowNull':![],'unique':_0x8522('0x4'),'comment':_0x8522('0x2')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0x8522('0x3')],'allowNull':![],'unique':_0x8522('0x4'),'comment':_0x8522('0x2')},'penalty':{'type':Sequelize[_0x8522('0x1')](0xb),'defaultValue':0x0,'comment':_0x8522('0x2')},'paused':{'type':Sequelize[_0x8522('0x1')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index c8e6276..fb8a112 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 _0x435c=['exports','../../mysqldb','setMaxListeners','update','remove','hasOwnProperty','hook'];(function(_0x1ac3cf,_0x2fedab){var _0x411de8=function(_0x33ebf7){while(--_0x33ebf7){_0x1ac3cf['push'](_0x1ac3cf['shift']());}};_0x411de8(++_0x2fedab);}(_0x435c,0x8d));var _0xc435=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x435c[_0x19e35c];return _0x3e1fe8;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0xc435('0x0'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xc435('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc435('0x2'),'afterDestroy':_0xc435('0x3')};function emitEvent(_0x5b2984){return function(_0x5b5c2c,_0x5020db,_0x59a915){UserVoiceQueueRtEvents['emit'](_0x5b2984+':'+_0x5b5c2c['id'],_0x5b5c2c);UserVoiceQueueRtEvents['emit'](_0x5b2984,_0x5b5c2c);_0x59a915(null);};}for(var e in events){if(events[_0xc435('0x4')](e)){var event=events[e];UserVoiceQueueRt[_0xc435('0x5')](e,emitEvent(event));}}module[_0xc435('0x6')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xf23c=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update','remove'];(function(_0x28feae,_0x1c6091){var _0x3e861d=function(_0x15b6e9){while(--_0x15b6e9){_0x28feae['push'](_0x28feae['shift']());}};_0x3e861d(++_0x1c6091);}(_0xf23c,0xe0));var _0xcf23=function(_0x534c8f,_0x500079){_0x534c8f=_0x534c8f-0x0;var _0x5a57f5=_0xf23c[_0x534c8f];return _0x5a57f5;};'use strict';var EventEmitter=require(_0xcf23('0x0'));var UserVoiceQueueRt=require(_0xcf23('0x1'))['db'][_0xcf23('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xcf23('0x3')](0x0);var events={'afterCreate':_0xcf23('0x4'),'afterUpdate':_0xcf23('0x5'),'afterDestroy':_0xcf23('0x6')};function emitEvent(_0x3b3bec){return function(_0x9a83a9,_0x25d275,_0x527c2a){UserVoiceQueueRtEvents[_0xcf23('0x7')](_0x3b3bec+':'+_0x9a83a9['id'],_0x9a83a9);UserVoiceQueueRtEvents[_0xcf23('0x7')](_0x3b3bec,_0x9a83a9);_0x527c2a(null);};}for(var e in events){if(events[_0xcf23('0x8')](e)){var event=events[e];UserVoiceQueueRt[_0xcf23('0x9')](e,emitEvent(event));}}module[_0xcf23('0xa')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index d323460..f8f1020 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 _0x7a4e=['util','../../config/logger','moment','bluebird','request-promise','../../config/environment','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x7a4e,0x8c));var _0xe7a4=function(_0x2ab76b,_0x176579){_0x2ab76b=_0x2ab76b-0x0;var _0x201126=_0x7a4e[_0x2ab76b];return _0x201126;};'use strict';var _=require('lodash');var util=require(_0xe7a4('0x0'));var logger=require(_0xe7a4('0x1'))('api');var moment=require(_0xe7a4('0x2'));var BPromise=require(_0xe7a4('0x3'));var rp=require(_0xe7a4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe7a4('0x5'));var attributes=require('./userVoiceQueueRt.attributes');module[_0xe7a4('0x6')]=function(_0xf46b59,_0x5062ec){return _0xf46b59[_0xe7a4('0x7')](_0xe7a4('0x8'),attributes,{'tableName':_0xe7a4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdd56=['bluebird','request-promise','./userVoiceQueueRt.attributes','define','UserVoiceQueueRt','user_has_voice_queues_rt','util','../../config/logger','api'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0xdd56,0x7b));var _0x6dd5=function(_0x412de8,_0x1e0ba5){_0x412de8=_0x412de8-0x0;var _0x4ba645=_0xdd56[_0x412de8];return _0x4ba645;};'use strict';var _=require('lodash');var util=require(_0x6dd5('0x0'));var logger=require(_0x6dd5('0x1'))(_0x6dd5('0x2'));var moment=require('moment');var BPromise=require(_0x6dd5('0x3'));var rp=require(_0x6dd5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6dd5('0x5'));module['exports']=function(_0x44663d,_0x2f631c){return _0x44663d[_0x6dd5('0x6')](_0x6dd5('0x7'),attributes,{'tableName':_0x6dd5('0x8'),'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 5718bc1..bc042f5 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 _0x20b0=['COUNT','literal','`paused`\x20=\x201,\x201,\x20null','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize'];(function(_0x15bbae,_0x5a2a74){var _0x3b1ee1=function(_0x1b36f8){while(--_0x1b36f8){_0x15bbae['push'](_0x15bbae['shift']());}};_0x3b1ee1(++_0x5a2a74);}(_0x20b0,0x150));var _0x020b=function(_0x3166bc,_0x5739bf){_0x3166bc=_0x3166bc-0x0;var _0x3f6778=_0x20b0[_0x3166bc];return _0x3f6778;};'use strict';var _=require(_0x020b('0x0'));var util=require(_0x020b('0x1'));var moment=require(_0x020b('0x2'));var BPromise=require(_0x020b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x020b('0x4'));var db=require(_0x020b('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x020b('0x6'));var config=require(_0x020b('0x7'));var jayson=require(_0x020b('0x8'));var client=jayson[_0x020b('0x9')][_0x020b('0xa')]({'port':0x232a});config[_0x020b('0xb')]=_['defaults'](config[_0x020b('0xb')],{'host':_0x020b('0xc'),'port':0x18eb});var socket=require(_0x020b('0xd'))(new Redis(config[_0x020b('0xb')]));require(_0x020b('0xe'))[_0x020b('0xf')](socket);function respondWithRpcPromise(_0x2040db,_0x36a274,_0x510fd8){return new BPromise(function(_0xc7ed3b,_0x579b14){return client[_0x020b('0x10')](_0x2040db,_0x510fd8)[_0x020b('0x11')](function(_0x52190e){logger[_0x020b('0x12')](_0x020b('0x13'),_0x36a274,_0x020b('0x14'));logger[_0x020b('0x15')](_0x020b('0x16'),_0x36a274,_0x020b('0x14'),JSON[_0x020b('0x17')](_0x52190e));if(_0x52190e['error']){if(_0x52190e['error']['code']===0x1f4){logger[_0x020b('0x18')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x36a274,_0x52190e['error'][_0x020b('0x19')]);return _0x579b14(_0x52190e[_0x020b('0x18')]['message']);}logger[_0x020b('0x18')](_0x020b('0x13'),_0x36a274,_0x52190e[_0x020b('0x18')][_0x020b('0x19')]);return _0xc7ed3b(_0x52190e['error']['message']);}else{logger[_0x020b('0x12')](_0x020b('0x13'),_0x36a274,'request\x20sent');_0xc7ed3b(_0x52190e[_0x020b('0x1a')][_0x020b('0x19')]);}})['catch'](function(_0x15b68b){logger[_0x020b('0x18')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x36a274,_0x15b68b);_0x579b14(_0x15b68b);});});}exports[_0x020b('0x1b')]=function(_0x1054a9){var _0x3abddf=this;return new Promise(function(_0x26f28a,_0x14d6c1){return db[_0x020b('0x1c')][_0x020b('0x1d')]({'raw':_0x1054a9[_0x020b('0x1e')]?_0x1054a9['options'][_0x020b('0x1f')]===undefined?!![]:![]:!![],'where':_0x1054a9[_0x020b('0x1e')]?_0x1054a9[_0x020b('0x1e')][_0x020b('0x20')]||null:null,'attributes':[[db[_0x020b('0x21')]['fn'](_0x020b('0x22'),db[_0x020b('0x21')]['fn']('IF',db[_0x020b('0x21')][_0x020b('0x23')](_0x020b('0x24')))),'outboundQueuePauses']]})[_0x020b('0x11')](function(_0x3bb5d5){logger[_0x020b('0x12')]('GetVoiceQueueRtPauses',_0x1054a9);logger['debug'](_0x020b('0x1b'),_0x1054a9,JSON[_0x020b('0x17')](_0x3bb5d5));_0x26f28a(_0x3bb5d5);})['catch'](function(_0x1284fc){logger['error'](_0x020b('0x1b'),_0x1284fc[_0x020b('0x19')],_0x1054a9);_0x14d6c1(_0x3abddf[_0x020b('0x18')](0x1f4,_0x1284fc[_0x020b('0x19')]));});});}; \ No newline at end of file +var _0x1841=['catch','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','http','defaults','redis','./userVoiceQueueRt.socket','register','then','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','info','result','GetVoiceQueueRtPauses','UserVoiceQueueRt','raw','options','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses'];(function(_0x219ee4,_0x71b6f5){var _0x4d99b3=function(_0x1dec9d){while(--_0x1dec9d){_0x219ee4['push'](_0x219ee4['shift']());}};_0x4d99b3(++_0x71b6f5);}(_0x1841,0x119));var _0x1184=function(_0x36a48e,_0x2b202e){_0x36a48e=_0x36a48e-0x0;var _0x461012=_0x1841[_0x36a48e];return _0x461012;};'use strict';var _=require(_0x1184('0x0'));var util=require(_0x1184('0x1'));var moment=require(_0x1184('0x2'));var BPromise=require(_0x1184('0x3'));var rs=require(_0x1184('0x4'));var fs=require('fs');var Redis=require(_0x1184('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1184('0x6'));var config=require(_0x1184('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1184('0x8')]({'port':0x232a});config['redis']=_[_0x1184('0x9')](config[_0x1184('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x1184('0xb'))[_0x1184('0xc')](socket);function respondWithRpcPromise(_0x488d70,_0x3ed04e,_0x256c00){return new BPromise(function(_0x2464bd,_0x3e3c63){return client['request'](_0x488d70,_0x256c00)[_0x1184('0xd')](function(_0x11a93e){logger['info']('UserVoiceQueueRt,\x20%s,\x20%s',_0x3ed04e,'request\x20sent');logger[_0x1184('0xe')](_0x1184('0xf'),_0x3ed04e,_0x1184('0x10'),JSON[_0x1184('0x11')](_0x11a93e));if(_0x11a93e[_0x1184('0x12')]){if(_0x11a93e[_0x1184('0x12')][_0x1184('0x13')]===0x1f4){logger[_0x1184('0x12')](_0x1184('0x14'),_0x3ed04e,_0x11a93e[_0x1184('0x12')][_0x1184('0x15')]);return _0x3e3c63(_0x11a93e[_0x1184('0x12')][_0x1184('0x15')]);}logger[_0x1184('0x12')](_0x1184('0x14'),_0x3ed04e,_0x11a93e[_0x1184('0x12')]['message']);return _0x2464bd(_0x11a93e[_0x1184('0x12')][_0x1184('0x15')]);}else{logger[_0x1184('0x16')](_0x1184('0x14'),_0x3ed04e,_0x1184('0x10'));_0x2464bd(_0x11a93e[_0x1184('0x17')][_0x1184('0x15')]);}})['catch'](function(_0x5b9952){logger[_0x1184('0x12')](_0x1184('0x14'),_0x3ed04e,_0x5b9952);_0x3e3c63(_0x5b9952);});});}exports[_0x1184('0x18')]=function(_0x4454b1){var _0x48dfab=this;return new Promise(function(_0x255d9b,_0x4dfb42){return db[_0x1184('0x19')]['findAll']({'raw':_0x4454b1['options']?_0x4454b1['options'][_0x1184('0x1a')]===undefined?!![]:![]:!![],'where':_0x4454b1[_0x1184('0x1b')]?_0x4454b1[_0x1184('0x1b')][_0x1184('0x1c')]||null:null,'attributes':[[db[_0x1184('0x1d')]['fn'](_0x1184('0x1e'),db['sequelize']['fn']('IF',db[_0x1184('0x1d')][_0x1184('0x1f')](_0x1184('0x20')))),_0x1184('0x21')]]})[_0x1184('0xd')](function(_0x21d846){logger[_0x1184('0x16')]('GetVoiceQueueRtPauses',_0x4454b1);logger[_0x1184('0xe')](_0x1184('0x18'),_0x4454b1,JSON[_0x1184('0x11')](_0x21d846));_0x255d9b(_0x21d846);})[_0x1184('0x22')](function(_0x2980f5){logger['error'](_0x1184('0x18'),_0x2980f5['message'],_0x4454b1);_0x4dfb42(_0x48dfab[_0x1184('0x12')](0x1f4,_0x2980f5['message']));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index cfb6c34..b472b52 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 _0x0686=['update','removeListener','register','length','./userVoiceQueueRt.events','save','remove'];(function(_0x32800c,_0x1d8e18){var _0x672d72=function(_0x8de39f){while(--_0x8de39f){_0x32800c['push'](_0x32800c['shift']());}};_0x672d72(++_0x1d8e18);}(_0x0686,0x123));var _0x6068=function(_0x391e8e,_0x210711){_0x391e8e=_0x391e8e-0x0;var _0x22465d=_0x0686[_0x391e8e];return _0x22465d;};'use strict';var UserVoiceQueueRtEvents=require(_0x6068('0x0'));var events=[_0x6068('0x1'),_0x6068('0x2'),_0x6068('0x3')];function createListener(_0x199954,_0x408d70){return function(_0xe6eb70){_0x408d70['emit'](_0x199954,_0xe6eb70);};}function removeListener(_0x22449d,_0x4ccea4){return function(){UserVoiceQueueRtEvents[_0x6068('0x4')](_0x22449d,_0x4ccea4);};}exports[_0x6068('0x5')]=function(_0x2d4dd0){for(var _0x3e5dfd=0x0,_0x37489b=events[_0x6068('0x6')];_0x3e5dfd<_0x37489b;_0x3e5dfd++){var _0x3eb140=events[_0x3e5dfd];var _0x4e0ccf=createListener('userVoiceQueueRt:'+_0x3eb140,_0x2d4dd0);UserVoiceQueueRtEvents['on'](_0x3eb140,_0x4e0ccf);}}; \ No newline at end of file +var _0x044a=['./userVoiceQueueRt.events','save','remove','update','emit','register','userVoiceQueueRt:'];(function(_0x3151a3,_0x391680){var _0x515eda=function(_0x509cf5){while(--_0x509cf5){_0x3151a3['push'](_0x3151a3['shift']());}};_0x515eda(++_0x391680);}(_0x044a,0x173));var _0xa044=function(_0x1f6ea5,_0x5667a8){_0x1f6ea5=_0x1f6ea5-0x0;var _0x3621e4=_0x044a[_0x1f6ea5];return _0x3621e4;};'use strict';var UserVoiceQueueRtEvents=require(_0xa044('0x0'));var events=[_0xa044('0x1'),_0xa044('0x2'),_0xa044('0x3')];function createListener(_0x31c260,_0x17f8c4){return function(_0x1bcad0){_0x17f8c4[_0xa044('0x4')](_0x31c260,_0x1bcad0);};}function removeListener(_0x25ed77,_0x116358){return function(){UserVoiceQueueRtEvents['removeListener'](_0x25ed77,_0x116358);};}exports[_0xa044('0x5')]=function(_0x1103e7){for(var _0x1bdd1b=0x0,_0x1c04bb=events['length'];_0x1bdd1b<_0x1c04bb;_0x1bdd1b++){var _0xe12f7d=events[_0x1bdd1b];var _0x33f556=createListener(_0xa044('0x6')+_0xe12f7d,_0x1103e7);UserVoiceQueueRtEvents['on'](_0xe12f7d,_0x33f556);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 505c4b9..37df380 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x2a2385,_0x483814){var _0x2c75=function(_0x1991da){while(--_0x1991da){_0x2a2385['push'](_0x2a2385['shift']());}};_0x2c75(++_0x483814);}(_0x9c44,0x178));var _0x49c4=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x9c44[_0x53ccf2];return _0x5a2964;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0xf39f8,_0x1cf176){var _0x145df4=function(_0x440c57){while(--_0x440c57){_0xf39f8['push'](_0xf39f8['shift']());}};_0x145df4(++_0x1cf176);}(_0xe706,0xa3));var _0x6e70=function(_0x2a238a,_0x1d5054){_0x2a238a=_0x2a238a-0x0;var _0xeef802=_0xe706[_0x2a238a];return _0xeef802;};'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 41705f4..5a8b718 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 _0x9dc4=['exports','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9dc4,0x1e6));var _0x49dc=function(_0x2be66a,_0x4d9ae1){_0x2be66a=_0x2be66a-0x0;var _0x1691fa=_0x9dc4[_0x2be66a];return _0x1691fa;};'use strict';var Sequelize=require('sequelize');module[_0x49dc('0x0')]={'penalty':{'type':Sequelize[_0x49dc('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x61f0=['exports','sequelize'];(function(_0x4ee0ba,_0x340d2c){var _0x52917f=function(_0x4b6de8){while(--_0x4b6de8){_0x4ee0ba['push'](_0x4ee0ba['shift']());}};_0x52917f(++_0x340d2c);}(_0x61f0,0x121));var _0x061f=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x61f0[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x061f('0x0'));module[_0x061f('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'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 781d17e..b0f2d70 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 _0xd49f=['define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports'];(function(_0x249aba,_0x3ee677){var _0x24e51d=function(_0x332b5c){while(--_0x332b5c){_0x249aba['push'](_0x249aba['shift']());}};_0x24e51d(++_0x3ee677);}(_0xd49f,0x1d4));var _0xfd49=function(_0x2a416a,_0x2f0660){_0x2a416a=_0x2a416a-0x0;var _0x52bb59=_0xd49f[_0x2a416a];return _0x52bb59;};'use strict';var _=require(_0xfd49('0x0'));var util=require(_0xfd49('0x1'));var logger=require(_0xfd49('0x2'))(_0xfd49('0x3'));var moment=require(_0xfd49('0x4'));var BPromise=require(_0xfd49('0x5'));var rp=require(_0xfd49('0x6'));var fs=require('fs');var path=require(_0xfd49('0x7'));var rimraf=require(_0xfd49('0x8'));var config=require(_0xfd49('0x9'));var attributes=require(_0xfd49('0xa'));module[_0xfd49('0xb')]=function(_0xe73b57,_0x1fb75b){return _0xe73b57[_0xfd49('0xc')](_0xfd49('0xd'),attributes,{'tableName':_0xfd49('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfe28=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','api'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0xfe28,0x192));var _0x8fe2=function(_0x2694cb,_0x280e97){_0x2694cb=_0x2694cb-0x0;var _0x34e01e=_0xfe28[_0x2694cb];return _0x34e01e;};'use strict';var _=require(_0x8fe2('0x0'));var util=require(_0x8fe2('0x1'));var logger=require(_0x8fe2('0x2'))(_0x8fe2('0x3'));var moment=require(_0x8fe2('0x4'));var BPromise=require(_0x8fe2('0x5'));var rp=require(_0x8fe2('0x6'));var fs=require('fs');var path=require(_0x8fe2('0x7'));var rimraf=require(_0x8fe2('0x8'));var config=require(_0x8fe2('0x9'));var attributes=require(_0x8fe2('0xa'));module[_0x8fe2('0xb')]=function(_0x147b1d,_0x5e0366){return _0x147b1d['define'](_0x8fe2('0xc'),attributes,{'tableName':_0x8fe2('0xd'),'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 c3033a4..20a3fad 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 _0x2f31=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s'];(function(_0x57898a,_0x16b175){var _0x15998d=function(_0xb2aea3){while(--_0xb2aea3){_0x57898a['push'](_0x57898a['shift']());}};_0x15998d(++_0x16b175);}(_0x2f31,0x147));var _0x12f3=function(_0x2183e7,_0x48656f){_0x2183e7=_0x2183e7-0x0;var _0x11d5e6=_0x2f31[_0x2183e7];return _0x11d5e6;};'use strict';var _=require(_0x12f3('0x0'));var util=require(_0x12f3('0x1'));var moment=require(_0x12f3('0x2'));var BPromise=require(_0x12f3('0x3'));var rs=require(_0x12f3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x12f3('0x5'))['db'];var utils=require(_0x12f3('0x6'));var logger=require(_0x12f3('0x7'))(_0x12f3('0x8'));var config=require(_0x12f3('0x9'));var jayson=require(_0x12f3('0xa'));var client=jayson[_0x12f3('0xb')][_0x12f3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x22a528,_0x44aa12,_0x4b40fb){return new BPromise(function(_0x2bb7d4,_0x50efb1){return client['request'](_0x22a528,_0x4b40fb)[_0x12f3('0xd')](function(_0x1eab58){logger[_0x12f3('0xe')](_0x12f3('0xf'),_0x44aa12,_0x12f3('0x10'));logger['debug'](_0x12f3('0x11'),_0x44aa12,_0x12f3('0x10'),JSON['stringify'](_0x1eab58));if(_0x1eab58[_0x12f3('0x12')]){if(_0x1eab58[_0x12f3('0x12')][_0x12f3('0x13')]===0x1f4){logger[_0x12f3('0x12')](_0x12f3('0xf'),_0x44aa12,_0x1eab58[_0x12f3('0x12')][_0x12f3('0x14')]);return _0x50efb1(_0x1eab58['error'][_0x12f3('0x14')]);}logger[_0x12f3('0x12')](_0x12f3('0xf'),_0x44aa12,_0x1eab58[_0x12f3('0x12')][_0x12f3('0x14')]);return _0x2bb7d4(_0x1eab58[_0x12f3('0x12')][_0x12f3('0x14')]);}else{logger[_0x12f3('0xe')](_0x12f3('0xf'),_0x44aa12,'request\x20sent');_0x2bb7d4(_0x1eab58[_0x12f3('0x15')][_0x12f3('0x14')]);}})[_0x12f3('0x16')](function(_0x192561){logger[_0x12f3('0x12')](_0x12f3('0xf'),_0x44aa12,_0x192561);_0x50efb1(_0x192561);});});} \ No newline at end of file +var _0xc4a9=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','bluebird'];(function(_0x2f3cc0,_0x1934a9){var _0x3686c9=function(_0x55753a){while(--_0x55753a){_0x2f3cc0['push'](_0x2f3cc0['shift']());}};_0x3686c9(++_0x1934a9);}(_0xc4a9,0x105));var _0x9c4a=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xc4a9[_0x5b561d];return _0x431060;};'use strict';var _=require(_0x9c4a('0x0'));var util=require('util');var moment=require(_0x9c4a('0x1'));var BPromise=require(_0x9c4a('0x2'));var rs=require(_0x9c4a('0x3'));var fs=require('fs');var Redis=require(_0x9c4a('0x4'));var db=require(_0x9c4a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9c4a('0x6'))(_0x9c4a('0x7'));var config=require(_0x9c4a('0x8'));var jayson=require(_0x9c4a('0x9'));var client=jayson[_0x9c4a('0xa')][_0x9c4a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2de3c3,_0x5c9fb2,_0x95a741){return new BPromise(function(_0x328731,_0x5a0223){return client[_0x9c4a('0xc')](_0x2de3c3,_0x95a741)[_0x9c4a('0xd')](function(_0x54b053){logger[_0x9c4a('0xe')](_0x9c4a('0xf'),_0x5c9fb2,_0x9c4a('0x10'));logger[_0x9c4a('0x11')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x5c9fb2,_0x9c4a('0x10'),JSON[_0x9c4a('0x12')](_0x54b053));if(_0x54b053[_0x9c4a('0x13')]){if(_0x54b053[_0x9c4a('0x13')][_0x9c4a('0x14')]===0x1f4){logger[_0x9c4a('0x13')]('UserWhatsappQueue,\x20%s,\x20%s',_0x5c9fb2,_0x54b053['error'][_0x9c4a('0x15')]);return _0x5a0223(_0x54b053[_0x9c4a('0x13')]['message']);}logger[_0x9c4a('0x13')](_0x9c4a('0xf'),_0x5c9fb2,_0x54b053[_0x9c4a('0x13')][_0x9c4a('0x15')]);return _0x328731(_0x54b053[_0x9c4a('0x13')][_0x9c4a('0x15')]);}else{logger[_0x9c4a('0xe')](_0x9c4a('0xf'),_0x5c9fb2,'request\x20sent');_0x328731(_0x54b053[_0x9c4a('0x16')][_0x9c4a('0x15')]);}})[_0x9c4a('0x17')](function(_0x29f72c){logger[_0x9c4a('0x13')](_0x9c4a('0xf'),_0x5c9fb2,_0x29f72c);_0x5a0223(_0x29f72c);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 18272df..d309aa2 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 _0x8ece=['create','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','isAuthenticated','index','get','/:id','show','post'];(function(_0x1c16e9,_0x77ea3c){var _0xeba40c=function(_0x3458ce){while(--_0x3458ce){_0x1c16e9['push'](_0x1c16e9['shift']());}};_0xeba40c(++_0x77ea3c);}(_0x8ece,0x195));var _0xe8ec=function(_0xf0f7ba,_0x48be70){_0xf0f7ba=_0xf0f7ba-0x0;var _0x44382c=_0x8ece[_0xf0f7ba];return _0x44382c;};'use strict';var multer=require(_0xe8ec('0x0'));var util=require(_0xe8ec('0x1'));var path=require(_0xe8ec('0x2'));var timeout=require(_0xe8ec('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe8ec('0x4'));var auth=require(_0xe8ec('0x5'));var interaction=require(_0xe8ec('0x6'));var config=require(_0xe8ec('0x7'));var controller=require(_0xe8ec('0x8'));router['get']('/',auth[_0xe8ec('0x9')](),controller[_0xe8ec('0xa')]);router[_0xe8ec('0xb')](_0xe8ec('0xc'),auth[_0xe8ec('0x9')](),controller[_0xe8ec('0xd')]);router[_0xe8ec('0xe')]('/',auth['isAuthenticated'](),controller[_0xe8ec('0xf')]);router['put'](_0xe8ec('0xc'),auth['isAuthenticated'](),controller[_0xe8ec('0x10')]);router[_0xe8ec('0x11')](_0xe8ec('0xc'),auth[_0xe8ec('0x9')](),controller[_0xe8ec('0x12')]);module[_0xe8ec('0x13')]=router; \ No newline at end of file +var _0x782e=['/:id','update','delete','destroy','exports','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./variable.controller','get','index','isAuthenticated','post','create','put'];(function(_0x4bd5c5,_0x24ea13){var _0x5547f2=function(_0x4feb1e){while(--_0x4feb1e){_0x4bd5c5['push'](_0x4bd5c5['shift']());}};_0x5547f2(++_0x24ea13);}(_0x782e,0xb9));var _0xe782=function(_0x1bebab,_0x420ccb){_0x1bebab=_0x1bebab-0x0;var _0x527642=_0x782e[_0x1bebab];return _0x527642;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe782('0x0'));var timeout=require(_0xe782('0x1'));var express=require('express');var router=express[_0xe782('0x2')]();var fs_extra=require(_0xe782('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xe782('0x4'));var config=require(_0xe782('0x5'));var controller=require(_0xe782('0x6'));router[_0xe782('0x7')]('/',auth['isAuthenticated'](),controller[_0xe782('0x8')]);router['get']('/:id',auth[_0xe782('0x9')](),controller['show']);router[_0xe782('0xa')]('/',auth[_0xe782('0x9')](),controller[_0xe782('0xb')]);router[_0xe782('0xc')](_0xe782('0xd'),auth[_0xe782('0x9')](),controller[_0xe782('0xe')]);router[_0xe782('0xf')](_0xe782('0xd'),auth[_0xe782('0x9')](),controller[_0xe782('0x10')]);module[_0xe782('0x11')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index d66f6a8..61b43df 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 _0x4049=['exports','STRING','sequelize'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0x4049,0x17c));var _0x9404=function(_0x3adc9f,_0x5d49d5){_0x3adc9f=_0x3adc9f-0x0;var _0x432a40=_0x4049[_0x3adc9f];return _0x432a40;};'use strict';var Sequelize=require(_0x9404('0x0'));module[_0x9404('0x1')]={'name':{'type':Sequelize[_0x9404('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9404('0x2')]}}; \ No newline at end of file +var _0xa71e=['name','sequelize','exports','STRING'];(function(_0x402ad8,_0x434589){var _0x323958=function(_0x89d258){while(--_0x89d258){_0x402ad8['push'](_0x402ad8['shift']());}};_0x323958(++_0x434589);}(_0xa71e,0x1dd));var _0xea71=function(_0x24693e,_0x2ba888){_0x24693e=_0x24693e-0x0;var _0x53e672=_0xa71e[_0x24693e];return _0x53e672;};'use strict';var Sequelize=require(_0xea71('0x0'));module[_0xea71('0x1')]={'name':{'type':Sequelize[_0xea71('0x2')],'unique':_0xea71('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xea71('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index f35f3de..2456a30 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 _0x1830=['update','then','destroy','Variables','UserProfileResource','error','stack','send','index','map','Variable','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save'];(function(_0x55affd,_0xaa69f4){var _0x3cc6c5=function(_0x28bbc4){while(--_0x28bbc4){_0x55affd['push'](_0x55affd['shift']());}};_0x3cc6c5(++_0xaa69f4);}(_0x1830,0x129));var _0x0183=function(_0x111c47,_0x2c867b){_0x111c47=_0x111c47-0x0;var _0x30790f=_0x1830[_0x111c47];return _0x30790f;};'use strict';var emlformat=require(_0x0183('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0183('0x1'));var jsonpatch=require(_0x0183('0x2'));var rp=require(_0x0183('0x3'));var moment=require(_0x0183('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0183('0x5'));var util=require(_0x0183('0x6'));var path=require(_0x0183('0x7'));var sox=require(_0x0183('0x8'));var csv=require(_0x0183('0x9'));var ejs=require(_0x0183('0xa'));var fs=require('fs');var fs_extra=require(_0x0183('0xb'));var _=require(_0x0183('0xc'));var squel=require(_0x0183('0xd'));var crypto=require(_0x0183('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0183('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0183('0x10'));var Redis=require(_0x0183('0x11'));var authService=require(_0x0183('0x12'));var qs=require(_0x0183('0x13'));var as=require(_0x0183('0x14'));var hardwareService=require(_0x0183('0x15'));var logger=require('../../config/logger')(_0x0183('0x16'));var utils=require(_0x0183('0x17'));var config=require(_0x0183('0x18'));var licenseUtil=require(_0x0183('0x19'));var db=require(_0x0183('0x1a'))['db'];function respondWithStatusCode(_0x4cc7c0,_0x3ce73e){_0x3ce73e=_0x3ce73e||0xcc;return function(_0x248d55){if(_0x248d55){return _0x4cc7c0[_0x0183('0x1b')](_0x3ce73e);}return _0x4cc7c0[_0x0183('0x1c')](_0x3ce73e)[_0x0183('0x1d')]();};}function respondWithResult(_0x1f0429,_0x28afd6){_0x28afd6=_0x28afd6||0xc8;return function(_0x3596a9){if(_0x3596a9){return _0x1f0429[_0x0183('0x1c')](_0x28afd6)[_0x0183('0x1e')](_0x3596a9);}};}function respondWithFilteredResult(_0x11e4df,_0x312863){return function(_0xe17fc5){if(_0xe17fc5){var _0x5c191b=typeof _0x312863[_0x0183('0x1f')]===_0x0183('0x20')&&typeof _0x312863[_0x0183('0x21')]===_0x0183('0x20');var _0x488511=_0xe17fc5['count'];var _0x3a04df=_0x5c191b?0x0:_0x312863[_0x0183('0x1f')];var _0x7cc9ea=_0x5c191b?_0xe17fc5[_0x0183('0x22')]:_0x312863[_0x0183('0x1f')]+_0x312863[_0x0183('0x21')];var _0x1a29a3;if(_0x7cc9ea>=_0x488511){_0x7cc9ea=_0x488511;_0x1a29a3=0xc8;}else{_0x1a29a3=0xce;}_0x11e4df[_0x0183('0x1c')](_0x1a29a3);return _0x11e4df[_0x0183('0x23')](_0x0183('0x24'),_0x3a04df+'-'+_0x7cc9ea+'/'+_0x488511)[_0x0183('0x1e')](_0xe17fc5);}return null;};}function patchUpdates(_0xb76cf8){return function(_0xe54542){try{jsonpatch[_0x0183('0x25')](_0xe54542,_0xb76cf8,!![]);}catch(_0x7716d1){return BPromise['reject'](_0x7716d1);}return _0xe54542[_0x0183('0x26')]();};}function saveUpdates(_0x14ad6e,_0x17f91a){return function(_0x2bc03c){if(_0x2bc03c){return _0x2bc03c[_0x0183('0x27')](_0x14ad6e)[_0x0183('0x28')](function(_0x2752a3){return _0x2752a3;});}return null;};}function removeEntity(_0x495458,_0x14d6d7){return function(_0x1602d4){if(_0x1602d4){return _0x1602d4[_0x0183('0x29')]()[_0x0183('0x28')](function(){var _0x320591=_0x1602d4['get']({'plain':!![]});var _0x40d6a2=_0x0183('0x2a');return db[_0x0183('0x2b')]['destroy']({'where':{'type':_0x40d6a2,'resourceId':_0x320591['id']}})['then'](function(){return _0x1602d4;});})[_0x0183('0x28')](function(){_0x495458['status'](0xcc)[_0x0183('0x1d')]();});}};}function handleEntityNotFound(_0x41612d,_0x2dfc6e){return function(_0x2bbca8){if(!_0x2bbca8){_0x41612d[_0x0183('0x1b')](0x194);}return _0x2bbca8;};}function handleError(_0x4046b3,_0x562922){_0x562922=_0x562922||0x1f4;return function(_0x4d248e){logger[_0x0183('0x2c')](_0x4d248e[_0x0183('0x2d')]);if(_0x4d248e['name']){delete _0x4d248e['name'];}_0x4046b3[_0x0183('0x1c')](_0x562922)[_0x0183('0x2e')](_0x4d248e);};}exports[_0x0183('0x2f')]=function(_0x59ac02,_0x398276){var _0x259d71={},_0x578b15={},_0x5e2176={'count':0x0,'rows':[]};var _0x349d77=_[_0x0183('0x30')](db[_0x0183('0x31')][_0x0183('0x32')],function(_0x24acc1){return{'name':_0x24acc1[_0x0183('0x33')],'type':_0x24acc1[_0x0183('0x34')][_0x0183('0x35')]};});_0x578b15[_0x0183('0x36')]=_[_0x0183('0x30')](_0x349d77,_0x0183('0x37'));_0x578b15[_0x0183('0x38')]=_[_0x0183('0x39')](_0x59ac02[_0x0183('0x38')]);_0x578b15[_0x0183('0x3a')]=_[_0x0183('0x3b')](_0x578b15[_0x0183('0x36')],_0x578b15[_0x0183('0x38')]);_0x259d71[_0x0183('0x3c')]=_[_0x0183('0x3b')](_0x578b15[_0x0183('0x36')],qs[_0x0183('0x3d')](_0x59ac02[_0x0183('0x38')]['fields']));_0x259d71[_0x0183('0x3c')]=_0x259d71['attributes']['length']?_0x259d71[_0x0183('0x3c')]:_0x578b15[_0x0183('0x36')];if(!_0x59ac02[_0x0183('0x38')]['hasOwnProperty'](_0x0183('0x3e'))){_0x259d71[_0x0183('0x21')]=qs[_0x0183('0x21')](_0x59ac02[_0x0183('0x38')][_0x0183('0x21')]);_0x259d71['offset']=qs[_0x0183('0x1f')](_0x59ac02[_0x0183('0x38')][_0x0183('0x1f')]);}_0x259d71[_0x0183('0x3f')]=qs['sort'](_0x59ac02[_0x0183('0x38')][_0x0183('0x40')]);_0x259d71[_0x0183('0x41')]=qs[_0x0183('0x3a')](_[_0x0183('0x42')](_0x59ac02[_0x0183('0x38')],_0x578b15['filters']),_0x349d77);if(_0x59ac02['query'][_0x0183('0x43')]){_0x259d71[_0x0183('0x41')]=_[_0x0183('0x44')](_0x259d71['where'],{'$or':_[_0x0183('0x30')](_0x349d77,function(_0x2e5666){if(_0x2e5666['type']!==_0x0183('0x45')){var _0x5423b6={};_0x5423b6[_0x2e5666['name']]={'$like':'%'+_0x59ac02[_0x0183('0x38')]['filter']+'%'};return _0x5423b6;}})});}_0x259d71=_[_0x0183('0x44')]({},_0x259d71,_0x59ac02[_0x0183('0x46')]);var _0x38d10d={'where':_0x259d71['where']};return db['Variable'][_0x0183('0x22')](_0x38d10d)[_0x0183('0x28')](function(_0x6a5674){_0x5e2176[_0x0183('0x22')]=_0x6a5674;if(_0x59ac02[_0x0183('0x38')][_0x0183('0x47')]){_0x259d71[_0x0183('0x48')]=[{'all':!![]}];}return db['Variable']['findAll'](_0x259d71);})[_0x0183('0x28')](function(_0xa3b39a){_0x5e2176['rows']=_0xa3b39a;return _0x5e2176;})['then'](respondWithFilteredResult(_0x398276,_0x259d71))[_0x0183('0x49')](handleError(_0x398276,null));};exports[_0x0183('0x4a')]=function(_0x135e0e,_0x4ba75f){var _0x3e9af4={'raw':!![],'where':{'id':_0x135e0e[_0x0183('0x4b')]['id']}},_0x477b3f={};_0x477b3f[_0x0183('0x36')]=_[_0x0183('0x39')](db[_0x0183('0x31')][_0x0183('0x32')]);_0x477b3f[_0x0183('0x38')]=_[_0x0183('0x39')](_0x135e0e[_0x0183('0x38')]);_0x477b3f['filters']=_[_0x0183('0x3b')](_0x477b3f[_0x0183('0x36')],_0x477b3f['query']);_0x3e9af4[_0x0183('0x3c')]=_[_0x0183('0x3b')](_0x477b3f[_0x0183('0x36')],qs[_0x0183('0x3d')](_0x135e0e['query']['fields']));_0x3e9af4[_0x0183('0x3c')]=_0x3e9af4[_0x0183('0x3c')]['length']?_0x3e9af4['attributes']:_0x477b3f[_0x0183('0x36')];if(_0x135e0e[_0x0183('0x38')][_0x0183('0x47')]){_0x3e9af4['include']=[{'all':!![]}];}_0x3e9af4=_[_0x0183('0x44')]({},_0x3e9af4,_0x135e0e[_0x0183('0x46')]);return db['Variable'][_0x0183('0x4c')](_0x3e9af4)[_0x0183('0x28')](handleEntityNotFound(_0x4ba75f,null))[_0x0183('0x28')](respondWithResult(_0x4ba75f,null))[_0x0183('0x49')](handleError(_0x4ba75f,null));};exports[_0x0183('0x4d')]=function(_0x39ae18,_0x3da104){return db['Variable'][_0x0183('0x4d')](_0x39ae18[_0x0183('0x4e')],{})[_0x0183('0x28')](function(_0x191fea){var _0x11e9a6=_0x39ae18[_0x0183('0x4f')][_0x0183('0x50')]({'plain':!![]});if(!_0x11e9a6)throw new Error(_0x0183('0x51'));if(_0x11e9a6['role']===_0x0183('0x4f')){var _0x2a485d=_0x191fea[_0x0183('0x50')]({'plain':!![]});var _0x3459af='Variables';return db[_0x0183('0x52')]['find']({'where':{'name':_0x3459af,'userProfileId':_0x11e9a6['userProfileId']},'raw':!![]})[_0x0183('0x28')](function(_0x158800){if(_0x158800&&_0x158800[_0x0183('0x53')]===0x0){return db[_0x0183('0x2b')][_0x0183('0x4d')]({'name':_0x2a485d[_0x0183('0x37')],'resourceId':_0x2a485d['id'],'type':_0x158800['name'],'sectionId':_0x158800['id']},{})['then'](function(){return _0x191fea;});}else{return _0x191fea;}})[_0x0183('0x49')](function(_0x546023){logger[_0x0183('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x546023);throw _0x546023;});}return _0x191fea;})[_0x0183('0x28')](respondWithResult(_0x3da104,0xc9))[_0x0183('0x49')](handleError(_0x3da104,null));};exports['update']=function(_0x5b1867,_0x2da506){if(_0x5b1867[_0x0183('0x4e')]['id']){delete _0x5b1867['body']['id'];}return db['Variable'][_0x0183('0x4c')]({'where':{'id':_0x5b1867[_0x0183('0x4b')]['id']}})[_0x0183('0x28')](handleEntityNotFound(_0x2da506,null))['then'](saveUpdates(_0x5b1867[_0x0183('0x4e')],null))[_0x0183('0x28')](respondWithResult(_0x2da506,null))['catch'](handleError(_0x2da506,null));};exports[_0x0183('0x29')]=function(_0x4c09ad,_0x34f28d){return db[_0x0183('0x31')]['find']({'where':{'id':_0x4c09ad[_0x0183('0x4b')]['id']}})[_0x0183('0x28')](handleEntityNotFound(_0x34f28d,null))[_0x0183('0x28')](removeEntity(_0x34f28d,null))['catch'](handleError(_0x34f28d,null));}; \ No newline at end of file +var _0x1803=['desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','get','Variables','UserProfileResource','error','stack','send','index','map','Variable','rawAttributes','fieldName','type','key','model','name','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','jsforce'];(function(_0x575c75,_0x120aa9){var _0x436370=function(_0x235a5a){while(--_0x235a5a){_0x575c75['push'](_0x575c75['shift']());}};_0x436370(++_0x120aa9);}(_0x1803,0x146));var _0x3180=function(_0x53997f,_0x311646){_0x53997f=_0x53997f-0x0;var _0x1ec151=_0x1803[_0x53997f];return _0x1ec151;};'use strict';var emlformat=require(_0x3180('0x0'));var rimraf=require(_0x3180('0x1'));var zipdir=require(_0x3180('0x2'));var jsonpatch=require(_0x3180('0x3'));var rp=require(_0x3180('0x4'));var moment=require(_0x3180('0x5'));var BPromise=require(_0x3180('0x6'));var Mustache=require(_0x3180('0x7'));var util=require('util');var path=require('path');var sox=require(_0x3180('0x8'));var csv=require(_0x3180('0x9'));var ejs=require(_0x3180('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3180('0xb'));var squel=require(_0x3180('0xc'));var crypto=require('crypto');var jsforce=require(_0x3180('0xd'));var deskjs=require(_0x3180('0xe'));var toCsv=require('to-csv');var querystring=require(_0x3180('0xf'));var Papa=require('papaparse');var Redis=require(_0x3180('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3180('0x11'));var as=require(_0x3180('0x12'));var hardwareService=require(_0x3180('0x13'));var logger=require(_0x3180('0x14'))(_0x3180('0x15'));var utils=require(_0x3180('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3180('0x17'))['db'];function respondWithStatusCode(_0x4a9d2d,_0xd239f4){_0xd239f4=_0xd239f4||0xcc;return function(_0x2167cc){if(_0x2167cc){return _0x4a9d2d[_0x3180('0x18')](_0xd239f4);}return _0x4a9d2d[_0x3180('0x19')](_0xd239f4)[_0x3180('0x1a')]();};}function respondWithResult(_0x199866,_0x259182){_0x259182=_0x259182||0xc8;return function(_0x548a7b){if(_0x548a7b){return _0x199866[_0x3180('0x19')](_0x259182)[_0x3180('0x1b')](_0x548a7b);}};}function respondWithFilteredResult(_0x36f697,_0x3b8f99){return function(_0x4ff247){if(_0x4ff247){var _0x2cf60a=typeof _0x3b8f99[_0x3180('0x1c')]===_0x3180('0x1d')&&typeof _0x3b8f99[_0x3180('0x1e')]==='undefined';var _0x283e86=_0x4ff247['count'];var _0x34e2f5=_0x2cf60a?0x0:_0x3b8f99[_0x3180('0x1c')];var _0xff0b77=_0x2cf60a?_0x4ff247['count']:_0x3b8f99['offset']+_0x3b8f99[_0x3180('0x1e')];var _0x1aae98;if(_0xff0b77>=_0x283e86){_0xff0b77=_0x283e86;_0x1aae98=0xc8;}else{_0x1aae98=0xce;}_0x36f697[_0x3180('0x19')](_0x1aae98);return _0x36f697[_0x3180('0x1f')](_0x3180('0x20'),_0x34e2f5+'-'+_0xff0b77+'/'+_0x283e86)[_0x3180('0x1b')](_0x4ff247);}return null;};}function patchUpdates(_0x19c7b9){return function(_0x121066){try{jsonpatch[_0x3180('0x21')](_0x121066,_0x19c7b9,!![]);}catch(_0x1a9810){return BPromise['reject'](_0x1a9810);}return _0x121066[_0x3180('0x22')]();};}function saveUpdates(_0x110fc7,_0x2db3b7){return function(_0x525571){if(_0x525571){return _0x525571[_0x3180('0x23')](_0x110fc7)[_0x3180('0x24')](function(_0x14b28d){return _0x14b28d;});}return null;};}function removeEntity(_0x465e79,_0x25356a){return function(_0xe486be){if(_0xe486be){return _0xe486be[_0x3180('0x25')]()['then'](function(){var _0x1b9dd8=_0xe486be[_0x3180('0x26')]({'plain':!![]});var _0x30fbb5=_0x3180('0x27');return db[_0x3180('0x28')][_0x3180('0x25')]({'where':{'type':_0x30fbb5,'resourceId':_0x1b9dd8['id']}})[_0x3180('0x24')](function(){return _0xe486be;});})[_0x3180('0x24')](function(){_0x465e79[_0x3180('0x19')](0xcc)[_0x3180('0x1a')]();});}};}function handleEntityNotFound(_0xb6aea9,_0x29d4d8){return function(_0x4cbb78){if(!_0x4cbb78){_0xb6aea9[_0x3180('0x18')](0x194);}return _0x4cbb78;};}function handleError(_0x3b2e2e,_0x584fe3){_0x584fe3=_0x584fe3||0x1f4;return function(_0x432ea2){logger[_0x3180('0x29')](_0x432ea2[_0x3180('0x2a')]);if(_0x432ea2['name']){delete _0x432ea2['name'];}_0x3b2e2e[_0x3180('0x19')](_0x584fe3)[_0x3180('0x2b')](_0x432ea2);};}exports[_0x3180('0x2c')]=function(_0x2bde1b,_0x204aac){var _0x5e4ec7={},_0x53ac4b={},_0x1a9194={'count':0x0,'rows':[]};var _0x1c0da5=_[_0x3180('0x2d')](db[_0x3180('0x2e')][_0x3180('0x2f')],function(_0x184cbe){return{'name':_0x184cbe[_0x3180('0x30')],'type':_0x184cbe[_0x3180('0x31')][_0x3180('0x32')]};});_0x53ac4b[_0x3180('0x33')]=_[_0x3180('0x2d')](_0x1c0da5,_0x3180('0x34'));_0x53ac4b['query']=_[_0x3180('0x35')](_0x2bde1b[_0x3180('0x36')]);_0x53ac4b['filters']=_[_0x3180('0x37')](_0x53ac4b[_0x3180('0x33')],_0x53ac4b[_0x3180('0x36')]);_0x5e4ec7[_0x3180('0x38')]=_[_0x3180('0x37')](_0x53ac4b['model'],qs[_0x3180('0x39')](_0x2bde1b[_0x3180('0x36')]['fields']));_0x5e4ec7[_0x3180('0x38')]=_0x5e4ec7[_0x3180('0x38')][_0x3180('0x3a')]?_0x5e4ec7[_0x3180('0x38')]:_0x53ac4b[_0x3180('0x33')];if(!_0x2bde1b[_0x3180('0x36')][_0x3180('0x3b')](_0x3180('0x3c'))){_0x5e4ec7[_0x3180('0x1e')]=qs[_0x3180('0x1e')](_0x2bde1b['query'][_0x3180('0x1e')]);_0x5e4ec7[_0x3180('0x1c')]=qs[_0x3180('0x1c')](_0x2bde1b[_0x3180('0x36')][_0x3180('0x1c')]);}_0x5e4ec7[_0x3180('0x3d')]=qs[_0x3180('0x3e')](_0x2bde1b['query']['sort']);_0x5e4ec7[_0x3180('0x3f')]=qs[_0x3180('0x40')](_[_0x3180('0x41')](_0x2bde1b[_0x3180('0x36')],_0x53ac4b[_0x3180('0x40')]),_0x1c0da5);if(_0x2bde1b[_0x3180('0x36')][_0x3180('0x42')]){_0x5e4ec7[_0x3180('0x3f')]=_[_0x3180('0x43')](_0x5e4ec7[_0x3180('0x3f')],{'$or':_['map'](_0x1c0da5,function(_0x53b539){if(_0x53b539[_0x3180('0x31')]!==_0x3180('0x44')){var _0x16b6e8={};_0x16b6e8[_0x53b539[_0x3180('0x34')]]={'$like':'%'+_0x2bde1b[_0x3180('0x36')][_0x3180('0x42')]+'%'};return _0x16b6e8;}})});}_0x5e4ec7=_[_0x3180('0x43')]({},_0x5e4ec7,_0x2bde1b[_0x3180('0x45')]);var _0x19e8ae={'where':_0x5e4ec7[_0x3180('0x3f')]};return db[_0x3180('0x2e')][_0x3180('0x46')](_0x19e8ae)[_0x3180('0x24')](function(_0x221343){_0x1a9194[_0x3180('0x46')]=_0x221343;if(_0x2bde1b[_0x3180('0x36')][_0x3180('0x47')]){_0x5e4ec7[_0x3180('0x48')]=[{'all':!![]}];}return db[_0x3180('0x2e')][_0x3180('0x49')](_0x5e4ec7);})[_0x3180('0x24')](function(_0x481292){_0x1a9194[_0x3180('0x4a')]=_0x481292;return _0x1a9194;})[_0x3180('0x24')](respondWithFilteredResult(_0x204aac,_0x5e4ec7))[_0x3180('0x4b')](handleError(_0x204aac,null));};exports[_0x3180('0x4c')]=function(_0xe1f0e0,_0x50a81a){var _0x587ff4={'raw':!![],'where':{'id':_0xe1f0e0[_0x3180('0x4d')]['id']}},_0x3fd5c8={};_0x3fd5c8[_0x3180('0x33')]=_['keys'](db[_0x3180('0x2e')][_0x3180('0x2f')]);_0x3fd5c8[_0x3180('0x36')]=_[_0x3180('0x35')](_0xe1f0e0[_0x3180('0x36')]);_0x3fd5c8[_0x3180('0x40')]=_[_0x3180('0x37')](_0x3fd5c8[_0x3180('0x33')],_0x3fd5c8['query']);_0x587ff4[_0x3180('0x38')]=_['intersection'](_0x3fd5c8[_0x3180('0x33')],qs[_0x3180('0x39')](_0xe1f0e0[_0x3180('0x36')]['fields']));_0x587ff4['attributes']=_0x587ff4[_0x3180('0x38')]['length']?_0x587ff4[_0x3180('0x38')]:_0x3fd5c8['model'];if(_0xe1f0e0[_0x3180('0x36')][_0x3180('0x47')]){_0x587ff4[_0x3180('0x48')]=[{'all':!![]}];}_0x587ff4=_['merge']({},_0x587ff4,_0xe1f0e0['options']);return db['Variable'][_0x3180('0x4e')](_0x587ff4)['then'](handleEntityNotFound(_0x50a81a,null))[_0x3180('0x24')](respondWithResult(_0x50a81a,null))[_0x3180('0x4b')](handleError(_0x50a81a,null));};exports[_0x3180('0x4f')]=function(_0x188161,_0x31f1ef){return db['Variable'][_0x3180('0x4f')](_0x188161[_0x3180('0x50')],{})[_0x3180('0x24')](function(_0x29e419){var _0x2e2bdc=_0x188161[_0x3180('0x51')]['get']({'plain':!![]});if(!_0x2e2bdc)throw new Error(_0x3180('0x52'));if(_0x2e2bdc['role']===_0x3180('0x51')){var _0x80b68=_0x29e419[_0x3180('0x26')]({'plain':!![]});var _0x577f57=_0x3180('0x27');return db['UserProfileSection'][_0x3180('0x4e')]({'where':{'name':_0x577f57,'userProfileId':_0x2e2bdc[_0x3180('0x53')]},'raw':!![]})['then'](function(_0x376ad3){if(_0x376ad3&&_0x376ad3[_0x3180('0x54')]===0x0){return db[_0x3180('0x28')][_0x3180('0x4f')]({'name':_0x80b68[_0x3180('0x34')],'resourceId':_0x80b68['id'],'type':_0x376ad3[_0x3180('0x34')],'sectionId':_0x376ad3['id']},{})[_0x3180('0x24')](function(){return _0x29e419;});}else{return _0x29e419;}})[_0x3180('0x4b')](function(_0x59ac8f){logger[_0x3180('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x59ac8f);throw _0x59ac8f;});}return _0x29e419;})[_0x3180('0x24')](respondWithResult(_0x31f1ef,0xc9))[_0x3180('0x4b')](handleError(_0x31f1ef,null));};exports[_0x3180('0x23')]=function(_0x256a1e,_0x31d83d){if(_0x256a1e[_0x3180('0x50')]['id']){delete _0x256a1e[_0x3180('0x50')]['id'];}return db[_0x3180('0x2e')][_0x3180('0x4e')]({'where':{'id':_0x256a1e[_0x3180('0x4d')]['id']}})['then'](handleEntityNotFound(_0x31d83d,null))['then'](saveUpdates(_0x256a1e['body'],null))[_0x3180('0x24')](respondWithResult(_0x31d83d,null))[_0x3180('0x4b')](handleError(_0x31d83d,null));};exports[_0x3180('0x25')]=function(_0x54f064,_0x512b24){return db[_0x3180('0x2e')][_0x3180('0x4e')]({'where':{'id':_0x54f064['params']['id']}})[_0x3180('0x24')](handleEntityNotFound(_0x512b24,null))[_0x3180('0x24')](removeEntity(_0x512b24,null))['catch'](handleError(_0x512b24,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 58ebc14..8652dfd 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 _0xa394=['rimraf','../../config/environment','./variable.attributes','exports','define','Variable','tools_variables','moment','bluebird','request-promise','path'];(function(_0x3d3f8b,_0x4b6a78){var _0xbeb143=function(_0x171734){while(--_0x171734){_0x3d3f8b['push'](_0x3d3f8b['shift']());}};_0xbeb143(++_0x4b6a78);}(_0xa394,0x1a9));var _0x4a39=function(_0x317a53,_0x1d9005){_0x317a53=_0x317a53-0x0;var _0x236159=_0xa394[_0x317a53];return _0x236159;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x4a39('0x0'));var BPromise=require(_0x4a39('0x1'));var rp=require(_0x4a39('0x2'));var fs=require('fs');var path=require(_0x4a39('0x3'));var rimraf=require(_0x4a39('0x4'));var config=require(_0x4a39('0x5'));var attributes=require(_0x4a39('0x6'));module[_0x4a39('0x7')]=function(_0x26527b,_0x37bdb6){return _0x26527b[_0x4a39('0x8')](_0x4a39('0x9'),attributes,{'tableName':_0x4a39('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x416c=['moment','bluebird','path','rimraf','./variable.attributes','exports','define','Variable','tools_variables','lodash','util','../../config/logger','api'];(function(_0x22b9cf,_0x198c16){var _0x2488f4=function(_0x1703f6){while(--_0x1703f6){_0x22b9cf['push'](_0x22b9cf['shift']());}};_0x2488f4(++_0x198c16);}(_0x416c,0x18f));var _0xc416=function(_0x4ea592,_0x66d7fa){_0x4ea592=_0x4ea592-0x0;var _0x52cbd9=_0x416c[_0x4ea592];return _0x52cbd9;};'use strict';var _=require(_0xc416('0x0'));var util=require(_0xc416('0x1'));var logger=require(_0xc416('0x2'))(_0xc416('0x3'));var moment=require(_0xc416('0x4'));var BPromise=require(_0xc416('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc416('0x6'));var rimraf=require(_0xc416('0x7'));var config=require('../../config/environment');var attributes=require(_0xc416('0x8'));module[_0xc416('0x9')]=function(_0x4314f7,_0x4b6068){return _0x4314f7[_0xc416('0xa')](_0xc416('0xb'),attributes,{'tableName':_0xc416('0xc'),'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 1927942..9226b78 100644 --- a/server/api/variable/variable.rpc.js +++ b/server/api/variable/variable.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['options','where','attributes','include','map','model','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowVariable','Variable','find'];(function(_0x243cca,_0x514c2d){var _0xf94771=function(_0x42d3de){while(--_0x42d3de){_0x243cca['push'](_0x243cca['shift']());}};_0xf94771(++_0x514c2d);}(_0x55ca,0x126));var _0xa55c=function(_0xcfc88f,_0x239d01){_0xcfc88f=_0xcfc88f-0x0;var _0x20cfc0=_0x55ca[_0xcfc88f];return _0x20cfc0;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('Variable,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('Variable,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});}exports[_0xa55c('0x17')]=function(_0x24783b){var _0x4cee3c=this;return new Promise(function(_0x3d4c9e,_0x104a99){return db[_0xa55c('0x18')][_0xa55c('0x19')]({'raw':_0x24783b[_0xa55c('0x1a')]?_0x24783b[_0xa55c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x24783b['options']?_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1b')]||null:null,'attributes':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1c')]||null:null,'include':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1d')],function(_0x234372){return{'model':db[_0x234372['model']],'as':_0x234372['as'],'attributes':_0x234372[_0xa55c('0x1c')],'include':_0x234372['include']?_['map'](_0x234372['include'],function(_0x19ae88){return{'model':db[_0x19ae88['model']],'as':_0x19ae88['as'],'attributes':_0x19ae88[_0xa55c('0x1c')],'include':_0x19ae88[_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x19ae88[_0xa55c('0x1d')],function(_0x2313a9){return{'model':db[_0x2313a9[_0xa55c('0x1f')]],'as':_0x2313a9['as'],'attributes':_0x2313a9[_0xa55c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa55c('0xb')](function(_0x192df2){logger[_0xa55c('0x14')](_0xa55c('0x17'),_0x24783b);logger['debug'](_0xa55c('0x17'),_0x24783b,JSON[_0xa55c('0x10')](_0x192df2));_0x3d4c9e(_0x192df2);})[_0xa55c('0x16')](function(_0x906caa){logger['error'](_0xa55c('0x17'),_0x906caa[_0xa55c('0x13')],_0x24783b);_0x104a99(_0x4cee3c[_0xa55c('0x11')](0x1f4,_0x906caa[_0xa55c('0x13')]));});});}; \ No newline at end of file +var _0x7fbe=['stringify','error','code','message','result','catch','Variable','find','options','where','attributes','include','map','model','info','ShowVariable','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s'];(function(_0x19cf63,_0x2fa797){var _0x320082=function(_0x504d17){while(--_0x504d17){_0x19cf63['push'](_0x19cf63['shift']());}};_0x320082(++_0x2fa797);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x32083e,_0x130a41){_0x32083e=_0x32083e-0x0;var _0x1efcc7=_0x7fbe[_0x32083e];return _0x1efcc7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7fb('0x0'));var BPromise=require(_0xe7fb('0x1'));var rs=require(_0xe7fb('0x2'));var fs=require('fs');var Redis=require(_0xe7fb('0x3'));var db=require(_0xe7fb('0x4'))['db'];var utils=require(_0xe7fb('0x5'));var logger=require(_0xe7fb('0x6'))(_0xe7fb('0x7'));var config=require(_0xe7fb('0x8'));var jayson=require(_0xe7fb('0x9'));var client=jayson[_0xe7fb('0xa')][_0xe7fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24cd67,_0x1f943f,_0x5ad75b){return new BPromise(function(_0x213ebc,_0x228f6b){return client[_0xe7fb('0xc')](_0x24cd67,_0x5ad75b)[_0xe7fb('0xd')](function(_0x4ba197){logger['info'](_0xe7fb('0xe'),_0x1f943f,_0xe7fb('0xf'));logger[_0xe7fb('0x10')](_0xe7fb('0x11'),_0x1f943f,_0xe7fb('0xf'),JSON[_0xe7fb('0x12')](_0x4ba197));if(_0x4ba197[_0xe7fb('0x13')]){if(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x14')]===0x1f4){logger[_0xe7fb('0x13')](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);return _0x228f6b(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')]['message']);return _0x213ebc(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}else{logger['info'](_0xe7fb('0xe'),_0x1f943f,'request\x20sent');_0x213ebc(_0x4ba197[_0xe7fb('0x16')][_0xe7fb('0x15')]);}})[_0xe7fb('0x17')](function(_0x17e8a8){logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x17e8a8);_0x228f6b(_0x17e8a8);});});}exports['ShowVariable']=function(_0x293a47){var _0x546463=this;return new Promise(function(_0x1e77fd,_0x4708f7){return db[_0xe7fb('0x18')][_0xe7fb('0x19')]({'raw':_0x293a47['options']?_0x293a47[_0xe7fb('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x293a47[_0xe7fb('0x1a')]?_0x293a47['options'][_0xe7fb('0x1b')]||null:null,'attributes':_0x293a47['options']?_0x293a47[_0xe7fb('0x1a')][_0xe7fb('0x1c')]||null:null,'include':_0x293a47['options']?_0x293a47[_0xe7fb('0x1a')][_0xe7fb('0x1d')]?_[_0xe7fb('0x1e')](_0x293a47['options'][_0xe7fb('0x1d')],function(_0x469ead){return{'model':db[_0x469ead['model']],'as':_0x469ead['as'],'attributes':_0x469ead['attributes'],'include':_0x469ead['include']?_[_0xe7fb('0x1e')](_0x469ead['include'],function(_0x49b219){return{'model':db[_0x49b219[_0xe7fb('0x1f')]],'as':_0x49b219['as'],'attributes':_0x49b219[_0xe7fb('0x1c')],'include':_0x49b219[_0xe7fb('0x1d')]?_['map'](_0x49b219[_0xe7fb('0x1d')],function(_0x2b69c4){return{'model':db[_0x2b69c4[_0xe7fb('0x1f')]],'as':_0x2b69c4['as'],'attributes':_0x2b69c4[_0xe7fb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe7fb('0xd')](function(_0x16237a){logger[_0xe7fb('0x20')]('ShowVariable',_0x293a47);logger['debug'](_0xe7fb('0x21'),_0x293a47,JSON[_0xe7fb('0x12')](_0x16237a));_0x1e77fd(_0x16237a);})[_0xe7fb('0x17')](function(_0x4fd290){logger[_0xe7fb('0x13')](_0xe7fb('0x21'),_0x4fd290[_0xe7fb('0x15')],_0x293a47);_0x4708f7(_0x546463[_0xe7fb('0x13')](0x1f4,_0x4fd290[_0xe7fb('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index fd34311..c258993 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 _0xc51c=['../../components/auth/service','./version.controller','index','get','/fetch','isAuthenticated','fetch','/reset','canUpdate','reset','pull','/migrations','migrations','exports','express','Router'];(function(_0x409ad2,_0x5129c1){var _0x595b5f=function(_0x592974){while(--_0x592974){_0x409ad2['push'](_0x409ad2['shift']());}};_0x595b5f(++_0x5129c1);}(_0xc51c,0x8e));var _0xcc51=function(_0x8619b4,_0x341d2e){_0x8619b4=_0x8619b4-0x0;var _0x505ae6=_0xc51c[_0x8619b4];return _0x505ae6;};'use strict';var express=require(_0xcc51('0x0'));var router=express[_0xcc51('0x1')]();var auth=require(_0xcc51('0x2'));var controller=require(_0xcc51('0x3'));router['get']('/',controller[_0xcc51('0x4')]);router[_0xcc51('0x5')](_0xcc51('0x6'),auth[_0xcc51('0x7')](),auth['canUpdate'](),controller[_0xcc51('0x8')]);router['get'](_0xcc51('0x9'),auth[_0xcc51('0x7')](),auth[_0xcc51('0xa')](),controller[_0xcc51('0xb')]);router['get']('/pull',auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xcc51('0xc')]);router[_0xcc51('0x5')]('/restart',auth[_0xcc51('0x7')](),controller['restart']);router[_0xcc51('0x5')](_0xcc51('0xd'),controller[_0xcc51('0xe')]);module[_0xcc51('0xf')]=router; \ No newline at end of file +var _0x69a7=['canUpdate','reset','get','/pull','/restart','restart','migrations','exports','express','../../components/auth/service','./version.controller','/fetch','isAuthenticated','fetch','/reset'];(function(_0xf89ad3,_0x4a4a05){var _0x324449=function(_0xe7bab5){while(--_0xe7bab5){_0xf89ad3['push'](_0xf89ad3['shift']());}};_0x324449(++_0x4a4a05);}(_0x69a7,0x143));var _0x769a=function(_0x1c206c,_0x30bdcf){_0x1c206c=_0x1c206c-0x0;var _0x188aaa=_0x69a7[_0x1c206c];return _0x188aaa;};'use strict';var express=require(_0x769a('0x0'));var router=express['Router']();var auth=require(_0x769a('0x1'));var controller=require(_0x769a('0x2'));router['get']('/',controller['index']);router['get'](_0x769a('0x3'),auth[_0x769a('0x4')](),auth['canUpdate'](),controller[_0x769a('0x5')]);router['get'](_0x769a('0x6'),auth['isAuthenticated'](),auth[_0x769a('0x7')](),controller[_0x769a('0x8')]);router[_0x769a('0x9')](_0x769a('0xa'),auth['isAuthenticated'](),auth[_0x769a('0x7')](),controller['pull']);router['get'](_0x769a('0xb'),auth[_0x769a('0x4')](),controller[_0x769a('0xc')]);router['get']('/migrations',controller[_0x769a('0xd')]);module[_0x769a('0xe')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index a5d4244..3d36097 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 _0x5cd6=['git\x20reset\x20--hard','pull','npm\x20install\x20--production','info','restart','motion2','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','join','root','length','.js','push','sort','sequelize','Migration','getQueryInterface','constructor','server','then','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','pkginfo','version','compare-versions','exec','../../mysqldb','../../config/pm2','../../config/logger','update','simple-git','exports','query','latest','tags','2.0.0','json','status','fetch','origin','master','error','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','git\x20reset\x20--hard\x20FETCH_HEAD'];(function(_0x2e6ea9,_0x1b9d9e){var _0x1f8081=function(_0xde1c8a){while(--_0xde1c8a){_0x2e6ea9['push'](_0x2e6ea9['shift']());}};_0x1f8081(++_0x1b9d9e);}(_0x5cd6,0x18e));var _0x65cd=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0x5cd6[_0x20c9b2];return _0x2c6030;};'use strict';var Umzug=require(_0x65cd('0x0'));var path=require('path');var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x65cd('0x1'))(module,_0x65cd('0x2'));var compareVersions=require(_0x65cd('0x3'));var exec=require('child_process')[_0x65cd('0x4')];var db=require(_0x65cd('0x5'))['db'];var config=require('../../config/environment');var pm2=require(_0x65cd('0x6'));var logger=require(_0x65cd('0x7'))(_0x65cd('0x8'));var git=require(_0x65cd('0x9'))(config['root']);exports['index']=function(_0x4e5578,_0x4ef37d){var _0x342363={'current':module[_0x65cd('0xa')]['version'],'phonebar':0x2};if(_0x4e5578['query']&&_0x4e5578[_0x65cd('0xb')][_0x65cd('0xc')]){return git['fetch']()[_0x65cd('0xd')](function(_0x5e67a4,_0x4458f2){_0x342363['latest']=(_0x5e67a4?module['exports'][_0x65cd('0x2')]:_0x4458f2[_0x65cd('0xc')])||_0x65cd('0xe');return _0x4ef37d['status'](0xc8)[_0x65cd('0xf')](_0x342363);});}else{return _0x4ef37d[_0x65cd('0x10')](0xc8)[_0x65cd('0xf')](_0x342363);}};exports[_0x65cd('0x11')]=function(_0x2d91a6,_0x14c836){return git['fetch']([_0x65cd('0x12'),_0x65cd('0x13')],function(_0x591d1e){if(_0x591d1e){logger[_0x65cd('0x14')](_0x591d1e);return _0x14c836['status'](0x1f4)[_0x65cd('0xf')](_0x591d1e);}logger['info'](_0x65cd('0x15'));return _0x14c836[_0x65cd('0x10')](0xc8)[_0x65cd('0xf')]({'output':_0x65cd('0x16')});});};exports['reset']=function(_0x288540,_0x214fb4){return git[_0x65cd('0x17')]([_0x65cd('0x18'),'FETCH_HEAD'],function(_0x173bb1){if(_0x173bb1){logger['error'](_0x173bb1);return _0x214fb4[_0x65cd('0x10')](0x1f4)[_0x65cd('0xf')](_0x173bb1);}logger['info'](_0x65cd('0x19'));return _0x214fb4['status'](0xc8)[_0x65cd('0xf')]({'output':_0x65cd('0x1a')});});};exports[_0x65cd('0x1b')]=function(_0x519b4e,_0x2fa56d){exec(_0x65cd('0x1c'),function(_0x9babb4,_0x29561f,_0x2d89be){logger[_0x65cd('0x1d')](_0x29561f);logger[_0x65cd('0x1d')](_0x2d89be);if(_0x9babb4){logger[_0x65cd('0x14')](_0x9babb4);return _0x2fa56d[_0x65cd('0x10')](0x1f4)[_0x65cd('0xf')](_0x9babb4);}return _0x2fa56d[_0x65cd('0x10')](0xc8)[_0x65cd('0xf')]({'output':_0x29561f});});};exports[_0x65cd('0x1e')]=function(_0x1418f9,_0x1c9575){return pm2[_0x65cd('0x1e')](_0x65cd('0x1f'))['then'](function(_0x4a585d){logger[_0x65cd('0x1d')](_0x65cd('0x20'),_0x4a585d);return _0x1c9575[_0x65cd('0x10')](0xc8)[_0x65cd('0xf')]({'output':_0x65cd('0x21')});})[_0x65cd('0x22')](function(_0x230b6a){logger[_0x65cd('0x14')](_0x230b6a);return _0x1c9575[_0x65cd('0x10')](0x1f4)[_0x65cd('0xf')](_0x230b6a);});};exports[_0x65cd('0x23')]=function(_0x4ad5b4,_0x4b99c9){var _0xd3e080=fs['readdirSync'](path[_0x65cd('0x24')](config[_0x65cd('0x25')],'server',_0x65cd('0x23')));var _0x57be8f=[];for(var _0x4c9efa=0x0;_0x4c9efa<_0xd3e080[_0x65cd('0x26')];_0x4c9efa++){var _0xd8a846=_0xd3e080[_0x4c9efa]['replace'](_0x65cd('0x27'),'');if(compareVersions(module['exports'][_0x65cd('0x2')],_0xd8a846)===-0x1){_0x57be8f[_0x65cd('0x28')](_0xd8a846);}}if(_0x57be8f['length']){var _0x58e804=_0x57be8f[_0x65cd('0x29')](compareVersions);var _0x551233=new Umzug({'storage':_0x65cd('0x2a'),'storageOptions':{'model':db[_0x65cd('0x2b')],'modelName':_0x65cd('0x2b'),'columnName':_0x65cd('0x2')},'migrations':{'params':[db['sequelize'][_0x65cd('0x2c')](),db[_0x65cd('0x2a')][_0x65cd('0x2d')],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path['join'](config[_0x65cd('0x25')],_0x65cd('0x2e'),_0x65cd('0x23')),'pattern':/\.js$/}});_0x551233['up']({'migrations':_['map'](_0x58e804,function(_0x54bb50){return _0x54bb50+_0x65cd('0x27');})})[_0x65cd('0x2f')](function(){return _0x4b99c9[_0x65cd('0x10')](0xc8)['json']({'output':_0x65cd('0x30')+module[_0x65cd('0xa')][_0x65cd('0x2')]+_0x65cd('0x31')+_[_0x65cd('0x32')](_0x58e804),'migrations':_['join'](_0x58e804)});})[_0x65cd('0x22')](function(_0x325246){if(_0x325246 instanceof db[_0x65cd('0x2a')][_0x65cd('0x33')]){return _0x4b99c9[_0x65cd('0x10')](0xc8)[_0x65cd('0xf')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x4b99c9[_0x65cd('0x10')](0x1f4)['json'](_0x325246);}});}else{return _0x4b99c9[_0x65cd('0x10')](0xc8)[_0x65cd('0xf')]({'output':_0x65cd('0x34')});}}; \ No newline at end of file +var _0xf22f=['git\x20reset\x20--hard','npm\x20install\x20--production','restart','motion2','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','server','replace','push','length','sequelize','Migration','getQueryInterface','constructor','join','map','.js','then','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','root','index','exports','latest','tags','2.0.0','status','json','fetch','origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD'];(function(_0x359541,_0x408ce0){var _0x2b101e=function(_0x48eaaf){while(--_0x48eaaf){_0x359541['push'](_0x359541['shift']());}};_0x2b101e(++_0x408ce0);}(_0xf22f,0x1c9));var _0xff22=function(_0x52455a,_0x18d76d){_0x52455a=_0x52455a-0x0;var _0xcc41a7=_0xf22f[_0x52455a];return _0xcc41a7;};'use strict';var Umzug=require(_0xff22('0x0'));var path=require(_0xff22('0x1'));var fs=require('fs');var _=require(_0xff22('0x2'));var pkginfo=require(_0xff22('0x3'))(module,_0xff22('0x4'));var compareVersions=require('compare-versions');var exec=require('child_process')['exec'];var db=require(_0xff22('0x5'))['db'];var config=require(_0xff22('0x6'));var pm2=require(_0xff22('0x7'));var logger=require(_0xff22('0x8'))(_0xff22('0x9'));var git=require('simple-git')(config[_0xff22('0xa')]);exports[_0xff22('0xb')]=function(_0x2744e7,_0x11347e){var _0x1c6f2a={'current':module[_0xff22('0xc')][_0xff22('0x4')],'phonebar':0x2};if(_0x2744e7['query']&&_0x2744e7['query'][_0xff22('0xd')]){return git['fetch']()[_0xff22('0xe')](function(_0x3afdf1,_0x4a39b4){_0x1c6f2a[_0xff22('0xd')]=(_0x3afdf1?module['exports'][_0xff22('0x4')]:_0x4a39b4[_0xff22('0xd')])||_0xff22('0xf');return _0x11347e[_0xff22('0x10')](0xc8)[_0xff22('0x11')](_0x1c6f2a);});}else{return _0x11347e[_0xff22('0x10')](0xc8)['json'](_0x1c6f2a);}};exports[_0xff22('0x12')]=function(_0x66a7c0,_0x22a265){return git[_0xff22('0x12')]([_0xff22('0x13'),_0xff22('0x14')],function(_0x40a96d){if(_0x40a96d){logger[_0xff22('0x15')](_0x40a96d);return _0x22a265[_0xff22('0x10')](0x1f4)[_0xff22('0x11')](_0x40a96d);}logger[_0xff22('0x16')](_0xff22('0x17'));return _0x22a265['status'](0xc8)[_0xff22('0x11')]({'output':_0xff22('0x18')});});};exports[_0xff22('0x19')]=function(_0x39d7c6,_0x4c6d6e){return git[_0xff22('0x19')]([_0xff22('0x1a'),_0xff22('0x1b')],function(_0x36ce08){if(_0x36ce08){logger[_0xff22('0x15')](_0x36ce08);return _0x4c6d6e[_0xff22('0x10')](0x1f4)[_0xff22('0x11')](_0x36ce08);}logger[_0xff22('0x16')](_0xff22('0x1c'));return _0x4c6d6e[_0xff22('0x10')](0xc8)[_0xff22('0x11')]({'output':_0xff22('0x1d')});});};exports['pull']=function(_0x485d9c,_0x47fa5e){exec(_0xff22('0x1e'),function(_0xc76bc5,_0x5551b8,_0x5ecab8){logger[_0xff22('0x16')](_0x5551b8);logger[_0xff22('0x16')](_0x5ecab8);if(_0xc76bc5){logger[_0xff22('0x15')](_0xc76bc5);return _0x47fa5e['status'](0x1f4)['json'](_0xc76bc5);}return _0x47fa5e[_0xff22('0x10')](0xc8)[_0xff22('0x11')]({'output':_0x5551b8});});};exports[_0xff22('0x1f')]=function(_0x4331bc,_0x2e9c66){return pm2[_0xff22('0x1f')](_0xff22('0x20'))['then'](function(_0x2e47ea){logger[_0xff22('0x16')](_0xff22('0x21'),_0x2e47ea);return _0x2e9c66['status'](0xc8)[_0xff22('0x11')]({'output':_0xff22('0x22')});})[_0xff22('0x23')](function(_0x239233){logger[_0xff22('0x15')](_0x239233);return _0x2e9c66['status'](0x1f4)[_0xff22('0x11')](_0x239233);});};exports[_0xff22('0x24')]=function(_0x399545,_0x501c2a){var _0x9ca8cb=fs[_0xff22('0x25')](path['join'](config[_0xff22('0xa')],_0xff22('0x26'),_0xff22('0x24')));var _0x157867=[];for(var _0x248474=0x0;_0x248474<_0x9ca8cb['length'];_0x248474++){var _0x22a59f=_0x9ca8cb[_0x248474][_0xff22('0x27')]('.js','');if(compareVersions(module[_0xff22('0xc')][_0xff22('0x4')],_0x22a59f)===-0x1){_0x157867[_0xff22('0x28')](_0x22a59f);}}if(_0x157867[_0xff22('0x29')]){var _0x45c2de=_0x157867['sort'](compareVersions);var _0x426b3f=new Umzug({'storage':_0xff22('0x2a'),'storageOptions':{'model':db[_0xff22('0x2b')],'modelName':'Migration','columnName':_0xff22('0x4')},'migrations':{'params':[db[_0xff22('0x2a')][_0xff22('0x2c')](),db['sequelize'][_0xff22('0x2d')],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path[_0xff22('0x2e')](config[_0xff22('0xa')],_0xff22('0x26'),_0xff22('0x24')),'pattern':/\.js$/}});_0x426b3f['up']({'migrations':_[_0xff22('0x2f')](_0x45c2de,function(_0x3f3039){return _0x3f3039+_0xff22('0x30');})})[_0xff22('0x31')](function(){return _0x501c2a[_0xff22('0x10')](0xc8)[_0xff22('0x11')]({'output':_0xff22('0x32')+module[_0xff22('0xc')]['version']+_0xff22('0x33')+_[_0xff22('0x34')](_0x45c2de),'migrations':_[_0xff22('0x2e')](_0x45c2de)});})[_0xff22('0x23')](function(_0x56978a){if(_0x56978a instanceof db[_0xff22('0x2a')]['UniqueConstraintError']){return _0x501c2a['status'](0xc8)[_0xff22('0x11')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x501c2a[_0xff22('0x10')](0x1f4)['json'](_0x56978a);}});}else{return _0x501c2a[_0xff22('0x10')](0xc8)['json']({'output':_0xff22('0x35')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 108f123..7c3078b 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 _0xa6f9=['index','get','/describe','describe','/:id','post','create','delete','destroy','exports','util','path','connect-timeout','Router','../../config/environment','isAuthenticated'];(function(_0x4b9781,_0x713b9f){var _0x1070f4=function(_0x158af4){while(--_0x158af4){_0x4b9781['push'](_0x4b9781['shift']());}};_0x1070f4(++_0x713b9f);}(_0xa6f9,0x11a));var _0x9a6f=function(_0x3cf338,_0x44e1a8){_0x3cf338=_0x3cf338-0x0;var _0x17653c=_0xa6f9[_0x3cf338];return _0x17653c;};'use strict';var multer=require('multer');var util=require(_0x9a6f('0x0'));var path=require(_0x9a6f('0x1'));var timeout=require(_0x9a6f('0x2'));var express=require('express');var router=express[_0x9a6f('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9a6f('0x4'));var controller=require('./voiceAgentReport.controller');router['get']('/',auth[_0x9a6f('0x5')](),controller[_0x9a6f('0x6')]);router[_0x9a6f('0x7')](_0x9a6f('0x8'),auth[_0x9a6f('0x5')](),controller[_0x9a6f('0x9')]);router[_0x9a6f('0x7')](_0x9a6f('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x9a6f('0xb')]('/',auth[_0x9a6f('0x5')](),controller[_0x9a6f('0xc')]);router['put'](_0x9a6f('0xa'),auth[_0x9a6f('0x5')](),controller['update']);router[_0x9a6f('0xd')](_0x9a6f('0xa'),auth['isAuthenticated'](),controller[_0x9a6f('0xe')]);module[_0x9a6f('0xf')]=router; \ No newline at end of file +var _0x3d38=['../../config/environment','./voiceAgentReport.controller','isAuthenticated','index','/describe','describe','show','post','/:id','update','destroy','exports','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3d38,0x1d7));var _0x83d3=function(_0x39580c,_0x22425c){_0x39580c=_0x39580c-0x0;var _0x1a4cd8=_0x3d38[_0x39580c];return _0x1a4cd8;};'use strict';var multer=require('multer');var util=require(_0x83d3('0x0'));var path=require('path');var timeout=require(_0x83d3('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x83d3('0x2'));var auth=require(_0x83d3('0x3'));var interaction=require(_0x83d3('0x4'));var config=require(_0x83d3('0x5'));var controller=require(_0x83d3('0x6'));router['get']('/',auth[_0x83d3('0x7')](),controller[_0x83d3('0x8')]);router['get'](_0x83d3('0x9'),auth[_0x83d3('0x7')](),controller[_0x83d3('0xa')]);router['get']('/:id',auth[_0x83d3('0x7')](),controller[_0x83d3('0xb')]);router[_0x83d3('0xc')]('/',auth[_0x83d3('0x7')](),controller['create']);router['put'](_0x83d3('0xd'),auth[_0x83d3('0x7')](),controller[_0x83d3('0xe')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x83d3('0xf')]);module[_0x83d3('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 1efc508..ff2a6ba 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 _0xd4f4=['exports','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x2f6d82,_0x4ddc85){_0x2f6d82=_0x2f6d82-0x0;var _0x1e6f2a=_0xd4f4[_0x2f6d82];return _0x1e6f2a;};'use strict';var Sequelize=require(_0x4d4f('0x0'));module[_0x4d4f('0x1')]={'type':{'type':Sequelize[_0x4d4f('0x2')]},'uniqueid':{'type':Sequelize[_0x4d4f('0x2')]},'calleridnum':{'type':Sequelize[_0x4d4f('0x2')]},'calleridname':{'type':Sequelize[_0x4d4f('0x2')]},'queue':{'type':Sequelize[_0x4d4f('0x2')]},'interface':{'type':Sequelize[_0x4d4f('0x2')]},'membername':{'type':Sequelize[_0x4d4f('0x2')]},'agentcalledAt':{'type':Sequelize[_0x4d4f('0x3')]},'agentconnectAt':{'type':Sequelize[_0x4d4f('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x4d4f('0x4')]},'agentcomplete':{'type':Sequelize[_0x4d4f('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x4d4f('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x4d4f('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x4d4f('0x4')]},'agentacw':{'type':Sequelize[_0x4d4f('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x4d4f('0x4')]},'reason':{'type':Sequelize[_0x4d4f('0x2')]},'lastevent':{'type':Sequelize[_0x4d4f('0x2')]},'channel':{'type':Sequelize[_0x4d4f('0x2')]},'channelstate':{'type':Sequelize[_0x4d4f('0x4')]},'channelstatedesc':{'type':Sequelize[_0x4d4f('0x2')]},'connectedlinenum':{'type':Sequelize[_0x4d4f('0x2')]},'connectedlinename':{'type':Sequelize[_0x4d4f('0x2')]},'language':{'type':Sequelize[_0x4d4f('0x2')]},'accountcode':{'type':Sequelize[_0x4d4f('0x2')]},'context':{'type':Sequelize[_0x4d4f('0x2')]},'exten':{'type':Sequelize[_0x4d4f('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x4d4f('0x2')]},'destcalleridnum':{'type':Sequelize[_0x4d4f('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x4d4f('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x4d4f('0x2')]},'destlanguage':{'type':Sequelize[_0x4d4f('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x4d4f('0x2')]},'destexten':{'type':Sequelize[_0x4d4f('0x2')]},'destpriority':{'type':Sequelize[_0x4d4f('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x4d4f('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x4d4f('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x4d4f('0x2')],'comment':_0x4d4f('0x6')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x4d4f('0x2')]},'agententerreason':{'type':Sequelize[_0x4d4f('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8374=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','BOOLEAN','INTEGER'];(function(_0x17c10a,_0xc9ee44){var _0x149440=function(_0x52f2c4){while(--_0x52f2c4){_0x17c10a['push'](_0x17c10a['shift']());}};_0x149440(++_0xc9ee44);}(_0x8374,0x174));var _0x4837=function(_0x84d35f,_0x47e15b){_0x84d35f=_0x84d35f-0x0;var _0x31a595=_0x8374[_0x84d35f];return _0x31a595;};'use strict';var Sequelize=require(_0x4837('0x0'));module[_0x4837('0x1')]={'type':{'type':Sequelize[_0x4837('0x2')]},'uniqueid':{'type':Sequelize[_0x4837('0x2')]},'calleridnum':{'type':Sequelize[_0x4837('0x2')]},'calleridname':{'type':Sequelize[_0x4837('0x2')]},'queue':{'type':Sequelize[_0x4837('0x2')]},'interface':{'type':Sequelize[_0x4837('0x2')]},'membername':{'type':Sequelize[_0x4837('0x2')]},'agentcalledAt':{'type':Sequelize[_0x4837('0x3')]},'agentconnectAt':{'type':Sequelize[_0x4837('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x4837('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x4837('0x3')]},'agentdumpAt':{'type':Sequelize[_0x4837('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x4837('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x4837('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x4837('0x5')]},'agentacw':{'type':Sequelize[_0x4837('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x4837('0x5')]},'reason':{'type':Sequelize[_0x4837('0x2')]},'lastevent':{'type':Sequelize[_0x4837('0x2')]},'channel':{'type':Sequelize[_0x4837('0x2')]},'channelstate':{'type':Sequelize[_0x4837('0x5')]},'channelstatedesc':{'type':Sequelize[_0x4837('0x2')]},'connectedlinenum':{'type':Sequelize[_0x4837('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x4837('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x4837('0x2')]},'priority':{'type':Sequelize[_0x4837('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x4837('0x2')]},'destcalleridname':{'type':Sequelize[_0x4837('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x4837('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x4837('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x4837('0x2')]},'destcontext':{'type':Sequelize[_0x4837('0x2')]},'destexten':{'type':Sequelize[_0x4837('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x4837('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x4837('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x4837('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x4837('0x2')],'comment':_0x4837('0x6')},'transferexten':{'type':Sequelize[_0x4837('0x2')]},'transferuniqueid':{'type':Sequelize[_0x4837('0x2')]},'agententerreason':{'type':Sequelize[_0x4837('0x5')],'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 a1c75e8..72d9319 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(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'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(_0x176329,_0x568c84){var _0x31997c=function(_0x3d64df){while(--_0x3d64df){_0x176329['push'](_0x176329['shift']());}};_0x31997c(++_0x568c84);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'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 355e883..ad0c43a 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 _0xe009=['bluebird','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','destuniqueid','lodash','util','../../config/logger','api'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0xe009,0x122));var _0x9e00=function(_0x2ea296,_0x44e3e6){_0x2ea296=_0x2ea296-0x0;var _0x1a914e=_0xe009[_0x2ea296];return _0x1a914e;};'use strict';var _=require(_0x9e00('0x0'));var util=require(_0x9e00('0x1'));var logger=require(_0x9e00('0x2'))(_0x9e00('0x3'));var moment=require('moment');var BPromise=require(_0x9e00('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9e00('0x5'));var rimraf=require(_0x9e00('0x6'));var config=require(_0x9e00('0x7'));var attributes=require(_0x9e00('0x8'));module[_0x9e00('0x9')]=function(_0x467e35,_0x32b4ee){return _0x467e35[_0x9e00('0xa')](_0x9e00('0xb'),attributes,{'tableName':_0x9e00('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0x9e00('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbbbd=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','util'];(function(_0x410092,_0x392c01){var _0x26ff36=function(_0x2f2d55){while(--_0x2f2d55){_0x410092['push'](_0x410092['shift']());}};_0x26ff36(++_0x392c01);}(_0xbbbd,0x86));var _0xdbbb=function(_0x556bb1,_0x34830d){_0x556bb1=_0x556bb1-0x0;var _0x45455f=_0xbbbd[_0x556bb1];return _0x45455f;};'use strict';var _=require(_0xdbbb('0x0'));var util=require(_0xdbbb('0x1'));var logger=require(_0xdbbb('0x2'))(_0xdbbb('0x3'));var moment=require(_0xdbbb('0x4'));var BPromise=require(_0xdbbb('0x5'));var rp=require(_0xdbbb('0x6'));var fs=require('fs');var path=require(_0xdbbb('0x7'));var rimraf=require(_0xdbbb('0x8'));var config=require(_0xdbbb('0x9'));var attributes=require(_0xdbbb('0xa'));module[_0xdbbb('0xb')]=function(_0x4e9523,_0xa5399d){return _0x4e9523[_0xdbbb('0xc')](_0xdbbb('0xd'),attributes,{'tableName':_0xdbbb('0xe'),'paranoid':![],'indexes':[{'fields':[_0xdbbb('0xf'),_0xdbbb('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 70de91b..4d430e7 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 _0x6fa9=['error','message','info','result','catch','CreateVoiceAgentReport','create','body','options','raw','VoiceAgentReport','where','attributes','limit','UpdateVoiceAgentReport','moment','bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','http','then','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x43a911,_0x30046e){var _0x46fbdb=function(_0x233731){while(--_0x233731){_0x43a911['push'](_0x43a911['shift']());}};_0x46fbdb(++_0x30046e);}(_0x6fa9,0x197));var _0x96fa=function(_0x26f72a,_0x1663a5){_0x26f72a=_0x26f72a-0x0;var _0xec9df1=_0x6fa9[_0x26f72a];return _0xec9df1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x96fa('0x0'));var BPromise=require(_0x96fa('0x1'));var rs=require(_0x96fa('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x96fa('0x3'))('rpc');var config=require(_0x96fa('0x4'));var jayson=require(_0x96fa('0x5'));var client=jayson['client'][_0x96fa('0x6')]({'port':0x232a});function respondWithRpcPromise(_0xf7631e,_0x73e8d5,_0x4c26f6){return new BPromise(function(_0x2ee5af,_0x5aca57){return client['request'](_0xf7631e,_0x4c26f6)[_0x96fa('0x7')](function(_0x54fdc1){logger['info'](_0x96fa('0x8'),_0x73e8d5,_0x96fa('0x9'));logger[_0x96fa('0xa')](_0x96fa('0xb'),_0x73e8d5,_0x96fa('0x9'),JSON[_0x96fa('0xc')](_0x54fdc1));if(_0x54fdc1[_0x96fa('0xd')]){if(_0x54fdc1['error']['code']===0x1f4){logger[_0x96fa('0xd')](_0x96fa('0x8'),_0x73e8d5,_0x54fdc1['error'][_0x96fa('0xe')]);return _0x5aca57(_0x54fdc1['error'][_0x96fa('0xe')]);}logger[_0x96fa('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x73e8d5,_0x54fdc1[_0x96fa('0xd')][_0x96fa('0xe')]);return _0x2ee5af(_0x54fdc1['error'][_0x96fa('0xe')]);}else{logger[_0x96fa('0xf')](_0x96fa('0x8'),_0x73e8d5,_0x96fa('0x9'));_0x2ee5af(_0x54fdc1[_0x96fa('0x10')][_0x96fa('0xe')]);}})[_0x96fa('0x11')](function(_0x5695d3){logger[_0x96fa('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x73e8d5,_0x5695d3);_0x5aca57(_0x5695d3);});});}exports[_0x96fa('0x12')]=function(_0x3a9ec1){var _0x1d370c=this;return new Promise(function(_0x3a37cb,_0x13c5e2){return db['VoiceAgentReport'][_0x96fa('0x13')](_0x3a9ec1[_0x96fa('0x14')],{'raw':_0x3a9ec1[_0x96fa('0x15')]?_0x3a9ec1['options'][_0x96fa('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x3c23d7){logger['info']('CreateVoiceAgentReport',_0x3a9ec1);logger[_0x96fa('0xa')](_0x96fa('0x12'),_0x3a9ec1,JSON[_0x96fa('0xc')](_0x3c23d7));_0x3a37cb(_0x3c23d7);})[_0x96fa('0x11')](function(_0x1c877e){logger[_0x96fa('0xd')](_0x96fa('0x12'),_0x1c877e[_0x96fa('0xe')],_0x3a9ec1);_0x13c5e2(_0x1d370c[_0x96fa('0xd')](0x1f4,_0x1c877e[_0x96fa('0xe')]));});});};exports['UpdateVoiceAgentReport']=function(_0x3d77c9){var _0x31a887=this;return new Promise(function(_0x4ddbde,_0x131030){return db[_0x96fa('0x17')]['update'](_0x3d77c9[_0x96fa('0x14')],{'raw':_0x3d77c9[_0x96fa('0x15')]?_0x3d77c9[_0x96fa('0x15')][_0x96fa('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d77c9[_0x96fa('0x15')]?_0x3d77c9[_0x96fa('0x15')][_0x96fa('0x18')]||null:null,'attributes':_0x3d77c9[_0x96fa('0x15')]?_0x3d77c9[_0x96fa('0x15')][_0x96fa('0x19')]||null:null,'limit':_0x3d77c9[_0x96fa('0x15')]?_0x3d77c9[_0x96fa('0x15')][_0x96fa('0x1a')]||null:null})[_0x96fa('0x7')](function(_0x4a2bdc){logger[_0x96fa('0xf')](_0x96fa('0x1b'),_0x3d77c9);logger[_0x96fa('0xa')](_0x96fa('0x1b'),_0x3d77c9,JSON[_0x96fa('0xc')](_0x4a2bdc));_0x4ddbde(_0x4a2bdc);})[_0x96fa('0x11')](function(_0x3afddd){logger[_0x96fa('0xd')]('UpdateVoiceAgentReport',_0x3afddd[_0x96fa('0xe')],_0x3d77c9);_0x131030(_0x31a887[_0x96fa('0xd')](0x1f4,_0x3afddd[_0x96fa('0xe')]));});});}; \ No newline at end of file +var _0xff05=['VoiceAgentReport','create','UpdateVoiceAgentReport','update','body','raw','options','where','limit','lodash','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceAgentReport,\x20%s,\x20%s','message','info','result','catch','CreateVoiceAgentReport'];(function(_0x36aad0,_0x3d2e17){var _0x31e987=function(_0x2d0fe4){while(--_0x2d0fe4){_0x36aad0['push'](_0x36aad0['shift']());}};_0x31e987(++_0x3d2e17);}(_0xff05,0x19c));var _0x5ff0=function(_0x27ffd1,_0x3c286f){_0x27ffd1=_0x27ffd1-0x0;var _0x418ded=_0xff05[_0x27ffd1];return _0x418ded;};'use strict';var _=require(_0x5ff0('0x0'));var util=require('util');var moment=require(_0x5ff0('0x1'));var BPromise=require(_0x5ff0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5ff0('0x3'));var logger=require(_0x5ff0('0x4'))(_0x5ff0('0x5'));var config=require(_0x5ff0('0x6'));var jayson=require(_0x5ff0('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x7908eb,_0x513786,_0x38285a){return new BPromise(function(_0x57b5ea,_0x5b23db){return client[_0x5ff0('0x8')](_0x7908eb,_0x38285a)[_0x5ff0('0x9')](function(_0x2fbb06){logger['info']('VoiceAgentReport,\x20%s,\x20%s',_0x513786,_0x5ff0('0xa'));logger[_0x5ff0('0xb')](_0x5ff0('0xc'),_0x513786,_0x5ff0('0xa'),JSON[_0x5ff0('0xd')](_0x2fbb06));if(_0x2fbb06[_0x5ff0('0xe')]){if(_0x2fbb06['error'][_0x5ff0('0xf')]===0x1f4){logger['error'](_0x5ff0('0x10'),_0x513786,_0x2fbb06[_0x5ff0('0xe')][_0x5ff0('0x11')]);return _0x5b23db(_0x2fbb06[_0x5ff0('0xe')][_0x5ff0('0x11')]);}logger[_0x5ff0('0xe')](_0x5ff0('0x10'),_0x513786,_0x2fbb06['error'][_0x5ff0('0x11')]);return _0x57b5ea(_0x2fbb06[_0x5ff0('0xe')]['message']);}else{logger[_0x5ff0('0x12')](_0x5ff0('0x10'),_0x513786,'request\x20sent');_0x57b5ea(_0x2fbb06[_0x5ff0('0x13')]['message']);}})[_0x5ff0('0x14')](function(_0x59188e){logger['error'](_0x5ff0('0x10'),_0x513786,_0x59188e);_0x5b23db(_0x59188e);});});}exports[_0x5ff0('0x15')]=function(_0x1721fc){var _0x1de948=this;return new Promise(function(_0x26cedf,_0x487843){return db[_0x5ff0('0x16')][_0x5ff0('0x17')](_0x1721fc['body'],{'raw':_0x1721fc['options']?_0x1721fc['options']['raw']===undefined?!![]:![]:!![]})[_0x5ff0('0x9')](function(_0x328b57){logger[_0x5ff0('0x12')](_0x5ff0('0x15'),_0x1721fc);logger[_0x5ff0('0xb')](_0x5ff0('0x15'),_0x1721fc,JSON[_0x5ff0('0xd')](_0x328b57));_0x26cedf(_0x328b57);})[_0x5ff0('0x14')](function(_0x52a641){logger[_0x5ff0('0xe')](_0x5ff0('0x15'),_0x52a641[_0x5ff0('0x11')],_0x1721fc);_0x487843(_0x1de948[_0x5ff0('0xe')](0x1f4,_0x52a641['message']));});});};exports[_0x5ff0('0x18')]=function(_0x3bafca){var _0x35f6b0=this;return new Promise(function(_0x481b93,_0x2d0576){return db[_0x5ff0('0x16')][_0x5ff0('0x19')](_0x3bafca[_0x5ff0('0x1a')],{'raw':_0x3bafca['options']?_0x3bafca['options'][_0x5ff0('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3bafca[_0x5ff0('0x1c')]?_0x3bafca['options'][_0x5ff0('0x1d')]||null:null,'attributes':_0x3bafca[_0x5ff0('0x1c')]?_0x3bafca['options']['attributes']||null:null,'limit':_0x3bafca['options']?_0x3bafca[_0x5ff0('0x1c')][_0x5ff0('0x1e')]||null:null})['then'](function(_0x7af939){logger[_0x5ff0('0x12')]('UpdateVoiceAgentReport',_0x3bafca);logger['debug'](_0x5ff0('0x18'),_0x3bafca,JSON[_0x5ff0('0xd')](_0x7af939));_0x481b93(_0x7af939);})[_0x5ff0('0x14')](function(_0x336421){logger[_0x5ff0('0xe')](_0x5ff0('0x18'),_0x336421[_0x5ff0('0x11')],_0x3bafca);_0x2d0576(_0x35f6b0['error'](0x1f4,_0x336421[_0x5ff0('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index ccb1c69..da7ba8b 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 _0x9c5a=['fs-extra','../../components/interaction/service','../../config/environment','get','index','describe','isAuthenticated','show','create','update','delete','/:id','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x1ea689,_0x388dfc){_0x1ea689=_0x1ea689-0x0;var _0x117d1c=_0x9c5a[_0x1ea689];return _0x117d1c;};'use strict';var multer=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var path=require('path');var timeout=require(_0xa9c5('0x2'));var express=require(_0xa9c5('0x3'));var router=express[_0xa9c5('0x4')]();var fs_extra=require(_0xa9c5('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa9c5('0x6'));var config=require(_0xa9c5('0x7'));var controller=require('./voiceCallReport.controller');router[_0xa9c5('0x8')]('/',auth['isAuthenticated'](),controller[_0xa9c5('0x9')]);router[_0xa9c5('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xa9c5('0xa')]);router[_0xa9c5('0x8')]('/:id',auth[_0xa9c5('0xb')](),controller[_0xa9c5('0xc')]);router['post']('/',auth[_0xa9c5('0xb')](),controller[_0xa9c5('0xd')]);router['put']('/:id',auth[_0xa9c5('0xb')](),controller[_0xa9c5('0xe')]);router[_0xa9c5('0xf')](_0xa9c5('0x10'),auth[_0xa9c5('0xb')](),controller[_0xa9c5('0x11')]);module[_0xa9c5('0x12')]=router; \ No newline at end of file +var _0xd0bb=['express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','destroy','exports','multer','util','path'];(function(_0x470200,_0x5449fe){var _0x18035a=function(_0x176a49){while(--_0x176a49){_0x470200['push'](_0x470200['shift']());}};_0x18035a(++_0x5449fe);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x6186a8,_0x5385c4){_0x6186a8=_0x6186a8-0x0;var _0xf72248=_0xd0bb[_0x6186a8];return _0xf72248;};'use strict';var multer=require(_0xbd0b('0x0'));var util=require(_0xbd0b('0x1'));var path=require(_0xbd0b('0x2'));var timeout=require('connect-timeout');var express=require(_0xbd0b('0x3'));var router=express['Router']();var fs_extra=require(_0xbd0b('0x4'));var auth=require(_0xbd0b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbd0b('0x6'));var controller=require('./voiceCallReport.controller');router[_0xbd0b('0x7')]('/',auth[_0xbd0b('0x8')](),controller[_0xbd0b('0x9')]);router[_0xbd0b('0x7')](_0xbd0b('0xa'),auth['isAuthenticated'](),controller[_0xbd0b('0xb')]);router[_0xbd0b('0x7')](_0xbd0b('0xc'),auth[_0xbd0b('0x8')](),controller[_0xbd0b('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbd0b('0xe')]);router[_0xbd0b('0xf')]('/:id',auth[_0xbd0b('0x8')](),controller[_0xbd0b('0x10')]);router['delete'](_0xbd0b('0xc'),auth[_0xbd0b('0x8')](),controller[_0xbd0b('0x11')]);module[_0xbd0b('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index faaa54a..b1092dd 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 _0x3f9b=['internal','dialer','DATE','INTEGER','STRING','inbound'];(function(_0x32dc62,_0xb7f67c){var _0x307f88=function(_0x4ef903){while(--_0x4ef903){_0x32dc62['push'](_0x32dc62['shift']());}};_0x307f88(++_0xb7f67c);}(_0x3f9b,0x11e));var _0xb3f9=function(_0x12de80,_0x2c6f81){_0x12de80=_0x12de80-0x0;var _0x3613d4=_0x3f9b[_0x12de80];return _0x3613d4;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xb3f9('0x0')]},'type':{'type':Sequelize['ENUM'](_0xb3f9('0x1'),_0xb3f9('0x2'),'outbound','inbound-fax','outbound-fax',_0xb3f9('0x3'))},'tag':{'type':Sequelize[_0xb3f9('0x0')]},'accountcode':{'type':Sequelize[_0xb3f9('0x0')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0xb3f9('0x0')]},'destinationcontext':{'type':Sequelize[_0xb3f9('0x0')]},'callerid':{'type':Sequelize[_0xb3f9('0x0')]},'channel':{'type':Sequelize[_0xb3f9('0x0')]},'destinationchannel':{'type':Sequelize[_0xb3f9('0x0')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0xb3f9('0x4')]},'systemanswertime':{'type':Sequelize[_0xb3f9('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xb3f9('0x4')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xb3f9('0x5')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xb3f9('0x0')]},'amaflags':{'type':Sequelize[_0xb3f9('0x0')]},'userfield':{'type':Sequelize[_0xb3f9('0x0')]},'userDisposition':{'type':Sequelize[_0xb3f9('0x0')]},'userSecondDisposition':{'type':Sequelize[_0xb3f9('0x0')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xb3f9('0x0')]},'prefix':{'type':Sequelize[_0xb3f9('0x0')]},'routeid':{'type':Sequelize[_0xb3f9('0x5')]},'sipcallid':{'type':Sequelize[_0xb3f9('0x0')]}}; \ No newline at end of file +var _0x8357=['sequelize','exports','STRING','inbound','internal','outbound','inbound-fax','outbound-fax','TEXT','DATE','INTEGER'];(function(_0x580730,_0x423233){var _0xf5629a=function(_0x5f3d05){while(--_0x5f3d05){_0x580730['push'](_0x580730['shift']());}};_0xf5629a(++_0x423233);}(_0x8357,0x1e4));var _0x7835=function(_0x5aa889,_0x4de735){_0x5aa889=_0x5aa889-0x0;var _0x353653=_0x8357[_0x5aa889];return _0x353653;};'use strict';var Sequelize=require(_0x7835('0x0'));module[_0x7835('0x1')]={'uniqueid':{'type':Sequelize[_0x7835('0x2')]},'type':{'type':Sequelize['ENUM'](_0x7835('0x3'),_0x7835('0x4'),_0x7835('0x5'),_0x7835('0x6'),_0x7835('0x7'),'dialer')},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x7835('0x2')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0x7835('0x2')]},'destinationcontext':{'type':Sequelize[_0x7835('0x2')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x7835('0x2')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x7835('0x8')]},'starttime':{'type':Sequelize[_0x7835('0x9')]},'systemanswertime':{'type':Sequelize[_0x7835('0x9')]},'answertime':{'type':Sequelize[_0x7835('0x9')]},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize[_0x7835('0xa')]},'billableseconds':{'type':Sequelize[_0x7835('0xa')]},'mohtime':{'type':Sequelize[_0x7835('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x7835('0x2')]},'amaflags':{'type':Sequelize[_0x7835('0x2')]},'userfield':{'type':Sequelize[_0x7835('0x2')]},'userDisposition':{'type':Sequelize[_0x7835('0x2')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0x7835('0x2')]},'note':{'type':Sequelize[_0x7835('0x2')]},'prefix':{'type':Sequelize[_0x7835('0x2')]},'routeid':{'type':Sequelize[_0x7835('0xa')]},'sipcallid':{'type':Sequelize[_0x7835('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 86942d8..a1e820a 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 _0x0b0e=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','offset','limit','set','json','apply','reject','save','then','destroy','error','stack','name','index','map','VoiceCallReport','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','count','includeAll','fullname','alias','User','findAll','rows','params','find','create','body','catch','describe','update','uniqueid','user','eml-format','zip-dir','request-promise','moment'];(function(_0xc63a6d,_0x194434){var _0x52ce2d=function(_0x3eff16){while(--_0x3eff16){_0xc63a6d['push'](_0xc63a6d['shift']());}};_0x52ce2d(++_0x194434);}(_0x0b0e,0x187));var _0xe0b0=function(_0x5cbf0e,_0x4cd140){_0x5cbf0e=_0x5cbf0e-0x0;var _0x1c76f8=_0x0b0e[_0x5cbf0e];return _0x1c76f8;};'use strict';var emlformat=require(_0xe0b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0b0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0b0('0x2'));var moment=require(_0xe0b0('0x3'));var BPromise=require(_0xe0b0('0x4'));var Mustache=require(_0xe0b0('0x5'));var util=require(_0xe0b0('0x6'));var path=require(_0xe0b0('0x7'));var sox=require(_0xe0b0('0x8'));var csv=require(_0xe0b0('0x9'));var ejs=require(_0xe0b0('0xa'));var fs=require('fs');var fs_extra=require(_0xe0b0('0xb'));var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0x9'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var hardwareService=require(_0xe0b0('0x13'));var logger=require('../../config/logger')(_0xe0b0('0x14'));var utils=require(_0xe0b0('0x15'));var config=require(_0xe0b0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe0b0('0x17'))['db'];function respondWithStatusCode(_0x1c358a,_0x3cc19a){_0x3cc19a=_0x3cc19a||0xcc;return function(_0x45f914){if(_0x45f914){return _0x1c358a[_0xe0b0('0x18')](_0x3cc19a);}return _0x1c358a['status'](_0x3cc19a)[_0xe0b0('0x19')]();};}function respondWithResult(_0x154de6,_0x743318){_0x743318=_0x743318||0xc8;return function(_0x24babd){if(_0x24babd){return _0x154de6[_0xe0b0('0x1a')](_0x743318)['json'](_0x24babd);}};}function respondWithFilteredResult(_0x41a7e2,_0x5adb01){return function(_0x35cb40){if(_0x35cb40){var _0xadee6e=typeof _0x5adb01['offset']===_0xe0b0('0x1b')&&typeof _0x5adb01['limit']===_0xe0b0('0x1b');var _0x100204=_0x35cb40['count'];var _0x54a3eb=_0xadee6e?0x0:_0x5adb01[_0xe0b0('0x1c')];var _0x50a441=_0xadee6e?_0x35cb40['count']:_0x5adb01['offset']+_0x5adb01[_0xe0b0('0x1d')];var _0x50fa4a;if(_0x50a441>=_0x100204){_0x50a441=_0x100204;_0x50fa4a=0xc8;}else{_0x50fa4a=0xce;}_0x41a7e2['status'](_0x50fa4a);return _0x41a7e2[_0xe0b0('0x1e')]('Content-Range',_0x54a3eb+'-'+_0x50a441+'/'+_0x100204)[_0xe0b0('0x1f')](_0x35cb40);}return null;};}function patchUpdates(_0x5dba2f){return function(_0x2c84cc){try{jsonpatch[_0xe0b0('0x20')](_0x2c84cc,_0x5dba2f,!![]);}catch(_0x3e10b3){return BPromise[_0xe0b0('0x21')](_0x3e10b3);}return _0x2c84cc[_0xe0b0('0x22')]();};}function saveUpdates(_0x58b804,_0x4cae54){return function(_0x2fa820){if(_0x2fa820){return _0x2fa820['update'](_0x58b804)[_0xe0b0('0x23')](function(_0x31b5f8){return _0x31b5f8;});}return null;};}function removeEntity(_0x513e63,_0x170ad8){return function(_0x503883){if(_0x503883){return _0x503883[_0xe0b0('0x24')]()['then'](function(){_0x513e63[_0xe0b0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e5c88,_0x4de537){return function(_0x4700cc){if(!_0x4700cc){_0x3e5c88['sendStatus'](0x194);}return _0x4700cc;};}function handleError(_0x3c221d,_0x5c5317){_0x5c5317=_0x5c5317||0x1f4;return function(_0x362aba){logger[_0xe0b0('0x25')](_0x362aba[_0xe0b0('0x26')]);if(_0x362aba[_0xe0b0('0x27')]){delete _0x362aba[_0xe0b0('0x27')];}_0x3c221d[_0xe0b0('0x1a')](_0x5c5317)['send'](_0x362aba);};}exports[_0xe0b0('0x28')]=function(_0x1b8aa8,_0x5b7a64){var _0x15e13b={},_0x419b1f={},_0x36d137={'count':0x0,'rows':[]};var _0x1d5759=_[_0xe0b0('0x29')](db[_0xe0b0('0x2a')][_0xe0b0('0x2b')],function(_0x4fb3b7){return{'name':_0x4fb3b7[_0xe0b0('0x2c')],'type':_0x4fb3b7[_0xe0b0('0x2d')]['key']};});_0x419b1f['model']=_[_0xe0b0('0x29')](_0x1d5759,_0xe0b0('0x27'));_0x419b1f[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x1b8aa8[_0xe0b0('0x2e')]);_0x419b1f['filters']=_[_0xe0b0('0x30')](_0x419b1f[_0xe0b0('0x31')],_0x419b1f[_0xe0b0('0x2e')]);_0x15e13b[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x419b1f['model'],qs[_0xe0b0('0x33')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x33')]));_0x15e13b[_0xe0b0('0x32')]=_0x15e13b[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x15e13b[_0xe0b0('0x32')]:_0x419b1f[_0xe0b0('0x31')];if(!_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x35')](_0xe0b0('0x36'))){_0x15e13b[_0xe0b0('0x1d')]=qs[_0xe0b0('0x1d')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1d')]);_0x15e13b['offset']=qs[_0xe0b0('0x1c')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1c')]);}_0x15e13b[_0xe0b0('0x37')]=qs[_0xe0b0('0x38')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x38')]);_0x15e13b['where']=qs['filters'](_['pick'](_0x1b8aa8['query'],_0x419b1f[_0xe0b0('0x39')]),_0x1d5759);if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]){_0x15e13b['where']=_[_0xe0b0('0x3b')](_0x15e13b[_0xe0b0('0x3c')],{'$or':_[_0xe0b0('0x29')](_0x1d5759,function(_0x297c64){if(_0x297c64['type']!==_0xe0b0('0x3d')){var _0xfbb61d={};_0xfbb61d[_0x297c64[_0xe0b0('0x27')]]={'$like':'%'+_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]+'%'};return _0xfbb61d;}})});}_0x15e13b=_[_0xe0b0('0x3b')]({},_0x15e13b,_0x1b8aa8[_0xe0b0('0x3e')]);var _0x115a69={'where':_0x15e13b[_0xe0b0('0x3c')]};return db['VoiceCallReport'][_0xe0b0('0x3f')](_0x115a69)['then'](function(_0x34178d){_0x36d137[_0xe0b0('0x3f')]=_0x34178d;if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x15e13b['include']=[{'attributes':['id',_0xe0b0('0x27'),_0xe0b0('0x41'),_0xe0b0('0x42')],'model':db[_0xe0b0('0x43')],'as':_0xe0b0('0x43')}];}return db[_0xe0b0('0x2a')][_0xe0b0('0x44')](_0x15e13b);})[_0xe0b0('0x23')](function(_0x52ffe4){_0x36d137[_0xe0b0('0x45')]=_0x52ffe4;return _0x36d137;})[_0xe0b0('0x23')](respondWithFilteredResult(_0x5b7a64,_0x15e13b))['catch'](handleError(_0x5b7a64,null));};exports['show']=function(_0x327fb4,_0x247f8d){var _0x56e7df={'raw':!![],'where':{'id':_0x327fb4[_0xe0b0('0x46')]['id']}},_0x18a59d={};_0x18a59d[_0xe0b0('0x31')]=_[_0xe0b0('0x2f')](db[_0xe0b0('0x2a')]['rawAttributes']);_0x18a59d['query']=_['keys'](_0x327fb4[_0xe0b0('0x2e')]);_0x18a59d[_0xe0b0('0x39')]=_['intersection'](_0x18a59d[_0xe0b0('0x31')],_0x18a59d[_0xe0b0('0x2e')]);_0x56e7df[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x18a59d[_0xe0b0('0x31')],qs['fields'](_0x327fb4['query'][_0xe0b0('0x33')]));_0x56e7df[_0xe0b0('0x32')]=_0x56e7df[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x56e7df[_0xe0b0('0x32')]:_0x18a59d['model'];if(_0x327fb4[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x56e7df['include']=[{'all':!![]}];}_0x56e7df=_['merge']({},_0x56e7df,_0x327fb4['options']);return db[_0xe0b0('0x2a')][_0xe0b0('0x47')](_0x56e7df)[_0xe0b0('0x23')](handleEntityNotFound(_0x247f8d,null))[_0xe0b0('0x23')](respondWithResult(_0x247f8d,null))['catch'](handleError(_0x247f8d,null));};exports[_0xe0b0('0x48')]=function(_0x87d8f3,_0x483f12){return db['VoiceCallReport'][_0xe0b0('0x48')](_0x87d8f3[_0xe0b0('0x49')],{})['then'](respondWithResult(_0x483f12,0xc9))[_0xe0b0('0x4a')](handleError(_0x483f12,null));};exports[_0xe0b0('0x24')]=function(_0x504284,_0x5cb2b6){return db[_0xe0b0('0x2a')]['find']({'where':{'id':_0x504284[_0xe0b0('0x46')]['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x5cb2b6,null))[_0xe0b0('0x23')](removeEntity(_0x5cb2b6,null))[_0xe0b0('0x4a')](handleError(_0x5cb2b6,null));};exports[_0xe0b0('0x4b')]=function(_0xf9e694,_0x5f5486){return db['VoiceCallReport'][_0xe0b0('0x4b')]()['then'](respondWithResult(_0x5f5486,null))['catch'](handleError(_0x5f5486,null));};exports[_0xe0b0('0x4c')]=function(_0x222174,_0x54cf7b){if(_0x222174['body'][_0xe0b0('0x4d')]){delete _0x222174[_0xe0b0('0x49')][_0xe0b0('0x4d')];}return db[_0xe0b0('0x2a')][_0xe0b0('0x47')]({'where':{'uniqueid':_0x222174[_0xe0b0('0x46')]['id'],'UserId':{'$or':[null,_0x222174[_0xe0b0('0x4e')]['id']]}}})['then'](handleEntityNotFound(_0x54cf7b,null))[_0xe0b0('0x23')](saveUpdates(_0x222174['body'],null))[_0xe0b0('0x23')](respondWithResult(_0x54cf7b,null))['catch'](handleError(_0x54cf7b,null));}; \ No newline at end of file +var _0x0b0e=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','offset','limit','set','json','apply','reject','save','then','destroy','error','stack','name','index','map','VoiceCallReport','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','count','includeAll','fullname','alias','User','findAll','rows','params','find','create','body','catch','describe','update','uniqueid','user','eml-format','zip-dir','request-promise','moment'];(function(_0x11986d,_0x12a6f0){var _0xbf58a5=function(_0x58da34){while(--_0x58da34){_0x11986d['push'](_0x11986d['shift']());}};_0xbf58a5(++_0x12a6f0);}(_0x0b0e,0x187));var _0xe0b0=function(_0x5d5c49,_0x528f94){_0x5d5c49=_0x5d5c49-0x0;var _0x41cb72=_0x0b0e[_0x5d5c49];return _0x41cb72;};'use strict';var emlformat=require(_0xe0b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0b0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0b0('0x2'));var moment=require(_0xe0b0('0x3'));var BPromise=require(_0xe0b0('0x4'));var Mustache=require(_0xe0b0('0x5'));var util=require(_0xe0b0('0x6'));var path=require(_0xe0b0('0x7'));var sox=require(_0xe0b0('0x8'));var csv=require(_0xe0b0('0x9'));var ejs=require(_0xe0b0('0xa'));var fs=require('fs');var fs_extra=require(_0xe0b0('0xb'));var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0x9'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var hardwareService=require(_0xe0b0('0x13'));var logger=require('../../config/logger')(_0xe0b0('0x14'));var utils=require(_0xe0b0('0x15'));var config=require(_0xe0b0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe0b0('0x17'))['db'];function respondWithStatusCode(_0x1c358a,_0x3cc19a){_0x3cc19a=_0x3cc19a||0xcc;return function(_0x45f914){if(_0x45f914){return _0x1c358a[_0xe0b0('0x18')](_0x3cc19a);}return _0x1c358a['status'](_0x3cc19a)[_0xe0b0('0x19')]();};}function respondWithResult(_0x154de6,_0x743318){_0x743318=_0x743318||0xc8;return function(_0x24babd){if(_0x24babd){return _0x154de6[_0xe0b0('0x1a')](_0x743318)['json'](_0x24babd);}};}function respondWithFilteredResult(_0x41a7e2,_0x5adb01){return function(_0x35cb40){if(_0x35cb40){var _0xadee6e=typeof _0x5adb01['offset']===_0xe0b0('0x1b')&&typeof _0x5adb01['limit']===_0xe0b0('0x1b');var _0x100204=_0x35cb40['count'];var _0x54a3eb=_0xadee6e?0x0:_0x5adb01[_0xe0b0('0x1c')];var _0x50a441=_0xadee6e?_0x35cb40['count']:_0x5adb01['offset']+_0x5adb01[_0xe0b0('0x1d')];var _0x50fa4a;if(_0x50a441>=_0x100204){_0x50a441=_0x100204;_0x50fa4a=0xc8;}else{_0x50fa4a=0xce;}_0x41a7e2['status'](_0x50fa4a);return _0x41a7e2[_0xe0b0('0x1e')]('Content-Range',_0x54a3eb+'-'+_0x50a441+'/'+_0x100204)[_0xe0b0('0x1f')](_0x35cb40);}return null;};}function patchUpdates(_0x5dba2f){return function(_0x2c84cc){try{jsonpatch[_0xe0b0('0x20')](_0x2c84cc,_0x5dba2f,!![]);}catch(_0x3e10b3){return BPromise[_0xe0b0('0x21')](_0x3e10b3);}return _0x2c84cc[_0xe0b0('0x22')]();};}function saveUpdates(_0x58b804,_0x4cae54){return function(_0x2fa820){if(_0x2fa820){return _0x2fa820['update'](_0x58b804)[_0xe0b0('0x23')](function(_0x31b5f8){return _0x31b5f8;});}return null;};}function removeEntity(_0x513e63,_0x170ad8){return function(_0x503883){if(_0x503883){return _0x503883[_0xe0b0('0x24')]()['then'](function(){_0x513e63[_0xe0b0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e5c88,_0x4de537){return function(_0x4700cc){if(!_0x4700cc){_0x3e5c88['sendStatus'](0x194);}return _0x4700cc;};}function handleError(_0x3c221d,_0x5c5317){_0x5c5317=_0x5c5317||0x1f4;return function(_0x362aba){logger[_0xe0b0('0x25')](_0x362aba[_0xe0b0('0x26')]);if(_0x362aba[_0xe0b0('0x27')]){delete _0x362aba[_0xe0b0('0x27')];}_0x3c221d[_0xe0b0('0x1a')](_0x5c5317)['send'](_0x362aba);};}exports[_0xe0b0('0x28')]=function(_0x1b8aa8,_0x5b7a64){var _0x15e13b={},_0x419b1f={},_0x36d137={'count':0x0,'rows':[]};var _0x1d5759=_[_0xe0b0('0x29')](db[_0xe0b0('0x2a')][_0xe0b0('0x2b')],function(_0x4fb3b7){return{'name':_0x4fb3b7[_0xe0b0('0x2c')],'type':_0x4fb3b7[_0xe0b0('0x2d')]['key']};});_0x419b1f['model']=_[_0xe0b0('0x29')](_0x1d5759,_0xe0b0('0x27'));_0x419b1f[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x1b8aa8[_0xe0b0('0x2e')]);_0x419b1f['filters']=_[_0xe0b0('0x30')](_0x419b1f[_0xe0b0('0x31')],_0x419b1f[_0xe0b0('0x2e')]);_0x15e13b[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x419b1f['model'],qs[_0xe0b0('0x33')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x33')]));_0x15e13b[_0xe0b0('0x32')]=_0x15e13b[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x15e13b[_0xe0b0('0x32')]:_0x419b1f[_0xe0b0('0x31')];if(!_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x35')](_0xe0b0('0x36'))){_0x15e13b[_0xe0b0('0x1d')]=qs[_0xe0b0('0x1d')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1d')]);_0x15e13b['offset']=qs[_0xe0b0('0x1c')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1c')]);}_0x15e13b[_0xe0b0('0x37')]=qs[_0xe0b0('0x38')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x38')]);_0x15e13b['where']=qs['filters'](_['pick'](_0x1b8aa8['query'],_0x419b1f[_0xe0b0('0x39')]),_0x1d5759);if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]){_0x15e13b['where']=_[_0xe0b0('0x3b')](_0x15e13b[_0xe0b0('0x3c')],{'$or':_[_0xe0b0('0x29')](_0x1d5759,function(_0x297c64){if(_0x297c64['type']!==_0xe0b0('0x3d')){var _0xfbb61d={};_0xfbb61d[_0x297c64[_0xe0b0('0x27')]]={'$like':'%'+_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]+'%'};return _0xfbb61d;}})});}_0x15e13b=_[_0xe0b0('0x3b')]({},_0x15e13b,_0x1b8aa8[_0xe0b0('0x3e')]);var _0x115a69={'where':_0x15e13b[_0xe0b0('0x3c')]};return db['VoiceCallReport'][_0xe0b0('0x3f')](_0x115a69)['then'](function(_0x34178d){_0x36d137[_0xe0b0('0x3f')]=_0x34178d;if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x15e13b['include']=[{'attributes':['id',_0xe0b0('0x27'),_0xe0b0('0x41'),_0xe0b0('0x42')],'model':db[_0xe0b0('0x43')],'as':_0xe0b0('0x43')}];}return db[_0xe0b0('0x2a')][_0xe0b0('0x44')](_0x15e13b);})[_0xe0b0('0x23')](function(_0x52ffe4){_0x36d137[_0xe0b0('0x45')]=_0x52ffe4;return _0x36d137;})[_0xe0b0('0x23')](respondWithFilteredResult(_0x5b7a64,_0x15e13b))['catch'](handleError(_0x5b7a64,null));};exports['show']=function(_0x327fb4,_0x247f8d){var _0x56e7df={'raw':!![],'where':{'id':_0x327fb4[_0xe0b0('0x46')]['id']}},_0x18a59d={};_0x18a59d[_0xe0b0('0x31')]=_[_0xe0b0('0x2f')](db[_0xe0b0('0x2a')]['rawAttributes']);_0x18a59d['query']=_['keys'](_0x327fb4[_0xe0b0('0x2e')]);_0x18a59d[_0xe0b0('0x39')]=_['intersection'](_0x18a59d[_0xe0b0('0x31')],_0x18a59d[_0xe0b0('0x2e')]);_0x56e7df[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x18a59d[_0xe0b0('0x31')],qs['fields'](_0x327fb4['query'][_0xe0b0('0x33')]));_0x56e7df[_0xe0b0('0x32')]=_0x56e7df[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x56e7df[_0xe0b0('0x32')]:_0x18a59d['model'];if(_0x327fb4[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x56e7df['include']=[{'all':!![]}];}_0x56e7df=_['merge']({},_0x56e7df,_0x327fb4['options']);return db[_0xe0b0('0x2a')][_0xe0b0('0x47')](_0x56e7df)[_0xe0b0('0x23')](handleEntityNotFound(_0x247f8d,null))[_0xe0b0('0x23')](respondWithResult(_0x247f8d,null))['catch'](handleError(_0x247f8d,null));};exports[_0xe0b0('0x48')]=function(_0x87d8f3,_0x483f12){return db['VoiceCallReport'][_0xe0b0('0x48')](_0x87d8f3[_0xe0b0('0x49')],{})['then'](respondWithResult(_0x483f12,0xc9))[_0xe0b0('0x4a')](handleError(_0x483f12,null));};exports[_0xe0b0('0x24')]=function(_0x504284,_0x5cb2b6){return db[_0xe0b0('0x2a')]['find']({'where':{'id':_0x504284[_0xe0b0('0x46')]['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x5cb2b6,null))[_0xe0b0('0x23')](removeEntity(_0x5cb2b6,null))[_0xe0b0('0x4a')](handleError(_0x5cb2b6,null));};exports[_0xe0b0('0x4b')]=function(_0xf9e694,_0x5f5486){return db['VoiceCallReport'][_0xe0b0('0x4b')]()['then'](respondWithResult(_0x5f5486,null))['catch'](handleError(_0x5f5486,null));};exports[_0xe0b0('0x4c')]=function(_0x222174,_0x54cf7b){if(_0x222174['body'][_0xe0b0('0x4d')]){delete _0x222174[_0xe0b0('0x49')][_0xe0b0('0x4d')];}return db[_0xe0b0('0x2a')][_0xe0b0('0x47')]({'where':{'uniqueid':_0x222174[_0xe0b0('0x46')]['id'],'UserId':{'$or':[null,_0x222174[_0xe0b0('0x4e')]['id']]}}})['then'](handleEntityNotFound(_0x54cf7b,null))[_0xe0b0('0x23')](saveUpdates(_0x222174['body'],null))[_0xe0b0('0x23')](respondWithResult(_0x54cf7b,null))['catch'](handleError(_0x54cf7b,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 9c8b06d..a7ba5e6 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 _0x7d32=['./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid','lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x260149,_0x49b979){var _0x1b69a1=function(_0xdd2b7d){while(--_0xdd2b7d){_0x260149['push'](_0x260149['shift']());}};_0x1b69a1(++_0x49b979);}(_0x7d32,0x1c0));var _0x27d3=function(_0x2b51a8,_0x12ca08){_0x2b51a8=_0x2b51a8-0x0;var _0x369802=_0x7d32[_0x2b51a8];return _0x369802;};'use strict';var _=require(_0x27d3('0x0'));var util=require('util');var logger=require(_0x27d3('0x1'))(_0x27d3('0x2'));var moment=require('moment');var BPromise=require(_0x27d3('0x3'));var rp=require(_0x27d3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x27d3('0x5'));var config=require(_0x27d3('0x6'));var attributes=require(_0x27d3('0x7'));module[_0x27d3('0x8')]=function(_0x4fc61d,_0x15da16){return _0x4fc61d[_0x27d3('0x9')](_0x27d3('0xa'),attributes,{'tableName':_0x27d3('0xb'),'paranoid':![],'indexes':[{'fields':[_0x27d3('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb9ee=['VoiceCallReport','report_call','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./voiceCallReport.attributes','exports','define'];(function(_0x519a92,_0x9c2117){var _0x2ce3fc=function(_0x59e58c){while(--_0x59e58c){_0x519a92['push'](_0x519a92['shift']());}};_0x2ce3fc(++_0x9c2117);}(_0xb9ee,0x12d));var _0xeb9e=function(_0x15b380,_0x1a3c5f){_0x15b380=_0x15b380-0x0;var _0x232c5c=_0xb9ee[_0x15b380];return _0x232c5c;};'use strict';var _=require(_0xeb9e('0x0'));var util=require(_0xeb9e('0x1'));var logger=require(_0xeb9e('0x2'))('api');var moment=require(_0xeb9e('0x3'));var BPromise=require(_0xeb9e('0x4'));var rp=require(_0xeb9e('0x5'));var fs=require('fs');var path=require(_0xeb9e('0x6'));var rimraf=require(_0xeb9e('0x7'));var config=require('../../config/environment');var attributes=require(_0xeb9e('0x8'));module[_0xeb9e('0x9')]=function(_0x43daa8,_0x5b35fe){return _0x43daa8[_0xeb9e('0xa')](_0xeb9e('0xb'),attributes,{'tableName':_0xeb9e('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index d488b99..96a4afb 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 _0x8aab=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','VoiceCallReport,\x20%s,\x20%s','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','GetVoiceCallReport','findAll','options','attributes','limit','map','model','include','catch','CreateVoiceCallReport','VoiceCallReport','create','body','raw','update','where'];(function(_0xc7e482,_0x8ec72d){var _0x958069=function(_0x24bdf9){while(--_0x24bdf9){_0xc7e482['push'](_0xc7e482['shift']());}};_0x958069(++_0x8ec72d);}(_0x8aab,0x1c7));var _0xb8aa=function(_0x12a9be,_0x2ec872){_0x12a9be=_0x12a9be-0x0;var _0x55a9fd=_0x8aab[_0x12a9be];return _0x55a9fd;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb8aa('0x0'));var BPromise=require(_0xb8aa('0x1'));var rs=require(_0xb8aa('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb8aa('0x3'))['db'];var utils=require(_0xb8aa('0x4'));var logger=require(_0xb8aa('0x5'))('rpc');var config=require(_0xb8aa('0x6'));var jayson=require(_0xb8aa('0x7'));var client=jayson[_0xb8aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe99c90,_0x217ef4,_0x45540b){return new BPromise(function(_0x499c52,_0x18295b){return client['request'](_0xe99c90,_0x45540b)[_0xb8aa('0x9')](function(_0x467ee2){logger[_0xb8aa('0xa')](_0xb8aa('0xb'),_0x217ef4,'request\x20sent');logger[_0xb8aa('0xc')](_0xb8aa('0xd'),_0x217ef4,_0xb8aa('0xe'),JSON[_0xb8aa('0xf')](_0x467ee2));if(_0x467ee2[_0xb8aa('0x10')]){if(_0x467ee2[_0xb8aa('0x10')]['code']===0x1f4){logger[_0xb8aa('0x10')]('VoiceCallReport,\x20%s,\x20%s',_0x217ef4,_0x467ee2['error']['message']);return _0x18295b(_0x467ee2[_0xb8aa('0x10')][_0xb8aa('0x11')]);}logger[_0xb8aa('0x10')]('VoiceCallReport,\x20%s,\x20%s',_0x217ef4,_0x467ee2[_0xb8aa('0x10')][_0xb8aa('0x11')]);return _0x499c52(_0x467ee2[_0xb8aa('0x10')]['message']);}else{logger[_0xb8aa('0xa')](_0xb8aa('0xb'),_0x217ef4,_0xb8aa('0xe'));_0x499c52(_0x467ee2[_0xb8aa('0x12')]['message']);}})['catch'](function(_0x2ba04a){logger[_0xb8aa('0x10')](_0xb8aa('0xb'),_0x217ef4,_0x2ba04a);_0x18295b(_0x2ba04a);});});}exports[_0xb8aa('0x13')]=function(_0x118d1c){var _0xbae7ba=this;return new Promise(function(_0x242261,_0x2e3bbf){return db['VoiceCallReport'][_0xb8aa('0x14')]({'raw':_0x118d1c[_0xb8aa('0x15')]?_0x118d1c[_0xb8aa('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x118d1c[_0xb8aa('0x15')]?_0x118d1c['options']['where']||null:null,'attributes':_0x118d1c[_0xb8aa('0x15')]?_0x118d1c[_0xb8aa('0x15')][_0xb8aa('0x16')]||null:null,'limit':_0x118d1c[_0xb8aa('0x15')]?_0x118d1c[_0xb8aa('0x15')][_0xb8aa('0x17')]||null:null,'include':_0x118d1c[_0xb8aa('0x15')]?_0x118d1c[_0xb8aa('0x15')]['include']?_[_0xb8aa('0x18')](_0x118d1c[_0xb8aa('0x15')]['include'],function(_0x227b62){return{'model':db[_0x227b62[_0xb8aa('0x19')]],'as':_0x227b62['as'],'attributes':_0x227b62[_0xb8aa('0x16')],'include':_0x227b62['include']?_[_0xb8aa('0x18')](_0x227b62['include'],function(_0x4070e9){return{'model':db[_0x4070e9['model']],'as':_0x4070e9['as'],'attributes':_0x4070e9[_0xb8aa('0x16')],'include':_0x4070e9[_0xb8aa('0x1a')]?_[_0xb8aa('0x18')](_0x4070e9['include'],function(_0x5713fa){return{'model':db[_0x5713fa[_0xb8aa('0x19')]],'as':_0x5713fa['as'],'attributes':_0x5713fa['attributes']};}):[]};}):[]};}):[]:[]})[_0xb8aa('0x9')](function(_0x32987e){logger[_0xb8aa('0xa')](_0xb8aa('0x13'),_0x118d1c);logger[_0xb8aa('0xc')](_0xb8aa('0x13'),_0x118d1c,JSON[_0xb8aa('0xf')](_0x32987e));_0x242261(_0x32987e);})[_0xb8aa('0x1b')](function(_0x3a1d42){logger[_0xb8aa('0x10')](_0xb8aa('0x13'),_0x3a1d42['message'],_0x118d1c);_0x2e3bbf(_0xbae7ba[_0xb8aa('0x10')](0x1f4,_0x3a1d42[_0xb8aa('0x11')]));});});};exports[_0xb8aa('0x1c')]=function(_0x353f2d){var _0x79f908=this;return new Promise(function(_0x3d5947,_0x3195f1){return db[_0xb8aa('0x1d')][_0xb8aa('0x1e')](_0x353f2d[_0xb8aa('0x1f')],{'raw':_0x353f2d['options']?_0x353f2d['options'][_0xb8aa('0x20')]===undefined?!![]:![]:!![]})[_0xb8aa('0x9')](function(_0x19c37b){logger[_0xb8aa('0xa')](_0xb8aa('0x1c'),_0x353f2d);logger['debug'](_0xb8aa('0x1c'),_0x353f2d,JSON[_0xb8aa('0xf')](_0x19c37b));_0x3d5947(_0x19c37b);})[_0xb8aa('0x1b')](function(_0x5c5504){logger['error'](_0xb8aa('0x1c'),_0x5c5504['message'],_0x353f2d);_0x3195f1(_0x79f908[_0xb8aa('0x10')](0x1f4,_0x5c5504[_0xb8aa('0x11')]));});});};exports['UpdateVoiceCallReport']=function(_0x109c21){var _0xf7cc8a=this;return new Promise(function(_0x5b8cbe,_0x56954c){return db[_0xb8aa('0x1d')][_0xb8aa('0x21')](_0x109c21[_0xb8aa('0x1f')],{'raw':_0x109c21[_0xb8aa('0x15')]?_0x109c21[_0xb8aa('0x15')][_0xb8aa('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x109c21[_0xb8aa('0x15')]?_0x109c21[_0xb8aa('0x15')][_0xb8aa('0x22')]||null:null,'attributes':_0x109c21[_0xb8aa('0x15')]?_0x109c21[_0xb8aa('0x15')][_0xb8aa('0x16')]||null:null,'limit':_0x109c21[_0xb8aa('0x15')]?_0x109c21[_0xb8aa('0x15')][_0xb8aa('0x17')]||null:null})[_0xb8aa('0x9')](function(_0x18582b){logger[_0xb8aa('0xa')]('UpdateVoiceCallReport',_0x109c21);logger[_0xb8aa('0xc')]('UpdateVoiceCallReport',_0x109c21,JSON[_0xb8aa('0xf')](_0x18582b));_0x5b8cbe(_0x18582b);})[_0xb8aa('0x1b')](function(_0x2552b4){logger['error']('UpdateVoiceCallReport',_0x2552b4[_0xb8aa('0x11')],_0x109c21);_0x56954c(_0xf7cc8a['error'](0x1f4,_0x2552b4['message']));});});}; \ No newline at end of file +var _0xee71=['error','code','message','result','catch','VoiceCallReport','findAll','raw','options','where','attributes','include','map','model','GetVoiceCallReport','debug','CreateVoiceCallReport','create','UpdateVoiceCallReport','update','body','limit','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x4a253b,_0x26f5a7){var _0x3e48c1=function(_0x41d099){while(--_0x41d099){_0x4a253b['push'](_0x4a253b['shift']());}};_0x3e48c1(++_0x26f5a7);}(_0xee71,0x1ce));var _0x1ee7=function(_0x1548d6,_0x299a92){_0x1548d6=_0x1548d6-0x0;var _0x281a2c=_0xee71[_0x1548d6];return _0x281a2c;};'use strict';var _=require(_0x1ee7('0x0'));var util=require(_0x1ee7('0x1'));var moment=require('moment');var BPromise=require(_0x1ee7('0x2'));var rs=require(_0x1ee7('0x3'));var fs=require('fs');var Redis=require(_0x1ee7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1ee7('0x5'));var logger=require(_0x1ee7('0x6'))('rpc');var config=require(_0x1ee7('0x7'));var jayson=require(_0x1ee7('0x8'));var client=jayson[_0x1ee7('0x9')][_0x1ee7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x33bd68,_0x42a475,_0x3adbd7){return new BPromise(function(_0x800500,_0x5d5c2f){return client[_0x1ee7('0xb')](_0x33bd68,_0x3adbd7)[_0x1ee7('0xc')](function(_0xa74f37){logger[_0x1ee7('0xd')](_0x1ee7('0xe'),_0x42a475,'request\x20sent');logger['debug'](_0x1ee7('0xf'),_0x42a475,_0x1ee7('0x10'),JSON[_0x1ee7('0x11')](_0xa74f37));if(_0xa74f37['error']){if(_0xa74f37[_0x1ee7('0x12')][_0x1ee7('0x13')]===0x1f4){logger[_0x1ee7('0x12')](_0x1ee7('0xe'),_0x42a475,_0xa74f37[_0x1ee7('0x12')][_0x1ee7('0x14')]);return _0x5d5c2f(_0xa74f37[_0x1ee7('0x12')][_0x1ee7('0x14')]);}logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x42a475,_0xa74f37['error'][_0x1ee7('0x14')]);return _0x800500(_0xa74f37[_0x1ee7('0x12')][_0x1ee7('0x14')]);}else{logger[_0x1ee7('0xd')](_0x1ee7('0xe'),_0x42a475,_0x1ee7('0x10'));_0x800500(_0xa74f37[_0x1ee7('0x15')][_0x1ee7('0x14')]);}})[_0x1ee7('0x16')](function(_0xd2e870){logger[_0x1ee7('0x12')](_0x1ee7('0xe'),_0x42a475,_0xd2e870);_0x5d5c2f(_0xd2e870);});});}exports['GetVoiceCallReport']=function(_0x322e79){var _0x16a924=this;return new Promise(function(_0x2d4d44,_0x13d18b){return db[_0x1ee7('0x17')][_0x1ee7('0x18')]({'raw':_0x322e79['options']?_0x322e79['options'][_0x1ee7('0x19')]===undefined?!![]:![]:!![],'where':_0x322e79[_0x1ee7('0x1a')]?_0x322e79[_0x1ee7('0x1a')][_0x1ee7('0x1b')]||null:null,'attributes':_0x322e79['options']?_0x322e79[_0x1ee7('0x1a')][_0x1ee7('0x1c')]||null:null,'limit':_0x322e79[_0x1ee7('0x1a')]?_0x322e79['options']['limit']||null:null,'include':_0x322e79[_0x1ee7('0x1a')]?_0x322e79[_0x1ee7('0x1a')][_0x1ee7('0x1d')]?_[_0x1ee7('0x1e')](_0x322e79[_0x1ee7('0x1a')][_0x1ee7('0x1d')],function(_0xd40632){return{'model':db[_0xd40632[_0x1ee7('0x1f')]],'as':_0xd40632['as'],'attributes':_0xd40632[_0x1ee7('0x1c')],'include':_0xd40632['include']?_[_0x1ee7('0x1e')](_0xd40632[_0x1ee7('0x1d')],function(_0x156012){return{'model':db[_0x156012[_0x1ee7('0x1f')]],'as':_0x156012['as'],'attributes':_0x156012[_0x1ee7('0x1c')],'include':_0x156012[_0x1ee7('0x1d')]?_[_0x1ee7('0x1e')](_0x156012[_0x1ee7('0x1d')],function(_0x3cc88c){return{'model':db[_0x3cc88c['model']],'as':_0x3cc88c['as'],'attributes':_0x3cc88c[_0x1ee7('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x1ee7('0xc')](function(_0x20bdfb){logger[_0x1ee7('0xd')](_0x1ee7('0x20'),_0x322e79);logger[_0x1ee7('0x21')](_0x1ee7('0x20'),_0x322e79,JSON[_0x1ee7('0x11')](_0x20bdfb));_0x2d4d44(_0x20bdfb);})[_0x1ee7('0x16')](function(_0x18efc6){logger[_0x1ee7('0x12')](_0x1ee7('0x20'),_0x18efc6[_0x1ee7('0x14')],_0x322e79);_0x13d18b(_0x16a924['error'](0x1f4,_0x18efc6[_0x1ee7('0x14')]));});});};exports[_0x1ee7('0x22')]=function(_0x92e9c5){var _0x27d6e8=this;return new Promise(function(_0x28a3c1,_0x28adf1){return db[_0x1ee7('0x17')][_0x1ee7('0x23')](_0x92e9c5['body'],{'raw':_0x92e9c5['options']?_0x92e9c5[_0x1ee7('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x1ee7('0xc')](function(_0x27f40e){logger['info'](_0x1ee7('0x22'),_0x92e9c5);logger[_0x1ee7('0x21')](_0x1ee7('0x22'),_0x92e9c5,JSON[_0x1ee7('0x11')](_0x27f40e));_0x28a3c1(_0x27f40e);})[_0x1ee7('0x16')](function(_0x336a4c){logger[_0x1ee7('0x12')](_0x1ee7('0x22'),_0x336a4c[_0x1ee7('0x14')],_0x92e9c5);_0x28adf1(_0x27d6e8['error'](0x1f4,_0x336a4c[_0x1ee7('0x14')]));});});};exports[_0x1ee7('0x24')]=function(_0x3466ad){var _0x5abf8a=this;return new Promise(function(_0x3c11d4,_0x3dfec9){return db[_0x1ee7('0x17')][_0x1ee7('0x25')](_0x3466ad[_0x1ee7('0x26')],{'raw':_0x3466ad[_0x1ee7('0x1a')]?_0x3466ad[_0x1ee7('0x1a')][_0x1ee7('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3466ad[_0x1ee7('0x1a')]?_0x3466ad[_0x1ee7('0x1a')][_0x1ee7('0x1b')]||null:null,'attributes':_0x3466ad['options']?_0x3466ad['options']['attributes']||null:null,'limit':_0x3466ad['options']?_0x3466ad[_0x1ee7('0x1a')][_0x1ee7('0x27')]||null:null})['then'](function(_0x13879b){logger[_0x1ee7('0xd')](_0x1ee7('0x24'),_0x3466ad);logger[_0x1ee7('0x21')](_0x1ee7('0x24'),_0x3466ad,JSON[_0x1ee7('0x11')](_0x13879b));_0x3c11d4(_0x13879b);})[_0x1ee7('0x16')](function(_0x4a16cf){logger[_0x1ee7('0x12')]('UpdateVoiceCallReport',_0x4a16cf[_0x1ee7('0x14')],_0x3466ad);_0x3dfec9(_0x5abf8a['error'](0x1f4,_0x4a16cf['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 24bee0e..f88e438 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 _0x7d2c=['exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','post','update','destroy'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x7d2c,0x199));var _0xc7d2=function(_0x684ca2,_0x31e36a){_0x684ca2=_0x684ca2-0x0;var _0x5c5f67=_0x7d2c[_0x684ca2];return _0x5c5f67;};'use strict';var multer=require('multer');var util=require(_0xc7d2('0x0'));var path=require(_0xc7d2('0x1'));var timeout=require(_0xc7d2('0x2'));var express=require(_0xc7d2('0x3'));var router=express[_0xc7d2('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc7d2('0x5'));var interaction=require(_0xc7d2('0x6'));var config=require('../../config/environment');var controller=require(_0xc7d2('0x7'));router[_0xc7d2('0x8')]('/',auth[_0xc7d2('0x9')](),controller[_0xc7d2('0xa')]);router[_0xc7d2('0x8')](_0xc7d2('0xb'),auth['isAuthenticated'](),controller[_0xc7d2('0xc')]);router[_0xc7d2('0xd')]('/',auth[_0xc7d2('0x9')](),controller['create']);router['put'](_0xc7d2('0xb'),auth[_0xc7d2('0x9')](),controller[_0xc7d2('0xe')]);router['delete']('/:id',auth[_0xc7d2('0x9')](),controller[_0xc7d2('0xf')]);module[_0xc7d2('0x10')]=router; \ No newline at end of file +var _0x4958=['put','update','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','isAuthenticated','index','/:id','show','create'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x4958,0x94));var _0x8495=function(_0xfb9c00,_0x417509){_0xfb9c00=_0xfb9c00-0x0;var _0x42e1de=_0x4958[_0xfb9c00];return _0x42e1de;};'use strict';var multer=require(_0x8495('0x0'));var util=require('util');var path=require(_0x8495('0x1'));var timeout=require(_0x8495('0x2'));var express=require(_0x8495('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8495('0x4'));var config=require(_0x8495('0x5'));var controller=require(_0x8495('0x6'));router['get']('/',auth[_0x8495('0x7')](),controller[_0x8495('0x8')]);router['get'](_0x8495('0x9'),auth[_0x8495('0x7')](),controller[_0x8495('0xa')]);router['post']('/',auth[_0x8495('0x7')](),controller[_0x8495('0xb')]);router[_0x8495('0xc')](_0x8495('0x9'),auth[_0x8495('0x7')](),controller[_0x8495('0xd')]);router['delete'](_0x8495('0x9'),auth[_0x8495('0x7')](),controller[_0x8495('0xe')]);module[_0x8495('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index a3afab6..79400f5 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 _0xbe32=['join','getDataValue','split','sequelize','exports','STRING','name','options'];(function(_0x584283,_0x1032da){var _0x47beaf=function(_0x3c1365){while(--_0x3c1365){_0x584283['push'](_0x584283['shift']());}};_0x47beaf(++_0x1032da);}(_0xbe32,0x133));var _0x2be3=function(_0x3f50b5,_0x472ce8){_0x3f50b5=_0x3f50b5-0x0;var _0x2f7db1=_0xbe32[_0x3f50b5];return _0x2f7db1;};'use strict';var Sequelize=require(_0x2be3('0x0'));module[_0x2be3('0x1')]={'name':{'type':Sequelize[_0x2be3('0x2')]},'prefix':{'type':Sequelize[_0x2be3('0x2')],'unique':_0x2be3('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x2be3('0x2')],'set':function(_0x11e993){this['setDataValue'](_0x2be3('0x4'),_0x11e993?_0x11e993[_0x2be3('0x5')](''):[]);},'get':function(){return this[_0x2be3('0x6')]('options')?this[_0x2be3('0x6')]('options')[_0x2be3('0x7')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x2be3('0x2')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x2be3('0x2')]},'description':{'type':Sequelize[_0x2be3('0x2')]}}; \ No newline at end of file +var _0x999f=['STRING','name','setDataValue','options','getDataValue','BOOLEAN','sequelize','exports'];(function(_0x43cd9f,_0x57d758){var _0x5cf244=function(_0xb0bd94){while(--_0xb0bd94){_0x43cd9f['push'](_0x43cd9f['shift']());}};_0x5cf244(++_0x57d758);}(_0x999f,0x126));var _0xf999=function(_0x8c8176,_0x5360a1){_0x8c8176=_0x8c8176-0x0;var _0x4dc47b=_0x999f[_0x8c8176];return _0x4dc47b;};'use strict';var Sequelize=require(_0xf999('0x0'));module[_0xf999('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xf999('0x2')],'unique':_0xf999('0x3'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x8efa98){this[_0xf999('0x4')](_0xf999('0x5'),_0x8efa98?_0x8efa98['join'](''):[]);},'get':function(){return this[_0xf999('0x6')]('options')?this[_0xf999('0x6')]('options')['split'](''):[];}},'auth':{'type':Sequelize[_0xf999('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0xf999('0x2')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xf999('0x2')]},'description':{'type':Sequelize[_0xf999('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index a220ec2..5ce4752 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 _0x3451=['ChanSpies','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','UserProfileResource','error','name','send','index','map','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','pick','filter','where','VIRTUAL','merge','options','VoiceChanSpy','include','findAll','catch','show','params','rawAttributes','length','includeAll','find','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user'];(function(_0x6eed90,_0x2656f2){var _0x4196f0=function(_0x11bb28){while(--_0x11bb28){_0x6eed90['push'](_0x6eed90['shift']());}};_0x4196f0(++_0x2656f2);}(_0x3451,0x19a));var _0x1345=function(_0x21a425,_0x2f1b8d){_0x21a425=_0x21a425-0x0;var _0x1aae7c=_0x3451[_0x21a425];return _0x1aae7c;};'use strict';var emlformat=require(_0x1345('0x0'));var rimraf=require(_0x1345('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1345('0x2'));var rp=require(_0x1345('0x3'));var moment=require(_0x1345('0x4'));var BPromise=require(_0x1345('0x5'));var Mustache=require(_0x1345('0x6'));var util=require(_0x1345('0x7'));var path=require(_0x1345('0x8'));var sox=require(_0x1345('0x9'));var csv=require(_0x1345('0xa'));var ejs=require(_0x1345('0xb'));var fs=require('fs');var fs_extra=require(_0x1345('0xc'));var _=require(_0x1345('0xd'));var squel=require('squel');var crypto=require(_0x1345('0xe'));var jsforce=require(_0x1345('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x1345('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1345('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1345('0x11'));var as=require(_0x1345('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1345('0x13'));var utils=require('../../config/utils');var config=require(_0x1345('0x14'));var licenseUtil=require(_0x1345('0x15'));var db=require(_0x1345('0x16'))['db'];function respondWithStatusCode(_0x3e1362,_0x528692){_0x528692=_0x528692||0xcc;return function(_0x3fdff0){if(_0x3fdff0){return _0x3e1362[_0x1345('0x17')](_0x528692);}return _0x3e1362[_0x1345('0x18')](_0x528692)[_0x1345('0x19')]();};}function respondWithResult(_0x4ea08a,_0x181a2b){_0x181a2b=_0x181a2b||0xc8;return function(_0x426e00){if(_0x426e00){return _0x4ea08a[_0x1345('0x18')](_0x181a2b)[_0x1345('0x1a')](_0x426e00);}};}function respondWithFilteredResult(_0x347591,_0x959544){return function(_0x3cd49e){if(_0x3cd49e){var _0x520e6c=typeof _0x959544[_0x1345('0x1b')]===_0x1345('0x1c')&&typeof _0x959544[_0x1345('0x1d')]==='undefined';var _0x5b4d04=_0x3cd49e[_0x1345('0x1e')];var _0x1afc89=_0x520e6c?0x0:_0x959544[_0x1345('0x1b')];var _0x1db636=_0x520e6c?_0x3cd49e['count']:_0x959544[_0x1345('0x1b')]+_0x959544[_0x1345('0x1d')];var _0x1f3746;if(_0x1db636>=_0x5b4d04){_0x1db636=_0x5b4d04;_0x1f3746=0xc8;}else{_0x1f3746=0xce;}_0x347591[_0x1345('0x18')](_0x1f3746);return _0x347591[_0x1345('0x1f')](_0x1345('0x20'),_0x1afc89+'-'+_0x1db636+'/'+_0x5b4d04)[_0x1345('0x1a')](_0x3cd49e);}return null;};}function patchUpdates(_0x43d209){return function(_0x3bc681){try{jsonpatch[_0x1345('0x21')](_0x3bc681,_0x43d209,!![]);}catch(_0x265ea8){return BPromise['reject'](_0x265ea8);}return _0x3bc681[_0x1345('0x22')]();};}function saveUpdates(_0x4855d7,_0xaf6ecc){return function(_0x217712){if(_0x217712){return _0x217712[_0x1345('0x23')](_0x4855d7)[_0x1345('0x24')](function(_0x422dd9){return _0x422dd9;});}return null;};}function removeEntity(_0x2fd7ca,_0x26c2a6){return function(_0x339ea9){if(_0x339ea9){return _0x339ea9[_0x1345('0x25')]()[_0x1345('0x24')](function(){var _0x39a950=_0x339ea9['get']({'plain':!![]});var _0x346054='ChanSpies';return db[_0x1345('0x26')][_0x1345('0x25')]({'where':{'type':_0x346054,'resourceId':_0x39a950['id']}})[_0x1345('0x24')](function(){return _0x339ea9;});})[_0x1345('0x24')](function(){_0x2fd7ca[_0x1345('0x18')](0xcc)[_0x1345('0x19')]();});}};}function handleEntityNotFound(_0x3b891c,_0x25b564){return function(_0x3dcf6c){if(!_0x3dcf6c){_0x3b891c[_0x1345('0x17')](0x194);}return _0x3dcf6c;};}function handleError(_0x3d06b5,_0x2817f0){_0x2817f0=_0x2817f0||0x1f4;return function(_0x483e75){logger[_0x1345('0x27')](_0x483e75['stack']);if(_0x483e75['name']){delete _0x483e75[_0x1345('0x28')];}_0x3d06b5[_0x1345('0x18')](_0x2817f0)[_0x1345('0x29')](_0x483e75);};}exports[_0x1345('0x2a')]=function(_0x44bbba,_0x51425d){var _0x389e94={},_0x2b2be4={},_0x96c944={'count':0x0,'rows':[]};var _0x49d8e8=_[_0x1345('0x2b')](db['VoiceChanSpy']['rawAttributes'],function(_0xee1b74){return{'name':_0xee1b74[_0x1345('0x2c')],'type':_0xee1b74[_0x1345('0x2d')][_0x1345('0x2e')]};});_0x2b2be4['model']=_[_0x1345('0x2b')](_0x49d8e8,_0x1345('0x28'));_0x2b2be4[_0x1345('0x2f')]=_[_0x1345('0x30')](_0x44bbba[_0x1345('0x2f')]);_0x2b2be4[_0x1345('0x31')]=_[_0x1345('0x32')](_0x2b2be4[_0x1345('0x33')],_0x2b2be4[_0x1345('0x2f')]);_0x389e94[_0x1345('0x34')]=_[_0x1345('0x32')](_0x2b2be4['model'],qs[_0x1345('0x35')](_0x44bbba[_0x1345('0x2f')][_0x1345('0x35')]));_0x389e94[_0x1345('0x34')]=_0x389e94[_0x1345('0x34')]['length']?_0x389e94[_0x1345('0x34')]:_0x2b2be4['model'];if(!_0x44bbba['query'][_0x1345('0x36')](_0x1345('0x37'))){_0x389e94[_0x1345('0x1d')]=qs['limit'](_0x44bbba[_0x1345('0x2f')][_0x1345('0x1d')]);_0x389e94[_0x1345('0x1b')]=qs[_0x1345('0x1b')](_0x44bbba[_0x1345('0x2f')][_0x1345('0x1b')]);}_0x389e94[_0x1345('0x38')]=qs['sort'](_0x44bbba['query']['sort']);_0x389e94['where']=qs['filters'](_[_0x1345('0x39')](_0x44bbba[_0x1345('0x2f')],_0x2b2be4[_0x1345('0x31')]),_0x49d8e8);if(_0x44bbba[_0x1345('0x2f')][_0x1345('0x3a')]){_0x389e94['where']=_['merge'](_0x389e94[_0x1345('0x3b')],{'$or':_[_0x1345('0x2b')](_0x49d8e8,function(_0x14ee7c){if(_0x14ee7c[_0x1345('0x2d')]!==_0x1345('0x3c')){var _0x1eae93={};_0x1eae93[_0x14ee7c['name']]={'$like':'%'+_0x44bbba[_0x1345('0x2f')][_0x1345('0x3a')]+'%'};return _0x1eae93;}})});}_0x389e94=_[_0x1345('0x3d')]({},_0x389e94,_0x44bbba[_0x1345('0x3e')]);var _0x521cdf={'where':_0x389e94[_0x1345('0x3b')]};return db[_0x1345('0x3f')][_0x1345('0x1e')](_0x521cdf)['then'](function(_0x10f67b){_0x96c944[_0x1345('0x1e')]=_0x10f67b;if(_0x44bbba[_0x1345('0x2f')]['includeAll']){_0x389e94[_0x1345('0x40')]=[{'all':!![]}];}return db[_0x1345('0x3f')][_0x1345('0x41')](_0x389e94);})[_0x1345('0x24')](function(_0x3bbc86){_0x96c944['rows']=_0x3bbc86;return _0x96c944;})[_0x1345('0x24')](respondWithFilteredResult(_0x51425d,_0x389e94))[_0x1345('0x42')](handleError(_0x51425d,null));};exports[_0x1345('0x43')]=function(_0x1c23df,_0x4f2d65){var _0x183132={'raw':![],'where':{'id':_0x1c23df[_0x1345('0x44')]['id']}},_0x2f128c={};_0x2f128c[_0x1345('0x33')]=_[_0x1345('0x30')](db[_0x1345('0x3f')][_0x1345('0x45')]);_0x2f128c[_0x1345('0x2f')]=_[_0x1345('0x30')](_0x1c23df[_0x1345('0x2f')]);_0x2f128c[_0x1345('0x31')]=_[_0x1345('0x32')](_0x2f128c[_0x1345('0x33')],_0x2f128c[_0x1345('0x2f')]);_0x183132[_0x1345('0x34')]=_[_0x1345('0x32')](_0x2f128c['model'],qs[_0x1345('0x35')](_0x1c23df[_0x1345('0x2f')][_0x1345('0x35')]));_0x183132[_0x1345('0x34')]=_0x183132[_0x1345('0x34')][_0x1345('0x46')]?_0x183132[_0x1345('0x34')]:_0x2f128c[_0x1345('0x33')];if(_0x1c23df[_0x1345('0x2f')][_0x1345('0x47')]){_0x183132[_0x1345('0x40')]=[{'all':!![]}];}_0x183132=_[_0x1345('0x3d')]({},_0x183132,_0x1c23df[_0x1345('0x3e')]);return db['VoiceChanSpy'][_0x1345('0x48')](_0x183132)['then'](handleEntityNotFound(_0x4f2d65,null))[_0x1345('0x24')](respondWithResult(_0x4f2d65,null))[_0x1345('0x42')](handleError(_0x4f2d65,null));};exports['create']=function(_0x49b8fc,_0x27fc27){return db[_0x1345('0x3f')]['create'](_0x49b8fc['body'],{})['then'](function(_0x379a98){var _0x3f336e=_0x49b8fc['user'][_0x1345('0x49')]({'plain':!![]});if(!_0x3f336e)throw new Error(_0x1345('0x4a'));if(_0x3f336e['role']===_0x1345('0x4b')){var _0x4ce41d=_0x379a98[_0x1345('0x49')]({'plain':!![]});var _0x5aab90=_0x1345('0x4c');return db[_0x1345('0x4d')]['find']({'where':{'name':_0x5aab90,'userProfileId':_0x3f336e[_0x1345('0x4e')]},'raw':!![]})[_0x1345('0x24')](function(_0x49fda2){if(_0x49fda2&&_0x49fda2['autoAssociation']===0x0){return db[_0x1345('0x26')]['create']({'name':_0x4ce41d[_0x1345('0x28')],'resourceId':_0x4ce41d['id'],'type':_0x49fda2[_0x1345('0x28')],'sectionId':_0x49fda2['id']},{})[_0x1345('0x24')](function(){return _0x379a98;});}else{return _0x379a98;}})['catch'](function(_0x5d6526){logger['error'](_0x1345('0x4f'),_0x5d6526);throw _0x5d6526;});}return _0x379a98;})[_0x1345('0x24')](respondWithResult(_0x27fc27,0xc9))[_0x1345('0x42')](handleError(_0x27fc27,null));};exports[_0x1345('0x23')]=function(_0x52db68,_0x257009){if(_0x52db68['body']['id']){delete _0x52db68[_0x1345('0x50')]['id'];}return db[_0x1345('0x3f')][_0x1345('0x48')]({'where':{'id':_0x52db68[_0x1345('0x44')]['id']}})[_0x1345('0x24')](handleEntityNotFound(_0x257009,null))[_0x1345('0x24')](saveUpdates(_0x52db68[_0x1345('0x50')],null))[_0x1345('0x24')](respondWithResult(_0x257009,null))[_0x1345('0x42')](handleError(_0x257009,null));};exports[_0x1345('0x25')]=function(_0x5e7b35,_0x37201e){return db[_0x1345('0x3f')][_0x1345('0x48')]({'where':{'id':_0x5e7b35[_0x1345('0x44')]['id']}})[_0x1345('0x24')](handleEntityNotFound(_0x37201e,null))[_0x1345('0x24')](removeEntity(_0x37201e,null))[_0x1345('0x42')](handleError(_0x37201e,null));}; \ No newline at end of file +var _0xc686=['zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','undefined','limit','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','ChanSpies','UserProfileResource','sendStatus','error','name','send','index','map','VoiceChanSpy','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','params'];(function(_0x15a3eb,_0x55fffa){var _0x550bb2=function(_0x94aae6){while(--_0x94aae6){_0x15a3eb['push'](_0x15a3eb['shift']());}};_0x550bb2(++_0x55fffa);}(_0xc686,0x148));var _0x6c68=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xc686[_0x37bd26];return _0xe83dc4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6c68('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6c68('0x1'));var moment=require('moment');var BPromise=require(_0x6c68('0x2'));var Mustache=require(_0x6c68('0x3'));var util=require(_0x6c68('0x4'));var path=require(_0x6c68('0x5'));var sox=require(_0x6c68('0x6'));var csv=require(_0x6c68('0x7'));var ejs=require(_0x6c68('0x8'));var fs=require('fs');var fs_extra=require(_0x6c68('0x9'));var _=require(_0x6c68('0xa'));var squel=require(_0x6c68('0xb'));var crypto=require(_0x6c68('0xc'));var jsforce=require(_0x6c68('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x6c68('0x7'));var querystring=require(_0x6c68('0xe'));var Papa=require('papaparse');var Redis=require(_0x6c68('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x6c68('0x10'));var as=require(_0x6c68('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6c68('0x12'))('api');var utils=require(_0x6c68('0x13'));var config=require(_0x6c68('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x6c68('0x15'))['db'];function respondWithStatusCode(_0x489c2f,_0x4f947a){_0x4f947a=_0x4f947a||0xcc;return function(_0x29e0a5){if(_0x29e0a5){return _0x489c2f['sendStatus'](_0x4f947a);}return _0x489c2f[_0x6c68('0x16')](_0x4f947a)[_0x6c68('0x17')]();};}function respondWithResult(_0x310431,_0x4c4f5d){_0x4c4f5d=_0x4c4f5d||0xc8;return function(_0x25a4dc){if(_0x25a4dc){return _0x310431[_0x6c68('0x16')](_0x4c4f5d)[_0x6c68('0x18')](_0x25a4dc);}};}function respondWithFilteredResult(_0x9393b,_0x2dc30b){return function(_0x494b6e){if(_0x494b6e){var _0x5a0a84=typeof _0x2dc30b['offset']===_0x6c68('0x19')&&typeof _0x2dc30b[_0x6c68('0x1a')]===_0x6c68('0x19');var _0x1422fa=_0x494b6e['count'];var _0x2cd5f6=_0x5a0a84?0x0:_0x2dc30b[_0x6c68('0x1b')];var _0x5045e3=_0x5a0a84?_0x494b6e['count']:_0x2dc30b[_0x6c68('0x1b')]+_0x2dc30b[_0x6c68('0x1a')];var _0x23d91d;if(_0x5045e3>=_0x1422fa){_0x5045e3=_0x1422fa;_0x23d91d=0xc8;}else{_0x23d91d=0xce;}_0x9393b['status'](_0x23d91d);return _0x9393b[_0x6c68('0x1c')](_0x6c68('0x1d'),_0x2cd5f6+'-'+_0x5045e3+'/'+_0x1422fa)[_0x6c68('0x18')](_0x494b6e);}return null;};}function patchUpdates(_0x29b74d){return function(_0x153edb){try{jsonpatch[_0x6c68('0x1e')](_0x153edb,_0x29b74d,!![]);}catch(_0x12dc3a){return BPromise[_0x6c68('0x1f')](_0x12dc3a);}return _0x153edb[_0x6c68('0x20')]();};}function saveUpdates(_0xb6635c,_0x5974e8){return function(_0x201d7d){if(_0x201d7d){return _0x201d7d[_0x6c68('0x21')](_0xb6635c)[_0x6c68('0x22')](function(_0x1d981c){return _0x1d981c;});}return null;};}function removeEntity(_0xb06428,_0x2a4aba){return function(_0x3e680a){if(_0x3e680a){return _0x3e680a[_0x6c68('0x23')]()[_0x6c68('0x22')](function(){var _0xfd98ef=_0x3e680a[_0x6c68('0x24')]({'plain':!![]});var _0x2f4fd5=_0x6c68('0x25');return db[_0x6c68('0x26')][_0x6c68('0x23')]({'where':{'type':_0x2f4fd5,'resourceId':_0xfd98ef['id']}})[_0x6c68('0x22')](function(){return _0x3e680a;});})[_0x6c68('0x22')](function(){_0xb06428['status'](0xcc)[_0x6c68('0x17')]();});}};}function handleEntityNotFound(_0x12ec21,_0x456728){return function(_0x3bf62a){if(!_0x3bf62a){_0x12ec21[_0x6c68('0x27')](0x194);}return _0x3bf62a;};}function handleError(_0x2da548,_0x17f3e0){_0x17f3e0=_0x17f3e0||0x1f4;return function(_0x1d4566){logger[_0x6c68('0x28')](_0x1d4566['stack']);if(_0x1d4566[_0x6c68('0x29')]){delete _0x1d4566[_0x6c68('0x29')];}_0x2da548['status'](_0x17f3e0)[_0x6c68('0x2a')](_0x1d4566);};}exports[_0x6c68('0x2b')]=function(_0x24fc6d,_0x486e84){var _0x18f087={},_0x590023={},_0xd55c65={'count':0x0,'rows':[]};var _0x5a5fd4=_[_0x6c68('0x2c')](db[_0x6c68('0x2d')][_0x6c68('0x2e')],function(_0x18d98c){return{'name':_0x18d98c[_0x6c68('0x2f')],'type':_0x18d98c[_0x6c68('0x30')][_0x6c68('0x31')]};});_0x590023[_0x6c68('0x32')]=_[_0x6c68('0x2c')](_0x5a5fd4,_0x6c68('0x29'));_0x590023[_0x6c68('0x33')]=_[_0x6c68('0x34')](_0x24fc6d[_0x6c68('0x33')]);_0x590023[_0x6c68('0x35')]=_[_0x6c68('0x36')](_0x590023[_0x6c68('0x32')],_0x590023['query']);_0x18f087['attributes']=_[_0x6c68('0x36')](_0x590023[_0x6c68('0x32')],qs[_0x6c68('0x37')](_0x24fc6d[_0x6c68('0x33')][_0x6c68('0x37')]));_0x18f087['attributes']=_0x18f087[_0x6c68('0x38')][_0x6c68('0x39')]?_0x18f087[_0x6c68('0x38')]:_0x590023[_0x6c68('0x32')];if(!_0x24fc6d[_0x6c68('0x33')][_0x6c68('0x3a')]('nolimit')){_0x18f087['limit']=qs[_0x6c68('0x1a')](_0x24fc6d[_0x6c68('0x33')]['limit']);_0x18f087['offset']=qs[_0x6c68('0x1b')](_0x24fc6d['query'][_0x6c68('0x1b')]);}_0x18f087[_0x6c68('0x3b')]=qs['sort'](_0x24fc6d[_0x6c68('0x33')][_0x6c68('0x3c')]);_0x18f087[_0x6c68('0x3d')]=qs[_0x6c68('0x35')](_[_0x6c68('0x3e')](_0x24fc6d[_0x6c68('0x33')],_0x590023[_0x6c68('0x35')]),_0x5a5fd4);if(_0x24fc6d[_0x6c68('0x33')][_0x6c68('0x3f')]){_0x18f087[_0x6c68('0x3d')]=_[_0x6c68('0x40')](_0x18f087[_0x6c68('0x3d')],{'$or':_[_0x6c68('0x2c')](_0x5a5fd4,function(_0x798117){if(_0x798117[_0x6c68('0x30')]!==_0x6c68('0x41')){var _0x29b900={};_0x29b900[_0x798117[_0x6c68('0x29')]]={'$like':'%'+_0x24fc6d[_0x6c68('0x33')][_0x6c68('0x3f')]+'%'};return _0x29b900;}})});}_0x18f087=_[_0x6c68('0x40')]({},_0x18f087,_0x24fc6d[_0x6c68('0x42')]);var _0x1bcf52={'where':_0x18f087['where']};return db[_0x6c68('0x2d')][_0x6c68('0x43')](_0x1bcf52)[_0x6c68('0x22')](function(_0x5cc254){_0xd55c65[_0x6c68('0x43')]=_0x5cc254;if(_0x24fc6d[_0x6c68('0x33')][_0x6c68('0x44')]){_0x18f087[_0x6c68('0x45')]=[{'all':!![]}];}return db[_0x6c68('0x2d')][_0x6c68('0x46')](_0x18f087);})[_0x6c68('0x22')](function(_0x388d2c){_0xd55c65[_0x6c68('0x47')]=_0x388d2c;return _0xd55c65;})[_0x6c68('0x22')](respondWithFilteredResult(_0x486e84,_0x18f087))[_0x6c68('0x48')](handleError(_0x486e84,null));};exports[_0x6c68('0x49')]=function(_0x10aade,_0x13d3f3){var _0x2aa77e={'raw':![],'where':{'id':_0x10aade['params']['id']}},_0x145e75={};_0x145e75[_0x6c68('0x32')]=_[_0x6c68('0x34')](db[_0x6c68('0x2d')][_0x6c68('0x2e')]);_0x145e75['query']=_[_0x6c68('0x34')](_0x10aade[_0x6c68('0x33')]);_0x145e75['filters']=_[_0x6c68('0x36')](_0x145e75[_0x6c68('0x32')],_0x145e75[_0x6c68('0x33')]);_0x2aa77e['attributes']=_[_0x6c68('0x36')](_0x145e75[_0x6c68('0x32')],qs[_0x6c68('0x37')](_0x10aade[_0x6c68('0x33')][_0x6c68('0x37')]));_0x2aa77e[_0x6c68('0x38')]=_0x2aa77e['attributes'][_0x6c68('0x39')]?_0x2aa77e['attributes']:_0x145e75[_0x6c68('0x32')];if(_0x10aade['query'][_0x6c68('0x44')]){_0x2aa77e['include']=[{'all':!![]}];}_0x2aa77e=_[_0x6c68('0x40')]({},_0x2aa77e,_0x10aade[_0x6c68('0x42')]);return db[_0x6c68('0x2d')][_0x6c68('0x4a')](_0x2aa77e)[_0x6c68('0x22')](handleEntityNotFound(_0x13d3f3,null))[_0x6c68('0x22')](respondWithResult(_0x13d3f3,null))[_0x6c68('0x48')](handleError(_0x13d3f3,null));};exports[_0x6c68('0x4b')]=function(_0x4f9ab6,_0x19f1fc){return db['VoiceChanSpy']['create'](_0x4f9ab6[_0x6c68('0x4c')],{})[_0x6c68('0x22')](function(_0x1507fe){var _0x33fa95=_0x4f9ab6[_0x6c68('0x4d')]['get']({'plain':!![]});if(!_0x33fa95)throw new Error(_0x6c68('0x4e'));if(_0x33fa95[_0x6c68('0x4f')]===_0x6c68('0x4d')){var _0x4bb381=_0x1507fe[_0x6c68('0x24')]({'plain':!![]});var _0x42bda2=_0x6c68('0x25');return db[_0x6c68('0x50')]['find']({'where':{'name':_0x42bda2,'userProfileId':_0x33fa95['userProfileId']},'raw':!![]})[_0x6c68('0x22')](function(_0x1ce44e){if(_0x1ce44e&&_0x1ce44e['autoAssociation']===0x0){return db[_0x6c68('0x26')]['create']({'name':_0x4bb381['name'],'resourceId':_0x4bb381['id'],'type':_0x1ce44e[_0x6c68('0x29')],'sectionId':_0x1ce44e['id']},{})['then'](function(){return _0x1507fe;});}else{return _0x1507fe;}})[_0x6c68('0x48')](function(_0x1cf860){logger[_0x6c68('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1cf860);throw _0x1cf860;});}return _0x1507fe;})['then'](respondWithResult(_0x19f1fc,0xc9))['catch'](handleError(_0x19f1fc,null));};exports[_0x6c68('0x21')]=function(_0x3a56dd,_0x1bcd6d){if(_0x3a56dd[_0x6c68('0x4c')]['id']){delete _0x3a56dd[_0x6c68('0x4c')]['id'];}return db[_0x6c68('0x2d')][_0x6c68('0x4a')]({'where':{'id':_0x3a56dd[_0x6c68('0x51')]['id']}})['then'](handleEntityNotFound(_0x1bcd6d,null))[_0x6c68('0x22')](saveUpdates(_0x3a56dd['body'],null))[_0x6c68('0x22')](respondWithResult(_0x1bcd6d,null))[_0x6c68('0x48')](handleError(_0x1bcd6d,null));};exports[_0x6c68('0x23')]=function(_0x1b5b23,_0x4c3895){return db[_0x6c68('0x2d')][_0x6c68('0x4a')]({'where':{'id':_0x1b5b23['params']['id']}})[_0x6c68('0x22')](handleEntityNotFound(_0x4c3895,null))[_0x6c68('0x22')](removeEntity(_0x4c3895,null))[_0x6c68('0x48')](handleError(_0x4c3895,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 12606e5..2bd489d 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 _0x4bbe=['destroy','./voiceChanSpy.attributes','context','from-sip','format','prefix','merge','Set','chanspy','push','MixMonitor','recordingFormat','auth','Authenticate','ChanSpy','name','join','record','StopMixMonitor','length','concat','internal','User','findAll','catch','exports','define','voice_chanspy','then','VoiceExtension','bulkCreate'];(function(_0x42b02c,_0x5c7b99){var _0x105518=function(_0x305734){while(--_0x305734){_0x42b02c['push'](_0x42b02c['shift']());}};_0x105518(++_0x5c7b99);}(_0x4bbe,0xbb));var _0xe4bb=function(_0x63908c,_0x16cbd3){_0x63908c=_0x63908c-0x0;var _0x16c9d8=_0x4bbe[_0x63908c];return _0x16c9d8;};'use strict';var _=require('lodash');var util=require('util');var BPromise=require('bluebird');var attributes=require(_0xe4bb('0x0'));var getUserApplications=function(_0x631174,_0x120c34,_0x4879f0){var _0x4db1ae=0x1;var _0x156cb8=[];var _0x12b212={'context':_0x120c34[_0xe4bb('0x1')]||_0xe4bb('0x2'),'exten':util[_0xe4bb('0x3')]('%s%s',_0x631174[_0xe4bb('0x4')],_0x4879f0),'type':'system','isApp':![],'ChanSpyId':_0x631174['id'],'UserId':_0x120c34['id']};_0x156cb8['push'](_[_0xe4bb('0x5')]({'app':_0xe4bb('0x6'),'appdata':util[_0xe4bb('0x3')]('CDR(type)=%s',_0xe4bb('0x7')),'priority':_0x4db1ae++},_0x12b212));if(_0x631174['record']){_0x156cb8[_0xe4bb('0x8')](_[_0xe4bb('0x5')]({'app':_0xe4bb('0x9'),'appdata':util['format']('${UNIQUEID}.%s,a',_0x631174[_0xe4bb('0xa')]),'priority':_0x4db1ae++},_0x12b212));}if(_0x631174[_0xe4bb('0xb')]){_0x156cb8[_0xe4bb('0x8')](_[_0xe4bb('0x5')]({'app':_0xe4bb('0xc'),'appdata':_0x631174['password'],'priority':_0x4db1ae++},_0x12b212));}_0x156cb8[_0xe4bb('0x8')](_[_0xe4bb('0x5')]({'app':_0xe4bb('0xd'),'appdata':util['format']('SIP/%s,%s',_0x120c34[_0xe4bb('0xe')],_0x631174['options']?_0x631174['options'][_0xe4bb('0xf')](''):''),'priority':_0x4db1ae++},_0x12b212));if(_0x631174[_0xe4bb('0x10')]){_0x156cb8[_0xe4bb('0x8')](_[_0xe4bb('0x5')]({'app':_0xe4bb('0x11'),'priority':_0x4db1ae++},_0x12b212));}return _0x156cb8;};var getChanSpyApplications=function(_0x79ef0e,_0x2b1397){var _0x263c83=[];for(var _0x365ca3=0x0,_0x1fa455=0x1;_0x365ca3<_0x2b1397[_0xe4bb('0x12')];_0x365ca3++,_0x1fa455=0x1){_0x263c83=_0x263c83[_0xe4bb('0x13')](getUserApplications(_0x79ef0e,_0x2b1397[_0x365ca3],_0x2b1397[_0x365ca3][_0xe4bb('0x14')]));if(_0x2b1397[_0x365ca3][_0xe4bb('0x14')]!=_0x2b1397[_0x365ca3][_0xe4bb('0xe')]){_0x263c83=_0x263c83[_0xe4bb('0x13')](getUserApplications(_0x79ef0e,_0x2b1397[_0x365ca3],_0x2b1397[_0x365ca3][_0xe4bb('0xe')]));}}return _0x263c83;};var getChanSpyPromise=function(_0x11dd17,_0x1a2c5c){return new BPromise(function(_0x249992,_0x1729d1){return _0x11dd17[_0xe4bb('0x15')][_0xe4bb('0x16')]({'attributes':['id',_0xe4bb('0xe'),_0xe4bb('0x14')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})['then'](function(_0x4fdbdd){if(_0x4fdbdd){return _0x249992(getChanSpyApplications(_0x1a2c5c,_0x4fdbdd));}return _0x249992([]);})[_0xe4bb('0x17')](function(_0x3e757a){_0x1729d1(_0x3e757a);});});};module[_0xe4bb('0x18')]=function(_0x14b513,_0x1759c5){var _0x42b19b=_0x14b513['models'];return _0x14b513[_0xe4bb('0x19')]('VoiceChanSpy',attributes,{'tableName':_0xe4bb('0x1a'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x288c44,_0x357b9a,_0x45518f){return getChanSpyPromise(_0x42b19b,_0x288c44)[_0xe4bb('0x1b')](function(_0x24f9f8){if(_0x24f9f8&&_0x24f9f8[_0xe4bb('0x12')]){return _0x42b19b[_0xe4bb('0x1c')][_0xe4bb('0x1d')](_0x24f9f8);}})[_0xe4bb('0x1b')](function(){_0x45518f();})[_0xe4bb('0x17')](function(_0x26551f){_0x45518f(_0x26551f);});},'afterUpdate':function(_0x4393b5,_0x57b255,_0x2b261a){return _0x42b19b[_0xe4bb('0x1c')][_0xe4bb('0x1e')]({'where':{'ChanSpyId':_0x4393b5['id']}})[_0xe4bb('0x1b')](function(){return getChanSpyPromise(_0x42b19b,_0x4393b5);})[_0xe4bb('0x1b')](function(_0x390019){if(_0x390019&&_0x390019['length']){return _0x42b19b['VoiceExtension']['bulkCreate'](_0x390019);}})[_0xe4bb('0x1b')](function(){_0x2b261a();})[_0xe4bb('0x17')](function(_0x9e1df5){_0x2b261a(_0x9e1df5);});},'afterDestroy':function(_0x4d8db2,_0x16fac8,_0x298c9a){return _0x42b19b[_0xe4bb('0x1c')][_0xe4bb('0x1e')]({'where':{'ChanSpyId':_0x4d8db2['id']}})[_0xe4bb('0x1b')](function(){_0x298c9a();})['catch'](function(_0x434187){_0x298c9a(_0x434187);});}}});}; \ No newline at end of file +var _0x66d8=['lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','prefix','system','push','merge','Set','format','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','password','ChanSpy','SIP/%s,%s','name','options','join','length','concat','internal','User','then','catch','exports','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy'];(function(_0x49f8c2,_0x5166b7){var _0x3e63ec=function(_0x575c26){while(--_0x575c26){_0x49f8c2['push'](_0x49f8c2['shift']());}};_0x3e63ec(++_0x5166b7);}(_0x66d8,0x156));var _0x866d=function(_0xf482c1,_0x32cbca){_0xf482c1=_0xf482c1-0x0;var _0x184548=_0x66d8[_0xf482c1];return _0x184548;};'use strict';var _=require(_0x866d('0x0'));var util=require(_0x866d('0x1'));var BPromise=require(_0x866d('0x2'));var attributes=require(_0x866d('0x3'));var getUserApplications=function(_0x3d54a7,_0x3274ed,_0x1b7c35){var _0x5b51ab=0x1;var _0x2b6065=[];var _0x5413b8={'context':_0x3274ed[_0x866d('0x4')]||_0x866d('0x5'),'exten':util['format']('%s%s',_0x3d54a7[_0x866d('0x6')],_0x1b7c35),'type':_0x866d('0x7'),'isApp':![],'ChanSpyId':_0x3d54a7['id'],'UserId':_0x3274ed['id']};_0x2b6065[_0x866d('0x8')](_[_0x866d('0x9')]({'app':_0x866d('0xa'),'appdata':util[_0x866d('0xb')]('CDR(type)=%s',_0x866d('0xc')),'priority':_0x5b51ab++},_0x5413b8));if(_0x3d54a7[_0x866d('0xd')]){_0x2b6065['push'](_[_0x866d('0x9')]({'app':_0x866d('0xe'),'appdata':util[_0x866d('0xb')](_0x866d('0xf'),_0x3d54a7[_0x866d('0x10')]),'priority':_0x5b51ab++},_0x5413b8));}if(_0x3d54a7[_0x866d('0x11')]){_0x2b6065[_0x866d('0x8')](_['merge']({'app':'Authenticate','appdata':_0x3d54a7[_0x866d('0x12')],'priority':_0x5b51ab++},_0x5413b8));}_0x2b6065['push'](_[_0x866d('0x9')]({'app':_0x866d('0x13'),'appdata':util[_0x866d('0xb')](_0x866d('0x14'),_0x3274ed[_0x866d('0x15')],_0x3d54a7[_0x866d('0x16')]?_0x3d54a7[_0x866d('0x16')][_0x866d('0x17')](''):''),'priority':_0x5b51ab++},_0x5413b8));if(_0x3d54a7['record']){_0x2b6065['push'](_[_0x866d('0x9')]({'app':'StopMixMonitor','priority':_0x5b51ab++},_0x5413b8));}return _0x2b6065;};var getChanSpyApplications=function(_0x334c01,_0x46400c){var _0x3fac55=[];for(var _0x2099bd=0x0,_0x45dcf6=0x1;_0x2099bd<_0x46400c[_0x866d('0x18')];_0x2099bd++,_0x45dcf6=0x1){_0x3fac55=_0x3fac55[_0x866d('0x19')](getUserApplications(_0x334c01,_0x46400c[_0x2099bd],_0x46400c[_0x2099bd][_0x866d('0x1a')]));if(_0x46400c[_0x2099bd][_0x866d('0x1a')]!=_0x46400c[_0x2099bd][_0x866d('0x15')]){_0x3fac55=_0x3fac55[_0x866d('0x19')](getUserApplications(_0x334c01,_0x46400c[_0x2099bd],_0x46400c[_0x2099bd][_0x866d('0x15')]));}}return _0x3fac55;};var getChanSpyPromise=function(_0x4ae72d,_0x4dbf0e){return new BPromise(function(_0x1e03e3,_0x36ee10){return _0x4ae72d[_0x866d('0x1b')]['findAll']({'attributes':['id',_0x866d('0x15'),_0x866d('0x1a')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0x866d('0x1c')](function(_0x44813f){if(_0x44813f){return _0x1e03e3(getChanSpyApplications(_0x4dbf0e,_0x44813f));}return _0x1e03e3([]);})[_0x866d('0x1d')](function(_0x529dab){_0x36ee10(_0x529dab);});});};module[_0x866d('0x1e')]=function(_0x375474,_0x2c7db3){var _0xeb1ca6=_0x375474[_0x866d('0x1f')];return _0x375474[_0x866d('0x20')](_0x866d('0x21'),attributes,{'tableName':_0x866d('0x22'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5a049c,_0x1dcac8,_0x519d9f){return getChanSpyPromise(_0xeb1ca6,_0x5a049c)[_0x866d('0x1c')](function(_0x2d296b){if(_0x2d296b&&_0x2d296b['length']){return _0xeb1ca6[_0x866d('0x23')]['bulkCreate'](_0x2d296b);}})['then'](function(){_0x519d9f();})[_0x866d('0x1d')](function(_0x4a769c){_0x519d9f(_0x4a769c);});},'afterUpdate':function(_0x231981,_0x54f684,_0x14c181){return _0xeb1ca6[_0x866d('0x23')]['destroy']({'where':{'ChanSpyId':_0x231981['id']}})[_0x866d('0x1c')](function(){return getChanSpyPromise(_0xeb1ca6,_0x231981);})[_0x866d('0x1c')](function(_0x3babd8){if(_0x3babd8&&_0x3babd8[_0x866d('0x18')]){return _0xeb1ca6[_0x866d('0x23')][_0x866d('0x24')](_0x3babd8);}})['then'](function(){_0x14c181();})['catch'](function(_0x587fcb){_0x14c181(_0x587fcb);});},'afterDestroy':function(_0x3a8bfe,_0x167dac,_0x18adcb){return _0xeb1ca6[_0x866d('0x23')][_0x866d('0x25')]({'where':{'ChanSpyId':_0x3a8bfe['id']}})[_0x866d('0x1c')](function(){_0x18adcb();})[_0x866d('0x1d')](function(_0x3e9e48){_0x18adcb(_0x3e9e48);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 5862ee3..9e22712 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 _0xf4eb=['VoiceChanSpy,\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(_0x4da1d1,_0x7e80bf){var _0x42b10c=function(_0x18ada4){while(--_0x18ada4){_0x4da1d1['push'](_0x4da1d1['shift']());}};_0x42b10c(++_0x7e80bf);}(_0xf4eb,0xec));var _0xbf4e=function(_0x5cdb78,_0x8a9a7c){_0x5cdb78=_0x5cdb78-0x0;var _0x32805d=_0xf4eb[_0x5cdb78];return _0x32805d;};'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')]('VoiceChanSpy,\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')]('VoiceChanSpy,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});} \ No newline at end of file +var _0xc368=['client','request','then','request\x20sent','debug','stringify','error','code','VoiceChanSpy,\x20%s,\x20%s','message','info','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x43d8a1,_0x15637e){var _0x418cdb=function(_0x16bb00){while(--_0x16bb00){_0x43d8a1['push'](_0x43d8a1['shift']());}};_0x418cdb(++_0x15637e);}(_0xc368,0x7b));var _0x8c36=function(_0x42c1a8,_0x432459){_0x42c1a8=_0x42c1a8-0x0;var _0x48478e=_0xc368[_0x42c1a8];return _0x48478e;};'use strict';var _=require('lodash');var util=require(_0x8c36('0x0'));var moment=require('moment');var BPromise=require(_0x8c36('0x1'));var rs=require(_0x8c36('0x2'));var fs=require('fs');var Redis=require(_0x8c36('0x3'));var db=require(_0x8c36('0x4'))['db'];var utils=require(_0x8c36('0x5'));var logger=require('../../config/logger')(_0x8c36('0x6'));var config=require(_0x8c36('0x7'));var jayson=require(_0x8c36('0x8'));var client=jayson[_0x8c36('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x554022,_0x8ed437,_0x384867){return new BPromise(function(_0x3e76be,_0x26bad1){return client[_0x8c36('0xa')](_0x554022,_0x384867)[_0x8c36('0xb')](function(_0x569f29){logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x8ed437,_0x8c36('0xc'));logger[_0x8c36('0xd')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x8ed437,_0x8c36('0xc'),JSON[_0x8c36('0xe')](_0x569f29));if(_0x569f29[_0x8c36('0xf')]){if(_0x569f29[_0x8c36('0xf')][_0x8c36('0x10')]===0x1f4){logger[_0x8c36('0xf')](_0x8c36('0x11'),_0x8ed437,_0x569f29[_0x8c36('0xf')][_0x8c36('0x12')]);return _0x26bad1(_0x569f29[_0x8c36('0xf')][_0x8c36('0x12')]);}logger[_0x8c36('0xf')](_0x8c36('0x11'),_0x8ed437,_0x569f29[_0x8c36('0xf')]['message']);return _0x3e76be(_0x569f29[_0x8c36('0xf')]['message']);}else{logger[_0x8c36('0x13')](_0x8c36('0x11'),_0x8ed437,_0x8c36('0xc'));_0x3e76be(_0x569f29[_0x8c36('0x14')][_0x8c36('0x12')]);}})[_0x8c36('0x15')](function(_0x3c10eb){logger[_0x8c36('0xf')](_0x8c36('0x11'),_0x8ed437,_0x3c10eb);_0x26bad1(_0x3c10eb);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 49528de..9fa35ff 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 _0x453c=['fs-extra','../../components/auth/service','../../components/interaction/service','./voiceContext.controller','get','/:id','show','post','isAuthenticated','create','put','update','delete','exports','multer','path','connect-timeout','express'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x453c,0xd4));var _0xc453=function(_0x5a95fa,_0x4a2fc9){_0x5a95fa=_0x5a95fa-0x0;var _0x1a61b8=_0x453c[_0x5a95fa];return _0x1a61b8;};'use strict';var multer=require(_0xc453('0x0'));var util=require('util');var path=require(_0xc453('0x1'));var timeout=require(_0xc453('0x2'));var express=require(_0xc453('0x3'));var router=express['Router']();var fs_extra=require(_0xc453('0x4'));var auth=require(_0xc453('0x5'));var interaction=require(_0xc453('0x6'));var config=require('../../config/environment');var controller=require(_0xc453('0x7'));router[_0xc453('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc453('0x8')](_0xc453('0x9'),auth['isAuthenticated'](),controller[_0xc453('0xa')]);router[_0xc453('0xb')]('/',auth[_0xc453('0xc')](),controller[_0xc453('0xd')]);router[_0xc453('0xe')](_0xc453('0x9'),auth[_0xc453('0xc')](),controller[_0xc453('0xf')]);router[_0xc453('0x10')](_0xc453('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0xc453('0x11')]=router; \ No newline at end of file +var _0x33cf=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','index','/:id','isAuthenticated','post','create','put'];(function(_0x4de226,_0xf589ec){var _0x2fb276=function(_0x3f99ed){while(--_0x3f99ed){_0x4de226['push'](_0x4de226['shift']());}};_0x2fb276(++_0xf589ec);}(_0x33cf,0x1d2));var _0xf33c=function(_0x349b2a,_0x2f55e7){_0x349b2a=_0x349b2a-0x0;var _0x3640a9=_0x33cf[_0x349b2a];return _0x3640a9;};'use strict';var multer=require(_0xf33c('0x0'));var util=require(_0xf33c('0x1'));var path=require(_0xf33c('0x2'));var timeout=require(_0xf33c('0x3'));var express=require(_0xf33c('0x4'));var router=express[_0xf33c('0x5')]();var fs_extra=require(_0xf33c('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xf33c('0x7'));var config=require(_0xf33c('0x8'));var controller=require(_0xf33c('0x9'));router[_0xf33c('0xa')]('/',auth['isAuthenticated'](),controller[_0xf33c('0xb')]);router[_0xf33c('0xa')](_0xf33c('0xc'),auth[_0xf33c('0xd')](),controller['show']);router[_0xf33c('0xe')]('/',auth[_0xf33c('0xd')](),controller[_0xf33c('0xf')]);router[_0xf33c('0x10')](_0xf33c('0xc'),auth[_0xf33c('0xd')](),controller[_0xf33c('0x11')]);router[_0xf33c('0x12')](_0xf33c('0xc'),auth[_0xf33c('0xd')](),controller[_0xf33c('0x13')]);module[_0xf33c('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 8e3d8c7..dd45dc4 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 _0xfb70=['name','STRING','sequelize'];(function(_0x2e8d11,_0x181aa8){var _0x5b7526=function(_0x4401bc){while(--_0x4401bc){_0x2e8d11['push'](_0x2e8d11['shift']());}};_0x5b7526(++_0x181aa8);}(_0xfb70,0x1f4));var _0x0fb7=function(_0xfd3ff4,_0x1e84d9){_0xfd3ff4=_0xfd3ff4-0x0;var _0xca5773=_0xfb70[_0xfd3ff4];return _0xca5773;};'use strict';var Sequelize=require(_0x0fb7('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x0fb7('0x1')},'description':{'type':Sequelize[_0x0fb7('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x24aa=['STRING','name','sequelize','exports'];(function(_0x43beb4,_0x20daf4){var _0x5a4267=function(_0x5e702b){while(--_0x5e702b){_0x43beb4['push'](_0x43beb4['shift']());}};_0x5a4267(++_0x20daf4);}(_0x24aa,0x1b2));var _0xa24a=function(_0x109a10,_0x1ff21b){_0x109a10=_0x109a10-0x0;var _0x28597d=_0x24aa[_0x109a10];return _0x28597d;};'use strict';var Sequelize=require(_0xa24a('0x0'));module[_0xa24a('0x1')]={'name':{'type':Sequelize[_0xa24a('0x2')],'unique':_0xa24a('0x3')},'description':{'type':Sequelize[_0xa24a('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'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 dd5b0f2..b4cb080 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 _0xe9f5=['findAll','show','params','find','create','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','body','/etc/asterisk/extensions_xcally_contexts.conf','readFileSync','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','error','VoiceContext,\x20%s,\x20%s','message','catch','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','get','Contexts','destroy','stack','name','index','map','VoiceContext','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include'];(function(_0x4bee78,_0x599cc3){var _0x310196=function(_0x26d56f){while(--_0x26d56f){_0x4bee78['push'](_0x4bee78['shift']());}};_0x310196(++_0x599cc3);}(_0xe9f5,0x140));var _0x5e9f=function(_0x414bb8,_0x17316c){_0x414bb8=_0x414bb8-0x0;var _0x5398d8=_0xe9f5[_0x414bb8];return _0x5398d8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5e9f('0x0'));var rp=require(_0x5e9f('0x1'));var moment=require(_0x5e9f('0x2'));var BPromise=require(_0x5e9f('0x3'));var Mustache=require(_0x5e9f('0x4'));var util=require('util');var path=require('path');var sox=require(_0x5e9f('0x5'));var csv=require('to-csv');var ejs=require(_0x5e9f('0x6'));var fs=require('fs');var fs_extra=require(_0x5e9f('0x7'));var _=require(_0x5e9f('0x8'));var squel=require(_0x5e9f('0x9'));var crypto=require(_0x5e9f('0xa'));var jsforce=require(_0x5e9f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x5e9f('0xc'));var querystring=require(_0x5e9f('0xd'));var Papa=require(_0x5e9f('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5e9f('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5e9f('0x10'));var utils=require(_0x5e9f('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5e9f('0x12'))['db'];var jayson=require(_0x5e9f('0x13'));var client=jayson[_0x5e9f('0x14')][_0x5e9f('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x3ecbd4,_0x5c216d,_0x1eaaed,_0x11b951){return new BPromise(function(_0x4ea5c3,_0x5bc3b7){var _0x3c0c72=_0x11b951||client;return _0x3c0c72[_0x5e9f('0x16')](_0x3ecbd4,_0x1eaaed)[_0x5e9f('0x17')](function(_0x1da0d6){logger[_0x5e9f('0x18')]('VoiceContext,\x20%s,\x20%s',_0x5c216d,_0x5e9f('0x19'));logger['debug'](_0x5e9f('0x1a'),_0x5c216d,'request\x20sent',JSON['stringify'](_0x1da0d6));if(_0x1da0d6[_0x5e9f('0x1b')]){if(_0x1da0d6[_0x5e9f('0x1b')]['code']===0x1f4){logger[_0x5e9f('0x1b')](_0x5e9f('0x1c'),_0x5c216d,_0x1da0d6[_0x5e9f('0x1b')]['message']);return _0x5bc3b7(_0x1da0d6['error']['message']);}logger[_0x5e9f('0x1b')](_0x5e9f('0x1c'),_0x5c216d,_0x1da0d6[_0x5e9f('0x1b')]['message']);return _0x4ea5c3(_0x1da0d6[_0x5e9f('0x1b')][_0x5e9f('0x1d')]);}else{logger[_0x5e9f('0x18')]('VoiceContext,\x20%s,\x20%s',_0x5c216d,_0x5e9f('0x19'));_0x4ea5c3(_0x1da0d6['result']['message']);}})[_0x5e9f('0x1e')](function(_0x5a274a){logger[_0x5e9f('0x1b')](_0x5e9f('0x1c'),_0x5c216d,_0x5a274a);_0x5bc3b7(_0x5a274a);});});}function respondWithStatusCode(_0x4de091,_0x1f1041){_0x1f1041=_0x1f1041||0xcc;return function(_0x1203cd){if(_0x1203cd){return _0x4de091[_0x5e9f('0x1f')](_0x1f1041);}return _0x4de091['status'](_0x1f1041)[_0x5e9f('0x20')]();};}function respondWithResult(_0x304a21,_0x342fdf){_0x342fdf=_0x342fdf||0xc8;return function(_0x199a9f){if(_0x199a9f){return _0x304a21['status'](_0x342fdf)[_0x5e9f('0x21')](_0x199a9f);}};}function respondWithFilteredResult(_0x33868d,_0xeed404){return function(_0x2bc265){if(_0x2bc265){var _0x12fae5=typeof _0xeed404[_0x5e9f('0x22')]===_0x5e9f('0x23')&&typeof _0xeed404[_0x5e9f('0x24')]===_0x5e9f('0x23');var _0x758387=_0x2bc265[_0x5e9f('0x25')];var _0x17a920=_0x12fae5?0x0:_0xeed404[_0x5e9f('0x22')];var _0x31b7cf=_0x12fae5?_0x2bc265[_0x5e9f('0x25')]:_0xeed404['offset']+_0xeed404[_0x5e9f('0x24')];var _0x724580;if(_0x31b7cf>=_0x758387){_0x31b7cf=_0x758387;_0x724580=0xc8;}else{_0x724580=0xce;}_0x33868d[_0x5e9f('0x26')](_0x724580);return _0x33868d[_0x5e9f('0x27')](_0x5e9f('0x28'),_0x17a920+'-'+_0x31b7cf+'/'+_0x758387)['json'](_0x2bc265);}return null;};}function patchUpdates(_0x168df0){return function(_0x3e00a2){try{jsonpatch[_0x5e9f('0x29')](_0x3e00a2,_0x168df0,!![]);}catch(_0x127e3e){return BPromise[_0x5e9f('0x2a')](_0x127e3e);}return _0x3e00a2[_0x5e9f('0x2b')]();};}function saveUpdates(_0x487538,_0x45fa75){return function(_0x12778c){if(_0x12778c){return _0x12778c[_0x5e9f('0x2c')](_0x487538)[_0x5e9f('0x17')](function(_0x51cd7c){return _0x51cd7c;});}return null;};}function removeEntity(_0xe4e700,_0x5867a8){return function(_0x284cd2){if(_0x284cd2){return _0x284cd2['destroy']()[_0x5e9f('0x17')](function(){var _0x3fe7a9=_0x284cd2[_0x5e9f('0x2d')]({'plain':!![]});var _0x397b70=_0x5e9f('0x2e');return db['UserProfileResource'][_0x5e9f('0x2f')]({'where':{'type':_0x397b70,'resourceId':_0x3fe7a9['id']}})[_0x5e9f('0x17')](function(){return _0x284cd2;});})['then'](function(){_0xe4e700[_0x5e9f('0x26')](0xcc)[_0x5e9f('0x20')]();});}};}function handleEntityNotFound(_0x5d7fe9,_0x320a94){return function(_0x42955b){if(!_0x42955b){_0x5d7fe9[_0x5e9f('0x1f')](0x194);}return _0x42955b;};}function handleError(_0x2633ab,_0x44cf51){_0x44cf51=_0x44cf51||0x1f4;return function(_0x22b02c){logger['error'](_0x22b02c[_0x5e9f('0x30')]);if(_0x22b02c[_0x5e9f('0x31')]){delete _0x22b02c['name'];}_0x2633ab[_0x5e9f('0x26')](_0x44cf51)['send'](_0x22b02c);};}exports[_0x5e9f('0x32')]=function(_0x1eb985,_0x5b1d5f){var _0xe6162d={},_0x201b00={},_0x100095={'count':0x0,'rows':[]};var _0x128707=_[_0x5e9f('0x33')](db[_0x5e9f('0x34')][_0x5e9f('0x35')],function(_0x33de7e){return{'name':_0x33de7e[_0x5e9f('0x36')],'type':_0x33de7e[_0x5e9f('0x37')][_0x5e9f('0x38')]};});_0x201b00['model']=_[_0x5e9f('0x33')](_0x128707,_0x5e9f('0x31'));_0x201b00['query']=_[_0x5e9f('0x39')](_0x1eb985[_0x5e9f('0x3a')]);_0x201b00[_0x5e9f('0x3b')]=_[_0x5e9f('0x3c')](_0x201b00['model'],_0x201b00['query']);_0xe6162d['attributes']=_[_0x5e9f('0x3c')](_0x201b00[_0x5e9f('0x3d')],qs[_0x5e9f('0x3e')](_0x1eb985['query'][_0x5e9f('0x3e')]));_0xe6162d[_0x5e9f('0x3f')]=_0xe6162d[_0x5e9f('0x3f')][_0x5e9f('0x40')]?_0xe6162d[_0x5e9f('0x3f')]:_0x201b00[_0x5e9f('0x3d')];if(!_0x1eb985[_0x5e9f('0x3a')][_0x5e9f('0x41')]('nolimit')){_0xe6162d[_0x5e9f('0x24')]=qs[_0x5e9f('0x24')](_0x1eb985[_0x5e9f('0x3a')]['limit']);_0xe6162d[_0x5e9f('0x22')]=qs['offset'](_0x1eb985['query'][_0x5e9f('0x22')]);}_0xe6162d[_0x5e9f('0x42')]=qs[_0x5e9f('0x43')](_0x1eb985[_0x5e9f('0x3a')]['sort']);_0xe6162d[_0x5e9f('0x44')]=qs['filters'](_[_0x5e9f('0x45')](_0x1eb985[_0x5e9f('0x3a')],_0x201b00[_0x5e9f('0x3b')]),_0x128707);if(_0x1eb985[_0x5e9f('0x3a')][_0x5e9f('0x46')]){_0xe6162d[_0x5e9f('0x44')]=_[_0x5e9f('0x47')](_0xe6162d[_0x5e9f('0x44')],{'$or':_['map'](_0x128707,function(_0x23b1f5){if(_0x23b1f5[_0x5e9f('0x37')]!==_0x5e9f('0x48')){var _0x243a22={};_0x243a22[_0x23b1f5['name']]={'$like':'%'+_0x1eb985[_0x5e9f('0x3a')][_0x5e9f('0x46')]+'%'};return _0x243a22;}})});}_0xe6162d=_[_0x5e9f('0x47')]({},_0xe6162d,_0x1eb985[_0x5e9f('0x49')]);var _0xa9a8bc={'where':_0xe6162d[_0x5e9f('0x44')]};return db[_0x5e9f('0x34')]['count'](_0xa9a8bc)[_0x5e9f('0x17')](function(_0x4e62a5){_0x100095[_0x5e9f('0x25')]=_0x4e62a5;if(_0x1eb985[_0x5e9f('0x3a')][_0x5e9f('0x4a')]){_0xe6162d[_0x5e9f('0x4b')]=[{'all':!![]}];}return db['VoiceContext'][_0x5e9f('0x4c')](_0xe6162d);})[_0x5e9f('0x17')](function(_0x3a8d4c){_0x100095['rows']=_0x3a8d4c;return _0x100095;})[_0x5e9f('0x17')](respondWithFilteredResult(_0x5b1d5f,_0xe6162d))['catch'](handleError(_0x5b1d5f,null));};exports[_0x5e9f('0x4d')]=function(_0x3ca7f7,_0x250584){var _0x1525d6={'raw':![],'where':{'id':_0x3ca7f7[_0x5e9f('0x4e')]['id']}},_0x428d29={};_0x428d29[_0x5e9f('0x3d')]=_['keys'](db[_0x5e9f('0x34')][_0x5e9f('0x35')]);_0x428d29[_0x5e9f('0x3a')]=_[_0x5e9f('0x39')](_0x3ca7f7[_0x5e9f('0x3a')]);_0x428d29[_0x5e9f('0x3b')]=_[_0x5e9f('0x3c')](_0x428d29[_0x5e9f('0x3d')],_0x428d29[_0x5e9f('0x3a')]);_0x1525d6[_0x5e9f('0x3f')]=_[_0x5e9f('0x3c')](_0x428d29[_0x5e9f('0x3d')],qs[_0x5e9f('0x3e')](_0x3ca7f7['query'][_0x5e9f('0x3e')]));_0x1525d6[_0x5e9f('0x3f')]=_0x1525d6['attributes']['length']?_0x1525d6['attributes']:_0x428d29['model'];if(_0x3ca7f7[_0x5e9f('0x3a')]['includeAll']){_0x1525d6[_0x5e9f('0x4b')]=[{'all':!![]}];}_0x1525d6=_[_0x5e9f('0x47')]({},_0x1525d6,_0x3ca7f7[_0x5e9f('0x49')]);return db[_0x5e9f('0x34')][_0x5e9f('0x4f')](_0x1525d6)['then'](handleEntityNotFound(_0x250584,null))[_0x5e9f('0x17')](respondWithResult(_0x250584,null))[_0x5e9f('0x1e')](handleError(_0x250584,null));};exports[_0x5e9f('0x50')]=function(_0x334291,_0x49e559,_0x2310ea){var _0x1801cd;return db[_0x5e9f('0x34')][_0x5e9f('0x50')](_0x334291['body'],{'raw':!![]})[_0x5e9f('0x17')](function(_0x3ff131){_0x1801cd=_0x3ff131;return db[_0x5e9f('0x34')][_0x5e9f('0x4c')]({'raw':!![]});})[_0x5e9f('0x17')](function(_0x57984d){var _0x3fa94b=fs['readFileSync'](path[_0x5e9f('0x51')](config[_0x5e9f('0x52')],_0x5e9f('0x53')),_0x5e9f('0x54'));var _0xb20d0=ejs[_0x5e9f('0x55')](_0x3fa94b,{'contexts':_0x57984d||[]});fs[_0x5e9f('0x56')]('/etc/asterisk/extensions_xcally_contexts.conf',_0xb20d0);})['then'](function(){return respondWithRpcPromise(_0x5e9f('0x57'),_0x5e9f('0x50'),{'module':_0x5e9f('0x58')});})['then'](function(){var _0x4e82e3=_0x334291[_0x5e9f('0x59')][_0x5e9f('0x2d')]({'plain':!![]});if(!_0x4e82e3)throw new Error(_0x5e9f('0x5a'));if(_0x4e82e3[_0x5e9f('0x5b')]===_0x5e9f('0x59')){var _0x4af743=_0x1801cd[_0x5e9f('0x2d')]({'plain':!![]});return db[_0x5e9f('0x5c')][_0x5e9f('0x4f')]({'where':{'name':_0x5e9f('0x2e'),'userProfileId':_0x4e82e3[_0x5e9f('0x5d')]},'raw':!![]})[_0x5e9f('0x17')](function(_0x518c8b){if(_0x518c8b&&_0x518c8b[_0x5e9f('0x5e')]===0x0){return db[_0x5e9f('0x5f')]['create']({'name':_0x4af743[_0x5e9f('0x31')],'resourceId':_0x4af743['id'],'type':_0x518c8b[_0x5e9f('0x31')],'sectionId':_0x518c8b['id']},{})[_0x5e9f('0x17')](function(){return _0x1801cd;});}else{return _0x1801cd;}})[_0x5e9f('0x1e')](function(_0x981a61){logger[_0x5e9f('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x981a61);throw _0x981a61;});}return _0x1801cd;})[_0x5e9f('0x17')](respondWithResult(_0x49e559,0xc9))[_0x5e9f('0x1e')](handleError(_0x49e559,null));};exports[_0x5e9f('0x2c')]=function(_0x383b7e,_0xba6447,_0x598e02){var _0x2cd1bd;return db[_0x5e9f('0x34')][_0x5e9f('0x4f')]({'where':{'id':_0x383b7e[_0x5e9f('0x4e')]['id']}})['then'](handleEntityNotFound(_0xba6447,null))[_0x5e9f('0x17')](saveUpdates(_0x383b7e[_0x5e9f('0x60')],null))[_0x5e9f('0x17')](function(_0x493e77){if(_0x493e77){_0x2cd1bd=_0x493e77;return db[_0x5e9f('0x34')]['findAll']({'raw':!![]});}})[_0x5e9f('0x17')](function(_0x23eb4a){var _0x4232de=fs['readFileSync'](path['join'](config['root'],_0x5e9f('0x53')),_0x5e9f('0x54'));var _0x221064=ejs[_0x5e9f('0x55')](_0x4232de,{'contexts':_0x23eb4a||[]});fs[_0x5e9f('0x56')](_0x5e9f('0x61'),_0x221064);})[_0x5e9f('0x17')](function(){return respondWithRpcPromise(_0x5e9f('0x57'),_0x5e9f('0x2c'),{'module':_0x5e9f('0x58')});})['then'](function(){return _0x2cd1bd;})[_0x5e9f('0x17')](respondWithResult(_0xba6447,null))[_0x5e9f('0x1e')](handleError(_0xba6447,null));};exports[_0x5e9f('0x2f')]=function(_0x2248d0,_0xa6d37f,_0x2b1e73){var _0x46231c;return db[_0x5e9f('0x34')][_0x5e9f('0x4f')]({'where':{'id':_0x2248d0[_0x5e9f('0x4e')]['id']}})['then'](handleEntityNotFound(_0xa6d37f,null))[_0x5e9f('0x17')](removeEntity(_0xa6d37f,null))[_0x5e9f('0x17')](function(){return db[_0x5e9f('0x34')][_0x5e9f('0x4c')]({'raw':!![]});})[_0x5e9f('0x17')](function(_0x2db928){var _0x4dedfb=fs[_0x5e9f('0x62')](path[_0x5e9f('0x51')](config[_0x5e9f('0x52')],_0x5e9f('0x53')),'utf8');var _0x3fcd36=ejs[_0x5e9f('0x55')](_0x4dedfb,{'contexts':_0x2db928});fs[_0x5e9f('0x56')](_0x5e9f('0x61'),_0x3fcd36);return respondWithRpcPromise('Reload',_0x5e9f('0x2f'),{'module':_0x5e9f('0x58')});})['catch'](handleError(_0xa6d37f,null));}; \ No newline at end of file +var _0x5475=['limit','undefined','count','set','Content-Range','apply','reject','save','update','get','UserProfileResource','destroy','stack','send','index','map','VoiceContext','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','rows','show','params','includeAll','find','create','body','findAll','readFileSync','root','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Contexts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/context.ejs','chan_sip.so','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','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','then','info','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','VoiceContext,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset'];(function(_0x5c378f,_0x3077b6){var _0x55dca5=function(_0x754f40){while(--_0x754f40){_0x5c378f['push'](_0x5c378f['shift']());}};_0x55dca5(++_0x3077b6);}(_0x5475,0xaf));var _0x5547=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x5475[_0x68c979];return _0x4f0001;};'use strict';var emlformat=require(_0x5547('0x0'));var rimraf=require(_0x5547('0x1'));var zipdir=require(_0x5547('0x2'));var jsonpatch=require(_0x5547('0x3'));var rp=require(_0x5547('0x4'));var moment=require(_0x5547('0x5'));var BPromise=require(_0x5547('0x6'));var Mustache=require(_0x5547('0x7'));var util=require(_0x5547('0x8'));var path=require(_0x5547('0x9'));var sox=require('sox');var csv=require(_0x5547('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5547('0xb'));var _=require(_0x5547('0xc'));var squel=require(_0x5547('0xd'));var crypto=require(_0x5547('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x5547('0xf'));var toCsv=require('to-csv');var querystring=require(_0x5547('0x10'));var Papa=require(_0x5547('0x11'));var Redis=require(_0x5547('0x12'));var authService=require(_0x5547('0x13'));var qs=require(_0x5547('0x14'));var as=require(_0x5547('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5547('0x16'))('api');var utils=require(_0x5547('0x17'));var config=require(_0x5547('0x18'));var licenseUtil=require(_0x5547('0x19'));var db=require(_0x5547('0x1a'))['db'];var jayson=require(_0x5547('0x1b'));var client=jayson['client'][_0x5547('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x528f38,_0x2907ad,_0x11a679,_0x37d06c){return new BPromise(function(_0x25c929,_0xa788b5){var _0xe6f5d6=_0x37d06c||client;return _0xe6f5d6['request'](_0x528f38,_0x11a679)[_0x5547('0x1d')](function(_0x174995){logger[_0x5547('0x1e')]('VoiceContext,\x20%s,\x20%s',_0x2907ad,'request\x20sent');logger[_0x5547('0x1f')](_0x5547('0x20'),_0x2907ad,'request\x20sent',JSON[_0x5547('0x21')](_0x174995));if(_0x174995['error']){if(_0x174995['error']['code']===0x1f4){logger[_0x5547('0x22')](_0x5547('0x23'),_0x2907ad,_0x174995['error'][_0x5547('0x24')]);return _0xa788b5(_0x174995['error'][_0x5547('0x24')]);}logger[_0x5547('0x22')](_0x5547('0x23'),_0x2907ad,_0x174995[_0x5547('0x22')][_0x5547('0x24')]);return _0x25c929(_0x174995[_0x5547('0x22')][_0x5547('0x24')]);}else{logger[_0x5547('0x1e')]('VoiceContext,\x20%s,\x20%s',_0x2907ad,'request\x20sent');_0x25c929(_0x174995[_0x5547('0x25')][_0x5547('0x24')]);}})[_0x5547('0x26')](function(_0x3a8b37){logger[_0x5547('0x22')]('VoiceContext,\x20%s,\x20%s',_0x2907ad,_0x3a8b37);_0xa788b5(_0x3a8b37);});});}function respondWithStatusCode(_0x2b9a2b,_0x31bc08){_0x31bc08=_0x31bc08||0xcc;return function(_0x7b8b07){if(_0x7b8b07){return _0x2b9a2b[_0x5547('0x27')](_0x31bc08);}return _0x2b9a2b[_0x5547('0x28')](_0x31bc08)['end']();};}function respondWithResult(_0x4adb08,_0x4e4d08){_0x4e4d08=_0x4e4d08||0xc8;return function(_0x5681f9){if(_0x5681f9){return _0x4adb08['status'](_0x4e4d08)[_0x5547('0x29')](_0x5681f9);}};}function respondWithFilteredResult(_0x564be6,_0x2145d6){return function(_0x308631){if(_0x308631){var _0x430546=typeof _0x2145d6[_0x5547('0x2a')]==='undefined'&&typeof _0x2145d6[_0x5547('0x2b')]===_0x5547('0x2c');var _0x304a78=_0x308631[_0x5547('0x2d')];var _0x542aea=_0x430546?0x0:_0x2145d6[_0x5547('0x2a')];var _0x4e057f=_0x430546?_0x308631[_0x5547('0x2d')]:_0x2145d6[_0x5547('0x2a')]+_0x2145d6['limit'];var _0x35f79f;if(_0x4e057f>=_0x304a78){_0x4e057f=_0x304a78;_0x35f79f=0xc8;}else{_0x35f79f=0xce;}_0x564be6[_0x5547('0x28')](_0x35f79f);return _0x564be6[_0x5547('0x2e')](_0x5547('0x2f'),_0x542aea+'-'+_0x4e057f+'/'+_0x304a78)['json'](_0x308631);}return null;};}function patchUpdates(_0x1a8358){return function(_0x41fbf0){try{jsonpatch[_0x5547('0x30')](_0x41fbf0,_0x1a8358,!![]);}catch(_0x124760){return BPromise[_0x5547('0x31')](_0x124760);}return _0x41fbf0[_0x5547('0x32')]();};}function saveUpdates(_0x3229c7,_0x617bb3){return function(_0x196722){if(_0x196722){return _0x196722[_0x5547('0x33')](_0x3229c7)[_0x5547('0x1d')](function(_0xfb85a3){return _0xfb85a3;});}return null;};}function removeEntity(_0x1fafc4,_0x2cb583){return function(_0x1d0706){if(_0x1d0706){return _0x1d0706['destroy']()[_0x5547('0x1d')](function(){var _0x41b0d1=_0x1d0706[_0x5547('0x34')]({'plain':!![]});var _0x1b4365='Contexts';return db[_0x5547('0x35')][_0x5547('0x36')]({'where':{'type':_0x1b4365,'resourceId':_0x41b0d1['id']}})[_0x5547('0x1d')](function(){return _0x1d0706;});})[_0x5547('0x1d')](function(){_0x1fafc4[_0x5547('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x27e58a,_0x37bf0a){return function(_0x3c1d95){if(!_0x3c1d95){_0x27e58a[_0x5547('0x27')](0x194);}return _0x3c1d95;};}function handleError(_0xb56d67,_0x19c820){_0x19c820=_0x19c820||0x1f4;return function(_0x1cd7a3){logger[_0x5547('0x22')](_0x1cd7a3[_0x5547('0x37')]);if(_0x1cd7a3['name']){delete _0x1cd7a3['name'];}_0xb56d67[_0x5547('0x28')](_0x19c820)[_0x5547('0x38')](_0x1cd7a3);};}exports[_0x5547('0x39')]=function(_0x4b6011,_0x1fd9c5){var _0x2549db={},_0x7c10e={},_0x4a0fe4={'count':0x0,'rows':[]};var _0x529078=_[_0x5547('0x3a')](db[_0x5547('0x3b')]['rawAttributes'],function(_0x2d4058){return{'name':_0x2d4058[_0x5547('0x3c')],'type':_0x2d4058[_0x5547('0x3d')][_0x5547('0x3e')]};});_0x7c10e[_0x5547('0x3f')]=_[_0x5547('0x3a')](_0x529078,_0x5547('0x40'));_0x7c10e[_0x5547('0x41')]=_[_0x5547('0x42')](_0x4b6011[_0x5547('0x41')]);_0x7c10e[_0x5547('0x43')]=_[_0x5547('0x44')](_0x7c10e[_0x5547('0x3f')],_0x7c10e[_0x5547('0x41')]);_0x2549db[_0x5547('0x45')]=_['intersection'](_0x7c10e[_0x5547('0x3f')],qs[_0x5547('0x46')](_0x4b6011[_0x5547('0x41')][_0x5547('0x46')]));_0x2549db[_0x5547('0x45')]=_0x2549db[_0x5547('0x45')][_0x5547('0x47')]?_0x2549db[_0x5547('0x45')]:_0x7c10e[_0x5547('0x3f')];if(!_0x4b6011[_0x5547('0x41')][_0x5547('0x48')](_0x5547('0x49'))){_0x2549db[_0x5547('0x2b')]=qs['limit'](_0x4b6011[_0x5547('0x41')]['limit']);_0x2549db[_0x5547('0x2a')]=qs[_0x5547('0x2a')](_0x4b6011['query']['offset']);}_0x2549db[_0x5547('0x4a')]=qs[_0x5547('0x4b')](_0x4b6011[_0x5547('0x41')][_0x5547('0x4b')]);_0x2549db[_0x5547('0x4c')]=qs[_0x5547('0x43')](_[_0x5547('0x4d')](_0x4b6011[_0x5547('0x41')],_0x7c10e[_0x5547('0x43')]),_0x529078);if(_0x4b6011[_0x5547('0x41')][_0x5547('0x4e')]){_0x2549db['where']=_['merge'](_0x2549db['where'],{'$or':_[_0x5547('0x3a')](_0x529078,function(_0x221560){if(_0x221560[_0x5547('0x3d')]!==_0x5547('0x4f')){var _0xc25f1d={};_0xc25f1d[_0x221560[_0x5547('0x40')]]={'$like':'%'+_0x4b6011[_0x5547('0x41')][_0x5547('0x4e')]+'%'};return _0xc25f1d;}})});}_0x2549db=_[_0x5547('0x50')]({},_0x2549db,_0x4b6011[_0x5547('0x51')]);var _0x59bc77={'where':_0x2549db[_0x5547('0x4c')]};return db['VoiceContext']['count'](_0x59bc77)[_0x5547('0x1d')](function(_0x5763ea){_0x4a0fe4[_0x5547('0x2d')]=_0x5763ea;if(_0x4b6011[_0x5547('0x41')]['includeAll']){_0x2549db[_0x5547('0x52')]=[{'all':!![]}];}return db[_0x5547('0x3b')]['findAll'](_0x2549db);})['then'](function(_0x4c9d92){_0x4a0fe4[_0x5547('0x53')]=_0x4c9d92;return _0x4a0fe4;})[_0x5547('0x1d')](respondWithFilteredResult(_0x1fd9c5,_0x2549db))[_0x5547('0x26')](handleError(_0x1fd9c5,null));};exports[_0x5547('0x54')]=function(_0x506d8a,_0x337039){var _0x3ed5a5={'raw':![],'where':{'id':_0x506d8a[_0x5547('0x55')]['id']}},_0x18771b={};_0x18771b['model']=_[_0x5547('0x42')](db[_0x5547('0x3b')]['rawAttributes']);_0x18771b['query']=_[_0x5547('0x42')](_0x506d8a[_0x5547('0x41')]);_0x18771b[_0x5547('0x43')]=_['intersection'](_0x18771b[_0x5547('0x3f')],_0x18771b[_0x5547('0x41')]);_0x3ed5a5['attributes']=_['intersection'](_0x18771b[_0x5547('0x3f')],qs[_0x5547('0x46')](_0x506d8a['query'][_0x5547('0x46')]));_0x3ed5a5[_0x5547('0x45')]=_0x3ed5a5[_0x5547('0x45')]['length']?_0x3ed5a5['attributes']:_0x18771b[_0x5547('0x3f')];if(_0x506d8a[_0x5547('0x41')][_0x5547('0x56')]){_0x3ed5a5[_0x5547('0x52')]=[{'all':!![]}];}_0x3ed5a5=_[_0x5547('0x50')]({},_0x3ed5a5,_0x506d8a[_0x5547('0x51')]);return db[_0x5547('0x3b')][_0x5547('0x57')](_0x3ed5a5)['then'](handleEntityNotFound(_0x337039,null))[_0x5547('0x1d')](respondWithResult(_0x337039,null))[_0x5547('0x26')](handleError(_0x337039,null));};exports[_0x5547('0x58')]=function(_0x2c5aa,_0x4ba2b0,_0x1a79b8){var _0x55dc74;return db['VoiceContext']['create'](_0x2c5aa[_0x5547('0x59')],{'raw':!![]})[_0x5547('0x1d')](function(_0x174b71){_0x55dc74=_0x174b71;return db['VoiceContext'][_0x5547('0x5a')]({'raw':!![]});})['then'](function(_0x272acb){var _0x5c8790=fs[_0x5547('0x5b')](path['join'](config[_0x5547('0x5c')],'server/files/templates/context.ejs'),_0x5547('0x5d'));var _0x525860=ejs[_0x5547('0x5e')](_0x5c8790,{'contexts':_0x272acb||[]});fs[_0x5547('0x5f')](_0x5547('0x60'),_0x525860);})[_0x5547('0x1d')](function(){return respondWithRpcPromise(_0x5547('0x61'),_0x5547('0x58'),{'module':'chan_sip.so'});})[_0x5547('0x1d')](function(){var _0x57bfbf=_0x2c5aa[_0x5547('0x62')][_0x5547('0x34')]({'plain':!![]});if(!_0x57bfbf)throw new Error(_0x5547('0x63'));if(_0x57bfbf[_0x5547('0x64')]===_0x5547('0x62')){var _0x5160fa=_0x55dc74[_0x5547('0x34')]({'plain':!![]});return db[_0x5547('0x65')][_0x5547('0x57')]({'where':{'name':_0x5547('0x66'),'userProfileId':_0x57bfbf[_0x5547('0x67')]},'raw':!![]})[_0x5547('0x1d')](function(_0x4af9ee){if(_0x4af9ee&&_0x4af9ee[_0x5547('0x68')]===0x0){return db[_0x5547('0x35')][_0x5547('0x58')]({'name':_0x5160fa[_0x5547('0x40')],'resourceId':_0x5160fa['id'],'type':_0x4af9ee[_0x5547('0x40')],'sectionId':_0x4af9ee['id']},{})['then'](function(){return _0x55dc74;});}else{return _0x55dc74;}})[_0x5547('0x26')](function(_0x294ee2){logger[_0x5547('0x22')](_0x5547('0x69'),_0x294ee2);throw _0x294ee2;});}return _0x55dc74;})[_0x5547('0x1d')](respondWithResult(_0x4ba2b0,0xc9))[_0x5547('0x26')](handleError(_0x4ba2b0,null));};exports['update']=function(_0x7856cd,_0x321aa2,_0x5abff6){var _0xc20153;return db['VoiceContext'][_0x5547('0x57')]({'where':{'id':_0x7856cd['params']['id']}})[_0x5547('0x1d')](handleEntityNotFound(_0x321aa2,null))[_0x5547('0x1d')](saveUpdates(_0x7856cd[_0x5547('0x59')],null))[_0x5547('0x1d')](function(_0xa773b8){if(_0xa773b8){_0xc20153=_0xa773b8;return db[_0x5547('0x3b')][_0x5547('0x5a')]({'raw':!![]});}})['then'](function(_0x279df2){var _0x146f5b=fs[_0x5547('0x5b')](path[_0x5547('0x6a')](config[_0x5547('0x5c')],_0x5547('0x6b')),_0x5547('0x5d'));var _0x456722=ejs['render'](_0x146f5b,{'contexts':_0x279df2||[]});fs[_0x5547('0x5f')](_0x5547('0x60'),_0x456722);})[_0x5547('0x1d')](function(){return respondWithRpcPromise(_0x5547('0x61'),_0x5547('0x33'),{'module':_0x5547('0x6c')});})[_0x5547('0x1d')](function(){return _0xc20153;})[_0x5547('0x1d')](respondWithResult(_0x321aa2,null))[_0x5547('0x26')](handleError(_0x321aa2,null));};exports['destroy']=function(_0xb23cc5,_0x40359f,_0x4faf02){var _0x35a385;return db[_0x5547('0x3b')]['find']({'where':{'id':_0xb23cc5[_0x5547('0x55')]['id']}})[_0x5547('0x1d')](handleEntityNotFound(_0x40359f,null))['then'](removeEntity(_0x40359f,null))['then'](function(){return db[_0x5547('0x3b')]['findAll']({'raw':!![]});})[_0x5547('0x1d')](function(_0x527284){var _0x266910=fs[_0x5547('0x5b')](path['join'](config[_0x5547('0x5c')],_0x5547('0x6b')),_0x5547('0x5d'));var _0x7aedbe=ejs[_0x5547('0x5e')](_0x266910,{'contexts':_0x527284});fs[_0x5547('0x5f')](_0x5547('0x60'),_0x7aedbe);return respondWithRpcPromise(_0x5547('0x61'),_0x5547('0x36'),{'module':_0x5547('0x6c')});})[_0x5547('0x26')](handleError(_0x40359f,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 1c34b22..af0b548 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 _0x2884=['../../config/environment','./voiceContext.attributes','define','VoiceContext','voice_contexts','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x68a0b0,_0x2bba91){var _0x4b4ee6=function(_0x36f6da){while(--_0x36f6da){_0x68a0b0['push'](_0x68a0b0['shift']());}};_0x4b4ee6(++_0x2bba91);}(_0x2884,0xb9));var _0x4288=function(_0x3fb9dd,_0x174fff){_0x3fb9dd=_0x3fb9dd-0x0;var _0x20136a=_0x2884[_0x3fb9dd];return _0x20136a;};'use strict';var _=require('lodash');var util=require(_0x4288('0x0'));var logger=require(_0x4288('0x1'))(_0x4288('0x2'));var moment=require('moment');var BPromise=require(_0x4288('0x3'));var rp=require(_0x4288('0x4'));var fs=require('fs');var path=require(_0x4288('0x5'));var rimraf=require(_0x4288('0x6'));var config=require(_0x4288('0x7'));var attributes=require(_0x4288('0x8'));module['exports']=function(_0x231984,_0x2d98e4){return _0x231984[_0x4288('0x9')](_0x4288('0xa'),attributes,{'tableName':_0x4288('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xccbd=['../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','lodash','util'];(function(_0x37c004,_0x4db92e){var _0x481c5b=function(_0x85d2f0){while(--_0x85d2f0){_0x37c004['push'](_0x37c004['shift']());}};_0x481c5b(++_0x4db92e);}(_0xccbd,0xb2));var _0xdccb=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xccbd[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xdccb('0x0'));var util=require(_0xdccb('0x1'));var logger=require(_0xdccb('0x2'))('api');var moment=require('moment');var BPromise=require(_0xdccb('0x3'));var rp=require(_0xdccb('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdccb('0x5'));var config=require(_0xdccb('0x6'));var attributes=require(_0xdccb('0x7'));module[_0xdccb('0x8')]=function(_0x3ea29a,_0x1b22bb){return _0x3ea29a[_0xdccb('0x9')](_0xdccb('0xa'),attributes,{'tableName':_0xdccb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index 48dc26f..032ed02 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 _0x6257=['info','request\x20sent','debug','code','message','error','VoiceContext,\x20%s,\x20%s','result','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x2670ac,_0x416f90){var _0x75b69e=function(_0x307fd2){while(--_0x307fd2){_0x2670ac['push'](_0x2670ac['shift']());}};_0x75b69e(++_0x416f90);}(_0x6257,0x1d4));var _0x7625=function(_0x1ca925,_0x11e098){_0x1ca925=_0x1ca925-0x0;var _0x19f311=_0x6257[_0x1ca925];return _0x19f311;};'use strict';var _=require(_0x7625('0x0'));var util=require('util');var moment=require(_0x7625('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7625('0x2'));var db=require(_0x7625('0x3'))['db'];var utils=require(_0x7625('0x4'));var logger=require(_0x7625('0x5'))(_0x7625('0x6'));var config=require(_0x7625('0x7'));var jayson=require(_0x7625('0x8'));var client=jayson[_0x7625('0x9')][_0x7625('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x427050,_0x5cf7a8,_0x4b790d){return new BPromise(function(_0x287434,_0x1a02de){return client['request'](_0x427050,_0x4b790d)[_0x7625('0xb')](function(_0x2a2625){logger[_0x7625('0xc')]('VoiceContext,\x20%s,\x20%s',_0x5cf7a8,_0x7625('0xd'));logger[_0x7625('0xe')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x5cf7a8,_0x7625('0xd'),JSON['stringify'](_0x2a2625));if(_0x2a2625['error']){if(_0x2a2625['error'][_0x7625('0xf')]===0x1f4){logger['error']('VoiceContext,\x20%s,\x20%s',_0x5cf7a8,_0x2a2625['error'][_0x7625('0x10')]);return _0x1a02de(_0x2a2625[_0x7625('0x11')][_0x7625('0x10')]);}logger[_0x7625('0x11')](_0x7625('0x12'),_0x5cf7a8,_0x2a2625[_0x7625('0x11')]['message']);return _0x287434(_0x2a2625['error'][_0x7625('0x10')]);}else{logger['info'](_0x7625('0x12'),_0x5cf7a8,_0x7625('0xd'));_0x287434(_0x2a2625[_0x7625('0x13')]['message']);}})['catch'](function(_0x43206e){logger[_0x7625('0x11')](_0x7625('0x12'),_0x5cf7a8,_0x43206e);_0x1a02de(_0x43206e);});});} \ No newline at end of file +var _0x6b20=['request','VoiceContext,\x20%s,\x20%s','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x9ecc21,_0xc4e45d){var _0xc15014=function(_0x30e720){while(--_0x30e720){_0x9ecc21['push'](_0x9ecc21['shift']());}};_0xc15014(++_0xc4e45d);}(_0x6b20,0xd1));var _0x06b2=function(_0x227b41,_0x1e1d00){_0x227b41=_0x227b41-0x0;var _0xa84fb8=_0x6b20[_0x227b41];return _0xa84fb8;};'use strict';var _=require(_0x06b2('0x0'));var util=require(_0x06b2('0x1'));var moment=require('moment');var BPromise=require(_0x06b2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x06b2('0x3'));var db=require(_0x06b2('0x4'))['db'];var utils=require(_0x06b2('0x5'));var logger=require('../../config/logger')(_0x06b2('0x6'));var config=require(_0x06b2('0x7'));var jayson=require(_0x06b2('0x8'));var client=jayson[_0x06b2('0x9')][_0x06b2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x37b825,_0x26a325,_0x4e6d3b){return new BPromise(function(_0x21cd31,_0x1828e4){return client[_0x06b2('0xb')](_0x37b825,_0x4e6d3b)['then'](function(_0x37ace0){logger['info'](_0x06b2('0xc'),_0x26a325,'request\x20sent');logger['debug'](_0x06b2('0xd'),_0x26a325,_0x06b2('0xe'),JSON['stringify'](_0x37ace0));if(_0x37ace0[_0x06b2('0xf')]){if(_0x37ace0[_0x06b2('0xf')][_0x06b2('0x10')]===0x1f4){logger[_0x06b2('0xf')](_0x06b2('0xc'),_0x26a325,_0x37ace0[_0x06b2('0xf')][_0x06b2('0x11')]);return _0x1828e4(_0x37ace0[_0x06b2('0xf')][_0x06b2('0x11')]);}logger[_0x06b2('0xf')](_0x06b2('0xc'),_0x26a325,_0x37ace0[_0x06b2('0xf')][_0x06b2('0x11')]);return _0x21cd31(_0x37ace0['error'][_0x06b2('0x11')]);}else{logger[_0x06b2('0x12')](_0x06b2('0xc'),_0x26a325,_0x06b2('0xe'));_0x21cd31(_0x37ace0[_0x06b2('0x13')][_0x06b2('0x11')]);}})['catch'](function(_0x17e69b){logger[_0x06b2('0xf')]('VoiceContext,\x20%s,\x20%s',_0x26a325,_0x17e69b);_0x1828e4(_0x17e69b);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index f8c65ef..c4c0176 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 _0x47c0=['../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x588791,_0x35a42e){var _0x28937a=function(_0x8ca701){while(--_0x8ca701){_0x588791['push'](_0x588791['shift']());}};_0x28937a(++_0x35a42e);}(_0x47c0,0x1dc));var _0x047c=function(_0x3fc878,_0x19aec0){_0x3fc878=_0x3fc878-0x0;var _0x5b8b1c=_0x47c0[_0x3fc878];return _0x5b8b1c;};'use strict';var multer=require(_0x047c('0x0'));var util=require(_0x047c('0x1'));var path=require(_0x047c('0x2'));var timeout=require('connect-timeout');var express=require(_0x047c('0x3'));var router=express[_0x047c('0x4')]();var fs_extra=require(_0x047c('0x5'));var auth=require(_0x047c('0x6'));var interaction=require(_0x047c('0x7'));var config=require(_0x047c('0x8'));var controller=require('./voiceDialReport.controller');router[_0x047c('0x9')]('/',auth['isAuthenticated'](),controller[_0x047c('0xa')]);router[_0x047c('0x9')]('/describe',auth[_0x047c('0xb')](),controller[_0x047c('0xc')]);router[_0x047c('0x9')](_0x047c('0xd'),auth[_0x047c('0xb')](),controller['show']);router[_0x047c('0xe')]('/',auth['isAuthenticated'](),controller[_0x047c('0xf')]);router[_0x047c('0x10')](_0x047c('0xd'),auth['isAuthenticated'](),controller[_0x047c('0x11')]);router[_0x047c('0x12')](_0x047c('0xd'),auth[_0x047c('0xb')](),controller[_0x047c('0x13')]);module[_0x047c('0x14')]=router; \ No newline at end of file +var _0xf377=['delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','describe','/:id','post','create','update'];(function(_0x5d4d09,_0x46bb48){var _0x2d25cb=function(_0x1f4138){while(--_0x1f4138){_0x5d4d09['push'](_0x5d4d09['shift']());}};_0x2d25cb(++_0x46bb48);}(_0xf377,0x113));var _0x7f37=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xf377[_0x5e3b04];return _0x1fc44d;};'use strict';var multer=require(_0x7f37('0x0'));var util=require(_0x7f37('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7f37('0x2'));var router=express[_0x7f37('0x3')]();var fs_extra=require(_0x7f37('0x4'));var auth=require(_0x7f37('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7f37('0x6'));var controller=require('./voiceDialReport.controller');router[_0x7f37('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7f37('0x7')]('/describe',auth[_0x7f37('0x8')](),controller[_0x7f37('0x9')]);router[_0x7f37('0x7')](_0x7f37('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x7f37('0xb')]('/',auth['isAuthenticated'](),controller[_0x7f37('0xc')]);router['put'](_0x7f37('0xa'),auth['isAuthenticated'](),controller[_0x7f37('0xd')]);router[_0x7f37('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x7f37('0xf')]);module[_0x7f37('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 b9f255d..f40ce08 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 _0xedd9=['DATE','called,connect,complete','exports','STRING','INTEGER'];(function(_0x386797,_0x481726){var _0x5cc78f=function(_0x4668c8){while(--_0x4668c8){_0x386797['push'](_0x386797['shift']());}};_0x5cc78f(++_0x481726);}(_0xedd9,0xfc));var _0x9edd=function(_0xdb6f79,_0x566312){_0xdb6f79=_0xdb6f79-0x0;var _0x2d546d=_0xedd9[_0xdb6f79];return _0x2d546d;};'use strict';var Sequelize=require('sequelize');module[_0x9edd('0x0')]={'privilege':{'type':Sequelize[_0x9edd('0x1')]},'channel':{'type':Sequelize[_0x9edd('0x1')]},'channelstate':{'type':Sequelize[_0x9edd('0x2')]},'channelstatedesc':{'type':Sequelize[_0x9edd('0x1')]},'calleridnum':{'type':Sequelize[_0x9edd('0x1')]},'calleridname':{'type':Sequelize[_0x9edd('0x1')]},'connectedlinenum':{'type':Sequelize[_0x9edd('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x9edd('0x1')]},'accountcode':{'type':Sequelize[_0x9edd('0x1')]},'context':{'type':Sequelize[_0x9edd('0x1')]},'exten':{'type':Sequelize[_0x9edd('0x1')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x9edd('0x1')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x9edd('0x1')]},'destchannelstate':{'type':Sequelize[_0x9edd('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x9edd('0x1')]},'destcalleridnum':{'type':Sequelize[_0x9edd('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x9edd('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x9edd('0x1')]},'destaccountcode':{'type':Sequelize[_0x9edd('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x9edd('0x1')]},'destpriority':{'type':Sequelize[_0x9edd('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0x9edd('0x1')]},'dialstring':{'type':Sequelize[_0x9edd('0x1')]},'dialstatus':{'type':Sequelize[_0x9edd('0x1')]},'starttime':{'type':Sequelize[_0x9edd('0x3')]},'answertime':{'type':Sequelize[_0x9edd('0x3')]},'endtime':{'type':Sequelize[_0x9edd('0x3')]},'lastevent':{'type':Sequelize[_0x9edd('0x1')],'comment':_0x9edd('0x4')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0x9edd('0x2')]},'holdtime':{'type':Sequelize[_0x9edd('0x2')]},'billableseconds':{'type':Sequelize[_0x9edd('0x2')]}}; \ No newline at end of file +var _0xd6d6=['STRING','INTEGER','DATE','called,connect,complete','sequelize','exports'];(function(_0x4717b8,_0x331c49){var _0x42a536=function(_0x580b33){while(--_0x580b33){_0x4717b8['push'](_0x4717b8['shift']());}};_0x42a536(++_0x331c49);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x1464ac,_0x3d8994){_0x1464ac=_0x1464ac-0x0;var _0xb0821f=_0xd6d6[_0x1464ac];return _0xb0821f;};'use strict';var Sequelize=require(_0x6d6d('0x0'));module[_0x6d6d('0x1')]={'privilege':{'type':Sequelize[_0x6d6d('0x2')]},'channel':{'type':Sequelize[_0x6d6d('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x6d6d('0x2')]},'calleridnum':{'type':Sequelize[_0x6d6d('0x2')]},'calleridname':{'type':Sequelize[_0x6d6d('0x2')]},'connectedlinenum':{'type':Sequelize[_0x6d6d('0x2')]},'connectedlinename':{'type':Sequelize[_0x6d6d('0x2')]},'language':{'type':Sequelize[_0x6d6d('0x2')]},'accountcode':{'type':Sequelize[_0x6d6d('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x6d6d('0x2')]},'priority':{'type':Sequelize[_0x6d6d('0x3')]},'uniqueid':{'type':Sequelize[_0x6d6d('0x2')]},'linkedid':{'type':Sequelize[_0x6d6d('0x2')]},'destchannel':{'type':Sequelize[_0x6d6d('0x2')]},'destchannelstate':{'type':Sequelize[_0x6d6d('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x6d6d('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x6d6d('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x6d6d('0x2')]},'destlanguage':{'type':Sequelize[_0x6d6d('0x2')]},'destaccountcode':{'type':Sequelize[_0x6d6d('0x2')]},'destcontext':{'type':Sequelize[_0x6d6d('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x6d6d('0x3')]},'destuniqueid':{'type':Sequelize[_0x6d6d('0x2')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x6d6d('0x2')]},'starttime':{'type':Sequelize[_0x6d6d('0x4')]},'answertime':{'type':Sequelize[_0x6d6d('0x4')]},'endtime':{'type':Sequelize[_0x6d6d('0x4')]},'lastevent':{'type':Sequelize[_0x6d6d('0x2')],'comment':_0x6d6d('0x5')},'routeId':{'type':Sequelize[_0x6d6d('0x3')]},'duration':{'type':Sequelize[_0x6d6d('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x6d6d('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index f7c32fa..3c5d198 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 _0x6305=['map','VoiceDialReport','rawAttributes','fieldName','key','query','keys','filters','attributes','model','fields','length','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','show','params','intersection','include','catch','create','body','find','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','error','stack','name','send','index'];(function(_0x544544,_0x3d1b7d){var _0x46b8d0=function(_0x4bcf80){while(--_0x4bcf80){_0x544544['push'](_0x544544['shift']());}};_0x46b8d0(++_0x3d1b7d);}(_0x6305,0x69));var _0x5630=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x6305[_0x297fd3];return _0x2af381;};'use strict';var emlformat=require(_0x5630('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5630('0x1'));var rp=require(_0x5630('0x2'));var moment=require(_0x5630('0x3'));var BPromise=require(_0x5630('0x4'));var Mustache=require(_0x5630('0x5'));var util=require(_0x5630('0x6'));var path=require(_0x5630('0x7'));var sox=require(_0x5630('0x8'));var csv=require(_0x5630('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5630('0xa'));var _=require('lodash');var squel=require(_0x5630('0xb'));var crypto=require(_0x5630('0xc'));var jsforce=require(_0x5630('0xd'));var deskjs=require(_0x5630('0xe'));var toCsv=require(_0x5630('0x9'));var querystring=require(_0x5630('0xf'));var Papa=require(_0x5630('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5630('0x11'));var as=require(_0x5630('0x12'));var hardwareService=require(_0x5630('0x13'));var logger=require('../../config/logger')(_0x5630('0x14'));var utils=require(_0x5630('0x15'));var config=require(_0x5630('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5630('0x17'))['db'];function respondWithStatusCode(_0x4bc170,_0xdbbbdb){_0xdbbbdb=_0xdbbbdb||0xcc;return function(_0x18180e){if(_0x18180e){return _0x4bc170[_0x5630('0x18')](_0xdbbbdb);}return _0x4bc170[_0x5630('0x19')](_0xdbbbdb)[_0x5630('0x1a')]();};}function respondWithResult(_0x54a1a1,_0x4ac4ba){_0x4ac4ba=_0x4ac4ba||0xc8;return function(_0x381d2e){if(_0x381d2e){return _0x54a1a1[_0x5630('0x19')](_0x4ac4ba)[_0x5630('0x1b')](_0x381d2e);}};}function respondWithFilteredResult(_0x61198c,_0x1ef12c){return function(_0x159a15){if(_0x159a15){var _0x37ef9c=typeof _0x1ef12c[_0x5630('0x1c')]===_0x5630('0x1d')&&typeof _0x1ef12c[_0x5630('0x1e')]===_0x5630('0x1d');var _0x5e574a=_0x159a15[_0x5630('0x1f')];var _0xd43ee=_0x37ef9c?0x0:_0x1ef12c['offset'];var _0x3bcb41=_0x37ef9c?_0x159a15[_0x5630('0x1f')]:_0x1ef12c['offset']+_0x1ef12c[_0x5630('0x1e')];var _0x44fede;if(_0x3bcb41>=_0x5e574a){_0x3bcb41=_0x5e574a;_0x44fede=0xc8;}else{_0x44fede=0xce;}_0x61198c[_0x5630('0x19')](_0x44fede);return _0x61198c['set']('Content-Range',_0xd43ee+'-'+_0x3bcb41+'/'+_0x5e574a)[_0x5630('0x1b')](_0x159a15);}return null;};}function patchUpdates(_0x2326dc){return function(_0x27146d){try{jsonpatch[_0x5630('0x20')](_0x27146d,_0x2326dc,!![]);}catch(_0x4a9d33){return BPromise[_0x5630('0x21')](_0x4a9d33);}return _0x27146d[_0x5630('0x22')]();};}function saveUpdates(_0x2b839a,_0x2389ee){return function(_0x370c8e){if(_0x370c8e){return _0x370c8e[_0x5630('0x23')](_0x2b839a)[_0x5630('0x24')](function(_0xd67ccc){return _0xd67ccc;});}return null;};}function removeEntity(_0x28f3e8,_0x1efa99){return function(_0x138e0e){if(_0x138e0e){return _0x138e0e[_0x5630('0x25')]()['then'](function(){_0x28f3e8[_0x5630('0x19')](0xcc)[_0x5630('0x1a')]();});}};}function handleEntityNotFound(_0x57c2ff,_0x9e8571){return function(_0x511607){if(!_0x511607){_0x57c2ff[_0x5630('0x18')](0x194);}return _0x511607;};}function handleError(_0x4b186b,_0x586907){_0x586907=_0x586907||0x1f4;return function(_0x3ad25e){logger[_0x5630('0x26')](_0x3ad25e[_0x5630('0x27')]);if(_0x3ad25e[_0x5630('0x28')]){delete _0x3ad25e[_0x5630('0x28')];}_0x4b186b[_0x5630('0x19')](_0x586907)[_0x5630('0x29')](_0x3ad25e);};}exports[_0x5630('0x2a')]=function(_0xe9c4c5,_0x1cc433){var _0x9d8543={},_0x8fb703={},_0x5d6635={'count':0x0,'rows':[]};var _0x1d05b9=_[_0x5630('0x2b')](db[_0x5630('0x2c')][_0x5630('0x2d')],function(_0x5d12e4){return{'name':_0x5d12e4[_0x5630('0x2e')],'type':_0x5d12e4['type'][_0x5630('0x2f')]};});_0x8fb703['model']=_[_0x5630('0x2b')](_0x1d05b9,_0x5630('0x28'));_0x8fb703[_0x5630('0x30')]=_[_0x5630('0x31')](_0xe9c4c5[_0x5630('0x30')]);_0x8fb703[_0x5630('0x32')]=_['intersection'](_0x8fb703['model'],_0x8fb703[_0x5630('0x30')]);_0x9d8543[_0x5630('0x33')]=_['intersection'](_0x8fb703[_0x5630('0x34')],qs[_0x5630('0x35')](_0xe9c4c5[_0x5630('0x30')][_0x5630('0x35')]));_0x9d8543[_0x5630('0x33')]=_0x9d8543['attributes'][_0x5630('0x36')]?_0x9d8543[_0x5630('0x33')]:_0x8fb703['model'];if(!_0xe9c4c5[_0x5630('0x30')]['hasOwnProperty']('nolimit')){_0x9d8543['limit']=qs[_0x5630('0x1e')](_0xe9c4c5[_0x5630('0x30')][_0x5630('0x1e')]);_0x9d8543[_0x5630('0x1c')]=qs[_0x5630('0x1c')](_0xe9c4c5['query'][_0x5630('0x1c')]);}_0x9d8543['order']=qs['sort'](_0xe9c4c5[_0x5630('0x30')][_0x5630('0x37')]);_0x9d8543[_0x5630('0x38')]=qs[_0x5630('0x32')](_[_0x5630('0x39')](_0xe9c4c5[_0x5630('0x30')],_0x8fb703['filters']),_0x1d05b9);if(_0xe9c4c5[_0x5630('0x30')][_0x5630('0x3a')]){_0x9d8543[_0x5630('0x38')]=_[_0x5630('0x3b')](_0x9d8543['where'],{'$or':_[_0x5630('0x2b')](_0x1d05b9,function(_0x2f2ade){if(_0x2f2ade[_0x5630('0x3c')]!==_0x5630('0x3d')){var _0x506607={};_0x506607[_0x2f2ade[_0x5630('0x28')]]={'$like':'%'+_0xe9c4c5[_0x5630('0x30')]['filter']+'%'};return _0x506607;}})});}_0x9d8543=_[_0x5630('0x3b')]({},_0x9d8543,_0xe9c4c5[_0x5630('0x3e')]);var _0x21b2e8={'where':_0x9d8543[_0x5630('0x38')]};return db[_0x5630('0x2c')]['count'](_0x21b2e8)[_0x5630('0x24')](function(_0x22959f){_0x5d6635[_0x5630('0x1f')]=_0x22959f;if(_0xe9c4c5['query'][_0x5630('0x3f')]){_0x9d8543['include']=[{'all':!![]}];}return db['VoiceDialReport'][_0x5630('0x40')](_0x9d8543);})['then'](function(_0x43d93a){_0x5d6635['rows']=_0x43d93a;return _0x5d6635;})[_0x5630('0x24')](respondWithFilteredResult(_0x1cc433,_0x9d8543))['catch'](handleError(_0x1cc433,null));};exports[_0x5630('0x41')]=function(_0x488e3c,_0x1ff1b4){var _0x154625={'raw':!![],'where':{'id':_0x488e3c[_0x5630('0x42')]['id']}},_0x304828={};_0x304828[_0x5630('0x34')]=_[_0x5630('0x31')](db[_0x5630('0x2c')]['rawAttributes']);_0x304828[_0x5630('0x30')]=_[_0x5630('0x31')](_0x488e3c[_0x5630('0x30')]);_0x304828[_0x5630('0x32')]=_[_0x5630('0x43')](_0x304828['model'],_0x304828[_0x5630('0x30')]);_0x154625['attributes']=_[_0x5630('0x43')](_0x304828['model'],qs['fields'](_0x488e3c[_0x5630('0x30')][_0x5630('0x35')]));_0x154625['attributes']=_0x154625[_0x5630('0x33')][_0x5630('0x36')]?_0x154625[_0x5630('0x33')]:_0x304828[_0x5630('0x34')];if(_0x488e3c[_0x5630('0x30')][_0x5630('0x3f')]){_0x154625[_0x5630('0x44')]=[{'all':!![]}];}_0x154625=_[_0x5630('0x3b')]({},_0x154625,_0x488e3c['options']);return db[_0x5630('0x2c')]['find'](_0x154625)[_0x5630('0x24')](handleEntityNotFound(_0x1ff1b4,null))['then'](respondWithResult(_0x1ff1b4,null))[_0x5630('0x45')](handleError(_0x1ff1b4,null));};exports[_0x5630('0x46')]=function(_0x497104,_0x93d919){return db[_0x5630('0x2c')][_0x5630('0x46')](_0x497104[_0x5630('0x47')],{})[_0x5630('0x24')](respondWithResult(_0x93d919,0xc9))[_0x5630('0x45')](handleError(_0x93d919,null));};exports[_0x5630('0x23')]=function(_0x1515f2,_0x59e8a6){if(_0x1515f2[_0x5630('0x47')]['id']){delete _0x1515f2[_0x5630('0x47')]['id'];}return db[_0x5630('0x2c')][_0x5630('0x48')]({'where':{'id':_0x1515f2[_0x5630('0x42')]['id']}})[_0x5630('0x24')](handleEntityNotFound(_0x59e8a6,null))[_0x5630('0x24')](saveUpdates(_0x1515f2[_0x5630('0x47')],null))['then'](respondWithResult(_0x59e8a6,null))[_0x5630('0x45')](handleError(_0x59e8a6,null));};exports[_0x5630('0x25')]=function(_0xab7a5f,_0x213fb6){return db['VoiceDialReport'][_0x5630('0x48')]({'where':{'id':_0xab7a5f[_0x5630('0x42')]['id']}})['then'](handleEntityNotFound(_0x213fb6,null))['then'](removeEntity(_0x213fb6,null))[_0x5630('0x45')](handleError(_0x213fb6,null));};exports[_0x5630('0x49')]=function(_0x3b3ea6,_0x3f2122){return db[_0x5630('0x2c')]['describe']()[_0x5630('0x24')](respondWithResult(_0x3f2122,null))['catch'](handleError(_0x3f2122,null));}; \ No newline at end of file +var _0xeb96=['end','offset','undefined','limit','count','set','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','show','params','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status'];(function(_0x5bb4e8,_0x44b756){var _0x2a86f2=function(_0x279ab2){while(--_0x279ab2){_0x5bb4e8['push'](_0x5bb4e8['shift']());}};_0x2a86f2(++_0x44b756);}(_0xeb96,0xc3));var _0x6eb9=function(_0x2f64ad,_0x10f99f){_0x2f64ad=_0x2f64ad-0x0;var _0x13a112=_0xeb96[_0x2f64ad];return _0x13a112;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6eb9('0x0'));var zipdir=require(_0x6eb9('0x1'));var jsonpatch=require(_0x6eb9('0x2'));var rp=require('request-promise');var moment=require(_0x6eb9('0x3'));var BPromise=require(_0x6eb9('0x4'));var Mustache=require(_0x6eb9('0x5'));var util=require('util');var path=require(_0x6eb9('0x6'));var sox=require('sox');var csv=require(_0x6eb9('0x7'));var ejs=require(_0x6eb9('0x8'));var fs=require('fs');var fs_extra=require(_0x6eb9('0x9'));var _=require(_0x6eb9('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6eb9('0xb'));var deskjs=require(_0x6eb9('0xc'));var toCsv=require('to-csv');var querystring=require(_0x6eb9('0xd'));var Papa=require(_0x6eb9('0xe'));var Redis=require(_0x6eb9('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x6eb9('0x10'));var as=require(_0x6eb9('0x11'));var hardwareService=require(_0x6eb9('0x12'));var logger=require(_0x6eb9('0x13'))('api');var utils=require(_0x6eb9('0x14'));var config=require(_0x6eb9('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6eb9('0x16'))['db'];function respondWithStatusCode(_0x3332a4,_0x11f6dd){_0x11f6dd=_0x11f6dd||0xcc;return function(_0x2c4feb){if(_0x2c4feb){return _0x3332a4['sendStatus'](_0x11f6dd);}return _0x3332a4[_0x6eb9('0x17')](_0x11f6dd)[_0x6eb9('0x18')]();};}function respondWithResult(_0x2e7ffe,_0x34bb79){_0x34bb79=_0x34bb79||0xc8;return function(_0x569e7c){if(_0x569e7c){return _0x2e7ffe[_0x6eb9('0x17')](_0x34bb79)['json'](_0x569e7c);}};}function respondWithFilteredResult(_0xb7bba,_0x52e548){return function(_0x58af51){if(_0x58af51){var _0x16c8eb=typeof _0x52e548[_0x6eb9('0x19')]===_0x6eb9('0x1a')&&typeof _0x52e548[_0x6eb9('0x1b')]===_0x6eb9('0x1a');var _0x49a560=_0x58af51[_0x6eb9('0x1c')];var _0x2df00e=_0x16c8eb?0x0:_0x52e548[_0x6eb9('0x19')];var _0x1290f3=_0x16c8eb?_0x58af51['count']:_0x52e548[_0x6eb9('0x19')]+_0x52e548[_0x6eb9('0x1b')];var _0x44f6ba;if(_0x1290f3>=_0x49a560){_0x1290f3=_0x49a560;_0x44f6ba=0xc8;}else{_0x44f6ba=0xce;}_0xb7bba[_0x6eb9('0x17')](_0x44f6ba);return _0xb7bba[_0x6eb9('0x1d')]('Content-Range',_0x2df00e+'-'+_0x1290f3+'/'+_0x49a560)['json'](_0x58af51);}return null;};}function patchUpdates(_0x449e89){return function(_0x250c66){try{jsonpatch[_0x6eb9('0x1e')](_0x250c66,_0x449e89,!![]);}catch(_0x55a4ae){return BPromise[_0x6eb9('0x1f')](_0x55a4ae);}return _0x250c66[_0x6eb9('0x20')]();};}function saveUpdates(_0x2078d5,_0x1b5aa1){return function(_0x18187b){if(_0x18187b){return _0x18187b[_0x6eb9('0x21')](_0x2078d5)[_0x6eb9('0x22')](function(_0x42e2ea){return _0x42e2ea;});}return null;};}function removeEntity(_0x4f6892,_0x32f1eb){return function(_0x598cbf){if(_0x598cbf){return _0x598cbf['destroy']()[_0x6eb9('0x22')](function(){_0x4f6892[_0x6eb9('0x17')](0xcc)[_0x6eb9('0x18')]();});}};}function handleEntityNotFound(_0x35058f,_0x4c3b4a){return function(_0x21cb16){if(!_0x21cb16){_0x35058f[_0x6eb9('0x23')](0x194);}return _0x21cb16;};}function handleError(_0x478b91,_0x23eb3d){_0x23eb3d=_0x23eb3d||0x1f4;return function(_0x476a54){logger[_0x6eb9('0x24')](_0x476a54[_0x6eb9('0x25')]);if(_0x476a54[_0x6eb9('0x26')]){delete _0x476a54[_0x6eb9('0x26')];}_0x478b91[_0x6eb9('0x17')](_0x23eb3d)[_0x6eb9('0x27')](_0x476a54);};}exports[_0x6eb9('0x28')]=function(_0x2a04ce,_0x3f8bc2){var _0x2e0684={},_0x50b751={},_0x5e85f3={'count':0x0,'rows':[]};var _0x3c9633=_[_0x6eb9('0x29')](db[_0x6eb9('0x2a')][_0x6eb9('0x2b')],function(_0x5c5361){return{'name':_0x5c5361[_0x6eb9('0x2c')],'type':_0x5c5361[_0x6eb9('0x2d')][_0x6eb9('0x2e')]};});_0x50b751[_0x6eb9('0x2f')]=_[_0x6eb9('0x29')](_0x3c9633,_0x6eb9('0x26'));_0x50b751['query']=_[_0x6eb9('0x30')](_0x2a04ce[_0x6eb9('0x31')]);_0x50b751[_0x6eb9('0x32')]=_[_0x6eb9('0x33')](_0x50b751[_0x6eb9('0x2f')],_0x50b751[_0x6eb9('0x31')]);_0x2e0684[_0x6eb9('0x34')]=_['intersection'](_0x50b751[_0x6eb9('0x2f')],qs[_0x6eb9('0x35')](_0x2a04ce['query'][_0x6eb9('0x35')]));_0x2e0684['attributes']=_0x2e0684[_0x6eb9('0x34')][_0x6eb9('0x36')]?_0x2e0684[_0x6eb9('0x34')]:_0x50b751['model'];if(!_0x2a04ce[_0x6eb9('0x31')][_0x6eb9('0x37')]('nolimit')){_0x2e0684[_0x6eb9('0x1b')]=qs[_0x6eb9('0x1b')](_0x2a04ce['query'][_0x6eb9('0x1b')]);_0x2e0684[_0x6eb9('0x19')]=qs[_0x6eb9('0x19')](_0x2a04ce['query'][_0x6eb9('0x19')]);}_0x2e0684[_0x6eb9('0x38')]=qs[_0x6eb9('0x39')](_0x2a04ce[_0x6eb9('0x31')][_0x6eb9('0x39')]);_0x2e0684[_0x6eb9('0x3a')]=qs['filters'](_[_0x6eb9('0x3b')](_0x2a04ce['query'],_0x50b751[_0x6eb9('0x32')]),_0x3c9633);if(_0x2a04ce[_0x6eb9('0x31')]['filter']){_0x2e0684[_0x6eb9('0x3a')]=_[_0x6eb9('0x3c')](_0x2e0684[_0x6eb9('0x3a')],{'$or':_[_0x6eb9('0x29')](_0x3c9633,function(_0x338362){if(_0x338362[_0x6eb9('0x2d')]!==_0x6eb9('0x3d')){var _0x2ec146={};_0x2ec146[_0x338362[_0x6eb9('0x26')]]={'$like':'%'+_0x2a04ce[_0x6eb9('0x31')][_0x6eb9('0x3e')]+'%'};return _0x2ec146;}})});}_0x2e0684=_[_0x6eb9('0x3c')]({},_0x2e0684,_0x2a04ce[_0x6eb9('0x3f')]);var _0xfda495={'where':_0x2e0684['where']};return db[_0x6eb9('0x2a')]['count'](_0xfda495)[_0x6eb9('0x22')](function(_0x4af0b5){_0x5e85f3['count']=_0x4af0b5;if(_0x2a04ce[_0x6eb9('0x31')]['includeAll']){_0x2e0684[_0x6eb9('0x40')]=[{'all':!![]}];}return db['VoiceDialReport'][_0x6eb9('0x41')](_0x2e0684);})['then'](function(_0x210884){_0x5e85f3['rows']=_0x210884;return _0x5e85f3;})[_0x6eb9('0x22')](respondWithFilteredResult(_0x3f8bc2,_0x2e0684))['catch'](handleError(_0x3f8bc2,null));};exports[_0x6eb9('0x42')]=function(_0x4504e2,_0x57a5fe){var _0x3ca480={'raw':!![],'where':{'id':_0x4504e2[_0x6eb9('0x43')]['id']}},_0x3c81ef={};_0x3c81ef['model']=_[_0x6eb9('0x30')](db[_0x6eb9('0x2a')]['rawAttributes']);_0x3c81ef[_0x6eb9('0x31')]=_[_0x6eb9('0x30')](_0x4504e2[_0x6eb9('0x31')]);_0x3c81ef[_0x6eb9('0x32')]=_['intersection'](_0x3c81ef[_0x6eb9('0x2f')],_0x3c81ef['query']);_0x3ca480['attributes']=_[_0x6eb9('0x33')](_0x3c81ef[_0x6eb9('0x2f')],qs[_0x6eb9('0x35')](_0x4504e2['query']['fields']));_0x3ca480[_0x6eb9('0x34')]=_0x3ca480[_0x6eb9('0x34')][_0x6eb9('0x36')]?_0x3ca480[_0x6eb9('0x34')]:_0x3c81ef[_0x6eb9('0x2f')];if(_0x4504e2[_0x6eb9('0x31')]['includeAll']){_0x3ca480[_0x6eb9('0x40')]=[{'all':!![]}];}_0x3ca480=_['merge']({},_0x3ca480,_0x4504e2['options']);return db[_0x6eb9('0x2a')][_0x6eb9('0x44')](_0x3ca480)[_0x6eb9('0x22')](handleEntityNotFound(_0x57a5fe,null))[_0x6eb9('0x22')](respondWithResult(_0x57a5fe,null))[_0x6eb9('0x45')](handleError(_0x57a5fe,null));};exports[_0x6eb9('0x46')]=function(_0x208696,_0x327eac){return db['VoiceDialReport'][_0x6eb9('0x46')](_0x208696[_0x6eb9('0x47')],{})[_0x6eb9('0x22')](respondWithResult(_0x327eac,0xc9))[_0x6eb9('0x45')](handleError(_0x327eac,null));};exports[_0x6eb9('0x21')]=function(_0x4bb41c,_0x1b95e4){if(_0x4bb41c[_0x6eb9('0x47')]['id']){delete _0x4bb41c[_0x6eb9('0x47')]['id'];}return db['VoiceDialReport']['find']({'where':{'id':_0x4bb41c[_0x6eb9('0x43')]['id']}})[_0x6eb9('0x22')](handleEntityNotFound(_0x1b95e4,null))['then'](saveUpdates(_0x4bb41c['body'],null))[_0x6eb9('0x22')](respondWithResult(_0x1b95e4,null))[_0x6eb9('0x45')](handleError(_0x1b95e4,null));};exports['destroy']=function(_0x46b368,_0x5797bc){return db['VoiceDialReport'][_0x6eb9('0x44')]({'where':{'id':_0x46b368['params']['id']}})[_0x6eb9('0x22')](handleEntityNotFound(_0x5797bc,null))[_0x6eb9('0x22')](removeEntity(_0x5797bc,null))[_0x6eb9('0x45')](handleError(_0x5797bc,null));};exports[_0x6eb9('0x48')]=function(_0x6ed644,_0x16c4df){return db['VoiceDialReport']['describe']()[_0x6eb9('0x22')](respondWithResult(_0x16c4df,null))[_0x6eb9('0x45')](handleError(_0x16c4df,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index ab7c4a7..68fd0d2 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 _0x67b6=['VoiceDialReport','report_dial','uniqueid','util','bluebird','request-promise','path','../../config/environment','define'];(function(_0x37b7b6,_0x165a5c){var _0x10c4c3=function(_0x16d71e){while(--_0x16d71e){_0x37b7b6['push'](_0x37b7b6['shift']());}};_0x10c4c3(++_0x165a5c);}(_0x67b6,0x1d7));var _0x667b=function(_0x3188c2,_0x4e628d){_0x3188c2=_0x3188c2-0x0;var _0xbeba85=_0x67b6[_0x3188c2];return _0xbeba85;};'use strict';var _=require('lodash');var util=require(_0x667b('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x667b('0x1'));var rp=require(_0x667b('0x2'));var fs=require('fs');var path=require(_0x667b('0x3'));var rimraf=require('rimraf');var config=require(_0x667b('0x4'));var attributes=require('./voiceDialReport.attributes');module['exports']=function(_0x18d138,_0x4d42de){return _0x18d138[_0x667b('0x5')](_0x667b('0x6'),attributes,{'tableName':_0x667b('0x7'),'paranoid':![],'indexes':[{'fields':[_0x667b('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa5c9=['path','rimraf','../../config/environment','./voiceDialReport.attributes','define','VoiceDialReport','report_dial','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5ebf86,_0x51b9ce){var _0x3bfe20=function(_0x4ed452){while(--_0x4ed452){_0x5ebf86['push'](_0x5ebf86['shift']());}};_0x3bfe20(++_0x51b9ce);}(_0xa5c9,0xda));var _0x9a5c=function(_0x374ada,_0x27b3a5){_0x374ada=_0x374ada-0x0;var _0x449ed8=_0xa5c9[_0x374ada];return _0x449ed8;};'use strict';var _=require(_0x9a5c('0x0'));var util=require(_0x9a5c('0x1'));var logger=require(_0x9a5c('0x2'))(_0x9a5c('0x3'));var moment=require(_0x9a5c('0x4'));var BPromise=require(_0x9a5c('0x5'));var rp=require(_0x9a5c('0x6'));var fs=require('fs');var path=require(_0x9a5c('0x7'));var rimraf=require(_0x9a5c('0x8'));var config=require(_0x9a5c('0x9'));var attributes=require(_0x9a5c('0xa'));module['exports']=function(_0x4bce37,_0x57b9e1){return _0x4bce37[_0x9a5c('0xb')](_0x9a5c('0xc'),attributes,{'tableName':_0x9a5c('0xd'),'paranoid':![],'indexes':[{'fields':[_0x9a5c('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index b02eb96..eab57af 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 _0x3089=['options','debug','UpdateVoiceDialReport','update','raw','where','attributes','limit','util','bluebird','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body'];(function(_0x4ac60a,_0x503a99){var _0x4b22e8=function(_0x145c47){while(--_0x145c47){_0x4ac60a['push'](_0x4ac60a['shift']());}};_0x4b22e8(++_0x503a99);}(_0x3089,0x181));var _0x9308=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x3089[_0x4fc9e6];return _0x551d28;};'use strict';var _=require('lodash');var util=require(_0x9308('0x0'));var moment=require('moment');var BPromise=require(_0x9308('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9308('0x2'))['db'];var utils=require(_0x9308('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x9308('0x4'));var jayson=require(_0x9308('0x5'));var client=jayson['client'][_0x9308('0x6')]({'port':0x232a});function respondWithRpcPromise(_0xd39e25,_0x2e1744,_0xd2e53a){return new BPromise(function(_0x41e984,_0xef847a){return client['request'](_0xd39e25,_0xd2e53a)[_0x9308('0x7')](function(_0x4c7406){logger[_0x9308('0x8')](_0x9308('0x9'),_0x2e1744,_0x9308('0xa'));logger['debug'](_0x9308('0xb'),_0x2e1744,_0x9308('0xa'),JSON[_0x9308('0xc')](_0x4c7406));if(_0x4c7406[_0x9308('0xd')]){if(_0x4c7406[_0x9308('0xd')]['code']===0x1f4){logger[_0x9308('0xd')](_0x9308('0x9'),_0x2e1744,_0x4c7406[_0x9308('0xd')][_0x9308('0xe')]);return _0xef847a(_0x4c7406['error'][_0x9308('0xe')]);}logger['error'](_0x9308('0x9'),_0x2e1744,_0x4c7406[_0x9308('0xd')]['message']);return _0x41e984(_0x4c7406[_0x9308('0xd')]['message']);}else{logger[_0x9308('0x8')]('VoiceDialReport,\x20%s,\x20%s',_0x2e1744,_0x9308('0xa'));_0x41e984(_0x4c7406[_0x9308('0xf')][_0x9308('0xe')]);}})[_0x9308('0x10')](function(_0x40245f){logger[_0x9308('0xd')](_0x9308('0x9'),_0x2e1744,_0x40245f);_0xef847a(_0x40245f);});});}exports[_0x9308('0x11')]=function(_0x3a0bde){var _0x5185f8=this;return new Promise(function(_0x3b31a5,_0x5db80f){return db[_0x9308('0x12')][_0x9308('0x13')](_0x3a0bde[_0x9308('0x14')],{'raw':_0x3a0bde[_0x9308('0x15')]?_0x3a0bde['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1531d0){logger[_0x9308('0x8')](_0x9308('0x11'),_0x3a0bde);logger[_0x9308('0x16')]('CreateVoiceDialReport',_0x3a0bde,JSON[_0x9308('0xc')](_0x1531d0));_0x3b31a5(_0x1531d0);})['catch'](function(_0x17ba2e){logger['error'](_0x9308('0x11'),_0x17ba2e[_0x9308('0xe')],_0x3a0bde);_0x5db80f(_0x5185f8[_0x9308('0xd')](0x1f4,_0x17ba2e[_0x9308('0xe')]));});});};exports[_0x9308('0x17')]=function(_0xcfc7cb){var _0x147090=this;return new Promise(function(_0x5af296,_0x1e0100){return db['VoiceDialReport'][_0x9308('0x18')](_0xcfc7cb[_0x9308('0x14')],{'raw':_0xcfc7cb[_0x9308('0x15')]?_0xcfc7cb[_0x9308('0x15')][_0x9308('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xcfc7cb['options']?_0xcfc7cb[_0x9308('0x15')][_0x9308('0x1a')]||null:null,'attributes':_0xcfc7cb['options']?_0xcfc7cb[_0x9308('0x15')][_0x9308('0x1b')]||null:null,'limit':_0xcfc7cb[_0x9308('0x15')]?_0xcfc7cb[_0x9308('0x15')][_0x9308('0x1c')]||null:null})[_0x9308('0x7')](function(_0x1140c8){logger[_0x9308('0x8')](_0x9308('0x17'),_0xcfc7cb);logger[_0x9308('0x16')](_0x9308('0x17'),_0xcfc7cb,JSON['stringify'](_0x1140c8));_0x5af296(_0x1140c8);})[_0x9308('0x10')](function(_0x26a9ef){logger[_0x9308('0xd')](_0x9308('0x17'),_0x26a9ef[_0x9308('0xe')],_0xcfc7cb);_0x1e0100(_0x147090[_0x9308('0xd')](0x1f4,_0x26a9ef[_0x9308('0xe')]));});});}; \ No newline at end of file +var _0xced7=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceDialReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','update','raw','where','attributes','limit','UpdateVoiceDialReport','lodash','util'];(function(_0x910888,_0x3d5ea2){var _0x5c3114=function(_0x194cda){while(--_0x194cda){_0x910888['push'](_0x910888['shift']());}};_0x5c3114(++_0x3d5ea2);}(_0xced7,0x174));var _0x7ced=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xced7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7ced('0x0'));var util=require(_0x7ced('0x1'));var moment=require(_0x7ced('0x2'));var BPromise=require(_0x7ced('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7ced('0x4'));var db=require(_0x7ced('0x5'))['db'];var utils=require(_0x7ced('0x6'));var logger=require(_0x7ced('0x7'))(_0x7ced('0x8'));var config=require(_0x7ced('0x9'));var jayson=require(_0x7ced('0xa'));var client=jayson[_0x7ced('0xb')][_0x7ced('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4902b7,_0x5b69ff,_0x837af7){return new BPromise(function(_0x12b54c,_0x5cfe14){return client[_0x7ced('0xd')](_0x4902b7,_0x837af7)[_0x7ced('0xe')](function(_0x358689){logger['info'](_0x7ced('0xf'),_0x5b69ff,'request\x20sent');logger[_0x7ced('0x10')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x5b69ff,_0x7ced('0x11'),JSON[_0x7ced('0x12')](_0x358689));if(_0x358689[_0x7ced('0x13')]){if(_0x358689['error']['code']===0x1f4){logger[_0x7ced('0x13')](_0x7ced('0xf'),_0x5b69ff,_0x358689[_0x7ced('0x13')][_0x7ced('0x14')]);return _0x5cfe14(_0x358689[_0x7ced('0x13')][_0x7ced('0x14')]);}logger[_0x7ced('0x13')](_0x7ced('0xf'),_0x5b69ff,_0x358689[_0x7ced('0x13')]['message']);return _0x12b54c(_0x358689[_0x7ced('0x13')][_0x7ced('0x14')]);}else{logger[_0x7ced('0x15')](_0x7ced('0xf'),_0x5b69ff,_0x7ced('0x11'));_0x12b54c(_0x358689['result'][_0x7ced('0x14')]);}})[_0x7ced('0x16')](function(_0x5884cc){logger[_0x7ced('0x13')](_0x7ced('0xf'),_0x5b69ff,_0x5884cc);_0x5cfe14(_0x5884cc);});});}exports[_0x7ced('0x17')]=function(_0x27ce72){var _0x3fca87=this;return new Promise(function(_0x2253ce,_0x33014a){return db[_0x7ced('0x18')][_0x7ced('0x19')](_0x27ce72[_0x7ced('0x1a')],{'raw':_0x27ce72[_0x7ced('0x1b')]?_0x27ce72[_0x7ced('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x7ced('0xe')](function(_0x3e4b27){logger[_0x7ced('0x15')](_0x7ced('0x17'),_0x27ce72);logger[_0x7ced('0x10')](_0x7ced('0x17'),_0x27ce72,JSON[_0x7ced('0x12')](_0x3e4b27));_0x2253ce(_0x3e4b27);})[_0x7ced('0x16')](function(_0x3e60eb){logger[_0x7ced('0x13')](_0x7ced('0x17'),_0x3e60eb[_0x7ced('0x14')],_0x27ce72);_0x33014a(_0x3fca87[_0x7ced('0x13')](0x1f4,_0x3e60eb['message']));});});};exports['UpdateVoiceDialReport']=function(_0x4d8796){var _0x4d49b4=this;return new Promise(function(_0x4df1cf,_0x31f52d){return db[_0x7ced('0x18')][_0x7ced('0x1c')](_0x4d8796[_0x7ced('0x1a')],{'raw':_0x4d8796['options']?_0x4d8796['options'][_0x7ced('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d8796[_0x7ced('0x1b')]?_0x4d8796[_0x7ced('0x1b')][_0x7ced('0x1e')]||null:null,'attributes':_0x4d8796[_0x7ced('0x1b')]?_0x4d8796[_0x7ced('0x1b')][_0x7ced('0x1f')]||null:null,'limit':_0x4d8796[_0x7ced('0x1b')]?_0x4d8796['options'][_0x7ced('0x20')]||null:null})[_0x7ced('0xe')](function(_0x2e4403){logger['info'](_0x7ced('0x21'),_0x4d8796);logger['debug']('UpdateVoiceDialReport',_0x4d8796,JSON[_0x7ced('0x12')](_0x2e4403));_0x4df1cf(_0x2e4403);})['catch'](function(_0x37379c){logger['error']('UpdateVoiceDialReport',_0x37379c['message'],_0x4d8796);_0x31f52d(_0x4d49b4['error'](0x1f4,_0x37379c[_0x7ced('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 95a10cf..f8a99c4 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 _0x1430=['fs-extra','../../components/auth/service','../../components/interaction/service','./voiceExtension.controller','get','isAuthenticated','index','post','/:id/applications','addApplications','update','/:id','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x5b10fc,_0x8c47be){var _0x126f3b=function(_0x4bcb8f){while(--_0x4bcb8f){_0x5b10fc['push'](_0x5b10fc['shift']());}};_0x126f3b(++_0x8c47be);}(_0x1430,0x1d5));var _0x0143=function(_0xaac610,_0x1f0e04){_0xaac610=_0xaac610-0x0;var _0x2980f1=_0x1430[_0xaac610];return _0x2980f1;};'use strict';var multer=require(_0x0143('0x0'));var util=require(_0x0143('0x1'));var path=require(_0x0143('0x2'));var timeout=require(_0x0143('0x3'));var express=require(_0x0143('0x4'));var router=express[_0x0143('0x5')]();var fs_extra=require(_0x0143('0x6'));var auth=require(_0x0143('0x7'));var interaction=require(_0x0143('0x8'));var config=require('../../config/environment');var controller=require(_0x0143('0x9'));router[_0x0143('0xa')]('/',auth[_0x0143('0xb')](),controller[_0x0143('0xc')]);router[_0x0143('0xa')]('/:id',auth[_0x0143('0xb')](),controller['show']);router[_0x0143('0xd')]('/',auth[_0x0143('0xb')](),controller['create']);router[_0x0143('0xd')](_0x0143('0xe'),auth[_0x0143('0xb')](),controller[_0x0143('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0143('0x10')]);router['delete'](_0x0143('0x11'),auth[_0x0143('0xb')](),controller[_0x0143('0x12')]);module['exports']=router; \ No newline at end of file +var _0xde4e=['util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','/:id','show','post','create','/:id/applications','addApplications','update','delete'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xde4e,0xaa));var _0xede4=function(_0x3223df,_0x365499){_0x3223df=_0x3223df-0x0;var _0xd78d62=_0xde4e[_0x3223df];return _0xd78d62;};'use strict';var multer=require('multer');var util=require(_0xede4('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xede4('0x1'));var router=express[_0xede4('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xede4('0x3'));var interaction=require(_0xede4('0x4'));var config=require(_0xede4('0x5'));var controller=require(_0xede4('0x6'));router[_0xede4('0x7')]('/',auth[_0xede4('0x8')](),controller['index']);router[_0xede4('0x7')](_0xede4('0x9'),auth[_0xede4('0x8')](),controller[_0xede4('0xa')]);router[_0xede4('0xb')]('/',auth[_0xede4('0x8')](),controller[_0xede4('0xc')]);router['post'](_0xede4('0xd'),auth[_0xede4('0x8')](),controller[_0xede4('0xe')]);router['put'](_0xede4('0x9'),auth[_0xede4('0x8')](),controller[_0xede4('0xf')]);router[_0xede4('0x10')](_0xede4('0x9'),auth[_0xede4('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 5e3213c..211e525 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 _0x86e2=['system','any','INTEGER','wav','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','inbound-fax'];(function(_0x4eab11,_0x420bfb){var _0x417a63=function(_0x35f378){while(--_0x35f378){_0x4eab11['push'](_0x4eab11['shift']());}};_0x417a63(++_0x420bfb);}(_0x86e2,0x1d7));var _0x286e=function(_0x4f16b2,_0x4b9908){_0x4f16b2=_0x4f16b2-0x0;var _0x44062c=_0x86e2[_0x4f16b2];return _0x44062c;};'use strict';var Sequelize=require(_0x286e('0x0'));module[_0x286e('0x1')]={'context':{'type':Sequelize[_0x286e('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x286e('0x2')],'allowNull':![],'unique':_0x286e('0x3')},'priority':{'type':Sequelize[_0x286e('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x286e('0x3')},'tag':{'type':Sequelize[_0x286e('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x286e('0x2')],'allowNull':![],'defaultValue':_0x286e('0x4')},'appdata':{'type':Sequelize[_0x286e('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x286e('0x5')](_0x286e('0x6'),_0x286e('0x7'),'internal',_0x286e('0x8'),'outbound-fax',_0x286e('0x9'),_0x286e('0xa')),'allowNull':![]},'description':{'type':Sequelize[_0x286e('0x2')]},'interval':{'type':Sequelize[_0x286e('0x2')],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize[_0x286e('0xb')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x286e('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x286e('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize[_0x286e('0x2')],'defaultValue':_0x286e('0xc')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x2dcfad){return this[_0x286e('0xd')](_0x286e('0xe'));}},'alias':{'type':Sequelize[_0x286e('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x8f3d=['NoOp','ENUM','inbound','internal','inbound-fax','outbound-fax','*,*,*,*','INTEGER','BOOLEAN','wav','getDataValue','exten','sequelize','exports','STRING','compositeIndex'];(function(_0x459baf,_0x332707){var _0x4a5970=function(_0x28ac61){while(--_0x28ac61){_0x459baf['push'](_0x459baf['shift']());}};_0x4a5970(++_0x332707);}(_0x8f3d,0x1cc));var _0xd8f3=function(_0x92977b,_0x290b38){_0x92977b=_0x92977b-0x0;var _0xa8734=_0x8f3d[_0x92977b];return _0xa8734;};'use strict';var Sequelize=require(_0xd8f3('0x0'));module[_0xd8f3('0x1')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xd8f3('0x2')],'allowNull':![],'unique':_0xd8f3('0x3')},'priority':{'type':Sequelize[_0xd8f3('0x2')],'allowNull':![],'defaultValue':'1','unique':_0xd8f3('0x3')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xd8f3('0x2')],'allowNull':![],'defaultValue':_0xd8f3('0x4')},'appdata':{'type':Sequelize[_0xd8f3('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xd8f3('0x5')](_0xd8f3('0x6'),'outbound',_0xd8f3('0x7'),_0xd8f3('0x8'),_0xd8f3('0x9'),'system','any'),'allowNull':![]},'description':{'type':Sequelize[_0xd8f3('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd8f3('0xa')},'IntervalId':{'type':Sequelize[_0xd8f3('0xb')]},'isApp':{'type':Sequelize[_0xd8f3('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xd8f3('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0xd8f3('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0xd8f3('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xd8f3('0xb')]},'recordingFormat':{'type':Sequelize[_0xd8f3('0x2')],'defaultValue':_0xd8f3('0xd')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x45852c){return this[_0xd8f3('0xe')](_0xd8f3('0xf'));}},'alias':{'type':Sequelize[_0xd8f3('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 0a6a4be..712392a 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 _0xe438=['ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','json','reject','update','then','destroy','get','InboundRoutes','outbound','filter','ignore','map','value','includes','type','find','name','UserProfileResource','error','stack','send','index','VoiceExtension','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','body','exten','concat','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','inbound','OutboundRoutes','InternalRoutes','internal','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','description','recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','findOne','sequelize','transaction','params','VoiceExtensionId','isApp','rewriteDial','toLowerCase','true','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x154f10,_0x5be025){var _0x5b5ddc=function(_0x3d8bbe){while(--_0x3d8bbe){_0x154f10['push'](_0x154f10['shift']());}};_0x5b5ddc(++_0x5be025);}(_0xe438,0xe7));var _0x8e43=function(_0x465aa4,_0x443041){_0x465aa4=_0x465aa4-0x0;var _0x56d34e=_0xe438[_0x465aa4];return _0x56d34e;};'use strict';var emlformat=require(_0x8e43('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8e43('0x1'));var jsonpatch=require(_0x8e43('0x2'));var rp=require(_0x8e43('0x3'));var moment=require(_0x8e43('0x4'));var BPromise=require(_0x8e43('0x5'));var Mustache=require(_0x8e43('0x6'));var util=require(_0x8e43('0x7'));var path=require(_0x8e43('0x8'));var sox=require(_0x8e43('0x9'));var csv=require(_0x8e43('0xa'));var ejs=require(_0x8e43('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8e43('0xc'));var squel=require(_0x8e43('0xd'));var crypto=require(_0x8e43('0xe'));var jsforce=require(_0x8e43('0xf'));var deskjs=require(_0x8e43('0x10'));var toCsv=require('to-csv');var querystring=require(_0x8e43('0x11'));var Papa=require(_0x8e43('0x12'));var Redis=require(_0x8e43('0x13'));var authService=require(_0x8e43('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x8e43('0x15'));var hardwareService=require(_0x8e43('0x16'));var logger=require(_0x8e43('0x17'))(_0x8e43('0x18'));var utils=require('../../config/utils');var config=require(_0x8e43('0x19'));var licenseUtil=require(_0x8e43('0x1a'));var db=require(_0x8e43('0x1b'))['db'];config[_0x8e43('0x1c')]=_[_0x8e43('0x1d')](config[_0x8e43('0x1c')],{'host':_0x8e43('0x1e'),'port':0x18eb});var socket=require(_0x8e43('0x1f'))(new Redis(config[_0x8e43('0x1c')]));require('./voiceExtension.socket')[_0x8e43('0x20')](socket);function respondWithStatusCode(_0x4992a3,_0xc8983a){_0xc8983a=_0xc8983a||0xcc;return function(_0x559ea7){if(_0x559ea7){return _0x4992a3[_0x8e43('0x21')](_0xc8983a);}return _0x4992a3['status'](_0xc8983a)[_0x8e43('0x22')]();};}function respondWithResult(_0x24bb5d,_0x486a8b){_0x486a8b=_0x486a8b||0xc8;return function(_0x23ceb8){if(_0x23ceb8){return _0x24bb5d[_0x8e43('0x23')](_0x486a8b)['json'](_0x23ceb8);}};}function respondWithFilteredResult(_0x301684,_0x22e13c){return function(_0x3a5c07){if(_0x3a5c07){var _0x5ef7f2=typeof _0x22e13c['offset']===_0x8e43('0x24')&&typeof _0x22e13c[_0x8e43('0x25')]===_0x8e43('0x24');var _0x1d12bc=_0x3a5c07[_0x8e43('0x26')];var _0x5d1510=_0x5ef7f2?0x0:_0x22e13c[_0x8e43('0x27')];var _0x5ae848=_0x5ef7f2?_0x3a5c07['count']:_0x22e13c[_0x8e43('0x27')]+_0x22e13c[_0x8e43('0x25')];var _0xb21663;if(_0x5ae848>=_0x1d12bc){_0x5ae848=_0x1d12bc;_0xb21663=0xc8;}else{_0xb21663=0xce;}_0x301684[_0x8e43('0x23')](_0xb21663);return _0x301684[_0x8e43('0x28')](_0x8e43('0x29'),_0x5d1510+'-'+_0x5ae848+'/'+_0x1d12bc)[_0x8e43('0x2a')](_0x3a5c07);}return null;};}function patchUpdates(_0x52e246){return function(_0x4b8e02){try{jsonpatch['apply'](_0x4b8e02,_0x52e246,!![]);}catch(_0x54acf7){return BPromise[_0x8e43('0x2b')](_0x54acf7);}return _0x4b8e02['save']();};}function saveUpdates(_0x3bd862,_0x2aa2e3){return function(_0x5f5dea){if(_0x5f5dea){return _0x5f5dea[_0x8e43('0x2c')](_0x3bd862)[_0x8e43('0x2d')](function(_0x4468fe){return _0x4468fe;});}return null;};}function removeEntity(_0x4dba23,_0x509efd){return function(_0x3e5f29){if(_0x3e5f29){return _0x3e5f29[_0x8e43('0x2e')]()[_0x8e43('0x2d')](function(){var _0x32c56d=_0x3e5f29[_0x8e43('0x2f')]({'plain':!![]});var _0x44dab5=[{'name':_0x8e43('0x30'),'value':'inbound','ignore':![]},{'name':'OutboundRoutes','value':_0x8e43('0x31'),'ignore':![]},{'name':'InternalRoutes','value':'internal','ignore':![]}];var _0x5deb49=_(_0x44dab5)[_0x8e43('0x32')](_0x8e43('0x33'))[_0x8e43('0x34')](_0x8e43('0x35'))['value']();if(_[_0x8e43('0x36')](_0x5deb49,_0x32c56d[_0x8e43('0x37')])){return;}var _0x266f20=_[_0x8e43('0x38')](_0x44dab5,[_0x8e43('0x35'),_0x32c56d[_0x8e43('0x37')]])[_0x8e43('0x39')];return db[_0x8e43('0x3a')][_0x8e43('0x2e')]({'where':{'type':_0x266f20,'resourceId':_0x32c56d['id']}})[_0x8e43('0x2d')](function(){return _0x3e5f29;});})[_0x8e43('0x2d')](function(){_0x4dba23[_0x8e43('0x23')](0xcc)[_0x8e43('0x22')]();});}};}function handleEntityNotFound(_0x2fc19c,_0x198a67){return function(_0x46022a){if(!_0x46022a){_0x2fc19c[_0x8e43('0x21')](0x194);}return _0x46022a;};}function handleError(_0x43a91d,_0x39f0ef){_0x39f0ef=_0x39f0ef||0x1f4;return function(_0x1ba61){logger[_0x8e43('0x3b')](_0x1ba61[_0x8e43('0x3c')]);if(_0x1ba61[_0x8e43('0x39')]){delete _0x1ba61['name'];}_0x43a91d[_0x8e43('0x23')](_0x39f0ef)[_0x8e43('0x3d')](_0x1ba61);};}exports[_0x8e43('0x3e')]=function(_0x1065a2,_0x58bf6c){var _0x220efb={},_0x2dbc6c={},_0x547338={'count':0x0,'rows':[]};var _0x4c61f4=_[_0x8e43('0x34')](db[_0x8e43('0x3f')]['rawAttributes'],function(_0x1de042){return{'name':_0x1de042[_0x8e43('0x40')],'type':_0x1de042['type'][_0x8e43('0x41')]};});_0x2dbc6c[_0x8e43('0x42')]=_[_0x8e43('0x34')](_0x4c61f4,_0x8e43('0x39'));_0x2dbc6c[_0x8e43('0x43')]=_[_0x8e43('0x44')](_0x1065a2[_0x8e43('0x43')]);_0x2dbc6c[_0x8e43('0x45')]=_['intersection'](_0x2dbc6c[_0x8e43('0x42')],_0x2dbc6c['query']);_0x220efb[_0x8e43('0x46')]=_[_0x8e43('0x47')](_0x2dbc6c['model'],qs[_0x8e43('0x48')](_0x1065a2['query'][_0x8e43('0x48')]));_0x220efb['attributes']=_0x220efb[_0x8e43('0x46')][_0x8e43('0x49')]?_0x220efb[_0x8e43('0x46')]:_0x2dbc6c[_0x8e43('0x42')];if(!_0x1065a2[_0x8e43('0x43')][_0x8e43('0x4a')]('nolimit')){_0x220efb['limit']=qs[_0x8e43('0x25')](_0x1065a2[_0x8e43('0x43')][_0x8e43('0x25')]);_0x220efb[_0x8e43('0x27')]=qs[_0x8e43('0x27')](_0x1065a2[_0x8e43('0x43')][_0x8e43('0x27')]);}_0x220efb[_0x8e43('0x4b')]=qs['sort'](_0x1065a2[_0x8e43('0x43')][_0x8e43('0x4c')]);_0x220efb['where']=qs[_0x8e43('0x45')](_['pick'](_0x1065a2['query'],_0x2dbc6c[_0x8e43('0x45')]),_0x4c61f4);if(_0x1065a2[_0x8e43('0x43')][_0x8e43('0x32')]){_0x220efb[_0x8e43('0x4d')]=_['merge'](_0x220efb[_0x8e43('0x4d')],{'$or':_[_0x8e43('0x34')](_0x4c61f4,function(_0x930ff7){if(_0x930ff7[_0x8e43('0x37')]!==_0x8e43('0x4e')){var _0x3e14c7={};_0x3e14c7[_0x930ff7[_0x8e43('0x39')]]={'$like':'%'+_0x1065a2[_0x8e43('0x43')][_0x8e43('0x32')]+'%'};return _0x3e14c7;}})});}_0x220efb=_[_0x8e43('0x4f')]({},_0x220efb,_0x1065a2[_0x8e43('0x50')]);var _0x4e05fe={'where':_0x220efb['where']};return db[_0x8e43('0x3f')]['count'](_0x4e05fe)[_0x8e43('0x2d')](function(_0xb2b152){_0x547338[_0x8e43('0x26')]=_0xb2b152;if(_0x1065a2[_0x8e43('0x43')][_0x8e43('0x51')]){_0x220efb[_0x8e43('0x52')]=[{'all':!![]}];}return db[_0x8e43('0x3f')][_0x8e43('0x53')](_0x220efb);})[_0x8e43('0x2d')](function(_0x3f1bfa){_0x547338['rows']=_0x3f1bfa;return _0x547338;})[_0x8e43('0x2d')](respondWithFilteredResult(_0x58bf6c,_0x220efb))[_0x8e43('0x54')](handleError(_0x58bf6c,null));};exports[_0x8e43('0x55')]=function(_0x41af69,_0x33854b){var _0x4ee545={'raw':![],'where':{'id':_0x41af69['params']['id']}},_0x89e56={};_0x89e56[_0x8e43('0x42')]=_[_0x8e43('0x44')](db[_0x8e43('0x3f')]['rawAttributes']);_0x89e56[_0x8e43('0x43')]=_['keys'](_0x41af69[_0x8e43('0x43')]);_0x89e56['filters']=_[_0x8e43('0x47')](_0x89e56[_0x8e43('0x42')],_0x89e56['query']);_0x4ee545['attributes']=_[_0x8e43('0x47')](_0x89e56[_0x8e43('0x42')],qs[_0x8e43('0x48')](_0x41af69[_0x8e43('0x43')]['fields']));_0x4ee545[_0x8e43('0x46')]=_0x4ee545[_0x8e43('0x46')][_0x8e43('0x49')]?_0x4ee545['attributes']:_0x89e56[_0x8e43('0x42')];if(_0x41af69['query']['includeAll']){_0x4ee545[_0x8e43('0x52')]=[{'all':!![]}];}_0x4ee545=_[_0x8e43('0x4f')]({},_0x4ee545,_0x41af69[_0x8e43('0x50')]);return db[_0x8e43('0x3f')][_0x8e43('0x38')](_0x4ee545)['then'](handleEntityNotFound(_0x33854b,null))[_0x8e43('0x2d')](respondWithResult(_0x33854b,null))[_0x8e43('0x54')](handleError(_0x33854b,null));};exports[_0x8e43('0x2e')]=function(_0x18b0a5,_0x1cb6c6){return db['VoiceExtension'][_0x8e43('0x38')]({'where':{'id':_0x18b0a5['params']['id']}})[_0x8e43('0x2d')](handleEntityNotFound(_0x1cb6c6,null))[_0x8e43('0x2d')](removeEntity(_0x1cb6c6,null))[_0x8e43('0x54')](handleError(_0x1cb6c6,null));};exports['create']=function(_0x596d45,_0x66087a){if(_0x596d45[_0x8e43('0x56')][_0x8e43('0x37')]===_0x8e43('0x31')&&!_['startsWith'](_0x596d45[_0x8e43('0x56')][_0x8e43('0x57')],'_')){_0x596d45[_0x8e43('0x56')][_0x8e43('0x57')]='_'[_0x8e43('0x58')](_0x596d45[_0x8e43('0x56')]['exten']);}return db[_0x8e43('0x3f')][_0x8e43('0x59')](_0x596d45[_0x8e43('0x56')],{'raw':![]})['then'](function(_0xcf99b1){var _0x491197=_0x596d45['user']['get']({'plain':!![]});if(!_0x491197)throw new Error(_0x8e43('0x5a'));if(_0x491197[_0x8e43('0x5b')]===_0x8e43('0x5c')){var _0x5bfc66=_0xcf99b1['get']({'plain':!![]});var _0x1db4a6=[{'name':_0x8e43('0x30'),'value':_0x8e43('0x5d')},{'name':_0x8e43('0x5e'),'value':'outbound'},{'name':_0x8e43('0x5f'),'value':_0x8e43('0x60')}];var _0x2a2a13=_[_0x8e43('0x38')](_0x1db4a6,[_0x8e43('0x35'),_0x5bfc66['type']])[_0x8e43('0x39')];return db[_0x8e43('0x61')]['find']({'where':{'name':_0x2a2a13,'userProfileId':_0x491197[_0x8e43('0x62')]},'raw':!![]})[_0x8e43('0x2d')](function(_0x418e66){if(_0x418e66&&_0x418e66[_0x8e43('0x63')]===0x0){return db['UserProfileResource'][_0x8e43('0x59')]({'name':_0x5bfc66[_0x8e43('0x39')],'resourceId':_0x5bfc66['id'],'type':_0x418e66[_0x8e43('0x39')],'sectionId':_0x418e66['id']},{})[_0x8e43('0x2d')](function(){return _0xcf99b1;});}else{return _0xcf99b1;}})[_0x8e43('0x54')](function(_0x1547a2){logger[_0x8e43('0x3b')](_0x8e43('0x64'),_0x1547a2);throw _0x1547a2;});}return _0xcf99b1;})[_0x8e43('0x2d')](respondWithResult(_0x66087a,0xc9))['catch'](handleError(_0x66087a,null));};exports[_0x8e43('0x2c')]=function(_0x30c973,_0x37ca29){if(_0x30c973[_0x8e43('0x56')]['id']){delete _0x30c973[_0x8e43('0x56')]['id'];}return db[_0x8e43('0x3f')][_0x8e43('0x38')]({'where':{'id':_0x30c973['params']['id']}})[_0x8e43('0x2d')](handleEntityNotFound(_0x37ca29,null))[_0x8e43('0x2d')](function(_0x1fe380){if(_0x1fe380){return db[_0x8e43('0x3f')][_0x8e43('0x2c')](_['pick'](_0x30c973[_0x8e43('0x56')],[_0x8e43('0x57'),_0x8e43('0x65'),_0x8e43('0x66'),_0x8e43('0x67'),_0x8e43('0x68'),_0x8e43('0x69'),_0x8e43('0x6a')]),{'where':{'context':_0x1fe380[_0x8e43('0x65')],'exten':_0x1fe380[_0x8e43('0x57')]},'individualHooks':!![]})['then'](function(_0x41a703){return _0x41a703;});}return null;})[_0x8e43('0x2d')](respondWithStatusCode(_0x37ca29,null))[_0x8e43('0x54')](handleError(_0x37ca29,null));};exports[_0x8e43('0x6b')]=function(_0x4865e1,_0x39445a){return db['VoiceExtension'][_0x8e43('0x6c')]({'where':{'id':_0x4865e1['params']['id']}})['then'](function(_0x10c196){if(_0x10c196){return db[_0x8e43('0x6d')][_0x8e43('0x6e')](function(_0x55de1f){return db[_0x8e43('0x3f')]['destroy']({'where':{'VoiceExtensionId':_0x4865e1[_0x8e43('0x6f')]['id']},'transaction':_0x55de1f})[_0x8e43('0x2d')](function(){var _0x5dba7a=_[_0x8e43('0x34')](_0x4865e1[_0x8e43('0x56')],function(_0x5ae102){_0x5ae102[_0x8e43('0x70')]=_0x4865e1[_0x8e43('0x6f')]['id'];_0x5ae102[_0x8e43('0x71')]=!![];return _0x5ae102;});var _0x44e3d0=_0x4865e1['query'][_0x8e43('0x72')]&&_0x4865e1[_0x8e43('0x43')]['rewriteDial'][_0x8e43('0x73')]()===_0x8e43('0x74')?!![]:![];return _0x10c196[_0x8e43('0x75')](_0x5dba7a,_0x44e3d0);})['then'](function(_0x4b7656){return db[_0x8e43('0x3f')][_0x8e43('0x76')](_0x4b7656,{'transaction':_0x55de1f});});})[_0x8e43('0x2d')](function(){return db[_0x8e43('0x3f')][_0x8e43('0x77')]({'where':{'isApp':!![],'VoiceExtensionId':_0x4865e1[_0x8e43('0x6f')]['id']},'order':_0x8e43('0x78')});});}})['then'](respondWithResult(_0x39445a,null))[_0x8e43('0x54')](handleError(_0x39445a,null));}; \ No newline at end of file +var _0xd3ca=['ignore','map','value','find','type','name','UserProfileResource','destroy','stack','send','index','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','options','VoiceExtension','includeAll','include','findAll','show','params','rawAttributes','catch','body','startsWith','exten','concat','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','InboundRoutes','OutboundRoutes','InternalRoutes','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','pick','context','description','recordingFormat','cutdigits','alias','addApplications','VoiceExtensionId','isApp','rewriteDial','true','createRouting','bulkCreate','cast(priority\x20as\x20unsigned)','rimraf','zip-dir','fast-json-patch','mustache','util','path','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/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','update','then','get','inbound','outbound','internal','filter'];(function(_0x29ed77,_0x3a78d0){var _0x2c1c90=function(_0x37c21c){while(--_0x37c21c){_0x29ed77['push'](_0x29ed77['shift']());}};_0x2c1c90(++_0x3a78d0);}(_0xd3ca,0xaf));var _0xad3c=function(_0x37e7a9,_0x248258){_0x37e7a9=_0x37e7a9-0x0;var _0x2fe1b8=_0xd3ca[_0x37e7a9];return _0x2fe1b8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xad3c('0x0'));var zipdir=require(_0xad3c('0x1'));var jsonpatch=require(_0xad3c('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xad3c('0x3'));var util=require(_0xad3c('0x4'));var path=require(_0xad3c('0x5'));var sox=require(_0xad3c('0x6'));var csv=require(_0xad3c('0x7'));var ejs=require(_0xad3c('0x8'));var fs=require('fs');var fs_extra=require(_0xad3c('0x9'));var _=require('lodash');var squel=require(_0xad3c('0xa'));var crypto=require(_0xad3c('0xb'));var jsforce=require(_0xad3c('0xc'));var deskjs=require(_0xad3c('0xd'));var toCsv=require(_0xad3c('0x7'));var querystring=require(_0xad3c('0xe'));var Papa=require('papaparse');var Redis=require(_0xad3c('0xf'));var authService=require(_0xad3c('0x10'));var qs=require(_0xad3c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xad3c('0x12'));var logger=require(_0xad3c('0x13'))('api');var utils=require(_0xad3c('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xad3c('0x15'));var db=require(_0xad3c('0x16'))['db'];config[_0xad3c('0x17')]=_[_0xad3c('0x18')](config[_0xad3c('0x17')],{'host':_0xad3c('0x19'),'port':0x18eb});var socket=require(_0xad3c('0x1a'))(new Redis(config[_0xad3c('0x17')]));require('./voiceExtension.socket')['register'](socket);function respondWithStatusCode(_0x884698,_0x50414f){_0x50414f=_0x50414f||0xcc;return function(_0xca9813){if(_0xca9813){return _0x884698[_0xad3c('0x1b')](_0x50414f);}return _0x884698[_0xad3c('0x1c')](_0x50414f)[_0xad3c('0x1d')]();};}function respondWithResult(_0x247ec0,_0x3b27eb){_0x3b27eb=_0x3b27eb||0xc8;return function(_0x5ad62b){if(_0x5ad62b){return _0x247ec0[_0xad3c('0x1c')](_0x3b27eb)['json'](_0x5ad62b);}};}function respondWithFilteredResult(_0x1aa8ca,_0x159b92){return function(_0x5d9a78){if(_0x5d9a78){var _0x42869d=typeof _0x159b92[_0xad3c('0x1e')]===_0xad3c('0x1f')&&typeof _0x159b92[_0xad3c('0x20')]==='undefined';var _0x23ed26=_0x5d9a78[_0xad3c('0x21')];var _0x11023d=_0x42869d?0x0:_0x159b92['offset'];var _0x27251c=_0x42869d?_0x5d9a78[_0xad3c('0x21')]:_0x159b92[_0xad3c('0x1e')]+_0x159b92[_0xad3c('0x20')];var _0x524756;if(_0x27251c>=_0x23ed26){_0x27251c=_0x23ed26;_0x524756=0xc8;}else{_0x524756=0xce;}_0x1aa8ca['status'](_0x524756);return _0x1aa8ca[_0xad3c('0x22')](_0xad3c('0x23'),_0x11023d+'-'+_0x27251c+'/'+_0x23ed26)[_0xad3c('0x24')](_0x5d9a78);}return null;};}function patchUpdates(_0x119a46){return function(_0x105702){try{jsonpatch['apply'](_0x105702,_0x119a46,!![]);}catch(_0x21f2b9){return BPromise[_0xad3c('0x25')](_0x21f2b9);}return _0x105702['save']();};}function saveUpdates(_0x5eafe9,_0x53af7b){return function(_0x340822){if(_0x340822){return _0x340822[_0xad3c('0x26')](_0x5eafe9)[_0xad3c('0x27')](function(_0x44f092){return _0x44f092;});}return null;};}function removeEntity(_0x3f10cf,_0x483ac2){return function(_0x10966a){if(_0x10966a){return _0x10966a['destroy']()[_0xad3c('0x27')](function(){var _0x552ce9=_0x10966a[_0xad3c('0x28')]({'plain':!![]});var _0x381396=[{'name':'InboundRoutes','value':_0xad3c('0x29'),'ignore':![]},{'name':'OutboundRoutes','value':_0xad3c('0x2a'),'ignore':![]},{'name':'InternalRoutes','value':_0xad3c('0x2b'),'ignore':![]}];var _0x434d51=_(_0x381396)[_0xad3c('0x2c')](_0xad3c('0x2d'))[_0xad3c('0x2e')](_0xad3c('0x2f'))[_0xad3c('0x2f')]();if(_['includes'](_0x434d51,_0x552ce9['type'])){return;}var _0x58d83a=_[_0xad3c('0x30')](_0x381396,[_0xad3c('0x2f'),_0x552ce9[_0xad3c('0x31')]])[_0xad3c('0x32')];return db[_0xad3c('0x33')][_0xad3c('0x34')]({'where':{'type':_0x58d83a,'resourceId':_0x552ce9['id']}})[_0xad3c('0x27')](function(){return _0x10966a;});})[_0xad3c('0x27')](function(){_0x3f10cf[_0xad3c('0x1c')](0xcc)[_0xad3c('0x1d')]();});}};}function handleEntityNotFound(_0x5333cf,_0x3a402d){return function(_0x5cb56f){if(!_0x5cb56f){_0x5333cf[_0xad3c('0x1b')](0x194);}return _0x5cb56f;};}function handleError(_0x24d8b6,_0x4081c6){_0x4081c6=_0x4081c6||0x1f4;return function(_0x10387d){logger['error'](_0x10387d[_0xad3c('0x35')]);if(_0x10387d[_0xad3c('0x32')]){delete _0x10387d[_0xad3c('0x32')];}_0x24d8b6['status'](_0x4081c6)[_0xad3c('0x36')](_0x10387d);};}exports[_0xad3c('0x37')]=function(_0x417594,_0x42e4f5){var _0x293164={},_0x3954e4={},_0x3f0b38={'count':0x0,'rows':[]};var _0x2ef629=_[_0xad3c('0x2e')](db['VoiceExtension']['rawAttributes'],function(_0x35a48a){return{'name':_0x35a48a[_0xad3c('0x38')],'type':_0x35a48a['type'][_0xad3c('0x39')]};});_0x3954e4[_0xad3c('0x3a')]=_['map'](_0x2ef629,_0xad3c('0x32'));_0x3954e4['query']=_[_0xad3c('0x3b')](_0x417594[_0xad3c('0x3c')]);_0x3954e4[_0xad3c('0x3d')]=_[_0xad3c('0x3e')](_0x3954e4[_0xad3c('0x3a')],_0x3954e4[_0xad3c('0x3c')]);_0x293164['attributes']=_[_0xad3c('0x3e')](_0x3954e4[_0xad3c('0x3a')],qs[_0xad3c('0x3f')](_0x417594[_0xad3c('0x3c')][_0xad3c('0x3f')]));_0x293164['attributes']=_0x293164[_0xad3c('0x40')][_0xad3c('0x41')]?_0x293164[_0xad3c('0x40')]:_0x3954e4[_0xad3c('0x3a')];if(!_0x417594[_0xad3c('0x3c')][_0xad3c('0x42')](_0xad3c('0x43'))){_0x293164[_0xad3c('0x20')]=qs['limit'](_0x417594[_0xad3c('0x3c')][_0xad3c('0x20')]);_0x293164[_0xad3c('0x1e')]=qs[_0xad3c('0x1e')](_0x417594[_0xad3c('0x3c')][_0xad3c('0x1e')]);}_0x293164[_0xad3c('0x44')]=qs[_0xad3c('0x45')](_0x417594['query']['sort']);_0x293164[_0xad3c('0x46')]=qs['filters'](_['pick'](_0x417594['query'],_0x3954e4['filters']),_0x2ef629);if(_0x417594[_0xad3c('0x3c')][_0xad3c('0x2c')]){_0x293164[_0xad3c('0x46')]=_[_0xad3c('0x47')](_0x293164[_0xad3c('0x46')],{'$or':_['map'](_0x2ef629,function(_0x2b4d49){if(_0x2b4d49[_0xad3c('0x31')]!=='VIRTUAL'){var _0x194272={};_0x194272[_0x2b4d49[_0xad3c('0x32')]]={'$like':'%'+_0x417594[_0xad3c('0x3c')][_0xad3c('0x2c')]+'%'};return _0x194272;}})});}_0x293164=_[_0xad3c('0x47')]({},_0x293164,_0x417594[_0xad3c('0x48')]);var _0x43936b={'where':_0x293164[_0xad3c('0x46')]};return db[_0xad3c('0x49')][_0xad3c('0x21')](_0x43936b)[_0xad3c('0x27')](function(_0x16b70b){_0x3f0b38[_0xad3c('0x21')]=_0x16b70b;if(_0x417594[_0xad3c('0x3c')][_0xad3c('0x4a')]){_0x293164[_0xad3c('0x4b')]=[{'all':!![]}];}return db[_0xad3c('0x49')][_0xad3c('0x4c')](_0x293164);})[_0xad3c('0x27')](function(_0x12f16e){_0x3f0b38['rows']=_0x12f16e;return _0x3f0b38;})[_0xad3c('0x27')](respondWithFilteredResult(_0x42e4f5,_0x293164))['catch'](handleError(_0x42e4f5,null));};exports[_0xad3c('0x4d')]=function(_0x4d00da,_0x1b2d80){var _0x5c3bd7={'raw':![],'where':{'id':_0x4d00da[_0xad3c('0x4e')]['id']}},_0x111626={};_0x111626[_0xad3c('0x3a')]=_[_0xad3c('0x3b')](db[_0xad3c('0x49')][_0xad3c('0x4f')]);_0x111626[_0xad3c('0x3c')]=_['keys'](_0x4d00da['query']);_0x111626[_0xad3c('0x3d')]=_[_0xad3c('0x3e')](_0x111626[_0xad3c('0x3a')],_0x111626['query']);_0x5c3bd7[_0xad3c('0x40')]=_[_0xad3c('0x3e')](_0x111626['model'],qs['fields'](_0x4d00da[_0xad3c('0x3c')][_0xad3c('0x3f')]));_0x5c3bd7[_0xad3c('0x40')]=_0x5c3bd7[_0xad3c('0x40')][_0xad3c('0x41')]?_0x5c3bd7[_0xad3c('0x40')]:_0x111626['model'];if(_0x4d00da[_0xad3c('0x3c')][_0xad3c('0x4a')]){_0x5c3bd7['include']=[{'all':!![]}];}_0x5c3bd7=_[_0xad3c('0x47')]({},_0x5c3bd7,_0x4d00da[_0xad3c('0x48')]);return db['VoiceExtension'][_0xad3c('0x30')](_0x5c3bd7)['then'](handleEntityNotFound(_0x1b2d80,null))[_0xad3c('0x27')](respondWithResult(_0x1b2d80,null))[_0xad3c('0x50')](handleError(_0x1b2d80,null));};exports[_0xad3c('0x34')]=function(_0xf3fe2f,_0x65757c){return db[_0xad3c('0x49')][_0xad3c('0x30')]({'where':{'id':_0xf3fe2f[_0xad3c('0x4e')]['id']}})[_0xad3c('0x27')](handleEntityNotFound(_0x65757c,null))[_0xad3c('0x27')](removeEntity(_0x65757c,null))['catch'](handleError(_0x65757c,null));};exports['create']=function(_0x113dcd,_0x5eb0a5){if(_0x113dcd[_0xad3c('0x51')][_0xad3c('0x31')]===_0xad3c('0x2a')&&!_[_0xad3c('0x52')](_0x113dcd['body'][_0xad3c('0x53')],'_')){_0x113dcd[_0xad3c('0x51')][_0xad3c('0x53')]='_'[_0xad3c('0x54')](_0x113dcd['body'][_0xad3c('0x53')]);}return db[_0xad3c('0x49')][_0xad3c('0x55')](_0x113dcd[_0xad3c('0x51')],{'raw':![]})[_0xad3c('0x27')](function(_0x575fce){var _0x4456ef=_0x113dcd[_0xad3c('0x56')][_0xad3c('0x28')]({'plain':!![]});if(!_0x4456ef)throw new Error(_0xad3c('0x57'));if(_0x4456ef[_0xad3c('0x58')]==='user'){var _0x4fdeef=_0x575fce[_0xad3c('0x28')]({'plain':!![]});var _0x32a8ef=[{'name':_0xad3c('0x59'),'value':'inbound'},{'name':_0xad3c('0x5a'),'value':'outbound'},{'name':_0xad3c('0x5b'),'value':_0xad3c('0x2b')}];var _0x2893a=_['find'](_0x32a8ef,[_0xad3c('0x2f'),_0x4fdeef[_0xad3c('0x31')]])[_0xad3c('0x32')];return db['UserProfileSection'][_0xad3c('0x30')]({'where':{'name':_0x2893a,'userProfileId':_0x4456ef[_0xad3c('0x5c')]},'raw':!![]})['then'](function(_0x124e9a){if(_0x124e9a&&_0x124e9a[_0xad3c('0x5d')]===0x0){return db['UserProfileResource']['create']({'name':_0x4fdeef[_0xad3c('0x32')],'resourceId':_0x4fdeef['id'],'type':_0x124e9a[_0xad3c('0x32')],'sectionId':_0x124e9a['id']},{})[_0xad3c('0x27')](function(){return _0x575fce;});}else{return _0x575fce;}})[_0xad3c('0x50')](function(_0x59bd46){logger[_0xad3c('0x5e')](_0xad3c('0x5f'),_0x59bd46);throw _0x59bd46;});}return _0x575fce;})[_0xad3c('0x27')](respondWithResult(_0x5eb0a5,0xc9))[_0xad3c('0x50')](handleError(_0x5eb0a5,null));};exports['update']=function(_0x465f4e,_0x206f57){if(_0x465f4e[_0xad3c('0x51')]['id']){delete _0x465f4e[_0xad3c('0x51')]['id'];}return db[_0xad3c('0x49')][_0xad3c('0x30')]({'where':{'id':_0x465f4e[_0xad3c('0x4e')]['id']}})[_0xad3c('0x27')](handleEntityNotFound(_0x206f57,null))[_0xad3c('0x27')](function(_0x4c2607){if(_0x4c2607){return db['VoiceExtension'][_0xad3c('0x26')](_[_0xad3c('0x60')](_0x465f4e[_0xad3c('0x51')],[_0xad3c('0x53'),_0xad3c('0x61'),_0xad3c('0x62'),_0xad3c('0x63'),_0xad3c('0x64'),'mandatoryDisposition',_0xad3c('0x65')]),{'where':{'context':_0x4c2607[_0xad3c('0x61')],'exten':_0x4c2607[_0xad3c('0x53')]},'individualHooks':!![]})['then'](function(_0x2b8f07){return _0x2b8f07;});}return null;})[_0xad3c('0x27')](respondWithStatusCode(_0x206f57,null))[_0xad3c('0x50')](handleError(_0x206f57,null));};exports[_0xad3c('0x66')]=function(_0x351e6c,_0x450065){return db[_0xad3c('0x49')]['findOne']({'where':{'id':_0x351e6c[_0xad3c('0x4e')]['id']}})[_0xad3c('0x27')](function(_0x5ab33f){if(_0x5ab33f){return db['sequelize']['transaction'](function(_0x46d16d){return db[_0xad3c('0x49')][_0xad3c('0x34')]({'where':{'VoiceExtensionId':_0x351e6c['params']['id']},'transaction':_0x46d16d})[_0xad3c('0x27')](function(){var _0x58a973=_[_0xad3c('0x2e')](_0x351e6c[_0xad3c('0x51')],function(_0x280082){_0x280082[_0xad3c('0x67')]=_0x351e6c['params']['id'];_0x280082[_0xad3c('0x68')]=!![];return _0x280082;});var _0x15061e=_0x351e6c[_0xad3c('0x3c')][_0xad3c('0x69')]&&_0x351e6c[_0xad3c('0x3c')][_0xad3c('0x69')]['toLowerCase']()===_0xad3c('0x6a')?!![]:![];return _0x5ab33f[_0xad3c('0x6b')](_0x58a973,_0x15061e);})['then'](function(_0x5ea8d2){return db[_0xad3c('0x49')][_0xad3c('0x6c')](_0x5ea8d2,{'transaction':_0x46d16d});});})[_0xad3c('0x27')](function(){return db['VoiceExtension']['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x351e6c['params']['id']},'order':_0xad3c('0x6d')});});}})[_0xad3c('0x27')](respondWithResult(_0x450065,null))[_0xad3c('0x50')](handleError(_0x450065,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index b0fcecb..345a2c1 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 _0xb2e7=['remove','VoiceExtension','setMaxListeners','save','update'];(function(_0x50a8ca,_0x43aa15){var _0x2ef4d4=function(_0x359a8a){while(--_0x359a8a){_0x50a8ca['push'](_0x50a8ca['shift']());}};_0x2ef4d4(++_0x43aa15);}(_0xb2e7,0xab));var _0x7b2e=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xb2e7[_0x4b369d];return _0x571a98;};'use strict';var EventEmitter=require('events');var VoiceExtension=require('../../mysqldb')['db'][_0x7b2e('0x0')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x7b2e('0x1')](0x0);var events={'afterCreate':_0x7b2e('0x2'),'afterUpdate':_0x7b2e('0x3'),'afterDestroy':_0x7b2e('0x4')};function emitEvent(_0x20773c){return function(_0x1e1045,_0x3e2987,_0x3958b8){VoiceExtensionEvents['emit'](_0x20773c+':'+_0x1e1045['id'],_0x1e1045);VoiceExtensionEvents['emit'](_0x20773c,_0x1e1045);_0x3958b8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file +var _0x9bc1=['../../mysqldb','save','update','remove','emit','hook','exports','events'];(function(_0x24b718,_0x9543eb){var _0x52e8a4=function(_0x11e0e6){while(--_0x11e0e6){_0x24b718['push'](_0x24b718['shift']());}};_0x52e8a4(++_0x9543eb);}(_0x9bc1,0x10f));var _0x19bc=function(_0x51ab4f,_0x32f508){_0x51ab4f=_0x51ab4f-0x0;var _0xc004ae=_0x9bc1[_0x51ab4f];return _0xc004ae;};'use strict';var EventEmitter=require(_0x19bc('0x0'));var VoiceExtension=require(_0x19bc('0x1'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x19bc('0x2'),'afterUpdate':_0x19bc('0x3'),'afterDestroy':_0x19bc('0x4')};function emitEvent(_0x47f4f4){return function(_0x39e22d,_0x417f8f,_0x2373d5){VoiceExtensionEvents[_0x19bc('0x5')](_0x47f4f4+':'+_0x39e22d['id'],_0x39e22d);VoiceExtensionEvents[_0x19bc('0x5')](_0x47f4f4,_0x39e22d);_0x2373d5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x19bc('0x6')](e,emitEvent(event));}}module[_0x19bc('0x7')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 95e9210..59986df 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 _0xd2ee=['context','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(destination)=','cutdigits','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','split','length','name','param','phone','prefix','SIP','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','interval','IntervalId','*,*,*,*','intervals','map','toLowerCase','tag','CDR(tag)=','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','app','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','appType','outboundDial','appdata','priority','last','concat','catch','define','VoiceExtension','voice_extensions','then','Hangup','util','lodash','./voiceExtension.attributes','exports','models','type','Set','CDR(type)=','exten','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd2ee,0x1df));var _0xed2e=function(_0x3c6827,_0x175507){_0x3c6827=_0x3c6827-0x0;var _0x95cf59=_0xd2ee[_0x3c6827];return _0x95cf59;};'use strict';var util=require(_0xed2e('0x0'));var _=require(_0xed2e('0x1'));var attributes=require(_0xed2e('0x2'));module[_0xed2e('0x3')]=function(_0x1054c1){var _0x49453c=_0x1054c1[_0xed2e('0x4')];function _0x1d6d86(_0x350eca){var _0x279061=0x2;var _0x376909=[{'type':_0x350eca[_0xed2e('0x5')],'app':_0xed2e('0x6'),'appdata':_0xed2e('0x7')+_0x350eca[_0xed2e('0x5')],'context':_0x350eca['context'],'exten':_0x350eca[_0xed2e('0x8')],'priority':_0x279061++,'VoiceExtensionId':_0x350eca['id']},{'type':_0x350eca[_0xed2e('0x5')],'app':_0x350eca[_0xed2e('0x9')]?_0xed2e('0x6'):_0xed2e('0xa'),'appdata':_0x350eca['alias']?_0xed2e('0xb')+_0x350eca['alias']:_0xed2e('0xc'),'context':_0x350eca[_0xed2e('0xd')],'exten':_0x350eca[_0xed2e('0x8')],'priority':_0x279061++,'VoiceExtensionId':_0x350eca['id']}];if(_0x350eca[_0xed2e('0x5')]===_0xed2e('0xe')){_0x376909[_0xed2e('0xf')]({'type':_0xed2e('0xe'),'app':'Set','appdata':_0xed2e('0x10')+_0x350eca['id'],'context':_0x350eca[_0xed2e('0xd')],'exten':_0x350eca[_0xed2e('0x8')],'priority':_0x279061++,'VoiceExtensionId':_0x350eca['id']});}_0x376909[_0xed2e('0xf')]({'type':_0x350eca[_0xed2e('0x5')],'app':'Set','appdata':_0xed2e('0x11'),'context':_0x350eca['context'],'exten':_0x350eca[_0xed2e('0x8')],'priority':_0x279061++,'VoiceExtensionId':_0x350eca['id']},{'type':_0x350eca[_0xed2e('0x5')],'app':'Set','appdata':_0xed2e('0x12'),'context':_0x350eca[_0xed2e('0xd')],'exten':_0x350eca[_0xed2e('0x8')],'priority':_0x279061++,'VoiceExtensionId':_0x350eca['id']},{'type':_0x350eca[_0xed2e('0x5')],'app':_0xed2e('0x6'),'appdata':_0xed2e('0x13'),'context':_0x350eca['context'],'exten':_0x350eca[_0xed2e('0x8')],'priority':_0x279061++,'VoiceExtensionId':_0x350eca['id']});return _0x376909;}function _0x381106(_0x147cba){var _0x3e99a3=0x2;var _0x32594f=[{'type':_0xed2e('0x14'),'app':_0xed2e('0x6'),'appdata':'CDR(type)=outbound','context':_0x147cba['context'],'exten':_0x147cba[_0xed2e('0x8')],'priority':_0x3e99a3++,'VoiceExtensionId':_0x147cba['id']},{'type':_0xed2e('0x14'),'app':_0x147cba['alias']?_0xed2e('0x6'):_0xed2e('0xa'),'appdata':_0x147cba['alias']?_0xed2e('0xb')+_0x147cba[_0xed2e('0x9')]:_0xed2e('0xc'),'context':_0x147cba['context'],'exten':_0x147cba['exten'],'priority':_0x3e99a3++,'VoiceExtensionId':_0x147cba['id']},{'type':_0xed2e('0x14'),'app':_0xed2e('0x6'),'appdata':_0xed2e('0x15')+(_0x147cba[_0xed2e('0x16')]?'${EXTEN:'+_0x147cba['cutdigits']+'}':_0xed2e('0x17')),'context':_0x147cba['context'],'exten':_0x147cba[_0xed2e('0x8')],'priority':_0x3e99a3++,'VoiceExtensionId':_0x147cba['id']},{'type':_0xed2e('0x14'),'app':_0xed2e('0x6'),'appdata':'CDR(routeid)='+_0x147cba['id'],'context':_0x147cba[_0xed2e('0xd')],'exten':_0x147cba[_0xed2e('0x8')],'priority':_0x3e99a3++,'VoiceExtensionId':_0x147cba['id']},{'type':'outbound','app':'ExecIf','appdata':_0xed2e('0x18')+(_0x3e99a3+0x2)+'):Goto('+(_0x3e99a3+0x1)+')','context':_0x147cba[_0xed2e('0xd')],'exten':_0x147cba[_0xed2e('0x8')],'priority':_0x3e99a3++,'VoiceExtensionId':_0x147cba['id']},{'type':_0xed2e('0x14'),'app':'Set','appdata':_0x147cba[_0xed2e('0x16')]?_0xed2e('0x19')+_0x147cba[_0xed2e('0x16')]+'}':'CDR(prefix)=noprefix','context':_0x147cba[_0xed2e('0xd')],'exten':_0x147cba[_0xed2e('0x8')],'priority':_0x3e99a3++,'VoiceExtensionId':_0x147cba['id']},{'type':_0xed2e('0x14'),'app':'Set','appdata':_0xed2e('0x11'),'context':_0x147cba[_0xed2e('0xd')],'exten':_0x147cba[_0xed2e('0x8')],'priority':_0x3e99a3++,'VoiceExtensionId':_0x147cba['id']},{'type':_0xed2e('0x14'),'app':'Set','appdata':_0xed2e('0x12'),'context':_0x147cba[_0xed2e('0xd')],'exten':_0x147cba[_0xed2e('0x8')],'priority':_0x3e99a3++,'VoiceExtensionId':_0x147cba['id']},{'type':_0xed2e('0x14'),'app':'Set','appdata':_0xed2e('0x13'),'context':_0x147cba[_0xed2e('0xd')],'exten':_0x147cba[_0xed2e('0x8')],'priority':_0x3e99a3++,'VoiceExtensionId':_0x147cba['id']},{'type':_0xed2e('0x14'),'app':_0xed2e('0x6'),'appdata':_0xed2e('0x1a')+_0x147cba['id'],'context':_0x147cba[_0xed2e('0xd')],'exten':_0x147cba[_0xed2e('0x8')],'priority':_0x3e99a3++,'VoiceExtensionId':_0x147cba['id']}];if(_0x147cba[_0xed2e('0x1b')]('recordingFormat')&&_0x147cba[_0xed2e('0x1c')]!==_0xed2e('0x1d')){_0x32594f[_0xed2e('0xf')]({'type':_0xed2e('0x14'),'app':_0xed2e('0x6'),'appdata':_0xed2e('0x1e'),'context':_0x147cba[_0xed2e('0xd')],'exten':_0x147cba[_0xed2e('0x8')],'priority':_0x3e99a3++,'VoiceExtensionId':_0x147cba['id']},{'type':_0xed2e('0x14'),'app':_0xed2e('0x6'),'appdata':_0xed2e('0x1f')+_0x147cba[_0xed2e('0x1c')]||_0xed2e('0x20'),'context':_0x147cba[_0xed2e('0xd')],'exten':_0x147cba[_0xed2e('0x8')],'priority':_0x3e99a3++,'VoiceExtensionId':_0x147cba['id']});}return _0x32594f;}function _0x4b3d2d(_0xb93f42){var _0x41a0ac=[{'name':_0xed2e('0x21'),'param':0x0},{'name':_0xed2e('0x22'),'param':0x1},{'name':_0xed2e('0x23'),'param':0x2},{'name':'url','param':0x3}];var _0x45f7a8={};var _0x92826c=_0xb93f42[_0xed2e('0x24')](',');var _0x2cee8f=[];for(var _0xd5ca5b=0x0;_0xd5ca5b<_0x41a0ac[_0xed2e('0x25')];_0xd5ca5b++){switch(_0x41a0ac[_0xd5ca5b][_0xed2e('0x26')]){case _0xed2e('0x21'):_0x45f7a8[_0xed2e('0x21')]=_0x92826c[_0x41a0ac[_0xd5ca5b][_0xed2e('0x27')]][_0xed2e('0x24')]('/')[0x1];_0x45f7a8[_0xed2e('0x28')]=_0x92826c[_0x41a0ac[_0xd5ca5b][_0xed2e('0x27')]][_0xed2e('0x24')]('/')[0x2];_0x45f7a8[_0xed2e('0x29')]=_0x45f7a8['phone']?_0x45f7a8[_0xed2e('0x28')][_0xed2e('0x24')]('$')[0x0]:undefined;_0x45f7a8['phone']=route[_0xed2e('0x16')]?(_0x45f7a8['prefix']||'')+'${EXTEN:'+route[_0xed2e('0x16')]+'}':(_0x45f7a8['prefix']||'')+_0xed2e('0x17');_0x2cee8f[_0x41a0ac[_0xd5ca5b]['param']]=[_0xed2e('0x2a'),_0x45f7a8[_0xed2e('0x21')],_0x45f7a8[_0xed2e('0x28')]]['join']('/');break;case _0xed2e('0x23'):_0x45f7a8[_0xed2e('0x23')]=_0x92826c[_0x41a0ac[_0xd5ca5b][_0xed2e('0x27')]];if(route[_0xed2e('0x1c')]!==_0xed2e('0x1d')){if(_0x45f7a8[_0xed2e('0x23')]['indexOf'](_0xed2e('0x2b'))<0x0){_0x45f7a8[_0xed2e('0x23')]+=_0xed2e('0x2b');}}else{_0x45f7a8[_0xed2e('0x23')]=_0x45f7a8['options'][_0xed2e('0x2c')](_0xed2e('0x2b'),'');}_0x2cee8f[_0x41a0ac[_0xd5ca5b][_0xed2e('0x27')]]=_0x45f7a8[_0xed2e('0x23')];break;default:_0x2cee8f[_0x41a0ac[_0xd5ca5b][_0xed2e('0x27')]]=_0x92826c[_0x41a0ac[_0xd5ca5b]['param']];}}return _0x2cee8f['join'](',');}function _0xcc8579(_0x47ef28,_0x1c0f46,_0x273deb,_0x58a482){return new Promise(function(_0x1c17c0,_0x44e612){var _0x309293=[];if(_[_0xed2e('0x2d')](_0x1c0f46))return _0x1c17c0(_0x309293);_0x49453c[_0xed2e('0x2e')]['findAll']({'attributes':['id',_0xed2e('0x2f'),_0xed2e('0x30')],'raw':!![]})['then'](function(_0x1c3894){for(var _0x3da1d9=0x0,_0x3568b0=0x0;_0x3da1d9<_0x1c0f46[_0xed2e('0x25')];_0x3da1d9++,_0x3568b0=0x0){var _0xed8c22=_0x1c0f46[_0x3da1d9];var _0x5cda7b=[];var _0x1aee49=[];if(_0xed8c22[_0xed2e('0x2f')]!==_0xed2e('0x31')){_0xed8c22[_0xed2e('0x32')]=[_0xed8c22['interval']];}else{_0xed8c22[_0xed2e('0x32')]=_0xed8c22[_0xed2e('0x30')]?_[_0xed2e('0x33')](_['filter'](_0x1c3894,{'IntervalId':_0xed8c22[_0xed2e('0x30')]}),_0xed2e('0x2f')):[];}_0xed8c22[_0xed2e('0xd')]=_0x47ef28[_0xed2e('0xd')];_0xed8c22[_0xed2e('0x8')]=_0x47ef28['exten'];if(_0xed8c22[_0xed2e('0x5')])_0xed8c22['type']=_0xed8c22[_0xed2e('0x5')][_0xed2e('0x34')]();if(_0x47ef28[_0xed2e('0x5')]===_0xed2e('0x14')){if(_0xed8c22[_0xed2e('0x1b')](_0xed2e('0x35'))&&_0xed8c22[_0xed2e('0x35')]&&_0xed8c22[_0xed2e('0x35')]!=='--'){_0x5cda7b['push']({'type':_0xed8c22[_0xed2e('0x5')]['toLowerCase'](),'app':'Set','appdata':_0xed2e('0x36')+_0xed8c22[_0xed2e('0x35')],'context':_0x47ef28['context'],'exten':_0x47ef28['exten'],'priority':_0xed8c22[_0xed2e('0x32')]['length']+_0x273deb+_0x3568b0++,'VoiceExtensionId':_0x47ef28['id']});}_0x5cda7b['push']({'type':_0xed8c22[_0xed2e('0x5')][_0xed2e('0x34')](),'app':_0xed2e('0x37'),'appdata':_0xed2e('0x38')+(_0xed8c22[_0xed2e('0x39')]?_0xed2e('0x3a')+_0xed8c22[_0xed2e('0x39')]+')':_0xed2e('0x3b')),'context':_0x47ef28[_0xed2e('0xd')],'exten':_0x47ef28[_0xed2e('0x8')],'priority':_0xed8c22['intervals']['length']+_0x273deb+_0x3568b0++,'VoiceExtensionId':_0x47ef28['id']});}else{if(_0xed8c22[_0xed2e('0x1b')](_0xed2e('0x3c'))){if([_0xed2e('0x3d'),_0xed2e('0x3e')]['includes'](_0xed8c22[_0xed2e('0x3f')][_0xed2e('0x34')]())&&_0xed8c22['appType']!==_0xed2e('0x40')){if(_0xed8c22[_0xed2e('0x3c')]){_0x5cda7b[_0xed2e('0xf')]({'type':_0xed8c22['type'][_0xed2e('0x34')](),'app':_0xed2e('0x37'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x47ef28[_0xed2e('0xd')],'exten':_0x47ef28[_0xed2e('0x8')],'priority':_0xed8c22['intervals'][_0xed2e('0x25')]+_0x273deb+_0x3568b0++,'VoiceExtensionId':_0x47ef28['id']});_0x5cda7b[_0xed2e('0xf')]({'type':_0xed8c22[_0xed2e('0x5')]['toLowerCase'](),'app':'Set','appdata':_0xed2e('0x41'),'context':_0x47ef28[_0xed2e('0xd')],'exten':_0x47ef28[_0xed2e('0x8')],'priority':_0xed8c22['intervals']['length']+_0x273deb+_0x3568b0++,'VoiceExtensionId':_0x47ef28['id']});}else{_0x5cda7b[_0xed2e('0xf')]({'type':_0xed8c22[_0xed2e('0x5')]['toLowerCase'](),'app':'ExecIf','appdata':_0xed2e('0x42'),'context':_0x47ef28['context'],'exten':_0x47ef28[_0xed2e('0x8')],'priority':_0xed8c22[_0xed2e('0x32')][_0xed2e('0x25')]+_0x273deb+_0x3568b0++,'VoiceExtensionId':_0x47ef28['id']});_0x5cda7b['push']({'type':_0xed8c22[_0xed2e('0x5')]['toLowerCase'](),'app':'Set','appdata':_0xed2e('0x43'),'context':_0x47ef28['context'],'exten':_0x47ef28[_0xed2e('0x8')],'priority':_0xed8c22['intervals']['length']+_0x273deb+_0x3568b0++,'VoiceExtensionId':_0x47ef28['id']});}}}}for(var _0x3d9390=0x0;_0x3d9390<_0xed8c22[_0xed2e('0x32')][_0xed2e('0x25')];_0x3d9390++){var _0x2c055e=_0x273deb+_0xed8c22[_0xed2e('0x32')][_0xed2e('0x25')];var _0x32c74b=_0x3d9390===_0xed8c22[_0xed2e('0x32')][_0xed2e('0x25')]-0x1?_0x273deb+_0x5cda7b[_0xed2e('0x25')]+_0x1aee49[_0xed2e('0x25')]+0x2:_0x273deb+_0x3d9390+0x1;_0x5cda7b['splice'](_0x3d9390,0x0,{'type':_0x47ef28[_0xed2e('0x5')],'app':_0xed2e('0x44'),'appdata':_0xed8c22['intervals'][_0x3d9390]+'?'+_0x47ef28['context']+_0xed2e('0x45')+_0x2c055e+':'+_0x47ef28[_0xed2e('0xd')]+_0xed2e('0x45')+_0x32c74b,'exten':_0x47ef28[_0xed2e('0x8')],'context':_0x47ef28[_0xed2e('0xd')],'priority':_0x273deb+_0x3d9390,'VoiceExtensionId':_0x47ef28['id']});}if(_0x58a482&&_0xed8c22[_0xed2e('0x46')]===_0xed2e('0x47'))_0xed8c22['appdata']=_0x4b3d2d(_0xed8c22[_0xed2e('0x48')]);_0xed8c22[_0xed2e('0x49')]=_0x5cda7b['length']?_[_0xed2e('0x4a')](_0x5cda7b)[_0xed2e('0x49')]+0x1:_0x273deb;_0x309293=_[_0xed2e('0x4b')](_0x309293,_0x5cda7b,[_0xed8c22],_0x1aee49);_0x273deb=_['last'](_0x309293)[_0xed2e('0x49')]+0x1;}return _0x1c17c0(_0x309293);})[_0xed2e('0x4c')](function(_0x294a0b){_0x44e612(_0x294a0b);});});}return _0x1054c1[_0xed2e('0x4d')](_0xed2e('0x4e'),attributes,{'tableName':_0xed2e('0x4f'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x693673,_0x3f47e6){var _0x540e71=this;var _0x36ceac=_0x540e71[_0xed2e('0x5')]==='outbound'?_0x381106(_0x540e71):_0x1d6d86(_0x540e71);return _0xcc8579(_0x540e71,_0x693673,_[_0xed2e('0x4a')](_0x36ceac)[_0xed2e('0x49')]+0x1,_0x3f47e6)[_0xed2e('0x50')](function(_0x1ff560){var _0x173700=_[_0xed2e('0x4b')](_0x36ceac,_0x1ff560);_0x173700[_0xed2e('0xf')]({'type':_0x540e71[_0xed2e('0x5')],'app':_0xed2e('0x51'),'exten':_0x540e71[_0xed2e('0x8')],'context':_0x540e71['context'],'priority':_[_0xed2e('0x4a')](_0x173700)[_0xed2e('0x49')]+0x1,'VoiceExtensionId':_0x540e71['id']});return _0x173700;});}}});}; \ No newline at end of file +var _0xdd32=['util','lodash','./voiceExtension.attributes','exports','models','Set','CDR(type)=','type','context','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','exten','push','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','${EXTEN:','${EXTEN}','CDR(routeid)=','ExecIf','):Goto(','cutdigits','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','XCALLY-MOTION-ANSWER=0','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','trunk','timeout','options','url','split','length','name','param','phone','prefix','join','indexOf','U(xcally-mixmonitor-context)','replace','Interval','findAll','interval','then','*,*,*,*','intervals','IntervalId','filter','toLowerCase','hasOwnProperty','tag','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','answer','queue','playback','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','splice','GotoIfTime',',${EXTEN},','appdata','last','priority','concat','catch','define','VoiceExtension'];(function(_0x311cad,_0xf6f359){var _0xf5a196=function(_0x50b262){while(--_0x50b262){_0x311cad['push'](_0x311cad['shift']());}};_0xf5a196(++_0xf6f359);}(_0xdd32,0xa0));var _0x2dd3=function(_0x3a744a,_0x2db755){_0x3a744a=_0x3a744a-0x0;var _0x2a6462=_0xdd32[_0x3a744a];return _0x2a6462;};'use strict';var util=require(_0x2dd3('0x0'));var _=require(_0x2dd3('0x1'));var attributes=require(_0x2dd3('0x2'));module[_0x2dd3('0x3')]=function(_0x56af27){var _0x5d356d=_0x56af27[_0x2dd3('0x4')];function _0x347a37(_0x529a1f){var _0x37509b=0x2;var _0x51b237=[{'type':_0x529a1f['type'],'app':_0x2dd3('0x5'),'appdata':_0x2dd3('0x6')+_0x529a1f[_0x2dd3('0x7')],'context':_0x529a1f[_0x2dd3('0x8')],'exten':_0x529a1f['exten'],'priority':_0x37509b++,'VoiceExtensionId':_0x529a1f['id']},{'type':_0x529a1f[_0x2dd3('0x7')],'app':_0x529a1f[_0x2dd3('0x9')]?_0x2dd3('0x5'):_0x2dd3('0xa'),'appdata':_0x529a1f['alias']?_0x2dd3('0xb')+_0x529a1f['alias']:_0x2dd3('0xc'),'context':_0x529a1f[_0x2dd3('0x8')],'exten':_0x529a1f[_0x2dd3('0xd')],'priority':_0x37509b++,'VoiceExtensionId':_0x529a1f['id']}];if(_0x529a1f[_0x2dd3('0x7')]==='inbound'){_0x51b237[_0x2dd3('0xe')]({'type':'inbound','app':'Set','appdata':'CDR(routeid)='+_0x529a1f['id'],'context':_0x529a1f[_0x2dd3('0x8')],'exten':_0x529a1f[_0x2dd3('0xd')],'priority':_0x37509b++,'VoiceExtensionId':_0x529a1f['id']});}_0x51b237[_0x2dd3('0xe')]({'type':_0x529a1f[_0x2dd3('0x7')],'app':_0x2dd3('0x5'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x529a1f[_0x2dd3('0x8')],'exten':_0x529a1f['exten'],'priority':_0x37509b++,'VoiceExtensionId':_0x529a1f['id']},{'type':_0x529a1f['type'],'app':_0x2dd3('0x5'),'appdata':_0x2dd3('0xf'),'context':_0x529a1f[_0x2dd3('0x8')],'exten':_0x529a1f['exten'],'priority':_0x37509b++,'VoiceExtensionId':_0x529a1f['id']},{'type':_0x529a1f[_0x2dd3('0x7')],'app':_0x2dd3('0x5'),'appdata':_0x2dd3('0x10'),'context':_0x529a1f[_0x2dd3('0x8')],'exten':_0x529a1f[_0x2dd3('0xd')],'priority':_0x37509b++,'VoiceExtensionId':_0x529a1f['id']});return _0x51b237;}function _0x46aee2(_0x5989bc){var _0x262aaf=0x2;var _0x28a133=[{'type':_0x2dd3('0x11'),'app':'Set','appdata':_0x2dd3('0x12'),'context':_0x5989bc['context'],'exten':_0x5989bc[_0x2dd3('0xd')],'priority':_0x262aaf++,'VoiceExtensionId':_0x5989bc['id']},{'type':_0x2dd3('0x11'),'app':_0x5989bc[_0x2dd3('0x9')]?'Set':_0x2dd3('0xa'),'appdata':_0x5989bc[_0x2dd3('0x9')]?_0x2dd3('0xb')+_0x5989bc['alias']:'No\x20alias\x20set','context':_0x5989bc['context'],'exten':_0x5989bc['exten'],'priority':_0x262aaf++,'VoiceExtensionId':_0x5989bc['id']},{'type':_0x2dd3('0x11'),'app':_0x2dd3('0x5'),'appdata':_0x2dd3('0x13')+(_0x5989bc['cutdigits']?_0x2dd3('0x14')+_0x5989bc['cutdigits']+'}':_0x2dd3('0x15')),'context':_0x5989bc['context'],'exten':_0x5989bc[_0x2dd3('0xd')],'priority':_0x262aaf++,'VoiceExtensionId':_0x5989bc['id']},{'type':_0x2dd3('0x11'),'app':_0x2dd3('0x5'),'appdata':_0x2dd3('0x16')+_0x5989bc['id'],'context':_0x5989bc[_0x2dd3('0x8')],'exten':_0x5989bc[_0x2dd3('0xd')],'priority':_0x262aaf++,'VoiceExtensionId':_0x5989bc['id']},{'type':'outbound','app':_0x2dd3('0x17'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x262aaf+0x2)+_0x2dd3('0x18')+(_0x262aaf+0x1)+')','context':_0x5989bc['context'],'exten':_0x5989bc['exten'],'priority':_0x262aaf++,'VoiceExtensionId':_0x5989bc['id']},{'type':'outbound','app':_0x2dd3('0x5'),'appdata':_0x5989bc[_0x2dd3('0x19')]?_0x2dd3('0x1a')+_0x5989bc[_0x2dd3('0x19')]+'}':_0x2dd3('0x1b'),'context':_0x5989bc[_0x2dd3('0x8')],'exten':_0x5989bc[_0x2dd3('0xd')],'priority':_0x262aaf++,'VoiceExtensionId':_0x5989bc['id']},{'type':_0x2dd3('0x11'),'app':_0x2dd3('0x5'),'appdata':_0x2dd3('0x1c'),'context':_0x5989bc[_0x2dd3('0x8')],'exten':_0x5989bc['exten'],'priority':_0x262aaf++,'VoiceExtensionId':_0x5989bc['id']},{'type':_0x2dd3('0x11'),'app':_0x2dd3('0x5'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x5989bc[_0x2dd3('0x8')],'exten':_0x5989bc[_0x2dd3('0xd')],'priority':_0x262aaf++,'VoiceExtensionId':_0x5989bc['id']},{'type':_0x2dd3('0x11'),'app':_0x2dd3('0x5'),'appdata':_0x2dd3('0x10'),'context':_0x5989bc['context'],'exten':_0x5989bc[_0x2dd3('0xd')],'priority':_0x262aaf++,'VoiceExtensionId':_0x5989bc['id']},{'type':_0x2dd3('0x11'),'app':_0x2dd3('0x5'),'appdata':_0x2dd3('0x1d')+_0x5989bc['id'],'context':_0x5989bc[_0x2dd3('0x8')],'exten':_0x5989bc['exten'],'priority':_0x262aaf++,'VoiceExtensionId':_0x5989bc['id']}];if(_0x5989bc['hasOwnProperty'](_0x2dd3('0x1e'))&&_0x5989bc[_0x2dd3('0x1e')]!==_0x2dd3('0x1f')){_0x28a133[_0x2dd3('0xe')]({'type':_0x2dd3('0x11'),'app':'Set','appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x5989bc[_0x2dd3('0x8')],'exten':_0x5989bc[_0x2dd3('0xd')],'priority':_0x262aaf++,'VoiceExtensionId':_0x5989bc['id']},{'type':_0x2dd3('0x11'),'app':_0x2dd3('0x5'),'appdata':_0x2dd3('0x20')+_0x5989bc[_0x2dd3('0x1e')]||'wav','context':_0x5989bc[_0x2dd3('0x8')],'exten':_0x5989bc[_0x2dd3('0xd')],'priority':_0x262aaf++,'VoiceExtensionId':_0x5989bc['id']});}return _0x28a133;}function _0x3359b5(_0xb9b948){var _0x575471=[{'name':_0x2dd3('0x21'),'param':0x0},{'name':_0x2dd3('0x22'),'param':0x1},{'name':_0x2dd3('0x23'),'param':0x2},{'name':_0x2dd3('0x24'),'param':0x3}];var _0x655409={};var _0x30ad6c=_0xb9b948[_0x2dd3('0x25')](',');var _0x4a34fa=[];for(var _0x5078c9=0x0;_0x5078c9<_0x575471[_0x2dd3('0x26')];_0x5078c9++){switch(_0x575471[_0x5078c9][_0x2dd3('0x27')]){case _0x2dd3('0x21'):_0x655409[_0x2dd3('0x21')]=_0x30ad6c[_0x575471[_0x5078c9][_0x2dd3('0x28')]][_0x2dd3('0x25')]('/')[0x1];_0x655409[_0x2dd3('0x29')]=_0x30ad6c[_0x575471[_0x5078c9]['param']]['split']('/')[0x2];_0x655409['prefix']=_0x655409[_0x2dd3('0x29')]?_0x655409[_0x2dd3('0x29')][_0x2dd3('0x25')]('$')[0x0]:undefined;_0x655409[_0x2dd3('0x29')]=route[_0x2dd3('0x19')]?(_0x655409[_0x2dd3('0x2a')]||'')+_0x2dd3('0x14')+route['cutdigits']+'}':(_0x655409[_0x2dd3('0x2a')]||'')+_0x2dd3('0x15');_0x4a34fa[_0x575471[_0x5078c9]['param']]=['SIP',_0x655409[_0x2dd3('0x21')],_0x655409[_0x2dd3('0x29')]][_0x2dd3('0x2b')]('/');break;case'options':_0x655409[_0x2dd3('0x23')]=_0x30ad6c[_0x575471[_0x5078c9][_0x2dd3('0x28')]];if(route[_0x2dd3('0x1e')]!=='none'){if(_0x655409[_0x2dd3('0x23')][_0x2dd3('0x2c')](_0x2dd3('0x2d'))<0x0){_0x655409[_0x2dd3('0x23')]+=_0x2dd3('0x2d');}}else{_0x655409[_0x2dd3('0x23')]=_0x655409[_0x2dd3('0x23')][_0x2dd3('0x2e')](_0x2dd3('0x2d'),'');}_0x4a34fa[_0x575471[_0x5078c9][_0x2dd3('0x28')]]=_0x655409[_0x2dd3('0x23')];break;default:_0x4a34fa[_0x575471[_0x5078c9][_0x2dd3('0x28')]]=_0x30ad6c[_0x575471[_0x5078c9][_0x2dd3('0x28')]];}}return _0x4a34fa['join'](',');}function _0x1a0311(_0x37e30a,_0x2c1231,_0x37d292,_0x53823b){return new Promise(function(_0x31a4d8,_0x571468){var _0x174e6c=[];if(_['isEmpty'](_0x2c1231))return _0x31a4d8(_0x174e6c);_0x5d356d[_0x2dd3('0x2f')][_0x2dd3('0x30')]({'attributes':['id',_0x2dd3('0x31'),'IntervalId'],'raw':!![]})[_0x2dd3('0x32')](function(_0x5bef58){for(var _0x2a5c8e=0x0,_0x3ce341=0x0;_0x2a5c8e<_0x2c1231[_0x2dd3('0x26')];_0x2a5c8e++,_0x3ce341=0x0){var _0x2f2b13=_0x2c1231[_0x2a5c8e];var _0x6e2dad=[];var _0xfbd187=[];if(_0x2f2b13['interval']!==_0x2dd3('0x33')){_0x2f2b13[_0x2dd3('0x34')]=[_0x2f2b13[_0x2dd3('0x31')]];}else{_0x2f2b13[_0x2dd3('0x34')]=_0x2f2b13[_0x2dd3('0x35')]?_['map'](_[_0x2dd3('0x36')](_0x5bef58,{'IntervalId':_0x2f2b13['IntervalId']}),_0x2dd3('0x31')):[];}_0x2f2b13[_0x2dd3('0x8')]=_0x37e30a[_0x2dd3('0x8')];_0x2f2b13['exten']=_0x37e30a[_0x2dd3('0xd')];if(_0x2f2b13[_0x2dd3('0x7')])_0x2f2b13['type']=_0x2f2b13[_0x2dd3('0x7')][_0x2dd3('0x37')]();if(_0x37e30a[_0x2dd3('0x7')]===_0x2dd3('0x11')){if(_0x2f2b13[_0x2dd3('0x38')](_0x2dd3('0x39'))&&_0x2f2b13[_0x2dd3('0x39')]&&_0x2f2b13[_0x2dd3('0x39')]!=='--'){_0x6e2dad[_0x2dd3('0xe')]({'type':_0x2f2b13[_0x2dd3('0x7')][_0x2dd3('0x37')](),'app':_0x2dd3('0x5'),'appdata':'CDR(tag)='+_0x2f2b13[_0x2dd3('0x39')],'context':_0x37e30a['context'],'exten':_0x37e30a[_0x2dd3('0xd')],'priority':_0x2f2b13[_0x2dd3('0x34')][_0x2dd3('0x26')]+_0x37d292+_0x3ce341++,'VoiceExtensionId':_0x37e30a['id']});}_0x6e2dad[_0x2dd3('0xe')]({'type':_0x2f2b13['type'][_0x2dd3('0x37')](),'app':_0x2dd3('0x17'),'appdata':_0x2dd3('0x3a')+(_0x2f2b13[_0x2dd3('0x3b')]?_0x2dd3('0x3c')+_0x2f2b13[_0x2dd3('0x3b')]+')':'NoOp(No\x20number\x20available)'),'context':_0x37e30a[_0x2dd3('0x8')],'exten':_0x37e30a['exten'],'priority':_0x2f2b13[_0x2dd3('0x34')][_0x2dd3('0x26')]+_0x37d292+_0x3ce341++,'VoiceExtensionId':_0x37e30a['id']});}else{if(_0x2f2b13[_0x2dd3('0x38')](_0x2dd3('0x3d'))){if([_0x2dd3('0x3e'),_0x2dd3('0x3f')][_0x2dd3('0x40')](_0x2f2b13[_0x2dd3('0x41')][_0x2dd3('0x37')]())&&_0x2f2b13[_0x2dd3('0x42')]!==_0x2dd3('0x43')){if(_0x2f2b13[_0x2dd3('0x3d')]){_0x6e2dad['push']({'type':_0x2f2b13[_0x2dd3('0x7')]['toLowerCase'](),'app':'ExecIf','appdata':_0x2dd3('0x44'),'context':_0x37e30a[_0x2dd3('0x8')],'exten':_0x37e30a[_0x2dd3('0xd')],'priority':_0x2f2b13[_0x2dd3('0x34')][_0x2dd3('0x26')]+_0x37d292+_0x3ce341++,'VoiceExtensionId':_0x37e30a['id']});_0x6e2dad[_0x2dd3('0xe')]({'type':_0x2f2b13[_0x2dd3('0x7')][_0x2dd3('0x37')](),'app':_0x2dd3('0x5'),'appdata':_0x2dd3('0x45'),'context':_0x37e30a[_0x2dd3('0x8')],'exten':_0x37e30a['exten'],'priority':_0x2f2b13[_0x2dd3('0x34')]['length']+_0x37d292+_0x3ce341++,'VoiceExtensionId':_0x37e30a['id']});}else{_0x6e2dad['push']({'type':_0x2f2b13[_0x2dd3('0x7')][_0x2dd3('0x37')](),'app':_0x2dd3('0x17'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x37e30a[_0x2dd3('0x8')],'exten':_0x37e30a[_0x2dd3('0xd')],'priority':_0x2f2b13[_0x2dd3('0x34')][_0x2dd3('0x26')]+_0x37d292+_0x3ce341++,'VoiceExtensionId':_0x37e30a['id']});_0x6e2dad[_0x2dd3('0xe')]({'type':_0x2f2b13[_0x2dd3('0x7')][_0x2dd3('0x37')](),'app':_0x2dd3('0x5'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x37e30a[_0x2dd3('0x8')],'exten':_0x37e30a[_0x2dd3('0xd')],'priority':_0x2f2b13[_0x2dd3('0x34')][_0x2dd3('0x26')]+_0x37d292+_0x3ce341++,'VoiceExtensionId':_0x37e30a['id']});}}}}for(var _0x1620ae=0x0;_0x1620ae<_0x2f2b13['intervals']['length'];_0x1620ae++){var _0x107776=_0x37d292+_0x2f2b13['intervals']['length'];var _0x1d8728=_0x1620ae===_0x2f2b13[_0x2dd3('0x34')]['length']-0x1?_0x37d292+_0x6e2dad['length']+_0xfbd187[_0x2dd3('0x26')]+0x2:_0x37d292+_0x1620ae+0x1;_0x6e2dad[_0x2dd3('0x46')](_0x1620ae,0x0,{'type':_0x37e30a['type'],'app':_0x2dd3('0x47'),'appdata':_0x2f2b13['intervals'][_0x1620ae]+'?'+_0x37e30a[_0x2dd3('0x8')]+_0x2dd3('0x48')+_0x107776+':'+_0x37e30a[_0x2dd3('0x8')]+_0x2dd3('0x48')+_0x1d8728,'exten':_0x37e30a[_0x2dd3('0xd')],'context':_0x37e30a[_0x2dd3('0x8')],'priority':_0x37d292+_0x1620ae,'VoiceExtensionId':_0x37e30a['id']});}if(_0x53823b&&_0x2f2b13[_0x2dd3('0x42')]==='outboundDial')_0x2f2b13[_0x2dd3('0x49')]=_0x3359b5(_0x2f2b13[_0x2dd3('0x49')]);_0x2f2b13['priority']=_0x6e2dad[_0x2dd3('0x26')]?_[_0x2dd3('0x4a')](_0x6e2dad)[_0x2dd3('0x4b')]+0x1:_0x37d292;_0x174e6c=_[_0x2dd3('0x4c')](_0x174e6c,_0x6e2dad,[_0x2f2b13],_0xfbd187);_0x37d292=_['last'](_0x174e6c)[_0x2dd3('0x4b')]+0x1;}return _0x31a4d8(_0x174e6c);})[_0x2dd3('0x4d')](function(_0xf6cacf){_0x571468(_0xf6cacf);});});}return _0x56af27[_0x2dd3('0x4e')](_0x2dd3('0x4f'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x8f029a,_0x4e9fdc){var _0x40fc39=this;var _0x2a78b2=_0x40fc39[_0x2dd3('0x7')]===_0x2dd3('0x11')?_0x46aee2(_0x40fc39):_0x347a37(_0x40fc39);return _0x1a0311(_0x40fc39,_0x8f029a,_[_0x2dd3('0x4a')](_0x2a78b2)['priority']+0x1,_0x4e9fdc)[_0x2dd3('0x32')](function(_0x2e8188){var _0xc14384=_['concat'](_0x2a78b2,_0x2e8188);_0xc14384[_0x2dd3('0xe')]({'type':_0x40fc39[_0x2dd3('0x7')],'app':'Hangup','exten':_0x40fc39[_0x2dd3('0xd')],'context':_0x40fc39['context'],'priority':_[_0x2dd3('0x4a')](_0xc14384)[_0x2dd3('0x4b')]+0x1,'VoiceExtensionId':_0x40fc39['id']});return _0xc14384;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 34c87ea..55bb611 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 _0xa23f=['VoiceExtension,\x20%s,\x20%s','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','attributes','limit','include','map','model','then','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','socket.io-emitter','./voiceExtension.socket','register','request','info'];(function(_0x1dee5c,_0x39a692){var _0x172e13=function(_0x278d91){while(--_0x278d91){_0x1dee5c['push'](_0x1dee5c['shift']());}};_0x172e13(++_0x39a692);}(_0xa23f,0x7c));var _0xfa23=function(_0x5c05a8,_0x6d9a4){_0x5c05a8=_0x5c05a8-0x0;var _0x2f7551=_0xa23f[_0x5c05a8];return _0x2f7551;};'use strict';var _=require(_0xfa23('0x0'));var util=require(_0xfa23('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfa23('0x2'));var fs=require('fs');var Redis=require(_0xfa23('0x3'));var db=require(_0xfa23('0x4'))['db'];var utils=require(_0xfa23('0x5'));var logger=require('../../config/logger')(_0xfa23('0x6'));var config=require('../../config/environment');var jayson=require(_0xfa23('0x7'));var client=jayson[_0xfa23('0x8')][_0xfa23('0x9')]({'port':0x232a});config[_0xfa23('0xa')]=_['defaults'](config[_0xfa23('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xfa23('0xb'))(new Redis(config[_0xfa23('0xa')]));require(_0xfa23('0xc'))[_0xfa23('0xd')](socket);function respondWithRpcPromise(_0x798943,_0x539453,_0x4b59d1){return new BPromise(function(_0x20a9b6,_0x4ea7a8){return client[_0xfa23('0xe')](_0x798943,_0x4b59d1)['then'](function(_0x1b99b7){logger[_0xfa23('0xf')](_0xfa23('0x10'),_0x539453,'request\x20sent');logger[_0xfa23('0x11')](_0xfa23('0x12'),_0x539453,_0xfa23('0x13'),JSON['stringify'](_0x1b99b7));if(_0x1b99b7['error']){if(_0x1b99b7[_0xfa23('0x14')][_0xfa23('0x15')]===0x1f4){logger[_0xfa23('0x14')](_0xfa23('0x10'),_0x539453,_0x1b99b7['error'][_0xfa23('0x16')]);return _0x4ea7a8(_0x1b99b7[_0xfa23('0x14')][_0xfa23('0x16')]);}logger[_0xfa23('0x14')]('VoiceExtension,\x20%s,\x20%s',_0x539453,_0x1b99b7[_0xfa23('0x14')][_0xfa23('0x16')]);return _0x20a9b6(_0x1b99b7[_0xfa23('0x14')][_0xfa23('0x16')]);}else{logger[_0xfa23('0xf')]('VoiceExtension,\x20%s,\x20%s',_0x539453,'request\x20sent');_0x20a9b6(_0x1b99b7['result'][_0xfa23('0x16')]);}})[_0xfa23('0x17')](function(_0x4bd0e0){logger[_0xfa23('0x14')](_0xfa23('0x10'),_0x539453,_0x4bd0e0);_0x4ea7a8(_0x4bd0e0);});});}exports[_0xfa23('0x18')]=function(_0x54bb04){var _0x1970ec=this;return new Promise(function(_0x452604,_0x47c323){return db[_0xfa23('0x19')][_0xfa23('0x1a')]({'raw':_0x54bb04[_0xfa23('0x1b')]?_0x54bb04[_0xfa23('0x1b')][_0xfa23('0x1c')]===undefined?!![]:![]:!![],'where':_0x54bb04[_0xfa23('0x1b')]?_0x54bb04[_0xfa23('0x1b')]['where']||null:null,'attributes':_0x54bb04[_0xfa23('0x1b')]?_0x54bb04[_0xfa23('0x1b')][_0xfa23('0x1d')]||null:null,'limit':_0x54bb04[_0xfa23('0x1b')]?_0x54bb04['options'][_0xfa23('0x1e')]||null:null,'include':_0x54bb04['options']?_0x54bb04[_0xfa23('0x1b')][_0xfa23('0x1f')]?_[_0xfa23('0x20')](_0x54bb04[_0xfa23('0x1b')][_0xfa23('0x1f')],function(_0x1340d9){return{'model':db[_0x1340d9[_0xfa23('0x21')]],'as':_0x1340d9['as'],'attributes':_0x1340d9[_0xfa23('0x1d')],'include':_0x1340d9['include']?_[_0xfa23('0x20')](_0x1340d9['include'],function(_0x1ae38a){return{'model':db[_0x1ae38a['model']],'as':_0x1ae38a['as'],'attributes':_0x1ae38a['attributes'],'include':_0x1ae38a[_0xfa23('0x1f')]?_[_0xfa23('0x20')](_0x1ae38a[_0xfa23('0x1f')],function(_0x3b00a8){return{'model':db[_0x3b00a8[_0xfa23('0x21')]],'as':_0x3b00a8['as'],'attributes':_0x3b00a8[_0xfa23('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xfa23('0x22')](function(_0x4c1ab0){logger[_0xfa23('0xf')]('GetVoiceExtension',_0x54bb04);logger[_0xfa23('0x11')](_0xfa23('0x18'),_0x54bb04,JSON['stringify'](_0x4c1ab0));_0x452604(_0x4c1ab0);})[_0xfa23('0x17')](function(_0x3a6966){logger[_0xfa23('0x14')](_0xfa23('0x18'),_0x3a6966[_0xfa23('0x16')],_0x54bb04);_0x47c323(_0x1970ec[_0xfa23('0x14')](0x1f4,_0x3a6966[_0xfa23('0x16')]));});});}; \ No newline at end of file +var _0x0618=['register','then','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','VoiceExtension,\x20%s,\x20%s','message','info','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','where','attributes','limit','map','model','include','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x3597af,_0x10039e){var _0x1e419e=function(_0x82179){while(--_0x82179){_0x3597af['push'](_0x3597af['shift']());}};_0x1e419e(++_0x10039e);}(_0x0618,0x1c6));var _0x8061=function(_0x19cb5a,_0x583fbd){_0x19cb5a=_0x19cb5a-0x0;var _0x9b2f0f=_0x0618[_0x19cb5a];return _0x9b2f0f;};'use strict';var _=require(_0x8061('0x0'));var util=require(_0x8061('0x1'));var moment=require('moment');var BPromise=require(_0x8061('0x2'));var rs=require(_0x8061('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8061('0x4'));var logger=require(_0x8061('0x5'))(_0x8061('0x6'));var config=require(_0x8061('0x7'));var jayson=require(_0x8061('0x8'));var client=jayson[_0x8061('0x9')][_0x8061('0xa')]({'port':0x232a});config[_0x8061('0xb')]=_[_0x8061('0xc')](config[_0x8061('0xb')],{'host':_0x8061('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8061('0xb')]));require('./voiceExtension.socket')[_0x8061('0xe')](socket);function respondWithRpcPromise(_0x16496b,_0x16f817,_0x3a5261){return new BPromise(function(_0x366a4e,_0x588bb3){return client['request'](_0x16496b,_0x3a5261)[_0x8061('0xf')](function(_0x3707bd){logger['info']('VoiceExtension,\x20%s,\x20%s',_0x16f817,_0x8061('0x10'));logger[_0x8061('0x11')](_0x8061('0x12'),_0x16f817,_0x8061('0x10'),JSON[_0x8061('0x13')](_0x3707bd));if(_0x3707bd[_0x8061('0x14')]){if(_0x3707bd['error']['code']===0x1f4){logger[_0x8061('0x14')](_0x8061('0x15'),_0x16f817,_0x3707bd[_0x8061('0x14')][_0x8061('0x16')]);return _0x588bb3(_0x3707bd['error']['message']);}logger[_0x8061('0x14')](_0x8061('0x15'),_0x16f817,_0x3707bd[_0x8061('0x14')][_0x8061('0x16')]);return _0x366a4e(_0x3707bd[_0x8061('0x14')][_0x8061('0x16')]);}else{logger[_0x8061('0x17')](_0x8061('0x15'),_0x16f817,_0x8061('0x10'));_0x366a4e(_0x3707bd[_0x8061('0x18')][_0x8061('0x16')]);}})[_0x8061('0x19')](function(_0x1ea27d){logger['error']('VoiceExtension,\x20%s,\x20%s',_0x16f817,_0x1ea27d);_0x588bb3(_0x1ea27d);});});}exports[_0x8061('0x1a')]=function(_0x310c1c){var _0x2d8025=this;return new Promise(function(_0x4b3fbf,_0x53f869){return db[_0x8061('0x1b')][_0x8061('0x1c')]({'raw':_0x310c1c[_0x8061('0x1d')]?_0x310c1c[_0x8061('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x310c1c['options']?_0x310c1c[_0x8061('0x1d')][_0x8061('0x1e')]||null:null,'attributes':_0x310c1c['options']?_0x310c1c['options'][_0x8061('0x1f')]||null:null,'limit':_0x310c1c['options']?_0x310c1c['options'][_0x8061('0x20')]||null:null,'include':_0x310c1c[_0x8061('0x1d')]?_0x310c1c['options']['include']?_[_0x8061('0x21')](_0x310c1c[_0x8061('0x1d')]['include'],function(_0x1b0ec7){return{'model':db[_0x1b0ec7[_0x8061('0x22')]],'as':_0x1b0ec7['as'],'attributes':_0x1b0ec7[_0x8061('0x1f')],'include':_0x1b0ec7[_0x8061('0x23')]?_['map'](_0x1b0ec7['include'],function(_0x1563a1){return{'model':db[_0x1563a1[_0x8061('0x22')]],'as':_0x1563a1['as'],'attributes':_0x1563a1[_0x8061('0x1f')],'include':_0x1563a1[_0x8061('0x23')]?_[_0x8061('0x21')](_0x1563a1['include'],function(_0x4c9202){return{'model':db[_0x4c9202['model']],'as':_0x4c9202['as'],'attributes':_0x4c9202['attributes']};}):[]};}):[]};}):[]:[]})[_0x8061('0xf')](function(_0x38317c){logger[_0x8061('0x17')](_0x8061('0x1a'),_0x310c1c);logger[_0x8061('0x11')](_0x8061('0x1a'),_0x310c1c,JSON[_0x8061('0x13')](_0x38317c));_0x4b3fbf(_0x38317c);})[_0x8061('0x19')](function(_0x42d5a7){logger[_0x8061('0x14')]('GetVoiceExtension',_0x42d5a7['message'],_0x310c1c);_0x53f869(_0x2d8025[_0x8061('0x14')](0x1f4,_0x42d5a7[_0x8061('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index fa4cea3..5c1a642 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 _0x53ec=['length','voiceExtension:','./voiceExtension.events','save','remove','update','emit','removeListener'];(function(_0x1fe9cd,_0x21562c){var _0x3780af=function(_0x496277){while(--_0x496277){_0x1fe9cd['push'](_0x1fe9cd['shift']());}};_0x3780af(++_0x21562c);}(_0x53ec,0x192));var _0xc53e=function(_0x29f31c,_0x46bbdf){_0x29f31c=_0x29f31c-0x0;var _0x3b6b8a=_0x53ec[_0x29f31c];return _0x3b6b8a;};'use strict';var VoiceExtensionEvents=require(_0xc53e('0x0'));var events=[_0xc53e('0x1'),_0xc53e('0x2'),_0xc53e('0x3')];function createListener(_0x1b04cc,_0xe45c6d){return function(_0x51c435){_0xe45c6d[_0xc53e('0x4')](_0x1b04cc,_0x51c435);};}function removeListener(_0x4e954a,_0x2b90f6){return function(){VoiceExtensionEvents[_0xc53e('0x5')](_0x4e954a,_0x2b90f6);};}exports['register']=function(_0x2f1414){for(var _0x4f989b=0x0,_0x41a9e8=events[_0xc53e('0x6')];_0x4f989b<_0x41a9e8;_0x4f989b++){var _0x5d3b28=events[_0x4f989b];var _0x1616ac=createListener(_0xc53e('0x7')+_0x5d3b28,_0x2f1414);VoiceExtensionEvents['on'](_0x5d3b28,_0x1616ac);}}; \ No newline at end of file +var _0x814b=['removeListener','register','length','voiceExtension:','./voiceExtension.events','save','remove','update','emit'];(function(_0x4664db,_0x1de672){var _0x5615b4=function(_0x54fb5a){while(--_0x54fb5a){_0x4664db['push'](_0x4664db['shift']());}};_0x5615b4(++_0x1de672);}(_0x814b,0x1a2));var _0xb814=function(_0xfb02c9,_0x43c274){_0xfb02c9=_0xfb02c9-0x0;var _0x9afb71=_0x814b[_0xfb02c9];return _0x9afb71;};'use strict';var VoiceExtensionEvents=require(_0xb814('0x0'));var events=[_0xb814('0x1'),_0xb814('0x2'),_0xb814('0x3')];function createListener(_0xfbb64b,_0x477725){return function(_0x4a98af){_0x477725[_0xb814('0x4')](_0xfbb64b,_0x4a98af);};}function removeListener(_0x3e1e9,_0x258866){return function(){VoiceExtensionEvents[_0xb814('0x5')](_0x3e1e9,_0x258866);};}exports[_0xb814('0x6')]=function(_0x322a70){for(var _0x53e507=0x0,_0x3b0829=events[_0xb814('0x7')];_0x53e507<_0x3b0829;_0x53e507++){var _0x5c8539=events[_0x53e507];var _0x271af9=createListener(_0xb814('0x8')+_0x5c8539,_0x322a70);VoiceExtensionEvents['on'](_0x5c8539,_0x271af9);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index ce61b77..41ecac2 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 _0x32f4=['multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','/:id','getMessages','post','create','update','exports'];(function(_0x4da7d4,_0x1c7e7a){var _0x1e1e2e=function(_0x4387f3){while(--_0x4387f3){_0x4da7d4['push'](_0x4da7d4['shift']());}};_0x1e1e2e(++_0x1c7e7a);}(_0x32f4,0x154));var _0x432f=function(_0x268ed2,_0x48d285){_0x268ed2=_0x268ed2-0x0;var _0x3a6b83=_0x32f4[_0x268ed2];return _0x3a6b83;};'use strict';var multer=require(_0x432f('0x0'));var util=require(_0x432f('0x1'));var path=require(_0x432f('0x2'));var timeout=require(_0x432f('0x3'));var express=require('express');var router=express[_0x432f('0x4')]();var fs_extra=require(_0x432f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x432f('0x6'));var config=require(_0x432f('0x7'));var controller=require(_0x432f('0x8'));router[_0x432f('0x9')]('/',auth[_0x432f('0xa')](),controller['index']);router['get'](_0x432f('0xb'),auth[_0x432f('0xa')](),controller['show']);router[_0x432f('0x9')]('/:id/messages',auth[_0x432f('0xa')](),controller[_0x432f('0xc')]);router[_0x432f('0xd')]('/',auth[_0x432f('0xa')](),controller[_0x432f('0xe')]);router['put'](_0x432f('0xb'),auth['isAuthenticated'](),controller[_0x432f('0xf')]);router['delete'](_0x432f('0xb'),auth[_0x432f('0xa')](),controller['destroy']);module[_0x432f('0x10')]=router; \ No newline at end of file +var _0xeda8=['show','/:id/messages','create','put','/:id','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index'];(function(_0x3b8d74,_0x451c62){var _0x5bdbb6=function(_0x4322c5){while(--_0x4322c5){_0x3b8d74['push'](_0x3b8d74['shift']());}};_0x5bdbb6(++_0x451c62);}(_0xeda8,0x104));var _0x8eda=function(_0x4e4bea,_0xaa55c6){_0x4e4bea=_0x4e4bea-0x0;var _0xfcfd8f=_0xeda8[_0x4e4bea];return _0xfcfd8f;};'use strict';var multer=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var path=require('path');var timeout=require(_0x8eda('0x2'));var express=require(_0x8eda('0x3'));var router=express[_0x8eda('0x4')]();var fs_extra=require(_0x8eda('0x5'));var auth=require(_0x8eda('0x6'));var interaction=require(_0x8eda('0x7'));var config=require(_0x8eda('0x8'));var controller=require(_0x8eda('0x9'));router[_0x8eda('0xa')]('/',auth[_0x8eda('0xb')](),controller[_0x8eda('0xc')]);router[_0x8eda('0xa')]('/:id',auth[_0x8eda('0xb')](),controller[_0x8eda('0xd')]);router[_0x8eda('0xa')](_0x8eda('0xe'),auth['isAuthenticated'](),controller['getMessages']);router['post']('/',auth['isAuthenticated'](),controller[_0x8eda('0xf')]);router[_0x8eda('0x10')](_0x8eda('0x11'),auth['isAuthenticated'](),controller[_0x8eda('0x12')]);router['delete'](_0x8eda('0x11'),auth[_0x8eda('0xb')](),controller[_0x8eda('0x13')]);module[_0x8eda('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 bb476d5..25c8584 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 _0xeff9=['ENUM','yes','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','STRING','from-voicemail','contest_mailbox','trim','central'];(function(_0x1d34ba,_0x2762d0){var _0x379c90=function(_0x4cdfee){while(--_0x4cdfee){_0x1d34ba['push'](_0x1d34ba['shift']());}};_0x379c90(++_0x2762d0);}(_0xeff9,0x1b5));var _0x9eff=function(_0x315429,_0x549e5b){_0x315429=_0x315429-0x0;var _0x37fe6b=_0xeff9[_0x315429];return _0x37fe6b;};'use strict';var Sequelize=require('sequelize');module['exports']={'customer_id':{'type':Sequelize[_0x9eff('0x0')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0x9eff('0x1'),'unique':_0x9eff('0x2')},'mailbox':{'type':Sequelize[_0x9eff('0x0')],'defaultValue':'','allowNull':![],'unique':_0x9eff('0x2')},'password':{'type':Sequelize[_0x9eff('0x0')]},'fullname':{'type':Sequelize[_0x9eff('0x0')]},'email':{'type':Sequelize[_0x9eff('0x0')],'validate':{'isEmail':!![]},'set':function(_0x236041){this['setDataValue']('email',typeof _0x236041==='string'&&_0x236041[_0x9eff('0x3')]()?_0x236041[_0x9eff('0x3')]():null);}},'pager':{'type':Sequelize[_0x9eff('0x0')]},'tz':{'type':Sequelize[_0x9eff('0x0')],'defaultValue':_0x9eff('0x4')},'attach':{'type':Sequelize[_0x9eff('0x5')](_0x9eff('0x6'),'no'),'defaultValue':_0x9eff('0x6'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x9eff('0x6'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x9eff('0x5')](_0x9eff('0x6'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x9eff('0x5')](_0x9eff('0x6'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x9eff('0x5')](_0x9eff('0x6'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x9eff('0x5')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0x9eff('0x6'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x9eff('0x5')](_0x9eff('0x6'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x9eff('0x5')](_0x9eff('0x6'),'no'),'defaultValue':_0x9eff('0x6'),'allowNull':![]},'forcename':{'type':Sequelize[_0x9eff('0x5')](_0x9eff('0x6'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x9eff('0x5')](_0x9eff('0x6'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x9eff('0x5')](_0x9eff('0x6'),'no'),'defaultValue':_0x9eff('0x6'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x9eff('0x0')]},'emailbody':{'type':Sequelize[_0x9eff('0x0')]},'maxsecs':{'type':Sequelize[_0x9eff('0x7')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x9eff('0x7')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x9eff('0x8')],'get':function(){return this[_0x9eff('0x9')](_0x9eff('0xa'))+_0x9eff('0xb')+this['getDataValue'](_0x9eff('0xc'));}}}; \ No newline at end of file +var _0x1e4a=['TIMESTAMP','INTEGER','VIRTUAL','getDataValue','mailbox','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','central','yes','ENUM','TINYINT(4)'];(function(_0x184749,_0x23fe56){var _0x552565=function(_0x3a836a){while(--_0x3a836a){_0x184749['push'](_0x184749['shift']());}};_0x552565(++_0x23fe56);}(_0x1e4a,0x126));var _0xa1e4=function(_0x2e8e5b,_0xc04c50){_0x2e8e5b=_0x2e8e5b-0x0;var _0x3e97c2=_0x1e4a[_0x2e8e5b];return _0x3e97c2;};'use strict';var Sequelize=require('sequelize');module[_0xa1e4('0x0')]={'customer_id':{'type':Sequelize[_0xa1e4('0x1')]},'context':{'type':Sequelize[_0xa1e4('0x1')],'defaultValue':_0xa1e4('0x2'),'unique':_0xa1e4('0x3')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0xa1e4('0x1')]},'fullname':{'type':Sequelize[_0xa1e4('0x1')]},'email':{'type':Sequelize[_0xa1e4('0x1')],'validate':{'isEmail':!![]},'set':function(_0x18bbe7){this[_0xa1e4('0x4')](_0xa1e4('0x5'),typeof _0x18bbe7===_0xa1e4('0x6')&&_0x18bbe7[_0xa1e4('0x7')]()?_0x18bbe7['trim']():null);}},'pager':{'type':Sequelize[_0xa1e4('0x1')]},'tz':{'type':Sequelize[_0xa1e4('0x1')],'defaultValue':_0xa1e4('0x8')},'attach':{'type':Sequelize['ENUM'](_0xa1e4('0x9'),'no'),'defaultValue':_0xa1e4('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0xa1e4('0xa')](_0xa1e4('0x9'),'no'),'defaultValue':_0xa1e4('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0xa1e4('0x1')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize['ENUM'](_0xa1e4('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xa1e4('0xa')](_0xa1e4('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xa1e4('0xa')](_0xa1e4('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xa1e4('0xa')](_0xa1e4('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xa1e4('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xa1e4('0xa')](_0xa1e4('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xa1e4('0xa')](_0xa1e4('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0xa1e4('0x9'),'no'),'defaultValue':_0xa1e4('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0xa1e4('0xa')](_0xa1e4('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xa1e4('0xa')]('yes','no'),'defaultValue':_0xa1e4('0x9'),'allowNull':![]},'stamp':{'type':_0xa1e4('0xc')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0xa1e4('0x1')]},'maxsecs':{'type':Sequelize[_0xa1e4('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xa1e4('0xd')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xa1e4('0xe')],'get':function(){return this[_0xa1e4('0xf')]('fullname')+'\x20-\x20'+this['getDataValue'](_0xa1e4('0x10'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 68251e3..2459ba2 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 _0x0bb5=['error','stack','name','send','index','map','VoiceMail','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','VoiceMailMessage','hasOwnProperty','mailbox','findAndCountAll','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','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','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','get','Voicemails'];(function(_0x3b5c38,_0x2c7022){var _0x442ebd=function(_0x738ed7){while(--_0x738ed7){_0x3b5c38['push'](_0x3b5c38['shift']());}};_0x442ebd(++_0x2c7022);}(_0x0bb5,0x148));var _0x50bb=function(_0x2fc0ef,_0xc8feb6){_0x2fc0ef=_0x2fc0ef-0x0;var _0x44c609=_0x0bb5[_0x2fc0ef];return _0x44c609;};'use strict';var emlformat=require(_0x50bb('0x0'));var rimraf=require(_0x50bb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x50bb('0x2'));var moment=require(_0x50bb('0x3'));var BPromise=require(_0x50bb('0x4'));var Mustache=require(_0x50bb('0x5'));var util=require(_0x50bb('0x6'));var path=require(_0x50bb('0x7'));var sox=require(_0x50bb('0x8'));var csv=require(_0x50bb('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x50bb('0xa'));var squel=require(_0x50bb('0xb'));var crypto=require(_0x50bb('0xc'));var jsforce=require(_0x50bb('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x50bb('0xe'));var Papa=require(_0x50bb('0xf'));var Redis=require(_0x50bb('0x10'));var authService=require(_0x50bb('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x50bb('0x12'));var hardwareService=require(_0x50bb('0x13'));var logger=require(_0x50bb('0x14'))(_0x50bb('0x15'));var utils=require(_0x50bb('0x16'));var config=require(_0x50bb('0x17'));var licenseUtil=require(_0x50bb('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x226370,_0x58837d){_0x58837d=_0x58837d||0xcc;return function(_0x283f04){if(_0x283f04){return _0x226370[_0x50bb('0x19')](_0x58837d);}return _0x226370[_0x50bb('0x1a')](_0x58837d)['end']();};}function respondWithResult(_0x17007f,_0x309986){_0x309986=_0x309986||0xc8;return function(_0x3094f2){if(_0x3094f2){return _0x17007f['status'](_0x309986)[_0x50bb('0x1b')](_0x3094f2);}};}function respondWithFilteredResult(_0x5e8478,_0x21befa){return function(_0x3e1a51){if(_0x3e1a51){var _0x253073=typeof _0x21befa[_0x50bb('0x1c')]===_0x50bb('0x1d')&&typeof _0x21befa['limit']===_0x50bb('0x1d');var _0x174065=_0x3e1a51['count'];var _0x24ba19=_0x253073?0x0:_0x21befa['offset'];var _0x301f61=_0x253073?_0x3e1a51[_0x50bb('0x1e')]:_0x21befa['offset']+_0x21befa['limit'];var _0x43465b;if(_0x301f61>=_0x174065){_0x301f61=_0x174065;_0x43465b=0xc8;}else{_0x43465b=0xce;}_0x5e8478[_0x50bb('0x1a')](_0x43465b);return _0x5e8478[_0x50bb('0x1f')](_0x50bb('0x20'),_0x24ba19+'-'+_0x301f61+'/'+_0x174065)['json'](_0x3e1a51);}return null;};}function patchUpdates(_0x19dc5d){return function(_0x32bfc3){try{jsonpatch[_0x50bb('0x21')](_0x32bfc3,_0x19dc5d,!![]);}catch(_0x597e95){return BPromise[_0x50bb('0x22')](_0x597e95);}return _0x32bfc3[_0x50bb('0x23')]();};}function saveUpdates(_0x1344ec,_0x4825f8){return function(_0x1dbba2){if(_0x1dbba2){return _0x1dbba2['update'](_0x1344ec)[_0x50bb('0x24')](function(_0x3391da){return _0x3391da;});}return null;};}function removeEntity(_0x1a2a0b,_0x2ee87a){return function(_0x846311){if(_0x846311){return _0x846311[_0x50bb('0x25')]()['then'](function(){var _0xad17ac=_0x846311[_0x50bb('0x26')]({'plain':!![]});var _0x284a76=_0x50bb('0x27');return db['UserProfileResource'][_0x50bb('0x25')]({'where':{'type':_0x284a76,'resourceId':_0xad17ac['id']}})['then'](function(){return _0x846311;});})['then'](function(){_0x1a2a0b[_0x50bb('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5cfe4b,_0x41fd89){return function(_0x12ee2c){if(!_0x12ee2c){_0x5cfe4b[_0x50bb('0x19')](0x194);}return _0x12ee2c;};}function handleError(_0x1b74f9,_0x17c158){_0x17c158=_0x17c158||0x1f4;return function(_0x269479){logger[_0x50bb('0x28')](_0x269479[_0x50bb('0x29')]);if(_0x269479['name']){delete _0x269479[_0x50bb('0x2a')];}_0x1b74f9[_0x50bb('0x1a')](_0x17c158)[_0x50bb('0x2b')](_0x269479);};}exports[_0x50bb('0x2c')]=function(_0x560b07,_0x13dc3c){var _0x1a62fb={},_0xc38da5={},_0xb3c3ba={'count':0x0,'rows':[]};var _0x3fd5f6=_[_0x50bb('0x2d')](db[_0x50bb('0x2e')][_0x50bb('0x2f')],function(_0x5cfdd5){return{'name':_0x5cfdd5[_0x50bb('0x30')],'type':_0x5cfdd5[_0x50bb('0x31')][_0x50bb('0x32')]};});_0xc38da5['model']=_[_0x50bb('0x2d')](_0x3fd5f6,_0x50bb('0x2a'));_0xc38da5[_0x50bb('0x33')]=_[_0x50bb('0x34')](_0x560b07[_0x50bb('0x33')]);_0xc38da5[_0x50bb('0x35')]=_[_0x50bb('0x36')](_0xc38da5[_0x50bb('0x37')],_0xc38da5[_0x50bb('0x33')]);_0x1a62fb[_0x50bb('0x38')]=_[_0x50bb('0x36')](_0xc38da5['model'],qs[_0x50bb('0x39')](_0x560b07[_0x50bb('0x33')][_0x50bb('0x39')]));_0x1a62fb[_0x50bb('0x38')]=_0x1a62fb[_0x50bb('0x38')][_0x50bb('0x3a')]?_0x1a62fb['attributes']:_0xc38da5['model'];if(!_0x560b07[_0x50bb('0x33')]['hasOwnProperty'](_0x50bb('0x3b'))){_0x1a62fb[_0x50bb('0x3c')]=qs[_0x50bb('0x3c')](_0x560b07[_0x50bb('0x33')][_0x50bb('0x3c')]);_0x1a62fb['offset']=qs[_0x50bb('0x1c')](_0x560b07['query'][_0x50bb('0x1c')]);}_0x1a62fb[_0x50bb('0x3d')]=qs[_0x50bb('0x3e')](_0x560b07['query']['sort']);_0x1a62fb[_0x50bb('0x3f')]=qs[_0x50bb('0x35')](_[_0x50bb('0x40')](_0x560b07[_0x50bb('0x33')],_0xc38da5['filters']),_0x3fd5f6);if(_0x560b07[_0x50bb('0x33')]['filter']){_0x1a62fb['where']=_[_0x50bb('0x41')](_0x1a62fb['where'],{'$or':_[_0x50bb('0x2d')](_0x3fd5f6,function(_0x3d94b8){if(_0x3d94b8[_0x50bb('0x31')]!==_0x50bb('0x42')){var _0x3a9fe4={};_0x3a9fe4[_0x3d94b8[_0x50bb('0x2a')]]={'$like':'%'+_0x560b07[_0x50bb('0x33')][_0x50bb('0x43')]+'%'};return _0x3a9fe4;}})});}_0x1a62fb=_[_0x50bb('0x41')]({},_0x1a62fb,_0x560b07[_0x50bb('0x44')]);var _0x594f16={'where':_0x1a62fb['where']};return db[_0x50bb('0x2e')][_0x50bb('0x1e')](_0x594f16)[_0x50bb('0x24')](function(_0x1d929d){_0xb3c3ba['count']=_0x1d929d;if(_0x560b07[_0x50bb('0x33')]['includeAll']){_0x1a62fb[_0x50bb('0x45')]=[{'all':!![]}];}return db[_0x50bb('0x2e')][_0x50bb('0x46')](_0x1a62fb);})[_0x50bb('0x24')](function(_0x1c438b){_0xb3c3ba[_0x50bb('0x47')]=_0x1c438b;return _0xb3c3ba;})[_0x50bb('0x24')](respondWithFilteredResult(_0x13dc3c,_0x1a62fb))[_0x50bb('0x48')](handleError(_0x13dc3c,null));};exports[_0x50bb('0x49')]=function(_0x46c1c3,_0x349474){var _0x24e375={'raw':!![],'where':{'id':_0x46c1c3[_0x50bb('0x4a')]['id']}},_0x85b0ff={};_0x85b0ff[_0x50bb('0x37')]=_[_0x50bb('0x34')](db['VoiceMail'][_0x50bb('0x2f')]);_0x85b0ff['query']=_[_0x50bb('0x34')](_0x46c1c3[_0x50bb('0x33')]);_0x85b0ff[_0x50bb('0x35')]=_[_0x50bb('0x36')](_0x85b0ff[_0x50bb('0x37')],_0x85b0ff[_0x50bb('0x33')]);_0x24e375[_0x50bb('0x38')]=_[_0x50bb('0x36')](_0x85b0ff[_0x50bb('0x37')],qs[_0x50bb('0x39')](_0x46c1c3[_0x50bb('0x33')][_0x50bb('0x39')]));_0x24e375[_0x50bb('0x38')]=_0x24e375[_0x50bb('0x38')]['length']?_0x24e375[_0x50bb('0x38')]:_0x85b0ff['model'];if(_0x46c1c3[_0x50bb('0x33')][_0x50bb('0x4b')]){_0x24e375[_0x50bb('0x45')]=[{'all':!![]}];}_0x24e375=_[_0x50bb('0x41')]({},_0x24e375,_0x46c1c3[_0x50bb('0x44')]);return db[_0x50bb('0x2e')][_0x50bb('0x4c')](_0x24e375)[_0x50bb('0x24')](handleEntityNotFound(_0x349474,null))['then'](respondWithResult(_0x349474,null))[_0x50bb('0x48')](handleError(_0x349474,null));};exports[_0x50bb('0x4d')]=function(_0xf52a22,_0x13afe2){return db[_0x50bb('0x2e')]['create'](_0xf52a22[_0x50bb('0x4e')],{})[_0x50bb('0x24')](function(_0x2a411d){var _0x154ff8=_0xf52a22[_0x50bb('0x4f')]['get']({'plain':!![]});if(!_0x154ff8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x154ff8[_0x50bb('0x50')]==='user'){var _0x357d08=_0x2a411d['get']({'plain':!![]});var _0x4316e4=_0x50bb('0x27');return db[_0x50bb('0x51')]['find']({'where':{'name':_0x4316e4,'userProfileId':_0x154ff8[_0x50bb('0x52')]},'raw':!![]})[_0x50bb('0x24')](function(_0x588dfe){if(_0x588dfe&&_0x588dfe[_0x50bb('0x53')]===0x0){return db[_0x50bb('0x54')][_0x50bb('0x4d')]({'name':_0x357d08[_0x50bb('0x2a')],'resourceId':_0x357d08['id'],'type':_0x588dfe['name'],'sectionId':_0x588dfe['id']},{})[_0x50bb('0x24')](function(){return _0x2a411d;});}else{return _0x2a411d;}})[_0x50bb('0x48')](function(_0x2e0032){logger[_0x50bb('0x28')](_0x50bb('0x55'),_0x2e0032);throw _0x2e0032;});}return _0x2a411d;})['then'](respondWithResult(_0x13afe2,0xc9))[_0x50bb('0x48')](handleError(_0x13afe2,null));};exports['update']=function(_0x38a775,_0x50216f){if(_0x38a775['body']['id']){delete _0x38a775[_0x50bb('0x4e')]['id'];}return db['VoiceMail']['find']({'where':{'id':_0x38a775[_0x50bb('0x4a')]['id']}})[_0x50bb('0x24')](handleEntityNotFound(_0x50216f,null))[_0x50bb('0x24')](saveUpdates(_0x38a775[_0x50bb('0x4e')],null))[_0x50bb('0x24')](respondWithResult(_0x50216f,null))[_0x50bb('0x48')](handleError(_0x50216f,null));};exports[_0x50bb('0x25')]=function(_0x1408fa,_0x57d749){return db['VoiceMail'][_0x50bb('0x4c')]({'where':{'id':_0x1408fa[_0x50bb('0x4a')]['id']}})[_0x50bb('0x24')](handleEntityNotFound(_0x57d749,null))[_0x50bb('0x24')](removeEntity(_0x57d749,null))[_0x50bb('0x48')](handleError(_0x57d749,null));};exports[_0x50bb('0x56')]=function(_0x287bc7,_0x4bf426,_0x3be83b){return db[_0x50bb('0x2e')][_0x50bb('0x57')]({'where':{'id':_0x287bc7[_0x50bb('0x4a')]['id']}})[_0x50bb('0x24')](handleEntityNotFound(_0x4bf426,null))['then'](function(_0x33ebe6){var _0x1d8b85;var _0x1da5cd={},_0x507f26={};_0x507f26[_0x50bb('0x37')]=_['keys'](db[_0x50bb('0x58')]['rawAttributes']);_0x507f26['query']=_[_0x50bb('0x34')](_0x287bc7[_0x50bb('0x33')]);_0x507f26[_0x50bb('0x35')]=_[_0x50bb('0x36')](_0x507f26[_0x50bb('0x37')],_0x507f26[_0x50bb('0x33')]);_0x1da5cd[_0x50bb('0x38')]=_[_0x50bb('0x36')](_0x507f26[_0x50bb('0x37')],qs[_0x50bb('0x39')](_0x287bc7[_0x50bb('0x33')]['fields']));_0x1da5cd[_0x50bb('0x38')]=_0x1da5cd['attributes'][_0x50bb('0x3a')]?_0x1da5cd[_0x50bb('0x38')]:_0x507f26['model'];if(!_0x287bc7[_0x50bb('0x33')][_0x50bb('0x59')](_0x50bb('0x3b'))){_0x1da5cd[_0x50bb('0x3c')]=qs[_0x50bb('0x3c')](_0x287bc7[_0x50bb('0x33')][_0x50bb('0x3c')]);_0x1da5cd[_0x50bb('0x1c')]=qs['offset'](_0x287bc7[_0x50bb('0x33')][_0x50bb('0x1c')]);}_0x1da5cd[_0x50bb('0x3d')]=qs['sort'](_0x287bc7[_0x50bb('0x33')][_0x50bb('0x3e')]);_0x1da5cd[_0x50bb('0x3f')]=qs[_0x50bb('0x35')](_[_0x50bb('0x40')](_0x287bc7[_0x50bb('0x33')],_0x507f26['filters']));if(_0x287bc7[_0x50bb('0x33')][_0x50bb('0x43')]){_0x1da5cd[_0x50bb('0x3f')]=_[_0x50bb('0x41')](_0x1da5cd[_0x50bb('0x3f')],{'$or':_[_0x50bb('0x2d')](_0x1da5cd['attributes'],function(_0x40257b){var _0xa85833={};_0xa85833[_0x40257b]={'$like':'%'+_0x287bc7[_0x50bb('0x33')][_0x50bb('0x43')]+'%'};return _0xa85833;})});}_0x1da5cd[_0x50bb('0x3f')]=_[_0x50bb('0x41')](_0x1da5cd[_0x50bb('0x3f')],{'mailboxuser':_0x33ebe6[_0x50bb('0x5a')]});_0x1da5cd=_[_0x50bb('0x41')]({},_0x1da5cd,_0x287bc7['options']);return db[_0x50bb('0x58')][_0x50bb('0x5b')](_0x1da5cd)[_0x50bb('0x24')](respondWithFilteredResult(_0x4bf426,_0x1da5cd));})[_0x50bb('0x48')](handleError(_0x4bf426,null));}; \ No newline at end of file +var _0xd4f4=['get','Voicemails','then','stack','name','send','index','map','VoiceMail','rawAttributes','fieldName','key','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','VoiceMailMessage','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy'];(function(_0x22c13b,_0x26a0a0){var _0x3894c1=function(_0x12b7fb){while(--_0x12b7fb){_0x22c13b['push'](_0x22c13b['shift']());}};_0x3894c1(++_0x26a0a0);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x1020a9,_0x2a66ab){_0x1020a9=_0x1020a9-0x0;var _0x2ce8a3=_0xd4f4[_0x1020a9];return _0x2ce8a3;};'use strict';var emlformat=require(_0x4d4f('0x0'));var rimraf=require(_0x4d4f('0x1'));var zipdir=require(_0x4d4f('0x2'));var jsonpatch=require(_0x4d4f('0x3'));var rp=require(_0x4d4f('0x4'));var moment=require(_0x4d4f('0x5'));var BPromise=require(_0x4d4f('0x6'));var Mustache=require(_0x4d4f('0x7'));var util=require(_0x4d4f('0x8'));var path=require(_0x4d4f('0x9'));var sox=require(_0x4d4f('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4d4f('0xb'));var squel=require(_0x4d4f('0xc'));var crypto=require(_0x4d4f('0xd'));var jsforce=require(_0x4d4f('0xe'));var deskjs=require(_0x4d4f('0xf'));var toCsv=require(_0x4d4f('0x10'));var querystring=require(_0x4d4f('0x11'));var Papa=require(_0x4d4f('0x12'));var Redis=require(_0x4d4f('0x13'));var authService=require(_0x4d4f('0x14'));var qs=require(_0x4d4f('0x15'));var as=require(_0x4d4f('0x16'));var hardwareService=require(_0x4d4f('0x17'));var logger=require(_0x4d4f('0x18'))(_0x4d4f('0x19'));var utils=require(_0x4d4f('0x1a'));var config=require(_0x4d4f('0x1b'));var licenseUtil=require(_0x4d4f('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x551a10,_0x5b4f4e){_0x5b4f4e=_0x5b4f4e||0xcc;return function(_0x15fe6a){if(_0x15fe6a){return _0x551a10[_0x4d4f('0x1d')](_0x5b4f4e);}return _0x551a10['status'](_0x5b4f4e)[_0x4d4f('0x1e')]();};}function respondWithResult(_0x301380,_0x1878b6){_0x1878b6=_0x1878b6||0xc8;return function(_0x59252c){if(_0x59252c){return _0x301380[_0x4d4f('0x1f')](_0x1878b6)[_0x4d4f('0x20')](_0x59252c);}};}function respondWithFilteredResult(_0x1a9173,_0x4a3364){return function(_0x59bfb5){if(_0x59bfb5){var _0x5e4ff5=typeof _0x4a3364[_0x4d4f('0x21')]===_0x4d4f('0x22')&&typeof _0x4a3364[_0x4d4f('0x23')]==='undefined';var _0x30b6b1=_0x59bfb5[_0x4d4f('0x24')];var _0x51dcf1=_0x5e4ff5?0x0:_0x4a3364['offset'];var _0x519501=_0x5e4ff5?_0x59bfb5['count']:_0x4a3364['offset']+_0x4a3364[_0x4d4f('0x23')];var _0x15100a;if(_0x519501>=_0x30b6b1){_0x519501=_0x30b6b1;_0x15100a=0xc8;}else{_0x15100a=0xce;}_0x1a9173[_0x4d4f('0x1f')](_0x15100a);return _0x1a9173[_0x4d4f('0x25')]('Content-Range',_0x51dcf1+'-'+_0x519501+'/'+_0x30b6b1)['json'](_0x59bfb5);}return null;};}function patchUpdates(_0x1e1ae2){return function(_0x4dd360){try{jsonpatch[_0x4d4f('0x26')](_0x4dd360,_0x1e1ae2,!![]);}catch(_0x1e3e9a){return BPromise[_0x4d4f('0x27')](_0x1e3e9a);}return _0x4dd360[_0x4d4f('0x28')]();};}function saveUpdates(_0x3dd36a,_0x5beab4){return function(_0x570520){if(_0x570520){return _0x570520[_0x4d4f('0x29')](_0x3dd36a)['then'](function(_0x247077){return _0x247077;});}return null;};}function removeEntity(_0x3d5d93,_0x2d2fb3){return function(_0x3f4a55){if(_0x3f4a55){return _0x3f4a55[_0x4d4f('0x2a')]()['then'](function(){var _0x44bd2f=_0x3f4a55[_0x4d4f('0x2b')]({'plain':!![]});var _0x1cf365=_0x4d4f('0x2c');return db['UserProfileResource']['destroy']({'where':{'type':_0x1cf365,'resourceId':_0x44bd2f['id']}})[_0x4d4f('0x2d')](function(){return _0x3f4a55;});})[_0x4d4f('0x2d')](function(){_0x3d5d93[_0x4d4f('0x1f')](0xcc)[_0x4d4f('0x1e')]();});}};}function handleEntityNotFound(_0x58acbe,_0x671c87){return function(_0x380ebf){if(!_0x380ebf){_0x58acbe[_0x4d4f('0x1d')](0x194);}return _0x380ebf;};}function handleError(_0x2e91b2,_0x4effb1){_0x4effb1=_0x4effb1||0x1f4;return function(_0x338ba2){logger['error'](_0x338ba2[_0x4d4f('0x2e')]);if(_0x338ba2[_0x4d4f('0x2f')]){delete _0x338ba2['name'];}_0x2e91b2[_0x4d4f('0x1f')](_0x4effb1)[_0x4d4f('0x30')](_0x338ba2);};}exports[_0x4d4f('0x31')]=function(_0x3d7f14,_0x19a502){var _0x43a704={},_0x4c69cb={},_0x36eede={'count':0x0,'rows':[]};var _0x4578b6=_[_0x4d4f('0x32')](db[_0x4d4f('0x33')][_0x4d4f('0x34')],function(_0x4e47e5){return{'name':_0x4e47e5[_0x4d4f('0x35')],'type':_0x4e47e5['type'][_0x4d4f('0x36')]};});_0x4c69cb['model']=_['map'](_0x4578b6,'name');_0x4c69cb[_0x4d4f('0x37')]=_['keys'](_0x3d7f14[_0x4d4f('0x37')]);_0x4c69cb[_0x4d4f('0x38')]=_[_0x4d4f('0x39')](_0x4c69cb['model'],_0x4c69cb[_0x4d4f('0x37')]);_0x43a704[_0x4d4f('0x3a')]=_[_0x4d4f('0x39')](_0x4c69cb['model'],qs[_0x4d4f('0x3b')](_0x3d7f14['query'][_0x4d4f('0x3b')]));_0x43a704[_0x4d4f('0x3a')]=_0x43a704[_0x4d4f('0x3a')][_0x4d4f('0x3c')]?_0x43a704[_0x4d4f('0x3a')]:_0x4c69cb[_0x4d4f('0x3d')];if(!_0x3d7f14[_0x4d4f('0x37')][_0x4d4f('0x3e')]('nolimit')){_0x43a704['limit']=qs[_0x4d4f('0x23')](_0x3d7f14['query']['limit']);_0x43a704[_0x4d4f('0x21')]=qs[_0x4d4f('0x21')](_0x3d7f14[_0x4d4f('0x37')][_0x4d4f('0x21')]);}_0x43a704[_0x4d4f('0x3f')]=qs['sort'](_0x3d7f14[_0x4d4f('0x37')][_0x4d4f('0x40')]);_0x43a704['where']=qs[_0x4d4f('0x38')](_[_0x4d4f('0x41')](_0x3d7f14[_0x4d4f('0x37')],_0x4c69cb[_0x4d4f('0x38')]),_0x4578b6);if(_0x3d7f14[_0x4d4f('0x37')][_0x4d4f('0x42')]){_0x43a704[_0x4d4f('0x43')]=_[_0x4d4f('0x44')](_0x43a704[_0x4d4f('0x43')],{'$or':_['map'](_0x4578b6,function(_0x55a151){if(_0x55a151[_0x4d4f('0x45')]!==_0x4d4f('0x46')){var _0x4b3ba1={};_0x4b3ba1[_0x55a151[_0x4d4f('0x2f')]]={'$like':'%'+_0x3d7f14['query']['filter']+'%'};return _0x4b3ba1;}})});}_0x43a704=_[_0x4d4f('0x44')]({},_0x43a704,_0x3d7f14[_0x4d4f('0x47')]);var _0x58b52c={'where':_0x43a704['where']};return db[_0x4d4f('0x33')][_0x4d4f('0x24')](_0x58b52c)['then'](function(_0x949a6d){_0x36eede[_0x4d4f('0x24')]=_0x949a6d;if(_0x3d7f14[_0x4d4f('0x37')][_0x4d4f('0x48')]){_0x43a704[_0x4d4f('0x49')]=[{'all':!![]}];}return db['VoiceMail'][_0x4d4f('0x4a')](_0x43a704);})['then'](function(_0x45a0c1){_0x36eede[_0x4d4f('0x4b')]=_0x45a0c1;return _0x36eede;})['then'](respondWithFilteredResult(_0x19a502,_0x43a704))[_0x4d4f('0x4c')](handleError(_0x19a502,null));};exports[_0x4d4f('0x4d')]=function(_0x1f7169,_0x489abe){var _0x379b59={'raw':!![],'where':{'id':_0x1f7169[_0x4d4f('0x4e')]['id']}},_0x48caa2={};_0x48caa2['model']=_[_0x4d4f('0x4f')](db[_0x4d4f('0x33')][_0x4d4f('0x34')]);_0x48caa2[_0x4d4f('0x37')]=_[_0x4d4f('0x4f')](_0x1f7169['query']);_0x48caa2['filters']=_[_0x4d4f('0x39')](_0x48caa2[_0x4d4f('0x3d')],_0x48caa2[_0x4d4f('0x37')]);_0x379b59[_0x4d4f('0x3a')]=_['intersection'](_0x48caa2['model'],qs['fields'](_0x1f7169[_0x4d4f('0x37')][_0x4d4f('0x3b')]));_0x379b59[_0x4d4f('0x3a')]=_0x379b59[_0x4d4f('0x3a')][_0x4d4f('0x3c')]?_0x379b59[_0x4d4f('0x3a')]:_0x48caa2[_0x4d4f('0x3d')];if(_0x1f7169[_0x4d4f('0x37')][_0x4d4f('0x48')]){_0x379b59[_0x4d4f('0x49')]=[{'all':!![]}];}_0x379b59=_[_0x4d4f('0x44')]({},_0x379b59,_0x1f7169[_0x4d4f('0x47')]);return db['VoiceMail'][_0x4d4f('0x50')](_0x379b59)[_0x4d4f('0x2d')](handleEntityNotFound(_0x489abe,null))['then'](respondWithResult(_0x489abe,null))[_0x4d4f('0x4c')](handleError(_0x489abe,null));};exports['create']=function(_0x15cf38,_0x401466){return db['VoiceMail'][_0x4d4f('0x51')](_0x15cf38[_0x4d4f('0x52')],{})[_0x4d4f('0x2d')](function(_0x21d0d6){var _0x7f22f2=_0x15cf38[_0x4d4f('0x53')][_0x4d4f('0x2b')]({'plain':!![]});if(!_0x7f22f2)throw new Error(_0x4d4f('0x54'));if(_0x7f22f2[_0x4d4f('0x55')]===_0x4d4f('0x53')){var _0xa6cef=_0x21d0d6[_0x4d4f('0x2b')]({'plain':!![]});var _0x504d85=_0x4d4f('0x2c');return db['UserProfileSection']['find']({'where':{'name':_0x504d85,'userProfileId':_0x7f22f2['userProfileId']},'raw':!![]})[_0x4d4f('0x2d')](function(_0x168742){if(_0x168742&&_0x168742['autoAssociation']===0x0){return db['UserProfileResource'][_0x4d4f('0x51')]({'name':_0xa6cef[_0x4d4f('0x2f')],'resourceId':_0xa6cef['id'],'type':_0x168742['name'],'sectionId':_0x168742['id']},{})[_0x4d4f('0x2d')](function(){return _0x21d0d6;});}else{return _0x21d0d6;}})['catch'](function(_0x17b59e){logger[_0x4d4f('0x56')](_0x4d4f('0x57'),_0x17b59e);throw _0x17b59e;});}return _0x21d0d6;})[_0x4d4f('0x2d')](respondWithResult(_0x401466,0xc9))['catch'](handleError(_0x401466,null));};exports[_0x4d4f('0x29')]=function(_0x2008c3,_0x36a446){if(_0x2008c3[_0x4d4f('0x52')]['id']){delete _0x2008c3[_0x4d4f('0x52')]['id'];}return db['VoiceMail'][_0x4d4f('0x50')]({'where':{'id':_0x2008c3['params']['id']}})[_0x4d4f('0x2d')](handleEntityNotFound(_0x36a446,null))['then'](saveUpdates(_0x2008c3[_0x4d4f('0x52')],null))[_0x4d4f('0x2d')](respondWithResult(_0x36a446,null))['catch'](handleError(_0x36a446,null));};exports[_0x4d4f('0x2a')]=function(_0x1d8ae6,_0x4d08c8){return db[_0x4d4f('0x33')]['find']({'where':{'id':_0x1d8ae6[_0x4d4f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4d08c8,null))['then'](removeEntity(_0x4d08c8,null))[_0x4d4f('0x4c')](handleError(_0x4d08c8,null));};exports[_0x4d4f('0x58')]=function(_0x23bf8e,_0x213cdb,_0x29a3a1){return db['VoiceMail']['findOne']({'where':{'id':_0x23bf8e[_0x4d4f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x213cdb,null))[_0x4d4f('0x2d')](function(_0xadc9ac){var _0x23771c;var _0x4585b5={},_0x31aba3={};_0x31aba3[_0x4d4f('0x3d')]=_['keys'](db[_0x4d4f('0x59')][_0x4d4f('0x34')]);_0x31aba3[_0x4d4f('0x37')]=_['keys'](_0x23bf8e[_0x4d4f('0x37')]);_0x31aba3[_0x4d4f('0x38')]=_[_0x4d4f('0x39')](_0x31aba3['model'],_0x31aba3[_0x4d4f('0x37')]);_0x4585b5['attributes']=_[_0x4d4f('0x39')](_0x31aba3[_0x4d4f('0x3d')],qs[_0x4d4f('0x3b')](_0x23bf8e[_0x4d4f('0x37')][_0x4d4f('0x3b')]));_0x4585b5[_0x4d4f('0x3a')]=_0x4585b5[_0x4d4f('0x3a')][_0x4d4f('0x3c')]?_0x4585b5[_0x4d4f('0x3a')]:_0x31aba3['model'];if(!_0x23bf8e[_0x4d4f('0x37')][_0x4d4f('0x3e')]('nolimit')){_0x4585b5[_0x4d4f('0x23')]=qs[_0x4d4f('0x23')](_0x23bf8e[_0x4d4f('0x37')][_0x4d4f('0x23')]);_0x4585b5['offset']=qs[_0x4d4f('0x21')](_0x23bf8e[_0x4d4f('0x37')]['offset']);}_0x4585b5['order']=qs[_0x4d4f('0x40')](_0x23bf8e[_0x4d4f('0x37')]['sort']);_0x4585b5['where']=qs['filters'](_[_0x4d4f('0x41')](_0x23bf8e[_0x4d4f('0x37')],_0x31aba3['filters']));if(_0x23bf8e[_0x4d4f('0x37')][_0x4d4f('0x42')]){_0x4585b5[_0x4d4f('0x43')]=_[_0x4d4f('0x44')](_0x4585b5[_0x4d4f('0x43')],{'$or':_[_0x4d4f('0x32')](_0x4585b5[_0x4d4f('0x3a')],function(_0x20845c){var _0x542513={};_0x542513[_0x20845c]={'$like':'%'+_0x23bf8e[_0x4d4f('0x37')]['filter']+'%'};return _0x542513;})});}_0x4585b5[_0x4d4f('0x43')]=_[_0x4d4f('0x44')](_0x4585b5[_0x4d4f('0x43')],{'mailboxuser':_0xadc9ac['mailbox']});_0x4585b5=_[_0x4d4f('0x44')]({},_0x4585b5,_0x23bf8e[_0x4d4f('0x47')]);return db[_0x4d4f('0x59')][_0x4d4f('0x5a')](_0x4585b5)['then'](respondWithFilteredResult(_0x213cdb,_0x4585b5));})[_0x4d4f('0x4c')](handleError(_0x213cdb,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index edf1c0b..158cee0 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 _0xe6f3=['api','moment','request-promise','path','rimraf','../../config/environment','exports','define','voice_voicemail','mailbox','context','lodash','util','../../config/logger'];(function(_0x5dd9e1,_0x491fdb){var _0x44185b=function(_0x43e8b1){while(--_0x43e8b1){_0x5dd9e1['push'](_0x5dd9e1['shift']());}};_0x44185b(++_0x491fdb);}(_0xe6f3,0xeb));var _0x3e6f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe6f3[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x3e6f('0x0'));var util=require(_0x3e6f('0x1'));var logger=require(_0x3e6f('0x2'))(_0x3e6f('0x3'));var moment=require(_0x3e6f('0x4'));var BPromise=require('bluebird');var rp=require(_0x3e6f('0x5'));var fs=require('fs');var path=require(_0x3e6f('0x6'));var rimraf=require(_0x3e6f('0x7'));var config=require(_0x3e6f('0x8'));var attributes=require('./voiceMail.attributes');module[_0x3e6f('0x9')]=function(_0x222085,_0x1b2524){return _0x222085[_0x3e6f('0xa')]('VoiceMail',attributes,{'tableName':_0x3e6f('0xb'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0x3e6f('0xc'),_0x3e6f('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xad42=['define','VoiceMail','mailbox_context','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceMail.attributes','exports'];(function(_0x2c2d73,_0x4569c2){var _0x2e3778=function(_0x1ec051){while(--_0x1ec051){_0x2c2d73['push'](_0x2c2d73['shift']());}};_0x2e3778(++_0x4569c2);}(_0xad42,0x1cb));var _0x2ad4=function(_0x2fec4e,_0x17f5bd){_0x2fec4e=_0x2fec4e-0x0;var _0x1f3461=_0xad42[_0x2fec4e];return _0x1f3461;};'use strict';var _=require('lodash');var util=require(_0x2ad4('0x0'));var logger=require(_0x2ad4('0x1'))('api');var moment=require(_0x2ad4('0x2'));var BPromise=require(_0x2ad4('0x3'));var rp=require(_0x2ad4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2ad4('0x5'));var config=require(_0x2ad4('0x6'));var attributes=require(_0x2ad4('0x7'));module[_0x2ad4('0x8')]=function(_0x2cea73,_0xb3777b){return _0x2cea73[_0x2ad4('0x9')](_0x2ad4('0xa'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0x2ad4('0xb'),'fields':['mailbox','context']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index f348c31..9d09e93 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 _0x18c9=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','bluebird','randomstring','ioredis'];(function(_0x213f1b,_0xddb2b){var _0x2ce6bc=function(_0x4781b4){while(--_0x4781b4){_0x213f1b['push'](_0x213f1b['shift']());}};_0x2ce6bc(++_0xddb2b);}(_0x18c9,0xaf));var _0x918c=function(_0x3a7a9c,_0x24f7d6){_0x3a7a9c=_0x3a7a9c-0x0;var _0x59156e=_0x18c9[_0x3a7a9c];return _0x59156e;};'use strict';var _=require(_0x918c('0x0'));var util=require(_0x918c('0x1'));var moment=require('moment');var BPromise=require(_0x918c('0x2'));var rs=require(_0x918c('0x3'));var fs=require('fs');var Redis=require(_0x918c('0x4'));var db=require(_0x918c('0x5'))['db'];var utils=require(_0x918c('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x918c('0x7'));var jayson=require(_0x918c('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x39bd9f,_0xc8325e,_0x7580f6){return new BPromise(function(_0x24896a,_0x3e59b6){return client[_0x918c('0x9')](_0x39bd9f,_0x7580f6)[_0x918c('0xa')](function(_0x29f419){logger[_0x918c('0xb')](_0x918c('0xc'),_0xc8325e,_0x918c('0xd'));logger[_0x918c('0xe')](_0x918c('0xf'),_0xc8325e,_0x918c('0xd'),JSON['stringify'](_0x29f419));if(_0x29f419['error']){if(_0x29f419[_0x918c('0x10')][_0x918c('0x11')]===0x1f4){logger['error'](_0x918c('0xc'),_0xc8325e,_0x29f419[_0x918c('0x10')][_0x918c('0x12')]);return _0x3e59b6(_0x29f419[_0x918c('0x10')]['message']);}logger[_0x918c('0x10')]('VoiceMail,\x20%s,\x20%s',_0xc8325e,_0x29f419[_0x918c('0x10')][_0x918c('0x12')]);return _0x24896a(_0x29f419[_0x918c('0x10')][_0x918c('0x12')]);}else{logger['info'](_0x918c('0xc'),_0xc8325e,_0x918c('0xd'));_0x24896a(_0x29f419[_0x918c('0x13')][_0x918c('0x12')]);}})['catch'](function(_0x1c76dc){logger[_0x918c('0x10')](_0x918c('0xc'),_0xc8325e,_0x1c76dc);_0x3e59b6(_0x1c76dc);});});} \ No newline at end of file +var _0x181d=['info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x568910,_0x9a610f){var _0x267456=function(_0x235183){while(--_0x235183){_0x568910['push'](_0x568910['shift']());}};_0x267456(++_0x9a610f);}(_0x181d,0xe5));var _0xd181=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x181d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xd181('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd181('0x1'))['db'];var utils=require(_0xd181('0x2'));var logger=require(_0xd181('0x3'))(_0xd181('0x4'));var config=require(_0xd181('0x5'));var jayson=require(_0xd181('0x6'));var client=jayson[_0xd181('0x7')][_0xd181('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5c9211,_0x353f9e,_0xc0dd79){return new BPromise(function(_0x7cd15a,_0x37e447){return client[_0xd181('0x9')](_0x5c9211,_0xc0dd79)[_0xd181('0xa')](function(_0x1a3292){logger[_0xd181('0xb')](_0xd181('0xc'),_0x353f9e,_0xd181('0xd'));logger[_0xd181('0xe')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x353f9e,'request\x20sent',JSON[_0xd181('0xf')](_0x1a3292));if(_0x1a3292['error']){if(_0x1a3292[_0xd181('0x10')]['code']===0x1f4){logger['error'](_0xd181('0xc'),_0x353f9e,_0x1a3292['error'][_0xd181('0x11')]);return _0x37e447(_0x1a3292[_0xd181('0x10')]['message']);}logger['error']('VoiceMail,\x20%s,\x20%s',_0x353f9e,_0x1a3292['error'][_0xd181('0x11')]);return _0x7cd15a(_0x1a3292['error'][_0xd181('0x11')]);}else{logger[_0xd181('0xb')](_0xd181('0xc'),_0x353f9e,_0xd181('0xd'));_0x7cd15a(_0x1a3292[_0xd181('0x12')][_0xd181('0x11')]);}})[_0xd181('0x13')](function(_0x9a63b0){logger[_0xd181('0x10')](_0xd181('0xc'),_0x353f9e,_0x9a63b0);_0x37e447(_0x9a63b0);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 6780c34..5660a28 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 _0xf7a6=['put','update','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','download','post','create'];(function(_0x27c256,_0x32c0bd){var _0x22217a=function(_0x1e8bf4){while(--_0x1e8bf4){_0x27c256['push'](_0x27c256['shift']());}};_0x22217a(++_0x32c0bd);}(_0xf7a6,0xb6));var _0x6f7a=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0xf7a6[_0x36ed48];return _0x51c63a;};'use strict';var multer=require('multer');var util=require(_0x6f7a('0x0'));var path=require('path');var timeout=require(_0x6f7a('0x1'));var express=require('express');var router=express[_0x6f7a('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6f7a('0x3'));var config=require(_0x6f7a('0x4'));var controller=require('./voiceMailMessage.controller');router[_0x6f7a('0x5')]('/',auth[_0x6f7a('0x6')](),controller[_0x6f7a('0x7')]);router[_0x6f7a('0x5')](_0x6f7a('0x8'),auth[_0x6f7a('0x6')](),controller[_0x6f7a('0x9')]);router[_0x6f7a('0x5')]('/:id/download',auth[_0x6f7a('0x6')](),controller[_0x6f7a('0xa')]);router[_0x6f7a('0xb')]('/',auth[_0x6f7a('0x6')](),controller[_0x6f7a('0xc')]);router[_0x6f7a('0xd')](_0x6f7a('0x8'),auth[_0x6f7a('0x6')](),controller[_0x6f7a('0xe')]);router['delete'](_0x6f7a('0x8'),auth[_0x6f7a('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xaabb=['download','post','create','update','delete','destroy','exports','multer','util','path','Router','../../components/interaction/service','get','isAuthenticated','index','/:id','/:id/download'];(function(_0x136a31,_0x39fc04){var _0x200331=function(_0x4eb88d){while(--_0x4eb88d){_0x136a31['push'](_0x136a31['shift']());}};_0x200331(++_0x39fc04);}(_0xaabb,0x15b));var _0xbaab=function(_0x4ff1a8,_0xbb3134){_0x4ff1a8=_0x4ff1a8-0x0;var _0x5b5582=_0xaabb[_0x4ff1a8];return _0x5b5582;};'use strict';var multer=require(_0xbaab('0x0'));var util=require(_0xbaab('0x1'));var path=require(_0xbaab('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbaab('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xbaab('0x4'));var config=require('../../config/environment');var controller=require('./voiceMailMessage.controller');router[_0xbaab('0x5')]('/',auth[_0xbaab('0x6')](),controller[_0xbaab('0x7')]);router['get'](_0xbaab('0x8'),auth[_0xbaab('0x6')](),controller['show']);router[_0xbaab('0x5')](_0xbaab('0x9'),auth[_0xbaab('0x6')](),controller[_0xbaab('0xa')]);router[_0xbaab('0xb')]('/',auth[_0xbaab('0x6')](),controller[_0xbaab('0xc')]);router['put'](_0xbaab('0x8'),auth[_0xbaab('0x6')](),controller[_0xbaab('0xd')]);router[_0xbaab('0xe')](_0xbaab('0x8'),auth['isAuthenticated'](),controller[_0xbaab('0xf')]);module[_0xbaab('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 7c745df..7e36b28 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 _0xb3fe=['getDataValue','STRING','BLOB','sequelize','VIRTUAL'];(function(_0x1a977e,_0x3045cf){var _0x4404b8=function(_0x50dcfb){while(--_0x50dcfb){_0x1a977e['push'](_0x1a977e['shift']());}};_0x4404b8(++_0x3045cf);}(_0xb3fe,0x99));var _0xeb3f=function(_0xe24ff7,_0x3f071b){_0xe24ff7=_0xe24ff7-0x0;var _0x30d497=_0xb3fe[_0xe24ff7];return _0x30d497;};'use strict';var Sequelize=require(_0xeb3f('0x0'));module['exports']={'name':{'type':Sequelize[_0xeb3f('0x1')],'get':function(_0x2d565d){return this[_0xeb3f('0x2')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xeb3f('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0xeb3f('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0xeb3f('0x3')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0xeb3f('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xeb3f('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0xeb3f('0x4')]('long'),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize['literal']('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0x9b4a=['STRING','BLOB','literal','sequelize','exports','VIRTUAL','INTEGER'];(function(_0x5964d2,_0x53cbc6){var _0x15e47f=function(_0x2bb0e9){while(--_0x2bb0e9){_0x5964d2['push'](_0x5964d2['shift']());}};_0x15e47f(++_0x53cbc6);}(_0x9b4a,0x129));var _0xa9b4=function(_0x46d4fb,_0x59d988){_0x46d4fb=_0x46d4fb-0x0;var _0x269aa8=_0x9b4a[_0x46d4fb];return _0x269aa8;};'use strict';var Sequelize=require(_0xa9b4('0x0'));module[_0xa9b4('0x1')]={'name':{'type':Sequelize[_0xa9b4('0x2')],'get':function(_0x5ce024){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0xa9b4('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xa9b4('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0xa9b4('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0xa9b4('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0xa9b4('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0xa9b4('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xa9b4('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0xa9b4('0x5')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0xa9b4('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xa9b4('0x4')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0xa9b4('0x6')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 5677898..8b1fc70 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 _0x81d6=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','save','update','then','destroy','error','name','index','map','rawAttributes','fieldName','type','key','differenceBy','keys','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceMailMessage','includeAll','findAll','rows','params','fields','include','find','catch','body','download','recording','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','msg_id','.wav\x22','send','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs'];(function(_0x365833,_0x65aaa4){var _0x437a67=function(_0x3ed4c8){while(--_0x3ed4c8){_0x365833['push'](_0x365833['shift']());}};_0x437a67(++_0x65aaa4);}(_0x81d6,0x192));var _0x681d=function(_0x5d5a7c,_0x1e2a8c){_0x5d5a7c=_0x5d5a7c-0x0;var _0x55141f=_0x81d6[_0x5d5a7c];return _0x55141f;};'use strict';var emlformat=require(_0x681d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x681d('0x1'));var jsonpatch=require(_0x681d('0x2'));var rp=require('request-promise');var moment=require(_0x681d('0x3'));var BPromise=require(_0x681d('0x4'));var Mustache=require('mustache');var util=require(_0x681d('0x5'));var path=require(_0x681d('0x6'));var sox=require(_0x681d('0x7'));var csv=require(_0x681d('0x8'));var ejs=require(_0x681d('0x9'));var fs=require('fs');var fs_extra=require(_0x681d('0xa'));var _=require(_0x681d('0xb'));var squel=require(_0x681d('0xc'));var crypto=require(_0x681d('0xd'));var jsforce=require(_0x681d('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x681d('0xf'));var Papa=require(_0x681d('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x681d('0x11'));var as=require(_0x681d('0x12'));var hardwareService=require(_0x681d('0x13'));var logger=require(_0x681d('0x14'))(_0x681d('0x15'));var utils=require(_0x681d('0x16'));var config=require(_0x681d('0x17'));var licenseUtil=require(_0x681d('0x18'));var db=require(_0x681d('0x19'))['db'];function respondWithStatusCode(_0x504324,_0x2f0ba4){_0x2f0ba4=_0x2f0ba4||0xcc;return function(_0x50ad1e){if(_0x50ad1e){return _0x504324[_0x681d('0x1a')](_0x2f0ba4);}return _0x504324[_0x681d('0x1b')](_0x2f0ba4)[_0x681d('0x1c')]();};}function respondWithResult(_0x5d7518,_0x26d27b){_0x26d27b=_0x26d27b||0xc8;return function(_0x341ad7){if(_0x341ad7){return _0x5d7518['status'](_0x26d27b)[_0x681d('0x1d')](_0x341ad7);}};}function respondWithFilteredResult(_0x2bd4f9,_0x1812d1){return function(_0xac88af){if(_0xac88af){var _0x2d9ee8=typeof _0x1812d1[_0x681d('0x1e')]==='undefined'&&typeof _0x1812d1[_0x681d('0x1f')]==='undefined';var _0x19b761=_0xac88af[_0x681d('0x20')];var _0x5dca9a=_0x2d9ee8?0x0:_0x1812d1[_0x681d('0x1e')];var _0x32a1af=_0x2d9ee8?_0xac88af[_0x681d('0x20')]:_0x1812d1[_0x681d('0x1e')]+_0x1812d1[_0x681d('0x1f')];var _0x1ac45e;if(_0x32a1af>=_0x19b761){_0x32a1af=_0x19b761;_0x1ac45e=0xc8;}else{_0x1ac45e=0xce;}_0x2bd4f9[_0x681d('0x1b')](_0x1ac45e);return _0x2bd4f9[_0x681d('0x21')](_0x681d('0x22'),_0x5dca9a+'-'+_0x32a1af+'/'+_0x19b761)[_0x681d('0x1d')](_0xac88af);}return null;};}function patchUpdates(_0x3b2857){return function(_0x21373c){try{jsonpatch[_0x681d('0x23')](_0x21373c,_0x3b2857,!![]);}catch(_0x304f14){return BPromise['reject'](_0x304f14);}return _0x21373c[_0x681d('0x24')]();};}function saveUpdates(_0x119d04,_0x1abe40){return function(_0x473220){if(_0x473220){return _0x473220[_0x681d('0x25')](_0x119d04)[_0x681d('0x26')](function(_0x161885){return _0x161885;});}return null;};}function removeEntity(_0x36631b,_0x5c7c96){return function(_0x1f265c){if(_0x1f265c){return _0x1f265c[_0x681d('0x27')]()[_0x681d('0x26')](function(){_0x36631b['status'](0xcc)[_0x681d('0x1c')]();});}};}function handleEntityNotFound(_0x5abc7e,_0x186276){return function(_0x3c9c45){if(!_0x3c9c45){_0x5abc7e['sendStatus'](0x194);}return _0x3c9c45;};}function handleError(_0x56eaef,_0x5b4c23){_0x5b4c23=_0x5b4c23||0x1f4;return function(_0x2beaf7){logger[_0x681d('0x28')](_0x2beaf7['stack']);if(_0x2beaf7[_0x681d('0x29')]){delete _0x2beaf7[_0x681d('0x29')];}_0x56eaef[_0x681d('0x1b')](_0x5b4c23)['send'](_0x2beaf7);};}exports[_0x681d('0x2a')]=function(_0xeef998,_0xe782a6){var _0x2ea89={},_0x34948e={},_0x48b553={'count':0x0,'rows':[]};var _0x113475=_[_0x681d('0x2b')](db['VoiceMailMessage'][_0x681d('0x2c')],function(_0xeb71d8){return{'name':_0xeb71d8[_0x681d('0x2d')],'type':_0xeb71d8[_0x681d('0x2e')][_0x681d('0x2f')]};});_0x34948e['model']=_[_0x681d('0x30')](_['map'](_0x113475,_0x681d('0x29')),[_0x681d('0x29')]);_0x34948e['query']=_[_0x681d('0x31')](_0xeef998[_0x681d('0x32')]);_0x34948e[_0x681d('0x33')]=_[_0x681d('0x34')](_0x34948e[_0x681d('0x35')],_0x34948e[_0x681d('0x32')]);_0x2ea89[_0x681d('0x36')]=_[_0x681d('0x34')](_0x34948e[_0x681d('0x35')],qs['fields'](_0xeef998['query']['fields']));_0x2ea89[_0x681d('0x36')]=_0x2ea89[_0x681d('0x36')][_0x681d('0x37')]?_0x2ea89['attributes']:_0x34948e[_0x681d('0x35')];if(!_0xeef998[_0x681d('0x32')][_0x681d('0x38')](_0x681d('0x39'))){_0x2ea89[_0x681d('0x1f')]=qs[_0x681d('0x1f')](_0xeef998[_0x681d('0x32')][_0x681d('0x1f')]);_0x2ea89[_0x681d('0x1e')]=qs[_0x681d('0x1e')](_0xeef998['query']['offset']);}_0x2ea89[_0x681d('0x3a')]=qs[_0x681d('0x3b')](_0xeef998[_0x681d('0x32')]['sort']);_0x2ea89[_0x681d('0x3c')]=qs['filters'](_[_0x681d('0x3d')](_0xeef998[_0x681d('0x32')],_0x34948e[_0x681d('0x33')]),_0x113475);if(_0xeef998[_0x681d('0x32')][_0x681d('0x3e')]){_0x2ea89[_0x681d('0x3c')]=_[_0x681d('0x3f')](_0x2ea89[_0x681d('0x3c')],{'$or':_[_0x681d('0x2b')](_0x113475,function(_0x596f74){if(_0x596f74[_0x681d('0x2e')]!==_0x681d('0x40')){var _0x567f74={};_0x567f74[_0x596f74['name']]={'$like':'%'+_0xeef998[_0x681d('0x32')][_0x681d('0x3e')]+'%'};return _0x567f74;}})});}_0x2ea89=_[_0x681d('0x3f')]({},_0x2ea89,_0xeef998[_0x681d('0x41')]);var _0x541633={'where':_0x2ea89[_0x681d('0x3c')]};return db[_0x681d('0x42')][_0x681d('0x20')](_0x541633)[_0x681d('0x26')](function(_0x24069f){_0x48b553['count']=_0x24069f;if(_0xeef998[_0x681d('0x32')][_0x681d('0x43')]){_0x2ea89['include']=[{'all':!![]}];}return db['VoiceMailMessage'][_0x681d('0x44')](_0x2ea89);})[_0x681d('0x26')](function(_0x3863d3){_0x48b553[_0x681d('0x45')]=_0x3863d3;return _0x48b553;})[_0x681d('0x26')](respondWithFilteredResult(_0xe782a6,_0x2ea89))['catch'](handleError(_0xe782a6,null));};exports['show']=function(_0x229cbe,_0x1d0edc){var _0x531dcb={'raw':!![],'where':{'id':_0x229cbe[_0x681d('0x46')]['id']}},_0x527e10={};_0x527e10[_0x681d('0x35')]=_[_0x681d('0x31')](db[_0x681d('0x42')][_0x681d('0x2c')]);_0x527e10[_0x681d('0x32')]=_['keys'](_0x229cbe[_0x681d('0x32')]);_0x527e10[_0x681d('0x33')]=_[_0x681d('0x34')](_0x527e10['model'],_0x527e10[_0x681d('0x32')]);_0x531dcb['attributes']=_['intersection'](_0x527e10[_0x681d('0x35')],qs[_0x681d('0x47')](_0x229cbe[_0x681d('0x32')]['fields']));_0x531dcb[_0x681d('0x36')]=_0x531dcb[_0x681d('0x36')][_0x681d('0x37')]?_0x531dcb[_0x681d('0x36')]:_0x527e10[_0x681d('0x35')];if(_0x229cbe[_0x681d('0x32')][_0x681d('0x43')]){_0x531dcb[_0x681d('0x48')]=[{'all':!![]}];}_0x531dcb=_['merge']({},_0x531dcb,_0x229cbe[_0x681d('0x41')]);return db[_0x681d('0x42')][_0x681d('0x49')](_0x531dcb)[_0x681d('0x26')](handleEntityNotFound(_0x1d0edc,null))['then'](respondWithResult(_0x1d0edc,null))[_0x681d('0x4a')](handleError(_0x1d0edc,null));};exports['create']=function(_0x4d8554,_0x2ab992){return db[_0x681d('0x42')]['create'](_0x4d8554[_0x681d('0x4b')],{})['then'](respondWithResult(_0x2ab992,0xc9))[_0x681d('0x4a')](handleError(_0x2ab992,null));};exports[_0x681d('0x25')]=function(_0xf1dbef,_0x7a2cea){if(_0xf1dbef[_0x681d('0x4b')]['id']){delete _0xf1dbef['body']['id'];}return db[_0x681d('0x42')]['find']({'where':{'id':_0xf1dbef['params']['id']}})[_0x681d('0x26')](handleEntityNotFound(_0x7a2cea,null))[_0x681d('0x26')](saveUpdates(_0xf1dbef[_0x681d('0x4b')],null))['then'](respondWithResult(_0x7a2cea,null))['catch'](handleError(_0x7a2cea,null));};exports[_0x681d('0x27')]=function(_0x3d5ad2,_0x3b5e04){return db[_0x681d('0x42')][_0x681d('0x49')]({'where':{'id':_0x3d5ad2['params']['id']}})[_0x681d('0x26')](handleEntityNotFound(_0x3b5e04,null))[_0x681d('0x26')](removeEntity(_0x3b5e04,null))[_0x681d('0x4a')](handleError(_0x3b5e04,null));};exports[_0x681d('0x4c')]=function(_0xf5b21b,_0x23623c,_0x298857){return db[_0x681d('0x42')]['find']({'where':{'id':_0xf5b21b[_0x681d('0x46')]['id']},'attributes':['id',_0x681d('0x4d'),'msg_id']})[_0x681d('0x26')](handleEntityNotFound(_0x23623c,null))[_0x681d('0x26')](function(_0x831034){if(_0x831034){if(!_0x831034[_0x681d('0x4d')]){throw new db[(_0x681d('0x4e'))]['ValidationError'](_0x681d('0x4f'));}var _0x2b2d3d={'Content-Type':_0x681d('0x50'),'Content-Disposition':'attachment'};if(_0x831034[_0x681d('0x51')]){_0x2b2d3d['Content-Disposition']='attachment;\x20filename=\x22'+_0x831034[_0x681d('0x51')]+_0x681d('0x52');}_0x23623c['set'](_0x2b2d3d);return _0x23623c[_0x681d('0x53')](new Buffer(_0x831034[_0x681d('0x4d')]));}})[_0x681d('0x4a')](handleError(_0x23623c,null));}; \ No newline at end of file +var _0x8ae4=['apply','reject','save','update','then','error','stack','name','send','index','VoiceMailMessage','rawAttributes','type','key','model','differenceBy','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','body','destroy','download','msg_id','ValidationError','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','set','recording','eml-format','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','limit','undefined','offset','count','Content-Range','json'];(function(_0x43c3df,_0x370d60){var _0x275e71=function(_0x5a9905){while(--_0x5a9905){_0x43c3df['push'](_0x43c3df['shift']());}};_0x275e71(++_0x370d60);}(_0x8ae4,0x184));var _0x48ae=function(_0x50aacb,_0x3a0e0a){_0x50aacb=_0x50aacb-0x0;var _0x4d142c=_0x8ae4[_0x50aacb];return _0x4d142c;};'use strict';var emlformat=require(_0x48ae('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x48ae('0x1'));var rp=require('request-promise');var moment=require(_0x48ae('0x2'));var BPromise=require(_0x48ae('0x3'));var Mustache=require(_0x48ae('0x4'));var util=require('util');var path=require(_0x48ae('0x5'));var sox=require(_0x48ae('0x6'));var csv=require(_0x48ae('0x7'));var ejs=require(_0x48ae('0x8'));var fs=require('fs');var fs_extra=require(_0x48ae('0x9'));var _=require(_0x48ae('0xa'));var squel=require('squel');var crypto=require(_0x48ae('0xb'));var jsforce=require(_0x48ae('0xc'));var deskjs=require(_0x48ae('0xd'));var toCsv=require(_0x48ae('0x7'));var querystring=require('querystring');var Papa=require(_0x48ae('0xe'));var Redis=require(_0x48ae('0xf'));var authService=require(_0x48ae('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x48ae('0x11'));var logger=require('../../config/logger')(_0x48ae('0x12'));var utils=require(_0x48ae('0x13'));var config=require(_0x48ae('0x14'));var licenseUtil=require(_0x48ae('0x15'));var db=require(_0x48ae('0x16'))['db'];function respondWithStatusCode(_0x23ff5,_0x225ab4){_0x225ab4=_0x225ab4||0xcc;return function(_0x2691ab){if(_0x2691ab){return _0x23ff5[_0x48ae('0x17')](_0x225ab4);}return _0x23ff5['status'](_0x225ab4)[_0x48ae('0x18')]();};}function respondWithResult(_0x1e91e5,_0xf7295e){_0xf7295e=_0xf7295e||0xc8;return function(_0x5a278a){if(_0x5a278a){return _0x1e91e5[_0x48ae('0x19')](_0xf7295e)['json'](_0x5a278a);}};}function respondWithFilteredResult(_0x34fd0d,_0x4870cb){return function(_0x1c1731){if(_0x1c1731){var _0x19dc68=typeof _0x4870cb['offset']==='undefined'&&typeof _0x4870cb[_0x48ae('0x1a')]===_0x48ae('0x1b');var _0x184d58=_0x1c1731['count'];var _0x2110c6=_0x19dc68?0x0:_0x4870cb[_0x48ae('0x1c')];var _0x2f2f92=_0x19dc68?_0x1c1731[_0x48ae('0x1d')]:_0x4870cb[_0x48ae('0x1c')]+_0x4870cb[_0x48ae('0x1a')];var _0x42d7ae;if(_0x2f2f92>=_0x184d58){_0x2f2f92=_0x184d58;_0x42d7ae=0xc8;}else{_0x42d7ae=0xce;}_0x34fd0d[_0x48ae('0x19')](_0x42d7ae);return _0x34fd0d['set'](_0x48ae('0x1e'),_0x2110c6+'-'+_0x2f2f92+'/'+_0x184d58)[_0x48ae('0x1f')](_0x1c1731);}return null;};}function patchUpdates(_0x594053){return function(_0x342631){try{jsonpatch[_0x48ae('0x20')](_0x342631,_0x594053,!![]);}catch(_0xd9ec71){return BPromise[_0x48ae('0x21')](_0xd9ec71);}return _0x342631[_0x48ae('0x22')]();};}function saveUpdates(_0x1b2583,_0xab383d){return function(_0x32706b){if(_0x32706b){return _0x32706b[_0x48ae('0x23')](_0x1b2583)[_0x48ae('0x24')](function(_0x2f09b7){return _0x2f09b7;});}return null;};}function removeEntity(_0x16d146,_0x24e6bc){return function(_0x8f7444){if(_0x8f7444){return _0x8f7444['destroy']()[_0x48ae('0x24')](function(){_0x16d146[_0x48ae('0x19')](0xcc)[_0x48ae('0x18')]();});}};}function handleEntityNotFound(_0x59924e,_0x28aa3b){return function(_0x29fc92){if(!_0x29fc92){_0x59924e[_0x48ae('0x17')](0x194);}return _0x29fc92;};}function handleError(_0x3d93e4,_0x5e7c44){_0x5e7c44=_0x5e7c44||0x1f4;return function(_0x298550){logger[_0x48ae('0x25')](_0x298550[_0x48ae('0x26')]);if(_0x298550[_0x48ae('0x27')]){delete _0x298550[_0x48ae('0x27')];}_0x3d93e4['status'](_0x5e7c44)[_0x48ae('0x28')](_0x298550);};}exports[_0x48ae('0x29')]=function(_0x3227ed,_0x4db5b8){var _0x26f1eb={},_0x35adea={},_0x184bf7={'count':0x0,'rows':[]};var _0x60420d=_['map'](db[_0x48ae('0x2a')][_0x48ae('0x2b')],function(_0x51484a){return{'name':_0x51484a['fieldName'],'type':_0x51484a[_0x48ae('0x2c')][_0x48ae('0x2d')]};});_0x35adea[_0x48ae('0x2e')]=_[_0x48ae('0x2f')](_[_0x48ae('0x30')](_0x60420d,_0x48ae('0x27')),['name']);_0x35adea[_0x48ae('0x31')]=_[_0x48ae('0x32')](_0x3227ed[_0x48ae('0x31')]);_0x35adea['filters']=_[_0x48ae('0x33')](_0x35adea[_0x48ae('0x2e')],_0x35adea[_0x48ae('0x31')]);_0x26f1eb['attributes']=_[_0x48ae('0x33')](_0x35adea[_0x48ae('0x2e')],qs[_0x48ae('0x34')](_0x3227ed['query'][_0x48ae('0x34')]));_0x26f1eb[_0x48ae('0x35')]=_0x26f1eb['attributes'][_0x48ae('0x36')]?_0x26f1eb['attributes']:_0x35adea[_0x48ae('0x2e')];if(!_0x3227ed['query'][_0x48ae('0x37')](_0x48ae('0x38'))){_0x26f1eb[_0x48ae('0x1a')]=qs[_0x48ae('0x1a')](_0x3227ed['query'][_0x48ae('0x1a')]);_0x26f1eb[_0x48ae('0x1c')]=qs[_0x48ae('0x1c')](_0x3227ed[_0x48ae('0x31')][_0x48ae('0x1c')]);}_0x26f1eb[_0x48ae('0x39')]=qs[_0x48ae('0x3a')](_0x3227ed['query']['sort']);_0x26f1eb[_0x48ae('0x3b')]=qs[_0x48ae('0x3c')](_[_0x48ae('0x3d')](_0x3227ed[_0x48ae('0x31')],_0x35adea[_0x48ae('0x3c')]),_0x60420d);if(_0x3227ed[_0x48ae('0x31')][_0x48ae('0x3e')]){_0x26f1eb['where']=_['merge'](_0x26f1eb[_0x48ae('0x3b')],{'$or':_['map'](_0x60420d,function(_0x343343){if(_0x343343[_0x48ae('0x2c')]!==_0x48ae('0x3f')){var _0x22d4b7={};_0x22d4b7[_0x343343[_0x48ae('0x27')]]={'$like':'%'+_0x3227ed[_0x48ae('0x31')][_0x48ae('0x3e')]+'%'};return _0x22d4b7;}})});}_0x26f1eb=_['merge']({},_0x26f1eb,_0x3227ed[_0x48ae('0x40')]);var _0x2cb066={'where':_0x26f1eb['where']};return db['VoiceMailMessage'][_0x48ae('0x1d')](_0x2cb066)[_0x48ae('0x24')](function(_0xea329){_0x184bf7[_0x48ae('0x1d')]=_0xea329;if(_0x3227ed[_0x48ae('0x31')][_0x48ae('0x41')]){_0x26f1eb[_0x48ae('0x42')]=[{'all':!![]}];}return db[_0x48ae('0x2a')][_0x48ae('0x43')](_0x26f1eb);})['then'](function(_0x3a132c){_0x184bf7['rows']=_0x3a132c;return _0x184bf7;})['then'](respondWithFilteredResult(_0x4db5b8,_0x26f1eb))[_0x48ae('0x44')](handleError(_0x4db5b8,null));};exports[_0x48ae('0x45')]=function(_0x1363b4,_0x124a19){var _0x4217ee={'raw':!![],'where':{'id':_0x1363b4[_0x48ae('0x46')]['id']}},_0x20f455={};_0x20f455[_0x48ae('0x2e')]=_[_0x48ae('0x32')](db[_0x48ae('0x2a')]['rawAttributes']);_0x20f455[_0x48ae('0x31')]=_[_0x48ae('0x32')](_0x1363b4[_0x48ae('0x31')]);_0x20f455[_0x48ae('0x3c')]=_[_0x48ae('0x33')](_0x20f455[_0x48ae('0x2e')],_0x20f455[_0x48ae('0x31')]);_0x4217ee[_0x48ae('0x35')]=_[_0x48ae('0x33')](_0x20f455[_0x48ae('0x2e')],qs[_0x48ae('0x34')](_0x1363b4['query'][_0x48ae('0x34')]));_0x4217ee['attributes']=_0x4217ee[_0x48ae('0x35')][_0x48ae('0x36')]?_0x4217ee[_0x48ae('0x35')]:_0x20f455[_0x48ae('0x2e')];if(_0x1363b4[_0x48ae('0x31')][_0x48ae('0x41')]){_0x4217ee[_0x48ae('0x42')]=[{'all':!![]}];}_0x4217ee=_['merge']({},_0x4217ee,_0x1363b4['options']);return db['VoiceMailMessage'][_0x48ae('0x47')](_0x4217ee)[_0x48ae('0x24')](handleEntityNotFound(_0x124a19,null))[_0x48ae('0x24')](respondWithResult(_0x124a19,null))[_0x48ae('0x44')](handleError(_0x124a19,null));};exports['create']=function(_0x5b2490,_0x4bd3d3){return db[_0x48ae('0x2a')]['create'](_0x5b2490[_0x48ae('0x48')],{})[_0x48ae('0x24')](respondWithResult(_0x4bd3d3,0xc9))[_0x48ae('0x44')](handleError(_0x4bd3d3,null));};exports[_0x48ae('0x23')]=function(_0x130f9d,_0x1b015d){if(_0x130f9d['body']['id']){delete _0x130f9d[_0x48ae('0x48')]['id'];}return db[_0x48ae('0x2a')][_0x48ae('0x47')]({'where':{'id':_0x130f9d[_0x48ae('0x46')]['id']}})['then'](handleEntityNotFound(_0x1b015d,null))[_0x48ae('0x24')](saveUpdates(_0x130f9d['body'],null))[_0x48ae('0x24')](respondWithResult(_0x1b015d,null))[_0x48ae('0x44')](handleError(_0x1b015d,null));};exports[_0x48ae('0x49')]=function(_0x92eed5,_0x18c5b4){return db[_0x48ae('0x2a')][_0x48ae('0x47')]({'where':{'id':_0x92eed5[_0x48ae('0x46')]['id']}})[_0x48ae('0x24')](handleEntityNotFound(_0x18c5b4,null))['then'](removeEntity(_0x18c5b4,null))['catch'](handleError(_0x18c5b4,null));};exports[_0x48ae('0x4a')]=function(_0xc9b711,_0x3bcd0d,_0x2329ba){return db['VoiceMailMessage']['find']({'where':{'id':_0xc9b711[_0x48ae('0x46')]['id']},'attributes':['id','recording',_0x48ae('0x4b')]})[_0x48ae('0x24')](handleEntityNotFound(_0x3bcd0d,null))[_0x48ae('0x24')](function(_0x54da84){if(_0x54da84){if(!_0x54da84['recording']){throw new db['Sequelize'][(_0x48ae('0x4c'))]('VoiceMailMessage\x20not\x20found');}var _0x5234a1={'Content-Type':_0x48ae('0x4d'),'Content-Disposition':_0x48ae('0x4e')};if(_0x54da84[_0x48ae('0x4b')]){_0x5234a1[_0x48ae('0x4f')]=_0x48ae('0x50')+_0x54da84['msg_id']+_0x48ae('0x51');}_0x3bcd0d[_0x48ae('0x52')](_0x5234a1);return _0x3bcd0d['send'](new Buffer(_0x54da84[_0x48ae('0x53')]));}})[_0x48ae('0x44')](handleError(_0x3bcd0d,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index e9631f5..76e3dc5 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 _0x509c=['lodash','util','../../config/logger','api','bluebird','path','rimraf','./voiceMailMessage.attributes','define','VoiceMailMessage','dir'];(function(_0x163742,_0x467e36){var _0x1152ac=function(_0x40a83d){while(--_0x40a83d){_0x163742['push'](_0x163742['shift']());}};_0x1152ac(++_0x467e36);}(_0x509c,0x14a));var _0xc509=function(_0x4769ff,_0x127733){_0x4769ff=_0x4769ff-0x0;var _0x2362ba=_0x509c[_0x4769ff];return _0x2362ba;};'use strict';var _=require(_0xc509('0x0'));var util=require(_0xc509('0x1'));var logger=require(_0xc509('0x2'))(_0xc509('0x3'));var moment=require('moment');var BPromise=require(_0xc509('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc509('0x5'));var rimraf=require(_0xc509('0x6'));var config=require('../../config/environment');var attributes=require(_0xc509('0x7'));module['exports']=function(_0x21c88c,_0x4611ed){return _0x21c88c[_0xc509('0x8')](_0xc509('0x9'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0xc509('0xa'),'fields':[_0xc509('0xa')]}],'timestamps':![]});}; \ No newline at end of file +var _0xbe49=['lodash','util','api','moment','bluebird','request-promise','rimraf','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir'];(function(_0x32ebb4,_0x407cc0){var _0x24d383=function(_0x545166){while(--_0x545166){_0x32ebb4['push'](_0x32ebb4['shift']());}};_0x24d383(++_0x407cc0);}(_0xbe49,0x1ad));var _0x9be4=function(_0x187c95,_0x2ea76e){_0x187c95=_0x187c95-0x0;var _0x47ace8=_0xbe49[_0x187c95];return _0x47ace8;};'use strict';var _=require(_0x9be4('0x0'));var util=require(_0x9be4('0x1'));var logger=require('../../config/logger')(_0x9be4('0x2'));var moment=require(_0x9be4('0x3'));var BPromise=require(_0x9be4('0x4'));var rp=require(_0x9be4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9be4('0x6'));var config=require('../../config/environment');var attributes=require(_0x9be4('0x7'));module[_0x9be4('0x8')]=function(_0x566dcd,_0x3fa457){return _0x566dcd[_0x9be4('0x9')](_0x9be4('0xa'),attributes,{'tableName':_0x9be4('0xb'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0x9be4('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index d12cf30..a315d0b 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 _0xce62=['catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x213c52,_0x3de966){var _0x38a46f=function(_0x339813){while(--_0x339813){_0x213c52['push'](_0x213c52['shift']());}};_0x38a46f(++_0x3de966);}(_0xce62,0x143));var _0x2ce6=function(_0x1eaf23,_0x3cbfe1){_0x1eaf23=_0x1eaf23-0x0;var _0xf2cecd=_0xce62[_0x1eaf23];return _0xf2cecd;};'use strict';var _=require(_0x2ce6('0x0'));var util=require('util');var moment=require(_0x2ce6('0x1'));var BPromise=require(_0x2ce6('0x2'));var rs=require(_0x2ce6('0x3'));var fs=require('fs');var Redis=require(_0x2ce6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2ce6('0x5'));var logger=require(_0x2ce6('0x6'))(_0x2ce6('0x7'));var config=require(_0x2ce6('0x8'));var jayson=require(_0x2ce6('0x9'));var client=jayson[_0x2ce6('0xa')][_0x2ce6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a0818,_0x4d2f13,_0x36df82){return new BPromise(function(_0x427660,_0x1a3d9d){return client[_0x2ce6('0xc')](_0x4a0818,_0x36df82)[_0x2ce6('0xd')](function(_0x14a1b7){logger[_0x2ce6('0xe')](_0x2ce6('0xf'),_0x4d2f13,_0x2ce6('0x10'));logger[_0x2ce6('0x11')](_0x2ce6('0x12'),_0x4d2f13,_0x2ce6('0x10'),JSON['stringify'](_0x14a1b7));if(_0x14a1b7[_0x2ce6('0x13')]){if(_0x14a1b7['error'][_0x2ce6('0x14')]===0x1f4){logger[_0x2ce6('0x13')](_0x2ce6('0xf'),_0x4d2f13,_0x14a1b7[_0x2ce6('0x13')]['message']);return _0x1a3d9d(_0x14a1b7[_0x2ce6('0x13')]['message']);}logger[_0x2ce6('0x13')](_0x2ce6('0xf'),_0x4d2f13,_0x14a1b7[_0x2ce6('0x13')]['message']);return _0x427660(_0x14a1b7[_0x2ce6('0x13')][_0x2ce6('0x15')]);}else{logger[_0x2ce6('0xe')](_0x2ce6('0xf'),_0x4d2f13,_0x2ce6('0x10'));_0x427660(_0x14a1b7['result']['message']);}})[_0x2ce6('0x16')](function(_0x100988){logger[_0x2ce6('0x13')]('VoiceMailMessage,\x20%s,\x20%s',_0x4d2f13,_0x100988);_0x1a3d9d(_0x100988);});});} \ No newline at end of file +var _0xf3ac=['stringify','error','code','message','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s'];(function(_0x2b9d61,_0x2fc2e0){var _0x3b4218=function(_0x27a2fe){while(--_0x27a2fe){_0x2b9d61['push'](_0x2b9d61['shift']());}};_0x3b4218(++_0x2fc2e0);}(_0xf3ac,0xf5));var _0xcf3a=function(_0x2b4a7d,_0x2094ca){_0x2b4a7d=_0x2b4a7d-0x0;var _0x2d186e=_0xf3ac[_0x2b4a7d];return _0x2d186e;};'use strict';var _=require('lodash');var util=require(_0xcf3a('0x0'));var moment=require('moment');var BPromise=require(_0xcf3a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcf3a('0x2'));var db=require(_0xcf3a('0x3'))['db'];var utils=require(_0xcf3a('0x4'));var logger=require(_0xcf3a('0x5'))(_0xcf3a('0x6'));var config=require(_0xcf3a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xcf3a('0x8')][_0xcf3a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4043d5,_0x169dc1,_0x243bd4){return new BPromise(function(_0x14fbed,_0x450d8b){return client['request'](_0x4043d5,_0x243bd4)[_0xcf3a('0xa')](function(_0x55bbc1){logger[_0xcf3a('0xb')](_0xcf3a('0xc'),_0x169dc1,_0xcf3a('0xd'));logger['debug'](_0xcf3a('0xe'),_0x169dc1,_0xcf3a('0xd'),JSON[_0xcf3a('0xf')](_0x55bbc1));if(_0x55bbc1[_0xcf3a('0x10')]){if(_0x55bbc1[_0xcf3a('0x10')][_0xcf3a('0x11')]===0x1f4){logger['error'](_0xcf3a('0xc'),_0x169dc1,_0x55bbc1['error']['message']);return _0x450d8b(_0x55bbc1[_0xcf3a('0x10')][_0xcf3a('0x12')]);}logger[_0xcf3a('0x10')](_0xcf3a('0xc'),_0x169dc1,_0x55bbc1[_0xcf3a('0x10')][_0xcf3a('0x12')]);return _0x14fbed(_0x55bbc1['error'][_0xcf3a('0x12')]);}else{logger[_0xcf3a('0xb')](_0xcf3a('0xc'),_0x169dc1,'request\x20sent');_0x14fbed(_0x55bbc1['result'][_0xcf3a('0x12')]);}})[_0xcf3a('0x13')](function(_0xfffdc7){logger[_0xcf3a('0x10')](_0xcf3a('0xc'),_0x169dc1,_0xfffdc7);_0x450d8b(_0xfffdc7);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index b0f3ca5..1545dc8 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 _0x7bde=['index','get','/:id','isAuthenticated','show','getSounds','post','create','/:id/sounds','put','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller'];(function(_0x1f4807,_0x1196bc){var _0x41fe63=function(_0x1ec529){while(--_0x1ec529){_0x1f4807['push'](_0x1f4807['shift']());}};_0x41fe63(++_0x1196bc);}(_0x7bde,0x190));var _0xe7bd=function(_0x4776ba,_0x250658){_0x4776ba=_0x4776ba-0x0;var _0x354c17=_0x7bde[_0x4776ba];return _0x354c17;};'use strict';var multer=require('multer');var util=require(_0xe7bd('0x0'));var path=require('path');var timeout=require(_0xe7bd('0x1'));var express=require(_0xe7bd('0x2'));var router=express[_0xe7bd('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe7bd('0x4'));var interaction=require(_0xe7bd('0x5'));var config=require(_0xe7bd('0x6'));var controller=require(_0xe7bd('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xe7bd('0x8')]);router[_0xe7bd('0x9')](_0xe7bd('0xa'),auth[_0xe7bd('0xb')](),controller[_0xe7bd('0xc')]);router[_0xe7bd('0x9')]('/:id/sounds',auth[_0xe7bd('0xb')](),controller[_0xe7bd('0xd')]);router[_0xe7bd('0xe')]('/',auth[_0xe7bd('0xb')](),controller[_0xe7bd('0xf')]);router[_0xe7bd('0xe')](_0xe7bd('0x10'),auth[_0xe7bd('0xb')](),controller['addSound']);router[_0xe7bd('0x11')](_0xe7bd('0xa'),auth[_0xe7bd('0xb')](),controller[_0xe7bd('0x12')]);router[_0xe7bd('0x13')](_0xe7bd('0xa'),auth[_0xe7bd('0xb')](),controller[_0xe7bd('0x14')]);router[_0xe7bd('0x13')](_0xe7bd('0x15'),auth[_0xe7bd('0xb')](),controller[_0xe7bd('0x16')]);module[_0xe7bd('0x17')]=router; \ No newline at end of file +var _0x25ce=['../../components/auth/service','./voiceMusicOnHold.controller','get','index','/:id','isAuthenticated','/:id/sounds','getSounds','post','create','addSound','delete','destroy','/:id/sounds/:id2','exports','multer','util','path','connect-timeout','express'];(function(_0x54a36a,_0x4bea5e){var _0x5aa3b5=function(_0x471710){while(--_0x471710){_0x54a36a['push'](_0x54a36a['shift']());}};_0x5aa3b5(++_0x4bea5e);}(_0x25ce,0xff));var _0xe25c=function(_0x5ca0fc,_0x383373){_0x5ca0fc=_0x5ca0fc-0x0;var _0x25f4c2=_0x25ce[_0x5ca0fc];return _0x25f4c2;};'use strict';var multer=require(_0xe25c('0x0'));var util=require(_0xe25c('0x1'));var path=require(_0xe25c('0x2'));var timeout=require(_0xe25c('0x3'));var express=require(_0xe25c('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe25c('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe25c('0x6'));router[_0xe25c('0x7')]('/',auth['isAuthenticated'](),controller[_0xe25c('0x8')]);router[_0xe25c('0x7')](_0xe25c('0x9'),auth[_0xe25c('0xa')](),controller['show']);router[_0xe25c('0x7')](_0xe25c('0xb'),auth[_0xe25c('0xa')](),controller[_0xe25c('0xc')]);router[_0xe25c('0xd')]('/',auth[_0xe25c('0xa')](),controller[_0xe25c('0xe')]);router[_0xe25c('0xd')]('/:id/sounds',auth[_0xe25c('0xa')](),controller[_0xe25c('0xf')]);router['put'](_0xe25c('0x9'),auth[_0xe25c('0xa')](),controller['update']);router[_0xe25c('0x10')]('/:id',auth[_0xe25c('0xa')](),controller[_0xe25c('0x11')]);router[_0xe25c('0x10')](_0xe25c('0x12'),auth[_0xe25c('0xa')](),controller['removeSound']);module[_0xe25c('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index f12edf4..6271130 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 _0x21ea=['BOOLEAN','sequelize','exports','STRING','name','ENUM','custom','files','mp3nb','quietmp3nb','mp3','alpha','TIMESTAMP'];(function(_0x38d27f,_0x413200){var _0x149891=function(_0x41b104){while(--_0x41b104){_0x38d27f['push'](_0x38d27f['shift']());}};_0x149891(++_0x413200);}(_0x21ea,0x139));var _0xa21e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x21ea[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0xa21e('0x0'));module[_0xa21e('0x1')]={'name':{'type':Sequelize[_0xa21e('0x2')],'allowNull':![],'unique':_0xa21e('0x3')},'mode':{'type':Sequelize[_0xa21e('0x4')](_0xa21e('0x5'),_0xa21e('0x6'),_0xa21e('0x7'),_0xa21e('0x8'),'quietmp3',_0xa21e('0x9')),'allowNull':!![],'defaultValue':_0xa21e('0x6')},'directory':{'type':Sequelize[_0xa21e('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0xa21e('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0xa21e('0x2')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xa21e('0xa')},'format':{'type':Sequelize[_0xa21e('0x2')],'allowNull':!![]},'stamp':{'type':_0xa21e('0xb')},'defaultEntry':{'type':Sequelize[_0xa21e('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5f27=['TIMESTAMP','sequelize','ENUM','custom','files','mp3nb','quietmp3','mp3','STRING'];(function(_0x1a7984,_0x530266){var _0x2ab593=function(_0x1060d4){while(--_0x1060d4){_0x1a7984['push'](_0x1a7984['shift']());}};_0x2ab593(++_0x530266);}(_0x5f27,0x1de));var _0x75f2=function(_0x2bb4fb,_0x10406d){_0x2bb4fb=_0x2bb4fb-0x0;var _0x373a2b=_0x5f27[_0x2bb4fb];return _0x373a2b;};'use strict';var Sequelize=require(_0x75f2('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x75f2('0x1')](_0x75f2('0x2'),_0x75f2('0x3'),_0x75f2('0x4'),'quietmp3nb',_0x75f2('0x5'),_0x75f2('0x6')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0x75f2('0x7')],'allowNull':!![]},'application':{'type':Sequelize[_0x75f2('0x7')],'allowNull':!![]},'digit':{'type':Sequelize[_0x75f2('0x7')],'allowNull':!![]},'sort':{'type':Sequelize[_0x75f2('0x7')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0x75f2('0x7')],'allowNull':!![]},'stamp':{'type':_0x75f2('0x8')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 1d93ab5..cce4b9f 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 _0xb062=['format','extname','%s.%s','removeSound','id2','unlinkSync','getSounds','nolimit','eml-format','zip-dir','fast-json-patch','util','path','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','get','MusicOnHolds','UserProfileResource','destroy','error','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','model','query','filters','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','keys','intersection','length','body','params','create','files','join','root','server/files/moh','mode','mkdirSync','directory','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','forEach','rmdirSync','Sequelize','ValidationError','message','addSound','sequelize','transaction','Sound','findOne','save_name','converted_format','createdAt'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0xb062,0x14c));var _0x2b06=function(_0x156653,_0x36f82c){_0x156653=_0x156653-0x0;var _0x1ce075=_0xb062[_0x156653];return _0x1ce075;};'use strict';var emlformat=require(_0x2b06('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2b06('0x1'));var jsonpatch=require(_0x2b06('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2b06('0x3'));var path=require(_0x2b06('0x4'));var sox=require('sox');var csv=require(_0x2b06('0x5'));var ejs=require(_0x2b06('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2b06('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2b06('0x8'));var deskjs=require(_0x2b06('0x9'));var toCsv=require('to-csv');var querystring=require(_0x2b06('0xa'));var Papa=require(_0x2b06('0xb'));var Redis=require(_0x2b06('0xc'));var authService=require(_0x2b06('0xd'));var qs=require(_0x2b06('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2b06('0xf'));var logger=require('../../config/logger')(_0x2b06('0x10'));var utils=require(_0x2b06('0x11'));var config=require(_0x2b06('0x12'));var licenseUtil=require(_0x2b06('0x13'));var db=require(_0x2b06('0x14'))['db'];function respondWithStatusCode(_0x48b8ea,_0x437de2){_0x437de2=_0x437de2||0xcc;return function(_0x1f8bc0){if(_0x1f8bc0){return _0x48b8ea['sendStatus'](_0x437de2);}return _0x48b8ea['status'](_0x437de2)[_0x2b06('0x15')]();};}function respondWithResult(_0x100b57,_0x39fe6d){_0x39fe6d=_0x39fe6d||0xc8;return function(_0x3b149a){if(_0x3b149a){return _0x100b57[_0x2b06('0x16')](_0x39fe6d)[_0x2b06('0x17')](_0x3b149a);}};}function respondWithFilteredResult(_0x385672,_0x497011){return function(_0x563517){if(_0x563517){var _0x238127=typeof _0x497011[_0x2b06('0x18')]===_0x2b06('0x19')&&typeof _0x497011[_0x2b06('0x1a')]===_0x2b06('0x19');var _0x5c41fe=_0x563517['count'];var _0x32de32=_0x238127?0x0:_0x497011[_0x2b06('0x18')];var _0x393f5f=_0x238127?_0x563517[_0x2b06('0x1b')]:_0x497011['offset']+_0x497011[_0x2b06('0x1a')];var _0x54f62;if(_0x393f5f>=_0x5c41fe){_0x393f5f=_0x5c41fe;_0x54f62=0xc8;}else{_0x54f62=0xce;}_0x385672['status'](_0x54f62);return _0x385672[_0x2b06('0x1c')](_0x2b06('0x1d'),_0x32de32+'-'+_0x393f5f+'/'+_0x5c41fe)[_0x2b06('0x17')](_0x563517);}return null;};}function patchUpdates(_0x292ffe){return function(_0x1cc4e0){try{jsonpatch['apply'](_0x1cc4e0,_0x292ffe,!![]);}catch(_0x1d01e1){return BPromise['reject'](_0x1d01e1);}return _0x1cc4e0[_0x2b06('0x1e')]();};}function saveUpdates(_0x3cc154,_0x5df13d){return function(_0x55602f){if(_0x55602f){return _0x55602f[_0x2b06('0x1f')](_0x3cc154)['then'](function(_0x5863ed){return _0x5863ed;});}return null;};}function removeEntity(_0x5b56c3,_0x18894e){return function(_0x504d28){if(_0x504d28){return _0x504d28['destroy']()[_0x2b06('0x20')](function(){var _0x309b49=_0x504d28[_0x2b06('0x21')]({'plain':!![]});var _0x5ca8e2=_0x2b06('0x22');return db[_0x2b06('0x23')][_0x2b06('0x24')]({'where':{'type':_0x5ca8e2,'resourceId':_0x309b49['id']}})[_0x2b06('0x20')](function(){return _0x504d28;});})[_0x2b06('0x20')](function(){_0x5b56c3[_0x2b06('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44660d,_0x118808){return function(_0x50b2db){if(!_0x50b2db){_0x44660d['sendStatus'](0x194);}return _0x50b2db;};}function handleError(_0x2b6cff,_0x977a77){_0x977a77=_0x977a77||0x1f4;return function(_0x5e2a1f){logger[_0x2b06('0x25')](_0x5e2a1f['stack']);if(_0x5e2a1f[_0x2b06('0x26')]){delete _0x5e2a1f[_0x2b06('0x26')];}_0x2b6cff['status'](_0x977a77)[_0x2b06('0x27')](_0x5e2a1f);};}exports[_0x2b06('0x28')]=function(_0x10649c,_0x28acaa){var _0x4db73e={},_0x49e2ad={},_0x4671cd={'count':0x0,'rows':[]};var _0xb09ca7=_[_0x2b06('0x29')](db[_0x2b06('0x2a')][_0x2b06('0x2b')],function(_0x1465bb){return{'name':_0x1465bb[_0x2b06('0x2c')],'type':_0x1465bb[_0x2b06('0x2d')]['key']};});_0x49e2ad[_0x2b06('0x2e')]=_[_0x2b06('0x29')](_0xb09ca7,_0x2b06('0x26'));_0x49e2ad[_0x2b06('0x2f')]=_['keys'](_0x10649c['query']);_0x49e2ad[_0x2b06('0x30')]=_['intersection'](_0x49e2ad[_0x2b06('0x2e')],_0x49e2ad[_0x2b06('0x2f')]);_0x4db73e[_0x2b06('0x31')]=_['intersection'](_0x49e2ad[_0x2b06('0x2e')],qs['fields'](_0x10649c[_0x2b06('0x2f')][_0x2b06('0x32')]));_0x4db73e[_0x2b06('0x31')]=_0x4db73e[_0x2b06('0x31')]['length']?_0x4db73e[_0x2b06('0x31')]:_0x49e2ad[_0x2b06('0x2e')];if(!_0x10649c[_0x2b06('0x2f')][_0x2b06('0x33')]('nolimit')){_0x4db73e[_0x2b06('0x1a')]=qs[_0x2b06('0x1a')](_0x10649c[_0x2b06('0x2f')]['limit']);_0x4db73e[_0x2b06('0x18')]=qs[_0x2b06('0x18')](_0x10649c['query'][_0x2b06('0x18')]);}_0x4db73e[_0x2b06('0x34')]=qs[_0x2b06('0x35')](_0x10649c[_0x2b06('0x2f')][_0x2b06('0x35')]);delete _0x10649c[_0x2b06('0x2f')]['sort'];_0x4db73e[_0x2b06('0x36')]=qs[_0x2b06('0x30')](_[_0x2b06('0x37')](_0x10649c[_0x2b06('0x2f')],_0x49e2ad[_0x2b06('0x30')]),_0xb09ca7);if(_0x10649c[_0x2b06('0x2f')][_0x2b06('0x38')]){_0x4db73e[_0x2b06('0x36')]=_[_0x2b06('0x39')](_0x4db73e[_0x2b06('0x36')],{'$or':_[_0x2b06('0x29')](_0xb09ca7,function(_0x19c479){if(_0x19c479[_0x2b06('0x2d')]!=='VIRTUAL'){var _0x2c5517={};_0x2c5517[_0x19c479['name']]={'$like':'%'+_0x10649c['query']['filter']+'%'};return _0x2c5517;}})});}_0x4db73e=_['merge']({},_0x4db73e,_0x10649c[_0x2b06('0x3a')]);var _0x40a7a7={'where':_0x4db73e['where']};return db[_0x2b06('0x2a')][_0x2b06('0x1b')](_0x40a7a7)[_0x2b06('0x20')](function(_0x4ca9cb){_0x4671cd[_0x2b06('0x1b')]=_0x4ca9cb;if(_0x10649c[_0x2b06('0x2f')][_0x2b06('0x3b')]){_0x4db73e[_0x2b06('0x3c')]=[{'all':!![]}];}return db[_0x2b06('0x2a')][_0x2b06('0x3d')](_0x4db73e);})[_0x2b06('0x20')](function(_0x3ab0ae){_0x4671cd[_0x2b06('0x3e')]=_0x3ab0ae;return _0x4671cd;})[_0x2b06('0x20')](respondWithFilteredResult(_0x28acaa,_0x4db73e))[_0x2b06('0x3f')](handleError(_0x28acaa,null));};exports[_0x2b06('0x40')]=function(_0x217271,_0x31af25){var _0x35eb94={'raw':![],'where':{'id':_0x217271['params']['id']}},_0x589b78={};_0x589b78[_0x2b06('0x2e')]=_[_0x2b06('0x41')](db[_0x2b06('0x2a')]['rawAttributes']);_0x589b78[_0x2b06('0x2f')]=_[_0x2b06('0x41')](_0x217271['query']);_0x589b78[_0x2b06('0x30')]=_[_0x2b06('0x42')](_0x589b78[_0x2b06('0x2e')],_0x589b78['query']);_0x35eb94[_0x2b06('0x31')]=_[_0x2b06('0x42')](_0x589b78['model'],qs['fields'](_0x217271[_0x2b06('0x2f')]['fields']));_0x35eb94[_0x2b06('0x31')]=_0x35eb94[_0x2b06('0x31')][_0x2b06('0x43')]?_0x35eb94[_0x2b06('0x31')]:_0x589b78[_0x2b06('0x2e')];if(_0x217271[_0x2b06('0x2f')]['includeAll']){_0x35eb94['include']=[{'all':!![]}];}_0x35eb94=_[_0x2b06('0x39')]({},_0x35eb94,_0x217271['options']);return db[_0x2b06('0x2a')]['find'](_0x35eb94)[_0x2b06('0x20')](handleEntityNotFound(_0x31af25,null))[_0x2b06('0x20')](respondWithResult(_0x31af25,null))[_0x2b06('0x3f')](handleError(_0x31af25,null));};exports[_0x2b06('0x1f')]=function(_0x554b90,_0x5f1c60){if(_0x554b90[_0x2b06('0x44')]['id']){delete _0x554b90[_0x2b06('0x44')]['id'];}return db['VoiceMusicOnHold']['find']({'where':{'id':_0x554b90[_0x2b06('0x45')]['id']}})[_0x2b06('0x20')](handleEntityNotFound(_0x5f1c60,null))['then'](saveUpdates(_0x554b90[_0x2b06('0x44')],null))[_0x2b06('0x20')](respondWithResult(_0x5f1c60,null))[_0x2b06('0x3f')](handleError(_0x5f1c60,null));};exports[_0x2b06('0x46')]=function(_0x4c60f5,_0xb6303,_0x9e1d2b){return db['sequelize']['transaction'](function(_0x5b47cf){if(_0x4c60f5['body']['mode']===_0x2b06('0x47')){_0x4c60f5['body']['directory']=path[_0x2b06('0x48')](config[_0x2b06('0x49')],_0x2b06('0x4a'),_0x4c60f5['body'][_0x2b06('0x26')]);}return db[_0x2b06('0x2a')][_0x2b06('0x46')](_0x4c60f5[_0x2b06('0x44')],{'transaction':_0x5b47cf})[_0x2b06('0x20')](function(_0x21c11f){if(_0x4c60f5['body'][_0x2b06('0x4b')]===_0x2b06('0x47')){fs[_0x2b06('0x4c')](_0x21c11f[_0x2b06('0x4d')],parseInt(_0x2b06('0x4e'),0x8));}var _0x560df8=_0x4c60f5[_0x2b06('0x4f')][_0x2b06('0x21')]({'plain':!![]});if(!_0x560df8)throw new Error(_0x2b06('0x50'));if(_0x560df8[_0x2b06('0x51')]==='user'){var _0x32fea3=_0x21c11f[_0x2b06('0x21')]({'plain':!![]});return db[_0x2b06('0x52')][_0x2b06('0x53')]({'where':{'name':'MusicOnHolds','userProfileId':_0x560df8[_0x2b06('0x54')]},'raw':!![]})['then'](function(_0x4a107e){if(_0x4a107e&&_0x4a107e[_0x2b06('0x55')]===0x0){return db[_0x2b06('0x23')]['create']({'name':_0x32fea3[_0x2b06('0x26')],'resourceId':_0x32fea3['id'],'type':_0x4a107e[_0x2b06('0x26')],'sectionId':_0x4a107e['id']},{})[_0x2b06('0x20')](function(){return _0x21c11f;});}else{return _0x21c11f;}})[_0x2b06('0x3f')](function(_0x265b76){logger[_0x2b06('0x25')](_0x2b06('0x56'),_0x265b76);});}return _0x21c11f;});})['then'](respondWithResult(_0xb6303,0xc9))[_0x2b06('0x3f')](handleError(_0xb6303,null));};exports[_0x2b06('0x24')]=function(_0x5c63e3,_0x5e7f96,_0x54803f){var _0x1f5fae;return db[_0x2b06('0x2a')]['find']({'where':{'id':_0x5c63e3[_0x2b06('0x45')]['id']}})['then'](function(_0xfdef0b){if(_0xfdef0b){return db['sequelize']['transaction'](function(_0x120652){return _0xfdef0b[_0x2b06('0x24')]({'transaction':_0x120652,'raw':!![]})[_0x2b06('0x20')](function(_0x57a73c){if(_0x57a73c['directory']){fs['readdirSync'](_0x57a73c[_0x2b06('0x4d')])[_0x2b06('0x57')](function(_0x4a36cc){fs['unlinkSync'](path[_0x2b06('0x48')](_0x57a73c[_0x2b06('0x4d')],_0x4a36cc));});fs[_0x2b06('0x58')](_0x57a73c['directory']);}return _0x57a73c;});})[_0x2b06('0x3f')](function(_0x425eb5){throw new db[(_0x2b06('0x59'))][(_0x2b06('0x5a'))](_0x425eb5[_0x2b06('0x5b')]);});}})[_0x2b06('0x20')](handleEntityNotFound(_0x5e7f96,null))['then'](removeEntity(_0x5e7f96,null))[_0x2b06('0x3f')](handleError(_0x5e7f96,null));};exports[_0x2b06('0x5c')]=function(_0x5412bc,_0x2e9f5d,_0x3264d5){return db[_0x2b06('0x5d')][_0x2b06('0x5e')](function(_0x40ec35){var _0x574c2b;return db[_0x2b06('0x2a')][_0x2b06('0x53')]({'where':{'id':_0x5412bc['params']['id']}})['then'](function(_0x306616){if(_0x306616){_0x574c2b=_0x306616;return _0x306616[_0x2b06('0x5c')](_0x5412bc[_0x2b06('0x44')]['id'],{'transaction':_0x40ec35});}})[_0x2b06('0x20')](function(_0xe7d37){if(_0xe7d37){return db[_0x2b06('0x5f')][_0x2b06('0x60')]({'where':{'id':_0x5412bc[_0x2b06('0x44')]['id']},'attributes':['id',_0x2b06('0x26'),_0x2b06('0x61'),_0x2b06('0x62'),_0x2b06('0x63')],'raw':!![]});}})['then'](function(_0x2b70f6){if(_0x2b70f6){var _0x1e0cfc=path[_0x2b06('0x48')](config[_0x2b06('0x49')],'server/files/sounds/converted',util[_0x2b06('0x64')]('%s.%s',path['basename'](_0x2b70f6[_0x2b06('0x61')],path[_0x2b06('0x65')](_0x2b70f6[_0x2b06('0x61')])),_0x2b70f6[_0x2b06('0x62')]));var _0x2fc9a1=path[_0x2b06('0x48')](config[_0x2b06('0x49')],_0x2b06('0x4a'),_0x574c2b[_0x2b06('0x26')],util[_0x2b06('0x64')](_0x2b06('0x66'),_0x2b70f6[_0x2b06('0x26')],_0x2b70f6['converted_format']));fs['symlinkSync'](_0x1e0cfc,_0x2fc9a1);return _0x2b70f6;}})['catch'](function(_0x47a5ae){throw new db[(_0x2b06('0x59'))][(_0x2b06('0x5a'))](_0x47a5ae[_0x2b06('0x5b')]);});})[_0x2b06('0x20')](handleEntityNotFound(_0x2e9f5d,null))[_0x2b06('0x20')](respondWithResult(_0x2e9f5d,0xc9))[_0x2b06('0x3f')](handleError(_0x2e9f5d,null));};exports[_0x2b06('0x67')]=function(_0x16cad7,_0x8a2371,_0x22e0d3){return db[_0x2b06('0x5d')][_0x2b06('0x5e')](function(_0x5d9e88){var _0x1a879c;return db[_0x2b06('0x2a')][_0x2b06('0x60')]({'where':{'id':_0x16cad7[_0x2b06('0x45')]['id']}})[_0x2b06('0x20')](handleEntityNotFound(_0x8a2371,null))[_0x2b06('0x20')](function(_0x1d2a1d){if(_0x1d2a1d){_0x1a879c=_0x1d2a1d;return _0x1d2a1d['removeSound'](_0x16cad7[_0x2b06('0x45')]['id2']);}})[_0x2b06('0x20')](function(_0x5622bd){if(_0x5622bd){return db[_0x2b06('0x5f')]['findOne']({'where':{'id':_0x16cad7[_0x2b06('0x45')][_0x2b06('0x68')]},'attributes':['id',_0x2b06('0x26'),_0x2b06('0x61'),_0x2b06('0x62'),_0x2b06('0x63')],'raw':!![]});}})['then'](function(_0x283a34){if(_0x283a34){fs[_0x2b06('0x69')](path[_0x2b06('0x48')](_0x1a879c['directory'],util[_0x2b06('0x64')](_0x2b06('0x66'),_0x283a34[_0x2b06('0x26')],_0x283a34[_0x2b06('0x62')])));return _0x283a34;}})[_0x2b06('0x3f')](function(_0x29f710){throw new db[(_0x2b06('0x59'))][(_0x2b06('0x5a'))](_0x29f710[_0x2b06('0x5b')]);});})[_0x2b06('0x20')](handleEntityNotFound(_0x8a2371,null))[_0x2b06('0x20')](respondWithStatusCode(_0x8a2371,0xcc))['catch'](handleError(_0x8a2371,null));};exports['getSounds']=function(_0xfba2fa,_0xfcfcbf,_0x264584){var _0x38e569={};var _0x1cf1f8={};var _0x334bf7;var _0x4e618d;return db[_0x2b06('0x2a')]['findOne']({'where':{'id':_0xfba2fa[_0x2b06('0x45')]['id']}})[_0x2b06('0x20')](handleEntityNotFound(_0xfcfcbf,null))[_0x2b06('0x20')](function(_0x4e3908){if(_0x4e3908){_0x334bf7=_0x4e3908;_0x1cf1f8[_0x2b06('0x2e')]=_[_0x2b06('0x41')](db[_0x2b06('0x5f')][_0x2b06('0x2b')]);_0x1cf1f8[_0x2b06('0x2f')]=_[_0x2b06('0x41')](_0xfba2fa[_0x2b06('0x2f')]);_0x1cf1f8[_0x2b06('0x30')]=_[_0x2b06('0x42')](_0x1cf1f8[_0x2b06('0x2e')],_0x1cf1f8[_0x2b06('0x2f')]);_0x38e569[_0x2b06('0x31')]=_[_0x2b06('0x42')](_0x1cf1f8['model'],qs['fields'](_0xfba2fa[_0x2b06('0x2f')][_0x2b06('0x32')]));_0x38e569[_0x2b06('0x31')]=_0x38e569[_0x2b06('0x31')][_0x2b06('0x43')]?_0x38e569[_0x2b06('0x31')]:_0x1cf1f8[_0x2b06('0x2e')];_0x38e569[_0x2b06('0x34')]=qs[_0x2b06('0x35')](_0xfba2fa[_0x2b06('0x2f')][_0x2b06('0x35')]);_0x38e569[_0x2b06('0x36')]=qs[_0x2b06('0x30')](_['pick'](_0xfba2fa['query'],_0x1cf1f8[_0x2b06('0x30')]));if(_0xfba2fa['query'][_0x2b06('0x38')]){_0x38e569[_0x2b06('0x36')]=_['merge'](_0x38e569[_0x2b06('0x36')],{'$or':_['map'](_0x38e569[_0x2b06('0x31')],function(_0x3cd756){var _0x213ea5={};_0x213ea5[_0x3cd756]={'$like':'%'+_0xfba2fa['query'][_0x2b06('0x38')]+'%'};return _0x213ea5;})});}_0x38e569=_['merge']({},_0x38e569,_0xfba2fa[_0x2b06('0x3a')]);return _0x334bf7[_0x2b06('0x6a')](_0x38e569);}})[_0x2b06('0x20')](function(_0xaf1f0c){if(_0xaf1f0c){_0x4e618d=_0xaf1f0c[_0x2b06('0x43')];if(!_0xfba2fa[_0x2b06('0x2f')][_0x2b06('0x33')](_0x2b06('0x6b'))){_0x38e569[_0x2b06('0x1a')]=qs[_0x2b06('0x1a')](_0xfba2fa[_0x2b06('0x2f')][_0x2b06('0x1a')]);_0x38e569[_0x2b06('0x18')]=qs[_0x2b06('0x18')](_0xfba2fa[_0x2b06('0x2f')][_0x2b06('0x18')]);}return _0x334bf7[_0x2b06('0x6a')](_0x38e569);}})[_0x2b06('0x20')](function(_0x4379f3){if(_0x4379f3){return _0x4379f3?{'count':_0x4e618d,'rows':_0x4379f3}:null;}})[_0x2b06('0x20')](respondWithResult(_0xfcfcbf,null))[_0x2b06('0x3f')](handleError(_0xfcfcbf,null));}; \ No newline at end of file +var _0xde7e=['model','attributes','fields','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','includeAll','findAll','rows','catch','show','params','include','options','body','find','mode','files','join','root','server/files/moh','create','mkdirSync','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','transaction','directory','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','converted_format','%s.%s','save_name','extname','format','symlinkSync','removeSound','id2','createdAt','getSounds','order','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','apply','reject','update','then','MusicOnHolds','UserProfileResource','destroy','name','send','index','VoiceMusicOnHold','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection'];(function(_0x418b04,_0x2f6322){var _0x344861=function(_0x58f62b){while(--_0x58f62b){_0x418b04['push'](_0x418b04['shift']());}};_0x344861(++_0x2f6322);}(_0xde7e,0x186));var _0xede7=function(_0x27ab37,_0x4cdd7b){_0x27ab37=_0x27ab37-0x0;var _0x3b3da6=_0xde7e[_0x27ab37];return _0x3b3da6;};'use strict';var emlformat=require(_0xede7('0x0'));var rimraf=require(_0xede7('0x1'));var zipdir=require(_0xede7('0x2'));var jsonpatch=require(_0xede7('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xede7('0x4'));var Mustache=require(_0xede7('0x5'));var util=require('util');var path=require(_0xede7('0x6'));var sox=require(_0xede7('0x7'));var csv=require(_0xede7('0x8'));var ejs=require(_0xede7('0x9'));var fs=require('fs');var fs_extra=require(_0xede7('0xa'));var _=require(_0xede7('0xb'));var squel=require(_0xede7('0xc'));var crypto=require(_0xede7('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xede7('0xe'));var toCsv=require(_0xede7('0x8'));var querystring=require('querystring');var Papa=require(_0xede7('0xf'));var Redis=require(_0xede7('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xede7('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xede7('0x12'));var logger=require(_0xede7('0x13'))('api');var utils=require(_0xede7('0x14'));var config=require(_0xede7('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xede7('0x16'))['db'];function respondWithStatusCode(_0xd3d2ca,_0x3959bf){_0x3959bf=_0x3959bf||0xcc;return function(_0x3cdcc1){if(_0x3cdcc1){return _0xd3d2ca[_0xede7('0x17')](_0x3959bf);}return _0xd3d2ca[_0xede7('0x18')](_0x3959bf)['end']();};}function respondWithResult(_0x2da84f,_0x396e2b){_0x396e2b=_0x396e2b||0xc8;return function(_0xf2eec8){if(_0xf2eec8){return _0x2da84f['status'](_0x396e2b)['json'](_0xf2eec8);}};}function respondWithFilteredResult(_0x4f5a6d,_0x31d914){return function(_0x2f651f){if(_0x2f651f){var _0x448139=typeof _0x31d914[_0xede7('0x19')]===_0xede7('0x1a')&&typeof _0x31d914[_0xede7('0x1b')]==='undefined';var _0xe350d2=_0x2f651f[_0xede7('0x1c')];var _0x353546=_0x448139?0x0:_0x31d914[_0xede7('0x19')];var _0x37bf89=_0x448139?_0x2f651f[_0xede7('0x1c')]:_0x31d914['offset']+_0x31d914['limit'];var _0x27bdf9;if(_0x37bf89>=_0xe350d2){_0x37bf89=_0xe350d2;_0x27bdf9=0xc8;}else{_0x27bdf9=0xce;}_0x4f5a6d['status'](_0x27bdf9);return _0x4f5a6d['set'](_0xede7('0x1d'),_0x353546+'-'+_0x37bf89+'/'+_0xe350d2)['json'](_0x2f651f);}return null;};}function patchUpdates(_0x10cab0){return function(_0x318c89){try{jsonpatch[_0xede7('0x1e')](_0x318c89,_0x10cab0,!![]);}catch(_0x443032){return BPromise[_0xede7('0x1f')](_0x443032);}return _0x318c89['save']();};}function saveUpdates(_0x21bbb1,_0xe0ddf2){return function(_0x4896f2){if(_0x4896f2){return _0x4896f2[_0xede7('0x20')](_0x21bbb1)[_0xede7('0x21')](function(_0x4391cb){return _0x4391cb;});}return null;};}function removeEntity(_0x4bc9ee,_0x15c598){return function(_0x4f1e70){if(_0x4f1e70){return _0x4f1e70['destroy']()[_0xede7('0x21')](function(){var _0x2958d2=_0x4f1e70['get']({'plain':!![]});var _0x46a544=_0xede7('0x22');return db[_0xede7('0x23')][_0xede7('0x24')]({'where':{'type':_0x46a544,'resourceId':_0x2958d2['id']}})['then'](function(){return _0x4f1e70;});})['then'](function(){_0x4bc9ee[_0xede7('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x239bac,_0x333a17){return function(_0x4298e5){if(!_0x4298e5){_0x239bac['sendStatus'](0x194);}return _0x4298e5;};}function handleError(_0x4d5403,_0x67c851){_0x67c851=_0x67c851||0x1f4;return function(_0x353dc6){logger['error'](_0x353dc6['stack']);if(_0x353dc6[_0xede7('0x25')]){delete _0x353dc6[_0xede7('0x25')];}_0x4d5403['status'](_0x67c851)[_0xede7('0x26')](_0x353dc6);};}exports[_0xede7('0x27')]=function(_0x505768,_0x14c26f){var _0x20dc1a={},_0x2dace0={},_0x1dc9c4={'count':0x0,'rows':[]};var _0xa69af7=_['map'](db[_0xede7('0x28')][_0xede7('0x29')],function(_0x58fc39){return{'name':_0x58fc39[_0xede7('0x2a')],'type':_0x58fc39[_0xede7('0x2b')][_0xede7('0x2c')]};});_0x2dace0['model']=_[_0xede7('0x2d')](_0xa69af7,'name');_0x2dace0[_0xede7('0x2e')]=_[_0xede7('0x2f')](_0x505768[_0xede7('0x2e')]);_0x2dace0[_0xede7('0x30')]=_[_0xede7('0x31')](_0x2dace0[_0xede7('0x32')],_0x2dace0['query']);_0x20dc1a[_0xede7('0x33')]=_[_0xede7('0x31')](_0x2dace0[_0xede7('0x32')],qs[_0xede7('0x34')](_0x505768[_0xede7('0x2e')]['fields']));_0x20dc1a[_0xede7('0x33')]=_0x20dc1a[_0xede7('0x33')][_0xede7('0x35')]?_0x20dc1a['attributes']:_0x2dace0[_0xede7('0x32')];if(!_0x505768[_0xede7('0x2e')]['hasOwnProperty'](_0xede7('0x36'))){_0x20dc1a[_0xede7('0x1b')]=qs['limit'](_0x505768[_0xede7('0x2e')][_0xede7('0x1b')]);_0x20dc1a[_0xede7('0x19')]=qs['offset'](_0x505768[_0xede7('0x2e')][_0xede7('0x19')]);}_0x20dc1a['order']=qs[_0xede7('0x37')](_0x505768[_0xede7('0x2e')][_0xede7('0x37')]);delete _0x505768['query'][_0xede7('0x37')];_0x20dc1a[_0xede7('0x38')]=qs['filters'](_[_0xede7('0x39')](_0x505768[_0xede7('0x2e')],_0x2dace0[_0xede7('0x30')]),_0xa69af7);if(_0x505768[_0xede7('0x2e')][_0xede7('0x3a')]){_0x20dc1a['where']=_['merge'](_0x20dc1a['where'],{'$or':_[_0xede7('0x2d')](_0xa69af7,function(_0x5bfe21){if(_0x5bfe21[_0xede7('0x2b')]!==_0xede7('0x3b')){var _0x343f71={};_0x343f71[_0x5bfe21[_0xede7('0x25')]]={'$like':'%'+_0x505768[_0xede7('0x2e')]['filter']+'%'};return _0x343f71;}})});}_0x20dc1a=_[_0xede7('0x3c')]({},_0x20dc1a,_0x505768['options']);var _0x533303={'where':_0x20dc1a['where']};return db[_0xede7('0x28')]['count'](_0x533303)['then'](function(_0x426fb3){_0x1dc9c4[_0xede7('0x1c')]=_0x426fb3;if(_0x505768['query'][_0xede7('0x3d')]){_0x20dc1a['include']=[{'all':!![]}];}return db[_0xede7('0x28')][_0xede7('0x3e')](_0x20dc1a);})[_0xede7('0x21')](function(_0x10fb8b){_0x1dc9c4[_0xede7('0x3f')]=_0x10fb8b;return _0x1dc9c4;})[_0xede7('0x21')](respondWithFilteredResult(_0x14c26f,_0x20dc1a))[_0xede7('0x40')](handleError(_0x14c26f,null));};exports[_0xede7('0x41')]=function(_0x4e66a2,_0xc757c3){var _0x29cb8a={'raw':![],'where':{'id':_0x4e66a2[_0xede7('0x42')]['id']}},_0x1fe1c7={};_0x1fe1c7[_0xede7('0x32')]=_[_0xede7('0x2f')](db[_0xede7('0x28')][_0xede7('0x29')]);_0x1fe1c7[_0xede7('0x2e')]=_[_0xede7('0x2f')](_0x4e66a2[_0xede7('0x2e')]);_0x1fe1c7[_0xede7('0x30')]=_['intersection'](_0x1fe1c7['model'],_0x1fe1c7[_0xede7('0x2e')]);_0x29cb8a[_0xede7('0x33')]=_[_0xede7('0x31')](_0x1fe1c7['model'],qs[_0xede7('0x34')](_0x4e66a2[_0xede7('0x2e')][_0xede7('0x34')]));_0x29cb8a['attributes']=_0x29cb8a['attributes'][_0xede7('0x35')]?_0x29cb8a['attributes']:_0x1fe1c7[_0xede7('0x32')];if(_0x4e66a2[_0xede7('0x2e')][_0xede7('0x3d')]){_0x29cb8a[_0xede7('0x43')]=[{'all':!![]}];}_0x29cb8a=_['merge']({},_0x29cb8a,_0x4e66a2[_0xede7('0x44')]);return db[_0xede7('0x28')]['find'](_0x29cb8a)[_0xede7('0x21')](handleEntityNotFound(_0xc757c3,null))[_0xede7('0x21')](respondWithResult(_0xc757c3,null))[_0xede7('0x40')](handleError(_0xc757c3,null));};exports['update']=function(_0x9083f8,_0x4c3985){if(_0x9083f8[_0xede7('0x45')]['id']){delete _0x9083f8[_0xede7('0x45')]['id'];}return db['VoiceMusicOnHold'][_0xede7('0x46')]({'where':{'id':_0x9083f8[_0xede7('0x42')]['id']}})['then'](handleEntityNotFound(_0x4c3985,null))[_0xede7('0x21')](saveUpdates(_0x9083f8[_0xede7('0x45')],null))[_0xede7('0x21')](respondWithResult(_0x4c3985,null))[_0xede7('0x40')](handleError(_0x4c3985,null));};exports['create']=function(_0x28823d,_0x28a36a,_0x1ff427){return db['sequelize']['transaction'](function(_0x1dbe65){if(_0x28823d[_0xede7('0x45')][_0xede7('0x47')]===_0xede7('0x48')){_0x28823d[_0xede7('0x45')]['directory']=path[_0xede7('0x49')](config[_0xede7('0x4a')],_0xede7('0x4b'),_0x28823d[_0xede7('0x45')][_0xede7('0x25')]);}return db[_0xede7('0x28')][_0xede7('0x4c')](_0x28823d[_0xede7('0x45')],{'transaction':_0x1dbe65})[_0xede7('0x21')](function(_0x12a7d8){if(_0x28823d['body'][_0xede7('0x47')]===_0xede7('0x48')){fs[_0xede7('0x4d')](_0x12a7d8['directory'],parseInt('0777',0x8));}var _0x41fb2a=_0x28823d[_0xede7('0x4e')][_0xede7('0x4f')]({'plain':!![]});if(!_0x41fb2a)throw new Error(_0xede7('0x50'));if(_0x41fb2a[_0xede7('0x51')]===_0xede7('0x4e')){var _0x57e05a=_0x12a7d8[_0xede7('0x4f')]({'plain':!![]});return db['UserProfileSection'][_0xede7('0x46')]({'where':{'name':_0xede7('0x22'),'userProfileId':_0x41fb2a[_0xede7('0x52')]},'raw':!![]})[_0xede7('0x21')](function(_0x120cfc){if(_0x120cfc&&_0x120cfc[_0xede7('0x53')]===0x0){return db[_0xede7('0x23')][_0xede7('0x4c')]({'name':_0x57e05a[_0xede7('0x25')],'resourceId':_0x57e05a['id'],'type':_0x120cfc[_0xede7('0x25')],'sectionId':_0x120cfc['id']},{})[_0xede7('0x21')](function(){return _0x12a7d8;});}else{return _0x12a7d8;}})[_0xede7('0x40')](function(_0x1affd6){logger['error'](_0xede7('0x54'),_0x1affd6);});}return _0x12a7d8;});})[_0xede7('0x21')](respondWithResult(_0x28a36a,0xc9))[_0xede7('0x40')](handleError(_0x28a36a,null));};exports[_0xede7('0x24')]=function(_0x2ce089,_0x19abe7,_0x105f9f){var _0x1f19ce;return db[_0xede7('0x28')][_0xede7('0x46')]({'where':{'id':_0x2ce089[_0xede7('0x42')]['id']}})[_0xede7('0x21')](function(_0x49e2f2){if(_0x49e2f2){return db[_0xede7('0x55')][_0xede7('0x56')](function(_0x1fe67b){return _0x49e2f2[_0xede7('0x24')]({'transaction':_0x1fe67b,'raw':!![]})[_0xede7('0x21')](function(_0x215af8){if(_0x215af8[_0xede7('0x57')]){fs[_0xede7('0x58')](_0x215af8[_0xede7('0x57')])[_0xede7('0x59')](function(_0x476662){fs[_0xede7('0x5a')](path['join'](_0x215af8[_0xede7('0x57')],_0x476662));});fs[_0xede7('0x5b')](_0x215af8['directory']);}return _0x215af8;});})[_0xede7('0x40')](function(_0x21bfcc){throw new db[(_0xede7('0x5c'))][(_0xede7('0x5d'))](_0x21bfcc[_0xede7('0x5e')]);});}})[_0xede7('0x21')](handleEntityNotFound(_0x19abe7,null))[_0xede7('0x21')](removeEntity(_0x19abe7,null))[_0xede7('0x40')](handleError(_0x19abe7,null));};exports['addSound']=function(_0x17c204,_0x14c3cc,_0x397a22){return db['sequelize'][_0xede7('0x56')](function(_0x2cf595){var _0x21f719;return db[_0xede7('0x28')]['find']({'where':{'id':_0x17c204[_0xede7('0x42')]['id']}})[_0xede7('0x21')](function(_0x3df969){if(_0x3df969){_0x21f719=_0x3df969;return _0x3df969[_0xede7('0x5f')](_0x17c204[_0xede7('0x45')]['id'],{'transaction':_0x2cf595});}})[_0xede7('0x21')](function(_0x17cd35){if(_0x17cd35){return db[_0xede7('0x60')][_0xede7('0x61')]({'where':{'id':_0x17c204[_0xede7('0x45')]['id']},'attributes':['id',_0xede7('0x25'),'save_name',_0xede7('0x62'),'createdAt'],'raw':!![]});}})[_0xede7('0x21')](function(_0x4ac9af){if(_0x4ac9af){var _0x1c6650=path[_0xede7('0x49')](config[_0xede7('0x4a')],'server/files/sounds/converted',util['format'](_0xede7('0x63'),path['basename'](_0x4ac9af[_0xede7('0x64')],path[_0xede7('0x65')](_0x4ac9af[_0xede7('0x64')])),_0x4ac9af[_0xede7('0x62')]));var _0x39ba0f=path[_0xede7('0x49')](config[_0xede7('0x4a')],_0xede7('0x4b'),_0x21f719[_0xede7('0x25')],util[_0xede7('0x66')]('%s.%s',_0x4ac9af[_0xede7('0x25')],_0x4ac9af['converted_format']));fs[_0xede7('0x67')](_0x1c6650,_0x39ba0f);return _0x4ac9af;}})['catch'](function(_0x175b37){throw new db['Sequelize'][(_0xede7('0x5d'))](_0x175b37[_0xede7('0x5e')]);});})[_0xede7('0x21')](handleEntityNotFound(_0x14c3cc,null))[_0xede7('0x21')](respondWithResult(_0x14c3cc,0xc9))[_0xede7('0x40')](handleError(_0x14c3cc,null));};exports[_0xede7('0x68')]=function(_0x56d91c,_0x316473,_0x56161b){return db[_0xede7('0x55')]['transaction'](function(_0x37108d){var _0x59f40a;return db[_0xede7('0x28')][_0xede7('0x61')]({'where':{'id':_0x56d91c[_0xede7('0x42')]['id']}})['then'](handleEntityNotFound(_0x316473,null))[_0xede7('0x21')](function(_0x308ba9){if(_0x308ba9){_0x59f40a=_0x308ba9;return _0x308ba9[_0xede7('0x68')](_0x56d91c[_0xede7('0x42')]['id2']);}})[_0xede7('0x21')](function(_0x2ed4e5){if(_0x2ed4e5){return db[_0xede7('0x60')]['findOne']({'where':{'id':_0x56d91c[_0xede7('0x42')][_0xede7('0x69')]},'attributes':['id',_0xede7('0x25'),_0xede7('0x64'),'converted_format',_0xede7('0x6a')],'raw':!![]});}})['then'](function(_0x4a5896){if(_0x4a5896){fs['unlinkSync'](path[_0xede7('0x49')](_0x59f40a['directory'],util['format'](_0xede7('0x63'),_0x4a5896[_0xede7('0x25')],_0x4a5896[_0xede7('0x62')])));return _0x4a5896;}})['catch'](function(_0x838d14){throw new db[(_0xede7('0x5c'))][(_0xede7('0x5d'))](_0x838d14[_0xede7('0x5e')]);});})[_0xede7('0x21')](handleEntityNotFound(_0x316473,null))[_0xede7('0x21')](respondWithStatusCode(_0x316473,0xcc))[_0xede7('0x40')](handleError(_0x316473,null));};exports[_0xede7('0x6b')]=function(_0x1f3db0,_0x5dbcb6,_0x39a4fe){var _0x474114={};var _0x39aba7={};var _0x228e6b;var _0x2fbc9f;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x1f3db0[_0xede7('0x42')]['id']}})[_0xede7('0x21')](handleEntityNotFound(_0x5dbcb6,null))['then'](function(_0x557dc9){if(_0x557dc9){_0x228e6b=_0x557dc9;_0x39aba7['model']=_[_0xede7('0x2f')](db[_0xede7('0x60')][_0xede7('0x29')]);_0x39aba7['query']=_[_0xede7('0x2f')](_0x1f3db0['query']);_0x39aba7[_0xede7('0x30')]=_[_0xede7('0x31')](_0x39aba7['model'],_0x39aba7[_0xede7('0x2e')]);_0x474114[_0xede7('0x33')]=_[_0xede7('0x31')](_0x39aba7[_0xede7('0x32')],qs[_0xede7('0x34')](_0x1f3db0[_0xede7('0x2e')][_0xede7('0x34')]));_0x474114[_0xede7('0x33')]=_0x474114[_0xede7('0x33')]['length']?_0x474114[_0xede7('0x33')]:_0x39aba7['model'];_0x474114[_0xede7('0x6c')]=qs[_0xede7('0x37')](_0x1f3db0[_0xede7('0x2e')][_0xede7('0x37')]);_0x474114[_0xede7('0x38')]=qs[_0xede7('0x30')](_[_0xede7('0x39')](_0x1f3db0[_0xede7('0x2e')],_0x39aba7[_0xede7('0x30')]));if(_0x1f3db0[_0xede7('0x2e')]['filter']){_0x474114['where']=_[_0xede7('0x3c')](_0x474114[_0xede7('0x38')],{'$or':_[_0xede7('0x2d')](_0x474114[_0xede7('0x33')],function(_0x96c664){var _0x447b77={};_0x447b77[_0x96c664]={'$like':'%'+_0x1f3db0['query'][_0xede7('0x3a')]+'%'};return _0x447b77;})});}_0x474114=_['merge']({},_0x474114,_0x1f3db0['options']);return _0x228e6b[_0xede7('0x6b')](_0x474114);}})[_0xede7('0x21')](function(_0x59de03){if(_0x59de03){_0x2fbc9f=_0x59de03['length'];if(!_0x1f3db0[_0xede7('0x2e')][_0xede7('0x6d')](_0xede7('0x36'))){_0x474114[_0xede7('0x1b')]=qs[_0xede7('0x1b')](_0x1f3db0[_0xede7('0x2e')][_0xede7('0x1b')]);_0x474114[_0xede7('0x19')]=qs[_0xede7('0x19')](_0x1f3db0[_0xede7('0x2e')][_0xede7('0x19')]);}return _0x228e6b[_0xede7('0x6b')](_0x474114);}})['then'](function(_0x53f80e){if(_0x53f80e){return _0x53f80e?{'count':_0x2fbc9f,'rows':_0x53f80e}:null;}})[_0xede7('0x21')](respondWithResult(_0x5dbcb6,null))['catch'](handleError(_0x5dbcb6,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 328f57a..2b61d87 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 _0x4726=['voice_musiconhold','lodash','util','api','bluebird','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x152fe3,_0x12b0c8){var _0xc5bb39=function(_0x1fde42){while(--_0x1fde42){_0x152fe3['push'](_0x152fe3['shift']());}};_0xc5bb39(++_0x12b0c8);}(_0x4726,0xa1));var _0x6472=function(_0x4f59b3,_0x4857f3){_0x4f59b3=_0x4f59b3-0x0;var _0x344cbc=_0x4726[_0x4f59b3];return _0x344cbc;};'use strict';var _=require(_0x6472('0x0'));var util=require(_0x6472('0x1'));var logger=require('../../config/logger')(_0x6472('0x2'));var moment=require('moment');var BPromise=require(_0x6472('0x3'));var rp=require(_0x6472('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6472('0x5'));var config=require(_0x6472('0x6'));var attributes=require('./voiceMusicOnHold.attributes');module[_0x6472('0x7')]=function(_0x39c2b8,_0x21c8f5){return _0x39c2b8[_0x6472('0x8')]('VoiceMusicOnHold',attributes,{'tableName':_0x6472('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc978=['api','moment','bluebird','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger'];(function(_0x108a6c,_0x546e69){var _0x3bf9bb=function(_0xee5d6c){while(--_0xee5d6c){_0x108a6c['push'](_0x108a6c['shift']());}};_0x3bf9bb(++_0x546e69);}(_0xc978,0xcd));var _0x8c97=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc978[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x8c97('0x0'));var util=require(_0x8c97('0x1'));var logger=require(_0x8c97('0x2'))(_0x8c97('0x3'));var moment=require(_0x8c97('0x4'));var BPromise=require(_0x8c97('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8c97('0x6'));var rimraf=require(_0x8c97('0x7'));var config=require(_0x8c97('0x8'));var attributes=require(_0x8c97('0x9'));module[_0x8c97('0xa')]=function(_0x2a9434,_0xabd146){return _0x2a9434['define'](_0x8c97('0xb'),attributes,{'tableName':_0x8c97('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index f0bad34..9c64067 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 _0x0713=['VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x58909e,_0x50785f){var _0x13a989=function(_0x68e8d5){while(--_0x68e8d5){_0x58909e['push'](_0x58909e['shift']());}};_0x13a989(++_0x50785f);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file +var _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s'];(function(_0x2e5725,_0x2102eb){var _0x45b170=function(_0x3e2573){while(--_0x3e2573){_0x2e5725['push'](_0x2e5725['shift']());}};_0x45b170(++_0x2102eb);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1e91eb,_0x5829a3){_0x1e91eb=_0x1e91eb-0x0;var _0x2af75a=_0xcb91[_0x1e91eb];return _0x2af75a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 952abda..9cdbb05 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 _0x6ce5=['/:id/users','getAgents','post','create','addAgents','put','update','delete','destroy','removeAgents','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x5b6744,_0x49c9c2){var _0x43d97a=function(_0x55633e){while(--_0x55633e){_0x5b6744['push'](_0x5b6744['shift']());}};_0x43d97a(++_0x49c9c2);}(_0x6ce5,0x136));var _0x56ce=function(_0x30de36,_0x579533){_0x30de36=_0x30de36-0x0;var _0x359e7d=_0x6ce5[_0x30de36];return _0x359e7d;};'use strict';var multer=require(_0x56ce('0x0'));var util=require(_0x56ce('0x1'));var path=require('path');var timeout=require(_0x56ce('0x2'));var express=require(_0x56ce('0x3'));var router=express[_0x56ce('0x4')]();var fs_extra=require(_0x56ce('0x5'));var auth=require(_0x56ce('0x6'));var interaction=require(_0x56ce('0x7'));var config=require(_0x56ce('0x8'));var controller=require('./voicePrefix.controller');router[_0x56ce('0x9')]('/',auth[_0x56ce('0xa')](),controller[_0x56ce('0xb')]);router[_0x56ce('0x9')](_0x56ce('0xc'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x56ce('0xd'),auth[_0x56ce('0xa')](),controller[_0x56ce('0xe')]);router[_0x56ce('0x9')](_0x56ce('0xf'),auth['isAuthenticated'](),controller[_0x56ce('0x10')]);router[_0x56ce('0x11')]('/',auth['isAuthenticated'](),controller[_0x56ce('0x12')]);router[_0x56ce('0x11')](_0x56ce('0xf'),auth['isAuthenticated'](),controller[_0x56ce('0x13')]);router[_0x56ce('0x14')]('/:id',auth[_0x56ce('0xa')](),controller[_0x56ce('0x15')]);router[_0x56ce('0x16')](_0x56ce('0xd'),auth['isAuthenticated'](),controller[_0x56ce('0x17')]);router[_0x56ce('0x16')](_0x56ce('0xf'),auth['isAuthenticated'](),controller[_0x56ce('0x18')]);module['exports']=router; \ No newline at end of file +var _0x8340=['isAuthenticated','describe','/:id','show','getAgents','post','create','/:id/users','put','destroy','delete','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voicePrefix.controller','index','get','/describe'];(function(_0x2daece,_0x575a3c){var _0x1855cb=function(_0x12c25f){while(--_0x12c25f){_0x2daece['push'](_0x2daece['shift']());}};_0x1855cb(++_0x575a3c);}(_0x8340,0xa9));var _0x0834=function(_0x1debbd,_0x4bd739){_0x1debbd=_0x1debbd-0x0;var _0x40c66d=_0x8340[_0x1debbd];return _0x40c66d;};'use strict';var multer=require(_0x0834('0x0'));var util=require(_0x0834('0x1'));var path=require(_0x0834('0x2'));var timeout=require(_0x0834('0x3'));var express=require(_0x0834('0x4'));var router=express[_0x0834('0x5')]();var fs_extra=require(_0x0834('0x6'));var auth=require(_0x0834('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x0834('0x8'));var controller=require(_0x0834('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x0834('0xa')]);router[_0x0834('0xb')](_0x0834('0xc'),auth[_0x0834('0xd')](),controller[_0x0834('0xe')]);router[_0x0834('0xb')](_0x0834('0xf'),auth[_0x0834('0xd')](),controller[_0x0834('0x10')]);router[_0x0834('0xb')]('/:id/users',auth[_0x0834('0xd')](),controller[_0x0834('0x11')]);router[_0x0834('0x12')]('/',auth['isAuthenticated'](),controller[_0x0834('0x13')]);router[_0x0834('0x12')](_0x0834('0x14'),auth[_0x0834('0xd')](),controller['addAgents']);router[_0x0834('0x15')]('/:id',auth[_0x0834('0xd')](),controller['update']);router['delete'](_0x0834('0xf'),auth[_0x0834('0xd')](),controller[_0x0834('0x16')]);router[_0x0834('0x17')](_0x0834('0x14'),auth[_0x0834('0xd')](),controller[_0x0834('0x18')]);module[_0x0834('0x19')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 7f793db..d8aa94d 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 _0x4e6e=['sequelize','exports','STRING','VIRTUAL','system-','getDataValue','INTEGER'];(function(_0x2405bc,_0x2f28a1){var _0x5272d4=function(_0x225294){while(--_0x225294){_0x2405bc['push'](_0x2405bc['shift']());}};_0x5272d4(++_0x2f28a1);}(_0x4e6e,0x1ea));var _0xe4e6=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x4e6e[_0x1da527];return _0x40fc7c;};'use strict';var Sequelize=require(_0xe4e6('0x0'));module[_0xe4e6('0x1')]={'name':{'type':Sequelize[_0xe4e6('0x2')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0xe4e6('0x3')],'get':function(_0x48a998){return _0xe4e6('0x4')+this[_0xe4e6('0x5')]('name')+'-';}},'description':{'type':Sequelize[_0xe4e6('0x2')]},'callerIdAll':{'type':Sequelize[_0xe4e6('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0xe4e6('0x6')]}}; \ No newline at end of file +var _0x5830=['system-','getDataValue','INTEGER','STRING','name','VIRTUAL'];(function(_0x2e977e,_0x575ab4){var _0xadb90c=function(_0x53d584){while(--_0x53d584){_0x2e977e['push'](_0x2e977e['shift']());}};_0xadb90c(++_0x575ab4);}(_0x5830,0x18f));var _0x0583=function(_0x228b26,_0x4f566f){_0x228b26=_0x228b26-0x0;var _0x55aef9=_0x5830[_0x228b26];return _0x55aef9;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x0583('0x0')],'allowNull':![],'unique':_0x0583('0x1')},'prefix':{'type':Sequelize[_0x0583('0x2')],'get':function(_0x41d016){return _0x0583('0x3')+this[_0x0583('0x4')]('name')+'-';}},'description':{'type':Sequelize[_0x0583('0x0')]},'callerIdAll':{'type':Sequelize[_0x0583('0x0')]},'VoiceExtensionId':{'type':Sequelize[_0x0583('0x5')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 96a8c07..140f67b 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 _0x0767=['destroy','VoicePrefixes','error','stack','name','map','VoicePrefix','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','includeAll','include','rows','catch','show','params','intersection','length','options','find','describe','create','get','VoiceExtension','VoiceExtensionId','user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','app','system','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','${EXTEN:','charAt','sequelize','findById','addAgents','body','ids','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','findOne','User','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then'];(function(_0x5d00e8,_0x5d9d7f){var _0x232cef=function(_0x2e5f0e){while(--_0x2e5f0e){_0x5d00e8['push'](_0x5d00e8['shift']());}};_0x232cef(++_0x5d9d7f);}(_0x0767,0x1bf));var _0x7076=function(_0x496984,_0x45c35d){_0x496984=_0x496984-0x0;var _0x170bc9=_0x0767[_0x496984];return _0x170bc9;};'use strict';var emlformat=require(_0x7076('0x0'));var rimraf=require(_0x7076('0x1'));var zipdir=require(_0x7076('0x2'));var jsonpatch=require(_0x7076('0x3'));var rp=require(_0x7076('0x4'));var moment=require(_0x7076('0x5'));var BPromise=require(_0x7076('0x6'));var Mustache=require(_0x7076('0x7'));var util=require(_0x7076('0x8'));var path=require(_0x7076('0x9'));var sox=require('sox');var csv=require(_0x7076('0xa'));var ejs=require(_0x7076('0xb'));var fs=require('fs');var fs_extra=require(_0x7076('0xc'));var _=require(_0x7076('0xd'));var squel=require('squel');var crypto=require(_0x7076('0xe'));var jsforce=require(_0x7076('0xf'));var deskjs=require(_0x7076('0x10'));var toCsv=require(_0x7076('0xa'));var querystring=require(_0x7076('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7076('0x12'));var as=require(_0x7076('0x13'));var hardwareService=require(_0x7076('0x14'));var logger=require(_0x7076('0x15'))('api');var utils=require(_0x7076('0x16'));var config=require(_0x7076('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x7076('0x18'))['db'];config[_0x7076('0x19')]=_['defaults'](config[_0x7076('0x19')],{'host':_0x7076('0x1a'),'port':0x18eb});var socket=require(_0x7076('0x1b'))(new Redis(config['redis']));require(_0x7076('0x1c'))[_0x7076('0x1d')](socket);function respondWithStatusCode(_0x57bc48,_0x1aebd6){_0x1aebd6=_0x1aebd6||0xcc;return function(_0x5c92ca){if(_0x5c92ca){return _0x57bc48[_0x7076('0x1e')](_0x1aebd6);}return _0x57bc48['status'](_0x1aebd6)[_0x7076('0x1f')]();};}function respondWithResult(_0x37583f,_0x5b9ca3){_0x5b9ca3=_0x5b9ca3||0xc8;return function(_0x21c1d7){if(_0x21c1d7){return _0x37583f[_0x7076('0x20')](_0x5b9ca3)[_0x7076('0x21')](_0x21c1d7);}};}function respondWithFilteredResult(_0x2663d7,_0x4cb422){return function(_0x56bc02){if(_0x56bc02){var _0x5a2b0a=typeof _0x4cb422[_0x7076('0x22')]===_0x7076('0x23')&&typeof _0x4cb422[_0x7076('0x24')]===_0x7076('0x23');var _0x26e147=_0x56bc02[_0x7076('0x25')];var _0x4bc64a=_0x5a2b0a?0x0:_0x4cb422[_0x7076('0x22')];var _0x1ba8d7=_0x5a2b0a?_0x56bc02[_0x7076('0x25')]:_0x4cb422['offset']+_0x4cb422[_0x7076('0x24')];var _0x2a8775;if(_0x1ba8d7>=_0x26e147){_0x1ba8d7=_0x26e147;_0x2a8775=0xc8;}else{_0x2a8775=0xce;}_0x2663d7[_0x7076('0x20')](_0x2a8775);return _0x2663d7[_0x7076('0x26')](_0x7076('0x27'),_0x4bc64a+'-'+_0x1ba8d7+'/'+_0x26e147)[_0x7076('0x21')](_0x56bc02);}return null;};}function patchUpdates(_0x40d76c){return function(_0x380b88){try{jsonpatch[_0x7076('0x28')](_0x380b88,_0x40d76c,!![]);}catch(_0x54a7bf){return BPromise[_0x7076('0x29')](_0x54a7bf);}return _0x380b88[_0x7076('0x2a')]();};}function saveUpdates(_0x29e301,_0x22527d){return function(_0x4a5fbc){if(_0x4a5fbc){return _0x4a5fbc[_0x7076('0x2b')](_0x29e301)[_0x7076('0x2c')](function(_0x556c06){return _0x556c06;});}return null;};}function removeEntity(_0x4634df,_0x19181f){return function(_0x718870){if(_0x718870){return _0x718870[_0x7076('0x2d')]()[_0x7076('0x2c')](function(){var _0x12deb3=_0x718870['get']({'plain':!![]});var _0x1c0a7e=_0x7076('0x2e');return db['UserProfileResource'][_0x7076('0x2d')]({'where':{'type':_0x1c0a7e,'resourceId':_0x12deb3['id']}})[_0x7076('0x2c')](function(){return _0x718870;});})[_0x7076('0x2c')](function(){_0x4634df[_0x7076('0x20')](0xcc)[_0x7076('0x1f')]();});}};}function handleEntityNotFound(_0x457d60,_0xfca185){return function(_0xd6ae1f){if(!_0xd6ae1f){_0x457d60[_0x7076('0x1e')](0x194);}return _0xd6ae1f;};}function handleError(_0x3e1430,_0x1194ee){_0x1194ee=_0x1194ee||0x1f4;return function(_0x1f80e9){logger[_0x7076('0x2f')](_0x1f80e9[_0x7076('0x30')]);if(_0x1f80e9[_0x7076('0x31')]){delete _0x1f80e9['name'];}_0x3e1430[_0x7076('0x20')](_0x1194ee)['send'](_0x1f80e9);};}exports['index']=function(_0x10789b,_0x1702bd){var _0x33f0a4={},_0x10f9fc={},_0x8018e6={'count':0x0,'rows':[]};var _0x40d311=_[_0x7076('0x32')](db[_0x7076('0x33')][_0x7076('0x34')],function(_0x625c7e){return{'name':_0x625c7e[_0x7076('0x35')],'type':_0x625c7e[_0x7076('0x36')][_0x7076('0x37')]};});_0x10f9fc[_0x7076('0x38')]=_[_0x7076('0x32')](_0x40d311,_0x7076('0x31'));_0x10f9fc[_0x7076('0x39')]=_[_0x7076('0x3a')](_0x10789b[_0x7076('0x39')]);_0x10f9fc['filters']=_['intersection'](_0x10f9fc['model'],_0x10f9fc[_0x7076('0x39')]);_0x33f0a4[_0x7076('0x3b')]=_['intersection'](_0x10f9fc[_0x7076('0x38')],qs[_0x7076('0x3c')](_0x10789b[_0x7076('0x39')][_0x7076('0x3c')]));_0x33f0a4[_0x7076('0x3b')]=_0x33f0a4[_0x7076('0x3b')]['length']?_0x33f0a4[_0x7076('0x3b')]:_0x10f9fc[_0x7076('0x38')];if(!_0x10789b[_0x7076('0x39')][_0x7076('0x3d')](_0x7076('0x3e'))){_0x33f0a4[_0x7076('0x24')]=qs[_0x7076('0x24')](_0x10789b[_0x7076('0x39')][_0x7076('0x24')]);_0x33f0a4[_0x7076('0x22')]=qs['offset'](_0x10789b[_0x7076('0x39')]['offset']);}_0x33f0a4[_0x7076('0x3f')]=qs[_0x7076('0x40')](_0x10789b[_0x7076('0x39')]['sort']);_0x33f0a4[_0x7076('0x41')]=qs['filters'](_['pick'](_0x10789b[_0x7076('0x39')],_0x10f9fc[_0x7076('0x42')]),_0x40d311);if(_0x10789b['query'][_0x7076('0x43')]){_0x33f0a4[_0x7076('0x41')]=_['merge'](_0x33f0a4['where'],{'$or':_['map'](_0x40d311,function(_0x6efe60){if(_0x6efe60[_0x7076('0x36')]!==_0x7076('0x44')){var _0x41e3b2={};_0x41e3b2[_0x6efe60[_0x7076('0x31')]]={'$like':'%'+_0x10789b['query'][_0x7076('0x43')]+'%'};return _0x41e3b2;}})});}_0x33f0a4=_[_0x7076('0x45')]({},_0x33f0a4,_0x10789b['options']);var _0x3870a3={'where':_0x33f0a4['where']};return db['VoicePrefix']['count'](_0x3870a3)['then'](function(_0x52cbcc){_0x8018e6['count']=_0x52cbcc;if(_0x10789b[_0x7076('0x39')][_0x7076('0x46')]){_0x33f0a4[_0x7076('0x47')]=[{'all':!![]}];}return db[_0x7076('0x33')]['findAll'](_0x33f0a4);})[_0x7076('0x2c')](function(_0x494e81){_0x8018e6[_0x7076('0x48')]=_0x494e81;return _0x8018e6;})['then'](respondWithFilteredResult(_0x1702bd,_0x33f0a4))[_0x7076('0x49')](handleError(_0x1702bd,null));};exports[_0x7076('0x4a')]=function(_0x45b611,_0x2a224e){var _0x4ab3f3={'raw':![],'where':{'id':_0x45b611[_0x7076('0x4b')]['id']}},_0xd9a41a={};_0xd9a41a[_0x7076('0x38')]=_[_0x7076('0x3a')](db[_0x7076('0x33')]['rawAttributes']);_0xd9a41a['query']=_[_0x7076('0x3a')](_0x45b611[_0x7076('0x39')]);_0xd9a41a[_0x7076('0x42')]=_[_0x7076('0x4c')](_0xd9a41a[_0x7076('0x38')],_0xd9a41a[_0x7076('0x39')]);_0x4ab3f3[_0x7076('0x3b')]=_[_0x7076('0x4c')](_0xd9a41a[_0x7076('0x38')],qs[_0x7076('0x3c')](_0x45b611[_0x7076('0x39')][_0x7076('0x3c')]));_0x4ab3f3[_0x7076('0x3b')]=_0x4ab3f3['attributes'][_0x7076('0x4d')]?_0x4ab3f3[_0x7076('0x3b')]:_0xd9a41a[_0x7076('0x38')];if(_0x45b611['query'][_0x7076('0x46')]){_0x4ab3f3[_0x7076('0x47')]=[{'all':!![]}];}_0x4ab3f3=_['merge']({},_0x4ab3f3,_0x45b611[_0x7076('0x4e')]);return db[_0x7076('0x33')][_0x7076('0x4f')](_0x4ab3f3)[_0x7076('0x2c')](handleEntityNotFound(_0x2a224e,null))[_0x7076('0x2c')](respondWithResult(_0x2a224e,null))['catch'](handleError(_0x2a224e,null));};exports['destroy']=function(_0x2b78f1,_0x3e9314){return db[_0x7076('0x33')][_0x7076('0x4f')]({'where':{'id':_0x2b78f1[_0x7076('0x4b')]['id']}})[_0x7076('0x2c')](handleEntityNotFound(_0x3e9314,null))[_0x7076('0x2c')](removeEntity(_0x3e9314,null))[_0x7076('0x49')](handleError(_0x3e9314,null));};exports[_0x7076('0x50')]=function(_0x19119a,_0x371da8){return db['VoicePrefix']['describe']()['then'](respondWithResult(_0x371da8,null))[_0x7076('0x49')](handleError(_0x371da8,null));};exports['create']=function(_0x25c333,_0x5524ca){var _0x5ae5b8;return db['sequelize']['transaction'](function(_0x2e69d4){return db[_0x7076('0x33')][_0x7076('0x51')](_0x25c333['body'],{'transaction':_0x2e69d4})[_0x7076('0x2c')](function(_0x465823){_0x5ae5b8=_0x465823[_0x7076('0x52')]({'plain':!![]});return db[_0x7076('0x53')]['find']({'where':{'id':_0x5ae5b8[_0x7076('0x54')]},'raw':!![]})[_0x7076('0x2c')](function(_0x4f29bf){return createVoicePrefixExtensions(_0x5ae5b8,_0x4f29bf,_0x2e69d4);});});})['then'](function(){var _0x29193c=_0x25c333[_0x7076('0x55')]['get']({'plain':!![]});if(!_0x29193c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x29193c[_0x7076('0x56')]===_0x7076('0x55')){var _0x3933fd=_0x5ae5b8;return db[_0x7076('0x57')]['find']({'where':{'name':_0x7076('0x2e'),'userProfileId':_0x29193c[_0x7076('0x58')]},'raw':!![]})[_0x7076('0x2c')](function(_0x520c11){if(_0x520c11&&_0x520c11['autoAssociation']===0x0){return db[_0x7076('0x59')][_0x7076('0x51')]({'name':_0x3933fd[_0x7076('0x31')],'resourceId':_0x3933fd['id'],'type':_0x520c11['name'],'sectionId':_0x520c11['id']},{})[_0x7076('0x2c')](function(){return _0x5ae5b8;});}else{return _0x5ae5b8;}})[_0x7076('0x49')](function(_0x3bae03){logger['error'](_0x7076('0x5a'),_0x3bae03);throw _0x3bae03;});}return _0x5ae5b8;})[_0x7076('0x2c')](respondWithResult(_0x5524ca,null))[_0x7076('0x49')](handleError(_0x5524ca,null));};function Extension(_0x4a2fb0,_0x457616,_0x1cd6d3,_0x30738a){this[_0x7076('0x5b')]=_0x7076('0x5c');this['exten']=_0x4a2fb0;this[_0x7076('0x5d')]=_0x1cd6d3;this['type']=_0x7076('0x5e');this['description']=_0x7076('0x5f');this[_0x7076('0x60')]=_0x457616;this[_0x7076('0x61')]=_0x30738a;}function createVoicePrefixExtensions(_0xd9f27e,_0x3d918e,_0x48b207){return new BPromise(function(_0x266bb3,_0x44f7b){var _0x47c7a8=new Extension(formatPrefixName(_0xd9f27e[_0x7076('0x62')]),0x1,_0x7076('0x63'),_0x7076('0x64'));_0x47c7a8[_0x7076('0x65')]=_0xd9f27e['id'];return db[_0x7076('0x53')][_0x7076('0x51')](_0x47c7a8,{'transaction':_0x48b207})['then'](function(_0x4c1f45){var _0x248a7a=_0x4c1f45[_0x7076('0x52')]({'plain':!![]});var _0x45dc7b=_[_0x7076('0x32')](addVoicePrefixExtensions(_0xd9f27e,_0x3d918e),function(_0x5d1e3d){_0x5d1e3d[_0x7076('0x54')]=_0x248a7a['id'];_0x5d1e3d[_0x7076('0x65')]=_0xd9f27e['id'];return _0x5d1e3d;});return db[_0x7076('0x53')][_0x7076('0x66')](_0x45dc7b,{'transaction':_0x48b207})[_0x7076('0x2c')](function(_0x273af9){if(!_0x273af9){return _0x44f7b(_0x7076('0x67'));}else{return _0x266bb3(_0x273af9);}})[_0x7076('0x49')](function(_0xbb3e98){return _0x44f7b(_0xbb3e98);});});;});};function addVoicePrefixExtensions(_0x2547f7,_0x3582b3){var _0x317ea9=[];var _0x14017d=formatPrefixName(_0x2547f7[_0x7076('0x62')]);_0x317ea9[_0x7076('0x68')](new Extension(_0x14017d,0x2,_0x7076('0x69'),_0x7076('0x6a')+_0x2547f7[_0x7076('0x31')]));if(_0x2547f7[_0x7076('0x6b')]){_0x317ea9['push'](new Extension(_0x14017d,0x3,_0x7076('0x69'),'PREFIX-CALLERIDALL='+_0x2547f7[_0x7076('0x6b')]));}else{_0x317ea9[_0x7076('0x68')](new Extension(_0x14017d,0x3,_0x7076('0x63'),'No\x20callerid\x20available'));}_0x317ea9['push'](new Extension(_0x14017d,0x4,'goto',_0x3582b3[_0x7076('0x5b')]+','+_0x7076('0x6c')+(0x8+_0x2547f7['name'][_0x7076('0x4d')])+'}'+','+0x1));return _0x317ea9;}function formatPrefixName(_0x27de48){var _0xabd361='_';for(var _0x2ee846=0x0;_0x2ee846<_0x27de48['length'];_0x2ee846++){if(_0x27de48[_0x7076('0x6d')](_0x2ee846)=='-'){_0xabd361+=_0x27de48[_0x7076('0x6d')](_0x2ee846);}else{_0xabd361+='['+_0x27de48['charAt'](_0x2ee846)+']';}}_0xabd361+='.';return _0xabd361;}exports[_0x7076('0x2b')]=function(_0x4e32d2,_0x29f024,_0xb4febe){var _0x1a964a=_0x4e32d2['body'];_0x1a964a['prefix']='system-'+_0x1a964a[_0x7076('0x31')]+'-';return db[_0x7076('0x6e')]['transaction'](function(_0x5eae40){return db[_0x7076('0x33')][_0x7076('0x2b')](_0x1a964a,{'where':{'id':_0x1a964a['id']},'transaction':_0x5eae40})[_0x7076('0x2c')](function(){return db[_0x7076('0x53')][_0x7076('0x2d')]({'where':{'VoicePrefixId':_0x1a964a['id']},'transaction':_0x5eae40})[_0x7076('0x2c')](function(){return db['VoiceExtension'][_0x7076('0x4f')]({'where':{'id':_0x1a964a[_0x7076('0x54')]},'raw':!![]})[_0x7076('0x2c')](function(_0xebde9d){return createVoicePrefixExtensions(_0x1a964a,_0xebde9d,_0x5eae40);});});});})[_0x7076('0x2c')](function(){return db[_0x7076('0x33')][_0x7076('0x6f')](_0x1a964a['id']);})[_0x7076('0x2c')](respondWithResult(_0x29f024,null))[_0x7076('0x49')](handleError(_0x29f024,null));};exports[_0x7076('0x70')]=function(_0x412a02,_0x48caea,_0x748a3a){return db[_0x7076('0x33')][_0x7076('0x4f')]({'where':{'id':_0x412a02[_0x7076('0x4b')]['id']}})['then'](handleEntityNotFound(_0x48caea,null))[_0x7076('0x2c')](function(_0x15e912){if(_0x15e912){return _0x15e912['addAgents'](_0x412a02[_0x7076('0x71')]['ids'],_['omit'](_0x412a02[_0x7076('0x71')],[_0x7076('0x72'),'id'])||{})['spread'](function(_0x277237){for(var _0x146cc9=0x0;_0x146cc9<_0x412a02['body'][_0x7076('0x72')][_0x7076('0x4d')];_0x146cc9+=0x1){socket[_0x7076('0x73')](_0x7076('0x74'),{'UserId':Number(_0x412a02[_0x7076('0x71')]['ids'][_0x146cc9]),'VoicePrefixId':Number(_0x412a02['params']['id'])});}return _0x277237;});}})[_0x7076('0x2c')](respondWithResult(_0x48caea,null))[_0x7076('0x49')](handleError(_0x48caea,null));};exports[_0x7076('0x75')]=function(_0x5210a9,_0x187972,_0x1be3b6){return db[_0x7076('0x33')][_0x7076('0x4f')]({'where':{'id':_0x5210a9[_0x7076('0x4b')]['id']}})[_0x7076('0x2c')](handleEntityNotFound(_0x187972,null))['then'](function(_0x2741a8){if(_0x2741a8){return _0x2741a8[_0x7076('0x75')](_0x5210a9[_0x7076('0x39')][_0x7076('0x72')])[_0x7076('0x2c')](function(){if(_[_0x7076('0x76')](_0x5210a9[_0x7076('0x39')][_0x7076('0x72')])){for(var _0x400e8f=0x0;_0x400e8f<_0x5210a9[_0x7076('0x39')][_0x7076('0x72')][_0x7076('0x4d')];_0x400e8f+=0x1){socket['emit'](_0x7076('0x77'),{'UserId':Number(_0x5210a9[_0x7076('0x39')][_0x7076('0x72')][_0x400e8f]),'VoicePrefixId':Number(_0x5210a9[_0x7076('0x4b')]['id'])});}}else{socket[_0x7076('0x73')]('userVoicePrefix:remove',{'UserId':Number(_0x5210a9[_0x7076('0x39')][_0x7076('0x72')]),'VoicePrefixId':Number(_0x5210a9[_0x7076('0x4b')]['id'])});}});}})[_0x7076('0x2c')](respondWithStatusCode(_0x187972,null))[_0x7076('0x49')](handleError(_0x187972,null));};exports['getAgents']=function(_0x171d5d,_0x2d0e85,_0x1428e2){var _0x339236={};var _0x551e0c={};var _0x37fbce;var _0x5a861c;return db[_0x7076('0x33')][_0x7076('0x78')]({'where':{'id':_0x171d5d[_0x7076('0x4b')]['id']}})[_0x7076('0x2c')](handleEntityNotFound(_0x2d0e85,null))[_0x7076('0x2c')](function(_0x160d86){if(_0x160d86){_0x37fbce=_0x160d86;_0x551e0c[_0x7076('0x38')]=_[_0x7076('0x3a')](db[_0x7076('0x79')]['rawAttributes']);_0x551e0c[_0x7076('0x39')]=_['keys'](_0x171d5d[_0x7076('0x39')]);_0x551e0c[_0x7076('0x42')]=_[_0x7076('0x4c')](_0x551e0c[_0x7076('0x38')],_0x551e0c['query']);_0x339236['attributes']=_[_0x7076('0x4c')](_0x551e0c['model'],qs[_0x7076('0x3c')](_0x171d5d[_0x7076('0x39')]['fields']));_0x339236[_0x7076('0x3b')]=_0x339236['attributes'][_0x7076('0x4d')]?_0x339236[_0x7076('0x3b')]:_0x551e0c[_0x7076('0x38')];_0x339236['order']=qs[_0x7076('0x40')](_0x171d5d['query'][_0x7076('0x40')]);_0x339236[_0x7076('0x41')]=qs[_0x7076('0x42')](_['pick'](_0x171d5d[_0x7076('0x39')],_0x551e0c[_0x7076('0x42')]));if(_0x171d5d[_0x7076('0x39')][_0x7076('0x43')]){_0x339236['where']=_[_0x7076('0x45')](_0x339236[_0x7076('0x41')],{'$or':_[_0x7076('0x32')](_0x339236[_0x7076('0x3b')],function(_0x49071b){var _0x373c48={};_0x373c48[_0x49071b]={'$like':'%'+_0x171d5d[_0x7076('0x39')][_0x7076('0x43')]+'%'};return _0x373c48;})});}_0x339236=_[_0x7076('0x45')]({},_0x339236,_0x171d5d[_0x7076('0x4e')]);return _0x37fbce[_0x7076('0x7a')](_0x339236);}})[_0x7076('0x2c')](function(_0x4c1c6c){if(_0x4c1c6c){_0x5a861c=_0x4c1c6c['length'];if(!_0x171d5d[_0x7076('0x39')]['hasOwnProperty']('nolimit')){_0x339236[_0x7076('0x24')]=qs[_0x7076('0x24')](_0x171d5d[_0x7076('0x39')][_0x7076('0x24')]);_0x339236[_0x7076('0x22')]=qs[_0x7076('0x22')](_0x171d5d['query'][_0x7076('0x22')]);}return _0x37fbce['getAgents'](_0x339236);}})[_0x7076('0x2c')](function(_0x294d58){if(_0x294d58){return _0x294d58?{'count':_0x5a861c,'rows':_0x294d58}:null;}})[_0x7076('0x2c')](respondWithResult(_0x2d0e85,null))[_0x7076('0x49')](handleError(_0x2d0e85,null));}; \ No newline at end of file +var _0x1c3d=['intersection','attributes','length','nolimit','order','sort','where','pick','filter','merge','count','includeAll','include','findAll','rows','show','fields','options','find','catch','params','describe','create','sequelize','transaction','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','context','from-sip','exten','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','charAt','body','system-','addAgents','ids','omit','spread','userVoicePrefix:save','removeAgents','userVoicePrefix:remove','emit','getAgents','findOne','User','hasOwnProperty','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','register','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','then','destroy','get','VoicePrefixes','UserProfileResource','error','name','send','index','VoicePrefix','rawAttributes','fieldName','key','model','map','query','keys','filters'];(function(_0x5a1115,_0x5c7120){var _0x62e297=function(_0x52cbf2){while(--_0x52cbf2){_0x5a1115['push'](_0x5a1115['shift']());}};_0x62e297(++_0x5c7120);}(_0x1c3d,0x1b8));var _0xd1c3=function(_0x4fa0e8,_0x5921d2){_0x4fa0e8=_0x4fa0e8-0x0;var _0x1c0b56=_0x1c3d[_0x4fa0e8];return _0x1c0b56;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd1c3('0x0'));var zipdir=require(_0xd1c3('0x1'));var jsonpatch=require(_0xd1c3('0x2'));var rp=require(_0xd1c3('0x3'));var moment=require(_0xd1c3('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd1c3('0x5'));var path=require(_0xd1c3('0x6'));var sox=require(_0xd1c3('0x7'));var csv=require(_0xd1c3('0x8'));var ejs=require(_0xd1c3('0x9'));var fs=require('fs');var fs_extra=require(_0xd1c3('0xa'));var _=require('lodash');var squel=require(_0xd1c3('0xb'));var crypto=require(_0xd1c3('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd1c3('0xd'));var toCsv=require(_0xd1c3('0x8'));var querystring=require(_0xd1c3('0xe'));var Papa=require(_0xd1c3('0xf'));var Redis=require(_0xd1c3('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd1c3('0x11'));var hardwareService=require(_0xd1c3('0x12'));var logger=require(_0xd1c3('0x13'))(_0xd1c3('0x14'));var utils=require(_0xd1c3('0x15'));var config=require(_0xd1c3('0x16'));var licenseUtil=require(_0xd1c3('0x17'));var db=require(_0xd1c3('0x18'))['db'];config[_0xd1c3('0x19')]=_['defaults'](config[_0xd1c3('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd1c3('0x19')]));require('./voicePrefix.socket')[_0xd1c3('0x1a')](socket);function respondWithStatusCode(_0x1f30ff,_0x37d175){_0x37d175=_0x37d175||0xcc;return function(_0x52e7bc){if(_0x52e7bc){return _0x1f30ff[_0xd1c3('0x1b')](_0x37d175);}return _0x1f30ff[_0xd1c3('0x1c')](_0x37d175)[_0xd1c3('0x1d')]();};}function respondWithResult(_0x3bc2b,_0x42ba11){_0x42ba11=_0x42ba11||0xc8;return function(_0xb5af75){if(_0xb5af75){return _0x3bc2b[_0xd1c3('0x1c')](_0x42ba11)[_0xd1c3('0x1e')](_0xb5af75);}};}function respondWithFilteredResult(_0x3439dc,_0x31821f){return function(_0x5d26c2){if(_0x5d26c2){var _0x53a5e1=typeof _0x31821f[_0xd1c3('0x1f')]===_0xd1c3('0x20')&&typeof _0x31821f[_0xd1c3('0x21')]===_0xd1c3('0x20');var _0x5b2571=_0x5d26c2['count'];var _0x9c9d4d=_0x53a5e1?0x0:_0x31821f[_0xd1c3('0x1f')];var _0x1dcb29=_0x53a5e1?_0x5d26c2['count']:_0x31821f['offset']+_0x31821f[_0xd1c3('0x21')];var _0x1b5fae;if(_0x1dcb29>=_0x5b2571){_0x1dcb29=_0x5b2571;_0x1b5fae=0xc8;}else{_0x1b5fae=0xce;}_0x3439dc['status'](_0x1b5fae);return _0x3439dc['set'](_0xd1c3('0x22'),_0x9c9d4d+'-'+_0x1dcb29+'/'+_0x5b2571)[_0xd1c3('0x1e')](_0x5d26c2);}return null;};}function patchUpdates(_0x201ff0){return function(_0x16e5d6){try{jsonpatch[_0xd1c3('0x23')](_0x16e5d6,_0x201ff0,!![]);}catch(_0x46ed40){return BPromise[_0xd1c3('0x24')](_0x46ed40);}return _0x16e5d6[_0xd1c3('0x25')]();};}function saveUpdates(_0x33c380,_0x218ef1){return function(_0x5a9d5d){if(_0x5a9d5d){return _0x5a9d5d['update'](_0x33c380)[_0xd1c3('0x26')](function(_0x261323){return _0x261323;});}return null;};}function removeEntity(_0x6aad1c,_0x227f24){return function(_0x5d1988){if(_0x5d1988){return _0x5d1988[_0xd1c3('0x27')]()[_0xd1c3('0x26')](function(){var _0x54fd33=_0x5d1988[_0xd1c3('0x28')]({'plain':!![]});var _0x3f5206=_0xd1c3('0x29');return db[_0xd1c3('0x2a')][_0xd1c3('0x27')]({'where':{'type':_0x3f5206,'resourceId':_0x54fd33['id']}})[_0xd1c3('0x26')](function(){return _0x5d1988;});})[_0xd1c3('0x26')](function(){_0x6aad1c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x564ca2,_0x3eabca){return function(_0x1a4448){if(!_0x1a4448){_0x564ca2[_0xd1c3('0x1b')](0x194);}return _0x1a4448;};}function handleError(_0x287952,_0x584b1d){_0x584b1d=_0x584b1d||0x1f4;return function(_0x331bad){logger[_0xd1c3('0x2b')](_0x331bad['stack']);if(_0x331bad[_0xd1c3('0x2c')]){delete _0x331bad['name'];}_0x287952[_0xd1c3('0x1c')](_0x584b1d)[_0xd1c3('0x2d')](_0x331bad);};}exports[_0xd1c3('0x2e')]=function(_0xdf49e1,_0x2c4449){var _0x1cd292={},_0xa52671={},_0x7613a9={'count':0x0,'rows':[]};var _0x525150=_['map'](db[_0xd1c3('0x2f')][_0xd1c3('0x30')],function(_0x55d395){return{'name':_0x55d395[_0xd1c3('0x31')],'type':_0x55d395['type'][_0xd1c3('0x32')]};});_0xa52671[_0xd1c3('0x33')]=_[_0xd1c3('0x34')](_0x525150,'name');_0xa52671[_0xd1c3('0x35')]=_[_0xd1c3('0x36')](_0xdf49e1[_0xd1c3('0x35')]);_0xa52671[_0xd1c3('0x37')]=_[_0xd1c3('0x38')](_0xa52671[_0xd1c3('0x33')],_0xa52671[_0xd1c3('0x35')]);_0x1cd292[_0xd1c3('0x39')]=_[_0xd1c3('0x38')](_0xa52671['model'],qs['fields'](_0xdf49e1[_0xd1c3('0x35')]['fields']));_0x1cd292[_0xd1c3('0x39')]=_0x1cd292[_0xd1c3('0x39')][_0xd1c3('0x3a')]?_0x1cd292[_0xd1c3('0x39')]:_0xa52671[_0xd1c3('0x33')];if(!_0xdf49e1[_0xd1c3('0x35')]['hasOwnProperty'](_0xd1c3('0x3b'))){_0x1cd292['limit']=qs[_0xd1c3('0x21')](_0xdf49e1['query'][_0xd1c3('0x21')]);_0x1cd292['offset']=qs['offset'](_0xdf49e1[_0xd1c3('0x35')][_0xd1c3('0x1f')]);}_0x1cd292[_0xd1c3('0x3c')]=qs['sort'](_0xdf49e1[_0xd1c3('0x35')][_0xd1c3('0x3d')]);_0x1cd292[_0xd1c3('0x3e')]=qs['filters'](_[_0xd1c3('0x3f')](_0xdf49e1[_0xd1c3('0x35')],_0xa52671[_0xd1c3('0x37')]),_0x525150);if(_0xdf49e1[_0xd1c3('0x35')][_0xd1c3('0x40')]){_0x1cd292[_0xd1c3('0x3e')]=_[_0xd1c3('0x41')](_0x1cd292['where'],{'$or':_[_0xd1c3('0x34')](_0x525150,function(_0x357855){if(_0x357855['type']!=='VIRTUAL'){var _0x413e25={};_0x413e25[_0x357855[_0xd1c3('0x2c')]]={'$like':'%'+_0xdf49e1[_0xd1c3('0x35')][_0xd1c3('0x40')]+'%'};return _0x413e25;}})});}_0x1cd292=_[_0xd1c3('0x41')]({},_0x1cd292,_0xdf49e1['options']);var _0x142c15={'where':_0x1cd292[_0xd1c3('0x3e')]};return db[_0xd1c3('0x2f')][_0xd1c3('0x42')](_0x142c15)[_0xd1c3('0x26')](function(_0x439f3){_0x7613a9[_0xd1c3('0x42')]=_0x439f3;if(_0xdf49e1[_0xd1c3('0x35')][_0xd1c3('0x43')]){_0x1cd292[_0xd1c3('0x44')]=[{'all':!![]}];}return db['VoicePrefix'][_0xd1c3('0x45')](_0x1cd292);})['then'](function(_0x4cab3f){_0x7613a9[_0xd1c3('0x46')]=_0x4cab3f;return _0x7613a9;})[_0xd1c3('0x26')](respondWithFilteredResult(_0x2c4449,_0x1cd292))['catch'](handleError(_0x2c4449,null));};exports[_0xd1c3('0x47')]=function(_0x767ff7,_0x261a89){var _0x1bbdcd={'raw':![],'where':{'id':_0x767ff7['params']['id']}},_0x10bf53={};_0x10bf53['model']=_[_0xd1c3('0x36')](db['VoicePrefix'][_0xd1c3('0x30')]);_0x10bf53[_0xd1c3('0x35')]=_[_0xd1c3('0x36')](_0x767ff7[_0xd1c3('0x35')]);_0x10bf53['filters']=_['intersection'](_0x10bf53[_0xd1c3('0x33')],_0x10bf53[_0xd1c3('0x35')]);_0x1bbdcd[_0xd1c3('0x39')]=_['intersection'](_0x10bf53[_0xd1c3('0x33')],qs['fields'](_0x767ff7[_0xd1c3('0x35')][_0xd1c3('0x48')]));_0x1bbdcd[_0xd1c3('0x39')]=_0x1bbdcd[_0xd1c3('0x39')]['length']?_0x1bbdcd['attributes']:_0x10bf53[_0xd1c3('0x33')];if(_0x767ff7[_0xd1c3('0x35')][_0xd1c3('0x43')]){_0x1bbdcd[_0xd1c3('0x44')]=[{'all':!![]}];}_0x1bbdcd=_[_0xd1c3('0x41')]({},_0x1bbdcd,_0x767ff7[_0xd1c3('0x49')]);return db[_0xd1c3('0x2f')][_0xd1c3('0x4a')](_0x1bbdcd)['then'](handleEntityNotFound(_0x261a89,null))[_0xd1c3('0x26')](respondWithResult(_0x261a89,null))[_0xd1c3('0x4b')](handleError(_0x261a89,null));};exports[_0xd1c3('0x27')]=function(_0x4220ae,_0x2eb58e){return db['VoicePrefix']['find']({'where':{'id':_0x4220ae[_0xd1c3('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2eb58e,null))[_0xd1c3('0x26')](removeEntity(_0x2eb58e,null))[_0xd1c3('0x4b')](handleError(_0x2eb58e,null));};exports[_0xd1c3('0x4d')]=function(_0x558439,_0x306d47){return db[_0xd1c3('0x2f')][_0xd1c3('0x4d')]()[_0xd1c3('0x26')](respondWithResult(_0x306d47,null))[_0xd1c3('0x4b')](handleError(_0x306d47,null));};exports[_0xd1c3('0x4e')]=function(_0x3b00ca,_0x9c3706){var _0xfcfaa;return db[_0xd1c3('0x4f')][_0xd1c3('0x50')](function(_0x438b96){return db[_0xd1c3('0x2f')][_0xd1c3('0x4e')](_0x3b00ca['body'],{'transaction':_0x438b96})['then'](function(_0x341a85){_0xfcfaa=_0x341a85['get']({'plain':!![]});return db[_0xd1c3('0x51')][_0xd1c3('0x4a')]({'where':{'id':_0xfcfaa[_0xd1c3('0x52')]},'raw':!![]})[_0xd1c3('0x26')](function(_0x3a924b){return createVoicePrefixExtensions(_0xfcfaa,_0x3a924b,_0x438b96);});});})[_0xd1c3('0x26')](function(){var _0x1b749d=_0x3b00ca[_0xd1c3('0x53')][_0xd1c3('0x28')]({'plain':!![]});if(!_0x1b749d)throw new Error(_0xd1c3('0x54'));if(_0x1b749d[_0xd1c3('0x55')]==='user'){var _0x246e02=_0xfcfaa;return db[_0xd1c3('0x56')][_0xd1c3('0x4a')]({'where':{'name':'VoicePrefixes','userProfileId':_0x1b749d[_0xd1c3('0x57')]},'raw':!![]})[_0xd1c3('0x26')](function(_0x3ba3fd){if(_0x3ba3fd&&_0x3ba3fd[_0xd1c3('0x58')]===0x0){return db[_0xd1c3('0x2a')]['create']({'name':_0x246e02[_0xd1c3('0x2c')],'resourceId':_0x246e02['id'],'type':_0x3ba3fd[_0xd1c3('0x2c')],'sectionId':_0x3ba3fd['id']},{})[_0xd1c3('0x26')](function(){return _0xfcfaa;});}else{return _0xfcfaa;}})[_0xd1c3('0x4b')](function(_0x1d2dbc){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1d2dbc);throw _0x1d2dbc;});}return _0xfcfaa;})[_0xd1c3('0x26')](respondWithResult(_0x9c3706,null))['catch'](handleError(_0x9c3706,null));};function Extension(_0x523d53,_0x47ce8d,_0x19ef3b,_0x5a9310){this[_0xd1c3('0x59')]=_0xd1c3('0x5a');this[_0xd1c3('0x5b')]=_0x523d53;this['app']=_0x19ef3b;this['type']='system';this[_0xd1c3('0x5c')]=_0xd1c3('0x5d');this[_0xd1c3('0x5e')]=_0x47ce8d;this[_0xd1c3('0x5f')]=_0x5a9310;}function createVoicePrefixExtensions(_0x3f5d86,_0x19291a,_0x246776){return new BPromise(function(_0x3b0f51,_0x541b1e){var _0x52f1b5=new Extension(formatPrefixName(_0x3f5d86[_0xd1c3('0x60')]),0x1,_0xd1c3('0x61'),_0xd1c3('0x62'));_0x52f1b5['VoicePrefixId']=_0x3f5d86['id'];return db[_0xd1c3('0x51')][_0xd1c3('0x4e')](_0x52f1b5,{'transaction':_0x246776})[_0xd1c3('0x26')](function(_0x3f45be){var _0x1b1613=_0x3f45be[_0xd1c3('0x28')]({'plain':!![]});var _0x4fef5a=_[_0xd1c3('0x34')](addVoicePrefixExtensions(_0x3f5d86,_0x19291a),function(_0x1ae027){_0x1ae027[_0xd1c3('0x52')]=_0x1b1613['id'];_0x1ae027[_0xd1c3('0x63')]=_0x3f5d86['id'];return _0x1ae027;});return db[_0xd1c3('0x51')][_0xd1c3('0x64')](_0x4fef5a,{'transaction':_0x246776})[_0xd1c3('0x26')](function(_0xd24091){if(!_0xd24091){return _0x541b1e(_0xd1c3('0x65'));}else{return _0x3b0f51(_0xd24091);}})[_0xd1c3('0x4b')](function(_0x5de67b){return _0x541b1e(_0x5de67b);});});;});};function addVoicePrefixExtensions(_0x4b5282,_0x45058c){var _0x175fb8=[];var _0x37564d=formatPrefixName(_0x4b5282['prefix']);_0x175fb8[_0xd1c3('0x66')](new Extension(_0x37564d,0x2,_0xd1c3('0x67'),_0xd1c3('0x68')+_0x4b5282[_0xd1c3('0x2c')]));if(_0x4b5282[_0xd1c3('0x69')]){_0x175fb8[_0xd1c3('0x66')](new Extension(_0x37564d,0x3,_0xd1c3('0x67'),_0xd1c3('0x6a')+_0x4b5282['callerIdAll']));}else{_0x175fb8['push'](new Extension(_0x37564d,0x3,_0xd1c3('0x61'),_0xd1c3('0x6b')));}_0x175fb8[_0xd1c3('0x66')](new Extension(_0x37564d,0x4,_0xd1c3('0x6c'),_0x45058c[_0xd1c3('0x59')]+','+'${EXTEN:'+(0x8+_0x4b5282[_0xd1c3('0x2c')]['length'])+'}'+','+0x1));return _0x175fb8;}function formatPrefixName(_0x3b42ae){var _0x463b33='_';for(var _0x2c722e=0x0;_0x2c722e<_0x3b42ae['length'];_0x2c722e++){if(_0x3b42ae[_0xd1c3('0x6d')](_0x2c722e)=='-'){_0x463b33+=_0x3b42ae[_0xd1c3('0x6d')](_0x2c722e);}else{_0x463b33+='['+_0x3b42ae[_0xd1c3('0x6d')](_0x2c722e)+']';}}_0x463b33+='.';return _0x463b33;}exports['update']=function(_0x44f93d,_0x464caa,_0x320746){var _0x52b24b=_0x44f93d[_0xd1c3('0x6e')];_0x52b24b[_0xd1c3('0x60')]=_0xd1c3('0x6f')+_0x52b24b['name']+'-';return db['sequelize'][_0xd1c3('0x50')](function(_0x5c1085){return db[_0xd1c3('0x2f')]['update'](_0x52b24b,{'where':{'id':_0x52b24b['id']},'transaction':_0x5c1085})[_0xd1c3('0x26')](function(){return db[_0xd1c3('0x51')][_0xd1c3('0x27')]({'where':{'VoicePrefixId':_0x52b24b['id']},'transaction':_0x5c1085})[_0xd1c3('0x26')](function(){return db[_0xd1c3('0x51')][_0xd1c3('0x4a')]({'where':{'id':_0x52b24b[_0xd1c3('0x52')]},'raw':!![]})[_0xd1c3('0x26')](function(_0x30acd0){return createVoicePrefixExtensions(_0x52b24b,_0x30acd0,_0x5c1085);});});});})[_0xd1c3('0x26')](function(){return db['VoicePrefix']['findById'](_0x52b24b['id']);})[_0xd1c3('0x26')](respondWithResult(_0x464caa,null))[_0xd1c3('0x4b')](handleError(_0x464caa,null));};exports[_0xd1c3('0x70')]=function(_0x488cbd,_0x5522f8,_0x521b50){return db[_0xd1c3('0x2f')]['find']({'where':{'id':_0x488cbd[_0xd1c3('0x4c')]['id']}})[_0xd1c3('0x26')](handleEntityNotFound(_0x5522f8,null))['then'](function(_0x212416){if(_0x212416){return _0x212416[_0xd1c3('0x70')](_0x488cbd[_0xd1c3('0x6e')][_0xd1c3('0x71')],_[_0xd1c3('0x72')](_0x488cbd[_0xd1c3('0x6e')],[_0xd1c3('0x71'),'id'])||{})[_0xd1c3('0x73')](function(_0x1905ca){for(var _0x51f3da=0x0;_0x51f3da<_0x488cbd['body'][_0xd1c3('0x71')][_0xd1c3('0x3a')];_0x51f3da+=0x1){socket['emit'](_0xd1c3('0x74'),{'UserId':Number(_0x488cbd['body'][_0xd1c3('0x71')][_0x51f3da]),'VoicePrefixId':Number(_0x488cbd[_0xd1c3('0x4c')]['id'])});}return _0x1905ca;});}})[_0xd1c3('0x26')](respondWithResult(_0x5522f8,null))[_0xd1c3('0x4b')](handleError(_0x5522f8,null));};exports['removeAgents']=function(_0xec8021,_0x341ec9,_0x50d30d){return db[_0xd1c3('0x2f')][_0xd1c3('0x4a')]({'where':{'id':_0xec8021['params']['id']}})[_0xd1c3('0x26')](handleEntityNotFound(_0x341ec9,null))[_0xd1c3('0x26')](function(_0x2b2554){if(_0x2b2554){return _0x2b2554[_0xd1c3('0x75')](_0xec8021[_0xd1c3('0x35')][_0xd1c3('0x71')])[_0xd1c3('0x26')](function(){if(_['isArray'](_0xec8021[_0xd1c3('0x35')][_0xd1c3('0x71')])){for(var _0x34476a=0x0;_0x34476a<_0xec8021[_0xd1c3('0x35')][_0xd1c3('0x71')][_0xd1c3('0x3a')];_0x34476a+=0x1){socket['emit'](_0xd1c3('0x76'),{'UserId':Number(_0xec8021['query'][_0xd1c3('0x71')][_0x34476a]),'VoicePrefixId':Number(_0xec8021['params']['id'])});}}else{socket[_0xd1c3('0x77')](_0xd1c3('0x76'),{'UserId':Number(_0xec8021['query'][_0xd1c3('0x71')]),'VoicePrefixId':Number(_0xec8021[_0xd1c3('0x4c')]['id'])});}});}})[_0xd1c3('0x26')](respondWithStatusCode(_0x341ec9,null))[_0xd1c3('0x4b')](handleError(_0x341ec9,null));};exports[_0xd1c3('0x78')]=function(_0x18aa64,_0xab394a,_0x2ed2f0){var _0x33797a={};var _0x41213e={};var _0x573f50;var _0x51c369;return db[_0xd1c3('0x2f')][_0xd1c3('0x79')]({'where':{'id':_0x18aa64[_0xd1c3('0x4c')]['id']}})[_0xd1c3('0x26')](handleEntityNotFound(_0xab394a,null))['then'](function(_0x1eb31a){if(_0x1eb31a){_0x573f50=_0x1eb31a;_0x41213e[_0xd1c3('0x33')]=_['keys'](db[_0xd1c3('0x7a')][_0xd1c3('0x30')]);_0x41213e[_0xd1c3('0x35')]=_[_0xd1c3('0x36')](_0x18aa64['query']);_0x41213e[_0xd1c3('0x37')]=_[_0xd1c3('0x38')](_0x41213e[_0xd1c3('0x33')],_0x41213e[_0xd1c3('0x35')]);_0x33797a['attributes']=_[_0xd1c3('0x38')](_0x41213e[_0xd1c3('0x33')],qs[_0xd1c3('0x48')](_0x18aa64[_0xd1c3('0x35')][_0xd1c3('0x48')]));_0x33797a['attributes']=_0x33797a['attributes']['length']?_0x33797a['attributes']:_0x41213e['model'];_0x33797a[_0xd1c3('0x3c')]=qs[_0xd1c3('0x3d')](_0x18aa64[_0xd1c3('0x35')]['sort']);_0x33797a[_0xd1c3('0x3e')]=qs[_0xd1c3('0x37')](_[_0xd1c3('0x3f')](_0x18aa64[_0xd1c3('0x35')],_0x41213e[_0xd1c3('0x37')]));if(_0x18aa64[_0xd1c3('0x35')][_0xd1c3('0x40')]){_0x33797a[_0xd1c3('0x3e')]=_[_0xd1c3('0x41')](_0x33797a[_0xd1c3('0x3e')],{'$or':_[_0xd1c3('0x34')](_0x33797a['attributes'],function(_0x1faeb5){var _0x100f25={};_0x100f25[_0x1faeb5]={'$like':'%'+_0x18aa64[_0xd1c3('0x35')][_0xd1c3('0x40')]+'%'};return _0x100f25;})});}_0x33797a=_['merge']({},_0x33797a,_0x18aa64['options']);return _0x573f50[_0xd1c3('0x78')](_0x33797a);}})[_0xd1c3('0x26')](function(_0x23aa2f){if(_0x23aa2f){_0x51c369=_0x23aa2f['length'];if(!_0x18aa64[_0xd1c3('0x35')][_0xd1c3('0x7b')]('nolimit')){_0x33797a['limit']=qs[_0xd1c3('0x21')](_0x18aa64['query'][_0xd1c3('0x21')]);_0x33797a[_0xd1c3('0x1f')]=qs['offset'](_0x18aa64['query'][_0xd1c3('0x1f')]);}return _0x573f50[_0xd1c3('0x78')](_0x33797a);}})['then'](function(_0x5058ae){if(_0x5058ae){return _0x5058ae?{'count':_0x51c369,'rows':_0x5058ae}:null;}})[_0xd1c3('0x26')](respondWithResult(_0xab394a,null))[_0xd1c3('0x4b')](handleError(_0xab394a,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index b0eeeb7..fb54001 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 _0x3ba6=['../../mysqldb','VoicePrefix','setMaxListeners','save','update','hasOwnProperty','hook','events'];(function(_0x1a3ee3,_0x1c0f51){var _0x213bc8=function(_0x297c4e){while(--_0x297c4e){_0x1a3ee3['push'](_0x1a3ee3['shift']());}};_0x213bc8(++_0x1c0f51);}(_0x3ba6,0x13f));var _0x63ba=function(_0x118653,_0x50ef26){_0x118653=_0x118653-0x0;var _0xc11fa6=_0x3ba6[_0x118653];return _0xc11fa6;};'use strict';var EventEmitter=require(_0x63ba('0x0'));var VoicePrefix=require(_0x63ba('0x1'))['db'][_0x63ba('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x63ba('0x3')](0x0);var events={'afterCreate':_0x63ba('0x4'),'afterUpdate':_0x63ba('0x5'),'afterDestroy':'remove'};function emitEvent(_0x7026fa){return function(_0x57b531,_0x561020,_0x3ad29a){VoicePrefixEvents['emit'](_0x7026fa+':'+_0x57b531['id'],_0x57b531);VoicePrefixEvents['emit'](_0x7026fa,_0x57b531);_0x3ad29a(null);};}for(var e in events){if(events[_0x63ba('0x6')](e)){var event=events[e];VoicePrefix[_0x63ba('0x7')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0x0fae=['../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty','hook','events'];(function(_0x4f087c,_0x40fae8){var _0x1d4579=function(_0x3b9e8b){while(--_0x3b9e8b){_0x4f087c['push'](_0x4f087c['shift']());}};_0x1d4579(++_0x40fae8);}(_0x0fae,0x147));var _0xe0fa=function(_0xc67e5d,_0x469a98){_0xc67e5d=_0xc67e5d-0x0;var _0x1c451d=_0x0fae[_0xc67e5d];return _0x1c451d;};'use strict';var EventEmitter=require(_0xe0fa('0x0'));var VoicePrefix=require(_0xe0fa('0x1'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xe0fa('0x2')](0x0);var events={'afterCreate':_0xe0fa('0x3'),'afterUpdate':_0xe0fa('0x4'),'afterDestroy':'remove'};function emitEvent(_0x53526f){return function(_0x1150b7,_0xd7ba43,_0x47866f){VoicePrefixEvents['emit'](_0x53526f+':'+_0x1150b7['id'],_0x1150b7);VoicePrefixEvents[_0xe0fa('0x5')](_0x53526f,_0x1150b7);_0x47866f(null);};}for(var e in events){if(events[_0xe0fa('0x6')](e)){var event=events[e];VoicePrefix[_0xe0fa('0x7')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 3d5ee18..58914bd 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 _0x098e=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','voice_prefixes','util'];(function(_0x4e1fbf,_0x58f9ad){var _0x58734c=function(_0x1cee34){while(--_0x1cee34){_0x4e1fbf['push'](_0x4e1fbf['shift']());}};_0x58734c(++_0x58f9ad);}(_0x098e,0x1ca));var _0xe098=function(_0x334a81,_0x5ec823){_0x334a81=_0x334a81-0x0;var _0x28f7f6=_0x098e[_0x334a81];return _0x28f7f6;};'use strict';var _=require('lodash');var util=require(_0xe098('0x0'));var logger=require(_0xe098('0x1'))(_0xe098('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe098('0x3'));var fs=require('fs');var path=require(_0xe098('0x4'));var rimraf=require(_0xe098('0x5'));var config=require(_0xe098('0x6'));var attributes=require(_0xe098('0x7'));module['exports']=function(_0x468c04,_0x157f6e){return _0x468c04['define']('VoicePrefix',attributes,{'tableName':_0xe098('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xae67=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','exports','VoicePrefix','voice_prefixes'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xae67,0x12b));var _0x7ae6=function(_0x4376fd,_0x4786c8){_0x4376fd=_0x4376fd-0x0;var _0x2dc34d=_0xae67[_0x4376fd];return _0x2dc34d;};'use strict';var _=require(_0x7ae6('0x0'));var util=require(_0x7ae6('0x1'));var logger=require(_0x7ae6('0x2'))(_0x7ae6('0x3'));var moment=require('moment');var BPromise=require(_0x7ae6('0x4'));var rp=require(_0x7ae6('0x5'));var fs=require('fs');var path=require(_0x7ae6('0x6'));var rimraf=require(_0x7ae6('0x7'));var config=require(_0x7ae6('0x8'));var attributes=require(_0x7ae6('0x9'));module[_0x7ae6('0xa')]=function(_0x5b27e6,_0x24db13){return _0x5b27e6['define'](_0x7ae6('0xb'),attributes,{'tableName':_0x7ae6('0xc'),'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 9fbde03..9dfcffb 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 _0x9f37=['./voicePrefix.socket','then','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','error','code','VoicePrefix,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9f37,0xd1));var _0x79f3=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x9f37[_0x24f31b];return _0x488401;};'use strict';var _=require(_0x79f3('0x0'));var util=require(_0x79f3('0x1'));var moment=require('moment');var BPromise=require(_0x79f3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x79f3('0x3'))['db'];var utils=require(_0x79f3('0x4'));var logger=require(_0x79f3('0x5'))('rpc');var config=require(_0x79f3('0x6'));var jayson=require(_0x79f3('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0x79f3('0x8')]=_[_0x79f3('0x9')](config[_0x79f3('0x8')],{'host':_0x79f3('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x79f3('0x8')]));require(_0x79f3('0xb'))['register'](socket);function respondWithRpcPromise(_0x3f30ce,_0x897ff1,_0xebcce4){return new BPromise(function(_0xa2f557,_0x3efa9b){return client['request'](_0x3f30ce,_0xebcce4)[_0x79f3('0xc')](function(_0x33e502){logger['info']('VoicePrefix,\x20%s,\x20%s',_0x897ff1,_0x79f3('0xd'));logger[_0x79f3('0xe')](_0x79f3('0xf'),_0x897ff1,_0x79f3('0xd'),JSON['stringify'](_0x33e502));if(_0x33e502[_0x79f3('0x10')]){if(_0x33e502[_0x79f3('0x10')][_0x79f3('0x11')]===0x1f4){logger[_0x79f3('0x10')](_0x79f3('0x12'),_0x897ff1,_0x33e502[_0x79f3('0x10')]['message']);return _0x3efa9b(_0x33e502['error'][_0x79f3('0x13')]);}logger[_0x79f3('0x10')]('VoicePrefix,\x20%s,\x20%s',_0x897ff1,_0x33e502[_0x79f3('0x10')][_0x79f3('0x13')]);return _0xa2f557(_0x33e502[_0x79f3('0x10')][_0x79f3('0x13')]);}else{logger['info'](_0x79f3('0x12'),_0x897ff1,_0x79f3('0xd'));_0xa2f557(_0x33e502[_0x79f3('0x14')][_0x79f3('0x13')]);}})[_0x79f3('0x15')](function(_0x1d1f3d){logger[_0x79f3('0x10')](_0x79f3('0x12'),_0x897ff1,_0x1d1f3d);_0x3efa9b(_0x1d1f3d);});});} \ No newline at end of file +var _0x7e4b=['socket.io-emitter','./voicePrefix.socket','register','request','then','info','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','VoicePrefix,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x2eea83,_0x18a77b){var _0x4ced89=function(_0x56607b){while(--_0x56607b){_0x2eea83['push'](_0x2eea83['shift']());}};_0x4ced89(++_0x18a77b);}(_0x7e4b,0x84));var _0xb7e4=function(_0x20cb58,_0x5aa157){_0x20cb58=_0x20cb58-0x0;var _0x4a2028=_0x7e4b[_0x20cb58];return _0x4a2028;};'use strict';var _=require(_0xb7e4('0x0'));var util=require(_0xb7e4('0x1'));var moment=require('moment');var BPromise=require(_0xb7e4('0x2'));var rs=require(_0xb7e4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb7e4('0x4'))['db'];var utils=require(_0xb7e4('0x5'));var logger=require(_0xb7e4('0x6'))(_0xb7e4('0x7'));var config=require(_0xb7e4('0x8'));var jayson=require(_0xb7e4('0x9'));var client=jayson[_0xb7e4('0xa')][_0xb7e4('0xb')]({'port':0x232a});config[_0xb7e4('0xc')]=_['defaults'](config[_0xb7e4('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xb7e4('0xd'))(new Redis(config[_0xb7e4('0xc')]));require(_0xb7e4('0xe'))[_0xb7e4('0xf')](socket);function respondWithRpcPromise(_0xf95b6,_0x3f4213,_0x1c5eb8){return new BPromise(function(_0x1c0633,_0xd998a1){return client[_0xb7e4('0x10')](_0xf95b6,_0x1c5eb8)[_0xb7e4('0x11')](function(_0x23c9f5){logger[_0xb7e4('0x12')]('VoicePrefix,\x20%s,\x20%s',_0x3f4213,'request\x20sent');logger[_0xb7e4('0x13')](_0xb7e4('0x14'),_0x3f4213,'request\x20sent',JSON[_0xb7e4('0x15')](_0x23c9f5));if(_0x23c9f5[_0xb7e4('0x16')]){if(_0x23c9f5[_0xb7e4('0x16')][_0xb7e4('0x17')]===0x1f4){logger[_0xb7e4('0x16')](_0xb7e4('0x18'),_0x3f4213,_0x23c9f5[_0xb7e4('0x16')][_0xb7e4('0x19')]);return _0xd998a1(_0x23c9f5[_0xb7e4('0x16')][_0xb7e4('0x19')]);}logger[_0xb7e4('0x16')](_0xb7e4('0x18'),_0x3f4213,_0x23c9f5[_0xb7e4('0x16')][_0xb7e4('0x19')]);return _0x1c0633(_0x23c9f5['error'][_0xb7e4('0x19')]);}else{logger[_0xb7e4('0x12')](_0xb7e4('0x18'),_0x3f4213,_0xb7e4('0x1a'));_0x1c0633(_0x23c9f5[_0xb7e4('0x1b')][_0xb7e4('0x19')]);}})[_0xb7e4('0x1c')](function(_0x23d919){logger[_0xb7e4('0x16')](_0xb7e4('0x18'),_0x3f4213,_0x23d919);_0xd998a1(_0x23d919);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 3e1134e..f2aa6ff 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 _0x1020=['./voicePrefix.events','remove','update','emit','removeListener','register','length'];(function(_0x488e20,_0x2d61b0){var _0x4099a3=function(_0x16816d){while(--_0x16816d){_0x488e20['push'](_0x488e20['shift']());}};_0x4099a3(++_0x2d61b0);}(_0x1020,0x1a4));var _0x0102=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x1020[_0x397e5f];return _0x5302b8;};'use strict';var VoicePrefixEvents=require(_0x0102('0x0'));var events=['save',_0x0102('0x1'),_0x0102('0x2')];function createListener(_0x35fd2b,_0x15aee5){return function(_0x1240be){_0x15aee5[_0x0102('0x3')](_0x35fd2b,_0x1240be);};}function removeListener(_0x2fea82,_0x3d59aa){return function(){VoicePrefixEvents[_0x0102('0x4')](_0x2fea82,_0x3d59aa);};}exports[_0x0102('0x5')]=function(_0x27dd86){for(var _0x3afe31=0x0,_0x55229f=events[_0x0102('0x6')];_0x3afe31<_0x55229f;_0x3afe31++){var _0x1aa60e=events[_0x3afe31];var _0x43df9f=createListener('voicePrefix:'+_0x1aa60e,_0x27dd86);VoicePrefixEvents['on'](_0x1aa60e,_0x43df9f);}}; \ No newline at end of file +var _0x6ce9=['remove','emit','removeListener','voicePrefix:','./voicePrefix.events','save'];(function(_0x3437a2,_0x4aa5ec){var _0x38ec72=function(_0x39009b){while(--_0x39009b){_0x3437a2['push'](_0x3437a2['shift']());}};_0x38ec72(++_0x4aa5ec);}(_0x6ce9,0x76));var _0x96ce=function(_0x10edc8,_0x14183a){_0x10edc8=_0x10edc8-0x0;var _0x2b10ec=_0x6ce9[_0x10edc8];return _0x2b10ec;};'use strict';var VoicePrefixEvents=require(_0x96ce('0x0'));var events=[_0x96ce('0x1'),_0x96ce('0x2'),'update'];function createListener(_0x48ccd5,_0x18bbb2){return function(_0x5bf6d5){_0x18bbb2[_0x96ce('0x3')](_0x48ccd5,_0x5bf6d5);};}function removeListener(_0x18a969,_0x2b5c98){return function(){VoicePrefixEvents[_0x96ce('0x4')](_0x18a969,_0x2b5c98);};}exports['register']=function(_0xce6b4f){for(var _0x2fe06e=0x0,_0x1a24c7=events['length'];_0x2fe06e<_0x1a24c7;_0x2fe06e++){var _0x1abd8c=events[_0x2fe06e];var _0x16a140=createListener(_0x96ce('0x5')+_0x1abd8c,_0xce6b4f);VoicePrefixEvents['on'](_0x1abd8c,_0x16a140);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index e59a5bb..0b38d65 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 _0x7447=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceQueue.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','addAgents','addLists','put','update','destroy','delete','removeTeams','removeAgents','removeLists','exports','multer'];(function(_0x4f386e,_0x56ffdd){var _0x4694e2=function(_0x3d16e4){while(--_0x3d16e4){_0x4f386e['push'](_0x4f386e['shift']());}};_0x4694e2(++_0x56ffdd);}(_0x7447,0x12c));var _0x7744=function(_0x27bd2c,_0x24bd98){_0x27bd2c=_0x27bd2c-0x0;var _0x3784ea=_0x7447[_0x27bd2c];return _0x3784ea;};'use strict';var multer=require(_0x7744('0x0'));var util=require(_0x7744('0x1'));var path=require(_0x7744('0x2'));var timeout=require(_0x7744('0x3'));var express=require('express');var router=express[_0x7744('0x4')]();var fs_extra=require(_0x7744('0x5'));var auth=require(_0x7744('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7744('0x7'));var controller=require(_0x7744('0x8'));router[_0x7744('0x9')]('/',auth[_0x7744('0xa')](),controller[_0x7744('0xb')]);router['get'](_0x7744('0xc'),auth['isAuthenticated'](),controller[_0x7744('0xd')]);router[_0x7744('0x9')](_0x7744('0xe'),auth[_0x7744('0xa')](),controller[_0x7744('0xf')]);router[_0x7744('0x9')](_0x7744('0x10'),auth['isAuthenticated'](),controller[_0x7744('0x11')]);router[_0x7744('0x9')](_0x7744('0x12'),auth[_0x7744('0xa')](),controller['getHopperFinals']);router[_0x7744('0x9')](_0x7744('0x13'),auth[_0x7744('0xa')](),controller[_0x7744('0x14')]);router[_0x7744('0x9')](_0x7744('0x15'),auth[_0x7744('0xa')](),controller[_0x7744('0x16')]);router[_0x7744('0x9')](_0x7744('0x17'),auth['isAuthenticated'](),controller[_0x7744('0x18')]);router[_0x7744('0x9')]('/:id/members',auth[_0x7744('0xa')](),controller['getMembers']);router[_0x7744('0x9')](_0x7744('0x19'),auth[_0x7744('0xa')](),controller[_0x7744('0x1a')]);router[_0x7744('0x9')](_0x7744('0x1b'),auth[_0x7744('0xa')](),controller[_0x7744('0x1c')]);router[_0x7744('0x1d')]('/',auth[_0x7744('0xa')](),controller[_0x7744('0x1e')]);router[_0x7744('0x1d')](_0x7744('0x1f'),auth[_0x7744('0xa')](),controller[_0x7744('0x20')]);router[_0x7744('0x1d')]('/:id/teams',auth[_0x7744('0xa')](),controller['addTeams']);router[_0x7744('0x1d')](_0x7744('0x17'),auth[_0x7744('0xa')](),controller[_0x7744('0x21')]);router[_0x7744('0x1d')](_0x7744('0x19'),auth[_0x7744('0xa')](),controller[_0x7744('0x22')]);router[_0x7744('0x1d')](_0x7744('0x1b'),auth['isAuthenticated'](),controller['addBlackLists']);router[_0x7744('0x23')](_0x7744('0xc'),auth[_0x7744('0xa')](),controller[_0x7744('0x24')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x7744('0x25')]);router[_0x7744('0x26')](_0x7744('0x15'),auth[_0x7744('0xa')](),controller[_0x7744('0x27')]);router['delete']('/:id/users',auth[_0x7744('0xa')](),controller[_0x7744('0x28')]);router[_0x7744('0x26')](_0x7744('0x19'),auth[_0x7744('0xa')](),controller[_0x7744('0x29')]);router[_0x7744('0x26')](_0x7744('0x1b'),auth['isAuthenticated'](),controller['removeBlackLists']);module[_0x7744('0x2a')]=router; \ No newline at end of file +var _0xa888=['isAuthenticated','index','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','/:id/clone','clone','addTeams','addAgents','/:id/blacklists','addBlackLists','put','/:id','update','delete','destroy','removeTeams','removeAgents','removeLists','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceQueue.controller','get'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xa888,0x13f));var _0x8a88=function(_0x588be9,_0x322db2){_0x588be9=_0x588be9-0x0;var _0x19947c=_0xa888[_0x588be9];return _0x19947c;};'use strict';var multer=require('multer');var util=require(_0x8a88('0x0'));var path=require(_0x8a88('0x1'));var timeout=require('connect-timeout');var express=require(_0x8a88('0x2'));var router=express[_0x8a88('0x3')]();var fs_extra=require(_0x8a88('0x4'));var auth=require(_0x8a88('0x5'));var interaction=require(_0x8a88('0x6'));var config=require('../../config/environment');var controller=require(_0x8a88('0x7'));router[_0x8a88('0x8')]('/',auth[_0x8a88('0x9')](),controller[_0x8a88('0xa')]);router[_0x8a88('0x8')]('/:id',auth[_0x8a88('0x9')](),controller[_0x8a88('0xb')]);router[_0x8a88('0x8')](_0x8a88('0xc'),auth['isAuthenticated'](),controller[_0x8a88('0xd')]);router[_0x8a88('0x8')](_0x8a88('0xe'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0x8a88('0x8')](_0x8a88('0xf'),auth[_0x8a88('0x9')](),controller['getHopperFinals']);router[_0x8a88('0x8')]('/:id/hopper_black',auth[_0x8a88('0x9')](),controller[_0x8a88('0x10')]);router[_0x8a88('0x8')](_0x8a88('0x11'),auth[_0x8a88('0x9')](),controller[_0x8a88('0x12')]);router[_0x8a88('0x8')](_0x8a88('0x13'),auth['isAuthenticated'](),controller[_0x8a88('0x14')]);router['get'](_0x8a88('0x15'),auth['isAuthenticated'](),controller[_0x8a88('0x16')]);router[_0x8a88('0x8')](_0x8a88('0x17'),auth[_0x8a88('0x9')](),controller[_0x8a88('0x18')]);router[_0x8a88('0x8')]('/:id/blacklists',auth['isAuthenticated'](),controller['getBlackLists']);router[_0x8a88('0x19')]('/',auth[_0x8a88('0x9')](),controller['create']);router[_0x8a88('0x19')](_0x8a88('0x1a'),auth[_0x8a88('0x9')](),controller[_0x8a88('0x1b')]);router[_0x8a88('0x19')](_0x8a88('0x11'),auth[_0x8a88('0x9')](),controller[_0x8a88('0x1c')]);router[_0x8a88('0x19')](_0x8a88('0x13'),auth[_0x8a88('0x9')](),controller[_0x8a88('0x1d')]);router[_0x8a88('0x19')](_0x8a88('0x17'),auth['isAuthenticated'](),controller['addLists']);router[_0x8a88('0x19')](_0x8a88('0x1e'),auth[_0x8a88('0x9')](),controller[_0x8a88('0x1f')]);router[_0x8a88('0x20')](_0x8a88('0x21'),auth[_0x8a88('0x9')](),controller[_0x8a88('0x22')]);router[_0x8a88('0x23')](_0x8a88('0x21'),auth['isAuthenticated'](),controller[_0x8a88('0x24')]);router['delete']('/:id/teams',auth[_0x8a88('0x9')](),controller[_0x8a88('0x25')]);router[_0x8a88('0x23')](_0x8a88('0x13'),auth[_0x8a88('0x9')](),controller[_0x8a88('0x26')]);router[_0x8a88('0x23')]('/:id/lists',auth[_0x8a88('0x9')](),controller[_0x8a88('0x27')]);router[_0x8a88('0x23')](_0x8a88('0x1e'),auth[_0x8a88('0x9')](),controller['removeBlackLists']);module[_0x8a88('0x28')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index e3fa16a..2a92938 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 _0x0a9f=['Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','exports','STRING','inbound','ringall','leastrecent','random','linear','wrandom','setDataValue','rrmemory','getDataValue','type','strategy','booked','roundrobin','progressive','predictive','power','INTEGER','yes','ENUM','all','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','preview','Dial\x20Method.','Max\x209999\x20channels,\x200\x20means\x20unlimited.','UNSIGNED','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)'];(function(_0x2980d9,_0xef7ff){var _0x37994e=function(_0x555936){while(--_0x555936){_0x2980d9['push'](_0x2980d9['shift']());}};_0x37994e(++_0xef7ff);}(_0x0a9f,0x64));var _0xf0a9=function(_0x2b608e,_0x2b9d76){_0x2b608e=_0x2b608e-0x0;var _0x2aca67=_0x0a9f[_0x2b608e];return _0x2aca67;};'use strict';var Sequelize=require('sequelize');module[_0xf0a9('0x0')]={'name':{'type':Sequelize[_0xf0a9('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xf0a9('0x2'),'outbound'),'allowNull':![],'defaultValue':_0xf0a9('0x2')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':'default'},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0xf0a9('0x3'),_0xf0a9('0x4'),'fewestcalls',_0xf0a9('0x5'),'rrmemory',_0xf0a9('0x6'),_0xf0a9('0x7'),'rrordered'),'allowNull':![],'defaultValue':_0xf0a9('0x3'),'set':function(_0x27c500){this[_0xf0a9('0x8')]('strategy',_0x27c500?_0x27c500:_0xf0a9('0x9'));},'get':function(){var _0x4be957=this[_0xf0a9('0xa')](_0xf0a9('0xb'));var _0x430a1b=this[_0xf0a9('0xa')]('dialMethod');var _0x1b9d6a=this[_0xf0a9('0xa')](_0xf0a9('0xc'));if(_0x4be957===_0xf0a9('0x2')){return _0x1b9d6a;}if(_0x430a1b==='booked'&&_0x1b9d6a==='rrmemory'||_0x430a1b===_0xf0a9('0xd')&&_0x1b9d6a===_0xf0a9('0xe')){return _0x1b9d6a;}if(_0x430a1b===_0xf0a9('0xf')||_0x430a1b===_0xf0a9('0x10')||_0x430a1b===_0xf0a9('0x11')){return _0x1b9d6a;}return null;}},'servicelevel':{'type':Sequelize[_0xf0a9('0x12')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xf0a9('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0xf0a9('0x12')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xf0a9('0x12')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xf0a9('0x1')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xf0a9('0x12')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM'](_0xf0a9('0x13'),'no'),'defaultValue':_0xf0a9('0x13')},'autopause':{'type':Sequelize[_0xf0a9('0x14')](_0xf0a9('0x13'),'no',_0xf0a9('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xf0a9('0x12')](0xb)},'autopausebusy':{'type':Sequelize[_0xf0a9('0x14')](_0xf0a9('0x13'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xf0a9('0x14')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xf0a9('0x12')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xf0a9('0x14')](_0xf0a9('0x13'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0xf0a9('0x13'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0xf0a9('0x13'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xf0a9('0x14')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xf0a9('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xf0a9('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xf0a9('0x12')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xf0a9('0x12')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xf0a9('0x14')](_0xf0a9('0x13'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xf0a9('0x14')](_0xf0a9('0x13'),'no'),'defaultValue':_0xf0a9('0x13')},'announce_holdtime':{'type':Sequelize[_0xf0a9('0x14')]('yes','no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xf0a9('0x14')](_0xf0a9('0x13'),'no')},'announce_position_limit':{'type':Sequelize[_0xf0a9('0x12')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xf0a9('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xf0a9('0x1')]},'queue_youarenext':{'type':Sequelize[_0xf0a9('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xf0a9('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xf0a9('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xf0a9('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xf0a9('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xf0a9('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xf0a9('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xf0a9('0x1')]},'queue_quantity1':{'type':Sequelize[_0xf0a9('0x1')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0xf0a9('0x1')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x4a569c){this['setDataValue'](_0xf0a9('0x16'),_0x4a569c?_0x4a569c[_0xf0a9('0x17')](','):[]);},'get':function(){return this[_0xf0a9('0xa')]('periodic_announce')?this[_0xf0a9('0xa')]('periodic_announce')[_0xf0a9('0x18')](','):[];}},'joinempty':{'type':Sequelize[_0xf0a9('0x1')],'defaultValue':'yes','set':function(_0x18ac98){this[_0xf0a9('0x8')](_0xf0a9('0x19'),_0x18ac98?_0x18ac98[_0xf0a9('0x17')](','):undefined);},'get':function(){return this[_0xf0a9('0xa')](_0xf0a9('0x19'))?this['getDataValue']('joinempty')['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x41888d){this['setDataValue'](_0xf0a9('0x1a'),_0x41888d?_0x41888d[_0xf0a9('0x17')](','):undefined);},'get':function(){return this[_0xf0a9('0xa')](_0xf0a9('0x1a'))?this[_0xf0a9('0xa')]('leavewhenempty')[_0xf0a9('0x18')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xf0a9('0x14')](_0xf0a9('0x13'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0xf0a9('0x13'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xf0a9('0x14')](_0xf0a9('0x13'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xf0a9('0x1')]},'description':{'type':Sequelize[_0xf0a9('0x1')]},'acw':{'type':Sequelize[_0xf0a9('0x1b')],'defaultValue':0x0,'set':function(_0x12e4ba){this['setDataValue'](_0xf0a9('0x1c'),_0x12e4ba);if(_0x12e4ba){if(this['getDataValue'](_0xf0a9('0x1d'))<0x2){this[_0xf0a9('0x8')](_0xf0a9('0x1d'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xf0a9('0x12')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xf0a9('0x1b')],'defaultValue':0x0,'comment':_0xf0a9('0x1e')},'dialMethod':{'type':Sequelize[_0xf0a9('0x14')](_0xf0a9('0x1f'),'progressive','power',_0xf0a9('0x10'),'booked'),'defaultValue':_0xf0a9('0xf'),'comment':_0xf0a9('0x20')},'dialLimitChannel':{'type':Sequelize[_0xf0a9('0x12')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xf0a9('0x21')},'dialLimitQueue':{'type':Sequelize[_0xf0a9('0x12')](0x4)[_0xf0a9('0x22')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xf0a9('0x23')},'dialPowerLevel':{'type':Sequelize[_0xf0a9('0x24')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0xf0a9('0x14')]('agentBusyFactor',_0xf0a9('0x25')),'defaultValue':_0xf0a9('0x25'),'comment':_0xf0a9('0x26')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xf0a9('0x24')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xf0a9('0x27')},'dialPredictiveInterval':{'type':Sequelize[_0xf0a9('0x12')](0x3)[_0xf0a9('0x22')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xf0a9('0x28')},'dialOriginateCallerIdName':{'type':Sequelize[_0xf0a9('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xf0a9('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0xf0a9('0x12')](0x3)[_0xf0a9('0x22')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf0a9('0x29')},'dialQueueOptions':{'type':Sequelize[_0xf0a9('0x1')],'defaultValue':'tTxX','comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xf0a9('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf0a9('0x2a')},'dialQueueProject':{'type':Sequelize[_0xf0a9('0x1')],'comment':_0xf0a9('0x2b')},'dialCongestionMaxRetry':{'type':Sequelize[_0xf0a9('0x12')](0x3)[_0xf0a9('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf0a9('0x2c')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xf0a9('0x12')](0x5)[_0xf0a9('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf0a9('0x2d')},'dialBusyMaxRetry':{'type':Sequelize[_0xf0a9('0x12')](0x3)[_0xf0a9('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xf0a9('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf0a9('0x2e')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xf0a9('0x12')](0x3)[_0xf0a9('0x22')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xf0a9('0x12')](0x5)[_0xf0a9('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf0a9('0x2f')},'dialGlobalMaxRetry':{'type':Sequelize[_0xf0a9('0x12')](0x3)[_0xf0a9('0x22')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xf0a9('0x30')},'dialTimezone':{'type':Sequelize[_0xf0a9('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xf0a9('0x1')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xf0a9('0x14')](_0xf0a9('0x31'),_0xf0a9('0x32'),_0xf0a9('0x33')),'defaultValue':_0xf0a9('0x31')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xf0a9('0x12')](0x9)[_0xf0a9('0x22')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xf0a9('0x34')},'dialAMDGreeting':{'type':Sequelize[_0xf0a9('0x12')](0x9)[_0xf0a9('0x22')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xf0a9('0x35')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xf0a9('0x12')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xf0a9('0x36')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xf0a9('0x12')](0x9)[_0xf0a9('0x22')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xf0a9('0x37')},'dialAMDMinWordLength':{'type':Sequelize[_0xf0a9('0x12')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xf0a9('0x38')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xf0a9('0x12')](0x9)[_0xf0a9('0x22')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xf0a9('0x39')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xf0a9('0x12')](0x9)[_0xf0a9('0x22')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xf0a9('0x12')](0x5)[_0xf0a9('0x22')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xf0a9('0x22')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xf0a9('0x3a')},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)[_0xf0a9('0x22')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xf0a9('0x3b')},'dialRecallInQueue':{'type':Sequelize[_0xf0a9('0x1b')],'defaultValue':0x0,'comment':_0xf0a9('0x3c')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xf0a9('0x3d'),_0xf0a9('0x3e')),'defaultValue':_0xf0a9('0x3d')},'dialQueueProject2':{'type':Sequelize[_0xf0a9('0x1')],'comment':_0xf0a9('0x2b')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xf0a9('0x1b')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xf0a9('0x22')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xf0a9('0x3f')},'dialCutDigit':{'type':Sequelize[_0xf0a9('0x12')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xf0a9('0x40')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xf0a9('0x12')](0x3)[_0xf0a9('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xf0a9('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xf0a9('0x12')](0x3)[_0xf0a9('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xf0a9('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf0a9('0x41')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xf0a9('0x12')](0x3)[_0xf0a9('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf0a9('0x42')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xf0a9('0x12')](0x5)[_0xf0a9('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xf0a9('0x12')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xf0a9('0x12')](0x5)[_0xf0a9('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xf0a9('0x12')](0x3)[_0xf0a9('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf0a9('0x43')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xf0a9('0x12')](0x5)[_0xf0a9('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf0a9('0x44')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf0a9('0x12')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xf0a9('0x1b')],'defaultValue':![],'comment':_0xf0a9('0x45'),'set':function(_0x3c3c9e){if(!_0x3c3c9e)this[_0xf0a9('0x8')](_0xf0a9('0x46'),null);this[_0xf0a9('0x8')]('mandatoryDisposition',_0x3c3c9e);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xf0a9('0x12')](0x3)[_0xf0a9('0x22')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xf0a9('0x12')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file +var _0x4e06=['all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','preview','progressive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','never','onlyIfOpen','always','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','exports','STRING','name','inbound','outbound','default','ENUM','ringall','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','rrordered','setDataValue','strategy','type','getDataValue','dialMethod','booked','predictive','power','INTEGER','yes'];(function(_0x432f39,_0x103f75){var _0x596f71=function(_0x12133a){while(--_0x12133a){_0x432f39['push'](_0x432f39['shift']());}};_0x596f71(++_0x103f75);}(_0x4e06,0x1d2));var _0x64e0=function(_0x5a2424,_0x33d683){_0x5a2424=_0x5a2424-0x0;var _0x449398=_0x4e06[_0x5a2424];return _0x449398;};'use strict';var Sequelize=require(_0x64e0('0x0'));module[_0x64e0('0x1')]={'name':{'type':Sequelize[_0x64e0('0x2')],'allowNull':![],'unique':_0x64e0('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x64e0('0x4'),_0x64e0('0x5')),'allowNull':![],'defaultValue':_0x64e0('0x4')},'musiconhold':{'type':Sequelize[_0x64e0('0x2')],'defaultValue':_0x64e0('0x6')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0x64e0('0x7')]('rr',_0x64e0('0x8'),_0x64e0('0x9'),_0x64e0('0xa'),_0x64e0('0xb'),_0x64e0('0xc'),_0x64e0('0xd'),_0x64e0('0xe'),_0x64e0('0xf')),'allowNull':![],'defaultValue':_0x64e0('0x8'),'set':function(_0xc6ad41){this[_0x64e0('0x10')](_0x64e0('0x11'),_0xc6ad41?_0xc6ad41:_0x64e0('0xc'));},'get':function(){var _0x34c44a=this['getDataValue'](_0x64e0('0x12'));var _0x1c2320=this[_0x64e0('0x13')](_0x64e0('0x14'));var _0x5a5581=this[_0x64e0('0x13')](_0x64e0('0x11'));if(_0x34c44a===_0x64e0('0x4')){return _0x5a5581;}if(_0x1c2320===_0x64e0('0x15')&&_0x5a5581===_0x64e0('0xc')||_0x1c2320===_0x64e0('0x15')&&_0x5a5581==='roundrobin'){return _0x5a5581;}if(_0x1c2320==='progressive'||_0x1c2320===_0x64e0('0x16')||_0x1c2320===_0x64e0('0x17')){return _0x5a5581;}return null;}},'servicelevel':{'type':Sequelize[_0x64e0('0x18')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x64e0('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x64e0('0x18')](0xb)},'timeout':{'type':Sequelize[_0x64e0('0x18')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize[_0x64e0('0x18')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x64e0('0x18')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x64e0('0x7')](_0x64e0('0x19'),'no'),'defaultValue':_0x64e0('0x19')},'autopause':{'type':Sequelize[_0x64e0('0x7')](_0x64e0('0x19'),'no',_0x64e0('0x1a')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0x64e0('0x7')](_0x64e0('0x19'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x64e0('0x7')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x64e0('0x18')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0x64e0('0x19'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x64e0('0x7')](_0x64e0('0x19'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x64e0('0x7')](_0x64e0('0x19'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0x64e0('0x19'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x64e0('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x64e0('0x18')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x64e0('0x18')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x64e0('0x18')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x64e0('0x7')](_0x64e0('0x19'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0x64e0('0x7')](_0x64e0('0x19'),'no',_0x64e0('0x1b')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x64e0('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x64e0('0x7')](_0x64e0('0x19'),'no')},'announce_position_limit':{'type':Sequelize[_0x64e0('0x18')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x64e0('0x2')]},'queue_youarenext':{'type':Sequelize[_0x64e0('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x64e0('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x64e0('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x64e0('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x64e0('0x2')]},'queue_quantity1':{'type':Sequelize[_0x64e0('0x2')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0x64e0('0x2')]},'periodic_announce':{'type':Sequelize[_0x64e0('0x1c')],'set':function(_0x23e6c9){this[_0x64e0('0x10')](_0x64e0('0x1d'),_0x23e6c9?_0x23e6c9[_0x64e0('0x1e')](','):[]);},'get':function(){return this[_0x64e0('0x13')](_0x64e0('0x1d'))?this[_0x64e0('0x13')](_0x64e0('0x1d'))[_0x64e0('0x1f')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0x64e0('0x19'),'set':function(_0x141883){this[_0x64e0('0x10')](_0x64e0('0x20'),_0x141883?_0x141883[_0x64e0('0x1e')](','):undefined);},'get':function(){return this[_0x64e0('0x13')](_0x64e0('0x20'))?this[_0x64e0('0x13')](_0x64e0('0x20'))[_0x64e0('0x1f')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x64e0('0x2')],'defaultValue':'no','set':function(_0x1be3ee){this[_0x64e0('0x10')](_0x64e0('0x21'),_0x1be3ee?_0x1be3ee[_0x64e0('0x1e')](','):undefined);},'get':function(){return this[_0x64e0('0x13')]('leavewhenempty')?this[_0x64e0('0x13')](_0x64e0('0x21'))[_0x64e0('0x1f')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x64e0('0x19'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0x64e0('0x19'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x64e0('0x2')]},'description':{'type':Sequelize[_0x64e0('0x2')]},'acw':{'type':Sequelize[_0x64e0('0x22')],'defaultValue':0x0,'set':function(_0x427e60){this[_0x64e0('0x10')](_0x64e0('0x23'),_0x427e60);if(_0x427e60){if(this[_0x64e0('0x13')](_0x64e0('0x24'))<0x2){this[_0x64e0('0x10')](_0x64e0('0x24'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x64e0('0x18')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x64e0('0x22')],'defaultValue':0x0,'comment':_0x64e0('0x25')},'dialMethod':{'type':Sequelize[_0x64e0('0x7')](_0x64e0('0x26'),_0x64e0('0x27'),_0x64e0('0x17'),_0x64e0('0x16'),_0x64e0('0x15')),'defaultValue':_0x64e0('0x27'),'comment':_0x64e0('0x28')},'dialLimitChannel':{'type':Sequelize[_0x64e0('0x18')](0x4)[_0x64e0('0x29')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x64e0('0x2a')},'dialLimitQueue':{'type':Sequelize[_0x64e0('0x18')](0x4)[_0x64e0('0x29')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x64e0('0x2b')},'dialPowerLevel':{'type':Sequelize[_0x64e0('0x2c')](0x2)[_0x64e0('0x29')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0x64e0('0x7')](_0x64e0('0x2d'),_0x64e0('0x2e')),'defaultValue':_0x64e0('0x2e'),'comment':_0x64e0('0x2f')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x64e0('0x2c')](0x2)[_0x64e0('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x64e0('0x30')},'dialPredictiveInterval':{'type':Sequelize[_0x64e0('0x18')](0x3)[_0x64e0('0x29')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x64e0('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x64e0('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x64e0('0x29')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x64e0('0x31')},'dialQueueOptions':{'type':Sequelize[_0x64e0('0x2')],'defaultValue':_0x64e0('0x32'),'comment':_0x64e0('0x33')},'dialQueueTimeout':{'type':Sequelize[_0x64e0('0x18')](0x3)[_0x64e0('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0x64e0('0x34')},'dialCongestionMaxRetry':{'type':Sequelize[_0x64e0('0x18')](0x3)[_0x64e0('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x64e0('0x18')](0x5)[_0x64e0('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x64e0('0x35')},'dialBusyMaxRetry':{'type':Sequelize[_0x64e0('0x18')](0x3)[_0x64e0('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x64e0('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x64e0('0x36')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x64e0('0x18')](0x3)[_0x64e0('0x29')],'defaultValue':0x3,'comment':_0x64e0('0x37')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x64e0('0x18')](0x5)[_0x64e0('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x64e0('0x38')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x64e0('0x39')},'dialTimezone':{'type':Sequelize[_0x64e0('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x64e0('0x2')],'defaultValue':_0x64e0('0x3a')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x64e0('0x7')]('always',_0x64e0('0x3b'),_0x64e0('0x3c')),'defaultValue':_0x64e0('0x3d')},'dialAMDActive':{'type':Sequelize[_0x64e0('0x22')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x64e0('0x29')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x64e0('0x3e')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x64e0('0x29')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x64e0('0x18')](0x9)[_0x64e0('0x29')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x64e0('0x3f')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x64e0('0x18')](0x9)[_0x64e0('0x29')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x64e0('0x40')},'dialAMDMinWordLength':{'type':Sequelize[_0x64e0('0x18')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x64e0('0x18')](0x9)[_0x64e0('0x29')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x64e0('0x41')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x64e0('0x29')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x64e0('0x42')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x64e0('0x18')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x64e0('0x43')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x64e0('0x18')](0x9)[_0x64e0('0x29')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x64e0('0x44')},'dialRecallMeTimeout':{'type':Sequelize[_0x64e0('0x18')](0x5)[_0x64e0('0x29')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize[_0x64e0('0x22')],'defaultValue':0x0,'comment':_0x64e0('0x45')},'dialOrderByScheduledAt':{'type':Sequelize[_0x64e0('0x7')](_0x64e0('0x46'),_0x64e0('0x47')),'defaultValue':_0x64e0('0x46')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x64e0('0x22')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x64e0('0x22')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x64e0('0x18')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x64e0('0x18')](0x3)[_0x64e0('0x29')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x64e0('0x48')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x64e0('0x18')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x64e0('0x49')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x64e0('0x18')](0x5)[_0x64e0('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x64e0('0x4a')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x64e0('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x64e0('0x18')](0x5)[_0x64e0('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x64e0('0x4b')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x64e0('0x18')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x64e0('0x4c')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x64e0('0x18')](0x5)[_0x64e0('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x64e0('0x18')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x64e0('0x4d')},'dialMachineRetryFrequency':{'type':Sequelize[_0x64e0('0x18')](0x5)[_0x64e0('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x64e0('0x18')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x64e0('0x4e')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x64e0('0x18')](0x5)[_0x64e0('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x64e0('0x4f')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x64e0('0x18')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x64e0('0x22')],'defaultValue':![],'comment':_0x64e0('0x50'),'set':function(_0x31d210){if(!_0x31d210)this['setDataValue']('mandatoryDispositionPauseId',null);this['setDataValue'](_0x64e0('0x51'),_0x31d210);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x64e0('0x18')](0x3)[_0x64e0('0x29')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x64e0('0x18')](0x3)[_0x64e0('0x29')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index f5bc71b..d53cc41 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 _0x589d=['phone\x20NOT\x20IN\x20(?)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','VoiceQueues','inbound','outbound','filter','ignore','value','includes','type','name','UserProfileResource','destroy','send','index','VoiceQueue','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','include','findAll','rows','catch','show','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','QueueCampaigns','VoiceQueueId','CmHopper','getHopperHistories','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','getTeams','teams','Team','User','Agents','voicePause','interface','flatMap','forEach','penalty','sequelize','transaction','addTeams','each','TeamVoiceQueue','upsert','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','emit','ids','select','from','team_has_voice_queues','join','user_has_teams','VoiceQueueId\x20=\x20?','QueryTypes','SELECT','every','TeamId','all','union','compact','removeTeams','isEmpty','removeAgents','addAgents','spread','online','push','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','field','NOW()','CmListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL'];(function(_0x1f44e4,_0x22d9fd){var _0x591989=function(_0x3aeb88){while(--_0x3aeb88){_0x1f44e4['push'](_0x1f44e4['shift']());}};_0x591989(++_0x22d9fd);}(_0x589d,0x17d));var _0xd589=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x589d[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xd589('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd589('0x1'));var jsonpatch=require(_0xd589('0x2'));var rp=require('request-promise');var moment=require(_0xd589('0x3'));var BPromise=require(_0xd589('0x4'));var Mustache=require('mustache');var util=require(_0xd589('0x5'));var path=require(_0xd589('0x6'));var sox=require(_0xd589('0x7'));var csv=require('to-csv');var ejs=require(_0xd589('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd589('0x9'));var crypto=require(_0xd589('0xa'));var jsforce=require(_0xd589('0xb'));var deskjs=require(_0xd589('0xc'));var toCsv=require(_0xd589('0xd'));var querystring=require(_0xd589('0xe'));var Papa=require(_0xd589('0xf'));var Redis=require(_0xd589('0x10'));var authService=require(_0xd589('0x11'));var qs=require(_0xd589('0x12'));var as=require(_0xd589('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd589('0x14'))('api');var utils=require(_0xd589('0x15'));var config=require(_0xd589('0x16'));var licenseUtil=require(_0xd589('0x17'));var db=require('../../mysqldb')['db'];config[_0xd589('0x18')]=_['defaults'](config[_0xd589('0x18')],{'host':_0xd589('0x19'),'port':0x18eb});var socket=require(_0xd589('0x1a'))(new Redis(config[_0xd589('0x18')]));require(_0xd589('0x1b'))[_0xd589('0x1c')](socket);function respondWithStatusCode(_0x4290cb,_0x48490f){_0x48490f=_0x48490f||0xcc;return function(_0x53595f){if(_0x53595f){return _0x4290cb[_0xd589('0x1d')](_0x48490f);}return _0x4290cb['status'](_0x48490f)[_0xd589('0x1e')]();};}function respondWithResult(_0x25d14c,_0x241776){_0x241776=_0x241776||0xc8;return function(_0x270bdb){if(_0x270bdb){return _0x25d14c[_0xd589('0x1f')](_0x241776)[_0xd589('0x20')](_0x270bdb);}};}function respondWithFilteredResult(_0x454fe1,_0x35d0f2){return function(_0x3a88ce){if(_0x3a88ce){var _0x595906=typeof _0x35d0f2[_0xd589('0x21')]===_0xd589('0x22')&&typeof _0x35d0f2[_0xd589('0x23')]===_0xd589('0x22');var _0x5927c3=_0x3a88ce[_0xd589('0x24')];var _0x278e77=_0x595906?0x0:_0x35d0f2[_0xd589('0x21')];var _0x2861e7=_0x595906?_0x3a88ce['count']:_0x35d0f2[_0xd589('0x21')]+_0x35d0f2[_0xd589('0x23')];var _0x48acf3;if(_0x2861e7>=_0x5927c3){_0x2861e7=_0x5927c3;_0x48acf3=0xc8;}else{_0x48acf3=0xce;}_0x454fe1[_0xd589('0x1f')](_0x48acf3);return _0x454fe1[_0xd589('0x25')](_0xd589('0x26'),_0x278e77+'-'+_0x2861e7+'/'+_0x5927c3)[_0xd589('0x20')](_0x3a88ce);}return null;};}function patchUpdates(_0x53db30){return function(_0x3de80c){try{jsonpatch[_0xd589('0x27')](_0x3de80c,_0x53db30,!![]);}catch(_0x1a1b06){return BPromise[_0xd589('0x28')](_0x1a1b06);}return _0x3de80c[_0xd589('0x29')]();};}function saveUpdates(_0x56b66c,_0x3ecf5a){return function(_0x14f9ae){if(_0x14f9ae){return _0x14f9ae[_0xd589('0x2a')](_0x56b66c)[_0xd589('0x2b')](function(_0x4acfa5){return _0x4acfa5;});}return null;};}function removeEntity(_0x235a2c,_0x5ad5d5){return function(_0x41a395){if(_0x41a395){return _0x41a395['destroy']()[_0xd589('0x2b')](function(){var _0x3765cf=_0x41a395[_0xd589('0x2c')]({'plain':!![]});var _0x19183a=[{'name':_0xd589('0x2d'),'value':_0xd589('0x2e'),'ignore':![]},{'name':'QueueCampaigns','value':_0xd589('0x2f'),'ignore':![]}];var _0x26cc89=_(_0x19183a)[_0xd589('0x30')](_0xd589('0x31'))['map'](_0xd589('0x32'))[_0xd589('0x32')]();if(_[_0xd589('0x33')](_0x26cc89,_0x3765cf[_0xd589('0x34')])){return;}var _0x556f77=_['find'](_0x19183a,[_0xd589('0x32'),_0x3765cf[_0xd589('0x34')]])[_0xd589('0x35')];return db[_0xd589('0x36')][_0xd589('0x37')]({'where':{'type':_0x556f77,'resourceId':_0x3765cf['id']}})[_0xd589('0x2b')](function(){return _0x41a395;});})[_0xd589('0x2b')](function(){_0x235a2c[_0xd589('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14623f,_0x22e956){return function(_0x1cf8a5){if(!_0x1cf8a5){_0x14623f[_0xd589('0x1d')](0x194);}return _0x1cf8a5;};}function handleError(_0x197075,_0x331d24){_0x331d24=_0x331d24||0x1f4;return function(_0x9c6ffa){logger['error'](_0x9c6ffa['stack']);if(_0x9c6ffa['name']){delete _0x9c6ffa[_0xd589('0x35')];}_0x197075[_0xd589('0x1f')](_0x331d24)[_0xd589('0x38')](_0x9c6ffa);};}exports[_0xd589('0x39')]=function(_0x2aca10,_0x31fc5f){var _0xc74b94={},_0x549569={},_0x4b33f3={'count':0x0,'rows':[]};var _0x139f18=_['map'](db[_0xd589('0x3a')][_0xd589('0x3b')],function(_0x18d39c){return{'name':_0x18d39c['fieldName'],'type':_0x18d39c['type'][_0xd589('0x3c')]};});_0x549569[_0xd589('0x3d')]=_[_0xd589('0x3e')](_0x139f18,'name');_0x549569[_0xd589('0x3f')]=_[_0xd589('0x40')](_0x2aca10['query']);_0x549569[_0xd589('0x41')]=_[_0xd589('0x42')](_0x549569[_0xd589('0x3d')],_0x549569['query']);_0xc74b94[_0xd589('0x43')]=_[_0xd589('0x42')](_0x549569['model'],qs[_0xd589('0x44')](_0x2aca10['query'][_0xd589('0x44')]));_0xc74b94[_0xd589('0x43')]=_0xc74b94['attributes'][_0xd589('0x45')]?_0xc74b94[_0xd589('0x43')]:_0x549569[_0xd589('0x3d')];if(!_0x2aca10[_0xd589('0x3f')][_0xd589('0x46')](_0xd589('0x47'))){_0xc74b94[_0xd589('0x23')]=qs[_0xd589('0x23')](_0x2aca10[_0xd589('0x3f')]['limit']);_0xc74b94[_0xd589('0x21')]=qs[_0xd589('0x21')](_0x2aca10[_0xd589('0x3f')][_0xd589('0x21')]);}_0xc74b94[_0xd589('0x48')]=qs['sort'](_0x2aca10[_0xd589('0x3f')][_0xd589('0x49')]);_0xc74b94[_0xd589('0x4a')]=qs[_0xd589('0x41')](_[_0xd589('0x4b')](_0x2aca10[_0xd589('0x3f')],_0x549569[_0xd589('0x41')]),_0x139f18);if(_0x2aca10['query'][_0xd589('0x30')]){_0xc74b94[_0xd589('0x4a')]=_[_0xd589('0x4c')](_0xc74b94['where'],{'$or':_['map'](_0x139f18,function(_0x9a911f){if(_0x9a911f[_0xd589('0x34')]!==_0xd589('0x4d')){var _0x2821fd={};_0x2821fd[_0x9a911f[_0xd589('0x35')]]={'$like':'%'+_0x2aca10[_0xd589('0x3f')][_0xd589('0x30')]+'%'};return _0x2821fd;}})});}_0xc74b94=_[_0xd589('0x4c')]({},_0xc74b94,_0x2aca10[_0xd589('0x4e')]);var _0xb7575a={'where':_0xc74b94['where']};return db[_0xd589('0x3a')][_0xd589('0x24')](_0xb7575a)[_0xd589('0x2b')](function(_0x3a26dd){_0x4b33f3[_0xd589('0x24')]=_0x3a26dd;if(_0x2aca10[_0xd589('0x3f')]['includeAll']){_0xc74b94[_0xd589('0x4f')]=[{'all':!![]}];}return db[_0xd589('0x3a')][_0xd589('0x50')](_0xc74b94);})[_0xd589('0x2b')](function(_0x505273){_0x4b33f3[_0xd589('0x51')]=_0x505273;return _0x4b33f3;})['then'](respondWithFilteredResult(_0x31fc5f,_0xc74b94))[_0xd589('0x52')](handleError(_0x31fc5f,null));};exports[_0xd589('0x53')]=function(_0x28eac4,_0x1ca768){var _0x2cbbc7={'raw':![],'where':{'id':_0x28eac4['params']['id']}},_0x132699={};_0x132699[_0xd589('0x3d')]=_[_0xd589('0x40')](db['VoiceQueue'][_0xd589('0x3b')]);_0x132699[_0xd589('0x3f')]=_[_0xd589('0x40')](_0x28eac4[_0xd589('0x3f')]);_0x132699[_0xd589('0x41')]=_[_0xd589('0x42')](_0x132699[_0xd589('0x3d')],_0x132699[_0xd589('0x3f')]);_0x2cbbc7[_0xd589('0x43')]=_[_0xd589('0x42')](_0x132699[_0xd589('0x3d')],qs['fields'](_0x28eac4[_0xd589('0x3f')][_0xd589('0x44')]));_0x2cbbc7['attributes']=_0x2cbbc7['attributes'][_0xd589('0x45')]?_0x2cbbc7[_0xd589('0x43')]:_0x132699[_0xd589('0x3d')];if(_0x28eac4[_0xd589('0x3f')][_0xd589('0x54')]){_0x2cbbc7['include']=[{'all':!![]}];}_0x2cbbc7=_['merge']({},_0x2cbbc7,_0x28eac4[_0xd589('0x4e')]);return db['VoiceQueue'][_0xd589('0x55')](_0x2cbbc7)[_0xd589('0x2b')](handleEntityNotFound(_0x1ca768,null))[_0xd589('0x2b')](respondWithResult(_0x1ca768,null))['catch'](handleError(_0x1ca768,null));};exports[_0xd589('0x56')]=function(_0xd19626,_0x486dae){return db[_0xd589('0x3a')]['create'](_0xd19626[_0xd589('0x57')],{})['then'](function(_0x39abd1){var _0x59790c=_0xd19626[_0xd589('0x58')][_0xd589('0x2c')]({'plain':!![]});if(!_0x59790c)throw new Error(_0xd589('0x59'));if(_0x59790c[_0xd589('0x5a')]==='user'){var _0x122e8f=_0x39abd1[_0xd589('0x2c')]({'plain':!![]});var _0x38daf2=[{'name':_0xd589('0x2d'),'value':_0xd589('0x2e')},{'name':'QueueCampaigns','value':_0xd589('0x2f')}];var _0x31e138=_['find'](_0x38daf2,[_0xd589('0x32'),_0x122e8f[_0xd589('0x34')]])[_0xd589('0x35')];return db[_0xd589('0x5b')][_0xd589('0x55')]({'where':{'name':_0x31e138,'userProfileId':_0x59790c[_0xd589('0x5c')]},'raw':!![]})[_0xd589('0x2b')](function(_0x3991da){if(_0x3991da&&_0x3991da[_0xd589('0x5d')]===0x0){return db[_0xd589('0x36')][_0xd589('0x56')]({'name':_0x122e8f['name'],'resourceId':_0x122e8f['id'],'type':_0x3991da[_0xd589('0x35')],'sectionId':_0x3991da['id']},{})[_0xd589('0x2b')](function(){return _0x39abd1;});}else{return _0x39abd1;}})['catch'](function(_0x5da123){logger[_0xd589('0x5e')](_0xd589('0x5f'),_0x5da123);throw _0x5da123;});}return _0x39abd1;})[_0xd589('0x2b')](respondWithResult(_0x486dae,0xc9))['catch'](handleError(_0x486dae,null));};exports[_0xd589('0x60')]=function(_0x25dff2,_0x37cf8a){var _0xc45dbc={'where':{'id':_0x25dff2[_0xd589('0x61')]['id']}},_0xbfe960={};_0xbfe960[_0xd589('0x3d')]=_['keys'](db[_0xd589('0x3a')][_0xd589('0x3b')]);_0xc45dbc[_0xd589('0x43')]=_['intersection'](_0xbfe960['model'],qs[_0xd589('0x44')](_0x25dff2['query'][_0xd589('0x44')]));_0xc45dbc[_0xd589('0x43')]=_0xc45dbc[_0xd589('0x43')][_0xd589('0x45')]?_0xc45dbc[_0xd589('0x43')]:_0xbfe960[_0xd589('0x3d')];if(_0x25dff2[_0xd589('0x3f')][_0xd589('0x54')]){_0xc45dbc[_0xd589('0x4f')]=[{'all':!![]}];}_0xc45dbc=_['merge']({},_0xc45dbc,_0x25dff2[_0xd589('0x4e')]);return db['VoiceQueue'][_0xd589('0x55')](_0xc45dbc)['then'](handleEntityNotFound(_0x37cf8a,null))[_0xd589('0x2b')](function(_0x5ce55c){if(_0x5ce55c){var _0x26f699=_0x5ce55c[_0xd589('0x2c')]({'plain':!![]});_0x26f699=qs[_0xd589('0x62')](_0x26f699,['id',_0xd589('0x63'),_0xd589('0x64')]);_0x25dff2[_0xd589('0x57')]=_[_0xd589('0x62')](_0x25dff2[_0xd589('0x57')],['id','createdAt',_0xd589('0x64')]);return db[_0xd589('0x3a')][_0xd589('0x56')](_[_0xd589('0x4c')](_0x26f699,_0x25dff2[_0xd589('0x57')]),{'include':_0x25dff2[_0xd589('0x3f')][_0xd589('0x54')]?[{'all':!![]}]:undefined})[_0xd589('0x2b')](function(_0x4d868a){var _0x1cbce3=_0x25dff2[_0xd589('0x58')]['get']({'plain':!![]});if(!_0x1cbce3)throw new Error(_0xd589('0x59'));if(_0x1cbce3[_0xd589('0x5a')]===_0xd589('0x58')){var _0x3caa01=_0x4d868a[_0xd589('0x2c')]({'plain':!![]});var _0x287eb4=[{'name':_0xd589('0x2d'),'value':'inbound'},{'name':_0xd589('0x65'),'value':_0xd589('0x2f')}];var _0x7193d0=_[_0xd589('0x55')](_0x287eb4,['value',_0x3caa01[_0xd589('0x34')]])['name'];return db[_0xd589('0x5b')]['find']({'where':{'name':_0x7193d0,'userProfileId':_0x1cbce3[_0xd589('0x5c')]},'raw':!![]})[_0xd589('0x2b')](function(_0x47c2ba){if(_0x47c2ba&&_0x47c2ba[_0xd589('0x5d')]===0x0){return db[_0xd589('0x36')][_0xd589('0x56')]({'name':_0x3caa01[_0xd589('0x35')],'resourceId':_0x3caa01['id'],'type':_0x47c2ba[_0xd589('0x35')],'sectionId':_0x47c2ba['id']},{})[_0xd589('0x2b')](function(){return _0x4d868a;});}else{return _0x4d868a;}})[_0xd589('0x52')](function(_0x6ace71){logger[_0xd589('0x5e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x6ace71);throw _0x6ace71;});}return _0x4d868a;});}})[_0xd589('0x2b')](respondWithResult(_0x37cf8a,0xc9))[_0xd589('0x52')](handleError(_0x37cf8a,null));};exports[_0xd589('0x2a')]=function(_0xb3038d,_0x3bd2e9){if(_0xb3038d[_0xd589('0x57')]['id']){delete _0xb3038d[_0xd589('0x57')]['id'];}return db['VoiceQueue'][_0xd589('0x55')]({'where':{'id':_0xb3038d[_0xd589('0x61')]['id']}})[_0xd589('0x2b')](handleEntityNotFound(_0x3bd2e9,null))['then'](saveUpdates(_0xb3038d[_0xd589('0x57')],null))[_0xd589('0x2b')](respondWithResult(_0x3bd2e9,null))[_0xd589('0x52')](handleError(_0x3bd2e9,null));};exports[_0xd589('0x37')]=function(_0x4f0269,_0x547691){return db[_0xd589('0x3a')][_0xd589('0x55')]({'where':{'id':_0x4f0269[_0xd589('0x61')]['id']}})[_0xd589('0x2b')](handleEntityNotFound(_0x547691,null))[_0xd589('0x2b')](removeEntity(_0x547691,null))[_0xd589('0x52')](handleError(_0x547691,null));};exports['getHoppers']=function(_0x31c401,_0x526e0c,_0x242cb8){var _0x2fa449={'raw':![],'where':{}};var _0x176e84={};var _0x4304d9={'count':0x0,'rows':[]};return db[_0xd589('0x3a')]['findOne']({'where':{'id':_0x31c401[_0xd589('0x61')]['id']}})[_0xd589('0x2b')](handleEntityNotFound(_0x526e0c,null))[_0xd589('0x2b')](function(_0x39d0c5){if(_0x39d0c5){_0x176e84[_0xd589('0x3d')]=_['keys'](db['CmHopper']['rawAttributes']);_0x176e84['query']=_[_0xd589('0x40')](_0x31c401[_0xd589('0x3f')]);_0x176e84[_0xd589('0x41')]=_[_0xd589('0x42')](_0x176e84['model'],_0x176e84[_0xd589('0x3f')]);_0x2fa449[_0xd589('0x43')]=_[_0xd589('0x42')](_0x176e84[_0xd589('0x3d')],qs['fields'](_0x31c401['query'][_0xd589('0x44')]));_0x2fa449[_0xd589('0x43')]=_0x2fa449[_0xd589('0x43')]['length']?_0x2fa449[_0xd589('0x43')]:_0x176e84[_0xd589('0x3d')];if(!_0x31c401[_0xd589('0x3f')][_0xd589('0x46')](_0xd589('0x47'))){_0x2fa449[_0xd589('0x23')]=qs['limit'](_0x31c401['query']['limit']);_0x2fa449[_0xd589('0x21')]=qs[_0xd589('0x21')](_0x31c401[_0xd589('0x3f')]['offset']);}_0x2fa449[_0xd589('0x48')]=qs[_0xd589('0x49')](_0x31c401[_0xd589('0x3f')]['sort']);_0x2fa449[_0xd589('0x4a')]=qs[_0xd589('0x41')](_['pick'](_0x31c401['query'],_0x176e84[_0xd589('0x41')]));_0x2fa449['where'][_0xd589('0x66')]=_0x39d0c5['id'];if(_0x31c401[_0xd589('0x3f')][_0xd589('0x30')]){_0x2fa449[_0xd589('0x4a')]=_[_0xd589('0x4c')](_0x2fa449['where'],{'$or':_['map'](_0x2fa449['attributes'],function(_0x51e337){var _0x5045dd={};_0x5045dd[_0x51e337]={'$like':'%'+_0x31c401[_0xd589('0x3f')]['filter']+'%'};return _0x5045dd;})});}_0x2fa449=_[_0xd589('0x4c')]({},_0x2fa449,_0x31c401[_0xd589('0x4e')]);return db['CmHopper']['count']({'where':_0x2fa449['where']})[_0xd589('0x2b')](function(_0x5c1051){_0x4304d9['count']=_0x5c1051;if(_0x31c401[_0xd589('0x3f')][_0xd589('0x54')]){_0x2fa449['include']=[{'all':!![]}];}return db[_0xd589('0x67')][_0xd589('0x50')](_0x2fa449);})[_0xd589('0x2b')](function(_0x4b7e23){_0x4304d9['rows']=_0x4b7e23;return _0x4304d9;});}})['then'](respondWithFilteredResult(_0x526e0c,_0x2fa449))[_0xd589('0x52')](handleError(_0x526e0c,null));};exports[_0xd589('0x68')]=function(_0x43483a,_0x3e0ca0,_0x4ab3e2){var _0x159d0a={'raw':!![],'where':{}};var _0x4473d9={};var _0xbea50f={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xd589('0x69')]({'where':{'id':_0x43483a[_0xd589('0x61')]['id']}})['then'](handleEntityNotFound(_0x3e0ca0,null))[_0xd589('0x2b')](function(_0x43319b){if(_0x43319b){_0x4473d9['model']=_['keys'](db[_0xd589('0x6a')][_0xd589('0x3b')]);_0x4473d9[_0xd589('0x3f')]=_[_0xd589('0x40')](_0x43483a[_0xd589('0x3f')]);_0x4473d9['filters']=_['intersection'](_0x4473d9[_0xd589('0x3d')],_0x4473d9[_0xd589('0x3f')]);_0x159d0a[_0xd589('0x43')]=_[_0xd589('0x42')](_0x4473d9[_0xd589('0x3d')],qs[_0xd589('0x44')](_0x43483a[_0xd589('0x3f')][_0xd589('0x44')]));_0x159d0a[_0xd589('0x43')]=_0x159d0a[_0xd589('0x43')]['length']?_0x159d0a[_0xd589('0x43')]:_0x4473d9[_0xd589('0x3d')];if(!_0x43483a[_0xd589('0x3f')][_0xd589('0x46')](_0xd589('0x47'))){_0x159d0a['limit']=qs['limit'](_0x43483a[_0xd589('0x3f')][_0xd589('0x23')]);_0x159d0a[_0xd589('0x21')]=qs[_0xd589('0x21')](_0x43483a[_0xd589('0x3f')][_0xd589('0x21')]);}_0x159d0a[_0xd589('0x48')]=qs[_0xd589('0x49')](_0x43483a[_0xd589('0x3f')][_0xd589('0x49')]);_0x159d0a['where']=qs[_0xd589('0x41')](_[_0xd589('0x4b')](_0x43483a[_0xd589('0x3f')],_0x4473d9[_0xd589('0x41')]));_0x159d0a[_0xd589('0x4a')][_0xd589('0x66')]=_0x43319b['id'];if(_0x43483a[_0xd589('0x3f')][_0xd589('0x30')]){_0x159d0a[_0xd589('0x4a')]=_[_0xd589('0x4c')](_0x159d0a[_0xd589('0x4a')],{'$or':_['map'](_0x159d0a[_0xd589('0x43')],function(_0x4d7f7a){var _0x300747={};_0x300747[_0x4d7f7a]={'$like':'%'+_0x43483a[_0xd589('0x3f')][_0xd589('0x30')]+'%'};return _0x300747;})});}_0x159d0a=_['merge']({},_0x159d0a,_0x43483a[_0xd589('0x4e')]);return db[_0xd589('0x6a')][_0xd589('0x24')]({'where':_0x159d0a[_0xd589('0x4a')]})[_0xd589('0x2b')](function(_0xd48a44){_0xbea50f[_0xd589('0x24')]=_0xd48a44;if(_0x43483a[_0xd589('0x3f')][_0xd589('0x54')]){_0x159d0a['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0xd589('0x50')](_0x159d0a);})['then'](function(_0x37fcb9){_0xbea50f[_0xd589('0x51')]=_0x37fcb9;return _0xbea50f;});}})[_0xd589('0x2b')](respondWithFilteredResult(_0x3e0ca0,_0x159d0a))['catch'](handleError(_0x3e0ca0,null));};exports[_0xd589('0x6b')]=function(_0x3e44b0,_0x131c1b,_0x9933ec){var _0x7cca0c={'raw':!![],'where':{}};var _0x4d1c9e={};var _0xc58941={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xd589('0x69')]({'where':{'id':_0x3e44b0[_0xd589('0x61')]['id']}})[_0xd589('0x2b')](handleEntityNotFound(_0x131c1b,null))['then'](function(_0x5c1d83){if(_0x5c1d83){_0x4d1c9e[_0xd589('0x3d')]=_[_0xd589('0x40')](db[_0xd589('0x6c')][_0xd589('0x3b')]);_0x4d1c9e[_0xd589('0x3f')]=_[_0xd589('0x40')](_0x3e44b0['query']);_0x4d1c9e[_0xd589('0x41')]=_[_0xd589('0x42')](_0x4d1c9e['model'],_0x4d1c9e[_0xd589('0x3f')]);_0x7cca0c[_0xd589('0x43')]=_[_0xd589('0x42')](_0x4d1c9e[_0xd589('0x3d')],qs[_0xd589('0x44')](_0x3e44b0['query'][_0xd589('0x44')]));_0x7cca0c[_0xd589('0x43')]=_0x7cca0c[_0xd589('0x43')][_0xd589('0x45')]?_0x7cca0c['attributes']:_0x4d1c9e['model'];if(!_0x3e44b0[_0xd589('0x3f')][_0xd589('0x46')](_0xd589('0x47'))){_0x7cca0c[_0xd589('0x23')]=qs['limit'](_0x3e44b0[_0xd589('0x3f')][_0xd589('0x23')]);_0x7cca0c[_0xd589('0x21')]=qs[_0xd589('0x21')](_0x3e44b0[_0xd589('0x3f')][_0xd589('0x21')]);}_0x7cca0c[_0xd589('0x48')]=qs['sort'](_0x3e44b0[_0xd589('0x3f')][_0xd589('0x49')]);_0x7cca0c[_0xd589('0x4a')]=qs[_0xd589('0x41')](_[_0xd589('0x4b')](_0x3e44b0[_0xd589('0x3f')],_0x4d1c9e[_0xd589('0x41')]));_0x7cca0c[_0xd589('0x4a')][_0xd589('0x66')]=_0x5c1d83['id'];if(_0x3e44b0[_0xd589('0x3f')][_0xd589('0x30')]){_0x7cca0c[_0xd589('0x4a')]=_['merge'](_0x7cca0c[_0xd589('0x4a')],{'$or':_[_0xd589('0x3e')](_0x7cca0c['attributes'],function(_0x315e3b){var _0x56270a={};_0x56270a[_0x315e3b]={'$like':'%'+_0x3e44b0['query'][_0xd589('0x30')]+'%'};return _0x56270a;})});}_0x7cca0c=_[_0xd589('0x4c')]({},_0x7cca0c,_0x3e44b0[_0xd589('0x4e')]);return db[_0xd589('0x6c')][_0xd589('0x24')]({'where':_0x7cca0c[_0xd589('0x4a')]})['then'](function(_0x3ca137){_0xc58941[_0xd589('0x24')]=_0x3ca137;if(_0x3e44b0[_0xd589('0x3f')][_0xd589('0x54')]){_0x7cca0c['include']=[{'all':!![]}];}return db[_0xd589('0x6c')][_0xd589('0x50')](_0x7cca0c);})[_0xd589('0x2b')](function(_0xf94ea1){_0xc58941['rows']=_0xf94ea1;return _0xc58941;});}})[_0xd589('0x2b')](respondWithFilteredResult(_0x131c1b,_0x7cca0c))['catch'](handleError(_0x131c1b,null));};exports['getHopperBlacks']=function(_0x50d47a,_0x484950,_0x47be8b){var _0xed05ce={'raw':!![],'where':{}};var _0x43b0f0={};var _0x2a0557={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xd589('0x69')]({'where':{'id':_0x50d47a[_0xd589('0x61')]['id']}})[_0xd589('0x2b')](handleEntityNotFound(_0x484950,null))[_0xd589('0x2b')](function(_0x2f77c7){if(_0x2f77c7){_0x43b0f0[_0xd589('0x3d')]=_['keys'](db[_0xd589('0x6d')]['rawAttributes']);_0x43b0f0[_0xd589('0x3f')]=_[_0xd589('0x40')](_0x50d47a['query']);_0x43b0f0[_0xd589('0x41')]=_[_0xd589('0x42')](_0x43b0f0['model'],_0x43b0f0[_0xd589('0x3f')]);_0xed05ce['attributes']=_['intersection'](_0x43b0f0['model'],qs['fields'](_0x50d47a['query'][_0xd589('0x44')]));_0xed05ce[_0xd589('0x43')]=_0xed05ce[_0xd589('0x43')][_0xd589('0x45')]?_0xed05ce[_0xd589('0x43')]:_0x43b0f0[_0xd589('0x3d')];if(!_0x50d47a[_0xd589('0x3f')][_0xd589('0x46')](_0xd589('0x47'))){_0xed05ce[_0xd589('0x23')]=qs[_0xd589('0x23')](_0x50d47a[_0xd589('0x3f')][_0xd589('0x23')]);_0xed05ce[_0xd589('0x21')]=qs['offset'](_0x50d47a[_0xd589('0x3f')][_0xd589('0x21')]);}_0xed05ce['order']=qs[_0xd589('0x49')](_0x50d47a[_0xd589('0x3f')][_0xd589('0x49')]);_0xed05ce['where']=qs[_0xd589('0x41')](_['pick'](_0x50d47a[_0xd589('0x3f')],_0x43b0f0['filters']));_0xed05ce[_0xd589('0x4a')][_0xd589('0x66')]=_0x2f77c7['id'];if(_0x50d47a['query'][_0xd589('0x30')]){_0xed05ce[_0xd589('0x4a')]=_[_0xd589('0x4c')](_0xed05ce[_0xd589('0x4a')],{'$or':_[_0xd589('0x3e')](_0xed05ce['attributes'],function(_0xd0bc08){var _0x2859e9={};_0x2859e9[_0xd0bc08]={'$like':'%'+_0x50d47a['query'][_0xd589('0x30')]+'%'};return _0x2859e9;})});}_0xed05ce=_[_0xd589('0x4c')]({},_0xed05ce,_0x50d47a[_0xd589('0x4e')]);return db[_0xd589('0x6d')][_0xd589('0x24')]({'where':_0xed05ce[_0xd589('0x4a')]})[_0xd589('0x2b')](function(_0x17ba65){_0x2a0557[_0xd589('0x24')]=_0x17ba65;if(_0x50d47a[_0xd589('0x3f')][_0xd589('0x54')]){_0xed05ce[_0xd589('0x4f')]=[{'all':!![]}];}return db[_0xd589('0x6d')]['findAll'](_0xed05ce);})[_0xd589('0x2b')](function(_0x163222){_0x2a0557['rows']=_0x163222;return _0x2a0557;});}})['then'](respondWithFilteredResult(_0x484950,_0xed05ce))['catch'](handleError(_0x484950,null));};exports[_0xd589('0x6e')]=function(_0x35a849,_0x32454c,_0x9ea485){var _0x1ceec3={};var _0x24b001={};var _0x562eb8;var _0x32abfe;return db[_0xd589('0x3a')][_0xd589('0x69')]({'where':{'id':_0x35a849[_0xd589('0x61')]['id']}})[_0xd589('0x2b')](handleEntityNotFound(_0x32454c,null))['then'](function(_0xcaa1fe){if(_0xcaa1fe){_0x562eb8=_0xcaa1fe;_0x24b001[_0xd589('0x3d')]=_['keys'](db['Team'][_0xd589('0x3b')]);_0x24b001[_0xd589('0x3f')]=_[_0xd589('0x40')](_0x35a849[_0xd589('0x3f')]);_0x24b001['filters']=_[_0xd589('0x42')](_0x24b001[_0xd589('0x3d')],_0x24b001[_0xd589('0x3f')]);_0x1ceec3['attributes']=_[_0xd589('0x42')](_0x24b001[_0xd589('0x3d')],qs[_0xd589('0x44')](_0x35a849[_0xd589('0x3f')]['fields']));_0x1ceec3[_0xd589('0x43')]=_0x1ceec3['attributes']['length']?_0x1ceec3[_0xd589('0x43')]:_0x24b001['model'];_0x1ceec3[_0xd589('0x48')]=qs[_0xd589('0x49')](_0x35a849[_0xd589('0x3f')][_0xd589('0x49')]);_0x1ceec3['where']=qs[_0xd589('0x41')](_['pick'](_0x35a849[_0xd589('0x3f')],_0x24b001[_0xd589('0x41')]));if(_0x35a849[_0xd589('0x3f')]['filter']){_0x1ceec3[_0xd589('0x4a')]=_[_0xd589('0x4c')](_0x1ceec3['where'],{'$or':_[_0xd589('0x3e')](_0x1ceec3[_0xd589('0x43')],function(_0x37a910){var _0x3c007d={};_0x3c007d[_0x37a910]={'$like':'%'+_0x35a849[_0xd589('0x3f')][_0xd589('0x30')]+'%'};return _0x3c007d;})});}_0x1ceec3=_[_0xd589('0x4c')]({},_0x1ceec3,_0x35a849[_0xd589('0x4e')]);return _0x562eb8[_0xd589('0x6e')](_0x1ceec3);}})[_0xd589('0x2b')](function(_0x3d5eee){if(_0x3d5eee){_0x32abfe=_0x3d5eee[_0xd589('0x45')];if(!_0x35a849['query'][_0xd589('0x46')](_0xd589('0x47'))){_0x1ceec3[_0xd589('0x23')]=qs[_0xd589('0x23')](_0x35a849['query'][_0xd589('0x23')]);_0x1ceec3[_0xd589('0x21')]=qs[_0xd589('0x21')](_0x35a849[_0xd589('0x3f')][_0xd589('0x21')]);}return _0x562eb8[_0xd589('0x6e')](_0x1ceec3);}})['then'](function(_0x374d70){if(_0x374d70){return _0x374d70?{'count':_0x32abfe,'rows':_0x374d70}:null;}})[_0xd589('0x2b')](respondWithResult(_0x32454c,null))[_0xd589('0x52')](handleError(_0x32454c,null));};exports['addTeams']=function(_0x1c4a3e,_0x501792,_0x386670){var _0x48b9a2=_0x1c4a3e[_0xd589('0x57')][_0xd589('0x6f')];var _0x4a330c=_[_0xd589('0x3e')](_0x48b9a2,'id');return db[_0xd589('0x70')][_0xd589('0x50')]({'where':{'id':_0x4a330c},'attributes':['id'],'include':[{'model':db[_0xd589('0x71')],'as':_0xd589('0x72'),'attributes':['id',_0xd589('0x35'),'online',_0xd589('0x73'),_0xd589('0x74')],'raw':!![]}]})[_0xd589('0x2b')](function(_0x32c562){if(_0x32c562){var _0x15578a=_[_0xd589('0x75')](_0x32c562,function(_0x3e0b32){var _0x36bb43=_0x3e0b32[_0xd589('0x2c')]({'plain':!![]});_0x36bb43[_0xd589('0x72')][_0xd589('0x76')](function(_0x5e0263){_0x5e0263['penalty']=_['find'](_0x48b9a2,{'id':_0x36bb43['id']})[_0xd589('0x77')];});return _0x36bb43['Agents'];});return db[_0xd589('0x3a')][_0xd589('0x55')]({'where':{'id':_0x1c4a3e[_0xd589('0x61')]['id']}})[_0xd589('0x2b')](function(_0x1e67b8){return db[_0xd589('0x78')][_0xd589('0x79')](function(_0x3ac456){return _0x1e67b8[_0xd589('0x7a')](_0x4a330c,{'transaction':_0x3ac456})[_0xd589('0x2b')](function(){return BPromise[_0xd589('0x7b')](_0x48b9a2,function(_0x1ef8a9){return db[_0xd589('0x7c')][_0xd589('0x7d')]({'TeamId':_0x1ef8a9['id'],'VoiceQueueId':_0x1c4a3e[_0xd589('0x61')]['id'],'penalty':_0x1ef8a9[_0xd589('0x77')]},{'transaction':_0x3ac456});});})['then'](function(){return BPromise[_0xd589('0x7b')](_0x15578a,function(_0xb3854){return db['UserVoiceQueue'][_0xd589('0x7e')]({'where':{'UserId':_0xb3854['id'],'VoiceQueueId':_0x1c4a3e[_0xd589('0x61')]['id']},'defaults':{'penalty':_0xb3854[_0xd589('0x77')]},'transaction':_0x3ac456});});})[_0xd589('0x2b')](function(){return BPromise['each'](_[_0xd589('0x30')](_0x15578a,{'online':!![]}),function(_0x1f88f9){return db[_0xd589('0x7f')][_0xd589('0x7d')]({'membername':_0x1f88f9[_0xd589('0x35')],'UserId':_0x1f88f9['id'],'queue_name':_0x1e67b8[_0xd589('0x35')],'VoiceQueueId':_0x1e67b8['id'],'interface':_[_0xd589('0x80')](_0x1f88f9[_0xd589('0x74')])?util[_0xd589('0x81')](_0xd589('0x82'),_0x1f88f9[_0xd589('0x35')]):_0x1f88f9[_0xd589('0x74')],'paused':_0x1f88f9[_0xd589('0x73')]||![],'penalty':_0x1f88f9[_0xd589('0x77')]},{'transaction':_0x3ac456});});})[_0xd589('0x2b')](function(){_0x15578a['forEach'](function(_0x5b6308){socket[_0xd589('0x83')]('userVoiceQueue:save',{'UserId':_0x5b6308['id'],'VoiceQueueId':_0x1e67b8['id']});});});});});}})[_0xd589('0x2b')](respondWithStatusCode(_0x501792,null))['catch'](handleError(_0x501792,null));};exports['removeTeams']=function(_0x16e923,_0x4fc054,_0x27d12f){return db['Team'][_0xd589('0x50')]({'where':{'id':_0x16e923['query'][_0xd589('0x84')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xd589('0x2b')](handleEntityNotFound(_0x4fc054,null))[_0xd589('0x2b')](function(_0x296ced){var _0x99433e=_[_0xd589('0x3e')](_0x296ced,'id');var _0x20e872=[];var _0xe90c09=[];var _0x1ce33b=squel[_0xd589('0x85')]();_0x1ce33b['field']('tq.TeamId')[_0xd589('0x86')](_0xd589('0x87'),'tq')[_0xd589('0x88')](_0xd589('0x89'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xd589('0x8a'),_0x16e923['params']['id']);for(var _0x4c24f1=0x0;_0x4c24f1<_0x296ced[_0xd589('0x45')];_0x4c24f1+=0x1){let _0x24d408=_0x296ced[_0x4c24f1];for(var _0xb312e1=0x0;_0xb312e1<_0x24d408[_0xd589('0x72')]['length'];_0xb312e1+=0x1){let _0x4df4c4=_0x24d408[_0xd589('0x72')][_0xb312e1];var _0x5a97b8=_0x1ce33b[_0xd589('0x60')]();_0x5a97b8['where']('ut.UserId\x20=\x20?',_0x4df4c4['id']);_0xe90c09['push'](db[_0xd589('0x78')][_0xd589('0x3f')](_0x5a97b8['toString'](),{'type':db['sequelize'][_0xd589('0x8b')][_0xd589('0x8c')]})[_0xd589('0x2b')](function(_0x26f7de){if(_0x26f7de[_0xd589('0x45')]===0x1){return _0x4df4c4['id'];}else{var _0x40f380=_[_0xd589('0x8d')](_[_0xd589('0x3e')](_0x26f7de,_0xd589('0x8e')),function(_0x2ae673){return _[_0xd589('0x33')](_0x99433e,_0x2ae673);});if(_0x40f380){return _0x4df4c4['id'];}}}));}}return BPromise[_0xd589('0x8f')](_0xe90c09)[_0xd589('0x2b')](function(_0x31a2cb){_0x20e872=_(_0x20e872)[_0xd589('0x90')](_0x31a2cb)[_0xd589('0x91')]()[_0xd589('0x32')]();return db[_0xd589('0x3a')][_0xd589('0x55')]({'where':{'id':_0x16e923[_0xd589('0x61')]['id']}})['then'](function(_0x8299f7){return db[_0xd589('0x78')]['transaction'](function(_0x337276){return _0x8299f7[_0xd589('0x92')](_0x16e923[_0xd589('0x3f')][_0xd589('0x84')],{'transaction':_0x337276})['then'](function(){if(!_[_0xd589('0x93')](_0x20e872)){return _0x8299f7[_0xd589('0x94')](_0x20e872,{'transaction':_0x337276})[_0xd589('0x2b')](function(){return db[_0xd589('0x7f')]['destroy']({'where':{'VoiceQueueId':_0x16e923[_0xd589('0x61')]['id'],'UserId':_0x20e872},'transaction':_0x337276});});}})[_0xd589('0x2b')](function(){_0x20e872['forEach'](function(_0x5a8b32){socket[_0xd589('0x83')]('userVoiceQueue:remove',{'UserId':_0x5a8b32,'VoiceQueueId':_0x8299f7['id']});});});});});});})['then'](respondWithStatusCode(_0x4fc054,null))['catch'](handleError(_0x4fc054,null));};exports[_0xd589('0x95')]=function(_0x5aa953,_0x4d8767,_0x4468e7){var _0x186365,_0x214300;return db['VoiceQueue'][_0xd589('0x55')]({'where':{'id':_0x5aa953[_0xd589('0x61')]['id']}})['then'](handleEntityNotFound(_0x4d8767,null))['then'](function(_0x56a1ed){if(_0x56a1ed){_0x214300=_0x56a1ed;return _0x56a1ed['addAgents'](_0x5aa953[_0xd589('0x57')][_0xd589('0x84')],_[_0xd589('0x62')](_0x5aa953[_0xd589('0x57')],[_0xd589('0x84'),'id'])||{})[_0xd589('0x96')](function(_0x53b2e5){for(var _0x36f2e6=0x0;_0x36f2e6<_0x5aa953[_0xd589('0x57')]['ids']['length'];_0x36f2e6+=0x1){socket[_0xd589('0x83')]('userVoiceQueue:save',{'UserId':Number(_0x5aa953[_0xd589('0x57')][_0xd589('0x84')][_0x36f2e6]),'VoiceQueueId':Number(_0x5aa953[_0xd589('0x61')]['id'])});}return _0x53b2e5;});}})[_0xd589('0x2b')](function(_0x25d110){_0x186365=_0x25d110||[];if(_0x214300){return db[_0xd589('0x71')]['findAll']({'where':{'id':_0x5aa953[_0xd589('0x57')][_0xd589('0x84')]},'attributes':['id','name',_0xd589('0x97'),_0xd589('0x73'),_0xd589('0x74')],'raw':!![]});}})[_0xd589('0x2b')](function(_0x51d7f7){if(!_[_0xd589('0x93')](_0x51d7f7)){var _0x3478b7=[];for(var _0x1f4e4e=0x0;_0x1f4e4e<_0x51d7f7[_0xd589('0x45')];_0x1f4e4e++){if(_0x51d7f7[_0x1f4e4e][_0xd589('0x97')]){_0x3478b7[_0xd589('0x98')](db[_0xd589('0x7f')][_0xd589('0x7d')]({'membername':_0x51d7f7[_0x1f4e4e][_0xd589('0x35')],'UserId':_0x51d7f7[_0x1f4e4e]['id'],'queue_name':_0x214300['name'],'VoiceQueueId':_0x214300['id'],'interface':_[_0xd589('0x80')](_0x51d7f7[_0x1f4e4e][_0xd589('0x74')])?util[_0xd589('0x81')](_0xd589('0x82'),_0x51d7f7[_0x1f4e4e]['name']):_0x51d7f7[_0x1f4e4e][_0xd589('0x74')],'paused':_0x51d7f7[_0x1f4e4e][_0xd589('0x73')]||![],'penalty':_0x5aa953[_0xd589('0x57')]['penalty']||0x0}));}}return BPromise[_0xd589('0x8f')](_0x3478b7);}})[_0xd589('0x2b')](function(){return _0x186365;})[_0xd589('0x2b')](respondWithResult(_0x4d8767,null))[_0xd589('0x52')](handleError(_0x4d8767,null));};exports[_0xd589('0x94')]=function(_0x2a4b01,_0x17c0ad,_0x256943){return db[_0xd589('0x3a')][_0xd589('0x55')]({'where':{'id':_0x2a4b01[_0xd589('0x61')]['id']}})[_0xd589('0x2b')](handleEntityNotFound(_0x17c0ad,null))[_0xd589('0x2b')](function(_0x40f938){if(_0x40f938){return _0x40f938[_0xd589('0x94')](_0x2a4b01[_0xd589('0x3f')][_0xd589('0x84')])[_0xd589('0x2b')](function(){if(_[_0xd589('0x99')](_0x2a4b01[_0xd589('0x3f')][_0xd589('0x84')])){for(var _0x2aa19e=0x0;_0x2aa19e<_0x2a4b01[_0xd589('0x3f')][_0xd589('0x84')][_0xd589('0x45')];_0x2aa19e+=0x1){socket[_0xd589('0x83')](_0xd589('0x9a'),{'UserId':Number(_0x2a4b01[_0xd589('0x3f')][_0xd589('0x84')][_0x2aa19e]),'VoiceQueueId':Number(_0x2a4b01[_0xd589('0x61')]['id'])});}}else{socket[_0xd589('0x83')]('userVoiceQueue:remove',{'UserId':Number(_0x2a4b01[_0xd589('0x3f')][_0xd589('0x84')]),'VoiceQueueId':Number(_0x2a4b01[_0xd589('0x61')]['id'])});}});}})[_0xd589('0x2b')](function(_0x28c524){return db[_0xd589('0x7f')][_0xd589('0x37')]({'where':{'VoiceQueueId':_0x2a4b01['params']['id'],'UserId':_0x2a4b01[_0xd589('0x3f')]['ids']}})[_0xd589('0x2b')](function(){return _0x28c524;});})[_0xd589('0x2b')](respondWithStatusCode(_0x17c0ad,null))[_0xd589('0x52')](handleError(_0x17c0ad,null));};exports[_0xd589('0x9b')]=function(_0x5d1098,_0x49a5f6,_0x5d393b){var _0x9c83ca={};var _0x4f7445={};var _0x2d1584;var _0x5c96b8;return db['VoiceQueue'][_0xd589('0x69')]({'where':{'id':_0x5d1098[_0xd589('0x61')]['id']}})[_0xd589('0x2b')](handleEntityNotFound(_0x49a5f6,null))['then'](function(_0x180d3f){if(_0x180d3f){_0x2d1584=_0x180d3f;_0x4f7445[_0xd589('0x3d')]=_[_0xd589('0x40')](db[_0xd589('0x71')][_0xd589('0x3b')]);_0x4f7445[_0xd589('0x3f')]=_[_0xd589('0x40')](_0x5d1098['query']);_0x4f7445[_0xd589('0x41')]=_[_0xd589('0x42')](_0x4f7445[_0xd589('0x3d')],_0x4f7445[_0xd589('0x3f')]);_0x9c83ca[_0xd589('0x43')]=_['intersection'](_0x4f7445['model'],qs[_0xd589('0x44')](_0x5d1098['query']['fields']));_0x9c83ca[_0xd589('0x43')]=_0x9c83ca[_0xd589('0x43')][_0xd589('0x45')]?_0x9c83ca[_0xd589('0x43')]:_0x4f7445[_0xd589('0x3d')];_0x9c83ca[_0xd589('0x48')]=qs[_0xd589('0x49')](_0x5d1098[_0xd589('0x3f')][_0xd589('0x49')]);_0x9c83ca['where']=qs[_0xd589('0x41')](_[_0xd589('0x4b')](_0x5d1098[_0xd589('0x3f')],_0x4f7445['filters']));if(_0x5d1098[_0xd589('0x3f')][_0xd589('0x30')]){_0x9c83ca[_0xd589('0x4a')]=_[_0xd589('0x4c')](_0x9c83ca[_0xd589('0x4a')],{'$or':_[_0xd589('0x3e')](_0x9c83ca[_0xd589('0x43')],function(_0x4b2e83){var _0x37c002={};_0x37c002[_0x4b2e83]={'$like':'%'+_0x5d1098[_0xd589('0x3f')][_0xd589('0x30')]+'%'};return _0x37c002;})});}_0x9c83ca=_[_0xd589('0x4c')]({},_0x9c83ca,_0x5d1098['options']);return _0x2d1584['getAgents'](_0x9c83ca);}})['then'](function(_0x346922){if(_0x346922){_0x5c96b8=_0x346922[_0xd589('0x45')];if(!_0x5d1098['query'][_0xd589('0x46')](_0xd589('0x47'))){_0x9c83ca[_0xd589('0x23')]=qs['limit'](_0x5d1098['query'][_0xd589('0x23')]);_0x9c83ca[_0xd589('0x21')]=qs[_0xd589('0x21')](_0x5d1098[_0xd589('0x3f')][_0xd589('0x21')]);}return _0x2d1584['getAgents'](_0x9c83ca);}})['then'](function(_0xdf01ce){if(_0xdf01ce){return _0xdf01ce?{'count':_0x5c96b8,'rows':_0xdf01ce}:null;}})[_0xd589('0x2b')](respondWithResult(_0x49a5f6,null))['catch'](handleError(_0x49a5f6,null));};exports['getMembers']=function(_0x4e85e0,_0x31233e,_0x5e1528){var _0x3f3650={};var _0x318f34={};var _0x9dd424;var _0x3dcd3a;return db[_0xd589('0x3a')][_0xd589('0x69')]({'where':{'id':_0x4e85e0[_0xd589('0x61')]['id']}})[_0xd589('0x2b')](handleEntityNotFound(_0x31233e,null))[_0xd589('0x2b')](function(_0x5ade51){if(_0x5ade51){_0x9dd424=_0x5ade51;_0x318f34['model']=_['keys'](db['UserVoiceQueueRt'][_0xd589('0x3b')]);_0x318f34[_0xd589('0x3f')]=_['keys'](_0x4e85e0['query']);_0x318f34[_0xd589('0x41')]=_[_0xd589('0x42')](_0x318f34[_0xd589('0x3d')],_0x318f34[_0xd589('0x3f')]);_0x3f3650['attributes']=_[_0xd589('0x42')](_0x318f34['model'],qs[_0xd589('0x44')](_0x4e85e0[_0xd589('0x3f')]['fields']));_0x3f3650[_0xd589('0x43')]=_0x3f3650[_0xd589('0x43')]['length']?_0x3f3650['attributes']:_0x318f34['model'];_0x3f3650['order']=qs[_0xd589('0x49')](_0x4e85e0[_0xd589('0x3f')][_0xd589('0x49')]);_0x3f3650['where']=qs[_0xd589('0x41')](_[_0xd589('0x4b')](_0x4e85e0[_0xd589('0x3f')],_0x318f34[_0xd589('0x41')]));if(_0x4e85e0[_0xd589('0x3f')]['filter']){_0x3f3650[_0xd589('0x4a')]=_[_0xd589('0x4c')](_0x3f3650[_0xd589('0x4a')],{'$or':_[_0xd589('0x3e')](_0x3f3650[_0xd589('0x43')],function(_0x45551c){var _0x170880={};_0x170880[_0x45551c]={'$like':'%'+_0x4e85e0[_0xd589('0x3f')]['filter']+'%'};return _0x170880;})});}_0x3f3650=_['merge']({},_0x3f3650,_0x4e85e0['options']);return _0x9dd424[_0xd589('0x9c')](_0x3f3650);}})['then'](function(_0x5f14ce){if(_0x5f14ce){_0x3dcd3a=_0x5f14ce['length'];if(!_0x4e85e0[_0xd589('0x3f')][_0xd589('0x46')](_0xd589('0x47'))){_0x3f3650[_0xd589('0x23')]=qs[_0xd589('0x23')](_0x4e85e0[_0xd589('0x3f')][_0xd589('0x23')]);_0x3f3650[_0xd589('0x21')]=qs[_0xd589('0x21')](_0x4e85e0['query'][_0xd589('0x21')]);}return _0x9dd424[_0xd589('0x9c')](_0x3f3650);}})[_0xd589('0x2b')](function(_0x166bd2){return _0x166bd2?{'count':_0x3dcd3a,'rows':_0x166bd2}:null;})[_0xd589('0x2b')](respondWithResult(_0x31233e,null))[_0xd589('0x52')](handleError(_0x31233e,null));};exports[_0xd589('0x9d')]=function(_0x232c3e,_0x3419fa,_0xceeb92){var _0x3f43cd={};var _0xcf3e78={};var _0x52b01b;var _0xa945f5;return db[_0xd589('0x3a')]['findOne']({'where':{'id':_0x232c3e['params']['id']}})['then'](handleEntityNotFound(_0x3419fa,null))[_0xd589('0x2b')](function(_0x5ce418){if(_0x5ce418){_0x52b01b=_0x5ce418;_0xcf3e78[_0xd589('0x3d')]=_[_0xd589('0x40')](db[_0xd589('0x9e')][_0xd589('0x3b')]);_0xcf3e78[_0xd589('0x3f')]=_[_0xd589('0x40')](_0x232c3e[_0xd589('0x3f')]);_0xcf3e78[_0xd589('0x41')]=_['intersection'](_0xcf3e78[_0xd589('0x3d')],_0xcf3e78[_0xd589('0x3f')]);_0x3f43cd[_0xd589('0x43')]=_['intersection'](_0xcf3e78[_0xd589('0x3d')],qs[_0xd589('0x44')](_0x232c3e[_0xd589('0x3f')][_0xd589('0x44')]));_0x3f43cd[_0xd589('0x43')]=_0x3f43cd[_0xd589('0x43')][_0xd589('0x45')]?_0x3f43cd['attributes']:_0xcf3e78[_0xd589('0x3d')];_0x3f43cd[_0xd589('0x48')]=qs['sort'](_0x232c3e[_0xd589('0x3f')][_0xd589('0x49')]);_0x3f43cd[_0xd589('0x4a')]=qs[_0xd589('0x41')](_[_0xd589('0x4b')](_0x232c3e['query'],_0xcf3e78[_0xd589('0x41')]));if(_0x232c3e[_0xd589('0x3f')][_0xd589('0x30')]){_0x3f43cd[_0xd589('0x4a')]=_[_0xd589('0x4c')](_0x3f43cd[_0xd589('0x4a')],{'$or':_[_0xd589('0x3e')](_0x3f43cd[_0xd589('0x43')],function(_0x1835d5){var _0x394279={};_0x394279[_0x1835d5]={'$like':'%'+_0x232c3e[_0xd589('0x3f')][_0xd589('0x30')]+'%'};return _0x394279;})});}_0x3f43cd=_[_0xd589('0x4c')]({},_0x3f43cd,_0x232c3e[_0xd589('0x4e')]);return _0x52b01b[_0xd589('0x9d')](_0x3f43cd);}})['then'](function(_0x51d8bf){if(_0x51d8bf){_0xa945f5=_0x51d8bf[_0xd589('0x45')];if(!_0x232c3e['query'][_0xd589('0x46')](_0xd589('0x47'))){_0x3f43cd[_0xd589('0x23')]=qs['limit'](_0x232c3e[_0xd589('0x3f')][_0xd589('0x23')]);_0x3f43cd[_0xd589('0x21')]=qs['offset'](_0x232c3e[_0xd589('0x3f')][_0xd589('0x21')]);}return _0x52b01b[_0xd589('0x9d')](_0x3f43cd);}})[_0xd589('0x2b')](function(_0x299bd3){if(_0x299bd3){return _0x299bd3?{'count':_0xa945f5,'rows':_0x299bd3}:null;}})[_0xd589('0x2b')](respondWithResult(_0x3419fa,null))[_0xd589('0x52')](handleError(_0x3419fa,null));};exports[_0xd589('0x9f')]=function(_0x1cdcc3,_0x2f23a0,_0xa483be){var _0x435955,_0x3bdbd8;return db[_0xd589('0x3a')][_0xd589('0x55')]({'where':{'id':_0x1cdcc3[_0xd589('0x61')]['id']}})[_0xd589('0x2b')](handleEntityNotFound(_0x2f23a0,null))[_0xd589('0x2b')](function(_0x58b55c){if(_0x58b55c){_0x3bdbd8=_0x58b55c;return _0x58b55c[_0xd589('0x9f')](_0x1cdcc3[_0xd589('0x57')]['ids'],_[_0xd589('0x62')](_0x1cdcc3[_0xd589('0x57')],['ids','id'])||{});}return null;})[_0xd589('0x96')](function(_0x57a7d9){var _0x5f3936;_0x435955=_0x57a7d9||[];var _0x3441bd=[];if(_0x57a7d9){for(var _0x28bb0e=0x0;_0x28bb0e<_0x57a7d9[_0xd589('0x45')];_0x28bb0e+=0x1){var _0x2d51ed=_0x57a7d9[_0x28bb0e][_0xd589('0x2c')]({'plain':!![]});_0x3bdbd8['dialCheckDuplicateType']=_0x1cdcc3[_0xd589('0x57')][_0xd589('0xa0')]?_0x1cdcc3['body'][_0xd589('0xa0')]:_0x3bdbd8['dialCheckDuplicateType'];switch(_0x3bdbd8[_0xd589('0xa0')]){case'always':_0x5f3936=squel[_0xd589('0xa1')]()[_0xd589('0xa2')](_0xd589('0xa3'))[_0xd589('0xa4')]([_0xd589('0xa5'),_0xd589('0xa6'),_0xd589('0xa7'),_0xd589('0xa8'),_0xd589('0x66'),_0xd589('0x63'),_0xd589('0x64')],squel[_0xd589('0x85')]()[_0xd589('0xa9')](_0xd589('0xa5'),_0xd589('0xa5'))[_0xd589('0xa9')](_0xd589('0xaa'),_0xd589('0xa6'))[_0xd589('0xa9')]('id',_0xd589('0xa7'))[_0xd589('0xa9')](_0x2d51ed[_0xd589('0xab')][_0xd589('0xac')](),_0xd589('0xa8'))[_0xd589('0xa9')](_0x1cdcc3[_0xd589('0x61')]['id']['toString'](),_0xd589('0x66'))['field'](_0xd589('0xaa'),_0xd589('0x63'))['field']('NOW()',_0xd589('0x64'))[_0xd589('0x86')](_0xd589('0xad'))[_0xd589('0x4a')](_0xd589('0xae'))[_0xd589('0x4a')](_0xd589('0xaf'),_0x2d51ed['CmListId'][_0xd589('0xac')]())[_0xd589('0x4a')](_0xd589('0xb0'))[_0xd589('0x4a')](_0xd589('0xb1'),squel['select']()[_0xd589('0xa9')]('COALESCE(calleridnum,\x27\x27)')[_0xd589('0x86')](_0xd589('0xb2'))[_0xd589('0x4a')](_0xd589('0x8a'),_0x1cdcc3[_0xd589('0x61')]['id']['toString']()))[_0xd589('0x4a')]('phone\x20NOT\x20IN\x20(?)',squel[_0xd589('0x85')]()['field'](_0xd589('0xb3'))[_0xd589('0x86')](_0xd589('0xa3'))['where'](_0xd589('0x8a'),_0x1cdcc3[_0xd589('0x61')]['id'][_0xd589('0xac')]())))['toString']();break;case _0xd589('0xb4'):_0x5f3936=squel[_0xd589('0xa1')]()['into'](_0xd589('0xa3'))['fromQuery']([_0xd589('0xa5'),_0xd589('0xa6'),_0xd589('0xa7'),_0xd589('0xa8'),'VoiceQueueId',_0xd589('0x63'),_0xd589('0x64')],squel[_0xd589('0x85')]()['field'](_0xd589('0xa5'),_0xd589('0xa5'))[_0xd589('0xa9')](_0xd589('0xaa'),_0xd589('0xa6'))[_0xd589('0xa9')]('id',_0xd589('0xa7'))[_0xd589('0xa9')](_0x2d51ed[_0xd589('0xab')]['toString'](),'ListId')[_0xd589('0xa9')](_0x1cdcc3[_0xd589('0x61')]['id'][_0xd589('0xac')](),_0xd589('0x66'))[_0xd589('0xa9')]('NOW()',_0xd589('0x63'))['field'](_0xd589('0xaa'),_0xd589('0x64'))[_0xd589('0x86')](_0xd589('0xad'))[_0xd589('0x4a')]('deletedAt\x20IS\x20NULL')[_0xd589('0x4a')](_0xd589('0xaf'),_0x2d51ed[_0xd589('0xab')][_0xd589('0xac')]())[_0xd589('0x4a')]('phone\x20IS\x20NOT\x20NULL')[_0xd589('0x4a')]('phone\x20NOT\x20IN\x20(?)',squel[_0xd589('0x85')]()['field']('COALESCE(phone,\x27\x27)')[_0xd589('0x86')]('cm_hopper')[_0xd589('0x4a')]('VoiceQueueId\x20=\x20?',_0x1cdcc3[_0xd589('0x61')]['id'][_0xd589('0xac')]())))[_0xd589('0xac')]();break;default:_0x5f3936=squel[_0xd589('0xa1')]()['into'](_0xd589('0xa3'))['fromQuery']([_0xd589('0xa5'),'scheduledAt',_0xd589('0xa7'),_0xd589('0xa8'),_0xd589('0x66'),_0xd589('0x63'),_0xd589('0x64')],squel['select']()[_0xd589('0xa9')](_0xd589('0xa5'),_0xd589('0xa5'))[_0xd589('0xa9')](_0xd589('0xaa'),_0xd589('0xa6'))['field']('id','ContactId')[_0xd589('0xa9')](_0x2d51ed[_0xd589('0xab')][_0xd589('0xac')](),_0xd589('0xa8'))[_0xd589('0xa9')](_0x1cdcc3[_0xd589('0x61')]['id']['toString'](),_0xd589('0x66'))[_0xd589('0xa9')]('NOW()',_0xd589('0x63'))[_0xd589('0xa9')](_0xd589('0xaa'),_0xd589('0x64'))['from']('cm_contacts')['where'](_0xd589('0xae'))['where']('ListId\x20=\x20?',_0x2d51ed[_0xd589('0xab')][_0xd589('0xac')]())['where'](_0xd589('0xb0')))[_0xd589('0xac')]();}_0x3441bd[_0xd589('0x98')](db[_0xd589('0x78')][_0xd589('0x3f')](_0x5f3936));}return BPromise[_0xd589('0x8f')](_0x3441bd);}})['then'](function(){return _0x435955;})['then'](respondWithResult(_0x2f23a0,null))['catch'](handleError(_0x2f23a0,null));};exports[_0xd589('0xb5')]=function(_0x1f8a43,_0x1ce41f,_0x3e0077){return db['VoiceQueue'][_0xd589('0x55')]({'where':{'id':_0x1f8a43[_0xd589('0x61')]['id']}})[_0xd589('0x2b')](handleEntityNotFound(_0x1ce41f,null))[_0xd589('0x2b')](function(_0x44e5d9){if(_0x44e5d9){return _0x44e5d9[_0xd589('0xb5')](_0x1f8a43[_0xd589('0x3f')][_0xd589('0x84')]);}})['then'](function(_0xbc411d){if(_0xbc411d){return db['CmHopper'][_0xd589('0x37')]({'where':{'ListId':_0x1f8a43[_0xd589('0x3f')][_0xd589('0x84')],'VoiceQueueId':_0x1f8a43[_0xd589('0x61')]['id']}})['then'](function(){return _0xbc411d;});}})['then'](respondWithStatusCode(_0x1ce41f,null))[_0xd589('0x52')](handleError(_0x1ce41f,null));};exports[_0xd589('0xb6')]=function(_0x49cff2,_0x5008d7,_0x337fab){var _0x18c7c9={};var _0x4b5bed={};var _0xc20fff;var _0x4fea97;return db[_0xd589('0x3a')][_0xd589('0x69')]({'where':{'id':_0x49cff2[_0xd589('0x61')]['id']}})[_0xd589('0x2b')](handleEntityNotFound(_0x5008d7,null))[_0xd589('0x2b')](function(_0x20677f){if(_0x20677f){_0xc20fff=_0x20677f;_0x4b5bed[_0xd589('0x3d')]=_[_0xd589('0x40')](db[_0xd589('0x9e')][_0xd589('0x3b')]);_0x4b5bed[_0xd589('0x3f')]=_[_0xd589('0x40')](_0x49cff2[_0xd589('0x3f')]);_0x4b5bed[_0xd589('0x41')]=_[_0xd589('0x42')](_0x4b5bed[_0xd589('0x3d')],_0x4b5bed[_0xd589('0x3f')]);_0x18c7c9[_0xd589('0x43')]=_[_0xd589('0x42')](_0x4b5bed[_0xd589('0x3d')],qs[_0xd589('0x44')](_0x49cff2[_0xd589('0x3f')]['fields']));_0x18c7c9[_0xd589('0x43')]=_0x18c7c9['attributes'][_0xd589('0x45')]?_0x18c7c9[_0xd589('0x43')]:_0x4b5bed[_0xd589('0x3d')];_0x18c7c9[_0xd589('0x48')]=qs[_0xd589('0x49')](_0x49cff2[_0xd589('0x3f')][_0xd589('0x49')]);_0x18c7c9[_0xd589('0x4a')]=qs['filters'](_[_0xd589('0x4b')](_0x49cff2[_0xd589('0x3f')],_0x4b5bed[_0xd589('0x41')]));if(_0x49cff2[_0xd589('0x3f')]['filter']){_0x18c7c9['where']=_[_0xd589('0x4c')](_0x18c7c9['where'],{'$or':_[_0xd589('0x3e')](_0x18c7c9[_0xd589('0x43')],function(_0x288372){var _0x255d47={};_0x255d47[_0x288372]={'$like':'%'+_0x49cff2[_0xd589('0x3f')][_0xd589('0x30')]+'%'};return _0x255d47;})});}_0x18c7c9=_[_0xd589('0x4c')]({},_0x18c7c9,_0x49cff2[_0xd589('0x4e')]);return _0xc20fff[_0xd589('0xb6')](_0x18c7c9);}})[_0xd589('0x2b')](function(_0x11d72f){if(_0x11d72f){_0x4fea97=_0x11d72f['length'];if(!_0x49cff2[_0xd589('0x3f')][_0xd589('0x46')](_0xd589('0x47'))){_0x18c7c9[_0xd589('0x23')]=qs['limit'](_0x49cff2[_0xd589('0x3f')][_0xd589('0x23')]);_0x18c7c9[_0xd589('0x21')]=qs[_0xd589('0x21')](_0x49cff2[_0xd589('0x3f')][_0xd589('0x21')]);}return _0xc20fff['getBlackLists'](_0x18c7c9);}})[_0xd589('0x2b')](function(_0x14f759){if(_0x14f759){return _0x14f759?{'count':_0x4fea97,'rows':_0x14f759}:null;}})[_0xd589('0x2b')](respondWithResult(_0x5008d7,null))[_0xd589('0x52')](handleError(_0x5008d7,null));};exports[_0xd589('0xb7')]=function(_0x4957a9,_0x263b41,_0x37b356){var _0x44a633,_0x190e4c;return db[_0xd589('0x3a')]['find']({'where':{'id':_0x4957a9[_0xd589('0x61')]['id']}})['then'](handleEntityNotFound(_0x263b41,null))[_0xd589('0x2b')](function(_0x4e2681){if(_0x4e2681){_0x190e4c=_0x4e2681;return _0x4e2681[_0xd589('0xb7')](_0x4957a9[_0xd589('0x57')][_0xd589('0x84')],_[_0xd589('0x62')](_0x4957a9[_0xd589('0x57')],[_0xd589('0x84'),'id'])||{});}return null;})[_0xd589('0x96')](function(_0x1405a4){var _0x52afeb;_0x44a633=_0x1405a4||[];var _0x52d7df=[];if(_0x1405a4){for(var _0x46039d=0x0;_0x46039d<_0x1405a4['length'];_0x46039d+=0x1){var _0x444e4a=_0x1405a4[_0x46039d]['get']({'plain':!![]});_0x52afeb=squel['insert']()[_0xd589('0xa2')](_0xd589('0xb8'))['fromQuery']([_0xd589('0xa5'),'ContactId',_0xd589('0xa8'),_0xd589('0x66'),_0xd589('0x63'),'updatedAt'],squel[_0xd589('0x85')]()['field'](_0xd589('0xa5'),_0xd589('0xa5'))[_0xd589('0xa9')]('id',_0xd589('0xa7'))[_0xd589('0xa9')](_0x444e4a[_0xd589('0xab')][_0xd589('0xac')](),_0xd589('0xa8'))[_0xd589('0xa9')](_0x4957a9[_0xd589('0x61')]['id'][_0xd589('0xac')](),_0xd589('0x66'))['field'](_0xd589('0xaa'),_0xd589('0x63'))[_0xd589('0xa9')]('NOW()',_0xd589('0x64'))[_0xd589('0x86')](_0xd589('0xad'))['where']('deletedAt\x20IS\x20NULL')[_0xd589('0x4a')](_0xd589('0xaf'),_0x444e4a[_0xd589('0xab')]['toString']())['where'](_0xd589('0xb0')))['toString']();_0x52d7df['push'](db[_0xd589('0x78')]['query'](_0x52afeb));}return BPromise['all'](_0x52d7df);}})[_0xd589('0x2b')](function(){return _0x44a633;})[_0xd589('0x2b')](respondWithResult(_0x263b41,null))[_0xd589('0x52')](handleError(_0x263b41,null));};exports[_0xd589('0xb9')]=function(_0x40c5da,_0x20756c,_0x3abf2b){return db[_0xd589('0x3a')]['find']({'where':{'id':_0x40c5da[_0xd589('0x61')]['id']}})[_0xd589('0x2b')](handleEntityNotFound(_0x20756c,null))['then'](function(_0x4e0c18){if(_0x4e0c18){return _0x4e0c18[_0xd589('0xb9')](_0x40c5da[_0xd589('0x3f')][_0xd589('0x84')]);}})['then'](function(_0x5ad4c0){if(_0x5ad4c0){return db[_0xd589('0x6d')]['destroy']({'where':{'ListId':_0x40c5da[_0xd589('0x3f')][_0xd589('0x84')],'VoiceQueueId':_0x40c5da[_0xd589('0x61')]['id']}})[_0xd589('0x2b')](function(){return _0x5ad4c0;});}})[_0xd589('0x2b')](respondWithStatusCode(_0x20756c,null))[_0xd589('0x52')](handleError(_0x20756c,null));}; \ No newline at end of file +var _0xc229=['user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','isEmpty','removeAgents','UserVoiceQueueRt','userVoiceQueue:remove','addAgents','isNil','all','getAgents','getMembers','addLists','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','NOW()','toString','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','onlyIfOpen','insert','CmListId','deletedAt\x20IS\x20NULL','removeLists','getBlackLists','CmList','addBlackLists','spread','removeBlackLists','eml-format','zip-dir','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/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueue.socket','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','find','destroy','stack','name','send','index','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','VIRTUAL','merge','includeAll','include','VoiceQueue','findAll','rows','catch','show','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','userProfileId','autoAssociation','UserProfileResource','error','clone','params','options','omit','createdAt','updatedAt','user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','CmHopper','VoiceQueueId','getHopperHistories','findOne','CmHopperHistory','nolimit','pick','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','teams','Team','User','online','voicePause','interface','flatMap','forEach','penalty','Agents','sequelize','transaction','addTeams','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','format','SIP/%s','emit','ids','select','field','from','team_has_voice_queues','join'];(function(_0x506dbc,_0x3fb0f0){var _0x8f93c2=function(_0x3376d5){while(--_0x3376d5){_0x506dbc['push'](_0x506dbc['shift']());}};_0x8f93c2(++_0x3fb0f0);}(_0xc229,0x1a1));var _0x9c22=function(_0x36d6bd,_0x180c31){_0x36d6bd=_0x36d6bd-0x0;var _0x29ce8c=_0xc229[_0x36d6bd];return _0x29ce8c;};'use strict';var emlformat=require(_0x9c22('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9c22('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9c22('0x2'));var moment=require(_0x9c22('0x3'));var BPromise=require(_0x9c22('0x4'));var Mustache=require(_0x9c22('0x5'));var util=require(_0x9c22('0x6'));var path=require(_0x9c22('0x7'));var sox=require(_0x9c22('0x8'));var csv=require(_0x9c22('0x9'));var ejs=require(_0x9c22('0xa'));var fs=require('fs');var fs_extra=require(_0x9c22('0xb'));var _=require('lodash');var squel=require(_0x9c22('0xc'));var crypto=require('crypto');var jsforce=require(_0x9c22('0xd'));var deskjs=require(_0x9c22('0xe'));var toCsv=require(_0x9c22('0x9'));var querystring=require(_0x9c22('0xf'));var Papa=require(_0x9c22('0x10'));var Redis=require(_0x9c22('0x11'));var authService=require(_0x9c22('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x9c22('0x13'));var hardwareService=require(_0x9c22('0x14'));var logger=require(_0x9c22('0x15'))(_0x9c22('0x16'));var utils=require('../../config/utils');var config=require(_0x9c22('0x17'));var licenseUtil=require(_0x9c22('0x18'));var db=require(_0x9c22('0x19'))['db'];config[_0x9c22('0x1a')]=_['defaults'](config[_0x9c22('0x1a')],{'host':_0x9c22('0x1b'),'port':0x18eb});var socket=require(_0x9c22('0x1c'))(new Redis(config[_0x9c22('0x1a')]));require(_0x9c22('0x1d'))['register'](socket);function respondWithStatusCode(_0xae8ebd,_0x2d7f7d){_0x2d7f7d=_0x2d7f7d||0xcc;return function(_0x4f50ea){if(_0x4f50ea){return _0xae8ebd[_0x9c22('0x1e')](_0x2d7f7d);}return _0xae8ebd['status'](_0x2d7f7d)['end']();};}function respondWithResult(_0x36aa52,_0x42c1b3){_0x42c1b3=_0x42c1b3||0xc8;return function(_0x31ca4f){if(_0x31ca4f){return _0x36aa52[_0x9c22('0x1f')](_0x42c1b3)[_0x9c22('0x20')](_0x31ca4f);}};}function respondWithFilteredResult(_0x5422be,_0x221d20){return function(_0x375dbf){if(_0x375dbf){var _0x3836ff=typeof _0x221d20['offset']===_0x9c22('0x21')&&typeof _0x221d20['limit']===_0x9c22('0x21');var _0x1f176c=_0x375dbf[_0x9c22('0x22')];var _0x1efee5=_0x3836ff?0x0:_0x221d20[_0x9c22('0x23')];var _0x4f7647=_0x3836ff?_0x375dbf[_0x9c22('0x22')]:_0x221d20[_0x9c22('0x23')]+_0x221d20[_0x9c22('0x24')];var _0x1b3594;if(_0x4f7647>=_0x1f176c){_0x4f7647=_0x1f176c;_0x1b3594=0xc8;}else{_0x1b3594=0xce;}_0x5422be['status'](_0x1b3594);return _0x5422be[_0x9c22('0x25')](_0x9c22('0x26'),_0x1efee5+'-'+_0x4f7647+'/'+_0x1f176c)[_0x9c22('0x20')](_0x375dbf);}return null;};}function patchUpdates(_0x420015){return function(_0x573538){try{jsonpatch[_0x9c22('0x27')](_0x573538,_0x420015,!![]);}catch(_0x15b9b7){return BPromise[_0x9c22('0x28')](_0x15b9b7);}return _0x573538[_0x9c22('0x29')]();};}function saveUpdates(_0x136606,_0xe19422){return function(_0x511af7){if(_0x511af7){return _0x511af7[_0x9c22('0x2a')](_0x136606)[_0x9c22('0x2b')](function(_0x21be02){return _0x21be02;});}return null;};}function removeEntity(_0x30a21b,_0x4ae501){return function(_0x1e9c9d){if(_0x1e9c9d){return _0x1e9c9d['destroy']()[_0x9c22('0x2b')](function(){var _0x1bde0d=_0x1e9c9d['get']({'plain':!![]});var _0x614419=[{'name':_0x9c22('0x2c'),'value':_0x9c22('0x2d'),'ignore':![]},{'name':_0x9c22('0x2e'),'value':_0x9c22('0x2f'),'ignore':![]}];var _0x43498b=_(_0x614419)[_0x9c22('0x30')](_0x9c22('0x31'))[_0x9c22('0x32')](_0x9c22('0x33'))[_0x9c22('0x33')]();if(_[_0x9c22('0x34')](_0x43498b,_0x1bde0d[_0x9c22('0x35')])){return;}var _0x4b8266=_[_0x9c22('0x36')](_0x614419,[_0x9c22('0x33'),_0x1bde0d[_0x9c22('0x35')]])['name'];return db['UserProfileResource'][_0x9c22('0x37')]({'where':{'type':_0x4b8266,'resourceId':_0x1bde0d['id']}})['then'](function(){return _0x1e9c9d;});})[_0x9c22('0x2b')](function(){_0x30a21b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2aa6a4,_0x33afc2){return function(_0x44b857){if(!_0x44b857){_0x2aa6a4['sendStatus'](0x194);}return _0x44b857;};}function handleError(_0x10804c,_0x1a59eb){_0x1a59eb=_0x1a59eb||0x1f4;return function(_0x8673c0){logger['error'](_0x8673c0[_0x9c22('0x38')]);if(_0x8673c0['name']){delete _0x8673c0[_0x9c22('0x39')];}_0x10804c[_0x9c22('0x1f')](_0x1a59eb)[_0x9c22('0x3a')](_0x8673c0);};}exports[_0x9c22('0x3b')]=function(_0x515fdf,_0x1b5a37){var _0x2770b5={},_0x1a2314={},_0x3bfd31={'count':0x0,'rows':[]};var _0xe5aa4f=_[_0x9c22('0x32')](db['VoiceQueue'][_0x9c22('0x3c')],function(_0x5c76e7){return{'name':_0x5c76e7[_0x9c22('0x3d')],'type':_0x5c76e7[_0x9c22('0x35')]['key']};});_0x1a2314[_0x9c22('0x3e')]=_[_0x9c22('0x32')](_0xe5aa4f,'name');_0x1a2314[_0x9c22('0x3f')]=_[_0x9c22('0x40')](_0x515fdf['query']);_0x1a2314[_0x9c22('0x41')]=_[_0x9c22('0x42')](_0x1a2314[_0x9c22('0x3e')],_0x1a2314['query']);_0x2770b5[_0x9c22('0x43')]=_[_0x9c22('0x42')](_0x1a2314['model'],qs['fields'](_0x515fdf['query'][_0x9c22('0x44')]));_0x2770b5[_0x9c22('0x43')]=_0x2770b5[_0x9c22('0x43')][_0x9c22('0x45')]?_0x2770b5['attributes']:_0x1a2314[_0x9c22('0x3e')];if(!_0x515fdf['query'][_0x9c22('0x46')]('nolimit')){_0x2770b5['limit']=qs[_0x9c22('0x24')](_0x515fdf[_0x9c22('0x3f')][_0x9c22('0x24')]);_0x2770b5['offset']=qs[_0x9c22('0x23')](_0x515fdf[_0x9c22('0x3f')][_0x9c22('0x23')]);}_0x2770b5[_0x9c22('0x47')]=qs['sort'](_0x515fdf['query'][_0x9c22('0x48')]);_0x2770b5['where']=qs[_0x9c22('0x41')](_['pick'](_0x515fdf[_0x9c22('0x3f')],_0x1a2314[_0x9c22('0x41')]),_0xe5aa4f);if(_0x515fdf[_0x9c22('0x3f')][_0x9c22('0x30')]){_0x2770b5['where']=_['merge'](_0x2770b5[_0x9c22('0x49')],{'$or':_[_0x9c22('0x32')](_0xe5aa4f,function(_0x2bcb15){if(_0x2bcb15['type']!==_0x9c22('0x4a')){var _0x280642={};_0x280642[_0x2bcb15[_0x9c22('0x39')]]={'$like':'%'+_0x515fdf[_0x9c22('0x3f')][_0x9c22('0x30')]+'%'};return _0x280642;}})});}_0x2770b5=_[_0x9c22('0x4b')]({},_0x2770b5,_0x515fdf['options']);var _0x2228f9={'where':_0x2770b5[_0x9c22('0x49')]};return db['VoiceQueue'][_0x9c22('0x22')](_0x2228f9)['then'](function(_0x3ab61c){_0x3bfd31['count']=_0x3ab61c;if(_0x515fdf[_0x9c22('0x3f')][_0x9c22('0x4c')]){_0x2770b5[_0x9c22('0x4d')]=[{'all':!![]}];}return db[_0x9c22('0x4e')][_0x9c22('0x4f')](_0x2770b5);})[_0x9c22('0x2b')](function(_0x36fcb9){_0x3bfd31[_0x9c22('0x50')]=_0x36fcb9;return _0x3bfd31;})['then'](respondWithFilteredResult(_0x1b5a37,_0x2770b5))[_0x9c22('0x51')](handleError(_0x1b5a37,null));};exports[_0x9c22('0x52')]=function(_0x2e8bfd,_0x5614da){var _0x446d5f={'raw':![],'where':{'id':_0x2e8bfd['params']['id']}},_0x36533c={};_0x36533c[_0x9c22('0x3e')]=_['keys'](db[_0x9c22('0x4e')][_0x9c22('0x3c')]);_0x36533c[_0x9c22('0x3f')]=_[_0x9c22('0x40')](_0x2e8bfd[_0x9c22('0x3f')]);_0x36533c[_0x9c22('0x41')]=_[_0x9c22('0x42')](_0x36533c[_0x9c22('0x3e')],_0x36533c[_0x9c22('0x3f')]);_0x446d5f[_0x9c22('0x43')]=_[_0x9c22('0x42')](_0x36533c[_0x9c22('0x3e')],qs['fields'](_0x2e8bfd[_0x9c22('0x3f')][_0x9c22('0x44')]));_0x446d5f['attributes']=_0x446d5f['attributes']['length']?_0x446d5f[_0x9c22('0x43')]:_0x36533c[_0x9c22('0x3e')];if(_0x2e8bfd[_0x9c22('0x3f')][_0x9c22('0x4c')]){_0x446d5f[_0x9c22('0x4d')]=[{'all':!![]}];}_0x446d5f=_[_0x9c22('0x4b')]({},_0x446d5f,_0x2e8bfd['options']);return db['VoiceQueue'][_0x9c22('0x36')](_0x446d5f)[_0x9c22('0x2b')](handleEntityNotFound(_0x5614da,null))['then'](respondWithResult(_0x5614da,null))[_0x9c22('0x51')](handleError(_0x5614da,null));};exports[_0x9c22('0x53')]=function(_0x1efdc5,_0x5a6c26){return db[_0x9c22('0x4e')][_0x9c22('0x53')](_0x1efdc5[_0x9c22('0x54')],{})[_0x9c22('0x2b')](function(_0x2ef818){var _0x4830d1=_0x1efdc5['user']['get']({'plain':!![]});if(!_0x4830d1)throw new Error(_0x9c22('0x55'));if(_0x4830d1['role']==='user'){var _0xc054b0=_0x2ef818[_0x9c22('0x56')]({'plain':!![]});var _0x7cba10=[{'name':'VoiceQueues','value':_0x9c22('0x2d')},{'name':'QueueCampaigns','value':_0x9c22('0x2f')}];var _0x5c97e1=_[_0x9c22('0x36')](_0x7cba10,[_0x9c22('0x33'),_0xc054b0[_0x9c22('0x35')]])['name'];return db['UserProfileSection'][_0x9c22('0x36')]({'where':{'name':_0x5c97e1,'userProfileId':_0x4830d1[_0x9c22('0x57')]},'raw':!![]})['then'](function(_0x101e05){if(_0x101e05&&_0x101e05[_0x9c22('0x58')]===0x0){return db[_0x9c22('0x59')][_0x9c22('0x53')]({'name':_0xc054b0[_0x9c22('0x39')],'resourceId':_0xc054b0['id'],'type':_0x101e05[_0x9c22('0x39')],'sectionId':_0x101e05['id']},{})[_0x9c22('0x2b')](function(){return _0x2ef818;});}else{return _0x2ef818;}})[_0x9c22('0x51')](function(_0x62ae47){logger[_0x9c22('0x5a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x62ae47);throw _0x62ae47;});}return _0x2ef818;})[_0x9c22('0x2b')](respondWithResult(_0x5a6c26,0xc9))[_0x9c22('0x51')](handleError(_0x5a6c26,null));};exports[_0x9c22('0x5b')]=function(_0x102c28,_0x5cfd9a){var _0x5f5b57={'where':{'id':_0x102c28[_0x9c22('0x5c')]['id']}},_0x4991e4={};_0x4991e4[_0x9c22('0x3e')]=_[_0x9c22('0x40')](db['VoiceQueue'][_0x9c22('0x3c')]);_0x5f5b57[_0x9c22('0x43')]=_[_0x9c22('0x42')](_0x4991e4['model'],qs[_0x9c22('0x44')](_0x102c28[_0x9c22('0x3f')][_0x9c22('0x44')]));_0x5f5b57[_0x9c22('0x43')]=_0x5f5b57['attributes']['length']?_0x5f5b57[_0x9c22('0x43')]:_0x4991e4[_0x9c22('0x3e')];if(_0x102c28[_0x9c22('0x3f')][_0x9c22('0x4c')]){_0x5f5b57[_0x9c22('0x4d')]=[{'all':!![]}];}_0x5f5b57=_[_0x9c22('0x4b')]({},_0x5f5b57,_0x102c28[_0x9c22('0x5d')]);return db[_0x9c22('0x4e')]['find'](_0x5f5b57)['then'](handleEntityNotFound(_0x5cfd9a,null))[_0x9c22('0x2b')](function(_0x326bd1){if(_0x326bd1){var _0x11af10=_0x326bd1[_0x9c22('0x56')]({'plain':!![]});_0x11af10=qs[_0x9c22('0x5e')](_0x11af10,['id',_0x9c22('0x5f'),_0x9c22('0x60')]);_0x102c28['body']=_[_0x9c22('0x5e')](_0x102c28[_0x9c22('0x54')],['id','createdAt',_0x9c22('0x60')]);return db[_0x9c22('0x4e')]['create'](_['merge'](_0x11af10,_0x102c28['body']),{'include':_0x102c28[_0x9c22('0x3f')]['includeAll']?[{'all':!![]}]:undefined})[_0x9c22('0x2b')](function(_0x264254){var _0x4b8fe5=_0x102c28[_0x9c22('0x61')][_0x9c22('0x56')]({'plain':!![]});if(!_0x4b8fe5)throw new Error(_0x9c22('0x55'));if(_0x4b8fe5[_0x9c22('0x62')]===_0x9c22('0x61')){var _0x1eddef=_0x264254[_0x9c22('0x56')]({'plain':!![]});var _0x21e7aa=[{'name':_0x9c22('0x2c'),'value':_0x9c22('0x2d')},{'name':_0x9c22('0x2e'),'value':'outbound'}];var _0x2c133b=_[_0x9c22('0x36')](_0x21e7aa,[_0x9c22('0x33'),_0x1eddef[_0x9c22('0x35')]])[_0x9c22('0x39')];return db[_0x9c22('0x63')][_0x9c22('0x36')]({'where':{'name':_0x2c133b,'userProfileId':_0x4b8fe5[_0x9c22('0x57')]},'raw':!![]})[_0x9c22('0x2b')](function(_0x16ba44){if(_0x16ba44&&_0x16ba44[_0x9c22('0x58')]===0x0){return db[_0x9c22('0x59')]['create']({'name':_0x1eddef[_0x9c22('0x39')],'resourceId':_0x1eddef['id'],'type':_0x16ba44[_0x9c22('0x39')],'sectionId':_0x16ba44['id']},{})[_0x9c22('0x2b')](function(){return _0x264254;});}else{return _0x264254;}})[_0x9c22('0x51')](function(_0x1bd5b9){logger[_0x9c22('0x5a')](_0x9c22('0x64'),_0x1bd5b9);throw _0x1bd5b9;});}return _0x264254;});}})['then'](respondWithResult(_0x5cfd9a,0xc9))[_0x9c22('0x51')](handleError(_0x5cfd9a,null));};exports[_0x9c22('0x2a')]=function(_0x7c2b63,_0x543527){if(_0x7c2b63['body']['id']){delete _0x7c2b63[_0x9c22('0x54')]['id'];}return db[_0x9c22('0x4e')]['find']({'where':{'id':_0x7c2b63[_0x9c22('0x5c')]['id']}})['then'](handleEntityNotFound(_0x543527,null))[_0x9c22('0x2b')](saveUpdates(_0x7c2b63[_0x9c22('0x54')],null))[_0x9c22('0x2b')](respondWithResult(_0x543527,null))[_0x9c22('0x51')](handleError(_0x543527,null));};exports[_0x9c22('0x37')]=function(_0x580c28,_0x2cb565){return db[_0x9c22('0x4e')][_0x9c22('0x36')]({'where':{'id':_0x580c28[_0x9c22('0x5c')]['id']}})['then'](handleEntityNotFound(_0x2cb565,null))[_0x9c22('0x2b')](removeEntity(_0x2cb565,null))[_0x9c22('0x51')](handleError(_0x2cb565,null));};exports[_0x9c22('0x65')]=function(_0x2eaa11,_0x1dfc5b,_0x18f377){var _0xa2c7b3={'raw':![],'where':{}};var _0xff539={};var _0x1e5648={'count':0x0,'rows':[]};return db[_0x9c22('0x4e')]['findOne']({'where':{'id':_0x2eaa11[_0x9c22('0x5c')]['id']}})[_0x9c22('0x2b')](handleEntityNotFound(_0x1dfc5b,null))[_0x9c22('0x2b')](function(_0x21052b){if(_0x21052b){_0xff539[_0x9c22('0x3e')]=_[_0x9c22('0x40')](db[_0x9c22('0x66')][_0x9c22('0x3c')]);_0xff539[_0x9c22('0x3f')]=_[_0x9c22('0x40')](_0x2eaa11[_0x9c22('0x3f')]);_0xff539[_0x9c22('0x41')]=_[_0x9c22('0x42')](_0xff539[_0x9c22('0x3e')],_0xff539[_0x9c22('0x3f')]);_0xa2c7b3[_0x9c22('0x43')]=_[_0x9c22('0x42')](_0xff539[_0x9c22('0x3e')],qs[_0x9c22('0x44')](_0x2eaa11[_0x9c22('0x3f')]['fields']));_0xa2c7b3[_0x9c22('0x43')]=_0xa2c7b3[_0x9c22('0x43')][_0x9c22('0x45')]?_0xa2c7b3['attributes']:_0xff539[_0x9c22('0x3e')];if(!_0x2eaa11[_0x9c22('0x3f')]['hasOwnProperty']('nolimit')){_0xa2c7b3[_0x9c22('0x24')]=qs[_0x9c22('0x24')](_0x2eaa11[_0x9c22('0x3f')][_0x9c22('0x24')]);_0xa2c7b3[_0x9c22('0x23')]=qs[_0x9c22('0x23')](_0x2eaa11[_0x9c22('0x3f')][_0x9c22('0x23')]);}_0xa2c7b3[_0x9c22('0x47')]=qs[_0x9c22('0x48')](_0x2eaa11[_0x9c22('0x3f')][_0x9c22('0x48')]);_0xa2c7b3[_0x9c22('0x49')]=qs[_0x9c22('0x41')](_['pick'](_0x2eaa11[_0x9c22('0x3f')],_0xff539[_0x9c22('0x41')]));_0xa2c7b3['where'][_0x9c22('0x67')]=_0x21052b['id'];if(_0x2eaa11[_0x9c22('0x3f')][_0x9c22('0x30')]){_0xa2c7b3[_0x9c22('0x49')]=_[_0x9c22('0x4b')](_0xa2c7b3['where'],{'$or':_[_0x9c22('0x32')](_0xa2c7b3['attributes'],function(_0x5ba940){var _0x517c33={};_0x517c33[_0x5ba940]={'$like':'%'+_0x2eaa11[_0x9c22('0x3f')][_0x9c22('0x30')]+'%'};return _0x517c33;})});}_0xa2c7b3=_[_0x9c22('0x4b')]({},_0xa2c7b3,_0x2eaa11[_0x9c22('0x5d')]);return db[_0x9c22('0x66')]['count']({'where':_0xa2c7b3['where']})[_0x9c22('0x2b')](function(_0x5670bf){_0x1e5648[_0x9c22('0x22')]=_0x5670bf;if(_0x2eaa11['query']['includeAll']){_0xa2c7b3['include']=[{'all':!![]}];}return db[_0x9c22('0x66')][_0x9c22('0x4f')](_0xa2c7b3);})[_0x9c22('0x2b')](function(_0xe1425){_0x1e5648[_0x9c22('0x50')]=_0xe1425;return _0x1e5648;});}})[_0x9c22('0x2b')](respondWithFilteredResult(_0x1dfc5b,_0xa2c7b3))['catch'](handleError(_0x1dfc5b,null));};exports[_0x9c22('0x68')]=function(_0x124671,_0x339a60,_0x55d85a){var _0x502bb5={'raw':!![],'where':{}};var _0xd1f2c={};var _0x194ac8={'count':0x0,'rows':[]};return db[_0x9c22('0x4e')][_0x9c22('0x69')]({'where':{'id':_0x124671[_0x9c22('0x5c')]['id']}})[_0x9c22('0x2b')](handleEntityNotFound(_0x339a60,null))['then'](function(_0x2c7adf){if(_0x2c7adf){_0xd1f2c[_0x9c22('0x3e')]=_['keys'](db[_0x9c22('0x6a')][_0x9c22('0x3c')]);_0xd1f2c['query']=_[_0x9c22('0x40')](_0x124671[_0x9c22('0x3f')]);_0xd1f2c[_0x9c22('0x41')]=_[_0x9c22('0x42')](_0xd1f2c['model'],_0xd1f2c[_0x9c22('0x3f')]);_0x502bb5[_0x9c22('0x43')]=_[_0x9c22('0x42')](_0xd1f2c[_0x9c22('0x3e')],qs[_0x9c22('0x44')](_0x124671['query'][_0x9c22('0x44')]));_0x502bb5['attributes']=_0x502bb5['attributes'][_0x9c22('0x45')]?_0x502bb5['attributes']:_0xd1f2c['model'];if(!_0x124671[_0x9c22('0x3f')][_0x9c22('0x46')](_0x9c22('0x6b'))){_0x502bb5[_0x9c22('0x24')]=qs[_0x9c22('0x24')](_0x124671[_0x9c22('0x3f')][_0x9c22('0x24')]);_0x502bb5[_0x9c22('0x23')]=qs[_0x9c22('0x23')](_0x124671['query'][_0x9c22('0x23')]);}_0x502bb5[_0x9c22('0x47')]=qs[_0x9c22('0x48')](_0x124671[_0x9c22('0x3f')][_0x9c22('0x48')]);_0x502bb5[_0x9c22('0x49')]=qs['filters'](_[_0x9c22('0x6c')](_0x124671[_0x9c22('0x3f')],_0xd1f2c['filters']));_0x502bb5[_0x9c22('0x49')][_0x9c22('0x67')]=_0x2c7adf['id'];if(_0x124671[_0x9c22('0x3f')][_0x9c22('0x30')]){_0x502bb5[_0x9c22('0x49')]=_[_0x9c22('0x4b')](_0x502bb5['where'],{'$or':_['map'](_0x502bb5[_0x9c22('0x43')],function(_0x1af4fa){var _0x4bbd10={};_0x4bbd10[_0x1af4fa]={'$like':'%'+_0x124671[_0x9c22('0x3f')][_0x9c22('0x30')]+'%'};return _0x4bbd10;})});}_0x502bb5=_['merge']({},_0x502bb5,_0x124671[_0x9c22('0x5d')]);return db[_0x9c22('0x6a')][_0x9c22('0x22')]({'where':_0x502bb5[_0x9c22('0x49')]})[_0x9c22('0x2b')](function(_0x4633aa){_0x194ac8[_0x9c22('0x22')]=_0x4633aa;if(_0x124671[_0x9c22('0x3f')][_0x9c22('0x4c')]){_0x502bb5['include']=[{'all':!![]}];}return db[_0x9c22('0x6a')][_0x9c22('0x4f')](_0x502bb5);})[_0x9c22('0x2b')](function(_0x54b5ce){_0x194ac8[_0x9c22('0x50')]=_0x54b5ce;return _0x194ac8;});}})[_0x9c22('0x2b')](respondWithFilteredResult(_0x339a60,_0x502bb5))['catch'](handleError(_0x339a60,null));};exports[_0x9c22('0x6d')]=function(_0x337280,_0xa046dc,_0x2087c3){var _0x58532c={'raw':!![],'where':{}};var _0x8cac1f={};var _0x75196={'count':0x0,'rows':[]};return db[_0x9c22('0x4e')][_0x9c22('0x69')]({'where':{'id':_0x337280[_0x9c22('0x5c')]['id']}})[_0x9c22('0x2b')](handleEntityNotFound(_0xa046dc,null))[_0x9c22('0x2b')](function(_0x5f13fc){if(_0x5f13fc){_0x8cac1f['model']=_[_0x9c22('0x40')](db[_0x9c22('0x6e')][_0x9c22('0x3c')]);_0x8cac1f['query']=_[_0x9c22('0x40')](_0x337280['query']);_0x8cac1f[_0x9c22('0x41')]=_['intersection'](_0x8cac1f[_0x9c22('0x3e')],_0x8cac1f['query']);_0x58532c[_0x9c22('0x43')]=_[_0x9c22('0x42')](_0x8cac1f[_0x9c22('0x3e')],qs[_0x9c22('0x44')](_0x337280['query']['fields']));_0x58532c[_0x9c22('0x43')]=_0x58532c[_0x9c22('0x43')]['length']?_0x58532c[_0x9c22('0x43')]:_0x8cac1f[_0x9c22('0x3e')];if(!_0x337280[_0x9c22('0x3f')][_0x9c22('0x46')](_0x9c22('0x6b'))){_0x58532c[_0x9c22('0x24')]=qs[_0x9c22('0x24')](_0x337280[_0x9c22('0x3f')]['limit']);_0x58532c['offset']=qs['offset'](_0x337280[_0x9c22('0x3f')][_0x9c22('0x23')]);}_0x58532c[_0x9c22('0x47')]=qs[_0x9c22('0x48')](_0x337280[_0x9c22('0x3f')][_0x9c22('0x48')]);_0x58532c[_0x9c22('0x49')]=qs[_0x9c22('0x41')](_[_0x9c22('0x6c')](_0x337280['query'],_0x8cac1f[_0x9c22('0x41')]));_0x58532c[_0x9c22('0x49')]['VoiceQueueId']=_0x5f13fc['id'];if(_0x337280['query'][_0x9c22('0x30')]){_0x58532c['where']=_[_0x9c22('0x4b')](_0x58532c['where'],{'$or':_[_0x9c22('0x32')](_0x58532c[_0x9c22('0x43')],function(_0x193a04){var _0x534eb3={};_0x534eb3[_0x193a04]={'$like':'%'+_0x337280[_0x9c22('0x3f')]['filter']+'%'};return _0x534eb3;})});}_0x58532c=_[_0x9c22('0x4b')]({},_0x58532c,_0x337280[_0x9c22('0x5d')]);return db[_0x9c22('0x6e')][_0x9c22('0x22')]({'where':_0x58532c[_0x9c22('0x49')]})[_0x9c22('0x2b')](function(_0x44f8dd){_0x75196[_0x9c22('0x22')]=_0x44f8dd;if(_0x337280['query'][_0x9c22('0x4c')]){_0x58532c['include']=[{'all':!![]}];}return db['CmHopperFinal'][_0x9c22('0x4f')](_0x58532c);})[_0x9c22('0x2b')](function(_0x59f4c1){_0x75196[_0x9c22('0x50')]=_0x59f4c1;return _0x75196;});}})['then'](respondWithFilteredResult(_0xa046dc,_0x58532c))[_0x9c22('0x51')](handleError(_0xa046dc,null));};exports[_0x9c22('0x6f')]=function(_0x1db8d0,_0xff2086,_0x40e1e7){var _0x33af4c={'raw':!![],'where':{}};var _0xb5c0e8={};var _0x2b04b5={'count':0x0,'rows':[]};return db[_0x9c22('0x4e')][_0x9c22('0x69')]({'where':{'id':_0x1db8d0[_0x9c22('0x5c')]['id']}})['then'](handleEntityNotFound(_0xff2086,null))[_0x9c22('0x2b')](function(_0x2f0ba4){if(_0x2f0ba4){_0xb5c0e8[_0x9c22('0x3e')]=_[_0x9c22('0x40')](db[_0x9c22('0x70')]['rawAttributes']);_0xb5c0e8[_0x9c22('0x3f')]=_[_0x9c22('0x40')](_0x1db8d0[_0x9c22('0x3f')]);_0xb5c0e8[_0x9c22('0x41')]=_['intersection'](_0xb5c0e8[_0x9c22('0x3e')],_0xb5c0e8[_0x9c22('0x3f')]);_0x33af4c['attributes']=_[_0x9c22('0x42')](_0xb5c0e8['model'],qs['fields'](_0x1db8d0[_0x9c22('0x3f')]['fields']));_0x33af4c[_0x9c22('0x43')]=_0x33af4c[_0x9c22('0x43')][_0x9c22('0x45')]?_0x33af4c[_0x9c22('0x43')]:_0xb5c0e8['model'];if(!_0x1db8d0['query'][_0x9c22('0x46')](_0x9c22('0x6b'))){_0x33af4c[_0x9c22('0x24')]=qs['limit'](_0x1db8d0[_0x9c22('0x3f')]['limit']);_0x33af4c['offset']=qs[_0x9c22('0x23')](_0x1db8d0['query'][_0x9c22('0x23')]);}_0x33af4c[_0x9c22('0x47')]=qs[_0x9c22('0x48')](_0x1db8d0[_0x9c22('0x3f')][_0x9c22('0x48')]);_0x33af4c[_0x9c22('0x49')]=qs['filters'](_[_0x9c22('0x6c')](_0x1db8d0[_0x9c22('0x3f')],_0xb5c0e8['filters']));_0x33af4c['where'][_0x9c22('0x67')]=_0x2f0ba4['id'];if(_0x1db8d0[_0x9c22('0x3f')][_0x9c22('0x30')]){_0x33af4c[_0x9c22('0x49')]=_['merge'](_0x33af4c[_0x9c22('0x49')],{'$or':_[_0x9c22('0x32')](_0x33af4c[_0x9c22('0x43')],function(_0xe7734){var _0x1c933e={};_0x1c933e[_0xe7734]={'$like':'%'+_0x1db8d0[_0x9c22('0x3f')][_0x9c22('0x30')]+'%'};return _0x1c933e;})});}_0x33af4c=_[_0x9c22('0x4b')]({},_0x33af4c,_0x1db8d0[_0x9c22('0x5d')]);return db[_0x9c22('0x70')][_0x9c22('0x22')]({'where':_0x33af4c[_0x9c22('0x49')]})[_0x9c22('0x2b')](function(_0x427afa){_0x2b04b5[_0x9c22('0x22')]=_0x427afa;if(_0x1db8d0[_0x9c22('0x3f')][_0x9c22('0x4c')]){_0x33af4c[_0x9c22('0x4d')]=[{'all':!![]}];}return db[_0x9c22('0x70')][_0x9c22('0x4f')](_0x33af4c);})[_0x9c22('0x2b')](function(_0x1514fc){_0x2b04b5['rows']=_0x1514fc;return _0x2b04b5;});}})[_0x9c22('0x2b')](respondWithFilteredResult(_0xff2086,_0x33af4c))['catch'](handleError(_0xff2086,null));};exports[_0x9c22('0x71')]=function(_0x3e2862,_0x22e9c3,_0x2260ee){var _0x4035bc={};var _0x693ffd={};var _0x20c033;var _0x19305b;return db['VoiceQueue'][_0x9c22('0x69')]({'where':{'id':_0x3e2862[_0x9c22('0x5c')]['id']}})[_0x9c22('0x2b')](handleEntityNotFound(_0x22e9c3,null))[_0x9c22('0x2b')](function(_0x39f445){if(_0x39f445){_0x20c033=_0x39f445;_0x693ffd[_0x9c22('0x3e')]=_[_0x9c22('0x40')](db['Team'][_0x9c22('0x3c')]);_0x693ffd[_0x9c22('0x3f')]=_['keys'](_0x3e2862['query']);_0x693ffd[_0x9c22('0x41')]=_[_0x9c22('0x42')](_0x693ffd[_0x9c22('0x3e')],_0x693ffd[_0x9c22('0x3f')]);_0x4035bc['attributes']=_['intersection'](_0x693ffd[_0x9c22('0x3e')],qs[_0x9c22('0x44')](_0x3e2862[_0x9c22('0x3f')][_0x9c22('0x44')]));_0x4035bc[_0x9c22('0x43')]=_0x4035bc[_0x9c22('0x43')]['length']?_0x4035bc[_0x9c22('0x43')]:_0x693ffd[_0x9c22('0x3e')];_0x4035bc[_0x9c22('0x47')]=qs['sort'](_0x3e2862[_0x9c22('0x3f')][_0x9c22('0x48')]);_0x4035bc[_0x9c22('0x49')]=qs[_0x9c22('0x41')](_[_0x9c22('0x6c')](_0x3e2862[_0x9c22('0x3f')],_0x693ffd[_0x9c22('0x41')]));if(_0x3e2862['query'][_0x9c22('0x30')]){_0x4035bc[_0x9c22('0x49')]=_[_0x9c22('0x4b')](_0x4035bc[_0x9c22('0x49')],{'$or':_['map'](_0x4035bc[_0x9c22('0x43')],function(_0x3a9325){var _0x267a19={};_0x267a19[_0x3a9325]={'$like':'%'+_0x3e2862[_0x9c22('0x3f')][_0x9c22('0x30')]+'%'};return _0x267a19;})});}_0x4035bc=_[_0x9c22('0x4b')]({},_0x4035bc,_0x3e2862[_0x9c22('0x5d')]);return _0x20c033[_0x9c22('0x71')](_0x4035bc);}})['then'](function(_0x4f3ddd){if(_0x4f3ddd){_0x19305b=_0x4f3ddd[_0x9c22('0x45')];if(!_0x3e2862[_0x9c22('0x3f')][_0x9c22('0x46')](_0x9c22('0x6b'))){_0x4035bc[_0x9c22('0x24')]=qs[_0x9c22('0x24')](_0x3e2862[_0x9c22('0x3f')][_0x9c22('0x24')]);_0x4035bc[_0x9c22('0x23')]=qs[_0x9c22('0x23')](_0x3e2862[_0x9c22('0x3f')][_0x9c22('0x23')]);}return _0x20c033[_0x9c22('0x71')](_0x4035bc);}})['then'](function(_0x533047){if(_0x533047){return _0x533047?{'count':_0x19305b,'rows':_0x533047}:null;}})['then'](respondWithResult(_0x22e9c3,null))['catch'](handleError(_0x22e9c3,null));};exports['addTeams']=function(_0x2bf0f8,_0x38766b,_0x43b092){var _0x2edeaa=_0x2bf0f8[_0x9c22('0x54')][_0x9c22('0x72')];var _0x12476c=_[_0x9c22('0x32')](_0x2edeaa,'id');return db[_0x9c22('0x73')][_0x9c22('0x4f')]({'where':{'id':_0x12476c},'attributes':['id'],'include':[{'model':db[_0x9c22('0x74')],'as':'Agents','attributes':['id','name',_0x9c22('0x75'),_0x9c22('0x76'),_0x9c22('0x77')],'raw':!![]}]})[_0x9c22('0x2b')](function(_0x59cde9){if(_0x59cde9){var _0x193f7c=_[_0x9c22('0x78')](_0x59cde9,function(_0x4c0a6d){var _0x4b57e9=_0x4c0a6d[_0x9c22('0x56')]({'plain':!![]});_0x4b57e9['Agents'][_0x9c22('0x79')](function(_0x27e076){_0x27e076[_0x9c22('0x7a')]=_['find'](_0x2edeaa,{'id':_0x4b57e9['id']})[_0x9c22('0x7a')];});return _0x4b57e9[_0x9c22('0x7b')];});return db[_0x9c22('0x4e')][_0x9c22('0x36')]({'where':{'id':_0x2bf0f8[_0x9c22('0x5c')]['id']}})['then'](function(_0x3fecde){return db[_0x9c22('0x7c')][_0x9c22('0x7d')](function(_0x5bf56b){return _0x3fecde[_0x9c22('0x7e')](_0x12476c,{'transaction':_0x5bf56b})[_0x9c22('0x2b')](function(){return BPromise[_0x9c22('0x7f')](_0x2edeaa,function(_0x4264bd){return db[_0x9c22('0x80')][_0x9c22('0x81')]({'TeamId':_0x4264bd['id'],'VoiceQueueId':_0x2bf0f8['params']['id'],'penalty':_0x4264bd[_0x9c22('0x7a')]},{'transaction':_0x5bf56b});});})[_0x9c22('0x2b')](function(){return BPromise['each'](_0x193f7c,function(_0x346e18){return db[_0x9c22('0x82')][_0x9c22('0x83')]({'where':{'UserId':_0x346e18['id'],'VoiceQueueId':_0x2bf0f8[_0x9c22('0x5c')]['id']},'defaults':{'penalty':_0x346e18['penalty']},'transaction':_0x5bf56b});});})[_0x9c22('0x2b')](function(){return BPromise[_0x9c22('0x7f')](_[_0x9c22('0x30')](_0x193f7c,{'online':!![]}),function(_0x629cae){return db['UserVoiceQueueRt'][_0x9c22('0x81')]({'membername':_0x629cae[_0x9c22('0x39')],'UserId':_0x629cae['id'],'queue_name':_0x3fecde[_0x9c22('0x39')],'VoiceQueueId':_0x3fecde['id'],'interface':_['isNil'](_0x629cae['interface'])?util[_0x9c22('0x84')](_0x9c22('0x85'),_0x629cae[_0x9c22('0x39')]):_0x629cae[_0x9c22('0x77')],'paused':_0x629cae[_0x9c22('0x76')]||![],'penalty':_0x629cae[_0x9c22('0x7a')]},{'transaction':_0x5bf56b});});})[_0x9c22('0x2b')](function(){_0x193f7c[_0x9c22('0x79')](function(_0x45aad3){socket[_0x9c22('0x86')]('userVoiceQueue:save',{'UserId':_0x45aad3['id'],'VoiceQueueId':_0x3fecde['id']});});});});});}})['then'](respondWithStatusCode(_0x38766b,null))[_0x9c22('0x51')](handleError(_0x38766b,null));};exports['removeTeams']=function(_0x3bea6e,_0x3b6247,_0x2b849f){return db['Team'][_0x9c22('0x4f')]({'where':{'id':_0x3bea6e[_0x9c22('0x3f')][_0x9c22('0x87')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x9c22('0x7b'),'attributes':['id'],'raw':!![]}]})[_0x9c22('0x2b')](handleEntityNotFound(_0x3b6247,null))[_0x9c22('0x2b')](function(_0x673311){var _0x580ec4=_[_0x9c22('0x32')](_0x673311,'id');var _0x35d449=[];var _0x4cc0b1=[];var _0x21aab9=squel[_0x9c22('0x88')]();_0x21aab9[_0x9c22('0x89')]('tq.TeamId')[_0x9c22('0x8a')](_0x9c22('0x8b'),'tq')[_0x9c22('0x8c')](_0x9c22('0x8d'),'ut',_0x9c22('0x8e'))['where'](_0x9c22('0x8f'),_0x3bea6e[_0x9c22('0x5c')]['id']);for(var _0x412686=0x0;_0x412686<_0x673311['length'];_0x412686+=0x1){let _0x54dd4f=_0x673311[_0x412686];for(var _0x5576cb=0x0;_0x5576cb<_0x54dd4f[_0x9c22('0x7b')][_0x9c22('0x45')];_0x5576cb+=0x1){let _0x385faa=_0x54dd4f[_0x9c22('0x7b')][_0x5576cb];var _0x1c324f=_0x21aab9['clone']();_0x1c324f['where'](_0x9c22('0x90'),_0x385faa['id']);_0x4cc0b1[_0x9c22('0x91')](db[_0x9c22('0x7c')][_0x9c22('0x3f')](_0x1c324f['toString'](),{'type':db[_0x9c22('0x7c')][_0x9c22('0x92')][_0x9c22('0x93')]})[_0x9c22('0x2b')](function(_0x17c87d){if(_0x17c87d[_0x9c22('0x45')]===0x1){return _0x385faa['id'];}else{var _0x11de9f=_[_0x9c22('0x94')](_[_0x9c22('0x32')](_0x17c87d,'TeamId'),function(_0x511136){return _[_0x9c22('0x34')](_0x580ec4,_0x511136);});if(_0x11de9f){return _0x385faa['id'];}}}));}}return BPromise['all'](_0x4cc0b1)[_0x9c22('0x2b')](function(_0x15b87a){_0x35d449=_(_0x35d449)['union'](_0x15b87a)['compact']()[_0x9c22('0x33')]();return db[_0x9c22('0x4e')][_0x9c22('0x36')]({'where':{'id':_0x3bea6e[_0x9c22('0x5c')]['id']}})[_0x9c22('0x2b')](function(_0x4ab510){return db[_0x9c22('0x7c')][_0x9c22('0x7d')](function(_0x33bcdd){return _0x4ab510['removeTeams'](_0x3bea6e[_0x9c22('0x3f')]['ids'],{'transaction':_0x33bcdd})[_0x9c22('0x2b')](function(){if(!_[_0x9c22('0x95')](_0x35d449)){return _0x4ab510[_0x9c22('0x96')](_0x35d449,{'transaction':_0x33bcdd})[_0x9c22('0x2b')](function(){return db[_0x9c22('0x97')][_0x9c22('0x37')]({'where':{'VoiceQueueId':_0x3bea6e[_0x9c22('0x5c')]['id'],'UserId':_0x35d449},'transaction':_0x33bcdd});});}})[_0x9c22('0x2b')](function(){_0x35d449[_0x9c22('0x79')](function(_0xe0d07f){socket[_0x9c22('0x86')](_0x9c22('0x98'),{'UserId':_0xe0d07f,'VoiceQueueId':_0x4ab510['id']});});});});});});})[_0x9c22('0x2b')](respondWithStatusCode(_0x3b6247,null))[_0x9c22('0x51')](handleError(_0x3b6247,null));};exports['addAgents']=function(_0x24d05c,_0x2da769,_0x2cdd7f){var _0x5f4ce4,_0x5618ef;return db[_0x9c22('0x4e')]['find']({'where':{'id':_0x24d05c[_0x9c22('0x5c')]['id']}})[_0x9c22('0x2b')](handleEntityNotFound(_0x2da769,null))[_0x9c22('0x2b')](function(_0x3a9549){if(_0x3a9549){_0x5618ef=_0x3a9549;return _0x3a9549[_0x9c22('0x99')](_0x24d05c['body'][_0x9c22('0x87')],_['omit'](_0x24d05c[_0x9c22('0x54')],[_0x9c22('0x87'),'id'])||{})['spread'](function(_0x4a77a2){for(var _0x12d605=0x0;_0x12d605<_0x24d05c[_0x9c22('0x54')][_0x9c22('0x87')]['length'];_0x12d605+=0x1){socket[_0x9c22('0x86')]('userVoiceQueue:save',{'UserId':Number(_0x24d05c[_0x9c22('0x54')]['ids'][_0x12d605]),'VoiceQueueId':Number(_0x24d05c[_0x9c22('0x5c')]['id'])});}return _0x4a77a2;});}})[_0x9c22('0x2b')](function(_0x1ca480){_0x5f4ce4=_0x1ca480||[];if(_0x5618ef){return db[_0x9c22('0x74')][_0x9c22('0x4f')]({'where':{'id':_0x24d05c[_0x9c22('0x54')][_0x9c22('0x87')]},'attributes':['id',_0x9c22('0x39'),_0x9c22('0x75'),_0x9c22('0x76'),_0x9c22('0x77')],'raw':!![]});}})['then'](function(_0x326698){if(!_[_0x9c22('0x95')](_0x326698)){var _0x3e16cc=[];for(var _0x4428d3=0x0;_0x4428d3<_0x326698[_0x9c22('0x45')];_0x4428d3++){if(_0x326698[_0x4428d3][_0x9c22('0x75')]){_0x3e16cc[_0x9c22('0x91')](db['UserVoiceQueueRt'][_0x9c22('0x81')]({'membername':_0x326698[_0x4428d3][_0x9c22('0x39')],'UserId':_0x326698[_0x4428d3]['id'],'queue_name':_0x5618ef[_0x9c22('0x39')],'VoiceQueueId':_0x5618ef['id'],'interface':_[_0x9c22('0x9a')](_0x326698[_0x4428d3][_0x9c22('0x77')])?util[_0x9c22('0x84')](_0x9c22('0x85'),_0x326698[_0x4428d3][_0x9c22('0x39')]):_0x326698[_0x4428d3]['interface'],'paused':_0x326698[_0x4428d3][_0x9c22('0x76')]||![],'penalty':_0x24d05c['body'][_0x9c22('0x7a')]||0x0}));}}return BPromise[_0x9c22('0x9b')](_0x3e16cc);}})[_0x9c22('0x2b')](function(){return _0x5f4ce4;})['then'](respondWithResult(_0x2da769,null))['catch'](handleError(_0x2da769,null));};exports['removeAgents']=function(_0x2bedfc,_0x4346a4,_0x31b083){return db['VoiceQueue'][_0x9c22('0x36')]({'where':{'id':_0x2bedfc[_0x9c22('0x5c')]['id']}})[_0x9c22('0x2b')](handleEntityNotFound(_0x4346a4,null))['then'](function(_0x54ef45){if(_0x54ef45){return _0x54ef45[_0x9c22('0x96')](_0x2bedfc[_0x9c22('0x3f')][_0x9c22('0x87')])[_0x9c22('0x2b')](function(){if(_['isArray'](_0x2bedfc[_0x9c22('0x3f')]['ids'])){for(var _0x448ddb=0x0;_0x448ddb<_0x2bedfc[_0x9c22('0x3f')]['ids']['length'];_0x448ddb+=0x1){socket[_0x9c22('0x86')]('userVoiceQueue:remove',{'UserId':Number(_0x2bedfc[_0x9c22('0x3f')][_0x9c22('0x87')][_0x448ddb]),'VoiceQueueId':Number(_0x2bedfc[_0x9c22('0x5c')]['id'])});}}else{socket[_0x9c22('0x86')](_0x9c22('0x98'),{'UserId':Number(_0x2bedfc['query'][_0x9c22('0x87')]),'VoiceQueueId':Number(_0x2bedfc[_0x9c22('0x5c')]['id'])});}});}})['then'](function(_0xc9659b){return db['UserVoiceQueueRt'][_0x9c22('0x37')]({'where':{'VoiceQueueId':_0x2bedfc[_0x9c22('0x5c')]['id'],'UserId':_0x2bedfc['query']['ids']}})[_0x9c22('0x2b')](function(){return _0xc9659b;});})[_0x9c22('0x2b')](respondWithStatusCode(_0x4346a4,null))[_0x9c22('0x51')](handleError(_0x4346a4,null));};exports['getAgents']=function(_0x52ef50,_0x2220d7,_0x496c67){var _0x26651a={};var _0x506b46={};var _0x1e6203;var _0x22f0f6;return db[_0x9c22('0x4e')][_0x9c22('0x69')]({'where':{'id':_0x52ef50['params']['id']}})[_0x9c22('0x2b')](handleEntityNotFound(_0x2220d7,null))[_0x9c22('0x2b')](function(_0x547de8){if(_0x547de8){_0x1e6203=_0x547de8;_0x506b46[_0x9c22('0x3e')]=_[_0x9c22('0x40')](db['User'][_0x9c22('0x3c')]);_0x506b46[_0x9c22('0x3f')]=_['keys'](_0x52ef50['query']);_0x506b46['filters']=_['intersection'](_0x506b46['model'],_0x506b46[_0x9c22('0x3f')]);_0x26651a[_0x9c22('0x43')]=_[_0x9c22('0x42')](_0x506b46[_0x9c22('0x3e')],qs[_0x9c22('0x44')](_0x52ef50[_0x9c22('0x3f')][_0x9c22('0x44')]));_0x26651a[_0x9c22('0x43')]=_0x26651a[_0x9c22('0x43')][_0x9c22('0x45')]?_0x26651a['attributes']:_0x506b46[_0x9c22('0x3e')];_0x26651a[_0x9c22('0x47')]=qs['sort'](_0x52ef50[_0x9c22('0x3f')]['sort']);_0x26651a[_0x9c22('0x49')]=qs[_0x9c22('0x41')](_[_0x9c22('0x6c')](_0x52ef50[_0x9c22('0x3f')],_0x506b46[_0x9c22('0x41')]));if(_0x52ef50[_0x9c22('0x3f')][_0x9c22('0x30')]){_0x26651a[_0x9c22('0x49')]=_[_0x9c22('0x4b')](_0x26651a[_0x9c22('0x49')],{'$or':_['map'](_0x26651a['attributes'],function(_0x286750){var _0x4c49a6={};_0x4c49a6[_0x286750]={'$like':'%'+_0x52ef50[_0x9c22('0x3f')][_0x9c22('0x30')]+'%'};return _0x4c49a6;})});}_0x26651a=_[_0x9c22('0x4b')]({},_0x26651a,_0x52ef50['options']);return _0x1e6203[_0x9c22('0x9c')](_0x26651a);}})['then'](function(_0x2dd73c){if(_0x2dd73c){_0x22f0f6=_0x2dd73c[_0x9c22('0x45')];if(!_0x52ef50[_0x9c22('0x3f')][_0x9c22('0x46')](_0x9c22('0x6b'))){_0x26651a['limit']=qs[_0x9c22('0x24')](_0x52ef50[_0x9c22('0x3f')]['limit']);_0x26651a[_0x9c22('0x23')]=qs[_0x9c22('0x23')](_0x52ef50[_0x9c22('0x3f')]['offset']);}return _0x1e6203[_0x9c22('0x9c')](_0x26651a);}})[_0x9c22('0x2b')](function(_0x338243){if(_0x338243){return _0x338243?{'count':_0x22f0f6,'rows':_0x338243}:null;}})[_0x9c22('0x2b')](respondWithResult(_0x2220d7,null))[_0x9c22('0x51')](handleError(_0x2220d7,null));};exports[_0x9c22('0x9d')]=function(_0x307330,_0x322dc9,_0x381ac9){var _0x1f61c5={};var _0x189140={};var _0x3b98e7;var _0x5dfb8c;return db[_0x9c22('0x4e')][_0x9c22('0x69')]({'where':{'id':_0x307330['params']['id']}})[_0x9c22('0x2b')](handleEntityNotFound(_0x322dc9,null))[_0x9c22('0x2b')](function(_0x520d1e){if(_0x520d1e){_0x3b98e7=_0x520d1e;_0x189140['model']=_[_0x9c22('0x40')](db[_0x9c22('0x97')][_0x9c22('0x3c')]);_0x189140[_0x9c22('0x3f')]=_[_0x9c22('0x40')](_0x307330[_0x9c22('0x3f')]);_0x189140[_0x9c22('0x41')]=_[_0x9c22('0x42')](_0x189140[_0x9c22('0x3e')],_0x189140[_0x9c22('0x3f')]);_0x1f61c5[_0x9c22('0x43')]=_[_0x9c22('0x42')](_0x189140[_0x9c22('0x3e')],qs[_0x9c22('0x44')](_0x307330['query'][_0x9c22('0x44')]));_0x1f61c5[_0x9c22('0x43')]=_0x1f61c5[_0x9c22('0x43')]['length']?_0x1f61c5['attributes']:_0x189140['model'];_0x1f61c5[_0x9c22('0x47')]=qs[_0x9c22('0x48')](_0x307330['query'][_0x9c22('0x48')]);_0x1f61c5[_0x9c22('0x49')]=qs[_0x9c22('0x41')](_[_0x9c22('0x6c')](_0x307330[_0x9c22('0x3f')],_0x189140[_0x9c22('0x41')]));if(_0x307330[_0x9c22('0x3f')]['filter']){_0x1f61c5[_0x9c22('0x49')]=_[_0x9c22('0x4b')](_0x1f61c5['where'],{'$or':_[_0x9c22('0x32')](_0x1f61c5[_0x9c22('0x43')],function(_0x23487a){var _0x1e86a2={};_0x1e86a2[_0x23487a]={'$like':'%'+_0x307330[_0x9c22('0x3f')][_0x9c22('0x30')]+'%'};return _0x1e86a2;})});}_0x1f61c5=_[_0x9c22('0x4b')]({},_0x1f61c5,_0x307330[_0x9c22('0x5d')]);return _0x3b98e7[_0x9c22('0x9d')](_0x1f61c5);}})[_0x9c22('0x2b')](function(_0x44ecd1){if(_0x44ecd1){_0x5dfb8c=_0x44ecd1[_0x9c22('0x45')];if(!_0x307330['query'][_0x9c22('0x46')](_0x9c22('0x6b'))){_0x1f61c5['limit']=qs[_0x9c22('0x24')](_0x307330[_0x9c22('0x3f')][_0x9c22('0x24')]);_0x1f61c5['offset']=qs['offset'](_0x307330[_0x9c22('0x3f')][_0x9c22('0x23')]);}return _0x3b98e7['getMembers'](_0x1f61c5);}})[_0x9c22('0x2b')](function(_0x5b9255){return _0x5b9255?{'count':_0x5dfb8c,'rows':_0x5b9255}:null;})[_0x9c22('0x2b')](respondWithResult(_0x322dc9,null))['catch'](handleError(_0x322dc9,null));};exports['getLists']=function(_0x30b86b,_0x537393,_0x5b9c2d){var _0x18c425={};var _0x1450f2={};var _0x7c5417;var _0x5bddba;return db[_0x9c22('0x4e')]['findOne']({'where':{'id':_0x30b86b[_0x9c22('0x5c')]['id']}})['then'](handleEntityNotFound(_0x537393,null))[_0x9c22('0x2b')](function(_0x3b0ae8){if(_0x3b0ae8){_0x7c5417=_0x3b0ae8;_0x1450f2[_0x9c22('0x3e')]=_['keys'](db['CmList'][_0x9c22('0x3c')]);_0x1450f2['query']=_['keys'](_0x30b86b[_0x9c22('0x3f')]);_0x1450f2[_0x9c22('0x41')]=_[_0x9c22('0x42')](_0x1450f2[_0x9c22('0x3e')],_0x1450f2['query']);_0x18c425['attributes']=_[_0x9c22('0x42')](_0x1450f2[_0x9c22('0x3e')],qs['fields'](_0x30b86b[_0x9c22('0x3f')][_0x9c22('0x44')]));_0x18c425['attributes']=_0x18c425[_0x9c22('0x43')][_0x9c22('0x45')]?_0x18c425['attributes']:_0x1450f2['model'];_0x18c425[_0x9c22('0x47')]=qs['sort'](_0x30b86b[_0x9c22('0x3f')][_0x9c22('0x48')]);_0x18c425[_0x9c22('0x49')]=qs[_0x9c22('0x41')](_[_0x9c22('0x6c')](_0x30b86b[_0x9c22('0x3f')],_0x1450f2['filters']));if(_0x30b86b[_0x9c22('0x3f')][_0x9c22('0x30')]){_0x18c425[_0x9c22('0x49')]=_[_0x9c22('0x4b')](_0x18c425['where'],{'$or':_['map'](_0x18c425['attributes'],function(_0x50f042){var _0xe9cfd9={};_0xe9cfd9[_0x50f042]={'$like':'%'+_0x30b86b[_0x9c22('0x3f')][_0x9c22('0x30')]+'%'};return _0xe9cfd9;})});}_0x18c425=_[_0x9c22('0x4b')]({},_0x18c425,_0x30b86b[_0x9c22('0x5d')]);return _0x7c5417['getLists'](_0x18c425);}})[_0x9c22('0x2b')](function(_0x1d8096){if(_0x1d8096){_0x5bddba=_0x1d8096[_0x9c22('0x45')];if(!_0x30b86b[_0x9c22('0x3f')][_0x9c22('0x46')](_0x9c22('0x6b'))){_0x18c425[_0x9c22('0x24')]=qs['limit'](_0x30b86b['query'][_0x9c22('0x24')]);_0x18c425['offset']=qs['offset'](_0x30b86b['query']['offset']);}return _0x7c5417['getLists'](_0x18c425);}})[_0x9c22('0x2b')](function(_0x5a721c){if(_0x5a721c){return _0x5a721c?{'count':_0x5bddba,'rows':_0x5a721c}:null;}})[_0x9c22('0x2b')](respondWithResult(_0x537393,null))[_0x9c22('0x51')](handleError(_0x537393,null));};exports[_0x9c22('0x9e')]=function(_0x3b4b24,_0x42d54d,_0x233f5d){var _0x3fce1e,_0xb0344d;return db['VoiceQueue'][_0x9c22('0x36')]({'where':{'id':_0x3b4b24[_0x9c22('0x5c')]['id']}})[_0x9c22('0x2b')](handleEntityNotFound(_0x42d54d,null))[_0x9c22('0x2b')](function(_0x387aa9){if(_0x387aa9){_0xb0344d=_0x387aa9;return _0x387aa9[_0x9c22('0x9e')](_0x3b4b24['body'][_0x9c22('0x87')],_[_0x9c22('0x5e')](_0x3b4b24[_0x9c22('0x54')],['ids','id'])||{});}return null;})['spread'](function(_0x2ef4f4){var _0x596d03;_0x3fce1e=_0x2ef4f4||[];var _0xba0e5c=[];if(_0x2ef4f4){for(var _0x47c19f=0x0;_0x47c19f<_0x2ef4f4[_0x9c22('0x45')];_0x47c19f+=0x1){var _0x334369=_0x2ef4f4[_0x47c19f]['get']({'plain':!![]});_0xb0344d['dialCheckDuplicateType']=_0x3b4b24[_0x9c22('0x54')][_0x9c22('0x9f')]?_0x3b4b24['body'][_0x9c22('0x9f')]:_0xb0344d[_0x9c22('0x9f')];switch(_0xb0344d[_0x9c22('0x9f')]){case _0x9c22('0xa0'):_0x596d03=squel['insert']()[_0x9c22('0xa1')](_0x9c22('0xa2'))[_0x9c22('0xa3')]([_0x9c22('0xa4'),_0x9c22('0xa5'),_0x9c22('0xa6'),_0x9c22('0xa7'),_0x9c22('0x67'),_0x9c22('0x5f'),_0x9c22('0x60')],squel[_0x9c22('0x88')]()[_0x9c22('0x89')]('phone',_0x9c22('0xa4'))[_0x9c22('0x89')](_0x9c22('0xa8'),_0x9c22('0xa5'))[_0x9c22('0x89')]('id',_0x9c22('0xa6'))['field'](_0x334369['CmListId'][_0x9c22('0xa9')](),_0x9c22('0xa7'))[_0x9c22('0x89')](_0x3b4b24[_0x9c22('0x5c')]['id'][_0x9c22('0xa9')](),_0x9c22('0x67'))[_0x9c22('0x89')](_0x9c22('0xa8'),_0x9c22('0x5f'))['field']('NOW()',_0x9c22('0x60'))[_0x9c22('0x8a')](_0x9c22('0xaa'))[_0x9c22('0x49')]('deletedAt\x20IS\x20NULL')['where'](_0x9c22('0xab'),_0x334369['CmListId']['toString']())[_0x9c22('0x49')](_0x9c22('0xac'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x9c22('0x88')]()[_0x9c22('0x89')](_0x9c22('0xad'))[_0x9c22('0x8a')](_0x9c22('0xae'))['where'](_0x9c22('0x8f'),_0x3b4b24['params']['id'][_0x9c22('0xa9')]()))['where'](_0x9c22('0xaf'),squel[_0x9c22('0x88')]()['field']('COALESCE(phone,\x27\x27)')[_0x9c22('0x8a')](_0x9c22('0xa2'))[_0x9c22('0x49')]('VoiceQueueId\x20=\x20?',_0x3b4b24['params']['id'][_0x9c22('0xa9')]())))[_0x9c22('0xa9')]();break;case _0x9c22('0xb0'):_0x596d03=squel[_0x9c22('0xb1')]()[_0x9c22('0xa1')](_0x9c22('0xa2'))[_0x9c22('0xa3')]([_0x9c22('0xa4'),'scheduledAt',_0x9c22('0xa6'),_0x9c22('0xa7'),_0x9c22('0x67'),_0x9c22('0x5f'),'updatedAt'],squel[_0x9c22('0x88')]()['field']('phone',_0x9c22('0xa4'))[_0x9c22('0x89')]('NOW()',_0x9c22('0xa5'))[_0x9c22('0x89')]('id','ContactId')['field'](_0x334369[_0x9c22('0xb2')][_0x9c22('0xa9')](),_0x9c22('0xa7'))['field'](_0x3b4b24[_0x9c22('0x5c')]['id'][_0x9c22('0xa9')](),'VoiceQueueId')['field'](_0x9c22('0xa8'),_0x9c22('0x5f'))['field'](_0x9c22('0xa8'),_0x9c22('0x60'))[_0x9c22('0x8a')](_0x9c22('0xaa'))[_0x9c22('0x49')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',_0x334369['CmListId'][_0x9c22('0xa9')]())['where'](_0x9c22('0xac'))['where'](_0x9c22('0xaf'),squel['select']()['field']('COALESCE(phone,\x27\x27)')[_0x9c22('0x8a')](_0x9c22('0xa2'))[_0x9c22('0x49')](_0x9c22('0x8f'),_0x3b4b24[_0x9c22('0x5c')]['id'][_0x9c22('0xa9')]())))[_0x9c22('0xa9')]();break;default:_0x596d03=squel['insert']()['into'](_0x9c22('0xa2'))[_0x9c22('0xa3')]([_0x9c22('0xa4'),_0x9c22('0xa5'),'ContactId',_0x9c22('0xa7'),_0x9c22('0x67'),_0x9c22('0x5f'),_0x9c22('0x60')],squel[_0x9c22('0x88')]()[_0x9c22('0x89')](_0x9c22('0xa4'),_0x9c22('0xa4'))[_0x9c22('0x89')](_0x9c22('0xa8'),_0x9c22('0xa5'))[_0x9c22('0x89')]('id',_0x9c22('0xa6'))[_0x9c22('0x89')](_0x334369[_0x9c22('0xb2')]['toString'](),_0x9c22('0xa7'))[_0x9c22('0x89')](_0x3b4b24[_0x9c22('0x5c')]['id'][_0x9c22('0xa9')](),'VoiceQueueId')[_0x9c22('0x89')](_0x9c22('0xa8'),_0x9c22('0x5f'))[_0x9c22('0x89')](_0x9c22('0xa8'),_0x9c22('0x60'))[_0x9c22('0x8a')](_0x9c22('0xaa'))['where'](_0x9c22('0xb3'))[_0x9c22('0x49')](_0x9c22('0xab'),_0x334369['CmListId'][_0x9c22('0xa9')]())[_0x9c22('0x49')]('phone\x20IS\x20NOT\x20NULL'))[_0x9c22('0xa9')]();}_0xba0e5c[_0x9c22('0x91')](db[_0x9c22('0x7c')]['query'](_0x596d03));}return BPromise[_0x9c22('0x9b')](_0xba0e5c);}})[_0x9c22('0x2b')](function(){return _0x3fce1e;})[_0x9c22('0x2b')](respondWithResult(_0x42d54d,null))['catch'](handleError(_0x42d54d,null));};exports[_0x9c22('0xb4')]=function(_0x18cb3a,_0x157adf,_0x1af57f){return db[_0x9c22('0x4e')][_0x9c22('0x36')]({'where':{'id':_0x18cb3a['params']['id']}})[_0x9c22('0x2b')](handleEntityNotFound(_0x157adf,null))[_0x9c22('0x2b')](function(_0x494009){if(_0x494009){return _0x494009[_0x9c22('0xb4')](_0x18cb3a[_0x9c22('0x3f')]['ids']);}})[_0x9c22('0x2b')](function(_0x3045c2){if(_0x3045c2){return db[_0x9c22('0x66')][_0x9c22('0x37')]({'where':{'ListId':_0x18cb3a['query'][_0x9c22('0x87')],'VoiceQueueId':_0x18cb3a[_0x9c22('0x5c')]['id']}})[_0x9c22('0x2b')](function(){return _0x3045c2;});}})['then'](respondWithStatusCode(_0x157adf,null))[_0x9c22('0x51')](handleError(_0x157adf,null));};exports[_0x9c22('0xb5')]=function(_0x40f738,_0x466a07,_0x347366){var _0x5b47a4={};var _0xcfa2b={};var _0x137f51;var _0x2213e2;return db[_0x9c22('0x4e')]['findOne']({'where':{'id':_0x40f738[_0x9c22('0x5c')]['id']}})['then'](handleEntityNotFound(_0x466a07,null))[_0x9c22('0x2b')](function(_0x5c5570){if(_0x5c5570){_0x137f51=_0x5c5570;_0xcfa2b[_0x9c22('0x3e')]=_[_0x9c22('0x40')](db[_0x9c22('0xb6')]['rawAttributes']);_0xcfa2b[_0x9c22('0x3f')]=_[_0x9c22('0x40')](_0x40f738[_0x9c22('0x3f')]);_0xcfa2b[_0x9c22('0x41')]=_[_0x9c22('0x42')](_0xcfa2b['model'],_0xcfa2b[_0x9c22('0x3f')]);_0x5b47a4['attributes']=_['intersection'](_0xcfa2b[_0x9c22('0x3e')],qs['fields'](_0x40f738[_0x9c22('0x3f')][_0x9c22('0x44')]));_0x5b47a4[_0x9c22('0x43')]=_0x5b47a4[_0x9c22('0x43')][_0x9c22('0x45')]?_0x5b47a4['attributes']:_0xcfa2b[_0x9c22('0x3e')];_0x5b47a4[_0x9c22('0x47')]=qs[_0x9c22('0x48')](_0x40f738['query']['sort']);_0x5b47a4['where']=qs[_0x9c22('0x41')](_[_0x9c22('0x6c')](_0x40f738[_0x9c22('0x3f')],_0xcfa2b['filters']));if(_0x40f738[_0x9c22('0x3f')][_0x9c22('0x30')]){_0x5b47a4[_0x9c22('0x49')]=_['merge'](_0x5b47a4[_0x9c22('0x49')],{'$or':_[_0x9c22('0x32')](_0x5b47a4[_0x9c22('0x43')],function(_0x28d4b7){var _0x2ccabe={};_0x2ccabe[_0x28d4b7]={'$like':'%'+_0x40f738[_0x9c22('0x3f')][_0x9c22('0x30')]+'%'};return _0x2ccabe;})});}_0x5b47a4=_[_0x9c22('0x4b')]({},_0x5b47a4,_0x40f738[_0x9c22('0x5d')]);return _0x137f51[_0x9c22('0xb5')](_0x5b47a4);}})[_0x9c22('0x2b')](function(_0x237df5){if(_0x237df5){_0x2213e2=_0x237df5[_0x9c22('0x45')];if(!_0x40f738[_0x9c22('0x3f')][_0x9c22('0x46')]('nolimit')){_0x5b47a4['limit']=qs[_0x9c22('0x24')](_0x40f738[_0x9c22('0x3f')][_0x9c22('0x24')]);_0x5b47a4['offset']=qs[_0x9c22('0x23')](_0x40f738['query'][_0x9c22('0x23')]);}return _0x137f51[_0x9c22('0xb5')](_0x5b47a4);}})['then'](function(_0x351b6f){if(_0x351b6f){return _0x351b6f?{'count':_0x2213e2,'rows':_0x351b6f}:null;}})[_0x9c22('0x2b')](respondWithResult(_0x466a07,null))['catch'](handleError(_0x466a07,null));};exports[_0x9c22('0xb7')]=function(_0x16850,_0x71be61,_0x1c9bfb){var _0x5995ea,_0x108490;return db[_0x9c22('0x4e')][_0x9c22('0x36')]({'where':{'id':_0x16850[_0x9c22('0x5c')]['id']}})['then'](handleEntityNotFound(_0x71be61,null))[_0x9c22('0x2b')](function(_0x415858){if(_0x415858){_0x108490=_0x415858;return _0x415858[_0x9c22('0xb7')](_0x16850[_0x9c22('0x54')][_0x9c22('0x87')],_[_0x9c22('0x5e')](_0x16850[_0x9c22('0x54')],[_0x9c22('0x87'),'id'])||{});}return null;})[_0x9c22('0xb8')](function(_0x22d72d){var _0x5987b7;_0x5995ea=_0x22d72d||[];var _0x1d6361=[];if(_0x22d72d){for(var _0x1faea2=0x0;_0x1faea2<_0x22d72d[_0x9c22('0x45')];_0x1faea2+=0x1){var _0x3caa1e=_0x22d72d[_0x1faea2]['get']({'plain':!![]});_0x5987b7=squel[_0x9c22('0xb1')]()[_0x9c22('0xa1')]('cm_hopper_black')[_0x9c22('0xa3')](['phone',_0x9c22('0xa6'),_0x9c22('0xa7'),_0x9c22('0x67'),_0x9c22('0x5f'),_0x9c22('0x60')],squel['select']()[_0x9c22('0x89')](_0x9c22('0xa4'),_0x9c22('0xa4'))['field']('id',_0x9c22('0xa6'))[_0x9c22('0x89')](_0x3caa1e['CmListId'][_0x9c22('0xa9')](),'ListId')[_0x9c22('0x89')](_0x16850[_0x9c22('0x5c')]['id'][_0x9c22('0xa9')](),'VoiceQueueId')[_0x9c22('0x89')](_0x9c22('0xa8'),_0x9c22('0x5f'))[_0x9c22('0x89')](_0x9c22('0xa8'),_0x9c22('0x60'))[_0x9c22('0x8a')](_0x9c22('0xaa'))[_0x9c22('0x49')](_0x9c22('0xb3'))[_0x9c22('0x49')](_0x9c22('0xab'),_0x3caa1e['CmListId'][_0x9c22('0xa9')]())[_0x9c22('0x49')](_0x9c22('0xac')))['toString']();_0x1d6361[_0x9c22('0x91')](db[_0x9c22('0x7c')]['query'](_0x5987b7));}return BPromise[_0x9c22('0x9b')](_0x1d6361);}})[_0x9c22('0x2b')](function(){return _0x5995ea;})[_0x9c22('0x2b')](respondWithResult(_0x71be61,null))[_0x9c22('0x51')](handleError(_0x71be61,null));};exports[_0x9c22('0xb9')]=function(_0x26b00d,_0x56c132,_0x33dbd6){return db[_0x9c22('0x4e')][_0x9c22('0x36')]({'where':{'id':_0x26b00d['params']['id']}})[_0x9c22('0x2b')](handleEntityNotFound(_0x56c132,null))['then'](function(_0x2c9ccd){if(_0x2c9ccd){return _0x2c9ccd['removeBlackLists'](_0x26b00d[_0x9c22('0x3f')][_0x9c22('0x87')]);}})[_0x9c22('0x2b')](function(_0x4527c4){if(_0x4527c4){return db[_0x9c22('0x70')][_0x9c22('0x37')]({'where':{'ListId':_0x26b00d[_0x9c22('0x3f')][_0x9c22('0x87')],'VoiceQueueId':_0x26b00d[_0x9c22('0x5c')]['id']}})[_0x9c22('0x2b')](function(){return _0x4527c4;});}})['then'](respondWithStatusCode(_0x56c132,null))['catch'](handleError(_0x56c132,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index a6f4f0f..e08599c 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 _0x1bf3=['hook','exports','events','VoiceQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x5bbea7,_0x572ed6){var _0x5334a9=function(_0x4082dc){while(--_0x4082dc){_0x5bbea7['push'](_0x5bbea7['shift']());}};_0x5334a9(++_0x572ed6);}(_0x1bf3,0x124));var _0x31bf=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1bf3[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x31bf('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0x31bf('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x31bf('0x2')](0x0);var events={'afterCreate':_0x31bf('0x3'),'afterUpdate':_0x31bf('0x4'),'afterDestroy':_0x31bf('0x5')};function emitEvent(_0x15438c){return function(_0x30f5bc,_0x24b483,_0x5d0152){VoiceQueueEvents[_0x31bf('0x6')](_0x15438c+':'+_0x30f5bc['id'],_0x30f5bc);VoiceQueueEvents[_0x31bf('0x6')](_0x15438c,_0x30f5bc);_0x5d0152(null);};}for(var e in events){if(events[_0x31bf('0x7')](e)){var event=events[e];VoiceQueue[_0x31bf('0x8')](e,emitEvent(event));}}module[_0x31bf('0x9')]=VoiceQueueEvents; \ No newline at end of file +var _0x1c28=['remove','emit','hook','events','../../mysqldb','VoiceQueue','setMaxListeners'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x1c28,0xb2));var _0x81c2=function(_0x235cb0,_0x599e81){_0x235cb0=_0x235cb0-0x0;var _0x27595b=_0x1c28[_0x235cb0];return _0x27595b;};'use strict';var EventEmitter=require(_0x81c2('0x0'));var VoiceQueue=require(_0x81c2('0x1'))['db'][_0x81c2('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x81c2('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x81c2('0x4')};function emitEvent(_0x392a5e){return function(_0x458240,_0x4c1608,_0x469810){VoiceQueueEvents['emit'](_0x392a5e+':'+_0x458240['id'],_0x458240);VoiceQueueEvents[_0x81c2('0x5')](_0x392a5e,_0x458240);_0x469810(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x81c2('0x6')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 0d41cf9..089624c 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 _0x70e0=['voice_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./voiceQueue.attributes'];(function(_0x465845,_0x15007c){var _0x314825=function(_0x4f24b8){while(--_0x4f24b8){_0x465845['push'](_0x465845['shift']());}};_0x314825(++_0x15007c);}(_0x70e0,0x17b));var _0x070e=function(_0x52bdc0,_0x581de4){_0x52bdc0=_0x52bdc0-0x0;var _0x3d8a9e=_0x70e0[_0x52bdc0];return _0x3d8a9e;};'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 +var _0xa9e0=['../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x22ec67,_0x447dfd){var _0x327c63=function(_0x2c48f3){while(--_0x2c48f3){_0x22ec67['push'](_0x22ec67['shift']());}};_0x327c63(++_0x447dfd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'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':'voice_queues','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 216120e..df8b6b8 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 _0x856e=['where','limit','include','model','attributes','map','ShowVoiceQueue','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','then','info','debug','request\x20sent','stringify','error','code','VoiceQueue,\x20%s,\x20%s','message','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw'];(function(_0x5c0f34,_0x886be2){var _0x576e65=function(_0xb84d31){while(--_0xb84d31){_0x5c0f34['push'](_0x5c0f34['shift']());}};_0x576e65(++_0x886be2);}(_0x856e,0xdf));var _0xe856=function(_0x383356,_0x33d2f5){_0x383356=_0x383356-0x0;var _0x32ee5a=_0x856e[_0x383356];return _0x32ee5a;};'use strict';var _=require('lodash');var util=require(_0xe856('0x0'));var moment=require(_0xe856('0x1'));var BPromise=require(_0xe856('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe856('0x3'));var db=require(_0xe856('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe856('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe856('0x6'));var client=jayson[_0xe856('0x7')][_0xe856('0x8')]({'port':0x232a});config[_0xe856('0x9')]=_['defaults'](config[_0xe856('0x9')],{'host':_0xe856('0xa'),'port':0x18eb});var socket=require(_0xe856('0xb'))(new Redis(config[_0xe856('0x9')]));require('./voiceQueue.socket')[_0xe856('0xc')](socket);function respondWithRpcPromise(_0x218d52,_0x6f885c,_0x4f4c9a){return new BPromise(function(_0x24b1ea,_0x1f8716){return client['request'](_0x218d52,_0x4f4c9a)[_0xe856('0xd')](function(_0x4caecf){logger[_0xe856('0xe')]('VoiceQueue,\x20%s,\x20%s',_0x6f885c,'request\x20sent');logger[_0xe856('0xf')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x6f885c,_0xe856('0x10'),JSON[_0xe856('0x11')](_0x4caecf));if(_0x4caecf['error']){if(_0x4caecf[_0xe856('0x12')][_0xe856('0x13')]===0x1f4){logger[_0xe856('0x12')](_0xe856('0x14'),_0x6f885c,_0x4caecf[_0xe856('0x12')][_0xe856('0x15')]);return _0x1f8716(_0x4caecf[_0xe856('0x12')][_0xe856('0x15')]);}logger[_0xe856('0x12')](_0xe856('0x14'),_0x6f885c,_0x4caecf['error']['message']);return _0x24b1ea(_0x4caecf['error']['message']);}else{logger[_0xe856('0xe')](_0xe856('0x14'),_0x6f885c,_0xe856('0x10'));_0x24b1ea(_0x4caecf[_0xe856('0x16')][_0xe856('0x15')]);}})[_0xe856('0x17')](function(_0x3f53fd){logger[_0xe856('0x12')](_0xe856('0x14'),_0x6f885c,_0x3f53fd);_0x1f8716(_0x3f53fd);});});}exports[_0xe856('0x18')]=function(_0x39fd89){var _0x1c268d=this;return new Promise(function(_0xe49eb8,_0x2f4824){return db[_0xe856('0x19')][_0xe856('0x1a')]({'raw':_0x39fd89[_0xe856('0x1b')]?_0x39fd89[_0xe856('0x1b')][_0xe856('0x1c')]===undefined?!![]:![]:!![],'where':_0x39fd89[_0xe856('0x1b')]?_0x39fd89[_0xe856('0x1b')][_0xe856('0x1d')]||null:null,'attributes':_0x39fd89[_0xe856('0x1b')]?_0x39fd89['options']['attributes']||null:null,'limit':_0x39fd89['options']?_0x39fd89[_0xe856('0x1b')][_0xe856('0x1e')]||null:null,'include':_0x39fd89[_0xe856('0x1b')]?_0x39fd89[_0xe856('0x1b')][_0xe856('0x1f')]?_['map'](_0x39fd89['options']['include'],function(_0x30321d){return{'model':db[_0x30321d[_0xe856('0x20')]],'as':_0x30321d['as'],'attributes':_0x30321d[_0xe856('0x21')],'include':_0x30321d[_0xe856('0x1f')]?_[_0xe856('0x22')](_0x30321d[_0xe856('0x1f')],function(_0x58e8a0){return{'model':db[_0x58e8a0[_0xe856('0x20')]],'as':_0x58e8a0['as'],'attributes':_0x58e8a0[_0xe856('0x21')],'include':_0x58e8a0['include']?_['map'](_0x58e8a0[_0xe856('0x1f')],function(_0x4bd97c){return{'model':db[_0x4bd97c[_0xe856('0x20')]],'as':_0x4bd97c['as'],'attributes':_0x4bd97c[_0xe856('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x219316){logger[_0xe856('0xe')]('GetVoiceQueue',_0x39fd89);logger[_0xe856('0xf')](_0xe856('0x18'),_0x39fd89,JSON['stringify'](_0x219316));_0xe49eb8(_0x219316);})['catch'](function(_0x3e0a62){logger[_0xe856('0x12')]('GetVoiceQueue',_0x3e0a62['message'],_0x39fd89);_0x2f4824(_0x1c268d[_0xe856('0x12')](0x1f4,_0x3e0a62[_0xe856('0x15')]));});});};exports[_0xe856('0x23')]=function(_0x4035b0){var _0x44bc82=this;return new Promise(function(_0xe17e9b,_0x122011){return db[_0xe856('0x19')]['find']({'raw':_0x4035b0[_0xe856('0x1b')]?_0x4035b0[_0xe856('0x1b')][_0xe856('0x1c')]===undefined?!![]:![]:!![],'where':_0x4035b0['options']?_0x4035b0['options']['where']||null:null,'attributes':_0x4035b0['options']?_0x4035b0['options']['attributes']||null:null,'include':_0x4035b0[_0xe856('0x1b')]?_0x4035b0[_0xe856('0x1b')][_0xe856('0x1f')]?_['map'](_0x4035b0[_0xe856('0x1b')][_0xe856('0x1f')],function(_0x320ea7){return{'model':db[_0x320ea7['model']],'as':_0x320ea7['as'],'attributes':_0x320ea7[_0xe856('0x21')],'include':_0x320ea7['include']?_['map'](_0x320ea7['include'],function(_0x459609){return{'model':db[_0x459609[_0xe856('0x20')]],'as':_0x459609['as'],'attributes':_0x459609[_0xe856('0x21')],'include':_0x459609[_0xe856('0x1f')]?_['map'](_0x459609[_0xe856('0x1f')],function(_0x37c39e){return{'model':db[_0x37c39e['model']],'as':_0x37c39e['as'],'attributes':_0x37c39e[_0xe856('0x21')]};}):[]};}):[]};}):[]:[]})[_0xe856('0xd')](function(_0x43ec78){logger[_0xe856('0xe')](_0xe856('0x23'),_0x4035b0);logger['debug'](_0xe856('0x23'),_0x4035b0,JSON[_0xe856('0x11')](_0x43ec78));_0xe17e9b(_0x43ec78);})['catch'](function(_0x254d2d){logger[_0xe856('0x12')]('ShowVoiceQueue',_0x254d2d[_0xe856('0x15')],_0x4035b0);_0x122011(_0x44bc82[_0xe856('0x12')](0x1f4,_0x254d2d[_0xe856('0x15')]));});});}; \ No newline at end of file +var _0x400d=['map','attributes','ShowVoiceQueue','find','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./voiceQueue.socket','request','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVoiceQueue','VoiceQueue','options','raw','where','include','model'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x400d,0x11c));var _0xd400=function(_0x3f3125,_0x3f49d2){_0x3f3125=_0x3f3125-0x0;var _0x28bf12=_0x400d[_0x3f3125];return _0x28bf12;};'use strict';var _=require('lodash');var util=require(_0xd400('0x0'));var moment=require(_0xd400('0x1'));var BPromise=require('bluebird');var rs=require(_0xd400('0x2'));var fs=require('fs');var Redis=require(_0xd400('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd400('0x4'));var logger=require('../../config/logger')(_0xd400('0x5'));var config=require(_0xd400('0x6'));var jayson=require(_0xd400('0x7'));var client=jayson['client'][_0xd400('0x8')]({'port':0x232a});config[_0xd400('0x9')]=_[_0xd400('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd400('0xb'))(new Redis(config['redis']));require(_0xd400('0xc'))['register'](socket);function respondWithRpcPromise(_0x36d863,_0x2d26d6,_0x304e78){return new BPromise(function(_0x2c555c,_0xd82fff){return client[_0xd400('0xd')](_0x36d863,_0x304e78)['then'](function(_0x52df84){logger[_0xd400('0xe')](_0xd400('0xf'),_0x2d26d6,_0xd400('0x10'));logger[_0xd400('0x11')](_0xd400('0x12'),_0x2d26d6,_0xd400('0x10'),JSON[_0xd400('0x13')](_0x52df84));if(_0x52df84[_0xd400('0x14')]){if(_0x52df84[_0xd400('0x14')][_0xd400('0x15')]===0x1f4){logger['error'](_0xd400('0xf'),_0x2d26d6,_0x52df84[_0xd400('0x14')][_0xd400('0x16')]);return _0xd82fff(_0x52df84['error'][_0xd400('0x16')]);}logger[_0xd400('0x14')](_0xd400('0xf'),_0x2d26d6,_0x52df84[_0xd400('0x14')]['message']);return _0x2c555c(_0x52df84[_0xd400('0x14')][_0xd400('0x16')]);}else{logger['info']('VoiceQueue,\x20%s,\x20%s',_0x2d26d6,_0xd400('0x10'));_0x2c555c(_0x52df84['result'][_0xd400('0x16')]);}})[_0xd400('0x17')](function(_0x3288a9){logger[_0xd400('0x14')](_0xd400('0xf'),_0x2d26d6,_0x3288a9);_0xd82fff(_0x3288a9);});});}exports[_0xd400('0x18')]=function(_0x58fd7b){var _0x536a34=this;return new Promise(function(_0x3329e4,_0x5270e5){return db[_0xd400('0x19')]['findAll']({'raw':_0x58fd7b['options']?_0x58fd7b[_0xd400('0x1a')][_0xd400('0x1b')]===undefined?!![]:![]:!![],'where':_0x58fd7b[_0xd400('0x1a')]?_0x58fd7b[_0xd400('0x1a')][_0xd400('0x1c')]||null:null,'attributes':_0x58fd7b[_0xd400('0x1a')]?_0x58fd7b[_0xd400('0x1a')]['attributes']||null:null,'limit':_0x58fd7b[_0xd400('0x1a')]?_0x58fd7b[_0xd400('0x1a')]['limit']||null:null,'include':_0x58fd7b[_0xd400('0x1a')]?_0x58fd7b[_0xd400('0x1a')][_0xd400('0x1d')]?_['map'](_0x58fd7b['options'][_0xd400('0x1d')],function(_0x5da828){return{'model':db[_0x5da828[_0xd400('0x1e')]],'as':_0x5da828['as'],'attributes':_0x5da828['attributes'],'include':_0x5da828[_0xd400('0x1d')]?_[_0xd400('0x1f')](_0x5da828[_0xd400('0x1d')],function(_0x3980b2){return{'model':db[_0x3980b2[_0xd400('0x1e')]],'as':_0x3980b2['as'],'attributes':_0x3980b2[_0xd400('0x20')],'include':_0x3980b2[_0xd400('0x1d')]?_[_0xd400('0x1f')](_0x3980b2['include'],function(_0x429f23){return{'model':db[_0x429f23[_0xd400('0x1e')]],'as':_0x429f23['as'],'attributes':_0x429f23['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x294566){logger[_0xd400('0xe')](_0xd400('0x18'),_0x58fd7b);logger['debug']('GetVoiceQueue',_0x58fd7b,JSON[_0xd400('0x13')](_0x294566));_0x3329e4(_0x294566);})[_0xd400('0x17')](function(_0x7d0513){logger[_0xd400('0x14')](_0xd400('0x18'),_0x7d0513[_0xd400('0x16')],_0x58fd7b);_0x5270e5(_0x536a34[_0xd400('0x14')](0x1f4,_0x7d0513[_0xd400('0x16')]));});});};exports[_0xd400('0x21')]=function(_0x4967b5){var _0x133be4=this;return new Promise(function(_0xd9ca85,_0x2764a8){return db[_0xd400('0x19')][_0xd400('0x22')]({'raw':_0x4967b5['options']?_0x4967b5[_0xd400('0x1a')][_0xd400('0x1b')]===undefined?!![]:![]:!![],'where':_0x4967b5['options']?_0x4967b5[_0xd400('0x1a')][_0xd400('0x1c')]||null:null,'attributes':_0x4967b5['options']?_0x4967b5[_0xd400('0x1a')][_0xd400('0x20')]||null:null,'include':_0x4967b5[_0xd400('0x1a')]?_0x4967b5[_0xd400('0x1a')][_0xd400('0x1d')]?_[_0xd400('0x1f')](_0x4967b5['options']['include'],function(_0x15a2af){return{'model':db[_0x15a2af['model']],'as':_0x15a2af['as'],'attributes':_0x15a2af['attributes'],'include':_0x15a2af[_0xd400('0x1d')]?_[_0xd400('0x1f')](_0x15a2af[_0xd400('0x1d')],function(_0x560833){return{'model':db[_0x560833[_0xd400('0x1e')]],'as':_0x560833['as'],'attributes':_0x560833[_0xd400('0x20')],'include':_0x560833[_0xd400('0x1d')]?_[_0xd400('0x1f')](_0x560833[_0xd400('0x1d')],function(_0x57ab0b){return{'model':db[_0x57ab0b[_0xd400('0x1e')]],'as':_0x57ab0b['as'],'attributes':_0x57ab0b[_0xd400('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xbcc38a){logger[_0xd400('0xe')](_0xd400('0x21'),_0x4967b5);logger[_0xd400('0x11')](_0xd400('0x21'),_0x4967b5,JSON['stringify'](_0xbcc38a));_0xd9ca85(_0xbcc38a);})[_0xd400('0x17')](function(_0x35bcb8){logger['error']('ShowVoiceQueue',_0x35bcb8[_0xd400('0x16')],_0x4967b5);_0x2764a8(_0x133be4[_0xd400('0x14')](0x1f4,_0x35bcb8[_0xd400('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 25c07ca..7273c1a 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 _0x68f1=['save','remove','update','emit','removeListener','length','voiceQueue:'];(function(_0x10461e,_0x7eab6c){var _0x4567d7=function(_0x8c65c0){while(--_0x8c65c0){_0x10461e['push'](_0x10461e['shift']());}};_0x4567d7(++_0x7eab6c);}(_0x68f1,0x126));var _0x168f=function(_0x512c6d,_0x5009ff){_0x512c6d=_0x512c6d-0x0;var _0x2ae871=_0x68f1[_0x512c6d];return _0x2ae871;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0x168f('0x0'),_0x168f('0x1'),_0x168f('0x2')];function createListener(_0x24cf32,_0xb9e909){return function(_0x18b4f3){_0xb9e909[_0x168f('0x3')](_0x24cf32,_0x18b4f3);};}function removeListener(_0x25c025,_0x5ad2c1){return function(){VoiceQueueEvents[_0x168f('0x4')](_0x25c025,_0x5ad2c1);};}exports['register']=function(_0xd1ac78){for(var _0x502c94=0x0,_0x3ee76f=events[_0x168f('0x5')];_0x502c94<_0x3ee76f;_0x502c94++){var _0x4d702d=events[_0x502c94];var _0x5d48dc=createListener(_0x168f('0x6')+_0x4d702d,_0xd1ac78);VoiceQueueEvents['on'](_0x4d702d,_0x5d48dc);}}; \ No newline at end of file +var _0xfd06=['./voiceQueue.events','save','remove','update','emit','removeListener','register','length','voiceQueue:'];(function(_0x20a7d2,_0x4d586c){var _0x42be49=function(_0x54a085){while(--_0x54a085){_0x20a7d2['push'](_0x20a7d2['shift']());}};_0x42be49(++_0x4d586c);}(_0xfd06,0x7e));var _0x6fd0=function(_0x5d99bb,_0x10e04b){_0x5d99bb=_0x5d99bb-0x0;var _0xdfe846=_0xfd06[_0x5d99bb];return _0xdfe846;};'use strict';var VoiceQueueEvents=require(_0x6fd0('0x0'));var events=[_0x6fd0('0x1'),_0x6fd0('0x2'),_0x6fd0('0x3')];function createListener(_0x9b5ba5,_0x1fbba8){return function(_0x50d5fc){_0x1fbba8[_0x6fd0('0x4')](_0x9b5ba5,_0x50d5fc);};}function removeListener(_0x2f64e0,_0x256705){return function(){VoiceQueueEvents[_0x6fd0('0x5')](_0x2f64e0,_0x256705);};}exports[_0x6fd0('0x6')]=function(_0x111cd7){for(var _0x28a416=0x0,_0xd3680d=events[_0x6fd0('0x7')];_0x28a416<_0xd3680d;_0x28a416++){var _0x3f61be=events[_0x28a416];var _0x568efa=createListener(_0x6fd0('0x8')+_0x3f61be,_0x111cd7);VoiceQueueEvents['on'](_0x3f61be,_0x568efa);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index c6098ba..80b532f 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 _0xe02a=['/describe','/index','getVoiceQueuesReport','/:id','show','create','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index'];(function(_0x2936f5,_0x23a7a3){var _0x5e2920=function(_0x50f904){while(--_0x50f904){_0x2936f5['push'](_0x2936f5['shift']());}};_0x5e2920(++_0x23a7a3);}(_0xe02a,0xb9));var _0xae02=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe02a[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xae02('0x0'));var util=require(_0xae02('0x1'));var path=require(_0xae02('0x2'));var timeout=require(_0xae02('0x3'));var express=require(_0xae02('0x4'));var router=express[_0xae02('0x5')]();var fs_extra=require(_0xae02('0x6'));var auth=require(_0xae02('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xae02('0x8'));var controller=require(_0xae02('0x9'));router[_0xae02('0xa')]('/',auth[_0xae02('0xb')](),controller[_0xae02('0xc')]);router[_0xae02('0xa')](_0xae02('0xd'),auth[_0xae02('0xb')](),controller['describe']);router[_0xae02('0xa')](_0xae02('0xe'),auth['isAuthenticated'](),controller[_0xae02('0xf')]);router[_0xae02('0xa')](_0xae02('0x10'),auth[_0xae02('0xb')](),controller[_0xae02('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0xae02('0x12')]);router['put'](_0xae02('0x10'),auth[_0xae02('0xb')](),controller[_0xae02('0x13')]);router[_0xae02('0x14')]('/:id',auth[_0xae02('0xb')](),controller['destroy']);module[_0xae02('0x15')]=router; \ No newline at end of file +var _0xb3b5=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceQueueReport.controller','get','isAuthenticated','index','describe','getVoiceQueuesReport','show','create','/:id','delete','util'];(function(_0x164af1,_0x3cf772){var _0x5d81a2=function(_0xa57547){while(--_0xa57547){_0x164af1['push'](_0x164af1['shift']());}};_0x5d81a2(++_0x3cf772);}(_0xb3b5,0x167));var _0x5b3b=function(_0x208961,_0x5e6cf6){_0x208961=_0x208961-0x0;var _0x4236f5=_0xb3b5[_0x208961];return _0x4236f5;};'use strict';var multer=require('multer');var util=require(_0x5b3b('0x0'));var path=require(_0x5b3b('0x1'));var timeout=require(_0x5b3b('0x2'));var express=require(_0x5b3b('0x3'));var router=express[_0x5b3b('0x4')]();var fs_extra=require(_0x5b3b('0x5'));var auth=require(_0x5b3b('0x6'));var interaction=require(_0x5b3b('0x7'));var config=require('../../config/environment');var controller=require(_0x5b3b('0x8'));router[_0x5b3b('0x9')]('/',auth[_0x5b3b('0xa')](),controller[_0x5b3b('0xb')]);router[_0x5b3b('0x9')]('/describe',auth[_0x5b3b('0xa')](),controller[_0x5b3b('0xc')]);router[_0x5b3b('0x9')]('/index',auth['isAuthenticated'](),controller[_0x5b3b('0xd')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x5b3b('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5b3b('0xf')]);router['put'](_0x5b3b('0x10'),auth[_0x5b3b('0xa')](),controller['update']);router[_0x5b3b('0x11')](_0x5b3b('0x10'),auth[_0x5b3b('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 0f0c894..53aae34 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 _0xc715=['COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','getDataValue','format','seconds','setDataValue','holdtime','INTEGER','BOOLEAN'];(function(_0xff2177,_0x4f3fe8){var _0x1e8711=function(_0x3f8f8b){while(--_0x3f8f8b){_0xff2177['push'](_0xff2177['shift']());}};_0x1e8711(++_0x4f3fe8);}(_0xc715,0x1a6));var _0x5c71=function(_0x3f9d5d,_0x4ee8dd){_0x3f9d5d=_0x3f9d5d-0x0;var _0x1b2cd7=_0xc715[_0x3f9d5d];return _0x1b2cd7;};'use strict';var Sequelize=require(_0x5c71('0x0'));var moment=require(_0x5c71('0x1'));module[_0x5c71('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x5c71('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x5c71('0x3')]},'queue':{'type':Sequelize[_0x5c71('0x3')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0x5c71('0x4')],'set':function(_0x2808e6){var _0x45ed7d=moment(_0x2808e6);var _0x4f3b28=moment(this[_0x5c71('0x5')]('queuecallerjoinAt'))[_0x5c71('0x6')]('YYYY-MM-DD\x20HH:mm:ss');var _0x21bae8=_0x45ed7d['diff'](_0x4f3b28,_0x5c71('0x7'));this['setDataValue']('queuecallerleaveAt',_0x2808e6);this[_0x5c71('0x8')](_0x5c71('0x9'),_0x21bae8||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x5c71('0xa')]},'queuecallerabandon':{'type':Sequelize[_0x5c71('0xb')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x5c71('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x5c71('0xb')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x5c71('0x4')]},'queuecallerexit':{'type':Sequelize[_0x5c71('0xb')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x5c71('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x5c71('0x3')],'comment':_0x5c71('0xc')},'originalposition':{'type':Sequelize[_0x5c71('0xa')]},'channel':{'type':Sequelize[_0x5c71('0x3')]},'connectedlinenum':{'type':Sequelize[_0x5c71('0x3')]},'connectedlinename':{'type':Sequelize[_0x5c71('0x3')]},'accountcode':{'type':Sequelize[_0x5c71('0x3')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x5c71('0x3')]},'holdtime':{'type':Sequelize[_0x5c71('0xa')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x5c71('0xb')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x5c71('0x3')]},'transfer':{'type':Sequelize[_0x5c71('0xb')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x5c71('0x3')],'comment':_0x5c71('0xd')},'transferexten':{'type':Sequelize[_0x5c71('0x3')]},'transferuniqueid':{'type':Sequelize[_0x5c71('0x3')]},'disposition':{'type':Sequelize[_0x5c71('0x3')]},'secondDisposition':{'type':Sequelize[_0x5c71('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0x5c71('0xa')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2dc0=['DATE','format','YYYY-MM-DD\x20HH:mm:ss','seconds','setDataValue','queuecallerleaveAt','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING'];(function(_0xd38e50,_0x1802d1){var _0x1619de=function(_0x52c833){while(--_0x52c833){_0xd38e50['push'](_0xd38e50['shift']());}};_0x1619de(++_0x1802d1);}(_0x2dc0,0x9a));var _0x02dc=function(_0x26f035,_0x80fa6f){_0x26f035=_0x26f035-0x0;var _0x43ec27=_0x2dc0[_0x26f035];return _0x43ec27;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x02dc('0x0')]={'type':{'type':Sequelize[_0x02dc('0x1')]},'uniqueid':{'type':Sequelize[_0x02dc('0x1')]},'calleridnum':{'type':Sequelize[_0x02dc('0x1')]},'calleridname':{'type':Sequelize[_0x02dc('0x1')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x02dc('0x2')]},'queuecallerleaveAt':{'type':Sequelize[_0x02dc('0x2')],'set':function(_0x1b45dd){var _0x32bbff=moment(_0x1b45dd);var _0x1befec=moment(this['getDataValue']('queuecallerjoinAt'))[_0x02dc('0x3')](_0x02dc('0x4'));var _0x55cf73=_0x32bbff['diff'](_0x1befec,_0x02dc('0x5'));this[_0x02dc('0x6')](_0x02dc('0x7'),_0x1b45dd);this['setDataValue']('holdtime',_0x55cf73||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x02dc('0x8')]},'queuecallerabandon':{'type':Sequelize[_0x02dc('0x9')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x02dc('0x2')]},'queuecallercomplete':{'type':Sequelize[_0x02dc('0x9')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x02dc('0x2')]},'queuecallerexitreason':{'type':Sequelize[_0x02dc('0x1')],'comment':_0x02dc('0xa')},'originalposition':{'type':Sequelize[_0x02dc('0x8')]},'channel':{'type':Sequelize[_0x02dc('0x1')]},'connectedlinenum':{'type':Sequelize[_0x02dc('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x02dc('0x1')]},'context':{'type':Sequelize[_0x02dc('0x1')]},'exten':{'type':Sequelize[_0x02dc('0x1')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x02dc('0x8')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x02dc('0x9')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x02dc('0x1')]},'transfer':{'type':Sequelize[_0x02dc('0x9')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x02dc('0x1')],'comment':_0x02dc('0xb')},'transferexten':{'type':Sequelize[_0x02dc('0x1')]},'transferuniqueid':{'type':Sequelize[_0x02dc('0x1')]},'disposition':{'type':Sequelize[_0x02dc('0x1')]},'secondDisposition':{'type':Sequelize[_0x02dc('0x1')]},'thirdDisposition':{'type':Sequelize[_0x02dc('0x1')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 63f1451..b6200f4 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 _0x1d14=['stack','name','map','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','options','VoiceQueueReport','includeAll','include','findAll','rows','catch','params','find','create','body','destroy','describe','getVoiceQueuesReport','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','end','limit','undefined','count','offset','status','set','apply','reject','save','update','then','error'];(function(_0x10103a,_0x5458d1){var _0x274b47=function(_0x252fa0){while(--_0x252fa0){_0x10103a['push'](_0x10103a['shift']());}};_0x274b47(++_0x5458d1);}(_0x1d14,0xc2));var _0x41d1=function(_0x133532,_0x366962){_0x133532=_0x133532-0x0;var _0x44c8ea=_0x1d14[_0x133532];return _0x44c8ea;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x41d1('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x41d1('0x1'));var moment=require(_0x41d1('0x2'));var BPromise=require(_0x41d1('0x3'));var Mustache=require('mustache');var util=require(_0x41d1('0x4'));var path=require(_0x41d1('0x5'));var sox=require('sox');var csv=require(_0x41d1('0x6'));var ejs=require(_0x41d1('0x7'));var fs=require('fs');var fs_extra=require(_0x41d1('0x8'));var _=require(_0x41d1('0x9'));var squel=require(_0x41d1('0xa'));var crypto=require(_0x41d1('0xb'));var jsforce=require(_0x41d1('0xc'));var deskjs=require(_0x41d1('0xd'));var toCsv=require(_0x41d1('0x6'));var querystring=require(_0x41d1('0xe'));var Papa=require(_0x41d1('0xf'));var Redis=require(_0x41d1('0x10'));var authService=require(_0x41d1('0x11'));var qs=require(_0x41d1('0x12'));var as=require(_0x41d1('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x41d1('0x14'));var config=require(_0x41d1('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x41d1('0x16'))['db'];config[_0x41d1('0x17')]=_[_0x41d1('0x18')](config[_0x41d1('0x17')],{'host':_0x41d1('0x19'),'port':0x18eb});var socket=require(_0x41d1('0x1a'))(new Redis(config['redis']));require(_0x41d1('0x1b'))[_0x41d1('0x1c')](socket);function respondWithStatusCode(_0x28c9fd,_0x46c49b){_0x46c49b=_0x46c49b||0xcc;return function(_0x237e3a){if(_0x237e3a){return _0x28c9fd[_0x41d1('0x1d')](_0x46c49b);}return _0x28c9fd['status'](_0x46c49b)[_0x41d1('0x1e')]();};}function respondWithResult(_0xd8b5d6,_0x28f7cc){_0x28f7cc=_0x28f7cc||0xc8;return function(_0x5bb8f2){if(_0x5bb8f2){return _0xd8b5d6['status'](_0x28f7cc)['json'](_0x5bb8f2);}};}function respondWithFilteredResult(_0x2a968b,_0x30bbb2){return function(_0x4752ac){if(_0x4752ac){var _0x4e0710=typeof _0x30bbb2['offset']==='undefined'&&typeof _0x30bbb2[_0x41d1('0x1f')]===_0x41d1('0x20');var _0x3c50ae=_0x4752ac[_0x41d1('0x21')];var _0x4a4e24=_0x4e0710?0x0:_0x30bbb2[_0x41d1('0x22')];var _0x3e3ae5=_0x4e0710?_0x4752ac[_0x41d1('0x21')]:_0x30bbb2['offset']+_0x30bbb2['limit'];var _0x4c2cf6;if(_0x3e3ae5>=_0x3c50ae){_0x3e3ae5=_0x3c50ae;_0x4c2cf6=0xc8;}else{_0x4c2cf6=0xce;}_0x2a968b[_0x41d1('0x23')](_0x4c2cf6);return _0x2a968b[_0x41d1('0x24')]('Content-Range',_0x4a4e24+'-'+_0x3e3ae5+'/'+_0x3c50ae)['json'](_0x4752ac);}return null;};}function patchUpdates(_0xf76ad3){return function(_0x25f106){try{jsonpatch[_0x41d1('0x25')](_0x25f106,_0xf76ad3,!![]);}catch(_0x230107){return BPromise[_0x41d1('0x26')](_0x230107);}return _0x25f106[_0x41d1('0x27')]();};}function saveUpdates(_0x52b90f,_0x1cc811){return function(_0x45358e){if(_0x45358e){return _0x45358e[_0x41d1('0x28')](_0x52b90f)[_0x41d1('0x29')](function(_0x3185ad){return _0x3185ad;});}return null;};}function removeEntity(_0x463789,_0x2b1ae8){return function(_0x3668ab){if(_0x3668ab){return _0x3668ab['destroy']()[_0x41d1('0x29')](function(){_0x463789['status'](0xcc)[_0x41d1('0x1e')]();});}};}function handleEntityNotFound(_0x5708cf,_0x3008c8){return function(_0x234da9){if(!_0x234da9){_0x5708cf['sendStatus'](0x194);}return _0x234da9;};}function handleError(_0x30a248,_0x1618b0){_0x1618b0=_0x1618b0||0x1f4;return function(_0x3af50b){logger[_0x41d1('0x2a')](_0x3af50b[_0x41d1('0x2b')]);if(_0x3af50b['name']){delete _0x3af50b[_0x41d1('0x2c')];}_0x30a248[_0x41d1('0x23')](_0x1618b0)['send'](_0x3af50b);};}exports['index']=function(_0x10dabf,_0x3ddeea){var _0x3d6148={},_0x1df319={},_0x1c5e37={'count':0x0,'rows':[]};var _0x45697b=_[_0x41d1('0x2d')](db['VoiceQueueReport'][_0x41d1('0x2e')],function(_0x120d0c){return{'name':_0x120d0c[_0x41d1('0x2f')],'type':_0x120d0c[_0x41d1('0x30')][_0x41d1('0x31')]};});_0x1df319['model']=_[_0x41d1('0x2d')](_0x45697b,'name');_0x1df319[_0x41d1('0x32')]=_[_0x41d1('0x33')](_0x10dabf[_0x41d1('0x32')]);_0x1df319['filters']=_[_0x41d1('0x34')](_0x1df319[_0x41d1('0x35')],_0x1df319['query']);_0x3d6148[_0x41d1('0x36')]=_[_0x41d1('0x34')](_0x1df319[_0x41d1('0x35')],qs[_0x41d1('0x37')](_0x10dabf[_0x41d1('0x32')][_0x41d1('0x37')]));_0x3d6148[_0x41d1('0x36')]=_0x3d6148[_0x41d1('0x36')][_0x41d1('0x38')]?_0x3d6148['attributes']:_0x1df319['model'];if(!_0x10dabf[_0x41d1('0x32')]['hasOwnProperty'](_0x41d1('0x39'))){_0x3d6148[_0x41d1('0x1f')]=qs['limit'](_0x10dabf['query']['limit']);_0x3d6148['offset']=qs[_0x41d1('0x22')](_0x10dabf[_0x41d1('0x32')][_0x41d1('0x22')]);}_0x3d6148[_0x41d1('0x3a')]=qs[_0x41d1('0x3b')](_0x10dabf['query'][_0x41d1('0x3b')]);_0x3d6148[_0x41d1('0x3c')]=qs[_0x41d1('0x3d')](_[_0x41d1('0x3e')](_0x10dabf[_0x41d1('0x32')],_0x1df319['filters']),_0x45697b);if(_0x10dabf[_0x41d1('0x32')][_0x41d1('0x3f')]){_0x3d6148['where']=_['merge'](_0x3d6148[_0x41d1('0x3c')],{'$or':_[_0x41d1('0x2d')](_0x45697b,function(_0x3fab7b){if(_0x3fab7b[_0x41d1('0x30')]!=='VIRTUAL'){var _0x3d3aec={};_0x3d3aec[_0x3fab7b[_0x41d1('0x2c')]]={'$like':'%'+_0x10dabf[_0x41d1('0x32')][_0x41d1('0x3f')]+'%'};return _0x3d3aec;}})});}_0x3d6148=_[_0x41d1('0x40')]({},_0x3d6148,_0x10dabf[_0x41d1('0x41')]);var _0x409b3b={'where':_0x3d6148[_0x41d1('0x3c')]};return db[_0x41d1('0x42')]['count'](_0x409b3b)['then'](function(_0x327548){_0x1c5e37[_0x41d1('0x21')]=_0x327548;if(_0x10dabf[_0x41d1('0x32')][_0x41d1('0x43')]){_0x3d6148[_0x41d1('0x44')]=[{'all':!![]}];}return db[_0x41d1('0x42')][_0x41d1('0x45')](_0x3d6148);})[_0x41d1('0x29')](function(_0x19adfc){_0x1c5e37[_0x41d1('0x46')]=_0x19adfc;return _0x1c5e37;})[_0x41d1('0x29')](respondWithFilteredResult(_0x3ddeea,_0x3d6148))[_0x41d1('0x47')](handleError(_0x3ddeea,null));};exports['show']=function(_0x5cef84,_0x415fd1){var _0x2f0456={'raw':![],'where':{'id':_0x5cef84[_0x41d1('0x48')]['id']}},_0x23c447={};_0x23c447['model']=_[_0x41d1('0x33')](db[_0x41d1('0x42')][_0x41d1('0x2e')]);_0x23c447[_0x41d1('0x32')]=_[_0x41d1('0x33')](_0x5cef84[_0x41d1('0x32')]);_0x23c447[_0x41d1('0x3d')]=_[_0x41d1('0x34')](_0x23c447[_0x41d1('0x35')],_0x23c447['query']);_0x2f0456[_0x41d1('0x36')]=_[_0x41d1('0x34')](_0x23c447[_0x41d1('0x35')],qs[_0x41d1('0x37')](_0x5cef84[_0x41d1('0x32')]['fields']));_0x2f0456[_0x41d1('0x36')]=_0x2f0456[_0x41d1('0x36')][_0x41d1('0x38')]?_0x2f0456[_0x41d1('0x36')]:_0x23c447[_0x41d1('0x35')];if(_0x5cef84[_0x41d1('0x32')]['includeAll']){_0x2f0456[_0x41d1('0x44')]=[{'all':!![]}];}_0x2f0456=_[_0x41d1('0x40')]({},_0x2f0456,_0x5cef84[_0x41d1('0x41')]);return db['VoiceQueueReport'][_0x41d1('0x49')](_0x2f0456)['then'](handleEntityNotFound(_0x415fd1,null))['then'](respondWithResult(_0x415fd1,null))[_0x41d1('0x47')](handleError(_0x415fd1,null));};exports['create']=function(_0x38e042,_0x3a096d){return db[_0x41d1('0x42')][_0x41d1('0x4a')](_0x38e042[_0x41d1('0x4b')],{})[_0x41d1('0x29')](respondWithResult(_0x3a096d,0xc9))[_0x41d1('0x47')](handleError(_0x3a096d,null));};exports[_0x41d1('0x28')]=function(_0x336cf2,_0x38bea6){if(_0x336cf2['body']['id']){delete _0x336cf2[_0x41d1('0x4b')]['id'];}return db[_0x41d1('0x42')][_0x41d1('0x49')]({'where':{'id':_0x336cf2[_0x41d1('0x48')]['id']}})[_0x41d1('0x29')](handleEntityNotFound(_0x38bea6,null))[_0x41d1('0x29')](saveUpdates(_0x336cf2['body'],null))[_0x41d1('0x29')](respondWithResult(_0x38bea6,null))[_0x41d1('0x47')](handleError(_0x38bea6,null));};exports[_0x41d1('0x4c')]=function(_0x1f1a85,_0x1955a1){return db[_0x41d1('0x42')][_0x41d1('0x49')]({'where':{'id':_0x1f1a85[_0x41d1('0x48')]['id']}})[_0x41d1('0x29')](handleEntityNotFound(_0x1955a1,null))[_0x41d1('0x29')](removeEntity(_0x1955a1,null))[_0x41d1('0x47')](handleError(_0x1955a1,null));};exports[_0x41d1('0x4d')]=function(_0x4b9355,_0x57830c){return db[_0x41d1('0x42')][_0x41d1('0x4d')]()[_0x41d1('0x29')](respondWithResult(_0x57830c,null))['catch'](handleError(_0x57830c,null));};exports[_0x41d1('0x4e')]=function(_0x4be387,_0x53bf81){var _0x38a9bc={},_0x486037={},_0x3a16ee={'count':0x0,'rows':[]};_0x486037[_0x41d1('0x35')]=_[_0x41d1('0x33')](db[_0x41d1('0x42')]['rawAttributes']);_0x486037[_0x41d1('0x32')]=_[_0x41d1('0x33')](_0x4be387[_0x41d1('0x32')]);_0x486037[_0x41d1('0x3d')]=_[_0x41d1('0x34')](_0x486037[_0x41d1('0x35')],_0x486037[_0x41d1('0x32')]);_0x38a9bc[_0x41d1('0x36')]=_[_0x41d1('0x34')](_0x486037[_0x41d1('0x35')],qs[_0x41d1('0x37')](_0x4be387[_0x41d1('0x32')][_0x41d1('0x37')]));_0x38a9bc[_0x41d1('0x36')]=_0x38a9bc['attributes']['length']?_0x38a9bc[_0x41d1('0x36')]:_0x486037[_0x41d1('0x35')];if(!_0x4be387[_0x41d1('0x32')]['hasOwnProperty'](_0x41d1('0x39'))){_0x38a9bc['limit']=qs[_0x41d1('0x1f')](_0x4be387[_0x41d1('0x32')][_0x41d1('0x1f')]);_0x38a9bc[_0x41d1('0x22')]=qs[_0x41d1('0x22')](_0x4be387['query'][_0x41d1('0x22')]);}_0x38a9bc[_0x41d1('0x3a')]=qs[_0x41d1('0x3b')](_0x4be387[_0x41d1('0x32')][_0x41d1('0x3b')]);_0x38a9bc['where']=qs['filters'](_[_0x41d1('0x3e')](_0x4be387[_0x41d1('0x32')],_0x486037['filters']));if(_0x4be387['query'][_0x41d1('0x3f')]){_0x38a9bc[_0x41d1('0x3c')]=_[_0x41d1('0x40')](_0x38a9bc[_0x41d1('0x3c')],{'$or':_['map'](_0x38a9bc[_0x41d1('0x36')],function(_0x1ad7f4){var _0x41b5cd={};_0x41b5cd[_0x1ad7f4]={'$like':'%'+_0x4be387[_0x41d1('0x32')]['filter']+'%'};return _0x41b5cd;})});}_0x38a9bc=_['merge']({},_0x38a9bc,_0x4be387[_0x41d1('0x41')]);var _0x47a2a1={'where':_0x38a9bc[_0x41d1('0x3c')]};return db[_0x41d1('0x42')][_0x41d1('0x21')](_0x47a2a1)['then'](function(_0x2d4493){_0x3a16ee[_0x41d1('0x21')]=_0x2d4493;if(_0x4be387[_0x41d1('0x32')][_0x41d1('0x43')]){_0x38a9bc['include']=[{'all':!![]}];}return db[_0x41d1('0x42')]['findAll'](_0x38a9bc);})[_0x41d1('0x29')](function(_0x194af5){_0x3a16ee[_0x41d1('0x46')]=_0x194af5;return _0x3a16ee;})[_0x41d1('0x29')](respondWithFilteredResult(_0x53bf81,_0x38a9bc,'getVoiceQueuesReport'))['catch'](handleError(_0x53bf81,null,_0x41d1('0x4e')));}; \ No newline at end of file +var _0x17f3=['send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','filter','where','merge','count','includeAll','include','findAll','rows','catch','params','keys','options','create','body','find','describe','getVoiceQueuesReport','pick','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voiceQueueReport.socket','register','sendStatus','status','end','offset','undefined','limit','Content-Range','json','apply','reject','save','update','then','stack','name'];(function(_0x35fa19,_0x36e646){var _0x21b416=function(_0x32f721){while(--_0x32f721){_0x35fa19['push'](_0x35fa19['shift']());}};_0x21b416(++_0x36e646);}(_0x17f3,0x168));var _0x317f=function(_0x225a0f,_0x4f2cf0){_0x225a0f=_0x225a0f-0x0;var _0x101d3e=_0x17f3[_0x225a0f];return _0x101d3e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x317f('0x0'));var zipdir=require(_0x317f('0x1'));var jsonpatch=require(_0x317f('0x2'));var rp=require(_0x317f('0x3'));var moment=require(_0x317f('0x4'));var BPromise=require(_0x317f('0x5'));var Mustache=require(_0x317f('0x6'));var util=require(_0x317f('0x7'));var path=require('path');var sox=require(_0x317f('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x317f('0x9'));var _=require(_0x317f('0xa'));var squel=require(_0x317f('0xb'));var crypto=require(_0x317f('0xc'));var jsforce=require(_0x317f('0xd'));var deskjs=require(_0x317f('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x317f('0xf'));var Redis=require('ioredis');var authService=require(_0x317f('0x10'));var qs=require(_0x317f('0x11'));var as=require(_0x317f('0x12'));var hardwareService=require(_0x317f('0x13'));var logger=require(_0x317f('0x14'))('api');var utils=require(_0x317f('0x15'));var config=require(_0x317f('0x16'));var licenseUtil=require(_0x317f('0x17'));var db=require(_0x317f('0x18'))['db'];config[_0x317f('0x19')]=_[_0x317f('0x1a')](config[_0x317f('0x19')],{'host':_0x317f('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x317f('0x19')]));require(_0x317f('0x1c'))[_0x317f('0x1d')](socket);function respondWithStatusCode(_0x385c30,_0x319b3b){_0x319b3b=_0x319b3b||0xcc;return function(_0x568c20){if(_0x568c20){return _0x385c30[_0x317f('0x1e')](_0x319b3b);}return _0x385c30[_0x317f('0x1f')](_0x319b3b)[_0x317f('0x20')]();};}function respondWithResult(_0x239c7d,_0x1e3df3){_0x1e3df3=_0x1e3df3||0xc8;return function(_0x5197a9){if(_0x5197a9){return _0x239c7d[_0x317f('0x1f')](_0x1e3df3)['json'](_0x5197a9);}};}function respondWithFilteredResult(_0x2c2b63,_0x457af8){return function(_0x510558){if(_0x510558){var _0x2c6f7f=typeof _0x457af8[_0x317f('0x21')]==='undefined'&&typeof _0x457af8['limit']===_0x317f('0x22');var _0x227412=_0x510558['count'];var _0x1e39f1=_0x2c6f7f?0x0:_0x457af8[_0x317f('0x21')];var _0x3b2656=_0x2c6f7f?_0x510558['count']:_0x457af8[_0x317f('0x21')]+_0x457af8[_0x317f('0x23')];var _0x5a5a25;if(_0x3b2656>=_0x227412){_0x3b2656=_0x227412;_0x5a5a25=0xc8;}else{_0x5a5a25=0xce;}_0x2c2b63['status'](_0x5a5a25);return _0x2c2b63['set'](_0x317f('0x24'),_0x1e39f1+'-'+_0x3b2656+'/'+_0x227412)[_0x317f('0x25')](_0x510558);}return null;};}function patchUpdates(_0x1b828a){return function(_0x12f49b){try{jsonpatch[_0x317f('0x26')](_0x12f49b,_0x1b828a,!![]);}catch(_0x106ea7){return BPromise[_0x317f('0x27')](_0x106ea7);}return _0x12f49b[_0x317f('0x28')]();};}function saveUpdates(_0x50e9c8,_0x3c9290){return function(_0x2eb9e2){if(_0x2eb9e2){return _0x2eb9e2[_0x317f('0x29')](_0x50e9c8)[_0x317f('0x2a')](function(_0x43cb6f){return _0x43cb6f;});}return null;};}function removeEntity(_0x2b1e7e,_0x5a1b22){return function(_0xe30488){if(_0xe30488){return _0xe30488['destroy']()['then'](function(){_0x2b1e7e[_0x317f('0x1f')](0xcc)[_0x317f('0x20')]();});}};}function handleEntityNotFound(_0x47474b,_0x2b189a){return function(_0xa661a7){if(!_0xa661a7){_0x47474b['sendStatus'](0x194);}return _0xa661a7;};}function handleError(_0x179068,_0x1cabdd){_0x1cabdd=_0x1cabdd||0x1f4;return function(_0x461da3){logger['error'](_0x461da3[_0x317f('0x2b')]);if(_0x461da3[_0x317f('0x2c')]){delete _0x461da3['name'];}_0x179068['status'](_0x1cabdd)[_0x317f('0x2d')](_0x461da3);};}exports[_0x317f('0x2e')]=function(_0x4121ea,_0x253013){var _0x361926={},_0x53f368={},_0x4cd8db={'count':0x0,'rows':[]};var _0x1dbf0a=_[_0x317f('0x2f')](db[_0x317f('0x30')][_0x317f('0x31')],function(_0x5da531){return{'name':_0x5da531[_0x317f('0x32')],'type':_0x5da531[_0x317f('0x33')]['key']};});_0x53f368['model']=_[_0x317f('0x2f')](_0x1dbf0a,'name');_0x53f368[_0x317f('0x34')]=_['keys'](_0x4121ea[_0x317f('0x34')]);_0x53f368[_0x317f('0x35')]=_[_0x317f('0x36')](_0x53f368['model'],_0x53f368[_0x317f('0x34')]);_0x361926[_0x317f('0x37')]=_[_0x317f('0x36')](_0x53f368['model'],qs[_0x317f('0x38')](_0x4121ea['query']['fields']));_0x361926[_0x317f('0x37')]=_0x361926[_0x317f('0x37')][_0x317f('0x39')]?_0x361926[_0x317f('0x37')]:_0x53f368[_0x317f('0x3a')];if(!_0x4121ea[_0x317f('0x34')][_0x317f('0x3b')](_0x317f('0x3c'))){_0x361926[_0x317f('0x23')]=qs[_0x317f('0x23')](_0x4121ea['query'][_0x317f('0x23')]);_0x361926[_0x317f('0x21')]=qs[_0x317f('0x21')](_0x4121ea[_0x317f('0x34')]['offset']);}_0x361926[_0x317f('0x3d')]=qs[_0x317f('0x3e')](_0x4121ea[_0x317f('0x34')]['sort']);_0x361926['where']=qs[_0x317f('0x35')](_['pick'](_0x4121ea[_0x317f('0x34')],_0x53f368[_0x317f('0x35')]),_0x1dbf0a);if(_0x4121ea['query'][_0x317f('0x3f')]){_0x361926[_0x317f('0x40')]=_[_0x317f('0x41')](_0x361926[_0x317f('0x40')],{'$or':_[_0x317f('0x2f')](_0x1dbf0a,function(_0x31aa9c){if(_0x31aa9c[_0x317f('0x33')]!=='VIRTUAL'){var _0x58e6d2={};_0x58e6d2[_0x31aa9c['name']]={'$like':'%'+_0x4121ea['query']['filter']+'%'};return _0x58e6d2;}})});}_0x361926=_['merge']({},_0x361926,_0x4121ea['options']);var _0x6e8d26={'where':_0x361926[_0x317f('0x40')]};return db[_0x317f('0x30')][_0x317f('0x42')](_0x6e8d26)[_0x317f('0x2a')](function(_0x4ab7aa){_0x4cd8db[_0x317f('0x42')]=_0x4ab7aa;if(_0x4121ea[_0x317f('0x34')][_0x317f('0x43')]){_0x361926[_0x317f('0x44')]=[{'all':!![]}];}return db[_0x317f('0x30')][_0x317f('0x45')](_0x361926);})['then'](function(_0x4e78c3){_0x4cd8db[_0x317f('0x46')]=_0x4e78c3;return _0x4cd8db;})[_0x317f('0x2a')](respondWithFilteredResult(_0x253013,_0x361926))[_0x317f('0x47')](handleError(_0x253013,null));};exports['show']=function(_0x19e820,_0x5e8e92){var _0x1dc8fd={'raw':![],'where':{'id':_0x19e820[_0x317f('0x48')]['id']}},_0x449fb8={};_0x449fb8[_0x317f('0x3a')]=_[_0x317f('0x49')](db[_0x317f('0x30')][_0x317f('0x31')]);_0x449fb8[_0x317f('0x34')]=_[_0x317f('0x49')](_0x19e820[_0x317f('0x34')]);_0x449fb8[_0x317f('0x35')]=_['intersection'](_0x449fb8[_0x317f('0x3a')],_0x449fb8[_0x317f('0x34')]);_0x1dc8fd[_0x317f('0x37')]=_[_0x317f('0x36')](_0x449fb8['model'],qs[_0x317f('0x38')](_0x19e820[_0x317f('0x34')][_0x317f('0x38')]));_0x1dc8fd['attributes']=_0x1dc8fd['attributes'][_0x317f('0x39')]?_0x1dc8fd[_0x317f('0x37')]:_0x449fb8[_0x317f('0x3a')];if(_0x19e820[_0x317f('0x34')][_0x317f('0x43')]){_0x1dc8fd['include']=[{'all':!![]}];}_0x1dc8fd=_[_0x317f('0x41')]({},_0x1dc8fd,_0x19e820[_0x317f('0x4a')]);return db[_0x317f('0x30')]['find'](_0x1dc8fd)[_0x317f('0x2a')](handleEntityNotFound(_0x5e8e92,null))['then'](respondWithResult(_0x5e8e92,null))['catch'](handleError(_0x5e8e92,null));};exports[_0x317f('0x4b')]=function(_0x173195,_0x3e733a){return db[_0x317f('0x30')][_0x317f('0x4b')](_0x173195[_0x317f('0x4c')],{})['then'](respondWithResult(_0x3e733a,0xc9))[_0x317f('0x47')](handleError(_0x3e733a,null));};exports[_0x317f('0x29')]=function(_0x2bdde0,_0x10e539){if(_0x2bdde0[_0x317f('0x4c')]['id']){delete _0x2bdde0['body']['id'];}return db[_0x317f('0x30')][_0x317f('0x4d')]({'where':{'id':_0x2bdde0[_0x317f('0x48')]['id']}})[_0x317f('0x2a')](handleEntityNotFound(_0x10e539,null))[_0x317f('0x2a')](saveUpdates(_0x2bdde0[_0x317f('0x4c')],null))[_0x317f('0x2a')](respondWithResult(_0x10e539,null))[_0x317f('0x47')](handleError(_0x10e539,null));};exports['destroy']=function(_0x23a41d,_0x1173fe){return db[_0x317f('0x30')][_0x317f('0x4d')]({'where':{'id':_0x23a41d[_0x317f('0x48')]['id']}})[_0x317f('0x2a')](handleEntityNotFound(_0x1173fe,null))[_0x317f('0x2a')](removeEntity(_0x1173fe,null))['catch'](handleError(_0x1173fe,null));};exports[_0x317f('0x4e')]=function(_0x4e8251,_0x4153a6){return db[_0x317f('0x30')][_0x317f('0x4e')]()[_0x317f('0x2a')](respondWithResult(_0x4153a6,null))[_0x317f('0x47')](handleError(_0x4153a6,null));};exports[_0x317f('0x4f')]=function(_0x30a7fd,_0x502720){var _0x4f98b7={},_0x204dea={},_0x524797={'count':0x0,'rows':[]};_0x204dea[_0x317f('0x3a')]=_[_0x317f('0x49')](db['VoiceQueueReport'][_0x317f('0x31')]);_0x204dea[_0x317f('0x34')]=_[_0x317f('0x49')](_0x30a7fd['query']);_0x204dea[_0x317f('0x35')]=_['intersection'](_0x204dea['model'],_0x204dea[_0x317f('0x34')]);_0x4f98b7[_0x317f('0x37')]=_[_0x317f('0x36')](_0x204dea[_0x317f('0x3a')],qs['fields'](_0x30a7fd[_0x317f('0x34')][_0x317f('0x38')]));_0x4f98b7['attributes']=_0x4f98b7[_0x317f('0x37')][_0x317f('0x39')]?_0x4f98b7[_0x317f('0x37')]:_0x204dea['model'];if(!_0x30a7fd[_0x317f('0x34')][_0x317f('0x3b')](_0x317f('0x3c'))){_0x4f98b7[_0x317f('0x23')]=qs[_0x317f('0x23')](_0x30a7fd[_0x317f('0x34')]['limit']);_0x4f98b7[_0x317f('0x21')]=qs[_0x317f('0x21')](_0x30a7fd[_0x317f('0x34')][_0x317f('0x21')]);}_0x4f98b7[_0x317f('0x3d')]=qs['sort'](_0x30a7fd['query']['sort']);_0x4f98b7[_0x317f('0x40')]=qs[_0x317f('0x35')](_[_0x317f('0x50')](_0x30a7fd[_0x317f('0x34')],_0x204dea[_0x317f('0x35')]));if(_0x30a7fd[_0x317f('0x34')][_0x317f('0x3f')]){_0x4f98b7[_0x317f('0x40')]=_[_0x317f('0x41')](_0x4f98b7['where'],{'$or':_[_0x317f('0x2f')](_0x4f98b7[_0x317f('0x37')],function(_0x886fbf){var _0x10db4f={};_0x10db4f[_0x886fbf]={'$like':'%'+_0x30a7fd[_0x317f('0x34')][_0x317f('0x3f')]+'%'};return _0x10db4f;})});}_0x4f98b7=_[_0x317f('0x41')]({},_0x4f98b7,_0x30a7fd[_0x317f('0x4a')]);var _0x544b4c={'where':_0x4f98b7[_0x317f('0x40')]};return db[_0x317f('0x30')]['count'](_0x544b4c)[_0x317f('0x2a')](function(_0x4b96e4){_0x524797[_0x317f('0x42')]=_0x4b96e4;if(_0x30a7fd['query'][_0x317f('0x43')]){_0x4f98b7['include']=[{'all':!![]}];}return db['VoiceQueueReport'][_0x317f('0x45')](_0x4f98b7);})[_0x317f('0x2a')](function(_0x54ffa2){_0x524797[_0x317f('0x46')]=_0x54ffa2;return _0x524797;})[_0x317f('0x2a')](respondWithFilteredResult(_0x502720,_0x4f98b7,_0x317f('0x4f')))['catch'](handleError(_0x502720,null,_0x317f('0x4f')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index eb1474f..a4a6d5e 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 _0xcad2=['hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','update','remove'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xcad2,0xfe));var _0x2cad=function(_0x2040d4,_0x39fb5a){_0x2040d4=_0x2040d4-0x0;var _0x2a1c0c=_0xcad2[_0x2040d4];return _0x2a1c0c;};'use strict';var EventEmitter=require(_0x2cad('0x0'));var VoiceQueueReport=require(_0x2cad('0x1'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x2cad('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2cad('0x3'),'afterDestroy':_0x2cad('0x4')};function emitEvent(_0x465252){return function(_0x2e8978,_0x5a70ca,_0x3be963){VoiceQueueReportEvents['emit'](_0x465252+':'+_0x2e8978['id'],_0x2e8978);VoiceQueueReportEvents['emit'](_0x465252,_0x2e8978);_0x3be963(null);};}for(var e in events){if(events[_0x2cad('0x5')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0x2cad('0x6')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xdfb3=['update','remove','emit','hasOwnProperty','exports','events','VoiceQueueReport','setMaxListeners','save'];(function(_0x2ab494,_0x28e7ce){var _0x595363=function(_0x34667e){while(--_0x34667e){_0x2ab494['push'](_0x2ab494['shift']());}};_0x595363(++_0x28e7ce);}(_0xdfb3,0xd4));var _0x3dfb=function(_0x471592,_0x24cbda){_0x471592=_0x471592-0x0;var _0x59fc24=_0xdfb3[_0x471592];return _0x59fc24;};'use strict';var EventEmitter=require(_0x3dfb('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0x3dfb('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x3dfb('0x2')](0x0);var events={'afterCreate':_0x3dfb('0x3'),'afterUpdate':_0x3dfb('0x4'),'afterDestroy':_0x3dfb('0x5')};function emitEvent(_0x1065ea){return function(_0x63805d,_0x11bc98,_0x3b1ab3){VoiceQueueReportEvents[_0x3dfb('0x6')](_0x1065ea+':'+_0x63805d['id'],_0x63805d);VoiceQueueReportEvents[_0x3dfb('0x6')](_0x1065ea,_0x63805d);_0x3b1ab3(null);};}for(var e in events){if(events[_0x3dfb('0x7')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0x3dfb('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 f79b62c..7d0428f 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 _0x5582=['report_queue','calleridnum','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport'];(function(_0x187dbd,_0x2ecf58){var _0x45d1e9=function(_0x2364c0){while(--_0x2364c0){_0x187dbd['push'](_0x187dbd['shift']());}};_0x45d1e9(++_0x2ecf58);}(_0x5582,0x136));var _0x2558=function(_0xe532f2,_0x18dffb){_0xe532f2=_0xe532f2-0x0;var _0xdd0cc5=_0x5582[_0xe532f2];return _0xdd0cc5;};'use strict';var _=require(_0x2558('0x0'));var util=require(_0x2558('0x1'));var logger=require('../../config/logger')(_0x2558('0x2'));var moment=require(_0x2558('0x3'));var BPromise=require(_0x2558('0x4'));var rp=require(_0x2558('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2558('0x6'));var config=require(_0x2558('0x7'));var attributes=require(_0x2558('0x8'));module[_0x2558('0x9')]=function(_0x75f269,_0x520276){return _0x75f269[_0x2558('0xa')](_0x2558('0xb'),attributes,{'tableName':_0x2558('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0x2558('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc870=['uniqueid','lodash','api','moment','bluebird','request-promise','path','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue'];(function(_0x3a7e7d,_0x3355cd){var _0x12be69=function(_0x2e8446){while(--_0x2e8446){_0x3a7e7d['push'](_0x3a7e7d['shift']());}};_0x12be69(++_0x3355cd);}(_0xc870,0x16d));var _0x0c87=function(_0x76fd33,_0x129a6f){_0x76fd33=_0x76fd33-0x0;var _0x40704b=_0xc870[_0x76fd33];return _0x40704b;};'use strict';var _=require(_0x0c87('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0c87('0x1'));var moment=require(_0x0c87('0x2'));var BPromise=require(_0x0c87('0x3'));var rp=require(_0x0c87('0x4'));var fs=require('fs');var path=require(_0x0c87('0x5'));var rimraf=require('rimraf');var config=require(_0x0c87('0x6'));var attributes=require(_0x0c87('0x7'));module[_0x0c87('0x8')]=function(_0x3147d5,_0x394a56){return _0x3147d5[_0x0c87('0x9')](_0x0c87('0xa'),attributes,{'tableName':_0x0c87('0xb'),'paranoid':![],'indexes':[{'fields':[_0x0c87('0xc')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 3533446..b64b75b 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 _0x981e=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','result','catch','GetVoiceQueueReport','findAll','options','raw','where','attributes','limit','include','map','model','CreateVoiceQueueReport','create','UpdateVoiceQueueReport','VoiceQueueReport','body'];(function(_0x15913f,_0x1bfd7d){var _0x59d888=function(_0x670a2d){while(--_0x670a2d){_0x15913f['push'](_0x15913f['shift']());}};_0x59d888(++_0x1bfd7d);}(_0x981e,0x1b8));var _0xe981=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x981e[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xe981('0x0'));var util=require(_0xe981('0x1'));var moment=require(_0xe981('0x2'));var BPromise=require('bluebird');var rs=require(_0xe981('0x3'));var fs=require('fs');var Redis=require(_0xe981('0x4'));var db=require(_0xe981('0x5'))['db'];var utils=require(_0xe981('0x6'));var logger=require('../../config/logger')(_0xe981('0x7'));var config=require(_0xe981('0x8'));var jayson=require(_0xe981('0x9'));var client=jayson[_0xe981('0xa')]['http']({'port':0x232a});config[_0xe981('0xb')]=_[_0xe981('0xc')](config[_0xe981('0xb')],{'host':_0xe981('0xd'),'port':0x18eb});var socket=require(_0xe981('0xe'))(new Redis(config['redis']));require(_0xe981('0xf'))[_0xe981('0x10')](socket);function respondWithRpcPromise(_0x372627,_0x3174d4,_0x1b8f66){return new BPromise(function(_0x52ccf6,_0x9b2c37){return client[_0xe981('0x11')](_0x372627,_0x1b8f66)[_0xe981('0x12')](function(_0x267672){logger['info'](_0xe981('0x13'),_0x3174d4,'request\x20sent');logger[_0xe981('0x14')](_0xe981('0x15'),_0x3174d4,'request\x20sent',JSON[_0xe981('0x16')](_0x267672));if(_0x267672[_0xe981('0x17')]){if(_0x267672[_0xe981('0x17')]['code']===0x1f4){logger[_0xe981('0x17')](_0xe981('0x13'),_0x3174d4,_0x267672[_0xe981('0x17')][_0xe981('0x18')]);return _0x9b2c37(_0x267672['error'][_0xe981('0x18')]);}logger['error'](_0xe981('0x13'),_0x3174d4,_0x267672[_0xe981('0x17')]['message']);return _0x52ccf6(_0x267672[_0xe981('0x17')][_0xe981('0x18')]);}else{logger[_0xe981('0x19')](_0xe981('0x13'),_0x3174d4,_0xe981('0x1a'));_0x52ccf6(_0x267672[_0xe981('0x1b')]['message']);}})[_0xe981('0x1c')](function(_0x13f810){logger['error'](_0xe981('0x13'),_0x3174d4,_0x13f810);_0x9b2c37(_0x13f810);});});}exports[_0xe981('0x1d')]=function(_0x34b579){var _0x2cd6b5=this;return new Promise(function(_0x1d2671,_0x3e77df){return db['VoiceQueueReport'][_0xe981('0x1e')]({'raw':_0x34b579['options']?_0x34b579[_0xe981('0x1f')][_0xe981('0x20')]===undefined?!![]:![]:!![],'where':_0x34b579[_0xe981('0x1f')]?_0x34b579[_0xe981('0x1f')][_0xe981('0x21')]||null:null,'attributes':_0x34b579[_0xe981('0x1f')]?_0x34b579[_0xe981('0x1f')][_0xe981('0x22')]||null:null,'limit':_0x34b579[_0xe981('0x1f')]?_0x34b579[_0xe981('0x1f')][_0xe981('0x23')]||null:null,'include':_0x34b579[_0xe981('0x1f')]?_0x34b579[_0xe981('0x1f')][_0xe981('0x24')]?_[_0xe981('0x25')](_0x34b579[_0xe981('0x1f')][_0xe981('0x24')],function(_0x550fe1){return{'model':db[_0x550fe1[_0xe981('0x26')]],'as':_0x550fe1['as'],'attributes':_0x550fe1[_0xe981('0x22')],'include':_0x550fe1['include']?_[_0xe981('0x25')](_0x550fe1[_0xe981('0x24')],function(_0x42b06e){return{'model':db[_0x42b06e[_0xe981('0x26')]],'as':_0x42b06e['as'],'attributes':_0x42b06e[_0xe981('0x22')],'include':_0x42b06e['include']?_[_0xe981('0x25')](_0x42b06e[_0xe981('0x24')],function(_0x210eb7){return{'model':db[_0x210eb7[_0xe981('0x26')]],'as':_0x210eb7['as'],'attributes':_0x210eb7[_0xe981('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xcfb1e7){logger[_0xe981('0x19')](_0xe981('0x1d'),_0x34b579);logger[_0xe981('0x14')](_0xe981('0x1d'),_0x34b579,JSON[_0xe981('0x16')](_0xcfb1e7));_0x1d2671(_0xcfb1e7);})['catch'](function(_0x1e224d){logger[_0xe981('0x17')](_0xe981('0x1d'),_0x1e224d[_0xe981('0x18')],_0x34b579);_0x3e77df(_0x2cd6b5[_0xe981('0x17')](0x1f4,_0x1e224d[_0xe981('0x18')]));});});};exports[_0xe981('0x27')]=function(_0x178bdc){var _0x118151=this;return new Promise(function(_0x30a294,_0x79a809){return db['VoiceQueueReport'][_0xe981('0x28')](_0x178bdc['body'],{'raw':_0x178bdc[_0xe981('0x1f')]?_0x178bdc[_0xe981('0x1f')][_0xe981('0x20')]===undefined?!![]:![]:!![]})[_0xe981('0x12')](function(_0x479f84){logger[_0xe981('0x19')](_0xe981('0x27'),_0x178bdc);logger['debug'](_0xe981('0x27'),_0x178bdc,JSON[_0xe981('0x16')](_0x479f84));_0x30a294(_0x479f84);})[_0xe981('0x1c')](function(_0x5e423f){logger[_0xe981('0x17')](_0xe981('0x27'),_0x5e423f['message'],_0x178bdc);_0x79a809(_0x118151[_0xe981('0x17')](0x1f4,_0x5e423f[_0xe981('0x18')]));});});};exports[_0xe981('0x29')]=function(_0x28d15a){var _0x35bd62=this;return new Promise(function(_0x4365ca,_0x288a7a){return db[_0xe981('0x2a')]['update'](_0x28d15a[_0xe981('0x2b')],{'raw':_0x28d15a[_0xe981('0x1f')]?_0x28d15a[_0xe981('0x1f')][_0xe981('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28d15a[_0xe981('0x1f')]?_0x28d15a['options']['where']||null:null,'attributes':_0x28d15a[_0xe981('0x1f')]?_0x28d15a['options']['attributes']||null:null,'limit':_0x28d15a[_0xe981('0x1f')]?_0x28d15a['options']['limit']||null:null})['then'](function(_0x3106f8){logger[_0xe981('0x19')](_0xe981('0x29'),_0x28d15a);logger[_0xe981('0x14')](_0xe981('0x29'),_0x28d15a,JSON[_0xe981('0x16')](_0x3106f8));_0x4365ca(_0x3106f8);})[_0xe981('0x1c')](function(_0xe4ca17){logger[_0xe981('0x17')]('UpdateVoiceQueueReport',_0xe4ca17[_0xe981('0x18')],_0x28d15a);_0x288a7a(_0x35bd62[_0xe981('0x17')](0x1f4,_0xe4ca17[_0xe981('0x18')]));});});}; \ No newline at end of file +var _0xc3a4=['../../config/utils','rpc','client','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','VoiceQueueReport','findAll','options','raw','where','limit','include','map','model','attributes','GetVoiceQueueReport','CreateVoiceQueueReport','create','UpdateVoiceQueueReport','update','util','randomstring','../../mysqldb'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0xc3a4,0x12d));var _0x4c3a=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xc3a4[_0x42cae2];return _0x5f256f;};'use strict';var _=require('lodash');var util=require(_0x4c3a('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4c3a('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4c3a('0x2'))['db'];var utils=require(_0x4c3a('0x3'));var logger=require('../../config/logger')(_0x4c3a('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4c3a('0x5')]['http']({'port':0x232a});config[_0x4c3a('0x6')]=_['defaults'](config['redis'],{'host':_0x4c3a('0x7'),'port':0x18eb});var socket=require(_0x4c3a('0x8'))(new Redis(config[_0x4c3a('0x6')]));require(_0x4c3a('0x9'))[_0x4c3a('0xa')](socket);function respondWithRpcPromise(_0x4095ce,_0x4ec478,_0x5eba73){return new BPromise(function(_0x26f95c,_0x70f611){return client['request'](_0x4095ce,_0x5eba73)[_0x4c3a('0xb')](function(_0x3b7f3f){logger[_0x4c3a('0xc')](_0x4c3a('0xd'),_0x4ec478,_0x4c3a('0xe'));logger[_0x4c3a('0xf')](_0x4c3a('0x10'),_0x4ec478,_0x4c3a('0xe'),JSON[_0x4c3a('0x11')](_0x3b7f3f));if(_0x3b7f3f['error']){if(_0x3b7f3f['error'][_0x4c3a('0x12')]===0x1f4){logger[_0x4c3a('0x13')](_0x4c3a('0xd'),_0x4ec478,_0x3b7f3f[_0x4c3a('0x13')][_0x4c3a('0x14')]);return _0x70f611(_0x3b7f3f[_0x4c3a('0x13')][_0x4c3a('0x14')]);}logger[_0x4c3a('0x13')](_0x4c3a('0xd'),_0x4ec478,_0x3b7f3f[_0x4c3a('0x13')][_0x4c3a('0x14')]);return _0x26f95c(_0x3b7f3f['error'][_0x4c3a('0x14')]);}else{logger[_0x4c3a('0xc')](_0x4c3a('0xd'),_0x4ec478,_0x4c3a('0xe'));_0x26f95c(_0x3b7f3f[_0x4c3a('0x15')][_0x4c3a('0x14')]);}})[_0x4c3a('0x16')](function(_0x1f759e){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x4ec478,_0x1f759e);_0x70f611(_0x1f759e);});});}exports['GetVoiceQueueReport']=function(_0x49040f){var _0x3d98b9=this;return new Promise(function(_0x3b7d1d,_0x1ba3d3){return db[_0x4c3a('0x17')][_0x4c3a('0x18')]({'raw':_0x49040f[_0x4c3a('0x19')]?_0x49040f[_0x4c3a('0x19')][_0x4c3a('0x1a')]===undefined?!![]:![]:!![],'where':_0x49040f[_0x4c3a('0x19')]?_0x49040f['options'][_0x4c3a('0x1b')]||null:null,'attributes':_0x49040f[_0x4c3a('0x19')]?_0x49040f[_0x4c3a('0x19')]['attributes']||null:null,'limit':_0x49040f[_0x4c3a('0x19')]?_0x49040f[_0x4c3a('0x19')][_0x4c3a('0x1c')]||null:null,'include':_0x49040f['options']?_0x49040f[_0x4c3a('0x19')][_0x4c3a('0x1d')]?_[_0x4c3a('0x1e')](_0x49040f[_0x4c3a('0x19')][_0x4c3a('0x1d')],function(_0x5770a0){return{'model':db[_0x5770a0['model']],'as':_0x5770a0['as'],'attributes':_0x5770a0['attributes'],'include':_0x5770a0['include']?_[_0x4c3a('0x1e')](_0x5770a0[_0x4c3a('0x1d')],function(_0x180a81){return{'model':db[_0x180a81[_0x4c3a('0x1f')]],'as':_0x180a81['as'],'attributes':_0x180a81['attributes'],'include':_0x180a81['include']?_[_0x4c3a('0x1e')](_0x180a81['include'],function(_0x5d8669){return{'model':db[_0x5d8669[_0x4c3a('0x1f')]],'as':_0x5d8669['as'],'attributes':_0x5d8669[_0x4c3a('0x20')]};}):[]};}):[]};}):[]:[]})[_0x4c3a('0xb')](function(_0x15bf33){logger['info']('GetVoiceQueueReport',_0x49040f);logger['debug'](_0x4c3a('0x21'),_0x49040f,JSON[_0x4c3a('0x11')](_0x15bf33));_0x3b7d1d(_0x15bf33);})[_0x4c3a('0x16')](function(_0x498582){logger[_0x4c3a('0x13')](_0x4c3a('0x21'),_0x498582[_0x4c3a('0x14')],_0x49040f);_0x1ba3d3(_0x3d98b9[_0x4c3a('0x13')](0x1f4,_0x498582['message']));});});};exports[_0x4c3a('0x22')]=function(_0x39dbac){var _0x433c62=this;return new Promise(function(_0x189783,_0x284bb5){return db[_0x4c3a('0x17')][_0x4c3a('0x23')](_0x39dbac['body'],{'raw':_0x39dbac[_0x4c3a('0x19')]?_0x39dbac[_0x4c3a('0x19')][_0x4c3a('0x1a')]===undefined?!![]:![]:!![]})[_0x4c3a('0xb')](function(_0xbfd388){logger[_0x4c3a('0xc')]('CreateVoiceQueueReport',_0x39dbac);logger[_0x4c3a('0xf')](_0x4c3a('0x22'),_0x39dbac,JSON['stringify'](_0xbfd388));_0x189783(_0xbfd388);})[_0x4c3a('0x16')](function(_0x2fd809){logger[_0x4c3a('0x13')](_0x4c3a('0x22'),_0x2fd809[_0x4c3a('0x14')],_0x39dbac);_0x284bb5(_0x433c62[_0x4c3a('0x13')](0x1f4,_0x2fd809[_0x4c3a('0x14')]));});});};exports[_0x4c3a('0x24')]=function(_0x1dc3d2){var _0x56846c=this;return new Promise(function(_0x5e537e,_0x34a3c8){return db['VoiceQueueReport'][_0x4c3a('0x25')](_0x1dc3d2['body'],{'raw':_0x1dc3d2[_0x4c3a('0x19')]?_0x1dc3d2['options'][_0x4c3a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1dc3d2['options']?_0x1dc3d2[_0x4c3a('0x19')][_0x4c3a('0x1b')]||null:null,'attributes':_0x1dc3d2[_0x4c3a('0x19')]?_0x1dc3d2[_0x4c3a('0x19')][_0x4c3a('0x20')]||null:null,'limit':_0x1dc3d2['options']?_0x1dc3d2[_0x4c3a('0x19')]['limit']||null:null})[_0x4c3a('0xb')](function(_0xf997d5){logger['info'](_0x4c3a('0x24'),_0x1dc3d2);logger[_0x4c3a('0xf')](_0x4c3a('0x24'),_0x1dc3d2,JSON[_0x4c3a('0x11')](_0xf997d5));_0x5e537e(_0xf997d5);})[_0x4c3a('0x16')](function(_0x249089){logger[_0x4c3a('0x13')]('UpdateVoiceQueueReport',_0x249089[_0x4c3a('0x14')],_0x1dc3d2);_0x34a3c8(_0x56846c[_0x4c3a('0x13')](0x1f4,_0x249089[_0x4c3a('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index ca8be15..c517c97 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 _0x142c=['removeListener','length','./voiceQueueReport.events','remove','update','emit'];(function(_0x202d24,_0x5e8641){var _0x2b3a8e=function(_0x4c7c4a){while(--_0x4c7c4a){_0x202d24['push'](_0x202d24['shift']());}};_0x2b3a8e(++_0x5e8641);}(_0x142c,0x86));var _0xc142=function(_0x2f69cf,_0x4bce8d){_0x2f69cf=_0x2f69cf-0x0;var _0x5f472a=_0x142c[_0x2f69cf];return _0x5f472a;};'use strict';var VoiceQueueReportEvents=require(_0xc142('0x0'));var events=['save',_0xc142('0x1'),_0xc142('0x2')];function createListener(_0x10367,_0x4e9d02){return function(_0x30e881){_0x4e9d02[_0xc142('0x3')](_0x10367,_0x30e881);};}function removeListener(_0x4fa56e,_0x47e43a){return function(){VoiceQueueReportEvents[_0xc142('0x4')](_0x4fa56e,_0x47e43a);};}exports['register']=function(_0x4033e9){for(var _0x53b32f=0x0,_0x2d6796=events[_0xc142('0x5')];_0x53b32f<_0x2d6796;_0x53b32f++){var _0x30bf01=events[_0x53b32f];var _0x4ba28e=createListener('voiceQueueReport:'+_0x30bf01,_0x4033e9);VoiceQueueReportEvents['on'](_0x30bf01,_0x4ba28e);}}; \ No newline at end of file +var _0x5089=['length','voiceQueueReport:','./voiceQueueReport.events','save','update','emit','register'];(function(_0x22f3e9,_0x1a5c9a){var _0x379cbf=function(_0x322936){while(--_0x322936){_0x22f3e9['push'](_0x22f3e9['shift']());}};_0x379cbf(++_0x1a5c9a);}(_0x5089,0x1bb));var _0x9508=function(_0xc69fda,_0x367f93){_0xc69fda=_0xc69fda-0x0;var _0x721842=_0x5089[_0xc69fda];return _0x721842;};'use strict';var VoiceQueueReportEvents=require(_0x9508('0x0'));var events=[_0x9508('0x1'),'remove',_0x9508('0x2')];function createListener(_0x35878a,_0x7dd13d){return function(_0x100d7e){_0x7dd13d[_0x9508('0x3')](_0x35878a,_0x100d7e);};}function removeListener(_0x59d3ee,_0x86540d){return function(){VoiceQueueReportEvents['removeListener'](_0x59d3ee,_0x86540d);};}exports[_0x9508('0x4')]=function(_0x4538dd){for(var _0x257318=0x0,_0x4ab3c6=events[_0x9508('0x5')];_0x257318<_0x4ab3c6;_0x257318++){var _0x42d13a=events[_0x257318];var _0x55a5de=createListener(_0x9508('0x6')+_0x42d13a,_0x4538dd);VoiceQueueReportEvents['on'](_0x42d13a,_0x55a5de);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index b129415..463ba99 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 _0x1e88=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','/:id','show','post','create','put','delete','destroy','multer'];(function(_0x1ae5ab,_0xc5d441){var _0x1ce001=function(_0x5ef96d){while(--_0x5ef96d){_0x1ae5ab['push'](_0x1ae5ab['shift']());}};_0x1ce001(++_0xc5d441);}(_0x1e88,0x1d3));var _0x81e8=function(_0x22f88c,_0x5b4524){_0x22f88c=_0x22f88c-0x0;var _0xbe2586=_0x1e88[_0x22f88c];return _0xbe2586;};'use strict';var multer=require(_0x81e8('0x0'));var util=require(_0x81e8('0x1'));var path=require(_0x81e8('0x2'));var timeout=require(_0x81e8('0x3'));var express=require(_0x81e8('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x81e8('0x5'));var interaction=require(_0x81e8('0x6'));var config=require(_0x81e8('0x7'));var controller=require(_0x81e8('0x8'));router[_0x81e8('0x9')]('/',auth[_0x81e8('0xa')](),controller['index']);router[_0x81e8('0x9')](_0x81e8('0xb'),auth[_0x81e8('0xa')](),controller[_0x81e8('0xc')]);router[_0x81e8('0xd')]('/',auth[_0x81e8('0xa')](),controller[_0x81e8('0xe')]);router[_0x81e8('0xf')](_0x81e8('0xb'),auth[_0x81e8('0xa')](),controller['update']);router[_0x81e8('0x10')](_0x81e8('0xb'),auth['isAuthenticated'](),controller[_0x81e8('0x11')]);module['exports']=router; \ No newline at end of file +var _0x567b=['put','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0xe6b727,_0x17d037){var _0x3b78cb=function(_0x1ae55e){while(--_0x1ae55e){_0xe6b727['push'](_0xe6b727['shift']());}};_0x3b78cb(++_0x17d037);}(_0x567b,0x6e));var _0xb567=function(_0x537d30,_0x7760db){_0x537d30=_0x537d30-0x0;var _0x32deca=_0x567b[_0x537d30];return _0x32deca;};'use strict';var multer=require(_0xb567('0x0'));var util=require('util');var path=require(_0xb567('0x1'));var timeout=require(_0xb567('0x2'));var express=require(_0xb567('0x3'));var router=express[_0xb567('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb567('0x5'));var interaction=require(_0xb567('0x6'));var config=require(_0xb567('0x7'));var controller=require(_0xb567('0x8'));router[_0xb567('0x9')]('/',auth[_0xb567('0xa')](),controller[_0xb567('0xb')]);router['get'](_0xb567('0xc'),auth[_0xb567('0xa')](),controller[_0xb567('0xd')]);router[_0xb567('0xe')]('/',auth[_0xb567('0xa')](),controller[_0xb567('0xf')]);router[_0xb567('0x10')]('/:id',auth[_0xb567('0xa')](),controller['update']);router['delete']('/:id',auth[_0xb567('0xa')](),controller[_0xb567('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 3857d9a..f363530 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 _0x6ced=['STRING','YYYY-MM-DD\x20HH:mm:ss','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6ced,0x116));var _0xd6ce=function(_0x4bce64,_0x58b704){_0x4bce64=_0x4bce64-0x0;var _0x57bc4b=_0x6ced[_0x4bce64];return _0x57bc4b;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0xd6ce('0x0')]={'time':{'type':Sequelize[_0xd6ce('0x1')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xd6ce('0x1')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xd6ce('0x1')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xd6ce('0x1')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xd6ce('0x1')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xd6ce('0x1')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()['format'](_0xd6ce('0x2'))}}; \ No newline at end of file +var _0x865b=['format','YYYY-MM-DD\x20HH:mm:ss','moment','exports','STRING'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x865b,0x165));var _0xb865=function(_0x27da43,_0x12984a){_0x27da43=_0x27da43-0x0;var _0x357d34=_0x865b[_0x27da43];return _0x357d34;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xb865('0x0'));module[_0xb865('0x1')]={'time':{'type':Sequelize[_0xb865('0x2')]},'callid':{'type':Sequelize[_0xb865('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xb865('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xb865('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xb865('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xb865('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xb865('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xb865('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xb865('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xb865('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()[_0xb865('0x3')](_0xb865('0x4'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 2242150..6b02624 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 _0xa4d4=['reject','save','update','destroy','then','error','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','options','create','body','find','params','rimraf','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','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa4d4,0x164));var _0x4a4d=function(_0x9ec2d5,_0x44b498){_0x9ec2d5=_0x9ec2d5-0x0;var _0x2ad8f9=_0xa4d4[_0x9ec2d5];return _0x2ad8f9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4a4d('0x0'));var zipdir=require(_0x4a4d('0x1'));var jsonpatch=require(_0x4a4d('0x2'));var rp=require(_0x4a4d('0x3'));var moment=require(_0x4a4d('0x4'));var BPromise=require(_0x4a4d('0x5'));var Mustache=require(_0x4a4d('0x6'));var util=require(_0x4a4d('0x7'));var path=require(_0x4a4d('0x8'));var sox=require(_0x4a4d('0x9'));var csv=require(_0x4a4d('0xa'));var ejs=require(_0x4a4d('0xb'));var fs=require('fs');var fs_extra=require(_0x4a4d('0xc'));var _=require('lodash');var squel=require(_0x4a4d('0xd'));var crypto=require('crypto');var jsforce=require(_0x4a4d('0xe'));var deskjs=require(_0x4a4d('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4a4d('0x10'));var Papa=require(_0x4a4d('0x11'));var Redis=require(_0x4a4d('0x12'));var authService=require(_0x4a4d('0x13'));var qs=require(_0x4a4d('0x14'));var as=require(_0x4a4d('0x15'));var hardwareService=require(_0x4a4d('0x16'));var logger=require(_0x4a4d('0x17'))(_0x4a4d('0x18'));var utils=require(_0x4a4d('0x19'));var config=require(_0x4a4d('0x1a'));var licenseUtil=require(_0x4a4d('0x1b'));var db=require(_0x4a4d('0x1c'))['db'];function respondWithStatusCode(_0x4fcd99,_0x5b00eb){_0x5b00eb=_0x5b00eb||0xcc;return function(_0x464c1b){if(_0x464c1b){return _0x4fcd99[_0x4a4d('0x1d')](_0x5b00eb);}return _0x4fcd99[_0x4a4d('0x1e')](_0x5b00eb)[_0x4a4d('0x1f')]();};}function respondWithResult(_0x4397a5,_0x13f231){_0x13f231=_0x13f231||0xc8;return function(_0x390288){if(_0x390288){return _0x4397a5[_0x4a4d('0x1e')](_0x13f231)[_0x4a4d('0x20')](_0x390288);}};}function respondWithFilteredResult(_0x9104b3,_0x2b1379){return function(_0x4934d0){if(_0x4934d0){var _0x253ffc=typeof _0x2b1379['offset']===_0x4a4d('0x21')&&typeof _0x2b1379[_0x4a4d('0x22')]===_0x4a4d('0x21');var _0x311a89=_0x4934d0[_0x4a4d('0x23')];var _0x409ad0=_0x253ffc?0x0:_0x2b1379[_0x4a4d('0x24')];var _0x52dd1b=_0x253ffc?_0x4934d0['count']:_0x2b1379[_0x4a4d('0x24')]+_0x2b1379['limit'];var _0x29eb6b;if(_0x52dd1b>=_0x311a89){_0x52dd1b=_0x311a89;_0x29eb6b=0xc8;}else{_0x29eb6b=0xce;}_0x9104b3['status'](_0x29eb6b);return _0x9104b3[_0x4a4d('0x25')]('Content-Range',_0x409ad0+'-'+_0x52dd1b+'/'+_0x311a89)['json'](_0x4934d0);}return null;};}function patchUpdates(_0xea64e3){return function(_0x28ec0c){try{jsonpatch[_0x4a4d('0x26')](_0x28ec0c,_0xea64e3,!![]);}catch(_0x104e0c){return BPromise[_0x4a4d('0x27')](_0x104e0c);}return _0x28ec0c[_0x4a4d('0x28')]();};}function saveUpdates(_0x117f53,_0x26e974){return function(_0x27b570){if(_0x27b570){return _0x27b570[_0x4a4d('0x29')](_0x117f53)['then'](function(_0x59cdf1){return _0x59cdf1;});}return null;};}function removeEntity(_0x4411d6,_0x439579){return function(_0x2e8c3d){if(_0x2e8c3d){return _0x2e8c3d[_0x4a4d('0x2a')]()[_0x4a4d('0x2b')](function(){_0x4411d6['status'](0xcc)[_0x4a4d('0x1f')]();});}};}function handleEntityNotFound(_0x39646c,_0x2aaebf){return function(_0x4e40f6){if(!_0x4e40f6){_0x39646c[_0x4a4d('0x1d')](0x194);}return _0x4e40f6;};}function handleError(_0x427753,_0x242d7e){_0x242d7e=_0x242d7e||0x1f4;return function(_0x24ffeb){logger[_0x4a4d('0x2c')](_0x24ffeb[_0x4a4d('0x2d')]);if(_0x24ffeb[_0x4a4d('0x2e')]){delete _0x24ffeb['name'];}_0x427753[_0x4a4d('0x1e')](_0x242d7e)[_0x4a4d('0x2f')](_0x24ffeb);};}exports[_0x4a4d('0x30')]=function(_0x5c0061,_0x2a2aaf){var _0x3a64ee={},_0x18a9bc={},_0x49b8ab={'count':0x0,'rows':[]};var _0x49cbac=_[_0x4a4d('0x31')](db[_0x4a4d('0x32')][_0x4a4d('0x33')],function(_0xff69b4){return{'name':_0xff69b4[_0x4a4d('0x34')],'type':_0xff69b4[_0x4a4d('0x35')]['key']};});_0x18a9bc['model']=_[_0x4a4d('0x31')](_0x49cbac,_0x4a4d('0x2e'));_0x18a9bc[_0x4a4d('0x36')]=_[_0x4a4d('0x37')](_0x5c0061[_0x4a4d('0x36')]);_0x18a9bc[_0x4a4d('0x38')]=_[_0x4a4d('0x39')](_0x18a9bc[_0x4a4d('0x3a')],_0x18a9bc['query']);_0x3a64ee[_0x4a4d('0x3b')]=_['intersection'](_0x18a9bc[_0x4a4d('0x3a')],qs[_0x4a4d('0x3c')](_0x5c0061[_0x4a4d('0x36')][_0x4a4d('0x3c')]));_0x3a64ee[_0x4a4d('0x3b')]=_0x3a64ee[_0x4a4d('0x3b')][_0x4a4d('0x3d')]?_0x3a64ee[_0x4a4d('0x3b')]:_0x18a9bc['model'];if(!_0x5c0061[_0x4a4d('0x36')][_0x4a4d('0x3e')](_0x4a4d('0x3f'))){_0x3a64ee[_0x4a4d('0x22')]=qs['limit'](_0x5c0061[_0x4a4d('0x36')][_0x4a4d('0x22')]);_0x3a64ee[_0x4a4d('0x24')]=qs[_0x4a4d('0x24')](_0x5c0061[_0x4a4d('0x36')]['offset']);}_0x3a64ee['order']=qs[_0x4a4d('0x40')](_0x5c0061[_0x4a4d('0x36')][_0x4a4d('0x40')]);_0x3a64ee[_0x4a4d('0x41')]=qs[_0x4a4d('0x38')](_['pick'](_0x5c0061['query'],_0x18a9bc[_0x4a4d('0x38')]),_0x49cbac);if(_0x5c0061[_0x4a4d('0x36')][_0x4a4d('0x42')]){_0x3a64ee['where']=_[_0x4a4d('0x43')](_0x3a64ee['where'],{'$or':_['map'](_0x49cbac,function(_0x3c0975){if(_0x3c0975[_0x4a4d('0x35')]!==_0x4a4d('0x44')){var _0x2d421b={};_0x2d421b[_0x3c0975['name']]={'$like':'%'+_0x5c0061[_0x4a4d('0x36')][_0x4a4d('0x42')]+'%'};return _0x2d421b;}})});}_0x3a64ee=_[_0x4a4d('0x43')]({},_0x3a64ee,_0x5c0061['options']);var _0x98d0de={'where':_0x3a64ee[_0x4a4d('0x41')]};return db['VoiceQueuesLog']['count'](_0x98d0de)[_0x4a4d('0x2b')](function(_0x1f2e9b){_0x49b8ab['count']=_0x1f2e9b;if(_0x5c0061[_0x4a4d('0x36')][_0x4a4d('0x45')]){_0x3a64ee['include']=[{'all':!![]}];}return db[_0x4a4d('0x32')][_0x4a4d('0x46')](_0x3a64ee);})[_0x4a4d('0x2b')](function(_0x371fb7){_0x49b8ab[_0x4a4d('0x47')]=_0x371fb7;return _0x49b8ab;})['then'](respondWithFilteredResult(_0x2a2aaf,_0x3a64ee))[_0x4a4d('0x48')](handleError(_0x2a2aaf,null));};exports[_0x4a4d('0x49')]=function(_0x3ced23,_0x3d3c4b){var _0x5afbc9={'raw':!![],'where':{'id':_0x3ced23['params']['id']}},_0x5f2670={};_0x5f2670['model']=_[_0x4a4d('0x37')](db['VoiceQueuesLog']['rawAttributes']);_0x5f2670['query']=_[_0x4a4d('0x37')](_0x3ced23[_0x4a4d('0x36')]);_0x5f2670['filters']=_[_0x4a4d('0x39')](_0x5f2670['model'],_0x5f2670[_0x4a4d('0x36')]);_0x5afbc9[_0x4a4d('0x3b')]=_[_0x4a4d('0x39')](_0x5f2670['model'],qs[_0x4a4d('0x3c')](_0x3ced23[_0x4a4d('0x36')][_0x4a4d('0x3c')]));_0x5afbc9[_0x4a4d('0x3b')]=_0x5afbc9[_0x4a4d('0x3b')][_0x4a4d('0x3d')]?_0x5afbc9[_0x4a4d('0x3b')]:_0x5f2670[_0x4a4d('0x3a')];if(_0x3ced23[_0x4a4d('0x36')]['includeAll']){_0x5afbc9['include']=[{'all':!![]}];}_0x5afbc9=_[_0x4a4d('0x43')]({},_0x5afbc9,_0x3ced23[_0x4a4d('0x4a')]);return db[_0x4a4d('0x32')]['find'](_0x5afbc9)['then'](handleEntityNotFound(_0x3d3c4b,null))[_0x4a4d('0x2b')](respondWithResult(_0x3d3c4b,null))['catch'](handleError(_0x3d3c4b,null));};exports[_0x4a4d('0x4b')]=function(_0xcb5620,_0xb8bb69){return db['VoiceQueuesLog'][_0x4a4d('0x4b')](_0xcb5620[_0x4a4d('0x4c')],{})[_0x4a4d('0x2b')](respondWithResult(_0xb8bb69,0xc9))[_0x4a4d('0x48')](handleError(_0xb8bb69,null));};exports[_0x4a4d('0x29')]=function(_0x5914ac,_0x8e1d93){if(_0x5914ac[_0x4a4d('0x4c')]['id']){delete _0x5914ac[_0x4a4d('0x4c')]['id'];}return db[_0x4a4d('0x32')][_0x4a4d('0x4d')]({'where':{'id':_0x5914ac[_0x4a4d('0x4e')]['id']}})[_0x4a4d('0x2b')](handleEntityNotFound(_0x8e1d93,null))[_0x4a4d('0x2b')](saveUpdates(_0x5914ac[_0x4a4d('0x4c')],null))[_0x4a4d('0x2b')](respondWithResult(_0x8e1d93,null))['catch'](handleError(_0x8e1d93,null));};exports[_0x4a4d('0x2a')]=function(_0x285bc2,_0x2c8b95){return db[_0x4a4d('0x32')]['find']({'where':{'id':_0x285bc2[_0x4a4d('0x4e')]['id']}})[_0x4a4d('0x2b')](handleEntityNotFound(_0x2c8b95,null))[_0x4a4d('0x2b')](removeEntity(_0x2c8b95,null))[_0x4a4d('0x48')](handleError(_0x2c8b95,null));}; \ No newline at end of file +var _0x2fee=['offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','length','find','create','body','update','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json'];(function(_0x21f6a1,_0x2e1094){var _0x116e47=function(_0x5ce7f0){while(--_0x5ce7f0){_0x21f6a1['push'](_0x21f6a1['shift']());}};_0x116e47(++_0x2e1094);}(_0x2fee,0x153));var _0xe2fe=function(_0x4863bc,_0x26dd88){_0x4863bc=_0x4863bc-0x0;var _0xa20d45=_0x2fee[_0x4863bc];return _0xa20d45;};'use strict';var emlformat=require(_0xe2fe('0x0'));var rimraf=require(_0xe2fe('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe2fe('0x2'));var rp=require(_0xe2fe('0x3'));var moment=require('moment');var BPromise=require(_0xe2fe('0x4'));var Mustache=require(_0xe2fe('0x5'));var util=require(_0xe2fe('0x6'));var path=require('path');var sox=require(_0xe2fe('0x7'));var csv=require('to-csv');var ejs=require(_0xe2fe('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe2fe('0x9'));var squel=require(_0xe2fe('0xa'));var crypto=require(_0xe2fe('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xe2fe('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe2fe('0xd'));var Papa=require(_0xe2fe('0xe'));var Redis=require('ioredis');var authService=require(_0xe2fe('0xf'));var qs=require(_0xe2fe('0x10'));var as=require(_0xe2fe('0x11'));var hardwareService=require(_0xe2fe('0x12'));var logger=require(_0xe2fe('0x13'))(_0xe2fe('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe2fe('0x15'));var db=require(_0xe2fe('0x16'))['db'];function respondWithStatusCode(_0x59ba70,_0x168d29){_0x168d29=_0x168d29||0xcc;return function(_0x2a5ea7){if(_0x2a5ea7){return _0x59ba70[_0xe2fe('0x17')](_0x168d29);}return _0x59ba70[_0xe2fe('0x18')](_0x168d29)['end']();};}function respondWithResult(_0x3c976d,_0xa8fa0e){_0xa8fa0e=_0xa8fa0e||0xc8;return function(_0x4ad196){if(_0x4ad196){return _0x3c976d[_0xe2fe('0x18')](_0xa8fa0e)[_0xe2fe('0x19')](_0x4ad196);}};}function respondWithFilteredResult(_0x26e900,_0x1db005){return function(_0x46cf04){if(_0x46cf04){var _0x7473dc=typeof _0x1db005[_0xe2fe('0x1a')]===_0xe2fe('0x1b')&&typeof _0x1db005[_0xe2fe('0x1c')]==='undefined';var _0x40d5e8=_0x46cf04[_0xe2fe('0x1d')];var _0x94d036=_0x7473dc?0x0:_0x1db005[_0xe2fe('0x1a')];var _0x1004c0=_0x7473dc?_0x46cf04[_0xe2fe('0x1d')]:_0x1db005[_0xe2fe('0x1a')]+_0x1db005[_0xe2fe('0x1c')];var _0xd1be00;if(_0x1004c0>=_0x40d5e8){_0x1004c0=_0x40d5e8;_0xd1be00=0xc8;}else{_0xd1be00=0xce;}_0x26e900[_0xe2fe('0x18')](_0xd1be00);return _0x26e900[_0xe2fe('0x1e')](_0xe2fe('0x1f'),_0x94d036+'-'+_0x1004c0+'/'+_0x40d5e8)[_0xe2fe('0x19')](_0x46cf04);}return null;};}function patchUpdates(_0x42e31b){return function(_0x1f04a1){try{jsonpatch[_0xe2fe('0x20')](_0x1f04a1,_0x42e31b,!![]);}catch(_0x28e8ff){return BPromise[_0xe2fe('0x21')](_0x28e8ff);}return _0x1f04a1[_0xe2fe('0x22')]();};}function saveUpdates(_0x37b076,_0x1ee21c){return function(_0x36be71){if(_0x36be71){return _0x36be71['update'](_0x37b076)[_0xe2fe('0x23')](function(_0x2a5280){return _0x2a5280;});}return null;};}function removeEntity(_0x5ca133,_0x5bf571){return function(_0x263a5a){if(_0x263a5a){return _0x263a5a[_0xe2fe('0x24')]()['then'](function(){_0x5ca133['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x559e5c,_0x1fbca7){return function(_0x3db092){if(!_0x3db092){_0x559e5c[_0xe2fe('0x17')](0x194);}return _0x3db092;};}function handleError(_0x276403,_0x16b681){_0x16b681=_0x16b681||0x1f4;return function(_0x2639d8){logger['error'](_0x2639d8[_0xe2fe('0x25')]);if(_0x2639d8[_0xe2fe('0x26')]){delete _0x2639d8[_0xe2fe('0x26')];}_0x276403[_0xe2fe('0x18')](_0x16b681)[_0xe2fe('0x27')](_0x2639d8);};}exports[_0xe2fe('0x28')]=function(_0x5d99de,_0x2ff03a){var _0x1eb15e={},_0x34cf35={},_0x2675ee={'count':0x0,'rows':[]};var _0x19312b=_[_0xe2fe('0x29')](db[_0xe2fe('0x2a')][_0xe2fe('0x2b')],function(_0x15db30){return{'name':_0x15db30[_0xe2fe('0x2c')],'type':_0x15db30[_0xe2fe('0x2d')][_0xe2fe('0x2e')]};});_0x34cf35['model']=_[_0xe2fe('0x29')](_0x19312b,_0xe2fe('0x26'));_0x34cf35[_0xe2fe('0x2f')]=_[_0xe2fe('0x30')](_0x5d99de[_0xe2fe('0x2f')]);_0x34cf35[_0xe2fe('0x31')]=_[_0xe2fe('0x32')](_0x34cf35['model'],_0x34cf35[_0xe2fe('0x2f')]);_0x1eb15e[_0xe2fe('0x33')]=_[_0xe2fe('0x32')](_0x34cf35[_0xe2fe('0x34')],qs[_0xe2fe('0x35')](_0x5d99de[_0xe2fe('0x2f')][_0xe2fe('0x35')]));_0x1eb15e[_0xe2fe('0x33')]=_0x1eb15e[_0xe2fe('0x33')]['length']?_0x1eb15e[_0xe2fe('0x33')]:_0x34cf35[_0xe2fe('0x34')];if(!_0x5d99de[_0xe2fe('0x2f')][_0xe2fe('0x36')]('nolimit')){_0x1eb15e[_0xe2fe('0x1c')]=qs[_0xe2fe('0x1c')](_0x5d99de[_0xe2fe('0x2f')]['limit']);_0x1eb15e['offset']=qs[_0xe2fe('0x1a')](_0x5d99de[_0xe2fe('0x2f')][_0xe2fe('0x1a')]);}_0x1eb15e[_0xe2fe('0x37')]=qs[_0xe2fe('0x38')](_0x5d99de['query'][_0xe2fe('0x38')]);_0x1eb15e[_0xe2fe('0x39')]=qs[_0xe2fe('0x31')](_[_0xe2fe('0x3a')](_0x5d99de[_0xe2fe('0x2f')],_0x34cf35[_0xe2fe('0x31')]),_0x19312b);if(_0x5d99de[_0xe2fe('0x2f')][_0xe2fe('0x3b')]){_0x1eb15e['where']=_[_0xe2fe('0x3c')](_0x1eb15e[_0xe2fe('0x39')],{'$or':_[_0xe2fe('0x29')](_0x19312b,function(_0x3ad189){if(_0x3ad189[_0xe2fe('0x2d')]!==_0xe2fe('0x3d')){var _0x170ad1={};_0x170ad1[_0x3ad189['name']]={'$like':'%'+_0x5d99de[_0xe2fe('0x2f')][_0xe2fe('0x3b')]+'%'};return _0x170ad1;}})});}_0x1eb15e=_[_0xe2fe('0x3c')]({},_0x1eb15e,_0x5d99de['options']);var _0x3f9f18={'where':_0x1eb15e[_0xe2fe('0x39')]};return db['VoiceQueuesLog'][_0xe2fe('0x1d')](_0x3f9f18)['then'](function(_0x13e6d3){_0x2675ee['count']=_0x13e6d3;if(_0x5d99de[_0xe2fe('0x2f')][_0xe2fe('0x3e')]){_0x1eb15e[_0xe2fe('0x3f')]=[{'all':!![]}];}return db[_0xe2fe('0x2a')][_0xe2fe('0x40')](_0x1eb15e);})[_0xe2fe('0x23')](function(_0x5ecacf){_0x2675ee['rows']=_0x5ecacf;return _0x2675ee;})[_0xe2fe('0x23')](respondWithFilteredResult(_0x2ff03a,_0x1eb15e))[_0xe2fe('0x41')](handleError(_0x2ff03a,null));};exports[_0xe2fe('0x42')]=function(_0x3e4112,_0x65246a){var _0x2bf0c7={'raw':!![],'where':{'id':_0x3e4112[_0xe2fe('0x43')]['id']}},_0x47efbb={};_0x47efbb[_0xe2fe('0x34')]=_['keys'](db[_0xe2fe('0x2a')][_0xe2fe('0x2b')]);_0x47efbb['query']=_['keys'](_0x3e4112[_0xe2fe('0x2f')]);_0x47efbb[_0xe2fe('0x31')]=_[_0xe2fe('0x32')](_0x47efbb['model'],_0x47efbb[_0xe2fe('0x2f')]);_0x2bf0c7['attributes']=_[_0xe2fe('0x32')](_0x47efbb[_0xe2fe('0x34')],qs['fields'](_0x3e4112[_0xe2fe('0x2f')]['fields']));_0x2bf0c7[_0xe2fe('0x33')]=_0x2bf0c7[_0xe2fe('0x33')][_0xe2fe('0x44')]?_0x2bf0c7[_0xe2fe('0x33')]:_0x47efbb[_0xe2fe('0x34')];if(_0x3e4112[_0xe2fe('0x2f')][_0xe2fe('0x3e')]){_0x2bf0c7[_0xe2fe('0x3f')]=[{'all':!![]}];}_0x2bf0c7=_[_0xe2fe('0x3c')]({},_0x2bf0c7,_0x3e4112['options']);return db['VoiceQueuesLog'][_0xe2fe('0x45')](_0x2bf0c7)[_0xe2fe('0x23')](handleEntityNotFound(_0x65246a,null))[_0xe2fe('0x23')](respondWithResult(_0x65246a,null))[_0xe2fe('0x41')](handleError(_0x65246a,null));};exports['create']=function(_0x1d4293,_0x5d1c07){return db[_0xe2fe('0x2a')][_0xe2fe('0x46')](_0x1d4293[_0xe2fe('0x47')],{})[_0xe2fe('0x23')](respondWithResult(_0x5d1c07,0xc9))[_0xe2fe('0x41')](handleError(_0x5d1c07,null));};exports[_0xe2fe('0x48')]=function(_0x57f534,_0x13738a){if(_0x57f534[_0xe2fe('0x47')]['id']){delete _0x57f534[_0xe2fe('0x47')]['id'];}return db[_0xe2fe('0x2a')]['find']({'where':{'id':_0x57f534[_0xe2fe('0x43')]['id']}})[_0xe2fe('0x23')](handleEntityNotFound(_0x13738a,null))[_0xe2fe('0x23')](saveUpdates(_0x57f534[_0xe2fe('0x47')],null))[_0xe2fe('0x23')](respondWithResult(_0x13738a,null))[_0xe2fe('0x41')](handleError(_0x13738a,null));};exports[_0xe2fe('0x24')]=function(_0x42c7f1,_0x118c10){return db[_0xe2fe('0x2a')]['find']({'where':{'id':_0x42c7f1[_0xe2fe('0x43')]['id']}})['then'](handleEntityNotFound(_0x118c10,null))[_0xe2fe('0x23')](removeEntity(_0x118c10,null))[_0xe2fe('0x41')](handleError(_0x118c10,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 066ee09..02f85ea 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 _0xb634=['lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','voice_queues_log','event','dtm'];(function(_0xb7b722,_0xe95ba7){var _0x217177=function(_0x463ab4){while(--_0x463ab4){_0xb7b722['push'](_0xb7b722['shift']());}};_0x217177(++_0xe95ba7);}(_0xb634,0x1c0));var _0x4b63=function(_0xf6f731,_0x5b870f){_0xf6f731=_0xf6f731-0x0;var _0x132490=_0xb634[_0xf6f731];return _0x132490;};'use strict';var _=require(_0x4b63('0x0'));var util=require('util');var logger=require(_0x4b63('0x1'))(_0x4b63('0x2'));var moment=require(_0x4b63('0x3'));var BPromise=require('bluebird');var rp=require(_0x4b63('0x4'));var fs=require('fs');var path=require(_0x4b63('0x5'));var rimraf=require(_0x4b63('0x6'));var config=require(_0x4b63('0x7'));var attributes=require(_0x4b63('0x8'));module[_0x4b63('0x9')]=function(_0x47abe1,_0x57fba1){return _0x47abe1[_0x4b63('0xa')]('VoiceQueuesLog',attributes,{'tableName':_0x4b63('0xb'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x4b63('0xc'),_0x4b63('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0x8ec3=['exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x8ec3,0x19c));var _0x38ec=function(_0x1ece6b,_0xaaa3ca){_0x1ece6b=_0x1ece6b-0x0;var _0x44d7c5=_0x8ec3[_0x1ece6b];return _0x44d7c5;};'use strict';var _=require(_0x38ec('0x0'));var util=require('util');var logger=require(_0x38ec('0x1'))(_0x38ec('0x2'));var moment=require(_0x38ec('0x3'));var BPromise=require(_0x38ec('0x4'));var rp=require(_0x38ec('0x5'));var fs=require('fs');var path=require(_0x38ec('0x6'));var rimraf=require('rimraf');var config=require(_0x38ec('0x7'));var attributes=require('./voiceQueuesLog.attributes');module[_0x38ec('0x8')]=function(_0x3cff07,_0x314dc2){return _0x3cff07[_0x38ec('0x9')](_0x38ec('0xa'),attributes,{'tableName':_0x38ec('0xb'),'paranoid':![],'indexes':[{'name':_0x38ec('0xc'),'fields':[_0x38ec('0xd'),_0x38ec('0xe')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index c2f375b..246a3dd 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 _0xb910=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','lodash'];(function(_0x2cc409,_0x5199ec){var _0xdfe8a2=function(_0x3d7e72){while(--_0x3d7e72){_0x2cc409['push'](_0x2cc409['shift']());}};_0xdfe8a2(++_0x5199ec);}(_0xb910,0x12b));var _0x0b91=function(_0x369151,_0x179f72){_0x369151=_0x369151-0x0;var _0x4292d5=_0xb910[_0x369151];return _0x4292d5;};'use strict';var _=require(_0x0b91('0x0'));var util=require(_0x0b91('0x1'));var moment=require(_0x0b91('0x2'));var BPromise=require(_0x0b91('0x3'));var rs=require(_0x0b91('0x4'));var fs=require('fs');var Redis=require(_0x0b91('0x5'));var db=require(_0x0b91('0x6'))['db'];var utils=require(_0x0b91('0x7'));var logger=require(_0x0b91('0x8'))(_0x0b91('0x9'));var config=require(_0x0b91('0xa'));var jayson=require(_0x0b91('0xb'));var client=jayson[_0x0b91('0xc')][_0x0b91('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5a22b6,_0x156fd1,_0xc65d86){return new BPromise(function(_0x3e8800,_0x41cc32){return client[_0x0b91('0xe')](_0x5a22b6,_0xc65d86)[_0x0b91('0xf')](function(_0x4118b8){logger[_0x0b91('0x10')](_0x0b91('0x11'),_0x156fd1,'request\x20sent');logger[_0x0b91('0x12')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x156fd1,_0x0b91('0x13'),JSON['stringify'](_0x4118b8));if(_0x4118b8['error']){if(_0x4118b8[_0x0b91('0x14')][_0x0b91('0x15')]===0x1f4){logger[_0x0b91('0x14')](_0x0b91('0x11'),_0x156fd1,_0x4118b8['error'][_0x0b91('0x16')]);return _0x41cc32(_0x4118b8[_0x0b91('0x14')][_0x0b91('0x16')]);}logger[_0x0b91('0x14')]('VoiceQueuesLog,\x20%s,\x20%s',_0x156fd1,_0x4118b8[_0x0b91('0x14')][_0x0b91('0x16')]);return _0x3e8800(_0x4118b8[_0x0b91('0x14')][_0x0b91('0x16')]);}else{logger[_0x0b91('0x10')](_0x0b91('0x11'),_0x156fd1,'request\x20sent');_0x3e8800(_0x4118b8[_0x0b91('0x17')][_0x0b91('0x16')]);}})[_0x0b91('0x18')](function(_0x17d6fd){logger[_0x0b91('0x14')](_0x0b91('0x11'),_0x156fd1,_0x17d6fd);_0x41cc32(_0x17d6fd);});});} \ No newline at end of file +var _0x0aaf=['rpc','jayson/promise','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x1a0f1b,_0x4782c4){var _0x65d867=function(_0xf152a3){while(--_0xf152a3){_0x1a0f1b['push'](_0x1a0f1b['shift']());}};_0x65d867(++_0x4782c4);}(_0x0aaf,0x1c8));var _0xf0aa=function(_0xd58823,_0x15c483){_0xd58823=_0xd58823-0x0;var _0x249c0a=_0x0aaf[_0xd58823];return _0x249c0a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf0aa('0x0'));var BPromise=require(_0xf0aa('0x1'));var rs=require(_0xf0aa('0x2'));var fs=require('fs');var Redis=require(_0xf0aa('0x3'));var db=require(_0xf0aa('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf0aa('0x5'))(_0xf0aa('0x6'));var config=require('../../config/environment');var jayson=require(_0xf0aa('0x7'));var client=jayson['client'][_0xf0aa('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4c2d11,_0xe4a744,_0x244745){return new BPromise(function(_0x38bf88,_0x579674){return client[_0xf0aa('0x9')](_0x4c2d11,_0x244745)[_0xf0aa('0xa')](function(_0x5b7efc){logger[_0xf0aa('0xb')](_0xf0aa('0xc'),_0xe4a744,_0xf0aa('0xd'));logger[_0xf0aa('0xe')](_0xf0aa('0xf'),_0xe4a744,_0xf0aa('0xd'),JSON[_0xf0aa('0x10')](_0x5b7efc));if(_0x5b7efc[_0xf0aa('0x11')]){if(_0x5b7efc[_0xf0aa('0x11')][_0xf0aa('0x12')]===0x1f4){logger[_0xf0aa('0x11')](_0xf0aa('0xc'),_0xe4a744,_0x5b7efc['error']['message']);return _0x579674(_0x5b7efc[_0xf0aa('0x11')][_0xf0aa('0x13')]);}logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0xe4a744,_0x5b7efc[_0xf0aa('0x11')]['message']);return _0x38bf88(_0x5b7efc[_0xf0aa('0x11')]['message']);}else{logger[_0xf0aa('0xb')]('VoiceQueuesLog,\x20%s,\x20%s',_0xe4a744,_0xf0aa('0xd'));_0x38bf88(_0x5b7efc[_0xf0aa('0x14')][_0xf0aa('0x13')]);}})[_0xf0aa('0x15')](function(_0x322ae0){logger[_0xf0aa('0x11')](_0xf0aa('0xc'),_0xe4a744,_0x322ae0);_0x579674(_0x322ae0);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 4b16ae0..5793617 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 _0x34d0=['exports','multer','express','Router','../../components/auth/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','describe','show','/:id/download','download','/:id/downloads','post','/:id/transcribe','runTranscribe','put','/:id','update','delete','destroy'];(function(_0x1443eb,_0x203408){var _0x2b8810=function(_0x48bc4e){while(--_0x48bc4e){_0x1443eb['push'](_0x1443eb['shift']());}};_0x2b8810(++_0x203408);}(_0x34d0,0xf3));var _0x034d=function(_0x34b18a,_0x564767){_0x34b18a=_0x34b18a-0x0;var _0x503369=_0x34d0[_0x34b18a];return _0x503369;};'use strict';var multer=require(_0x034d('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x034d('0x1'));var router=express[_0x034d('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x034d('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x034d('0x4'));var controller=require(_0x034d('0x5'));router[_0x034d('0x6')]('/',auth[_0x034d('0x7')](),controller['index']);router[_0x034d('0x6')]('/describe',auth[_0x034d('0x7')](),controller[_0x034d('0x8')]);router['get']('/:id',auth[_0x034d('0x7')](),controller[_0x034d('0x9')]);router[_0x034d('0x6')](_0x034d('0xa'),auth[_0x034d('0x7')](),controller[_0x034d('0xb')]);router[_0x034d('0x6')](_0x034d('0xc'),controller['downloads']);router[_0x034d('0x6')]('/:id/transcribe',auth[_0x034d('0x7')](),controller['downloadTranscribe']);router[_0x034d('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x034d('0xd')](_0x034d('0xe'),auth[_0x034d('0x7')](),controller[_0x034d('0xf')]);router[_0x034d('0x10')](_0x034d('0x11'),auth[_0x034d('0x7')](),controller[_0x034d('0x12')]);router[_0x034d('0x13')]('/:id',auth[_0x034d('0x7')](),controller[_0x034d('0x14')]);module[_0x034d('0x15')]=router; \ No newline at end of file +var _0x2f7c=['/:id/transcribe','runTranscribe','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','/describe','get','show','/:id/download','download','/:id/downloads','downloads','downloadTranscribe','post','create'];(function(_0x3be863,_0x9b3a5){var _0x403dea=function(_0x53f390){while(--_0x53f390){_0x3be863['push'](_0x3be863['shift']());}};_0x403dea(++_0x9b3a5);}(_0x2f7c,0x74));var _0xc2f7=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2f7c[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0xc2f7('0x0'));var util=require(_0xc2f7('0x1'));var path=require(_0xc2f7('0x2'));var timeout=require(_0xc2f7('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xc2f7('0x4'));var auth=require(_0xc2f7('0x5'));var interaction=require(_0xc2f7('0x6'));var config=require(_0xc2f7('0x7'));var controller=require('./voiceRecording.controller');router['get']('/',auth[_0xc2f7('0x8')](),controller['index']);router['get'](_0xc2f7('0x9'),auth[_0xc2f7('0x8')](),controller['describe']);router[_0xc2f7('0xa')]('/:id',auth[_0xc2f7('0x8')](),controller[_0xc2f7('0xb')]);router['get'](_0xc2f7('0xc'),auth[_0xc2f7('0x8')](),controller[_0xc2f7('0xd')]);router[_0xc2f7('0xa')](_0xc2f7('0xe'),controller[_0xc2f7('0xf')]);router[_0xc2f7('0xa')]('/:id/transcribe',auth['isAuthenticated'](),controller[_0xc2f7('0x10')]);router[_0xc2f7('0x11')]('/',auth[_0xc2f7('0x8')](),controller[_0xc2f7('0x12')]);router[_0xc2f7('0x11')](_0xc2f7('0x13'),auth[_0xc2f7('0x8')](),controller[_0xc2f7('0x14')]);router[_0xc2f7('0x15')](_0xc2f7('0x16'),auth[_0xc2f7('0x8')](),controller[_0xc2f7('0x17')]);router[_0xc2f7('0x18')](_0xc2f7('0x16'),auth[_0xc2f7('0x8')](),controller[_0xc2f7('0x19')]);module[_0xc2f7('0x1a')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 2542ad3..187fe68 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(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'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(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'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 e5375b0..ac7756a 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 _0x0337=['root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','zip-dir','fast-json-patch','request-promise','moment','mustache','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','aws-sdk','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','reject','save','destroy','error','name','send','index','map','VoiceRecording','rawAttributes','fieldName','type','key','differenceBy','format','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','sort','where','pick','merge','VIRTUAL','filter','options','then','includeAll','include','findAll','catch','show','length','find','create','body','update','params','describe','download','uniqueid','value','%s.cypher','decryptFile','secrets','recording','existsSync','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','unlink','sequelize','MD5','col','token','push','$and','extname','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','listBuckets','createBucket','upload','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','Location','bucket','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','runTranscribe','Voice\x20Recording\x20not\x20found','Setting','findOne','transcribe','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','transcribeRegion','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','tempSentiment','updateAttributes','downloadTranscribe','fileText'];(function(_0x1cfa0d,_0x4391f2){var _0xe33279=function(_0x3ce7c1){while(--_0x3ce7c1){_0x1cfa0d['push'](_0x1cfa0d['shift']());}};_0xe33279(++_0x4391f2);}(_0x0337,0x1d2));var _0x7033=function(_0x4c0622,_0x5dacaf){_0x4c0622=_0x4c0622-0x0;var _0x1799d8=_0x0337[_0x4c0622];return _0x1799d8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7033('0x0'));var jsonpatch=require(_0x7033('0x1'));var rp=require(_0x7033('0x2'));var moment=require(_0x7033('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7033('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7033('0x5'));var fs=require('fs');var fs_extra=require(_0x7033('0x6'));var _=require(_0x7033('0x7'));var squel=require(_0x7033('0x8'));var crypto=require(_0x7033('0x9'));var jsforce=require(_0x7033('0xa'));var deskjs=require(_0x7033('0xb'));var toCsv=require(_0x7033('0xc'));var querystring=require(_0x7033('0xd'));var Papa=require(_0x7033('0xe'));var AWS=require(_0x7033('0xf'));var uuidv4=require('uuid/v4');var Redis=require(_0x7033('0x10'));var authService=require(_0x7033('0x11'));var qs=require(_0x7033('0x12'));var as=require(_0x7033('0x13'));var hardwareService=require(_0x7033('0x14'));var logger=require(_0x7033('0x15'))(_0x7033('0x16'));var utils=require(_0x7033('0x17'));var config=require(_0x7033('0x18'));var licenseUtil=require(_0x7033('0x19'));var db=require(_0x7033('0x1a'))['db'];function respondWithStatusCode(_0x3e06ba,_0x1454ac){_0x1454ac=_0x1454ac||0xcc;return function(_0x2f286d){if(_0x2f286d){return _0x3e06ba[_0x7033('0x1b')](_0x1454ac);}return _0x3e06ba[_0x7033('0x1c')](_0x1454ac)[_0x7033('0x1d')]();};}function respondWithResult(_0x6732e,_0x63fad2){_0x63fad2=_0x63fad2||0xc8;return function(_0xdc44b2){if(_0xdc44b2){return _0x6732e[_0x7033('0x1c')](_0x63fad2)[_0x7033('0x1e')](_0xdc44b2);}};}function respondWithFilteredResult(_0x27dc57,_0x1f7b2f){return function(_0x3682f2){if(_0x3682f2){var _0x1e60b2=typeof _0x1f7b2f['offset']===_0x7033('0x1f')&&typeof _0x1f7b2f[_0x7033('0x20')]==='undefined';var _0x1f4e02=_0x3682f2['count'];var _0x5debdd=_0x1e60b2?0x0:_0x1f7b2f[_0x7033('0x21')];var _0x15a715=_0x1e60b2?_0x3682f2[_0x7033('0x22')]:_0x1f7b2f[_0x7033('0x21')]+_0x1f7b2f[_0x7033('0x20')];var _0x7316b1;if(_0x15a715>=_0x1f4e02){_0x15a715=_0x1f4e02;_0x7316b1=0xc8;}else{_0x7316b1=0xce;}_0x27dc57[_0x7033('0x1c')](_0x7316b1);return _0x27dc57[_0x7033('0x23')](_0x7033('0x24'),_0x5debdd+'-'+_0x15a715+'/'+_0x1f4e02)[_0x7033('0x1e')](_0x3682f2);}return null;};}function patchUpdates(_0x1d2865){return function(_0x45f4ab){try{jsonpatch['apply'](_0x45f4ab,_0x1d2865,!![]);}catch(_0x3ea472){return BPromise[_0x7033('0x25')](_0x3ea472);}return _0x45f4ab[_0x7033('0x26')]();};}function saveUpdates(_0x4d0357,_0xed3d08){return function(_0x5e2098){if(_0x5e2098){return _0x5e2098['update'](_0x4d0357)['then'](function(_0x5ed42f){return _0x5ed42f;});}return null;};}function removeEntity(_0x476ea3,_0x1f7b8f){return function(_0x3ee2f8){if(_0x3ee2f8){return _0x3ee2f8[_0x7033('0x27')]()['then'](function(){_0x476ea3[_0x7033('0x1c')](0xcc)[_0x7033('0x1d')]();});}};}function handleEntityNotFound(_0x18810f,_0x379f0e){return function(_0x2036a2){if(!_0x2036a2){_0x18810f[_0x7033('0x1b')](0x194);}return _0x2036a2;};}function handleError(_0x557691,_0x382d47){_0x382d47=_0x382d47||0x1f4;return function(_0x511e6f){logger[_0x7033('0x28')](_0x511e6f['stack']);if(_0x511e6f[_0x7033('0x29')]){delete _0x511e6f[_0x7033('0x29')];}_0x557691[_0x7033('0x1c')](_0x382d47)[_0x7033('0x2a')](_0x511e6f);};}exports[_0x7033('0x2b')]=function(_0x1fccda,_0x5bfcab){var _0x38f19e={},_0xfd931b={},_0x26d7dc={'count':0x0,'rows':[]};var _0x5cf0e9=_[_0x7033('0x2c')](db[_0x7033('0x2d')][_0x7033('0x2e')],function(_0x5ed39e){return{'name':_0x5ed39e[_0x7033('0x2f')],'type':_0x5ed39e[_0x7033('0x30')][_0x7033('0x31')]};});_0xfd931b['model']=_[_0x7033('0x32')](_[_0x7033('0x2c')](_0x5cf0e9,'name'),[_0x7033('0x33')]);_0xfd931b[_0x7033('0x34')]=_[_0x7033('0x35')](_0x1fccda[_0x7033('0x34')]);_0xfd931b[_0x7033('0x36')]=_[_0x7033('0x37')](_0xfd931b[_0x7033('0x38')],_0xfd931b[_0x7033('0x34')]);_0x38f19e[_0x7033('0x39')]=_[_0x7033('0x37')](_0xfd931b[_0x7033('0x38')],qs['fields'](_0x1fccda[_0x7033('0x34')][_0x7033('0x3a')]));_0x38f19e[_0x7033('0x39')]=_0x38f19e['attributes']['length']?_0x38f19e[_0x7033('0x39')]:_0xfd931b['model'];if(!_0x1fccda['query'][_0x7033('0x3b')]('nolimit')){_0x38f19e[_0x7033('0x20')]=qs[_0x7033('0x20')](_0x1fccda[_0x7033('0x34')][_0x7033('0x20')]);_0x38f19e[_0x7033('0x21')]=qs[_0x7033('0x21')](_0x1fccda['query'][_0x7033('0x21')]);}_0x38f19e['order']=qs[_0x7033('0x3c')](_0x1fccda[_0x7033('0x34')][_0x7033('0x3c')]);_0x38f19e[_0x7033('0x3d')]=qs['filters'](_[_0x7033('0x3e')](_0x1fccda[_0x7033('0x34')],_0xfd931b[_0x7033('0x36')]),_0x5cf0e9);if(_0x1fccda[_0x7033('0x34')]['filter']){_0x38f19e['where']=_[_0x7033('0x3f')](_0x38f19e[_0x7033('0x3d')],{'$or':_['map'](_0x5cf0e9,function(_0x231f10){if(_0x231f10[_0x7033('0x30')]!==_0x7033('0x40')){var _0x51a393={};_0x51a393[_0x231f10[_0x7033('0x29')]]={'$like':'%'+_0x1fccda[_0x7033('0x34')][_0x7033('0x41')]+'%'};return _0x51a393;}})});}_0x38f19e=_['merge']({},_0x38f19e,_0x1fccda[_0x7033('0x42')]);var _0x4cc075={'where':_0x38f19e[_0x7033('0x3d')]};return db[_0x7033('0x2d')][_0x7033('0x22')](_0x4cc075)[_0x7033('0x43')](function(_0x3e02b0){_0x26d7dc['count']=_0x3e02b0;if(_0x1fccda[_0x7033('0x34')][_0x7033('0x44')]){_0x38f19e[_0x7033('0x45')]=[{'all':!![]}];}return db[_0x7033('0x2d')][_0x7033('0x46')](_0x38f19e);})[_0x7033('0x43')](function(_0x21b209){_0x26d7dc['rows']=_0x21b209;return _0x26d7dc;})['then'](respondWithFilteredResult(_0x5bfcab,_0x38f19e))[_0x7033('0x47')](handleError(_0x5bfcab,null));};exports[_0x7033('0x48')]=function(_0x3c164a,_0x4a2343){var _0x3b0516={'raw':![],'where':{'id':_0x3c164a['params']['id']}},_0xda36fa={};_0xda36fa[_0x7033('0x38')]=_['keys'](db['VoiceRecording']['rawAttributes']);_0xda36fa[_0x7033('0x34')]=_[_0x7033('0x35')](_0x3c164a[_0x7033('0x34')]);_0xda36fa[_0x7033('0x36')]=_[_0x7033('0x37')](_0xda36fa[_0x7033('0x38')],_0xda36fa[_0x7033('0x34')]);_0x3b0516[_0x7033('0x39')]=_[_0x7033('0x37')](_0xda36fa['model'],qs[_0x7033('0x3a')](_0x3c164a[_0x7033('0x34')][_0x7033('0x3a')]));_0x3b0516[_0x7033('0x39')]=_0x3b0516[_0x7033('0x39')][_0x7033('0x49')]?_0x3b0516['attributes']:_0xda36fa[_0x7033('0x38')];if(_0x3c164a[_0x7033('0x34')][_0x7033('0x44')]){_0x3b0516['include']=[{'all':!![]}];}_0x3b0516=_['merge']({},_0x3b0516,_0x3c164a[_0x7033('0x42')]);return db['VoiceRecording'][_0x7033('0x4a')](_0x3b0516)[_0x7033('0x43')](handleEntityNotFound(_0x4a2343,null))[_0x7033('0x43')](respondWithResult(_0x4a2343,null))[_0x7033('0x47')](handleError(_0x4a2343,null));};exports[_0x7033('0x4b')]=function(_0xd80032,_0xd2ea08){return db[_0x7033('0x2d')][_0x7033('0x4b')](_0xd80032[_0x7033('0x4c')],{})['then'](respondWithResult(_0xd2ea08,0xc9))[_0x7033('0x47')](handleError(_0xd2ea08,null));};exports[_0x7033('0x4d')]=function(_0x455c21,_0x20e13c){if(_0x455c21[_0x7033('0x4c')]['id']){delete _0x455c21[_0x7033('0x4c')]['id'];}return db[_0x7033('0x2d')][_0x7033('0x4a')]({'where':{'id':_0x455c21[_0x7033('0x4e')]['id']}})[_0x7033('0x43')](handleEntityNotFound(_0x20e13c,null))[_0x7033('0x43')](saveUpdates(_0x455c21[_0x7033('0x4c')],null))['then'](respondWithResult(_0x20e13c,null))[_0x7033('0x47')](handleError(_0x20e13c,null));};exports[_0x7033('0x4f')]=function(_0x392bab,_0x148bbb){return db[_0x7033('0x2d')][_0x7033('0x4f')]()[_0x7033('0x43')](respondWithResult(_0x148bbb,null))[_0x7033('0x47')](handleError(_0x148bbb,null));};exports[_0x7033('0x50')]=function(_0x4f541f,_0x12e7f0,_0x4a04b8){var _0x17adcc=require('../../components/encryptor');var _0xdfc494=![];var _0x475adc={};if(_0x4f541f[_0x7033('0x34')][_0x7033('0x30')]&&_0x4f541f['query'][_0x7033('0x30')]===_0x7033('0x51')){_0x475adc[_0x7033('0x51')]=_0x4f541f[_0x7033('0x4e')]['id'];}else{_0x475adc['id']=_0x4f541f['params']['id'];}return db[_0x7033('0x2d')][_0x7033('0x4a')]({'where':_0x475adc,'attributes':['id',_0x7033('0x52')],'raw':!![]})[_0x7033('0x43')](handleEntityNotFound(_0x12e7f0,null))[_0x7033('0x43')](function(_0x56a1d4){if(_0x56a1d4){var _0x59fb92=_0x56a1d4['value'];var _0x378f7d=util['format'](_0x7033('0x53'),_0x59fb92);if(fs['existsSync'](_0x378f7d)){_0xdfc494=!![];return _0x17adcc[_0x7033('0x54')](_0x378f7d,_0x59fb92,config[_0x7033('0x55')][_0x7033('0x56')])[_0x7033('0x43')](function(){return _0x56a1d4;});}return _0x56a1d4;}})[_0x7033('0x43')](function(_0xd00592){if(_0xd00592){var _0x2631e7=_0xd00592[_0x7033('0x52')];if(!fs[_0x7033('0x57')](_0x2631e7)){throw new db[(_0x7033('0x58'))][(_0x7033('0x59'))](_0x7033('0x5a'));}if(_0xd00592[_0x7033('0x5b')]){return _0x12e7f0[_0x7033('0x50')](_0x2631e7,_0xd00592['filename']+path['extname'](_0x2631e7),function(){if(_0xdfc494){fs[_0x7033('0x5c')](_0x2631e7);}});}else{return _0x12e7f0['download'](_0x2631e7,function(_0x8a47ec){if(_0xdfc494){fs[_0x7033('0x5c')](_0x2631e7);}});}}})[_0x7033('0x47')](function(_0x5614a2){if(_0x5614a2['message']===_0x7033('0x5a')){_0x12e7f0[_0x7033('0x1c')](0x194)[_0x7033('0x2a')]('Not\x20found');}else{return handleError(_0x12e7f0,null);}});};exports['downloads']=function(_0x32a1b2,_0x26328a,_0x5566c3){var _0x68a3ad=require('../../components/encryptor');var _0x4d3a69=![];var _0xddf833={'$and':[db['sequelize'][_0x7033('0x3d')](db[_0x7033('0x5d')]['fn'](_0x7033('0x5e'),db['sequelize'][_0x7033('0x5f')](_0x7033('0x51'))),_0x32a1b2['query'][_0x7033('0x60')])]};if(_0x32a1b2[_0x7033('0x34')][_0x7033('0x30')]&&_0x32a1b2[_0x7033('0x34')][_0x7033('0x30')]===_0x7033('0x51')){_0xddf833['$and'][_0x7033('0x61')]({'uniqueid':_0x32a1b2[_0x7033('0x4e')]['id']});}else{_0xddf833[_0x7033('0x62')][_0x7033('0x61')]({'id':_0x32a1b2[_0x7033('0x4e')]['id']});}return db['VoiceRecording'][_0x7033('0x4a')]({'where':_0xddf833,'attributes':['id',_0x7033('0x52')],'raw':!![]})[_0x7033('0x43')](handleEntityNotFound(_0x26328a,null))['then'](function(_0xadcdda){if(_0xadcdda){var _0x5439a2=util['format'](_0x7033('0x53'),_0xadcdda[_0x7033('0x52')]);if(fs[_0x7033('0x57')](_0x5439a2)){_0x4d3a69=!![];return _0x68a3ad[_0x7033('0x54')](_0x5439a2,_0xadcdda[_0x7033('0x52')],config[_0x7033('0x55')][_0x7033('0x56')])['then'](function(){return _0xadcdda;});}return _0xadcdda;}})[_0x7033('0x43')](function(_0xedb116){if(_0xedb116){if(!fs[_0x7033('0x57')](_0xedb116[_0x7033('0x52')])){throw new db['Sequelize'][(_0x7033('0x59'))](_0x7033('0x5a'));}if(_0xedb116[_0x7033('0x5b')]){return _0x26328a[_0x7033('0x50')](_0xedb116[_0x7033('0x52')],_0xedb116[_0x7033('0x5b')]+path[_0x7033('0x63')](_0xedb116[_0x7033('0x52')]),function(){if(_0x4d3a69){fs[_0x7033('0x5c')](_0xedb116['value']);}});}else{return _0x26328a[_0x7033('0x50')](_0xedb116[_0x7033('0x52')],function(_0x14f080){if(_0x4d3a69){fs[_0x7033('0x5c')](_0xedb116[_0x7033('0x52')]);}});}}})['catch'](handleError(_0x26328a,null));};exports[_0x7033('0x27')]=function(_0x31e04e,_0x1ce926){return db['VoiceRecording']['find']({'where':{'id':_0x31e04e[_0x7033('0x4e')]['id']}})[_0x7033('0x43')](function(_0x20c570){if(_[_0x7033('0x64')](_0x20c570)){throw new ReferenceError(_0x7033('0x65'));}return _0x20c570;})[_0x7033('0x43')](function(_0x583b92){var _0x2ca672=_0x583b92[_0x7033('0x52')];logger[_0x7033('0x66')](_0x7033('0x67'),_0x2ca672);if(!_[_0x7033('0x64')](_0x583b92[_0x7033('0x52')])&&fs[_0x7033('0x57')](_0x2ca672)){logger[_0x7033('0x66')]('File:\x20\x22'+_0x2ca672+_0x7033('0x68'));fs[_0x7033('0x69')](_0x2ca672);}_0x2ca672=_0x2ca672+_0x7033('0x6a');if(!_[_0x7033('0x64')](_0x583b92[_0x7033('0x52')])&&fs[_0x7033('0x57')](_0x2ca672)){logger[_0x7033('0x66')](_0x7033('0x6b')+_0x2ca672+_0x7033('0x68'));fs['unlinkSync'](_0x2ca672);}return _0x583b92;})['then'](function(_0x4c6e49){if(!_0x4c6e49)throw new InternalError();return _0x4c6e49[_0x7033('0x27')]();})['then'](function(){_0x1ce926['status'](0xcc)[_0x7033('0x1d')]();})[_0x7033('0x47')](handleError(_0x1ce926,null));};function getBucketslist(_0xff6674,_0x3d6738,_0x21a94c){return new Promise(function(_0xd75e47,_0x3f16c3){var _0xcd5ad3=new AWS['S3']({'accessKeyId':_0x3d6738,'secretAccessKey':_0xff6674,'region':_0x21a94c});_0xcd5ad3[_0x7033('0x6c')]({},function(_0x3130a6,_0xe70520){if(_0x3130a6){return _0x3f16c3(_0x3130a6);}else{return _0xd75e47(_0xe70520);}});});}function createBucket(_0x1b492f,_0x1fe9ef,_0x2dd1c9,_0x2de766){return new Promise(function(_0x4f0d51,_0x113162){var _0x4cdd9d=new AWS['S3']({'accessKeyId':_0x1fe9ef,'secretAccessKey':_0x1b492f,'region':_0x2dd1c9});_0x4cdd9d[_0x7033('0x6d')]({'Bucket':_0x2de766},function(_0xb2e355,_0x1827fe){if(_0xb2e355){return _0x113162(_0xb2e355);}else{return _0x4f0d51(_0x1827fe);}});});}function uploadFile(_0xf3fd28,_0x23212f,_0x23ac6b,_0x5d8289,_0x7aabda,_0x5c96d4){return new Promise(function(_0x200670,_0x4abb4e){var _0x19bace=new AWS['S3']({'accessKeyId':_0x23212f,'secretAccessKey':_0xf3fd28,'region':_0x23ac6b});_0x19bace[_0x7033('0x6e')]({'Bucket':_0x5d8289,'Key':_0x7aabda,'Body':_0x5c96d4},function(_0x495a20,_0x5582f1){if(_0x495a20){return _0x4abb4e(_0x495a20);}else{return _0x200670(_0x5582f1);}});});}function startTranscribe(_0xf163f1,_0x40a85e,_0x124c4d,_0x732376,_0x539142,_0x85e118){return new Promise(function(_0x1bf389,_0x345604){var _0x54237e=new AWS[(_0x7033('0x6f'))]({'accessKeyId':_0x40a85e,'secretAccessKey':_0xf163f1,'region':_0x124c4d});_0x54237e['startTranscriptionJob']({'TranscriptionJobName':_0x732376,'LanguageCode':_0x539142,'Media':{'MediaFileUri':_0x85e118}},function(_0x2b8d39,_0x5cacb5){if(_0x2b8d39){return _0x345604(_0x2b8d39);}else{return _0x1bf389(_0x5cacb5);}});});}function transcribe(_0x31ac89,_0x2101b9,_0x21f67d,_0x233da5,_0x2d4432,_0x3dc1de,_0xa4a56b){return new Promise(function(_0x85e637,_0x50ed26){var _0x2bd710={};logger[_0x7033('0x66')](util['format'](_0x7033('0x70'),_0x31ac89,_0x2d4432));return uploadFile(_0x2101b9,_0x21f67d,_0x233da5,_0x2d4432,path[_0x7033('0x71')](_0x3dc1de),fs[_0x7033('0x72')](_0x3dc1de))[_0x7033('0x43')](function(_0xc50f09){logger[_0x7033('0x66')](util[_0x7033('0x33')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x31ac89,_0x2d4432,_0xc50f09[_0x7033('0x73')]));_0x2bd710[_0x7033('0x74')]=_0xc50f09['Bucket'];_0x2bd710['location']=_0xc50f09[_0x7033('0x73')];logger[_0x7033('0x66')](util[_0x7033('0x33')](_0x7033('0x75'),_0x31ac89));return startTranscribe(_0x2101b9,_0x21f67d,_0x233da5,uuidv4(),_0xa4a56b,_0xc50f09[_0x7033('0x73')]);})[_0x7033('0x43')](function(_0x45acd3){logger[_0x7033('0x66')](util[_0x7033('0x33')](_0x7033('0x76'),_0x31ac89,_0x45acd3[_0x7033('0x77')][_0x7033('0x78')]));_0x2bd710[_0x7033('0x79')]=_0x45acd3[_0x7033('0x77')]['TranscriptionJobName'];_0x2bd710[_0x7033('0x7a')]=_0x45acd3[_0x7033('0x77')]['TranscriptionJobStatus'];return _0x85e637(_0x2bd710);})[_0x7033('0x47')](function(_0x4158aa){return _0x50ed26(_0x4158aa);});});}exports[_0x7033('0x7b')]=function(_0x1d60da,_0x5c46ac,_0x2c8240){var _0x773141;var _0x2160ba;var _0x1de3d7;var _0x55f0b5=require('../../components/encryptor');return db[_0x7033('0x2d')]['findOne']({'where':{'id':_0x1d60da['params']['id']}})[_0x7033('0x43')](function(_0x16b58c){if(_0x16b58c){var _0x331437=util[_0x7033('0x33')](_0x7033('0x53'),_0x16b58c[_0x7033('0x52')]);if(fs[_0x7033('0x57')](_0x331437)){cypher=!![];return _0x55f0b5['decryptFile'](_0x331437,_0x16b58c[_0x7033('0x52')],config[_0x7033('0x55')][_0x7033('0x56')])[_0x7033('0x43')](function(){return _0x16b58c;});}return _0x16b58c;}})[_0x7033('0x43')](function(_0x27eefd){if(!_0x27eefd){throw new db[(_0x7033('0x58'))]['ValidationError'](_0x7033('0x7c'));}_0x2160ba=_0x27eefd;return db[_0x7033('0x7d')][_0x7033('0x7e')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x5c46ac,null))[_0x7033('0x43')](function(_0x466c0b){if(_0x466c0b){_0x773141=_0x466c0b;if(!_0x773141[_0x7033('0x7f')]||!_0x773141['transcribeAccountId']||!_0x773141['transcribeRegion']||!_0x773141[_0x7033('0x80')]||!_0x773141[_0x7033('0x74')]){throw new db['Sequelize']['ValidationError'](_0x7033('0x81'));}if(_0x1d60da['body'][_0x7033('0x82')]&&(!_0x773141[_0x7033('0x83')]||!_0x773141['sentimentAccountId']||!_0x773141[_0x7033('0x84')]||!_0x773141[_0x7033('0x80')]||!_0x773141[_0x7033('0x74')])){throw new db[(_0x7033('0x58'))]['ValidationError'](_0x7033('0x85'));}return db[_0x7033('0x86')][_0x7033('0x7e')]({'where':{'id':_0x773141[_0x7033('0x87')]}});}})[_0x7033('0x43')](function(_0x1b83c9){if(!_0x1b83c9){throw new db[(_0x7033('0x58'))]['ValidationError'](_0x7033('0x88'));}if(!_0x1b83c9[_0x7033('0x89')]||!_0x1b83c9[_0x7033('0x8a')]){throw new db[(_0x7033('0x58'))][(_0x7033('0x59'))](_0x7033('0x8b'));}_0x1de3d7=_0x1b83c9;return getBucketslist(_0x1de3d7['data1'],_0x1de3d7[_0x7033('0x8a')],_0x773141['transcribeRegion']);})[_0x7033('0x43')](function(_0x141204){if(_0x141204&&_0x141204[_0x7033('0x8c')]){var _0x493781=_['find'](_0x141204[_0x7033('0x8c')],function(_0x2b26ff){return _0x2b26ff[_0x7033('0x8d')]===_0x773141[_0x7033('0x74')];});if(!_0x493781){logger[_0x7033('0x66')](util[_0x7033('0x33')](_0x7033('0x8e'),_0x1d60da[_0x7033('0x4e')]['id'],_0x773141['bucket']));return createBucket(_0x1de3d7['data1'],_0x1de3d7[_0x7033('0x8a')],_0x773141[_0x7033('0x8f')],_0x773141[_0x7033('0x74')]);}logger[_0x7033('0x66')](util[_0x7033('0x33')](_0x7033('0x90'),_0x1d60da[_0x7033('0x4e')]['id'],_0x773141[_0x7033('0x74')]));return;}})['then'](function(_0x383ce9){if(_0x2160ba[_0x7033('0x7a')]===_0x7033('0x91')){return transcribe(_0x1d60da[_0x7033('0x4e')]['id'],_0x1de3d7[_0x7033('0x89')],_0x1de3d7[_0x7033('0x8a')],_0x773141['transcribeRegion'],_0x773141[_0x7033('0x74')],_0x2160ba['value'],_0x773141[_0x7033('0x80')]);}else{logger[_0x7033('0x66')](util[_0x7033('0x33')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x1d60da[_0x7033('0x4e')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0x7033('0x43')](function(_0xce18a8){if(_0xce18a8){_0xce18a8[_0x7033('0x92')]=_0x1d60da[_0x7033('0x4c')][_0x7033('0x82')];return _0x2160ba[_0x7033('0x93')](_0xce18a8);}})['then'](respondWithResult(_0x5c46ac,null))[_0x7033('0x47')](handleError(_0x5c46ac,null));};function writeFile(_0x49b734,_0x508f04){return new Promise(function(_0x40f72b,_0xe4c14d){fs['writeFile'](_0x508f04,_0x49b734,function(_0x383457,_0x501224){if(_0x383457){return _0xe4c14d(_0x383457);}else{return _0x40f72b(_0x501224);}});});}exports[_0x7033('0x94')]=function(_0x566278,_0x4fc5b7,_0x1dee56){return db['VoiceRecording'][_0x7033('0x7e')]({'where':{'id':_0x566278['params']['id']}})[_0x7033('0x43')](handleEntityNotFound(_0x4fc5b7))[_0x7033('0x43')](function(_0x57b46e){if(_0x57b46e&&_0x57b46e[_0x7033('0x95')]){var _0x5b732b=_0x57b46e['fileText'];var _0x5c3483=config[_0x7033('0x96')]+_0x7033('0x97')+_0x57b46e['id']+_0x7033('0x98');if(fs[_0x7033('0x57')](_0x5c3483)){return _0x5c3483;}return writeFile(_0x5b732b,_0x5c3483)['then'](function(){return _0x5c3483;});}else{throw new db['Sequelize'][(_0x7033('0x59'))](_0x7033('0x99'));}})['then'](function(_0x35c6b6){return _0x4fc5b7['download'](_0x35c6b6);})[_0x7033('0x47')](handleError(_0x4fc5b7));}; \ No newline at end of file +var _0x5e94=['transcribeStatus','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','/server/files/transcribes/transcribe_','.txt','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','aws-sdk','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','apply','reject','save','update','then','destroy','error','name','send','index','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','length','attributes','limit','order','sort','where','filter','options','VoiceRecording','includeAll','findAll','rows','catch','show','params','include','find','create','body','describe','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','VoiceRecording\x20not\x20found','filename','download','extname','unlink','message','Not\x20found','sequelize','token','push','$and','format','ValidationError','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','createBucket','upload','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','TranscriptionJobStatus','runTranscribe','Voice\x20Recording\x20not\x20found','Setting','findOne','transcribeRegion','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','data1','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available'];(function(_0x359bbe,_0x5b7fcc){var _0x1b3353=function(_0x34b41c){while(--_0x34b41c){_0x359bbe['push'](_0x359bbe['shift']());}};_0x1b3353(++_0x5b7fcc);}(_0x5e94,0x12b));var _0x45e9=function(_0x5cd33c,_0x151e9b){_0x5cd33c=_0x5cd33c-0x0;var _0x3ca5b7=_0x5e94[_0x5cd33c];return _0x3ca5b7;};'use strict';var emlformat=require(_0x45e9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x45e9('0x1'));var jsonpatch=require(_0x45e9('0x2'));var rp=require(_0x45e9('0x3'));var moment=require(_0x45e9('0x4'));var BPromise=require(_0x45e9('0x5'));var Mustache=require(_0x45e9('0x6'));var util=require('util');var path=require(_0x45e9('0x7'));var sox=require(_0x45e9('0x8'));var csv=require(_0x45e9('0x9'));var ejs=require(_0x45e9('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x45e9('0xb'));var squel=require(_0x45e9('0xc'));var crypto=require(_0x45e9('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x45e9('0xe'));var toCsv=require(_0x45e9('0x9'));var querystring=require(_0x45e9('0xf'));var Papa=require('papaparse');var AWS=require(_0x45e9('0x10'));var uuidv4=require('uuid/v4');var Redis=require('ioredis');var authService=require(_0x45e9('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x45e9('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x45e9('0x13'))('api');var utils=require(_0x45e9('0x14'));var config=require(_0x45e9('0x15'));var licenseUtil=require(_0x45e9('0x16'));var db=require(_0x45e9('0x17'))['db'];function respondWithStatusCode(_0x2c7302,_0x11274b){_0x11274b=_0x11274b||0xcc;return function(_0x51a241){if(_0x51a241){return _0x2c7302[_0x45e9('0x18')](_0x11274b);}return _0x2c7302[_0x45e9('0x19')](_0x11274b)[_0x45e9('0x1a')]();};}function respondWithResult(_0x23cb51,_0x276849){_0x276849=_0x276849||0xc8;return function(_0x170fce){if(_0x170fce){return _0x23cb51[_0x45e9('0x19')](_0x276849)[_0x45e9('0x1b')](_0x170fce);}};}function respondWithFilteredResult(_0x34f035,_0x785bc){return function(_0x2099c3){if(_0x2099c3){var _0x3adb6b=typeof _0x785bc[_0x45e9('0x1c')]===_0x45e9('0x1d')&&typeof _0x785bc['limit']===_0x45e9('0x1d');var _0x8e468f=_0x2099c3[_0x45e9('0x1e')];var _0x2c8a02=_0x3adb6b?0x0:_0x785bc[_0x45e9('0x1c')];var _0x5bcb5f=_0x3adb6b?_0x2099c3[_0x45e9('0x1e')]:_0x785bc[_0x45e9('0x1c')]+_0x785bc['limit'];var _0x5c5ff5;if(_0x5bcb5f>=_0x8e468f){_0x5bcb5f=_0x8e468f;_0x5c5ff5=0xc8;}else{_0x5c5ff5=0xce;}_0x34f035[_0x45e9('0x19')](_0x5c5ff5);return _0x34f035[_0x45e9('0x1f')]('Content-Range',_0x2c8a02+'-'+_0x5bcb5f+'/'+_0x8e468f)[_0x45e9('0x1b')](_0x2099c3);}return null;};}function patchUpdates(_0x581c27){return function(_0x597664){try{jsonpatch[_0x45e9('0x20')](_0x597664,_0x581c27,!![]);}catch(_0x370d30){return BPromise[_0x45e9('0x21')](_0x370d30);}return _0x597664[_0x45e9('0x22')]();};}function saveUpdates(_0x14b782,_0xa5cdd6){return function(_0x6ae434){if(_0x6ae434){return _0x6ae434[_0x45e9('0x23')](_0x14b782)[_0x45e9('0x24')](function(_0x498cc0){return _0x498cc0;});}return null;};}function removeEntity(_0x2eee41,_0x40c269){return function(_0x445469){if(_0x445469){return _0x445469[_0x45e9('0x25')]()[_0x45e9('0x24')](function(){_0x2eee41[_0x45e9('0x19')](0xcc)[_0x45e9('0x1a')]();});}};}function handleEntityNotFound(_0x24f429,_0x4a4645){return function(_0x128a9e){if(!_0x128a9e){_0x24f429[_0x45e9('0x18')](0x194);}return _0x128a9e;};}function handleError(_0x34eef2,_0x25ba4a){_0x25ba4a=_0x25ba4a||0x1f4;return function(_0x3ce973){logger[_0x45e9('0x26')](_0x3ce973['stack']);if(_0x3ce973[_0x45e9('0x27')]){delete _0x3ce973[_0x45e9('0x27')];}_0x34eef2['status'](_0x25ba4a)[_0x45e9('0x28')](_0x3ce973);};}exports[_0x45e9('0x29')]=function(_0x2c41e3,_0x27e600){var _0x150ef6={},_0x454b09={},_0x53507d={'count':0x0,'rows':[]};var _0x39b433=_['map'](db['VoiceRecording'][_0x45e9('0x2a')],function(_0x5458a0){return{'name':_0x5458a0[_0x45e9('0x2b')],'type':_0x5458a0[_0x45e9('0x2c')]['key']};});_0x454b09[_0x45e9('0x2d')]=_['differenceBy'](_['map'](_0x39b433,_0x45e9('0x27')),['format']);_0x454b09[_0x45e9('0x2e')]=_[_0x45e9('0x2f')](_0x2c41e3[_0x45e9('0x2e')]);_0x454b09[_0x45e9('0x30')]=_[_0x45e9('0x31')](_0x454b09[_0x45e9('0x2d')],_0x454b09[_0x45e9('0x2e')]);_0x150ef6['attributes']=_['intersection'](_0x454b09[_0x45e9('0x2d')],qs[_0x45e9('0x32')](_0x2c41e3[_0x45e9('0x2e')][_0x45e9('0x32')]));_0x150ef6['attributes']=_0x150ef6['attributes'][_0x45e9('0x33')]?_0x150ef6[_0x45e9('0x34')]:_0x454b09['model'];if(!_0x2c41e3['query']['hasOwnProperty']('nolimit')){_0x150ef6[_0x45e9('0x35')]=qs[_0x45e9('0x35')](_0x2c41e3['query']['limit']);_0x150ef6['offset']=qs['offset'](_0x2c41e3[_0x45e9('0x2e')][_0x45e9('0x1c')]);}_0x150ef6[_0x45e9('0x36')]=qs[_0x45e9('0x37')](_0x2c41e3[_0x45e9('0x2e')]['sort']);_0x150ef6[_0x45e9('0x38')]=qs['filters'](_['pick'](_0x2c41e3['query'],_0x454b09[_0x45e9('0x30')]),_0x39b433);if(_0x2c41e3[_0x45e9('0x2e')][_0x45e9('0x39')]){_0x150ef6[_0x45e9('0x38')]=_['merge'](_0x150ef6[_0x45e9('0x38')],{'$or':_['map'](_0x39b433,function(_0x493629){if(_0x493629['type']!=='VIRTUAL'){var _0x2c079f={};_0x2c079f[_0x493629[_0x45e9('0x27')]]={'$like':'%'+_0x2c41e3[_0x45e9('0x2e')][_0x45e9('0x39')]+'%'};return _0x2c079f;}})});}_0x150ef6=_['merge']({},_0x150ef6,_0x2c41e3[_0x45e9('0x3a')]);var _0x2cfcf5={'where':_0x150ef6[_0x45e9('0x38')]};return db[_0x45e9('0x3b')][_0x45e9('0x1e')](_0x2cfcf5)['then'](function(_0x3b5168){_0x53507d[_0x45e9('0x1e')]=_0x3b5168;if(_0x2c41e3[_0x45e9('0x2e')][_0x45e9('0x3c')]){_0x150ef6['include']=[{'all':!![]}];}return db['VoiceRecording'][_0x45e9('0x3d')](_0x150ef6);})[_0x45e9('0x24')](function(_0x74f396){_0x53507d[_0x45e9('0x3e')]=_0x74f396;return _0x53507d;})['then'](respondWithFilteredResult(_0x27e600,_0x150ef6))[_0x45e9('0x3f')](handleError(_0x27e600,null));};exports[_0x45e9('0x40')]=function(_0x4881ec,_0x3731fa){var _0xbac0a9={'raw':![],'where':{'id':_0x4881ec[_0x45e9('0x41')]['id']}},_0x3bfb47={};_0x3bfb47[_0x45e9('0x2d')]=_[_0x45e9('0x2f')](db['VoiceRecording'][_0x45e9('0x2a')]);_0x3bfb47[_0x45e9('0x2e')]=_[_0x45e9('0x2f')](_0x4881ec[_0x45e9('0x2e')]);_0x3bfb47[_0x45e9('0x30')]=_['intersection'](_0x3bfb47[_0x45e9('0x2d')],_0x3bfb47[_0x45e9('0x2e')]);_0xbac0a9[_0x45e9('0x34')]=_['intersection'](_0x3bfb47[_0x45e9('0x2d')],qs['fields'](_0x4881ec[_0x45e9('0x2e')][_0x45e9('0x32')]));_0xbac0a9[_0x45e9('0x34')]=_0xbac0a9[_0x45e9('0x34')]['length']?_0xbac0a9[_0x45e9('0x34')]:_0x3bfb47[_0x45e9('0x2d')];if(_0x4881ec[_0x45e9('0x2e')]['includeAll']){_0xbac0a9[_0x45e9('0x42')]=[{'all':!![]}];}_0xbac0a9=_['merge']({},_0xbac0a9,_0x4881ec[_0x45e9('0x3a')]);return db[_0x45e9('0x3b')][_0x45e9('0x43')](_0xbac0a9)['then'](handleEntityNotFound(_0x3731fa,null))[_0x45e9('0x24')](respondWithResult(_0x3731fa,null))[_0x45e9('0x3f')](handleError(_0x3731fa,null));};exports[_0x45e9('0x44')]=function(_0x4d37f9,_0x36a640){return db['VoiceRecording'][_0x45e9('0x44')](_0x4d37f9[_0x45e9('0x45')],{})[_0x45e9('0x24')](respondWithResult(_0x36a640,0xc9))[_0x45e9('0x3f')](handleError(_0x36a640,null));};exports['update']=function(_0x1cf9e6,_0x12a2df){if(_0x1cf9e6[_0x45e9('0x45')]['id']){delete _0x1cf9e6['body']['id'];}return db[_0x45e9('0x3b')][_0x45e9('0x43')]({'where':{'id':_0x1cf9e6[_0x45e9('0x41')]['id']}})[_0x45e9('0x24')](handleEntityNotFound(_0x12a2df,null))[_0x45e9('0x24')](saveUpdates(_0x1cf9e6[_0x45e9('0x45')],null))['then'](respondWithResult(_0x12a2df,null))[_0x45e9('0x3f')](handleError(_0x12a2df,null));};exports['describe']=function(_0x43fcbe,_0x4f753c){return db[_0x45e9('0x3b')][_0x45e9('0x46')]()['then'](respondWithResult(_0x4f753c,null))[_0x45e9('0x3f')](handleError(_0x4f753c,null));};exports['download']=function(_0x33dad4,_0x2cd320,_0x24e696){var _0x29e39d=require(_0x45e9('0x47'));var _0x453998=![];var _0x1c3434={};if(_0x33dad4[_0x45e9('0x2e')][_0x45e9('0x2c')]&&_0x33dad4[_0x45e9('0x2e')][_0x45e9('0x2c')]===_0x45e9('0x48')){_0x1c3434[_0x45e9('0x48')]=_0x33dad4[_0x45e9('0x41')]['id'];}else{_0x1c3434['id']=_0x33dad4[_0x45e9('0x41')]['id'];}return db[_0x45e9('0x3b')][_0x45e9('0x43')]({'where':_0x1c3434,'attributes':['id',_0x45e9('0x49')],'raw':!![]})[_0x45e9('0x24')](handleEntityNotFound(_0x2cd320,null))['then'](function(_0x75d739){if(_0x75d739){var _0x2d2048=_0x75d739[_0x45e9('0x49')];var _0x132e9c=util['format'](_0x45e9('0x4a'),_0x2d2048);if(fs[_0x45e9('0x4b')](_0x132e9c)){_0x453998=!![];return _0x29e39d[_0x45e9('0x4c')](_0x132e9c,_0x2d2048,config[_0x45e9('0x4d')][_0x45e9('0x4e')])[_0x45e9('0x24')](function(){return _0x75d739;});}return _0x75d739;}})[_0x45e9('0x24')](function(_0x5493b7){if(_0x5493b7){var _0x2a4af9=_0x5493b7[_0x45e9('0x49')];if(!fs[_0x45e9('0x4b')](_0x2a4af9)){throw new db[(_0x45e9('0x4f'))]['ValidationError'](_0x45e9('0x50'));}if(_0x5493b7[_0x45e9('0x51')]){return _0x2cd320[_0x45e9('0x52')](_0x2a4af9,_0x5493b7['filename']+path[_0x45e9('0x53')](_0x2a4af9),function(){if(_0x453998){fs[_0x45e9('0x54')](_0x2a4af9);}});}else{return _0x2cd320[_0x45e9('0x52')](_0x2a4af9,function(_0x24aa9c){if(_0x453998){fs['unlink'](_0x2a4af9);}});}}})['catch'](function(_0x30b078){if(_0x30b078[_0x45e9('0x55')]===_0x45e9('0x50')){_0x2cd320[_0x45e9('0x19')](0x194)[_0x45e9('0x28')](_0x45e9('0x56'));}else{return handleError(_0x2cd320,null);}});};exports['downloads']=function(_0x511311,_0x476a09,_0x46fea2){var _0x5e4cfa=require(_0x45e9('0x47'));var _0x28450c=![];var _0x83af24={'$and':[db[_0x45e9('0x57')][_0x45e9('0x38')](db[_0x45e9('0x57')]['fn']('MD5',db[_0x45e9('0x57')]['col'](_0x45e9('0x48'))),_0x511311[_0x45e9('0x2e')][_0x45e9('0x58')])]};if(_0x511311[_0x45e9('0x2e')]['type']&&_0x511311['query'][_0x45e9('0x2c')]===_0x45e9('0x48')){_0x83af24['$and'][_0x45e9('0x59')]({'uniqueid':_0x511311[_0x45e9('0x41')]['id']});}else{_0x83af24[_0x45e9('0x5a')][_0x45e9('0x59')]({'id':_0x511311[_0x45e9('0x41')]['id']});}return db['VoiceRecording']['find']({'where':_0x83af24,'attributes':['id',_0x45e9('0x49')],'raw':!![]})[_0x45e9('0x24')](handleEntityNotFound(_0x476a09,null))['then'](function(_0x18961e){if(_0x18961e){var _0x39172b=util[_0x45e9('0x5b')](_0x45e9('0x4a'),_0x18961e[_0x45e9('0x49')]);if(fs[_0x45e9('0x4b')](_0x39172b)){_0x28450c=!![];return _0x5e4cfa[_0x45e9('0x4c')](_0x39172b,_0x18961e[_0x45e9('0x49')],config[_0x45e9('0x4d')][_0x45e9('0x4e')])[_0x45e9('0x24')](function(){return _0x18961e;});}return _0x18961e;}})['then'](function(_0x118dea){if(_0x118dea){if(!fs[_0x45e9('0x4b')](_0x118dea[_0x45e9('0x49')])){throw new db[(_0x45e9('0x4f'))][(_0x45e9('0x5c'))](_0x45e9('0x50'));}if(_0x118dea['filename']){return _0x476a09[_0x45e9('0x52')](_0x118dea['value'],_0x118dea['filename']+path[_0x45e9('0x53')](_0x118dea[_0x45e9('0x49')]),function(){if(_0x28450c){fs['unlink'](_0x118dea[_0x45e9('0x49')]);}});}else{return _0x476a09[_0x45e9('0x52')](_0x118dea[_0x45e9('0x49')],function(_0x18a518){if(_0x28450c){fs[_0x45e9('0x54')](_0x118dea[_0x45e9('0x49')]);}});}}})['catch'](handleError(_0x476a09,null));};exports[_0x45e9('0x25')]=function(_0x4633c7,_0x3144cf){return db[_0x45e9('0x3b')][_0x45e9('0x43')]({'where':{'id':_0x4633c7['params']['id']}})['then'](function(_0x42fec5){if(_[_0x45e9('0x5d')](_0x42fec5)){throw new ReferenceError(_0x45e9('0x5e'));}return _0x42fec5;})[_0x45e9('0x24')](function(_0x4d4320){var _0xd7c841=_0x4d4320[_0x45e9('0x49')];logger[_0x45e9('0x5f')](_0x45e9('0x60'),_0xd7c841);if(!_['isNil'](_0x4d4320['value'])&&fs['existsSync'](_0xd7c841)){logger[_0x45e9('0x5f')](_0x45e9('0x61')+_0xd7c841+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0xd7c841);}_0xd7c841=_0xd7c841+_0x45e9('0x62');if(!_[_0x45e9('0x5d')](_0x4d4320[_0x45e9('0x49')])&&fs[_0x45e9('0x4b')](_0xd7c841)){logger[_0x45e9('0x5f')](_0x45e9('0x61')+_0xd7c841+_0x45e9('0x63'));fs[_0x45e9('0x64')](_0xd7c841);}return _0x4d4320;})[_0x45e9('0x24')](function(_0x570e9d){if(!_0x570e9d)throw new InternalError();return _0x570e9d[_0x45e9('0x25')]();})[_0x45e9('0x24')](function(){_0x3144cf[_0x45e9('0x19')](0xcc)[_0x45e9('0x1a')]();})[_0x45e9('0x3f')](handleError(_0x3144cf,null));};function getBucketslist(_0x1e8483,_0xf93952,_0x1c8fd6){return new Promise(function(_0x5874b,_0x135289){var _0x5b6be2=new AWS['S3']({'accessKeyId':_0xf93952,'secretAccessKey':_0x1e8483,'region':_0x1c8fd6});_0x5b6be2['listBuckets']({},function(_0x3169e9,_0x2a8063){if(_0x3169e9){return _0x135289(_0x3169e9);}else{return _0x5874b(_0x2a8063);}});});}function createBucket(_0x39cc10,_0x1f8690,_0x10f1a4,_0x590080){return new Promise(function(_0x3036ac,_0x5ef7a1){var _0x367879=new AWS['S3']({'accessKeyId':_0x1f8690,'secretAccessKey':_0x39cc10,'region':_0x10f1a4});_0x367879[_0x45e9('0x65')]({'Bucket':_0x590080},function(_0x494b6a,_0x57ee35){if(_0x494b6a){return _0x5ef7a1(_0x494b6a);}else{return _0x3036ac(_0x57ee35);}});});}function uploadFile(_0x23d50a,_0x232353,_0x45e440,_0x591cce,_0x5d2416,_0x150895){return new Promise(function(_0x2c1aff,_0x555e38){var _0x4f3492=new AWS['S3']({'accessKeyId':_0x232353,'secretAccessKey':_0x23d50a,'region':_0x45e440});_0x4f3492[_0x45e9('0x66')]({'Bucket':_0x591cce,'Key':_0x5d2416,'Body':_0x150895},function(_0x2ec853,_0x51e81c){if(_0x2ec853){return _0x555e38(_0x2ec853);}else{return _0x2c1aff(_0x51e81c);}});});}function startTranscribe(_0x4e8820,_0x9a4792,_0x4a7853,_0x5f3c60,_0x3d7b46,_0x4848c5){return new Promise(function(_0x4d6b82,_0x5abc19){var _0x4e95b9=new AWS['TranscribeService']({'accessKeyId':_0x9a4792,'secretAccessKey':_0x4e8820,'region':_0x4a7853});_0x4e95b9['startTranscriptionJob']({'TranscriptionJobName':_0x5f3c60,'LanguageCode':_0x3d7b46,'Media':{'MediaFileUri':_0x4848c5}},function(_0xfc7427,_0x133a96){if(_0xfc7427){return _0x5abc19(_0xfc7427);}else{return _0x4d6b82(_0x133a96);}});});}function transcribe(_0x47b21f,_0x145eee,_0x495036,_0x187b7c,_0x52b371,_0x215cac,_0x309de){return new Promise(function(_0x41055f,_0x5a0be8){var _0x548168={};logger['info'](util['format']('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x47b21f,_0x52b371));return uploadFile(_0x145eee,_0x495036,_0x187b7c,_0x52b371,path[_0x45e9('0x67')](_0x215cac),fs[_0x45e9('0x68')](_0x215cac))['then'](function(_0x4cbf34){logger[_0x45e9('0x5f')](util[_0x45e9('0x5b')](_0x45e9('0x69'),_0x47b21f,_0x52b371,_0x4cbf34[_0x45e9('0x6a')]));_0x548168[_0x45e9('0x6b')]=_0x4cbf34[_0x45e9('0x6c')];_0x548168[_0x45e9('0x6d')]=_0x4cbf34['Location'];logger[_0x45e9('0x5f')](util['format']('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x47b21f));return startTranscribe(_0x145eee,_0x495036,_0x187b7c,uuidv4(),_0x309de,_0x4cbf34[_0x45e9('0x6a')]);})['then'](function(_0x3711e4){logger[_0x45e9('0x5f')](util[_0x45e9('0x5b')](_0x45e9('0x6e'),_0x47b21f,_0x3711e4[_0x45e9('0x6f')][_0x45e9('0x70')]));_0x548168[_0x45e9('0x71')]=_0x3711e4[_0x45e9('0x6f')][_0x45e9('0x70')];_0x548168['transcribeStatus']=_0x3711e4['TranscriptionJob'][_0x45e9('0x72')];return _0x41055f(_0x548168);})['catch'](function(_0x83fd43){return _0x5a0be8(_0x83fd43);});});}exports[_0x45e9('0x73')]=function(_0x53368c,_0x55a2b0,_0x247a8e){var _0x32e42b;var _0xc2fdb4;var _0x4798bb;var _0x2370b9=require(_0x45e9('0x47'));return db[_0x45e9('0x3b')]['findOne']({'where':{'id':_0x53368c[_0x45e9('0x41')]['id']}})[_0x45e9('0x24')](function(_0x4064a0){if(_0x4064a0){var _0x358aed=util['format']('%s.cypher',_0x4064a0[_0x45e9('0x49')]);if(fs[_0x45e9('0x4b')](_0x358aed)){cypher=!![];return _0x2370b9[_0x45e9('0x4c')](_0x358aed,_0x4064a0['value'],config[_0x45e9('0x4d')]['recording'])['then'](function(){return _0x4064a0;});}return _0x4064a0;}})[_0x45e9('0x24')](function(_0x24df7e){if(!_0x24df7e){throw new db[(_0x45e9('0x4f'))]['ValidationError'](_0x45e9('0x74'));}_0xc2fdb4=_0x24df7e;return db[_0x45e9('0x75')][_0x45e9('0x76')]({'where':{'id':0x1}});})[_0x45e9('0x24')](handleEntityNotFound(_0x55a2b0,null))[_0x45e9('0x24')](function(_0x53fd3d){if(_0x53fd3d){_0x32e42b=_0x53fd3d;if(!_0x32e42b['transcribe']||!_0x32e42b['transcribeAccountId']||!_0x32e42b[_0x45e9('0x77')]||!_0x32e42b['language']||!_0x32e42b['bucket']){throw new db[(_0x45e9('0x4f'))][(_0x45e9('0x5c'))](_0x45e9('0x78'));}if(_0x53368c[_0x45e9('0x45')][_0x45e9('0x79')]&&(!_0x32e42b[_0x45e9('0x7a')]||!_0x32e42b['sentimentAccountId']||!_0x32e42b[_0x45e9('0x7b')]||!_0x32e42b[_0x45e9('0x7c')]||!_0x32e42b['bucket'])){throw new db[(_0x45e9('0x4f'))][(_0x45e9('0x5c'))](_0x45e9('0x7d'));}return db[_0x45e9('0x7e')][_0x45e9('0x76')]({'where':{'id':_0x32e42b['transcribeAccountId']}});}})[_0x45e9('0x24')](function(_0x39efda){if(!_0x39efda){throw new db[(_0x45e9('0x4f'))][(_0x45e9('0x5c'))](_0x45e9('0x7f'));}if(!_0x39efda['data1']||!_0x39efda[_0x45e9('0x80')]){throw new db[(_0x45e9('0x4f'))][(_0x45e9('0x5c'))](_0x45e9('0x81'));}_0x4798bb=_0x39efda;return getBucketslist(_0x4798bb[_0x45e9('0x82')],_0x4798bb[_0x45e9('0x80')],_0x32e42b[_0x45e9('0x77')]);})['then'](function(_0x54be0c){if(_0x54be0c&&_0x54be0c[_0x45e9('0x83')]){var _0x2bff67=_[_0x45e9('0x43')](_0x54be0c['Buckets'],function(_0x4e634f){return _0x4e634f['Name']===_0x32e42b[_0x45e9('0x6b')];});if(!_0x2bff67){logger['info'](util[_0x45e9('0x5b')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x53368c['params']['id'],_0x32e42b['bucket']));return createBucket(_0x4798bb[_0x45e9('0x82')],_0x4798bb['data2'],_0x32e42b[_0x45e9('0x77')],_0x32e42b[_0x45e9('0x6b')]);}logger[_0x45e9('0x5f')](util[_0x45e9('0x5b')](_0x45e9('0x84'),_0x53368c[_0x45e9('0x41')]['id'],_0x32e42b[_0x45e9('0x6b')]));return;}})[_0x45e9('0x24')](function(_0x4b1af5){if(_0xc2fdb4[_0x45e9('0x85')]===_0x45e9('0x86')){return transcribe(_0x53368c['params']['id'],_0x4798bb[_0x45e9('0x82')],_0x4798bb[_0x45e9('0x80')],_0x32e42b['transcribeRegion'],_0x32e42b[_0x45e9('0x6b')],_0xc2fdb4[_0x45e9('0x49')],_0x32e42b[_0x45e9('0x7c')]);}else{logger[_0x45e9('0x5f')](util[_0x45e9('0x5b')](_0x45e9('0x87'),_0x53368c['params']['id']));return{'transcribeStatus':_0x45e9('0x88')};}})[_0x45e9('0x24')](function(_0x4aa266){if(_0x4aa266){_0x4aa266[_0x45e9('0x89')]=_0x53368c[_0x45e9('0x45')][_0x45e9('0x79')];return _0xc2fdb4[_0x45e9('0x8a')](_0x4aa266);}})['then'](respondWithResult(_0x55a2b0,null))[_0x45e9('0x3f')](handleError(_0x55a2b0,null));};function writeFile(_0xcc61a4,_0x4a1c1b){return new Promise(function(_0x4527b1,_0x4ed956){fs[_0x45e9('0x8b')](_0x4a1c1b,_0xcc61a4,function(_0x1dcbe1,_0x99a450){if(_0x1dcbe1){return _0x4ed956(_0x1dcbe1);}else{return _0x4527b1(_0x99a450);}});});}exports[_0x45e9('0x8c')]=function(_0x3435df,_0x4ff630,_0x354602){return db[_0x45e9('0x3b')][_0x45e9('0x76')]({'where':{'id':_0x3435df[_0x45e9('0x41')]['id']}})[_0x45e9('0x24')](handleEntityNotFound(_0x4ff630))[_0x45e9('0x24')](function(_0x563da8){if(_0x563da8&&_0x563da8['fileText']){var _0x3cc8ce=_0x563da8[_0x45e9('0x8d')];var _0x11f7e8=config['root']+_0x45e9('0x8e')+_0x563da8['id']+_0x45e9('0x8f');if(fs[_0x45e9('0x4b')](_0x11f7e8)){return _0x11f7e8;}return writeFile(_0x3cc8ce,_0x11f7e8)[_0x45e9('0x24')](function(){return _0x11f7e8;});}else{throw new db[(_0x45e9('0x4f'))][(_0x45e9('0x5c'))]('Transcript\x20not\x20available');}})['then'](function(_0x4f9430){return _0x4ff630['download'](_0x4f9430);})[_0x45e9('0x3f')](handleError(_0x4ff630));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 06644b1..7c68d88 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 _0xd9db=['request-promise','path','rimraf','../../config/environment','./voiceRecording.attributes','exports','voice_recordings','uniqueid','lodash','util','api','moment','bluebird'];(function(_0x23c888,_0x1a2425){var _0x3448d8=function(_0x1e6bf3){while(--_0x1e6bf3){_0x23c888['push'](_0x23c888['shift']());}};_0x3448d8(++_0x1a2425);}(_0xd9db,0x8a));var _0xbd9d=function(_0x3045ab,_0x2eb79e){_0x3045ab=_0x3045ab-0x0;var _0x3143d6=_0xd9db[_0x3045ab];return _0x3143d6;};'use strict';var _=require(_0xbd9d('0x0'));var util=require(_0xbd9d('0x1'));var logger=require('../../config/logger')(_0xbd9d('0x2'));var moment=require(_0xbd9d('0x3'));var BPromise=require(_0xbd9d('0x4'));var rp=require(_0xbd9d('0x5'));var fs=require('fs');var path=require(_0xbd9d('0x6'));var rimraf=require(_0xbd9d('0x7'));var config=require(_0xbd9d('0x8'));var attributes=require(_0xbd9d('0x9'));module[_0xbd9d('0xa')]=function(_0xdbad26,_0x326406){return _0xdbad26['define']('VoiceRecording',attributes,{'tableName':_0xbd9d('0xb'),'paranoid':![],'indexes':[{'name':_0xbd9d('0xc'),'fields':[_0xbd9d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7c5a=['./voiceRecording.attributes','define','voice_recordings','uniqueid','util','../../config/logger','path','rimraf'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x7c5a,0x184));var _0xa7c5=function(_0x444070,_0x3b35ea){_0x444070=_0x444070-0x0;var _0x44104a=_0x7c5a[_0x444070];return _0x44104a;};'use strict';var _=require('lodash');var util=require(_0xa7c5('0x0'));var logger=require(_0xa7c5('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa7c5('0x2'));var rimraf=require(_0xa7c5('0x3'));var config=require('../../config/environment');var attributes=require(_0xa7c5('0x4'));module['exports']=function(_0x2c0419,_0x3a50f9){return _0x2c0419[_0xa7c5('0x5')]('VoiceRecording',attributes,{'tableName':_0xa7c5('0x6'),'paranoid':![],'indexes':[{'name':_0xa7c5('0x7'),'fields':[_0xa7c5('0x7')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 2365c40..1c002c8 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 _0x90b1=['request','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','limit','then','../../components/encryptor','findOne','callRecordingEncryption','create','existsSync','%s.cypher','encryptFile','value','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','CreateVoiceRecording','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','http'];(function(_0x595bd1,_0xb1e7a){var _0xd0344f=function(_0x5eb2fd){while(--_0x5eb2fd){_0x595bd1['push'](_0x595bd1['shift']());}};_0xd0344f(++_0xb1e7a);}(_0x90b1,0x1bb));var _0x190b=function(_0x58fc2b,_0x368286){_0x58fc2b=_0x58fc2b-0x0;var _0x3937ce=_0x90b1[_0x58fc2b];return _0x3937ce;};'use strict';var _=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var moment=require(_0x190b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x190b('0x3'));var db=require(_0x190b('0x4'))['db'];var utils=require(_0x190b('0x5'));var logger=require(_0x190b('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x190b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x34a689,_0x3b57f7,_0x626aa1){return new BPromise(function(_0x311161,_0x802924){return client[_0x190b('0x8')](_0x34a689,_0x626aa1)['then'](function(_0x14b93d){logger[_0x190b('0x9')](_0x190b('0xa'),_0x3b57f7,_0x190b('0xb'));logger[_0x190b('0xc')](_0x190b('0xd'),_0x3b57f7,_0x190b('0xb'),JSON[_0x190b('0xe')](_0x14b93d));if(_0x14b93d['error']){if(_0x14b93d[_0x190b('0xf')][_0x190b('0x10')]===0x1f4){logger['error'](_0x190b('0xa'),_0x3b57f7,_0x14b93d[_0x190b('0xf')][_0x190b('0x11')]);return _0x802924(_0x14b93d[_0x190b('0xf')][_0x190b('0x11')]);}logger[_0x190b('0xf')](_0x190b('0xa'),_0x3b57f7,_0x14b93d[_0x190b('0xf')][_0x190b('0x11')]);return _0x311161(_0x14b93d[_0x190b('0xf')][_0x190b('0x11')]);}else{logger[_0x190b('0x9')](_0x190b('0xa'),_0x3b57f7,_0x190b('0xb'));_0x311161(_0x14b93d[_0x190b('0x12')][_0x190b('0x11')]);}})[_0x190b('0x13')](function(_0x5c63d9){logger[_0x190b('0xf')]('VoiceRecording,\x20%s,\x20%s',_0x3b57f7,_0x5c63d9);_0x802924(_0x5c63d9);});});}exports[_0x190b('0x14')]=function(_0x21e458){var _0x56d07a=this;return new Promise(function(_0x16c009,_0x50a3c4){return db[_0x190b('0x15')][_0x190b('0x16')](_0x21e458[_0x190b('0x17')],{'raw':_0x21e458[_0x190b('0x18')]?_0x21e458[_0x190b('0x18')][_0x190b('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x21e458['options']?_0x21e458[_0x190b('0x18')][_0x190b('0x1a')]||null:null,'attributes':_0x21e458['options']?_0x21e458[_0x190b('0x18')]['attributes']||null:null,'limit':_0x21e458['options']?_0x21e458[_0x190b('0x18')][_0x190b('0x1b')]||null:null})[_0x190b('0x1c')](function(_0x4c0b6e){logger[_0x190b('0x9')](_0x190b('0x14'),_0x21e458);logger[_0x190b('0xc')](_0x190b('0x14'),_0x21e458,JSON[_0x190b('0xe')](_0x4c0b6e));_0x16c009(_0x4c0b6e);})[_0x190b('0x13')](function(_0x1bce97){logger['error']('UpdateVoiceRecording',_0x1bce97[_0x190b('0x11')],_0x21e458);_0x50a3c4(_0x56d07a[_0x190b('0xf')](0x1f4,_0x1bce97['message']));});});};exports['CreateVoiceRecording']=function(_0x3260d5){var _0x4e2a93=this;return new Promise(function(_0x328e5e,_0x3b6aaf){var _0x51f8b4=require(_0x190b('0x1d'));var _0x1deea6;return db['Setting'][_0x190b('0x1e')]({'attributes':['id',_0x190b('0x1f')],'where':{'id':0x1},'raw':!![]})[_0x190b('0x1c')](function(_0x494f3f){_0x1deea6=_0x494f3f;return db['VoiceRecording'][_0x190b('0x20')](_0x3260d5['body']);})[_0x190b('0x1c')](function(_0x19e421){if(_0x1deea6['callRecordingEncryption']&&fs[_0x190b('0x21')](_0x19e421['value'])){var _0x40d060=util['format'](_0x190b('0x22'),_0x19e421['value']);return _0x51f8b4[_0x190b('0x23')](_0x19e421[_0x190b('0x24')],_0x40d060,config['secrets'][_0x190b('0x25')])[_0x190b('0x1c')](function(){fs[_0x190b('0x26')](_0x19e421[_0x190b('0x24')]);logger[_0x190b('0x9')](_0x190b('0x27'));return _0x19e421;});}return _0x19e421;})[_0x190b('0x1c')](function(_0x248919){logger['info']('CreateVoiceRecording',_0x3260d5);logger[_0x190b('0xc')](_0x190b('0x28'),_0x3260d5,JSON['stringify'](_0x248919));_0x328e5e(_0x248919);})[_0x190b('0x13')](function(_0x2dcd39){logger[_0x190b('0xf')](_0x190b('0x28'),_0x2dcd39[_0x190b('0x11')],_0x3260d5);_0x3b6aaf(_0x4e2a93[_0x190b('0xf')](0x1f4,_0x2dcd39[_0x190b('0x11')]));});});}; \ No newline at end of file +var _0x5430=['info','request\x20sent','debug','stringify','error','code','VoiceRecording,\x20%s,\x20%s','message','result','UpdateVoiceRecording','VoiceRecording','options','raw','limit','catch','CreateVoiceRecording','../../components/encryptor','findOne','callRecordingEncryption','create','body','existsSync','format','%s.cypher','value','encryptFile','secrets','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','jayson/promise','client','http','request','then'];(function(_0x3d762a,_0x10470c){var _0x163698=function(_0x61549f){while(--_0x61549f){_0x3d762a['push'](_0x3d762a['shift']());}};_0x163698(++_0x10470c);}(_0x5430,0x10c));var _0x0543=function(_0x2039df,_0x2dec90){_0x2039df=_0x2039df-0x0;var _0x5d8294=_0x5430[_0x2039df];return _0x5d8294;};'use strict';var _=require(_0x0543('0x0'));var util=require(_0x0543('0x1'));var moment=require(_0x0543('0x2'));var BPromise=require(_0x0543('0x3'));var rs=require(_0x0543('0x4'));var fs=require('fs');var Redis=require(_0x0543('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0543('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0543('0x7'));var client=jayson[_0x0543('0x8')][_0x0543('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x319568,_0x46bca7,_0x5ac352){return new BPromise(function(_0x372974,_0x7b8280){return client[_0x0543('0xa')](_0x319568,_0x5ac352)[_0x0543('0xb')](function(_0x2fb723){logger[_0x0543('0xc')]('VoiceRecording,\x20%s,\x20%s',_0x46bca7,_0x0543('0xd'));logger[_0x0543('0xe')]('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x46bca7,_0x0543('0xd'),JSON[_0x0543('0xf')](_0x2fb723));if(_0x2fb723[_0x0543('0x10')]){if(_0x2fb723[_0x0543('0x10')][_0x0543('0x11')]===0x1f4){logger[_0x0543('0x10')](_0x0543('0x12'),_0x46bca7,_0x2fb723[_0x0543('0x10')][_0x0543('0x13')]);return _0x7b8280(_0x2fb723[_0x0543('0x10')][_0x0543('0x13')]);}logger[_0x0543('0x10')]('VoiceRecording,\x20%s,\x20%s',_0x46bca7,_0x2fb723[_0x0543('0x10')][_0x0543('0x13')]);return _0x372974(_0x2fb723['error']['message']);}else{logger[_0x0543('0xc')](_0x0543('0x12'),_0x46bca7,_0x0543('0xd'));_0x372974(_0x2fb723[_0x0543('0x14')][_0x0543('0x13')]);}})['catch'](function(_0xe69a3d){logger[_0x0543('0x10')](_0x0543('0x12'),_0x46bca7,_0xe69a3d);_0x7b8280(_0xe69a3d);});});}exports[_0x0543('0x15')]=function(_0x20b396){var _0x285080=this;return new Promise(function(_0x577cf0,_0x5eb03e){return db[_0x0543('0x16')]['update'](_0x20b396['body'],{'raw':_0x20b396[_0x0543('0x17')]?_0x20b396[_0x0543('0x17')][_0x0543('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20b396['options']?_0x20b396[_0x0543('0x17')]['where']||null:null,'attributes':_0x20b396[_0x0543('0x17')]?_0x20b396[_0x0543('0x17')]['attributes']||null:null,'limit':_0x20b396[_0x0543('0x17')]?_0x20b396[_0x0543('0x17')][_0x0543('0x19')]||null:null})[_0x0543('0xb')](function(_0x37347e){logger[_0x0543('0xc')]('UpdateVoiceRecording',_0x20b396);logger['debug']('UpdateVoiceRecording',_0x20b396,JSON[_0x0543('0xf')](_0x37347e));_0x577cf0(_0x37347e);})[_0x0543('0x1a')](function(_0x15ebeb){logger[_0x0543('0x10')](_0x0543('0x15'),_0x15ebeb[_0x0543('0x13')],_0x20b396);_0x5eb03e(_0x285080[_0x0543('0x10')](0x1f4,_0x15ebeb[_0x0543('0x13')]));});});};exports[_0x0543('0x1b')]=function(_0xf1eccf){var _0x40a261=this;return new Promise(function(_0x21fc63,_0x547a88){var _0x25e6f1=require(_0x0543('0x1c'));var _0x30ad9e;return db['Setting'][_0x0543('0x1d')]({'attributes':['id',_0x0543('0x1e')],'where':{'id':0x1},'raw':!![]})[_0x0543('0xb')](function(_0x10b881){_0x30ad9e=_0x10b881;return db['VoiceRecording'][_0x0543('0x1f')](_0xf1eccf[_0x0543('0x20')]);})['then'](function(_0x576084){if(_0x30ad9e[_0x0543('0x1e')]&&fs[_0x0543('0x21')](_0x576084['value'])){var _0x3b879b=util[_0x0543('0x22')](_0x0543('0x23'),_0x576084[_0x0543('0x24')]);return _0x25e6f1[_0x0543('0x25')](_0x576084[_0x0543('0x24')],_0x3b879b,config[_0x0543('0x26')]['recording'])[_0x0543('0xb')](function(){fs['unlink'](_0x576084[_0x0543('0x24')]);logger[_0x0543('0xc')](_0x0543('0x27'));return _0x576084;});}return _0x576084;})[_0x0543('0xb')](function(_0x28307f){logger['info'](_0x0543('0x1b'),_0xf1eccf);logger['debug'](_0x0543('0x1b'),_0xf1eccf,JSON[_0x0543('0xf')](_0x28307f));_0x21fc63(_0x28307f);})[_0x0543('0x1a')](function(_0x327027){logger['error'](_0x0543('0x1b'),_0x327027['message'],_0xf1eccf);_0x547a88(_0x40a261[_0x0543('0x10')](0x1f4,_0x327027[_0x0543('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 8d38de0..41c1166 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 _0xddaf=['../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','index','get','/describe','describe','isAuthenticated','/:id','update','delete','destroy','multer','util','path','express','Router','fs-extra'];(function(_0x5a9756,_0x2a94c7){var _0x40e0f6=function(_0x45464b){while(--_0x45464b){_0x5a9756['push'](_0x5a9756['shift']());}};_0x40e0f6(++_0x2a94c7);}(_0xddaf,0x13e));var _0xfdda=function(_0x55d5c9,_0x11781b){_0x55d5c9=_0x55d5c9-0x0;var _0x2332b7=_0xddaf[_0x55d5c9];return _0x2332b7;};'use strict';var multer=require(_0xfdda('0x0'));var util=require(_0xfdda('0x1'));var path=require(_0xfdda('0x2'));var timeout=require('connect-timeout');var express=require(_0xfdda('0x3'));var router=express[_0xfdda('0x4')]();var fs_extra=require(_0xfdda('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xfdda('0x6'));var config=require(_0xfdda('0x7'));var controller=require(_0xfdda('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xfdda('0x9')]);router[_0xfdda('0xa')](_0xfdda('0xb'),auth['isAuthenticated'](),controller[_0xfdda('0xc')]);router[_0xfdda('0xa')]('/:id',auth[_0xfdda('0xd')](),controller['show']);router['post']('/',auth[_0xfdda('0xd')](),controller['create']);router['put'](_0xfdda('0xe'),auth[_0xfdda('0xd')](),controller[_0xfdda('0xf')]);router[_0xfdda('0x10')]('/:id',auth[_0xfdda('0xd')](),controller[_0xfdda('0x11')]);module['exports']=router; \ No newline at end of file +var _0x2303=['../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x4ea413,_0x51ff3a){var _0x51cf25=function(_0x3c6456){while(--_0x3c6456){_0x4ea413['push'](_0x4ea413['shift']());}};_0x51cf25(++_0x51ff3a);}(_0x2303,0xf5));var _0x3230=function(_0x549fb4,_0x57140c){_0x549fb4=_0x549fb4-0x0;var _0xc64c37=_0x2303[_0x549fb4];return _0xc64c37;};'use strict';var multer=require(_0x3230('0x0'));var util=require(_0x3230('0x1'));var path=require(_0x3230('0x2'));var timeout=require(_0x3230('0x3'));var express=require(_0x3230('0x4'));var router=express['Router']();var fs_extra=require(_0x3230('0x5'));var auth=require(_0x3230('0x6'));var interaction=require(_0x3230('0x7'));var config=require(_0x3230('0x8'));var controller=require(_0x3230('0x9'));router[_0x3230('0xa')]('/',auth[_0x3230('0xb')](),controller['index']);router['get'](_0x3230('0xc'),auth['isAuthenticated'](),controller[_0x3230('0xd')]);router[_0x3230('0xa')](_0x3230('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x3230('0xf')]('/',auth['isAuthenticated'](),controller[_0x3230('0x10')]);router[_0x3230('0x11')]('/:id',auth[_0x3230('0xb')](),controller[_0x3230('0x12')]);router['delete'](_0x3230('0xe'),auth[_0x3230('0xb')](),controller[_0x3230('0x13')]);module[_0x3230('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index b099b66..0d68d63 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 _0x0e72=['attended','STRING','sequelize','moment','exports','ENUM','blind'];(function(_0x5270a6,_0x1a157c){var _0x3e1a14=function(_0x3c9e02){while(--_0x3c9e02){_0x5270a6['push'](_0x5270a6['shift']());}};_0x3e1a14(++_0x1a157c);}(_0x0e72,0x121));var _0x20e7=function(_0x353310,_0x426be5){_0x353310=_0x353310-0x0;var _0x571b19=_0x0e72[_0x353310];return _0x571b19;};'use strict';var Sequelize=require(_0x20e7('0x0'));var moment=require(_0x20e7('0x1'));module[_0x20e7('0x2')]={'type':{'type':Sequelize[_0x20e7('0x3')](_0x20e7('0x4'),_0x20e7('0x5'))},'result':{'type':Sequelize[_0x20e7('0x6')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0x20e7('0x6')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0x20e7('0x6')]},'transfererconnectedlinename':{'type':Sequelize[_0x20e7('0x6')]},'transfereraccountcode':{'type':Sequelize[_0x20e7('0x6')]},'transferercontext':{'type':Sequelize[_0x20e7('0x6')]},'transfererexten':{'type':Sequelize[_0x20e7('0x6')]},'transfererlinkedid':{'type':Sequelize[_0x20e7('0x6')]},'transfereechannel':{'type':Sequelize[_0x20e7('0x6')]},'transfereecalleridnum':{'type':Sequelize[_0x20e7('0x6')]},'transfereecalleridname':{'type':Sequelize[_0x20e7('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0x20e7('0x6')]},'transfereeaccountcode':{'type':Sequelize[_0x20e7('0x6')]},'transfereecontext':{'type':Sequelize[_0x20e7('0x6')]},'transfereeexten':{'type':Sequelize[_0x20e7('0x6')]},'transfereelinkedid':{'type':Sequelize[_0x20e7('0x6')]},'isexternal':{'type':Sequelize[_0x20e7('0x3')]('Yes','No')},'context':{'type':Sequelize[_0x20e7('0x6')]},'extension':{'type':Sequelize[_0x20e7('0x6')]}}; \ No newline at end of file +var _0xcf2b=['blind','attended','STRING','Yes','moment','exports','ENUM'];(function(_0x251cb1,_0x26bc4f){var _0x335d05=function(_0x5b6230){while(--_0x5b6230){_0x251cb1['push'](_0x251cb1['shift']());}};_0x335d05(++_0x26bc4f);}(_0xcf2b,0x97));var _0xbcf2=function(_0x323430,_0x3d2b6d){_0x323430=_0x323430-0x0;var _0x9eecd1=_0xcf2b[_0x323430];return _0x9eecd1;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xbcf2('0x0'));module[_0xbcf2('0x1')]={'type':{'type':Sequelize[_0xbcf2('0x2')](_0xbcf2('0x3'),_0xbcf2('0x4'))},'result':{'type':Sequelize[_0xbcf2('0x5')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0xbcf2('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0xbcf2('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0xbcf2('0x5')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0xbcf2('0x5')]},'transfererexten':{'type':Sequelize[_0xbcf2('0x5')]},'transfererlinkedid':{'type':Sequelize[_0xbcf2('0x5')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0xbcf2('0x5')]},'transfereecalleridname':{'type':Sequelize[_0xbcf2('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xbcf2('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0xbcf2('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0xbcf2('0x5')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0xbcf2('0x5')]},'transfereelinkedid':{'type':Sequelize[_0xbcf2('0x5')]},'isexternal':{'type':Sequelize[_0xbcf2('0x2')](_0xbcf2('0x6'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xbcf2('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index ed6bc43..4bac1f9 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 _0xb523=['where','filters','pick','filter','VIRTUAL','merge','options','then','include','findAll','rows','catch','show','keys','rawAttributes','includeAll','find','create','update','body','params','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','reject','save','destroy','error','stack','name','send','index','VoiceTransferReport','fieldName','type','model','map','query','attributes','intersection','fields','length','nolimit','order','sort'];(function(_0x285a67,_0x13833d){var _0x1947c3=function(_0x4f8b77){while(--_0x4f8b77){_0x285a67['push'](_0x285a67['shift']());}};_0x1947c3(++_0x13833d);}(_0xb523,0x14e));var _0x3b52=function(_0x2368bb,_0x3fc8ad){_0x2368bb=_0x2368bb-0x0;var _0x36d247=_0xb523[_0x2368bb];return _0x36d247;};'use strict';var emlformat=require(_0x3b52('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3b52('0x1'));var rp=require(_0x3b52('0x2'));var moment=require(_0x3b52('0x3'));var BPromise=require(_0x3b52('0x4'));var Mustache=require(_0x3b52('0x5'));var util=require(_0x3b52('0x6'));var path=require(_0x3b52('0x7'));var sox=require('sox');var csv=require(_0x3b52('0x8'));var ejs=require(_0x3b52('0x9'));var fs=require('fs');var fs_extra=require(_0x3b52('0xa'));var _=require(_0x3b52('0xb'));var squel=require(_0x3b52('0xc'));var crypto=require('crypto');var jsforce=require(_0x3b52('0xd'));var deskjs=require(_0x3b52('0xe'));var toCsv=require(_0x3b52('0x8'));var querystring=require(_0x3b52('0xf'));var Papa=require(_0x3b52('0x10'));var Redis=require(_0x3b52('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x3b52('0x12'));var as=require(_0x3b52('0x13'));var hardwareService=require(_0x3b52('0x14'));var logger=require(_0x3b52('0x15'))(_0x3b52('0x16'));var utils=require(_0x3b52('0x17'));var config=require(_0x3b52('0x18'));var licenseUtil=require(_0x3b52('0x19'));var db=require(_0x3b52('0x1a'))['db'];function respondWithStatusCode(_0x4b515e,_0x354398){_0x354398=_0x354398||0xcc;return function(_0x501c4c){if(_0x501c4c){return _0x4b515e[_0x3b52('0x1b')](_0x354398);}return _0x4b515e['status'](_0x354398)[_0x3b52('0x1c')]();};}function respondWithResult(_0x1ce7b5,_0x3d5a43){_0x3d5a43=_0x3d5a43||0xc8;return function(_0x3427a6){if(_0x3427a6){return _0x1ce7b5[_0x3b52('0x1d')](_0x3d5a43)[_0x3b52('0x1e')](_0x3427a6);}};}function respondWithFilteredResult(_0x5b80a7,_0x100fcb){return function(_0x3d11ce){if(_0x3d11ce){var _0x3a8a18=typeof _0x100fcb[_0x3b52('0x1f')]===_0x3b52('0x20')&&typeof _0x100fcb[_0x3b52('0x21')]==='undefined';var _0x209ba3=_0x3d11ce[_0x3b52('0x22')];var _0x3d6b3a=_0x3a8a18?0x0:_0x100fcb[_0x3b52('0x1f')];var _0x23ca54=_0x3a8a18?_0x3d11ce[_0x3b52('0x22')]:_0x100fcb[_0x3b52('0x1f')]+_0x100fcb[_0x3b52('0x21')];var _0x317a20;if(_0x23ca54>=_0x209ba3){_0x23ca54=_0x209ba3;_0x317a20=0xc8;}else{_0x317a20=0xce;}_0x5b80a7['status'](_0x317a20);return _0x5b80a7['set']('Content-Range',_0x3d6b3a+'-'+_0x23ca54+'/'+_0x209ba3)['json'](_0x3d11ce);}return null;};}function patchUpdates(_0x24b6a4){return function(_0x1c300f){try{jsonpatch['apply'](_0x1c300f,_0x24b6a4,!![]);}catch(_0x2cbe63){return BPromise[_0x3b52('0x23')](_0x2cbe63);}return _0x1c300f[_0x3b52('0x24')]();};}function saveUpdates(_0x4b4242,_0x5a3602){return function(_0x86dfe1){if(_0x86dfe1){return _0x86dfe1['update'](_0x4b4242)['then'](function(_0x17d2ba){return _0x17d2ba;});}return null;};}function removeEntity(_0x173531,_0xd0777){return function(_0x339ed3){if(_0x339ed3){return _0x339ed3[_0x3b52('0x25')]()['then'](function(){_0x173531['status'](0xcc)[_0x3b52('0x1c')]();});}};}function handleEntityNotFound(_0x3eedda,_0x56369f){return function(_0x9094cb){if(!_0x9094cb){_0x3eedda['sendStatus'](0x194);}return _0x9094cb;};}function handleError(_0x4b4b25,_0x5674aa){_0x5674aa=_0x5674aa||0x1f4;return function(_0x16a8d5){logger[_0x3b52('0x26')](_0x16a8d5[_0x3b52('0x27')]);if(_0x16a8d5[_0x3b52('0x28')]){delete _0x16a8d5[_0x3b52('0x28')];}_0x4b4b25[_0x3b52('0x1d')](_0x5674aa)[_0x3b52('0x29')](_0x16a8d5);};}exports[_0x3b52('0x2a')]=function(_0x4296b0,_0x44cf00){var _0x1f4c63={},_0x238220={},_0x218c95={'count':0x0,'rows':[]};var _0x399ceb=_['map'](db[_0x3b52('0x2b')]['rawAttributes'],function(_0x137f2d){return{'name':_0x137f2d[_0x3b52('0x2c')],'type':_0x137f2d[_0x3b52('0x2d')]['key']};});_0x238220[_0x3b52('0x2e')]=_[_0x3b52('0x2f')](_0x399ceb,'name');_0x238220[_0x3b52('0x30')]=_['keys'](_0x4296b0[_0x3b52('0x30')]);_0x238220['filters']=_['intersection'](_0x238220[_0x3b52('0x2e')],_0x238220[_0x3b52('0x30')]);_0x1f4c63[_0x3b52('0x31')]=_[_0x3b52('0x32')](_0x238220[_0x3b52('0x2e')],qs[_0x3b52('0x33')](_0x4296b0[_0x3b52('0x30')][_0x3b52('0x33')]));_0x1f4c63[_0x3b52('0x31')]=_0x1f4c63[_0x3b52('0x31')][_0x3b52('0x34')]?_0x1f4c63[_0x3b52('0x31')]:_0x238220[_0x3b52('0x2e')];if(!_0x4296b0[_0x3b52('0x30')]['hasOwnProperty'](_0x3b52('0x35'))){_0x1f4c63['limit']=qs[_0x3b52('0x21')](_0x4296b0[_0x3b52('0x30')][_0x3b52('0x21')]);_0x1f4c63['offset']=qs['offset'](_0x4296b0['query'][_0x3b52('0x1f')]);}_0x1f4c63[_0x3b52('0x36')]=qs['sort'](_0x4296b0[_0x3b52('0x30')][_0x3b52('0x37')]);_0x1f4c63[_0x3b52('0x38')]=qs[_0x3b52('0x39')](_[_0x3b52('0x3a')](_0x4296b0[_0x3b52('0x30')],_0x238220[_0x3b52('0x39')]),_0x399ceb);if(_0x4296b0[_0x3b52('0x30')][_0x3b52('0x3b')]){_0x1f4c63['where']=_['merge'](_0x1f4c63[_0x3b52('0x38')],{'$or':_['map'](_0x399ceb,function(_0x14649){if(_0x14649[_0x3b52('0x2d')]!==_0x3b52('0x3c')){var _0x250a48={};_0x250a48[_0x14649[_0x3b52('0x28')]]={'$like':'%'+_0x4296b0[_0x3b52('0x30')][_0x3b52('0x3b')]+'%'};return _0x250a48;}})});}_0x1f4c63=_[_0x3b52('0x3d')]({},_0x1f4c63,_0x4296b0[_0x3b52('0x3e')]);var _0x224b20={'where':_0x1f4c63[_0x3b52('0x38')]};return db[_0x3b52('0x2b')][_0x3b52('0x22')](_0x224b20)[_0x3b52('0x3f')](function(_0x574eba){_0x218c95['count']=_0x574eba;if(_0x4296b0['query']['includeAll']){_0x1f4c63[_0x3b52('0x40')]=[{'all':!![]}];}return db[_0x3b52('0x2b')][_0x3b52('0x41')](_0x1f4c63);})[_0x3b52('0x3f')](function(_0x5bfbc3){_0x218c95[_0x3b52('0x42')]=_0x5bfbc3;return _0x218c95;})[_0x3b52('0x3f')](respondWithFilteredResult(_0x44cf00,_0x1f4c63))[_0x3b52('0x43')](handleError(_0x44cf00,null));};exports[_0x3b52('0x44')]=function(_0x648907,_0x27c613){var _0x2cd08d={'raw':!![],'where':{'id':_0x648907['params']['id']}},_0x1b44df={};_0x1b44df[_0x3b52('0x2e')]=_[_0x3b52('0x45')](db['VoiceTransferReport'][_0x3b52('0x46')]);_0x1b44df['query']=_[_0x3b52('0x45')](_0x648907[_0x3b52('0x30')]);_0x1b44df['filters']=_['intersection'](_0x1b44df[_0x3b52('0x2e')],_0x1b44df[_0x3b52('0x30')]);_0x2cd08d[_0x3b52('0x31')]=_['intersection'](_0x1b44df[_0x3b52('0x2e')],qs['fields'](_0x648907[_0x3b52('0x30')][_0x3b52('0x33')]));_0x2cd08d[_0x3b52('0x31')]=_0x2cd08d[_0x3b52('0x31')]['length']?_0x2cd08d[_0x3b52('0x31')]:_0x1b44df['model'];if(_0x648907[_0x3b52('0x30')][_0x3b52('0x47')]){_0x2cd08d[_0x3b52('0x40')]=[{'all':!![]}];}_0x2cd08d=_[_0x3b52('0x3d')]({},_0x2cd08d,_0x648907['options']);return db[_0x3b52('0x2b')][_0x3b52('0x48')](_0x2cd08d)[_0x3b52('0x3f')](handleEntityNotFound(_0x27c613,null))[_0x3b52('0x3f')](respondWithResult(_0x27c613,null))[_0x3b52('0x43')](handleError(_0x27c613,null));};exports[_0x3b52('0x49')]=function(_0x3a9e5b,_0x5084ed){return db[_0x3b52('0x2b')][_0x3b52('0x49')](_0x3a9e5b['body'],{})[_0x3b52('0x3f')](respondWithResult(_0x5084ed,0xc9))['catch'](handleError(_0x5084ed,null));};exports[_0x3b52('0x4a')]=function(_0x5a9320,_0x241f32){if(_0x5a9320[_0x3b52('0x4b')]['id']){delete _0x5a9320[_0x3b52('0x4b')]['id'];}return db[_0x3b52('0x2b')][_0x3b52('0x48')]({'where':{'id':_0x5a9320[_0x3b52('0x4c')]['id']}})[_0x3b52('0x3f')](handleEntityNotFound(_0x241f32,null))[_0x3b52('0x3f')](saveUpdates(_0x5a9320[_0x3b52('0x4b')],null))[_0x3b52('0x3f')](respondWithResult(_0x241f32,null))[_0x3b52('0x43')](handleError(_0x241f32,null));};exports['destroy']=function(_0x255ddb,_0x221ca8){return db[_0x3b52('0x2b')][_0x3b52('0x48')]({'where':{'id':_0x255ddb['params']['id']}})[_0x3b52('0x3f')](handleEntityNotFound(_0x221ca8,null))[_0x3b52('0x3f')](removeEntity(_0x221ca8,null))[_0x3b52('0x43')](handleError(_0x221ca8,null));};exports['describe']=function(_0x17d867,_0xfd4024){return db[_0x3b52('0x2b')][_0x3b52('0x4d')]()['then'](respondWithResult(_0xfd4024,null))[_0x3b52('0x43')](handleError(_0xfd4024,null));}; \ No newline at end of file +var _0xd521=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','limit','undefined','count','set','apply','reject','save','then','error','name','index','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','sort','pick','VIRTUAL','filter','merge','where','includeAll','include','VoiceTransferReport','rows','rawAttributes','length','options','find','create','update','body','params','catch','destroy','describe','eml-format','request-promise','bluebird','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis'];(function(_0x5c7570,_0x156449){var _0x59b092=function(_0x5742b7){while(--_0x5742b7){_0x5c7570['push'](_0x5c7570['shift']());}};_0x59b092(++_0x156449);}(_0xd521,0x18b));var _0x1d52=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xd521[_0x28947d];return _0x12d2ee;};'use strict';var emlformat=require(_0x1d52('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1d52('0x1'));var moment=require('moment');var BPromise=require(_0x1d52('0x2'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x1d52('0x3'));var ejs=require(_0x1d52('0x4'));var fs=require('fs');var fs_extra=require(_0x1d52('0x5'));var _=require(_0x1d52('0x6'));var squel=require(_0x1d52('0x7'));var crypto=require(_0x1d52('0x8'));var jsforce=require(_0x1d52('0x9'));var deskjs=require(_0x1d52('0xa'));var toCsv=require(_0x1d52('0x3'));var querystring=require(_0x1d52('0xb'));var Papa=require('papaparse');var Redis=require(_0x1d52('0xc'));var authService=require(_0x1d52('0xd'));var qs=require(_0x1d52('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1d52('0xf'));var logger=require(_0x1d52('0x10'))(_0x1d52('0x11'));var utils=require(_0x1d52('0x12'));var config=require(_0x1d52('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x589f96,_0x2641ff){_0x2641ff=_0x2641ff||0xcc;return function(_0x3dc7e4){if(_0x3dc7e4){return _0x589f96['sendStatus'](_0x2641ff);}return _0x589f96[_0x1d52('0x14')](_0x2641ff)[_0x1d52('0x15')]();};}function respondWithResult(_0x480c92,_0x23e4a4){_0x23e4a4=_0x23e4a4||0xc8;return function(_0x52df9d){if(_0x52df9d){return _0x480c92[_0x1d52('0x14')](_0x23e4a4)[_0x1d52('0x16')](_0x52df9d);}};}function respondWithFilteredResult(_0x5969d9,_0xd4643b){return function(_0x19f409){if(_0x19f409){var _0xb80907=typeof _0xd4643b['offset']==='undefined'&&typeof _0xd4643b[_0x1d52('0x17')]===_0x1d52('0x18');var _0x31d17e=_0x19f409['count'];var _0x3b66a0=_0xb80907?0x0:_0xd4643b['offset'];var _0x37d505=_0xb80907?_0x19f409[_0x1d52('0x19')]:_0xd4643b['offset']+_0xd4643b['limit'];var _0x485e27;if(_0x37d505>=_0x31d17e){_0x37d505=_0x31d17e;_0x485e27=0xc8;}else{_0x485e27=0xce;}_0x5969d9[_0x1d52('0x14')](_0x485e27);return _0x5969d9[_0x1d52('0x1a')]('Content-Range',_0x3b66a0+'-'+_0x37d505+'/'+_0x31d17e)[_0x1d52('0x16')](_0x19f409);}return null;};}function patchUpdates(_0x63546b){return function(_0x3469bd){try{jsonpatch[_0x1d52('0x1b')](_0x3469bd,_0x63546b,!![]);}catch(_0x297bab){return BPromise[_0x1d52('0x1c')](_0x297bab);}return _0x3469bd[_0x1d52('0x1d')]();};}function saveUpdates(_0xb8c5b3,_0x3f9ac5){return function(_0x459f57){if(_0x459f57){return _0x459f57['update'](_0xb8c5b3)['then'](function(_0xf494d9){return _0xf494d9;});}return null;};}function removeEntity(_0x6de2c7,_0x120d13){return function(_0x40bc7a){if(_0x40bc7a){return _0x40bc7a['destroy']()[_0x1d52('0x1e')](function(){_0x6de2c7[_0x1d52('0x14')](0xcc)[_0x1d52('0x15')]();});}};}function handleEntityNotFound(_0x36795e,_0x43d95d){return function(_0x32dcae){if(!_0x32dcae){_0x36795e['sendStatus'](0x194);}return _0x32dcae;};}function handleError(_0x2ddf8d,_0xd34a67){_0xd34a67=_0xd34a67||0x1f4;return function(_0x3f1bc3){logger[_0x1d52('0x1f')](_0x3f1bc3['stack']);if(_0x3f1bc3['name']){delete _0x3f1bc3[_0x1d52('0x20')];}_0x2ddf8d[_0x1d52('0x14')](_0xd34a67)['send'](_0x3f1bc3);};}exports[_0x1d52('0x21')]=function(_0x4cb80f,_0x59acde){var _0x2fdf62={},_0x366999={},_0x2850be={'count':0x0,'rows':[]};var _0x4d922d=_['map'](db['VoiceTransferReport']['rawAttributes'],function(_0x39e546){return{'name':_0x39e546[_0x1d52('0x22')],'type':_0x39e546[_0x1d52('0x23')]['key']};});_0x366999[_0x1d52('0x24')]=_[_0x1d52('0x25')](_0x4d922d,'name');_0x366999[_0x1d52('0x26')]=_[_0x1d52('0x27')](_0x4cb80f[_0x1d52('0x26')]);_0x366999[_0x1d52('0x28')]=_[_0x1d52('0x29')](_0x366999['model'],_0x366999[_0x1d52('0x26')]);_0x2fdf62[_0x1d52('0x2a')]=_['intersection'](_0x366999[_0x1d52('0x24')],qs[_0x1d52('0x2b')](_0x4cb80f[_0x1d52('0x26')][_0x1d52('0x2b')]));_0x2fdf62[_0x1d52('0x2a')]=_0x2fdf62['attributes']['length']?_0x2fdf62['attributes']:_0x366999[_0x1d52('0x24')];if(!_0x4cb80f['query'][_0x1d52('0x2c')](_0x1d52('0x2d'))){_0x2fdf62['limit']=qs[_0x1d52('0x17')](_0x4cb80f[_0x1d52('0x26')][_0x1d52('0x17')]);_0x2fdf62['offset']=qs[_0x1d52('0x2e')](_0x4cb80f[_0x1d52('0x26')][_0x1d52('0x2e')]);}_0x2fdf62['order']=qs['sort'](_0x4cb80f[_0x1d52('0x26')][_0x1d52('0x2f')]);_0x2fdf62['where']=qs[_0x1d52('0x28')](_[_0x1d52('0x30')](_0x4cb80f['query'],_0x366999[_0x1d52('0x28')]),_0x4d922d);if(_0x4cb80f[_0x1d52('0x26')]['filter']){_0x2fdf62['where']=_['merge'](_0x2fdf62['where'],{'$or':_[_0x1d52('0x25')](_0x4d922d,function(_0x3f5f87){if(_0x3f5f87['type']!==_0x1d52('0x31')){var _0x464231={};_0x464231[_0x3f5f87[_0x1d52('0x20')]]={'$like':'%'+_0x4cb80f['query'][_0x1d52('0x32')]+'%'};return _0x464231;}})});}_0x2fdf62=_[_0x1d52('0x33')]({},_0x2fdf62,_0x4cb80f['options']);var _0x48e840={'where':_0x2fdf62[_0x1d52('0x34')]};return db['VoiceTransferReport'][_0x1d52('0x19')](_0x48e840)[_0x1d52('0x1e')](function(_0x1c6c8f){_0x2850be[_0x1d52('0x19')]=_0x1c6c8f;if(_0x4cb80f['query'][_0x1d52('0x35')]){_0x2fdf62[_0x1d52('0x36')]=[{'all':!![]}];}return db[_0x1d52('0x37')]['findAll'](_0x2fdf62);})[_0x1d52('0x1e')](function(_0x4199b4){_0x2850be[_0x1d52('0x38')]=_0x4199b4;return _0x2850be;})[_0x1d52('0x1e')](respondWithFilteredResult(_0x59acde,_0x2fdf62))['catch'](handleError(_0x59acde,null));};exports['show']=function(_0x23b6b8,_0x32c287){var _0x29a95a={'raw':!![],'where':{'id':_0x23b6b8['params']['id']}},_0x485a0e={};_0x485a0e[_0x1d52('0x24')]=_['keys'](db['VoiceTransferReport'][_0x1d52('0x39')]);_0x485a0e[_0x1d52('0x26')]=_[_0x1d52('0x27')](_0x23b6b8['query']);_0x485a0e[_0x1d52('0x28')]=_[_0x1d52('0x29')](_0x485a0e['model'],_0x485a0e[_0x1d52('0x26')]);_0x29a95a[_0x1d52('0x2a')]=_[_0x1d52('0x29')](_0x485a0e[_0x1d52('0x24')],qs[_0x1d52('0x2b')](_0x23b6b8[_0x1d52('0x26')][_0x1d52('0x2b')]));_0x29a95a[_0x1d52('0x2a')]=_0x29a95a[_0x1d52('0x2a')][_0x1d52('0x3a')]?_0x29a95a['attributes']:_0x485a0e[_0x1d52('0x24')];if(_0x23b6b8[_0x1d52('0x26')][_0x1d52('0x35')]){_0x29a95a[_0x1d52('0x36')]=[{'all':!![]}];}_0x29a95a=_[_0x1d52('0x33')]({},_0x29a95a,_0x23b6b8[_0x1d52('0x3b')]);return db['VoiceTransferReport'][_0x1d52('0x3c')](_0x29a95a)[_0x1d52('0x1e')](handleEntityNotFound(_0x32c287,null))[_0x1d52('0x1e')](respondWithResult(_0x32c287,null))['catch'](handleError(_0x32c287,null));};exports[_0x1d52('0x3d')]=function(_0x38df80,_0x572b99){return db[_0x1d52('0x37')][_0x1d52('0x3d')](_0x38df80['body'],{})[_0x1d52('0x1e')](respondWithResult(_0x572b99,0xc9))['catch'](handleError(_0x572b99,null));};exports[_0x1d52('0x3e')]=function(_0x2397be,_0x3feab5){if(_0x2397be[_0x1d52('0x3f')]['id']){delete _0x2397be[_0x1d52('0x3f')]['id'];}return db[_0x1d52('0x37')][_0x1d52('0x3c')]({'where':{'id':_0x2397be[_0x1d52('0x40')]['id']}})[_0x1d52('0x1e')](handleEntityNotFound(_0x3feab5,null))[_0x1d52('0x1e')](saveUpdates(_0x2397be['body'],null))[_0x1d52('0x1e')](respondWithResult(_0x3feab5,null))[_0x1d52('0x41')](handleError(_0x3feab5,null));};exports[_0x1d52('0x42')]=function(_0x2d8e44,_0xd80c06){return db[_0x1d52('0x37')]['find']({'where':{'id':_0x2d8e44[_0x1d52('0x40')]['id']}})[_0x1d52('0x1e')](handleEntityNotFound(_0xd80c06,null))[_0x1d52('0x1e')](removeEntity(_0xd80c06,null))[_0x1d52('0x41')](handleError(_0xd80c06,null));};exports[_0x1d52('0x43')]=function(_0x264c90,_0x4cf6ec){return db[_0x1d52('0x37')][_0x1d52('0x43')]()['then'](respondWithResult(_0x4cf6ec,null))['catch'](handleError(_0x4cf6ec,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index f8d98a9..58666ab 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 _0xfc7b=['request-promise','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash','../../config/logger','moment','bluebird'];(function(_0xa60623,_0x2d4e4f){var _0x4a6487=function(_0xba6cbe){while(--_0xba6cbe){_0xa60623['push'](_0xa60623['shift']());}};_0x4a6487(++_0x2d4e4f);}(_0xfc7b,0x74));var _0xbfc7=function(_0x3557f2,_0x2d5a90){_0x3557f2=_0x3557f2-0x0;var _0x29169a=_0xfc7b[_0x3557f2];return _0x29169a;};'use strict';var _=require(_0xbfc7('0x0'));var util=require('util');var logger=require(_0xbfc7('0x1'))('api');var moment=require(_0xbfc7('0x2'));var BPromise=require(_0xbfc7('0x3'));var rp=require(_0xbfc7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbfc7('0x5'));var config=require(_0xbfc7('0x6'));var attributes=require(_0xbfc7('0x7'));module[_0xbfc7('0x8')]=function(_0x49af64,_0x4b0d6b){return _0x49af64[_0xbfc7('0x9')](_0xbfc7('0xa'),attributes,{'tableName':_0xbfc7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8c78=['report_call_transfer','util','api','moment','request-promise','path','rimraf','./voiceTransferReport.attributes','exports','define','VoiceTransferReport'];(function(_0x177cea,_0x3c865a){var _0x3c83ba=function(_0x5e6935){while(--_0x5e6935){_0x177cea['push'](_0x177cea['shift']());}};_0x3c83ba(++_0x3c865a);}(_0x8c78,0x1a3));var _0x88c7=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x8c78[_0x126558];return _0x1f6d14;};'use strict';var _=require('lodash');var util=require(_0x88c7('0x0'));var logger=require('../../config/logger')(_0x88c7('0x1'));var moment=require(_0x88c7('0x2'));var BPromise=require('bluebird');var rp=require(_0x88c7('0x3'));var fs=require('fs');var path=require(_0x88c7('0x4'));var rimraf=require(_0x88c7('0x5'));var config=require('../../config/environment');var attributes=require(_0x88c7('0x6'));module[_0x88c7('0x7')]=function(_0x1f0e8d,_0x31b291){return _0x1f0e8d[_0x88c7('0x8')](_0x88c7('0x9'),attributes,{'tableName':_0x88c7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index 13ceba1..7b0cc74 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 _0x47b8=['VoiceTransferReport,\x20%s,\x20%s','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','VoiceTransferReport','body','options','CreateVoiceTransferReport','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x5710c9,_0x44780c){var _0x5dd2d5=function(_0x51213d){while(--_0x51213d){_0x5710c9['push'](_0x5710c9['shift']());}};_0x5dd2d5(++_0x44780c);}(_0x47b8,0x94));var _0x847b=function(_0x4a9e1a,_0x501dff){_0x4a9e1a=_0x4a9e1a-0x0;var _0x48d73f=_0x47b8[_0x4a9e1a];return _0x48d73f;};'use strict';var _=require('lodash');var util=require(_0x847b('0x0'));var moment=require('moment');var BPromise=require(_0x847b('0x1'));var rs=require(_0x847b('0x2'));var fs=require('fs');var Redis=require(_0x847b('0x3'));var db=require(_0x847b('0x4'))['db'];var utils=require(_0x847b('0x5'));var logger=require(_0x847b('0x6'))(_0x847b('0x7'));var config=require(_0x847b('0x8'));var jayson=require(_0x847b('0x9'));var client=jayson[_0x847b('0xa')][_0x847b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x195c87,_0x4c84ca,_0x3ef957){return new BPromise(function(_0x4a67f1,_0x1fb408){return client['request'](_0x195c87,_0x3ef957)[_0x847b('0xc')](function(_0x39d273){logger[_0x847b('0xd')](_0x847b('0xe'),_0x4c84ca,'request\x20sent');logger[_0x847b('0xf')](_0x847b('0x10'),_0x4c84ca,_0x847b('0x11'),JSON[_0x847b('0x12')](_0x39d273));if(_0x39d273[_0x847b('0x13')]){if(_0x39d273[_0x847b('0x13')][_0x847b('0x14')]===0x1f4){logger[_0x847b('0x13')](_0x847b('0xe'),_0x4c84ca,_0x39d273['error'][_0x847b('0x15')]);return _0x1fb408(_0x39d273[_0x847b('0x13')][_0x847b('0x15')]);}logger[_0x847b('0x13')](_0x847b('0xe'),_0x4c84ca,_0x39d273[_0x847b('0x13')][_0x847b('0x15')]);return _0x4a67f1(_0x39d273['error']['message']);}else{logger[_0x847b('0xd')](_0x847b('0xe'),_0x4c84ca,'request\x20sent');_0x4a67f1(_0x39d273['result'][_0x847b('0x15')]);}})[_0x847b('0x16')](function(_0x35b265){logger[_0x847b('0x13')](_0x847b('0xe'),_0x4c84ca,_0x35b265);_0x1fb408(_0x35b265);});});}exports['CreateVoiceTransferReport']=function(_0x58fe0d){var _0x36b4d1=this;return new Promise(function(_0x4f9dac,_0x2dd893){return db[_0x847b('0x17')]['create'](_0x58fe0d[_0x847b('0x18')],{'raw':_0x58fe0d[_0x847b('0x19')]?_0x58fe0d[_0x847b('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x847b('0xc')](function(_0x32e905){logger[_0x847b('0xd')](_0x847b('0x1a'),_0x58fe0d);logger[_0x847b('0xf')](_0x847b('0x1a'),_0x58fe0d,JSON[_0x847b('0x12')](_0x32e905));_0x4f9dac(_0x32e905);})['catch'](function(_0x627e52){logger[_0x847b('0x13')](_0x847b('0x1a'),_0x627e52['message'],_0x58fe0d);_0x2dd893(_0x36b4d1[_0x847b('0x13')](0x1f4,_0x627e52[_0x847b('0x15')]));});});}; \ No newline at end of file +var _0x28cf=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceTransferReport,\x20%s,\x20%s','catch','VoiceTransferReport','create','body','options','raw','CreateVoiceTransferReport','lodash','util','moment','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x28cf,0xc0));var _0xf28c=function(_0x591eef,_0xef7f26){_0x591eef=_0x591eef-0x0;var _0x4e64b4=_0x28cf[_0x591eef];return _0x4e64b4;};'use strict';var _=require(_0xf28c('0x0'));var util=require(_0xf28c('0x1'));var moment=require(_0xf28c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf28c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf28c('0x4'));var logger=require(_0xf28c('0x5'))(_0xf28c('0x6'));var config=require(_0xf28c('0x7'));var jayson=require(_0xf28c('0x8'));var client=jayson[_0xf28c('0x9')][_0xf28c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f6b7b,_0x22aac4,_0x4df57b){return new BPromise(function(_0x14f16c,_0x26993d){return client['request'](_0x4f6b7b,_0x4df57b)[_0xf28c('0xb')](function(_0x12e15f){logger[_0xf28c('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0x22aac4,_0xf28c('0xd'));logger[_0xf28c('0xe')](_0xf28c('0xf'),_0x22aac4,_0xf28c('0xd'),JSON[_0xf28c('0x10')](_0x12e15f));if(_0x12e15f[_0xf28c('0x11')]){if(_0x12e15f[_0xf28c('0x11')][_0xf28c('0x12')]===0x1f4){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x22aac4,_0x12e15f[_0xf28c('0x11')]['message']);return _0x26993d(_0x12e15f[_0xf28c('0x11')][_0xf28c('0x13')]);}logger[_0xf28c('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0x22aac4,_0x12e15f[_0xf28c('0x11')][_0xf28c('0x13')]);return _0x14f16c(_0x12e15f[_0xf28c('0x11')]['message']);}else{logger[_0xf28c('0xc')](_0xf28c('0x14'),_0x22aac4,'request\x20sent');_0x14f16c(_0x12e15f['result']['message']);}})[_0xf28c('0x15')](function(_0x55c6d4){logger[_0xf28c('0x11')](_0xf28c('0x14'),_0x22aac4,_0x55c6d4);_0x26993d(_0x55c6d4);});});}exports['CreateVoiceTransferReport']=function(_0x35a378){var _0x13d1c6=this;return new Promise(function(_0x1569d9,_0x56ae84){return db[_0xf28c('0x16')][_0xf28c('0x17')](_0x35a378[_0xf28c('0x18')],{'raw':_0x35a378[_0xf28c('0x19')]?_0x35a378[_0xf28c('0x19')][_0xf28c('0x1a')]===undefined?!![]:![]:!![]})[_0xf28c('0xb')](function(_0x50c8c6){logger[_0xf28c('0xc')](_0xf28c('0x1b'),_0x35a378);logger[_0xf28c('0xe')](_0xf28c('0x1b'),_0x35a378,JSON[_0xf28c('0x10')](_0x50c8c6));_0x1569d9(_0x50c8c6);})[_0xf28c('0x15')](function(_0x15056d){logger[_0xf28c('0x11')](_0xf28c('0x1b'),_0x15056d[_0xf28c('0x13')],_0x35a378);_0x56ae84(_0x13d1c6[_0xf28c('0x11')](0x1f4,_0x15056d[_0xf28c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index c07ee0e..5c792e6 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 _0x9e04=['/hangup','answer','hold','/unhold','unhold','transfer','exports','express','Router','../../components/auth/service','post','/originate','isAuthenticated','canUpdate','originate'];(function(_0x363876,_0x1359e2){var _0x3cb88e=function(_0x510281){while(--_0x510281){_0x363876['push'](_0x363876['shift']());}};_0x3cb88e(++_0x1359e2);}(_0x9e04,0x1e7));var _0x49e0=function(_0x568408,_0x34f526){_0x568408=_0x568408-0x0;var _0x105f84=_0x9e04[_0x568408];return _0x105f84;};'use strict';var express=require(_0x49e0('0x0'));var router=express[_0x49e0('0x1')]();var auth=require(_0x49e0('0x2'));var controller=require('./webbar.controller');router[_0x49e0('0x3')](_0x49e0('0x4'),auth[_0x49e0('0x5')](),auth[_0x49e0('0x6')](),controller[_0x49e0('0x7')]);router['post'](_0x49e0('0x8'),auth['isAuthenticated'](),auth[_0x49e0('0x6')](),controller['hangup']);router[_0x49e0('0x3')]('/answer',auth[_0x49e0('0x5')](),auth[_0x49e0('0x6')](),controller[_0x49e0('0x9')]);router[_0x49e0('0x3')]('/hold',auth['isAuthenticated'](),auth[_0x49e0('0x6')](),controller[_0x49e0('0xa')]);router[_0x49e0('0x3')](_0x49e0('0xb'),auth[_0x49e0('0x5')](),auth[_0x49e0('0x6')](),controller[_0x49e0('0xc')]);router['post']('/calls',auth[_0x49e0('0x5')](),auth['canUpdate'](),controller['calls']);router['post']('/transfer',auth[_0x49e0('0x5')](),auth[_0x49e0('0x6')](),controller[_0x49e0('0xd')]);module[_0x49e0('0xe')]=router; \ No newline at end of file +var _0xf9f1=['../../components/auth/service','./webbar.controller','isAuthenticated','canUpdate','originate','post','/hangup','hangup','/answer','answer','/hold','/unhold','unhold','/calls','/transfer','transfer','exports','Router'];(function(_0x471853,_0x3a73ac){var _0x2819e1=function(_0x18dc32){while(--_0x18dc32){_0x471853['push'](_0x471853['shift']());}};_0x2819e1(++_0x3a73ac);}(_0xf9f1,0x1af));var _0x1f9f=function(_0x3cc1dd,_0x425a56){_0x3cc1dd=_0x3cc1dd-0x0;var _0x3f4738=_0xf9f1[_0x3cc1dd];return _0x3f4738;};'use strict';var express=require('express');var router=express[_0x1f9f('0x0')]();var auth=require(_0x1f9f('0x1'));var controller=require(_0x1f9f('0x2'));router['post']('/originate',auth[_0x1f9f('0x3')](),auth[_0x1f9f('0x4')](),controller[_0x1f9f('0x5')]);router[_0x1f9f('0x6')](_0x1f9f('0x7'),auth['isAuthenticated'](),auth[_0x1f9f('0x4')](),controller[_0x1f9f('0x8')]);router[_0x1f9f('0x6')](_0x1f9f('0x9'),auth[_0x1f9f('0x3')](),auth[_0x1f9f('0x4')](),controller[_0x1f9f('0xa')]);router[_0x1f9f('0x6')](_0x1f9f('0xb'),auth[_0x1f9f('0x3')](),auth[_0x1f9f('0x4')](),controller['hold']);router[_0x1f9f('0x6')](_0x1f9f('0xc'),auth[_0x1f9f('0x3')](),auth[_0x1f9f('0x4')](),controller[_0x1f9f('0xd')]);router[_0x1f9f('0x6')](_0x1f9f('0xe'),auth[_0x1f9f('0x3')](),auth['canUpdate'](),controller['calls']);router[_0x1f9f('0x6')](_0x1f9f('0xf'),auth['isAuthenticated'](),auth[_0x1f9f('0x4')](),controller[_0x1f9f('0x10')]);module[_0x1f9f('0x11')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index aaf2dea..22aec39 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 _0xe600=['redis','localhost','socket.io-emitter','number','userId\x20is\x20required','string','callNumber\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','error','stack','name','status','send','NotFound','request','then','code','message','result','User','VoiceChannels','rows','UserId','length','sessionId\x20','\x20not\x20found!','originate\x20fired:','body','validate','json','callNumber','callerId','callbackUrl','format','user:%s','catch','hangup\x20fired:','userId','sessionId','entityFound:','webbar:hangup','hangup\x20executed!','answer','webbar:answer','hold\x20fired:','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls\x20fired:','all','conference','conference\x20fired:','transfer','transfer\x20fired:','webbar:transfer','lodash','../../config/environment','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis'];(function(_0x3bab09,_0x217c29){var _0x164376=function(_0x277730){while(--_0x277730){_0x3bab09['push'](_0x3bab09['shift']());}};_0x164376(++_0x217c29);}(_0xe600,0x159));var _0x0e60=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe600[_0x321bb2];return _0x9c12ed;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x0e60('0x0'));var db=require('../../mysqldb')['db'];var config=require(_0x0e60('0x1'));var util=require(_0x0e60('0x2'));var BPromise=require(_0x0e60('0x3'));var jayson=require(_0x0e60('0x4'));var amiClient=jayson[_0x0e60('0x5')][_0x0e60('0x6')]({'port':0x232a});var logger=require(_0x0e60('0x7'))(_0x0e60('0x8'));var Redis=require(_0x0e60('0x9'));config[_0x0e60('0xa')]=_['defaults'](config[_0x0e60('0xa')],{'host':_0x0e60('0xb'),'port':0x18eb});var io=require(_0x0e60('0xc'))(new Redis(config[_0x0e60('0xa')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x0e60('0xd'),'required':[!![],_0x0e60('0xe')]},'callNumber':{'type':_0x0e60('0xf'),'required':[!![],_0x0e60('0x10')]},'callerId':{'type':_0x0e60('0xf')},'callbackUrl':{'type':_0x0e60('0xf')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0x0e60('0xe')]},'sessionId':{'type':_0x0e60('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x0e60('0xd'),'required':[!![],_0x0e60('0xe')]},'sessionId':{'type':_0x0e60('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x0e60('0xd'),'required':[!![],_0x0e60('0xe')]},'sessionId':{'type':_0x0e60('0xf'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0x0e60('0xf'),'required':[!![],_0x0e60('0x11')]}});var holdValidation=new Schema({'userId':{'type':_0x0e60('0xd'),'required':[!![],_0x0e60('0xe')]},'sessionId':{'type':_0x0e60('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x0e60('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x0e60('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0x0e60('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':_0x0e60('0xd'),'required':[!![],_0x0e60('0xe')]}});function emit(_0x5ab4ba,_0x2a8b5a,_0x3f2d13){logger[_0x0e60('0x12')](_0x5ab4ba,_0x2a8b5a,JSON[_0x0e60('0x13')](_0x3f2d13));io['to'](_0x5ab4ba)[_0x0e60('0x14')](_0x2a8b5a,_0x3f2d13);}function handleError(_0x4ed292){return function(_0x992490){console[_0x0e60('0x15')]('handleError:',_0x992490,_0x992490 instanceof RangeError);logger[_0x0e60('0x16')](_0x992490[_0x0e60('0x17')]);if(_0x992490 instanceof RangeError){if(_0x992490[_0x0e60('0x18')]){delete _0x992490['name'];}_0x4ed292[_0x0e60('0x19')](0x194)['send'](_0x992490);}else{if(_0x992490[_0x0e60('0x18')]){delete _0x992490[_0x0e60('0x18')];}_0x4ed292[_0x0e60('0x19')](0x1f4)[_0x0e60('0x1a')](_0x992490);}};}function checkError(){return function(_0x329620){if(!_0x329620){throw new RangeError(_0x0e60('0x1b'));}return _0x329620;};}function respondWithRpcPromise(_0x38f677,_0x2ed72f){return new BPromise(function(_0x352633,_0x10f875){var _0x22c0e0=amiClient;return _0x22c0e0[_0x0e60('0x1c')](_0x38f677,_0x2ed72f)[_0x0e60('0x1d')](function(_0x16985f){if(_0x16985f[_0x0e60('0x16')]){if(_0x16985f[_0x0e60('0x16')][_0x0e60('0x1e')]===0x1f4){return _0x10f875(_0x16985f[_0x0e60('0x16')][_0x0e60('0x1f')]);}return _0x352633(_0x16985f['error'][_0x0e60('0x1f')]);}else{_0x352633(_0x16985f[_0x0e60('0x20')]);}})['catch'](function(_0x10451f){_0x10f875(_0x10451f);});});}function getAgent(_0x5ddd18){return db[_0x0e60('0x21')]['findOne']({'where':{'id':_0x5ddd18,'role':'agent'}})[_0x0e60('0x1d')](checkError());}function getAgentCheckSession(_0x39dae2,_0x526aaa){return new BPromise(function(_0x4eb9b8,_0x3ca649){var _0x54d7ce=respondWithRpcPromise(_0x0e60('0x22'));var _0x548919=getAgent(_0x39dae2);Promise['all']([_0x54d7ce,_0x548919])[_0x0e60('0x1d')](function(_0x3d3c13){var _0x2a282d=_0x3d3c13[0x0];var _0x4d9b18=_0x3d3c13[0x1];var _0x473813=_['filter'](_0x2a282d[_0x0e60('0x23')],function(_0x1d54c0){return _0x1d54c0[_0x0e60('0x24')]==_0x4d9b18['id']&&_0x1d54c0['sessionId']==_0x526aaa;});if(_0x473813[_0x0e60('0x25')]==0x1){_0x4eb9b8(_0x4d9b18);}else{_0x3ca649(new RangeError(_0x0e60('0x26')+_0x526aaa+_0x0e60('0x27')));}});});}exports['originate']=function(_0x17e210,_0x3ea4ac){logger[_0x0e60('0x12')](_0x0e60('0x28'),_0x17e210[_0x0e60('0x29')]);var _0x588e9d=originateValidation[_0x0e60('0x2a')](_0x17e210['body']);if(_0x588e9d[_0x0e60('0x25')]>0x0){return _0x3ea4ac['status'](0x190)[_0x0e60('0x2b')](_0x588e9d);}var _0x2388a7=_0x17e210[_0x0e60('0x29')]['userId'];var _0xf29971=_0x17e210[_0x0e60('0x29')][_0x0e60('0x2c')];var _0x81a892=_0x17e210[_0x0e60('0x29')][_0x0e60('0x2d')];var _0x9302fe=_0x17e210[_0x0e60('0x29')][_0x0e60('0x2e')];return getAgent(_0x2388a7)[_0x0e60('0x1d')](function(_0x2533a9){logger[_0x0e60('0x12')]('entityFound:',_0x2533a9[_0x0e60('0x18')]);emit(util[_0x0e60('0x2f')](_0x0e60('0x30'),_0x2533a9[_0x0e60('0x18')]),'webbar:originate',{'callNumber':_0xf29971,'callerId':_0x81a892,'callbackUrl':_0x9302fe});return _0x3ea4ac['status'](0xc8)[_0x0e60('0x2b')]({'error':![],'message':'originate\x20executed!'});})[_0x0e60('0x31')](handleError(_0x3ea4ac));};exports['hangup']=function(_0x4582b8,_0x44db32){logger[_0x0e60('0x12')](_0x0e60('0x32'),_0x4582b8[_0x0e60('0x29')]);var _0x25761d=hangupValidation[_0x0e60('0x2a')](_0x4582b8[_0x0e60('0x29')]);if(_0x25761d[_0x0e60('0x25')]>0x0){return _0x44db32[_0x0e60('0x19')](0x190)[_0x0e60('0x2b')](_0x25761d);}var _0x3becf9=_0x4582b8['body'][_0x0e60('0x33')];var _0x56ce38=_0x4582b8[_0x0e60('0x29')][_0x0e60('0x34')];return getAgent(_0x3becf9)['then'](function(_0x482583){logger[_0x0e60('0x12')](_0x0e60('0x35'),_0x482583['name']);emit(util[_0x0e60('0x2f')](_0x0e60('0x30'),_0x482583['name']),_0x0e60('0x36'),{'sessionId':_0x56ce38});return _0x44db32[_0x0e60('0x19')](0xc8)[_0x0e60('0x2b')]({'error':![],'message':_0x0e60('0x37')});})[_0x0e60('0x31')](handleError(_0x44db32));};exports[_0x0e60('0x38')]=function(_0x8244f,_0x233743){logger[_0x0e60('0x12')]('answer\x20fired:',_0x8244f['body']);var _0x535c06=answerValidation[_0x0e60('0x2a')](_0x8244f['body']);if(_0x535c06[_0x0e60('0x25')]>0x0){return _0x233743[_0x0e60('0x19')](0x190)[_0x0e60('0x2b')](_0x535c06);}var _0x4bfebf=_0x8244f[_0x0e60('0x29')][_0x0e60('0x33')];var _0x4ce029=_0x8244f['body'][_0x0e60('0x34')];return getAgent(_0x4bfebf)[_0x0e60('0x1d')](function(_0xd4f785){logger[_0x0e60('0x12')](_0x0e60('0x35'),_0xd4f785[_0x0e60('0x18')]);emit(util['format'](_0x0e60('0x30'),_0xd4f785[_0x0e60('0x18')]),_0x0e60('0x39'),{'sessionId':_0x4ce029});return _0x233743[_0x0e60('0x19')](0xc8)[_0x0e60('0x2b')]({'error':![],'message':'answer\x20executed!'});})['catch'](handleError(_0x233743));};exports['hold']=function(_0x36f90e,_0x449f38){logger[_0x0e60('0x12')](_0x0e60('0x3a'),_0x36f90e['body']);var _0x5b9cf6=holdValidation['validate'](_0x36f90e[_0x0e60('0x29')]);if(_0x5b9cf6[_0x0e60('0x25')]>0x0){return _0x449f38[_0x0e60('0x19')](0x190)[_0x0e60('0x2b')](_0x5b9cf6);}var _0x8777f4=_0x36f90e['body']['userId'];var _0x3c3ab7=_0x36f90e[_0x0e60('0x29')][_0x0e60('0x34')];return getAgent(_0x8777f4)[_0x0e60('0x1d')](function(_0x4ad156){logger[_0x0e60('0x12')](_0x0e60('0x35'),_0x4ad156[_0x0e60('0x18')]);emit(util['format'](_0x0e60('0x30'),_0x4ad156[_0x0e60('0x18')]),'webbar:hold',{'sessionId':_0x3c3ab7});return _0x449f38[_0x0e60('0x19')](0xc8)['json']({'error':![],'message':_0x0e60('0x3b')});})[_0x0e60('0x31')](handleError(_0x449f38));};exports[_0x0e60('0x3c')]=function(_0x2e887c,_0x477a99){logger['info'](_0x0e60('0x3d'),_0x2e887c[_0x0e60('0x29')]);var _0x103c30=unholdValidation[_0x0e60('0x2a')](_0x2e887c['body']);if(_0x103c30[_0x0e60('0x25')]>0x0){return _0x477a99[_0x0e60('0x19')](0x190)[_0x0e60('0x2b')](_0x103c30);}var _0x2d7403=_0x2e887c['body'][_0x0e60('0x33')];var _0x4c6f07=_0x2e887c[_0x0e60('0x29')][_0x0e60('0x34')];return getAgent(_0x2d7403)[_0x0e60('0x1d')](function(_0x9e4340){logger[_0x0e60('0x12')](_0x0e60('0x35'),_0x9e4340[_0x0e60('0x18')]);emit(util['format'](_0x0e60('0x30'),_0x9e4340['name']),_0x0e60('0x3e'),{'sessionId':_0x4c6f07});return _0x477a99[_0x0e60('0x19')](0xc8)[_0x0e60('0x2b')]({'error':![],'message':_0x0e60('0x3f')});})['catch'](handleError(_0x477a99));};exports['calls']=function(_0x3282b8,_0x5a6c01){logger[_0x0e60('0x12')](_0x0e60('0x40'),_0x5a6c01[_0x0e60('0x29')]);var _0x24ada9=callsValidation[_0x0e60('0x2a')](_0x3282b8[_0x0e60('0x29')]);if(_0x24ada9[_0x0e60('0x25')]>0x0){return _0x5a6c01[_0x0e60('0x19')](0x190)['json'](_0x24ada9);}var _0x33b560=_0x3282b8[_0x0e60('0x29')][_0x0e60('0x33')];var _0x1249b2=respondWithRpcPromise(_0x0e60('0x22'));var _0x52ac12=getAgent(_0x33b560);return Promise[_0x0e60('0x41')]([_0x1249b2,_0x52ac12])[_0x0e60('0x1d')](function(_0x3ee5e2){var _0x221608=_0x3ee5e2[0x0];var _0x565eab=_0x3ee5e2[0x1];var _0x88b035=_['filter'](_0x221608[_0x0e60('0x23')],function(_0x37c13c){return _0x37c13c[_0x0e60('0x24')]==_0x565eab['id'];});return _0x5a6c01[_0x0e60('0x19')](0xc8)[_0x0e60('0x2b')]({'count':_0x88b035['length'],'rows':_0x88b035});})[_0x0e60('0x31')](handleError(_0x5a6c01));};exports[_0x0e60('0x42')]=function(_0x55d4e7,_0x472ebe){logger['info'](_0x0e60('0x43'),_0x55d4e7[_0x0e60('0x29')]);var _0x5e50ad=conferenceValidation['validate'](_0x55d4e7[_0x0e60('0x29')]);if(_0x5e50ad[_0x0e60('0x25')]>0x0){return _0x472ebe['status'](0x190)['json'](_0x5e50ad);}var _0x33bc63=_0x55d4e7[_0x0e60('0x29')][_0x0e60('0x33')];return getAgent(_0x33bc63)[_0x0e60('0x1d')](function(_0x58fa48){logger[_0x0e60('0x12')](_0x0e60('0x35'),_0x58fa48[_0x0e60('0x18')]);emit(util['format'](_0x0e60('0x30'),_0x58fa48[_0x0e60('0x18')]),'webbar:conference');return _0x472ebe[_0x0e60('0x19')](0xc8)[_0x0e60('0x2b')]({'error':![],'message':'conference\x20executed!'});})[_0x0e60('0x31')](handleError(_0x472ebe));};exports[_0x0e60('0x44')]=function(_0x5f383e,_0x5cc420){logger[_0x0e60('0x12')](_0x0e60('0x45'),_0x5f383e[_0x0e60('0x29')]);var _0x234cc5=transferValidation[_0x0e60('0x2a')](_0x5f383e[_0x0e60('0x29')]);if(_0x234cc5[_0x0e60('0x25')]>0x0){return _0x5cc420[_0x0e60('0x19')](0x190)[_0x0e60('0x2b')](_0x234cc5);}var _0x2d0c5d=_0x5f383e[_0x0e60('0x29')][_0x0e60('0x33')];var _0x2546f8=_0x5f383e[_0x0e60('0x29')][_0x0e60('0x34')];var _0x200d81=_0x5f383e[_0x0e60('0x29')]['transferNumber'];return getAgent(_0x2d0c5d)['then'](function(_0x1a8efe){logger[_0x0e60('0x12')](_0x0e60('0x35'),_0x1a8efe['name']);emit(util[_0x0e60('0x2f')](_0x0e60('0x30'),_0x1a8efe['name']),_0x0e60('0x46'),{'sessionId':_0x2546f8,'transferNumber':_0x200d81});return _0x5cc420[_0x0e60('0x19')](0xc8)[_0x0e60('0x2b')]({'error':![],'message':'transfer\x20executed!'});})['catch'](handleError(_0x5cc420));}; \ No newline at end of file +var _0xee24=['stack','name','status','send','NotFound','then','code','message','User','findOne','agent','rows','UserId','sessionId','length','originate','originate\x20fired:','body','json','userId','callNumber','callerId','callbackUrl','info','format','user:%s','webbar:originate','originate\x20executed!','catch','hangup','entityFound:','webbar:hangup','hangup\x20executed!','answer\x20fired:','answer\x20executed!','hold','hold\x20fired:','hold\x20executed!','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','all','filter','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','lodash','../../mysqldb','util','bluebird','jayson/promise','client','../../config/logger','webbarapi','ioredis','redis','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','transferNumber\x20is\x20required','stringify','emit','log','handleError:','error'];(function(_0x1fe287,_0x3b43ea){var _0xcbd0f0=function(_0x139c8b){while(--_0x139c8b){_0x1fe287['push'](_0x1fe287['shift']());}};_0xcbd0f0(++_0x3b43ea);}(_0xee24,0x1a6));var _0x4ee2=function(_0xbac849,_0x14f9ff){_0xbac849=_0xbac849-0x0;var _0x1e27aa=_0xee24[_0xbac849];return _0x1e27aa;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x4ee2('0x0'));var db=require(_0x4ee2('0x1'))['db'];var config=require('../../config/environment');var util=require(_0x4ee2('0x2'));var BPromise=require(_0x4ee2('0x3'));var jayson=require(_0x4ee2('0x4'));var amiClient=jayson[_0x4ee2('0x5')]['http']({'port':0x232a});var logger=require(_0x4ee2('0x6'))(_0x4ee2('0x7'));var Redis=require(_0x4ee2('0x8'));config[_0x4ee2('0x9')]=_['defaults'](config[_0x4ee2('0x9')],{'host':_0x4ee2('0xa'),'port':0x18eb});var io=require(_0x4ee2('0xb'))(new Redis(config[_0x4ee2('0x9')]));var Schema=require(_0x4ee2('0xc'));var originateValidation=new Schema({'userId':{'type':_0x4ee2('0xd'),'required':[!![],_0x4ee2('0xe')]},'callNumber':{'type':_0x4ee2('0xf'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':'string'},'callbackUrl':{'type':_0x4ee2('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0x4ee2('0xd'),'required':[!![],_0x4ee2('0xe')]},'sessionId':{'type':_0x4ee2('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x4ee2('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x4ee2('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x4ee2('0xd'),'required':[!![],_0x4ee2('0xe')]},'sessionId':{'type':_0x4ee2('0xf'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0x4ee2('0xf'),'required':[!![],_0x4ee2('0x10')]}});var holdValidation=new Schema({'userId':{'type':_0x4ee2('0xd'),'required':[!![],_0x4ee2('0xe')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x4ee2('0xe')]},'sessionId':{'type':_0x4ee2('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0x4ee2('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':_0x4ee2('0xd'),'required':[!![],_0x4ee2('0xe')]}});function emit(_0x1b95c5,_0x14bc72,_0x3b742c){logger['info'](_0x1b95c5,_0x14bc72,JSON[_0x4ee2('0x11')](_0x3b742c));io['to'](_0x1b95c5)[_0x4ee2('0x12')](_0x14bc72,_0x3b742c);}function handleError(_0x3d0308){return function(_0x4aba2b){console[_0x4ee2('0x13')](_0x4ee2('0x14'),_0x4aba2b,_0x4aba2b instanceof RangeError);logger[_0x4ee2('0x15')](_0x4aba2b[_0x4ee2('0x16')]);if(_0x4aba2b instanceof RangeError){if(_0x4aba2b[_0x4ee2('0x17')]){delete _0x4aba2b[_0x4ee2('0x17')];}_0x3d0308[_0x4ee2('0x18')](0x194)[_0x4ee2('0x19')](_0x4aba2b);}else{if(_0x4aba2b['name']){delete _0x4aba2b['name'];}_0x3d0308[_0x4ee2('0x18')](0x1f4)['send'](_0x4aba2b);}};}function checkError(){return function(_0x34c281){if(!_0x34c281){throw new RangeError(_0x4ee2('0x1a'));}return _0x34c281;};}function respondWithRpcPromise(_0x1d9a37,_0x416a78){return new BPromise(function(_0x4507d6,_0x53f246){var _0x1d5037=amiClient;return _0x1d5037['request'](_0x1d9a37,_0x416a78)[_0x4ee2('0x1b')](function(_0x3e6344){if(_0x3e6344[_0x4ee2('0x15')]){if(_0x3e6344[_0x4ee2('0x15')][_0x4ee2('0x1c')]===0x1f4){return _0x53f246(_0x3e6344[_0x4ee2('0x15')][_0x4ee2('0x1d')]);}return _0x4507d6(_0x3e6344['error'][_0x4ee2('0x1d')]);}else{_0x4507d6(_0x3e6344['result']);}})['catch'](function(_0xebd95f){_0x53f246(_0xebd95f);});});}function getAgent(_0x291734){return db[_0x4ee2('0x1e')][_0x4ee2('0x1f')]({'where':{'id':_0x291734,'role':_0x4ee2('0x20')}})['then'](checkError());}function getAgentCheckSession(_0x50005e,_0x404fba){return new BPromise(function(_0x2a078f,_0x562a4d){var _0x2fe02a=respondWithRpcPromise('VoiceChannels');var _0x49b1be=getAgent(_0x50005e);Promise['all']([_0x2fe02a,_0x49b1be])[_0x4ee2('0x1b')](function(_0x970fa6){var _0x50da2d=_0x970fa6[0x0];var _0x3f68b9=_0x970fa6[0x1];var _0x6775f7=_['filter'](_0x50da2d[_0x4ee2('0x21')],function(_0x4bf072){return _0x4bf072[_0x4ee2('0x22')]==_0x3f68b9['id']&&_0x4bf072[_0x4ee2('0x23')]==_0x404fba;});if(_0x6775f7[_0x4ee2('0x24')]==0x1){_0x2a078f(_0x3f68b9);}else{_0x562a4d(new RangeError('sessionId\x20'+_0x404fba+'\x20not\x20found!'));}});});}exports[_0x4ee2('0x25')]=function(_0x14f164,_0x3ab2a1){logger['info'](_0x4ee2('0x26'),_0x14f164[_0x4ee2('0x27')]);var _0x1fca9f=originateValidation[_0x4ee2('0xc')](_0x14f164[_0x4ee2('0x27')]);if(_0x1fca9f[_0x4ee2('0x24')]>0x0){return _0x3ab2a1[_0x4ee2('0x18')](0x190)[_0x4ee2('0x28')](_0x1fca9f);}var _0x256bea=_0x14f164[_0x4ee2('0x27')][_0x4ee2('0x29')];var _0x25db8f=_0x14f164['body'][_0x4ee2('0x2a')];var _0x287ff3=_0x14f164['body'][_0x4ee2('0x2b')];var _0x21968c=_0x14f164[_0x4ee2('0x27')][_0x4ee2('0x2c')];return getAgent(_0x256bea)[_0x4ee2('0x1b')](function(_0x429a90){logger[_0x4ee2('0x2d')]('entityFound:',_0x429a90[_0x4ee2('0x17')]);emit(util[_0x4ee2('0x2e')](_0x4ee2('0x2f'),_0x429a90['name']),_0x4ee2('0x30'),{'callNumber':_0x25db8f,'callerId':_0x287ff3,'callbackUrl':_0x21968c});return _0x3ab2a1['status'](0xc8)[_0x4ee2('0x28')]({'error':![],'message':_0x4ee2('0x31')});})[_0x4ee2('0x32')](handleError(_0x3ab2a1));};exports[_0x4ee2('0x33')]=function(_0x3c7282,_0x52fa55){logger['info']('hangup\x20fired:',_0x3c7282[_0x4ee2('0x27')]);var _0x3f2c6a=hangupValidation[_0x4ee2('0xc')](_0x3c7282[_0x4ee2('0x27')]);if(_0x3f2c6a[_0x4ee2('0x24')]>0x0){return _0x52fa55[_0x4ee2('0x18')](0x190)[_0x4ee2('0x28')](_0x3f2c6a);}var _0x29c4b3=_0x3c7282[_0x4ee2('0x27')][_0x4ee2('0x29')];var _0x57b506=_0x3c7282['body'][_0x4ee2('0x23')];return getAgent(_0x29c4b3)[_0x4ee2('0x1b')](function(_0x1255ff){logger['info'](_0x4ee2('0x34'),_0x1255ff[_0x4ee2('0x17')]);emit(util[_0x4ee2('0x2e')](_0x4ee2('0x2f'),_0x1255ff[_0x4ee2('0x17')]),_0x4ee2('0x35'),{'sessionId':_0x57b506});return _0x52fa55[_0x4ee2('0x18')](0xc8)[_0x4ee2('0x28')]({'error':![],'message':_0x4ee2('0x36')});})[_0x4ee2('0x32')](handleError(_0x52fa55));};exports['answer']=function(_0x5d4395,_0x3e7f65){logger[_0x4ee2('0x2d')](_0x4ee2('0x37'),_0x5d4395['body']);var _0x1ef1d5=answerValidation['validate'](_0x5d4395[_0x4ee2('0x27')]);if(_0x1ef1d5['length']>0x0){return _0x3e7f65[_0x4ee2('0x18')](0x190)[_0x4ee2('0x28')](_0x1ef1d5);}var _0x41607a=_0x5d4395['body'][_0x4ee2('0x29')];var _0x4e7a92=_0x5d4395[_0x4ee2('0x27')][_0x4ee2('0x23')];return getAgent(_0x41607a)[_0x4ee2('0x1b')](function(_0x38a25a){logger['info'](_0x4ee2('0x34'),_0x38a25a[_0x4ee2('0x17')]);emit(util['format'](_0x4ee2('0x2f'),_0x38a25a['name']),'webbar:answer',{'sessionId':_0x4e7a92});return _0x3e7f65[_0x4ee2('0x18')](0xc8)['json']({'error':![],'message':_0x4ee2('0x38')});})['catch'](handleError(_0x3e7f65));};exports[_0x4ee2('0x39')]=function(_0x4641b8,_0x39237a){logger['info'](_0x4ee2('0x3a'),_0x4641b8[_0x4ee2('0x27')]);var _0x44ada1=holdValidation[_0x4ee2('0xc')](_0x4641b8[_0x4ee2('0x27')]);if(_0x44ada1['length']>0x0){return _0x39237a[_0x4ee2('0x18')](0x190)[_0x4ee2('0x28')](_0x44ada1);}var _0x535c11=_0x4641b8['body'][_0x4ee2('0x29')];var _0x54e734=_0x4641b8[_0x4ee2('0x27')][_0x4ee2('0x23')];return getAgent(_0x535c11)['then'](function(_0x43ca98){logger[_0x4ee2('0x2d')](_0x4ee2('0x34'),_0x43ca98['name']);emit(util[_0x4ee2('0x2e')](_0x4ee2('0x2f'),_0x43ca98['name']),'webbar:hold',{'sessionId':_0x54e734});return _0x39237a['status'](0xc8)['json']({'error':![],'message':_0x4ee2('0x3b')});})[_0x4ee2('0x32')](handleError(_0x39237a));};exports['unhold']=function(_0x1379c0,_0x3d25fb){logger[_0x4ee2('0x2d')](_0x4ee2('0x3c'),_0x1379c0[_0x4ee2('0x27')]);var _0x152519=unholdValidation[_0x4ee2('0xc')](_0x1379c0['body']);if(_0x152519[_0x4ee2('0x24')]>0x0){return _0x3d25fb['status'](0x190)[_0x4ee2('0x28')](_0x152519);}var _0x14a86d=_0x1379c0[_0x4ee2('0x27')]['userId'];var _0x386a59=_0x1379c0[_0x4ee2('0x27')][_0x4ee2('0x23')];return getAgent(_0x14a86d)['then'](function(_0x53a6c8){logger[_0x4ee2('0x2d')](_0x4ee2('0x34'),_0x53a6c8[_0x4ee2('0x17')]);emit(util[_0x4ee2('0x2e')]('user:%s',_0x53a6c8[_0x4ee2('0x17')]),_0x4ee2('0x3d'),{'sessionId':_0x386a59});return _0x3d25fb[_0x4ee2('0x18')](0xc8)[_0x4ee2('0x28')]({'error':![],'message':_0x4ee2('0x3e')});})[_0x4ee2('0x32')](handleError(_0x3d25fb));};exports[_0x4ee2('0x3f')]=function(_0x3c65ca,_0x279c28){logger[_0x4ee2('0x2d')](_0x4ee2('0x40'),_0x279c28[_0x4ee2('0x27')]);var _0x58dac3=callsValidation['validate'](_0x3c65ca[_0x4ee2('0x27')]);if(_0x58dac3[_0x4ee2('0x24')]>0x0){return _0x279c28[_0x4ee2('0x18')](0x190)['json'](_0x58dac3);}var _0x578908=_0x3c65ca[_0x4ee2('0x27')][_0x4ee2('0x29')];var _0xf00660=respondWithRpcPromise('VoiceChannels');var _0x45294c=getAgent(_0x578908);return Promise[_0x4ee2('0x41')]([_0xf00660,_0x45294c])[_0x4ee2('0x1b')](function(_0x3ef445){var _0x430dfc=_0x3ef445[0x0];var _0x5a9dac=_0x3ef445[0x1];var _0x55e0a4=_[_0x4ee2('0x42')](_0x430dfc[_0x4ee2('0x21')],function(_0x47f36e){return _0x47f36e[_0x4ee2('0x22')]==_0x5a9dac['id'];});return _0x279c28[_0x4ee2('0x18')](0xc8)[_0x4ee2('0x28')]({'count':_0x55e0a4[_0x4ee2('0x24')],'rows':_0x55e0a4});})[_0x4ee2('0x32')](handleError(_0x279c28));};exports['conference']=function(_0x344e1c,_0x56a88b){logger[_0x4ee2('0x2d')](_0x4ee2('0x43'),_0x344e1c['body']);var _0x1bb9e3=conferenceValidation[_0x4ee2('0xc')](_0x344e1c[_0x4ee2('0x27')]);if(_0x1bb9e3[_0x4ee2('0x24')]>0x0){return _0x56a88b['status'](0x190)[_0x4ee2('0x28')](_0x1bb9e3);}var _0x380682=_0x344e1c['body'][_0x4ee2('0x29')];return getAgent(_0x380682)[_0x4ee2('0x1b')](function(_0x33992f){logger[_0x4ee2('0x2d')]('entityFound:',_0x33992f[_0x4ee2('0x17')]);emit(util[_0x4ee2('0x2e')](_0x4ee2('0x2f'),_0x33992f[_0x4ee2('0x17')]),_0x4ee2('0x44'));return _0x56a88b[_0x4ee2('0x18')](0xc8)['json']({'error':![],'message':_0x4ee2('0x45')});})[_0x4ee2('0x32')](handleError(_0x56a88b));};exports[_0x4ee2('0x46')]=function(_0xd2a358,_0x4f34c1){logger[_0x4ee2('0x2d')](_0x4ee2('0x47'),_0xd2a358[_0x4ee2('0x27')]);var _0x54f7ab=transferValidation['validate'](_0xd2a358['body']);if(_0x54f7ab[_0x4ee2('0x24')]>0x0){return _0x4f34c1['status'](0x190)[_0x4ee2('0x28')](_0x54f7ab);}var _0xcdf9c2=_0xd2a358[_0x4ee2('0x27')]['userId'];var _0x5a5a9e=_0xd2a358[_0x4ee2('0x27')][_0x4ee2('0x23')];var _0x4217f9=_0xd2a358[_0x4ee2('0x27')][_0x4ee2('0x48')];return getAgent(_0xcdf9c2)[_0x4ee2('0x1b')](function(_0x5cc907){logger[_0x4ee2('0x2d')](_0x4ee2('0x34'),_0x5cc907[_0x4ee2('0x17')]);emit(util[_0x4ee2('0x2e')](_0x4ee2('0x2f'),_0x5cc907[_0x4ee2('0x17')]),_0x4ee2('0x49'),{'sessionId':_0x5a5a9e,'transferNumber':_0x4217f9});return _0x4f34c1[_0x4ee2('0x18')](0xc8)[_0x4ee2('0x28')]({'error':![],'message':'transfer\x20executed!'});})['catch'](handleError(_0x4f34c1));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index bf4b8d7..96604da 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 _0x5c3c=['../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','describe','show','/:id/dispositions','/:id/canned_answers','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','addAgents','addApplications','/:id/notify','notify','/:id/send','send','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x131d27,_0x5ba5c8){var _0x23f54a=function(_0x5541fd){while(--_0x5541fd){_0x131d27['push'](_0x131d27['shift']());}};_0x23f54a(++_0x5ba5c8);}(_0x5c3c,0x132));var _0xc5c3=function(_0x369151,_0x179f72){_0x369151=_0x369151-0x0;var _0x4292d5=_0x5c3c[_0x369151];return _0x4292d5;};'use strict';var multer=require(_0xc5c3('0x0'));var util=require(_0xc5c3('0x1'));var path=require(_0xc5c3('0x2'));var timeout=require(_0xc5c3('0x3'));var express=require('express');var router=express[_0xc5c3('0x4')]();var fs_extra=require(_0xc5c3('0x5'));var auth=require(_0xc5c3('0x6'));var interaction=require(_0xc5c3('0x7'));var config=require(_0xc5c3('0x8'));var controller=require(_0xc5c3('0x9'));router[_0xc5c3('0xa')]('/',auth[_0xc5c3('0xb')](),controller[_0xc5c3('0xc')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xc5c3('0xd')]);router[_0xc5c3('0xa')]('/:id',auth[_0xc5c3('0xb')](),controller[_0xc5c3('0xe')]);router['get'](_0xc5c3('0xf'),auth[_0xc5c3('0xb')](),controller['getDispositions']);router[_0xc5c3('0xa')](_0xc5c3('0x10'),auth[_0xc5c3('0xb')](),controller['getAnswers']);router[_0xc5c3('0xa')](_0xc5c3('0x11'),auth['isAuthenticated'](),controller[_0xc5c3('0x12')]);router[_0xc5c3('0xa')](_0xc5c3('0x13'),auth['isAuthenticated'](),controller[_0xc5c3('0x14')]);router[_0xc5c3('0x15')]('/',auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x16')]);router[_0xc5c3('0x15')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xc5c3('0x17')]);router[_0xc5c3('0x15')](_0xc5c3('0x10'),auth[_0xc5c3('0xb')](),controller['addAnswer']);router['post'](_0xc5c3('0x11'),auth['isAuthenticated'](),controller[_0xc5c3('0x18')]);router[_0xc5c3('0x15')](_0xc5c3('0x13'),auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x19')]);router['post'](_0xc5c3('0x1a'),controller[_0xc5c3('0x1b')]);router[_0xc5c3('0x15')](_0xc5c3('0x1c'),auth['isAuthenticated'](),controller[_0xc5c3('0x1d')]);router[_0xc5c3('0x1e')](_0xc5c3('0x1f'),auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x20')]);router['delete'](_0xc5c3('0x1f'),auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x21')]);router[_0xc5c3('0x22')](_0xc5c3('0xf'),auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x23')]);router['delete']('/:id/canned_answers',auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x24')]);router['delete']('/:id/users',auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x25')]);module[_0xc5c3('0x26')]=router; \ No newline at end of file +var _0xc1c6=['addDisposition','/:id/canned_answers','addAnswer','addAgents','/:id/applications','addApplications','notify','/:id/send','send','put','/:id','update','delete','destroy','removeDispositions','removeAnswers','/:id/users','removeAgents','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','show','/:id/dispositions','getDispositions','getAnswers','getAgents','post','create'];(function(_0x24409a,_0x3f6b75){var _0x2c0961=function(_0x2b8b25){while(--_0x2b8b25){_0x24409a['push'](_0x24409a['shift']());}};_0x2c0961(++_0x3f6b75);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x2736a0,_0x38cbf5){_0x2736a0=_0x2736a0-0x0;var _0x250173=_0xc1c6[_0x2736a0];return _0x250173;};'use strict';var multer=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var path=require(_0x6c1c('0x2'));var timeout=require('connect-timeout');var express=require(_0x6c1c('0x3'));var router=express['Router']();var fs_extra=require(_0x6c1c('0x4'));var auth=require(_0x6c1c('0x5'));var interaction=require(_0x6c1c('0x6'));var config=require('../../config/environment');var controller=require('./whatsappAccount.controller');router[_0x6c1c('0x7')]('/',auth['isAuthenticated'](),controller[_0x6c1c('0x8')]);router['get'](_0x6c1c('0x9'),auth[_0x6c1c('0xa')](),controller[_0x6c1c('0xb')]);router[_0x6c1c('0x7')]('/:id',auth[_0x6c1c('0xa')](),controller[_0x6c1c('0xc')]);router['get'](_0x6c1c('0xd'),auth[_0x6c1c('0xa')](),controller[_0x6c1c('0xe')]);router[_0x6c1c('0x7')]('/:id/canned_answers',auth[_0x6c1c('0xa')](),controller[_0x6c1c('0xf')]);router[_0x6c1c('0x7')]('/:id/users',auth[_0x6c1c('0xa')](),controller[_0x6c1c('0x10')]);router[_0x6c1c('0x7')]('/:id/applications',auth[_0x6c1c('0xa')](),controller['getApplications']);router[_0x6c1c('0x11')]('/',auth[_0x6c1c('0xa')](),controller[_0x6c1c('0x12')]);router[_0x6c1c('0x11')](_0x6c1c('0xd'),auth[_0x6c1c('0xa')](),controller[_0x6c1c('0x13')]);router[_0x6c1c('0x11')](_0x6c1c('0x14'),auth['isAuthenticated'](),controller[_0x6c1c('0x15')]);router[_0x6c1c('0x11')]('/:id/users',auth[_0x6c1c('0xa')](),controller[_0x6c1c('0x16')]);router['post'](_0x6c1c('0x17'),auth['isAuthenticated'](),controller[_0x6c1c('0x18')]);router[_0x6c1c('0x11')]('/:id/notify',controller[_0x6c1c('0x19')]);router['post'](_0x6c1c('0x1a'),auth[_0x6c1c('0xa')](),controller[_0x6c1c('0x1b')]);router[_0x6c1c('0x1c')](_0x6c1c('0x1d'),auth[_0x6c1c('0xa')](),controller[_0x6c1c('0x1e')]);router[_0x6c1c('0x1f')](_0x6c1c('0x1d'),auth[_0x6c1c('0xa')](),controller[_0x6c1c('0x20')]);router[_0x6c1c('0x1f')](_0x6c1c('0xd'),auth[_0x6c1c('0xa')](),controller[_0x6c1c('0x21')]);router[_0x6c1c('0x1f')](_0x6c1c('0x14'),auth[_0x6c1c('0xa')](),controller[_0x6c1c('0x22')]);router[_0x6c1c('0x1f')](_0x6c1c('0x23'),auth[_0x6c1c('0xa')](),controller[_0x6c1c('0x24')]);module[_0x6c1c('0x25')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 91dbc56..398c4a3 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 _0x41c1=['generate','ENUM','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING','name'];(function(_0x469436,_0x75a5b){var _0x524f38=function(_0x2aa0cd){while(--_0x2aa0cd){_0x469436['push'](_0x469436['shift']());}};_0x524f38(++_0x75a5b);}(_0x41c1,0x7b));var _0x141c=function(_0x38ff1e,_0x3b9385){_0x38ff1e=_0x38ff1e-0x0;var _0x3755d4=_0x41c1[_0x38ff1e];return _0x3755d4;};'use strict';var Sequelize=require(_0x141c('0x0'));var rs=require(_0x141c('0x1'));module[_0x141c('0x2')]={'name':{'type':Sequelize[_0x141c('0x3')],'unique':_0x141c('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x141c('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x141c('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x141c('0x3')],'defaultValue':function(){return rs[_0x141c('0x5')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x141c('0x6')](_0x141c('0x7'))},'accountSid':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x141c('0x3')]},'notificationTemplate':{'type':Sequelize[_0x141c('0x8')],'defaultValue':function(){return _0x141c('0x9');}},'notificationSound':{'type':Sequelize[_0x141c('0xa')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x141c('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x141c('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x141c('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x141c('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x141c('0xb')],'comment':_0x141c('0xc')},'mandatoryDisposition':{'type':Sequelize[_0x141c('0xa')],'defaultValue':![],'comment':_0x141c('0xd'),'set':function(_0x3b1d40){if(!_0x3b1d40){this[_0x141c('0xe')](_0x141c('0xf'),null);}this[_0x141c('0xe')]('mandatoryDisposition',_0x3b1d40);}},'description':{'type':Sequelize[_0x141c('0x3')]}}; \ No newline at end of file +var _0xd500=['BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','sequelize','randomstring','name','STRING','generate','ENUM','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x1f0bd3,_0x6b2ed0){var _0x1ebb2a=function(_0x26c4e6){while(--_0x26c4e6){_0x1f0bd3['push'](_0x1f0bd3['shift']());}};_0x1ebb2a(++_0x6b2ed0);}(_0xd500,0x1cb));var _0x0d50=function(_0x34021d,_0x753aa6){_0x34021d=_0x34021d-0x0;var _0x16597b=_0xd500[_0x34021d];return _0x16597b;};'use strict';var Sequelize=require(_0x0d50('0x0'));var rs=require(_0x0d50('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x0d50('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x0d50('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x0d50('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x0d50('0x4')]();}},'phone':{'type':Sequelize[_0x0d50('0x3')]},'type':{'type':Sequelize[_0x0d50('0x5')](_0x0d50('0x6'))},'accountSid':{'type':Sequelize[_0x0d50('0x3')]},'authToken':{'type':Sequelize[_0x0d50('0x3')]},'notificationTemplate':{'type':Sequelize[_0x0d50('0x7')],'defaultValue':function(){return _0x0d50('0x8');}},'notificationSound':{'type':Sequelize[_0x0d50('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0d50('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x0d50('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0d50('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0d50('0xa')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x0d50('0x9')],'defaultValue':![],'comment':_0x0d50('0xb'),'set':function(_0x5d9d67){if(!_0x5d9d67){this[_0x0d50('0xc')]('mandatoryDispositionPauseId',null);}this[_0x0d50('0xc')]('mandatoryDisposition',_0x5d9d67);}},'description':{'type':Sequelize[_0x0d50('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index eed0b46..2c1d6c2 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 _0x7d35=['options','includeAll','findAll','catch','show','keys','rawAttributes','length','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','WhatsappAccountId','findOne','Disposition','removeDispositions','ids','CannedAnswer','getAnswers','hasOwnProperty','rows','removeAnswers','omit','emit','userWhatsappAccount:save','removeAgents','userWhatsappAccount:remove','getAgents','User','order','addApplications','sequelize','transaction','WhatsappApplication','bulkCreate','priority','getApplications','whatsapp','Applications','applications','orderBy','asc','account','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','ListId','twilio','From','replace','whatsapp:','isNil','from','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','DESC','list','Contacts','defaults','WhatsappInteraction','spread','created','autoclose','close','unmanaged','interaction','UserId','unshift','agent','*,*,*,*','startRouting','Start','receiveMessage','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','Content-Type','\x0a','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','CmList','List','out','WhatsappMessage','dataValues','Messages','push','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','register','jayson/promise','client','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','get','WhatsappAccounts','UserProfileResource','destroy','stack','name','send','Pause','mandatoryDispositionPause','map','WhatsappAccount','fieldName','type','key','model','query','intersection','attributes','fields','nolimit','limit','sort','pick','filters','where','VIRTUAL','filter','merge'];(function(_0x331b08,_0x2c5937){var _0x5034d9=function(_0x2c916a){while(--_0x2c916a){_0x331b08['push'](_0x331b08['shift']());}};_0x5034d9(++_0x2c5937);}(_0x7d35,0x11a));var _0x57d3=function(_0x1988f1,_0x290a23){_0x1988f1=_0x1988f1-0x0;var _0x3c848e=_0x7d35[_0x1988f1];return _0x3c848e;};'use strict';var emlformat=require(_0x57d3('0x0'));var rimraf=require(_0x57d3('0x1'));var zipdir=require(_0x57d3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x57d3('0x3'));var moment=require(_0x57d3('0x4'));var BPromise=require(_0x57d3('0x5'));var Mustache=require(_0x57d3('0x6'));var util=require(_0x57d3('0x7'));var path=require(_0x57d3('0x8'));var sox=require(_0x57d3('0x9'));var csv=require('to-csv');var ejs=require(_0x57d3('0xa'));var fs=require('fs');var fs_extra=require(_0x57d3('0xb'));var _=require(_0x57d3('0xc'));var squel=require(_0x57d3('0xd'));var crypto=require(_0x57d3('0xe'));var jsforce=require(_0x57d3('0xf'));var deskjs=require(_0x57d3('0x10'));var toCsv=require(_0x57d3('0x11'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x57d3('0x12'));var authService=require(_0x57d3('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x57d3('0x14'));var logger=require(_0x57d3('0x15'))(_0x57d3('0x16'));var utils=require(_0x57d3('0x17'));var config=require(_0x57d3('0x18'));var licenseUtil=require(_0x57d3('0x19'));var db=require('../../mysqldb')['db'];config[_0x57d3('0x1a')]=_['defaults'](config[_0x57d3('0x1a')],{'host':_0x57d3('0x1b'),'port':0x18eb});var socket=require(_0x57d3('0x1c'))(new Redis(config[_0x57d3('0x1a')]));require('./whatsappAccount.socket')[_0x57d3('0x1d')](socket);var jayson=require(_0x57d3('0x1e'));var client=jayson[_0x57d3('0x1f')]['http']({'port':0x232c});function respondWithRpcPromise(_0x325ef6,_0x55e284,_0x3f12b3,_0x338f13){return new BPromise(function(_0x1f81a8,_0x296f46){var _0x1b66e0=_0x338f13||client;return _0x1b66e0[_0x57d3('0x20')](_0x325ef6,_0x3f12b3)[_0x57d3('0x21')](function(_0x1eebc4){logger[_0x57d3('0x22')](_0x57d3('0x23'),_0x55e284,_0x57d3('0x24'));logger['debug'](_0x57d3('0x25'),_0x55e284,'request\x20sent',JSON[_0x57d3('0x26')](_0x1eebc4));if(_0x1eebc4[_0x57d3('0x27')]){if(_0x1eebc4[_0x57d3('0x27')][_0x57d3('0x28')]===0x1f4){logger[_0x57d3('0x27')](_0x57d3('0x23'),_0x55e284,_0x1eebc4[_0x57d3('0x27')][_0x57d3('0x29')]);return _0x296f46(_0x1eebc4['error'][_0x57d3('0x29')]);}logger[_0x57d3('0x27')]('WhatsappAccount,\x20%s,\x20%s',_0x55e284,_0x1eebc4[_0x57d3('0x27')]['message']);return _0x1f81a8(_0x1eebc4['error'][_0x57d3('0x29')]);}else{logger[_0x57d3('0x22')](_0x57d3('0x23'),_0x55e284,'request\x20sent');_0x1f81a8(_0x1eebc4['result'][_0x57d3('0x29')]);}})['catch'](function(_0x1c8c23){logger['error'](_0x57d3('0x23'),_0x55e284,_0x1c8c23);_0x296f46(_0x1c8c23);});});}function respondWithStatusCode(_0x20f31d,_0x4dcb20){_0x4dcb20=_0x4dcb20||0xcc;return function(_0x467475){if(_0x467475){return _0x20f31d['sendStatus'](_0x4dcb20);}return _0x20f31d[_0x57d3('0x2a')](_0x4dcb20)[_0x57d3('0x2b')]();};}function respondWithResult(_0xf8d36a,_0x16bb37){_0x16bb37=_0x16bb37||0xc8;return function(_0x487ea4){if(_0x487ea4){return _0xf8d36a[_0x57d3('0x2a')](_0x16bb37)[_0x57d3('0x2c')](_0x487ea4);}};}function respondWithFilteredResult(_0x2687cc,_0x583768){return function(_0x67cd66){if(_0x67cd66){var _0x5f5214=typeof _0x583768[_0x57d3('0x2d')]===_0x57d3('0x2e')&&typeof _0x583768['limit']===_0x57d3('0x2e');var _0x1d64ef=_0x67cd66[_0x57d3('0x2f')];var _0x58a98c=_0x5f5214?0x0:_0x583768[_0x57d3('0x2d')];var _0x2badbc=_0x5f5214?_0x67cd66['count']:_0x583768[_0x57d3('0x2d')]+_0x583768['limit'];var _0x1b8011;if(_0x2badbc>=_0x1d64ef){_0x2badbc=_0x1d64ef;_0x1b8011=0xc8;}else{_0x1b8011=0xce;}_0x2687cc['status'](_0x1b8011);return _0x2687cc[_0x57d3('0x30')](_0x57d3('0x31'),_0x58a98c+'-'+_0x2badbc+'/'+_0x1d64ef)[_0x57d3('0x2c')](_0x67cd66);}return null;};}function patchUpdates(_0xae9f57){return function(_0x5157f0){try{jsonpatch[_0x57d3('0x32')](_0x5157f0,_0xae9f57,!![]);}catch(_0x4299b3){return BPromise[_0x57d3('0x33')](_0x4299b3);}return _0x5157f0[_0x57d3('0x34')]();};}function saveUpdates(_0x39294f,_0x4003ba){return function(_0x1e234d){if(_0x1e234d){return _0x1e234d[_0x57d3('0x35')](_0x39294f)[_0x57d3('0x21')](function(_0x57a007){return _0x57a007;});}return null;};}function removeEntity(_0x2b422d,_0x214538){return function(_0xd09c75){if(_0xd09c75){return _0xd09c75['destroy']()[_0x57d3('0x21')](function(){var _0x155934=_0xd09c75[_0x57d3('0x36')]({'plain':!![]});var _0x53b159=_0x57d3('0x37');return db[_0x57d3('0x38')][_0x57d3('0x39')]({'where':{'type':_0x53b159,'resourceId':_0x155934['id']}})['then'](function(){return _0xd09c75;});})['then'](function(){_0x2b422d[_0x57d3('0x2a')](0xcc)[_0x57d3('0x2b')]();});}};}function handleEntityNotFound(_0x36c0d9,_0x189cff){return function(_0x36fe09){if(!_0x36fe09){_0x36c0d9['sendStatus'](0x194);}return _0x36fe09;};}function handleError(_0x175911,_0xa28c78){_0xa28c78=_0xa28c78||0x1f4;return function(_0x318c52){logger[_0x57d3('0x27')](_0x318c52[_0x57d3('0x3a')]);if(_0x318c52[_0x57d3('0x3b')]){delete _0x318c52[_0x57d3('0x3b')];}_0x175911[_0x57d3('0x2a')](_0xa28c78)[_0x57d3('0x3c')](_0x318c52);};}exports['index']=function(_0x4199a7,_0x49e794){var _0xa0f32d={'include':[{'model':db[_0x57d3('0x3d')],'as':_0x57d3('0x3e')}]},_0x3df046={},_0x5377f3={'count':0x0,'rows':[]};var _0x347dfc=_[_0x57d3('0x3f')](db[_0x57d3('0x40')]['rawAttributes'],function(_0x3d75db){return{'name':_0x3d75db[_0x57d3('0x41')],'type':_0x3d75db[_0x57d3('0x42')][_0x57d3('0x43')]};});_0x3df046[_0x57d3('0x44')]=_['map'](_0x347dfc,_0x57d3('0x3b'));_0x3df046[_0x57d3('0x45')]=_['keys'](_0x4199a7[_0x57d3('0x45')]);_0x3df046['filters']=_[_0x57d3('0x46')](_0x3df046['model'],_0x3df046['query']);_0xa0f32d[_0x57d3('0x47')]=_[_0x57d3('0x46')](_0x3df046[_0x57d3('0x44')],qs[_0x57d3('0x48')](_0x4199a7[_0x57d3('0x45')]['fields']));_0xa0f32d['attributes']=_0xa0f32d['attributes']['length']?_0xa0f32d['attributes']:_0x3df046[_0x57d3('0x44')];if(!_0x4199a7[_0x57d3('0x45')]['hasOwnProperty'](_0x57d3('0x49'))){_0xa0f32d[_0x57d3('0x4a')]=qs[_0x57d3('0x4a')](_0x4199a7[_0x57d3('0x45')]['limit']);_0xa0f32d[_0x57d3('0x2d')]=qs['offset'](_0x4199a7[_0x57d3('0x45')][_0x57d3('0x2d')]);}_0xa0f32d['order']=qs[_0x57d3('0x4b')](_0x4199a7['query'][_0x57d3('0x4b')]);_0xa0f32d['where']=qs['filters'](_[_0x57d3('0x4c')](_0x4199a7[_0x57d3('0x45')],_0x3df046[_0x57d3('0x4d')]),_0x347dfc);if(_0x4199a7[_0x57d3('0x45')]['filter']){_0xa0f32d[_0x57d3('0x4e')]=_['merge'](_0xa0f32d[_0x57d3('0x4e')],{'$or':_[_0x57d3('0x3f')](_0x347dfc,function(_0x4f965d){if(_0x4f965d[_0x57d3('0x42')]!==_0x57d3('0x4f')){var _0x54a72e={};_0x54a72e[_0x4f965d[_0x57d3('0x3b')]]={'$like':'%'+_0x4199a7['query'][_0x57d3('0x50')]+'%'};return _0x54a72e;}})});}_0xa0f32d=_[_0x57d3('0x51')]({},_0xa0f32d,_0x4199a7[_0x57d3('0x52')]);var _0x47afe2={'where':_0xa0f32d[_0x57d3('0x4e')]};return db[_0x57d3('0x40')][_0x57d3('0x2f')](_0x47afe2)[_0x57d3('0x21')](function(_0x66415a){_0x5377f3['count']=_0x66415a;if(_0x4199a7[_0x57d3('0x45')][_0x57d3('0x53')]){_0xa0f32d['include']=[{'all':!![]}];}return db['WhatsappAccount'][_0x57d3('0x54')](_0xa0f32d);})['then'](function(_0x1d26e6){_0x5377f3['rows']=_0x1d26e6;return _0x5377f3;})[_0x57d3('0x21')](respondWithFilteredResult(_0x49e794,_0xa0f32d))[_0x57d3('0x55')](handleError(_0x49e794,null));};exports[_0x57d3('0x56')]=function(_0x5ed102,_0x4cc137){var _0x631b58={'raw':![],'where':{'id':_0x5ed102['params']['id']},'include':[{'model':db[_0x57d3('0x3d')],'as':_0x57d3('0x3e')}]},_0x49397b={};_0x49397b[_0x57d3('0x44')]=_[_0x57d3('0x57')](db[_0x57d3('0x40')][_0x57d3('0x58')]);_0x49397b['query']=_[_0x57d3('0x57')](_0x5ed102[_0x57d3('0x45')]);_0x49397b[_0x57d3('0x4d')]=_[_0x57d3('0x46')](_0x49397b[_0x57d3('0x44')],_0x49397b['query']);_0x631b58['attributes']=_[_0x57d3('0x46')](_0x49397b[_0x57d3('0x44')],qs[_0x57d3('0x48')](_0x5ed102[_0x57d3('0x45')][_0x57d3('0x48')]));_0x631b58[_0x57d3('0x47')]=_0x631b58[_0x57d3('0x47')][_0x57d3('0x59')]?_0x631b58[_0x57d3('0x47')]:_0x49397b[_0x57d3('0x44')];if(_0x5ed102['query'][_0x57d3('0x53')]){_0x631b58[_0x57d3('0x5a')]=[{'all':!![]}];}_0x631b58=_[_0x57d3('0x51')]({},_0x631b58,_0x5ed102[_0x57d3('0x52')]);return db['WhatsappAccount']['find'](_0x631b58)[_0x57d3('0x21')](handleEntityNotFound(_0x4cc137,null))[_0x57d3('0x21')](respondWithResult(_0x4cc137,null))[_0x57d3('0x55')](handleError(_0x4cc137,null));};exports[_0x57d3('0x5b')]=function(_0x1be283,_0x27b71c){return db[_0x57d3('0x40')][_0x57d3('0x5b')](_0x1be283[_0x57d3('0x5c')],{})[_0x57d3('0x21')](function(_0x243fec){var _0x1bd57d=_0x1be283[_0x57d3('0x5d')][_0x57d3('0x36')]({'plain':!![]});if(!_0x1bd57d)throw new Error(_0x57d3('0x5e'));if(_0x1bd57d[_0x57d3('0x5f')]===_0x57d3('0x5d')){var _0x421832=_0x243fec['get']({'plain':!![]});var _0x17a240='WhatsappAccounts';return db[_0x57d3('0x60')][_0x57d3('0x61')]({'where':{'name':_0x17a240,'userProfileId':_0x1bd57d['userProfileId']},'raw':!![]})[_0x57d3('0x21')](function(_0x2b19f2){if(_0x2b19f2&&_0x2b19f2[_0x57d3('0x62')]===0x0){return db[_0x57d3('0x38')]['create']({'name':_0x421832[_0x57d3('0x3b')],'resourceId':_0x421832['id'],'type':_0x2b19f2[_0x57d3('0x3b')],'sectionId':_0x2b19f2['id']},{})[_0x57d3('0x21')](function(){return _0x243fec;});}else{return _0x243fec;}})[_0x57d3('0x55')](function(_0x36f235){logger[_0x57d3('0x27')](_0x57d3('0x63'),_0x36f235);throw _0x36f235;});}return _0x243fec;})['then'](respondWithResult(_0x27b71c,0xc9))[_0x57d3('0x55')](handleError(_0x27b71c,null));};exports[_0x57d3('0x35')]=function(_0x3b0c6e,_0x3b0ef8){if(_0x3b0c6e[_0x57d3('0x5c')]['id']){delete _0x3b0c6e[_0x57d3('0x5c')]['id'];}return db['WhatsappAccount'][_0x57d3('0x61')]({'where':{'id':_0x3b0c6e[_0x57d3('0x64')]['id']},'include':[{'model':db[_0x57d3('0x3d')],'as':_0x57d3('0x3e')}]})['then'](handleEntityNotFound(_0x3b0ef8,null))[_0x57d3('0x21')](saveUpdates(_0x3b0c6e[_0x57d3('0x5c')],null))[_0x57d3('0x21')](respondWithResult(_0x3b0ef8,null))[_0x57d3('0x55')](handleError(_0x3b0ef8,null));};exports['destroy']=function(_0x1234c9,_0x26de51){return db[_0x57d3('0x40')]['find']({'where':{'id':_0x1234c9[_0x57d3('0x64')]['id']}})[_0x57d3('0x21')](handleEntityNotFound(_0x26de51,null))[_0x57d3('0x21')](removeEntity(_0x26de51,null))[_0x57d3('0x55')](handleError(_0x26de51,null));};exports[_0x57d3('0x65')]=function(_0xaa9fd5,_0x353082){return db['WhatsappAccount'][_0x57d3('0x65')]()[_0x57d3('0x21')](respondWithResult(_0x353082,null))[_0x57d3('0x55')](handleError(_0x353082,null));};exports['addDisposition']=function(_0x260ecb,_0x4302bd,_0x1574d3){if(_0x260ecb['body']['id']){delete _0x260ecb[_0x57d3('0x5c')]['id'];}return db[_0x57d3('0x40')][_0x57d3('0x61')]({'where':{'id':_0x260ecb[_0x57d3('0x64')]['id']}})[_0x57d3('0x21')](handleEntityNotFound(_0x4302bd,null))[_0x57d3('0x21')](function(_0x3968e4){if(_0x3968e4){_0x260ecb['body'][_0x57d3('0x66')]=_0x3968e4['id'];return db['Disposition'][_0x57d3('0x5b')](_0x260ecb['body']);}})[_0x57d3('0x21')](respondWithResult(_0x4302bd,null))[_0x57d3('0x55')](handleError(_0x4302bd,null));};exports['getDispositions']=function(_0x5c4d1c,_0x2538d8,_0x3cb8f9){var _0x42bf64={'raw':![],'where':{}};var _0x2cddfc={};var _0x536fc6={'count':0x0,'rows':[]};return db[_0x57d3('0x40')][_0x57d3('0x67')]({'where':{'id':_0x5c4d1c[_0x57d3('0x64')]['id']}})[_0x57d3('0x21')](handleEntityNotFound(_0x2538d8,null))[_0x57d3('0x21')](function(_0x5d12c7){if(_0x5d12c7){_0x2cddfc[_0x57d3('0x44')]=_['keys'](db[_0x57d3('0x68')]['rawAttributes']);_0x2cddfc[_0x57d3('0x45')]=_['keys'](_0x5c4d1c[_0x57d3('0x45')]);_0x2cddfc[_0x57d3('0x4d')]=_['intersection'](_0x2cddfc[_0x57d3('0x44')],_0x2cddfc['query']);_0x42bf64[_0x57d3('0x47')]=_[_0x57d3('0x46')](_0x2cddfc[_0x57d3('0x44')],qs['fields'](_0x5c4d1c[_0x57d3('0x45')][_0x57d3('0x48')]));_0x42bf64[_0x57d3('0x47')]=_0x42bf64[_0x57d3('0x47')][_0x57d3('0x59')]?_0x42bf64[_0x57d3('0x47')]:_0x2cddfc['model'];if(!_0x5c4d1c[_0x57d3('0x45')]['hasOwnProperty'](_0x57d3('0x49'))){_0x42bf64['limit']=qs[_0x57d3('0x4a')](_0x5c4d1c['query'][_0x57d3('0x4a')]);_0x42bf64[_0x57d3('0x2d')]=qs[_0x57d3('0x2d')](_0x5c4d1c['query'][_0x57d3('0x2d')]);}_0x42bf64['order']=qs['sort'](_0x5c4d1c[_0x57d3('0x45')]['sort']);_0x42bf64[_0x57d3('0x4e')]=qs[_0x57d3('0x4d')](_[_0x57d3('0x4c')](_0x5c4d1c[_0x57d3('0x45')],_0x2cddfc[_0x57d3('0x4d')]));_0x42bf64[_0x57d3('0x4e')][_0x57d3('0x66')]=_0x5d12c7['id'];if(_0x5c4d1c['query']['filter']){_0x42bf64[_0x57d3('0x4e')]=_[_0x57d3('0x51')](_0x42bf64[_0x57d3('0x4e')],{'$or':_[_0x57d3('0x3f')](_0x42bf64[_0x57d3('0x47')],function(_0x574e7e){var _0x3f4c40={};_0x3f4c40[_0x574e7e]={'$like':'%'+_0x5c4d1c[_0x57d3('0x45')][_0x57d3('0x50')]+'%'};return _0x3f4c40;})});}_0x42bf64=_['merge']({},_0x42bf64,_0x5c4d1c[_0x57d3('0x52')]);return db[_0x57d3('0x68')][_0x57d3('0x2f')]({'where':_0x42bf64[_0x57d3('0x4e')]})[_0x57d3('0x21')](function(_0x5077e0){_0x536fc6[_0x57d3('0x2f')]=_0x5077e0;if(_0x5c4d1c[_0x57d3('0x45')][_0x57d3('0x53')]){_0x42bf64[_0x57d3('0x5a')]=[{'all':!![]}];}return db[_0x57d3('0x68')][_0x57d3('0x54')](_0x42bf64);})[_0x57d3('0x21')](function(_0x469f50){_0x536fc6['rows']=_0x469f50;return _0x536fc6;});}})[_0x57d3('0x21')](respondWithFilteredResult(_0x2538d8,_0x42bf64))[_0x57d3('0x55')](handleError(_0x2538d8,null));};exports[_0x57d3('0x69')]=function(_0x5854a5,_0x33ad07,_0x4a19c7){return db[_0x57d3('0x40')]['find']({'where':{'id':_0x5854a5['params']['id']}})[_0x57d3('0x21')](handleEntityNotFound(_0x33ad07,null))['then'](function(_0x4dec0f){if(_0x4dec0f){return _0x4dec0f[_0x57d3('0x69')](_0x5854a5[_0x57d3('0x45')][_0x57d3('0x6a')]);}})[_0x57d3('0x21')](respondWithStatusCode(_0x33ad07,null))['catch'](handleError(_0x33ad07,null));};exports['addAnswer']=function(_0xee0dcd,_0x130071,_0x4f8264){if(_0xee0dcd[_0x57d3('0x5c')]['id']){delete _0xee0dcd['body']['id'];}return db[_0x57d3('0x40')][_0x57d3('0x61')]({'where':{'id':_0xee0dcd[_0x57d3('0x64')]['id']}})[_0x57d3('0x21')](handleEntityNotFound(_0x130071,null))['then'](function(_0x22b3bb){if(_0x22b3bb){_0xee0dcd[_0x57d3('0x5c')]['WhatsappAccountId']=_0x22b3bb['id'];return db[_0x57d3('0x6b')]['create'](_0xee0dcd[_0x57d3('0x5c')]);}})[_0x57d3('0x21')](respondWithResult(_0x130071,null))[_0x57d3('0x55')](handleError(_0x130071,null));};exports[_0x57d3('0x6c')]=function(_0x3eb3bc,_0x5b5ccb,_0x33144e){var _0x29124a={'raw':![],'where':{}};var _0x21b851={};var _0x3ad915={'count':0x0,'rows':[]};return db[_0x57d3('0x40')]['findOne']({'where':{'id':_0x3eb3bc['params']['id']}})[_0x57d3('0x21')](handleEntityNotFound(_0x5b5ccb,null))[_0x57d3('0x21')](function(_0x14600c){if(_0x14600c){_0x21b851['model']=_['keys'](db[_0x57d3('0x6b')][_0x57d3('0x58')]);_0x21b851[_0x57d3('0x45')]=_[_0x57d3('0x57')](_0x3eb3bc[_0x57d3('0x45')]);_0x21b851['filters']=_[_0x57d3('0x46')](_0x21b851['model'],_0x21b851[_0x57d3('0x45')]);_0x29124a['attributes']=_[_0x57d3('0x46')](_0x21b851[_0x57d3('0x44')],qs[_0x57d3('0x48')](_0x3eb3bc[_0x57d3('0x45')]['fields']));_0x29124a['attributes']=_0x29124a[_0x57d3('0x47')][_0x57d3('0x59')]?_0x29124a['attributes']:_0x21b851[_0x57d3('0x44')];if(!_0x3eb3bc[_0x57d3('0x45')][_0x57d3('0x6d')](_0x57d3('0x49'))){_0x29124a[_0x57d3('0x4a')]=qs[_0x57d3('0x4a')](_0x3eb3bc['query']['limit']);_0x29124a[_0x57d3('0x2d')]=qs[_0x57d3('0x2d')](_0x3eb3bc[_0x57d3('0x45')][_0x57d3('0x2d')]);}_0x29124a['order']=qs[_0x57d3('0x4b')](_0x3eb3bc[_0x57d3('0x45')]['sort']);_0x29124a[_0x57d3('0x4e')]=qs[_0x57d3('0x4d')](_['pick'](_0x3eb3bc[_0x57d3('0x45')],_0x21b851[_0x57d3('0x4d')]));_0x29124a['where'][_0x57d3('0x66')]=_0x14600c['id'];if(_0x3eb3bc[_0x57d3('0x45')][_0x57d3('0x50')]){_0x29124a[_0x57d3('0x4e')]=_[_0x57d3('0x51')](_0x29124a['where'],{'$or':_['map'](_0x29124a[_0x57d3('0x47')],function(_0x3bd289){var _0x1783d8={};_0x1783d8[_0x3bd289]={'$like':'%'+_0x3eb3bc['query']['filter']+'%'};return _0x1783d8;})});}_0x29124a=_[_0x57d3('0x51')]({},_0x29124a,_0x3eb3bc[_0x57d3('0x52')]);return db[_0x57d3('0x6b')][_0x57d3('0x2f')]({'where':_0x29124a[_0x57d3('0x4e')]})[_0x57d3('0x21')](function(_0x195c33){_0x3ad915[_0x57d3('0x2f')]=_0x195c33;if(_0x3eb3bc[_0x57d3('0x45')][_0x57d3('0x53')]){_0x29124a[_0x57d3('0x5a')]=[{'all':!![]}];}return db[_0x57d3('0x6b')]['findAll'](_0x29124a);})['then'](function(_0x38e708){_0x3ad915[_0x57d3('0x6e')]=_0x38e708;return _0x3ad915;});}})['then'](respondWithFilteredResult(_0x5b5ccb,_0x29124a))['catch'](handleError(_0x5b5ccb,null));};exports[_0x57d3('0x6f')]=function(_0x4dcaa7,_0x43faef,_0x456757){return db['WhatsappAccount'][_0x57d3('0x61')]({'where':{'id':_0x4dcaa7['params']['id']}})[_0x57d3('0x21')](handleEntityNotFound(_0x43faef,null))[_0x57d3('0x21')](function(_0x168555){if(_0x168555){return _0x168555[_0x57d3('0x6f')](_0x4dcaa7[_0x57d3('0x45')]['ids']);}})['then'](respondWithStatusCode(_0x43faef,null))[_0x57d3('0x55')](handleError(_0x43faef,null));};exports['addAgents']=function(_0x17c7bc,_0x38577c,_0x4fc5be){return db[_0x57d3('0x40')][_0x57d3('0x61')]({'where':{'id':_0x17c7bc[_0x57d3('0x64')]['id']}})[_0x57d3('0x21')](handleEntityNotFound(_0x38577c,null))[_0x57d3('0x21')](function(_0xf09f4){if(_0xf09f4){return _0xf09f4['addAgents'](_0x17c7bc[_0x57d3('0x5c')]['ids'],_[_0x57d3('0x70')](_0x17c7bc[_0x57d3('0x5c')],[_0x57d3('0x6a'),'id'])||{})['spread'](function(_0x3b4a08){for(var _0xaad633=0x0;_0xaad633<_0x17c7bc[_0x57d3('0x5c')][_0x57d3('0x6a')]['length'];_0xaad633+=0x1){socket[_0x57d3('0x71')](_0x57d3('0x72'),{'UserId':Number(_0x17c7bc['body'][_0x57d3('0x6a')][_0xaad633]),'WhatsappAccountId':Number(_0x17c7bc['params']['id'])});}return _0x3b4a08;});}})[_0x57d3('0x21')](respondWithResult(_0x38577c,null))[_0x57d3('0x55')](handleError(_0x38577c,null));};exports[_0x57d3('0x73')]=function(_0x534f7b,_0x404436,_0x473d7a){return db['WhatsappAccount'][_0x57d3('0x61')]({'where':{'id':_0x534f7b[_0x57d3('0x64')]['id']}})[_0x57d3('0x21')](handleEntityNotFound(_0x404436,null))[_0x57d3('0x21')](function(_0x328f5b){if(_0x328f5b){return _0x328f5b[_0x57d3('0x73')](_0x534f7b['query'][_0x57d3('0x6a')])['then'](function(){if(_['isArray'](_0x534f7b['query'][_0x57d3('0x6a')])){for(var _0x10ff46=0x0;_0x10ff46<_0x534f7b['query']['ids'][_0x57d3('0x59')];_0x10ff46+=0x1){socket[_0x57d3('0x71')]('userWhatsappAccount:remove',{'UserId':Number(_0x534f7b[_0x57d3('0x45')]['ids'][_0x10ff46]),'WhatsappAccountId':Number(_0x534f7b['params']['id'])});}}else{socket[_0x57d3('0x71')](_0x57d3('0x74'),{'UserId':Number(_0x534f7b[_0x57d3('0x45')][_0x57d3('0x6a')]),'WhatsappAccountId':Number(_0x534f7b[_0x57d3('0x64')]['id'])});}});}})[_0x57d3('0x21')](respondWithStatusCode(_0x404436,null))['catch'](handleError(_0x404436,null));};exports[_0x57d3('0x75')]=function(_0x4461be,_0x55f5b9,_0x82c124){var _0x5d4dd6={};var _0x400f49={};var _0x501d82;var _0x1d530e;return db[_0x57d3('0x40')][_0x57d3('0x67')]({'where':{'id':_0x4461be[_0x57d3('0x64')]['id']}})[_0x57d3('0x21')](handleEntityNotFound(_0x55f5b9,null))['then'](function(_0x9e93cb){if(_0x9e93cb){_0x501d82=_0x9e93cb;_0x400f49[_0x57d3('0x44')]=_['keys'](db[_0x57d3('0x76')][_0x57d3('0x58')]);_0x400f49[_0x57d3('0x45')]=_[_0x57d3('0x57')](_0x4461be['query']);_0x400f49[_0x57d3('0x4d')]=_['intersection'](_0x400f49[_0x57d3('0x44')],_0x400f49['query']);_0x5d4dd6[_0x57d3('0x47')]=_[_0x57d3('0x46')](_0x400f49[_0x57d3('0x44')],qs['fields'](_0x4461be['query'][_0x57d3('0x48')]));_0x5d4dd6['attributes']=_0x5d4dd6[_0x57d3('0x47')][_0x57d3('0x59')]?_0x5d4dd6['attributes']:_0x400f49['model'];_0x5d4dd6[_0x57d3('0x77')]=qs[_0x57d3('0x4b')](_0x4461be[_0x57d3('0x45')]['sort']);_0x5d4dd6[_0x57d3('0x4e')]=qs['filters'](_[_0x57d3('0x4c')](_0x4461be[_0x57d3('0x45')],_0x400f49[_0x57d3('0x4d')]));if(_0x4461be[_0x57d3('0x45')]['filter']){_0x5d4dd6['where']=_['merge'](_0x5d4dd6[_0x57d3('0x4e')],{'$or':_[_0x57d3('0x3f')](_0x5d4dd6[_0x57d3('0x47')],function(_0x30246a){var _0x27afef={};_0x27afef[_0x30246a]={'$like':'%'+_0x4461be[_0x57d3('0x45')]['filter']+'%'};return _0x27afef;})});}_0x5d4dd6=_[_0x57d3('0x51')]({},_0x5d4dd6,_0x4461be[_0x57d3('0x52')]);return _0x501d82[_0x57d3('0x75')](_0x5d4dd6);}})['then'](function(_0x2ef7f7){if(_0x2ef7f7){_0x1d530e=_0x2ef7f7[_0x57d3('0x59')];if(!_0x4461be[_0x57d3('0x45')][_0x57d3('0x6d')](_0x57d3('0x49'))){_0x5d4dd6[_0x57d3('0x4a')]=qs[_0x57d3('0x4a')](_0x4461be[_0x57d3('0x45')][_0x57d3('0x4a')]);_0x5d4dd6[_0x57d3('0x2d')]=qs['offset'](_0x4461be['query'][_0x57d3('0x2d')]);}return _0x501d82[_0x57d3('0x75')](_0x5d4dd6);}})[_0x57d3('0x21')](function(_0x128574){if(_0x128574){return _0x128574?{'count':_0x1d530e,'rows':_0x128574}:null;}})['then'](respondWithResult(_0x55f5b9,null))['catch'](handleError(_0x55f5b9,null));};exports[_0x57d3('0x78')]=function(_0x536b05,_0x3d6e6e,_0x5b273f){return db['WhatsappAccount'][_0x57d3('0x67')]({'where':{'id':_0x536b05[_0x57d3('0x64')]['id']}})[_0x57d3('0x21')](handleEntityNotFound(_0x3d6e6e,null))[_0x57d3('0x21')](function(_0x4567d1){if(_0x4567d1){return db[_0x57d3('0x79')][_0x57d3('0x7a')](function(_0x113e7d){return db[_0x57d3('0x7b')][_0x57d3('0x39')]({'where':{'WhatsappAccountId':_0x536b05[_0x57d3('0x64')]['id']},'transaction':_0x113e7d})[_0x57d3('0x21')](function(_0x3b3bba){var _0x483eff=_['map'](_0x536b05[_0x57d3('0x5c')],function(_0x3e658c){_0x3e658c[_0x57d3('0x66')]=_0x536b05['params']['id'];return _0x3e658c;});return db[_0x57d3('0x7b')][_0x57d3('0x7c')](_0x483eff,{'transaction':_0x113e7d});});})[_0x57d3('0x21')](function(){return db[_0x57d3('0x7b')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x536b05[_0x57d3('0x64')]['id']},'order':_0x57d3('0x7d')});});}})[_0x57d3('0x21')](respondWithResult(_0x3d6e6e,null))[_0x57d3('0x55')](handleError(_0x3d6e6e,null));};exports[_0x57d3('0x7e')]=function(_0x19f1f4,_0x418199,_0x2cc61b){var _0x71e61e={};var _0x2baba1={};var _0x338e3f;var _0x3512ee;return db[_0x57d3('0x40')][_0x57d3('0x67')]({'where':{'id':_0x19f1f4['params']['id']}})[_0x57d3('0x21')](handleEntityNotFound(_0x418199,null))['then'](function(_0x395803){if(_0x395803){_0x338e3f=_0x395803;_0x2baba1[_0x57d3('0x44')]=_[_0x57d3('0x57')](db['WhatsappApplication'][_0x57d3('0x58')]);_0x2baba1[_0x57d3('0x45')]=_[_0x57d3('0x57')](_0x19f1f4[_0x57d3('0x45')]);_0x2baba1[_0x57d3('0x4d')]=_[_0x57d3('0x46')](_0x2baba1[_0x57d3('0x44')],_0x2baba1[_0x57d3('0x45')]);_0x71e61e[_0x57d3('0x47')]=_[_0x57d3('0x46')](_0x2baba1[_0x57d3('0x44')],qs['fields'](_0x19f1f4[_0x57d3('0x45')][_0x57d3('0x48')]));_0x71e61e[_0x57d3('0x47')]=_0x71e61e[_0x57d3('0x47')]['length']?_0x71e61e['attributes']:_0x2baba1['model'];_0x71e61e['order']=qs[_0x57d3('0x4b')](_0x19f1f4[_0x57d3('0x45')][_0x57d3('0x4b')]);_0x71e61e['where']=qs[_0x57d3('0x4d')](_[_0x57d3('0x4c')](_0x19f1f4['query'],_0x2baba1[_0x57d3('0x4d')]));if(_0x19f1f4[_0x57d3('0x45')][_0x57d3('0x50')]){_0x71e61e[_0x57d3('0x4e')]=_[_0x57d3('0x51')](_0x71e61e['where'],{'$or':_[_0x57d3('0x3f')](_0x71e61e['attributes'],function(_0x5cc162){var _0x35853d={};_0x35853d[_0x5cc162]={'$like':'%'+_0x19f1f4[_0x57d3('0x45')][_0x57d3('0x50')]+'%'};return _0x35853d;})});}_0x71e61e=_[_0x57d3('0x51')]({},_0x71e61e,_0x19f1f4[_0x57d3('0x52')]);return _0x338e3f[_0x57d3('0x7e')](_0x71e61e);}})['then'](function(_0x4f6767){if(_0x4f6767){_0x3512ee=_0x4f6767['length'];if(!_0x19f1f4['query'][_0x57d3('0x6d')](_0x57d3('0x49'))){_0x71e61e[_0x57d3('0x4a')]=qs[_0x57d3('0x4a')](_0x19f1f4[_0x57d3('0x45')]['limit']);_0x71e61e[_0x57d3('0x2d')]=qs[_0x57d3('0x2d')](_0x19f1f4['query'][_0x57d3('0x2d')]);}return _0x338e3f[_0x57d3('0x7e')](_0x71e61e);}})[_0x57d3('0x21')](function(_0x5b6ab7){if(_0x5b6ab7){return _0x5b6ab7?{'count':_0x3512ee,'rows':_0x5b6ab7}:null;}})[_0x57d3('0x21')](respondWithResult(_0x418199,null))[_0x57d3('0x55')](handleError(_0x418199,null));};exports['notify']=function(_0x543ba2,_0x427b73,_0x27a7f9){var _0x6ce185={'channel':_0x57d3('0x7f')};var _0x586c79=[];var _0x38ea04=[];var _0x4260ae={};return db[_0x57d3('0x40')][_0x57d3('0x61')]({'where':{'id':_0x543ba2[_0x57d3('0x64')]['id']},'include':[{'model':db[_0x57d3('0x7b')],'as':_0x57d3('0x80')}]})[_0x57d3('0x21')](handleEntityNotFound(_0x427b73,null))[_0x57d3('0x21')](function(_0x2b4191){_0x6ce185['account']=_0x2b4191;_0x6ce185[_0x57d3('0x81')]=_[_0x57d3('0x82')](_0x2b4191[_0x57d3('0x80')],[_0x57d3('0x7d')],[_0x57d3('0x83')]);if(_0x6ce185[_0x57d3('0x84')][_0x57d3('0x80')]){delete _0x6ce185[_0x57d3('0x84')]['Applications'];}return db[_0x57d3('0x85')][_0x57d3('0x65')]();})[_0x57d3('0x21')](function(_0x91366f){if(!_0x91366f){throw new db[(_0x57d3('0x86'))][(_0x57d3('0x87'))]('no\x20available\x20attributes');}_0x586c79=_[_0x57d3('0x88')](_[_0x57d3('0x57')](_0x91366f),[_0x57d3('0x89'),_0x57d3('0x8a')]);_0x38ea04=_[_0x57d3('0x88')](_[_0x57d3('0x57')](_0x91366f),['createdAt',_0x57d3('0x8a'),'CompanyId',_0x57d3('0x8b')]);_0x6ce185[_0x57d3('0x5c')]={'mapKey':'mobile'};if(_0x6ce185[_0x57d3('0x84')][_0x57d3('0x42')]&&_0x6ce185['account'][_0x57d3('0x42')]===_0x57d3('0x8c')){_0x6ce185['body']['from']=_0x543ba2[_0x57d3('0x5c')][_0x57d3('0x8d')][_0x57d3('0x8e')](_0x57d3('0x8f'),'');_0x6ce185[_0x57d3('0x5c')]['body']=_0x543ba2['body']['Body'];_0x6ce185[_0x57d3('0x5c')]['messageId']=_0x543ba2['body']['MessageSid'];}if(_0x6ce185['body']['id']){delete _0x6ce185[_0x57d3('0x5c')]['id'];}if(_[_0x57d3('0x90')](_0x6ce185[_0x57d3('0x5c')][_0x57d3('0x91')])){throw new db[(_0x57d3('0x86'))][(_0x57d3('0x87'))]('from\x20is\x20mandatory');}if(_[_0x57d3('0x90')](_0x6ce185[_0x57d3('0x5c')][_0x57d3('0x5c')])||_0x6ce185[_0x57d3('0x5c')][_0x57d3('0x5c')]===''){throw new db[(_0x57d3('0x86'))][(_0x57d3('0x87'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x6ce185[_0x57d3('0x5c')][_0x57d3('0x92')])){throw new db[(_0x57d3('0x86'))][(_0x57d3('0x87'))](_0x57d3('0x93')+_0x38ea04);}if(!_[_0x57d3('0x94')](_0x38ea04,_0x6ce185[_0x57d3('0x5c')]['mapKey'])){throw new db[(_0x57d3('0x86'))][(_0x57d3('0x87'))](_0x57d3('0x95')+_0x38ea04);}_0x4260ae[_0x6ce185[_0x57d3('0x5c')][_0x57d3('0x92')]]=_0x6ce185[_0x57d3('0x5c')]['from'];return db['CmList'][_0x57d3('0x61')]({'where':{'id':_0x6ce185[_0x57d3('0x84')]['ListId']},'include':[{'model':db[_0x57d3('0x85')],'as':'Contacts','where':_0x4260ae,'limit':0x1,'order':[[_0x57d3('0x8a'),_0x57d3('0x96')]]}]});})[_0x57d3('0x21')](handleEntityNotFound(_0x427b73,null))['then'](function(_0x53d81a){if(_0x53d81a){_0x6ce185[_0x57d3('0x97')]=_['omit'](_0x53d81a,[_0x57d3('0x98')]);if(_0x53d81a[_0x57d3('0x98')][_0x57d3('0x59')]){return _0x53d81a[_0x57d3('0x98')][0x0];}var _0x52e9f7=_[_0x57d3('0x99')](_0x6ce185[_0x57d3('0x5c')],{'firstName':_0x6ce185[_0x57d3('0x5c')][_0x57d3('0x91')],'ListId':_0x53d81a['id']});_0x52e9f7[_0x6ce185['body'][_0x57d3('0x92')]]=_0x6ce185[_0x57d3('0x5c')][_0x57d3('0x91')];return db[_0x57d3('0x85')][_0x57d3('0x5b')](_0x52e9f7,{'fields':_0x586c79,'raw':!![]});}})[_0x57d3('0x21')](handleEntityNotFound(_0x427b73,null))[_0x57d3('0x21')](function(_0x5653cc){if(_0x5653cc){_0x6ce185['contact']=_0x5653cc;var _0x56ece7={'ContactId':_0x5653cc['id'],'phone':_0x6ce185[_0x57d3('0x5c')][_0x57d3('0x91')],'WhatsappAccountId':_0x543ba2[_0x57d3('0x64')]['id']};var _0xd05388={'ContactId':_0x5653cc['id'],'WhatsappAccountId':_0x543ba2[_0x57d3('0x64')]['id'],'closed':![]};return db[_0x57d3('0x9a')][_0x57d3('0x61')]({'where':_0xd05388})[_0x57d3('0x21')](function(_0x2af941){if(_0x2af941){return[_0x2af941,![]];}return db[_0x57d3('0x9a')][_0x57d3('0x5b')](_0x56ece7)[_0x57d3('0x21')](function(_0x38d877){return[_0x38d877,!![]];});});}})[_0x57d3('0x9b')](function(_0x261ec5,_0x5b52f6){_0x6ce185['interaction']=_0x261ec5[_0x57d3('0x36')]({'plain':!![]});_0x6ce185['interaction'][_0x57d3('0x9c')]=![];if(_0x5b52f6){if(_0x6ce185[_0x57d3('0x84')][_0x57d3('0x9d')]){_0x6ce185[_0x57d3('0x81')]['push']({'id':0x0,'priority':_0x6ce185[_0x57d3('0x81')][_0x57d3('0x59')]+0x1,'app':_0x57d3('0x9e'),'appdata':_0x57d3('0x9f'),'interval':'*,*,*,*'});}_0x6ce185[_0x57d3('0xa0')][_0x57d3('0x9c')]=!![];}return db['WhatsappMessage'][_0x57d3('0x5b')]({'phone':_0x6ce185[_0x57d3('0x5c')][_0x57d3('0x91')],'messageId':_0x6ce185[_0x57d3('0x5c')]['messageId'],'body':_0x6ce185[_0x57d3('0x5c')][_0x57d3('0x5c')],'WhatsappAccountId':_0x543ba2[_0x57d3('0x64')]['id'],'WhatsappInteractionId':_0x261ec5['id'],'direction':'in','ContactId':_0x261ec5['ContactId'],'AttachmentId':_0x6ce185[_0x57d3('0x5c')]['AttachmentId']});})[_0x57d3('0x21')](function(_0x49a455){_0x6ce185[_0x57d3('0x29')]=_0x49a455;if(_0x6ce185['interaction'][_0x57d3('0xa1')]){return db[_0x57d3('0x76')][_0x57d3('0x61')]({'attributes':['id','name'],'where':{'id':_0x6ce185['interaction'][_0x57d3('0xa1')]}})[_0x57d3('0x21')](function(_0x58f8ef){if(_0x58f8ef){_0x6ce185[_0x57d3('0x81')][_0x57d3('0xa2')]({'id':0x0,'priority':0x0,'app':_0x57d3('0xa3'),'appdata':_0x58f8ef[_0x57d3('0x3b')]+','+(_0x6ce185[_0x57d3('0x84')]['waitForTheAssignedAgent']||0xa),'interval':_0x57d3('0xa4')});}return respondWithRpcPromise('Start',_0x57d3('0xa5'),_0x6ce185);});}return respondWithRpcPromise(_0x57d3('0xa6'),_0x57d3('0xa5'),_0x6ce185);})[_0x57d3('0x21')](function(_0x2a8475){if(_0x2a8475){var _0x11c680=0xc8;var _0x3d0032=_0x57d3('0xa7');logger[_0x57d3('0x22')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x3d0032,_0x11c680,'entity\x20found');logger[_0x57d3('0xa8')](_0x57d3('0xa9'),_0x3d0032,_0x11c680,_0x57d3('0xaa'),JSON[_0x57d3('0x26')](_0x2a8475));if(_0x6ce185[_0x57d3('0x84')]['type']===_0x57d3('0x8c')){return _0x427b73['status'](_0x11c680)[_0x57d3('0x30')](_0x57d3('0xab'),'text/xml')[_0x57d3('0x3c')](_0x57d3('0xac'));}else{return _0x427b73[_0x57d3('0x2a')](_0x11c680)[_0x57d3('0x2c')](_0x2a8475);}}})['catch'](handleError(_0x427b73,null));};exports[_0x57d3('0x3c')]=function(_0x50130c,_0x64a329,_0x5af246){var _0x1b1330,_0x38c4ae,_0x72b5b3;if(_[_0x57d3('0x90')](_0x50130c[_0x57d3('0x5c')][_0x57d3('0x5c')])||_0x50130c[_0x57d3('0x5c')][_0x57d3('0x5c')]===''){throw new db[(_0x57d3('0x86'))][(_0x57d3('0x87'))](_0x57d3('0xad'));}if(_['isNil'](_0x50130c[_0x57d3('0x5c')]['to'])){throw new db[(_0x57d3('0x86'))][(_0x57d3('0x87'))](_0x57d3('0xae'));}_0x1b1330=_0x50130c[_0x57d3('0x5c')]['to'];return db[_0x57d3('0x40')]['find']({'where':{'id':_0x50130c['params']['id']},'include':[{'model':db[_0x57d3('0xaf')],'as':_0x57d3('0xb0'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'mobile':_0x1b1330},'limit':0x1,'order':[['updatedAt',_0x57d3('0x96')]]}]}]})[_0x57d3('0x21')](handleEntityNotFound(_0x64a329,null))[_0x57d3('0x21')](function(_0x4c1eef){if(_0x4c1eef&&_0x4c1eef['List']){_0x38c4ae=_0x4c1eef[_0x57d3('0x36')]({'plain':!![]});if(_0x38c4ae[_0x57d3('0xb0')]&&_0x38c4ae[_0x57d3('0xb0')][_0x57d3('0x98')][_0x57d3('0x59')]){return _0x38c4ae[_0x57d3('0xb0')][_0x57d3('0x98')][0x0];}return db['CmContact'][_0x57d3('0x5b')](_[_0x57d3('0x99')](_0x50130c[_0x57d3('0x5c')],{'firstName':_0x1b1330,'mobile':_0x1b1330,'phone':_0x1b1330,'ListId':_0x38c4ae[_0x57d3('0x8b')]}));}})[_0x57d3('0x21')](handleEntityNotFound(_0x64a329,null))['then'](function(_0x475195){if(_0x475195){_0x72b5b3=_0x475195;return db[_0x57d3('0x9a')][_0x57d3('0x61')]({'where':{'ContactId':_0x72b5b3['id'],'closed':![],'WhatsappAccountId':_0x38c4ae['id']}})[_0x57d3('0x21')](function(_0x224dfa){if(_0x224dfa){return[_0x224dfa,![]];}return db[_0x57d3('0x9a')][_0x57d3('0x5b')]({'UserId':_0x50130c['user']['id'],'ContactId':_0x72b5b3['id'],'WhatsappAccountId':_0x38c4ae['id'],'phone':_0x1b1330,'firstMsgDirection':_0x57d3('0xb1'),'Messages':[_['merge'](_0x50130c[_0x57d3('0x5c')],{'read':![],'body':_0x50130c['body'][_0x57d3('0x5c')],'phone':_0x1b1330,'WhatsappAccountId':_0x38c4ae['id'],'UserId':_0x50130c[_0x57d3('0x5d')]['id'],'ContactId':_0x72b5b3['id']})]},{'include':[{'model':db[_0x57d3('0xb2')],'as':'Messages'}]})['then'](function(_0x1c72b6){return[_0x1c72b6,!![]];});});}})[_0x57d3('0x9b')](function(_0x31f2ea,_0x521f49){if(_0x521f49){return _0x31f2ea;}return db['WhatsappMessage'][_0x57d3('0x5b')](_['merge'](_0x50130c['body'],{'read':![],'body':_0x50130c[_0x57d3('0x5c')][_0x57d3('0x5c')],'phone':_0x1b1330,'WhatsappAccountId':_0x38c4ae['id'],'WhatsappInteractionId':_0x31f2ea['id'],'UserId':_0x50130c[_0x57d3('0x5d')]['id'],'ContactId':_0x72b5b3['id']}))[_0x57d3('0x21')](function(_0x15162c){_0x31f2ea[_0x57d3('0xb3')][_0x57d3('0xb4')]=[];_0x31f2ea['dataValues'][_0x57d3('0xb4')][_0x57d3('0xb5')](_0x15162c['dataValues']);return _0x31f2ea;});})[_0x57d3('0x21')](respondWithResult(_0x64a329,null))[_0x57d3('0x55')](handleError(_0x64a329,null));}; \ No newline at end of file +var _0x5f82=['autoclose','push','close','*,*,*,*','WhatsappMessage','ContactId','AttachmentId','UserId','unshift','waitForTheAssignedAgent','startRouting','Start','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','text/xml','send','\x0a','to\x20is\x20mandatory','CmList','DESC','List','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','register','jayson/promise','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','error','message','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','get','WhatsappAccounts','UserProfileResource','stack','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','describe','WhatsappAccountId','Disposition','findOne','removeDispositions','ids','addAnswer','CannedAnswer','pick','removeAnswers','addAgents','omit','spread','removeAgents','emit','userWhatsappAccount:remove','User','getAgents','sequelize','transaction','WhatsappApplication','findAndCountAll','priority','getApplications','notify','whatsapp','Applications','account','applications','orderBy','asc','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','from','From','replace','whatsapp:','Body','messageId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmContact','Contacts','list','contact','WhatsappInteraction','interaction','created'];(function(_0x3a1af9,_0x3deeb9){var _0x20f9c2=function(_0x2f41ce){while(--_0x2f41ce){_0x3a1af9['push'](_0x3a1af9['shift']());}};_0x20f9c2(++_0x3deeb9);}(_0x5f82,0xcf));var _0x25f8=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x5f82[_0x411017];return _0x2adeea;};'use strict';var emlformat=require(_0x25f8('0x0'));var rimraf=require(_0x25f8('0x1'));var zipdir=require(_0x25f8('0x2'));var jsonpatch=require(_0x25f8('0x3'));var rp=require(_0x25f8('0x4'));var moment=require('moment');var BPromise=require(_0x25f8('0x5'));var Mustache=require(_0x25f8('0x6'));var util=require('util');var path=require(_0x25f8('0x7'));var sox=require(_0x25f8('0x8'));var csv=require(_0x25f8('0x9'));var ejs=require(_0x25f8('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x25f8('0xb'));var crypto=require(_0x25f8('0xc'));var jsforce=require(_0x25f8('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x25f8('0x9'));var querystring=require(_0x25f8('0xe'));var Papa=require(_0x25f8('0xf'));var Redis=require(_0x25f8('0x10'));var authService=require(_0x25f8('0x11'));var qs=require(_0x25f8('0x12'));var as=require(_0x25f8('0x13'));var hardwareService=require(_0x25f8('0x14'));var logger=require('../../config/logger')(_0x25f8('0x15'));var utils=require('../../config/utils');var config=require(_0x25f8('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x25f8('0x17'))['db'];config['redis']=_[_0x25f8('0x18')](config[_0x25f8('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x25f8('0x1a'))(new Redis(config[_0x25f8('0x19')]));require('./whatsappAccount.socket')[_0x25f8('0x1b')](socket);var jayson=require(_0x25f8('0x1c'));var client=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x3ca641,_0x6bf4d7,_0x283c34,_0x438514){return new BPromise(function(_0x29bb67,_0xa0ee70){var _0x51bb6b=_0x438514||client;return _0x51bb6b['request'](_0x3ca641,_0x283c34)[_0x25f8('0x1d')](function(_0x28fa29){logger[_0x25f8('0x1e')](_0x25f8('0x1f'),_0x6bf4d7,_0x25f8('0x20'));logger[_0x25f8('0x21')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x6bf4d7,_0x25f8('0x20'),JSON['stringify'](_0x28fa29));if(_0x28fa29[_0x25f8('0x22')]){if(_0x28fa29[_0x25f8('0x22')]['code']===0x1f4){logger[_0x25f8('0x22')]('WhatsappAccount,\x20%s,\x20%s',_0x6bf4d7,_0x28fa29['error'][_0x25f8('0x23')]);return _0xa0ee70(_0x28fa29[_0x25f8('0x22')][_0x25f8('0x23')]);}logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x6bf4d7,_0x28fa29[_0x25f8('0x22')]['message']);return _0x29bb67(_0x28fa29['error'][_0x25f8('0x23')]);}else{logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x6bf4d7,_0x25f8('0x20'));_0x29bb67(_0x28fa29['result'][_0x25f8('0x23')]);}})['catch'](function(_0x5a5e51){logger[_0x25f8('0x22')]('WhatsappAccount,\x20%s,\x20%s',_0x6bf4d7,_0x5a5e51);_0xa0ee70(_0x5a5e51);});});}function respondWithStatusCode(_0xf47933,_0x15e56e){_0x15e56e=_0x15e56e||0xcc;return function(_0x4e91f0){if(_0x4e91f0){return _0xf47933[_0x25f8('0x24')](_0x15e56e);}return _0xf47933[_0x25f8('0x25')](_0x15e56e)[_0x25f8('0x26')]();};}function respondWithResult(_0xa87fb8,_0x29d0b7){_0x29d0b7=_0x29d0b7||0xc8;return function(_0x1f7fc4){if(_0x1f7fc4){return _0xa87fb8[_0x25f8('0x25')](_0x29d0b7)[_0x25f8('0x27')](_0x1f7fc4);}};}function respondWithFilteredResult(_0x3d66b7,_0x20ce2a){return function(_0x5bec31){if(_0x5bec31){var _0x30ca5d=typeof _0x20ce2a[_0x25f8('0x28')]===_0x25f8('0x29')&&typeof _0x20ce2a['limit']===_0x25f8('0x29');var _0x54b260=_0x5bec31[_0x25f8('0x2a')];var _0x17a145=_0x30ca5d?0x0:_0x20ce2a[_0x25f8('0x28')];var _0x14b2d3=_0x30ca5d?_0x5bec31['count']:_0x20ce2a[_0x25f8('0x28')]+_0x20ce2a[_0x25f8('0x2b')];var _0x12811a;if(_0x14b2d3>=_0x54b260){_0x14b2d3=_0x54b260;_0x12811a=0xc8;}else{_0x12811a=0xce;}_0x3d66b7['status'](_0x12811a);return _0x3d66b7[_0x25f8('0x2c')](_0x25f8('0x2d'),_0x17a145+'-'+_0x14b2d3+'/'+_0x54b260)[_0x25f8('0x27')](_0x5bec31);}return null;};}function patchUpdates(_0x77b99a){return function(_0x30e775){try{jsonpatch[_0x25f8('0x2e')](_0x30e775,_0x77b99a,!![]);}catch(_0xe42090){return BPromise[_0x25f8('0x2f')](_0xe42090);}return _0x30e775[_0x25f8('0x30')]();};}function saveUpdates(_0x432429,_0x41a0f8){return function(_0x5dc516){if(_0x5dc516){return _0x5dc516[_0x25f8('0x31')](_0x432429)[_0x25f8('0x1d')](function(_0x1f3710){return _0x1f3710;});}return null;};}function removeEntity(_0x543af4,_0x5a9b10){return function(_0x3bbd40){if(_0x3bbd40){return _0x3bbd40[_0x25f8('0x32')]()['then'](function(){var _0x1e125d=_0x3bbd40[_0x25f8('0x33')]({'plain':!![]});var _0xc91feb=_0x25f8('0x34');return db[_0x25f8('0x35')][_0x25f8('0x32')]({'where':{'type':_0xc91feb,'resourceId':_0x1e125d['id']}})[_0x25f8('0x1d')](function(){return _0x3bbd40;});})[_0x25f8('0x1d')](function(){_0x543af4[_0x25f8('0x25')](0xcc)[_0x25f8('0x26')]();});}};}function handleEntityNotFound(_0x2f7c12,_0x265f5a){return function(_0x33aae5){if(!_0x33aae5){_0x2f7c12[_0x25f8('0x24')](0x194);}return _0x33aae5;};}function handleError(_0x5ebd33,_0x14d619){_0x14d619=_0x14d619||0x1f4;return function(_0x232dde){logger[_0x25f8('0x22')](_0x232dde[_0x25f8('0x36')]);if(_0x232dde['name']){delete _0x232dde['name'];}_0x5ebd33['status'](_0x14d619)['send'](_0x232dde);};}exports[_0x25f8('0x37')]=function(_0x130a7d,_0x4af522){var _0x52b91d={'include':[{'model':db[_0x25f8('0x38')],'as':_0x25f8('0x39')}]},_0x227f68={},_0x1b3875={'count':0x0,'rows':[]};var _0x48815c=_[_0x25f8('0x3a')](db[_0x25f8('0x3b')][_0x25f8('0x3c')],function(_0x5db459){return{'name':_0x5db459[_0x25f8('0x3d')],'type':_0x5db459[_0x25f8('0x3e')][_0x25f8('0x3f')]};});_0x227f68[_0x25f8('0x40')]=_[_0x25f8('0x3a')](_0x48815c,_0x25f8('0x41'));_0x227f68[_0x25f8('0x42')]=_[_0x25f8('0x43')](_0x130a7d[_0x25f8('0x42')]);_0x227f68[_0x25f8('0x44')]=_[_0x25f8('0x45')](_0x227f68[_0x25f8('0x40')],_0x227f68[_0x25f8('0x42')]);_0x52b91d[_0x25f8('0x46')]=_[_0x25f8('0x45')](_0x227f68[_0x25f8('0x40')],qs[_0x25f8('0x47')](_0x130a7d[_0x25f8('0x42')][_0x25f8('0x47')]));_0x52b91d['attributes']=_0x52b91d[_0x25f8('0x46')][_0x25f8('0x48')]?_0x52b91d[_0x25f8('0x46')]:_0x227f68[_0x25f8('0x40')];if(!_0x130a7d[_0x25f8('0x42')][_0x25f8('0x49')](_0x25f8('0x4a'))){_0x52b91d[_0x25f8('0x2b')]=qs[_0x25f8('0x2b')](_0x130a7d['query'][_0x25f8('0x2b')]);_0x52b91d['offset']=qs[_0x25f8('0x28')](_0x130a7d['query'][_0x25f8('0x28')]);}_0x52b91d[_0x25f8('0x4b')]=qs[_0x25f8('0x4c')](_0x130a7d[_0x25f8('0x42')][_0x25f8('0x4c')]);_0x52b91d['where']=qs[_0x25f8('0x44')](_['pick'](_0x130a7d[_0x25f8('0x42')],_0x227f68['filters']),_0x48815c);if(_0x130a7d[_0x25f8('0x42')][_0x25f8('0x4d')]){_0x52b91d[_0x25f8('0x4e')]=_[_0x25f8('0x4f')](_0x52b91d[_0x25f8('0x4e')],{'$or':_[_0x25f8('0x3a')](_0x48815c,function(_0x580275){if(_0x580275[_0x25f8('0x3e')]!=='VIRTUAL'){var _0x3bdf02={};_0x3bdf02[_0x580275[_0x25f8('0x41')]]={'$like':'%'+_0x130a7d[_0x25f8('0x42')][_0x25f8('0x4d')]+'%'};return _0x3bdf02;}})});}_0x52b91d=_['merge']({},_0x52b91d,_0x130a7d[_0x25f8('0x50')]);var _0x6c7d9a={'where':_0x52b91d['where']};return db[_0x25f8('0x3b')][_0x25f8('0x2a')](_0x6c7d9a)[_0x25f8('0x1d')](function(_0xa7245){_0x1b3875['count']=_0xa7245;if(_0x130a7d[_0x25f8('0x42')]['includeAll']){_0x52b91d[_0x25f8('0x51')]=[{'all':!![]}];}return db['WhatsappAccount'][_0x25f8('0x52')](_0x52b91d);})[_0x25f8('0x1d')](function(_0x436e73){_0x1b3875[_0x25f8('0x53')]=_0x436e73;return _0x1b3875;})[_0x25f8('0x1d')](respondWithFilteredResult(_0x4af522,_0x52b91d))[_0x25f8('0x54')](handleError(_0x4af522,null));};exports[_0x25f8('0x55')]=function(_0x56d77d,_0x1a3e7f){var _0x4e8ae2={'raw':![],'where':{'id':_0x56d77d[_0x25f8('0x56')]['id']},'include':[{'model':db[_0x25f8('0x38')],'as':_0x25f8('0x39')}]},_0x4a855f={};_0x4a855f[_0x25f8('0x40')]=_['keys'](db[_0x25f8('0x3b')][_0x25f8('0x3c')]);_0x4a855f[_0x25f8('0x42')]=_[_0x25f8('0x43')](_0x56d77d[_0x25f8('0x42')]);_0x4a855f[_0x25f8('0x44')]=_[_0x25f8('0x45')](_0x4a855f['model'],_0x4a855f['query']);_0x4e8ae2[_0x25f8('0x46')]=_[_0x25f8('0x45')](_0x4a855f[_0x25f8('0x40')],qs[_0x25f8('0x47')](_0x56d77d[_0x25f8('0x42')][_0x25f8('0x47')]));_0x4e8ae2[_0x25f8('0x46')]=_0x4e8ae2[_0x25f8('0x46')][_0x25f8('0x48')]?_0x4e8ae2['attributes']:_0x4a855f[_0x25f8('0x40')];if(_0x56d77d[_0x25f8('0x42')][_0x25f8('0x57')]){_0x4e8ae2[_0x25f8('0x51')]=[{'all':!![]}];}_0x4e8ae2=_['merge']({},_0x4e8ae2,_0x56d77d[_0x25f8('0x50')]);return db[_0x25f8('0x3b')][_0x25f8('0x58')](_0x4e8ae2)[_0x25f8('0x1d')](handleEntityNotFound(_0x1a3e7f,null))['then'](respondWithResult(_0x1a3e7f,null))[_0x25f8('0x54')](handleError(_0x1a3e7f,null));};exports[_0x25f8('0x59')]=function(_0x1fb6e0,_0x32c148){return db[_0x25f8('0x3b')][_0x25f8('0x59')](_0x1fb6e0[_0x25f8('0x5a')],{})[_0x25f8('0x1d')](function(_0x1b4c6e){var _0x4ae22c=_0x1fb6e0['user'][_0x25f8('0x33')]({'plain':!![]});if(!_0x4ae22c)throw new Error(_0x25f8('0x5b'));if(_0x4ae22c[_0x25f8('0x5c')]===_0x25f8('0x5d')){var _0x35f473=_0x1b4c6e[_0x25f8('0x33')]({'plain':!![]});var _0x443787='WhatsappAccounts';return db[_0x25f8('0x5e')][_0x25f8('0x58')]({'where':{'name':_0x443787,'userProfileId':_0x4ae22c[_0x25f8('0x5f')]},'raw':!![]})[_0x25f8('0x1d')](function(_0x5f3280){if(_0x5f3280&&_0x5f3280['autoAssociation']===0x0){return db[_0x25f8('0x35')]['create']({'name':_0x35f473[_0x25f8('0x41')],'resourceId':_0x35f473['id'],'type':_0x5f3280[_0x25f8('0x41')],'sectionId':_0x5f3280['id']},{})[_0x25f8('0x1d')](function(){return _0x1b4c6e;});}else{return _0x1b4c6e;}})[_0x25f8('0x54')](function(_0x473605){logger[_0x25f8('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x473605);throw _0x473605;});}return _0x1b4c6e;})['then'](respondWithResult(_0x32c148,0xc9))[_0x25f8('0x54')](handleError(_0x32c148,null));};exports[_0x25f8('0x31')]=function(_0x3ed4fd,_0x51eb1e){if(_0x3ed4fd[_0x25f8('0x5a')]['id']){delete _0x3ed4fd[_0x25f8('0x5a')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x3ed4fd[_0x25f8('0x56')]['id']},'include':[{'model':db[_0x25f8('0x38')],'as':'mandatoryDispositionPause'}]})[_0x25f8('0x1d')](handleEntityNotFound(_0x51eb1e,null))['then'](saveUpdates(_0x3ed4fd[_0x25f8('0x5a')],null))[_0x25f8('0x1d')](respondWithResult(_0x51eb1e,null))['catch'](handleError(_0x51eb1e,null));};exports['destroy']=function(_0x25f8bd,_0x3a5e85){return db[_0x25f8('0x3b')][_0x25f8('0x58')]({'where':{'id':_0x25f8bd[_0x25f8('0x56')]['id']}})[_0x25f8('0x1d')](handleEntityNotFound(_0x3a5e85,null))['then'](removeEntity(_0x3a5e85,null))['catch'](handleError(_0x3a5e85,null));};exports[_0x25f8('0x60')]=function(_0x4f6a83,_0x4e2fd4){return db[_0x25f8('0x3b')][_0x25f8('0x60')]()['then'](respondWithResult(_0x4e2fd4,null))[_0x25f8('0x54')](handleError(_0x4e2fd4,null));};exports['addDisposition']=function(_0x323f0f,_0x2c2f2d,_0xad2ac0){if(_0x323f0f[_0x25f8('0x5a')]['id']){delete _0x323f0f['body']['id'];}return db[_0x25f8('0x3b')]['find']({'where':{'id':_0x323f0f[_0x25f8('0x56')]['id']}})[_0x25f8('0x1d')](handleEntityNotFound(_0x2c2f2d,null))[_0x25f8('0x1d')](function(_0x4a38da){if(_0x4a38da){_0x323f0f[_0x25f8('0x5a')][_0x25f8('0x61')]=_0x4a38da['id'];return db[_0x25f8('0x62')][_0x25f8('0x59')](_0x323f0f[_0x25f8('0x5a')]);}})[_0x25f8('0x1d')](respondWithResult(_0x2c2f2d,null))['catch'](handleError(_0x2c2f2d,null));};exports['getDispositions']=function(_0x51e4f3,_0x14973e,_0x498874){var _0x2e1e57={'raw':![],'where':{}};var _0x5600db={};var _0xe770db={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x25f8('0x63')]({'where':{'id':_0x51e4f3['params']['id']}})[_0x25f8('0x1d')](handleEntityNotFound(_0x14973e,null))[_0x25f8('0x1d')](function(_0x33f4a9){if(_0x33f4a9){_0x5600db[_0x25f8('0x40')]=_[_0x25f8('0x43')](db[_0x25f8('0x62')]['rawAttributes']);_0x5600db['query']=_[_0x25f8('0x43')](_0x51e4f3[_0x25f8('0x42')]);_0x5600db[_0x25f8('0x44')]=_[_0x25f8('0x45')](_0x5600db[_0x25f8('0x40')],_0x5600db[_0x25f8('0x42')]);_0x2e1e57[_0x25f8('0x46')]=_[_0x25f8('0x45')](_0x5600db['model'],qs[_0x25f8('0x47')](_0x51e4f3[_0x25f8('0x42')]['fields']));_0x2e1e57[_0x25f8('0x46')]=_0x2e1e57['attributes'][_0x25f8('0x48')]?_0x2e1e57[_0x25f8('0x46')]:_0x5600db['model'];if(!_0x51e4f3[_0x25f8('0x42')][_0x25f8('0x49')](_0x25f8('0x4a'))){_0x2e1e57[_0x25f8('0x2b')]=qs[_0x25f8('0x2b')](_0x51e4f3[_0x25f8('0x42')][_0x25f8('0x2b')]);_0x2e1e57[_0x25f8('0x28')]=qs['offset'](_0x51e4f3['query'][_0x25f8('0x28')]);}_0x2e1e57[_0x25f8('0x4b')]=qs[_0x25f8('0x4c')](_0x51e4f3[_0x25f8('0x42')]['sort']);_0x2e1e57[_0x25f8('0x4e')]=qs[_0x25f8('0x44')](_['pick'](_0x51e4f3[_0x25f8('0x42')],_0x5600db[_0x25f8('0x44')]));_0x2e1e57[_0x25f8('0x4e')][_0x25f8('0x61')]=_0x33f4a9['id'];if(_0x51e4f3[_0x25f8('0x42')][_0x25f8('0x4d')]){_0x2e1e57[_0x25f8('0x4e')]=_['merge'](_0x2e1e57['where'],{'$or':_[_0x25f8('0x3a')](_0x2e1e57[_0x25f8('0x46')],function(_0x244c20){var _0x4d8273={};_0x4d8273[_0x244c20]={'$like':'%'+_0x51e4f3[_0x25f8('0x42')][_0x25f8('0x4d')]+'%'};return _0x4d8273;})});}_0x2e1e57=_[_0x25f8('0x4f')]({},_0x2e1e57,_0x51e4f3[_0x25f8('0x50')]);return db[_0x25f8('0x62')][_0x25f8('0x2a')]({'where':_0x2e1e57[_0x25f8('0x4e')]})['then'](function(_0xf0f004){_0xe770db[_0x25f8('0x2a')]=_0xf0f004;if(_0x51e4f3[_0x25f8('0x42')][_0x25f8('0x57')]){_0x2e1e57[_0x25f8('0x51')]=[{'all':!![]}];}return db[_0x25f8('0x62')][_0x25f8('0x52')](_0x2e1e57);})[_0x25f8('0x1d')](function(_0x22ee1a){_0xe770db[_0x25f8('0x53')]=_0x22ee1a;return _0xe770db;});}})[_0x25f8('0x1d')](respondWithFilteredResult(_0x14973e,_0x2e1e57))[_0x25f8('0x54')](handleError(_0x14973e,null));};exports[_0x25f8('0x64')]=function(_0x490dbb,_0x1645a8,_0x2cfcfd){return db[_0x25f8('0x3b')][_0x25f8('0x58')]({'where':{'id':_0x490dbb[_0x25f8('0x56')]['id']}})[_0x25f8('0x1d')](handleEntityNotFound(_0x1645a8,null))[_0x25f8('0x1d')](function(_0x38635c){if(_0x38635c){return _0x38635c[_0x25f8('0x64')](_0x490dbb['query'][_0x25f8('0x65')]);}})[_0x25f8('0x1d')](respondWithStatusCode(_0x1645a8,null))[_0x25f8('0x54')](handleError(_0x1645a8,null));};exports[_0x25f8('0x66')]=function(_0x32c821,_0x22086e,_0x507dc1){if(_0x32c821[_0x25f8('0x5a')]['id']){delete _0x32c821[_0x25f8('0x5a')]['id'];}return db['WhatsappAccount'][_0x25f8('0x58')]({'where':{'id':_0x32c821['params']['id']}})['then'](handleEntityNotFound(_0x22086e,null))[_0x25f8('0x1d')](function(_0x5e780e){if(_0x5e780e){_0x32c821['body']['WhatsappAccountId']=_0x5e780e['id'];return db[_0x25f8('0x67')][_0x25f8('0x59')](_0x32c821[_0x25f8('0x5a')]);}})[_0x25f8('0x1d')](respondWithResult(_0x22086e,null))[_0x25f8('0x54')](handleError(_0x22086e,null));};exports['getAnswers']=function(_0x327e54,_0x2020b9,_0x94d142){var _0x493b47={'raw':![],'where':{}};var _0xe110b9={};var _0x412bee={'count':0x0,'rows':[]};return db[_0x25f8('0x3b')]['findOne']({'where':{'id':_0x327e54['params']['id']}})['then'](handleEntityNotFound(_0x2020b9,null))[_0x25f8('0x1d')](function(_0x5d9aad){if(_0x5d9aad){_0xe110b9[_0x25f8('0x40')]=_['keys'](db['CannedAnswer']['rawAttributes']);_0xe110b9['query']=_[_0x25f8('0x43')](_0x327e54['query']);_0xe110b9[_0x25f8('0x44')]=_[_0x25f8('0x45')](_0xe110b9[_0x25f8('0x40')],_0xe110b9[_0x25f8('0x42')]);_0x493b47[_0x25f8('0x46')]=_[_0x25f8('0x45')](_0xe110b9[_0x25f8('0x40')],qs['fields'](_0x327e54['query'][_0x25f8('0x47')]));_0x493b47['attributes']=_0x493b47['attributes'][_0x25f8('0x48')]?_0x493b47[_0x25f8('0x46')]:_0xe110b9['model'];if(!_0x327e54[_0x25f8('0x42')][_0x25f8('0x49')](_0x25f8('0x4a'))){_0x493b47['limit']=qs['limit'](_0x327e54[_0x25f8('0x42')][_0x25f8('0x2b')]);_0x493b47[_0x25f8('0x28')]=qs[_0x25f8('0x28')](_0x327e54[_0x25f8('0x42')]['offset']);}_0x493b47[_0x25f8('0x4b')]=qs[_0x25f8('0x4c')](_0x327e54[_0x25f8('0x42')][_0x25f8('0x4c')]);_0x493b47['where']=qs[_0x25f8('0x44')](_[_0x25f8('0x68')](_0x327e54[_0x25f8('0x42')],_0xe110b9[_0x25f8('0x44')]));_0x493b47[_0x25f8('0x4e')][_0x25f8('0x61')]=_0x5d9aad['id'];if(_0x327e54[_0x25f8('0x42')][_0x25f8('0x4d')]){_0x493b47['where']=_['merge'](_0x493b47[_0x25f8('0x4e')],{'$or':_[_0x25f8('0x3a')](_0x493b47['attributes'],function(_0x4768f6){var _0x1ff60e={};_0x1ff60e[_0x4768f6]={'$like':'%'+_0x327e54[_0x25f8('0x42')][_0x25f8('0x4d')]+'%'};return _0x1ff60e;})});}_0x493b47=_['merge']({},_0x493b47,_0x327e54[_0x25f8('0x50')]);return db[_0x25f8('0x67')][_0x25f8('0x2a')]({'where':_0x493b47[_0x25f8('0x4e')]})[_0x25f8('0x1d')](function(_0x181ad0){_0x412bee['count']=_0x181ad0;if(_0x327e54[_0x25f8('0x42')][_0x25f8('0x57')]){_0x493b47['include']=[{'all':!![]}];}return db[_0x25f8('0x67')]['findAll'](_0x493b47);})[_0x25f8('0x1d')](function(_0x2def4f){_0x412bee[_0x25f8('0x53')]=_0x2def4f;return _0x412bee;});}})[_0x25f8('0x1d')](respondWithFilteredResult(_0x2020b9,_0x493b47))[_0x25f8('0x54')](handleError(_0x2020b9,null));};exports[_0x25f8('0x69')]=function(_0x237a41,_0x5c3f26,_0x57003c){return db[_0x25f8('0x3b')]['find']({'where':{'id':_0x237a41[_0x25f8('0x56')]['id']}})['then'](handleEntityNotFound(_0x5c3f26,null))['then'](function(_0x1d93a9){if(_0x1d93a9){return _0x1d93a9[_0x25f8('0x69')](_0x237a41[_0x25f8('0x42')]['ids']);}})[_0x25f8('0x1d')](respondWithStatusCode(_0x5c3f26,null))[_0x25f8('0x54')](handleError(_0x5c3f26,null));};exports[_0x25f8('0x6a')]=function(_0x1ef813,_0x387c7c,_0x36ee55){return db[_0x25f8('0x3b')][_0x25f8('0x58')]({'where':{'id':_0x1ef813[_0x25f8('0x56')]['id']}})[_0x25f8('0x1d')](handleEntityNotFound(_0x387c7c,null))[_0x25f8('0x1d')](function(_0x4bd015){if(_0x4bd015){return _0x4bd015[_0x25f8('0x6a')](_0x1ef813['body'][_0x25f8('0x65')],_[_0x25f8('0x6b')](_0x1ef813['body'],['ids','id'])||{})[_0x25f8('0x6c')](function(_0x4292af){for(var _0x58d1f1=0x0;_0x58d1f1<_0x1ef813['body'][_0x25f8('0x65')]['length'];_0x58d1f1+=0x1){socket['emit']('userWhatsappAccount:save',{'UserId':Number(_0x1ef813[_0x25f8('0x5a')][_0x25f8('0x65')][_0x58d1f1]),'WhatsappAccountId':Number(_0x1ef813[_0x25f8('0x56')]['id'])});}return _0x4292af;});}})[_0x25f8('0x1d')](respondWithResult(_0x387c7c,null))[_0x25f8('0x54')](handleError(_0x387c7c,null));};exports['removeAgents']=function(_0x552133,_0x338cd6,_0x2ad63f){return db[_0x25f8('0x3b')]['find']({'where':{'id':_0x552133[_0x25f8('0x56')]['id']}})[_0x25f8('0x1d')](handleEntityNotFound(_0x338cd6,null))[_0x25f8('0x1d')](function(_0x3c39b1){if(_0x3c39b1){return _0x3c39b1[_0x25f8('0x6d')](_0x552133['query'][_0x25f8('0x65')])['then'](function(){if(_['isArray'](_0x552133['query'][_0x25f8('0x65')])){for(var _0x51184a=0x0;_0x51184a<_0x552133[_0x25f8('0x42')][_0x25f8('0x65')][_0x25f8('0x48')];_0x51184a+=0x1){socket[_0x25f8('0x6e')](_0x25f8('0x6f'),{'UserId':Number(_0x552133[_0x25f8('0x42')][_0x25f8('0x65')][_0x51184a]),'WhatsappAccountId':Number(_0x552133[_0x25f8('0x56')]['id'])});}}else{socket[_0x25f8('0x6e')](_0x25f8('0x6f'),{'UserId':Number(_0x552133[_0x25f8('0x42')]['ids']),'WhatsappAccountId':Number(_0x552133[_0x25f8('0x56')]['id'])});}});}})[_0x25f8('0x1d')](respondWithStatusCode(_0x338cd6,null))[_0x25f8('0x54')](handleError(_0x338cd6,null));};exports['getAgents']=function(_0x3e7e7b,_0x1a0272,_0x4b33c8){var _0x1f44ba={};var _0x16020c={};var _0x2c4602;var _0x4cce9d;return db[_0x25f8('0x3b')][_0x25f8('0x63')]({'where':{'id':_0x3e7e7b[_0x25f8('0x56')]['id']}})['then'](handleEntityNotFound(_0x1a0272,null))[_0x25f8('0x1d')](function(_0x1289f0){if(_0x1289f0){_0x2c4602=_0x1289f0;_0x16020c['model']=_[_0x25f8('0x43')](db[_0x25f8('0x70')][_0x25f8('0x3c')]);_0x16020c['query']=_[_0x25f8('0x43')](_0x3e7e7b[_0x25f8('0x42')]);_0x16020c['filters']=_[_0x25f8('0x45')](_0x16020c['model'],_0x16020c[_0x25f8('0x42')]);_0x1f44ba[_0x25f8('0x46')]=_['intersection'](_0x16020c[_0x25f8('0x40')],qs[_0x25f8('0x47')](_0x3e7e7b['query'][_0x25f8('0x47')]));_0x1f44ba[_0x25f8('0x46')]=_0x1f44ba[_0x25f8('0x46')][_0x25f8('0x48')]?_0x1f44ba['attributes']:_0x16020c[_0x25f8('0x40')];_0x1f44ba[_0x25f8('0x4b')]=qs['sort'](_0x3e7e7b[_0x25f8('0x42')][_0x25f8('0x4c')]);_0x1f44ba[_0x25f8('0x4e')]=qs['filters'](_[_0x25f8('0x68')](_0x3e7e7b['query'],_0x16020c[_0x25f8('0x44')]));if(_0x3e7e7b[_0x25f8('0x42')][_0x25f8('0x4d')]){_0x1f44ba[_0x25f8('0x4e')]=_['merge'](_0x1f44ba[_0x25f8('0x4e')],{'$or':_[_0x25f8('0x3a')](_0x1f44ba['attributes'],function(_0x49ac61){var _0x31a3f1={};_0x31a3f1[_0x49ac61]={'$like':'%'+_0x3e7e7b[_0x25f8('0x42')][_0x25f8('0x4d')]+'%'};return _0x31a3f1;})});}_0x1f44ba=_[_0x25f8('0x4f')]({},_0x1f44ba,_0x3e7e7b[_0x25f8('0x50')]);return _0x2c4602[_0x25f8('0x71')](_0x1f44ba);}})[_0x25f8('0x1d')](function(_0x5bfc9a){if(_0x5bfc9a){_0x4cce9d=_0x5bfc9a[_0x25f8('0x48')];if(!_0x3e7e7b[_0x25f8('0x42')][_0x25f8('0x49')](_0x25f8('0x4a'))){_0x1f44ba['limit']=qs['limit'](_0x3e7e7b[_0x25f8('0x42')][_0x25f8('0x2b')]);_0x1f44ba['offset']=qs[_0x25f8('0x28')](_0x3e7e7b[_0x25f8('0x42')][_0x25f8('0x28')]);}return _0x2c4602[_0x25f8('0x71')](_0x1f44ba);}})['then'](function(_0x1af1ae){if(_0x1af1ae){return _0x1af1ae?{'count':_0x4cce9d,'rows':_0x1af1ae}:null;}})['then'](respondWithResult(_0x1a0272,null))[_0x25f8('0x54')](handleError(_0x1a0272,null));};exports['addApplications']=function(_0x36f5cc,_0x5a7729,_0x2b2a9b){return db['WhatsappAccount'][_0x25f8('0x63')]({'where':{'id':_0x36f5cc[_0x25f8('0x56')]['id']}})[_0x25f8('0x1d')](handleEntityNotFound(_0x5a7729,null))[_0x25f8('0x1d')](function(_0x9d074e){if(_0x9d074e){return db[_0x25f8('0x72')][_0x25f8('0x73')](function(_0xcfb5d1){return db[_0x25f8('0x74')][_0x25f8('0x32')]({'where':{'WhatsappAccountId':_0x36f5cc['params']['id']},'transaction':_0xcfb5d1})['then'](function(_0x3621df){var _0x3ee5c8=_[_0x25f8('0x3a')](_0x36f5cc[_0x25f8('0x5a')],function(_0x3240a2){_0x3240a2[_0x25f8('0x61')]=_0x36f5cc[_0x25f8('0x56')]['id'];return _0x3240a2;});return db['WhatsappApplication']['bulkCreate'](_0x3ee5c8,{'transaction':_0xcfb5d1});});})[_0x25f8('0x1d')](function(){return db[_0x25f8('0x74')][_0x25f8('0x75')]({'where':{'WhatsappAccountId':_0x36f5cc[_0x25f8('0x56')]['id']},'order':_0x25f8('0x76')});});}})[_0x25f8('0x1d')](respondWithResult(_0x5a7729,null))[_0x25f8('0x54')](handleError(_0x5a7729,null));};exports[_0x25f8('0x77')]=function(_0x2e4c25,_0x4f15dc,_0x1c076c){var _0x277b38={};var _0x43dad6={};var _0x123a68;var _0x4c854d;return db[_0x25f8('0x3b')][_0x25f8('0x63')]({'where':{'id':_0x2e4c25['params']['id']}})[_0x25f8('0x1d')](handleEntityNotFound(_0x4f15dc,null))[_0x25f8('0x1d')](function(_0x38481d){if(_0x38481d){_0x123a68=_0x38481d;_0x43dad6[_0x25f8('0x40')]=_[_0x25f8('0x43')](db[_0x25f8('0x74')][_0x25f8('0x3c')]);_0x43dad6[_0x25f8('0x42')]=_['keys'](_0x2e4c25['query']);_0x43dad6['filters']=_[_0x25f8('0x45')](_0x43dad6[_0x25f8('0x40')],_0x43dad6[_0x25f8('0x42')]);_0x277b38[_0x25f8('0x46')]=_[_0x25f8('0x45')](_0x43dad6[_0x25f8('0x40')],qs[_0x25f8('0x47')](_0x2e4c25['query']['fields']));_0x277b38[_0x25f8('0x46')]=_0x277b38[_0x25f8('0x46')][_0x25f8('0x48')]?_0x277b38[_0x25f8('0x46')]:_0x43dad6[_0x25f8('0x40')];_0x277b38[_0x25f8('0x4b')]=qs[_0x25f8('0x4c')](_0x2e4c25[_0x25f8('0x42')][_0x25f8('0x4c')]);_0x277b38[_0x25f8('0x4e')]=qs[_0x25f8('0x44')](_[_0x25f8('0x68')](_0x2e4c25['query'],_0x43dad6[_0x25f8('0x44')]));if(_0x2e4c25[_0x25f8('0x42')]['filter']){_0x277b38[_0x25f8('0x4e')]=_[_0x25f8('0x4f')](_0x277b38[_0x25f8('0x4e')],{'$or':_[_0x25f8('0x3a')](_0x277b38[_0x25f8('0x46')],function(_0x3f3895){var _0x108625={};_0x108625[_0x3f3895]={'$like':'%'+_0x2e4c25['query'][_0x25f8('0x4d')]+'%'};return _0x108625;})});}_0x277b38=_[_0x25f8('0x4f')]({},_0x277b38,_0x2e4c25[_0x25f8('0x50')]);return _0x123a68[_0x25f8('0x77')](_0x277b38);}})[_0x25f8('0x1d')](function(_0x193350){if(_0x193350){_0x4c854d=_0x193350[_0x25f8('0x48')];if(!_0x2e4c25[_0x25f8('0x42')]['hasOwnProperty'](_0x25f8('0x4a'))){_0x277b38['limit']=qs['limit'](_0x2e4c25['query']['limit']);_0x277b38['offset']=qs[_0x25f8('0x28')](_0x2e4c25['query'][_0x25f8('0x28')]);}return _0x123a68[_0x25f8('0x77')](_0x277b38);}})[_0x25f8('0x1d')](function(_0xcd2aa5){if(_0xcd2aa5){return _0xcd2aa5?{'count':_0x4c854d,'rows':_0xcd2aa5}:null;}})['then'](respondWithResult(_0x4f15dc,null))[_0x25f8('0x54')](handleError(_0x4f15dc,null));};exports[_0x25f8('0x78')]=function(_0x50c546,_0x14d5e1,_0x59f82e){var _0x28588d={'channel':_0x25f8('0x79')};var _0xa550a2=[];var _0x67d267=[];var _0x46f555={};return db[_0x25f8('0x3b')]['find']({'where':{'id':_0x50c546[_0x25f8('0x56')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x25f8('0x7a')}]})[_0x25f8('0x1d')](handleEntityNotFound(_0x14d5e1,null))[_0x25f8('0x1d')](function(_0x13ee4b){_0x28588d[_0x25f8('0x7b')]=_0x13ee4b;_0x28588d[_0x25f8('0x7c')]=_[_0x25f8('0x7d')](_0x13ee4b[_0x25f8('0x7a')],[_0x25f8('0x76')],[_0x25f8('0x7e')]);if(_0x28588d[_0x25f8('0x7b')][_0x25f8('0x7a')]){delete _0x28588d['account'][_0x25f8('0x7a')];}return db['CmContact'][_0x25f8('0x60')]();})[_0x25f8('0x1d')](function(_0x3075b7){if(!_0x3075b7){throw new db[(_0x25f8('0x7f'))][(_0x25f8('0x80'))](_0x25f8('0x81'));}_0xa550a2=_[_0x25f8('0x82')](_[_0x25f8('0x43')](_0x3075b7),[_0x25f8('0x83'),_0x25f8('0x84')]);_0x67d267=_[_0x25f8('0x82')](_[_0x25f8('0x43')](_0x3075b7),[_0x25f8('0x83'),_0x25f8('0x84'),'CompanyId',_0x25f8('0x85')]);_0x28588d[_0x25f8('0x5a')]={'mapKey':'mobile'};if(_0x28588d[_0x25f8('0x7b')][_0x25f8('0x3e')]&&_0x28588d[_0x25f8('0x7b')][_0x25f8('0x3e')]==='twilio'){_0x28588d[_0x25f8('0x5a')][_0x25f8('0x86')]=_0x50c546[_0x25f8('0x5a')][_0x25f8('0x87')][_0x25f8('0x88')](_0x25f8('0x89'),'');_0x28588d[_0x25f8('0x5a')][_0x25f8('0x5a')]=_0x50c546['body'][_0x25f8('0x8a')];_0x28588d[_0x25f8('0x5a')][_0x25f8('0x8b')]=_0x50c546[_0x25f8('0x5a')]['MessageSid'];}if(_0x28588d[_0x25f8('0x5a')]['id']){delete _0x28588d[_0x25f8('0x5a')]['id'];}if(_[_0x25f8('0x8c')](_0x28588d['body']['from'])){throw new db[(_0x25f8('0x7f'))]['ValidationError'](_0x25f8('0x8d'));}if(_[_0x25f8('0x8c')](_0x28588d['body'][_0x25f8('0x5a')])||_0x28588d['body'][_0x25f8('0x5a')]===''){throw new db['Sequelize']['ValidationError'](_0x25f8('0x8e'));}if(_['isNil'](_0x28588d[_0x25f8('0x5a')][_0x25f8('0x8f')])){throw new db['Sequelize'][(_0x25f8('0x80'))](_0x25f8('0x90')+_0x67d267);}if(!_['includes'](_0x67d267,_0x28588d[_0x25f8('0x5a')][_0x25f8('0x8f')])){throw new db['Sequelize'][(_0x25f8('0x80'))](_0x25f8('0x91')+_0x67d267);}_0x46f555[_0x28588d[_0x25f8('0x5a')]['mapKey']]=_0x28588d[_0x25f8('0x5a')][_0x25f8('0x86')];return db['CmList'][_0x25f8('0x58')]({'where':{'id':_0x28588d[_0x25f8('0x7b')][_0x25f8('0x85')]},'include':[{'model':db[_0x25f8('0x92')],'as':_0x25f8('0x93'),'where':_0x46f555,'limit':0x1,'order':[[_0x25f8('0x84'),'DESC']]}]});})['then'](handleEntityNotFound(_0x14d5e1,null))['then'](function(_0x22a67b){if(_0x22a67b){_0x28588d[_0x25f8('0x94')]=_[_0x25f8('0x6b')](_0x22a67b,[_0x25f8('0x93')]);if(_0x22a67b[_0x25f8('0x93')]['length']){return _0x22a67b[_0x25f8('0x93')][0x0];}var _0x44919f=_['defaults'](_0x28588d[_0x25f8('0x5a')],{'firstName':_0x28588d[_0x25f8('0x5a')][_0x25f8('0x86')],'ListId':_0x22a67b['id']});_0x44919f[_0x28588d[_0x25f8('0x5a')][_0x25f8('0x8f')]]=_0x28588d[_0x25f8('0x5a')][_0x25f8('0x86')];return db[_0x25f8('0x92')][_0x25f8('0x59')](_0x44919f,{'fields':_0xa550a2,'raw':!![]});}})[_0x25f8('0x1d')](handleEntityNotFound(_0x14d5e1,null))[_0x25f8('0x1d')](function(_0xd93d9e){if(_0xd93d9e){_0x28588d[_0x25f8('0x95')]=_0xd93d9e;var _0x4ad73a={'ContactId':_0xd93d9e['id'],'phone':_0x28588d[_0x25f8('0x5a')]['from'],'WhatsappAccountId':_0x50c546[_0x25f8('0x56')]['id']};var _0x2b32fc={'ContactId':_0xd93d9e['id'],'WhatsappAccountId':_0x50c546[_0x25f8('0x56')]['id'],'closed':![]};return db['WhatsappInteraction'][_0x25f8('0x58')]({'where':_0x2b32fc})['then'](function(_0x4942d3){if(_0x4942d3){return[_0x4942d3,![]];}return db[_0x25f8('0x96')][_0x25f8('0x59')](_0x4ad73a)[_0x25f8('0x1d')](function(_0x4cb2b9){return[_0x4cb2b9,!![]];});});}})[_0x25f8('0x6c')](function(_0x1d967f,_0x4cf1c4){_0x28588d[_0x25f8('0x97')]=_0x1d967f[_0x25f8('0x33')]({'plain':!![]});_0x28588d[_0x25f8('0x97')][_0x25f8('0x98')]=![];if(_0x4cf1c4){if(_0x28588d[_0x25f8('0x7b')][_0x25f8('0x99')]){_0x28588d[_0x25f8('0x7c')][_0x25f8('0x9a')]({'id':0x0,'priority':_0x28588d[_0x25f8('0x7c')][_0x25f8('0x48')]+0x1,'app':_0x25f8('0x9b'),'appdata':'unmanaged','interval':_0x25f8('0x9c')});}_0x28588d['interaction'][_0x25f8('0x98')]=!![];}return db[_0x25f8('0x9d')][_0x25f8('0x59')]({'phone':_0x28588d[_0x25f8('0x5a')][_0x25f8('0x86')],'messageId':_0x28588d[_0x25f8('0x5a')][_0x25f8('0x8b')],'body':_0x28588d[_0x25f8('0x5a')][_0x25f8('0x5a')],'WhatsappAccountId':_0x50c546[_0x25f8('0x56')]['id'],'WhatsappInteractionId':_0x1d967f['id'],'direction':'in','ContactId':_0x1d967f[_0x25f8('0x9e')],'AttachmentId':_0x28588d[_0x25f8('0x5a')][_0x25f8('0x9f')]});})[_0x25f8('0x1d')](function(_0x37b045){_0x28588d[_0x25f8('0x23')]=_0x37b045;if(_0x28588d[_0x25f8('0x97')][_0x25f8('0xa0')]){return db['User'][_0x25f8('0x58')]({'attributes':['id',_0x25f8('0x41')],'where':{'id':_0x28588d[_0x25f8('0x97')][_0x25f8('0xa0')]}})[_0x25f8('0x1d')](function(_0x540cc5){if(_0x540cc5){_0x28588d[_0x25f8('0x7c')][_0x25f8('0xa1')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x540cc5[_0x25f8('0x41')]+','+(_0x28588d['account'][_0x25f8('0xa2')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0x25f8('0xa3'),_0x28588d);});}return respondWithRpcPromise(_0x25f8('0xa4'),'startRouting',_0x28588d);})[_0x25f8('0x1d')](function(_0x2ccd59){if(_0x2ccd59){var _0x540bf2=0xc8;var _0x42ff59=_0x25f8('0xa5');logger[_0x25f8('0x1e')](_0x25f8('0xa6'),_0x42ff59,_0x540bf2,_0x25f8('0xa7'));logger[_0x25f8('0x21')](_0x25f8('0xa8'),_0x42ff59,_0x540bf2,_0x25f8('0xa7'),JSON[_0x25f8('0xa9')](_0x2ccd59));if(_0x28588d[_0x25f8('0x7b')][_0x25f8('0x3e')]==='twilio'){return _0x14d5e1['status'](_0x540bf2)[_0x25f8('0x2c')](_0x25f8('0xaa'),_0x25f8('0xab'))[_0x25f8('0xac')](_0x25f8('0xad'));}else{return _0x14d5e1[_0x25f8('0x25')](_0x540bf2)[_0x25f8('0x27')](_0x2ccd59);}}})[_0x25f8('0x54')](handleError(_0x14d5e1,null));};exports[_0x25f8('0xac')]=function(_0x1e6588,_0x10607b,_0x11f854){var _0x389c6d,_0x1b7724,_0x98923c;if(_['isNil'](_0x1e6588['body']['body'])||_0x1e6588[_0x25f8('0x5a')][_0x25f8('0x5a')]===''){throw new db[(_0x25f8('0x7f'))][(_0x25f8('0x80'))](_0x25f8('0x8e'));}if(_[_0x25f8('0x8c')](_0x1e6588['body']['to'])){throw new db[(_0x25f8('0x7f'))][(_0x25f8('0x80'))](_0x25f8('0xae'));}_0x389c6d=_0x1e6588[_0x25f8('0x5a')]['to'];return db['WhatsappAccount'][_0x25f8('0x58')]({'where':{'id':_0x1e6588[_0x25f8('0x56')]['id']},'include':[{'model':db[_0x25f8('0xaf')],'as':'List','include':[{'model':db[_0x25f8('0x92')],'as':'Contacts','where':{'mobile':_0x389c6d},'limit':0x1,'order':[[_0x25f8('0x84'),_0x25f8('0xb0')]]}]}]})[_0x25f8('0x1d')](handleEntityNotFound(_0x10607b,null))[_0x25f8('0x1d')](function(_0xdfe272){if(_0xdfe272&&_0xdfe272[_0x25f8('0xb1')]){_0x1b7724=_0xdfe272[_0x25f8('0x33')]({'plain':!![]});if(_0x1b7724[_0x25f8('0xb1')]&&_0x1b7724[_0x25f8('0xb1')][_0x25f8('0x93')][_0x25f8('0x48')]){return _0x1b7724[_0x25f8('0xb1')][_0x25f8('0x93')][0x0];}return db[_0x25f8('0x92')]['create'](_[_0x25f8('0x18')](_0x1e6588[_0x25f8('0x5a')],{'firstName':_0x389c6d,'mobile':_0x389c6d,'phone':_0x389c6d,'ListId':_0x1b7724['ListId']}));}})[_0x25f8('0x1d')](handleEntityNotFound(_0x10607b,null))[_0x25f8('0x1d')](function(_0x1122ef){if(_0x1122ef){_0x98923c=_0x1122ef;return db[_0x25f8('0x96')]['find']({'where':{'ContactId':_0x98923c['id'],'closed':![],'WhatsappAccountId':_0x1b7724['id']}})[_0x25f8('0x1d')](function(_0x4c48dc){if(_0x4c48dc){return[_0x4c48dc,![]];}return db['WhatsappInteraction'][_0x25f8('0x59')]({'UserId':_0x1e6588['user']['id'],'ContactId':_0x98923c['id'],'WhatsappAccountId':_0x1b7724['id'],'phone':_0x389c6d,'firstMsgDirection':'out','Messages':[_[_0x25f8('0x4f')](_0x1e6588[_0x25f8('0x5a')],{'read':![],'body':_0x1e6588[_0x25f8('0x5a')][_0x25f8('0x5a')],'phone':_0x389c6d,'WhatsappAccountId':_0x1b7724['id'],'UserId':_0x1e6588['user']['id'],'ContactId':_0x98923c['id']})]},{'include':[{'model':db[_0x25f8('0x9d')],'as':_0x25f8('0xb2')}]})[_0x25f8('0x1d')](function(_0x2164b7){return[_0x2164b7,!![]];});});}})['spread'](function(_0x2c74ad,_0x224aa3){if(_0x224aa3){return _0x2c74ad;}return db[_0x25f8('0x9d')]['create'](_[_0x25f8('0x4f')](_0x1e6588[_0x25f8('0x5a')],{'read':![],'body':_0x1e6588[_0x25f8('0x5a')][_0x25f8('0x5a')],'phone':_0x389c6d,'WhatsappAccountId':_0x1b7724['id'],'WhatsappInteractionId':_0x2c74ad['id'],'UserId':_0x1e6588['user']['id'],'ContactId':_0x98923c['id']}))['then'](function(_0x4c2e62){_0x2c74ad['dataValues']['Messages']=[];_0x2c74ad[_0x25f8('0xb3')][_0x25f8('0xb2')][_0x25f8('0x9a')](_0x4c2e62[_0x25f8('0xb3')]);return _0x2c74ad;});})[_0x25f8('0x1d')](respondWithResult(_0x10607b,null))['catch'](handleError(_0x10607b,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 720c36f..d8c5ae0 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 _0xd19a=['hook','exports','../../mysqldb','WhatsappAccount','update','remove','emit','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd19a,0x112));var _0xad19=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xd19a[_0x40a045];return _0x1a687c;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0xad19('0x0'))['db'][_0xad19('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xad19('0x2'),'afterDestroy':_0xad19('0x3')};function emitEvent(_0x4140e2){return function(_0x4a32c9,_0x553f8c,_0x4cc19a){WhatsappAccountEvents[_0xad19('0x4')](_0x4140e2+':'+_0x4a32c9['id'],_0x4a32c9);WhatsappAccountEvents[_0xad19('0x4')](_0x4140e2,_0x4a32c9);_0x4cc19a(null);};}for(var e in events){if(events[_0xad19('0x5')](e)){var event=events[e];WhatsappAccount[_0xad19('0x6')](e,emitEvent(event));}}module[_0xad19('0x7')]=WhatsappAccountEvents; \ No newline at end of file +var _0xad24=['update','remove','emit','hook','exports','../../mysqldb','WhatsappAccount','save'];(function(_0x5e36d1,_0x471178){var _0x950b9e=function(_0x1872f3){while(--_0x1872f3){_0x5e36d1['push'](_0x5e36d1['shift']());}};_0x950b9e(++_0x471178);}(_0xad24,0xed));var _0x4ad2=function(_0x25bf32,_0x5d4f4f){_0x25bf32=_0x25bf32-0x0;var _0x4bc551=_0xad24[_0x25bf32];return _0x4bc551;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0x4ad2('0x0'))['db'][_0x4ad2('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4ad2('0x2'),'afterUpdate':_0x4ad2('0x3'),'afterDestroy':_0x4ad2('0x4')};function emitEvent(_0x19b37e){return function(_0x35aeca,_0x27dd33,_0x882c30){WhatsappAccountEvents[_0x4ad2('0x5')](_0x19b37e+':'+_0x35aeca['id'],_0x35aeca);WhatsappAccountEvents[_0x4ad2('0x5')](_0x19b37e,_0x35aeca);_0x882c30(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x4ad2('0x6')](e,emitEvent(event));}}module[_0x4ad2('0x7')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index d012f37..616a2e7 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 _0x0e9e=['whatsapp_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define'];(function(_0x10b631,_0x94b61b){var _0x76f91f=function(_0x1f57fd){while(--_0x1f57fd){_0x10b631['push'](_0x10b631['shift']());}};_0x76f91f(++_0x94b61b);}(_0x0e9e,0xfd));var _0xe0e9=function(_0x5780d5,_0x42eb48){_0x5780d5=_0x5780d5-0x0;var _0x1e6a02=_0x0e9e[_0x5780d5];return _0x1e6a02;};'use strict';var _=require(_0xe0e9('0x0'));var util=require(_0xe0e9('0x1'));var logger=require(_0xe0e9('0x2'))(_0xe0e9('0x3'));var moment=require(_0xe0e9('0x4'));var BPromise=require(_0xe0e9('0x5'));var rp=require(_0xe0e9('0x6'));var fs=require('fs');var path=require(_0xe0e9('0x7'));var rimraf=require(_0xe0e9('0x8'));var config=require(_0xe0e9('0x9'));var attributes=require(_0xe0e9('0xa'));module[_0xe0e9('0xb')]=function(_0x2a68df,_0x2bfef6){return _0x2a68df[_0xe0e9('0xc')]('WhatsappAccount',attributes,{'tableName':_0xe0e9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xab38=['path','rimraf','./whatsappAccount.attributes','exports','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x12e990,_0x4bf671){var _0x285c1a=function(_0x36480c){while(--_0x36480c){_0x12e990['push'](_0x12e990['shift']());}};_0x285c1a(++_0x4bf671);}(_0xab38,0xea));var _0x8ab3=function(_0x16f698,_0x14a929){_0x16f698=_0x16f698-0x0;var _0x58859b=_0xab38[_0x16f698];return _0x58859b;};'use strict';var _=require(_0x8ab3('0x0'));var util=require(_0x8ab3('0x1'));var logger=require(_0x8ab3('0x2'))(_0x8ab3('0x3'));var moment=require(_0x8ab3('0x4'));var BPromise=require('bluebird');var rp=require(_0x8ab3('0x5'));var fs=require('fs');var path=require(_0x8ab3('0x6'));var rimraf=require(_0x8ab3('0x7'));var config=require('../../config/environment');var attributes=require(_0x8ab3('0x8'));module[_0x8ab3('0x9')]=function(_0x10811e,_0x733859){return _0x10811e['define'](_0x8ab3('0xa'),attributes,{'tableName':_0x8ab3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 41d12b6..95746e9 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 _0xd987=['options','where','attributes','include','map','model','ShowWhatsappAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./whatsappAccount.socket','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','WhatsappAccount','find','raw'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd987,0x15d));var _0x7d98=function(_0x167439,_0x51ae2c){_0x167439=_0x167439-0x0;var _0xde9c27=_0xd987[_0x167439];return _0xde9c27;};'use strict';var _=require(_0x7d98('0x0'));var util=require(_0x7d98('0x1'));var moment=require(_0x7d98('0x2'));var BPromise=require(_0x7d98('0x3'));var rs=require(_0x7d98('0x4'));var fs=require('fs');var Redis=require(_0x7d98('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7d98('0x6'));var logger=require(_0x7d98('0x7'))(_0x7d98('0x8'));var config=require(_0x7d98('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7d98('0xa')][_0x7d98('0xb')]({'port':0x232a});config[_0x7d98('0xc')]=_['defaults'](config[_0x7d98('0xc')],{'host':_0x7d98('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x7d98('0xe'))['register'](socket);function respondWithRpcPromise(_0x36fb51,_0x27754f,_0x2af556){return new BPromise(function(_0x2fb481,_0x1e1376){return client[_0x7d98('0xf')](_0x36fb51,_0x2af556)[_0x7d98('0x10')](function(_0x3acc3c){logger[_0x7d98('0x11')](_0x7d98('0x12'),_0x27754f,_0x7d98('0x13'));logger[_0x7d98('0x14')](_0x7d98('0x15'),_0x27754f,_0x7d98('0x13'),JSON[_0x7d98('0x16')](_0x3acc3c));if(_0x3acc3c[_0x7d98('0x17')]){if(_0x3acc3c[_0x7d98('0x17')][_0x7d98('0x18')]===0x1f4){logger[_0x7d98('0x17')](_0x7d98('0x12'),_0x27754f,_0x3acc3c[_0x7d98('0x17')][_0x7d98('0x19')]);return _0x1e1376(_0x3acc3c[_0x7d98('0x17')]['message']);}logger['error'](_0x7d98('0x12'),_0x27754f,_0x3acc3c[_0x7d98('0x17')][_0x7d98('0x19')]);return _0x2fb481(_0x3acc3c[_0x7d98('0x17')][_0x7d98('0x19')]);}else{logger[_0x7d98('0x11')](_0x7d98('0x12'),_0x27754f,_0x7d98('0x13'));_0x2fb481(_0x3acc3c[_0x7d98('0x1a')][_0x7d98('0x19')]);}})[_0x7d98('0x1b')](function(_0x42c2af){logger[_0x7d98('0x17')]('WhatsappAccount,\x20%s,\x20%s',_0x27754f,_0x42c2af);_0x1e1376(_0x42c2af);});});}exports['ShowWhatsappAccount']=function(_0x1407d1){var _0x39d193=this;return new Promise(function(_0x3e7c66,_0x43d590){return db[_0x7d98('0x1c')][_0x7d98('0x1d')]({'raw':_0x1407d1['options']?_0x1407d1['options'][_0x7d98('0x1e')]===undefined?!![]:![]:!![],'where':_0x1407d1[_0x7d98('0x1f')]?_0x1407d1['options'][_0x7d98('0x20')]||null:null,'attributes':_0x1407d1['options']?_0x1407d1[_0x7d98('0x1f')][_0x7d98('0x21')]||null:null,'include':_0x1407d1[_0x7d98('0x1f')]?_0x1407d1[_0x7d98('0x1f')][_0x7d98('0x22')]?_[_0x7d98('0x23')](_0x1407d1[_0x7d98('0x1f')][_0x7d98('0x22')],function(_0x3426d7){return{'model':db[_0x3426d7['model']],'as':_0x3426d7['as'],'attributes':_0x3426d7['attributes'],'include':_0x3426d7['include']?_[_0x7d98('0x23')](_0x3426d7[_0x7d98('0x22')],function(_0x5e1b2e){return{'model':db[_0x5e1b2e[_0x7d98('0x24')]],'as':_0x5e1b2e['as'],'attributes':_0x5e1b2e[_0x7d98('0x21')],'include':_0x5e1b2e[_0x7d98('0x22')]?_['map'](_0x5e1b2e[_0x7d98('0x22')],function(_0x465ea2){return{'model':db[_0x465ea2[_0x7d98('0x24')]],'as':_0x465ea2['as'],'attributes':_0x465ea2[_0x7d98('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7d98('0x10')](function(_0x7ddc9f){logger['info']('ShowWhatsappAccount',_0x1407d1);logger[_0x7d98('0x14')](_0x7d98('0x25'),_0x1407d1,JSON[_0x7d98('0x16')](_0x7ddc9f));_0x3e7c66(_0x7ddc9f);})[_0x7d98('0x1b')](function(_0x26256c){logger['error'](_0x7d98('0x25'),_0x26256c[_0x7d98('0x19')],_0x1407d1);_0x43d590(_0x39d193[_0x7d98('0x17')](0x1f4,_0x26256c[_0x7d98('0x19')]));});});}; \ No newline at end of file +var _0xe0f9=['message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','redis','defaults','localhost','./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xe0f9,0x16c));var _0x9e0f=function(_0x45bdc7,_0x4652e1){_0x45bdc7=_0x45bdc7-0x0;var _0x1e795d=_0xe0f9[_0x45bdc7];return _0x1e795d;};'use strict';var _=require(_0x9e0f('0x0'));var util=require(_0x9e0f('0x1'));var moment=require(_0x9e0f('0x2'));var BPromise=require(_0x9e0f('0x3'));var rs=require(_0x9e0f('0x4'));var fs=require('fs');var Redis=require(_0x9e0f('0x5'));var db=require(_0x9e0f('0x6'))['db'];var utils=require(_0x9e0f('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x9e0f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9e0f('0x9')][_0x9e0f('0xa')]({'port':0x232a});config[_0x9e0f('0xb')]=_[_0x9e0f('0xc')](config[_0x9e0f('0xb')],{'host':_0x9e0f('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9e0f('0xb')]));require(_0x9e0f('0xe'))[_0x9e0f('0xf')](socket);function respondWithRpcPromise(_0x362fd7,_0x412206,_0x2dab74){return new BPromise(function(_0x4ab60f,_0x3b11a5){return client[_0x9e0f('0x10')](_0x362fd7,_0x2dab74)[_0x9e0f('0x11')](function(_0x9d0722){logger[_0x9e0f('0x12')](_0x9e0f('0x13'),_0x412206,_0x9e0f('0x14'));logger[_0x9e0f('0x15')](_0x9e0f('0x16'),_0x412206,_0x9e0f('0x14'),JSON[_0x9e0f('0x17')](_0x9d0722));if(_0x9d0722['error']){if(_0x9d0722[_0x9e0f('0x18')][_0x9e0f('0x19')]===0x1f4){logger[_0x9e0f('0x18')](_0x9e0f('0x13'),_0x412206,_0x9d0722[_0x9e0f('0x18')]['message']);return _0x3b11a5(_0x9d0722[_0x9e0f('0x18')]['message']);}logger['error'](_0x9e0f('0x13'),_0x412206,_0x9d0722['error'][_0x9e0f('0x1a')]);return _0x4ab60f(_0x9d0722[_0x9e0f('0x18')][_0x9e0f('0x1a')]);}else{logger[_0x9e0f('0x12')](_0x9e0f('0x13'),_0x412206,_0x9e0f('0x14'));_0x4ab60f(_0x9d0722[_0x9e0f('0x1b')][_0x9e0f('0x1a')]);}})[_0x9e0f('0x1c')](function(_0x58a440){logger[_0x9e0f('0x18')]('WhatsappAccount,\x20%s,\x20%s',_0x412206,_0x58a440);_0x3b11a5(_0x58a440);});});}exports[_0x9e0f('0x1d')]=function(_0x43d11d){var _0x2cd1e9=this;return new Promise(function(_0x422285,_0x28def2){return db[_0x9e0f('0x1e')][_0x9e0f('0x1f')]({'raw':_0x43d11d[_0x9e0f('0x20')]?_0x43d11d[_0x9e0f('0x20')][_0x9e0f('0x21')]===undefined?!![]:![]:!![],'where':_0x43d11d['options']?_0x43d11d[_0x9e0f('0x20')][_0x9e0f('0x22')]||null:null,'attributes':_0x43d11d[_0x9e0f('0x20')]?_0x43d11d[_0x9e0f('0x20')][_0x9e0f('0x23')]||null:null,'include':_0x43d11d[_0x9e0f('0x20')]?_0x43d11d[_0x9e0f('0x20')][_0x9e0f('0x24')]?_[_0x9e0f('0x25')](_0x43d11d[_0x9e0f('0x20')][_0x9e0f('0x24')],function(_0xbba8e8){return{'model':db[_0xbba8e8[_0x9e0f('0x26')]],'as':_0xbba8e8['as'],'attributes':_0xbba8e8[_0x9e0f('0x23')],'include':_0xbba8e8[_0x9e0f('0x24')]?_[_0x9e0f('0x25')](_0xbba8e8[_0x9e0f('0x24')],function(_0x10b49b){return{'model':db[_0x10b49b[_0x9e0f('0x26')]],'as':_0x10b49b['as'],'attributes':_0x10b49b['attributes'],'include':_0x10b49b[_0x9e0f('0x24')]?_[_0x9e0f('0x25')](_0x10b49b['include'],function(_0x5c0b09){return{'model':db[_0x5c0b09[_0x9e0f('0x26')]],'as':_0x5c0b09['as'],'attributes':_0x5c0b09[_0x9e0f('0x23')]};}):[]};}):[]};}):[]:[]})[_0x9e0f('0x11')](function(_0x331533){logger[_0x9e0f('0x12')](_0x9e0f('0x1d'),_0x43d11d);logger[_0x9e0f('0x15')](_0x9e0f('0x1d'),_0x43d11d,JSON['stringify'](_0x331533));_0x422285(_0x331533);})[_0x9e0f('0x1c')](function(_0x3a719d){logger[_0x9e0f('0x18')]('ShowWhatsappAccount',_0x3a719d[_0x9e0f('0x1a')],_0x43d11d);_0x28def2(_0x2cd1e9[_0x9e0f('0x18')](0x1f4,_0x3a719d['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index fecf720..3a8aac8 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 _0xd603=['save','update','emit','removeListener','length','./whatsappAccount.events'];(function(_0x19f9e6,_0x4f59a6){var _0x45c862=function(_0x3447fb){while(--_0x3447fb){_0x19f9e6['push'](_0x19f9e6['shift']());}};_0x45c862(++_0x4f59a6);}(_0xd603,0x1f1));var _0x3d60=function(_0x648163,_0x241576){_0x648163=_0x648163-0x0;var _0x199d4d=_0xd603[_0x648163];return _0x199d4d;};'use strict';var WhatsappAccountEvents=require(_0x3d60('0x0'));var events=[_0x3d60('0x1'),'remove',_0x3d60('0x2')];function createListener(_0x244224,_0x211f03){return function(_0x519ff1){_0x211f03[_0x3d60('0x3')](_0x244224,_0x519ff1);};}function removeListener(_0x113f46,_0x17ad79){return function(){WhatsappAccountEvents[_0x3d60('0x4')](_0x113f46,_0x17ad79);};}exports['register']=function(_0x927770){for(var _0x11b2b7=0x0,_0x5e6efb=events[_0x3d60('0x5')];_0x11b2b7<_0x5e6efb;_0x11b2b7++){var _0x536d77=events[_0x11b2b7];var _0x415bd0=createListener('whatsappAccount:'+_0x536d77,_0x927770);WhatsappAccountEvents['on'](_0x536d77,_0x415bd0);}}; \ No newline at end of file +var _0x8378=['update','emit','removeListener','register','length','./whatsappAccount.events'];(function(_0x484280,_0x1fadcd){var _0xebdc4=function(_0x2caf11){while(--_0x2caf11){_0x484280['push'](_0x484280['shift']());}};_0xebdc4(++_0x1fadcd);}(_0x8378,0xd1));var _0x8837=function(_0x32de29,_0x4086ac){_0x32de29=_0x32de29-0x0;var _0x1089a2=_0x8378[_0x32de29];return _0x1089a2;};'use strict';var WhatsappAccountEvents=require(_0x8837('0x0'));var events=['save','remove',_0x8837('0x1')];function createListener(_0x1869d4,_0x179fd5){return function(_0x1b7bb8){_0x179fd5[_0x8837('0x2')](_0x1869d4,_0x1b7bb8);};}function removeListener(_0x464f29,_0x4a1597){return function(){WhatsappAccountEvents[_0x8837('0x3')](_0x464f29,_0x4a1597);};}exports[_0x8837('0x4')]=function(_0x55839b){for(var _0x10f7c0=0x0,_0x406d5d=events[_0x8837('0x5')];_0x10f7c0<_0x406d5d;_0x10f7c0++){var _0x427b98=events[_0x10f7c0];var _0x39d88e=createListener('whatsappAccount:'+_0x427b98,_0x55839b);WhatsappAccountEvents['on'](_0x427b98,_0x39d88e);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 64c3d0a..40c8b82 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 _0x1e8f=['put','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show'];(function(_0x1460c9,_0x2edcea){var _0x2d48db=function(_0x16c808){while(--_0x16c808){_0x1460c9['push'](_0x1460c9['shift']());}};_0x2d48db(++_0x2edcea);}(_0x1e8f,0x1f1));var _0xf1e8=function(_0x11afd1,_0x4d62ff){_0x11afd1=_0x11afd1-0x0;var _0x5e8b34=_0x1e8f[_0x11afd1];return _0x5e8b34;};'use strict';var multer=require('multer');var util=require(_0xf1e8('0x0'));var path=require(_0xf1e8('0x1'));var timeout=require(_0xf1e8('0x2'));var express=require(_0xf1e8('0x3'));var router=express[_0xf1e8('0x4')]();var fs_extra=require(_0xf1e8('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf1e8('0x6'));var controller=require(_0xf1e8('0x7'));router[_0xf1e8('0x8')]('/',auth[_0xf1e8('0x9')](),controller[_0xf1e8('0xa')]);router[_0xf1e8('0x8')](_0xf1e8('0xb'),auth[_0xf1e8('0x9')](),controller[_0xf1e8('0xc')]);router['post']('/',auth[_0xf1e8('0x9')](),controller['create']);router[_0xf1e8('0xd')](_0xf1e8('0xb'),auth[_0xf1e8('0x9')](),controller[_0xf1e8('0xe')]);router[_0xf1e8('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xf1e8('0x10')]);module['exports']=router; \ No newline at end of file +var _0x0f11=['exports','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','create','update','delete','destroy'];(function(_0x13a5c1,_0x70c6e8){var _0x1f4484=function(_0xd9629b){while(--_0xd9629b){_0x13a5c1['push'](_0x13a5c1['shift']());}};_0x1f4484(++_0x70c6e8);}(_0x0f11,0xcd));var _0x10f1=function(_0x1bd1b4,_0x150add){_0x1bd1b4=_0x1bd1b4-0x0;var _0x4fc923=_0x0f11[_0x1bd1b4];return _0x4fc923;};'use strict';var multer=require('multer');var util=require(_0x10f1('0x0'));var path=require(_0x10f1('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x10f1('0x2'));var auth=require(_0x10f1('0x3'));var interaction=require(_0x10f1('0x4'));var config=require(_0x10f1('0x5'));var controller=require(_0x10f1('0x6'));router[_0x10f1('0x7')]('/',auth[_0x10f1('0x8')](),controller[_0x10f1('0x9')]);router[_0x10f1('0x7')](_0x10f1('0xa'),auth['isAuthenticated'](),controller[_0x10f1('0xb')]);router['post']('/',auth[_0x10f1('0x8')](),controller[_0x10f1('0xc')]);router['put'](_0x10f1('0xa'),auth[_0x10f1('0x8')](),controller[_0x10f1('0xd')]);router[_0x10f1('0xe')](_0x10f1('0xa'),auth[_0x10f1('0x8')](),controller[_0x10f1('0xf')]);module[_0x10f1('0x10')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 3c228c4..29e8ef4 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 _0x072a=['sequelize','exports','STRING','TEXT'];(function(_0x27c1e7,_0x78ade7){var _0x1b30a7=function(_0x474133){while(--_0x474133){_0x27c1e7['push'](_0x27c1e7['shift']());}};_0x1b30a7(++_0x78ade7);}(_0x072a,0x194));var _0xa072=function(_0x2e062d,_0x30bb39){_0x2e062d=_0x2e062d-0x0;var _0x45ee8c=_0x072a[_0x2e062d];return _0x45ee8c;};'use strict';var Sequelize=require(_0xa072('0x0'));module[_0xa072('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xa072('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xa072('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xa072('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xa4b6=['noop','TEXT','STRING','*,*,*,*','sequelize','INTEGER'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa4b6,0xfa));var _0x6a4b=function(_0x12b66d,_0xc75ddc){_0x12b66d=_0x12b66d-0x0;var _0x519e94=_0xa4b6[_0x12b66d];return _0x519e94;};'use strict';var Sequelize=require(_0x6a4b('0x0'));module['exports']={'priority':{'type':Sequelize[_0x6a4b('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6a4b('0x2')},'appdata':{'type':Sequelize[_0x6a4b('0x3')]()},'description':{'type':Sequelize[_0x6a4b('0x4')]},'interval':{'type':Sequelize[_0x6a4b('0x4')],'defaultValue':_0x6a4b('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 50038d3..4adbc93 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 _0xef4d=['map','WhatsappApplication','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','fields','find','create','body','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/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','undefined','limit','offset','count','set','Content-Range','json','apply','reject','save','update','then','end','sendStatus','error','name','send','index'];(function(_0x305cb0,_0x124dbf){var _0x5b4133=function(_0x3af47d){while(--_0x3af47d){_0x305cb0['push'](_0x305cb0['shift']());}};_0x5b4133(++_0x124dbf);}(_0xef4d,0x165));var _0xdef4=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0xef4d[_0xd1d19a];return _0x52a79d;};'use strict';var emlformat=require(_0xdef4('0x0'));var rimraf=require(_0xdef4('0x1'));var zipdir=require(_0xdef4('0x2'));var jsonpatch=require(_0xdef4('0x3'));var rp=require(_0xdef4('0x4'));var moment=require(_0xdef4('0x5'));var BPromise=require(_0xdef4('0x6'));var Mustache=require(_0xdef4('0x7'));var util=require(_0xdef4('0x8'));var path=require(_0xdef4('0x9'));var sox=require(_0xdef4('0xa'));var csv=require(_0xdef4('0xb'));var ejs=require(_0xdef4('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdef4('0xd'));var squel=require(_0xdef4('0xe'));var crypto=require(_0xdef4('0xf'));var jsforce=require(_0xdef4('0x10'));var deskjs=require(_0xdef4('0x11'));var toCsv=require(_0xdef4('0xb'));var querystring=require(_0xdef4('0x12'));var Papa=require(_0xdef4('0x13'));var Redis=require(_0xdef4('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xdef4('0x15'));var as=require(_0xdef4('0x16'));var hardwareService=require(_0xdef4('0x17'));var logger=require(_0xdef4('0x18'))(_0xdef4('0x19'));var utils=require(_0xdef4('0x1a'));var config=require(_0xdef4('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0xdef4('0x1c'))['db'];function respondWithStatusCode(_0x52e079,_0x4e72a9){_0x4e72a9=_0x4e72a9||0xcc;return function(_0x17db7a){if(_0x17db7a){return _0x52e079['sendStatus'](_0x4e72a9);}return _0x52e079[_0xdef4('0x1d')](_0x4e72a9)['end']();};}function respondWithResult(_0x3133fb,_0x41e6cf){_0x41e6cf=_0x41e6cf||0xc8;return function(_0x20effa){if(_0x20effa){return _0x3133fb[_0xdef4('0x1d')](_0x41e6cf)['json'](_0x20effa);}};}function respondWithFilteredResult(_0x2359fb,_0x5c528a){return function(_0x19e623){if(_0x19e623){var _0x29951c=typeof _0x5c528a['offset']===_0xdef4('0x1e')&&typeof _0x5c528a[_0xdef4('0x1f')]===_0xdef4('0x1e');var _0x4414e0=_0x19e623['count'];var _0x377beb=_0x29951c?0x0:_0x5c528a[_0xdef4('0x20')];var _0x469178=_0x29951c?_0x19e623[_0xdef4('0x21')]:_0x5c528a[_0xdef4('0x20')]+_0x5c528a['limit'];var _0x3c60dc;if(_0x469178>=_0x4414e0){_0x469178=_0x4414e0;_0x3c60dc=0xc8;}else{_0x3c60dc=0xce;}_0x2359fb[_0xdef4('0x1d')](_0x3c60dc);return _0x2359fb[_0xdef4('0x22')](_0xdef4('0x23'),_0x377beb+'-'+_0x469178+'/'+_0x4414e0)[_0xdef4('0x24')](_0x19e623);}return null;};}function patchUpdates(_0x451826){return function(_0x5f358f){try{jsonpatch[_0xdef4('0x25')](_0x5f358f,_0x451826,!![]);}catch(_0x36124a){return BPromise[_0xdef4('0x26')](_0x36124a);}return _0x5f358f[_0xdef4('0x27')]();};}function saveUpdates(_0x1b668e,_0x60c932){return function(_0x4e65e6){if(_0x4e65e6){return _0x4e65e6[_0xdef4('0x28')](_0x1b668e)['then'](function(_0x58e4a1){return _0x58e4a1;});}return null;};}function removeEntity(_0x209801,_0x35c401){return function(_0x3728e8){if(_0x3728e8){return _0x3728e8['destroy']()[_0xdef4('0x29')](function(){_0x209801[_0xdef4('0x1d')](0xcc)[_0xdef4('0x2a')]();});}};}function handleEntityNotFound(_0xf43627,_0x1dab9a){return function(_0x34ff25){if(!_0x34ff25){_0xf43627[_0xdef4('0x2b')](0x194);}return _0x34ff25;};}function handleError(_0x91199e,_0x4dd320){_0x4dd320=_0x4dd320||0x1f4;return function(_0x3e770f){logger[_0xdef4('0x2c')](_0x3e770f['stack']);if(_0x3e770f[_0xdef4('0x2d')]){delete _0x3e770f[_0xdef4('0x2d')];}_0x91199e[_0xdef4('0x1d')](_0x4dd320)[_0xdef4('0x2e')](_0x3e770f);};}exports[_0xdef4('0x2f')]=function(_0x287608,_0x50ae94){var _0x438376={},_0x256165={},_0x4bd517={'count':0x0,'rows':[]};var _0x25d6f1=_[_0xdef4('0x30')](db[_0xdef4('0x31')][_0xdef4('0x32')],function(_0x321bb6){return{'name':_0x321bb6[_0xdef4('0x33')],'type':_0x321bb6[_0xdef4('0x34')][_0xdef4('0x35')]};});_0x256165[_0xdef4('0x36')]=_[_0xdef4('0x30')](_0x25d6f1,_0xdef4('0x2d'));_0x256165['query']=_['keys'](_0x287608[_0xdef4('0x37')]);_0x256165[_0xdef4('0x38')]=_[_0xdef4('0x39')](_0x256165['model'],_0x256165[_0xdef4('0x37')]);_0x438376[_0xdef4('0x3a')]=_[_0xdef4('0x39')](_0x256165[_0xdef4('0x36')],qs['fields'](_0x287608['query']['fields']));_0x438376[_0xdef4('0x3a')]=_0x438376[_0xdef4('0x3a')][_0xdef4('0x3b')]?_0x438376[_0xdef4('0x3a')]:_0x256165[_0xdef4('0x36')];if(!_0x287608['query'][_0xdef4('0x3c')](_0xdef4('0x3d'))){_0x438376[_0xdef4('0x1f')]=qs[_0xdef4('0x1f')](_0x287608[_0xdef4('0x37')]['limit']);_0x438376[_0xdef4('0x20')]=qs[_0xdef4('0x20')](_0x287608[_0xdef4('0x37')]['offset']);}_0x438376[_0xdef4('0x3e')]=qs['sort'](_0x287608['query'][_0xdef4('0x3f')]);_0x438376['where']=qs[_0xdef4('0x38')](_[_0xdef4('0x40')](_0x287608[_0xdef4('0x37')],_0x256165[_0xdef4('0x38')]),_0x25d6f1);if(_0x287608[_0xdef4('0x37')][_0xdef4('0x41')]){_0x438376[_0xdef4('0x42')]=_[_0xdef4('0x43')](_0x438376['where'],{'$or':_['map'](_0x25d6f1,function(_0x1604b4){if(_0x1604b4[_0xdef4('0x34')]!=='VIRTUAL'){var _0x586ffc={};_0x586ffc[_0x1604b4[_0xdef4('0x2d')]]={'$like':'%'+_0x287608[_0xdef4('0x37')][_0xdef4('0x41')]+'%'};return _0x586ffc;}})});}_0x438376=_[_0xdef4('0x43')]({},_0x438376,_0x287608[_0xdef4('0x44')]);var _0xaa75d6={'where':_0x438376[_0xdef4('0x42')]};return db[_0xdef4('0x31')][_0xdef4('0x21')](_0xaa75d6)[_0xdef4('0x29')](function(_0x26c14e){_0x4bd517['count']=_0x26c14e;if(_0x287608[_0xdef4('0x37')][_0xdef4('0x45')]){_0x438376[_0xdef4('0x46')]=[{'all':!![]}];}return db[_0xdef4('0x31')][_0xdef4('0x47')](_0x438376);})['then'](function(_0x5dfd15){_0x4bd517[_0xdef4('0x48')]=_0x5dfd15;return _0x4bd517;})[_0xdef4('0x29')](respondWithFilteredResult(_0x50ae94,_0x438376))[_0xdef4('0x49')](handleError(_0x50ae94,null));};exports[_0xdef4('0x4a')]=function(_0x370cfe,_0x13f472){var _0x5a4d64={'raw':!![],'where':{'id':_0x370cfe[_0xdef4('0x4b')]['id']}},_0xbdfd50={};_0xbdfd50[_0xdef4('0x36')]=_[_0xdef4('0x4c')](db['WhatsappApplication']['rawAttributes']);_0xbdfd50[_0xdef4('0x37')]=_['keys'](_0x370cfe[_0xdef4('0x37')]);_0xbdfd50[_0xdef4('0x38')]=_['intersection'](_0xbdfd50[_0xdef4('0x36')],_0xbdfd50[_0xdef4('0x37')]);_0x5a4d64[_0xdef4('0x3a')]=_[_0xdef4('0x39')](_0xbdfd50[_0xdef4('0x36')],qs['fields'](_0x370cfe[_0xdef4('0x37')][_0xdef4('0x4d')]));_0x5a4d64[_0xdef4('0x3a')]=_0x5a4d64[_0xdef4('0x3a')][_0xdef4('0x3b')]?_0x5a4d64[_0xdef4('0x3a')]:_0xbdfd50[_0xdef4('0x36')];if(_0x370cfe[_0xdef4('0x37')][_0xdef4('0x45')]){_0x5a4d64[_0xdef4('0x46')]=[{'all':!![]}];}_0x5a4d64=_[_0xdef4('0x43')]({},_0x5a4d64,_0x370cfe['options']);return db['WhatsappApplication'][_0xdef4('0x4e')](_0x5a4d64)[_0xdef4('0x29')](handleEntityNotFound(_0x13f472,null))[_0xdef4('0x29')](respondWithResult(_0x13f472,null))[_0xdef4('0x49')](handleError(_0x13f472,null));};exports[_0xdef4('0x4f')]=function(_0x113e15,_0x6c0f3f){return db[_0xdef4('0x31')]['create'](_0x113e15['body'],{})[_0xdef4('0x29')](respondWithResult(_0x6c0f3f,0xc9))[_0xdef4('0x49')](handleError(_0x6c0f3f,null));};exports[_0xdef4('0x28')]=function(_0x250061,_0x3c2233){if(_0x250061[_0xdef4('0x50')]['id']){delete _0x250061[_0xdef4('0x50')]['id'];}return db[_0xdef4('0x31')][_0xdef4('0x4e')]({'where':{'id':_0x250061['params']['id']}})[_0xdef4('0x29')](handleEntityNotFound(_0x3c2233,null))[_0xdef4('0x29')](saveUpdates(_0x250061[_0xdef4('0x50')],null))['then'](respondWithResult(_0x3c2233,null))[_0xdef4('0x49')](handleError(_0x3c2233,null));};exports['destroy']=function(_0x227841,_0x1c579d){return db['WhatsappApplication']['find']({'where':{'id':_0x227841[_0xdef4('0x4b')]['id']}})[_0xdef4('0x29')](handleEntityNotFound(_0x1c579d,null))[_0xdef4('0x29')](removeEntity(_0x1c579d,null))[_0xdef4('0x49')](handleError(_0x1c579d,null));}; \ No newline at end of file +var _0x3af5=['name','send','index','WhatsappApplication','fieldName','type','key','map','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','create','body','update','find','eml-format','rimraf','fast-json-patch','request-promise','mustache','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack'];(function(_0x1827ca,_0x2c4f5d){var _0x4eb37a=function(_0x514736){while(--_0x514736){_0x1827ca['push'](_0x1827ca['shift']());}};_0x4eb37a(++_0x2c4f5d);}(_0x3af5,0x1d3));var _0x53af=function(_0x58ee19,_0xdf0765){_0x58ee19=_0x58ee19-0x0;var _0x49af25=_0x3af5[_0x58ee19];return _0x49af25;};'use strict';var emlformat=require(_0x53af('0x0'));var rimraf=require(_0x53af('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x53af('0x2'));var rp=require(_0x53af('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x53af('0x4'));var util=require('util');var path=require('path');var sox=require(_0x53af('0x5'));var csv=require(_0x53af('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x53af('0x7'));var _=require('lodash');var squel=require(_0x53af('0x8'));var crypto=require(_0x53af('0x9'));var jsforce=require(_0x53af('0xa'));var deskjs=require(_0x53af('0xb'));var toCsv=require(_0x53af('0x6'));var querystring=require(_0x53af('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x53af('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x53af('0xe'));var hardwareService=require(_0x53af('0xf'));var logger=require('../../config/logger')(_0x53af('0x10'));var utils=require(_0x53af('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x53af('0x12'));var db=require(_0x53af('0x13'))['db'];function respondWithStatusCode(_0x3366ea,_0x59285f){_0x59285f=_0x59285f||0xcc;return function(_0x25a7c9){if(_0x25a7c9){return _0x3366ea['sendStatus'](_0x59285f);}return _0x3366ea[_0x53af('0x14')](_0x59285f)[_0x53af('0x15')]();};}function respondWithResult(_0xee9b56,_0xe7cf2){_0xe7cf2=_0xe7cf2||0xc8;return function(_0x1dea0a){if(_0x1dea0a){return _0xee9b56[_0x53af('0x14')](_0xe7cf2)[_0x53af('0x16')](_0x1dea0a);}};}function respondWithFilteredResult(_0x1c8479,_0x1ee76f){return function(_0x3978f9){if(_0x3978f9){var _0x4d601a=typeof _0x1ee76f[_0x53af('0x17')]===_0x53af('0x18')&&typeof _0x1ee76f[_0x53af('0x19')]===_0x53af('0x18');var _0x1d2747=_0x3978f9[_0x53af('0x1a')];var _0x3fb005=_0x4d601a?0x0:_0x1ee76f['offset'];var _0x207f25=_0x4d601a?_0x3978f9[_0x53af('0x1a')]:_0x1ee76f[_0x53af('0x17')]+_0x1ee76f[_0x53af('0x19')];var _0x568d52;if(_0x207f25>=_0x1d2747){_0x207f25=_0x1d2747;_0x568d52=0xc8;}else{_0x568d52=0xce;}_0x1c8479['status'](_0x568d52);return _0x1c8479[_0x53af('0x1b')](_0x53af('0x1c'),_0x3fb005+'-'+_0x207f25+'/'+_0x1d2747)[_0x53af('0x16')](_0x3978f9);}return null;};}function patchUpdates(_0x5a31d6){return function(_0x28e1fb){try{jsonpatch[_0x53af('0x1d')](_0x28e1fb,_0x5a31d6,!![]);}catch(_0x46d0d5){return BPromise[_0x53af('0x1e')](_0x46d0d5);}return _0x28e1fb[_0x53af('0x1f')]();};}function saveUpdates(_0x217426,_0x222d73){return function(_0x3d04c9){if(_0x3d04c9){return _0x3d04c9['update'](_0x217426)[_0x53af('0x20')](function(_0x26e701){return _0x26e701;});}return null;};}function removeEntity(_0x4fea36,_0x3e164e){return function(_0x363646){if(_0x363646){return _0x363646[_0x53af('0x21')]()['then'](function(){_0x4fea36[_0x53af('0x14')](0xcc)[_0x53af('0x15')]();});}};}function handleEntityNotFound(_0x26a0cf,_0x2b232c){return function(_0x480665){if(!_0x480665){_0x26a0cf[_0x53af('0x22')](0x194);}return _0x480665;};}function handleError(_0x17d47d,_0x25b2cd){_0x25b2cd=_0x25b2cd||0x1f4;return function(_0x530e3c){logger[_0x53af('0x23')](_0x530e3c[_0x53af('0x24')]);if(_0x530e3c[_0x53af('0x25')]){delete _0x530e3c[_0x53af('0x25')];}_0x17d47d['status'](_0x25b2cd)[_0x53af('0x26')](_0x530e3c);};}exports[_0x53af('0x27')]=function(_0xc9b0df,_0x2c27ba){var _0x2820df={},_0x264d0d={},_0x154cc2={'count':0x0,'rows':[]};var _0x584a53=_['map'](db[_0x53af('0x28')]['rawAttributes'],function(_0x308819){return{'name':_0x308819[_0x53af('0x29')],'type':_0x308819[_0x53af('0x2a')][_0x53af('0x2b')]};});_0x264d0d['model']=_[_0x53af('0x2c')](_0x584a53,_0x53af('0x25'));_0x264d0d['query']=_['keys'](_0xc9b0df[_0x53af('0x2d')]);_0x264d0d[_0x53af('0x2e')]=_[_0x53af('0x2f')](_0x264d0d[_0x53af('0x30')],_0x264d0d['query']);_0x2820df['attributes']=_[_0x53af('0x2f')](_0x264d0d[_0x53af('0x30')],qs[_0x53af('0x31')](_0xc9b0df['query']['fields']));_0x2820df[_0x53af('0x32')]=_0x2820df[_0x53af('0x32')][_0x53af('0x33')]?_0x2820df[_0x53af('0x32')]:_0x264d0d[_0x53af('0x30')];if(!_0xc9b0df[_0x53af('0x2d')][_0x53af('0x34')]('nolimit')){_0x2820df[_0x53af('0x19')]=qs[_0x53af('0x19')](_0xc9b0df['query'][_0x53af('0x19')]);_0x2820df[_0x53af('0x17')]=qs[_0x53af('0x17')](_0xc9b0df[_0x53af('0x2d')][_0x53af('0x17')]);}_0x2820df['order']=qs[_0x53af('0x35')](_0xc9b0df['query'][_0x53af('0x35')]);_0x2820df[_0x53af('0x36')]=qs[_0x53af('0x2e')](_[_0x53af('0x37')](_0xc9b0df[_0x53af('0x2d')],_0x264d0d['filters']),_0x584a53);if(_0xc9b0df['query']['filter']){_0x2820df[_0x53af('0x36')]=_['merge'](_0x2820df['where'],{'$or':_['map'](_0x584a53,function(_0x17f024){if(_0x17f024[_0x53af('0x2a')]!==_0x53af('0x38')){var _0x78817a={};_0x78817a[_0x17f024[_0x53af('0x25')]]={'$like':'%'+_0xc9b0df[_0x53af('0x2d')][_0x53af('0x39')]+'%'};return _0x78817a;}})});}_0x2820df=_[_0x53af('0x3a')]({},_0x2820df,_0xc9b0df[_0x53af('0x3b')]);var _0x5906a3={'where':_0x2820df[_0x53af('0x36')]};return db[_0x53af('0x28')][_0x53af('0x1a')](_0x5906a3)[_0x53af('0x20')](function(_0x409c75){_0x154cc2[_0x53af('0x1a')]=_0x409c75;if(_0xc9b0df['query'][_0x53af('0x3c')]){_0x2820df[_0x53af('0x3d')]=[{'all':!![]}];}return db[_0x53af('0x28')][_0x53af('0x3e')](_0x2820df);})['then'](function(_0x12fbf6){_0x154cc2[_0x53af('0x3f')]=_0x12fbf6;return _0x154cc2;})[_0x53af('0x20')](respondWithFilteredResult(_0x2c27ba,_0x2820df))[_0x53af('0x40')](handleError(_0x2c27ba,null));};exports[_0x53af('0x41')]=function(_0x5d1b82,_0x274e72){var _0x3490ff={'raw':!![],'where':{'id':_0x5d1b82[_0x53af('0x42')]['id']}},_0x46e4d9={};_0x46e4d9[_0x53af('0x30')]=_[_0x53af('0x43')](db[_0x53af('0x28')]['rawAttributes']);_0x46e4d9[_0x53af('0x2d')]=_[_0x53af('0x43')](_0x5d1b82[_0x53af('0x2d')]);_0x46e4d9['filters']=_[_0x53af('0x2f')](_0x46e4d9['model'],_0x46e4d9[_0x53af('0x2d')]);_0x3490ff[_0x53af('0x32')]=_[_0x53af('0x2f')](_0x46e4d9[_0x53af('0x30')],qs[_0x53af('0x31')](_0x5d1b82[_0x53af('0x2d')][_0x53af('0x31')]));_0x3490ff['attributes']=_0x3490ff[_0x53af('0x32')][_0x53af('0x33')]?_0x3490ff[_0x53af('0x32')]:_0x46e4d9[_0x53af('0x30')];if(_0x5d1b82[_0x53af('0x2d')][_0x53af('0x3c')]){_0x3490ff[_0x53af('0x3d')]=[{'all':!![]}];}_0x3490ff=_[_0x53af('0x3a')]({},_0x3490ff,_0x5d1b82[_0x53af('0x3b')]);return db['WhatsappApplication']['find'](_0x3490ff)[_0x53af('0x20')](handleEntityNotFound(_0x274e72,null))[_0x53af('0x20')](respondWithResult(_0x274e72,null))['catch'](handleError(_0x274e72,null));};exports['create']=function(_0x651bfe,_0x27c961){return db[_0x53af('0x28')][_0x53af('0x44')](_0x651bfe[_0x53af('0x45')],{})[_0x53af('0x20')](respondWithResult(_0x27c961,0xc9))['catch'](handleError(_0x27c961,null));};exports[_0x53af('0x46')]=function(_0x2f3adb,_0x4586aa){if(_0x2f3adb[_0x53af('0x45')]['id']){delete _0x2f3adb[_0x53af('0x45')]['id'];}return db[_0x53af('0x28')][_0x53af('0x47')]({'where':{'id':_0x2f3adb[_0x53af('0x42')]['id']}})['then'](handleEntityNotFound(_0x4586aa,null))['then'](saveUpdates(_0x2f3adb[_0x53af('0x45')],null))['then'](respondWithResult(_0x4586aa,null))[_0x53af('0x40')](handleError(_0x4586aa,null));};exports[_0x53af('0x21')]=function(_0x3f3483,_0x452e9d){return db[_0x53af('0x28')][_0x53af('0x47')]({'where':{'id':_0x3f3483[_0x53af('0x42')]['id']}})['then'](handleEntityNotFound(_0x452e9d,null))['then'](removeEntity(_0x452e9d,null))['catch'](handleError(_0x452e9d,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 4f4ba53..f1aa8c8 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 _0xb18e=['./whatsappApplication.attributes','exports','define','whatsapp_applications','utf8mb4','../../config/logger','moment','request-promise','path','../../config/environment'];(function(_0x2dbc58,_0x2ab1c6){var _0x151f8e=function(_0x147266){while(--_0x147266){_0x2dbc58['push'](_0x2dbc58['shift']());}};_0x151f8e(++_0x2ab1c6);}(_0xb18e,0x181));var _0xeb18=function(_0x4a6cf8,_0x5534ef){_0x4a6cf8=_0x4a6cf8-0x0;var _0x22205e=_0xb18e[_0x4a6cf8];return _0x22205e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xeb18('0x0'))('api');var moment=require(_0xeb18('0x1'));var BPromise=require('bluebird');var rp=require(_0xeb18('0x2'));var fs=require('fs');var path=require(_0xeb18('0x3'));var rimraf=require('rimraf');var config=require(_0xeb18('0x4'));var attributes=require(_0xeb18('0x5'));module[_0xeb18('0x6')]=function(_0x409efb,_0x46d281){return _0x409efb[_0xeb18('0x7')]('WhatsappApplication',attributes,{'tableName':_0xeb18('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xeb18('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xa8eb=['bluebird','request-promise','rimraf','../../config/environment','exports','WhatsappApplication','whatsapp_applications','lodash','../../config/logger','moment'];(function(_0x54d4a8,_0x585a59){var _0x3b321b=function(_0x245c6a){while(--_0x245c6a){_0x54d4a8['push'](_0x54d4a8['shift']());}};_0x3b321b(++_0x585a59);}(_0xa8eb,0x179));var _0xba8e=function(_0x4e5056,_0x4905f8){_0x4e5056=_0x4e5056-0x0;var _0x37ef4d=_0xa8eb[_0x4e5056];return _0x37ef4d;};'use strict';var _=require(_0xba8e('0x0'));var util=require('util');var logger=require(_0xba8e('0x1'))('api');var moment=require(_0xba8e('0x2'));var BPromise=require(_0xba8e('0x3'));var rp=require(_0xba8e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xba8e('0x5'));var config=require(_0xba8e('0x6'));var attributes=require('./whatsappApplication.attributes');module[_0xba8e('0x7')]=function(_0x57e345,_0x14c3ac){return _0x57e345['define'](_0xba8e('0x8'),attributes,{'tableName':_0xba8e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index b712a87..a279d8a 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 _0x0a9a=['WhatsappApplication,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x421cf8,_0x23152c){var _0x145c48=function(_0x565862){while(--_0x565862){_0x421cf8['push'](_0x421cf8['shift']());}};_0x145c48(++_0x23152c);}(_0x0a9a,0x183));var _0xa0a9=function(_0x3aa2e5,_0x2a7977){_0x3aa2e5=_0x3aa2e5-0x0;var _0x4a4b19=_0x0a9a[_0x3aa2e5];return _0x4a4b19;};'use strict';var _=require('lodash');var util=require(_0xa0a9('0x0'));var moment=require('moment');var BPromise=require(_0xa0a9('0x1'));var rs=require(_0xa0a9('0x2'));var fs=require('fs');var Redis=require(_0xa0a9('0x3'));var db=require(_0xa0a9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa0a9('0x5'))(_0xa0a9('0x6'));var config=require('../../config/environment');var jayson=require(_0xa0a9('0x7'));var client=jayson[_0xa0a9('0x8')][_0xa0a9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x31d689,_0x499a29,_0x2b2eb4){return new BPromise(function(_0x520f42,_0x10aa8a){return client[_0xa0a9('0xa')](_0x31d689,_0x2b2eb4)[_0xa0a9('0xb')](function(_0x2d6ac0){logger['info'](_0xa0a9('0xc'),_0x499a29,_0xa0a9('0xd'));logger['debug']('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x499a29,_0xa0a9('0xd'),JSON[_0xa0a9('0xe')](_0x2d6ac0));if(_0x2d6ac0['error']){if(_0x2d6ac0[_0xa0a9('0xf')]['code']===0x1f4){logger[_0xa0a9('0xf')]('WhatsappApplication,\x20%s,\x20%s',_0x499a29,_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);return _0x10aa8a(_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);}logger[_0xa0a9('0xf')]('WhatsappApplication,\x20%s,\x20%s',_0x499a29,_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);return _0x520f42(_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);}else{logger[_0xa0a9('0x11')](_0xa0a9('0xc'),_0x499a29,'request\x20sent');_0x520f42(_0x2d6ac0[_0xa0a9('0x12')]['message']);}})['catch'](function(_0x347092){logger[_0xa0a9('0xf')](_0xa0a9('0xc'),_0x499a29,_0x347092);_0x10aa8a(_0x347092);});});} \ No newline at end of file +var _0x5636=['code','WhatsappApplication,\x20%s,\x20%s','message','info','result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','error'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x5636,0x102));var _0x6563=function(_0x3c6273,_0x1b21e4){_0x3c6273=_0x3c6273-0x0;var _0x3cccdd=_0x5636[_0x3c6273];return _0x3cccdd;};'use strict';var _=require(_0x6563('0x0'));var util=require(_0x6563('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6563('0x2'));var db=require(_0x6563('0x3'))['db'];var utils=require(_0x6563('0x4'));var logger=require('../../config/logger')(_0x6563('0x5'));var config=require(_0x6563('0x6'));var jayson=require(_0x6563('0x7'));var client=jayson[_0x6563('0x8')][_0x6563('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x193942,_0x9884a9,_0x2d57d5){return new BPromise(function(_0x2d0d5b,_0x98fcd4){return client[_0x6563('0xa')](_0x193942,_0x2d57d5)[_0x6563('0xb')](function(_0x3ccb4e){logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x9884a9,_0x6563('0xc'));logger[_0x6563('0xd')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x9884a9,'request\x20sent',JSON['stringify'](_0x3ccb4e));if(_0x3ccb4e[_0x6563('0xe')]){if(_0x3ccb4e[_0x6563('0xe')][_0x6563('0xf')]===0x1f4){logger[_0x6563('0xe')](_0x6563('0x10'),_0x9884a9,_0x3ccb4e[_0x6563('0xe')][_0x6563('0x11')]);return _0x98fcd4(_0x3ccb4e[_0x6563('0xe')][_0x6563('0x11')]);}logger['error'](_0x6563('0x10'),_0x9884a9,_0x3ccb4e['error'][_0x6563('0x11')]);return _0x2d0d5b(_0x3ccb4e[_0x6563('0xe')][_0x6563('0x11')]);}else{logger[_0x6563('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x9884a9,_0x6563('0xc'));_0x2d0d5b(_0x3ccb4e[_0x6563('0x13')][_0x6563('0x11')]);}})[_0x6563('0x14')](function(_0x4e7282){logger[_0x6563('0xe')]('WhatsappApplication,\x20%s,\x20%s',_0x9884a9,_0x4e7282);_0x98fcd4(_0x4e7282);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 223f804..89ee062 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 _0xc1c6=['/describe','isAuthenticated','describe','show','/:id/messages','getMessages','download','post','create','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','/:id','whatsappinteraction:update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','index'];(function(_0x1d9c73,_0x593097){var _0x5a3eff=function(_0x1665cd){while(--_0x1665cd){_0x1d9c73['push'](_0x1d9c73['shift']());}};_0x5a3eff(++_0x593097);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x577193,_0x382e37){_0x577193=_0x577193-0x0;var _0x585e11=_0xc1c6[_0x577193];return _0x585e11;};'use strict';var multer=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var path=require(_0x6c1c('0x2'));var timeout=require('connect-timeout');var express=require(_0x6c1c('0x3'));var router=express['Router']();var fs_extra=require(_0x6c1c('0x4'));var auth=require(_0x6c1c('0x5'));var interaction=require(_0x6c1c('0x6'));var config=require('../../config/environment');var controller=require('./whatsappInteraction.controller');router[_0x6c1c('0x7')]('/',auth['isAuthenticated'](),controller[_0x6c1c('0x8')]);router['get'](_0x6c1c('0x9'),auth[_0x6c1c('0xa')](),controller[_0x6c1c('0xb')]);router[_0x6c1c('0x7')]('/:id',auth[_0x6c1c('0xa')](),controller[_0x6c1c('0xc')]);router['get'](_0x6c1c('0xd'),auth[_0x6c1c('0xa')](),controller[_0x6c1c('0xe')]);router[_0x6c1c('0x7')]('/:id/download',auth[_0x6c1c('0xa')](),controller[_0x6c1c('0xf')]);router[_0x6c1c('0x10')]('/',auth['isAuthenticated'](),controller[_0x6c1c('0x11')]);router[_0x6c1c('0x10')](_0x6c1c('0xd'),auth['isAuthenticated'](),controller[_0x6c1c('0x12')]);router['post'](_0x6c1c('0x13'),auth[_0x6c1c('0xa')](),interaction[_0x6c1c('0x14')](_0x6c1c('0x15'),_0x6c1c('0x16')),controller[_0x6c1c('0x17')]);router[_0x6c1c('0x18')](_0x6c1c('0x19'),auth[_0x6c1c('0xa')](),interaction['tracked'](_0x6c1c('0x15'),_0x6c1c('0x1a')),controller['update']);router[_0x6c1c('0x1b')](_0x6c1c('0x19'),auth['isAuthenticated'](),interaction[_0x6c1c('0x14')]('whatsapp',_0x6c1c('0x1c')),controller[_0x6c1c('0x1d')]);router['delete'](_0x6c1c('0x13'),auth['isAuthenticated'](),controller[_0x6c1c('0x1e')]);module[_0x6c1c('0x1f')]=router; \ No newline at end of file +var _0xfc17=['create','/:id/messages','addMessage','/:id/tags','whatsapp','whatsappinteraction:addtags','addTags','put','/:id','tracked','whatsappinteraction:update','update','destroy','delete','removeTags','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','isAuthenticated','index','get','/describe','describe','show','/:id/download','download','post'];(function(_0x988547,_0x416089){var _0x574899=function(_0x3f84ad){while(--_0x3f84ad){_0x988547['push'](_0x988547['shift']());}};_0x574899(++_0x416089);}(_0xfc17,0x1b4));var _0x7fc1=function(_0x3b8325,_0x3f2282){_0x3b8325=_0x3b8325-0x0;var _0x19b725=_0xfc17[_0x3b8325];return _0x19b725;};'use strict';var multer=require(_0x7fc1('0x0'));var util=require(_0x7fc1('0x1'));var path=require(_0x7fc1('0x2'));var timeout=require(_0x7fc1('0x3'));var express=require('express');var router=express[_0x7fc1('0x4')]();var fs_extra=require(_0x7fc1('0x5'));var auth=require(_0x7fc1('0x6'));var interaction=require(_0x7fc1('0x7'));var config=require(_0x7fc1('0x8'));var controller=require(_0x7fc1('0x9'));router['get']('/',auth[_0x7fc1('0xa')](),controller[_0x7fc1('0xb')]);router[_0x7fc1('0xc')](_0x7fc1('0xd'),auth[_0x7fc1('0xa')](),controller[_0x7fc1('0xe')]);router[_0x7fc1('0xc')]('/:id',auth[_0x7fc1('0xa')](),controller[_0x7fc1('0xf')]);router[_0x7fc1('0xc')]('/:id/messages',auth[_0x7fc1('0xa')](),controller['getMessages']);router['get'](_0x7fc1('0x10'),auth[_0x7fc1('0xa')](),controller[_0x7fc1('0x11')]);router[_0x7fc1('0x12')]('/',auth[_0x7fc1('0xa')](),controller[_0x7fc1('0x13')]);router[_0x7fc1('0x12')](_0x7fc1('0x14'),auth[_0x7fc1('0xa')](),controller[_0x7fc1('0x15')]);router[_0x7fc1('0x12')](_0x7fc1('0x16'),auth['isAuthenticated'](),interaction['tracked'](_0x7fc1('0x17'),_0x7fc1('0x18')),controller[_0x7fc1('0x19')]);router[_0x7fc1('0x1a')](_0x7fc1('0x1b'),auth[_0x7fc1('0xa')](),interaction[_0x7fc1('0x1c')](_0x7fc1('0x17'),_0x7fc1('0x1d')),controller[_0x7fc1('0x1e')]);router['delete'](_0x7fc1('0x1b'),auth['isAuthenticated'](),interaction[_0x7fc1('0x1c')](_0x7fc1('0x17'),'whatsappinteraction:destroy'),controller[_0x7fc1('0x1f')]);router[_0x7fc1('0x20')]('/:id/tags',auth[_0x7fc1('0xa')](),controller[_0x7fc1('0x21')]);module[_0x7fc1('0x22')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 6a6b8ef..2acc7ed 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 _0xac4f=['ENUM','out','BOOLEAN','sequelize','exports','DATE','STRING'];(function(_0x4748a2,_0x5d04bd){var _0x16c342=function(_0x26237e){while(--_0x26237e){_0x4748a2['push'](_0x4748a2['shift']());}};_0x16c342(++_0x5d04bd);}(_0xac4f,0x122));var _0xfac4=function(_0x24a188,_0x4efd77){_0x24a188=_0x24a188-0x0;var _0x493a78=_0xac4f[_0x24a188];return _0x493a78;};'use strict';var Sequelize=require(_0xfac4('0x0'));var moment=require('moment');module[_0xfac4('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xfac4('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xfac4('0x3')]},'note':{'type':Sequelize[_0xfac4('0x3')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xfac4('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xfac4('0x4')]('in',_0xfac4('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xfac4('0x4')]('in',_0xfac4('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xfac4('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x15cb=['out','moment','BOOLEAN','STRING','DATE','ENUM'];(function(_0x4aeda5,_0x1ca887){var _0x32bc0d=function(_0x834c7a){while(--_0x834c7a){_0x4aeda5['push'](_0x4aeda5['shift']());}};_0x32bc0d(++_0x1ca887);}(_0x15cb,0x16f));var _0xb15c=function(_0x46f4dc,_0x10f86e){_0x46f4dc=_0x46f4dc-0x0;var _0xe4ecbf=_0x15cb[_0x46f4dc];return _0xe4ecbf;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xb15c('0x0'));module['exports']={'closed':{'type':Sequelize[_0xb15c('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xb15c('0x2')]},'secondDisposition':{'type':Sequelize[_0xb15c('0x2')]},'thirdDisposition':{'type':Sequelize[_0xb15c('0x2')]},'note':{'type':Sequelize[_0xb15c('0x2')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xb15c('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xb15c('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xb15c('0x4')]('in',_0xb15c('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xb15c('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 65c279f..08eebb3 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 _0x7ee1=['attributes','fields','length','nolimit','sort','where','pick','select','field','color','tools_tags','u.fullname','ui.WhatsappInteractionId','from','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','operator','UserId','body','keys','some','compact','isEmpty','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','resolve','WhatsappAccountId','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','i.WhatsappAccountId\x20IS\x20NULL','agent','sequelize','toString','keyBy','merge','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.phone','Contact.phone','c.mobile','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','rows','show','params','includeAll','include','create','describe','addMessage','WhatsappMessage','ids','getMessages','findOne','hasOwnProperty','options','findAll','setTags','Tag','emit','whatsappInteractionTags:save','removeTags','download','unix','root','server','join','files','attachments','format','transcript-%d-%s.zip','User','CmContact','lastName','Attachment','Messages','secret','WhatsappAccount','Account','get','mkdirSync','Whatsapp','Owner','fullname','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','existsSync','pipe','out','System','Contact','firstName','direction','views','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','json','undefined','limit','offset','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','Users','Tags','TagIds','split','forEach','push','catch','index','map','WhatsappInteraction','rawAttributes','fieldName','type','key','model','query','filters','intersection'];(function(_0x33f153,_0x39d65d){var _0x12ac15=function(_0x1603c1){while(--_0x1603c1){_0x33f153['push'](_0x33f153['shift']());}};_0x12ac15(++_0x39d65d);}(_0x7ee1,0xab));var _0x17ee=function(_0x276c51,_0x309c86){_0x276c51=_0x276c51-0x0;var _0x15487f=_0x7ee1[_0x276c51];return _0x15487f;};'use strict';var emlformat=require(_0x17ee('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x17ee('0x1'));var jsonpatch=require(_0x17ee('0x2'));var rp=require(_0x17ee('0x3'));var moment=require(_0x17ee('0x4'));var BPromise=require(_0x17ee('0x5'));var Mustache=require('mustache');var util=require(_0x17ee('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x17ee('0x7'));var ejs=require(_0x17ee('0x8'));var fs=require('fs');var fs_extra=require(_0x17ee('0x9'));var _=require(_0x17ee('0xa'));var squel=require(_0x17ee('0xb'));var crypto=require('crypto');var jsforce=require(_0x17ee('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x17ee('0x7'));var querystring=require(_0x17ee('0xd'));var Papa=require('papaparse');var Redis=require(_0x17ee('0xe'));var authService=require(_0x17ee('0xf'));var qs=require(_0x17ee('0x10'));var as=require(_0x17ee('0x11'));var pdf=require(_0x17ee('0x12'));var hardwareService=require(_0x17ee('0x13'));var logger=require(_0x17ee('0x14'))(_0x17ee('0x15'));var utils=require(_0x17ee('0x16'));var config=require(_0x17ee('0x17'));var licenseUtil=require(_0x17ee('0x18'));var db=require(_0x17ee('0x19'))['db'];config['redis']=_[_0x17ee('0x1a')](config[_0x17ee('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x17ee('0x1c'))(new Redis(config['redis']));require(_0x17ee('0x1d'))[_0x17ee('0x1e')](socket);function respondWithStatusCode(_0x16a1b5,_0x206f85){_0x206f85=_0x206f85||0xcc;return function(_0x5eebbc){if(_0x5eebbc){return _0x16a1b5[_0x17ee('0x1f')](_0x206f85);}return _0x16a1b5[_0x17ee('0x20')](_0x206f85)[_0x17ee('0x21')]();};}function respondWithResult(_0x4bfb6d,_0x138507){_0x138507=_0x138507||0xc8;return function(_0x47c346){if(_0x47c346){return _0x4bfb6d[_0x17ee('0x20')](_0x138507)[_0x17ee('0x22')](_0x47c346);}};}function respondWithFilteredResult(_0x42b403,_0x3785ed){return function(_0x15d245){if(_0x15d245){var _0x5506a3=typeof _0x3785ed['offset']===_0x17ee('0x23')&&typeof _0x3785ed[_0x17ee('0x24')]===_0x17ee('0x23');var _0x2f908f=_0x15d245['count'];var _0x29a874=_0x5506a3?0x0:_0x3785ed[_0x17ee('0x25')];var _0x25782c=_0x5506a3?_0x15d245[_0x17ee('0x26')]:_0x3785ed['offset']+_0x3785ed[_0x17ee('0x24')];var _0x3d9120;if(_0x25782c>=_0x2f908f){_0x25782c=_0x2f908f;_0x3d9120=0xc8;}else{_0x3d9120=0xce;}_0x42b403[_0x17ee('0x20')](_0x3d9120);return _0x42b403['set'](_0x17ee('0x27'),_0x29a874+'-'+_0x25782c+'/'+_0x2f908f)[_0x17ee('0x22')](_0x15d245);}return null;};}function patchUpdates(_0x27f056){return function(_0x199311){try{jsonpatch[_0x17ee('0x28')](_0x199311,_0x27f056,!![]);}catch(_0x4804ea){return BPromise[_0x17ee('0x29')](_0x4804ea);}return _0x199311[_0x17ee('0x2a')]();};}function saveUpdates(_0xf20fe0,_0x1ce8c7){return function(_0x88a4af){if(_0x88a4af){return _0x88a4af[_0x17ee('0x2b')](_0xf20fe0)[_0x17ee('0x2c')](function(_0x51a282){return _0x51a282;});}return null;};}function removeEntity(_0x4f24a8,_0x284fbc){return function(_0x1e24bf){if(_0x1e24bf){return _0x1e24bf[_0x17ee('0x2d')]()[_0x17ee('0x2c')](function(){_0x4f24a8[_0x17ee('0x20')](0xcc)[_0x17ee('0x21')]();});}};}function handleEntityNotFound(_0x5b11c5,_0x4ba675){return function(_0x32548e){if(!_0x32548e){_0x5b11c5[_0x17ee('0x1f')](0x194);}return _0x32548e;};}function handleError(_0x390c04,_0x5ea202){_0x5ea202=_0x5ea202||0x1f4;return function(_0x393231){logger[_0x17ee('0x2e')](_0x393231[_0x17ee('0x2f')]);if(_0x393231['name']){delete _0x393231[_0x17ee('0x30')];}_0x390c04[_0x17ee('0x20')](_0x5ea202)[_0x17ee('0x31')](_0x393231);};}function getInteractionUsers(_0x1e5727,_0x4dfb63){return new BPromise(function(_0x3aa7fe,_0x3e7b9b){try{if(_0x4dfb63[_0x1e5727['id']]){_0x1e5727[_0x17ee('0x32')]=_['map'](_0x4dfb63[_0x1e5727['id']],function(_0x6f8327){return{'id':_0x6f8327['id'],'fullname':_0x6f8327['fullname']};});}}catch(_0x9e6424){_0x3e7b9b(_0x9e6424);}_0x3aa7fe(_0x1e5727);});}function getInteractionTags(_0x1cf8b9,_0x126f3a){return new BPromise(function(_0x5d0171,_0x2356fd){try{if(_0x1cf8b9['TagIds']){_0x1cf8b9[_0x17ee('0x33')]=[];_0x1cf8b9[_0x17ee('0x34')][_0x17ee('0x35')](',')[_0x17ee('0x36')](function(_0x514114){_0x1cf8b9[_0x17ee('0x33')][_0x17ee('0x37')](_0x126f3a[_0x514114]);});}delete _0x1cf8b9[_0x17ee('0x34')];}catch(_0x57096e){_0x2356fd(_0x57096e);}_0x5d0171(_0x1cf8b9);});}function updateWhatsappInteraction(_0x64ca53,_0x3d91a2,_0x4284cc){return new BPromise(function(_0x5b338e,_0x12a758){return getInteractionUsers(_0x64ca53,_0x4284cc)[_0x17ee('0x2c')](function(_0x2177ef){return getInteractionTags(_0x2177ef,_0x3d91a2);})[_0x17ee('0x2c')](function(_0x1e3c2f){_0x5b338e(_0x1e3c2f);})[_0x17ee('0x38')](function(_0x219384){_0x12a758(_0x219384);});});}exports[_0x17ee('0x39')]=function(_0x219db4,_0x466787){var _0x51e304={},_0x3c2846={},_0xe8f55c={'count':0x0,'rows':[]};var _0x1614fd=_[_0x17ee('0x3a')](db[_0x17ee('0x3b')][_0x17ee('0x3c')],function(_0x2d6afc){return{'name':_0x2d6afc[_0x17ee('0x3d')],'type':_0x2d6afc[_0x17ee('0x3e')][_0x17ee('0x3f')]};});_0x3c2846[_0x17ee('0x40')]=_['map'](_0x1614fd,_0x17ee('0x30'));_0x3c2846[_0x17ee('0x41')]=_['keys'](_0x219db4[_0x17ee('0x41')]);_0x3c2846[_0x17ee('0x42')]=_[_0x17ee('0x43')](_0x3c2846[_0x17ee('0x40')],_0x3c2846[_0x17ee('0x41')]);_0x51e304[_0x17ee('0x44')]=_['intersection'](_0x3c2846['model'],qs[_0x17ee('0x45')](_0x219db4[_0x17ee('0x41')][_0x17ee('0x45')]));_0x51e304[_0x17ee('0x44')]=_0x51e304[_0x17ee('0x44')][_0x17ee('0x46')]?_0x51e304['attributes']:_0x3c2846[_0x17ee('0x40')];if(!_0x219db4[_0x17ee('0x41')]['hasOwnProperty'](_0x17ee('0x47'))){_0x51e304['limit']=qs[_0x17ee('0x24')](_0x219db4['query'][_0x17ee('0x24')]);_0x51e304[_0x17ee('0x25')]=qs[_0x17ee('0x25')](_0x219db4[_0x17ee('0x41')]['offset']);}_0x51e304['order']=qs['sort'](_0x219db4['query'][_0x17ee('0x48')]);_0x51e304[_0x17ee('0x49')]=qs['filters'](_[_0x17ee('0x4a')](_0x219db4[_0x17ee('0x41')],_0x3c2846[_0x17ee('0x42')]),_0x1614fd);var _0xcf486=[];var _0x31e4f1=squel[_0x17ee('0x4b')]()[_0x17ee('0x4c')]('id')[_0x17ee('0x4c')]('name')[_0x17ee('0x4c')](_0x17ee('0x4d'))['from'](_0x17ee('0x4e'));var _0x1a8bc5=squel[_0x17ee('0x4b')]()['field']('u.id')['field'](_0x17ee('0x4f'))[_0x17ee('0x4c')](_0x17ee('0x50'))[_0x17ee('0x51')](_0x17ee('0x52'),'ui')[_0x17ee('0x53')](_0x17ee('0x54'),'u',_0x17ee('0x55'));var _0x5d2e69=squel[_0x17ee('0x4b')]()[_0x17ee('0x51')](_0x17ee('0x56'),'i')[_0x17ee('0x53')](_0x17ee('0x57'),'c',_0x17ee('0x58'))[_0x17ee('0x53')]('users','o',_0x17ee('0x59'))[_0x17ee('0x53')](_0x17ee('0x5a'),'a',_0x17ee('0x5b'))['left_join'](_0x17ee('0x5c'),'me',_0x17ee('0x5d'))[_0x17ee('0x53')](_0x17ee('0x5e'),'it','it.WhatsappInteractionId\x20=\x20i.id')[_0x17ee('0x53')](_0x17ee('0x4e'),'t',_0x17ee('0x5f'));var _0x3d399b=squel[_0x17ee('0x60')]();var _0x3e588a=[];var _0x153b50=squel[_0x17ee('0x60')]();var _0x4b913a;if(_0x219db4['query'][_0x17ee('0x61')]){_0x4b913a=as[_0x17ee('0x62')](_0x219db4['query'][_0x17ee('0x61')]);var _0x144bab=_0x4b913a[_0x17ee('0x63')];for(var _0x1d9bc2=0x0;_0x1d9bc2<_0x4b913a['conditions']['length'];_0x1d9bc2++){var _0x3046b0=_0x4b913a[_0x17ee('0x64')][_0x1d9bc2];var _0x4fcb6d='i';var _0x5f316a=_[_0x17ee('0x65')](_0x1614fd,['name',_0x3046b0[_0x17ee('0x4c')]]);if(!_0x5f316a){switch(_0x3046b0['field']){case _0x17ee('0x66'):if(_0x3046b0['value']==0x1){_0x5d2e69[_0x17ee('0x67')]('`'+_0x3046b0[_0x17ee('0x4c')]+_0x17ee('0x68'));}else{_0x5d2e69['having']('`'+_0x3046b0[_0x17ee('0x4c')]+'`\x20>\x200');}break;case'Contact':if(_0x3046b0['operator']===_0x17ee('0x69')){if(_0x3046b0[_0x17ee('0x6a')]['split']('\x20')[_0x17ee('0x46')]>0x1){_0x3d399b[_0x144bab](_0x17ee('0x6b'),qs[_0x17ee('0x6c')](_0x3046b0[_0x17ee('0x6a')]),null);}else{var _0x6f45ec='%'+_0x3046b0['value']+'%';_0x3d399b[_0x144bab](_0x17ee('0x6d'),_0x6f45ec,_0x6f45ec,_0x6f45ec);}}else{_0x5f316a=_[_0x17ee('0x65')](_0x1614fd,['name',_0x17ee('0x6e')]);_0x3046b0['field']=_0x17ee('0x6e');_0x4d67ed=as[_0x17ee('0x6f')](_0x4fcb6d,_0x5f316a['type'],_0x3046b0);_0x3d399b[_0x144bab](_0x4d67ed[_0x17ee('0x70')],_0x4d67ed[_0x17ee('0x6a')][_0x17ee('0x71')],_0x4d67ed[_0x17ee('0x6a')]['end']);}break;case'Tag':var _0x47ca5f=_0x3046b0[_0x17ee('0x6a')]['split'](',')[_0x17ee('0x3a')](function(_0x33572c){return Number(_0x33572c);});_0x47ca5f['forEach'](function(_0x272ec3){_0x153b50['or'](_0x17ee('0x72'),'%,'+_0x272ec3+',%');});_0x3e588a=_[_0x17ee('0x73')](_0x3e588a,_0x47ca5f);break;case'User':if(_0x3046b0[_0x17ee('0x74')]===_0x17ee('0x69')){_0x3d399b[_0x144bab]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x3046b0[_0x17ee('0x6a')]+'%',null);}else{_0x5f316a=_[_0x17ee('0x65')](_0x1614fd,[_0x17ee('0x30'),_0x17ee('0x75')]);_0x3046b0[_0x17ee('0x4c')]=_0x17ee('0x75');_0x4d67ed=as['buildExpression'](_0x4fcb6d,_0x5f316a['type'],_0x3046b0);_0x3d399b[_0x144bab](_0x4d67ed[_0x17ee('0x70')],_0x4d67ed['value']['start'],_0x4d67ed[_0x17ee('0x6a')][_0x17ee('0x21')]);}break;case _0x17ee('0x76'):_0x4d67ed=as['buildExpression']('me',null,_0x3046b0);_0x3d399b[_0x144bab](_0x4d67ed['text'],_0x4d67ed[_0x17ee('0x6a')][_0x17ee('0x71')],_0x4d67ed[_0x17ee('0x6a')][_0x17ee('0x21')]);break;}}else{var _0x4d67ed=as['buildExpression'](_0x4fcb6d,_0x5f316a[_0x17ee('0x3e')],_0x3046b0);_0x3d399b[_0x144bab](_0x4d67ed['text'],_0x4d67ed['value'][_0x17ee('0x71')],_0x4d67ed[_0x17ee('0x6a')]['end']);}}}else{var _0x7c0c8e=_(_0x219db4['query'])[_0x17ee('0x77')]()[_0x17ee('0x3a')](function(_0x14921e){return _[_0x17ee('0x78')](_0x1614fd,['name',_0x14921e])?_0x14921e:undefined;})[_0x17ee('0x79')]()[_0x17ee('0x6a')]();if(!_[_0x17ee('0x7a')](_0x7c0c8e)){_0x7c0c8e[_0x17ee('0x36')](function(_0xa490e2){if(_0xa490e2==='WhatsappAccountId'){_0x5d2e69['where'](_0x17ee('0x7b'),[][_0x17ee('0x7c')](_0x219db4[_0x17ee('0x41')][_0xa490e2]));}else if(_0xa490e2===_0x17ee('0x7d')){var _0x38f3ec=JSON[_0x17ee('0x7e')](_0x219db4[_0x17ee('0x41')][_0xa490e2])[_0x17ee('0x7f')];var _0x46a3c1=JSON[_0x17ee('0x7e')](_0x219db4[_0x17ee('0x41')][_0xa490e2])[_0x17ee('0x80')];_0x5d2e69[_0x17ee('0x49')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x38f3ec,_0x46a3c1);}else{if(_0x219db4[_0x17ee('0x41')][_0xa490e2]===_0x17ee('0x81')){_0x5d2e69[_0x17ee('0x49')]('i.'+_0xa490e2+'\x20IS\x20NULL');}else{_0x5d2e69['where']('i.'+_0xa490e2+_0x17ee('0x82'),_0x219db4['query'][_0xa490e2]);}}});}if(_0x219db4[_0x17ee('0x41')][_0x17ee('0x83')]){if(_0x219db4[_0x17ee('0x41')][_0x17ee('0x83')]==0x1){_0x5d2e69['having']('`unreadMessages`\x20=\x200');}else{_0x5d2e69[_0x17ee('0x67')](_0x17ee('0x84'));}}if(_0x219db4['query'][_0x17ee('0x85')]){_0x3e588a=_[_0x17ee('0x86')](_0x219db4[_0x17ee('0x41')]['tag'])?_0x219db4[_0x17ee('0x41')]['tag']:new Array(_0x219db4[_0x17ee('0x41')][_0x17ee('0x85')]);_0x3e588a['forEach'](function(_0x5dd9a3){_0x153b50['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5dd9a3+',%');});}if(_0x219db4[_0x17ee('0x41')][_0x17ee('0x87')]){var _0x15f5b4=_0x219db4['query']['filter'][_0x17ee('0x88')]('\x5c','\x5c\x5c')[_0x17ee('0x88')](/'/g,'\x27\x27');if(qs[_0x17ee('0x89')](_0x15f5b4)){_0x3d399b['or'](_0x17ee('0x8a'),_0x15f5b4+'%')['or']('i.phone\x20LIKE\x20?',_0x15f5b4+'%');}else{_0x3d399b['or'](_0x17ee('0x8b'),qs[_0x17ee('0x6c')](_0x15f5b4))['or'](_0x17ee('0x8c'),_0x15f5b4+'%');}}}_0x5d2e69[_0x17ee('0x49')](_0x3d399b);_0x5d2e69[_0x17ee('0x8d')](_0x17ee('0x8e'));var _0x457479={'type':db['Sequelize']['QueryTypes'][_0x17ee('0x8f')],'raw':!![]};var _0x555302=_0x5d2e69['clone']();_0x555302['field']('i.id');_0x555302['field'](_0x17ee('0x90'),_0x17ee('0x66'));if(_0x51e304[_0x17ee('0x91')]){_0x51e304['order']['forEach'](function(_0x416afe){var _0x5e43a6=_0x416afe[0x0]===_0x17ee('0x92')?_0x416afe[0x0]:'i.'+_0x416afe[0x0];_0x5d2e69['order'](_0x5e43a6,_0x416afe[0x1]==='DESC'?![]:!![]);});}if(!_[_0x17ee('0x7a')](_0x3e588a)){_0x5d2e69[_0x17ee('0x67')](_0x153b50);_0x555302[_0x17ee('0x49')]('t.id\x20IN\x20?',_0x3e588a);}BPromise[_0x17ee('0x93')]()[_0x17ee('0x2c')](function(){if(!_0x4b913a){if(_0x219db4[_0x17ee('0x41')][_0x17ee('0x94')])return;_0x555302[_0x17ee('0x49')](_0x17ee('0x95'));_0x5d2e69[_0x17ee('0x49')](_0x17ee('0x95'));return;}if(_0x219db4[_0x17ee('0x96')][_0x17ee('0x97')]!=='agent')return;return _0x219db4[_0x17ee('0x96')]['getWhatsappAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0xf7f178){if(_['isEmpty'](_0xf7f178)){_0x555302[_0x17ee('0x49')]('i.WhatsappAccountId\x20IS\x20NULL');_0x5d2e69[_0x17ee('0x49')](_0x17ee('0x98'));}else{_0x555302[_0x17ee('0x49')](_0x17ee('0x7b'),_[_0x17ee('0x3a')](_0xf7f178,'id'));_0x5d2e69['where'](_0x17ee('0x7b'),_['map'](_0xf7f178,'id'));}});})[_0x17ee('0x2c')](function(){if(_0x219db4[_0x17ee('0x96')][_0x17ee('0x97')]===_0x17ee('0x99')&&!_0x4b913a&&!_0x219db4[_0x17ee('0x41')][_0x17ee('0x94')])return[];return db[_0x17ee('0x9a')][_0x17ee('0x41')](_0x555302['toString'](),_0x457479);})[_0x17ee('0x2c')](function(_0x580e18){_0xe8f55c[_0x17ee('0x26')]=_0x580e18[_0x17ee('0x46')];if(_0xe8f55c[_0x17ee('0x26')]===0x0)return[];return db[_0x17ee('0x9a')]['query'](_0x31e4f1[_0x17ee('0x9b')](),_0x457479)[_0x17ee('0x2c')](function(_0xc049ff){_0xcf486=_[_0x17ee('0x9c')](_0xc049ff,'id');_0x457479=_[_0x17ee('0x9d')](_0x457479,{'model':db[_0x17ee('0x3b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x219db4[_0x17ee('0x41')]['fields']){_0x51e304[_0x17ee('0x44')][_0x17ee('0x36')](function(_0x49e8b7){_0x5d2e69[_0x17ee('0x4c')]('i.'+_0x49e8b7);});}else{_0x5d2e69['field'](_0x17ee('0x90'),'unreadMessages');_0x5d2e69[_0x17ee('0x4c')]('a.key',_0x17ee('0x9e'));_0x5d2e69[_0x17ee('0x4c')](_0x17ee('0x9f'),_0x17ee('0xa0'));_0x5d2e69[_0x17ee('0x4c')](_0x17ee('0xa1'),_0x17ee('0x92'));_0x5d2e69[_0x17ee('0x4c')](_0x17ee('0xa2'));_0x5d2e69[_0x17ee('0x4c')](_0x17ee('0xa3'),_0x17ee('0xa4'));_0x5d2e69[_0x17ee('0x4c')](_0x17ee('0xa5'),_0x17ee('0xa6'));_0x5d2e69['field']('c.email','Contact.email');_0x5d2e69[_0x17ee('0x4c')](_0x17ee('0xa7'),_0x17ee('0xa8'));_0x5d2e69[_0x17ee('0x4c')](_0x17ee('0xa9'),'Contact.mobile');_0x5d2e69['field']('c.fax','Contact.fax');_0x5d2e69[_0x17ee('0x4c')](_0x17ee('0xaa'),_0x17ee('0xab'));_0x5d2e69[_0x17ee('0x4c')](_0x17ee('0xac'),'Owner.internal');_0x5d2e69[_0x17ee('0x4c')](_0x17ee('0xad'),_0x17ee('0x34'));}if(_0x51e304[_0x17ee('0x24')])_0x5d2e69['limit'](_0x51e304[_0x17ee('0x24')]);if(_0x51e304['offset'])_0x5d2e69[_0x17ee('0x25')](_0x51e304['offset']);return db[_0x17ee('0x9a')]['query'](_0x5d2e69[_0x17ee('0x9b')](),_0x457479);})[_0x17ee('0x2c')](function(_0x1e72d6){if(_0x1e72d6[_0x17ee('0x46')]>0x0)_0x1a8bc5[_0x17ee('0x49')](_0x17ee('0xae'),_['map'](_0x1e72d6,'id'));return db[_0x17ee('0x9a')][_0x17ee('0x41')](_0x1a8bc5[_0x17ee('0x9b')](),_0x457479)[_0x17ee('0x2c')](function(_0x20089b){var _0x399f72=_[_0x17ee('0xaf')](_0x20089b,_0x17ee('0xb0'));var _0xf5177b=[];_0x1e72d6['forEach'](function(_0x6608fa){_0xf5177b[_0x17ee('0x37')](updateWhatsappInteraction(_0x6608fa,_0xcf486,_0x399f72));});return BPromise[_0x17ee('0xb1')](_0xf5177b);});});})['then'](function(_0x18ad73){_0xe8f55c[_0x17ee('0xb2')]=_0x18ad73;return _0xe8f55c;})[_0x17ee('0x2c')](respondWithFilteredResult(_0x466787,_0x51e304))[_0x17ee('0x38')](handleError(_0x466787,null));};exports[_0x17ee('0xb3')]=function(_0x1836ce,_0x304ff5){var _0x2ac69c={'raw':![],'where':{'id':_0x1836ce[_0x17ee('0xb4')]['id']}},_0x1cdf79={};_0x1cdf79[_0x17ee('0x40')]=_[_0x17ee('0x77')](db[_0x17ee('0x3b')][_0x17ee('0x3c')]);_0x1cdf79[_0x17ee('0x41')]=_['keys'](_0x1836ce[_0x17ee('0x41')]);_0x1cdf79['filters']=_[_0x17ee('0x43')](_0x1cdf79[_0x17ee('0x40')],_0x1cdf79['query']);_0x2ac69c['attributes']=_[_0x17ee('0x43')](_0x1cdf79[_0x17ee('0x40')],qs[_0x17ee('0x45')](_0x1836ce[_0x17ee('0x41')][_0x17ee('0x45')]));_0x2ac69c[_0x17ee('0x44')]=_0x2ac69c[_0x17ee('0x44')][_0x17ee('0x46')]?_0x2ac69c[_0x17ee('0x44')]:_0x1cdf79[_0x17ee('0x40')];if(_0x1836ce['query'][_0x17ee('0xb5')]){_0x2ac69c[_0x17ee('0xb6')]=[{'all':!![]}];}_0x2ac69c=_[_0x17ee('0x9d')]({},_0x2ac69c,_0x1836ce['options']);return db[_0x17ee('0x3b')]['find'](_0x2ac69c)[_0x17ee('0x2c')](handleEntityNotFound(_0x304ff5,null))[_0x17ee('0x2c')](respondWithResult(_0x304ff5,null))[_0x17ee('0x38')](handleError(_0x304ff5,null));};exports[_0x17ee('0xb7')]=function(_0x85c590,_0xa6b624){return db[_0x17ee('0x3b')]['create'](_0x85c590[_0x17ee('0x76')],{})[_0x17ee('0x2c')](respondWithResult(_0xa6b624,0xc9))[_0x17ee('0x38')](handleError(_0xa6b624,null));};exports[_0x17ee('0x2b')]=function(_0x34ff0d,_0x393277){if(_0x34ff0d[_0x17ee('0x76')]['id']){delete _0x34ff0d[_0x17ee('0x76')]['id'];}return db[_0x17ee('0x3b')][_0x17ee('0x65')]({'where':{'id':_0x34ff0d[_0x17ee('0xb4')]['id']}})[_0x17ee('0x2c')](handleEntityNotFound(_0x393277,null))[_0x17ee('0x2c')](saveUpdates(_0x34ff0d['body'],null))[_0x17ee('0x2c')](respondWithResult(_0x393277,null))[_0x17ee('0x38')](handleError(_0x393277,null));};exports[_0x17ee('0x2d')]=function(_0x4d8595,_0x4a0b0c){return db['WhatsappInteraction'][_0x17ee('0x65')]({'where':{'id':_0x4d8595[_0x17ee('0xb4')]['id']}})['then'](handleEntityNotFound(_0x4a0b0c,null))['then'](removeEntity(_0x4a0b0c,null))[_0x17ee('0x38')](handleError(_0x4a0b0c,null));};exports[_0x17ee('0xb8')]=function(_0x5ccec3,_0x302b61){return db[_0x17ee('0x3b')][_0x17ee('0xb8')]()['then'](respondWithResult(_0x302b61,null))[_0x17ee('0x38')](handleError(_0x302b61,null));};exports[_0x17ee('0xb9')]=function(_0x36cc83,_0x5f214f,_0x5c1bf3){return db[_0x17ee('0xba')][_0x17ee('0x65')]({'where':{'id':_0x36cc83[_0x17ee('0xb4')]['id']}})[_0x17ee('0x2c')](handleEntityNotFound(_0x5f214f,null))[_0x17ee('0x2c')](function(_0x1a8018){if(_0x1a8018){return _0x1a8018['addMessage'](_0x36cc83[_0x17ee('0x76')][_0x17ee('0xbb')],_['omit'](_0x36cc83['body'],[_0x17ee('0xbb'),'id'])||{});}})[_0x17ee('0x2c')](respondWithResult(_0x5f214f,null))[_0x17ee('0x38')](handleError(_0x5f214f,null));};exports[_0x17ee('0xbc')]=function(_0x2a5199,_0x50f520,_0x572386){var _0x58901d={'raw':![],'where':{}};var _0x30c0de={};var _0x504a27={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0x17ee('0xbd')]({'where':{'id':_0x2a5199['params']['id']}})[_0x17ee('0x2c')](handleEntityNotFound(_0x50f520,null))[_0x17ee('0x2c')](function(_0x2298ef){if(_0x2298ef){_0x30c0de[_0x17ee('0x40')]=_['keys'](db[_0x17ee('0xba')][_0x17ee('0x3c')]);_0x30c0de[_0x17ee('0x41')]=_['keys'](_0x2a5199[_0x17ee('0x41')]);_0x30c0de['filters']=_[_0x17ee('0x43')](_0x30c0de[_0x17ee('0x40')],_0x30c0de[_0x17ee('0x41')]);_0x58901d[_0x17ee('0x44')]=_[_0x17ee('0x43')](_0x30c0de[_0x17ee('0x40')],qs[_0x17ee('0x45')](_0x2a5199['query'][_0x17ee('0x45')]));_0x58901d[_0x17ee('0x44')]=_0x58901d[_0x17ee('0x44')][_0x17ee('0x46')]?_0x58901d[_0x17ee('0x44')]:_0x30c0de[_0x17ee('0x40')];if(!_0x2a5199[_0x17ee('0x41')][_0x17ee('0xbe')](_0x17ee('0x47'))){_0x58901d['limit']=qs[_0x17ee('0x24')](_0x2a5199['query']['limit']);_0x58901d[_0x17ee('0x25')]=qs[_0x17ee('0x25')](_0x2a5199[_0x17ee('0x41')][_0x17ee('0x25')]);}_0x58901d['order']=qs[_0x17ee('0x48')](_0x2a5199[_0x17ee('0x41')][_0x17ee('0x48')]);_0x58901d['where']=qs[_0x17ee('0x42')](_[_0x17ee('0x4a')](_0x2a5199['query'],_0x30c0de[_0x17ee('0x42')]));_0x58901d[_0x17ee('0x49')][_0x17ee('0xb0')]=_0x2298ef['id'];if(_0x2a5199['query'][_0x17ee('0x87')]){_0x58901d[_0x17ee('0x49')]=_[_0x17ee('0x9d')](_0x58901d[_0x17ee('0x49')],{'$or':_[_0x17ee('0x3a')](_0x58901d[_0x17ee('0x44')],function(_0x192178){var _0x3f9b13={};_0x3f9b13[_0x192178]={'$like':'%'+_0x2a5199[_0x17ee('0x41')]['filter']+'%'};return _0x3f9b13;})});}if(_0x2a5199[_0x17ee('0x41')][_0x17ee('0x7f')]){var _0x5b1d20=_0x2a5199[_0x17ee('0x41')][_0x17ee('0x7f')]['split'](',');var _0x3e5a95={};_0x3e5a95[_0x5b1d20[0x0]]={'$gte':moment(_0x5b1d20[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x58901d[_0x17ee('0x49')]=_[_0x17ee('0x9d')](_0x58901d[_0x17ee('0x49')],_0x3e5a95);}_0x58901d=_[_0x17ee('0x9d')]({},_0x58901d,_0x2a5199[_0x17ee('0xbf')]);return db[_0x17ee('0xba')][_0x17ee('0x26')]({'where':_0x58901d[_0x17ee('0x49')]})[_0x17ee('0x2c')](function(_0x29c9f1){_0x504a27[_0x17ee('0x26')]=_0x29c9f1;if(_0x2a5199[_0x17ee('0x41')][_0x17ee('0xb5')]){_0x58901d['include']=[{'all':!![]}];}return db[_0x17ee('0xba')][_0x17ee('0xc0')](_0x58901d);})[_0x17ee('0x2c')](function(_0x4c9954){_0x504a27[_0x17ee('0xb2')]=_0x4c9954;return _0x504a27;});}})[_0x17ee('0x2c')](respondWithFilteredResult(_0x50f520,_0x58901d))[_0x17ee('0x38')](handleError(_0x50f520,null));};exports['addTags']=function(_0x546adb,_0x4a468a,_0x56a22a){return db[_0x17ee('0x3b')]['find']({'where':{'id':_0x546adb[_0x17ee('0xb4')]['id']}})['then'](handleEntityNotFound(_0x4a468a,null))['then'](function(_0x4ef8f9){if(_0x4ef8f9){return _0x4ef8f9[_0x17ee('0xc1')](_0x546adb['body'][_0x17ee('0xbb')],_['omit'](_0x546adb[_0x17ee('0x76')],['ids','id'])||{})['spread'](function(){return db[_0x17ee('0xc2')][_0x17ee('0xc0')]({'attributes':['id',_0x17ee('0x30'),_0x17ee('0x4d')],'where':{'id':_0x546adb['body'][_0x17ee('0xbb')]}});})[_0x17ee('0x2c')](function(_0x2c6b84){socket[_0x17ee('0xc3')](_0x17ee('0xc4'),{'id':Number(_0x546adb[_0x17ee('0xb4')]['id']),'tags':_0x2c6b84||[]});return{'id':Number(_0x546adb[_0x17ee('0xb4')]['id']),'tags':_0x2c6b84||[]};});}})['then'](respondWithResult(_0x4a468a,null))[_0x17ee('0x38')](handleError(_0x4a468a,null));};exports[_0x17ee('0xc5')]=function(_0x2795b1,_0xb1af47,_0x5030c1){return db[_0x17ee('0x3b')]['find']({'where':{'id':_0x2795b1['params']['id']}})[_0x17ee('0x2c')](handleEntityNotFound(_0xb1af47,null))[_0x17ee('0x2c')](function(_0x5b033e){if(_0x5b033e){return _0x5b033e[_0x17ee('0xc5')](_0x2795b1[_0x17ee('0x41')][_0x17ee('0xbb')]);}})[_0x17ee('0x2c')](respondWithStatusCode(_0xb1af47,null))[_0x17ee('0x38')](handleError(_0xb1af47,null));};exports[_0x17ee('0xc6')]=function(_0xe8b45c,_0x3111b5){var _0x42e8a0=moment()[_0x17ee('0xc7')]()[_0x17ee('0x9b')]();var _0x49b745=path['join'](config[_0x17ee('0xc8')],_0x17ee('0xc9'),'files','tmp');var _0x3d379b=path[_0x17ee('0xca')](config['root'],'server',_0x17ee('0xcb'),_0x17ee('0xcc'));var _0xecdd2=path[_0x17ee('0xca')](_0x49b745,_0x42e8a0);var _0x111584=util[_0x17ee('0xcd')](_0x17ee('0xce'),_0xe8b45c['params']['id'],_0x42e8a0);var _0x4acaeb=path[_0x17ee('0xca')](_0x49b745,_0x111584);var _0x12a32f=[];_0x12a32f[_0x17ee('0x37')]({'model':db[_0x17ee('0xcf')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x12a32f[_0x17ee('0x37')]({'model':db[_0x17ee('0xd0')],'as':'Contact','attributes':['id','firstName',_0x17ee('0xd1')],'raw':!![]});if(_0xe8b45c['query'][_0x17ee('0xcc')]){_0x12a32f[_0x17ee('0x37')]({'model':db[_0x17ee('0xd2')],'as':'Attachment','raw':!![]});}var _0x5174a9=[{'model':db['WhatsappMessage'],'as':_0x17ee('0xd3'),'attributes':['id',_0x17ee('0x76'),_0x17ee('0x7d'),'direction',_0x17ee('0xd4'),'read'],'include':_0x12a32f}];_0x5174a9[_0x17ee('0x37')]({'model':db[_0x17ee('0xd5')],'as':_0x17ee('0xd6'),'attributes':['id','name']});_0x5174a9[_0x17ee('0x37')]({'model':db[_0x17ee('0xcf')],'as':'Owner','attributes':['id','fullname']});return db[_0x17ee('0x3b')][_0x17ee('0x65')]({'where':{'id':_0xe8b45c[_0x17ee('0xb4')]['id']},'include':_0x5174a9})['then'](handleEntityNotFound(_0x3111b5,null))[_0x17ee('0x2c')](function(_0x3125af){if(_0x3125af){var _0x476053=_0x3125af[_0x17ee('0xd7')]({'plain':!![]});fs[_0x17ee('0xd8')](_0xecdd2);var _0x327e12={'channel':_0x17ee('0xd9'),'account':_0x476053['Account'][_0x17ee('0x30')],'agent':_0x476053[_0x17ee('0xda')]?_0x476053[_0x17ee('0xda')][_0x17ee('0xdb')]:_0x17ee('0xdc'),'createdAt':moment(_0x476053[_0x17ee('0x7d')])[_0x17ee('0xcd')](_0x17ee('0xdd'))[_0x17ee('0x9b')](),'closedAt':_0x476053[_0x17ee('0xde')]?moment(_0x476053[_0x17ee('0xdf')])[_0x17ee('0xcd')]('YYYY-MM-DD\x20HH:mm:ss')[_0x17ee('0x9b')]():'','disposition':_0x476053[_0x17ee('0xe0')],'messages':_(_0x476053['Messages'])[_0x17ee('0x87')]({'secret':![]})[_0x17ee('0x3a')](function(_0x433074){if(_0x433074['Attachment']){var _0x424174=path['join'](_0x3d379b,_0x433074[_0x17ee('0xd2')]['basename']);if(fs[_0x17ee('0xe1')](_0x424174)){fs['createReadStream'](_0x424174)[_0x17ee('0xe2')](fs['createWriteStream'](path[_0x17ee('0xca')](_0xecdd2,_0x433074['Attachment']['basename'])));}}return{'date':moment(_0x433074[_0x17ee('0x7d')])[_0x17ee('0xcd')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x433074['direction']===_0x17ee('0xe3')?_0x433074[_0x17ee('0xcf')]?_0x433074['User'][_0x17ee('0xdb')]:_0x17ee('0xe4'):_0x433074[_0x17ee('0xe5')][_0x17ee('0xe6')]+(_0x433074['Contact']['lastName']?'\x20'+_0x433074[_0x17ee('0xe5')]['lastName']:''),'body':_0x433074[_0x17ee('0xd2')]?_0x433074['Attachment']['basename']:_0x433074[_0x17ee('0x76')],'direction':_0x433074[_0x17ee('0xe7')]==='out'?'A':'C','secret':_0x433074[_0x17ee('0xd4')],'read':_0x433074[_0x17ee('0x83')],'attachment':_0x433074[_0x17ee('0xd2')]};})[_0x17ee('0x6a')]()};return ejs['renderFile'](path[_0x17ee('0xca')](config['root'],_0x17ee('0xc9'),_0x17ee('0xe8'),'downloadInteraction.ejs'),{'interaction':_0x327e12})['then'](function(_0x43d33b){var _0x46f382=path['join'](_0xecdd2,_0x17ee('0xe9')+_0x476053['id']+'-'+_0x42e8a0+_0x17ee('0xea'));var _0x53c0ff={'path':_0x46f382,'channel':'Whatsapp','interactionId':_0x476053['id']};return pdf[_0x17ee('0xeb')](_0x43d33b,_0x53c0ff);})[_0x17ee('0x2c')](function(){return new BPromise(function(_0x5277d9,_0x2d2ebe){zipdir(_0xecdd2,{'saveTo':_0x4acaeb},function(_0x2d6f75,_0x24a917){if(_0x2d6f75)return _0x2d2ebe(_0x2d6f75);return _0x5277d9(_0x24a917);});})[_0x17ee('0x2c')](function(){return new BPromise(function(_0x4c4d18,_0x3b59c8){rimraf(_0xecdd2,function(_0x564871){if(_0x564871)_0x3b59c8(_0x564871);return _0x4c4d18();});});})[_0x17ee('0x2c')](function(){return _0x3111b5[_0x17ee('0xc6')](_0x4acaeb,_0x111584,function(_0x6e8e96){if(_0x6e8e96){console[_0x17ee('0xec')](_0x17ee('0xed'),_0x6e8e96);}else{fs[_0x17ee('0xee')](_0x4acaeb);}});});});}else{return _0x3111b5[_0x17ee('0x1f')](0xc8);}})[_0x17ee('0x38')](handleError(_0x3111b5,null));}; \ No newline at end of file +var _0x67c7=['MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','find','ContactId','type','text','start','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','body','some','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','tag','filter','replace','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','t.id\x20IN\x20?','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','role','agent','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','c.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','rows','show','params','fields','options','create','destroy','describe','WhatsappMessage','ids','omit','getMessages','hasOwnProperty','pick','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','include','findAll','addTags','setTags','color','emit','whatsappInteractionTags:save','removeTags','unix','root','server','files','tmp','join','fullname','CmContact','Contact','lastName','attachments','Attachment','Messages','secret','WhatsappAccount','Account','Owner','get','mkdirSync','Whatsapp','closed','closedAt','basename','pipe','createWriteStream','out','System','direction','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','end','error','stack','name','send','Users','map','TagIds','Tags','split','push','catch','WhatsappInteraction','rawAttributes','query','keys','filters','intersection','model','attributes','length','nolimit','order','sort','where','field','from','tools_tags','select','u.id','u.fullname','ui.WhatsappInteractionId','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','expr','search','sqlOperator','conditions','unreadMessages','value','having','`\x20>\x200'];(function(_0x1f047e,_0x23b312){var _0x206db5=function(_0xe06955){while(--_0xe06955){_0x1f047e['push'](_0x1f047e['shift']());}};_0x206db5(++_0x23b312);}(_0x67c7,0x172));var _0x767c=function(_0x6aaa69,_0x4457b5){_0x6aaa69=_0x6aaa69-0x0;var _0x25359f=_0x67c7[_0x6aaa69];return _0x25359f;};'use strict';var emlformat=require(_0x767c('0x0'));var rimraf=require(_0x767c('0x1'));var zipdir=require(_0x767c('0x2'));var jsonpatch=require(_0x767c('0x3'));var rp=require(_0x767c('0x4'));var moment=require(_0x767c('0x5'));var BPromise=require(_0x767c('0x6'));var Mustache=require(_0x767c('0x7'));var util=require('util');var path=require(_0x767c('0x8'));var sox=require(_0x767c('0x9'));var csv=require('to-csv');var ejs=require(_0x767c('0xa'));var fs=require('fs');var fs_extra=require(_0x767c('0xb'));var _=require(_0x767c('0xc'));var squel=require(_0x767c('0xd'));var crypto=require(_0x767c('0xe'));var jsforce=require(_0x767c('0xf'));var deskjs=require(_0x767c('0x10'));var toCsv=require(_0x767c('0x11'));var querystring=require(_0x767c('0x12'));var Papa=require(_0x767c('0x13'));var Redis=require(_0x767c('0x14'));var authService=require(_0x767c('0x15'));var qs=require(_0x767c('0x16'));var as=require(_0x767c('0x17'));var pdf=require(_0x767c('0x18'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x767c('0x19'))(_0x767c('0x1a'));var utils=require(_0x767c('0x1b'));var config=require(_0x767c('0x1c'));var licenseUtil=require(_0x767c('0x1d'));var db=require(_0x767c('0x1e'))['db'];config[_0x767c('0x1f')]=_[_0x767c('0x20')](config[_0x767c('0x1f')],{'host':'localhost','port':0x18eb});var socket=require(_0x767c('0x21'))(new Redis(config[_0x767c('0x1f')]));require(_0x767c('0x22'))[_0x767c('0x23')](socket);function respondWithStatusCode(_0x426288,_0xb62440){_0xb62440=_0xb62440||0xcc;return function(_0xcccac7){if(_0xcccac7){return _0x426288[_0x767c('0x24')](_0xb62440);}return _0x426288[_0x767c('0x25')](_0xb62440)['end']();};}function respondWithResult(_0x2266b9,_0x19844b){_0x19844b=_0x19844b||0xc8;return function(_0x3e4927){if(_0x3e4927){return _0x2266b9[_0x767c('0x25')](_0x19844b)[_0x767c('0x26')](_0x3e4927);}};}function respondWithFilteredResult(_0x46dea7,_0x4d612a){return function(_0x38a758){if(_0x38a758){var _0x5856c5=typeof _0x4d612a[_0x767c('0x27')]===_0x767c('0x28')&&typeof _0x4d612a[_0x767c('0x29')]===_0x767c('0x28');var _0x2f9586=_0x38a758[_0x767c('0x2a')];var _0x2c3321=_0x5856c5?0x0:_0x4d612a['offset'];var _0x9edb2d=_0x5856c5?_0x38a758[_0x767c('0x2a')]:_0x4d612a['offset']+_0x4d612a[_0x767c('0x29')];var _0x2ee8f7;if(_0x9edb2d>=_0x2f9586){_0x9edb2d=_0x2f9586;_0x2ee8f7=0xc8;}else{_0x2ee8f7=0xce;}_0x46dea7[_0x767c('0x25')](_0x2ee8f7);return _0x46dea7[_0x767c('0x2b')]('Content-Range',_0x2c3321+'-'+_0x9edb2d+'/'+_0x2f9586)[_0x767c('0x26')](_0x38a758);}return null;};}function patchUpdates(_0x1c174b){return function(_0x1ac8f0){try{jsonpatch[_0x767c('0x2c')](_0x1ac8f0,_0x1c174b,!![]);}catch(_0x27cee2){return BPromise[_0x767c('0x2d')](_0x27cee2);}return _0x1ac8f0[_0x767c('0x2e')]();};}function saveUpdates(_0x368ef0,_0x2f5b57){return function(_0x3a3de1){if(_0x3a3de1){return _0x3a3de1[_0x767c('0x2f')](_0x368ef0)[_0x767c('0x30')](function(_0x1a694b){return _0x1a694b;});}return null;};}function removeEntity(_0x26d750,_0xf8cb90){return function(_0x8b2f22){if(_0x8b2f22){return _0x8b2f22['destroy']()['then'](function(){_0x26d750[_0x767c('0x25')](0xcc)[_0x767c('0x31')]();});}};}function handleEntityNotFound(_0x12fbbb,_0x300598){return function(_0x770ea){if(!_0x770ea){_0x12fbbb['sendStatus'](0x194);}return _0x770ea;};}function handleError(_0x875075,_0xf601c){_0xf601c=_0xf601c||0x1f4;return function(_0x6ec0e){logger[_0x767c('0x32')](_0x6ec0e[_0x767c('0x33')]);if(_0x6ec0e[_0x767c('0x34')]){delete _0x6ec0e[_0x767c('0x34')];}_0x875075[_0x767c('0x25')](_0xf601c)[_0x767c('0x35')](_0x6ec0e);};}function getInteractionUsers(_0x33b831,_0x2268e4){return new BPromise(function(_0x5631ce,_0x1a01eb){try{if(_0x2268e4[_0x33b831['id']]){_0x33b831[_0x767c('0x36')]=_[_0x767c('0x37')](_0x2268e4[_0x33b831['id']],function(_0xbda76c){return{'id':_0xbda76c['id'],'fullname':_0xbda76c['fullname']};});}}catch(_0x30e2f3){_0x1a01eb(_0x30e2f3);}_0x5631ce(_0x33b831);});}function getInteractionTags(_0x3b92fb,_0x36c6de){return new BPromise(function(_0x3c6143,_0x37f3c1){try{if(_0x3b92fb[_0x767c('0x38')]){_0x3b92fb[_0x767c('0x39')]=[];_0x3b92fb[_0x767c('0x38')][_0x767c('0x3a')](',')['forEach'](function(_0x17073f){_0x3b92fb[_0x767c('0x39')][_0x767c('0x3b')](_0x36c6de[_0x17073f]);});}delete _0x3b92fb['TagIds'];}catch(_0xe269e8){_0x37f3c1(_0xe269e8);}_0x3c6143(_0x3b92fb);});}function updateWhatsappInteraction(_0x2376fd,_0x5e5ad1,_0x923a6b){return new BPromise(function(_0x412b0b,_0x3e2c3b){return getInteractionUsers(_0x2376fd,_0x923a6b)[_0x767c('0x30')](function(_0x1f782f){return getInteractionTags(_0x1f782f,_0x5e5ad1);})[_0x767c('0x30')](function(_0x294e80){_0x412b0b(_0x294e80);})[_0x767c('0x3c')](function(_0x2f4832){_0x3e2c3b(_0x2f4832);});});}exports['index']=function(_0x2121ac,_0x75d272){var _0x27e9e7={},_0x385cc3={},_0x4cd040={'count':0x0,'rows':[]};var _0x14f4af=_[_0x767c('0x37')](db[_0x767c('0x3d')][_0x767c('0x3e')],function(_0x4ff871){return{'name':_0x4ff871['fieldName'],'type':_0x4ff871['type']['key']};});_0x385cc3['model']=_['map'](_0x14f4af,_0x767c('0x34'));_0x385cc3[_0x767c('0x3f')]=_[_0x767c('0x40')](_0x2121ac[_0x767c('0x3f')]);_0x385cc3[_0x767c('0x41')]=_[_0x767c('0x42')](_0x385cc3[_0x767c('0x43')],_0x385cc3[_0x767c('0x3f')]);_0x27e9e7[_0x767c('0x44')]=_[_0x767c('0x42')](_0x385cc3[_0x767c('0x43')],qs['fields'](_0x2121ac[_0x767c('0x3f')]['fields']));_0x27e9e7[_0x767c('0x44')]=_0x27e9e7[_0x767c('0x44')][_0x767c('0x45')]?_0x27e9e7[_0x767c('0x44')]:_0x385cc3[_0x767c('0x43')];if(!_0x2121ac['query']['hasOwnProperty'](_0x767c('0x46'))){_0x27e9e7[_0x767c('0x29')]=qs['limit'](_0x2121ac[_0x767c('0x3f')][_0x767c('0x29')]);_0x27e9e7[_0x767c('0x27')]=qs[_0x767c('0x27')](_0x2121ac[_0x767c('0x3f')][_0x767c('0x27')]);}_0x27e9e7[_0x767c('0x47')]=qs[_0x767c('0x48')](_0x2121ac[_0x767c('0x3f')][_0x767c('0x48')]);_0x27e9e7[_0x767c('0x49')]=qs['filters'](_['pick'](_0x2121ac[_0x767c('0x3f')],_0x385cc3[_0x767c('0x41')]),_0x14f4af);var _0x20417d=[];var _0x326ada=squel['select']()['field']('id')['field']('name')[_0x767c('0x4a')]('color')[_0x767c('0x4b')](_0x767c('0x4c'));var _0x354c0b=squel[_0x767c('0x4d')]()['field'](_0x767c('0x4e'))['field'](_0x767c('0x4f'))[_0x767c('0x4a')](_0x767c('0x50'))[_0x767c('0x4b')]('user_has_whatsapp_interactions','ui')[_0x767c('0x51')](_0x767c('0x52'),'u',_0x767c('0x53'));var _0xde82c6=squel[_0x767c('0x4d')]()[_0x767c('0x4b')](_0x767c('0x54'),'i')[_0x767c('0x51')](_0x767c('0x55'),'c',_0x767c('0x56'))[_0x767c('0x51')](_0x767c('0x52'),'o','o.id\x20=\x20i.UserId')['left_join']('whatsapp_accounts','a',_0x767c('0x57'))[_0x767c('0x51')](_0x767c('0x58'),'me',_0x767c('0x59'))[_0x767c('0x51')](_0x767c('0x5a'),'it',_0x767c('0x5b'))[_0x767c('0x51')]('tools_tags','t','t.id\x20=\x20it.TagId');var _0x2f5e27=squel[_0x767c('0x5c')]();var _0x22348d=[];var _0x34a51c=squel[_0x767c('0x5c')]();var _0xc2dc0d;if(_0x2121ac[_0x767c('0x3f')][_0x767c('0x5d')]){_0xc2dc0d=as['parseSearch'](_0x2121ac[_0x767c('0x3f')]['search']);var _0xf6d4ad=_0xc2dc0d[_0x767c('0x5e')];for(var _0x4a6135=0x0;_0x4a6135<_0xc2dc0d['conditions'][_0x767c('0x45')];_0x4a6135++){var _0x521197=_0xc2dc0d[_0x767c('0x5f')][_0x4a6135];var _0x4864cd='i';var _0x10fc47=_['find'](_0x14f4af,[_0x767c('0x34'),_0x521197[_0x767c('0x4a')]]);if(!_0x10fc47){switch(_0x521197[_0x767c('0x4a')]){case _0x767c('0x60'):if(_0x521197[_0x767c('0x61')]==0x1){_0xde82c6[_0x767c('0x62')]('`'+_0x521197[_0x767c('0x4a')]+'`\x20=\x200');}else{_0xde82c6[_0x767c('0x62')]('`'+_0x521197[_0x767c('0x4a')]+_0x767c('0x63'));}break;case'Contact':if(_0x521197['operator']==='$substring'){if(_0x521197[_0x767c('0x61')][_0x767c('0x3a')]('\x20')[_0x767c('0x45')]>0x1){_0x2f5e27[_0xf6d4ad](_0x767c('0x64'),qs['getFullTextValue'](_0x521197[_0x767c('0x61')]),null);}else{var _0x546122='%'+_0x521197[_0x767c('0x61')]+'%';_0x2f5e27[_0xf6d4ad]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x546122,_0x546122,_0x546122);}}else{_0x10fc47=_[_0x767c('0x65')](_0x14f4af,[_0x767c('0x34'),'ContactId']);_0x521197[_0x767c('0x4a')]=_0x767c('0x66');_0x597985=as['buildExpression'](_0x4864cd,_0x10fc47[_0x767c('0x67')],_0x521197);_0x2f5e27[_0xf6d4ad](_0x597985[_0x767c('0x68')],_0x597985['value'][_0x767c('0x69')],_0x597985[_0x767c('0x61')]['end']);}break;case'Tag':var _0x5f3ae4=_0x521197[_0x767c('0x61')]['split'](',')[_0x767c('0x37')](function(_0x3f4c87){return Number(_0x3f4c87);});_0x5f3ae4[_0x767c('0x6a')](function(_0x59f1fc){_0x34a51c['or'](_0x767c('0x6b'),'%,'+_0x59f1fc+',%');});_0x22348d=_[_0x767c('0x6c')](_0x22348d,_0x5f3ae4);break;case _0x767c('0x6d'):if(_0x521197['operator']===_0x767c('0x6e')){_0x2f5e27[_0xf6d4ad](_0x767c('0x6f'),'%'+_0x521197[_0x767c('0x61')]+'%',null);}else{_0x10fc47=_[_0x767c('0x65')](_0x14f4af,[_0x767c('0x34'),_0x767c('0x70')]);_0x521197[_0x767c('0x4a')]=_0x767c('0x70');_0x597985=as[_0x767c('0x71')](_0x4864cd,_0x10fc47['type'],_0x521197);_0x2f5e27[_0xf6d4ad](_0x597985['text'],_0x597985[_0x767c('0x61')]['start'],_0x597985[_0x767c('0x61')][_0x767c('0x31')]);}break;case _0x767c('0x72'):_0x597985=as[_0x767c('0x71')]('me',null,_0x521197);_0x2f5e27[_0xf6d4ad](_0x597985[_0x767c('0x68')],_0x597985[_0x767c('0x61')]['start'],_0x597985[_0x767c('0x61')][_0x767c('0x31')]);break;}}else{var _0x597985=as[_0x767c('0x71')](_0x4864cd,_0x10fc47['type'],_0x521197);_0x2f5e27[_0xf6d4ad](_0x597985['text'],_0x597985['value'][_0x767c('0x69')],_0x597985[_0x767c('0x61')]['end']);}}}else{var _0xb35110=_(_0x2121ac[_0x767c('0x3f')])[_0x767c('0x40')]()['map'](function(_0x3f1fbd){return _[_0x767c('0x73')](_0x14f4af,['name',_0x3f1fbd])?_0x3f1fbd:undefined;})['compact']()[_0x767c('0x61')]();if(!_[_0x767c('0x74')](_0xb35110)){_0xb35110[_0x767c('0x6a')](function(_0x2fa7b9){if(_0x2fa7b9===_0x767c('0x75')){_0xde82c6[_0x767c('0x49')](_0x767c('0x76'),[][_0x767c('0x77')](_0x2121ac[_0x767c('0x3f')][_0x2fa7b9]));}else if(_0x2fa7b9===_0x767c('0x78')){var _0x283d8d=JSON[_0x767c('0x79')](_0x2121ac['query'][_0x2fa7b9])[_0x767c('0x7a')];var _0x3f801d=JSON['parse'](_0x2121ac[_0x767c('0x3f')][_0x2fa7b9])[_0x767c('0x7b')];_0xde82c6['where'](_0x767c('0x7c'),_0x283d8d,_0x3f801d);}else{if(_0x2121ac[_0x767c('0x3f')][_0x2fa7b9]===_0x767c('0x7d')){_0xde82c6['where']('i.'+_0x2fa7b9+_0x767c('0x7e'));}else{_0xde82c6[_0x767c('0x49')]('i.'+_0x2fa7b9+'\x20=\x20?',_0x2121ac[_0x767c('0x3f')][_0x2fa7b9]);}}});}if(_0x2121ac['query'][_0x767c('0x7f')]){if(_0x2121ac['query'][_0x767c('0x7f')]==0x1){_0xde82c6[_0x767c('0x62')](_0x767c('0x80'));}else{_0xde82c6['having']('`unreadMessages`\x20>\x200');}}if(_0x2121ac['query'][_0x767c('0x81')]){_0x22348d=_['isArray'](_0x2121ac['query']['tag'])?_0x2121ac[_0x767c('0x3f')]['tag']:new Array(_0x2121ac[_0x767c('0x3f')]['tag']);_0x22348d['forEach'](function(_0x5a26a5){_0x34a51c['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5a26a5+',%');});}if(_0x2121ac['query'][_0x767c('0x82')]){var _0x536bd5=_0x2121ac[_0x767c('0x3f')][_0x767c('0x82')]['replace']('\x5c','\x5c\x5c')[_0x767c('0x83')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x536bd5)){_0x2f5e27['or']('i.id\x20LIKE\x20?',_0x536bd5+'%')['or'](_0x767c('0x84'),_0x536bd5+'%');}else{_0x2f5e27['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x536bd5))['or'](_0x767c('0x85'),_0x536bd5+'%');}}}_0xde82c6[_0x767c('0x49')](_0x2f5e27);_0xde82c6[_0x767c('0x86')]('i.id');var _0x50f3af={'type':db[_0x767c('0x87')][_0x767c('0x88')][_0x767c('0x89')],'raw':!![]};var _0x323f99=_0xde82c6[_0x767c('0x8a')]();_0x323f99[_0x767c('0x4a')]('i.id');_0x323f99['field'](_0x767c('0x8b'),_0x767c('0x60'));if(_0x27e9e7[_0x767c('0x47')]){_0x27e9e7[_0x767c('0x47')][_0x767c('0x6a')](function(_0x7acabe){var _0x1cb426=_0x7acabe[0x0]==='contactName'?_0x7acabe[0x0]:'i.'+_0x7acabe[0x0];_0xde82c6[_0x767c('0x47')](_0x1cb426,_0x7acabe[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x22348d)){_0xde82c6['having'](_0x34a51c);_0x323f99['where'](_0x767c('0x8c'),_0x22348d);}BPromise['resolve']()[_0x767c('0x30')](function(){if(!_0xc2dc0d){if(_0x2121ac[_0x767c('0x3f')][_0x767c('0x75')])return;_0x323f99[_0x767c('0x49')](_0x767c('0x8d'));_0xde82c6[_0x767c('0x49')](_0x767c('0x8d'));return;}if(_0x2121ac['user']['role']!=='agent')return;return _0x2121ac[_0x767c('0x8e')][_0x767c('0x8f')]({'attributes':['id'],'raw':!![]})[_0x767c('0x30')](function(_0x496b8e){if(_['isEmpty'](_0x496b8e)){_0x323f99[_0x767c('0x49')]('i.WhatsappAccountId\x20IS\x20NULL');_0xde82c6['where'](_0x767c('0x90'));}else{_0x323f99[_0x767c('0x49')](_0x767c('0x76'),_[_0x767c('0x37')](_0x496b8e,'id'));_0xde82c6[_0x767c('0x49')](_0x767c('0x76'),_['map'](_0x496b8e,'id'));}});})['then'](function(){if(_0x2121ac['user'][_0x767c('0x91')]===_0x767c('0x92')&&!_0xc2dc0d&&!_0x2121ac['query'][_0x767c('0x75')])return[];return db[_0x767c('0x93')]['query'](_0x323f99[_0x767c('0x94')](),_0x50f3af);})[_0x767c('0x30')](function(_0x55be62){_0x4cd040[_0x767c('0x2a')]=_0x55be62[_0x767c('0x45')];if(_0x4cd040['count']===0x0)return[];return db[_0x767c('0x93')][_0x767c('0x3f')](_0x326ada[_0x767c('0x94')](),_0x50f3af)[_0x767c('0x30')](function(_0x56b62e){_0x20417d=_[_0x767c('0x95')](_0x56b62e,'id');_0x50f3af=_[_0x767c('0x96')](_0x50f3af,{'model':db[_0x767c('0x3d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2121ac['query']['fields']){_0x27e9e7[_0x767c('0x44')]['forEach'](function(_0x498192){_0xde82c6[_0x767c('0x4a')]('i.'+_0x498192);});}else{_0xde82c6['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x767c('0x60'));_0xde82c6[_0x767c('0x4a')](_0x767c('0x97'),_0x767c('0x98'));_0xde82c6[_0x767c('0x4a')](_0x767c('0x99'),_0x767c('0x9a'));_0xde82c6[_0x767c('0x4a')](_0x767c('0x9b'),_0x767c('0x9c'));_0xde82c6[_0x767c('0x4a')]('i.*');_0xde82c6[_0x767c('0x4a')](_0x767c('0x9d'),'Contact.firstName');_0xde82c6[_0x767c('0x4a')](_0x767c('0x9e'),_0x767c('0x9f'));_0xde82c6[_0x767c('0x4a')]('c.email',_0x767c('0xa0'));_0xde82c6[_0x767c('0x4a')](_0x767c('0xa1'),_0x767c('0xa2'));_0xde82c6[_0x767c('0x4a')]('c.mobile',_0x767c('0xa3'));_0xde82c6[_0x767c('0x4a')]('c.fax',_0x767c('0xa4'));_0xde82c6[_0x767c('0x4a')](_0x767c('0xa5'),_0x767c('0xa6'));_0xde82c6[_0x767c('0x4a')](_0x767c('0xa7'),'Owner.internal');_0xde82c6['field'](_0x767c('0xa8'),_0x767c('0x38'));}if(_0x27e9e7[_0x767c('0x29')])_0xde82c6['limit'](_0x27e9e7[_0x767c('0x29')]);if(_0x27e9e7[_0x767c('0x27')])_0xde82c6[_0x767c('0x27')](_0x27e9e7[_0x767c('0x27')]);return db[_0x767c('0x93')][_0x767c('0x3f')](_0xde82c6['toString'](),_0x50f3af);})[_0x767c('0x30')](function(_0xe8e31c){if(_0xe8e31c[_0x767c('0x45')]>0x0)_0x354c0b['where'](_0x767c('0xa9'),_[_0x767c('0x37')](_0xe8e31c,'id'));return db[_0x767c('0x93')]['query'](_0x354c0b[_0x767c('0x94')](),_0x50f3af)['then'](function(_0x2d7366){var _0x53175a=_[_0x767c('0xaa')](_0x2d7366,_0x767c('0xab'));var _0x14c78f=[];_0xe8e31c[_0x767c('0x6a')](function(_0x297115){_0x14c78f[_0x767c('0x3b')](updateWhatsappInteraction(_0x297115,_0x20417d,_0x53175a));});return BPromise[_0x767c('0xac')](_0x14c78f);});});})['then'](function(_0x54bcd2){_0x4cd040[_0x767c('0xad')]=_0x54bcd2;return _0x4cd040;})[_0x767c('0x30')](respondWithFilteredResult(_0x75d272,_0x27e9e7))[_0x767c('0x3c')](handleError(_0x75d272,null));};exports[_0x767c('0xae')]=function(_0x2fd839,_0x290e94){var _0x22de13={'raw':![],'where':{'id':_0x2fd839[_0x767c('0xaf')]['id']}},_0x542450={};_0x542450['model']=_[_0x767c('0x40')](db[_0x767c('0x3d')][_0x767c('0x3e')]);_0x542450['query']=_[_0x767c('0x40')](_0x2fd839[_0x767c('0x3f')]);_0x542450[_0x767c('0x41')]=_[_0x767c('0x42')](_0x542450[_0x767c('0x43')],_0x542450[_0x767c('0x3f')]);_0x22de13[_0x767c('0x44')]=_[_0x767c('0x42')](_0x542450['model'],qs[_0x767c('0xb0')](_0x2fd839[_0x767c('0x3f')][_0x767c('0xb0')]));_0x22de13[_0x767c('0x44')]=_0x22de13[_0x767c('0x44')][_0x767c('0x45')]?_0x22de13[_0x767c('0x44')]:_0x542450[_0x767c('0x43')];if(_0x2fd839[_0x767c('0x3f')]['includeAll']){_0x22de13['include']=[{'all':!![]}];}_0x22de13=_[_0x767c('0x96')]({},_0x22de13,_0x2fd839[_0x767c('0xb1')]);return db[_0x767c('0x3d')][_0x767c('0x65')](_0x22de13)[_0x767c('0x30')](handleEntityNotFound(_0x290e94,null))[_0x767c('0x30')](respondWithResult(_0x290e94,null))[_0x767c('0x3c')](handleError(_0x290e94,null));};exports[_0x767c('0xb2')]=function(_0x2d0e0e,_0x558726){return db[_0x767c('0x3d')][_0x767c('0xb2')](_0x2d0e0e[_0x767c('0x72')],{})[_0x767c('0x30')](respondWithResult(_0x558726,0xc9))[_0x767c('0x3c')](handleError(_0x558726,null));};exports[_0x767c('0x2f')]=function(_0x22ea42,_0x2f2bdc){if(_0x22ea42[_0x767c('0x72')]['id']){delete _0x22ea42['body']['id'];}return db[_0x767c('0x3d')][_0x767c('0x65')]({'where':{'id':_0x22ea42['params']['id']}})[_0x767c('0x30')](handleEntityNotFound(_0x2f2bdc,null))[_0x767c('0x30')](saveUpdates(_0x22ea42[_0x767c('0x72')],null))['then'](respondWithResult(_0x2f2bdc,null))[_0x767c('0x3c')](handleError(_0x2f2bdc,null));};exports[_0x767c('0xb3')]=function(_0x2d25cb,_0x2c7661){return db['WhatsappInteraction'][_0x767c('0x65')]({'where':{'id':_0x2d25cb[_0x767c('0xaf')]['id']}})['then'](handleEntityNotFound(_0x2c7661,null))[_0x767c('0x30')](removeEntity(_0x2c7661,null))[_0x767c('0x3c')](handleError(_0x2c7661,null));};exports['describe']=function(_0x5d09d6,_0x454bca){return db[_0x767c('0x3d')][_0x767c('0xb4')]()[_0x767c('0x30')](respondWithResult(_0x454bca,null))[_0x767c('0x3c')](handleError(_0x454bca,null));};exports['addMessage']=function(_0x4ca4e1,_0x406a4c,_0x2e06f2){return db[_0x767c('0xb5')][_0x767c('0x65')]({'where':{'id':_0x4ca4e1['params']['id']}})[_0x767c('0x30')](handleEntityNotFound(_0x406a4c,null))[_0x767c('0x30')](function(_0x278291){if(_0x278291){return _0x278291['addMessage'](_0x4ca4e1[_0x767c('0x72')][_0x767c('0xb6')],_[_0x767c('0xb7')](_0x4ca4e1[_0x767c('0x72')],['ids','id'])||{});}})[_0x767c('0x30')](respondWithResult(_0x406a4c,null))[_0x767c('0x3c')](handleError(_0x406a4c,null));};exports[_0x767c('0xb8')]=function(_0x596bed,_0x329ae5,_0x230f09){var _0x9db634={'raw':![],'where':{}};var _0x2ac62f={};var _0x4817b3={'count':0x0,'rows':[]};return db['WhatsappInteraction']['findOne']({'where':{'id':_0x596bed['params']['id']}})[_0x767c('0x30')](handleEntityNotFound(_0x329ae5,null))['then'](function(_0x5dc2a8){if(_0x5dc2a8){_0x2ac62f[_0x767c('0x43')]=_[_0x767c('0x40')](db[_0x767c('0xb5')][_0x767c('0x3e')]);_0x2ac62f[_0x767c('0x3f')]=_[_0x767c('0x40')](_0x596bed[_0x767c('0x3f')]);_0x2ac62f[_0x767c('0x41')]=_[_0x767c('0x42')](_0x2ac62f[_0x767c('0x43')],_0x2ac62f['query']);_0x9db634[_0x767c('0x44')]=_[_0x767c('0x42')](_0x2ac62f[_0x767c('0x43')],qs[_0x767c('0xb0')](_0x596bed[_0x767c('0x3f')][_0x767c('0xb0')]));_0x9db634['attributes']=_0x9db634[_0x767c('0x44')][_0x767c('0x45')]?_0x9db634[_0x767c('0x44')]:_0x2ac62f[_0x767c('0x43')];if(!_0x596bed[_0x767c('0x3f')][_0x767c('0xb9')]('nolimit')){_0x9db634['limit']=qs[_0x767c('0x29')](_0x596bed[_0x767c('0x3f')]['limit']);_0x9db634[_0x767c('0x27')]=qs[_0x767c('0x27')](_0x596bed[_0x767c('0x3f')][_0x767c('0x27')]);}_0x9db634[_0x767c('0x47')]=qs[_0x767c('0x48')](_0x596bed[_0x767c('0x3f')]['sort']);_0x9db634['where']=qs['filters'](_[_0x767c('0xba')](_0x596bed[_0x767c('0x3f')],_0x2ac62f[_0x767c('0x41')]));_0x9db634[_0x767c('0x49')]['WhatsappInteractionId']=_0x5dc2a8['id'];if(_0x596bed['query'][_0x767c('0x82')]){_0x9db634[_0x767c('0x49')]=_['merge'](_0x9db634[_0x767c('0x49')],{'$or':_['map'](_0x9db634[_0x767c('0x44')],function(_0x2766d3){var _0x2353c9={};_0x2353c9[_0x2766d3]={'$like':'%'+_0x596bed[_0x767c('0x3f')][_0x767c('0x82')]+'%'};return _0x2353c9;})});}if(_0x596bed['query'][_0x767c('0x7a')]){var _0x66e572=_0x596bed[_0x767c('0x3f')][_0x767c('0x7a')][_0x767c('0x3a')](',');var _0x56e220={};_0x56e220[_0x66e572[0x0]]={'$gte':moment(_0x66e572[0x1])[_0x767c('0xbb')](_0x767c('0xbc'))};_0x9db634[_0x767c('0x49')]=_[_0x767c('0x96')](_0x9db634[_0x767c('0x49')],_0x56e220);}_0x9db634=_[_0x767c('0x96')]({},_0x9db634,_0x596bed['options']);return db[_0x767c('0xb5')]['count']({'where':_0x9db634[_0x767c('0x49')]})[_0x767c('0x30')](function(_0x162c90){_0x4817b3['count']=_0x162c90;if(_0x596bed[_0x767c('0x3f')][_0x767c('0xbd')]){_0x9db634[_0x767c('0xbe')]=[{'all':!![]}];}return db[_0x767c('0xb5')][_0x767c('0xbf')](_0x9db634);})[_0x767c('0x30')](function(_0x45a5bb){_0x4817b3[_0x767c('0xad')]=_0x45a5bb;return _0x4817b3;});}})[_0x767c('0x30')](respondWithFilteredResult(_0x329ae5,_0x9db634))['catch'](handleError(_0x329ae5,null));};exports[_0x767c('0xc0')]=function(_0x3b994f,_0x5de0e1,_0x59d41b){return db['WhatsappInteraction'][_0x767c('0x65')]({'where':{'id':_0x3b994f['params']['id']}})['then'](handleEntityNotFound(_0x5de0e1,null))[_0x767c('0x30')](function(_0xe6698d){if(_0xe6698d){return _0xe6698d[_0x767c('0xc1')](_0x3b994f[_0x767c('0x72')][_0x767c('0xb6')],_[_0x767c('0xb7')](_0x3b994f[_0x767c('0x72')],[_0x767c('0xb6'),'id'])||{})['spread'](function(){return db['Tag']['findAll']({'attributes':['id',_0x767c('0x34'),_0x767c('0xc2')],'where':{'id':_0x3b994f[_0x767c('0x72')][_0x767c('0xb6')]}});})[_0x767c('0x30')](function(_0x19a0d9){socket[_0x767c('0xc3')](_0x767c('0xc4'),{'id':Number(_0x3b994f[_0x767c('0xaf')]['id']),'tags':_0x19a0d9||[]});return{'id':Number(_0x3b994f[_0x767c('0xaf')]['id']),'tags':_0x19a0d9||[]};});}})[_0x767c('0x30')](respondWithResult(_0x5de0e1,null))['catch'](handleError(_0x5de0e1,null));};exports[_0x767c('0xc5')]=function(_0x544df2,_0x30471f,_0x19fb59){return db['WhatsappInteraction']['find']({'where':{'id':_0x544df2[_0x767c('0xaf')]['id']}})[_0x767c('0x30')](handleEntityNotFound(_0x30471f,null))[_0x767c('0x30')](function(_0x2cb7f8){if(_0x2cb7f8){return _0x2cb7f8['removeTags'](_0x544df2[_0x767c('0x3f')][_0x767c('0xb6')]);}})[_0x767c('0x30')](respondWithStatusCode(_0x30471f,null))[_0x767c('0x3c')](handleError(_0x30471f,null));};exports['download']=function(_0x11df62,_0x443c30){var _0x864405=moment()[_0x767c('0xc6')]()[_0x767c('0x94')]();var _0x3bac37=path['join'](config[_0x767c('0xc7')],_0x767c('0xc8'),_0x767c('0xc9'),_0x767c('0xca'));var _0x438b87=path[_0x767c('0xcb')](config[_0x767c('0xc7')],_0x767c('0xc8'),_0x767c('0xc9'),'attachments');var _0x343bc3=path['join'](_0x3bac37,_0x864405);var _0x31dda6=util[_0x767c('0xbb')]('transcript-%d-%s.zip',_0x11df62['params']['id'],_0x864405);var _0x2497f7=path[_0x767c('0xcb')](_0x3bac37,_0x31dda6);var _0x5229d6=[];_0x5229d6[_0x767c('0x3b')]({'model':db[_0x767c('0x6d')],'as':_0x767c('0x6d'),'attributes':['id',_0x767c('0xcc')],'raw':!![]});_0x5229d6['push']({'model':db[_0x767c('0xcd')],'as':_0x767c('0xce'),'attributes':['id','firstName',_0x767c('0xcf')],'raw':!![]});if(_0x11df62[_0x767c('0x3f')][_0x767c('0xd0')]){_0x5229d6[_0x767c('0x3b')]({'model':db[_0x767c('0xd1')],'as':'Attachment','raw':!![]});}var _0x33f196=[{'model':db['WhatsappMessage'],'as':_0x767c('0xd2'),'attributes':['id','body',_0x767c('0x78'),'direction',_0x767c('0xd3'),_0x767c('0x7f')],'include':_0x5229d6}];_0x33f196[_0x767c('0x3b')]({'model':db[_0x767c('0xd4')],'as':_0x767c('0xd5'),'attributes':['id',_0x767c('0x34')]});_0x33f196['push']({'model':db[_0x767c('0x6d')],'as':_0x767c('0xd6'),'attributes':['id','fullname']});return db[_0x767c('0x3d')]['find']({'where':{'id':_0x11df62[_0x767c('0xaf')]['id']},'include':_0x33f196})['then'](handleEntityNotFound(_0x443c30,null))[_0x767c('0x30')](function(_0x18db7e){if(_0x18db7e){var _0x4ecd1c=_0x18db7e[_0x767c('0xd7')]({'plain':!![]});fs[_0x767c('0xd8')](_0x343bc3);var _0x4c3fb7={'channel':_0x767c('0xd9'),'account':_0x4ecd1c[_0x767c('0xd5')][_0x767c('0x34')],'agent':_0x4ecd1c[_0x767c('0xd6')]?_0x4ecd1c['Owner'][_0x767c('0xcc')]:'N.A.','createdAt':moment(_0x4ecd1c[_0x767c('0x78')])[_0x767c('0xbb')]('YYYY-MM-DD\x20HH:mm:ss')[_0x767c('0x94')](),'closedAt':_0x4ecd1c[_0x767c('0xda')]?moment(_0x4ecd1c[_0x767c('0xdb')])['format'](_0x767c('0xbc'))[_0x767c('0x94')]():'','disposition':_0x4ecd1c['disposition'],'messages':_(_0x4ecd1c[_0x767c('0xd2')])['filter']({'secret':![]})[_0x767c('0x37')](function(_0x1eee86){if(_0x1eee86['Attachment']){var _0x2fd84c=path[_0x767c('0xcb')](_0x438b87,_0x1eee86[_0x767c('0xd1')][_0x767c('0xdc')]);if(fs['existsSync'](_0x2fd84c)){fs['createReadStream'](_0x2fd84c)[_0x767c('0xdd')](fs[_0x767c('0xde')](path['join'](_0x343bc3,_0x1eee86[_0x767c('0xd1')][_0x767c('0xdc')])));}}return{'date':moment(_0x1eee86['createdAt'])[_0x767c('0xbb')](_0x767c('0xbc'))[_0x767c('0x94')](),'sender':_0x1eee86['direction']===_0x767c('0xdf')?_0x1eee86[_0x767c('0x6d')]?_0x1eee86['User'][_0x767c('0xcc')]:_0x767c('0xe0'):_0x1eee86['Contact']['firstName']+(_0x1eee86[_0x767c('0xce')][_0x767c('0xcf')]?'\x20'+_0x1eee86['Contact'][_0x767c('0xcf')]:''),'body':_0x1eee86[_0x767c('0xd1')]?_0x1eee86[_0x767c('0xd1')][_0x767c('0xdc')]:_0x1eee86[_0x767c('0x72')],'direction':_0x1eee86[_0x767c('0xe1')]===_0x767c('0xdf')?'A':'C','secret':_0x1eee86[_0x767c('0xd3')],'read':_0x1eee86[_0x767c('0x7f')],'attachment':_0x1eee86[_0x767c('0xd1')]};})['value']()};return ejs[_0x767c('0xe2')](path[_0x767c('0xcb')](config[_0x767c('0xc7')],'server',_0x767c('0xe3'),_0x767c('0xe4')),{'interaction':_0x4c3fb7})[_0x767c('0x30')](function(_0x151107){var _0x34227b=path[_0x767c('0xcb')](_0x343bc3,_0x767c('0xe5')+_0x4ecd1c['id']+'-'+_0x864405+_0x767c('0xe6'));var _0x37b400={'path':_0x34227b,'channel':_0x767c('0xd9'),'interactionId':_0x4ecd1c['id']};return pdf[_0x767c('0xe7')](_0x151107,_0x37b400);})[_0x767c('0x30')](function(){return new BPromise(function(_0x2549ad,_0x367551){zipdir(_0x343bc3,{'saveTo':_0x2497f7},function(_0x202551,_0x374044){if(_0x202551)return _0x367551(_0x202551);return _0x2549ad(_0x374044);});})[_0x767c('0x30')](function(){return new BPromise(function(_0x334a0d,_0x2dd3dd){rimraf(_0x343bc3,function(_0x208b7e){if(_0x208b7e)_0x2dd3dd(_0x208b7e);return _0x334a0d();});});})[_0x767c('0x30')](function(){return _0x443c30['download'](_0x2497f7,_0x31dda6,function(_0x46f186){if(_0x46f186){console[_0x767c('0xe8')](_0x767c('0xe9'),_0x46f186);}else{fs[_0x767c('0xea')](_0x2497f7);}});});});}else{return _0x443c30[_0x767c('0x24')](0xc8);}})[_0x767c('0x3c')](handleError(_0x443c30,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 60df650..1f72cfa 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 _0xa788=['catch','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction','setMaxListeners','save','remove','getUsers','then','Users','findAll','setDataValue','unreadMessages','length','emit'];(function(_0x516e3c,_0x589b74){var _0x14d474=function(_0x1d6ab5){while(--_0x1d6ab5){_0x516e3c['push'](_0x516e3c['shift']());}};_0x14d474(++_0x589b74);}(_0xa788,0x70));var _0x8a78=function(_0x32c473,_0x3ac5aa){_0x32c473=_0x32c473-0x0;var _0x3a7b40=_0xa788[_0x32c473];return _0x3a7b40;};'use strict';var EventEmitter=require(_0x8a78('0x0'));var WhatsappInteraction=require(_0x8a78('0x1'))['db'][_0x8a78('0x2')];var WhatsappMessage=require(_0x8a78('0x1'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x8a78('0x3')](0x0);var events={'afterCreate':_0x8a78('0x4'),'afterUpdate':'update','afterDestroy':_0x8a78('0x5')};function emitEvent(_0x12ce72){return function(_0x5af5af,_0x47be20,_0x506edf){_0x5af5af[_0x8a78('0x6')]({'attributes':['id'],'raw':!![]})[_0x8a78('0x7')](function(_0x539774){_0x5af5af['setDataValue'](_0x8a78('0x8'),_0x539774['map'](function(_0x5e655c){return{'id':_0x5e655c['id']};}));return WhatsappMessage[_0x8a78('0x9')]({'where':{'WhatsappInteractionId':_0x5af5af['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8a78('0x7')](function(_0x4e2918){_0x5af5af[_0x8a78('0xa')](_0x8a78('0xb'),_0x4e2918[_0x8a78('0xc')]);WhatsappInteractionEvents[_0x8a78('0xd')](_0x12ce72+':'+_0x5af5af['id'],_0x5af5af);WhatsappInteractionEvents[_0x8a78('0xd')](_0x12ce72,_0x5af5af);_0x506edf(null);})[_0x8a78('0xe')](_0x506edf(null));};}for(var e in events){if(events[_0x8a78('0xf')](e)){var event=events[e];WhatsappInteraction[_0x8a78('0x10')](e,emitEvent(event));}}module[_0x8a78('0x11')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x847d=['setDataValue','Users','map','findAll','then','emit','catch','exports','../../mysqldb','WhatsappInteraction','setMaxListeners','update','remove','getUsers'];(function(_0x3ab353,_0x5d5283){var _0x1e2285=function(_0x55804f){while(--_0x55804f){_0x3ab353['push'](_0x3ab353['shift']());}};_0x1e2285(++_0x5d5283);}(_0x847d,0x14a));var _0xd847=function(_0x2085f3,_0x50105b){_0x2085f3=_0x2085f3-0x0;var _0x384e3c=_0x847d[_0x2085f3];return _0x384e3c;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0xd847('0x0'))['db'][_0xd847('0x1')];var WhatsappMessage=require(_0xd847('0x0'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xd847('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd847('0x3'),'afterDestroy':_0xd847('0x4')};function emitEvent(_0x5258c0){return function(_0x2256b9,_0x363b99,_0x375a88){_0x2256b9[_0xd847('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x20dbfd){_0x2256b9[_0xd847('0x6')](_0xd847('0x7'),_0x20dbfd[_0xd847('0x8')](function(_0x1ab96d){return{'id':_0x1ab96d['id']};}));return WhatsappMessage[_0xd847('0x9')]({'where':{'WhatsappInteractionId':_0x2256b9['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd847('0xa')](function(_0x5a9998){_0x2256b9['setDataValue']('unreadMessages',_0x5a9998['length']);WhatsappInteractionEvents[_0xd847('0xb')](_0x5258c0+':'+_0x2256b9['id'],_0x2256b9);WhatsappInteractionEvents[_0xd847('0xb')](_0x5258c0,_0x2256b9);_0x375a88(null);})[_0xd847('0xc')](_0x375a88(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0xd847('0xd')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 9811324..ab09111 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 _0xc8f7=['./whatsappInteraction.attributes','define','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0xf26f0d,_0x1671e9){var _0x2ab3c4=function(_0x172fe0){while(--_0x172fe0){_0xf26f0d['push'](_0xf26f0d['shift']());}};_0x2ab3c4(++_0x1671e9);}(_0xc8f7,0x99));var _0x7c8f=function(_0x5cbd7b,_0x207439){_0x5cbd7b=_0x5cbd7b-0x0;var _0x3fdfb8=_0xc8f7[_0x5cbd7b];return _0x3fdfb8;};'use strict';var _=require(_0x7c8f('0x0'));var util=require(_0x7c8f('0x1'));var logger=require(_0x7c8f('0x2'))(_0x7c8f('0x3'));var moment=require(_0x7c8f('0x4'));var BPromise=require('bluebird');var rp=require(_0x7c8f('0x5'));var fs=require('fs');var path=require(_0x7c8f('0x6'));var rimraf=require(_0x7c8f('0x7'));var config=require(_0x7c8f('0x8'));var attributes=require(_0x7c8f('0x9'));module['exports']=function(_0x5c917e,_0x48dc49){return _0x5c917e[_0x7c8f('0xa')](_0x7c8f('0xb'),attributes,{'tableName':_0x7c8f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4fb01c,_0x43952f,_0x22c377){if(_0x4fb01c[_0x7c8f('0xd')](_0x7c8f('0xe'))){_0x4fb01c[_0x7c8f('0xf')]=moment()[_0x7c8f('0x10')](_0x7c8f('0x11'));}_0x22c377(null,_0x4fb01c);}}});}; \ No newline at end of file +var _0xc392=['closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','util','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','WhatsappInteraction','changed'];(function(_0x5e32f3,_0x3386c1){var _0x4d4e03=function(_0xe86f5){while(--_0xe86f5){_0x5e32f3['push'](_0x5e32f3['shift']());}};_0x4d4e03(++_0x3386c1);}(_0xc392,0x13b));var _0x2c39=function(_0x3de834,_0x44fc01){_0x3de834=_0x3de834-0x0;var _0x4d6ee3=_0xc392[_0x3de834];return _0x4d6ee3;};'use strict';var _=require('lodash');var util=require(_0x2c39('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x2c39('0x1'));var rp=require(_0x2c39('0x2'));var fs=require('fs');var path=require(_0x2c39('0x3'));var rimraf=require(_0x2c39('0x4'));var config=require(_0x2c39('0x5'));var attributes=require(_0x2c39('0x6'));module[_0x2c39('0x7')]=function(_0x519bf8,_0x3901b1){return _0x519bf8['define'](_0x2c39('0x8'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x45c56f,_0x19dd38,_0x27b89c){if(_0x45c56f[_0x2c39('0x9')](_0x2c39('0xa'))){_0x45c56f[_0x2c39('0xb')]=moment()['format'](_0x2c39('0xc'));}_0x27b89c(null,_0x45c56f);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 04bc9e9..47eaf77 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 _0x90c8=['options','raw','where','attributes','limit','debug','find','addTags','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x90c8,0x69));var _0x890c=function(_0x2ed8f3,_0x4aa12f){_0x2ed8f3=_0x2ed8f3-0x0;var _0x525a55=_0x90c8[_0x2ed8f3];return _0x525a55;};'use strict';var _=require(_0x890c('0x0'));var util=require(_0x890c('0x1'));var moment=require(_0x890c('0x2'));var BPromise=require(_0x890c('0x3'));var rs=require(_0x890c('0x4'));var fs=require('fs');var Redis=require(_0x890c('0x5'));var db=require(_0x890c('0x6'))['db'];var utils=require(_0x890c('0x7'));var logger=require(_0x890c('0x8'))(_0x890c('0x9'));var config=require(_0x890c('0xa'));var jayson=require(_0x890c('0xb'));var client=jayson['client'][_0x890c('0xc')]({'port':0x232a});config[_0x890c('0xd')]=_[_0x890c('0xe')](config[_0x890c('0xd')],{'host':_0x890c('0xf'),'port':0x18eb});var socket=require(_0x890c('0x10'))(new Redis(config[_0x890c('0xd')]));require(_0x890c('0x11'))[_0x890c('0x12')](socket);function respondWithRpcPromise(_0x322640,_0x571455,_0x530779){return new BPromise(function(_0x793d04,_0x7f638e){return client[_0x890c('0x13')](_0x322640,_0x530779)[_0x890c('0x14')](function(_0x3bbcc8){logger[_0x890c('0x15')](_0x890c('0x16'),_0x571455,_0x890c('0x17'));logger['debug']('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x571455,_0x890c('0x17'),JSON[_0x890c('0x18')](_0x3bbcc8));if(_0x3bbcc8[_0x890c('0x19')]){if(_0x3bbcc8[_0x890c('0x19')][_0x890c('0x1a')]===0x1f4){logger[_0x890c('0x19')](_0x890c('0x16'),_0x571455,_0x3bbcc8[_0x890c('0x19')][_0x890c('0x1b')]);return _0x7f638e(_0x3bbcc8[_0x890c('0x19')][_0x890c('0x1b')]);}logger[_0x890c('0x19')]('WhatsappInteraction,\x20%s,\x20%s',_0x571455,_0x3bbcc8['error'][_0x890c('0x1b')]);return _0x793d04(_0x3bbcc8['error']['message']);}else{logger[_0x890c('0x15')](_0x890c('0x16'),_0x571455,_0x890c('0x17'));_0x793d04(_0x3bbcc8[_0x890c('0x1c')][_0x890c('0x1b')]);}})[_0x890c('0x1d')](function(_0x52966b){logger[_0x890c('0x19')](_0x890c('0x16'),_0x571455,_0x52966b);_0x7f638e(_0x52966b);});});}exports[_0x890c('0x1e')]=function(_0x293703){var _0x363424=this;return new Promise(function(_0x488211,_0x3c38b7){return db[_0x890c('0x1f')][_0x890c('0x20')](_0x293703['body'],{'raw':_0x293703[_0x890c('0x21')]?_0x293703[_0x890c('0x21')][_0x890c('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x293703['options']?_0x293703['options'][_0x890c('0x23')]||null:null,'attributes':_0x293703['options']?_0x293703[_0x890c('0x21')][_0x890c('0x24')]||null:null,'limit':_0x293703[_0x890c('0x21')]?_0x293703[_0x890c('0x21')][_0x890c('0x25')]||null:null})[_0x890c('0x14')](function(_0x249c79){logger[_0x890c('0x15')](_0x890c('0x1e'),_0x293703);logger[_0x890c('0x26')](_0x890c('0x1e'),_0x293703,JSON[_0x890c('0x18')](_0x249c79));_0x488211(_0x249c79);})[_0x890c('0x1d')](function(_0x4d803c){logger[_0x890c('0x19')]('UpdateWhatsappInteraction',_0x4d803c[_0x890c('0x1b')],_0x293703);_0x3c38b7(_0x363424['error'](0x1f4,_0x4d803c[_0x890c('0x1b')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x112271){return new Promise(function(_0x5e049f,_0xcf5276){return db[_0x890c('0x1f')][_0x890c('0x27')]({'where':_0x112271[_0x890c('0x21')]?_0x112271[_0x890c('0x21')][_0x890c('0x23')]||null:null})[_0x890c('0x14')](function(_0x313db0){if(_0x313db0){return _0x313db0[_0x890c('0x28')](_0x112271[_0x890c('0x29')][_0x890c('0x2a')],_[_0x890c('0x2b')](_0x112271['body'],[_0x890c('0x2a'),'id'])||{});}})[_0x890c('0x2c')](function(_0x11ffdc){logger[_0x890c('0x15')]('AddTags',_0x112271);logger[_0x890c('0x26')](_0x890c('0x2d'),_0x112271,JSON[_0x890c('0x18')](_0x11ffdc));_0x5e049f(_0x11ffdc);})['catch'](function(_0x299440){logger[_0x890c('0x19')]('AddTags',_0x299440[_0x890c('0x1b')],_0x112271);_0xcf5276(_this[_0x890c('0x19')](0x1f4,_0x299440[_0x890c('0x1b')]));});});}; \ No newline at end of file +var _0x9721=['register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','limit','AddTagsToWhatsappInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','redis','localhost','./whatsappInteraction.socket'];(function(_0x5f3796,_0x5f5d3b){var _0x8d009b=function(_0x359181){while(--_0x359181){_0x5f3796['push'](_0x5f3796['shift']());}};_0x8d009b(++_0x5f5d3b);}(_0x9721,0x71));var _0x1972=function(_0x41630e,_0x453d18){_0x41630e=_0x41630e-0x0;var _0x4d104c=_0x9721[_0x41630e];return _0x4d104c;};'use strict';var _=require(_0x1972('0x0'));var util=require(_0x1972('0x1'));var moment=require(_0x1972('0x2'));var BPromise=require(_0x1972('0x3'));var rs=require(_0x1972('0x4'));var fs=require('fs');var Redis=require(_0x1972('0x5'));var db=require(_0x1972('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1972('0x7'))('rpc');var config=require(_0x1972('0x8'));var jayson=require(_0x1972('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x1972('0xa')]=_['defaults'](config[_0x1972('0xa')],{'host':_0x1972('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1972('0xa')]));require(_0x1972('0xc'))[_0x1972('0xd')](socket);function respondWithRpcPromise(_0x53a408,_0x12ddf4,_0xf753b7){return new BPromise(function(_0x482377,_0x11e7e9){return client[_0x1972('0xe')](_0x53a408,_0xf753b7)[_0x1972('0xf')](function(_0x3cf051){logger[_0x1972('0x10')](_0x1972('0x11'),_0x12ddf4,_0x1972('0x12'));logger[_0x1972('0x13')](_0x1972('0x14'),_0x12ddf4,_0x1972('0x12'),JSON[_0x1972('0x15')](_0x3cf051));if(_0x3cf051[_0x1972('0x16')]){if(_0x3cf051['error'][_0x1972('0x17')]===0x1f4){logger[_0x1972('0x16')]('WhatsappInteraction,\x20%s,\x20%s',_0x12ddf4,_0x3cf051['error'][_0x1972('0x18')]);return _0x11e7e9(_0x3cf051[_0x1972('0x16')][_0x1972('0x18')]);}logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x12ddf4,_0x3cf051[_0x1972('0x16')]['message']);return _0x482377(_0x3cf051[_0x1972('0x16')][_0x1972('0x18')]);}else{logger[_0x1972('0x10')]('WhatsappInteraction,\x20%s,\x20%s',_0x12ddf4,'request\x20sent');_0x482377(_0x3cf051['result'][_0x1972('0x18')]);}})[_0x1972('0x19')](function(_0x328c20){logger[_0x1972('0x16')](_0x1972('0x11'),_0x12ddf4,_0x328c20);_0x11e7e9(_0x328c20);});});}exports[_0x1972('0x1a')]=function(_0xaf7245){var _0x3fc484=this;return new Promise(function(_0x3e273d,_0x59907e){return db[_0x1972('0x1b')][_0x1972('0x1c')](_0xaf7245[_0x1972('0x1d')],{'raw':_0xaf7245[_0x1972('0x1e')]?_0xaf7245[_0x1972('0x1e')][_0x1972('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xaf7245['options']?_0xaf7245[_0x1972('0x1e')][_0x1972('0x20')]||null:null,'attributes':_0xaf7245[_0x1972('0x1e')]?_0xaf7245[_0x1972('0x1e')][_0x1972('0x21')]||null:null,'limit':_0xaf7245[_0x1972('0x1e')]?_0xaf7245[_0x1972('0x1e')][_0x1972('0x22')]||null:null})[_0x1972('0xf')](function(_0x4a35e0){logger[_0x1972('0x10')](_0x1972('0x1a'),_0xaf7245);logger[_0x1972('0x13')](_0x1972('0x1a'),_0xaf7245,JSON['stringify'](_0x4a35e0));_0x3e273d(_0x4a35e0);})[_0x1972('0x19')](function(_0x37c66){logger[_0x1972('0x16')](_0x1972('0x1a'),_0x37c66[_0x1972('0x18')],_0xaf7245);_0x59907e(_0x3fc484[_0x1972('0x16')](0x1f4,_0x37c66[_0x1972('0x18')]));});});};exports[_0x1972('0x23')]=function(_0x497f7c){return new Promise(function(_0x15758b,_0x5afea1){return db['WhatsappInteraction'][_0x1972('0x24')]({'where':_0x497f7c[_0x1972('0x1e')]?_0x497f7c[_0x1972('0x1e')][_0x1972('0x20')]||null:null})[_0x1972('0xf')](function(_0x2d0b90){if(_0x2d0b90){return _0x2d0b90[_0x1972('0x25')](_0x497f7c[_0x1972('0x1d')][_0x1972('0x26')],_[_0x1972('0x27')](_0x497f7c[_0x1972('0x1d')],[_0x1972('0x26'),'id'])||{});}})[_0x1972('0x28')](function(_0x4a1650){logger['info']('AddTags',_0x497f7c);logger[_0x1972('0x13')](_0x1972('0x29'),_0x497f7c,JSON[_0x1972('0x15')](_0x4a1650));_0x15758b(_0x4a1650);})['catch'](function(_0xd81aa3){logger['error'](_0x1972('0x29'),_0xd81aa3['message'],_0x497f7c);_0x5afea1(_this[_0x1972('0x16')](0x1f4,_0xd81aa3[_0x1972('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 32898dd..63d8aeb 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 _0x53ad=['register','length','whatsappInteraction:','save','remove','emit','removeListener'];(function(_0x10e5f5,_0x37574d){var _0x42a98b=function(_0x580a92){while(--_0x580a92){_0x10e5f5['push'](_0x10e5f5['shift']());}};_0x42a98b(++_0x37574d);}(_0x53ad,0x13e));var _0xd53a=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x53ad[_0x397e5f];return _0x5302b8;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0xd53a('0x0'),_0xd53a('0x1'),'update'];function createListener(_0x5d456e,_0x164399){return function(_0x117002){_0x164399[_0xd53a('0x2')](_0x5d456e,_0x117002);};}function removeListener(_0x1debc9,_0x43d2bf){return function(){WhatsappInteractionEvents[_0xd53a('0x3')](_0x1debc9,_0x43d2bf);};}exports[_0xd53a('0x4')]=function(_0x205e78){for(var _0x166edd=0x0,_0x3b0e74=events[_0xd53a('0x5')];_0x166edd<_0x3b0e74;_0x166edd++){var _0x5a011e=events[_0x166edd];var _0x19a746=createListener(_0xd53a('0x6')+_0x5a011e,_0x205e78);WhatsappInteractionEvents['on'](_0x5a011e,_0x19a746);}}; \ No newline at end of file +var _0xada0=['save','remove','update','emit','removeListener','register','length','whatsappInteraction:'];(function(_0x170522,_0x273df0){var _0x2a0a7b=function(_0x5539a5){while(--_0x5539a5){_0x170522['push'](_0x170522['shift']());}};_0x2a0a7b(++_0x273df0);}(_0xada0,0x108));var _0x0ada=function(_0x165257,_0x27438d){_0x165257=_0x165257-0x0;var _0x1e2e4a=_0xada0[_0x165257];return _0x1e2e4a;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0x0ada('0x0'),_0x0ada('0x1'),_0x0ada('0x2')];function createListener(_0x20b6fc,_0x52c867){return function(_0x170149){_0x52c867[_0x0ada('0x3')](_0x20b6fc,_0x170149);};}function removeListener(_0x1838d4,_0x53fb14){return function(){WhatsappInteractionEvents[_0x0ada('0x4')](_0x1838d4,_0x53fb14);};}exports[_0x0ada('0x5')]=function(_0x1107d5){for(var _0x10ef3d=0x0,_0x313949=events[_0x0ada('0x6')];_0x10ef3d<_0x313949;_0x10ef3d++){var _0x56c349=events[_0x10ef3d];var _0x32299f=createListener(_0x0ada('0x7')+_0x56c349,_0x1107d5);WhatsappInteractionEvents['on'](_0x56c349,_0x32299f);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index d81287b..726a071 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 _0xd238=['create','update','put','/:id/reject','reject','delete','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','whatsapp','whatsappmessage:create'];(function(_0x5627e1,_0x1b2dbf){var _0x2f013f=function(_0x142015){while(--_0x142015){_0x5627e1['push'](_0x5627e1['shift']());}};_0x2f013f(++_0x1b2dbf);}(_0xd238,0xa8));var _0x8d23=function(_0x247f1a,_0xb1d3a0){_0x247f1a=_0x247f1a-0x0;var _0xa5ed2=_0xd238[_0x247f1a];return _0xa5ed2;};'use strict';var multer=require(_0x8d23('0x0'));var util=require(_0x8d23('0x1'));var path=require('path');var timeout=require(_0x8d23('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8d23('0x3'));var auth=require(_0x8d23('0x4'));var interaction=require(_0x8d23('0x5'));var config=require(_0x8d23('0x6'));var controller=require(_0x8d23('0x7'));router[_0x8d23('0x8')]('/',auth[_0x8d23('0x9')](),controller['index']);router[_0x8d23('0x8')](_0x8d23('0xa'),auth[_0x8d23('0x9')](),controller[_0x8d23('0xb')]);router[_0x8d23('0x8')](_0x8d23('0xc'),auth['isAuthenticated'](),controller[_0x8d23('0xd')]);router['post']('/',auth[_0x8d23('0x9')](),interaction['tracked'](_0x8d23('0xe'),_0x8d23('0xf')),controller[_0x8d23('0x10')]);router['post']('/:id/status',controller['status']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x8d23('0x11')]);router[_0x8d23('0x12')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0x8d23('0x12')](_0x8d23('0x13'),auth[_0x8d23('0x9')](),controller[_0x8d23('0x14')]);router[_0x8d23('0x15')](_0x8d23('0xc'),auth[_0x8d23('0x9')](),controller['destroy']);module[_0x8d23('0x16')]=router; \ No newline at end of file +var _0x3ee2=['tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x1a92a6,_0x37d0a8){var _0x7870e4=function(_0x2506f3){while(--_0x2506f3){_0x1a92a6['push'](_0x1a92a6['shift']());}};_0x7870e4(++_0x37d0a8);}(_0x3ee2,0x86));var _0x23ee=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x3ee2[_0x1cc8fe];return _0x230054;};'use strict';var multer=require(_0x23ee('0x0'));var util=require(_0x23ee('0x1'));var path=require(_0x23ee('0x2'));var timeout=require(_0x23ee('0x3'));var express=require('express');var router=express[_0x23ee('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x23ee('0x5'));var interaction=require(_0x23ee('0x6'));var config=require(_0x23ee('0x7'));var controller=require('./whatsappMessage.controller');router[_0x23ee('0x8')]('/',auth[_0x23ee('0x9')](),controller[_0x23ee('0xa')]);router['get'](_0x23ee('0xb'),auth[_0x23ee('0x9')](),controller[_0x23ee('0xc')]);router[_0x23ee('0x8')](_0x23ee('0xd'),auth[_0x23ee('0x9')](),controller[_0x23ee('0xe')]);router[_0x23ee('0xf')]('/',auth[_0x23ee('0x9')](),interaction[_0x23ee('0x10')](_0x23ee('0x11'),_0x23ee('0x12')),controller[_0x23ee('0x13')]);router[_0x23ee('0xf')](_0x23ee('0x14'),controller[_0x23ee('0x15')]);router[_0x23ee('0x16')](_0x23ee('0xd'),auth[_0x23ee('0x9')](),controller[_0x23ee('0x17')]);router[_0x23ee('0x16')](_0x23ee('0x18'),auth[_0x23ee('0x9')](),controller[_0x23ee('0x19')]);router[_0x23ee('0x16')](_0x23ee('0x1a'),auth[_0x23ee('0x9')](),controller[_0x23ee('0x1b')]);router[_0x23ee('0x1c')](_0x23ee('0xd'),auth[_0x23ee('0x9')](),controller[_0x23ee('0x1d')]);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 caccabc..7c20a9c 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 _0x793c=['medium','BOOLEAN','ENUM','out','STRING','DATE','TEXT'];(function(_0x5d60d1,_0x325ad0){var _0x5e94a7=function(_0x40fb9c){while(--_0x40fb9c){_0x5d60d1['push'](_0x5d60d1['shift']());}};_0x5e94a7(++_0x325ad0);}(_0x793c,0x99));var _0xc793=function(_0x1b7368,_0x3286ed){_0x1b7368=_0x1b7368-0x0;var _0x25d54c=_0x793c[_0x1b7368];return _0x25d54c;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xc793('0x0')](_0xc793('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xc793('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc793('0x3')]('in',_0xc793('0x4')),'defaultValue':_0xc793('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xc793('0x5')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xc793('0x6')]},'secret':{'type':Sequelize[_0xc793('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xc793('0x0')]}}; \ No newline at end of file +var _0xb4d5=['TEXT','BOOLEAN','ENUM','out','STRING','DATE','sequelize','exports'];(function(_0x1edd53,_0x27c8d7){var _0x49e4bc=function(_0x101b17){while(--_0x101b17){_0x1edd53['push'](_0x1edd53['shift']());}};_0x49e4bc(++_0x27c8d7);}(_0xb4d5,0x18e));var _0x5b4d=function(_0x40fdd8,_0x4662a0){_0x40fdd8=_0x40fdd8-0x0;var _0x1e41ad=_0xb4d5[_0x40fdd8];return _0x1e41ad;};'use strict';var Sequelize=require(_0x5b4d('0x0'));module[_0x5b4d('0x1')]={'body':{'type':Sequelize[_0x5b4d('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x5b4d('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x5b4d('0x4')]('in',_0x5b4d('0x5')),'defaultValue':_0x5b4d('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x5b4d('0x6')](0xbe)},'phone':{'type':Sequelize[_0x5b4d('0x6')]},'readAt':{'type':Sequelize[_0x5b4d('0x7')]},'secret':{'type':Sequelize[_0x5b4d('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x5b4d('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 2c470d5..8d87296 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 _0x5d17=['WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','client','http','request','then','info','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','catch','status','json','undefined','count','offset','limit','set','apply','reject','save','update','destroy','end','sendStatus','stack','name','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','type','VIRTUAL','options','WhatsappMessage','includeAll','include','findAll','show','rawAttributes','merge','find','create','body','params','describe','../../config/logger','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteractionId','isNil','read1stAt','interaction','role','AcceptMessage','acceptMessage','ContactId','Sequelize','QueryTypes','contact','User','fullname','email','internal','manual','interface','channel','accept','EventManager','acceptmessage','whatsapp-interactions','whatsapp','WhatsappInteraction','null','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','SELECT','format','event','rejectmessage','WhatsappAccount','WhatsappAccountId'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x5d17,0x114));var _0x75d1=function(_0x5dcb2f,_0x402ca3){_0x5dcb2f=_0x5dcb2f-0x0;var _0x2cf625=_0x5d17[_0x5dcb2f];return _0x2cf625;};'use strict';var emlformat=require(_0x75d1('0x0'));var rimraf=require(_0x75d1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x75d1('0x2'));var moment=require(_0x75d1('0x3'));var BPromise=require(_0x75d1('0x4'));var Mustache=require('mustache');var util=require(_0x75d1('0x5'));var path=require(_0x75d1('0x6'));var sox=require(_0x75d1('0x7'));var csv=require(_0x75d1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x75d1('0x9'));var _=require(_0x75d1('0xa'));var squel=require(_0x75d1('0xb'));var crypto=require(_0x75d1('0xc'));var jsforce=require(_0x75d1('0xd'));var deskjs=require(_0x75d1('0xe'));var toCsv=require(_0x75d1('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x75d1('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x75d1('0x10'));var hardwareService=require(_0x75d1('0x11'));var logger=require('../../config/logger')(_0x75d1('0x12'));var utils=require(_0x75d1('0x13'));var config=require(_0x75d1('0x14'));var licenseUtil=require(_0x75d1('0x15'));var db=require(_0x75d1('0x16'))['db'];config[_0x75d1('0x17')]=_['defaults'](config[_0x75d1('0x17')],{'host':_0x75d1('0x18'),'port':0x18eb});var socket=require(_0x75d1('0x19'))(new Redis(config[_0x75d1('0x17')]));require('./whatsappMessage.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x75d1('0x1a')][_0x75d1('0x1b')]({'port':0x232c});var client9002=jayson[_0x75d1('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f9620,_0x3fff9b,_0x1d30f3,_0x269e82){return new BPromise(function(_0x1160ca,_0x39a26b){var _0x2845bc=_0x269e82||client;return _0x2845bc[_0x75d1('0x1c')](_0x1f9620,_0x1d30f3)[_0x75d1('0x1d')](function(_0x3d0717){logger[_0x75d1('0x1e')]('WhatsappMessage,\x20%s,\x20%s',_0x3fff9b,'request\x20sent');logger[_0x75d1('0x1f')](_0x75d1('0x20'),_0x3fff9b,'request\x20sent',JSON[_0x75d1('0x21')](_0x3d0717));if(_0x3d0717[_0x75d1('0x22')]){if(_0x3d0717[_0x75d1('0x22')][_0x75d1('0x23')]===0x1f4){logger[_0x75d1('0x22')](_0x75d1('0x24'),_0x3fff9b,_0x3d0717['error'][_0x75d1('0x25')]);return _0x39a26b(_0x3d0717[_0x75d1('0x22')]['message']);}logger[_0x75d1('0x22')](_0x75d1('0x24'),_0x3fff9b,_0x3d0717['error'][_0x75d1('0x25')]);return _0x1160ca(_0x3d0717['error'][_0x75d1('0x25')]);}else{logger[_0x75d1('0x1e')](_0x75d1('0x24'),_0x3fff9b,'request\x20sent');_0x1160ca(_0x3d0717['result'][_0x75d1('0x25')]);}})[_0x75d1('0x26')](function(_0x315ce5){logger[_0x75d1('0x22')]('WhatsappMessage,\x20%s,\x20%s',_0x3fff9b,_0x315ce5);_0x39a26b(_0x315ce5);});});}function respondWithStatusCode(_0x280498,_0x2b5848){_0x2b5848=_0x2b5848||0xcc;return function(_0x367238){if(_0x367238){return _0x280498['sendStatus'](_0x2b5848);}return _0x280498['status'](_0x2b5848)['end']();};}function respondWithResult(_0x364dc9,_0x30d9f3){_0x30d9f3=_0x30d9f3||0xc8;return function(_0x45c182){if(_0x45c182){return _0x364dc9[_0x75d1('0x27')](_0x30d9f3)[_0x75d1('0x28')](_0x45c182);}};}function respondWithFilteredResult(_0x519ceb,_0x4d292e){return function(_0x410e16){if(_0x410e16){var _0x197f52=typeof _0x4d292e['offset']===_0x75d1('0x29')&&typeof _0x4d292e['limit']===_0x75d1('0x29');var _0x244da6=_0x410e16[_0x75d1('0x2a')];var _0x3fb7b9=_0x197f52?0x0:_0x4d292e[_0x75d1('0x2b')];var _0x506b93=_0x197f52?_0x410e16[_0x75d1('0x2a')]:_0x4d292e[_0x75d1('0x2b')]+_0x4d292e[_0x75d1('0x2c')];var _0x84d9ae;if(_0x506b93>=_0x244da6){_0x506b93=_0x244da6;_0x84d9ae=0xc8;}else{_0x84d9ae=0xce;}_0x519ceb['status'](_0x84d9ae);return _0x519ceb[_0x75d1('0x2d')]('Content-Range',_0x3fb7b9+'-'+_0x506b93+'/'+_0x244da6)[_0x75d1('0x28')](_0x410e16);}return null;};}function patchUpdates(_0x31e072){return function(_0x4c449d){try{jsonpatch[_0x75d1('0x2e')](_0x4c449d,_0x31e072,!![]);}catch(_0x39d0ff){return BPromise[_0x75d1('0x2f')](_0x39d0ff);}return _0x4c449d[_0x75d1('0x30')]();};}function saveUpdates(_0x22b190,_0x495aa4){return function(_0x23f94a){if(_0x23f94a){return _0x23f94a[_0x75d1('0x31')](_0x22b190)[_0x75d1('0x1d')](function(_0xa0f4c9){return _0xa0f4c9;});}return null;};}function removeEntity(_0x4b936c,_0x5bd3d7){return function(_0x551723){if(_0x551723){return _0x551723[_0x75d1('0x32')]()[_0x75d1('0x1d')](function(){_0x4b936c[_0x75d1('0x27')](0xcc)[_0x75d1('0x33')]();});}};}function handleEntityNotFound(_0x38972c,_0x372e23){return function(_0x3effda){if(!_0x3effda){_0x38972c[_0x75d1('0x34')](0x194);}return _0x3effda;};}function handleError(_0x433092,_0x534511){_0x534511=_0x534511||0x1f4;return function(_0x1dd3b5){logger[_0x75d1('0x22')](_0x1dd3b5[_0x75d1('0x35')]);if(_0x1dd3b5[_0x75d1('0x36')]){delete _0x1dd3b5[_0x75d1('0x36')];}_0x433092['status'](_0x534511)['send'](_0x1dd3b5);};}exports['index']=function(_0x1058b7,_0x17c0f6){var _0x7c9dc3={},_0x29d72f={},_0x460b92={'count':0x0,'rows':[]};var _0x734a47=_['map'](db['WhatsappMessage']['rawAttributes'],function(_0x3f2569){return{'name':_0x3f2569['fieldName'],'type':_0x3f2569['type'][_0x75d1('0x37')]};});_0x29d72f[_0x75d1('0x38')]=_[_0x75d1('0x39')](_0x734a47,_0x75d1('0x36'));_0x29d72f['query']=_[_0x75d1('0x3a')](_0x1058b7[_0x75d1('0x3b')]);_0x29d72f[_0x75d1('0x3c')]=_[_0x75d1('0x3d')](_0x29d72f[_0x75d1('0x38')],_0x29d72f[_0x75d1('0x3b')]);_0x7c9dc3[_0x75d1('0x3e')]=_[_0x75d1('0x3d')](_0x29d72f[_0x75d1('0x38')],qs[_0x75d1('0x3f')](_0x1058b7[_0x75d1('0x3b')][_0x75d1('0x3f')]));_0x7c9dc3[_0x75d1('0x3e')]=_0x7c9dc3[_0x75d1('0x3e')][_0x75d1('0x40')]?_0x7c9dc3[_0x75d1('0x3e')]:_0x29d72f[_0x75d1('0x38')];if(!_0x1058b7[_0x75d1('0x3b')][_0x75d1('0x41')](_0x75d1('0x42'))){_0x7c9dc3[_0x75d1('0x2c')]=qs[_0x75d1('0x2c')](_0x1058b7['query']['limit']);_0x7c9dc3[_0x75d1('0x2b')]=qs[_0x75d1('0x2b')](_0x1058b7[_0x75d1('0x3b')][_0x75d1('0x2b')]);}_0x7c9dc3['order']=qs[_0x75d1('0x43')](_0x1058b7[_0x75d1('0x3b')][_0x75d1('0x43')]);_0x7c9dc3[_0x75d1('0x44')]=qs['filters'](_[_0x75d1('0x45')](_0x1058b7[_0x75d1('0x3b')],_0x29d72f[_0x75d1('0x3c')]),_0x734a47);if(_0x1058b7[_0x75d1('0x3b')]['filter']){_0x7c9dc3[_0x75d1('0x44')]=_['merge'](_0x7c9dc3[_0x75d1('0x44')],{'$or':_[_0x75d1('0x39')](_0x734a47,function(_0x9bc1ed){if(_0x9bc1ed[_0x75d1('0x46')]!==_0x75d1('0x47')){var _0x2137e1={};_0x2137e1[_0x9bc1ed['name']]={'$like':'%'+_0x1058b7[_0x75d1('0x3b')]['filter']+'%'};return _0x2137e1;}})});}_0x7c9dc3=_['merge']({},_0x7c9dc3,_0x1058b7[_0x75d1('0x48')]);var _0x125c9d={'where':_0x7c9dc3[_0x75d1('0x44')]};return db[_0x75d1('0x49')][_0x75d1('0x2a')](_0x125c9d)[_0x75d1('0x1d')](function(_0x18f96a){_0x460b92['count']=_0x18f96a;if(_0x1058b7['query'][_0x75d1('0x4a')]){_0x7c9dc3[_0x75d1('0x4b')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x75d1('0x4c')](_0x7c9dc3);})[_0x75d1('0x1d')](function(_0x2066c8){_0x460b92['rows']=_0x2066c8;return _0x460b92;})[_0x75d1('0x1d')](respondWithFilteredResult(_0x17c0f6,_0x7c9dc3))[_0x75d1('0x26')](handleError(_0x17c0f6,null));};exports[_0x75d1('0x4d')]=function(_0x3be4b5,_0x352208){var _0x41869d={'raw':!![],'where':{'id':_0x3be4b5['params']['id']}},_0x2eec9d={};_0x2eec9d[_0x75d1('0x38')]=_[_0x75d1('0x3a')](db[_0x75d1('0x49')][_0x75d1('0x4e')]);_0x2eec9d[_0x75d1('0x3b')]=_[_0x75d1('0x3a')](_0x3be4b5[_0x75d1('0x3b')]);_0x2eec9d['filters']=_[_0x75d1('0x3d')](_0x2eec9d[_0x75d1('0x38')],_0x2eec9d[_0x75d1('0x3b')]);_0x41869d['attributes']=_[_0x75d1('0x3d')](_0x2eec9d[_0x75d1('0x38')],qs[_0x75d1('0x3f')](_0x3be4b5[_0x75d1('0x3b')][_0x75d1('0x3f')]));_0x41869d[_0x75d1('0x3e')]=_0x41869d['attributes'][_0x75d1('0x40')]?_0x41869d[_0x75d1('0x3e')]:_0x2eec9d[_0x75d1('0x38')];if(_0x3be4b5[_0x75d1('0x3b')][_0x75d1('0x4a')]){_0x41869d[_0x75d1('0x4b')]=[{'all':!![]}];}_0x41869d=_[_0x75d1('0x4f')]({},_0x41869d,_0x3be4b5[_0x75d1('0x48')]);return db[_0x75d1('0x49')][_0x75d1('0x50')](_0x41869d)[_0x75d1('0x1d')](handleEntityNotFound(_0x352208,null))[_0x75d1('0x1d')](respondWithResult(_0x352208,null))['catch'](handleError(_0x352208,null));};exports['create']=function(_0x41d54f,_0x4c1f5e){return db[_0x75d1('0x49')][_0x75d1('0x51')](_0x41d54f['body'],{})[_0x75d1('0x1d')](respondWithResult(_0x4c1f5e,0xc9))[_0x75d1('0x26')](handleError(_0x4c1f5e,null));};exports[_0x75d1('0x31')]=function(_0x209857,_0x35722d){if(_0x209857[_0x75d1('0x52')]['id']){delete _0x209857[_0x75d1('0x52')]['id'];}return db['WhatsappMessage'][_0x75d1('0x50')]({'where':{'id':_0x209857[_0x75d1('0x53')]['id']}})[_0x75d1('0x1d')](handleEntityNotFound(_0x35722d,null))[_0x75d1('0x1d')](saveUpdates(_0x209857[_0x75d1('0x52')],null))[_0x75d1('0x1d')](respondWithResult(_0x35722d,null))[_0x75d1('0x26')](handleError(_0x35722d,null));};exports[_0x75d1('0x32')]=function(_0x22c75a,_0x349134){return db['WhatsappMessage']['find']({'where':{'id':_0x22c75a[_0x75d1('0x53')]['id']}})[_0x75d1('0x1d')](handleEntityNotFound(_0x349134,null))[_0x75d1('0x1d')](removeEntity(_0x349134,null))['catch'](handleError(_0x349134,null));};exports[_0x75d1('0x54')]=function(_0x586acb,_0x2005d1){return db[_0x75d1('0x49')][_0x75d1('0x54')]()[_0x75d1('0x1d')](respondWithResult(_0x2005d1,null))['catch'](handleError(_0x2005d1,null));};var interaction_log=require(_0x75d1('0x55'))('whatsapp-interactions');exports['accept']=function(_0x18d8f3,_0x91d298,_0x286658){var _0x3c8119={'agent':{},'channel':'whatsapp'};if(_0x18d8f3['body']['id']){delete _0x18d8f3[_0x75d1('0x52')]['id'];}_0x18d8f3[_0x75d1('0x52')][_0x75d1('0x56')]=!![];_0x18d8f3[_0x75d1('0x52')][_0x75d1('0x57')]=moment()['format'](_0x75d1('0x58'));_0x18d8f3[_0x75d1('0x52')][_0x75d1('0x59')]=_0x18d8f3[_0x75d1('0x52')][_0x75d1('0x59')]||_0x18d8f3[_0x75d1('0x5a')]['id'];_0x3c8119[_0x75d1('0x5b')]['id']=_0x18d8f3[_0x75d1('0x52')][_0x75d1('0x59')];return db[_0x75d1('0x49')][_0x75d1('0x50')]({'where':{'id':_0x18d8f3['params']['id'],'UserId':null}})[_0x75d1('0x1d')](handleEntityNotFound(_0x91d298,null))[_0x75d1('0x1d')](saveUpdates(_0x18d8f3[_0x75d1('0x52')],null))[_0x75d1('0x1d')](function(_0x3754b1){if(_0x3754b1){_0x3c8119[_0x75d1('0x25')]=_0x3754b1[_0x75d1('0x5c')]({'plain':!![]});return db['WhatsappInteraction']['find']({'where':{'id':_0x3754b1[_0x75d1('0x5d')]}});}return null;})[_0x75d1('0x1d')](handleEntityNotFound(_0x91d298,null))[_0x75d1('0x1d')](function(_0x13ddbb){if(_0x13ddbb){return _0x13ddbb[_0x75d1('0x31')]({'UserId':_0x18d8f3['body']['UserId'],'read1stAt':_[_0x75d1('0x5e')](_0x13ddbb[_0x75d1('0x5f')])?moment()['format'](_0x75d1('0x58')):undefined});}return null;})[_0x75d1('0x1d')](function(_0x25dfa1){if(_0x25dfa1){_0x3c8119[_0x75d1('0x60')]=_0x25dfa1[_0x75d1('0x5c')]({'plain':!![]});interaction_log[_0x75d1('0x1e')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x18d8f3['user']['id'],_0x18d8f3[_0x75d1('0x5a')][_0x75d1('0x36')],_0x18d8f3['user'][_0x75d1('0x61')],_0x3c8119['interaction']['id'],_0x18d8f3[_0x75d1('0x52')]?JSON[_0x75d1('0x21')](_0x18d8f3[_0x75d1('0x52')]):'null');return respondWithRpcPromise(_0x75d1('0x62'),_0x75d1('0x63'),_0x3c8119);}return null;})[_0x75d1('0x1d')](function(_0x1baaca){var _0x4553ff='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1baaca['message'][_0x75d1('0x64')];return db['sequelize'][_0x75d1('0x3b')](_0x4553ff,{'type':db[_0x75d1('0x65')][_0x75d1('0x66')]['SELECT'],'raw':!![]})['then'](function(_0x2e6849){return _0x2e6849;});})['then'](function(_0x419983){if(_0x419983){_0x3c8119[_0x75d1('0x25')][_0x75d1('0x67')]=_0x419983[0x0];if(!_0x18d8f3['body'][_0x75d1('0x59')])return;return db[_0x75d1('0x68')][_0x75d1('0x50')]({'where':{'id':_0x18d8f3[_0x75d1('0x52')][_0x75d1('0x59')],'role':_0x75d1('0x5b')},'attributes':['id',_0x75d1('0x36'),_0x75d1('0x69'),_0x75d1('0x6a'),_0x75d1('0x6b')],'raw':!![]});}return null;})[_0x75d1('0x1d')](function(_0x3549f2){if(!_0x3549f2)return null;_0x3c8119[_0x75d1('0x25')][_0x75d1('0x5b')]=_0x3549f2;return _0x3c8119;})['then'](function(_0x574cb0){if(_0x574cb0){if(_0x18d8f3[_0x75d1('0x52')][_0x75d1('0x6c')]){_0x3c8119['message'][_0x75d1('0x6d')]=util['format']('SIP/%s',_0x18d8f3['user'][_0x75d1('0x36')]);_0x3c8119[_0x75d1('0x25')][_0x75d1('0x6e')]=_0x3c8119[_0x75d1('0x6e')];_0x3c8119[_0x75d1('0x25')]['event']=_0x75d1('0x6f');return respondWithRpcPromise(_0x75d1('0x70'),_0x75d1('0x70'),{'event':_0x75d1('0x71'),'message':_0x3c8119[_0x75d1('0x25')]},client9002)['then'](function(){return _0x3c8119;});}return _0x3c8119;}return null;})[_0x75d1('0x1d')](respondWithResult(_0x91d298,null))['catch'](handleError(_0x91d298,null));};var interaction_log=require(_0x75d1('0x55'))(_0x75d1('0x72'));exports[_0x75d1('0x2f')]=function(_0x526d98,_0x506e05,_0x4e88e9){var _0x7846f2={'agent':{},'channel':_0x75d1('0x73')};if(_0x526d98[_0x75d1('0x52')]['id']){delete _0x526d98[_0x75d1('0x52')]['id'];}_0x526d98[_0x75d1('0x52')][_0x75d1('0x59')]=_0x526d98['body'][_0x75d1('0x59')]||_0x526d98[_0x75d1('0x5a')]['id'];_0x7846f2['agent']['id']=_0x526d98[_0x75d1('0x52')]['UserId'];return db['WhatsappMessage']['find']({'where':{'id':_0x526d98[_0x75d1('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x506e05,null))['then'](function(_0x3f582c){if(_0x3f582c){_0x7846f2['message']=_0x3f582c[_0x75d1('0x5c')]({'plain':!![]});return db[_0x75d1('0x74')][_0x75d1('0x50')]({'where':{'id':_0x3f582c[_0x75d1('0x5d')]}});}return null;})[_0x75d1('0x1d')](handleEntityNotFound(_0x506e05,null))[_0x75d1('0x1d')](function(_0x388210){if(_0x388210){_0x7846f2[_0x75d1('0x60')]=_0x388210['get']({'plain':!![]});interaction_log[_0x75d1('0x1e')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x526d98[_0x75d1('0x5a')]['id'],_0x526d98[_0x75d1('0x5a')][_0x75d1('0x36')],_0x526d98['user'][_0x75d1('0x61')],_0x7846f2[_0x75d1('0x60')]['id'],_0x526d98[_0x75d1('0x52')]?JSON[_0x75d1('0x21')](_0x526d98[_0x75d1('0x52')]):_0x75d1('0x75'));return respondWithRpcPromise(_0x75d1('0x76'),'rejectMessage',_0x7846f2);}return null;})[_0x75d1('0x1d')](function(_0x21932b){var _0x339321=_0x75d1('0x77')+_0x21932b[_0x75d1('0x25')]['ContactId'];return db['sequelize'][_0x75d1('0x3b')](_0x339321,{'type':db['Sequelize'][_0x75d1('0x66')][_0x75d1('0x78')],'raw':!![]})[_0x75d1('0x1d')](function(_0x3cc03d){return _0x3cc03d;});})['then'](function(_0x576ff0){if(_0x576ff0){_0x7846f2[_0x75d1('0x25')][_0x75d1('0x67')]=_0x576ff0[0x0];if(!_0x526d98[_0x75d1('0x52')][_0x75d1('0x59')])return;return db[_0x75d1('0x68')]['find']({'where':{'id':_0x526d98[_0x75d1('0x52')][_0x75d1('0x59')],'role':'agent'},'attributes':['id',_0x75d1('0x36'),_0x75d1('0x69'),_0x75d1('0x6a'),_0x75d1('0x6b')],'raw':!![]});}return null;})[_0x75d1('0x1d')](function(_0x6eccd8){if(!_0x6eccd8)return null;_0x7846f2['message'][_0x75d1('0x5b')]=_0x6eccd8;return _0x7846f2;})[_0x75d1('0x1d')](function(_0x39084f){if(_0x39084f){_0x39084f[_0x75d1('0x25')][_0x75d1('0x6d')]=util[_0x75d1('0x79')]('SIP/%s',_0x526d98[_0x75d1('0x5a')]['name']);_0x39084f[_0x75d1('0x25')][_0x75d1('0x6e')]=_0x7846f2[_0x75d1('0x6e')];_0x39084f[_0x75d1('0x25')][_0x75d1('0x7a')]=_0x75d1('0x2f');respondWithRpcPromise('EventManager',_0x75d1('0x70'),{'event':_0x75d1('0x7b'),'message':_0x39084f[_0x75d1('0x25')]},client9002);return _0x7846f2;}return null;})['then'](respondWithResult(_0x506e05,null))[_0x75d1('0x26')](handleError(_0x506e05,null));};exports[_0x75d1('0x27')]=function(_0x5882fe,_0x5767f4,_0xbd3b74){if(_0x5882fe[_0x75d1('0x52')]['id']){delete _0x5882fe[_0x75d1('0x52')]['id'];}var _0x2bacfe;return db[_0x75d1('0x49')][_0x75d1('0x50')]({'where':{'id':_0x5882fe[_0x75d1('0x53')]['id']}})[_0x75d1('0x1d')](handleEntityNotFound(_0x5767f4,null))['then'](function(_0x24280b){if(_0x24280b){_0x2bacfe=_0x24280b;return db[_0x75d1('0x7c')]['find']({'where':{'id':_0x24280b[_0x75d1('0x7d')]}});}})[_0x75d1('0x1d')](handleEntityNotFound(_0x5767f4,null))['then'](function(_0x4ec00a){if(_0x4ec00a){logger[_0x75d1('0x1f')](_0x75d1('0x7e'),_0x75d1('0x27'),_0x75d1('0x7f'),_0x4ec00a['type'],util[_0x75d1('0x80')](_0x5882fe['body'],{'showHidden':![],'depth':null}));switch(_0x4ec00a[_0x75d1('0x46')]){case _0x75d1('0x81'):if(_0x5882fe[_0x75d1('0x52')][_0x75d1('0x82')]&&_0x5882fe[_0x75d1('0x52')][_0x75d1('0x82')]===_0x2bacfe[_0x75d1('0x83')]&&_0x5882fe[_0x75d1('0x52')][_0x75d1('0x84')]&&_0x5882fe[_0x75d1('0x52')][_0x75d1('0x84')]===_0x75d1('0x56')){return _0x2bacfe[_0x75d1('0x31')]({'read':!![]});}else{logger[_0x75d1('0x22')](_0x75d1('0x85'),_0x75d1('0x27'),_0x75d1('0x81'),util['inspect'](_0x5882fe[_0x75d1('0x52')],{'showHidden':![],'depth':null}));}break;}return _0x2bacfe;}})[_0x75d1('0x1d')](respondWithResult(_0x5767f4,null))[_0x75d1('0x26')](handleError(_0x5767f4,null));}; \ No newline at end of file +var _0xfcf8=['twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','end','status','json','offset','limit','apply','reject','save','destroy','stack','name','index','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','WhatsappMessage','findAll','params','find','body','describe','accept','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','WhatsappInteraction','WhatsappInteractionId','update','isNil','read1stAt','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','null','AcceptMessage','acceptMessage','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','interface','channel','EventManager','whatsapp-interactions','whatsapp','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','SIP/%s','event','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect'];(function(_0x1bb47b,_0x54e02e){var _0x566418=function(_0x4ceb66){while(--_0x4ceb66){_0x1bb47b['push'](_0x1bb47b['shift']());}};_0x566418(++_0x54e02e);}(_0xfcf8,0x8f));var _0x8fcf=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xfcf8[_0x50a0c2];return _0x5ebadd;};'use strict';var emlformat=require(_0x8fcf('0x0'));var rimraf=require(_0x8fcf('0x1'));var zipdir=require(_0x8fcf('0x2'));var jsonpatch=require(_0x8fcf('0x3'));var rp=require(_0x8fcf('0x4'));var moment=require(_0x8fcf('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8fcf('0x6'));var util=require(_0x8fcf('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x8fcf('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8fcf('0x9'));var _=require(_0x8fcf('0xa'));var squel=require(_0x8fcf('0xb'));var crypto=require(_0x8fcf('0xc'));var jsforce=require(_0x8fcf('0xd'));var deskjs=require(_0x8fcf('0xe'));var toCsv=require(_0x8fcf('0x8'));var querystring=require('querystring');var Papa=require(_0x8fcf('0xf'));var Redis=require(_0x8fcf('0x10'));var authService=require(_0x8fcf('0x11'));var qs=require(_0x8fcf('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8fcf('0x13'));var logger=require(_0x8fcf('0x14'))('api');var utils=require(_0x8fcf('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x8fcf('0x16'));var db=require(_0x8fcf('0x17'))['db'];config[_0x8fcf('0x18')]=_['defaults'](config['redis'],{'host':_0x8fcf('0x19'),'port':0x18eb});var socket=require(_0x8fcf('0x1a'))(new Redis(config[_0x8fcf('0x18')]));require(_0x8fcf('0x1b'))[_0x8fcf('0x1c')](socket);var jayson=require(_0x8fcf('0x1d'));var client=jayson[_0x8fcf('0x1e')][_0x8fcf('0x1f')]({'port':0x232c});var client9002=jayson[_0x8fcf('0x1e')][_0x8fcf('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x13a764,_0x4e5064,_0x46b988,_0x392733){return new BPromise(function(_0x545c19,_0x5ba3f9){var _0x567843=_0x392733||client;return _0x567843[_0x8fcf('0x20')](_0x13a764,_0x46b988)[_0x8fcf('0x21')](function(_0x13008a){logger[_0x8fcf('0x22')](_0x8fcf('0x23'),_0x4e5064,'request\x20sent');logger[_0x8fcf('0x24')](_0x8fcf('0x25'),_0x4e5064,_0x8fcf('0x26'),JSON[_0x8fcf('0x27')](_0x13008a));if(_0x13008a[_0x8fcf('0x28')]){if(_0x13008a[_0x8fcf('0x28')][_0x8fcf('0x29')]===0x1f4){logger[_0x8fcf('0x28')](_0x8fcf('0x23'),_0x4e5064,_0x13008a[_0x8fcf('0x28')][_0x8fcf('0x2a')]);return _0x5ba3f9(_0x13008a[_0x8fcf('0x28')][_0x8fcf('0x2a')]);}logger[_0x8fcf('0x28')](_0x8fcf('0x23'),_0x4e5064,_0x13008a['error'][_0x8fcf('0x2a')]);return _0x545c19(_0x13008a[_0x8fcf('0x28')]['message']);}else{logger[_0x8fcf('0x22')]('WhatsappMessage,\x20%s,\x20%s',_0x4e5064,_0x8fcf('0x26'));_0x545c19(_0x13008a['result']['message']);}})[_0x8fcf('0x2b')](function(_0x1257f2){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x4e5064,_0x1257f2);_0x5ba3f9(_0x1257f2);});});}function respondWithStatusCode(_0x5ba09a,_0x50d728){_0x50d728=_0x50d728||0xcc;return function(_0x54664e){if(_0x54664e){return _0x5ba09a[_0x8fcf('0x2c')](_0x50d728);}return _0x5ba09a['status'](_0x50d728)[_0x8fcf('0x2d')]();};}function respondWithResult(_0x19f185,_0x4a9b98){_0x4a9b98=_0x4a9b98||0xc8;return function(_0x4787d5){if(_0x4787d5){return _0x19f185[_0x8fcf('0x2e')](_0x4a9b98)[_0x8fcf('0x2f')](_0x4787d5);}};}function respondWithFilteredResult(_0xbfc69d,_0x260844){return function(_0x4038d4){if(_0x4038d4){var _0x5a9d55=typeof _0x260844[_0x8fcf('0x30')]==='undefined'&&typeof _0x260844[_0x8fcf('0x31')]==='undefined';var _0x2df8ef=_0x4038d4['count'];var _0x512bf1=_0x5a9d55?0x0:_0x260844[_0x8fcf('0x30')];var _0x1ccd93=_0x5a9d55?_0x4038d4['count']:_0x260844[_0x8fcf('0x30')]+_0x260844[_0x8fcf('0x31')];var _0x421b23;if(_0x1ccd93>=_0x2df8ef){_0x1ccd93=_0x2df8ef;_0x421b23=0xc8;}else{_0x421b23=0xce;}_0xbfc69d[_0x8fcf('0x2e')](_0x421b23);return _0xbfc69d['set']('Content-Range',_0x512bf1+'-'+_0x1ccd93+'/'+_0x2df8ef)[_0x8fcf('0x2f')](_0x4038d4);}return null;};}function patchUpdates(_0x4a890c){return function(_0x3eb827){try{jsonpatch[_0x8fcf('0x32')](_0x3eb827,_0x4a890c,!![]);}catch(_0x3e3e1f){return BPromise[_0x8fcf('0x33')](_0x3e3e1f);}return _0x3eb827[_0x8fcf('0x34')]();};}function saveUpdates(_0x3f5e05,_0x493eb5){return function(_0xae0030){if(_0xae0030){return _0xae0030['update'](_0x3f5e05)[_0x8fcf('0x21')](function(_0x3fcc30){return _0x3fcc30;});}return null;};}function removeEntity(_0x3a60d1,_0x4ccfea){return function(_0x2e2098){if(_0x2e2098){return _0x2e2098[_0x8fcf('0x35')]()[_0x8fcf('0x21')](function(){_0x3a60d1[_0x8fcf('0x2e')](0xcc)[_0x8fcf('0x2d')]();});}};}function handleEntityNotFound(_0x115663,_0x863a98){return function(_0x3d990d){if(!_0x3d990d){_0x115663['sendStatus'](0x194);}return _0x3d990d;};}function handleError(_0x1146d1,_0x489f30){_0x489f30=_0x489f30||0x1f4;return function(_0x1b55ca){logger['error'](_0x1b55ca[_0x8fcf('0x36')]);if(_0x1b55ca[_0x8fcf('0x37')]){delete _0x1b55ca['name'];}_0x1146d1[_0x8fcf('0x2e')](_0x489f30)['send'](_0x1b55ca);};}exports[_0x8fcf('0x38')]=function(_0x291418,_0x446e42){var _0xf018a6={},_0x42e7d9={},_0x5e7af7={'count':0x0,'rows':[]};var _0xa89aba=_['map'](db['WhatsappMessage'][_0x8fcf('0x39')],function(_0x5e7bb1){return{'name':_0x5e7bb1[_0x8fcf('0x3a')],'type':_0x5e7bb1[_0x8fcf('0x3b')][_0x8fcf('0x3c')]};});_0x42e7d9['model']=_[_0x8fcf('0x3d')](_0xa89aba,'name');_0x42e7d9[_0x8fcf('0x3e')]=_[_0x8fcf('0x3f')](_0x291418[_0x8fcf('0x3e')]);_0x42e7d9[_0x8fcf('0x40')]=_[_0x8fcf('0x41')](_0x42e7d9[_0x8fcf('0x42')],_0x42e7d9[_0x8fcf('0x3e')]);_0xf018a6[_0x8fcf('0x43')]=_[_0x8fcf('0x41')](_0x42e7d9[_0x8fcf('0x42')],qs[_0x8fcf('0x44')](_0x291418[_0x8fcf('0x3e')][_0x8fcf('0x44')]));_0xf018a6[_0x8fcf('0x43')]=_0xf018a6[_0x8fcf('0x43')][_0x8fcf('0x45')]?_0xf018a6[_0x8fcf('0x43')]:_0x42e7d9[_0x8fcf('0x42')];if(!_0x291418[_0x8fcf('0x3e')][_0x8fcf('0x46')](_0x8fcf('0x47'))){_0xf018a6[_0x8fcf('0x31')]=qs['limit'](_0x291418['query']['limit']);_0xf018a6[_0x8fcf('0x30')]=qs['offset'](_0x291418[_0x8fcf('0x3e')]['offset']);}_0xf018a6[_0x8fcf('0x48')]=qs[_0x8fcf('0x49')](_0x291418[_0x8fcf('0x3e')]['sort']);_0xf018a6[_0x8fcf('0x4a')]=qs[_0x8fcf('0x40')](_[_0x8fcf('0x4b')](_0x291418[_0x8fcf('0x3e')],_0x42e7d9['filters']),_0xa89aba);if(_0x291418['query'][_0x8fcf('0x4c')]){_0xf018a6[_0x8fcf('0x4a')]=_[_0x8fcf('0x4d')](_0xf018a6[_0x8fcf('0x4a')],{'$or':_[_0x8fcf('0x3d')](_0xa89aba,function(_0x5579bd){if(_0x5579bd[_0x8fcf('0x3b')]!==_0x8fcf('0x4e')){var _0x533be6={};_0x533be6[_0x5579bd[_0x8fcf('0x37')]]={'$like':'%'+_0x291418[_0x8fcf('0x3e')]['filter']+'%'};return _0x533be6;}})});}_0xf018a6=_[_0x8fcf('0x4d')]({},_0xf018a6,_0x291418[_0x8fcf('0x4f')]);var _0x2808bd={'where':_0xf018a6[_0x8fcf('0x4a')]};return db['WhatsappMessage'][_0x8fcf('0x50')](_0x2808bd)[_0x8fcf('0x21')](function(_0x4e1ecc){_0x5e7af7[_0x8fcf('0x50')]=_0x4e1ecc;if(_0x291418[_0x8fcf('0x3e')][_0x8fcf('0x51')]){_0xf018a6['include']=[{'all':!![]}];}return db[_0x8fcf('0x52')][_0x8fcf('0x53')](_0xf018a6);})['then'](function(_0x31ae52){_0x5e7af7['rows']=_0x31ae52;return _0x5e7af7;})[_0x8fcf('0x21')](respondWithFilteredResult(_0x446e42,_0xf018a6))[_0x8fcf('0x2b')](handleError(_0x446e42,null));};exports['show']=function(_0x4007a3,_0x1bca83){var _0x169b1d={'raw':!![],'where':{'id':_0x4007a3[_0x8fcf('0x54')]['id']}},_0x456547={};_0x456547[_0x8fcf('0x42')]=_['keys'](db[_0x8fcf('0x52')][_0x8fcf('0x39')]);_0x456547[_0x8fcf('0x3e')]=_[_0x8fcf('0x3f')](_0x4007a3[_0x8fcf('0x3e')]);_0x456547[_0x8fcf('0x40')]=_[_0x8fcf('0x41')](_0x456547[_0x8fcf('0x42')],_0x456547[_0x8fcf('0x3e')]);_0x169b1d[_0x8fcf('0x43')]=_['intersection'](_0x456547[_0x8fcf('0x42')],qs['fields'](_0x4007a3[_0x8fcf('0x3e')]['fields']));_0x169b1d[_0x8fcf('0x43')]=_0x169b1d['attributes'][_0x8fcf('0x45')]?_0x169b1d[_0x8fcf('0x43')]:_0x456547[_0x8fcf('0x42')];if(_0x4007a3['query'][_0x8fcf('0x51')]){_0x169b1d['include']=[{'all':!![]}];}_0x169b1d=_[_0x8fcf('0x4d')]({},_0x169b1d,_0x4007a3[_0x8fcf('0x4f')]);return db[_0x8fcf('0x52')][_0x8fcf('0x55')](_0x169b1d)[_0x8fcf('0x21')](handleEntityNotFound(_0x1bca83,null))['then'](respondWithResult(_0x1bca83,null))['catch'](handleError(_0x1bca83,null));};exports['create']=function(_0x42aa2d,_0x6591fc){return db[_0x8fcf('0x52')]['create'](_0x42aa2d[_0x8fcf('0x56')],{})[_0x8fcf('0x21')](respondWithResult(_0x6591fc,0xc9))[_0x8fcf('0x2b')](handleError(_0x6591fc,null));};exports['update']=function(_0x4db476,_0x5ab560){if(_0x4db476[_0x8fcf('0x56')]['id']){delete _0x4db476[_0x8fcf('0x56')]['id'];}return db[_0x8fcf('0x52')][_0x8fcf('0x55')]({'where':{'id':_0x4db476['params']['id']}})['then'](handleEntityNotFound(_0x5ab560,null))[_0x8fcf('0x21')](saveUpdates(_0x4db476[_0x8fcf('0x56')],null))[_0x8fcf('0x21')](respondWithResult(_0x5ab560,null))[_0x8fcf('0x2b')](handleError(_0x5ab560,null));};exports[_0x8fcf('0x35')]=function(_0x2c91b8,_0x5bd5b3){return db[_0x8fcf('0x52')][_0x8fcf('0x55')]({'where':{'id':_0x2c91b8['params']['id']}})['then'](handleEntityNotFound(_0x5bd5b3,null))[_0x8fcf('0x21')](removeEntity(_0x5bd5b3,null))[_0x8fcf('0x2b')](handleError(_0x5bd5b3,null));};exports[_0x8fcf('0x57')]=function(_0x3e61cd,_0x13a3ae){return db['WhatsappMessage'][_0x8fcf('0x57')]()[_0x8fcf('0x21')](respondWithResult(_0x13a3ae,null))[_0x8fcf('0x2b')](handleError(_0x13a3ae,null));};var interaction_log=require(_0x8fcf('0x14'))('whatsapp-interactions');exports[_0x8fcf('0x58')]=function(_0x510f34,_0x1579b3,_0x4ab9b4){var _0x29841a={'agent':{},'channel':'whatsapp'};if(_0x510f34[_0x8fcf('0x56')]['id']){delete _0x510f34['body']['id'];}_0x510f34[_0x8fcf('0x56')][_0x8fcf('0x59')]=!![];_0x510f34['body']['readAt']=moment()[_0x8fcf('0x5a')](_0x8fcf('0x5b'));_0x510f34[_0x8fcf('0x56')][_0x8fcf('0x5c')]=_0x510f34[_0x8fcf('0x56')]['UserId']||_0x510f34['user']['id'];_0x29841a[_0x8fcf('0x5d')]['id']=_0x510f34[_0x8fcf('0x56')][_0x8fcf('0x5c')];return db[_0x8fcf('0x52')][_0x8fcf('0x55')]({'where':{'id':_0x510f34[_0x8fcf('0x54')]['id'],'UserId':null}})[_0x8fcf('0x21')](handleEntityNotFound(_0x1579b3,null))[_0x8fcf('0x21')](saveUpdates(_0x510f34['body'],null))[_0x8fcf('0x21')](function(_0x1f6ac8){if(_0x1f6ac8){_0x29841a[_0x8fcf('0x2a')]=_0x1f6ac8[_0x8fcf('0x5e')]({'plain':!![]});return db[_0x8fcf('0x5f')][_0x8fcf('0x55')]({'where':{'id':_0x1f6ac8[_0x8fcf('0x60')]}});}return null;})[_0x8fcf('0x21')](handleEntityNotFound(_0x1579b3,null))[_0x8fcf('0x21')](function(_0x28ee43){if(_0x28ee43){return _0x28ee43[_0x8fcf('0x61')]({'UserId':_0x510f34[_0x8fcf('0x56')][_0x8fcf('0x5c')],'read1stAt':_[_0x8fcf('0x62')](_0x28ee43[_0x8fcf('0x63')])?moment()[_0x8fcf('0x5a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x8fcf('0x21')](function(_0x2bd7c1){if(_0x2bd7c1){_0x29841a['interaction']=_0x2bd7c1[_0x8fcf('0x5e')]({'plain':!![]});interaction_log[_0x8fcf('0x22')](_0x8fcf('0x64'),_0x510f34[_0x8fcf('0x65')]['id'],_0x510f34[_0x8fcf('0x65')][_0x8fcf('0x37')],_0x510f34['user'][_0x8fcf('0x66')],_0x29841a[_0x8fcf('0x67')]['id'],_0x510f34['body']?JSON[_0x8fcf('0x27')](_0x510f34['body']):_0x8fcf('0x68'));return respondWithRpcPromise(_0x8fcf('0x69'),_0x8fcf('0x6a'),_0x29841a);}return null;})[_0x8fcf('0x21')](function(_0x25db9e){var _0x9f3cf6='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x25db9e[_0x8fcf('0x2a')]['ContactId'];return db[_0x8fcf('0x6b')][_0x8fcf('0x3e')](_0x9f3cf6,{'type':db[_0x8fcf('0x6c')][_0x8fcf('0x6d')][_0x8fcf('0x6e')],'raw':!![]})[_0x8fcf('0x21')](function(_0x48203a){return _0x48203a;});})['then'](function(_0x40879e){if(_0x40879e){_0x29841a['message'][_0x8fcf('0x6f')]=_0x40879e[0x0];if(!_0x510f34[_0x8fcf('0x56')][_0x8fcf('0x5c')])return;return db[_0x8fcf('0x70')][_0x8fcf('0x55')]({'where':{'id':_0x510f34['body'][_0x8fcf('0x5c')],'role':_0x8fcf('0x5d')},'attributes':['id','name',_0x8fcf('0x71'),_0x8fcf('0x72'),_0x8fcf('0x73')],'raw':!![]});}return null;})[_0x8fcf('0x21')](function(_0x43d1c9){if(!_0x43d1c9)return null;_0x29841a['message']['agent']=_0x43d1c9;return _0x29841a;})[_0x8fcf('0x21')](function(_0x5e9782){if(_0x5e9782){if(_0x510f34[_0x8fcf('0x56')]['manual']){_0x29841a[_0x8fcf('0x2a')][_0x8fcf('0x74')]=util[_0x8fcf('0x5a')]('SIP/%s',_0x510f34[_0x8fcf('0x65')][_0x8fcf('0x37')]);_0x29841a[_0x8fcf('0x2a')]['channel']=_0x29841a[_0x8fcf('0x75')];_0x29841a['message']['event']=_0x8fcf('0x58');return respondWithRpcPromise(_0x8fcf('0x76'),'EventManager',{'event':'acceptmessage','message':_0x29841a[_0x8fcf('0x2a')]},client9002)[_0x8fcf('0x21')](function(){return _0x29841a;});}return _0x29841a;}return null;})[_0x8fcf('0x21')](respondWithResult(_0x1579b3,null))[_0x8fcf('0x2b')](handleError(_0x1579b3,null));};var interaction_log=require(_0x8fcf('0x14'))(_0x8fcf('0x77'));exports[_0x8fcf('0x33')]=function(_0x4eda2d,_0x5e0088,_0x1ab0cf){var _0x34a8de={'agent':{},'channel':_0x8fcf('0x78')};if(_0x4eda2d['body']['id']){delete _0x4eda2d[_0x8fcf('0x56')]['id'];}_0x4eda2d[_0x8fcf('0x56')][_0x8fcf('0x5c')]=_0x4eda2d['body'][_0x8fcf('0x5c')]||_0x4eda2d[_0x8fcf('0x65')]['id'];_0x34a8de[_0x8fcf('0x5d')]['id']=_0x4eda2d[_0x8fcf('0x56')][_0x8fcf('0x5c')];return db['WhatsappMessage'][_0x8fcf('0x55')]({'where':{'id':_0x4eda2d[_0x8fcf('0x54')]['id'],'UserId':null}})[_0x8fcf('0x21')](handleEntityNotFound(_0x5e0088,null))[_0x8fcf('0x21')](function(_0x3dc1af){if(_0x3dc1af){_0x34a8de[_0x8fcf('0x2a')]=_0x3dc1af['get']({'plain':!![]});return db[_0x8fcf('0x5f')][_0x8fcf('0x55')]({'where':{'id':_0x3dc1af[_0x8fcf('0x60')]}});}return null;})[_0x8fcf('0x21')](handleEntityNotFound(_0x5e0088,null))[_0x8fcf('0x21')](function(_0x548d4e){if(_0x548d4e){_0x34a8de[_0x8fcf('0x67')]=_0x548d4e[_0x8fcf('0x5e')]({'plain':!![]});interaction_log['info'](_0x8fcf('0x79'),_0x4eda2d[_0x8fcf('0x65')]['id'],_0x4eda2d[_0x8fcf('0x65')][_0x8fcf('0x37')],_0x4eda2d[_0x8fcf('0x65')][_0x8fcf('0x66')],_0x34a8de[_0x8fcf('0x67')]['id'],_0x4eda2d[_0x8fcf('0x56')]?JSON['stringify'](_0x4eda2d[_0x8fcf('0x56')]):_0x8fcf('0x68'));return respondWithRpcPromise(_0x8fcf('0x7a'),_0x8fcf('0x7b'),_0x34a8de);}return null;})['then'](function(_0xae55e2){var _0x496703=_0x8fcf('0x7c')+_0xae55e2[_0x8fcf('0x2a')][_0x8fcf('0x7d')];return db[_0x8fcf('0x6b')][_0x8fcf('0x3e')](_0x496703,{'type':db['Sequelize'][_0x8fcf('0x6d')][_0x8fcf('0x6e')],'raw':!![]})[_0x8fcf('0x21')](function(_0x561eb9){return _0x561eb9;});})['then'](function(_0x31b7d3){if(_0x31b7d3){_0x34a8de[_0x8fcf('0x2a')][_0x8fcf('0x6f')]=_0x31b7d3[0x0];if(!_0x4eda2d[_0x8fcf('0x56')][_0x8fcf('0x5c')])return;return db[_0x8fcf('0x70')][_0x8fcf('0x55')]({'where':{'id':_0x4eda2d[_0x8fcf('0x56')][_0x8fcf('0x5c')],'role':_0x8fcf('0x5d')},'attributes':['id',_0x8fcf('0x37'),_0x8fcf('0x71'),_0x8fcf('0x72'),'internal'],'raw':!![]});}return null;})['then'](function(_0x140ce5){if(!_0x140ce5)return null;_0x34a8de[_0x8fcf('0x2a')][_0x8fcf('0x5d')]=_0x140ce5;return _0x34a8de;})['then'](function(_0x11782c){if(_0x11782c){_0x11782c[_0x8fcf('0x2a')][_0x8fcf('0x74')]=util[_0x8fcf('0x5a')](_0x8fcf('0x7e'),_0x4eda2d['user'][_0x8fcf('0x37')]);_0x11782c[_0x8fcf('0x2a')]['channel']=_0x34a8de['channel'];_0x11782c[_0x8fcf('0x2a')][_0x8fcf('0x7f')]=_0x8fcf('0x33');respondWithRpcPromise(_0x8fcf('0x76'),_0x8fcf('0x76'),{'event':_0x8fcf('0x80'),'message':_0x11782c['message']},client9002);return _0x34a8de;}return null;})[_0x8fcf('0x21')](respondWithResult(_0x5e0088,null))[_0x8fcf('0x2b')](handleError(_0x5e0088,null));};exports['status']=function(_0x2de87b,_0x46ce5c,_0x9c331){if(_0x2de87b[_0x8fcf('0x56')]['id']){delete _0x2de87b[_0x8fcf('0x56')]['id'];}var _0x37461d;return db['WhatsappMessage']['find']({'where':{'id':_0x2de87b[_0x8fcf('0x54')]['id']}})[_0x8fcf('0x21')](handleEntityNotFound(_0x46ce5c,null))[_0x8fcf('0x21')](function(_0x175ec3){if(_0x175ec3){_0x37461d=_0x175ec3;return db[_0x8fcf('0x81')]['find']({'where':{'id':_0x175ec3[_0x8fcf('0x82')]}});}})[_0x8fcf('0x21')](handleEntityNotFound(_0x46ce5c,null))[_0x8fcf('0x21')](function(_0x3903ae){if(_0x3903ae){logger[_0x8fcf('0x24')](_0x8fcf('0x83'),'status','received\x20delivery\x20report\x20from',_0x3903ae[_0x8fcf('0x3b')],util[_0x8fcf('0x84')](_0x2de87b[_0x8fcf('0x56')],{'showHidden':![],'depth':null}));switch(_0x3903ae[_0x8fcf('0x3b')]){case _0x8fcf('0x85'):if(_0x2de87b[_0x8fcf('0x56')][_0x8fcf('0x86')]&&_0x2de87b['body'][_0x8fcf('0x86')]===_0x37461d[_0x8fcf('0x87')]&&_0x2de87b[_0x8fcf('0x56')][_0x8fcf('0x88')]&&_0x2de87b[_0x8fcf('0x56')][_0x8fcf('0x88')]===_0x8fcf('0x59')){return _0x37461d[_0x8fcf('0x61')]({'read':!![]});}else{logger[_0x8fcf('0x28')](_0x8fcf('0x89'),_0x8fcf('0x2e'),_0x8fcf('0x85'),util[_0x8fcf('0x84')](_0x2de87b['body'],{'showHidden':![],'depth':null}));}break;}return _0x37461d;}})[_0x8fcf('0x21')](respondWithResult(_0x46ce5c,null))[_0x8fcf('0x2b')](handleError(_0x46ce5c,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index c70c8d9..8dac17d 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 _0x63a5=['WhatsappMessage','save','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x301d99,_0x4b455a){var _0x17ccf6=function(_0x39f935){while(--_0x39f935){_0x301d99['push'](_0x301d99['shift']());}};_0x17ccf6(++_0x4b455a);}(_0x63a5,0x18e));var _0x563a=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x63a5[_0x36c5b0];return _0xf19333;};'use strict';var EventEmitter=require(_0x563a('0x0'));var WhatsappMessage=require(_0x563a('0x1'))['db'][_0x563a('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x563a('0x3'),'afterUpdate':'update','afterDestroy':_0x563a('0x4')};function emitEvent(_0x13195e){return function(_0x386400,_0x37e617,_0x5c2a8d){WhatsappMessageEvents['emit'](_0x13195e+':'+_0x386400['id'],_0x386400);WhatsappMessageEvents[_0x563a('0x5')](_0x13195e,_0x386400);_0x5c2a8d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage[_0x563a('0x6')](e,emitEvent(event));}}module[_0x563a('0x7')]=WhatsappMessageEvents; \ No newline at end of file +var _0xdac7=['../../mysqldb','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xdac7,0x180));var _0x7dac=function(_0x37a6c4,_0x2aa811){_0x37a6c4=_0x37a6c4-0x0;var _0x4eaead=_0xdac7[_0x37a6c4];return _0x4eaead;};'use strict';var EventEmitter=require(_0x7dac('0x0'));var WhatsappMessage=require(_0x7dac('0x1'))['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x7dac('0x2'),'afterDestroy':_0x7dac('0x3')};function emitEvent(_0x10eadc){return function(_0x3c4806,_0x56d2ac,_0x4f55eb){WhatsappMessageEvents['emit'](_0x10eadc+':'+_0x3c4806['id'],_0x3c4806);WhatsappMessageEvents[_0x7dac('0x4')](_0x10eadc,_0x3c4806);_0x4f55eb(null);};}for(var e in events){if(events[_0x7dac('0x5')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0x7dac('0x6')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index e273edd..9a3b24b 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 _0xc951=['request-promise','path','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','models','get','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','findOne','then','update','createdAt','catch','error','WhatsappAccountId','type','twilio','authToken','phone','accountSid','messages','create','whatsapp:','remote','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment'];(function(_0x54a8be,_0x586c4e){var _0x5a2dc1=function(_0x4c07b2){while(--_0x4c07b2){_0x54a8be['push'](_0x54a8be['shift']());}};_0x5a2dc1(++_0x586c4e);}(_0xc951,0x1a3));var _0x1c95=function(_0x262cee,_0x34e3df){_0x262cee=_0x262cee-0x0;var _0x5324a1=_0xc951[_0x262cee];return _0x5324a1;};'use strict';var _=require('lodash');var util=require(_0x1c95('0x0'));var logger=require(_0x1c95('0x1'))(_0x1c95('0x2'));var moment=require(_0x1c95('0x3'));var BPromise=require('bluebird');var rp=require(_0x1c95('0x4'));var fs=require('fs');var path=require(_0x1c95('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./whatsappMessage.attributes');module[_0x1c95('0x6')]=function(_0x1c2648,_0x4cc66b){return _0x1c2648[_0x1c95('0x7')](_0x1c95('0x8'),attributes,{'tableName':_0x1c95('0x9'),'paranoid':![],'indexes':[{'name':_0x1c95('0xa'),'fields':[_0x1c95('0xa')]},{'name':_0x1c95('0xb'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2aa215,_0x9b6c4c,_0x2e128a){var _0x197a5e=_0x1c2648[_0x1c95('0xc')];var _0x3cf942=_0x2aa215[_0x1c95('0xd')]({'plain':!![]});if(_0x3cf942[_0x1c95('0xe')][_0x1c95('0xf')]()==='in'||_0x3cf942[_0x1c95('0xe')][_0x1c95('0xf')]()===_0x1c95('0x10')&&!_0x3cf942[_0x1c95('0x11')]&&!_[_0x1c95('0x12')](_0x3cf942[_0x1c95('0x13')])){_0x197a5e[_0x1c95('0x14')][_0x1c95('0x15')]({'where':{'id':_0x3cf942['WhatsappInteractionId']}})[_0x1c95('0x16')](function(_0xb3a944){if(_0xb3a944){_0xb3a944[_0x1c95('0x17')]({'lastMsgAt':_0x3cf942[_0x1c95('0x18')],'lastMsgDirection':_0x3cf942['direction']['toLowerCase']()});}})[_0x1c95('0x19')](function(_0x145e66){console[_0x1c95('0x1a')](_0x145e66);});}if(_0x3cf942[_0x1c95('0xe')]===_0x1c95('0x10')&&!_0x3cf942['secret']){var _0x5438bd;_0x197a5e['WhatsappAccount']['find']({'where':{'id':_0x3cf942[_0x1c95('0x1b')]},'raw':!![]})[_0x1c95('0x16')](function(_0x1ca178){_0x5438bd=_0x1ca178;if(_0x5438bd&&_0x5438bd[_0x1c95('0x1c')]){switch(_0x5438bd[_0x1c95('0x1c')]){case _0x1c95('0x1d'):var _0x5e2a59=require(_0x1c95('0x1d'));if(_0x5438bd['accountSid']&&_0x5438bd[_0x1c95('0x1e')]&&_0x5438bd[_0x1c95('0x1f')]){var _0x53a587=new _0x5e2a59(_0x5438bd[_0x1c95('0x20')],_0x5438bd[_0x1c95('0x1e')]);_0x53a587[_0x1c95('0x21')][_0x1c95('0x22')]({'body':_0x3cf942['body'],'to':_0x1c95('0x23')+_0x3cf942[_0x1c95('0x1f')],'from':'whatsapp:'+_0x5438bd[_0x1c95('0x1f')],'statusCallback':_0x5438bd[_0x1c95('0x24')]+'/api/whatsapp/messages/'+_0x3cf942['id']+_0x1c95('0x25')+_0x5438bd[_0x1c95('0x26')]})[_0x1c95('0x16')](function(_0x48fc60){if(_0x48fc60['sid']){return _0x2aa215[_0x1c95('0x17')]({'messageId':_0x48fc60[_0x1c95('0x27')]});}})[_0x1c95('0x19')](function(_0x4233a8){logger[_0x1c95('0x1a')](_0x1c95('0x28'),_0x1c95('0x29'),_0x1c95('0x1d'),util[_0x1c95('0x2a')](_0x4233a8,{'showHidden':![],'depth':null}));});}else{logger[_0x1c95('0x1a')](_0x1c95('0x28'),_0x1c95('0x29'),_0x1c95('0x1d'),_0x1c95('0x2b'));}break;}}})[_0x1c95('0x2c')](function(){_0x2e128a();});}else{_0x2e128a();}}},'charset':_0x1c95('0x2d'),'collate':_0x1c95('0x2e')});}; \ No newline at end of file +var _0xffdf=['messageId','body','FULLTEXT','models','get','toLowerCase','out','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','direction','catch','secret','find','WhatsappAccountId','type','twilio','authToken','phone','accountSid','whatsapp:','/api/whatsapp/messages/','/status?token=','token','sid','error','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','lodash','util','../../config/logger','moment','bluebird','../../config/environment','./whatsappMessage.attributes','WhatsappMessage','whatsapp_messages'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xffdf,0x7e));var _0xfffd=function(_0x28d252,_0x160cb9){_0x28d252=_0x28d252-0x0;var _0x48d8cb=_0xffdf[_0x28d252];return _0x48d8cb;};'use strict';var _=require(_0xfffd('0x0'));var util=require(_0xfffd('0x1'));var logger=require(_0xfffd('0x2'))('api');var moment=require(_0xfffd('0x3'));var BPromise=require(_0xfffd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xfffd('0x5'));var attributes=require(_0xfffd('0x6'));module['exports']=function(_0x5d58c0,_0x38d2c4){return _0x5d58c0['define'](_0xfffd('0x7'),attributes,{'tableName':_0xfffd('0x8'),'paranoid':![],'indexes':[{'name':_0xfffd('0x9'),'fields':[_0xfffd('0x9')]},{'name':'fti_whatsapp_messages','fields':[_0xfffd('0xa')],'type':_0xfffd('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2c6780,_0x1e4872,_0x4a523f){var _0x5c5da6=_0x5d58c0[_0xfffd('0xc')];var _0x517273=_0x2c6780[_0xfffd('0xd')]({'plain':!![]});if(_0x517273['direction'][_0xfffd('0xe')]()==='in'||_0x517273['direction'][_0xfffd('0xe')]()===_0xfffd('0xf')&&!_0x517273['secret']&&!_[_0xfffd('0x10')](_0x517273[_0xfffd('0x11')])){_0x5c5da6[_0xfffd('0x12')][_0xfffd('0x13')]({'where':{'id':_0x517273[_0xfffd('0x14')]}})[_0xfffd('0x15')](function(_0x54e33d){if(_0x54e33d){_0x54e33d[_0xfffd('0x16')]({'lastMsgAt':_0x517273[_0xfffd('0x17')],'lastMsgDirection':_0x517273[_0xfffd('0x18')][_0xfffd('0xe')]()});}})[_0xfffd('0x19')](function(_0x16e4b0){console['error'](_0x16e4b0);});}if(_0x517273['direction']===_0xfffd('0xf')&&!_0x517273[_0xfffd('0x1a')]){var _0x3e8ed7;_0x5c5da6['WhatsappAccount'][_0xfffd('0x1b')]({'where':{'id':_0x517273[_0xfffd('0x1c')]},'raw':!![]})['then'](function(_0x179127){_0x3e8ed7=_0x179127;if(_0x3e8ed7&&_0x3e8ed7[_0xfffd('0x1d')]){switch(_0x3e8ed7[_0xfffd('0x1d')]){case'twilio':var _0x2189dc=require(_0xfffd('0x1e'));if(_0x3e8ed7['accountSid']&&_0x3e8ed7[_0xfffd('0x1f')]&&_0x3e8ed7[_0xfffd('0x20')]){var _0x5eaeca=new _0x2189dc(_0x3e8ed7[_0xfffd('0x21')],_0x3e8ed7[_0xfffd('0x1f')]);_0x5eaeca['messages']['create']({'body':_0x517273[_0xfffd('0xa')],'to':'whatsapp:'+_0x517273[_0xfffd('0x20')],'from':_0xfffd('0x22')+_0x3e8ed7[_0xfffd('0x20')],'statusCallback':_0x3e8ed7['remote']+_0xfffd('0x23')+_0x517273['id']+_0xfffd('0x24')+_0x3e8ed7[_0xfffd('0x25')]})[_0xfffd('0x15')](function(_0x10249f){if(_0x10249f[_0xfffd('0x26')]){return _0x2c6780[_0xfffd('0x16')]({'messageId':_0x10249f['sid']});}})['catch'](function(_0x364760){logger[_0xfffd('0x27')](_0xfffd('0x28'),_0xfffd('0x29'),_0xfffd('0x1e'),util[_0xfffd('0x2a')](_0x364760,{'showHidden':![],'depth':null}));});}else{logger['error']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xfffd('0x29'),_0xfffd('0x1e'),_0xfffd('0x2b'));}break;}}})[_0xfffd('0x2c')](function(){_0x4a523f();});}else{_0x4a523f();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index ccb58c8..a87ca40 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 _0x36e7=['CreateWhatsappMessage','create','body','options','then','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','info','debug','request\x20sent','stringify','error','WhatsappMessage,\x20%s,\x20%s','message','result','catch'];(function(_0x31e142,_0x41d7af){var _0x199fd6=function(_0x269d2f){while(--_0x269d2f){_0x31e142['push'](_0x31e142['shift']());}};_0x199fd6(++_0x41d7af);}(_0x36e7,0x17e));var _0x736e=function(_0xe943c6,_0x547fe6){_0xe943c6=_0xe943c6-0x0;var _0x46aa75=_0x36e7[_0xe943c6];return _0x46aa75;};'use strict';var _=require(_0x736e('0x0'));var util=require(_0x736e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x736e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x736e('0x3'))['db'];var utils=require(_0x736e('0x4'));var logger=require(_0x736e('0x5'))('rpc');var config=require(_0x736e('0x6'));var jayson=require(_0x736e('0x7'));var client=jayson[_0x736e('0x8')]['http']({'port':0x232a});config[_0x736e('0x9')]=_[_0x736e('0xa')](config[_0x736e('0x9')],{'host':_0x736e('0xb'),'port':0x18eb});var socket=require(_0x736e('0xc'))(new Redis(config['redis']));require(_0x736e('0xd'))[_0x736e('0xe')](socket);function respondWithRpcPromise(_0x440718,_0x393f0b,_0x1e1aa9){return new BPromise(function(_0x240dfd,_0x54669c){return client['request'](_0x440718,_0x1e1aa9)['then'](function(_0x5aab26){logger[_0x736e('0xf')]('WhatsappMessage,\x20%s,\x20%s',_0x393f0b,'request\x20sent');logger[_0x736e('0x10')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x393f0b,_0x736e('0x11'),JSON[_0x736e('0x12')](_0x5aab26));if(_0x5aab26[_0x736e('0x13')]){if(_0x5aab26[_0x736e('0x13')]['code']===0x1f4){logger[_0x736e('0x13')](_0x736e('0x14'),_0x393f0b,_0x5aab26[_0x736e('0x13')]['message']);return _0x54669c(_0x5aab26[_0x736e('0x13')][_0x736e('0x15')]);}logger[_0x736e('0x13')](_0x736e('0x14'),_0x393f0b,_0x5aab26[_0x736e('0x13')][_0x736e('0x15')]);return _0x240dfd(_0x5aab26[_0x736e('0x13')][_0x736e('0x15')]);}else{logger[_0x736e('0xf')](_0x736e('0x14'),_0x393f0b,_0x736e('0x11'));_0x240dfd(_0x5aab26[_0x736e('0x16')]['message']);}})[_0x736e('0x17')](function(_0x1897e3){logger[_0x736e('0x13')](_0x736e('0x14'),_0x393f0b,_0x1897e3);_0x54669c(_0x1897e3);});});}exports[_0x736e('0x18')]=function(_0x2b04aa){var _0x5167cd=this;return new Promise(function(_0x20e7b4,_0x53bf07){return db['WhatsappMessage'][_0x736e('0x19')](_0x2b04aa[_0x736e('0x1a')],{'raw':_0x2b04aa[_0x736e('0x1b')]?_0x2b04aa['options']['raw']===undefined?!![]:![]:!![]})[_0x736e('0x1c')](function(_0x44ba46){logger[_0x736e('0xf')](_0x736e('0x18'),_0x2b04aa);logger[_0x736e('0x10')]('CreateWhatsappMessage',_0x2b04aa,JSON[_0x736e('0x12')](_0x44ba46));_0x20e7b4(_0x44ba46);})[_0x736e('0x17')](function(_0x18c028){logger['error'](_0x736e('0x18'),_0x18c028[_0x736e('0x15')],_0x2b04aa);_0x53bf07(_0x5167cd[_0x736e('0x13')](0x1f4,_0x18c028['message']));});});}; \ No newline at end of file +var _0xf69e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','then','info','request\x20sent','debug','stringify','error','message','WhatsappMessage,\x20%s,\x20%s','result','catch','CreateWhatsappMessage','WhatsappMessage','body','options','raw','lodash','util','bluebird'];(function(_0x2a1ff7,_0x4e44cb){var _0x168537=function(_0x45ed52){while(--_0x45ed52){_0x2a1ff7['push'](_0x2a1ff7['shift']());}};_0x168537(++_0x4e44cb);}(_0xf69e,0xdd));var _0xef69=function(_0x52fea9,_0x52e709){_0x52fea9=_0x52fea9-0x0;var _0x13780d=_0xf69e[_0x52fea9];return _0x13780d;};'use strict';var _=require(_0xef69('0x0'));var util=require(_0xef69('0x1'));var moment=require('moment');var BPromise=require(_0xef69('0x2'));var rs=require(_0xef69('0x3'));var fs=require('fs');var Redis=require(_0xef69('0x4'));var db=require(_0xef69('0x5'))['db'];var utils=require(_0xef69('0x6'));var logger=require(_0xef69('0x7'))('rpc');var config=require(_0xef69('0x8'));var jayson=require(_0xef69('0x9'));var client=jayson[_0xef69('0xa')][_0xef69('0xb')]({'port':0x232a});config[_0xef69('0xc')]=_[_0xef69('0xd')](config['redis'],{'host':_0xef69('0xe'),'port':0x18eb});var socket=require(_0xef69('0xf'))(new Redis(config[_0xef69('0xc')]));require(_0xef69('0x10'))['register'](socket);function respondWithRpcPromise(_0x2f46ed,_0x1c3e29,_0x727bd4){return new BPromise(function(_0x3e68d0,_0x3fcb8e){return client['request'](_0x2f46ed,_0x727bd4)[_0xef69('0x11')](function(_0xcc9b3b){logger[_0xef69('0x12')]('WhatsappMessage,\x20%s,\x20%s',_0x1c3e29,_0xef69('0x13'));logger[_0xef69('0x14')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x1c3e29,_0xef69('0x13'),JSON[_0xef69('0x15')](_0xcc9b3b));if(_0xcc9b3b[_0xef69('0x16')]){if(_0xcc9b3b[_0xef69('0x16')]['code']===0x1f4){logger[_0xef69('0x16')]('WhatsappMessage,\x20%s,\x20%s',_0x1c3e29,_0xcc9b3b[_0xef69('0x16')][_0xef69('0x17')]);return _0x3fcb8e(_0xcc9b3b[_0xef69('0x16')][_0xef69('0x17')]);}logger[_0xef69('0x16')](_0xef69('0x18'),_0x1c3e29,_0xcc9b3b[_0xef69('0x16')][_0xef69('0x17')]);return _0x3e68d0(_0xcc9b3b[_0xef69('0x16')][_0xef69('0x17')]);}else{logger[_0xef69('0x12')]('WhatsappMessage,\x20%s,\x20%s',_0x1c3e29,_0xef69('0x13'));_0x3e68d0(_0xcc9b3b[_0xef69('0x19')][_0xef69('0x17')]);}})[_0xef69('0x1a')](function(_0x5e660c){logger[_0xef69('0x16')]('WhatsappMessage,\x20%s,\x20%s',_0x1c3e29,_0x5e660c);_0x3fcb8e(_0x5e660c);});});}exports[_0xef69('0x1b')]=function(_0x16b2cd){var _0x361b85=this;return new Promise(function(_0x5cc5fd,_0x68d546){return db[_0xef69('0x1c')]['create'](_0x16b2cd[_0xef69('0x1d')],{'raw':_0x16b2cd[_0xef69('0x1e')]?_0x16b2cd[_0xef69('0x1e')][_0xef69('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x20ab0e){logger['info'](_0xef69('0x1b'),_0x16b2cd);logger['debug'](_0xef69('0x1b'),_0x16b2cd,JSON['stringify'](_0x20ab0e));_0x5cc5fd(_0x20ab0e);})[_0xef69('0x1a')](function(_0x5f4b1f){logger[_0xef69('0x16')](_0xef69('0x1b'),_0x5f4b1f[_0xef69('0x17')],_0x16b2cd);_0x68d546(_0x361b85[_0xef69('0x16')](0x1f4,_0x5f4b1f[_0xef69('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 7488a9c..c2f2a01 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 _0x8947=['removeListener','register','length','whatsappMessage:','./whatsappMessage.events','save','update','emit'];(function(_0x33bef4,_0x11be16){var _0x318bea=function(_0x50bcef){while(--_0x50bcef){_0x33bef4['push'](_0x33bef4['shift']());}};_0x318bea(++_0x11be16);}(_0x8947,0xcc));var _0x7894=function(_0x1cb74c,_0x248486){_0x1cb74c=_0x1cb74c-0x0;var _0x511253=_0x8947[_0x1cb74c];return _0x511253;};'use strict';var WhatsappMessageEvents=require(_0x7894('0x0'));var events=[_0x7894('0x1'),'remove',_0x7894('0x2')];function createListener(_0x176f6b,_0x9805a4){return function(_0x1da098){_0x9805a4[_0x7894('0x3')](_0x176f6b,_0x1da098);};}function removeListener(_0x16f4ce,_0x412c30){return function(){WhatsappMessageEvents[_0x7894('0x4')](_0x16f4ce,_0x412c30);};}exports[_0x7894('0x5')]=function(_0x554a99){for(var _0x563075=0x0,_0x28664c=events[_0x7894('0x6')];_0x563075<_0x28664c;_0x563075++){var _0x2b1e94=events[_0x563075];var _0x3919c8=createListener(_0x7894('0x7')+_0x2b1e94,_0x554a99);WhatsappMessageEvents['on'](_0x2b1e94,_0x3919c8);}}; \ No newline at end of file +var _0x9d90=['length','whatsappMessage:','./whatsappMessage.events','save','remove','update','removeListener','register'];(function(_0x188bc5,_0xbf6b79){var _0x6a51ca=function(_0x127a8f){while(--_0x127a8f){_0x188bc5['push'](_0x188bc5['shift']());}};_0x6a51ca(++_0xbf6b79);}(_0x9d90,0x82));var _0x09d9=function(_0x4258c1,_0x1214fe){_0x4258c1=_0x4258c1-0x0;var _0x16403f=_0x9d90[_0x4258c1];return _0x16403f;};'use strict';var WhatsappMessageEvents=require(_0x09d9('0x0'));var events=[_0x09d9('0x1'),_0x09d9('0x2'),_0x09d9('0x3')];function createListener(_0x787f7,_0x3b6bd5){return function(_0x3c68b9){_0x3b6bd5['emit'](_0x787f7,_0x3c68b9);};}function removeListener(_0x9ccfc1,_0x6b7a36){return function(){WhatsappMessageEvents[_0x09d9('0x4')](_0x9ccfc1,_0x6b7a36);};}exports[_0x09d9('0x5')]=function(_0x3c2f23){for(var _0x1f79ca=0x0,_0x2ccfaf=events[_0x09d9('0x6')];_0x1f79ca<_0x2ccfaf;_0x1f79ca++){var _0x529829=events[_0x1f79ca];var _0x17eb51=createListener(_0x09d9('0x7')+_0x529829,_0x3c2f23);WhatsappMessageEvents['on'](_0x529829,_0x17eb51);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index aeb14ce..3533719 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 _0xdeac=['removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','put','/:id','delete','destroy'];(function(_0x4ee7b1,_0x20d16b){var _0x53d343=function(_0x3d0c72){while(--_0x3d0c72){_0x4ee7b1['push'](_0x4ee7b1['shift']());}};_0x53d343(++_0x20d16b);}(_0xdeac,0xfa));var _0xcdea=function(_0x3a10c8,_0x2c31be){_0x3a10c8=_0x3a10c8-0x0;var _0x375d0b=_0xdeac[_0x3a10c8];return _0x375d0b;};'use strict';var multer=require(_0xcdea('0x0'));var util=require(_0xcdea('0x1'));var path=require(_0xcdea('0x2'));var timeout=require(_0xcdea('0x3'));var express=require(_0xcdea('0x4'));var router=express[_0xcdea('0x5')]();var fs_extra=require(_0xcdea('0x6'));var auth=require(_0xcdea('0x7'));var interaction=require(_0xcdea('0x8'));var config=require(_0xcdea('0x9'));var controller=require('./whatsappQueue.controller');router[_0xcdea('0xa')]('/',auth[_0xcdea('0xb')](),controller[_0xcdea('0xc')]);router['get'](_0xcdea('0xd'),auth['isAuthenticated'](),controller[_0xcdea('0xe')]);router[_0xcdea('0xa')]('/:id',auth[_0xcdea('0xb')](),controller[_0xcdea('0xf')]);router[_0xcdea('0xa')](_0xcdea('0x10'),auth['isAuthenticated'](),controller[_0xcdea('0x11')]);router[_0xcdea('0xa')]('/:id/teams',auth[_0xcdea('0xb')](),controller[_0xcdea('0x12')]);router[_0xcdea('0xa')](_0xcdea('0x13'),auth[_0xcdea('0xb')](),controller[_0xcdea('0x14')]);router[_0xcdea('0x15')]('/',auth['isAuthenticated'](),controller[_0xcdea('0x16')]);router[_0xcdea('0x15')](_0xcdea('0x17'),auth[_0xcdea('0xb')](),controller[_0xcdea('0x18')]);router[_0xcdea('0x15')](_0xcdea('0x13'),auth[_0xcdea('0xb')](),controller['addAgents']);router[_0xcdea('0x19')](_0xcdea('0x1a'),auth['isAuthenticated'](),controller['update']);router[_0xcdea('0x1b')]('/:id',auth[_0xcdea('0xb')](),controller[_0xcdea('0x1c')]);router[_0xcdea('0x1b')]('/:id/teams',auth[_0xcdea('0xb')](),controller['removeTeams']);router[_0xcdea('0x1b')](_0xcdea('0x13'),auth[_0xcdea('0xb')](),controller[_0xcdea('0x1d')]);module[_0xcdea('0x1e')]=router; \ No newline at end of file +var _0x7e9f=['show','/:id/members','/:id/teams','/:id/users','getAgents','post','addTeams','addAgents','put','update','delete','/:id','destroy','removeTeams','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x7e9f,0xcc));var _0xf7e9=function(_0x36fc4c,_0x4f5126){_0x36fc4c=_0x36fc4c-0x0;var _0x266bc6=_0x7e9f[_0x36fc4c];return _0x266bc6;};'use strict';var multer=require(_0xf7e9('0x0'));var util=require(_0xf7e9('0x1'));var path=require(_0xf7e9('0x2'));var timeout=require(_0xf7e9('0x3'));var express=require('express');var router=express[_0xf7e9('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf7e9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf7e9('0x6'));var controller=require('./whatsappQueue.controller');router[_0xf7e9('0x7')]('/',auth[_0xf7e9('0x8')](),controller[_0xf7e9('0x9')]);router['get'](_0xf7e9('0xa'),auth['isAuthenticated'](),controller[_0xf7e9('0xb')]);router['get']('/:id',auth[_0xf7e9('0x8')](),controller[_0xf7e9('0xc')]);router[_0xf7e9('0x7')](_0xf7e9('0xd'),auth['isAuthenticated'](),controller['getMembers']);router[_0xf7e9('0x7')](_0xf7e9('0xe'),auth['isAuthenticated'](),controller['getTeams']);router[_0xf7e9('0x7')](_0xf7e9('0xf'),auth[_0xf7e9('0x8')](),controller[_0xf7e9('0x10')]);router[_0xf7e9('0x11')]('/',auth[_0xf7e9('0x8')](),controller['create']);router['post'](_0xf7e9('0xe'),auth[_0xf7e9('0x8')](),controller[_0xf7e9('0x12')]);router[_0xf7e9('0x11')]('/:id/users',auth[_0xf7e9('0x8')](),controller[_0xf7e9('0x13')]);router[_0xf7e9('0x14')]('/:id',auth[_0xf7e9('0x8')](),controller[_0xf7e9('0x15')]);router[_0xf7e9('0x16')](_0xf7e9('0x17'),auth[_0xf7e9('0x8')](),controller[_0xf7e9('0x18')]);router[_0xf7e9('0x16')](_0xf7e9('0xe'),auth['isAuthenticated'](),controller[_0xf7e9('0x19')]);router['delete'](_0xf7e9('0xf'),auth[_0xf7e9('0x8')](),controller['removeAgents']);module[_0xf7e9('0x1a')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 3248aff..6f11b23 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 _0xf81a=['exports','STRING','INTEGER','ENUM','rrmemory','roundrobin','sequelize'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0xf81a,0x16b));var _0xaf81=function(_0x125c54,_0x156158){_0x125c54=_0x125c54-0x0;var _0x5006c1=_0xf81a[_0x125c54];return _0x5006c1;};'use strict';var Sequelize=require(_0xaf81('0x0'));module[_0xaf81('0x1')]={'name':{'type':Sequelize[_0xaf81('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xaf81('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xaf81('0x4')](_0xaf81('0x5'),'beepall',_0xaf81('0x6'))},'description':{'type':Sequelize[_0xaf81('0x2')]}}; \ No newline at end of file +var _0x79d8=['STRING','name','ENUM','rrmemory','roundrobin','sequelize','exports'];(function(_0x284b67,_0x1673dc){var _0x3d938e=function(_0x4e90a8){while(--_0x4e90a8){_0x284b67['push'](_0x284b67['shift']());}};_0x3d938e(++_0x1673dc);}(_0x79d8,0x67));var _0x879d=function(_0x5183fd,_0x45c719){_0x5183fd=_0x5183fd-0x0;var _0x185223=_0x79d8[_0x5183fd];return _0x185223;};'use strict';var Sequelize=require(_0x879d('0x0'));module[_0x879d('0x1')]={'name':{'type':Sequelize[_0x879d('0x2')],'unique':_0x879d('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x879d('0x4')](_0x879d('0x5'),'beepall',_0x879d('0x6'))},'description':{'type':Sequelize[_0x879d('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index e36ed83..d60119c 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 _0xcf9e=['key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','WhatsappQueue','include','show','rawAttributes','keys','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','getMembers','findOne','pick','options','UserWhatsappQueue','findAll','User','whatsappPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','Team','addTeams','ids','online','flatMap','Agents','transaction','each','findOrCreate','emit','userWhatsappQueue:save','removeTeams','select','tq.TeamId','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','toString','SELECT','every','TeamId','includes','union','compact','value','isEmpty','removeAgents','forEach','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','socket.io-emitter','./whatsappQueue.socket','register','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','get','WhatsappQueues','UserProfileResource','error','name','send','map','fieldName','type'];(function(_0x1c6958,_0x122b8d){var _0x3c63d1=function(_0x3f55e3){while(--_0x3f55e3){_0x1c6958['push'](_0x1c6958['shift']());}};_0x3c63d1(++_0x122b8d);}(_0xcf9e,0xde));var _0xecf9=function(_0x3b747b,_0x307397){_0x3b747b=_0x3b747b-0x0;var _0x59a442=_0xcf9e[_0x3b747b];return _0x59a442;};'use strict';var emlformat=require(_0xecf9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xecf9('0x1'));var jsonpatch=require(_0xecf9('0x2'));var rp=require(_0xecf9('0x3'));var moment=require('moment');var BPromise=require(_0xecf9('0x4'));var Mustache=require(_0xecf9('0x5'));var util=require(_0xecf9('0x6'));var path=require(_0xecf9('0x7'));var sox=require(_0xecf9('0x8'));var csv=require(_0xecf9('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xecf9('0xa'));var squel=require(_0xecf9('0xb'));var crypto=require(_0xecf9('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xecf9('0x9'));var querystring=require(_0xecf9('0xd'));var Papa=require(_0xecf9('0xe'));var Redis=require('ioredis');var authService=require(_0xecf9('0xf'));var qs=require(_0xecf9('0x10'));var as=require(_0xecf9('0x11'));var hardwareService=require(_0xecf9('0x12'));var logger=require(_0xecf9('0x13'))('api');var utils=require(_0xecf9('0x14'));var config=require(_0xecf9('0x15'));var licenseUtil=require(_0xecf9('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xecf9('0x17')](config[_0xecf9('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xecf9('0x19'))(new Redis(config[_0xecf9('0x18')]));require(_0xecf9('0x1a'))[_0xecf9('0x1b')](socket);function respondWithStatusCode(_0x3e3f39,_0x3e6a0c){_0x3e6a0c=_0x3e6a0c||0xcc;return function(_0xd55eb6){if(_0xd55eb6){return _0x3e3f39['sendStatus'](_0x3e6a0c);}return _0x3e3f39[_0xecf9('0x1c')](_0x3e6a0c)[_0xecf9('0x1d')]();};}function respondWithResult(_0x41c12a,_0x2452dc){_0x2452dc=_0x2452dc||0xc8;return function(_0x3276bb){if(_0x3276bb){return _0x41c12a['status'](_0x2452dc)[_0xecf9('0x1e')](_0x3276bb);}};}function respondWithFilteredResult(_0x52a7cc,_0x2c7abc){return function(_0x4e9d58){if(_0x4e9d58){var _0x5b653b=typeof _0x2c7abc[_0xecf9('0x1f')]===_0xecf9('0x20')&&typeof _0x2c7abc[_0xecf9('0x21')]===_0xecf9('0x20');var _0x13a7b8=_0x4e9d58[_0xecf9('0x22')];var _0x571c1b=_0x5b653b?0x0:_0x2c7abc[_0xecf9('0x1f')];var _0x131136=_0x5b653b?_0x4e9d58['count']:_0x2c7abc[_0xecf9('0x1f')]+_0x2c7abc[_0xecf9('0x21')];var _0x2bf2e3;if(_0x131136>=_0x13a7b8){_0x131136=_0x13a7b8;_0x2bf2e3=0xc8;}else{_0x2bf2e3=0xce;}_0x52a7cc['status'](_0x2bf2e3);return _0x52a7cc['set'](_0xecf9('0x23'),_0x571c1b+'-'+_0x131136+'/'+_0x13a7b8)['json'](_0x4e9d58);}return null;};}function patchUpdates(_0xd7ce44){return function(_0x5776b9){try{jsonpatch[_0xecf9('0x24')](_0x5776b9,_0xd7ce44,!![]);}catch(_0x2f4067){return BPromise[_0xecf9('0x25')](_0x2f4067);}return _0x5776b9[_0xecf9('0x26')]();};}function saveUpdates(_0x2f62de,_0x3ccce8){return function(_0x162c7a){if(_0x162c7a){return _0x162c7a['update'](_0x2f62de)[_0xecf9('0x27')](function(_0x2e498c){return _0x2e498c;});}return null;};}function removeEntity(_0x33742c,_0x5d601b){return function(_0x26b93b){if(_0x26b93b){return _0x26b93b[_0xecf9('0x28')]()[_0xecf9('0x27')](function(){var _0x475f57=_0x26b93b[_0xecf9('0x29')]({'plain':!![]});var _0x14fffa=_0xecf9('0x2a');return db[_0xecf9('0x2b')][_0xecf9('0x28')]({'where':{'type':_0x14fffa,'resourceId':_0x475f57['id']}})[_0xecf9('0x27')](function(){return _0x26b93b;});})[_0xecf9('0x27')](function(){_0x33742c['status'](0xcc)[_0xecf9('0x1d')]();});}};}function handleEntityNotFound(_0x1e0ccc,_0x291e8d){return function(_0x28da7e){if(!_0x28da7e){_0x1e0ccc['sendStatus'](0x194);}return _0x28da7e;};}function handleError(_0x2bd09c,_0x17827b){_0x17827b=_0x17827b||0x1f4;return function(_0x24ede9){logger[_0xecf9('0x2c')](_0x24ede9['stack']);if(_0x24ede9[_0xecf9('0x2d')]){delete _0x24ede9['name'];}_0x2bd09c[_0xecf9('0x1c')](_0x17827b)[_0xecf9('0x2e')](_0x24ede9);};}exports['index']=function(_0x153da5,_0x3bc983){var _0xc7b1a5={},_0x37f810={},_0x3a2895={'count':0x0,'rows':[]};var _0x1103cd=_[_0xecf9('0x2f')](db['WhatsappQueue']['rawAttributes'],function(_0x3e528f){return{'name':_0x3e528f[_0xecf9('0x30')],'type':_0x3e528f[_0xecf9('0x31')][_0xecf9('0x32')]};});_0x37f810['model']=_[_0xecf9('0x2f')](_0x1103cd,_0xecf9('0x2d'));_0x37f810[_0xecf9('0x33')]=_['keys'](_0x153da5['query']);_0x37f810[_0xecf9('0x34')]=_[_0xecf9('0x35')](_0x37f810[_0xecf9('0x36')],_0x37f810[_0xecf9('0x33')]);_0xc7b1a5[_0xecf9('0x37')]=_['intersection'](_0x37f810['model'],qs[_0xecf9('0x38')](_0x153da5['query']['fields']));_0xc7b1a5[_0xecf9('0x37')]=_0xc7b1a5[_0xecf9('0x37')]['length']?_0xc7b1a5[_0xecf9('0x37')]:_0x37f810[_0xecf9('0x36')];if(!_0x153da5['query'][_0xecf9('0x39')](_0xecf9('0x3a'))){_0xc7b1a5[_0xecf9('0x21')]=qs[_0xecf9('0x21')](_0x153da5[_0xecf9('0x33')][_0xecf9('0x21')]);_0xc7b1a5[_0xecf9('0x1f')]=qs[_0xecf9('0x1f')](_0x153da5[_0xecf9('0x33')][_0xecf9('0x1f')]);}_0xc7b1a5[_0xecf9('0x3b')]=qs[_0xecf9('0x3c')](_0x153da5[_0xecf9('0x33')][_0xecf9('0x3c')]);_0xc7b1a5[_0xecf9('0x3d')]=qs[_0xecf9('0x34')](_['pick'](_0x153da5[_0xecf9('0x33')],_0x37f810[_0xecf9('0x34')]),_0x1103cd);if(_0x153da5['query'][_0xecf9('0x3e')]){_0xc7b1a5[_0xecf9('0x3d')]=_[_0xecf9('0x3f')](_0xc7b1a5[_0xecf9('0x3d')],{'$or':_[_0xecf9('0x2f')](_0x1103cd,function(_0xb421c8){if(_0xb421c8['type']!==_0xecf9('0x40')){var _0x4eff1e={};_0x4eff1e[_0xb421c8[_0xecf9('0x2d')]]={'$like':'%'+_0x153da5[_0xecf9('0x33')][_0xecf9('0x3e')]+'%'};return _0x4eff1e;}})});}_0xc7b1a5=_[_0xecf9('0x3f')]({},_0xc7b1a5,_0x153da5['options']);var _0x425c29={'where':_0xc7b1a5[_0xecf9('0x3d')]};return db[_0xecf9('0x41')][_0xecf9('0x22')](_0x425c29)[_0xecf9('0x27')](function(_0x535424){_0x3a2895[_0xecf9('0x22')]=_0x535424;if(_0x153da5[_0xecf9('0x33')]['includeAll']){_0xc7b1a5[_0xecf9('0x42')]=[{'all':!![]}];}return db[_0xecf9('0x41')]['findAll'](_0xc7b1a5);})['then'](function(_0x2e42e9){_0x3a2895['rows']=_0x2e42e9;return _0x3a2895;})[_0xecf9('0x27')](respondWithFilteredResult(_0x3bc983,_0xc7b1a5))['catch'](handleError(_0x3bc983,null));};exports[_0xecf9('0x43')]=function(_0x242183,_0x1844d3){var _0x48512e={'raw':!![],'where':{'id':_0x242183['params']['id']}},_0x2cf9e7={};_0x2cf9e7['model']=_['keys'](db[_0xecf9('0x41')][_0xecf9('0x44')]);_0x2cf9e7[_0xecf9('0x33')]=_[_0xecf9('0x45')](_0x242183[_0xecf9('0x33')]);_0x2cf9e7[_0xecf9('0x34')]=_[_0xecf9('0x35')](_0x2cf9e7[_0xecf9('0x36')],_0x2cf9e7[_0xecf9('0x33')]);_0x48512e[_0xecf9('0x37')]=_[_0xecf9('0x35')](_0x2cf9e7['model'],qs['fields'](_0x242183[_0xecf9('0x33')][_0xecf9('0x38')]));_0x48512e[_0xecf9('0x37')]=_0x48512e[_0xecf9('0x37')][_0xecf9('0x46')]?_0x48512e[_0xecf9('0x37')]:_0x2cf9e7[_0xecf9('0x36')];if(_0x242183['query']['includeAll']){_0x48512e[_0xecf9('0x42')]=[{'all':!![]}];}_0x48512e=_[_0xecf9('0x3f')]({},_0x48512e,_0x242183['options']);return db[_0xecf9('0x41')][_0xecf9('0x47')](_0x48512e)['then'](handleEntityNotFound(_0x1844d3,null))['then'](respondWithResult(_0x1844d3,null))['catch'](handleError(_0x1844d3,null));};exports['create']=function(_0x365c19,_0x40f50d){return db[_0xecf9('0x41')][_0xecf9('0x48')](_0x365c19[_0xecf9('0x49')],{})[_0xecf9('0x27')](function(_0x2a6325){var _0x38f0c6=_0x365c19['user']['get']({'plain':!![]});if(!_0x38f0c6)throw new Error(_0xecf9('0x4a'));if(_0x38f0c6['role']===_0xecf9('0x4b')){var _0x41986c=_0x2a6325[_0xecf9('0x29')]({'plain':!![]});var _0x24a67a=_0xecf9('0x2a');return db[_0xecf9('0x4c')]['find']({'where':{'name':_0x24a67a,'userProfileId':_0x38f0c6[_0xecf9('0x4d')]},'raw':!![]})[_0xecf9('0x27')](function(_0x5c2d71){if(_0x5c2d71&&_0x5c2d71[_0xecf9('0x4e')]===0x0){return db[_0xecf9('0x2b')]['create']({'name':_0x41986c[_0xecf9('0x2d')],'resourceId':_0x41986c['id'],'type':_0x5c2d71[_0xecf9('0x2d')],'sectionId':_0x5c2d71['id']},{})[_0xecf9('0x27')](function(){return _0x2a6325;});}else{return _0x2a6325;}})[_0xecf9('0x4f')](function(_0x438430){logger[_0xecf9('0x2c')](_0xecf9('0x50'),_0x438430);throw _0x438430;});}return _0x2a6325;})[_0xecf9('0x27')](respondWithResult(_0x40f50d,0xc9))[_0xecf9('0x4f')](handleError(_0x40f50d,null));};exports[_0xecf9('0x51')]=function(_0x52809c,_0x1955ae){if(_0x52809c[_0xecf9('0x49')]['id']){delete _0x52809c[_0xecf9('0x49')]['id'];}return db[_0xecf9('0x41')][_0xecf9('0x47')]({'where':{'id':_0x52809c[_0xecf9('0x52')]['id']}})[_0xecf9('0x27')](handleEntityNotFound(_0x1955ae,null))[_0xecf9('0x27')](saveUpdates(_0x52809c[_0xecf9('0x49')],null))[_0xecf9('0x27')](respondWithResult(_0x1955ae,null))[_0xecf9('0x4f')](handleError(_0x1955ae,null));};exports[_0xecf9('0x28')]=function(_0xa24541,_0x2915f6){return db[_0xecf9('0x41')][_0xecf9('0x47')]({'where':{'id':_0xa24541[_0xecf9('0x52')]['id']}})[_0xecf9('0x27')](handleEntityNotFound(_0x2915f6,null))[_0xecf9('0x27')](removeEntity(_0x2915f6,null))[_0xecf9('0x4f')](handleError(_0x2915f6,null));};exports[_0xecf9('0x53')]=function(_0x263055,_0x10c5a5){return db['WhatsappQueue'][_0xecf9('0x53')]()['then'](respondWithResult(_0x10c5a5,null))['catch'](handleError(_0x10c5a5,null));};exports[_0xecf9('0x54')]=function(_0x143d53,_0x436795,_0x43f8c1){var _0x57275c={'raw':!![],'where':{}},_0x4bbc6d={},_0x279bf1;return db['WhatsappQueue'][_0xecf9('0x55')]({'where':{'id':_0x143d53[_0xecf9('0x52')]['id']}})[_0xecf9('0x27')](handleEntityNotFound(_0x436795,null))[_0xecf9('0x27')](function(_0x2aa4d2){if(_0x2aa4d2){_0x279bf1=_0x2aa4d2[_0xecf9('0x29')]({'plain':!![]});_0x4bbc6d[_0xecf9('0x36')]=_[_0xecf9('0x45')](db['UserWhatsappQueue'][_0xecf9('0x44')]);_0x4bbc6d[_0xecf9('0x33')]=_[_0xecf9('0x45')](_0x143d53[_0xecf9('0x33')]);_0x4bbc6d['filters']=_['intersection'](_0x4bbc6d['model'],_0x4bbc6d[_0xecf9('0x33')]);_0x57275c[_0xecf9('0x37')]=_['intersection'](_0x4bbc6d[_0xecf9('0x36')],qs[_0xecf9('0x38')](_0x143d53[_0xecf9('0x33')][_0xecf9('0x38')]));_0x57275c[_0xecf9('0x37')]=_0x57275c[_0xecf9('0x37')][_0xecf9('0x46')]?_0x57275c[_0xecf9('0x37')]:_0x4bbc6d[_0xecf9('0x36')];if(!_0x143d53[_0xecf9('0x33')]['hasOwnProperty']('nolimit')){_0x57275c[_0xecf9('0x21')]=qs[_0xecf9('0x21')](_0x143d53[_0xecf9('0x33')][_0xecf9('0x21')]);_0x57275c[_0xecf9('0x1f')]=qs[_0xecf9('0x1f')](_0x143d53[_0xecf9('0x33')][_0xecf9('0x1f')]);}_0x57275c[_0xecf9('0x3b')]=qs[_0xecf9('0x3c')](_0x143d53['query'][_0xecf9('0x3c')]);_0x57275c[_0xecf9('0x3d')]=qs[_0xecf9('0x34')](_[_0xecf9('0x56')](_0x143d53['query'],_0x4bbc6d[_0xecf9('0x34')]));_0x57275c[_0xecf9('0x3d')]['WhatsappQueueId']=_0x2aa4d2['id'];if(_0x143d53[_0xecf9('0x33')][_0xecf9('0x3e')]){_0x57275c['where']=_[_0xecf9('0x3f')](_0x57275c['where'],{'$or':_[_0xecf9('0x2f')](_0x57275c['attributes'],function(_0xca2732){var _0x10fdbf={};_0x10fdbf[_0xca2732]={'$like':'%'+_0x143d53[_0xecf9('0x33')][_0xecf9('0x3e')]+'%'};return _0x10fdbf;})});}_0x57275c=_[_0xecf9('0x3f')]({},_0x57275c,_0x143d53[_0xecf9('0x57')]);return db[_0xecf9('0x58')][_0xecf9('0x59')](_0x57275c);}})[_0xecf9('0x27')](function(_0x13b7d8){if(_0x13b7d8){return db[_0xecf9('0x5a')]['findAndCountAll']({'where':{'id':_['map'](_0x13b7d8,'UserId'),'role':'agent'},'attributes':['id',_0xecf9('0x2d'),_0xecf9('0x5b'),'updatedAt',_0xecf9('0x5c')]});}})[_0xecf9('0x27')](function(_0x114a17){if(_0x114a17){return{'count':_0x114a17[_0xecf9('0x22')],'rows':_[_0xecf9('0x2f')](_0x114a17['rows'],function(_0xd7a5b2){return{'membername':_0xd7a5b2['name'],'UserId':_0xd7a5b2['id'],'queue_name':_0x279bf1[_0xecf9('0x2d')],'WhatsappQueueId':_0x279bf1['id'],'interface':util[_0xecf9('0x5d')](_0xecf9('0x5e'),_0xecf9('0x5f'),_0xd7a5b2['name']),'penalty':0x0,'paused':_0xd7a5b2[_0xecf9('0x5b')],'createdAt':_0xd7a5b2[_0xecf9('0x5c')],'updatedAt':_0xd7a5b2[_0xecf9('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xecf9('0x27')](respondWithFilteredResult(_0x436795,_0x57275c))[_0xecf9('0x4f')](handleError(_0x436795,null));};exports[_0xecf9('0x61')]=function(_0x388a80,_0x197e82,_0x11b905){var _0x591803={};var _0x1c6cf0={};var _0x20e4ce;var _0x269237;return db[_0xecf9('0x41')][_0xecf9('0x55')]({'where':{'id':_0x388a80[_0xecf9('0x52')]['id']}})[_0xecf9('0x27')](handleEntityNotFound(_0x197e82,null))[_0xecf9('0x27')](function(_0x5ad0e2){if(_0x5ad0e2){_0x20e4ce=_0x5ad0e2;_0x1c6cf0['model']=_['keys'](db[_0xecf9('0x62')][_0xecf9('0x44')]);_0x1c6cf0[_0xecf9('0x33')]=_[_0xecf9('0x45')](_0x388a80[_0xecf9('0x33')]);_0x1c6cf0[_0xecf9('0x34')]=_[_0xecf9('0x35')](_0x1c6cf0[_0xecf9('0x36')],_0x1c6cf0[_0xecf9('0x33')]);_0x591803[_0xecf9('0x37')]=_[_0xecf9('0x35')](_0x1c6cf0[_0xecf9('0x36')],qs[_0xecf9('0x38')](_0x388a80[_0xecf9('0x33')][_0xecf9('0x38')]));_0x591803['attributes']=_0x591803[_0xecf9('0x37')][_0xecf9('0x46')]?_0x591803['attributes']:_0x1c6cf0[_0xecf9('0x36')];_0x591803[_0xecf9('0x3b')]=qs[_0xecf9('0x3c')](_0x388a80[_0xecf9('0x33')][_0xecf9('0x3c')]);_0x591803[_0xecf9('0x3d')]=qs[_0xecf9('0x34')](_[_0xecf9('0x56')](_0x388a80['query'],_0x1c6cf0[_0xecf9('0x34')]));if(_0x388a80[_0xecf9('0x33')][_0xecf9('0x3e')]){_0x591803[_0xecf9('0x3d')]=_[_0xecf9('0x3f')](_0x591803['where'],{'$or':_[_0xecf9('0x2f')](_0x591803[_0xecf9('0x37')],function(_0x248ba9){var _0x467fda={};_0x467fda[_0x248ba9]={'$like':'%'+_0x388a80[_0xecf9('0x33')][_0xecf9('0x3e')]+'%'};return _0x467fda;})});}_0x591803=_[_0xecf9('0x3f')]({},_0x591803,_0x388a80[_0xecf9('0x57')]);return _0x20e4ce['getTeams'](_0x591803);}})[_0xecf9('0x27')](function(_0x4af1cd){if(_0x4af1cd){_0x269237=_0x4af1cd[_0xecf9('0x46')];if(!_0x388a80[_0xecf9('0x33')][_0xecf9('0x39')]('nolimit')){_0x591803[_0xecf9('0x21')]=qs[_0xecf9('0x21')](_0x388a80[_0xecf9('0x33')][_0xecf9('0x21')]);_0x591803[_0xecf9('0x1f')]=qs[_0xecf9('0x1f')](_0x388a80[_0xecf9('0x33')][_0xecf9('0x1f')]);}return _0x20e4ce['getTeams'](_0x591803);}})['then'](function(_0x2c7d3a){if(_0x2c7d3a){return _0x2c7d3a?{'count':_0x269237,'rows':_0x2c7d3a}:null;}})[_0xecf9('0x27')](respondWithResult(_0x197e82,null))[_0xecf9('0x4f')](handleError(_0x197e82,null));};exports[_0xecf9('0x63')]=function(_0x241650,_0x1fffbf,_0x37a835){var _0x4dfd1c=_0x241650['body'][_0xecf9('0x64')];return db[_0xecf9('0x62')][_0xecf9('0x59')]({'where':{'id':_0x4dfd1c},'attributes':['id'],'include':[{'model':db[_0xecf9('0x5a')],'as':'Agents','attributes':['id',_0xecf9('0x2d'),_0xecf9('0x65'),'voicePause','interface'],'raw':!![]}]})['then'](function(_0x4371d1){if(_0x4371d1){var _0x267ecd=_[_0xecf9('0x66')](_0x4371d1,function(_0x3cc8de){var _0x1eb60a=_0x3cc8de[_0xecf9('0x29')]({'plain':!![]});return _0x1eb60a[_0xecf9('0x67')];});return db['WhatsappQueue']['find']({'where':{'id':_0x241650[_0xecf9('0x52')]['id']}})['then'](function(_0xfa3f30){return db['sequelize'][_0xecf9('0x68')](function(_0x3daa3b){return _0xfa3f30[_0xecf9('0x63')](_0x4dfd1c,{'transaction':_0x3daa3b})[_0xecf9('0x27')](function(){return BPromise[_0xecf9('0x69')](_0x267ecd,function(_0x180b1a){return db['UserWhatsappQueue'][_0xecf9('0x6a')]({'where':{'UserId':_0x180b1a['id'],'WhatsappQueueId':_0x241650[_0xecf9('0x52')]['id']},'transaction':_0x3daa3b});});})[_0xecf9('0x27')](function(){_0x267ecd['forEach'](function(_0x6a1eca){socket[_0xecf9('0x6b')](_0xecf9('0x6c'),{'UserId':_0x6a1eca['id'],'WhatsappQueueId':_0xfa3f30['id']});});});});});}})[_0xecf9('0x27')](respondWithStatusCode(_0x1fffbf,null))['catch'](handleError(_0x1fffbf,null));};exports[_0xecf9('0x6d')]=function(_0x1689d0,_0x164b2f,_0x3ab4cd){return db['Team'][_0xecf9('0x59')]({'where':{'id':_0x1689d0[_0xecf9('0x33')][_0xecf9('0x64')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xecf9('0x67'),'attributes':['id'],'raw':!![]}]})[_0xecf9('0x27')](handleEntityNotFound(_0x164b2f,null))[_0xecf9('0x27')](function(_0x2bdd5b){var _0x325340=_[_0xecf9('0x2f')](_0x2bdd5b,'id');var _0x44b480=[];var _0x531ae6=[];var _0x1c13e8=squel[_0xecf9('0x6e')]();_0x1c13e8['field'](_0xecf9('0x6f'))['from']('team_has_whatsapp_queues','tq')[_0xecf9('0x70')](_0xecf9('0x71'),'ut',_0xecf9('0x72'))[_0xecf9('0x3d')](_0xecf9('0x73'),_0x1689d0[_0xecf9('0x52')]['id']);for(var _0x3a86ae=0x0;_0x3a86ae<_0x2bdd5b[_0xecf9('0x46')];_0x3a86ae+=0x1){let _0x479490=_0x2bdd5b[_0x3a86ae];for(var _0x1c8e9d=0x0;_0x1c8e9d<_0x479490[_0xecf9('0x67')][_0xecf9('0x46')];_0x1c8e9d+=0x1){let _0x3023ab=_0x479490[_0xecf9('0x67')][_0x1c8e9d];var _0x57f572=_0x1c13e8['clone']();_0x57f572[_0xecf9('0x3d')](_0xecf9('0x74'),_0x3023ab['id']);_0x531ae6[_0xecf9('0x75')](db[_0xecf9('0x76')][_0xecf9('0x33')](_0x57f572[_0xecf9('0x77')](),{'type':db[_0xecf9('0x76')]['QueryTypes'][_0xecf9('0x78')]})[_0xecf9('0x27')](function(_0xdc3b3f){if(_0xdc3b3f['length']===0x1){return _0x3023ab['id'];}else{var _0x12249c=_[_0xecf9('0x79')](_[_0xecf9('0x2f')](_0xdc3b3f,_0xecf9('0x7a')),function(_0x222ba0){return _[_0xecf9('0x7b')](_0x325340,_0x222ba0);});if(_0x12249c){return _0x3023ab['id'];}}}));}}return BPromise['all'](_0x531ae6)[_0xecf9('0x27')](function(_0x2ef8ea){_0x44b480=_(_0x44b480)[_0xecf9('0x7c')](_0x2ef8ea)[_0xecf9('0x7d')]()[_0xecf9('0x7e')]();return db[_0xecf9('0x41')][_0xecf9('0x47')]({'where':{'id':_0x1689d0[_0xecf9('0x52')]['id']}})[_0xecf9('0x27')](function(_0x17eb69){return db[_0xecf9('0x76')][_0xecf9('0x68')](function(_0x1df839){return _0x17eb69['removeTeams'](_0x1689d0[_0xecf9('0x33')][_0xecf9('0x64')],{'transaction':_0x1df839})[_0xecf9('0x27')](function(){if(!_[_0xecf9('0x7f')](_0x44b480)){return _0x17eb69[_0xecf9('0x80')](_0x44b480,{'transaction':_0x1df839});}})['then'](function(){_0x44b480[_0xecf9('0x81')](function(_0x1b5601){socket[_0xecf9('0x6b')](_0xecf9('0x82'),{'UserId':_0x1b5601,'WhatsappQueueId':_0x17eb69['id']});});});});});});})[_0xecf9('0x27')](respondWithStatusCode(_0x164b2f,null))[_0xecf9('0x4f')](handleError(_0x164b2f,null));};exports[_0xecf9('0x83')]=function(_0x1909c7,_0x48197b,_0xf33e2f){return db['WhatsappQueue'][_0xecf9('0x47')]({'where':{'id':_0x1909c7[_0xecf9('0x52')]['id']}})[_0xecf9('0x27')](handleEntityNotFound(_0x48197b,null))['then'](function(_0x5a8203){if(_0x5a8203){return _0x5a8203[_0xecf9('0x83')](_0x1909c7[_0xecf9('0x49')][_0xecf9('0x64')],_[_0xecf9('0x84')](_0x1909c7[_0xecf9('0x49')],[_0xecf9('0x64'),'id'])||{})[_0xecf9('0x85')](function(_0xa088aa){for(var _0x4ef391=0x0;_0x4ef391<_0x1909c7['body'][_0xecf9('0x64')][_0xecf9('0x46')];_0x4ef391+=0x1){socket[_0xecf9('0x6b')]('userWhatsappQueue:save',{'UserId':Number(_0x1909c7[_0xecf9('0x49')]['ids'][_0x4ef391]),'WhatsappQueueId':Number(_0x1909c7[_0xecf9('0x52')]['id'])});}return _0xa088aa;});}})[_0xecf9('0x27')](respondWithResult(_0x48197b,null))['catch'](handleError(_0x48197b,null));};exports[_0xecf9('0x80')]=function(_0x4fafbc,_0x5618a1,_0x80a650){return db[_0xecf9('0x41')][_0xecf9('0x47')]({'where':{'id':_0x4fafbc[_0xecf9('0x52')]['id']}})[_0xecf9('0x27')](handleEntityNotFound(_0x5618a1,null))[_0xecf9('0x27')](function(_0x554d6a){if(_0x554d6a){return _0x554d6a[_0xecf9('0x80')](_0x4fafbc[_0xecf9('0x33')][_0xecf9('0x64')])[_0xecf9('0x27')](function(){if(_[_0xecf9('0x86')](_0x4fafbc['query'][_0xecf9('0x64')])){for(var _0xa71325=0x0;_0xa71325<_0x4fafbc[_0xecf9('0x33')][_0xecf9('0x64')][_0xecf9('0x46')];_0xa71325+=0x1){socket[_0xecf9('0x6b')]('userWhatsappQueue:remove',{'UserId':Number(_0x4fafbc[_0xecf9('0x33')][_0xecf9('0x64')][_0xa71325]),'WhatsappQueueId':Number(_0x4fafbc['params']['id'])});}}else{socket[_0xecf9('0x6b')](_0xecf9('0x82'),{'UserId':Number(_0x4fafbc[_0xecf9('0x33')]['ids']),'WhatsappQueueId':Number(_0x4fafbc[_0xecf9('0x52')]['id'])});}});}})[_0xecf9('0x27')](respondWithStatusCode(_0x5618a1,null))[_0xecf9('0x4f')](handleError(_0x5618a1,null));};exports[_0xecf9('0x87')]=function(_0x5c1f57,_0x49484e,_0x1750ab){var _0x48520d={};var _0x232363={};var _0x1615db;var _0x2b2da2;return db[_0xecf9('0x41')][_0xecf9('0x55')]({'where':{'id':_0x5c1f57[_0xecf9('0x52')]['id']}})[_0xecf9('0x27')](handleEntityNotFound(_0x49484e,null))[_0xecf9('0x27')](function(_0x408ca4){if(_0x408ca4){_0x1615db=_0x408ca4;_0x232363[_0xecf9('0x36')]=_[_0xecf9('0x45')](db[_0xecf9('0x5a')][_0xecf9('0x44')]);_0x232363[_0xecf9('0x33')]=_['keys'](_0x5c1f57[_0xecf9('0x33')]);_0x232363[_0xecf9('0x34')]=_[_0xecf9('0x35')](_0x232363[_0xecf9('0x36')],_0x232363[_0xecf9('0x33')]);_0x48520d[_0xecf9('0x37')]=_[_0xecf9('0x35')](_0x232363[_0xecf9('0x36')],qs[_0xecf9('0x38')](_0x5c1f57[_0xecf9('0x33')][_0xecf9('0x38')]));_0x48520d[_0xecf9('0x37')]=_0x48520d[_0xecf9('0x37')][_0xecf9('0x46')]?_0x48520d[_0xecf9('0x37')]:_0x232363[_0xecf9('0x36')];_0x48520d[_0xecf9('0x3b')]=qs['sort'](_0x5c1f57['query'][_0xecf9('0x3c')]);_0x48520d['where']=qs[_0xecf9('0x34')](_['pick'](_0x5c1f57[_0xecf9('0x33')],_0x232363[_0xecf9('0x34')]));if(_0x5c1f57[_0xecf9('0x33')][_0xecf9('0x3e')]){_0x48520d[_0xecf9('0x3d')]=_[_0xecf9('0x3f')](_0x48520d['where'],{'$or':_[_0xecf9('0x2f')](_0x48520d[_0xecf9('0x37')],function(_0x25b520){var _0x27dec5={};_0x27dec5[_0x25b520]={'$like':'%'+_0x5c1f57[_0xecf9('0x33')][_0xecf9('0x3e')]+'%'};return _0x27dec5;})});}_0x48520d=_['merge']({},_0x48520d,_0x5c1f57[_0xecf9('0x57')]);return _0x1615db['getAgents'](_0x48520d);}})[_0xecf9('0x27')](function(_0x39e669){if(_0x39e669){_0x2b2da2=_0x39e669[_0xecf9('0x46')];if(!_0x5c1f57['query']['hasOwnProperty']('nolimit')){_0x48520d[_0xecf9('0x21')]=qs['limit'](_0x5c1f57[_0xecf9('0x33')][_0xecf9('0x21')]);_0x48520d[_0xecf9('0x1f')]=qs['offset'](_0x5c1f57['query']['offset']);}return _0x1615db[_0xecf9('0x87')](_0x48520d);}})[_0xecf9('0x27')](function(_0x3113e7){if(_0x3113e7){return _0x3113e7?{'count':_0x2b2da2,'rows':_0x3113e7}:null;}})['then'](respondWithResult(_0x49484e,null))[_0xecf9('0x4f')](handleError(_0x49484e,null));}; \ No newline at end of file +var _0x3c2e=['order','sort','pick','filter','where','VIRTUAL','merge','includeAll','include','catch','params','keys','attributes','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','WhatsappQueueId','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams','Team','findAll','Agents','online','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit','ids','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','push','toString','SELECT','TeamId','includes','union','value','removeTeams','isEmpty','userWhatsappQueue:remove','addAgents','omit','spread','userWhatsappQueue:save','removeAgents','isArray','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','sendStatus','status','end','json','limit','count','offset','Content-Range','apply','save','then','destroy','get','WhatsappQueues','stack','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','length','hasOwnProperty','nolimit'];(function(_0x242b12,_0x283c5a){var _0xda5e1f=function(_0x5a629e){while(--_0x5a629e){_0x242b12['push'](_0x242b12['shift']());}};_0xda5e1f(++_0x283c5a);}(_0x3c2e,0x1e8));var _0xe3c2=function(_0xa742f6,_0x2af3ca){_0xa742f6=_0xa742f6-0x0;var _0x2885a6=_0x3c2e[_0xa742f6];return _0x2885a6;};'use strict';var emlformat=require(_0xe3c2('0x0'));var rimraf=require(_0xe3c2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe3c2('0x2'));var rp=require(_0xe3c2('0x3'));var moment=require(_0xe3c2('0x4'));var BPromise=require(_0xe3c2('0x5'));var Mustache=require('mustache');var util=require(_0xe3c2('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xe3c2('0x7'));var ejs=require(_0xe3c2('0x8'));var fs=require('fs');var fs_extra=require(_0xe3c2('0x9'));var _=require(_0xe3c2('0xa'));var squel=require('squel');var crypto=require(_0xe3c2('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xe3c2('0xc'));var toCsv=require(_0xe3c2('0x7'));var querystring=require('querystring');var Papa=require(_0xe3c2('0xd'));var Redis=require(_0xe3c2('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe3c2('0xf'));var hardwareService=require(_0xe3c2('0x10'));var logger=require('../../config/logger')(_0xe3c2('0x11'));var utils=require(_0xe3c2('0x12'));var config=require(_0xe3c2('0x13'));var licenseUtil=require(_0xe3c2('0x14'));var db=require('../../mysqldb')['db'];config[_0xe3c2('0x15')]=_['defaults'](config[_0xe3c2('0x15')],{'host':_0xe3c2('0x16'),'port':0x18eb});var socket=require(_0xe3c2('0x17'))(new Redis(config['redis']));require('./whatsappQueue.socket')['register'](socket);function respondWithStatusCode(_0x3847fc,_0x4ab0c2){_0x4ab0c2=_0x4ab0c2||0xcc;return function(_0x54b845){if(_0x54b845){return _0x3847fc[_0xe3c2('0x18')](_0x4ab0c2);}return _0x3847fc[_0xe3c2('0x19')](_0x4ab0c2)[_0xe3c2('0x1a')]();};}function respondWithResult(_0x5c4a60,_0x406784){_0x406784=_0x406784||0xc8;return function(_0x5368f2){if(_0x5368f2){return _0x5c4a60[_0xe3c2('0x19')](_0x406784)[_0xe3c2('0x1b')](_0x5368f2);}};}function respondWithFilteredResult(_0x3d442d,_0x605db0){return function(_0x4231f1){if(_0x4231f1){var _0x13dba1=typeof _0x605db0['offset']==='undefined'&&typeof _0x605db0[_0xe3c2('0x1c')]==='undefined';var _0x56a5cf=_0x4231f1[_0xe3c2('0x1d')];var _0x5ccae4=_0x13dba1?0x0:_0x605db0[_0xe3c2('0x1e')];var _0x1aa716=_0x13dba1?_0x4231f1[_0xe3c2('0x1d')]:_0x605db0['offset']+_0x605db0[_0xe3c2('0x1c')];var _0x2f076d;if(_0x1aa716>=_0x56a5cf){_0x1aa716=_0x56a5cf;_0x2f076d=0xc8;}else{_0x2f076d=0xce;}_0x3d442d[_0xe3c2('0x19')](_0x2f076d);return _0x3d442d['set'](_0xe3c2('0x1f'),_0x5ccae4+'-'+_0x1aa716+'/'+_0x56a5cf)[_0xe3c2('0x1b')](_0x4231f1);}return null;};}function patchUpdates(_0x5a67d1){return function(_0x590589){try{jsonpatch[_0xe3c2('0x20')](_0x590589,_0x5a67d1,!![]);}catch(_0x5eff78){return BPromise['reject'](_0x5eff78);}return _0x590589[_0xe3c2('0x21')]();};}function saveUpdates(_0x16c362,_0x4af338){return function(_0x4a110f){if(_0x4a110f){return _0x4a110f['update'](_0x16c362)[_0xe3c2('0x22')](function(_0x2a0a46){return _0x2a0a46;});}return null;};}function removeEntity(_0x452184,_0x28557a){return function(_0x54d33e){if(_0x54d33e){return _0x54d33e[_0xe3c2('0x23')]()[_0xe3c2('0x22')](function(){var _0x2b0016=_0x54d33e[_0xe3c2('0x24')]({'plain':!![]});var _0x4efbe8=_0xe3c2('0x25');return db['UserProfileResource'][_0xe3c2('0x23')]({'where':{'type':_0x4efbe8,'resourceId':_0x2b0016['id']}})[_0xe3c2('0x22')](function(){return _0x54d33e;});})[_0xe3c2('0x22')](function(){_0x452184[_0xe3c2('0x19')](0xcc)[_0xe3c2('0x1a')]();});}};}function handleEntityNotFound(_0x11c32e,_0x3d4a5e){return function(_0x1ec374){if(!_0x1ec374){_0x11c32e[_0xe3c2('0x18')](0x194);}return _0x1ec374;};}function handleError(_0x12ddd6,_0x1b1092){_0x1b1092=_0x1b1092||0x1f4;return function(_0x33e040){logger['error'](_0x33e040[_0xe3c2('0x26')]);if(_0x33e040[_0xe3c2('0x27')]){delete _0x33e040[_0xe3c2('0x27')];}_0x12ddd6[_0xe3c2('0x19')](_0x1b1092)[_0xe3c2('0x28')](_0x33e040);};}exports[_0xe3c2('0x29')]=function(_0x263e43,_0x5c2724){var _0x242bf3={},_0xc6aeb1={},_0x1c8ef3={'count':0x0,'rows':[]};var _0x1c1a33=_[_0xe3c2('0x2a')](db[_0xe3c2('0x2b')][_0xe3c2('0x2c')],function(_0x5c92f3){return{'name':_0x5c92f3[_0xe3c2('0x2d')],'type':_0x5c92f3[_0xe3c2('0x2e')][_0xe3c2('0x2f')]};});_0xc6aeb1[_0xe3c2('0x30')]=_[_0xe3c2('0x2a')](_0x1c1a33,_0xe3c2('0x27'));_0xc6aeb1[_0xe3c2('0x31')]=_['keys'](_0x263e43[_0xe3c2('0x31')]);_0xc6aeb1[_0xe3c2('0x32')]=_[_0xe3c2('0x33')](_0xc6aeb1[_0xe3c2('0x30')],_0xc6aeb1['query']);_0x242bf3['attributes']=_[_0xe3c2('0x33')](_0xc6aeb1[_0xe3c2('0x30')],qs['fields'](_0x263e43[_0xe3c2('0x31')][_0xe3c2('0x34')]));_0x242bf3['attributes']=_0x242bf3['attributes'][_0xe3c2('0x35')]?_0x242bf3['attributes']:_0xc6aeb1[_0xe3c2('0x30')];if(!_0x263e43[_0xe3c2('0x31')][_0xe3c2('0x36')](_0xe3c2('0x37'))){_0x242bf3['limit']=qs[_0xe3c2('0x1c')](_0x263e43['query'][_0xe3c2('0x1c')]);_0x242bf3['offset']=qs[_0xe3c2('0x1e')](_0x263e43['query'][_0xe3c2('0x1e')]);}_0x242bf3[_0xe3c2('0x38')]=qs['sort'](_0x263e43[_0xe3c2('0x31')][_0xe3c2('0x39')]);_0x242bf3['where']=qs[_0xe3c2('0x32')](_[_0xe3c2('0x3a')](_0x263e43[_0xe3c2('0x31')],_0xc6aeb1['filters']),_0x1c1a33);if(_0x263e43[_0xe3c2('0x31')][_0xe3c2('0x3b')]){_0x242bf3[_0xe3c2('0x3c')]=_['merge'](_0x242bf3[_0xe3c2('0x3c')],{'$or':_[_0xe3c2('0x2a')](_0x1c1a33,function(_0x1c5f5d){if(_0x1c5f5d[_0xe3c2('0x2e')]!==_0xe3c2('0x3d')){var _0x10dea4={};_0x10dea4[_0x1c5f5d[_0xe3c2('0x27')]]={'$like':'%'+_0x263e43[_0xe3c2('0x31')][_0xe3c2('0x3b')]+'%'};return _0x10dea4;}})});}_0x242bf3=_[_0xe3c2('0x3e')]({},_0x242bf3,_0x263e43['options']);var _0xef2c95={'where':_0x242bf3[_0xe3c2('0x3c')]};return db[_0xe3c2('0x2b')][_0xe3c2('0x1d')](_0xef2c95)[_0xe3c2('0x22')](function(_0x19b498){_0x1c8ef3[_0xe3c2('0x1d')]=_0x19b498;if(_0x263e43[_0xe3c2('0x31')][_0xe3c2('0x3f')]){_0x242bf3[_0xe3c2('0x40')]=[{'all':!![]}];}return db[_0xe3c2('0x2b')]['findAll'](_0x242bf3);})[_0xe3c2('0x22')](function(_0xc6d390){_0x1c8ef3['rows']=_0xc6d390;return _0x1c8ef3;})[_0xe3c2('0x22')](respondWithFilteredResult(_0x5c2724,_0x242bf3))[_0xe3c2('0x41')](handleError(_0x5c2724,null));};exports['show']=function(_0x5897c5,_0x350b52){var _0x4d4864={'raw':!![],'where':{'id':_0x5897c5[_0xe3c2('0x42')]['id']}},_0x240f5a={};_0x240f5a['model']=_[_0xe3c2('0x43')](db['WhatsappQueue'][_0xe3c2('0x2c')]);_0x240f5a[_0xe3c2('0x31')]=_['keys'](_0x5897c5[_0xe3c2('0x31')]);_0x240f5a[_0xe3c2('0x32')]=_['intersection'](_0x240f5a[_0xe3c2('0x30')],_0x240f5a[_0xe3c2('0x31')]);_0x4d4864['attributes']=_[_0xe3c2('0x33')](_0x240f5a['model'],qs[_0xe3c2('0x34')](_0x5897c5[_0xe3c2('0x31')]['fields']));_0x4d4864[_0xe3c2('0x44')]=_0x4d4864[_0xe3c2('0x44')][_0xe3c2('0x35')]?_0x4d4864[_0xe3c2('0x44')]:_0x240f5a[_0xe3c2('0x30')];if(_0x5897c5[_0xe3c2('0x31')][_0xe3c2('0x3f')]){_0x4d4864[_0xe3c2('0x40')]=[{'all':!![]}];}_0x4d4864=_['merge']({},_0x4d4864,_0x5897c5[_0xe3c2('0x45')]);return db[_0xe3c2('0x2b')][_0xe3c2('0x46')](_0x4d4864)['then'](handleEntityNotFound(_0x350b52,null))['then'](respondWithResult(_0x350b52,null))[_0xe3c2('0x41')](handleError(_0x350b52,null));};exports['create']=function(_0xbf3a31,_0x23d324){return db['WhatsappQueue'][_0xe3c2('0x47')](_0xbf3a31[_0xe3c2('0x48')],{})[_0xe3c2('0x22')](function(_0x21e60a){var _0x2cba07=_0xbf3a31[_0xe3c2('0x49')][_0xe3c2('0x24')]({'plain':!![]});if(!_0x2cba07)throw new Error(_0xe3c2('0x4a'));if(_0x2cba07[_0xe3c2('0x4b')]===_0xe3c2('0x49')){var _0x2774ca=_0x21e60a[_0xe3c2('0x24')]({'plain':!![]});var _0x7daba0=_0xe3c2('0x25');return db[_0xe3c2('0x4c')]['find']({'where':{'name':_0x7daba0,'userProfileId':_0x2cba07[_0xe3c2('0x4d')]},'raw':!![]})[_0xe3c2('0x22')](function(_0x2f86f0){if(_0x2f86f0&&_0x2f86f0[_0xe3c2('0x4e')]===0x0){return db['UserProfileResource'][_0xe3c2('0x47')]({'name':_0x2774ca[_0xe3c2('0x27')],'resourceId':_0x2774ca['id'],'type':_0x2f86f0[_0xe3c2('0x27')],'sectionId':_0x2f86f0['id']},{})[_0xe3c2('0x22')](function(){return _0x21e60a;});}else{return _0x21e60a;}})[_0xe3c2('0x41')](function(_0x325d7a){logger[_0xe3c2('0x4f')](_0xe3c2('0x50'),_0x325d7a);throw _0x325d7a;});}return _0x21e60a;})['then'](respondWithResult(_0x23d324,0xc9))[_0xe3c2('0x41')](handleError(_0x23d324,null));};exports['update']=function(_0x2f4088,_0x13f9b9){if(_0x2f4088[_0xe3c2('0x48')]['id']){delete _0x2f4088[_0xe3c2('0x48')]['id'];}return db[_0xe3c2('0x2b')][_0xe3c2('0x46')]({'where':{'id':_0x2f4088[_0xe3c2('0x42')]['id']}})[_0xe3c2('0x22')](handleEntityNotFound(_0x13f9b9,null))[_0xe3c2('0x22')](saveUpdates(_0x2f4088[_0xe3c2('0x48')],null))[_0xe3c2('0x22')](respondWithResult(_0x13f9b9,null))[_0xe3c2('0x41')](handleError(_0x13f9b9,null));};exports[_0xe3c2('0x23')]=function(_0x526f04,_0x1db45b){return db[_0xe3c2('0x2b')][_0xe3c2('0x46')]({'where':{'id':_0x526f04['params']['id']}})[_0xe3c2('0x22')](handleEntityNotFound(_0x1db45b,null))['then'](removeEntity(_0x1db45b,null))[_0xe3c2('0x41')](handleError(_0x1db45b,null));};exports['describe']=function(_0x391d65,_0x36e566){return db['WhatsappQueue'][_0xe3c2('0x51')]()[_0xe3c2('0x22')](respondWithResult(_0x36e566,null))[_0xe3c2('0x41')](handleError(_0x36e566,null));};exports[_0xe3c2('0x52')]=function(_0xa7c2bd,_0x586034,_0x5843b4){var _0x33f4cb={'raw':!![],'where':{}},_0x2c9c87={},_0x1d6dd0;return db[_0xe3c2('0x2b')][_0xe3c2('0x53')]({'where':{'id':_0xa7c2bd[_0xe3c2('0x42')]['id']}})[_0xe3c2('0x22')](handleEntityNotFound(_0x586034,null))[_0xe3c2('0x22')](function(_0x505539){if(_0x505539){_0x1d6dd0=_0x505539['get']({'plain':!![]});_0x2c9c87[_0xe3c2('0x30')]=_[_0xe3c2('0x43')](db[_0xe3c2('0x54')]['rawAttributes']);_0x2c9c87[_0xe3c2('0x31')]=_[_0xe3c2('0x43')](_0xa7c2bd[_0xe3c2('0x31')]);_0x2c9c87[_0xe3c2('0x32')]=_[_0xe3c2('0x33')](_0x2c9c87[_0xe3c2('0x30')],_0x2c9c87['query']);_0x33f4cb[_0xe3c2('0x44')]=_[_0xe3c2('0x33')](_0x2c9c87[_0xe3c2('0x30')],qs[_0xe3c2('0x34')](_0xa7c2bd[_0xe3c2('0x31')][_0xe3c2('0x34')]));_0x33f4cb[_0xe3c2('0x44')]=_0x33f4cb['attributes'][_0xe3c2('0x35')]?_0x33f4cb[_0xe3c2('0x44')]:_0x2c9c87[_0xe3c2('0x30')];if(!_0xa7c2bd[_0xe3c2('0x31')][_0xe3c2('0x36')]('nolimit')){_0x33f4cb[_0xe3c2('0x1c')]=qs['limit'](_0xa7c2bd['query'][_0xe3c2('0x1c')]);_0x33f4cb[_0xe3c2('0x1e')]=qs['offset'](_0xa7c2bd[_0xe3c2('0x31')][_0xe3c2('0x1e')]);}_0x33f4cb['order']=qs[_0xe3c2('0x39')](_0xa7c2bd[_0xe3c2('0x31')][_0xe3c2('0x39')]);_0x33f4cb[_0xe3c2('0x3c')]=qs['filters'](_[_0xe3c2('0x3a')](_0xa7c2bd[_0xe3c2('0x31')],_0x2c9c87[_0xe3c2('0x32')]));_0x33f4cb['where'][_0xe3c2('0x55')]=_0x505539['id'];if(_0xa7c2bd[_0xe3c2('0x31')]['filter']){_0x33f4cb[_0xe3c2('0x3c')]=_[_0xe3c2('0x3e')](_0x33f4cb['where'],{'$or':_[_0xe3c2('0x2a')](_0x33f4cb[_0xe3c2('0x44')],function(_0xaff773){var _0x1d9c56={};_0x1d9c56[_0xaff773]={'$like':'%'+_0xa7c2bd[_0xe3c2('0x31')][_0xe3c2('0x3b')]+'%'};return _0x1d9c56;})});}_0x33f4cb=_[_0xe3c2('0x3e')]({},_0x33f4cb,_0xa7c2bd[_0xe3c2('0x45')]);return db[_0xe3c2('0x54')]['findAll'](_0x33f4cb);}})['then'](function(_0x14ec28){if(_0x14ec28){return db[_0xe3c2('0x56')][_0xe3c2('0x57')]({'where':{'id':_[_0xe3c2('0x2a')](_0x14ec28,_0xe3c2('0x58')),'role':_0xe3c2('0x59')},'attributes':['id',_0xe3c2('0x27'),_0xe3c2('0x5a'),_0xe3c2('0x5b'),_0xe3c2('0x5c')]});}})[_0xe3c2('0x22')](function(_0x23f374){if(_0x23f374){return{'count':_0x23f374[_0xe3c2('0x1d')],'rows':_[_0xe3c2('0x2a')](_0x23f374['rows'],function(_0x38e194){return{'membername':_0x38e194[_0xe3c2('0x27')],'UserId':_0x38e194['id'],'queue_name':_0x1d6dd0[_0xe3c2('0x27')],'WhatsappQueueId':_0x1d6dd0['id'],'interface':util[_0xe3c2('0x5d')](_0xe3c2('0x5e'),_0xe3c2('0x5f'),_0x38e194[_0xe3c2('0x27')]),'penalty':0x0,'paused':_0x38e194[_0xe3c2('0x5a')],'createdAt':_0x38e194[_0xe3c2('0x5c')],'updatedAt':_0x38e194[_0xe3c2('0x5b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe3c2('0x22')](respondWithFilteredResult(_0x586034,_0x33f4cb))[_0xe3c2('0x41')](handleError(_0x586034,null));};exports['getTeams']=function(_0x166177,_0x25cd3e,_0xcc1ca3){var _0x214a12={};var _0x2dcd92={};var _0x7a01d3;var _0x50f003;return db[_0xe3c2('0x2b')][_0xe3c2('0x53')]({'where':{'id':_0x166177[_0xe3c2('0x42')]['id']}})[_0xe3c2('0x22')](handleEntityNotFound(_0x25cd3e,null))[_0xe3c2('0x22')](function(_0x2506db){if(_0x2506db){_0x7a01d3=_0x2506db;_0x2dcd92[_0xe3c2('0x30')]=_[_0xe3c2('0x43')](db['Team'][_0xe3c2('0x2c')]);_0x2dcd92[_0xe3c2('0x31')]=_[_0xe3c2('0x43')](_0x166177['query']);_0x2dcd92[_0xe3c2('0x32')]=_[_0xe3c2('0x33')](_0x2dcd92[_0xe3c2('0x30')],_0x2dcd92[_0xe3c2('0x31')]);_0x214a12['attributes']=_[_0xe3c2('0x33')](_0x2dcd92[_0xe3c2('0x30')],qs[_0xe3c2('0x34')](_0x166177['query'][_0xe3c2('0x34')]));_0x214a12[_0xe3c2('0x44')]=_0x214a12[_0xe3c2('0x44')][_0xe3c2('0x35')]?_0x214a12['attributes']:_0x2dcd92[_0xe3c2('0x30')];_0x214a12[_0xe3c2('0x38')]=qs[_0xe3c2('0x39')](_0x166177[_0xe3c2('0x31')]['sort']);_0x214a12[_0xe3c2('0x3c')]=qs[_0xe3c2('0x32')](_[_0xe3c2('0x3a')](_0x166177[_0xe3c2('0x31')],_0x2dcd92['filters']));if(_0x166177[_0xe3c2('0x31')]['filter']){_0x214a12[_0xe3c2('0x3c')]=_[_0xe3c2('0x3e')](_0x214a12['where'],{'$or':_[_0xe3c2('0x2a')](_0x214a12['attributes'],function(_0x3e53a2){var _0x408fc7={};_0x408fc7[_0x3e53a2]={'$like':'%'+_0x166177[_0xe3c2('0x31')]['filter']+'%'};return _0x408fc7;})});}_0x214a12=_[_0xe3c2('0x3e')]({},_0x214a12,_0x166177['options']);return _0x7a01d3[_0xe3c2('0x60')](_0x214a12);}})[_0xe3c2('0x22')](function(_0x2477d3){if(_0x2477d3){_0x50f003=_0x2477d3[_0xe3c2('0x35')];if(!_0x166177['query'][_0xe3c2('0x36')](_0xe3c2('0x37'))){_0x214a12[_0xe3c2('0x1c')]=qs['limit'](_0x166177[_0xe3c2('0x31')][_0xe3c2('0x1c')]);_0x214a12['offset']=qs[_0xe3c2('0x1e')](_0x166177[_0xe3c2('0x31')][_0xe3c2('0x1e')]);}return _0x7a01d3[_0xe3c2('0x60')](_0x214a12);}})[_0xe3c2('0x22')](function(_0x12d4e2){if(_0x12d4e2){return _0x12d4e2?{'count':_0x50f003,'rows':_0x12d4e2}:null;}})[_0xe3c2('0x22')](respondWithResult(_0x25cd3e,null))['catch'](handleError(_0x25cd3e,null));};exports[_0xe3c2('0x61')]=function(_0x2d7323,_0x230d34,_0x652b3a){var _0x33e6d1=_0x2d7323[_0xe3c2('0x48')]['ids'];return db[_0xe3c2('0x62')][_0xe3c2('0x63')]({'where':{'id':_0x33e6d1},'attributes':['id'],'include':[{'model':db[_0xe3c2('0x56')],'as':_0xe3c2('0x64'),'attributes':['id',_0xe3c2('0x27'),_0xe3c2('0x65'),'voicePause',_0xe3c2('0x66')],'raw':!![]}]})['then'](function(_0x235dd6){if(_0x235dd6){var _0x532b1e=_[_0xe3c2('0x67')](_0x235dd6,function(_0x1ae29b){var _0x3badf1=_0x1ae29b[_0xe3c2('0x24')]({'plain':!![]});return _0x3badf1[_0xe3c2('0x64')];});return db[_0xe3c2('0x2b')][_0xe3c2('0x46')]({'where':{'id':_0x2d7323['params']['id']}})[_0xe3c2('0x22')](function(_0xe65fd1){return db[_0xe3c2('0x68')][_0xe3c2('0x69')](function(_0x590204){return _0xe65fd1[_0xe3c2('0x61')](_0x33e6d1,{'transaction':_0x590204})[_0xe3c2('0x22')](function(){return BPromise['each'](_0x532b1e,function(_0xd1fe38){return db[_0xe3c2('0x54')][_0xe3c2('0x6a')]({'where':{'UserId':_0xd1fe38['id'],'WhatsappQueueId':_0x2d7323[_0xe3c2('0x42')]['id']},'transaction':_0x590204});});})[_0xe3c2('0x22')](function(){_0x532b1e[_0xe3c2('0x6b')](function(_0x7cb9ae){socket[_0xe3c2('0x6c')]('userWhatsappQueue:save',{'UserId':_0x7cb9ae['id'],'WhatsappQueueId':_0xe65fd1['id']});});});});});}})['then'](respondWithStatusCode(_0x230d34,null))[_0xe3c2('0x41')](handleError(_0x230d34,null));};exports['removeTeams']=function(_0x54d531,_0x38ae41,_0x30d72c){return db[_0xe3c2('0x62')][_0xe3c2('0x63')]({'where':{'id':_0x54d531['query'][_0xe3c2('0x6d')]},'attributes':['id'],'include':[{'model':db[_0xe3c2('0x56')],'as':_0xe3c2('0x64'),'attributes':['id'],'raw':!![]}]})[_0xe3c2('0x22')](handleEntityNotFound(_0x38ae41,null))[_0xe3c2('0x22')](function(_0x47eece){var _0x116e65=_['map'](_0x47eece,'id');var _0xcda2d6=[];var _0x4f90f7=[];var _0x5e7641=squel[_0xe3c2('0x6e')]();_0x5e7641[_0xe3c2('0x6f')](_0xe3c2('0x70'))[_0xe3c2('0x71')](_0xe3c2('0x72'),'tq')[_0xe3c2('0x73')](_0xe3c2('0x74'),'ut',_0xe3c2('0x75'))[_0xe3c2('0x3c')](_0xe3c2('0x76'),_0x54d531[_0xe3c2('0x42')]['id']);for(var _0x4dd411=0x0;_0x4dd411<_0x47eece[_0xe3c2('0x35')];_0x4dd411+=0x1){let _0x56325b=_0x47eece[_0x4dd411];for(var _0x340470=0x0;_0x340470<_0x56325b[_0xe3c2('0x64')][_0xe3c2('0x35')];_0x340470+=0x1){let _0x3e5689=_0x56325b[_0xe3c2('0x64')][_0x340470];var _0x17b87f=_0x5e7641['clone']();_0x17b87f[_0xe3c2('0x3c')]('ut.UserId\x20=\x20?',_0x3e5689['id']);_0x4f90f7[_0xe3c2('0x77')](db[_0xe3c2('0x68')][_0xe3c2('0x31')](_0x17b87f[_0xe3c2('0x78')](),{'type':db[_0xe3c2('0x68')]['QueryTypes'][_0xe3c2('0x79')]})[_0xe3c2('0x22')](function(_0x5c798f){if(_0x5c798f['length']===0x1){return _0x3e5689['id'];}else{var _0x45af42=_['every'](_['map'](_0x5c798f,_0xe3c2('0x7a')),function(_0x3b8e2c){return _[_0xe3c2('0x7b')](_0x116e65,_0x3b8e2c);});if(_0x45af42){return _0x3e5689['id'];}}}));}}return BPromise['all'](_0x4f90f7)[_0xe3c2('0x22')](function(_0x1e77db){_0xcda2d6=_(_0xcda2d6)[_0xe3c2('0x7c')](_0x1e77db)['compact']()[_0xe3c2('0x7d')]();return db[_0xe3c2('0x2b')][_0xe3c2('0x46')]({'where':{'id':_0x54d531[_0xe3c2('0x42')]['id']}})['then'](function(_0x2cc737){return db['sequelize'][_0xe3c2('0x69')](function(_0x2bd99f){return _0x2cc737[_0xe3c2('0x7e')](_0x54d531[_0xe3c2('0x31')][_0xe3c2('0x6d')],{'transaction':_0x2bd99f})[_0xe3c2('0x22')](function(){if(!_[_0xe3c2('0x7f')](_0xcda2d6)){return _0x2cc737['removeAgents'](_0xcda2d6,{'transaction':_0x2bd99f});}})['then'](function(){_0xcda2d6[_0xe3c2('0x6b')](function(_0x3a8b39){socket['emit'](_0xe3c2('0x80'),{'UserId':_0x3a8b39,'WhatsappQueueId':_0x2cc737['id']});});});});});});})[_0xe3c2('0x22')](respondWithStatusCode(_0x38ae41,null))[_0xe3c2('0x41')](handleError(_0x38ae41,null));};exports[_0xe3c2('0x81')]=function(_0x58fc38,_0x25ec6d,_0x51f700){return db[_0xe3c2('0x2b')][_0xe3c2('0x46')]({'where':{'id':_0x58fc38['params']['id']}})['then'](handleEntityNotFound(_0x25ec6d,null))[_0xe3c2('0x22')](function(_0x2298f0){if(_0x2298f0){return _0x2298f0[_0xe3c2('0x81')](_0x58fc38[_0xe3c2('0x48')][_0xe3c2('0x6d')],_[_0xe3c2('0x82')](_0x58fc38[_0xe3c2('0x48')],[_0xe3c2('0x6d'),'id'])||{})[_0xe3c2('0x83')](function(_0x25118a){for(var _0x1535e4=0x0;_0x1535e4<_0x58fc38[_0xe3c2('0x48')][_0xe3c2('0x6d')][_0xe3c2('0x35')];_0x1535e4+=0x1){socket[_0xe3c2('0x6c')](_0xe3c2('0x84'),{'UserId':Number(_0x58fc38[_0xe3c2('0x48')][_0xe3c2('0x6d')][_0x1535e4]),'WhatsappQueueId':Number(_0x58fc38[_0xe3c2('0x42')]['id'])});}return _0x25118a;});}})[_0xe3c2('0x22')](respondWithResult(_0x25ec6d,null))[_0xe3c2('0x41')](handleError(_0x25ec6d,null));};exports[_0xe3c2('0x85')]=function(_0x1e0ce1,_0x30245b,_0x3a1564){return db[_0xe3c2('0x2b')][_0xe3c2('0x46')]({'where':{'id':_0x1e0ce1[_0xe3c2('0x42')]['id']}})[_0xe3c2('0x22')](handleEntityNotFound(_0x30245b,null))['then'](function(_0x1cfe99){if(_0x1cfe99){return _0x1cfe99['removeAgents'](_0x1e0ce1[_0xe3c2('0x31')]['ids'])[_0xe3c2('0x22')](function(){if(_[_0xe3c2('0x86')](_0x1e0ce1[_0xe3c2('0x31')]['ids'])){for(var _0x42d431=0x0;_0x42d431<_0x1e0ce1[_0xe3c2('0x31')][_0xe3c2('0x6d')]['length'];_0x42d431+=0x1){socket[_0xe3c2('0x6c')](_0xe3c2('0x80'),{'UserId':Number(_0x1e0ce1['query'][_0xe3c2('0x6d')][_0x42d431]),'WhatsappQueueId':Number(_0x1e0ce1[_0xe3c2('0x42')]['id'])});}}else{socket[_0xe3c2('0x6c')](_0xe3c2('0x80'),{'UserId':Number(_0x1e0ce1[_0xe3c2('0x31')][_0xe3c2('0x6d')]),'WhatsappQueueId':Number(_0x1e0ce1['params']['id'])});}});}})[_0xe3c2('0x22')](respondWithStatusCode(_0x30245b,null))[_0xe3c2('0x41')](handleError(_0x30245b,null));};exports[_0xe3c2('0x87')]=function(_0x29ea3d,_0x16b4d7,_0x11c40a){var _0xa1cc2a={};var _0x5a4d5b={};var _0x470130;var _0x2abb57;return db['WhatsappQueue'][_0xe3c2('0x53')]({'where':{'id':_0x29ea3d[_0xe3c2('0x42')]['id']}})[_0xe3c2('0x22')](handleEntityNotFound(_0x16b4d7,null))[_0xe3c2('0x22')](function(_0x10a365){if(_0x10a365){_0x470130=_0x10a365;_0x5a4d5b[_0xe3c2('0x30')]=_['keys'](db[_0xe3c2('0x56')]['rawAttributes']);_0x5a4d5b['query']=_[_0xe3c2('0x43')](_0x29ea3d[_0xe3c2('0x31')]);_0x5a4d5b['filters']=_[_0xe3c2('0x33')](_0x5a4d5b[_0xe3c2('0x30')],_0x5a4d5b[_0xe3c2('0x31')]);_0xa1cc2a[_0xe3c2('0x44')]=_[_0xe3c2('0x33')](_0x5a4d5b[_0xe3c2('0x30')],qs['fields'](_0x29ea3d[_0xe3c2('0x31')][_0xe3c2('0x34')]));_0xa1cc2a['attributes']=_0xa1cc2a[_0xe3c2('0x44')]['length']?_0xa1cc2a['attributes']:_0x5a4d5b[_0xe3c2('0x30')];_0xa1cc2a[_0xe3c2('0x38')]=qs[_0xe3c2('0x39')](_0x29ea3d[_0xe3c2('0x31')][_0xe3c2('0x39')]);_0xa1cc2a[_0xe3c2('0x3c')]=qs[_0xe3c2('0x32')](_[_0xe3c2('0x3a')](_0x29ea3d['query'],_0x5a4d5b[_0xe3c2('0x32')]));if(_0x29ea3d[_0xe3c2('0x31')][_0xe3c2('0x3b')]){_0xa1cc2a[_0xe3c2('0x3c')]=_[_0xe3c2('0x3e')](_0xa1cc2a['where'],{'$or':_[_0xe3c2('0x2a')](_0xa1cc2a[_0xe3c2('0x44')],function(_0x4abe3f){var _0x14810b={};_0x14810b[_0x4abe3f]={'$like':'%'+_0x29ea3d[_0xe3c2('0x31')][_0xe3c2('0x3b')]+'%'};return _0x14810b;})});}_0xa1cc2a=_[_0xe3c2('0x3e')]({},_0xa1cc2a,_0x29ea3d[_0xe3c2('0x45')]);return _0x470130[_0xe3c2('0x87')](_0xa1cc2a);}})['then'](function(_0x34df07){if(_0x34df07){_0x2abb57=_0x34df07['length'];if(!_0x29ea3d[_0xe3c2('0x31')][_0xe3c2('0x36')](_0xe3c2('0x37'))){_0xa1cc2a[_0xe3c2('0x1c')]=qs['limit'](_0x29ea3d[_0xe3c2('0x31')][_0xe3c2('0x1c')]);_0xa1cc2a[_0xe3c2('0x1e')]=qs[_0xe3c2('0x1e')](_0x29ea3d[_0xe3c2('0x31')][_0xe3c2('0x1e')]);}return _0x470130[_0xe3c2('0x87')](_0xa1cc2a);}})[_0xe3c2('0x22')](function(_0x96ee6b){if(_0x96ee6b){return _0x96ee6b?{'count':_0x2abb57,'rows':_0x96ee6b}:null;}})[_0xe3c2('0x22')](respondWithResult(_0x16b4d7,null))[_0xe3c2('0x41')](handleError(_0x16b4d7,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index bc2d02b..327109e 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 _0x2c7c=['hasOwnProperty','hook','exports','setMaxListeners','save','update','remove','emit'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x2c7c,0x193));var _0xc2c7=function(_0x2e41c7,_0xd5fae7){_0x2e41c7=_0x2e41c7-0x0;var _0x3d4308=_0x2c7c[_0x2e41c7];return _0x3d4308;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require('../../mysqldb')['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xc2c7('0x0')](0x0);var events={'afterCreate':_0xc2c7('0x1'),'afterUpdate':_0xc2c7('0x2'),'afterDestroy':_0xc2c7('0x3')};function emitEvent(_0x562274){return function(_0x19271e,_0x1b1633,_0x15df9e){WhatsappQueueEvents['emit'](_0x562274+':'+_0x19271e['id'],_0x19271e);WhatsappQueueEvents[_0xc2c7('0x4')](_0x562274,_0x19271e);_0x15df9e(null);};}for(var e in events){if(events[_0xc2c7('0x5')](e)){var event=events[e];WhatsappQueue[_0xc2c7('0x6')](e,emitEvent(event));}}module[_0xc2c7('0x7')]=WhatsappQueueEvents; \ No newline at end of file +var _0xc871=['hook','events','../../mysqldb','WhatsappQueue','setMaxListeners','save','update','remove','emit'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xc871,0xf4));var _0x1c87=function(_0x2bce9a,_0x556cfe){_0x2bce9a=_0x2bce9a-0x0;var _0x1d7ca2=_0xc871[_0x2bce9a];return _0x1d7ca2;};'use strict';var EventEmitter=require(_0x1c87('0x0'));var WhatsappQueue=require(_0x1c87('0x1'))['db'][_0x1c87('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x1c87('0x3')](0x0);var events={'afterCreate':_0x1c87('0x4'),'afterUpdate':_0x1c87('0x5'),'afterDestroy':_0x1c87('0x6')};function emitEvent(_0x4c2968){return function(_0x98487e,_0x3e9474,_0x1cbeff){WhatsappQueueEvents['emit'](_0x4c2968+':'+_0x98487e['id'],_0x98487e);WhatsappQueueEvents[_0x1c87('0x7')](_0x4c2968,_0x98487e);_0x1cbeff(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x1c87('0x8')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 290f347..c2a7b54 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 _0x4589=['define','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x4e7e3f,_0x2adb53){var _0x537ef0=function(_0x3c8843){while(--_0x3c8843){_0x4e7e3f['push'](_0x4e7e3f['shift']());}};_0x537ef0(++_0x2adb53);}(_0x4589,0x145));var _0x9458=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x4589[_0x18ab2a];return _0x16dcee;};'use strict';var _=require(_0x9458('0x0'));var util=require(_0x9458('0x1'));var logger=require(_0x9458('0x2'))(_0x9458('0x3'));var moment=require(_0x9458('0x4'));var BPromise=require(_0x9458('0x5'));var rp=require(_0x9458('0x6'));var fs=require('fs');var path=require(_0x9458('0x7'));var rimraf=require(_0x9458('0x8'));var config=require(_0x9458('0x9'));var attributes=require('./whatsappQueue.attributes');module[_0x9458('0xa')]=function(_0x27fa6f,_0x294a25){return _0x27fa6f[_0x9458('0xb')](_0x9458('0xc'),attributes,{'tableName':_0x9458('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe7a8=['whatsapp_queues','util','bluebird','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','WhatsappQueue'];(function(_0x2d7a4c,_0x2768b6){var _0x5b55fb=function(_0x504a7e){while(--_0x504a7e){_0x2d7a4c['push'](_0x2d7a4c['shift']());}};_0x5b55fb(++_0x2768b6);}(_0xe7a8,0x88));var _0x8e7a=function(_0x20210e,_0x1603f6){_0x20210e=_0x20210e-0x0;var _0x439c00=_0xe7a8[_0x20210e];return _0x439c00;};'use strict';var _=require('lodash');var util=require(_0x8e7a('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x8e7a('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8e7a('0x2'));var rimraf=require(_0x8e7a('0x3'));var config=require(_0x8e7a('0x4'));var attributes=require(_0x8e7a('0x5'));module[_0x8e7a('0x6')]=function(_0x2f911b,_0x606183){return _0x2f911b['define'](_0x8e7a('0x7'),attributes,{'tableName':_0x8e7a('0x8'),'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 9cae03e..d608bff 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 _0x7a5c=['ShowWhatsappQueue','WhatsappQueue','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','request\x20sent','debug','stringify','code','error','WhatsappQueue,\x20%s,\x20%s','message','result','catch','GetWhatsappQueue','options','raw','where','attributes','limit','include','map','model'];(function(_0x5c3023,_0x59be84){var _0x3e3f58=function(_0x52f5da){while(--_0x52f5da){_0x5c3023['push'](_0x5c3023['shift']());}};_0x3e3f58(++_0x59be84);}(_0x7a5c,0x142));var _0xc7a5=function(_0x588084,_0x287050){_0x588084=_0x588084-0x0;var _0x5ee972=_0x7a5c[_0x588084];return _0x5ee972;};'use strict';var _=require(_0xc7a5('0x0'));var util=require(_0xc7a5('0x1'));var moment=require(_0xc7a5('0x2'));var BPromise=require(_0xc7a5('0x3'));var rs=require(_0xc7a5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc7a5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc7a5('0x6'))('rpc');var config=require(_0xc7a5('0x7'));var jayson=require(_0xc7a5('0x8'));var client=jayson[_0xc7a5('0x9')][_0xc7a5('0xa')]({'port':0x232a});config[_0xc7a5('0xb')]=_[_0xc7a5('0xc')](config['redis'],{'host':_0xc7a5('0xd'),'port':0x18eb});var socket=require(_0xc7a5('0xe'))(new Redis(config[_0xc7a5('0xb')]));require(_0xc7a5('0xf'))[_0xc7a5('0x10')](socket);function respondWithRpcPromise(_0x549f74,_0xf73814,_0x469200){return new BPromise(function(_0x10c495,_0x123996){return client[_0xc7a5('0x11')](_0x549f74,_0x469200)[_0xc7a5('0x12')](function(_0x19a86a){logger[_0xc7a5('0x13')]('WhatsappQueue,\x20%s,\x20%s',_0xf73814,_0xc7a5('0x14'));logger[_0xc7a5('0x15')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0xf73814,_0xc7a5('0x14'),JSON[_0xc7a5('0x16')](_0x19a86a));if(_0x19a86a['error']){if(_0x19a86a['error'][_0xc7a5('0x17')]===0x1f4){logger[_0xc7a5('0x18')](_0xc7a5('0x19'),_0xf73814,_0x19a86a[_0xc7a5('0x18')][_0xc7a5('0x1a')]);return _0x123996(_0x19a86a[_0xc7a5('0x18')][_0xc7a5('0x1a')]);}logger['error'](_0xc7a5('0x19'),_0xf73814,_0x19a86a[_0xc7a5('0x18')][_0xc7a5('0x1a')]);return _0x10c495(_0x19a86a[_0xc7a5('0x18')]['message']);}else{logger[_0xc7a5('0x13')]('WhatsappQueue,\x20%s,\x20%s',_0xf73814,_0xc7a5('0x14'));_0x10c495(_0x19a86a[_0xc7a5('0x1b')][_0xc7a5('0x1a')]);}})[_0xc7a5('0x1c')](function(_0x198f70){logger[_0xc7a5('0x18')](_0xc7a5('0x19'),_0xf73814,_0x198f70);_0x123996(_0x198f70);});});}exports[_0xc7a5('0x1d')]=function(_0x48f548){var _0x2f6574=this;return new Promise(function(_0x442b50,_0x5a51b3){return db['WhatsappQueue']['findAll']({'raw':_0x48f548[_0xc7a5('0x1e')]?_0x48f548[_0xc7a5('0x1e')][_0xc7a5('0x1f')]===undefined?!![]:![]:!![],'where':_0x48f548[_0xc7a5('0x1e')]?_0x48f548[_0xc7a5('0x1e')][_0xc7a5('0x20')]||null:null,'attributes':_0x48f548[_0xc7a5('0x1e')]?_0x48f548['options'][_0xc7a5('0x21')]||null:null,'limit':_0x48f548[_0xc7a5('0x1e')]?_0x48f548['options'][_0xc7a5('0x22')]||null:null,'include':_0x48f548[_0xc7a5('0x1e')]?_0x48f548[_0xc7a5('0x1e')][_0xc7a5('0x23')]?_[_0xc7a5('0x24')](_0x48f548['options']['include'],function(_0x5968da){return{'model':db[_0x5968da['model']],'as':_0x5968da['as'],'attributes':_0x5968da[_0xc7a5('0x21')],'include':_0x5968da[_0xc7a5('0x23')]?_[_0xc7a5('0x24')](_0x5968da[_0xc7a5('0x23')],function(_0x4aacd2){return{'model':db[_0x4aacd2[_0xc7a5('0x25')]],'as':_0x4aacd2['as'],'attributes':_0x4aacd2['attributes'],'include':_0x4aacd2[_0xc7a5('0x23')]?_[_0xc7a5('0x24')](_0x4aacd2[_0xc7a5('0x23')],function(_0x6827f5){return{'model':db[_0x6827f5[_0xc7a5('0x25')]],'as':_0x6827f5['as'],'attributes':_0x6827f5[_0xc7a5('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x169bca){logger[_0xc7a5('0x13')]('GetWhatsappQueue',_0x48f548);logger[_0xc7a5('0x15')](_0xc7a5('0x1d'),_0x48f548,JSON['stringify'](_0x169bca));_0x442b50(_0x169bca);})[_0xc7a5('0x1c')](function(_0x4c64ac){logger[_0xc7a5('0x18')](_0xc7a5('0x1d'),_0x4c64ac['message'],_0x48f548);_0x5a51b3(_0x2f6574[_0xc7a5('0x18')](0x1f4,_0x4c64ac[_0xc7a5('0x1a')]));});});};exports[_0xc7a5('0x26')]=function(_0x56419b){var _0x3c9378=this;return new Promise(function(_0x182a76,_0xfe3193){return db[_0xc7a5('0x27')]['find']({'raw':_0x56419b[_0xc7a5('0x1e')]?_0x56419b['options'][_0xc7a5('0x1f')]===undefined?!![]:![]:!![],'where':_0x56419b[_0xc7a5('0x1e')]?_0x56419b[_0xc7a5('0x1e')][_0xc7a5('0x20')]||null:null,'attributes':_0x56419b[_0xc7a5('0x1e')]?_0x56419b[_0xc7a5('0x1e')]['attributes']||null:null,'include':_0x56419b[_0xc7a5('0x1e')]?_0x56419b['options']['include']?_[_0xc7a5('0x24')](_0x56419b['options'][_0xc7a5('0x23')],function(_0x193df7){return{'model':db[_0x193df7[_0xc7a5('0x25')]],'as':_0x193df7['as'],'attributes':_0x193df7[_0xc7a5('0x21')],'include':_0x193df7['include']?_[_0xc7a5('0x24')](_0x193df7[_0xc7a5('0x23')],function(_0x316ae0){return{'model':db[_0x316ae0['model']],'as':_0x316ae0['as'],'attributes':_0x316ae0[_0xc7a5('0x21')],'include':_0x316ae0[_0xc7a5('0x23')]?_['map'](_0x316ae0[_0xc7a5('0x23')],function(_0x2f3bae){return{'model':db[_0x2f3bae['model']],'as':_0x2f3bae['as'],'attributes':_0x2f3bae[_0xc7a5('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1f422d){logger['info']('ShowWhatsappQueue',_0x56419b);logger[_0xc7a5('0x15')](_0xc7a5('0x26'),_0x56419b,JSON[_0xc7a5('0x16')](_0x1f422d));_0x182a76(_0x1f422d);})[_0xc7a5('0x1c')](function(_0x4b468f){logger[_0xc7a5('0x18')](_0xc7a5('0x26'),_0x4b468f[_0xc7a5('0x1a')],_0x56419b);_0xfe3193(_0x3c9378['error'](0x1f4,_0x4b468f[_0xc7a5('0x1a')]));});});}; \ No newline at end of file +var _0xe80c=['info','result','catch','GetWhatsappQueue','options','where','attributes','include','map','model','ShowWhatsappQueue','WhatsappQueue','find','raw','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe80c,0x156));var _0xce80=function(_0x54dc5f,_0x2ac5e1){_0x54dc5f=_0x54dc5f-0x0;var _0x201750=_0xe80c[_0x54dc5f];return _0x201750;};'use strict';var _=require(_0xce80('0x0'));var util=require(_0xce80('0x1'));var moment=require(_0xce80('0x2'));var BPromise=require(_0xce80('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xce80('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xce80('0x5'));var logger=require(_0xce80('0x6'))(_0xce80('0x7'));var config=require(_0xce80('0x8'));var jayson=require(_0xce80('0x9'));var client=jayson[_0xce80('0xa')]['http']({'port':0x232a});config[_0xce80('0xb')]=_[_0xce80('0xc')](config[_0xce80('0xb')],{'host':_0xce80('0xd'),'port':0x18eb});var socket=require(_0xce80('0xe'))(new Redis(config[_0xce80('0xb')]));require(_0xce80('0xf'))[_0xce80('0x10')](socket);function respondWithRpcPromise(_0x504a34,_0x10a0f2,_0x3ac455){return new BPromise(function(_0x11281a,_0x16ccca){return client[_0xce80('0x11')](_0x504a34,_0x3ac455)[_0xce80('0x12')](function(_0x21cd67){logger['info'](_0xce80('0x13'),_0x10a0f2,_0xce80('0x14'));logger[_0xce80('0x15')](_0xce80('0x16'),_0x10a0f2,_0xce80('0x14'),JSON[_0xce80('0x17')](_0x21cd67));if(_0x21cd67[_0xce80('0x18')]){if(_0x21cd67[_0xce80('0x18')][_0xce80('0x19')]===0x1f4){logger[_0xce80('0x18')](_0xce80('0x13'),_0x10a0f2,_0x21cd67[_0xce80('0x18')][_0xce80('0x1a')]);return _0x16ccca(_0x21cd67[_0xce80('0x18')]['message']);}logger[_0xce80('0x18')](_0xce80('0x13'),_0x10a0f2,_0x21cd67[_0xce80('0x18')][_0xce80('0x1a')]);return _0x11281a(_0x21cd67[_0xce80('0x18')]['message']);}else{logger[_0xce80('0x1b')](_0xce80('0x13'),_0x10a0f2,_0xce80('0x14'));_0x11281a(_0x21cd67[_0xce80('0x1c')][_0xce80('0x1a')]);}})[_0xce80('0x1d')](function(_0x16e4bc){logger['error'](_0xce80('0x13'),_0x10a0f2,_0x16e4bc);_0x16ccca(_0x16e4bc);});});}exports[_0xce80('0x1e')]=function(_0x2bbfcc){var _0x48ad17=this;return new Promise(function(_0x26b9db,_0x3067ef){return db['WhatsappQueue']['findAll']({'raw':_0x2bbfcc['options']?_0x2bbfcc[_0xce80('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x2bbfcc['options']?_0x2bbfcc['options'][_0xce80('0x20')]||null:null,'attributes':_0x2bbfcc[_0xce80('0x1f')]?_0x2bbfcc[_0xce80('0x1f')][_0xce80('0x21')]||null:null,'limit':_0x2bbfcc['options']?_0x2bbfcc[_0xce80('0x1f')]['limit']||null:null,'include':_0x2bbfcc[_0xce80('0x1f')]?_0x2bbfcc[_0xce80('0x1f')][_0xce80('0x22')]?_[_0xce80('0x23')](_0x2bbfcc[_0xce80('0x1f')][_0xce80('0x22')],function(_0x36707f){return{'model':db[_0x36707f[_0xce80('0x24')]],'as':_0x36707f['as'],'attributes':_0x36707f[_0xce80('0x21')],'include':_0x36707f[_0xce80('0x22')]?_[_0xce80('0x23')](_0x36707f['include'],function(_0x332de5){return{'model':db[_0x332de5[_0xce80('0x24')]],'as':_0x332de5['as'],'attributes':_0x332de5['attributes'],'include':_0x332de5[_0xce80('0x22')]?_[_0xce80('0x23')](_0x332de5['include'],function(_0x595f53){return{'model':db[_0x595f53[_0xce80('0x24')]],'as':_0x595f53['as'],'attributes':_0x595f53[_0xce80('0x21')]};}):[]};}):[]};}):[]:[]})[_0xce80('0x12')](function(_0x1802aa){logger[_0xce80('0x1b')](_0xce80('0x1e'),_0x2bbfcc);logger[_0xce80('0x15')](_0xce80('0x1e'),_0x2bbfcc,JSON['stringify'](_0x1802aa));_0x26b9db(_0x1802aa);})[_0xce80('0x1d')](function(_0x1c7a80){logger[_0xce80('0x18')]('GetWhatsappQueue',_0x1c7a80[_0xce80('0x1a')],_0x2bbfcc);_0x3067ef(_0x48ad17[_0xce80('0x18')](0x1f4,_0x1c7a80[_0xce80('0x1a')]));});});};exports[_0xce80('0x25')]=function(_0x4c642b){var _0x54b0cf=this;return new Promise(function(_0x40d955,_0x3b4115){return db[_0xce80('0x26')][_0xce80('0x27')]({'raw':_0x4c642b[_0xce80('0x1f')]?_0x4c642b[_0xce80('0x1f')][_0xce80('0x28')]===undefined?!![]:![]:!![],'where':_0x4c642b[_0xce80('0x1f')]?_0x4c642b[_0xce80('0x1f')]['where']||null:null,'attributes':_0x4c642b[_0xce80('0x1f')]?_0x4c642b['options'][_0xce80('0x21')]||null:null,'include':_0x4c642b[_0xce80('0x1f')]?_0x4c642b[_0xce80('0x1f')][_0xce80('0x22')]?_[_0xce80('0x23')](_0x4c642b['options']['include'],function(_0x14ca63){return{'model':db[_0x14ca63[_0xce80('0x24')]],'as':_0x14ca63['as'],'attributes':_0x14ca63[_0xce80('0x21')],'include':_0x14ca63[_0xce80('0x22')]?_[_0xce80('0x23')](_0x14ca63['include'],function(_0x5e1673){return{'model':db[_0x5e1673['model']],'as':_0x5e1673['as'],'attributes':_0x5e1673['attributes'],'include':_0x5e1673['include']?_[_0xce80('0x23')](_0x5e1673[_0xce80('0x22')],function(_0xb5611c){return{'model':db[_0xb5611c['model']],'as':_0xb5611c['as'],'attributes':_0xb5611c['attributes']};}):[]};}):[]};}):[]:[]})[_0xce80('0x12')](function(_0x4acff2){logger[_0xce80('0x1b')](_0xce80('0x25'),_0x4c642b);logger['debug'](_0xce80('0x25'),_0x4c642b,JSON[_0xce80('0x17')](_0x4acff2));_0x40d955(_0x4acff2);})[_0xce80('0x1d')](function(_0x453e68){logger[_0xce80('0x18')](_0xce80('0x25'),_0x453e68['message'],_0x4c642b);_0x3b4115(_0x54b0cf[_0xce80('0x18')](0x1f4,_0x453e68[_0xce80('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 859bac2..bf05d15 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 _0x3605=['register','length','whatsappQueue:','./whatsappQueue.events','save','remove','update','emit'];(function(_0x293a24,_0x2406e6){var _0x23d1cf=function(_0x1130d4){while(--_0x1130d4){_0x293a24['push'](_0x293a24['shift']());}};_0x23d1cf(++_0x2406e6);}(_0x3605,0xdb));var _0x5360=function(_0x3469d9,_0x11b241){_0x3469d9=_0x3469d9-0x0;var _0x5a6fb7=_0x3605[_0x3469d9];return _0x5a6fb7;};'use strict';var WhatsappQueueEvents=require(_0x5360('0x0'));var events=[_0x5360('0x1'),_0x5360('0x2'),_0x5360('0x3')];function createListener(_0xe93bba,_0x5ddb3b){return function(_0x238087){_0x5ddb3b[_0x5360('0x4')](_0xe93bba,_0x238087);};}function removeListener(_0x4a6a62,_0xeb69d0){return function(){WhatsappQueueEvents['removeListener'](_0x4a6a62,_0xeb69d0);};}exports[_0x5360('0x5')]=function(_0xe9fba4){for(var _0xe8f1a5=0x0,_0x50a736=events[_0x5360('0x6')];_0xe8f1a5<_0x50a736;_0xe8f1a5++){var _0x12bd8b=events[_0xe8f1a5];var _0x5c1ac6=createListener(_0x5360('0x7')+_0x12bd8b,_0xe9fba4);WhatsappQueueEvents['on'](_0x12bd8b,_0x5c1ac6);}}; \ No newline at end of file +var _0x9d16=['./whatsappQueue.events','remove','removeListener','register'];(function(_0x3f1b6a,_0x3fe787){var _0x4c7209=function(_0x2797bc){while(--_0x2797bc){_0x3f1b6a['push'](_0x3f1b6a['shift']());}};_0x4c7209(++_0x3fe787);}(_0x9d16,0x15c));var _0x69d1=function(_0x11a55c,_0x4eced9){_0x11a55c=_0x11a55c-0x0;var _0x26c390=_0x9d16[_0x11a55c];return _0x26c390;};'use strict';var WhatsappQueueEvents=require(_0x69d1('0x0'));var events=['save',_0x69d1('0x1'),'update'];function createListener(_0x513150,_0x18aea9){return function(_0x4b4430){_0x18aea9['emit'](_0x513150,_0x4b4430);};}function removeListener(_0xc4c10c,_0x4e3a8a){return function(){WhatsappQueueEvents[_0x69d1('0x2')](_0xc4c10c,_0x4e3a8a);};}exports[_0x69d1('0x3')]=function(_0x125102){for(var _0x26df31=0x0,_0x349102=events['length'];_0x26df31<_0x349102;_0x26df31++){var _0x8724a1=events[_0x26df31];var _0xfbe760=createListener('whatsappQueue:'+_0x8724a1,_0x125102);WhatsappQueueEvents['on'](_0x8724a1,_0xfbe760);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index dda88b9..090f8e0 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 _0xbef1=['path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','delete','destroy','exports','util'];(function(_0x4cefc8,_0x16d44e){var _0xe9ccd5=function(_0x2d5a73){while(--_0x2d5a73){_0x4cefc8['push'](_0x4cefc8['shift']());}};_0xe9ccd5(++_0x16d44e);}(_0xbef1,0xaa));var _0x1bef=function(_0x3aef89,_0x3fdaf5){_0x3aef89=_0x3aef89-0x0;var _0x1f4b10=_0xbef1[_0x3aef89];return _0x1f4b10;};'use strict';var multer=require('multer');var util=require(_0x1bef('0x0'));var path=require(_0x1bef('0x1'));var timeout=require(_0x1bef('0x2'));var express=require(_0x1bef('0x3'));var router=express['Router']();var fs_extra=require(_0x1bef('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1bef('0x5'));var config=require(_0x1bef('0x6'));var controller=require(_0x1bef('0x7'));router[_0x1bef('0x8')]('/',auth[_0x1bef('0x9')](),controller[_0x1bef('0xa')]);router[_0x1bef('0x8')](_0x1bef('0xb'),auth[_0x1bef('0x9')](),controller[_0x1bef('0xc')]);router[_0x1bef('0x8')](_0x1bef('0xd'),auth[_0x1bef('0x9')](),controller['show']);router[_0x1bef('0xe')]('/',auth[_0x1bef('0x9')](),controller[_0x1bef('0xf')]);router['put'](_0x1bef('0xd'),auth[_0x1bef('0x9')](),controller['update']);router[_0x1bef('0x10')](_0x1bef('0xd'),auth['isAuthenticated'](),controller[_0x1bef('0x11')]);module[_0x1bef('0x12')]=router; \ No newline at end of file +var _0xf739=['./whatsappQueueReport.controller','get','isAuthenticated','/describe','describe','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x1703c2,_0x27d16d){var _0x50cb00=function(_0x22d358){while(--_0x22d358){_0x1703c2['push'](_0x1703c2['shift']());}};_0x50cb00(++_0x27d16d);}(_0xf739,0xb5));var _0x9f73=function(_0x2d3040,_0x129c56){_0x2d3040=_0x2d3040-0x0;var _0x4c85b6=_0xf739[_0x2d3040];return _0x4c85b6;};'use strict';var multer=require(_0x9f73('0x0'));var util=require('util');var path=require(_0x9f73('0x1'));var timeout=require(_0x9f73('0x2'));var express=require('express');var router=express[_0x9f73('0x3')]();var fs_extra=require(_0x9f73('0x4'));var auth=require(_0x9f73('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9f73('0x6'));router[_0x9f73('0x7')]('/',auth[_0x9f73('0x8')](),controller['index']);router[_0x9f73('0x7')](_0x9f73('0x9'),auth[_0x9f73('0x8')](),controller[_0x9f73('0xa')]);router['get']('/:id',auth[_0x9f73('0x8')](),controller['show']);router['post']('/',auth[_0x9f73('0x8')](),controller['create']);router[_0x9f73('0xb')](_0x9f73('0xc'),auth[_0x9f73('0x8')](),controller[_0x9f73('0xd')]);router[_0x9f73('0xe')](_0x9f73('0xc'),auth[_0x9f73('0x8')](),controller[_0x9f73('0xf')]);module[_0x9f73('0x10')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index e23a5b4..25e4ef1 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(_0x4b6de3,_0x11213e){var _0x53f452=function(_0x21010d){while(--_0x21010d){_0x4b6de3['push'](_0x4b6de3['shift']());}};_0x53f452(++_0x11213e);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x1c2721,_0x1d8ce8){var _0x1e5907=function(_0x28b4e6){while(--_0x28b4e6){_0x1c2721['push'](_0x1c2721['shift']());}};_0x1e5907(++_0x1d8ce8);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'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 fef7ad1..158712f 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 _0xa5fa=['offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','index','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','filter','options','WhatsappQueueReport','includeAll','rows','catch','show','params','fields','include','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status'];(function(_0x4bf0a3,_0x25099e){var _0xe3a581=function(_0x3c4b49){while(--_0x3c4b49){_0x4bf0a3['push'](_0x4bf0a3['shift']());}};_0xe3a581(++_0x25099e);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x3e78f4,_0x5d4c9a){_0x3e78f4=_0x3e78f4-0x0;var _0x5ca5eb=_0xa5fa[_0x3e78f4];return _0x5ca5eb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaa5f('0x0'));var zipdir=require(_0xaa5f('0x1'));var jsonpatch=require(_0xaa5f('0x2'));var rp=require(_0xaa5f('0x3'));var moment=require('moment');var BPromise=require(_0xaa5f('0x4'));var Mustache=require(_0xaa5f('0x5'));var util=require('util');var path=require(_0xaa5f('0x6'));var sox=require(_0xaa5f('0x7'));var csv=require(_0xaa5f('0x8'));var ejs=require(_0xaa5f('0x9'));var fs=require('fs');var fs_extra=require(_0xaa5f('0xa'));var _=require(_0xaa5f('0xb'));var squel=require(_0xaa5f('0xc'));var crypto=require(_0xaa5f('0xd'));var jsforce=require(_0xaa5f('0xe'));var deskjs=require(_0xaa5f('0xf'));var toCsv=require(_0xaa5f('0x8'));var querystring=require('querystring');var Papa=require(_0xaa5f('0x10'));var Redis=require(_0xaa5f('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xaa5f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xaa5f('0x13'));var utils=require('../../config/utils');var config=require(_0xaa5f('0x14'));var licenseUtil=require(_0xaa5f('0x15'));var db=require(_0xaa5f('0x16'))['db'];function respondWithStatusCode(_0x9aeae9,_0x252ae0){_0x252ae0=_0x252ae0||0xcc;return function(_0x48d1d3){if(_0x48d1d3){return _0x9aeae9[_0xaa5f('0x17')](_0x252ae0);}return _0x9aeae9['status'](_0x252ae0)[_0xaa5f('0x18')]();};}function respondWithResult(_0x23f872,_0x31eabc){_0x31eabc=_0x31eabc||0xc8;return function(_0x19aa27){if(_0x19aa27){return _0x23f872[_0xaa5f('0x19')](_0x31eabc)['json'](_0x19aa27);}};}function respondWithFilteredResult(_0x4fc828,_0x1f37fb){return function(_0x291042){if(_0x291042){var _0xb0bfb6=typeof _0x1f37fb[_0xaa5f('0x1a')]===_0xaa5f('0x1b')&&typeof _0x1f37fb[_0xaa5f('0x1c')]===_0xaa5f('0x1b');var _0x28407c=_0x291042[_0xaa5f('0x1d')];var _0x3d874f=_0xb0bfb6?0x0:_0x1f37fb[_0xaa5f('0x1a')];var _0x1019e8=_0xb0bfb6?_0x291042['count']:_0x1f37fb[_0xaa5f('0x1a')]+_0x1f37fb[_0xaa5f('0x1c')];var _0x1cbab5;if(_0x1019e8>=_0x28407c){_0x1019e8=_0x28407c;_0x1cbab5=0xc8;}else{_0x1cbab5=0xce;}_0x4fc828[_0xaa5f('0x19')](_0x1cbab5);return _0x4fc828[_0xaa5f('0x1e')](_0xaa5f('0x1f'),_0x3d874f+'-'+_0x1019e8+'/'+_0x28407c)[_0xaa5f('0x20')](_0x291042);}return null;};}function patchUpdates(_0x194691){return function(_0x2d8fc3){try{jsonpatch[_0xaa5f('0x21')](_0x2d8fc3,_0x194691,!![]);}catch(_0x40c223){return BPromise[_0xaa5f('0x22')](_0x40c223);}return _0x2d8fc3[_0xaa5f('0x23')]();};}function saveUpdates(_0x5238a8,_0x1e917d){return function(_0x57082c){if(_0x57082c){return _0x57082c[_0xaa5f('0x24')](_0x5238a8)[_0xaa5f('0x25')](function(_0x561381){return _0x561381;});}return null;};}function removeEntity(_0x1baa2e,_0x1032ce){return function(_0x5b9f0b){if(_0x5b9f0b){return _0x5b9f0b[_0xaa5f('0x26')]()[_0xaa5f('0x25')](function(){_0x1baa2e[_0xaa5f('0x19')](0xcc)[_0xaa5f('0x18')]();});}};}function handleEntityNotFound(_0x1f66c0,_0xacbded){return function(_0x3d7bca){if(!_0x3d7bca){_0x1f66c0[_0xaa5f('0x17')](0x194);}return _0x3d7bca;};}function handleError(_0x51eb55,_0x2445a6){_0x2445a6=_0x2445a6||0x1f4;return function(_0x3a66e8){logger[_0xaa5f('0x27')](_0x3a66e8['stack']);if(_0x3a66e8[_0xaa5f('0x28')]){delete _0x3a66e8[_0xaa5f('0x28')];}_0x51eb55[_0xaa5f('0x19')](_0x2445a6)['send'](_0x3a66e8);};}exports[_0xaa5f('0x29')]=function(_0x479f29,_0x5990d2){var _0x27d1a4={},_0x50998f={},_0x1bffec={'count':0x0,'rows':[]};var _0x4e0ec9=_['map'](db['WhatsappQueueReport'][_0xaa5f('0x2a')],function(_0x4ddebd){return{'name':_0x4ddebd[_0xaa5f('0x2b')],'type':_0x4ddebd[_0xaa5f('0x2c')]['key']};});_0x50998f['model']=_[_0xaa5f('0x2d')](_0x4e0ec9,'name');_0x50998f[_0xaa5f('0x2e')]=_[_0xaa5f('0x2f')](_0x479f29['query']);_0x50998f[_0xaa5f('0x30')]=_[_0xaa5f('0x31')](_0x50998f[_0xaa5f('0x32')],_0x50998f['query']);_0x27d1a4[_0xaa5f('0x33')]=_[_0xaa5f('0x31')](_0x50998f['model'],qs['fields'](_0x479f29['query']['fields']));_0x27d1a4[_0xaa5f('0x33')]=_0x27d1a4[_0xaa5f('0x33')][_0xaa5f('0x34')]?_0x27d1a4[_0xaa5f('0x33')]:_0x50998f[_0xaa5f('0x32')];if(!_0x479f29[_0xaa5f('0x2e')][_0xaa5f('0x35')]('nolimit')){_0x27d1a4[_0xaa5f('0x1c')]=qs[_0xaa5f('0x1c')](_0x479f29[_0xaa5f('0x2e')][_0xaa5f('0x1c')]);_0x27d1a4[_0xaa5f('0x1a')]=qs[_0xaa5f('0x1a')](_0x479f29['query'][_0xaa5f('0x1a')]);}_0x27d1a4[_0xaa5f('0x36')]=qs[_0xaa5f('0x37')](_0x479f29[_0xaa5f('0x2e')][_0xaa5f('0x37')]);_0x27d1a4['where']=qs['filters'](_[_0xaa5f('0x38')](_0x479f29[_0xaa5f('0x2e')],_0x50998f[_0xaa5f('0x30')]),_0x4e0ec9);if(_0x479f29[_0xaa5f('0x2e')]['filter']){_0x27d1a4[_0xaa5f('0x39')]=_[_0xaa5f('0x3a')](_0x27d1a4[_0xaa5f('0x39')],{'$or':_[_0xaa5f('0x2d')](_0x4e0ec9,function(_0x37db88){if(_0x37db88[_0xaa5f('0x2c')]!==_0xaa5f('0x3b')){var _0x2c4d29={};_0x2c4d29[_0x37db88[_0xaa5f('0x28')]]={'$like':'%'+_0x479f29[_0xaa5f('0x2e')][_0xaa5f('0x3c')]+'%'};return _0x2c4d29;}})});}_0x27d1a4=_['merge']({},_0x27d1a4,_0x479f29[_0xaa5f('0x3d')]);var _0x2562ce={'where':_0x27d1a4[_0xaa5f('0x39')]};return db[_0xaa5f('0x3e')][_0xaa5f('0x1d')](_0x2562ce)[_0xaa5f('0x25')](function(_0x1fb572){_0x1bffec[_0xaa5f('0x1d')]=_0x1fb572;if(_0x479f29[_0xaa5f('0x2e')][_0xaa5f('0x3f')]){_0x27d1a4['include']=[{'all':!![]}];}return db[_0xaa5f('0x3e')]['findAll'](_0x27d1a4);})[_0xaa5f('0x25')](function(_0x21f4bc){_0x1bffec[_0xaa5f('0x40')]=_0x21f4bc;return _0x1bffec;})['then'](respondWithFilteredResult(_0x5990d2,_0x27d1a4))[_0xaa5f('0x41')](handleError(_0x5990d2,null));};exports[_0xaa5f('0x42')]=function(_0xe49f8,_0x528b08){var _0x12a8e4={'raw':!![],'where':{'id':_0xe49f8[_0xaa5f('0x43')]['id']}},_0x179be8={};_0x179be8[_0xaa5f('0x32')]=_['keys'](db[_0xaa5f('0x3e')][_0xaa5f('0x2a')]);_0x179be8[_0xaa5f('0x2e')]=_[_0xaa5f('0x2f')](_0xe49f8[_0xaa5f('0x2e')]);_0x179be8[_0xaa5f('0x30')]=_[_0xaa5f('0x31')](_0x179be8[_0xaa5f('0x32')],_0x179be8['query']);_0x12a8e4[_0xaa5f('0x33')]=_['intersection'](_0x179be8[_0xaa5f('0x32')],qs['fields'](_0xe49f8[_0xaa5f('0x2e')][_0xaa5f('0x44')]));_0x12a8e4['attributes']=_0x12a8e4[_0xaa5f('0x33')][_0xaa5f('0x34')]?_0x12a8e4[_0xaa5f('0x33')]:_0x179be8['model'];if(_0xe49f8['query']['includeAll']){_0x12a8e4[_0xaa5f('0x45')]=[{'all':!![]}];}_0x12a8e4=_['merge']({},_0x12a8e4,_0xe49f8[_0xaa5f('0x3d')]);return db[_0xaa5f('0x3e')][_0xaa5f('0x46')](_0x12a8e4)[_0xaa5f('0x25')](handleEntityNotFound(_0x528b08,null))['then'](respondWithResult(_0x528b08,null))[_0xaa5f('0x41')](handleError(_0x528b08,null));};exports[_0xaa5f('0x47')]=function(_0x3c6a17,_0x231ad1){return db[_0xaa5f('0x3e')][_0xaa5f('0x47')](_0x3c6a17[_0xaa5f('0x48')],{})[_0xaa5f('0x25')](respondWithResult(_0x231ad1,0xc9))[_0xaa5f('0x41')](handleError(_0x231ad1,null));};exports[_0xaa5f('0x24')]=function(_0x3ea553,_0x2de737){if(_0x3ea553[_0xaa5f('0x48')]['id']){delete _0x3ea553[_0xaa5f('0x48')]['id'];}return db[_0xaa5f('0x3e')][_0xaa5f('0x46')]({'where':{'id':_0x3ea553['params']['id']}})[_0xaa5f('0x25')](handleEntityNotFound(_0x2de737,null))[_0xaa5f('0x25')](saveUpdates(_0x3ea553[_0xaa5f('0x48')],null))[_0xaa5f('0x25')](respondWithResult(_0x2de737,null))[_0xaa5f('0x41')](handleError(_0x2de737,null));};exports[_0xaa5f('0x26')]=function(_0x32bbed,_0x4aa556){return db[_0xaa5f('0x3e')][_0xaa5f('0x46')]({'where':{'id':_0x32bbed[_0xaa5f('0x43')]['id']}})[_0xaa5f('0x25')](handleEntityNotFound(_0x4aa556,null))['then'](removeEntity(_0x4aa556,null))[_0xaa5f('0x41')](handleError(_0x4aa556,null));};exports[_0xaa5f('0x49')]=function(_0x36c4aa,_0x575803){return db['WhatsappQueueReport']['describe']()['then'](respondWithResult(_0x575803,null))['catch'](handleError(_0x575803,null));}; \ No newline at end of file +var _0xa74f=['hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','WhatsappQueueReport','include','findAll','rows','params','keys','rawAttributes','create','body','catch','find','describe','zip-dir','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','offset','undefined','limit','count','set','json','reject','save','destroy','then','error','name','send','map','type','model','query','filters','intersection','attributes','fields','length'];(function(_0x25276e,_0xb629f7){var _0x3e7509=function(_0x2bd95e){while(--_0x2bd95e){_0x25276e['push'](_0x25276e['shift']());}};_0x3e7509(++_0xb629f7);}(_0xa74f,0x9a));var _0xfa74=function(_0x14a862,_0x2b559d){_0x14a862=_0x14a862-0x0;var _0x245eb5=_0xa74f[_0x14a862];return _0x245eb5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xfa74('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xfa74('0x1'));var BPromise=require(_0xfa74('0x2'));var Mustache=require(_0xfa74('0x3'));var util=require(_0xfa74('0x4'));var path=require('path');var sox=require(_0xfa74('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfa74('0x6'));var _=require(_0xfa74('0x7'));var squel=require(_0xfa74('0x8'));var crypto=require(_0xfa74('0x9'));var jsforce=require(_0xfa74('0xa'));var deskjs=require(_0xfa74('0xb'));var toCsv=require('to-csv');var querystring=require(_0xfa74('0xc'));var Papa=require(_0xfa74('0xd'));var Redis=require(_0xfa74('0xe'));var authService=require(_0xfa74('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xfa74('0x10'));var hardwareService=require(_0xfa74('0x11'));var logger=require('../../config/logger')(_0xfa74('0x12'));var utils=require(_0xfa74('0x13'));var config=require(_0xfa74('0x14'));var licenseUtil=require(_0xfa74('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23591a,_0x998585){_0x998585=_0x998585||0xcc;return function(_0x78173f){if(_0x78173f){return _0x23591a[_0xfa74('0x16')](_0x998585);}return _0x23591a['status'](_0x998585)[_0xfa74('0x17')]();};}function respondWithResult(_0x33cda3,_0x3eb49b){_0x3eb49b=_0x3eb49b||0xc8;return function(_0x3947ca){if(_0x3947ca){return _0x33cda3[_0xfa74('0x18')](_0x3eb49b)['json'](_0x3947ca);}};}function respondWithFilteredResult(_0x199d20,_0x13d911){return function(_0x947da6){if(_0x947da6){var _0x1f1de0=typeof _0x13d911[_0xfa74('0x19')]===_0xfa74('0x1a')&&typeof _0x13d911[_0xfa74('0x1b')]==='undefined';var _0x58a67a=_0x947da6[_0xfa74('0x1c')];var _0x51dda1=_0x1f1de0?0x0:_0x13d911['offset'];var _0x31d3c1=_0x1f1de0?_0x947da6[_0xfa74('0x1c')]:_0x13d911[_0xfa74('0x19')]+_0x13d911['limit'];var _0x3bede6;if(_0x31d3c1>=_0x58a67a){_0x31d3c1=_0x58a67a;_0x3bede6=0xc8;}else{_0x3bede6=0xce;}_0x199d20[_0xfa74('0x18')](_0x3bede6);return _0x199d20[_0xfa74('0x1d')]('Content-Range',_0x51dda1+'-'+_0x31d3c1+'/'+_0x58a67a)[_0xfa74('0x1e')](_0x947da6);}return null;};}function patchUpdates(_0x302eb4){return function(_0x2e6c33){try{jsonpatch['apply'](_0x2e6c33,_0x302eb4,!![]);}catch(_0x5466ca){return BPromise[_0xfa74('0x1f')](_0x5466ca);}return _0x2e6c33[_0xfa74('0x20')]();};}function saveUpdates(_0x9932db,_0xeaaa19){return function(_0x1a453d){if(_0x1a453d){return _0x1a453d['update'](_0x9932db)['then'](function(_0x3721bf){return _0x3721bf;});}return null;};}function removeEntity(_0x5aa8a7,_0x48cbd3){return function(_0x529810){if(_0x529810){return _0x529810[_0xfa74('0x21')]()[_0xfa74('0x22')](function(){_0x5aa8a7[_0xfa74('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x530f99,_0x9eb68c){return function(_0xeb6c11){if(!_0xeb6c11){_0x530f99['sendStatus'](0x194);}return _0xeb6c11;};}function handleError(_0x62e1be,_0x5d3b26){_0x5d3b26=_0x5d3b26||0x1f4;return function(_0x1a8cf7){logger[_0xfa74('0x23')](_0x1a8cf7['stack']);if(_0x1a8cf7[_0xfa74('0x24')]){delete _0x1a8cf7[_0xfa74('0x24')];}_0x62e1be[_0xfa74('0x18')](_0x5d3b26)[_0xfa74('0x25')](_0x1a8cf7);};}exports['index']=function(_0xd9c55d,_0x2f7cd7){var _0x204e01={},_0x57d90e={},_0x4d4bed={'count':0x0,'rows':[]};var _0x1322a4=_[_0xfa74('0x26')](db['WhatsappQueueReport']['rawAttributes'],function(_0x343466){return{'name':_0x343466['fieldName'],'type':_0x343466[_0xfa74('0x27')]['key']};});_0x57d90e[_0xfa74('0x28')]=_[_0xfa74('0x26')](_0x1322a4,_0xfa74('0x24'));_0x57d90e[_0xfa74('0x29')]=_['keys'](_0xd9c55d[_0xfa74('0x29')]);_0x57d90e[_0xfa74('0x2a')]=_[_0xfa74('0x2b')](_0x57d90e[_0xfa74('0x28')],_0x57d90e[_0xfa74('0x29')]);_0x204e01[_0xfa74('0x2c')]=_[_0xfa74('0x2b')](_0x57d90e['model'],qs[_0xfa74('0x2d')](_0xd9c55d['query'][_0xfa74('0x2d')]));_0x204e01[_0xfa74('0x2c')]=_0x204e01[_0xfa74('0x2c')][_0xfa74('0x2e')]?_0x204e01['attributes']:_0x57d90e['model'];if(!_0xd9c55d[_0xfa74('0x29')][_0xfa74('0x2f')](_0xfa74('0x30'))){_0x204e01[_0xfa74('0x1b')]=qs['limit'](_0xd9c55d[_0xfa74('0x29')][_0xfa74('0x1b')]);_0x204e01['offset']=qs['offset'](_0xd9c55d['query']['offset']);}_0x204e01['order']=qs[_0xfa74('0x31')](_0xd9c55d[_0xfa74('0x29')][_0xfa74('0x31')]);_0x204e01[_0xfa74('0x32')]=qs[_0xfa74('0x2a')](_[_0xfa74('0x33')](_0xd9c55d[_0xfa74('0x29')],_0x57d90e[_0xfa74('0x2a')]),_0x1322a4);if(_0xd9c55d[_0xfa74('0x29')]['filter']){_0x204e01[_0xfa74('0x32')]=_[_0xfa74('0x34')](_0x204e01[_0xfa74('0x32')],{'$or':_[_0xfa74('0x26')](_0x1322a4,function(_0x42fc31){if(_0x42fc31[_0xfa74('0x27')]!=='VIRTUAL'){var _0x4307be={};_0x4307be[_0x42fc31[_0xfa74('0x24')]]={'$like':'%'+_0xd9c55d[_0xfa74('0x29')][_0xfa74('0x35')]+'%'};return _0x4307be;}})});}_0x204e01=_['merge']({},_0x204e01,_0xd9c55d[_0xfa74('0x36')]);var _0x13d9a5={'where':_0x204e01[_0xfa74('0x32')]};return db[_0xfa74('0x37')]['count'](_0x13d9a5)[_0xfa74('0x22')](function(_0x1f7023){_0x4d4bed[_0xfa74('0x1c')]=_0x1f7023;if(_0xd9c55d['query']['includeAll']){_0x204e01[_0xfa74('0x38')]=[{'all':!![]}];}return db[_0xfa74('0x37')][_0xfa74('0x39')](_0x204e01);})[_0xfa74('0x22')](function(_0x55f4e3){_0x4d4bed[_0xfa74('0x3a')]=_0x55f4e3;return _0x4d4bed;})[_0xfa74('0x22')](respondWithFilteredResult(_0x2f7cd7,_0x204e01))['catch'](handleError(_0x2f7cd7,null));};exports['show']=function(_0x523b25,_0x492c7d){var _0x95c891={'raw':!![],'where':{'id':_0x523b25[_0xfa74('0x3b')]['id']}},_0x3098ca={};_0x3098ca[_0xfa74('0x28')]=_[_0xfa74('0x3c')](db[_0xfa74('0x37')][_0xfa74('0x3d')]);_0x3098ca['query']=_[_0xfa74('0x3c')](_0x523b25[_0xfa74('0x29')]);_0x3098ca[_0xfa74('0x2a')]=_[_0xfa74('0x2b')](_0x3098ca[_0xfa74('0x28')],_0x3098ca['query']);_0x95c891[_0xfa74('0x2c')]=_[_0xfa74('0x2b')](_0x3098ca[_0xfa74('0x28')],qs[_0xfa74('0x2d')](_0x523b25[_0xfa74('0x29')][_0xfa74('0x2d')]));_0x95c891[_0xfa74('0x2c')]=_0x95c891[_0xfa74('0x2c')][_0xfa74('0x2e')]?_0x95c891[_0xfa74('0x2c')]:_0x3098ca['model'];if(_0x523b25[_0xfa74('0x29')]['includeAll']){_0x95c891[_0xfa74('0x38')]=[{'all':!![]}];}_0x95c891=_[_0xfa74('0x34')]({},_0x95c891,_0x523b25[_0xfa74('0x36')]);return db[_0xfa74('0x37')]['find'](_0x95c891)[_0xfa74('0x22')](handleEntityNotFound(_0x492c7d,null))[_0xfa74('0x22')](respondWithResult(_0x492c7d,null))['catch'](handleError(_0x492c7d,null));};exports[_0xfa74('0x3e')]=function(_0x2f9755,_0x5cbb70){return db[_0xfa74('0x37')][_0xfa74('0x3e')](_0x2f9755[_0xfa74('0x3f')],{})[_0xfa74('0x22')](respondWithResult(_0x5cbb70,0xc9))[_0xfa74('0x40')](handleError(_0x5cbb70,null));};exports['update']=function(_0x54e06c,_0x36f6ca){if(_0x54e06c[_0xfa74('0x3f')]['id']){delete _0x54e06c['body']['id'];}return db[_0xfa74('0x37')][_0xfa74('0x41')]({'where':{'id':_0x54e06c[_0xfa74('0x3b')]['id']}})['then'](handleEntityNotFound(_0x36f6ca,null))['then'](saveUpdates(_0x54e06c[_0xfa74('0x3f')],null))[_0xfa74('0x22')](respondWithResult(_0x36f6ca,null))[_0xfa74('0x40')](handleError(_0x36f6ca,null));};exports[_0xfa74('0x21')]=function(_0x36508a,_0x3cb23d){return db[_0xfa74('0x37')][_0xfa74('0x41')]({'where':{'id':_0x36508a['params']['id']}})[_0xfa74('0x22')](handleEntityNotFound(_0x3cb23d,null))[_0xfa74('0x22')](removeEntity(_0x3cb23d,null))[_0xfa74('0x40')](handleError(_0x3cb23d,null));};exports[_0xfa74('0x42')]=function(_0x569801,_0x4ec218){return db[_0xfa74('0x37')]['describe']()[_0xfa74('0x22')](respondWithResult(_0x4ec218,null))[_0xfa74('0x40')](handleError(_0x4ec218,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 9d92a77..a252ccd 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 _0xc817=['WhatsappQueueReport','report_whatsapp_queue','uniqueid','util','api','moment','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x154a79,_0x7a67aa){var _0x52c703=function(_0x43c7ec){while(--_0x43c7ec){_0x154a79['push'](_0x154a79['shift']());}};_0x52c703(++_0x7a67aa);}(_0xc817,0x1a7));var _0x7c81=function(_0x1b69bb,_0xd01deb){_0x1b69bb=_0x1b69bb-0x0;var _0x53d2ec=_0xc817[_0x1b69bb];return _0x53d2ec;};'use strict';var _=require('lodash');var util=require(_0x7c81('0x0'));var logger=require('../../config/logger')(_0x7c81('0x1'));var moment=require(_0x7c81('0x2'));var BPromise=require('bluebird');var rp=require(_0x7c81('0x3'));var fs=require('fs');var path=require(_0x7c81('0x4'));var rimraf=require(_0x7c81('0x5'));var config=require(_0x7c81('0x6'));var attributes=require('./whatsappQueueReport.attributes');module[_0x7c81('0x7')]=function(_0x472e23,_0xbc6e67){return _0x472e23[_0x7c81('0x8')](_0x7c81('0x9'),attributes,{'tableName':_0x7c81('0xa'),'paranoid':![],'indexes':[{'name':_0x7c81('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x8ecf=['path','./whatsappQueueReport.attributes','WhatsappQueueReport','uniqueid','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x35ba25,_0x4ce7f3){var _0x353060=function(_0x1cbf5c){while(--_0x1cbf5c){_0x35ba25['push'](_0x35ba25['shift']());}};_0x353060(++_0x4ce7f3);}(_0x8ecf,0xb8));var _0xf8ec=function(_0x312afa,_0x439290){_0x312afa=_0x312afa-0x0;var _0x588f02=_0x8ecf[_0x312afa];return _0x588f02;};'use strict';var _=require(_0xf8ec('0x0'));var util=require(_0xf8ec('0x1'));var logger=require(_0xf8ec('0x2'))(_0xf8ec('0x3'));var moment=require(_0xf8ec('0x4'));var BPromise=require('bluebird');var rp=require(_0xf8ec('0x5'));var fs=require('fs');var path=require(_0xf8ec('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf8ec('0x7'));module['exports']=function(_0x60b81c,_0x37e149){return _0x60b81c['define'](_0xf8ec('0x8'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0xf8ec('0x9'),'fields':[_0xf8ec('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index e78240c..33317e7 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 _0x95fd=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateWhatsappQueueReport','body','options','raw','debug','UpdateWhatsappQueueReport','WhatsappQueueReport','update','where','limit','lodash','util','randomstring','ioredis','../../mysqldb'];(function(_0x5279cb,_0x1601be){var _0x55785a=function(_0x33fd36){while(--_0x33fd36){_0x5279cb['push'](_0x5279cb['shift']());}};_0x55785a(++_0x1601be);}(_0x95fd,0x16f));var _0xd95f=function(_0x4fdab7,_0x5b7829){_0x4fdab7=_0x4fdab7-0x0;var _0x474151=_0x95fd[_0x4fdab7];return _0x474151;};'use strict';var _=require(_0xd95f('0x0'));var util=require(_0xd95f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd95f('0x2'));var fs=require('fs');var Redis=require(_0xd95f('0x3'));var db=require(_0xd95f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd95f('0x5'))(_0xd95f('0x6'));var config=require(_0xd95f('0x7'));var jayson=require(_0xd95f('0x8'));var client=jayson[_0xd95f('0x9')][_0xd95f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x38627f,_0x4a0f13,_0x57d001){return new BPromise(function(_0x195bd5,_0x5247c6){return client[_0xd95f('0xb')](_0x38627f,_0x57d001)[_0xd95f('0xc')](function(_0x710393){logger[_0xd95f('0xd')](_0xd95f('0xe'),_0x4a0f13,_0xd95f('0xf'));logger['debug']('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x4a0f13,_0xd95f('0xf'),JSON[_0xd95f('0x10')](_0x710393));if(_0x710393[_0xd95f('0x11')]){if(_0x710393[_0xd95f('0x11')][_0xd95f('0x12')]===0x1f4){logger[_0xd95f('0x11')](_0xd95f('0xe'),_0x4a0f13,_0x710393[_0xd95f('0x11')]['message']);return _0x5247c6(_0x710393[_0xd95f('0x11')][_0xd95f('0x13')]);}logger[_0xd95f('0x11')](_0xd95f('0xe'),_0x4a0f13,_0x710393[_0xd95f('0x11')][_0xd95f('0x13')]);return _0x195bd5(_0x710393[_0xd95f('0x11')][_0xd95f('0x13')]);}else{logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0x4a0f13,'request\x20sent');_0x195bd5(_0x710393['result']['message']);}})[_0xd95f('0x14')](function(_0xbcc286){logger[_0xd95f('0x11')]('WhatsappQueueReport,\x20%s,\x20%s',_0x4a0f13,_0xbcc286);_0x5247c6(_0xbcc286);});});}exports[_0xd95f('0x15')]=function(_0x17726f){var _0x257c6d=this;return new Promise(function(_0x49f82d,_0x1b4d75){return db['WhatsappQueueReport']['create'](_0x17726f[_0xd95f('0x16')],{'raw':_0x17726f[_0xd95f('0x17')]?_0x17726f[_0xd95f('0x17')][_0xd95f('0x18')]===undefined?!![]:![]:!![]})[_0xd95f('0xc')](function(_0x2d6cfc){logger[_0xd95f('0xd')](_0xd95f('0x15'),_0x17726f);logger[_0xd95f('0x19')]('CreateWhatsappQueueReport',_0x17726f,JSON[_0xd95f('0x10')](_0x2d6cfc));_0x49f82d(_0x2d6cfc);})[_0xd95f('0x14')](function(_0x2f9352){logger[_0xd95f('0x11')](_0xd95f('0x15'),_0x2f9352[_0xd95f('0x13')],_0x17726f);_0x1b4d75(_0x257c6d[_0xd95f('0x11')](0x1f4,_0x2f9352[_0xd95f('0x13')]));});});};exports[_0xd95f('0x1a')]=function(_0x1d75a3){var _0x577fbe=this;return new Promise(function(_0x5e20b2,_0x17f4b2){return db[_0xd95f('0x1b')][_0xd95f('0x1c')](_0x1d75a3['body'],{'raw':_0x1d75a3['options']?_0x1d75a3[_0xd95f('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d75a3[_0xd95f('0x17')]?_0x1d75a3[_0xd95f('0x17')][_0xd95f('0x1d')]||null:null,'attributes':_0x1d75a3[_0xd95f('0x17')]?_0x1d75a3[_0xd95f('0x17')]['attributes']||null:null,'limit':_0x1d75a3[_0xd95f('0x17')]?_0x1d75a3[_0xd95f('0x17')][_0xd95f('0x1e')]||null:null})[_0xd95f('0xc')](function(_0x57fed6){logger[_0xd95f('0xd')]('UpdateWhatsappQueueReport',_0x1d75a3);logger[_0xd95f('0x19')](_0xd95f('0x1a'),_0x1d75a3,JSON['stringify'](_0x57fed6));_0x5e20b2(_0x57fed6);})[_0xd95f('0x14')](function(_0x2c2801){logger[_0xd95f('0x11')](_0xd95f('0x1a'),_0x2c2801[_0xd95f('0x13')],_0x1d75a3);_0x17f4b2(_0x577fbe[_0xd95f('0x11')](0x1f4,_0x2c2801[_0xd95f('0x13')]));});});}; \ No newline at end of file +var _0x210c=['request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','options','raw','update','body','UpdateWhatsappQueueReport','util','moment','bluebird','ioredis','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','WhatsappQueueReport,\x20%s,\x20%s'];(function(_0x3a282a,_0x10c986){var _0x1f98b7=function(_0x2d6b4c){while(--_0x2d6b4c){_0x3a282a['push'](_0x3a282a['shift']());}};_0x1f98b7(++_0x10c986);}(_0x210c,0x160));var _0xc210=function(_0x397dd0,_0x58a7a8){_0x397dd0=_0x397dd0-0x0;var _0x4188b2=_0x210c[_0x397dd0];return _0x4188b2;};'use strict';var _=require('lodash');var util=require(_0xc210('0x0'));var moment=require(_0xc210('0x1'));var BPromise=require(_0xc210('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc210('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc210('0x4'))('rpc');var config=require(_0xc210('0x5'));var jayson=require(_0xc210('0x6'));var client=jayson[_0xc210('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c2b16,_0x58c72a,_0x3f6cd7){return new BPromise(function(_0x1dc507,_0x33256a){return client[_0xc210('0x8')](_0x4c2b16,_0x3f6cd7)[_0xc210('0x9')](function(_0x155cfd){logger[_0xc210('0xa')](_0xc210('0xb'),_0x58c72a,_0xc210('0xc'));logger[_0xc210('0xd')](_0xc210('0xe'),_0x58c72a,'request\x20sent',JSON['stringify'](_0x155cfd));if(_0x155cfd['error']){if(_0x155cfd[_0xc210('0xf')]['code']===0x1f4){logger[_0xc210('0xf')](_0xc210('0xb'),_0x58c72a,_0x155cfd['error'][_0xc210('0x10')]);return _0x33256a(_0x155cfd[_0xc210('0xf')][_0xc210('0x10')]);}logger[_0xc210('0xf')](_0xc210('0xb'),_0x58c72a,_0x155cfd[_0xc210('0xf')]['message']);return _0x1dc507(_0x155cfd['error'][_0xc210('0x10')]);}else{logger[_0xc210('0xa')](_0xc210('0xb'),_0x58c72a,_0xc210('0xc'));_0x1dc507(_0x155cfd[_0xc210('0x11')][_0xc210('0x10')]);}})[_0xc210('0x12')](function(_0x35313c){logger[_0xc210('0xf')](_0xc210('0xb'),_0x58c72a,_0x35313c);_0x33256a(_0x35313c);});});}exports[_0xc210('0x13')]=function(_0x57f774){var _0x58b696=this;return new Promise(function(_0x1d3942,_0x13c139){return db[_0xc210('0x14')]['create'](_0x57f774['body'],{'raw':_0x57f774[_0xc210('0x15')]?_0x57f774['options'][_0xc210('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x5d8fdf){logger[_0xc210('0xa')](_0xc210('0x13'),_0x57f774);logger['debug'](_0xc210('0x13'),_0x57f774,JSON['stringify'](_0x5d8fdf));_0x1d3942(_0x5d8fdf);})['catch'](function(_0x1af428){logger['error'](_0xc210('0x13'),_0x1af428['message'],_0x57f774);_0x13c139(_0x58b696[_0xc210('0xf')](0x1f4,_0x1af428['message']));});});};exports['UpdateWhatsappQueueReport']=function(_0x1f3230){var _0x3f3a22=this;return new Promise(function(_0x3faecf,_0x499e35){return db[_0xc210('0x14')][_0xc210('0x17')](_0x1f3230[_0xc210('0x18')],{'raw':_0x1f3230['options']?_0x1f3230[_0xc210('0x15')][_0xc210('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f3230[_0xc210('0x15')]?_0x1f3230[_0xc210('0x15')]['where']||null:null,'attributes':_0x1f3230[_0xc210('0x15')]?_0x1f3230['options']['attributes']||null:null,'limit':_0x1f3230['options']?_0x1f3230['options']['limit']||null:null})[_0xc210('0x9')](function(_0x321ddc){logger['info'](_0xc210('0x19'),_0x1f3230);logger[_0xc210('0xd')](_0xc210('0x19'),_0x1f3230,JSON['stringify'](_0x321ddc));_0x3faecf(_0x321ddc);})['catch'](function(_0x2f07c2){logger[_0xc210('0xf')]('UpdateWhatsappQueueReport',_0x2f07c2[_0xc210('0x10')],_0x1f3230);_0x499e35(_0x3f3a22[_0xc210('0xf')](0x1f4,_0x2f07c2[_0xc210('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 0520646..85dba3c 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 _0x9269=['index','/describe','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x9269,0x1ae));var _0x9926=function(_0x2e0afd,_0x1a71f7){_0x2e0afd=_0x2e0afd-0x0;var _0x4cefad=_0x9269[_0x2e0afd];return _0x4cefad;};'use strict';var multer=require(_0x9926('0x0'));var util=require(_0x9926('0x1'));var path=require(_0x9926('0x2'));var timeout=require(_0x9926('0x3'));var express=require(_0x9926('0x4'));var router=express[_0x9926('0x5')]();var fs_extra=require(_0x9926('0x6'));var auth=require(_0x9926('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x9926('0x8'));var controller=require('./whatsappTransferReport.controller');router[_0x9926('0x9')]('/',auth['isAuthenticated'](),controller[_0x9926('0xa')]);router[_0x9926('0x9')](_0x9926('0xb'),auth[_0x9926('0xc')](),controller[_0x9926('0xd')]);router[_0x9926('0x9')](_0x9926('0xe'),auth[_0x9926('0xc')](),controller['show']);router[_0x9926('0xf')]('/',auth['isAuthenticated'](),controller[_0x9926('0x10')]);router[_0x9926('0x11')](_0x9926('0xe'),auth[_0x9926('0xc')](),controller[_0x9926('0x12')]);router[_0x9926('0x13')](_0x9926('0xe'),auth[_0x9926('0xc')](),controller[_0x9926('0x14')]);module[_0x9926('0x15')]=router; \ No newline at end of file +var _0x0aa6=['/describe','describe','get','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./whatsappTransferReport.controller','isAuthenticated'];(function(_0x51624b,_0x3c74a7){var _0x50a050=function(_0x1d4665){while(--_0x1d4665){_0x51624b['push'](_0x51624b['shift']());}};_0x50a050(++_0x3c74a7);}(_0x0aa6,0xb4));var _0x60aa=function(_0x4ebead,_0x427677){_0x4ebead=_0x4ebead-0x0;var _0x49daae=_0x0aa6[_0x4ebead];return _0x49daae;};'use strict';var multer=require('multer');var util=require(_0x60aa('0x0'));var path=require(_0x60aa('0x1'));var timeout=require(_0x60aa('0x2'));var express=require(_0x60aa('0x3'));var router=express[_0x60aa('0x4')]();var fs_extra=require(_0x60aa('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x60aa('0x6'));var controller=require(_0x60aa('0x7'));router['get']('/',auth[_0x60aa('0x8')](),controller['index']);router['get'](_0x60aa('0x9'),auth[_0x60aa('0x8')](),controller[_0x60aa('0xa')]);router[_0x60aa('0xb')](_0x60aa('0xc'),auth[_0x60aa('0x8')](),controller[_0x60aa('0xd')]);router[_0x60aa('0xe')]('/',auth['isAuthenticated'](),controller[_0x60aa('0xf')]);router[_0x60aa('0x10')](_0x60aa('0xc'),auth['isAuthenticated'](),controller[_0x60aa('0x11')]);router[_0x60aa('0x12')]('/:id',auth[_0x60aa('0x8')](),controller[_0x60aa('0x13')]);module[_0x60aa('0x14')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 52aebff..6ecf976 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 _0xae87=['account','agent','DATE'];(function(_0x564693,_0x2c46b6){var _0x505617=function(_0x166bc9){while(--_0x166bc9){_0x564693['push'](_0x564693['shift']());}};_0x505617(++_0x2c46b6);}(_0xae87,0x1ce));var _0x7ae8=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xae87[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x7ae8('0x0'),_0x7ae8('0x1'),'queue'),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x7ae8('0x2')]}}; \ No newline at end of file +var _0x4cf8=['DATE','sequelize','exports','STRING','ENUM','account','agent','queue'];(function(_0x4806ac,_0x181406){var _0x349c36=function(_0x892b20){while(--_0x892b20){_0x4806ac['push'](_0x4806ac['shift']());}};_0x349c36(++_0x181406);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x106214,_0x454b8d){_0x106214=_0x106214-0x0;var _0x5f5cea=_0x4cf8[_0x106214];return _0x5f5cea;};'use strict';var Sequelize=require(_0x84cf('0x0'));module[_0x84cf('0x1')]={'uniqueid':{'type':Sequelize[_0x84cf('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x84cf('0x3')](_0x84cf('0x4'),_0x84cf('0x5'),_0x84cf('0x6')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x84cf('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index fcfe617..79cc8ba 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 _0xdd2e=['create','body','update','params','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','Content-Range','json','reject','save','then','destroy','end','sendStatus','error','stack','name','send','index','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','map','VIRTUAL','options','includeAll','include','WhatsappTransferReport','findAll','rows','catch','show','find'];(function(_0x584291,_0x24b5b3){var _0x4e7d08=function(_0x59e0b1){while(--_0x59e0b1){_0x584291['push'](_0x584291['shift']());}};_0x4e7d08(++_0x24b5b3);}(_0xdd2e,0x13d));var _0xedd2=function(_0x16005d,_0x277bae){_0x16005d=_0x16005d-0x0;var _0x17878f=_0xdd2e[_0x16005d];return _0x17878f;};'use strict';var emlformat=require(_0xedd2('0x0'));var rimraf=require(_0xedd2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xedd2('0x2'));var rp=require(_0xedd2('0x3'));var moment=require('moment');var BPromise=require(_0xedd2('0x4'));var Mustache=require(_0xedd2('0x5'));var util=require(_0xedd2('0x6'));var path=require(_0xedd2('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xedd2('0x8'));var fs=require('fs');var fs_extra=require(_0xedd2('0x9'));var _=require(_0xedd2('0xa'));var squel=require(_0xedd2('0xb'));var crypto=require(_0xedd2('0xc'));var jsforce=require(_0xedd2('0xd'));var deskjs=require(_0xedd2('0xe'));var toCsv=require('to-csv');var querystring=require(_0xedd2('0xf'));var Papa=require('papaparse');var Redis=require(_0xedd2('0x10'));var authService=require(_0xedd2('0x11'));var qs=require(_0xedd2('0x12'));var as=require(_0xedd2('0x13'));var hardwareService=require(_0xedd2('0x14'));var logger=require(_0xedd2('0x15'))(_0xedd2('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xedd2('0x17'));var db=require(_0xedd2('0x18'))['db'];function respondWithStatusCode(_0x41cbc5,_0x13a487){_0x13a487=_0x13a487||0xcc;return function(_0x59e4b1){if(_0x59e4b1){return _0x41cbc5['sendStatus'](_0x13a487);}return _0x41cbc5[_0xedd2('0x19')](_0x13a487)['end']();};}function respondWithResult(_0x513c1a,_0x20ee63){_0x20ee63=_0x20ee63||0xc8;return function(_0x503d13){if(_0x503d13){return _0x513c1a[_0xedd2('0x19')](_0x20ee63)['json'](_0x503d13);}};}function respondWithFilteredResult(_0x321537,_0x48d3a7){return function(_0x1bd995){if(_0x1bd995){var _0x1330a7=typeof _0x48d3a7[_0xedd2('0x1a')]===_0xedd2('0x1b')&&typeof _0x48d3a7[_0xedd2('0x1c')]===_0xedd2('0x1b');var _0x198ba3=_0x1bd995[_0xedd2('0x1d')];var _0x2ed67b=_0x1330a7?0x0:_0x48d3a7[_0xedd2('0x1a')];var _0x6e597b=_0x1330a7?_0x1bd995[_0xedd2('0x1d')]:_0x48d3a7['offset']+_0x48d3a7['limit'];var _0x3ba22c;if(_0x6e597b>=_0x198ba3){_0x6e597b=_0x198ba3;_0x3ba22c=0xc8;}else{_0x3ba22c=0xce;}_0x321537[_0xedd2('0x19')](_0x3ba22c);return _0x321537['set'](_0xedd2('0x1e'),_0x2ed67b+'-'+_0x6e597b+'/'+_0x198ba3)[_0xedd2('0x1f')](_0x1bd995);}return null;};}function patchUpdates(_0xd9f8ae){return function(_0x149ea6){try{jsonpatch['apply'](_0x149ea6,_0xd9f8ae,!![]);}catch(_0x10f1ae){return BPromise[_0xedd2('0x20')](_0x10f1ae);}return _0x149ea6[_0xedd2('0x21')]();};}function saveUpdates(_0x11d7e2,_0x5a02a3){return function(_0x445d7a){if(_0x445d7a){return _0x445d7a['update'](_0x11d7e2)[_0xedd2('0x22')](function(_0x46bd61){return _0x46bd61;});}return null;};}function removeEntity(_0x51373a,_0x1afc7d){return function(_0x31f44b){if(_0x31f44b){return _0x31f44b[_0xedd2('0x23')]()[_0xedd2('0x22')](function(){_0x51373a[_0xedd2('0x19')](0xcc)[_0xedd2('0x24')]();});}};}function handleEntityNotFound(_0x5e9a0a,_0x598574){return function(_0x91d7c0){if(!_0x91d7c0){_0x5e9a0a[_0xedd2('0x25')](0x194);}return _0x91d7c0;};}function handleError(_0xff41ed,_0x4127bc){_0x4127bc=_0x4127bc||0x1f4;return function(_0x2f1079){logger[_0xedd2('0x26')](_0x2f1079[_0xedd2('0x27')]);if(_0x2f1079[_0xedd2('0x28')]){delete _0x2f1079[_0xedd2('0x28')];}_0xff41ed['status'](_0x4127bc)[_0xedd2('0x29')](_0x2f1079);};}exports[_0xedd2('0x2a')]=function(_0x5d47ab,_0x1c9c3f){var _0x18a830={},_0x57018a={},_0x3c72a4={'count':0x0,'rows':[]};var _0x214260=_['map'](db['WhatsappTransferReport'][_0xedd2('0x2b')],function(_0x534930){return{'name':_0x534930['fieldName'],'type':_0x534930[_0xedd2('0x2c')][_0xedd2('0x2d')]};});_0x57018a['model']=_['map'](_0x214260,_0xedd2('0x28'));_0x57018a[_0xedd2('0x2e')]=_[_0xedd2('0x2f')](_0x5d47ab['query']);_0x57018a[_0xedd2('0x30')]=_[_0xedd2('0x31')](_0x57018a[_0xedd2('0x32')],_0x57018a[_0xedd2('0x2e')]);_0x18a830[_0xedd2('0x33')]=_[_0xedd2('0x31')](_0x57018a['model'],qs[_0xedd2('0x34')](_0x5d47ab['query'][_0xedd2('0x34')]));_0x18a830['attributes']=_0x18a830[_0xedd2('0x33')][_0xedd2('0x35')]?_0x18a830[_0xedd2('0x33')]:_0x57018a[_0xedd2('0x32')];if(!_0x5d47ab['query'][_0xedd2('0x36')](_0xedd2('0x37'))){_0x18a830[_0xedd2('0x1c')]=qs[_0xedd2('0x1c')](_0x5d47ab[_0xedd2('0x2e')][_0xedd2('0x1c')]);_0x18a830[_0xedd2('0x1a')]=qs[_0xedd2('0x1a')](_0x5d47ab[_0xedd2('0x2e')]['offset']);}_0x18a830[_0xedd2('0x38')]=qs[_0xedd2('0x39')](_0x5d47ab[_0xedd2('0x2e')][_0xedd2('0x39')]);_0x18a830['where']=qs['filters'](_[_0xedd2('0x3a')](_0x5d47ab[_0xedd2('0x2e')],_0x57018a[_0xedd2('0x30')]),_0x214260);if(_0x5d47ab[_0xedd2('0x2e')][_0xedd2('0x3b')]){_0x18a830['where']=_[_0xedd2('0x3c')](_0x18a830[_0xedd2('0x3d')],{'$or':_[_0xedd2('0x3e')](_0x214260,function(_0x27a648){if(_0x27a648[_0xedd2('0x2c')]!==_0xedd2('0x3f')){var _0x315afc={};_0x315afc[_0x27a648['name']]={'$like':'%'+_0x5d47ab[_0xedd2('0x2e')][_0xedd2('0x3b')]+'%'};return _0x315afc;}})});}_0x18a830=_[_0xedd2('0x3c')]({},_0x18a830,_0x5d47ab[_0xedd2('0x40')]);var _0x3e6893={'where':_0x18a830['where']};return db['WhatsappTransferReport'][_0xedd2('0x1d')](_0x3e6893)[_0xedd2('0x22')](function(_0x3eed1b){_0x3c72a4[_0xedd2('0x1d')]=_0x3eed1b;if(_0x5d47ab[_0xedd2('0x2e')][_0xedd2('0x41')]){_0x18a830[_0xedd2('0x42')]=[{'all':!![]}];}return db[_0xedd2('0x43')][_0xedd2('0x44')](_0x18a830);})[_0xedd2('0x22')](function(_0x33efca){_0x3c72a4[_0xedd2('0x45')]=_0x33efca;return _0x3c72a4;})[_0xedd2('0x22')](respondWithFilteredResult(_0x1c9c3f,_0x18a830))[_0xedd2('0x46')](handleError(_0x1c9c3f,null));};exports[_0xedd2('0x47')]=function(_0x31a216,_0x1c38da){var _0x4605b9={'raw':!![],'where':{'id':_0x31a216['params']['id']}},_0x102d7e={};_0x102d7e[_0xedd2('0x32')]=_[_0xedd2('0x2f')](db[_0xedd2('0x43')]['rawAttributes']);_0x102d7e['query']=_['keys'](_0x31a216['query']);_0x102d7e[_0xedd2('0x30')]=_[_0xedd2('0x31')](_0x102d7e[_0xedd2('0x32')],_0x102d7e['query']);_0x4605b9[_0xedd2('0x33')]=_[_0xedd2('0x31')](_0x102d7e[_0xedd2('0x32')],qs[_0xedd2('0x34')](_0x31a216[_0xedd2('0x2e')][_0xedd2('0x34')]));_0x4605b9[_0xedd2('0x33')]=_0x4605b9[_0xedd2('0x33')][_0xedd2('0x35')]?_0x4605b9[_0xedd2('0x33')]:_0x102d7e['model'];if(_0x31a216[_0xedd2('0x2e')][_0xedd2('0x41')]){_0x4605b9[_0xedd2('0x42')]=[{'all':!![]}];}_0x4605b9=_[_0xedd2('0x3c')]({},_0x4605b9,_0x31a216[_0xedd2('0x40')]);return db[_0xedd2('0x43')][_0xedd2('0x48')](_0x4605b9)[_0xedd2('0x22')](handleEntityNotFound(_0x1c38da,null))['then'](respondWithResult(_0x1c38da,null))[_0xedd2('0x46')](handleError(_0x1c38da,null));};exports[_0xedd2('0x49')]=function(_0x27d3ca,_0x76d7ab){return db[_0xedd2('0x43')][_0xedd2('0x49')](_0x27d3ca[_0xedd2('0x4a')],{})[_0xedd2('0x22')](respondWithResult(_0x76d7ab,0xc9))[_0xedd2('0x46')](handleError(_0x76d7ab,null));};exports[_0xedd2('0x4b')]=function(_0xe248dc,_0x39c9e5){if(_0xe248dc[_0xedd2('0x4a')]['id']){delete _0xe248dc[_0xedd2('0x4a')]['id'];}return db[_0xedd2('0x43')][_0xedd2('0x48')]({'where':{'id':_0xe248dc[_0xedd2('0x4c')]['id']}})[_0xedd2('0x22')](handleEntityNotFound(_0x39c9e5,null))[_0xedd2('0x22')](saveUpdates(_0xe248dc[_0xedd2('0x4a')],null))[_0xedd2('0x22')](respondWithResult(_0x39c9e5,null))[_0xedd2('0x46')](handleError(_0x39c9e5,null));};exports[_0xedd2('0x23')]=function(_0x10e14f,_0x4bb8a4){return db[_0xedd2('0x43')][_0xedd2('0x48')]({'where':{'id':_0x10e14f[_0xedd2('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4bb8a4,null))['then'](removeEntity(_0x4bb8a4,null))[_0xedd2('0x46')](handleError(_0x4bb8a4,null));};exports['describe']=function(_0x4ab8cc,_0x1023b2){return db['WhatsappTransferReport'][_0xedd2('0x4d')]()['then'](respondWithResult(_0x1023b2,null))[_0xedd2('0x46')](handleError(_0x1023b2,null));}; \ No newline at end of file +var _0x3609=['query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','WhatsappTransferReport','count','findAll','then','catch','show','params','intersection','includeAll','include','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','update','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','keys'];(function(_0x84a85,_0x54e55c){var _0x1c2943=function(_0x99a250){while(--_0x99a250){_0x84a85['push'](_0x84a85['shift']());}};_0x1c2943(++_0x54e55c);}(_0x3609,0x101));var _0x9360=function(_0x59c2a0,_0x3e01e1){_0x59c2a0=_0x59c2a0-0x0;var _0x466854=_0x3609[_0x59c2a0];return _0x466854;};'use strict';var emlformat=require(_0x9360('0x0'));var rimraf=require(_0x9360('0x1'));var zipdir=require(_0x9360('0x2'));var jsonpatch=require(_0x9360('0x3'));var rp=require(_0x9360('0x4'));var moment=require(_0x9360('0x5'));var BPromise=require(_0x9360('0x6'));var Mustache=require('mustache');var util=require(_0x9360('0x7'));var path=require(_0x9360('0x8'));var sox=require(_0x9360('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9360('0xa'));var squel=require(_0x9360('0xb'));var crypto=require('crypto');var jsforce=require(_0x9360('0xc'));var deskjs=require(_0x9360('0xd'));var toCsv=require(_0x9360('0xe'));var querystring=require(_0x9360('0xf'));var Papa=require(_0x9360('0x10'));var Redis=require(_0x9360('0x11'));var authService=require(_0x9360('0x12'));var qs=require(_0x9360('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9360('0x14'))(_0x9360('0x15'));var utils=require(_0x9360('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x9360('0x17'));var db=require(_0x9360('0x18'))['db'];function respondWithStatusCode(_0x265b26,_0x1e1112){_0x1e1112=_0x1e1112||0xcc;return function(_0x359e01){if(_0x359e01){return _0x265b26[_0x9360('0x19')](_0x1e1112);}return _0x265b26[_0x9360('0x1a')](_0x1e1112)['end']();};}function respondWithResult(_0x5cb848,_0x16c686){_0x16c686=_0x16c686||0xc8;return function(_0x4ef4c1){if(_0x4ef4c1){return _0x5cb848[_0x9360('0x1a')](_0x16c686)[_0x9360('0x1b')](_0x4ef4c1);}};}function respondWithFilteredResult(_0x29a8aa,_0x42e9cb){return function(_0x4ee9b7){if(_0x4ee9b7){var _0x30b194=typeof _0x42e9cb[_0x9360('0x1c')]===_0x9360('0x1d')&&typeof _0x42e9cb[_0x9360('0x1e')]===_0x9360('0x1d');var _0x2bf175=_0x4ee9b7['count'];var _0x22bdb8=_0x30b194?0x0:_0x42e9cb[_0x9360('0x1c')];var _0x41d070=_0x30b194?_0x4ee9b7['count']:_0x42e9cb[_0x9360('0x1c')]+_0x42e9cb['limit'];var _0x24a0a6;if(_0x41d070>=_0x2bf175){_0x41d070=_0x2bf175;_0x24a0a6=0xc8;}else{_0x24a0a6=0xce;}_0x29a8aa[_0x9360('0x1a')](_0x24a0a6);return _0x29a8aa[_0x9360('0x1f')](_0x9360('0x20'),_0x22bdb8+'-'+_0x41d070+'/'+_0x2bf175)[_0x9360('0x1b')](_0x4ee9b7);}return null;};}function patchUpdates(_0x551e2d){return function(_0x57b024){try{jsonpatch[_0x9360('0x21')](_0x57b024,_0x551e2d,!![]);}catch(_0x112bd8){return BPromise[_0x9360('0x22')](_0x112bd8);}return _0x57b024['save']();};}function saveUpdates(_0x2937d0,_0x275d16){return function(_0x2135a7){if(_0x2135a7){return _0x2135a7[_0x9360('0x23')](_0x2937d0)['then'](function(_0x5f2bd4){return _0x5f2bd4;});}return null;};}function removeEntity(_0x52dcad,_0x59a944){return function(_0x57851f){if(_0x57851f){return _0x57851f['destroy']()['then'](function(){_0x52dcad[_0x9360('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x220dad,_0x3e512d){return function(_0x14559b){if(!_0x14559b){_0x220dad[_0x9360('0x19')](0x194);}return _0x14559b;};}function handleError(_0x42d9c2,_0x13417d){_0x13417d=_0x13417d||0x1f4;return function(_0x2d9627){logger[_0x9360('0x24')](_0x2d9627[_0x9360('0x25')]);if(_0x2d9627[_0x9360('0x26')]){delete _0x2d9627[_0x9360('0x26')];}_0x42d9c2[_0x9360('0x1a')](_0x13417d)['send'](_0x2d9627);};}exports[_0x9360('0x27')]=function(_0x593907,_0x44e586){var _0x5860d5={},_0x27674c={},_0x2318b2={'count':0x0,'rows':[]};var _0x1d578b=_[_0x9360('0x28')](db['WhatsappTransferReport'][_0x9360('0x29')],function(_0x2a1404){return{'name':_0x2a1404[_0x9360('0x2a')],'type':_0x2a1404[_0x9360('0x2b')][_0x9360('0x2c')]};});_0x27674c[_0x9360('0x2d')]=_['map'](_0x1d578b,'name');_0x27674c['query']=_[_0x9360('0x2e')](_0x593907[_0x9360('0x2f')]);_0x27674c[_0x9360('0x30')]=_['intersection'](_0x27674c['model'],_0x27674c['query']);_0x5860d5[_0x9360('0x31')]=_['intersection'](_0x27674c[_0x9360('0x2d')],qs[_0x9360('0x32')](_0x593907[_0x9360('0x2f')][_0x9360('0x32')]));_0x5860d5[_0x9360('0x31')]=_0x5860d5['attributes'][_0x9360('0x33')]?_0x5860d5['attributes']:_0x27674c['model'];if(!_0x593907[_0x9360('0x2f')][_0x9360('0x34')](_0x9360('0x35'))){_0x5860d5[_0x9360('0x1e')]=qs[_0x9360('0x1e')](_0x593907[_0x9360('0x2f')][_0x9360('0x1e')]);_0x5860d5[_0x9360('0x1c')]=qs[_0x9360('0x1c')](_0x593907[_0x9360('0x2f')][_0x9360('0x1c')]);}_0x5860d5[_0x9360('0x36')]=qs['sort'](_0x593907['query'][_0x9360('0x37')]);_0x5860d5[_0x9360('0x38')]=qs[_0x9360('0x30')](_[_0x9360('0x39')](_0x593907[_0x9360('0x2f')],_0x27674c[_0x9360('0x30')]),_0x1d578b);if(_0x593907['query'][_0x9360('0x3a')]){_0x5860d5[_0x9360('0x38')]=_[_0x9360('0x3b')](_0x5860d5[_0x9360('0x38')],{'$or':_['map'](_0x1d578b,function(_0x5b96a3){if(_0x5b96a3[_0x9360('0x2b')]!=='VIRTUAL'){var _0x1048ef={};_0x1048ef[_0x5b96a3[_0x9360('0x26')]]={'$like':'%'+_0x593907[_0x9360('0x2f')][_0x9360('0x3a')]+'%'};return _0x1048ef;}})});}_0x5860d5=_[_0x9360('0x3b')]({},_0x5860d5,_0x593907[_0x9360('0x3c')]);var _0x2bdbf0={'where':_0x5860d5[_0x9360('0x38')]};return db[_0x9360('0x3d')][_0x9360('0x3e')](_0x2bdbf0)['then'](function(_0x18c92a){_0x2318b2[_0x9360('0x3e')]=_0x18c92a;if(_0x593907[_0x9360('0x2f')]['includeAll']){_0x5860d5['include']=[{'all':!![]}];}return db[_0x9360('0x3d')][_0x9360('0x3f')](_0x5860d5);})['then'](function(_0x49df3c){_0x2318b2['rows']=_0x49df3c;return _0x2318b2;})[_0x9360('0x40')](respondWithFilteredResult(_0x44e586,_0x5860d5))[_0x9360('0x41')](handleError(_0x44e586,null));};exports[_0x9360('0x42')]=function(_0xab8bda,_0x50d664){var _0x568546={'raw':!![],'where':{'id':_0xab8bda[_0x9360('0x43')]['id']}},_0x38edb9={};_0x38edb9[_0x9360('0x2d')]=_[_0x9360('0x2e')](db['WhatsappTransferReport']['rawAttributes']);_0x38edb9[_0x9360('0x2f')]=_['keys'](_0xab8bda[_0x9360('0x2f')]);_0x38edb9['filters']=_[_0x9360('0x44')](_0x38edb9[_0x9360('0x2d')],_0x38edb9[_0x9360('0x2f')]);_0x568546[_0x9360('0x31')]=_[_0x9360('0x44')](_0x38edb9[_0x9360('0x2d')],qs[_0x9360('0x32')](_0xab8bda[_0x9360('0x2f')][_0x9360('0x32')]));_0x568546[_0x9360('0x31')]=_0x568546['attributes'][_0x9360('0x33')]?_0x568546['attributes']:_0x38edb9[_0x9360('0x2d')];if(_0xab8bda[_0x9360('0x2f')][_0x9360('0x45')]){_0x568546[_0x9360('0x46')]=[{'all':!![]}];}_0x568546=_['merge']({},_0x568546,_0xab8bda['options']);return db['WhatsappTransferReport']['find'](_0x568546)[_0x9360('0x40')](handleEntityNotFound(_0x50d664,null))[_0x9360('0x40')](respondWithResult(_0x50d664,null))[_0x9360('0x41')](handleError(_0x50d664,null));};exports['create']=function(_0x5075ab,_0x40861f){return db[_0x9360('0x3d')][_0x9360('0x47')](_0x5075ab[_0x9360('0x48')],{})[_0x9360('0x40')](respondWithResult(_0x40861f,0xc9))['catch'](handleError(_0x40861f,null));};exports[_0x9360('0x23')]=function(_0x206248,_0x57ee1b){if(_0x206248[_0x9360('0x48')]['id']){delete _0x206248[_0x9360('0x48')]['id'];}return db[_0x9360('0x3d')][_0x9360('0x49')]({'where':{'id':_0x206248['params']['id']}})[_0x9360('0x40')](handleEntityNotFound(_0x57ee1b,null))['then'](saveUpdates(_0x206248[_0x9360('0x48')],null))['then'](respondWithResult(_0x57ee1b,null))[_0x9360('0x41')](handleError(_0x57ee1b,null));};exports[_0x9360('0x4a')]=function(_0x54744d,_0x4be222){return db[_0x9360('0x3d')][_0x9360('0x49')]({'where':{'id':_0x54744d[_0x9360('0x43')]['id']}})[_0x9360('0x40')](handleEntityNotFound(_0x4be222,null))[_0x9360('0x40')](removeEntity(_0x4be222,null))[_0x9360('0x41')](handleError(_0x4be222,null));};exports['describe']=function(_0x1e6c29,_0x42059a){return db['WhatsappTransferReport'][_0x9360('0x4b')]()[_0x9360('0x40')](respondWithResult(_0x42059a,null))[_0x9360('0x41')](handleError(_0x42059a,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index d327706..05b35fd 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 _0x9cbd=['./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x3bf925,_0x4dd8e4){var _0x2128a1=function(_0x4d2049){while(--_0x4d2049){_0x3bf925['push'](_0x3bf925['shift']());}};_0x2128a1(++_0x4dd8e4);}(_0x9cbd,0x18e));var _0xd9cb=function(_0x368167,_0x5a1132){_0x368167=_0x368167-0x0;var _0x3962ba=_0x9cbd[_0x368167];return _0x3962ba;};'use strict';var _=require('lodash');var util=require(_0xd9cb('0x0'));var logger=require(_0xd9cb('0x1'))(_0xd9cb('0x2'));var moment=require(_0xd9cb('0x3'));var BPromise=require(_0xd9cb('0x4'));var rp=require(_0xd9cb('0x5'));var fs=require('fs');var path=require(_0xd9cb('0x6'));var rimraf=require('rimraf');var config=require(_0xd9cb('0x7'));var attributes=require(_0xd9cb('0x8'));module[_0xd9cb('0x9')]=function(_0x1aa02f,_0x3f8fb6){return _0x1aa02f[_0xd9cb('0xa')](_0xd9cb('0xb'),attributes,{'tableName':_0xd9cb('0xc'),'paranoid':![],'indexes':[{'name':_0xd9cb('0xd'),'fields':[_0xd9cb('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1c62=['WhatsappTransferReport','report_whatsapp_transfer','uniqueid','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./whatsappTransferReport.attributes','define'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x1c62,0xdb));var _0x21c6=function(_0x4991d6,_0x348deb){_0x4991d6=_0x4991d6-0x0;var _0x50faf7=_0x1c62[_0x4991d6];return _0x50faf7;};'use strict';var _=require('lodash');var util=require(_0x21c6('0x0'));var logger=require(_0x21c6('0x1'))(_0x21c6('0x2'));var moment=require(_0x21c6('0x3'));var BPromise=require('bluebird');var rp=require(_0x21c6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x21c6('0x5'));var config=require(_0x21c6('0x6'));var attributes=require(_0x21c6('0x7'));module['exports']=function(_0x115bb6,_0x22acd1){return _0x115bb6[_0x21c6('0x8')](_0x21c6('0x9'),attributes,{'tableName':_0x21c6('0xa'),'paranoid':![],'indexes':[{'name':_0x21c6('0xb'),'fields':[_0x21c6('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 6a287a9..8396730 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 _0x3e49=['jayson/promise','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0xf2a3bc,_0x5671b8){var _0x56708c=function(_0x42e7ac){while(--_0x42e7ac){_0xf2a3bc['push'](_0xf2a3bc['shift']());}};_0x56708c(++_0x5671b8);}(_0x3e49,0x1b1));var _0x93e4=function(_0xd67a3,_0x1abfa4){_0xd67a3=_0xd67a3-0x0;var _0x266de8=_0x3e49[_0xd67a3];return _0x266de8;};'use strict';var _=require(_0x93e4('0x0'));var util=require(_0x93e4('0x1'));var moment=require(_0x93e4('0x2'));var BPromise=require('bluebird');var rs=require(_0x93e4('0x3'));var fs=require('fs');var Redis=require(_0x93e4('0x4'));var db=require(_0x93e4('0x5'))['db'];var utils=require(_0x93e4('0x6'));var logger=require('../../config/logger')(_0x93e4('0x7'));var config=require('../../config/environment');var jayson=require(_0x93e4('0x8'));var client=jayson['client'][_0x93e4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x23e4a6,_0x348e98,_0x19dc2f){return new BPromise(function(_0x4737ad,_0x4e6ed9){return client[_0x93e4('0xa')](_0x23e4a6,_0x19dc2f)[_0x93e4('0xb')](function(_0x1c9cf9){logger[_0x93e4('0xc')](_0x93e4('0xd'),_0x348e98,_0x93e4('0xe'));logger[_0x93e4('0xf')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x348e98,_0x93e4('0xe'),JSON['stringify'](_0x1c9cf9));if(_0x1c9cf9[_0x93e4('0x10')]){if(_0x1c9cf9[_0x93e4('0x10')][_0x93e4('0x11')]===0x1f4){logger['error'](_0x93e4('0xd'),_0x348e98,_0x1c9cf9[_0x93e4('0x10')][_0x93e4('0x12')]);return _0x4e6ed9(_0x1c9cf9[_0x93e4('0x10')][_0x93e4('0x12')]);}logger[_0x93e4('0x10')](_0x93e4('0xd'),_0x348e98,_0x1c9cf9[_0x93e4('0x10')][_0x93e4('0x12')]);return _0x4737ad(_0x1c9cf9['error']['message']);}else{logger[_0x93e4('0xc')]('WhatsappTransferReport,\x20%s,\x20%s',_0x348e98,'request\x20sent');_0x4737ad(_0x1c9cf9[_0x93e4('0x13')]['message']);}})[_0x93e4('0x14')](function(_0x5f37e8){logger['error'](_0x93e4('0xd'),_0x348e98,_0x5f37e8);_0x4e6ed9(_0x5f37e8);});});} \ No newline at end of file +var _0x6c1d=['message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x20a9e,_0x55b46c){var _0x48f194=function(_0x4454b6){while(--_0x4454b6){_0x20a9e['push'](_0x20a9e['shift']());}};_0x48f194(++_0x55b46c);}(_0x6c1d,0xf9));var _0xd6c1=function(_0xc35932,_0x3ea565){_0xc35932=_0xc35932-0x0;var _0x31efda=_0x6c1d[_0xc35932];return _0x31efda;};'use strict';var _=require(_0xd6c1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd6c1('0x1'));var rs=require(_0xd6c1('0x2'));var fs=require('fs');var Redis=require(_0xd6c1('0x3'));var db=require(_0xd6c1('0x4'))['db'];var utils=require(_0xd6c1('0x5'));var logger=require('../../config/logger')(_0xd6c1('0x6'));var config=require('../../config/environment');var jayson=require(_0xd6c1('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c6cba,_0xee389a,_0x790ba0){return new BPromise(function(_0x536bfd,_0xec492e){return client['request'](_0x2c6cba,_0x790ba0)[_0xd6c1('0x8')](function(_0xee89f3){logger[_0xd6c1('0x9')](_0xd6c1('0xa'),_0xee389a,_0xd6c1('0xb'));logger[_0xd6c1('0xc')](_0xd6c1('0xd'),_0xee389a,'request\x20sent',JSON[_0xd6c1('0xe')](_0xee89f3));if(_0xee89f3[_0xd6c1('0xf')]){if(_0xee89f3[_0xd6c1('0xf')][_0xd6c1('0x10')]===0x1f4){logger[_0xd6c1('0xf')](_0xd6c1('0xa'),_0xee389a,_0xee89f3['error'][_0xd6c1('0x11')]);return _0xec492e(_0xee89f3[_0xd6c1('0xf')][_0xd6c1('0x11')]);}logger[_0xd6c1('0xf')]('WhatsappTransferReport,\x20%s,\x20%s',_0xee389a,_0xee89f3['error'][_0xd6c1('0x11')]);return _0x536bfd(_0xee89f3[_0xd6c1('0xf')][_0xd6c1('0x11')]);}else{logger[_0xd6c1('0x9')](_0xd6c1('0xa'),_0xee389a,'request\x20sent');_0x536bfd(_0xee89f3['result']['message']);}})[_0xd6c1('0x12')](function(_0x53e6f0){logger[_0xd6c1('0xf')]('WhatsappTransferReport,\x20%s,\x20%s',_0xee389a,_0x53e6f0);_0xec492e(_0x53e6f0);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index beef57d..7021d75 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2cea=['map','filter','online','name','join','status','None','seedDB','./config/seedDB','default','./config/license','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','./mysqldb','./config/environment','./config/logger','app','./config/schedule','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','listen','then','info','start','Online\x20apps:'];(function(_0xd214ef,_0x4b28fe){var _0x656ed7=function(_0x555ef7){while(--_0x555ef7){_0xd214ef['push'](_0xd214ef['shift']());}};_0x656ed7(++_0x4b28fe);}(_0x2cea,0x11c));var _0xa2ce=function(_0xe3cfba,_0x14d39e){_0xe3cfba=_0xe3cfba-0x0;var _0x3feb92=_0x2cea[_0xe3cfba];return _0x3feb92;};'use strict';var _=require('lodash');var mysqldb=require(_0xa2ce('0x0'));var rpc=require('./rpc');var config=require(_0xa2ce('0x1'));var logger=require(_0xa2ce('0x2'))(_0xa2ce('0x3'));var pm2=require('./config/pm2');var pm2Config=require('./config/pm2/config');var schedule=require(_0xa2ce('0x4'));var chat=require('./config/schedule/chat');var whatsapp=require(_0xa2ce('0x5'));var transcribe=require(_0xa2ce('0x6'));function main(){return mysqldb['db'][_0xa2ce('0x7')]['sync']()['then'](function(){return rpc[_0xa2ce('0x8')]();})[_0xa2ce('0x9')](function(_0x5ece69){logger[_0xa2ce('0xa')](_0x5ece69);return chat['start']();})[_0xa2ce('0x9')](function(){return whatsapp['start']();})[_0xa2ce('0x9')](function(){return schedule[_0xa2ce('0xb')]();})[_0xa2ce('0x9')](function(){return transcribe[_0xa2ce('0xb')]();})['then'](function(_0x56884d){logger[_0xa2ce('0xa')](_0x56884d);return pm2[_0xa2ce('0xb')](pm2Config);})[_0xa2ce('0x9')](function(_0x8664e8){logger[_0xa2ce('0xa')](_0xa2ce('0xc'),_[_0xa2ce('0xd')](_[_0xa2ce('0xe')](_0x8664e8,{'status':_0xa2ce('0xf')}),_0xa2ce('0x10'))[_0xa2ce('0x11')]());logger['info']('Offline\x20apps:',_[_0xa2ce('0xd')](_['filter'](_0x8664e8,function(_0x252d27){return _0x252d27[_0xa2ce('0x12')]!=='online';}),_0xa2ce('0x10'))[_0xa2ce('0x11')]()||_0xa2ce('0x13'));config[_0xa2ce('0x14')]&&require(_0xa2ce('0x15'))[_0xa2ce('0x16')]();require(_0xa2ce('0x17'))[_0xa2ce('0x16')]();})[_0xa2ce('0x18')](function(_0x8c86b){logger[_0xa2ce('0x19')](_0xa2ce('0x1a'),_0x8c86b);process['exit'](0x1);});}main(); \ No newline at end of file +var _0xb930=['./config/environment','./config/logger','app','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','sync','then','info','start','filter','online','name','Offline\x20apps:','status','None','./config/seedDB','default','./config/license','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./mysqldb'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0xb930,0x1ae));var _0x0b93=function(_0x13cc6f,_0x3969b9){_0x13cc6f=_0x13cc6f-0x0;var _0x1bdfba=_0xb930[_0x13cc6f];return _0x1bdfba;};'use strict';var _=require(_0x0b93('0x0'));var mysqldb=require(_0x0b93('0x1'));var rpc=require('./rpc');var config=require(_0x0b93('0x2'));var logger=require(_0x0b93('0x3'))(_0x0b93('0x4'));var pm2=require('./config/pm2');var pm2Config=require(_0x0b93('0x5'));var schedule=require(_0x0b93('0x6'));var chat=require(_0x0b93('0x7'));var whatsapp=require(_0x0b93('0x8'));var transcribe=require(_0x0b93('0x9'));function main(){return mysqldb['db'][_0x0b93('0xa')][_0x0b93('0xb')]()[_0x0b93('0xc')](function(){return rpc['listen']();})['then'](function(_0xb43b0e){logger[_0x0b93('0xd')](_0xb43b0e);return chat[_0x0b93('0xe')]();})[_0x0b93('0xc')](function(){return whatsapp[_0x0b93('0xe')]();})[_0x0b93('0xc')](function(){return schedule[_0x0b93('0xe')]();})[_0x0b93('0xc')](function(){return transcribe[_0x0b93('0xe')]();})[_0x0b93('0xc')](function(_0x3a22fa){logger[_0x0b93('0xd')](_0x3a22fa);return pm2[_0x0b93('0xe')](pm2Config);})[_0x0b93('0xc')](function(_0x2db92f){logger['info']('Online\x20apps:',_['map'](_[_0x0b93('0xf')](_0x2db92f,{'status':_0x0b93('0x10')}),_0x0b93('0x11'))['join']());logger[_0x0b93('0xd')](_0x0b93('0x12'),_['map'](_[_0x0b93('0xf')](_0x2db92f,function(_0x3d3d9d){return _0x3d3d9d[_0x0b93('0x13')]!==_0x0b93('0x10');}),_0x0b93('0x11'))['join']()||_0x0b93('0x14'));config['seedDB']&&require(_0x0b93('0x15'))[_0x0b93('0x16')]();require(_0x0b93('0x17'))[_0x0b93('0x16')]();})[_0x0b93('0x18')](function(_0x1b49c0){logger[_0x0b93('0x19')](_0x0b93('0x1a'),_0x1b49c0);process['exit'](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index c91077f..b2a14e6 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 _0x845a=['userProfileId','privacyEnabled','settingsEnabled','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','disposition','then','status','unmanaged','json','Forbidden.','catch','headers','startsWith','authorization','User','authenticate','pass','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','find','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','nonce','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isMiddleware','signToken','setTokenCookie','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyNonce','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','updatePasswordsHistory','length','unshift','join','promisify','sign','payload','options','verify','randomBytes','toString','floor','now','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','lodash','express-jwt','composable-middleware','basic-auth','crypto','bluebird','moment','secrets','session','role','fullname','name','internal','email','userpic','permissions','md5secret','voicePause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','crudPermissions','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x845a,0x1d1));var _0xa845=function(_0x36a0bb,_0x367dfd){_0x36a0bb=_0x36a0bb-0x0;var _0x2f59fd=_0x845a[_0x36a0bb];return _0x2f59fd;};'use strict';var db=require(_0xa845('0x0'))['db'];var config=require(_0xa845('0x1'));var hardwareConf=require(_0xa845('0x2'));var licenseUtil=require(_0xa845('0x3'));var encryptor=require('../encryptor');var _=require(_0xa845('0x4'));var jwt=require('jsonwebtoken');var expressJwt=require(_0xa845('0x5'));var compose=require(_0xa845('0x6'));var basicAuth=require(_0xa845('0x7'));var crypto=require(_0xa845('0x8'));var BPromise=require(_0xa845('0x9'));var util=require('util');var moment=require(_0xa845('0xa'));var validateJwt=expressJwt({'secret':config[_0xa845('0xb')][_0xa845('0xc')]});var userAttributes=['id',_0xa845('0xd'),_0xa845('0xe'),_0xa845('0xf'),_0xa845('0x10'),_0xa845('0x11'),_0xa845('0x12'),_0xa845('0x13'),_0xa845('0x14'),_0xa845('0x15'),'chatPause','mailPause',_0xa845('0x16'),_0xa845('0x17'),_0xa845('0x18'),_0xa845('0x19'),_0xa845('0x1a'),_0xa845('0x1b'),'lastPauseAt',_0xa845('0x1c'),'allowmessenger','passwordResetAt',_0xa845('0x1d'),_0xa845('0x1e'),_0xa845('0x1f'),_0xa845('0x20'),_0xa845('0x21'),'phoneBarEnableDtmfTone',_0xa845('0x22'),_0xa845('0x23'),'phoneBarPrefixRequired',_0xa845('0x24'),_0xa845('0x25'),_0xa845('0x26'),'interface',_0xa845('0x27'),_0xa845('0x28'),_0xa845('0x29'),'wssPort',_0xa845('0x2a'),_0xa845('0x2b'),_0xa845('0x2c')];exports[_0xa845('0x2d')]=function(){return this[_0xa845('0x2e')](!![])[_0xa845('0x2f')](function(_0x509191,_0x5137c2,_0x4b237d){if(_0x509191[_0xa845('0x30')]){_0x4b237d();}else{return db[_0xa845('0x31')][_0xa845('0x32')]({'where':{'id':_0x509191[_0xa845('0x33')]['id']},'attributes':['id','closed',_0xa845('0x34')],'raw':!![]})[_0xa845('0x35')](function(_0x2661dc){if(_0x2661dc&&_0x2661dc['closed']){return _0x5137c2[_0xa845('0x36')](_0x2661dc[_0xa845('0x34')]===_0xa845('0x37')?0x195:0x193)[_0xa845('0x38')]({'message':_0x2661dc[_0xa845('0x34')]===_0xa845('0x37')?'Unmanaged.':_0xa845('0x39')});}else{_0x4b237d();}})[_0xa845('0x3a')](function(_0x5ee788){_0x4b237d(_0x5ee788);});}});};exports[_0xa845('0x2e')]=function isAuthenticated(_0x28d8d2){return compose()[_0xa845('0x2f')](function(_0x7b3543,_0x505844,_0x953971){var _0x2cee8a;if(_0x7b3543[_0xa845('0x3b')]['authorization']){if(_[_0xa845('0x3c')](_0x7b3543[_0xa845('0x3b')][_0xa845('0x3d')],'Basic')){var _0x3a180d=basicAuth(_0x7b3543);db[_0xa845('0x3e')]['find']({'where':{'name':_0x3a180d[_0xa845('0xf')]}})[_0xa845('0x35')](function(_0x10ad35){if(!_0x10ad35||!_0x10ad35[_0xa845('0x3f')](_0x3a180d[_0xa845('0x40')])){return _0x505844[_0xa845('0x36')](0x191)[_0xa845('0x38')]({'message':_0xa845('0x41')});}_0x7b3543[_0xa845('0x30')]={'id':_0x10ad35['id']};_0x953971();})['catch'](function(_0x1b8e3b){_0x953971(_0x1b8e3b);});}else if(_['startsWith'](_0x7b3543[_0xa845('0x3b')][_0xa845('0x3d')],_0xa845('0x42'))){validateJwt(_0x7b3543,_0x505844,_0x953971);}else{if(_0x28d8d2){_0x953971();}else{return _0x505844[_0xa845('0x36')](0x193)[_0xa845('0x38')]({'message':_0xa845('0x43')});}}}else if(_0x7b3543[_0xa845('0x44')][_0xa845('0x45')]){try{var _0x3ad826={'audience':hardwareConf[_0xa845('0x46')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x7b3543[_0xa845('0x44')]['apikey'],_0x3ad826)[_0xa845('0x35')](function(_0x8ecaba){return db[_0xa845('0x3e')][_0xa845('0x47')]({'where':{'id':_0x8ecaba[_0xa845('0x48')]}})[_0xa845('0x35')](function(_0x3fa540){_0x2cee8a=_0x3fa540;return db[_0xa845('0x49')][_0xa845('0x32')]({'where':{'id':0x1},'attributes':[_0xa845('0x4a'),_0xa845('0x4b')],'raw':!![]});})[_0xa845('0x35')](function(_0x4b62f8){if(!_0x2cee8a||!_[_0xa845('0x4c')](_0x2cee8a['apiKeyNonce'],_0x8ecaba[_0xa845('0x4d')])){return _0x505844[_0xa845('0x36')](0x191)['json']({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x2cee8a[_0xa845('0x4e')]){return _0x505844['status'](0x191)['json']({'message':_0xa845('0x4f')});}if(_0x2cee8a[_0xa845('0x50')]){if(_0x4b62f8[_0xa845('0x4b')]>0x0){if(moment(_0x2cee8a[_0xa845('0x51')])[_0xa845('0x52')](_0x4b62f8['blockDuration'],_0xa845('0x53'))>moment()){return _0x505844[_0xa845('0x36')](0x191)[_0xa845('0x38')]({'message':_0xa845('0x4f')});}}else{return _0x505844[_0xa845('0x36')](0x191)[_0xa845('0x38')]({'message':_0xa845('0x4f')});}}_0x7b3543['user']={'id':_0x2cee8a['id']};_0x953971();});})[_0xa845('0x3a')](function(){return _0x505844['status'](0x191)['json']({'message':_0xa845('0x4f')});});}catch(_0x343164){_0x953971(_0x343164);}}else if(_0x28d8d2){_0x953971();}else{return _0x505844['status'](0x193)[_0xa845('0x38')]({'message':'Unknown\x20authorization\x20format'});}})[_0xa845('0x2f')](function(_0x4ac386,_0x28d728,_0x2a86b5){if(_0x4ac386['user']){db['User'][_0xa845('0x47')]({'where':{'id':_0x4ac386['user']['id']},'attributes':userAttributes})[_0xa845('0x35')](function(_0x5e7fe2){if(!_0x5e7fe2){return _0x28d728[_0xa845('0x36')](0x194)[_0xa845('0x38')]({'message':_0xa845('0x54')});}_0x4ac386[_0xa845('0x30')]=_0x5e7fe2;_0x2a86b5();})[_0xa845('0x3a')](function(_0x383696){_0x2a86b5(_0x383696);});}else if(_0x28d8d2){_0x2a86b5();}else{return _0x28d728[_0xa845('0x36')](0x194)['json']({'message':_0xa845('0x55')});}});};exports[_0xa845('0x56')]=function canUpdate(){return compose()['use'](function(_0x5b32c4,_0x465cea,_0x5c8c8b){return licenseUtil[_0xa845('0x57')]()[_0xa845('0x35')](function(_0x246f95){if(_0x246f95[_0xa845('0x58')]){_0x5c8c8b();}else{return _0x465cea[_0xa845('0x36')](0x193)[_0xa845('0x38')]({'message':_0xa845('0x59')});}})[_0xa845('0x3a')](function(_0x5689b8){_0x5c8c8b(_0x5689b8);});});};exports[_0xa845('0x5a')]=function(_0x391451,_0x2fce98,_0x3e354d){_0x391451[_0xa845('0x5a')]=!![];return _0x3e354d();};exports[_0xa845('0x5b')]=function signToken(_0x3b4162){return signJwt(_0x3b4162);};exports[_0xa845('0x5c')]=function(_0x4247d4,_0x1ba221){if(!_0x4247d4[_0xa845('0x30')]){return _0x1ba221[_0xa845('0x36')](0x194)[_0xa845('0x38')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0xbad1ae={'payload':{'id':_0x4247d4[_0xa845('0x30')]['id'],'role':_0x4247d4[_0xa845('0x30')][_0xa845('0xd')]},'options':{'expiresIn':0x15180}};return signJwt(_0xbad1ae)['then'](function(_0x2ab8d7){_0x1ba221[_0xa845('0x5d')](_0xa845('0x5e'),_0x2ab8d7);_0x1ba221[_0xa845('0x5f')](_0xa845('0x60'));})[_0xa845('0x3a')](function(_0x70bb13){return _0x1ba221[_0xa845('0x36')](0x1f4)[_0xa845('0x61')](_0x70bb13);});};exports[_0xa845('0x62')]=function(_0x4465f6){if(_[_0xa845('0x63')](_0x4465f6[_0xa845('0x64')])||_[_0xa845('0x63')](_0x4465f6['apiKeyIat'])){return null;}else{return createJwt(_0x4465f6);}};exports['generateApiKey']=function(_0x5e217a){_0x5e217a[_0xa845('0x64')]=generateNonce();_0x5e217a[_0xa845('0x65')]=generateIssuedAt();return createJwt(_0x5e217a);};exports[_0xa845('0x66')]=function(_0x5870e2,_0x49818c){var _0x307c51=_0x5870e2['query'][_0xa845('0x45')];if(_0x307c51){var _0x3563ae={'nonce':_0x49818c['apiKeyNonce'],'iat':_0x49818c[_0xa845('0x65')],'audience':hardwareConf[_0xa845('0x46')](),'issuer':hardwareConf[_0xa845('0x46')]()};return verifyJwt(_0x307c51,_0x3563ae)[_0xa845('0x35')](function(){return generateApiKey(_0x49818c);});}else{throw{'message':_0xa845('0x67')};}};exports['validatePasswordPattern']=function(_0x3291d0){var _0x114f34=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x114f34['test'](_0x3291d0))throw new db['Sequelize'][(_0xa845('0x68'))](_0xa845('0x69'));return;};exports[_0xa845('0x6a')]=function(_0x22ca77,_0x182f1d,_0x43256f){var _0x381da0=encryptor['decryptString'](_0x182f1d)[_0xa845('0x6b')](',');for(var _0x47f13a=0x0;_0x47f13a<_0x43256f;_0x47f13a++){if(!_0x381da0[_0x47f13a])break;if(_0x22ca77[_0xa845('0x6c')]()===_0x381da0[_0x47f13a][_0xa845('0x6c')]()){var _0x3cbb38=util[_0xa845('0x6d')](_0xa845('0x6e'),_0x43256f);if(_0x43256f===0x1){_0x3cbb38=_0xa845('0x6f');}throw new db[(_0xa845('0x70'))][(_0xa845('0x68'))](_0x3cbb38);}}return;};exports[_0xa845('0x71')]=function(_0x41559e,_0x15bfd9){var _0xba6ef=_0x15bfd9?encryptor['decryptString'](_0x15bfd9)[_0xa845('0x6b')](','):[];if(_0xba6ef[_0xa845('0x72')]===0x5){_0xba6ef['splice'](-0x1,0x1);}_0xba6ef[_0xa845('0x73')](_0x41559e);return encryptor['encryptString'](_0xba6ef[_0xa845('0x74')](','));};function signJwt(_0x44203e){var _0x598a68=BPromise[_0xa845('0x75')](jwt[_0xa845('0x76')],{'context':jwt});var _0x484df5=_0x44203e['secret']||config[_0xa845('0xb')][_0xa845('0xc')];return new BPromise(function(_0x7c9e12,_0x1f71ca){_0x598a68(_0x44203e[_0xa845('0x77')],_0x484df5,_0x44203e[_0xa845('0x78')])['then'](function(_0x2b9cf5){_0x7c9e12(_0x2b9cf5);})[_0xa845('0x3a')](function(_0xa23f68){_0x1f71ca(_0xa23f68);});});}function verifyJwt(_0x9243bb,_0x2f6587,_0xb763bf){var _0x5ba72e=BPromise[_0xa845('0x75')](jwt[_0xa845('0x79')],{'context':jwt});var _0x1909c3=_0xb763bf||config[_0xa845('0xb')]['session'];return new BPromise(function(_0x2a0916,_0xcfe9c5){_0x5ba72e(_0x9243bb,_0x1909c3,_0x2f6587)[_0xa845('0x35')](function(_0x24b74a){_0x2a0916(_0x24b74a);})[_0xa845('0x3a')](function(_0x3169e4){_0xcfe9c5(_0x3169e4);});});}function generateNonce(){return crypto[_0xa845('0x7a')](0x10)[_0xa845('0x7b')]('hex');}function generateIssuedAt(){return Math[_0xa845('0x7c')](Date[_0xa845('0x7d')]()/0x3e8)['toString']();}function createJwt(_0x371ce4){var _0x34e157={'payload':{'iat':_0x371ce4[_0xa845('0x65')],'nonce':_0x371ce4['apiKeyNonce']},'options':{'algorithm':'HS512','subject':_0x371ce4['id'][_0xa845('0x7b')](),'issuer':hardwareConf[_0xa845('0x46')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x34e157)[_0xa845('0x35')](function(_0xdf276f){return{'iat':_0x371ce4[_0xa845('0x65')],'nonce':_0x371ce4[_0xa845('0x64')],'token':_0xdf276f};});} \ No newline at end of file +var _0xc842=['role','name','internal','email','permissions','md5secret','voicePause','chatPause','mailPause','smsPause','openchannelPause','showWebBar','lastLoginAt','crudPermissions','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','settingsEnabled','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','isChatInteractionAuthorized','isAuthenticated','use','ChatInteraction','params','closed','status','disposition','unmanaged','json','Forbidden.','catch','headers','startsWith','authorization','find','then','pass','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','findOne','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','blocked','add','user','Invalid\x20API\x20access\x20key','User','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','isMiddleware','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','/dashboards/general','retrieveApiKey','isNil','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','splice','unshift','encryptString','promisify','sign','payload','verify','randomBytes','hex','floor','now','toString','HS512','../../mysqldb','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','bluebird','util','moment','secrets','session'];(function(_0x2b98fa,_0x23ed96){var _0x11b64f=function(_0x3c6050){while(--_0x3c6050){_0x2b98fa['push'](_0x2b98fa['shift']());}};_0x11b64f(++_0x23ed96);}(_0xc842,0x16a));var _0x2c84=function(_0x1ae5ab,_0xc5d441){_0x1ae5ab=_0x1ae5ab-0x0;var _0x1ce001=_0xc842[_0x1ae5ab];return _0x1ce001;};'use strict';var db=require(_0x2c84('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0x2c84('0x1'));var licenseUtil=require(_0x2c84('0x2'));var encryptor=require(_0x2c84('0x3'));var _=require(_0x2c84('0x4'));var jwt=require(_0x2c84('0x5'));var expressJwt=require(_0x2c84('0x6'));var compose=require(_0x2c84('0x7'));var basicAuth=require('basic-auth');var crypto=require('crypto');var BPromise=require(_0x2c84('0x8'));var util=require(_0x2c84('0x9'));var moment=require(_0x2c84('0xa'));var validateJwt=expressJwt({'secret':config[_0x2c84('0xb')][_0x2c84('0xc')]});var userAttributes=['id',_0x2c84('0xd'),'fullname',_0x2c84('0xe'),_0x2c84('0xf'),_0x2c84('0x10'),'userpic',_0x2c84('0x11'),_0x2c84('0x12'),_0x2c84('0x13'),_0x2c84('0x14'),_0x2c84('0x15'),'faxPause',_0x2c84('0x16'),_0x2c84('0x17'),'pauseType',_0x2c84('0x18'),_0x2c84('0x19'),'lastPauseAt',_0x2c84('0x1a'),'allowmessenger','passwordResetAt',_0x2c84('0x1b'),_0x2c84('0x1c'),_0x2c84('0x1d'),_0x2c84('0x1e'),'phoneBarEnableRecording','phoneBarEnableDtmfTone',_0x2c84('0x1f'),_0x2c84('0x20'),_0x2c84('0x21'),_0x2c84('0x22'),_0x2c84('0x23'),_0x2c84('0x24'),_0x2c84('0x25'),_0x2c84('0x26'),_0x2c84('0x27'),_0x2c84('0x28'),'wssPort',_0x2c84('0x29'),_0x2c84('0x2a'),_0x2c84('0x2b')];exports[_0x2c84('0x2c')]=function(){return this[_0x2c84('0x2d')](!![])[_0x2c84('0x2e')](function(_0x284431,_0xb7ddb4,_0x435cf5){if(_0x284431['user']){_0x435cf5();}else{return db[_0x2c84('0x2f')]['findOne']({'where':{'id':_0x284431[_0x2c84('0x30')]['id']},'attributes':['id',_0x2c84('0x31'),'disposition'],'raw':!![]})['then'](function(_0x4ba23a){if(_0x4ba23a&&_0x4ba23a[_0x2c84('0x31')]){return _0xb7ddb4[_0x2c84('0x32')](_0x4ba23a[_0x2c84('0x33')]===_0x2c84('0x34')?0x195:0x193)[_0x2c84('0x35')]({'message':_0x4ba23a[_0x2c84('0x33')]==='unmanaged'?'Unmanaged.':_0x2c84('0x36')});}else{_0x435cf5();}})[_0x2c84('0x37')](function(_0x2bdf59){_0x435cf5(_0x2bdf59);});}});};exports[_0x2c84('0x2d')]=function isAuthenticated(_0x614012){return compose()['use'](function(_0x4e32fa,_0x2f0fea,_0x35c58c){var _0x4d30ac;if(_0x4e32fa[_0x2c84('0x38')]['authorization']){if(_[_0x2c84('0x39')](_0x4e32fa[_0x2c84('0x38')][_0x2c84('0x3a')],'Basic')){var _0x5291d6=basicAuth(_0x4e32fa);db['User'][_0x2c84('0x3b')]({'where':{'name':_0x5291d6[_0x2c84('0xe')]}})[_0x2c84('0x3c')](function(_0x429169){if(!_0x429169||!_0x429169['authenticate'](_0x5291d6[_0x2c84('0x3d')])){return _0x2f0fea[_0x2c84('0x32')](0x191)[_0x2c84('0x35')]({'message':_0x2c84('0x3e')});}_0x4e32fa['user']={'id':_0x429169['id']};_0x35c58c();})[_0x2c84('0x37')](function(_0x43ee33){_0x35c58c(_0x43ee33);});}else if(_[_0x2c84('0x39')](_0x4e32fa[_0x2c84('0x38')]['authorization'],_0x2c84('0x3f'))){validateJwt(_0x4e32fa,_0x2f0fea,_0x35c58c);}else{if(_0x614012){_0x35c58c();}else{return _0x2f0fea[_0x2c84('0x32')](0x193)[_0x2c84('0x35')]({'message':_0x2c84('0x40')});}}}else if(_0x4e32fa[_0x2c84('0x41')][_0x2c84('0x42')]){try{var _0x35df8d={'audience':hardwareConf[_0x2c84('0x43')](),'issuer':hardwareConf[_0x2c84('0x43')]()};verifyJwt(_0x4e32fa['query'][_0x2c84('0x42')],_0x35df8d)[_0x2c84('0x3c')](function(_0x8f88c0){return db['User']['find']({'where':{'id':_0x8f88c0[_0x2c84('0x44')]}})[_0x2c84('0x3c')](function(_0x500728){_0x4d30ac=_0x500728;return db[_0x2c84('0x45')][_0x2c84('0x46')]({'where':{'id':0x1},'attributes':[_0x2c84('0x47'),_0x2c84('0x48')],'raw':!![]});})[_0x2c84('0x3c')](function(_0x931767){if(!_0x4d30ac||!_[_0x2c84('0x49')](_0x4d30ac[_0x2c84('0x4a')],_0x8f88c0[_0x2c84('0x4b')])){return _0x2f0fea[_0x2c84('0x32')](0x191)['json']({'message':_0x2c84('0x4c')});}if(_0x4d30ac[_0x2c84('0x4d')]){return _0x2f0fea[_0x2c84('0x32')](0x191)[_0x2c84('0x35')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x4d30ac[_0x2c84('0x4e')]){if(_0x931767['blockDuration']>0x0){if(moment(_0x4d30ac['blockedAt'])[_0x2c84('0x4f')](_0x931767[_0x2c84('0x48')],'minutes')>moment()){return _0x2f0fea[_0x2c84('0x32')](0x191)[_0x2c84('0x35')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x2f0fea[_0x2c84('0x32')](0x191)[_0x2c84('0x35')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x4e32fa[_0x2c84('0x50')]={'id':_0x4d30ac['id']};_0x35c58c();});})['catch'](function(){return _0x2f0fea[_0x2c84('0x32')](0x191)['json']({'message':_0x2c84('0x51')});});}catch(_0x20edab){_0x35c58c(_0x20edab);}}else if(_0x614012){_0x35c58c();}else{return _0x2f0fea[_0x2c84('0x32')](0x193)[_0x2c84('0x35')]({'message':'Unknown\x20authorization\x20format'});}})[_0x2c84('0x2e')](function(_0x7b7164,_0x40d3c4,_0x1a283f){if(_0x7b7164[_0x2c84('0x50')]){db[_0x2c84('0x52')][_0x2c84('0x3b')]({'where':{'id':_0x7b7164[_0x2c84('0x50')]['id']},'attributes':userAttributes})[_0x2c84('0x3c')](function(_0x5edeb0){if(!_0x5edeb0){return _0x40d3c4[_0x2c84('0x32')](0x194)[_0x2c84('0x35')]({'message':_0x2c84('0x53')});}_0x7b7164[_0x2c84('0x50')]=_0x5edeb0;_0x1a283f();})[_0x2c84('0x37')](function(_0x226a09){_0x1a283f(_0x226a09);});}else if(_0x614012){_0x1a283f();}else{return _0x40d3c4['status'](0x194)['json']({'message':_0x2c84('0x54')});}});};exports[_0x2c84('0x55')]=function canUpdate(){return compose()[_0x2c84('0x2e')](function(_0x49e913,_0x5b7040,_0x3303bc){return licenseUtil[_0x2c84('0x56')]()[_0x2c84('0x3c')](function(_0x143738){if(_0x143738[_0x2c84('0x57')]){_0x3303bc();}else{return _0x5b7040[_0x2c84('0x32')](0x193)['json']({'message':'Forbidden'});}})['catch'](function(_0x3f97e3){_0x3303bc(_0x3f97e3);});});};exports[_0x2c84('0x58')]=function(_0x2b564b,_0x36a7d,_0x496794){_0x2b564b[_0x2c84('0x58')]=!![];return _0x496794();};exports['signToken']=function signToken(_0x3c8196){return signJwt(_0x3c8196);};exports[_0x2c84('0x59')]=function(_0x27c44f,_0x5158b3){if(!_0x27c44f['user']){return _0x5158b3[_0x2c84('0x32')](0x194)[_0x2c84('0x35')]({'message':_0x2c84('0x5a')});}var _0x1b0afd={'payload':{'id':_0x27c44f['user']['id'],'role':_0x27c44f[_0x2c84('0x50')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x1b0afd)[_0x2c84('0x3c')](function(_0x328240){_0x5158b3[_0x2c84('0x5b')](_0x2c84('0x5c'),_0x328240);_0x5158b3['redirect'](_0x2c84('0x5d'));})[_0x2c84('0x37')](function(_0x341c5d){return _0x5158b3['status'](0x1f4)['send'](_0x341c5d);});};exports[_0x2c84('0x5e')]=function(_0x4a68e2){if(_[_0x2c84('0x5f')](_0x4a68e2[_0x2c84('0x4a')])||_[_0x2c84('0x5f')](_0x4a68e2['apiKeyIat'])){return null;}else{return createJwt(_0x4a68e2);}};exports['generateApiKey']=function(_0x243ef9){_0x243ef9[_0x2c84('0x4a')]=generateNonce();_0x243ef9[_0x2c84('0x60')]=generateIssuedAt();return createJwt(_0x243ef9);};exports[_0x2c84('0x61')]=function(_0x5d9582,_0x3309d2){var _0x35ba27=_0x5d9582['query'][_0x2c84('0x42')];if(_0x35ba27){var _0x443df7={'nonce':_0x3309d2['apiKeyNonce'],'iat':_0x3309d2[_0x2c84('0x60')],'audience':hardwareConf[_0x2c84('0x43')](),'issuer':hardwareConf[_0x2c84('0x43')]()};return verifyJwt(_0x35ba27,_0x443df7)[_0x2c84('0x3c')](function(){return generateApiKey(_0x3309d2);});}else{throw{'message':_0x2c84('0x62')};}};exports[_0x2c84('0x63')]=function(_0x4aae8e){var _0x17441b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x17441b[_0x2c84('0x64')](_0x4aae8e))throw new db[(_0x2c84('0x65'))][(_0x2c84('0x66'))](_0x2c84('0x67'));return;};exports[_0x2c84('0x68')]=function(_0x10e890,_0x1a0cbc,_0x3ef7e5){var _0x13ac1a=encryptor[_0x2c84('0x69')](_0x1a0cbc)[_0x2c84('0x6a')](',');for(var _0x174c79=0x0;_0x174c79<_0x3ef7e5;_0x174c79++){if(!_0x13ac1a[_0x174c79])break;if(_0x10e890[_0x2c84('0x6b')]()===_0x13ac1a[_0x174c79]['toLowerCase']()){var _0xf00ca3=util[_0x2c84('0x6c')](_0x2c84('0x6d'),_0x3ef7e5);if(_0x3ef7e5===0x1){_0xf00ca3='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0x2c84('0x65'))][(_0x2c84('0x66'))](_0xf00ca3);}}return;};exports[_0x2c84('0x6e')]=function(_0x2db161,_0x5ed4cd){var _0x3233b4=_0x5ed4cd?encryptor[_0x2c84('0x69')](_0x5ed4cd)[_0x2c84('0x6a')](','):[];if(_0x3233b4[_0x2c84('0x6f')]===0x5){_0x3233b4[_0x2c84('0x70')](-0x1,0x1);}_0x3233b4[_0x2c84('0x71')](_0x2db161);return encryptor[_0x2c84('0x72')](_0x3233b4['join'](','));};function signJwt(_0x49cd71){var _0x4aacc8=BPromise[_0x2c84('0x73')](jwt[_0x2c84('0x74')],{'context':jwt});var _0x244896=_0x49cd71['secret']||config[_0x2c84('0xb')][_0x2c84('0xc')];return new BPromise(function(_0x5adf53,_0x191dfb){_0x4aacc8(_0x49cd71[_0x2c84('0x75')],_0x244896,_0x49cd71['options'])['then'](function(_0x45bd66){_0x5adf53(_0x45bd66);})[_0x2c84('0x37')](function(_0x244ce0){_0x191dfb(_0x244ce0);});});}function verifyJwt(_0x375e57,_0xe51b84,_0x5e1ff3){var _0x466db9=BPromise[_0x2c84('0x73')](jwt[_0x2c84('0x76')],{'context':jwt});var _0x39ee2e=_0x5e1ff3||config[_0x2c84('0xb')][_0x2c84('0xc')];return new BPromise(function(_0x3ac45d,_0x5dd91d){_0x466db9(_0x375e57,_0x39ee2e,_0xe51b84)[_0x2c84('0x3c')](function(_0x317f99){_0x3ac45d(_0x317f99);})[_0x2c84('0x37')](function(_0x3d901b){_0x5dd91d(_0x3d901b);});});}function generateNonce(){return crypto[_0x2c84('0x77')](0x10)['toString'](_0x2c84('0x78'));}function generateIssuedAt(){return Math[_0x2c84('0x79')](Date[_0x2c84('0x7a')]()/0x3e8)[_0x2c84('0x7b')]();}function createJwt(_0x1b0431){var _0x2346b9={'payload':{'iat':_0x1b0431[_0x2c84('0x60')],'nonce':_0x1b0431[_0x2c84('0x4a')]},'options':{'algorithm':_0x2c84('0x7c'),'subject':_0x1b0431['id'][_0x2c84('0x7b')](),'issuer':hardwareConf[_0x2c84('0x43')](),'audience':hardwareConf[_0x2c84('0x43')]()}};return signJwt(_0x2346b9)['then'](function(_0x10a813){return{'iat':_0x1b0431[_0x2c84('0x60')],'nonce':_0x1b0431['apiKeyNonce'],'token':_0x10a813};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 06e67e9..7b45646 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 _0xc882=['createDecipher','data','unlink','encryptString','secret','createCipher','base64','decryptString','lodash','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','error','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','update','binary','write','end','final','close','decryptFile'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc882,0x1c8));var _0x2c88=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xc882[_0x13d07a];return _0x5ee0ee;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require('bluebird');var _=require(_0x2c88('0x0'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0x2c88('0x1'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x2c88('0x2')][_0x2c88('0x3')],'algorithm':_0x2c88('0x4')};const fileOptions={'algorithm':_0x2c88('0x5')};if(config[_0x2c88('0x6')]&&config[_0x2c88('0x6')][_0x2c88('0x7')]){var isSupported=isAlgorithmSupported(config[_0x2c88('0x6')][_0x2c88('0x7')]);if(isSupported){fileOptions[_0x2c88('0x7')]=config['encrypt']['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger[_0x2c88('0x8')](config[_0x2c88('0x6')][_0x2c88('0x7')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x28560b){return AES_SUPPORTED_RX[_0x2c88('0x9')](_0x28560b);}function getSupportedCiphers(){return crypto[_0x2c88('0xa')]()[_0x2c88('0xb')](isASupportedCipher);}function isAlgorithmSupported(_0x5c2509){return getSupportedCiphers()[_0x2c88('0xc')](_0x5c2509)>-0x1;}function combineOptions(_0x39e5c2){var _0x384212={};for(var _0x29df7e in fileOptions){if(fileOptions[_0x2c88('0xd')](_0x29df7e)){_0x384212[_0x29df7e]=fileOptions[_0x29df7e];}}if(_0x39e5c2){for(var _0x3d15c5 in _0x39e5c2){if(_0x39e5c2[_0x2c88('0xd')](_0x3d15c5)){_0x384212[_0x3d15c5]=_0x39e5c2[_0x3d15c5];}}}return _0x384212;}exports[_0x2c88('0xe')]=function(_0x361392,_0x25c5ea,_0x4a69c3,_0x1d140a){return new BPromise(function(_0x12ec1e,_0x149f80){_0x1d140a=combineOptions(_0x1d140a);var _0x4095d6=new Buffer(_0x4a69c3);var _0x3ab213=fs[_0x2c88('0xf')](_0x361392);var _0x2210d3=fs[_0x2c88('0x10')](_0x25c5ea);var _0x51d235=crypto['createCipher'](_0x1d140a['algorithm'],_0x4095d6);_0x3ab213['on']('data',function(_0x8fd543){var _0x26447d=new Buffer(_0x51d235[_0x2c88('0x11')](_0x8fd543),_0x2c88('0x12'));_0x2210d3[_0x2c88('0x13')](_0x26447d);});_0x3ab213['on'](_0x2c88('0x14'),function(){try{var _0x25fa2e=new Buffer(_0x51d235[_0x2c88('0x15')]('binary'),_0x2c88('0x12'));_0x2210d3[_0x2c88('0x13')](_0x25fa2e);_0x2210d3['end']();_0x2210d3['on'](_0x2c88('0x16'),function(){return _0x12ec1e(_0x25c5ea);});}catch(_0x46a01b){fs['unlink'](_0x25c5ea);return _0x149f80(_0x46a01b);}});});};exports[_0x2c88('0x17')]=function(_0x4caa69,_0x3af919,_0x2b32c1,_0x35e51b){return new BPromise(function(_0x23f8d1,_0x42fc95){_0x35e51b=combineOptions(_0x35e51b);var _0x42eee9=new Buffer(_0x2b32c1);var _0x5eb1da=fs[_0x2c88('0xf')](_0x4caa69);var _0xe4bb65=fs[_0x2c88('0x10')](_0x3af919);var _0x2d0a39=crypto[_0x2c88('0x18')](_0x35e51b[_0x2c88('0x7')],_0x42eee9);_0x5eb1da['on'](_0x2c88('0x19'),function(_0x58f09d){var _0x1b4fbd=new Buffer(_0x2d0a39[_0x2c88('0x11')](_0x58f09d),'binary');_0xe4bb65[_0x2c88('0x13')](_0x1b4fbd);});_0x5eb1da['on']('end',function(){try{var _0x26c53f=new Buffer(_0x2d0a39['final'](_0x2c88('0x12')),_0x2c88('0x12'));_0xe4bb65[_0x2c88('0x13')](_0x26c53f);_0xe4bb65['end']();_0xe4bb65['on'](_0x2c88('0x16'),function(){return _0x23f8d1(_0x3af919);});}catch(_0x66726d){fs[_0x2c88('0x1a')](_0x3af919);return _0x42fc95(_0x66726d);}});});};exports[_0x2c88('0x1b')]=function(_0x1db48b,_0xc39c15,_0x481bd5){var _0xb3d301=_0x481bd5||stringOptions[_0x2c88('0x7')];var _0x416920=_0xc39c15||stringOptions[_0x2c88('0x1c')];var _0x1a4722=crypto[_0x2c88('0x1d')](_0xb3d301,_0x416920);var _0x546182=_0x1a4722[_0x2c88('0x11')](_0x1db48b,'utf8',_0x2c88('0x1e'));_0x546182+=_0x1a4722[_0x2c88('0x15')](_0x2c88('0x1e'));return _0x546182;};exports[_0x2c88('0x1f')]=function(_0x46204e,_0xe0c5b0,_0x4897d2){var _0x46b818=_0x4897d2||stringOptions[_0x2c88('0x7')];var _0x207f7a=_0xe0c5b0||stringOptions[_0x2c88('0x1c')];var _0x343353=crypto[_0x2c88('0x18')](_0x46b818,_0x207f7a);var _0x5746a3=_0x343353[_0x2c88('0x11')](_0x46204e,_0x2c88('0x1e'),'utf8');_0x5746a3+=_0x343353[_0x2c88('0x15')]('utf8');return _0x5746a3;}; \ No newline at end of file +var _0xb103=['filter','indexOf','hasOwnProperty','encryptFile','createWriteStream','createCipher','update','write','end','final','binary','close','decryptFile','createReadStream','createDecipher','data','unlink','encryptString','secret','utf8','base64','decryptString','crypto','bluebird','lodash','../../config/environment','../../config/logger','secrets','session','aes-256-ctr','encrypt','algorithm','join','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','getCiphers'];(function(_0x5637ed,_0x5b50da){var _0x2b8760=function(_0x3d503c){while(--_0x3d503c){_0x5637ed['push'](_0x5637ed['shift']());}};_0x2b8760(++_0x5b50da);}(_0xb103,0x197));var _0x3b10=function(_0x58afd5,_0x534a48){_0x58afd5=_0x58afd5-0x0;var _0x3e503b=_0xb103[_0x58afd5];return _0x3e503b;};'use strict';var crypto=require(_0x3b10('0x0'));var fs=require('fs');var BPromise=require(_0x3b10('0x1'));var _=require(_0x3b10('0x2'));var config=require(_0x3b10('0x3'));var logger=require(_0x3b10('0x4'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x3b10('0x5')][_0x3b10('0x6')],'algorithm':_0x3b10('0x7')};const fileOptions={'algorithm':'aes192'};if(config[_0x3b10('0x8')]&&config['encrypt'][_0x3b10('0x9')]){var isSupported=isAlgorithmSupported(config[_0x3b10('0x8')]['algorithm']);if(isSupported){fileOptions[_0x3b10('0x9')]=config[_0x3b10('0x8')][_0x3b10('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x3b10('0xa')](',\x20');logger['error'](config[_0x3b10('0x8')][_0x3b10('0x9')],_0x3b10('0xb'),supportedAlgorithms);}}function isASupportedCipher(_0x1484e2){return AES_SUPPORTED_RX['test'](_0x1484e2);}function getSupportedCiphers(){return crypto[_0x3b10('0xc')]()[_0x3b10('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x138b50){return getSupportedCiphers()[_0x3b10('0xe')](_0x138b50)>-0x1;}function combineOptions(_0x52eca4){var _0x26fa27={};for(var _0x67a0d3 in fileOptions){if(fileOptions[_0x3b10('0xf')](_0x67a0d3)){_0x26fa27[_0x67a0d3]=fileOptions[_0x67a0d3];}}if(_0x52eca4){for(var _0x253255 in _0x52eca4){if(_0x52eca4[_0x3b10('0xf')](_0x253255)){_0x26fa27[_0x253255]=_0x52eca4[_0x253255];}}}return _0x26fa27;}exports[_0x3b10('0x10')]=function(_0xdce852,_0x320bab,_0x32cbf7,_0x27175d){return new BPromise(function(_0x33d3f2,_0x128dea){_0x27175d=combineOptions(_0x27175d);var _0x5a5bd7=new Buffer(_0x32cbf7);var _0x4151c5=fs['createReadStream'](_0xdce852);var _0x5ca9b7=fs[_0x3b10('0x11')](_0x320bab);var _0xa83515=crypto[_0x3b10('0x12')](_0x27175d['algorithm'],_0x5a5bd7);_0x4151c5['on']('data',function(_0x1924c4){var _0x3a6e33=new Buffer(_0xa83515[_0x3b10('0x13')](_0x1924c4),'binary');_0x5ca9b7[_0x3b10('0x14')](_0x3a6e33);});_0x4151c5['on'](_0x3b10('0x15'),function(){try{var _0x2cc718=new Buffer(_0xa83515[_0x3b10('0x16')](_0x3b10('0x17')),_0x3b10('0x17'));_0x5ca9b7['write'](_0x2cc718);_0x5ca9b7['end']();_0x5ca9b7['on'](_0x3b10('0x18'),function(){return _0x33d3f2(_0x320bab);});}catch(_0x16f124){fs['unlink'](_0x320bab);return _0x128dea(_0x16f124);}});});};exports[_0x3b10('0x19')]=function(_0x17cbcc,_0x2f8ed4,_0x563afb,_0x1be9e7){return new BPromise(function(_0x3308aa,_0x3d4694){_0x1be9e7=combineOptions(_0x1be9e7);var _0x36ba2c=new Buffer(_0x563afb);var _0x5732e6=fs[_0x3b10('0x1a')](_0x17cbcc);var _0x4d76f5=fs[_0x3b10('0x11')](_0x2f8ed4);var _0x2d83b4=crypto[_0x3b10('0x1b')](_0x1be9e7[_0x3b10('0x9')],_0x36ba2c);_0x5732e6['on'](_0x3b10('0x1c'),function(_0x4ce0b3){var _0x2b507a=new Buffer(_0x2d83b4[_0x3b10('0x13')](_0x4ce0b3),_0x3b10('0x17'));_0x4d76f5[_0x3b10('0x14')](_0x2b507a);});_0x5732e6['on'](_0x3b10('0x15'),function(){try{var _0x123fa0=new Buffer(_0x2d83b4[_0x3b10('0x16')]('binary'),'binary');_0x4d76f5[_0x3b10('0x14')](_0x123fa0);_0x4d76f5[_0x3b10('0x15')]();_0x4d76f5['on'](_0x3b10('0x18'),function(){return _0x3308aa(_0x2f8ed4);});}catch(_0x3a2dec){fs[_0x3b10('0x1d')](_0x2f8ed4);return _0x3d4694(_0x3a2dec);}});});};exports[_0x3b10('0x1e')]=function(_0xef4643,_0x1f3e3d,_0x1986d5){var _0x4b1487=_0x1986d5||stringOptions['algorithm'];var _0x26ac12=_0x1f3e3d||stringOptions[_0x3b10('0x1f')];var _0x389975=crypto[_0x3b10('0x12')](_0x4b1487,_0x26ac12);var _0x5fd8b8=_0x389975[_0x3b10('0x13')](_0xef4643,_0x3b10('0x20'),'base64');_0x5fd8b8+=_0x389975[_0x3b10('0x16')](_0x3b10('0x21'));return _0x5fd8b8;};exports[_0x3b10('0x22')]=function(_0x182cc3,_0x342632,_0x396b71){var _0x3be916=_0x396b71||stringOptions[_0x3b10('0x9')];var _0x3e46e4=_0x342632||stringOptions['secret'];var _0xff9e0e=crypto[_0x3b10('0x1b')](_0x3be916,_0x3e46e4);var _0xbb747=_0xff9e0e[_0x3b10('0x13')](_0x182cc3,_0x3b10('0x21'),_0x3b10('0x20'));_0xbb747+=_0xff9e0e[_0x3b10('0x16')](_0x3b10('0x20'));return _0xbb747;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 37bb8b7..ac61dd2 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 _0xdb94=['rimraf','../../mysqldb','../../config/logger','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','find','split','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','.csv','length','existsSync','join','each','then','%s%d.%s','csv','%s.%s','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','util','path','lodash','to-csv','bluebird'];(function(_0x397127,_0x31429d){var _0x1d5516=function(_0x5c557f){while(--_0x5c557f){_0x397127['push'](_0x397127['shift']());}};_0x1d5516(++_0x31429d);}(_0xdb94,0xab));var _0x4db9=function(_0x31f53b,_0x21c467){_0x31f53b=_0x31f53b-0x0;var _0x4d7b20=_0xdb94[_0x31f53b];return _0x4d7b20;};'use strict';var util=require(_0x4db9('0x0'));var path=require(_0x4db9('0x1'));var _=require(_0x4db9('0x2'));var csv=require(_0x4db9('0x3'));var fs=require('fs');var BPromise=require(_0x4db9('0x4'));var zipdir=require('zip-dir');var rimraf=require(_0x4db9('0x5'));var db=require(_0x4db9('0x6'))['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0x4db9('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x4db9('0x8')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x196ede,_0x50c27a){var _0x14deb9={'status':_0x196ede};var _0x26248b={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x50c27a){_0x14deb9[_0x4db9('0x9')]=_0x50c27a;}return db[_0x4db9('0xa')][_0x4db9('0xb')](_0x14deb9,_0x26248b);}function main(){var _0x242116=0x1388;var _0x45c0e4;logger[_0x4db9('0xc')](util[_0x4db9('0xd')](_0x4db9('0xe'),EXTRACTED_REPORT_ID,_0x4db9('0xf')));return db['Setting'][_0x4db9('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x4db9('0x11'),'splitSizeCsv']})['then'](function(_0x31222b){if(_0x31222b){_0x45c0e4=_0x31222b;_0x242116=_0x45c0e4['splitSizeCsv']||0x1388;}})['then'](function(){return dbH[_0x4db9('0x12')][_0x4db9('0x13')](util['format'](_0x4db9('0x14'),QUERY),{'type':dbH[_0x4db9('0x12')][_0x4db9('0x15')][_0x4db9('0x16')]});})['then'](function(_0x5e04ab){if(!_0x5e04ab[0x0][_0x4db9('0x17')]){return analyticExtractedReport(_0x4db9('0x18'));}var _0x4a037f=[];var _0xadc104=0x0;var _0x4976=!![];if(_0x5e04ab&&_0x5e04ab['length']){var _0x5a85c4=_0x5e04ab[0x0][_0x4db9('0x17')]%(_0xadc104+_0x242116);if(_0x45c0e4[_0x4db9('0x11')]){for(;_0x4976;_0xadc104+=_0x242116,_0x5a85c4=_0x5e04ab[0x0][_0x4db9('0x17')]%(_0xadc104+_0x242116)){if(_0x5a85c4==0x0||_0x5a85c4==_0x5e04ab[0x0][_0x4db9('0x17')]){_0x4976=![];}_0x4a037f[_0x4db9('0x19')](dbH['sequelize'][_0x4db9('0x13')](util[_0x4db9('0xd')](_0x4db9('0x1a'),QUERY,_0x242116,_0xadc104),{'type':dbH['sequelize'][_0x4db9('0x15')][_0x4db9('0x16')]}));}}else{_0x4a037f[_0x4db9('0x19')](dbH['sequelize'][_0x4db9('0x13')](QUERY,{'type':dbH[_0x4db9('0x12')][_0x4db9('0x15')][_0x4db9('0x16')]}));}}var _0xf4f3fe=path[_0x4db9('0x1b')](PATH);var _0x3585d5=path['basename'](PATH,_0x4db9('0x1c'));var _0x3252d0=_0x45c0e4[_0x4db9('0x11')]&&_0x4a037f[_0x4db9('0x1d')]>0x1;var _0x4aaa84=[];if(!fs[_0x4db9('0x1e')](path[_0x4db9('0x1f')](_0xf4f3fe,_0x3585d5))&&_0x3252d0){fs['mkdirSync'](path[_0x4db9('0x1f')](_0xf4f3fe,_0x3585d5));}return BPromise[_0x4db9('0x20')](_0x4a037f,function(_0x2987c6){_0x4aaa84['push'](_0x2987c6);})[_0x4db9('0x21')](function(){for(var _0xd250c5=0x0;_0xd250c5<_0x4aaa84[_0x4db9('0x1d')];_0xd250c5+=0x1){var _0x2d330e;var _0x3f9f7e=_0x4aaa84[_0xd250c5];if(_0x3252d0){_0x2d330e=path[_0x4db9('0x1f')](_0xf4f3fe,_0x3585d5,util[_0x4db9('0xd')](_0x4db9('0x22'),_0x3585d5,_0xd250c5,_0x4db9('0x23')));}else{_0x2d330e=path[_0x4db9('0x1f')](_0xf4f3fe,util[_0x4db9('0xd')](_0x4db9('0x24'),_0x3585d5,_0x4db9('0x23')));}fs[_0x4db9('0x25')](_0x2d330e,csv(_0x3f9f7e));}})['then'](function(){if(_0x3252d0){zipdir(path['join'](_0xf4f3fe,_0x3585d5),{'saveTo':path[_0x4db9('0x1f')](_0xf4f3fe,util[_0x4db9('0xd')](_0x4db9('0x24'),_0x3585d5,_0x4db9('0x26')))},function(_0x2af884,_0x459131){});rimraf(path['join'](_0xf4f3fe,_0x3585d5),function(){});}})[_0x4db9('0x21')](function(){logger['info'](util[_0x4db9('0xd')](_0x4db9('0x27'),EXTRACTED_REPORT_ID,_0x4db9('0xf')));return analyticExtractedReport(_0x4db9('0x28'),_0x3252d0?util[_0x4db9('0xd')]('%s.%s',_0x3585d5,_0x3252d0?'zip':_0x4db9('0x23')):null);});})['catch'](function(_0x337d74){logger[_0x4db9('0xc')](util['format'](_0x4db9('0x29'),EXTRACTED_REPORT_ID,_0x4db9('0xf')),util[_0x4db9('0x2a')](_0x337d74,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x4db9('0x2b')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0x9354=['each','%s%d.%s','csv','writeFileSync','%s.%s','zip','Completed','CSV','inspect','Failed','finally','exit','path','lodash','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','find','then','splitSizeCsv','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','split','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','join','mkdirSync'];(function(_0x30ab39,_0x9cdee6){var _0x469940=function(_0x437fad){while(--_0x437fad){_0x30ab39['push'](_0x30ab39['shift']());}};_0x469940(++_0x9cdee6);}(_0x9354,0x96));var _0x4935=function(_0x3e2480,_0x2eed70){_0x3e2480=_0x3e2480-0x0;var _0x652c0=_0x9354[_0x3e2480];return _0x652c0;};'use strict';var util=require('util');var path=require(_0x4935('0x0'));var _=require(_0x4935('0x1'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0x4935('0x2'));var zipdir=require(_0x4935('0x3'));var rimraf=require(_0x4935('0x4'));var db=require(_0x4935('0x5'))['db'];var dbH=require('../../mysqldb')[_0x4935('0x6')];var logger=require(_0x4935('0x7'))(_0x4935('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x4935('0x9')][0x2]);var QUERY=process[_0x4935('0x9')][0x3];var PATH=process[_0x4935('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x118d36,_0x2d735e){var _0x10793e={'status':_0x118d36};var _0x4c9902={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2d735e){_0x10793e[_0x4935('0xa')]=_0x2d735e;}return db['AnalyticExtractedReport'][_0x4935('0xb')](_0x10793e,_0x4c9902);}function main(){var _0x38de96=0x1388;var _0xd5b117;logger[_0x4935('0xc')](util[_0x4935('0xd')](_0x4935('0xe'),EXTRACTED_REPORT_ID,'CSV'));return db['Setting'][_0x4935('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizeCsv']})[_0x4935('0x10')](function(_0x32916f){if(_0x32916f){_0xd5b117=_0x32916f;_0x38de96=_0xd5b117[_0x4935('0x11')]||0x1388;}})[_0x4935('0x10')](function(){return dbH[_0x4935('0x12')][_0x4935('0x13')](util[_0x4935('0xd')](_0x4935('0x14'),QUERY),{'type':dbH[_0x4935('0x12')][_0x4935('0x15')][_0x4935('0x16')]});})[_0x4935('0x10')](function(_0xa41961){if(!_0xa41961[0x0][_0x4935('0x17')]){return analyticExtractedReport(_0x4935('0x18'));}var _0x395a43=[];var _0x57d7ed=0x0;var _0x3079e7=!![];if(_0xa41961&&_0xa41961[_0x4935('0x19')]){var _0x165ed3=_0xa41961[0x0][_0x4935('0x17')]%(_0x57d7ed+_0x38de96);if(_0xd5b117[_0x4935('0x1a')]){for(;_0x3079e7;_0x57d7ed+=_0x38de96,_0x165ed3=_0xa41961[0x0][_0x4935('0x17')]%(_0x57d7ed+_0x38de96)){if(_0x165ed3==0x0||_0x165ed3==_0xa41961[0x0]['num']){_0x3079e7=![];}_0x395a43[_0x4935('0x1b')](dbH[_0x4935('0x12')]['query'](util[_0x4935('0xd')](_0x4935('0x1c'),QUERY,_0x38de96,_0x57d7ed),{'type':dbH[_0x4935('0x12')]['QueryTypes']['SELECT']}));}}else{_0x395a43[_0x4935('0x1b')](dbH[_0x4935('0x12')][_0x4935('0x13')](QUERY,{'type':dbH[_0x4935('0x12')][_0x4935('0x15')][_0x4935('0x16')]}));}}var _0x7a50ab=path[_0x4935('0x1d')](PATH);var _0x58b2f3=path[_0x4935('0x1e')](PATH,_0x4935('0x1f'));var _0x1db8d2=_0xd5b117[_0x4935('0x1a')]&&_0x395a43[_0x4935('0x19')]>0x1;var _0x53530f=[];if(!fs['existsSync'](path[_0x4935('0x20')](_0x7a50ab,_0x58b2f3))&&_0x1db8d2){fs[_0x4935('0x21')](path[_0x4935('0x20')](_0x7a50ab,_0x58b2f3));}return BPromise[_0x4935('0x22')](_0x395a43,function(_0x344e51){_0x53530f[_0x4935('0x1b')](_0x344e51);})[_0x4935('0x10')](function(){for(var _0x1d53a7=0x0;_0x1d53a7<_0x53530f[_0x4935('0x19')];_0x1d53a7+=0x1){var _0xf4abb2;var _0x1d08b5=_0x53530f[_0x1d53a7];if(_0x1db8d2){_0xf4abb2=path[_0x4935('0x20')](_0x7a50ab,_0x58b2f3,util[_0x4935('0xd')](_0x4935('0x23'),_0x58b2f3,_0x1d53a7,_0x4935('0x24')));}else{_0xf4abb2=path['join'](_0x7a50ab,util['format']('%s.%s',_0x58b2f3,_0x4935('0x24')));}fs[_0x4935('0x25')](_0xf4abb2,csv(_0x1d08b5));}})['then'](function(){if(_0x1db8d2){zipdir(path[_0x4935('0x20')](_0x7a50ab,_0x58b2f3),{'saveTo':path[_0x4935('0x20')](_0x7a50ab,util[_0x4935('0xd')](_0x4935('0x26'),_0x58b2f3,_0x4935('0x27')))},function(_0x24262e,_0x28afc2){});rimraf(path[_0x4935('0x20')](_0x7a50ab,_0x58b2f3),function(){});}})['then'](function(){logger[_0x4935('0xc')](util[_0x4935('0xd')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0x4935('0x28'),_0x1db8d2?util['format'](_0x4935('0x26'),_0x58b2f3,_0x1db8d2?_0x4935('0x27'):_0x4935('0x24')):null);});})['catch'](function(_0x4bb012){logger[_0x4935('0xc')](util[_0x4935('0xd')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x4935('0x29')),util[_0x4935('0x2a')](_0x4bb012,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x4935('0x2b'));})[_0x4935('0x2c')](function(){process[_0x4935('0x2d')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 3704b68..703d474 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 _0x6dbd=['length','before','margin','push','landscape','\x20/\x20','Arial','right','Empty','dirname','basename','.pdf','join','find','splitSizePdf','then','num','split','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','existsSync','all','flatten','createPdfKitDocument','%s.%s','info','CSV','zip','pdf','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','YYYY-MM-DD','center','header','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','footer','createWriteStream','finish','end','createPdfFromHTML','lodash','util','path','html-to-pdfmake','pdfmake/src/printer','rimraf','jsdom','window','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','AnalyticExtractedReport','update','map','tableHeader','pick','toString','value','fill','body','concat','chunk','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0x6dbd,0x186));var _0xd6db=function(_0x271b32,_0x2df4b9){_0x271b32=_0x271b32-0x0;var _0x2b4398=_0x6dbd[_0x271b32];return _0x2b4398;};'use strict';var _=require(_0xd6db('0x0'));var fs=require('fs');var util=require(_0xd6db('0x1'));var path=require(_0xd6db('0x2'));var moment=require('moment');var htmlToPdfmake=require(_0xd6db('0x3'));var PdfPrinter=require(_0xd6db('0x4'));var zipdir=require('zip-dir');var rimraf=require(_0xd6db('0x5'));var JSDOM=require(_0xd6db('0x6'))['JSDOM'];var window=new JSDOM('')[_0xd6db('0x7')];var db=require(_0xd6db('0x8'))['db'];var dbH=require('../../mysqldb')[_0xd6db('0x9')];var logger=require(_0xd6db('0xa'))(_0xd6db('0xb'));var EXTRACTED_REPORT_ID=Number(process[_0xd6db('0xc')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xd6db('0xc')][0x4];var NAME=process[_0xd6db('0xc')][0x5];var FORMAT=_0xd6db('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x289acf,_0x29f22f){var _0x341891={'status':_0x289acf};var _0x57cc3c={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x29f22f){_0x341891['savename']=_0x29f22f;}return db[_0xd6db('0xe')][_0xd6db('0xf')](_0x341891,_0x57cc3c);}function getHeaders(_0x169287){return _[_0xd6db('0x10')](_0x169287,function(_0x29d5dd){return{'text':_0x29d5dd,'style':_0xd6db('0x11')};});}function getRows(_0x182647,_0x14ac1c){return _[_0xd6db('0x10')](_0x14ac1c,function(_0x545425){return _(_0x545425)[_0xd6db('0x12')](_0x182647)[_0xd6db('0x10')](function(_0x2721c0){return _0x2721c0?_[_0xd6db('0x13')](_0x2721c0):'';})[_0xd6db('0x14')]();});}function createTable(_0x12cb7f,_0x39fe8d){var _0x410aab={'widths':_[_0xd6db('0x15')](Array(_0x12cb7f['length']),0x91),'heights':function(_0x768c4){return _0x768c4===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x599996=getHeaders(_0x12cb7f);_0x410aab[_0xd6db('0x16')]['push'](_0x599996);var _0x22adb3=getRows(_0x12cb7f,_0x39fe8d);_0x410aab[_0xd6db('0x16')]=_0x410aab['body'][_0xd6db('0x17')](_0x22adb3);return _0x410aab;}function createTables(_0x25453f){var _0x1ead96=[];var _0x1579d5=_[_0xd6db('0x18')](Object['keys'](_0x25453f[0x0]),0x5);_0x1579d5['forEach'](function(_0xa3fb15){_0x1ead96['push'](createTable(_0xa3fb15,_0x25453f));});return _0x1ead96;}function getPDFDocDefinition(_0x40bce1){var _0x39eaab=util[_0xd6db('0x19')](_0xd6db('0x1a'),NAME,EXTRACTED_REPORT[_0xd6db('0x1b')],moment(EXTRACTED_REPORT[_0xd6db('0x1c')])[_0xd6db('0x19')](FORMAT),moment(EXTRACTED_REPORT[_0xd6db('0x1d')])[_0xd6db('0x19')](FORMAT));var _0x33e31e=[];for(var _0x18cc49=0x0;_0x18cc49<_0x40bce1[_0xd6db('0x1e')];_0x18cc49++){var _0x588132=[];if(_0x18cc49===0x0){_0x588132['push']({'text':_0x39eaab,'style':'header'});}var _0x1c82a0={'table':_0x40bce1[_0x18cc49]};if(_0x18cc49>0x0){_0x1c82a0['pageBreak']=_0xd6db('0x1f');_0x1c82a0[_0xd6db('0x20')]=[0x0,0x46,0x0,0x0];}_0x588132[_0xd6db('0x21')](_0x1c82a0);_0x33e31e[_0xd6db('0x21')](_0x588132);}return{'pageSize':'A4','pageOrientation':_0xd6db('0x22'),'content':_0x33e31e,'footer':function(_0x2bed0f,_0x2db377){return{'text':_0x2bed0f['toString']()+_0xd6db('0x23')+_0x2db377,'style':'footer'};},'defaultStyle':{'font':_0xd6db('0x24')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0xd6db('0x25'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x18a88f){var _0x1c6198=0x1388;var _0xfbb1a9;if(!_0x18a88f[0x0]['num']){return analyticExtractedReport(_0xd6db('0x26'));}var _0x4e2ac0=[];var _0x5e5c86=0x0;var _0x1b5844=!![];var _0x3796c8=path[_0xd6db('0x27')](PATH);var _0xf2ba0b=path[_0xd6db('0x28')](PATH,_0xd6db('0x29'));var _0x2f70fe=path[_0xd6db('0x2a')](_0x3796c8,util[_0xd6db('0x19')]('%s.%s',_0xf2ba0b,'pdf'));var _0x69530f=![];return db['Setting'][_0xd6db('0x2b')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xd6db('0x2c')]})[_0xd6db('0x2d')](function(_0x54467e){if(_0x54467e){_0xfbb1a9=_0x54467e;_0x1c6198=_0xfbb1a9['splitSizePdf']||0x3e8;}})[_0xd6db('0x2d')](function(){if(_0x18a88f&&_0x18a88f['length']){var _0x52d2f3=_0x18a88f[0x0][_0xd6db('0x2e')]%(_0x5e5c86+_0x1c6198);if(_0xfbb1a9[_0xd6db('0x2f')]){for(;_0x1b5844;_0x5e5c86+=_0x1c6198,_0x52d2f3=_0x18a88f[0x0][_0xd6db('0x2e')]%(_0x5e5c86+_0x1c6198)){if(_0x52d2f3==0x0||_0x52d2f3==_0x18a88f[0x0][_0xd6db('0x2e')]){_0x1b5844=![];}_0x4e2ac0['push'](dbH[_0xd6db('0x30')][_0xd6db('0x31')](util[_0xd6db('0x19')](_0xd6db('0x32'),QUERY,_0x1c6198,_0x5e5c86),{'type':dbH['sequelize'][_0xd6db('0x33')][_0xd6db('0x34')]}));}}else{_0x4e2ac0['push'](dbH['sequelize'][_0xd6db('0x31')](QUERY,{'type':dbH[_0xd6db('0x30')][_0xd6db('0x33')][_0xd6db('0x34')]}));}}_0x69530f=_0xfbb1a9['split']&&_0x4e2ac0[_0xd6db('0x1e')]>0x1;if(!fs[_0xd6db('0x35')](path['join'](_0x3796c8,_0xf2ba0b))&&_0x69530f){fs['mkdirSync'](path[_0xd6db('0x2a')](_0x3796c8,_0xf2ba0b));}return Promise[_0xd6db('0x36')](_0x4e2ac0);})[_0xd6db('0x2d')](function(_0x1d27b9){return createTables(_[_0xd6db('0x37')](_0x1d27b9));})[_0xd6db('0x2d')](function(_0x23626c){var _0x53de9e=getPDFDocDefinition(_0x23626c);var _0x4c54a8=getPDFPrinter();var _0x1de995=_0x4c54a8[_0xd6db('0x38')](_0x53de9e);if(_0x69530f)_0x2f70fe=path[_0xd6db('0x2a')](_0x3796c8,_0xf2ba0b,util[_0xd6db('0x19')]('%s%d.%s',_0xf2ba0b,index,'pdf'));return writePDFDocument(_0x1de995,_0x2f70fe);})[_0xd6db('0x2d')](function(){if(!_0x69530f)return;zipdir(path[_0xd6db('0x2a')](_0x3796c8,_0xf2ba0b),{'saveTo':path['join'](_0x3796c8,util[_0xd6db('0x19')](_0xd6db('0x39'),_0xf2ba0b,'zip'))},function(_0x3b9114){if(_0x3b9114)throw _0x3b9114;return;});})['then'](function(){if(!_0x69530f)return;rimraf(path['join'](_0x3796c8,_0xf2ba0b),function(){});})[_0xd6db('0x2d')](function(){logger[_0xd6db('0x3a')](util[_0xd6db('0x19')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xd6db('0x3b')));return analyticExtractedReport('Completed',_0x69530f?util[_0xd6db('0x19')](_0xd6db('0x39'),_0xf2ba0b,_0x69530f?_0xd6db('0x3c'):_0xd6db('0x3d')):null);});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xd6db('0x3a')](util[_0xd6db('0x19')](_0xd6db('0x3e'),EXTRACTED_REPORT_ID,_0xd6db('0x3f')));return db[_0xd6db('0xe')][_0xd6db('0x40')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xd6db('0x2d')](function(_0x316368){EXTRACTED_REPORT=_0x316368;return dbH['sequelize'][_0xd6db('0x31')](util['format'](_0xd6db('0x41'),QUERY),{'type':dbH[_0xd6db('0x30')][_0xd6db('0x33')][_0xd6db('0x34')]});})['then'](extractReport)[_0xd6db('0x42')](function(_0x3731f7){logger[_0xd6db('0x3a')](util[_0xd6db('0x19')](_0xd6db('0x43'),EXTRACTED_REPORT_ID,'PDF'),util[_0xd6db('0x44')](_0x3731f7,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xd6db('0x45')](function(){process[_0xd6db('0x46')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x5eff95=new PdfPrinter({'Arial':{'normal':__dirname+_0xd6db('0x47'),'bold':__dirname+_0xd6db('0x48'),'italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0xd6db('0x49')}});return _0x5eff95;}function getPDFDocDefinitionFromHTML(_0x1d4cbb,_0x5745ea){var _0x2a8ef8=util[_0xd6db('0x19')](_0xd6db('0x4a'),_0x5745ea['channel'],_0x5745ea['interactionId']);var _0x587acd=moment()[_0xd6db('0x19')](_0xd6db('0x4b'))['toString']();var _0x464184=htmlToPdfmake(_0x1d4cbb,{'window':window,'tableAutoSize':!![]});return{'content':[_0x464184],'defaultStyle':{'font':_0xd6db('0x24')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xd6db('0x4c'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xd6db('0x4c'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xd6db('0x4c')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0xd6db('0x4d')}];},'footer':function(_0x3f2ea1,_0x249ded){return[{'text':util[_0xd6db('0x19')](_0xd6db('0x4e'),_0x2a8ef8,_0x3f2ea1,_0x249ded,_0x587acd),'style':_0xd6db('0x4f')}];}};}function writePDFDocument(_0x369479,_0xb4b886){return new Promise(function(_0x492051,_0x327551){var _0x5b65a0=_0x369479['pipe'](fs[_0xd6db('0x50')](_0xb4b886));_0x5b65a0['on']('finish',function(){_0x492051(_0xd6db('0x51'));});_0x5b65a0['on']('error',function(_0x23ed91){_0x327551(_0x23ed91);});_0x369479[_0xd6db('0x52')]();});}exports[_0xd6db('0x53')]=function(_0x40aa43,_0x589f6e){var _0x395f75=getPDFPrinter();var _0x2a08d3=getPDFDocDefinitionFromHTML(_0x40aa43,_0x589f6e);var _0x9d3ec9=_0x395f75['createPdfKitDocument'](_0x2a08d3);return writePDFDocument(_0x9d3ec9,_0x589f6e[_0xd6db('0x2')])['catch'](function(_0x20f427){throw _0x20f427;});}; \ No newline at end of file +var _0x1851=['format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','length','header','pageBreak','before','landscape','\x20/\x20','footer','Arial','black','right','num','Empty','dirname','basename','.pdf','%s.%s','pdf','find','then','splitSizePdf','split','sequelize','QueryTypes','query','join','mkdirSync','all','flatten','%s%d.%s','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','/fonts/arial-regular.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','end','path','lodash','moment','rimraf','jsdom','JSDOM','../../mysqldb','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','pick','toString','body','push','concat','chunk','keys','forEach'];(function(_0x12ca5f,_0x223d98){var _0xfc3ae9=function(_0x1928fb){while(--_0x1928fb){_0x12ca5f['push'](_0x12ca5f['shift']());}};_0xfc3ae9(++_0x223d98);}(_0x1851,0x88));var _0x1185=function(_0x26fbf0,_0x24c18c){_0x26fbf0=_0x26fbf0-0x0;var _0x1c3c0a=_0x1851[_0x26fbf0];return _0x1c3c0a;};'use strict';var _=require(_0x1185('0x0'));var fs=require('fs');var util=require('util');var path=require('path');var moment=require(_0x1185('0x1'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require('pdfmake/src/printer');var zipdir=require('zip-dir');var rimraf=require(_0x1185('0x2'));var JSDOM=require(_0x1185('0x3'))[_0x1185('0x4')];var window=new JSDOM('')['window'];var db=require(_0x1185('0x5'))['db'];var dbH=require(_0x1185('0x5'))['dbH'];var logger=require(_0x1185('0x6'))(_0x1185('0x7'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x1185('0x8')][0x3];var PATH=process[_0x1185('0x8')][0x4];var NAME=process[_0x1185('0x8')][0x5];var FORMAT=_0x1185('0x9');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x385fcc,_0x178652){var _0x37606c={'status':_0x385fcc};var _0x53060b={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x178652){_0x37606c[_0x1185('0xa')]=_0x178652;}return db[_0x1185('0xb')][_0x1185('0xc')](_0x37606c,_0x53060b);}function getHeaders(_0x3b8e20){return _[_0x1185('0xd')](_0x3b8e20,function(_0x26f635){return{'text':_0x26f635,'style':'tableHeader'};});}function getRows(_0x2e9840,_0x3ec9be){return _[_0x1185('0xd')](_0x3ec9be,function(_0x206edb){return _(_0x206edb)[_0x1185('0xe')](_0x2e9840)[_0x1185('0xd')](function(_0x141467){return _0x141467?_[_0x1185('0xf')](_0x141467):'';})['value']();});}function createTable(_0x418436,_0x3ad184){var _0x4b126d={'widths':_['fill'](Array(_0x418436['length']),0x91),'heights':function(_0x27432e){return _0x27432e===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x56eace=getHeaders(_0x418436);_0x4b126d[_0x1185('0x10')][_0x1185('0x11')](_0x56eace);var _0x535728=getRows(_0x418436,_0x3ad184);_0x4b126d['body']=_0x4b126d['body'][_0x1185('0x12')](_0x535728);return _0x4b126d;}function createTables(_0x5b861a){var _0x1a7e5a=[];var _0x2ee443=_[_0x1185('0x13')](Object[_0x1185('0x14')](_0x5b861a[0x0]),0x5);_0x2ee443[_0x1185('0x15')](function(_0x560b54){_0x1a7e5a[_0x1185('0x11')](createTable(_0x560b54,_0x5b861a));});return _0x1a7e5a;}function getPDFDocDefinition(_0xa6be91){var _0x7cde36=util[_0x1185('0x16')](_0x1185('0x17'),NAME,EXTRACTED_REPORT[_0x1185('0x18')],moment(EXTRACTED_REPORT[_0x1185('0x19')])[_0x1185('0x16')](FORMAT),moment(EXTRACTED_REPORT[_0x1185('0x1a')])['format'](FORMAT));var _0x123a93=[];for(var _0x395d83=0x0;_0x395d83<_0xa6be91[_0x1185('0x1b')];_0x395d83++){var _0x2264d5=[];if(_0x395d83===0x0){_0x2264d5['push']({'text':_0x7cde36,'style':_0x1185('0x1c')});}var _0x158932={'table':_0xa6be91[_0x395d83]};if(_0x395d83>0x0){_0x158932[_0x1185('0x1d')]=_0x1185('0x1e');_0x158932['margin']=[0x0,0x46,0x0,0x0];}_0x2264d5['push'](_0x158932);_0x123a93[_0x1185('0x11')](_0x2264d5);}return{'pageSize':'A4','pageOrientation':_0x1185('0x1f'),'content':_0x123a93,'footer':function(_0x4d22ba,_0x128333){return{'text':_0x4d22ba['toString']()+_0x1185('0x20')+_0x128333,'style':_0x1185('0x21')};},'defaultStyle':{'font':_0x1185('0x22')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x1185('0x23')},'footer':{'alignment':_0x1185('0x24'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x51e99b){var _0x3c1286=0x1388;var _0x268158;if(!_0x51e99b[0x0][_0x1185('0x25')]){return analyticExtractedReport(_0x1185('0x26'));}var _0x4bed03=[];var _0x41210c=0x0;var _0x18a554=!![];var _0x38bc9b=path[_0x1185('0x27')](PATH);var _0x59f44a=path[_0x1185('0x28')](PATH,_0x1185('0x29'));var _0x4cda74=path['join'](_0x38bc9b,util['format'](_0x1185('0x2a'),_0x59f44a,_0x1185('0x2b')));var _0x211e13=![];return db['Setting'][_0x1185('0x2c')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizePdf']})[_0x1185('0x2d')](function(_0x5d00fa){if(_0x5d00fa){_0x268158=_0x5d00fa;_0x3c1286=_0x268158[_0x1185('0x2e')]||0x3e8;}})[_0x1185('0x2d')](function(){if(_0x51e99b&&_0x51e99b['length']){var _0x440811=_0x51e99b[0x0]['num']%(_0x41210c+_0x3c1286);if(_0x268158[_0x1185('0x2f')]){for(;_0x18a554;_0x41210c+=_0x3c1286,_0x440811=_0x51e99b[0x0][_0x1185('0x25')]%(_0x41210c+_0x3c1286)){if(_0x440811==0x0||_0x440811==_0x51e99b[0x0]['num']){_0x18a554=![];}_0x4bed03['push'](dbH[_0x1185('0x30')]['query'](util[_0x1185('0x16')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x3c1286,_0x41210c),{'type':dbH[_0x1185('0x30')][_0x1185('0x31')]['SELECT']}));}}else{_0x4bed03[_0x1185('0x11')](dbH[_0x1185('0x30')][_0x1185('0x32')](QUERY,{'type':dbH[_0x1185('0x30')][_0x1185('0x31')]['SELECT']}));}}_0x211e13=_0x268158[_0x1185('0x2f')]&&_0x4bed03[_0x1185('0x1b')]>0x1;if(!fs['existsSync'](path[_0x1185('0x33')](_0x38bc9b,_0x59f44a))&&_0x211e13){fs[_0x1185('0x34')](path[_0x1185('0x33')](_0x38bc9b,_0x59f44a));}return Promise[_0x1185('0x35')](_0x4bed03);})[_0x1185('0x2d')](function(_0x115f78){return createTables(_[_0x1185('0x36')](_0x115f78));})['then'](function(_0x1952e0){var _0x5e3369=getPDFDocDefinition(_0x1952e0);var _0x4ec936=getPDFPrinter();var _0x3ad21d=_0x4ec936['createPdfKitDocument'](_0x5e3369);if(_0x211e13)_0x4cda74=path[_0x1185('0x33')](_0x38bc9b,_0x59f44a,util[_0x1185('0x16')](_0x1185('0x37'),_0x59f44a,index,_0x1185('0x2b')));return writePDFDocument(_0x3ad21d,_0x4cda74);})[_0x1185('0x2d')](function(){if(!_0x211e13)return;zipdir(path[_0x1185('0x33')](_0x38bc9b,_0x59f44a),{'saveTo':path['join'](_0x38bc9b,util[_0x1185('0x16')](_0x1185('0x2a'),_0x59f44a,_0x1185('0x38')))},function(_0xc10bfb){if(_0xc10bfb)throw _0xc10bfb;return;});})[_0x1185('0x2d')](function(){if(!_0x211e13)return;rimraf(path['join'](_0x38bc9b,_0x59f44a),function(){});})[_0x1185('0x2d')](function(){logger[_0x1185('0x39')](util['format'](_0x1185('0x3a'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport('Completed',_0x211e13?util[_0x1185('0x16')]('%s.%s',_0x59f44a,_0x211e13?_0x1185('0x38'):_0x1185('0x2b')):null);});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x1185('0x39')](util[_0x1185('0x16')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x1185('0x3b')));return db[_0x1185('0xb')][_0x1185('0x3c')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x1185('0x2d')](function(_0x426d0a){EXTRACTED_REPORT=_0x426d0a;return dbH[_0x1185('0x30')][_0x1185('0x32')](util[_0x1185('0x16')](_0x1185('0x3d'),QUERY),{'type':dbH[_0x1185('0x30')][_0x1185('0x31')]['SELECT']});})[_0x1185('0x2d')](extractReport)[_0x1185('0x3e')](function(_0x4946e8){logger[_0x1185('0x39')](util[_0x1185('0x16')](_0x1185('0x3f'),EXTRACTED_REPORT_ID,_0x1185('0x3b')),util['inspect'](_0x4946e8,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x1185('0x40'));})[_0x1185('0x41')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x5a63ca=new PdfPrinter({'Arial':{'normal':__dirname+_0x1185('0x42'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0x1185('0x43')}});return _0x5a63ca;}function getPDFDocDefinitionFromHTML(_0x3241b1,_0x5cf0fa){var _0x1c2564=util[_0x1185('0x16')](_0x1185('0x44'),_0x5cf0fa[_0x1185('0x45')],_0x5cf0fa['interactionId']);var _0x3d0565=moment()[_0x1185('0x16')](_0x1185('0x46'))['toString']();var _0x387e5a=htmlToPdfmake(_0x3241b1,{'window':window,'tableAutoSize':!![]});return{'content':[_0x387e5a],'defaultStyle':{'font':_0x1185('0x22')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x1185('0x47'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':'center','margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x1185('0x47')}},'header':function(){return[{'text':_0x1185('0x48'),'style':_0x1185('0x1c')}];},'footer':function(_0x16dbae,_0x3fba05){return[{'text':util[_0x1185('0x16')](_0x1185('0x49'),_0x1c2564,_0x16dbae,_0x3fba05,_0x3d0565),'style':_0x1185('0x21')}];}};}function writePDFDocument(_0x140f3b,_0x383754){return new Promise(function(_0x3d4092,_0x3f0495){var _0x4a5438=_0x140f3b[_0x1185('0x4a')](fs[_0x1185('0x4b')](_0x383754));_0x4a5438['on']('finish',function(){_0x3d4092(_0x1185('0x4c'));});_0x4a5438['on']('error',function(_0x2a3cdc){_0x3f0495(_0x2a3cdc);});_0x140f3b[_0x1185('0x4d')]();});}exports['createPdfFromHTML']=function(_0x582296,_0x31af17){var _0x3b789a=getPDFPrinter();var _0x17a452=getPDFDocDefinitionFromHTML(_0x582296,_0x31af17);var _0x326c32=_0x3b789a['createPdfKitDocument'](_0x17a452);return writePDFDocument(_0x326c32,_0x31af17[_0x1185('0x4e')])['catch'](function(_0x703ba4){throw _0x703ba4;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index f2572d2..0339551 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 _0xdb72=['bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','find','splitSizeXlsx','then','sequelize','query','QueryTypes','SELECT','Empty','split','length','num','push','dirname','basename','.xlsx','join','%s%d.%s','xlsx','%s.%s','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','lodash','json2xls'];(function(_0x338e5d,_0x1f18a9){var _0x1ba1e2=function(_0x1e5403){while(--_0x1e5403){_0x338e5d['push'](_0x338e5d['shift']());}};_0x1ba1e2(++_0x1f18a9);}(_0xdb72,0x14c));var _0x2db7=function(_0x3a6922,_0xc728be){_0x3a6922=_0x3a6922-0x0;var _0x9c1b44=_0xdb72[_0x3a6922];return _0x9c1b44;};'use strict';var util=require(_0x2db7('0x0'));var path=require(_0x2db7('0x1'));var _=require(_0x2db7('0x2'));var fs=require('fs');var json2xls=require(_0x2db7('0x3'));var BPromise=require(_0x2db7('0x4'));var zipdir=require(_0x2db7('0x5'));var rimraf=require(_0x2db7('0x6'));var db=require(_0x2db7('0x7'))['db'];var dbH=require(_0x2db7('0x7'))[_0x2db7('0x8')];var logger=require(_0x2db7('0x9'))(_0x2db7('0xa'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x2db7('0xb')][0x3];var PATH=process[_0x2db7('0xb')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x312388,_0x4da3e6){var _0x2d5ad8={'status':_0x312388};var _0x543821={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4da3e6){_0x2d5ad8[_0x2db7('0xc')]=_0x4da3e6;}return db[_0x2db7('0xd')][_0x2db7('0xe')](_0x2d5ad8,_0x543821);}function main(){var _0x3e1723=0x1388;var _0x5b3d63;logger[_0x2db7('0xf')](util[_0x2db7('0x10')](_0x2db7('0x11'),EXTRACTED_REPORT_ID,_0x2db7('0x12')));return db['Setting'][_0x2db7('0x13')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x2db7('0x14')]})[_0x2db7('0x15')](function(_0x1f1e13){if(_0x1f1e13){_0x5b3d63=_0x1f1e13;_0x3e1723=_0x5b3d63[_0x2db7('0x14')]||0x1388;}})['then'](function(){return dbH[_0x2db7('0x16')][_0x2db7('0x17')](util[_0x2db7('0x10')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x2db7('0x16')][_0x2db7('0x18')][_0x2db7('0x19')]});})[_0x2db7('0x15')](function(_0x4df45a){if(!_0x4df45a[0x0]['num']){return analyticExtractedReport(_0x2db7('0x1a'));}var _0xf21167=[];var _0x1d4d80=0x0;var _0x35d77e=!![];if(_0x5b3d63[_0x2db7('0x1b')]){if(_0x4df45a&&_0x4df45a[_0x2db7('0x1c')]){var _0x447c36=_0x4df45a[0x0][_0x2db7('0x1d')]%(_0x1d4d80+_0x3e1723);for(;_0x35d77e;_0x1d4d80+=_0x3e1723,_0x447c36=_0x4df45a[0x0][_0x2db7('0x1d')]%(_0x1d4d80+_0x3e1723)){if(_0x447c36==0x0||_0x447c36==_0x4df45a[0x0][_0x2db7('0x1d')]){_0x35d77e=![];}_0xf21167[_0x2db7('0x1e')](dbH[_0x2db7('0x16')][_0x2db7('0x17')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x3e1723,_0x1d4d80),{'type':dbH['sequelize'][_0x2db7('0x18')]['SELECT']}));}}}else{_0xf21167[_0x2db7('0x1e')](dbH['sequelize']['query'](QUERY,{'type':dbH[_0x2db7('0x16')][_0x2db7('0x18')]['SELECT']}));}var _0x227f82=path[_0x2db7('0x1f')](PATH);var _0x10f9d7=path[_0x2db7('0x20')](PATH,_0x2db7('0x21'));var _0x12686a=_0x5b3d63[_0x2db7('0x1b')]&&_0xf21167[_0x2db7('0x1c')]>0x1;var _0x314f0e=[];if(!fs['existsSync'](path[_0x2db7('0x22')](_0x227f82,_0x10f9d7))&&_0x12686a){fs['mkdirSync'](path[_0x2db7('0x22')](_0x227f82,_0x10f9d7));}return BPromise['each'](_0xf21167,function(_0x24b033){_0x314f0e[_0x2db7('0x1e')](_0x24b033);})[_0x2db7('0x15')](function(){for(var _0x5c70ca=0x0;_0x5c70ca<_0x314f0e[_0x2db7('0x1c')];_0x5c70ca+=0x1){var _0x5a1b3c;var _0x3c0337=_0x314f0e[_0x5c70ca];if(_0x12686a){_0x5a1b3c=path['join'](_0x227f82,_0x10f9d7,util[_0x2db7('0x10')](_0x2db7('0x23'),_0x10f9d7,_0x5c70ca,_0x2db7('0x24')));}else{_0x5a1b3c=path[_0x2db7('0x22')](_0x227f82,util[_0x2db7('0x10')](_0x2db7('0x25'),_0x10f9d7,_0x2db7('0x24')));}fs['writeFileSync'](_0x5a1b3c,json2xls(_0x3c0337),_0x2db7('0x26'));}})[_0x2db7('0x15')](function(){if(_0x12686a){zipdir(path[_0x2db7('0x22')](_0x227f82,_0x10f9d7),{'saveTo':path[_0x2db7('0x22')](_0x227f82,util[_0x2db7('0x10')]('%s.%s',_0x10f9d7,_0x2db7('0x27')))},function(_0x2d9a56,_0x3787c4){});rimraf(path['join'](_0x227f82,_0x10f9d7),function(){});}})[_0x2db7('0x15')](function(){logger[_0x2db7('0xf')](util[_0x2db7('0x10')](_0x2db7('0x28'),EXTRACTED_REPORT_ID,_0x2db7('0x12')));return analyticExtractedReport(_0x2db7('0x29'),_0x12686a?util[_0x2db7('0x10')](_0x2db7('0x25'),_0x10f9d7,_0x12686a?'zip':'xlsx'):null);});})[_0x2db7('0x2a')](function(_0x32dd67){logger[_0x2db7('0xf')](util[_0x2db7('0x10')](_0x2db7('0x2b'),EXTRACTED_REPORT_ID,_0x2db7('0x12')),util[_0x2db7('0x2c')](_0x32dd67,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x2db7('0x2d'));})[_0x2db7('0x2e')](function(){process[_0x2db7('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x1f46=['SELECT','dirname','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','%s.%s','binary','zip','info','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','path','json2xls','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','num','Empty','length','push'];(function(_0x42f009,_0x5e27b1){var _0x22a1e0=function(_0x297993){while(--_0x297993){_0x42f009['push'](_0x42f009['shift']());}};_0x22a1e0(++_0x5e27b1);}(_0x1f46,0x1ca));var _0x61f4=function(_0x469d36,_0x13b7b1){_0x469d36=_0x469d36-0x0;var _0x2709b3=_0x1f46[_0x469d36];return _0x2709b3;};'use strict';var util=require('util');var path=require(_0x61f4('0x0'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0x61f4('0x1'));var BPromise=require('bluebird');var zipdir=require(_0x61f4('0x2'));var rimraf=require(_0x61f4('0x3'));var db=require('../../mysqldb')['db'];var dbH=require(_0x61f4('0x4'))['dbH'];var logger=require(_0x61f4('0x5'))(_0x61f4('0x6'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x61f4('0x7')][0x3];var PATH=process[_0x61f4('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x25e596,_0x177e91){var _0x781da2={'status':_0x25e596};var _0x38c90d={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x177e91){_0x781da2[_0x61f4('0x8')]=_0x177e91;}return db[_0x61f4('0x9')][_0x61f4('0xa')](_0x781da2,_0x38c90d);}function main(){var _0x19606f=0x1388;var _0x26d330;logger['info'](util[_0x61f4('0xb')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x61f4('0xc')));return db[_0x61f4('0xd')][_0x61f4('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x61f4('0xf'),_0x61f4('0x10')]})[_0x61f4('0x11')](function(_0x207079){if(_0x207079){_0x26d330=_0x207079;_0x19606f=_0x26d330[_0x61f4('0x10')]||0x1388;}})[_0x61f4('0x11')](function(){return dbH[_0x61f4('0x12')][_0x61f4('0x13')](util[_0x61f4('0xb')](_0x61f4('0x14'),QUERY),{'type':dbH[_0x61f4('0x12')][_0x61f4('0x15')]['SELECT']});})[_0x61f4('0x11')](function(_0x5d9e2a){if(!_0x5d9e2a[0x0][_0x61f4('0x16')]){return analyticExtractedReport(_0x61f4('0x17'));}var _0x3d151f=[];var _0xb76de9=0x0;var _0x53773d=!![];if(_0x26d330[_0x61f4('0xf')]){if(_0x5d9e2a&&_0x5d9e2a[_0x61f4('0x18')]){var _0xe03bed=_0x5d9e2a[0x0]['num']%(_0xb76de9+_0x19606f);for(;_0x53773d;_0xb76de9+=_0x19606f,_0xe03bed=_0x5d9e2a[0x0][_0x61f4('0x16')]%(_0xb76de9+_0x19606f)){if(_0xe03bed==0x0||_0xe03bed==_0x5d9e2a[0x0]['num']){_0x53773d=![];}_0x3d151f[_0x61f4('0x19')](dbH[_0x61f4('0x12')][_0x61f4('0x13')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x19606f,_0xb76de9),{'type':dbH[_0x61f4('0x12')][_0x61f4('0x15')][_0x61f4('0x1a')]}));}}}else{_0x3d151f[_0x61f4('0x19')](dbH['sequelize']['query'](QUERY,{'type':dbH[_0x61f4('0x12')][_0x61f4('0x15')][_0x61f4('0x1a')]}));}var _0x1f79c9=path[_0x61f4('0x1b')](PATH);var _0x4726c3=path['basename'](PATH,'.xlsx');var _0x52663f=_0x26d330[_0x61f4('0xf')]&&_0x3d151f[_0x61f4('0x18')]>0x1;var _0xfd33a=[];if(!fs[_0x61f4('0x1c')](path[_0x61f4('0x1d')](_0x1f79c9,_0x4726c3))&&_0x52663f){fs[_0x61f4('0x1e')](path[_0x61f4('0x1d')](_0x1f79c9,_0x4726c3));}return BPromise[_0x61f4('0x1f')](_0x3d151f,function(_0x31dfb1){_0xfd33a['push'](_0x31dfb1);})[_0x61f4('0x11')](function(){for(var _0x40db79=0x0;_0x40db79<_0xfd33a[_0x61f4('0x18')];_0x40db79+=0x1){var _0x7de6fd;var _0x765411=_0xfd33a[_0x40db79];if(_0x52663f){_0x7de6fd=path['join'](_0x1f79c9,_0x4726c3,util[_0x61f4('0xb')](_0x61f4('0x20'),_0x4726c3,_0x40db79,_0x61f4('0x21')));}else{_0x7de6fd=path[_0x61f4('0x1d')](_0x1f79c9,util['format'](_0x61f4('0x22'),_0x4726c3,_0x61f4('0x21')));}fs['writeFileSync'](_0x7de6fd,json2xls(_0x765411),_0x61f4('0x23'));}})[_0x61f4('0x11')](function(){if(_0x52663f){zipdir(path[_0x61f4('0x1d')](_0x1f79c9,_0x4726c3),{'saveTo':path[_0x61f4('0x1d')](_0x1f79c9,util[_0x61f4('0xb')]('%s.%s',_0x4726c3,_0x61f4('0x24')))},function(_0x49feb4,_0xbb3886){});rimraf(path['join'](_0x1f79c9,_0x4726c3),function(){});}})[_0x61f4('0x11')](function(){logger[_0x61f4('0x25')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x61f4('0xc')));return analyticExtractedReport(_0x61f4('0x26'),_0x52663f?util['format'](_0x61f4('0x22'),_0x4726c3,_0x52663f?_0x61f4('0x24'):'xlsx'):null);});})[_0x61f4('0x27')](function(_0x16406e){logger['info'](util['format'](_0x61f4('0x28'),EXTRACTED_REPORT_ID,_0x61f4('0xc')),util[_0x61f4('0x29')](_0x16406e,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x61f4('0x2a')](function(){process[_0x61f4('0x2b')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 62bcea9..a7c56fb 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 _0x57b8=['VoiceExtension','findAll','IntervalId','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','exten','playback','hasOwnProperty','priority','extension','find','extensions','push','type','Set','format','CDR(type)=%s','context','inbound','VoiceExtensionId','outbound','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','createdAt','interval','map','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','catch','error','util','models','Interval','then','intervals'];(function(_0x1d23b8,_0x4d234d){var _0x2693a3=function(_0x5d39eb){while(--_0x5d39eb){_0x1d23b8['push'](_0x1d23b8['shift']());}};_0x2693a3(++_0x4d234d);}(_0x57b8,0x1a5));var _0x857b=function(_0x39adc0,_0x4844a4){_0x39adc0=_0x39adc0-0x0;var _0x2fccf0=_0x57b8[_0x39adc0];return _0x2fccf0;};'use strict';var _=require('lodash');var util=require(_0x857b('0x0'));function rewrite(_0x1da73f,_0x46000a){var _0x287dea=this;return _0x1da73f[_0x857b('0x1')][_0x857b('0x2')]['findAll']({'raw':!![]})[_0x857b('0x3')](function(_0xeff9f9){_0x287dea[_0x857b('0x4')]=_0xeff9f9;return _0x1da73f[_0x857b('0x1')][_0x857b('0x5')][_0x857b('0x6')]({'where':{'IntervalId':_0x46000a[_0x857b('0x7')]},'raw':!![]});})['then'](function(_0x51b18c){return _0x1da73f['models'][_0x857b('0x5')][_0x857b('0x6')]({'where':{'exten':{'$in':_['uniq'](_['map'](_0x51b18c,'exten'))}},'order':[{'raw':_0x857b('0x8')}],'raw':!![]});})[_0x857b('0x3')](function(_0x599e9c){var _0x41e138=_[_0x857b('0x9')](_0x599e9c,{'priority':'1'});var _0x1cfcc0=_['filter'](_0x599e9c,{'isApp':0x1});var _0x2d5db7=_[_0x857b('0xa')](_0x1cfcc0,_0x857b('0xb'));var _0x116d0a=['queue',_0x857b('0xc')];var _0x3ad961=[];var _0x7e14d9=[];for(var _0x12eda5 in _0x2d5db7){if(_0x2d5db7[_0x857b('0xd')](_0x12eda5)){_0x287dea[_0x857b('0xe')]=0x2;_0x287dea['extensions']=[];_0x287dea[_0x857b('0xf')]=_[_0x857b('0x10')](_0x41e138,{'exten':_0x2d5db7[_0x12eda5][0x0]['exten']});_0x287dea[_0x857b('0x11')][_0x857b('0x12')]({'type':_0x2d5db7[_0x12eda5][0x0][_0x857b('0x13')],'app':_0x857b('0x14'),'appdata':util[_0x857b('0x15')](_0x857b('0x16'),_0x2d5db7[_0x12eda5][0x0][_0x857b('0x13')]),'context':_0x2d5db7[_0x12eda5][0x0][_0x857b('0x17')],'exten':_0x2d5db7[_0x12eda5][0x0][_0x857b('0xb')],'priority':_0x287dea[_0x857b('0xe')]++,'VoiceExtensionId':_0x2d5db7[_0x12eda5][0x0]['VoiceExtensionId']});if(_0x2d5db7[_0x12eda5][0x0][_0x857b('0x13')]===_0x857b('0x18')){_0x287dea[_0x857b('0x11')]['push']({'type':_0x2d5db7[_0x12eda5][0x0][_0x857b('0x13')],'app':_0x857b('0x14'),'appdata':'CDR(routeid)='+_0x2d5db7[_0x12eda5][0x0][_0x857b('0x19')],'context':_0x2d5db7[_0x12eda5][0x0]['context'],'exten':_0x2d5db7[_0x12eda5][0x0][_0x857b('0xb')],'priority':_0x287dea['priority']++,'VoiceExtensionId':_0x2d5db7[_0x12eda5][0x0]['VoiceExtensionId']});}else if(_0x2d5db7[_0x12eda5][0x0][_0x857b('0x13')]===_0x857b('0x1a')){if(_0x287dea[_0x857b('0xf')]){_0x287dea[_0x857b('0x11')][_0x857b('0x12')]({'type':_0x2d5db7[_0x12eda5][0x0]['type'],'app':_0x857b('0x14'),'appdata':'CDR(destination)='+(_0x287dea[_0x857b('0xf')][_0x857b('0x1b')]?_0x857b('0x1c')+_0x287dea[_0x857b('0xf')][_0x857b('0x1b')]+'}':_0x857b('0x1d')),'context':_0x2d5db7[_0x12eda5][0x0][_0x857b('0x17')],'exten':_0x2d5db7[_0x12eda5][0x0][_0x857b('0xb')],'priority':_0x287dea[_0x857b('0xe')]++,'VoiceExtensionId':_0x2d5db7[_0x12eda5][0x0][_0x857b('0x19')]});}_0x287dea[_0x857b('0x11')][_0x857b('0x12')]({'type':_0x2d5db7[_0x12eda5][0x0][_0x857b('0x13')],'app':_0x857b('0x14'),'appdata':_0x857b('0x1e')+_0x2d5db7[_0x12eda5][0x0][_0x857b('0x19')],'context':_0x2d5db7[_0x12eda5][0x0][_0x857b('0x17')],'exten':_0x2d5db7[_0x12eda5][0x0][_0x857b('0xb')],'priority':_0x287dea['priority']++,'VoiceExtensionId':_0x2d5db7[_0x12eda5][0x0]['VoiceExtensionId']});var _0x359ad6=_0x287dea['priority']++;_0x287dea['extensions']['push']({'type':_0x2d5db7[_0x12eda5][0x0][_0x857b('0x13')],'app':_0x857b('0x1f'),'appdata':_0x857b('0x20')+(_0x359ad6+0x2)+_0x857b('0x21')+(_0x359ad6+0x1)+')','context':_0x2d5db7[_0x12eda5][0x0][_0x857b('0x17')],'exten':_0x2d5db7[_0x12eda5][0x0][_0x857b('0xb')],'priority':_0x359ad6,'VoiceExtensionId':_0x2d5db7[_0x12eda5][0x0][_0x857b('0x19')]});if(_0x287dea[_0x857b('0xf')]){_0x287dea[_0x857b('0x11')][_0x857b('0x12')]({'type':_0x2d5db7[_0x12eda5][0x0][_0x857b('0x13')],'app':'Set','appdata':_0x287dea[_0x857b('0xf')]['cutdigits']?_0x857b('0x22')+_0x287dea['extension'][_0x857b('0x1b')]+'}':_0x857b('0x23'),'context':_0x2d5db7[_0x12eda5][0x0]['context'],'exten':_0x2d5db7[_0x12eda5][0x0][_0x857b('0xb')],'priority':_0x287dea[_0x857b('0xe')]++,'VoiceExtensionId':_0x2d5db7[_0x12eda5][0x0][_0x857b('0x19')]});}_0x287dea['extensions']['push']({'type':_0x2d5db7[_0x12eda5][0x0][_0x857b('0x13')],'app':'Set','appdata':_0x857b('0x24')+_0x2d5db7[_0x12eda5][0x0][_0x857b('0x19')],'context':_0x2d5db7[_0x12eda5][0x0][_0x857b('0x17')],'exten':_0x2d5db7[_0x12eda5][0x0]['exten'],'priority':_0x287dea['priority']++,'VoiceExtensionId':_0x2d5db7[_0x12eda5][0x0][_0x857b('0x19')]});if(_0x287dea[_0x857b('0xf')]&&_0x287dea[_0x857b('0xf')]['hasOwnProperty'](_0x857b('0x25'))&&_0x287dea['extension'][_0x857b('0x25')]!==_0x857b('0x26')){_0x287dea[_0x857b('0x11')][_0x857b('0x12')]({'type':_0x2d5db7[_0x12eda5][0x0]['type'],'app':_0x857b('0x14'),'appdata':_0x857b('0x27'),'context':_0x2d5db7[_0x12eda5][0x0][_0x857b('0x17')],'exten':_0x2d5db7[_0x12eda5][0x0][_0x857b('0xb')],'priority':_0x287dea[_0x857b('0xe')]++,'VoiceExtensionId':_0x2d5db7[_0x12eda5][0x0][_0x857b('0x19')]});_0x287dea[_0x857b('0x11')][_0x857b('0x12')]({'type':_0x2d5db7[_0x12eda5][0x0][_0x857b('0x13')],'app':_0x857b('0x14'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x287dea['extension'][_0x857b('0x25')]||_0x857b('0x28'),'context':_0x2d5db7[_0x12eda5][0x0][_0x857b('0x17')],'exten':_0x2d5db7[_0x12eda5][0x0][_0x857b('0xb')],'priority':_0x287dea[_0x857b('0xe')]++,'VoiceExtensionId':_0x2d5db7[_0x12eda5][0x0][_0x857b('0x19')]});}}_0x287dea[_0x857b('0x11')][_0x857b('0x12')]({'type':_0x2d5db7[_0x12eda5][0x0]['type'],'app':'Set','appdata':_0x857b('0x29'),'context':_0x2d5db7[_0x12eda5][0x0][_0x857b('0x17')],'exten':_0x2d5db7[_0x12eda5][0x0]['exten'],'priority':_0x287dea[_0x857b('0xe')]++,'VoiceExtensionId':_0x2d5db7[_0x12eda5][0x0][_0x857b('0x19')]});_0x287dea['extensions']['push']({'type':_0x2d5db7[_0x12eda5][0x0][_0x857b('0x13')],'app':'Set','appdata':_0x857b('0x2a'),'context':_0x2d5db7[_0x12eda5][0x0][_0x857b('0x17')],'exten':_0x2d5db7[_0x12eda5][0x0][_0x857b('0xb')],'priority':_0x287dea['priority']++,'VoiceExtensionId':_0x2d5db7[_0x12eda5][0x0][_0x857b('0x19')]});_0x287dea[_0x857b('0x11')]['push']({'type':_0x2d5db7[_0x12eda5][0x0]['type'],'app':_0x857b('0x14'),'appdata':_0x857b('0x2b'),'context':_0x2d5db7[_0x12eda5][0x0][_0x857b('0x17')],'exten':_0x2d5db7[_0x12eda5][0x0][_0x857b('0xb')],'priority':_0x287dea[_0x857b('0xe')]++,'VoiceExtensionId':_0x2d5db7[_0x12eda5][0x0][_0x857b('0x19')]});for(var _0x3625dd=0x0,_0x9a2f30=0x0;_0x3625dd<_0x2d5db7[_0x12eda5][_0x857b('0x2c')];_0x3625dd+=0x1,_0x9a2f30=0x0){var _0x309cb8=_0x2d5db7[_0x12eda5][_0x3625dd];if(_0x309cb8[_0x857b('0x13')]){_0x309cb8[_0x857b('0x13')]=_0x309cb8[_0x857b('0x13')]['toLowerCase']();}var _0x385147=[];var _0x23ab67=[];delete _0x309cb8['id'];delete _0x309cb8[_0x857b('0x2d')];delete _0x309cb8['updatedAt'];var _0x405842=_0x309cb8[_0x857b('0x2e')]!=='*,*,*,*'?[_0x309cb8[_0x857b('0x2e')]]:_0x309cb8[_0x857b('0x7')]?_[_0x857b('0x2f')](_[_0x857b('0x9')](_0x287dea[_0x857b('0x4')],{'IntervalId':_0x309cb8[_0x857b('0x7')]}),_0x857b('0x2e')):[];if(_0x309cb8[_0x857b('0xd')](_0x857b('0x30'))){if(_0x309cb8[_0x857b('0x30')]&&_0x309cb8['tag']!=='--'){_0x385147[_0x857b('0x12')]({'type':_0x309cb8['type'],'app':_0x857b('0x14'),'appdata':_0x857b('0x31')+_0x309cb8['tag'],'context':_0x309cb8[_0x857b('0x17')],'exten':_0x309cb8[_0x857b('0xb')],'priority':_0x405842['length']+_0x287dea['priority']+_0x9a2f30++,'VoiceExtensionId':_0x309cb8[_0x857b('0x19')]});}}if(_0x309cb8[_0x857b('0x13')]===_0x857b('0x1a')&&_0x309cb8[_0x857b('0xd')](_0x857b('0x32'))){if(_0x309cb8['callerID']){_0x385147[_0x857b('0x12')]({'type':_0x309cb8[_0x857b('0x13')],'app':_0x857b('0x1f'),'appdata':_0x857b('0x33')+_0x309cb8['callerID']+')','context':_0x309cb8[_0x857b('0x17')],'exten':_0x309cb8[_0x857b('0xb')],'priority':_0x405842[_0x857b('0x2c')]+_0x287dea['priority']+_0x9a2f30++,'VoiceExtensionId':_0x309cb8[_0x857b('0x19')]});}else{_0x385147[_0x857b('0x12')]({'type':_0x309cb8[_0x857b('0x13')],'app':_0x857b('0x1f'),'appdata':_0x857b('0x34'),'context':_0x309cb8['context'],'exten':_0x309cb8[_0x857b('0xb')],'priority':_0x405842[_0x857b('0x2c')]+_0x287dea['priority']+_0x9a2f30++,'VoiceExtensionId':_0x309cb8['VoiceExtensionId']});}}if(_0x309cb8[_0x857b('0xd')](_0x857b('0x35'))){if(_0x116d0a[_0x857b('0x36')](_0x309cb8[_0x857b('0x37')]['toLowerCase']())>=0x0&&_0x309cb8['appType']!=='custom'){if(_0x309cb8[_0x857b('0x35')]){_0x385147[_0x857b('0x12')]({'type':_0x309cb8['type'],'app':'ExecIf','appdata':_0x857b('0x38'),'context':_0x309cb8[_0x857b('0x17')],'exten':_0x309cb8[_0x857b('0xb')],'priority':_0x405842[_0x857b('0x2c')]+_0x287dea[_0x857b('0xe')]+_0x9a2f30++,'VoiceExtensionId':_0x309cb8[_0x857b('0x19')]});_0x385147[_0x857b('0x12')]({'type':_0x309cb8[_0x857b('0x13')],'app':_0x857b('0x14'),'appdata':_0x857b('0x39'),'context':_0x309cb8[_0x857b('0x17')],'exten':_0x309cb8[_0x857b('0xb')],'priority':_0x405842['length']+_0x287dea[_0x857b('0xe')]+_0x9a2f30++,'VoiceExtensionId':_0x309cb8['VoiceExtensionId']});}else{_0x385147[_0x857b('0x12')]({'type':_0x309cb8['type'],'app':_0x857b('0x1f'),'appdata':_0x857b('0x3a'),'context':_0x309cb8[_0x857b('0x17')],'exten':_0x309cb8[_0x857b('0xb')],'priority':_0x405842[_0x857b('0x2c')]+_0x287dea[_0x857b('0xe')]+_0x9a2f30++,'VoiceExtensionId':_0x309cb8['VoiceExtensionId']});_0x385147[_0x857b('0x12')]({'type':_0x309cb8[_0x857b('0x13')],'app':_0x857b('0x14'),'appdata':_0x857b('0x3b'),'context':_0x309cb8[_0x857b('0x17')],'exten':_0x309cb8[_0x857b('0xb')],'priority':_0x405842[_0x857b('0x2c')]+_0x287dea[_0x857b('0xe')]+_0x9a2f30++,'VoiceExtensionId':_0x309cb8[_0x857b('0x19')]});}}}for(var _0x6f4ec0=0x0;_0x6f4ec0<_0x405842['length'];_0x6f4ec0+=0x1){var _0x39a7cb=_0x287dea[_0x857b('0xe')]+_0x405842[_0x857b('0x2c')];var _0x1fe165=_0x6f4ec0===_0x405842[_0x857b('0x2c')]-0x1?_0x287dea[_0x857b('0xe')]+_0x385147[_0x857b('0x2c')]+_0x23ab67['length']+0x2:_0x287dea[_0x857b('0xe')]+_0x6f4ec0+0x1;_0x385147['splice'](_0x6f4ec0,0x0,{'type':_0x309cb8[_0x857b('0x13')],'app':_0x857b('0x3c'),'appdata':_0x405842[_0x6f4ec0]+'?'+_0x309cb8[_0x857b('0x17')]+',${EXTEN},'+_0x39a7cb+':'+_0x309cb8[_0x857b('0x17')]+_0x857b('0x3d')+_0x1fe165,'exten':_0x309cb8[_0x857b('0xb')],'context':_0x309cb8[_0x857b('0x17')],'priority':_0x287dea[_0x857b('0xe')]+_0x6f4ec0,'VoiceExtensionId':_0x2d5db7[_0x12eda5][0x0]['VoiceExtensionId']});}_0x309cb8[_0x857b('0xe')]=_0x385147[_0x857b('0x2c')]?_[_0x857b('0x3e')](_0x385147)[_0x857b('0xe')]+0x1:_0x287dea[_0x857b('0xe')];_0x287dea[_0x857b('0xe')]=(_0x23ab67['length']?_[_0x857b('0x3e')](_0x23ab67)[_0x857b('0xe')]:_0x309cb8[_0x857b('0xe')])+0x1;_0x287dea[_0x857b('0x11')]=_[_0x857b('0x3f')](_0x287dea['extensions'],_0x385147,[_0x309cb8],_0x23ab67);}_0x287dea[_0x857b('0x11')]['push']({'type':_0x2d5db7[_0x12eda5][0x0][_0x857b('0x13')],'app':_0x857b('0x40'),'exten':_0x2d5db7[_0x12eda5][0x0][_0x857b('0xb')],'context':_0x2d5db7[_0x12eda5][0x0][_0x857b('0x17')],'priority':_0x287dea[_0x857b('0xe')],'VoiceExtensionId':_0x2d5db7[_0x12eda5][0x0][_0x857b('0x19')]});_0x3ad961['push'](_0x2d5db7[_0x12eda5][0x0]['VoiceExtensionId']);_0x7e14d9=_['concat'](_0x7e14d9,_0x287dea[_0x857b('0x11')]);}}return _0x1da73f[_0x857b('0x41')](function(_0xa36c5a){return _0x1da73f[_0x857b('0x1')][_0x857b('0x5')][_0x857b('0x42')]({'where':{'VoiceExtensionId':{'$in':_0x3ad961}},'transaction':_0xa36c5a})[_0x857b('0x3')](function(_0x4b5761){return _0x1da73f['models'][_0x857b('0x5')][_0x857b('0x43')](_[_0x857b('0x44')](_0x7e14d9,_0x857b('0xe')),{'transaction':_0xa36c5a});});});})[_0x857b('0x45')](function(_0x224bdc){console[_0x857b('0x46')](_0x224bdc);});}exports['rewrite']=rewrite; \ No newline at end of file +var _0x43f1=['$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','VoiceExtension','bulkCreate','catch','error','rewrite','lodash','util','models','Interval','findAll','then','intervals','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','playback','hasOwnProperty','priority','extension','find','extensions','push','type','format','CDR(type)=%s','Set','CDR(routeid)=','context','outbound','${EXTEN:','${EXTEN}','VoiceExtensionId','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','cutdigits','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','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)','answer','indexOf','appType','custom'];(function(_0x13854c,_0x2ed273){var _0x4d9c2e=function(_0x2680d9){while(--_0x2680d9){_0x13854c['push'](_0x13854c['shift']());}};_0x4d9c2e(++_0x2ed273);}(_0x43f1,0x1b8));var _0x143f=function(_0x2bafde,_0x39326c){_0x2bafde=_0x2bafde-0x0;var _0x5733dc=_0x43f1[_0x2bafde];return _0x5733dc;};'use strict';var _=require(_0x143f('0x0'));var util=require(_0x143f('0x1'));function rewrite(_0x34ec35,_0x32e1b5){var _0x344919=this;return _0x34ec35[_0x143f('0x2')][_0x143f('0x3')][_0x143f('0x4')]({'raw':!![]})[_0x143f('0x5')](function(_0x38df8a){_0x344919[_0x143f('0x6')]=_0x38df8a;return _0x34ec35[_0x143f('0x2')]['VoiceExtension'][_0x143f('0x4')]({'where':{'IntervalId':_0x32e1b5[_0x143f('0x7')]},'raw':!![]});})[_0x143f('0x5')](function(_0x54ee7a){return _0x34ec35[_0x143f('0x2')]['VoiceExtension'][_0x143f('0x4')]({'where':{'exten':{'$in':_[_0x143f('0x8')](_[_0x143f('0x9')](_0x54ee7a,_0x143f('0xa')))}},'order':[{'raw':_0x143f('0xb')}],'raw':!![]});})[_0x143f('0x5')](function(_0x1a684c){var _0x50b352=_[_0x143f('0xc')](_0x1a684c,{'priority':'1'});var _0x3a7e09=_[_0x143f('0xc')](_0x1a684c,{'isApp':0x1});var _0x452ff5=_['groupBy'](_0x3a7e09,'exten');var _0x33a5f2=['queue',_0x143f('0xd')];var _0x296e5b=[];var _0x41181c=[];for(var _0x110793 in _0x452ff5){if(_0x452ff5[_0x143f('0xe')](_0x110793)){_0x344919[_0x143f('0xf')]=0x2;_0x344919['extensions']=[];_0x344919[_0x143f('0x10')]=_[_0x143f('0x11')](_0x50b352,{'exten':_0x452ff5[_0x110793][0x0][_0x143f('0xa')]});_0x344919[_0x143f('0x12')][_0x143f('0x13')]({'type':_0x452ff5[_0x110793][0x0][_0x143f('0x14')],'app':'Set','appdata':util[_0x143f('0x15')](_0x143f('0x16'),_0x452ff5[_0x110793][0x0][_0x143f('0x14')]),'context':_0x452ff5[_0x110793][0x0]['context'],'exten':_0x452ff5[_0x110793][0x0][_0x143f('0xa')],'priority':_0x344919[_0x143f('0xf')]++,'VoiceExtensionId':_0x452ff5[_0x110793][0x0]['VoiceExtensionId']});if(_0x452ff5[_0x110793][0x0]['type']==='inbound'){_0x344919[_0x143f('0x12')]['push']({'type':_0x452ff5[_0x110793][0x0]['type'],'app':_0x143f('0x17'),'appdata':_0x143f('0x18')+_0x452ff5[_0x110793][0x0]['VoiceExtensionId'],'context':_0x452ff5[_0x110793][0x0][_0x143f('0x19')],'exten':_0x452ff5[_0x110793][0x0]['exten'],'priority':_0x344919[_0x143f('0xf')]++,'VoiceExtensionId':_0x452ff5[_0x110793][0x0]['VoiceExtensionId']});}else if(_0x452ff5[_0x110793][0x0][_0x143f('0x14')]===_0x143f('0x1a')){if(_0x344919['extension']){_0x344919[_0x143f('0x12')][_0x143f('0x13')]({'type':_0x452ff5[_0x110793][0x0][_0x143f('0x14')],'app':_0x143f('0x17'),'appdata':'CDR(destination)='+(_0x344919[_0x143f('0x10')]['cutdigits']?_0x143f('0x1b')+_0x344919[_0x143f('0x10')]['cutdigits']+'}':_0x143f('0x1c')),'context':_0x452ff5[_0x110793][0x0][_0x143f('0x19')],'exten':_0x452ff5[_0x110793][0x0]['exten'],'priority':_0x344919[_0x143f('0xf')]++,'VoiceExtensionId':_0x452ff5[_0x110793][0x0][_0x143f('0x1d')]});}_0x344919[_0x143f('0x12')][_0x143f('0x13')]({'type':_0x452ff5[_0x110793][0x0][_0x143f('0x14')],'app':_0x143f('0x17'),'appdata':'CDR(routeid)='+_0x452ff5[_0x110793][0x0]['VoiceExtensionId'],'context':_0x452ff5[_0x110793][0x0][_0x143f('0x19')],'exten':_0x452ff5[_0x110793][0x0][_0x143f('0xa')],'priority':_0x344919[_0x143f('0xf')]++,'VoiceExtensionId':_0x452ff5[_0x110793][0x0][_0x143f('0x1d')]});var _0x3f63d3=_0x344919['priority']++;_0x344919[_0x143f('0x12')][_0x143f('0x13')]({'type':_0x452ff5[_0x110793][0x0][_0x143f('0x14')],'app':'ExecIf','appdata':_0x143f('0x1e')+(_0x3f63d3+0x2)+_0x143f('0x1f')+(_0x3f63d3+0x1)+')','context':_0x452ff5[_0x110793][0x0][_0x143f('0x19')],'exten':_0x452ff5[_0x110793][0x0]['exten'],'priority':_0x3f63d3,'VoiceExtensionId':_0x452ff5[_0x110793][0x0]['VoiceExtensionId']});if(_0x344919[_0x143f('0x10')]){_0x344919[_0x143f('0x12')][_0x143f('0x13')]({'type':_0x452ff5[_0x110793][0x0][_0x143f('0x14')],'app':'Set','appdata':_0x344919['extension'][_0x143f('0x20')]?_0x143f('0x21')+_0x344919['extension']['cutdigits']+'}':_0x143f('0x22'),'context':_0x452ff5[_0x110793][0x0][_0x143f('0x19')],'exten':_0x452ff5[_0x110793][0x0][_0x143f('0xa')],'priority':_0x344919['priority']++,'VoiceExtensionId':_0x452ff5[_0x110793][0x0][_0x143f('0x1d')]});}_0x344919[_0x143f('0x12')][_0x143f('0x13')]({'type':_0x452ff5[_0x110793][0x0][_0x143f('0x14')],'app':_0x143f('0x17'),'appdata':_0x143f('0x23')+_0x452ff5[_0x110793][0x0]['VoiceExtensionId'],'context':_0x452ff5[_0x110793][0x0][_0x143f('0x19')],'exten':_0x452ff5[_0x110793][0x0][_0x143f('0xa')],'priority':_0x344919[_0x143f('0xf')]++,'VoiceExtensionId':_0x452ff5[_0x110793][0x0]['VoiceExtensionId']});if(_0x344919[_0x143f('0x10')]&&_0x344919[_0x143f('0x10')][_0x143f('0xe')]('recordingFormat')&&_0x344919[_0x143f('0x10')][_0x143f('0x24')]!==_0x143f('0x25')){_0x344919[_0x143f('0x12')][_0x143f('0x13')]({'type':_0x452ff5[_0x110793][0x0]['type'],'app':_0x143f('0x17'),'appdata':_0x143f('0x26'),'context':_0x452ff5[_0x110793][0x0][_0x143f('0x19')],'exten':_0x452ff5[_0x110793][0x0]['exten'],'priority':_0x344919['priority']++,'VoiceExtensionId':_0x452ff5[_0x110793][0x0][_0x143f('0x1d')]});_0x344919[_0x143f('0x12')][_0x143f('0x13')]({'type':_0x452ff5[_0x110793][0x0][_0x143f('0x14')],'app':_0x143f('0x17'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x344919['extension']['recordingFormat']||_0x143f('0x27'),'context':_0x452ff5[_0x110793][0x0][_0x143f('0x19')],'exten':_0x452ff5[_0x110793][0x0][_0x143f('0xa')],'priority':_0x344919['priority']++,'VoiceExtensionId':_0x452ff5[_0x110793][0x0][_0x143f('0x1d')]});}}_0x344919['extensions'][_0x143f('0x13')]({'type':_0x452ff5[_0x110793][0x0][_0x143f('0x14')],'app':_0x143f('0x17'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x452ff5[_0x110793][0x0]['context'],'exten':_0x452ff5[_0x110793][0x0][_0x143f('0xa')],'priority':_0x344919[_0x143f('0xf')]++,'VoiceExtensionId':_0x452ff5[_0x110793][0x0][_0x143f('0x1d')]});_0x344919['extensions']['push']({'type':_0x452ff5[_0x110793][0x0][_0x143f('0x14')],'app':_0x143f('0x17'),'appdata':_0x143f('0x28'),'context':_0x452ff5[_0x110793][0x0]['context'],'exten':_0x452ff5[_0x110793][0x0][_0x143f('0xa')],'priority':_0x344919[_0x143f('0xf')]++,'VoiceExtensionId':_0x452ff5[_0x110793][0x0][_0x143f('0x1d')]});_0x344919[_0x143f('0x12')][_0x143f('0x13')]({'type':_0x452ff5[_0x110793][0x0]['type'],'app':'Set','appdata':_0x143f('0x29'),'context':_0x452ff5[_0x110793][0x0][_0x143f('0x19')],'exten':_0x452ff5[_0x110793][0x0][_0x143f('0xa')],'priority':_0x344919['priority']++,'VoiceExtensionId':_0x452ff5[_0x110793][0x0][_0x143f('0x1d')]});for(var _0x2b95b6=0x0,_0x470697=0x0;_0x2b95b6<_0x452ff5[_0x110793][_0x143f('0x2a')];_0x2b95b6+=0x1,_0x470697=0x0){var _0x5aae64=_0x452ff5[_0x110793][_0x2b95b6];if(_0x5aae64[_0x143f('0x14')]){_0x5aae64['type']=_0x5aae64[_0x143f('0x14')][_0x143f('0x2b')]();}var _0x250da6=[];var _0x184a4b=[];delete _0x5aae64['id'];delete _0x5aae64[_0x143f('0x2c')];delete _0x5aae64[_0x143f('0x2d')];var _0x207ffd=_0x5aae64[_0x143f('0x2e')]!=='*,*,*,*'?[_0x5aae64['interval']]:_0x5aae64['IntervalId']?_[_0x143f('0x9')](_['filter'](_0x344919[_0x143f('0x6')],{'IntervalId':_0x5aae64[_0x143f('0x7')]}),_0x143f('0x2e')):[];if(_0x5aae64[_0x143f('0xe')]('tag')){if(_0x5aae64['tag']&&_0x5aae64[_0x143f('0x2f')]!=='--'){_0x250da6[_0x143f('0x13')]({'type':_0x5aae64[_0x143f('0x14')],'app':_0x143f('0x17'),'appdata':_0x143f('0x30')+_0x5aae64['tag'],'context':_0x5aae64[_0x143f('0x19')],'exten':_0x5aae64[_0x143f('0xa')],'priority':_0x207ffd[_0x143f('0x2a')]+_0x344919[_0x143f('0xf')]+_0x470697++,'VoiceExtensionId':_0x5aae64[_0x143f('0x1d')]});}}if(_0x5aae64[_0x143f('0x14')]===_0x143f('0x1a')&&_0x5aae64['hasOwnProperty'](_0x143f('0x31'))){if(_0x5aae64[_0x143f('0x31')]){_0x250da6['push']({'type':_0x5aae64[_0x143f('0x14')],'app':_0x143f('0x32'),'appdata':_0x143f('0x33')+_0x5aae64[_0x143f('0x31')]+')','context':_0x5aae64[_0x143f('0x19')],'exten':_0x5aae64[_0x143f('0xa')],'priority':_0x207ffd[_0x143f('0x2a')]+_0x344919['priority']+_0x470697++,'VoiceExtensionId':_0x5aae64[_0x143f('0x1d')]});}else{_0x250da6['push']({'type':_0x5aae64[_0x143f('0x14')],'app':_0x143f('0x32'),'appdata':_0x143f('0x34'),'context':_0x5aae64[_0x143f('0x19')],'exten':_0x5aae64['exten'],'priority':_0x207ffd[_0x143f('0x2a')]+_0x344919['priority']+_0x470697++,'VoiceExtensionId':_0x5aae64[_0x143f('0x1d')]});}}if(_0x5aae64['hasOwnProperty'](_0x143f('0x35'))){if(_0x33a5f2[_0x143f('0x36')](_0x5aae64['app'][_0x143f('0x2b')]())>=0x0&&_0x5aae64[_0x143f('0x37')]!==_0x143f('0x38')){if(_0x5aae64['answer']){_0x250da6['push']({'type':_0x5aae64[_0x143f('0x14')],'app':_0x143f('0x32'),'appdata':_0x143f('0x39'),'context':_0x5aae64[_0x143f('0x19')],'exten':_0x5aae64[_0x143f('0xa')],'priority':_0x207ffd[_0x143f('0x2a')]+_0x344919[_0x143f('0xf')]+_0x470697++,'VoiceExtensionId':_0x5aae64[_0x143f('0x1d')]});_0x250da6['push']({'type':_0x5aae64['type'],'app':_0x143f('0x17'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x5aae64[_0x143f('0x19')],'exten':_0x5aae64[_0x143f('0xa')],'priority':_0x207ffd[_0x143f('0x2a')]+_0x344919[_0x143f('0xf')]+_0x470697++,'VoiceExtensionId':_0x5aae64[_0x143f('0x1d')]});}else{_0x250da6[_0x143f('0x13')]({'type':_0x5aae64[_0x143f('0x14')],'app':'ExecIf','appdata':_0x143f('0x3a'),'context':_0x5aae64['context'],'exten':_0x5aae64[_0x143f('0xa')],'priority':_0x207ffd['length']+_0x344919[_0x143f('0xf')]+_0x470697++,'VoiceExtensionId':_0x5aae64[_0x143f('0x1d')]});_0x250da6[_0x143f('0x13')]({'type':_0x5aae64[_0x143f('0x14')],'app':_0x143f('0x17'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x5aae64[_0x143f('0x19')],'exten':_0x5aae64['exten'],'priority':_0x207ffd[_0x143f('0x2a')]+_0x344919[_0x143f('0xf')]+_0x470697++,'VoiceExtensionId':_0x5aae64[_0x143f('0x1d')]});}}}for(var _0x40c296=0x0;_0x40c296<_0x207ffd[_0x143f('0x2a')];_0x40c296+=0x1){var _0x3af585=_0x344919[_0x143f('0xf')]+_0x207ffd[_0x143f('0x2a')];var _0x788e7c=_0x40c296===_0x207ffd[_0x143f('0x2a')]-0x1?_0x344919['priority']+_0x250da6['length']+_0x184a4b['length']+0x2:_0x344919[_0x143f('0xf')]+_0x40c296+0x1;_0x250da6[_0x143f('0x3b')](_0x40c296,0x0,{'type':_0x5aae64[_0x143f('0x14')],'app':_0x143f('0x3c'),'appdata':_0x207ffd[_0x40c296]+'?'+_0x5aae64[_0x143f('0x19')]+',${EXTEN},'+_0x3af585+':'+_0x5aae64[_0x143f('0x19')]+_0x143f('0x3d')+_0x788e7c,'exten':_0x5aae64[_0x143f('0xa')],'context':_0x5aae64['context'],'priority':_0x344919[_0x143f('0xf')]+_0x40c296,'VoiceExtensionId':_0x452ff5[_0x110793][0x0][_0x143f('0x1d')]});}_0x5aae64[_0x143f('0xf')]=_0x250da6[_0x143f('0x2a')]?_[_0x143f('0x3e')](_0x250da6)[_0x143f('0xf')]+0x1:_0x344919['priority'];_0x344919[_0x143f('0xf')]=(_0x184a4b['length']?_[_0x143f('0x3e')](_0x184a4b)[_0x143f('0xf')]:_0x5aae64[_0x143f('0xf')])+0x1;_0x344919[_0x143f('0x12')]=_[_0x143f('0x3f')](_0x344919[_0x143f('0x12')],_0x250da6,[_0x5aae64],_0x184a4b);}_0x344919[_0x143f('0x12')][_0x143f('0x13')]({'type':_0x452ff5[_0x110793][0x0][_0x143f('0x14')],'app':_0x143f('0x40'),'exten':_0x452ff5[_0x110793][0x0][_0x143f('0xa')],'context':_0x452ff5[_0x110793][0x0]['context'],'priority':_0x344919['priority'],'VoiceExtensionId':_0x452ff5[_0x110793][0x0][_0x143f('0x1d')]});_0x296e5b[_0x143f('0x13')](_0x452ff5[_0x110793][0x0][_0x143f('0x1d')]);_0x41181c=_[_0x143f('0x3f')](_0x41181c,_0x344919[_0x143f('0x12')]);}}return _0x34ec35[_0x143f('0x41')](function(_0x4e0631){return _0x34ec35[_0x143f('0x2')][_0x143f('0x42')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x296e5b}},'transaction':_0x4e0631})[_0x143f('0x5')](function(_0x2f46fb){return _0x34ec35[_0x143f('0x2')][_0x143f('0x42')][_0x143f('0x43')](_['sortBy'](_0x41181c,_0x143f('0xf')),{'transaction':_0x4e0631});});});})[_0x143f('0x44')](function(_0x4d25a5){console[_0x143f('0x45')](_0x4d25a5);});}exports[_0x143f('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 8be2712..f803d9c 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 _0x2f2e=['cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','id\x20IN\x20?','str','cm_hopper_final','phone\x20IS\x20NOT\x20NULL','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','sequelize','query','VoiceQueueId','onlyIfOpen','BlackLists','all','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','finally','emit','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','info','CmContact','createReadStream','parse','CSV\x20parsed\x20correctly!','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','papaparse','ioredis','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','Missing\x20filepath\x20parameter!','undefined','null','Missing\x20binding\x20parameters!','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','length','map','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','find','duplicate','Duplicate\x20Contact','create','keys','then','push','pick','catch','stringify','checkHopper','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','toString','from'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2f2e,0x176));var _0xe2f2=function(_0x4ca333,_0x1218a3){_0x4ca333=_0x4ca333-0x0;var _0x13b2e1=_0x2f2e[_0x4ca333];return _0x13b2e1;};'use strict';var BPromise=require(_0xe2f2('0x0'));var util=require(_0xe2f2('0x1'));var _=require(_0xe2f2('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require(_0xe2f2('0x3'));var Redis=require(_0xe2f2('0x4'));var db=require('../../../mysqldb')['db'];var config=require(_0xe2f2('0x5'));var logger=require(_0xe2f2('0x6'))(_0xe2f2('0x7'));config[_0xe2f2('0x8')]=_[_0xe2f2('0x9')](config[_0xe2f2('0x8')],{'host':_0xe2f2('0xa'),'port':0x18eb});var socket=require(_0xe2f2('0xb'))(new Redis(config[_0xe2f2('0x8')]));require(_0xe2f2('0xc'))[_0xe2f2('0xd')](socket);try{if(!process[_0xe2f2('0xe')][0x2]||process[_0xe2f2('0xe')][0x2]==='undefined'||process[_0xe2f2('0xe')][0x2]==='null'){throw new Error(_0xe2f2('0xf'));}var FILEPATH=process[_0xe2f2('0xe')][0x2];if(!process[_0xe2f2('0xe')][0x3]||process[_0xe2f2('0xe')][0x3]===_0xe2f2('0x10')||process[_0xe2f2('0xe')][0x3]===_0xe2f2('0x11')||!process[_0xe2f2('0xe')][0x4]||process[_0xe2f2('0xe')][0x4]===_0xe2f2('0x10')||process['argv'][0x4]===_0xe2f2('0x11')){throw new Error(_0xe2f2('0x12'));}var FIELDS=_[_0xe2f2('0x13')](process[_0xe2f2('0xe')][0x3][_0xe2f2('0x14')](','),process[_0xe2f2('0xe')][0x4][_0xe2f2('0x14')](','));if(!process[_0xe2f2('0xe')][0x5]||process[_0xe2f2('0xe')][0x5]===_0xe2f2('0x10')||process[_0xe2f2('0xe')][0x5]===_0xe2f2('0x11')){throw new Error(_0xe2f2('0x15'));}var LISTID=process['argv'][0x5];var COMPANYID=process['argv'][0x6]&&process[_0xe2f2('0xe')][0x6]!=='undefined'&&process[_0xe2f2('0xe')][0x6]!==_0xe2f2('0x11')?process[_0xe2f2('0xe')][0x6]:null;var DUPLICATES=process[_0xe2f2('0xe')][0x7]&&process['argv'][0x7]!==_0xe2f2('0x10')&&process[_0xe2f2('0xe')][0x7]!==_0xe2f2('0x11')?process[_0xe2f2('0xe')][0x7]:null;if(!process[_0xe2f2('0xe')][0x8]||process[_0xe2f2('0xe')][0x8]==='undefined'||process[_0xe2f2('0xe')][0x8]===_0xe2f2('0x11')){throw new Error(_0xe2f2('0x16'));}var SOCKET_TIMESTAMP=process[_0xe2f2('0xe')][0x8];}catch(_0x11ea18){logger[_0xe2f2('0x17')](_0x11ea18);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(_0x128e76,_0x427b7c,_0x189142,_0x44b8c4){var _0x2ff55e={'message':_0x427b7c};_0x2ff55e[_0x128e76]=!![];if(_0x189142){_0x2ff55e['contact']=_0x189142;}if(_0x44b8c4){_0x2ff55e[_0xe2f2('0x18')]=_0x44b8c4;}return _0x2ff55e;}function isEmail(_0x33bea6){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))*$/[_0xe2f2('0x19')](_0x33bea6);}function checkRow(_0x2054f4,_0x2b291a,_0x238905){return new BPromise(function(_0x443344,_0xda63de){if(_[_0xe2f2('0x1a')](_0x2054f4)){return _0xda63de(handleCheckRowError(_0xe2f2('0x17'),_0xe2f2('0x1b'),null,_0x238905));}if(_0x2054f4[_0xe2f2('0x1c')]&&_0x2054f4[_0xe2f2('0x1c')][_0xe2f2('0x1d')]){var _0x3ecd37=_[_0xe2f2('0x1e')](_0x2054f4[_0xe2f2('0x1c')],_0xe2f2('0x1f'))[_0xe2f2('0x20')](';');return _0xda63de(handleCheckRowError('error',_0x3ecd37,null,_0x238905));}var _0x517fe1={};for(var _0x282e33 in FIELDS){if(FIELDS[_0xe2f2('0x21')](_0x282e33)&&FIELDS[_0x282e33]){_0x517fe1[_0x282e33]=_0x2054f4[_0xe2f2('0x22')][0x0][FIELDS[_0x282e33]]||_0x2054f4[_0xe2f2('0x22')][0x0]['\ufeff'+FIELDS[_0x282e33]];}}if(!_0x517fe1[_0xe2f2('0x23')]){return _0xda63de(handleCheckRowError('error',_0xe2f2('0x24'),null,_0x238905));}if(!_0x517fe1[_0xe2f2('0x25')]){return _0xda63de(handleCheckRowError(_0xe2f2('0x17'),_0xe2f2('0x26'),null,_0x238905));}if(_0x517fe1[_0xe2f2('0x27')]){var _0x49f72c=moment(_0x517fe1[_0xe2f2('0x27')],_0xe2f2('0x28'));if(!_0x49f72c['isValid']()){return _0xda63de(handleCheckRowError('error',_0xe2f2('0x29'),null,_0x238905));}}if(_0x517fe1[_0xe2f2('0x2a')]){if(!isEmail(_0x517fe1[_0xe2f2('0x2a')])){return _0xda63de(handleCheckRowError(_0xe2f2('0x17'),_0xe2f2('0x2b'),null,_0x238905));}}_0x517fe1[_0xe2f2('0x2c')]=LISTID;_0x517fe1['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xe2f2('0x1d')]&&_0x2b291a){var _0x2dd4c={};for(var _0x529543=0x0,_0x79705e=DUPLICATES[_0xe2f2('0x1d')];_0x529543<_0x79705e;_0x529543+=0x1){_0x2dd4c[DUPLICATES[_0x529543]]=_0x517fe1[DUPLICATES[_0x529543]];}var _0x544dba=_[_0xe2f2('0x2d')](_0x2b291a,_0x2dd4c);if(_0x544dba){return _0xda63de(handleCheckRowError(_0xe2f2('0x2e'),_0xe2f2('0x2f'),_0x544dba,_0x238905));}}return db['CmContact'][_0xe2f2('0x30')](_0x517fe1,{'raw':!![],'hooks':![],'fields':_[_0xe2f2('0x31')](_0x517fe1)})[_0xe2f2('0x32')](function(_0x1d2973){if(DUPLICATES&&DUPLICATES['length']&&_0x2b291a){_0x2b291a[_0xe2f2('0x33')](_[_0xe2f2('0x34')](_0x517fe1,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x1d2973['id'];return _0x443344();})[_0xe2f2('0x35')](function(_0xd20c69){return _0xda63de(handleCheckRowError('error','Error\x20while\x20creating\x20contact:\x20'+(_0xd20c69[_0xe2f2('0x1f')]||JSON[_0xe2f2('0x36')](_0xd20c69)),null,_0x238905));});});}function checkHopper(){function _0x59fbff(){return function(_0x468770){logger[_0xe2f2('0x17')]('cmContact',_0xe2f2('0x37'),util[_0xe2f2('0x38')](_0x468770,{'showHidden':![],'depth':null}));};}var _0x3b3850=function(_0x153f68,_0x54e11b){var _0x5a546b=squel[_0xe2f2('0x39')]()[_0xe2f2('0x3a')](_0xe2f2('0x3b'))[_0xe2f2('0x3c')]([_0xe2f2('0x25'),_0xe2f2('0x3d'),_0xe2f2('0x3e'),_0xe2f2('0x2c'),_0x54e11b,_0xe2f2('0x3f'),_0xe2f2('0x40')],squel[_0xe2f2('0x41')]()[_0xe2f2('0x42')](_0xe2f2('0x25'),_0xe2f2('0x25'))[_0xe2f2('0x42')](_0xe2f2('0x43'),'scheduledAt')[_0xe2f2('0x42')]('id',_0xe2f2('0x3e'))[_0xe2f2('0x42')](LISTID[_0xe2f2('0x44')](),_0xe2f2('0x2c'))[_0xe2f2('0x42')](_0x153f68['id']['toString'](),_0x54e11b)[_0xe2f2('0x42')](_0xe2f2('0x43'),'createdAt')[_0xe2f2('0x42')](_0xe2f2('0x43'),_0xe2f2('0x40'))[_0xe2f2('0x45')](_0xe2f2('0x46'))[_0xe2f2('0x47')](_0xe2f2('0x48'))['where'](_0xe2f2('0x49'),LISTID[_0xe2f2('0x44')]())[_0xe2f2('0x47')]('phone\x20IS\x20NOT\x20NULL')[_0xe2f2('0x47')](_0xe2f2('0x4a'),squel['select']()['field'](_0xe2f2('0x25'))[_0xe2f2('0x45')]('cm_hopper')[_0xe2f2('0x47')](_0x54e11b+_0xe2f2('0x4b'),_0x153f68['id']['toString']())))[_0xe2f2('0x44')]();return _0x5a546b;};var _0x1c02da=function(_0x2aa55d,_0x2c2e6){var _0x3b15f3=squel[_0xe2f2('0x39')]()[_0xe2f2('0x3a')](_0xe2f2('0x3b'))[_0xe2f2('0x3c')]([_0xe2f2('0x25'),'scheduledAt',_0xe2f2('0x3e'),'ListId',_0x2c2e6,'createdAt','updatedAt'],squel['select']()[_0xe2f2('0x42')]('phone',_0xe2f2('0x25'))[_0xe2f2('0x42')]('NOW()',_0xe2f2('0x3d'))[_0xe2f2('0x42')]('id',_0xe2f2('0x3e'))[_0xe2f2('0x42')](LISTID[_0xe2f2('0x44')](),_0xe2f2('0x2c'))[_0xe2f2('0x42')](_0x2aa55d['id'][_0xe2f2('0x44')](),_0x2c2e6)[_0xe2f2('0x42')]('NOW()',_0xe2f2('0x3f'))[_0xe2f2('0x42')](_0xe2f2('0x43'),_0xe2f2('0x40'))[_0xe2f2('0x45')](_0xe2f2('0x46'))[_0xe2f2('0x47')](_0xe2f2('0x48'))[_0xe2f2('0x47')](_0xe2f2('0x49'),LISTID[_0xe2f2('0x44')]())['where'](_0xe2f2('0x4c'),squel[_0xe2f2('0x4d')](hopperContacts))[_0xe2f2('0x47')]('phone\x20IS\x20NOT\x20NULL')[_0xe2f2('0x47')](_0xe2f2('0x4a'),squel[_0xe2f2('0x41')]()[_0xe2f2('0x42')]('calleridnum')[_0xe2f2('0x45')](_0xe2f2('0x4e'))[_0xe2f2('0x47')](_0x2c2e6+_0xe2f2('0x4b'),_0x2aa55d['id'][_0xe2f2('0x44')]()))[_0xe2f2('0x47')]('phone\x20NOT\x20IN\x20(?)',squel[_0xe2f2('0x41')]()[_0xe2f2('0x42')](_0xe2f2('0x25'))[_0xe2f2('0x45')](_0xe2f2('0x3b'))[_0xe2f2('0x47')](_0x2c2e6+_0xe2f2('0x4b'),_0x2aa55d['id'][_0xe2f2('0x44')]())))[_0xe2f2('0x44')]();return _0x3b15f3;};function _0x41efc0(_0x4e66d2,_0x4441f4){var _0x309ddd=squel[_0xe2f2('0x39')]()[_0xe2f2('0x3a')](_0xe2f2('0x3b'))[_0xe2f2('0x3c')]([_0xe2f2('0x25'),_0xe2f2('0x3d'),'ContactId',_0xe2f2('0x2c'),_0x4441f4,'createdAt',_0xe2f2('0x40')],squel[_0xe2f2('0x41')]()['field']('phone','phone')[_0xe2f2('0x42')](_0xe2f2('0x43'),_0xe2f2('0x3d'))['field']('id',_0xe2f2('0x3e'))[_0xe2f2('0x42')](LISTID[_0xe2f2('0x44')](),'ListId')['field'](_0x4e66d2['id'][_0xe2f2('0x44')](),_0x4441f4)[_0xe2f2('0x42')](_0xe2f2('0x43'),_0xe2f2('0x3f'))['field'](_0xe2f2('0x43'),_0xe2f2('0x40'))[_0xe2f2('0x45')](_0xe2f2('0x46'))['where'](_0xe2f2('0x48'))[_0xe2f2('0x47')](_0xe2f2('0x49'),LISTID[_0xe2f2('0x44')]())[_0xe2f2('0x47')](_0xe2f2('0x4c'),squel[_0xe2f2('0x4d')](hopperContacts))[_0xe2f2('0x47')](_0xe2f2('0x4f')))[_0xe2f2('0x44')]();return _0x309ddd;}function _0x211e7e(_0x461eb7,_0x33af37){var _0x401193=squel[_0xe2f2('0x39')]()[_0xe2f2('0x3a')]('cm_hopper_black')['fromQuery']([_0xe2f2('0x25'),_0xe2f2('0x3e'),'ListId',_0x33af37,'createdAt','updatedAt'],squel['select']()['field'](_0xe2f2('0x25'),_0xe2f2('0x25'))[_0xe2f2('0x42')]('id','ContactId')['field'](LISTID[_0xe2f2('0x44')](),_0xe2f2('0x2c'))[_0xe2f2('0x42')](_0x461eb7['id'][_0xe2f2('0x44')](),_0x33af37)[_0xe2f2('0x42')]('NOW()',_0xe2f2('0x3f'))[_0xe2f2('0x42')]('NOW()','updatedAt')[_0xe2f2('0x45')]('cm_contacts')[_0xe2f2('0x47')](_0xe2f2('0x48'))[_0xe2f2('0x47')]('ListId\x20=\x20?',LISTID[_0xe2f2('0x44')]())[_0xe2f2('0x47')](_0xe2f2('0x4c'),squel[_0xe2f2('0x4d')](hopperContacts))[_0xe2f2('0x47')](_0xe2f2('0x4f')))[_0xe2f2('0x44')]();return _0x401193;}return db[_0xe2f2('0x50')][_0xe2f2('0x51')]({'where':{'type':_0xe2f2('0x52')},'attributes':['id',_0xe2f2('0x53')],'include':[{'model':db[_0xe2f2('0x54')],'as':_0xe2f2('0x55'),'where':{'id':LISTID}}]})[_0xe2f2('0x32')](function(_0x1e4356){var _0x1f7305=[];if(_0x1e4356){var _0x5d8812;for(var _0x466bfb=0x0,_0x403506;_0x466bfb<_0x1e4356['length'];_0x466bfb+=0x1){_0x403506=_0x1e4356[_0x466bfb][_0xe2f2('0x56')]({'plain':!![]});switch(_0x403506['dialCheckDuplicateType']){case _0xe2f2('0x57'):_0x1f7305['push'](db[_0xe2f2('0x58')][_0xe2f2('0x59')](_0x1c02da(_0x403506,_0xe2f2('0x5a')))[_0xe2f2('0x32')](function(){})['catch'](_0x59fbff()));break;case _0xe2f2('0x5b'):_0x1f7305[_0xe2f2('0x33')](db['sequelize'][_0xe2f2('0x59')](_0x3b3850(_0x403506,_0xe2f2('0x5a')))['then'](function(){})[_0xe2f2('0x35')](_0x59fbff()));break;default:_0x1f7305[_0xe2f2('0x33')](db[_0xe2f2('0x58')][_0xe2f2('0x59')](_0x41efc0(_0x403506,_0xe2f2('0x5a')))[_0xe2f2('0x32')](function(){})[_0xe2f2('0x35')](_0x59fbff()));}}}return _0x1f7305;})['all']()[_0xe2f2('0x32')](function(){return db[_0xe2f2('0x50')][_0xe2f2('0x51')]({'where':{'type':_0xe2f2('0x52')},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0xe2f2('0x5c'),'where':{'id':LISTID}}]})[_0xe2f2('0x32')](function(_0x12e658){var _0x53e71c=[];if(_0x12e658){var _0x215cd9;for(var _0x42141d=0x0,_0x1b176b;_0x42141d<_0x12e658[_0xe2f2('0x1d')];_0x42141d+=0x1){_0x1b176b=_0x12e658[_0x42141d][_0xe2f2('0x56')]({'plain':!![]});_0x53e71c[_0xe2f2('0x33')](db['sequelize'][_0xe2f2('0x59')](_0x211e7e(_0x1b176b,_0xe2f2('0x5a')))[_0xe2f2('0x32')](function(){})[_0xe2f2('0x35')](_0x59fbff()));}}return _0x53e71c;})[_0xe2f2('0x5d')]();})['then'](function(){return db['Campaign'][_0xe2f2('0x51')]({'attributes':['id',_0xe2f2('0x53')],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})[_0xe2f2('0x32')](function(_0x2b0ddc){var _0xf202c0=[];if(_0x2b0ddc){for(var _0x2dbd14=0x0,_0x4ca318;_0x2dbd14<_0x2b0ddc[_0xe2f2('0x1d')];_0x2dbd14+=0x1){_0x4ca318=_0x2b0ddc[_0x2dbd14][_0xe2f2('0x56')]({'plain':!![]});switch(_0x4ca318[_0xe2f2('0x53')]){case _0xe2f2('0x57'):_0xf202c0[_0xe2f2('0x33')](db[_0xe2f2('0x58')]['query'](_0x1c02da(_0x4ca318,_0xe2f2('0x5e')))[_0xe2f2('0x32')](function(){})[_0xe2f2('0x35')](_0x59fbff()));break;case _0xe2f2('0x5b'):_0xf202c0[_0xe2f2('0x33')](db[_0xe2f2('0x58')][_0xe2f2('0x59')](_0x3b3850(_0x4ca318,_0xe2f2('0x5e')))['then'](function(){})[_0xe2f2('0x35')](_0x59fbff()));break;default:_0xf202c0[_0xe2f2('0x33')](db[_0xe2f2('0x58')]['query'](_0x41efc0(_0x4ca318,'CampaignId'))[_0xe2f2('0x32')](function(){})[_0xe2f2('0x35')](_0x59fbff()));}}}return _0xf202c0;})[_0xe2f2('0x5d')]();})[_0xe2f2('0x32')](function(){return db['Campaign'][_0xe2f2('0x51')]({'attributes':['id'],'include':[{'model':db[_0xe2f2('0x54')],'as':_0xe2f2('0x5c'),'where':{'id':LISTID}}]})[_0xe2f2('0x32')](function(_0x840d92){var _0x30d571=[];if(_0x840d92){for(var _0x607257=0x0,_0x30919a;_0x607257<_0x840d92[_0xe2f2('0x1d')];_0x607257+=0x1){_0x30919a=_0x840d92[_0x607257][_0xe2f2('0x56')]({'plain':!![]});_0x30d571[_0xe2f2('0x33')](db[_0xe2f2('0x58')][_0xe2f2('0x59')](_0x211e7e(_0x30919a,_0xe2f2('0x5e')))['then'](function(){})[_0xe2f2('0x35')](_0x59fbff()));}}return _0x30d571;})[_0xe2f2('0x5d')]();})[_0xe2f2('0x35')](function(_0xf081dc){logger[_0xe2f2('0x17')](_0xe2f2('0x5f'),_0xe2f2('0x60'),_0xf081dc[_0xe2f2('0x1f')]);});}var processPromises=function(_0x429dc4){return BPromise['all'](promises)[_0xe2f2('0x32')](function(_0x50194e){})[_0xe2f2('0x35')](function(_0x3210ec){logger[_0xe2f2('0x17')]('Error\x20processing\x20rows\x20block:',JSON[_0xe2f2('0x36')](_0x3210ec));})[_0xe2f2('0x61')](function(){socket[_0xe2f2('0x62')](_0xe2f2('0x63')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x429dc4){return _0x429dc4[_0xe2f2('0x64')]();}});};var endCsv=function(){return BPromise[_0xe2f2('0x65')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0xe2f2('0x32')](function(){socket[_0xe2f2('0x62')](_0xe2f2('0x63')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xe2f2('0x66')](FILEPATH);}catch(_0x40faf6){logger['error'](_0xe2f2('0x67'),JSON[_0xe2f2('0x36')](_0x40faf6));}finally{process['exit'](0x0);}});};process['on'](_0xe2f2('0x68'),function(){logger[_0xe2f2('0x69')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0xe2f2('0x65')]()[_0xe2f2('0x32')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xe2f2('0x14')](',');return db[_0xe2f2('0x6a')][_0xe2f2('0x51')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xe2f2('0x32')](function(_0x94bec5){var _0x50129e=fs[_0xe2f2('0x6b')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xe2f2('0x6c')](_0x50129e,{'header':!![],'skipEmptyLines':!![],'step':function(_0x2e33d1,_0x28558e){total+=0x1;var _0x5911b2=total;promises[_0xe2f2('0x33')](checkRow(_0x2e33d1,_0x94bec5,_0x5911b2)[_0xe2f2('0x32')](function(){success+=0x1;})[_0xe2f2('0x35')](function(_0x118ae0){if(_0x118ae0[_0xe2f2('0x17')]){errors+=0x1;delete _0x118ae0[_0xe2f2('0x17')];}else if(_0x118ae0[_0xe2f2('0x2e')]){duplicates+=0x1;delete _0x118ae0[_0xe2f2('0x2e')];}rows[_0xe2f2('0x33')](_0x118ae0);}));if(total%0xc8===0x0){_0x28558e['pause']();return processPromises(_0x28558e);}},'complete':function(){return processPromises()['then'](function(){logger[_0xe2f2('0x69')](_0xe2f2('0x6d'));endCsv();});},'error':function(_0x17473c,_0xaf7e61){logger[_0xe2f2('0x69')]('CSV\x20parse\x20error',JSON[_0xe2f2('0x36')](_0x17473c));endCsv();}});})[_0xe2f2('0x35')](function(_0x5adc2a){logger[_0xe2f2('0x17')](_0xe2f2('0x6e'),JSON['stringify'](_0x5adc2a));});}main(); \ No newline at end of file +var _0xa3a2=['Lists','then','get','always','sequelize','query','VoiceQueueId','onlyIfOpen','VoiceQueue','CmList','all','CampaignId','Campaign','BlackLists','generalCheckHopper','stringify','finally','emit','resume','resolve','contact:csv_','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','info','CSV\x20import\x20process\x20stopped!','createReadStream','pause','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','papaparse','ioredis','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','test','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','message','join','hasOwnProperty','data','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','duplicate','Duplicate\x20Contact','CmContact','create','keys','push','pick','catch','cmContact','checkHopper','inspect','insert','into','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','toString','cm_contacts','where','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','from','cm_hopper','\x20=\x20?','id\x20IN\x20?','str','calleridnum','cm_hopper_final','fromQuery','deletedAt\x20IS\x20NULL','cm_hopper_black','findAll','outbound','dialCheckDuplicateType'];(function(_0x3e5f6d,_0x121db6){var _0x1bea6e=function(_0x435c7c){while(--_0x435c7c){_0x3e5f6d['push'](_0x3e5f6d['shift']());}};_0x1bea6e(++_0x121db6);}(_0xa3a2,0x8e));var _0x2a3a=function(_0x44a573,_0x1e6efc){_0x44a573=_0x44a573-0x0;var _0x4babc6=_0xa3a2[_0x44a573];return _0x4babc6;};'use strict';var BPromise=require(_0x2a3a('0x0'));var util=require(_0x2a3a('0x1'));var _=require(_0x2a3a('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require(_0x2a3a('0x3'));var Redis=require(_0x2a3a('0x4'));var db=require('../../../mysqldb')['db'];var config=require(_0x2a3a('0x5'));var logger=require(_0x2a3a('0x6'))(_0x2a3a('0x7'));config[_0x2a3a('0x8')]=_[_0x2a3a('0x9')](config[_0x2a3a('0x8')],{'host':_0x2a3a('0xa'),'port':0x18eb});var socket=require(_0x2a3a('0xb'))(new Redis(config[_0x2a3a('0x8')]));require(_0x2a3a('0xc'))[_0x2a3a('0xd')](socket);try{if(!process[_0x2a3a('0xe')][0x2]||process['argv'][0x2]===_0x2a3a('0xf')||process['argv'][0x2]===_0x2a3a('0x10')){throw new Error(_0x2a3a('0x11'));}var FILEPATH=process[_0x2a3a('0xe')][0x2];if(!process[_0x2a3a('0xe')][0x3]||process[_0x2a3a('0xe')][0x3]===_0x2a3a('0xf')||process[_0x2a3a('0xe')][0x3]===_0x2a3a('0x10')||!process[_0x2a3a('0xe')][0x4]||process['argv'][0x4]===_0x2a3a('0xf')||process[_0x2a3a('0xe')][0x4]===_0x2a3a('0x10')){throw new Error(_0x2a3a('0x12'));}var FIELDS=_[_0x2a3a('0x13')](process[_0x2a3a('0xe')][0x3][_0x2a3a('0x14')](','),process[_0x2a3a('0xe')][0x4][_0x2a3a('0x14')](','));if(!process[_0x2a3a('0xe')][0x5]||process[_0x2a3a('0xe')][0x5]===_0x2a3a('0xf')||process[_0x2a3a('0xe')][0x5]===_0x2a3a('0x10')){throw new Error(_0x2a3a('0x15'));}var LISTID=process[_0x2a3a('0xe')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x2a3a('0xe')][0x6]!==_0x2a3a('0xf')&&process[_0x2a3a('0xe')][0x6]!==_0x2a3a('0x10')?process[_0x2a3a('0xe')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x2a3a('0xe')][0x7]!==_0x2a3a('0xf')&&process[_0x2a3a('0xe')][0x7]!==_0x2a3a('0x10')?process[_0x2a3a('0xe')][0x7]:null;if(!process[_0x2a3a('0xe')][0x8]||process[_0x2a3a('0xe')][0x8]===_0x2a3a('0xf')||process[_0x2a3a('0xe')][0x8]===_0x2a3a('0x10')){throw new Error(_0x2a3a('0x16'));}var SOCKET_TIMESTAMP=process[_0x2a3a('0xe')][0x8];}catch(_0x3a73b6){logger[_0x2a3a('0x17')](_0x3a73b6);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(_0x122582,_0x4166a8,_0x226760,_0x3c5750){var _0x3d1bea={'message':_0x4166a8};_0x3d1bea[_0x122582]=!![];if(_0x226760){_0x3d1bea[_0x2a3a('0x18')]=_0x226760;}if(_0x3c5750){_0x3d1bea['index']=_0x3c5750;}return _0x3d1bea;}function isEmail(_0x1b4f68){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))*$/[_0x2a3a('0x19')](_0x1b4f68);}function checkRow(_0x77532d,_0x42cad6,_0x49716d){return new BPromise(function(_0x54865c,_0x545745){if(_['isNil'](_0x77532d)){return _0x545745(handleCheckRowError(_0x2a3a('0x17'),_0x2a3a('0x1a'),null,_0x49716d));}if(_0x77532d[_0x2a3a('0x1b')]&&_0x77532d['errors'][_0x2a3a('0x1c')]){var _0x1e6028=_['map'](_0x77532d[_0x2a3a('0x1b')],_0x2a3a('0x1d'))[_0x2a3a('0x1e')](';');return _0x545745(handleCheckRowError(_0x2a3a('0x17'),_0x1e6028,null,_0x49716d));}var _0x42a570={};for(var _0x4ed7af in FIELDS){if(FIELDS[_0x2a3a('0x1f')](_0x4ed7af)&&FIELDS[_0x4ed7af]){_0x42a570[_0x4ed7af]=_0x77532d['data'][0x0][FIELDS[_0x4ed7af]]||_0x77532d[_0x2a3a('0x20')][0x0]['\ufeff'+FIELDS[_0x4ed7af]];}}if(!_0x42a570['firstName']){return _0x545745(handleCheckRowError(_0x2a3a('0x17'),_0x2a3a('0x21'),null,_0x49716d));}if(!_0x42a570[_0x2a3a('0x22')]){return _0x545745(handleCheckRowError(_0x2a3a('0x17'),_0x2a3a('0x23'),null,_0x49716d));}if(_0x42a570['birthDate']){var _0x3da0ec=moment(_0x42a570[_0x2a3a('0x24')],_0x2a3a('0x25'));if(!_0x3da0ec[_0x2a3a('0x26')]()){return _0x545745(handleCheckRowError(_0x2a3a('0x17'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x49716d));}}if(_0x42a570[_0x2a3a('0x27')]){if(!isEmail(_0x42a570['email'])){return _0x545745(handleCheckRowError(_0x2a3a('0x17'),_0x2a3a('0x28'),null,_0x49716d));}}_0x42a570[_0x2a3a('0x29')]=LISTID;_0x42a570[_0x2a3a('0x2a')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x42cad6){var _0x1c9a03={};for(var _0x5ec178=0x0,_0x533b69=DUPLICATES[_0x2a3a('0x1c')];_0x5ec178<_0x533b69;_0x5ec178+=0x1){_0x1c9a03[DUPLICATES[_0x5ec178]]=_0x42a570[DUPLICATES[_0x5ec178]];}var _0x91b6d5=_['find'](_0x42cad6,_0x1c9a03);if(_0x91b6d5){return _0x545745(handleCheckRowError(_0x2a3a('0x2b'),_0x2a3a('0x2c'),_0x91b6d5,_0x49716d));}}return db[_0x2a3a('0x2d')][_0x2a3a('0x2e')](_0x42a570,{'raw':!![],'hooks':![],'fields':_[_0x2a3a('0x2f')](_0x42a570)})['then'](function(_0x3b83ad){if(DUPLICATES&&DUPLICATES[_0x2a3a('0x1c')]&&_0x42cad6){_0x42cad6[_0x2a3a('0x30')](_[_0x2a3a('0x31')](_0x42a570,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x3b83ad['id'];return _0x54865c();})[_0x2a3a('0x32')](function(_0x39ae94){return _0x545745(handleCheckRowError('error','Error\x20while\x20creating\x20contact:\x20'+(_0x39ae94[_0x2a3a('0x1d')]||JSON['stringify'](_0x39ae94)),null,_0x49716d));});});}function checkHopper(){function _0x58b77f(){return function(_0x1ce787){logger[_0x2a3a('0x17')](_0x2a3a('0x33'),_0x2a3a('0x34'),util[_0x2a3a('0x35')](_0x1ce787,{'showHidden':![],'depth':null}));};}var _0x2b407b=function(_0x84895d,_0x1b2acc){var _0x4c9a01=squel[_0x2a3a('0x36')]()[_0x2a3a('0x37')]('cm_hopper')['fromQuery']([_0x2a3a('0x22'),_0x2a3a('0x38'),_0x2a3a('0x39'),'ListId',_0x1b2acc,_0x2a3a('0x3a'),_0x2a3a('0x3b')],squel[_0x2a3a('0x3c')]()[_0x2a3a('0x3d')](_0x2a3a('0x22'),_0x2a3a('0x22'))[_0x2a3a('0x3d')](_0x2a3a('0x3e'),_0x2a3a('0x38'))[_0x2a3a('0x3d')]('id',_0x2a3a('0x39'))[_0x2a3a('0x3d')](LISTID[_0x2a3a('0x3f')](),_0x2a3a('0x29'))['field'](_0x84895d['id'][_0x2a3a('0x3f')](),_0x1b2acc)[_0x2a3a('0x3d')](_0x2a3a('0x3e'),_0x2a3a('0x3a'))[_0x2a3a('0x3d')]('NOW()',_0x2a3a('0x3b'))['from'](_0x2a3a('0x40'))[_0x2a3a('0x41')]('deletedAt\x20IS\x20NULL')[_0x2a3a('0x41')](_0x2a3a('0x42'),LISTID[_0x2a3a('0x3f')]())[_0x2a3a('0x41')](_0x2a3a('0x43'))[_0x2a3a('0x41')](_0x2a3a('0x44'),squel['select']()[_0x2a3a('0x3d')](_0x2a3a('0x22'))[_0x2a3a('0x45')](_0x2a3a('0x46'))[_0x2a3a('0x41')](_0x1b2acc+_0x2a3a('0x47'),_0x84895d['id'][_0x2a3a('0x3f')]())))[_0x2a3a('0x3f')]();return _0x4c9a01;};var _0x3d1ab5=function(_0x4e2008,_0x21ab15){var _0x2fb921=squel[_0x2a3a('0x36')]()[_0x2a3a('0x37')]('cm_hopper')['fromQuery']([_0x2a3a('0x22'),_0x2a3a('0x38'),_0x2a3a('0x39'),_0x2a3a('0x29'),_0x21ab15,_0x2a3a('0x3a'),'updatedAt'],squel[_0x2a3a('0x3c')]()['field'](_0x2a3a('0x22'),_0x2a3a('0x22'))[_0x2a3a('0x3d')]('NOW()',_0x2a3a('0x38'))[_0x2a3a('0x3d')]('id','ContactId')['field'](LISTID[_0x2a3a('0x3f')](),_0x2a3a('0x29'))[_0x2a3a('0x3d')](_0x4e2008['id']['toString'](),_0x21ab15)['field']('NOW()',_0x2a3a('0x3a'))['field'](_0x2a3a('0x3e'),'updatedAt')[_0x2a3a('0x45')](_0x2a3a('0x40'))[_0x2a3a('0x41')]('deletedAt\x20IS\x20NULL')[_0x2a3a('0x41')](_0x2a3a('0x42'),LISTID[_0x2a3a('0x3f')]())['where'](_0x2a3a('0x48'),squel[_0x2a3a('0x49')](hopperContacts))['where'](_0x2a3a('0x43'))[_0x2a3a('0x41')]('phone\x20NOT\x20IN\x20(?)',squel[_0x2a3a('0x3c')]()[_0x2a3a('0x3d')](_0x2a3a('0x4a'))[_0x2a3a('0x45')](_0x2a3a('0x4b'))[_0x2a3a('0x41')](_0x21ab15+_0x2a3a('0x47'),_0x4e2008['id'][_0x2a3a('0x3f')]()))['where'](_0x2a3a('0x44'),squel[_0x2a3a('0x3c')]()[_0x2a3a('0x3d')]('phone')[_0x2a3a('0x45')](_0x2a3a('0x46'))[_0x2a3a('0x41')](_0x21ab15+_0x2a3a('0x47'),_0x4e2008['id'][_0x2a3a('0x3f')]())))[_0x2a3a('0x3f')]();return _0x2fb921;};function _0x205b59(_0xb07b4e,_0x33d204){var _0x2e9be0=squel[_0x2a3a('0x36')]()['into']('cm_hopper')[_0x2a3a('0x4c')]([_0x2a3a('0x22'),_0x2a3a('0x38'),_0x2a3a('0x39'),_0x2a3a('0x29'),_0x33d204,_0x2a3a('0x3a'),_0x2a3a('0x3b')],squel[_0x2a3a('0x3c')]()[_0x2a3a('0x3d')](_0x2a3a('0x22'),'phone')[_0x2a3a('0x3d')]('NOW()','scheduledAt')[_0x2a3a('0x3d')]('id',_0x2a3a('0x39'))[_0x2a3a('0x3d')](LISTID['toString'](),_0x2a3a('0x29'))[_0x2a3a('0x3d')](_0xb07b4e['id'][_0x2a3a('0x3f')](),_0x33d204)[_0x2a3a('0x3d')](_0x2a3a('0x3e'),_0x2a3a('0x3a'))[_0x2a3a('0x3d')]('NOW()','updatedAt')[_0x2a3a('0x45')]('cm_contacts')[_0x2a3a('0x41')](_0x2a3a('0x4d'))[_0x2a3a('0x41')](_0x2a3a('0x42'),LISTID[_0x2a3a('0x3f')]())[_0x2a3a('0x41')](_0x2a3a('0x48'),squel[_0x2a3a('0x49')](hopperContacts))[_0x2a3a('0x41')](_0x2a3a('0x43')))[_0x2a3a('0x3f')]();return _0x2e9be0;}function _0x4069c7(_0x26dc88,_0x15640f){var _0x280f92=squel[_0x2a3a('0x36')]()[_0x2a3a('0x37')](_0x2a3a('0x4e'))[_0x2a3a('0x4c')]([_0x2a3a('0x22'),_0x2a3a('0x39'),_0x2a3a('0x29'),_0x15640f,_0x2a3a('0x3a'),_0x2a3a('0x3b')],squel[_0x2a3a('0x3c')]()[_0x2a3a('0x3d')](_0x2a3a('0x22'),_0x2a3a('0x22'))[_0x2a3a('0x3d')]('id',_0x2a3a('0x39'))[_0x2a3a('0x3d')](LISTID[_0x2a3a('0x3f')](),'ListId')[_0x2a3a('0x3d')](_0x26dc88['id'][_0x2a3a('0x3f')](),_0x15640f)[_0x2a3a('0x3d')](_0x2a3a('0x3e'),'createdAt')[_0x2a3a('0x3d')]('NOW()',_0x2a3a('0x3b'))[_0x2a3a('0x45')](_0x2a3a('0x40'))[_0x2a3a('0x41')]('deletedAt\x20IS\x20NULL')[_0x2a3a('0x41')](_0x2a3a('0x42'),LISTID[_0x2a3a('0x3f')]())[_0x2a3a('0x41')](_0x2a3a('0x48'),squel[_0x2a3a('0x49')](hopperContacts))['where'](_0x2a3a('0x43')))[_0x2a3a('0x3f')]();return _0x280f92;}return db['VoiceQueue'][_0x2a3a('0x4f')]({'where':{'type':_0x2a3a('0x50')},'attributes':['id',_0x2a3a('0x51')],'include':[{'model':db['CmList'],'as':_0x2a3a('0x52'),'where':{'id':LISTID}}]})[_0x2a3a('0x53')](function(_0x53a706){var _0x4a01ba=[];if(_0x53a706){var _0x533b6a;for(var _0x5d6a88=0x0,_0x265eaa;_0x5d6a88<_0x53a706['length'];_0x5d6a88+=0x1){_0x265eaa=_0x53a706[_0x5d6a88][_0x2a3a('0x54')]({'plain':!![]});switch(_0x265eaa[_0x2a3a('0x51')]){case _0x2a3a('0x55'):_0x4a01ba[_0x2a3a('0x30')](db[_0x2a3a('0x56')][_0x2a3a('0x57')](_0x3d1ab5(_0x265eaa,_0x2a3a('0x58')))['then'](function(){})['catch'](_0x58b77f()));break;case _0x2a3a('0x59'):_0x4a01ba[_0x2a3a('0x30')](db[_0x2a3a('0x56')][_0x2a3a('0x57')](_0x2b407b(_0x265eaa,'VoiceQueueId'))[_0x2a3a('0x53')](function(){})[_0x2a3a('0x32')](_0x58b77f()));break;default:_0x4a01ba['push'](db['sequelize'][_0x2a3a('0x57')](_0x205b59(_0x265eaa,_0x2a3a('0x58')))[_0x2a3a('0x53')](function(){})['catch'](_0x58b77f()));}}}return _0x4a01ba;})['all']()[_0x2a3a('0x53')](function(){return db[_0x2a3a('0x5a')][_0x2a3a('0x4f')]({'where':{'type':_0x2a3a('0x50')},'attributes':['id'],'include':[{'model':db[_0x2a3a('0x5b')],'as':'BlackLists','where':{'id':LISTID}}]})['then'](function(_0xe25c28){var _0x2d7cf4=[];if(_0xe25c28){var _0x44d9e7;for(var _0x1f0ca1=0x0,_0x4f07c7;_0x1f0ca1<_0xe25c28[_0x2a3a('0x1c')];_0x1f0ca1+=0x1){_0x4f07c7=_0xe25c28[_0x1f0ca1]['get']({'plain':!![]});_0x2d7cf4[_0x2a3a('0x30')](db[_0x2a3a('0x56')][_0x2a3a('0x57')](_0x4069c7(_0x4f07c7,_0x2a3a('0x58')))[_0x2a3a('0x53')](function(){})[_0x2a3a('0x32')](_0x58b77f()));}}return _0x2d7cf4;})[_0x2a3a('0x5c')]();})[_0x2a3a('0x53')](function(){return db['Campaign'][_0x2a3a('0x4f')]({'attributes':['id',_0x2a3a('0x51')],'include':[{'model':db[_0x2a3a('0x5b')],'as':_0x2a3a('0x52'),'where':{'id':LISTID}}]})['then'](function(_0x51196c){var _0x58f38e=[];if(_0x51196c){for(var _0x279309=0x0,_0x52fdf4;_0x279309<_0x51196c[_0x2a3a('0x1c')];_0x279309+=0x1){_0x52fdf4=_0x51196c[_0x279309]['get']({'plain':!![]});switch(_0x52fdf4[_0x2a3a('0x51')]){case _0x2a3a('0x55'):_0x58f38e['push'](db[_0x2a3a('0x56')]['query'](_0x3d1ab5(_0x52fdf4,'CampaignId'))['then'](function(){})['catch'](_0x58b77f()));break;case'onlyIfOpen':_0x58f38e[_0x2a3a('0x30')](db[_0x2a3a('0x56')]['query'](_0x2b407b(_0x52fdf4,'CampaignId'))['then'](function(){})['catch'](_0x58b77f()));break;default:_0x58f38e[_0x2a3a('0x30')](db[_0x2a3a('0x56')][_0x2a3a('0x57')](_0x205b59(_0x52fdf4,_0x2a3a('0x5d')))[_0x2a3a('0x53')](function(){})[_0x2a3a('0x32')](_0x58b77f()));}}}return _0x58f38e;})[_0x2a3a('0x5c')]();})['then'](function(){return db[_0x2a3a('0x5e')][_0x2a3a('0x4f')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x2a3a('0x5f'),'where':{'id':LISTID}}]})['then'](function(_0x1ae44e){var _0x16913f=[];if(_0x1ae44e){for(var _0x125acf=0x0,_0x55e594;_0x125acf<_0x1ae44e[_0x2a3a('0x1c')];_0x125acf+=0x1){_0x55e594=_0x1ae44e[_0x125acf][_0x2a3a('0x54')]({'plain':!![]});_0x16913f[_0x2a3a('0x30')](db[_0x2a3a('0x56')][_0x2a3a('0x57')](_0x4069c7(_0x55e594,_0x2a3a('0x5d')))['then'](function(){})[_0x2a3a('0x32')](_0x58b77f()));}}return _0x16913f;})['all']();})['catch'](function(_0x12e666){logger[_0x2a3a('0x17')]('cmContact,\x20%s,\x20%s',_0x2a3a('0x60'),_0x12e666[_0x2a3a('0x1d')]);});}var processPromises=function(_0x5dc7b6){return BPromise[_0x2a3a('0x5c')](promises)[_0x2a3a('0x53')](function(_0x41245e){})[_0x2a3a('0x32')](function(_0x141239){logger[_0x2a3a('0x17')]('Error\x20processing\x20rows\x20block:',JSON[_0x2a3a('0x61')](_0x141239));})[_0x2a3a('0x62')](function(){socket[_0x2a3a('0x63')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x5dc7b6){return _0x5dc7b6[_0x2a3a('0x64')]();}});};var endCsv=function(){return BPromise[_0x2a3a('0x65')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x2a3a('0x53')](function(){socket[_0x2a3a('0x63')](_0x2a3a('0x66')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x2a3a('0x67')](FILEPATH);}catch(_0x57b95c){logger[_0x2a3a('0x17')](_0x2a3a('0x68'),JSON[_0x2a3a('0x61')](_0x57b95c));}finally{process['exit'](0x0);}});};process['on'](_0x2a3a('0x69'),function(){logger[_0x2a3a('0x6a')](_0x2a3a('0x6b'));endCsv();});function main(){return BPromise[_0x2a3a('0x65')]()[_0x2a3a('0x53')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db['CmContact'][_0x2a3a('0x4f')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x478a64){var _0x2ebf3b=fs[_0x2a3a('0x6c')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x2ebf3b,{'header':!![],'skipEmptyLines':!![],'step':function(_0x26faa7,_0xb363cd){total+=0x1;var _0x5be5ba=total;promises['push'](checkRow(_0x26faa7,_0x478a64,_0x5be5ba)[_0x2a3a('0x53')](function(){success+=0x1;})['catch'](function(_0x210846){if(_0x210846[_0x2a3a('0x17')]){errors+=0x1;delete _0x210846[_0x2a3a('0x17')];}else if(_0x210846[_0x2a3a('0x2b')]){duplicates+=0x1;delete _0x210846[_0x2a3a('0x2b')];}rows['push'](_0x210846);}));if(total%0xc8===0x0){_0xb363cd[_0x2a3a('0x6d')]();return processPromises(_0xb363cd);}},'complete':function(){return processPromises()[_0x2a3a('0x53')](function(){logger[_0x2a3a('0x6a')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x278d10,_0x14a693){logger[_0x2a3a('0x6a')](_0x2a3a('0x6e'),JSON[_0x2a3a('0x61')](_0x278d10));endCsv();}});})[_0x2a3a('0x32')](function(_0x41cf6e){logger['error'](_0x2a3a('0x6f'),JSON[_0x2a3a('0x61')](_0x41cf6e));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index cce6533..05e7a71 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 _0x3eab=['ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','parse','SIGINT','uncaughtException','path','lodash','papaparse','squel','../../../mysqldb','../../../config/environment','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','insert','into','cm_hopper','scheduledat','ContactId','updatedAt','priority','UserId','recallme','fields','.CmListId','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','cm_hopper_black','createdAt','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','field','ListId\x20=\x20?','\x20=\x20?','toString','keys','ListId','CompanyId','fromQuery',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','min_id','group','info','error','message','errors','push','spread','catch','stringify','send','start','binding','socket_timestamp','root','server/files/tmp','.csv','header','writeFileSync','createReadStream','length','rows','data','hasOwnProperty','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','appendFileSync','emit','contact:import:','abort','step','duplicates','cm_contacts_','\x20LIKE\x20cm_contacts;','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','isNil',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','campaigns','CampaignId','each','affectedRows','unlink','exit','complete','argv','existsSync','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName'];(function(_0x5dcef8,_0x287810){var _0x206b84=function(_0x92315a){while(--_0x92315a){_0x5dcef8['push'](_0x5dcef8['shift']());}};_0x206b84(++_0x287810);}(_0x3eab,0x102));var _0xb3ea=function(_0x5a7eb1,_0x2c7a23){_0x5a7eb1=_0x5a7eb1-0x0;var _0x2bce3c=_0x3eab[_0x5a7eb1];return _0x2bce3c;};'use strict';var fs=require('fs');var path=require(_0xb3ea('0x0'));var _=require(_0xb3ea('0x1'));var Papa=require(_0xb3ea('0x2'));var util=require('util');var BPromise=require('bluebird');var moment=require('moment');var squel=require(_0xb3ea('0x3'));var Redis=require('ioredis');var db=require(_0xb3ea('0x4'))['db'];var config=require(_0xb3ea('0x5'));var logger=require('../../../config/logger')('import');config[_0xb3ea('0x6')]=_[_0xb3ea('0x7')](config[_0xb3ea('0x6')],{'host':_0xb3ea('0x8'),'port':0x18eb});var socket=require(_0xb3ea('0x9'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0xb3ea('0xa')](_0xb3ea('0xb'));function isEmail(_0x55beaf){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))*$/[_0xb3ea('0xc')](_0x55beaf);}function selectNotIn(_0x260c33,_0x5d50ba,_0x42a140,_0x500980,_0x300f14){return squel[_0xb3ea('0xd')]()['field'](_0xb3ea('0xe'))[_0xb3ea('0xf')](_0x500980)[_0xb3ea('0x10')](_0x5d50ba,null,_0x5d50ba+_0xb3ea('0x11')+_0x500980+'.'+_0x42a140)[_0xb3ea('0x12')](_0x500980+'.'+_0x42a140+_0xb3ea('0x13')+_0x260c33+'.'+_0x42a140)['where'](_0x5d50ba+_0xb3ea('0x14')+_0x300f14['join']()+')');}function insertCmHopper(_0x485493,_0x14e36c,_0x546232,_0x2fed59,_0xd5f286){var _0x5b74d8=[_0xb3ea('0x15'),'cm_contacts.scheduledat',_0xb3ea('0x16'),_0xb3ea('0x17'),_0x14e36c+'.'+_0x2fed59,_0xb3ea('0x18'),_0xb3ea('0x19'),'cm_contacts.priority',_0xb3ea('0x1a'),'\x22'+_0xd5f286+'\x22'];return squel[_0xb3ea('0x1b')]()[_0xb3ea('0x1c')](_0xb3ea('0x1d'))['fromQuery'](['phone',_0xb3ea('0x1e'),_0xb3ea('0x1f'),'ListId',_0x2fed59,'createdAt',_0xb3ea('0x20'),_0xb3ea('0x21'),_0xb3ea('0x22'),_0xb3ea('0x23')],squel[_0xb3ea('0xd')]()[_0xb3ea('0x24')](_0x5b74d8)[_0xb3ea('0xf')](_0x14e36c)[_0xb3ea('0x10')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x14e36c+_0xb3ea('0x25'))[_0xb3ea('0x10')](_0x546232,null,_0x546232+_0xb3ea('0x11')+_0x14e36c+'.'+_0x2fed59)['where'](_0x14e36c+'.CmListId\x20=\x20?',_0x485493)[_0xb3ea('0x12')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xb3ea('0x12')](_0xb3ea('0x26'),selectNotIn(_0x14e36c,_0x546232,_0x2fed59,_0xb3ea('0x1d'),['\x22always\x22','\x22onlyIfOpen\x22']))[_0xb3ea('0x12')](_0xb3ea('0x26'),selectNotIn(_0x14e36c,_0x546232,_0x2fed59,_0xb3ea('0x1d'),[_0xb3ea('0x27')])))['toString']();}function insertCmHopperBlack(_0xc89e43,_0x497a4d,_0x505ab9,_0x1bbdf5){var _0x302e08=[_0xb3ea('0x15'),_0xb3ea('0x16'),_0xb3ea('0x17'),_0x497a4d+'.'+_0x1bbdf5,_0xb3ea('0x18'),_0xb3ea('0x19')];return squel[_0xb3ea('0x1b')]()[_0xb3ea('0x1c')](_0xb3ea('0x28'))['fromQuery']([_0xb3ea('0xe'),_0xb3ea('0x1f'),'ListId',_0x1bbdf5,_0xb3ea('0x29'),'updatedAt'],squel[_0xb3ea('0xd')]()['fields'](_0x302e08)[_0xb3ea('0xf')](_0x497a4d)['join'](_0xb3ea('0x2a'),null,_0xb3ea('0x2b')+_0x497a4d+_0xb3ea('0x25'))[_0xb3ea('0x10')](_0x505ab9,null,_0x505ab9+_0xb3ea('0x11')+_0x497a4d+'.'+_0x1bbdf5)[_0xb3ea('0x12')](_0x497a4d+_0xb3ea('0x2c'),_0xc89e43)['where'](_0xb3ea('0x2d'),NOW)[_0xb3ea('0x12')](_0xb3ea('0x26'),squel[_0xb3ea('0xd')]()[_0xb3ea('0x2e')](_0xb3ea('0xe'))[_0xb3ea('0xf')](_0xb3ea('0x28'))['where'](_0xb3ea('0x2f'),_0xc89e43)[_0xb3ea('0x12')](_0x1bbdf5+_0xb3ea('0x30'),_0x497a4d+'.'+_0x1bbdf5)))[_0xb3ea('0x31')]();}function insertCmContact(_0x2119d4,_0xe2d6ff,_0x3bd14f,_0x4cdd8e){var _0x4aabb5=_['concat'](_[_0xb3ea('0x32')](_0x4cdd8e),[_0xb3ea('0x33'),_0xb3ea('0x34'),_0xb3ea('0x29'),_0xb3ea('0x20')]);return squel['insert']()['into']('cm_contacts')[_0xb3ea('0x35')](_0x4aabb5,squel[_0xb3ea('0xd')]()[_0xb3ea('0x24')](_0x4aabb5)[_0xb3ea('0xf')](_0xe2d6ff)['where']('('+_0x3bd14f[_0xb3ea('0x10')](',')+_0xb3ea('0x36'),squel[_0xb3ea('0xd')]()[_0xb3ea('0x24')](_0x3bd14f)[_0xb3ea('0xf')]('cm_contacts')[_0xb3ea('0x12')]('ListId\x20=\x20?',_0x2119d4)[_0xb3ea('0x12')](_0xb3ea('0x37')))[_0xb3ea('0x12')](_0xb3ea('0x38'),squel[_0xb3ea('0xd')]()['field']('MIN(id)',_0xb3ea('0x39'))['from'](_0xe2d6ff)[_0xb3ea('0x3a')](_0x3bd14f[_0xb3ea('0x10')](','))))[_0xb3ea('0x31')]();}function handleStop(){logger[_0xb3ea('0x3b')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x3361d8){logger[_0xb3ea('0x3c')](_0x3361d8[_0xb3ea('0x3d')]);process['exit'](0x1);}function handleError(_0x45a3ae,_0x192aca){stats[_0xb3ea('0x3e')][_0xb3ea('0x3f')]({'name':_0x192aca['code'],'message':_0x192aca[_0xb3ea('0x3d')],'row':_0x45a3ae});}function handleQuery(_0x34d7e5){logger[_0xb3ea('0x3b')](_0x34d7e5);return db['sequelize']['query'](_0x34d7e5)[_0xb3ea('0x40')](function(_0xbf96a){results[_0xb3ea('0x3f')](_0xbf96a);})[_0xb3ea('0x41')](function(_0x5557ec){logger[_0xb3ea('0x3c')](_0x5557ec[_0xb3ea('0x3d')]);});}function main(_0x284c51,_0x49151c,_0x18ce86,_0x59dc2d){logger['info']('main',_0x284c51,JSON[_0xb3ea('0x42')](_0x49151c));process[_0xb3ea('0x43')](_0xb3ea('0x44'));var _0x423aed=_0x49151c[_0xb3ea('0x45')];var _0x4e86a5=_0x49151c[_0xb3ea('0x46')];var _0x205d84=path['join'](config[_0xb3ea('0x47')],_0xb3ea('0x48'),_0x4e86a5+_0xb3ea('0x49'));var _0x57d32a=_['keys'](_0x423aed)[_0xb3ea('0x10')]();logger[_0xb3ea('0x3b')](_0xb3ea('0x4a'),_0x57d32a);fs[_0xb3ea('0x4b')](_0x205d84,_0x57d32a+'\x0a');Papa['parse'](fs[_0xb3ea('0x4c')](_0x284c51),{'header':!![],'skipEmptyLines':!![],'step':function(_0x576c1a,_0x278269){try{for(var _0x3b4aec=0x0,_0x17cf2f=[];_0x3b4aec<_0x576c1a['data'][_0xb3ea('0x4d')];_0x3b4aec++){stats[_0xb3ea('0x4e')]+=0x1;if(_0x576c1a['errors'][_0x3b4aec]){handleError(_0x576c1a[_0xb3ea('0x4f')][_0x3b4aec],_0x576c1a['errors'][_0x3b4aec]);}else{var _0x5d0ea5=[];for(var _0x506cc4 in _0x423aed){if(_0x423aed[_0xb3ea('0x50')](_0x506cc4)){if(_0x576c1a[_0xb3ea('0x4f')][_0x3b4aec][_0x423aed[_0x506cc4]]){var _0x10dfc=_['trim'](_0x576c1a[_0xb3ea('0x4f')][_0x3b4aec][_0x423aed[_0x506cc4]][_0xb3ea('0x51')](/"/g,'\x27'));switch(_0x506cc4){case _0xb3ea('0x1e'):var _0x25431e=moment(_0x10dfc,_0xb3ea('0xb'),!![]);if(_0x25431e[_0xb3ea('0x52')]()){_0x17cf2f[_0xb3ea('0x3f')]('\x22'+_0x10dfc+'\x22');}else{_0x5d0ea5[_0xb3ea('0x3f')](_0xb3ea('0x53'));}break;case _0xb3ea('0x21'):var _0x5c2114=parseInt(_0x10dfc);_0x10dfc=_[_0xb3ea('0x54')](_0x5c2114)||_0x5c2114<0x0||_0x5c2114>0x4?_0x59dc2d?0x3:0x2:_0x5c2114;_0x17cf2f[_0xb3ea('0x3f')]('\x22'+_0x10dfc+'\x22');break;case _0xb3ea('0x22'):var _0x1ff5a6=parseInt(_0x10dfc);if(_['isNumber'](_0x1ff5a6)&&_[_0xb3ea('0x55')](_0x18ce86,_0x1ff5a6)){_0x17cf2f['push']('\x22'+_0x1ff5a6+'\x22');}else{_0x5d0ea5[_0xb3ea('0x3f')](_0xb3ea('0x56'));}break;case _0xb3ea('0x57'):if(isEmail(_0x10dfc)){_0x17cf2f[_0xb3ea('0x3f')]('\x22'+_0x10dfc+'\x22');}else{_0x5d0ea5[_0xb3ea('0x3f')](_0xb3ea('0x58'));}break;case _0xb3ea('0x59'):var _0x18cd69=moment(_0x10dfc,_0xb3ea('0x5a'),!![]);if(_0x18cd69[_0xb3ea('0x52')]()){_0x17cf2f[_0xb3ea('0x3f')]('\x22'+_0x10dfc+'\x22');}else{_0x5d0ea5[_0xb3ea('0x3f')](_0xb3ea('0x5b'));}break;default:_0x17cf2f[_0xb3ea('0x3f')]('\x22'+_0x10dfc+'\x22');}}else{switch(_0x506cc4){case'firstName':case _0xb3ea('0xe'):_0x5d0ea5['push'](_0x506cc4+_0xb3ea('0x5c'));break;default:_0x17cf2f['push']('\x22\x22');}}}}if(_0x5d0ea5[_0xb3ea('0x4d')]){handleError(_0x576c1a[_0xb3ea('0x4f')][_0x3b4aec],{'code':'SystemRow','message':_0x5d0ea5['join']()});}else{fs[_0xb3ea('0x5d')](_0x205d84,_0x17cf2f['join']()+'\x0a');}_0x17cf2f=[];}if(!(stats[_0xb3ea('0x4e')]%0xc8)){socket[_0xb3ea('0x5e')](_0xb3ea('0x5f')+_0x4e86a5,stats);stats[_0xb3ea('0x3e')]=[];}}if(stopped){logger[_0xb3ea('0x3b')]('Abort\x20parser');_0x278269[_0xb3ea('0x60')]();}}catch(_0x1106bc){handleError(_0x576c1a[_0xb3ea('0x4f')][_0x3b4aec],{'code':'SystemError','message':_0x1106bc[_0xb3ea('0x3d')]});logger[_0xb3ea('0x3c')](_0xb3ea('0x61'),_0x1106bc[_0xb3ea('0x3d')]);}},'complete':function(){try{var _0x559550=[];var _0x46226a='cm_contacts';if(_0x49151c['duplicates']&&_0x49151c[_0xb3ea('0x62')]['length']){_0x46226a=_0xb3ea('0x63')+_0x4e86a5;_0x559550[_0xb3ea('0x3f')]('CREATE\x20TABLE\x20'+_0x46226a+_0xb3ea('0x64'));}var _0x3e024a=util[_0xb3ea('0xa')](_0xb3ea('0x65'),_0x205d84,_0x46226a,_0x57d32a,_0x49151c[_0xb3ea('0x33')],_0x49151c[_0xb3ea('0x34')]||null,NOW,NOW);if(_[_0xb3ea('0x66')](_0x423aed['scheduledat'])){_0x3e024a+=_0xb3ea('0x67');}_0x559550[_0xb3ea('0x3f')](_0x3e024a);if(_0x49151c[_0xb3ea('0x62')]&&_0x49151c[_0xb3ea('0x62')][_0xb3ea('0x4d')]){_0x559550['push'](insertCmContact(_0x49151c[_0xb3ea('0x33')],_0x46226a,_0x49151c[_0xb3ea('0x62')],_0x423aed));_0x559550[_0xb3ea('0x3f')](_0xb3ea('0x68')+_0x46226a+';');}_0x559550[_0xb3ea('0x3f')](insertCmHopper(_0x49151c[_0xb3ea('0x33')],_0xb3ea('0x69'),_0xb3ea('0x6a'),_0xb3ea('0x6b'),_0x59dc2d));_0x559550[_0xb3ea('0x3f')](insertCmHopperBlack(_0x49151c[_0xb3ea('0x33')],'voice_queues_has_cm_blacklists',_0xb3ea('0x6a'),'VoiceQueueId'));_0x559550['push'](insertCmHopper(_0x49151c[_0xb3ea('0x33')],'campaigns_has_cm_lists',_0xb3ea('0x6c'),_0xb3ea('0x6d'),_0x59dc2d));_0x559550[_0xb3ea('0x3f')](insertCmHopperBlack(_0x49151c[_0xb3ea('0x33')],'campaigns_has_cm_blacklists',_0xb3ea('0x6c'),_0xb3ea('0x6d')));BPromise[_0xb3ea('0x6e')](_0x559550,handleQuery)['then'](function(_0x1e32d6){stats['finish']=!![];stats[_0xb3ea('0x6f')]=_0x49151c[_0xb3ea('0x62')]&&_0x49151c[_0xb3ea('0x62')]['length']?results[0x2][_0xb3ea('0x6f')]:results[0x0][_0xb3ea('0x6f')];socket[_0xb3ea('0x5e')](_0xb3ea('0x5f')+_0x4e86a5,stats);fs[_0xb3ea('0x70')](_0x284c51);fs[_0xb3ea('0x70')](_0x205d84);process[_0xb3ea('0x71')](0x0);})[_0xb3ea('0x41')](function(_0x1d4711){logger[_0xb3ea('0x3c')](_0x1d4711[_0xb3ea('0x3d')]);process[_0xb3ea('0x71')](0x1);});}catch(_0x4f5d7f){logger[_0xb3ea('0x3c')](_0xb3ea('0x72'),_0x4f5d7f[_0xb3ea('0x3d')]);process['exit'](0x1);}},'error':function(_0x104ccb,_0xcba4f0,_0x59e765,_0x217d6d){throw new Error(_0x217d6d);}});}function validate(){if(process[_0xb3ea('0x73')]&&process['argv'][_0xb3ea('0x4d')]<0x4){throw new Error('arguments\x20\x20\x20');}var _0x4a9d58=path['join'](config[_0xb3ea('0x47')],_0xb3ea('0x48'),process[_0xb3ea('0x73')][0x2]);if(!fs[_0xb3ea('0x74')](_0x4a9d58)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x17f0c2={};try{_0x17f0c2=JSON['parse'](process[_0xb3ea('0x73')][0x3]);if(!_0x17f0c2['binding']){throw new Error(_0xb3ea('0x75'));}if(!_0x17f0c2['binding'][_0xb3ea('0xe')]){throw new Error(_0xb3ea('0x76'));}if(!_0x17f0c2[_0xb3ea('0x45')][_0xb3ea('0x77')]){throw new Error('firstName\x20is\x20mandatory');}var _0x3a6034=0x0;if(_0x17f0c2[_0xb3ea('0x45')][_0xb3ea('0x22')]){_0x3a6034=0x1;}if(!_0x17f0c2[_0xb3ea('0x33')]){throw new Error(_0xb3ea('0x78'));}}catch(_0x539c5d){throw new Error(_0xb3ea('0x79'));}var _0x39abe3=[];try{_0x39abe3=_[_0xb3ea('0x7a')](JSON[_0xb3ea('0x7b')](process[_0xb3ea('0x73')][0x4]),'id');}catch(_0x4c1e1c){logger[_0xb3ea('0x3b')]('No\x20agent\x20available');}main(_0x4a9d58,_0x17f0c2,_0x39abe3,_0x3a6034);}validate();process['on'](_0xb3ea('0x7c'),handleStop);process['on'](_0xb3ea('0x7d'),handleUncaughtException); \ No newline at end of file +var _0x5ba9=['fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','select','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','into','cm_hopper_black','.CmListId','cm_contacts.createdAt\x20=\x20?','\x20=\x20?','keys','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','push','code','sequelize','query','spread','main','stringify','send','binding','socket_timestamp','server/files/tmp','.csv','header','writeFileSync','createReadStream','data','length','rows','errors','hasOwnProperty','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','UserId','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','SystemRow','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','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','isNil',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns','campaigns_has_cm_blacklists','CampaignId','each','then','finish','affectedRows','unlink','exit','catch','complete','argv','arguments\x20\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName','ListId\x20is\x20mandatory','map','parse','No\x20agent\x20available','SIGINT','lodash','papaparse','bluebird','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','field','phone','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','cm_hopper'];(function(_0x5099c0,_0x57a54a){var _0x217219=function(_0x26fe76){while(--_0x26fe76){_0x5099c0['push'](_0x5099c0['shift']());}};_0x217219(++_0x57a54a);}(_0x5ba9,0x17f));var _0x95ba=function(_0x28bb09,_0x549e04){_0x28bb09=_0x28bb09-0x0;var _0x4370fe=_0x5ba9[_0x28bb09];return _0x4370fe;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x95ba('0x0'));var Papa=require(_0x95ba('0x1'));var util=require('util');var BPromise=require(_0x95ba('0x2'));var moment=require('moment');var squel=require(_0x95ba('0x3'));var Redis=require(_0x95ba('0x4'));var db=require(_0x95ba('0x5'))['db'];var config=require(_0x95ba('0x6'));var logger=require(_0x95ba('0x7'))(_0x95ba('0x8'));config[_0x95ba('0x9')]=_[_0x95ba('0xa')](config[_0x95ba('0x9')],{'host':_0x95ba('0xb'),'port':0x18eb});var socket=require(_0x95ba('0xc'))(new Redis(config[_0x95ba('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x95ba('0xd')](_0x95ba('0xe'));function isEmail(_0x34b20f){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))*$/[_0x95ba('0xf')](_0x34b20f);}function selectNotIn(_0x5368f4,_0x3f031a,_0x128e59,_0x4ccd02,_0x2a9ba0){return squel['select']()[_0x95ba('0x10')](_0x95ba('0x11'))[_0x95ba('0x12')](_0x4ccd02)[_0x95ba('0x13')](_0x3f031a,null,_0x3f031a+_0x95ba('0x14')+_0x4ccd02+'.'+_0x128e59)[_0x95ba('0x15')](_0x4ccd02+'.'+_0x128e59+'\x20=\x20'+_0x5368f4+'.'+_0x128e59)['where'](_0x3f031a+_0x95ba('0x16')+_0x2a9ba0['join']()+')');}function insertCmHopper(_0x45a492,_0x38b81c,_0x221562,_0x292b3a,_0x127e1c){var _0x163135=[_0x95ba('0x17'),'cm_contacts.scheduledat',_0x95ba('0x18'),'cm_contacts.ListId',_0x38b81c+'.'+_0x292b3a,_0x95ba('0x19'),_0x95ba('0x1a'),_0x95ba('0x1b'),_0x95ba('0x1c'),'\x22'+_0x127e1c+'\x22'];return squel[_0x95ba('0x1d')]()['into'](_0x95ba('0x1e'))[_0x95ba('0x1f')]([_0x95ba('0x11'),_0x95ba('0x20'),_0x95ba('0x21'),_0x95ba('0x22'),_0x292b3a,_0x95ba('0x23'),_0x95ba('0x24'),'priority','UserId','recallme'],squel[_0x95ba('0x25')]()[_0x95ba('0x26')](_0x163135)[_0x95ba('0x12')](_0x38b81c)['join'](_0x95ba('0x27'),null,_0x95ba('0x28')+_0x38b81c+'.CmListId')['join'](_0x221562,null,_0x221562+_0x95ba('0x14')+_0x38b81c+'.'+_0x292b3a)['where'](_0x38b81c+_0x95ba('0x29'),_0x45a492)[_0x95ba('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x95ba('0x15')](_0x95ba('0x2a'),selectNotIn(_0x38b81c,_0x221562,_0x292b3a,_0x95ba('0x1e'),[_0x95ba('0x2b'),_0x95ba('0x2c')]))['where'](_0x95ba('0x2a'),selectNotIn(_0x38b81c,_0x221562,_0x292b3a,_0x95ba('0x1e'),['\x22always\x22'])))[_0x95ba('0x2d')]();}function insertCmHopperBlack(_0x5e9d16,_0x33ca26,_0x1e35d9,_0x38b315){var _0x40df81=[_0x95ba('0x17'),_0x95ba('0x18'),'cm_contacts.ListId',_0x33ca26+'.'+_0x38b315,_0x95ba('0x19'),_0x95ba('0x1a')];return squel[_0x95ba('0x1d')]()[_0x95ba('0x2e')](_0x95ba('0x2f'))[_0x95ba('0x1f')](['phone','ContactId',_0x95ba('0x22'),_0x38b315,_0x95ba('0x23'),_0x95ba('0x24')],squel[_0x95ba('0x25')]()[_0x95ba('0x26')](_0x40df81)[_0x95ba('0x12')](_0x33ca26)[_0x95ba('0x13')](_0x95ba('0x27'),null,'cm_contacts.ListId\x20=\x20'+_0x33ca26+_0x95ba('0x30'))['join'](_0x1e35d9,null,_0x1e35d9+'.id\x20=\x20'+_0x33ca26+'.'+_0x38b315)[_0x95ba('0x15')](_0x33ca26+_0x95ba('0x29'),_0x5e9d16)[_0x95ba('0x15')](_0x95ba('0x31'),NOW)[_0x95ba('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x95ba('0x25')]()['field'](_0x95ba('0x11'))[_0x95ba('0x12')]('cm_hopper_black')[_0x95ba('0x15')]('ListId\x20=\x20?',_0x5e9d16)[_0x95ba('0x15')](_0x38b315+_0x95ba('0x32'),_0x33ca26+'.'+_0x38b315)))[_0x95ba('0x2d')]();}function insertCmContact(_0x691800,_0x41baf3,_0x2fb086,_0x40b7bb){var _0x4e6e7d=_['concat'](_[_0x95ba('0x33')](_0x40b7bb),[_0x95ba('0x22'),_0x95ba('0x34'),_0x95ba('0x23'),'updatedAt']);return squel[_0x95ba('0x1d')]()[_0x95ba('0x2e')](_0x95ba('0x27'))[_0x95ba('0x1f')](_0x4e6e7d,squel[_0x95ba('0x25')]()[_0x95ba('0x26')](_0x4e6e7d)[_0x95ba('0x12')](_0x41baf3)[_0x95ba('0x15')]('('+_0x2fb086[_0x95ba('0x13')](',')+_0x95ba('0x35'),squel[_0x95ba('0x25')]()[_0x95ba('0x26')](_0x2fb086)[_0x95ba('0x12')](_0x95ba('0x27'))[_0x95ba('0x15')]('ListId\x20=\x20?',_0x691800)[_0x95ba('0x15')](_0x95ba('0x36')))[_0x95ba('0x15')](_0x95ba('0x37'),squel[_0x95ba('0x25')]()[_0x95ba('0x10')](_0x95ba('0x38'),_0x95ba('0x39'))['from'](_0x41baf3)[_0x95ba('0x3a')](_0x2fb086[_0x95ba('0x13')](','))))[_0x95ba('0x2d')]();}function handleStop(){logger[_0x95ba('0x3b')](_0x95ba('0x3c'));stopped=!![];}function handleUncaughtException(_0x3e506b){logger[_0x95ba('0x3d')](_0x3e506b[_0x95ba('0x3e')]);process['exit'](0x1);}function handleError(_0x35437a,_0x19bd3d){stats['errors'][_0x95ba('0x3f')]({'name':_0x19bd3d[_0x95ba('0x40')],'message':_0x19bd3d[_0x95ba('0x3e')],'row':_0x35437a});}function handleQuery(_0x40af17){logger[_0x95ba('0x3b')](_0x40af17);return db[_0x95ba('0x41')][_0x95ba('0x42')](_0x40af17)[_0x95ba('0x43')](function(_0x2fb024){results[_0x95ba('0x3f')](_0x2fb024);})['catch'](function(_0x13bd3f){logger[_0x95ba('0x3d')](_0x13bd3f['message']);});}function main(_0x83da24,_0x347fba,_0x4abfcd,_0x4aa1aa){logger[_0x95ba('0x3b')](_0x95ba('0x44'),_0x83da24,JSON[_0x95ba('0x45')](_0x347fba));process[_0x95ba('0x46')]('start');var _0x2c753d=_0x347fba[_0x95ba('0x47')];var _0x527c48=_0x347fba[_0x95ba('0x48')];var _0x193c93=path[_0x95ba('0x13')](config['root'],_0x95ba('0x49'),_0x527c48+_0x95ba('0x4a'));var _0xd328f2=_[_0x95ba('0x33')](_0x2c753d)[_0x95ba('0x13')]();logger['info'](_0x95ba('0x4b'),_0xd328f2);fs[_0x95ba('0x4c')](_0x193c93,_0xd328f2+'\x0a');Papa['parse'](fs[_0x95ba('0x4d')](_0x83da24),{'header':!![],'skipEmptyLines':!![],'step':function(_0x40dfde,_0x5bb42c){try{for(var _0x43ee1c=0x0,_0x1967c3=[];_0x43ee1c<_0x40dfde[_0x95ba('0x4e')][_0x95ba('0x4f')];_0x43ee1c++){stats[_0x95ba('0x50')]+=0x1;if(_0x40dfde[_0x95ba('0x51')][_0x43ee1c]){handleError(_0x40dfde[_0x95ba('0x4e')][_0x43ee1c],_0x40dfde[_0x95ba('0x51')][_0x43ee1c]);}else{var _0x3ee2aa=[];for(var _0x3d4445 in _0x2c753d){if(_0x2c753d[_0x95ba('0x52')](_0x3d4445)){if(_0x40dfde[_0x95ba('0x4e')][_0x43ee1c][_0x2c753d[_0x3d4445]]){var _0xb01426=_[_0x95ba('0x53')](_0x40dfde[_0x95ba('0x4e')][_0x43ee1c][_0x2c753d[_0x3d4445]][_0x95ba('0x54')](/"/g,'\x27'));switch(_0x3d4445){case _0x95ba('0x20'):var _0x1eae25=moment(_0xb01426,_0x95ba('0xe'),!![]);if(_0x1eae25[_0x95ba('0x55')]()){_0x1967c3[_0x95ba('0x3f')]('\x22'+_0xb01426+'\x22');}else{_0x3ee2aa[_0x95ba('0x3f')](_0x95ba('0x56'));}break;case _0x95ba('0x57'):var _0xf871ae=parseInt(_0xb01426);_0xb01426=_['isNaN'](_0xf871ae)||_0xf871ae<0x0||_0xf871ae>0x4?_0x4aa1aa?0x3:0x2:_0xf871ae;_0x1967c3[_0x95ba('0x3f')]('\x22'+_0xb01426+'\x22');break;case _0x95ba('0x58'):var _0x56164c=parseInt(_0xb01426);if(_[_0x95ba('0x59')](_0x56164c)&&_[_0x95ba('0x5a')](_0x4abfcd,_0x56164c)){_0x1967c3[_0x95ba('0x3f')]('\x22'+_0x56164c+'\x22');}else{_0x3ee2aa['push'](_0x95ba('0x5b'));}break;case _0x95ba('0x5c'):if(isEmail(_0xb01426)){_0x1967c3['push']('\x22'+_0xb01426+'\x22');}else{_0x3ee2aa[_0x95ba('0x3f')](_0x95ba('0x5d'));}break;case _0x95ba('0x5e'):var _0x364116=moment(_0xb01426,'YYYY-MM-DD',!![]);if(_0x364116[_0x95ba('0x55')]()){_0x1967c3['push']('\x22'+_0xb01426+'\x22');}else{_0x3ee2aa[_0x95ba('0x3f')](_0x95ba('0x5f'));}break;default:_0x1967c3['push']('\x22'+_0xb01426+'\x22');}}else{switch(_0x3d4445){case'firstName':case _0x95ba('0x11'):_0x3ee2aa[_0x95ba('0x3f')](_0x3d4445+'\x20not\x20specified');break;default:_0x1967c3[_0x95ba('0x3f')]('\x22\x22');}}}}if(_0x3ee2aa[_0x95ba('0x4f')]){handleError(_0x40dfde['data'][_0x43ee1c],{'code':_0x95ba('0x60'),'message':_0x3ee2aa[_0x95ba('0x13')]()});}else{fs['appendFileSync'](_0x193c93,_0x1967c3['join']()+'\x0a');}_0x1967c3=[];}if(!(stats[_0x95ba('0x50')]%0xc8)){socket[_0x95ba('0x61')](_0x95ba('0x62')+_0x527c48,stats);stats['errors']=[];}}if(stopped){logger[_0x95ba('0x3b')](_0x95ba('0x63'));_0x5bb42c[_0x95ba('0x64')]();}}catch(_0x472215){handleError(_0x40dfde[_0x95ba('0x4e')][_0x43ee1c],{'code':_0x95ba('0x65'),'message':_0x472215['message']});logger[_0x95ba('0x3d')](_0x95ba('0x66'),_0x472215[_0x95ba('0x3e')]);}},'complete':function(){try{var _0x4e6e14=[];var _0x4a2057='cm_contacts';if(_0x347fba[_0x95ba('0x67')]&&_0x347fba[_0x95ba('0x67')][_0x95ba('0x4f')]){_0x4a2057=_0x95ba('0x68')+_0x527c48;_0x4e6e14[_0x95ba('0x3f')](_0x95ba('0x69')+_0x4a2057+'\x20LIKE\x20cm_contacts;');}var _0x4dccd2=util[_0x95ba('0xd')](_0x95ba('0x6a'),_0x193c93,_0x4a2057,_0xd328f2,_0x347fba[_0x95ba('0x22')],_0x347fba['CompanyId']||null,NOW,NOW);if(_[_0x95ba('0x6b')](_0x2c753d['scheduledat'])){_0x4dccd2+=_0x95ba('0x6c');}_0x4e6e14['push'](_0x4dccd2);if(_0x347fba[_0x95ba('0x67')]&&_0x347fba[_0x95ba('0x67')][_0x95ba('0x4f')]){_0x4e6e14[_0x95ba('0x3f')](insertCmContact(_0x347fba['ListId'],_0x4a2057,_0x347fba[_0x95ba('0x67')],_0x2c753d));_0x4e6e14['push'](_0x95ba('0x6d')+_0x4a2057+';');}_0x4e6e14[_0x95ba('0x3f')](insertCmHopper(_0x347fba[_0x95ba('0x22')],_0x95ba('0x6e'),_0x95ba('0x6f'),_0x95ba('0x70'),_0x4aa1aa));_0x4e6e14['push'](insertCmHopperBlack(_0x347fba[_0x95ba('0x22')],_0x95ba('0x71'),'voice_queues',_0x95ba('0x70')));_0x4e6e14[_0x95ba('0x3f')](insertCmHopper(_0x347fba['ListId'],'campaigns_has_cm_lists',_0x95ba('0x72'),'CampaignId',_0x4aa1aa));_0x4e6e14[_0x95ba('0x3f')](insertCmHopperBlack(_0x347fba[_0x95ba('0x22')],_0x95ba('0x73'),_0x95ba('0x72'),_0x95ba('0x74')));BPromise[_0x95ba('0x75')](_0x4e6e14,handleQuery)[_0x95ba('0x76')](function(_0x44c00d){stats[_0x95ba('0x77')]=!![];stats['affectedRows']=_0x347fba[_0x95ba('0x67')]&&_0x347fba[_0x95ba('0x67')][_0x95ba('0x4f')]?results[0x2][_0x95ba('0x78')]:results[0x0][_0x95ba('0x78')];socket[_0x95ba('0x61')](_0x95ba('0x62')+_0x527c48,stats);fs['unlink'](_0x83da24);fs[_0x95ba('0x79')](_0x193c93);process[_0x95ba('0x7a')](0x0);})[_0x95ba('0x7b')](function(_0x558c6e){logger[_0x95ba('0x3d')](_0x558c6e['message']);process[_0x95ba('0x7a')](0x1);});}catch(_0x4bf92c){logger[_0x95ba('0x3d')](_0x95ba('0x7c'),_0x4bf92c[_0x95ba('0x3e')]);process[_0x95ba('0x7a')](0x1);}},'error':function(_0x2e366f,_0x2bb646,_0x2701c3,_0xb8cfbe){throw new Error(_0xb8cfbe);}});}function validate(){if(process['argv']&&process[_0x95ba('0x7d')][_0x95ba('0x4f')]<0x4){throw new Error(_0x95ba('0x7e'));}var _0x2f2bf=path[_0x95ba('0x13')](config[_0x95ba('0x7f')],_0x95ba('0x49'),process['argv'][0x2]);if(!fs[_0x95ba('0x80')](_0x2f2bf)){throw new Error(_0x95ba('0x81'));}var _0x1c8412={};try{_0x1c8412=JSON['parse'](process[_0x95ba('0x7d')][0x3]);if(!_0x1c8412['binding']){throw new Error(_0x95ba('0x82'));}if(!_0x1c8412['binding'][_0x95ba('0x11')]){throw new Error(_0x95ba('0x83'));}if(!_0x1c8412['binding'][_0x95ba('0x84')]){throw new Error('firstName\x20is\x20mandatory');}var _0x362b0a=0x0;if(_0x1c8412[_0x95ba('0x47')][_0x95ba('0x58')]){_0x362b0a=0x1;}if(!_0x1c8412['ListId']){throw new Error(_0x95ba('0x85'));}}catch(_0x2f0729){throw new Error('body\x20id\x20mandatory');}var _0x361bc7=[];try{_0x361bc7=_[_0x95ba('0x86')](JSON[_0x95ba('0x87')](process[_0x95ba('0x7d')][0x4]),'id');}catch(_0x458934){logger[_0x95ba('0x3b')](_0x95ba('0x88'));}main(_0x2f2bf,_0x1c8412,_0x361bc7,_0x362b0a);}validate();process['on'](_0x95ba('0x89'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index a280b9f..9197f65 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4f6a=['duration','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','variable','queue','push','calleridnum','outbound','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','Call\x20To','destexten','UniqueId','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','destcalleridnum','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','Agent\x20Complete','Hold\x20Time','holdtime','talktime','Answer\x20Time','answertime','Complete\x20Time','endtime'];(function(_0x331227,_0x277f7e){var _0x32d1c1=function(_0xed0476){while(--_0xed0476){_0x331227['push'](_0x331227['shift']());}};_0x32d1c1(++_0x277f7e);}(_0x4f6a,0x131));var _0xa4f6=function(_0xc2c353,_0x41a5a3){_0xc2c353=_0xc2c353-0x0;var _0x806605=_0x4f6a[_0xc2c353];return _0x806605;};'use strict';exports[_0xa4f6('0x0')]=function(_0x5c9144,_0x2fa24f){var _0x3d27fc=[{'type':_0xa4f6('0x1'),'content':_0xa4f6('0x2'),'variableName':null}];switch(_0x5c9144[_0xa4f6('0x3')]()){case _0xa4f6('0x4'):switch(_0x2fa24f[_0xa4f6('0x3')]()){case _0xa4f6('0x5'):_0x3d27fc['push']({'type':_0xa4f6('0x6'),'content':'','variableName':_0xa4f6('0x7')});_0x3d27fc[_0xa4f6('0x8')]({'type':_0xa4f6('0x6'),'content':'','variableName':_0xa4f6('0x9')});break;case _0xa4f6('0xa'):_0x3d27fc[_0xa4f6('0x8')]({'type':'string','content':'Outbound\x20Call','variableName':null});_0x3d27fc['push']({'type':_0xa4f6('0x6'),'content':'','variableName':'destcalleridnum'});break;}}return _0x3d27fc;};exports[_0xa4f6('0xb')]=function(_0x3d3349,_0x598bc5){var _0x34d08c=[];switch(_0x3d3349[_0xa4f6('0x3')]()){case _0xa4f6('0x4'):switch(_0x598bc5[_0xa4f6('0x3')]()){case'inbound':_0x34d08c=[{'type':_0xa4f6('0x1'),'content':_0xa4f6('0xc'),'key':null,'keyType':null,'variableName':null},{'type':_0xa4f6('0xd'),'content':'','key':_0xa4f6('0xe'),'keyType':_0xa4f6('0x6'),'variableName':_0xa4f6('0x9')},{'type':_0xa4f6('0xd'),'content':'','key':_0xa4f6('0xf'),'keyType':_0xa4f6('0x6'),'variableName':'calleridname'},{'type':_0xa4f6('0xd'),'content':'','key':_0xa4f6('0x10'),'keyType':_0xa4f6('0x6'),'variableName':_0xa4f6('0x11')},{'type':'keyValue','content':'','key':'Queue','keyType':_0xa4f6('0x6'),'variableName':_0xa4f6('0x7')},{'type':_0xa4f6('0xd'),'content':'','key':_0xa4f6('0x12'),'keyType':_0xa4f6('0x6'),'variableName':'uniqueid'},{'type':_0xa4f6('0xd'),'content':'','key':_0xa4f6('0x13'),'keyType':'variable','variableName':_0xa4f6('0x14')},{'type':_0xa4f6('0x1'),'content':_0xa4f6('0x15'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xa4f6('0x16'),'keyType':_0xa4f6('0x6'),'variableName':_0xa4f6('0x17')},{'type':_0xa4f6('0xd'),'content':'','key':_0xa4f6('0x18'),'keyType':_0xa4f6('0x6'),'variableName':_0xa4f6('0x19')},{'type':_0xa4f6('0x1'),'content':_0xa4f6('0x1a'),'key':null,'keyType':null,'variableName':null},{'type':_0xa4f6('0xd'),'content':'','key':_0xa4f6('0x1b'),'keyType':_0xa4f6('0x6'),'variableName':_0xa4f6('0x14')},{'type':_0xa4f6('0xd'),'content':'','key':_0xa4f6('0x1c'),'keyType':'variable','variableName':'agentconnectAt'},{'type':_0xa4f6('0xd'),'content':'','key':_0xa4f6('0x1d'),'keyType':_0xa4f6('0x6'),'variableName':'agentcompleteAt'},{'type':_0xa4f6('0xd'),'content':'','key':_0xa4f6('0x1e'),'keyType':_0xa4f6('0x6'),'variableName':_0xa4f6('0x1f')},{'type':_0xa4f6('0xd'),'content':'','key':'Talk\x20Time','keyType':_0xa4f6('0x6'),'variableName':_0xa4f6('0x20')}];break;case'outbound':_0x34d08c=[{'type':_0xa4f6('0x1'),'content':_0xa4f6('0xc'),'variableName':null},{'type':_0xa4f6('0xd'),'content':'','key':'Called\x20Number','keyType':_0xa4f6('0x6'),'keyContent':'','variableName':_0xa4f6('0x19')},{'type':_0xa4f6('0xd'),'content':'','key':'Member\x20Name','keyType':'variable','keyContent':'','variableName':'membername'},{'type':_0xa4f6('0xd'),'content':'','key':_0xa4f6('0x12'),'keyType':'variable','keyContent':'','variableName':'uniqueid'},{'type':_0xa4f6('0xd'),'content':'','key':_0xa4f6('0x13'),'keyType':_0xa4f6('0x6'),'keyContent':'','variableName':'starttime'},{'type':_0xa4f6('0x1'),'content':'***\x20Time\x20Info\x20***'},{'type':_0xa4f6('0xd'),'content':'','key':_0xa4f6('0x21'),'keyType':'variable','keyContent':'','variableName':_0xa4f6('0x22')},{'type':_0xa4f6('0xd'),'content':'','key':_0xa4f6('0x23'),'keyType':'variable','keyContent':'','variableName':_0xa4f6('0x24')},{'type':_0xa4f6('0xd'),'content':'','key':'Duration','keyType':'variable','keyContent':'','variableName':_0xa4f6('0x25')},{'type':_0xa4f6('0xd'),'content':'','key':'Billable\x20Time','keyType':_0xa4f6('0x6'),'keyContent':'','variableName':'billableseconds'}];break;}}return _0x34d08c;}; \ No newline at end of file +var _0x5476=['variable','outbound','Outbound\x20Call','destcalleridnum','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','calleridname','Call\x20To','UniqueId','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','Agent\x20Ring','Agent\x20Connect','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','Called\x20Number','Member\x20Name','membername','***\x20Time\x20Info\x20***','answertime','Complete\x20Time','endtime','Duration','duration','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','voice','toLowerCase','queue','push'];(function(_0x20259c,_0xe43fb2){var _0x4d988e=function(_0x2097b9){while(--_0x2097b9){_0x20259c['push'](_0x20259c['shift']());}};_0x4d988e(++_0xe43fb2);}(_0x5476,0x126));var _0x6547=function(_0x155c1c,_0x4bf31d){_0x155c1c=_0x155c1c-0x0;var _0x42f3c7=_0x5476[_0x155c1c];return _0x42f3c7;};'use strict';exports[_0x6547('0x0')]=function(_0x57c4a4,_0x39b19c){var _0xe98d5a=[{'type':_0x6547('0x1'),'content':_0x6547('0x2'),'variableName':null}];switch(_0x57c4a4['toLowerCase']()){case _0x6547('0x3'):switch(_0x39b19c[_0x6547('0x4')]()){case'inbound':_0xe98d5a['push']({'type':'variable','content':'','variableName':_0x6547('0x5')});_0xe98d5a[_0x6547('0x6')]({'type':_0x6547('0x7'),'content':'','variableName':'calleridnum'});break;case _0x6547('0x8'):_0xe98d5a[_0x6547('0x6')]({'type':_0x6547('0x1'),'content':_0x6547('0x9'),'variableName':null});_0xe98d5a[_0x6547('0x6')]({'type':'variable','content':'','variableName':_0x6547('0xa')});break;}}return _0xe98d5a;};exports['getDescriptions']=function(_0x49fafa,_0x4507aa){var _0x919e30=[];switch(_0x49fafa['toLowerCase']()){case'voice':switch(_0x4507aa[_0x6547('0x4')]()){case'inbound':_0x919e30=[{'type':_0x6547('0x1'),'content':_0x6547('0xb'),'key':null,'keyType':null,'variableName':null},{'type':_0x6547('0xc'),'content':'','key':_0x6547('0xd'),'keyType':'variable','variableName':'calleridnum'},{'type':'keyValue','content':'','key':_0x6547('0xe'),'keyType':'variable','variableName':_0x6547('0xf')},{'type':_0x6547('0xc'),'content':'','key':_0x6547('0x10'),'keyType':_0x6547('0x7'),'variableName':'destexten'},{'type':_0x6547('0xc'),'content':'','key':'Queue','keyType':_0x6547('0x7'),'variableName':_0x6547('0x5')},{'type':_0x6547('0xc'),'content':'','key':_0x6547('0x11'),'keyType':_0x6547('0x7'),'variableName':_0x6547('0x12')},{'type':_0x6547('0xc'),'content':'','key':_0x6547('0x13'),'keyType':'variable','variableName':_0x6547('0x14')},{'type':_0x6547('0x1'),'content':_0x6547('0x15'),'key':null,'keyType':null,'variableName':null},{'type':_0x6547('0xc'),'content':'','key':_0x6547('0x16'),'keyType':_0x6547('0x7'),'variableName':_0x6547('0x17')},{'type':'keyValue','content':'','key':_0x6547('0x18'),'keyType':'variable','variableName':_0x6547('0xa')},{'type':_0x6547('0x1'),'content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x6547('0xc'),'content':'','key':_0x6547('0x19'),'keyType':_0x6547('0x7'),'variableName':_0x6547('0x14')},{'type':_0x6547('0xc'),'content':'','key':_0x6547('0x1a'),'keyType':'variable','variableName':'agentconnectAt'},{'type':_0x6547('0xc'),'content':'','key':_0x6547('0x1b'),'keyType':'variable','variableName':_0x6547('0x1c')},{'type':'keyValue','content':'','key':_0x6547('0x1d'),'keyType':_0x6547('0x7'),'variableName':_0x6547('0x1e')},{'type':_0x6547('0xc'),'content':'','key':_0x6547('0x1f'),'keyType':_0x6547('0x7'),'variableName':_0x6547('0x20')}];break;case'outbound':_0x919e30=[{'type':_0x6547('0x1'),'content':'***\x20Call\x20Info\x20***','variableName':null},{'type':_0x6547('0xc'),'content':'','key':_0x6547('0x21'),'keyType':_0x6547('0x7'),'keyContent':'','variableName':_0x6547('0xa')},{'type':_0x6547('0xc'),'content':'','key':_0x6547('0x22'),'keyType':'variable','keyContent':'','variableName':_0x6547('0x23')},{'type':_0x6547('0xc'),'content':'','key':_0x6547('0x11'),'keyType':_0x6547('0x7'),'keyContent':'','variableName':'uniqueid'},{'type':_0x6547('0xc'),'content':'','key':_0x6547('0x13'),'keyType':'variable','keyContent':'','variableName':'starttime'},{'type':_0x6547('0x1'),'content':_0x6547('0x24')},{'type':_0x6547('0xc'),'content':'','key':'Answer\x20Time','keyType':_0x6547('0x7'),'keyContent':'','variableName':_0x6547('0x25')},{'type':_0x6547('0xc'),'content':'','key':_0x6547('0x26'),'keyType':_0x6547('0x7'),'keyContent':'','variableName':_0x6547('0x27')},{'type':_0x6547('0xc'),'content':'','key':_0x6547('0x28'),'keyType':'variable','keyContent':'','variableName':_0x6547('0x29')},{'type':_0x6547('0xc'),'content':'','key':'Billable\x20Time','keyType':_0x6547('0x7'),'keyContent':'','variableName':_0x6547('0x2a')}];break;}}return _0x919e30;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 2228417..3835aca 100644 --- a/server/components/interaction/service.js +++ b/server/components/interaction/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xec62=['../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','chat-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','Interaction','findOne','then','update','info','catch','error','user','query','clone','omit','body','html','phone','fax','lodash'];(function(_0x4f35eb,_0x26ce78){var _0x3a6459=function(_0x32afef){while(--_0x32afef){_0x4f35eb['push'](_0x4f35eb['shift']());}};_0x3a6459(++_0x26ce78);}(_0xec62,0x1b2));var _0x2ec6=function(_0x527ce8,_0x122695){_0x527ce8=_0x527ce8-0x0;var _0x2a8a56=_0xec62[_0x527ce8];return _0x2a8a56;};'use strict';var _=require(_0x2ec6('0x0'));var db=require(_0x2ec6('0x1'))['db'];var loggers={'openchannel':require(_0x2ec6('0x2'))(_0x2ec6('0x3')),'mail':require('../../config/logger')(_0x2ec6('0x4')),'fax':require(_0x2ec6('0x2'))('fax-interactions'),'sms':require(_0x2ec6('0x2'))('sms-interactions'),'chat':require(_0x2ec6('0x2'))(_0x2ec6('0x5')),'whatsapp':require(_0x2ec6('0x2'))(_0x2ec6('0x6'))};function getInteractionId(_0x4410f8,_0x5c3503,_0x50fd08){if(_0x4410f8&&_0x4410f8[_[_0x2ec6('0x7')](_0x50fd08)+_0x2ec6('0x8')]){return _0x4410f8[_[_0x2ec6('0x7')](_0x50fd08)+_0x2ec6('0x8')];}else if(_0x4410f8&&_0x4410f8['id']){return _0x4410f8['id'];}else if(_0x5c3503&&_0x5c3503['id']){return _0x5c3503['id'];}else{return _0x2ec6('0x9');}}function log(_0x19fdda,_0x8f59d2,_0x4adf12,_0xc09ed6,_0x4eee5f,_0x9dec53){loggers[_0x4eee5f['toLowerCase']()][_0x19fdda](_0x2ec6('0xa'),_0x9dec53[_0x2ec6('0xb')](),_0x8f59d2?_0x8f59d2['id']:null,_0x8f59d2?_0x8f59d2[_0x2ec6('0xc')]:null,_0x8f59d2?_0x8f59d2[_0x2ec6('0xd')]:null,getInteractionId(_0x4adf12,_0xc09ed6,_0x4eee5f),_0x4adf12?JSON['stringify'](_0x4adf12):'null');}function updateUser(_0x398515,_0x485060,_0x31bfc1,_0x2f33bd,_0x25bf61){db[_[_0x2ec6('0x7')](_0x2f33bd)+_0x2ec6('0xe')][_0x2ec6('0xf')]({'where':{'id':getInteractionId(_0x485060,_0x31bfc1,_0x2f33bd)}})[_0x2ec6('0x10')](function(_0x40c619){if(_0x40c619){return _0x40c619[_0x2ec6('0x11')]({'UserId':_0x398515?_0x398515['id']:null});}})[_0x2ec6('0x10')](function(_0x5d4b96){if(_0x5d4b96){log(_0x2ec6('0x12'),_0x398515,_0x485060,_0x31bfc1,_0x2f33bd,_0x25bf61);}})[_0x2ec6('0x13')](function(){log(_0x2ec6('0x14'),_0x398515,_0x485060,_0x31bfc1,_0x2f33bd,_0x25bf61);});}exports['tracked']=function(_0x5067f5,_0x482216){return function(_0x15d896,_0x1a25de,_0xf57655){var _0x11e4d4=_0x15d896[_0x2ec6('0x15')];var _0x4d4a29={};var _0x43805c=_0x15d896[_0x2ec6('0x16')];if(_0x4d4a29){_0x4d4a29=_[_0x2ec6('0x17')](_0x15d896['body']);_0x4d4a29=_[_0x2ec6('0x18')](_0x4d4a29,[_0x2ec6('0x19'),_0x2ec6('0x1a'),_0x2ec6('0x1b'),_0x2ec6('0x1c'),'mobile']);}updateUser(_0x11e4d4,_0x4d4a29,_0x43805c,_0x5067f5,_0x482216);_0xf57655(null);};}; \ No newline at end of file +var _0x8453=['role','stringify','null','Interaction','findOne','update','then','info','catch','tracked','query','clone','body','omit','html','fax','mobile','lodash','../../mysqldb','openchannel-interactions','../../config/logger','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name'];(function(_0x4bcf49,_0x422ef0){var _0x3a523e=function(_0x19ed55){while(--_0x19ed55){_0x4bcf49['push'](_0x4bcf49['shift']());}};_0x3a523e(++_0x422ef0);}(_0x8453,0x1f1));var _0x3845=function(_0x21fd16,_0x207486){_0x21fd16=_0x21fd16-0x0;var _0x4af946=_0x8453[_0x21fd16];return _0x4af946;};'use strict';var _=require(_0x3845('0x0'));var db=require(_0x3845('0x1'))['db'];var loggers={'openchannel':require('../../config/logger')(_0x3845('0x2')),'mail':require('../../config/logger')('mail-interactions'),'fax':require(_0x3845('0x3'))(_0x3845('0x4')),'sms':require(_0x3845('0x3'))(_0x3845('0x5')),'chat':require(_0x3845('0x3'))(_0x3845('0x6')),'whatsapp':require('../../config/logger')(_0x3845('0x7'))};function getInteractionId(_0x506118,_0x32d96e,_0x5371e3){if(_0x506118&&_0x506118[_[_0x3845('0x8')](_0x5371e3)+_0x3845('0x9')]){return _0x506118[_['upperFirst'](_0x5371e3)+'InteractionId'];}else if(_0x506118&&_0x506118['id']){return _0x506118['id'];}else if(_0x32d96e&&_0x32d96e['id']){return _0x32d96e['id'];}else{return _0x3845('0xa');}}function log(_0x1b57ab,_0x42e5bc,_0x10d7db,_0x2be8c5,_0x8d621c,_0x390c77){loggers[_0x8d621c[_0x3845('0xb')]()][_0x1b57ab](_0x3845('0xc'),_0x390c77[_0x3845('0xd')](),_0x42e5bc?_0x42e5bc['id']:null,_0x42e5bc?_0x42e5bc[_0x3845('0xe')]:null,_0x42e5bc?_0x42e5bc[_0x3845('0xf')]:null,getInteractionId(_0x10d7db,_0x2be8c5,_0x8d621c),_0x10d7db?JSON[_0x3845('0x10')](_0x10d7db):_0x3845('0x11'));}function updateUser(_0x4dde3d,_0x2511b7,_0x2eeffe,_0x3fa9a6,_0x400e96){db[_[_0x3845('0x8')](_0x3fa9a6)+_0x3845('0x12')][_0x3845('0x13')]({'where':{'id':getInteractionId(_0x2511b7,_0x2eeffe,_0x3fa9a6)}})['then'](function(_0x2df901){if(_0x2df901){return _0x2df901[_0x3845('0x14')]({'UserId':_0x4dde3d?_0x4dde3d['id']:null});}})[_0x3845('0x15')](function(_0x2df0ca){if(_0x2df0ca){log(_0x3845('0x16'),_0x4dde3d,_0x2511b7,_0x2eeffe,_0x3fa9a6,_0x400e96);}})[_0x3845('0x17')](function(){log('error',_0x4dde3d,_0x2511b7,_0x2eeffe,_0x3fa9a6,_0x400e96);});}exports[_0x3845('0x18')]=function(_0x1fa626,_0x496fc1){return function(_0x3c36e7,_0x407333,_0xa99cb5){var _0x372a13=_0x3c36e7['user'];var _0x3ab657={};var _0x1e7ecb=_0x3c36e7[_0x3845('0x19')];if(_0x3ab657){_0x3ab657=_[_0x3845('0x1a')](_0x3c36e7[_0x3845('0x1b')]);_0x3ab657=_[_0x3845('0x1c')](_0x3ab657,[_0x3845('0x1b'),_0x3845('0x1d'),'phone',_0x3845('0x1e'),_0x3845('0x1f')]);}updateUser(_0x372a13,_0x3ab657,_0x1e7ecb,_0x1fa626,_0x496fc1);_0xa99cb5(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 0e12b45..9453cd3 100644 --- a/server/components/license/service.js +++ b/server/components/license/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd9f2=['update','base64','utf8','final','parse','License','then','count','status','catch','users','admin','user','isUserLimit','crypto','util','composable-middleware','../../config/environment','license','data1','split','createDecipher','format'];(function(_0x43a93f,_0xe5b6fe){var _0xa74555=function(_0x20fa13){while(--_0x20fa13){_0x43a93f['push'](_0x43a93f['shift']());}};_0xa74555(++_0xe5b6fe);}(_0xd9f2,0xaf));var _0x2d9f=function(_0xe04fc9,_0xec1021){_0xe04fc9=_0xe04fc9-0x0;var _0x53cd1a=_0xd9f2[_0xe04fc9];return _0x53cd1a;};'use strict';var crypto=require(_0x2d9f('0x0'));var util=require(_0x2d9f('0x1'));var compose=require(_0x2d9f('0x2'));var db=require('../../mysqldb')['db'];var config=require(_0x2d9f('0x3'));function getValueFromLicense(_0x48fe9e,_0x3f569a){if(_0x48fe9e&&_0x3f569a){if(_0x3f569a['data1']&&_0x3f569a[_0x2d9f('0x4')]){var _0x4cc83d=_0x3f569a[_0x2d9f('0x5')];var _0x14b9a3=_0x3f569a[_0x2d9f('0x4')];var _0x490db3=_0x4cc83d[_0x2d9f('0x6')]('-')[0x4];var _0x5e7c19=_0x4cc83d['split']('-')[0x0];var _0x5a627b=crypto[_0x2d9f('0x7')]('aes-256-ctr',util[_0x2d9f('0x8')]('%s:%s:%s',_0x490db3,_0x4cc83d,_0x5e7c19));var _0x77ad30=_0x5a627b[_0x2d9f('0x9')](_0x14b9a3,_0x2d9f('0xa'),_0x2d9f('0xb'));_0x77ad30+=_0x5a627b[_0x2d9f('0xc')]('utf8');var _0xee3743=JSON[_0x2d9f('0xd')](_0x77ad30);return _0xee3743['hasOwnProperty'](_0x48fe9e)?_0xee3743[_0x48fe9e]:null;}}return null;}function isLimit(_0x4f3c08,_0xafbdc2,_0x92c7cf,_0x27c6e3){var _0x3c9db6=_0xafbdc2;return compose()['use'](function(_0x22e888,_0x233d94,_0x3c5116){return db[_0x2d9f('0xe')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0x2d9f('0xf')](function(_0x238413){var _0x3eebdb=getValueFromLicense(_0x4f3c08,_0x238413);return _0x3eebdb?_0x3eebdb:_0x3c9db6;})['then'](function(_0x8df73c){_0x3c9db6=_0x8df73c;return _0x92c7cf[_0x2d9f('0x10')](_0x27c6e3);})[_0x2d9f('0xf')](function(_0x431ab2){if(_0x431ab2>=_0x3c9db6){return _0x233d94[_0x2d9f('0x11')](0x193)['json']({'message':util[_0x2d9f('0x8')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x4f3c08)});}_0x3c5116();})[_0x2d9f('0x12')](function(_0x1ea83b){_0x3c5116(_0x1ea83b);});});}function isUserLimit(){return isLimit(_0x2d9f('0x13'),0x1,db['User'],{'where':{'$or':[{'role':_0x2d9f('0x14')},{'role':_0x2d9f('0x15')}]}});}exports[_0x2d9f('0x16')]=isUserLimit; \ No newline at end of file +var _0xe552=['aes-256-ctr','format','%s:%s:%s','base64','utf8','final','parse','hasOwnProperty','License','findOne','then','count','status','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user','isUserLimit','crypto','util','../../mysqldb','../../config/environment','data1','license','split','createDecipher'];(function(_0x4171a8,_0x2309d6){var _0x41e768=function(_0x575c89){while(--_0x575c89){_0x4171a8['push'](_0x4171a8['shift']());}};_0x41e768(++_0x2309d6);}(_0xe552,0xf4));var _0x2e55=function(_0x4cfa2e,_0x5752b5){_0x4cfa2e=_0x4cfa2e-0x0;var _0x279b50=_0xe552[_0x4cfa2e];return _0x279b50;};'use strict';var crypto=require(_0x2e55('0x0'));var util=require(_0x2e55('0x1'));var compose=require('composable-middleware');var db=require(_0x2e55('0x2'))['db'];var config=require(_0x2e55('0x3'));function getValueFromLicense(_0x1fd1c2,_0x219f47){if(_0x1fd1c2&&_0x219f47){if(_0x219f47[_0x2e55('0x4')]&&_0x219f47[_0x2e55('0x5')]){var _0xbba2be=_0x219f47['data1'];var _0x4db849=_0x219f47[_0x2e55('0x5')];var _0x4f0458=_0xbba2be[_0x2e55('0x6')]('-')[0x4];var _0x4f8cd4=_0xbba2be[_0x2e55('0x6')]('-')[0x0];var _0x26ae81=crypto[_0x2e55('0x7')](_0x2e55('0x8'),util[_0x2e55('0x9')](_0x2e55('0xa'),_0x4f0458,_0xbba2be,_0x4f8cd4));var _0x277eeb=_0x26ae81['update'](_0x4db849,_0x2e55('0xb'),_0x2e55('0xc'));_0x277eeb+=_0x26ae81[_0x2e55('0xd')](_0x2e55('0xc'));var _0x38a823=JSON[_0x2e55('0xe')](_0x277eeb);return _0x38a823[_0x2e55('0xf')](_0x1fd1c2)?_0x38a823[_0x1fd1c2]:null;}}return null;}function isLimit(_0x40cc33,_0xd72dae,_0x137440,_0x3d2ba7){var _0x483e08=_0xd72dae;return compose()['use'](function(_0x43a156,_0x280d61,_0x495bf8){return db[_0x2e55('0x10')][_0x2e55('0x11')]({'where':{'id':0x1},'raw':!![]})[_0x2e55('0x12')](function(_0x12b43c){var _0x1bf586=getValueFromLicense(_0x40cc33,_0x12b43c);return _0x1bf586?_0x1bf586:_0x483e08;})[_0x2e55('0x12')](function(_0x235374){_0x483e08=_0x235374;return _0x137440[_0x2e55('0x13')](_0x3d2ba7);})[_0x2e55('0x12')](function(_0x52ac1d){if(_0x52ac1d>=_0x483e08){return _0x280d61[_0x2e55('0x14')](0x193)['json']({'message':util[_0x2e55('0x9')](_0x2e55('0x15'),_0x40cc33)});}_0x495bf8();})[_0x2e55('0x16')](function(_0x7acd43){_0x495bf8(_0x7acd43);});});}function isUserLimit(){return isLimit(_0x2e55('0x17'),0x1,db[_0x2e55('0x18')],{'where':{'$or':[{'role':_0x2e55('0x19')},{'role':_0x2e55('0x1a')}]}});}exports[_0x2e55('0x1b')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 209d4b9..ef749bb 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 _0xcf95=['DATE','operator','$eq','value','includes','$lte','add','days','format','castTo','text','CAST(','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','=\x20?','<>\x20?','$substring','$endsWith','LIKE\x20?','$lt','<\x20?','$gt','>\x20?','<=\x20?','$gte','$between','BETWEEN\x20?\x20AND\x20?','start','$startsWith','pop','hours','minutes','seconds','lodash','moment','parseSearch','sqlOperator','[$or]','and','replace','split','length','forEach','shift','filter','map'];(function(_0x2a7176,_0x4f2ab7){var _0x246252=function(_0xf3bcd6){while(--_0xf3bcd6){_0x2a7176['push'](_0x2a7176['shift']());}};_0x246252(++_0x4f2ab7);}(_0xcf95,0x193));var _0x5cf9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcf95[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5cf9('0x0'));var moment=require(_0x5cf9('0x1'));exports[_0x5cf9('0x2')]=function(_0x14f4b5){var _0x16c62f={'conditions':[]};_0x16c62f[_0x5cf9('0x3')]=_['startsWith'](_0x14f4b5,_0x5cf9('0x4'))?'or':_0x5cf9('0x5');var _0x5e7952=_0x14f4b5['replace']('[$and]','')[_0x5cf9('0x6')]('[$or]','')[_0x5cf9('0x7')]('||');for(var _0x49b99e=0x0;_0x49b99e<_0x5e7952[_0x5cf9('0x8')];_0x49b99e++){var _0x487886=_0x5e7952[_0x49b99e][_0x5cf9('0x7')](':=');var _0x105bec=_0x487886[0x0];var _0x4af8c6=_0x487886['slice'](0x1);_0x4af8c6[_0x5cf9('0x9')](function(_0x56787f){var _0x450817=_0x56787f['split']('[')[_0x5cf9('0xa')]();var _0x44d0fd=_0x56787f['match'](/\[(.*?)\]/g);_0x44d0fd[_0x5cf9('0x9')](function(_0x11c17f){var _0x16d1ed=_0x11c17f[_0x5cf9('0x7')]('[')[_0x5cf9('0xb')](function(_0x3bd4d6){return _0x3bd4d6['indexOf'](']')>-0x1;})[_0x5cf9('0xc')](function(_0x5e580a){return _0x5e580a[_0x5cf9('0x7')](']')[0x0];})[0x0];_0x16c62f['conditions']['push']({'field':_0x105bec,'operator':_0x450817,'value':_0x16d1ed});});});}return _0x16c62f;};exports['buildExpression']=function(_0x380a65,_0x4d5466,_0x5a692e){var _0x31928f={};if(_0x4d5466===_0x5cf9('0xd')){if(_0x5a692e[_0x5cf9('0xe')]===_0x5cf9('0xf')){_0x5a692e[_0x5cf9('0xe')]='$between';_0x5a692e[_0x5cf9('0x10')]+=','+_0x5a692e[_0x5cf9('0x10')];}else if(_[_0x5cf9('0x11')](['$gt',_0x5cf9('0x12')],_0x5a692e[_0x5cf9('0xe')])){_0x5a692e[_0x5cf9('0x10')]=moment(_0x5a692e[_0x5cf9('0x10')])[_0x5cf9('0x13')](0x1,_0x5cf9('0x14'))[_0x5cf9('0x15')]('YYYY-MM-DD');}}if(_0x5a692e[_0x5cf9('0x16')]){_0x4d5466=_0x5a692e[_0x5cf9('0x16')];_0x31928f[_0x5cf9('0x17')]=_0x5cf9('0x18')+_0x380a65+'.'+_0x5a692e[_0x5cf9('0x19')]+_0x5cf9('0x1a')+_0x5a692e[_0x5cf9('0x16')]+')\x20'+parseOperator(_0x5a692e['operator']);}else{_0x31928f[_0x5cf9('0x17')]=_0x380a65+'.'+_0x5a692e[_0x5cf9('0x19')]+'\x20'+parseOperator(_0x5a692e[_0x5cf9('0xe')]);}if(_[_0x5cf9('0x11')]([_0x5cf9('0x1b'),_0x5cf9('0x1c')],_0x5a692e[_0x5cf9('0xe')]))_0x31928f[_0x5cf9('0x17')]='('+_0x31928f['text']+_0x5cf9('0x1d')+_0x380a65+'.'+_0x5a692e[_0x5cf9('0x19')]+_0x5cf9('0x1e');_0x31928f[_0x5cf9('0x10')]=parseValue(_0x4d5466,_0x5a692e['operator'],_0x5a692e[_0x5cf9('0x10')]);return _0x31928f;};function parseOperator(_0x4e00cf){var _0x59fe7e;switch(_0x4e00cf){case _0x5cf9('0x1f'):_0x59fe7e=_0x5cf9('0x20');break;case _0x5cf9('0x1c'):_0x59fe7e='NOT\x20IN\x20?';break;case _0x5cf9('0xf'):_0x59fe7e=_0x5cf9('0x21');break;case _0x5cf9('0x1b'):_0x59fe7e=_0x5cf9('0x22');break;case _0x5cf9('0x23'):case'$startsWith':case _0x5cf9('0x24'):_0x59fe7e=_0x5cf9('0x25');break;case _0x5cf9('0x26'):_0x59fe7e=_0x5cf9('0x27');break;case _0x5cf9('0x28'):_0x59fe7e=_0x5cf9('0x29');break;case'$lte':_0x59fe7e=_0x5cf9('0x2a');break;case _0x5cf9('0x2b'):_0x59fe7e='>=\x20?';break;case _0x5cf9('0x2c'):_0x59fe7e=_0x5cf9('0x2d');break;}return _0x59fe7e;}function parseValue(_0xd7fb96,_0x1d48c8,_0x12075e){var _0x1810df={'start':undefined,'end':undefined};switch(_0x1d48c8){case'$in':case _0x5cf9('0x1c'):_0x1810df[_0x5cf9('0x2e')]=_0x12075e[_0x5cf9('0x7')](',');break;case _0x5cf9('0x23'):_0x1810df[_0x5cf9('0x2e')]='%'+_0x12075e+'%';break;case _0x5cf9('0x2f'):_0x1810df[_0x5cf9('0x2e')]=_0x12075e+'%';break;case _0x5cf9('0x24'):_0x1810df[_0x5cf9('0x2e')]='%'+_0x12075e;break;case _0x5cf9('0x2c'):var _0x45a9c6=_0x12075e['split'](',');var _0x12075e=_0x45a9c6[_0x5cf9('0xa')]();var _0x150561=_0x45a9c6[_0x5cf9('0x30')]();if(_0xd7fb96===_0x5cf9('0xd')){_0x12075e=moment(_0x12075e)['utcOffset'](0x0,!![])[_0x5cf9('0x15')]();_0x150561=moment(_0x150561)['utcOffset'](0x0,!![])[_0x5cf9('0x13')](0x17,_0x5cf9('0x31'))[_0x5cf9('0x13')](0x3b,_0x5cf9('0x32'))[_0x5cf9('0x13')](0x3b,_0x5cf9('0x33'))['format']();}_0x1810df={'start':_0x12075e,'end':_0x150561};break;default:_0x1810df[_0x5cf9('0x2e')]=_0x12075e;break;}return _0x1810df;} \ No newline at end of file +var _0x3894=['format','minutes','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','and','[$and]','replace','[$or]','split','slice','forEach','filter','indexOf','conditions','push','buildExpression','DATE','operator','$eq','value','$gt','$lte','add','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$notIn','\x20OR\x20','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','$ne','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','<\x20?','<=\x20?','$between','start','shift','pop','utcOffset'];(function(_0x2261ce,_0x9ed8b6){var _0x524640=function(_0x3cbb90){while(--_0x3cbb90){_0x2261ce['push'](_0x2261ce['shift']());}};_0x524640(++_0x9ed8b6);}(_0x3894,0x1d7));var _0x4389=function(_0xf6aec0,_0x51ffd6){_0xf6aec0=_0xf6aec0-0x0;var _0x59a51b=_0x3894[_0xf6aec0];return _0x59a51b;};'use strict';var _=require(_0x4389('0x0'));var moment=require(_0x4389('0x1'));exports[_0x4389('0x2')]=function(_0x20df77){var _0x53b15b={'conditions':[]};_0x53b15b[_0x4389('0x3')]=_[_0x4389('0x4')](_0x20df77,'[$or]')?'or':_0x4389('0x5');var _0xb91d26=_0x20df77['replace'](_0x4389('0x6'),'')[_0x4389('0x7')](_0x4389('0x8'),'')[_0x4389('0x9')]('||');for(var _0x2bb03a=0x0;_0x2bb03a<_0xb91d26['length'];_0x2bb03a++){var _0x37fbfb=_0xb91d26[_0x2bb03a]['split'](':=');var _0x27ad8e=_0x37fbfb[0x0];var _0x23fe92=_0x37fbfb[_0x4389('0xa')](0x1);_0x23fe92[_0x4389('0xb')](function(_0x55a9b7){var _0x1730f=_0x55a9b7[_0x4389('0x9')]('[')['shift']();var _0x3319c6=_0x55a9b7['match'](/\[(.*?)\]/g);_0x3319c6[_0x4389('0xb')](function(_0xe50310){var _0x227f5a=_0xe50310[_0x4389('0x9')]('[')[_0x4389('0xc')](function(_0x5c47a9){return _0x5c47a9[_0x4389('0xd')](']')>-0x1;})['map'](function(_0x1eea14){return _0x1eea14[_0x4389('0x9')](']')[0x0];})[0x0];_0x53b15b[_0x4389('0xe')][_0x4389('0xf')]({'field':_0x27ad8e,'operator':_0x1730f,'value':_0x227f5a});});});}return _0x53b15b;};exports[_0x4389('0x10')]=function(_0x29c596,_0x245f9a,_0x5f06cf){var _0x46441f={};if(_0x245f9a===_0x4389('0x11')){if(_0x5f06cf[_0x4389('0x12')]===_0x4389('0x13')){_0x5f06cf[_0x4389('0x12')]='$between';_0x5f06cf[_0x4389('0x14')]+=','+_0x5f06cf['value'];}else if(_['includes']([_0x4389('0x15'),_0x4389('0x16')],_0x5f06cf['operator'])){_0x5f06cf[_0x4389('0x14')]=moment(_0x5f06cf[_0x4389('0x14')])[_0x4389('0x17')](0x1,'days')['format'](_0x4389('0x18'));}}if(_0x5f06cf[_0x4389('0x19')]){_0x245f9a=_0x5f06cf['castTo'];_0x46441f[_0x4389('0x1a')]=_0x4389('0x1b')+_0x29c596+'.'+_0x5f06cf[_0x4389('0x1c')]+_0x4389('0x1d')+_0x5f06cf[_0x4389('0x19')]+')\x20'+parseOperator(_0x5f06cf[_0x4389('0x12')]);}else{_0x46441f[_0x4389('0x1a')]=_0x29c596+'.'+_0x5f06cf[_0x4389('0x1c')]+'\x20'+parseOperator(_0x5f06cf[_0x4389('0x12')]);}if(_['includes'](['$ne',_0x4389('0x1e')],_0x5f06cf[_0x4389('0x12')]))_0x46441f['text']='('+_0x46441f[_0x4389('0x1a')]+_0x4389('0x1f')+_0x29c596+'.'+_0x5f06cf['field']+'\x20IS\x20NULL)';_0x46441f[_0x4389('0x14')]=parseValue(_0x245f9a,_0x5f06cf[_0x4389('0x12')],_0x5f06cf[_0x4389('0x14')]);return _0x46441f;};function parseOperator(_0x2f0e43){var _0x149683;switch(_0x2f0e43){case _0x4389('0x20'):_0x149683=_0x4389('0x21');break;case _0x4389('0x1e'):_0x149683=_0x4389('0x22');break;case'$eq':_0x149683=_0x4389('0x23');break;case _0x4389('0x24'):_0x149683=_0x4389('0x25');break;case _0x4389('0x26'):case _0x4389('0x27'):case _0x4389('0x28'):_0x149683=_0x4389('0x29');break;case'$lt':_0x149683=_0x4389('0x2a');break;case _0x4389('0x15'):_0x149683='>\x20?';break;case _0x4389('0x16'):_0x149683=_0x4389('0x2b');break;case'$gte':_0x149683='>=\x20?';break;case _0x4389('0x2c'):_0x149683='BETWEEN\x20?\x20AND\x20?';break;}return _0x149683;}function parseValue(_0x3112a3,_0x466969,_0x4b2dd8){var _0x39b22d={'start':undefined,'end':undefined};switch(_0x466969){case _0x4389('0x20'):case'$notIn':_0x39b22d[_0x4389('0x2d')]=_0x4b2dd8[_0x4389('0x9')](',');break;case _0x4389('0x26'):_0x39b22d[_0x4389('0x2d')]='%'+_0x4b2dd8+'%';break;case _0x4389('0x27'):_0x39b22d[_0x4389('0x2d')]=_0x4b2dd8+'%';break;case _0x4389('0x28'):_0x39b22d['start']='%'+_0x4b2dd8;break;case _0x4389('0x2c'):var _0x53b4b9=_0x4b2dd8[_0x4389('0x9')](',');var _0x4b2dd8=_0x53b4b9[_0x4389('0x2e')]();var _0x2dcce1=_0x53b4b9[_0x4389('0x2f')]();if(_0x3112a3===_0x4389('0x11')){_0x4b2dd8=moment(_0x4b2dd8)[_0x4389('0x30')](0x0,!![])[_0x4389('0x31')]();_0x2dcce1=moment(_0x2dcce1)[_0x4389('0x30')](0x0,!![])[_0x4389('0x17')](0x17,'hours')[_0x4389('0x17')](0x3b,_0x4389('0x32'))[_0x4389('0x17')](0x3b,_0x4389('0x33'))[_0x4389('0x31')]();}_0x39b22d={'start':_0x4b2dd8,'end':_0x2dcce1};break;default:_0x39b22d['start']=_0x4b2dd8;break;}return _0x39b22d;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index e3bf089..54da560 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 _0x57a6=['model','attributes','fields','nolimit','order','where','pick','filter','lower','options','lodash','sequelize','moment','parse','includes','split','filters','isEmpty','forOwn','type','isPlainObject','$gte','format','YYYY-MM-DD','utc','subtract','name','uniqueid','isArray','limit','offset','sort','map','indexOf','priority','cast','unsigned','col','omit','length','isObject','isString','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','replace','push','join','getOptions','query','$id','keys','intersection'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x57a6,0x122));var _0x657a=function(_0x3a12fc,_0x22c494){_0x3a12fc=_0x3a12fc-0x0;var _0x5abed1=_0x57a6[_0x3a12fc];return _0x5abed1;};'use strict';var _=require(_0x657a('0x0'));var sequelize=require(_0x657a('0x1'));var moment=require(_0x657a('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x5bb917){var _0x54de70=['ne'];try{var _0x4c854c=JSON[_0x657a('0x3')](_0x5bb917);var _0x2eee36=Object['keys'](_0x4c854c)[0x0];return _0x54de70[_0x657a('0x4')](_0x2eee36);}catch(_0x4f39c6){return![];}}function getOperatorValue(_0x26c1ce){var _0x398a87=JSON[_0x657a('0x3')](_0x26c1ce);var _0x5abf37=Object['keys'](_0x398a87)[0x0];var _0x4b04e8=_0x398a87[_0x5abf37];return{['$'+_0x5abf37]:_0x4b04e8};}exports['fields']=function(_0x6798cd){var _0x35c664=null;if(_0x6798cd){_0x35c664=_0x6798cd[_0x657a('0x5')](',');}return _0x35c664;};exports[_0x657a('0x6')]=function(_0x2f873d,_0x4d9817){var _0x5a510c={};if(!_[_0x657a('0x7')](_0x2f873d)){_[_0x657a('0x8')](_0x2f873d,function(_0x1fba2c,_0x48ae30){try{if(_0x4d9817){var _0x3b995a=_['find'](_0x4d9817,{'name':_0x48ae30})||{};if(hasSequelizeOperator(_0x1fba2c)){_0x5a510c[_0x48ae30]=getOperatorValue(_0x1fba2c);}else if(_0x3b995a[_0x657a('0x9')]==='DATE'&&_[_0x657a('0xa')](_0x1fba2c)){var _0x424c7a=JSON[_0x657a('0x3')](_0x1fba2c);var _0x445245={'$gte':moment(moment(_0x424c7a[_0x657a('0xb')])[_0x657a('0xc')](_0x657a('0xd')))[_0x657a('0xe')]()[_0x657a('0xc')](),'$lte':moment(moment(_0x424c7a['$lte'])[_0x657a('0xc')](_0x657a('0xd')))[_0x657a('0xe')]()[_0x657a('0xf')](0x1,'s')[_0x657a('0xc')]()};_0x5a510c[_0x48ae30]=_0x445245;}else if(_0x3b995a[_0x657a('0x10')]===_0x657a('0x11')){_0x5a510c[_0x48ae30]=_0x1fba2c;}else{_0x5a510c[_0x48ae30]=_[_0x657a('0x12')](_0x1fba2c)?_0x1fba2c:JSON[_0x657a('0x3')](_0x1fba2c);}}else{_0x5a510c[_0x48ae30]=_[_0x657a('0x12')](_0x1fba2c)?_0x1fba2c:JSON[_0x657a('0x3')](_0x1fba2c);}}catch(_0x1a6c4e){_0x5a510c[_0x48ae30]=_0x1fba2c[_0x657a('0x5')](',');}});}return _0x5a510c;};exports[_0x657a('0x13')]=function(_0x43b671){_0x43b671=parseInt(_0x43b671,0xa);if(!_0x43b671||_0x43b671<0x0){_0x43b671=LIMIT_VALUE;}return _0x43b671;};exports[_0x657a('0x14')]=function(_0x16e69e){_0x16e69e=parseInt(_0x16e69e,0xa);if(!_0x16e69e||_0x16e69e<0x0){_0x16e69e=0x0;}return _0x16e69e;};exports[_0x657a('0x15')]=function(_0x13fb26){var _0x593495,_0x2dcd1b=null;if(_0x13fb26){_0x593495=_0x13fb26[_0x657a('0x5')](',');_0x2dcd1b=_[_0x657a('0x16')](_0x593495,function(_0x1add12){if(_0x1add12[_0x657a('0x17')]('-')===0x0){return[_0x1add12===_0x657a('0x18')?sequelize[_0x657a('0x19')](sequelize['col'](_0x657a('0x18')),_0x657a('0x1a')):_0x1add12['substr'](0x1),'DESC'];}else{return[_0x1add12==='priority'?sequelize[_0x657a('0x19')](sequelize[_0x657a('0x1b')](_0x657a('0x18')),'unsigned'):_0x1add12,'ASC'];}});}return _0x2dcd1b;};exports[_0x657a('0x1c')]=function(_0xa9678c,_0x487888){if(_[_0x657a('0x7')](_0xa9678c)){return _0xa9678c;}if(_[_0x657a('0x12')](_0xa9678c)){for(var _0x16a34a=0x0;_0x16a34a<_0xa9678c[_0x657a('0x1d')];_0x16a34a+=0x1){_0xa9678c[_0x16a34a]=this[_0x657a('0x1c')](_0xa9678c[_0x16a34a],_0x487888);}return _0xa9678c;}if(!_[_0x657a('0x1e')](_0xa9678c)){return _0xa9678c;}if(_[_0x657a('0x1f')](_0x487888)){_0x487888=[_0x487888];}if(!_[_0x657a('0x12')](_0x487888)){return _0xa9678c;}for(var _0x414aa4=0x0;_0x414aa4<_0x487888[_0x657a('0x1d')];_0x414aa4+=0x1){_[_0x657a('0x20')](_0xa9678c,_0x487888[_0x414aa4]);}for(var _0x53ba9a in _0xa9678c){if(_0xa9678c[_0x657a('0x21')](_0x53ba9a)){_0xa9678c[_0x53ba9a]=this[_0x657a('0x1c')](_0xa9678c[_0x53ba9a],_0x487888);}}return _0xa9678c;};exports[_0x657a('0x22')]=function(_0x2e778b){return _0x2e778b[_0x657a('0x23')](RegExp(_0x657a('0x24')))?!![]:![];};exports[_0x657a('0x25')]=function(_0x38a5c7){return _0x38a5c7[_0x657a('0x23')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x51c078){var _0x3394a8=[];_0x51c078[_0x657a('0x5')](/[ ,]+/)['forEach'](function(_0x33f05d){_0x33f05d=_0x33f05d[_0x657a('0x26')](/([^:]")"+/g,'$1');_0x33f05d='+'+_0x33f05d+'*';if(_0x33f05d['includes']('@'))_0x33f05d='\x22'+_0x33f05d+'\x22';_0x3394a8[_0x657a('0x27')](_0x33f05d);});return _0x3394a8[_0x657a('0x28')]('\x20');};exports[_0x657a('0x29')]=function(_0x3b020e,_0x1d191d,_0x551b67){var _0x35b2ce={},_0x121a28={};if(_0x1d191d[_0x657a('0x2a')][_0x657a('0x2b')]){_0x1d191d['query']['id']=_0x1d191d['query'][_0x657a('0x2b')];delete _0x1d191d[_0x657a('0x2a')]['$id'];}_0x35b2ce['model']=_[_0x657a('0x16')](_0x3b020e,_0x657a('0x10'));_0x35b2ce['query']=_[_0x657a('0x2c')](_0x1d191d['query']);_0x35b2ce[_0x657a('0x6')]=_[_0x657a('0x2d')](_0x35b2ce[_0x657a('0x2e')],_0x35b2ce[_0x657a('0x2a')]);_0x121a28[_0x657a('0x2f')]=_[_0x657a('0x2d')](_0x35b2ce[_0x657a('0x2e')],this['fields'](_0x1d191d['query'][_0x657a('0x30')]));_0x121a28[_0x657a('0x2f')]=_0x121a28[_0x657a('0x2f')][_0x657a('0x1d')]?_0x121a28[_0x657a('0x2f')]:_0x35b2ce[_0x657a('0x2e')];if(!_0x1d191d[_0x657a('0x2a')][_0x657a('0x21')](_0x657a('0x31'))){_0x121a28['limit']=this['limit'](_0x1d191d['query'][_0x657a('0x13')]);_0x121a28[_0x657a('0x14')]=this[_0x657a('0x14')](_0x1d191d[_0x657a('0x2a')][_0x657a('0x14')]);}_0x121a28[_0x657a('0x32')]=this[_0x657a('0x15')](_0x1d191d[_0x657a('0x2a')][_0x657a('0x15')]);_0x121a28[_0x657a('0x33')]=this[_0x657a('0x6')](_[_0x657a('0x34')](_0x1d191d[_0x657a('0x2a')],_0x35b2ce[_0x657a('0x6')]),_0x3b020e);if(_0x1d191d[_0x657a('0x2a')][_0x657a('0x35')]){_0x121a28[_0x657a('0x33')]=_['merge'](_0x121a28['where'],{'$or':_['map'](_0x3b020e,function(_0xcbf991){if(_0xcbf991[_0x657a('0x9')]!=='VIRTUAL'){if(_0x551b67){return sequelize[_0x657a('0x33')](sequelize['fn'](_0x657a('0x36'),sequelize['col'](_0xcbf991[_0x657a('0x10')])),{'$like':sequelize['fn'](_0x657a('0x36'),'%'+_0x1d191d[_0x657a('0x2a')][_0x657a('0x35')]+'%')});}else{var _0x4b540f={};_0x4b540f[_0xcbf991[_0x657a('0x10')]]={'$like':'%'+_0x1d191d[_0x657a('0x2a')][_0x657a('0x35')]+'%'};return _0x4b540f;}}})});}_0x121a28=_['merge']({},_0x121a28,_0x1d191d[_0x657a('0x37')]);return _0x121a28;}; \ No newline at end of file +var _0x624a=['omit','length','isObject','isString','unset','hasOwnProperty','isNumeric','^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','push','join','query','$id','model','attributes','intersection','order','where','filters','pick','filter','merge','type','lower','options','lodash','sequelize','moment','parse','keys','includes','fields','split','isEmpty','find','isPlainObject','$gte','format','YYYY-MM-DD','subtract','name','uniqueid','isArray','limit','offset','sort','map','indexOf','cast','col','priority','unsigned','substr','DESC','ASC'];(function(_0x4bd573,_0x186ad4){var _0x1d7704=function(_0x2a51ad){while(--_0x2a51ad){_0x4bd573['push'](_0x4bd573['shift']());}};_0x1d7704(++_0x186ad4);}(_0x624a,0xff));var _0xa624=function(_0xcb0eb2,_0x3906bf){_0xcb0eb2=_0xcb0eb2-0x0;var _0xbab9b8=_0x624a[_0xcb0eb2];return _0xbab9b8;};'use strict';var _=require(_0xa624('0x0'));var sequelize=require(_0xa624('0x1'));var moment=require(_0xa624('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x328f2e){var _0x569c72=['ne'];try{var _0x1627b9=JSON[_0xa624('0x3')](_0x328f2e);var _0x431c56=Object[_0xa624('0x4')](_0x1627b9)[0x0];return _0x569c72[_0xa624('0x5')](_0x431c56);}catch(_0x28e25e){return![];}}function getOperatorValue(_0x5aafcf){var _0x31bc08=JSON[_0xa624('0x3')](_0x5aafcf);var _0x4750d5=Object[_0xa624('0x4')](_0x31bc08)[0x0];var _0x3c661b=_0x31bc08[_0x4750d5];return{['$'+_0x4750d5]:_0x3c661b};}exports[_0xa624('0x6')]=function(_0x251b60){var _0x320bff=null;if(_0x251b60){_0x320bff=_0x251b60[_0xa624('0x7')](',');}return _0x320bff;};exports['filters']=function(_0x177bf0,_0x28c9f0){var _0x3b3ab8={};if(!_[_0xa624('0x8')](_0x177bf0)){_['forOwn'](_0x177bf0,function(_0x292d4f,_0x84ae46){try{if(_0x28c9f0){var _0x2cf39a=_[_0xa624('0x9')](_0x28c9f0,{'name':_0x84ae46})||{};if(hasSequelizeOperator(_0x292d4f)){_0x3b3ab8[_0x84ae46]=getOperatorValue(_0x292d4f);}else if(_0x2cf39a['type']==='DATE'&&_[_0xa624('0xa')](_0x292d4f)){var _0x598b0c=JSON[_0xa624('0x3')](_0x292d4f);var _0x516b2d={'$gte':moment(moment(_0x598b0c[_0xa624('0xb')])[_0xa624('0xc')](_0xa624('0xd')))['utc']()[_0xa624('0xc')](),'$lte':moment(moment(_0x598b0c['$lte'])[_0xa624('0xc')]('YYYY-MM-DD'))['utc']()[_0xa624('0xe')](0x1,'s')[_0xa624('0xc')]()};_0x3b3ab8[_0x84ae46]=_0x516b2d;}else if(_0x2cf39a[_0xa624('0xf')]===_0xa624('0x10')){_0x3b3ab8[_0x84ae46]=_0x292d4f;}else{_0x3b3ab8[_0x84ae46]=_[_0xa624('0x11')](_0x292d4f)?_0x292d4f:JSON[_0xa624('0x3')](_0x292d4f);}}else{_0x3b3ab8[_0x84ae46]=_[_0xa624('0x11')](_0x292d4f)?_0x292d4f:JSON['parse'](_0x292d4f);}}catch(_0x364735){_0x3b3ab8[_0x84ae46]=_0x292d4f[_0xa624('0x7')](',');}});}return _0x3b3ab8;};exports[_0xa624('0x12')]=function(_0x30b727){_0x30b727=parseInt(_0x30b727,0xa);if(!_0x30b727||_0x30b727<0x0){_0x30b727=LIMIT_VALUE;}return _0x30b727;};exports[_0xa624('0x13')]=function(_0x23960f){_0x23960f=parseInt(_0x23960f,0xa);if(!_0x23960f||_0x23960f<0x0){_0x23960f=0x0;}return _0x23960f;};exports[_0xa624('0x14')]=function(_0x2f4929){var _0xf7c31f,_0x186cd9=null;if(_0x2f4929){_0xf7c31f=_0x2f4929[_0xa624('0x7')](',');_0x186cd9=_[_0xa624('0x15')](_0xf7c31f,function(_0x3cb73b){if(_0x3cb73b[_0xa624('0x16')]('-')===0x0){return[_0x3cb73b==='priority'?sequelize[_0xa624('0x17')](sequelize[_0xa624('0x18')](_0xa624('0x19')),_0xa624('0x1a')):_0x3cb73b[_0xa624('0x1b')](0x1),_0xa624('0x1c')];}else{return[_0x3cb73b===_0xa624('0x19')?sequelize[_0xa624('0x17')](sequelize[_0xa624('0x18')]('priority'),_0xa624('0x1a')):_0x3cb73b,_0xa624('0x1d')];}});}return _0x186cd9;};exports[_0xa624('0x1e')]=function(_0x8e551d,_0xcaf37b){if(_[_0xa624('0x8')](_0x8e551d)){return _0x8e551d;}if(_['isArray'](_0x8e551d)){for(var _0xc86f15=0x0;_0xc86f15<_0x8e551d[_0xa624('0x1f')];_0xc86f15+=0x1){_0x8e551d[_0xc86f15]=this[_0xa624('0x1e')](_0x8e551d[_0xc86f15],_0xcaf37b);}return _0x8e551d;}if(!_[_0xa624('0x20')](_0x8e551d)){return _0x8e551d;}if(_[_0xa624('0x21')](_0xcaf37b)){_0xcaf37b=[_0xcaf37b];}if(!_[_0xa624('0x11')](_0xcaf37b)){return _0x8e551d;}for(var _0x296b40=0x0;_0x296b40<_0xcaf37b[_0xa624('0x1f')];_0x296b40+=0x1){_[_0xa624('0x22')](_0x8e551d,_0xcaf37b[_0x296b40]);}for(var _0x2d2a0b in _0x8e551d){if(_0x8e551d[_0xa624('0x23')](_0x2d2a0b)){_0x8e551d[_0x2d2a0b]=this[_0xa624('0x1e')](_0x8e551d[_0x2d2a0b],_0xcaf37b);}}return _0x8e551d;};exports[_0xa624('0x24')]=function(_0x35e813){return _0x35e813['match'](RegExp(_0xa624('0x25')))?!![]:![];};exports[_0xa624('0x26')]=function(_0x2b26a6){return _0x2b26a6['match'](/^\S+@\S+$/)?!![]:![];};exports[_0xa624('0x27')]=function(_0x56860c){var _0x5d44d0=[];_0x56860c[_0xa624('0x7')](/[ ,]+/)[_0xa624('0x28')](function(_0x56312f){_0x56312f=_0x56312f['replace'](/([^:]")"+/g,'$1');_0x56312f='+'+_0x56312f+'*';if(_0x56312f[_0xa624('0x5')]('@'))_0x56312f='\x22'+_0x56312f+'\x22';_0x5d44d0[_0xa624('0x29')](_0x56312f);});return _0x5d44d0[_0xa624('0x2a')]('\x20');};exports['getOptions']=function(_0x3212db,_0x44df96,_0xbdd47b){var _0x46791b={},_0x37607f={};if(_0x44df96[_0xa624('0x2b')][_0xa624('0x2c')]){_0x44df96['query']['id']=_0x44df96[_0xa624('0x2b')]['$id'];delete _0x44df96[_0xa624('0x2b')]['$id'];}_0x46791b['model']=_[_0xa624('0x15')](_0x3212db,_0xa624('0xf'));_0x46791b[_0xa624('0x2b')]=_[_0xa624('0x4')](_0x44df96[_0xa624('0x2b')]);_0x46791b['filters']=_['intersection'](_0x46791b[_0xa624('0x2d')],_0x46791b['query']);_0x37607f[_0xa624('0x2e')]=_[_0xa624('0x2f')](_0x46791b[_0xa624('0x2d')],this[_0xa624('0x6')](_0x44df96[_0xa624('0x2b')][_0xa624('0x6')]));_0x37607f['attributes']=_0x37607f[_0xa624('0x2e')][_0xa624('0x1f')]?_0x37607f[_0xa624('0x2e')]:_0x46791b[_0xa624('0x2d')];if(!_0x44df96[_0xa624('0x2b')][_0xa624('0x23')]('nolimit')){_0x37607f[_0xa624('0x12')]=this[_0xa624('0x12')](_0x44df96[_0xa624('0x2b')][_0xa624('0x12')]);_0x37607f[_0xa624('0x13')]=this[_0xa624('0x13')](_0x44df96[_0xa624('0x2b')][_0xa624('0x13')]);}_0x37607f[_0xa624('0x30')]=this[_0xa624('0x14')](_0x44df96[_0xa624('0x2b')]['sort']);_0x37607f[_0xa624('0x31')]=this[_0xa624('0x32')](_[_0xa624('0x33')](_0x44df96[_0xa624('0x2b')],_0x46791b['filters']),_0x3212db);if(_0x44df96[_0xa624('0x2b')][_0xa624('0x34')]){_0x37607f[_0xa624('0x31')]=_[_0xa624('0x35')](_0x37607f['where'],{'$or':_[_0xa624('0x15')](_0x3212db,function(_0x399b89){if(_0x399b89[_0xa624('0x36')]!=='VIRTUAL'){if(_0xbdd47b){return sequelize[_0xa624('0x31')](sequelize['fn'](_0xa624('0x37'),sequelize['col'](_0x399b89[_0xa624('0xf')])),{'$like':sequelize['fn'](_0xa624('0x37'),'%'+_0x44df96[_0xa624('0x2b')][_0xa624('0x34')]+'%')});}else{var _0x946503={};_0x946503[_0x399b89['name']]={'$like':'%'+_0x44df96[_0xa624('0x2b')][_0xa624('0x34')]+'%'};return _0x946503;}}})});}_0x37607f=_[_0xa624('0x35')]({},_0x37607f,_0x44df96[_0xa624('0x38')]);return _0x37607f;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index c8b8707..1c6e06c 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x85e9=['express','serve-favicon','method-override','cookie-parser','errorhandler','passport','cors','./environment','../mysqldb','get','env','set','appPath','root','public','development','join','client','json\x20replacer','toISOString','use','static','views','/server/views','engine','renderFile','view\x20engine','urlencoded','50mb','json','initialize'];(function(_0xd36ecf,_0xbc090b){var _0x15847a=function(_0x345247){while(--_0x345247){_0xd36ecf['push'](_0xd36ecf['shift']());}};_0x15847a(++_0xbc090b);}(_0x85e9,0x193));var _0x985e=function(_0x72d420,_0x48358f){_0x72d420=_0x72d420-0x0;var _0x3649cc=_0x85e9[_0x72d420];return _0x3649cc;};'use strict';var express=require(_0x985e('0x0'));var favicon=require(_0x985e('0x1'));var bodyParser=require('body-parser');var methodOverride=require(_0x985e('0x2'));var cookieParser=require(_0x985e('0x3'));var errorHandler=require(_0x985e('0x4'));var path=require('path');var passport=require(_0x985e('0x5'));var cors=require(_0x985e('0x6'));var moment=require('moment');var config=require(_0x985e('0x7'));var db=require(_0x985e('0x8'))['db'];exports['default']=function(_0xdd1cb5){var _0xf512b0=_0xdd1cb5[_0x985e('0x9')](_0x985e('0xa'));if(_0xf512b0==='production'){_0xdd1cb5[_0x985e('0xb')](_0x985e('0xc'),path['join'](config[_0x985e('0xd')],_0x985e('0xe')));}if(_0xf512b0===_0x985e('0xf')||_0xf512b0==='test'){_0xdd1cb5['set']('appPath',path[_0x985e('0x10')](config['root'],_0x985e('0x11')));_0xdd1cb5['use'](errorHandler());}_0xdd1cb5['set'](_0x985e('0x12'),function(_0x309894,_0x4287a1){if(this[_0x309894]instanceof Date){_0x4287a1=this[_0x309894][_0x985e('0x13')]()['split']('.')[0x0]+'Z';}return _0x4287a1;});_0xdd1cb5[_0x985e('0x14')](express[_0x985e('0x15')](_0xdd1cb5[_0x985e('0x9')](_0x985e('0xc'))));_0xdd1cb5[_0x985e('0xb')](_0x985e('0x16'),config[_0x985e('0xd')]+_0x985e('0x17'));_0xdd1cb5[_0x985e('0x18')]('html',require('ejs')[_0x985e('0x19')]);_0xdd1cb5[_0x985e('0xb')](_0x985e('0x1a'),'html');_0xdd1cb5['use'](bodyParser[_0x985e('0x1b')]({'limit':_0x985e('0x1c'),'extended':!![]}));_0xdd1cb5[_0x985e('0x14')](bodyParser[_0x985e('0x1d')]({'limit':'50mb'}));_0xdd1cb5[_0x985e('0x14')](cors());_0xdd1cb5[_0x985e('0x14')](methodOverride());_0xdd1cb5[_0x985e('0x14')](cookieParser());_0xdd1cb5['use'](passport[_0x985e('0x1e')]());}; \ No newline at end of file +var _0x508d=['get','env','production','set','appPath','development','test','root','client','use','toISOString','split','static','views','/server/views','engine','ejs','renderFile','view\x20engine','html','urlencoded','50mb','initialize','serve-favicon','body-parser','method-override','errorhandler','path','moment','./environment','../mysqldb'];(function(_0x576702,_0x32bd3e){var _0x16f020=function(_0x3d2d8a){while(--_0x3d2d8a){_0x576702['push'](_0x576702['shift']());}};_0x16f020(++_0x32bd3e);}(_0x508d,0x12e));var _0xd508=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x508d[_0x2641f9];return _0x585741;};'use strict';var express=require('express');var favicon=require(_0xd508('0x0'));var bodyParser=require(_0xd508('0x1'));var methodOverride=require(_0xd508('0x2'));var cookieParser=require('cookie-parser');var errorHandler=require(_0xd508('0x3'));var path=require(_0xd508('0x4'));var passport=require('passport');var cors=require('cors');var moment=require(_0xd508('0x5'));var config=require(_0xd508('0x6'));var db=require(_0xd508('0x7'))['db'];exports['default']=function(_0x270465){var _0x5ba8b4=_0x270465[_0xd508('0x8')](_0xd508('0x9'));if(_0x5ba8b4===_0xd508('0xa')){_0x270465[_0xd508('0xb')](_0xd508('0xc'),path['join'](config['root'],'public'));}if(_0x5ba8b4===_0xd508('0xd')||_0x5ba8b4===_0xd508('0xe')){_0x270465[_0xd508('0xb')](_0xd508('0xc'),path['join'](config[_0xd508('0xf')],_0xd508('0x10')));_0x270465[_0xd508('0x11')](errorHandler());}_0x270465[_0xd508('0xb')]('json\x20replacer',function(_0x1fe63d,_0x21608d){if(this[_0x1fe63d]instanceof Date){_0x21608d=this[_0x1fe63d][_0xd508('0x12')]()[_0xd508('0x13')]('.')[0x0]+'Z';}return _0x21608d;});_0x270465[_0xd508('0x11')](express[_0xd508('0x14')](_0x270465[_0xd508('0x8')](_0xd508('0xc'))));_0x270465[_0xd508('0xb')](_0xd508('0x15'),config['root']+_0xd508('0x16'));_0x270465[_0xd508('0x17')]('html',require(_0xd508('0x18'))[_0xd508('0x19')]);_0x270465['set'](_0xd508('0x1a'),_0xd508('0x1b'));_0x270465[_0xd508('0x11')](bodyParser[_0xd508('0x1c')]({'limit':_0xd508('0x1d'),'extended':!![]}));_0x270465[_0xd508('0x11')](bodyParser['json']({'limit':_0xd508('0x1d')}));_0x270465[_0xd508('0x11')](cors());_0x270465['use'](methodOverride());_0x270465['use'](cookieParser());_0x270465['use'](passport[_0xd508('0x1e')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 3e7af0a..a8bb544 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 _0x4bac=['utf8','replace','macAddress','ipAddress','substring','crypto','execSync','orderBy','filter','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','cpus','map','model','join','createHash','md5','update','digest','hex','getUuid','platform','test','licenseToken','win32'];(function(_0x313e64,_0x1e2019){var _0x9d4f24=function(_0x8f18f4){while(--_0x8f18f4){_0x313e64['push'](_0x313e64['shift']());}};_0x9d4f24(++_0x1e2019);}(_0x4bac,0x113));var _0xc4ba=function(_0x522c6c,_0x18f153){_0x522c6c=_0x522c6c-0x0;var _0xc8f69e=_0x4bac[_0x522c6c];return _0xc8f69e;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0xc4ba('0x0'));var machine=require('bimedia-machine-uuid');var exec=require('child_process')[_0xc4ba('0x1')];var config=require('../environment');function getInterfaces(){var _0x27a1c6=[];var _0x21e005=os['networkInterfaces']();var _0x294593=_[_0xc4ba('0x2')](_['keys'](_0x21e005));for(var _0x1d3139=0x0;_0x1d3139<_0x294593['length'];_0x1d3139++){var _0x1b7eda=_0x21e005[_0x294593[_0x1d3139]][_0xc4ba('0x3')](function(_0x1852ac){return _0x1852ac['family']==='IPv4'&&_0x1852ac[_0xc4ba('0x4')]===![];});_0x27a1c6=_0x27a1c6[_0xc4ba('0x5')](_0x1b7eda);}return _0x27a1c6;}function getFirstInterface(){var _0x5f3eee=_[_0xc4ba('0x6')](getInterfaces());return{'macAddress':_0x5f3eee&&_0x5f3eee['mac']?_0x5f3eee[_0xc4ba('0x7')]:_0xc4ba('0x8'),'ipAddress':_0x5f3eee&&_0x5f3eee[_0xc4ba('0x9')]?_0x5f3eee[_0xc4ba('0x9')]:_0xc4ba('0xa')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0xe8c7d3=_[_0xc4ba('0x2')](os[_0xc4ba('0xb')]()[_0xc4ba('0xc')](function(_0x426f5b){return _0x426f5b[_0xc4ba('0xd')];}))[_0xc4ba('0xe')](':');return crypto[_0xc4ba('0xf')](_0xc4ba('0x10'))[_0xc4ba('0x11')](_0xe8c7d3)[_0xc4ba('0x12')](_0xc4ba('0x13'));}exports[_0xc4ba('0x14')]=function(){var _0x4c38b1=os[_0xc4ba('0x15')]();var _0x5a2dc2=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x5a2dc2[_0xc4ba('0x16')](config[_0xc4ba('0x17')])){return config['licenseToken'];}else if(_0x4c38b1===_0xc4ba('0x18')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0xc4ba('0x19')})[_0xc4ba('0x1a')]('\x0d\x0a','');}else{var _0x7b66de=getFirstInterface();var _0x4432e5=getCPUhash();var _0x12d77e=_0x4432e5+'|'+os['hostname']()+'|'+_0x7b66de[_0xc4ba('0x1b')]+'|'+_0x7b66de[_0xc4ba('0x1c')];var _0x220105=crypto['createHash'](_0xc4ba('0x10'))[_0xc4ba('0x11')](_0x12d77e)[_0xc4ba('0x12')](_0xc4ba('0x13'));return _0x220105[_0xc4ba('0x1d')](0x0,0x8)+'-'+_0x220105['substring'](0x8,0xc)+'-'+_0x220105[_0xc4ba('0x1d')](0xc,0x10)+'-'+_0x220105['substring'](0x10,0x14)+'-'+_0x220105[_0xc4ba('0x1d')](0x14);}}; \ No newline at end of file +var _0x5353=['model','join','createHash','update','digest','hex','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','hostname','macAddress','ipAddress','substring','lodash','crypto','child_process','execSync','orderBy','keys','length','filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus'];(function(_0x52a6e3,_0x4a73b4){var _0x8910d0=function(_0x57e5ef){while(--_0x57e5ef){_0x52a6e3['push'](_0x52a6e3['shift']());}};_0x8910d0(++_0x4a73b4);}(_0x5353,0x1c1));var _0x3535=function(_0x3ff173,_0x548e76){_0x3ff173=_0x3ff173-0x0;var _0x1d0d72=_0x5353[_0x3ff173];return _0x1d0d72;};'use strict';var _=require(_0x3535('0x0'));var os=require('os');var crypto=require(_0x3535('0x1'));var machine=require('bimedia-machine-uuid');var exec=require(_0x3535('0x2'))[_0x3535('0x3')];var config=require('../environment');function getInterfaces(){var _0x54a73f=[];var _0xcae5ae=os['networkInterfaces']();var _0x54caa6=_[_0x3535('0x4')](_[_0x3535('0x5')](_0xcae5ae));for(var _0x3386db=0x0;_0x3386db<_0x54caa6[_0x3535('0x6')];_0x3386db++){var _0x33b066=_0xcae5ae[_0x54caa6[_0x3386db]][_0x3535('0x7')](function(_0x164885){return _0x164885[_0x3535('0x8')]===_0x3535('0x9')&&_0x164885[_0x3535('0xa')]===![];});_0x54a73f=_0x54a73f[_0x3535('0xb')](_0x33b066);}return _0x54a73f;}function getFirstInterface(){var _0x3944e5=_[_0x3535('0xc')](getInterfaces());return{'macAddress':_0x3944e5&&_0x3944e5[_0x3535('0xd')]?_0x3944e5[_0x3535('0xd')]:_0x3535('0xe'),'ipAddress':_0x3944e5&&_0x3944e5[_0x3535('0xf')]?_0x3944e5[_0x3535('0xf')]:_0x3535('0x10')};}exports[_0x3535('0x11')]=getFirstInterface;function getCPUhash(){var _0x437421=_[_0x3535('0x4')](os[_0x3535('0x12')]()['map'](function(_0x4273f7){return _0x4273f7[_0x3535('0x13')];}))[_0x3535('0x14')](':');return crypto[_0x3535('0x15')]('md5')[_0x3535('0x16')](_0x437421)[_0x3535('0x17')](_0x3535('0x18'));}exports[_0x3535('0x19')]=function(){var _0x4ad7b8=os[_0x3535('0x1a')]();var _0x47e3e2=/[0-9a-f-]{36}/;if(config[_0x3535('0x1b')]&&_0x47e3e2[_0x3535('0x1c')](config[_0x3535('0x1b')])){return config[_0x3535('0x1b')];}else if(_0x4ad7b8===_0x3535('0x1d')){return exec(_0x3535('0x1e'),{'encoding':_0x3535('0x1f')})['replace']('\x0d\x0a','');}else{var _0x30c34c=getFirstInterface();var _0xa20a9d=getCPUhash();var _0x518a9c=_0xa20a9d+'|'+os[_0x3535('0x20')]()+'|'+_0x30c34c[_0x3535('0x21')]+'|'+_0x30c34c[_0x3535('0x22')];var _0x2ae0c8=crypto[_0x3535('0x15')]('md5')[_0x3535('0x16')](_0x518a9c)['digest']('hex');return _0x2ae0c8[_0x3535('0x23')](0x0,0x8)+'-'+_0x2ae0c8[_0x3535('0x23')](0x8,0xc)+'-'+_0x2ae0c8['substring'](0xc,0x10)+'-'+_0x2ae0c8['substring'](0x10,0x14)+'-'+_0x2ae0c8['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index cec5ad6..8d9912a 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 _0xaa5f=['THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','update','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','encryptString','decryptString','days','DEMO\x20START\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','catch','error','message','finally','getUuid','License','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','default','moment','bluebird','pkginfo','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','version','GET','then','get','data2','data1','active'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0xaa5f,0x1d0));var _0xfaa5=function(_0x377a02,_0x48ac04){_0x377a02=_0x377a02-0x0;var _0x495cf7=_0xaa5f[_0x377a02];return _0x495cf7;};'use strict';var util=require('util');var moment=require(_0xfaa5('0x0'));var rp=require('request-promise');var BPromise=require(_0xfaa5('0x1'));var pkginfo=require(_0xfaa5('0x2'))(module,'version');var db=require('../../mysqldb')['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0xfaa5('0x3'));var logger=require(_0xfaa5('0x4'))(_0xfaa5('0x5'));var HOST=_0xfaa5('0x6');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x2ca334){return new BPromise(function(_0x50fe4d,_0x2d2c58){var _0x1d73d4=util[_0xfaa5('0x7')](_0xfaa5('0x8'),HOST,_0x2ca334,module[_0xfaa5('0x9')][_0xfaa5('0xa')]);if(oldToken){_0x1d73d4=util[_0xfaa5('0x7')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x2ca334,module[_0xfaa5('0x9')][_0xfaa5('0xa')],oldToken);}var _0xef858e={'uri':_0x1d73d4,'method':_0xfaa5('0xb'),'timeout':0xea60,'json':!![]};return rp(_0xef858e)[_0xfaa5('0xc')](function(_0xcf1fe8){_0x50fe4d(_0xcf1fe8);})['catch'](function(_0x588e00){_0x2d2c58(_0x588e00);});});}function manageLicense(_0x47239f,_0x53d271){var _0x5995b8=_0x53d271[_0xfaa5('0xd')]({'plain':!![]});if(!isOldTokenSent&&_0x5995b8['data1']!==_0x47239f&&!_0x5995b8[_0xfaa5('0xe')]){oldToken=_0x5995b8[_0xfaa5('0xf')];}httpRequest(_0x47239f)[_0xfaa5('0xc')](function(_0x3666fa){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x3666fa[_0xfaa5('0x10')]){isOldTokenSent=![];if(!_0x5995b8[_0xfaa5('0x5')]&&_0x5995b8['license']!=_0x3666fa[_0xfaa5('0x5')]||_0x5995b8[_0xfaa5('0x5')]&&_0x5995b8[_0xfaa5('0xe')]){logger['info'](_0xfaa5('0x11'));}if(_0x5995b8[_0xfaa5('0x5')]&&!_0x5995b8['data2']&&_0x5995b8[_0xfaa5('0x5')]!=_0x3666fa[_0xfaa5('0x5')]){logger[_0xfaa5('0x12')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x5995b8[_0xfaa5('0x5')]&&!_0x5995b8[_0xfaa5('0xe')]&&_0x5995b8['license']==_0x3666fa['license']){return _0x53d271;}return _0x53d271[_0xfaa5('0x13')]({'data1':_0x47239f,'data2':null,'license':_0x3666fa['license']});}else{if(_0x3666fa[_0xfaa5('0x5')]||_0x5995b8['license']){if(!_0x5995b8[_0xfaa5('0xe')]){if(_0x5995b8[_0xfaa5('0xf')]==_0x47239f){GRAY_PERIOD_REASON='Disabled';logger[_0xfaa5('0x12')](_0xfaa5('0x14'));}else{GRAY_PERIOD_REASON=_0xfaa5('0x15');logger[_0xfaa5('0x12')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x5995b8[_0xfaa5('0xf')],_0x47239f);}logger[_0xfaa5('0x12')](_0xfaa5('0x16'),GRAY_PERIOD_REASON['toUpperCase'](),moment()['format']('YYYY-MM-DD\x20HH:mm'));return _0x53d271[_0xfaa5('0x13')]({'data2':encryptor[_0xfaa5('0x17')](moment()[_0xfaa5('0x7')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()['diff'](encryptor[_0xfaa5('0x18')](_0x5995b8['data2']),_0xfaa5('0x19'))>DAYS){logger[_0xfaa5('0x12')](_0xfaa5('0x1a'),moment()['format'](_0xfaa5('0x1b')));isOldTokenSent=![];return _0x53d271[_0xfaa5('0x13')]({'data1':_0x47239f,'data2':null,'license':null});}}}else{if(_0x5995b8[_0xfaa5('0xf')]!=_0x47239f){logger[_0xfaa5('0x12')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x5995b8['data1'],_0x47239f);return _0x53d271[_0xfaa5('0x13')]({'data1':_0x47239f,'data2':null,'license':null});}}}return _0x53d271;})[_0xfaa5('0xc')](function(_0x49b869){_0x53d271=_0x49b869;})[_0xfaa5('0x1c')](function(_0x1888ac){logger[_0xfaa5('0x1d')](_0x1888ac[_0xfaa5('0x1e')]);})[_0xfaa5('0x1f')](function(){setTimeout(function(){manageLicense(hardware[_0xfaa5('0x20')](),_0x53d271);},TIME);});}function defaultLicense(){var _0x18a96f=hardware[_0xfaa5('0x20')]();if(_0x18a96f){return db[_0xfaa5('0x21')][_0xfaa5('0x22')]({'where':{'id':0x1},'defaults':{'data1':_0x18a96f}})['spread'](function(_0x3f8227,_0x227fbc){logger[_0xfaa5('0x12')](_0xfaa5('0x23'),_0x18a96f);manageLicense(_0x18a96f,_0x3f8227);})[_0xfaa5('0x1c')](function(_0x5b876b){logger['error'](_0x5b876b['message']);});}}exports[_0xfaa5('0x24')]=defaultLicense; \ No newline at end of file +var _0xfd93=['days','DEMO\x20START\x20AT\x20%s','error','finally','getUuid','License','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','message','default','util','moment','request-promise','pkginfo','./hardware','license','https://www.xcallymotion.com','format','version','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','encryptString','YYYY-MM-DD\x20HH:mm','diff'];(function(_0x50dab7,_0xa4e770){var _0x5af743=function(_0x4014db){while(--_0x4014db){_0x50dab7['push'](_0x50dab7['shift']());}};_0x5af743(++_0xa4e770);}(_0xfd93,0x1de));var _0x3fd9=function(_0xd8aad0,_0x4da2cd){_0xd8aad0=_0xd8aad0-0x0;var _0x570860=_0xfd93[_0xd8aad0];return _0x570860;};'use strict';var util=require(_0x3fd9('0x0'));var moment=require(_0x3fd9('0x1'));var rp=require(_0x3fd9('0x2'));var BPromise=require('bluebird');var pkginfo=require(_0x3fd9('0x3'))(module,'version');var db=require('../../mysqldb')['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0x3fd9('0x4'));var logger=require('../logger')(_0x3fd9('0x5'));var HOST=_0x3fd9('0x6');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x218e0e){return new BPromise(function(_0x581b22,_0x152cbd){var _0x19feb6=util[_0x3fd9('0x7')]('%s/api/servers/%s/check?version=%s',HOST,_0x218e0e,module['exports'][_0x3fd9('0x8')]);if(oldToken){_0x19feb6=util[_0x3fd9('0x7')](_0x3fd9('0x9'),HOST,_0x218e0e,module['exports'][_0x3fd9('0x8')],oldToken);}var _0x4fead1={'uri':_0x19feb6,'method':_0x3fd9('0xa'),'timeout':0xea60,'json':!![]};return rp(_0x4fead1)[_0x3fd9('0xb')](function(_0x50d00f){_0x581b22(_0x50d00f);})[_0x3fd9('0xc')](function(_0x544696){_0x152cbd(_0x544696);});});}function manageLicense(_0x386162,_0x5c1dfe){var _0x553e5b=_0x5c1dfe[_0x3fd9('0xd')]({'plain':!![]});if(!isOldTokenSent&&_0x553e5b[_0x3fd9('0xe')]!==_0x386162&&!_0x553e5b[_0x3fd9('0xf')]){oldToken=_0x553e5b[_0x3fd9('0xe')];}httpRequest(_0x386162)[_0x3fd9('0xb')](function(_0x4f4642){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x4f4642[_0x3fd9('0x10')]){isOldTokenSent=![];if(!_0x553e5b[_0x3fd9('0x5')]&&_0x553e5b['license']!=_0x4f4642[_0x3fd9('0x5')]||_0x553e5b[_0x3fd9('0x5')]&&_0x553e5b[_0x3fd9('0xf')]){logger[_0x3fd9('0x11')](_0x3fd9('0x12'));}if(_0x553e5b[_0x3fd9('0x5')]&&!_0x553e5b[_0x3fd9('0xf')]&&_0x553e5b['license']!=_0x4f4642[_0x3fd9('0x5')]){logger['info'](_0x3fd9('0x13'));}if(_0x553e5b['license']&&!_0x553e5b['data2']&&_0x553e5b[_0x3fd9('0x5')]==_0x4f4642[_0x3fd9('0x5')]){return _0x5c1dfe;}return _0x5c1dfe[_0x3fd9('0x14')]({'data1':_0x386162,'data2':null,'license':_0x4f4642['license']});}else{if(_0x4f4642[_0x3fd9('0x5')]||_0x553e5b[_0x3fd9('0x5')]){if(!_0x553e5b[_0x3fd9('0xf')]){if(_0x553e5b[_0x3fd9('0xe')]==_0x386162){GRAY_PERIOD_REASON=_0x3fd9('0x15');logger[_0x3fd9('0x11')](_0x3fd9('0x16'));}else{GRAY_PERIOD_REASON=_0x3fd9('0x17');logger[_0x3fd9('0x11')](_0x3fd9('0x18'),_0x553e5b[_0x3fd9('0xe')],_0x386162);}logger[_0x3fd9('0x11')](_0x3fd9('0x19'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0x3fd9('0x7')]('YYYY-MM-DD\x20HH:mm'));return _0x5c1dfe['update']({'data2':encryptor[_0x3fd9('0x1a')](moment()[_0x3fd9('0x7')](_0x3fd9('0x1b')))});}else{if(moment()[_0x3fd9('0x1c')](encryptor['decryptString'](_0x553e5b['data2']),_0x3fd9('0x1d'))>DAYS){logger['info'](_0x3fd9('0x1e'),moment()[_0x3fd9('0x7')](_0x3fd9('0x1b')));isOldTokenSent=![];return _0x5c1dfe[_0x3fd9('0x14')]({'data1':_0x386162,'data2':null,'license':null});}}}else{if(_0x553e5b[_0x3fd9('0xe')]!=_0x386162){logger[_0x3fd9('0x11')](_0x3fd9('0x18'),_0x553e5b['data1'],_0x386162);return _0x5c1dfe[_0x3fd9('0x14')]({'data1':_0x386162,'data2':null,'license':null});}}}return _0x5c1dfe;})[_0x3fd9('0xb')](function(_0x371125){_0x5c1dfe=_0x371125;})['catch'](function(_0x56d110){logger[_0x3fd9('0x1f')](_0x56d110['message']);})[_0x3fd9('0x20')](function(){setTimeout(function(){manageLicense(hardware[_0x3fd9('0x21')](),_0x5c1dfe);},TIME);});}function defaultLicense(){var _0x3e19cd=hardware[_0x3fd9('0x21')]();if(_0x3e19cd){return db[_0x3fd9('0x22')][_0x3fd9('0x23')]({'where':{'id':0x1},'defaults':{'data1':_0x3e19cd}})['spread'](function(_0x2459d5,_0x440288){logger[_0x3fd9('0x11')](_0x3fd9('0x24'),_0x3e19cd);manageLicense(_0x3e19cd,_0x2459d5);})[_0x3fd9('0xc')](function(_0x5cd9d5){logger[_0x3fd9('0x1f')](_0x5cd9d5[_0x3fd9('0x25')]);});}}exports[_0x3fd9('0x26')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 202425d..bfbc1a7 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 _0xef99=['demo','deadline','add','machineUuid','changed','disabled','message','then','User','findAll','sequelize','col','role','count','admin','user','telephone','users','telephones','forEach','pick','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','License','find','defaults','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s','parse'];(function(_0x2476d5,_0x466ffd){var _0x1587dd=function(_0x3d3e62){while(--_0x3d3e62){_0x2476d5['push'](_0x2476d5['shift']());}};_0x1587dd(++_0x466ffd);}(_0xef99,0x103));var _0x9ef9=function(_0x254e8,_0x3f4a99){_0x254e8=_0x254e8-0x0;var _0x31d829=_0xef99[_0x254e8];return _0x31d829;};'use strict';var util=require(_0x9ef9('0x0'));var _=require('lodash');var moment=require('moment');var BPromise=require(_0x9ef9('0x1'));var hardware=require(_0x9ef9('0x2'));var encryptor=require(_0x9ef9('0x3'));var db=require(_0x9ef9('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x9ef9('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x9ef9('0x6'),'machineUuid':hardware[_0x9ef9('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x9ef9('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x4f2862){return new BPromise(function(_0x7ae55f,_0x4d1d6b){return db[_0x9ef9('0x8')][_0x9ef9('0x9')](_[_0x9ef9('0xa')](_0x4f2862,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x425f84){return checkLicense(_0x425f84,null);})['then'](function(_0x3a9361){_0x7ae55f(_0x3a9361);return;})[_0x9ef9('0xb')](function(_0x2a3bb4){_0x4d1d6b(_0x2a3bb4);});});}function checkLicense(_0x3fb006,_0x460194){if(!_0x3fb006){demoLicense[_0x9ef9('0xc')]=_0x3fb006[_0x9ef9('0xd')];return demoLicense;}try{var _0x34a226=_0x460194||_0x3fb006[_0x9ef9('0xe')];if(_[_0x9ef9('0xf')](_0x34a226)){throw new Error(_0x9ef9('0x10'));}var _0x47b632=_0x3fb006[_0x9ef9('0xd')];var _0x24972d=_0x3fb006[_0x9ef9('0x11')];var _0xd3da74=_0x47b632[_0x9ef9('0x12')]('-')[0x4];var _0x26d612=_0x47b632['split']('-')[0x0];var _0x658839=encryptor[_0x9ef9('0x13')](_0x34a226,util[_0x9ef9('0x14')](_0x9ef9('0x15'),_0xd3da74,_0x47b632,_0x26d612));var _0x40d812=JSON[_0x9ef9('0x16')](_0x658839);_0x40d812[_0x9ef9('0x17')]=![];_0x40d812[_0x9ef9('0xc')]=_0x47b632;_0x40d812['machineUuid']=hardware[_0x9ef9('0x7')]();if(_0x24972d){var _0x1e9442=encryptor['decryptString'](_0x24972d);_0x40d812['gray']=_0x1e9442;_0x40d812[_0x9ef9('0x18')]=moment(_0x1e9442)[_0x9ef9('0x19')](0x7,'days')['format']();_0x40d812['grayReason']=_0x40d812[_0x9ef9('0xc')]!=_0x40d812[_0x9ef9('0x1a')]?_0x9ef9('0x1b'):_0x9ef9('0x1c');}return _0x40d812;}catch(_0x140a00){breakingLicense[_0x9ef9('0xc')]=_0x3fb006[_0x9ef9('0xd')];breakingLicense[_0x9ef9('0x1d')]=_0x140a00[_0x9ef9('0x1d')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x339015,_0x13ebc0){getLicense()[_0x9ef9('0x1e')](function(_0x234d97){return db[_0x9ef9('0x1f')][_0x9ef9('0x20')]({'attributes':['role',[db[_0x9ef9('0x21')]['fn']('COUNT',db[_0x9ef9('0x21')][_0x9ef9('0x22')](_0x9ef9('0x23'))),_0x9ef9('0x24')]],'group':_0x9ef9('0x23'),'where':{'role':{'$or':[_0x9ef9('0x25'),_0x9ef9('0x26'),_0x9ef9('0x27')]}},'raw':!![]})[_0x9ef9('0x1e')](function(_0x2295e2){var _0xbb32c1={'user':_0x234d97[_0x9ef9('0x28')]||0x0,'telephone':_0x234d97[_0x9ef9('0x29')]||0x0};_0x2295e2[_0x9ef9('0x2a')](function(_0x3d3b47){var _0x2b82fa=_0x3d3b47[_0x9ef9('0x23')]==='admin'?_0x9ef9('0x26'):_0x3d3b47['role'];_0xbb32c1[_0x2b82fa]-=_0x3d3b47[_0x9ef9('0x24')];if(_0xbb32c1[_0x2b82fa]<0x0)_0xbb32c1[_0x2b82fa]=0x0;});_0x339015(_0xbb32c1);return;});})[_0x9ef9('0xb')](function(_0x32c5b8){_0x13ebc0(_0x32c5b8);});});}function checkUserLimits(_0x51544d){return new BPromise(function(_0x590097,_0x53440e){getLimits()[_0x9ef9('0x1e')](function(_0x5c8408){var _0x375a4d=_[_0x9ef9('0x2b')](_['countBy'](_0x51544d,'role'),[_0x9ef9('0x25'),_0x9ef9('0x26'),_0x9ef9('0x27')]);var _0x33a94f=(_0x375a4d[_0x9ef9('0x25')]||0x0)+(_0x375a4d[_0x9ef9('0x26')]||0x0);var _0x3e9ea9=_0x375a4d['telephone']||0x0;if(_0x33a94f>_0x5c8408[_0x9ef9('0x26')])return _0x53440e(_0x9ef9('0x2c'));if(_0x3e9ea9>_0x5c8408[_0x9ef9('0x27')])return _0x53440e(_0x9ef9('0x2d'));return _0x590097();})[_0x9ef9('0xb')](function(_0x41a53a){_0x53440e(_0x41a53a);});});}module[_0x9ef9('0x2e')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x6f35=['col','count','admin','user','telephone','users','forEach','catch','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','lodash','bluebird','./hardware','../../components/encryptor','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','defaults','then','uuid','data1','license','isEmpty','split','decryptString','format','%s:%s:%s','parse','demo','machineUuid','gray','deadline','add','days','message','User','findAll','role','sequelize','COUNT'];(function(_0x215e65,_0x183f97){var _0xa85842=function(_0x43bf45){while(--_0x43bf45){_0x215e65['push'](_0x215e65['shift']());}};_0xa85842(++_0x183f97);}(_0x6f35,0x66));var _0x56f3=function(_0x301d84,_0x80a343){_0x301d84=_0x301d84-0x0;var _0x9aafd1=_0x6f35[_0x301d84];return _0x9aafd1;};'use strict';var util=require('util');var _=require(_0x56f3('0x0'));var moment=require('moment');var BPromise=require(_0x56f3('0x1'));var hardware=require(_0x56f3('0x2'));var encryptor=require(_0x56f3('0x3'));var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x56f3('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x56f3('0x5'),'machineUuid':hardware[_0x56f3('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x56f3('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x56f3('0x7'),'machineUuid':hardware[_0x56f3('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x1a8bff){return new BPromise(function(_0x1ecd7f,_0x398dad){return db[_0x56f3('0x8')][_0x56f3('0x9')](_[_0x56f3('0xa')](_0x1a8bff,{'raw':!![],'where':{'id':0x1}}))[_0x56f3('0xb')](function(_0xac8911){return checkLicense(_0xac8911,null);})[_0x56f3('0xb')](function(_0x55491f){_0x1ecd7f(_0x55491f);return;})['catch'](function(_0xbe8246){_0x398dad(_0xbe8246);});});}function checkLicense(_0x39851b,_0x18d43d){if(!_0x39851b){demoLicense[_0x56f3('0xc')]=_0x39851b[_0x56f3('0xd')];return demoLicense;}try{var _0x4192a7=_0x18d43d||_0x39851b[_0x56f3('0xe')];if(_[_0x56f3('0xf')](_0x4192a7)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x9cff95=_0x39851b[_0x56f3('0xd')];var _0xaa1126=_0x39851b['data2'];var _0x577312=_0x9cff95[_0x56f3('0x10')]('-')[0x4];var _0x35fc71=_0x9cff95[_0x56f3('0x10')]('-')[0x0];var _0x417e18=encryptor[_0x56f3('0x11')](_0x4192a7,util[_0x56f3('0x12')](_0x56f3('0x13'),_0x577312,_0x9cff95,_0x35fc71));var _0x313ef7=JSON[_0x56f3('0x14')](_0x417e18);_0x313ef7[_0x56f3('0x15')]=![];_0x313ef7[_0x56f3('0xc')]=_0x9cff95;_0x313ef7[_0x56f3('0x16')]=hardware[_0x56f3('0x6')]();if(_0xaa1126){var _0x11a788=encryptor['decryptString'](_0xaa1126);_0x313ef7[_0x56f3('0x17')]=_0x11a788;_0x313ef7[_0x56f3('0x18')]=moment(_0x11a788)[_0x56f3('0x19')](0x7,_0x56f3('0x1a'))[_0x56f3('0x12')]();_0x313ef7['grayReason']=_0x313ef7[_0x56f3('0xc')]!=_0x313ef7[_0x56f3('0x16')]?'changed':'disabled';}return _0x313ef7;}catch(_0x576e9f){breakingLicense[_0x56f3('0xc')]=_0x39851b['data1'];breakingLicense['message']=_0x576e9f[_0x56f3('0x1b')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x58eba8,_0x50ca07){getLicense()[_0x56f3('0xb')](function(_0x9b3aae){return db[_0x56f3('0x1c')][_0x56f3('0x1d')]({'attributes':[_0x56f3('0x1e'),[db[_0x56f3('0x1f')]['fn'](_0x56f3('0x20'),db[_0x56f3('0x1f')][_0x56f3('0x21')](_0x56f3('0x1e'))),_0x56f3('0x22')]],'group':'role','where':{'role':{'$or':[_0x56f3('0x23'),_0x56f3('0x24'),_0x56f3('0x25')]}},'raw':!![]})[_0x56f3('0xb')](function(_0x4bcb9e){var _0x108540={'user':_0x9b3aae[_0x56f3('0x26')]||0x0,'telephone':_0x9b3aae['telephones']||0x0};_0x4bcb9e[_0x56f3('0x27')](function(_0x1a8bf4){var _0x57d6c9=_0x1a8bf4[_0x56f3('0x1e')]===_0x56f3('0x23')?_0x56f3('0x24'):_0x1a8bf4['role'];_0x108540[_0x57d6c9]-=_0x1a8bf4[_0x56f3('0x22')];if(_0x108540[_0x57d6c9]<0x0)_0x108540[_0x57d6c9]=0x0;});_0x58eba8(_0x108540);return;});})[_0x56f3('0x28')](function(_0x18cba6){_0x50ca07(_0x18cba6);});});}function checkUserLimits(_0x5e133d){return new BPromise(function(_0xf92afe,_0x150533){getLimits()[_0x56f3('0xb')](function(_0x2736c1){var _0x3560c9=_['pick'](_[_0x56f3('0x29')](_0x5e133d,_0x56f3('0x1e')),[_0x56f3('0x23'),_0x56f3('0x24'),'telephone']);var _0x1b9467=(_0x3560c9['admin']||0x0)+(_0x3560c9[_0x56f3('0x24')]||0x0);var _0x91d44c=_0x3560c9[_0x56f3('0x25')]||0x0;if(_0x1b9467>_0x2736c1[_0x56f3('0x24')])return _0x150533(_0x56f3('0x2a'));if(_0x91d44c>_0x2736c1[_0x56f3('0x25')])return _0x150533(_0x56f3('0x2b'));return _0xf92afe();})[_0x56f3('0x28')](function(_0x5ac522){_0x150533(_0x5ac522);});});}module[_0x56f3('0x2c')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 2a1fa58..6eceb4d 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 _0xdd4f=['exports','secret'];(function(_0x5a3062,_0x547536){var _0x365170=function(_0x4a567c){while(--_0x4a567c){_0x5a3062['push'](_0x5a3062['shift']());}};_0x365170(++_0x547536);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x586b9a,_0x2441b6){_0x586b9a=_0x586b9a-0x0;var _0x322996=_0xdd4f[_0x586b9a];return _0x322996;};'use strict';module[_0xfdd4('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':'app-id','GOOGLE_SECRET':_0xfdd4('0x1'),'DEBUG':''}; \ No newline at end of file +var _0xe1e3=['http://localhost:9000','app-id','exports'];(function(_0x33f7e1,_0x48d209){var _0x23bab4=function(_0xd532b0){while(--_0xd532b0){_0x33f7e1['push'](_0x33f7e1['shift']());}};_0x23bab4(++_0x48d209);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0x10d49e,_0x543606){_0x10d49e=_0x10d49e-0x0;var _0x33add=_0xe1e3[_0x10d49e];return _0x33add;};'use strict';module[_0x3e1e('0x0')]={'DOMAIN':_0x3e1e('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x3e1e('0x2'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 7f1543c..fc359c2 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x265f=['INFO','join','/var','log','xcally','%s-%s.log','message','replace','}}}','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','exports','Logger','transports','File','%s-%s','error','info','Console','env','debugLevel','moment','winston','util','path'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x265f,0x168));var _0xf265=function(_0x4b23b0,_0xf3d9b4){_0x4b23b0=_0x4b23b0-0x0;var _0x1440d7=_0x265f[_0x4b23b0];return _0x1440d7;};'use strict';var moment=require(_0xf265('0x0'));var winston=require(_0xf265('0x1'));var util=require(_0xf265('0x2'));var path=require(_0xf265('0x3'));var debugLevel=_0xf265('0x4');function filename(_0x1b149f,_0x2b9765){return path[_0xf265('0x5')](_0xf265('0x6'),_0xf265('0x7'),_0xf265('0x8'),util['format'](_0xf265('0x9'),_0x1b149f,_0x2b9765));}function formatter(_0x1ad66a,_0xf7a711){_0xf7a711[_0xf265('0xa')]=_0xf7a711[_0xf265('0xa')][_0xf265('0xb')](/@@{/g,'{{{')[_0xf265('0xb')](/}@@/g,_0xf265('0xc'))[_0xf265('0xb')](/@{/g,'{{')[_0xf265('0xb')](/}@/g,'}}');return util[_0xf265('0xd')](_0xf265('0xe'),moment()['format'](_0xf265('0xf')),_0xf7a711[_0xf265('0x10')][_0xf265('0x11')](),_0x1ad66a,_0xf7a711[_0xf265('0xa')]);}module[_0xf265('0x12')]=function(_0x10d2d0){return new winston[(_0xf265('0x13'))]({'transports':[new winston[(_0xf265('0x14'))][(_0xf265('0x15'))]({'name':util['format'](_0xf265('0x16'),_0x10d2d0,_0xf265('0x17')),'filename':filename(_0x10d2d0,'error'),'level':_0xf265('0x17'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2b1870){return formatter(_0x10d2d0,_0x2b1870);}}),new winston[(_0xf265('0x14'))][(_0xf265('0x15'))]({'name':util[_0xf265('0xd')](_0xf265('0x16'),_0x10d2d0,_0xf265('0x18')),'filename':filename(_0x10d2d0,_0xf265('0x18')),'level':_0xf265('0x18'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x528664){return formatter(_0x10d2d0,_0x528664);}}),new winston[(_0xf265('0x14'))][(_0xf265('0x19'))]({'level':process[_0xf265('0x1a')][_0xf265('0x1b')]||debugLevel,'json':![],'formatter':function(_0x35bece){return formatter(_0x10d2d0,_0x35bece);}})]});}; \ No newline at end of file +var _0xd17d=['level','toUpperCase','exports','transports','%s-%s','error','File','info','Console','debugLevel','winston','path','INFO','join','/var','xcally','format','%s-%s.log','message','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x1448cd,_0x5ac472){var _0x24abbe=function(_0x4d13ec){while(--_0x4d13ec){_0x1448cd['push'](_0x1448cd['shift']());}};_0x24abbe(++_0x5ac472);}(_0xd17d,0x1ed));var _0xdd17=function(_0x5e194f,_0x1d0dc4){_0x5e194f=_0x5e194f-0x0;var _0x138aa3=_0xd17d[_0x5e194f];return _0x138aa3;};'use strict';var moment=require('moment');var winston=require(_0xdd17('0x0'));var util=require('util');var path=require(_0xdd17('0x1'));var debugLevel=_0xdd17('0x2');function filename(_0x2d7dfb,_0x6b9a0){return path[_0xdd17('0x3')](_0xdd17('0x4'),'log',_0xdd17('0x5'),util[_0xdd17('0x6')](_0xdd17('0x7'),_0x2d7dfb,_0x6b9a0));}function formatter(_0x5e04d8,_0x11f1d9){_0x11f1d9[_0xdd17('0x8')]=_0x11f1d9[_0xdd17('0x8')]['replace'](/@@{/g,'{{{')[_0xdd17('0x9')](/}@@/g,_0xdd17('0xa'))[_0xdd17('0x9')](/@{/g,'{{')[_0xdd17('0x9')](/}@/g,'}}');return util['format'](_0xdd17('0xb'),moment()[_0xdd17('0x6')](_0xdd17('0xc')),_0x11f1d9[_0xdd17('0xd')][_0xdd17('0xe')](),_0x5e04d8,_0x11f1d9[_0xdd17('0x8')]);}module[_0xdd17('0xf')]=function(_0x548cd4){return new winston['Logger']({'transports':[new winston[(_0xdd17('0x10'))]['File']({'name':util[_0xdd17('0x6')](_0xdd17('0x11'),_0x548cd4,_0xdd17('0x12')),'filename':filename(_0x548cd4,_0xdd17('0x12')),'level':_0xdd17('0x12'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2c6539){return formatter(_0x548cd4,_0x2c6539);}}),new winston['transports'][(_0xdd17('0x13'))]({'name':util[_0xdd17('0x6')](_0xdd17('0x11'),_0x548cd4,_0xdd17('0x14')),'filename':filename(_0x548cd4,_0xdd17('0x14')),'level':_0xdd17('0x14'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2510ed){return formatter(_0x548cd4,_0x2510ed);}}),new winston[(_0xdd17('0x10'))][(_0xdd17('0x15'))]({'level':process['env'][_0xdd17('0x16')]||debugLevel,'json':![],'formatter':function(_0x2d5bf9){return formatter(_0x548cd4,_0x2d5bf9);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 37df8a1..b6d2b4c 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 _0xa3da=['express','join','../../services/express/index.js','ami','agi','../../services/agi/index.js','email','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path'];(function(_0x463e45,_0x1ff35f){var _0x172e49=function(_0x35f7d0){while(--_0x35f7d0){_0x463e45['push'](_0x463e45['shift']());}};_0x172e49(++_0x1ff35f);}(_0xa3da,0x151));var _0xaa3d=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa3da[_0x3947c9];return _0x2e7871;};'use strict';var path=require(_0xaa3d('0x0'));var os=require('os');var config={'apps':[{'name':_0xaa3d('0x1'),'script':path[_0xaa3d('0x2')](__dirname,_0xaa3d('0x3'))},{'name':_0xaa3d('0x4'),'script':path[_0xaa3d('0x2')](__dirname,'../../services/ami/index.js')},{'name':_0xaa3d('0x5'),'script':path[_0xaa3d('0x2')](__dirname,_0xaa3d('0x6'))},{'name':_0xaa3d('0x7'),'script':path[_0xaa3d('0x2')](__dirname,'../../services/email/index.js')},{'name':_0xaa3d('0x8'),'script':path[_0xaa3d('0x2')](__dirname,_0xaa3d('0x9'))},{'name':_0xaa3d('0xa'),'script':path[_0xaa3d('0x2')](__dirname,_0xaa3d('0xb'))}]};module[_0xaa3d('0xc')]=config; \ No newline at end of file +var _0xd92c=['routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','express','join','agi','email','../../services/email/index.js'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd92c,0x7e));var _0xcd92=function(_0x3b2ce7,_0x11a240){_0x3b2ce7=_0x3b2ce7-0x0;var _0x56b937=_0xd92c[_0x3b2ce7];return _0x56b937;};'use strict';var path=require(_0xcd92('0x0'));var os=require('os');var config={'apps':[{'name':_0xcd92('0x1'),'script':path[_0xcd92('0x2')](__dirname,'../../services/express/index.js')},{'name':'ami','script':path['join'](__dirname,'../../services/ami/index.js')},{'name':_0xcd92('0x3'),'script':path[_0xcd92('0x2')](__dirname,'../../services/agi/index.js')},{'name':_0xcd92('0x4'),'script':path[_0xcd92('0x2')](__dirname,_0xcd92('0x5'))},{'name':_0xcd92('0x6'),'script':path[_0xcd92('0x2')](__dirname,_0xcd92('0x7'))},{'name':_0xcd92('0x8'),'script':path[_0xcd92('0x2')](__dirname,_0xcd92('0x9'))}]};module[_0xcd92('0xa')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 9007055..9fb947d 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 _0x547d=['./config','connected','start','then','stop','disconnect','restart','describe','delete','dump','saved','pm2','bluebird'];(function(_0xda21e8,_0x19d184){var _0x28904b=function(_0x10c833){while(--_0x10c833){_0xda21e8['push'](_0xda21e8['shift']());}};_0x28904b(++_0x19d184);}(_0x547d,0x1c5));var _0xd547=function(_0x2da357,_0x1f9b2f){_0x2da357=_0x2da357-0x0;var _0x138fdd=_0x547d[_0x2da357];return _0x138fdd;};'use strict';var pm2=require(_0xd547('0x0'));var BPromise=require(_0xd547('0x1'));var config=require(_0xd547('0x2'));function connect(){return new BPromise(function(_0x86ab3c,_0x2f2fa7){return pm2['connect'](function(_0x439e7f){if(_0x439e7f){return _0x2f2fa7(_0x439e7f);}return _0x86ab3c(_0xd547('0x3'));});});};exports[_0xd547('0x4')]=function(_0x2508b5){return connect()[_0xd547('0x5')](function(){return new BPromise(function(_0x20f318,_0x1da6c3){return pm2[_0xd547('0x4')](_0x2508b5,function(_0x2e7698,_0x5c6c3e){if(_0x2e7698){return _0x1da6c3(_0x2e7698);}pm2['disconnect']();return _0x20f318(_0x5c6c3e);});});});};exports[_0xd547('0x6')]=function(_0x1ea4d2){return connect()['then'](function(){return new BPromise(function(_0x695080,_0x5eb9de){return pm2['stop'](_0x1ea4d2,function(_0x93052d,_0x3db835){if(_0x93052d){return _0x5eb9de(_0x93052d);}pm2[_0xd547('0x7')]();return _0x695080(_0x3db835);});});});};exports[_0xd547('0x8')]=function(_0x33e1f0){return connect()['then'](function(){return new BPromise(function(_0x4675e9,_0x5ac832){return pm2['restart'](_0x33e1f0,function(_0x49279d,_0x24e7f4){if(_0x49279d){return _0x5ac832(_0x49279d);}pm2[_0xd547('0x7')]();return _0x4675e9(_0x24e7f4);});});});};exports['list']=function(){return connect()[_0xd547('0x5')](function(){return new BPromise(function(_0x1f0d0d,_0x12fedf){return pm2['list'](function(_0x23cad2,_0x59add1){if(_0x23cad2){return _0x12fedf(_0x23cad2);}pm2[_0xd547('0x7')]();return _0x1f0d0d(_0x59add1);});});});};exports[_0xd547('0x9')]=function(_0x449234){return connect()[_0xd547('0x5')](function(){return new BPromise(function(_0xba44fb,_0x367290){return pm2[_0xd547('0x9')](_0x449234,function(_0x989c6c,_0x5f0ca7){if(_0x989c6c){return _0x367290(_0x989c6c);}pm2['disconnect']();return _0xba44fb(_0x5f0ca7);});});});};exports[_0xd547('0xa')]=function(_0x27ef74){return connect()[_0xd547('0x5')](function(){return new BPromise(function(_0x154f5a,_0x53d396){return pm2[_0xd547('0xa')](_0x27ef74,function(_0x5110d1,_0x1906bd){if(_0x5110d1){return _0x53d396(_0x5110d1);}pm2[_0xd547('0x7')]();return _0x154f5a(_0x1906bd);});});});};exports[_0xd547('0xb')]=function(){return connect()[_0xd547('0x5')](function(){return new BPromise(function(_0x4c6657,_0x2f6654){return pm2[_0xd547('0xb')](function(_0x336644){if(_0x336644){return _0x2f6654(_0x336644);}return _0x4c6657(_0xd547('0xc'));});});});}; \ No newline at end of file +var _0x5687=['start','then','disconnect','stop','restart','list','describe','delete','dump','bluebird','./config'];(function(_0x2d1be7,_0x3bc95f){var _0x4302ec=function(_0x5cb3f8){while(--_0x5cb3f8){_0x2d1be7['push'](_0x2d1be7['shift']());}};_0x4302ec(++_0x3bc95f);}(_0x5687,0xda));var _0x7568=function(_0x3455b6,_0x57e3aa){_0x3455b6=_0x3455b6-0x0;var _0x384fbe=_0x5687[_0x3455b6];return _0x384fbe;};'use strict';var pm2=require('pm2');var BPromise=require(_0x7568('0x0'));var config=require(_0x7568('0x1'));function connect(){return new BPromise(function(_0x234a47,_0x5cc44c){return pm2['connect'](function(_0x1ee66b){if(_0x1ee66b){return _0x5cc44c(_0x1ee66b);}return _0x234a47('connected');});});};exports[_0x7568('0x2')]=function(_0x497a9b){return connect()[_0x7568('0x3')](function(){return new BPromise(function(_0x1a2fc9,_0x11e440){return pm2[_0x7568('0x2')](_0x497a9b,function(_0x53a121,_0x4694de){if(_0x53a121){return _0x11e440(_0x53a121);}pm2[_0x7568('0x4')]();return _0x1a2fc9(_0x4694de);});});});};exports[_0x7568('0x5')]=function(_0x25ec0d){return connect()[_0x7568('0x3')](function(){return new BPromise(function(_0x1dca4d,_0x15974b){return pm2[_0x7568('0x5')](_0x25ec0d,function(_0x5b07d6,_0x30db9a){if(_0x5b07d6){return _0x15974b(_0x5b07d6);}pm2[_0x7568('0x4')]();return _0x1dca4d(_0x30db9a);});});});};exports[_0x7568('0x6')]=function(_0x4d3ad2){return connect()[_0x7568('0x3')](function(){return new BPromise(function(_0x55241f,_0x5288fc){return pm2[_0x7568('0x6')](_0x4d3ad2,function(_0x3ee321,_0x138a28){if(_0x3ee321){return _0x5288fc(_0x3ee321);}pm2[_0x7568('0x4')]();return _0x55241f(_0x138a28);});});});};exports[_0x7568('0x7')]=function(){return connect()['then'](function(){return new BPromise(function(_0x554c15,_0x3e483c){return pm2[_0x7568('0x7')](function(_0x379a89,_0x5daff7){if(_0x379a89){return _0x3e483c(_0x379a89);}pm2[_0x7568('0x4')]();return _0x554c15(_0x5daff7);});});});};exports['describe']=function(_0x49e194){return connect()['then'](function(){return new BPromise(function(_0x22723a,_0x23b457){return pm2[_0x7568('0x8')](_0x49e194,function(_0x5d468c,_0x10d360){if(_0x5d468c){return _0x23b457(_0x5d468c);}pm2[_0x7568('0x4')]();return _0x22723a(_0x10d360);});});});};exports[_0x7568('0x9')]=function(_0x892f4f){return connect()[_0x7568('0x3')](function(){return new BPromise(function(_0x2b2d4a,_0x38d7e8){return pm2[_0x7568('0x9')](_0x892f4f,function(_0xc060ea,_0x4918c6){if(_0xc060ea){return _0x38d7e8(_0xc060ea);}pm2[_0x7568('0x4')]();return _0x2b2d4a(_0x4918c6);});});});};exports[_0x7568('0xa')]=function(){return connect()['then'](function(){return new BPromise(function(_0x1f2ddc,_0x454dba){return pm2[_0x7568('0xa')](function(_0x2d72a8){if(_0x2d72a8){return _0x454dba(_0x2d72a8);}return _0x1f2ddc('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index d1a1e76..733dc71 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 _0x0def=['ChatInteraction','findAll','lastMsgAt','subtract','chatTimeout','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','catch','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','util','../../config/environment','../../mysqldb','../logger','schedule','redis','localhost','socket.io-emitter','Setting','find','then'];(function(_0x372c96,_0x59799b){var _0x4ad389=function(_0x151c80){while(--_0x151c80){_0x372c96['push'](_0x372c96['shift']());}};_0x4ad389(++_0x59799b);}(_0x0def,0x12b));var _0xf0de=function(_0x5d1044,_0x18f656){_0x5d1044=_0x5d1044-0x0;var _0x3cd90e=_0x0def[_0x5d1044];return _0x3cd90e;};'use strict';var _=require('lodash');var moment=require('moment');var Redis=require('ioredis');var util=require(_0xf0de('0x0'));var config=require(_0xf0de('0x1'));var db=require(_0xf0de('0x2'))['db'];var logger=require(_0xf0de('0x3'))(_0xf0de('0x4'));config[_0xf0de('0x5')]=_['defaults'](config[_0xf0de('0x5')],{'host':_0xf0de('0x6'),'port':0x18eb});var io=require(_0xf0de('0x7'))(new Redis(config[_0xf0de('0x5')]));function closeInteractions(){var _0x361528=0x0;var _0x3d2416=[];return db[_0xf0de('0x8')][_0xf0de('0x9')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0xf0de('0xa')](function(_0x3b398f){_0x361528=_0x3b398f['chatTimeout'];if(_0x361528){return db[_0xf0de('0xb')][_0xf0de('0xc')]({'raw':!![],'attributes':['id',_0xf0de('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xf0de('0xe')](_0x3b398f[_0xf0de('0xf')],'minutes')}}});}else{return[];}})[_0xf0de('0xa')](function(_0xa34c5a){if(_0xa34c5a&&_0xa34c5a[_0xf0de('0x10')]){_0x3d2416=_[_0xf0de('0x11')](_0xa34c5a||[],'id');logger[_0xf0de('0x12')](_0xf0de('0x13'),_0x3d2416[_0xf0de('0x14')]());return db[_0xf0de('0xb')][_0xf0de('0x15')]({'closeReason':_0xf0de('0x16'),'disposition':_0xf0de('0x17'),'closed':!![],'closedAt':moment()[_0xf0de('0x18')](_0xf0de('0x19'))},{'where':{'id':_0x3d2416}});}})[_0xf0de('0xa')](function(){if(_0x3d2416&&_0x3d2416[_0xf0de('0x10')]){logger[_0xf0de('0x12')](_0xf0de('0x1a'),_0x3d2416[_0xf0de('0x14')]());for(var _0xc3d2d3=0x0;_0xc3d2d3<_0x3d2416[_0xf0de('0x10')];_0xc3d2d3++){io['emit']('chatInteraction:update',{'id':_0x3d2416[_0xc3d2d3],'closed':!![]});}}})[_0xf0de('0x1b')](function(_0x16ee38){logger['error'](_0xf0de('0x1c'),_0x16ee38?util[_0xf0de('0x1d')](_0x16ee38,{'showHidden':![],'depth':null}):'');});}exports[_0xf0de('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x047c=['socket.io-emitter','Setting','chatTimeout','then','ChatInteraction','findAll','subtract','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','catch','error','inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','redis','localhost'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x047c,0x1a4));var _0xc047=function(_0x2f8140,_0x37076b){_0x2f8140=_0x2f8140-0x0;var _0x21bd12=_0x047c[_0x2f8140];return _0x21bd12;};'use strict';var _=require(_0xc047('0x0'));var moment=require(_0xc047('0x1'));var Redis=require(_0xc047('0x2'));var util=require(_0xc047('0x3'));var config=require(_0xc047('0x4'));var db=require(_0xc047('0x5'))['db'];var logger=require(_0xc047('0x6'))('schedule');config[_0xc047('0x7')]=_['defaults'](config[_0xc047('0x7')],{'host':_0xc047('0x8'),'port':0x18eb});var io=require(_0xc047('0x9'))(new Redis(config[_0xc047('0x7')]));function closeInteractions(){var _0x6d73eb=0x0;var _0x423e09=[];return db[_0xc047('0xa')]['find']({'raw':!![],'attributes':['id',_0xc047('0xb')],'where':{'id':0x1}})[_0xc047('0xc')](function(_0x3c7165){_0x6d73eb=_0x3c7165['chatTimeout'];if(_0x6d73eb){return db[_0xc047('0xd')][_0xc047('0xe')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xc047('0xf')](_0x3c7165[_0xc047('0xb')],_0xc047('0x10'))}}});}else{return[];}})[_0xc047('0xc')](function(_0x2e9b20){if(_0x2e9b20&&_0x2e9b20[_0xc047('0x11')]){_0x423e09=_[_0xc047('0x12')](_0x2e9b20||[],'id');logger[_0xc047('0x13')](_0xc047('0x14'),_0x423e09[_0xc047('0x15')]());return db['ChatInteraction'][_0xc047('0x16')]({'closeReason':_0xc047('0x17'),'disposition':_0xc047('0x18'),'closed':!![],'closedAt':moment()[_0xc047('0x19')](_0xc047('0x1a'))},{'where':{'id':_0x423e09}});}})['then'](function(){if(_0x423e09&&_0x423e09['length']){logger[_0xc047('0x13')](_0xc047('0x1b'),_0x423e09['join']());for(var _0x9f6c9e=0x0;_0x9f6c9e<_0x423e09[_0xc047('0x11')];_0x9f6c9e++){io[_0xc047('0x1c')]('chatInteraction:update',{'id':_0x423e09[_0x9f6c9e],'closed':!![]});}}})[_0xc047('0x1d')](function(_0x2fdf5d){logger[_0xc047('0x1e')]('[CHAT]\x20Error\x20closing\x20interactions',_0x2fdf5d?util[_0xc047('0x1f')](_0x2fdf5d,{'showHidden':![],'depth':null}):'');});}exports[_0xc047('0x20')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 8c7ca2d..13bbeb7 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 _0xcc01=['\x22%s\x22\x20<%s>','email','bcc','subtractNumber','subtractUnit','join','../../files/reports','%s.%s','basename','savename','extname','zip','Sent','message','attachments','text','stringify','existsSync','status','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','SendMail','then','error','email\x20sent','catch','error\x20mail','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','name','DefaultReportId','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','findAll','keys','jobs','map','toString','difference','intersection','length','exists','stop','toRun','index','my\x20id','run\x20job','cron','active','isBetween','startAt','add','add\x20cron','stop\x20cron','update','update\x20cron','deleteJob','run','start','util','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','Smtp','service','host','port','secure','authentication','auth','user','pass','format'];(function(_0x3e7bc8,_0x317f27){var _0x1932a9=function(_0xa8a526){while(--_0xa8a526){_0x3e7bc8['push'](_0x3e7bc8['shift']());}};_0x1932a9(++_0x317f27);}(_0xcc01,0x1b7));var _0x1cc0=function(_0x2ed1ae,_0x2b49f1){_0x2ed1ae=_0x2ed1ae-0x0;var _0x57ef10=_0xcc01[_0x2ed1ae];return _0x57ef10;};'use strict';var fs=require('fs');var util=require(_0x1cc0('0x0'));var path=require(_0x1cc0('0x1'));var _=require(_0x1cc0('0x2'));var moment=require(_0x1cc0('0x3'));var CronJobManager=require(_0x1cc0('0x4'));var jayson=require(_0x1cc0('0x5'));var BPromise=require(_0x1cc0('0x6'));var logger=require(_0x1cc0('0x7'))(_0x1cc0('0x8'));var db=require(_0x1cc0('0x9'))['db'];var analyticCustomReportController=require(_0x1cc0('0xa'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0x1cc0('0xb')][_0x1cc0('0xc')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0xc0840f,_0x12f6b5){return function(){logger[_0x1cc0('0xd')](_0x1cc0('0xe'),_0xc0840f['email']);var _0x1b1a1=!![];var _0x24ad12={'tls':{'rejectUnauthorized':![]}};if(_0xc0840f[_0x1cc0('0xf')][_0x1cc0('0x10')]['service']){_0x24ad12[_0x1cc0('0x11')]=_0xc0840f[_0x1cc0('0xf')][_0x1cc0('0x10')][_0x1cc0('0x11')];}else{_0x24ad12[_0x1cc0('0x12')]=_0xc0840f[_0x1cc0('0xf')][_0x1cc0('0x10')][_0x1cc0('0x12')];_0x24ad12[_0x1cc0('0x13')]=_0xc0840f[_0x1cc0('0xf')]['Smtp'][_0x1cc0('0x13')];_0x24ad12[_0x1cc0('0x14')]=_0xc0840f['MailAccount'][_0x1cc0('0x10')][_0x1cc0('0x14')];}if(_0xc0840f['MailAccount'][_0x1cc0('0x10')][_0x1cc0('0x15')]){_0x24ad12[_0x1cc0('0x16')]={'user':_0xc0840f[_0x1cc0('0xf')][_0x1cc0('0x10')][_0x1cc0('0x17')],'pass':_0xc0840f[_0x1cc0('0xf')]['Smtp'][_0x1cc0('0x18')]};}var _0x1dea4a={'account':_0x24ad12,'message':{'from':util[_0x1cc0('0x19')](_0x1cc0('0x1a'),_0xc0840f[_0x1cc0('0xf')]['name'],_0xc0840f[_0x1cc0('0xf')][_0x1cc0('0x1b')]||_0xc0840f[_0x1cc0('0xf')][_0x1cc0('0x10')][_0x1cc0('0x17')]),'to':_0xc0840f[_0x1cc0('0x1b')],'cc':_0xc0840f['cc'],'bcc':_0xc0840f[_0x1cc0('0x1c')],'subject':util[_0x1cc0('0x19')]('Report\x20%s\x20last\x20%s\x20%s',_0x12f6b5['name'],_0xc0840f[_0x1cc0('0x1d')],_0xc0840f[_0x1cc0('0x1e')])}};var _0x346a79=path[_0x1cc0('0x1f')](__dirname,_0x1cc0('0x20'));var _0x183c8e=_0x12f6b5['savename'];var _0x2d4328=util[_0x1cc0('0x19')](_0x1cc0('0x21'),path[_0x1cc0('0x22')](_0x12f6b5[_0x1cc0('0x23')],path[_0x1cc0('0x24')](_0x12f6b5['savename'])),_0x1cc0('0x25'));var _0x4e413d=path[_0x1cc0('0x1f')](_0x346a79,_0x183c8e);var _0x2a686f=path[_0x1cc0('0x1f')](_0x346a79,_0x2d4328);if(fs['existsSync'](_0x4e413d)){_0x12f6b5['status']=_0x1cc0('0x26');_0x1dea4a[_0x1cc0('0x27')][_0x1cc0('0x28')]=[{'filename':_0x183c8e,'path':_0x4e413d}];_0x1dea4a[_0x1cc0('0x27')][_0x1cc0('0x29')]=util[_0x1cc0('0x19')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0x1cc0('0x2a')](_0x12f6b5,null,0x2));}else if(fs[_0x1cc0('0x2b')](_0x2a686f)){_0x12f6b5[_0x1cc0('0x2c')]=_0x1cc0('0x26');_0x1dea4a[_0x1cc0('0x27')]['attachments']=[{'filename':_0x2d4328,'path':_0x2a686f}];}else{_0x1dea4a['message'][_0x1cc0('0x29')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0xc0840f[_0x1cc0('0x2d')]){_0x1b1a1=![];logger[_0x1cc0('0xd')](_0x1cc0('0x2e'));}}if(_0x1b1a1){return client['request'](_0x1cc0('0x2f'),_0x1dea4a)[_0x1cc0('0x30')](function(_0x24fccd){if(_0x24fccd['error']){return logger[_0x1cc0('0x31')]('error\x20mail',JSON[_0x1cc0('0x2a')](_0x24fccd));}return logger['info'](_0x1cc0('0x32'));})[_0x1cc0('0x33')](function(_0xb3d4b5){return logger['error'](_0x1cc0('0x34'),JSON['stringify'](_0xb3d4b5));});}};}function handleError(){return function(_0x194521){return logger[_0x1cc0('0x31')](JSON[_0x1cc0('0x2a')](_0x194521));};}function handleResult(_0x46a021){return function(_0x239ea5){logger[_0x1cc0('0xd')](_0x1cc0('0x35'),JSON[_0x1cc0('0x2a')](_0x239ea5));if(_0x46a021[_0x1cc0('0xf')]&&_0x46a021[_0x1cc0('0xf')][_0x1cc0('0x10')]&&!_[_0x1cc0('0x36')](_0x46a021[_0x1cc0('0x1b')])){setTimeout(handleSendEmail(_0x46a021,_0x239ea5),0x3c*0x3e8);}};}function handleJob(_0x5aa7c2){return function(){try{if(_[_0x1cc0('0x36')](_0x5aa7c2[_0x1cc0('0x1d')])){return logger[_0x1cc0('0xd')](_0x1cc0('0x37'));}if(_[_0x1cc0('0x36')](_0x5aa7c2['subtractUnit'])){return logger[_0x1cc0('0xd')](_0x1cc0('0x38'));}var _0x1f0598={'startDate':moment()[_0x1cc0('0x39')](_0x5aa7c2[_0x1cc0('0x1d')],_0x5aa7c2[_0x1cc0('0x1e')])[_0x1cc0('0x19')](_0x1cc0('0x3a')),'endDate':moment()[_0x1cc0('0x19')](_0x1cc0('0x3a')),'type':_0x1cc0('0x3b'),'output':_0x5aa7c2[_0x1cc0('0x3c')],'name':_0x5aa7c2[_0x1cc0('0x3d')]};if(!_[_0x1cc0('0x36')](_0x5aa7c2[_0x1cc0('0x3e')])){logger[_0x1cc0('0xd')]('exec\x20defaul\x20report\x20id:%s',_0x5aa7c2[_0x1cc0('0x3e')]);return analyticDefaultReportController[_0x1cc0('0x3f')]({'id':_0x5aa7c2[_0x1cc0('0x3e')]},_0x1f0598)[_0x1cc0('0x30')](handleResult(_0x5aa7c2))[_0x1cc0('0x33')](handleError());}if(!_[_0x1cc0('0x36')](_0x5aa7c2[_0x1cc0('0x40')])){logger[_0x1cc0('0xd')](_0x1cc0('0x41'),_0x5aa7c2[_0x1cc0('0x40')]);return analyticCustomReportController[_0x1cc0('0x3f')]({'id':_0x5aa7c2[_0x1cc0('0x40')]},_0x1f0598)[_0x1cc0('0x30')](handleResult(_0x5aa7c2))['catch'](handleError());}}catch(_0x124e3c){logger[_0x1cc0('0x31')](JSON[_0x1cc0('0x2a')](_0x124e3c));}return logger[_0x1cc0('0xd')](_0x1cc0('0x42'));};}function getJobs(_0x5a5c77){var _0x296937={};if(_0x5a5c77){_0x296937['id']=_0x5a5c77;}return db['Schedule'][_0x1cc0('0x43')]({'where':_0x296937,'include':[{'model':db[_0x1cc0('0xf')],'attributes':['id',_0x1cc0('0x3d'),_0x1cc0('0x1b')],'include':[{'model':db['MailServerOut'],'as':_0x1cc0('0x10')}]}]})[_0x1cc0('0x30')](function(_0x5ee77b){var _0x425949=_[_0x1cc0('0x44')](manager[_0x1cc0('0x45')]);var _0x1efacb=_[_0x1cc0('0x46')](_0x5ee77b,function(_0x21149a){return _0x21149a['id'][_0x1cc0('0x47')]();});var _0x13f5fe=_['keyBy'](_0x5ee77b,function(_0x2ecbab){return _0x2ecbab['id']['toString']();});var _0x1e9adf=_0x5a5c77?_0x1efacb:_[_0x1cc0('0x48')](_0x1efacb,_0x425949);var _0x545804=_[_0x1cc0('0x49')](_0x1efacb,_0x425949);var _0x365433=_[_0x1cc0('0x48')](_0x425949,_0x1efacb);var _0x4146f0;var _0xb1bd61;for(_0x4146f0=0x0;_0x4146f0<_0x365433[_0x1cc0('0x4a')]&&!_0x5a5c77;_0x4146f0+=0x1){_0xb1bd61=_0x365433[_0x4146f0]['toString']();if(manager[_0x1cc0('0x4b')](_0xb1bd61)){manager[_0x1cc0('0x4c')](_0xb1bd61);manager['deleteJob'](_0xb1bd61);logger[_0x1cc0('0xd')]('delete\x20cron',_0xb1bd61);}}logger[_0x1cc0('0xd')](_0x1cc0('0x4d'),JSON[_0x1cc0('0x2a')](_0x1e9adf));for(_0x4146f0=0x0;_0x4146f0<_0x1e9adf[_0x1cc0('0x4a')];_0x4146f0+=0x1){_0xb1bd61=_0x1e9adf[_0x4146f0][_0x1cc0('0x47')]();logger[_0x1cc0('0xd')](_0x1cc0('0x4e'),_0xb1bd61);if(_0x5a5c77){logger['info'](_0x1cc0('0x4f'),_0x5a5c77);logger['info'](JSON['stringify'](_0x13f5fe[_0xb1bd61]));BPromise['resolve']()[_0x1cc0('0x30')](handleJob(_0x13f5fe[_0xb1bd61]));logger['info'](_0x1cc0('0x50'),_0x13f5fe[_0xb1bd61][_0x1cc0('0x3d')],_0x13f5fe[_0xb1bd61][_0x1cc0('0x51')]);}else if(_0x13f5fe[_0xb1bd61]['cron']&&_0x13f5fe[_0xb1bd61][_0x1cc0('0x52')]&&moment()[_0x1cc0('0x53')](_0x13f5fe[_0xb1bd61][_0x1cc0('0x54')],_0x13f5fe[_0xb1bd61]['endAt'])){manager[_0x1cc0('0x55')](_0xb1bd61,_0x13f5fe[_0xb1bd61][_0x1cc0('0x51')],handleJob(_0x13f5fe[_0xb1bd61]));manager['start'](_0xb1bd61);logger[_0x1cc0('0xd')](_0x1cc0('0x56'),_0x13f5fe[_0xb1bd61][_0x1cc0('0x3d')],_0x13f5fe[_0xb1bd61][_0x1cc0('0x51')]);}else if(manager[_0x1cc0('0x4b')](_0xb1bd61)){manager[_0x1cc0('0x4c')](_0xb1bd61);manager['deleteJob'](_0xb1bd61);logger[_0x1cc0('0xd')](_0x1cc0('0x57'),_0x13f5fe[_0xb1bd61][_0x1cc0('0x3d')],_0x13f5fe[_0xb1bd61][_0x1cc0('0x51')]);}}for(_0x4146f0=0x0,_0xb1bd61;_0x4146f0<_0x545804[_0x1cc0('0x4a')]&&!_0x5a5c77;_0x4146f0+=0x1){_0xb1bd61=_0x545804[_0x4146f0][_0x1cc0('0x47')]();if(manager[_0x1cc0('0x4b')](_0xb1bd61)){if(_0x13f5fe[_0xb1bd61]['cron']&&_0x13f5fe[_0xb1bd61][_0x1cc0('0x52')]&&moment()[_0x1cc0('0x53')](_0x13f5fe[_0xb1bd61][_0x1cc0('0x54')],_0x13f5fe[_0xb1bd61]['endAt'])){manager[_0x1cc0('0x58')](_0xb1bd61,_0x13f5fe[_0xb1bd61][_0x1cc0('0x51')],handleJob(_0x13f5fe[_0xb1bd61]));logger['info'](_0x1cc0('0x59'),_0x13f5fe[_0xb1bd61][_0x1cc0('0x3d')],_0x13f5fe[_0xb1bd61]['cron']);}else{manager['stop'](_0xb1bd61);manager[_0x1cc0('0x5a')](_0xb1bd61);logger[_0x1cc0('0xd')]('stop\x20cron',_0x13f5fe[_0xb1bd61][_0x1cc0('0x3d')],_0x13f5fe[_0xb1bd61][_0x1cc0('0x51')]);}}}})[_0x1cc0('0x33')](function(_0x68e3e3){logger[_0x1cc0('0x31')](JSON[_0x1cc0('0x2a')](_0x68e3e3));});}exports[_0x1cc0('0x5b')]=function(_0xffe507){return getJobs(_0xffe507);};exports[_0x1cc0('0x5c')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xd8e0=['../../files/reports','savename','%s.%s','basename','extname','zip','existsSync','message','text','status','attachments','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','error\x20mail','stringify','email\x20sent','catch','error','isNil','subtractNumber\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','then','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','MailServerOut','keys','jobs','map','toString','keyBy','intersection','difference','length','exists','stop','delete\x20cron','toRun','index','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','endAt','add','start','add\x20cron','deleteJob','stop\x20cron','update','update\x20cron','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','../../mysqldb','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','Smtp','service','MailAccount','host','port','secure','authentication','auth','pass','format','name','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join'];(function(_0x12fa29,_0x3db9a3){var _0x2421aa=function(_0x2b2a91){while(--_0x2b2a91){_0x12fa29['push'](_0x12fa29['shift']());}};_0x2421aa(++_0x3db9a3);}(_0xd8e0,0x1af));var _0x0d8e=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0xd8e0[_0x40220a];return _0x3903cc;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x0d8e('0x0'));var _=require(_0x0d8e('0x1'));var moment=require(_0x0d8e('0x2'));var CronJobManager=require(_0x0d8e('0x3'));var jayson=require(_0x0d8e('0x4'));var BPromise=require(_0x0d8e('0x5'));var logger=require(_0x0d8e('0x6'))('schedule');var db=require(_0x0d8e('0x7'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x0d8e('0x8'));var client=jayson['client'][_0x0d8e('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x3b90b6,_0x286b21){return function(){logger[_0x0d8e('0xa')](_0x0d8e('0xb'),_0x3b90b6[_0x0d8e('0xc')]);var _0x233cd6=!![];var _0xf8f64a={'tls':{'rejectUnauthorized':![]}};if(_0x3b90b6['MailAccount'][_0x0d8e('0xd')]['service']){_0xf8f64a[_0x0d8e('0xe')]=_0x3b90b6[_0x0d8e('0xf')][_0x0d8e('0xd')][_0x0d8e('0xe')];}else{_0xf8f64a[_0x0d8e('0x10')]=_0x3b90b6['MailAccount'][_0x0d8e('0xd')][_0x0d8e('0x10')];_0xf8f64a[_0x0d8e('0x11')]=_0x3b90b6[_0x0d8e('0xf')][_0x0d8e('0xd')][_0x0d8e('0x11')];_0xf8f64a[_0x0d8e('0x12')]=_0x3b90b6[_0x0d8e('0xf')][_0x0d8e('0xd')][_0x0d8e('0x12')];}if(_0x3b90b6[_0x0d8e('0xf')][_0x0d8e('0xd')][_0x0d8e('0x13')]){_0xf8f64a[_0x0d8e('0x14')]={'user':_0x3b90b6[_0x0d8e('0xf')][_0x0d8e('0xd')]['user'],'pass':_0x3b90b6[_0x0d8e('0xf')][_0x0d8e('0xd')][_0x0d8e('0x15')]};}var _0x13ef57={'account':_0xf8f64a,'message':{'from':util[_0x0d8e('0x16')]('\x22%s\x22\x20<%s>',_0x3b90b6['MailAccount'][_0x0d8e('0x17')],_0x3b90b6['MailAccount']['email']||_0x3b90b6[_0x0d8e('0xf')][_0x0d8e('0xd')]['user']),'to':_0x3b90b6['email'],'cc':_0x3b90b6['cc'],'bcc':_0x3b90b6[_0x0d8e('0x18')],'subject':util[_0x0d8e('0x16')](_0x0d8e('0x19'),_0x286b21[_0x0d8e('0x17')],_0x3b90b6[_0x0d8e('0x1a')],_0x3b90b6[_0x0d8e('0x1b')])}};var _0x597d7d=path[_0x0d8e('0x1c')](__dirname,_0x0d8e('0x1d'));var _0x554969=_0x286b21[_0x0d8e('0x1e')];var _0xa7ddba=util[_0x0d8e('0x16')](_0x0d8e('0x1f'),path[_0x0d8e('0x20')](_0x286b21['savename'],path[_0x0d8e('0x21')](_0x286b21[_0x0d8e('0x1e')])),_0x0d8e('0x22'));var _0xd5c1a7=path[_0x0d8e('0x1c')](_0x597d7d,_0x554969);var _0x14014c=path[_0x0d8e('0x1c')](_0x597d7d,_0xa7ddba);if(fs[_0x0d8e('0x23')](_0xd5c1a7)){_0x286b21['status']='Sent';_0x13ef57[_0x0d8e('0x24')]['attachments']=[{'filename':_0x554969,'path':_0xd5c1a7}];_0x13ef57[_0x0d8e('0x24')][_0x0d8e('0x25')]=util[_0x0d8e('0x16')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON['stringify'](_0x286b21,null,0x2));}else if(fs['existsSync'](_0x14014c)){_0x286b21[_0x0d8e('0x26')]='Sent';_0x13ef57[_0x0d8e('0x24')][_0x0d8e('0x27')]=[{'filename':_0xa7ddba,'path':_0x14014c}];}else{_0x13ef57[_0x0d8e('0x24')][_0x0d8e('0x25')]=_0x0d8e('0x28');if(!_0x3b90b6[_0x0d8e('0x29')]){_0x233cd6=![];logger['info'](_0x0d8e('0x2a'));}}if(_0x233cd6){return client[_0x0d8e('0x2b')](_0x0d8e('0x2c'),_0x13ef57)['then'](function(_0x466b61){if(_0x466b61['error']){return logger['error'](_0x0d8e('0x2d'),JSON[_0x0d8e('0x2e')](_0x466b61));}return logger[_0x0d8e('0xa')](_0x0d8e('0x2f'));})[_0x0d8e('0x30')](function(_0x235331){return logger[_0x0d8e('0x31')](_0x0d8e('0x2d'),JSON[_0x0d8e('0x2e')](_0x235331));});}};}function handleError(){return function(_0x35718f){return logger[_0x0d8e('0x31')](JSON['stringify'](_0x35718f));};}function handleResult(_0x25f9b9){return function(_0x42b7f6){logger[_0x0d8e('0xa')]('data',JSON[_0x0d8e('0x2e')](_0x42b7f6));if(_0x25f9b9[_0x0d8e('0xf')]&&_0x25f9b9[_0x0d8e('0xf')][_0x0d8e('0xd')]&&!_[_0x0d8e('0x32')](_0x25f9b9[_0x0d8e('0xc')])){setTimeout(handleSendEmail(_0x25f9b9,_0x42b7f6),0x3c*0x3e8);}};}function handleJob(_0x2804f1){return function(){try{if(_[_0x0d8e('0x32')](_0x2804f1[_0x0d8e('0x1a')])){return logger[_0x0d8e('0xa')](_0x0d8e('0x33'));}if(_[_0x0d8e('0x32')](_0x2804f1[_0x0d8e('0x1b')])){return logger[_0x0d8e('0xa')]('subtractUnit\x20null\x20or\x20undefined');}var _0x90bf45={'startDate':moment()[_0x0d8e('0x34')](_0x2804f1[_0x0d8e('0x1a')],_0x2804f1[_0x0d8e('0x1b')])[_0x0d8e('0x16')](_0x0d8e('0x35')),'endDate':moment()[_0x0d8e('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x0d8e('0x36'),'output':_0x2804f1[_0x0d8e('0x37')],'name':_0x2804f1[_0x0d8e('0x17')]};if(!_['isNil'](_0x2804f1[_0x0d8e('0x38')])){logger[_0x0d8e('0xa')](_0x0d8e('0x39'),_0x2804f1['DefaultReportId']);return analyticDefaultReportController[_0x0d8e('0x3a')]({'id':_0x2804f1[_0x0d8e('0x38')]},_0x90bf45)[_0x0d8e('0x3b')](handleResult(_0x2804f1))[_0x0d8e('0x30')](handleError());}if(!_[_0x0d8e('0x32')](_0x2804f1[_0x0d8e('0x3c')])){logger[_0x0d8e('0xa')](_0x0d8e('0x3d'),_0x2804f1['CustomReportId']);return analyticCustomReportController[_0x0d8e('0x3a')]({'id':_0x2804f1['CustomReportId']},_0x90bf45)[_0x0d8e('0x3b')](handleResult(_0x2804f1))[_0x0d8e('0x30')](handleError());}}catch(_0x349676){logger[_0x0d8e('0x31')](JSON[_0x0d8e('0x2e')](_0x349676));}return logger['info'](_0x0d8e('0x3e'));};}function getJobs(_0x303c46){var _0x5c56ea={};if(_0x303c46){_0x5c56ea['id']=_0x303c46;}return db['Schedule']['findAll']({'where':_0x5c56ea,'include':[{'model':db['MailAccount'],'attributes':['id',_0x0d8e('0x17'),_0x0d8e('0xc')],'include':[{'model':db[_0x0d8e('0x3f')],'as':_0x0d8e('0xd')}]}]})[_0x0d8e('0x3b')](function(_0x2dc6c0){var _0x2c2492=_[_0x0d8e('0x40')](manager[_0x0d8e('0x41')]);var _0x2f3a15=_[_0x0d8e('0x42')](_0x2dc6c0,function(_0x32673b){return _0x32673b['id'][_0x0d8e('0x43')]();});var _0x235c7a=_[_0x0d8e('0x44')](_0x2dc6c0,function(_0x393aaa){return _0x393aaa['id'][_0x0d8e('0x43')]();});var _0x320a57=_0x303c46?_0x2f3a15:_['difference'](_0x2f3a15,_0x2c2492);var _0x4cd954=_[_0x0d8e('0x45')](_0x2f3a15,_0x2c2492);var _0x332727=_[_0x0d8e('0x46')](_0x2c2492,_0x2f3a15);var _0x123f50;var _0x4695e3;for(_0x123f50=0x0;_0x123f50<_0x332727[_0x0d8e('0x47')]&&!_0x303c46;_0x123f50+=0x1){_0x4695e3=_0x332727[_0x123f50][_0x0d8e('0x43')]();if(manager[_0x0d8e('0x48')](_0x4695e3)){manager[_0x0d8e('0x49')](_0x4695e3);manager['deleteJob'](_0x4695e3);logger['info'](_0x0d8e('0x4a'),_0x4695e3);}}logger[_0x0d8e('0xa')](_0x0d8e('0x4b'),JSON['stringify'](_0x320a57));for(_0x123f50=0x0;_0x123f50<_0x320a57['length'];_0x123f50+=0x1){_0x4695e3=_0x320a57[_0x123f50][_0x0d8e('0x43')]();logger['info'](_0x0d8e('0x4c'),_0x4695e3);if(_0x303c46){logger[_0x0d8e('0xa')](_0x0d8e('0x4d'),_0x303c46);logger[_0x0d8e('0xa')](JSON[_0x0d8e('0x2e')](_0x235c7a[_0x4695e3]));BPromise[_0x0d8e('0x4e')]()[_0x0d8e('0x3b')](handleJob(_0x235c7a[_0x4695e3]));logger[_0x0d8e('0xa')](_0x0d8e('0x4f'),_0x235c7a[_0x4695e3][_0x0d8e('0x17')],_0x235c7a[_0x4695e3][_0x0d8e('0x50')]);}else if(_0x235c7a[_0x4695e3][_0x0d8e('0x50')]&&_0x235c7a[_0x4695e3][_0x0d8e('0x51')]&&moment()[_0x0d8e('0x52')](_0x235c7a[_0x4695e3][_0x0d8e('0x53')],_0x235c7a[_0x4695e3][_0x0d8e('0x54')])){manager[_0x0d8e('0x55')](_0x4695e3,_0x235c7a[_0x4695e3][_0x0d8e('0x50')],handleJob(_0x235c7a[_0x4695e3]));manager[_0x0d8e('0x56')](_0x4695e3);logger[_0x0d8e('0xa')](_0x0d8e('0x57'),_0x235c7a[_0x4695e3][_0x0d8e('0x17')],_0x235c7a[_0x4695e3][_0x0d8e('0x50')]);}else if(manager[_0x0d8e('0x48')](_0x4695e3)){manager[_0x0d8e('0x49')](_0x4695e3);manager[_0x0d8e('0x58')](_0x4695e3);logger[_0x0d8e('0xa')](_0x0d8e('0x59'),_0x235c7a[_0x4695e3][_0x0d8e('0x17')],_0x235c7a[_0x4695e3][_0x0d8e('0x50')]);}}for(_0x123f50=0x0,_0x4695e3;_0x123f50<_0x4cd954[_0x0d8e('0x47')]&&!_0x303c46;_0x123f50+=0x1){_0x4695e3=_0x4cd954[_0x123f50][_0x0d8e('0x43')]();if(manager[_0x0d8e('0x48')](_0x4695e3)){if(_0x235c7a[_0x4695e3][_0x0d8e('0x50')]&&_0x235c7a[_0x4695e3][_0x0d8e('0x51')]&&moment()['isBetween'](_0x235c7a[_0x4695e3][_0x0d8e('0x53')],_0x235c7a[_0x4695e3][_0x0d8e('0x54')])){manager[_0x0d8e('0x5a')](_0x4695e3,_0x235c7a[_0x4695e3][_0x0d8e('0x50')],handleJob(_0x235c7a[_0x4695e3]));logger['info'](_0x0d8e('0x5b'),_0x235c7a[_0x4695e3][_0x0d8e('0x17')],_0x235c7a[_0x4695e3][_0x0d8e('0x50')]);}else{manager[_0x0d8e('0x49')](_0x4695e3);manager[_0x0d8e('0x58')](_0x4695e3);logger['info'](_0x0d8e('0x59'),_0x235c7a[_0x4695e3][_0x0d8e('0x17')],_0x235c7a[_0x4695e3][_0x0d8e('0x50')]);}}}})[_0x0d8e('0x30')](function(_0x5a207d){logger[_0x0d8e('0x31')](JSON[_0x0d8e('0x2e')](_0x5a207d));});}exports['run']=function(_0x5de003){return getJobs(_0x5de003);};exports[_0x0d8e('0x56')]=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 6ea302c..f2e44dc 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 _0x67da=['[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','SentimentScore','Positive','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','Sentiment','Negative','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','VoiceRecording','findAll','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribeAccountId','forEach','push','all','catch','start','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','transcribeRegion','then','TranscriptionJobStatus','fileText','TranscriptionJob','COMPLETED','Transcript','TranscriptFileUri','info','format','[RECORDING:%d]\x20Get\x20transcript','results','transcripts','length','update'];(function(_0x4d13ba,_0x425bd8){var _0x10e236=function(_0x585057){while(--_0x585057){_0x4d13ba['push'](_0x4d13ba['shift']());}};_0x10e236(++_0x425bd8);}(_0x67da,0x192));var _0xa67d=function(_0x1524a0,_0x1a9489){_0x1524a0=_0x1524a0-0x0;var _0x4ea1ab=_0x67da[_0x1524a0];return _0x4ea1ab;};var _=require('lodash');var AWS=require(_0xa67d('0x0'));var rp=require(_0xa67d('0x1'));var util=require(_0xa67d('0x2'));var BPromise=require(_0xa67d('0x3'));var db=require(_0xa67d('0x4'))['db'];var logger=require(_0xa67d('0x5'))(_0xa67d('0x6'));function getTranscriptionJob(_0x1a8b5e,_0x3dcee7,_0x359c06,_0x4851cb){return new Promise(function(_0x5b8ec7,_0x408786){var _0x4d2734=new AWS[(_0xa67d('0x7'))]({'accessKeyId':_0x3dcee7,'secretAccessKey':_0x1a8b5e,'region':_0x359c06});_0x4d2734[_0xa67d('0x8')]({'TranscriptionJobName':_0x4851cb},function(_0x10f89a,_0x2c37c2){if(_0x10f89a){return _0x408786(_0x10f89a);}else{return _0x5b8ec7(_0x2c37c2);}});});}function sentiment(_0x23cbc5,_0x285e16,_0x330a9f,_0x3e58e0,_0x1e1ef6){return new Promise(function(_0x3d9b30,_0x52a024){var _0x284d90=new AWS[(_0xa67d('0x9'))]({'accessKeyId':_0x285e16,'secretAccessKey':_0x23cbc5,'region':_0x330a9f});_0x284d90[_0xa67d('0xa')]({'Text':_0x3e58e0,'LanguageCode':_0x1e1ef6[_0xa67d('0xb')](0x0,0x2)},function(_0x50561d,_0x3cd18a){if(_0x50561d){return _0x52a024(_0x50561d);}else{return _0x3d9b30(_0x3cd18a);}});});}function checkTranscribeJob(_0x431f21,_0x560485,_0x4e86f6){var _0x304ee2;return new BPromise(function(_0x47ac79,_0x10d5ef){logger['info'](util['format'](_0xa67d('0xc'),_0x431f21['id'],_0x431f21[_0xa67d('0xd')]));return getTranscriptionJob(_0x4e86f6['data1'],_0x4e86f6[_0xa67d('0xe')],_0x560485[_0xa67d('0xf')],_0x431f21[_0xa67d('0xd')])[_0xa67d('0x10')](function(_0x5a47de){logger['info'](util['format']('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x431f21['id'],_0x431f21[_0xa67d('0xd')],_0x5a47de['TranscriptionJob'][_0xa67d('0x11')]));if(!_0x431f21[_0xa67d('0x12')]){switch(_0x5a47de[_0xa67d('0x13')][_0xa67d('0x11')]){case _0xa67d('0x14'):var _0xb1ea04={'transcribeStatus':_0x5a47de[_0xa67d('0x13')]['TranscriptionJobStatus'],'fileUri':_0x5a47de[_0xa67d('0x13')][_0xa67d('0x15')][_0xa67d('0x16')]};logger[_0xa67d('0x17')](util[_0xa67d('0x18')](_0xa67d('0x19'),_0x431f21['id']));return rp({'uri':_0x5a47de['TranscriptionJob'][_0xa67d('0x15')][_0xa67d('0x16')],'json':!![]})[_0xa67d('0x10')](function(_0xed6c3e){logger[_0xa67d('0x17')](util[_0xa67d('0x18')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x431f21['id']));if(_0xed6c3e&&_0xed6c3e[_0xa67d('0x1a')]&&_0xed6c3e[_0xa67d('0x1a')][_0xa67d('0x1b')]&&_0xed6c3e[_0xa67d('0x1a')][_0xa67d('0x1b')][_0xa67d('0x1c')]){_0xb1ea04[_0xa67d('0x12')]='';for(var _0x5ed92a=0x0;_0x5ed92a<_0xed6c3e[_0xa67d('0x1a')][_0xa67d('0x1b')][_0xa67d('0x1c')];_0x5ed92a++){_0xb1ea04[_0xa67d('0x12')]+=_0xed6c3e[_0xa67d('0x1a')][_0xa67d('0x1b')][_0x5ed92a]['transcript']+'';}}return _0x431f21[_0xa67d('0x1d')](_0xb1ea04);})[_0xa67d('0x10')](function(){logger['info'](util[_0xa67d('0x18')](_0xa67d('0x1e'),_0x431f21['id']));if(!_0x431f21[_0xa67d('0x1f')]){throw new db[(_0xa67d('0x20'))][(_0xa67d('0x21'))](_0xa67d('0x22'));}if(!_0x560485[_0xa67d('0x23')]||!_0x560485[_0xa67d('0x24')]||!_0x560485[_0xa67d('0x25')]||!_0x560485[_0xa67d('0x26')]||!_0x560485[_0xa67d('0x27')]){throw new db[(_0xa67d('0x20'))][(_0xa67d('0x21'))](_0xa67d('0x28'));}if(!_0xb1ea04['fileText']){throw new Error(_0xa67d('0x29'));}if(_0x560485[_0xa67d('0x24')]===_0x4e86f6['id']){return _0x4e86f6;}else{return db[_0xa67d('0x2a')][_0xa67d('0x2b')]({'where':{'id':_settings[_0xa67d('0x24')]}});}})['then'](function(_0x371894){if(!_0x371894){throw new db[(_0xa67d('0x20'))][(_0xa67d('0x21'))](_0xa67d('0x2c'));}if(!_0x371894[_0xa67d('0x2d')]||!_0x371894[_0xa67d('0xe')]){throw new db[(_0xa67d('0x20'))][(_0xa67d('0x21'))](_0xa67d('0x2e'));}_0x304ee2=_0x371894;logger[_0xa67d('0x17')](util['format'](_0xa67d('0x2f'),_0x431f21['id']));return sentiment(_0x304ee2['data1'],_0x304ee2[_0xa67d('0xe')],_0x560485[_0xa67d('0x25')],_0xb1ea04[_0xa67d('0x12')],_0x560485['language']);})[_0xa67d('0x10')](function(_0x1fd5b6){logger[_0xa67d('0x17')](util[_0xa67d('0x18')](_0xa67d('0x30'),_0x431f21['id']));return _0x431f21[_0xa67d('0x1d')]({'sentiment':_0x1fd5b6['Sentiment'],'sPositive':_0x1fd5b6[_0xa67d('0x31')][_0xa67d('0x32')],'sNegative':_0x1fd5b6['SentimentScore']['Negative'],'sMixed':_0x1fd5b6['SentimentScore'][_0xa67d('0x33')],'sNeutral':_0x1fd5b6['SentimentScore'][_0xa67d('0x34')]});})[_0xa67d('0x10')](function(){logger[_0xa67d('0x17')](util[_0xa67d('0x18')](_0xa67d('0x1e'),_0x431f21['id']));_0x47ac79();});case _0xa67d('0x35'):return _0x431f21[_0xa67d('0x1d')]({'transcribeStatus':_0xa67d('0x35'),'failureReason':_0x5a47de[_0xa67d('0x13')][_0xa67d('0x36')]})[_0xa67d('0x10')](function(){logger[_0xa67d('0x17')](util[_0xa67d('0x18')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x431f21['id']));_0x47ac79();});default:logger['info'](util['format'](_0xa67d('0x37'),_0x431f21['id']));break;}}else{return BPromise['resolve']()[_0xa67d('0x10')](function(){if(!_0x431f21[_0xa67d('0x1f')]){throw new db[(_0xa67d('0x20'))][(_0xa67d('0x21'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x560485[_0xa67d('0x23')]||!_0x560485[_0xa67d('0x24')]||!_0x560485[_0xa67d('0x25')]||!_0x560485[_0xa67d('0x26')]||!_0x560485[_0xa67d('0x27')]){throw new db[(_0xa67d('0x20'))][(_0xa67d('0x21'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x431f21['fileText']){throw new Error(_0xa67d('0x29'));}if(_0x560485[_0xa67d('0x24')]===_0x4e86f6['id']){return _0x4e86f6;}else{return db[_0xa67d('0x2a')][_0xa67d('0x2b')]({'where':{'id':_settings[_0xa67d('0x24')]}});}})[_0xa67d('0x10')](function(_0x57a27d){if(!_0x57a27d){throw new db[(_0xa67d('0x20'))]['ValidationError'](_0xa67d('0x2c'));}if(!_0x57a27d[_0xa67d('0x2d')]||!_0x57a27d[_0xa67d('0xe')]){throw new db['Sequelize'][(_0xa67d('0x21'))](_0xa67d('0x2e'));}_0x304ee2=_0x57a27d;logger['info'](util['format'](_0xa67d('0x2f'),_0x431f21['id']));return sentiment(_0x304ee2['data1'],_0x304ee2[_0xa67d('0xe')],_0x560485[_0xa67d('0x25')],_0x431f21[_0xa67d('0x12')],_0x560485['language']);})[_0xa67d('0x10')](function(_0x5a2ac5){logger[_0xa67d('0x17')](util[_0xa67d('0x18')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x431f21['id']));return _0x431f21[_0xa67d('0x1d')]({'sentiment':_0x5a2ac5[_0xa67d('0x38')],'sPositive':_0x5a2ac5[_0xa67d('0x31')][_0xa67d('0x32')],'sNegative':_0x5a2ac5[_0xa67d('0x31')][_0xa67d('0x39')],'sMixed':_0x5a2ac5[_0xa67d('0x31')][_0xa67d('0x33')],'sNeutral':_0x5a2ac5['SentimentScore'][_0xa67d('0x34')],'transcribeStatus':_0xa67d('0x14')});})[_0xa67d('0x10')](function(){logger[_0xa67d('0x17')](util[_0xa67d('0x18')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x431f21['id']));_0x47ac79();});}})['catch'](function(_0x3f6711){if(_0x3f6711){if(!_0x3f6711[_0xa67d('0x3a')]||_0x3f6711[_0xa67d('0x3a')]!==_0xa67d('0x3b')){logger[_0xa67d('0x3c')](util['format'](_0xa67d('0x3d'),_0x431f21['id']),util['inspect'](_0x3f6711,{'showHidden':![],'depth':null}));}}_0x47ac79();});});}function checkTranscribe(){var _0x15ee01;var _0x2d926e;var _0x1c451f;return db[_0xa67d('0x3e')][_0xa67d('0x3f')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0xa67d('0x10')](function(_0x3c392f){if(!_0x3c392f||!_0x3c392f[_0xa67d('0x1c')]){throw new db[(_0xa67d('0x20'))][(_0xa67d('0x21'))](_0xa67d('0x40'));}_0x15ee01=_0x3c392f;return db['Setting'][_0xa67d('0x2b')]({'where':{'id':0x1}});})[_0xa67d('0x10')](function(_0x51c887){if(!_0x51c887){throw new db['Sequelize'][(_0xa67d('0x21'))](_0xa67d('0x41'));}_0x2d926e=_0x51c887;if(!_0x2d926e[_0xa67d('0x6')]||!_0x2d926e[_0xa67d('0x42')]||!_0x2d926e[_0xa67d('0xf')]||!_0x2d926e[_0xa67d('0x26')]||!_0x2d926e[_0xa67d('0x27')]){throw new db[(_0xa67d('0x20'))][(_0xa67d('0x21'))]('Transcribe\x20not\x20configured');}return db[_0xa67d('0x2a')][_0xa67d('0x2b')]({'where':{'id':_0x2d926e['transcribeAccountId']}});})[_0xa67d('0x10')](function(_0x18f99d){if(!_0x18f99d){throw new db['Sequelize'][(_0xa67d('0x21'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x18f99d[_0xa67d('0x2d')]||!_0x18f99d[_0xa67d('0xe')]){throw new db[(_0xa67d('0x20'))][(_0xa67d('0x21'))](_0xa67d('0x2e'));}_0x1c451f=_0x18f99d;var _0x17249a=[];_0x15ee01[_0xa67d('0x43')](function(_0xe0e2ed){_0x17249a[_0xa67d('0x44')](checkTranscribeJob(_0xe0e2ed,_0x2d926e,_0x1c451f));});return BPromise[_0xa67d('0x45')](_0x17249a);})[_0xa67d('0x46')](function(_0x4e4af3){if(_0x4e4af3){if(!_0x4e4af3[_0xa67d('0x3a')]||_0x4e4af3[_0xa67d('0x3a')]!==_0xa67d('0x3b')){logger[_0xa67d('0x3c')](util['inspect'](_0x4e4af3,{'showHidden':![],'depth':null}));}}});}exports[_0xa67d('0x47')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xc35f=['[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','Neutral','catch','name','SequelizeValidationError','error','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','all','start','lodash','aws-sdk','request-promise','util','../../mysqldb','../../config/logger','transcribe','getTranscriptionJob','Comprehend','substring','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','transcribeRegion','then','format','TranscriptionJob','fileText','TranscriptionJobStatus','TranscriptFileUri','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','ValidationError','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Sequelize','Cloud\x20Provider\x20not\x20available','data1','data2','SentimentScore','Positive','Negative','Mixed','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','bucket','Cloud\x20Provider\x20not\x20configured'];(function(_0x539bda,_0x2507ac){var _0x5c7c2f=function(_0x2bd317){while(--_0x2bd317){_0x539bda['push'](_0x539bda['shift']());}};_0x5c7c2f(++_0x2507ac);}(_0xc35f,0x1ca));var _0xfc35=function(_0x247f11,_0x2075c8){_0x247f11=_0x247f11-0x0;var _0x1ffb8e=_0xc35f[_0x247f11];return _0x1ffb8e;};var _=require(_0xfc35('0x0'));var AWS=require(_0xfc35('0x1'));var rp=require(_0xfc35('0x2'));var util=require(_0xfc35('0x3'));var BPromise=require('bluebird');var db=require(_0xfc35('0x4'))['db'];var logger=require(_0xfc35('0x5'))(_0xfc35('0x6'));function getTranscriptionJob(_0x54ce0c,_0x4739a0,_0x5abe8c,_0x4bd1ea){return new Promise(function(_0x6d47a0,_0x1991a5){var _0x4c92db=new AWS['TranscribeService']({'accessKeyId':_0x4739a0,'secretAccessKey':_0x54ce0c,'region':_0x5abe8c});_0x4c92db[_0xfc35('0x7')]({'TranscriptionJobName':_0x4bd1ea},function(_0x290dcc,_0x43deed){if(_0x290dcc){return _0x1991a5(_0x290dcc);}else{return _0x6d47a0(_0x43deed);}});});}function sentiment(_0x4aabff,_0x350796,_0x13d7b9,_0x7cc33a,_0x5278e3){return new Promise(function(_0x28242f,_0xad628d){var _0x37f6ba=new AWS[(_0xfc35('0x8'))]({'accessKeyId':_0x350796,'secretAccessKey':_0x4aabff,'region':_0x13d7b9});_0x37f6ba['detectSentiment']({'Text':_0x7cc33a,'LanguageCode':_0x5278e3[_0xfc35('0x9')](0x0,0x2)},function(_0x249998,_0x511d4e){if(_0x249998){return _0xad628d(_0x249998);}else{return _0x28242f(_0x511d4e);}});});}function checkTranscribeJob(_0x546f47,_0x419378,_0x188be4){var _0x48bf41;return new BPromise(function(_0x3703cf,_0x4f1d03){logger[_0xfc35('0xa')](util['format'](_0xfc35('0xb'),_0x546f47['id'],_0x546f47[_0xfc35('0xc')]));return getTranscriptionJob(_0x188be4['data1'],_0x188be4['data2'],_0x419378[_0xfc35('0xd')],_0x546f47[_0xfc35('0xc')])[_0xfc35('0xe')](function(_0x10cf41){logger[_0xfc35('0xa')](util[_0xfc35('0xf')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x546f47['id'],_0x546f47[_0xfc35('0xc')],_0x10cf41[_0xfc35('0x10')]['TranscriptionJobStatus']));if(!_0x546f47[_0xfc35('0x11')]){switch(_0x10cf41[_0xfc35('0x10')][_0xfc35('0x12')]){case'COMPLETED':var _0x19e319={'transcribeStatus':_0x10cf41[_0xfc35('0x10')][_0xfc35('0x12')],'fileUri':_0x10cf41[_0xfc35('0x10')]['Transcript'][_0xfc35('0x13')]};logger[_0xfc35('0xa')](util[_0xfc35('0xf')]('[RECORDING:%d]\x20Get\x20transcript',_0x546f47['id']));return rp({'uri':_0x10cf41[_0xfc35('0x10')][_0xfc35('0x14')]['TranscriptFileUri'],'json':!![]})['then'](function(_0xbb7262){logger[_0xfc35('0xa')](util['format'](_0xfc35('0x15'),_0x546f47['id']));if(_0xbb7262&&_0xbb7262[_0xfc35('0x16')]&&_0xbb7262['results'][_0xfc35('0x17')]&&_0xbb7262[_0xfc35('0x16')][_0xfc35('0x17')]['length']){_0x19e319[_0xfc35('0x11')]='';for(var _0x4a9333=0x0;_0x4a9333<_0xbb7262[_0xfc35('0x16')][_0xfc35('0x17')][_0xfc35('0x18')];_0x4a9333++){_0x19e319[_0xfc35('0x11')]+=_0xbb7262[_0xfc35('0x16')][_0xfc35('0x17')][_0x4a9333][_0xfc35('0x19')]+'';}}return _0x546f47[_0xfc35('0x1a')](_0x19e319);})[_0xfc35('0xe')](function(){logger['info'](util[_0xfc35('0xf')](_0xfc35('0x1b'),_0x546f47['id']));if(!_0x546f47[_0xfc35('0x1c')]){throw new db['Sequelize']['ValidationError'](_0xfc35('0x1d'));}if(!_0x419378[_0xfc35('0x1e')]||!_0x419378[_0xfc35('0x1f')]||!_0x419378[_0xfc35('0x20')]||!_0x419378[_0xfc35('0x21')]||!_0x419378['bucket']){throw new db['Sequelize'][(_0xfc35('0x22'))](_0xfc35('0x23'));}if(!_0x19e319[_0xfc35('0x11')]){throw new Error(_0xfc35('0x24'));}if(_0x419378[_0xfc35('0x1f')]===_0x188be4['id']){return _0x188be4;}else{return db[_0xfc35('0x25')][_0xfc35('0x26')]({'where':{'id':_settings[_0xfc35('0x1f')]}});}})[_0xfc35('0xe')](function(_0x51e5f0){if(!_0x51e5f0){throw new db[(_0xfc35('0x27'))][(_0xfc35('0x22'))](_0xfc35('0x28'));}if(!_0x51e5f0[_0xfc35('0x29')]||!_0x51e5f0[_0xfc35('0x2a')]){throw new db[(_0xfc35('0x27'))][(_0xfc35('0x22'))]('Cloud\x20Provider\x20not\x20configured');}_0x48bf41=_0x51e5f0;logger[_0xfc35('0xa')](util[_0xfc35('0xf')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x546f47['id']));return sentiment(_0x48bf41[_0xfc35('0x29')],_0x48bf41[_0xfc35('0x2a')],_0x419378['sentimentRegion'],_0x19e319[_0xfc35('0x11')],_0x419378[_0xfc35('0x21')]);})['then'](function(_0x4f8c72){logger[_0xfc35('0xa')](util[_0xfc35('0xf')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x546f47['id']));return _0x546f47[_0xfc35('0x1a')]({'sentiment':_0x4f8c72['Sentiment'],'sPositive':_0x4f8c72[_0xfc35('0x2b')][_0xfc35('0x2c')],'sNegative':_0x4f8c72[_0xfc35('0x2b')][_0xfc35('0x2d')],'sMixed':_0x4f8c72[_0xfc35('0x2b')][_0xfc35('0x2e')],'sNeutral':_0x4f8c72['SentimentScore']['Neutral']});})[_0xfc35('0xe')](function(){logger['info'](util[_0xfc35('0xf')](_0xfc35('0x1b'),_0x546f47['id']));_0x3703cf();});case _0xfc35('0x2f'):return _0x546f47['update']({'transcribeStatus':_0xfc35('0x2f'),'failureReason':_0x10cf41['TranscriptionJob'][_0xfc35('0x30')]})[_0xfc35('0xe')](function(){logger[_0xfc35('0xa')](util[_0xfc35('0xf')](_0xfc35('0x1b'),_0x546f47['id']));_0x3703cf();});default:logger['info'](util[_0xfc35('0xf')](_0xfc35('0x31'),_0x546f47['id']));break;}}else{return BPromise[_0xfc35('0x32')]()[_0xfc35('0xe')](function(){if(!_0x546f47[_0xfc35('0x1c')]){throw new db[(_0xfc35('0x27'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x419378[_0xfc35('0x1e')]||!_0x419378[_0xfc35('0x1f')]||!_0x419378[_0xfc35('0x20')]||!_0x419378[_0xfc35('0x21')]||!_0x419378[_0xfc35('0x33')]){throw new db[(_0xfc35('0x27'))][(_0xfc35('0x22'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x546f47[_0xfc35('0x11')]){throw new Error(_0xfc35('0x24'));}if(_0x419378[_0xfc35('0x1f')]===_0x188be4['id']){return _0x188be4;}else{return db[_0xfc35('0x25')][_0xfc35('0x26')]({'where':{'id':_settings[_0xfc35('0x1f')]}});}})[_0xfc35('0xe')](function(_0x40810a){if(!_0x40810a){throw new db[(_0xfc35('0x27'))][(_0xfc35('0x22'))](_0xfc35('0x28'));}if(!_0x40810a['data1']||!_0x40810a['data2']){throw new db[(_0xfc35('0x27'))]['ValidationError'](_0xfc35('0x34'));}_0x48bf41=_0x40810a;logger['info'](util[_0xfc35('0xf')](_0xfc35('0x35'),_0x546f47['id']));return sentiment(_0x48bf41[_0xfc35('0x29')],_0x48bf41['data2'],_0x419378[_0xfc35('0x20')],_0x546f47[_0xfc35('0x11')],_0x419378[_0xfc35('0x21')]);})['then'](function(_0x4b3f3c){logger[_0xfc35('0xa')](util[_0xfc35('0xf')](_0xfc35('0x36'),_0x546f47['id']));return _0x546f47['update']({'sentiment':_0x4b3f3c[_0xfc35('0x37')],'sPositive':_0x4b3f3c[_0xfc35('0x2b')][_0xfc35('0x2c')],'sNegative':_0x4b3f3c[_0xfc35('0x2b')][_0xfc35('0x2d')],'sMixed':_0x4b3f3c[_0xfc35('0x2b')][_0xfc35('0x2e')],'sNeutral':_0x4b3f3c[_0xfc35('0x2b')][_0xfc35('0x38')],'transcribeStatus':'COMPLETED'});})[_0xfc35('0xe')](function(){logger[_0xfc35('0xa')](util[_0xfc35('0xf')](_0xfc35('0x1b'),_0x546f47['id']));_0x3703cf();});}})[_0xfc35('0x39')](function(_0x17046a){if(_0x17046a){if(!_0x17046a[_0xfc35('0x3a')]||_0x17046a[_0xfc35('0x3a')]!==_0xfc35('0x3b')){logger[_0xfc35('0x3c')](util['format']('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x546f47['id']),util[_0xfc35('0x3d')](_0x17046a,{'showHidden':![],'depth':null}));}}_0x3703cf();});});}function checkTranscribe(){var _0x312f87;var _0x25e838;var _0xc38758;return db[_0xfc35('0x3e')][_0xfc35('0x3f')]({'where':{'transcribeStatus':_0xfc35('0x40')}})[_0xfc35('0xe')](function(_0x2e5fa8){if(!_0x2e5fa8||!_0x2e5fa8[_0xfc35('0x18')]){throw new db[(_0xfc35('0x27'))][(_0xfc35('0x22'))](_0xfc35('0x41'));}_0x312f87=_0x2e5fa8;return db[_0xfc35('0x42')][_0xfc35('0x26')]({'where':{'id':0x1}});})[_0xfc35('0xe')](function(_0xefa1cf){if(!_0xefa1cf){throw new db[(_0xfc35('0x27'))][(_0xfc35('0x22'))]('Settings\x20not\x20available');}_0x25e838=_0xefa1cf;if(!_0x25e838['transcribe']||!_0x25e838[_0xfc35('0x43')]||!_0x25e838[_0xfc35('0xd')]||!_0x25e838[_0xfc35('0x21')]||!_0x25e838[_0xfc35('0x33')]){throw new db[(_0xfc35('0x27'))][(_0xfc35('0x22'))](_0xfc35('0x44'));}return db[_0xfc35('0x25')][_0xfc35('0x26')]({'where':{'id':_0x25e838[_0xfc35('0x43')]}});})['then'](function(_0x2cd691){if(!_0x2cd691){throw new db[(_0xfc35('0x27'))][(_0xfc35('0x22'))](_0xfc35('0x28'));}if(!_0x2cd691[_0xfc35('0x29')]||!_0x2cd691[_0xfc35('0x2a')]){throw new db[(_0xfc35('0x27'))][(_0xfc35('0x22'))](_0xfc35('0x34'));}_0xc38758=_0x2cd691;var _0x39a61b=[];_0x312f87[_0xfc35('0x45')](function(_0x41dded){_0x39a61b[_0xfc35('0x46')](checkTranscribeJob(_0x41dded,_0x25e838,_0xc38758));});return BPromise[_0xfc35('0x47')](_0x39a61b);})[_0xfc35('0x39')](function(_0x1a41ef){if(_0x1a41ef){if(!_0x1a41ef[_0xfc35('0x3a')]||_0x1a41ef[_0xfc35('0x3a')]!==_0xfc35('0x3b')){logger['error'](util[_0xfc35('0x3d')](_0x1a41ef,{'showHidden':![],'depth':null}));}}});}exports[_0xfc35('0x48')]=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 ea7a7df..5776603 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 _0x02d5=['util','../../config/environment','../logger','schedule','defaults','redis','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','length','map','info','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','then','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','join','whatsappInteraction:update','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis'];(function(_0x571dbc,_0x400df9){var _0x55043c=function(_0x47df3b){while(--_0x47df3b){_0x571dbc['push'](_0x571dbc['shift']());}};_0x55043c(++_0x400df9);}(_0x02d5,0x17d));var _0x502d=function(_0x23082a,_0x445d35){_0x23082a=_0x23082a-0x0;var _0x4be541=_0x02d5[_0x23082a];return _0x4be541;};'use strict';var _=require(_0x502d('0x0'));var moment=require(_0x502d('0x1'));var Redis=require(_0x502d('0x2'));var util=require(_0x502d('0x3'));var config=require(_0x502d('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0x502d('0x5'))(_0x502d('0x6'));config['redis']=_[_0x502d('0x7')](config[_0x502d('0x8')],{'host':_0x502d('0x9'),'port':0x18eb});var io=require(_0x502d('0xa'))(new Redis(config['redis']));function closeInteractions(){var _0x2503b3=[];return db[_0x502d('0xb')][_0x502d('0xc')]({'raw':!![],'attributes':['id',_0x502d('0xd')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x502d('0xe')](0x18,_0x502d('0xf'))}}})['then'](function(_0x45c8f6){if(_0x45c8f6&&_0x45c8f6[_0x502d('0x10')]){_0x2503b3=_[_0x502d('0x11')](_0x45c8f6||[],'id');logger[_0x502d('0x12')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x2503b3['join']());return db[_0x502d('0xb')][_0x502d('0x13')]({'closeReason':_0x502d('0x14'),'disposition':_0x502d('0x15'),'closed':!![],'closedAt':moment()[_0x502d('0x16')](_0x502d('0x17'))},{'where':{'id':_0x2503b3}});}})[_0x502d('0x18')](function(){if(_0x2503b3&&_0x2503b3[_0x502d('0x10')]){logger[_0x502d('0x12')](_0x502d('0x19'),_0x2503b3[_0x502d('0x1a')]());for(var _0x4c0050=0x0;_0x4c0050<_0x2503b3[_0x502d('0x10')];_0x4c0050++){io['emit'](_0x502d('0x1b'),{'id':_0x2503b3[_0x4c0050],'closed':!![]});}}})['catch'](function(_0x674a31){logger[_0x502d('0x1c')](_0x502d('0x1d'),_0x674a31?util[_0x502d('0x1e')](_0x674a31,{'showHidden':![],'depth':null}):'');});}exports[_0x502d('0x1f')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x1136=['redis','socket.io-emitter','WhatsappInteraction','lastMsgAt','subtract','then','length','info','update','timeout','format','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','inspect','start','lodash','util','../../config/environment','../../mysqldb','../logger','schedule','defaults'];(function(_0x32b2ff,_0x130e86){var _0x29c7cf=function(_0x22077b){while(--_0x22077b){_0x32b2ff['push'](_0x32b2ff['shift']());}};_0x29c7cf(++_0x130e86);}(_0x1136,0x76));var _0x6113=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x1136[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x6113('0x0'));var moment=require('moment');var Redis=require('ioredis');var util=require(_0x6113('0x1'));var config=require(_0x6113('0x2'));var db=require(_0x6113('0x3'))['db'];var logger=require(_0x6113('0x4'))(_0x6113('0x5'));config['redis']=_[_0x6113('0x6')](config[_0x6113('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x6113('0x8'))(new Redis(config['redis']));function closeInteractions(){var _0xe817f1=[];return db[_0x6113('0x9')]['findAll']({'raw':!![],'attributes':['id',_0x6113('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x6113('0xb')](0x18,'hours')}}})[_0x6113('0xc')](function(_0x59d0fe){if(_0x59d0fe&&_0x59d0fe[_0x6113('0xd')]){_0xe817f1=_['map'](_0x59d0fe||[],'id');logger[_0x6113('0xe')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0xe817f1['join']());return db[_0x6113('0x9')][_0x6113('0xf')]({'closeReason':'system','disposition':_0x6113('0x10'),'closed':!![],'closedAt':moment()[_0x6113('0x11')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0xe817f1}});}})[_0x6113('0xc')](function(){if(_0xe817f1&&_0xe817f1[_0x6113('0xd')]){logger['info'](_0x6113('0x12'),_0xe817f1['join']());for(var _0x20df5d=0x0;_0x20df5d<_0xe817f1[_0x6113('0xd')];_0x20df5d++){io[_0x6113('0x13')](_0x6113('0x14'),{'id':_0xe817f1[_0x20df5d],'closed':!![]});}}})[_0x6113('0x15')](function(_0x1f9e59){logger[_0x6113('0x16')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x1f9e59?util[_0x6113('0x17')](_0x1f9e59,{'showHidden':![],'depth':null}):'');});}exports[_0x6113('0x18')]=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 1a5008c..5fd6583 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5568=['util','../mysqldb','push','Biondo','@xcally.com','now','Innocenzo','CmContact','destroy','then','log','finished\x20populating','contacts1','CmHopper','bulkCreate','hopper2'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5568,0xc0));var _0x8556=function(_0x2e9a71,_0x11b783){_0x2e9a71=_0x2e9a71-0x0;var _0x1a397b=_0x5568[_0x2e9a71];return _0x1a397b;};'use strict';var util=require(_0x8556('0x0'));var db=require(_0x8556('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x8556('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x8556('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x8556('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x8556('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x8556('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x8556('0x5')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x8556('0x6')+i,'lastName':_0x8556('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x8556('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x8556('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x8556('0x5')](),'updatedAt':Date[_0x8556('0x5')]()});}db[_0x8556('0x7')][_0x8556('0x8')]({'where':{}})[_0x8556('0x9')](function(){return db[_0x8556('0x7')]['bulkCreate'](contacts);})[_0x8556('0x9')](function(){console[_0x8556('0xa')](_0x8556('0xb'),_0x8556('0xc'));return db['CmHopper']['destroy']({'where':{}});})[_0x8556('0x9')](function(){return db[_0x8556('0xd')][_0x8556('0xe')](hopper);})['then'](function(){console[_0x8556('0xa')]('finished\x20populating','hopper1');return db[_0x8556('0x7')][_0x8556('0xe')](contacts2);})[_0x8556('0x9')](function(){console[_0x8556('0xa')](_0x8556('0xb'),'contacts2');return db[_0x8556('0xd')][_0x8556('0xe')](hopper2);})['then'](function(){console[_0x8556('0xa')](_0x8556('0xb'),_0x8556('0xf'));})['catch'](function(_0x5bd113){console[_0x8556('0xa')](_0x5bd113);}); \ No newline at end of file +var _0x1ed5=['CmHopper','hopper2','catch','util','../mysqldb','Innocenzo','Biondo','innocenzo.biondo','push','now','@xcally.com','destroy','then','CmContact','bulkCreate','log','finished\x20populating','contacts1'];(function(_0xe5f735,_0xb3bb7f){var _0x259679=function(_0x17883f){while(--_0x17883f){_0xe5f735['push'](_0xe5f735['shift']());}};_0x259679(++_0xb3bb7f);}(_0x1ed5,0x17d));var _0x51ed=function(_0x295811,_0x2825f4){_0x295811=_0x295811-0x0;var _0x147146=_0x1ed5[_0x295811];return _0x147146;};'use strict';var util=require(_0x51ed('0x0'));var db=require(_0x51ed('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x51ed('0x2')+i,'lastName':_0x51ed('0x3')+i,'phone':0xf879fb460+i,'email':_0x51ed('0x4')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x51ed('0x5')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x51ed('0x6')](),'updatedAt':Date[_0x51ed('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x51ed('0x5')]({'id':i,'firstName':_0x51ed('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x51ed('0x4')+i+_0x51ed('0x7')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x51ed('0x5')]({'id':i,'active':![],'scheduledat':Date[_0x51ed('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x51ed('0x6')](),'updatedAt':Date[_0x51ed('0x6')]()});}db['CmContact'][_0x51ed('0x8')]({'where':{}})[_0x51ed('0x9')](function(){return db[_0x51ed('0xa')][_0x51ed('0xb')](contacts);})['then'](function(){console[_0x51ed('0xc')](_0x51ed('0xd'),_0x51ed('0xe'));return db[_0x51ed('0xf')][_0x51ed('0x8')]({'where':{}});})['then'](function(){return db['CmHopper'][_0x51ed('0xb')](hopper);})['then'](function(){console[_0x51ed('0xc')](_0x51ed('0xd'),'hopper1');return db[_0x51ed('0xa')][_0x51ed('0xb')](contacts2);})[_0x51ed('0x9')](function(){console[_0x51ed('0xc')](_0x51ed('0xd'),'contacts2');return db[_0x51ed('0xf')][_0x51ed('0xb')](hopper2);})[_0x51ed('0x9')](function(){console['log']('finished\x20populating',_0x51ed('0x10'));})[_0x51ed('0x11')](function(_0x4ccec6){console[_0x51ed('0xc')](_0x4ccec6);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index ce94bce..646d6f0 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x32ed=['agent','%s%s','%s%s@xcally.com','password','udp','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','catch','util','../mysqldb','push','format'];(function(_0x1be492,_0x57fe47){var _0x355ecf=function(_0x3b9eb0){while(--_0x3b9eb0){_0x1be492['push'](_0x1be492['shift']());}};_0x355ecf(++_0x57fe47);}(_0x32ed,0x176));var _0xd32e=function(_0x39a50f,_0x559bd0){_0x39a50f=_0x39a50f-0x0;var _0x3243d1=_0x32ed[_0x39a50f];return _0x3243d1;};'use strict';var util=require(_0xd32e('0x0'));var db=require(_0xd32e('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xd32e('0x2')]({'name':util[_0xd32e('0x3')]('%s%s',_0xd32e('0x4'),i),'fullname':util[_0xd32e('0x3')](_0xd32e('0x5'),_0xd32e('0x4'),i),'email':util[_0xd32e('0x3')](_0xd32e('0x6'),_0xd32e('0x4'),i),'role':_0xd32e('0x4'),'password':_0xd32e('0x7'),'internal':0xfa0+i,'type':'friend','transport':[_0xd32e('0x8'),'ws','wss'],'disallow':[_0xd32e('0x9')],'allow':[_0xd32e('0xa')],'defaultuser':util[_0xd32e('0x3')]('%s%s',_0xd32e('0x4'),i),'encryption':'yes','avpf':_0xd32e('0xb'),'force_avp':_0xd32e('0xb'),'icesupport':_0xd32e('0xb'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0xd32e('0xc'),'dtlsprivatekey':_0xd32e('0xd'),'dtlssetup':_0xd32e('0xe'),'callerid':util['format'](_0xd32e('0xf'),util['format'](_0xd32e('0x5'),'agent',i),0xfa0+i)});}db[_0xd32e('0x10')][_0xd32e('0x11')](users)[_0xd32e('0x12')](function(){console[_0xd32e('0x13')]('add\x20user');})[_0xd32e('0x14')](function(_0x472d5e){console[_0xd32e('0x13')](_0x472d5e);}); \ No newline at end of file +var _0x9fcc=['then','log','add\x20user','util','../mysqldb','format','%s%s','agent','%s%s@xcally.com','password','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','\x22%s\x22\x20<%s>','User','bulkCreate'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x9fcc,0x1cf));var _0xc9fc=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x9fcc[_0x199572];return _0x13cfa3;};'use strict';var util=require(_0xc9fc('0x0'));var db=require(_0xc9fc('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0xc9fc('0x2')](_0xc9fc('0x3'),'agent',i),'fullname':util[_0xc9fc('0x2')](_0xc9fc('0x3'),_0xc9fc('0x4'),i),'email':util['format'](_0xc9fc('0x5'),_0xc9fc('0x4'),i),'role':'agent','password':_0xc9fc('0x6'),'internal':0xfa0+i,'type':_0xc9fc('0x7'),'transport':[_0xc9fc('0x8'),'ws',_0xc9fc('0x9')],'disallow':[_0xc9fc('0xa')],'allow':[_0xc9fc('0xb')],'defaultuser':util['format'](_0xc9fc('0x3'),_0xc9fc('0x4'),i),'encryption':_0xc9fc('0xc'),'avpf':_0xc9fc('0xc'),'force_avp':_0xc9fc('0xc'),'icesupport':_0xc9fc('0xc'),'dtlsenable':_0xc9fc('0xc'),'dtlsverify':'no','dtlscertfile':_0xc9fc('0xd'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':'actpass','callerid':util['format'](_0xc9fc('0xe'),util[_0xc9fc('0x2')]('%s%s',_0xc9fc('0x4'),i),0xfa0+i)});}db[_0xc9fc('0xf')][_0xc9fc('0x10')](users)[_0xc9fc('0x11')](function(){console[_0xc9fc('0x12')](_0xc9fc('0x13'));})['catch'](function(_0x344562){console[_0xc9fc('0x12')](_0x344562);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index feca5ee..8c50cbe 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd7c1=['OpenchannelInteractions','WhatsappInteraction','user:%s','admin','voice:inbound','voice:outbound','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','Campaign','userProfileId','SmsQueues','getVoiceQueues','getChatQueues','getFaxQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','sms','mail','openchannel','whatsapp','trunk:%s','campaign:%s:%s','leave','map','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','WhatsappInteractions','removeWhatsappInteractions','catch','log','join','setMaxListeners','address','request','connection','remoteAddress','remotePort','connectedAt','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','Agents','User','role','agent','telephone','type','ivr','findOne','then','autoAssociation','ChatQueues','FaxQueues','MailQueues','OpenchannelQueues','WhatsappQueues','Telephones','Trunks','findAll','IvrCampaigns','resourceId','where','format','%s:queue:%s','length','handshake','find','query','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions'];(function(_0x1c1f92,_0x2620cb){var _0x4e930f=function(_0x186dc3){while(--_0x186dc3){_0x1c1f92['push'](_0x1c1f92['shift']());}};_0x4e930f(++_0x2620cb);}(_0xd7c1,0xa5));var _0x1d7c=function(_0x50e520,_0x9f42d3){_0x50e520=_0x50e520-0x0;var _0x46b7a1=_0xd7c1[_0x50e520];return _0x46b7a1;};'use strict';var _=require(_0x1d7c('0x0'));var util=require(_0x1d7c('0x1'));var BPromise=require(_0x1d7c('0x2'));var db=require(_0x1d7c('0x3'))['db'];var config=require(_0x1d7c('0x4'));var queryQueues={'attributes':['id',_0x1d7c('0x5')],'include':[{'as':_0x1d7c('0x6'),'model':db[_0x1d7c('0x7')],'attributes':['id',_0x1d7c('0x5'),_0x1d7c('0x8')],'raw':!![],'where':{'role':_0x1d7c('0x9')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x1d7c('0x5')],'where':{'role':_0x1d7c('0xa')}};var queryTrunks={'raw':!![],'attributes':['id',_0x1d7c('0x5')]};var queryAgents={'raw':!![],'attributes':['id',_0x1d7c('0x5')],'where':{'role':_0x1d7c('0x9')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x1d7c('0x5'),_0x1d7c('0xb')],'where':{'type':_0x1d7c('0xc')}};function getAssociatedResources(_0x10fff3,_0x1091e3,_0x4a7eef){return db['UserProfileSection'][_0x1d7c('0xd')]({'where':{'name':_0x10fff3,'userProfileId':_0x1091e3},'raw':!![]})[_0x1d7c('0xe')](function(_0x38fd05){if(_0x38fd05){if(_0x38fd05[_0x1d7c('0xf')]){switch(_0x10fff3){case'VoiceQueues':case _0x1d7c('0x10'):case _0x1d7c('0x11'):case'SmsQueues':case _0x1d7c('0x12'):case _0x1d7c('0x13'):case _0x1d7c('0x14'):return db[_0x4a7eef]['findAll'](queryQueues);case _0x1d7c('0x15'):return db[_0x4a7eef]['findAll'](queryTelephones);case _0x1d7c('0x16'):return db[_0x4a7eef][_0x1d7c('0x17')](queryTrunks);case _0x1d7c('0x18'):return db[_0x4a7eef][_0x1d7c('0x17')](queryCampaigns);}}else{return db['UserProfileResource'][_0x1d7c('0x17')]({'attributes':['resourceId'],'where':{'sectionId':_0x38fd05['id']},'raw':!![]})[_0x1d7c('0xe')](function(_0x49dbb4){if(_0x49dbb4){var _0x41112d={'where':{'id':_['map'](_0x49dbb4,_0x1d7c('0x19'))},'raw':!![]};switch(_0x4a7eef){case _0x1d7c('0x7'):_0x41112d[_0x1d7c('0x1a')][_0x1d7c('0x8')]=_0x1d7c('0xa');break;case'Campaign':_0x41112d[_0x1d7c('0x1a')][_0x1d7c('0xb')]='ivr';break;}return db[_0x4a7eef][_0x1d7c('0x17')](_0x41112d);}else{return[];}});}}else{return[];}})['then'](function(_0x5147d1){return _0x5147d1;});}function joinOrLeaveQueues(_0x29b24c,_0x1f31f2,_0xf378ad,_0x4102a4){_0x29b24c[_0x1f31f2](util[_0x1d7c('0x1b')](_0x1d7c('0x1c'),_0xf378ad,_0x4102a4[_0x1d7c('0x5')]));if(_0x4102a4[_0x1d7c('0x6')]){for(var _0x1dafe8=0x0;_0x1dafe8<_0x4102a4[_0x1d7c('0x6')][_0x1d7c('0x1d')];_0x1dafe8+=0x1){_0x29b24c[_0x1f31f2](util['format']('user:%s',_0x4102a4['Agents'][_0x1dafe8]['name']));}}}function joinOrLeave(_0x218bdd,_0x3037ed,_0x33e74e){var _0x57c6e7;if(_0x218bdd[_0x1d7c('0x1e')]['query']['id']){db[_0x1d7c('0x7')][_0x1d7c('0x1f')]({'attributes':['id',_0x1d7c('0x5'),'role','userProfileId'],'where':{'id':_0x218bdd[_0x1d7c('0x1e')][_0x1d7c('0x20')]['id']},'include':[{'model':db[_0x1d7c('0x21')],'as':_0x1d7c('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0x1d7c('0x23')],'as':_0x1d7c('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x1d7c('0x25')],'as':_0x1d7c('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x1d7c('0x27')],'as':_0x1d7c('0x28'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0x1d7c('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x1d7c('0x2a')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0x1d7c('0xe')](function(_0x3ef33a){if(_0x3ef33a){_0x57c6e7=_0x3ef33a;_0x218bdd[_0x3037ed](util[_0x1d7c('0x1b')](_0x1d7c('0x2b'),_0x3ef33a[_0x1d7c('0x5')]));var _0x443a85=[];switch(_0x3ef33a[_0x1d7c('0x8')]){case _0x1d7c('0x2c'):_0x218bdd[_0x3037ed](_0x1d7c('0x2d'));_0x218bdd[_0x3037ed](_0x1d7c('0x2e'));if(queryQueues['hasOwnProperty'](_0x1d7c('0x2f'))){delete queryQueues[_0x1d7c('0x2f')];}_0x443a85[_0x1d7c('0x30')](db[_0x1d7c('0x31')][_0x1d7c('0x17')](queryQueues));_0x443a85[_0x1d7c('0x30')](db[_0x1d7c('0x32')]['findAll'](queryQueues));_0x443a85[_0x1d7c('0x30')](db[_0x1d7c('0x33')][_0x1d7c('0x17')](queryQueues));_0x443a85[_0x1d7c('0x30')](db[_0x1d7c('0x34')][_0x1d7c('0x17')](queryQueues));_0x443a85['push'](db[_0x1d7c('0x35')][_0x1d7c('0x17')](queryQueues));_0x443a85[_0x1d7c('0x30')](db[_0x1d7c('0x36')][_0x1d7c('0x17')](queryQueues));_0x443a85[_0x1d7c('0x30')](db[_0x1d7c('0x37')][_0x1d7c('0x17')](queryQueues));_0x443a85[_0x1d7c('0x30')](db['User'][_0x1d7c('0x17')](queryTelephones));_0x443a85[_0x1d7c('0x30')](db[_0x1d7c('0x38')]['findAll'](queryTrunks));_0x443a85[_0x1d7c('0x30')](db[_0x1d7c('0x39')][_0x1d7c('0x17')](queryCampaigns));_0x443a85['push'](db[_0x1d7c('0x7')][_0x1d7c('0x17')](queryAgents));break;case'user':_0x218bdd[_0x3037ed](_0x1d7c('0x2d'));_0x218bdd[_0x3037ed](_0x1d7c('0x2e'));_0x443a85['push'](getAssociatedResources('VoiceQueues',_0x3ef33a[_0x1d7c('0x3a')],_0x1d7c('0x31')));_0x443a85[_0x1d7c('0x30')](getAssociatedResources(_0x1d7c('0x10'),_0x3ef33a[_0x1d7c('0x3a')],'ChatQueue'));_0x443a85[_0x1d7c('0x30')](getAssociatedResources('FaxQueues',_0x3ef33a[_0x1d7c('0x3a')],_0x1d7c('0x33')));_0x443a85['push'](getAssociatedResources(_0x1d7c('0x3b'),_0x3ef33a[_0x1d7c('0x3a')],'SmsQueue'));_0x443a85['push'](getAssociatedResources('MailQueues',_0x3ef33a[_0x1d7c('0x3a')],'MailQueue'));_0x443a85['push'](getAssociatedResources('OpenchannelQueues',_0x3ef33a[_0x1d7c('0x3a')],_0x1d7c('0x36')));_0x443a85[_0x1d7c('0x30')](getAssociatedResources(_0x1d7c('0x14'),_0x3ef33a[_0x1d7c('0x3a')],'WhatsappQueue'));_0x443a85[_0x1d7c('0x30')](getAssociatedResources(_0x1d7c('0x15'),_0x3ef33a[_0x1d7c('0x3a')],'User'));_0x443a85[_0x1d7c('0x30')](getAssociatedResources('Trunks',_0x3ef33a[_0x1d7c('0x3a')],_0x1d7c('0x38')));_0x443a85[_0x1d7c('0x30')](getAssociatedResources(_0x1d7c('0x18'),_0x3ef33a[_0x1d7c('0x3a')],_0x1d7c('0x39')));_0x443a85[_0x1d7c('0x30')](db[_0x1d7c('0x7')][_0x1d7c('0x17')](queryAgents));break;case _0x1d7c('0x9'):_0x218bdd[_0x3037ed](_0x1d7c('0x2d'));_0x218bdd[_0x3037ed](_0x1d7c('0x2e'));_0x443a85[_0x1d7c('0x30')](_0x3ef33a[_0x1d7c('0x3c')]({'attributes':['id','name']}));_0x443a85[_0x1d7c('0x30')](_0x3ef33a[_0x1d7c('0x3d')]({'attributes':['id',_0x1d7c('0x5')]}));_0x443a85['push'](_0x3ef33a[_0x1d7c('0x3e')]({'attributes':['id',_0x1d7c('0x5')]}));_0x443a85[_0x1d7c('0x30')](_0x3ef33a['getSmsQueues']({'attributes':['id',_0x1d7c('0x5')]}));_0x443a85['push'](_0x3ef33a['getMailQueues']({'attributes':['id',_0x1d7c('0x5')]}));_0x443a85[_0x1d7c('0x30')](_0x3ef33a[_0x1d7c('0x3f')]({'attributes':['id',_0x1d7c('0x5')]}));_0x443a85['push'](_0x3ef33a[_0x1d7c('0x40')]({'attributes':['id',_0x1d7c('0x5')]}));break;}return BPromise[_0x1d7c('0x41')](_0x443a85);}})['then'](function(_0xd538d1){if(_0xd538d1&&_0xd538d1[_0x1d7c('0x1d')]){for(var _0x4677e9=0x0;_0x4677e9<_0xd538d1[_0x1d7c('0x1d')];_0x4677e9+=0x1){for(var _0x16c522=0x0;_0x16c522<_0xd538d1[_0x4677e9][_0x1d7c('0x1d')];_0x16c522+=0x1){switch(_0x4677e9){case 0x0:joinOrLeaveQueues(_0x218bdd,_0x3037ed,_0x1d7c('0x42'),_0xd538d1[_0x4677e9][_0x16c522]);break;case 0x1:joinOrLeaveQueues(_0x218bdd,_0x3037ed,_0x1d7c('0x43'),_0xd538d1[_0x4677e9][_0x16c522]);break;case 0x2:joinOrLeaveQueues(_0x218bdd,_0x3037ed,'fax',_0xd538d1[_0x4677e9][_0x16c522]);break;case 0x3:joinOrLeaveQueues(_0x218bdd,_0x3037ed,_0x1d7c('0x44'),_0xd538d1[_0x4677e9][_0x16c522]);break;case 0x4:joinOrLeaveQueues(_0x218bdd,_0x3037ed,_0x1d7c('0x45'),_0xd538d1[_0x4677e9][_0x16c522]);break;case 0x5:joinOrLeaveQueues(_0x218bdd,_0x3037ed,_0x1d7c('0x46'),_0xd538d1[_0x4677e9][_0x16c522]);break;case 0x6:joinOrLeaveQueues(_0x218bdd,_0x3037ed,_0x1d7c('0x47'),_0xd538d1[_0x4677e9][_0x16c522]);break;case 0x7:if(_0x57c6e7[_0x1d7c('0x8')]!==_0x1d7c('0x9'))_0x218bdd[_0x3037ed](util[_0x1d7c('0x1b')]('telephone:%s',_0xd538d1[_0x4677e9][_0x16c522]['name']));break;case 0x8:if(_0x57c6e7[_0x1d7c('0x8')]!==_0x1d7c('0x9'))_0x218bdd[_0x3037ed](util[_0x1d7c('0x1b')](_0x1d7c('0x48'),_0xd538d1[_0x4677e9][_0x16c522][_0x1d7c('0x5')]));break;case 0x9:if(_0x57c6e7[_0x1d7c('0x8')]!==_0x1d7c('0x9'))_0x218bdd[_0x3037ed](util[_0x1d7c('0x1b')](_0x1d7c('0x49'),_0xd538d1[_0x4677e9][_0x16c522][_0x1d7c('0xb')],_0xd538d1[_0x4677e9][_0x16c522][_0x1d7c('0x5')]));break;case 0xa:_0x218bdd[_0x3037ed](util[_0x1d7c('0x1b')](_0x1d7c('0x2b'),_0xd538d1[_0x4677e9][_0x16c522]['name']));break;}}}}})[_0x1d7c('0xe')](function(){if(_0x3037ed===_0x1d7c('0x4a')){var _0x373939=_[_0x1d7c('0x4b')](_0x57c6e7[_0x1d7c('0x22')],'id');return _0x57c6e7[_0x1d7c('0x4c')](_0x373939)[_0x1d7c('0xe')](function(){for(var _0x1a768d=0x0;_0x1a768d<_0x373939[_0x1d7c('0x1d')];_0x1a768d+=0x1){_0x33e74e[_0x1d7c('0x4d')](_0x1d7c('0x4e'),{'ChatInteractionId':Number(_0x373939[_0x1a768d]),'UserId':Number(_0x57c6e7['id'])});}});}})[_0x1d7c('0xe')](function(){if(_0x3037ed==='leave'){var _0x1a2cdb=_[_0x1d7c('0x4b')](_0x57c6e7[_0x1d7c('0x24')],'id');return _0x57c6e7[_0x1d7c('0x4f')](_0x1a2cdb)[_0x1d7c('0xe')](function(){for(var _0x3a3445=0x0;_0x3a3445<_0x1a2cdb[_0x1d7c('0x1d')];_0x3a3445+=0x1){_0x33e74e[_0x1d7c('0x4d')](_0x1d7c('0x50'),{'MailInteractionId':Number(_0x1a2cdb[_0x3a3445]),'UserId':Number(_0x57c6e7['id'])});}});}})[_0x1d7c('0xe')](function(){if(_0x3037ed===_0x1d7c('0x4a')){var _0x54403e=_[_0x1d7c('0x4b')](_0x57c6e7['FaxInteractions'],'id');return _0x57c6e7[_0x1d7c('0x51')](_0x54403e)[_0x1d7c('0xe')](function(){for(var _0x10d4b4=0x0;_0x10d4b4<_0x54403e[_0x1d7c('0x1d')];_0x10d4b4+=0x1){_0x33e74e['emit'](_0x1d7c('0x52'),{'FaxInteractionId':Number(_0x54403e[_0x10d4b4]),'UserId':Number(_0x57c6e7['id'])});}});}})[_0x1d7c('0xe')](function(){if(_0x3037ed===_0x1d7c('0x4a')){var _0x23f280=_[_0x1d7c('0x4b')](_0x57c6e7[_0x1d7c('0x28')],'id');return _0x57c6e7[_0x1d7c('0x53')](_0x23f280)['then'](function(){for(var _0x22388d=0x0;_0x22388d<_0x23f280[_0x1d7c('0x1d')];_0x22388d+=0x1){_0x33e74e[_0x1d7c('0x4d')](_0x1d7c('0x54'),{'SmsInteractionId':Number(_0x23f280[_0x22388d]),'UserId':Number(_0x57c6e7['id'])});}});}})[_0x1d7c('0xe')](function(){if(_0x3037ed==='leave'){var _0x445c89=_[_0x1d7c('0x4b')](_0x57c6e7[_0x1d7c('0x29')],'id');return _0x57c6e7[_0x1d7c('0x55')](_0x445c89)[_0x1d7c('0xe')](function(){for(var _0x3cdd59=0x0;_0x3cdd59<_0x445c89['length'];_0x3cdd59+=0x1){_0x33e74e[_0x1d7c('0x4d')](_0x1d7c('0x56'),{'OpenchannelInteractionId':Number(_0x445c89[_0x3cdd59]),'UserId':Number(_0x57c6e7['id'])});}});}})[_0x1d7c('0xe')](function(){if(_0x3037ed===_0x1d7c('0x4a')){var _0x26b5ad=_[_0x1d7c('0x4b')](_0x57c6e7[_0x1d7c('0x57')],'id');return _0x57c6e7[_0x1d7c('0x58')](_0x26b5ad)['then'](function(){for(var _0x558eff=0x0;_0x558eff<_0x26b5ad[_0x1d7c('0x1d')];_0x558eff+=0x1){_0x33e74e[_0x1d7c('0x4d')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x26b5ad[_0x558eff]),'UserId':Number(_0x57c6e7['id'])});}});}})[_0x1d7c('0x59')](function(_0x41e227){_0x218bdd[_0x1d7c('0x5a')](_0x41e227);});}}function onDisconnect(_0x303ca6,_0x542be3){joinOrLeave(_0x303ca6,'leave',_0x542be3);}function onConnect(_0x534e0c){joinOrLeave(_0x534e0c,_0x1d7c('0x5b'));}exports['default']=function(_0xd5486a){_0xd5486a['on']('connection',function(_0x3d4cd6){_0x3d4cd6[_0x1d7c('0x5c')](0x0);_0x3d4cd6[_0x1d7c('0x5d')]=_0x3d4cd6[_0x1d7c('0x5e')][_0x1d7c('0x5f')][_0x1d7c('0x60')]+':'+_0x3d4cd6['request'][_0x1d7c('0x5f')][_0x1d7c('0x61')];_0x3d4cd6[_0x1d7c('0x62')]=new Date();_0x3d4cd6[_0x1d7c('0x5a')]=function(_0x5411a4){console['log']('SocketIO\x20'+_0x3d4cd6[_0x1d7c('0x63')][_0x1d7c('0x5')]+'['+_0x3d4cd6[_0x1d7c('0x5d')]+']',_0x5411a4);};_0x3d4cd6['on'](_0x1d7c('0x64'),function(){onDisconnect(_0x3d4cd6,_0xd5486a);_0x3d4cd6[_0x1d7c('0x5a')](_0x1d7c('0x65'));});onConnect(_0x3d4cd6);_0x3d4cd6['log'](_0x1d7c('0x66'));});}; \ No newline at end of file +var _0xfa25=['SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','util','bluebird','../mysqldb','./environment','name','Agents','User','telephone','agent','type','ivr','UserProfileSection','findOne','ChatQueues','FaxQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','then','map','role','Campaign','format','%s:queue:%s','length','user:%s','handshake','find','query','ChatInteraction','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','OpenchannelQueue','WhatsappQueue','Trunk','voice:outbound','VoiceQueues','userProfileId','SmsQueues','MailQueue','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','campaign:%s:%s','ChatInteractions','removeChatInteractions','emit','user_has_chat_interactions:remove','leave','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','log','join','default','connection','address','request','remoteAddress','remotePort'];(function(_0x59d438,_0x49e538){var _0x4cde6b=function(_0x7897cd){while(--_0x7897cd){_0x59d438['push'](_0x59d438['shift']());}};_0x4cde6b(++_0x49e538);}(_0xfa25,0xd1));var _0x5fa2=function(_0x19cade,_0x42510d){_0x19cade=_0x19cade-0x0;var _0xaf01fa=_0xfa25[_0x19cade];return _0xaf01fa;};'use strict';var _=require('lodash');var util=require(_0x5fa2('0x0'));var BPromise=require(_0x5fa2('0x1'));var db=require(_0x5fa2('0x2'))['db'];var config=require(_0x5fa2('0x3'));var queryQueues={'attributes':['id',_0x5fa2('0x4')],'include':[{'as':_0x5fa2('0x5'),'model':db[_0x5fa2('0x6')],'attributes':['id',_0x5fa2('0x4'),'role'],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x5fa2('0x4')],'where':{'role':_0x5fa2('0x7')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0x5fa2('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0x5fa2('0x9')],'where':{'type':_0x5fa2('0xa')}};function getAssociatedResources(_0x424089,_0x57dea5,_0x36778e){return db[_0x5fa2('0xb')][_0x5fa2('0xc')]({'where':{'name':_0x424089,'userProfileId':_0x57dea5},'raw':!![]})['then'](function(_0x474efa){if(_0x474efa){if(_0x474efa['autoAssociation']){switch(_0x424089){case'VoiceQueues':case _0x5fa2('0xd'):case _0x5fa2('0xe'):case'SmsQueues':case _0x5fa2('0xf'):case _0x5fa2('0x10'):case _0x5fa2('0x11'):return db[_0x36778e][_0x5fa2('0x12')](queryQueues);case _0x5fa2('0x13'):return db[_0x36778e][_0x5fa2('0x12')](queryTelephones);case _0x5fa2('0x14'):return db[_0x36778e][_0x5fa2('0x12')](queryTrunks);case _0x5fa2('0x15'):return db[_0x36778e][_0x5fa2('0x12')](queryCampaigns);}}else{return db[_0x5fa2('0x16')][_0x5fa2('0x12')]({'attributes':[_0x5fa2('0x17')],'where':{'sectionId':_0x474efa['id']},'raw':!![]})[_0x5fa2('0x18')](function(_0x55caa1){if(_0x55caa1){var _0x3482a9={'where':{'id':_[_0x5fa2('0x19')](_0x55caa1,_0x5fa2('0x17'))},'raw':!![]};switch(_0x36778e){case'User':_0x3482a9['where'][_0x5fa2('0x1a')]=_0x5fa2('0x7');break;case _0x5fa2('0x1b'):_0x3482a9['where'][_0x5fa2('0x9')]='ivr';break;}return db[_0x36778e][_0x5fa2('0x12')](_0x3482a9);}else{return[];}});}}else{return[];}})['then'](function(_0x44ed12){return _0x44ed12;});}function joinOrLeaveQueues(_0x4503c5,_0x4a5321,_0x2a34b3,_0xe562b4){_0x4503c5[_0x4a5321](util[_0x5fa2('0x1c')](_0x5fa2('0x1d'),_0x2a34b3,_0xe562b4['name']));if(_0xe562b4[_0x5fa2('0x5')]){for(var _0x356902=0x0;_0x356902<_0xe562b4[_0x5fa2('0x5')][_0x5fa2('0x1e')];_0x356902+=0x1){_0x4503c5[_0x4a5321](util[_0x5fa2('0x1c')](_0x5fa2('0x1f'),_0xe562b4[_0x5fa2('0x5')][_0x356902][_0x5fa2('0x4')]));}}}function joinOrLeave(_0x448096,_0x16a18f,_0x228367){var _0x2cac01;if(_0x448096[_0x5fa2('0x20')]['query']['id']){db[_0x5fa2('0x6')][_0x5fa2('0x21')]({'attributes':['id',_0x5fa2('0x4'),_0x5fa2('0x1a'),'userProfileId'],'where':{'id':_0x448096['handshake'][_0x5fa2('0x22')]['id']},'include':[{'model':db[_0x5fa2('0x23')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x5fa2('0x24')],'as':_0x5fa2('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x5fa2('0x26')],'as':_0x5fa2('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x5fa2('0x28')],'as':_0x5fa2('0x29'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0x5fa2('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0x5fa2('0x2b')],'as':_0x5fa2('0x2c'),'attributes':['id'],'raw':!![]}]})[_0x5fa2('0x18')](function(_0x4fd561){if(_0x4fd561){_0x2cac01=_0x4fd561;_0x448096[_0x16a18f](util[_0x5fa2('0x1c')](_0x5fa2('0x1f'),_0x4fd561['name']));var _0x498898=[];switch(_0x4fd561['role']){case _0x5fa2('0x2d'):_0x448096[_0x16a18f](_0x5fa2('0x2e'));_0x448096[_0x16a18f]('voice:outbound');if(queryQueues[_0x5fa2('0x2f')](_0x5fa2('0x30'))){delete queryQueues[_0x5fa2('0x30')];}_0x498898[_0x5fa2('0x31')](db[_0x5fa2('0x32')]['findAll'](queryQueues));_0x498898[_0x5fa2('0x31')](db[_0x5fa2('0x33')][_0x5fa2('0x12')](queryQueues));_0x498898[_0x5fa2('0x31')](db[_0x5fa2('0x34')]['findAll'](queryQueues));_0x498898[_0x5fa2('0x31')](db[_0x5fa2('0x35')]['findAll'](queryQueues));_0x498898['push'](db['MailQueue'][_0x5fa2('0x12')](queryQueues));_0x498898[_0x5fa2('0x31')](db[_0x5fa2('0x36')]['findAll'](queryQueues));_0x498898[_0x5fa2('0x31')](db[_0x5fa2('0x37')]['findAll'](queryQueues));_0x498898['push'](db[_0x5fa2('0x6')]['findAll'](queryTelephones));_0x498898[_0x5fa2('0x31')](db[_0x5fa2('0x38')]['findAll'](queryTrunks));_0x498898[_0x5fa2('0x31')](db['Campaign'][_0x5fa2('0x12')](queryCampaigns));_0x498898['push'](db[_0x5fa2('0x6')][_0x5fa2('0x12')](queryAgents));break;case'user':_0x448096[_0x16a18f](_0x5fa2('0x2e'));_0x448096[_0x16a18f](_0x5fa2('0x39'));_0x498898[_0x5fa2('0x31')](getAssociatedResources(_0x5fa2('0x3a'),_0x4fd561[_0x5fa2('0x3b')],_0x5fa2('0x32')));_0x498898[_0x5fa2('0x31')](getAssociatedResources(_0x5fa2('0xd'),_0x4fd561[_0x5fa2('0x3b')],_0x5fa2('0x33')));_0x498898[_0x5fa2('0x31')](getAssociatedResources(_0x5fa2('0xe'),_0x4fd561[_0x5fa2('0x3b')],'FaxQueue'));_0x498898[_0x5fa2('0x31')](getAssociatedResources(_0x5fa2('0x3c'),_0x4fd561[_0x5fa2('0x3b')],'SmsQueue'));_0x498898['push'](getAssociatedResources(_0x5fa2('0xf'),_0x4fd561[_0x5fa2('0x3b')],_0x5fa2('0x3d')));_0x498898[_0x5fa2('0x31')](getAssociatedResources('OpenchannelQueues',_0x4fd561[_0x5fa2('0x3b')],_0x5fa2('0x36')));_0x498898['push'](getAssociatedResources('WhatsappQueues',_0x4fd561['userProfileId'],_0x5fa2('0x37')));_0x498898[_0x5fa2('0x31')](getAssociatedResources(_0x5fa2('0x13'),_0x4fd561[_0x5fa2('0x3b')],_0x5fa2('0x6')));_0x498898['push'](getAssociatedResources(_0x5fa2('0x14'),_0x4fd561['userProfileId'],_0x5fa2('0x38')));_0x498898['push'](getAssociatedResources('IvrCampaigns',_0x4fd561[_0x5fa2('0x3b')],_0x5fa2('0x1b')));_0x498898['push'](db[_0x5fa2('0x6')][_0x5fa2('0x12')](queryAgents));break;case'agent':_0x448096[_0x16a18f]('voice:inbound');_0x448096[_0x16a18f]('voice:outbound');_0x498898['push'](_0x4fd561[_0x5fa2('0x3e')]({'attributes':['id',_0x5fa2('0x4')]}));_0x498898[_0x5fa2('0x31')](_0x4fd561[_0x5fa2('0x3f')]({'attributes':['id',_0x5fa2('0x4')]}));_0x498898['push'](_0x4fd561[_0x5fa2('0x40')]({'attributes':['id',_0x5fa2('0x4')]}));_0x498898['push'](_0x4fd561[_0x5fa2('0x41')]({'attributes':['id',_0x5fa2('0x4')]}));_0x498898[_0x5fa2('0x31')](_0x4fd561[_0x5fa2('0x42')]({'attributes':['id',_0x5fa2('0x4')]}));_0x498898['push'](_0x4fd561[_0x5fa2('0x43')]({'attributes':['id',_0x5fa2('0x4')]}));_0x498898[_0x5fa2('0x31')](_0x4fd561[_0x5fa2('0x44')]({'attributes':['id',_0x5fa2('0x4')]}));break;}return BPromise[_0x5fa2('0x45')](_0x498898);}})[_0x5fa2('0x18')](function(_0x59f98c){if(_0x59f98c&&_0x59f98c[_0x5fa2('0x1e')]){for(var _0x336c62=0x0;_0x336c62<_0x59f98c[_0x5fa2('0x1e')];_0x336c62+=0x1){for(var _0x206949=0x0;_0x206949<_0x59f98c[_0x336c62][_0x5fa2('0x1e')];_0x206949+=0x1){switch(_0x336c62){case 0x0:joinOrLeaveQueues(_0x448096,_0x16a18f,_0x5fa2('0x46'),_0x59f98c[_0x336c62][_0x206949]);break;case 0x1:joinOrLeaveQueues(_0x448096,_0x16a18f,_0x5fa2('0x47'),_0x59f98c[_0x336c62][_0x206949]);break;case 0x2:joinOrLeaveQueues(_0x448096,_0x16a18f,_0x5fa2('0x48'),_0x59f98c[_0x336c62][_0x206949]);break;case 0x3:joinOrLeaveQueues(_0x448096,_0x16a18f,_0x5fa2('0x49'),_0x59f98c[_0x336c62][_0x206949]);break;case 0x4:joinOrLeaveQueues(_0x448096,_0x16a18f,_0x5fa2('0x4a'),_0x59f98c[_0x336c62][_0x206949]);break;case 0x5:joinOrLeaveQueues(_0x448096,_0x16a18f,_0x5fa2('0x4b'),_0x59f98c[_0x336c62][_0x206949]);break;case 0x6:joinOrLeaveQueues(_0x448096,_0x16a18f,_0x5fa2('0x4c'),_0x59f98c[_0x336c62][_0x206949]);break;case 0x7:if(_0x2cac01['role']!=='agent')_0x448096[_0x16a18f](util[_0x5fa2('0x1c')](_0x5fa2('0x4d'),_0x59f98c[_0x336c62][_0x206949][_0x5fa2('0x4')]));break;case 0x8:if(_0x2cac01[_0x5fa2('0x1a')]!==_0x5fa2('0x8'))_0x448096[_0x16a18f](util[_0x5fa2('0x1c')]('trunk:%s',_0x59f98c[_0x336c62][_0x206949]['name']));break;case 0x9:if(_0x2cac01[_0x5fa2('0x1a')]!==_0x5fa2('0x8'))_0x448096[_0x16a18f](util[_0x5fa2('0x1c')](_0x5fa2('0x4e'),_0x59f98c[_0x336c62][_0x206949]['type'],_0x59f98c[_0x336c62][_0x206949][_0x5fa2('0x4')]));break;case 0xa:_0x448096[_0x16a18f](util[_0x5fa2('0x1c')](_0x5fa2('0x1f'),_0x59f98c[_0x336c62][_0x206949][_0x5fa2('0x4')]));break;}}}}})[_0x5fa2('0x18')](function(){if(_0x16a18f==='leave'){var _0x58def8=_['map'](_0x2cac01[_0x5fa2('0x4f')],'id');return _0x2cac01[_0x5fa2('0x50')](_0x58def8)[_0x5fa2('0x18')](function(){for(var _0x14d6eb=0x0;_0x14d6eb<_0x58def8[_0x5fa2('0x1e')];_0x14d6eb+=0x1){_0x228367[_0x5fa2('0x51')](_0x5fa2('0x52'),{'ChatInteractionId':Number(_0x58def8[_0x14d6eb]),'UserId':Number(_0x2cac01['id'])});}});}})['then'](function(){if(_0x16a18f===_0x5fa2('0x53')){var _0x559e20=_['map'](_0x2cac01[_0x5fa2('0x25')],'id');return _0x2cac01['removeMailInteractions'](_0x559e20)[_0x5fa2('0x18')](function(){for(var _0x13796a=0x0;_0x13796a<_0x559e20['length'];_0x13796a+=0x1){_0x228367['emit']('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x559e20[_0x13796a]),'UserId':Number(_0x2cac01['id'])});}});}})[_0x5fa2('0x18')](function(){if(_0x16a18f==='leave'){var _0x27c947=_[_0x5fa2('0x19')](_0x2cac01[_0x5fa2('0x27')],'id');return _0x2cac01['removeFaxInteractions'](_0x27c947)[_0x5fa2('0x18')](function(){for(var _0x566482=0x0;_0x566482<_0x27c947['length'];_0x566482+=0x1){_0x228367[_0x5fa2('0x51')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x27c947[_0x566482]),'UserId':Number(_0x2cac01['id'])});}});}})[_0x5fa2('0x18')](function(){if(_0x16a18f===_0x5fa2('0x53')){var _0x405a60=_[_0x5fa2('0x19')](_0x2cac01[_0x5fa2('0x29')],'id');return _0x2cac01[_0x5fa2('0x54')](_0x405a60)[_0x5fa2('0x18')](function(){for(var _0x5a2d81=0x0;_0x5a2d81<_0x405a60[_0x5fa2('0x1e')];_0x5a2d81+=0x1){_0x228367[_0x5fa2('0x51')](_0x5fa2('0x55'),{'SmsInteractionId':Number(_0x405a60[_0x5a2d81]),'UserId':Number(_0x2cac01['id'])});}});}})[_0x5fa2('0x18')](function(){if(_0x16a18f===_0x5fa2('0x53')){var _0xd8f4be=_[_0x5fa2('0x19')](_0x2cac01[_0x5fa2('0x2a')],'id');return _0x2cac01[_0x5fa2('0x56')](_0xd8f4be)[_0x5fa2('0x18')](function(){for(var _0x20792b=0x0;_0x20792b<_0xd8f4be[_0x5fa2('0x1e')];_0x20792b+=0x1){_0x228367[_0x5fa2('0x51')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0xd8f4be[_0x20792b]),'UserId':Number(_0x2cac01['id'])});}});}})[_0x5fa2('0x18')](function(){if(_0x16a18f===_0x5fa2('0x53')){var _0x1eb5d6=_['map'](_0x2cac01['WhatsappInteractions'],'id');return _0x2cac01[_0x5fa2('0x57')](_0x1eb5d6)['then'](function(){for(var _0x2432e5=0x0;_0x2432e5<_0x1eb5d6[_0x5fa2('0x1e')];_0x2432e5+=0x1){_0x228367[_0x5fa2('0x51')](_0x5fa2('0x58'),{'WhatsappInteractionId':Number(_0x1eb5d6[_0x2432e5]),'UserId':Number(_0x2cac01['id'])});}});}})['catch'](function(_0x3081b6){_0x448096[_0x5fa2('0x59')](_0x3081b6);});}}function onDisconnect(_0x5af27e,_0x3ac387){joinOrLeave(_0x5af27e,_0x5fa2('0x53'),_0x3ac387);}function onConnect(_0x55dbe0){joinOrLeave(_0x55dbe0,_0x5fa2('0x5a'));}exports[_0x5fa2('0x5b')]=function(_0x9204ee){_0x9204ee['on'](_0x5fa2('0x5c'),function(_0x2b5ac4){_0x2b5ac4['setMaxListeners'](0x0);_0x2b5ac4[_0x5fa2('0x5d')]=_0x2b5ac4[_0x5fa2('0x5e')][_0x5fa2('0x5c')][_0x5fa2('0x5f')]+':'+_0x2b5ac4['request'][_0x5fa2('0x5c')][_0x5fa2('0x60')];_0x2b5ac4['connectedAt']=new Date();_0x2b5ac4['log']=function(_0x461361){console[_0x5fa2('0x59')](_0x5fa2('0x61')+_0x2b5ac4[_0x5fa2('0x62')][_0x5fa2('0x4')]+'['+_0x2b5ac4[_0x5fa2('0x5d')]+']',_0x461361);};_0x2b5ac4['on'](_0x5fa2('0x63'),function(){onDisconnect(_0x2b5ac4,_0x9204ee);_0x2b5ac4[_0x5fa2('0x59')](_0x5fa2('0x64'));});onConnect(_0x2b5ac4);_0x2b5ac4['log'](_0x5fa2('0x65'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 98a6466..775289f 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 _0xf8d9=['util','../../mysqldb','jayson/promise','../logger','triggers','lodash','client','Chat','afterUpdate','closedinteraction','ChatMessage','newmessage','Sms','newinteraction','SmsInteraction','SmsMessage','Whatsapp','afterCreate','WhatsappInteraction','WhatsappMessage','FaxInteraction','Fax','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','then','info','Trigger,\x20%s','error','channel','direction','sequelize','Sequelize','QueryTypes','SELECT','contact','UserId','find','fullname','email','internal','incomingmessage','catch','outgoingmessage','event','ContactId','query','closed','get','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','name','interface','SIP/%s','agent','model','hook','toLowerCase','condition'];(function(_0x5ce663,_0x9e1b76){var _0xae7923=function(_0x385595){while(--_0x385595){_0x5ce663['push'](_0x5ce663['shift']());}};_0xae7923(++_0x9e1b76);}(_0xf8d9,0x140));var _0x9f8d=function(_0x276167,_0x21086e){_0x276167=_0x276167-0x0;var _0x27a866=_0xf8d9[_0x276167];return _0x27a866;};'use strict';var util=require(_0x9f8d('0x0'));var db=require(_0x9f8d('0x1'))['db'];var jayson=require(_0x9f8d('0x2'));var logger=require(_0x9f8d('0x3'))(_0x9f8d('0x4'));var _=require(_0x9f8d('0x5'));var client=jayson[_0x9f8d('0x6')]['http']({'port':0x232a});var triggers=[{'channel':_0x9f8d('0x7'),'model':'ChatInteraction','event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':_0x9f8d('0x7'),'model':'ChatInteraction','event':_0x9f8d('0x8'),'condition':_0x9f8d('0x9'),'callback':afterUpdate},{'channel':_0x9f8d('0x7'),'model':_0x9f8d('0xa'),'event':'afterCreate','condition':_0x9f8d('0xb'),'callback':afterCreateMessage},{'channel':_0x9f8d('0xc'),'model':'SmsInteraction','event':'afterCreate','condition':_0x9f8d('0xd'),'callback':afterCreate},{'channel':_0x9f8d('0xc'),'model':_0x9f8d('0xe'),'event':_0x9f8d('0x8'),'condition':_0x9f8d('0x9'),'callback':afterUpdate},{'channel':_0x9f8d('0xc'),'model':_0x9f8d('0xf'),'event':'afterCreate','condition':_0x9f8d('0xb'),'callback':afterCreateMessage},{'channel':_0x9f8d('0x10'),'model':'WhatsappInteraction','event':_0x9f8d('0x11'),'condition':_0x9f8d('0xd'),'callback':afterCreate},{'channel':_0x9f8d('0x10'),'model':_0x9f8d('0x12'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0x9f8d('0x10'),'model':_0x9f8d('0x13'),'event':_0x9f8d('0x11'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Fax','model':_0x9f8d('0x14'),'event':_0x9f8d('0x11'),'condition':_0x9f8d('0xd'),'callback':afterCreate},{'channel':_0x9f8d('0x15'),'model':'FaxInteraction','event':_0x9f8d('0x8'),'condition':_0x9f8d('0x9'),'callback':afterUpdate},{'channel':'Fax','model':_0x9f8d('0x16'),'event':'afterCreate','condition':_0x9f8d('0xb'),'callback':afterCreateMessage},{'channel':_0x9f8d('0x17'),'model':'MailInteraction','event':_0x9f8d('0x11'),'condition':_0x9f8d('0xd'),'callback':afterCreate},{'channel':_0x9f8d('0x17'),'model':_0x9f8d('0x18'),'event':_0x9f8d('0x8'),'condition':_0x9f8d('0x9'),'callback':afterUpdate},{'channel':_0x9f8d('0x17'),'model':_0x9f8d('0x19'),'event':_0x9f8d('0x11'),'condition':_0x9f8d('0xb'),'callback':afterCreateMessage},{'channel':_0x9f8d('0x1a'),'model':_0x9f8d('0x1b'),'event':_0x9f8d('0x11'),'condition':_0x9f8d('0xd'),'callback':afterCreate},{'channel':'Openchannel','model':_0x9f8d('0x1b'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0x9f8d('0x1a'),'model':_0x9f8d('0x1c'),'event':_0x9f8d('0x11'),'condition':_0x9f8d('0xb'),'callback':afterCreateMessage}];function request(_0x371414){return client[_0x9f8d('0x1d')](_0x9f8d('0x1e'),_0x371414)[_0x9f8d('0x1f')](function(_0x465d3e){logger[_0x9f8d('0x20')](_0x9f8d('0x21'),_0x9f8d('0x1e'),_0x465d3e);if(_0x465d3e[_0x9f8d('0x22')]){if(_0x465d3e['error']['code']===0x1f4){logger[_0x9f8d('0x22')](_0x9f8d('0x21'),_0x9f8d('0x1e'),_0x465d3e[_0x9f8d('0x22')]);}}})['catch'](function(_0x16ca86){logger[_0x9f8d('0x22')](_0x9f8d('0x21'),_0x9f8d('0x1e'),_0x16ca86);});}function afterCreateMessage(_0x1eb6c9,_0x5c25da){return function(_0x45d0b7,_0x1b5b85){_0x45d0b7=_0x45d0b7['get']({'plain':!![]});_0x45d0b7[_0x9f8d('0x23')]=_0x1eb6c9;_0x45d0b7['event']=_0x45d0b7[_0x9f8d('0x24')];var _0x22e7fc='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x45d0b7['ContactId'];return db[_0x9f8d('0x25')]['query'](_0x22e7fc,{'type':db[_0x9f8d('0x26')][_0x9f8d('0x27')][_0x9f8d('0x28')],'raw':!![]})[_0x9f8d('0x1f')](function(_0x3c5e3e){return _0x3c5e3e;})['then'](function(_0x529eee){if(_0x529eee){_0x45d0b7[_0x9f8d('0x29')]=_0x529eee[0x0];}if(_0x45d0b7[_0x9f8d('0x2a')]){return db['User'][_0x9f8d('0x2b')]({'where':{'id':_0x45d0b7[_0x9f8d('0x2a')]},'attributes':['id','name',_0x9f8d('0x2c'),_0x9f8d('0x2d'),_0x9f8d('0x2e')],'raw':!![]})[_0x9f8d('0x1f')](function(_0xa32791){_0x45d0b7['interface']=util['format']('SIP/%s',_0xa32791['name']);_0x45d0b7[_0x9f8d('0x23')]=_0x1eb6c9;_0x45d0b7['agent']=_0xa32791;return request({'event':_0x9f8d('0x2f'),'message':_0x45d0b7});})[_0x9f8d('0x30')](function(_0x1dd034){console['error'](_0x1dd034);});}else{return request({'event':_0x9f8d('0x31'),'message':_0x45d0b7});}});};}function afterCreate(_0x20312c,_0x4d6ff6){return function(_0x5b1998,_0x1003da){_0x5b1998=_0x5b1998['get']({'plain':!![]});_0x5b1998['channel']=_0x20312c;_0x5b1998[_0x9f8d('0x32')]='opened';var _0x238c71='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5b1998[_0x9f8d('0x33')];return db[_0x9f8d('0x25')][_0x9f8d('0x34')](_0x238c71,{'type':db[_0x9f8d('0x26')][_0x9f8d('0x27')]['SELECT'],'raw':!![]})[_0x9f8d('0x1f')](function(_0xd28cd6){return _0xd28cd6;})['then'](function(_0xd59e09){if(_0xd59e09){_0x5b1998['contact']=_0xd59e09[0x0];}return request({'event':_0x4d6ff6,'message':_0x5b1998});});};}function afterUpdate(_0x55a6e8,_0x24b6f5){return function(_0x4ba15b,_0x24d209){if(_0x4ba15b['changed'](_0x9f8d('0x35'))&&_0x4ba15b[_0x9f8d('0x35')]){_0x4ba15b=_0x4ba15b[_0x9f8d('0x36')]({'plain':!![]});_0x4ba15b[_0x9f8d('0x23')]=_0x55a6e8;_0x4ba15b[_0x9f8d('0x32')]='closed';var _0x51aa70=_0x9f8d('0x37')+_0x4ba15b[_0x9f8d('0x33')];return db['sequelize'][_0x9f8d('0x34')](_0x51aa70,{'type':db[_0x9f8d('0x26')]['QueryTypes'][_0x9f8d('0x28')],'raw':!![]})['then'](function(_0x5abae0){return _0x5abae0;})[_0x9f8d('0x1f')](function(_0x31b659){if(_0x31b659){_0x4ba15b['contact']=_0x31b659[0x0];}if(_0x4ba15b[_0x9f8d('0x2a')]){return db['User']['find']({'where':{'id':_0x4ba15b['UserId']},'attributes':['id',_0x9f8d('0x38'),_0x9f8d('0x2c'),_0x9f8d('0x2d'),_0x9f8d('0x2e')],'raw':!![]})[_0x9f8d('0x1f')](function(_0x401bca){_0x4ba15b[_0x9f8d('0x39')]=util['format'](_0x9f8d('0x3a'),_0x401bca[_0x9f8d('0x38')]);_0x4ba15b[_0x9f8d('0x3b')]=_0x401bca;return request({'event':_0x24b6f5,'message':_0x4ba15b});})[_0x9f8d('0x30')](function(_0x21756e){console[_0x9f8d('0x22')](_0x21756e);});}else{return request({'event':_0x24b6f5,'message':_0x4ba15b});}});}};}exports['default']=function(){for(var _0x20860c=0x0;_0x20860c=_0xa1cea8['agents']){throw Error(_0xabaa('0x14'));}_0x1b099a(_0x2c9271);})[_0xabaa('0x15')](function(_0x58b8fe){_0x3a2605(_0x58b8fe);});});}; \ No newline at end of file +var _0x34e6=['Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','../mysqldb','./license/util','voice','chat','fax','sms','openchannel','isValidChannel','toLowerCase','isUndefined','blockedAt','getLicense','role','agent','User','count','then'];(function(_0x641145,_0x4a6429){var _0x39af3f=function(_0x3a2274){while(--_0x3a2274){_0x641145['push'](_0x641145['shift']());}};_0x39af3f(++_0x4a6429);}(_0x34e6,0x80));var _0x634e=function(_0x58b998,_0x113c33){_0x58b998=_0x58b998-0x0;var _0x119f63=_0x34e6[_0x58b998];return _0x119f63;};'use strict';var _=require(_0x634e('0x0'));var BPromise=require(_0x634e('0x1'));var db=require(_0x634e('0x2'))['db'];var util=require(_0x634e('0x3'));var channels=[_0x634e('0x4'),'mail',_0x634e('0x5'),_0x634e('0x6'),_0x634e('0x7'),'whatsapp',_0x634e('0x8')];exports['getChannels']=function(){return channels;};exports[_0x634e('0x9')]=function(_0x517de4){_0x517de4=_0x517de4[_0x634e('0xa')]();return _['includes'](channels,_0x517de4);};exports['clearBlockUser']=function(_0x4a82ce,_0x1ed8d0,_0x589046,_0x541d6e){var _0x381aa3={'loginAttempts':_0x1ed8d0,'blocked':_0x589046};if(!_[_0x634e('0xb')](_0x541d6e)){_0x381aa3[_0x634e('0xc')]=_0x541d6e;}return _0x4a82ce['updateAttributes'](_0x381aa3);};exports[_0x634e('0xd')]=function(_0x17b9ab){return new BPromise(function(_0x27a243,_0x5a2e98){var _0x7d94ff=0x0;if(_0x17b9ab[_0x634e('0xe')]!==_0x634e('0xf')){_0x27a243(_0x17b9ab);}db[_0x634e('0x10')][_0x634e('0x11')]({'where':{'role':_0x634e('0xf'),'online':!![],'id':{'$ne':_0x17b9ab['id']}}})['then'](function(_0x627fc6){_0x7d94ff=_0x627fc6;return util[_0x634e('0xd')]();})[_0x634e('0x12')](function(_0x18da11){if(_0x18da11&&_0x18da11['agents']&&_0x7d94ff>=_0x18da11['agents']){throw Error(_0x634e('0x13'));}_0x27a243(_0x17b9ab);})[_0x634e('0x14')](function(_0x4c6a6d){_0x5a2e98(_0x4c6a6d);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index dcfe8c1..6665192 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4fc2=['send','exports','status','render'];(function(_0x1b7368,_0x3286ed){var _0x25d54c=function(_0x2366da){while(--_0x2366da){_0x1b7368['push'](_0x1b7368['shift']());}};_0x25d54c(++_0x3286ed);}(_0x4fc2,0x111));var _0x24fc=function(_0x625560,_0x3da411){_0x625560=_0x625560-0x0;var _0x47ffd7=_0x4fc2[_0x625560];return _0x47ffd7;};'use strict';module[_0x24fc('0x0')][0x194]=function pageNotFound(_0x2b05a5,_0x1a4e51){var _0x4390a0='404';var _0x365c56=0x194;var _0x23eaa0={'status':_0x365c56};_0x1a4e51[_0x24fc('0x1')](_0x23eaa0['status']);_0x1a4e51[_0x24fc('0x2')](_0x4390a0,{},function(_0x3772eb,_0x58dafc){if(_0x3772eb){return _0x1a4e51[_0x24fc('0x1')](_0x23eaa0[_0x24fc('0x1')])['json'](_0x23eaa0);}_0x1a4e51[_0x24fc('0x3')](_0x58dafc);});}; \ No newline at end of file +var _0x34ec=['render','json','send','exports','404','status'];(function(_0x51389a,_0x1bfad3){var _0x17ed0a=function(_0x1c784d){while(--_0x1c784d){_0x51389a['push'](_0x51389a['shift']());}};_0x17ed0a(++_0x1bfad3);}(_0x34ec,0x129));var _0xc34e=function(_0x4cc927,_0x402bed){_0x4cc927=_0x4cc927-0x0;var _0x16cc66=_0x34ec[_0x4cc927];return _0x16cc66;};'use strict';module[_0xc34e('0x0')][0x194]=function pageNotFound(_0xb6c0a2,_0x5a03e3){var _0x4f822c=_0xc34e('0x1');var _0x583137=0x194;var _0x214399={'status':_0x583137};_0x5a03e3[_0xc34e('0x2')](_0x214399[_0xc34e('0x2')]);_0x5a03e3[_0xc34e('0x3')](_0x4f822c,{},function(_0xb9594b,_0x56ae6a){if(_0xb9594b){return _0x5a03e3[_0xc34e('0x2')](_0x214399[_0xc34e('0x2')])[_0xc34e('0x4')](_0x214399);}_0x5a03e3[_0xc34e('0x5')](_0x56ae6a);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 0ad7a8a..57fec83 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8743=['HopperFinals','CmHopperHistory','HopperHistory','ReportAgentPreview','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','SenderId','belongsTo','belongsToMany','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueue','VoiceQueues','MailQueues','UserMailQueue','ChatQueue','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueue','OpenchannelQueues','WhatsappQueues','VoicePrefixes','user_has_voice_prefixes','ChatWebsites','user_has_chat_websites','FaxAccount','FaxAccounts','user_has_fax_accounts','user_has_mail_accounts','OpenchannelAccount','OpenchannelAccounts','user_has_openchannel_accounts','user_has_sms_accounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','VoiceContext','Applications','Sounds','moh_has_sounds','UserVoiceQueueRt','Members','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','voice_queues_has_cm_blacklists','Messages','mailboxuser','VoiceCallReport','uniqueid','VoiceAgentReport','AgentReports','CmContact','Contact','ContactId','MailAccountId','Imap','Smtp','Disposition','Dispositions','Answers','MailMessage','Interactions','MailApplication','ListId','team_has_mail_queues','MailInteractionId','Account','mail_interaction_has_tags','ThroughTags','Users','Attachments','Interaction','ChatWebsiteId','restrict','MailQueueReport','List','Items','FaxAccountId','Exntensions','mandatoryDispositionPause','TagId','FaxInteractionId','Owner','Tags','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','sms_interaction_has_tags','SmsInteractionId','team_has_sms_queues','OpenchannelAccountId','OpenchannelMessage','OpenchannelApplication','OpenchannelInteractionId','openchannel_interaction_has_tags','UserOpenchannelQueue','OpenchannelQueueId','team_has_openchannel_queues','ProactiveActions','Agent','ChatApplication','ChatInteractionId','chat_interaction_has_tags','ChatOfflineMessageId','ChatGroupId','Website','Contacts','CompanyId','Company','cm_contact_has_tags','Queue','Campaign','CampaignId','OwnerId','OneAll','AutomationAllId','OneAny','AutomationAnyId','Actions','MailApplications','ChatApplications','FaxApplications','CustomReportId','Mohs','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerId','AnalyticCustomReport','Fields','AnalyticDefaultReport','DefaultReportId','MetricId','Configurations','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Description','Field','VariableId','DeskAccount','int_desk_configuration_has_tags','int_zendesk_configuration_has_tags','FreshdeskAccount','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowAccount','ChatQueueReport','FromId','ToId','SessionId','ProjectId','team_has_chat_queues','team_has_whatsapp_queues','HopperHistories','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToMailQueueId','ToQueue','ToAccount','FromChatWebsiteId','ToAgent','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromUserId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','CustomFields','Queues','userProfileId','Resources','sectionId','WhatsappAccount','WhatsappAccountId','WhatsappInteractionId','whatsapp_interaction_has_tags','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','../config/environment','sequelize','determine','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','defaultsDeep','database','username','password','options','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserWhatsappQueue','MailServerIn','../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','MailInteraction','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','Dashboard','DashboardItem','../api/dashboardItem/dashboardItem.model','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','../api/openchannelAccount/openchannelAccount.model','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','../api/openchannelMessage/openchannelMessage.model','ChatWebsite','OpenchannelQueueReport','../api/chatApplication/chatApplication.model','ChatInteraction','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','../api/chatQueue/chatQueue.model','ChatGroup','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperFinal/cmHopperFinal.model','../api/cmHopperHistory/cmHopperHistory.model','CmCustomField','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','Tag','../api/tag/tag.model','Template','../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','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','ZendeskField','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','../api/campaign/campaign.model','Migration','Attachment','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','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','UserNotification','../api/userNotification/userNotification.model','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','hasOne','cascade','UserId','Recordings','hasMany','VoiceQueuesRt','Extensions','CmHopperFinal'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x8743,0xdd));var _0x3874=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x8743[_0x1facfa];return _0x9ec701;};'use strict';var config=require(_0x3874('0x0'));var Sequelize=require(_0x3874('0x1'));var _=require('lodash');var jstz=require('jstz');var timezone=jstz[_0x3874('0x2')]();config[_0x3874('0x1')]=_['defaultsDeep'](config[_0x3874('0x1')],{'database':_0x3874('0x3'),'username':_0x3874('0x4'),'password':_0x3874('0x5'),'options':{'host':_0x3874('0x6'),'port':0xcea,'dialect':_0x3874('0x7'),'dialectOptions':{'charset':_0x3874('0x8')},'logging':![],'timezone':timezone[_0x3874('0x9')](),'define':{'charset':_0x3874('0xa'),'collate':_0x3874('0xb')}}});config[_0x3874('0xc')]=_[_0x3874('0xd')](config['sequelizeHistory'],{'database':_0x3874('0x3'),'username':'xcall','password':_0x3874('0x5'),'options':{'host':_0x3874('0x6'),'port':0xcea,'dialect':_0x3874('0x7'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x3874('0xa'),'collate':_0x3874('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x3874('0x1')][_0x3874('0xe')],config[_0x3874('0x1')][_0x3874('0xf')],config[_0x3874('0x1')][_0x3874('0x10')],config[_0x3874('0x1')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x3874('0xe')],config[_0x3874('0xc')][_0x3874('0xf')],config[_0x3874('0xc')][_0x3874('0x10')],config[_0x3874('0xc')][_0x3874('0x11')])};db[_0x3874('0x12')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x14'));db[_0x3874('0x15')]=db[_0x3874('0x1')]['import'](_0x3874('0x16'));db['VoiceContext']=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x17'));db[_0x3874('0x18')]=db[_0x3874('0x1')]['import'](_0x3874('0x19'));db[_0x3874('0x1a')]=db[_0x3874('0x1')][_0x3874('0x13')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db['VoiceQueue']=db[_0x3874('0x1')][_0x3874('0x13')]('../api/voiceQueue/voiceQueue.model');db[_0x3874('0x1b')]=db[_0x3874('0x1')]['import'](_0x3874('0x1c'));db[_0x3874('0x1d')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x1e'));db[_0x3874('0x1f')]=db['sequelize'][_0x3874('0x13')](_0x3874('0x20'));db[_0x3874('0x21')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x22'));db['VoiceCallReport']=db[_0x3874('0x1')]['import'](_0x3874('0x23'));db['VoiceDialReport']=db[_0x3874('0x1')][_0x3874('0x13')]('../api/voiceDialReport/voiceDialReport.model');db['VoiceAgentReport']=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x24'));db[_0x3874('0x25')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x26'));db[_0x3874('0x27')]=db['sequelize'][_0x3874('0x13')](_0x3874('0x28'));db[_0x3874('0x29')]=db['sequelize'][_0x3874('0x13')](_0x3874('0x2a'));db[_0x3874('0x2b')]=db['sequelize']['import'](_0x3874('0x2c'));db['UserVoiceQueueRt']=db['sequelize'][_0x3874('0x13')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0x3874('0x2d')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x2e'));db['UserChatQueue']=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x2f'));db['UserMailQueue']=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x30'));db['UserFaxQueue']=db['sequelize'][_0x3874('0x13')](_0x3874('0x31'));db[_0x3874('0x32')]=db['sequelize']['import'](_0x3874('0x33'));db['UserOpenchannelQueue']=db['sequelize']['import']('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0x3874('0x34')]=db[_0x3874('0x1')][_0x3874('0x13')]('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0x3874('0x35')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x36'));db['MailServerOut']=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x37'));db[_0x3874('0x38')]=db['sequelize'][_0x3874('0x13')](_0x3874('0x39'));db[_0x3874('0x3a')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x3b'));db[_0x3874('0x3c')]=db['sequelize'][_0x3874('0x13')]('../api/mailSubstatus/mailSubstatus.model');db[_0x3874('0x3d')]=db[_0x3874('0x1')]['import']('../api/mailInteraction/mailInteraction.model');db['MailMessage']=db['sequelize'][_0x3874('0x13')](_0x3874('0x3e'));db['MailApplication']=db[_0x3874('0x1')]['import'](_0x3874('0x3f'));db['MailQueueReport']=db['sequelize'][_0x3874('0x13')](_0x3874('0x40'));db[_0x3874('0x41')]=db[_0x3874('0x1')][_0x3874('0x13')]('../api/dashboard/dashboard.model');db[_0x3874('0x42')]=db[_0x3874('0x1')]['import'](_0x3874('0x43'));db['FaxAccount']=db[_0x3874('0x1')]['import'](_0x3874('0x44'));db[_0x3874('0x45')]=db[_0x3874('0x1')]['import'](_0x3874('0x46'));db[_0x3874('0x47')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x48'));db[_0x3874('0x49')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x4a'));db[_0x3874('0x4b')]=db[_0x3874('0x1')]['import'](_0x3874('0x4c'));db[_0x3874('0x4d')]=db['sequelize'][_0x3874('0x13')](_0x3874('0x4e'));db[_0x3874('0x4f')]=db[_0x3874('0x1')][_0x3874('0x13')]('../api/smsAccount/smsAccount.model');db[_0x3874('0x50')]=db['sequelize'][_0x3874('0x13')](_0x3874('0x51'));db[_0x3874('0x52')]=db[_0x3874('0x1')]['import'](_0x3874('0x53'));db[_0x3874('0x54')]=db[_0x3874('0x1')]['import'](_0x3874('0x55'));db[_0x3874('0x56')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x57'));db['OpenchannelAccount']=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x58'));db['OpenchannelApplication']=db['sequelize']['import'](_0x3874('0x59'));db[_0x3874('0x5a')]=db['sequelize']['import'](_0x3874('0x5b'));db['OpenchannelMessage']=db[_0x3874('0x1')]['import'](_0x3874('0x5c'));db['OpenchannelQueue']=db[_0x3874('0x1')][_0x3874('0x13')]('../api/openchannelQueue/openchannelQueue.model');db[_0x3874('0x5d')]=db[_0x3874('0x1')][_0x3874('0x13')]('../api/chatWebsite/chatWebsite.model');db[_0x3874('0x5e')]=db[_0x3874('0x1')][_0x3874('0x13')]('../api/openchannelQueueReport/openchannelQueueReport.model');db['ChatApplication']=db[_0x3874('0x1')]['import'](_0x3874('0x5f'));db[_0x3874('0x60')]=db['sequelize'][_0x3874('0x13')]('../api/chatInteraction/chatInteraction.model');db[_0x3874('0x61')]=db[_0x3874('0x1')]['import'](_0x3874('0x62'));db[_0x3874('0x63')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x64'));db['ChatQueue']=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x65'));db[_0x3874('0x66')]=db[_0x3874('0x1')]['import']('../api/chatGroup/chatGroup.model');db[_0x3874('0x67')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x68'));db[_0x3874('0x69')]=db[_0x3874('0x1')]['import'](_0x3874('0x6a'));db['CmContact']=db['sequelize']['import']('../api/cmContact/cmContact.model');db[_0x3874('0x6b')]=db[_0x3874('0x1')]['import'](_0x3874('0x6c'));db[_0x3874('0x6d')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x6e'));db['CmHopperFinal']=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x6f'));db['CmHopperHistory']=db[_0x3874('0x1')]['import'](_0x3874('0x70'));db['ReportAgentPreview']=db['sequelize'][_0x3874('0x13')]('../api/reportAgentPreview/reportAgentPreview.model');db[_0x3874('0x71')]=db['sequelize'][_0x3874('0x13')]('../api/cmCustomField/cmCustomField.model');db[_0x3874('0x72')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x73'));db[_0x3874('0x74')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x75'));db[_0x3874('0x76')]=db[_0x3874('0x1')][_0x3874('0x13')]('../api/cannedAnswer/cannedAnswer.model');db['Disposition']=db['sequelize'][_0x3874('0x13')]('../api/disposition/disposition.model');db[_0x3874('0x77')]=db['sequelize'][_0x3874('0x13')](_0x3874('0x78'));db[_0x3874('0x79')]=db['sequelize']['import'](_0x3874('0x7a'));db[_0x3874('0x7b')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x7c'));db['Cdr']=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x7d'));db[_0x3874('0x7e')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x7f'));db[_0x3874('0x80')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x81'));db[_0x3874('0x82')]=db[_0x3874('0x1')][_0x3874('0x13')]('../api/sound/sound.model');db[_0x3874('0x83')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x84'));db[_0x3874('0x85')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x86'));db[_0x3874('0x87')]=db['sequelize']['import'](_0x3874('0x88'));db[_0x3874('0x89')]=db[_0x3874('0x1')]['import'](_0x3874('0x8a'));db[_0x3874('0x8b')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x8c'));db[_0x3874('0x8d')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x8e'));db['AnalyticCustomReport']=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x8f'));db['AnalyticDefaultReport']=db['sequelize'][_0x3874('0x13')]('../api/analyticDefaultReport/analyticDefaultReport.model');db['AnalyticExtractedReport']=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x90'));db[_0x3874('0x91')]=db[_0x3874('0x1')][_0x3874('0x13')]('../api/analyticMetric/analyticMetric.model');db[_0x3874('0x92')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x93'));db[_0x3874('0x94')]=db['sequelize'][_0x3874('0x13')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0x3874('0x95')]=db[_0x3874('0x1')]['import'](_0x3874('0x96'));db[_0x3874('0x97')]=db[_0x3874('0x1')]['import'](_0x3874('0x98'));db[_0x3874('0x99')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x9a'));db[_0x3874('0x9b')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x9c'));db[_0x3874('0x9d')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x9e'));db[_0x3874('0x9f')]=db['sequelize'][_0x3874('0x13')](_0x3874('0xa0'));db['DeskAccount']=db['sequelize'][_0x3874('0x13')](_0x3874('0xa1'));db[_0x3874('0xa2')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0xa3'));db[_0x3874('0xa4')]=db[_0x3874('0x1')][_0x3874('0x13')]('../api/intDeskField/intDeskField.model');db[_0x3874('0xa5')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0xa6'));db[_0x3874('0xa7')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0xa8'));db[_0x3874('0xa9')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0xaa'));db[_0x3874('0xab')]=db['sequelize']['import'](_0x3874('0xac'));db[_0x3874('0xad')]=db[_0x3874('0x1')][_0x3874('0x13')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0x3874('0xae')]=db[_0x3874('0x1')][_0x3874('0x13')]('../api/intZendeskField/intZendeskField.model');db['FreshdeskAccount']=db['sequelize'][_0x3874('0x13')](_0x3874('0xaf'));db[_0x3874('0xb0')]=db[_0x3874('0x1')]['import'](_0x3874('0xb1'));db[_0x3874('0xb2')]=db[_0x3874('0x1')]['import'](_0x3874('0xb3'));db['VtigerAccount']=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0xb4'));db[_0x3874('0xb5')]=db[_0x3874('0x1')]['import'](_0x3874('0xb6'));db[_0x3874('0xb7')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0xb8'));db['ServicenowAccount']=db[_0x3874('0x1')]['import'](_0x3874('0xb9'));db[_0x3874('0xba')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0xbb'));db[_0x3874('0xbc')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0xbd'));db[_0x3874('0xbe')]=db[_0x3874('0x1')][_0x3874('0x13')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x3874('0xbf')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0xc0'));db[_0x3874('0xc1')]=db[_0x3874('0x1')][_0x3874('0x13')]('../api/intDynamics365Field/intDynamics365Field.model');db[_0x3874('0xc2')]=db['sequelize'][_0x3874('0x13')](_0x3874('0xc3'));db[_0x3874('0xc4')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0xc5'));db[_0x3874('0xc6')]=db['sequelize'][_0x3874('0x13')](_0x3874('0xc7'));db['Integration']=db[_0x3874('0x1')][_0x3874('0x13')]('../api/integration/integration.model');db[_0x3874('0xc8')]=db[_0x3874('0x1')][_0x3874('0x13')]('../api/network/network.model');db['ChatQueueReport']=db[_0x3874('0x1')]['import'](_0x3874('0xc9'));db[_0x3874('0xca')]=db[_0x3874('0x1')]['import']('../api/chatInternalMessage/chatInternalMessage.model');db[_0x3874('0xcb')]=db['sequelize'][_0x3874('0x13')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0x3874('0xcc')]=db['sequelize'][_0x3874('0x13')](_0x3874('0xcd'));db[_0x3874('0xce')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0xcf'));db[_0x3874('0xd0')]=db[_0x3874('0x1')][_0x3874('0x13')]('../api/smsQueueReport/smsQueueReport.model');db['SquareReport']=db['sequelize'][_0x3874('0x13')](_0x3874('0xd1'));db[_0x3874('0xd2')]=db['sequelize'][_0x3874('0x13')](_0x3874('0xd3'));db[_0x3874('0xd4')]=db['sequelize'][_0x3874('0x13')](_0x3874('0xd5'));db[_0x3874('0xd6')]=db['sequelize'][_0x3874('0x13')]('../api/setting/setting.model');db['SquareOdbc']=db[_0x3874('0x1')][_0x3874('0x13')]('../api/squareOdbc/squareOdbc.model');db[_0x3874('0xd7')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0xd8'));db[_0x3874('0xd9')]=db['sequelize'][_0x3874('0x13')](_0x3874('0xda'));db['SquareMessage']=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0xdb'));db[_0x3874('0xdc')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0xdd'));db[_0x3874('0xde')]=db[_0x3874('0x1')]['import'](_0x3874('0xdf'));db['Campaign']=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0xe0'));db[_0x3874('0xe1')]=db[_0x3874('0x1')][_0x3874('0x13')]('../api/migration/migration.model');db[_0x3874('0xe2')]=db['sequelize']['import']('../api/attachment/attachment.model');db[_0x3874('0xe3')]=db[_0x3874('0x1')]['import'](_0x3874('0xe4'));db[_0x3874('0xe5')]=db[_0x3874('0x1')]['import'](_0x3874('0xe6'));db[_0x3874('0xe7')]=db[_0x3874('0x1')][_0x3874('0x13')]('../api/chatTransferReport/chatTransferReport.model');db[_0x3874('0xe8')]=db[_0x3874('0x1')]['import'](_0x3874('0xe9'));db[_0x3874('0xea')]=db['sequelize']['import'](_0x3874('0xeb'));db[_0x3874('0xec')]=db['sequelize'][_0x3874('0x13')](_0x3874('0xed'));db[_0x3874('0xee')]=db[_0x3874('0x1')][_0x3874('0x13')]('../api/cmList/cmList.model');db[_0x3874('0xef')]=db['sequelize'][_0x3874('0x13')](_0x3874('0xf0'));db[_0x3874('0xf1')]=db['sequelize']['import'](_0x3874('0xf2'));db[_0x3874('0xf3')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0xf4'));db[_0x3874('0xf5')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0xf6'));db[_0x3874('0xf7')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0xf8'));db['WhatsappAccount']=db['sequelize'][_0x3874('0x13')](_0x3874('0xf9'));db[_0x3874('0xfa')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0xfb'));db[_0x3874('0xfc')]=db[_0x3874('0x1')]['import']('../api/whatsappInteraction/whatsappInteraction.model');db[_0x3874('0xfd')]=db['sequelize']['import'](_0x3874('0xfe'));db[_0x3874('0xff')]=db[_0x3874('0x1')]['import'](_0x3874('0x100'));db[_0x3874('0x101')]=db['sequelize'][_0x3874('0x13')](_0x3874('0x102'));db[_0x3874('0x103')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x104'));db[_0x3874('0x105')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x106'));db['TeamVoiceQueue']=db[_0x3874('0x1')][_0x3874('0x13')]('../api/teamVoiceQueue/teamVoiceQueue.model');db['User'][_0x3874('0x107')](db[_0x3874('0x1f')],{'as':_0x3874('0x1f'),'onDelete':_0x3874('0x108'),'foreignKey':_0x3874('0x109')});db[_0x3874('0x12')]['hasMany'](db['VoiceRecording'],{'as':_0x3874('0x10a'),'foreignKey':'UserId'});db[_0x3874('0x12')][_0x3874('0x10b')](db['UserVoiceQueueRt'],{'as':_0x3874('0x10c'),'foreignKey':'UserId'});db[_0x3874('0x12')][_0x3874('0x10b')](db[_0x3874('0x18')],{'as':_0x3874('0x10d'),'onDelete':_0x3874('0x108'),'hooks':!![]});db['User'][_0x3874('0x10b')](db[_0x3874('0x10e')],{'as':_0x3874('0x10f'),'foreignKey':'UserId'});db[_0x3874('0x12')][_0x3874('0x10b')](db[_0x3874('0x110')],{'as':_0x3874('0x111'),'foreignKey':'UserId'});db[_0x3874('0x12')]['hasMany'](db[_0x3874('0x112')],{'as':_0x3874('0x112'),'foreignKey':'UserId'});db[_0x3874('0x12')][_0x3874('0x10b')](db[_0x3874('0x5a')],{'as':_0x3874('0x113'),'foreignKey':_0x3874('0x109')});db['User'][_0x3874('0x10b')](db[_0x3874('0x60')],{'as':_0x3874('0x114'),'foreignKey':_0x3874('0x109')});db[_0x3874('0x12')][_0x3874('0x10b')](db['SmsInteraction'],{'as':_0x3874('0x115'),'foreignKey':_0x3874('0x109')});db[_0x3874('0x12')]['hasMany'](db[_0x3874('0x47')],{'as':_0x3874('0x116'),'foreignKey':_0x3874('0x109')});db['User'][_0x3874('0x10b')](db[_0x3874('0x3d')],{'as':_0x3874('0x117'),'foreignKey':_0x3874('0x109')});db[_0x3874('0x12')]['hasMany'](db[_0x3874('0xfc')],{'as':_0x3874('0x118'),'foreignKey':'UserId'});db[_0x3874('0x12')][_0x3874('0x10b')](db[_0x3874('0xf7')],{'as':'UserNotifications','foreignKey':_0x3874('0x119')});db[_0x3874('0x12')][_0x3874('0x11a')](db[_0x3874('0xf1')],{'as':_0x3874('0xf1'),'foreignKey':'userProfileId'});db[_0x3874('0x12')][_0x3874('0x11b')](db[_0x3874('0x66')],{'as':'Groups','through':'chat_group_has_users'});db[_0x3874('0x12')][_0x3874('0x11b')](db['CmContact'],{'as':'Contacts','through':'cm_user_has_contacts'});db[_0x3874('0x12')]['belongsToMany'](db[_0x3874('0xee')],{'as':_0x3874('0x11c'),'through':_0x3874('0x11d')});db[_0x3874('0x12')]['belongsToMany'](db['Team'],{'through':_0x3874('0x11e')});db[_0x3874('0x12')][_0x3874('0x11b')](db[_0x3874('0x3d')],{'as':_0x3874('0x117'),'through':_0x3874('0x11f')});db[_0x3874('0x12')]['belongsToMany'](db[_0x3874('0x60')],{'as':'ChatInteractions','through':_0x3874('0x120')});db[_0x3874('0x12')]['belongsToMany'](db[_0x3874('0x47')],{'as':'FaxInteractions','through':_0x3874('0x121')});db[_0x3874('0x12')][_0x3874('0x11b')](db[_0x3874('0x52')],{'as':_0x3874('0x115'),'through':_0x3874('0x122')});db['User']['belongsToMany'](db[_0x3874('0x5a')],{'as':_0x3874('0x113'),'through':_0x3874('0x123')});db[_0x3874('0x12')][_0x3874('0x11b')](db[_0x3874('0xfc')],{'as':'WhatsappInteractions','through':_0x3874('0x124')});db['User'][_0x3874('0x11b')](db[_0x3874('0x125')],{'as':_0x3874('0x126'),'through':_0x3874('0x2d'),'required':![]});db[_0x3874('0x12')]['belongsToMany'](db['MailQueue'],{'as':_0x3874('0x127'),'through':_0x3874('0x128'),'required':![]});db[_0x3874('0x12')]['belongsToMany'](db[_0x3874('0x129')],{'as':_0x3874('0x12a'),'through':_0x3874('0x12b'),'required':![],'hooks':!![]});db[_0x3874('0x12')]['belongsToMany'](db['FaxQueue'],{'as':_0x3874('0x12c'),'through':'UserFaxQueue','required':![]});db[_0x3874('0x12')][_0x3874('0x11b')](db[_0x3874('0x56')],{'as':_0x3874('0x12d'),'through':_0x3874('0x32'),'required':![]});db['User'][_0x3874('0x11b')](db[_0x3874('0x12e')],{'as':_0x3874('0x12f'),'through':'UserOpenchannelQueue','required':![]});db['User'][_0x3874('0x11b')](db['WhatsappQueue'],{'as':_0x3874('0x130'),'through':_0x3874('0x34'),'required':![]});db[_0x3874('0x12')]['belongsToMany'](db[_0x3874('0xee')],{'through':_0x3874('0x11d')});db['User']['belongsToMany'](db['VoicePrefix'],{'as':_0x3874('0x131'),'through':_0x3874('0x132'),'required':![]});db[_0x3874('0x12')][_0x3874('0x11b')](db[_0x3874('0x5d')],{'as':_0x3874('0x133'),'through':_0x3874('0x134')});db['User'][_0x3874('0x11b')](db[_0x3874('0x135')],{'as':_0x3874('0x136'),'through':_0x3874('0x137')});db[_0x3874('0x12')]['belongsToMany'](db[_0x3874('0x38')],{'as':'MailAccounts','through':_0x3874('0x138')});db['User'][_0x3874('0x11b')](db[_0x3874('0x139')],{'as':_0x3874('0x13a'),'through':_0x3874('0x13b')});db['User'][_0x3874('0x11b')](db['SmsAccount'],{'as':'SmsAccounts','through':_0x3874('0x13c')});db[_0x3874('0x12')][_0x3874('0x11b')](db['WhatsappAccount'],{'as':'WhatsappAccounts','through':_0x3874('0x13d')});db[_0x3874('0x12')][_0x3874('0x11b')](db['SquareProject'],{'as':_0x3874('0x13e'),'through':_0x3874('0x13f')});db[_0x3874('0x15')]['hasMany'](db[_0x3874('0x18')],{'as':_0x3874('0x140'),'onDelete':_0x3874('0x108'),'foreignKey':_0x3874('0x141')});db[_0x3874('0x142')][_0x3874('0x10b')](db[_0x3874('0x18')],{'onDelete':_0x3874('0x108')});db['VoiceExtension']['hasMany'](db['VoiceExtension'],{'as':_0x3874('0x143'),'onDelete':'cascade'});db[_0x3874('0x1a')][_0x3874('0x11b')](db[_0x3874('0x82')],{'as':_0x3874('0x144'),'through':_0x3874('0x145')});db[_0x3874('0x125')]['hasMany'](db[_0x3874('0x146')],{'as':_0x3874('0x147'),'foreignKey':_0x3874('0x148')});db[_0x3874('0x125')][_0x3874('0x10b')](db[_0x3874('0x6b')],{'as':_0x3874('0x149'),'foreignKey':_0x3874('0x148')});db['VoiceQueue'][_0x3874('0x10b')](db[_0x3874('0x10e')],{'as':_0x3874('0x10f'),'foreignKey':'VoiceQueueId'});db[_0x3874('0x125')][_0x3874('0x10b')](db[_0x3874('0x110')],{'as':'HopperHistories','foreignKey':_0x3874('0x148')});db[_0x3874('0x125')][_0x3874('0x10b')](db['ReportAgentPreview'],{'as':_0x3874('0x112'),'foreignKey':_0x3874('0x148')});db[_0x3874('0x125')]['hasMany'](db[_0x3874('0x6d')],{'as':_0x3874('0x14a'),'foreignKey':_0x3874('0x148')});db['VoiceQueue'][_0x3874('0x10b')](db[_0x3874('0xce')],{'as':_0x3874('0x14b'),'foreignKey':_0x3874('0x148')});db[_0x3874('0x125')]['belongsTo'](db[_0x3874('0x29')],{'as':_0x3874('0x29'),'foreignKey':_0x3874('0x14c')});db[_0x3874('0x125')]['belongsTo'](db[_0x3874('0x29')],{'as':_0x3874('0x14d'),'foreignKey':_0x3874('0x14e')});db[_0x3874('0x125')][_0x3874('0x11a')](db[_0x3874('0x79')],{'as':_0x3874('0x79'),'foreignKey':_0x3874('0x14f')});db[_0x3874('0x125')][_0x3874('0x11a')](db[_0x3874('0x7b')],{'as':'mandatoryDispositionPause','foreignKey':_0x3874('0x150')});db[_0x3874('0x125')][_0x3874('0x11b')](db[_0x3874('0xee')],{'as':_0x3874('0x11c'),'through':_0x3874('0x151')});db[_0x3874('0x125')][_0x3874('0x11b')](db[_0x3874('0x12')],{'as':_0x3874('0x152'),'through':_0x3874('0x2d')});db[_0x3874('0x125')][_0x3874('0x11b')](db['Team'],{'as':_0x3874('0x153'),'through':'TeamVoiceQueue'});db['VoiceQueue'][_0x3874('0x11b')](db[_0x3874('0xee')],{'as':'BlackLists','through':_0x3874('0x154')});db[_0x3874('0x1b')][_0x3874('0x11a')](db[_0x3874('0x12')],{'as':_0x3874('0x12'),'foreignKey':_0x3874('0x109')});db[_0x3874('0x1d')]['belongsTo'](db[_0x3874('0x12')],{'as':_0x3874('0x12'),'foreignKey':_0x3874('0x109')});db[_0x3874('0x1f')][_0x3874('0x10b')](db[_0x3874('0x21')],{'as':_0x3874('0x155'),'onDelete':_0x3874('0x108'),'foreignKey':'mailboxuser','sourceKey':'mailbox'});db[_0x3874('0x21')][_0x3874('0x11a')](db[_0x3874('0x1f')],{'foreignKey':_0x3874('0x156'),'targetKey':'mailbox'});db[_0x3874('0x157')][_0x3874('0x10b')](db['VoiceQueueReport'],{'as':'QueueCalls','foreignKey':_0x3874('0x158'),'constraints':![]});db[_0x3874('0x157')][_0x3874('0x10b')](db[_0x3874('0x159')],{'as':_0x3874('0x15a'),'foreignKey':'uniqueid','constraints':![]});db[_0x3874('0x157')]['belongsTo'](db[_0x3874('0x12')],{'as':'User','foreignKey':_0x3874('0x109')});db['VoiceCallReport'][_0x3874('0x11a')](db[_0x3874('0x15b')],{'as':_0x3874('0x15c'),'foreignKey':_0x3874('0x15d')});db[_0x3874('0x35')][_0x3874('0x11a')](db[_0x3874('0x38')],{'as':_0x3874('0x38'),'foreignKey':_0x3874('0x15e')});db['MailServerOut'][_0x3874('0x11a')](db[_0x3874('0x38')],{'as':'MailAccount','foreignKey':'MailAccountId'});db[_0x3874('0x38')][_0x3874('0x107')](db[_0x3874('0x35')],{'as':_0x3874('0x15f'),'onDelete':_0x3874('0x108')});db[_0x3874('0x38')]['hasOne'](db['MailServerOut'],{'as':_0x3874('0x160'),'onDelete':'cascade'});db[_0x3874('0x38')][_0x3874('0x10b')](db[_0x3874('0x161')],{'as':_0x3874('0x162'),'foreignKey':'MailAccountId','onDelete':'cascade'});db[_0x3874('0x38')][_0x3874('0x10b')](db[_0x3874('0x76')],{'as':_0x3874('0x163'),'foreignKey':_0x3874('0x15e')});db['MailAccount'][_0x3874('0x10b')](db[_0x3874('0x164')],{'as':'Messages','foreignKey':_0x3874('0x15e')});db[_0x3874('0x38')][_0x3874('0x10b')](db['MailInteraction'],{'as':_0x3874('0x165')});db[_0x3874('0x38')][_0x3874('0x10b')](db[_0x3874('0x166')],{'as':'Applications'});db[_0x3874('0x38')][_0x3874('0x11a')](db['CmList'],{'as':'List','foreignKey':_0x3874('0x167')});db[_0x3874('0x38')][_0x3874('0x11a')](db['Template'],{'as':'Template','foreignKey':'TemplateId'});db[_0x3874('0x38')][_0x3874('0x11a')](db[_0x3874('0x7b')],{'as':'mandatoryDispositionPause','foreignKey':_0x3874('0x150')});db['MailAccount'][_0x3874('0x11b')](db['User'],{'as':_0x3874('0x152'),'through':_0x3874('0x138')});db[_0x3874('0x3a')][_0x3874('0x11b')](db['User'],{'as':'Agents','through':'UserMailQueue'});db[_0x3874('0x3a')][_0x3874('0x11b')](db[_0x3874('0xdc')],{'through':_0x3874('0x168'),'as':_0x3874('0x153')});db['MailInteraction'][_0x3874('0x10b')](db[_0x3874('0x164')],{'as':_0x3874('0x155'),'onDelete':'cascade','foreignKey':_0x3874('0x169')});db['MailInteraction'][_0x3874('0x11a')](db[_0x3874('0x38')],{'as':_0x3874('0x16a'),'foreignKey':_0x3874('0x15e')});db['MailInteraction'][_0x3874('0x11a')](db[_0x3874('0x15b')],{'as':_0x3874('0x15c'),'foreignKey':_0x3874('0x15d')});db['MailInteraction'][_0x3874('0x11a')](db['User'],{'as':'Owner','foreignKey':_0x3874('0x109')});db['MailInteraction'][_0x3874('0x11b')](db[_0x3874('0x83')],{'through':'mail_interaction_has_tags','as':'Tags'});db[_0x3874('0x3d')][_0x3874('0x11b')](db[_0x3874('0x83')],{'through':_0x3874('0x16b'),'as':_0x3874('0x16c')});db[_0x3874('0x3d')][_0x3874('0x11b')](db[_0x3874('0x12')],{'as':_0x3874('0x16d'),'through':'user_has_mail_interactions','foreignKey':'MailInteractionId'});db[_0x3874('0x164')][_0x3874('0x10b')](db[_0x3874('0xe2')],{'as':_0x3874('0x16e'),'onDelete':_0x3874('0x108')});db[_0x3874('0x164')][_0x3874('0x11a')](db[_0x3874('0x12')],{'as':'User'});db[_0x3874('0x164')][_0x3874('0x11a')](db[_0x3874('0x15b')],{'onDelete':_0x3874('0x108'),'as':_0x3874('0x15c')});db[_0x3874('0x164')][_0x3874('0x11a')](db[_0x3874('0x3d')],{'as':_0x3874('0x16f'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x3874('0x11a')](db['MailAccount'],{'as':_0x3874('0x16a'),'foreignKey':_0x3874('0x15e')});db[_0x3874('0x164')]['belongsTo'](db[_0x3874('0x5d')],{'as':_0x3874('0x5d'),'foreignKey':_0x3874('0x170')});db[_0x3874('0x164')][_0x3874('0x11a')](db[_0x3874('0x63')],{'as':'ChatOfflineMessage','foreignKey':'ChatOfflineMessageId'});db[_0x3874('0x166')][_0x3874('0x11a')](db[_0x3874('0x12')],{'onDelete':_0x3874('0x171')});db[_0x3874('0x166')][_0x3874('0x11a')](db['MailQueue'],{'onDelete':_0x3874('0x171')});db[_0x3874('0x166')][_0x3874('0x11a')](db[_0x3874('0x38')],{'onDelete':_0x3874('0x171')});db[_0x3874('0x166')][_0x3874('0x11a')](db[_0x3874('0x79')],{'onDelete':'restrict','foreignKey':_0x3874('0x14f')});db[_0x3874('0x166')][_0x3874('0x11a')](db[_0x3874('0x83')],{'onDelete':_0x3874('0x171'),'foreignKey':'TagId'});db[_0x3874('0x172')][_0x3874('0x11a')](db[_0x3874('0x38')],{});db[_0x3874('0x172')][_0x3874('0x11a')](db[_0x3874('0xee')],{'as':_0x3874('0x173'),'foreignKey':_0x3874('0x167')});db['MailQueueReport'][_0x3874('0x11a')](db['CmContact'],{'as':_0x3874('0x15c'),'foreignKey':'ContactId'});db[_0x3874('0x172')][_0x3874('0x11a')](db[_0x3874('0x3d')],{});db[_0x3874('0x172')]['belongsTo'](db[_0x3874('0x164')],{});db['MailQueueReport']['belongsTo'](db[_0x3874('0x12')],{});db[_0x3874('0x172')][_0x3874('0x11a')](db[_0x3874('0x3a')],{});db['Dashboard'][_0x3874('0x10b')](db[_0x3874('0x42')],{'as':_0x3874('0x174'),'onDelete':_0x3874('0x108')});db[_0x3874('0x135')][_0x3874('0x10b')](db['Disposition'],{'as':_0x3874('0x162'),'foreignKey':_0x3874('0x175'),'onDelete':_0x3874('0x108')});db['FaxAccount'][_0x3874('0x10b')](db[_0x3874('0x76')],{'as':_0x3874('0x163'),'foreignKey':_0x3874('0x175')});db[_0x3874('0x135')]['hasMany'](db[_0x3874('0x47')],{'as':_0x3874('0x165')});db[_0x3874('0x135')][_0x3874('0x10b')](db[_0x3874('0x45')],{'as':_0x3874('0x143')});db[_0x3874('0x135')][_0x3874('0x10b')](db['VoiceExtension'],{'as':_0x3874('0x176'),'onDelete':_0x3874('0x108')});db[_0x3874('0x135')][_0x3874('0x10b')](db['FaxMessage'],{'as':_0x3874('0x155')});db['FaxAccount']['belongsTo'](db['Trunk'],{'as':_0x3874('0x29')});db['FaxAccount'][_0x3874('0x11a')](db[_0x3874('0xee')],{'as':_0x3874('0x173'),'foreignKey':_0x3874('0x167')});db['FaxAccount'][_0x3874('0x11a')](db[_0x3874('0x7b')],{'as':_0x3874('0x177'),'foreignKey':_0x3874('0x150')});db[_0x3874('0x135')]['belongsToMany'](db[_0x3874('0x12')],{'as':_0x3874('0x152'),'through':_0x3874('0x137')});db['FaxApplication'][_0x3874('0x11a')](db[_0x3874('0x12')],{'onDelete':_0x3874('0x171')});db[_0x3874('0x45')][_0x3874('0x11a')](db[_0x3874('0x4b')],{'onDelete':_0x3874('0x171')});db['FaxApplication']['belongsTo'](db[_0x3874('0x135')],{'onDelete':'restrict'});db[_0x3874('0x45')][_0x3874('0x11a')](db[_0x3874('0x83')],{'onDelete':'restrict','foreignKey':_0x3874('0x178')});db[_0x3874('0x47')]['hasMany'](db[_0x3874('0x49')],{'as':'Messages','onDelete':_0x3874('0x108'),'foreignKey':_0x3874('0x179')});db[_0x3874('0x47')]['belongsTo'](db[_0x3874('0x135')],{'as':_0x3874('0x16a'),'foreignKey':_0x3874('0x175')});db[_0x3874('0x47')]['belongsTo'](db['CmContact'],{'as':_0x3874('0x15c'),'foreignKey':_0x3874('0x15d')});db['FaxInteraction'][_0x3874('0x11a')](db[_0x3874('0x12')],{'as':_0x3874('0x17a'),'foreignKey':_0x3874('0x109')});db[_0x3874('0x47')]['belongsToMany'](db[_0x3874('0x83')],{'through':'fax_interaction_has_tags','as':_0x3874('0x17b')});db[_0x3874('0x47')]['belongsToMany'](db[_0x3874('0x83')],{'through':_0x3874('0x17c'),'as':_0x3874('0x16c')});db[_0x3874('0x47')][_0x3874('0x11b')](db['User'],{'as':_0x3874('0x16d'),'through':_0x3874('0x121'),'foreignKey':_0x3874('0x179')});db[_0x3874('0x49')][_0x3874('0x11a')](db[_0x3874('0x12')],{'onDelete':_0x3874('0x108'),'as':_0x3874('0x12')});db[_0x3874('0x49')][_0x3874('0x11a')](db[_0x3874('0x47')],{'as':_0x3874('0x16f'),'foreignKey':_0x3874('0x179')});db['FaxMessage'][_0x3874('0x11a')](db['CmContact'],{'onDelete':_0x3874('0x108'),'as':_0x3874('0x15c')});db[_0x3874('0x49')][_0x3874('0x11a')](db['Attachment'],{'as':'Attachment','foreignKey':_0x3874('0x17d')});db[_0x3874('0x49')]['belongsTo'](db['FaxAccount'],{'as':_0x3874('0x16a'),'foreignKey':'FaxAccountId'});db[_0x3874('0x4b')][_0x3874('0x11b')](db[_0x3874('0x12')],{'as':_0x3874('0x152'),'through':'UserFaxQueue'});db[_0x3874('0x4b')][_0x3874('0x11b')](db[_0x3874('0xdc')],{'through':_0x3874('0x17e'),'as':'Teams'});db['FaxQueueReport']['belongsTo'](db[_0x3874('0x135')],{});db[_0x3874('0x4d')][_0x3874('0x11a')](db[_0x3874('0xee')],{'as':_0x3874('0x173'),'foreignKey':'ListId'});db['FaxQueueReport']['belongsTo'](db[_0x3874('0x15b')],{'as':_0x3874('0x15c'),'foreignKey':'ContactId'});db[_0x3874('0x4d')][_0x3874('0x11a')](db['FaxInteraction'],{});db[_0x3874('0x4d')]['belongsTo'](db[_0x3874('0x49')],{});db[_0x3874('0x4d')][_0x3874('0x11a')](db['User'],{});db[_0x3874('0x4d')][_0x3874('0x11a')](db[_0x3874('0x4b')],{});db[_0x3874('0x4f')][_0x3874('0x10b')](db[_0x3874('0x161')],{'as':_0x3874('0x162'),'foreignKey':'SmsAccountId','onDelete':_0x3874('0x108')});db['SmsAccount'][_0x3874('0x10b')](db[_0x3874('0x76')],{'as':_0x3874('0x163'),'foreignKey':_0x3874('0x17f')});db[_0x3874('0x4f')][_0x3874('0x10b')](db[_0x3874('0x54')],{'as':_0x3874('0x155'),'foreignKey':_0x3874('0x17f')});db[_0x3874('0x4f')][_0x3874('0x10b')](db[_0x3874('0x52')],{'as':'Interactions'});db[_0x3874('0x4f')][_0x3874('0x10b')](db['SmsApplication'],{'as':_0x3874('0x143')});db[_0x3874('0x4f')][_0x3874('0x11a')](db[_0x3874('0xee')],{'as':_0x3874('0x173'),'foreignKey':_0x3874('0x167')});db['SmsAccount'][_0x3874('0x11a')](db[_0x3874('0x7b')],{'as':'mandatoryDispositionPause','foreignKey':_0x3874('0x150')});db[_0x3874('0x4f')]['belongsToMany'](db[_0x3874('0x12')],{'as':'Agents','through':_0x3874('0x13c')});db[_0x3874('0x50')][_0x3874('0x11a')](db[_0x3874('0x12')],{'onDelete':'restrict'});db[_0x3874('0x50')][_0x3874('0x11a')](db[_0x3874('0x56')],{'onDelete':'restrict'});db[_0x3874('0x50')]['belongsTo'](db['SmsAccount'],{'onDelete':'restrict'});db[_0x3874('0x50')][_0x3874('0x11a')](db[_0x3874('0x79')],{'onDelete':_0x3874('0x171'),'foreignKey':'IntervalId'});db[_0x3874('0x50')]['belongsTo'](db[_0x3874('0x83')],{'onDelete':_0x3874('0x171'),'foreignKey':_0x3874('0x178')});db[_0x3874('0x52')][_0x3874('0x10b')](db[_0x3874('0x54')],{'as':_0x3874('0x155'),'onDelete':_0x3874('0x108'),'foreignKey':'SmsInteractionId'});db[_0x3874('0x52')][_0x3874('0x11a')](db[_0x3874('0x4f')],{'as':_0x3874('0x16a'),'foreignKey':_0x3874('0x17f')});db[_0x3874('0x52')][_0x3874('0x11a')](db[_0x3874('0x15b')],{'as':'Contact','foreignKey':'ContactId'});db['SmsInteraction'][_0x3874('0x11a')](db[_0x3874('0x12')],{'as':_0x3874('0x17a'),'foreignKey':_0x3874('0x109')});db[_0x3874('0x52')][_0x3874('0x11b')](db[_0x3874('0x83')],{'through':'sms_interaction_has_tags','as':_0x3874('0x17b')});db[_0x3874('0x52')][_0x3874('0x11b')](db[_0x3874('0x83')],{'through':_0x3874('0x180'),'as':_0x3874('0x16c')});db[_0x3874('0x52')][_0x3874('0x11b')](db[_0x3874('0x12')],{'as':_0x3874('0x16d'),'through':_0x3874('0x122'),'foreignKey':'SmsInteractionId'});db[_0x3874('0x54')][_0x3874('0x11a')](db[_0x3874('0x12')],{'as':_0x3874('0x12')});db[_0x3874('0x54')][_0x3874('0x11a')](db[_0x3874('0x15b')],{'onDelete':'cascade','as':_0x3874('0x15c')});db[_0x3874('0x54')]['belongsTo'](db[_0x3874('0x52')],{'onDelete':_0x3874('0x108'),'as':_0x3874('0x16f'),'foreignKey':_0x3874('0x181')});db['SmsMessage']['belongsTo'](db[_0x3874('0x4f')],{'as':_0x3874('0x16a'),'foreignKey':_0x3874('0x17f')});db[_0x3874('0x56')][_0x3874('0x11b')](db[_0x3874('0x12')],{'as':_0x3874('0x152'),'through':_0x3874('0x32'),'foreignKey':'SmsQueueId'});db[_0x3874('0x56')][_0x3874('0x11b')](db[_0x3874('0xdc')],{'through':_0x3874('0x182'),'as':_0x3874('0x153')});db['OpenchannelAccount'][_0x3874('0x10b')](db['Disposition'],{'as':_0x3874('0x162'),'foreignKey':'OpenchannelAccountId','onDelete':_0x3874('0x108')});db[_0x3874('0x139')][_0x3874('0x10b')](db['CannedAnswer'],{'as':_0x3874('0x163'),'foreignKey':_0x3874('0x183')});db['OpenchannelAccount'][_0x3874('0x10b')](db[_0x3874('0x5a')],{'as':_0x3874('0x165'),'foreignKey':_0x3874('0x183')});db['OpenchannelAccount'][_0x3874('0x10b')](db[_0x3874('0x184')],{'as':_0x3874('0x155'),'foreignKey':_0x3874('0x183')});db[_0x3874('0x139')][_0x3874('0x10b')](db['OpenchannelApplication'],{'as':'Applications','foreignKey':_0x3874('0x183')});db[_0x3874('0x139')]['belongsTo'](db[_0x3874('0xee')],{'as':_0x3874('0x173'),'foreignKey':_0x3874('0x167')});db['OpenchannelAccount'][_0x3874('0x11a')](db['Pause'],{'as':_0x3874('0x177'),'foreignKey':_0x3874('0x150')});db[_0x3874('0x139')]['belongsToMany'](db[_0x3874('0x12')],{'as':'Agents','through':_0x3874('0x13b')});db[_0x3874('0x185')][_0x3874('0x11a')](db[_0x3874('0x12')],{'onDelete':_0x3874('0x171')});db[_0x3874('0x185')][_0x3874('0x11a')](db[_0x3874('0x12e')],{'onDelete':_0x3874('0x171'),'foreignKey':'OpenchannelQueueId'});db[_0x3874('0x185')][_0x3874('0x11a')](db['OpenchannelAccount'],{'onDelete':_0x3874('0x171'),'foreignKey':_0x3874('0x183')});db[_0x3874('0x185')][_0x3874('0x11a')](db[_0x3874('0x79')],{'onDelete':_0x3874('0x171'),'foreignKey':_0x3874('0x14f')});db['OpenchannelApplication'][_0x3874('0x11a')](db[_0x3874('0x83')],{'onDelete':'restrict','foreignKey':_0x3874('0x178')});db[_0x3874('0x5a')][_0x3874('0x10b')](db['OpenchannelMessage'],{'as':_0x3874('0x155'),'onDelete':'cascade','foreignKey':_0x3874('0x186')});db['OpenchannelInteraction'][_0x3874('0x11a')](db[_0x3874('0x139')],{'as':_0x3874('0x16a'),'foreignKey':_0x3874('0x183')});db[_0x3874('0x5a')][_0x3874('0x11a')](db['CmContact'],{'as':_0x3874('0x15c'),'foreignKey':_0x3874('0x15d')});db['OpenchannelInteraction'][_0x3874('0x11a')](db[_0x3874('0x12')],{'as':_0x3874('0x17a'),'foreignKey':_0x3874('0x109')});db[_0x3874('0x5a')][_0x3874('0x11b')](db[_0x3874('0x83')],{'through':_0x3874('0x187'),'as':_0x3874('0x17b')});db[_0x3874('0x5a')][_0x3874('0x11b')](db[_0x3874('0x83')],{'through':_0x3874('0x187'),'as':'ThroughTags'});db[_0x3874('0x5a')]['belongsToMany'](db['User'],{'as':_0x3874('0x16d'),'through':_0x3874('0x123'),'foreignKey':_0x3874('0x186')});db[_0x3874('0x184')][_0x3874('0x11a')](db[_0x3874('0x12')],{'onDelete':'cascade','as':_0x3874('0x12')});db[_0x3874('0x184')][_0x3874('0x11a')](db[_0x3874('0x15b')],{'onDelete':_0x3874('0x108'),'as':_0x3874('0x15c')});db['OpenchannelMessage']['belongsTo'](db[_0x3874('0x5a')],{'onDelete':_0x3874('0x108'),'as':_0x3874('0x16f'),'foreignKey':'OpenchannelInteractionId'});db[_0x3874('0x184')]['belongsTo'](db[_0x3874('0xe2')],{'as':_0x3874('0xe2'),'foreignKey':_0x3874('0x17d')});db[_0x3874('0x184')]['belongsTo'](db[_0x3874('0x139')],{'as':_0x3874('0x16a'),'foreignKey':'OpenchannelAccountId'});db[_0x3874('0x12e')][_0x3874('0x11b')](db['User'],{'as':'Agents','through':_0x3874('0x188'),'foreignKey':_0x3874('0x189')});db[_0x3874('0x12e')]['belongsToMany'](db['Team'],{'through':_0x3874('0x18a'),'as':_0x3874('0x153')});db['ChatWebsite'][_0x3874('0x10b')](db[_0x3874('0x161')],{'as':'Dispositions','foreignKey':'ChatWebsiteId','onDelete':_0x3874('0x108')});db['ChatWebsite'][_0x3874('0x10b')](db[_0x3874('0x76')],{'as':_0x3874('0x163'),'foreignKey':'ChatWebsiteId'});db['ChatWebsite'][_0x3874('0x10b')](db[_0x3874('0x67')],{'as':_0x3874('0x18b')});db['ChatWebsite']['hasMany'](db['ChatInteraction'],{'as':_0x3874('0x165')});db[_0x3874('0x5d')][_0x3874('0x10b')](db['ChatApplication'],{'as':_0x3874('0x143')});db[_0x3874('0x5d')][_0x3874('0x10b')](db[_0x3874('0x61')],{'as':_0x3874('0x155')});db[_0x3874('0x5d')]['belongsTo'](db['CmList'],{'as':_0x3874('0x173'),'foreignKey':_0x3874('0x167')});db[_0x3874('0x5d')][_0x3874('0x11a')](db['Interval'],{'as':_0x3874('0x79'),'foreignKey':_0x3874('0x14f')});db[_0x3874('0x5d')]['belongsTo'](db['MailAccount'],{'as':_0x3874('0x38'),'foreignKey':_0x3874('0x15e')});db[_0x3874('0x5d')][_0x3874('0x11a')](db[_0x3874('0x7b')],{'as':_0x3874('0x177'),'foreignKey':_0x3874('0x150')});db[_0x3874('0x5d')][_0x3874('0x11b')](db[_0x3874('0x12')],{'as':_0x3874('0x152'),'through':_0x3874('0x134')});db['OpenchannelQueueReport'][_0x3874('0x11a')](db[_0x3874('0x139')],{});db['OpenchannelQueueReport'][_0x3874('0x11a')](db[_0x3874('0xee')],{'as':_0x3874('0x173'),'foreignKey':'ListId'});db[_0x3874('0x5e')][_0x3874('0x11a')](db[_0x3874('0x15b')],{'as':'Contact','foreignKey':_0x3874('0x15d')});db['OpenchannelQueueReport'][_0x3874('0x11a')](db[_0x3874('0x5a')],{});db['OpenchannelQueueReport'][_0x3874('0x11a')](db['OpenchannelMessage'],{});db['OpenchannelQueueReport'][_0x3874('0x11a')](db[_0x3874('0x12')],{});db[_0x3874('0x5e')][_0x3874('0x11a')](db[_0x3874('0x12e')],{});db['ChatApplication'][_0x3874('0x11a')](db[_0x3874('0x12')],{'as':_0x3874('0x18c'),'foreignKey':_0x3874('0x109'),'onDelete':_0x3874('0x171')});db[_0x3874('0x18d')]['belongsTo'](db[_0x3874('0x129')],{'as':'Queue','foreignKey':'ChatQueueId','onDelete':_0x3874('0x171')});db['ChatApplication'][_0x3874('0x11a')](db['ChatWebsite'],{'as':'Website','foreignKey':_0x3874('0x170'),'onDelete':_0x3874('0x171')});db['ChatApplication'][_0x3874('0x11a')](db[_0x3874('0x83')],{'onDelete':_0x3874('0x171'),'foreignKey':_0x3874('0x178')});db[_0x3874('0x60')][_0x3874('0x10b')](db[_0x3874('0x61')],{'as':_0x3874('0x155'),'onDelete':_0x3874('0x108'),'foreignKey':_0x3874('0x18e')});db[_0x3874('0x60')][_0x3874('0x11a')](db[_0x3874('0x5d')],{'as':'Account','foreignKey':_0x3874('0x170')});db[_0x3874('0x60')][_0x3874('0x11a')](db[_0x3874('0x15b')],{'as':'Contact','foreignKey':_0x3874('0x15d')});db[_0x3874('0x60')][_0x3874('0x11a')](db[_0x3874('0x12')],{'as':_0x3874('0x17a'),'foreignKey':_0x3874('0x109')});db['ChatInteraction'][_0x3874('0x11b')](db[_0x3874('0x83')],{'through':_0x3874('0x18f'),'as':_0x3874('0x17b')});db[_0x3874('0x60')][_0x3874('0x11b')](db[_0x3874('0x83')],{'through':_0x3874('0x18f'),'as':_0x3874('0x16c')});db[_0x3874('0x60')][_0x3874('0x11b')](db[_0x3874('0x12')],{'as':_0x3874('0x16d'),'through':_0x3874('0x120'),'foreignKey':'ChatInteractionId'});db['ChatMessage'][_0x3874('0x11a')](db[_0x3874('0x12')],{'onDelete':_0x3874('0x108'),'as':_0x3874('0x12')});db[_0x3874('0x61')][_0x3874('0x11a')](db[_0x3874('0x15b')],{'onDelete':'cascade','as':_0x3874('0x15c'),'foreignKey':_0x3874('0x15d')});db[_0x3874('0x61')][_0x3874('0x11a')](db[_0x3874('0x60')],{'onDelete':_0x3874('0x108'),'as':'Interaction','foreignKey':_0x3874('0x18e')});db[_0x3874('0x61')][_0x3874('0x11a')](db[_0x3874('0xe2')],{'as':_0x3874('0xe2'),'foreignKey':_0x3874('0x17d')});db[_0x3874('0x61')]['belongsTo'](db['ChatWebsite'],{'as':'Account','foreignKey':_0x3874('0x170')});db[_0x3874('0x63')][_0x3874('0x10b')](db['Attachment'],{'as':_0x3874('0x16e'),'foreignKey':_0x3874('0x190'),'onDelete':'cascade','hooks':!![]});db[_0x3874('0x63')][_0x3874('0x11a')](db['CmContact'],{'onDelete':'cascade','as':'Contact','foreignKey':_0x3874('0x15d')});db[_0x3874('0x63')]['belongsTo'](db[_0x3874('0x5d')],{'as':_0x3874('0x16a'),'foreignKey':'ChatWebsiteId'});db['ChatQueue']['belongsToMany'](db[_0x3874('0x12')],{'as':_0x3874('0x152'),'through':_0x3874('0x12b'),'hooks':!![]});db[_0x3874('0x129')]['belongsToMany'](db[_0x3874('0xdc')],{'through':'team_has_chat_queues','as':_0x3874('0x153')});db[_0x3874('0x66')][_0x3874('0x10b')](db['ChatInternalMessage'],{'as':_0x3874('0x155'),'foreignKey':_0x3874('0x191'),'onDelete':_0x3874('0x108')});db[_0x3874('0x66')][_0x3874('0x11b')](db[_0x3874('0x12')],{'as':_0x3874('0x147'),'through':'chat_group_has_users'});db[_0x3874('0x67')][_0x3874('0x11a')](db[_0x3874('0x5d')],{'as':_0x3874('0x192'),'foreignKey':'ChatWebsiteId'});db[_0x3874('0x69')][_0x3874('0x10b')](db[_0x3874('0x15b')],{'as':_0x3874('0x193'),'foreignKey':_0x3874('0x194')});db[_0x3874('0x15b')][_0x3874('0x10b')](db[_0x3874('0x6b')],{'as':_0x3874('0x149'),'foreignKey':'ContactId'});db['CmContact'][_0x3874('0x10b')](db[_0x3874('0x10e')],{'as':_0x3874('0x10f'),'foreignKey':_0x3874('0x15d')});db['CmContact']['hasMany'](db[_0x3874('0x110')],{'as':'HopperHistories','foreignKey':'ContactId'});db[_0x3874('0x15b')][_0x3874('0x10b')](db[_0x3874('0x112')],{'as':_0x3874('0x112'),'foreignKey':_0x3874('0x15d')});db['CmContact'][_0x3874('0x10b')](db['JscriptySessionReport'],{'as':_0x3874('0x14b'),'foreignKey':_0x3874('0x15d')});db['CmContact'][_0x3874('0x10b')](db[_0x3874('0x5a')],{'as':_0x3874('0x113'),'foreignKey':_0x3874('0x15d'),'onDelete':_0x3874('0x171')});db['CmContact'][_0x3874('0x10b')](db[_0x3874('0x60')],{'as':'ChatInteractions','foreignKey':_0x3874('0x15d'),'onDelete':_0x3874('0x171')});db[_0x3874('0x15b')][_0x3874('0x10b')](db[_0x3874('0x52')],{'as':_0x3874('0x115'),'foreignKey':_0x3874('0x15d'),'onDelete':'restrict'});db[_0x3874('0x15b')][_0x3874('0x10b')](db[_0x3874('0x47')],{'as':'FaxInteractions','foreignKey':_0x3874('0x15d'),'onDelete':_0x3874('0x171')});db[_0x3874('0x15b')][_0x3874('0x10b')](db[_0x3874('0x3d')],{'as':'MailInteractions','foreignKey':_0x3874('0x15d'),'onDelete':_0x3874('0x171')});db[_0x3874('0x15b')][_0x3874('0x11a')](db['CmCompany'],{'as':_0x3874('0x195'),'foreignKey':'CompanyId'});db['CmContact']['belongsTo'](db[_0x3874('0xee')],{'as':'List','foreignKey':'ListId','onDelete':_0x3874('0x108')});db[_0x3874('0x15b')]['belongsToMany'](db['User'],{'as':_0x3874('0x16d'),'through':'cm_user_has_contacts'});db[_0x3874('0x15b')][_0x3874('0x11b')](db[_0x3874('0x83')],{'as':'Tags','through':_0x3874('0x196')});db[_0x3874('0x15b')][_0x3874('0x11b')](db['Tag'],{'through':_0x3874('0x196'),'as':'ThroughTags'});db[_0x3874('0x6b')]['belongsTo'](db[_0x3874('0x15b')],{'as':'Contact','foreignKey':'ContactId','onDelete':_0x3874('0x108')});db[_0x3874('0x6b')]['belongsTo'](db['CmList'],{'as':_0x3874('0x173'),'foreignKey':_0x3874('0x167'),'onDelete':_0x3874('0x108')});db[_0x3874('0x6b')][_0x3874('0x11a')](db[_0x3874('0x12')],{'as':'Agent','foreignKey':'UserId'});db[_0x3874('0x6b')][_0x3874('0x11a')](db[_0x3874('0x125')],{'as':_0x3874('0x197'),'foreignKey':_0x3874('0x148'),'onDelete':_0x3874('0x108')});db[_0x3874('0x6b')][_0x3874('0x11a')](db['Campaign'],{'as':_0x3874('0x198'),'foreignKey':_0x3874('0x199'),'onDelete':'cascade'});db['CmHopper']['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x3874('0x19a')});db[_0x3874('0x6d')][_0x3874('0x11a')](db['CmContact'],{'as':_0x3874('0x15c'),'foreignKey':'ContactId','onDelete':'cascade'});db['CmHopperBlack'][_0x3874('0x11a')](db[_0x3874('0xee')],{'as':_0x3874('0x173'),'foreignKey':_0x3874('0x167'),'onDelete':_0x3874('0x108')});db[_0x3874('0x6d')]['belongsTo'](db[_0x3874('0x125')],{'as':_0x3874('0x197'),'foreignKey':_0x3874('0x148'),'onDelete':_0x3874('0x108')});db['CmHopperBlack']['belongsTo'](db[_0x3874('0x198')],{'as':_0x3874('0x198'),'foreignKey':'CampaignId','onDelete':_0x3874('0x108')});db[_0x3874('0x74')][_0x3874('0x10b')](db['Condition'],{'as':{'plural':'All','singular':_0x3874('0x19b')},'foreignKey':_0x3874('0x19c'),'onDelete':'cascade','hooks':!![]});db[_0x3874('0x74')][_0x3874('0x10b')](db['Condition'],{'as':{'plural':'Any','singular':_0x3874('0x19d')},'foreignKey':_0x3874('0x19e'),'onDelete':_0x3874('0x108'),'hooks':!![]});db[_0x3874('0x74')][_0x3874('0x10b')](db[_0x3874('0x72')],{'as':_0x3874('0x19f'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x3874('0x161')][_0x3874('0x10b')](db[_0x3874('0x161')],{'as':'Dispositions','foreignKey':'ParentId','onDelete':'cascade'});db['Interval'][_0x3874('0x10b')](db[_0x3874('0x79')],{'as':'Intervals','foreignKey':_0x3874('0x14f'),'onDelete':_0x3874('0x108'),'hooks':!![],'required':![]});db['Interval'][_0x3874('0x10b')](db[_0x3874('0x18')],{'as':_0x3874('0x10d'),'foreignKey':_0x3874('0x14f'),'onDelete':_0x3874('0x171')});db[_0x3874('0x79')][_0x3874('0x10b')](db['MailApplication'],{'as':_0x3874('0x1a0'),'foreignKey':'IntervalId'});db[_0x3874('0x79')][_0x3874('0x10b')](db[_0x3874('0x18d')],{'as':_0x3874('0x1a1'),'foreignKey':_0x3874('0x14f')});db[_0x3874('0x79')][_0x3874('0x10b')](db['FaxApplication'],{'as':_0x3874('0x1a2'),'foreignKey':_0x3874('0x14f')});db[_0x3874('0x79')][_0x3874('0x10b')](db[_0x3874('0x50')],{'as':'SmsApplications','foreignKey':'IntervalId'});db['Schedule'][_0x3874('0x11a')](db[_0x3874('0x38')],{});db['Schedule'][_0x3874('0x11a')](db['AnalyticDefaultReport'],{'foreignKey':'DefaultReportId'});db[_0x3874('0x80')][_0x3874('0x11a')](db['AnalyticCustomReport'],{'foreignKey':_0x3874('0x1a3')});db[_0x3874('0x82')][_0x3874('0x11b')](db[_0x3874('0x1a')],{'as':_0x3874('0x1a4'),'through':_0x3874('0x145'),'onDelete':_0x3874('0x171')});db[_0x3874('0x83')][_0x3874('0x11b')](db[_0x3874('0x15b')],{'through':'cm_contact_has_tags'});db[_0x3874('0x83')][_0x3874('0x11b')](db[_0x3874('0x60')],{'through':'chat_interaction_has_tags'});db['Tag'][_0x3874('0x11b')](db[_0x3874('0x3d')],{'through':'mail_interaction_has_tags'});db[_0x3874('0x83')][_0x3874('0x11b')](db[_0x3874('0x52')],{'through':_0x3874('0x180')});db[_0x3874('0x83')]['belongsToMany'](db[_0x3874('0x47')],{'through':_0x3874('0x17c')});db[_0x3874('0x83')][_0x3874('0x11b')](db[_0x3874('0x5a')],{'through':'openchannel_interaction_has_tags'});db[_0x3874('0x83')]['belongsToMany'](db['WhatsappInteraction'],{'through':'whatsapp_interaction_has_tags'});db[_0x3874('0x87')][_0x3874('0x10b')](db[_0x3874('0x77')],{'as':{'plural':_0x3874('0x1a5'),'singular':_0x3874('0x1a6')},'foreignKey':_0x3874('0x1a7'),'onDelete':'cascade','hooks':!![]});db[_0x3874('0x87')][_0x3874('0x10b')](db[_0x3874('0x77')],{'as':{'plural':_0x3874('0x1a8'),'singular':_0x3874('0x1a9')},'foreignKey':'TriggerAnyId','onDelete':_0x3874('0x108'),'hooks':!![]});db['Trigger'][_0x3874('0x10b')](db[_0x3874('0x72')],{'as':_0x3874('0x19f'),'foreignKey':_0x3874('0x1aa'),'onDelete':'cascade','hooks':!![]});db[_0x3874('0x1ab')]['hasMany'](db[_0x3874('0x92')],{'as':_0x3874('0x1ac'),'onDelete':'cascade','foreignKey':'CustomReportId','hooks':!![]});db[_0x3874('0x1ad')][_0x3874('0x10b')](db[_0x3874('0x92')],{'as':_0x3874('0x1ac'),'onDelete':_0x3874('0x108'),'foreignKey':_0x3874('0x1ae')});db['AnalyticMetric'][_0x3874('0x10b')](db['AnalyticFieldReport'],{'as':_0x3874('0x1ac'),'onDelete':_0x3874('0x108'),'foreignKey':_0x3874('0x1af')});db[_0x3874('0x92')][_0x3874('0x11a')](db[_0x3874('0x91')],{'foreignKey':_0x3874('0x1af')});db[_0x3874('0x95')]['hasMany'](db[_0x3874('0x97')],{'as':_0x3874('0x1b0'),'onDelete':_0x3874('0x108'),'foreignKey':_0x3874('0x1b1')});db['SalesforceConfiguration'][_0x3874('0x10b')](db[_0x3874('0x99')],{'as':_0x3874('0x1b2'),'onDelete':'cascade','foreignKey':_0x3874('0x1b3')});db[_0x3874('0x97')][_0x3874('0x10b')](db['SalesforceField'],{'as':_0x3874('0x1b4'),'onDelete':_0x3874('0x108'),'foreignKey':_0x3874('0x1b5')});db[_0x3874('0x97')]['hasMany'](db[_0x3874('0x99')],{'as':_0x3874('0x1ac'),'onDelete':_0x3874('0x108'),'foreignKey':_0x3874('0x1b6')});db['SalesforceConfiguration'][_0x3874('0x11a')](db['SalesforceAccount'],{'as':_0x3874('0x16a'),'foreignKey':_0x3874('0x1b1')});db[_0x3874('0x99')]['hasMany'](db[_0x3874('0x99')],{'as':_0x3874('0x1b7'),'foreignKey':_0x3874('0x1b3')});db[_0x3874('0x99')]['hasMany'](db[_0x3874('0x99')],{'as':_0x3874('0x1b8'),'foreignKey':'DescriptionId'});db[_0x3874('0x99')][_0x3874('0x10b')](db['SalesforceField'],{'as':'Field','foreignKey':_0x3874('0x1b6')});db[_0x3874('0x99')][_0x3874('0x11a')](db[_0x3874('0x89')],{'as':_0x3874('0x89'),'foreignKey':'VariableId'});db['SugarcrmAccount'][_0x3874('0x10b')](db[_0x3874('0x9d')],{'as':_0x3874('0x1b0'),'onDelete':_0x3874('0x108'),'foreignKey':_0x3874('0x1b1')});db[_0x3874('0x9d')][_0x3874('0x10b')](db['SugarcrmField'],{'as':_0x3874('0x1b2'),'onDelete':'cascade','foreignKey':_0x3874('0x1b3')});db[_0x3874('0x9d')][_0x3874('0x10b')](db[_0x3874('0x9f')],{'as':_0x3874('0x1b4'),'onDelete':'cascade','foreignKey':_0x3874('0x1b5')});db[_0x3874('0x9d')][_0x3874('0x10b')](db[_0x3874('0x9f')],{'as':_0x3874('0x1ac'),'onDelete':_0x3874('0x108'),'foreignKey':'FieldId'});db[_0x3874('0x9d')][_0x3874('0x11a')](db[_0x3874('0x9b')],{'as':_0x3874('0x16a'),'foreignKey':_0x3874('0x1b1')});db[_0x3874('0x9f')]['hasMany'](db[_0x3874('0x9f')],{'as':'Subject','foreignKey':_0x3874('0x1b3')});db['SugarcrmField']['hasMany'](db[_0x3874('0x9f')],{'as':'Description','foreignKey':_0x3874('0x1b5')});db['SugarcrmField']['hasMany'](db[_0x3874('0x9f')],{'as':_0x3874('0x1b9'),'foreignKey':'FieldId'});db[_0x3874('0x9f')][_0x3874('0x11a')](db[_0x3874('0x89')],{'as':_0x3874('0x89'),'foreignKey':_0x3874('0x1ba')});db['DeskAccount'][_0x3874('0x10b')](db[_0x3874('0xa2')],{'as':_0x3874('0x1b0'),'onDelete':_0x3874('0x108'),'foreignKey':_0x3874('0x1b1')});db['DeskConfiguration'][_0x3874('0x10b')](db[_0x3874('0xa4')],{'as':_0x3874('0x1b2'),'onDelete':'cascade','foreignKey':_0x3874('0x1b3')});db['DeskConfiguration'][_0x3874('0x10b')](db['DeskField'],{'as':_0x3874('0x1b4'),'onDelete':_0x3874('0x108'),'foreignKey':_0x3874('0x1b5')});db[_0x3874('0xa2')][_0x3874('0x10b')](db[_0x3874('0xa4')],{'as':_0x3874('0x1ac'),'onDelete':_0x3874('0x108'),'foreignKey':_0x3874('0x1b6')});db[_0x3874('0xa2')][_0x3874('0x11a')](db[_0x3874('0x1bb')],{'as':'Account','foreignKey':_0x3874('0x1b1')});db[_0x3874('0xa2')][_0x3874('0x11b')](db[_0x3874('0x83')],{'through':_0x3874('0x1bc')});db[_0x3874('0xa4')][_0x3874('0x10b')](db[_0x3874('0xa4')],{'as':_0x3874('0x1b7'),'foreignKey':_0x3874('0x1b3')});db[_0x3874('0xa4')][_0x3874('0x10b')](db[_0x3874('0xa4')],{'as':_0x3874('0x1b8'),'foreignKey':_0x3874('0x1b5')});db[_0x3874('0xa4')][_0x3874('0x10b')](db['DeskField'],{'as':_0x3874('0x1b9'),'foreignKey':_0x3874('0x1b6')});db[_0x3874('0xa4')][_0x3874('0x11a')](db[_0x3874('0x89')],{'as':_0x3874('0x89'),'foreignKey':'VariableId'});db[_0x3874('0xa5')]['hasMany'](db[_0x3874('0xa7')],{'as':_0x3874('0x1b0'),'onDelete':_0x3874('0x108'),'foreignKey':_0x3874('0x1b1')});db[_0x3874('0xa7')][_0x3874('0x10b')](db['ZohoField'],{'as':_0x3874('0x1b2'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x3874('0xa7')][_0x3874('0x10b')](db['ZohoField'],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x3874('0x1b5')});db[_0x3874('0xa7')][_0x3874('0x10b')](db[_0x3874('0xa9')],{'as':_0x3874('0x1ac'),'onDelete':_0x3874('0x108'),'foreignKey':_0x3874('0x1b6')});db[_0x3874('0xa7')][_0x3874('0x11a')](db[_0x3874('0xa5')],{'as':_0x3874('0x16a'),'foreignKey':'AccountId'});db[_0x3874('0xa9')][_0x3874('0x10b')](db[_0x3874('0xa9')],{'as':_0x3874('0x1b7'),'foreignKey':_0x3874('0x1b3')});db['ZohoField'][_0x3874('0x10b')](db[_0x3874('0xa9')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x3874('0xa9')]['hasMany'](db[_0x3874('0xa9')],{'as':_0x3874('0x1b9'),'foreignKey':_0x3874('0x1b6')});db['ZohoField']['belongsTo'](db[_0x3874('0x89')],{'as':_0x3874('0x89'),'foreignKey':_0x3874('0x1ba')});db[_0x3874('0xab')][_0x3874('0x10b')](db[_0x3874('0xad')],{'as':_0x3874('0x1b0'),'onDelete':'cascade','foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x3874('0x10b')](db['ZendeskField'],{'as':_0x3874('0x1b2'),'foreignKey':'SubjectId'});db['ZendeskConfiguration'][_0x3874('0x10b')](db[_0x3874('0xae')],{'as':_0x3874('0x1b4'),'foreignKey':'DescriptionId'});db[_0x3874('0xad')]['hasMany'](db['ZendeskField'],{'as':_0x3874('0x1ac'),'foreignKey':_0x3874('0x1b6')});db['ZendeskConfiguration'][_0x3874('0x11a')](db['ZendeskAccount'],{'as':_0x3874('0x16a'),'foreignKey':_0x3874('0x1b1')});db[_0x3874('0xad')][_0x3874('0x11b')](db[_0x3874('0x83')],{'through':_0x3874('0x1bd')});db['ZendeskField'][_0x3874('0x10b')](db[_0x3874('0xae')],{'as':_0x3874('0x1b7'),'foreignKey':_0x3874('0x1b3')});db['ZendeskField'][_0x3874('0x10b')](db['ZendeskField'],{'as':_0x3874('0x1b8'),'foreignKey':_0x3874('0x1b5')});db['ZendeskField']['hasMany'](db[_0x3874('0xae')],{'as':_0x3874('0x1b9'),'foreignKey':_0x3874('0x1b6')});db[_0x3874('0xae')][_0x3874('0x11a')](db[_0x3874('0x89')],{'as':'Variable','foreignKey':'VariableId'});db[_0x3874('0x1be')][_0x3874('0x10b')](db[_0x3874('0xb0')],{'as':_0x3874('0x1b0'),'onDelete':'cascade','foreignKey':_0x3874('0x1b1')});db[_0x3874('0xb0')][_0x3874('0x10b')](db[_0x3874('0xb2')],{'as':'Subjects','onDelete':_0x3874('0x108'),'foreignKey':'SubjectId'});db[_0x3874('0xb0')][_0x3874('0x10b')](db[_0x3874('0xb2')],{'as':_0x3874('0x1b4'),'onDelete':_0x3874('0x108'),'foreignKey':_0x3874('0x1b5')});db[_0x3874('0xb0')][_0x3874('0x10b')](db[_0x3874('0xb2')],{'as':_0x3874('0x1ac'),'onDelete':_0x3874('0x108'),'foreignKey':_0x3874('0x1b6')});db[_0x3874('0xb0')][_0x3874('0x11a')](db[_0x3874('0x1be')],{'as':'Account','foreignKey':_0x3874('0x1b1')});db[_0x3874('0xb0')]['belongsToMany'](db[_0x3874('0x83')],{'through':_0x3874('0x1bf')});db['FreshdeskField'][_0x3874('0x10b')](db[_0x3874('0xb2')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x3874('0xb2')][_0x3874('0x10b')](db['FreshdeskField'],{'as':_0x3874('0x1b8'),'foreignKey':_0x3874('0x1b5')});db['FreshdeskField'][_0x3874('0x10b')](db[_0x3874('0xb2')],{'as':_0x3874('0x1b9'),'foreignKey':_0x3874('0x1b6')});db[_0x3874('0xb2')][_0x3874('0x11a')](db['Variable'],{'as':_0x3874('0x89'),'foreignKey':_0x3874('0x1ba')});db[_0x3874('0x1c0')]['hasMany'](db[_0x3874('0xb5')],{'as':_0x3874('0x1b0'),'onDelete':_0x3874('0x108'),'foreignKey':_0x3874('0x1b1')});db[_0x3874('0xb5')][_0x3874('0x10b')](db[_0x3874('0xb7')],{'as':_0x3874('0x1b2'),'foreignKey':_0x3874('0x1b3')});db[_0x3874('0xb5')][_0x3874('0x10b')](db['VtigerField'],{'as':'Descriptions','foreignKey':_0x3874('0x1b5')});db[_0x3874('0xb5')][_0x3874('0x10b')](db['VtigerField'],{'as':_0x3874('0x1ac'),'foreignKey':_0x3874('0x1b6')});db[_0x3874('0xb5')]['belongsTo'](db[_0x3874('0x1c0')],{'as':_0x3874('0x16a'),'foreignKey':_0x3874('0x1b1')});db[_0x3874('0xb7')]['hasMany'](db[_0x3874('0xb7')],{'as':_0x3874('0x1b7'),'foreignKey':'SubjectId'});db[_0x3874('0xb7')][_0x3874('0x10b')](db[_0x3874('0xb7')],{'as':_0x3874('0x1b8'),'foreignKey':_0x3874('0x1b5')});db[_0x3874('0xb7')][_0x3874('0x10b')](db[_0x3874('0xb7')],{'as':_0x3874('0x1b9'),'foreignKey':_0x3874('0x1b6')});db[_0x3874('0xb7')][_0x3874('0x11a')](db[_0x3874('0x89')],{'as':_0x3874('0x89'),'foreignKey':_0x3874('0x1ba')});db[_0x3874('0x1c1')][_0x3874('0x10b')](db[_0x3874('0xba')],{'as':_0x3874('0x1b0'),'onDelete':_0x3874('0x108'),'foreignKey':'AccountId'});db[_0x3874('0xba')][_0x3874('0x10b')](db[_0x3874('0xbc')],{'as':_0x3874('0x1b2'),'foreignKey':'SubjectId'});db[_0x3874('0xba')][_0x3874('0x10b')](db[_0x3874('0xbc')],{'as':_0x3874('0x1b4'),'foreignKey':_0x3874('0x1b5')});db[_0x3874('0xba')][_0x3874('0x10b')](db[_0x3874('0xbc')],{'as':_0x3874('0x1ac'),'foreignKey':_0x3874('0x1b6')});db[_0x3874('0xba')][_0x3874('0x11a')](db['ServicenowAccount'],{'as':_0x3874('0x16a'),'foreignKey':_0x3874('0x1b1')});db[_0x3874('0xbc')]['hasMany'](db[_0x3874('0xbc')],{'as':_0x3874('0x1b7'),'foreignKey':_0x3874('0x1b3')});db['ServicenowField'][_0x3874('0x10b')](db[_0x3874('0xbc')],{'as':'Description','foreignKey':'DescriptionId'});db['ServicenowField'][_0x3874('0x10b')](db['ServicenowField'],{'as':_0x3874('0x1b9'),'foreignKey':'FieldId'});db[_0x3874('0xbc')][_0x3874('0x11a')](db[_0x3874('0x89')],{'as':_0x3874('0x89'),'foreignKey':'VariableId'});db['Dynamics365Account']['hasMany'](db[_0x3874('0xbf')],{'as':'Configurations','onDelete':_0x3874('0x108'),'foreignKey':_0x3874('0x1b1')});db[_0x3874('0xbf')][_0x3874('0x10b')](db[_0x3874('0xc1')],{'as':_0x3874('0x1b2'),'onDelete':_0x3874('0x108'),'foreignKey':'SubjectId'});db['Dynamics365Configuration'][_0x3874('0x10b')](db[_0x3874('0xc1')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x3874('0x1b5')});db[_0x3874('0xbf')]['hasMany'](db[_0x3874('0xc1')],{'as':_0x3874('0x1ac'),'onDelete':_0x3874('0x108'),'foreignKey':_0x3874('0x1b6')});db[_0x3874('0xbf')]['belongsTo'](db[_0x3874('0xbe')],{'as':_0x3874('0x16a'),'foreignKey':_0x3874('0x1b1')});db['Dynamics365Field'][_0x3874('0x10b')](db[_0x3874('0xc1')],{'as':'Subject','foreignKey':_0x3874('0x1b3')});db['Dynamics365Field'][_0x3874('0x10b')](db[_0x3874('0xc1')],{'as':_0x3874('0x1b8'),'foreignKey':_0x3874('0x1b5')});db[_0x3874('0xc1')][_0x3874('0x10b')](db[_0x3874('0xc1')],{'as':_0x3874('0x1b9'),'foreignKey':_0x3874('0x1b6')});db[_0x3874('0xc1')][_0x3874('0x11a')](db[_0x3874('0x89')],{'as':_0x3874('0x89'),'foreignKey':_0x3874('0x1ba')});db[_0x3874('0xc2')][_0x3874('0x10b')](db[_0x3874('0xc4')],{'as':_0x3874('0x1b0'),'onDelete':_0x3874('0x108'),'foreignKey':_0x3874('0x1b1')});db[_0x3874('0xc4')]['hasMany'](db[_0x3874('0xc6')],{'as':'Subjects','foreignKey':_0x3874('0x1b3')});db[_0x3874('0xc4')][_0x3874('0x10b')](db[_0x3874('0xc6')],{'as':_0x3874('0x1b4'),'foreignKey':_0x3874('0x1b5')});db[_0x3874('0xc4')][_0x3874('0x10b')](db[_0x3874('0xc6')],{'as':'Fields','foreignKey':_0x3874('0x1b6')});db[_0x3874('0xc4')]['belongsTo'](db[_0x3874('0xc2')],{'as':_0x3874('0x16a'),'foreignKey':'AccountId'});db['FreshsalesField'][_0x3874('0x10b')](db[_0x3874('0xc6')],{'as':_0x3874('0x1b7'),'foreignKey':_0x3874('0x1b3')});db[_0x3874('0xc6')]['hasMany'](db['FreshsalesField'],{'as':_0x3874('0x1b8'),'foreignKey':_0x3874('0x1b5')});db[_0x3874('0xc6')][_0x3874('0x10b')](db[_0x3874('0xc6')],{'as':'Field','foreignKey':_0x3874('0x1b6')});db[_0x3874('0xc6')][_0x3874('0x11a')](db[_0x3874('0x89')],{'as':_0x3874('0x89'),'foreignKey':_0x3874('0x1ba')});db['ChatQueueReport']['belongsTo'](db[_0x3874('0x5d')],{});db[_0x3874('0x1c2')][_0x3874('0x11a')](db[_0x3874('0xee')],{'as':_0x3874('0x173'),'foreignKey':'ListId'});db[_0x3874('0x1c2')]['belongsTo'](db[_0x3874('0x15b')],{'as':_0x3874('0x15c'),'foreignKey':_0x3874('0x15d')});db[_0x3874('0x1c2')][_0x3874('0x11a')](db[_0x3874('0x60')],{});db[_0x3874('0x1c2')][_0x3874('0x11a')](db[_0x3874('0x61')],{});db[_0x3874('0x1c2')][_0x3874('0x11a')](db[_0x3874('0x12')],{});db[_0x3874('0x1c2')]['belongsTo'](db['ChatQueue'],{});db['ChatInternalMessage'][_0x3874('0x11a')](db[_0x3874('0x12')],{'onDelete':_0x3874('0x108'),'foreignKey':_0x3874('0x1c3')});db['ChatInternalMessage'][_0x3874('0x11a')](db[_0x3874('0x12')],{'onDelete':_0x3874('0x108'),'foreignKey':_0x3874('0x1c4')});db[_0x3874('0xce')]['hasMany'](db[_0x3874('0xcc')],{'foreignKey':_0x3874('0x1c5'),'onDelete':_0x3874('0x108')});db[_0x3874('0xce')]['hasMany'](db['JscriptyAnswerReport'],{'foreignKey':_0x3874('0x1c5'),'onDelete':_0x3874('0x108')});db[_0x3874('0xd0')][_0x3874('0x11a')](db['SmsAccount'],{});db[_0x3874('0xd0')][_0x3874('0x11a')](db[_0x3874('0xee')],{'as':'List','foreignKey':_0x3874('0x167')});db[_0x3874('0xd0')][_0x3874('0x11a')](db[_0x3874('0x15b')],{'as':'Contact','foreignKey':_0x3874('0x15d')});db['SmsQueueReport'][_0x3874('0x11a')](db[_0x3874('0x52')],{});db[_0x3874('0xd0')]['belongsTo'](db[_0x3874('0x54')],{});db['SmsQueueReport']['belongsTo'](db[_0x3874('0x12')],{});db[_0x3874('0xd0')][_0x3874('0x11a')](db[_0x3874('0x56')],{});db[_0x3874('0xd4')]['hasMany'](db['JscriptySessionReport'],{'foreignKey':_0x3874('0x1c6')});db[_0x3874('0xd4')]['hasMany'](db[_0x3874('0xcc')],{'foreignKey':'ProjectId'});db[_0x3874('0xd4')][_0x3874('0x10b')](db[_0x3874('0xcb')],{'foreignKey':_0x3874('0x1c6')});db[_0x3874('0xd7')][_0x3874('0x11b')](db['User'],{'as':_0x3874('0x16d'),'through':_0x3874('0x13f')});db['Team']['belongsToMany'](db[_0x3874('0x12')],{'as':_0x3874('0x152'),'through':_0x3874('0x11e')});db[_0x3874('0xdc')]['belongsToMany'](db[_0x3874('0x125')],{'through':'TeamVoiceQueue','as':_0x3874('0x126')});db['Team']['belongsToMany'](db[_0x3874('0x3a')],{'through':_0x3874('0x168'),'as':_0x3874('0x127')});db[_0x3874('0xdc')][_0x3874('0x11b')](db['ChatQueue'],{'through':_0x3874('0x1c7'),'as':_0x3874('0x12a')});db[_0x3874('0xdc')][_0x3874('0x11b')](db[_0x3874('0x4b')],{'through':'team_has_fax_queues','as':_0x3874('0x12c')});db[_0x3874('0xdc')][_0x3874('0x11b')](db[_0x3874('0x56')],{'through':_0x3874('0x182'),'as':'SmsQueues'});db[_0x3874('0xdc')]['belongsToMany'](db[_0x3874('0x12e')],{'through':_0x3874('0x18a'),'as':'OpenchannelQueues'});db[_0x3874('0xdc')][_0x3874('0x11b')](db[_0x3874('0x103')],{'through':_0x3874('0x1c8'),'as':_0x3874('0x130')});db[_0x3874('0x198')]['hasMany'](db['CmHopper'],{'as':_0x3874('0x149'),'foreignKey':_0x3874('0x199')});db['Campaign'][_0x3874('0x10b')](db[_0x3874('0x10e')],{'as':_0x3874('0x10f'),'foreignKey':_0x3874('0x199')});db[_0x3874('0x198')][_0x3874('0x10b')](db[_0x3874('0x110')],{'as':_0x3874('0x1c9'),'foreignKey':_0x3874('0x199')});db[_0x3874('0x198')]['hasMany'](db[_0x3874('0x6d')],{'as':_0x3874('0x14a'),'foreignKey':_0x3874('0x199')});db[_0x3874('0x198')]['belongsTo'](db['Trunk'],{'as':_0x3874('0x29'),'foreignKey':_0x3874('0x14c')});db[_0x3874('0x198')][_0x3874('0x11a')](db[_0x3874('0x29')],{'as':'TrunkBackup','foreignKey':_0x3874('0x14e')});db[_0x3874('0x198')][_0x3874('0x11a')](db[_0x3874('0x79')],{'as':'Interval','foreignKey':_0x3874('0x14f')});db[_0x3874('0x198')][_0x3874('0x11a')](db[_0x3874('0xd7')],{'as':'SquareProject','foreignKey':_0x3874('0x1ca')});db[_0x3874('0x198')][_0x3874('0x11b')](db[_0x3874('0xee')],{'as':_0x3874('0x11c'),'through':_0x3874('0x1cb')});db['Campaign']['belongsToMany'](db[_0x3874('0xee')],{'as':'BlackLists','through':_0x3874('0x1cc')});db[_0x3874('0xe2')][_0x3874('0x11a')](db['ChatOfflineMessage'],{'as':_0x3874('0x63'),'foreignKey':'ChatOfflineMessageId'});db[_0x3874('0xe5')][_0x3874('0x11a')](db['MailMessage'],{});db[_0x3874('0xe5')][_0x3874('0x11a')](db[_0x3874('0x3d')],{});db[_0x3874('0xe5')][_0x3874('0x11a')](db[_0x3874('0x38')],{'foreignKey':_0x3874('0x1cd'),'as':_0x3874('0x1ce')});db[_0x3874('0xe5')][_0x3874('0x11a')](db['User'],{'foreignKey':'FromUserId','as':_0x3874('0x1cf')});db['MailTransferReport'][_0x3874('0x11a')](db[_0x3874('0x12')],{'foreignKey':_0x3874('0x1d0'),'as':'ToAgent'});db['MailTransferReport'][_0x3874('0x11a')](db[_0x3874('0x3a')],{'foreignKey':_0x3874('0x1d1'),'as':_0x3874('0x1d2')});db['MailTransferReport']['belongsTo'](db[_0x3874('0x38')],{'foreignKey':'ToMailAccountId','as':_0x3874('0x1d3')});db['ChatTransferReport'][_0x3874('0x11a')](db[_0x3874('0x61')],{});db[_0x3874('0xe7')][_0x3874('0x11a')](db[_0x3874('0x60')],{});db[_0x3874('0xe7')]['belongsTo'](db[_0x3874('0x5d')],{'foreignKey':_0x3874('0x1d4'),'as':'FromAccount'});db[_0x3874('0xe7')][_0x3874('0x11a')](db[_0x3874('0x12')],{'foreignKey':'FromUserId','as':'FromAgent'});db['ChatTransferReport'][_0x3874('0x11a')](db[_0x3874('0x12')],{'foreignKey':_0x3874('0x1d0'),'as':_0x3874('0x1d5')});db[_0x3874('0xe7')][_0x3874('0x11a')](db[_0x3874('0x129')],{'foreignKey':_0x3874('0x1d6'),'as':'ToQueue'});db[_0x3874('0xe7')][_0x3874('0x11a')](db[_0x3874('0x5d')],{'foreignKey':_0x3874('0x1d7'),'as':_0x3874('0x1d3')});db['FaxTransferReport'][_0x3874('0x11a')](db['FaxMessage'],{});db[_0x3874('0xe8')]['belongsTo'](db[_0x3874('0x47')],{});db[_0x3874('0xe8')]['belongsTo'](db[_0x3874('0x135')],{'foreignKey':_0x3874('0x1d8'),'as':_0x3874('0x1ce')});db['FaxTransferReport'][_0x3874('0x11a')](db[_0x3874('0x12')],{'foreignKey':'FromUserId','as':_0x3874('0x1cf')});db[_0x3874('0xe8')][_0x3874('0x11a')](db[_0x3874('0x12')],{'foreignKey':_0x3874('0x1d0'),'as':_0x3874('0x1d5')});db[_0x3874('0xe8')][_0x3874('0x11a')](db['FaxQueue'],{'foreignKey':_0x3874('0x1d9'),'as':'ToQueue'});db[_0x3874('0xe8')][_0x3874('0x11a')](db[_0x3874('0x135')],{'foreignKey':_0x3874('0x1da'),'as':_0x3874('0x1d3')});db['OpenchannelTransferReport'][_0x3874('0x11a')](db['OpenchannelMessage'],{});db[_0x3874('0xea')][_0x3874('0x11a')](db[_0x3874('0x5a')],{});db[_0x3874('0xea')][_0x3874('0x11a')](db[_0x3874('0x139')],{'foreignKey':'FromOpenchannelAccountId','as':'FromAccount'});db['OpenchannelTransferReport'][_0x3874('0x11a')](db[_0x3874('0x12')],{'foreignKey':_0x3874('0x1db'),'as':_0x3874('0x1cf')});db['OpenchannelTransferReport'][_0x3874('0x11a')](db[_0x3874('0x12')],{'foreignKey':'ToUserId','as':_0x3874('0x1d5')});db[_0x3874('0xea')]['belongsTo'](db[_0x3874('0x12e')],{'foreignKey':'ToOpenchannelQueueId','as':_0x3874('0x1d2')});db[_0x3874('0xea')][_0x3874('0x11a')](db[_0x3874('0x139')],{'foreignKey':_0x3874('0x1dc'),'as':_0x3874('0x1d3')});db[_0x3874('0xec')][_0x3874('0x11a')](db[_0x3874('0x54')],{});db[_0x3874('0xec')][_0x3874('0x11a')](db[_0x3874('0x52')],{});db[_0x3874('0xec')]['belongsTo'](db[_0x3874('0x4f')],{'foreignKey':_0x3874('0x1dd'),'as':_0x3874('0x1ce')});db[_0x3874('0xec')][_0x3874('0x11a')](db['User'],{'foreignKey':_0x3874('0x1db'),'as':'FromAgent'});db['SmsTransferReport'][_0x3874('0x11a')](db[_0x3874('0x12')],{'foreignKey':_0x3874('0x1d0'),'as':'ToAgent'});db[_0x3874('0xec')]['belongsTo'](db[_0x3874('0x56')],{'foreignKey':_0x3874('0x1de'),'as':_0x3874('0x1d2')});db[_0x3874('0xec')][_0x3874('0x11a')](db[_0x3874('0x4f')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db[_0x3874('0xee')][_0x3874('0x10b')](db['Disposition'],{'as':_0x3874('0x162'),'foreignKey':_0x3874('0x167'),'onDelete':_0x3874('0x108')});db[_0x3874('0xee')][_0x3874('0x10b')](db['CmCustomField'],{'as':_0x3874('0x1df'),'foreignKey':_0x3874('0x167')});db[_0x3874('0xee')][_0x3874('0x10b')](db[_0x3874('0x15b')],{'as':_0x3874('0x193'),'onDelete':'cascade','foreignKey':_0x3874('0x167')});db[_0x3874('0xee')][_0x3874('0x10b')](db[_0x3874('0x10e')],{'as':_0x3874('0x10f'),'foreignKey':'ListId'});db[_0x3874('0xee')][_0x3874('0x10b')](db[_0x3874('0x110')],{'as':'HopperHistory','foreignKey':_0x3874('0x167')});db['CmList'][_0x3874('0x10b')](db[_0x3874('0x112')],{'as':'ReportAgentPreview','foreignKey':'ListId'});db[_0x3874('0xee')][_0x3874('0x11b')](db[_0x3874('0x125')],{'as':_0x3874('0x1e0'),'through':'voice_queues_has_cm_lists'});db[_0x3874('0xee')][_0x3874('0x11b')](db['User'],{'as':_0x3874('0x152'),'through':'cm_user_has_lists'});db['VoicePrefix']['hasMany'](db[_0x3874('0x18')],{'as':_0x3874('0x10d'),'onDelete':_0x3874('0x108')});db['VoicePrefix'][_0x3874('0x11b')](db[_0x3874('0x12')],{'as':'Agents','through':_0x3874('0x132')});db[_0x3874('0xf1')][_0x3874('0x10b')](db[_0x3874('0x12')],{'as':_0x3874('0x16d'),'foreignKey':_0x3874('0x1e1')});db['UserProfile']['hasMany'](db[_0x3874('0xf3')],{'as':'UserProfileSections','foreignKey':_0x3874('0x1e1'),'onDelete':_0x3874('0x108')});db[_0x3874('0xf3')][_0x3874('0x10b')](db['UserProfileResource'],{'as':_0x3874('0x1e2'),'foreignKey':_0x3874('0x1e3'),'onDelete':'cascade'});db[_0x3874('0x1e4')][_0x3874('0x10b')](db[_0x3874('0x161')],{'as':'Dispositions','foreignKey':_0x3874('0x1e5'),'onDelete':'cascade'});db[_0x3874('0x1e4')][_0x3874('0x10b')](db[_0x3874('0x76')],{'as':_0x3874('0x163'),'foreignKey':_0x3874('0x1e5')});db[_0x3874('0x1e4')][_0x3874('0x10b')](db[_0x3874('0xfd')],{'as':'Messages','foreignKey':_0x3874('0x1e5')});db[_0x3874('0x1e4')][_0x3874('0x10b')](db['WhatsappInteraction'],{'as':'Interactions'});db[_0x3874('0x1e4')]['hasMany'](db[_0x3874('0xfa')],{'as':'Applications'});db[_0x3874('0x1e4')][_0x3874('0x11a')](db[_0x3874('0xee')],{'as':_0x3874('0x173'),'foreignKey':'ListId'});db['WhatsappAccount'][_0x3874('0x11a')](db[_0x3874('0x7b')],{'as':_0x3874('0x177'),'foreignKey':_0x3874('0x150')});db[_0x3874('0x1e4')][_0x3874('0x11b')](db[_0x3874('0x12')],{'as':_0x3874('0x152'),'through':_0x3874('0x13d')});db[_0x3874('0xfa')][_0x3874('0x11a')](db[_0x3874('0x12')],{'onDelete':_0x3874('0x171')});db['WhatsappApplication'][_0x3874('0x11a')](db[_0x3874('0x103')],{'onDelete':_0x3874('0x171')});db[_0x3874('0xfa')][_0x3874('0x11a')](db[_0x3874('0x1e4')],{'onDelete':'restrict'});db[_0x3874('0xfa')]['belongsTo'](db[_0x3874('0x79')],{'onDelete':_0x3874('0x171'),'foreignKey':_0x3874('0x14f')});db['WhatsappApplication'][_0x3874('0x11a')](db['Tag'],{'onDelete':_0x3874('0x171'),'foreignKey':_0x3874('0x178')});db[_0x3874('0xfc')][_0x3874('0x10b')](db[_0x3874('0xfd')],{'as':_0x3874('0x155'),'onDelete':_0x3874('0x108'),'foreignKey':_0x3874('0x1e6')});db['WhatsappInteraction'][_0x3874('0x11a')](db['WhatsappAccount'],{'as':_0x3874('0x16a'),'foreignKey':_0x3874('0x1e5')});db['WhatsappInteraction'][_0x3874('0x11a')](db[_0x3874('0x15b')],{'as':'Contact','foreignKey':_0x3874('0x15d')});db[_0x3874('0xfc')]['belongsTo'](db[_0x3874('0x12')],{'as':_0x3874('0x17a'),'foreignKey':_0x3874('0x109')});db[_0x3874('0xfc')]['belongsToMany'](db[_0x3874('0x83')],{'through':_0x3874('0x1e7'),'as':_0x3874('0x17b')});db[_0x3874('0xfc')]['belongsToMany'](db[_0x3874('0x83')],{'through':'whatsapp_interaction_has_tags','as':_0x3874('0x16c')});db[_0x3874('0xfc')][_0x3874('0x11b')](db['User'],{'as':_0x3874('0x16d'),'through':_0x3874('0x124'),'foreignKey':_0x3874('0x1e6')});db[_0x3874('0xfd')]['belongsTo'](db[_0x3874('0x12')],{'as':_0x3874('0x12')});db['WhatsappMessage'][_0x3874('0x11a')](db[_0x3874('0x15b')],{'onDelete':_0x3874('0x108'),'as':_0x3874('0x15c')});db[_0x3874('0xfd')][_0x3874('0x11a')](db['WhatsappInteraction'],{'onDelete':_0x3874('0x108'),'as':_0x3874('0x16f'),'foreignKey':'WhatsappInteractionId'});db[_0x3874('0xfd')][_0x3874('0x11a')](db['WhatsappAccount'],{'as':_0x3874('0x16a'),'foreignKey':_0x3874('0x1e5')});db[_0x3874('0xff')]['belongsTo'](db[_0x3874('0x1e4')],{});db['WhatsappQueueReport']['belongsTo'](db['CmList'],{'as':_0x3874('0x173'),'foreignKey':_0x3874('0x167')});db['WhatsappQueueReport']['belongsTo'](db[_0x3874('0x15b')],{'as':'Contact','foreignKey':'ContactId'});db[_0x3874('0xff')][_0x3874('0x11a')](db[_0x3874('0xfc')],{});db[_0x3874('0xff')][_0x3874('0x11a')](db[_0x3874('0x103')],{});db[_0x3874('0xff')][_0x3874('0x11a')](db['WhatsappMessage'],{});db[_0x3874('0xff')][_0x3874('0x11a')](db[_0x3874('0x12')],{});db['WhatsappTransferReport']['belongsTo'](db[_0x3874('0xfd')],{});db[_0x3874('0x101')][_0x3874('0x11a')](db['WhatsappInteraction'],{});db['WhatsappTransferReport'][_0x3874('0x11a')](db[_0x3874('0x1e4')],{'foreignKey':_0x3874('0x1e8'),'as':_0x3874('0x1ce')});db[_0x3874('0x101')][_0x3874('0x11a')](db[_0x3874('0x1e4')],{'foreignKey':_0x3874('0x1e9'),'as':_0x3874('0x1d3')});db[_0x3874('0x101')][_0x3874('0x11a')](db[_0x3874('0x103')],{'foreignKey':_0x3874('0x1ea'),'as':_0x3874('0x1d2')});db[_0x3874('0x101')]['belongsTo'](db[_0x3874('0x12')],{'foreignKey':_0x3874('0x1db'),'as':'FromAgent'});db[_0x3874('0x101')]['belongsTo'](db[_0x3874('0x12')],{'foreignKey':'ToUserId','as':_0x3874('0x1d5')});db[_0x3874('0x103')]['belongsToMany'](db[_0x3874('0x12')],{'as':_0x3874('0x152'),'through':_0x3874('0x34'),'foreignKey':_0x3874('0x1eb')});db[_0x3874('0x103')]['belongsToMany'](db[_0x3874('0xdc')],{'through':_0x3874('0x1c8'),'as':_0x3874('0x153')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x3f00=['CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','ReportAgentPreview','../api/cmCustomField/cmCustomField.model','Action','Automation','CannedAnswer','Disposition','../api/disposition/disposition.model','Condition','Interval','../api/interval/interval.model','../api/pause/pause.model','Cdr','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','../api/template/template.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticTreeReport','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskConfiguration','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','../api/intDynamics365Field/intDynamics365Field.model','../api/intFreshsalesAccount/intFreshsalesAccount.model','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','SquareMessage','../api/squareMessage/squareMessage.model','Team','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','VoicePrefix','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','../api/teamVoiceQueue/teamVoiceQueue.model','hasOne','UserId','Recordings','hasMany','VoiceQueuesRt','Extensions','cascade','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteraction','UserNotifications','SenderId','userProfileId','Groups','chat_group_has_users','belongsToMany','Contacts','CmList','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','WhatsappInteractions','VoiceQueues','MailQueues','ChatQueue','ChatQueues','SmsQueues','OpenchannelQueues','VoicePrefixes','ChatWebsite','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','user_has_mail_accounts','OpenchannelAccounts','SmsAccount','SmsAccounts','user_has_sms_accounts','WhatsappAccount','WhatsappAccounts','user_has_whatsapp_accounts','user_has_square_projects','SpiedAgents','ChanSpyId','VoiceExtension','Applications','Sounds','Members','CmHopper','VoiceQueueId','HopperFinals','HopperHistories','belongsTo','TrunkId','TrunkBackup','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','TeamVoiceQueue','BlackLists','voice_queues_has_cm_blacklists','VoiceMailMessage','mailboxuser','mailbox','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','MailServerIn','MailServerOut','MailAccountId','Smtp','Dispositions','Answers','Messages','ListId','TemplateId','Pause','team_has_mail_queues','MailInteractionId','Account','Owner','Tags','mail_interaction_has_tags','ThroughTags','Users','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessageId','restrict','IntervalId','TagId','List','Interactions','FaxInteractionId','FaxAccountId','ContactId','fax_interaction_has_tags','team_has_fax_queues','Teams','SmsAccountId','SmsMessage','sms_interaction_has_tags','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','user_has_openchannel_accounts','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','AttachmentId','team_has_openchannel_queues','Agent','Queue','ChatInteractionId','chat_interaction_has_tags','ChatInternalMessage','ChatGroupId','Website','Company','CompanyId','cm_user_has_contacts','cm_contact_has_tags','CampaignId','OwnerId','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','SmsApplications','AnalyticDefaultReport','DefaultReportId','CustomReportId','Sound','Mohs','whatsapp_interaction_has_tags','Trigger','AllConditions','AllCondition','AnyConditions','TriggerId','AnalyticFieldReport','Fields','MetricId','SalesforceConfiguration','Configurations','SubjectId','FieldId','AccountId','Subject','Description','DescriptionId','VariableId','SugarcrmConfiguration','Subjects','Field','DeskAccount','int_desk_configuration_has_tags','ZohoConfiguration','Descriptions','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskField','ServicenowField','Dynamics365Configuration','Dynamics365Field','FreshsalesAccount','FreshsalesConfiguration','FromId','ToId','SessionId','SmsQueueReport','ProjectId','team_has_chat_queues','FaxQueues','WhatsappQueue','team_has_whatsapp_queues','WhatsappQueues','HopperBlacks','SquareProjectId','campaigns_has_cm_lists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CmCustomField','Queues','user_has_voice_prefixes','Resources','sectionId','WhatsappAccountId','user_has_whatsapp_interactions','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','exports','lodash','determine','sequelize','defaultsDeep','motion2','xC@LL1234','mysql','name','utf8','utf8_general_ci','sequelizeHistory','127.0.0.1','utf8mb4','database','options','username','password','User','import','../api/user/user.model','VoiceChanSpy','VoiceContext','../api/voiceContext/voiceContext.model','VoiceMusicOnHold','VoiceQueue','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','../api/mailSubstatus/mailSubstatus.model','MailInteraction','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsQueue','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model'];(function(_0x4d1154,_0x1c6641){var _0x466cdf=function(_0x3dbe9d){while(--_0x3dbe9d){_0x4d1154['push'](_0x4d1154['shift']());}};_0x466cdf(++_0x1c6641);}(_0x3f00,0x171));var _0x03f0=function(_0x5c5804,_0x8b31c1){_0x5c5804=_0x5c5804-0x0;var _0x359f14=_0x3f00[_0x5c5804];return _0x359f14;};'use strict';var config=require('../config/environment');var Sequelize=require('sequelize');var _=require(_0x03f0('0x0'));var jstz=require('jstz');var timezone=jstz[_0x03f0('0x1')]();config[_0x03f0('0x2')]=_[_0x03f0('0x3')](config[_0x03f0('0x2')],{'database':_0x03f0('0x4'),'username':'xcall','password':_0x03f0('0x5'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x03f0('0x6'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x03f0('0x7')](),'define':{'charset':_0x03f0('0x8'),'collate':_0x03f0('0x9')}}});config[_0x03f0('0xa')]=_[_0x03f0('0x3')](config[_0x03f0('0xa')],{'database':_0x03f0('0x4'),'username':'xcall','password':_0x03f0('0x5'),'options':{'host':_0x03f0('0xb'),'port':0xcea,'dialect':_0x03f0('0x6'),'dialectOptions':{'charset':_0x03f0('0xc')},'logging':![],'timezone':timezone[_0x03f0('0x7')](),'define':{'charset':_0x03f0('0x8'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x03f0('0x2')][_0x03f0('0xd')],config[_0x03f0('0x2')]['username'],config['sequelize']['password'],config[_0x03f0('0x2')][_0x03f0('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x03f0('0xa')][_0x03f0('0xd')],config[_0x03f0('0xa')][_0x03f0('0xf')],config[_0x03f0('0xa')][_0x03f0('0x10')],config[_0x03f0('0xa')][_0x03f0('0xe')])};db[_0x03f0('0x11')]=db['sequelize'][_0x03f0('0x12')](_0x03f0('0x13'));db[_0x03f0('0x14')]=db['sequelize']['import']('../api/voiceChanSpy/voiceChanSpy.model');db[_0x03f0('0x15')]=db[_0x03f0('0x2')][_0x03f0('0x12')](_0x03f0('0x16'));db['VoiceExtension']=db[_0x03f0('0x2')]['import']('../api/voiceExtension/voiceExtension.model');db[_0x03f0('0x17')]=db[_0x03f0('0x2')][_0x03f0('0x12')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0x03f0('0x18')]=db[_0x03f0('0x2')][_0x03f0('0x12')]('../api/voiceQueue/voiceQueue.model');db[_0x03f0('0x19')]=db[_0x03f0('0x2')]['import'](_0x03f0('0x1a'));db[_0x03f0('0x1b')]=db[_0x03f0('0x2')][_0x03f0('0x12')](_0x03f0('0x1c'));db[_0x03f0('0x1d')]=db[_0x03f0('0x2')][_0x03f0('0x12')]('../api/voiceMail/voiceMail.model');db['VoiceMailMessage']=db[_0x03f0('0x2')][_0x03f0('0x12')](_0x03f0('0x1e'));db[_0x03f0('0x1f')]=db[_0x03f0('0x2')]['import']('../api/voiceCallReport/voiceCallReport.model');db['VoiceDialReport']=db['sequelize'][_0x03f0('0x12')](_0x03f0('0x20'));db['VoiceAgentReport']=db[_0x03f0('0x2')][_0x03f0('0x12')](_0x03f0('0x21'));db[_0x03f0('0x22')]=db[_0x03f0('0x2')][_0x03f0('0x12')]('../api/voiceQueueReport/voiceQueueReport.model');db[_0x03f0('0x23')]=db[_0x03f0('0x2')]['import'](_0x03f0('0x24'));db[_0x03f0('0x25')]=db[_0x03f0('0x2')][_0x03f0('0x12')](_0x03f0('0x26'));db['VoiceTransferReport']=db[_0x03f0('0x2')]['import'](_0x03f0('0x27'));db[_0x03f0('0x28')]=db['sequelize'][_0x03f0('0x12')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0x03f0('0x29')]=db[_0x03f0('0x2')][_0x03f0('0x12')](_0x03f0('0x2a'));db[_0x03f0('0x2b')]=db[_0x03f0('0x2')]['import'](_0x03f0('0x2c'));db['UserMailQueue']=db[_0x03f0('0x2')]['import']('../api/userMailQueue/userMailQueue.model');db[_0x03f0('0x2d')]=db[_0x03f0('0x2')][_0x03f0('0x12')](_0x03f0('0x2e'));db[_0x03f0('0x2f')]=db[_0x03f0('0x2')][_0x03f0('0x12')](_0x03f0('0x30'));db[_0x03f0('0x31')]=db[_0x03f0('0x2')][_0x03f0('0x12')](_0x03f0('0x32'));db[_0x03f0('0x33')]=db[_0x03f0('0x2')][_0x03f0('0x12')](_0x03f0('0x34'));db['MailServerIn']=db[_0x03f0('0x2')][_0x03f0('0x12')](_0x03f0('0x35'));db['MailServerOut']=db[_0x03f0('0x2')]['import'](_0x03f0('0x36'));db[_0x03f0('0x37')]=db['sequelize'][_0x03f0('0x12')](_0x03f0('0x38'));db[_0x03f0('0x39')]=db['sequelize'][_0x03f0('0x12')](_0x03f0('0x3a'));db['MailSubstatus']=db['sequelize']['import'](_0x03f0('0x3b'));db[_0x03f0('0x3c')]=db[_0x03f0('0x2')][_0x03f0('0x12')]('../api/mailInteraction/mailInteraction.model');db[_0x03f0('0x3d')]=db['sequelize'][_0x03f0('0x12')](_0x03f0('0x3e'));db[_0x03f0('0x3f')]=db[_0x03f0('0x2')][_0x03f0('0x12')](_0x03f0('0x40'));db[_0x03f0('0x41')]=db[_0x03f0('0x2')]['import']('../api/mailQueueReport/mailQueueReport.model');db['Dashboard']=db['sequelize'][_0x03f0('0x12')](_0x03f0('0x42'));db[_0x03f0('0x43')]=db[_0x03f0('0x2')][_0x03f0('0x12')](_0x03f0('0x44'));db[_0x03f0('0x45')]=db[_0x03f0('0x2')]['import'](_0x03f0('0x46'));db[_0x03f0('0x47')]=db[_0x03f0('0x2')][_0x03f0('0x12')](_0x03f0('0x48'));db[_0x03f0('0x49')]=db['sequelize'][_0x03f0('0x12')](_0x03f0('0x4a'));db[_0x03f0('0x4b')]=db[_0x03f0('0x2')][_0x03f0('0x12')](_0x03f0('0x4c'));db[_0x03f0('0x4d')]=db[_0x03f0('0x2')][_0x03f0('0x12')](_0x03f0('0x4e'));db[_0x03f0('0x4f')]=db['sequelize'][_0x03f0('0x12')]('../api/faxQueueReport/faxQueueReport.model');db['SmsAccount']=db[_0x03f0('0x2')][_0x03f0('0x12')](_0x03f0('0x50'));db[_0x03f0('0x51')]=db[_0x03f0('0x2')][_0x03f0('0x12')](_0x03f0('0x52'));db[_0x03f0('0x53')]=db[_0x03f0('0x2')][_0x03f0('0x12')](_0x03f0('0x54'));db['SmsMessage']=db[_0x03f0('0x2')][_0x03f0('0x12')]('../api/smsMessage/smsMessage.model');db[_0x03f0('0x55')]=db[_0x03f0('0x2')]['import']('../api/smsQueue/smsQueue.model');db[_0x03f0('0x56')]=db[_0x03f0('0x2')][_0x03f0('0x12')](_0x03f0('0x57'));db[_0x03f0('0x58')]=db[_0x03f0('0x2')]['import'](_0x03f0('0x59'));db[_0x03f0('0x5a')]=db[_0x03f0('0x2')][_0x03f0('0x12')](_0x03f0('0x5b'));db[_0x03f0('0x5c')]=db['sequelize'][_0x03f0('0x12')](_0x03f0('0x5d'));db[_0x03f0('0x5e')]=db[_0x03f0('0x2')]['import']('../api/openchannelQueue/openchannelQueue.model');db['ChatWebsite']=db[_0x03f0('0x2')][_0x03f0('0x12')](_0x03f0('0x5f'));db[_0x03f0('0x60')]=db[_0x03f0('0x2')]['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x03f0('0x61')]=db[_0x03f0('0x2')][_0x03f0('0x12')](_0x03f0('0x62'));db[_0x03f0('0x63')]=db[_0x03f0('0x2')][_0x03f0('0x12')]('../api/chatInteraction/chatInteraction.model');db[_0x03f0('0x64')]=db[_0x03f0('0x2')][_0x03f0('0x12')](_0x03f0('0x65'));db[_0x03f0('0x66')]=db[_0x03f0('0x2')][_0x03f0('0x12')](_0x03f0('0x67'));db['ChatQueue']=db['sequelize'][_0x03f0('0x12')](_0x03f0('0x68'));db[_0x03f0('0x69')]=db[_0x03f0('0x2')][_0x03f0('0x12')](_0x03f0('0x6a'));db[_0x03f0('0x6b')]=db['sequelize'][_0x03f0('0x12')](_0x03f0('0x6c'));db[_0x03f0('0x6d')]=db['sequelize'][_0x03f0('0x12')](_0x03f0('0x6e'));db[_0x03f0('0x6f')]=db['sequelize'][_0x03f0('0x12')](_0x03f0('0x70'));db['CmHopper']=db[_0x03f0('0x2')]['import'](_0x03f0('0x71'));db[_0x03f0('0x72')]=db['sequelize'][_0x03f0('0x12')](_0x03f0('0x73'));db[_0x03f0('0x74')]=db[_0x03f0('0x2')][_0x03f0('0x12')](_0x03f0('0x75'));db[_0x03f0('0x76')]=db[_0x03f0('0x2')][_0x03f0('0x12')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x03f0('0x77')]=db[_0x03f0('0x2')][_0x03f0('0x12')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db[_0x03f0('0x2')][_0x03f0('0x12')](_0x03f0('0x78'));db[_0x03f0('0x79')]=db[_0x03f0('0x2')][_0x03f0('0x12')]('../api/action/action.model');db[_0x03f0('0x7a')]=db[_0x03f0('0x2')]['import']('../api/automation/automation.model');db[_0x03f0('0x7b')]=db[_0x03f0('0x2')][_0x03f0('0x12')]('../api/cannedAnswer/cannedAnswer.model');db[_0x03f0('0x7c')]=db['sequelize'][_0x03f0('0x12')](_0x03f0('0x7d'));db[_0x03f0('0x7e')]=db[_0x03f0('0x2')][_0x03f0('0x12')]('../api/condition/condition.model');db[_0x03f0('0x7f')]=db[_0x03f0('0x2')][_0x03f0('0x12')](_0x03f0('0x80'));db['Pause']=db['sequelize']['import'](_0x03f0('0x81'));db[_0x03f0('0x82')]=db[_0x03f0('0x2')][_0x03f0('0x12')]('../api/cdr/cdr.model');db['VoiceQueuesLog']=db['sequelize'][_0x03f0('0x12')](_0x03f0('0x83'));db[_0x03f0('0x84')]=db['sequelize'][_0x03f0('0x12')](_0x03f0('0x85'));db['Sound']=db['sequelize'][_0x03f0('0x12')](_0x03f0('0x86'));db[_0x03f0('0x87')]=db[_0x03f0('0x2')]['import'](_0x03f0('0x88'));db[_0x03f0('0x89')]=db[_0x03f0('0x2')][_0x03f0('0x12')](_0x03f0('0x8a'));db['Trigger']=db['sequelize'][_0x03f0('0x12')]('../api/trigger/trigger.model');db[_0x03f0('0x8b')]=db[_0x03f0('0x2')][_0x03f0('0x12')](_0x03f0('0x8c'));db[_0x03f0('0x8d')]=db[_0x03f0('0x2')][_0x03f0('0x12')](_0x03f0('0x8e'));db['IntegrationReport']=db[_0x03f0('0x2')][_0x03f0('0x12')](_0x03f0('0x8f'));db[_0x03f0('0x90')]=db['sequelize'][_0x03f0('0x12')](_0x03f0('0x91'));db['AnalyticDefaultReport']=db[_0x03f0('0x2')]['import'](_0x03f0('0x92'));db['AnalyticExtractedReport']=db[_0x03f0('0x2')]['import'](_0x03f0('0x93'));db[_0x03f0('0x94')]=db[_0x03f0('0x2')][_0x03f0('0x12')](_0x03f0('0x95'));db['AnalyticFieldReport']=db['sequelize'][_0x03f0('0x12')]('../api/analyticFieldReport/analyticFieldReport.model');db[_0x03f0('0x96')]=db[_0x03f0('0x2')][_0x03f0('0x12')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0x03f0('0x97')]=db[_0x03f0('0x2')][_0x03f0('0x12')](_0x03f0('0x98'));db['SalesforceConfiguration']=db[_0x03f0('0x2')][_0x03f0('0x12')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0x03f0('0x99')]=db[_0x03f0('0x2')]['import'](_0x03f0('0x9a'));db[_0x03f0('0x9b')]=db['sequelize'][_0x03f0('0x12')](_0x03f0('0x9c'));db['SugarcrmConfiguration']=db['sequelize']['import']('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0x03f0('0x9d')]=db[_0x03f0('0x2')]['import'](_0x03f0('0x9e'));db['DeskAccount']=db[_0x03f0('0x2')]['import']('../api/intDeskAccount/intDeskAccount.model');db[_0x03f0('0x9f')]=db['sequelize']['import']('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0x03f0('0xa0')]=db[_0x03f0('0x2')]['import'](_0x03f0('0xa1'));db[_0x03f0('0xa2')]=db[_0x03f0('0x2')][_0x03f0('0x12')]('../api/intZohoAccount/intZohoAccount.model');db['ZohoConfiguration']=db[_0x03f0('0x2')][_0x03f0('0x12')](_0x03f0('0xa3'));db[_0x03f0('0xa4')]=db[_0x03f0('0x2')][_0x03f0('0x12')]('../api/intZohoField/intZohoField.model');db[_0x03f0('0xa5')]=db[_0x03f0('0x2')]['import']('../api/intZendeskAccount/intZendeskAccount.model');db['ZendeskConfiguration']=db[_0x03f0('0x2')][_0x03f0('0x12')](_0x03f0('0xa6'));db[_0x03f0('0xa7')]=db[_0x03f0('0x2')][_0x03f0('0x12')](_0x03f0('0xa8'));db[_0x03f0('0xa9')]=db['sequelize'][_0x03f0('0x12')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0x03f0('0xaa')]=db[_0x03f0('0x2')][_0x03f0('0x12')](_0x03f0('0xab'));db['FreshdeskField']=db['sequelize'][_0x03f0('0x12')](_0x03f0('0xac'));db[_0x03f0('0xad')]=db[_0x03f0('0x2')][_0x03f0('0x12')]('../api/intVtigerAccount/intVtigerAccount.model');db[_0x03f0('0xae')]=db['sequelize'][_0x03f0('0x12')](_0x03f0('0xaf'));db[_0x03f0('0xb0')]=db[_0x03f0('0x2')][_0x03f0('0x12')]('../api/intVtigerField/intVtigerField.model');db[_0x03f0('0xb1')]=db['sequelize'][_0x03f0('0x12')](_0x03f0('0xb2'));db[_0x03f0('0xb3')]=db[_0x03f0('0x2')]['import'](_0x03f0('0xb4'));db['ServicenowField']=db['sequelize'][_0x03f0('0x12')]('../api/intServicenowField/intServicenowField.model');db[_0x03f0('0xb5')]=db['sequelize'][_0x03f0('0x12')](_0x03f0('0xb6'));db['Dynamics365Configuration']=db[_0x03f0('0x2')][_0x03f0('0x12')](_0x03f0('0xb7'));db['Dynamics365Field']=db[_0x03f0('0x2')][_0x03f0('0x12')](_0x03f0('0xb8'));db['FreshsalesAccount']=db[_0x03f0('0x2')][_0x03f0('0x12')](_0x03f0('0xb9'));db['FreshsalesConfiguration']=db[_0x03f0('0x2')][_0x03f0('0x12')](_0x03f0('0xba'));db[_0x03f0('0xbb')]=db[_0x03f0('0x2')][_0x03f0('0x12')](_0x03f0('0xbc'));db['Integration']=db['sequelize'][_0x03f0('0x12')](_0x03f0('0x8e'));db[_0x03f0('0xbd')]=db['sequelize'][_0x03f0('0x12')](_0x03f0('0xbe'));db[_0x03f0('0xbf')]=db[_0x03f0('0x2')][_0x03f0('0x12')](_0x03f0('0xc0'));db['ChatInternalMessage']=db[_0x03f0('0x2')][_0x03f0('0x12')](_0x03f0('0xc1'));db[_0x03f0('0xc2')]=db[_0x03f0('0x2')][_0x03f0('0x12')](_0x03f0('0xc3'));db[_0x03f0('0xc4')]=db[_0x03f0('0x2')][_0x03f0('0x12')](_0x03f0('0xc5'));db[_0x03f0('0xc6')]=db[_0x03f0('0x2')]['import']('../api/jscriptySessionReport/jscriptySessionReport.model');db['SmsQueueReport']=db[_0x03f0('0x2')][_0x03f0('0x12')](_0x03f0('0xc7'));db[_0x03f0('0xc8')]=db[_0x03f0('0x2')][_0x03f0('0x12')](_0x03f0('0xc9'));db[_0x03f0('0xca')]=db[_0x03f0('0x2')][_0x03f0('0x12')](_0x03f0('0xcb'));db[_0x03f0('0xcc')]=db[_0x03f0('0x2')][_0x03f0('0x12')]('../api/jscriptyProject/jscriptyProject.model');db['Setting']=db[_0x03f0('0x2')][_0x03f0('0x12')](_0x03f0('0xcd'));db[_0x03f0('0xce')]=db['sequelize'][_0x03f0('0x12')](_0x03f0('0xcf'));db[_0x03f0('0xd0')]=db[_0x03f0('0x2')][_0x03f0('0x12')](_0x03f0('0xd1'));db[_0x03f0('0xd2')]=db[_0x03f0('0x2')]['import']('../api/squareRecording/squareRecording.model');db[_0x03f0('0xd3')]=db[_0x03f0('0x2')][_0x03f0('0x12')](_0x03f0('0xd4'));db[_0x03f0('0xd5')]=db['sequelize'][_0x03f0('0x12')]('../api/team/team.model');db[_0x03f0('0xd6')]=db[_0x03f0('0x2')]['import'](_0x03f0('0xd7'));db[_0x03f0('0xd8')]=db['sequelize']['import'](_0x03f0('0xd9'));db[_0x03f0('0xda')]=db[_0x03f0('0x2')]['import'](_0x03f0('0xdb'));db[_0x03f0('0xdc')]=db[_0x03f0('0x2')][_0x03f0('0x12')](_0x03f0('0xdd'));db[_0x03f0('0xde')]=db[_0x03f0('0x2')]['import']('../api/plugin/plugin.model');db[_0x03f0('0xdf')]=db['sequelize'][_0x03f0('0x12')](_0x03f0('0xe0'));db[_0x03f0('0xe1')]=db[_0x03f0('0x2')][_0x03f0('0x12')](_0x03f0('0xe2'));db[_0x03f0('0xe3')]=db['sequelize'][_0x03f0('0x12')]('../api/faxTransferReport/faxTransferReport.model');db[_0x03f0('0xe4')]=db[_0x03f0('0x2')][_0x03f0('0x12')](_0x03f0('0xe5'));db[_0x03f0('0xe6')]=db['sequelize'][_0x03f0('0x12')](_0x03f0('0xe7'));db['CmList']=db[_0x03f0('0x2')][_0x03f0('0x12')]('../api/cmList/cmList.model');db[_0x03f0('0xe8')]=db[_0x03f0('0x2')][_0x03f0('0x12')]('../api/voicePrefix/voicePrefix.model');db[_0x03f0('0xe9')]=db[_0x03f0('0x2')]['import'](_0x03f0('0xea'));db[_0x03f0('0xeb')]=db[_0x03f0('0x2')][_0x03f0('0x12')](_0x03f0('0xec'));db[_0x03f0('0xed')]=db['sequelize'][_0x03f0('0x12')](_0x03f0('0xee'));db[_0x03f0('0xef')]=db['sequelize']['import'](_0x03f0('0xf0'));db['WhatsappAccount']=db[_0x03f0('0x2')]['import']('../api/whatsappAccount/whatsappAccount.model');db[_0x03f0('0xf1')]=db['sequelize']['import'](_0x03f0('0xf2'));db['WhatsappInteraction']=db[_0x03f0('0x2')][_0x03f0('0x12')]('../api/whatsappInteraction/whatsappInteraction.model');db[_0x03f0('0xf3')]=db[_0x03f0('0x2')][_0x03f0('0x12')](_0x03f0('0xf4'));db[_0x03f0('0xf5')]=db['sequelize']['import']('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0x03f0('0xf6')]=db[_0x03f0('0x2')][_0x03f0('0x12')](_0x03f0('0xf7'));db['WhatsappQueue']=db[_0x03f0('0x2')][_0x03f0('0x12')](_0x03f0('0xf8'));db['CloudProvider']=db[_0x03f0('0x2')][_0x03f0('0x12')]('../api/cloudProvider/cloudProvider.model');db['TeamVoiceQueue']=db[_0x03f0('0x2')][_0x03f0('0x12')](_0x03f0('0xf9'));db[_0x03f0('0x11')][_0x03f0('0xfa')](db[_0x03f0('0x1d')],{'as':_0x03f0('0x1d'),'onDelete':'cascade','foreignKey':_0x03f0('0xfb')});db[_0x03f0('0x11')]['hasMany'](db[_0x03f0('0x19')],{'as':_0x03f0('0xfc'),'foreignKey':_0x03f0('0xfb')});db[_0x03f0('0x11')][_0x03f0('0xfd')](db[_0x03f0('0x28')],{'as':_0x03f0('0xfe'),'foreignKey':_0x03f0('0xfb')});db[_0x03f0('0x11')][_0x03f0('0xfd')](db['VoiceExtension'],{'as':_0x03f0('0xff'),'onDelete':_0x03f0('0x100'),'hooks':!![]});db['User']['hasMany'](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0x03f0('0xfb')});db['User']['hasMany'](db[_0x03f0('0x76')],{'as':_0x03f0('0x101'),'foreignKey':_0x03f0('0xfb')});db[_0x03f0('0x11')]['hasMany'](db[_0x03f0('0x77')],{'as':_0x03f0('0x77'),'foreignKey':'UserId'});db[_0x03f0('0x11')]['hasMany'](db['OpenchannelInteraction'],{'as':_0x03f0('0x102'),'foreignKey':_0x03f0('0xfb')});db['User'][_0x03f0('0xfd')](db[_0x03f0('0x63')],{'as':_0x03f0('0x103'),'foreignKey':'UserId'});db[_0x03f0('0x11')][_0x03f0('0xfd')](db[_0x03f0('0x53')],{'as':_0x03f0('0x104'),'foreignKey':'UserId'});db['User'][_0x03f0('0xfd')](db[_0x03f0('0x49')],{'as':_0x03f0('0x105'),'foreignKey':'UserId'});db[_0x03f0('0x11')]['hasMany'](db[_0x03f0('0x3c')],{'as':_0x03f0('0x106'),'foreignKey':_0x03f0('0xfb')});db[_0x03f0('0x11')][_0x03f0('0xfd')](db[_0x03f0('0x107')],{'as':'WhatsappInteractions','foreignKey':_0x03f0('0xfb')});db[_0x03f0('0x11')]['hasMany'](db['UserNotification'],{'as':_0x03f0('0x108'),'foreignKey':_0x03f0('0x109')});db['User']['belongsTo'](db[_0x03f0('0xe9')],{'as':_0x03f0('0xe9'),'foreignKey':_0x03f0('0x10a')});db[_0x03f0('0x11')]['belongsToMany'](db['ChatGroup'],{'as':_0x03f0('0x10b'),'through':_0x03f0('0x10c')});db['User'][_0x03f0('0x10d')](db[_0x03f0('0x6f')],{'as':_0x03f0('0x10e'),'through':'cm_user_has_contacts'});db[_0x03f0('0x11')]['belongsToMany'](db[_0x03f0('0x10f')],{'as':_0x03f0('0x110'),'through':_0x03f0('0x111')});db[_0x03f0('0x11')][_0x03f0('0x10d')](db[_0x03f0('0xd5')],{'through':_0x03f0('0x112')});db['User'][_0x03f0('0x10d')](db[_0x03f0('0x3c')],{'as':'MailInteractions','through':_0x03f0('0x113')});db['User']['belongsToMany'](db[_0x03f0('0x63')],{'as':_0x03f0('0x103'),'through':_0x03f0('0x114')});db['User'][_0x03f0('0x10d')](db[_0x03f0('0x49')],{'as':'FaxInteractions','through':_0x03f0('0x115')});db[_0x03f0('0x11')][_0x03f0('0x10d')](db[_0x03f0('0x53')],{'as':_0x03f0('0x104'),'through':_0x03f0('0x116')});db[_0x03f0('0x11')][_0x03f0('0x10d')](db[_0x03f0('0x5a')],{'as':_0x03f0('0x102'),'through':_0x03f0('0x117')});db[_0x03f0('0x11')][_0x03f0('0x10d')](db[_0x03f0('0x107')],{'as':_0x03f0('0x118'),'through':'user_has_whatsapp_interactions'});db[_0x03f0('0x11')][_0x03f0('0x10d')](db[_0x03f0('0x18')],{'as':_0x03f0('0x119'),'through':_0x03f0('0x29'),'required':![]});db[_0x03f0('0x11')][_0x03f0('0x10d')](db[_0x03f0('0x39')],{'as':_0x03f0('0x11a'),'through':'UserMailQueue','required':![]});db['User'][_0x03f0('0x10d')](db[_0x03f0('0x11b')],{'as':_0x03f0('0x11c'),'through':_0x03f0('0x2b'),'required':![],'hooks':!![]});db[_0x03f0('0x11')]['belongsToMany'](db[_0x03f0('0x4d')],{'as':'FaxQueues','through':'UserFaxQueue','required':![]});db[_0x03f0('0x11')][_0x03f0('0x10d')](db[_0x03f0('0x55')],{'as':_0x03f0('0x11d'),'through':'UserSmsQueue','required':![]});db[_0x03f0('0x11')][_0x03f0('0x10d')](db[_0x03f0('0x5e')],{'as':_0x03f0('0x11e'),'through':_0x03f0('0x31'),'required':![]});db[_0x03f0('0x11')][_0x03f0('0x10d')](db['WhatsappQueue'],{'as':'WhatsappQueues','through':_0x03f0('0x33'),'required':![]});db[_0x03f0('0x11')][_0x03f0('0x10d')](db[_0x03f0('0x10f')],{'through':_0x03f0('0x111')});db[_0x03f0('0x11')][_0x03f0('0x10d')](db[_0x03f0('0xe8')],{'as':_0x03f0('0x11f'),'through':'user_has_voice_prefixes','required':![]});db[_0x03f0('0x11')][_0x03f0('0x10d')](db[_0x03f0('0x120')],{'as':'ChatWebsites','through':_0x03f0('0x121')});db[_0x03f0('0x11')][_0x03f0('0x10d')](db[_0x03f0('0x45')],{'as':_0x03f0('0x122'),'through':_0x03f0('0x123')});db[_0x03f0('0x11')][_0x03f0('0x10d')](db[_0x03f0('0x37')],{'as':'MailAccounts','through':_0x03f0('0x124')});db[_0x03f0('0x11')][_0x03f0('0x10d')](db[_0x03f0('0x56')],{'as':_0x03f0('0x125'),'through':'user_has_openchannel_accounts'});db['User'][_0x03f0('0x10d')](db[_0x03f0('0x126')],{'as':_0x03f0('0x127'),'through':_0x03f0('0x128')});db[_0x03f0('0x11')][_0x03f0('0x10d')](db[_0x03f0('0x129')],{'as':_0x03f0('0x12a'),'through':_0x03f0('0x12b')});db[_0x03f0('0x11')][_0x03f0('0x10d')](db[_0x03f0('0xd0')],{'as':'SquareProjects','through':_0x03f0('0x12c')});db[_0x03f0('0x14')][_0x03f0('0xfd')](db['VoiceExtension'],{'as':_0x03f0('0x12d'),'onDelete':_0x03f0('0x100'),'foreignKey':_0x03f0('0x12e')});db[_0x03f0('0x15')]['hasMany'](db[_0x03f0('0x12f')],{'onDelete':_0x03f0('0x100')});db[_0x03f0('0x12f')][_0x03f0('0xfd')](db[_0x03f0('0x12f')],{'as':_0x03f0('0x130'),'onDelete':_0x03f0('0x100')});db['VoiceMusicOnHold'][_0x03f0('0x10d')](db['Sound'],{'as':_0x03f0('0x131'),'through':'moh_has_sounds'});db[_0x03f0('0x18')][_0x03f0('0xfd')](db[_0x03f0('0x28')],{'as':_0x03f0('0x132'),'foreignKey':'VoiceQueueId'});db[_0x03f0('0x18')][_0x03f0('0xfd')](db[_0x03f0('0x133')],{'as':'Hoppers','foreignKey':_0x03f0('0x134')});db[_0x03f0('0x18')][_0x03f0('0xfd')](db[_0x03f0('0x74')],{'as':_0x03f0('0x135'),'foreignKey':_0x03f0('0x134')});db[_0x03f0('0x18')][_0x03f0('0xfd')](db[_0x03f0('0x76')],{'as':_0x03f0('0x136'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x03f0('0xfd')](db[_0x03f0('0x77')],{'as':'ReportAgentPreview','foreignKey':_0x03f0('0x134')});db[_0x03f0('0x18')]['hasMany'](db[_0x03f0('0x72')],{'as':'HopperBlacks','foreignKey':_0x03f0('0x134')});db['VoiceQueue'][_0x03f0('0xfd')](db[_0x03f0('0xc6')],{'as':'JscriptySessions','foreignKey':_0x03f0('0x134')});db[_0x03f0('0x18')][_0x03f0('0x137')](db[_0x03f0('0x25')],{'as':_0x03f0('0x25'),'foreignKey':_0x03f0('0x138')});db[_0x03f0('0x18')][_0x03f0('0x137')](db[_0x03f0('0x25')],{'as':_0x03f0('0x139'),'foreignKey':'TrunkBackupId'});db['VoiceQueue']['belongsTo'](db[_0x03f0('0x7f')],{'as':'Interval','foreignKey':'IntervalId'});db[_0x03f0('0x18')][_0x03f0('0x137')](db['Pause'],{'as':_0x03f0('0x13a'),'foreignKey':_0x03f0('0x13b')});db[_0x03f0('0x18')][_0x03f0('0x10d')](db[_0x03f0('0x10f')],{'as':'Lists','through':_0x03f0('0x13c')});db[_0x03f0('0x18')][_0x03f0('0x10d')](db[_0x03f0('0x11')],{'as':_0x03f0('0x13d'),'through':'UserVoiceQueue'});db['VoiceQueue']['belongsToMany'](db[_0x03f0('0xd5')],{'as':'Teams','through':_0x03f0('0x13e')});db[_0x03f0('0x18')][_0x03f0('0x10d')](db[_0x03f0('0x10f')],{'as':_0x03f0('0x13f'),'through':_0x03f0('0x140')});db[_0x03f0('0x19')][_0x03f0('0x137')](db[_0x03f0('0x11')],{'as':_0x03f0('0x11'),'foreignKey':_0x03f0('0xfb')});db[_0x03f0('0x1b')][_0x03f0('0x137')](db[_0x03f0('0x11')],{'as':_0x03f0('0x11'),'foreignKey':_0x03f0('0xfb')});db['VoiceMail'][_0x03f0('0xfd')](db[_0x03f0('0x141')],{'as':'Messages','onDelete':'cascade','foreignKey':_0x03f0('0x142'),'sourceKey':_0x03f0('0x143')});db['VoiceMailMessage']['belongsTo'](db['VoiceMail'],{'foreignKey':'mailboxuser','targetKey':_0x03f0('0x143')});db[_0x03f0('0x1f')][_0x03f0('0xfd')](db['VoiceQueueReport'],{'as':_0x03f0('0x144'),'foreignKey':_0x03f0('0x145'),'constraints':![]});db[_0x03f0('0x1f')]['hasMany'](db[_0x03f0('0x146')],{'as':_0x03f0('0x147'),'foreignKey':_0x03f0('0x145'),'constraints':![]});db[_0x03f0('0x1f')][_0x03f0('0x137')](db['User'],{'as':_0x03f0('0x11'),'foreignKey':_0x03f0('0xfb')});db['VoiceCallReport'][_0x03f0('0x137')](db[_0x03f0('0x6f')],{'as':_0x03f0('0x148'),'foreignKey':'ContactId'});db[_0x03f0('0x149')][_0x03f0('0x137')](db[_0x03f0('0x37')],{'as':_0x03f0('0x37'),'foreignKey':'MailAccountId'});db[_0x03f0('0x14a')][_0x03f0('0x137')](db[_0x03f0('0x37')],{'as':_0x03f0('0x37'),'foreignKey':_0x03f0('0x14b')});db[_0x03f0('0x37')][_0x03f0('0xfa')](db[_0x03f0('0x149')],{'as':'Imap','onDelete':'cascade'});db['MailAccount'][_0x03f0('0xfa')](db[_0x03f0('0x14a')],{'as':_0x03f0('0x14c'),'onDelete':_0x03f0('0x100')});db['MailAccount'][_0x03f0('0xfd')](db['Disposition'],{'as':_0x03f0('0x14d'),'foreignKey':'MailAccountId','onDelete':_0x03f0('0x100')});db[_0x03f0('0x37')][_0x03f0('0xfd')](db[_0x03f0('0x7b')],{'as':_0x03f0('0x14e'),'foreignKey':_0x03f0('0x14b')});db[_0x03f0('0x37')][_0x03f0('0xfd')](db['MailMessage'],{'as':_0x03f0('0x14f'),'foreignKey':_0x03f0('0x14b')});db['MailAccount'][_0x03f0('0xfd')](db[_0x03f0('0x3c')],{'as':'Interactions'});db['MailAccount']['hasMany'](db['MailApplication'],{'as':_0x03f0('0x130')});db[_0x03f0('0x37')][_0x03f0('0x137')](db['CmList'],{'as':'List','foreignKey':_0x03f0('0x150')});db[_0x03f0('0x37')][_0x03f0('0x137')](db[_0x03f0('0x89')],{'as':_0x03f0('0x89'),'foreignKey':_0x03f0('0x151')});db[_0x03f0('0x37')][_0x03f0('0x137')](db[_0x03f0('0x152')],{'as':_0x03f0('0x13a'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x03f0('0x37')][_0x03f0('0x10d')](db[_0x03f0('0x11')],{'as':'Agents','through':_0x03f0('0x124')});db[_0x03f0('0x39')][_0x03f0('0x10d')](db[_0x03f0('0x11')],{'as':_0x03f0('0x13d'),'through':'UserMailQueue'});db[_0x03f0('0x39')][_0x03f0('0x10d')](db[_0x03f0('0xd5')],{'through':_0x03f0('0x153'),'as':'Teams'});db[_0x03f0('0x3c')]['hasMany'](db[_0x03f0('0x3d')],{'as':_0x03f0('0x14f'),'onDelete':_0x03f0('0x100'),'foreignKey':_0x03f0('0x154')});db[_0x03f0('0x3c')][_0x03f0('0x137')](db[_0x03f0('0x37')],{'as':_0x03f0('0x155'),'foreignKey':'MailAccountId'});db[_0x03f0('0x3c')]['belongsTo'](db['CmContact'],{'as':_0x03f0('0x148'),'foreignKey':'ContactId'});db[_0x03f0('0x3c')][_0x03f0('0x137')](db[_0x03f0('0x11')],{'as':_0x03f0('0x156'),'foreignKey':_0x03f0('0xfb')});db[_0x03f0('0x3c')][_0x03f0('0x10d')](db[_0x03f0('0x87')],{'through':'mail_interaction_has_tags','as':_0x03f0('0x157')});db['MailInteraction'][_0x03f0('0x10d')](db['Tag'],{'through':_0x03f0('0x158'),'as':_0x03f0('0x159')});db['MailInteraction'][_0x03f0('0x10d')](db[_0x03f0('0x11')],{'as':_0x03f0('0x15a'),'through':_0x03f0('0x113'),'foreignKey':'MailInteractionId'});db[_0x03f0('0x3d')]['hasMany'](db[_0x03f0('0xdc')],{'as':_0x03f0('0x15b'),'onDelete':_0x03f0('0x100')});db[_0x03f0('0x3d')][_0x03f0('0x137')](db[_0x03f0('0x11')],{'as':'User'});db[_0x03f0('0x3d')]['belongsTo'](db['CmContact'],{'onDelete':'cascade','as':_0x03f0('0x148')});db['MailMessage'][_0x03f0('0x137')](db[_0x03f0('0x3c')],{'as':_0x03f0('0x15c'),'foreignKey':_0x03f0('0x154')});db[_0x03f0('0x3d')][_0x03f0('0x137')](db[_0x03f0('0x37')],{'as':_0x03f0('0x155'),'foreignKey':_0x03f0('0x14b')});db[_0x03f0('0x3d')][_0x03f0('0x137')](db[_0x03f0('0x120')],{'as':_0x03f0('0x120'),'foreignKey':_0x03f0('0x15d')});db['MailMessage'][_0x03f0('0x137')](db['ChatOfflineMessage'],{'as':_0x03f0('0x66'),'foreignKey':_0x03f0('0x15e')});db['MailApplication'][_0x03f0('0x137')](db[_0x03f0('0x11')],{'onDelete':'restrict'});db[_0x03f0('0x3f')]['belongsTo'](db[_0x03f0('0x39')],{'onDelete':_0x03f0('0x15f')});db[_0x03f0('0x3f')][_0x03f0('0x137')](db['MailAccount'],{'onDelete':'restrict'});db['MailApplication'][_0x03f0('0x137')](db[_0x03f0('0x7f')],{'onDelete':_0x03f0('0x15f'),'foreignKey':_0x03f0('0x160')});db[_0x03f0('0x3f')]['belongsTo'](db['Tag'],{'onDelete':_0x03f0('0x15f'),'foreignKey':_0x03f0('0x161')});db['MailQueueReport'][_0x03f0('0x137')](db['MailAccount'],{});db['MailQueueReport'][_0x03f0('0x137')](db[_0x03f0('0x10f')],{'as':_0x03f0('0x162'),'foreignKey':'ListId'});db[_0x03f0('0x41')]['belongsTo'](db[_0x03f0('0x6f')],{'as':'Contact','foreignKey':'ContactId'});db['MailQueueReport']['belongsTo'](db[_0x03f0('0x3c')],{});db[_0x03f0('0x41')][_0x03f0('0x137')](db[_0x03f0('0x3d')],{});db[_0x03f0('0x41')][_0x03f0('0x137')](db[_0x03f0('0x11')],{});db[_0x03f0('0x41')][_0x03f0('0x137')](db['MailQueue'],{});db['Dashboard'][_0x03f0('0xfd')](db[_0x03f0('0x43')],{'as':'Items','onDelete':_0x03f0('0x100')});db[_0x03f0('0x45')][_0x03f0('0xfd')](db[_0x03f0('0x7c')],{'as':_0x03f0('0x14d'),'foreignKey':'FaxAccountId','onDelete':_0x03f0('0x100')});db['FaxAccount'][_0x03f0('0xfd')](db['CannedAnswer'],{'as':'Answers','foreignKey':'FaxAccountId'});db[_0x03f0('0x45')]['hasMany'](db['FaxInteraction'],{'as':_0x03f0('0x163')});db[_0x03f0('0x45')]['hasMany'](db[_0x03f0('0x47')],{'as':_0x03f0('0x130')});db[_0x03f0('0x45')]['hasMany'](db[_0x03f0('0x12f')],{'as':'Exntensions','onDelete':_0x03f0('0x100')});db[_0x03f0('0x45')][_0x03f0('0xfd')](db['FaxMessage'],{'as':_0x03f0('0x14f')});db[_0x03f0('0x45')][_0x03f0('0x137')](db[_0x03f0('0x25')],{'as':'Trunk'});db['FaxAccount'][_0x03f0('0x137')](db['CmList'],{'as':_0x03f0('0x162'),'foreignKey':_0x03f0('0x150')});db[_0x03f0('0x45')][_0x03f0('0x137')](db['Pause'],{'as':_0x03f0('0x13a'),'foreignKey':_0x03f0('0x13b')});db[_0x03f0('0x45')][_0x03f0('0x10d')](db[_0x03f0('0x11')],{'as':_0x03f0('0x13d'),'through':_0x03f0('0x123')});db[_0x03f0('0x47')]['belongsTo'](db[_0x03f0('0x11')],{'onDelete':_0x03f0('0x15f')});db[_0x03f0('0x47')][_0x03f0('0x137')](db[_0x03f0('0x4d')],{'onDelete':_0x03f0('0x15f')});db['FaxApplication'][_0x03f0('0x137')](db[_0x03f0('0x45')],{'onDelete':_0x03f0('0x15f')});db[_0x03f0('0x47')][_0x03f0('0x137')](db[_0x03f0('0x87')],{'onDelete':'restrict','foreignKey':_0x03f0('0x161')});db[_0x03f0('0x49')]['hasMany'](db['FaxMessage'],{'as':_0x03f0('0x14f'),'onDelete':_0x03f0('0x100'),'foreignKey':_0x03f0('0x164')});db['FaxInteraction'][_0x03f0('0x137')](db[_0x03f0('0x45')],{'as':_0x03f0('0x155'),'foreignKey':_0x03f0('0x165')});db[_0x03f0('0x49')][_0x03f0('0x137')](db[_0x03f0('0x6f')],{'as':_0x03f0('0x148'),'foreignKey':_0x03f0('0x166')});db[_0x03f0('0x49')]['belongsTo'](db[_0x03f0('0x11')],{'as':_0x03f0('0x156'),'foreignKey':_0x03f0('0xfb')});db[_0x03f0('0x49')][_0x03f0('0x10d')](db[_0x03f0('0x87')],{'through':_0x03f0('0x167'),'as':_0x03f0('0x157')});db[_0x03f0('0x49')]['belongsToMany'](db[_0x03f0('0x87')],{'through':_0x03f0('0x167'),'as':_0x03f0('0x159')});db[_0x03f0('0x49')][_0x03f0('0x10d')](db[_0x03f0('0x11')],{'as':_0x03f0('0x15a'),'through':_0x03f0('0x115'),'foreignKey':_0x03f0('0x164')});db['FaxMessage'][_0x03f0('0x137')](db[_0x03f0('0x11')],{'onDelete':_0x03f0('0x100'),'as':_0x03f0('0x11')});db[_0x03f0('0x4b')][_0x03f0('0x137')](db[_0x03f0('0x49')],{'as':_0x03f0('0x15c'),'foreignKey':'FaxInteractionId'});db[_0x03f0('0x4b')][_0x03f0('0x137')](db[_0x03f0('0x6f')],{'onDelete':'cascade','as':_0x03f0('0x148')});db['FaxMessage']['belongsTo'](db['Attachment'],{'as':_0x03f0('0xdc'),'foreignKey':'AttachmentId'});db[_0x03f0('0x4b')]['belongsTo'](db[_0x03f0('0x45')],{'as':_0x03f0('0x155'),'foreignKey':_0x03f0('0x165')});db[_0x03f0('0x4d')][_0x03f0('0x10d')](db[_0x03f0('0x11')],{'as':_0x03f0('0x13d'),'through':_0x03f0('0x2d')});db['FaxQueue'][_0x03f0('0x10d')](db[_0x03f0('0xd5')],{'through':_0x03f0('0x168'),'as':_0x03f0('0x169')});db['FaxQueueReport'][_0x03f0('0x137')](db[_0x03f0('0x45')],{});db[_0x03f0('0x4f')]['belongsTo'](db[_0x03f0('0x10f')],{'as':_0x03f0('0x162'),'foreignKey':_0x03f0('0x150')});db[_0x03f0('0x4f')][_0x03f0('0x137')](db[_0x03f0('0x6f')],{'as':_0x03f0('0x148'),'foreignKey':'ContactId'});db[_0x03f0('0x4f')]['belongsTo'](db[_0x03f0('0x49')],{});db['FaxQueueReport'][_0x03f0('0x137')](db['FaxMessage'],{});db['FaxQueueReport']['belongsTo'](db['User'],{});db[_0x03f0('0x4f')][_0x03f0('0x137')](db[_0x03f0('0x4d')],{});db[_0x03f0('0x126')][_0x03f0('0xfd')](db[_0x03f0('0x7c')],{'as':_0x03f0('0x14d'),'foreignKey':_0x03f0('0x16a'),'onDelete':_0x03f0('0x100')});db[_0x03f0('0x126')][_0x03f0('0xfd')](db['CannedAnswer'],{'as':_0x03f0('0x14e'),'foreignKey':_0x03f0('0x16a')});db[_0x03f0('0x126')][_0x03f0('0xfd')](db[_0x03f0('0x16b')],{'as':_0x03f0('0x14f'),'foreignKey':_0x03f0('0x16a')});db[_0x03f0('0x126')][_0x03f0('0xfd')](db[_0x03f0('0x53')],{'as':_0x03f0('0x163')});db[_0x03f0('0x126')][_0x03f0('0xfd')](db[_0x03f0('0x51')],{'as':'Applications'});db['SmsAccount'][_0x03f0('0x137')](db[_0x03f0('0x10f')],{'as':'List','foreignKey':_0x03f0('0x150')});db['SmsAccount'][_0x03f0('0x137')](db[_0x03f0('0x152')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x03f0('0x126')][_0x03f0('0x10d')](db[_0x03f0('0x11')],{'as':_0x03f0('0x13d'),'through':_0x03f0('0x128')});db[_0x03f0('0x51')]['belongsTo'](db[_0x03f0('0x11')],{'onDelete':'restrict'});db[_0x03f0('0x51')][_0x03f0('0x137')](db[_0x03f0('0x55')],{'onDelete':_0x03f0('0x15f')});db[_0x03f0('0x51')][_0x03f0('0x137')](db[_0x03f0('0x126')],{'onDelete':_0x03f0('0x15f')});db['SmsApplication'][_0x03f0('0x137')](db[_0x03f0('0x7f')],{'onDelete':_0x03f0('0x15f'),'foreignKey':_0x03f0('0x160')});db[_0x03f0('0x51')]['belongsTo'](db['Tag'],{'onDelete':'restrict','foreignKey':_0x03f0('0x161')});db['SmsInteraction'][_0x03f0('0xfd')](db['SmsMessage'],{'as':_0x03f0('0x14f'),'onDelete':_0x03f0('0x100'),'foreignKey':'SmsInteractionId'});db['SmsInteraction'][_0x03f0('0x137')](db[_0x03f0('0x126')],{'as':'Account','foreignKey':'SmsAccountId'});db[_0x03f0('0x53')][_0x03f0('0x137')](db[_0x03f0('0x6f')],{'as':'Contact','foreignKey':'ContactId'});db[_0x03f0('0x53')][_0x03f0('0x137')](db[_0x03f0('0x11')],{'as':_0x03f0('0x156'),'foreignKey':_0x03f0('0xfb')});db[_0x03f0('0x53')][_0x03f0('0x10d')](db[_0x03f0('0x87')],{'through':_0x03f0('0x16c'),'as':_0x03f0('0x157')});db[_0x03f0('0x53')][_0x03f0('0x10d')](db[_0x03f0('0x87')],{'through':_0x03f0('0x16c'),'as':_0x03f0('0x159')});db[_0x03f0('0x53')][_0x03f0('0x10d')](db['User'],{'as':'Users','through':'user_has_sms_interactions','foreignKey':_0x03f0('0x16d')});db[_0x03f0('0x16b')][_0x03f0('0x137')](db[_0x03f0('0x11')],{'as':_0x03f0('0x11')});db[_0x03f0('0x16b')]['belongsTo'](db[_0x03f0('0x6f')],{'onDelete':'cascade','as':_0x03f0('0x148')});db[_0x03f0('0x16b')][_0x03f0('0x137')](db[_0x03f0('0x53')],{'onDelete':_0x03f0('0x100'),'as':_0x03f0('0x15c'),'foreignKey':'SmsInteractionId'});db[_0x03f0('0x16b')][_0x03f0('0x137')](db[_0x03f0('0x126')],{'as':'Account','foreignKey':_0x03f0('0x16a')});db[_0x03f0('0x55')][_0x03f0('0x10d')](db[_0x03f0('0x11')],{'as':_0x03f0('0x13d'),'through':_0x03f0('0x2f'),'foreignKey':_0x03f0('0x16e')});db[_0x03f0('0x55')][_0x03f0('0x10d')](db[_0x03f0('0xd5')],{'through':_0x03f0('0x16f'),'as':_0x03f0('0x169')});db[_0x03f0('0x56')]['hasMany'](db[_0x03f0('0x7c')],{'as':_0x03f0('0x14d'),'foreignKey':_0x03f0('0x170'),'onDelete':_0x03f0('0x100')});db[_0x03f0('0x56')][_0x03f0('0xfd')](db[_0x03f0('0x7b')],{'as':_0x03f0('0x14e'),'foreignKey':'OpenchannelAccountId'});db[_0x03f0('0x56')][_0x03f0('0xfd')](db[_0x03f0('0x5a')],{'as':_0x03f0('0x163'),'foreignKey':_0x03f0('0x170')});db['OpenchannelAccount'][_0x03f0('0xfd')](db[_0x03f0('0x5c')],{'as':_0x03f0('0x14f'),'foreignKey':_0x03f0('0x170')});db[_0x03f0('0x56')][_0x03f0('0xfd')](db[_0x03f0('0x58')],{'as':_0x03f0('0x130'),'foreignKey':_0x03f0('0x170')});db[_0x03f0('0x56')][_0x03f0('0x137')](db[_0x03f0('0x10f')],{'as':_0x03f0('0x162'),'foreignKey':_0x03f0('0x150')});db[_0x03f0('0x56')][_0x03f0('0x137')](db[_0x03f0('0x152')],{'as':_0x03f0('0x13a'),'foreignKey':_0x03f0('0x13b')});db[_0x03f0('0x56')][_0x03f0('0x10d')](db[_0x03f0('0x11')],{'as':_0x03f0('0x13d'),'through':_0x03f0('0x171')});db[_0x03f0('0x58')][_0x03f0('0x137')](db[_0x03f0('0x11')],{'onDelete':'restrict'});db[_0x03f0('0x58')][_0x03f0('0x137')](db[_0x03f0('0x5e')],{'onDelete':'restrict','foreignKey':_0x03f0('0x172')});db['OpenchannelApplication'][_0x03f0('0x137')](db[_0x03f0('0x56')],{'onDelete':_0x03f0('0x15f'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelApplication']['belongsTo'](db[_0x03f0('0x7f')],{'onDelete':_0x03f0('0x15f'),'foreignKey':_0x03f0('0x160')});db['OpenchannelApplication'][_0x03f0('0x137')](db[_0x03f0('0x87')],{'onDelete':_0x03f0('0x15f'),'foreignKey':_0x03f0('0x161')});db[_0x03f0('0x5a')][_0x03f0('0xfd')](db[_0x03f0('0x5c')],{'as':_0x03f0('0x14f'),'onDelete':'cascade','foreignKey':_0x03f0('0x173')});db['OpenchannelInteraction'][_0x03f0('0x137')](db[_0x03f0('0x56')],{'as':_0x03f0('0x155'),'foreignKey':_0x03f0('0x170')});db[_0x03f0('0x5a')]['belongsTo'](db[_0x03f0('0x6f')],{'as':'Contact','foreignKey':_0x03f0('0x166')});db[_0x03f0('0x5a')][_0x03f0('0x137')](db['User'],{'as':'Owner','foreignKey':'UserId'});db[_0x03f0('0x5a')][_0x03f0('0x10d')](db['Tag'],{'through':_0x03f0('0x174'),'as':_0x03f0('0x157')});db[_0x03f0('0x5a')]['belongsToMany'](db[_0x03f0('0x87')],{'through':'openchannel_interaction_has_tags','as':'ThroughTags'});db['OpenchannelInteraction'][_0x03f0('0x10d')](db[_0x03f0('0x11')],{'as':'Users','through':_0x03f0('0x117'),'foreignKey':'OpenchannelInteractionId'});db[_0x03f0('0x5c')][_0x03f0('0x137')](db['User'],{'onDelete':_0x03f0('0x100'),'as':'User'});db[_0x03f0('0x5c')][_0x03f0('0x137')](db[_0x03f0('0x6f')],{'onDelete':'cascade','as':_0x03f0('0x148')});db[_0x03f0('0x5c')][_0x03f0('0x137')](db[_0x03f0('0x5a')],{'onDelete':_0x03f0('0x100'),'as':_0x03f0('0x15c'),'foreignKey':_0x03f0('0x173')});db[_0x03f0('0x5c')][_0x03f0('0x137')](db[_0x03f0('0xdc')],{'as':_0x03f0('0xdc'),'foreignKey':_0x03f0('0x175')});db['OpenchannelMessage'][_0x03f0('0x137')](db[_0x03f0('0x56')],{'as':_0x03f0('0x155'),'foreignKey':_0x03f0('0x170')});db[_0x03f0('0x5e')]['belongsToMany'](db[_0x03f0('0x11')],{'as':_0x03f0('0x13d'),'through':_0x03f0('0x31'),'foreignKey':_0x03f0('0x172')});db[_0x03f0('0x5e')]['belongsToMany'](db[_0x03f0('0xd5')],{'through':_0x03f0('0x176'),'as':'Teams'});db[_0x03f0('0x120')][_0x03f0('0xfd')](db[_0x03f0('0x7c')],{'as':'Dispositions','foreignKey':'ChatWebsiteId','onDelete':_0x03f0('0x100')});db[_0x03f0('0x120')]['hasMany'](db[_0x03f0('0x7b')],{'as':'Answers','foreignKey':_0x03f0('0x15d')});db[_0x03f0('0x120')][_0x03f0('0xfd')](db[_0x03f0('0x6b')],{'as':'ProactiveActions'});db[_0x03f0('0x120')][_0x03f0('0xfd')](db[_0x03f0('0x63')],{'as':_0x03f0('0x163')});db[_0x03f0('0x120')][_0x03f0('0xfd')](db[_0x03f0('0x61')],{'as':_0x03f0('0x130')});db['ChatWebsite'][_0x03f0('0xfd')](db[_0x03f0('0x64')],{'as':'Messages'});db['ChatWebsite'][_0x03f0('0x137')](db[_0x03f0('0x10f')],{'as':_0x03f0('0x162'),'foreignKey':_0x03f0('0x150')});db[_0x03f0('0x120')][_0x03f0('0x137')](db[_0x03f0('0x7f')],{'as':_0x03f0('0x7f'),'foreignKey':_0x03f0('0x160')});db[_0x03f0('0x120')][_0x03f0('0x137')](db[_0x03f0('0x37')],{'as':'MailAccount','foreignKey':_0x03f0('0x14b')});db['ChatWebsite']['belongsTo'](db[_0x03f0('0x152')],{'as':_0x03f0('0x13a'),'foreignKey':_0x03f0('0x13b')});db[_0x03f0('0x120')]['belongsToMany'](db[_0x03f0('0x11')],{'as':_0x03f0('0x13d'),'through':_0x03f0('0x121')});db[_0x03f0('0x60')][_0x03f0('0x137')](db['OpenchannelAccount'],{});db['OpenchannelQueueReport'][_0x03f0('0x137')](db['CmList'],{'as':_0x03f0('0x162'),'foreignKey':'ListId'});db[_0x03f0('0x60')][_0x03f0('0x137')](db[_0x03f0('0x6f')],{'as':'Contact','foreignKey':_0x03f0('0x166')});db[_0x03f0('0x60')][_0x03f0('0x137')](db[_0x03f0('0x5a')],{});db['OpenchannelQueueReport'][_0x03f0('0x137')](db[_0x03f0('0x5c')],{});db['OpenchannelQueueReport']['belongsTo'](db['User'],{});db['OpenchannelQueueReport']['belongsTo'](db[_0x03f0('0x5e')],{});db[_0x03f0('0x61')][_0x03f0('0x137')](db[_0x03f0('0x11')],{'as':_0x03f0('0x177'),'foreignKey':_0x03f0('0xfb'),'onDelete':_0x03f0('0x15f')});db[_0x03f0('0x61')][_0x03f0('0x137')](db[_0x03f0('0x11b')],{'as':_0x03f0('0x178'),'foreignKey':'ChatQueueId','onDelete':'restrict'});db[_0x03f0('0x61')]['belongsTo'](db['ChatWebsite'],{'as':'Website','foreignKey':'ChatWebsiteId','onDelete':_0x03f0('0x15f')});db[_0x03f0('0x61')]['belongsTo'](db['Tag'],{'onDelete':_0x03f0('0x15f'),'foreignKey':'TagId'});db[_0x03f0('0x63')][_0x03f0('0xfd')](db[_0x03f0('0x64')],{'as':_0x03f0('0x14f'),'onDelete':_0x03f0('0x100'),'foreignKey':_0x03f0('0x179')});db[_0x03f0('0x63')][_0x03f0('0x137')](db[_0x03f0('0x120')],{'as':_0x03f0('0x155'),'foreignKey':_0x03f0('0x15d')});db[_0x03f0('0x63')][_0x03f0('0x137')](db[_0x03f0('0x6f')],{'as':_0x03f0('0x148'),'foreignKey':_0x03f0('0x166')});db[_0x03f0('0x63')]['belongsTo'](db[_0x03f0('0x11')],{'as':_0x03f0('0x156'),'foreignKey':_0x03f0('0xfb')});db[_0x03f0('0x63')][_0x03f0('0x10d')](db[_0x03f0('0x87')],{'through':_0x03f0('0x17a'),'as':_0x03f0('0x157')});db['ChatInteraction'][_0x03f0('0x10d')](db[_0x03f0('0x87')],{'through':_0x03f0('0x17a'),'as':_0x03f0('0x159')});db[_0x03f0('0x63')]['belongsToMany'](db[_0x03f0('0x11')],{'as':_0x03f0('0x15a'),'through':_0x03f0('0x114'),'foreignKey':'ChatInteractionId'});db['ChatMessage'][_0x03f0('0x137')](db[_0x03f0('0x11')],{'onDelete':_0x03f0('0x100'),'as':_0x03f0('0x11')});db[_0x03f0('0x64')][_0x03f0('0x137')](db[_0x03f0('0x6f')],{'onDelete':_0x03f0('0x100'),'as':_0x03f0('0x148'),'foreignKey':_0x03f0('0x166')});db['ChatMessage'][_0x03f0('0x137')](db[_0x03f0('0x63')],{'onDelete':_0x03f0('0x100'),'as':_0x03f0('0x15c'),'foreignKey':'ChatInteractionId'});db['ChatMessage']['belongsTo'](db['Attachment'],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x03f0('0x64')][_0x03f0('0x137')](db[_0x03f0('0x120')],{'as':_0x03f0('0x155'),'foreignKey':_0x03f0('0x15d')});db['ChatOfflineMessage'][_0x03f0('0xfd')](db[_0x03f0('0xdc')],{'as':_0x03f0('0x15b'),'foreignKey':_0x03f0('0x15e'),'onDelete':_0x03f0('0x100'),'hooks':!![]});db['ChatOfflineMessage'][_0x03f0('0x137')](db[_0x03f0('0x6f')],{'onDelete':_0x03f0('0x100'),'as':'Contact','foreignKey':'ContactId'});db['ChatOfflineMessage'][_0x03f0('0x137')](db[_0x03f0('0x120')],{'as':_0x03f0('0x155'),'foreignKey':_0x03f0('0x15d')});db[_0x03f0('0x11b')][_0x03f0('0x10d')](db[_0x03f0('0x11')],{'as':_0x03f0('0x13d'),'through':'UserChatQueue','hooks':!![]});db[_0x03f0('0x11b')][_0x03f0('0x10d')](db[_0x03f0('0xd5')],{'through':'team_has_chat_queues','as':_0x03f0('0x169')});db[_0x03f0('0x69')][_0x03f0('0xfd')](db[_0x03f0('0x17b')],{'as':_0x03f0('0x14f'),'foreignKey':_0x03f0('0x17c'),'onDelete':_0x03f0('0x100')});db['ChatGroup']['belongsToMany'](db[_0x03f0('0x11')],{'as':_0x03f0('0x132'),'through':_0x03f0('0x10c')});db['ChatProactiveAction']['belongsTo'](db[_0x03f0('0x120')],{'as':_0x03f0('0x17d'),'foreignKey':_0x03f0('0x15d')});db[_0x03f0('0x6d')][_0x03f0('0xfd')](db[_0x03f0('0x6f')],{'as':'Contacts','foreignKey':'CompanyId'});db[_0x03f0('0x6f')][_0x03f0('0xfd')](db['CmHopper'],{'as':'Hoppers','foreignKey':_0x03f0('0x166')});db['CmContact'][_0x03f0('0xfd')](db[_0x03f0('0x74')],{'as':_0x03f0('0x135'),'foreignKey':_0x03f0('0x166')});db['CmContact'][_0x03f0('0xfd')](db[_0x03f0('0x76')],{'as':_0x03f0('0x136'),'foreignKey':'ContactId'});db[_0x03f0('0x6f')]['hasMany'](db[_0x03f0('0x77')],{'as':'ReportAgentPreview','foreignKey':_0x03f0('0x166')});db[_0x03f0('0x6f')][_0x03f0('0xfd')](db[_0x03f0('0xc6')],{'as':'JscriptySessions','foreignKey':'ContactId'});db['CmContact'][_0x03f0('0xfd')](db[_0x03f0('0x5a')],{'as':_0x03f0('0x102'),'foreignKey':_0x03f0('0x166'),'onDelete':_0x03f0('0x15f')});db[_0x03f0('0x6f')][_0x03f0('0xfd')](db[_0x03f0('0x63')],{'as':_0x03f0('0x103'),'foreignKey':'ContactId','onDelete':_0x03f0('0x15f')});db[_0x03f0('0x6f')][_0x03f0('0xfd')](db[_0x03f0('0x53')],{'as':_0x03f0('0x104'),'foreignKey':'ContactId','onDelete':'restrict'});db[_0x03f0('0x6f')][_0x03f0('0xfd')](db[_0x03f0('0x49')],{'as':_0x03f0('0x105'),'foreignKey':'ContactId','onDelete':_0x03f0('0x15f')});db[_0x03f0('0x6f')][_0x03f0('0xfd')](db[_0x03f0('0x3c')],{'as':_0x03f0('0x106'),'foreignKey':'ContactId','onDelete':_0x03f0('0x15f')});db[_0x03f0('0x6f')][_0x03f0('0x137')](db['CmCompany'],{'as':_0x03f0('0x17e'),'foreignKey':_0x03f0('0x17f')});db['CmContact'][_0x03f0('0x137')](db[_0x03f0('0x10f')],{'as':_0x03f0('0x162'),'foreignKey':_0x03f0('0x150'),'onDelete':'cascade'});db[_0x03f0('0x6f')]['belongsToMany'](db[_0x03f0('0x11')],{'as':_0x03f0('0x15a'),'through':_0x03f0('0x180')});db[_0x03f0('0x6f')][_0x03f0('0x10d')](db[_0x03f0('0x87')],{'as':_0x03f0('0x157'),'through':_0x03f0('0x181')});db['CmContact'][_0x03f0('0x10d')](db['Tag'],{'through':'cm_contact_has_tags','as':_0x03f0('0x159')});db[_0x03f0('0x133')]['belongsTo'](db[_0x03f0('0x6f')],{'as':_0x03f0('0x148'),'foreignKey':_0x03f0('0x166'),'onDelete':_0x03f0('0x100')});db[_0x03f0('0x133')][_0x03f0('0x137')](db[_0x03f0('0x10f')],{'as':_0x03f0('0x162'),'foreignKey':_0x03f0('0x150'),'onDelete':_0x03f0('0x100')});db['CmHopper'][_0x03f0('0x137')](db[_0x03f0('0x11')],{'as':_0x03f0('0x177'),'foreignKey':_0x03f0('0xfb')});db[_0x03f0('0x133')]['belongsTo'](db[_0x03f0('0x18')],{'as':'Queue','foreignKey':_0x03f0('0x134'),'onDelete':_0x03f0('0x100')});db['CmHopper'][_0x03f0('0x137')](db[_0x03f0('0xd8')],{'as':'Campaign','foreignKey':_0x03f0('0x182'),'onDelete':'cascade'});db[_0x03f0('0x133')]['belongsTo'](db[_0x03f0('0x11')],{'as':_0x03f0('0x156'),'foreignKey':_0x03f0('0x183')});db[_0x03f0('0x72')]['belongsTo'](db[_0x03f0('0x6f')],{'as':_0x03f0('0x148'),'foreignKey':'ContactId','onDelete':_0x03f0('0x100')});db[_0x03f0('0x72')][_0x03f0('0x137')](db['CmList'],{'as':'List','foreignKey':_0x03f0('0x150'),'onDelete':'cascade'});db[_0x03f0('0x72')][_0x03f0('0x137')](db[_0x03f0('0x18')],{'as':'Queue','foreignKey':_0x03f0('0x134'),'onDelete':'cascade'});db[_0x03f0('0x72')]['belongsTo'](db['Campaign'],{'as':_0x03f0('0xd8'),'foreignKey':_0x03f0('0x182'),'onDelete':_0x03f0('0x100')});db['Automation']['hasMany'](db['Condition'],{'as':{'plural':_0x03f0('0x184'),'singular':_0x03f0('0x185')},'foreignKey':_0x03f0('0x186'),'onDelete':'cascade','hooks':!![]});db['Automation']['hasMany'](db['Condition'],{'as':{'plural':_0x03f0('0x187'),'singular':_0x03f0('0x188')},'foreignKey':_0x03f0('0x189'),'onDelete':_0x03f0('0x100'),'hooks':!![]});db[_0x03f0('0x7a')][_0x03f0('0xfd')](db[_0x03f0('0x79')],{'as':_0x03f0('0x18a'),'foreignKey':_0x03f0('0x18b'),'onDelete':'cascade','hooks':!![]});db[_0x03f0('0x7c')]['hasMany'](db[_0x03f0('0x7c')],{'as':_0x03f0('0x14d'),'foreignKey':_0x03f0('0x18c'),'onDelete':_0x03f0('0x100')});db['Interval']['hasMany'](db[_0x03f0('0x7f')],{'as':_0x03f0('0x18d'),'foreignKey':_0x03f0('0x160'),'onDelete':_0x03f0('0x100'),'hooks':!![],'required':![]});db['Interval']['hasMany'](db['VoiceExtension'],{'as':_0x03f0('0xff'),'foreignKey':_0x03f0('0x160'),'onDelete':_0x03f0('0x15f')});db['Interval'][_0x03f0('0xfd')](db['MailApplication'],{'as':_0x03f0('0x18e'),'foreignKey':_0x03f0('0x160')});db[_0x03f0('0x7f')][_0x03f0('0xfd')](db['ChatApplication'],{'as':_0x03f0('0x18f'),'foreignKey':_0x03f0('0x160')});db['Interval'][_0x03f0('0xfd')](db['FaxApplication'],{'as':'FaxApplications','foreignKey':'IntervalId'});db['Interval'][_0x03f0('0xfd')](db[_0x03f0('0x51')],{'as':_0x03f0('0x190'),'foreignKey':'IntervalId'});db[_0x03f0('0x84')][_0x03f0('0x137')](db[_0x03f0('0x37')],{});db[_0x03f0('0x84')][_0x03f0('0x137')](db[_0x03f0('0x191')],{'foreignKey':_0x03f0('0x192')});db['Schedule'][_0x03f0('0x137')](db[_0x03f0('0x90')],{'foreignKey':_0x03f0('0x193')});db[_0x03f0('0x194')][_0x03f0('0x10d')](db[_0x03f0('0x17')],{'as':_0x03f0('0x195'),'through':'moh_has_sounds','onDelete':_0x03f0('0x15f')});db[_0x03f0('0x87')][_0x03f0('0x10d')](db[_0x03f0('0x6f')],{'through':_0x03f0('0x181')});db[_0x03f0('0x87')]['belongsToMany'](db['ChatInteraction'],{'through':_0x03f0('0x17a')});db[_0x03f0('0x87')][_0x03f0('0x10d')](db['MailInteraction'],{'through':'mail_interaction_has_tags'});db[_0x03f0('0x87')]['belongsToMany'](db[_0x03f0('0x53')],{'through':_0x03f0('0x16c')});db[_0x03f0('0x87')][_0x03f0('0x10d')](db[_0x03f0('0x49')],{'through':_0x03f0('0x167')});db['Tag'][_0x03f0('0x10d')](db[_0x03f0('0x5a')],{'through':_0x03f0('0x174')});db[_0x03f0('0x87')][_0x03f0('0x10d')](db[_0x03f0('0x107')],{'through':_0x03f0('0x196')});db[_0x03f0('0x197')]['hasMany'](db[_0x03f0('0x7e')],{'as':{'plural':_0x03f0('0x198'),'singular':_0x03f0('0x199')},'foreignKey':'TriggerAllId','onDelete':_0x03f0('0x100'),'hooks':!![]});db[_0x03f0('0x197')]['hasMany'](db[_0x03f0('0x7e')],{'as':{'plural':_0x03f0('0x19a'),'singular':'AnyCondition'},'foreignKey':'TriggerAnyId','onDelete':_0x03f0('0x100'),'hooks':!![]});db[_0x03f0('0x197')][_0x03f0('0xfd')](db['Action'],{'as':_0x03f0('0x18a'),'foreignKey':_0x03f0('0x19b'),'onDelete':_0x03f0('0x100'),'hooks':!![]});db[_0x03f0('0x90')]['hasMany'](db[_0x03f0('0x19c')],{'as':_0x03f0('0x19d'),'onDelete':_0x03f0('0x100'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport']['hasMany'](db[_0x03f0('0x19c')],{'as':_0x03f0('0x19d'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x03f0('0x94')]['hasMany'](db[_0x03f0('0x19c')],{'as':_0x03f0('0x19d'),'onDelete':_0x03f0('0x100'),'foreignKey':_0x03f0('0x19e')});db[_0x03f0('0x19c')][_0x03f0('0x137')](db[_0x03f0('0x94')],{'foreignKey':_0x03f0('0x19e')});db[_0x03f0('0x97')][_0x03f0('0xfd')](db[_0x03f0('0x19f')],{'as':_0x03f0('0x1a0'),'onDelete':_0x03f0('0x100'),'foreignKey':'AccountId'});db[_0x03f0('0x19f')][_0x03f0('0xfd')](db['SalesforceField'],{'as':'Subjects','onDelete':_0x03f0('0x100'),'foreignKey':_0x03f0('0x1a1')});db[_0x03f0('0x19f')][_0x03f0('0xfd')](db[_0x03f0('0x99')],{'as':'Descriptions','onDelete':'cascade','foreignKey':'DescriptionId'});db['SalesforceConfiguration'][_0x03f0('0xfd')](db['SalesforceField'],{'as':_0x03f0('0x19d'),'onDelete':_0x03f0('0x100'),'foreignKey':_0x03f0('0x1a2')});db['SalesforceConfiguration'][_0x03f0('0x137')](db[_0x03f0('0x97')],{'as':_0x03f0('0x155'),'foreignKey':_0x03f0('0x1a3')});db[_0x03f0('0x99')][_0x03f0('0xfd')](db[_0x03f0('0x99')],{'as':_0x03f0('0x1a4'),'foreignKey':'SubjectId'});db[_0x03f0('0x99')][_0x03f0('0xfd')](db[_0x03f0('0x99')],{'as':_0x03f0('0x1a5'),'foreignKey':_0x03f0('0x1a6')});db[_0x03f0('0x99')][_0x03f0('0xfd')](db[_0x03f0('0x99')],{'as':'Field','foreignKey':_0x03f0('0x1a2')});db[_0x03f0('0x99')][_0x03f0('0x137')](db[_0x03f0('0x8b')],{'as':_0x03f0('0x8b'),'foreignKey':_0x03f0('0x1a7')});db[_0x03f0('0x9b')]['hasMany'](db[_0x03f0('0x1a8')],{'as':_0x03f0('0x1a0'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x03f0('0x1a8')][_0x03f0('0xfd')](db[_0x03f0('0x9d')],{'as':_0x03f0('0x1a9'),'onDelete':_0x03f0('0x100'),'foreignKey':_0x03f0('0x1a1')});db[_0x03f0('0x1a8')][_0x03f0('0xfd')](db[_0x03f0('0x9d')],{'as':'Descriptions','onDelete':_0x03f0('0x100'),'foreignKey':'DescriptionId'});db['SugarcrmConfiguration'][_0x03f0('0xfd')](db[_0x03f0('0x9d')],{'as':_0x03f0('0x19d'),'onDelete':_0x03f0('0x100'),'foreignKey':_0x03f0('0x1a2')});db[_0x03f0('0x1a8')][_0x03f0('0x137')](db[_0x03f0('0x9b')],{'as':_0x03f0('0x155'),'foreignKey':_0x03f0('0x1a3')});db[_0x03f0('0x9d')][_0x03f0('0xfd')](db['SugarcrmField'],{'as':_0x03f0('0x1a4'),'foreignKey':'SubjectId'});db['SugarcrmField']['hasMany'](db[_0x03f0('0x9d')],{'as':_0x03f0('0x1a5'),'foreignKey':'DescriptionId'});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0x03f0('0x1aa'),'foreignKey':_0x03f0('0x1a2')});db[_0x03f0('0x9d')]['belongsTo'](db['Variable'],{'as':_0x03f0('0x8b'),'foreignKey':'VariableId'});db['DeskAccount'][_0x03f0('0xfd')](db[_0x03f0('0x9f')],{'as':_0x03f0('0x1a0'),'onDelete':_0x03f0('0x100'),'foreignKey':_0x03f0('0x1a3')});db['DeskConfiguration']['hasMany'](db[_0x03f0('0xa0')],{'as':'Subjects','onDelete':_0x03f0('0x100'),'foreignKey':_0x03f0('0x1a1')});db[_0x03f0('0x9f')][_0x03f0('0xfd')](db[_0x03f0('0xa0')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x03f0('0x1a6')});db['DeskConfiguration']['hasMany'](db[_0x03f0('0xa0')],{'as':'Fields','onDelete':'cascade','foreignKey':'FieldId'});db[_0x03f0('0x9f')][_0x03f0('0x137')](db[_0x03f0('0x1ab')],{'as':_0x03f0('0x155'),'foreignKey':_0x03f0('0x1a3')});db[_0x03f0('0x9f')][_0x03f0('0x10d')](db[_0x03f0('0x87')],{'through':_0x03f0('0x1ac')});db[_0x03f0('0xa0')][_0x03f0('0xfd')](db[_0x03f0('0xa0')],{'as':'Subject','foreignKey':_0x03f0('0x1a1')});db['DeskField'][_0x03f0('0xfd')](db[_0x03f0('0xa0')],{'as':_0x03f0('0x1a5'),'foreignKey':_0x03f0('0x1a6')});db[_0x03f0('0xa0')][_0x03f0('0xfd')](db[_0x03f0('0xa0')],{'as':'Field','foreignKey':_0x03f0('0x1a2')});db[_0x03f0('0xa0')][_0x03f0('0x137')](db[_0x03f0('0x8b')],{'as':_0x03f0('0x8b'),'foreignKey':_0x03f0('0x1a7')});db[_0x03f0('0xa2')]['hasMany'](db['ZohoConfiguration'],{'as':_0x03f0('0x1a0'),'onDelete':'cascade','foreignKey':_0x03f0('0x1a3')});db[_0x03f0('0x1ad')][_0x03f0('0xfd')](db['ZohoField'],{'as':_0x03f0('0x1a9'),'onDelete':'cascade','foreignKey':_0x03f0('0x1a1')});db['ZohoConfiguration'][_0x03f0('0xfd')](db['ZohoField'],{'as':_0x03f0('0x1ae'),'onDelete':_0x03f0('0x100'),'foreignKey':'DescriptionId'});db[_0x03f0('0x1ad')][_0x03f0('0xfd')](db[_0x03f0('0xa4')],{'as':'Fields','onDelete':_0x03f0('0x100'),'foreignKey':'FieldId'});db[_0x03f0('0x1ad')][_0x03f0('0x137')](db[_0x03f0('0xa2')],{'as':_0x03f0('0x155'),'foreignKey':'AccountId'});db['ZohoField'][_0x03f0('0xfd')](db[_0x03f0('0xa4')],{'as':_0x03f0('0x1a4'),'foreignKey':_0x03f0('0x1a1')});db[_0x03f0('0xa4')][_0x03f0('0xfd')](db[_0x03f0('0xa4')],{'as':_0x03f0('0x1a5'),'foreignKey':_0x03f0('0x1a6')});db[_0x03f0('0xa4')][_0x03f0('0xfd')](db[_0x03f0('0xa4')],{'as':_0x03f0('0x1aa'),'foreignKey':_0x03f0('0x1a2')});db['ZohoField']['belongsTo'](db[_0x03f0('0x8b')],{'as':_0x03f0('0x8b'),'foreignKey':'VariableId'});db[_0x03f0('0xa5')][_0x03f0('0xfd')](db[_0x03f0('0x1af')],{'as':_0x03f0('0x1a0'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x03f0('0x1af')]['hasMany'](db[_0x03f0('0xa7')],{'as':'Subjects','foreignKey':_0x03f0('0x1a1')});db[_0x03f0('0x1af')]['hasMany'](db['ZendeskField'],{'as':_0x03f0('0x1ae'),'foreignKey':_0x03f0('0x1a6')});db[_0x03f0('0x1af')]['hasMany'](db['ZendeskField'],{'as':_0x03f0('0x19d'),'foreignKey':'FieldId'});db['ZendeskConfiguration'][_0x03f0('0x137')](db[_0x03f0('0xa5')],{'as':_0x03f0('0x155'),'foreignKey':_0x03f0('0x1a3')});db[_0x03f0('0x1af')][_0x03f0('0x10d')](db['Tag'],{'through':_0x03f0('0x1b0')});db[_0x03f0('0xa7')][_0x03f0('0xfd')](db[_0x03f0('0xa7')],{'as':'Subject','foreignKey':'SubjectId'});db['ZendeskField'][_0x03f0('0xfd')](db[_0x03f0('0xa7')],{'as':'Description','foreignKey':'DescriptionId'});db['ZendeskField'][_0x03f0('0xfd')](db[_0x03f0('0xa7')],{'as':_0x03f0('0x1aa'),'foreignKey':'FieldId'});db[_0x03f0('0xa7')][_0x03f0('0x137')](db[_0x03f0('0x8b')],{'as':_0x03f0('0x8b'),'foreignKey':'VariableId'});db[_0x03f0('0xa9')]['hasMany'](db[_0x03f0('0xaa')],{'as':_0x03f0('0x1a0'),'onDelete':_0x03f0('0x100'),'foreignKey':_0x03f0('0x1a3')});db[_0x03f0('0xaa')]['hasMany'](db[_0x03f0('0x1b1')],{'as':_0x03f0('0x1a9'),'onDelete':_0x03f0('0x100'),'foreignKey':'SubjectId'});db[_0x03f0('0xaa')][_0x03f0('0xfd')](db[_0x03f0('0x1b1')],{'as':_0x03f0('0x1ae'),'onDelete':_0x03f0('0x100'),'foreignKey':_0x03f0('0x1a6')});db['FreshdeskConfiguration'][_0x03f0('0xfd')](db[_0x03f0('0x1b1')],{'as':_0x03f0('0x19d'),'onDelete':_0x03f0('0x100'),'foreignKey':_0x03f0('0x1a2')});db[_0x03f0('0xaa')][_0x03f0('0x137')](db['FreshdeskAccount'],{'as':_0x03f0('0x155'),'foreignKey':_0x03f0('0x1a3')});db['FreshdeskConfiguration'][_0x03f0('0x10d')](db[_0x03f0('0x87')],{'through':'int_freshdesk_configuration_has_tags'});db[_0x03f0('0x1b1')][_0x03f0('0xfd')](db[_0x03f0('0x1b1')],{'as':'Subject','foreignKey':_0x03f0('0x1a1')});db['FreshdeskField']['hasMany'](db['FreshdeskField'],{'as':_0x03f0('0x1a5'),'foreignKey':_0x03f0('0x1a6')});db[_0x03f0('0x1b1')][_0x03f0('0xfd')](db[_0x03f0('0x1b1')],{'as':_0x03f0('0x1aa'),'foreignKey':_0x03f0('0x1a2')});db[_0x03f0('0x1b1')][_0x03f0('0x137')](db[_0x03f0('0x8b')],{'as':'Variable','foreignKey':'VariableId'});db[_0x03f0('0xad')][_0x03f0('0xfd')](db['VtigerConfiguration'],{'as':'Configurations','onDelete':_0x03f0('0x100'),'foreignKey':_0x03f0('0x1a3')});db[_0x03f0('0xae')]['hasMany'](db['VtigerField'],{'as':_0x03f0('0x1a9'),'foreignKey':'SubjectId'});db['VtigerConfiguration'][_0x03f0('0xfd')](db[_0x03f0('0xb0')],{'as':_0x03f0('0x1ae'),'foreignKey':_0x03f0('0x1a6')});db[_0x03f0('0xae')][_0x03f0('0xfd')](db[_0x03f0('0xb0')],{'as':_0x03f0('0x19d'),'foreignKey':_0x03f0('0x1a2')});db[_0x03f0('0xae')]['belongsTo'](db[_0x03f0('0xad')],{'as':_0x03f0('0x155'),'foreignKey':'AccountId'});db['VtigerField'][_0x03f0('0xfd')](db[_0x03f0('0xb0')],{'as':_0x03f0('0x1a4'),'foreignKey':_0x03f0('0x1a1')});db[_0x03f0('0xb0')][_0x03f0('0xfd')](db[_0x03f0('0xb0')],{'as':_0x03f0('0x1a5'),'foreignKey':_0x03f0('0x1a6')});db[_0x03f0('0xb0')][_0x03f0('0xfd')](db['VtigerField'],{'as':_0x03f0('0x1aa'),'foreignKey':_0x03f0('0x1a2')});db[_0x03f0('0xb0')]['belongsTo'](db[_0x03f0('0x8b')],{'as':_0x03f0('0x8b'),'foreignKey':_0x03f0('0x1a7')});db['ServicenowAccount'][_0x03f0('0xfd')](db['ServicenowConfiguration'],{'as':_0x03f0('0x1a0'),'onDelete':_0x03f0('0x100'),'foreignKey':_0x03f0('0x1a3')});db[_0x03f0('0xb3')]['hasMany'](db['ServicenowField'],{'as':_0x03f0('0x1a9'),'foreignKey':_0x03f0('0x1a1')});db[_0x03f0('0xb3')][_0x03f0('0xfd')](db[_0x03f0('0x1b2')],{'as':'Descriptions','foreignKey':'DescriptionId'});db[_0x03f0('0xb3')]['hasMany'](db[_0x03f0('0x1b2')],{'as':_0x03f0('0x19d'),'foreignKey':_0x03f0('0x1a2')});db[_0x03f0('0xb3')][_0x03f0('0x137')](db[_0x03f0('0xb1')],{'as':_0x03f0('0x155'),'foreignKey':_0x03f0('0x1a3')});db[_0x03f0('0x1b2')][_0x03f0('0xfd')](db[_0x03f0('0x1b2')],{'as':_0x03f0('0x1a4'),'foreignKey':_0x03f0('0x1a1')});db['ServicenowField']['hasMany'](db[_0x03f0('0x1b2')],{'as':_0x03f0('0x1a5'),'foreignKey':_0x03f0('0x1a6')});db[_0x03f0('0x1b2')][_0x03f0('0xfd')](db[_0x03f0('0x1b2')],{'as':_0x03f0('0x1aa'),'foreignKey':_0x03f0('0x1a2')});db['ServicenowField'][_0x03f0('0x137')](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db[_0x03f0('0xb5')]['hasMany'](db['Dynamics365Configuration'],{'as':_0x03f0('0x1a0'),'onDelete':'cascade','foreignKey':_0x03f0('0x1a3')});db[_0x03f0('0x1b3')]['hasMany'](db['Dynamics365Field'],{'as':'Subjects','onDelete':_0x03f0('0x100'),'foreignKey':'SubjectId'});db[_0x03f0('0x1b3')]['hasMany'](db['Dynamics365Field'],{'as':_0x03f0('0x1ae'),'onDelete':_0x03f0('0x100'),'foreignKey':_0x03f0('0x1a6')});db[_0x03f0('0x1b3')][_0x03f0('0xfd')](db[_0x03f0('0x1b4')],{'as':_0x03f0('0x19d'),'onDelete':_0x03f0('0x100'),'foreignKey':_0x03f0('0x1a2')});db['Dynamics365Configuration'][_0x03f0('0x137')](db[_0x03f0('0xb5')],{'as':_0x03f0('0x155'),'foreignKey':_0x03f0('0x1a3')});db[_0x03f0('0x1b4')][_0x03f0('0xfd')](db[_0x03f0('0x1b4')],{'as':_0x03f0('0x1a4'),'foreignKey':_0x03f0('0x1a1')});db[_0x03f0('0x1b4')][_0x03f0('0xfd')](db[_0x03f0('0x1b4')],{'as':_0x03f0('0x1a5'),'foreignKey':_0x03f0('0x1a6')});db['Dynamics365Field'][_0x03f0('0xfd')](db[_0x03f0('0x1b4')],{'as':_0x03f0('0x1aa'),'foreignKey':_0x03f0('0x1a2')});db[_0x03f0('0x1b4')][_0x03f0('0x137')](db[_0x03f0('0x8b')],{'as':'Variable','foreignKey':'VariableId'});db[_0x03f0('0x1b5')]['hasMany'](db[_0x03f0('0x1b6')],{'as':_0x03f0('0x1a0'),'onDelete':_0x03f0('0x100'),'foreignKey':'AccountId'});db[_0x03f0('0x1b6')][_0x03f0('0xfd')](db[_0x03f0('0xbb')],{'as':_0x03f0('0x1a9'),'foreignKey':_0x03f0('0x1a1')});db[_0x03f0('0x1b6')][_0x03f0('0xfd')](db[_0x03f0('0xbb')],{'as':_0x03f0('0x1ae'),'foreignKey':_0x03f0('0x1a6')});db[_0x03f0('0x1b6')][_0x03f0('0xfd')](db[_0x03f0('0xbb')],{'as':_0x03f0('0x19d'),'foreignKey':_0x03f0('0x1a2')});db[_0x03f0('0x1b6')][_0x03f0('0x137')](db['FreshsalesAccount'],{'as':'Account','foreignKey':_0x03f0('0x1a3')});db[_0x03f0('0xbb')][_0x03f0('0xfd')](db[_0x03f0('0xbb')],{'as':'Subject','foreignKey':_0x03f0('0x1a1')});db[_0x03f0('0xbb')][_0x03f0('0xfd')](db[_0x03f0('0xbb')],{'as':_0x03f0('0x1a5'),'foreignKey':_0x03f0('0x1a6')});db[_0x03f0('0xbb')][_0x03f0('0xfd')](db['FreshsalesField'],{'as':_0x03f0('0x1aa'),'foreignKey':_0x03f0('0x1a2')});db[_0x03f0('0xbb')][_0x03f0('0x137')](db[_0x03f0('0x8b')],{'as':_0x03f0('0x8b'),'foreignKey':_0x03f0('0x1a7')});db[_0x03f0('0xbf')][_0x03f0('0x137')](db[_0x03f0('0x120')],{});db[_0x03f0('0xbf')]['belongsTo'](db[_0x03f0('0x10f')],{'as':_0x03f0('0x162'),'foreignKey':_0x03f0('0x150')});db['ChatQueueReport'][_0x03f0('0x137')](db[_0x03f0('0x6f')],{'as':_0x03f0('0x148'),'foreignKey':_0x03f0('0x166')});db[_0x03f0('0xbf')][_0x03f0('0x137')](db[_0x03f0('0x63')],{});db[_0x03f0('0xbf')]['belongsTo'](db[_0x03f0('0x64')],{});db[_0x03f0('0xbf')][_0x03f0('0x137')](db['User'],{});db[_0x03f0('0xbf')]['belongsTo'](db['ChatQueue'],{});db[_0x03f0('0x17b')][_0x03f0('0x137')](db[_0x03f0('0x11')],{'onDelete':'cascade','foreignKey':_0x03f0('0x1b7')});db[_0x03f0('0x17b')]['belongsTo'](db[_0x03f0('0x11')],{'onDelete':_0x03f0('0x100'),'foreignKey':_0x03f0('0x1b8')});db[_0x03f0('0xc6')][_0x03f0('0xfd')](db[_0x03f0('0xc4')],{'foreignKey':_0x03f0('0x1b9'),'onDelete':_0x03f0('0x100')});db[_0x03f0('0xc6')][_0x03f0('0xfd')](db[_0x03f0('0xc2')],{'foreignKey':'SessionId','onDelete':_0x03f0('0x100')});db[_0x03f0('0x1ba')]['belongsTo'](db[_0x03f0('0x126')],{});db['SmsQueueReport'][_0x03f0('0x137')](db[_0x03f0('0x10f')],{'as':_0x03f0('0x162'),'foreignKey':'ListId'});db[_0x03f0('0x1ba')][_0x03f0('0x137')](db[_0x03f0('0x6f')],{'as':_0x03f0('0x148'),'foreignKey':'ContactId'});db[_0x03f0('0x1ba')]['belongsTo'](db[_0x03f0('0x53')],{});db[_0x03f0('0x1ba')]['belongsTo'](db[_0x03f0('0x16b')],{});db[_0x03f0('0x1ba')][_0x03f0('0x137')](db[_0x03f0('0x11')],{});db[_0x03f0('0x1ba')][_0x03f0('0x137')](db[_0x03f0('0x55')],{});db[_0x03f0('0xcc')][_0x03f0('0xfd')](db[_0x03f0('0xc6')],{'foreignKey':_0x03f0('0x1bb')});db[_0x03f0('0xcc')][_0x03f0('0xfd')](db[_0x03f0('0xc4')],{'foreignKey':_0x03f0('0x1bb')});db['JscriptyProject'][_0x03f0('0xfd')](db[_0x03f0('0xc2')],{'foreignKey':_0x03f0('0x1bb')});db[_0x03f0('0xd0')][_0x03f0('0x10d')](db[_0x03f0('0x11')],{'as':_0x03f0('0x15a'),'through':_0x03f0('0x12c')});db[_0x03f0('0xd5')][_0x03f0('0x10d')](db[_0x03f0('0x11')],{'as':_0x03f0('0x13d'),'through':_0x03f0('0x112')});db['Team']['belongsToMany'](db[_0x03f0('0x18')],{'through':_0x03f0('0x13e'),'as':_0x03f0('0x119')});db['Team'][_0x03f0('0x10d')](db[_0x03f0('0x39')],{'through':_0x03f0('0x153'),'as':_0x03f0('0x11a')});db[_0x03f0('0xd5')]['belongsToMany'](db[_0x03f0('0x11b')],{'through':_0x03f0('0x1bc'),'as':_0x03f0('0x11c')});db[_0x03f0('0xd5')][_0x03f0('0x10d')](db['FaxQueue'],{'through':_0x03f0('0x168'),'as':_0x03f0('0x1bd')});db[_0x03f0('0xd5')][_0x03f0('0x10d')](db[_0x03f0('0x55')],{'through':'team_has_sms_queues','as':_0x03f0('0x11d')});db[_0x03f0('0xd5')][_0x03f0('0x10d')](db[_0x03f0('0x5e')],{'through':_0x03f0('0x176'),'as':_0x03f0('0x11e')});db[_0x03f0('0xd5')][_0x03f0('0x10d')](db[_0x03f0('0x1be')],{'through':_0x03f0('0x1bf'),'as':_0x03f0('0x1c0')});db[_0x03f0('0xd8')][_0x03f0('0xfd')](db['CmHopper'],{'as':'Hoppers','foreignKey':_0x03f0('0x182')});db[_0x03f0('0xd8')][_0x03f0('0xfd')](db[_0x03f0('0x74')],{'as':'HopperFinals','foreignKey':_0x03f0('0x182')});db[_0x03f0('0xd8')][_0x03f0('0xfd')](db['CmHopperHistory'],{'as':_0x03f0('0x136'),'foreignKey':_0x03f0('0x182')});db[_0x03f0('0xd8')][_0x03f0('0xfd')](db[_0x03f0('0x72')],{'as':_0x03f0('0x1c1'),'foreignKey':_0x03f0('0x182')});db[_0x03f0('0xd8')][_0x03f0('0x137')](db[_0x03f0('0x25')],{'as':'Trunk','foreignKey':'TrunkId'});db['Campaign'][_0x03f0('0x137')](db[_0x03f0('0x25')],{'as':'TrunkBackup','foreignKey':'TrunkBackupId'});db[_0x03f0('0xd8')][_0x03f0('0x137')](db[_0x03f0('0x7f')],{'as':_0x03f0('0x7f'),'foreignKey':_0x03f0('0x160')});db[_0x03f0('0xd8')]['belongsTo'](db[_0x03f0('0xd0')],{'as':_0x03f0('0xd0'),'foreignKey':_0x03f0('0x1c2')});db[_0x03f0('0xd8')][_0x03f0('0x10d')](db[_0x03f0('0x10f')],{'as':'Lists','through':_0x03f0('0x1c3')});db['Campaign'][_0x03f0('0x10d')](db[_0x03f0('0x10f')],{'as':'BlackLists','through':'campaigns_has_cm_blacklists'});db[_0x03f0('0xdc')]['belongsTo'](db['ChatOfflineMessage'],{'as':_0x03f0('0x66'),'foreignKey':'ChatOfflineMessageId'});db['MailTransferReport'][_0x03f0('0x137')](db[_0x03f0('0x3d')],{});db[_0x03f0('0xdf')][_0x03f0('0x137')](db[_0x03f0('0x3c')],{});db[_0x03f0('0xdf')][_0x03f0('0x137')](db[_0x03f0('0x37')],{'foreignKey':_0x03f0('0x1c4'),'as':_0x03f0('0x1c5')});db[_0x03f0('0xdf')]['belongsTo'](db['User'],{'foreignKey':_0x03f0('0x1c6'),'as':_0x03f0('0x1c7')});db[_0x03f0('0xdf')]['belongsTo'](db[_0x03f0('0x11')],{'foreignKey':_0x03f0('0x1c8'),'as':_0x03f0('0x1c9')});db[_0x03f0('0xdf')]['belongsTo'](db['MailQueue'],{'foreignKey':_0x03f0('0x1ca'),'as':_0x03f0('0x1cb')});db['MailTransferReport'][_0x03f0('0x137')](db[_0x03f0('0x37')],{'foreignKey':_0x03f0('0x1cc'),'as':_0x03f0('0x1cd')});db[_0x03f0('0xe1')][_0x03f0('0x137')](db[_0x03f0('0x64')],{});db[_0x03f0('0xe1')][_0x03f0('0x137')](db[_0x03f0('0x63')],{});db[_0x03f0('0xe1')]['belongsTo'](db[_0x03f0('0x120')],{'foreignKey':'FromChatWebsiteId','as':_0x03f0('0x1c5')});db[_0x03f0('0xe1')][_0x03f0('0x137')](db[_0x03f0('0x11')],{'foreignKey':_0x03f0('0x1c6'),'as':_0x03f0('0x1c7')});db[_0x03f0('0xe1')][_0x03f0('0x137')](db[_0x03f0('0x11')],{'foreignKey':_0x03f0('0x1c8'),'as':'ToAgent'});db[_0x03f0('0xe1')][_0x03f0('0x137')](db[_0x03f0('0x11b')],{'foreignKey':_0x03f0('0x1ce'),'as':_0x03f0('0x1cb')});db[_0x03f0('0xe1')][_0x03f0('0x137')](db[_0x03f0('0x120')],{'foreignKey':_0x03f0('0x1cf'),'as':_0x03f0('0x1cd')});db[_0x03f0('0xe3')]['belongsTo'](db[_0x03f0('0x4b')],{});db[_0x03f0('0xe3')][_0x03f0('0x137')](db[_0x03f0('0x49')],{});db[_0x03f0('0xe3')][_0x03f0('0x137')](db[_0x03f0('0x45')],{'foreignKey':_0x03f0('0x1d0'),'as':_0x03f0('0x1c5')});db['FaxTransferReport']['belongsTo'](db[_0x03f0('0x11')],{'foreignKey':_0x03f0('0x1c6'),'as':_0x03f0('0x1c7')});db[_0x03f0('0xe3')][_0x03f0('0x137')](db['User'],{'foreignKey':_0x03f0('0x1c8'),'as':_0x03f0('0x1c9')});db[_0x03f0('0xe3')][_0x03f0('0x137')](db[_0x03f0('0x4d')],{'foreignKey':_0x03f0('0x1d1'),'as':_0x03f0('0x1cb')});db[_0x03f0('0xe3')][_0x03f0('0x137')](db[_0x03f0('0x45')],{'foreignKey':_0x03f0('0x1d2'),'as':_0x03f0('0x1cd')});db[_0x03f0('0xe4')][_0x03f0('0x137')](db[_0x03f0('0x5c')],{});db[_0x03f0('0xe4')]['belongsTo'](db['OpenchannelInteraction'],{});db[_0x03f0('0xe4')][_0x03f0('0x137')](db[_0x03f0('0x56')],{'foreignKey':_0x03f0('0x1d3'),'as':_0x03f0('0x1c5')});db[_0x03f0('0xe4')][_0x03f0('0x137')](db[_0x03f0('0x11')],{'foreignKey':_0x03f0('0x1c6'),'as':_0x03f0('0x1c7')});db[_0x03f0('0xe4')][_0x03f0('0x137')](db[_0x03f0('0x11')],{'foreignKey':_0x03f0('0x1c8'),'as':_0x03f0('0x1c9')});db['OpenchannelTransferReport']['belongsTo'](db[_0x03f0('0x5e')],{'foreignKey':_0x03f0('0x1d4'),'as':_0x03f0('0x1cb')});db[_0x03f0('0xe4')]['belongsTo'](db[_0x03f0('0x56')],{'foreignKey':_0x03f0('0x1d5'),'as':_0x03f0('0x1cd')});db[_0x03f0('0xe6')][_0x03f0('0x137')](db['SmsMessage'],{});db[_0x03f0('0xe6')][_0x03f0('0x137')](db[_0x03f0('0x53')],{});db[_0x03f0('0xe6')]['belongsTo'](db['SmsAccount'],{'foreignKey':_0x03f0('0x1d6'),'as':_0x03f0('0x1c5')});db[_0x03f0('0xe6')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x03f0('0x1c7')});db[_0x03f0('0xe6')][_0x03f0('0x137')](db[_0x03f0('0x11')],{'foreignKey':_0x03f0('0x1c8'),'as':'ToAgent'});db['SmsTransferReport'][_0x03f0('0x137')](db[_0x03f0('0x55')],{'foreignKey':_0x03f0('0x1d7'),'as':'ToQueue'});db[_0x03f0('0xe6')][_0x03f0('0x137')](db[_0x03f0('0x126')],{'foreignKey':_0x03f0('0x1d8'),'as':_0x03f0('0x1cd')});db[_0x03f0('0x10f')][_0x03f0('0xfd')](db[_0x03f0('0x7c')],{'as':_0x03f0('0x14d'),'foreignKey':_0x03f0('0x150'),'onDelete':_0x03f0('0x100')});db['CmList'][_0x03f0('0xfd')](db[_0x03f0('0x1d9')],{'as':'CustomFields','foreignKey':'ListId'});db['CmList'][_0x03f0('0xfd')](db['CmContact'],{'as':_0x03f0('0x10e'),'onDelete':_0x03f0('0x100'),'foreignKey':_0x03f0('0x150')});db[_0x03f0('0x10f')][_0x03f0('0xfd')](db[_0x03f0('0x74')],{'as':'HopperFinals','foreignKey':_0x03f0('0x150')});db[_0x03f0('0x10f')][_0x03f0('0xfd')](db[_0x03f0('0x76')],{'as':'HopperHistory','foreignKey':_0x03f0('0x150')});db[_0x03f0('0x10f')][_0x03f0('0xfd')](db[_0x03f0('0x77')],{'as':_0x03f0('0x77'),'foreignKey':_0x03f0('0x150')});db[_0x03f0('0x10f')][_0x03f0('0x10d')](db['VoiceQueue'],{'as':_0x03f0('0x1da'),'through':_0x03f0('0x13c')});db[_0x03f0('0x10f')][_0x03f0('0x10d')](db[_0x03f0('0x11')],{'as':_0x03f0('0x13d'),'through':_0x03f0('0x111')});db[_0x03f0('0xe8')][_0x03f0('0xfd')](db[_0x03f0('0x12f')],{'as':_0x03f0('0xff'),'onDelete':_0x03f0('0x100')});db[_0x03f0('0xe8')]['belongsToMany'](db[_0x03f0('0x11')],{'as':_0x03f0('0x13d'),'through':_0x03f0('0x1db')});db[_0x03f0('0xe9')]['hasMany'](db['User'],{'as':'Users','foreignKey':_0x03f0('0x10a')});db['UserProfile'][_0x03f0('0xfd')](db['UserProfileSection'],{'as':'UserProfileSections','foreignKey':'userProfileId','onDelete':_0x03f0('0x100')});db['UserProfileSection'][_0x03f0('0xfd')](db[_0x03f0('0xed')],{'as':_0x03f0('0x1dc'),'foreignKey':_0x03f0('0x1dd'),'onDelete':_0x03f0('0x100')});db[_0x03f0('0x129')][_0x03f0('0xfd')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x03f0('0x1de'),'onDelete':_0x03f0('0x100')});db[_0x03f0('0x129')][_0x03f0('0xfd')](db[_0x03f0('0x7b')],{'as':_0x03f0('0x14e'),'foreignKey':_0x03f0('0x1de')});db[_0x03f0('0x129')][_0x03f0('0xfd')](db[_0x03f0('0xf3')],{'as':_0x03f0('0x14f'),'foreignKey':'WhatsappAccountId'});db['WhatsappAccount'][_0x03f0('0xfd')](db[_0x03f0('0x107')],{'as':'Interactions'});db[_0x03f0('0x129')][_0x03f0('0xfd')](db['WhatsappApplication'],{'as':_0x03f0('0x130')});db[_0x03f0('0x129')]['belongsTo'](db[_0x03f0('0x10f')],{'as':_0x03f0('0x162'),'foreignKey':_0x03f0('0x150')});db[_0x03f0('0x129')][_0x03f0('0x137')](db[_0x03f0('0x152')],{'as':_0x03f0('0x13a'),'foreignKey':_0x03f0('0x13b')});db[_0x03f0('0x129')][_0x03f0('0x10d')](db[_0x03f0('0x11')],{'as':'Agents','through':_0x03f0('0x12b')});db[_0x03f0('0xf1')]['belongsTo'](db['User'],{'onDelete':'restrict'});db['WhatsappApplication'][_0x03f0('0x137')](db[_0x03f0('0x1be')],{'onDelete':'restrict'});db[_0x03f0('0xf1')][_0x03f0('0x137')](db['WhatsappAccount'],{'onDelete':_0x03f0('0x15f')});db[_0x03f0('0xf1')]['belongsTo'](db[_0x03f0('0x7f')],{'onDelete':_0x03f0('0x15f'),'foreignKey':_0x03f0('0x160')});db[_0x03f0('0xf1')][_0x03f0('0x137')](db['Tag'],{'onDelete':_0x03f0('0x15f'),'foreignKey':'TagId'});db[_0x03f0('0x107')][_0x03f0('0xfd')](db['WhatsappMessage'],{'as':'Messages','onDelete':_0x03f0('0x100'),'foreignKey':'WhatsappInteractionId'});db['WhatsappInteraction'][_0x03f0('0x137')](db[_0x03f0('0x129')],{'as':_0x03f0('0x155'),'foreignKey':'WhatsappAccountId'});db['WhatsappInteraction']['belongsTo'](db[_0x03f0('0x6f')],{'as':_0x03f0('0x148'),'foreignKey':_0x03f0('0x166')});db['WhatsappInteraction'][_0x03f0('0x137')](db['User'],{'as':_0x03f0('0x156'),'foreignKey':_0x03f0('0xfb')});db['WhatsappInteraction'][_0x03f0('0x10d')](db[_0x03f0('0x87')],{'through':_0x03f0('0x196'),'as':_0x03f0('0x157')});db['WhatsappInteraction']['belongsToMany'](db[_0x03f0('0x87')],{'through':_0x03f0('0x196'),'as':_0x03f0('0x159')});db[_0x03f0('0x107')][_0x03f0('0x10d')](db['User'],{'as':_0x03f0('0x15a'),'through':_0x03f0('0x1df'),'foreignKey':_0x03f0('0x1e0')});db[_0x03f0('0xf3')][_0x03f0('0x137')](db[_0x03f0('0x11')],{'as':'User'});db[_0x03f0('0xf3')][_0x03f0('0x137')](db['CmContact'],{'onDelete':_0x03f0('0x100'),'as':_0x03f0('0x148')});db['WhatsappMessage'][_0x03f0('0x137')](db[_0x03f0('0x107')],{'onDelete':'cascade','as':_0x03f0('0x15c'),'foreignKey':_0x03f0('0x1e0')});db[_0x03f0('0xf3')][_0x03f0('0x137')](db[_0x03f0('0x129')],{'as':_0x03f0('0x155'),'foreignKey':_0x03f0('0x1de')});db[_0x03f0('0xf5')][_0x03f0('0x137')](db[_0x03f0('0x129')],{});db[_0x03f0('0xf5')][_0x03f0('0x137')](db[_0x03f0('0x10f')],{'as':_0x03f0('0x162'),'foreignKey':_0x03f0('0x150')});db[_0x03f0('0xf5')][_0x03f0('0x137')](db[_0x03f0('0x6f')],{'as':_0x03f0('0x148'),'foreignKey':_0x03f0('0x166')});db[_0x03f0('0xf5')][_0x03f0('0x137')](db['WhatsappInteraction'],{});db['WhatsappQueueReport'][_0x03f0('0x137')](db['WhatsappQueue'],{});db[_0x03f0('0xf5')][_0x03f0('0x137')](db[_0x03f0('0xf3')],{});db[_0x03f0('0xf5')][_0x03f0('0x137')](db['User'],{});db[_0x03f0('0xf6')][_0x03f0('0x137')](db['WhatsappMessage'],{});db['WhatsappTransferReport'][_0x03f0('0x137')](db[_0x03f0('0x107')],{});db[_0x03f0('0xf6')][_0x03f0('0x137')](db[_0x03f0('0x129')],{'foreignKey':_0x03f0('0x1e1'),'as':_0x03f0('0x1c5')});db[_0x03f0('0xf6')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x03f0('0x1e2'),'as':_0x03f0('0x1cd')});db[_0x03f0('0xf6')][_0x03f0('0x137')](db[_0x03f0('0x1be')],{'foreignKey':_0x03f0('0x1e3'),'as':'ToQueue'});db[_0x03f0('0xf6')]['belongsTo'](db[_0x03f0('0x11')],{'foreignKey':_0x03f0('0x1c6'),'as':'FromAgent'});db['WhatsappTransferReport'][_0x03f0('0x137')](db['User'],{'foreignKey':_0x03f0('0x1c8'),'as':'ToAgent'});db['WhatsappQueue'][_0x03f0('0x10d')](db[_0x03f0('0x11')],{'as':'Agents','through':'UserWhatsappQueue','foreignKey':'WhatsappQueueId'});db[_0x03f0('0x1be')][_0x03f0('0x10d')](db[_0x03f0('0xd5')],{'through':_0x03f0('0x1bf'),'as':'Teams'});module[_0x03f0('0x1e4')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 3c9b303..cef2acf 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5b8a=['./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','./api/intVtigerAccount','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','./api/chatInternalMessage','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','/api/square/reports','./api/squareReportDetail','/api/jscripty/projects','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','/api/square/recordings','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','/api/chat/reports/transfer','./api/chatTransferReport','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','./api/smsTransferReport','./api/cmList','/api/voice/prefixes','./api/voicePrefix','./api/userProfile','/api/userProfile/sections','/api/userProfile/resources','./api/userProfileResource','./api/userNotification','./api/whatsappAccount','./api/whatsappApplication','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','./api/rpc','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/apidoc','static','join','root','/www','/demo','/snippet','snippet','3.0.0','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','resolve','appPath','/index.html','password','newPassword','apiKey','firstName','lastName','street','phone','fax','email','clientId','clientSecret','securityToken','accessKey','tenantId','channelSecret','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','accesskeyid','key','pass','accountSid','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray','isString','replace','@@{','}@@','includes','lodash','express-winston','util','./errors','./config/logger','auth','default','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','user','name','role','inspect','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','method','device','agent_name','test','/api/users','/api/voice/chanspy','/api/voice/contexts','./api/voiceContext','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','/api/voice/mails/messages','./api/voiceMailMessage','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','/api/voice/transfers/reports','./api/voiceTransferReport','./api/mailServerOut','/api/mail/accounts','/api/mail/queues','./api/mailQueue','./api/mailSubstatus','/api/mail/interactions','/api/mail/messages','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','/api/dashboards','./api/dashboardItem','./api/faxAccount','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','/api/fax/queues','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','./api/cmHopper','/api/cm/hopper_black','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','/api/canned_answers','./api/cannedAnswer','./api/disposition','/api/intervals','./api/interval','./api/pause','/api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','./api/sound','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/integrations/salesforce/accounts','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','./api/intDeskConfiguration','./api/intDeskField','/api/integrations/zoho/accounts','/api/integrations/zoho/configurations','/api/integrations/zoho/fields'];(function(_0x5f2098,_0x47308b){var _0x18af32=function(_0xa53c8e){while(--_0xa53c8e){_0x5f2098['push'](_0x5f2098['shift']());}};_0x18af32(++_0x47308b);}(_0x5b8a,0x9f));var _0xa5b8=function(_0x3525fe,_0x42dae5){_0x3525fe=_0x3525fe-0x0;var _0x4efe6c=_0x5b8a[_0x3525fe];return _0x4efe6c;};'use strict';var _=require(_0xa5b8('0x0'));var path=require('path');var express=require('express');var ewinston=require(_0xa5b8('0x1'));var util=require(_0xa5b8('0x2'));var errors=require(_0xa5b8('0x3'));var config=require('./config/environment');var logger=require(_0xa5b8('0x4'))('api');var authLogger=require(_0xa5b8('0x4'))(_0xa5b8('0x5'));exports[_0xa5b8('0x6')]=function(_0x310699){_0x310699[_0xa5b8('0x7')](ewinston['logger']({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x241c7b,_0x2a3b45){var _0x35df88=_0xa5b8('0x8');if(!_[_0xa5b8('0x9')](_0x241c7b[_0xa5b8('0xa')])){_0x35df88+=_0xa5b8('0xb');var _0x2eea99=_0x241c7b['body'];maskSensitiveData(_0x2eea99);}return util[_0xa5b8('0xc')](_0x35df88,_0x241c7b['method'],_0x241c7b[_0xa5b8('0xd')][_0xa5b8('0xe')]?_0x241c7b['headers'][_0xa5b8('0xe')]:_0x241c7b[_0xa5b8('0xf')][_0xa5b8('0x10')]||_0x241c7b['ip'],_0x241c7b[_0xa5b8('0x11')],_0x2a3b45[_0xa5b8('0x12')],_0x2a3b45[_0xa5b8('0x13')],_0x241c7b[_0xa5b8('0x14')]?_0x241c7b[_0xa5b8('0x14')]['id']:null,_0x241c7b[_0xa5b8('0x14')]?_0x241c7b[_0xa5b8('0x14')][_0xa5b8('0x15')]:null,_0x241c7b['user']?_0x241c7b[_0xa5b8('0x14')][_0xa5b8('0x16')]:null,_0x2eea99?util[_0xa5b8('0x17')](_0x2eea99,![],null):'');}}));_0x310699[_0xa5b8('0x7')](ewinston[_0xa5b8('0x18')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x19930,_0x3c2545){var _0x162d3e=_0xa5b8('0x19');if(_0x19930['body']&&_0x19930['body']['device']&&_0x19930[_0xa5b8('0xa')][_0xa5b8('0x1a')]){_0x162d3e=_0xa5b8('0x1b');}return util[_0xa5b8('0xc')](_0x162d3e,_0x19930[_0xa5b8('0x1c')],_0x19930['headers'][_0xa5b8('0xe')]?_0x19930[_0xa5b8('0xd')]['x-forwarded-for']:_0x19930[_0xa5b8('0xf')][_0xa5b8('0x10')]||_0x19930['ip'],_0x19930[_0xa5b8('0x11')],_0x3c2545['statusCode'],_0x3c2545['responseTime'],_0x19930[_0xa5b8('0x14')]?_0x19930[_0xa5b8('0x14')]['id']:null,_0x19930[_0xa5b8('0x14')]?_0x19930[_0xa5b8('0x14')]['name']:null,_0x19930['user']?_0x19930['user'][_0xa5b8('0x16')]:null,_0x19930['body']&&_0x19930[_0xa5b8('0xa')][_0xa5b8('0x1d')]?_0x19930[_0xa5b8('0xa')][_0xa5b8('0x1d')]:'other',_0x19930[_0xa5b8('0xa')]&&_0x19930[_0xa5b8('0xa')]['agent_id']?_0x19930[_0xa5b8('0xa')][_0xa5b8('0x1a')]:'',_0x19930[_0xa5b8('0xa')]&&_0x19930['body']['agent_name']?_0x19930[_0xa5b8('0xa')][_0xa5b8('0x1e')]:'');},'ignoreRoute':function(_0x2cd2d5){var _0x17eaa2=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x17eaa2[_0xa5b8('0x1f')](_0x2cd2d5[_0xa5b8('0x11')]);}}));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x20'),require('./api/user'));_0x310699['use'](_0xa5b8('0x21'),require('./api/voiceChanSpy'));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x22'),require(_0xa5b8('0x23')));_0x310699[_0xa5b8('0x7')]('/api/voice/extensions',require(_0xa5b8('0x24')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x25'),require(_0xa5b8('0x26')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x27'),require(_0xa5b8('0x28')));_0x310699[_0xa5b8('0x7')]('/api/voice/recordings',require(_0xa5b8('0x29')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x2a'),require(_0xa5b8('0x2b')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x2c'),require('./api/voiceMail'));_0x310699['use'](_0xa5b8('0x2d'),require(_0xa5b8('0x2e')));_0x310699['use']('/api/voice/calls/reports',require(_0xa5b8('0x2f')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x30'),require(_0xa5b8('0x31')));_0x310699['use'](_0xa5b8('0x32'),require(_0xa5b8('0x33')));_0x310699['use'](_0xa5b8('0x34'),require(_0xa5b8('0x35')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x36'),require(_0xa5b8('0x37')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x38'),require('./api/trunk'));_0x310699['use'](_0xa5b8('0x39'),require(_0xa5b8('0x3a')));_0x310699[_0xa5b8('0x7')]('/api/mail/out_servers',require(_0xa5b8('0x3b')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x3c'),require('./api/mailAccount'));_0x310699['use'](_0xa5b8('0x3d'),require(_0xa5b8('0x3e')));_0x310699[_0xa5b8('0x7')]('/api/mail/substatuses',require(_0xa5b8('0x3f')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x40'),require('./api/mailInteraction'));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x41'),require('./api/mailMessage'));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x42'),require(_0xa5b8('0x43')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x44'),require('./api/mailQueueReport'));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x45'),require('./api/dashboard'));_0x310699[_0xa5b8('0x7')]('/api/dashboards/items',require(_0xa5b8('0x46')));_0x310699[_0xa5b8('0x7')]('/api/fax/accounts',require(_0xa5b8('0x47')));_0x310699[_0xa5b8('0x7')]('/api/fax/applications',require(_0xa5b8('0x48')));_0x310699['use'](_0xa5b8('0x49'),require(_0xa5b8('0x4a')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x4b'),require('./api/faxMessage'));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x4c'),require('./api/faxQueue'));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x4d'),require(_0xa5b8('0x4e')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x4f'),require(_0xa5b8('0x50')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x51'),require(_0xa5b8('0x52')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x53'),require('./api/smsInteraction'));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x54'),require(_0xa5b8('0x55')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x56'),require(_0xa5b8('0x57')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x58'),require(_0xa5b8('0x59')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x5a'),require(_0xa5b8('0x5b')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x5c'),require(_0xa5b8('0x5d')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x5e'),require('./api/openchannelMessage'));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x5f'),require(_0xa5b8('0x60')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x61'),require('./api/chatWebsite'));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x62'),require(_0xa5b8('0x63')));_0x310699[_0xa5b8('0x7')]('/api/chat/applications',require(_0xa5b8('0x64')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x65'),require(_0xa5b8('0x66')));_0x310699['use']('/api/chat/messages',require(_0xa5b8('0x67')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x68'),require(_0xa5b8('0x69')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x6a'),require(_0xa5b8('0x6b')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x6c'),require(_0xa5b8('0x6d')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x6e'),require(_0xa5b8('0x6f')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x70'),require(_0xa5b8('0x71')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x72'),require(_0xa5b8('0x73')));_0x310699[_0xa5b8('0x7')]('/api/cm/hopper',require(_0xa5b8('0x74')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x75'),require('./api/cmHopperBlack'));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x76'),require(_0xa5b8('0x77')));_0x310699['use'](_0xa5b8('0x78'),require(_0xa5b8('0x79')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x7a'),require(_0xa5b8('0x7b')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x7c'),require(_0xa5b8('0x7d')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x7e'),require('./api/automation'));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x7f'),require(_0xa5b8('0x80')));_0x310699[_0xa5b8('0x7')]('/api/dispositions',require(_0xa5b8('0x81')));_0x310699[_0xa5b8('0x7')]('/api/conditions',require('./api/condition'));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x82'),require(_0xa5b8('0x83')));_0x310699[_0xa5b8('0x7')]('/api/pauses',require(_0xa5b8('0x84')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x85'),require('./api/cdr'));_0x310699['use'](_0xa5b8('0x86'),require(_0xa5b8('0x87')));_0x310699['use'](_0xa5b8('0x88'),require(_0xa5b8('0x89')));_0x310699[_0xa5b8('0x7')]('/api/sounds',require(_0xa5b8('0x8a')));_0x310699[_0xa5b8('0x7')]('/api/tags',require('./api/tag'));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x8b'),require(_0xa5b8('0x8c')));_0x310699['use'](_0xa5b8('0x8d'),require(_0xa5b8('0x8e')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x8f'),require(_0xa5b8('0x90')));_0x310699['use']('/api/integrations',require(_0xa5b8('0x91')));_0x310699['use'](_0xa5b8('0x92'),require(_0xa5b8('0x93')));_0x310699['use'](_0xa5b8('0x94'),require(_0xa5b8('0x95')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x96'),require(_0xa5b8('0x97')));_0x310699[_0xa5b8('0x7')]('/api/analytics/extracted_reports',require(_0xa5b8('0x98')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x99'),require(_0xa5b8('0x9a')));_0x310699['use'](_0xa5b8('0x9b'),require(_0xa5b8('0x9c')));_0x310699['use']('/api/analytics/tree_reports',require('./api/analyticTreeReport'));_0x310699['use'](_0xa5b8('0x9d'),require('./api/intSalesforceAccount'));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x9e'),require(_0xa5b8('0x9f')));_0x310699[_0xa5b8('0x7')]('/api/integrations/salesforce/fields',require(_0xa5b8('0xa0')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xa1'),require(_0xa5b8('0xa2')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xa3'),require(_0xa5b8('0xa4')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xa5'),require(_0xa5b8('0xa6')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xa7'),require(_0xa5b8('0xa8')));_0x310699[_0xa5b8('0x7')]('/api/integrations/desk/configurations',require(_0xa5b8('0xa9')));_0x310699[_0xa5b8('0x7')]('/api/integrations/desk/fields',require(_0xa5b8('0xaa')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xab'),require('./api/intZohoAccount'));_0x310699['use'](_0xa5b8('0xac'),require('./api/intZohoConfiguration'));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xad'),require(_0xa5b8('0xae')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xaf'),require('./api/intZendeskAccount'));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xb0'),require('./api/intZendeskConfiguration'));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xb1'),require(_0xa5b8('0xb2')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xb3'),require(_0xa5b8('0xb4')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xb5'),require(_0xa5b8('0xb6')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xb7'),require('./api/intFreshdeskField'));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xb8'),require(_0xa5b8('0xb9')));_0x310699[_0xa5b8('0x7')]('/api/integrations/vtiger/configurations',require(_0xa5b8('0xba')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xbb'),require(_0xa5b8('0xbc')));_0x310699['use'](_0xa5b8('0xbd'),require('./api/intServicenowAccount'));_0x310699['use']('/api/integrations/servicenow/configurations',require(_0xa5b8('0xbe')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xbf'),require(_0xa5b8('0xc0')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xc1'),require(_0xa5b8('0xc2')));_0x310699[_0xa5b8('0x7')]('/api/integrations/dynamics365/configurations',require(_0xa5b8('0xc3')));_0x310699['use'](_0xa5b8('0xc4'),require(_0xa5b8('0xc5')));_0x310699[_0xa5b8('0x7')]('/api/integrations/freshsales/accounts',require(_0xa5b8('0xc6')));_0x310699['use'](_0xa5b8('0xc7'),require(_0xa5b8('0xc8')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xc9'),require(_0xa5b8('0xca')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xcb'),require(_0xa5b8('0xcc')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xcd'),require(_0xa5b8('0xce')));_0x310699[_0xa5b8('0x7')]('/api/chat/internal/messages',require(_0xa5b8('0xcf')));_0x310699['use']('/api/jscripty/answers/reports',require(_0xa5b8('0xd0')));_0x310699['use'](_0xa5b8('0xd1'),require(_0xa5b8('0xd2')));_0x310699['use'](_0xa5b8('0xd3'),require(_0xa5b8('0xd4')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xd5'),require('./api/smsQueueReport'));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xd6'),require('./api/squareReport'));_0x310699[_0xa5b8('0x7')]('/api/square/details/reports',require(_0xa5b8('0xd7')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xd8'),require('./api/jscriptyProject'));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xd9'),require(_0xa5b8('0xda')));_0x310699['use'](_0xa5b8('0xdb'),require(_0xa5b8('0xdc')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xdd'),require('./api/squareProject'));_0x310699['use'](_0xa5b8('0xde'),require('./api/squareRecording'));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xdf'),require(_0xa5b8('0xe0')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xe1'),require(_0xa5b8('0xe2')));_0x310699['use'](_0xa5b8('0xe3'),require(_0xa5b8('0xe4')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xe5'),require(_0xa5b8('0xe6')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xe7'),require(_0xa5b8('0xe8')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xe9'),require(_0xa5b8('0xea')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xeb'),require(_0xa5b8('0xec')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xed'),require('./api/mailTransferReport'));_0x310699['use'](_0xa5b8('0xee'),require(_0xa5b8('0xef')));_0x310699[_0xa5b8('0x7')]('/api/fax/reports/transfer',require(_0xa5b8('0xf0')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xf1'),require(_0xa5b8('0xf2')));_0x310699['use']('/api/sms/reports/transfer',require(_0xa5b8('0xf3')));_0x310699[_0xa5b8('0x7')]('/api/cm/lists',require(_0xa5b8('0xf4')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xf5'),require(_0xa5b8('0xf6')));_0x310699[_0xa5b8('0x7')]('/api/userProfiles',require(_0xa5b8('0xf7')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xf8'),require('./api/userProfileSection'));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xf9'),require(_0xa5b8('0xfa')));_0x310699[_0xa5b8('0x7')]('/api/userNotifications',require(_0xa5b8('0xfb')));_0x310699[_0xa5b8('0x7')]('/api/whatsapp/accounts',require(_0xa5b8('0xfc')));_0x310699[_0xa5b8('0x7')]('/api/whatsapp/applications',require(_0xa5b8('0xfd')));_0x310699[_0xa5b8('0x7')]('/api/whatsapp/interactions',require('./api/whatsappInteraction'));_0x310699['use']('/api/whatsapp/messages',require(_0xa5b8('0xfe')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xff'),require(_0xa5b8('0x100')));_0x310699['use']('/api/whatsapp/reports/transfer',require(_0xa5b8('0x101')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x102'),require(_0xa5b8('0x103')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x104'),require(_0xa5b8('0x105')));_0x310699['use'](_0xa5b8('0x106'),require('./api/realtime'));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x107'),require(_0xa5b8('0x108')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x109'),require(_0xa5b8('0x10a')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x10b'),require(_0xa5b8('0x10c')));_0x310699[_0xa5b8('0x7')]('/api/rpc',require(_0xa5b8('0x10d')));_0x310699['use']('/api/version',require(_0xa5b8('0x10e')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x10f'),require(_0xa5b8('0x110')));_0x310699['use'](_0xa5b8('0x111'),require(_0xa5b8('0x112')));_0x310699['use'](_0xa5b8('0x113'),require(_0xa5b8('0x114')));_0x310699['use'](_0xa5b8('0x115'),express[_0xa5b8('0x116')](path[_0xa5b8('0x117')](config[_0xa5b8('0x118')],'/apidoc')));_0x310699[_0xa5b8('0x7')]('/www',express[_0xa5b8('0x116')](path['join'](config[_0xa5b8('0x118')],_0xa5b8('0x119'))));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x11a'),express[_0xa5b8('0x116')](path[_0xa5b8('0x117')](config['root'],'/demo')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x11b'),express['static'](path['join'](config[_0xa5b8('0x118')],_0xa5b8('0x11c'),_0xa5b8('0x11d'))));_0x310699['use']('/plugins',express[_0xa5b8('0x116')](path[_0xa5b8('0x117')](config[_0xa5b8('0x118')],_0xa5b8('0x11e'))));_0x310699[_0xa5b8('0x11f')](_0xa5b8('0x120'))['get'](errors[0x194]);_0x310699['route']('/*')[_0xa5b8('0x121')](function(_0x52c432,_0x525590){_0x525590['sendFile'](path[_0xa5b8('0x122')](_0x310699[_0xa5b8('0x121')](_0xa5b8('0x123'))+_0xa5b8('0x124')));});};var sensitiveFields=['username',_0xa5b8('0x125'),_0xa5b8('0x126'),_0xa5b8('0x127'),_0xa5b8('0x128'),_0xa5b8('0x129'),_0xa5b8('0x12a'),_0xa5b8('0x12b'),'mobile',_0xa5b8('0x12c'),_0xa5b8('0x12d'),_0xa5b8('0x12e'),_0xa5b8('0x12f'),_0xa5b8('0x130'),'code',_0xa5b8('0x131'),_0xa5b8('0x132'),'token',_0xa5b8('0x133'),'accessToken','accessTokenSecret',_0xa5b8('0x134'),_0xa5b8('0x135'),_0xa5b8('0x136'),_0xa5b8('0x137'),_0xa5b8('0x138'),_0xa5b8('0x139'),_0xa5b8('0x13a'),_0xa5b8('0x13b'),_0xa5b8('0x13c'),'privateKey',_0xa5b8('0x13d'),'secretaccesskey',_0xa5b8('0x13e'),'user',_0xa5b8('0x13f'),_0xa5b8('0x140'),_0xa5b8('0x141'),_0xa5b8('0x142'),_0xa5b8('0x143'),_0xa5b8('0x144'),_0xa5b8('0x145')];function maskSensitiveData(_0x36a659){var _0x1bc592=/(?!^)[\s\S](?!$)/g;if(!_[_0xa5b8('0x146')](_0x36a659))return;for(var _0x48b998 in _0x36a659){if(_[_0xa5b8('0x147')](_0x36a659[_0x48b998])){for(var _0x5387ca=0x0;_0x5387ca<_0x36a659[_0x48b998]['length'];_0x5387ca++){maskSensitiveData(_0x36a659[_0x48b998][_0x5387ca]);}}else if(_[_0xa5b8('0x146')](_0x36a659[_0x48b998])){maskSensitiveData(_0x36a659[_0x48b998]);}else if(_[_0xa5b8('0x148')](_0x36a659[_0x48b998])){_0x36a659[_0x48b998]=_0x36a659[_0x48b998][_0xa5b8('0x149')](/{{{/g,_0xa5b8('0x14a'))[_0xa5b8('0x149')](/}}}/g,_0xa5b8('0x14b'))[_0xa5b8('0x149')](/{{/g,'@{')[_0xa5b8('0x149')](/}}/g,'}@');if(_[_0xa5b8('0x14c')](sensitiveFields,_0x48b998)){_0x36a659[_0x48b998]=_0x36a659[_0x48b998]['replace'](_0x1bc592,'*');}}}} \ No newline at end of file +var _0x7db0=['./api/license','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/faxTransferReport','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/cmList','/api/voice/prefixes','/api/userProfiles','/api/userProfile/sections','./api/userProfileResource','/api/userNotifications','./api/userNotification','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','./api/whatsappMessage','./api/whatsappQueueReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/apidoc','join','root','/www','static','/demo','/snippet','snippet','3.0.0','/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','resolve','appPath','/index.html','username','password','newPassword','apiKey','firstName','street','phone','mobile','email','clientId','securityToken','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridnum','exten','vidaooApiKey','clientEmail','accesskeyid','secretaccesskey','key','pass','accountSid','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isString','replace','@@{','}@@','includes','path','express','express-winston','util','./errors','./config/environment','./config/logger','api','auth','default','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','headers','x-forwarded-for','connection','remoteAddress','url','user','name','role','inspect','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','method','statusCode','responseTime','agent_name','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/recordings','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/memberReport','/api/trunks','./api/trunk','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','/api/mail/queues','./api/mailQueue','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','/api/dashboards','./api/dashboard','/api/dashboards/items','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','/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/openchannel/applications','./api/openchannelInteraction','/api/openchannel/messages','/api/openchannel/queues','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','/api/chat/interactions','./api/chatInteraction','/api/chat/offline_messages','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','./api/chatProactiveAction','/api/cm/companies','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','/api/actions','./api/action','/api/automations','/api/canned_answers','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/tags','./api/tag','/api/templates','./api/template','./api/trigger','/api/variables','./api/variable','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','/api/analytics/metrics','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','./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/integrations/servicenow/configurations','./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/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/networks','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','/api/square/odbc','/api/square/projects','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage'];(function(_0x1aab55,_0x29720e){var _0x5c59cf=function(_0x2d72){while(--_0x2d72){_0x1aab55['push'](_0x1aab55['shift']());}};_0x5c59cf(++_0x29720e);}(_0x7db0,0x68));var _0x07db=function(_0x561f25,_0x2d95c1){_0x561f25=_0x561f25-0x0;var _0x150e4c=_0x7db0[_0x561f25];return _0x150e4c;};'use strict';var _=require('lodash');var path=require(_0x07db('0x0'));var express=require(_0x07db('0x1'));var ewinston=require(_0x07db('0x2'));var util=require(_0x07db('0x3'));var errors=require(_0x07db('0x4'));var config=require(_0x07db('0x5'));var logger=require(_0x07db('0x6'))(_0x07db('0x7'));var authLogger=require(_0x07db('0x6'))(_0x07db('0x8'));exports[_0x07db('0x9')]=function(_0x1b9644){_0x1b9644['use'](ewinston[_0x07db('0xa')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x534555,_0x151851){var _0x3f4039=_0x07db('0xb');if(!_[_0x07db('0xc')](_0x534555[_0x07db('0xd')])){_0x3f4039+=_0x07db('0xe');var _0x17803c=_0x534555[_0x07db('0xd')];maskSensitiveData(_0x17803c);}return util[_0x07db('0xf')](_0x3f4039,_0x534555['method'],_0x534555[_0x07db('0x10')][_0x07db('0x11')]?_0x534555[_0x07db('0x10')][_0x07db('0x11')]:_0x534555[_0x07db('0x12')][_0x07db('0x13')]||_0x534555['ip'],_0x534555[_0x07db('0x14')],_0x151851['statusCode'],_0x151851['responseTime'],_0x534555[_0x07db('0x15')]?_0x534555[_0x07db('0x15')]['id']:null,_0x534555[_0x07db('0x15')]?_0x534555['user'][_0x07db('0x16')]:null,_0x534555['user']?_0x534555[_0x07db('0x15')][_0x07db('0x17')]:null,_0x17803c?util[_0x07db('0x18')](_0x17803c,![],null):'');}}));_0x1b9644[_0x07db('0x19')](ewinston[_0x07db('0xa')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x46d8fd,_0x2de06e){var _0x507653=_0x07db('0x1a');if(_0x46d8fd[_0x07db('0xd')]&&_0x46d8fd['body'][_0x07db('0x1b')]&&_0x46d8fd['body'][_0x07db('0x1c')]){_0x507653=_0x07db('0x1d');}return util[_0x07db('0xf')](_0x507653,_0x46d8fd[_0x07db('0x1e')],_0x46d8fd[_0x07db('0x10')][_0x07db('0x11')]?_0x46d8fd[_0x07db('0x10')][_0x07db('0x11')]:_0x46d8fd[_0x07db('0x12')][_0x07db('0x13')]||_0x46d8fd['ip'],_0x46d8fd[_0x07db('0x14')],_0x2de06e[_0x07db('0x1f')],_0x2de06e[_0x07db('0x20')],_0x46d8fd[_0x07db('0x15')]?_0x46d8fd[_0x07db('0x15')]['id']:null,_0x46d8fd[_0x07db('0x15')]?_0x46d8fd[_0x07db('0x15')][_0x07db('0x16')]:null,_0x46d8fd['user']?_0x46d8fd[_0x07db('0x15')][_0x07db('0x17')]:null,_0x46d8fd[_0x07db('0xd')]&&_0x46d8fd['body'][_0x07db('0x1b')]?_0x46d8fd[_0x07db('0xd')][_0x07db('0x1b')]:'other',_0x46d8fd[_0x07db('0xd')]&&_0x46d8fd['body'][_0x07db('0x1c')]?_0x46d8fd[_0x07db('0xd')]['agent_id']:'',_0x46d8fd['body']&&_0x46d8fd['body'][_0x07db('0x21')]?_0x46d8fd[_0x07db('0xd')][_0x07db('0x21')]:'');},'ignoreRoute':function(_0x211411){var _0x4c0421=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x4c0421['test'](_0x211411[_0x07db('0x14')]);}}));_0x1b9644[_0x07db('0x19')](_0x07db('0x22'),require(_0x07db('0x23')));_0x1b9644[_0x07db('0x19')](_0x07db('0x24'),require(_0x07db('0x25')));_0x1b9644[_0x07db('0x19')](_0x07db('0x26'),require('./api/voiceContext'));_0x1b9644[_0x07db('0x19')](_0x07db('0x27'),require(_0x07db('0x28')));_0x1b9644[_0x07db('0x19')](_0x07db('0x29'),require(_0x07db('0x2a')));_0x1b9644['use']('/api/voice/queues',require('./api/voiceQueue'));_0x1b9644['use'](_0x07db('0x2b'),require('./api/voiceRecording'));_0x1b9644[_0x07db('0x19')](_0x07db('0x2c'),require(_0x07db('0x2d')));_0x1b9644[_0x07db('0x19')](_0x07db('0x2e'),require(_0x07db('0x2f')));_0x1b9644[_0x07db('0x19')](_0x07db('0x30'),require(_0x07db('0x31')));_0x1b9644[_0x07db('0x19')](_0x07db('0x32'),require(_0x07db('0x33')));_0x1b9644[_0x07db('0x19')]('/api/voice/dials/reports',require(_0x07db('0x34')));_0x1b9644['use'](_0x07db('0x35'),require(_0x07db('0x36')));_0x1b9644[_0x07db('0x19')](_0x07db('0x37'),require('./api/voiceQueueReport'));_0x1b9644[_0x07db('0x19')]('/api/members/reports',require(_0x07db('0x38')));_0x1b9644[_0x07db('0x19')](_0x07db('0x39'),require(_0x07db('0x3a')));_0x1b9644[_0x07db('0x19')]('/api/voice/transfers/reports',require(_0x07db('0x3b')));_0x1b9644[_0x07db('0x19')](_0x07db('0x3c'),require(_0x07db('0x3d')));_0x1b9644['use'](_0x07db('0x3e'),require('./api/mailAccount'));_0x1b9644[_0x07db('0x19')](_0x07db('0x3f'),require(_0x07db('0x40')));_0x1b9644[_0x07db('0x19')]('/api/mail/substatuses',require(_0x07db('0x41')));_0x1b9644[_0x07db('0x19')](_0x07db('0x42'),require(_0x07db('0x43')));_0x1b9644['use'](_0x07db('0x44'),require(_0x07db('0x45')));_0x1b9644['use'](_0x07db('0x46'),require(_0x07db('0x47')));_0x1b9644[_0x07db('0x19')](_0x07db('0x48'),require('./api/mailQueueReport'));_0x1b9644['use'](_0x07db('0x49'),require(_0x07db('0x4a')));_0x1b9644['use'](_0x07db('0x4b'),require('./api/dashboardItem'));_0x1b9644['use']('/api/fax/accounts',require('./api/faxAccount'));_0x1b9644[_0x07db('0x19')](_0x07db('0x4c'),require(_0x07db('0x4d')));_0x1b9644[_0x07db('0x19')](_0x07db('0x4e'),require(_0x07db('0x4f')));_0x1b9644[_0x07db('0x19')](_0x07db('0x50'),require('./api/faxMessage'));_0x1b9644['use'](_0x07db('0x51'),require(_0x07db('0x52')));_0x1b9644[_0x07db('0x19')](_0x07db('0x53'),require(_0x07db('0x54')));_0x1b9644[_0x07db('0x19')](_0x07db('0x55'),require(_0x07db('0x56')));_0x1b9644[_0x07db('0x19')](_0x07db('0x57'),require(_0x07db('0x58')));_0x1b9644[_0x07db('0x19')]('/api/sms/interactions',require(_0x07db('0x59')));_0x1b9644[_0x07db('0x19')](_0x07db('0x5a'),require(_0x07db('0x5b')));_0x1b9644['use'](_0x07db('0x5c'),require(_0x07db('0x5d')));_0x1b9644[_0x07db('0x19')](_0x07db('0x5e'),require('./api/openchannelAccount'));_0x1b9644[_0x07db('0x19')](_0x07db('0x5f'),require('./api/openchannelApplication'));_0x1b9644[_0x07db('0x19')]('/api/openchannel/interactions',require(_0x07db('0x60')));_0x1b9644[_0x07db('0x19')](_0x07db('0x61'),require('./api/openchannelMessage'));_0x1b9644[_0x07db('0x19')](_0x07db('0x62'),require('./api/openchannelQueue'));_0x1b9644['use']('/api/chat/websites',require('./api/chatWebsite'));_0x1b9644[_0x07db('0x19')](_0x07db('0x63'),require(_0x07db('0x64')));_0x1b9644[_0x07db('0x19')](_0x07db('0x65'),require('./api/chatApplication'));_0x1b9644[_0x07db('0x19')](_0x07db('0x66'),require(_0x07db('0x67')));_0x1b9644[_0x07db('0x19')]('/api/chat/messages',require('./api/chatMessage'));_0x1b9644[_0x07db('0x19')](_0x07db('0x68'),require('./api/chatOfflineMessage'));_0x1b9644[_0x07db('0x19')](_0x07db('0x69'),require(_0x07db('0x6a')));_0x1b9644[_0x07db('0x19')](_0x07db('0x6b'),require(_0x07db('0x6c')));_0x1b9644[_0x07db('0x19')]('/api/chat/proactive_actions',require(_0x07db('0x6d')));_0x1b9644[_0x07db('0x19')](_0x07db('0x6e'),require('./api/cmCompany'));_0x1b9644[_0x07db('0x19')](_0x07db('0x6f'),require(_0x07db('0x70')));_0x1b9644[_0x07db('0x19')](_0x07db('0x71'),require(_0x07db('0x72')));_0x1b9644['use'](_0x07db('0x73'),require(_0x07db('0x74')));_0x1b9644['use'](_0x07db('0x75'),require(_0x07db('0x76')));_0x1b9644['use'](_0x07db('0x77'),require(_0x07db('0x78')));_0x1b9644[_0x07db('0x19')](_0x07db('0x79'),require('./api/cmCustomField'));_0x1b9644[_0x07db('0x19')](_0x07db('0x7a'),require(_0x07db('0x7b')));_0x1b9644['use'](_0x07db('0x7c'),require('./api/automation'));_0x1b9644[_0x07db('0x19')](_0x07db('0x7d'),require('./api/cannedAnswer'));_0x1b9644[_0x07db('0x19')]('/api/dispositions',require(_0x07db('0x7e')));_0x1b9644[_0x07db('0x19')](_0x07db('0x7f'),require(_0x07db('0x80')));_0x1b9644[_0x07db('0x19')](_0x07db('0x81'),require(_0x07db('0x82')));_0x1b9644[_0x07db('0x19')]('/api/pauses',require(_0x07db('0x83')));_0x1b9644[_0x07db('0x19')](_0x07db('0x84'),require(_0x07db('0x85')));_0x1b9644['use'](_0x07db('0x86'),require(_0x07db('0x87')));_0x1b9644['use'](_0x07db('0x88'),require(_0x07db('0x89')));_0x1b9644['use']('/api/sounds',require('./api/sound'));_0x1b9644[_0x07db('0x19')](_0x07db('0x8a'),require(_0x07db('0x8b')));_0x1b9644[_0x07db('0x19')](_0x07db('0x8c'),require(_0x07db('0x8d')));_0x1b9644[_0x07db('0x19')]('/api/triggers',require(_0x07db('0x8e')));_0x1b9644['use'](_0x07db('0x8f'),require(_0x07db('0x90')));_0x1b9644['use']('/api/integrations',require(_0x07db('0x91')));_0x1b9644[_0x07db('0x19')](_0x07db('0x92'),require(_0x07db('0x93')));_0x1b9644[_0x07db('0x19')](_0x07db('0x94'),require(_0x07db('0x95')));_0x1b9644['use'](_0x07db('0x96'),require(_0x07db('0x97')));_0x1b9644[_0x07db('0x19')](_0x07db('0x98'),require('./api/analyticExtractedReport'));_0x1b9644[_0x07db('0x19')](_0x07db('0x99'),require('./api/analyticMetric'));_0x1b9644[_0x07db('0x19')]('/api/analytics/field_reports',require(_0x07db('0x9a')));_0x1b9644[_0x07db('0x19')](_0x07db('0x9b'),require(_0x07db('0x9c')));_0x1b9644['use'](_0x07db('0x9d'),require('./api/intSalesforceAccount'));_0x1b9644[_0x07db('0x19')]('/api/integrations/salesforce/configurations',require(_0x07db('0x9e')));_0x1b9644['use'](_0x07db('0x9f'),require(_0x07db('0xa0')));_0x1b9644[_0x07db('0x19')](_0x07db('0xa1'),require(_0x07db('0xa2')));_0x1b9644[_0x07db('0x19')]('/api/integrations/sugarcrm/configurations',require('./api/intSugarcrmConfiguration'));_0x1b9644['use'](_0x07db('0xa3'),require(_0x07db('0xa4')));_0x1b9644[_0x07db('0x19')]('/api/integrations/desk/accounts',require(_0x07db('0xa5')));_0x1b9644[_0x07db('0x19')](_0x07db('0xa6'),require(_0x07db('0xa7')));_0x1b9644['use'](_0x07db('0xa8'),require(_0x07db('0xa9')));_0x1b9644[_0x07db('0x19')](_0x07db('0xaa'),require('./api/intZohoAccount'));_0x1b9644['use'](_0x07db('0xab'),require(_0x07db('0xac')));_0x1b9644[_0x07db('0x19')]('/api/integrations/zoho/fields',require('./api/intZohoField'));_0x1b9644[_0x07db('0x19')](_0x07db('0xad'),require('./api/intZendeskAccount'));_0x1b9644[_0x07db('0x19')](_0x07db('0xae'),require(_0x07db('0xaf')));_0x1b9644[_0x07db('0x19')](_0x07db('0xb0'),require('./api/intZendeskField'));_0x1b9644['use'](_0x07db('0xb1'),require(_0x07db('0xb2')));_0x1b9644['use'](_0x07db('0xb3'),require(_0x07db('0xb4')));_0x1b9644[_0x07db('0x19')]('/api/integrations/freshdesk/fields',require(_0x07db('0xb5')));_0x1b9644[_0x07db('0x19')](_0x07db('0xb6'),require(_0x07db('0xb7')));_0x1b9644[_0x07db('0x19')](_0x07db('0xb8'),require(_0x07db('0xb9')));_0x1b9644[_0x07db('0x19')](_0x07db('0xba'),require(_0x07db('0xbb')));_0x1b9644['use'](_0x07db('0xbc'),require('./api/intServicenowAccount'));_0x1b9644[_0x07db('0x19')](_0x07db('0xbd'),require(_0x07db('0xbe')));_0x1b9644[_0x07db('0x19')](_0x07db('0xbf'),require(_0x07db('0xc0')));_0x1b9644[_0x07db('0x19')](_0x07db('0xc1'),require(_0x07db('0xc2')));_0x1b9644['use'](_0x07db('0xc3'),require(_0x07db('0xc4')));_0x1b9644[_0x07db('0x19')](_0x07db('0xc5'),require('./api/intDynamics365Field'));_0x1b9644[_0x07db('0x19')]('/api/integrations/freshsales/accounts',require(_0x07db('0xc6')));_0x1b9644[_0x07db('0x19')](_0x07db('0xc7'),require(_0x07db('0xc8')));_0x1b9644[_0x07db('0x19')]('/api/integrations/freshsales/fields',require('./api/intFreshsalesField'));_0x1b9644[_0x07db('0x19')](_0x07db('0xc9'),require('./api/network'));_0x1b9644[_0x07db('0x19')](_0x07db('0xca'),require(_0x07db('0xcb')));_0x1b9644['use'](_0x07db('0xcc'),require(_0x07db('0xcd')));_0x1b9644['use']('/api/jscripty/answers/reports',require(_0x07db('0xce')));_0x1b9644[_0x07db('0x19')](_0x07db('0xcf'),require('./api/jscriptyQuestionReport'));_0x1b9644[_0x07db('0x19')]('/api/jscripty/sessions/reports',require(_0x07db('0xd0')));_0x1b9644[_0x07db('0x19')](_0x07db('0xd1'),require(_0x07db('0xd2')));_0x1b9644[_0x07db('0x19')]('/api/square/reports',require(_0x07db('0xd3')));_0x1b9644[_0x07db('0x19')](_0x07db('0xd4'),require(_0x07db('0xd5')));_0x1b9644['use'](_0x07db('0xd6'),require(_0x07db('0xd7')));_0x1b9644['use'](_0x07db('0xd8'),require('./api/setting'));_0x1b9644[_0x07db('0x19')](_0x07db('0xd9'),require('./api/squareOdbc'));_0x1b9644[_0x07db('0x19')](_0x07db('0xda'),require('./api/squareProject'));_0x1b9644[_0x07db('0x19')](_0x07db('0xdb'),require(_0x07db('0xdc')));_0x1b9644[_0x07db('0x19')](_0x07db('0xdd'),require(_0x07db('0xde')));_0x1b9644[_0x07db('0x19')]('/api/teams',require('./api/team'));_0x1b9644[_0x07db('0x19')]('/api/license',require(_0x07db('0xdf')));_0x1b9644[_0x07db('0x19')]('/api/campaigns',require(_0x07db('0xe0')));_0x1b9644['use'](_0x07db('0xe1'),require(_0x07db('0xe2')));_0x1b9644[_0x07db('0x19')](_0x07db('0xe3'),require(_0x07db('0xe4')));_0x1b9644[_0x07db('0x19')](_0x07db('0xe5'),require(_0x07db('0xe6')));_0x1b9644[_0x07db('0x19')](_0x07db('0xe7'),require(_0x07db('0xe8')));_0x1b9644['use'](_0x07db('0xe9'),require('./api/chatTransferReport'));_0x1b9644[_0x07db('0x19')]('/api/fax/reports/transfer',require(_0x07db('0xea')));_0x1b9644['use']('/api/openchannel/reports/transfer',require(_0x07db('0xeb')));_0x1b9644['use'](_0x07db('0xec'),require('./api/smsTransferReport'));_0x1b9644[_0x07db('0x19')]('/api/cm/lists',require(_0x07db('0xed')));_0x1b9644[_0x07db('0x19')](_0x07db('0xee'),require('./api/voicePrefix'));_0x1b9644[_0x07db('0x19')](_0x07db('0xef'),require('./api/userProfile'));_0x1b9644[_0x07db('0x19')](_0x07db('0xf0'),require('./api/userProfileSection'));_0x1b9644[_0x07db('0x19')]('/api/userProfile/resources',require(_0x07db('0xf1')));_0x1b9644[_0x07db('0x19')](_0x07db('0xf2'),require(_0x07db('0xf3')));_0x1b9644[_0x07db('0x19')]('/api/whatsapp/accounts',require(_0x07db('0xf4')));_0x1b9644[_0x07db('0x19')](_0x07db('0xf5'),require(_0x07db('0xf6')));_0x1b9644[_0x07db('0x19')]('/api/whatsapp/interactions',require(_0x07db('0xf7')));_0x1b9644[_0x07db('0x19')]('/api/whatsapp/messages',require(_0x07db('0xf8')));_0x1b9644[_0x07db('0x19')]('/api/whatsapp/reports/queue',require(_0x07db('0xf9')));_0x1b9644[_0x07db('0x19')]('/api/whatsapp/reports/transfer',require('./api/whatsappTransferReport'));_0x1b9644[_0x07db('0x19')](_0x07db('0xfa'),require(_0x07db('0xfb')));_0x1b9644[_0x07db('0x19')](_0x07db('0xfc'),require(_0x07db('0xfd')));_0x1b9644[_0x07db('0x19')](_0x07db('0xfe'),require(_0x07db('0xff')));_0x1b9644[_0x07db('0x19')]('/api/auth/local',require(_0x07db('0x100')));_0x1b9644[_0x07db('0x19')](_0x07db('0x101'),require(_0x07db('0x102')));_0x1b9644[_0x07db('0x19')](_0x07db('0x103'),require(_0x07db('0x104')));_0x1b9644[_0x07db('0x19')](_0x07db('0x105'),require(_0x07db('0x106')));_0x1b9644['use'](_0x07db('0x107'),require(_0x07db('0x108')));_0x1b9644['use'](_0x07db('0x109'),require(_0x07db('0x10a')));_0x1b9644[_0x07db('0x19')](_0x07db('0x10b'),require(_0x07db('0x10c')));_0x1b9644[_0x07db('0x19')]('/api/webbar',require('./api/webbar'));_0x1b9644[_0x07db('0x19')](_0x07db('0x10d'),express['static'](path[_0x07db('0x10e')](config[_0x07db('0x10f')],_0x07db('0x10d'))));_0x1b9644[_0x07db('0x19')](_0x07db('0x110'),express[_0x07db('0x111')](path[_0x07db('0x10e')](config[_0x07db('0x10f')],_0x07db('0x110'))));_0x1b9644[_0x07db('0x19')]('/demo',express['static'](path[_0x07db('0x10e')](config[_0x07db('0x10f')],_0x07db('0x112'))));_0x1b9644[_0x07db('0x19')](_0x07db('0x113'),express[_0x07db('0x111')](path['join'](config[_0x07db('0x10f')],_0x07db('0x114'),_0x07db('0x115'))));_0x1b9644['use'](_0x07db('0x116'),express[_0x07db('0x111')](path['join'](config[_0x07db('0x10f')],'/server/files/plugins')));_0x1b9644[_0x07db('0x117')](_0x07db('0x118'))[_0x07db('0x119')](errors[0x194]);_0x1b9644[_0x07db('0x117')]('/*')[_0x07db('0x119')](function(_0x3e609,_0x1505d6){_0x1505d6['sendFile'](path[_0x07db('0x11a')](_0x1b9644['get'](_0x07db('0x11b'))+_0x07db('0x11c')));});};var sensitiveFields=[_0x07db('0x11d'),_0x07db('0x11e'),_0x07db('0x11f'),_0x07db('0x120'),_0x07db('0x121'),'lastName',_0x07db('0x122'),_0x07db('0x123'),_0x07db('0x124'),'fax',_0x07db('0x125'),_0x07db('0x126'),'clientSecret',_0x07db('0x127'),_0x07db('0x128'),_0x07db('0x129'),_0x07db('0x12a'),_0x07db('0x12b'),_0x07db('0x12c'),_0x07db('0x12d'),_0x07db('0x12e'),_0x07db('0x12f'),_0x07db('0x130'),_0x07db('0x131'),_0x07db('0x132'),'calleridname',_0x07db('0x133'),_0x07db('0x134'),_0x07db('0x135'),_0x07db('0x136'),'privateKey',_0x07db('0x137'),_0x07db('0x138'),_0x07db('0x139'),_0x07db('0x15'),_0x07db('0x13a'),_0x07db('0x13b'),_0x07db('0x13c'),_0x07db('0x13d'),_0x07db('0x13e'),_0x07db('0x13f'),_0x07db('0x140')];function maskSensitiveData(_0x39bfed){var _0x4937af=/(?!^)[\s\S](?!$)/g;if(!_[_0x07db('0x141')](_0x39bfed))return;for(var _0x342039 in _0x39bfed){if(_['isArray'](_0x39bfed[_0x342039])){for(var _0x9c1464=0x0;_0x9c1464<_0x39bfed[_0x342039]['length'];_0x9c1464++){maskSensitiveData(_0x39bfed[_0x342039][_0x9c1464]);}}else if(_['isPlainObject'](_0x39bfed[_0x342039])){maskSensitiveData(_0x39bfed[_0x342039]);}else if(_[_0x07db('0x142')](_0x39bfed[_0x342039])){_0x39bfed[_0x342039]=_0x39bfed[_0x342039][_0x07db('0x143')](/{{{/g,_0x07db('0x144'))[_0x07db('0x143')](/}}}/g,_0x07db('0x145'))[_0x07db('0x143')](/{{/g,'@{')[_0x07db('0x143')](/}}/g,'}@');if(_[_0x07db('0x146')](sensitiveFields,_0x342039)){_0x39bfed[_0x342039]=_0x39bfed[_0x342039][_0x07db('0x143')](_0x4937af,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 82e4e0a..85d16b2 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x54f4=['../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/pause/pause.rpc','../api/sound/sound.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/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/plugin/plugin.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','server','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','jayson/promise','bluebird','lodash','../config/environment','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc'];(function(_0x4c3f4f,_0x17a3e6){var _0x33237d=function(_0x413aa7){while(--_0x413aa7){_0x4c3f4f['push'](_0x4c3f4f['shift']());}};_0x33237d(++_0x17a3e6);}(_0x54f4,0x113));var _0x454f=function(_0x2b3102,_0x28ec26){_0x2b3102=_0x2b3102-0x0;var _0x301cda=_0x54f4[_0x2b3102];return _0x301cda;};'use strict';var jayson=require(_0x454f('0x0'));var BPromise=require(_0x454f('0x1'));var _=require(_0x454f('0x2'));var config=require(_0x454f('0x3'));exports[_0x454f('0x4')]=function(){return new BPromise(function(_0xf5114b,_0x28da91){var _0x219245={};_0x219245=_['merge'](_0x219245,require('../api/user/user.rpc'));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x6')));_0x219245=_['merge'](_0x219245,require(_0x454f('0x7')));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x8')));_0x219245=_[_0x454f('0x5')](_0x219245,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x9')));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0xa')));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0xb')));_0x219245=_['merge'](_0x219245,require(_0x454f('0xc')));_0x219245=_[_0x454f('0x5')](_0x219245,require('../api/trunk/trunk.rpc'));_0x219245=_['merge'](_0x219245,require(_0x454f('0xd')));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0xe')));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0xf')));_0x219245=_[_0x454f('0x5')](_0x219245,require('../api/mailAccount/mailAccount.rpc'));_0x219245=_[_0x454f('0x5')](_0x219245,require('../api/mailQueue/mailQueue.rpc'));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x10')));_0x219245=_[_0x454f('0x5')](_0x219245,require('../api/mailMessage/mailMessage.rpc'));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x11')));_0x219245=_[_0x454f('0x5')](_0x219245,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x12')));_0x219245=_[_0x454f('0x5')](_0x219245,require('../api/faxApplication/faxApplication.rpc'));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x13')));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x14')));_0x219245=_['merge'](_0x219245,require(_0x454f('0x15')));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x16')));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x17')));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x18')));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x19')));_0x219245=_[_0x454f('0x5')](_0x219245,require('../api/smsQueue/smsQueue.rpc'));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x1a')));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x1b')));_0x219245=_['merge'](_0x219245,require(_0x454f('0x1c')));_0x219245=_['merge'](_0x219245,require(_0x454f('0x1d')));_0x219245=_['merge'](_0x219245,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x219245=_[_0x454f('0x5')](_0x219245,require('../api/chatInteraction/chatInteraction.rpc'));_0x219245=_[_0x454f('0x5')](_0x219245,require('../api/chatMessage/chatMessage.rpc'));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x1e')));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x1f')));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x20')));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x21')));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x22')));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x23')));_0x219245=_['merge'](_0x219245,require(_0x454f('0x24')));_0x219245=_[_0x454f('0x5')](_0x219245,require('../api/interval/interval.rpc'));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x25')));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x26')));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x27')));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x28')));_0x219245=_['merge'](_0x219245,require(_0x454f('0x29')));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x2a')));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x2b')));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x2c')));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x2d')));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x2e')));_0x219245=_[_0x454f('0x5')](_0x219245,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x2f')));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x30')));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x31')));_0x219245=_['merge'](_0x219245,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x32')));_0x219245=_['merge'](_0x219245,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x33')));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x34')));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x35')));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x36')));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x37')));_0x219245=_['merge'](_0x219245,require(_0x454f('0x38')));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x39')));_0x219245=_[_0x454f('0x5')](_0x219245,require('../api/campaign/campaign.rpc'));_0x219245=_[_0x454f('0x5')](_0x219245,require('../api/attachment/attachment.rpc'));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x3a')));_0x219245=_[_0x454f('0x5')](_0x219245,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x3b')));_0x219245=_['merge'](_0x219245,require(_0x454f('0x3c')));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x3d')));_0x219245=_[_0x454f('0x5')](_0x219245,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0xa5ff62=jayson[_0x454f('0x3e')](_0x219245)[_0x454f('0x3f')]();var _0x297587=config[_0x454f('0x40')][_0x454f('0x41')]||config[_0x454f('0x41')]+0x1;var _0x21bd4d=config['rpc']['ip']||_0x454f('0x42');_0xa5ff62['on'](_0x454f('0x43'),function(_0x5750c6){return _0x28da91(_0x5750c6);});_0xa5ff62['listen'](_0x297587,_0x21bd4d,function(){console[_0x454f('0x44')](_0x454f('0x45'),_0x21bd4d,_0x297587);require(_0x454f('0x46'))['default']();return _0xf5114b('RPC\x20listening\x20on\x20'+_0x21bd4d+':'+_0x297587);});});}; \ No newline at end of file +var _0xc1c2=['../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','port','rpc','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc'];(function(_0x72a33d,_0x5691da){var _0x2621d5=function(_0x95b7c6){while(--_0x95b7c6){_0x72a33d['push'](_0x72a33d['shift']());}};_0x2621d5(++_0x5691da);}(_0xc1c2,0x17c));var _0x2c1c=function(_0x581c94,_0x41184f){_0x581c94=_0x581c94-0x0;var _0x4874f=_0xc1c2[_0x581c94];return _0x4874f;};'use strict';var jayson=require(_0x2c1c('0x0'));var BPromise=require(_0x2c1c('0x1'));var _=require(_0x2c1c('0x2'));var config=require(_0x2c1c('0x3'));exports[_0x2c1c('0x4')]=function(){return new BPromise(function(_0x4656f7,_0x4b4117){var _0x239315={};_0x239315=_[_0x2c1c('0x5')](_0x239315,require(_0x2c1c('0x6')));_0x239315=_[_0x2c1c('0x5')](_0x239315,require(_0x2c1c('0x7')));_0x239315=_[_0x2c1c('0x5')](_0x239315,require('../api/voiceQueue/voiceQueue.rpc'));_0x239315=_['merge'](_0x239315,require(_0x2c1c('0x8')));_0x239315=_[_0x2c1c('0x5')](_0x239315,require(_0x2c1c('0x9')));_0x239315=_[_0x2c1c('0x5')](_0x239315,require(_0x2c1c('0xa')));_0x239315=_[_0x2c1c('0x5')](_0x239315,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x239315=_[_0x2c1c('0x5')](_0x239315,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x239315=_[_0x2c1c('0x5')](_0x239315,require(_0x2c1c('0xb')));_0x239315=_[_0x2c1c('0x5')](_0x239315,require(_0x2c1c('0xc')));_0x239315=_[_0x2c1c('0x5')](_0x239315,require(_0x2c1c('0xd')));_0x239315=_[_0x2c1c('0x5')](_0x239315,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x239315=_[_0x2c1c('0x5')](_0x239315,require(_0x2c1c('0xe')));_0x239315=_['merge'](_0x239315,require(_0x2c1c('0xf')));_0x239315=_[_0x2c1c('0x5')](_0x239315,require('../api/mailQueue/mailQueue.rpc'));_0x239315=_[_0x2c1c('0x5')](_0x239315,require(_0x2c1c('0x10')));_0x239315=_[_0x2c1c('0x5')](_0x239315,require(_0x2c1c('0x11')));_0x239315=_[_0x2c1c('0x5')](_0x239315,require('../api/mailApplication/mailApplication.rpc'));_0x239315=_[_0x2c1c('0x5')](_0x239315,require(_0x2c1c('0x12')));_0x239315=_[_0x2c1c('0x5')](_0x239315,require('../api/faxAccount/faxAccount.rpc'));_0x239315=_[_0x2c1c('0x5')](_0x239315,require(_0x2c1c('0x13')));_0x239315=_[_0x2c1c('0x5')](_0x239315,require(_0x2c1c('0x14')));_0x239315=_[_0x2c1c('0x5')](_0x239315,require(_0x2c1c('0x15')));_0x239315=_[_0x2c1c('0x5')](_0x239315,require(_0x2c1c('0x16')));_0x239315=_[_0x2c1c('0x5')](_0x239315,require(_0x2c1c('0x17')));_0x239315=_[_0x2c1c('0x5')](_0x239315,require(_0x2c1c('0x18')));_0x239315=_['merge'](_0x239315,require('../api/smsInteraction/smsInteraction.rpc'));_0x239315=_[_0x2c1c('0x5')](_0x239315,require(_0x2c1c('0x19')));_0x239315=_[_0x2c1c('0x5')](_0x239315,require(_0x2c1c('0x1a')));_0x239315=_['merge'](_0x239315,require(_0x2c1c('0x1b')));_0x239315=_[_0x2c1c('0x5')](_0x239315,require(_0x2c1c('0x1c')));_0x239315=_[_0x2c1c('0x5')](_0x239315,require(_0x2c1c('0x1d')));_0x239315=_[_0x2c1c('0x5')](_0x239315,require(_0x2c1c('0x1e')));_0x239315=_[_0x2c1c('0x5')](_0x239315,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x239315=_[_0x2c1c('0x5')](_0x239315,require('../api/chatInteraction/chatInteraction.rpc'));_0x239315=_[_0x2c1c('0x5')](_0x239315,require(_0x2c1c('0x1f')));_0x239315=_['merge'](_0x239315,require(_0x2c1c('0x20')));_0x239315=_[_0x2c1c('0x5')](_0x239315,require(_0x2c1c('0x21')));_0x239315=_['merge'](_0x239315,require(_0x2c1c('0x22')));_0x239315=_[_0x2c1c('0x5')](_0x239315,require(_0x2c1c('0x23')));_0x239315=_['merge'](_0x239315,require(_0x2c1c('0x24')));_0x239315=_[_0x2c1c('0x5')](_0x239315,require(_0x2c1c('0x25')));_0x239315=_[_0x2c1c('0x5')](_0x239315,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x239315=_['merge'](_0x239315,require('../api/interval/interval.rpc'));_0x239315=_['merge'](_0x239315,require(_0x2c1c('0x26')));_0x239315=_['merge'](_0x239315,require(_0x2c1c('0x27')));_0x239315=_[_0x2c1c('0x5')](_0x239315,require(_0x2c1c('0x28')));_0x239315=_['merge'](_0x239315,require('../api/trigger/trigger.rpc'));_0x239315=_[_0x2c1c('0x5')](_0x239315,require(_0x2c1c('0x29')));_0x239315=_[_0x2c1c('0x5')](_0x239315,require(_0x2c1c('0x2a')));_0x239315=_[_0x2c1c('0x5')](_0x239315,require(_0x2c1c('0x2b')));_0x239315=_['merge'](_0x239315,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x239315=_[_0x2c1c('0x5')](_0x239315,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x239315=_[_0x2c1c('0x5')](_0x239315,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x239315=_['merge'](_0x239315,require(_0x2c1c('0x2c')));_0x239315=_[_0x2c1c('0x5')](_0x239315,require(_0x2c1c('0x2d')));_0x239315=_[_0x2c1c('0x5')](_0x239315,require(_0x2c1c('0x2e')));_0x239315=_[_0x2c1c('0x5')](_0x239315,require(_0x2c1c('0x2f')));_0x239315=_['merge'](_0x239315,require(_0x2c1c('0x30')));_0x239315=_[_0x2c1c('0x5')](_0x239315,require(_0x2c1c('0x31')));_0x239315=_['merge'](_0x239315,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x239315=_['merge'](_0x239315,require(_0x2c1c('0x32')));_0x239315=_[_0x2c1c('0x5')](_0x239315,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x239315=_[_0x2c1c('0x5')](_0x239315,require('../api/setting/setting.rpc'));_0x239315=_[_0x2c1c('0x5')](_0x239315,require('../api/squareOdbc/squareOdbc.rpc'));_0x239315=_[_0x2c1c('0x5')](_0x239315,require(_0x2c1c('0x33')));_0x239315=_[_0x2c1c('0x5')](_0x239315,require('../api/squareRecording/squareRecording.rpc'));_0x239315=_[_0x2c1c('0x5')](_0x239315,require(_0x2c1c('0x34')));_0x239315=_['merge'](_0x239315,require(_0x2c1c('0x35')));_0x239315=_['merge'](_0x239315,require(_0x2c1c('0x36')));_0x239315=_['merge'](_0x239315,require('../api/plugin/plugin.rpc'));_0x239315=_[_0x2c1c('0x5')](_0x239315,require(_0x2c1c('0x37')));_0x239315=_['merge'](_0x239315,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x239315=_[_0x2c1c('0x5')](_0x239315,require(_0x2c1c('0x38')));_0x239315=_[_0x2c1c('0x5')](_0x239315,require(_0x2c1c('0x39')));_0x239315=_[_0x2c1c('0x5')](_0x239315,require(_0x2c1c('0x3a')));var _0x238028=jayson['server'](_0x239315)[_0x2c1c('0x3b')]();var _0x143f18=config['rpc'][_0x2c1c('0x3c')]||config[_0x2c1c('0x3c')]+0x1;var _0x285fb7=config[_0x2c1c('0x3d')]['ip']||'localhost';_0x238028['on']('error',function(_0x47ba55){return _0x4b4117(_0x47ba55);});_0x238028[_0x2c1c('0x4')](_0x143f18,_0x285fb7,function(){console[_0x2c1c('0x3e')](_0x2c1c('0x3f'),_0x285fb7,_0x143f18);require(_0x2c1c('0x40'))[_0x2c1c('0x41')]();return _0x4656f7(_0x2c1c('0x42')+_0x285fb7+':'+_0x143f18);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 8057715..ebf14e3 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 _0xa24d=['utf8','setTimeout','emit','ready','toLowerCase','hangup','520-Invalid','520\x20End\x20of\x20proper','function','substring','no\x20code','result=','substr','indexOf','length','match','error','E_AGI_SOCKET_ERROR','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','write','inherits','prototype','sendRequest','command','sync','answer','ANSWER','getData','format','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','EXEC\x20%s\x20%s','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','replace','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setContext','setExtension','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','exec','AGI','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','util','lodash','events','EventEmitter','./reply','./error','call'];(function(_0x50e7b2,_0x436c0b){var _0x24a67b=function(_0x493580){while(--_0x493580){_0x50e7b2['push'](_0x50e7b2['shift']());}};_0x24a67b(++_0x436c0b);}(_0xa24d,0x1c1));var _0xda24=function(_0x25f9dc,_0x36c8e1){_0x25f9dc=_0x25f9dc-0x0;var _0x4213ec=_0xa24d[_0x25f9dc];return _0x4213ec;};'use strict';var util=require(_0xda24('0x0'));var _=require(_0xda24('0x1'));var EventEmitter=require(_0xda24('0x2'))[_0xda24('0x3')];var AGIReply=require(_0xda24('0x4'));var AGIError=require(_0xda24('0x5'));function AGIChannel(_0x2da518){var _0x501b16=this,_0xcc2450=new AGIReply(),_0x2e6e4f=![],_0x24a908={};EventEmitter[_0xda24('0x6')](_0x501b16);_0x2da518['setEncoding'](_0xda24('0x7'));_0x2da518[_0xda24('0x8')](0x8*0x3c*0x3c*0x3e8);_0xcc2450['setEncoding'](_0xda24('0x7'));_0xcc2450['on']('headers',function(_0x446e2e){for(var _0x4f5d7e in _0x446e2e){_0x501b16[_0x4f5d7e]=_0x446e2e[_0x4f5d7e];}_0x501b16[_0xda24('0x9')](_0xda24('0xa'));});_0xcc2450['on']('line',function(_0x243fc8){if(_0x243fc8[_0xda24('0xb')]()==_0xda24('0xc')){_0x501b16[_0xda24('0x9')](_0xda24('0xc'));return;}if(_0x243fc8['substring'](0x0,0xb)==_0xda24('0xd')){_0x2e6e4f=!![];}if(_0x2e6e4f){_0x24a908['rx']+=_0x243fc8+'\x0a';if(_0x243fc8['search'](_0xda24('0xe'))!=-0x1){_0x2e6e4f=![];}}else{_0x24a908['rx']=_0x243fc8;}if(_0x2e6e4f){return;}if(typeof _0x24a908['cb']==_0xda24('0xf')){var _0x519fb9=_0x24a908['rx'][_0xda24('0x10')](0x0,0x3),_0x54b23d=null,_0x2e3505=null;_0x519fb9=parseInt(_0x519fb9);if(isNaN(_0x519fb9)){_0x24a908['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xda24('0x11')});return;}if(_0x519fb9!=0xc8){_0x24a908['cb'](null,{'code':_0x519fb9,'result':-0x1,'extra':'KO'});return;}_0x54b23d=_0x24a908['rx'][_0xda24('0x10')](0x4)['replace'](_0xda24('0x12'),'');if(_0x54b23d['indexOf']('\x20')!=-0x1){_0x54b23d=_0x54b23d[_0xda24('0x13')](0x0,_0x54b23d[_0xda24('0x14')]('\x20'));}if(_['startsWith'](_0x54b23d,'-1')){_0x54b23d=parseInt(_0x54b23d);}_0x2e3505=_0x24a908['rx']['split']('\x20');if(_0x2e3505[_0xda24('0x15')]==0x3){_0x2e3505=_0x2e3505[0x2][_0xda24('0x10')](0x1,_0x2e3505[0x2][_0xda24('0x15')]-0x1);}else if(_0x2e3505[_0xda24('0x15')]>0x3){var _0x3348e0=/\((.+)\)/;var _0x2754f2=_0x24a908['rx'][_0xda24('0x16')](_0x3348e0);if(_0x2754f2){_0x2e3505=_0x2754f2[0x1];}else{_0x2e3505=null;}}else{_0x2e3505=null;}_0x24a908['cb'](null,{'code':_0x519fb9,'result':_0x54b23d,'extra':_0x2e3505});}});_0x2da518['on'](_0xda24('0x17'),function(_0x847878){_0x501b16['emit'](_0xda24('0x17'),new AGIError(_0xda24('0x18'),_0x847878['code']));});_0x2da518['on'](_0xda24('0x19'),function(){_0x501b16['emit']('close',new AGIError(_0xda24('0x1a')));});_0x2da518['on'](_0xda24('0x1b'),function(){_0x501b16[_0xda24('0x9')](_0xda24('0x1b'),new AGIError(_0xda24('0x1c')));_0x2da518[_0xda24('0x1d')]();});_0x2da518[_0xda24('0x1e')](_0xcc2450);this['command']=function(_0xf36f2a,_0x5f53a3){var _0xf36f2a=_0xf36f2a||'',_0x5f53a3=typeof _0x5f53a3==_0xda24('0xf')?_0x5f53a3:new Function();_0x24a908={'tx':_0xf36f2a,'rx':'','cb':_0x5f53a3};_0x2da518[_0xda24('0x1f')](_0xf36f2a+'\x0a');},this[_0xda24('0x19')]=function(){_0x2da518[_0xda24('0x1d')]();};}util[_0xda24('0x20')](AGIChannel,EventEmitter);AGIChannel[_0xda24('0x21')][_0xda24('0x22')]=function(_0x134753){return this[_0xda24('0x23')][_0xda24('0x24')](this,_0x134753);};AGIChannel['prototype'][_0xda24('0x25')]=function(){return this[_0xda24('0x22')](_0xda24('0x26'));};AGIChannel[_0xda24('0x21')][_0xda24('0x27')]=function(_0x3f666b,_0x5bf414,_0x207c5d){_0x3f666b=_0x3f666b===undefined?'beep':_0x3f666b;_0x5bf414=_0x5bf414===undefined?'5':_0x5bf414;_0x207c5d=_0x207c5d===undefined?'1':_0x207c5d;return this[_0xda24('0x22')](util[_0xda24('0x28')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x3f666b,_0x5bf414*0x3e8,_0x207c5d));};AGIChannel[_0xda24('0x21')][_0xda24('0x29')]=function(_0x49a311){_0x49a311=_0x49a311||_0xda24('0x2a');return this[_0xda24('0x22')](util[_0xda24('0x28')](_0xda24('0x2b'),_0x49a311));};AGIChannel[_0xda24('0x21')]['exec']=function(_0x5e6fe6,_0x20f60d){if(_['isArray'](_0x20f60d)){return this['sendRequest'](util[_0xda24('0x28')](_0xda24('0x2c'),_0x5e6fe6,_0x20f60d['join'](',')));}return this['sendRequest'](util[_0xda24('0x28')](_0xda24('0x2c'),_0x5e6fe6,_0x20f60d));};AGIChannel['prototype']['setContext']=function(_0x3bc177){return this[_0xda24('0x22')](util[_0xda24('0x28')](_0xda24('0x2d'),_0x3bc177));};AGIChannel[_0xda24('0x21')]['setExtension']=function(_0x136e27){return this[_0xda24('0x22')](util[_0xda24('0x28')](_0xda24('0x2e'),_0x136e27));};AGIChannel['prototype'][_0xda24('0x2f')]=function(_0x567568){return this[_0xda24('0x22')](util[_0xda24('0x28')](_0xda24('0x30'),_0x567568));};AGIChannel[_0xda24('0x21')][_0xda24('0xc')]=function(){return this['sendRequest'](_0xda24('0x31'));};AGIChannel[_0xda24('0x21')][_0xda24('0x32')]=function(_0x226be6,_0x3e3e81){var _0x50523a=_[_0xda24('0x33')](_0x3e3e81)||_[_0xda24('0x34')](_0x3e3e81)?_0x3e3e81['toString']():_0x3e3e81;return this['sendRequest'](util['format'](_0xda24('0x35'),_0x226be6,_0x50523a?_0x50523a[_0xda24('0x36')]()[_0xda24('0x37')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xda24('0x21')][_0xda24('0x38')]=function(_0xb4f489,_0x568e39){return this[_0xda24('0x22')](util[_0xda24('0x28')](_0xda24('0x39'),_0xb4f489,_0x568e39));};AGIChannel['prototype'][_0xda24('0x3a')]=function(_0x4b4d84,_0x25d0cd){return this['sendRequest'](util[_0xda24('0x28')]('SAY\x20DIGITS\x20%s\x20%s',_0x4b4d84,_0x25d0cd));};AGIChannel[_0xda24('0x21')]['sayPhonetic']=function(_0x5e81e8,_0x10320b){return this[_0xda24('0x22')](util[_0xda24('0x28')](_0xda24('0x3b'),_0x5e81e8,_0x10320b));};AGIChannel[_0xda24('0x21')][_0xda24('0x3c')]=function(_0x4269a9,_0x4a8610,_0x1dd63){_0x4a8610=_0x4a8610||this[_0xda24('0x3d')];_0x1dd63=_0x1dd63||0x1;this[_0xda24('0x3e')](_0x4269a9);this[_0xda24('0x3f')](_0x4a8610);this[_0xda24('0x2f')](_0x1dd63);return this[_0xda24('0x29')](util[_0xda24('0x28')](_0xda24('0x40'),_0x4269a9,_0x4a8610,_0x1dd63));};AGIChannel[_0xda24('0x21')][_0xda24('0x41')]=function(_0x4aea76){return this[_0xda24('0x22')](util[_0xda24('0x28')](_0xda24('0x42'),_0x4aea76));};AGIChannel[_0xda24('0x21')]['recordFile']=function(_0x2b462b,_0x46756c,_0x5ceb8c,_0x57a1a9,_0x48dd5e,_0x5470e8){_0x46756c=_0x46756c||'wav';_0x5ceb8c=_0x5ceb8c||'';_0x57a1a9=_0x57a1a9===undefined?-0x1:_0x57a1a9==='-1'?-0x1:_0x57a1a9*0x3e8;_0x48dd5e=_0x48dd5e===undefined?'':'s='+_0x48dd5e;_0x5470e8=_0x5470e8?'BEEP':'';return this[_0xda24('0x22')](util[_0xda24('0x28')](_0xda24('0x43'),_0x2b462b,_0x46756c,_0x5ceb8c,_0x57a1a9,_0x5470e8,_0x48dd5e));};AGIChannel[_0xda24('0x21')][_0xda24('0x44')]=function(_0x4962d4,_0xf7b3b3){_0xf7b3b3=_0xf7b3b3||'';return this[_0xda24('0x22')](util[_0xda24('0x28')](_0xda24('0x45'),_0x4962d4,_0xf7b3b3));};AGIChannel['prototype'][_0xda24('0x46')]=function(_0x2dd5c5){return this[_0xda24('0x47')](_0xda24('0x48'),_0x2dd5c5);};AGIChannel[_0xda24('0x21')]['wait']=function(_0x4c12bc){return this[_0xda24('0x47')](_0xda24('0x49'),_0x4c12bc);};AGIChannel[_0xda24('0x21')][_0xda24('0x17')]=function(_0x14a399,_0x37a834){this[_0xda24('0x29')](util['format'](_0xda24('0x4a'),_0x14a399['id'],_0x14a399[_0xda24('0x4b')],_0x37a834));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file +var _0xc7d3=['split','length','error','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','prototype','sendRequest','sync','answer','ANSWER','getData','beep','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','format','VERBOSE\x20\x22%s\x22','exec','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','GOTO\x20%s\x20%s\x20%s','getVariable','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','util','events','./error','setEncoding','utf8','headers','emit','ready','line','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','replace','indexOf','substr','startsWith'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xc7d3,0x1f3));var _0x3c7d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc7d3[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0x3c7d('0x0'));var _=require('lodash');var EventEmitter=require(_0x3c7d('0x1'))['EventEmitter'];var AGIReply=require('./reply');var AGIError=require(_0x3c7d('0x2'));function AGIChannel(_0xedc741){var _0x42ae07=this,_0x179232=new AGIReply(),_0x1c3036=![],_0x51e9a6={};EventEmitter['call'](_0x42ae07);_0xedc741[_0x3c7d('0x3')](_0x3c7d('0x4'));_0xedc741['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x179232['setEncoding']('utf8');_0x179232['on'](_0x3c7d('0x5'),function(_0x47c9d8){for(var _0x53d559 in _0x47c9d8){_0x42ae07[_0x53d559]=_0x47c9d8[_0x53d559];}_0x42ae07[_0x3c7d('0x6')](_0x3c7d('0x7'));});_0x179232['on'](_0x3c7d('0x8'),function(_0x4e3d90){if(_0x4e3d90['toLowerCase']()==_0x3c7d('0x9')){_0x42ae07[_0x3c7d('0x6')](_0x3c7d('0x9'));return;}if(_0x4e3d90[_0x3c7d('0xa')](0x0,0xb)==_0x3c7d('0xb')){_0x1c3036=!![];}if(_0x1c3036){_0x51e9a6['rx']+=_0x4e3d90+'\x0a';if(_0x4e3d90[_0x3c7d('0xc')](_0x3c7d('0xd'))!=-0x1){_0x1c3036=![];}}else{_0x51e9a6['rx']=_0x4e3d90;}if(_0x1c3036){return;}if(typeof _0x51e9a6['cb']==_0x3c7d('0xe')){var _0x25c778=_0x51e9a6['rx']['substring'](0x0,0x3),_0x2bdcb8=null,_0x57aeb1=null;_0x25c778=parseInt(_0x25c778);if(isNaN(_0x25c778)){_0x51e9a6['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x25c778!=0xc8){_0x51e9a6['cb'](null,{'code':_0x25c778,'result':-0x1,'extra':'KO'});return;}_0x2bdcb8=_0x51e9a6['rx']['substring'](0x4)[_0x3c7d('0xf')]('result=','');if(_0x2bdcb8[_0x3c7d('0x10')]('\x20')!=-0x1){_0x2bdcb8=_0x2bdcb8[_0x3c7d('0x11')](0x0,_0x2bdcb8[_0x3c7d('0x10')]('\x20'));}if(_[_0x3c7d('0x12')](_0x2bdcb8,'-1')){_0x2bdcb8=parseInt(_0x2bdcb8);}_0x57aeb1=_0x51e9a6['rx'][_0x3c7d('0x13')]('\x20');if(_0x57aeb1[_0x3c7d('0x14')]==0x3){_0x57aeb1=_0x57aeb1[0x2]['substring'](0x1,_0x57aeb1[0x2]['length']-0x1);}else if(_0x57aeb1[_0x3c7d('0x14')]>0x3){var _0x2ec049=/\((.+)\)/;var _0x2caa1f=_0x51e9a6['rx']['match'](_0x2ec049);if(_0x2caa1f){_0x57aeb1=_0x2caa1f[0x1];}else{_0x57aeb1=null;}}else{_0x57aeb1=null;}_0x51e9a6['cb'](null,{'code':_0x25c778,'result':_0x2bdcb8,'extra':_0x57aeb1});}});_0xedc741['on'](_0x3c7d('0x15'),function(_0x387772){_0x42ae07['emit'](_0x3c7d('0x15'),new AGIError('E_AGI_SOCKET_ERROR',_0x387772['code']));});_0xedc741['on'](_0x3c7d('0x16'),function(){_0x42ae07[_0x3c7d('0x6')]('close',new AGIError(_0x3c7d('0x17')));});_0xedc741['on'](_0x3c7d('0x18'),function(){_0x42ae07[_0x3c7d('0x6')](_0x3c7d('0x18'),new AGIError(_0x3c7d('0x19')));_0xedc741[_0x3c7d('0x1a')]();});_0xedc741[_0x3c7d('0x1b')](_0x179232);this[_0x3c7d('0x1c')]=function(_0x5e6d2f,_0x32fbc3){var _0x5e6d2f=_0x5e6d2f||'',_0x32fbc3=typeof _0x32fbc3=='function'?_0x32fbc3:new Function();_0x51e9a6={'tx':_0x5e6d2f,'rx':'','cb':_0x32fbc3};_0xedc741[_0x3c7d('0x1d')](_0x5e6d2f+'\x0a');},this['close']=function(){_0xedc741[_0x3c7d('0x1a')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0x3c7d('0x1e')][_0x3c7d('0x1f')]=function(_0x7f194a){return this[_0x3c7d('0x1c')][_0x3c7d('0x20')](this,_0x7f194a);};AGIChannel[_0x3c7d('0x1e')][_0x3c7d('0x21')]=function(){return this[_0x3c7d('0x1f')](_0x3c7d('0x22'));};AGIChannel[_0x3c7d('0x1e')][_0x3c7d('0x23')]=function(_0x409043,_0x1ab607,_0x4c3b1c){_0x409043=_0x409043===undefined?_0x3c7d('0x24'):_0x409043;_0x1ab607=_0x1ab607===undefined?'5':_0x1ab607;_0x4c3b1c=_0x4c3b1c===undefined?'1':_0x4c3b1c;return this['sendRequest'](util['format'](_0x3c7d('0x25'),_0x409043,_0x1ab607*0x3e8,_0x4c3b1c));};AGIChannel['prototype'][_0x3c7d('0x26')]=function(_0x46e5c0){_0x46e5c0=_0x46e5c0||_0x3c7d('0x27');return this[_0x3c7d('0x1f')](util[_0x3c7d('0x28')](_0x3c7d('0x29'),_0x46e5c0));};AGIChannel[_0x3c7d('0x1e')][_0x3c7d('0x2a')]=function(_0x9b9722,_0x2bf03){if(_['isArray'](_0x2bf03)){return this['sendRequest'](util[_0x3c7d('0x28')](_0x3c7d('0x2b'),_0x9b9722,_0x2bf03[_0x3c7d('0x2c')](',')));}return this[_0x3c7d('0x1f')](util[_0x3c7d('0x28')](_0x3c7d('0x2b'),_0x9b9722,_0x2bf03));};AGIChannel[_0x3c7d('0x1e')][_0x3c7d('0x2d')]=function(_0x721da1){return this[_0x3c7d('0x1f')](util[_0x3c7d('0x28')](_0x3c7d('0x2e'),_0x721da1));};AGIChannel['prototype'][_0x3c7d('0x2f')]=function(_0x5b608f){return this[_0x3c7d('0x1f')](util[_0x3c7d('0x28')](_0x3c7d('0x30'),_0x5b608f));};AGIChannel[_0x3c7d('0x1e')]['setPriority']=function(_0xa486e1){return this['sendRequest'](util[_0x3c7d('0x28')](_0x3c7d('0x31'),_0xa486e1));};AGIChannel['prototype']['hangup']=function(){return this['sendRequest'](_0x3c7d('0x32'));};AGIChannel[_0x3c7d('0x1e')][_0x3c7d('0x33')]=function(_0x48b713,_0x11ca22){var _0x2e372a=_[_0x3c7d('0x34')](_0x11ca22)||_[_0x3c7d('0x35')](_0x11ca22)?_0x11ca22['toString']():_0x11ca22;return this[_0x3c7d('0x1f')](util[_0x3c7d('0x28')](_0x3c7d('0x36'),_0x48b713,_0x2e372a?_0x2e372a['toString']()[_0x3c7d('0xf')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x3c7d('0x1e')][_0x3c7d('0x37')]=function(_0x532761,_0x3035a7){return this[_0x3c7d('0x1f')](util[_0x3c7d('0x28')](_0x3c7d('0x38'),_0x532761,_0x3035a7));};AGIChannel[_0x3c7d('0x1e')]['sayDigits']=function(_0x6f448d,_0x1bcef1){return this['sendRequest'](util[_0x3c7d('0x28')](_0x3c7d('0x39'),_0x6f448d,_0x1bcef1));};AGIChannel[_0x3c7d('0x1e')]['sayPhonetic']=function(_0x34973f,_0x4176c4){return this['sendRequest'](util['format'](_0x3c7d('0x3a'),_0x34973f,_0x4176c4));};AGIChannel[_0x3c7d('0x1e')][_0x3c7d('0x3b')]=function(_0x4a007e,_0x1ac0fe,_0x22eb17){_0x1ac0fe=_0x1ac0fe||this[_0x3c7d('0x3c')];_0x22eb17=_0x22eb17||0x1;this[_0x3c7d('0x2d')](_0x4a007e);this[_0x3c7d('0x2f')](_0x1ac0fe);this['setPriority'](_0x22eb17);return this[_0x3c7d('0x26')](util[_0x3c7d('0x28')](_0x3c7d('0x3d'),_0x4a007e,_0x1ac0fe,_0x22eb17));};AGIChannel['prototype'][_0x3c7d('0x3e')]=function(_0x17f3c6){return this[_0x3c7d('0x1f')](util['format']('GET\x20VARIABLE\x20\x22%s\x22',_0x17f3c6));};AGIChannel[_0x3c7d('0x1e')][_0x3c7d('0x3f')]=function(_0x55f96e,_0x5b79e9,_0x1e1cca,_0x269064,_0x2e147e,_0x347b81){_0x5b79e9=_0x5b79e9||_0x3c7d('0x40');_0x1e1cca=_0x1e1cca||'';_0x269064=_0x269064===undefined?-0x1:_0x269064==='-1'?-0x1:_0x269064*0x3e8;_0x2e147e=_0x2e147e===undefined?'':'s='+_0x2e147e;_0x347b81=_0x347b81?_0x3c7d('0x41'):'';return this[_0x3c7d('0x1f')](util['format'](_0x3c7d('0x42'),_0x55f96e,_0x5b79e9,_0x1e1cca,_0x269064,_0x347b81,_0x2e147e));};AGIChannel[_0x3c7d('0x1e')][_0x3c7d('0x43')]=function(_0xd224aa,_0x325de1){_0x325de1=_0x325de1||'';return this[_0x3c7d('0x1f')](util[_0x3c7d('0x28')](_0x3c7d('0x44'),_0xd224aa,_0x325de1));};AGIChannel[_0x3c7d('0x1e')][_0x3c7d('0x45')]=function(_0x357aab){return this['exec'](_0x3c7d('0x46'),_0x357aab);};AGIChannel[_0x3c7d('0x1e')]['wait']=function(_0x55aa33){return this[_0x3c7d('0x2a')](_0x3c7d('0x47'),_0x55aa33);};AGIChannel['prototype']['error']=function(_0x45d972,_0x1a14de){this[_0x3c7d('0x26')](util[_0x3c7d('0x28')](_0x3c7d('0x48'),_0x45d972['id'],_0x45d972[_0x3c7d('0x49')],_0x1a14de));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index bea84ea..b804ff9 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 _0xd185=['exports','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message'];(function(_0x25fa9e,_0x3d1094){var _0x1a2e2c=function(_0x3d103a){while(--_0x3d103a){_0x25fa9e['push'](_0x25fa9e['shift']());}};_0x1a2e2c(++_0x3d1094);}(_0xd185,0x10b));var _0x5d18=function(_0x1cb9b0,_0x2a09c2){_0x1cb9b0=_0x1cb9b0-0x0;var _0x5e2c4c=_0xd185[_0x1cb9b0];return _0x5e2c4c;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x5d18('0x0'),'E_AGI_SERVER_ERROR':_0x5d18('0x1'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0x5d18('0x2'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x5d18('0x3'),'E_AGI_SOCKET_CLOSE':_0x5d18('0x4'),'E_AGI_SOCKET_TIMEOUT':_0x5d18('0x5'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x5d18('0x6'),'E_AGI_IVR_ENTRY':_0x5d18('0x7')};function AGIError(_0xde95d5){var _0xde95d5=_0xde95d5||null,_0x3c3231=_0x3c3231||[],_0x5a3cdd=0x1,_0x4e6ae1='';if(!error[_0xde95d5]){_0xde95d5=_0x5d18('0x8');}_0x3c3231[_0x5d18('0x9')](error[_0xde95d5]);while(arguments[_0x5a3cdd]){_0x3c3231['push'](arguments[_0x5a3cdd]);_0x5a3cdd++;}_0x4e6ae1=util[_0x5d18('0xa')][_0x5d18('0xb')](util,_0x3c3231);this[_0x5d18('0xc')]=_0x4e6ae1;this['name']=_0xde95d5;}module[_0x5d18('0xd')]=AGIError; \ No newline at end of file +var _0xaa2d=['push','format','apply','message','name','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_UNDEFINED'];(function(_0x595d29,_0x3cab2a){var _0x254cdf=function(_0x2f3b9c){while(--_0x2f3b9c){_0x595d29['push'](_0x595d29['shift']());}};_0x254cdf(++_0x3cab2a);}(_0xaa2d,0x18c));var _0xdaa2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaa2d[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xdaa2('0x0'));var error={'E_AGI_UNDEFINED':_0xdaa2('0x1'),'E_AGI_ARGUMENT_PORT':_0xdaa2('0x2'),'E_AGI_SERVER_ERROR':_0xdaa2('0x3'),'E_AGI_SERVER_CLOSE':_0xdaa2('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0xdaa2('0x5'),'E_AGI_SERVER_VOICE_DISABLED':_0xdaa2('0x6'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0xdaa2('0x7'),'E_AGI_SOCKET_TIMEOUT':_0xdaa2('0x8'),'E_AGI_COMMAND_EMPTY':_0xdaa2('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xdaa2('0xa'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x3c4810){var _0x3c4810=_0x3c4810||null,_0x53cf5f=_0x53cf5f||[],_0x2b70e0=0x1,_0x51751e='';if(!error[_0x3c4810]){_0x3c4810=_0xdaa2('0xb');}_0x53cf5f['push'](error[_0x3c4810]);while(arguments[_0x2b70e0]){_0x53cf5f[_0xdaa2('0xc')](arguments[_0x2b70e0]);_0x2b70e0++;}_0x51751e=util[_0xdaa2('0xd')][_0xdaa2('0xe')](util,_0x53cf5f);this[_0xdaa2('0xf')]=_0x51751e;this[_0xdaa2('0x10')]=_0x3c4810;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 5406614..c808b9e 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 _0xe195=['no\x20edge/s\x20available','condition','split','agicommand','vswitch','target','default','invalid','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','agi','menu','getdigits','getsecretdigits','vertices','numberOfEdges','prototype','addVertex','edges','size','relations','traverseBFS','info','length'];(function(_0x3b7a06,_0x41f79e){var _0x363e31=function(_0x51e3f5){while(--_0x51e3f5){_0x3b7a06['push'](_0x3b7a06['shift']());}};_0x363e31(++_0x41f79e);}(_0xe195,0x1c6));var _0x5e19=function(_0x1862bd,_0x6da078){_0x1862bd=_0x1862bd-0x0;var _0x5a1bfa=_0xe195[_0x1862bd];return _0x5a1bfa;};'use strict';var _=require('lodash');var logger=require('../../../config/logger')(_0x5e19('0x0'));var verticesWithRetry=[_0x5e19('0x1'),_0x5e19('0x2'),_0x5e19('0x3')];var Graph=function(){this[_0x5e19('0x4')]={};this['edges']={};this[_0x5e19('0x5')]=0x0;};Graph[_0x5e19('0x6')][_0x5e19('0x7')]=function(_0x14a70e){this[_0x5e19('0x4')][_0x14a70e['id']]=_0x14a70e;this['edges'][_0x14a70e['id']]=[];};Graph[_0x5e19('0x6')]['addEdge']=function(_0x1e40c4,_0x21e440,_0x377428){this[_0x5e19('0x8')][_0x1e40c4]['push']({'target':_0x21e440,'condition':_0x377428});this[_0x5e19('0x5')]+=0x1;};Graph['prototype'][_0x5e19('0x9')]=function(){return _[_0x5e19('0x9')](this[_0x5e19('0x4')]);};Graph[_0x5e19('0x6')][_0x5e19('0xa')]=function(){return this[_0x5e19('0x5')];};Graph[_0x5e19('0x6')]['getVertex']=function(_0x2db85f){return this[_0x5e19('0x4')][_0x2db85f];};Graph[_0x5e19('0x6')][_0x5e19('0xb')]=function(_0x316098,_0x5dfc07){if(!this[_0x5e19('0x4')][_0x316098]){return logger[_0x5e19('0xc')]('no\x20vertex\x20found');}var _0x228bd9=_0x5dfc07(this[_0x5e19('0x4')][_0x316098]);if(!_0x228bd9){return logger[_0x5e19('0xc')]('stop\x20traverse');}if(this['edges'][_0x316098][_0x5e19('0xd')]===0x0){return logger['info'](_0x5e19('0xe'));}for(var _0x1a15ea=0x0,_0x3325aa=[],_0x5e72a3=![];_0x1a15ea\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','isUndefined','toString','agicommand\x20not\x20found','finally','[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','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','./server','listening','connection','xml2json','syncho','util','moment','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./mailRpc','./graph','./vertices','127.0.0.1','nextTick','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','error','[ERROR]\x20%s','stack','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','evtHangup','toJson'];(function(_0x3566c0,_0x264311){var _0x55edbb=function(_0xf50e1d){while(--_0xf50e1d){_0x3566c0['push'](_0x3566c0['shift']());}};_0x55edbb(++_0x264311);}(_0x767d,0x1f2));var _0xd767=function(_0x4cf482,_0x4417f0){_0x4cf482=_0x4cf482-0x0;var _0x394326=_0x767d[_0x4cf482];return _0x394326;};'use strict';var parser=require(_0xd767('0x0'));var _=require('lodash');var syncho=require(_0xd767('0x1'));var util=require(_0xd767('0x2'));var moment=require(_0xd767('0x3'));var config=require(_0xd767('0x4'));var logger=require(_0xd767('0x5'))(_0xd767('0x6'));var utilLicense=require(_0xd767('0x7'));var rpc=require(_0xd767('0x8'));var mailRpc=require(_0xd767('0x9'));var Graph=require(_0xd767('0xa'));var Vertices=require(_0xd767('0xb'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xd767('0x6')]=_['defaults'](config['agi'],{'ip':_0xd767('0xc'),'port':0x11dd});function connectionHandler(_0x9cc1ee){process[_0xd767('0xd')](function(){syncho(function(){try{setChannelVariables(_0x9cc1ee);agiHandler(_0x9cc1ee);}catch(_0x2d980d){logger['error'](_0x2d980d['stack']);}});});}function listeningHandler(){console[_0xd767('0xe')](_0xd767('0xf'),config[_0xd767('0x6')][_0xd767('0x10')]);logger[_0xd767('0x11')](util[_0xd767('0x12')](_0xd767('0x13'),config['agi']['ip'],config['agi'][_0xd767('0x10')]));}function errorHandler(_0x261f8d){if(_0x261f8d&&_0x261f8d[_0xd767('0x14')]&&_0x261f8d[_0xd767('0x15')]){logger['error'](util[_0xd767('0x12')](_0xd767('0x16'),_0x261f8d['name'],_0x261f8d[_0xd767('0x15')]));}else{logger[_0xd767('0x17')](util['format'](_0xd767('0x18'),_0x261f8d[_0xd767('0x19')]));}}function closeHandler(){logger['info'](util[_0xd767('0x12')](_0xd767('0x1a'),this['arg_1'],this[_0xd767('0x1b')],this[_0xd767('0x1c')],this[_0xd767('0x1d')],this['uniqueid']));try{createSquareReport(this);}catch(_0x237972){logger[_0xd767('0x17')](_0x237972[_0xd767('0x19')]);}}function timeoutHandler(){logger[_0xd767('0x11')](util[_0xd767('0x12')](_0xd767('0x1e'),this[_0xd767('0x1f')],this[_0xd767('0x1b')],this[_0xd767('0x1c')],this[_0xd767('0x1d')],this['uniqueid']));}function hangupHandler(){logger['info'](util[_0xd767('0x12')](_0xd767('0x20'),this[_0xd767('0x1f')],this['calleridname'],this[_0xd767('0x1c')],this[_0xd767('0x1d')],this[_0xd767('0x21')]));this[_0xd767('0x22')]=!![];}function getRoot(_0x34f0b0){return parser[_0xd767('0x23')](_0x34f0b0,{'object':!![]})[_0xd767('0x24')][_0xd767('0x25')];}function addVertex(_0x202cd1,_0xc24a9a,_0x47c0e3){_0xc24a9a[_0xd767('0x26')]=_0x47c0e3;if(_0xc24a9a[_0xd767('0x27')](_0xd767('0x28'))){_0xc24a9a['maxRetry']=parseInt(_0xc24a9a[_0xd767('0x28')],0xa);}_0x202cd1[_0xd767('0x29')](_['omit'](_0xc24a9a,_0xd767('0x2a')));}function initGraph(_0x2b2e7b,_0x14234e){var _0x5ce092=new Graph();for(var _0x52e14e in _0x2b2e7b){if(_0x2b2e7b[_0xd767('0x27')](_0x52e14e)){if(_['isArray'](_0x2b2e7b[_0x52e14e])){for(var _0x17a611=0x0;_0x17a611<_0x2b2e7b[_0x52e14e][_0xd767('0x2b')];_0x17a611+=0x1){addVertex(_0x5ce092,_0x2b2e7b[_0x52e14e][_0x17a611],_0x52e14e);}}else{addVertex(_0x5ce092,_0x2b2e7b[_0x52e14e],_0x52e14e);}}}for(var _0x3218b0=0x0;_0x3218b0<_0x14234e['length'];_0x3218b0+=0x1){if(_0x14234e[_0x3218b0]['source']&&_0x14234e[_0x3218b0][_0xd767('0x2c')]){_0x5ce092['addEdge'](_0x14234e[_0x3218b0][_0xd767('0x2d')],_0x14234e[_0x3218b0][_0xd767('0x2c')],_0x14234e[_0x3218b0][_0xd767('0x2e')]);}}return _0x5ce092;}function getSquareProject(_0x145064,_0x33da0c){rpc[_0xd767('0x2f')](_0x145064)[_0xd767('0x30')](function(_0x2f52b1){_0x33da0c(null,_0x2f52b1);})[_0xd767('0x31')](function(_0x38633f){_0x33da0c(null,_0x38633f);});}function createSquareReport(_0x449e0f,_0x48f796){rpc['createSquareReport'](_0x449e0f)[_0xd767('0x30')](function(_0x85933a){if(_0x48f796){_0x48f796(null,_0x85933a);}})['catch'](function(_0x1a4c4e){if(_0x48f796){_0x48f796(null,_0x1a4c4e);}});}function setChannelVariables(_0x1b1c5d){for(var _0x4546d9 in _0x1b1c5d){if(_0x1b1c5d['hasOwnProperty'](_0x4546d9)){if(_0x4546d9['indexOf'](_0xd767('0x32'))===0x0){_0x1b1c5d[_0x4546d9[_0xd767('0x33')](0x4)]=_0x1b1c5d[_0x4546d9];delete _0x1b1c5d[_0x4546d9];}}}}function getLogFromObject(_0x1b1f93){return util[_0xd767('0x34')](_0x1b1f93,{'showHidden':![],'depth':null});}function agiHandler(_0x5bcee2){var _0x490f13,_0x280e23,_0x35bfc4,_0x23cfbd,_0x5b82ca;logger[_0xd767('0x35')]('variables',JSON[_0xd767('0x36')](_0x5bcee2,null,0x2));logger[_0xd767('0x11')](util[_0xd767('0x12')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x5bcee2[_0xd767('0x1f')],_0x5bcee2['calleridname'],_0x5bcee2['callerid'],_0x5bcee2[_0xd767('0x1d')],_0x5bcee2['uniqueid']));_0x5bcee2['on'](_0xd767('0x17'),errorHandler);_0x5bcee2['on'](_0xd767('0x37'),closeHandler);_0x5bcee2['on'](_0xd767('0x38'),timeoutHandler);_0x5bcee2[_0xd767('0x22')]=![];_0x5bcee2['on'](_0xd767('0x39'),hangupHandler);var _0x5c7bff=getSquareProject['sync'](null,_0x5bcee2[_0xd767('0x1f')]);if(_0x5c7bff){if(_0x5c7bff[_0xd767('0x3a')]){_0x490f13=getRoot(_0x5c7bff[_0xd767('0x3a')]);if(_0x490f13&&_0x490f13[_0xd767('0x3b')]){logger['debug'](_0xd767('0x25'),JSON[_0xd767('0x36')](_0x490f13,null,0x2));_0x5bcee2['joinAt']=moment()[_0xd767('0x12')](_0xd767('0x3c'));_0x280e23=initGraph(_[_0xd767('0x3d')](_0x490f13,_0xd767('0x2a')),_0x490f13[_0xd767('0x2a')]);_0x35bfc4=new Vertices(_0x5bcee2,rpc,mailRpc);logger[_0xd767('0x11')](util['format'](_0xd767('0x3e'),_0x5bcee2['arg_1'],_0x5bcee2[_0xd767('0x1b')],_0x5bcee2[_0xd767('0x1c')],_0x5bcee2[_0xd767('0x1d')],_0x5bcee2[_0xd767('0x21')]));_0x280e23[_0xd767('0x3f')](_0x490f13[_0xd767('0x3b')]['id'],function(_0x24422b){try{_0x24422b=_0x35bfc4[_0xd767('0x40')](_0x24422b);logger[_0xd767('0x35')](_0xd767('0x41'),JSON[_0xd767('0x36')](_0x24422b,null,0x2));if(_0x24422b['agicommand']===_0xd767('0x42')){logger['info'](_0xd767('0x43'));_0x5bcee2[_0xd767('0x44')]=_0x24422b[_0xd767('0x44')]||_0x5bcee2[_0xd767('0x44')];_0x5bcee2[_0xd767('0x45')]=_0x24422b[_0xd767('0x45')];_0x5bcee2['priority']=_0x24422b[_0xd767('0x46')]?_0x24422b['priority']-0x1:0x1;return null;}else if(_0x24422b&&_0x35bfc4[_0x24422b[_0xd767('0x26')]]){_0x5b82ca=_0x35bfc4[_0x24422b[_0xd767('0x26')]](_0x24422b);logger[_0xd767('0x11')](_0xd767('0x47'),JSON['stringify'](_0x5b82ca,null,0x2));if(_0x5b82ca&&_0x5b82ca[_0xd767('0x48')]===AGI_CODE_SUCCESS&&_0x5b82ca[_0xd767('0x49')]!==AGI_RESULT_ERROR&&!_0x5bcee2[_0xd767('0x22')]){logger[_0xd767('0x35')]('response',getLogFromObject(_0x5b82ca));return _[_0xd767('0x4a')](_0x5b82ca['result'])?null:_0x5b82ca['result'][_0xd767('0x4b')]();}else{logger[_0xd767('0x17')](_0xd767('0x47'),getLogFromObject(_0x5b82ca));return null;}}else{logger[_0xd767('0x17')](_0xd767('0x4c'));return null;}}catch(_0x21dc55){logger[_0xd767('0x17')](_0x21dc55[_0xd767('0x19')]);return null;}});if(_0x490f13[_0xd767('0x4d')]){logger[_0xd767('0x11')](util['format']('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x5bcee2[_0xd767('0x1f')],_0x5bcee2[_0xd767('0x1b')],_0x5bcee2['callerid'],_0x5bcee2[_0xd767('0x1d')],_0x5bcee2[_0xd767('0x21')]));_0x280e23[_0xd767('0x3f')](_0x490f13['finally']['id'],function(_0x282e11){try{_0x282e11=_0x35bfc4['clear'](_0x282e11);logger[_0xd767('0x35')](_0xd767('0x41'),JSON[_0xd767('0x36')](_0x282e11,null,0x2));if(_0x282e11&&_0x35bfc4[_0x282e11[_0xd767('0x26')]]){_0x5b82ca=_0x35bfc4[_0x282e11[_0xd767('0x26')]](_0x282e11);if(_0x5b82ca){logger['debug'](_0xd767('0x47'),getLogFromObject(_0x5b82ca));return _[_0xd767('0x4a')](_0x5b82ca[_0xd767('0x49')])?null:_0x5b82ca['result']['toString']();}else{logger[_0xd767('0x17')](_0xd767('0x47'),getLogFromObject(_0x5b82ca));return null;}}else{logger['error'](_0xd767('0x4c'));return null;}}catch(_0x311a08){logger['error'](_0x311a08[_0xd767('0x19')]);return null;}});}logger[_0xd767('0x11')](util['format'](_0xd767('0x4e'),_0x5bcee2[_0xd767('0x1f')],_0x5bcee2[_0xd767('0x1b')],_0x5bcee2['callerid'],_0x5bcee2[_0xd767('0x1d')],_0x5bcee2[_0xd767('0x21')]));logger[_0xd767('0x11')](util['format']('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x5bcee2[_0xd767('0x44')],_0x5bcee2[_0xd767('0x45')],parseInt(_0x5bcee2[_0xd767('0x46')],0xa)+0x1));_0x5bcee2['continueAt'](_0x5bcee2[_0xd767('0x44')],_0x5bcee2[_0xd767('0x45')],parseInt(_0x5bcee2['priority'],0xa)+0x1);_0x5bcee2['close']();}}else{logger[_0xd767('0x17')](util[_0xd767('0x12')]('Project\x20%s\x20not\x20published',_0x5bcee2['arg_1']));_0x5bcee2[_0xd767('0x4f')](_0x5bcee2['context'],_0x5bcee2[_0xd767('0x45')],parseInt(_0x5bcee2[_0xd767('0x46')],0xa)+0x1);_0x5bcee2[_0xd767('0x37')]();}}else{logger[_0xd767('0x17')](util[_0xd767('0x12')](_0xd767('0x50'),_0x5bcee2['arg_1']));_0x5bcee2[_0xd767('0x4f')](_0x5bcee2[_0xd767('0x44')],_0x5bcee2[_0xd767('0x45')],parseInt(_0x5bcee2[_0xd767('0x46')],0xa)+0x1);_0x5bcee2[_0xd767('0x37')]();}}function main(){var _0xf29f5d;return utilLicense['getLicense']()[_0xd767('0x30')](function(_0x38882d){if(_0x38882d){if(_0x38882d[_0xd767('0x51')]){if(_0x38882d[_0xd767('0x52')]&&_0x38882d[_0xd767('0x52')]>0x0){logger[_0xd767('0x11')](util[_0xd767('0x12')](_0xd767('0x53'),_0x38882d[_0xd767('0x52')]));_0xf29f5d=_0x38882d[_0xd767('0x52')];}else{logger[_0xd767('0x11')](_0xd767('0x54'));}}else{logger['info'](_0xd767('0x55'));_0xf29f5d=-0x1;}}})[_0xd767('0x31')](function(_0x2dd688){logger['error']('[LICENSE]',_0x2dd688['stack']);})['finally'](function(){var _0x491dd0=require(_0xd767('0x56'))(config[_0xd767('0x6')][_0xd767('0x10')],config[_0xd767('0x6')]['ip'],_0xf29f5d);_0x491dd0['on'](_0xd767('0x17'),errorHandler);_0x491dd0['on'](_0xd767('0x57'),listeningHandler);_0x491dd0['on'](_0xd767('0x58'),connectionHandler);_0x491dd0['on'](_0xd767('0x37'),closeHandler);});}main(); \ No newline at end of file +var _0xd9ea=['evtHangup','production','start','stringify','joinAt','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','extension','priority','response','code','result','isUndefined','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','clear','vertex','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','context','continueAt','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]','./server','listening','connection','lodash','syncho','moment','../../config/environment','../../config/logger','agi','../../config/license/util','./mailRpc','./vertices','defaults','nextTick','error','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','name','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','toJson','root','agicommand','retry','addVertex','omit','mxCell','hasOwnProperty','isArray','length','source','target','value','getSquareProject','then','catch','createSquareReport','indexOf','substring','inspect','debug','variables','close','timeout'];(function(_0x546aaf,_0x1ed138){var _0x1cbf6d=function(_0x36c837){while(--_0x36c837){_0x546aaf['push'](_0x546aaf['shift']());}};_0x1cbf6d(++_0x1ed138);}(_0xd9ea,0xd1));var _0xad9e=function(_0x2850c0,_0x1363a7){_0x2850c0=_0x2850c0-0x0;var _0x21e830=_0xd9ea[_0x2850c0];return _0x21e830;};'use strict';var parser=require('xml2json');var _=require(_0xad9e('0x0'));var syncho=require(_0xad9e('0x1'));var util=require('util');var moment=require(_0xad9e('0x2'));var config=require(_0xad9e('0x3'));var logger=require(_0xad9e('0x4'))(_0xad9e('0x5'));var utilLicense=require(_0xad9e('0x6'));var rpc=require('./rpc');var mailRpc=require(_0xad9e('0x7'));var Graph=require('./graph');var Vertices=require(_0xad9e('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config['agi']=_[_0xad9e('0x9')](config[_0xad9e('0x5')],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0x153bab){process[_0xad9e('0xa')](function(){syncho(function(){try{setChannelVariables(_0x153bab);agiHandler(_0x153bab);}catch(_0x24fd02){logger[_0xad9e('0xb')](_0x24fd02[_0xad9e('0xc')]);}});});}function listeningHandler(){console[_0xad9e('0xd')](_0xad9e('0xe'),config[_0xad9e('0x5')][_0xad9e('0xf')]);logger[_0xad9e('0x10')](util[_0xad9e('0x11')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0xad9e('0x5')]['ip'],config[_0xad9e('0x5')][_0xad9e('0xf')]));}function errorHandler(_0x8f8547){if(_0x8f8547&&_0x8f8547[_0xad9e('0x12')]&&_0x8f8547['message']){logger['error'](util[_0xad9e('0x11')]('[%s]\x20%s',_0x8f8547['name'],_0x8f8547['message']));}else{logger[_0xad9e('0xb')](util[_0xad9e('0x11')](_0xad9e('0x13'),_0x8f8547[_0xad9e('0xc')]));}}function closeHandler(){logger[_0xad9e('0x10')](util[_0xad9e('0x11')](_0xad9e('0x14'),this[_0xad9e('0x15')],this['calleridname'],this['callerid'],this[_0xad9e('0x16')],this['uniqueid']));try{createSquareReport(this);}catch(_0x263d90){logger[_0xad9e('0xb')](_0x263d90['stack']);}}function timeoutHandler(){logger[_0xad9e('0x10')](util[_0xad9e('0x11')](_0xad9e('0x17'),this[_0xad9e('0x15')],this[_0xad9e('0x18')],this[_0xad9e('0x19')],this['dnid'],this[_0xad9e('0x1a')]));}function hangupHandler(){logger['info'](util[_0xad9e('0x11')](_0xad9e('0x1b'),this[_0xad9e('0x15')],this[_0xad9e('0x18')],this[_0xad9e('0x19')],this[_0xad9e('0x16')],this[_0xad9e('0x1a')]));this['evtHangup']=!![];}function getRoot(_0x376f1e){return parser[_0xad9e('0x1c')](_0x376f1e,{'object':!![]})['mxGraphModel'][_0xad9e('0x1d')];}function addVertex(_0x2cb50e,_0x5183ea,_0x13aaa9){_0x5183ea[_0xad9e('0x1e')]=_0x13aaa9;if(_0x5183ea['hasOwnProperty'](_0xad9e('0x1f'))){_0x5183ea['maxRetry']=parseInt(_0x5183ea[_0xad9e('0x1f')],0xa);}_0x2cb50e[_0xad9e('0x20')](_[_0xad9e('0x21')](_0x5183ea,_0xad9e('0x22')));}function initGraph(_0x11bd98,_0xfc40dd){var _0x3168ff=new Graph();for(var _0x3e3563 in _0x11bd98){if(_0x11bd98[_0xad9e('0x23')](_0x3e3563)){if(_[_0xad9e('0x24')](_0x11bd98[_0x3e3563])){for(var _0x51473c=0x0;_0x51473c<_0x11bd98[_0x3e3563]['length'];_0x51473c+=0x1){addVertex(_0x3168ff,_0x11bd98[_0x3e3563][_0x51473c],_0x3e3563);}}else{addVertex(_0x3168ff,_0x11bd98[_0x3e3563],_0x3e3563);}}}for(var _0x54e463=0x0;_0x54e463<_0xfc40dd[_0xad9e('0x25')];_0x54e463+=0x1){if(_0xfc40dd[_0x54e463][_0xad9e('0x26')]&&_0xfc40dd[_0x54e463][_0xad9e('0x27')]){_0x3168ff['addEdge'](_0xfc40dd[_0x54e463][_0xad9e('0x26')],_0xfc40dd[_0x54e463]['target'],_0xfc40dd[_0x54e463][_0xad9e('0x28')]);}}return _0x3168ff;}function getSquareProject(_0x410f32,_0x52e6da){rpc[_0xad9e('0x29')](_0x410f32)[_0xad9e('0x2a')](function(_0x5b1d49){_0x52e6da(null,_0x5b1d49);})[_0xad9e('0x2b')](function(_0x2853cf){_0x52e6da(null,_0x2853cf);});}function createSquareReport(_0x4536d8,_0x7bf658){rpc[_0xad9e('0x2c')](_0x4536d8)[_0xad9e('0x2a')](function(_0x59b621){if(_0x7bf658){_0x7bf658(null,_0x59b621);}})[_0xad9e('0x2b')](function(_0x32d0f9){if(_0x7bf658){_0x7bf658(null,_0x32d0f9);}});}function setChannelVariables(_0x4d0b41){for(var _0x2ac167 in _0x4d0b41){if(_0x4d0b41[_0xad9e('0x23')](_0x2ac167)){if(_0x2ac167[_0xad9e('0x2d')]('agi_')===0x0){_0x4d0b41[_0x2ac167[_0xad9e('0x2e')](0x4)]=_0x4d0b41[_0x2ac167];delete _0x4d0b41[_0x2ac167];}}}}function getLogFromObject(_0xe7693f){return util[_0xad9e('0x2f')](_0xe7693f,{'showHidden':![],'depth':null});}function agiHandler(_0x34e102){var _0x5054d4,_0x2de162,_0x977dee,_0x13059a,_0x45c6a3;logger[_0xad9e('0x30')](_0xad9e('0x31'),JSON['stringify'](_0x34e102,null,0x2));logger[_0xad9e('0x10')](util[_0xad9e('0x11')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x34e102[_0xad9e('0x15')],_0x34e102['calleridname'],_0x34e102[_0xad9e('0x19')],_0x34e102['dnid'],_0x34e102[_0xad9e('0x1a')]));_0x34e102['on'](_0xad9e('0xb'),errorHandler);_0x34e102['on'](_0xad9e('0x32'),closeHandler);_0x34e102['on'](_0xad9e('0x33'),timeoutHandler);_0x34e102[_0xad9e('0x34')]=![];_0x34e102['on']('hangup',hangupHandler);var _0x7469dd=getSquareProject['sync'](null,_0x34e102[_0xad9e('0x15')]);if(_0x7469dd){if(_0x7469dd[_0xad9e('0x35')]){_0x5054d4=getRoot(_0x7469dd['production']);if(_0x5054d4&&_0x5054d4[_0xad9e('0x36')]){logger[_0xad9e('0x30')](_0xad9e('0x1d'),JSON[_0xad9e('0x37')](_0x5054d4,null,0x2));_0x34e102[_0xad9e('0x38')]=moment()[_0xad9e('0x11')](_0xad9e('0x39'));_0x2de162=initGraph(_[_0xad9e('0x21')](_0x5054d4,_0xad9e('0x22')),_0x5054d4[_0xad9e('0x22')]);_0x977dee=new Vertices(_0x34e102,rpc,mailRpc);logger[_0xad9e('0x10')](util[_0xad9e('0x11')](_0xad9e('0x3a'),_0x34e102[_0xad9e('0x15')],_0x34e102[_0xad9e('0x18')],_0x34e102['callerid'],_0x34e102[_0xad9e('0x16')],_0x34e102[_0xad9e('0x1a')]));_0x2de162[_0xad9e('0x3b')](_0x5054d4[_0xad9e('0x36')]['id'],function(_0x15a446){try{_0x15a446=_0x977dee['clear'](_0x15a446);logger[_0xad9e('0x30')]('vertex',JSON[_0xad9e('0x37')](_0x15a446,null,0x2));if(_0x15a446['agicommand']===_0xad9e('0x3c')){logger[_0xad9e('0x10')](_0xad9e('0x3d'));_0x34e102['context']=_0x15a446['context']||_0x34e102['context'];_0x34e102[_0xad9e('0x3e')]=_0x15a446['extension'];_0x34e102[_0xad9e('0x3f')]=_0x15a446[_0xad9e('0x3f')]?_0x15a446[_0xad9e('0x3f')]-0x1:0x1;return null;}else if(_0x15a446&&_0x977dee[_0x15a446[_0xad9e('0x1e')]]){_0x45c6a3=_0x977dee[_0x15a446['agicommand']](_0x15a446);logger[_0xad9e('0x10')](_0xad9e('0x40'),JSON[_0xad9e('0x37')](_0x45c6a3,null,0x2));if(_0x45c6a3&&_0x45c6a3[_0xad9e('0x41')]===AGI_CODE_SUCCESS&&_0x45c6a3[_0xad9e('0x42')]!==AGI_RESULT_ERROR&&!_0x34e102['evtHangup']){logger[_0xad9e('0x30')](_0xad9e('0x40'),getLogFromObject(_0x45c6a3));return _[_0xad9e('0x43')](_0x45c6a3[_0xad9e('0x42')])?null:_0x45c6a3[_0xad9e('0x42')][_0xad9e('0x44')]();}else{logger[_0xad9e('0xb')](_0xad9e('0x40'),getLogFromObject(_0x45c6a3));return null;}}else{logger[_0xad9e('0xb')](_0xad9e('0x45'));return null;}}catch(_0x3d6d32){logger['error'](_0x3d6d32[_0xad9e('0xc')]);return null;}});if(_0x5054d4[_0xad9e('0x46')]){logger['info'](util['format'](_0xad9e('0x47'),_0x34e102[_0xad9e('0x15')],_0x34e102[_0xad9e('0x18')],_0x34e102[_0xad9e('0x19')],_0x34e102['dnid'],_0x34e102[_0xad9e('0x1a')]));_0x2de162[_0xad9e('0x3b')](_0x5054d4['finally']['id'],function(_0x4d2019){try{_0x4d2019=_0x977dee[_0xad9e('0x48')](_0x4d2019);logger['debug'](_0xad9e('0x49'),JSON[_0xad9e('0x37')](_0x4d2019,null,0x2));if(_0x4d2019&&_0x977dee[_0x4d2019[_0xad9e('0x1e')]]){_0x45c6a3=_0x977dee[_0x4d2019['agicommand']](_0x4d2019);if(_0x45c6a3){logger['debug'](_0xad9e('0x40'),getLogFromObject(_0x45c6a3));return _[_0xad9e('0x43')](_0x45c6a3[_0xad9e('0x42')])?null:_0x45c6a3[_0xad9e('0x42')][_0xad9e('0x44')]();}else{logger['error'](_0xad9e('0x40'),getLogFromObject(_0x45c6a3));return null;}}else{logger['error']('agicommand\x20not\x20found');return null;}}catch(_0x53ec0b){logger[_0xad9e('0xb')](_0x53ec0b['stack']);return null;}});}logger[_0xad9e('0x10')](util[_0xad9e('0x11')](_0xad9e('0x4a'),_0x34e102[_0xad9e('0x15')],_0x34e102['calleridname'],_0x34e102[_0xad9e('0x19')],_0x34e102[_0xad9e('0x16')],_0x34e102['uniqueid']));logger['info'](util[_0xad9e('0x11')](_0xad9e('0x4b'),_0x34e102[_0xad9e('0x4c')],_0x34e102[_0xad9e('0x3e')],parseInt(_0x34e102['priority'],0xa)+0x1));_0x34e102[_0xad9e('0x4d')](_0x34e102['context'],_0x34e102[_0xad9e('0x3e')],parseInt(_0x34e102[_0xad9e('0x3f')],0xa)+0x1);_0x34e102[_0xad9e('0x32')]();}}else{logger[_0xad9e('0xb')](util['format']('Project\x20%s\x20not\x20published',_0x34e102[_0xad9e('0x15')]));_0x34e102['continueAt'](_0x34e102[_0xad9e('0x4c')],_0x34e102[_0xad9e('0x3e')],parseInt(_0x34e102[_0xad9e('0x3f')],0xa)+0x1);_0x34e102[_0xad9e('0x32')]();}}else{logger[_0xad9e('0xb')](util[_0xad9e('0x11')](_0xad9e('0x4e'),_0x34e102['arg_1']));_0x34e102[_0xad9e('0x4d')](_0x34e102[_0xad9e('0x4c')],_0x34e102[_0xad9e('0x3e')],parseInt(_0x34e102[_0xad9e('0x3f')],0xa)+0x1);_0x34e102[_0xad9e('0x32')]();}}function main(){var _0x180837;return utilLicense[_0xad9e('0x4f')]()[_0xad9e('0x2a')](function(_0x2aaee5){if(_0x2aaee5){if(_0x2aaee5[_0xad9e('0x50')]){if(_0x2aaee5[_0xad9e('0x51')]&&_0x2aaee5[_0xad9e('0x51')]>0x0){logger[_0xad9e('0x10')](util[_0xad9e('0x11')]('[LICENSE]\x20CHANNELS:\x20%s',_0x2aaee5[_0xad9e('0x51')]));_0x180837=_0x2aaee5['callysquare'];}else{logger[_0xad9e('0x10')](_0xad9e('0x52'));}}else{logger['info']('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x180837=-0x1;}}})[_0xad9e('0x2b')](function(_0x1338c6){logger[_0xad9e('0xb')](_0xad9e('0x53'),_0x1338c6[_0xad9e('0xc')]);})[_0xad9e('0x46')](function(){var _0x65e204=require(_0xad9e('0x54'))(config[_0xad9e('0x5')][_0xad9e('0xf')],config[_0xad9e('0x5')]['ip'],_0x180837);_0x65e204['on'](_0xad9e('0xb'),errorHandler);_0x65e204['on'](_0xad9e('0x55'),listeningHandler);_0x65e204['on'](_0xad9e('0x56'),connectionHandler);_0x65e204['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 7fa0696..fc96095 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 _0x4fff=['sendMailMessage','SendMail','bluebird','jayson/promise','client','error','message','result','catch'];(function(_0x32ced2,_0x52cd38){var _0x1e2a65=function(_0x58c8a6){while(--_0x58c8a6){_0x32ced2['push'](_0x32ced2['shift']());}};_0x1e2a65(++_0x52cd38);}(_0x4fff,0xe3));var _0xf4ff=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x4fff[_0x2dafbe];return _0x58a45a;};'use strict';var BPromise=require(_0xf4ff('0x0'));var jayson=require(_0xf4ff('0x1'));var client=jayson[_0xf4ff('0x2')]['http']({'port':0x232b});function request(_0x1d71d5,_0x2b2c0f){return new BPromise(function(_0x20a261,_0xbd18d2){return client['request'](_0x1d71d5,_0x2b2c0f)['then'](function(_0x4ed8f5){if(_0x4ed8f5[_0xf4ff('0x3')]){return _0xbd18d2(_0x4ed8f5['error'][_0xf4ff('0x4')]);}else{return _0x20a261(_0x4ed8f5[_0xf4ff('0x5')]);}})[_0xf4ff('0x6')](function(_0x5aac46){return _0xbd18d2(_0x5aac46);});});}exports[_0xf4ff('0x7')]=function(_0x554d41,_0x1717ac){return request(_0xf4ff('0x8'),{'account':_0x554d41,'message':_0x1717ac});}; \ No newline at end of file +var _0x6413=['sendMailMessage','SendMail','jayson/promise','client','http','request','error','result','catch'];(function(_0x1bd937,_0x3e349d){var _0x11eb66=function(_0x252cd5){while(--_0x252cd5){_0x1bd937['push'](_0x1bd937['shift']());}};_0x11eb66(++_0x3e349d);}(_0x6413,0x110));var _0x3641=function(_0x3c7f47,_0x2e9681){_0x3c7f47=_0x3c7f47-0x0;var _0x3c4e88=_0x6413[_0x3c7f47];return _0x3c4e88;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x3641('0x0'));var client=jayson[_0x3641('0x1')][_0x3641('0x2')]({'port':0x232b});function request(_0x21afa4,_0x1d1c50){return new BPromise(function(_0x5a2f78,_0x1dfd50){return client[_0x3641('0x3')](_0x21afa4,_0x1d1c50)['then'](function(_0x2f32a5){if(_0x2f32a5['error']){return _0x1dfd50(_0x2f32a5[_0x3641('0x4')]['message']);}else{return _0x5a2f78(_0x2f32a5[_0x3641('0x5')]);}})[_0x3641('0x6')](function(_0x5f16d2){return _0x1dfd50(_0x5f16d2);});});}exports[_0x3641('0x7')]=function(_0x1b8e2e,_0x370cc3){return request(_0x3641('0x8'),{'account':_0x1b8e2e,'message':_0x370cc3});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 88d1b07..2a31c17 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 _0x4343=['indexOf','substring','length','trim','slice','emit','line','exports','util','Transform','call','_localBuffer','_inBody','inherits','prototype','toString'];(function(_0x5949ba,_0xd1a7fa){var _0x3402a4=function(_0x59df1c){while(--_0x59df1c){_0x5949ba['push'](_0x5949ba['shift']());}};_0x3402a4(++_0xd1a7fa);}(_0x4343,0x158));var _0x3434=function(_0x324882,_0x45e867){_0x324882=_0x324882-0x0;var _0x489525=_0x4343[_0x324882];return _0x489525;};'use strict';var util=require(_0x3434('0x0'));var Transform=require('stream')[_0x3434('0x1')];function AGIReply(_0x2ad8f1){Transform[_0x3434('0x2')](this,_0x2ad8f1);this[_0x3434('0x3')]='';this[_0x3434('0x4')]=![];}util[_0x3434('0x5')](AGIReply,Transform);AGIReply[_0x3434('0x6')]['_transform']=function(_0x357056,_0x41778e,_0x438e70){var _0x367ffb='\x0a',_0x56145b=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x5b1528=-0x1,_0x17525d=-0x1,_0xb886da='',_0x1ea9f1=0x0,_0x5c4831='',_0x22cbae='';this[_0x3434('0x3')]+=_0x357056[_0x3434('0x7')]();_0x5c4831=this[_0x3434('0x3')];if(!this[_0x3434('0x4')]){_0x1ea9f1=0x0;while(_0x56145b[_0x1ea9f1]){while((_0x17525d=_0x5c4831[_0x3434('0x8')](_0x56145b[_0x1ea9f1]))!=-0x1){_0xb886da=_0x56145b[_0x1ea9f1];_0x22cbae=_0x5c4831[_0x3434('0x9')](0x0,_0x17525d);_0x5c4831=_0x5c4831[_0x3434('0x9')](_0x17525d+_0xb886da[_0x3434('0xa')]);var _0x77a12a=_0x22cbae['split'](_0x367ffb),_0x19e394=0x0,_0x485776={},_0x55ac79='',_0x4e73b1='',_0x51be0c=-0x1;while(_0x77a12a[_0x19e394]){_0x51be0c=_0x77a12a[_0x19e394][_0x3434('0x8')](':');if(_0x51be0c!=-0x1){_0x55ac79=_0x77a12a[_0x19e394]['slice'](0x0,_0x51be0c)[_0x3434('0xb')]();_0x4e73b1=_0x77a12a[_0x19e394][_0x3434('0xc')](_0x51be0c+0x1)[_0x3434('0xb')]();if(_0x55ac79[_0x3434('0xa')]>0x0){_0x485776[_0x55ac79]=_0x4e73b1;}}else{}_0x19e394++;}this[_0x3434('0xd')]('headers',_0x485776);this['_inBody']=!![];}_0x1ea9f1++;}this[_0x3434('0x3')]=_0x5c4831;}else{while((_0x5b1528=_0x5c4831[_0x3434('0x8')](_0x367ffb))!=-0x1){_0x22cbae=_0x5c4831[_0x3434('0x9')](0x0,_0x5b1528);this[_0x3434('0xd')](_0x3434('0xe'),_0x22cbae);_0x5c4831=_0x5c4831[_0x3434('0x9')](_0x5b1528+_0x367ffb['length']);}this[_0x3434('0x3')]=_0x5c4831;}_0x438e70();};module[_0x3434('0xf')]=AGIReply; \ No newline at end of file +var _0xc902=['substring','length','slice','trim','headers','emit','line','exports','util','stream','Transform','call','_localBuffer','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString','_inBody','indexOf'];(function(_0x8b0f43,_0x1c57b8){var _0x3f4425=function(_0x16e59a){while(--_0x16e59a){_0x8b0f43['push'](_0x8b0f43['shift']());}};_0x3f4425(++_0x1c57b8);}(_0xc902,0x15c));var _0x2c90=function(_0x343e9b,_0x43c273){_0x343e9b=_0x343e9b-0x0;var _0xd0bac7=_0xc902[_0x343e9b];return _0xd0bac7;};'use strict';var util=require(_0x2c90('0x0'));var Transform=require(_0x2c90('0x1'))[_0x2c90('0x2')];function AGIReply(_0x2e035a){Transform[_0x2c90('0x3')](this,_0x2e035a);this[_0x2c90('0x4')]='';this['_inBody']=![];}util[_0x2c90('0x5')](AGIReply,Transform);AGIReply[_0x2c90('0x6')][_0x2c90('0x7')]=function(_0x3a0f32,_0x1cb37b,_0x5d7b9a){var _0x552ef2='\x0a',_0x73546a=['\x0a\x0a',_0x2c90('0x8')],_0x2b16eb=-0x1,_0x2a9ed9=-0x1,_0x5edd0d='',_0xfb5e40=0x0,_0x51812c='',_0x5b6573='';this['_localBuffer']+=_0x3a0f32[_0x2c90('0x9')]();_0x51812c=this[_0x2c90('0x4')];if(!this[_0x2c90('0xa')]){_0xfb5e40=0x0;while(_0x73546a[_0xfb5e40]){while((_0x2a9ed9=_0x51812c[_0x2c90('0xb')](_0x73546a[_0xfb5e40]))!=-0x1){_0x5edd0d=_0x73546a[_0xfb5e40];_0x5b6573=_0x51812c[_0x2c90('0xc')](0x0,_0x2a9ed9);_0x51812c=_0x51812c[_0x2c90('0xc')](_0x2a9ed9+_0x5edd0d[_0x2c90('0xd')]);var _0xad3652=_0x5b6573['split'](_0x552ef2),_0x547b6a=0x0,_0x2ea005={},_0x3434b1='',_0x548ed4='',_0x42809d=-0x1;while(_0xad3652[_0x547b6a]){_0x42809d=_0xad3652[_0x547b6a][_0x2c90('0xb')](':');if(_0x42809d!=-0x1){_0x3434b1=_0xad3652[_0x547b6a][_0x2c90('0xe')](0x0,_0x42809d)[_0x2c90('0xf')]();_0x548ed4=_0xad3652[_0x547b6a][_0x2c90('0xe')](_0x42809d+0x1)[_0x2c90('0xf')]();if(_0x3434b1[_0x2c90('0xd')]>0x0){_0x2ea005[_0x3434b1]=_0x548ed4;}}else{}_0x547b6a++;}this['emit'](_0x2c90('0x10'),_0x2ea005);this[_0x2c90('0xa')]=!![];}_0xfb5e40++;}this[_0x2c90('0x4')]=_0x51812c;}else{while((_0x2b16eb=_0x51812c[_0x2c90('0xb')](_0x552ef2))!=-0x1){_0x5b6573=_0x51812c[_0x2c90('0xc')](0x0,_0x2b16eb);this[_0x2c90('0x11')](_0x2c90('0x12'),_0x5b6573);_0x51812c=_0x51812c[_0x2c90('0xc')](_0x2b16eb+_0x552ef2[_0x2c90('0xd')]);}this['_localBuffer']=_0x51812c;}_0x5d7b9a();};module[_0x2c90('0x13')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index bdd69e2..6a8a658 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 _0x6941=['CreateSquareReport','merge','arg_1','arg_2','format','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','ShowCmHopper','ListId','CreateCmContact','getPauseById','ShowPause','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','jayson/promise','client','http','then','error','message','result','catch','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','name','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','getUserById','ShowUser','getTrunkById','getSoundById','ShowSound','getIntervalById','ShowInterval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport'];(function(_0x35677d,_0x3e5aa2){var _0x298966=function(_0x438cf7){while(--_0x438cf7){_0x35677d['push'](_0x35677d['shift']());}};_0x298966(++_0x3e5aa2);}(_0x6941,0xc0));var _0x1694=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x6941[_0x5bd426];return _0x23a7eb;};'use strict';var BPromise=require('bluebird');var moment=require('moment');var _=require(_0x1694('0x0'));var util=require('util');var jayson=require(_0x1694('0x1'));var client=jayson[_0x1694('0x2')][_0x1694('0x3')]({'port':0x2329});function request(_0x11d3db,_0x4d41a1){return new BPromise(function(_0x190671,_0x13aa21){return client['request'](_0x11d3db,_0x4d41a1)[_0x1694('0x4')](function(_0xd263bf){if(_0xd263bf[_0x1694('0x5')]){return _0x13aa21(_0xd263bf['error'][_0x1694('0x6')]);}else{return _0x190671(_0xd263bf[_0x1694('0x7')]);}})[_0x1694('0x8')](function(_0x3249fb){return _0x13aa21(_0x3249fb);});});}exports[_0x1694('0x9')]=function(_0x7e65e3){return request(_0x1694('0xa'),{'options':{'raw':![],'where':{'name':_0x7e65e3},'attributes':[_0x1694('0xb')]}});};exports[_0x1694('0xc')]=function(_0x568a78){return request(_0x1694('0xd'),{'options':{'raw':![],'where':{'id':_0x568a78},'include':[{'model':_0x1694('0xe'),'as':'Smtp'}],'attributes':['id',_0x1694('0xf'),'email']}});};exports[_0x1694('0x10')]=function(_0x26cbb3){return request(_0x1694('0xa'),{'options':{'where':{'id':_0x26cbb3},'attributes':[_0x1694('0xf')]}});};exports[_0x1694('0x11')]=function(_0xd87120){return request(_0x1694('0x12'),{'options':{'where':{'id':_0xd87120},'attributes':[_0x1694('0xf')]}});};exports[_0x1694('0x13')]=function(_0x3948f7){return request(_0x1694('0x14'),{'options':{'where':{'id':_0x3948f7},'attributes':[_0x1694('0xf')]}});};exports[_0x1694('0x15')]=function(_0x3e9870){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x3e9870},'attributes':['dsn']}});};exports[_0x1694('0x16')]=function(_0x5e6b3f){return request(_0x1694('0x17'),{'options':{'where':{'id':_0x5e6b3f},'attributes':['name']}});};exports[_0x1694('0x18')]=function(_0x1a1a93){return request('ShowTrunk',{'options':{'where':{'id':_0x1a1a93},'attributes':['name']}});};exports[_0x1694('0x19')]=function(_0x431b4e){return request(_0x1694('0x1a'),{'options':{'where':{'id':_0x431b4e},'attributes':['save_name']}});};exports[_0x1694('0x1b')]=function(_0x4a4d56){return request(_0x1694('0x1c'),{'options':{'raw':![],'where':{'id':_0x4a4d56},'include':[{'model':'Interval','as':_0x1694('0x1d')}]}});};exports[_0x1694('0x1e')]=function(_0x571514){return request(_0x1694('0x1f'),{'options':{'where':{'id':_0x571514},'attributes':['id',_0x1694('0xf')]}});};exports[_0x1694('0x20')]=function(_0x29e961){return request('CreateSmsMessage',{'body':_0x29e961});};exports[_0x1694('0x21')]=function(_0x1e3f06){return request(_0x1694('0x22'),{'body':_0x1e3f06});};exports[_0x1694('0x23')]=function(_0xc4c902){return request(_0x1694('0x24'),{'body':_[_0x1694('0x25')](_0xc4c902,{'project_name':_0xc4c902[_0x1694('0x26')],'prev_project_name':_0xc4c902[_0x1694('0x27')]||'','is_subproject':_0xc4c902[_0x1694('0x27')]?!![]:![],'leaveAt':moment()[_0x1694('0x28')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x1694('0x29')]=function(_0x32065a){return request(_0x1694('0x2a'),{'body':_0x32065a});};exports[_0x1694('0x2b')]=function(_0x3b9c63){return request(_0x1694('0x2c'),{'body':_0x3b9c63});};exports['createCmContact']=function(_0x30474a){return request(_0x1694('0x2d'),{'options':{'raw':![],'where':{'phone':_0x30474a['phone'],'ListId':_0x30474a[_0x1694('0x2e')]}}})['then'](function(_0x1ceeab){if(_0x1ceeab){return _0x1ceeab;}return request(_0x1694('0x2f'),{'body':_0x30474a});});};exports[_0x1694('0x30')]=function(_0x46b910){return request(_0x1694('0x31'),{'options':{'where':{'id':_0x46b910},'attributes':['name']}});};exports['agentLogin']=function(_0x53b31a,_0x57d4e1){return request(_0x1694('0x32'),{'body':{'interface':_0x57d4e1},'options':{'where':_0x53b31a}});};exports[_0x1694('0x33')]=function(_0x3e6125,_0x4002f6,_0x3599de){return request(_0x1694('0x34'),{'body':{'type':_0x4002f6,'uniqueid':_0x3599de},'options':{'where':_0x3e6125}});};exports[_0x1694('0x35')]=function(_0x1f014d){return request(_0x1694('0x36'),{'body':{},'options':{'where':_0x1f014d}});};exports[_0x1694('0x37')]=function(_0x9b1358){return request(_0x1694('0x38'),{'body':{},'options':{'where':_0x9b1358}});}; \ No newline at end of file +var _0x8321=['createSquareRecording','CreateSquareRecording','createSquareMessage','ShowCmHopper','phone','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','agentLogout','bluebird','moment','lodash','util','jayson/promise','client','request','then','error','message','result','catch','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','name','email','getSquareProjectById','getVoiceQueueById','getVariableById','dsn','ShowUser','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_2','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x1f3c56,_0x598757){var _0x569524=function(_0x345301){while(--_0x345301){_0x1f3c56['push'](_0x1f3c56['shift']());}};_0x569524(++_0x598757);}(_0x8321,0xb6));var _0x1832=function(_0x3f0fec,_0x42d2f7){_0x3f0fec=_0x3f0fec-0x0;var _0x5eac97=_0x8321[_0x3f0fec];return _0x5eac97;};'use strict';var BPromise=require(_0x1832('0x0'));var moment=require(_0x1832('0x1'));var _=require(_0x1832('0x2'));var util=require(_0x1832('0x3'));var jayson=require(_0x1832('0x4'));var client=jayson[_0x1832('0x5')]['http']({'port':0x2329});function request(_0x499bf8,_0x8518ed){return new BPromise(function(_0x19d4e8,_0xf69107){return client[_0x1832('0x6')](_0x499bf8,_0x8518ed)[_0x1832('0x7')](function(_0x11ea2b){if(_0x11ea2b[_0x1832('0x8')]){return _0xf69107(_0x11ea2b[_0x1832('0x8')][_0x1832('0x9')]);}else{return _0x19d4e8(_0x11ea2b[_0x1832('0xa')]);}})[_0x1832('0xb')](function(_0x2da314){return _0xf69107(_0x2da314);});});}exports[_0x1832('0xc')]=function(_0x70a0ce){return request(_0x1832('0xd'),{'options':{'raw':![],'where':{'name':_0x70a0ce},'attributes':[_0x1832('0xe')]}});};exports[_0x1832('0xf')]=function(_0x418b4a){return request(_0x1832('0x10'),{'options':{'raw':![],'where':{'id':_0x418b4a},'include':[{'model':'MailServerOut','as':'Smtp'}],'attributes':['id',_0x1832('0x11'),_0x1832('0x12')]}});};exports[_0x1832('0x13')]=function(_0x5f2934){return request(_0x1832('0xd'),{'options':{'where':{'id':_0x5f2934},'attributes':['name']}});};exports[_0x1832('0x14')]=function(_0x1c8eb4){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x1c8eb4},'attributes':[_0x1832('0x11')]}});};exports[_0x1832('0x15')]=function(_0x4b7449){return request('ShowVariable',{'options':{'where':{'id':_0x4b7449},'attributes':[_0x1832('0x11')]}});};exports['getSquareOdbcById']=function(_0x9d9090){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x9d9090},'attributes':[_0x1832('0x16')]}});};exports['getUserById']=function(_0x51590b){return request(_0x1832('0x17'),{'options':{'where':{'id':_0x51590b},'attributes':[_0x1832('0x11')]}});};exports[_0x1832('0x18')]=function(_0x26d96a){return request(_0x1832('0x19'),{'options':{'where':{'id':_0x26d96a},'attributes':[_0x1832('0x11')]}});};exports[_0x1832('0x1a')]=function(_0x568b6e){return request(_0x1832('0x1b'),{'options':{'where':{'id':_0x568b6e},'attributes':[_0x1832('0x1c')]}});};exports['getIntervalById']=function(_0x43f665){return request(_0x1832('0x1d'),{'options':{'raw':![],'where':{'id':_0x43f665},'include':[{'model':_0x1832('0x1e'),'as':_0x1832('0x1f')}]}});};exports[_0x1832('0x20')]=function(_0xc3eb2f){return request(_0x1832('0x21'),{'options':{'where':{'id':_0xc3eb2f},'attributes':['id',_0x1832('0x11')]}});};exports[_0x1832('0x22')]=function(_0x31078e){return request('CreateSmsMessage',{'body':_0x31078e});};exports[_0x1832('0x23')]=function(_0x47b7d4){return request(_0x1832('0x24'),{'body':_0x47b7d4});};exports[_0x1832('0x25')]=function(_0xe9b5f8){return request(_0x1832('0x26'),{'body':_[_0x1832('0x27')](_0xe9b5f8,{'project_name':_0xe9b5f8['arg_1'],'prev_project_name':_0xe9b5f8['arg_2']||'','is_subproject':_0xe9b5f8[_0x1832('0x28')]?!![]:![],'leaveAt':moment()['format'](_0x1832('0x29'))})});};exports[_0x1832('0x2a')]=function(_0x3723dc){return request(_0x1832('0x2b'),{'body':_0x3723dc});};exports[_0x1832('0x2c')]=function(_0x3b12fc){return request('CreateSquareMessage',{'body':_0x3b12fc});};exports['createCmContact']=function(_0x4c62ab){return request(_0x1832('0x2d'),{'options':{'raw':![],'where':{'phone':_0x4c62ab[_0x1832('0x2e')],'ListId':_0x4c62ab['ListId']}}})[_0x1832('0x7')](function(_0x4a8f3d){if(_0x4a8f3d){return _0x4a8f3d;}return request(_0x1832('0x2f'),{'body':_0x4c62ab});});};exports[_0x1832('0x30')]=function(_0x557bd3){return request(_0x1832('0x31'),{'options':{'where':{'id':_0x557bd3},'attributes':[_0x1832('0x11')]}});};exports[_0x1832('0x32')]=function(_0x3f1ccf,_0x30020d){return request(_0x1832('0x33'),{'body':{'interface':_0x30020d},'options':{'where':_0x3f1ccf}});};exports[_0x1832('0x34')]=function(_0x1e22b3,_0xb32611,_0x6f2698){return request(_0x1832('0x35'),{'body':{'type':_0xb32611,'uniqueid':_0x6f2698},'options':{'where':_0x1e22b3}});};exports[_0x1832('0x36')]=function(_0x5e725f){return request('UnpauseUser',{'body':{},'options':{'where':_0x5e725f}});};exports[_0x1832('0x37')]=function(_0xd777b1){return request('LogoutUser',{'body':{},'options':{'where':_0xd777b1}});}; \ 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 427f09e..7027145 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 _0xb931=['exports'];(function(_0x17410f,_0x3cec7c){var _0x18e5a0=function(_0x368c8b){while(--_0x368c8b){_0x17410f['push'](_0x17410f['shift']());}};_0x18e5a0(++_0x3cec7c);}(_0xb931,0x155));var _0x1b93=function(_0x276a53,_0x28fcfb){_0x276a53=_0x276a53-0x0;var _0x28314d=_0xb931[_0x276a53];return _0x28314d;};var polly=require('./polly');var lex=require('./lex');module[_0x1b93('0x0')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x2f2e=['./lex','exports'];(function(_0x422eec,_0x960314){var _0x50b7b6=function(_0x9b86b5){while(--_0x9b86b5){_0x422eec['push'](_0x422eec['shift']());}};_0x50b7b6(++_0x960314);}(_0x2f2e,0x146));var _0xe2f2=function(_0x5af97c,_0x24a49f){_0x5af97c=_0x5af97c-0x0;var _0x3472ae=_0x2f2e[_0x5af97c];return _0x3472ae;};var polly=require('./polly');var lex=require(_0xe2f2('0x0'));module[_0xe2f2('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 1a8a92f..dfa8db8 100644 --- a/server/services/agi/scripts/aws/lex/index.js +++ b/server/services/agi/scripts/aws/lex/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -'use strict';var lex=require('./lib/api');module['exports']=function(_0x46400f,_0xa5f6b7,_0x4a08d4,_0x5080f5,_0x229028,_0x1fdf5b){return lex(_0x46400f,_0xa5f6b7,_0x4a08d4,_0x5080f5,_0x229028,_0x1fdf5b);}; \ No newline at end of file +var _0x2dae=['./lib/api'];(function(_0x29f227,_0x1f4086){var _0x5e58bd=function(_0x96e696){while(--_0x96e696){_0x29f227['push'](_0x29f227['shift']());}};_0x5e58bd(++_0x1f4086);}(_0x2dae,0xc3));var _0xe2da=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0x2dae[_0xa8883];return _0x479426;};'use strict';var lex=require(_0xe2da('0x0'));module['exports']=function(_0x11ec30,_0x31359d,_0xcd0055,_0x167432,_0x99b46f,_0x481d97){return lex(_0x11ec30,_0x31359d,_0xcd0055,_0x167432,_0x99b46f,_0x481d97);}; \ 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 0b7629f..88f621a 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(_0xdaea51,_0x5db859){var _0x176510=function(_0x3f6788){while(--_0x3f6788){_0xdaea51['push'](_0xdaea51['shift']());}};_0x176510(++_0x5db859);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'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(_0x2ccf8b,_0x43b25e){var _0x2b9b9d=function(_0xbcb681){while(--_0xbcb681){_0x2ccf8b['push'](_0x2ccf8b['shift']());}};_0x2b9b9d(++_0x43b25e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'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 0361352..87169d0 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 _0xa805=['./lib/api','exports'];(function(_0x5b4c44,_0x2e495e){var _0x58485a=function(_0x13299b){while(--_0x13299b){_0x5b4c44['push'](_0x5b4c44['shift']());}};_0x58485a(++_0x2e495e);}(_0xa805,0x1c2));var _0x5a80=function(_0x44d9e2,_0x434718){_0x44d9e2=_0x44d9e2-0x0;var _0x1aa711=_0xa805[_0x44d9e2];return _0x1aa711;};'use strict';var polly=require(_0x5a80('0x0'));module[_0x5a80('0x1')]=function(_0x2feefa,_0xba5888,_0x4abf73,_0x120946,_0x14041e,_0x1d5e1d,_0x1cb6b9){return polly(_0x2feefa,_0xba5888,_0x4abf73,_0x120946,_0x14041e,_0x1d5e1d,_0x1cb6b9);}; \ No newline at end of file +var _0x49d6=['exports'];(function(_0x4affb3,_0x4db761){var _0x3dbaee=function(_0x2f6e18){while(--_0x2f6e18){_0x4affb3['push'](_0x4affb3['shift']());}};_0x3dbaee(++_0x4db761);}(_0x49d6,0xa8));var _0x649d=function(_0x579cee,_0x1e1f32){_0x579cee=_0x579cee-0x0;var _0x58e343=_0x49d6[_0x579cee];return _0x58e343;};'use strict';var polly=require('./lib/api');module[_0x649d('0x0')]=function(_0x24101b,_0x148b29,_0xe4cc86,_0x2c5df6,_0x284884,_0x522edc,_0x2dd9e7){return polly(_0x24101b,_0x148b29,_0xe4cc86,_0x2c5df6,_0x284884,_0x522edc,_0x2dd9e7);}; \ 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 3968885..ff57c0e 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 _0xa18c=['text','path','bluebird','randomstring','aws-sdk','writeFile','AudioStream','No\x20data\x20response\x20from\x20aws\x20Polly!','exports'];(function(_0x55e131,_0x52d237){var _0xe4bb67=function(_0x3d225c){while(--_0x3d225c){_0x55e131['push'](_0x55e131['shift']());}};_0xe4bb67(++_0x52d237);}(_0xa18c,0x160));var _0xca18=function(_0x1605a9,_0x377412){_0x1605a9=_0x1605a9-0x0;var _0x3efff2=_0xa18c[_0x1605a9];return _0x3efff2;};'use strict';var fs=require('fs');var path=require(_0xca18('0x0'));var BPromise=require(_0xca18('0x1'));var rs=require(_0xca18('0x2'));var AWS=require(_0xca18('0x3'));function pollyResult(_0x3f64d3,_0x5bdd15,_0x5b4bb5){return new BPromise(function(_0x34ad3f,_0x49c73f){_0x3f64d3['synthesizeSpeech'](_0x5bdd15,function(_0x5c0bba,_0x86a873){if(_0x5c0bba){_0x49c73f(_0x5c0bba);}else if(_0x86a873){if(_0x86a873['AudioStream']instanceof Buffer){fs[_0xca18('0x4')](_0x5b4bb5,_0x86a873[_0xca18('0x5')],function(_0x18250d){if(_0x18250d){_0x49c73f(_0x18250d);}else{_0x34ad3f();}});}else{_0x49c73f(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x49c73f(new Error(_0xca18('0x6')));}});});}module[_0xca18('0x7')]=function(_0x134fb2,_0x15c03b,_0x10d812,_0x4c93ba,_0x292dfb,_0x1dac1c,_0x2f322d){var _0x2998f1=new AWS['Polly']({'accessKeyId':_0x134fb2,'secretAccessKey':_0x15c03b,'region':_0x10d812});var _0x171e20={'Text':_0x292dfb,'TextType':_0x1dac1c||_0xca18('0x8'),'OutputFormat':'mp3','VoiceId':_0x4c93ba};return pollyResult(_0x2998f1,_0x171e20,_0x2f322d);}; \ No newline at end of file +var _0x4a13=['Polly','text','mp3','path','aws-sdk','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x4a13,0x111));var _0x34a1=function(_0x1379b7,_0x2bd54e){_0x1379b7=_0x1379b7-0x0;var _0x205091=_0x4a13[_0x1379b7];return _0x205091;};'use strict';var fs=require('fs');var path=require(_0x34a1('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var AWS=require(_0x34a1('0x1'));function pollyResult(_0x20cb51,_0x283123,_0x4b2240){return new BPromise(function(_0xb36eb2,_0x19b55a){_0x20cb51['synthesizeSpeech'](_0x283123,function(_0x57d515,_0x3c20b4){if(_0x57d515){_0x19b55a(_0x57d515);}else if(_0x3c20b4){if(_0x3c20b4[_0x34a1('0x2')]instanceof Buffer){fs[_0x34a1('0x3')](_0x4b2240,_0x3c20b4[_0x34a1('0x2')],function(_0x404430){if(_0x404430){_0x19b55a(_0x404430);}else{_0xb36eb2();}});}else{_0x19b55a(new Error(_0x34a1('0x4')));}}else{_0x19b55a(new Error(_0x34a1('0x5')));}});});}module['exports']=function(_0x3f5943,_0x92acd2,_0xd1f3ee,_0xd7e87,_0x3a8bae,_0x39bbc0,_0x545964){var _0x5ea682=new AWS[(_0x34a1('0x6'))]({'accessKeyId':_0x3f5943,'secretAccessKey':_0x92acd2,'region':_0xd1f3ee});var _0x269345={'Text':_0x3a8bae,'TextType':_0x39bbc0||_0x34a1('0x7'),'OutputFormat':_0x34a1('0x8'),'VoiceId':_0xd7e87};return pollyResult(_0x5ea682,_0x269345,_0x545964);}; \ 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 b28e708..e8ad9d8 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. * // * * // ************************************************************************* -'use strict';var asr=require('./lib/api');module['exports']=function(_0x2e7560,_0x447d1e,_0x2a827e,_0x1646a0){return asr(_0x2e7560,_0x447d1e,_0x2a827e);}; \ No newline at end of file +var _0x5439=['exports'];(function(_0x5be9e3,_0x39735a){var _0x4df97e=function(_0x368174){while(--_0x368174){_0x5be9e3['push'](_0x5be9e3['shift']());}};_0x4df97e(++_0x39735a);}(_0x5439,0xaf));var _0x9543=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5439[_0x14add3];return _0x4a174f;};'use strict';var asr=require('./lib/api');module[_0x9543('0x0')]=function(_0xba62cd,_0xd1b445,_0x4d5221,_0x3678d4){return asr(_0xba62cd,_0xd1b445,_0x4d5221);}; \ 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 6fde6a5..5d6ea45 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 _0xf323=['length','filepath\x20should\x20be\x20a\x20string','string','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','LINEAR16','8000','https://speech.googleapis.com','exports'];(function(_0x4d29a8,_0x374965){var _0x3201ae=function(_0xef6c96){while(--_0xef6c96){_0x4d29a8['push'](_0x4d29a8['shift']());}};_0x3201ae(++_0x374965);}(_0xf323,0x1c6));var _0x3f32=function(_0x57e58a,_0x118716){_0x57e58a=_0x57e58a-0x0;var _0x439d56=_0xf323[_0x57e58a];return _0x439d56;};'use strict';var url=require('url');var BPromise=require('bluebird');var fs=require('fs');var host=_0x3f32('0x0');module[_0x3f32('0x1')]=function(_0x5420ab,_0x455911,_0x1081c3){return new BPromise(function(_0x3d0d9f,_0x6b7a8d){var _0x319ba4;if(typeof _0x5420ab!=='string'||_0x5420ab[_0x3f32('0x2')]===0x0){return _0x6b7a8d(_0x3f32('0x3'));}if(typeof _0x455911!==_0x3f32('0x4')||_0x455911[_0x3f32('0x2')]===0x0){return _0x6b7a8d('key\x20should\x20be\x20a\x20string');}if(typeof _0x1081c3!=='undefined'&&(typeof _0x1081c3!==_0x3f32('0x4')||_0x1081c3[_0x3f32('0x2')]===0x0)){return _0x6b7a8d(_0x3f32('0x5'));}try{_0x319ba4=fs[_0x3f32('0x6')](_0x5420ab)[_0x3f32('0x7')](_0x3f32('0x8'));}catch(_0x228ac0){return _0x6b7a8d(_0x228ac0);}return _0x3d0d9f({'method':_0x3f32('0x9'),'uri':host+'/v1/speech:recognize?key='+_0x455911,'body':{'config':{'encoding':_0x3f32('0xa'),'sampleRateHertz':_0x3f32('0xb'),'languageCode':_0x1081c3},'audio':{'content':_0x319ba4}},'json':!![]});});}; \ No newline at end of file +var _0xd246=['undefined','lang\x20should\x20be\x20a\x20string','base64','POST','LINEAR16','url','bluebird','https://speech.googleapis.com','exports','length','string','key\x20should\x20be\x20a\x20string'];(function(_0x595adf,_0xbdddd5){var _0x547d01=function(_0x2f8a23){while(--_0x2f8a23){_0x595adf['push'](_0x595adf['shift']());}};_0x547d01(++_0xbdddd5);}(_0xd246,0xf5));var _0x6d24=function(_0x20a4dc,_0x2bd7c7){_0x20a4dc=_0x20a4dc-0x0;var _0x49000f=_0xd246[_0x20a4dc];return _0x49000f;};'use strict';var url=require(_0x6d24('0x0'));var BPromise=require(_0x6d24('0x1'));var fs=require('fs');var host=_0x6d24('0x2');module[_0x6d24('0x3')]=function(_0x3e2217,_0x20310f,_0x1d0589){return new BPromise(function(_0x51c18f,_0x4e76e1){var _0xfa68f3;if(typeof _0x3e2217!=='string'||_0x3e2217[_0x6d24('0x4')]===0x0){return _0x4e76e1('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x20310f!==_0x6d24('0x5')||_0x20310f[_0x6d24('0x4')]===0x0){return _0x4e76e1(_0x6d24('0x6'));}if(typeof _0x1d0589!==_0x6d24('0x7')&&(typeof _0x1d0589!==_0x6d24('0x5')||_0x1d0589[_0x6d24('0x4')]===0x0)){return _0x4e76e1(_0x6d24('0x8'));}try{_0xfa68f3=fs['readFileSync'](_0x3e2217)['toString'](_0x6d24('0x9'));}catch(_0x519e5e){return _0x4e76e1(_0x519e5e);}return _0x51c18f({'method':_0x6d24('0xa'),'uri':host+'/v1/speech:recognize?key='+_0x20310f,'body':{'config':{'encoding':_0x6d24('0xb'),'sampleRateHertz':'8000','languageCode':_0x1d0589},'audio':{'content':_0xfa68f3}},'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 e5cdad8..ed30d80 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 _0x4e36=['./asr','exports'];(function(_0x51c14c,_0x53cb9c){var _0x11a098=function(_0x38be6b){while(--_0x38be6b){_0x51c14c['push'](_0x51c14c['shift']());}};_0x11a098(++_0x53cb9c);}(_0x4e36,0x8a));var _0x64e3=function(_0x1358a7,_0x242de6){_0x1358a7=_0x1358a7-0x0;var _0x1f2295=_0x4e36[_0x1358a7];return _0x1f2295;};var asr=require(_0x64e3('0x0'));module[_0x64e3('0x1')]={'asr':asr}; \ No newline at end of file +var _0x7a13=['./asr'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x7a13,0x1c6));var _0x37a1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7a13[_0x3dd15e];return _0x231fd0;};var asr=require(_0x37a1('0x0'));module['exports']={'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 6f5e18e..97f995c 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 _0x6718=['intent','isFallback','languageCode','queryText','intentDetectionConfidence','fulfillmentText','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsLex','lex','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','parse','sestekNDA','nda','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','https','md5','path','querystring','randomstring','sox','google-tts-api','./aws','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','WHAT_EVER','get','statusCode','error','request\x20to\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','unlink','download\x20error','pipe','end','host','\x20failed,\x20status\x20code\x20=\x20','wav','error\x20convert','finish\x20to\x20convert','start','tmp','generate','writeFileSync','then','777','split','readFileSync','toString','base64','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','input','voice','MP3','text:synthesize','POST','audioContent','writeFile','chmodSync','resolve','.wav','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','data','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','parse\x20response\x20failed:\x0a','.mp3','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','googleDialogflow','textRequest','result','resolvedQuery','action','actionIncomplete','speech','score','status','endConversation','metadata','isFallbackIntent','SessionsClient','sessionPath','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','end_conversation','boolValue'];(function(_0x4562ed,_0x4d4b3f){var _0x3af219=function(_0x4138f8){while(--_0x4138f8){_0x4562ed['push'](_0x4562ed['shift']());}};_0x3af219(++_0x4d4b3f);}(_0x6718,0x1bc));var _0x8671=function(_0x11de83,_0x49e1c1){_0x11de83=_0x11de83-0x0;var _0x45bdb0=_0x6718[_0x11de83];return _0x45bdb0;};'use strict';var apiai=require(_0x8671('0x0'));var BPromise=require(_0x8671('0x1'));var dialogflow=require(_0x8671('0x2'));var fs=require('fs');var http=require(_0x8671('0x3'));var https=require(_0x8671('0x4'));var md5=require(_0x8671('0x5'));var path=require(_0x8671('0x6'));var querystring=require(_0x8671('0x7'));var rp=require('request-promise');var rs=require(_0x8671('0x8'));var sox=require(_0x8671('0x9'));var tts=require(_0x8671('0xa'));var urlParse=require('url')['parse'];var util=require('util');var aws=require(_0x8671('0xb'));var google=require(_0x8671('0xc'));var sestek=require(_0x8671('0xd'));var tilde=require(_0x8671('0xe'));var logger=require(_0x8671('0xf'))(_0x8671('0x10'));var ISPEECH_API=_0x8671('0x11');function downloadFile(_0x41aa1f,_0x5c5388){return new BPromise(function(_0x5d4e74,_0x30a8e7){var _0x81256=urlParse(_0x41aa1f);var _0x300cd1=_0x81256[_0x8671('0x12')]===_0x8671('0x13')?https:http;var _0x12fd46={'host':_0x81256['host'],'path':_0x81256['path'],'headers':{'user-agent':_0x8671('0x14')}};_0x300cd1[_0x8671('0x15')](_0x12fd46,function(_0x19c743){if(_0x19c743[_0x8671('0x16')]!==0xc8){logger[_0x8671('0x17')](_0x8671('0x18')+_0x41aa1f+'\x20failed,\x20status\x20code\x20=\x20'+_0x19c743[_0x8671('0x16')]+'\x20('+_0x19c743['statusMessage']+')');_0x30a8e7(new Error('request\x20to\x20'+_0x41aa1f+'\x20failed,\x20status\x20code\x20=\x20'+_0x19c743[_0x8671('0x16')]+'\x20('+_0x19c743[_0x8671('0x19')]+')'));return;}var _0x5ed398=fs[_0x8671('0x1a')](_0x5c5388);_0x5ed398['on'](_0x8671('0x1b'),function(){logger[_0x8671('0x1c')](_0x8671('0x1d'));_0x5ed398['close'](_0x5d4e74);});_0x5ed398['on']('error',function(_0x37463e){fs[_0x8671('0x1e')](_0x5c5388);logger[_0x8671('0x17')](_0x8671('0x1f'),_0x37463e);_0x30a8e7(_0x37463e);});_0x19c743[_0x8671('0x20')](_0x5ed398);})['on']('error',function(_0x54d5f8){logger[_0x8671('0x17')](_0x54d5f8);_0x30a8e7(_0x54d5f8);})[_0x8671('0x21')]();});}function uploadFile(_0x174981){return new BPromise(function(_0x1f25a7,_0x11e5bb){var _0x55e9ca=urlParse(_0x174981);var _0x3bae55=_0x55e9ca[_0x8671('0x12')]===_0x8671('0x13')?https:http;var _0xaaa8bd={'host':_0x55e9ca[_0x8671('0x22')],'path':_0x55e9ca[_0x8671('0x6')],'headers':{'user-agent':'WHAT_EVER'}};_0x3bae55[_0x8671('0x15')](_0xaaa8bd,function(_0x5b6159){if(_0x5b6159[_0x8671('0x16')]!==0xc8){_0x11e5bb(new Error(_0x8671('0x18')+_0x174981+_0x8671('0x23')+_0x5b6159[_0x8671('0x16')]+'\x20('+_0x5b6159[_0x8671('0x19')]+')'));return;}var _0x57a6ed='';_0x5b6159['on']('data',function(_0x59829f){_0x57a6ed+=_0x59829f;});_0x5b6159['on'](_0x8671('0x21'),function(){_0x1f25a7(_0x57a6ed);});})['on']('error',function(_0x3b89ea){_0x11e5bb(_0x3b89ea);})[_0x8671('0x21')]();});}function convertFile(_0x4f74dd,_0x3b9f39){return new BPromise(function(_0x5ab348,_0x52ba32){var _0x1dba4d=sox['transcode'](_0x4f74dd,_0x3b9f39,{'sampleRate':0x1f40,'format':_0x8671('0x24'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1dba4d['on'](_0x8671('0x17'),function(_0x12212a){logger[_0x8671('0x17')](_0x8671('0x25'),_0x12212a);_0x52ba32(_0x12212a);});_0x1dba4d['on'](_0x8671('0x21'),function(){logger[_0x8671('0x1c')](_0x8671('0x26'));_0x5ab348();});_0x1dba4d[_0x8671('0x27')]();});}function base64Decode(_0x4d44cf,_0x6809a6){var _0x18ec0a=path['resolve'](__dirname,_0x8671('0x28'),rs[_0x8671('0x29')](0x4)+'.wav');fs[_0x8671('0x2a')](_0x18ec0a,_0x4d44cf,'base64');return convertFile(_0x18ec0a,_0x6809a6)[_0x8671('0x2b')](function(){try{fs[_0x8671('0x1e')](_0x18ec0a);fs['chmodSync'](_0x6809a6,_0x8671('0x2c'));}catch(_0x2a286f){logger['error'](_0x2a286f);}return _0x6809a6[_0x8671('0x2d')]('.')[0x0];});}function base64Encode(_0x460f51){var _0x44c729=fs[_0x8671('0x2e')](_0x460f51);return new Buffer(_0x44c729)[_0x8671('0x2f')](_0x8671('0x30'));}exports[_0x8671('0x31')]=function(_0x2ab96c,_0x318834,_0x240309,_0x2371f1,_0x58c39b,_0x385ad3){var _0x145a8e,_0x4d463f;var _0x2410fc=_0x8671('0x32');var _0x7c1015=_0x8671('0x33')+_0x2ab96c;var _0x10a290={};if(_0x318834==='ssml'){_0x10a290[_0x8671('0x34')]={'ssml':_0x240309};}else{_0x10a290[_0x8671('0x34')]={'text':_0x240309};};_0x10a290[_0x8671('0x35')]={'languageCode':_0x2371f1,'ssmlGender':_0x58c39b};_0x10a290['audioConfig']={'audioEncoding':_0x8671('0x36'),'sampleRateHertz':0x1f40};var _0x4deb09={'url':_0x2410fc+_0x8671('0x37')+_0x7c1015,'method':_0x8671('0x38'),'json':!![],'body':_0x10a290};return rp(_0x4deb09)[_0x8671('0x2b')](function(_0x1b740c){return new BPromise(function(_0x4bf728,_0x340c31){_0x145a8e=path['resolve'](__dirname,_0x8671('0x28'),rs[_0x8671('0x29')](0x4)+'.mp3');var _0x57d1f2=Buffer['from'](_0x1b740c[_0x8671('0x39')],_0x8671('0x30'));return fs[_0x8671('0x3a')](_0x145a8e,_0x57d1f2,function(_0x2abd98){_0x340c31(_0x2abd98);},function(_0x43cf53){fs[_0x8671('0x3b')](_0x145a8e,'777');_0x4bf728(_0x43cf53);});});})[_0x8671('0x2b')](function(_0x210a2f){_0x4d463f=path[_0x8671('0x3c')](__dirname,_0x8671('0x28'),rs[_0x8671('0x29')](0x4)+_0x8671('0x3d'));return convertFile(_0x145a8e,_0x4d463f);})['then'](function(){try{fs[_0x8671('0x1e')](_0x145a8e);fs[_0x8671('0x3b')](_0x4d463f,_0x8671('0x2c'));}catch(_0xeab047){logger[_0x8671('0x17')](_0xeab047);}logger[_0x8671('0x1c')](_0x8671('0x3e'),_0x4d463f[_0x8671('0x2d')]('.')[0x0]);return _0x4d463f[_0x8671('0x2d')]('.')[0x0];});};exports[_0x8671('0x3f')]=function(_0x379d0d,_0x5343ca){var _0x290574=_0x8671('0x40');var _0x1d9591,_0x9e1b86;var _0x2e2173;var _0x178f1c={'encoding':_0x8671('0x41'),'method':_0x8671('0x38'),'timeout':0x2710,'url':_0x290574,'headers':{'Content-Type':_0x8671('0x42')},'body':_0x8671('0x43')+encodeURIComponent(JSON[_0x8671('0x44')]([[[_0x8671('0x45'),JSON[_0x8671('0x44')]([_0x379d0d,_0x5343ca||'en',![],'null']),null,'generic']]]))};return rp(_0x178f1c)[_0x8671('0x2b')](function(_0x1b620f){try{_0x2e2173=eval(_0x1b620f['slice'](0x5))[0x0][0x2];}catch(_0x5771cb){throw new Error('parse\x20response\x20failed:\x0a'+_0x1b620f[_0x8671('0x46')]);}if(!_0x2e2173){if(_0x379d0d[_0x8671('0x47')]>0xc8){throw new Error(_0x8671('0x48'));}else{throw new Error(_0x8671('0x49')+_0x5343ca+_0x8671('0x4a'));}}try{_0x2e2173=eval(_0x2e2173)[0x0];}catch(_0x444af5){throw new Error(_0x8671('0x4b')+res[_0x8671('0x46')]);}const _0x3c1fa0=_0x2e2173;_0x1d9591=path[_0x8671('0x3c')](__dirname,_0x8671('0x28'),rs[_0x8671('0x29')](0x4)+_0x8671('0x4c'));fs[_0x8671('0x2a')](_0x1d9591,_0x2e2173,{'encoding':_0x8671('0x30')});_0x9e1b86=path[_0x8671('0x3c')](__dirname,_0x8671('0x28'),rs['generate'](0x4)+_0x8671('0x3d'));return convertFile(_0x1d9591,_0x9e1b86);})[_0x8671('0x2b')](function(){try{fs[_0x8671('0x1e')](_0x1d9591);fs['chmodSync'](_0x9e1b86,_0x8671('0x2c'));}catch(_0x25d23f){logger[_0x8671('0x17')](_0x25d23f);}logger[_0x8671('0x1c')](_0x8671('0x4d'),_0x9e1b86[_0x8671('0x2d')]('.')[0x0]);return _0x9e1b86[_0x8671('0x2d')]('.')[0x0];});};exports[_0x8671('0x4e')]=function(_0xf67933,_0x1ced0d,_0x3ae971){return google[_0x8671('0x4f')](_0xf67933,_0x1ced0d,_0x3ae971)['then'](function(_0x3fe015){logger[_0x8671('0x1c')](_0x3fe015[_0x8671('0x50')]);return rp(_0x3fe015);})['then'](function(_0x2dbc44){var _0x418954='';var _0x5a02a6=0x0;try{fs[_0x8671('0x1e')](_0xf67933);}catch(_0xf0f830){logger[_0x8671('0x17')](_0xf0f830);}if(_0x2dbc44&&_0x2dbc44[_0x8671('0x51')]){_0x418954=_0x2dbc44[_0x8671('0x51')][_0x8671('0x52')](function(_0x28b2ab){return _0x28b2ab&&_0x28b2ab['alternatives'][0x0]&&_0x28b2ab[_0x8671('0x53')][0x0][_0x8671('0x54')]?_0x28b2ab[_0x8671('0x53')][0x0][_0x8671('0x54')]:'';})[_0x8671('0x55')]('\x0a');_0x5a02a6=_0x2dbc44[_0x8671('0x51')][_0x8671('0x52')](function(_0x57acf8){return _0x57acf8&&_0x57acf8[_0x8671('0x53')][0x0]&&_0x57acf8['alternatives'][0x0][_0x8671('0x56')]?_0x57acf8[_0x8671('0x53')][0x0][_0x8671('0x56')]:0x0;})['join']('\x0a');}logger[_0x8671('0x1c')](_0x8671('0x57'),_0x418954);logger[_0x8671('0x1c')](_0x8671('0x58'),_0x5a02a6);return{'transcript':_0x418954,'confidence':_0x5a02a6};})[_0x8671('0x59')](function(_0x5b851b){logger[_0x8671('0x17')](_0x8671('0x5a'),_0x5b851b[_0x8671('0x16')],_0x5b851b[_0x8671('0x5b')],_0x5b851b['message']);});};exports[_0x8671('0x5c')]=function(_0x3a9021,_0x49aa31,_0x4b627e,_0x2c3fad){var _0x228093=apiai(_0x49aa31,{'language':_0x2c3fad||'en'});return _0x228093[_0x8671('0x5d')](_0x4b627e,{'sessionId':md5(_0x3a9021)})[_0x8671('0x2b')](function(_0x17fce5){logger[_0x8671('0x1c')](JSON[_0x8671('0x44')](_0x17fce5));return{'source':_0x17fce5[_0x8671('0x5e')]['source'],'resolvedQuery':_0x17fce5['result'][_0x8671('0x5f')],'action':_0x17fce5['result'][_0x8671('0x60')],'actionIncomplete':_0x17fce5[_0x8671('0x5e')][_0x8671('0x61')],'speech':_0x17fce5[_0x8671('0x5e')]['fulfillment'][_0x8671('0x62')],'score':_0x17fce5[_0x8671('0x5e')][_0x8671('0x63')],'statusCode':_0x17fce5[_0x8671('0x64')]['code'],'endConversation':_0x17fce5[_0x8671('0x5e')]['metadata'][_0x8671('0x65')]||![],'isFallbackIntent':_0x17fce5[_0x8671('0x5e')][_0x8671('0x66')][_0x8671('0x67')]};});};exports['googleDialogflowV2']=function(_0xcddfe7,_0x2656b4,_0x4dbd62,_0x36f9c3,_0x533a9d,_0x434fbe){var _0x3fc179=_0x36f9c3['replace'](/\\n/g,'\x0a');var _0x428554={'credentials':{'private_key':_0x3fc179,'client_email':_0x4dbd62}};var _0x1f88ec=new dialogflow[(_0x8671('0x68'))](_0x428554);var _0x667de1=_0x1f88ec[_0x8671('0x69')](_0x2656b4,md5(_0xcddfe7));var _0x51ba66={'session':_0x667de1,'queryInput':{'text':{'text':_0x533a9d,'languageCode':_0x434fbe}}};return _0x1f88ec['detectIntent'](_0x51ba66)[_0x8671('0x2b')](function(_0x5369d6){if(_0x5369d6&&_0x5369d6['length']){logger['info'](_0x8671('0x6a'),JSON['stringify'](_0x5369d6));var _0x54e7d7=_0x5369d6[0x0];if(_0x54e7d7){var _0x618ac={'action':_0x54e7d7[_0x8671('0x6b')][_0x8671('0x60')],'allRequiredParamsPresent':_0x54e7d7[_0x8671('0x6b')]['allRequiredParamsPresent'],'endConversation':_0x54e7d7[_0x8671('0x6b')][_0x8671('0x6c')]&&_0x54e7d7[_0x8671('0x6b')]['diagnosticInfo']['fields']?_0x54e7d7[_0x8671('0x6b')][_0x8671('0x6c')][_0x8671('0x6d')][_0x8671('0x6e')][_0x8671('0x6f')]:![],'fulfillmentText':_0x54e7d7[_0x8671('0x6b')]['fulfillmentText'],'intentName':_0x54e7d7[_0x8671('0x6b')][_0x8671('0x70')]['name'],'intentDisplayName':_0x54e7d7[_0x8671('0x6b')][_0x8671('0x70')]['displayName'],'isFallbackIntent':_0x54e7d7[_0x8671('0x6b')][_0x8671('0x70')][_0x8671('0x71')],'languageCode':_0x54e7d7[_0x8671('0x6b')][_0x8671('0x72')],'queryText':_0x54e7d7[_0x8671('0x6b')][_0x8671('0x73')],'responseId':_0x54e7d7['responseId'],'score':_0x54e7d7['queryResult'][_0x8671('0x74')],'speech':_0x54e7d7[_0x8671('0x6b')][_0x8671('0x75')],'providerResponse':JSON[_0x8671('0x44')](_0x5369d6)};return _0x618ac;}}});};exports[_0x8671('0x76')]=function(_0x4c4a52,_0xe6fef8,_0x4ba649,_0x2df97e){return tilde[_0x8671('0x4f')](_0x4c4a52,_0xe6fef8,_0x4ba649,_0x2df97e)['then'](function(_0x436819){try{fs[_0x8671('0x1e')](_0x4c4a52);}catch(_0x3c12fe){logger['error'](_0x3c12fe);}logger[_0x8671('0x1c')](_0x8671('0x77'),_0x436819[_0x8671('0x54')]);logger[_0x8671('0x1c')](_0x8671('0x78'),_0x436819[_0x8671('0x56')]);return _0x436819;});};exports['awsPolly']=function(_0x3f641d,_0x36466d,_0x43da38,_0x6faa2d,_0x341599,_0x2e5c1b){var _0x486973=path[_0x8671('0x3c')](__dirname,_0x8671('0x28'),rs[_0x8671('0x29')](0x4)+_0x8671('0x4c'));var _0x275dec;return aws['polly'](_0x3f641d,_0x36466d,_0x43da38,_0x6faa2d,_0x341599,_0x2e5c1b,_0x486973)[_0x8671('0x2b')](function(){_0x275dec=path[_0x8671('0x3c')](__dirname,_0x8671('0x28'),rs[_0x8671('0x29')](0x4)+_0x8671('0x3d'));return convertFile(_0x486973,_0x275dec);})[_0x8671('0x2b')](function(){try{fs[_0x8671('0x1e')](_0x486973);fs[_0x8671('0x3b')](_0x275dec,'777');}catch(_0x34f9fb){logger['error'](_0x34f9fb);}return _0x275dec[_0x8671('0x2d')]('.')[0x0];});};exports[_0x8671('0x79')]=function(_0x2981a1,_0x2ba3ec,_0x318624,_0xa4ff17,_0x44df42,_0x56247c){return aws[_0x8671('0x7a')](_0x2981a1,_0x2ba3ec,_0x318624,_0xa4ff17,_0x44df42,_0x56247c)[_0x8671('0x2b')](function(_0x108c93){logger[_0x8671('0x1c')](JSON[_0x8671('0x44')](_0x108c93));return _0x108c93;});};exports['ispeechTTS']=function(_0x5edee2,_0x11785c,_0xbc2fe,_0x11fc53){var _0x2526a9=util[_0x8671('0x7b')](_0x8671('0x7c'),ISPEECH_API,_0x5edee2,encodeURIComponent(_0x11785c),_0xbc2fe,_0x11fc53);var _0x4d4ce4=path[_0x8671('0x3c')](__dirname,'tmp',rs[_0x8671('0x29')](0x4)+_0x8671('0x4c'));var _0x3a438b;return downloadFile(_0x2526a9,_0x4d4ce4)['then'](function(){_0x3a438b=path[_0x8671('0x3c')](__dirname,_0x8671('0x28'),rs[_0x8671('0x29')](0x4)+_0x8671('0x3d'));return convertFile(_0x4d4ce4,_0x3a438b);})[_0x8671('0x2b')](function(){try{fs[_0x8671('0x1e')](_0x4d4ce4);fs[_0x8671('0x3b')](_0x3a438b,_0x8671('0x2c'));}catch(_0x5620de){logger[_0x8671('0x17')](_0x5620de);}return _0x3a438b[_0x8671('0x2d')]('.')[0x0];});};exports[_0x8671('0x7d')]=function(_0x27880c,_0xd0187a,_0x971f01,_0x318c9f){var _0x2f17a6=util['format'](_0x8671('0x7e'),ISPEECH_API,_0xd0187a,_0x971f01,base64Encode(_0x27880c),_0x318c9f?util[_0x8671('0x7b')](_0x8671('0x7f'),encodeURIComponent(_0x318c9f)):_0x8671('0x80'));return uploadFile(_0x2f17a6)[_0x8671('0x2b')](function(_0xd6ab9e){return querystring[_0x8671('0x81')](_0xd6ab9e);});};exports[_0x8671('0x82')]=function(_0x1faae7,_0x3619f5){return sestek[_0x8671('0x83')](_0x1faae7,_0x3619f5)[_0x8671('0x2b')](function(_0x2a1edb){logger['info'](JSON[_0x8671('0x44')](_0x2a1edb));var _0x4eb722={'speech':_0x2a1edb['text'],'action':_0x2a1edb['channelData']?_0x2a1edb[_0x8671('0x84')][_0x8671('0x85')]:undefined,'actiondata':_0x2a1edb['channelData']?_0x2a1edb['channelData'][_0x8671('0x86')]:undefined};if(_0x2a1edb[_0x8671('0x84')]&&_0x2a1edb[_0x8671('0x84')][_0x8671('0x87')]){return base64Decode(_0x2a1edb[_0x8671('0x84')][_0x8671('0x87')][_0x8671('0x88')],path[_0x8671('0x3c')](__dirname,_0x8671('0x28'),rs['generate'](0x4)+'.wav'))[_0x8671('0x2b')](function(_0x1d0a30){_0x4eb722[_0x8671('0x89')]=_0x1d0a30;return _0x4eb722;});}return _0x4eb722;});};exports[_0x8671('0x8a')]=function(){return __dirname;}; \ No newline at end of file +var _0x7a1c=['parse','util','./aws','./google','./sestek','./tilde','../../../config/logger','https://api.ispeech.org/api/rest','protocol','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','download\x20error','pipe','end','https:','data','transcode','wav','start','resolve','tmp','generate','.wav','writeFileSync','unlink','chmodSync','777','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','POST','.mp3','from','audioContent','writeFile','then','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','textRequest','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','endConversation','metadata','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','detectIntent','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','isFallback','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','awsLex','lex','ispeechTTS','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','freeform=3','sestekNDA','nda','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','http','https','md5','path','request-promise','sox','google-tts-api','url'];(function(_0x3ec333,_0x26bcbe){var _0x15ccb8=function(_0x2c4d0c){while(--_0x2c4d0c){_0x3ec333['push'](_0x3ec333['shift']());}};_0x15ccb8(++_0x26bcbe);}(_0x7a1c,0x110));var _0xc7a1=function(_0x42ac24,_0x436be1){_0x42ac24=_0x42ac24-0x0;var _0x422c65=_0x7a1c[_0x42ac24];return _0x422c65;};'use strict';var apiai=require(_0xc7a1('0x0'));var BPromise=require(_0xc7a1('0x1'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0xc7a1('0x2'));var https=require(_0xc7a1('0x3'));var md5=require(_0xc7a1('0x4'));var path=require(_0xc7a1('0x5'));var querystring=require('querystring');var rp=require(_0xc7a1('0x6'));var rs=require('randomstring');var sox=require(_0xc7a1('0x7'));var tts=require(_0xc7a1('0x8'));var urlParse=require(_0xc7a1('0x9'))[_0xc7a1('0xa')];var util=require(_0xc7a1('0xb'));var aws=require(_0xc7a1('0xc'));var google=require(_0xc7a1('0xd'));var sestek=require(_0xc7a1('0xe'));var tilde=require(_0xc7a1('0xf'));var logger=require(_0xc7a1('0x10'))('agi');var ISPEECH_API=_0xc7a1('0x11');function downloadFile(_0x3b80b5,_0x5b9828){return new BPromise(function(_0x54cca5,_0x394732){var _0x23a7dd=urlParse(_0x3b80b5);var _0x48217f=_0x23a7dd[_0xc7a1('0x12')]==='https:'?https:http;var _0x5b4d08={'host':_0x23a7dd[_0xc7a1('0x13')],'path':_0x23a7dd[_0xc7a1('0x5')],'headers':{'user-agent':_0xc7a1('0x14')}};_0x48217f[_0xc7a1('0x15')](_0x5b4d08,function(_0x4e9ed7){if(_0x4e9ed7[_0xc7a1('0x16')]!==0xc8){logger[_0xc7a1('0x17')](_0xc7a1('0x18')+_0x3b80b5+_0xc7a1('0x19')+_0x4e9ed7['statusCode']+'\x20('+_0x4e9ed7[_0xc7a1('0x1a')]+')');_0x394732(new Error(_0xc7a1('0x18')+_0x3b80b5+_0xc7a1('0x19')+_0x4e9ed7['statusCode']+'\x20('+_0x4e9ed7[_0xc7a1('0x1a')]+')'));return;}var _0x576d82=fs[_0xc7a1('0x1b')](_0x5b9828);_0x576d82['on'](_0xc7a1('0x1c'),function(){logger[_0xc7a1('0x1d')](_0xc7a1('0x1e'));_0x576d82['close'](_0x54cca5);});_0x576d82['on']('error',function(_0x1088af){fs['unlink'](_0x5b9828);logger[_0xc7a1('0x17')](_0xc7a1('0x1f'),_0x1088af);_0x394732(_0x1088af);});_0x4e9ed7[_0xc7a1('0x20')](_0x576d82);})['on'](_0xc7a1('0x17'),function(_0xfe67ce){logger['error'](_0xfe67ce);_0x394732(_0xfe67ce);})[_0xc7a1('0x21')]();});}function uploadFile(_0x2c2550){return new BPromise(function(_0x5868c1,_0x47d29f){var _0x25c0ee=urlParse(_0x2c2550);var _0x598788=_0x25c0ee[_0xc7a1('0x12')]===_0xc7a1('0x22')?https:http;var _0x51ca98={'host':_0x25c0ee[_0xc7a1('0x13')],'path':_0x25c0ee[_0xc7a1('0x5')],'headers':{'user-agent':_0xc7a1('0x14')}};_0x598788[_0xc7a1('0x15')](_0x51ca98,function(_0x5a6eb3){if(_0x5a6eb3[_0xc7a1('0x16')]!==0xc8){_0x47d29f(new Error('request\x20to\x20'+_0x2c2550+'\x20failed,\x20status\x20code\x20=\x20'+_0x5a6eb3['statusCode']+'\x20('+_0x5a6eb3[_0xc7a1('0x1a')]+')'));return;}var _0x48e408='';_0x5a6eb3['on'](_0xc7a1('0x23'),function(_0x208dc5){_0x48e408+=_0x208dc5;});_0x5a6eb3['on']('end',function(){_0x5868c1(_0x48e408);});})['on']('error',function(_0x21b1f6){_0x47d29f(_0x21b1f6);})['end']();});}function convertFile(_0x3aa4cd,_0x101308){return new BPromise(function(_0x3b9766,_0x2e1a57){var _0x22682a=sox[_0xc7a1('0x24')](_0x3aa4cd,_0x101308,{'sampleRate':0x1f40,'format':_0xc7a1('0x25'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x22682a['on'](_0xc7a1('0x17'),function(_0x2131ec){logger[_0xc7a1('0x17')]('error\x20convert',_0x2131ec);_0x2e1a57(_0x2131ec);});_0x22682a['on']('end',function(){logger[_0xc7a1('0x1d')]('finish\x20to\x20convert');_0x3b9766();});_0x22682a[_0xc7a1('0x26')]();});}function base64Decode(_0x4ad7b1,_0x388ad1){var _0x2b6ff3=path[_0xc7a1('0x27')](__dirname,_0xc7a1('0x28'),rs[_0xc7a1('0x29')](0x4)+_0xc7a1('0x2a'));fs[_0xc7a1('0x2b')](_0x2b6ff3,_0x4ad7b1,'base64');return convertFile(_0x2b6ff3,_0x388ad1)['then'](function(){try{fs[_0xc7a1('0x2c')](_0x2b6ff3);fs[_0xc7a1('0x2d')](_0x388ad1,_0xc7a1('0x2e'));}catch(_0x5d23b8){logger[_0xc7a1('0x17')](_0x5d23b8);}return _0x388ad1[_0xc7a1('0x2f')]('.')[0x0];});}function base64Encode(_0x9136ff){var _0xa9958d=fs[_0xc7a1('0x30')](_0x9136ff);return new Buffer(_0xa9958d)[_0xc7a1('0x31')]('base64');}exports[_0xc7a1('0x32')]=function(_0x22cbe6,_0x5e1445,_0x3aa10f,_0x40704d,_0x3bed7e,_0x20c2e8){var _0x1a182,_0x5e06a3;var _0x5d9729=_0xc7a1('0x33');var _0x123107=_0xc7a1('0x34')+_0x22cbe6;var _0x32cd43={};if(_0x5e1445===_0xc7a1('0x35')){_0x32cd43[_0xc7a1('0x36')]={'ssml':_0x3aa10f};}else{_0x32cd43['input']={'text':_0x3aa10f};};_0x32cd43[_0xc7a1('0x37')]={'languageCode':_0x40704d,'ssmlGender':_0x3bed7e};_0x32cd43[_0xc7a1('0x38')]={'audioEncoding':_0xc7a1('0x39'),'sampleRateHertz':0x1f40};var _0x164a92={'url':_0x5d9729+'text:synthesize'+_0x123107,'method':_0xc7a1('0x3a'),'json':!![],'body':_0x32cd43};return rp(_0x164a92)['then'](function(_0x1344d4){return new BPromise(function(_0x42339c,_0x27d082){_0x1a182=path['resolve'](__dirname,'tmp',rs[_0xc7a1('0x29')](0x4)+_0xc7a1('0x3b'));var _0x43f0d5=Buffer[_0xc7a1('0x3c')](_0x1344d4[_0xc7a1('0x3d')],'base64');return fs[_0xc7a1('0x3e')](_0x1a182,_0x43f0d5,function(_0x14f848){_0x27d082(_0x14f848);},function(_0x33e2ad){fs[_0xc7a1('0x2d')](_0x1a182,'777');_0x42339c(_0x33e2ad);});});})[_0xc7a1('0x3f')](function(_0x2155d3){_0x5e06a3=path['resolve'](__dirname,_0xc7a1('0x28'),rs[_0xc7a1('0x29')](0x4)+_0xc7a1('0x2a'));return convertFile(_0x1a182,_0x5e06a3);})[_0xc7a1('0x3f')](function(){try{fs[_0xc7a1('0x2c')](_0x1a182);fs[_0xc7a1('0x2d')](_0x5e06a3,'777');}catch(_0x24f02f){logger[_0xc7a1('0x17')](_0x24f02f);}logger[_0xc7a1('0x1d')]('googleCloudTTS\x20path',_0x5e06a3[_0xc7a1('0x2f')]('.')[0x0]);return _0x5e06a3[_0xc7a1('0x2f')]('.')[0x0];});};exports[_0xc7a1('0x40')]=function(_0x4d76f1,_0x21f0ea){var _0x347800=_0xc7a1('0x41');var _0x1025a5,_0x4fc210;var _0x1fc53;var _0x2a2053={'encoding':_0xc7a1('0x42'),'method':'POST','timeout':0x2710,'url':_0x347800,'headers':{'Content-Type':_0xc7a1('0x43')},'body':_0xc7a1('0x44')+encodeURIComponent(JSON['stringify']([[['jQ1olc',JSON[_0xc7a1('0x45')]([_0x4d76f1,_0x21f0ea||'en',![],'null']),null,'generic']]]))};return rp(_0x2a2053)[_0xc7a1('0x3f')](function(_0x5787e3){try{_0x1fc53=eval(_0x5787e3['slice'](0x5))[0x0][0x2];}catch(_0x1fa955){throw new Error(_0xc7a1('0x46')+_0x5787e3['data']);}if(!_0x1fc53){if(_0x4d76f1[_0xc7a1('0x47')]>0xc8){throw new Error(_0xc7a1('0x48'));}else{throw new Error(_0xc7a1('0x49')+_0x21f0ea+_0xc7a1('0x4a'));}}try{_0x1fc53=eval(_0x1fc53)[0x0];}catch(_0x48b9ad){throw new Error('parse\x20response\x20failed:\x0a'+res['data']);}const _0x33721f=_0x1fc53;_0x1025a5=path[_0xc7a1('0x27')](__dirname,_0xc7a1('0x28'),rs[_0xc7a1('0x29')](0x4)+'.mp3');fs['writeFileSync'](_0x1025a5,_0x1fc53,{'encoding':'base64'});_0x4fc210=path[_0xc7a1('0x27')](__dirname,_0xc7a1('0x28'),rs[_0xc7a1('0x29')](0x4)+'.wav');return convertFile(_0x1025a5,_0x4fc210);})['then'](function(){try{fs[_0xc7a1('0x2c')](_0x1025a5);fs[_0xc7a1('0x2d')](_0x4fc210,_0xc7a1('0x2e'));}catch(_0x13c992){logger[_0xc7a1('0x17')](_0x13c992);}logger[_0xc7a1('0x1d')](_0xc7a1('0x4b'),_0x4fc210[_0xc7a1('0x2f')]('.')[0x0]);return _0x4fc210[_0xc7a1('0x2f')]('.')[0x0];});};exports[_0xc7a1('0x4c')]=function(_0x512d1b,_0x3d7520,_0x4c1844){return google[_0xc7a1('0x4d')](_0x512d1b,_0x3d7520,_0x4c1844)['then'](function(_0x346c7e){logger[_0xc7a1('0x1d')](_0x346c7e[_0xc7a1('0x4e')]);return rp(_0x346c7e);})['then'](function(_0x42568d){var _0x184e26='';var _0x256a6a=0x0;try{fs[_0xc7a1('0x2c')](_0x512d1b);}catch(_0xd6443b){logger[_0xc7a1('0x17')](_0xd6443b);}if(_0x42568d&&_0x42568d[_0xc7a1('0x4f')]){_0x184e26=_0x42568d[_0xc7a1('0x4f')][_0xc7a1('0x50')](function(_0x811eef){return _0x811eef&&_0x811eef[_0xc7a1('0x51')][0x0]&&_0x811eef[_0xc7a1('0x51')][0x0]['transcript']?_0x811eef['alternatives'][0x0][_0xc7a1('0x52')]:'';})[_0xc7a1('0x53')]('\x0a');_0x256a6a=_0x42568d[_0xc7a1('0x4f')]['map'](function(_0x3e2107){return _0x3e2107&&_0x3e2107[_0xc7a1('0x51')][0x0]&&_0x3e2107['alternatives'][0x0][_0xc7a1('0x54')]?_0x3e2107[_0xc7a1('0x51')][0x0][_0xc7a1('0x54')]:0x0;})[_0xc7a1('0x53')]('\x0a');}logger[_0xc7a1('0x1d')](_0xc7a1('0x55'),_0x184e26);logger['info'](_0xc7a1('0x56'),_0x256a6a);return{'transcript':_0x184e26,'confidence':_0x256a6a};})[_0xc7a1('0x57')](function(_0x33d9dd){logger[_0xc7a1('0x17')](_0xc7a1('0x58'),_0x33d9dd['statusCode'],_0x33d9dd[_0xc7a1('0x59')],_0x33d9dd[_0xc7a1('0x5a')]);});};exports['googleDialogflow']=function(_0x21b7e8,_0x52d1fc,_0x5b04d9,_0xcebf64){var _0x2aa864=apiai(_0x52d1fc,{'language':_0xcebf64||'en'});return _0x2aa864[_0xc7a1('0x5b')](_0x5b04d9,{'sessionId':md5(_0x21b7e8)})['then'](function(_0xaf07){logger['info'](JSON[_0xc7a1('0x45')](_0xaf07));return{'source':_0xaf07[_0xc7a1('0x5c')][_0xc7a1('0x5d')],'resolvedQuery':_0xaf07['result'][_0xc7a1('0x5e')],'action':_0xaf07[_0xc7a1('0x5c')][_0xc7a1('0x5f')],'actionIncomplete':_0xaf07[_0xc7a1('0x5c')][_0xc7a1('0x60')],'speech':_0xaf07['result'][_0xc7a1('0x61')][_0xc7a1('0x62')],'score':_0xaf07['result'][_0xc7a1('0x63')],'statusCode':_0xaf07['status']['code'],'endConversation':_0xaf07['result']['metadata'][_0xc7a1('0x64')]||![],'isFallbackIntent':_0xaf07[_0xc7a1('0x5c')][_0xc7a1('0x65')][_0xc7a1('0x66')]};});};exports[_0xc7a1('0x67')]=function(_0x5c029a,_0x265f2e,_0x32d57a,_0x2500cc,_0x2d1f58,_0x2279c6){var _0x349f82=_0x2500cc[_0xc7a1('0x68')](/\\n/g,'\x0a');var _0x2417a4={'credentials':{'private_key':_0x349f82,'client_email':_0x32d57a}};var _0xd65f50=new dialogflow[(_0xc7a1('0x69'))](_0x2417a4);var _0x1163e6=_0xd65f50['sessionPath'](_0x265f2e,md5(_0x5c029a));var _0x11a4e0={'session':_0x1163e6,'queryInput':{'text':{'text':_0x2d1f58,'languageCode':_0x2279c6}}};return _0xd65f50[_0xc7a1('0x6a')](_0x11a4e0)[_0xc7a1('0x3f')](function(_0x23d391){if(_0x23d391&&_0x23d391['length']){logger['info'](_0xc7a1('0x6b'),JSON['stringify'](_0x23d391));var _0x494507=_0x23d391[0x0];if(_0x494507){var _0x55c938={'action':_0x494507['queryResult']['action'],'allRequiredParamsPresent':_0x494507['queryResult']['allRequiredParamsPresent'],'endConversation':_0x494507[_0xc7a1('0x6c')][_0xc7a1('0x6d')]&&_0x494507['queryResult'][_0xc7a1('0x6d')][_0xc7a1('0x6e')]?_0x494507[_0xc7a1('0x6c')]['diagnosticInfo']['fields'][_0xc7a1('0x6f')][_0xc7a1('0x70')]:![],'fulfillmentText':_0x494507[_0xc7a1('0x6c')][_0xc7a1('0x71')],'intentName':_0x494507[_0xc7a1('0x6c')][_0xc7a1('0x72')]['name'],'intentDisplayName':_0x494507[_0xc7a1('0x6c')][_0xc7a1('0x72')][_0xc7a1('0x73')],'isFallbackIntent':_0x494507[_0xc7a1('0x6c')][_0xc7a1('0x72')][_0xc7a1('0x74')],'languageCode':_0x494507[_0xc7a1('0x6c')]['languageCode'],'queryText':_0x494507[_0xc7a1('0x6c')][_0xc7a1('0x75')],'responseId':_0x494507[_0xc7a1('0x76')],'score':_0x494507[_0xc7a1('0x6c')][_0xc7a1('0x77')],'speech':_0x494507[_0xc7a1('0x6c')][_0xc7a1('0x71')],'providerResponse':JSON['stringify'](_0x23d391)};return _0x55c938;}}});};exports[_0xc7a1('0x78')]=function(_0x373f3e,_0x4813e0,_0x837965,_0x46c4c9){return tilde[_0xc7a1('0x4d')](_0x373f3e,_0x4813e0,_0x837965,_0x46c4c9)[_0xc7a1('0x3f')](function(_0x1fd5fc){try{fs[_0xc7a1('0x2c')](_0x373f3e);}catch(_0x21af54){logger[_0xc7a1('0x17')](_0x21af54);}logger[_0xc7a1('0x1d')](_0xc7a1('0x79'),_0x1fd5fc[_0xc7a1('0x52')]);logger[_0xc7a1('0x1d')](_0xc7a1('0x7a'),_0x1fd5fc[_0xc7a1('0x54')]);return _0x1fd5fc;});};exports[_0xc7a1('0x7b')]=function(_0x5f3d4f,_0x50bcb4,_0x35a53f,_0x21bbb8,_0x2cd09e,_0x144f6d){var _0x3a489a=path[_0xc7a1('0x27')](__dirname,'tmp',rs[_0xc7a1('0x29')](0x4)+_0xc7a1('0x3b'));var _0x2f9562;return aws['polly'](_0x5f3d4f,_0x50bcb4,_0x35a53f,_0x21bbb8,_0x2cd09e,_0x144f6d,_0x3a489a)[_0xc7a1('0x3f')](function(){_0x2f9562=path[_0xc7a1('0x27')](__dirname,_0xc7a1('0x28'),rs[_0xc7a1('0x29')](0x4)+_0xc7a1('0x2a'));return convertFile(_0x3a489a,_0x2f9562);})[_0xc7a1('0x3f')](function(){try{fs['unlink'](_0x3a489a);fs[_0xc7a1('0x2d')](_0x2f9562,'777');}catch(_0x5d1b24){logger['error'](_0x5d1b24);}return _0x2f9562[_0xc7a1('0x2f')]('.')[0x0];});};exports[_0xc7a1('0x7c')]=function(_0x1f454c,_0x273c2e,_0x25e99c,_0x35fa2a,_0x5bc705,_0xd76f1c){return aws[_0xc7a1('0x7d')](_0x1f454c,_0x273c2e,_0x25e99c,_0x35fa2a,_0x5bc705,_0xd76f1c)['then'](function(_0x1756d7){logger[_0xc7a1('0x1d')](JSON['stringify'](_0x1756d7));return _0x1756d7;});};exports[_0xc7a1('0x7e')]=function(_0x522dbd,_0x3b3ada,_0x7bca47,_0x110f6c){var _0x29bd2f=util['format'](_0xc7a1('0x7f'),ISPEECH_API,_0x522dbd,encodeURIComponent(_0x3b3ada),_0x7bca47,_0x110f6c);var _0x56d6fc=path[_0xc7a1('0x27')](__dirname,_0xc7a1('0x28'),rs['generate'](0x4)+_0xc7a1('0x3b'));var _0x3b61f1;return downloadFile(_0x29bd2f,_0x56d6fc)[_0xc7a1('0x3f')](function(){_0x3b61f1=path[_0xc7a1('0x27')](__dirname,_0xc7a1('0x28'),rs[_0xc7a1('0x29')](0x4)+_0xc7a1('0x2a'));return convertFile(_0x56d6fc,_0x3b61f1);})[_0xc7a1('0x3f')](function(){try{fs[_0xc7a1('0x2c')](_0x56d6fc);fs['chmodSync'](_0x3b61f1,_0xc7a1('0x2e'));}catch(_0x2ae8b5){logger[_0xc7a1('0x17')](_0x2ae8b5);}return _0x3b61f1['split']('.')[0x0];});};exports[_0xc7a1('0x80')]=function(_0x28b8f4,_0x7eb73a,_0xa593ee,_0x3dd873){var _0x22295f=util[_0xc7a1('0x81')](_0xc7a1('0x82'),ISPEECH_API,_0x7eb73a,_0xa593ee,base64Encode(_0x28b8f4),_0x3dd873?util[_0xc7a1('0x81')]('model=%s',encodeURIComponent(_0x3dd873)):_0xc7a1('0x83'));return uploadFile(_0x22295f)[_0xc7a1('0x3f')](function(_0x53ff8b){return querystring[_0xc7a1('0xa')](_0x53ff8b);});};exports[_0xc7a1('0x84')]=function(_0x343bac,_0x4bad9b){return sestek[_0xc7a1('0x85')](_0x343bac,_0x4bad9b)[_0xc7a1('0x3f')](function(_0x5ea065){logger[_0xc7a1('0x1d')](JSON[_0xc7a1('0x45')](_0x5ea065));var _0x1ebc5b={'speech':_0x5ea065['text'],'action':_0x5ea065[_0xc7a1('0x86')]?_0x5ea065[_0xc7a1('0x86')][_0xc7a1('0x87')]:undefined,'actiondata':_0x5ea065[_0xc7a1('0x86')]?_0x5ea065[_0xc7a1('0x86')][_0xc7a1('0x88')]:undefined};if(_0x5ea065[_0xc7a1('0x86')]&&_0x5ea065[_0xc7a1('0x86')]['AudioFromTts']){return base64Decode(_0x5ea065[_0xc7a1('0x86')][_0xc7a1('0x89')][_0xc7a1('0x8a')],path[_0xc7a1('0x27')](__dirname,'tmp',rs[_0xc7a1('0x29')](0x4)+'.wav'))[_0xc7a1('0x3f')](function(_0x35b6c5){_0x1ebc5b[_0xc7a1('0x8b')]=_0x35b6c5;return _0x1ebc5b;});}return _0x1ebc5b;});};exports[_0xc7a1('0x8c')]=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 03fa0f6..1937451 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 _0x49c0=['exports'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x49c0,0xb5));var _0x049c=function(_0x410e0d,_0x520e45){_0x410e0d=_0x410e0d-0x0;var _0x4d0663=_0x49c0[_0x410e0d];return _0x4d0663;};var nda=require('./nda');module[_0x049c('0x0')]={'nda':nda}; \ No newline at end of file +var _0xf1b5=['./nda'];(function(_0x4f217f,_0x313163){var _0x3b583a=function(_0x334971){while(--_0x334971){_0x4f217f['push'](_0x4f217f['shift']());}};_0x3b583a(++_0x313163);}(_0xf1b5,0x141));var _0x5f1b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf1b5[_0x3dd15e];return _0x231fd0;};var nda=require(_0x5f1b('0x0'));module['exports']={'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 931a2d7..92d9ee7 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 _0x4ea3=['dnid','text','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','request-promise','url','../../../../../config/logger','agi','ndauth_url','/token','password','username','then','POST','resolve','ndassistant_url','ndaactivity_type','message','callerid','calleridname'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4ea3,0x70));var _0x34ea=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x4ea3[_0x5b644e];return _0x49c6bf;};'use strict';var rp=require(_0x34ea('0x0'));var url=require(_0x34ea('0x1'));var logger=require(_0x34ea('0x2'))(_0x34ea('0x3'));module['exports']=function(_0x374ec1,_0x494b56){var _0x269d4c={'method':'POST','uri':url['resolve'](_0x494b56[_0x34ea('0x4')],_0x34ea('0x5')),'form':{'grant_type':_0x34ea('0x6'),'username':_0x494b56[_0x34ea('0x7')],'password':_0x494b56[_0x34ea('0x6')]},'json':!![]};return rp(_0x269d4c)[_0x34ea('0x8')](function(_0x22b09e){var _0x5bec7c={'method':_0x34ea('0x9'),'uri':url[_0x34ea('0xa')](_0x494b56[_0x34ea('0xb')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x494b56[_0x34ea('0xc')]||_0x34ea('0xd'),'channelId':'Nda','conversation':{'id':_0x374ec1['uniqueid']},'from':{'id':_0x374ec1[_0x34ea('0xe')],'name':_0x374ec1[_0x34ea('0xf')]},'recipient':{'id':_0x374ec1[_0x34ea('0x10')],'name':_0x374ec1['extension']},'text':_0x494b56[_0x34ea('0x11')],'channelData':{}},'headers':{'Authorization':_0x34ea('0x12')+_0x22b09e[_0x34ea('0x13')]},'json':!![]};if(_0x494b56[_0x34ea('0x14')]){_0x5bec7c[_0x34ea('0x15')][_0x34ea('0x16')][_0x34ea('0x17')]=_0x494b56[_0x34ea('0x14')];}if(_0x494b56[_0x34ea('0x18')]=='1'){_0x5bec7c[_0x34ea('0x15')][_0x34ea('0x16')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x34ea('0x19')};}if(_0x494b56[_0x34ea('0x1a')]){_0x5bec7c[_0x34ea('0x15')][_0x34ea('0x16')][_0x34ea('0x1b')]=_0x494b56['custom_action'];if(_0x494b56[_0x34ea('0x1c')]){_0x5bec7c[_0x34ea('0x15')][_0x34ea('0x16')][_0x34ea('0x1d')]=_0x494b56['custom_action_data'];}}logger[_0x34ea('0x1e')](JSON[_0x34ea('0x1f')](_0x5bec7c));return rp(_0x5bec7c);});}; \ No newline at end of file +var _0x851a=['text','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','CustomAction','custom_action','CustomActionData','custom_action_data','info','request-promise','../../../../../config/logger','agi','exports','POST','resolve','/token','username','password','then','ndassistant_url','ndaactivity_type','message','uniqueid','callerid','calleridname','dnid','extension'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x851a,0x19b));var _0xa851=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0x851a[_0x2aea9e];return _0x430b92;};'use strict';var rp=require(_0xa851('0x0'));var url=require('url');var logger=require(_0xa851('0x1'))(_0xa851('0x2'));module[_0xa851('0x3')]=function(_0x52489c,_0xd7442b){var _0x1af5fd={'method':_0xa851('0x4'),'uri':url[_0xa851('0x5')](_0xd7442b['ndauth_url'],_0xa851('0x6')),'form':{'grant_type':'password','username':_0xd7442b[_0xa851('0x7')],'password':_0xd7442b[_0xa851('0x8')]},'json':!![]};return rp(_0x1af5fd)[_0xa851('0x9')](function(_0x551e16){var _0x3e1e9d={'method':_0xa851('0x4'),'uri':url[_0xa851('0x5')](_0xd7442b[_0xa851('0xa')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0xd7442b[_0xa851('0xb')]||_0xa851('0xc'),'channelId':'Nda','conversation':{'id':_0x52489c[_0xa851('0xd')]},'from':{'id':_0x52489c[_0xa851('0xe')],'name':_0x52489c[_0xa851('0xf')]},'recipient':{'id':_0x52489c[_0xa851('0x10')],'name':_0x52489c[_0xa851('0x11')]},'text':_0xd7442b[_0xa851('0x12')],'channelData':{}},'headers':{'Authorization':_0xa851('0x13')+_0x551e16[_0xa851('0x14')]},'json':!![]};if(_0xd7442b[_0xa851('0x15')]){_0x3e1e9d[_0xa851('0x16')][_0xa851('0x17')][_0xa851('0x18')]=_0xd7442b[_0xa851('0x15')];}if(_0xd7442b[_0xa851('0x19')]=='1'){_0x3e1e9d[_0xa851('0x16')][_0xa851('0x17')][_0xa851('0x1a')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xa851('0x1b')};}if(_0xd7442b['custom_action']){_0x3e1e9d[_0xa851('0x16')][_0xa851('0x17')][_0xa851('0x1c')]=_0xd7442b[_0xa851('0x1d')];if(_0xd7442b['custom_action_data']){_0x3e1e9d[_0xa851('0x16')][_0xa851('0x17')][_0xa851('0x1e')]=_0xd7442b[_0xa851('0x1f')];}}logger[_0xa851('0x20')](JSON['stringify'](_0x3e1e9d));return rp(_0x3e1e9d);});}; \ 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 5d257c3..f284b45 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 _0x84fe=['exports'];(function(_0x47492a,_0x42bc87){var _0x195f98=function(_0x550bcb){while(--_0x550bcb){_0x47492a['push'](_0x47492a['shift']());}};_0x195f98(++_0x42bc87);}(_0x84fe,0xb8));var _0xe84f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x84fe[_0x321bb2];return _0x9c12ed;};'use strict';var asr=require('./lib/api');module[_0xe84f('0x0')]=function(_0x31fb32,_0x50b7b5,_0x100425,_0x4a5fe8){return asr(_0x31fb32,_0x50b7b5,_0x100425,_0x4a5fe8);}; \ No newline at end of file +var _0x78ca=['./lib/api','exports'];(function(_0x1d6558,_0x4f9467){var _0x5cb728=function(_0x41ae21){while(--_0x41ae21){_0x1d6558['push'](_0x1d6558['shift']());}};_0x5cb728(++_0x4f9467);}(_0x78ca,0xf2));var _0xa78c=function(_0x136d86,_0x130a03){_0x136d86=_0x136d86-0x0;var _0x2d20b0=_0x78ca[_0x136d86];return _0x2d20b0;};'use strict';var asr=require(_0xa78c('0x0'));module[_0xa78c('0x1')]=function(_0x2ddafe,_0x18a9b4,_0x2d7bd7,_0x324e08){return asr(_0x2ddafe,_0x18a9b4,_0x2d7bd7,_0x324e08);}; \ 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 4dc5a06..46535bd 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 _0xdb97=['status','result','final','Tilde\x20ASR\x20hypoteses','transcript','hypotheses','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.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','isNil','message','bluebird','lodash','moment','crypto','../../../../../../config/logger','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','update','digest','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','close','error','Tilde\x20ASR\x20send\x20error','terminate','parse'];(function(_0x83aa1a,_0x54c5cb){var _0x162dcb=function(_0x4c8809){while(--_0x4c8809){_0x83aa1a['push'](_0x83aa1a['shift']());}};_0x162dcb(++_0x54c5cb);}(_0xdb97,0x1c8));var _0x7db9=function(_0x15fbd9,_0x735c9c){_0x15fbd9=_0x15fbd9-0x0;var _0x56179f=_0xdb97[_0x15fbd9];return _0x56179f;};'use strict';var BPromise=require(_0x7db9('0x0'));var _=require(_0x7db9('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x7db9('0x2'));var crypto=require(_0x7db9('0x3'));var logger=require(_0x7db9('0x4'))('agi');module[_0x7db9('0x5')]=function(_0x3d6fa8,_0x5dab77,_0x27ecfb,_0x5cf2ce){return new BPromise(function(_0x507fa8,_0x56c6d1){logger[_0x7db9('0x6')](_0x7db9('0x7'),_0x5cf2ce||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x4fdc56=new WebSocket(_0x5cf2ce||_0x7db9('0x8'),{'perMessageDeflate':![]});var _0x432769='';var _0x284a95='0';var _0x2df8d2='1';var _0x8ea67f=_0x7db9('0x9');function _0x1a310b(_0xe985c){var _0x551958=crypto['createHash'](_0x7db9('0xa'));_0x551958[_0x7db9('0xb')](_0xe985c);return _0x551958[_0x7db9('0xc')]('hex');}function _0x345f12(){try{logger[_0x7db9('0x6')](_0x7db9('0xd'));var _0x5736fb=moment()[_0x7db9('0xe')]();var _0x3ac45e=_0x1a310b(_0x5736fb+_0x5dab77+_0x27ecfb);_0x4fdc56[_0x7db9('0xf')](JSON[_0x7db9('0x10')]({'appID':_0x5dab77,'timestamp':_0x5736fb,'appKey':_0x3ac45e}));var _0x23e870=fs[_0x7db9('0x11')](_0x3d6fa8);_0x23e870['on'](_0x7db9('0x12'),function(_0x36d7bc){_0x4fdc56[_0x7db9('0xf')](_0x36d7bc);});_0x23e870['on'](_0x7db9('0x13'),function(){_0x4fdc56['send']('EOS');});}catch(_0x2df7ae){logger[_0x7db9('0x14')](_0x7db9('0x15'),JSON[_0x7db9('0x10')](_0x2df7ae));_0x4fdc56[_0x7db9('0x16')]();}}function _0x11864a(_0x325ebf){try{if(_0x325ebf){var _0x3b87e3=JSON[_0x7db9('0x17')](_0x325ebf);switch(_0x3b87e3[_0x7db9('0x18')]){case 0x0:if(_0x3b87e3['result']){if(_0x3b87e3[_0x7db9('0x19')][_0x7db9('0x1a')]){logger[_0x7db9('0x6')](_0x7db9('0x1b'),JSON['stringify'](_0x3b87e3[_0x7db9('0x19')]['hypotheses']));_0x432769=_0x3b87e3[_0x7db9('0x19')]['hypotheses'][0x0][_0x7db9('0x1c')];_0x284a95=_0x3b87e3[_0x7db9('0x19')][_0x7db9('0x1d')][0x0][_0x7db9('0x1e')];_0x2df8d2='0';_0x8ea67f=_0x7db9('0x1f');_0x4fdc56[_0x7db9('0x16')]();}}break;case 0x1:logger['info']('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x2df8d2='1';_0x8ea67f=_0x7db9('0x9');break;case 0x2:logger[_0x7db9('0x6')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x2df8d2='2';_0x8ea67f=_0x7db9('0x20');break;case 0x9:logger[_0x7db9('0x6')](_0x7db9('0x21'));_0x2df8d2='9';_0x8ea67f=_0x7db9('0x21');break;case 0xa:logger['info'](_0x7db9('0x22'));_0x2df8d2='10';_0x8ea67f='Authentication\x20failed.';break;case 0xb:logger['info'](_0x7db9('0x23'));_0x2df8d2='11';_0x8ea67f=_0x7db9('0x23');}}}catch(_0x4106f4){logger[_0x7db9('0x14')](_0x7db9('0x24'),JSON[_0x7db9('0x10')](_0x4106f4));_0x4fdc56[_0x7db9('0x16')]();}}function _0x91d612(){logger[_0x7db9('0x6')](_0x7db9('0x25'));_0x507fa8({'transcript':_0x432769,'confidence':_0x284a95,'status':_0x2df8d2,'status_message':_0x8ea67f});}function _0xd12a14(_0x2faec3){logger['error']('Error\x20Tilde\x20ASR\x20socket');if(!_[_0x7db9('0x26')](_0x2faec3)){logger[_0x7db9('0x14')](_['isObject'](_0x2faec3)?JSON[_0x7db9('0x10')](_0x2faec3):_0x2faec3);}}_0x4fdc56['on']('open',_0x345f12);_0x4fdc56['on'](_0x7db9('0x27'),_0x11864a);_0x4fdc56['on'](_0x7db9('0x13'),_0x91d612);_0x4fdc56['on'](_0x7db9('0x14'),_0xd12a14);});}; \ No newline at end of file +var _0x5ee2=['message','bluebird','lodash','moment','crypto','../../../../../../config/logger','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','stringify','createReadStream','data','send','close','EOS','terminate','parse','status','result','final','hypotheses','transcript','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','open'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x5ee2,0x14e));var _0x25ee=function(_0x1137d6,_0x3a201c){_0x1137d6=_0x1137d6-0x0;var _0x5d8c6f=_0x5ee2[_0x1137d6];return _0x5d8c6f;};'use strict';var BPromise=require(_0x25ee('0x0'));var _=require(_0x25ee('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x25ee('0x2'));var crypto=require(_0x25ee('0x3'));var logger=require(_0x25ee('0x4'))('agi');module[_0x25ee('0x5')]=function(_0x13c336,_0x588837,_0x23c762,_0x177fe){return new BPromise(function(_0x581d5b,_0x2117da){logger[_0x25ee('0x6')](_0x25ee('0x7'),_0x177fe||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x17cd8f=new WebSocket(_0x177fe||_0x25ee('0x8'),{'perMessageDeflate':![]});var _0x2d95c1='';var _0x36bbfa='0';var _0x64cc1b='1';var _0x4d1152=_0x25ee('0x9');function _0x240e40(_0xc79efb){var _0x3eaa33=crypto[_0x25ee('0xa')](_0x25ee('0xb'));_0x3eaa33[_0x25ee('0xc')](_0xc79efb);return _0x3eaa33[_0x25ee('0xd')](_0x25ee('0xe'));}function _0x405efa(){try{logger['info']('Open\x20Tilde\x20ASR\x20socket');var _0x7fe46=moment()['unix']();var _0x64c3a4=_0x240e40(_0x7fe46+_0x588837+_0x23c762);_0x17cd8f['send'](JSON[_0x25ee('0xf')]({'appID':_0x588837,'timestamp':_0x7fe46,'appKey':_0x64c3a4}));var _0x9cbf98=fs[_0x25ee('0x10')](_0x13c336);_0x9cbf98['on'](_0x25ee('0x11'),function(_0x218752){_0x17cd8f[_0x25ee('0x12')](_0x218752);});_0x9cbf98['on'](_0x25ee('0x13'),function(){_0x17cd8f[_0x25ee('0x12')](_0x25ee('0x14'));});}catch(_0x5eba22){logger['error']('Tilde\x20ASR\x20send\x20error',JSON['stringify'](_0x5eba22));_0x17cd8f[_0x25ee('0x15')]();}}function _0x537c85(_0xfe6c0f){try{if(_0xfe6c0f){var _0x2520cd=JSON[_0x25ee('0x16')](_0xfe6c0f);switch(_0x2520cd[_0x25ee('0x17')]){case 0x0:if(_0x2520cd[_0x25ee('0x18')]){if(_0x2520cd[_0x25ee('0x18')][_0x25ee('0x19')]){logger['info']('Tilde\x20ASR\x20hypoteses',JSON['stringify'](_0x2520cd[_0x25ee('0x18')]['hypotheses']));_0x2d95c1=_0x2520cd[_0x25ee('0x18')][_0x25ee('0x1a')][0x0][_0x25ee('0x1b')];_0x36bbfa=_0x2520cd[_0x25ee('0x18')][_0x25ee('0x1a')][0x0]['likelihood'];_0x64cc1b='0';_0x4d1152=_0x25ee('0x1c');_0x17cd8f[_0x25ee('0x15')]();}}break;case 0x1:logger[_0x25ee('0x6')](_0x25ee('0x9'));_0x64cc1b='1';_0x4d1152=_0x25ee('0x9');break;case 0x2:logger[_0x25ee('0x6')](_0x25ee('0x1d'));_0x64cc1b='2';_0x4d1152=_0x25ee('0x1d');break;case 0x9:logger['info']('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x64cc1b='9';_0x4d1152='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0x25ee('0x6')](_0x25ee('0x1e'));_0x64cc1b='10';_0x4d1152=_0x25ee('0x1e');break;case 0xb:logger['info'](_0x25ee('0x1f'));_0x64cc1b='11';_0x4d1152=_0x25ee('0x1f');}}}catch(_0x5831e6){logger[_0x25ee('0x20')](_0x25ee('0x21'),JSON[_0x25ee('0xf')](_0x5831e6));_0x17cd8f[_0x25ee('0x15')]();}}function _0x163273(){logger[_0x25ee('0x6')](_0x25ee('0x22'));_0x581d5b({'transcript':_0x2d95c1,'confidence':_0x36bbfa,'status':_0x64cc1b,'status_message':_0x4d1152});}function _0x4f4f5f(_0x1cf146){logger[_0x25ee('0x20')]('Error\x20Tilde\x20ASR\x20socket');if(!_['isNil'](_0x1cf146)){logger['error'](_['isObject'](_0x1cf146)?JSON[_0x25ee('0xf')](_0x1cf146):_0x1cf146);}}_0x17cd8f['on'](_0x25ee('0x23'),_0x405efa);_0x17cd8f['on'](_0x25ee('0x24'),_0x537c85);_0x17cd8f['on'](_0x25ee('0x13'),_0x163273);_0x17cd8f['on'](_0x25ee('0x20'),_0x4f4f5f);});}; \ 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 24eda10..598a0ec 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 _0xee39=['./asr'];(function(_0x1f153d,_0x20935f){var _0x1883d4=function(_0x227075){while(--_0x227075){_0x1f153d['push'](_0x1f153d['shift']());}};_0x1883d4(++_0x20935f);}(_0xee39,0x107));var _0x9ee3=function(_0x50d9f2,_0x305115){_0x50d9f2=_0x50d9f2-0x0;var _0xcd6a7a=_0xee39[_0x50d9f2];return _0xcd6a7a;};var asr=require(_0x9ee3('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x1778=['exports'];(function(_0x268717,_0x3e7811){var _0x367780=function(_0x52fcc1){while(--_0x52fcc1){_0x268717['push'](_0x268717['shift']());}};_0x367780(++_0x3e7811);}(_0x1778,0x16d));var _0x8177=function(_0x292c2e,_0xeb8a05){_0x292c2e=_0x292c2e-0x0;var _0x2eebeb=_0x1778[_0x292c2e];return _0x2eebeb;};var asr=require('./asr');module[_0x8177('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index cfdf267..769e288 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 _0x295b=['createServer','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','ready','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','util','EventEmitter','./error','./channel','call','emit','error','E_AGI_ARGUMENT_PORT'];(function(_0xb41283,_0x42775f){var _0x524ef0=function(_0x21f45c){while(--_0x21f45c){_0xb41283['push'](_0xb41283['shift']());}};_0x524ef0(++_0x42775f);}(_0x295b,0x10c));var _0xb295=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x295b[_0x49b207];return _0x2dc8fa;};'use strict';var util=require(_0xb295('0x0'));var net=require('net');var EventEmitter=require('events')[_0xb295('0x1')];var AGIError=require(_0xb295('0x2'));var AGIChannel=require(_0xb295('0x3'));var AGIServer=function(_0x354581,_0x500b19,_0x32202c){var _0x5f29b0=this,_0x354581=_0x354581||0x11dd,_0x500b19=_0x500b19||'127.0.0.1',_0x5226e3=null,_0x14d0c0=0x0;EventEmitter[_0xb295('0x4')](_0x5f29b0);function _0x5bbb25(){if(!_0x354581){_0x5f29b0[_0xb295('0x5')](_0xb295('0x6'),new AGIError(_0xb295('0x7')));return![];}_0x5226e3=net[_0xb295('0x8')]();_0x5226e3[_0xb295('0x9')](_0x354581,_0x500b19);_0x5226e3['on'](_0xb295('0xa'),function(){_0x5f29b0[_0xb295('0x5')](_0xb295('0xa'));});_0x5226e3['on'](_0xb295('0xb'),function(_0x2bdf42){_0x5226e3[_0xb295('0xc')](function(_0x56bc28,_0x22b953){if(_0x56bc28){_0x5f29b0['emit'](_0xb295('0x6'),new AGIError(_0xb295('0xd'),_0x56bc28));}else if(_0x32202c&&_0x32202c<0x0){_0x5f29b0[_0xb295('0x5')](_0xb295('0x6'),new AGIError(_0xb295('0xe')));_0x2bdf42[_0xb295('0xf')]();}else if(_0x32202c&&_0x32202c>0x0&&_0x32202c<_0x22b953){_0x14d0c0+=0x1;_0x5f29b0[_0xb295('0x5')](_0xb295('0x6'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x14d0c0));_0x2bdf42[_0xb295('0xf')]();}else{var _0x5cd9b1=new AGIChannel(_0x2bdf42);_0x5cd9b1['on'](_0xb295('0x10'),function(){_0x5f29b0[_0xb295('0x5')](_0xb295('0xb'),_0x5cd9b1);});}});});_0x5226e3['on']('error',function(_0x21da5b){_0x5f29b0['emit'](_0xb295('0x6'),new AGIError(_0xb295('0xd'),_0x21da5b[_0xb295('0x11')]));});_0x5226e3['on'](_0xb295('0x12'),function(){_0x5f29b0[_0xb295('0x5')](_0xb295('0x12'),new AGIError(_0xb295('0x13')));});}process[_0xb295('0x14')](function(){_0x5bbb25();});};util[_0xb295('0x15')](AGIServer,EventEmitter);module[_0xb295('0x16')]=function(_0x19defe,_0x57fa9a,_0xe4586f){return new AGIServer(_0x19defe,_0x57fa9a,_0xe4586f);}; \ No newline at end of file +var _0x5d8c=['E_AGI_SERVER_VOICE_DISABLED','E_AGI_SERVER_MAXCONNECTION','destroy','ready','connection','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','util','net','events','EventEmitter','./error','./channel','call','emit','error','createServer','listen','listening','getConnections','E_AGI_SERVER_ERROR'];(function(_0xd11332,_0x109f79){var _0x493808=function(_0x8cd38d){while(--_0x8cd38d){_0xd11332['push'](_0xd11332['shift']());}};_0x493808(++_0x109f79);}(_0x5d8c,0x6a));var _0xc5d8=function(_0x3f633a,_0x1ccf72){_0x3f633a=_0x3f633a-0x0;var _0x3757ee=_0x5d8c[_0x3f633a];return _0x3757ee;};'use strict';var util=require(_0xc5d8('0x0'));var net=require(_0xc5d8('0x1'));var EventEmitter=require(_0xc5d8('0x2'))[_0xc5d8('0x3')];var AGIError=require(_0xc5d8('0x4'));var AGIChannel=require(_0xc5d8('0x5'));var AGIServer=function(_0x59b6c8,_0x4b057c,_0x5a4a81){var _0x548553=this,_0x59b6c8=_0x59b6c8||0x11dd,_0x4b057c=_0x4b057c||'127.0.0.1',_0x347de1=null,_0x15a6fa=0x0;EventEmitter[_0xc5d8('0x6')](_0x548553);function _0x26def0(){if(!_0x59b6c8){_0x548553[_0xc5d8('0x7')](_0xc5d8('0x8'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x347de1=net[_0xc5d8('0x9')]();_0x347de1[_0xc5d8('0xa')](_0x59b6c8,_0x4b057c);_0x347de1['on']('listening',function(){_0x548553[_0xc5d8('0x7')](_0xc5d8('0xb'));});_0x347de1['on']('connection',function(_0xdafb1c){_0x347de1[_0xc5d8('0xc')](function(_0x37948a,_0x21967c){if(_0x37948a){_0x548553['emit'](_0xc5d8('0x8'),new AGIError(_0xc5d8('0xd'),_0x37948a));}else if(_0x5a4a81&&_0x5a4a81<0x0){_0x548553['emit'](_0xc5d8('0x8'),new AGIError(_0xc5d8('0xe')));_0xdafb1c['destroy']();}else if(_0x5a4a81&&_0x5a4a81>0x0&&_0x5a4a81<_0x21967c){_0x15a6fa+=0x1;_0x548553[_0xc5d8('0x7')]('error',new AGIError(_0xc5d8('0xf'),_0x15a6fa));_0xdafb1c[_0xc5d8('0x10')]();}else{var _0x4ac725=new AGIChannel(_0xdafb1c);_0x4ac725['on'](_0xc5d8('0x11'),function(){_0x548553['emit'](_0xc5d8('0x12'),_0x4ac725);});}});});_0x347de1['on'](_0xc5d8('0x8'),function(_0xc2fb){_0x548553[_0xc5d8('0x7')](_0xc5d8('0x8'),new AGIError(_0xc5d8('0xd'),_0xc2fb['code']));});_0x347de1['on'](_0xc5d8('0x13'),function(){_0x548553[_0xc5d8('0x7')](_0xc5d8('0x13'),new AGIError(_0xc5d8('0x14')));});}process[_0xc5d8('0x15')](function(){_0x26def0();});};util[_0xc5d8('0x16')](AGIServer,EventEmitter);module[_0xc5d8('0x17')]=function(_0x1eafcb,_0x16e996,_0x4c34a8){return new AGIServer(_0x1eafcb,_0x16e996,_0x4c34a8);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 5617097..fb66b32 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 _0x1677=['scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPauseById','agentPause','agent','agentUnpause','agentLogout','internal','%s/%s@from-sip/n','LOCAL','agentLogin','shellCommand','exec','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','number','includes','POST','PUT','toUpperCase','body','rawBody','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','headers','parse','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','dialogflow_language','googleDialogflowV2','client_email','sestekNDA','key','ispeech_tts_language','speed','ispeechASR','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','tildeASR','appid','clone','hasOwnProperty','isString','recursiveNodeIndex','isPlainObject','isArray','length','replaceAllVariables','saveRestApiResult','%s.%s','setVariable','replaceObjectAllVariables','split','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','isConfigured','maxRetry','retry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','noop','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','agi','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','add','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','no\x20grammar\x20configured','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','odbc_id','no\x20database\x20selected','query','no\x20query\x20configured','query:\x20%s','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20selected','getUser','sip_id','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','dialogflowV2_project_id','no\x20project_id\x20configured','no\x20client_email\x20configured','private_key','no\x20private_key\x20configured','dialogflowV2_language','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20is\x20unreachable','ndauth_url','username','no\x20username\x20configured','password','no\x20password\x20configured','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','sesteknda','audiofile','streamFile','.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','SIP/%s/%s','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20found','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','response','maxdigit','test','mindigit','no\x20variable\x20found','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','goalname','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','Trying\x20aws\x20Polly\x20%s','unlink','aws\x20Polly\x20is\x20unreachable','awslex','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','appsecret','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','context','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','ispeechTTS','ispeech\x20%s\x20file\x20created','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','failure','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','forEach','%s[%s]','variable\x20%s[key]\x20set','menu','no\x20file\x20audio\x20selected','getSound','getData','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','pause','getPause','pause_id','playback','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','QUEUE','macro','gosub','position','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','Response:','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayPhonetic','sendMail','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','subject','service','host','port','secure','authentication','auth','pass','template_id','debug','sendMail\x20message','sendFax','SENDFAX\x20block\x20not\x20implemented','sendSMS','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','yes','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','arg_1','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','join','util','shelljs','randomstring','moment','mustache','request-promise','../../config/logger','../../config/environment','/var/opt/motion2/server/files','rawHeaders','getdigits','getsecretdigits','mailRpc','prototype','getVariable','rpc','getVariableById','then','name','catch','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','getTrunk','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','IntervalId','interval','map','Intervals','format','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','channel','callerid','createSquareRecording','extension','priority','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id'];(function(_0x287575,_0xbb9c74){var _0x598ba8=function(_0x5b4668){while(--_0x5b4668){_0x287575['push'](_0x287575['shift']());}};_0x598ba8(++_0xbb9c74);}(_0x1677,0x18f));var _0x7167=function(_0x434ac8,_0x5ce9d1){_0x434ac8=_0x434ac8-0x0;var _0x5729d7=_0x1677[_0x434ac8];return _0x5729d7;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0x7167('0x0'));var _=require('lodash');var sh=require(_0x7167('0x1'));var odbc=require('odbc')();var rs=require(_0x7167('0x2'));var moment=require(_0x7167('0x3'));var Mustache=require(_0x7167('0x4'));var rp=require(_0x7167('0x5'));var logger=require(_0x7167('0x6'))('agi');var config=require(_0x7167('0x7'));var scripts=require('./scripts');var FILES_PATH=_0x7167('0x8');var recursiveMapAttributes=[_0x7167('0x9'),'rawBody'];var verticesWithRetry=['menu',_0x7167('0xa'),_0x7167('0xb')];var AGIVertices=function(_0x49381c,_0xaaf5cc,_0x104f1a){this['channel']=_0x49381c;this['rpc']=_0xaaf5cc;this[_0x7167('0xc')]=_0x104f1a;};AGIVertices[_0x7167('0xd')][_0x7167('0xe')]=function(_0x179124,_0x1ee922){this[_0x7167('0xf')][_0x7167('0x10')](_0x179124)[_0x7167('0x11')](function(_0x17c6e2){_0x1ee922(null,_0x17c6e2?_0x17c6e2[_0x7167('0x12')]:![]);})[_0x7167('0x13')](function(_0x96688a){_0x1ee922(_0x96688a);});};AGIVertices[_0x7167('0xd')]['getVoiceQueue']=function(_0x3d3715,_0xfdc20f){this['rpc'][_0x7167('0x14')](_0x3d3715)[_0x7167('0x11')](function(_0x3621c8){_0xfdc20f(null,_0x3621c8?_0x3621c8[_0x7167('0x12')]:![]);})[_0x7167('0x13')](function(_0x20bc59){_0xfdc20f(_0x20bc59);});};AGIVertices[_0x7167('0xd')][_0x7167('0x15')]=function(_0x3b9d02,_0x39eab1){this[_0x7167('0xf')][_0x7167('0x16')](_0x3b9d02)[_0x7167('0x11')](function(_0x31f2a6){_0x39eab1(null,_0x31f2a6?_0x31f2a6[_0x7167('0x12')]:![]);})[_0x7167('0x13')](function(_0x47ac15){_0x39eab1(_0x47ac15);});};AGIVertices[_0x7167('0xd')][_0x7167('0x17')]=function(_0x3b8d68,_0x47257a){this[_0x7167('0xf')][_0x7167('0x18')](_0x3b8d68)[_0x7167('0x11')](function(_0x3c9e6d){_0x47257a(null,_0x3c9e6d?_0x3c9e6d['dsn']:![]);})[_0x7167('0x13')](function(_0x14bebe){_0x47257a(_0x14bebe);});};AGIVertices[_0x7167('0xd')]['getUser']=function(_0x3abe6e,_0x423077){this[_0x7167('0xf')]['getUserById'](_0x3abe6e)[_0x7167('0x11')](function(_0x58175a){_0x423077(null,_0x58175a?_0x58175a[_0x7167('0x12')]:![]);})[_0x7167('0x13')](function(_0x1dd57f){_0x423077(_0x1dd57f);});};AGIVertices[_0x7167('0xd')][_0x7167('0x19')]=function(_0x3b5014,_0x3a5aee){this[_0x7167('0xf')]['getTrunkById'](_0x3b5014)[_0x7167('0x11')](function(_0x176f73){_0x3a5aee(null,_0x176f73?_0x176f73[_0x7167('0x12')]:![]);})[_0x7167('0x13')](function(_0x348f88){_0x3a5aee(_0x348f88);});};AGIVertices[_0x7167('0xd')]['getSound']=function(_0x3c6882,_0x2397e1){var _0x38dd7e=this;this[_0x7167('0xf')][_0x7167('0x1a')](_0x3c6882)[_0x7167('0x11')](function(_0x4ed601){_0x2397e1(null,_0x4ed601?_0x38dd7e[_0x7167('0x1b')](_0x4ed601[_0x7167('0x1c')]):![]);})['catch'](function(_0x175d89){_0x2397e1(_0x175d89);});};AGIVertices[_0x7167('0xd')][_0x7167('0x1d')]=function(_0x40cd7f,_0x16742f){this[_0x7167('0xf')][_0x7167('0x1e')](_0x40cd7f)[_0x7167('0x11')](function(_0x2e4770){_0x16742f(null,_0x2e4770?_0x2e4770:![]);})[_0x7167('0x13')](function(_0x250dce){_0x16742f(_0x250dce);});};AGIVertices['prototype'][_0x7167('0x1f')]=function(_0x14405f,_0xe85f5e,_0x224377){this[_0x7167('0xc')]['sendMailMessage'](_0x14405f,_0xe85f5e)[_0x7167('0x11')](function(){_0x224377(null);})[_0x7167('0x13')](function(_0x3f4bcc){_0x224377(_0x3f4bcc);});};AGIVertices[_0x7167('0xd')]['getIntervals']=function(_0x184fd6,_0x3a408d){this[_0x7167('0xf')]['getIntervalById'](_0x184fd6)['then'](function(_0x54e620){if(_0x54e620){if(_0x54e620[_0x7167('0x20')]){_0x3a408d(null,[_0x54e620[_0x7167('0x21')]]);}else{_0x3a408d(null,_[_0x7167('0x22')](_0x54e620[_0x7167('0x23')],_0x7167('0x21')));}}else{_0x3a408d(null,![]);}})[_0x7167('0x13')](function(_0x3e8122){_0x3a408d(_0x3e8122);});};AGIVertices[_0x7167('0xd')][_0x7167('0x1b')]=function(_0x245ec4){return util[_0x7167('0x24')]('%s/sounds/converted/%s',FILES_PATH,_0x245ec4);};AGIVertices[_0x7167('0xd')][_0x7167('0x25')]=function(_0x59b265,_0x5d753f,_0x3d487a){odbc[_0x7167('0x26')](_0x59b265,function(_0x1fc341){if(_0x1fc341){logger[_0x7167('0x27')](_0x7167('0x28'),_0x1fc341);_0x3d487a(_0x1fc341);}else{logger[_0x7167('0x29')](_0x7167('0x2a'));odbc['query'](_0x5d753f,function(_0x406a09,_0x3512d9){if(_0x406a09){logger[_0x7167('0x29')](_0x7167('0x2b'),_0x5d753f);_0x3d487a(_0x406a09);}else{logger[_0x7167('0x29')](_0x7167('0x2c'),_0x5d753f);odbc[_0x7167('0x2d')](function(_0x2ac760){if(_0x2ac760){logger[_0x7167('0x27')](_0x7167('0x2e'),_0x2ac760);}_0x3d487a(null,_0x3512d9);});}});}});};AGIVertices[_0x7167('0xd')][_0x7167('0x2f')]=function(_0x548464,_0x3897de){this[_0x7167('0xf')][_0x7167('0x30')](_0x548464)[_0x7167('0x11')](function(_0x58cbfc){_0x3897de(null,_0x58cbfc?_0x58cbfc:![]);})[_0x7167('0x13')](function(_0x431873){_0x3897de(_0x431873);});};AGIVertices[_0x7167('0xd')][_0x7167('0x31')]=function(_0x314e73,_0x5e36aa){this[_0x7167('0xf')][_0x7167('0x31')](_0x314e73)[_0x7167('0x11')](function(_0xd63db0){_0x5e36aa(null,_0xd63db0);})[_0x7167('0x13')](function(_0x3f6bac){_0x5e36aa(_0x3f6bac);});};AGIVertices[_0x7167('0xd')][_0x7167('0x32')]=function(_0x3c5178,_0x548b86,_0x471f26){this[_0x7167('0xf')][_0x7167('0x32')]({'uniqueid':this['channel'][_0x7167('0x33')],'node':_0x3c5178[_0x7167('0x34')],'application':_0x3c5178[_0x7167('0x35')],'data':_0x548b86||null,'project_name':this[_0x7167('0x36')]['arg_1'],'callerid':this[_0x7167('0x36')][_0x7167('0x37')]})[_0x7167('0x11')](function(_0x5d07a8){if(_0x471f26){_0x471f26(null,_0x5d07a8);}})[_0x7167('0x13')](function(_0x253915){if(_0x471f26){_0x471f26(_0x253915);}});};AGIVertices[_0x7167('0xd')][_0x7167('0x38')]=function(_0x482b70,_0x4e3376,_0x5b94cc,_0x437e83){this[_0x7167('0xf')][_0x7167('0x38')]({'uniqueid':this[_0x7167('0x36')][_0x7167('0x33')],'callerid':this['channel'][_0x7167('0x37')],'calleridname':this[_0x7167('0x36')]['calleridname'],'context':this['channel']['context'],'extension':this[_0x7167('0x36')][_0x7167('0x39')],'priority':this[_0x7167('0x36')][_0x7167('0x3a')],'accountcode':this[_0x7167('0x36')]['accountcode'],'dnid':this[_0x7167('0x36')]['dnid'],'projectName':this['channel']['arg_1'],'saveName':_0x4e3376,'filename':_0x482b70[_0x7167('0x3b')]||_0x4e3376,'savePath':_0x5b94cc})[_0x7167('0x11')](function(_0x1dc81a){_0x437e83(null,_0x1dc81a);})[_0x7167('0x13')](function(_0x58d13b){_0x437e83(_0x58d13b);});};AGIVertices[_0x7167('0xd')][_0x7167('0x3c')]=function(_0x22a05c,_0x49c09b,_0x384707,_0x154c06,_0x5e3ef7){this[_0x7167('0xf')][_0x7167('0x3c')]({'uniqueid':this[_0x7167('0x36')][_0x7167('0x33')],'body':_0x22a05c,'direction':_0x49c09b,'providerName':_0x384707,'providerResponse':_0x154c06})[_0x7167('0x11')](function(_0x4ea134){if(_0x5e3ef7){_0x5e3ef7(null,_0x4ea134);}})['catch'](function(_0x3d8d9c){if(_0x5e3ef7){_0x5e3ef7(_0x3d8d9c);}});};AGIVertices[_0x7167('0xd')][_0x7167('0x3d')]=function(_0x2b0f5d,_0x7ac906){this['rpc'][_0x7167('0x3d')]({'firstName':_[_0x7167('0x3e')](_0x2b0f5d['name'])||_[_0x7167('0x3f')](_0x2b0f5d[_0x7167('0x12')])?_0x7167('0x40')+Math[_0x7167('0x41')]():_0x2b0f5d['name'],'lastName':_[_0x7167('0x3e')](_0x2b0f5d[_0x7167('0x42')])||_['isNil'](_0x2b0f5d['lastName'])?null:_0x2b0f5d[_0x7167('0x42')],'phone':_0x2b0f5d[_0x7167('0x43')],'ListId':_0x2b0f5d[_0x7167('0x44')],'scheduledat':_0x2b0f5d[_0x7167('0x45')],'callbackUniqueid':this[_0x7167('0x36')]['uniqueid'],'tags':_0x7167('0x46'),'description':_0x7167('0x47')+_0x2b0f5d[_0x7167('0x45')][_0x7167('0x48')](),'priority':_0x2b0f5d[_0x7167('0x49')]})[_0x7167('0x11')](function(_0xe51f77){_0x7ac906(null,_0xe51f77);})[_0x7167('0x13')](function(_0x2695e9){_0x7ac906(_0x2695e9);});};AGIVertices['prototype']['getPause']=function(_0x1e4948,_0x25073f){this[_0x7167('0xf')][_0x7167('0x4a')](_0x1e4948)['then'](function(_0x3ad623){_0x25073f(null,_0x3ad623?_0x3ad623[_0x7167('0x12')]:![]);})['catch'](function(_0x21fd3e){_0x25073f(_0x21fd3e);});};AGIVertices[_0x7167('0xd')][_0x7167('0x4b')]=function(_0x11637f,_0x3b79b4,_0x4a63ba){var _0x588ff9={'role':_0x7167('0x4c')};_0x588ff9[_0x11637f]=this[_0x7167('0x36')]['callerid'];this[_0x7167('0xf')][_0x7167('0x4b')](_0x588ff9,_0x3b79b4,this['channel']['uniqueid'])[_0x7167('0x11')](function(_0x535bf5){_0x4a63ba(null,_[_0x7167('0x3f')](_0x535bf5)?![]:!![]);})[_0x7167('0x13')](function(_0x59995a){logger[_0x7167('0x27')](_0x59995a);_0x4a63ba(null,![]);});};AGIVertices[_0x7167('0xd')]['agentUnpause']=function(_0x2ff3e0,_0x247f8b){var _0x39b8f4={'role':_0x7167('0x4c')};_0x39b8f4[_0x2ff3e0]=this[_0x7167('0x36')]['callerid'];this[_0x7167('0xf')][_0x7167('0x4d')](_0x39b8f4)[_0x7167('0x11')](function(_0xaf6cb9){_0x247f8b(null,_[_0x7167('0x3f')](_0xaf6cb9)?![]:!![]);})[_0x7167('0x13')](function(_0x49710b){logger[_0x7167('0x27')](_0x49710b);_0x247f8b(null,![]);});};AGIVertices[_0x7167('0xd')][_0x7167('0x4e')]=function(_0x1288c7,_0x4dd858){var _0xa8a505={'role':_0x7167('0x4c')};_0xa8a505[_0x1288c7]=this[_0x7167('0x36')][_0x7167('0x37')];this[_0x7167('0xf')][_0x7167('0x4e')](_0xa8a505)[_0x7167('0x11')](function(_0x429e1b){_0x4dd858(null,_[_0x7167('0x3f')](_0x429e1b)?![]:!![]);})[_0x7167('0x13')](function(_0x20b3f3){logger[_0x7167('0x27')](_0x20b3f3);_0x4dd858(null,![]);});};AGIVertices[_0x7167('0xd')]['agentLogin']=function(_0x4a847e,_0x2070af){var _0x4b714f={'role':_0x7167('0x4c')};_0x4b714f[_0x4a847e]=this[_0x7167('0x36')]['callerid'];var _0x110649=_0x4a847e!=_0x7167('0x4f')?util[_0x7167('0x24')](_0x7167('0x50'),_0x7167('0x51'),this['channel']['callerid']):undefined;this['rpc'][_0x7167('0x52')](_0x4b714f,_0x110649)['then'](function(_0x5d7567){_0x2070af(null,_['isNil'](_0x5d7567)?![]:!![]);})[_0x7167('0x13')](function(_0xceb41f){logger[_0x7167('0x27')](_0xceb41f);_0x2070af(null,![]);});};AGIVertices[_0x7167('0xd')][_0x7167('0x53')]=function(_0x460e6f,_0x5f25e2){sh[_0x7167('0x54')](_['trim'](_0x460e6f),function(_0x4b030a,_0x51f8bd){var _0x3123c8=_0x51f8bd[_0x7167('0x55')](/(\r\n|\n|\r)/gm,'');_0x5f25e2(null,_0x3123c8);});};AGIVertices[_0x7167('0xd')][_0x7167('0x56')]=function(_0x17356f,_0x5390ae){scripts[_0x7167('0x56')](_0x17356f[_0x7167('0x57')],_0x17356f[_0x7167('0x58')]||_0x7167('0x59'),_0x17356f[_0x7167('0x59')],_0x17356f[_0x7167('0x5a')]||_0x7167('0x5b'),_0x17356f[_0x7167('0x5c')]||_0x7167('0x5d'),_0x17356f[_0x7167('0x5e')]||_0x7167('0x5f'))[_0x7167('0x11')](function(_0x5da7b5){_0x5390ae(null,_0x5da7b5);})[_0x7167('0x13')](function(_0xd18b2e){_0x5390ae(_0xd18b2e);});};AGIVertices['prototype'][_0x7167('0x60')]=function(_0x403a79,_0x2dbaec){scripts[_0x7167('0x60')](_0x403a79['text'],_0x403a79[_0x7167('0x61')]||'en',0x1)[_0x7167('0x11')](function(_0x509200){_0x2dbaec(null,_0x509200);})['catch'](function(_0x280d44){_0x2dbaec(_0x280d44);});};AGIVertices['prototype'][_0x7167('0x62')]=function(_0x429de9,_0x203d33){var _0x54b0aa={'uri':_0x429de9[_0x7167('0x63')],'method':_0x429de9[_0x7167('0x64')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x429de9[_0x7167('0x65')])===_0x7167('0x66')&&parseInt(_0x429de9[_0x7167('0x65')])>=0x1?parseInt(_0x429de9[_0x7167('0x65')])*0x3e8:0x5*0x3e8};if(_[_0x7167('0x67')]([_0x7167('0x68'),_0x7167('0x69')],_0x54b0aa[_0x7167('0x64')][_0x7167('0x6a')]())){try{_0x54b0aa[_0x7167('0x6b')]=_0x429de9[_0x7167('0x6c')]?JSON['parse'](_0x429de9[_0x7167('0x6c')]):{};}catch(_0x2bd3cc){logger[_0x7167('0x27')](_0x7167('0x6d'),_0x2bd3cc);}}try{_0x54b0aa['headers']=_0x429de9[_0x7167('0x9')]?JSON['parse'](_0x429de9[_0x7167('0x9')]):{};}catch(_0x20c639){logger[_0x7167('0x27')](_0x7167('0x6e'),_0x20c639);}if(_0x429de9[_0x7167('0x6f')]){try{var _0x323269=require(_0x429de9[_0x7167('0x6f')])[_0x7167('0x70')](this,_0x54b0aa);_0x54b0aa[_0x7167('0x71')]=Mustache['render'](_0x429de9['url'],_0x323269,{},['$$','$$']);if(_0x54b0aa[_0x7167('0x72')]){_0x54b0aa[_0x7167('0x72')]=JSON[_0x7167('0x73')](Mustache['render'](JSON[_0x7167('0x74')](_0x54b0aa[_0x7167('0x72')]),_0x323269,{},['$$','$$']));}if(_0x54b0aa[_0x7167('0x6b')]){_0x54b0aa['body']=JSON['parse'](Mustache['render'](JSON['stringify'](_0x54b0aa[_0x7167('0x6b')]),_0x323269,{},['$$','$$']));}}catch(_0x206b1d){logger['error'](_0x7167('0x75'),_0x206b1d);}}rp(_0x54b0aa)[_0x7167('0x11')](function(_0x779d05){var _0xdef550={'statusCode':_0x779d05[_0x7167('0x76')]||0xc8,'statusMessage':_0x779d05[_0x7167('0x77')]||'OK','headers':_0x779d05[_0x7167('0x72')]||{},'body':_0x779d05[_0x7167('0x6b')]||{}};_0x203d33(null,_0xdef550);})[_0x7167('0x13')](function(_0x3d6a67){var _0x4f012d={'statusCode':_0x3d6a67[_0x7167('0x76')]||0x1f4,'statusMessage':_0x3d6a67[_0x7167('0x78')]||_0x7167('0x79'),'headers':_0x3d6a67[_0x7167('0x7a')][_0x7167('0x72')]||{},'body':_0x3d6a67[_0x7167('0x7a')]['body']||{}};_0x203d33(null,_0x4f012d);});};AGIVertices['prototype'][_0x7167('0x7b')]=function(_0x5441f7,_0x361701){scripts[_0x7167('0x7b')](this[_0x7167('0x36')]['uniqueid'],_0x5441f7['key'],_0x5441f7[_0x7167('0x59')],_0x5441f7[_0x7167('0x7c')]||'en')[_0x7167('0x11')](function(_0x2d01e1){_0x361701(null,_0x2d01e1);})[_0x7167('0x13')](function(_0x4476ae){_0x361701(_0x4476ae);});};AGIVertices[_0x7167('0xd')][_0x7167('0x7d')]=function(_0x23a39e,_0x3df345){scripts[_0x7167('0x7d')](this[_0x7167('0x36')][_0x7167('0x33')],_0x23a39e['dialogflowV2_project_id'],_0x23a39e[_0x7167('0x7e')],_0x23a39e['private_key'],_0x23a39e[_0x7167('0x59')],_0x23a39e['dialogflowV2_language']||'en')[_0x7167('0x11')](function(_0x36a25d){_0x3df345(null,_0x36a25d);})[_0x7167('0x13')](function(_0x10c61b){_0x3df345(_0x10c61b);});};AGIVertices['prototype']['sestekNDA']=function(_0x24f794,_0x1cbcd0){scripts[_0x7167('0x7f')](this[_0x7167('0x36')],_0x24f794)[_0x7167('0x11')](function(_0x54b114){_0x1cbcd0(null,_0x54b114);})[_0x7167('0x13')](function(_0x5be4eb){_0x1cbcd0(_0x5be4eb);});};AGIVertices[_0x7167('0xd')]['ispeechTTS']=function(_0x1e4c5d,_0x19ad14){scripts['ispeechTTS'](_0x1e4c5d[_0x7167('0x80')],_0x1e4c5d[_0x7167('0x59')],_0x1e4c5d[_0x7167('0x81')]||_0x7167('0x5b'),_0x1e4c5d[_0x7167('0x82')])[_0x7167('0x11')](function(_0x524e40){_0x19ad14(null,_0x524e40);})[_0x7167('0x13')](function(_0x42674b){_0x19ad14(_0x42674b);});};AGIVertices[_0x7167('0xd')][_0x7167('0x83')]=function(_0x49c114,_0x4ca87f,_0x33189b){scripts['ispeechASR'](_0x4ca87f,_0x49c114[_0x7167('0x80')],_0x49c114['ispeech_asr_language']||'en-US',this['isConfigured'](_0x49c114[_0x7167('0x84')])?_0x49c114[_0x7167('0x84')]:undefined)[_0x7167('0x11')](function(_0x5831e2){_0x33189b(null,_0x5831e2);})[_0x7167('0x13')](function(_0x29283b){_0x33189b(_0x29283b);});};AGIVertices[_0x7167('0xd')]['awsPolly']=function(_0x302ab2,_0x291b01){scripts[_0x7167('0x85')](_0x302ab2[_0x7167('0x86')],_0x302ab2[_0x7167('0x87')],_0x302ab2['aws_polly_region'],_0x302ab2[_0x7167('0x88')]||_0x7167('0x89'),_0x302ab2[_0x7167('0x59')],_0x302ab2[_0x7167('0x8a')]||_0x7167('0x59'))['then'](function(_0x275cfd){_0x291b01(null,_0x275cfd);})[_0x7167('0x13')](function(_0x4a5e99){_0x291b01(_0x4a5e99);});};AGIVertices[_0x7167('0xd')][_0x7167('0x8b')]=function(_0x238fc5,_0x336478){scripts['awsLex'](this[_0x7167('0x36')][_0x7167('0x33')],_0x238fc5[_0x7167('0x86')],_0x238fc5[_0x7167('0x87')],_0x238fc5[_0x7167('0x8c')],_0x238fc5[_0x7167('0x59')],_0x238fc5[_0x7167('0x8d')])['then'](function(_0x3ea1f2){_0x336478(null,_0x3ea1f2);})[_0x7167('0x13')](function(_0x972330){_0x336478(_0x972330);});};AGIVertices['prototype'][_0x7167('0x8e')]=function(_0xead982,_0x592daa,_0x421eee){scripts[_0x7167('0x8e')](_0x592daa,_0xead982[_0x7167('0x80')],_0xead982['google_asr_language']||_0x7167('0x5b'))[_0x7167('0x11')](function(_0x418c45){_0x421eee(null,_0x418c45);})['catch'](function(_0x3089d0){_0x421eee(_0x3089d0);});};AGIVertices[_0x7167('0xd')][_0x7167('0x8f')]=function(_0x5c08eb,_0x833ea5,_0x14475a){scripts['tildeASR'](_0x833ea5,_0x5c08eb[_0x7167('0x90')],_0x5c08eb['appsecret'],_0x5c08eb[_0x7167('0x71')])[_0x7167('0x11')](function(_0x483e83){_0x14475a(null,_0x483e83);})[_0x7167('0x13')](function(_0x512801){_0x14475a(_0x512801);});};AGIVertices[_0x7167('0xd')]['clear']=function(_0x97f72d){var _0x465ef2=_['includes'](verticesWithRetry,_0x97f72d[_0x7167('0x35')])?_0x97f72d:_[_0x7167('0x91')](_0x97f72d);for(var _0x1a21ec in _0x465ef2){if(_0x465ef2[_0x7167('0x92')](_0x1a21ec)){if(_0x465ef2[_0x1a21ec]&&_[_0x7167('0x93')](_0x465ef2[_0x1a21ec])){if(_[_0x7167('0x67')](recursiveMapAttributes,_0x1a21ec)){_0x465ef2[_0x1a21ec]=this['replaceObjectAllVariables'](_0x465ef2[_0x1a21ec]);}else{_0x465ef2[_0x1a21ec]=this['replaceAllVariables'](_0x465ef2[_0x1a21ec]);}}}}return _0x465ef2;};AGIVertices[_0x7167('0xd')][_0x7167('0x94')]=function(_0x471dcc){for(var _0x5da88c in _0x471dcc){if(_0x471dcc[_0x7167('0x92')](_0x5da88c)){if(_[_0x7167('0x95')](_0x471dcc[_0x5da88c])){this[_0x7167('0x94')](_0x471dcc[_0x5da88c]);}else if(_[_0x7167('0x96')](_0x471dcc[_0x5da88c])){for(var _0x442508=0x0;_0x442508<_0x471dcc[_0x5da88c][_0x7167('0x97')];_0x442508++){this['recursiveNodeIndex'](_0x471dcc[_0x5da88c][_0x442508]);}}else if(_[_0x7167('0x93')](_0x471dcc[_0x5da88c])){_0x471dcc[_0x5da88c]=this[_0x7167('0x98')](_0x471dcc[_0x5da88c]);}}}};AGIVertices[_0x7167('0xd')][_0x7167('0x99')]=function(_0x56940c,_0x1895c6){for(var _0x489468 in _0x56940c){if(_0x56940c[_0x7167('0x92')](_0x489468)){if(_[_0x7167('0x95')](_0x56940c[_0x489468])){if(!_['isEmpty'](_0x56940c[_0x489468])){this[_0x7167('0x99')](_0x56940c[_0x489468],util[_0x7167('0x24')](_0x7167('0x9a'),_0x1895c6,_0x489468));}}else if(_[_0x7167('0x96')](_0x56940c[_0x489468])){for(var _0x33ef46=0x0;_0x33ef46<_0x56940c[_0x489468][_0x7167('0x97')];_0x33ef46++){this[_0x7167('0x99')](_0x56940c[_0x489468][_0x33ef46],util[_0x7167('0x24')](_0x7167('0x9a'),_0x1895c6,_0x489468+'['+_0x33ef46+']'));}}else{if(!_[_0x7167('0x3f')](_0x56940c[_0x489468])){this[_0x7167('0x36')][_0x7167('0x9b')](util[_0x7167('0x24')](_0x7167('0x9a'),_0x1895c6,_0x489468),_0x56940c[_0x489468]);}}}}};AGIVertices['prototype'][_0x7167('0x9c')]=function(_0x5d21e1){try{var _0x136a31=JSON[_0x7167('0x73')](_0x5d21e1);this[_0x7167('0x94')](_0x136a31);return JSON['stringify'](_0x136a31);}catch(_0x335601){return this[_0x7167('0x98')](_0x5d21e1);}};AGIVertices[_0x7167('0xd')][_0x7167('0x98')]=function(_0xb807bc){var _0x306808=_0xb807bc['split']('{');for(var _0x38a53f=0x1;_0x38a53f<_0x306808[_0x7167('0x97')];_0x38a53f+=0x1){var _0x408699=_0x306808[_0x38a53f][_0x7167('0x9d')]('}');if(_0x408699['length']>0x1){_0xb807bc=_0xb807bc[_0x7167('0x9e')]('{'+_0x408699[0x0]+'}',this[_0x7167('0x36')][_0x7167('0xe')](_0x408699[0x0])[_0x7167('0x9f')]||_0x408699[0x0]);}}if(_0x306808[_0x7167('0x97')]===0x1){return _0xb807bc[_0x7167('0x48')]();}return this['replaceAllVariables'](_0xb807bc);};AGIVertices[_0x7167('0xd')][_0x7167('0xa0')]=function(_0x7b3778,_0xb7b2e3){var _0x2ec67f=this['channel'][_0x7167('0xe')](_0x7b3778);if(_0x2ec67f[_0x7167('0xa1')]===-0x1){return _0x2ec67f;}logger['info'](util[_0x7167('0x24')](_0x7167('0xa2'),_0xb7b2e3,_0x2ec67f[_0x7167('0x9f')]));return this[_0x7167('0x36')][_0x7167('0x9b')](_0xb7b2e3,_0x2ec67f['extra']);};AGIVertices[_0x7167('0xd')][_0x7167('0xa3')]=function(_0xc1ebc0){return _0xc1ebc0&&_0xc1ebc0!=='0'&&_0xc1ebc0!=='-1'&&_0xc1ebc0!=='';};AGIVertices[_0x7167('0xd')][_0x7167('0xa4')]=function(_0x1a9333){this[_0x7167('0x32')][_0x7167('0x70')](this,_0x1a9333,'-');_0x1a9333[_0x7167('0xa5')]=_0x1a9333[_0x7167('0xa4')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x7167('0xd')]['mrcpsynth']=function(_0x30ce76){logger[_0x7167('0x29')](util['format'](_0x7167('0xa6'),_0x30ce76[_0x7167('0x34')]));if(!this[_0x7167('0xa3')](_0x30ce76['text'])){return this[_0x7167('0x36')]['noop'](_0x7167('0xa7'));}var _0x4c8575='\x22'+_0x30ce76[_0x7167('0x59')]+'\x22';if(this[_0x7167('0xa3')](_0x30ce76['options'])){_0x4c8575+=','+_0x30ce76[_0x7167('0x7a')];}var _0x4f8951=this[_0x7167('0x36')][_0x7167('0x54')](_0x7167('0xa8'),_0x4c8575);if(_0x4f8951['result']===-0x1){return _0x4f8951;}return this['channel']['noop'](util[_0x7167('0x24')](_0x7167('0xa9'),_0x4c8575));};AGIVertices['prototype']['mrcprecog']=function(_0x28e78a){logger['info'](util['format'](_0x7167('0xaa'),_0x28e78a[_0x7167('0x34')]));if(!this[_0x7167('0xa3')](_0x28e78a[_0x7167('0xab')])){return this[_0x7167('0x36')][_0x7167('0xac')]('no\x20grammar\x20configured');}var _0x15c7aa=_0x28e78a['grammar'];if(this['isConfigured'](_0x28e78a[_0x7167('0x7a')])){_0x15c7aa+=','+_0x28e78a[_0x7167('0x7a')];}var _0x47bf40=this[_0x7167('0x36')][_0x7167('0x54')](_0x7167('0xad'),_0x15c7aa);if(_0x47bf40[_0x7167('0xa1')]===-0x1){return _0x47bf40;}var _0x3eb00a=this[_0x7167('0xa0')](_0x7167('0xae'),_0x7167('0xaf'));if(_0x3eb00a[_0x7167('0xa1')]===-0x1){return _0x3eb00a;}var _0x5f1f42=this['getAndSetVariable'](_0x7167('0xb0'),_0x7167('0xb1'));if(_0x5f1f42[_0x7167('0xa1')]===-0x1){return _0x5f1f42;}var _0x24183a=this[_0x7167('0xa0')]('RECOG_INSTANCE()',_0x7167('0xb2'));if(_0x24183a[_0x7167('0xa1')]===-0x1){return _0x24183a;}return this[_0x7167('0x36')][_0x7167('0xac')](util[_0x7167('0x24')](_0x7167('0xb3'),_0x15c7aa));};AGIVertices[_0x7167('0xd')][_0x7167('0xb4')]=function(_0x2cfd17){logger['info'](util['format'](_0x7167('0xb5'),_0x2cfd17[_0x7167('0x34')]));return this[_0x7167('0x36')][_0x7167('0xb4')]([_0x2cfd17[_0x7167('0xb6')],_0x2cfd17[_0x7167('0xb7')]]);};AGIVertices[_0x7167('0xd')][_0x7167('0xb8')]=function(_0x3f719e){logger[_0x7167('0x29')](util['format']('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x3f719e['label']));if(this[_0x7167('0xa3')](_0x3f719e[_0x7167('0x65')])){logger[_0x7167('0x29')](util[_0x7167('0x24')](_0x7167('0xb9'),_0x3f719e['timeout']));var _0x322bfb=this[_0x7167('0x36')][_0x7167('0xba')](_0x3f719e[_0x7167('0x65')]);if(_0x322bfb['result']===-0x1){return _0x322bfb;}}return this[_0x7167('0x36')][_0x7167('0xb8')]();};AGIVertices[_0x7167('0xd')][_0x7167('0x46')]=function(_0x47a89c){logger['info'](util['format'](_0x7167('0xbb'),_0x47a89c[_0x7167('0x34')]));if(!this['isConfigured'](_0x47a89c[_0x7167('0x44')])){return this[_0x7167('0x36')]['error'](_0x47a89c,_0x7167('0xbc'));}_0x47a89c[_0x7167('0x45')]=moment();if(this[_0x7167('0xa3')](_0x47a89c['delay'])){_0x47a89c[_0x7167('0x45')]=moment()[_0x7167('0xbd')](_0x47a89c[_0x7167('0xbe')],_0x7167('0xbf'));}if(!this[_0x7167('0xa3')](_0x47a89c[_0x7167('0x49')])){_0x47a89c[_0x7167('0x49')]=0x2;}this[_0x7167('0x3d')][_0x7167('0x70')](this,_0x47a89c);return this[_0x7167('0x36')][_0x7167('0xac')](util[_0x7167('0x24')](_0x7167('0xc0'),_0x47a89c[_0x7167('0x43')],_0x47a89c['list_id'],_0x47a89c[_0x7167('0x45')]));};AGIVertices['prototype'][_0x7167('0xc1')]=function(_0x527e48){logger['info'](util[_0x7167('0x24')](_0x7167('0xc2'),_0x527e48[_0x7167('0x34')]));var _0x19f0de=this[_0x7167('0x36')]['exec'](_0x527e48[_0x7167('0xc3')],_0x527e48[_0x7167('0x7a')]);if(_0x19f0de[_0x7167('0xa1')]===-0x1){return _0x19f0de;}return this[_0x7167('0x36')]['noop'](util[_0x7167('0x24')](_0x7167('0xc4'),_0x527e48[_0x7167('0xc3')],_0x527e48[_0x7167('0x7a')]));};AGIVertices['prototype']['lumenvoxtts']=function(_0x3cb7c2){logger['info'](util['format'](_0x7167('0xc5'),_0x3cb7c2['label']));if(!this['isConfigured'](_0x3cb7c2['text'])){return this[_0x7167('0x36')][_0x7167('0xac')]('no\x20text\x20configured');}var _0x343089='\x22'+_0x3cb7c2['text']+'\x22';if(this[_0x7167('0xa3')](_0x3cb7c2['options'])){_0x343089+=','+_0x3cb7c2[_0x7167('0x7a')];}var _0x4f2bd6=this['channel'][_0x7167('0x54')]('MRCPSynth',_0x343089);if(_0x4f2bd6[_0x7167('0xa1')]===-0x1){return _0x4f2bd6;}return this[_0x7167('0x36')][_0x7167('0xac')](util['format'](_0x7167('0xa9'),_0x343089));};AGIVertices[_0x7167('0xd')][_0x7167('0xc6')]=function(_0x31036e){logger[_0x7167('0x29')](util[_0x7167('0x24')](_0x7167('0xc7'),_0x31036e[_0x7167('0x34')]));if(!this[_0x7167('0xa3')](_0x31036e[_0x7167('0x59')])){return this[_0x7167('0x36')][_0x7167('0xac')](_0x7167('0xa7'));}var _0xed0961='\x22'+_0x31036e[_0x7167('0x59')]+'\x22';if(this[_0x7167('0xa3')](_0x31036e[_0x7167('0x7a')])){_0xed0961+=','+_0x31036e[_0x7167('0x7a')];}var _0x47e25c=this[_0x7167('0x36')][_0x7167('0x54')](_0x7167('0xa8'),_0xed0961);if(_0x47e25c['result']===-0x1){return _0x47e25c;}return this[_0x7167('0x36')][_0x7167('0xac')](util['format'](_0x7167('0xa9'),_0xed0961));};AGIVertices[_0x7167('0xd')]['lumenvoxasr']=function(_0x16c95b){logger[_0x7167('0x29')](util[_0x7167('0x24')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x16c95b['label']));if(!this[_0x7167('0xa3')](_0x16c95b['grammar'])){return this[_0x7167('0x36')][_0x7167('0xac')](_0x7167('0xc8'));}var _0x3912f3=_0x16c95b[_0x7167('0xab')];if(this[_0x7167('0xa3')](_0x16c95b[_0x7167('0x7a')])){_0x3912f3+=','+_0x16c95b[_0x7167('0x7a')];}var _0x32735c=this['channel'][_0x7167('0x54')](_0x7167('0xad'),_0x3912f3);if(_0x32735c['result']===-0x1){return _0x32735c;}var _0x319dff=this[_0x7167('0xa0')]('RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE');if(_0x319dff[_0x7167('0xa1')]===-0x1){return _0x319dff;}var _0x2834b7=this[_0x7167('0xa0')](_0x7167('0xb0'),_0x7167('0xc9'));if(_0x2834b7[_0x7167('0xa1')]===-0x1){return _0x2834b7;}var _0x2372a5=this['getAndSetVariable'](_0x7167('0xca'),_0x7167('0xcb'));if(_0x2372a5[_0x7167('0xa1')]===-0x1){return _0x2372a5;}return this[_0x7167('0x36')][_0x7167('0xac')](util['format'](_0x7167('0xb3'),_0x3912f3));};AGIVertices[_0x7167('0xd')][_0x7167('0xcc')]=function(_0x5bf8f8){logger['info'](util[_0x7167('0x24')](_0x7167('0xcd'),_0x5bf8f8[_0x7167('0x34')]));if(!this[_0x7167('0xa3')](_0x5bf8f8[_0x7167('0xab')])){return this[_0x7167('0x36')][_0x7167('0xac')](_0x7167('0xc8'));}var _0x4d585d=_0x5bf8f8['grammar'];if(this['isConfigured'](_0x5bf8f8['options'])){_0x4d585d+=','+_0x5bf8f8['options'];}var _0x25cd23=this[_0x7167('0x36')][_0x7167('0x54')](_0x7167('0xad'),_0x4d585d);if(_0x25cd23[_0x7167('0xa1')]===-0x1){return _0x25cd23;}var _0x4e868b=this[_0x7167('0xa0')](_0x7167('0xae'),_0x7167('0xce'));if(_0x4e868b['result']===-0x1){return _0x4e868b;}var _0x1f819f=this['getAndSetVariable'](_0x7167('0xb0'),_0x7167('0xcf'));if(_0x1f819f['result']===-0x1){return _0x1f819f;}var _0x41fd1b=this[_0x7167('0xa0')](_0x7167('0xca'),_0x7167('0xd0'));if(_0x41fd1b['result']===-0x1){return _0x41fd1b;}return this[_0x7167('0x36')][_0x7167('0xac')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x4d585d));};AGIVertices[_0x7167('0xd')][_0x7167('0xd1')]=function(_0x1e0fdc){logger['info'](util['format']('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x1e0fdc[_0x7167('0x34')]));if(!this[_0x7167('0xa3')](_0x1e0fdc[_0x7167('0xd2')])){return this[_0x7167('0x36')]['error'](_0x1e0fdc,_0x7167('0xd3'));}var _0x55af82=this['getSquareOdbc'][_0x7167('0x70')](this,_0x1e0fdc[_0x7167('0xd2')]);if(!_0x55af82){return this['channel'][_0x7167('0x27')](_0x1e0fdc,'no\x20odbc\x20database\x20found');}if(!this[_0x7167('0xa3')](_0x1e0fdc[_0x7167('0xd4')])){return this[_0x7167('0x36')][_0x7167('0x27')](_0x1e0fdc,_0x7167('0xd5'));}var _0xe5005e=_0x1e0fdc[_0x7167('0xd4')][_0x7167('0x55')](/(\r\n|\n|\r)/gm,'\x20');this[_0x7167('0x36')][_0x7167('0xac')](util[_0x7167('0x24')](_0x7167('0xd6'),_0xe5005e));var _0x32e7c7=this[_0x7167('0x25')][_0x7167('0x70')](this,_0x55af82,_0xe5005e);this['createSquareDetailsReport'][_0x7167('0x70')](this,_0x1e0fdc,_0xe5005e);if(!this[_0x7167('0xa3')](_0x1e0fdc['variable_id'])){return this[_0x7167('0x36')][_0x7167('0xac')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x2cce35=this[_0x7167('0xe')]['sync'](this,_0x1e0fdc['variable_id']);if(!_0x2cce35){return this[_0x7167('0x36')]['error'](_0x1e0fdc,'no\x20variable\x20found');}var _0x105559=this;_0x32e7c7['forEach'](function(_0x7f23d9,_0x115363){Object['keys'](_0x7f23d9)['forEach'](function(_0x497412){_0x105559[_0x7167('0x36')]['setVariable'](util[_0x7167('0x24')](_0x7167('0xd7'),_0x2cce35,_0x115363,_0x497412),_0x7f23d9[_0x497412]);});});this[_0x7167('0x36')][_0x7167('0x9b')](util['format'](_0x7167('0xd8'),_0x2cce35),_0x32e7c7[_0x7167('0x97')]);return this[_0x7167('0x36')]['noop'](util[_0x7167('0x24')](_0x7167('0xd9'),_0x2cce35));};AGIVertices['prototype'][_0x7167('0xda')]=function(_0xb760c5){logger['debug'](util[_0x7167('0x24')](_0x7167('0xdb'),_0xb760c5[_0x7167('0x34')]));if(!this['isConfigured'](_0xb760c5['sip_id'])){return this[_0x7167('0x36')][_0x7167('0x27')](_0xb760c5,_0x7167('0xdc'));}var _0x91914c=this[_0x7167('0xdd')][_0x7167('0x70')](this,_0xb760c5[_0x7167('0xde')]);if(!_0x91914c){return this[_0x7167('0x36')][_0x7167('0x27')](_0xb760c5,_0x7167('0xdf'));}var _0x260203=this['channel'][_0x7167('0x54')](_0x7167('0xe0'),[util[_0x7167('0x24')](_0x7167('0xe1'),_0x91914c),_0xb760c5[_0x7167('0x65')],_0xb760c5[_0x7167('0xe2')],_0xb760c5[_0x7167('0x63')]]);if(_0x260203[_0x7167('0xa1')]===-0x1){return _0x260203;}return this[_0x7167('0x36')][_0x7167('0xac')](util[_0x7167('0x24')](_0x7167('0xe3'),_0x7167('0xe0')));};AGIVertices[_0x7167('0xd')][_0x7167('0xe4')]=function(_0x5890f4){logger[_0x7167('0x29')](util[_0x7167('0x24')](_0x7167('0xe5'),_0x5890f4['label']));if(!this[_0x7167('0xa3')](_0x5890f4[_0x7167('0x80')])){return this[_0x7167('0x36')][_0x7167('0xac')](_0x7167('0xe6'));}if(!this[_0x7167('0xa3')](_0x5890f4[_0x7167('0x59')])){return this[_0x7167('0x36')][_0x7167('0xac')](_0x7167('0xa7'));}this[_0x7167('0x36')][_0x7167('0xe7')]=!![];this[_0x7167('0x32')](_0x5890f4);this[_0x7167('0x3c')](_0x5890f4['text'],'in','','');this[_0x7167('0x36')][_0x7167('0xac')](util[_0x7167('0x24')](_0x7167('0xe8'),_0x5890f4['text']));var _0x11a9d3=this['googleDialogflow']['sync'](this,_0x5890f4);if(_0x11a9d3){for(var _0x4848a5 in _0x11a9d3){if(_0x11a9d3[_0x7167('0x92')](_0x4848a5)){this['channel'][_0x7167('0x9b')](util[_0x7167('0x24')](_0x7167('0xe9'),_0x4848a5[_0x7167('0x6a')]()),_0x11a9d3[_0x4848a5]);}}this[_0x7167('0x3c')](_0x11a9d3[_0x7167('0xea')],_0x7167('0xeb'),'dialogflow','');return this[_0x7167('0x36')][_0x7167('0xac')](util[_0x7167('0x24')](_0x7167('0xec'),_0x11a9d3[_0x7167('0xea')]));}return this['channel'][_0x7167('0x27')](_0x5890f4,_0x7167('0xed'));};AGIVertices[_0x7167('0xd')][_0x7167('0xee')]=function(_0x3f5b36){logger[_0x7167('0x29')](util[_0x7167('0x24')](_0x7167('0xef'),_0x3f5b36[_0x7167('0x34')]));if(!this[_0x7167('0xa3')](_0x3f5b36[_0x7167('0xf0')])){return this[_0x7167('0x36')][_0x7167('0xac')](_0x7167('0xf1'));}if(!this[_0x7167('0xa3')](_0x3f5b36[_0x7167('0x7e')])){return this['channel']['noop'](_0x7167('0xf2'));}if(!this['isConfigured'](_0x3f5b36[_0x7167('0xf3')])){return this[_0x7167('0x36')][_0x7167('0xac')](_0x7167('0xf4'));}if(!this[_0x7167('0xa3')](_0x3f5b36[_0x7167('0xf5')])){return this['channel']['noop'](_0x7167('0xf6'));}if(!this['isConfigured'](_0x3f5b36[_0x7167('0x59')])){return this[_0x7167('0x36')][_0x7167('0xac')](_0x7167('0xa7'));}this[_0x7167('0x36')][_0x7167('0xe7')]=!![];this['createSquareDetailsReport'](_0x3f5b36);this[_0x7167('0x3c')](_0x3f5b36[_0x7167('0x59')],'in','','');this[_0x7167('0x36')]['noop'](util[_0x7167('0x24')](_0x7167('0xf7'),_0x3f5b36[_0x7167('0x59')]));var _0x326b8f=this[_0x7167('0x7d')]['sync'](this,_0x3f5b36);if(_0x326b8f){for(var _0x21f608 in _0x326b8f){if(_0x326b8f[_0x7167('0x92')](_0x21f608)){if(_0x21f608!==_0x7167('0xf8')){this[_0x7167('0x36')][_0x7167('0x9b')](util['format'](_0x7167('0xe9'),_0x21f608['toUpperCase']()),_0x326b8f[_0x21f608]);}}}this[_0x7167('0x3c')](_0x326b8f[_0x7167('0xea')],'out',_0x7167('0xee'),_0x326b8f[_0x7167('0xf8')]);return this['channel'][_0x7167('0xac')](util['format']('DialogflowV2\x20Result\x20%s',_0x326b8f[_0x7167('0xea')]));}return this[_0x7167('0x36')][_0x7167('0x27')](_0x3f5b36,_0x7167('0xf9'));};AGIVertices[_0x7167('0xd')]['sesteknda']=function(_0x3007d7){logger[_0x7167('0x29')](util[_0x7167('0x24')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x3007d7[_0x7167('0x34')]));if(!this[_0x7167('0xa3')](_0x3007d7[_0x7167('0xfa')])){return this[_0x7167('0x36')][_0x7167('0xac')]('no\x20ndauth\x20url\x20configured');}if(!this[_0x7167('0xa3')](_0x3007d7[_0x7167('0xfb')])){return this[_0x7167('0x36')]['noop'](_0x7167('0xfc'));}if(!this[_0x7167('0xa3')](_0x3007d7[_0x7167('0xfd')])){return this['channel'][_0x7167('0xac')](_0x7167('0xfe'));}if(!this['isConfigured'](_0x3007d7['ndassistant_url'])){return this['channel'][_0x7167('0xac')](_0x7167('0xa7'));}this[_0x7167('0x36')][_0x7167('0xe7')]=!![];this[_0x7167('0x32')](_0x3007d7);this[_0x7167('0x3c')](_0x3007d7[_0x7167('0x59')],'in','','');this['channel'][_0x7167('0xac')](util[_0x7167('0x24')](_0x7167('0xff'),_0x3007d7['text']));var _0x3abf22=this['sestekNDA'][_0x7167('0x70')](this,_0x3007d7);if(_0x3abf22){for(var _0x3f6c4c in _0x3abf22){if(_0x3abf22[_0x7167('0x92')](_0x3f6c4c)){this[_0x7167('0x36')][_0x7167('0x9b')](util[_0x7167('0x24')](_0x7167('0x100'),_0x3f6c4c[_0x7167('0x6a')]()),_0x3abf22[_0x3f6c4c]);}}this['createSquareMessage'](_0x3abf22[_0x7167('0xea')],'out',_0x7167('0x101'),'');if(_0x3abf22['audiofile']){this['channel'][_0x7167('0xac')](util['format']('Sestek\x20NDA\x20%s\x20file\x20created',_0x3abf22[_0x7167('0x102')]));var _0x31938d=this[_0x7167('0x36')][_0x7167('0x103')](_0x3abf22[_0x7167('0x102')]);try{fs['unlink'](_0x3abf22[_0x7167('0x102')]+_0x7167('0x104'));}catch(_0x5e9abb){logger['error'](_0x5e9abb);}return _0x31938d;}else{return this['channel'][_0x7167('0xac')](util['format'](_0x7167('0x105'),_0x3abf22[_0x7167('0xea')]));}}return this[_0x7167('0x36')][_0x7167('0x27')](_0x3007d7,_0x7167('0x106'));};AGIVertices[_0x7167('0xd')][_0x7167('0x107')]=function(_0x562a22){logger[_0x7167('0x29')](util[_0x7167('0x24')](_0x7167('0x108'),_0x562a22[_0x7167('0x34')]));return this['channel'][_0x7167('0xac')](_0x7167('0x107'));};AGIVertices[_0x7167('0xd')]['ext_dial']=function(_0xbf9f1b){logger[_0x7167('0x29')](util[_0x7167('0x24')](_0x7167('0x109'),_0xbf9f1b[_0x7167('0x34')]));var _0x2c7174='';if(_0xbf9f1b[_0x7167('0x10a')]){if(!this['isConfigured'](_0xbf9f1b[_0x7167('0x10a')])){return this[_0x7167('0x36')][_0x7167('0x27')](_0xbf9f1b,_0x7167('0x10b'));}else{var _0x160f8d=parseInt(_0xbf9f1b[_0x7167('0x10a')],0xa);if(isNaN(_0x160f8d)){_0x2c7174=_0xbf9f1b['trunk_id'];}else{_0x2c7174=this[_0x7167('0x19')][_0x7167('0x70')](this,_0xbf9f1b['trunk_id']);if(!_0x2c7174){return this['channel']['error'](_0xbf9f1b,_0x7167('0x10c'));}}}}else if(_0xbf9f1b[_0x7167('0x10d')]){_0x2c7174=_0xbf9f1b['trunk_name'];}else{return this['channel'][_0x7167('0x27')](_0xbf9f1b,_0x7167('0x10b'));}var _0x40a9c9=this[_0x7167('0x36')][_0x7167('0x54')]('DIAL',[util['format'](_0x7167('0x10e'),_0x2c7174,_0xbf9f1b[_0x7167('0x43')]),_0xbf9f1b[_0x7167('0x65')],_0xbf9f1b[_0x7167('0xe2')],_0xbf9f1b[_0x7167('0x63')]]);if(_0x40a9c9[_0x7167('0xa1')]===-0x1){return _0x40a9c9;}return this[_0x7167('0x36')][_0x7167('0xac')](util[_0x7167('0x24')](_0x7167('0xe3'),_0x7167('0xe0')));};AGIVertices['prototype']['finally']=function(_0x388b05){logger['info'](util[_0x7167('0x24')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x388b05[_0x7167('0x34')]));return this[_0x7167('0x36')][_0x7167('0xac')](_0x7167('0x10f'));};AGIVertices[_0x7167('0xd')][_0x7167('0xa')]=function(_0x299c13){logger['info'](util[_0x7167('0x24')](_0x7167('0x110'),_0x299c13[_0x7167('0x34')]));if(_0x299c13['retry']===0x0){return this[_0x7167('0xa4')](_0x299c13);}_0x299c13[_0x7167('0xa5')]-=0x1;if(!this[_0x7167('0xa3')](_0x299c13['file_id'])){return this[_0x7167('0x36')][_0x7167('0x27')](_0x299c13,'no\x20file\x20audio\x20selected');}var _0x238cbd=this['getSound'][_0x7167('0x70')](this,_0x299c13[_0x7167('0x111')]);if(!_0x238cbd){return this['channel'][_0x7167('0x27')](_0x299c13,_0x7167('0x112'));}if(!this[_0x7167('0xa3')](_0x299c13[_0x7167('0x113')])){return this[_0x7167('0x36')][_0x7167('0x27')](_0x7167('0x114'));}var _0x140598=this[_0x7167('0x36')]['getData'](_0x238cbd,_0x299c13[_0x7167('0x115')],_0x299c13[_0x7167('0x116')]);var _0x45574d=_0x140598[_0x7167('0xa1')]?_0x140598['result'][_0x7167('0x48')]():'';logger['info'](_0x7167('0x117'),JSON['stringify'](_0x140598));if(_0x140598[_0x7167('0xa1')]===-0x1){this[_0x7167('0x32')][_0x7167('0x70')](this,_0x299c13,_0x45574d);return _0x140598;}else if(_0x140598[_0x7167('0x9f')]===_0x7167('0x65')){_0x140598[_0x7167('0xa1')]=_0x45574d[_0x7167('0x97')]>=parseInt(_0x299c13[_0x7167('0x118')])?'x':'i';}else{_0x140598[_0x7167('0xa1')]=_0x45574d['length']>=parseInt(_0x299c13[_0x7167('0x118')])&&_0x45574d[_0x7167('0x97')]<=parseInt(_0x299c13[_0x7167('0x116')])?'x':'i';}var _0xc9f141=this[_0x7167('0xe')]['sync'](this,_0x299c13[_0x7167('0x113')]);if(!_0xc9f141){return this[_0x7167('0x36')][_0x7167('0x27')](_0x299c13,_0x7167('0x119'));}this['channel'][_0x7167('0x9b')](_0xc9f141,_0x45574d);if(this[_0x7167('0xa3')](_0x299c13['hiddendigitsnum'])){var _0x2bd95b=parseInt(_0x299c13['hiddendigitsnum'],0xa);var _0x2baf75=rs[_0x7167('0x11a')]({'charset':'*','length':_0x2bd95b});var _0x3252bd=_0x45574d[_0x7167('0x97')];if(_0x3252bd>0x0){if(_0x3252bd>_0x2bd95b){this[_0x7167('0x32')][_0x7167('0x70')](this,_0x299c13,_0x299c13[_0x7167('0x11b')]===_0x7167('0x11c')?_0x2baf75+_0x45574d[_0x7167('0x11d')](_0x2bd95b):_0x45574d[_0x7167('0x11d')](0x0,_0x3252bd-_0x2bd95b)+_0x2baf75);}else{this[_0x7167('0x32')]['sync'](this,_0x299c13,rs[_0x7167('0x11a')]({'charset':'*','length':_0x3252bd}));}}else{this[_0x7167('0x32')][_0x7167('0x70')](this,_0x299c13,'');}}else{this['createSquareDetailsReport'][_0x7167('0x70')](this,_0x299c13,_0x45574d);}return _0x140598;};AGIVertices[_0x7167('0xd')][_0x7167('0xb')]=function(_0x2c76bd){logger['info'](util[_0x7167('0x24')](_0x7167('0x11e'),_0x2c76bd[_0x7167('0x34')]));return this['getdigits'](_0x2c76bd);};AGIVertices[_0x7167('0xd')][_0x7167('0x11f')]=function(_0x4e2bc0){logger['info'](util[_0x7167('0x24')](_0x7167('0x120'),_0x4e2bc0[_0x7167('0x34')]));this['createSquareDetailsReport'][_0x7167('0x70')](this,_0x4e2bc0,_0x4e2bc0['goalname']);return this[_0x7167('0x36')][_0x7167('0xac')](util['format'](_0x7167('0x121'),_0x4e2bc0[_0x7167('0x122')]));};AGIVertices[_0x7167('0xd')]['awspolly']=function(_0x230499){logger[_0x7167('0x29')](util['format'](_0x7167('0x123'),_0x230499['label']));if(!this[_0x7167('0xa3')](_0x230499[_0x7167('0x86')])||!this['isConfigured'](_0x230499[_0x7167('0x87')])){return this['channel'][_0x7167('0xac')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x7167('0xa3')](_0x230499[_0x7167('0x59')])){return this['channel'][_0x7167('0xac')](_0x7167('0xa7'));}this[_0x7167('0x36')][_0x7167('0xac')](util[_0x7167('0x24')](_0x7167('0x124'),_0x230499['text']));var _0x42bb23=this[_0x7167('0x85')][_0x7167('0x70')](this,_0x230499);if(_0x42bb23){this[_0x7167('0x36')][_0x7167('0xac')](util[_0x7167('0x24')]('aws\x20Polly\x20%s\x20file\x20created',_0x42bb23));var _0x5be432=this[_0x7167('0x36')][_0x7167('0x103')](_0x42bb23);try{fs[_0x7167('0x125')](_0x42bb23+_0x7167('0x104'));}catch(_0x106097){logger[_0x7167('0x27')](_0x106097);}return _0x5be432;}return this['channel'][_0x7167('0x27')](_0x230499,_0x7167('0x126'));};AGIVertices[_0x7167('0xd')][_0x7167('0x127')]=function(_0x288ee3){logger['info'](util[_0x7167('0x24')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x288ee3['label']));if(!this[_0x7167('0xa3')](_0x288ee3[_0x7167('0x86')])||!this[_0x7167('0xa3')](_0x288ee3[_0x7167('0x87')])){return this['channel'][_0x7167('0xac')](_0x7167('0x128'));}if(!this[_0x7167('0xa3')](_0x288ee3[_0x7167('0x8d')])){return this[_0x7167('0x36')][_0x7167('0xac')](_0x7167('0x129'));}if(!this[_0x7167('0xa3')](_0x288ee3[_0x7167('0x59')])){return this[_0x7167('0x36')][_0x7167('0xac')](_0x7167('0xa7'));}this[_0x7167('0x36')]['bot']=!![];this[_0x7167('0x32')](_0x288ee3);this['createSquareMessage'](_0x288ee3['text'],'in','','');this[_0x7167('0x36')][_0x7167('0xac')](util[_0x7167('0x24')](_0x7167('0x12a'),_0x288ee3[_0x7167('0x59')]));var _0x9261fd=this[_0x7167('0x8b')]['sync'](this,_0x288ee3);if(_0x9261fd){for(var _0x257d36 in _0x9261fd){if(_0x9261fd[_0x7167('0x92')](_0x257d36)&&_['isString'](_0x9261fd[_0x257d36])){this[_0x7167('0x36')]['setVariable'](util[_0x7167('0x24')](_0x7167('0x12b'),_0x257d36[_0x7167('0x6a')]()),_0x9261fd[_0x257d36]);}}if(_[_0x7167('0x3f')](_0x9261fd[_0x7167('0x78')])){return this[_0x7167('0x36')][_0x7167('0xac')](_0x7167('0x12c'));}else{this['createSquareMessage'](_0x9261fd['message'],_0x7167('0xeb'),'amazonlex','');return this[_0x7167('0x36')][_0x7167('0xac')](util[_0x7167('0x24')](_0x7167('0x12d'),_0x9261fd[_0x7167('0x78')]));}}return this[_0x7167('0x36')]['error'](_0x288ee3,_0x7167('0x12e'));};AGIVertices[_0x7167('0xd')][_0x7167('0x12f')]=function(_0x4c718e){logger[_0x7167('0x29')](util[_0x7167('0x24')](_0x7167('0x130'),_0x4c718e[_0x7167('0x34')],_0x4c718e[_0x7167('0x65')]));if(!this[_0x7167('0xa3')](_0x4c718e[_0x7167('0x80')])){return this[_0x7167('0x36')]['noop'](_0x7167('0xe6'));}var _0x530f1d=_0x7167('0x131');var _0xf06a54=util[_0x7167('0x24')](_0x7167('0x132'),FILES_PATH,rs['generate'](0x4));var _0x138d3c=util['format'](_0x7167('0x9a'),_0xf06a54,_0x530f1d);var _0x3267ce=!![];if(_0x4c718e[_0x7167('0x133')]===_0x7167('0x134')){_0x3267ce=![];}var _0x1fa4c8=this[_0x7167('0x36')][_0x7167('0x135')](_0xf06a54,_0x530f1d,_0x4c718e[_0x7167('0x136')],_0x4c718e['timeout'],undefined,_0x3267ce);if(_0x1fa4c8[_0x7167('0xa1')]!==-0x1){this[_0x7167('0x36')][_0x7167('0xac')](util[_0x7167('0x24')]('google\x20%s\x20file\x20created',_0x138d3c));var _0x3e0825=this[_0x7167('0x8e')]['sync'](this,_0x4c718e,_0x138d3c);if(_0x3e0825){for(var _0x31af84 in _0x3e0825){if(_0x3e0825[_0x7167('0x92')](_0x31af84)){this[_0x7167('0x36')][_0x7167('0x9b')](util['format'](_0x7167('0x137'),_0x31af84[_0x7167('0x6a')]()),_0x3e0825[_0x31af84]);}}return this['channel'][_0x7167('0xac')](util[_0x7167('0x24')](_0x7167('0x138'),JSON['stringify'](_0x3e0825)));}}return _0x1fa4c8;};AGIVertices['prototype'][_0x7167('0x139')]=function(_0x128f4b){logger[_0x7167('0x29')](util[_0x7167('0x24')](_0x7167('0x13a'),_0x128f4b[_0x7167('0x34')]));if(!this[_0x7167('0xa3')](_0x128f4b[_0x7167('0x90')])){return this[_0x7167('0x36')][_0x7167('0xac')](_0x7167('0x13b'));}if(!this[_0x7167('0xa3')](_0x128f4b[_0x7167('0x13c')])){return this[_0x7167('0x36')][_0x7167('0xac')](_0x7167('0x13d'));}var _0x17833e='wav';var _0x1ed908=util[_0x7167('0x24')](_0x7167('0x132'),FILES_PATH,rs[_0x7167('0x11a')](0x4));var _0x5c79b9=util[_0x7167('0x24')](_0x7167('0x9a'),_0x1ed908,_0x17833e);var _0x3f0227=!![];if(_0x128f4b[_0x7167('0x133')]===_0x7167('0x134')){_0x3f0227=![];}var _0xc02a23=this[_0x7167('0x36')][_0x7167('0x135')](_0x1ed908,_0x17833e,_0x128f4b[_0x7167('0x136')],_0x128f4b[_0x7167('0x65')],undefined,_0x3f0227);if(_0xc02a23[_0x7167('0xa1')]!==-0x1){this[_0x7167('0x36')]['noop'](util['format'](_0x7167('0x13e'),_0x5c79b9));var _0x5b8040=this[_0x7167('0x8f')][_0x7167('0x70')](this,_0x128f4b,_0x5c79b9);if(_0x5b8040){for(var _0x451edf in _0x5b8040){if(_0x5b8040['hasOwnProperty'](_0x451edf)){this[_0x7167('0x36')]['setVariable'](util[_0x7167('0x24')](_0x7167('0x13f'),_0x451edf['toUpperCase']()),_0x5b8040[_0x451edf]);}}return this[_0x7167('0x36')][_0x7167('0xac')](util[_0x7167('0x24')](_0x7167('0x140'),JSON[_0x7167('0x74')](_0x5b8040)));}}return _0xc02a23;};AGIVertices[_0x7167('0xd')][_0x7167('0x141')]=function(_0x5ad110){logger[_0x7167('0x29')](util[_0x7167('0x24')](_0x7167('0x142'),_0x5ad110[_0x7167('0x34')]));return this[_0x7167('0x36')][_0x7167('0x143')](_0x5ad110[_0x7167('0x144')],_0x5ad110[_0x7167('0x39')],_0x5ad110[_0x7167('0x3a')]);};AGIVertices['prototype']['gotoif']=function(_0x28ea96){logger['info'](util[_0x7167('0x24')](_0x7167('0x145'),_0x28ea96['label']));if(!this[_0x7167('0xa3')](_0x28ea96['condition'])){return this[_0x7167('0x36')][_0x7167('0x27')](_0x28ea96,_0x7167('0x146'));}try{var _0x47e0db=eval(_0x28ea96[_0x7167('0x147')])?_0x7167('0x148'):_0x7167('0x149');this[_0x7167('0x36')][_0x7167('0xac')](util[_0x7167('0x24')](_0x7167('0x14a'),_0x28ea96['condition'],_0x47e0db));return{'code':0xc8,'result':_0x47e0db};}catch(_0x5de74f){return{'code':0xc8,'result':_0x7167('0x149')};}};AGIVertices[_0x7167('0xd')][_0x7167('0x14b')]=function(_0x1ccdbc){logger[_0x7167('0x29')](util[_0x7167('0x24')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x1ccdbc[_0x7167('0x34')]));if(!this[_0x7167('0xa3')](_0x1ccdbc[_0x7167('0x14c')])){return this[_0x7167('0x36')][_0x7167('0x27')](_0x1ccdbc,'no\x20interval\x20configured');}var _0x3cab6c=this['getIntervals'][_0x7167('0x70')](this,_0x1ccdbc[_0x7167('0x14c')]);if(!_0x3cab6c){return this[_0x7167('0x36')]['error'](_0x1ccdbc,_0x7167('0x14d'));}for(var _0x4bbc4b=0x0;_0x4bbc4b<_0x3cab6c[_0x7167('0x97')];_0x4bbc4b+=0x1){var _0x5b206f=this[_0x7167('0x36')]['getVariable'](util[_0x7167('0x24')](_0x7167('0x14e'),_0x3cab6c[_0x4bbc4b]));if(_0x5b206f[_0x7167('0xa1')]===-0x1){return _0x5b206f;}logger['info'](util[_0x7167('0x24')]('IFTIME\x20%s\x20%s',_0x3cab6c[_0x4bbc4b],_0x5b206f['extra']));if(_0x5b206f[_0x7167('0x9f')]==='true'){logger[_0x7167('0x29')](util[_0x7167('0x24')](_0x7167('0x14f'),_0x3cab6c[_0x4bbc4b],_0x7167('0x148')));this['channel'][_0x7167('0xac')](util[_0x7167('0x24')]('IFTIME\x20%s\x20%s',_0x3cab6c[_0x4bbc4b],_0x7167('0x148')));return{'code':0xc8,'result':_0x7167('0x148')};}else{logger[_0x7167('0x29')](util[_0x7167('0x24')]('IFTIME\x20%s\x20%s',_0x3cab6c[_0x4bbc4b],_0x7167('0x149')));this[_0x7167('0x36')]['noop'](util[_0x7167('0x24')]('IFTIME\x20%s\x20%s',_0x3cab6c[_0x4bbc4b],_0x7167('0x149')));}}return{'code':0xc8,'result':_0x7167('0x149')};};AGIVertices[_0x7167('0xd')][_0x7167('0x150')]=function(_0x28950d){logger[_0x7167('0x29')](util[_0x7167('0x24')](_0x7167('0x151'),_0x28950d[_0x7167('0x34')]));return this[_0x7167('0x36')][_0x7167('0x150')]();};AGIVertices[_0x7167('0xd')][_0x7167('0x152')]=function(_0x5944b7){logger[_0x7167('0x29')](util[_0x7167('0x24')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x5944b7[_0x7167('0x34')]));if(!this[_0x7167('0xa3')](_0x5944b7[_0x7167('0x80')])){return this[_0x7167('0x36')][_0x7167('0xac')](_0x7167('0xe6'));}var _0x1c2cdb='wav';var _0x3894c9=util[_0x7167('0x24')](_0x7167('0x132'),FILES_PATH,rs[_0x7167('0x11a')](0x4));var _0x104ce1=util['format'](_0x7167('0x9a'),_0x3894c9,_0x1c2cdb);var _0x2ccb6a=!![];if(_0x5944b7[_0x7167('0x133')]===_0x7167('0x134')){_0x2ccb6a=![];}var _0x2cb5ea=this[_0x7167('0x36')][_0x7167('0x135')](_0x3894c9,_0x1c2cdb,_0x5944b7['intKey'],_0x5944b7['timeout'],undefined,_0x2ccb6a);if(_0x2cb5ea[_0x7167('0xa1')]!==-0x1){this['channel'][_0x7167('0xac')](util[_0x7167('0x24')]('ispeech\x20%s\x20file\x20created',_0x104ce1));var _0x1c4065=this['ispeechASR'][_0x7167('0x70')](this,_0x5944b7,_0x104ce1);if(_0x1c4065){for(var _0x4e56d3 in _0x1c4065){if(_0x1c4065[_0x7167('0x92')](_0x4e56d3)){this[_0x7167('0x36')][_0x7167('0x9b')](util[_0x7167('0x24')](_0x7167('0x153'),_0x4e56d3[_0x7167('0x6a')]()),_0x1c4065[_0x4e56d3]);}}return this[_0x7167('0x36')]['noop'](util[_0x7167('0x24')](_0x7167('0x154'),JSON['stringify'](_0x1c4065)));}}return _0x2cb5ea;};AGIVertices['prototype'][_0x7167('0x155')]=function(_0x2a7d08){logger['info'](util[_0x7167('0x24')](_0x7167('0x156'),_0x2a7d08[_0x7167('0x34')]));if(!this[_0x7167('0xa3')](_0x2a7d08[_0x7167('0x80')])){return this[_0x7167('0x36')][_0x7167('0xac')]('no\x20key\x20configured');}if(!this[_0x7167('0xa3')](_0x2a7d08[_0x7167('0x59')])){return this[_0x7167('0x36')][_0x7167('0xac')](_0x7167('0xa7'));}this[_0x7167('0x36')][_0x7167('0xac')](util[_0x7167('0x24')]('Trying\x20ispeech\x20TTS\x20%s',_0x2a7d08[_0x7167('0x59')]));var _0x505790=this[_0x7167('0x157')]['sync'](this,_0x2a7d08);if(_0x505790){this[_0x7167('0x36')][_0x7167('0xac')](util[_0x7167('0x24')](_0x7167('0x158'),_0x505790));var _0xf6c61a=this[_0x7167('0x36')][_0x7167('0x103')](_0x505790,_0x2a7d08[_0x7167('0x136')]);try{fs[_0x7167('0x125')](_0x505790+_0x7167('0x104'));}catch(_0xe56e43){logger['error'](_0xe56e43);}return _0xf6c61a;}return this['channel'][_0x7167('0x27')](_0x2a7d08,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0x7167('0x159')]=function(_0x428c7f){logger[_0x7167('0x29')](util['format'](_0x7167('0x15a'),_0x428c7f['label']));if(!this[_0x7167('0xa3')](_0x428c7f['findBy'])){return this[_0x7167('0x36')][_0x7167('0x27')](_0x428c7f,_0x7167('0x15b'));}logger['info'](util[_0x7167('0x24')](_0x7167('0x15c'),this[_0x7167('0x36')][_0x7167('0x37')],_0x428c7f[_0x7167('0x15d')]));var _0x31f43a=this[_0x7167('0x52')][_0x7167('0x70')](this,_0x428c7f[_0x7167('0x15d')]);if(_0x31f43a){logger['info'](util['format'](_0x7167('0x15e'),this['channel']['callerid'],_0x428c7f[_0x7167('0x15d')]));this[_0x7167('0x36')]['noop'](util[_0x7167('0x24')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x7167('0x37')],_0x428c7f['findBy']));return{'code':0xc8,'result':_0x7167('0x15f')};}else{logger[_0x7167('0x29')](util[_0x7167('0x24')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x7167('0x36')][_0x7167('0x37')],_0x428c7f[_0x7167('0x15d')]));this[_0x7167('0x36')]['noop'](util[_0x7167('0x24')](_0x7167('0x160'),this[_0x7167('0x36')][_0x7167('0x37')],_0x428c7f[_0x7167('0x15d')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0x7167('0x161')]=function(_0x30ac48){logger[_0x7167('0x29')](util[_0x7167('0x24')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x30ac48['label']));if(!this[_0x7167('0xa3')](_0x30ac48[_0x7167('0x15d')])){return this['channel'][_0x7167('0x27')](_0x30ac48,_0x7167('0x15b'));}logger['info'](util[_0x7167('0x24')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x7167('0x36')]['callerid'],_0x30ac48[_0x7167('0x15d')]));var _0x3f3078=this[_0x7167('0x4e')]['sync'](this,_0x30ac48[_0x7167('0x15d')]);if(_0x3f3078){logger['info'](util[_0x7167('0x24')](_0x7167('0x15e'),this[_0x7167('0x36')][_0x7167('0x37')],_0x30ac48['findBy']));this[_0x7167('0x36')][_0x7167('0xac')](util[_0x7167('0x24')](_0x7167('0x15e'),this[_0x7167('0x36')][_0x7167('0x37')],_0x30ac48[_0x7167('0x15d')]));return{'code':0xc8,'result':_0x7167('0x15f')};}else{logger[_0x7167('0x29')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x7167('0x36')][_0x7167('0x37')],_0x30ac48[_0x7167('0x15d')]));this[_0x7167('0x36')][_0x7167('0xac')](util[_0x7167('0x24')](_0x7167('0x160'),this[_0x7167('0x36')][_0x7167('0x37')],_0x30ac48['findBy']));return{'code':0xc8,'result':_0x7167('0x162')};}};AGIVertices[_0x7167('0xd')][_0x7167('0x163')]=function(_0x6a4d25){logger[_0x7167('0x29')](util[_0x7167('0x24')](_0x7167('0x164'),_0x6a4d25[_0x7167('0x34')]));if(!this[_0x7167('0xa3')](_0x6a4d25[_0x7167('0x165')])){return this[_0x7167('0x36')][_0x7167('0x27')](_0x6a4d25,_0x7167('0x166'));}this[_0x7167('0x36')][_0x7167('0xac')](util[_0x7167('0x24')](_0x7167('0x167'),_0x6a4d25[_0x7167('0x165')]));var _0x580456=eval(_0x6a4d25[_0x7167('0x165')]);if(!this[_0x7167('0xa3')](_0x6a4d25[_0x7167('0x113')])){return this[_0x7167('0x36')][_0x7167('0xac')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x463490=this['getVariable'][_0x7167('0x70')](this,_0x6a4d25[_0x7167('0x113')]);if(!_0x463490){return this[_0x7167('0x36')][_0x7167('0x27')](_0x6a4d25,_0x7167('0x119'));}if(_[_0x7167('0x96')](_0x580456)){var _0x13d3ce=this;_0x580456[_0x7167('0x168')](function(_0x1ffe8c,_0x5babc7){_0x13d3ce[_0x7167('0x36')][_0x7167('0x9b')](util[_0x7167('0x24')](_0x7167('0x169'),_0x463490,_0x5babc7),_0x1ffe8c);});return this[_0x7167('0x36')]['noop'](util['format'](_0x7167('0x16a'),_0x463490));}else{return this[_0x7167('0x36')]['setVariable'](_0x463490,_0x580456);}};AGIVertices[_0x7167('0xd')][_0x7167('0x16b')]=function(_0x1ce1c4){logger[_0x7167('0x29')](util[_0x7167('0x24')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x1ce1c4['label']));if(_0x1ce1c4['retry']===0x0){return this['maxRetry'](_0x1ce1c4);}_0x1ce1c4[_0x7167('0xa5')]-=0x1;if(!this[_0x7167('0xa3')](_0x1ce1c4['file_id'])){return this['channel'][_0x7167('0x27')](_0x1ce1c4,_0x7167('0x16c'));}var _0x3d65a1=this[_0x7167('0x16d')]['sync'](this,_0x1ce1c4['file_id']);if(!_0x3d65a1){return this[_0x7167('0x36')]['error'](_0x1ce1c4,_0x7167('0x112'));}var _0x183f88=this['channel'][_0x7167('0x16e')](_0x3d65a1,_0x1ce1c4[_0x7167('0x115')],_0x1ce1c4[_0x7167('0x16f')]);var _0x9df17d=_0x183f88[_0x7167('0xa1')];if(_0x183f88['result']===-0x1){this[_0x7167('0x32')][_0x7167('0x70')](this,_0x1ce1c4,'-1');return _0x183f88;}else if(_0x183f88[_0x7167('0x9f')]===_0x7167('0x65')){_0x183f88[_0x7167('0xa1')]=_0x183f88[_0x7167('0xa1')][_0x7167('0x97')]>0x0?_0x183f88[_0x7167('0xa1')]:'t';}else if(_[_0x7167('0x3e')](_0x183f88['result'])){_0x183f88[_0x7167('0xa1')]='#';_0x9df17d='#';}if(!this[_0x7167('0xa3')](_0x1ce1c4['variable_id'])){this[_0x7167('0x36')][_0x7167('0xac')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x1e4f57=this[_0x7167('0xe')][_0x7167('0x70')](this,_0x1ce1c4[_0x7167('0x113')]);if(!_0x1e4f57){return this[_0x7167('0x36')][_0x7167('0x27')](_0x1ce1c4,_0x7167('0x119'));}this[_0x7167('0x36')][_0x7167('0x9b')](_0x1e4f57,_0x9df17d);}this['createSquareDetailsReport'][_0x7167('0x70')](this,_0x1ce1c4,_0x9df17d);return _0x183f88;};AGIVertices[_0x7167('0xd')][_0x7167('0xac')]=function(_0x5dc35c){logger[_0x7167('0x29')](util[_0x7167('0x24')](_0x7167('0x170'),_0x5dc35c[_0x7167('0x34')]));return this['channel'][_0x7167('0xac')](_0x5dc35c['output']||_0x5dc35c[_0x7167('0x34')]);};AGIVertices[_0x7167('0xd')][_0x7167('0x171')]=function(_0x10c618){logger['info'](util[_0x7167('0x24')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x10c618['label']));if(!this[_0x7167('0xa3')](_0x10c618[_0x7167('0x15d')])){return this['channel'][_0x7167('0x27')](_0x10c618,_0x7167('0x15b'));}logger[_0x7167('0x29')](util[_0x7167('0x24')](_0x7167('0x15c'),this[_0x7167('0x36')][_0x7167('0x37')],_0x10c618[_0x7167('0x15d')]));var _0x15d55b=this[_0x7167('0x172')][_0x7167('0x70')](this,_0x10c618[_0x7167('0x173')]);var _0x4a3215=this['agentPause']['sync'](this,_0x10c618[_0x7167('0x15d')],_0x15d55b);if(_0x4a3215){logger[_0x7167('0x29')](util[_0x7167('0x24')](_0x7167('0x15e'),this[_0x7167('0x36')][_0x7167('0x37')],_0x10c618['findBy']));this['channel']['noop'](util[_0x7167('0x24')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x7167('0x37')],_0x10c618[_0x7167('0x15d')]));return{'code':0xc8,'result':_0x7167('0x15f')};}else{logger[_0x7167('0x29')](util[_0x7167('0x24')](_0x7167('0x160'),this['channel']['callerid'],_0x10c618[_0x7167('0x15d')]));this[_0x7167('0x36')]['noop'](util[_0x7167('0x24')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x7167('0x36')][_0x7167('0x37')],_0x10c618[_0x7167('0x15d')]));return{'code':0xc8,'result':_0x7167('0x162')};}};AGIVertices[_0x7167('0xd')][_0x7167('0x174')]=function(_0x161e61){logger['info'](util['format']('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x161e61[_0x7167('0x34')]));if(!this[_0x7167('0xa3')](_0x161e61[_0x7167('0x111')])){return this[_0x7167('0x36')][_0x7167('0x27')](_0x161e61,_0x7167('0x16c'));}var _0xebe1bf=this[_0x7167('0x16d')][_0x7167('0x70')](this,_0x161e61[_0x7167('0x111')]);if(!_0xebe1bf){return this[_0x7167('0x36')][_0x7167('0x27')](_0x161e61,_0x7167('0x112'));}var _0x6f4717=this[_0x7167('0x36')][_0x7167('0x54')](_0x7167('0x175'),[_0xebe1bf,_0x161e61[_0x7167('0xe2')]]);if(_0x6f4717[_0x7167('0xa1')]===-0x1){return _0x6f4717;}return this[_0x7167('0x36')]['noop'](util[_0x7167('0x24')](_0x7167('0xc4'),_0x7167('0x175'),_0xebe1bf));};AGIVertices[_0x7167('0xd')][_0x7167('0x176')]=function(_0x2c3804){logger[_0x7167('0x29')](util['format'](_0x7167('0x177'),_0x2c3804['label']));if(!this['isConfigured'](_0x2c3804[_0x7167('0x178')])){return this[_0x7167('0x36')][_0x7167('0x27')](_0x2c3804,_0x7167('0x179'));}var _0x61dae3='';var _0xefa2af=parseInt(_0x2c3804[_0x7167('0x178')],0xa);if(isNaN(_0xefa2af)){_0x61dae3=_0x2c3804[_0x7167('0x178')];}else{_0x61dae3=this['getVoiceQueue']['sync'](this,_0x2c3804['queue_id']);if(!_0x61dae3){return this[_0x7167('0x36')][_0x7167('0x27')](_0x2c3804,_0x7167('0x17a'));}}var _0x32ce64='';if(this['isConfigured'](_0x2c3804[_0x7167('0x111')])){var _0x390a2e=this[_0x7167('0x16d')]['sync'](this,_0x2c3804[_0x7167('0x111')]);if(_0x390a2e){_0x32ce64=_0x390a2e;}}this[_0x7167('0x32')][_0x7167('0x70')](this,_0x2c3804,_0x61dae3);if(_0x2c3804[_0x7167('0xe2')][_0x7167('0x17b')]('x')<0x0){_0x2c3804[_0x7167('0xe2')]+='x';}if(_0x2c3804['opts']['indexOf']('X')<0x0){_0x2c3804[_0x7167('0xe2')]+='X';}this[_0x7167('0x36')]['setVariable'](_0x7167('0x17c'),_0x61dae3?_0x61dae3['toLowerCase']():'');var _0x475a2b=this[_0x7167('0x36')][_0x7167('0x54')](_0x7167('0x17d'),[_0x61dae3,_0x2c3804[_0x7167('0xe2')],_0x2c3804[_0x7167('0x63')],_0x32ce64,_0x2c3804[_0x7167('0x65')],_0x2c3804[_0x7167('0xb4')],_0x2c3804[_0x7167('0x17e')],_0x2c3804[_0x7167('0x17f')],'',_0x2c3804[_0x7167('0x180')]]);if(_0x475a2b['result']===-0x1){return _0x475a2b;}return this[_0x7167('0x36')][_0x7167('0xac')](util[_0x7167('0x24')](_0x7167('0xc4'),_0x7167('0x17d'),_0x61dae3));};AGIVertices['prototype']['record']=function(_0x54e6e1){logger[_0x7167('0x29')](util[_0x7167('0x24')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x54e6e1[_0x7167('0x34')]));var _0xf9af5d=_0x54e6e1[_0x7167('0x181')]||_0x7167('0x131');var _0x1d32af=util[_0x7167('0x24')](_0x7167('0x182'),this[_0x7167('0x36')][_0x7167('0x33')],rs[_0x7167('0x11a')](0x5));var _0x474fa2=util[_0x7167('0x24')](_0x7167('0x183'),FILES_PATH,_0x1d32af,_0xf9af5d);var _0xe3d4d0=util[_0x7167('0x24')](_0x7167('0x132'),FILES_PATH,_0x1d32af);this[_0x7167('0x38')][_0x7167('0x70')](this,_0x54e6e1,_0x1d32af,_0x474fa2);this[_0x7167('0x36')][_0x7167('0x9b')](_0x7167('0x184'),_0x1d32af);logger[_0x7167('0x29')](_0x7167('0x185'),_0xe3d4d0,_0xf9af5d,_0x54e6e1[_0x7167('0x186')],_0x54e6e1[_0x7167('0x65')]);return this[_0x7167('0x36')][_0x7167('0x135')](_0xe3d4d0,_0xf9af5d,_0x54e6e1[_0x7167('0x186')],_0x54e6e1[_0x7167('0x65')],undefined,!![]);};AGIVertices[_0x7167('0xd')]['restapi']=function(_0x269b05){logger[_0x7167('0x29')](util[_0x7167('0x24')](_0x7167('0x187'),_0x269b05['label']));if(!this['isConfigured'](_0x269b05[_0x7167('0x63')])){return this[_0x7167('0x36')][_0x7167('0xac')]('no\x20url\x20configured');}var _0x4ef179=this[_0x7167('0x62')][_0x7167('0x70')](this,_0x269b05);logger[_0x7167('0x29')](util[_0x7167('0x24')](_0x7167('0x188'),util['inspect'](_0x4ef179,{'showHidden':![],'depth':null})));if(!this[_0x7167('0xa3')](_0x269b05[_0x7167('0x113')])){return this['channel'][_0x7167('0xac')](_0x7167('0x189'));}var _0x200705=this[_0x7167('0xe')]['sync'](this,_0x269b05[_0x7167('0x113')]);if(!_0x200705){return this[_0x7167('0x36')][_0x7167('0x27')](_0x269b05,_0x7167('0x119'));}this[_0x7167('0x36')][_0x7167('0x9b')](util[_0x7167('0x24')](_0x7167('0x18a'),_0x200705),_0x4ef179['statusCode']?_0x4ef179[_0x7167('0x76')]:_0x7167('0x18b'));this[_0x7167('0x36')][_0x7167('0x9b')](util['format'](_0x7167('0x18c'),_0x200705),_0x4ef179['statusMessage']?_0x4ef179[_0x7167('0x77')]:'OK');if(_0x4ef179[_0x7167('0x6b')]){try{this[_0x7167('0x99')](_0x4ef179[_0x7167('0x6b')],_0x200705);}catch(_0x5df87c){logger['error'](util[_0x7167('0x24')](_0x7167('0x18d'),_0x200705));}}return this[_0x7167('0x36')]['noop'](util[_0x7167('0x24')](_0x7167('0xd9'),_0x200705));};AGIVertices[_0x7167('0xd')][_0x7167('0x18e')]=function(_0x4d3930){logger['info'](util['format'](_0x7167('0x18f'),_0x4d3930[_0x7167('0x34')]));return this['channel'][_0x7167('0x190')](_0x4d3930[_0x7167('0x191')]['replace'](/\s+/g,''),_0x4d3930[_0x7167('0x186')]);};AGIVertices[_0x7167('0xd')][_0x7167('0x192')]=function(_0x51b1db){logger['info'](util[_0x7167('0x24')](_0x7167('0x193'),_0x51b1db['label']));return this[_0x7167('0x36')][_0x7167('0x194')](_0x51b1db[_0x7167('0x66')][_0x7167('0x55')](/\s+/g,''),_0x51b1db[_0x7167('0x186')]);};AGIVertices[_0x7167('0xd')]['sayphonetic']=function(_0x508ae3){logger[_0x7167('0x29')](util[_0x7167('0x24')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x508ae3[_0x7167('0x34')]));return this[_0x7167('0x36')][_0x7167('0x195')](_0x508ae3[_0x7167('0x59')],_0x508ae3[_0x7167('0x186')]);};AGIVertices['prototype'][_0x7167('0x196')]=function(_0x5b6282){logger[_0x7167('0x29')](util[_0x7167('0x24')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x5b6282[_0x7167('0x34')]));if(!this[_0x7167('0xa3')](_0x5b6282[_0x7167('0x197')])){return this[_0x7167('0x36')][_0x7167('0xac')](_0x7167('0x198'));}var _0x3674f6=this[_0x7167('0x1d')]['sync'](this,_0x5b6282['account_id']);if(!_0x3674f6||!_0x3674f6[_0x7167('0x199')]){return this[_0x7167('0x36')]['error'](_0x5b6282,_0x7167('0x19a'));}var _0x44750d={'from':util[_0x7167('0x24')](_0x7167('0x19b'),_0x3674f6[_0x7167('0x12')],_0x3674f6[_0x7167('0x19c')]||_0x3674f6[_0x7167('0x199')][_0x7167('0x19d')]),'to':_0x5b6282['to']||'','cc':_0x5b6282['cc']||'','bcc':_0x5b6282[_0x7167('0x19e')]||'','subject':_0x5b6282[_0x7167('0x19f')],'html':_0x5b6282['text'],'text':_0x5b6282['text']};var _0x1cddc0={'tls':{'rejectUnauthorized':![]}};if(_0x3674f6[_0x7167('0x199')][_0x7167('0x1a0')]){_0x1cddc0[_0x7167('0x1a0')]=_0x3674f6[_0x7167('0x199')][_0x7167('0x1a0')];}else{_0x1cddc0[_0x7167('0x1a1')]=_0x3674f6[_0x7167('0x199')][_0x7167('0x1a1')];_0x1cddc0[_0x7167('0x1a2')]=_0x3674f6[_0x7167('0x199')]['port'];_0x1cddc0[_0x7167('0x1a3')]=_0x3674f6[_0x7167('0x199')][_0x7167('0x1a3')];}if(_0x3674f6[_0x7167('0x199')][_0x7167('0x1a4')]){_0x1cddc0[_0x7167('0x1a5')]={'user':_0x3674f6[_0x7167('0x199')]['user'],'pass':_0x3674f6[_0x7167('0x199')][_0x7167('0x1a6')]};}if(this[_0x7167('0xa3')](_0x5b6282[_0x7167('0x1a7')])){}logger[_0x7167('0x1a8')](_0x7167('0x1a9'),JSON[_0x7167('0x74')](_0x44750d));this[_0x7167('0x32')]['sync'](this,_0x5b6282,_0x5b6282[_0x7167('0x197')]);this[_0x7167('0x36')][_0x7167('0xac')](util['format']('Trying\x20SendMail\x20with\x20account\x20%s',_0x3674f6['name']));this['sendMailMessage'][_0x7167('0x70')](this,_0x1cddc0,_0x44750d);return this[_0x7167('0x36')][_0x7167('0xac')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x7167('0xd')][_0x7167('0x1aa')]=function(_0x4be15f){logger[_0x7167('0x29')](util[_0x7167('0x24')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x4be15f[_0x7167('0x34')]));return this['channel']['noop'](_0x7167('0x1ab'));};AGIVertices[_0x7167('0xd')][_0x7167('0x1ac')]=function(_0x4e746c){logger[_0x7167('0x29')](util[_0x7167('0x24')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x4e746c[_0x7167('0x34')]));if(!this[_0x7167('0xa3')](_0x4e746c['sms_account_id'])){return this[_0x7167('0x36')][_0x7167('0xac')]('no\x20sms\x20account\x20configured');}var _0x545c7c=this['getSmsAccount'][_0x7167('0x70')](this,_0x4e746c[_0x7167('0x1ad')]);if(!_0x545c7c){return this['channel'][_0x7167('0x27')](_0x4e746c,_0x7167('0x1ae'));}var _0x41529e={'body':_0x4e746c[_0x7167('0x1af')],'phone':_0x4e746c['to']||'','SmsAccountId':_0x545c7c['id']};logger['debug'](_0x7167('0x1b0'),JSON[_0x7167('0x74')](_0x41529e));this[_0x7167('0x32')]['sync'](this,_0x4e746c,_0x4e746c[_0x7167('0x1ad')]);this[_0x7167('0x36')][_0x7167('0xac')](util[_0x7167('0x24')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x545c7c[_0x7167('0x12')]));this[_0x7167('0x31')][_0x7167('0x70')](this,_0x41529e);return this[_0x7167('0x36')]['noop'](_0x7167('0x1b1'));};AGIVertices['prototype'][_0x7167('0x1b2')]=function(_0x1cf198){logger[_0x7167('0x29')](util[_0x7167('0x24')](_0x7167('0x1b3'),_0x1cf198[_0x7167('0x34')]));if(!this[_0x7167('0xa3')](_0x1cf198[_0x7167('0x113')])){return this[_0x7167('0x36')][_0x7167('0x27')](_0x1cf198,'no\x20variable\x20selected');}var _0x57db54=this[_0x7167('0xe')]['sync'](this,_0x1cf198[_0x7167('0x113')]);if(!_0x57db54){return this[_0x7167('0x36')][_0x7167('0x27')](_0x1cf198,_0x7167('0x119'));}return this[_0x7167('0x36')]['setVariable'](_0x57db54,_0x1cf198[_0x7167('0x1b4')]);};AGIVertices['prototype'][_0x7167('0x1b5')]=function(_0x4544d8){logger[_0x7167('0x29')](util[_0x7167('0x24')](_0x7167('0x1b6'),_0x4544d8[_0x7167('0x34')]));this[_0x7167('0x36')][_0x7167('0xac')]('START\x20CALLY\x20SQUARE');if(_0x4544d8[_0x7167('0xb8')]===_0x7167('0x1b7')){this['channel']['noop'](_0x7167('0x1b8'));return this[_0x7167('0x36')][_0x7167('0xb8')]();}return this[_0x7167('0x36')]['noop'](_0x7167('0x1b9'));};AGIVertices['prototype']['subproject']=function(_0x5cebea){logger['info'](util[_0x7167('0x24')](_0x7167('0x1ba'),_0x5cebea[_0x7167('0x34')]));if(!this[_0x7167('0xa3')](_0x5cebea[_0x7167('0x1bb')])){return this['channel'][_0x7167('0x27')](_0x5cebea,_0x7167('0x1bc'));}var _0x5d6b54=this[_0x7167('0x15')][_0x7167('0x70')](this,_0x5cebea[_0x7167('0x1bb')]);if(!this['isConfigured'](_0x5d6b54)){return this[_0x7167('0x36')][_0x7167('0x27')](_0x5cebea,util[_0x7167('0x24')](_0x7167('0x1bd'),_0x5cebea[_0x7167('0x1bb')]));}if(_0x5d6b54===this[_0x7167('0x36')][_0x7167('0x1be')]){return this[_0x7167('0x36')][_0x7167('0x27')](_0x5cebea,_0x7167('0x1bf'));}this[_0x7167('0x32')][_0x7167('0x70')](this,_0x5cebea,_0x5d6b54);var _0x1e999f=this[_0x7167('0x36')][_0x7167('0x54')](_0x7167('0x1c0'),util[_0x7167('0x24')](_0x7167('0x1c1'),config['agi'][_0x7167('0x1a1')]||'127.0.0.1',_0x5d6b54,this['channel']['arg_1']));if(_0x1e999f[_0x7167('0xa1')]===-0x1){return _0x1e999f;}return this[_0x7167('0x36')][_0x7167('0xac')](util[_0x7167('0x24')](_0x7167('0xc4'),_0x7167('0x1c0'),_0x5d6b54));};AGIVertices[_0x7167('0xd')]['system']=function(_0x3a0a3e){logger[_0x7167('0x29')](util[_0x7167('0x24')](_0x7167('0x1c2'),_0x3a0a3e[_0x7167('0x34')]));var _0x4fcc0e=this[_0x7167('0x53')][_0x7167('0x70')](this,_0x3a0a3e[_0x7167('0xb6')]);this[_0x7167('0x32')][_0x7167('0x70')](this,_0x3a0a3e,_0x3a0a3e[_0x7167('0xb6')]);if(this[_0x7167('0xa3')](_0x3a0a3e['variable_id'])){var _0x98278c=this[_0x7167('0xe')][_0x7167('0x70')](this,_0x3a0a3e['variable_id']);if(_0x98278c){this[_0x7167('0x36')][_0x7167('0x9b')](_0x98278c,_0x4fcc0e);return this[_0x7167('0x36')][_0x7167('0xac')](util[_0x7167('0x24')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x3a0a3e[_0x7167('0xb6')],_0x98278c));}}return this[_0x7167('0x36')][_0x7167('0xac')](util[_0x7167('0x24')](_0x7167('0x1c3'),_0x3a0a3e['command']));};AGIVertices[_0x7167('0xd')][_0x7167('0x1c4')]=function(_0x397777){logger[_0x7167('0x29')](util[_0x7167('0x24')](_0x7167('0x1c5'),_0x397777[_0x7167('0x34')]));_0x397777[_0x7167('0x59')]=_0x397777[_0x7167('0x59')][_0x7167('0x55')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x7167('0xa3')](_0x397777[_0x7167('0x57')])){return this[_0x7167('0x36')][_0x7167('0xac')](_0x7167('0x1c6'));}if(!this[_0x7167('0xa3')](_0x397777[_0x7167('0x59')])){return this[_0x7167('0x36')][_0x7167('0xac')](_0x7167('0xa7'));}this[_0x7167('0x36')][_0x7167('0xac')](util[_0x7167('0x24')](_0x7167('0x1c7'),_0x397777[_0x7167('0x59')]));var _0x187bac=this[_0x7167('0x56')]['sync'](this,_0x397777);if(_0x187bac){this['channel'][_0x7167('0xac')](util[_0x7167('0x24')](_0x7167('0x1c8'),_0x187bac));var _0x110cff=this['channel'][_0x7167('0x103')](_0x187bac);try{fs[_0x7167('0x125')](_0x187bac+_0x7167('0x104'));}catch(_0x4c1c8b){logger[_0x7167('0x27')](_0x4c1c8b);}return _0x110cff;}return this['channel'][_0x7167('0x27')](_0x397777,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0x7167('0xd')]['tts']=function(_0x5b23ef){logger[_0x7167('0x29')](util[_0x7167('0x24')](_0x7167('0x1c9'),_0x5b23ef[_0x7167('0x34')]));_0x5b23ef['text']=_0x5b23ef[_0x7167('0x59')][_0x7167('0x55')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x7167('0xa3')](_0x5b23ef[_0x7167('0x59')])){return this[_0x7167('0x36')][_0x7167('0xac')](_0x7167('0xa7'));}this[_0x7167('0x36')][_0x7167('0xac')](util[_0x7167('0x24')]('Trying\x20Google\x20TTS\x20%s',_0x5b23ef['text']));var _0x1a6db7=this[_0x7167('0x60')][_0x7167('0x70')](this,_0x5b23ef);if(_0x1a6db7){this[_0x7167('0x36')][_0x7167('0xac')](util['format'](_0x7167('0x1ca'),_0x1a6db7));var _0x94f5df=this[_0x7167('0x36')][_0x7167('0x103')](_0x1a6db7);try{fs[_0x7167('0x125')](_0x1a6db7+'.wav');}catch(_0x224e46){logger[_0x7167('0x27')](_0x224e46);}return _0x94f5df;}return this[_0x7167('0x36')][_0x7167('0x27')](_0x5b23ef,_0x7167('0x1cb'));};AGIVertices[_0x7167('0xd')][_0x7167('0x1cc')]=function(_0x3d680b){logger[_0x7167('0x29')](util['format'](_0x7167('0x1cd'),_0x3d680b['label']));if(!this[_0x7167('0xa3')](_0x3d680b[_0x7167('0x15d')])){return this[_0x7167('0x36')]['error'](_0x3d680b,_0x7167('0x15b'));}logger[_0x7167('0x29')](util[_0x7167('0x24')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x7167('0x36')][_0x7167('0x37')],_0x3d680b[_0x7167('0x15d')]));var _0x1f0021=this['agentUnpause'][_0x7167('0x70')](this,_0x3d680b[_0x7167('0x15d')]);if(_0x1f0021){logger[_0x7167('0x29')](util[_0x7167('0x24')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x7167('0x36')]['callerid'],_0x3d680b[_0x7167('0x15d')]));this[_0x7167('0x36')][_0x7167('0xac')](util['format'](_0x7167('0x15e'),this['channel']['callerid'],_0x3d680b[_0x7167('0x15d')]));return{'code':0xc8,'result':_0x7167('0x15f')};}else{logger[_0x7167('0x29')](util[_0x7167('0x24')](_0x7167('0x160'),this[_0x7167('0x36')]['callerid'],_0x3d680b['findBy']));this['channel'][_0x7167('0xac')](util[_0x7167('0x24')](_0x7167('0x160'),this[_0x7167('0x36')][_0x7167('0x37')],_0x3d680b[_0x7167('0x15d')]));return{'code':0xc8,'result':_0x7167('0x162')};}};AGIVertices[_0x7167('0xd')]['voicemail']=function(_0x41e644){logger[_0x7167('0x29')](util[_0x7167('0x24')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x41e644[_0x7167('0x34')]));var _0x575a11=this[_0x7167('0x36')][_0x7167('0x54')](_0x7167('0x1ce'),[_0x41e644[_0x7167('0x1cf')],_0x41e644[_0x7167('0x7a')]]);if(_0x575a11[_0x7167('0xa1')]===-0x1){return _0x575a11;}return this['channel']['noop'](util[_0x7167('0x24')]('Executed\x20command\x20%s\x20%s',_0x7167('0x1ce'),_0x41e644[_0x7167('0x1cf')]));};AGIVertices['prototype'][_0x7167('0x1d0')]=function(_0xa10f2b){logger[_0x7167('0x29')](util[_0x7167('0x24')](_0x7167('0x1d1'),_0xa10f2b['label']));if(!this[_0x7167('0xa3')](_0xa10f2b[_0x7167('0x113')])){return this[_0x7167('0x36')][_0x7167('0x27')](_0xa10f2b,_0x7167('0x1d2'));}var _0x59af68=this[_0x7167('0xe')]['sync'](this,_0xa10f2b['variable_id']);if(!_0x59af68){return this['channel'][_0x7167('0x27')](_0xa10f2b,'no\x20variable\x20found');}var _0x23285b=this[_0x7167('0x36')][_0x7167('0xe')](_0x59af68);return{'code':0xc8,'result':_0x23285b[_0x7167('0x9f')]?_0x23285b[_0x7167('0x9f')]:'-'};};String['prototype']['replaceAll']=function(_0x298419,_0x19a517){return this[_0x7167('0x9d')](_0x298419)[_0x7167('0x1d3')](_0x19a517);};module['exports']=AGIVertices; \ No newline at end of file +var _0x7707=['format','getQueryOdbc','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','arg_1','createSquareRecording','calleridname','context','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','uniqueid','scheduledAt','callback_priority','getPause','agent','callerid','agentUnpause','agentLogout','internal','agentLogin','shellCommand','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','number','timeout','POST','body','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','headers','stringify','render','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','client_email','private_key','dialogflowV2_language','sestekNDA','ispeech_tts_language','speed','ispeechASR','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','aws_text_type','awsLex','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','agicommand','clone','hasOwnProperty','isString','includes','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','saveRestApiResult','%s.%s','length','setVariable','split','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','exec','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','label','no\x20grammar\x20configured','grammar','MRCPRecog','RECOG_CONFIDENCE()','RECOG_INPUT()','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','add','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','opts','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','dialogflowV2_project_id','no\x20client_email\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','toUpperCase','out','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','username','no\x20username\x20configured','no\x20password\x20configured','Trying\x20SestekNDA:\x20%s','audiofile','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20found','getData','response','maxdigit','toString','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\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','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','googleasr','%s/recordings/%s','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appsecret\x20configured','wav','beep','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','continueAt','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','true','false','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeechTTS','ispeech\x20TTS\x20is\x20unreachable','login','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','failure','math','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20selected','file_id','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','agentPause','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','queue_id','no\x20queue\x20selected','getVoiceQueue','no\x20queue\x20found','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_MESSAGE','digits','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sendMail','account_id','no\x20mail\x20account\x20configured','getMailAccount','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','service','host','port','secure','auth','pass','template_id','debug','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','sms_account_id','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','variable_value','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','project_id','no\x20subproject\x20selected','getSquareProject','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','exports','util','lodash','shelljs','odbc','randomstring','mustache','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','then','name','catch','getVoiceQueueById','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getSound','getSoundById','save_name','getMailAccountById','sendMailMessage','getIntervalById','IntervalId','interval','map','Intervals'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x7707,0x199));var _0x7770=function(_0x2dd396,_0x501104){_0x2dd396=_0x2dd396-0x0;var _0x217448=_0x7707[_0x2dd396];return _0x217448;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0x7770('0x0'));var _=require(_0x7770('0x1'));var sh=require(_0x7770('0x2'));var odbc=require(_0x7770('0x3'))();var rs=require(_0x7770('0x4'));var moment=require('moment');var Mustache=require(_0x7770('0x5'));var rp=require('request-promise');var logger=require('../../config/logger')(_0x7770('0x6'));var config=require(_0x7770('0x7'));var scripts=require(_0x7770('0x8'));var FILES_PATH=_0x7770('0x9');var recursiveMapAttributes=[_0x7770('0xa'),_0x7770('0xb')];var verticesWithRetry=[_0x7770('0xc'),_0x7770('0xd'),_0x7770('0xe')];var AGIVertices=function(_0x4b6120,_0x3ba22c,_0xa52eeb){this[_0x7770('0xf')]=_0x4b6120;this[_0x7770('0x10')]=_0x3ba22c;this[_0x7770('0x11')]=_0xa52eeb;};AGIVertices[_0x7770('0x12')][_0x7770('0x13')]=function(_0x155915,_0x178e00){this[_0x7770('0x10')]['getVariableById'](_0x155915)[_0x7770('0x14')](function(_0x3d7d1d){_0x178e00(null,_0x3d7d1d?_0x3d7d1d[_0x7770('0x15')]:![]);})[_0x7770('0x16')](function(_0x2dd19e){_0x178e00(_0x2dd19e);});};AGIVertices[_0x7770('0x12')]['getVoiceQueue']=function(_0x2b00a0,_0x67dad2){this[_0x7770('0x10')][_0x7770('0x17')](_0x2b00a0)['then'](function(_0xbce67d){_0x67dad2(null,_0xbce67d?_0xbce67d['name']:![]);})['catch'](function(_0xfed16d){_0x67dad2(_0xfed16d);});};AGIVertices[_0x7770('0x12')]['getSquareProject']=function(_0x3b8100,_0x1d9cec){this[_0x7770('0x10')][_0x7770('0x18')](_0x3b8100)[_0x7770('0x14')](function(_0x22f8ec){_0x1d9cec(null,_0x22f8ec?_0x22f8ec['name']:![]);})[_0x7770('0x16')](function(_0x39652e){_0x1d9cec(_0x39652e);});};AGIVertices['prototype'][_0x7770('0x19')]=function(_0x32cad0,_0x3916de){this['rpc'][_0x7770('0x1a')](_0x32cad0)[_0x7770('0x14')](function(_0xe2eb00){_0x3916de(null,_0xe2eb00?_0xe2eb00[_0x7770('0x1b')]:![]);})['catch'](function(_0x3eb284){_0x3916de(_0x3eb284);});};AGIVertices['prototype'][_0x7770('0x1c')]=function(_0xb3ba7e,_0x17d22d){this[_0x7770('0x10')]['getUserById'](_0xb3ba7e)[_0x7770('0x14')](function(_0x103a4e){_0x17d22d(null,_0x103a4e?_0x103a4e[_0x7770('0x15')]:![]);})['catch'](function(_0x561b62){_0x17d22d(_0x561b62);});};AGIVertices[_0x7770('0x12')]['getTrunk']=function(_0x2680be,_0x8bd85e){this['rpc']['getTrunkById'](_0x2680be)[_0x7770('0x14')](function(_0x4ae6cf){_0x8bd85e(null,_0x4ae6cf?_0x4ae6cf['name']:![]);})['catch'](function(_0x2f00cc){_0x8bd85e(_0x2f00cc);});};AGIVertices[_0x7770('0x12')][_0x7770('0x1d')]=function(_0x3e9d8e,_0x4c7787){var _0x3cc709=this;this[_0x7770('0x10')][_0x7770('0x1e')](_0x3e9d8e)[_0x7770('0x14')](function(_0x14e36d){_0x4c7787(null,_0x14e36d?_0x3cc709['getSoundPath'](_0x14e36d[_0x7770('0x1f')]):![]);})[_0x7770('0x16')](function(_0x1ef1f7){_0x4c7787(_0x1ef1f7);});};AGIVertices[_0x7770('0x12')]['getMailAccount']=function(_0x1d3a23,_0xed9fc8){this[_0x7770('0x10')][_0x7770('0x20')](_0x1d3a23)[_0x7770('0x14')](function(_0x552911){_0xed9fc8(null,_0x552911?_0x552911:![]);})[_0x7770('0x16')](function(_0x408c2e){_0xed9fc8(_0x408c2e);});};AGIVertices[_0x7770('0x12')][_0x7770('0x21')]=function(_0x3a5ac9,_0x20eaf6,_0x35405d){this[_0x7770('0x11')][_0x7770('0x21')](_0x3a5ac9,_0x20eaf6)['then'](function(){_0x35405d(null);})['catch'](function(_0x4bd52e){_0x35405d(_0x4bd52e);});};AGIVertices[_0x7770('0x12')]['getIntervals']=function(_0x1f1d91,_0x5d15b9){this[_0x7770('0x10')][_0x7770('0x22')](_0x1f1d91)[_0x7770('0x14')](function(_0x38a8d2){if(_0x38a8d2){if(_0x38a8d2[_0x7770('0x23')]){_0x5d15b9(null,[_0x38a8d2[_0x7770('0x24')]]);}else{_0x5d15b9(null,_[_0x7770('0x25')](_0x38a8d2[_0x7770('0x26')],'interval'));}}else{_0x5d15b9(null,![]);}})[_0x7770('0x16')](function(_0x2fd731){_0x5d15b9(_0x2fd731);});};AGIVertices[_0x7770('0x12')]['getSoundPath']=function(_0x5626d8){return util[_0x7770('0x27')]('%s/sounds/converted/%s',FILES_PATH,_0x5626d8);};AGIVertices[_0x7770('0x12')][_0x7770('0x28')]=function(_0x458202,_0x2c62e4,_0x44e3f1){odbc['open'](_0x458202,function(_0x243f59){if(_0x243f59){logger[_0x7770('0x29')](_0x7770('0x2a'),_0x243f59);_0x44e3f1(_0x243f59);}else{logger[_0x7770('0x2b')](_0x7770('0x2c'));odbc[_0x7770('0x2d')](_0x2c62e4,function(_0x413ce5,_0x404007){if(_0x413ce5){logger['info'](_0x7770('0x2e'),_0x2c62e4);_0x44e3f1(_0x413ce5);}else{logger[_0x7770('0x2b')]('Query\x20executed\x20correctly\x20%s',_0x2c62e4);odbc[_0x7770('0x2f')](function(_0x3f4afe){if(_0x3f4afe){logger[_0x7770('0x29')](_0x7770('0x30'),_0x3f4afe);}_0x44e3f1(null,_0x404007);});}});}});};AGIVertices[_0x7770('0x12')][_0x7770('0x31')]=function(_0x46ab6b,_0x49c720){this[_0x7770('0x10')]['getSmsAccountById'](_0x46ab6b)[_0x7770('0x14')](function(_0x50dbf5){_0x49c720(null,_0x50dbf5?_0x50dbf5:![]);})[_0x7770('0x16')](function(_0x594968){_0x49c720(_0x594968);});};AGIVertices[_0x7770('0x12')][_0x7770('0x32')]=function(_0x291544,_0x4a84bb){this['rpc'][_0x7770('0x32')](_0x291544)[_0x7770('0x14')](function(_0x561246){_0x4a84bb(null,_0x561246);})[_0x7770('0x16')](function(_0x52b5f0){_0x4a84bb(_0x52b5f0);});};AGIVertices[_0x7770('0x12')][_0x7770('0x33')]=function(_0x4bb171,_0x19f197,_0x1915e7){this[_0x7770('0x10')][_0x7770('0x33')]({'uniqueid':this[_0x7770('0xf')]['uniqueid'],'node':_0x4bb171['label'],'application':_0x4bb171['agicommand'],'data':_0x19f197||null,'project_name':this[_0x7770('0xf')][_0x7770('0x34')],'callerid':this[_0x7770('0xf')]['callerid']})[_0x7770('0x14')](function(_0x27e594){if(_0x1915e7){_0x1915e7(null,_0x27e594);}})[_0x7770('0x16')](function(_0x28bbfd){if(_0x1915e7){_0x1915e7(_0x28bbfd);}});};AGIVertices[_0x7770('0x12')][_0x7770('0x35')]=function(_0x266847,_0x9afe9e,_0x8b3fac,_0x4ae9da){this[_0x7770('0x10')][_0x7770('0x35')]({'uniqueid':this[_0x7770('0xf')]['uniqueid'],'callerid':this['channel']['callerid'],'calleridname':this[_0x7770('0xf')][_0x7770('0x36')],'context':this['channel'][_0x7770('0x37')],'extension':this[_0x7770('0xf')][_0x7770('0x38')],'priority':this['channel'][_0x7770('0x39')],'accountcode':this[_0x7770('0xf')][_0x7770('0x3a')],'dnid':this['channel'][_0x7770('0x3b')],'projectName':this['channel'][_0x7770('0x34')],'saveName':_0x9afe9e,'filename':_0x266847[_0x7770('0x3c')]||_0x9afe9e,'savePath':_0x8b3fac})[_0x7770('0x14')](function(_0xc48128){_0x4ae9da(null,_0xc48128);})[_0x7770('0x16')](function(_0x544f0a){_0x4ae9da(_0x544f0a);});};AGIVertices[_0x7770('0x12')][_0x7770('0x3d')]=function(_0x44d190,_0x4bbcde,_0xddfa16,_0x500970,_0x504d4e){this[_0x7770('0x10')]['createSquareMessage']({'uniqueid':this[_0x7770('0xf')]['uniqueid'],'body':_0x44d190,'direction':_0x4bbcde,'providerName':_0xddfa16,'providerResponse':_0x500970})[_0x7770('0x14')](function(_0x1dd70d){if(_0x504d4e){_0x504d4e(null,_0x1dd70d);}})[_0x7770('0x16')](function(_0x89ee09){if(_0x504d4e){_0x504d4e(_0x89ee09);}});};AGIVertices[_0x7770('0x12')][_0x7770('0x3e')]=function(_0x90d7bd,_0x4e70c3){this[_0x7770('0x10')][_0x7770('0x3e')]({'firstName':_[_0x7770('0x3f')](_0x90d7bd[_0x7770('0x15')])||_[_0x7770('0x40')](_0x90d7bd[_0x7770('0x15')])?_0x7770('0x41')+Math[_0x7770('0x42')]():_0x90d7bd[_0x7770('0x15')],'lastName':_[_0x7770('0x3f')](_0x90d7bd[_0x7770('0x43')])||_[_0x7770('0x40')](_0x90d7bd[_0x7770('0x43')])?null:_0x90d7bd[_0x7770('0x43')],'phone':_0x90d7bd[_0x7770('0x44')],'ListId':_0x90d7bd[_0x7770('0x45')],'scheduledat':_0x90d7bd['scheduledAt'],'callbackUniqueid':this[_0x7770('0xf')][_0x7770('0x46')],'tags':'callback','description':'Callback\x20scheduled\x20at\x20'+_0x90d7bd[_0x7770('0x47')]['toString'](),'priority':_0x90d7bd[_0x7770('0x48')]})[_0x7770('0x14')](function(_0x496045){_0x4e70c3(null,_0x496045);})[_0x7770('0x16')](function(_0x5ab85d){_0x4e70c3(_0x5ab85d);});};AGIVertices['prototype'][_0x7770('0x49')]=function(_0x352fdb,_0x12c993){this[_0x7770('0x10')]['getPauseById'](_0x352fdb)['then'](function(_0x4e999e){_0x12c993(null,_0x4e999e?_0x4e999e[_0x7770('0x15')]:![]);})[_0x7770('0x16')](function(_0x41f05c){_0x12c993(_0x41f05c);});};AGIVertices['prototype']['agentPause']=function(_0x1d9c83,_0x3ffd90,_0xd6f64b){var _0x368bd0={'role':_0x7770('0x4a')};_0x368bd0[_0x1d9c83]=this[_0x7770('0xf')][_0x7770('0x4b')];this[_0x7770('0x10')]['agentPause'](_0x368bd0,_0x3ffd90,this[_0x7770('0xf')][_0x7770('0x46')])['then'](function(_0x33d13e){_0xd6f64b(null,_[_0x7770('0x40')](_0x33d13e)?![]:!![]);})['catch'](function(_0x20af80){logger[_0x7770('0x29')](_0x20af80);_0xd6f64b(null,![]);});};AGIVertices[_0x7770('0x12')]['agentUnpause']=function(_0x2ff902,_0x527519){var _0x1919f9={'role':_0x7770('0x4a')};_0x1919f9[_0x2ff902]=this[_0x7770('0xf')][_0x7770('0x4b')];this['rpc'][_0x7770('0x4c')](_0x1919f9)[_0x7770('0x14')](function(_0x535d98){_0x527519(null,_[_0x7770('0x40')](_0x535d98)?![]:!![]);})[_0x7770('0x16')](function(_0x583faf){logger[_0x7770('0x29')](_0x583faf);_0x527519(null,![]);});};AGIVertices[_0x7770('0x12')]['agentLogout']=function(_0x1fe2b4,_0xed365f){var _0x1d8b89={'role':'agent'};_0x1d8b89[_0x1fe2b4]=this[_0x7770('0xf')][_0x7770('0x4b')];this[_0x7770('0x10')][_0x7770('0x4d')](_0x1d8b89)[_0x7770('0x14')](function(_0xcac7e7){_0xed365f(null,_[_0x7770('0x40')](_0xcac7e7)?![]:!![]);})[_0x7770('0x16')](function(_0x5c74e5){logger['error'](_0x5c74e5);_0xed365f(null,![]);});};AGIVertices[_0x7770('0x12')]['agentLogin']=function(_0xb08a53,_0x36759f){var _0x3d2b42={'role':_0x7770('0x4a')};_0x3d2b42[_0xb08a53]=this[_0x7770('0xf')][_0x7770('0x4b')];var _0x796f9d=_0xb08a53!=_0x7770('0x4e')?util[_0x7770('0x27')]('%s/%s@from-sip/n','LOCAL',this[_0x7770('0xf')][_0x7770('0x4b')]):undefined;this[_0x7770('0x10')][_0x7770('0x4f')](_0x3d2b42,_0x796f9d)[_0x7770('0x14')](function(_0x2c5055){_0x36759f(null,_[_0x7770('0x40')](_0x2c5055)?![]:!![]);})[_0x7770('0x16')](function(_0x11339c){logger[_0x7770('0x29')](_0x11339c);_0x36759f(null,![]);});};AGIVertices[_0x7770('0x12')][_0x7770('0x50')]=function(_0x25d605,_0x4558b8){sh['exec'](_[_0x7770('0x51')](_0x25d605),function(_0x2e35ab,_0x35803b){var _0x23bf9f=_0x35803b[_0x7770('0x52')](/(\r\n|\n|\r)/gm,'');_0x4558b8(null,_0x23bf9f);});};AGIVertices['prototype'][_0x7770('0x53')]=function(_0xbad84a,_0x11ad92){scripts[_0x7770('0x53')](_0xbad84a[_0x7770('0x54')],_0xbad84a[_0x7770('0x55')]||_0x7770('0x56'),_0xbad84a['text'],_0xbad84a[_0x7770('0x57')]||_0x7770('0x58'),_0xbad84a[_0x7770('0x59')]||'MALE',_0xbad84a[_0x7770('0x5a')]||_0x7770('0x5b'))[_0x7770('0x14')](function(_0x3cbe94){_0x11ad92(null,_0x3cbe94);})[_0x7770('0x16')](function(_0x1bb11a){_0x11ad92(_0x1bb11a);});};AGIVertices[_0x7770('0x12')][_0x7770('0x5c')]=function(_0x103227,_0x1e117c){scripts[_0x7770('0x5c')](_0x103227['text'],_0x103227[_0x7770('0x5d')]||'en',0x1)['then'](function(_0x4be5a4){_0x1e117c(null,_0x4be5a4);})[_0x7770('0x16')](function(_0x5de444){_0x1e117c(_0x5de444);});};AGIVertices[_0x7770('0x12')][_0x7770('0x5e')]=function(_0x1ae00e,_0xcc04fc){var _0x500489={'uri':_0x1ae00e[_0x7770('0x5f')],'method':_0x1ae00e[_0x7770('0x60')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x1ae00e['timeout'])===_0x7770('0x61')&&parseInt(_0x1ae00e[_0x7770('0x62')])>=0x1?parseInt(_0x1ae00e[_0x7770('0x62')])*0x3e8:0x5*0x3e8};if(_['includes']([_0x7770('0x63'),'PUT'],_0x500489[_0x7770('0x60')]['toUpperCase']())){try{_0x500489[_0x7770('0x64')]=_0x1ae00e[_0x7770('0xb')]?JSON[_0x7770('0x65')](_0x1ae00e[_0x7770('0xb')]):{};}catch(_0x1a3407){logger[_0x7770('0x29')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x1a3407);}}try{_0x500489['headers']=_0x1ae00e[_0x7770('0xa')]?JSON[_0x7770('0x65')](_0x1ae00e[_0x7770('0xa')]):{};}catch(_0x5c3ba5){logger[_0x7770('0x29')](_0x7770('0x66'),_0x5c3ba5);}if(_0x1ae00e[_0x7770('0x67')]){try{var _0x20ded3=require(_0x1ae00e[_0x7770('0x67')])[_0x7770('0x68')](this,_0x500489);_0x500489[_0x7770('0x69')]=Mustache['render'](_0x1ae00e['url'],_0x20ded3,{},['$$','$$']);if(_0x500489[_0x7770('0x6a')]){_0x500489[_0x7770('0x6a')]=JSON[_0x7770('0x65')](Mustache['render'](JSON[_0x7770('0x6b')](_0x500489[_0x7770('0x6a')]),_0x20ded3,{},['$$','$$']));}if(_0x500489[_0x7770('0x64')]){_0x500489[_0x7770('0x64')]=JSON[_0x7770('0x65')](Mustache[_0x7770('0x6c')](JSON[_0x7770('0x6b')](_0x500489['body']),_0x20ded3,{},['$$','$$']));}}catch(_0x1246f5){logger[_0x7770('0x29')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x1246f5);}}rp(_0x500489)['then'](function(_0x36b67d){var _0x52e2d4={'statusCode':_0x36b67d[_0x7770('0x6d')]||0xc8,'statusMessage':_0x36b67d[_0x7770('0x6e')]||'OK','headers':_0x36b67d[_0x7770('0x6a')]||{},'body':_0x36b67d[_0x7770('0x64')]||{}};_0xcc04fc(null,_0x52e2d4);})[_0x7770('0x16')](function(_0xebf94d){var _0x2e3b19={'statusCode':_0xebf94d[_0x7770('0x6d')]||0x1f4,'statusMessage':_0xebf94d[_0x7770('0x6f')]||_0x7770('0x70'),'headers':_0xebf94d[_0x7770('0x71')][_0x7770('0x6a')]||{},'body':_0xebf94d['options'][_0x7770('0x64')]||{}};_0xcc04fc(null,_0x2e3b19);});};AGIVertices[_0x7770('0x12')][_0x7770('0x72')]=function(_0x2a0edc,_0x2bc19e){scripts['googleDialogflow'](this['channel'][_0x7770('0x46')],_0x2a0edc[_0x7770('0x73')],_0x2a0edc[_0x7770('0x56')],_0x2a0edc[_0x7770('0x74')]||'en')[_0x7770('0x14')](function(_0x259f7a){_0x2bc19e(null,_0x259f7a);})['catch'](function(_0x51fc5a){_0x2bc19e(_0x51fc5a);});};AGIVertices['prototype']['googleDialogflowV2']=function(_0x347575,_0x16c443){scripts[_0x7770('0x75')](this[_0x7770('0xf')]['uniqueid'],_0x347575['dialogflowV2_project_id'],_0x347575[_0x7770('0x76')],_0x347575[_0x7770('0x77')],_0x347575[_0x7770('0x56')],_0x347575[_0x7770('0x78')]||'en')[_0x7770('0x14')](function(_0x5a4d83){_0x16c443(null,_0x5a4d83);})['catch'](function(_0xe2d66b){_0x16c443(_0xe2d66b);});};AGIVertices[_0x7770('0x12')][_0x7770('0x79')]=function(_0x2b8d02,_0x58479d){scripts[_0x7770('0x79')](this['channel'],_0x2b8d02)[_0x7770('0x14')](function(_0x2b44a3){_0x58479d(null,_0x2b44a3);})['catch'](function(_0x546215){_0x58479d(_0x546215);});};AGIVertices[_0x7770('0x12')]['ispeechTTS']=function(_0x3c399b,_0x2214ea){scripts['ispeechTTS'](_0x3c399b['key'],_0x3c399b[_0x7770('0x56')],_0x3c399b[_0x7770('0x7a')]||_0x7770('0x58'),_0x3c399b[_0x7770('0x7b')])[_0x7770('0x14')](function(_0x1c6282){_0x2214ea(null,_0x1c6282);})[_0x7770('0x16')](function(_0x1f1003){_0x2214ea(_0x1f1003);});};AGIVertices[_0x7770('0x12')][_0x7770('0x7c')]=function(_0x143485,_0x3defa1,_0x32054c){scripts[_0x7770('0x7c')](_0x3defa1,_0x143485['key'],_0x143485['ispeech_asr_language']||_0x7770('0x58'),this[_0x7770('0x7d')](_0x143485[_0x7770('0x7e')])?_0x143485[_0x7770('0x7e')]:undefined)['then'](function(_0x390f76){_0x32054c(null,_0x390f76);})[_0x7770('0x16')](function(_0x119b07){_0x32054c(_0x119b07);});};AGIVertices[_0x7770('0x12')][_0x7770('0x7f')]=function(_0x44cc38,_0x1965a4){scripts['awsPolly'](_0x44cc38[_0x7770('0x80')],_0x44cc38[_0x7770('0x81')],_0x44cc38[_0x7770('0x82')],_0x44cc38[_0x7770('0x83')]||'Amy',_0x44cc38['text'],_0x44cc38[_0x7770('0x84')]||_0x7770('0x56'))[_0x7770('0x14')](function(_0x3e32d5){_0x1965a4(null,_0x3e32d5);})[_0x7770('0x16')](function(_0x281b05){_0x1965a4(_0x281b05);});};AGIVertices[_0x7770('0x12')]['awsLex']=function(_0x5a1e4a,_0x2c4582){scripts[_0x7770('0x85')](this[_0x7770('0xf')][_0x7770('0x46')],_0x5a1e4a[_0x7770('0x80')],_0x5a1e4a[_0x7770('0x81')],_0x5a1e4a['aws_lex_region'],_0x5a1e4a[_0x7770('0x56')],_0x5a1e4a[_0x7770('0x86')])[_0x7770('0x14')](function(_0x5db6eb){_0x2c4582(null,_0x5db6eb);})[_0x7770('0x16')](function(_0x2b577f){_0x2c4582(_0x2b577f);});};AGIVertices['prototype'][_0x7770('0x87')]=function(_0x28acc1,_0x283842,_0x3a7056){scripts[_0x7770('0x87')](_0x283842,_0x28acc1[_0x7770('0x73')],_0x28acc1[_0x7770('0x88')]||_0x7770('0x58'))[_0x7770('0x14')](function(_0x245804){_0x3a7056(null,_0x245804);})[_0x7770('0x16')](function(_0x4c0321){_0x3a7056(_0x4c0321);});};AGIVertices[_0x7770('0x12')][_0x7770('0x89')]=function(_0x2dac6a,_0x491615,_0x15c7fa){scripts[_0x7770('0x89')](_0x491615,_0x2dac6a[_0x7770('0x8a')],_0x2dac6a[_0x7770('0x8b')],_0x2dac6a[_0x7770('0x69')])[_0x7770('0x14')](function(_0x1290fb){_0x15c7fa(null,_0x1290fb);})[_0x7770('0x16')](function(_0x1860ca){_0x15c7fa(_0x1860ca);});};AGIVertices[_0x7770('0x12')]['clear']=function(_0x58782f){var _0x1ca52a=_['includes'](verticesWithRetry,_0x58782f[_0x7770('0x8c')])?_0x58782f:_[_0x7770('0x8d')](_0x58782f);for(var _0x59a674 in _0x1ca52a){if(_0x1ca52a[_0x7770('0x8e')](_0x59a674)){if(_0x1ca52a[_0x59a674]&&_[_0x7770('0x8f')](_0x1ca52a[_0x59a674])){if(_[_0x7770('0x90')](recursiveMapAttributes,_0x59a674)){_0x1ca52a[_0x59a674]=this[_0x7770('0x91')](_0x1ca52a[_0x59a674]);}else{_0x1ca52a[_0x59a674]=this[_0x7770('0x92')](_0x1ca52a[_0x59a674]);}}}}return _0x1ca52a;};AGIVertices[_0x7770('0x12')][_0x7770('0x93')]=function(_0x2c8635){for(var _0x5db3cb in _0x2c8635){if(_0x2c8635[_0x7770('0x8e')](_0x5db3cb)){if(_[_0x7770('0x94')](_0x2c8635[_0x5db3cb])){this[_0x7770('0x93')](_0x2c8635[_0x5db3cb]);}else if(_[_0x7770('0x95')](_0x2c8635[_0x5db3cb])){for(var _0x52b798=0x0;_0x52b798<_0x2c8635[_0x5db3cb]['length'];_0x52b798++){this['recursiveNodeIndex'](_0x2c8635[_0x5db3cb][_0x52b798]);}}else if(_[_0x7770('0x8f')](_0x2c8635[_0x5db3cb])){_0x2c8635[_0x5db3cb]=this[_0x7770('0x92')](_0x2c8635[_0x5db3cb]);}}}};AGIVertices[_0x7770('0x12')][_0x7770('0x96')]=function(_0x14f866,_0x37002e){for(var _0x1751db in _0x14f866){if(_0x14f866[_0x7770('0x8e')](_0x1751db)){if(_[_0x7770('0x94')](_0x14f866[_0x1751db])){if(!_[_0x7770('0x3f')](_0x14f866[_0x1751db])){this['saveRestApiResult'](_0x14f866[_0x1751db],util[_0x7770('0x27')](_0x7770('0x97'),_0x37002e,_0x1751db));}}else if(_[_0x7770('0x95')](_0x14f866[_0x1751db])){for(var _0x39aa4c=0x0;_0x39aa4c<_0x14f866[_0x1751db][_0x7770('0x98')];_0x39aa4c++){this[_0x7770('0x96')](_0x14f866[_0x1751db][_0x39aa4c],util[_0x7770('0x27')]('%s.%s',_0x37002e,_0x1751db+'['+_0x39aa4c+']'));}}else{if(!_[_0x7770('0x40')](_0x14f866[_0x1751db])){this['channel'][_0x7770('0x99')](util[_0x7770('0x27')](_0x7770('0x97'),_0x37002e,_0x1751db),_0x14f866[_0x1751db]);}}}}};AGIVertices['prototype']['replaceObjectAllVariables']=function(_0x4d8681){try{var _0x110558=JSON['parse'](_0x4d8681);this[_0x7770('0x93')](_0x110558);return JSON['stringify'](_0x110558);}catch(_0x2c1a50){return this[_0x7770('0x92')](_0x4d8681);}};AGIVertices[_0x7770('0x12')][_0x7770('0x92')]=function(_0x1b538c){var _0x58fc74=_0x1b538c[_0x7770('0x9a')]('{');for(var _0x5ea5a3=0x1;_0x5ea5a3<_0x58fc74[_0x7770('0x98')];_0x5ea5a3+=0x1){var _0x1086ad=_0x58fc74[_0x5ea5a3][_0x7770('0x9a')]('}');if(_0x1086ad['length']>0x1){_0x1b538c=_0x1b538c[_0x7770('0x9b')]('{'+_0x1086ad[0x0]+'}',this[_0x7770('0xf')]['getVariable'](_0x1086ad[0x0])[_0x7770('0x9c')]||_0x1086ad[0x0]);}}if(_0x58fc74[_0x7770('0x98')]===0x1){return _0x1b538c['toString']();}return this[_0x7770('0x92')](_0x1b538c);};AGIVertices[_0x7770('0x12')][_0x7770('0x9d')]=function(_0x319ddb,_0x109df5){var _0x5dfed4=this[_0x7770('0xf')][_0x7770('0x13')](_0x319ddb);if(_0x5dfed4[_0x7770('0x9e')]===-0x1){return _0x5dfed4;}logger[_0x7770('0x2b')](util[_0x7770('0x27')](_0x7770('0x9f'),_0x109df5,_0x5dfed4[_0x7770('0x9c')]));return this['channel'][_0x7770('0x99')](_0x109df5,_0x5dfed4[_0x7770('0x9c')]);};AGIVertices[_0x7770('0x12')][_0x7770('0x7d')]=function(_0x106ce0){return _0x106ce0&&_0x106ce0!=='0'&&_0x106ce0!=='-1'&&_0x106ce0!=='';};AGIVertices[_0x7770('0x12')][_0x7770('0xa0')]=function(_0x46d2ba){this[_0x7770('0x33')]['sync'](this,_0x46d2ba,'-');_0x46d2ba[_0x7770('0xa1')]=_0x46d2ba[_0x7770('0xa0')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype']['mrcpsynth']=function(_0x7de79){logger[_0x7770('0x2b')](util[_0x7770('0x27')](_0x7770('0xa2'),_0x7de79['label']));if(!this[_0x7770('0x7d')](_0x7de79[_0x7770('0x56')])){return this['channel'][_0x7770('0xa3')]('no\x20text\x20configured');}var _0x5a133f='\x22'+_0x7de79[_0x7770('0x56')]+'\x22';if(this[_0x7770('0x7d')](_0x7de79['options'])){_0x5a133f+=','+_0x7de79[_0x7770('0x71')];}var _0x671249=this[_0x7770('0xf')][_0x7770('0xa4')](_0x7770('0xa5'),_0x5a133f);if(_0x671249[_0x7770('0x9e')]===-0x1){return _0x671249;}return this['channel']['noop'](util[_0x7770('0x27')](_0x7770('0xa6'),_0x5a133f));};AGIVertices[_0x7770('0x12')][_0x7770('0xa7')]=function(_0x4e0119){logger['info'](util[_0x7770('0x27')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x4e0119[_0x7770('0xa8')]));if(!this[_0x7770('0x7d')](_0x4e0119['grammar'])){return this[_0x7770('0xf')][_0x7770('0xa3')](_0x7770('0xa9'));}var _0x40048a=_0x4e0119[_0x7770('0xaa')];if(this[_0x7770('0x7d')](_0x4e0119[_0x7770('0x71')])){_0x40048a+=','+_0x4e0119['options'];}var _0x4fd410=this[_0x7770('0xf')][_0x7770('0xa4')](_0x7770('0xab'),_0x40048a);if(_0x4fd410[_0x7770('0x9e')]===-0x1){return _0x4fd410;}var _0x12cc93=this[_0x7770('0x9d')](_0x7770('0xac'),'MRCP_RECOG_CONFIDENCE');if(_0x12cc93[_0x7770('0x9e')]===-0x1){return _0x12cc93;}var _0x4f0fd9=this['getAndSetVariable'](_0x7770('0xad'),'MRCP_RECOG_TRANSCRIPT');if(_0x4f0fd9[_0x7770('0x9e')]===-0x1){return _0x4f0fd9;}var _0x28ab96=this[_0x7770('0x9d')](_0x7770('0xae'),_0x7770('0xaf'));if(_0x28ab96[_0x7770('0x9e')]===-0x1){return _0x28ab96;}return this[_0x7770('0xf')][_0x7770('0xa3')](util[_0x7770('0x27')](_0x7770('0xb0'),_0x40048a));};AGIVertices[_0x7770('0x12')][_0x7770('0x6')]=function(_0x3ec3d7){logger[_0x7770('0x2b')](util[_0x7770('0x27')](_0x7770('0xb1'),_0x3ec3d7['label']));return this[_0x7770('0xf')][_0x7770('0x6')]([_0x3ec3d7['command'],_0x3ec3d7[_0x7770('0xb2')]]);};AGIVertices[_0x7770('0x12')][_0x7770('0xb3')]=function(_0x233260){logger[_0x7770('0x2b')](util[_0x7770('0x27')](_0x7770('0xb4'),_0x233260[_0x7770('0xa8')]));if(this['isConfigured'](_0x233260['timeout'])){logger['info'](util[_0x7770('0x27')](_0x7770('0xb5'),_0x233260[_0x7770('0x62')]));var _0x57bb19=this[_0x7770('0xf')][_0x7770('0xb6')](_0x233260['timeout']);if(_0x57bb19[_0x7770('0x9e')]===-0x1){return _0x57bb19;}}return this[_0x7770('0xf')]['answer']();};AGIVertices[_0x7770('0x12')][_0x7770('0xb7')]=function(_0x3de6a1){logger[_0x7770('0x2b')](util['format'](_0x7770('0xb8'),_0x3de6a1[_0x7770('0xa8')]));if(!this[_0x7770('0x7d')](_0x3de6a1['list_id'])){return this['channel']['error'](_0x3de6a1,_0x7770('0xb9'));}_0x3de6a1[_0x7770('0x47')]=moment();if(this[_0x7770('0x7d')](_0x3de6a1['delay'])){_0x3de6a1['scheduledAt']=moment()[_0x7770('0xba')](_0x3de6a1[_0x7770('0xbb')],_0x7770('0xbc'));}if(!this[_0x7770('0x7d')](_0x3de6a1[_0x7770('0x48')])){_0x3de6a1[_0x7770('0x48')]=0x2;}this[_0x7770('0x3e')]['sync'](this,_0x3de6a1);return this[_0x7770('0xf')][_0x7770('0xa3')](util['format'](_0x7770('0xbd'),_0x3de6a1['phone'],_0x3de6a1[_0x7770('0x45')],_0x3de6a1['scheduledAt']));};AGIVertices[_0x7770('0x12')]['custom_app']=function(_0x31a032){logger['info'](util['format']('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x31a032['label']));var _0x2eb907=this[_0x7770('0xf')][_0x7770('0xa4')](_0x31a032[_0x7770('0xbe')],_0x31a032['options']);if(_0x2eb907[_0x7770('0x9e')]===-0x1){return _0x2eb907;}return this[_0x7770('0xf')][_0x7770('0xa3')](util[_0x7770('0x27')](_0x7770('0xbf'),_0x31a032[_0x7770('0xbe')],_0x31a032[_0x7770('0x71')]));};AGIVertices['prototype'][_0x7770('0xc0')]=function(_0x47d3ba){logger[_0x7770('0x2b')](util[_0x7770('0x27')](_0x7770('0xc1'),_0x47d3ba[_0x7770('0xa8')]));if(!this[_0x7770('0x7d')](_0x47d3ba[_0x7770('0x56')])){return this[_0x7770('0xf')][_0x7770('0xa3')](_0x7770('0xc2'));}var _0x4f56a8='\x22'+_0x47d3ba[_0x7770('0x56')]+'\x22';if(this['isConfigured'](_0x47d3ba[_0x7770('0x71')])){_0x4f56a8+=','+_0x47d3ba['options'];}var _0x118549=this['channel'][_0x7770('0xa4')](_0x7770('0xa5'),_0x4f56a8);if(_0x118549[_0x7770('0x9e')]===-0x1){return _0x118549;}return this[_0x7770('0xf')][_0x7770('0xa3')](util[_0x7770('0x27')](_0x7770('0xa6'),_0x4f56a8));};AGIVertices[_0x7770('0x12')][_0x7770('0xc3')]=function(_0x5de561){logger[_0x7770('0x2b')](util['format'](_0x7770('0xc4'),_0x5de561[_0x7770('0xa8')]));if(!this['isConfigured'](_0x5de561[_0x7770('0x56')])){return this[_0x7770('0xf')][_0x7770('0xa3')](_0x7770('0xc2'));}var _0x452591='\x22'+_0x5de561[_0x7770('0x56')]+'\x22';if(this[_0x7770('0x7d')](_0x5de561[_0x7770('0x71')])){_0x452591+=','+_0x5de561[_0x7770('0x71')];}var _0x55534c=this[_0x7770('0xf')][_0x7770('0xa4')](_0x7770('0xa5'),_0x452591);if(_0x55534c[_0x7770('0x9e')]===-0x1){return _0x55534c;}return this['channel'][_0x7770('0xa3')](util['format'](_0x7770('0xa6'),_0x452591));};AGIVertices[_0x7770('0x12')][_0x7770('0xc5')]=function(_0x46b150){logger['info'](util[_0x7770('0x27')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x46b150['label']));if(!this[_0x7770('0x7d')](_0x46b150['grammar'])){return this[_0x7770('0xf')][_0x7770('0xa3')](_0x7770('0xa9'));}var _0xec0eeb=_0x46b150[_0x7770('0xaa')];if(this[_0x7770('0x7d')](_0x46b150[_0x7770('0x71')])){_0xec0eeb+=','+_0x46b150[_0x7770('0x71')];}var _0x876beb=this[_0x7770('0xf')][_0x7770('0xa4')]('MRCPRecog',_0xec0eeb);if(_0x876beb[_0x7770('0x9e')]===-0x1){return _0x876beb;}var _0x4be91f=this[_0x7770('0x9d')](_0x7770('0xac'),_0x7770('0xc6'));if(_0x4be91f[_0x7770('0x9e')]===-0x1){return _0x4be91f;}var _0x308f80=this[_0x7770('0x9d')](_0x7770('0xad'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x308f80['result']===-0x1){return _0x308f80;}var _0x342898=this[_0x7770('0x9d')]('RECOG_INSTANCE()',_0x7770('0xc7'));if(_0x342898['result']===-0x1){return _0x342898;}return this[_0x7770('0xf')][_0x7770('0xa3')](util[_0x7770('0x27')](_0x7770('0xb0'),_0xec0eeb));};AGIVertices[_0x7770('0x12')][_0x7770('0xc8')]=function(_0x137204){logger[_0x7770('0x2b')](util[_0x7770('0x27')](_0x7770('0xc9'),_0x137204[_0x7770('0xa8')]));if(!this[_0x7770('0x7d')](_0x137204['grammar'])){return this[_0x7770('0xf')]['noop'](_0x7770('0xa9'));}var _0x10d277=_0x137204[_0x7770('0xaa')];if(this[_0x7770('0x7d')](_0x137204[_0x7770('0x71')])){_0x10d277+=','+_0x137204['options'];}var _0x27f31e=this[_0x7770('0xf')][_0x7770('0xa4')](_0x7770('0xab'),_0x10d277);if(_0x27f31e['result']===-0x1){return _0x27f31e;}var _0x432f61=this[_0x7770('0x9d')](_0x7770('0xac'),_0x7770('0xca'));if(_0x432f61[_0x7770('0x9e')]===-0x1){return _0x432f61;}var _0x4e9f15=this['getAndSetVariable'](_0x7770('0xad'),_0x7770('0xcb'));if(_0x4e9f15['result']===-0x1){return _0x4e9f15;}var _0x31bc85=this[_0x7770('0x9d')]('RECOG_INSTANCE()','SESTEK_ASR_INSTANCE');if(_0x31bc85['result']===-0x1){return _0x31bc85;}return this[_0x7770('0xf')][_0x7770('0xa3')](util[_0x7770('0x27')](_0x7770('0xb0'),_0x10d277));};AGIVertices[_0x7770('0x12')][_0x7770('0xcc')]=function(_0x11306a){logger['info'](util[_0x7770('0x27')](_0x7770('0xcd'),_0x11306a['label']));if(!this[_0x7770('0x7d')](_0x11306a[_0x7770('0xce')])){return this[_0x7770('0xf')][_0x7770('0x29')](_0x11306a,_0x7770('0xcf'));}var _0x47f275=this['getSquareOdbc'][_0x7770('0x68')](this,_0x11306a[_0x7770('0xce')]);if(!_0x47f275){return this[_0x7770('0xf')][_0x7770('0x29')](_0x11306a,_0x7770('0xd0'));}if(!this[_0x7770('0x7d')](_0x11306a[_0x7770('0x2d')])){return this['channel'][_0x7770('0x29')](_0x11306a,'no\x20query\x20configured');}var _0x2109c9=_0x11306a[_0x7770('0x2d')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x7770('0xf')][_0x7770('0xa3')](util[_0x7770('0x27')](_0x7770('0xd1'),_0x2109c9));var _0x15a7d8=this['getQueryOdbc'][_0x7770('0x68')](this,_0x47f275,_0x2109c9);this[_0x7770('0x33')][_0x7770('0x68')](this,_0x11306a,_0x2109c9);if(!this[_0x7770('0x7d')](_0x11306a[_0x7770('0xd2')])){return this[_0x7770('0xf')][_0x7770('0xa3')](_0x7770('0xd3'));}var _0x9dcd2=this[_0x7770('0x13')][_0x7770('0x68')](this,_0x11306a[_0x7770('0xd2')]);if(!_0x9dcd2){return this[_0x7770('0xf')][_0x7770('0x29')](_0x11306a,_0x7770('0xd4'));}var _0x3074d2=this;_0x15a7d8[_0x7770('0xd5')](function(_0x2b2ba1,_0x2ddcef){Object['keys'](_0x2b2ba1)[_0x7770('0xd5')](function(_0x52d657){_0x3074d2[_0x7770('0xf')]['setVariable'](util['format'](_0x7770('0xd6'),_0x9dcd2,_0x2ddcef,_0x52d657),_0x2b2ba1[_0x52d657]);});});this['channel'][_0x7770('0x99')](util[_0x7770('0x27')](_0x7770('0xd7'),_0x9dcd2),_0x15a7d8['length']);return this[_0x7770('0xf')][_0x7770('0xa3')](util[_0x7770('0x27')](_0x7770('0xd8'),_0x9dcd2));};AGIVertices[_0x7770('0x12')][_0x7770('0xd9')]=function(_0x190412){logger['debug'](util[_0x7770('0x27')](_0x7770('0xda'),_0x190412[_0x7770('0xa8')]));if(!this['isConfigured'](_0x190412[_0x7770('0xdb')])){return this[_0x7770('0xf')][_0x7770('0x29')](_0x190412,_0x7770('0xdc'));}var _0x17833f=this[_0x7770('0x1c')][_0x7770('0x68')](this,_0x190412[_0x7770('0xdb')]);if(!_0x17833f){return this[_0x7770('0xf')][_0x7770('0x29')](_0x190412,_0x7770('0xdd'));}var _0x2969b5=this[_0x7770('0xf')][_0x7770('0xa4')](_0x7770('0xde'),[util['format']('SIP/%s',_0x17833f),_0x190412[_0x7770('0x62')],_0x190412[_0x7770('0xdf')],_0x190412[_0x7770('0x5f')]]);if(_0x2969b5[_0x7770('0x9e')]===-0x1){return _0x2969b5;}return this[_0x7770('0xf')]['noop'](util[_0x7770('0x27')]('Executed\x20command\x20%s',_0x7770('0xde')));};AGIVertices[_0x7770('0x12')]['dialogflow']=function(_0x1541a0){logger['info'](util[_0x7770('0x27')](_0x7770('0xe0'),_0x1541a0[_0x7770('0xa8')]));if(!this[_0x7770('0x7d')](_0x1541a0['key'])){return this[_0x7770('0xf')][_0x7770('0xa3')](_0x7770('0xe1'));}if(!this[_0x7770('0x7d')](_0x1541a0[_0x7770('0x56')])){return this['channel']['noop'](_0x7770('0xc2'));}this[_0x7770('0xf')][_0x7770('0xe2')]=!![];this[_0x7770('0x33')](_0x1541a0);this[_0x7770('0x3d')](_0x1541a0['text'],'in','','');this['channel']['noop'](util[_0x7770('0x27')](_0x7770('0xe3'),_0x1541a0[_0x7770('0x56')]));var _0x34a102=this[_0x7770('0x72')][_0x7770('0x68')](this,_0x1541a0);if(_0x34a102){for(var _0x1fa117 in _0x34a102){if(_0x34a102['hasOwnProperty'](_0x1fa117)){this[_0x7770('0xf')][_0x7770('0x99')](util[_0x7770('0x27')](_0x7770('0xe4'),_0x1fa117['toUpperCase']()),_0x34a102[_0x1fa117]);}}this[_0x7770('0x3d')](_0x34a102[_0x7770('0xe5')],'out','dialogflow','');return this[_0x7770('0xf')][_0x7770('0xa3')](util[_0x7770('0x27')](_0x7770('0xe6'),_0x34a102[_0x7770('0xe5')]));}return this[_0x7770('0xf')][_0x7770('0x29')](_0x1541a0,_0x7770('0xe7'));};AGIVertices['prototype'][_0x7770('0xe8')]=function(_0x536151){logger[_0x7770('0x2b')](util[_0x7770('0x27')](_0x7770('0xe9'),_0x536151['label']));if(!this[_0x7770('0x7d')](_0x536151[_0x7770('0xea')])){return this[_0x7770('0xf')]['noop']('no\x20project_id\x20configured');}if(!this[_0x7770('0x7d')](_0x536151[_0x7770('0x76')])){return this['channel'][_0x7770('0xa3')](_0x7770('0xeb'));}if(!this[_0x7770('0x7d')](_0x536151[_0x7770('0x77')])){return this[_0x7770('0xf')][_0x7770('0xa3')]('no\x20private_key\x20configured');}if(!this['isConfigured'](_0x536151['dialogflowV2_language'])){return this[_0x7770('0xf')][_0x7770('0xa3')]('no\x20anguage\x20configured');}if(!this['isConfigured'](_0x536151[_0x7770('0x56')])){return this[_0x7770('0xf')][_0x7770('0xa3')]('no\x20text\x20configured');}this[_0x7770('0xf')][_0x7770('0xe2')]=!![];this['createSquareDetailsReport'](_0x536151);this['createSquareMessage'](_0x536151['text'],'in','','');this[_0x7770('0xf')]['noop'](util[_0x7770('0x27')](_0x7770('0xec'),_0x536151[_0x7770('0x56')]));var _0x7d28b5=this[_0x7770('0x75')][_0x7770('0x68')](this,_0x536151);if(_0x7d28b5){for(var _0x3b6de6 in _0x7d28b5){if(_0x7d28b5[_0x7770('0x8e')](_0x3b6de6)){if(_0x3b6de6!==_0x7770('0xed')){this[_0x7770('0xf')][_0x7770('0x99')](util['format']('DIALOGFLOW_%s',_0x3b6de6[_0x7770('0xee')]()),_0x7d28b5[_0x3b6de6]);}}}this[_0x7770('0x3d')](_0x7d28b5[_0x7770('0xe5')],_0x7770('0xef'),'dialogflowV2',_0x7d28b5[_0x7770('0xed')]);return this[_0x7770('0xf')][_0x7770('0xa3')](util[_0x7770('0x27')]('DialogflowV2\x20Result\x20%s',_0x7d28b5[_0x7770('0xe5')]));}return this['channel'][_0x7770('0x29')](_0x536151,_0x7770('0xf0'));};AGIVertices[_0x7770('0x12')][_0x7770('0xf1')]=function(_0x41a3c4){logger[_0x7770('0x2b')](util[_0x7770('0x27')](_0x7770('0xf2'),_0x41a3c4[_0x7770('0xa8')]));if(!this[_0x7770('0x7d')](_0x41a3c4[_0x7770('0xf3')])){return this[_0x7770('0xf')][_0x7770('0xa3')]('no\x20ndauth\x20url\x20configured');}if(!this[_0x7770('0x7d')](_0x41a3c4[_0x7770('0xf4')])){return this['channel']['noop'](_0x7770('0xf5'));}if(!this[_0x7770('0x7d')](_0x41a3c4['password'])){return this[_0x7770('0xf')][_0x7770('0xa3')](_0x7770('0xf6'));}if(!this['isConfigured'](_0x41a3c4['ndassistant_url'])){return this[_0x7770('0xf')][_0x7770('0xa3')]('no\x20text\x20configured');}this[_0x7770('0xf')]['bot']=!![];this[_0x7770('0x33')](_0x41a3c4);this[_0x7770('0x3d')](_0x41a3c4[_0x7770('0x56')],'in','','');this['channel'][_0x7770('0xa3')](util[_0x7770('0x27')](_0x7770('0xf7'),_0x41a3c4[_0x7770('0x56')]));var _0x368b29=this[_0x7770('0x79')][_0x7770('0x68')](this,_0x41a3c4);if(_0x368b29){for(var _0xc49042 in _0x368b29){if(_0x368b29[_0x7770('0x8e')](_0xc49042)){this[_0x7770('0xf')]['setVariable'](util[_0x7770('0x27')]('SESTEK_NDA_%s',_0xc49042[_0x7770('0xee')]()),_0x368b29[_0xc49042]);}}this[_0x7770('0x3d')](_0x368b29[_0x7770('0xe5')],_0x7770('0xef'),_0x7770('0xf1'),'');if(_0x368b29[_0x7770('0xf8')]){this[_0x7770('0xf')][_0x7770('0xa3')](util['format']('Sestek\x20NDA\x20%s\x20file\x20created',_0x368b29[_0x7770('0xf8')]));var _0x375175=this[_0x7770('0xf')][_0x7770('0xf9')](_0x368b29[_0x7770('0xf8')]);try{fs[_0x7770('0xfa')](_0x368b29[_0x7770('0xf8')]+_0x7770('0xfb'));}catch(_0x4363d6){logger['error'](_0x4363d6);}return _0x375175;}else{return this['channel'][_0x7770('0xa3')](util['format'](_0x7770('0xfc'),_0x368b29['speech']));}}return this['channel'][_0x7770('0x29')](_0x41a3c4,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0x7770('0x12')][_0x7770('0xfd')]=function(_0x4a3620){logger[_0x7770('0x2b')](util[_0x7770('0x27')](_0x7770('0xfe'),_0x4a3620[_0x7770('0xa8')]));return this[_0x7770('0xf')][_0x7770('0xa3')](_0x7770('0xfd'));};AGIVertices[_0x7770('0x12')][_0x7770('0xff')]=function(_0x5e26a4){logger[_0x7770('0x2b')](util[_0x7770('0x27')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x5e26a4['label']));var _0x3c1002='';if(_0x5e26a4[_0x7770('0x100')]){if(!this[_0x7770('0x7d')](_0x5e26a4[_0x7770('0x100')])){return this[_0x7770('0xf')]['error'](_0x5e26a4,_0x7770('0x101'));}else{var _0xbbfdfc=parseInt(_0x5e26a4[_0x7770('0x100')],0xa);if(isNaN(_0xbbfdfc)){_0x3c1002=_0x5e26a4[_0x7770('0x100')];}else{_0x3c1002=this['getTrunk'][_0x7770('0x68')](this,_0x5e26a4[_0x7770('0x100')]);if(!_0x3c1002){return this['channel'][_0x7770('0x29')](_0x5e26a4,_0x7770('0x102'));}}}}else if(_0x5e26a4['trunk_name']){_0x3c1002=_0x5e26a4[_0x7770('0x103')];}else{return this[_0x7770('0xf')][_0x7770('0x29')](_0x5e26a4,_0x7770('0x101'));}var _0x2fc636=this[_0x7770('0xf')][_0x7770('0xa4')](_0x7770('0xde'),[util[_0x7770('0x27')]('SIP/%s/%s',_0x3c1002,_0x5e26a4[_0x7770('0x44')]),_0x5e26a4['timeout'],_0x5e26a4[_0x7770('0xdf')],_0x5e26a4['url']]);if(_0x2fc636['result']===-0x1){return _0x2fc636;}return this['channel']['noop'](util[_0x7770('0x27')]('Executed\x20command\x20%s','DIAL'));};AGIVertices[_0x7770('0x12')]['finally']=function(_0x581135){logger[_0x7770('0x2b')](util[_0x7770('0x27')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x581135[_0x7770('0xa8')]));return this[_0x7770('0xf')][_0x7770('0xa3')](_0x7770('0x104'));};AGIVertices[_0x7770('0x12')][_0x7770('0xd')]=function(_0x10ab9f){logger['info'](util['format'](_0x7770('0x105'),_0x10ab9f['label']));if(_0x10ab9f['retry']===0x0){return this[_0x7770('0xa0')](_0x10ab9f);}_0x10ab9f['retry']-=0x1;if(!this[_0x7770('0x7d')](_0x10ab9f['file_id'])){return this[_0x7770('0xf')][_0x7770('0x29')](_0x10ab9f,'no\x20file\x20audio\x20selected');}var _0x73538d=this[_0x7770('0x1d')][_0x7770('0x68')](this,_0x10ab9f['file_id']);if(!_0x73538d){return this[_0x7770('0xf')]['error'](_0x10ab9f,_0x7770('0x106'));}if(!this[_0x7770('0x7d')](_0x10ab9f[_0x7770('0xd2')])){return this[_0x7770('0xf')][_0x7770('0x29')](_0x7770('0xd3'));}var _0x364a7b=this[_0x7770('0xf')][_0x7770('0x107')](_0x73538d,_0x10ab9f[_0x7770('0x108')],_0x10ab9f[_0x7770('0x109')]);var _0x5d0981=_0x364a7b[_0x7770('0x9e')]?_0x364a7b[_0x7770('0x9e')][_0x7770('0x10a')]():'';logger[_0x7770('0x2b')](_0x7770('0x10b'),JSON[_0x7770('0x6b')](_0x364a7b));if(_0x364a7b[_0x7770('0x9e')]===-0x1){this[_0x7770('0x33')][_0x7770('0x68')](this,_0x10ab9f,_0x5d0981);return _0x364a7b;}else if(_0x364a7b[_0x7770('0x9c')]===_0x7770('0x62')){_0x364a7b['result']=_0x5d0981[_0x7770('0x98')]>=parseInt(_0x10ab9f[_0x7770('0x10c')])?'x':'i';}else{_0x364a7b[_0x7770('0x9e')]=_0x5d0981[_0x7770('0x98')]>=parseInt(_0x10ab9f[_0x7770('0x10c')])&&_0x5d0981['length']<=parseInt(_0x10ab9f[_0x7770('0x109')])?'x':'i';}var _0xbc180a=this['getVariable']['sync'](this,_0x10ab9f[_0x7770('0xd2')]);if(!_0xbc180a){return this[_0x7770('0xf')][_0x7770('0x29')](_0x10ab9f,_0x7770('0xd4'));}this[_0x7770('0xf')][_0x7770('0x99')](_0xbc180a,_0x5d0981);if(this[_0x7770('0x7d')](_0x10ab9f[_0x7770('0x10d')])){var _0x495544=parseInt(_0x10ab9f[_0x7770('0x10d')],0xa);var _0x41cd81=rs[_0x7770('0x10e')]({'charset':'*','length':_0x495544});var _0x4ad72f=_0x5d0981[_0x7770('0x98')];if(_0x4ad72f>0x0){if(_0x4ad72f>_0x495544){this['createSquareDetailsReport'][_0x7770('0x68')](this,_0x10ab9f,_0x10ab9f[_0x7770('0x10f')]===_0x7770('0x110')?_0x41cd81+_0x5d0981[_0x7770('0x111')](_0x495544):_0x5d0981[_0x7770('0x111')](0x0,_0x4ad72f-_0x495544)+_0x41cd81);}else{this[_0x7770('0x33')][_0x7770('0x68')](this,_0x10ab9f,rs[_0x7770('0x10e')]({'charset':'*','length':_0x4ad72f}));}}else{this[_0x7770('0x33')]['sync'](this,_0x10ab9f,'');}}else{this['createSquareDetailsReport'][_0x7770('0x68')](this,_0x10ab9f,_0x5d0981);}return _0x364a7b;};AGIVertices[_0x7770('0x12')][_0x7770('0xe')]=function(_0x242ee0){logger[_0x7770('0x2b')](util[_0x7770('0x27')](_0x7770('0x112'),_0x242ee0[_0x7770('0xa8')]));return this['getdigits'](_0x242ee0);};AGIVertices[_0x7770('0x12')]['goal']=function(_0x2af03a){logger[_0x7770('0x2b')](util['format'](_0x7770('0x113'),_0x2af03a['label']));this[_0x7770('0x33')]['sync'](this,_0x2af03a,_0x2af03a[_0x7770('0x114')]);return this[_0x7770('0xf')][_0x7770('0xa3')](util[_0x7770('0x27')](_0x7770('0x115'),_0x2af03a[_0x7770('0x114')]));};AGIVertices['prototype']['awspolly']=function(_0x56ddc1){logger['info'](util[_0x7770('0x27')](_0x7770('0x116'),_0x56ddc1[_0x7770('0xa8')]));if(!this[_0x7770('0x7d')](_0x56ddc1[_0x7770('0x80')])||!this[_0x7770('0x7d')](_0x56ddc1[_0x7770('0x81')])){return this[_0x7770('0xf')][_0x7770('0xa3')](_0x7770('0x117'));}if(!this[_0x7770('0x7d')](_0x56ddc1[_0x7770('0x56')])){return this[_0x7770('0xf')][_0x7770('0xa3')](_0x7770('0xc2'));}this[_0x7770('0xf')]['noop'](util[_0x7770('0x27')](_0x7770('0x118'),_0x56ddc1[_0x7770('0x56')]));var _0x3c9924=this[_0x7770('0x7f')]['sync'](this,_0x56ddc1);if(_0x3c9924){this[_0x7770('0xf')][_0x7770('0xa3')](util[_0x7770('0x27')](_0x7770('0x119'),_0x3c9924));var _0x314118=this[_0x7770('0xf')][_0x7770('0xf9')](_0x3c9924);try{fs[_0x7770('0xfa')](_0x3c9924+_0x7770('0xfb'));}catch(_0x3a83ad){logger[_0x7770('0x29')](_0x3a83ad);}return _0x314118;}return this[_0x7770('0xf')][_0x7770('0x29')](_0x56ddc1,_0x7770('0x11a'));};AGIVertices[_0x7770('0x12')][_0x7770('0x11b')]=function(_0x1fe0c6){logger[_0x7770('0x2b')](util[_0x7770('0x27')](_0x7770('0x11c'),_0x1fe0c6[_0x7770('0xa8')]));if(!this['isConfigured'](_0x1fe0c6['aws_access_key_id'])||!this[_0x7770('0x7d')](_0x1fe0c6[_0x7770('0x81')])){return this[_0x7770('0xf')][_0x7770('0xa3')](_0x7770('0x117'));}if(!this[_0x7770('0x7d')](_0x1fe0c6[_0x7770('0x86')])){return this[_0x7770('0xf')]['noop']('no\x20bot\x20name\x20configured');}if(!this[_0x7770('0x7d')](_0x1fe0c6['text'])){return this['channel'][_0x7770('0xa3')](_0x7770('0xc2'));}this[_0x7770('0xf')][_0x7770('0xe2')]=!![];this[_0x7770('0x33')](_0x1fe0c6);this[_0x7770('0x3d')](_0x1fe0c6[_0x7770('0x56')],'in','','');this['channel'][_0x7770('0xa3')](util[_0x7770('0x27')](_0x7770('0x11d'),_0x1fe0c6[_0x7770('0x56')]));var _0x220108=this['awsLex']['sync'](this,_0x1fe0c6);if(_0x220108){for(var _0xba8651 in _0x220108){if(_0x220108[_0x7770('0x8e')](_0xba8651)&&_['isString'](_0x220108[_0xba8651])){this[_0x7770('0xf')][_0x7770('0x99')](util[_0x7770('0x27')](_0x7770('0x11e'),_0xba8651[_0x7770('0xee')]()),_0x220108[_0xba8651]);}}if(_[_0x7770('0x40')](_0x220108[_0x7770('0x6f')])){return this['channel'][_0x7770('0xa3')](_0x7770('0x11f'));}else{this[_0x7770('0x3d')](_0x220108[_0x7770('0x6f')],_0x7770('0xef'),_0x7770('0x120'),'');return this[_0x7770('0xf')][_0x7770('0xa3')](util[_0x7770('0x27')](_0x7770('0x121'),_0x220108[_0x7770('0x6f')]));}}return this[_0x7770('0xf')][_0x7770('0x29')](_0x1fe0c6,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x7770('0x12')][_0x7770('0x122')]=function(_0x5bad67){logger['info'](util[_0x7770('0x27')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x5bad67['label'],_0x5bad67[_0x7770('0x62')]));if(!this[_0x7770('0x7d')](_0x5bad67[_0x7770('0x73')])){return this[_0x7770('0xf')][_0x7770('0xa3')](_0x7770('0xe1'));}var _0x5c22c5='wav';var _0x257a7d=util['format'](_0x7770('0x123'),FILES_PATH,rs[_0x7770('0x10e')](0x4));var _0x57b3d3=util[_0x7770('0x27')]('%s.%s',_0x257a7d,_0x5c22c5);var _0x316907=!![];if(_0x5bad67['beep']===_0x7770('0x124')){_0x316907=![];}var _0x55afa2=this[_0x7770('0xf')][_0x7770('0x125')](_0x257a7d,_0x5c22c5,_0x5bad67[_0x7770('0x126')],_0x5bad67[_0x7770('0x62')],undefined,_0x316907);if(_0x55afa2[_0x7770('0x9e')]!==-0x1){this[_0x7770('0xf')][_0x7770('0xa3')](util[_0x7770('0x27')](_0x7770('0x127'),_0x57b3d3));var _0x5b8c47=this[_0x7770('0x87')][_0x7770('0x68')](this,_0x5bad67,_0x57b3d3);if(_0x5b8c47){for(var _0x5069ff in _0x5b8c47){if(_0x5b8c47[_0x7770('0x8e')](_0x5069ff)){this['channel'][_0x7770('0x99')](util[_0x7770('0x27')]('GOOGLE_ASR_%s',_0x5069ff[_0x7770('0xee')]()),_0x5b8c47[_0x5069ff]);}}return this[_0x7770('0xf')][_0x7770('0xa3')](util[_0x7770('0x27')](_0x7770('0x128'),JSON['stringify'](_0x5b8c47)));}}return _0x55afa2;};AGIVertices[_0x7770('0x12')][_0x7770('0x129')]=function(_0x54a9d3){logger[_0x7770('0x2b')](util[_0x7770('0x27')](_0x7770('0x12a'),_0x54a9d3[_0x7770('0xa8')]));if(!this[_0x7770('0x7d')](_0x54a9d3[_0x7770('0x8a')])){return this[_0x7770('0xf')][_0x7770('0xa3')]('no\x20appid\x20configured');}if(!this[_0x7770('0x7d')](_0x54a9d3[_0x7770('0x8b')])){return this[_0x7770('0xf')][_0x7770('0xa3')](_0x7770('0x12b'));}var _0x2b3a9d=_0x7770('0x12c');var _0x428ff=util['format'](_0x7770('0x123'),FILES_PATH,rs['generate'](0x4));var _0x47473c=util[_0x7770('0x27')]('%s.%s',_0x428ff,_0x2b3a9d);var _0x3260e2=!![];if(_0x54a9d3[_0x7770('0x12d')]===_0x7770('0x124')){_0x3260e2=![];}var _0x2bc2e0=this[_0x7770('0xf')][_0x7770('0x125')](_0x428ff,_0x2b3a9d,_0x54a9d3[_0x7770('0x126')],_0x54a9d3['timeout'],undefined,_0x3260e2);if(_0x2bc2e0[_0x7770('0x9e')]!==-0x1){this[_0x7770('0xf')][_0x7770('0xa3')](util[_0x7770('0x27')]('tilde\x20%s\x20file\x20created',_0x47473c));var _0x293bd8=this['tildeASR'][_0x7770('0x68')](this,_0x54a9d3,_0x47473c);if(_0x293bd8){for(var _0x477f33 in _0x293bd8){if(_0x293bd8['hasOwnProperty'](_0x477f33)){this[_0x7770('0xf')]['setVariable'](util['format'](_0x7770('0x12e'),_0x477f33['toUpperCase']()),_0x293bd8[_0x477f33]);}}return this['channel'][_0x7770('0xa3')](util[_0x7770('0x27')](_0x7770('0x12f'),JSON[_0x7770('0x6b')](_0x293bd8)));}}return _0x2bc2e0;};AGIVertices[_0x7770('0x12')][_0x7770('0x130')]=function(_0x57d446){logger[_0x7770('0x2b')](util['format']('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x57d446['label']));return this[_0x7770('0xf')][_0x7770('0x131')](_0x57d446[_0x7770('0x37')],_0x57d446[_0x7770('0x38')],_0x57d446['priority']);};AGIVertices['prototype']['gotoif']=function(_0x94bf4c){logger[_0x7770('0x2b')](util[_0x7770('0x27')](_0x7770('0x132'),_0x94bf4c[_0x7770('0xa8')]));if(!this['isConfigured'](_0x94bf4c[_0x7770('0x133')])){return this['channel'][_0x7770('0x29')](_0x94bf4c,'no\x20condition\x20configured');}try{var _0x328e00=eval(_0x94bf4c[_0x7770('0x133')])?_0x7770('0x134'):_0x7770('0x135');this[_0x7770('0xf')][_0x7770('0xa3')](util[_0x7770('0x27')]('EVAL\x20CONDITION\x20%s\x20%s',_0x94bf4c[_0x7770('0x133')],_0x328e00));return{'code':0xc8,'result':_0x328e00};}catch(_0xda509f){return{'code':0xc8,'result':'false'};}};AGIVertices['prototype']['gotoiftime']=function(_0x3bf81b){logger[_0x7770('0x2b')](util[_0x7770('0x27')](_0x7770('0x136'),_0x3bf81b[_0x7770('0xa8')]));if(!this[_0x7770('0x7d')](_0x3bf81b['interval_id'])){return this[_0x7770('0xf')]['error'](_0x3bf81b,_0x7770('0x137'));}var _0x2b99a3=this['getIntervals']['sync'](this,_0x3bf81b[_0x7770('0x138')]);if(!_0x2b99a3){return this['channel'][_0x7770('0x29')](_0x3bf81b,_0x7770('0x139'));}for(var _0x144526=0x0;_0x144526<_0x2b99a3[_0x7770('0x98')];_0x144526+=0x1){var _0x46f7cc=this[_0x7770('0xf')][_0x7770('0x13')](util['format'](_0x7770('0x13a'),_0x2b99a3[_0x144526]));if(_0x46f7cc[_0x7770('0x9e')]===-0x1){return _0x46f7cc;}logger[_0x7770('0x2b')](util['format']('IFTIME\x20%s\x20%s',_0x2b99a3[_0x144526],_0x46f7cc[_0x7770('0x9c')]));if(_0x46f7cc[_0x7770('0x9c')]==='true'){logger[_0x7770('0x2b')](util[_0x7770('0x27')](_0x7770('0x13b'),_0x2b99a3[_0x144526],_0x7770('0x134')));this['channel'][_0x7770('0xa3')](util[_0x7770('0x27')](_0x7770('0x13b'),_0x2b99a3[_0x144526],'true'));return{'code':0xc8,'result':_0x7770('0x134')};}else{logger[_0x7770('0x2b')](util[_0x7770('0x27')](_0x7770('0x13b'),_0x2b99a3[_0x144526],_0x7770('0x135')));this[_0x7770('0xf')][_0x7770('0xa3')](util[_0x7770('0x27')](_0x7770('0x13b'),_0x2b99a3[_0x144526],_0x7770('0x135')));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0x7770('0x12')][_0x7770('0x13c')]=function(_0x16d053){logger[_0x7770('0x2b')](util[_0x7770('0x27')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x16d053[_0x7770('0xa8')]));return this[_0x7770('0xf')][_0x7770('0x13c')]();};AGIVertices[_0x7770('0x12')]['ispeechasr']=function(_0x22f3e1){logger['info'](util[_0x7770('0x27')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x22f3e1[_0x7770('0xa8')]));if(!this[_0x7770('0x7d')](_0x22f3e1[_0x7770('0x73')])){return this[_0x7770('0xf')][_0x7770('0xa3')](_0x7770('0xe1'));}var _0x2f231d=_0x7770('0x12c');var _0xd9c3dc=util[_0x7770('0x27')](_0x7770('0x123'),FILES_PATH,rs[_0x7770('0x10e')](0x4));var _0x2813e7=util[_0x7770('0x27')]('%s.%s',_0xd9c3dc,_0x2f231d);var _0x51f03f=!![];if(_0x22f3e1[_0x7770('0x12d')]===_0x7770('0x124')){_0x51f03f=![];}var _0x45de89=this[_0x7770('0xf')]['recordFile'](_0xd9c3dc,_0x2f231d,_0x22f3e1[_0x7770('0x126')],_0x22f3e1[_0x7770('0x62')],undefined,_0x51f03f);if(_0x45de89['result']!==-0x1){this[_0x7770('0xf')]['noop'](util['format'](_0x7770('0x13d'),_0x2813e7));var _0x50fa4f=this[_0x7770('0x7c')]['sync'](this,_0x22f3e1,_0x2813e7);if(_0x50fa4f){for(var _0x20e6db in _0x50fa4f){if(_0x50fa4f[_0x7770('0x8e')](_0x20e6db)){this[_0x7770('0xf')][_0x7770('0x99')](util[_0x7770('0x27')](_0x7770('0x13e'),_0x20e6db[_0x7770('0xee')]()),_0x50fa4f[_0x20e6db]);}}return this['channel']['noop'](util['format'](_0x7770('0x13f'),JSON['stringify'](_0x50fa4f)));}}return _0x45de89;};AGIVertices[_0x7770('0x12')][_0x7770('0x140')]=function(_0x55c029){logger[_0x7770('0x2b')](util[_0x7770('0x27')](_0x7770('0x141'),_0x55c029[_0x7770('0xa8')]));if(!this[_0x7770('0x7d')](_0x55c029['key'])){return this['channel'][_0x7770('0xa3')](_0x7770('0xe1'));}if(!this[_0x7770('0x7d')](_0x55c029[_0x7770('0x56')])){return this[_0x7770('0xf')][_0x7770('0xa3')]('no\x20text\x20configured');}this['channel'][_0x7770('0xa3')](util[_0x7770('0x27')](_0x7770('0x142'),_0x55c029[_0x7770('0x56')]));var _0x1df8dc=this[_0x7770('0x143')][_0x7770('0x68')](this,_0x55c029);if(_0x1df8dc){this[_0x7770('0xf')][_0x7770('0xa3')](util[_0x7770('0x27')](_0x7770('0x13d'),_0x1df8dc));var _0x5cc14d=this[_0x7770('0xf')][_0x7770('0xf9')](_0x1df8dc,_0x55c029[_0x7770('0x126')]);try{fs[_0x7770('0xfa')](_0x1df8dc+'.wav');}catch(_0xf348d5){logger['error'](_0xf348d5);}return _0x5cc14d;}return this[_0x7770('0xf')][_0x7770('0x29')](_0x55c029,_0x7770('0x144'));};AGIVertices['prototype'][_0x7770('0x145')]=function(_0x4d4a39){logger[_0x7770('0x2b')](util['format']('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x4d4a39[_0x7770('0xa8')]));if(!this[_0x7770('0x7d')](_0x4d4a39[_0x7770('0x146')])){return this['channel'][_0x7770('0x29')](_0x4d4a39,'no\x20find\x20by\x20configured');}logger[_0x7770('0x2b')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x7770('0xf')][_0x7770('0x4b')],_0x4d4a39[_0x7770('0x146')]));var _0x4e0838=this[_0x7770('0x4f')][_0x7770('0x68')](this,_0x4d4a39['findBy']);if(_0x4e0838){logger[_0x7770('0x2b')](util[_0x7770('0x27')](_0x7770('0x147'),this[_0x7770('0xf')][_0x7770('0x4b')],_0x4d4a39[_0x7770('0x146')]));this['channel'][_0x7770('0xa3')](util[_0x7770('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x7770('0xf')][_0x7770('0x4b')],_0x4d4a39[_0x7770('0x146')]));return{'code':0xc8,'result':_0x7770('0x148')};}else{logger['info'](util['format'](_0x7770('0x149'),this['channel']['callerid'],_0x4d4a39['findBy']));this[_0x7770('0xf')][_0x7770('0xa3')](util[_0x7770('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x7770('0x4b')],_0x4d4a39[_0x7770('0x146')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x7770('0x12')][_0x7770('0x14a')]=function(_0x426d6a){logger[_0x7770('0x2b')](util[_0x7770('0x27')](_0x7770('0x14b'),_0x426d6a['label']));if(!this['isConfigured'](_0x426d6a[_0x7770('0x146')])){return this['channel'][_0x7770('0x29')](_0x426d6a,_0x7770('0x14c'));}logger[_0x7770('0x2b')](util[_0x7770('0x27')](_0x7770('0x14d'),this['channel'][_0x7770('0x4b')],_0x426d6a['findBy']));var _0x47222e=this[_0x7770('0x4d')]['sync'](this,_0x426d6a['findBy']);if(_0x47222e){logger[_0x7770('0x2b')](util[_0x7770('0x27')](_0x7770('0x147'),this[_0x7770('0xf')][_0x7770('0x4b')],_0x426d6a[_0x7770('0x146')]));this[_0x7770('0xf')]['noop'](util[_0x7770('0x27')](_0x7770('0x147'),this['channel']['callerid'],_0x426d6a['findBy']));return{'code':0xc8,'result':_0x7770('0x148')};}else{logger[_0x7770('0x2b')](util[_0x7770('0x27')](_0x7770('0x149'),this[_0x7770('0xf')][_0x7770('0x4b')],_0x426d6a[_0x7770('0x146')]));this[_0x7770('0xf')]['noop'](util[_0x7770('0x27')](_0x7770('0x149'),this['channel'][_0x7770('0x4b')],_0x426d6a[_0x7770('0x146')]));return{'code':0xc8,'result':_0x7770('0x14e')};}};AGIVertices[_0x7770('0x12')][_0x7770('0x14f')]=function(_0x2aa9d6){logger[_0x7770('0x2b')](util[_0x7770('0x27')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x2aa9d6['label']));if(!this[_0x7770('0x7d')](_0x2aa9d6[_0x7770('0x150')])){return this[_0x7770('0xf')]['error'](_0x2aa9d6,_0x7770('0x151'));}this[_0x7770('0xf')]['noop'](util[_0x7770('0x27')](_0x7770('0x152'),_0x2aa9d6[_0x7770('0x150')]));var _0x138379=eval(_0x2aa9d6[_0x7770('0x150')]);if(!this['isConfigured'](_0x2aa9d6[_0x7770('0xd2')])){return this[_0x7770('0xf')][_0x7770('0xa3')](_0x7770('0xd3'));}var _0x1dcabe=this[_0x7770('0x13')][_0x7770('0x68')](this,_0x2aa9d6[_0x7770('0xd2')]);if(!_0x1dcabe){return this[_0x7770('0xf')][_0x7770('0x29')](_0x2aa9d6,_0x7770('0xd4'));}if(_[_0x7770('0x95')](_0x138379)){var _0x5b77b0=this;_0x138379[_0x7770('0xd5')](function(_0x8b95e0,_0x41d951){_0x5b77b0[_0x7770('0xf')]['setVariable'](util[_0x7770('0x27')](_0x7770('0x153'),_0x1dcabe,_0x41d951),_0x8b95e0);});return this['channel'][_0x7770('0xa3')](util['format']('variable\x20%s[key]\x20set',_0x1dcabe));}else{return this[_0x7770('0xf')][_0x7770('0x99')](_0x1dcabe,_0x138379);}};AGIVertices['prototype'][_0x7770('0xc')]=function(_0x56abbf){logger[_0x7770('0x2b')](util[_0x7770('0x27')](_0x7770('0x154'),_0x56abbf[_0x7770('0xa8')]));if(_0x56abbf[_0x7770('0xa1')]===0x0){return this[_0x7770('0xa0')](_0x56abbf);}_0x56abbf[_0x7770('0xa1')]-=0x1;if(!this['isConfigured'](_0x56abbf['file_id'])){return this[_0x7770('0xf')][_0x7770('0x29')](_0x56abbf,_0x7770('0x155'));}var _0x156f8a=this['getSound'][_0x7770('0x68')](this,_0x56abbf[_0x7770('0x156')]);if(!_0x156f8a){return this[_0x7770('0xf')][_0x7770('0x29')](_0x56abbf,_0x7770('0x106'));}var _0x277497=this[_0x7770('0xf')][_0x7770('0x107')](_0x156f8a,_0x56abbf[_0x7770('0x108')],_0x56abbf[_0x7770('0x157')]);var _0x1aefff=_0x277497[_0x7770('0x9e')];if(_0x277497['result']===-0x1){this['createSquareDetailsReport'][_0x7770('0x68')](this,_0x56abbf,'-1');return _0x277497;}else if(_0x277497[_0x7770('0x9c')]===_0x7770('0x62')){_0x277497[_0x7770('0x9e')]=_0x277497['result'][_0x7770('0x98')]>0x0?_0x277497[_0x7770('0x9e')]:'t';}else if(_[_0x7770('0x3f')](_0x277497[_0x7770('0x9e')])){_0x277497[_0x7770('0x9e')]='#';_0x1aefff='#';}if(!this['isConfigured'](_0x56abbf['variable_id'])){this[_0x7770('0xf')][_0x7770('0xa3')](_0x7770('0xd3'));}else{var _0x35c2b8=this[_0x7770('0x13')][_0x7770('0x68')](this,_0x56abbf[_0x7770('0xd2')]);if(!_0x35c2b8){return this[_0x7770('0xf')][_0x7770('0x29')](_0x56abbf,_0x7770('0xd4'));}this[_0x7770('0xf')][_0x7770('0x99')](_0x35c2b8,_0x1aefff);}this[_0x7770('0x33')][_0x7770('0x68')](this,_0x56abbf,_0x1aefff);return _0x277497;};AGIVertices[_0x7770('0x12')]['noop']=function(_0x640fce){logger[_0x7770('0x2b')](util[_0x7770('0x27')](_0x7770('0x158'),_0x640fce[_0x7770('0xa8')]));return this['channel'][_0x7770('0xa3')](_0x640fce['output']||_0x640fce['label']);};AGIVertices['prototype'][_0x7770('0x159')]=function(_0x55bcc2){logger[_0x7770('0x2b')](util[_0x7770('0x27')](_0x7770('0x15a'),_0x55bcc2['label']));if(!this[_0x7770('0x7d')](_0x55bcc2[_0x7770('0x146')])){return this[_0x7770('0xf')][_0x7770('0x29')](_0x55bcc2,'no\x20find\x20by\x20configured');}logger[_0x7770('0x2b')](util[_0x7770('0x27')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x7770('0xf')]['callerid'],_0x55bcc2[_0x7770('0x146')]));var _0xa2d6dc=this['getPause'][_0x7770('0x68')](this,_0x55bcc2[_0x7770('0x15b')]);var _0xa34394=this[_0x7770('0x15c')][_0x7770('0x68')](this,_0x55bcc2[_0x7770('0x146')],_0xa2d6dc);if(_0xa34394){logger[_0x7770('0x2b')](util[_0x7770('0x27')](_0x7770('0x147'),this[_0x7770('0xf')][_0x7770('0x4b')],_0x55bcc2[_0x7770('0x146')]));this['channel'][_0x7770('0xa3')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x7770('0xf')][_0x7770('0x4b')],_0x55bcc2[_0x7770('0x146')]));return{'code':0xc8,'result':_0x7770('0x148')};}else{logger['info'](util[_0x7770('0x27')](_0x7770('0x149'),this[_0x7770('0xf')][_0x7770('0x4b')],_0x55bcc2[_0x7770('0x146')]));this[_0x7770('0xf')]['noop'](util[_0x7770('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x7770('0xf')][_0x7770('0x4b')],_0x55bcc2[_0x7770('0x146')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x7770('0x12')][_0x7770('0x15d')]=function(_0x389bc1){logger['info'](util[_0x7770('0x27')](_0x7770('0x15e'),_0x389bc1[_0x7770('0xa8')]));if(!this['isConfigured'](_0x389bc1[_0x7770('0x156')])){return this[_0x7770('0xf')][_0x7770('0x29')](_0x389bc1,_0x7770('0x155'));}var _0x4b3451=this[_0x7770('0x1d')][_0x7770('0x68')](this,_0x389bc1['file_id']);if(!_0x4b3451){return this[_0x7770('0xf')][_0x7770('0x29')](_0x389bc1,_0x7770('0x106'));}var _0x429462=this[_0x7770('0xf')]['exec']('PLAYBACK',[_0x4b3451,_0x389bc1[_0x7770('0xdf')]]);if(_0x429462[_0x7770('0x9e')]===-0x1){return _0x429462;}return this[_0x7770('0xf')][_0x7770('0xa3')](util[_0x7770('0x27')](_0x7770('0xbf'),_0x7770('0x15f'),_0x4b3451));};AGIVertices['prototype'][_0x7770('0x160')]=function(_0x3ad084){logger[_0x7770('0x2b')](util[_0x7770('0x27')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x3ad084[_0x7770('0xa8')]));if(!this[_0x7770('0x7d')](_0x3ad084[_0x7770('0x161')])){return this[_0x7770('0xf')][_0x7770('0x29')](_0x3ad084,_0x7770('0x162'));}var _0x89a8b7='';var _0x351bf4=parseInt(_0x3ad084['queue_id'],0xa);if(isNaN(_0x351bf4)){_0x89a8b7=_0x3ad084[_0x7770('0x161')];}else{_0x89a8b7=this[_0x7770('0x163')][_0x7770('0x68')](this,_0x3ad084[_0x7770('0x161')]);if(!_0x89a8b7){return this[_0x7770('0xf')][_0x7770('0x29')](_0x3ad084,_0x7770('0x164'));}}var _0x15a63a='';if(this[_0x7770('0x7d')](_0x3ad084[_0x7770('0x156')])){var _0x4394c1=this['getSound']['sync'](this,_0x3ad084[_0x7770('0x156')]);if(_0x4394c1){_0x15a63a=_0x4394c1;}}this[_0x7770('0x33')][_0x7770('0x68')](this,_0x3ad084,_0x89a8b7);if(_0x3ad084[_0x7770('0xdf')]['indexOf']('x')<0x0){_0x3ad084[_0x7770('0xdf')]+='x';}if(_0x3ad084[_0x7770('0xdf')]['indexOf']('X')<0x0){_0x3ad084['opts']+='X';}this[_0x7770('0xf')][_0x7770('0x99')](_0x7770('0x165'),_0x89a8b7?_0x89a8b7[_0x7770('0x166')]():'');var _0x5cd72e=this['channel'][_0x7770('0xa4')](_0x7770('0x167'),[_0x89a8b7,_0x3ad084[_0x7770('0xdf')],_0x3ad084[_0x7770('0x5f')],_0x15a63a,_0x3ad084[_0x7770('0x62')],_0x3ad084[_0x7770('0x6')],_0x3ad084[_0x7770('0x168')],_0x3ad084[_0x7770('0x169')],'',_0x3ad084[_0x7770('0x16a')]]);if(_0x5cd72e[_0x7770('0x9e')]===-0x1){return _0x5cd72e;}return this[_0x7770('0xf')][_0x7770('0xa3')](util[_0x7770('0x27')](_0x7770('0xbf'),_0x7770('0x167'),_0x89a8b7));};AGIVertices[_0x7770('0x12')][_0x7770('0x16b')]=function(_0x32c6db){logger[_0x7770('0x2b')](util[_0x7770('0x27')](_0x7770('0x16c'),_0x32c6db[_0x7770('0xa8')]));var _0x17e751=_0x32c6db['recordingFormat']||_0x7770('0x12c');var _0x2d1b42=util[_0x7770('0x27')](_0x7770('0x16d'),this[_0x7770('0xf')][_0x7770('0x46')],rs['generate'](0x5));var _0x67690e=util[_0x7770('0x27')](_0x7770('0x16e'),FILES_PATH,_0x2d1b42,_0x17e751);var _0x2e5a45=util['format'](_0x7770('0x123'),FILES_PATH,_0x2d1b42);this[_0x7770('0x35')][_0x7770('0x68')](this,_0x32c6db,_0x2d1b42,_0x67690e);this[_0x7770('0xf')][_0x7770('0x99')](_0x7770('0x16f'),_0x2d1b42);logger[_0x7770('0x2b')](_0x7770('0x170'),_0x2e5a45,_0x17e751,_0x32c6db[_0x7770('0x171')],_0x32c6db[_0x7770('0x62')]);return this[_0x7770('0xf')][_0x7770('0x125')](_0x2e5a45,_0x17e751,_0x32c6db['escape_digits'],_0x32c6db[_0x7770('0x62')],undefined,!![]);};AGIVertices[_0x7770('0x12')]['restapi']=function(_0x319d04){logger[_0x7770('0x2b')](util['format'](_0x7770('0x172'),_0x319d04['label']));if(!this[_0x7770('0x7d')](_0x319d04['url'])){return this['channel'][_0x7770('0xa3')](_0x7770('0x173'));}var _0x4fae93=this[_0x7770('0x5e')][_0x7770('0x68')](this,_0x319d04);logger['info'](util[_0x7770('0x27')](_0x7770('0x174'),util['inspect'](_0x4fae93,{'showHidden':![],'depth':null})));if(!this[_0x7770('0x7d')](_0x319d04[_0x7770('0xd2')])){return this[_0x7770('0xf')]['noop'](_0x7770('0x175'));}var _0x26dc37=this[_0x7770('0x13')][_0x7770('0x68')](this,_0x319d04[_0x7770('0xd2')]);if(!_0x26dc37){return this[_0x7770('0xf')][_0x7770('0x29')](_0x319d04,_0x7770('0xd4'));}this[_0x7770('0xf')][_0x7770('0x99')](util[_0x7770('0x27')]('%s_STATUS_CODE',_0x26dc37),_0x4fae93['statusCode']?_0x4fae93[_0x7770('0x6d')]:'200');this[_0x7770('0xf')][_0x7770('0x99')](util[_0x7770('0x27')](_0x7770('0x176'),_0x26dc37),_0x4fae93[_0x7770('0x6e')]?_0x4fae93[_0x7770('0x6e')]:'OK');if(_0x4fae93[_0x7770('0x64')]){try{this[_0x7770('0x96')](_0x4fae93['body'],_0x26dc37);}catch(_0x35aa78){logger[_0x7770('0x29')](util[_0x7770('0x27')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x26dc37));}}return this[_0x7770('0xf')]['noop'](util[_0x7770('0x27')](_0x7770('0xd8'),_0x26dc37));};AGIVertices[_0x7770('0x12')]['saydigits']=function(_0xdf2906){logger[_0x7770('0x2b')](util[_0x7770('0x27')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0xdf2906[_0x7770('0xa8')]));return this[_0x7770('0xf')]['sayDigits'](_0xdf2906[_0x7770('0x177')][_0x7770('0x52')](/\s+/g,''),_0xdf2906['escape_digits']);};AGIVertices[_0x7770('0x12')]['saynumber']=function(_0x3c2926){logger[_0x7770('0x2b')](util['format']('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x3c2926['label']));return this[_0x7770('0xf')][_0x7770('0x178')](_0x3c2926['number']['replace'](/\s+/g,''),_0x3c2926[_0x7770('0x171')]);};AGIVertices[_0x7770('0x12')][_0x7770('0x179')]=function(_0x1a39e2){logger[_0x7770('0x2b')](util['format'](_0x7770('0x17a'),_0x1a39e2[_0x7770('0xa8')]));return this['channel']['sayPhonetic'](_0x1a39e2['text'],_0x1a39e2[_0x7770('0x171')]);};AGIVertices[_0x7770('0x12')][_0x7770('0x17b')]=function(_0x3c91f3){logger[_0x7770('0x2b')](util[_0x7770('0x27')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x3c91f3['label']));if(!this[_0x7770('0x7d')](_0x3c91f3[_0x7770('0x17c')])){return this['channel'][_0x7770('0xa3')](_0x7770('0x17d'));}var _0x4e1a5d=this[_0x7770('0x17e')]['sync'](this,_0x3c91f3[_0x7770('0x17c')]);if(!_0x4e1a5d||!_0x4e1a5d[_0x7770('0x17f')]){return this[_0x7770('0xf')]['error'](_0x3c91f3,_0x7770('0x180'));}var _0x240d8c={'from':util['format'](_0x7770('0x181'),_0x4e1a5d[_0x7770('0x15')],_0x4e1a5d[_0x7770('0x182')]||_0x4e1a5d['Smtp'][_0x7770('0x183')]),'to':_0x3c91f3['to']||'','cc':_0x3c91f3['cc']||'','bcc':_0x3c91f3['bcc']||'','subject':_0x3c91f3['subject'],'html':_0x3c91f3[_0x7770('0x56')],'text':_0x3c91f3['text']};var _0x3b7c95={'tls':{'rejectUnauthorized':![]}};if(_0x4e1a5d['Smtp']['service']){_0x3b7c95['service']=_0x4e1a5d[_0x7770('0x17f')][_0x7770('0x184')];}else{_0x3b7c95[_0x7770('0x185')]=_0x4e1a5d[_0x7770('0x17f')][_0x7770('0x185')];_0x3b7c95[_0x7770('0x186')]=_0x4e1a5d[_0x7770('0x17f')][_0x7770('0x186')];_0x3b7c95[_0x7770('0x187')]=_0x4e1a5d[_0x7770('0x17f')][_0x7770('0x187')];}if(_0x4e1a5d[_0x7770('0x17f')]['authentication']){_0x3b7c95[_0x7770('0x188')]={'user':_0x4e1a5d[_0x7770('0x17f')]['user'],'pass':_0x4e1a5d['Smtp'][_0x7770('0x189')]};}if(this['isConfigured'](_0x3c91f3[_0x7770('0x18a')])){}logger[_0x7770('0x18b')](_0x7770('0x18c'),JSON[_0x7770('0x6b')](_0x240d8c));this[_0x7770('0x33')][_0x7770('0x68')](this,_0x3c91f3,_0x3c91f3[_0x7770('0x17c')]);this['channel'][_0x7770('0xa3')](util[_0x7770('0x27')](_0x7770('0x18d'),_0x4e1a5d[_0x7770('0x15')]));this[_0x7770('0x21')][_0x7770('0x68')](this,_0x3b7c95,_0x240d8c);return this[_0x7770('0xf')][_0x7770('0xa3')](_0x7770('0x18e'));};AGIVertices['prototype'][_0x7770('0x18f')]=function(_0x5afe80){logger['info'](util['format'](_0x7770('0x190'),_0x5afe80[_0x7770('0xa8')]));return this[_0x7770('0xf')][_0x7770('0xa3')](_0x7770('0x191'));};AGIVertices['prototype'][_0x7770('0x192')]=function(_0x395fe9){logger[_0x7770('0x2b')](util[_0x7770('0x27')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x395fe9['label']));if(!this[_0x7770('0x7d')](_0x395fe9[_0x7770('0x193')])){return this[_0x7770('0xf')][_0x7770('0xa3')]('no\x20sms\x20account\x20configured');}var _0xb0dc5a=this['getSmsAccount']['sync'](this,_0x395fe9['sms_account_id']);if(!_0xb0dc5a){return this['channel']['error'](_0x395fe9,_0x7770('0x194'));}var _0x230258={'body':_0x395fe9[_0x7770('0x195')],'phone':_0x395fe9['to']||'','SmsAccountId':_0xb0dc5a['id']};logger[_0x7770('0x18b')](_0x7770('0x196'),JSON[_0x7770('0x6b')](_0x230258));this[_0x7770('0x33')][_0x7770('0x68')](this,_0x395fe9,_0x395fe9[_0x7770('0x193')]);this[_0x7770('0xf')][_0x7770('0xa3')](util['format'](_0x7770('0x197'),_0xb0dc5a['name']));this['createSmsMessage'][_0x7770('0x68')](this,_0x230258);return this['channel']['noop'](_0x7770('0x198'));};AGIVertices[_0x7770('0x12')]['set']=function(_0x3813dc){logger[_0x7770('0x2b')](util[_0x7770('0x27')](_0x7770('0x199'),_0x3813dc[_0x7770('0xa8')]));if(!this['isConfigured'](_0x3813dc['variable_id'])){return this[_0x7770('0xf')][_0x7770('0x29')](_0x3813dc,_0x7770('0x19a'));}var _0x35f915=this[_0x7770('0x13')]['sync'](this,_0x3813dc[_0x7770('0xd2')]);if(!_0x35f915){return this[_0x7770('0xf')][_0x7770('0x29')](_0x3813dc,_0x7770('0xd4'));}return this['channel'][_0x7770('0x99')](_0x35f915,_0x3813dc[_0x7770('0x19b')]);};AGIVertices[_0x7770('0x12')]['start']=function(_0xe4ac54){logger[_0x7770('0x2b')](util[_0x7770('0x27')](_0x7770('0x19c'),_0xe4ac54[_0x7770('0xa8')]));this['channel']['noop'](_0x7770('0x19d'));if(_0xe4ac54[_0x7770('0xb3')]===_0x7770('0x19e')){this[_0x7770('0xf')][_0x7770('0xa3')](_0x7770('0x19f'));return this['channel'][_0x7770('0xb3')]();}return this[_0x7770('0xf')][_0x7770('0xa3')](_0x7770('0x1a0'));};AGIVertices[_0x7770('0x12')]['subproject']=function(_0x5ac827){logger[_0x7770('0x2b')](util[_0x7770('0x27')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x5ac827[_0x7770('0xa8')]));if(!this['isConfigured'](_0x5ac827[_0x7770('0x1a1')])){return this[_0x7770('0xf')][_0x7770('0x29')](_0x5ac827,_0x7770('0x1a2'));}var _0x5d1bb8=this[_0x7770('0x1a3')]['sync'](this,_0x5ac827[_0x7770('0x1a1')]);if(!this['isConfigured'](_0x5d1bb8)){return this['channel']['error'](_0x5ac827,util['format'](_0x7770('0x1a4'),_0x5ac827[_0x7770('0x1a1')]));}if(_0x5d1bb8===this[_0x7770('0xf')][_0x7770('0x34')]){return this[_0x7770('0xf')][_0x7770('0x29')](_0x5ac827,_0x7770('0x1a5'));}this[_0x7770('0x33')][_0x7770('0x68')](this,_0x5ac827,_0x5d1bb8);var _0x29b8ae=this[_0x7770('0xf')][_0x7770('0xa4')](_0x7770('0x1a6'),util[_0x7770('0x27')](_0x7770('0x1a7'),config['agi'][_0x7770('0x185')]||_0x7770('0x1a8'),_0x5d1bb8,this['channel'][_0x7770('0x34')]));if(_0x29b8ae[_0x7770('0x9e')]===-0x1){return _0x29b8ae;}return this[_0x7770('0xf')][_0x7770('0xa3')](util[_0x7770('0x27')](_0x7770('0xbf'),_0x7770('0x1a6'),_0x5d1bb8));};AGIVertices[_0x7770('0x12')][_0x7770('0x1a9')]=function(_0xf2ec9b){logger[_0x7770('0x2b')](util[_0x7770('0x27')](_0x7770('0x1aa'),_0xf2ec9b[_0x7770('0xa8')]));var _0x25303e=this[_0x7770('0x50')][_0x7770('0x68')](this,_0xf2ec9b['command']);this[_0x7770('0x33')][_0x7770('0x68')](this,_0xf2ec9b,_0xf2ec9b[_0x7770('0x1ab')]);if(this[_0x7770('0x7d')](_0xf2ec9b[_0x7770('0xd2')])){var _0x2e6b6b=this['getVariable'][_0x7770('0x68')](this,_0xf2ec9b[_0x7770('0xd2')]);if(_0x2e6b6b){this[_0x7770('0xf')][_0x7770('0x99')](_0x2e6b6b,_0x25303e);return this['channel'][_0x7770('0xa3')](util[_0x7770('0x27')](_0x7770('0x1ac'),_0xf2ec9b[_0x7770('0x1ab')],_0x2e6b6b));}}return this[_0x7770('0xf')][_0x7770('0xa3')](util['format'](_0x7770('0x1ad'),_0xf2ec9b['command']));};AGIVertices[_0x7770('0x12')][_0x7770('0x1ae')]=function(_0x5b57e5){logger[_0x7770('0x2b')](util[_0x7770('0x27')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x5b57e5['label']));_0x5b57e5[_0x7770('0x56')]=_0x5b57e5[_0x7770('0x56')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x7770('0x7d')](_0x5b57e5[_0x7770('0x54')])){return this[_0x7770('0xf')][_0x7770('0xa3')](_0x7770('0x1af'));}if(!this[_0x7770('0x7d')](_0x5b57e5[_0x7770('0x56')])){return this[_0x7770('0xf')][_0x7770('0xa3')](_0x7770('0xc2'));}this[_0x7770('0xf')][_0x7770('0xa3')](util[_0x7770('0x27')](_0x7770('0x1b0'),_0x5b57e5[_0x7770('0x56')]));var _0x37024a=this[_0x7770('0x53')][_0x7770('0x68')](this,_0x5b57e5);if(_0x37024a){this[_0x7770('0xf')][_0x7770('0xa3')](util[_0x7770('0x27')](_0x7770('0x1b1'),_0x37024a));var _0x1257d6=this[_0x7770('0xf')][_0x7770('0xf9')](_0x37024a);try{fs[_0x7770('0xfa')](_0x37024a+_0x7770('0xfb'));}catch(_0x43e3a4){logger[_0x7770('0x29')](_0x43e3a4);}return _0x1257d6;}return this[_0x7770('0xf')]['error'](_0x5b57e5,_0x7770('0x1b2'));};AGIVertices[_0x7770('0x12')][_0x7770('0x1b3')]=function(_0x53ad2e){logger[_0x7770('0x2b')](util[_0x7770('0x27')](_0x7770('0x1b4'),_0x53ad2e[_0x7770('0xa8')]));_0x53ad2e['text']=_0x53ad2e[_0x7770('0x56')][_0x7770('0x52')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x7770('0x7d')](_0x53ad2e[_0x7770('0x56')])){return this[_0x7770('0xf')]['noop'](_0x7770('0xc2'));}this['channel'][_0x7770('0xa3')](util[_0x7770('0x27')]('Trying\x20Google\x20TTS\x20%s',_0x53ad2e[_0x7770('0x56')]));var _0x458574=this[_0x7770('0x5c')][_0x7770('0x68')](this,_0x53ad2e);if(_0x458574){this[_0x7770('0xf')][_0x7770('0xa3')](util[_0x7770('0x27')](_0x7770('0x1b5'),_0x458574));var _0x24766d=this[_0x7770('0xf')][_0x7770('0xf9')](_0x458574);try{fs['unlink'](_0x458574+'.wav');}catch(_0x2ee51f){logger[_0x7770('0x29')](_0x2ee51f);}return _0x24766d;}return this[_0x7770('0xf')][_0x7770('0x29')](_0x53ad2e,_0x7770('0x1b6'));};AGIVertices[_0x7770('0x12')][_0x7770('0x1b7')]=function(_0x3de941){logger[_0x7770('0x2b')](util['format'](_0x7770('0x1b8'),_0x3de941[_0x7770('0xa8')]));if(!this[_0x7770('0x7d')](_0x3de941[_0x7770('0x146')])){return this[_0x7770('0xf')]['error'](_0x3de941,_0x7770('0x14c'));}logger[_0x7770('0x2b')](util[_0x7770('0x27')](_0x7770('0x14d'),this[_0x7770('0xf')][_0x7770('0x4b')],_0x3de941[_0x7770('0x146')]));var _0x2bc338=this[_0x7770('0x4c')]['sync'](this,_0x3de941[_0x7770('0x146')]);if(_0x2bc338){logger['info'](util[_0x7770('0x27')](_0x7770('0x147'),this[_0x7770('0xf')][_0x7770('0x4b')],_0x3de941[_0x7770('0x146')]));this[_0x7770('0xf')][_0x7770('0xa3')](util[_0x7770('0x27')](_0x7770('0x147'),this[_0x7770('0xf')][_0x7770('0x4b')],_0x3de941['findBy']));return{'code':0xc8,'result':_0x7770('0x148')};}else{logger[_0x7770('0x2b')](util['format'](_0x7770('0x149'),this[_0x7770('0xf')]['callerid'],_0x3de941[_0x7770('0x146')]));this['channel']['noop'](util[_0x7770('0x27')](_0x7770('0x149'),this[_0x7770('0xf')][_0x7770('0x4b')],_0x3de941[_0x7770('0x146')]));return{'code':0xc8,'result':_0x7770('0x14e')};}};AGIVertices[_0x7770('0x12')][_0x7770('0x1b9')]=function(_0x3d9a61){logger[_0x7770('0x2b')](util[_0x7770('0x27')](_0x7770('0x1ba'),_0x3d9a61[_0x7770('0xa8')]));var _0x7e970=this['channel'][_0x7770('0xa4')](_0x7770('0x1bb'),[_0x3d9a61[_0x7770('0x1bc')],_0x3d9a61[_0x7770('0x71')]]);if(_0x7e970[_0x7770('0x9e')]===-0x1){return _0x7e970;}return this[_0x7770('0xf')][_0x7770('0xa3')](util[_0x7770('0x27')](_0x7770('0xbf'),'VOICEMAIL',_0x3d9a61[_0x7770('0x1bc')]));};AGIVertices[_0x7770('0x12')][_0x7770('0x1bd')]=function(_0x33868b){logger[_0x7770('0x2b')](util['format'](_0x7770('0x1be'),_0x33868b[_0x7770('0xa8')]));if(!this[_0x7770('0x7d')](_0x33868b[_0x7770('0xd2')])){return this[_0x7770('0xf')][_0x7770('0x29')](_0x33868b,'no\x20variable\x20selected');}var _0x4518a4=this[_0x7770('0x13')][_0x7770('0x68')](this,_0x33868b[_0x7770('0xd2')]);if(!_0x4518a4){return this[_0x7770('0xf')][_0x7770('0x29')](_0x33868b,'no\x20variable\x20found');}var _0x439a87=this[_0x7770('0xf')][_0x7770('0x13')](_0x4518a4);return{'code':0xc8,'result':_0x439a87[_0x7770('0x9c')]?_0x439a87[_0x7770('0x9c')]:'-'};};String[_0x7770('0x12')][_0x7770('0x9b')]=function(_0x5e5b41,_0x29f530){return this['split'](_0x5e5b41)['join'](_0x29f530);};module[_0x7770('0x1bf')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 09641c2..956e051 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 _0x5717=['isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','transfertargetuniqueid','secondtransfereruniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','moment','../ami','../../../config/logger','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','syncAgentConnect','bind','hanguprequest','hangup','syncHangup','syncAgentRingNoAnswer','syncAttendedTransfer','syncBlindTransfer','milliseconds','seconds','startAcw','interface','queue','ACW','mandatoryDisposition','name','mandatoryDispositionPause','QueuePause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','update','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','message','prototype','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest'];(function(_0x111947,_0x43ea55){var _0x2d00f2=function(_0x56f3b9){while(--_0x56f3b9){_0x111947['push'](_0x111947['shift']());}};_0x2d00f2(++_0x43ea55);}(_0x5717,0x1a9));var _0x7571=function(_0x3c452f,_0x13b81a){_0x3c452f=_0x3c452f-0x0;var _0x5425dd=_0x5717[_0x3c452f];return _0x5425dd;};'use strict';var util=require(_0x7571('0x0'));var _=require('lodash');var moment=require(_0x7571('0x1'));var ami=require(_0x7571('0x2'));var logger=require(_0x7571('0x3'))(_0x7571('0x4'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x7571('0x5'));function Acw(_0x1ac2c4){this[_0x7571('0x6')]=_0x1ac2c4[_0x7571('0x6')];this[_0x7571('0x7')]=_0x1ac2c4[_0x7571('0x7')];this[_0x7571('0x8')]=_0x1ac2c4[_0x7571('0x8')];this[_0x7571('0x9')]={};ami['on']('agentconnect',this[_0x7571('0xa')][_0x7571('0xb')](this));ami['on'](_0x7571('0xc'),this['syncHangupRequest'][_0x7571('0xb')](this));ami['on'](_0x7571('0xd'),this[_0x7571('0xe')]['bind'](this));ami['on']('agentringnoanswer',this[_0x7571('0xf')][_0x7571('0xb')](this));ami['on']('attendedtransfer',this[_0x7571('0x10')]['bind'](this));ami['on']('blindtransfer',this[_0x7571('0x11')][_0x7571('0xb')](this));ami['on']('custom:agentConnectPreview',this['syncAgentConnectPreview'][_0x7571('0xb')](this));}function getDiff(_0x102795){var _0x3393ad=moment()[_0x7571('0x12')](0x0);var _0x5522de=moment(_0x102795)[_0x7571('0x12')](0x0);return _0x3393ad['diff'](_0x5522de,_0x7571('0x13'));}Acw['prototype'][_0x7571('0x14')]=function(_0xef0057){try{var _0x2ec498=this;var _0x483c3b=this[_0x7571('0x9')][_0xef0057][_0x7571('0x15')];var _0x5a6f3a=this[_0x7571('0x9')][_0xef0057][_0x7571('0x16')];var _0x10fc37=this['voiceQueues'][_0x5a6f3a];var _0x405c96=![];var _0x378831=_0x7571('0x17');if(_0x10fc37[_0x7571('0x18')]){if(_0x10fc37['mandatoryDispositionPause'][_0x7571('0x19')]){_0x405c96=!![];_0x378831=_0x10fc37[_0x7571('0x1a')][_0x7571('0x19')];}}ami['Action']({'action':_0x7571('0x1b'),'interface':_0x483c3b,'paused':!![],'reason':_0x378831})[_0x7571('0x1c')](function(_0x5ba9d4){if(_0x2ec498[_0x7571('0x7')][_0x483c3b]){return RpcUser[_0x7571('0x1d')](_0x2ec498[_0x7571('0x7')][_0x483c3b]['id'])[_0x7571('0x1c')](function(_0x545cf8){if(_0x545cf8&&!_0x545cf8[_0x7571('0x1e')]){logger[_0x7571('0x1f')](_0x7571('0x20'),_0xef0057,_0x483c3b,_0x5a6f3a);var _0x1f3b5d=_0x2ec498[_0x7571('0x9')][_0xef0057][_0x7571('0x21')]&&_0x2ec498['channels'][_0xef0057]['destlinkedid']?_0x2ec498['channels'][_0xef0057]['destlinkedid']:_0xef0057;return RpcUser[_0x7571('0x22')](_0x2ec498[_0x7571('0x7')][_0x483c3b],_0x378831,_0x1f3b5d)[_0x7571('0x1c')](function(_0x353973){if(!_0x405c96){_0x2ec498[_0x7571('0x8')][_0x483c3b]={};logger['info'](_0x7571('0x23'),_0xef0057,_0x2ec498[_0x7571('0x6')][_0x5a6f3a][_0x7571('0x24')],_0x483c3b,_0x5a6f3a);_0x2ec498['timers'][_0x483c3b][_0x7571('0x25')]=setTimeout(_0x2ec498[_0x7571('0x26')][_0x7571('0xb')](_0x2ec498,_0x483c3b),_0x2ec498['voiceQueues'][_0x5a6f3a][_0x7571('0x24')]*0x3e8);_0x2ec498[_0x7571('0x8')][_0x483c3b][_0x7571('0x27')]=moment()[_0x7571('0x28')](_0x7571('0x29'));_0x2ec498[_0x7571('0x8')][_0x483c3b][_0x7571('0x2a')]=_0xef0057;_0x2ec498[_0x7571('0x8')][_0x483c3b]['queue']=_0x5a6f3a;_0x2ec498[_0x7571('0x8')][_0x483c3b][_0x7571('0x2b')]=function(){var _0x42991e=getDiff(_0x2ec498[_0x7571('0x8')][_0x483c3b][_0x7571('0x27')]);clearTimeout(_0x2ec498[_0x7571('0x8')][_0x483c3b][_0x7571('0x25')]);_0x2ec498[_0x7571('0x8')][_0x483c3b][_0x7571('0x25')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x42991e},_0x2ec498[_0x7571('0x8')][_0x483c3b][_0x7571('0x2a')],_0x483c3b)[_0x7571('0x1c')](function(_0x5ece2b){logger['info'](_0x7571('0x2c'),_0xef0057,_0x42991e,_0x5ece2b);})[_0x7571('0x2d')](function(_0xcbc944){logger[_0x7571('0x2e')](_0x7571('0x2f'),_0xef0057,_0xcbc944);});delete _0x2ec498[_0x7571('0x8')][_0x483c3b];};}});}else{logger[_0x7571('0x1f')](_0x7571('0x30'),_0xef0057,_0x483c3b,_0x5a6f3a);}});}})[_0x7571('0x2d')](function(_0x2d8269){logger['error'](_0x7571('0x23'),_0xef0057,_0x2ec498[_0x7571('0x6')][_0x5a6f3a][_0x7571('0x24')],_0x483c3b,_0x5a6f3a);})[_0x7571('0x31')](function(){delete _0x2ec498[_0x7571('0x9')][_0xef0057];});}catch(_0x4ee684){logger[_0x7571('0x2e')](_0x7571('0x32'),_0x4ee684['message']);}};Acw['prototype']['stopAcw']=function(_0x175eef){try{var _0xc2f68d=this;if(_0xc2f68d[_0x7571('0x8')][_0x175eef]){_0xc2f68d[_0x7571('0x8')][_0x175eef][_0x7571('0x25')]=![];var _0x4d67e0=_0xc2f68d['timers'][_0x175eef][_0x7571('0x2a')];var _0x13906b=_0xc2f68d[_0x7571('0x8')][_0x175eef][_0x7571('0x16')];var _0x1a1f1a=_0xc2f68d['voiceQueues'][_0x13906b][_0x7571('0x24')];logger[_0x7571('0x1f')](_0x7571('0x33'),_0x4d67e0,_0x175eef);RpcUser[_0x7571('0x34')](this[_0x7571('0x7')][_0x175eef]);RpcVoiceAgentReport[_0x7571('0x35')]({'acwtime':_0x1a1f1a,'agentacw':!![]},_0x4d67e0,_0x175eef)[_0x7571('0x1c')](function(_0x59aca2){logger[_0x7571('0x1f')]('[%s][UPDATE][ACWTIME:%s]',_0x4d67e0,_0x1a1f1a,_0x59aca2);})['catch'](function(_0x3e4709){logger['error'](_0x7571('0x2f'),_0x4d67e0,_0x3e4709);});}else{logger[_0x7571('0x2e')](_0x7571('0x36'),_0x175eef);if(_0xc2f68d[_0x7571('0x8')]){logger[_0x7571('0x1f')](_0x7571('0x37'),JSON[_0x7571('0x38')](_0xc2f68d['timers']));}}}catch(_0x5b8262){logger[_0x7571('0x2e')]('[ACW][STOP]\x20%s',_0x5b8262[_0x7571('0x39')]);}};Acw[_0x7571('0x3a')][_0x7571('0xa')]=function(_0x4411fd){try{if(this[_0x7571('0x6')][_0x4411fd[_0x7571('0x16')]]&&(this[_0x7571('0x6')][_0x4411fd[_0x7571('0x16')]][_0x7571('0x4')]||this['voiceQueues'][_0x4411fd[_0x7571('0x16')]]['mandatoryDisposition'])){if(this[_0x7571('0x7')][_0x4411fd[_0x7571('0x15')]]){this[_0x7571('0x9')][_0x4411fd['uniqueid']]={'queue':_0x4411fd['queue'],'interface':_0x4411fd[_0x7571('0x15')],'destlinkedid':_0x4411fd['destlinkedid']};}}}catch(_0x1cea8e){logger[_0x7571('0x2e')]('[ACW][syncAgentConnect]\x20%s',_0x1cea8e[_0x7571('0x39')]);}};Acw[_0x7571('0x3a')]['syncAgentConnectPreview']=function(_0x10a045){try{if(this[_0x7571('0x6')][_0x10a045[_0x7571('0x16')]]&&(this[_0x7571('0x6')][_0x10a045[_0x7571('0x16')]][_0x7571('0x4')]||this[_0x7571('0x6')][_0x10a045[_0x7571('0x16')]][_0x7571('0x18')])){if(this[_0x7571('0x7')][_0x10a045[_0x7571('0x15')]]){this[_0x7571('0x9')][_0x10a045[_0x7571('0x2a')]]={'queue':_0x10a045[_0x7571('0x16')],'interface':_0x10a045['interface']};}}}catch(_0x2bafef){logger[_0x7571('0x2e')](_0x7571('0x3b'),_0x2bafef[_0x7571('0x39')]);}};Acw[_0x7571('0x3a')][_0x7571('0x3c')]=function(_0x2581ac){try{if(this[_0x7571('0x9')][_0x2581ac[_0x7571('0x2a')]]&&_[_0x7571('0x3d')](this[_0x7571('0x9')][_0x2581ac[_0x7571('0x2a')]]['attended'])){logger[_0x7571('0x1f')](_0x7571('0x3e'),_0x2581ac[_0x7571('0x2a')]);this['startAcw'](_0x2581ac[_0x7571('0x2a')]);}else if(this[_0x7571('0x9')][_0x2581ac[_0x7571('0x3f')]]&&_[_0x7571('0x3d')](this[_0x7571('0x9')][_0x2581ac[_0x7571('0x3f')]][_0x7571('0x21')])){logger[_0x7571('0x1f')](_0x7571('0x40'),_0x2581ac[_0x7571('0x3f')]);this[_0x7571('0x14')](_0x2581ac[_0x7571('0x3f')]);}}catch(_0xeb8ee1){logger[_0x7571('0x2e')]('[ACW][syncHangupRequest]\x20%s',_0xeb8ee1[_0x7571('0x39')]);}};Acw[_0x7571('0x3a')]['syncHangup']=function(_0x4a3bce){try{if(this['channels'][_0x4a3bce[_0x7571('0x2a')]]&&this[_0x7571('0x9')][_0x4a3bce['uniqueid']][_0x7571('0x21')]){logger['info'](_0x7571('0x41'),_0x4a3bce[_0x7571('0x2a')]);this[_0x7571('0x14')](_0x4a3bce['uniqueid']);}else if(this[_0x7571('0x9')][_0x4a3bce[_0x7571('0x3f')]]&&this[_0x7571('0x9')][_0x4a3bce[_0x7571('0x3f')]][_0x7571('0x21')]){logger[_0x7571('0x1f')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x4a3bce[_0x7571('0x3f')]);this[_0x7571('0x14')](_0x4a3bce[_0x7571('0x3f')]);}}catch(_0x391c9f){logger['error'](_0x7571('0x42'),_0x391c9f['message']);}};Acw['prototype'][_0x7571('0x10')]=function(_0x144b25){try{if(!_['isNil'](this['channels'][_0x144b25[_0x7571('0x43')]])){this[_0x7571('0x14')](_0x144b25['transfereeuniqueid']);if(this[_0x7571('0x9')][_0x144b25['secondtransfereruniqueid']]){this[_0x7571('0x9')][_0x144b25['secondtransfereruniqueid']][_0x7571('0x21')]=!![];this[_0x7571('0x9')][_0x144b25[_0x7571('0x44')]]=this[_0x7571('0x9')][_0x144b25[_0x7571('0x45')]];delete this[_0x7571('0x9')][_0x144b25[_0x7571('0x45')]];}}else if(!_['isNil'](this['channels'][_0x144b25[_0x7571('0x44')]])){this[_0x7571('0x14')](_0x144b25[_0x7571('0x44')]);if(this[_0x7571('0x9')][_0x144b25[_0x7571('0x46')]]){this[_0x7571('0x9')][_0x144b25[_0x7571('0x46')]]['attended']=!![];this['channels'][_0x144b25['transfereeuniqueid']]=this[_0x7571('0x9')][_0x144b25[_0x7571('0x46')]];delete this[_0x7571('0x9')][_0x144b25['origtransfereruniqueid']];}}}catch(_0x3d635e){logger[_0x7571('0x2e')](_0x7571('0x47'),_0x3d635e[_0x7571('0x39')]);}};Acw[_0x7571('0x3a')][_0x7571('0x11')]=function(_0x17df6f){try{if(this[_0x7571('0x9')][_0x17df6f[_0x7571('0x48')]]){logger[_0x7571('0x1f')](_0x7571('0x49'),JSON[_0x7571('0x38')](_0x17df6f[_0x7571('0x48')]));this[_0x7571('0x14')](_0x17df6f[_0x7571('0x48')]);}else if(this[_0x7571('0x9')][_0x17df6f['transfererlinkedid']]){logger[_0x7571('0x1f')](_0x7571('0x4a'),JSON['stringify'](_0x17df6f[_0x7571('0x4b')]));this[_0x7571('0x14')](_0x17df6f['transfererlinkedid']);}}catch(_0x764946){logger[_0x7571('0x2e')](_0x7571('0x4c'),_0x764946[_0x7571('0x39')]);}};Acw[_0x7571('0x3a')][_0x7571('0xf')]=function(_0x32a5ca){try{if(this[_0x7571('0x6')][_0x32a5ca[_0x7571('0x16')]]&&this[_0x7571('0x6')][_0x32a5ca[_0x7571('0x16')]][_0x7571('0x4d')]==='all'){if(this[_0x7571('0x7')][_0x32a5ca['interface']]){logger['info'](_0x7571('0x4e'),_0x32a5ca[_0x7571('0x2a')],_0x32a5ca[_0x7571('0x15')],_0x32a5ca[_0x7571('0x16')]);return RpcUser[_0x7571('0x22')](this[_0x7571('0x7')][_0x32a5ca[_0x7571('0x15')]],'Auto-Pause',_0x32a5ca[_0x7571('0x2a')]);}}}catch(_0xb5d2d6){logger[_0x7571('0x2e')](_0x7571('0x4f'),_0xb5d2d6[_0x7571('0x39')]);}};module[_0x7571('0x50')]=Acw; \ No newline at end of file +var _0x4ffe=['[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','[ACW][syncAgentRingNoAnswer]\x20%s','util','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','agentconnect','syncAgentConnect','bind','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','milliseconds','diff','seconds','startAcw','interface','channels','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','acwTimeout','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','timer','update','[%s][UPDATE][ACWTIME:%s]','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','prototype','stopAcw','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','catch','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','message','[ACW][syncAgentConnect]\x20%s','attended','[%s][HANGUP:UNIQUEID]','isUndefined','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereeuniqueid','[ACW][syncAttendedTransfer]\x20%s'];(function(_0xa82688,_0x3d82f0){var _0x5c1582=function(_0x3214e2){while(--_0x3214e2){_0xa82688['push'](_0xa82688['shift']());}};_0x5c1582(++_0x3d82f0);}(_0x4ffe,0x110));var _0xe4ff=function(_0x2598f0,_0x3d61ff){_0x2598f0=_0x2598f0-0x0;var _0x4448c8=_0x4ffe[_0x2598f0];return _0x4448c8;};'use strict';var util=require(_0xe4ff('0x0'));var _=require(_0xe4ff('0x1'));var moment=require(_0xe4ff('0x2'));var ami=require(_0xe4ff('0x3'));var logger=require(_0xe4ff('0x4'))(_0xe4ff('0x5'));var RpcUser=require(_0xe4ff('0x6'));var RpcVoiceAgentReport=require(_0xe4ff('0x7'));function Acw(_0xd5cd37){this[_0xe4ff('0x8')]=_0xd5cd37[_0xe4ff('0x8')];this[_0xe4ff('0x9')]=_0xd5cd37[_0xe4ff('0x9')];this[_0xe4ff('0xa')]=_0xd5cd37['timers'];this['channels']={};ami['on'](_0xe4ff('0xb'),this[_0xe4ff('0xc')][_0xe4ff('0xd')](this));ami['on']('hanguprequest',this[_0xe4ff('0xe')][_0xe4ff('0xd')](this));ami['on'](_0xe4ff('0xf'),this[_0xe4ff('0x10')][_0xe4ff('0xd')](this));ami['on'](_0xe4ff('0x11'),this[_0xe4ff('0x12')][_0xe4ff('0xd')](this));ami['on'](_0xe4ff('0x13'),this[_0xe4ff('0x14')][_0xe4ff('0xd')](this));ami['on']('blindtransfer',this[_0xe4ff('0x15')][_0xe4ff('0xd')](this));ami['on']('custom:agentConnectPreview',this['syncAgentConnectPreview'][_0xe4ff('0xd')](this));}function getDiff(_0x425cdc){var _0x75b821=moment()[_0xe4ff('0x16')](0x0);var _0x2b0c9b=moment(_0x425cdc)[_0xe4ff('0x16')](0x0);return _0x75b821[_0xe4ff('0x17')](_0x2b0c9b,_0xe4ff('0x18'));}Acw['prototype'][_0xe4ff('0x19')]=function(_0x3246e0){try{var _0x40766a=this;var _0x4aa2c5=this['channels'][_0x3246e0][_0xe4ff('0x1a')];var _0x573a49=this[_0xe4ff('0x1b')][_0x3246e0][_0xe4ff('0x1c')];var _0xd22fb3=this[_0xe4ff('0x8')][_0x573a49];var _0x1e7d2d=![];var _0x13c8d0=_0xe4ff('0x1d');if(_0xd22fb3[_0xe4ff('0x1e')]){if(_0xd22fb3[_0xe4ff('0x1f')][_0xe4ff('0x20')]){_0x1e7d2d=!![];_0x13c8d0=_0xd22fb3[_0xe4ff('0x1f')][_0xe4ff('0x20')];}}ami[_0xe4ff('0x21')]({'action':_0xe4ff('0x22'),'interface':_0x4aa2c5,'paused':!![],'reason':_0x13c8d0})[_0xe4ff('0x23')](function(_0x2f6a3f){if(_0x40766a[_0xe4ff('0x9')][_0x4aa2c5]){return RpcUser[_0xe4ff('0x24')](_0x40766a[_0xe4ff('0x9')][_0x4aa2c5]['id'])[_0xe4ff('0x23')](function(_0x24a88e){if(_0x24a88e&&!_0x24a88e[_0xe4ff('0x25')]){logger[_0xe4ff('0x26')](_0xe4ff('0x27'),_0x3246e0,_0x4aa2c5,_0x573a49);var _0x208c54=_0x40766a['channels'][_0x3246e0]['attended']&&_0x40766a['channels'][_0x3246e0]['destlinkedid']?_0x40766a['channels'][_0x3246e0][_0xe4ff('0x28')]:_0x3246e0;return RpcUser[_0xe4ff('0x29')](_0x40766a[_0xe4ff('0x9')][_0x4aa2c5],_0x13c8d0,_0x208c54)[_0xe4ff('0x23')](function(_0x3f087e){if(!_0x1e7d2d){_0x40766a[_0xe4ff('0xa')][_0x4aa2c5]={};logger[_0xe4ff('0x26')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x3246e0,_0x40766a[_0xe4ff('0x8')][_0x573a49][_0xe4ff('0x2a')],_0x4aa2c5,_0x573a49);_0x40766a['timers'][_0x4aa2c5]['timer']=setTimeout(_0x40766a['stopAcw'][_0xe4ff('0xd')](_0x40766a,_0x4aa2c5),_0x40766a[_0xe4ff('0x8')][_0x573a49][_0xe4ff('0x2a')]*0x3e8);_0x40766a[_0xe4ff('0xa')][_0x4aa2c5][_0xe4ff('0x2b')]=moment()[_0xe4ff('0x2c')](_0xe4ff('0x2d'));_0x40766a[_0xe4ff('0xa')][_0x4aa2c5][_0xe4ff('0x2e')]=_0x3246e0;_0x40766a['timers'][_0x4aa2c5][_0xe4ff('0x1c')]=_0x573a49;_0x40766a[_0xe4ff('0xa')][_0x4aa2c5]['updateAcw']=function(){var _0x1d5b91=getDiff(_0x40766a[_0xe4ff('0xa')][_0x4aa2c5]['lastPauseAt']);clearTimeout(_0x40766a[_0xe4ff('0xa')][_0x4aa2c5][_0xe4ff('0x2f')]);_0x40766a[_0xe4ff('0xa')][_0x4aa2c5][_0xe4ff('0x2f')]=![];RpcVoiceAgentReport[_0xe4ff('0x30')]({'acwtime':_0x1d5b91},_0x40766a[_0xe4ff('0xa')][_0x4aa2c5]['uniqueid'],_0x4aa2c5)['then'](function(_0x6abf86){logger['info'](_0xe4ff('0x31'),_0x3246e0,_0x1d5b91,_0x6abf86);})['catch'](function(_0x4d6093){logger[_0xe4ff('0x32')](_0xe4ff('0x33'),_0x3246e0,_0x4d6093);});delete _0x40766a['timers'][_0x4aa2c5];};}});}else{logger[_0xe4ff('0x26')](_0xe4ff('0x34'),_0x3246e0,_0x4aa2c5,_0x573a49);}});}})['catch'](function(_0x3bf468){logger[_0xe4ff('0x32')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x3246e0,_0x40766a[_0xe4ff('0x8')][_0x573a49][_0xe4ff('0x2a')],_0x4aa2c5,_0x573a49);})[_0xe4ff('0x35')](function(){delete _0x40766a[_0xe4ff('0x1b')][_0x3246e0];});}catch(_0x2e88bb){logger['error'](_0xe4ff('0x36'),_0x2e88bb['message']);}};Acw[_0xe4ff('0x37')][_0xe4ff('0x38')]=function(_0x40e2e3){try{var _0x5dec2b=this;if(_0x5dec2b[_0xe4ff('0xa')][_0x40e2e3]){_0x5dec2b['timers'][_0x40e2e3][_0xe4ff('0x2f')]=![];var _0x57b520=_0x5dec2b[_0xe4ff('0xa')][_0x40e2e3]['uniqueid'];var _0x5e28b9=_0x5dec2b['timers'][_0x40e2e3][_0xe4ff('0x1c')];var _0x4d1706=_0x5dec2b[_0xe4ff('0x8')][_0x5e28b9][_0xe4ff('0x2a')];logger['info'](_0xe4ff('0x39'),_0x57b520,_0x40e2e3);RpcUser[_0xe4ff('0x3a')](this['agents'][_0x40e2e3]);RpcVoiceAgentReport[_0xe4ff('0x30')]({'acwtime':_0x4d1706,'agentacw':!![]},_0x57b520,_0x40e2e3)[_0xe4ff('0x23')](function(_0x3acba3){logger[_0xe4ff('0x26')]('[%s][UPDATE][ACWTIME:%s]',_0x57b520,_0x4d1706,_0x3acba3);})[_0xe4ff('0x3b')](function(_0x406f65){logger[_0xe4ff('0x32')]('[%s][UPDATE][ERRORS:%s]',_0x57b520,_0x406f65);});}else{logger[_0xe4ff('0x32')](_0xe4ff('0x3c'),_0x40e2e3);if(_0x5dec2b[_0xe4ff('0xa')]){logger['info'](_0xe4ff('0x3d'),JSON[_0xe4ff('0x3e')](_0x5dec2b[_0xe4ff('0xa')]));}}}catch(_0x2b1967){logger[_0xe4ff('0x32')](_0xe4ff('0x3f'),_0x2b1967[_0xe4ff('0x40')]);}};Acw['prototype'][_0xe4ff('0xc')]=function(_0x27f83){try{if(this[_0xe4ff('0x8')][_0x27f83[_0xe4ff('0x1c')]]&&(this[_0xe4ff('0x8')][_0x27f83['queue']][_0xe4ff('0x5')]||this[_0xe4ff('0x8')][_0x27f83['queue']][_0xe4ff('0x1e')])){if(this[_0xe4ff('0x9')][_0x27f83['interface']]){this['channels'][_0x27f83[_0xe4ff('0x2e')]]={'queue':_0x27f83[_0xe4ff('0x1c')],'interface':_0x27f83[_0xe4ff('0x1a')],'destlinkedid':_0x27f83[_0xe4ff('0x28')]};}}}catch(_0x14312b){logger[_0xe4ff('0x32')](_0xe4ff('0x41'),_0x14312b[_0xe4ff('0x40')]);}};Acw['prototype']['syncAgentConnectPreview']=function(_0xadd6fe){try{if(this['voiceQueues'][_0xadd6fe[_0xe4ff('0x1c')]]&&(this[_0xe4ff('0x8')][_0xadd6fe['queue']][_0xe4ff('0x5')]||this[_0xe4ff('0x8')][_0xadd6fe[_0xe4ff('0x1c')]][_0xe4ff('0x1e')])){if(this[_0xe4ff('0x9')][_0xadd6fe[_0xe4ff('0x1a')]]){this[_0xe4ff('0x1b')][_0xadd6fe[_0xe4ff('0x2e')]]={'queue':_0xadd6fe[_0xe4ff('0x1c')],'interface':_0xadd6fe[_0xe4ff('0x1a')]};}}}catch(_0x1b5103){logger[_0xe4ff('0x32')]('[ACW][syncAgentConnectPreview]\x20%s',_0x1b5103[_0xe4ff('0x40')]);}};Acw[_0xe4ff('0x37')][_0xe4ff('0xe')]=function(_0x5060c8){try{if(this[_0xe4ff('0x1b')][_0x5060c8[_0xe4ff('0x2e')]]&&_['isUndefined'](this[_0xe4ff('0x1b')][_0x5060c8['uniqueid']][_0xe4ff('0x42')])){logger[_0xe4ff('0x26')](_0xe4ff('0x43'),_0x5060c8[_0xe4ff('0x2e')]);this[_0xe4ff('0x19')](_0x5060c8[_0xe4ff('0x2e')]);}else if(this[_0xe4ff('0x1b')][_0x5060c8['linkedid']]&&_[_0xe4ff('0x44')](this[_0xe4ff('0x1b')][_0x5060c8[_0xe4ff('0x45')]][_0xe4ff('0x42')])){logger[_0xe4ff('0x26')](_0xe4ff('0x46'),_0x5060c8['linkedid']);this[_0xe4ff('0x19')](_0x5060c8[_0xe4ff('0x45')]);}}catch(_0x187424){logger[_0xe4ff('0x32')](_0xe4ff('0x47'),_0x187424[_0xe4ff('0x40')]);}};Acw[_0xe4ff('0x37')][_0xe4ff('0x10')]=function(_0xed3401){try{if(this[_0xe4ff('0x1b')][_0xed3401[_0xe4ff('0x2e')]]&&this[_0xe4ff('0x1b')][_0xed3401['uniqueid']]['attended']){logger[_0xe4ff('0x26')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0xed3401[_0xe4ff('0x2e')]);this[_0xe4ff('0x19')](_0xed3401['uniqueid']);}else if(this[_0xe4ff('0x1b')][_0xed3401[_0xe4ff('0x45')]]&&this[_0xe4ff('0x1b')][_0xed3401[_0xe4ff('0x45')]]['attended']){logger[_0xe4ff('0x26')](_0xe4ff('0x48'),_0xed3401[_0xe4ff('0x45')]);this['startAcw'](_0xed3401[_0xe4ff('0x45')]);}}catch(_0x41e8a6){logger['error'](_0xe4ff('0x49'),_0x41e8a6['message']);}};Acw[_0xe4ff('0x37')][_0xe4ff('0x14')]=function(_0x54121c){try{if(!_[_0xe4ff('0x4a')](this[_0xe4ff('0x1b')][_0x54121c['transfereeuniqueid']])){this[_0xe4ff('0x19')](_0x54121c['transfereeuniqueid']);if(this[_0xe4ff('0x1b')][_0x54121c[_0xe4ff('0x4b')]]){this['channels'][_0x54121c[_0xe4ff('0x4b')]][_0xe4ff('0x42')]=!![];this[_0xe4ff('0x1b')][_0x54121c[_0xe4ff('0x4c')]]=this[_0xe4ff('0x1b')][_0x54121c[_0xe4ff('0x4b')]];delete this[_0xe4ff('0x1b')][_0x54121c['secondtransfereruniqueid']];}}else if(!_[_0xe4ff('0x4a')](this[_0xe4ff('0x1b')][_0x54121c[_0xe4ff('0x4c')]])){this[_0xe4ff('0x19')](_0x54121c['transfertargetuniqueid']);if(this[_0xe4ff('0x1b')][_0x54121c[_0xe4ff('0x4d')]]){this[_0xe4ff('0x1b')][_0x54121c[_0xe4ff('0x4d')]][_0xe4ff('0x42')]=!![];this['channels'][_0x54121c[_0xe4ff('0x4e')]]=this[_0xe4ff('0x1b')][_0x54121c[_0xe4ff('0x4d')]];delete this['channels'][_0x54121c['origtransfereruniqueid']];}}}catch(_0x1732e4){logger['error'](_0xe4ff('0x4f'),_0x1732e4[_0xe4ff('0x40')]);}};Acw[_0xe4ff('0x37')][_0xe4ff('0x15')]=function(_0x546470){try{if(this[_0xe4ff('0x1b')][_0x546470['transfereruniqueid']]){logger[_0xe4ff('0x26')](_0xe4ff('0x50'),JSON[_0xe4ff('0x3e')](_0x546470['transfereruniqueid']));this[_0xe4ff('0x19')](_0x546470[_0xe4ff('0x51')]);}else if(this[_0xe4ff('0x1b')][_0x546470[_0xe4ff('0x52')]]){logger[_0xe4ff('0x26')](_0xe4ff('0x53'),JSON[_0xe4ff('0x3e')](_0x546470['transfererlinkedid']));this[_0xe4ff('0x19')](_0x546470[_0xe4ff('0x52')]);}}catch(_0x37f1eb){logger['error'](_0xe4ff('0x54'),_0x37f1eb[_0xe4ff('0x40')]);}};Acw['prototype'][_0xe4ff('0x12')]=function(_0x404619){try{if(this[_0xe4ff('0x8')][_0x404619[_0xe4ff('0x1c')]]&&this[_0xe4ff('0x8')][_0x404619[_0xe4ff('0x1c')]]['autopause']===_0xe4ff('0x55')){if(this[_0xe4ff('0x9')][_0x404619[_0xe4ff('0x1a')]]){logger[_0xe4ff('0x26')](_0xe4ff('0x56'),_0x404619[_0xe4ff('0x2e')],_0x404619['interface'],_0x404619['queue']);return RpcUser[_0xe4ff('0x29')](this[_0xe4ff('0x9')][_0x404619['interface']],'Auto-Pause',_0x404619[_0xe4ff('0x2e')]);}}}catch(_0x3845fd){logger[_0xe4ff('0x32')](_0xe4ff('0x57'),_0x3845fd[_0xe4ff('0x40')]);}};module['exports']=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 61c488d..5fea4f6 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 _0xb1eb=['shutdown','inspect','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipShowRegistry','catch','log','exports','asterisk-manager','bluebird','util','lodash','../../config/logger','ami','../../config/environment','asterisk','password','keepConnected','Action','promisify','action','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','port','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','actionQueueSummary','actionCoreShowChannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','error','close','connect'];(function(_0x29ee22,_0x4d7559){var _0x2e7a29=function(_0x561137){while(--_0x561137){_0x29ee22['push'](_0x29ee22['shift']());}};_0x2e7a29(++_0x4d7559);}(_0xb1eb,0x172));var _0xbb1e=function(_0x362f68,_0x396471){_0x362f68=_0x362f68-0x0;var _0x15dde4=_0xb1eb[_0x362f68];return _0x15dde4;};'use strict';var Manager=require(_0xbb1e('0x0'));var BPromise=require(_0xbb1e('0x1'));var moment=require('moment');var util=require(_0xbb1e('0x2'));var _=require(_0xbb1e('0x3'));var logger=require(_0xbb1e('0x4'))(_0xbb1e('0x5'));var config=require(_0xbb1e('0x6'));var ami=new Manager(config[_0xbb1e('0x7')]['port'],config[_0xbb1e('0x7')]['ip'],config[_0xbb1e('0x7')]['username'],config[_0xbb1e('0x7')][_0xbb1e('0x8')],!![]);ami[_0xbb1e('0x9')]();ami[_0xbb1e('0xa')]=BPromise[_0xbb1e('0xb')](ami[_0xbb1e('0xc')]);function error(_0x2cde43){logger['error'](util[_0xbb1e('0xd')](_0xbb1e('0xe'),config['asterisk'][_0xbb1e('0xf')],config[_0xbb1e('0x7')]['ip'],config[_0xbb1e('0x7')][_0xbb1e('0x10')],util['inspect'](_0x2cde43,![],null)));}function close(){logger['error'](util[_0xbb1e('0xd')](_0xbb1e('0x11'),config[_0xbb1e('0x7')][_0xbb1e('0xf')],config[_0xbb1e('0x7')]['ip'],config[_0xbb1e('0x7')][_0xbb1e('0x10')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0xbb1e('0xa')]({'action':_0xbb1e('0x12')});};};ami[_0xbb1e('0x13')]=function(){return function(){return ami[_0xbb1e('0xa')]({'action':_0xbb1e('0x14')});};};ami[_0xbb1e('0x15')]=function(){return function(){return ami[_0xbb1e('0xa')]({'action':'sippeerstatus'});};};ami[_0xbb1e('0x16')]=function(){return function(){return ami[_0xbb1e('0xa')]({'action':'queuesummary'});};};ami[_0xbb1e('0x17')]=function(){return function(){return ami[_0xbb1e('0xa')]({'action':'coreshowchannels'});};};function connect(_0x42fd11){logger[_0xbb1e('0x18')](util[_0xbb1e('0xd')](_0xbb1e('0x19'),config['asterisk']['username'],config[_0xbb1e('0x7')]['ip'],config[_0xbb1e('0x7')]['port']));ami[_0xbb1e('0x1a')](_0xbb1e('0x1b'),error);ami[_0xbb1e('0x1a')](_0xbb1e('0x1c'),close);}ami['on'](_0xbb1e('0x1d'),connect);ami['on'](_0xbb1e('0x1e'),function(_0x3b45aa){logger[_0xbb1e('0x18')](util[_0xbb1e('0xd')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0xbb1e('0x7')]['username'],config['asterisk']['ip'],config['asterisk'][_0xbb1e('0x10')],util[_0xbb1e('0x1f')](_0x3b45aa,![],null)));});ami['on'](_0xbb1e('0x20'),function(_0x3db5f0){logger['info'](util['format'](_0xbb1e('0x21'),config[_0xbb1e('0x7')][_0xbb1e('0xf')],config[_0xbb1e('0x7')]['ip'],config[_0xbb1e('0x7')]['port']));return BPromise[_0xbb1e('0x22')]()[_0xbb1e('0x23')](ami[_0xbb1e('0x24')]())[_0xbb1e('0x23')](ami['actionDeviceStateList']())[_0xbb1e('0x23')](ami[_0xbb1e('0x15')]())[_0xbb1e('0x23')](ami[_0xbb1e('0x16')]())['then'](ami[_0xbb1e('0x17')]())[_0xbb1e('0x25')](function(_0x40aafa){console[_0xbb1e('0x26')](_0x40aafa);});});ami[_0xbb1e('0x1a')](_0xbb1e('0x1b'),error);ami[_0xbb1e('0x1a')](_0xbb1e('0x1c'),close);module[_0xbb1e('0x27')]=ami; \ No newline at end of file +var _0x5c35=['actionQueueSummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','error','once','shutdown','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','actionDeviceStateList','then','actionSipPeerStatus','catch','close','exports','asterisk-manager','bluebird','util','lodash','../../config/logger','ami','port','username','asterisk','password','keepConnected','Action','action','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','devicestatelist','sippeerstatus'];(function(_0x435681,_0x5e6a4a){var _0x157d07=function(_0x4b2bed){while(--_0x4b2bed){_0x435681['push'](_0x435681['shift']());}};_0x157d07(++_0x5e6a4a);}(_0x5c35,0x167));var _0x55c3=function(_0x2ec393,_0x32cd0e){_0x2ec393=_0x2ec393-0x0;var _0x66fc75=_0x5c35[_0x2ec393];return _0x66fc75;};'use strict';var Manager=require(_0x55c3('0x0'));var BPromise=require(_0x55c3('0x1'));var moment=require('moment');var util=require(_0x55c3('0x2'));var _=require(_0x55c3('0x3'));var logger=require(_0x55c3('0x4'))(_0x55c3('0x5'));var config=require('../../config/environment');var ami=new Manager(config['asterisk'][_0x55c3('0x6')],config['asterisk']['ip'],config['asterisk'][_0x55c3('0x7')],config[_0x55c3('0x8')][_0x55c3('0x9')],!![]);ami[_0x55c3('0xa')]();ami[_0x55c3('0xb')]=BPromise['promisify'](ami[_0x55c3('0xc')]);function error(_0x1acca8){logger['error'](util[_0x55c3('0xd')](_0x55c3('0xe'),config[_0x55c3('0x8')][_0x55c3('0x7')],config[_0x55c3('0x8')]['ip'],config[_0x55c3('0x8')][_0x55c3('0x6')],util[_0x55c3('0xf')](_0x1acca8,![],null)));}function close(){logger['error'](util[_0x55c3('0xd')](_0x55c3('0x10'),config[_0x55c3('0x8')][_0x55c3('0x7')],config['asterisk']['ip'],config[_0x55c3('0x8')][_0x55c3('0x6')]));}ami[_0x55c3('0x11')]=function(){return function(){return ami[_0x55c3('0xb')]({'action':_0x55c3('0x12')});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x55c3('0xb')]({'action':_0x55c3('0x13')});};};ami['actionSipPeerStatus']=function(){return function(){return ami['Action']({'action':_0x55c3('0x14')});};};ami[_0x55c3('0x15')]=function(){return function(){return ami[_0x55c3('0xb')]({'action':'queuesummary'});};};ami[_0x55c3('0x16')]=function(){return function(){return ami[_0x55c3('0xb')]({'action':_0x55c3('0x17')});};};function connect(_0xb6fa25){logger[_0x55c3('0x18')](util[_0x55c3('0xd')](_0x55c3('0x19'),config[_0x55c3('0x8')][_0x55c3('0x7')],config[_0x55c3('0x8')]['ip'],config[_0x55c3('0x8')][_0x55c3('0x6')]));ami['once'](_0x55c3('0x1a'),error);ami[_0x55c3('0x1b')]('close',close);}ami['on']('connect',connect);ami['on'](_0x55c3('0x1c'),function(_0x132e53){logger[_0x55c3('0x18')](util[_0x55c3('0xd')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0x55c3('0x8')][_0x55c3('0x7')],config[_0x55c3('0x8')]['ip'],config[_0x55c3('0x8')]['port'],util[_0x55c3('0xf')](_0x132e53,![],null)));});ami['on'](_0x55c3('0x1d'),function(_0x1c85a1){logger['info'](util[_0x55c3('0xd')](_0x55c3('0x1e'),config[_0x55c3('0x8')][_0x55c3('0x7')],config[_0x55c3('0x8')]['ip'],config['asterisk'][_0x55c3('0x6')]));return BPromise[_0x55c3('0x1f')]()['then'](ami[_0x55c3('0x11')]())['then'](ami[_0x55c3('0x20')]())[_0x55c3('0x21')](ami[_0x55c3('0x22')]())[_0x55c3('0x21')](ami[_0x55c3('0x15')]())['then'](ami[_0x55c3('0x16')]())[_0x55c3('0x23')](function(_0x1bc25f){console['log'](_0x1bc25f);});});ami[_0x55c3('0x1b')](_0x55c3('0x1a'),error);ami['once'](_0x55c3('0x24'),close);module[_0x55c3('0x25')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 71bf3ac..fc6880b 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 _0xa9e0=['result','catch','exports','jayson/promise','bluebird','../../config/logger','http','request','debug','rpc','error','message'];(function(_0x159f8e,_0x258d08){var _0x458e17=function(_0xafee19){while(--_0xafee19){_0x159f8e['push'](_0x159f8e['shift']());}};_0x458e17(++_0x258d08);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('ami');var client=jayson['client'][_0x0a9e('0x3')]({'port':0x2329});client['Request']=function(_0x333808,_0x432180){return new BPromise(function(_0x2ab90b,_0x991246){return client[_0x0a9e('0x4')](_0x333808,_0x432180)['then'](function(_0x219af0){logger[_0x0a9e('0x5')](_0x0a9e('0x6'),'memberReport',_0x333808,_0x432180,_0x219af0);if(_0x219af0['error']){logger[_0x0a9e('0x7')]('rpc','memberReport',_0x333808,_0x219af0[_0x0a9e('0x7')][_0x0a9e('0x8')],_0x432180);return _0x991246(_0x219af0[_0x0a9e('0x7')][_0x0a9e('0x8')]);}else{return _0x2ab90b(_0x219af0[_0x0a9e('0x9')]);}})[_0x0a9e('0xa')](function(_0x4a4c56){logger['error']('rpc','memberReport',_0x333808,_0x4a4c56,_0x432180);return _0x991246(_0x4a4c56);});});};module[_0x0a9e('0xb')]=client; \ No newline at end of file +var _0xe706=['result','catch','exports','jayson/promise','bluebird','../../config/logger','client','http','Request','request','then','debug','rpc','memberReport','error','message'];(function(_0x581249,_0x483f03){var _0x284bae=function(_0x2faadd){while(--_0x2faadd){_0x581249['push'](_0x581249['shift']());}};_0x284bae(++_0x483f03);}(_0xe706,0xa3));var _0x6e70=function(_0x221ba2,_0x79208){_0x221ba2=_0x221ba2-0x0;var _0x47d08e=_0xe706[_0x221ba2];return _0x47d08e;};'use strict';var jayson=require(_0x6e70('0x0'));var BPromise=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('ami');var client=jayson[_0x6e70('0x3')][_0x6e70('0x4')]({'port':0x2329});client[_0x6e70('0x5')]=function(_0x7dfbc3,_0x142c27){return new BPromise(function(_0x2164a4,_0x376a8d){return client[_0x6e70('0x6')](_0x7dfbc3,_0x142c27)[_0x6e70('0x7')](function(_0x4381d1){logger[_0x6e70('0x8')](_0x6e70('0x9'),_0x6e70('0xa'),_0x7dfbc3,_0x142c27,_0x4381d1);if(_0x4381d1[_0x6e70('0xb')]){logger[_0x6e70('0xb')](_0x6e70('0x9'),_0x6e70('0xa'),_0x7dfbc3,_0x4381d1[_0x6e70('0xb')][_0x6e70('0xc')],_0x142c27);return _0x376a8d(_0x4381d1[_0x6e70('0xb')][_0x6e70('0xc')]);}else{return _0x2164a4(_0x4381d1[_0x6e70('0xd')]);}})[_0x6e70('0xe')](function(_0x4600f9){logger['error']('rpc',_0x6e70('0xa'),_0x7dfbc3,_0x4600f9,_0x142c27);return _0x376a8d(_0x4600f9);});});};module[_0x6e70('0xf')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 810fd44..0ca53a4 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 _0x9bf6=['name','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','getCaller','voiceQueue','dialCutDigit','prototype','exports','lodash','isNil','string','uniqueid','Contact','firstName','lastName','number','phone','queue'];(function(_0x11140a,_0x311fb7){var _0x562bd7=function(_0x32d317){while(--_0x32d317){_0x11140a['push'](_0x11140a['shift']());}};_0x562bd7(++_0x311fb7);}(_0x9bf6,0x146));var _0x69bf=function(_0x33f26c,_0x6a39d4){_0x33f26c=_0x33f26c-0x0;var _0xac0fec=_0x9bf6[_0x33f26c];return _0xac0fec;};'use strict';var util=require('util');var _=require(_0x69bf('0x0'));var moment=require('moment');function checkNameSurname(_0x143525,_0x16c0bb,_0x15e117){var _0x19e274='';if(!_[_0x69bf('0x1')](_0x16c0bb)&&_0x69bf('0x2')===typeof _0x16c0bb){_0x19e274+=_0x16c0bb;}if(!_['isNil'](_0x15e117)&&_0x69bf('0x2')===typeof _0x15e117){_0x19e274+='\x20'+_0x15e117;}if(_0x19e274!==''){return _0x19e274;}return _0x143525;}function Action(_0x2dd730,_0x300f46,_0x28e859){this['voiceQueue']=_0x2dd730;this[_0x69bf('0x3')]=_0x28e859||undefined;this['name']=checkNameSurname(_0x300f46[_0x69bf('0x4')]['phone'],_0x300f46[_0x69bf('0x4')][_0x69bf('0x5')],_0x300f46[_0x69bf('0x4')][_0x69bf('0x6')]);this[_0x69bf('0x7')]=_0x300f46[_0x69bf('0x4')][_0x69bf('0x8')];this[_0x69bf('0x9')]=_0x2dd730[_0x69bf('0xa')];this[_0x69bf('0xb')]=_0x300f46['active']||![];this[_0x69bf('0xc')]=_0x2dd730[_0x69bf('0xc')];this[_0x69bf('0xd')]=_0x2dd730[_0x69bf('0xd')]||0x3;this['scheduledat']=_0x300f46[_0x69bf('0xe')];this[_0x69bf('0xf')]=_0x300f46['countbusyretry'];this[_0x69bf('0x10')]=_0x300f46[_0x69bf('0x10')];this[_0x69bf('0x11')]=_0x300f46[_0x69bf('0x11')];this[_0x69bf('0x12')]=_0x300f46[_0x69bf('0x12')];this[_0x69bf('0x13')]=_0x300f46[_0x69bf('0x13')];this[_0x69bf('0x14')]=_0x300f46['countabandonedretry'];this['countmachineretry']=_0x300f46['countmachineretry'];this[_0x69bf('0x15')]=_0x300f46['countagentrejectretry'];this[_0x69bf('0x16')]=_0x300f46[_0x69bf('0x16')];this[_0x69bf('0x17')]=_0x300f46[_0x69bf('0x17')];this['UserId']=_0x300f46[_0x69bf('0x18')];this['VoiceQueueId']=_0x300f46[_0x69bf('0x19')];this[_0x69bf('0x1a')]=_0x300f46[_0x69bf('0x1a')];this[_0x69bf('0x1b')]=_0x300f46['id'];this[_0x69bf('0x1c')]=_0x300f46[_0x69bf('0x4')][_0x69bf('0x5')]||'';this[_0x69bf('0x1d')]=moment()[_0x69bf('0x1e')](_0x69bf('0x1f'));this['callback']=_0x300f46['callback'];this['callbackuniqueid']=_0x300f46[_0x69bf('0x20')];this[_0x69bf('0x21')]=_0x300f46[_0x69bf('0x21')];this[_0x69bf('0x22')]=_0x300f46[_0x69bf('0x22')];this[_0x69bf('0x23')]='';this[_0x69bf('0x24')]='';}Action['prototype'][_0x69bf('0x25')]=function(){return util[_0x69bf('0x1e')]('\x22%s\x22\x20<%s>',this['name'],this[_0x69bf('0x26')]['dialCutDigit']>0x0?this['number']['substring'](this[_0x69bf('0x26')][_0x69bf('0x27')]):this[_0x69bf('0x7')]);};Action[_0x69bf('0x28')]['getQueue']=function(){return this[_0x69bf('0x9')];};module[_0x69bf('0x29')]=Action; \ No newline at end of file +var _0x4e3b=['lodash','isNil','voiceQueue','Contact','phone','firstName','number','queue','active','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','prototype','getCaller','format','substring','dialCutDigit','exports','util'];(function(_0x509fc8,_0x3c640d){var _0x5d0fe9=function(_0x590ccb){while(--_0x590ccb){_0x509fc8['push'](_0x509fc8['shift']());}};_0x5d0fe9(++_0x3c640d);}(_0x4e3b,0x12f));var _0xb4e3=function(_0x879e31,_0x139d02){_0x879e31=_0x879e31-0x0;var _0x3467e8=_0x4e3b[_0x879e31];return _0x3467e8;};'use strict';var util=require(_0xb4e3('0x0'));var _=require(_0xb4e3('0x1'));var moment=require('moment');function checkNameSurname(_0x505451,_0x167340,_0x4ea77b){var _0x401006='';if(!_[_0xb4e3('0x2')](_0x167340)&&'string'===typeof _0x167340){_0x401006+=_0x167340;}if(!_[_0xb4e3('0x2')](_0x4ea77b)&&'string'===typeof _0x4ea77b){_0x401006+='\x20'+_0x4ea77b;}if(_0x401006!==''){return _0x401006;}return _0x505451;}function Action(_0x398482,_0x1d8956,_0x16fd05){this[_0xb4e3('0x3')]=_0x398482;this['uniqueid']=_0x16fd05||undefined;this['name']=checkNameSurname(_0x1d8956[_0xb4e3('0x4')][_0xb4e3('0x5')],_0x1d8956['Contact'][_0xb4e3('0x6')],_0x1d8956['Contact']['lastName']);this[_0xb4e3('0x7')]=_0x1d8956['Contact'][_0xb4e3('0x5')];this[_0xb4e3('0x8')]=_0x398482['name'];this[_0xb4e3('0x9')]=_0x1d8956['active']||![];this['type']=_0x398482['type'];this['dialQueueTimeout']=_0x398482[_0xb4e3('0xa')]||0x3;this[_0xb4e3('0xb')]=_0x1d8956[_0xb4e3('0xb')];this[_0xb4e3('0xc')]=_0x1d8956['countbusyretry'];this['countcongestionretry']=_0x1d8956[_0xb4e3('0xd')];this['countnoanswerretry']=_0x1d8956['countnoanswerretry'];this[_0xb4e3('0xe')]=_0x1d8956[_0xb4e3('0xe')];this[_0xb4e3('0xf')]=_0x1d8956[_0xb4e3('0xf')];this['countabandonedretry']=_0x1d8956[_0xb4e3('0x10')];this[_0xb4e3('0x11')]=_0x1d8956[_0xb4e3('0x11')];this['countagentrejectretry']=_0x1d8956['countagentrejectretry'];this[_0xb4e3('0x12')]=_0x1d8956['ContactId'];this['ListId']=_0x1d8956[_0xb4e3('0x13')];this[_0xb4e3('0x14')]=_0x1d8956['UserId'];this[_0xb4e3('0x15')]=_0x1d8956['VoiceQueueId'];this[_0xb4e3('0x16')]=_0x1d8956[_0xb4e3('0x16')];this[_0xb4e3('0x17')]=_0x1d8956['id'];this[_0xb4e3('0x18')]=_0x1d8956[_0xb4e3('0x4')]['firstName']||'';this[_0xb4e3('0x19')]=moment()['format'](_0xb4e3('0x1a'));this[_0xb4e3('0x1b')]=_0x1d8956[_0xb4e3('0x1b')];this[_0xb4e3('0x1c')]=_0x1d8956[_0xb4e3('0x1c')];this[_0xb4e3('0x1d')]=_0x1d8956[_0xb4e3('0x1d')];this[_0xb4e3('0x1e')]=_0x1d8956[_0xb4e3('0x1e')];this[_0xb4e3('0x1f')]='';this['originatecalleridname']='';}Action[_0xb4e3('0x20')][_0xb4e3('0x21')]=function(){return util[_0xb4e3('0x22')]('\x22%s\x22\x20<%s>',this['name'],this[_0xb4e3('0x3')]['dialCutDigit']>0x0?this[_0xb4e3('0x7')][_0xb4e3('0x23')](this[_0xb4e3('0x3')][_0xb4e3('0x24')]):this[_0xb4e3('0x7')]);};Action['prototype']['getQueue']=function(){return this[_0xb4e3('0x8')];};module[_0xb4e3('0x25')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index a12d0d1..3106015 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 _0x2a77=['exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname'];(function(_0x41d3fe,_0x12a1f8){var _0x125976=function(_0x1d5252){while(--_0x1d5252){_0x41d3fe['push'](_0x41d3fe['shift']());}};_0x125976(++_0x12a1f8);}(_0x2a77,0x1ba));var _0x72a7=function(_0x4cce65,_0x40021e){_0x4cce65=_0x4cce65-0x0;var _0x4d1b45=_0x2a77[_0x4cce65];return _0x4d1b45;};'use strict';var util=require(_0x72a7('0x0'));var _=require(_0x72a7('0x1'));var moment=require(_0x72a7('0x2'));function getSeconds(_0x59cac5,_0x4786c0){var _0x12cbda=moment(_0x59cac5)[_0x72a7('0x3')](0x0);var _0x339683=moment(_0x4786c0)[_0x72a7('0x3')](0x0);return _0x12cbda[_0x72a7('0x4')](_0x339683,_0x72a7('0x5'));}function AgentComplete(_0x199dae,_0x8cfd76){this[_0x72a7('0x6')]=0x4;this[_0x72a7('0x7')]=_0x72a7('0x8');this[_0x72a7('0x9')]=_0x199dae['scheduledat'];this[_0x72a7('0xa')]=_0x199dae[_0x72a7('0xa')];this[_0x72a7('0xb')]=_0x199dae[_0x72a7('0xa')]===_0x72a7('0xc')?_0x72a7('0xd'):_0x199dae[_0x72a7('0xa')];this[_0x72a7('0xe')]=_0x199dae[_0x72a7('0xe')];this[_0x72a7('0xf')]=_0x199dae[_0x72a7('0xf')];this[_0x72a7('0x10')]=_0x199dae[_0x72a7('0x10')];this[_0x72a7('0x11')]=_0x199dae[_0x72a7('0xe')]+_0x199dae[_0x72a7('0xf')]+_0x199dae['countnoanswerretry']+_0x199dae[_0x72a7('0x12')]+_0x199dae[_0x72a7('0x13')]+_0x199dae[_0x72a7('0x14')]+_0x199dae[_0x72a7('0x15')]+_0x199dae[_0x72a7('0x16')];this[_0x72a7('0x12')]=_0x199dae[_0x72a7('0x12')];this[_0x72a7('0x13')]=_0x199dae[_0x72a7('0x13')];this[_0x72a7('0x14')]=_0x199dae[_0x72a7('0x14')];this[_0x72a7('0x15')]=_0x199dae['countmachineretry'];this[_0x72a7('0x16')]=_0x199dae['countagentrejectretry'];this['uniqueid']=_0x8cfd76[_0x72a7('0x17')];this[_0x72a7('0x18')]=_0x199dae[_0x72a7('0x19')];this['calleridnum']=_0x199dae[_0x72a7('0x1a')];this[_0x72a7('0x1b')]=_0x199dae[_0x72a7('0x1b')];this[_0x72a7('0x1c')]=_0x199dae[_0x72a7('0x1c')];this[_0x72a7('0x1d')]=_0x199dae[_0x72a7('0x1d')];this[_0x72a7('0x1e')]=moment()[_0x72a7('0x1f')](_0x72a7('0x20'));this[_0x72a7('0x21')]=getSeconds(_0x199dae['responsetime'],_0x199dae[_0x72a7('0x1b')]);this['holdtime']=getSeconds(_0x199dae[_0x72a7('0x1d')],_0x199dae[_0x72a7('0x1c')]);this[_0x72a7('0x22')]=getSeconds(this[_0x72a7('0x1e')],_0x199dae['answertime']);this['queue']=_0x8cfd76[_0x72a7('0xd')];this[_0x72a7('0x23')]=_0x8cfd76[_0x72a7('0x23')];this[_0x72a7('0x24')]=_0x8cfd76[_0x72a7('0x24')];this[_0x72a7('0x25')]=_0x199dae[_0x72a7('0x25')];this['callbackuniqueid']=_0x199dae[_0x72a7('0x26')];this['callbackat']=_0x199dae[_0x72a7('0x27')];this[_0x72a7('0x28')]=_0x199dae[_0x72a7('0x28')];this[_0x72a7('0x29')]=_0x199dae[_0x72a7('0x29')];this[_0x72a7('0x2a')]=_0x199dae[_0x72a7('0x2a')];this[_0x72a7('0x2b')]=_0x199dae[_0x72a7('0x2b')];this[_0x72a7('0x2c')]=_0x199dae['VoiceQueueId'];this['CampaignId']=_0x199dae[_0x72a7('0x2d')];this[_0x72a7('0x2e')]=_0x199dae[_0x72a7('0x2e')]||'';this[_0x72a7('0x2f')]=_0x199dae[_0x72a7('0x2f')]||'';}module[_0x72a7('0x30')]=AgentComplete; \ No newline at end of file +var _0xc443=['originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','state','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countdropretry','countmachineretry','uniqueid','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','membername','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum'];(function(_0x4ca6a4,_0x5e9694){var _0x120555=function(_0x56888c){while(--_0x56888c){_0x4ca6a4['push'](_0x4ca6a4['shift']());}};_0x120555(++_0x5e9694);}(_0xc443,0x1c4));var _0x3c44=function(_0x3da27a,_0x48ae72){_0x3da27a=_0x3da27a-0x0;var _0x15ef25=_0xc443[_0x3da27a];return _0x15ef25;};'use strict';var util=require(_0x3c44('0x0'));var _=require(_0x3c44('0x1'));var moment=require(_0x3c44('0x2'));function getSeconds(_0x29575a,_0x466162){var _0x1a2f1d=moment(_0x29575a)[_0x3c44('0x3')](0x0);var _0x56ec81=moment(_0x466162)[_0x3c44('0x3')](0x0);return _0x1a2f1d[_0x3c44('0x4')](_0x56ec81,_0x3c44('0x5'));}function AgentComplete(_0x57dbc1,_0x3c5390){this[_0x3c44('0x6')]=0x4;this['statedesc']='Answer';this[_0x3c44('0x7')]=_0x57dbc1['scheduledat'];this[_0x3c44('0x8')]=_0x57dbc1[_0x3c44('0x8')];this[_0x3c44('0x9')]=_0x57dbc1[_0x3c44('0x8')]===_0x3c44('0xa')?_0x3c44('0xb'):_0x57dbc1[_0x3c44('0x8')];this[_0x3c44('0xc')]=_0x57dbc1[_0x3c44('0xc')];this[_0x3c44('0xd')]=_0x57dbc1[_0x3c44('0xd')];this[_0x3c44('0xe')]=_0x57dbc1[_0x3c44('0xe')];this[_0x3c44('0xf')]=_0x57dbc1[_0x3c44('0xc')]+_0x57dbc1[_0x3c44('0xd')]+_0x57dbc1[_0x3c44('0xe')]+_0x57dbc1[_0x3c44('0x10')]+_0x57dbc1['countdropretry']+_0x57dbc1[_0x3c44('0x11')]+_0x57dbc1['countmachineretry']+_0x57dbc1[_0x3c44('0x12')];this['countnosuchnumberretry']=_0x57dbc1[_0x3c44('0x10')];this['countdropretry']=_0x57dbc1[_0x3c44('0x13')];this[_0x3c44('0x11')]=_0x57dbc1['countabandonedretry'];this[_0x3c44('0x14')]=_0x57dbc1['countmachineretry'];this[_0x3c44('0x12')]=_0x57dbc1[_0x3c44('0x12')];this[_0x3c44('0x15')]=_0x3c5390['uniqueid'];this['calleridname']=_0x57dbc1[_0x3c44('0x16')];this[_0x3c44('0x17')]=_0x57dbc1[_0x3c44('0x18')];this[_0x3c44('0x19')]=_0x57dbc1[_0x3c44('0x19')];this[_0x3c44('0x1a')]=_0x57dbc1[_0x3c44('0x1a')];this[_0x3c44('0x1b')]=_0x57dbc1[_0x3c44('0x1b')];this[_0x3c44('0x1c')]=moment()[_0x3c44('0x1d')](_0x3c44('0x1e'));this[_0x3c44('0x1f')]=getSeconds(_0x57dbc1['responsetime'],_0x57dbc1['starttime']);this[_0x3c44('0x20')]=getSeconds(_0x57dbc1['answertime'],_0x57dbc1[_0x3c44('0x1a')]);this['talktime']=getSeconds(this[_0x3c44('0x1c')],_0x57dbc1[_0x3c44('0x1b')]);this[_0x3c44('0xb')]=_0x3c5390['queue'];this['membername']=_0x3c5390[_0x3c44('0x21')];this['reason']=_0x3c5390['reason'];this['callback']=_0x57dbc1['callback'];this[_0x3c44('0x22')]=_0x57dbc1['callbackuniqueid'];this[_0x3c44('0x23')]=_0x57dbc1[_0x3c44('0x23')];this[_0x3c44('0x24')]=_0x57dbc1['recallme'];this[_0x3c44('0x25')]=_0x57dbc1['ContactId'];this[_0x3c44('0x26')]=_0x57dbc1[_0x3c44('0x26')];this[_0x3c44('0x27')]=_0x57dbc1[_0x3c44('0x27')];this[_0x3c44('0x28')]=_0x57dbc1[_0x3c44('0x28')];this[_0x3c44('0x29')]=_0x57dbc1[_0x3c44('0x29')];this['originatecalleridnum']=_0x57dbc1[_0x3c44('0x2a')]||'';this['originatecalleridname']=_0x57dbc1[_0x3c44('0x2b')]||'';}module[_0x3c44('0x2c')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 27c5605..6d81f0c 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 _0x85d0=['type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','milliseconds','diff','uniqueid','scheduledat'];(function(_0x3137f0,_0x509d52){var _0x4c12c4=function(_0x4b9be3){while(--_0x4b9be3){_0x3137f0['push'](_0x3137f0['shift']());}};_0x4c12c4(++_0x509d52);}(_0x85d0,0x164));var _0x085d=function(_0x4dbdbe,_0x276811){_0x4dbdbe=_0x4dbdbe-0x0;var _0x5ec384=_0x85d0[_0x4dbdbe];return _0x5ec384;};'use strict';var util=require('util');var _=require('lodash');var moment=require('moment');function getSeconds(_0x51c417,_0x297001){var _0x1716e5=moment(_0x51c417)[_0x085d('0x0')](0x0);var _0x313db8=moment(_0x297001)[_0x085d('0x0')](0x0);return _0x1716e5[_0x085d('0x1')](_0x313db8,'seconds');}function Final(_0x2f37ca){this['uniqueid']=_0x2f37ca[_0x085d('0x2')];this[_0x085d('0x3')]=_0x2f37ca[_0x085d('0x3')];this['type']=_0x2f37ca[_0x085d('0x4')];this[_0x085d('0x5')]=_0x2f37ca[_0x085d('0x4')]===_0x085d('0x6')?_0x085d('0x7'):_0x2f37ca[_0x085d('0x4')];this[_0x085d('0x8')]=_0x2f37ca[_0x085d('0x8')];this[_0x085d('0x9')]=_0x2f37ca['countcongestionretry'];this[_0x085d('0xa')]=_0x2f37ca[_0x085d('0xa')];this[_0x085d('0xb')]=_0x2f37ca[_0x085d('0x8')]+_0x2f37ca['countcongestionretry']+_0x2f37ca[_0x085d('0xa')]+_0x2f37ca[_0x085d('0xc')]+_0x2f37ca['countdropretry']+_0x2f37ca[_0x085d('0xd')]+_0x2f37ca[_0x085d('0xe')]+_0x2f37ca[_0x085d('0xf')];this[_0x085d('0xc')]=_0x2f37ca['countnosuchnumberretry'];this[_0x085d('0x10')]=_0x2f37ca[_0x085d('0x10')];this['countabandonedretry']=_0x2f37ca['countabandonedretry'];this[_0x085d('0xe')]=_0x2f37ca[_0x085d('0xe')];this[_0x085d('0xf')]=_0x2f37ca[_0x085d('0xf')];this[_0x085d('0x7')]=_0x2f37ca['queue'];this[_0x085d('0x11')]=_0x2f37ca[_0x085d('0x11')];this[_0x085d('0x12')]=_0x2f37ca[_0x085d('0x12')];this[_0x085d('0x13')]=_0x2f37ca[_0x085d('0x13')];this[_0x085d('0x14')]=_0x2f37ca[_0x085d('0x14')];this[_0x085d('0x15')]=_0x2f37ca['responsetime'];this[_0x085d('0x16')]=_0x2f37ca[_0x085d('0x16')]||0x0;this[_0x085d('0x17')]=_0x2f37ca[_0x085d('0x17')]||0x0;this[_0x085d('0x18')]=_0x2f37ca['talktime']||0x0;this[_0x085d('0x19')]=_0x2f37ca[_0x085d('0x19')];this[_0x085d('0x1a')]=_0x2f37ca[_0x085d('0x1a')];this['callbackat']=_0x2f37ca['callbackat'];this['recallme']=_0x2f37ca[_0x085d('0x1b')];this[_0x085d('0x1c')]=_0x2f37ca[_0x085d('0x1c')];this[_0x085d('0x1d')]=_0x2f37ca[_0x085d('0x1d')];this[_0x085d('0x1e')]=_0x2f37ca['UserId'];this[_0x085d('0x1f')]=_0x2f37ca[_0x085d('0x1f')];this[_0x085d('0x20')]=_0x2f37ca['CampaignId'];this[_0x085d('0x21')]=_0x2f37ca[_0x085d('0x21')]||'';this[_0x085d('0x22')]=_0x2f37ca[_0x085d('0x22')]||'';}module[_0x085d('0x23')]=Final; \ No newline at end of file +var _0x0fda=['recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','moment','milliseconds','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countmachineretry','countnosuchnumberretry','countdropretry','countagentrejectretry','calleridname','calleridnum','starttime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat'];(function(_0xfa9d96,_0x3436ff){var _0x3a329c=function(_0x41bfe4){while(--_0x41bfe4){_0xfa9d96['push'](_0xfa9d96['shift']());}};_0x3a329c(++_0x3436ff);}(_0x0fda,0x1a0));var _0xa0fd=function(_0xc6a63,_0x4456e0){_0xc6a63=_0xc6a63-0x0;var _0x2228f4=_0x0fda[_0xc6a63];return _0x2228f4;};'use strict';var util=require(_0xa0fd('0x0'));var _=require('lodash');var moment=require(_0xa0fd('0x1'));function getSeconds(_0x28e34c,_0x314a1a){var _0x2f71f3=moment(_0x28e34c)[_0xa0fd('0x2')](0x0);var _0xd8e73a=moment(_0x314a1a)[_0xa0fd('0x2')](0x0);return _0x2f71f3['diff'](_0xd8e73a,'seconds');}function Final(_0x65fa5d){this['uniqueid']=_0x65fa5d['uniqueid'];this[_0xa0fd('0x3')]=_0x65fa5d[_0xa0fd('0x3')];this[_0xa0fd('0x4')]=_0x65fa5d[_0xa0fd('0x4')];this['campaigntype']=_0x65fa5d[_0xa0fd('0x4')]===_0xa0fd('0x5')?_0xa0fd('0x6'):_0x65fa5d[_0xa0fd('0x4')];this['countbusyretry']=_0x65fa5d[_0xa0fd('0x7')];this[_0xa0fd('0x8')]=_0x65fa5d[_0xa0fd('0x8')];this['countnoanswerretry']=_0x65fa5d[_0xa0fd('0x9')];this[_0xa0fd('0xa')]=_0x65fa5d[_0xa0fd('0x7')]+_0x65fa5d[_0xa0fd('0x8')]+_0x65fa5d[_0xa0fd('0x9')]+_0x65fa5d['countnosuchnumberretry']+_0x65fa5d['countdropretry']+_0x65fa5d[_0xa0fd('0xb')]+_0x65fa5d[_0xa0fd('0xc')]+_0x65fa5d['countagentrejectretry'];this[_0xa0fd('0xd')]=_0x65fa5d[_0xa0fd('0xd')];this[_0xa0fd('0xe')]=_0x65fa5d[_0xa0fd('0xe')];this[_0xa0fd('0xb')]=_0x65fa5d[_0xa0fd('0xb')];this[_0xa0fd('0xc')]=_0x65fa5d['countmachineretry'];this[_0xa0fd('0xf')]=_0x65fa5d[_0xa0fd('0xf')];this['queue']=_0x65fa5d['queue'];this[_0xa0fd('0x10')]=_0x65fa5d[_0xa0fd('0x10')];this['calleridnum']=_0x65fa5d[_0xa0fd('0x11')];this[_0xa0fd('0x12')]=_0x65fa5d[_0xa0fd('0x12')];this['responsetime']=_0x65fa5d['responsetime'];this[_0xa0fd('0x13')]=_0x65fa5d['responsetime'];this[_0xa0fd('0x14')]=_0x65fa5d[_0xa0fd('0x14')]||0x0;this[_0xa0fd('0x15')]=_0x65fa5d[_0xa0fd('0x15')]||0x0;this[_0xa0fd('0x16')]=_0x65fa5d[_0xa0fd('0x16')]||0x0;this[_0xa0fd('0x17')]=_0x65fa5d['callback'];this[_0xa0fd('0x18')]=_0x65fa5d[_0xa0fd('0x18')];this[_0xa0fd('0x19')]=_0x65fa5d[_0xa0fd('0x19')];this[_0xa0fd('0x1a')]=_0x65fa5d[_0xa0fd('0x1a')];this[_0xa0fd('0x1b')]=_0x65fa5d[_0xa0fd('0x1b')];this[_0xa0fd('0x1c')]=_0x65fa5d[_0xa0fd('0x1c')];this[_0xa0fd('0x1d')]=_0x65fa5d[_0xa0fd('0x1d')];this[_0xa0fd('0x1e')]=_0x65fa5d['VoiceQueueId'];this[_0xa0fd('0x1f')]=_0x65fa5d[_0xa0fd('0x1f')];this['originatecalleridnum']=_0x65fa5d[_0xa0fd('0x20')]||'';this[_0xa0fd('0x21')]=_0x65fa5d['originatecalleridname']||'';}module['exports']=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 16e44fb..bca3362 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 _0x8fb0=['reason','cause-txt','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff','seconds','statedesc','Answer','scheduledat','type','campaigntype','outbound','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','queue','IVR'];(function(_0x575934,_0x4a6760){var _0x109a3d=function(_0x1c20a1){while(--_0x1c20a1){_0x575934['push'](_0x575934['shift']());}};_0x109a3d(++_0x4a6760);}(_0x8fb0,0x146));var _0x08fb=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x8fb0[_0x4a9fb1];return _0x348672;};'use strict';var util=require(_0x08fb('0x0'));var _=require(_0x08fb('0x1'));var moment=require(_0x08fb('0x2'));function getSeconds(_0xa3488a,_0x248d33){var _0x2d598e=moment(_0xa3488a)[_0x08fb('0x3')](0x0);var _0xbd9401=moment(_0x248d33)[_0x08fb('0x3')](0x0);return _0x2d598e[_0x08fb('0x4')](_0xbd9401,_0x08fb('0x5'));}function Hangup(_0x86d446,_0x3918a8){this['state']=0x4;this[_0x08fb('0x6')]=_0x08fb('0x7');this[_0x08fb('0x8')]=_0x86d446['scheduledat'];this['type']=_0x86d446[_0x08fb('0x9')];this[_0x08fb('0xa')]=_0x86d446[_0x08fb('0x9')]===_0x08fb('0xb')?'queue':_0x86d446[_0x08fb('0x9')];this[_0x08fb('0xc')]=_0x86d446[_0x08fb('0xc')];this['countcongestionretry']=_0x86d446['countcongestionretry'];this[_0x08fb('0xd')]=_0x86d446[_0x08fb('0xd')];this[_0x08fb('0xe')]=_0x86d446[_0x08fb('0xc')]+_0x86d446[_0x08fb('0xf')]+_0x86d446[_0x08fb('0xd')]+_0x86d446[_0x08fb('0x10')]+_0x86d446['countdropretry']+_0x86d446[_0x08fb('0x11')]+_0x86d446[_0x08fb('0x12')]+_0x86d446[_0x08fb('0x13')];this['countnosuchnumberretry']=_0x86d446[_0x08fb('0x10')];this[_0x08fb('0x14')]=_0x86d446[_0x08fb('0x14')];this[_0x08fb('0x11')]=_0x86d446[_0x08fb('0x11')];this['countmachineretry']=_0x86d446['countmachineretry'];this[_0x08fb('0x13')]=_0x86d446[_0x08fb('0x13')];this[_0x08fb('0x15')]=_0x3918a8[_0x08fb('0x15')];this[_0x08fb('0x16')]=_0x86d446[_0x08fb('0x17')];this[_0x08fb('0x18')]=_0x86d446['number'];this['starttime']=_0x86d446[_0x08fb('0x19')];this[_0x08fb('0x1a')]=_0x86d446['responsetime'];this[_0x08fb('0x1b')]=moment()['format'](_0x08fb('0x1c'));this[_0x08fb('0x1d')]=getSeconds(_0x86d446[_0x08fb('0x1a')],_0x86d446[_0x08fb('0x19')]);this[_0x08fb('0x1e')]=0x0;this[_0x08fb('0x1f')]=getSeconds(this[_0x08fb('0x1b')],_0x86d446[_0x08fb('0x1a')]);this[_0x08fb('0x20')]=_0x86d446[_0x08fb('0x20')];this['membername']=_0x08fb('0x21');this[_0x08fb('0x22')]=_0x3918a8[_0x08fb('0x23')];this['callback']=_0x86d446[_0x08fb('0x24')];this[_0x08fb('0x25')]=_0x86d446[_0x08fb('0x25')];this['callbackat']=_0x86d446['callbackat'];this['recallme']=_0x86d446[_0x08fb('0x26')];this[_0x08fb('0x27')]=_0x86d446[_0x08fb('0x27')];this[_0x08fb('0x28')]=_0x86d446[_0x08fb('0x28')];this['UserId']=_0x86d446[_0x08fb('0x29')];this[_0x08fb('0x2a')]=_0x86d446[_0x08fb('0x2a')];this[_0x08fb('0x2b')]=_0x86d446[_0x08fb('0x2b')];}module[_0x08fb('0x2c')]=Hangup; \ No newline at end of file +var _0xb991=['type','outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','name','calleridnum','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','CampaignId','exports','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat'];(function(_0x391154,_0x40fb12){var _0x4b7767=function(_0x3b1573){while(--_0x3b1573){_0x391154['push'](_0x391154['shift']());}};_0x4b7767(++_0x40fb12);}(_0xb991,0x78));var _0x1b99=function(_0x4aba15,_0x4e90aa){_0x4aba15=_0x4aba15-0x0;var _0x1c8122=_0xb991[_0x4aba15];return _0x1c8122;};'use strict';var util=require('util');var _=require(_0x1b99('0x0'));var moment=require(_0x1b99('0x1'));function getSeconds(_0x49bc28,_0xb046e3){var _0x37541f=moment(_0x49bc28)[_0x1b99('0x2')](0x0);var _0x145a98=moment(_0xb046e3)[_0x1b99('0x2')](0x0);return _0x37541f[_0x1b99('0x3')](_0x145a98,_0x1b99('0x4'));}function Hangup(_0x2ed2ac,_0x264893){this[_0x1b99('0x5')]=0x4;this[_0x1b99('0x6')]=_0x1b99('0x7');this[_0x1b99('0x8')]=_0x2ed2ac[_0x1b99('0x8')];this[_0x1b99('0x9')]=_0x2ed2ac[_0x1b99('0x9')];this['campaigntype']=_0x2ed2ac[_0x1b99('0x9')]===_0x1b99('0xa')?_0x1b99('0xb'):_0x2ed2ac[_0x1b99('0x9')];this['countbusyretry']=_0x2ed2ac['countbusyretry'];this[_0x1b99('0xc')]=_0x2ed2ac['countcongestionretry'];this[_0x1b99('0xd')]=_0x2ed2ac[_0x1b99('0xd')];this[_0x1b99('0xe')]=_0x2ed2ac[_0x1b99('0xf')]+_0x2ed2ac['countcongestionretry']+_0x2ed2ac[_0x1b99('0xd')]+_0x2ed2ac[_0x1b99('0x10')]+_0x2ed2ac[_0x1b99('0x11')]+_0x2ed2ac['countabandonedretry']+_0x2ed2ac['countmachineretry']+_0x2ed2ac[_0x1b99('0x12')];this[_0x1b99('0x10')]=_0x2ed2ac['countnosuchnumberretry'];this['countdropretry']=_0x2ed2ac[_0x1b99('0x11')];this[_0x1b99('0x13')]=_0x2ed2ac[_0x1b99('0x13')];this['countmachineretry']=_0x2ed2ac[_0x1b99('0x14')];this['countagentrejectretry']=_0x2ed2ac[_0x1b99('0x12')];this['uniqueid']=_0x264893['uniqueid'];this['calleridname']=_0x2ed2ac[_0x1b99('0x15')];this[_0x1b99('0x16')]=_0x2ed2ac['number'];this['starttime']=_0x2ed2ac[_0x1b99('0x17')];this[_0x1b99('0x18')]=_0x2ed2ac[_0x1b99('0x18')];this[_0x1b99('0x19')]=moment()[_0x1b99('0x1a')](_0x1b99('0x1b'));this[_0x1b99('0x1c')]=getSeconds(_0x2ed2ac['responsetime'],_0x2ed2ac[_0x1b99('0x17')]);this[_0x1b99('0x1d')]=0x0;this[_0x1b99('0x1e')]=getSeconds(this['endtime'],_0x2ed2ac[_0x1b99('0x18')]);this[_0x1b99('0xb')]=_0x2ed2ac[_0x1b99('0xb')];this[_0x1b99('0x1f')]=_0x1b99('0x20');this[_0x1b99('0x21')]=_0x264893[_0x1b99('0x22')];this[_0x1b99('0x23')]=_0x2ed2ac[_0x1b99('0x23')];this[_0x1b99('0x24')]=_0x2ed2ac[_0x1b99('0x24')];this[_0x1b99('0x25')]=_0x2ed2ac[_0x1b99('0x25')];this[_0x1b99('0x26')]=_0x2ed2ac[_0x1b99('0x26')];this[_0x1b99('0x27')]=_0x2ed2ac[_0x1b99('0x27')];this['ListId']=_0x2ed2ac['ListId'];this[_0x1b99('0x28')]=_0x2ed2ac[_0x1b99('0x28')];this['VoiceQueueId']=_0x2ed2ac['VoiceQueueId'];this[_0x1b99('0x29')]=_0x2ed2ac['CampaignId'];}module[_0x1b99('0x2a')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index b82dbb4..d1f4a30 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 _0x296d=['starttime','responsetime','endtime','ringtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','uniqueid','scheduledat','campaigntype','type','outbound','queue','countbusyretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','calleridname','name','calleridnum','number'];(function(_0x55677b,_0x3e5655){var _0x104b88=function(_0x78d34f){while(--_0x78d34f){_0x55677b['push'](_0x55677b['shift']());}};_0x104b88(++_0x3e5655);}(_0x296d,0xc9));var _0xd296=function(_0x336df4,_0x52c1dc){_0x336df4=_0x336df4-0x0;var _0x580d8c=_0x296d[_0x336df4];return _0x580d8c;};'use strict';var util=require(_0xd296('0x0'));var _=require('lodash');var moment=require(_0xd296('0x1'));function getSeconds(_0x36e0c6,_0x102ec2){var _0x2dbb75=moment(_0x36e0c6)[_0xd296('0x2')](0x0);var _0x3c47d3=moment(_0x102ec2)[_0xd296('0x2')](0x0);return _0x2dbb75['diff'](_0x3c47d3,'seconds');}function History(_0x10cb43){this[_0xd296('0x3')]=_0x10cb43[_0xd296('0x3')];this['scheduledat']=_0x10cb43[_0xd296('0x4')]||undefined;this['type']=_0x10cb43['type'];this[_0xd296('0x5')]=_0x10cb43[_0xd296('0x6')]===_0xd296('0x7')?_0xd296('0x8'):_0x10cb43[_0xd296('0x6')];this['countbusyretry']=_0x10cb43[_0xd296('0x9')];this['countcongestionretry']=_0x10cb43['countcongestionretry'];this[_0xd296('0xa')]=_0x10cb43[_0xd296('0xa')];this[_0xd296('0xb')]=_0x10cb43[_0xd296('0x9')]+_0x10cb43['countcongestionretry']+_0x10cb43[_0xd296('0xa')]+_0x10cb43['countnosuchnumberretry']+_0x10cb43[_0xd296('0xc')]+_0x10cb43[_0xd296('0xd')]+_0x10cb43[_0xd296('0xe')]+_0x10cb43[_0xd296('0xf')];this[_0xd296('0x10')]=_0x10cb43[_0xd296('0x10')];this[_0xd296('0xc')]=_0x10cb43[_0xd296('0xc')];this[_0xd296('0xd')]=_0x10cb43[_0xd296('0xd')];this[_0xd296('0xe')]=_0x10cb43[_0xd296('0xe')];this['countagentrejectretry']=_0x10cb43[_0xd296('0xf')];this[_0xd296('0x8')]=_0x10cb43[_0xd296('0x8')];this[_0xd296('0x11')]=_0x10cb43[_0xd296('0x12')];this[_0xd296('0x13')]=_0x10cb43[_0xd296('0x14')];this[_0xd296('0x15')]=_0x10cb43[_0xd296('0x15')];this[_0xd296('0x16')]=_0x10cb43[_0xd296('0x16')];this[_0xd296('0x17')]=_0x10cb43['responsetime'];this[_0xd296('0x18')]=getSeconds(_0x10cb43[_0xd296('0x16')],_0x10cb43[_0xd296('0x15')]);this['holdtime']=0x0;this['talktime']=0x0;this['callback']=_0x10cb43[_0xd296('0x19')];this[_0xd296('0x1a')]=_0x10cb43['callbackuniqueid'];this[_0xd296('0x1b')]=_0x10cb43['callbackat'];this[_0xd296('0x1c')]=_0x10cb43['recallme'];this[_0xd296('0x1d')]=_0x10cb43[_0xd296('0x1d')];this[_0xd296('0x1e')]=_0x10cb43[_0xd296('0x1e')];this[_0xd296('0x1f')]=_0x10cb43[_0xd296('0x1f')];this[_0xd296('0x20')]=_0x10cb43[_0xd296('0x20')];this[_0xd296('0x21')]=_0x10cb43[_0xd296('0x21')];this[_0xd296('0x22')]=_0x10cb43['originatecalleridnum']||'';this['originatecalleridname']=_0x10cb43[_0xd296('0x23')]||'';}module[_0xd296('0x24')]=History; \ No newline at end of file +var _0xdf16=['talktime','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','exports','lodash','moment','milliseconds','diff','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','calleridname','name','calleridnum','number','starttime','responsetime','ringtime'];(function(_0x47667b,_0x30669d){var _0x5a5458=function(_0x9c1a80){while(--_0x9c1a80){_0x47667b['push'](_0x47667b['shift']());}};_0x5a5458(++_0x30669d);}(_0xdf16,0x17d));var _0x6df1=function(_0x52b828,_0x359d0f){_0x52b828=_0x52b828-0x0;var _0x2721d8=_0xdf16[_0x52b828];return _0x2721d8;};'use strict';var util=require('util');var _=require(_0x6df1('0x0'));var moment=require(_0x6df1('0x1'));function getSeconds(_0x338640,_0x6da770){var _0x1ea5d1=moment(_0x338640)[_0x6df1('0x2')](0x0);var _0x1f2a82=moment(_0x6da770)[_0x6df1('0x2')](0x0);return _0x1ea5d1[_0x6df1('0x3')](_0x1f2a82,'seconds');}function History(_0x4a7656){this[_0x6df1('0x4')]=_0x4a7656[_0x6df1('0x4')];this[_0x6df1('0x5')]=_0x4a7656[_0x6df1('0x5')]||undefined;this[_0x6df1('0x6')]=_0x4a7656[_0x6df1('0x6')];this[_0x6df1('0x7')]=_0x4a7656[_0x6df1('0x6')]===_0x6df1('0x8')?_0x6df1('0x9'):_0x4a7656[_0x6df1('0x6')];this['countbusyretry']=_0x4a7656[_0x6df1('0xa')];this[_0x6df1('0xb')]=_0x4a7656[_0x6df1('0xb')];this[_0x6df1('0xc')]=_0x4a7656[_0x6df1('0xc')];this[_0x6df1('0xd')]=_0x4a7656['countbusyretry']+_0x4a7656[_0x6df1('0xb')]+_0x4a7656[_0x6df1('0xc')]+_0x4a7656[_0x6df1('0xe')]+_0x4a7656['countdropretry']+_0x4a7656['countabandonedretry']+_0x4a7656[_0x6df1('0xf')]+_0x4a7656[_0x6df1('0x10')];this[_0x6df1('0xe')]=_0x4a7656[_0x6df1('0xe')];this[_0x6df1('0x11')]=_0x4a7656[_0x6df1('0x11')];this[_0x6df1('0x12')]=_0x4a7656[_0x6df1('0x12')];this[_0x6df1('0xf')]=_0x4a7656[_0x6df1('0xf')];this['countagentrejectretry']=_0x4a7656[_0x6df1('0x10')];this[_0x6df1('0x9')]=_0x4a7656[_0x6df1('0x9')];this[_0x6df1('0x13')]=_0x4a7656[_0x6df1('0x14')];this[_0x6df1('0x15')]=_0x4a7656[_0x6df1('0x16')];this[_0x6df1('0x17')]=_0x4a7656[_0x6df1('0x17')];this[_0x6df1('0x18')]=_0x4a7656['responsetime'];this['endtime']=_0x4a7656[_0x6df1('0x18')];this[_0x6df1('0x19')]=getSeconds(_0x4a7656[_0x6df1('0x18')],_0x4a7656[_0x6df1('0x17')]);this['holdtime']=0x0;this[_0x6df1('0x1a')]=0x0;this[_0x6df1('0x1b')]=_0x4a7656['callback'];this[_0x6df1('0x1c')]=_0x4a7656[_0x6df1('0x1c')];this[_0x6df1('0x1d')]=_0x4a7656[_0x6df1('0x1d')];this['recallme']=_0x4a7656['recallme'];this[_0x6df1('0x1e')]=_0x4a7656[_0x6df1('0x1e')];this[_0x6df1('0x1f')]=_0x4a7656['ListId'];this['UserId']=_0x4a7656[_0x6df1('0x20')];this[_0x6df1('0x21')]=_0x4a7656[_0x6df1('0x21')];this[_0x6df1('0x22')]=_0x4a7656[_0x6df1('0x22')];this['originatecalleridnum']=_0x4a7656['originatecalleridnum']||'';this[_0x6df1('0x23')]=_0x4a7656['originatecalleridname']||'';}module[_0x6df1('0x24')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 9f06bb1..11e8989 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 _0x7070=['name','NOT_ACTIVE','\x20NOT\x20Active','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Interval','isEmpty','Intervals','[ifTime][Action]','stringify','milliseconds','diff','seconds','emit','type','outbound','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','talking','total','waiting','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','active','md5','format','ivr','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\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','startProgressive','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','error','stack','inspect','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','contacts','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','IS_DISACTIVED','is\x20disactive','starttime','clearZombieChannels','[uniqueid]','actions','[actions]','isNil','Action','status','channel','catch','No\x20such\x20channel','queue','[Dialer][checkChannel]','updateOriginated','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20is\x20null\x20or\x20undefined','emptyContact','notFound','saveInDb','ContactId','ListId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','SIP/%s','unmonitored','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','HANGUP','outboundAnswerAgiCallsDay','state','statedesc','membername','AMD','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','dialAMDActive','value','MACHINE','Machine','countglobal','[syncAgentComplete][createHistory][0]','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','add','dialMachineRetryFrequency','minutes','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','countcongestionretry','reason\x2019\x20machine....','YYYY-MM-DD\x20HH:mm:ss','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','AnswerAGI','AGI','cause-txt','Unknow','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','dropreason','TIMEOUT','dialDropMaxRetry','dialDropRetryFrequency','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actionid','locked','paused','stateinterface','push','pick','idHopper','queueStatusComplete','run','_rr','length','unlockRR','Agent:\x20','[Catch][Preview][syncQueueStatusComplete]','[booked][RR][finaly]','[booked][unlock]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','isTrunkReachable','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','TIMEZONE_UNKNOW','command','indexOf','true','iftime\x20%s,%s','content','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','checkDialMethod','progressive','power','predictive','handlePower','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialActive','dialGlobalInterval','dialTimezone','[syncCampaigns]','\x5cw{0,','pow','replace','match','actionOriginate','object','originate','Contact','phone','contact\x20is\x20undefine','getCaller','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAMDInitialSilence','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDSILENCETHRESHOLD','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','updatedAt','XMD-','toUpper','callerid','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','SIP/%s/%s%s','dialCutDigit','substring','trim','[originateError]:\x20%s','OriginateError','endtime','[originate][error]','Error','originate\x20action\x20Error','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','reason','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','startMethodPredictive','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','UserId','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','Agent','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','Blacklist','[Originate][historyBlacklist]','inBlackList','limitCalls','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','loggerHandler','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','reachable','ACTIVE','Contact.phone','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','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','p\x20=\x20','[abandonmentRate]','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\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','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]','Ts\x20=\x20','exports','lodash','uuid','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','booked','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/voiceQueueRt','./history','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','uniqueId','optionPredictive','queueBooked','queueBookedRR','agentconnect','queuecallerabandon','syncQueueCallerAbandon','bind','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','isUndefined','message','AGENTS_NOT_LOGGED'];(function(_0x28a5ad,_0x520afa){var _0x176b8a=function(_0x3d71b){while(--_0x3d71b){_0x28a5ad['push'](_0x28a5ad['shift']());}};_0x176b8a(++_0x520afa);}(_0x7070,0x1d7));var _0x0707=function(_0x1c26cd,_0x5a5f43){_0x1c26cd=_0x1c26cd-0x0;var _0x5ec84e=_0x7070[_0x1c26cd];return _0x5ec84e;};'use strict';var util=require('util');var _=require(_0x0707('0x0'));var BPromise=require('bluebird');var uuid=require(_0x0707('0x1'));var moment=require('moment');var rr=require('rr');var md5=require('md5');var Redis=require(_0x0707('0x2'));var ut=require(_0x0707('0x3'));var config=require(_0x0707('0x4'));var logger=require(_0x0707('0x5'))('dialer');var loggerBooked=require(_0x0707('0x5'))(_0x0707('0x6'));var loggerPredictive=require('../../../config/logger')('predictive');var loggerPredictiveCalls=require(_0x0707('0x5'))('predictiveCalls');var loggerSyncQueueSummary=require('../../../config/logger')(_0x0707('0x7'));var ami=require(_0x0707('0x8'));config[_0x0707('0x9')]=_[_0x0707('0xa')](config[_0x0707('0x9')],{'host':_0x0707('0xb'),'port':0x18eb});var io=require(_0x0707('0xc'))(new Redis(config[_0x0707('0x9')]));var cmHopper=require(_0x0707('0xd'));var cmHopperHistory=require(_0x0707('0xe'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x0707('0xf'));var Action=require('./action');var History=require(_0x0707('0x10'));var Final=require('./final');var AgentComplete=require(_0x0707('0x11'));var QueueCallerAbandon=require(_0x0707('0x12'));var Hangup=require(_0x0707('0x13'));var ipAgi=process[_0x0707('0x14')][_0x0707('0x15')]||_0x0707('0x16');var strategy={'rrmemory':_0x0707('0x17'),'roundrobin':_0x0707('0x18')};var Sequence=function(){};Sequence[_0x0707('0x19')][_0x0707('0x1a')]=function(_0x47b154){this['tail']=this[_0x0707('0x1b')]?this[_0x0707('0x1b')][_0x0707('0x1c')](_0x47b154):_0x47b154();};function Dialer(_0x46f6de,_0x5e989a){this[_0x0707('0x1d')]=new Sequence();this[_0x0707('0x1e')]=_0x5e989a;this[_0x0707('0x1f')]=_0x46f6de['voiceQueues'];this[_0x0707('0x20')]=_0x46f6de['campaigns'];this[_0x0707('0x21')]=_0x46f6de['agents'];this[_0x0707('0x22')]=_0x46f6de[_0x0707('0x22')];this[_0x0707('0x23')]=config[_0x0707('0x23')]||0x2;this[_0x0707('0x24')]={};this['actions']={};this[_0x0707('0x25')]={};this[_0x0707('0x26')]={};this[_0x0707('0x27')]={};this['startPredictive']={};this['startProgressive']={};this['ivrOriginated']={};this[_0x0707('0x28')]={};this[_0x0707('0x29')]={};ami['on'](_0x0707('0x2a'),this['syncAgentConnect']['bind'](this));ami['on'](_0x0707('0x2b'),this[_0x0707('0x2c')][_0x0707('0x2d')](this));ami['on'](_0x0707('0x2e'),this[_0x0707('0x2f')][_0x0707('0x2d')](this));ami['on'](_0x0707('0x30'),this[_0x0707('0x31')][_0x0707('0x2d')](this));ami['on'](_0x0707('0x32'),this[_0x0707('0x7')][_0x0707('0x2d')](this));ami['on']('hangup',this[_0x0707('0x33')][_0x0707('0x2d')](this));ami['on'](_0x0707('0x34'),this[_0x0707('0x35')]['bind'](this));ami['on'](_0x0707('0x36'),this[_0x0707('0x37')][_0x0707('0x2d')](this));ami['on'](_0x0707('0x38'),this[_0x0707('0x39')]['bind'](this));ami['on'](_0x0707('0x3a'),this[_0x0707('0x3b')][_0x0707('0x2d')](this));this[_0x0707('0x3c')]();this['loopClearZombieChannels']();}function isNotNull(_0x11b444){return _0x11b444!==null&&!_[_0x0707('0x3d')](_0x11b444);}function checkIsLoggedIn(_0x160485,_0x451c3f){return function(){if(_0x451c3f<=0x0){_0x160485[_0x0707('0x3e')]=_0x0707('0x3f');throw _0x160485[_0x0707('0x40')]+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x511abb){return _0x511abb;}function checkIsActive(_0x1ed31b,_0x300216){return function(){if(!isActive(_0x300216)){_0x1ed31b[_0x0707('0x3e')]=_0x0707('0x41');throw _0x1ed31b['name']+_0x0707('0x42');}};}function checkInterval(_0x2e219c){return function(){if(!isNotNull(_0x2e219c['Interval'])){_0x2e219c[_0x0707('0x3e')]=_0x0707('0x43');throw _0x2e219c['name']+_0x0707('0x44');}if(!isNotNull(_0x2e219c[_0x0707('0x45')]['Intervals'])){_0x2e219c[_0x0707('0x3e')]=_0x0707('0x43');throw _0x2e219c['name']+_0x0707('0x44');}if(!isNotNull(_[_0x0707('0x46')](_0x2e219c[_0x0707('0x45')][_0x0707('0x47')]))){_0x2e219c[_0x0707('0x3e')]=_0x0707('0x43');throw _0x2e219c[_0x0707('0x40')]+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x19f114,_0x10b0a1,_0x2c5048){return{'action':_0x19f114,'response':_0x10b0a1,'message':_0x2c5048,'stack':_0x2c5048};}function myreject(_0x52232c){return function(_0x1348e3){return _0x52232c(msgResponse(_0x0707('0x48'),'Error',JSON[_0x0707('0x49')](_0x1348e3)));};}function getSeconds(_0x406dee,_0xd39a8c){var _0x587c2b=moment(_0x406dee)[_0x0707('0x4a')](0x0);var _0x4d093c=moment(_0xd39a8c)[_0x0707('0x4a')](0x0);return _0x587c2b[_0x0707('0x4b')](_0x4d093c,_0x0707('0x4c'));}function emit(_0x2d3bd6,_0x40cf83,_0x4318dc){io['to'](_0x2d3bd6)[_0x0707('0x4d')](_0x40cf83,_0x4318dc);}function emitVoiceQueueSummary(_0x23c13f){if(_0x23c13f[_0x0707('0x4e')]===_0x0707('0x4f')){var _0x4da7c={'id':_0x23c13f['id'],'name':_0x23c13f[_0x0707('0x40')],'strategy':_0x23c13f[_0x0707('0x50')],'answered':_0x23c13f[_0x0707('0x51')],'available':_0x23c13f[_0x0707('0x52')],'loggedIn':_0x23c13f[_0x0707('0x53')],'pTalking':_0x23c13f[_0x0707('0x54')],'sumBillable':_0x23c13f[_0x0707('0x55')],'sumDuration':_0x23c13f[_0x0707('0x56')],'sumHoldTime':_0x23c13f['sumHoldTime']||0x0,'talking':_0x23c13f[_0x0707('0x57')],'total':_0x23c13f[_0x0707('0x58')],'type':_0x23c13f[_0x0707('0x4e')],'unmanaged':_0x23c13f['unmanaged'],'abandoned':_0x23c13f['abandoned'],'waiting':_0x23c13f[_0x0707('0x59')],'loggedInDb':_0x23c13f[_0x0707('0x5a')],'dialActive':_0x23c13f['dialActive'],'dialMethod':_0x23c13f[_0x0707('0x5b')],'dialOriginateCallerIdName':_0x23c13f[_0x0707('0x5c')],'dialOriginateCallerIdNumber':_0x23c13f[_0x0707('0x5d')],'dialOriginateTimeout':_0x23c13f[_0x0707('0x5e')],'dialPrefix':_0x23c13f[_0x0707('0x5f')],'outboundAnswerAgiCallsDay':_0x23c13f['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x23c13f[_0x0707('0x60')],'outboundBlacklistCallsDay':_0x23c13f[_0x0707('0x61')],'outboundBusyCallsDay':_0x23c13f[_0x0707('0x62')],'outboundCongestionCallsDay':_0x23c13f['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x23c13f[_0x0707('0x63')],'outboundDropCallsDayCallersExit':_0x23c13f[_0x0707('0x64')],'outboundDropCallsDayTimeout':_0x23c13f[_0x0707('0x65')],'outboundNoAnswerCallsDay':_0x23c13f[_0x0707('0x66')],'outboundNoSuchCallsDay':_0x23c13f[_0x0707('0x67')],'outboundOriginateFailureCallsDay':_0x23c13f[_0x0707('0x68')],'outboundReCallsDay':_0x23c13f['outboundReCallsDay'],'outboundRejectCallsDay':_0x23c13f[_0x0707('0x69')],'outboundUnknownCallsDay':_0x23c13f[_0x0707('0x6a')],'predictiveIntervalAnsweredCalls':_0x23c13f[_0x0707('0x6b')],'predictiveIntervalAvgHoldtime':_0x23c13f[_0x0707('0x6c')],'predictiveIntervalAvgTalktime':_0x23c13f['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x23c13f['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x23c13f[_0x0707('0x6d')],'predictiveIntervalErlangCalls':_0x23c13f[_0x0707('0x6e')],'predictiveIntervalErlangCallsDroppedCalls':_0x23c13f[_0x0707('0x6f')],'predictiveIntervalHitRate':_0x23c13f[_0x0707('0x70')],'predictiveIntervalMultiplicativeFactor':_0x23c13f[_0x0707('0x71')],'predictiveIntervalPauses':_0x23c13f[_0x0707('0x72')],'predictiveIntervalAvailable':_0x23c13f[_0x0707('0x73')],'predictiveIntervalTotalCalls':_0x23c13f[_0x0707('0x74')],'message':_0x23c13f[_0x0707('0x3e')],'originated':_0x23c13f[_0x0707('0x75')],'erlangCalls':_0x23c13f[_0x0707('0x76')],'erlangCallToSecond':_0x23c13f['erlangCallToSecond'],'erlangAbandonmentRate':_0x23c13f[_0x0707('0x77')],'erlangBusyFactor':_0x23c13f[_0x0707('0x78')],'startPredictive':_0x23c13f[_0x0707('0x79')],'startProgressive':_0x23c13f['startProgressive']};if(_0x23c13f[_0x0707('0x7a')]){_0x4da7c[_0x0707('0x7a')]={'id':_0x23c13f[_0x0707('0x7a')]['id'],'name':_0x23c13f[_0x0707('0x7a')][_0x0707('0x40')],'active':_0x23c13f[_0x0707('0x7a')][_0x0707('0x7b')],'callerid':_0x23c13f[_0x0707('0x7a')]['callerid']};}if(_0x23c13f[_0x0707('0x45')]){_0x4da7c[_0x0707('0x45')]={'id':_0x23c13f[_0x0707('0x45')]['id'],'name':_0x23c13f[_0x0707('0x45')][_0x0707('0x40')]};}var _0x5e5d53=md5(JSON[_0x0707('0x49')](_0x4da7c));if(_0x23c13f[_0x0707('0x7c')]!==_0x5e5d53){_0x23c13f[_0x0707('0x7c')]=_0x5e5d53;emit(util[_0x0707('0x7d')]('voice:queue:%s',_0x4da7c[_0x0707('0x40')]),'voice_queue:save',_0x4da7c);}}}function emitCampaignSummary(_0x1f8118){if(_0x1f8118[_0x0707('0x4e')]===_0x0707('0x7e')){emit(util[_0x0707('0x7d')]('campaign:ivr:%s',_0x1f8118[_0x0707('0x40')]),_0x0707('0x7f'),_0x1f8118);}}function checkGetDataPredictive(_0x38d3e1){if(isNotNull(_0x38d3e1)&&!_[_0x0707('0x46')](_0x38d3e1)){loggerPredictive[_0x0707('0x80')](_0x0707('0x81'));loggerPredictive['info'](_0x0707('0x82'),_0x38d3e1[_0x0707('0x74')]);loggerPredictive[_0x0707('0x80')](_0x0707('0x83'),_0x38d3e1[_0x0707('0x6b')]);loggerPredictive[_0x0707('0x80')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x38d3e1[_0x0707('0x6d')]);loggerPredictive[_0x0707('0x80')](_0x0707('0x84'),_0x38d3e1[_0x0707('0x85')]);loggerPredictive[_0x0707('0x80')](_0x0707('0x86'),_0x38d3e1['predictiveIntervalAvgHoldtime']);loggerPredictive[_0x0707('0x80')](_0x0707('0x87'),_0x38d3e1[_0x0707('0x88')]);loggerPredictive['info'](_0x0707('0x89'));if(_0x38d3e1[_0x0707('0x74')]>0x0){if(!_['isUndefined'](_0x38d3e1['predictiveIntervalAvgTalktime'])&&_0x38d3e1[_0x0707('0x88')]>0x0){return!![];}loggerPredictive[_0x0707('0x80')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0x0707('0x3d')](_0x38d3e1[_0x0707('0x6c')])&&_0x38d3e1[_0x0707('0x6c')]>0x0){return!![];}loggerPredictive[_0x0707('0x80')](_0x0707('0x8a'));}else{loggerPredictive[_0x0707('0x80')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x0707('0x80')](_0x0707('0x8b'));}return![];}function mergeDataErlangB(_0x130543){return function(_0x1d0147){loggerPredictive[_0x0707('0x80')](_0x0707('0x8c'));loggerPredictive['info']('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1d0147[_0x0707('0x76')]);loggerPredictive[_0x0707('0x80')](_0x0707('0x8d'),_0x1d0147[_0x0707('0x8e')]);loggerPredictive[_0x0707('0x80')](_0x0707('0x8f'),_0x1d0147[_0x0707('0x77')]);loggerPredictive[_0x0707('0x80')](_0x0707('0x90'),_0x1d0147[_0x0707('0x78')]);loggerPredictive[_0x0707('0x80')](_0x0707('0x8f'),_0x1d0147[_0x0707('0x77')]);loggerPredictive[_0x0707('0x80')]('---------------------------');_[_0x0707('0x91')](_0x130543,_0x1d0147);};}function getDiff(_0x424a8){var _0x474a52=moment()['milliseconds'](0x0);var _0x579128=moment(_0x424a8)['milliseconds'](0x0);return _0x474a52['diff'](_0x579128,_0x0707('0x4c'));}function ifInterval(_0x5e41b8,_0x50081c){if(_[_0x0707('0x3d')](_0x50081c)){return![];}return getDiff(_0x50081c)<_0x5e41b8*0x3c;}function freeVariablesPredictive(_0x4f895a){if(isNotNull(_0x4f895a)){if(!_[_0x0707('0x3d')](_0x4f895a[_0x0707('0x92')])){_0x4f895a[_0x0707('0x92')]=undefined;loggerPredictive[_0x0707('0x80')](_0x4f895a[_0x0707('0x40')],_0x0707('0x93'));}if(!_[_0x0707('0x3d')](_0x4f895a[_0x0707('0x79')])){_0x4f895a['startPredictive']=undefined;loggerPredictive[_0x0707('0x80')](_0x4f895a[_0x0707('0x40')],_0x0707('0x94'));}if(!_[_0x0707('0x3d')](_0x4f895a[_0x0707('0x95')])){clearInterval(_0x4f895a[_0x0707('0x95')]);_0x4f895a['handlePredictive']=undefined;loggerPredictive[_0x0707('0x80')](_0x4f895a[_0x0707('0x40')],_0x0707('0x96'));}}}function erlangb(_0x1c5ba2,_0x3b8679){if(_0x3b8679===0x0){return 0x0;}var _0x16c00c=0x1;for(var _0x444b0e=0x1;_0x444b0e<=_0x3b8679;_0x444b0e+=0x1){_0x16c00c=0x1+_0x16c00c*_0x444b0e/_0x1c5ba2;}return 0x1/_0x16c00c;}function isVoiceQueueOutbound(_0x5cb706){return _0x5cb706===_0x0707('0x4f');}function isNotPreview(_0xaa1f6e){return _0xaa1f6e!=='preview';}function isCampaignIvr(_0x36263b){return _0x36263b===_0x0707('0x7e');}function getCallerId(_0x22eaf1,_0x159d44,_0x144ec7){if(!_[_0x0707('0x3d')](_0x144ec7)&&typeof _0x144ec7===_0x0707('0x97')&&!_[_0x0707('0x46')](_0x144ec7)){if(!_[_0x0707('0x3d')](_0x159d44)&&typeof _0x159d44==='string'&&!_['isEmpty'](_0x159d44)){return util[_0x0707('0x7d')]('\x22%s\x22\x20<%s>',_0x159d44,_0x144ec7);}return util[_0x0707('0x7d')](_0x0707('0x98'),_0x144ec7,_0x144ec7);}if(!_['isUndefined'](_0x22eaf1)&&typeof _0x22eaf1===_0x0707('0x97')&&!_[_0x0707('0x46')](_0x22eaf1)){return _0x22eaf1;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x1fc1f9,_0x324629){return function(_0xdee468){freeVariablesPredictive(_0x324629);emitVoiceQueueSummary(_0x324629);emitCampaignSummary(_0x324629);loggerSyncQueueSummary[_0x0707('0x99')](_0x1fc1f9,util['inspect'](_0xdee468,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x1a8600,_0x5c183e){return function(_0x8848d7){loggerPredictive[_0x0707('0x99')](_0x5c183e[_0x0707('0x40')],_0x1a8600);loggerPredictive['error'](_0x8848d7[_0x0707('0x9a')]);freeVariablesPredictive(_0x5c183e);};}function loggerCatch(_0x311b12){return function(_0x1dd7f6){logger[_0x0707('0x99')](_0x311b12,util[_0x0707('0x9b')](_0x1dd7f6,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x50ee65){return _0x50ee65&&!_[_0x0707('0x3d')](_0x50ee65)&&_0x50ee65['length']>0x0;}function decremetOriginate(_0x4f5806){if(!_[_0x0707('0x3d')](_0x4f5806)&&_0x4f5806!==null){if(typeof _0x4f5806[_0x0707('0x75')]!==_0x0707('0x9c')){if(_0x4f5806[_0x0707('0x75')]>0x0){_0x4f5806[_0x0707('0x75')]-=0x1;}else{logger['error'](_0x0707('0x9d'));}}}else{logger[_0x0707('0x99')](_0x0707('0x9e'));}}function checkContactLowerLimitOriginate(_0x3f66d7,_0x51f54c,_0x31d556){if(_0x51f54c>_0x31d556){for(var _0x3e7851=0x0;_0x3e7851<_0x51f54c-_0x31d556;_0x3e7851+=0x1){decremetOriginate(_0x3f66d7);}}}function loggerGetContactDialer(_0xab635a,_0x3ad27f,_0x2597a9){return function(_0x447af4){checkContactLowerLimitOriginate(_0x3ad27f,_0x2597a9,0x0);logger['error'](_0xab635a,util['inspect'](_0x447af4,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x2f8dba){return function(_0x388469){if(isNotNull(_0x388469)&&isNotNull(_0x388469[0x0])){if(_0x388469[0x0][_0x0707('0x9f')]>0x0){_0x2f8dba[_0x0707('0x3e')]='RESCHEDULED_CONTACTS';logger[_0x0707('0x80')]('[getContactDialer2][ReScheduled]'+_0x2f8dba[_0x0707('0x40')],_0x388469[0x0][_0x0707('0x9f')],_0x0707('0xa0'));}else{_0x2f8dba[_0x0707('0x3e')]='AVAILABLE_CONTACTS_FINISHED';logger[_0x0707('0x80')]('[getContactDialer2][Empty]'+_0x2f8dba[_0x0707('0x40')]);}}};}function notSendMessagesQueue(_0x246ea7){if(_0x246ea7[_0x0707('0xa1')]){freeVariablesPredictive(_0x246ea7);if(_0x246ea7[_0x0707('0x75')]===0x0&&_0x246ea7[_0x0707('0x57')]===0x0&&_0x246ea7[_0x0707('0x59')]===0x0&&(_0x246ea7['pTalking']||0x0)===0x0){_0x246ea7['sendMessageOneNotActive']=![];_0x246ea7[_0x0707('0x52')]=0x0;_0x246ea7[_0x0707('0x3e')]='NOT_ACTIVE';loggerSyncQueueSummary[_0x0707('0x99')](_0x0707('0xa2'),_0x246ea7['name'],_0x0707('0xa3'));}else{_0x246ea7['message']='IS_DISACTIVED';loggerSyncQueueSummary[_0x0707('0x99')](_0x0707('0xa2'),_0x246ea7['name'],'is\x20disactive');}emitVoiceQueueSummary(_0x246ea7);}}function notSendMessagesCampaign(_0xb49a75){if(_0xb49a75[_0x0707('0xa1')]){if(_0xb49a75[_0x0707('0x75')]===0x0){_0xb49a75[_0x0707('0xa1')]=![];_0xb49a75[_0x0707('0x3e')]=_0x0707('0x41');loggerSyncQueueSummary['error'](_0x0707('0xa4'),_0xb49a75[_0x0707('0x40')],_0x0707('0xa3'));}else{_0xb49a75[_0x0707('0x3e')]=_0x0707('0xa5');loggerSyncQueueSummary[_0x0707('0x99')](_0x0707('0xa4'),_0xb49a75[_0x0707('0x40')],_0x0707('0xa6'));}emitCampaignSummary(_0xb49a75);}}function createObjHistory(_0x378c41,_0x1c0dd0,_0x14b6d8,_0x4b9e69,_0x29468c){_0x378c41[_0x0707('0x3e')]=_0x14b6d8;var _0x587b56=new Action(_0x378c41,_0x1c0dd0);var _0x295104=new History(_0x587b56);_0x295104['state']=_0x4b9e69;_0x295104['statedesc']=_0x29468c;_0x295104['endtime']=_0x587b56[_0x0707('0xa7')];return _0x295104;}Dialer['prototype']['loopClearZombieChannels']=function(){var _0x5196c5=this;setInterval(function(){_0x5196c5[_0x0707('0xa8')](_0x5196c5[_0x0707('0x26')],_0x0707('0xa9'));_0x5196c5[_0x0707('0xa8')](_0x5196c5[_0x0707('0xaa')],_0x0707('0xab'));},0x32c8);};Dialer[_0x0707('0x19')][_0x0707('0xa8')]=function(_0x4b37ea,_0x785f68){var _0xc9f94f=this;for(var _0x424f3f in _0x4b37ea){if(typeof _0x4b37ea[_0x424f3f]!=='undefined'){this[_0x0707('0x1d')][_0x0707('0x1a')](function(){if(!_[_0x0707('0xac')](_0x4b37ea[_0x424f3f])){return ami[_0x0707('0xad')]({'action':_0x0707('0xae'),'channel':_0x4b37ea[_0x424f3f][_0x0707('0xaf')]})[_0x0707('0xb0')](function(_0x547311){if(_0x547311[_0x0707('0x3e')]===_0x0707('0xb1')){setTimeout(function(){if(_0x4b37ea[_0x424f3f]&&_0x4b37ea[_0x424f3f][_0x0707('0x4e')]!=='ivr'){_0xc9f94f['updateOriginated'](_0xc9f94f[_0x0707('0x1f')][_0x4b37ea[_0x424f3f][_0x0707('0xb2')]]);logger[_0x0707('0x99')](_0x0707('0xb3'),_0x785f68,_0x424f3f,_0x4b37ea[_0x424f3f][_0x0707('0xb2')]);delete _0x4b37ea[_0x424f3f];}if(_0x4b37ea[_0x424f3f]&&_0x4b37ea[_0x424f3f][_0x0707('0x4e')]===_0x0707('0x7e')){_0xc9f94f[_0x0707('0xb4')](_0xc9f94f[_0x0707('0x20')][_0x4b37ea[_0x424f3f][_0x0707('0xb2')]]);logger['error'](_0x0707('0xb5'),_0x785f68,_0x424f3f,_0x4b37ea[_0x424f3f][_0x0707('0xb2')]);delete _0x4b37ea[_0x424f3f];}},0x2328);}});}});}}};Dialer[_0x0707('0x19')][_0x0707('0xb6')]=function(_0x1ed1b8){return BPromise[_0x0707('0xb7')]()[_0x0707('0xb8')](cmHopper[_0x0707('0xb6')](_0x1ed1b8))[_0x0707('0xb0')](loggerCatch(_0x0707('0xb9')));};Dialer['prototype'][_0x0707('0xba')]=function(_0x5cbe8a){return BPromise['resolve']()['then'](cmHopperBlack[_0x0707('0xba')](_0x5cbe8a))[_0x0707('0xb0')](loggerCatch(_0x0707('0xbb')));};Dialer['prototype'][_0x0707('0xbc')]=function(_0x2a6325){return BPromise[_0x0707('0xb7')]()['then'](cmHopperBlack['checkIsBlackListIvr'](_0x2a6325))[_0x0707('0xb0')](loggerCatch(_0x0707('0xbd')));};Dialer[_0x0707('0x19')][_0x0707('0xbe')]=function(_0x3868be){return BPromise[_0x0707('0xb7')]()[_0x0707('0xb8')](cmHopperHistory[_0x0707('0xbf')](_0x3868be))[_0x0707('0xb0')](loggerCatch(_0x0707('0xc0')));};Dialer[_0x0707('0x19')][_0x0707('0xc1')]=function(_0x39979a){return BPromise['resolve']()[_0x0707('0xb8')](cmHopper[_0x0707('0xc1')](_0x39979a))[_0x0707('0xb0')](loggerCatch(_0x0707('0xc2')));};Dialer[_0x0707('0x19')][_0x0707('0xc3')]=function(_0x577472,_0x39e244,_0x552507){return BPromise['resolve']()[_0x0707('0xb8')](cmHopper['unlockContact'](_0x577472,_0x39e244,_0x552507))[_0x0707('0xb0')](loggerCatch(_0x0707('0xc4')));};Dialer[_0x0707('0x19')][_0x0707('0xc5')]=function(_0x235062,_0x527307,_0x34a5cf,_0x4b85a1,_0x3fd41a){return BPromise[_0x0707('0xb7')]()[_0x0707('0xb8')](cmHopper[_0x0707('0xc5')](_0x235062,_0x527307,_0x34a5cf,_0x4b85a1))[_0x0707('0xb0')](function(_0x52be42){_0x3fd41a[_0x0707('0xc6')]-=_0x34a5cf;_0x3fd41a['temp']=_0x3fd41a[_0x0707('0xc6')]>0x0?_0x3fd41a[_0x0707('0xc6')]:0x0;loggerCatch('[getContactDialer]\x20')(_0x52be42);});};Dialer['prototype']['getContactDialerIvr']=function(_0x14198b,_0x47f997,_0x14faa5,_0x4e1254){return BPromise[_0x0707('0xb7')]()[_0x0707('0xb8')](cmHopper[_0x0707('0xc7')](_0x14198b,_0x47f997,_0x14faa5))[_0x0707('0xb0')](function(_0x39d7e5){_0x4e1254[_0x0707('0xc6')]-=_0x47f997;_0x4e1254[_0x0707('0xc6')]=_0x4e1254[_0x0707('0xc6')]>0x0?_0x4e1254[_0x0707('0xc6')]:0x0;loggerCatch(_0x0707('0xc8'))(_0x39d7e5);});};Dialer[_0x0707('0x19')][_0x0707('0xc9')]=function(_0x2c1970){return BPromise[_0x0707('0xb7')]()[_0x0707('0xb8')](voiceQueueRt[_0x0707('0xc9')](_0x2c1970))[_0x0707('0xb0')](loggerCatch(_0x0707('0xca')));};Dialer[_0x0707('0x19')][_0x0707('0xcb')]=function(_0x52fa81){return BPromise[_0x0707('0xb7')]()[_0x0707('0xb8')](cmHopper['moveContactManagedDialer'](_0x52fa81))[_0x0707('0xb0')](loggerCatch(_0x0707('0xcc')));};Dialer[_0x0707('0x19')][_0x0707('0xcd')]=function(_0x3aa5d1){return BPromise[_0x0707('0xb7')]()[_0x0707('0xb8')](cmHopperHistory[_0x0707('0xcd')](_0x3aa5d1))[_0x0707('0xb0')](loggerCatch(_0x0707('0xce')));};Dialer[_0x0707('0x19')][_0x0707('0xb4')]=function(_0x1f977f){if(!_[_0x0707('0x3d')](_0x1f977f)&&_0x1f977f!==null){if(typeof _0x1f977f[_0x0707('0x75')]!=='undefined'){if(_0x1f977f[_0x0707('0x75')]>0x0){_0x1f977f[_0x0707('0x75')]-=0x1;}else{logger[_0x0707('0x99')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger['error'](_0x0707('0xcf'));}};Dialer[_0x0707('0x19')]['loggerHandler']=function(_0x1ac7a7,_0x4c142d){var _0x499d0a=this;return function(_0x1888ee){_0x499d0a[_0x0707('0xb4')](_0x4c142d);logger['error'](_0x1ac7a7,util[_0x0707('0x9b')](_0x1888ee,{'showHidden':![],'depth':null}));};};Dialer[_0x0707('0x19')][_0x0707('0xd0')]=function(_0x9d285f,_0x5a0f15,_0x5ca408){var _0x4490b8={'state':0x19,'statedesc':_0x0707('0xd1')};this[_0x0707('0xb4')](_0x5a0f15);this[_0x0707('0xd2')](_[_0x0707('0x91')](_0x4490b8,_['pick'](_0x5ca408,[_0x0707('0xd3'),_0x0707('0xd4'),'UserId',_0x0707('0xd5'),_0x0707('0xd6')])),_0x0707('0xd7'),_0x0707('0xd8'));logger[_0x0707('0x99')](_0x9d285f);};Dialer[_0x0707('0x19')][_0x0707('0xd9')]=function(_0x1279ad){return _0x1279ad===_0x0707('0xda');};Dialer[_0x0707('0x19')]['isTrunkReachable']=function(_0x39625a){return!_[_0x0707('0x3d')](_0x39625a)&&_0x39625a&&!_['isUndefined'](_0x39625a[_0x0707('0x40')])&&!_[_0x0707('0x3d')](_0x39625a['active'])&&_0x39625a[_0x0707('0x7b')]&&(this[_0x0707('0x22')][util['format']('SIP/%s',_0x39625a[_0x0707('0x40')])][_0x0707('0xae')]==='reachable'||this[_0x0707('0x22')][util[_0x0707('0x7d')](_0x0707('0xdb'),_0x39625a[_0x0707('0x40')])][_0x0707('0xae')]===_0x0707('0xdc'));};Dialer[_0x0707('0x19')][_0x0707('0xd2')]=function(_0x47e4bf,_0x1ab23f,_0x4a48b0){this[_0x0707('0xcd')](_0x47e4bf)['catch'](loggerCatch(_0x1ab23f));this[_0x0707('0xcb')](_0x47e4bf)[_0x0707('0xb0')](loggerCatch(_0x4a48b0));};Dialer[_0x0707('0x19')][_0x0707('0x37')]=function(_0x5d95fa){var _0x511d8a=this[_0x0707('0x26')][_0x5d95fa[_0x0707('0xdd')]];var _0x4743d5;if(!_[_0x0707('0xac')](_0x5d95fa)&&!_[_0x0707('0xac')](_0x5d95fa[_0x0707('0xde')])&&!_[_0x0707('0xac')](_0x5d95fa[_0x0707('0xde')][_0x0707('0xdf')])&&_0x5d95fa[_0x0707('0xe0')]===_0x0707('0xe1')&&_0x511d8a){if(_0x511d8a[_0x0707('0x4e')]!=='ivr'&&this[_0x0707('0x1f')][_0x511d8a[_0x0707('0xb2')]]['dialAMDActive']&&_0x5d95fa['value']===_0x0707('0xe2')){delete this['uniqueId'][_0x5d95fa[_0x0707('0xdd')]];this[_0x0707('0xb4')](this['voiceQueues'][_0x511d8a[_0x0707('0xb2')]]);this[_0x0707('0x1f')][_0x511d8a['queue']][_0x0707('0x60')]+=0x1;this[_0x0707('0x1f')][_0x511d8a[_0x0707('0xb2')]][_0x0707('0xe3')]+=0x1;_0x4743d5=new Hangup(_0x511d8a,_0x5d95fa);_0x4743d5[_0x0707('0xe4')]=0x12;_0x4743d5[_0x0707('0xe5')]='HangupInAMD';_0x4743d5[_0x0707('0xe6')]=_0x0707('0xe7');ami['emit'](_0x0707('0xe8'),ut[_0x0707('0xe9')](_0x4743d5,_0x0707('0xea')));this[_0x0707('0xd2')](_0x4743d5,_0x0707('0xeb'),'[syncHangupInAMD]');}if(_0x511d8a[_0x0707('0x4e')]!=='ivr'&&this[_0x0707('0x1f')][_0x511d8a[_0x0707('0xb2')]][_0x0707('0xec')]&&_0x5d95fa[_0x0707('0xed')]===_0x0707('0xee')){var _0x2337d8=this;return new BPromise(function(_0x588fa9,_0x3bd555){delete _0x2337d8[_0x0707('0x26')][_0x5d95fa[_0x0707('0xdd')]];_0x2337d8['updateOriginated'](_0x2337d8[_0x0707('0x1f')][_0x511d8a[_0x0707('0xb2')]]);_0x2337d8[_0x0707('0x1f')][_0x511d8a[_0x0707('0xb2')]][_0x0707('0x60')]+=0x1;_0x2337d8[_0x0707('0x1f')][_0x511d8a[_0x0707('0xb2')]][_0x0707('0xe3')]+=0x1;var _0x45373a=_0x2337d8[_0x0707('0x1f')][_0x511d8a[_0x0707('0xb2')]];var _0x17a3ea=new Hangup(_0x511d8a,_0x5d95fa);_0x17a3ea[_0x0707('0xe4')]=0x13;_0x17a3ea[_0x0707('0xe5')]=_0x0707('0xef');_0x17a3ea['membername']=_0x0707('0xe7');_0x17a3ea['countmachineretry']+=0x1;_0x17a3ea[_0x0707('0xf0')]+=0x1;_0x17a3ea[_0x0707('0xea')]=!![];ami['emit'](_0x0707('0xe8'),ut[_0x0707('0xe9')](_0x17a3ea,_0x0707('0xea')));_0x2337d8[_0x0707('0xcd')](_0x17a3ea)[_0x0707('0xb0')](loggerCatch(_0x0707('0xf1')));if(_0x17a3ea[_0x0707('0xf2')]+_0x17a3ea['countcongestionretry']+_0x17a3ea[_0x0707('0xf3')]+_0x17a3ea[_0x0707('0xf4')]+_0x17a3ea[_0x0707('0xf5')]+_0x17a3ea[_0x0707('0xf6')]+_0x17a3ea[_0x0707('0xf7')]+_0x17a3ea[_0x0707('0xf8')]>=_0x45373a[_0x0707('0xf9')]){_0x2337d8[_0x0707('0xfa')](_0x17a3ea,_0x588fa9,_0x3bd555,_0x0707('0xfb'));}else{if(_0x17a3ea[_0x0707('0xf7')]>=_0x45373a[_0x0707('0xfc')]){_0x2337d8[_0x0707('0xfd')](_0x17a3ea,_0x588fa9,_0x3bd555,'reason\x2019\x20machine....');}else{_0x2337d8[_0x0707('0xc1')]({'active':![],'countmachineretry':_0x17a3ea['countmachineretry'],'scheduledat':moment()[_0x0707('0xfe')](_0x45373a[_0x0707('0xff')],_0x0707('0x100'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x17a3ea[_0x0707('0xd3')],'ListId':_0x17a3ea['ListId'],'VoiceQueueId':_0x17a3ea['VoiceQueueId']||undefined,'CampaignId':_0x17a3ea[_0x0707('0xd6')]||undefined})[_0x0707('0xb0')](loggerCatch(_0x0707('0x101')));_0x588fa9({'reschedule':0x1});}}});}if(_0x511d8a[_0x0707('0x4e')]==='ivr'&&this[_0x0707('0x20')][_0x511d8a[_0x0707('0xb2')]][_0x0707('0xec')]&&_0x5d95fa[_0x0707('0xed')]===_0x0707('0xe2')){delete this[_0x0707('0x26')][_0x5d95fa['uniqueid']];this[_0x0707('0xb4')](this[_0x0707('0x20')][_0x511d8a[_0x0707('0xb2')]]);_0x4743d5=new Hangup(_0x511d8a,_0x5d95fa);_0x4743d5[_0x0707('0xe4')]=0x12;_0x4743d5[_0x0707('0xe5')]='HangupInAMD';_0x4743d5[_0x0707('0xe6')]='AMD';ami[_0x0707('0x4d')]('custom:amd',ut[_0x0707('0xe9')](_0x4743d5,_0x0707('0xea')));this[_0x0707('0xd2')](_0x4743d5,_0x0707('0x102'),'[syncHangupInAMDIvr]');}if(_0x511d8a[_0x0707('0x4e')]===_0x0707('0x7e')&&this[_0x0707('0x20')][_0x511d8a[_0x0707('0xb2')]][_0x0707('0xec')]&&_0x5d95fa[_0x0707('0xed')]===_0x0707('0xee')){var _0x2337d8=this;return new BPromise(function(_0x374e5c,_0x59a619){delete _0x2337d8[_0x0707('0x26')][_0x5d95fa['uniqueid']];_0x2337d8[_0x0707('0xb4')](_0x2337d8[_0x0707('0x20')][_0x511d8a[_0x0707('0xb2')]]);_0x2337d8[_0x0707('0x20')][_0x511d8a['queue']][_0x0707('0x60')]+=0x1;_0x2337d8[_0x0707('0x20')][_0x511d8a[_0x0707('0xb2')]][_0x0707('0xe3')]+=0x1;var _0x4e37b1=_0x2337d8[_0x0707('0x20')][_0x511d8a['queue']];var _0x553304=new Hangup(_0x511d8a,_0x5d95fa);_0x553304[_0x0707('0xe4')]=0x13;_0x553304[_0x0707('0xe5')]='Machine';_0x553304['membername']=_0x0707('0xe7');_0x553304[_0x0707('0xf7')]+=0x1;_0x553304[_0x0707('0xf0')]+=0x1;_0x553304[_0x0707('0xea')]=!![];ami[_0x0707('0x4d')](_0x0707('0xe8'),ut[_0x0707('0xe9')](_0x553304,'amd'));_0x2337d8[_0x0707('0xcd')](_0x553304)[_0x0707('0xb0')](loggerCatch(_0x0707('0xf1')));if(_0x553304[_0x0707('0xf2')]+_0x553304[_0x0707('0x103')]+_0x553304['countnoanswerretry']+_0x553304[_0x0707('0xf4')]+_0x553304[_0x0707('0xf5')]+_0x553304[_0x0707('0xf6')]+_0x553304['countmachineretry']+_0x553304['countagentrejectretry']>=_0x4e37b1['dialGlobalMaxRetry']){_0x2337d8[_0x0707('0xfa')](_0x553304,_0x374e5c,_0x59a619,_0x0707('0xfb'));}else{if(_0x553304[_0x0707('0xf7')]>=_0x4e37b1[_0x0707('0xfc')]){_0x2337d8[_0x0707('0xfd')](_0x553304,_0x374e5c,_0x59a619,_0x0707('0x104'));}else{_0x2337d8[_0x0707('0xc1')]({'active':![],'countmachineretry':_0x553304[_0x0707('0xf7')],'scheduledat':moment()[_0x0707('0xfe')](_0x4e37b1[_0x0707('0xff')],_0x0707('0x100'))[_0x0707('0x7d')](_0x0707('0x105')),'ContactId':_0x553304[_0x0707('0xd3')],'ListId':_0x553304[_0x0707('0xd4')],'VoiceQueueId':_0x553304['VoiceQueueId']||undefined,'CampaignId':_0x553304[_0x0707('0xd6')]||undefined})['catch'](loggerCatch(_0x0707('0x101')));_0x374e5c({'reschedule':0x1});}}});}}};Dialer['prototype'][_0x0707('0x33')]=function(_0x57bacc){var _0x5660b1=this[_0x0707('0x26')][_0x57bacc[_0x0707('0xdd')]];var _0x1a63df=this;var _0x8a0102;if(_0x5660b1&&_0x5660b1[_0x0707('0x4e')]===_0x0707('0x7e')){delete this[_0x0707('0x26')][_0x57bacc['uniqueid']];this[_0x0707('0xb4')](this[_0x0707('0x20')][_0x5660b1[_0x0707('0xb2')]]);this['campaigns'][_0x5660b1['queue']][_0x0707('0x106')]+=0x1;_0x8a0102=new Hangup(_0x5660b1,_0x57bacc);this[_0x0707('0xcd')](_0x8a0102)[_0x0707('0xb0')](loggerCatch(_0x0707('0x107')));this[_0x0707('0xcb')](_0x8a0102)[_0x0707('0xb0')](loggerCatch(_0x0707('0x108')));}if(_0x5660b1&&_0x5660b1[_0x0707('0x4e')]!==_0x0707('0x7e')&&isNotNull(this['voiceQueues'][_0x5660b1['queue']]['dialQueueProject'])){delete this[_0x0707('0x26')][_0x57bacc['uniqueid']];this[_0x0707('0xb4')](this[_0x0707('0x1f')][_0x5660b1[_0x0707('0xb2')]]);this['voiceQueues'][_0x5660b1['queue']][_0x0707('0x60')]+=0x1;this[_0x0707('0x1f')][_0x5660b1['queue']][_0x0707('0xe3')]+=0x1;_0x8a0102=new Hangup(_0x5660b1,_0x57bacc);_0x8a0102[_0x0707('0xe4')]=0x10;_0x8a0102[_0x0707('0xe5')]=_0x0707('0x109');_0x8a0102[_0x0707('0xe6')]=_0x0707('0x10a');this['createHistory'](_0x8a0102)['catch'](loggerCatch(_0x0707('0x107')));this[_0x0707('0xcb')](_0x8a0102)[_0x0707('0xb0')](loggerCatch('[syncHangupIvr]'));}if(_0x5660b1&&_0x5660b1[_0x0707('0x4e')]!=='ivr'&&!isNotNull(this[_0x0707('0x1f')][_0x5660b1['queue']]['dialQueueProject'])){delete this['uniqueId'][_0x57bacc[_0x0707('0xdd')]];this[_0x0707('0xb4')](this[_0x0707('0x1f')][_0x5660b1[_0x0707('0xb2')]]);this['voiceQueues'][_0x5660b1[_0x0707('0xb2')]][_0x0707('0x6a')]+=0x1;_0x8a0102=new Hangup(_0x5660b1,_0x57bacc);_0x8a0102[_0x0707('0xe4')]=0xc;_0x8a0102[_0x0707('0xe5')]=_0x57bacc[_0x0707('0x10b')];_0x8a0102[_0x0707('0xe6')]=_0x0707('0x10c');this[_0x0707('0xcd')](_0x8a0102)[_0x0707('0xb0')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x0707('0xcb')](_0x8a0102)['catch'](loggerCatch('[syncHangupIvr]'));}};Dialer[_0x0707('0x19')][_0x0707('0x31')]=function(_0xa5befd){var _0x1b7640=this[_0x0707('0x26')][_0xa5befd[_0x0707('0xdd')]];var _0x20f2d4=this;if(this[_0x0707('0x1f')][_0xa5befd[_0x0707('0xb2')]]){if(_0x1b7640&&_0x1b7640['type']!==_0x0707('0x7e')){delete this[_0x0707('0x26')][_0xa5befd['uniqueid']];this[_0x0707('0x1f')][_0xa5befd['queue']][_0x0707('0x60')]+=0x1;var _0x459fe3=new AgentComplete(_0x1b7640,_0xa5befd);if(_0xa5befd['reason']===_0x0707('0x10d')){_0x459fe3[_0x0707('0x10e')]=this[_0x0707('0x1f')][_0xa5befd['queue']][_0x0707('0x10f')]&&this[_0x0707('0x1f')][_0xa5befd[_0x0707('0xb2')]][_0x0707('0x110')]?moment()[_0x0707('0x7d')](_0x0707('0x105')):undefined;}this[_0x0707('0xcd')](_0x459fe3)[_0x0707('0xb0')](loggerCatch(_0x0707('0x111')));this[_0x0707('0xcb')](_0x459fe3)[_0x0707('0xb0')](loggerCatch(_0x0707('0x112')));}}};Dialer[_0x0707('0x19')]['syncAgentConnect']=function(_0x302fa6){if(this[_0x0707('0x1f')][_0x302fa6[_0x0707('0xb2')]]){if(this[_0x0707('0x26')][_0x302fa6[_0x0707('0xdd')]]&&this[_0x0707('0x26')][_0x302fa6['uniqueid']]['type']!=='ivr'){this[_0x0707('0xb4')](this[_0x0707('0x1f')][_0x302fa6[_0x0707('0xb2')]]);this[_0x0707('0x26')][_0x302fa6[_0x0707('0xdd')]]['answertime']=moment()['format'](_0x0707('0x105'));}}};Dialer[_0x0707('0x19')][_0x0707('0x113')]=function(_0x368c4d){this[_0x0707('0xcd')](_0x368c4d)[_0x0707('0xb0')](loggerCatch(_0x0707('0x111')));this['moveContactManagedDialer'](_0x368c4d)[_0x0707('0xb0')](loggerCatch(_0x0707('0x114')));};Dialer['prototype'][_0x0707('0x2c')]=function(_0x145da6){var _0x271c40=this['uniqueId'][_0x145da6['uniqueid']];var _0x445399=this;if(this[_0x0707('0x1f')][_0x145da6['queue']]){if(_0x271c40&&_0x271c40[_0x0707('0x4e')]!=='ivr'){delete this['uniqueId'][_0x145da6['uniqueid']];this[_0x0707('0xb4')](this[_0x0707('0x1f')][_0x145da6[_0x0707('0xb2')]]);_0x271c40['droptime']=moment()[_0x0707('0x7d')](_0x0707('0x105'));var _0x5de5cc=new QueueCallerAbandon(_0x271c40,_0x145da6);if(getSeconds(_0x271c40[_0x0707('0x115')],_0x271c40[_0x0707('0x116')])>=_0x271c40[_0x0707('0x117')]){this[_0x0707('0x1f')][_0x145da6['queue']][_0x0707('0x6d')]+=0x1;this[_0x0707('0x1f')][_0x145da6['queue']][_0x0707('0x65')]+=0x1;this[_0x0707('0x1f')][_0x145da6['queue']]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x5de5cc[_0x0707('0xe4')]=0xa;_0x5de5cc['statedesc']='Drop';_0x5de5cc[_0x0707('0x118')]=_0x0707('0x119');_0x5de5cc[_0x0707('0x10e')]=this[_0x0707('0x1f')][_0x145da6[_0x0707('0xb2')]][_0x0707('0x10f')]?moment()[_0x0707('0x7d')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x5de5cc['countdropretry']+=0x1;_0x5de5cc['countglobal']+=0x1;if(_0x5de5cc['countdropretry']>=this[_0x0707('0x1f')][_0x145da6[_0x0707('0xb2')]][_0x0707('0x11a')]){this[_0x0707('0x113')](_0x5de5cc);}else{this[_0x0707('0xc1')]({'active':![],'countdropretry':_0x5de5cc[_0x0707('0xf5')],'scheduledat':moment()[_0x0707('0xfe')](this[_0x0707('0x1f')][_0x145da6[_0x0707('0xb2')]][_0x0707('0x11b')],_0x0707('0x100'))[_0x0707('0x7d')](_0x0707('0x105')),'ContactId':_0x271c40[_0x0707('0xd3')],'ListId':_0x271c40[_0x0707('0xd4')],'VoiceQueueId':_0x271c40['VoiceQueueId']||undefined,'CampaignId':_0x271c40[_0x0707('0xd6')]||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));var _0x1a093a=new History(_0x5de5cc);_0x1a093a['state']=0xa;_0x1a093a[_0x0707('0xe5')]='Drop';_0x1a093a[_0x0707('0xa7')]=moment()['format'](_0x0707('0x105'));_0x1a093a['endtime']=_0x1a093a[_0x0707('0xa7')];_0x1a093a[_0x0707('0x11c')]=_0x5de5cc['calleridname'];_0x1a093a['calleridnum']=_0x5de5cc[_0x0707('0x11d')];this[_0x0707('0xcd')](_0x1a093a)[_0x0707('0xb0')](loggerCatch(_0x0707('0x11e')));}}else{this[_0x0707('0x1f')][_0x145da6[_0x0707('0xb2')]][_0x0707('0x85')]+=0x1;this[_0x0707('0x1f')][_0x145da6[_0x0707('0xb2')]]['outboundDropCallsDayCallersExit']+=0x1;_0x5de5cc[_0x0707('0xe4')]=0xb;_0x5de5cc[_0x0707('0xe5')]=_0x0707('0x11f');_0x5de5cc[_0x0707('0x118')]='CALLEREXIT';_0x5de5cc[_0x0707('0xf6')]+=0x1;_0x5de5cc[_0x0707('0xf0')]+=0x1;if(_0x5de5cc[_0x0707('0xf6')]>=this['voiceQueues'][_0x145da6[_0x0707('0xb2')]][_0x0707('0x120')]){this[_0x0707('0x113')](_0x5de5cc);}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0x5de5cc[_0x0707('0xf6')],'scheduledat':moment()[_0x0707('0xfe')](this[_0x0707('0x1f')][_0x145da6[_0x0707('0xb2')]][_0x0707('0x121')],_0x0707('0x100'))[_0x0707('0x7d')](_0x0707('0x105')),'ContactId':_0x271c40[_0x0707('0xd3')],'ListId':_0x271c40[_0x0707('0xd4')],'VoiceQueueId':_0x271c40[_0x0707('0xd5')]||undefined,'CampaignId':_0x271c40['CampaignId']||undefined})[_0x0707('0xb0')](loggerCatch(_0x0707('0x122')));var _0x1a093a=new History(_0x5de5cc);_0x1a093a['state']=0xb;_0x1a093a[_0x0707('0xe5')]=_0x0707('0x11f');_0x1a093a['starttime']=moment()[_0x0707('0x7d')](_0x0707('0x105'));_0x1a093a['endtime']=_0x1a093a[_0x0707('0xa7')];_0x1a093a[_0x0707('0x11c')]=_0x5de5cc[_0x0707('0x11c')];_0x1a093a[_0x0707('0x11d')]=_0x5de5cc[_0x0707('0x11d')];this[_0x0707('0xcd')](_0x1a093a)[_0x0707('0xb0')](loggerCatch(_0x0707('0x123')));}}}}};Dialer[_0x0707('0x19')]['syncNewExten']=function(_0x50467d){if(this[_0x0707('0xaa')][_0x50467d[_0x0707('0xdd')]]){this['actions'][_0x50467d[_0x0707('0xdd')]][_0x0707('0xaf')]=_0x50467d[_0x0707('0xaf')];}if(this[_0x0707('0x26')][_0x50467d[_0x0707('0xdd')]]){this[_0x0707('0x26')][_0x50467d[_0x0707('0xdd')]][_0x0707('0xaf')]=_0x50467d[_0x0707('0xaf')];}};Dialer[_0x0707('0x19')][_0x0707('0x39')]=function(_0x12bb89){if(strategy[this[_0x0707('0x1f')][this['actions'][_0x12bb89[_0x0707('0x124')]]['queue']][_0x0707('0x50')]]===_0x0707('0x18')){if(this[_0x0707('0xaa')][_0x12bb89['actionid']]&&_[_0x0707('0xac')](this[_0x0707('0xaa')][_0x12bb89['actionid']][_0x0707('0x125')])&&_0x12bb89[_0x0707('0xae')]==='1'&&_0x12bb89[_0x0707('0x126')]==='0'){if(this[_0x0707('0x21')][_0x12bb89[_0x0707('0x127')]]){if(!this['agents'][_0x12bb89[_0x0707('0x127')]][_0x0707('0x125')]){this[_0x0707('0x21')][_0x12bb89[_0x0707('0x127')]]['locked']=!![];this[_0x0707('0xaa')][_0x12bb89[_0x0707('0x124')]][_0x0707('0x125')]=!![];this[_0x0707('0xaa')][_0x12bb89['actionid']][_0x0707('0x127')]=_0x12bb89[_0x0707('0x127')];}}}}else if((strategy[this[_0x0707('0x1f')][this[_0x0707('0xaa')][_0x12bb89[_0x0707('0x124')]][_0x0707('0xb2')]][_0x0707('0x50')]]||'rrmemory')==='rrmemory'){if(this[_0x0707('0xaa')][_0x12bb89[_0x0707('0x124')]]){if(this[_0x0707('0x21')][_0x12bb89[_0x0707('0x127')]]){this[_0x0707('0xaa')][_0x12bb89[_0x0707('0x124')]][_0x0707('0x127')]=_0x12bb89[_0x0707('0x127')];if(_[_0x0707('0xac')](this[_0x0707('0x28')][this[_0x0707('0xaa')][_0x12bb89[_0x0707('0x124')]][_0x0707('0xb2')]])){this[_0x0707('0x28')][this[_0x0707('0xaa')][_0x12bb89[_0x0707('0x124')]][_0x0707('0xb2')]]=[];}this['queueBooked'][this[_0x0707('0xaa')][_0x12bb89[_0x0707('0x124')]]['queue']][_0x0707('0x128')](_[_0x0707('0x91')](_[_0x0707('0x129')](this[_0x0707('0xaa')][_0x12bb89[_0x0707('0x124')]],[_0x0707('0x12a'),_0x0707('0x127')]),{'status':_0x12bb89['status'],'paused':_0x12bb89['paused']}));}}}};function unlockQueueStatus(_0x10f46a,_0xe8f959){setTimeout(function(){if(_[_0x0707('0x3d')](_0x10f46a[_0x0707('0x12b')])){loggerBooked[_0x0707('0x99')]('[unlockQueueStatus][undefined]',_0xe8f959);}_0x10f46a['queueStatusComplete']=!![];loggerBooked[_0x0707('0x80')]('[booked][unlockQueueStatus]',_0xe8f959,JSON[_0x0707('0x49')](_[_0x0707('0x129')](_0x10f46a,[_0x0707('0x40'),_0x0707('0x12b')])));},0x1f3);}Dialer[_0x0707('0x19')][_0x0707('0x3b')]=function(_0x5dc02f){var _0x4609d8=this;var _0x48e586=_0x4609d8[_0x0707('0x1f')][_0x4609d8[_0x0707('0xaa')][_0x5dc02f[_0x0707('0x124')]][_0x0707('0xb2')]];if(strategy[this[_0x0707('0x1f')][this[_0x0707('0xaa')][_0x5dc02f[_0x0707('0x124')]][_0x0707('0xb2')]][_0x0707('0x50')]]===_0x0707('0x18')){if(this[_0x0707('0xaa')][_0x5dc02f[_0x0707('0x124')]]&&this[_0x0707('0xaa')][_0x5dc02f[_0x0707('0x124')]][_0x0707('0x127')]){this['preview'][_0x0707('0x12c')](this[_0x0707('0xaa')][_0x5dc02f[_0x0707('0x124')]][_0x0707('0x12a')],this[_0x0707('0xaa')][_0x5dc02f['actionid']][_0x0707('0x127')])['catch'](function(_0x32d744){logger[_0x0707('0x99')]('[Catch][Preview][syncQueueStatusComplete]',util[_0x0707('0x9b')](_0x32d744,{'showHidden':![],'depth':null}));})[_0x0707('0x1c')](function(){_0x4609d8[_0x0707('0xb4')](_0x4609d8[_0x0707('0x1f')][_0x4609d8[_0x0707('0xaa')][_0x5dc02f['actionid']][_0x0707('0xb2')]]);_0x4609d8[_0x0707('0x21')][_0x4609d8[_0x0707('0xaa')][_0x5dc02f['actionid']][_0x0707('0x127')]][_0x0707('0x125')]=![];delete _0x4609d8['actions'][_0x5dc02f['actionid']];unlockQueueStatus(_0x48e586);});}else{this['updateOriginated'](this[_0x0707('0x1f')][this[_0x0707('0xaa')][_0x5dc02f['actionid']][_0x0707('0xb2')]]);this[_0x0707('0xc1')]({'active':![],'ContactId':this[_0x0707('0xaa')][_0x5dc02f['actionid']][_0x0707('0xd3')],'ListId':this[_0x0707('0xaa')][_0x5dc02f[_0x0707('0x124')]][_0x0707('0xd4')],'VoiceQueueId':this[_0x0707('0xaa')][_0x5dc02f[_0x0707('0x124')]][_0x0707('0xd5')]||undefined,'CampaignId':this['actions'][_0x5dc02f['actionid']]['CampaignId']||undefined})['catch'](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this['actions'][_0x5dc02f[_0x0707('0x124')]];unlockQueueStatus(_0x48e586);}}else if((strategy[this[_0x0707('0x1f')][this[_0x0707('0xaa')][_0x5dc02f[_0x0707('0x124')]]['queue']][_0x0707('0x50')]]||'rrmemory')===_0x0707('0x17')){var _0x356452;if(this[_0x0707('0xaa')][_0x5dc02f[_0x0707('0x124')]]&&!_[_0x0707('0x46')](this['queueBooked'][this[_0x0707('0xaa')][_0x5dc02f['actionid']][_0x0707('0xb2')]])){if(this[_0x0707('0x29')][_0x4609d8[_0x0707('0xaa')][_0x5dc02f['actionid']][_0x0707('0xb2')]]){this['queueBookedRR'][_0x4609d8['actions'][_0x5dc02f[_0x0707('0x124')]][_0x0707('0xb2')]]=this[_0x0707('0x29')][this[_0x0707('0xaa')][_0x5dc02f[_0x0707('0x124')]][_0x0707('0xb2')]]?this[_0x0707('0x29')][this[_0x0707('0xaa')][_0x5dc02f[_0x0707('0x124')]][_0x0707('0xb2')]]:this['queueBooked'][this['actions'][_0x5dc02f[_0x0707('0x124')]]['queue']]?this['queueBooked'][this[_0x0707('0xaa')][_0x5dc02f[_0x0707('0x124')]][_0x0707('0xb2')]][_0x0707('0x12d')]||0x0:0x0;}this[_0x0707('0x28')][this[_0x0707('0xaa')][_0x5dc02f[_0x0707('0x124')]][_0x0707('0xb2')]][_0x0707('0x12d')]=this[_0x0707('0x29')][this[_0x0707('0xaa')][_0x5dc02f['actionid']][_0x0707('0xb2')]];for(var _0x3ce3f5=0x0;_0x3ce3f5=0x0;})[_0x0707('0xb0')](myreject(_0x5f34c9)));}}else{_0x39059c[_0x0707('0x128')](ami['Action']({'action':_0x0707('0x148'),'command':util[_0x0707('0x7d')](_0x0707('0x14b'),_0x34376e,!_['isUndefined'](config['timezones'][_0x32735d])?_0x32735d:'')})['then'](function(_0x5510a5){return _0x5510a5[_0x0707('0x14c')][_0x0707('0x149')](_0x0707('0x14a'))>=0x0;})[_0x0707('0xb0')](myreject(_0x5f34c9)));}BPromise[_0x0707('0x14d')](_0x39059c)[_0x0707('0xb8')](function(_0x5b6677){var _0xe9deb3=_[_0x0707('0x14e')](_0x5b6677);if(_0xe9deb3){return _0x3f03d0(_0xe9deb3);}else{_0x561891[_0x0707('0x3e')]=_0x3df920?_0x0707('0x14f'):_0x0707('0x150');return _0x5f34c9(msgResponse(_0x0707('0x151'),'Failure',_0x0707('0x152')+_0x3df920+'\x20'+_0xab2bba+'\x20Interval\x20is\x20overtime:\x20'+util[_0x0707('0x9b')](_0x34376e,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x32735d));}})[_0x0707('0xb0')](function(_0x5b22b5){return _0x5f34c9(msgResponse(_0x0707('0x140'),_0x0707('0x142'),JSON[_0x0707('0x49')](_0x5b22b5)));});});};Dialer[_0x0707('0x19')][_0x0707('0x153')]=function(_0x495c9f){var _0x4a4d97=this;return function(){switch(_0x495c9f[_0x0707('0x5b')]){case _0x0707('0x154'):freeVariablesPredictive(_0x495c9f);_0x4a4d97['handlePower'](_0x495c9f,0x1);break;case _0x0707('0x155'):freeVariablesPredictive(_0x495c9f);_0x4a4d97['handlePower'](_0x495c9f,_0x495c9f['dialPowerLevel']);break;case _0x0707('0x156'):_0x4a4d97[_0x0707('0x156')](_0x495c9f);break;case _0x0707('0x6'):freeVariablesPredictive(_0x495c9f);_0x4a4d97[_0x0707('0x157')](_0x495c9f,0x1);break;default:freeVariablesPredictive(_0x495c9f);logger['error'](_0x0707('0x158'),_0x495c9f[_0x0707('0x40')],_0x0707('0x159'));}};};Dialer['prototype'][_0x0707('0x15a')]=function(_0x1097cc){var _0x5c98a5=this;return function(){_0x5c98a5[_0x0707('0x15b')](_0x1097cc);};};Dialer['prototype']['syncQueueSummary']=function(_0x427eb1){var _0x35682d=this;if(isNotPreview(_0x427eb1[_0x0707('0x5b')])){if(isVoiceQueueOutbound(_0x427eb1[_0x0707('0x4e')])&&isActive(_0x427eb1[_0x0707('0x15c')])){_0x427eb1['sendMessageOneNotActive']=!![];BPromise[_0x0707('0xb7')]()[_0x0707('0xb8')](checkIsLoggedIn(_0x427eb1,_0x427eb1['loggedIn']))[_0x0707('0xb8')](checkIsActive(_0x427eb1,_0x427eb1[_0x0707('0x15c')]))['then'](checkInterval(_0x427eb1))[_0x0707('0xb8')](_0x35682d[_0x0707('0x13a')](_0x427eb1))[_0x0707('0xb8')](_0x35682d[_0x0707('0x13f')](_0x427eb1[_0x0707('0x15d')],_0x427eb1[_0x0707('0x15e')],_0x427eb1[_0x0707('0x40')],_0x427eb1))['then'](_0x35682d['checkIfTimeIntervals'](_0x427eb1[_0x0707('0x45')],_0x427eb1['dialTimezone'],_0x427eb1[_0x0707('0x40')],_0x427eb1))[_0x0707('0xb8')](_0x35682d[_0x0707('0x153')](_0x427eb1))['catch'](loggerCatchQueueSummary('[syncQueueSummary]',_0x427eb1));}else{notSendMessagesQueue(_0x427eb1);}}else{freeVariablesPredictive(_0x427eb1);}};Dialer['prototype'][_0x0707('0x139')]=function(){var _0x374326=this;var _0x137985;for(var _0x1a996b in this['campaigns']){if(typeof this[_0x0707('0x20')][_0x1a996b]!==_0x0707('0x9c')){_0x137985=this['campaigns'][_0x1a996b];if(isCampaignIvr(_0x137985[_0x0707('0x4e')])&&isActive(_0x137985['active'])){_0x137985[_0x0707('0xa1')]=!![];BPromise[_0x0707('0xb7')]()['then'](checkIsActive(_0x137985,_0x137985['active']))[_0x0707('0xb8')](checkInterval(_0x137985))[_0x0707('0xb8')](_0x374326[_0x0707('0x13a')](_0x137985))[_0x0707('0xb8')](_0x374326[_0x0707('0x13f')](_0x137985['dialGlobalInterval'],_0x137985[_0x0707('0x15e')],_0x137985[_0x0707('0x40')],_0x137985))[_0x0707('0xb8')](_0x374326[_0x0707('0x141')](_0x137985[_0x0707('0x45')],_0x137985[_0x0707('0x15e')],_0x137985[_0x0707('0x40')],_0x137985))[_0x0707('0xb8')](_0x374326[_0x0707('0x15a')](_0x137985))[_0x0707('0xb0')](loggerCatchQueueSummary(_0x0707('0x15f'),_0x137985));}else{notSendMessagesCampaign(_0x137985);}}}};function getCallerIdRandom(_0x5c0522,_0x24e006){var _0x50681a;var _0x13c9ff;var _0x7fa3a4;if(_0x24e006<=0x0){_0x24e006=0x1;}_0x50681a=new RegExp(_0x0707('0x160')+_0x24e006+'}$');_0x13c9ff=Math[_0x0707('0x161')](0xa,_0x24e006-0x1);_0x7fa3a4=Math[_0x0707('0x161')](0xa,_0x24e006)-0x1;return util[_0x0707('0x7d')]('%s',_[_0x0707('0x162')](_0x5c0522,_0x50681a,_['random'](_0x13c9ff,_0x7fa3a4)));}function extractCalleridName(_0x792b1b){var _0x4e4a6f=_0x792b1b[_0x0707('0x163')](/"(.*?)"/);return _0x4e4a6f?_0x4e4a6f[0x1]:_0x792b1b;}function extractCalleridNumber(_0x2d2f0f){var _0x3911d1=_0x2d2f0f[_0x0707('0x163')](/<(.*?)>/);return _0x3911d1?_0x3911d1[0x1]:_0x2d2f0f;}Dialer[_0x0707('0x19')][_0x0707('0x164')]=function(_0x1715d9,_0x4c9f1f){var _0x2e3559=this;var _0x5a38ec=uuid['v4']();this[_0x0707('0xaa')][_0x5a38ec]=new Action(_0x1715d9,_0x4c9f1f,_0x5a38ec);return new BPromise(function(_0x55f2be,_0x1416b3){if(_[_0x0707('0x3d')](_0x1715d9)&&typeof _0x1715d9!==_0x0707('0x165')){return _0x1416b3(msgResponse(_0x0707('0x166'),'Failure','voiceQueue\x20is\x20undefine'));}if(_[_0x0707('0x3d')](_0x4c9f1f[_0x0707('0x167')][_0x0707('0x168')])||_0x4c9f1f['Contact'][_0x0707('0x168')]===null){return _0x1416b3(msgResponse(_0x0707('0x166'),_0x0707('0x142'),_0x0707('0x169')));}var _0x1ceb1d={'XMD-CALLERID':_0x2e3559[_0x0707('0xaa')][_0x5a38ec][_0x0707('0x16a')](),'XMD-AGI':_0x1715d9[_0x0707('0x16b')]?util['format'](_0x0707('0x16c'),ipAgi,_0x1715d9['dialQueueProject']):_0x0707('0x16d'),'XMD-AGIAFTER':_0x1715d9[_0x0707('0x10f')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x1715d9[_0x0707('0x10f')]):_0x0707('0x16d'),'XMD-QUEUE':_0x1715d9[_0x0707('0x4e')]===_0x0707('0x4f')?util[_0x0707('0x7d')](_0x0707('0x16e'),_0x1715d9[_0x0707('0x40')],_0x1715d9[_0x0707('0x16f')]||'',_0x1715d9[_0x0707('0x110')]?'c':'',_0x1715d9['dialQueueTimeout']||0x3):_0x0707('0x16d'),'XMD-CONTACTID':_0x4c9f1f[_0x0707('0xd3')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x2e3559[_0x0707('0xaa')][_0x5a38ec][_0x0707('0x16a')](),'XMD-AMD':_0x1715d9[_0x0707('0xec')]?'ACTIVE':_0x0707('0x16d'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x1715d9['dialAMDActive']){_0x1ceb1d['XMD-AMDINITIALSILENCE']=_0x1715d9[_0x0707('0x170')]||0x9c4;_0x1ceb1d['XMD-AMDGREETING']=_0x1715d9['dialAMDGreeting']||0x5dc;_0x1ceb1d[_0x0707('0x171')]=_0x1715d9[_0x0707('0x172')]||0x320;_0x1ceb1d['XMD-AMDTOTALANALYSISTIME']=_0x1715d9[_0x0707('0x173')]||0x1388;_0x1ceb1d[_0x0707('0x174')]=_0x1715d9[_0x0707('0x175')]||0x64;_0x1ceb1d[_0x0707('0x176')]=_0x1715d9[_0x0707('0x177')]||0x32;_0x1ceb1d['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x1715d9['dialAMDMaximumNumberOfWords']||0x3;_0x1ceb1d[_0x0707('0x178')]=_0x1715d9['dialAMDSilenceThreshold']||0x100;_0x1ceb1d['XMD-AMDMAXIMUMWORDLENGTH']=_0x1715d9[_0x0707('0x179')]||0x1388;}if(_0x1715d9[_0x0707('0x4e')]===_0x0707('0x4f')){_0x1ceb1d[_0x0707('0x17a')]=_0x4c9f1f[_0x0707('0xd5')];}else{_0x1ceb1d[_0x0707('0x17b')]=_0x4c9f1f['CampaignId'];}for(var _0x2da294 in _0x4c9f1f[_0x0707('0x167')]){if(typeof _0x4c9f1f[_0x0707('0x167')][_0x2da294]!=='undefined'){if(isNotNull(_0x4c9f1f[_0x0707('0x167')][_0x2da294])&&_0x2da294!=='id'&&_0x2da294!=='tags'&&_0x2da294!=='createdAt'&&_0x2da294!==_0x0707('0x17c')){_0x1ceb1d[util[_0x0707('0x7d')]('%s%s',_0x0707('0x17d'),_[_0x0707('0x17e')](_0x2da294))]=_0x4c9f1f['Contact'][_0x2da294];}}}var _0x5f55f2=_0x2e3559[_0x0707('0x13b')](_0x1715d9[_0x0707('0x7a')])?getCallerId(_0x1715d9[_0x0707('0x7a')][_0x0707('0x17f')],_0x1715d9[_0x0707('0x5c')],_0x1715d9[_0x0707('0x180')]>0x0?getCallerIdRandom(_0x1715d9[_0x0707('0x5d')],_0x1715d9['dialRandomLastDigitCallerIdNumber']):_0x1715d9['dialOriginateCallerIdNumber']):getCallerId(_['isNil'](_0x1715d9[_0x0707('0x13c')])?_0x1715d9['Trunk'][_0x0707('0x17f')]:_0x1715d9['TrunkBackup'][_0x0707('0x17f')],_0x1715d9[_0x0707('0x5c')],_0x1715d9['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x1715d9[_0x0707('0x5d')],_0x1715d9['dialRandomLastDigitCallerIdNumber']):_0x1715d9[_0x0707('0x5d')]);if(_0x5f55f2){_0x1ceb1d[_0x0707('0x181')]=_0x2e3559[_0x0707('0xaa')][_0x5a38ec][_0x0707('0x182')]=extractCalleridName(_0x5f55f2);_0x1ceb1d['XMD-ORIGINATECALLERIDNUM']=_0x2e3559['actions'][_0x5a38ec]['originatecalleridnum']=extractCalleridNumber(_0x5f55f2);}return ami['Action']({'actionid':_0x5a38ec,'action':_0x0707('0x166'),'channel':_0x2e3559['isTrunkReachable'](_0x1715d9[_0x0707('0x7a')])?util[_0x0707('0x7d')](_0x0707('0x183'),_0x1715d9[_0x0707('0x7a')][_0x0707('0x40')],isNotNull(_0x1715d9[_0x0707('0x5f')])?_0x1715d9[_0x0707('0x5f')]['trim']()||'':'',_0x1715d9[_0x0707('0x184')]>0x0?_0x4c9f1f[_0x0707('0x167')]['phone'][_0x0707('0x185')](_0x1715d9['dialCutDigit']):_0x4c9f1f[_0x0707('0x167')][_0x0707('0x168')]):util[_0x0707('0x7d')](_0x0707('0x183'),_[_0x0707('0xac')](_0x1715d9[_0x0707('0x13c')])?_0x1715d9[_0x0707('0x7a')][_0x0707('0x40')]:_0x1715d9[_0x0707('0x13c')][_0x0707('0x40')],isNotNull(_0x1715d9[_0x0707('0x5f')])?_0x1715d9[_0x0707('0x5f')][_0x0707('0x186')]()||'':'',_0x1715d9[_0x0707('0x184')]>0x0?_0x4c9f1f[_0x0707('0x167')][_0x0707('0x168')][_0x0707('0x185')](_0x1715d9[_0x0707('0x184')]):_0x4c9f1f['Contact']['phone']),'callerid':_0x5f55f2,'Exten':_0x0707('0xe1'),'Context':'from-sip','Priority':'1','variable':_0x1ceb1d,'timeout':(_0x1715d9[_0x0707('0x5e')]||0x1e)*0x3e8,'async':!![],'channelid':_0x5a38ec})[_0x0707('0xb8')](function(_0x14b7b8){return _0x55f2be(_0x14b7b8);})[_0x0707('0xb0')](function(_0x58c1f1){_0x1715d9[_0x0707('0x68')]+=0x1;var _0x1c9a7c=new History(_0x2e3559[_0x0707('0xaa')][_0x5a38ec]);logger['error'](util[_0x0707('0x7d')](_0x0707('0x187'),JSON[_0x0707('0x49')](_0x58c1f1)));_0x1c9a7c['state']=0xe;_0x1c9a7c[_0x0707('0xe5')]=_0x0707('0x188');_0x1c9a7c[_0x0707('0xa7')]=moment()[_0x0707('0x7d')]('YYYY-MM-DD\x20HH:mm:ss');_0x1c9a7c[_0x0707('0x189')]=_0x1c9a7c['starttime'];_0x2e3559[_0x0707('0xcd')](_0x1c9a7c)[_0x0707('0xb0')](loggerCatch(_0x0707('0x18a')));_0x2e3559['moveContactManagedDialer'](_0x1c9a7c)[_0x0707('0xb0')](loggerCatch('[originate][error]'))['finally'](function(){delete _0x2e3559[_0x0707('0xaa')][_0x5a38ec];return _0x1416b3(msgResponse(_0x0707('0x166'),_0x0707('0x18b'),_0x0707('0x18c')));});});});};Dialer['prototype'][_0x0707('0x2f')]=function(_0x77d8ea){var _0x12044f=this[_0x0707('0xaa')][_0x77d8ea[_0x0707('0x124')]];if(_0x12044f){delete this['actions'][_0x77d8ea[_0x0707('0x124')]];_0x12044f[_0x0707('0x116')]=moment()[_0x0707('0x7d')](_0x0707('0x105'));var _0x455576=_0x12044f[_0x0707('0x4e')]==='ivr'?this[_0x0707('0x20')][_0x12044f[_0x0707('0xb2')]]:this[_0x0707('0x1f')][_0x12044f['getQueue']()];if(!this[_0x0707('0xd9')](_0x77d8ea[_0x0707('0x18d')])){this[_0x0707('0xb4')](_0x455576);return this[_0x0707('0x18e')](_0x12044f,_0x455576,_0x77d8ea)[_0x0707('0xb0')](loggerCatch(_0x0707('0x18f')));}this[_0x0707('0x26')][_0x77d8ea[_0x0707('0xdd')]]=_0x12044f;}};Dialer[_0x0707('0x19')][_0x0707('0x190')]=function(_0x24190f,_0x234c76,_0x17f0c9){var _0x68c6a2=new History(_0x234c76);if(_0x68c6a2[_0x0707('0xf2')]+_0x68c6a2[_0x0707('0x103')]+_0x68c6a2[_0x0707('0xf3')]+_0x68c6a2[_0x0707('0xf4')]+_0x68c6a2[_0x0707('0xf5')]+_0x68c6a2[_0x0707('0xf6')]+_0x68c6a2[_0x0707('0xf7')]+_0x68c6a2[_0x0707('0xf8')]>=_0x17f0c9[_0x0707('0xf9')]-0x1){return!![];}switch(_0x24190f){case 0x3:if(_0x68c6a2[_0x0707('0xf3')]>=_0x17f0c9[_0x0707('0x191')]-0x1){return!![];}this[_0x0707('0xc1')]({'active':![],'countnoanswerretry':_0x68c6a2['countnoanswerretry']+=0x1,'scheduledat':moment()[_0x0707('0xfe')](_0x17f0c9[_0x0707('0x192')],'minutes')[_0x0707('0x7d')](_0x0707('0x105')),'ContactId':_0x68c6a2[_0x0707('0xd3')],'ListId':_0x68c6a2[_0x0707('0xd4')],'VoiceQueueId':_0x68c6a2[_0x0707('0xd5')]||undefined,'CampaignId':_0x68c6a2[_0x0707('0xd6')]||undefined})[_0x0707('0xb0')](loggerCatch(_0x0707('0x193')));break;case 0x5:if(_0x68c6a2[_0x0707('0xf2')]>=_0x17f0c9['dialBusyMaxRetry']-0x1){return!![];}this[_0x0707('0xc1')]({'active':![],'countbusyretry':_0x68c6a2[_0x0707('0xf2')]+=0x1,'scheduledat':moment()[_0x0707('0xfe')](_0x17f0c9[_0x0707('0x194')],_0x0707('0x100'))[_0x0707('0x7d')](_0x0707('0x105')),'ContactId':_0x68c6a2[_0x0707('0xd3')],'ListId':_0x68c6a2[_0x0707('0xd4')],'VoiceQueueId':_0x68c6a2[_0x0707('0xd5')]||undefined,'CampaignId':_0x68c6a2[_0x0707('0xd6')]||undefined})['catch'](loggerCatch(_0x0707('0x195')));break;case 0x8:if(_0x68c6a2['countcongestionretry']>=_0x17f0c9[_0x0707('0x196')]-0x1){return!![];}this[_0x0707('0xc1')]({'active':![],'countcongestionretry':_0x68c6a2[_0x0707('0x103')]+=0x1,'scheduledat':moment()[_0x0707('0xfe')](_0x17f0c9[_0x0707('0x197')],_0x0707('0x100'))[_0x0707('0x7d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x68c6a2[_0x0707('0xd3')],'ListId':_0x68c6a2[_0x0707('0xd4')],'VoiceQueueId':_0x68c6a2['VoiceQueueId']||undefined,'CampaignId':_0x68c6a2['CampaignId']||undefined})[_0x0707('0xb0')](loggerCatch(_0x0707('0x198')));break;case 0x0:if(_0x68c6a2[_0x0707('0xf4')]>=_0x17f0c9[_0x0707('0x199')]-0x1){return!![];}else{this[_0x0707('0xc1')]({'active':![],'countnosuchnumberretry':_0x68c6a2[_0x0707('0xf4')]+=0x1,'scheduledat':moment()[_0x0707('0xfe')](_0x17f0c9[_0x0707('0x19a')],_0x0707('0x100'))[_0x0707('0x7d')](_0x0707('0x105')),'ContactId':_0x68c6a2['ContactId'],'ListId':_0x68c6a2[_0x0707('0xd4')],'VoiceQueueId':_0x68c6a2['VoiceQueueId']||undefined,'CampaignId':_0x68c6a2[_0x0707('0xd6')]||undefined})[_0x0707('0xb0')](loggerCatch(_0x0707('0x19b')));}break;case 0xa:if(_0x68c6a2[_0x0707('0xf5')]>=_0x17f0c9[_0x0707('0x11a')]-0x1){return!![];}this[_0x0707('0xc1')]({'active':![],'countdropretry':_0x68c6a2[_0x0707('0xf5')]+=0x1,'scheduledat':moment()[_0x0707('0xfe')](_0x17f0c9[_0x0707('0x11b')],_0x0707('0x100'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x68c6a2[_0x0707('0xd3')],'ListId':_0x68c6a2['ListId'],'VoiceQueueId':_0x68c6a2[_0x0707('0xd5')]||undefined,'CampaignId':_0x68c6a2['CampaignId']||undefined})[_0x0707('0xb0')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x68c6a2[_0x0707('0xf6')]>=_0x17f0c9[_0x0707('0x120')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countabandonedretry':_0x68c6a2[_0x0707('0xf6')]+=0x1,'scheduledat':moment()['add'](_0x17f0c9[_0x0707('0x121')],_0x0707('0x100'))[_0x0707('0x7d')](_0x0707('0x105')),'ContactId':_0x68c6a2[_0x0707('0xd3')],'ListId':_0x68c6a2['ListId'],'VoiceQueueId':_0x68c6a2['VoiceQueueId']||undefined,'CampaignId':_0x68c6a2[_0x0707('0xd6')]||undefined})[_0x0707('0xb0')](loggerCatch(_0x0707('0x122')));break;case 0x13:if(_0x68c6a2[_0x0707('0xf7')]>=_0x17f0c9[_0x0707('0xfc')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countmachineretry':_0x68c6a2[_0x0707('0xf7')]+=0x1,'scheduledat':moment()[_0x0707('0xfe')](_0x17f0c9[_0x0707('0xff')],_0x0707('0x100'))[_0x0707('0x7d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x68c6a2['ContactId'],'ListId':_0x68c6a2[_0x0707('0xd4')],'VoiceQueueId':_0x68c6a2[_0x0707('0xd5')]||undefined,'CampaignId':_0x68c6a2['CampaignId']||undefined})[_0x0707('0xb0')](loggerCatch(_0x0707('0x101')));break;case 0x14:if(_0x68c6a2[_0x0707('0xf8')]>=_0x17f0c9[_0x0707('0x19c')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countagentrejectretry':_0x68c6a2[_0x0707('0xf8')]+=0x1,'scheduledat':moment()[_0x0707('0xfe')](_0x17f0c9[_0x0707('0x19d')],'minutes')[_0x0707('0x7d')](_0x0707('0x105')),'ContactId':_0x68c6a2[_0x0707('0xd3')],'ListId':_0x68c6a2[_0x0707('0xd4')],'VoiceQueueId':_0x68c6a2['VoiceQueueId']||undefined,'CampaignId':_0x68c6a2[_0x0707('0xd6')]||undefined})[_0x0707('0xb0')](loggerCatch(_0x0707('0x19e')));break;default:return!![];}};Dialer[_0x0707('0x19')][_0x0707('0x18e')]=function(_0x1e7233,_0x5576b9,_0xfe36a4){var _0x28fc23=this;var _0x385b28=new History(_0x1e7233);return new BPromise(function(_0x3b43c9,_0x4d41f8){if(_[_0x0707('0x3d')](_0x5576b9)&&typeof _0x5576b9!==_0x0707('0x165')){return _0x4d41f8(msgResponse(_0x0707('0x19f'),_0x0707('0x142'),_0x0707('0x1a0')));}if(_['isUndefined'](_0xfe36a4)&&typeof _0xfe36a4!==_0x0707('0x165')){return _0x4d41f8(msgResponse(_0x0707('0x19f'),_0x0707('0x142'),_0x0707('0x1a1')));}switch(_0xfe36a4[_0x0707('0x1a2')]){case'0':_0x5576b9[_0x0707('0x67')]+=0x1;_0x385b28[_0x0707('0xe4')]=0x0;_0x385b28[_0x0707('0xe5')]='NoSuchNumber';_0x385b28[_0x0707('0xf4')]+=0x1;_0x385b28[_0x0707('0xf0')]+=0x1;ami[_0x0707('0x4d')](_0x0707('0x1a3'),ut['buildObj'](_0x1e7233,_0x0707('0x1a4')));_0x28fc23['createHistory'](_0x385b28)[_0x0707('0xb0')](loggerCatch(_0x0707('0xf1')));if(_0x28fc23[_0x0707('0x190')](0x0,_0x1e7233,_0x5576b9)){if(_0x385b28[_0x0707('0xf4')]>=_0x5576b9['dialNoSuchNumberMaxRetry']){_0x28fc23[_0x0707('0xfd')](_0x385b28,_0x3b43c9,_0x4d41f8,_0x0707('0x1a5'));}else{_0x28fc23['stateGlobal'](_0x385b28,_0x3b43c9,_0x4d41f8,_0x0707('0x1a5'));}}break;case'3':_0x5576b9['outboundNoAnswerCallsDay']+=0x1;_0x385b28[_0x0707('0xe4')]=0x3;_0x385b28[_0x0707('0xe5')]=_0x0707('0x1a6');_0x385b28[_0x0707('0xf3')]+=0x1;_0x385b28[_0x0707('0xf0')]+=0x1;ami[_0x0707('0x4d')]('custom:agentnoanswer',ut['buildObj'](_0x1e7233,_0x0707('0x1a7')));_0x28fc23[_0x0707('0xcd')](_0x385b28)[_0x0707('0xb0')](loggerCatch(_0x0707('0x1a8')));if(_0x28fc23[_0x0707('0x190')](0x3,_0x1e7233,_0x5576b9)){if(_0x385b28[_0x0707('0xf3')]>=_0x5576b9[_0x0707('0x191')]){_0x28fc23[_0x0707('0xfd')](_0x385b28,_0x3b43c9,_0x4d41f8,_0x0707('0x1a9'));}else{_0x28fc23['stateGlobal'](_0x385b28,_0x3b43c9,_0x4d41f8,_0x0707('0x1a9'));}}break;case'5':_0x5576b9['outboundBusyCallsDay']+=0x1;_0x385b28[_0x0707('0xe4')]=0x5;_0x385b28[_0x0707('0xe5')]=_0x0707('0x1aa');_0x385b28['countbusyretry']+=0x1;_0x385b28[_0x0707('0xf0')]+=0x1;ami[_0x0707('0x4d')](_0x0707('0x1ab'),ut[_0x0707('0xe9')](_0x1e7233,_0x0707('0x1ac')));_0x28fc23[_0x0707('0xcd')](_0x385b28)['catch'](loggerCatch(_0x0707('0x1ad')));if(_0x28fc23[_0x0707('0x190')](0x5,_0x1e7233,_0x5576b9)){if(_0x385b28[_0x0707('0xf2')]>=_0x5576b9[_0x0707('0x1ae')]){_0x28fc23[_0x0707('0xfd')](_0x385b28,_0x3b43c9,_0x4d41f8,'reason\x205\x20busy');}else{_0x28fc23[_0x0707('0xfa')](_0x385b28,_0x3b43c9,_0x4d41f8,'reason\x205\x20busy');}}break;case'8':_0x5576b9[_0x0707('0x1af')]+=0x1;_0x385b28[_0x0707('0xe4')]=0x8;_0x385b28['statedesc']=_0x0707('0x1b0');_0x385b28['countcongestionretry']+=0x1;_0x385b28[_0x0707('0xf0')]+=0x1;ami[_0x0707('0x4d')](_0x0707('0x1b1'),ut[_0x0707('0xe9')](_0x1e7233,_0x0707('0x1b2')));_0x28fc23[_0x0707('0xcd')](_0x385b28)[_0x0707('0xb0')](loggerCatch(_0x0707('0x1b3')));if(_0x28fc23[_0x0707('0x190')](0x8,_0x1e7233,_0x5576b9)){if(_0x385b28[_0x0707('0x103')]>=_0x5576b9[_0x0707('0x196')]){_0x28fc23[_0x0707('0xfd')](_0x385b28,_0x3b43c9,_0x4d41f8,_0x0707('0x1b4'));}else{_0x28fc23[_0x0707('0xfa')](_0x385b28,_0x3b43c9,_0x4d41f8,_0x0707('0x1b4'));}}break;case'11':_0x5576b9[_0x0707('0x1b5')]+=0x1;_0x385b28['state']=0xb;_0x385b28['statedesc']='Abandoned';_0x385b28[_0x0707('0xf6')]+=0x1;_0x385b28[_0x0707('0xf0')]+=0x1;_0x28fc23[_0x0707('0xcd')](_0x385b28)[_0x0707('0xb0')](loggerCatch(_0x0707('0x123')));if(_0x28fc23[_0x0707('0x190')](0xb,_0x1e7233,_0x5576b9)){if(_0x385b28[_0x0707('0xf6')]>=_0x5576b9[_0x0707('0x120')]){_0x28fc23[_0x0707('0xfd')](_0x385b28,_0x3b43c9,_0x4d41f8,_0x0707('0x1b6'));}else{_0x28fc23[_0x0707('0xfa')](_0x385b28,_0x3b43c9,_0x4d41f8,_0x0707('0x1b6'));}}break;case'20':_0x5576b9['outboundRejectCallsDay']+=0x1;_0x385b28[_0x0707('0xe4')]=0x14;_0x385b28[_0x0707('0xe5')]='AgentReject';_0x385b28['countagentrejectretry']+=0x1;_0x385b28[_0x0707('0xf0')]+=0x1;ami[_0x0707('0x4d')](_0x0707('0x1b7'),ut[_0x0707('0xe9')](_0x1e7233,_0x0707('0x1b8')));_0x28fc23[_0x0707('0xcd')](_0x385b28)[_0x0707('0xb0')](loggerCatch(_0x0707('0x1b9')));if(_0x28fc23[_0x0707('0x190')](0x14,_0x1e7233,_0x5576b9)){if(_0x385b28[_0x0707('0xf8')]>=_0x5576b9[_0x0707('0x19c')]){_0x28fc23['createStateFinal'](_0x385b28,_0x3b43c9,_0x4d41f8,'reason\x2020\x20agentreject');}else{_0x28fc23[_0x0707('0xfa')](_0x385b28,_0x3b43c9,_0x4d41f8,_0x0707('0x1ba'));}}break;default:_0x5576b9['outboundUnknownCallsDay']+=0x1;_0x385b28[_0x0707('0xe4')]=0xc;_0x385b28[_0x0707('0xe5')]=_0xfe36a4[_0x0707('0x1a2')];_0x28fc23[_0x0707('0xcd')](_0x385b28)[_0x0707('0xb0')](loggerCatch(_0x0707('0x1bb')));if(_0x28fc23[_0x0707('0x190')](_0xfe36a4[_0x0707('0x1a2')],_0x1e7233,_0x5576b9)){if(_0x385b28['countbusyretry']+_0x385b28['countcongestionretry']+_0x385b28[_0x0707('0xf3')]+_0x385b28['countnosuchnumberretry']+_0x385b28[_0x0707('0xf5')]+_0x385b28[_0x0707('0xf6')]+_0x385b28[_0x0707('0xf7')]+_0x385b28['countagentrejectretry']>=_0x5576b9[_0x0707('0xf9')]){_0x28fc23[_0x0707('0xfa')](_0x385b28,_0x3b43c9,_0x4d41f8,_0xfe36a4[_0x0707('0x1a2')]);}else{_0x28fc23['createStateFinal'](_0x385b28,_0x3b43c9,_0x4d41f8,_0xfe36a4[_0x0707('0x1a2')]);}}}});};Dialer[_0x0707('0x19')][_0x0707('0xfa')]=function(_0x2d2049,_0x4c7e97,_0x1f87ad,_0x50ed0f){var _0x3f4020=new Final(_0x2d2049);_0x3f4020['state']=0xf;_0x3f4020[_0x0707('0xe5')]=_0x0707('0x1bc');this[_0x0707('0xfd')](_0x3f4020,_0x4c7e97,_0x1f87ad,_0x50ed0f);};Dialer[_0x0707('0x19')][_0x0707('0xfd')]=function(_0x40cd09,_0x520c91,_0xcf0f97,_0x2b6f9d){this['moveContactManagedDialer'](_0x40cd09)['then'](function(){return _0x520c91(msgResponse(_0x0707('0x19f'),'Success',_0x2b6f9d));})[_0x0707('0xb0')](function(){return _0xcf0f97(msgResponse(_0x0707('0x1bd'),'Failure',_0x0707('0x1be')));});};Dialer['prototype'][_0x0707('0x156')]=function(_0x2cddc7){var _0x3c51d5=_0x2cddc7[_0x0707('0x1bf')]/0x64;var _0x30c31e=_0x2cddc7['outboundDropCallsDayTimeout']/(_0x2cddc7[_0x0707('0x65')]+_0x2cddc7['outboundAnswerCallsDay']);var _0x1055cb=Math[_0x0707('0x1c0')](_0x2cddc7[_0x0707('0x73')]*(_0x2cddc7[_0x0707('0x1c1')]/0x64));var _0x2d3957=Math['round'](_0x2cddc7['predictiveIntervalAvailable']*(_0x2cddc7[_0x0707('0x1c2')]/0x64));var _0x1eb299=_0x2cddc7[_0x0707('0x52')]+_0x2cddc7[_0x0707('0x57')];var _0x27da31=Math[_0x0707('0x1c3')](_0x2cddc7['erlangCalls']*_0x2cddc7[_0x0707('0x77')]*_0x2cddc7[_0x0707('0x70')]*_0x2cddc7[_0x0707('0x71')]);if(_[_0x0707('0x3d')](_0x2cddc7[_0x0707('0x92')])){if(!_['isUndefined'](_0x2cddc7[_0x0707('0x79')])){_0x2cddc7[_0x0707('0x79')]=undefined;loggerPredictive[_0x0707('0x99')]('[startMethodPredictive][StartProgressive]',_0x0707('0x1c4'));}if(!_['isUndefined'](_0x2cddc7[_0x0707('0x95')])){loggerPredictive[_0x0707('0x99')](_0x0707('0x1c5'),_0x0707('0x1c6'));clearInterval(_0x2cddc7[_0x0707('0x95')]);_0x2cddc7['handlePredictive']=undefined;}_0x2cddc7[_0x0707('0x92')]=moment()[_0x0707('0x7d')](_0x0707('0x105'));loggerPredictive[_0x0707('0x80')](_0x2cddc7[_0x0707('0x40')],'collection\x20data\x20in\x20progressive\x20at',_0x2cddc7[_0x0707('0x92')]);this[_0x0707('0x157')](_0x2cddc7,0x1);}else if(ifInterval(_0x2cddc7[_0x0707('0x1c7')],_0x2cddc7[_0x0707('0x92')])){this[_0x0707('0x157')](_0x2cddc7,0x1);loggerPredictiveCalls[_0x0707('0x80')]('[startMethodPredictive][StartProgressive][Loop]',_0x2cddc7[_0x0707('0x92')],_0x2cddc7[_0x0707('0x40')]);_0x2cddc7[_0x0707('0x76')]=0x0;_0x2cddc7[_0x0707('0x6f')]=0x0;}else if(_0x3c51d5<_0x30c31e&&_0x2cddc7[_0x0707('0x1c8')]===_0x0707('0x1c9')){freeVariablesPredictive(_0x2cddc7);loggerPredictive[_0x0707('0x80')](_0x0707('0x1ca'),_0x0707('0x1cb'),_0x30c31e,_0x0707('0x92'),_0x2cddc7[_0x0707('0x40')]);}else if(_0x27da31<_0x2cddc7[_0x0707('0x6f')]&&_0x2cddc7[_0x0707('0x1c8')]==='dropRate'){freeVariablesPredictive(_0x2cddc7);loggerPredictive[_0x0707('0x80')](_0x0707('0x1cc'),_0x0707('0x1cd'),_0x27da31,_0x0707('0x1ce'),_0x2cddc7[_0x0707('0x6f')],_0x0707('0x92'),_0x2cddc7[_0x0707('0x40')]);}else if(!ifInterval(_0x2cddc7[_0x0707('0x1c7')],_0x2cddc7[_0x0707('0x92')])&&_[_0x0707('0x3d')](_0x2cddc7['startPredictive'])&&!_[_0x0707('0x3d')](_0x2cddc7[_0x0707('0x92')])){_0x2cddc7[_0x0707('0x79')]=moment()[_0x0707('0x7d')](_0x0707('0x105'));loggerPredictive['info'](_0x2cddc7[_0x0707('0x40')],_0x0707('0x1cf'),_0x2cddc7[_0x0707('0x79')]);this['averageHandleTime'](_0x2cddc7[_0x0707('0x1c7')])[_0x0707('0xb8')](this[_0x0707('0x1d0')](_0x2cddc7))[_0x0707('0xb8')](mergeDataErlangB(_0x2cddc7))[_0x0707('0xb8')](this['startMethodPredictive'](_0x2cddc7))[_0x0707('0xb0')](loggerCatchPredictive(_0x0707('0x1d1'),_0x2cddc7));}else if(!ifInterval(_0x2cddc7[_0x0707('0x1c7')],_0x2cddc7[_0x0707('0x79')])){_0x2cddc7[_0x0707('0x6f')]=0x0;_0x2cddc7[_0x0707('0x79')]=moment()[_0x0707('0x7d')](_0x0707('0x105'));loggerPredictive[_0x0707('0x80')](_0x2cddc7[_0x0707('0x40')],_0x0707('0x1d2'),_0x2cddc7[_0x0707('0x79')]);clearInterval(_0x2cddc7[_0x0707('0x95')]);_0x2cddc7[_0x0707('0x95')]=undefined;this[_0x0707('0xbe')](_0x2cddc7['dialPredictiveInterval'])['then'](this[_0x0707('0x1d0')](_0x2cddc7))[_0x0707('0xb8')](mergeDataErlangB(_0x2cddc7))[_0x0707('0xb8')](this[_0x0707('0x1d3')](_0x2cddc7))[_0x0707('0xb0')](loggerCatchPredictive(_0x0707('0x1d4'),_0x2cddc7));}else if(_0x2cddc7[_0x0707('0x73')]&&_0x1eb299<_0x2cddc7[_0x0707('0x73')]-_0x2d3957){freeVariablesPredictive(_0x2cddc7);loggerPredictive[_0x0707('0x80')](_0x2cddc7[_0x0707('0x40')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x1eb299,_0x0707('0x1d5'),_0x2cddc7['predictiveIntervalAvailable'],'-',_0x2d3957,'=',_0x2cddc7['predictiveIntervalAvailable']-_0x2d3957,')');}else if(_0x2cddc7[_0x0707('0x73')]&&_0x1eb299>_0x2cddc7[_0x0707('0x73')]+_0x1055cb){freeVariablesPredictive(_0x2cddc7);loggerPredictive[_0x0707('0x80')](_0x2cddc7[_0x0707('0x40')],_0x0707('0x1d6'),_0x1eb299,_0x0707('0x1d7'),_0x2cddc7[_0x0707('0x73')],'+',_0x1055cb,'=',_0x2cddc7['predictiveIntervalAvailable']+_0x1055cb,')');}};Dialer[_0x0707('0x19')]['getDataPredictive']=function(_0xfea010){var _0x35ddee=this;return function(_0x3774ea){return new BPromise(function(_0x2a698b,_0x1f2835){_['merge'](_0xfea010,_0x3774ea[0x0]);if(checkGetDataPredictive(_0x3774ea[0x0])){var _0x1ae16a=_0xfea010[_0x0707('0x73')]=_0xfea010['talking']+_0xfea010[_0x0707('0x52')];var _0x1a90ad=_0xfea010['dialPredictiveInterval']*0x3c;var _0x55ad0d=_0x3774ea[0x0]['predictiveIntervalAvgTalktime']+_0x3774ea[0x0][_0x0707('0x6c')];var _0x91adec=(_0x3774ea[0x0][_0x0707('0x6b')]+_0x3774ea[0x0][_0x0707('0x6d')]+_0x3774ea[0x0][_0x0707('0x85')])/_0x3774ea[0x0][_0x0707('0x74')];_0xfea010['predictiveIntervalHitRate']=_0x91adec>0x0?_0x91adec:0x1;switch(_0xfea010[_0x0707('0x1c8')]){case'dropRate':var _0x2bbe3f=_0xfea010[_0x0707('0x1bf')]/0x64;return _0x35ddee[_0x0707('0x1d8')](_0x1ae16a,_0x1a90ad,_0x55ad0d,_0x91adec,_0x2bbe3f)[_0x0707('0xb8')](function(_0x1185d0){return _0x2a698b(_0x1185d0);});case'agentBusyFactor':var _0x23e2cf=_0xfea010[_0x0707('0x1bf')]/0x64;return _0x35ddee['busyFactor'](_0x1ae16a,_0x1a90ad,_0x55ad0d,_0x91adec,_0x23e2cf)[_0x0707('0xb8')](function(_0x135c8a){return _0x2a698b(_0x135c8a);});default:return _0x1f2835(msgResponse(_0x0707('0x1d9'),_0x0707('0x142'),_0x0707('0x1da')));}}else{return _0x1f2835(msgResponse(_0x0707('0x1d9'),_0x0707('0x142'),_0x0707('0x1db')));}});};};Dialer[_0x0707('0x19')][_0x0707('0x1dc')]=function(_0x3bd4ce){var _0x4874b1=this;return function(_0x5e1605){return new BPromise(function(_0x32746d,_0x2cb313){_[_0x0707('0x91')](_0x3bd4ce,_0x5e1605[0x0]);if(checkGetDataPredictive(_0x5e1605[0x0])){loggerPredictive['info'](JSON[_0x0707('0x49')](_0x5e1605[0x0]));if(_0x3bd4ce['dialPredictiveOptimization']===_0x0707('0x1c9')){return _0x4874b1[_0x0707('0xc9')](_0x3bd4ce['id'])[_0x0707('0xb8')](function(_0x40a8b9){var _0x17859f=_0x3bd4ce[_0x0707('0x53')]-_0x40a8b9[0x0][_0x0707('0x1dd')];var _0x44f6f8=_0x3bd4ce[_0x0707('0x1c7')]*0x3c;var _0x5b479c=_0x5e1605[0x0][_0x0707('0x88')]+_0x5e1605[0x0][_0x0707('0x6c')];var _0x47692c=(_0x5e1605[0x0]['predictiveIntervalAnsweredCalls']+_0x5e1605[0x0][_0x0707('0x6d')]+_0x5e1605[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x5e1605[0x0]['predictiveIntervalTotalCalls'];var _0x199092=_0x3bd4ce[_0x0707('0x1bf')]/0x64;_0x3bd4ce[_0x0707('0x72')]=_0x40a8b9[0x0][_0x0707('0x1dd')]||0x0;_0x3bd4ce[_0x0707('0x70')]=_0x47692c>0x0?_0x47692c:0x1;return _0x4874b1[_0x0707('0x1d8')](_0x17859f,_0x44f6f8,_0x5b479c,_0x47692c,_0x199092);})[_0x0707('0xb8')](function(_0x49da61){return _0x32746d(_0x49da61);})['catch'](function(_0x3932f6){return _0x2cb313(msgResponse('[CatchErlangB]',_0x0707('0x142'),JSON[_0x0707('0x49')](_0x3932f6)));});}if(_0x3bd4ce[_0x0707('0x1c8')]==='agentBusyFactor'){return _0x4874b1[_0x0707('0xc9')](_0x3bd4ce['id'])[_0x0707('0xb8')](function(_0x1a65b3){var _0x42326a=_0x3bd4ce[_0x0707('0x53')]-_0x1a65b3[0x0][_0x0707('0x1dd')];var _0x29d8c8=_0x3bd4ce['dialPredictiveInterval']*0x3c;var _0x4d4538=_0x5e1605[0x0][_0x0707('0x88')]+_0x5e1605[0x0][_0x0707('0x6c')];var _0x3ea59a=(_0x5e1605[0x0]['predictiveIntervalAnsweredCalls']+_0x5e1605[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x5e1605[0x0][_0x0707('0x85')])/_0x5e1605[0x0][_0x0707('0x74')];var _0x109560=_0x3bd4ce['dialPredictiveOptimizationPercentage']/0x64;_0x3bd4ce[_0x0707('0x72')]=_0x1a65b3[0x0]['outboundQueuePauses']||0x0;_0x3bd4ce[_0x0707('0x70')]=_0x3ea59a>0x0?_0x3ea59a:0x1;return _0x4874b1['busyFactor'](_0x42326a,_0x29d8c8,_0x4d4538,_0x3ea59a,_0x109560);})['then'](function(_0x4c62b5){return _0x32746d(_0x4c62b5);})['catch'](function(_0x5a60f2){return _0x2cb313(msgResponse(_0x0707('0x1de'),'Failure',JSON[_0x0707('0x49')](_0x5a60f2)));});}}else{return _0x2cb313(msgResponse(_0x0707('0x1d9'),_0x0707('0x142'),_0x0707('0x1db')));}});};};Dialer[_0x0707('0x19')]['startMethodPredictive']=function(_0x24f451){var _0x10e5fe=this;return function(){var _0x10bb1c=0x0;var _0x48d98a=Math[_0x0707('0x1c3')](_0x24f451['erlangCallToSecond']*0x3e8);if(_0x48d98a>0x0){_0x48d98a=_0x48d98a<0x64?0x64:_0x48d98a;loggerPredictive['info'](_0x24f451[_0x0707('0x40')],_0x0707('0x1df'),_0x48d98a,_0x0707('0x4a'));_0x24f451[_0x0707('0x95')]=setInterval(function(){_0x10e5fe['handlePredictive'](_0x24f451);loggerPredictiveCalls[_0x0707('0x80')](_0x0707('0x1e0'),_0x10bb1c+=0x1);},_0x48d98a);}else{loggerPredictive['info'](_0x24f451[_0x0707('0x40')],_0x0707('0x1e1'));}};};Dialer[_0x0707('0x19')][_0x0707('0x1e2')]=function(_0x2ce81f,_0x41433e){var _0x48d19c=this;return function(_0x3b7e06){if(_['isEmpty'](_0x3b7e06)){if(_[_0x0707('0xac')](_0x41433e[_0x0707('0x1e3')])||!_0x41433e[_0x0707('0x1e4')]){if(_0x2ce81f[_0x0707('0x5b')]===_0x0707('0x6')){_0x2ce81f[_0x0707('0x12b')]=_[_0x0707('0x3d')](_0x2ce81f[_0x0707('0x12b')])?!![]:_0x2ce81f[_0x0707('0x12b')];var _0x584bee=uuid['v4']();_0x48d19c[_0x0707('0xaa')][_0x584bee]=new Action(_0x2ce81f,_0x41433e,_0x584bee);loggerBooked[_0x0707('0x80')](_0x0707('0x1e5'),_0x584bee,_0x0707('0x1e6'),JSON[_0x0707('0x49')](_0x2ce81f['queueStatusComplete']),_0x0707('0x1e7'),_0x2ce81f[_0x0707('0x40')]);if(_0x2ce81f[_0x0707('0x12b')]){_0x2ce81f[_0x0707('0x12b')]=![];_0x48d19c[_0x0707('0x28')][_0x48d19c[_0x0707('0xaa')][_0x584bee][_0x0707('0xb2')]]=[];ami[_0x0707('0xad')]({'actionid':_0x584bee,'action':_0x0707('0x1e8'),'queue':_0x2ce81f[_0x0707('0x40')]})['catch'](function(){_0x48d19c['updateOriginated'](_0x2ce81f);_0x48d19c['rescheduleContact']({'active':![],'ContactId':_0x48d19c[_0x0707('0xaa')][_0x584bee][_0x0707('0xd3')],'ListId':_0x48d19c[_0x0707('0xaa')][_0x584bee][_0x0707('0xd4')],'VoiceQueueId':_0x48d19c[_0x0707('0xaa')][_0x584bee][_0x0707('0xd5')]||undefined,'CampaignId':_0x48d19c[_0x0707('0xaa')][_0x584bee]['CampaignId']||undefined})[_0x0707('0xb0')](loggerCatch(_0x0707('0x1e9')));delete _0x48d19c['actions'][_0x584bee];});}else{loggerBooked['info']('[booked][checkContactBlack][else]',JSON[_0x0707('0x49')](_0x2ce81f[_0x0707('0x12b')]),_0x0707('0x1e7'),_0x2ce81f[_0x0707('0x40')]);_0x48d19c[_0x0707('0xb4')](_0x2ce81f);_0x48d19c[_0x0707('0xc1')]({'active':![],'ContactId':_0x48d19c[_0x0707('0xaa')][_0x584bee][_0x0707('0xd3')],'ListId':_0x48d19c['actions'][_0x584bee][_0x0707('0xd4')],'VoiceQueueId':_0x48d19c[_0x0707('0xaa')][_0x584bee][_0x0707('0xd5')]||undefined,'CampaignId':_0x48d19c[_0x0707('0xaa')][_0x584bee][_0x0707('0xd6')]||undefined})[_0x0707('0xb0')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x48d19c[_0x0707('0xaa')][_0x584bee];}}else{return _0x48d19c[_0x0707('0x164')](_0x2ce81f,_0x41433e);}}else{if(getDiff(_0x41433e[_0x0707('0x1ea')])<_0x2ce81f[_0x0707('0x1eb')]*0x3c){if(_0x41433e['Agent']&&!_0x41433e[_0x0707('0x1ec')][_0x0707('0x1ed')]){_0x48d19c['preview'][_0x0707('0x12c')](_0x41433e['id'])[_0x0707('0x1c')](function(){_0x48d19c[_0x0707('0xb4')](_0x2ce81f);});}else{_0x48d19c['unlockContact']({'active':![]},_0x41433e['id'],0x1)['finally'](function(){_0x48d19c['updateOriginated'](_0x2ce81f);});}}else{_0x2ce81f['outboundReCallsDay']+=0x1;_0x48d19c['updateOriginated'](_0x2ce81f);if(_0x2ce81f[_0x0707('0x1ee')]){_0x48d19c[_0x0707('0xc1')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x41433e['ContactId'],'ListId':_0x41433e[_0x0707('0xd4')],'VoiceQueueId':_0x41433e[_0x0707('0xd5')]||undefined,'CampaignId':_0x41433e[_0x0707('0xd6')]||undefined})[_0x0707('0xb0')](loggerCatch(_0x0707('0x1ef')));_0x48d19c[_0x0707('0xcd')](createObjHistory(_0x2ce81f,_0x41433e,_0x0707('0x1f0'),0x17,'RecallInQueue'))['catch'](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x48d19c[_0x0707('0xd2')](createObjHistory(_0x2ce81f,_0x41433e,'RECALLFAILEDTIMEOUT',0x16,'RecallFailedTimeout'),_0x0707('0x1f1'),_0x0707('0x1f2'));}}}}else{_0x2ce81f[_0x0707('0x61')]+=0x1;_0x48d19c[_0x0707('0xd2')](createObjHistory(_0x2ce81f,_0x41433e,'BLACKLIST',0xd,_0x0707('0x1f3')),_0x0707('0x1f4'),'[Originate][MoveBlacklist]');throw _0x0707('0x1f5');}};};Dialer[_0x0707('0x19')][_0x0707('0x15b')]=function(_0x1d2282){var _0x243982=this;var _0x525599=_0x1d2282[_0x0707('0x1f6')]-_0x1d2282[_0x0707('0x75')]-_0x1d2282[_0x0707('0xc6')];emitCampaignSummary(_0x1d2282);if(_0x525599>0x0){if(_0x525599>this[_0x0707('0x23')]){_0x525599=this['maxNumberOriginate'];}_0x1d2282[_0x0707('0xc6')]+=_0x525599;this[_0x0707('0xc7')](_0x1d2282['id'],_0x525599,_0x1d2282[_0x0707('0x1f7')],_0x1d2282)[_0x0707('0xb8')](function(_0x39ffc1){_0x1d2282[_0x0707('0xc6')]-=_0x525599;_0x1d2282['temp']=_0x1d2282[_0x0707('0xc6')]>0x0?_0x1d2282['temp']:0x0;if(!checkContactEmpty(_0x39ffc1)){_0x1d2282[_0x0707('0x3e')]='AVAILABLE_CONTACTS_FINISHED';logger[_0x0707('0x80')](_0x0707('0x1f8')+_0x1d2282[_0x0707('0x40')]);}else{_0x1d2282['originated']+=_0x39ffc1[_0x0707('0x12e')];_0x1d2282[_0x0707('0x3e')]=_0x0707('0x1f9');for(var _0x3612df=0x0;_0x3612df<_0x39ffc1['length'];_0x3612df+=0x1){_0x1d2282[_0x0707('0x1fa')]+=0x1;if(_['isNil'](_0x39ffc1[_0x3612df])||_[_0x0707('0xac')](_0x39ffc1[_0x3612df][_0x0707('0x167')])||_[_0x0707('0xac')](_0x39ffc1[_0x3612df]['Contact'][_0x0707('0x168')])){_0x243982['emptyContact'](_0x0707('0x1fb'),_0x1d2282,_0x39ffc1[_0x3612df]);}else{_0x243982[_0x0707('0xbc')](_[_0x0707('0x129')](_0x39ffc1[_0x3612df],['CampaignId','Contact.phone']))['then'](_0x243982['checkContactBlack'](_0x1d2282,_0x39ffc1[_0x3612df]))[_0x0707('0xb0')](_0x243982[_0x0707('0x1fc')](_0x0707('0x1fd'),_0x1d2282));}}}})[_0x0707('0xb0')](loggerGetContactDialer(_0x0707('0x1fe'),_0x1d2282,_0x525599));}};Dialer[_0x0707('0x19')][_0x0707('0x157')]=function(_0x29289e,_0x23da4d){var _0x480e3d=this;var _0x22a3fe=[];var _0x2a2e29=_0x23da4d>=0x1?_0x23da4d:0x1;if(_0x29289e['dialMethod']==='booked'){_0x2a2e29=0x1;}var _0x1b6cec=Math['floor'](_0x29289e['available']*_0x2a2e29)-_0x29289e[_0x0707('0x75')]-_0x29289e[_0x0707('0xc6')];emitVoiceQueueSummary(_0x29289e);if(_0x29289e[_0x0707('0x1ff')]>0x0){var _0x4b9229=_0x29289e[_0x0707('0x1ff')]-_0x29289e[_0x0707('0x75')]-_0x29289e[_0x0707('0x57')]-_0x29289e[_0x0707('0xc6')]-_0x29289e[_0x0707('0x54')];if(_0x1b6cec>_0x4b9229){_0x1b6cec=_0x4b9229;}}if(_0x1b6cec>0x0){if(_0x29289e[_0x0707('0x5b')]==='booked'){_0x1b6cec=0x1;}if(_0x1b6cec>this['maxNumberOriginate']){_0x1b6cec=this['maxNumberOriginate'];}_0x29289e[_0x0707('0xc6')]+=_0x1b6cec;for(var _0x52bfb9 in this[_0x0707('0x21')]){if(typeof this[_0x0707('0x21')][_0x52bfb9]!==_0x0707('0x9c')){if(this['agents'][_0x52bfb9][_0x0707('0xe4')]==='not_inuse'&&this[_0x0707('0x21')][_0x52bfb9][_0x0707('0xae')]===_0x0707('0x200')){_0x22a3fe[_0x0707('0x128')](this[_0x0707('0x21')][_0x52bfb9]['id']);}}}this[_0x0707('0xc5')](_0x29289e['id'],_0x22a3fe,_0x1b6cec,_0x29289e[_0x0707('0x1f7')],_0x29289e)[_0x0707('0xb8')](function(_0x255b1b){_0x29289e[_0x0707('0xc6')]-=_0x1b6cec;_0x29289e['temp']=_0x29289e[_0x0707('0xc6')]>0x0?_0x29289e['temp']:0x0;if(!checkContactEmpty(_0x255b1b)){_0x480e3d['countReScheduled'](_0x29289e)[_0x0707('0xb8')](sendMessageReschedule(_0x29289e))[_0x0707('0xb0')](loggerCatch(_0x0707('0xb9')));}else{_0x29289e['originated']+=_0x255b1b[_0x0707('0x12e')];_0x29289e[_0x0707('0x3e')]=_0x29289e[_0x0707('0x5b')]==='booked'?_0x0707('0x201'):_0x0707('0x1f9');for(var _0x22a685=0x0;_0x22a685<_0x255b1b[_0x0707('0x12e')];_0x22a685+=0x1){if(_[_0x0707('0xac')](_0x255b1b[_0x22a685])||_[_0x0707('0xac')](_0x255b1b[_0x22a685][_0x0707('0x167')])||_['isNil'](_0x255b1b[_0x22a685][_0x0707('0x167')][_0x0707('0x168')])){_0x480e3d['emptyContact'](_0x0707('0x1fb'),_0x29289e,_0x255b1b[_0x22a685]);}else{_0x480e3d[_0x0707('0xba')](_[_0x0707('0x129')](_0x255b1b[_0x22a685],[_0x0707('0xd5'),_0x0707('0x202')]))[_0x0707('0xb8')](_0x480e3d[_0x0707('0x1e2')](_0x29289e,_0x255b1b[_0x22a685]))['catch'](_0x480e3d['loggerHandler'](_0x0707('0x1fb'),_0x29289e));}}}})[_0x0707('0xb0')](loggerGetContactDialer(_0x0707('0x203'),_0x29289e,_0x1b6cec));}};Dialer[_0x0707('0x19')]['handlePredictive']=function(_0x27a20d){if(_0x27a20d['dialLimitQueue']>0x0){var _0x5c0490=_0x27a20d[_0x0707('0x1ff')]-_0x27a20d[_0x0707('0x75')]-_0x27a20d['talking'];if(_0x5c0490>0x0){this[_0x0707('0x204')](_0x27a20d);}else{loggerPredictiveCalls[_0x0707('0x80')](_0x0707('0x205'));}}else{this['tryOriginatePredictive'](_0x27a20d);}};Dialer[_0x0707('0x19')]['tryOriginatePredictive']=function(_0x45e780){var _0x14c9fc=this;var _0x13b479=[];_0x45e780[_0x0707('0x75')]+=0x1;for(var _0x45ed9e in this[_0x0707('0x21')]){if(typeof this['agents'][_0x45ed9e]!=='undefined'){if(this[_0x0707('0x21')][_0x45ed9e][_0x0707('0xe4')]===_0x0707('0x206')&&this[_0x0707('0x21')][_0x45ed9e][_0x0707('0xae')]===_0x0707('0x200')){_0x13b479[_0x0707('0x128')](this['agents'][_0x45ed9e]['id']);}}}this['getContactDialer'](_0x45e780['id'],_0x13b479,0x1,_0x45e780[_0x0707('0x1f7')],_0x45e780)[_0x0707('0xb8')](function(_0x3a0601){if(!checkContactEmpty(_0x3a0601)){checkContactLowerLimitOriginate(_0x45e780,0x1,0x0);_0x14c9fc['countReScheduled'](_0x45e780)[_0x0707('0xb8')](sendMessageReschedule(_0x45e780))[_0x0707('0xb0')](loggerCatch(_0x0707('0xb9')));}else{_0x45e780[_0x0707('0x3e')]=_0x0707('0x1f9');if(_['isNil'](_0x3a0601[0x0])||_['isNil'](_0x3a0601[0x0][_0x0707('0x167')])||_['isNil'](_0x3a0601[0x0][_0x0707('0x167')][_0x0707('0x168')])){_0x14c9fc['emptyContact'](_0x0707('0x1fb'),_0x45e780,_0x3a0601[0x0]);}else{_0x14c9fc[_0x0707('0xba')](_[_0x0707('0x129')](_0x3a0601[0x0],[_0x0707('0xd5'),_0x0707('0x202')]))[_0x0707('0xb8')](_0x14c9fc['checkContactBlack'](_0x45e780,_0x3a0601[0x0]))[_0x0707('0xb0')](_0x14c9fc[_0x0707('0x1fc')](_0x0707('0x207'),_0x45e780));}}})['catch'](loggerGetContactDialer(_0x0707('0x208'),_0x45e780,0x1));emitVoiceQueueSummary(_0x45e780);};Dialer[_0x0707('0x19')]['abandonmentRate']=function(_0x1b40ce,_0x15f490,_0x535daa,_0x11dd35,_0x216e66,_0x236a6d){loggerPredictive[_0x0707('0x80')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive['info']('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',_0x1b40ce);loggerPredictive[_0x0707('0x80')](_0x0707('0x209'),_0x15f490);loggerPredictive[_0x0707('0x80')](_0x0707('0x20a'),_0x535daa);loggerPredictive[_0x0707('0x80')]('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',_0x11dd35);loggerPredictive['info'](_0x0707('0x20b'),_0x216e66);loggerPredictive[_0x0707('0x80')](_0x0707('0x89'));return new BPromise(function(_0xcfa88a,_0x6ea945){if(_0x1b40ce<=0x0||isNaN(_0x1b40ce)){return _0x6ea945(msgResponse('[abandonmentRate]',_0x0707('0x18b'),_0x0707('0x20c')+_0x1b40ce));}if(_0x535daa<=0x0||isNaN(_0x535daa)){return _0x6ea945(msgResponse('[abandonmentRate]',_0x0707('0x18b'),'Ts\x20=\x20'+_0x535daa));}if(_0x11dd35<=0x0||isNaN(_0x11dd35)){return _0x6ea945(msgResponse('[abandonmentRate]',_0x0707('0x18b'),_0x0707('0x20d')+_0x11dd35));}if(_0x15f490<=0x0||isNaN(_0x15f490)){return _0x6ea945(msgResponse(_0x0707('0x20e'),'Error',_0x0707('0x20f')+_0x15f490));}if(_0x216e66<=0x0||isNaN(_0x216e66)){return _0x6ea945(msgResponse(_0x0707('0x20e'),_0x0707('0x18b'),_0x0707('0x210')+_0x216e66));}_0x236a6d=_0x236a6d||0x0;var _0x9c67be=0x1/_0x535daa;var _0x25fcf8=0x0;var _0x24b4b5=0x0;var _0x2a34ce=0x0;var _0x349039=0x0;for(var _0x27fe00=0x0;_0x2a34ce<_0x216e66;_0x27fe00+=0x1){_0x24b4b5=_0x27fe00/_0x15f490;_0x25fcf8=(_0x11dd35*_0x24b4b5+_0x236a6d)/_0x9c67be;_0x2a34ce=erlangb(_0x25fcf8,_0x1b40ce);_0x349039=_0x25fcf8/_0x1b40ce*(0x1-erlangb(_0x25fcf8,_0x1b40ce));}return _0xcfa88a({'erlangCalls':_0x27fe00,'erlangCallToSecond':_0x15f490/_0x27fe00,'erlangAbandonmentRate':_0x2a34ce,'erlangBusyFactor':_0x349039});});};Dialer[_0x0707('0x19')]['busyFactor']=function(_0x2f8d00,_0xb88df4,_0x5cab9c,_0x58021e,_0x599e43,_0x52cb1a){loggerPredictive[_0x0707('0x80')](_0x0707('0x211'));loggerPredictive['info'](_0x0707('0x212'),_0x2f8d00);loggerPredictive[_0x0707('0x80')](_0x0707('0x209'),_0xb88df4);loggerPredictive[_0x0707('0x80')](_0x0707('0x20a'),_0x5cab9c);loggerPredictive[_0x0707('0x80')](_0x0707('0x213'),_0x58021e);loggerPredictive[_0x0707('0x80')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x599e43);loggerPredictive['info']('---------------------------');return new BPromise(function(_0x4007d9,_0x14c26f){if(_0x2f8d00<=0x0||isNaN(_0x2f8d00)){return _0x14c26f(msgResponse(_0x0707('0x214'),_0x0707('0x18b'),_0x0707('0x20c')+_0x2f8d00));}if(_0x5cab9c<=0x0||isNaN(_0x5cab9c)){return _0x14c26f(msgResponse(_0x0707('0x214'),_0x0707('0x18b'),_0x0707('0x215')+_0x5cab9c));}if(_0x58021e<=0x0||isNaN(_0x58021e)){return _0x14c26f(msgResponse(_0x0707('0x214'),'Error',_0x0707('0x20d')+_0x58021e));}if(_0xb88df4<=0x0||isNaN(_0xb88df4)){return _0x14c26f(msgResponse(_0x0707('0x214'),_0x0707('0x18b'),'interval\x20=\x20'+_0xb88df4));}if(_0x599e43<=0x0||isNaN(_0x599e43)){return _0x14c26f(msgResponse('[busyFactor]',_0x0707('0x18b'),'Umin\x20=\x20'+_0x599e43));}_0x52cb1a=_0x52cb1a||0x0;var _0x365bed=0x1/_0x5cab9c;var _0x4f18b7=0x0;var _0x50dfdc=0x0;var _0x4faeca=0x0;var _0x44bbe5=0x0;for(var _0x35aa65=0x0;_0x44bbe5<_0x599e43;_0x35aa65+=0x1){_0x50dfdc=_0x35aa65/_0xb88df4;_0x4f18b7=(_0x58021e*_0x50dfdc+_0x52cb1a)/_0x365bed;_0x4faeca=erlangb(_0x4f18b7,_0x2f8d00);_0x44bbe5=_0x4f18b7/_0x2f8d00*(0x1-erlangb(_0x4f18b7,_0x2f8d00));}return _0x4007d9({'erlangCalls':_0x35aa65,'erlangCallToSecond':_0xb88df4/_0x35aa65,'erlangAbandonmentRate':_0x4faeca,'erlangBusyFactor':_0x44bbe5});});};module[_0x0707('0x216')]=Dialer; \ No newline at end of file +var _0xbc4a=['diff','seconds','emit','type','outbound','answered','available','loggedIn','pTalking','sumDuration','talking','total','waiting','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','startPredictive','Trunk','active','callerid','md5','format','voice:queue:%s','ivr','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\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','merge','isUndefined','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','string','\x22%s\x22\x20<%s>','error','stack','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','inspect','contactsRescheduled','RESCHEDULED_CONTACTS','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','statedesc','endtime','prototype','loopClearZombieChannels','clearZombieChannels','[uniqueid]','[actions]','isNil','Action','channel','catch','No\x20such\x20channel','queue','[Dialer][checkChannel]','updateOriginated','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','notFound','saveInDb','pick','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','SIP/%s','status','unmonitored','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','HANGUP','HangupInAMD','membername','custom:amd','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','value','MACHINE','uniqueid','state','AMD','countglobal','buildObj','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','reason\x2019\x20machine....','add','dialMachineRetryFrequency','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','[syncHangupInAMDIvr]','createStateFinal','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','AnswerAGI','dialQueueProject','cause-txt','Unknow','reason','agent','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','syncAgentConnect','answertime','queueCallerAbandonCreateState','droptime','responsetime','dialQueueTimeout','Drop','dropreason','TIMEOUT','agiafterat','dialQueueProject2','dialDropMaxRetry','minutes','[rescheduleContact][Drop]','starttime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','syncNewExten','actionid','strategy','roundrobin','paused','agents','stateinterface','locked','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','finally','_rr','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','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','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','push','command','iftime\x20%s,%s','interval','content','indexOf','true','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','handleIvr','dialActive','dialTimezone','checkDialMethod','[syncQueueSummary]','dialGlobalInterval','launchHandleIvr','[syncCampaigns]','\x5cw{0,','pow','random','actionOriginate','object','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-CAMPAIGNID','tags','updatedAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originate','trim','substring','dialCutDigit','from-sip','OriginateError','[originate][error]','originate\x20action\x20Error','getQueue','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropRetryFrequency','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','congestion','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','outboundRejectCallsDay','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','[moveContactManagedDialer][0]','contact\x20not\x20moved','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','getDataPredictive','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','dialPredictiveOptimizationPercentage','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','predictiveIntervalDroppedCallsTimeout','floor','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','Agent','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','[Originate][HistoryRecallClose][historyCatch]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','[getContactCampaign2][Empty]','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','checkContactBlack','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','dialOrderByScheduledAt','ACTIVE','RUNNING','emptyContact','[getContactDialer2]','[handlePredictive][limitChannel]','tryOriginatePredictive','reachable','[actionOriginatePredictive]\x20','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Error','m\x20=\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','lodash','bluebird','../../../config/environment/','dialer','../../../config/logger','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','env','127.0.0.1','rrmemory','enqueue','tail','sequence','preview','voiceQueues','campaigns','trunks','maxNumberOriginate','actions','contactsId','uniqueId','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','bind','queuecallerabandon','syncQueueCallerAbandon','syncOriginateResponse','syncAgentComplete','hangup','syncHangup','newexten','varset','syncVarSet','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','message','AGENTS_NOT_LOGGED','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','name','Interval','Intervals','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','isEmpty','stringify','milliseconds'];(function(_0x4b890f,_0x514c23){var _0x343883=function(_0x5b3135){while(--_0x5b3135){_0x4b890f['push'](_0x4b890f['shift']());}};_0x343883(++_0x514c23);}(_0xbc4a,0x1dd));var _0xabc4=function(_0x19abdf,_0x249612){_0x19abdf=_0x19abdf-0x0;var _0x3aa6d5=_0xbc4a[_0x19abdf];return _0x3aa6d5;};'use strict';var util=require(_0xabc4('0x0'));var _=require(_0xabc4('0x1'));var BPromise=require(_0xabc4('0x2'));var uuid=require('uuid');var moment=require('moment');var rr=require('rr');var md5=require('md5');var Redis=require('ioredis');var ut=require('../preview/util/util');var config=require(_0xabc4('0x3'));var logger=require('../../../config/logger')(_0xabc4('0x4'));var loggerBooked=require(_0xabc4('0x5'))(_0xabc4('0x6'));var loggerPredictive=require(_0xabc4('0x5'))(_0xabc4('0x7'));var loggerPredictiveCalls=require(_0xabc4('0x5'))(_0xabc4('0x8'));var loggerSyncQueueSummary=require(_0xabc4('0x5'))(_0xabc4('0x9'));var ami=require(_0xabc4('0xa'));config[_0xabc4('0xb')]=_[_0xabc4('0xc')](config[_0xabc4('0xb')],{'host':_0xabc4('0xd'),'port':0x18eb});var io=require(_0xabc4('0xe'))(new Redis(config[_0xabc4('0xb')]));var cmHopper=require(_0xabc4('0xf'));var cmHopperHistory=require(_0xabc4('0x10'));var cmHopperBlack=require(_0xabc4('0x11'));var voiceQueueRt=require(_0xabc4('0x12'));var Action=require(_0xabc4('0x13'));var History=require(_0xabc4('0x14'));var Final=require(_0xabc4('0x15'));var AgentComplete=require(_0xabc4('0x16'));var QueueCallerAbandon=require(_0xabc4('0x17'));var Hangup=require(_0xabc4('0x18'));var ipAgi=process[_0xabc4('0x19')]['XCALLY_IP_AGI']||_0xabc4('0x1a');var strategy={'rrmemory':_0xabc4('0x1b'),'roundrobin':'roundrobin'};var Sequence=function(){};Sequence['prototype'][_0xabc4('0x1c')]=function(_0x10f53d){this[_0xabc4('0x1d')]=this['tail']?this['tail']['finally'](_0x10f53d):_0x10f53d();};function Dialer(_0x134d0e,_0x260e1c){this[_0xabc4('0x1e')]=new Sequence();this[_0xabc4('0x1f')]=_0x260e1c;this[_0xabc4('0x20')]=_0x134d0e[_0xabc4('0x20')];this[_0xabc4('0x21')]=_0x134d0e[_0xabc4('0x21')];this['agents']=_0x134d0e['agents'];this[_0xabc4('0x22')]=_0x134d0e[_0xabc4('0x22')];this[_0xabc4('0x23')]=config[_0xabc4('0x23')]||0x2;this['channels']={};this[_0xabc4('0x24')]={};this[_0xabc4('0x25')]={};this[_0xabc4('0x26')]={};this['optionPredictive']={};this['startPredictive']={};this[_0xabc4('0x27')]={};this[_0xabc4('0x28')]={};this[_0xabc4('0x29')]={};this[_0xabc4('0x2a')]={};ami['on'](_0xabc4('0x2b'),this['syncAgentConnect'][_0xabc4('0x2c')](this));ami['on'](_0xabc4('0x2d'),this[_0xabc4('0x2e')][_0xabc4('0x2c')](this));ami['on']('originateresponse',this[_0xabc4('0x2f')][_0xabc4('0x2c')](this));ami['on']('agentcomplete',this[_0xabc4('0x30')][_0xabc4('0x2c')](this));ami['on']('custom:queuesummary',this[_0xabc4('0x9')][_0xabc4('0x2c')](this));ami['on'](_0xabc4('0x31'),this[_0xabc4('0x32')][_0xabc4('0x2c')](this));ami['on'](_0xabc4('0x33'),this['syncNewExten']['bind'](this));ami['on'](_0xabc4('0x34'),this[_0xabc4('0x35')][_0xabc4('0x2c')](this));ami['on']('queuemember',this[_0xabc4('0x36')][_0xabc4('0x2c')](this));ami['on'](_0xabc4('0x37'),this[_0xabc4('0x38')]['bind'](this));this[_0xabc4('0x39')]();this['loopClearZombieChannels']();}function isNotNull(_0x4521c5){return _0x4521c5!==null&&!_['isUndefined'](_0x4521c5);}function checkIsLoggedIn(_0x455b80,_0x3b248c){return function(){if(_0x3b248c<=0x0){_0x455b80[_0xabc4('0x3a')]=_0xabc4('0x3b');throw _0x455b80['name']+_0xabc4('0x3c');}};}function isActive(_0x52d669){return _0x52d669;}function checkIsActive(_0x22f6e1,_0x5bb7b3){return function(){if(!isActive(_0x5bb7b3)){_0x22f6e1[_0xabc4('0x3a')]=_0xabc4('0x3d');throw _0x22f6e1[_0xabc4('0x3e')]+'\x20NOT\x20Active';}};}function checkInterval(_0x588376){return function(){if(!isNotNull(_0x588376[_0xabc4('0x3f')])){_0x588376[_0xabc4('0x3a')]='INTERVAL_IS_NULL';throw _0x588376['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x588376[_0xabc4('0x3f')][_0xabc4('0x40')])){_0x588376[_0xabc4('0x3a')]=_0xabc4('0x41');throw _0x588376[_0xabc4('0x3e')]+_0xabc4('0x42');}if(!isNotNull(_[_0xabc4('0x43')](_0x588376[_0xabc4('0x3f')]['Intervals']))){_0x588376[_0xabc4('0x3a')]=_0xabc4('0x41');throw _0x588376[_0xabc4('0x3e')]+_0xabc4('0x42');}};}function msgResponse(_0x34879b,_0x1ce959,_0x44801b){return{'action':_0x34879b,'response':_0x1ce959,'message':_0x44801b,'stack':_0x44801b};}function myreject(_0x1f80bc){return function(_0x689de1){return _0x1f80bc(msgResponse('[ifTime][Action]','Error',JSON[_0xabc4('0x44')](_0x689de1)));};}function getSeconds(_0x1b7750,_0x3349ab){var _0x3c5e9c=moment(_0x1b7750)['milliseconds'](0x0);var _0x5364f2=moment(_0x3349ab)[_0xabc4('0x45')](0x0);return _0x3c5e9c[_0xabc4('0x46')](_0x5364f2,_0xabc4('0x47'));}function emit(_0x1fe1c5,_0x18e781,_0x369412){io['to'](_0x1fe1c5)[_0xabc4('0x48')](_0x18e781,_0x369412);}function emitVoiceQueueSummary(_0x1d6fd0){if(_0x1d6fd0[_0xabc4('0x49')]===_0xabc4('0x4a')){var _0x297267={'id':_0x1d6fd0['id'],'name':_0x1d6fd0[_0xabc4('0x3e')],'strategy':_0x1d6fd0['strategy'],'answered':_0x1d6fd0[_0xabc4('0x4b')],'available':_0x1d6fd0[_0xabc4('0x4c')],'loggedIn':_0x1d6fd0[_0xabc4('0x4d')],'pTalking':_0x1d6fd0[_0xabc4('0x4e')],'sumBillable':_0x1d6fd0['sumBillable'],'sumDuration':_0x1d6fd0[_0xabc4('0x4f')],'sumHoldTime':_0x1d6fd0['sumHoldTime']||0x0,'talking':_0x1d6fd0[_0xabc4('0x50')],'total':_0x1d6fd0[_0xabc4('0x51')],'type':_0x1d6fd0[_0xabc4('0x49')],'unmanaged':_0x1d6fd0['unmanaged'],'abandoned':_0x1d6fd0['abandoned'],'waiting':_0x1d6fd0[_0xabc4('0x52')],'loggedInDb':_0x1d6fd0[_0xabc4('0x53')],'dialActive':_0x1d6fd0['dialActive'],'dialMethod':_0x1d6fd0[_0xabc4('0x54')],'dialOriginateCallerIdName':_0x1d6fd0[_0xabc4('0x55')],'dialOriginateCallerIdNumber':_0x1d6fd0['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x1d6fd0[_0xabc4('0x56')],'dialPrefix':_0x1d6fd0[_0xabc4('0x57')],'outboundAnswerAgiCallsDay':_0x1d6fd0[_0xabc4('0x58')],'outboundAnswerCallsDay':_0x1d6fd0[_0xabc4('0x59')],'outboundBlacklistCallsDay':_0x1d6fd0[_0xabc4('0x5a')],'outboundBusyCallsDay':_0x1d6fd0[_0xabc4('0x5b')],'outboundCongestionCallsDay':_0x1d6fd0[_0xabc4('0x5c')],'outboundDropCallsDayACS':_0x1d6fd0[_0xabc4('0x5d')],'outboundDropCallsDayCallersExit':_0x1d6fd0[_0xabc4('0x5e')],'outboundDropCallsDayTimeout':_0x1d6fd0[_0xabc4('0x5f')],'outboundNoAnswerCallsDay':_0x1d6fd0[_0xabc4('0x60')],'outboundNoSuchCallsDay':_0x1d6fd0[_0xabc4('0x61')],'outboundOriginateFailureCallsDay':_0x1d6fd0[_0xabc4('0x62')],'outboundReCallsDay':_0x1d6fd0[_0xabc4('0x63')],'outboundRejectCallsDay':_0x1d6fd0['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x1d6fd0[_0xabc4('0x64')],'predictiveIntervalAnsweredCalls':_0x1d6fd0[_0xabc4('0x65')],'predictiveIntervalAvgHoldtime':_0x1d6fd0[_0xabc4('0x66')],'predictiveIntervalAvgTalktime':_0x1d6fd0[_0xabc4('0x67')],'predictiveIntervalDroppedCallsCallersExit':_0x1d6fd0[_0xabc4('0x68')],'predictiveIntervalDroppedCallsTimeout':_0x1d6fd0['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x1d6fd0[_0xabc4('0x69')],'predictiveIntervalErlangCallsDroppedCalls':_0x1d6fd0[_0xabc4('0x6a')],'predictiveIntervalHitRate':_0x1d6fd0[_0xabc4('0x6b')],'predictiveIntervalMultiplicativeFactor':_0x1d6fd0[_0xabc4('0x6c')],'predictiveIntervalPauses':_0x1d6fd0[_0xabc4('0x6d')],'predictiveIntervalAvailable':_0x1d6fd0[_0xabc4('0x6e')],'predictiveIntervalTotalCalls':_0x1d6fd0[_0xabc4('0x6f')],'message':_0x1d6fd0['message'],'originated':_0x1d6fd0[_0xabc4('0x70')],'erlangCalls':_0x1d6fd0[_0xabc4('0x71')],'erlangCallToSecond':_0x1d6fd0[_0xabc4('0x72')],'erlangAbandonmentRate':_0x1d6fd0[_0xabc4('0x73')],'erlangBusyFactor':_0x1d6fd0['erlangBusyFactor'],'startPredictive':_0x1d6fd0[_0xabc4('0x74')],'startProgressive':_0x1d6fd0[_0xabc4('0x27')]};if(_0x1d6fd0['Trunk']){_0x297267[_0xabc4('0x75')]={'id':_0x1d6fd0[_0xabc4('0x75')]['id'],'name':_0x1d6fd0[_0xabc4('0x75')][_0xabc4('0x3e')],'active':_0x1d6fd0['Trunk'][_0xabc4('0x76')],'callerid':_0x1d6fd0[_0xabc4('0x75')][_0xabc4('0x77')]};}if(_0x1d6fd0['Interval']){_0x297267[_0xabc4('0x3f')]={'id':_0x1d6fd0['Interval']['id'],'name':_0x1d6fd0['Interval']['name']};}var _0x4c9bba=md5(JSON[_0xabc4('0x44')](_0x297267));if(_0x1d6fd0[_0xabc4('0x78')]!==_0x4c9bba){_0x1d6fd0[_0xabc4('0x78')]=_0x4c9bba;emit(util[_0xabc4('0x79')](_0xabc4('0x7a'),_0x297267['name']),'voice_queue:save',_0x297267);}}}function emitCampaignSummary(_0x41fa3b){if(_0x41fa3b[_0xabc4('0x49')]===_0xabc4('0x7b')){emit(util[_0xabc4('0x79')]('campaign:ivr:%s',_0x41fa3b['name']),_0xabc4('0x7c'),_0x41fa3b);}}function checkGetDataPredictive(_0x273a93){if(isNotNull(_0x273a93)&&!_[_0xabc4('0x43')](_0x273a93)){loggerPredictive[_0xabc4('0x7d')](_0xabc4('0x7e'));loggerPredictive[_0xabc4('0x7d')](_0xabc4('0x7f'),_0x273a93['predictiveIntervalTotalCalls']);loggerPredictive[_0xabc4('0x7d')](_0xabc4('0x80'),_0x273a93[_0xabc4('0x65')]);loggerPredictive['info'](_0xabc4('0x81'),_0x273a93['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0xabc4('0x7d')](_0xabc4('0x82'),_0x273a93['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0xabc4('0x7d')](_0xabc4('0x83'),_0x273a93['predictiveIntervalAvgHoldtime']);loggerPredictive['info'](_0xabc4('0x84'),_0x273a93[_0xabc4('0x67')]);loggerPredictive[_0xabc4('0x7d')](_0xabc4('0x85'));if(_0x273a93[_0xabc4('0x6f')]>0x0){if(!_['isUndefined'](_0x273a93['predictiveIntervalAvgTalktime'])&&_0x273a93[_0xabc4('0x67')]>0x0){return!![];}loggerPredictive[_0xabc4('0x7d')](_0xabc4('0x86'));if(!_['isUndefined'](_0x273a93[_0xabc4('0x66')])&&_0x273a93[_0xabc4('0x66')]>0x0){return!![];}loggerPredictive[_0xabc4('0x7d')](_0xabc4('0x87'));}else{loggerPredictive[_0xabc4('0x7d')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0xabc4('0x7d')](_0xabc4('0x88'));}return![];}function mergeDataErlangB(_0x2bdd93){return function(_0x914cc8){loggerPredictive['info'](_0xabc4('0x89'));loggerPredictive['info']('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x914cc8['erlangCalls']);loggerPredictive[_0xabc4('0x7d')](_0xabc4('0x8a'),_0x914cc8[_0xabc4('0x72')]);loggerPredictive[_0xabc4('0x7d')](_0xabc4('0x8b'),_0x914cc8['erlangAbandonmentRate']);loggerPredictive['info']('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x914cc8['erlangBusyFactor']);loggerPredictive[_0xabc4('0x7d')](_0xabc4('0x8b'),_0x914cc8[_0xabc4('0x73')]);loggerPredictive[_0xabc4('0x7d')](_0xabc4('0x85'));_[_0xabc4('0x8c')](_0x2bdd93,_0x914cc8);};}function getDiff(_0x3d58f6){var _0x1f6db0=moment()['milliseconds'](0x0);var _0x32d827=moment(_0x3d58f6)[_0xabc4('0x45')](0x0);return _0x1f6db0[_0xabc4('0x46')](_0x32d827,_0xabc4('0x47'));}function ifInterval(_0x306209,_0xed3ff6){if(_[_0xabc4('0x8d')](_0xed3ff6)){return![];}return getDiff(_0xed3ff6)<_0x306209*0x3c;}function freeVariablesPredictive(_0x1d6b77){if(isNotNull(_0x1d6b77)){if(!_[_0xabc4('0x8d')](_0x1d6b77[_0xabc4('0x27')])){_0x1d6b77[_0xabc4('0x27')]=undefined;loggerPredictive['info'](_0x1d6b77[_0xabc4('0x3e')],_0xabc4('0x8e'));}if(!_['isUndefined'](_0x1d6b77[_0xabc4('0x74')])){_0x1d6b77['startPredictive']=undefined;loggerPredictive[_0xabc4('0x7d')](_0x1d6b77[_0xabc4('0x3e')],_0xabc4('0x8f'));}if(!_[_0xabc4('0x8d')](_0x1d6b77[_0xabc4('0x90')])){clearInterval(_0x1d6b77[_0xabc4('0x90')]);_0x1d6b77[_0xabc4('0x90')]=undefined;loggerPredictive[_0xabc4('0x7d')](_0x1d6b77[_0xabc4('0x3e')],'clearing\x20variable\x20handle\x20predictive');}}}function erlangb(_0x5b6962,_0xd76dac){if(_0xd76dac===0x0){return 0x0;}var _0x50268a=0x1;for(var _0x4c3bb1=0x1;_0x4c3bb1<=_0xd76dac;_0x4c3bb1+=0x1){_0x50268a=0x1+_0x50268a*_0x4c3bb1/_0x5b6962;}return 0x1/_0x50268a;}function isVoiceQueueOutbound(_0x527d45){return _0x527d45===_0xabc4('0x4a');}function isNotPreview(_0x432c5f){return _0x432c5f!==_0xabc4('0x1f');}function isCampaignIvr(_0x5c15e){return _0x5c15e==='ivr';}function getCallerId(_0x329103,_0x13f529,_0x17f3aa){if(!_[_0xabc4('0x8d')](_0x17f3aa)&&typeof _0x17f3aa===_0xabc4('0x91')&&!_['isEmpty'](_0x17f3aa)){if(!_[_0xabc4('0x8d')](_0x13f529)&&typeof _0x13f529==='string'&&!_[_0xabc4('0x43')](_0x13f529)){return util[_0xabc4('0x79')](_0xabc4('0x92'),_0x13f529,_0x17f3aa);}return util[_0xabc4('0x79')](_0xabc4('0x92'),_0x17f3aa,_0x17f3aa);}if(!_[_0xabc4('0x8d')](_0x329103)&&typeof _0x329103==='string'&&!_[_0xabc4('0x43')](_0x329103)){return _0x329103;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x661c05,_0x221859){return function(_0x204b64){freeVariablesPredictive(_0x221859);emitVoiceQueueSummary(_0x221859);emitCampaignSummary(_0x221859);loggerSyncQueueSummary[_0xabc4('0x93')](_0x661c05,util['inspect'](_0x204b64,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x165163,_0xd33005){return function(_0x2181e9){loggerPredictive[_0xabc4('0x93')](_0xd33005[_0xabc4('0x3e')],_0x165163);loggerPredictive[_0xabc4('0x93')](_0x2181e9[_0xabc4('0x94')]);freeVariablesPredictive(_0xd33005);};}function loggerCatch(_0x5696b4){return function(_0x38c5cf){logger[_0xabc4('0x93')](_0x5696b4,util['inspect'](_0x38c5cf,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x1113d5){return _0x1113d5&&!_[_0xabc4('0x8d')](_0x1113d5)&&_0x1113d5[_0xabc4('0x95')]>0x0;}function decremetOriginate(_0x199869){if(!_[_0xabc4('0x8d')](_0x199869)&&_0x199869!==null){if(typeof _0x199869[_0xabc4('0x70')]!==_0xabc4('0x96')){if(_0x199869[_0xabc4('0x70')]>0x0){_0x199869[_0xabc4('0x70')]-=0x1;}else{logger[_0xabc4('0x93')](_0xabc4('0x97'));}}}else{logger[_0xabc4('0x93')](_0xabc4('0x98'));}}function checkContactLowerLimitOriginate(_0xdd8a6f,_0x5583dd,_0x4e2838){if(_0x5583dd>_0x4e2838){for(var _0x4a21c9=0x0;_0x4a21c9<_0x5583dd-_0x4e2838;_0x4a21c9+=0x1){decremetOriginate(_0xdd8a6f);}}}function loggerGetContactDialer(_0x185e80,_0x3d3176,_0x2a34be){return function(_0x546a38){checkContactLowerLimitOriginate(_0x3d3176,_0x2a34be,0x0);logger['error'](_0x185e80,util[_0xabc4('0x99')](_0x546a38,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x35f9e3){return function(_0x244fd5){if(isNotNull(_0x244fd5)&&isNotNull(_0x244fd5[0x0])){if(_0x244fd5[0x0][_0xabc4('0x9a')]>0x0){_0x35f9e3[_0xabc4('0x3a')]=_0xabc4('0x9b');logger['info']('[getContactDialer2][ReScheduled]'+_0x35f9e3[_0xabc4('0x3e')],_0x244fd5[0x0][_0xabc4('0x9a')],_0xabc4('0x9c'));}else{_0x35f9e3[_0xabc4('0x3a')]=_0xabc4('0x9d');logger[_0xabc4('0x7d')](_0xabc4('0x9e')+_0x35f9e3[_0xabc4('0x3e')]);}}};}function notSendMessagesQueue(_0x1254a8){if(_0x1254a8[_0xabc4('0x9f')]){freeVariablesPredictive(_0x1254a8);if(_0x1254a8[_0xabc4('0x70')]===0x0&&_0x1254a8['talking']===0x0&&_0x1254a8[_0xabc4('0x52')]===0x0&&(_0x1254a8[_0xabc4('0x4e')]||0x0)===0x0){_0x1254a8[_0xabc4('0x9f')]=![];_0x1254a8['available']=0x0;_0x1254a8[_0xabc4('0x3a')]='NOT_ACTIVE';loggerSyncQueueSummary['error'](_0xabc4('0xa0'),_0x1254a8[_0xabc4('0x3e')],'is\x20not\x20active');}else{_0x1254a8[_0xabc4('0x3a')]=_0xabc4('0xa1');loggerSyncQueueSummary[_0xabc4('0x93')](_0xabc4('0xa0'),_0x1254a8['name'],'is\x20disactive');}emitVoiceQueueSummary(_0x1254a8);}}function notSendMessagesCampaign(_0x149292){if(_0x149292[_0xabc4('0x9f')]){if(_0x149292[_0xabc4('0x70')]===0x0){_0x149292['sendMessageOneNotActive']=![];_0x149292[_0xabc4('0x3a')]=_0xabc4('0x3d');loggerSyncQueueSummary[_0xabc4('0x93')](_0xabc4('0xa2'),_0x149292[_0xabc4('0x3e')],'is\x20not\x20active');}else{_0x149292['message']=_0xabc4('0xa1');loggerSyncQueueSummary[_0xabc4('0x93')](_0xabc4('0xa2'),_0x149292['name'],_0xabc4('0xa3'));}emitCampaignSummary(_0x149292);}}function createObjHistory(_0x59dc22,_0x260637,_0x12c03f,_0x58d854,_0x2fe16f){_0x59dc22['message']=_0x12c03f;var _0x50b653=new Action(_0x59dc22,_0x260637);var _0x56761c=new History(_0x50b653);_0x56761c['state']=_0x58d854;_0x56761c[_0xabc4('0xa4')]=_0x2fe16f;_0x56761c[_0xabc4('0xa5')]=_0x50b653['starttime'];return _0x56761c;}Dialer[_0xabc4('0xa6')][_0xabc4('0xa7')]=function(){var _0x1b6436=this;setInterval(function(){_0x1b6436[_0xabc4('0xa8')](_0x1b6436['uniqueId'],_0xabc4('0xa9'));_0x1b6436['clearZombieChannels'](_0x1b6436[_0xabc4('0x24')],_0xabc4('0xaa'));},0x32c8);};Dialer[_0xabc4('0xa6')]['clearZombieChannels']=function(_0x529e65,_0x4e6b99){var _0xf2a6a9=this;for(var _0x1a4f9b in _0x529e65){if(typeof _0x529e65[_0x1a4f9b]!==_0xabc4('0x96')){this['sequence']['enqueue'](function(){if(!_[_0xabc4('0xab')](_0x529e65[_0x1a4f9b])){return ami[_0xabc4('0xac')]({'action':'status','channel':_0x529e65[_0x1a4f9b][_0xabc4('0xad')]})[_0xabc4('0xae')](function(_0x214230){if(_0x214230[_0xabc4('0x3a')]===_0xabc4('0xaf')){setTimeout(function(){if(_0x529e65[_0x1a4f9b]&&_0x529e65[_0x1a4f9b][_0xabc4('0x49')]!=='ivr'){_0xf2a6a9['updateOriginated'](_0xf2a6a9[_0xabc4('0x20')][_0x529e65[_0x1a4f9b][_0xabc4('0xb0')]]);logger[_0xabc4('0x93')](_0xabc4('0xb1'),_0x4e6b99,_0x1a4f9b,_0x529e65[_0x1a4f9b][_0xabc4('0xb0')]);delete _0x529e65[_0x1a4f9b];}if(_0x529e65[_0x1a4f9b]&&_0x529e65[_0x1a4f9b][_0xabc4('0x49')]===_0xabc4('0x7b')){_0xf2a6a9[_0xabc4('0xb2')](_0xf2a6a9[_0xabc4('0x21')][_0x529e65[_0x1a4f9b][_0xabc4('0xb0')]]);logger[_0xabc4('0x93')](_0xabc4('0xb3'),_0x4e6b99,_0x1a4f9b,_0x529e65[_0x1a4f9b][_0xabc4('0xb0')]);delete _0x529e65[_0x1a4f9b];}},0x2328);}});}});}}};Dialer[_0xabc4('0xa6')][_0xabc4('0xb4')]=function(_0x4f3b01){return BPromise[_0xabc4('0xb5')]()[_0xabc4('0xb6')](cmHopper[_0xabc4('0xb4')](_0x4f3b01))[_0xabc4('0xae')](loggerCatch(_0xabc4('0xb7')));};Dialer[_0xabc4('0xa6')][_0xabc4('0xb8')]=function(_0x4a9261){return BPromise[_0xabc4('0xb5')]()['then'](cmHopperBlack[_0xabc4('0xb8')](_0x4a9261))[_0xabc4('0xae')](loggerCatch(_0xabc4('0xb9')));};Dialer['prototype'][_0xabc4('0xba')]=function(_0x115b0f){return BPromise['resolve']()['then'](cmHopperBlack[_0xabc4('0xba')](_0x115b0f))[_0xabc4('0xae')](loggerCatch(_0xabc4('0xbb')));};Dialer['prototype'][_0xabc4('0xbc')]=function(_0x104687){return BPromise[_0xabc4('0xb5')]()[_0xabc4('0xb6')](cmHopperHistory[_0xabc4('0xbd')](_0x104687))[_0xabc4('0xae')](loggerCatch('[averageHandleTime]\x20'));};Dialer[_0xabc4('0xa6')][_0xabc4('0xbe')]=function(_0x8cbafa){return BPromise[_0xabc4('0xb5')]()[_0xabc4('0xb6')](cmHopper[_0xabc4('0xbe')](_0x8cbafa))[_0xabc4('0xae')](loggerCatch(_0xabc4('0xbf')));};Dialer['prototype'][_0xabc4('0xc0')]=function(_0x27e334,_0x4ff268,_0x1e7967){return BPromise[_0xabc4('0xb5')]()[_0xabc4('0xb6')](cmHopper[_0xabc4('0xc0')](_0x27e334,_0x4ff268,_0x1e7967))[_0xabc4('0xae')](loggerCatch(_0xabc4('0xc1')));};Dialer[_0xabc4('0xa6')][_0xabc4('0xc2')]=function(_0x249601,_0x453e38,_0x35039d,_0x764c0,_0xa9f00d){return BPromise['resolve']()[_0xabc4('0xb6')](cmHopper[_0xabc4('0xc2')](_0x249601,_0x453e38,_0x35039d,_0x764c0))[_0xabc4('0xae')](function(_0x5af421){_0xa9f00d['temp']-=_0x35039d;_0xa9f00d[_0xabc4('0xc3')]=_0xa9f00d['temp']>0x0?_0xa9f00d[_0xabc4('0xc3')]:0x0;loggerCatch(_0xabc4('0xc4'))(_0x5af421);});};Dialer[_0xabc4('0xa6')][_0xabc4('0xc5')]=function(_0x48cf60,_0x50be21,_0x128ce0,_0x56f2dd){return BPromise[_0xabc4('0xb5')]()[_0xabc4('0xb6')](cmHopper[_0xabc4('0xc5')](_0x48cf60,_0x50be21,_0x128ce0))[_0xabc4('0xae')](function(_0xadb80f){_0x56f2dd[_0xabc4('0xc3')]-=_0x50be21;_0x56f2dd[_0xabc4('0xc3')]=_0x56f2dd['temp']>0x0?_0x56f2dd[_0xabc4('0xc3')]:0x0;loggerCatch(_0xabc4('0xc6'))(_0xadb80f);});};Dialer[_0xabc4('0xa6')][_0xabc4('0xc7')]=function(_0x531ec4){return BPromise[_0xabc4('0xb5')]()[_0xabc4('0xb6')](voiceQueueRt['getVoiceQueueRtPauses'](_0x531ec4))[_0xabc4('0xae')](loggerCatch(_0xabc4('0xc8')));};Dialer[_0xabc4('0xa6')][_0xabc4('0xc9')]=function(_0x10c0fd){return BPromise[_0xabc4('0xb5')]()['then'](cmHopper[_0xabc4('0xc9')](_0x10c0fd))[_0xabc4('0xae')](loggerCatch(_0xabc4('0xca')));};Dialer['prototype'][_0xabc4('0xcb')]=function(_0x5c093a){return BPromise[_0xabc4('0xb5')]()[_0xabc4('0xb6')](cmHopperHistory[_0xabc4('0xcb')](_0x5c093a))[_0xabc4('0xae')](loggerCatch(_0xabc4('0xcc')));};Dialer[_0xabc4('0xa6')]['updateOriginated']=function(_0xb8d94a){if(!_['isUndefined'](_0xb8d94a)&&_0xb8d94a!==null){if(typeof _0xb8d94a[_0xabc4('0x70')]!==_0xabc4('0x96')){if(_0xb8d94a[_0xabc4('0x70')]>0x0){_0xb8d94a[_0xabc4('0x70')]-=0x1;}else{logger[_0xabc4('0x93')](_0xabc4('0xcd'));}}}else{logger['error'](_0xabc4('0xce'));}};Dialer['prototype'][_0xabc4('0xcf')]=function(_0x120dfe,_0x3751a0){var _0x1d58d2=this;return function(_0x256d7f){_0x1d58d2[_0xabc4('0xb2')](_0x3751a0);logger[_0xabc4('0x93')](_0x120dfe,util[_0xabc4('0x99')](_0x256d7f,{'showHidden':![],'depth':null}));};};Dialer[_0xabc4('0xa6')]['emptyContact']=function(_0x21b9d4,_0x525484,_0x3555ab){var _0x5b45e6={'state':0x19,'statedesc':_0xabc4('0xd0')};this[_0xabc4('0xb2')](_0x525484);this[_0xabc4('0xd1')](_[_0xabc4('0x8c')](_0x5b45e6,_[_0xabc4('0xd2')](_0x3555ab,[_0xabc4('0xd3'),_0xabc4('0xd4'),_0xabc4('0xd5'),_0xabc4('0xd6'),_0xabc4('0xd7')])),_0xabc4('0xd8'),_0xabc4('0xd9'));logger[_0xabc4('0x93')](_0x21b9d4);};Dialer['prototype'][_0xabc4('0xda')]=function(_0x40b4e2){return _0x40b4e2===_0xabc4('0xdb');};Dialer[_0xabc4('0xa6')][_0xabc4('0xdc')]=function(_0x4de8a0){return!_[_0xabc4('0x8d')](_0x4de8a0)&&_0x4de8a0&&!_[_0xabc4('0x8d')](_0x4de8a0[_0xabc4('0x3e')])&&!_[_0xabc4('0x8d')](_0x4de8a0[_0xabc4('0x76')])&&_0x4de8a0['active']&&(this[_0xabc4('0x22')][util[_0xabc4('0x79')](_0xabc4('0xdd'),_0x4de8a0[_0xabc4('0x3e')])][_0xabc4('0xde')]==='reachable'||this['trunks'][util['format'](_0xabc4('0xdd'),_0x4de8a0['name'])][_0xabc4('0xde')]===_0xabc4('0xdf'));};Dialer['prototype'][_0xabc4('0xd1')]=function(_0x1c680a,_0x217356,_0x58e5c6){this[_0xabc4('0xcb')](_0x1c680a)[_0xabc4('0xae')](loggerCatch(_0x217356));this[_0xabc4('0xc9')](_0x1c680a)['catch'](loggerCatch(_0x58e5c6));};Dialer['prototype']['syncVarSet']=function(_0x11182b){var _0x44343f=this[_0xabc4('0x26')][_0x11182b['uniqueid']];var _0x59a0ff;if(!_[_0xabc4('0xab')](_0x11182b)&&!_['isNil'](_0x11182b[_0xabc4('0xe0')])&&!_[_0xabc4('0xab')](_0x11182b['variable'][_0xabc4('0xe1')])&&_0x11182b[_0xabc4('0xe2')]===_0xabc4('0xe3')&&_0x44343f){if(_0x44343f['type']!==_0xabc4('0x7b')&&this[_0xabc4('0x20')][_0x44343f[_0xabc4('0xb0')]][_0xabc4('0xe4')]&&_0x11182b['value']===_0xabc4('0xe5')){delete this['uniqueId'][_0x11182b['uniqueid']];this[_0xabc4('0xb2')](this[_0xabc4('0x20')][_0x44343f['queue']]);this[_0xabc4('0x20')][_0x44343f[_0xabc4('0xb0')]]['outboundAnswerCallsDay']+=0x1;this[_0xabc4('0x20')][_0x44343f[_0xabc4('0xb0')]][_0xabc4('0x58')]+=0x1;_0x59a0ff=new Hangup(_0x44343f,_0x11182b);_0x59a0ff['state']=0x12;_0x59a0ff['statedesc']=_0xabc4('0xe6');_0x59a0ff[_0xabc4('0xe7')]='AMD';ami[_0xabc4('0x48')](_0xabc4('0xe8'),ut['buildObj'](_0x59a0ff,_0xabc4('0xe9')));this['saveInDb'](_0x59a0ff,_0xabc4('0xea'),_0xabc4('0xeb'));}if(_0x44343f['type']!==_0xabc4('0x7b')&&this['voiceQueues'][_0x44343f[_0xabc4('0xb0')]][_0xabc4('0xe4')]&&_0x11182b[_0xabc4('0xec')]===_0xabc4('0xed')){var _0x57c54b=this;return new BPromise(function(_0x51bc0d,_0x2f91a9){delete _0x57c54b['uniqueId'][_0x11182b[_0xabc4('0xee')]];_0x57c54b['updateOriginated'](_0x57c54b[_0xabc4('0x20')][_0x44343f[_0xabc4('0xb0')]]);_0x57c54b[_0xabc4('0x20')][_0x44343f[_0xabc4('0xb0')]][_0xabc4('0x59')]+=0x1;_0x57c54b[_0xabc4('0x20')][_0x44343f[_0xabc4('0xb0')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x8d5d0a=_0x57c54b[_0xabc4('0x20')][_0x44343f['queue']];var _0x257569=new Hangup(_0x44343f,_0x11182b);_0x257569[_0xabc4('0xef')]=0x13;_0x257569[_0xabc4('0xa4')]='Machine';_0x257569[_0xabc4('0xe7')]=_0xabc4('0xf0');_0x257569['countmachineretry']+=0x1;_0x257569[_0xabc4('0xf1')]+=0x1;_0x257569[_0xabc4('0xe9')]=!![];ami[_0xabc4('0x48')]('custom:amd',ut[_0xabc4('0xf2')](_0x257569,_0xabc4('0xe9')));_0x57c54b[_0xabc4('0xcb')](_0x257569)[_0xabc4('0xae')](loggerCatch(_0xabc4('0xf3')));if(_0x257569[_0xabc4('0xf4')]+_0x257569[_0xabc4('0xf5')]+_0x257569[_0xabc4('0xf6')]+_0x257569[_0xabc4('0xf7')]+_0x257569[_0xabc4('0xf8')]+_0x257569[_0xabc4('0xf9')]+_0x257569[_0xabc4('0xfa')]+_0x257569[_0xabc4('0xfb')]>=_0x8d5d0a[_0xabc4('0xfc')]){_0x57c54b[_0xabc4('0xfd')](_0x257569,_0x51bc0d,_0x2f91a9,_0xabc4('0xfe'));}else{if(_0x257569[_0xabc4('0xfa')]>=_0x8d5d0a[_0xabc4('0xff')]){_0x57c54b['createStateFinal'](_0x257569,_0x51bc0d,_0x2f91a9,_0xabc4('0x100'));}else{_0x57c54b[_0xabc4('0xbe')]({'active':![],'countmachineretry':_0x257569[_0xabc4('0xfa')],'scheduledat':moment()[_0xabc4('0x101')](_0x8d5d0a[_0xabc4('0x102')],'minutes')['format'](_0xabc4('0x103')),'ContactId':_0x257569[_0xabc4('0xd3')],'ListId':_0x257569[_0xabc4('0xd4')],'VoiceQueueId':_0x257569[_0xabc4('0xd6')]||undefined,'CampaignId':_0x257569['CampaignId']||undefined})['catch'](loggerCatch(_0xabc4('0x104')));_0x51bc0d({'reschedule':0x1});}}});}if(_0x44343f[_0xabc4('0x49')]===_0xabc4('0x7b')&&this['campaigns'][_0x44343f[_0xabc4('0xb0')]][_0xabc4('0xe4')]&&_0x11182b['value']==='HANGUP'){delete this['uniqueId'][_0x11182b[_0xabc4('0xee')]];this[_0xabc4('0xb2')](this[_0xabc4('0x21')][_0x44343f[_0xabc4('0xb0')]]);_0x59a0ff=new Hangup(_0x44343f,_0x11182b);_0x59a0ff[_0xabc4('0xef')]=0x12;_0x59a0ff[_0xabc4('0xa4')]=_0xabc4('0xe6');_0x59a0ff[_0xabc4('0xe7')]=_0xabc4('0xf0');ami[_0xabc4('0x48')]('custom:amd',ut[_0xabc4('0xf2')](_0x59a0ff,'amd'));this[_0xabc4('0xd1')](_0x59a0ff,'[syncHangupInAMDIvr][createHistory]',_0xabc4('0x105'));}if(_0x44343f[_0xabc4('0x49')]===_0xabc4('0x7b')&&this[_0xabc4('0x21')][_0x44343f[_0xabc4('0xb0')]][_0xabc4('0xe4')]&&_0x11182b[_0xabc4('0xec')]===_0xabc4('0xed')){var _0x57c54b=this;return new BPromise(function(_0x16c864,_0x821ce1){delete _0x57c54b[_0xabc4('0x26')][_0x11182b[_0xabc4('0xee')]];_0x57c54b[_0xabc4('0xb2')](_0x57c54b[_0xabc4('0x21')][_0x44343f[_0xabc4('0xb0')]]);_0x57c54b['campaigns'][_0x44343f[_0xabc4('0xb0')]][_0xabc4('0x59')]+=0x1;_0x57c54b[_0xabc4('0x21')][_0x44343f[_0xabc4('0xb0')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x39100d=_0x57c54b[_0xabc4('0x21')][_0x44343f['queue']];var _0xd48aaa=new Hangup(_0x44343f,_0x11182b);_0xd48aaa[_0xabc4('0xef')]=0x13;_0xd48aaa[_0xabc4('0xa4')]='Machine';_0xd48aaa['membername']='AMD';_0xd48aaa[_0xabc4('0xfa')]+=0x1;_0xd48aaa[_0xabc4('0xf1')]+=0x1;_0xd48aaa[_0xabc4('0xe9')]=!![];ami['emit'](_0xabc4('0xe8'),ut[_0xabc4('0xf2')](_0xd48aaa,'amd'));_0x57c54b[_0xabc4('0xcb')](_0xd48aaa)['catch'](loggerCatch(_0xabc4('0xf3')));if(_0xd48aaa[_0xabc4('0xf4')]+_0xd48aaa[_0xabc4('0xf5')]+_0xd48aaa[_0xabc4('0xf6')]+_0xd48aaa[_0xabc4('0xf7')]+_0xd48aaa[_0xabc4('0xf8')]+_0xd48aaa['countabandonedretry']+_0xd48aaa['countmachineretry']+_0xd48aaa[_0xabc4('0xfb')]>=_0x39100d[_0xabc4('0xfc')]){_0x57c54b['stateGlobal'](_0xd48aaa,_0x16c864,_0x821ce1,_0xabc4('0xfe'));}else{if(_0xd48aaa[_0xabc4('0xfa')]>=_0x39100d[_0xabc4('0xff')]){_0x57c54b[_0xabc4('0x106')](_0xd48aaa,_0x16c864,_0x821ce1,_0xabc4('0x100'));}else{_0x57c54b[_0xabc4('0xbe')]({'active':![],'countmachineretry':_0xd48aaa['countmachineretry'],'scheduledat':moment()[_0xabc4('0x101')](_0x39100d[_0xabc4('0x102')],'minutes')[_0xabc4('0x79')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xd48aaa[_0xabc4('0xd3')],'ListId':_0xd48aaa[_0xabc4('0xd4')],'VoiceQueueId':_0xd48aaa['VoiceQueueId']||undefined,'CampaignId':_0xd48aaa[_0xabc4('0xd7')]||undefined})['catch'](loggerCatch(_0xabc4('0x104')));_0x16c864({'reschedule':0x1});}}});}}};Dialer['prototype'][_0xabc4('0x32')]=function(_0x3b08d0){var _0x398b87=this[_0xabc4('0x26')][_0x3b08d0[_0xabc4('0xee')]];var _0x4db93f=this;var _0x367335;if(_0x398b87&&_0x398b87['type']===_0xabc4('0x7b')){delete this['uniqueId'][_0x3b08d0[_0xabc4('0xee')]];this['updateOriginated'](this[_0xabc4('0x21')][_0x398b87[_0xabc4('0xb0')]]);this[_0xabc4('0x21')][_0x398b87[_0xabc4('0xb0')]][_0xabc4('0x107')]+=0x1;_0x367335=new Hangup(_0x398b87,_0x3b08d0);this[_0xabc4('0xcb')](_0x367335)[_0xabc4('0xae')](loggerCatch(_0xabc4('0x108')));this['moveContactManagedDialer'](_0x367335)[_0xabc4('0xae')](loggerCatch(_0xabc4('0x109')));}if(_0x398b87&&_0x398b87[_0xabc4('0x49')]!==_0xabc4('0x7b')&&isNotNull(this[_0xabc4('0x20')][_0x398b87[_0xabc4('0xb0')]]['dialQueueProject'])){delete this[_0xabc4('0x26')][_0x3b08d0[_0xabc4('0xee')]];this['updateOriginated'](this[_0xabc4('0x20')][_0x398b87[_0xabc4('0xb0')]]);this[_0xabc4('0x20')][_0x398b87['queue']][_0xabc4('0x59')]+=0x1;this[_0xabc4('0x20')][_0x398b87[_0xabc4('0xb0')]][_0xabc4('0x58')]+=0x1;_0x367335=new Hangup(_0x398b87,_0x3b08d0);_0x367335[_0xabc4('0xef')]=0x10;_0x367335[_0xabc4('0xa4')]=_0xabc4('0x10a');_0x367335[_0xabc4('0xe7')]='AGI';this[_0xabc4('0xcb')](_0x367335)[_0xabc4('0xae')](loggerCatch(_0xabc4('0x108')));this['moveContactManagedDialer'](_0x367335)['catch'](loggerCatch(_0xabc4('0x109')));}if(_0x398b87&&_0x398b87[_0xabc4('0x49')]!==_0xabc4('0x7b')&&!isNotNull(this[_0xabc4('0x20')][_0x398b87['queue']][_0xabc4('0x10b')])){delete this[_0xabc4('0x26')][_0x3b08d0[_0xabc4('0xee')]];this[_0xabc4('0xb2')](this[_0xabc4('0x20')][_0x398b87[_0xabc4('0xb0')]]);this['voiceQueues'][_0x398b87[_0xabc4('0xb0')]][_0xabc4('0x64')]+=0x1;_0x367335=new Hangup(_0x398b87,_0x3b08d0);_0x367335[_0xabc4('0xef')]=0xc;_0x367335[_0xabc4('0xa4')]=_0x3b08d0[_0xabc4('0x10c')];_0x367335['membername']=_0xabc4('0x10d');this[_0xabc4('0xcb')](_0x367335)[_0xabc4('0xae')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xabc4('0xc9')](_0x367335)[_0xabc4('0xae')](loggerCatch(_0xabc4('0x109')));}};Dialer['prototype'][_0xabc4('0x30')]=function(_0x2b2ede){var _0x7f1866=this[_0xabc4('0x26')][_0x2b2ede[_0xabc4('0xee')]];var _0x3c1dcf=this;if(this['voiceQueues'][_0x2b2ede[_0xabc4('0xb0')]]){if(_0x7f1866&&_0x7f1866['type']!==_0xabc4('0x7b')){delete this[_0xabc4('0x26')][_0x2b2ede[_0xabc4('0xee')]];this[_0xabc4('0x20')][_0x2b2ede[_0xabc4('0xb0')]][_0xabc4('0x59')]+=0x1;var _0x544f89=new AgentComplete(_0x7f1866,_0x2b2ede);if(_0x2b2ede[_0xabc4('0x10e')]===_0xabc4('0x10f')){_0x544f89['agiafterat']=this[_0xabc4('0x20')][_0x2b2ede[_0xabc4('0xb0')]]['dialQueueProject2']&&this[_0xabc4('0x20')][_0x2b2ede['queue']][_0xabc4('0x110')]?moment()['format'](_0xabc4('0x103')):undefined;}this[_0xabc4('0xcb')](_0x544f89)[_0xabc4('0xae')](loggerCatch(_0xabc4('0x111')));this['moveContactManagedDialer'](_0x544f89)[_0xabc4('0xae')](loggerCatch(_0xabc4('0x112')));}}};Dialer[_0xabc4('0xa6')][_0xabc4('0x113')]=function(_0x2c8b0b){if(this[_0xabc4('0x20')][_0x2c8b0b[_0xabc4('0xb0')]]){if(this[_0xabc4('0x26')][_0x2c8b0b[_0xabc4('0xee')]]&&this['uniqueId'][_0x2c8b0b['uniqueid']][_0xabc4('0x49')]!==_0xabc4('0x7b')){this[_0xabc4('0xb2')](this[_0xabc4('0x20')][_0x2c8b0b['queue']]);this[_0xabc4('0x26')][_0x2c8b0b['uniqueid']][_0xabc4('0x114')]=moment()[_0xabc4('0x79')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0xabc4('0xa6')][_0xabc4('0x115')]=function(_0xa250e7){this[_0xabc4('0xcb')](_0xa250e7)[_0xabc4('0xae')](loggerCatch(_0xabc4('0x111')));this[_0xabc4('0xc9')](_0xa250e7)[_0xabc4('0xae')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));};Dialer[_0xabc4('0xa6')][_0xabc4('0x2e')]=function(_0x3c90b0){var _0x4a5bd1=this[_0xabc4('0x26')][_0x3c90b0[_0xabc4('0xee')]];var _0x26e9d=this;if(this[_0xabc4('0x20')][_0x3c90b0['queue']]){if(_0x4a5bd1&&_0x4a5bd1[_0xabc4('0x49')]!==_0xabc4('0x7b')){delete this['uniqueId'][_0x3c90b0['uniqueid']];this['updateOriginated'](this[_0xabc4('0x20')][_0x3c90b0[_0xabc4('0xb0')]]);_0x4a5bd1[_0xabc4('0x116')]=moment()[_0xabc4('0x79')]('YYYY-MM-DD\x20HH:mm:ss');var _0x35712b=new QueueCallerAbandon(_0x4a5bd1,_0x3c90b0);if(getSeconds(_0x4a5bd1[_0xabc4('0x116')],_0x4a5bd1[_0xabc4('0x117')])>=_0x4a5bd1[_0xabc4('0x118')]){this[_0xabc4('0x20')][_0x3c90b0[_0xabc4('0xb0')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0xabc4('0x20')][_0x3c90b0['queue']]['outboundDropCallsDayTimeout']+=0x1;this[_0xabc4('0x20')][_0x3c90b0['queue']]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x35712b[_0xabc4('0xef')]=0xa;_0x35712b[_0xabc4('0xa4')]=_0xabc4('0x119');_0x35712b[_0xabc4('0x11a')]=_0xabc4('0x11b');_0x35712b[_0xabc4('0x11c')]=this[_0xabc4('0x20')][_0x3c90b0[_0xabc4('0xb0')]][_0xabc4('0x11d')]?moment()['format'](_0xabc4('0x103')):undefined;_0x35712b[_0xabc4('0xf8')]+=0x1;_0x35712b[_0xabc4('0xf1')]+=0x1;if(_0x35712b[_0xabc4('0xf8')]>=this[_0xabc4('0x20')][_0x3c90b0[_0xabc4('0xb0')]][_0xabc4('0x11e')]){this['queueCallerAbandonCreateState'](_0x35712b);}else{this['rescheduleContact']({'active':![],'countdropretry':_0x35712b[_0xabc4('0xf8')],'scheduledat':moment()[_0xabc4('0x101')](this[_0xabc4('0x20')][_0x3c90b0['queue']]['dialDropRetryFrequency'],_0xabc4('0x11f'))[_0xabc4('0x79')](_0xabc4('0x103')),'ContactId':_0x4a5bd1[_0xabc4('0xd3')],'ListId':_0x4a5bd1[_0xabc4('0xd4')],'VoiceQueueId':_0x4a5bd1[_0xabc4('0xd6')]||undefined,'CampaignId':_0x4a5bd1[_0xabc4('0xd7')]||undefined})['catch'](loggerCatch(_0xabc4('0x120')));var _0x3d2c3f=new History(_0x35712b);_0x3d2c3f[_0xabc4('0xef')]=0xa;_0x3d2c3f[_0xabc4('0xa4')]=_0xabc4('0x119');_0x3d2c3f[_0xabc4('0x121')]=moment()['format'](_0xabc4('0x103'));_0x3d2c3f[_0xabc4('0xa5')]=_0x3d2c3f[_0xabc4('0x121')];_0x3d2c3f[_0xabc4('0x122')]=_0x35712b['calleridname'];_0x3d2c3f['calleridnum']=_0x35712b[_0xabc4('0x123')];this[_0xabc4('0xcb')](_0x3d2c3f)['catch'](loggerCatch(_0xabc4('0x124')));}}else{this['voiceQueues'][_0x3c90b0['queue']][_0xabc4('0x68')]+=0x1;this[_0xabc4('0x20')][_0x3c90b0[_0xabc4('0xb0')]][_0xabc4('0x5e')]+=0x1;_0x35712b['state']=0xb;_0x35712b['statedesc']=_0xabc4('0x125');_0x35712b[_0xabc4('0x11a')]=_0xabc4('0x126');_0x35712b[_0xabc4('0xf9')]+=0x1;_0x35712b['countglobal']+=0x1;if(_0x35712b[_0xabc4('0xf9')]>=this['voiceQueues'][_0x3c90b0[_0xabc4('0xb0')]][_0xabc4('0x127')]){this[_0xabc4('0x115')](_0x35712b);}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0x35712b['countabandonedretry'],'scheduledat':moment()['add'](this['voiceQueues'][_0x3c90b0['queue']][_0xabc4('0x128')],_0xabc4('0x11f'))[_0xabc4('0x79')](_0xabc4('0x103')),'ContactId':_0x4a5bd1[_0xabc4('0xd3')],'ListId':_0x4a5bd1[_0xabc4('0xd4')],'VoiceQueueId':_0x4a5bd1[_0xabc4('0xd6')]||undefined,'CampaignId':_0x4a5bd1[_0xabc4('0xd7')]||undefined})[_0xabc4('0xae')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x3d2c3f=new History(_0x35712b);_0x3d2c3f[_0xabc4('0xef')]=0xb;_0x3d2c3f[_0xabc4('0xa4')]='Abandoned';_0x3d2c3f['starttime']=moment()[_0xabc4('0x79')](_0xabc4('0x103'));_0x3d2c3f['endtime']=_0x3d2c3f[_0xabc4('0x121')];_0x3d2c3f[_0xabc4('0x122')]=_0x35712b[_0xabc4('0x122')];_0x3d2c3f[_0xabc4('0x123')]=_0x35712b[_0xabc4('0x123')];this['createHistory'](_0x3d2c3f)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));}}}}};Dialer[_0xabc4('0xa6')][_0xabc4('0x129')]=function(_0x34bb5d){if(this[_0xabc4('0x24')][_0x34bb5d['uniqueid']]){this[_0xabc4('0x24')][_0x34bb5d['uniqueid']][_0xabc4('0xad')]=_0x34bb5d[_0xabc4('0xad')];}if(this[_0xabc4('0x26')][_0x34bb5d[_0xabc4('0xee')]]){this[_0xabc4('0x26')][_0x34bb5d[_0xabc4('0xee')]]['channel']=_0x34bb5d['channel'];}};Dialer[_0xabc4('0xa6')][_0xabc4('0x36')]=function(_0xacfb81){if(strategy[this[_0xabc4('0x20')][this[_0xabc4('0x24')][_0xacfb81[_0xabc4('0x12a')]][_0xabc4('0xb0')]][_0xabc4('0x12b')]]===_0xabc4('0x12c')){if(this[_0xabc4('0x24')][_0xacfb81[_0xabc4('0x12a')]]&&_[_0xabc4('0xab')](this[_0xabc4('0x24')][_0xacfb81[_0xabc4('0x12a')]]['locked'])&&_0xacfb81[_0xabc4('0xde')]==='1'&&_0xacfb81[_0xabc4('0x12d')]==='0'){if(this[_0xabc4('0x12e')][_0xacfb81['stateinterface']]){if(!this[_0xabc4('0x12e')][_0xacfb81[_0xabc4('0x12f')]][_0xabc4('0x130')]){this['agents'][_0xacfb81['stateinterface']][_0xabc4('0x130')]=!![];this['actions'][_0xacfb81[_0xabc4('0x12a')]][_0xabc4('0x130')]=!![];this[_0xabc4('0x24')][_0xacfb81[_0xabc4('0x12a')]][_0xabc4('0x12f')]=_0xacfb81['stateinterface'];}}}}else if((strategy[this[_0xabc4('0x20')][this[_0xabc4('0x24')][_0xacfb81[_0xabc4('0x12a')]][_0xabc4('0xb0')]][_0xabc4('0x12b')]]||'rrmemory')==='rrmemory'){if(this['actions'][_0xacfb81['actionid']]){if(this[_0xabc4('0x12e')][_0xacfb81[_0xabc4('0x12f')]]){this[_0xabc4('0x24')][_0xacfb81[_0xabc4('0x12a')]]['stateinterface']=_0xacfb81['stateinterface'];if(_[_0xabc4('0xab')](this[_0xabc4('0x29')][this[_0xabc4('0x24')][_0xacfb81[_0xabc4('0x12a')]][_0xabc4('0xb0')]])){this[_0xabc4('0x29')][this[_0xabc4('0x24')][_0xacfb81['actionid']][_0xabc4('0xb0')]]=[];}this[_0xabc4('0x29')][this[_0xabc4('0x24')][_0xacfb81[_0xabc4('0x12a')]][_0xabc4('0xb0')]]['push'](_[_0xabc4('0x8c')](_[_0xabc4('0xd2')](this[_0xabc4('0x24')][_0xacfb81[_0xabc4('0x12a')]],['idHopper','stateinterface']),{'status':_0xacfb81[_0xabc4('0xde')],'paused':_0xacfb81[_0xabc4('0x12d')]}));}}}};function unlockQueueStatus(_0x9ec7a9,_0x456a35){setTimeout(function(){if(_['isUndefined'](_0x9ec7a9[_0xabc4('0x131')])){loggerBooked[_0xabc4('0x93')](_0xabc4('0x132'),_0x456a35);}_0x9ec7a9[_0xabc4('0x131')]=!![];loggerBooked[_0xabc4('0x7d')](_0xabc4('0x133'),_0x456a35,JSON['stringify'](_[_0xabc4('0xd2')](_0x9ec7a9,['name',_0xabc4('0x131')])));},0x1f3);}Dialer[_0xabc4('0xa6')][_0xabc4('0x38')]=function(_0x50d13e){var _0x5b8793=this;var _0x56d869=_0x5b8793[_0xabc4('0x20')][_0x5b8793['actions'][_0x50d13e[_0xabc4('0x12a')]][_0xabc4('0xb0')]];if(strategy[this['voiceQueues'][this[_0xabc4('0x24')][_0x50d13e[_0xabc4('0x12a')]][_0xabc4('0xb0')]][_0xabc4('0x12b')]]===_0xabc4('0x12c')){if(this[_0xabc4('0x24')][_0x50d13e[_0xabc4('0x12a')]]&&this[_0xabc4('0x24')][_0x50d13e[_0xabc4('0x12a')]]['stateinterface']){this['preview'][_0xabc4('0x134')](this[_0xabc4('0x24')][_0x50d13e['actionid']][_0xabc4('0x135')],this['actions'][_0x50d13e[_0xabc4('0x12a')]][_0xabc4('0x12f')])[_0xabc4('0xae')](function(_0x41b025){logger['error'](_0xabc4('0x136'),util[_0xabc4('0x99')](_0x41b025,{'showHidden':![],'depth':null}));})[_0xabc4('0x137')](function(){_0x5b8793[_0xabc4('0xb2')](_0x5b8793[_0xabc4('0x20')][_0x5b8793[_0xabc4('0x24')][_0x50d13e[_0xabc4('0x12a')]][_0xabc4('0xb0')]]);_0x5b8793[_0xabc4('0x12e')][_0x5b8793['actions'][_0x50d13e[_0xabc4('0x12a')]][_0xabc4('0x12f')]][_0xabc4('0x130')]=![];delete _0x5b8793['actions'][_0x50d13e[_0xabc4('0x12a')]];unlockQueueStatus(_0x56d869);});}else{this[_0xabc4('0xb2')](this[_0xabc4('0x20')][this[_0xabc4('0x24')][_0x50d13e[_0xabc4('0x12a')]][_0xabc4('0xb0')]]);this[_0xabc4('0xbe')]({'active':![],'ContactId':this[_0xabc4('0x24')][_0x50d13e[_0xabc4('0x12a')]][_0xabc4('0xd3')],'ListId':this['actions'][_0x50d13e[_0xabc4('0x12a')]]['ListId'],'VoiceQueueId':this[_0xabc4('0x24')][_0x50d13e[_0xabc4('0x12a')]][_0xabc4('0xd6')]||undefined,'CampaignId':this['actions'][_0x50d13e[_0xabc4('0x12a')]][_0xabc4('0xd7')]||undefined})[_0xabc4('0xae')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0xabc4('0x24')][_0x50d13e['actionid']];unlockQueueStatus(_0x56d869);}}else if((strategy[this[_0xabc4('0x20')][this['actions'][_0x50d13e[_0xabc4('0x12a')]][_0xabc4('0xb0')]][_0xabc4('0x12b')]]||_0xabc4('0x1b'))===_0xabc4('0x1b')){var _0x45039b;if(this[_0xabc4('0x24')][_0x50d13e[_0xabc4('0x12a')]]&&!_[_0xabc4('0x43')](this[_0xabc4('0x29')][this['actions'][_0x50d13e[_0xabc4('0x12a')]][_0xabc4('0xb0')]])){if(this[_0xabc4('0x2a')][_0x5b8793[_0xabc4('0x24')][_0x50d13e[_0xabc4('0x12a')]][_0xabc4('0xb0')]]){this['queueBookedRR'][_0x5b8793[_0xabc4('0x24')][_0x50d13e['actionid']]['queue']]=this[_0xabc4('0x2a')][this['actions'][_0x50d13e[_0xabc4('0x12a')]][_0xabc4('0xb0')]]?this[_0xabc4('0x2a')][this[_0xabc4('0x24')][_0x50d13e[_0xabc4('0x12a')]][_0xabc4('0xb0')]]:this[_0xabc4('0x29')][this[_0xabc4('0x24')][_0x50d13e['actionid']][_0xabc4('0xb0')]]?this[_0xabc4('0x29')][this[_0xabc4('0x24')][_0x50d13e[_0xabc4('0x12a')]]['queue']]['_rr']||0x0:0x0;}this[_0xabc4('0x29')][this[_0xabc4('0x24')][_0x50d13e['actionid']][_0xabc4('0xb0')]]['_rr']=this[_0xabc4('0x2a')][this[_0xabc4('0x24')][_0x50d13e[_0xabc4('0x12a')]][_0xabc4('0xb0')]];for(var _0x3e6979=0x0;_0x3e6979=0x0;})['catch'](myreject(_0x550a29)));}}else{_0x5d2e03[_0xabc4('0x151')](ami[_0xabc4('0xac')]({'action':_0xabc4('0x152'),'command':util[_0xabc4('0x79')](_0xabc4('0x153'),_0x200a1f,!_[_0xabc4('0x8d')](config[_0xabc4('0x14d')][_0x1e08b4])?_0x1e08b4:'')})['then'](function(_0x3bc2bf){return _0x3bc2bf[_0xabc4('0x155')][_0xabc4('0x156')](_0xabc4('0x157'))>=0x0;})['catch'](myreject(_0x550a29)));}BPromise['all'](_0x5d2e03)[_0xabc4('0xb6')](function(_0xb45f83){var _0x51064f=_[_0xabc4('0x158')](_0xb45f83);if(_0x51064f){return _0xd5d868(_0x51064f);}else{_0x39ccb8[_0xabc4('0x3a')]=_0x319e1c?_0xabc4('0x159'):_0xabc4('0x15a');return _0x550a29(msgResponse(_0xabc4('0x15b'),_0xabc4('0x149'),_0xabc4('0x15c')+_0x319e1c+'\x20'+_0x5d39a7+_0xabc4('0x15d')+util[_0xabc4('0x99')](_0x200a1f,{'showHidden':![],'depth':null})+_0xabc4('0x15e')+_0x1e08b4));}})[_0xabc4('0xae')](function(_0x99d021){return _0x550a29(msgResponse(_0xabc4('0x147'),'Failure',JSON['stringify'](_0x99d021)));});});};Dialer[_0xabc4('0xa6')]['checkDialMethod']=function(_0x207a5d){var _0x3b4db1=this;return function(){switch(_0x207a5d[_0xabc4('0x54')]){case _0xabc4('0x15f'):freeVariablesPredictive(_0x207a5d);_0x3b4db1[_0xabc4('0x160')](_0x207a5d,0x1);break;case _0xabc4('0x161'):freeVariablesPredictive(_0x207a5d);_0x3b4db1[_0xabc4('0x160')](_0x207a5d,_0x207a5d[_0xabc4('0x162')]);break;case _0xabc4('0x7'):_0x3b4db1[_0xabc4('0x7')](_0x207a5d);break;case _0xabc4('0x6'):freeVariablesPredictive(_0x207a5d);_0x3b4db1[_0xabc4('0x160')](_0x207a5d,0x1);break;default:freeVariablesPredictive(_0x207a5d);logger[_0xabc4('0x93')](_0xabc4('0x163'),_0x207a5d[_0xabc4('0x3e')],_0xabc4('0x164'));}};};Dialer['prototype']['launchHandleIvr']=function(_0x52c645){var _0x3f5e05=this;return function(){_0x3f5e05[_0xabc4('0x165')](_0x52c645);};};Dialer['prototype'][_0xabc4('0x9')]=function(_0x537b9c){var _0x11db35=this;if(isNotPreview(_0x537b9c[_0xabc4('0x54')])){if(isVoiceQueueOutbound(_0x537b9c['type'])&&isActive(_0x537b9c[_0xabc4('0x166')])){_0x537b9c[_0xabc4('0x9f')]=!![];BPromise[_0xabc4('0xb5')]()[_0xabc4('0xb6')](checkIsLoggedIn(_0x537b9c,_0x537b9c['loggedIn']))[_0xabc4('0xb6')](checkIsActive(_0x537b9c,_0x537b9c[_0xabc4('0x166')]))[_0xabc4('0xb6')](checkInterval(_0x537b9c))['then'](_0x11db35[_0xabc4('0x142')](_0x537b9c))['then'](_0x11db35['checkIfTime'](_0x537b9c['dialGlobalInterval'],_0x537b9c[_0xabc4('0x167')],_0x537b9c['name'],_0x537b9c))[_0xabc4('0xb6')](_0x11db35['checkIfTimeIntervals'](_0x537b9c['Interval'],_0x537b9c['dialTimezone'],_0x537b9c['name'],_0x537b9c))[_0xabc4('0xb6')](_0x11db35[_0xabc4('0x168')](_0x537b9c))[_0xabc4('0xae')](loggerCatchQueueSummary(_0xabc4('0x169'),_0x537b9c));}else{notSendMessagesQueue(_0x537b9c);}}else{freeVariablesPredictive(_0x537b9c);}};Dialer[_0xabc4('0xa6')]['syncCampaigns']=function(){var _0x31ccd5=this;var _0x4585dc;for(var _0x426df1 in this[_0xabc4('0x21')]){if(typeof this[_0xabc4('0x21')][_0x426df1]!=='undefined'){_0x4585dc=this['campaigns'][_0x426df1];if(isCampaignIvr(_0x4585dc[_0xabc4('0x49')])&&isActive(_0x4585dc[_0xabc4('0x76')])){_0x4585dc['sendMessageOneNotActive']=!![];BPromise[_0xabc4('0xb5')]()['then'](checkIsActive(_0x4585dc,_0x4585dc[_0xabc4('0x76')]))[_0xabc4('0xb6')](checkInterval(_0x4585dc))[_0xabc4('0xb6')](_0x31ccd5[_0xabc4('0x142')](_0x4585dc))[_0xabc4('0xb6')](_0x31ccd5['checkIfTime'](_0x4585dc[_0xabc4('0x16a')],_0x4585dc[_0xabc4('0x167')],_0x4585dc[_0xabc4('0x3e')],_0x4585dc))[_0xabc4('0xb6')](_0x31ccd5[_0xabc4('0x148')](_0x4585dc['Interval'],_0x4585dc[_0xabc4('0x167')],_0x4585dc[_0xabc4('0x3e')],_0x4585dc))['then'](_0x31ccd5[_0xabc4('0x16b')](_0x4585dc))['catch'](loggerCatchQueueSummary(_0xabc4('0x16c'),_0x4585dc));}else{notSendMessagesCampaign(_0x4585dc);}}}};function getCallerIdRandom(_0x17d26f,_0x1293aa){var _0x376e3c;var _0x2d0db2;var _0x468cde;if(_0x1293aa<=0x0){_0x1293aa=0x1;}_0x376e3c=new RegExp(_0xabc4('0x16d')+_0x1293aa+'}$');_0x2d0db2=Math['pow'](0xa,_0x1293aa-0x1);_0x468cde=Math[_0xabc4('0x16e')](0xa,_0x1293aa)-0x1;return util[_0xabc4('0x79')]('%s',_['replace'](_0x17d26f,_0x376e3c,_[_0xabc4('0x16f')](_0x2d0db2,_0x468cde)));}function extractCalleridName(_0x31dd1c){var _0x4fa8cd=_0x31dd1c['match'](/"(.*?)"/);return _0x4fa8cd?_0x4fa8cd[0x1]:_0x31dd1c;}function extractCalleridNumber(_0x310010){var _0x1ad004=_0x310010['match'](/<(.*?)>/);return _0x1ad004?_0x1ad004[0x1]:_0x310010;}Dialer['prototype'][_0xabc4('0x170')]=function(_0x3e0479,_0x117c28){var _0xe9632b=this;var _0x2ee54e=uuid['v4']();this[_0xabc4('0x24')][_0x2ee54e]=new Action(_0x3e0479,_0x117c28,_0x2ee54e);return new BPromise(function(_0x527d63,_0x329a6d){if(_['isUndefined'](_0x3e0479)&&typeof _0x3e0479!==_0xabc4('0x171')){return _0x329a6d(msgResponse('originate','Failure',_0xabc4('0x172')));}if(_['isUndefined'](_0x117c28[_0xabc4('0x173')][_0xabc4('0x174')])||_0x117c28['Contact'][_0xabc4('0x174')]===null){return _0x329a6d(msgResponse('originate',_0xabc4('0x149'),_0xabc4('0x175')));}var _0x4e113b={'XMD-CALLERID':_0xe9632b[_0xabc4('0x24')][_0x2ee54e][_0xabc4('0x176')](),'XMD-AGI':_0x3e0479[_0xabc4('0x10b')]?util[_0xabc4('0x79')](_0xabc4('0x177'),ipAgi,_0x3e0479['dialQueueProject']):_0xabc4('0x178'),'XMD-AGIAFTER':_0x3e0479[_0xabc4('0x11d')]?util[_0xabc4('0x79')]('\x22agi://%s/square,%s\x22',ipAgi,_0x3e0479['dialQueueProject2']):_0xabc4('0x178'),'XMD-QUEUE':_0x3e0479[_0xabc4('0x49')]==='outbound'?util[_0xabc4('0x79')](_0xabc4('0x179'),_0x3e0479[_0xabc4('0x3e')],_0x3e0479['dialQueueOptions']||'',_0x3e0479[_0xabc4('0x110')]?'c':'',_0x3e0479[_0xabc4('0x118')]||0x3):_0xabc4('0x178'),'XMD-CONTACTID':_0x117c28[_0xabc4('0xd3')],'XMD-CDRTYPE':_0xabc4('0x4'),'CALLERID(all)':_0xe9632b[_0xabc4('0x24')][_0x2ee54e]['getCaller'](),'XMD-AMD':_0x3e0479[_0xabc4('0xe4')]?'ACTIVE':_0xabc4('0x178'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x3e0479[_0xabc4('0xe4')]){_0x4e113b[_0xabc4('0x17a')]=_0x3e0479[_0xabc4('0x17b')]||0x9c4;_0x4e113b[_0xabc4('0x17c')]=_0x3e0479[_0xabc4('0x17d')]||0x5dc;_0x4e113b[_0xabc4('0x17e')]=_0x3e0479['dialAMDAfterGreetingSilence']||0x320;_0x4e113b['XMD-AMDTOTALANALYSISTIME']=_0x3e0479[_0xabc4('0x17f')]||0x1388;_0x4e113b[_0xabc4('0x180')]=_0x3e0479['dialAMDMinWordLength']||0x64;_0x4e113b[_0xabc4('0x181')]=_0x3e0479[_0xabc4('0x182')]||0x32;_0x4e113b[_0xabc4('0x183')]=_0x3e0479[_0xabc4('0x184')]||0x3;_0x4e113b[_0xabc4('0x185')]=_0x3e0479['dialAMDSilenceThreshold']||0x100;_0x4e113b[_0xabc4('0x186')]=_0x3e0479[_0xabc4('0x187')]||0x1388;}if(_0x3e0479['type']==='outbound'){_0x4e113b['XMD-VOICEQUEUEID']=_0x117c28[_0xabc4('0xd6')];}else{_0x4e113b[_0xabc4('0x188')]=_0x117c28[_0xabc4('0xd7')];}for(var _0x42c4c7 in _0x117c28[_0xabc4('0x173')]){if(typeof _0x117c28[_0xabc4('0x173')][_0x42c4c7]!=='undefined'){if(isNotNull(_0x117c28[_0xabc4('0x173')][_0x42c4c7])&&_0x42c4c7!=='id'&&_0x42c4c7!==_0xabc4('0x189')&&_0x42c4c7!=='createdAt'&&_0x42c4c7!==_0xabc4('0x18a')){_0x4e113b[util['format'](_0xabc4('0x18b'),_0xabc4('0x18c'),_[_0xabc4('0x18d')](_0x42c4c7))]=_0x117c28['Contact'][_0x42c4c7];}}}var _0x468829=_0xe9632b[_0xabc4('0xdc')](_0x3e0479[_0xabc4('0x75')])?getCallerId(_0x3e0479[_0xabc4('0x75')]['callerid'],_0x3e0479[_0xabc4('0x55')],_0x3e0479[_0xabc4('0x18e')]>0x0?getCallerIdRandom(_0x3e0479[_0xabc4('0x18f')],_0x3e0479['dialRandomLastDigitCallerIdNumber']):_0x3e0479[_0xabc4('0x18f')]):getCallerId(_['isNil'](_0x3e0479['TrunkBackup'])?_0x3e0479[_0xabc4('0x75')][_0xabc4('0x77')]:_0x3e0479[_0xabc4('0x143')][_0xabc4('0x77')],_0x3e0479[_0xabc4('0x55')],_0x3e0479[_0xabc4('0x18e')]>0x0?getCallerIdRandom(_0x3e0479[_0xabc4('0x18f')],_0x3e0479[_0xabc4('0x18e')]):_0x3e0479['dialOriginateCallerIdNumber']);if(_0x468829){_0x4e113b[_0xabc4('0x190')]=_0xe9632b['actions'][_0x2ee54e][_0xabc4('0x191')]=extractCalleridName(_0x468829);_0x4e113b[_0xabc4('0x192')]=_0xe9632b[_0xabc4('0x24')][_0x2ee54e]['originatecalleridnum']=extractCalleridNumber(_0x468829);}return ami['Action']({'actionid':_0x2ee54e,'action':_0xabc4('0x193'),'channel':_0xe9632b[_0xabc4('0xdc')](_0x3e0479[_0xabc4('0x75')])?util[_0xabc4('0x79')]('SIP/%s/%s%s',_0x3e0479[_0xabc4('0x75')]['name'],isNotNull(_0x3e0479[_0xabc4('0x57')])?_0x3e0479[_0xabc4('0x57')][_0xabc4('0x194')]()||'':'',_0x3e0479['dialCutDigit']>0x0?_0x117c28['Contact'][_0xabc4('0x174')][_0xabc4('0x195')](_0x3e0479[_0xabc4('0x196')]):_0x117c28[_0xabc4('0x173')][_0xabc4('0x174')]):util[_0xabc4('0x79')]('SIP/%s/%s%s',_[_0xabc4('0xab')](_0x3e0479[_0xabc4('0x143')])?_0x3e0479[_0xabc4('0x75')][_0xabc4('0x3e')]:_0x3e0479[_0xabc4('0x143')][_0xabc4('0x3e')],isNotNull(_0x3e0479[_0xabc4('0x57')])?_0x3e0479[_0xabc4('0x57')][_0xabc4('0x194')]()||'':'',_0x3e0479[_0xabc4('0x196')]>0x0?_0x117c28[_0xabc4('0x173')][_0xabc4('0x174')]['substring'](_0x3e0479[_0xabc4('0x196')]):_0x117c28[_0xabc4('0x173')][_0xabc4('0x174')]),'callerid':_0x468829,'Exten':'xcally-motion-dialer','Context':_0xabc4('0x197'),'Priority':'1','variable':_0x4e113b,'timeout':(_0x3e0479[_0xabc4('0x56')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2ee54e})['then'](function(_0x33a304){return _0x527d63(_0x33a304);})[_0xabc4('0xae')](function(_0x20d6ee){_0x3e0479[_0xabc4('0x62')]+=0x1;var _0x334796=new History(_0xe9632b[_0xabc4('0x24')][_0x2ee54e]);logger[_0xabc4('0x93')](util[_0xabc4('0x79')]('[originateError]:\x20%s',JSON[_0xabc4('0x44')](_0x20d6ee)));_0x334796[_0xabc4('0xef')]=0xe;_0x334796[_0xabc4('0xa4')]=_0xabc4('0x198');_0x334796[_0xabc4('0x121')]=moment()[_0xabc4('0x79')](_0xabc4('0x103'));_0x334796['endtime']=_0x334796[_0xabc4('0x121')];_0xe9632b[_0xabc4('0xcb')](_0x334796)['catch'](loggerCatch(_0xabc4('0x199')));_0xe9632b[_0xabc4('0xc9')](_0x334796)[_0xabc4('0xae')](loggerCatch(_0xabc4('0x199')))[_0xabc4('0x137')](function(){delete _0xe9632b[_0xabc4('0x24')][_0x2ee54e];return _0x329a6d(msgResponse(_0xabc4('0x193'),'Error',_0xabc4('0x19a')));});});});};Dialer['prototype']['syncOriginateResponse']=function(_0x580b45){var _0x1723ad=this[_0xabc4('0x24')][_0x580b45['actionid']];if(_0x1723ad){delete this[_0xabc4('0x24')][_0x580b45['actionid']];_0x1723ad[_0xabc4('0x117')]=moment()['format'](_0xabc4('0x103'));var _0x9bd87f=_0x1723ad['type']==='ivr'?this[_0xabc4('0x21')][_0x1723ad[_0xabc4('0xb0')]]:this[_0xabc4('0x20')][_0x1723ad[_0xabc4('0x19b')]()];if(!this['isSuccess'](_0x580b45['response'])){this[_0xabc4('0xb2')](_0x9bd87f);return this[_0xabc4('0x19c')](_0x1723ad,_0x9bd87f,_0x580b45)[_0xabc4('0xae')](loggerCatch(_0xabc4('0x19d')));}this['uniqueId'][_0x580b45[_0xabc4('0xee')]]=_0x1723ad;}};Dialer['prototype'][_0xabc4('0x19e')]=function(_0x516aef,_0x29d641,_0xb7c260){var _0x3b1872=new History(_0x29d641);if(_0x3b1872['countbusyretry']+_0x3b1872[_0xabc4('0xf5')]+_0x3b1872[_0xabc4('0xf6')]+_0x3b1872[_0xabc4('0xf7')]+_0x3b1872['countdropretry']+_0x3b1872[_0xabc4('0xf9')]+_0x3b1872[_0xabc4('0xfa')]+_0x3b1872['countagentrejectretry']>=_0xb7c260[_0xabc4('0xfc')]-0x1){return!![];}switch(_0x516aef){case 0x3:if(_0x3b1872[_0xabc4('0xf6')]>=_0xb7c260[_0xabc4('0x19f')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countnoanswerretry':_0x3b1872[_0xabc4('0xf6')]+=0x1,'scheduledat':moment()[_0xabc4('0x101')](_0xb7c260['dialNoAnswerRetryFrequency'],_0xabc4('0x11f'))[_0xabc4('0x79')](_0xabc4('0x103')),'ContactId':_0x3b1872[_0xabc4('0xd3')],'ListId':_0x3b1872[_0xabc4('0xd4')],'VoiceQueueId':_0x3b1872[_0xabc4('0xd6')]||undefined,'CampaignId':_0x3b1872[_0xabc4('0xd7')]||undefined})['catch'](loggerCatch(_0xabc4('0x1a0')));break;case 0x5:if(_0x3b1872[_0xabc4('0xf4')]>=_0xb7c260[_0xabc4('0x1a1')]-0x1){return!![];}this[_0xabc4('0xbe')]({'active':![],'countbusyretry':_0x3b1872[_0xabc4('0xf4')]+=0x1,'scheduledat':moment()[_0xabc4('0x101')](_0xb7c260[_0xabc4('0x1a2')],_0xabc4('0x11f'))[_0xabc4('0x79')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3b1872['ContactId'],'ListId':_0x3b1872[_0xabc4('0xd4')],'VoiceQueueId':_0x3b1872[_0xabc4('0xd6')]||undefined,'CampaignId':_0x3b1872[_0xabc4('0xd7')]||undefined})[_0xabc4('0xae')](loggerCatch(_0xabc4('0x1a3')));break;case 0x8:if(_0x3b1872[_0xabc4('0xf5')]>=_0xb7c260[_0xabc4('0x1a4')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countcongestionretry':_0x3b1872['countcongestionretry']+=0x1,'scheduledat':moment()[_0xabc4('0x101')](_0xb7c260['dialCongestionRetryFrequency'],_0xabc4('0x11f'))[_0xabc4('0x79')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3b1872[_0xabc4('0xd3')],'ListId':_0x3b1872[_0xabc4('0xd4')],'VoiceQueueId':_0x3b1872[_0xabc4('0xd6')]||undefined,'CampaignId':_0x3b1872['CampaignId']||undefined})[_0xabc4('0xae')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x3b1872['countnosuchnumberretry']>=_0xb7c260[_0xabc4('0x1a5')]-0x1){return!![];}else{this[_0xabc4('0xbe')]({'active':![],'countnosuchnumberretry':_0x3b1872['countnosuchnumberretry']+=0x1,'scheduledat':moment()['add'](_0xb7c260[_0xabc4('0x1a6')],'minutes')[_0xabc4('0x79')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3b1872[_0xabc4('0xd3')],'ListId':_0x3b1872[_0xabc4('0xd4')],'VoiceQueueId':_0x3b1872['VoiceQueueId']||undefined,'CampaignId':_0x3b1872[_0xabc4('0xd7')]||undefined})['catch'](loggerCatch(_0xabc4('0x1a7')));}break;case 0xa:if(_0x3b1872[_0xabc4('0xf8')]>=_0xb7c260['dialDropMaxRetry']-0x1){return!![];}this[_0xabc4('0xbe')]({'active':![],'countdropretry':_0x3b1872[_0xabc4('0xf8')]+=0x1,'scheduledat':moment()[_0xabc4('0x101')](_0xb7c260[_0xabc4('0x1a8')],_0xabc4('0x11f'))[_0xabc4('0x79')](_0xabc4('0x103')),'ContactId':_0x3b1872[_0xabc4('0xd3')],'ListId':_0x3b1872[_0xabc4('0xd4')],'VoiceQueueId':_0x3b1872[_0xabc4('0xd6')]||undefined,'CampaignId':_0x3b1872['CampaignId']||undefined})[_0xabc4('0xae')](loggerCatch(_0xabc4('0x120')));break;case 0xb:if(_0x3b1872[_0xabc4('0xf9')]>=_0xb7c260[_0xabc4('0x127')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countabandonedretry':_0x3b1872[_0xabc4('0xf9')]+=0x1,'scheduledat':moment()[_0xabc4('0x101')](_0xb7c260[_0xabc4('0x128')],_0xabc4('0x11f'))[_0xabc4('0x79')](_0xabc4('0x103')),'ContactId':_0x3b1872[_0xabc4('0xd3')],'ListId':_0x3b1872[_0xabc4('0xd4')],'VoiceQueueId':_0x3b1872[_0xabc4('0xd6')]||undefined,'CampaignId':_0x3b1872[_0xabc4('0xd7')]||undefined})[_0xabc4('0xae')](loggerCatch(_0xabc4('0x1a9')));break;case 0x13:if(_0x3b1872['countmachineretry']>=_0xb7c260['dialMachineMaxRetry']-0x1){return!![];}this[_0xabc4('0xbe')]({'active':![],'countmachineretry':_0x3b1872[_0xabc4('0xfa')]+=0x1,'scheduledat':moment()[_0xabc4('0x101')](_0xb7c260[_0xabc4('0x102')],_0xabc4('0x11f'))[_0xabc4('0x79')](_0xabc4('0x103')),'ContactId':_0x3b1872[_0xabc4('0xd3')],'ListId':_0x3b1872['ListId'],'VoiceQueueId':_0x3b1872[_0xabc4('0xd6')]||undefined,'CampaignId':_0x3b1872[_0xabc4('0xd7')]||undefined})[_0xabc4('0xae')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x3b1872[_0xabc4('0xfb')]>=_0xb7c260[_0xabc4('0x1aa')]-0x1){return!![];}this[_0xabc4('0xbe')]({'active':![],'countagentrejectretry':_0x3b1872[_0xabc4('0xfb')]+=0x1,'scheduledat':moment()['add'](_0xb7c260[_0xabc4('0x1ab')],_0xabc4('0x11f'))['format'](_0xabc4('0x103')),'ContactId':_0x3b1872['ContactId'],'ListId':_0x3b1872[_0xabc4('0xd4')],'VoiceQueueId':_0x3b1872['VoiceQueueId']||undefined,'CampaignId':_0x3b1872[_0xabc4('0xd7')]||undefined})[_0xabc4('0xae')](loggerCatch(_0xabc4('0x1ac')));break;default:return!![];}};Dialer['prototype'][_0xabc4('0x19c')]=function(_0x54a95f,_0x5c6963,_0x399c1c){var _0x491963=this;var _0x4b7ec0=new History(_0x54a95f);return new BPromise(function(_0x49f61b,_0x19c1dd){if(_['isUndefined'](_0x5c6963)&&typeof _0x5c6963!==_0xabc4('0x171')){return _0x19c1dd(msgResponse(_0xabc4('0x1ad'),_0xabc4('0x149'),_0xabc4('0x1ae')));}if(_[_0xabc4('0x8d')](_0x399c1c)&&typeof _0x399c1c!=='object'){return _0x19c1dd(msgResponse('[callProgressDetecting]',_0xabc4('0x149'),_0xabc4('0x1af')));}switch(_0x399c1c[_0xabc4('0x10e')]){case'0':_0x5c6963['outboundNoSuchCallsDay']+=0x1;_0x4b7ec0[_0xabc4('0xef')]=0x0;_0x4b7ec0['statedesc']='NoSuchNumber';_0x4b7ec0[_0xabc4('0xf7')]+=0x1;_0x4b7ec0[_0xabc4('0xf1')]+=0x1;ami[_0xabc4('0x48')](_0xabc4('0x1b0'),ut[_0xabc4('0xf2')](_0x54a95f,_0xabc4('0x1b1')));_0x491963['createHistory'](_0x4b7ec0)[_0xabc4('0xae')](loggerCatch(_0xabc4('0xf3')));if(_0x491963[_0xabc4('0x19e')](0x0,_0x54a95f,_0x5c6963)){if(_0x4b7ec0[_0xabc4('0xf7')]>=_0x5c6963['dialNoSuchNumberMaxRetry']){_0x491963[_0xabc4('0x106')](_0x4b7ec0,_0x49f61b,_0x19c1dd,_0xabc4('0x1b2'));}else{_0x491963[_0xabc4('0xfd')](_0x4b7ec0,_0x49f61b,_0x19c1dd,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x5c6963[_0xabc4('0x60')]+=0x1;_0x4b7ec0[_0xabc4('0xef')]=0x3;_0x4b7ec0[_0xabc4('0xa4')]=_0xabc4('0x1b3');_0x4b7ec0['countnoanswerretry']+=0x1;_0x4b7ec0[_0xabc4('0xf1')]+=0x1;ami[_0xabc4('0x48')](_0xabc4('0x1b4'),ut['buildObj'](_0x54a95f,'noanswer'));_0x491963[_0xabc4('0xcb')](_0x4b7ec0)[_0xabc4('0xae')](loggerCatch(_0xabc4('0x1b5')));if(_0x491963[_0xabc4('0x19e')](0x3,_0x54a95f,_0x5c6963)){if(_0x4b7ec0[_0xabc4('0xf6')]>=_0x5c6963['dialNoAnswerMaxRetry']){_0x491963[_0xabc4('0x106')](_0x4b7ec0,_0x49f61b,_0x19c1dd,_0xabc4('0x1b6'));}else{_0x491963[_0xabc4('0xfd')](_0x4b7ec0,_0x49f61b,_0x19c1dd,_0xabc4('0x1b6'));}}break;case'5':_0x5c6963[_0xabc4('0x5b')]+=0x1;_0x4b7ec0[_0xabc4('0xef')]=0x5;_0x4b7ec0[_0xabc4('0xa4')]='Busy';_0x4b7ec0[_0xabc4('0xf4')]+=0x1;_0x4b7ec0[_0xabc4('0xf1')]+=0x1;ami[_0xabc4('0x48')](_0xabc4('0x1b7'),ut['buildObj'](_0x54a95f,_0xabc4('0x1b8')));_0x491963['createHistory'](_0x4b7ec0)[_0xabc4('0xae')](loggerCatch(_0xabc4('0x1b9')));if(_0x491963[_0xabc4('0x19e')](0x5,_0x54a95f,_0x5c6963)){if(_0x4b7ec0[_0xabc4('0xf4')]>=_0x5c6963['dialBusyMaxRetry']){_0x491963[_0xabc4('0x106')](_0x4b7ec0,_0x49f61b,_0x19c1dd,_0xabc4('0x1ba'));}else{_0x491963[_0xabc4('0xfd')](_0x4b7ec0,_0x49f61b,_0x19c1dd,'reason\x205\x20busy');}}break;case'8':_0x5c6963[_0xabc4('0x5c')]+=0x1;_0x4b7ec0[_0xabc4('0xef')]=0x8;_0x4b7ec0[_0xabc4('0xa4')]='Congestion';_0x4b7ec0['countcongestionretry']+=0x1;_0x4b7ec0[_0xabc4('0xf1')]+=0x1;ami[_0xabc4('0x48')]('custom:agentcongestion',ut[_0xabc4('0xf2')](_0x54a95f,_0xabc4('0x1bb')));_0x491963[_0xabc4('0xcb')](_0x4b7ec0)[_0xabc4('0xae')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x491963[_0xabc4('0x19e')](0x8,_0x54a95f,_0x5c6963)){if(_0x4b7ec0[_0xabc4('0xf5')]>=_0x5c6963[_0xabc4('0x1a4')]){_0x491963[_0xabc4('0x106')](_0x4b7ec0,_0x49f61b,_0x19c1dd,'reason\x208\x20congestion');}else{_0x491963['stateGlobal'](_0x4b7ec0,_0x49f61b,_0x19c1dd,_0xabc4('0x1bc'));}}break;case'11':_0x5c6963[_0xabc4('0x1bd')]+=0x1;_0x4b7ec0[_0xabc4('0xef')]=0xb;_0x4b7ec0[_0xabc4('0xa4')]='Abandoned';_0x4b7ec0['countabandonedretry']+=0x1;_0x4b7ec0['countglobal']+=0x1;_0x491963[_0xabc4('0xcb')](_0x4b7ec0)[_0xabc4('0xae')](loggerCatch(_0xabc4('0x1be')));if(_0x491963[_0xabc4('0x19e')](0xb,_0x54a95f,_0x5c6963)){if(_0x4b7ec0[_0xabc4('0xf9')]>=_0x5c6963[_0xabc4('0x127')]){_0x491963[_0xabc4('0x106')](_0x4b7ec0,_0x49f61b,_0x19c1dd,_0xabc4('0x1bf'));}else{_0x491963[_0xabc4('0xfd')](_0x4b7ec0,_0x49f61b,_0x19c1dd,'reason\x2011\x20abandoned');}}break;case'20':_0x5c6963[_0xabc4('0x1c0')]+=0x1;_0x4b7ec0[_0xabc4('0xef')]=0x14;_0x4b7ec0[_0xabc4('0xa4')]='AgentReject';_0x4b7ec0[_0xabc4('0xfb')]+=0x1;_0x4b7ec0['countglobal']+=0x1;ami[_0xabc4('0x48')](_0xabc4('0x1c1'),ut['buildObj'](_0x54a95f,_0xabc4('0x1c2')));_0x491963[_0xabc4('0xcb')](_0x4b7ec0)[_0xabc4('0xae')](loggerCatch(_0xabc4('0x1c3')));if(_0x491963[_0xabc4('0x19e')](0x14,_0x54a95f,_0x5c6963)){if(_0x4b7ec0[_0xabc4('0xfb')]>=_0x5c6963[_0xabc4('0x1aa')]){_0x491963[_0xabc4('0x106')](_0x4b7ec0,_0x49f61b,_0x19c1dd,_0xabc4('0x1c4'));}else{_0x491963[_0xabc4('0xfd')](_0x4b7ec0,_0x49f61b,_0x19c1dd,_0xabc4('0x1c4'));}}break;default:_0x5c6963[_0xabc4('0x64')]+=0x1;_0x4b7ec0[_0xabc4('0xef')]=0xc;_0x4b7ec0[_0xabc4('0xa4')]=_0x399c1c[_0xabc4('0x10e')];_0x491963['createHistory'](_0x4b7ec0)[_0xabc4('0xae')](loggerCatch(_0xabc4('0x1c5')));if(_0x491963[_0xabc4('0x19e')](_0x399c1c[_0xabc4('0x10e')],_0x54a95f,_0x5c6963)){if(_0x4b7ec0[_0xabc4('0xf4')]+_0x4b7ec0[_0xabc4('0xf5')]+_0x4b7ec0['countnoanswerretry']+_0x4b7ec0[_0xabc4('0xf7')]+_0x4b7ec0[_0xabc4('0xf8')]+_0x4b7ec0['countabandonedretry']+_0x4b7ec0[_0xabc4('0xfa')]+_0x4b7ec0[_0xabc4('0xfb')]>=_0x5c6963[_0xabc4('0xfc')]){_0x491963['stateGlobal'](_0x4b7ec0,_0x49f61b,_0x19c1dd,_0x399c1c[_0xabc4('0x10e')]);}else{_0x491963[_0xabc4('0x106')](_0x4b7ec0,_0x49f61b,_0x19c1dd,_0x399c1c[_0xabc4('0x10e')]);}}}});};Dialer['prototype'][_0xabc4('0xfd')]=function(_0x8afe3c,_0x126774,_0x328dda,_0xb28892){var _0xcb3597=new Final(_0x8afe3c);_0xcb3597['state']=0xf;_0xcb3597[_0xabc4('0xa4')]='Global';this[_0xabc4('0x106')](_0xcb3597,_0x126774,_0x328dda,_0xb28892);};Dialer[_0xabc4('0xa6')][_0xabc4('0x106')]=function(_0x12a7a8,_0x4ab429,_0x4b4c78,_0x2d770b){this[_0xabc4('0xc9')](_0x12a7a8)['then'](function(){return _0x4ab429(msgResponse(_0xabc4('0x1ad'),_0xabc4('0xdb'),_0x2d770b));})[_0xabc4('0xae')](function(){return _0x4b4c78(msgResponse(_0xabc4('0x1c6'),_0xabc4('0x149'),_0xabc4('0x1c7')));});};Dialer[_0xabc4('0xa6')][_0xabc4('0x7')]=function(_0x5cfbe3){var _0x138a00=_0x5cfbe3['dialPredictiveOptimizationPercentage']/0x64;var _0x444a3b=_0x5cfbe3[_0xabc4('0x5f')]/(_0x5cfbe3[_0xabc4('0x5f')]+_0x5cfbe3[_0xabc4('0x59')]);var _0x374d99=Math[_0xabc4('0x1c8')](_0x5cfbe3[_0xabc4('0x6e')]*(_0x5cfbe3[_0xabc4('0x1c9')]/0x64));var _0x178e83=Math[_0xabc4('0x1c8')](_0x5cfbe3['predictiveIntervalAvailable']*(_0x5cfbe3[_0xabc4('0x1ca')]/0x64));var _0x5ed71a=_0x5cfbe3[_0xabc4('0x4c')]+_0x5cfbe3[_0xabc4('0x50')];var _0xcb20f4=Math['floor'](_0x5cfbe3[_0xabc4('0x71')]*_0x5cfbe3[_0xabc4('0x73')]*_0x5cfbe3[_0xabc4('0x6b')]*_0x5cfbe3['predictiveIntervalMultiplicativeFactor']);if(_['isUndefined'](_0x5cfbe3[_0xabc4('0x27')])){if(!_[_0xabc4('0x8d')](_0x5cfbe3[_0xabc4('0x74')])){_0x5cfbe3[_0xabc4('0x74')]=undefined;loggerPredictive['error']('[startMethodPredictive][StartProgressive]',_0xabc4('0x1cb'));}if(!_[_0xabc4('0x8d')](_0x5cfbe3[_0xabc4('0x90')])){loggerPredictive[_0xabc4('0x93')](_0xabc4('0x1cc'),_0xabc4('0x1cd'));clearInterval(_0x5cfbe3['handlePredictive']);_0x5cfbe3[_0xabc4('0x90')]=undefined;}_0x5cfbe3[_0xabc4('0x27')]=moment()['format'](_0xabc4('0x103'));loggerPredictive[_0xabc4('0x7d')](_0x5cfbe3[_0xabc4('0x3e')],_0xabc4('0x1ce'),_0x5cfbe3['startProgressive']);this['handlePower'](_0x5cfbe3,0x1);}else if(ifInterval(_0x5cfbe3[_0xabc4('0x1cf')],_0x5cfbe3[_0xabc4('0x27')])){this['handlePower'](_0x5cfbe3,0x1);loggerPredictiveCalls[_0xabc4('0x7d')](_0xabc4('0x1d0'),_0x5cfbe3['startProgressive'],_0x5cfbe3[_0xabc4('0x3e')]);_0x5cfbe3[_0xabc4('0x71')]=0x0;_0x5cfbe3[_0xabc4('0x6a')]=0x0;}else if(_0x138a00<_0x444a3b&&_0x5cfbe3[_0xabc4('0x1d1')]===_0xabc4('0x1d2')){freeVariablesPredictive(_0x5cfbe3);loggerPredictive[_0xabc4('0x7d')](_0xabc4('0x1d3'),_0xabc4('0x1d4'),_0x444a3b,_0xabc4('0x27'),_0x5cfbe3[_0xabc4('0x3e')]);}else if(_0xcb20f4<_0x5cfbe3[_0xabc4('0x6a')]&&_0x5cfbe3[_0xabc4('0x1d1')]===_0xabc4('0x1d2')){freeVariablesPredictive(_0x5cfbe3);loggerPredictive[_0xabc4('0x7d')](_0xabc4('0x1d5'),'Max\x20Drop\x20',_0xcb20f4,_0xabc4('0x1d6'),_0x5cfbe3[_0xabc4('0x6a')],_0xabc4('0x27'),_0x5cfbe3['name']);}else if(!ifInterval(_0x5cfbe3[_0xabc4('0x1cf')],_0x5cfbe3[_0xabc4('0x27')])&&_[_0xabc4('0x8d')](_0x5cfbe3[_0xabc4('0x74')])&&!_['isUndefined'](_0x5cfbe3['startProgressive'])){_0x5cfbe3['startPredictive']=moment()['format'](_0xabc4('0x103'));loggerPredictive[_0xabc4('0x7d')](_0x5cfbe3[_0xabc4('0x3e')],_0xabc4('0x1d7'),_0x5cfbe3[_0xabc4('0x74')]);this[_0xabc4('0xbc')](_0x5cfbe3[_0xabc4('0x1cf')])[_0xabc4('0xb6')](this['getDataPredictive'](_0x5cfbe3))['then'](mergeDataErlangB(_0x5cfbe3))['then'](this[_0xabc4('0x1d8')](_0x5cfbe3))[_0xabc4('0xae')](loggerCatchPredictive(_0xabc4('0x1d9'),_0x5cfbe3));}else if(!ifInterval(_0x5cfbe3[_0xabc4('0x1cf')],_0x5cfbe3['startPredictive'])){_0x5cfbe3[_0xabc4('0x6a')]=0x0;_0x5cfbe3['startPredictive']=moment()[_0xabc4('0x79')](_0xabc4('0x103'));loggerPredictive['info'](_0x5cfbe3[_0xabc4('0x3e')],_0xabc4('0x1da'),_0x5cfbe3['startPredictive']);clearInterval(_0x5cfbe3[_0xabc4('0x90')]);_0x5cfbe3['handlePredictive']=undefined;this['averageHandleTime'](_0x5cfbe3[_0xabc4('0x1cf')])['then'](this[_0xabc4('0x1db')](_0x5cfbe3))[_0xabc4('0xb6')](mergeDataErlangB(_0x5cfbe3))[_0xabc4('0xb6')](this[_0xabc4('0x1d8')](_0x5cfbe3))[_0xabc4('0xae')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x5cfbe3));}else if(_0x5cfbe3[_0xabc4('0x6e')]&&_0x5ed71a<_0x5cfbe3['predictiveIntervalAvailable']-_0x178e83){freeVariablesPredictive(_0x5cfbe3);loggerPredictive['info'](_0x5cfbe3[_0xabc4('0x3e')],_0xabc4('0x1dc'),_0x5ed71a,')\x20are\x20less\x20than\x20threshold\x20(',_0x5cfbe3[_0xabc4('0x6e')],'-',_0x178e83,'=',_0x5cfbe3['predictiveIntervalAvailable']-_0x178e83,')');}else if(_0x5cfbe3[_0xabc4('0x6e')]&&_0x5ed71a>_0x5cfbe3[_0xabc4('0x6e')]+_0x374d99){freeVariablesPredictive(_0x5cfbe3);loggerPredictive[_0xabc4('0x7d')](_0x5cfbe3[_0xabc4('0x3e')],_0xabc4('0x1dc'),_0x5ed71a,_0xabc4('0x1dd'),_0x5cfbe3['predictiveIntervalAvailable'],'+',_0x374d99,'=',_0x5cfbe3[_0xabc4('0x6e')]+_0x374d99,')');}};Dialer[_0xabc4('0xa6')][_0xabc4('0x1db')]=function(_0x37e226){var _0x1cfa34=this;return function(_0xe10387){return new BPromise(function(_0x7ae980,_0x58a72c){_[_0xabc4('0x8c')](_0x37e226,_0xe10387[0x0]);if(checkGetDataPredictive(_0xe10387[0x0])){var _0x50d252=_0x37e226['predictiveIntervalAvailable']=_0x37e226[_0xabc4('0x50')]+_0x37e226[_0xabc4('0x4c')];var _0x5e4c1d=_0x37e226[_0xabc4('0x1cf')]*0x3c;var _0x36763c=_0xe10387[0x0][_0xabc4('0x67')]+_0xe10387[0x0][_0xabc4('0x66')];var _0x4cbfd5=(_0xe10387[0x0][_0xabc4('0x65')]+_0xe10387[0x0]['predictiveIntervalDroppedCallsTimeout']+_0xe10387[0x0][_0xabc4('0x68')])/_0xe10387[0x0][_0xabc4('0x6f')];_0x37e226[_0xabc4('0x6b')]=_0x4cbfd5>0x0?_0x4cbfd5:0x1;switch(_0x37e226[_0xabc4('0x1d1')]){case'dropRate':var _0xd99cc0=_0x37e226['dialPredictiveOptimizationPercentage']/0x64;return _0x1cfa34[_0xabc4('0x1de')](_0x50d252,_0x5e4c1d,_0x36763c,_0x4cbfd5,_0xd99cc0)[_0xabc4('0xb6')](function(_0x4ac036){return _0x7ae980(_0x4ac036);});case _0xabc4('0x1df'):var _0x1e303b=_0x37e226[_0xabc4('0x1e0')]/0x64;return _0x1cfa34[_0xabc4('0x1e1')](_0x50d252,_0x5e4c1d,_0x36763c,_0x4cbfd5,_0x1e303b)[_0xabc4('0xb6')](function(_0x1a0659){return _0x7ae980(_0x1a0659);});default:return _0x58a72c(msgResponse(_0xabc4('0x1e2'),_0xabc4('0x149'),_0xabc4('0x1e3')));}}else{return _0x58a72c(msgResponse(_0xabc4('0x1e2'),_0xabc4('0x149'),_0xabc4('0x1e4')));}});};};Dialer[_0xabc4('0xa6')][_0xabc4('0x1e5')]=function(_0x65710a){var _0x202cd6=this;return function(_0x4e97bd){return new BPromise(function(_0x22bc53,_0x19e250){_[_0xabc4('0x8c')](_0x65710a,_0x4e97bd[0x0]);if(checkGetDataPredictive(_0x4e97bd[0x0])){loggerPredictive['info'](JSON[_0xabc4('0x44')](_0x4e97bd[0x0]));if(_0x65710a[_0xabc4('0x1d1')]==='dropRate'){return _0x202cd6[_0xabc4('0xc7')](_0x65710a['id'])['then'](function(_0x5ae08e){var _0x164a32=_0x65710a[_0xabc4('0x4d')]-_0x5ae08e[0x0][_0xabc4('0x1e6')];var _0x1875ea=_0x65710a['dialPredictiveInterval']*0x3c;var _0x592447=_0x4e97bd[0x0][_0xabc4('0x67')]+_0x4e97bd[0x0][_0xabc4('0x66')];var _0x29d98f=(_0x4e97bd[0x0][_0xabc4('0x65')]+_0x4e97bd[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x4e97bd[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x4e97bd[0x0]['predictiveIntervalTotalCalls'];var _0xce637c=_0x65710a[_0xabc4('0x1e0')]/0x64;_0x65710a[_0xabc4('0x6d')]=_0x5ae08e[0x0]['outboundQueuePauses']||0x0;_0x65710a[_0xabc4('0x6b')]=_0x29d98f>0x0?_0x29d98f:0x1;return _0x202cd6[_0xabc4('0x1de')](_0x164a32,_0x1875ea,_0x592447,_0x29d98f,_0xce637c);})['then'](function(_0x410f75){return _0x22bc53(_0x410f75);})[_0xabc4('0xae')](function(_0x4822e1){return _0x19e250(msgResponse(_0xabc4('0x1e7'),'Failure',JSON['stringify'](_0x4822e1)));});}if(_0x65710a[_0xabc4('0x1d1')]===_0xabc4('0x1df')){return _0x202cd6['getVoiceQueueRtPauses'](_0x65710a['id'])[_0xabc4('0xb6')](function(_0x4331a1){var _0x5a65e5=_0x65710a[_0xabc4('0x4d')]-_0x4331a1[0x0][_0xabc4('0x1e6')];var _0x1e555e=_0x65710a[_0xabc4('0x1cf')]*0x3c;var _0x35de70=_0x4e97bd[0x0]['predictiveIntervalAvgTalktime']+_0x4e97bd[0x0][_0xabc4('0x66')];var _0x168a10=(_0x4e97bd[0x0][_0xabc4('0x65')]+_0x4e97bd[0x0][_0xabc4('0x1e8')]+_0x4e97bd[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x4e97bd[0x0][_0xabc4('0x6f')];var _0x367b36=_0x65710a[_0xabc4('0x1e0')]/0x64;_0x65710a[_0xabc4('0x6d')]=_0x4331a1[0x0][_0xabc4('0x1e6')]||0x0;_0x65710a[_0xabc4('0x6b')]=_0x168a10>0x0?_0x168a10:0x1;return _0x202cd6[_0xabc4('0x1e1')](_0x5a65e5,_0x1e555e,_0x35de70,_0x168a10,_0x367b36);})[_0xabc4('0xb6')](function(_0x56f8e2){return _0x22bc53(_0x56f8e2);})[_0xabc4('0xae')](function(_0x29bb2f){return _0x19e250(msgResponse(_0xabc4('0x1e7'),'Failure',JSON['stringify'](_0x29bb2f)));});}}else{return _0x19e250(msgResponse('[getDataPredictive]',_0xabc4('0x149'),_0xabc4('0x1e4')));}});};};Dialer['prototype']['startMethodPredictive']=function(_0x23073c){var _0x391edd=this;return function(){var _0x2e3443=0x0;var _0x2143df=Math[_0xabc4('0x1e9')](_0x23073c[_0xabc4('0x72')]*0x3e8);if(_0x2143df>0x0){_0x2143df=_0x2143df<0x64?0x64:_0x2143df;loggerPredictive['info'](_0x23073c[_0xabc4('0x3e')],_0xabc4('0x1ea'),_0x2143df,_0xabc4('0x45'));_0x23073c['handlePredictive']=setInterval(function(){_0x391edd['handlePredictive'](_0x23073c);loggerPredictiveCalls[_0xabc4('0x7d')](_0xabc4('0x1eb'),_0x2e3443+=0x1);},_0x2143df);}else{loggerPredictive[_0xabc4('0x7d')](_0x23073c[_0xabc4('0x3e')],_0xabc4('0x1ec'));}};};Dialer[_0xabc4('0xa6')]['checkContactBlack']=function(_0x531e07,_0x1bb3f3){var _0x41571d=this;return function(_0x17d215){if(_[_0xabc4('0x43')](_0x17d215)){if(_['isNil'](_0x1bb3f3['UserId'])||!_0x1bb3f3[_0xabc4('0x1ed')]){if(_0x531e07[_0xabc4('0x54')]==='booked'){_0x531e07[_0xabc4('0x131')]=_[_0xabc4('0x8d')](_0x531e07['queueStatusComplete'])?!![]:_0x531e07[_0xabc4('0x131')];var _0x36d3b1=uuid['v4']();_0x41571d[_0xabc4('0x24')][_0x36d3b1]=new Action(_0x531e07,_0x1bb3f3,_0x36d3b1);loggerBooked['info'](_0xabc4('0x1ee'),_0x36d3b1,_0xabc4('0x1ef'),JSON[_0xabc4('0x44')](_0x531e07[_0xabc4('0x131')]),_0xabc4('0x1f0'),_0x531e07['name']);if(_0x531e07['queueStatusComplete']){_0x531e07[_0xabc4('0x131')]=![];_0x41571d[_0xabc4('0x29')][_0x41571d['actions'][_0x36d3b1][_0xabc4('0xb0')]]=[];ami['Action']({'actionid':_0x36d3b1,'action':_0xabc4('0x1f1'),'queue':_0x531e07[_0xabc4('0x3e')]})[_0xabc4('0xae')](function(){_0x41571d[_0xabc4('0xb2')](_0x531e07);_0x41571d['rescheduleContact']({'active':![],'ContactId':_0x41571d[_0xabc4('0x24')][_0x36d3b1]['ContactId'],'ListId':_0x41571d[_0xabc4('0x24')][_0x36d3b1][_0xabc4('0xd4')],'VoiceQueueId':_0x41571d[_0xabc4('0x24')][_0x36d3b1]['VoiceQueueId']||undefined,'CampaignId':_0x41571d[_0xabc4('0x24')][_0x36d3b1][_0xabc4('0xd7')]||undefined})['catch'](loggerCatch(_0xabc4('0x1f2')));delete _0x41571d[_0xabc4('0x24')][_0x36d3b1];});}else{loggerBooked[_0xabc4('0x7d')](_0xabc4('0x1f3'),JSON[_0xabc4('0x44')](_0x531e07[_0xabc4('0x131')]),_0xabc4('0x1f0'),_0x531e07[_0xabc4('0x3e')]);_0x41571d['updateOriginated'](_0x531e07);_0x41571d[_0xabc4('0xbe')]({'active':![],'ContactId':_0x41571d['actions'][_0x36d3b1][_0xabc4('0xd3')],'ListId':_0x41571d[_0xabc4('0x24')][_0x36d3b1][_0xabc4('0xd4')],'VoiceQueueId':_0x41571d['actions'][_0x36d3b1][_0xabc4('0xd6')]||undefined,'CampaignId':_0x41571d[_0xabc4('0x24')][_0x36d3b1][_0xabc4('0xd7')]||undefined})[_0xabc4('0xae')](loggerCatch(_0xabc4('0x1f2')));delete _0x41571d['actions'][_0x36d3b1];}}else{return _0x41571d[_0xabc4('0x170')](_0x531e07,_0x1bb3f3);}}else{if(getDiff(_0x1bb3f3['scheduledat'])<_0x531e07['dialRecallMeTimeout']*0x3c){if(_0x1bb3f3['Agent']&&!_0x1bb3f3[_0xabc4('0x1f4')][_0xabc4('0x1f5')]){_0x41571d[_0xabc4('0x1f')][_0xabc4('0x134')](_0x1bb3f3['id'])[_0xabc4('0x137')](function(){_0x41571d['updateOriginated'](_0x531e07);});}else{_0x41571d[_0xabc4('0xc0')]({'active':![]},_0x1bb3f3['id'],0x1)[_0xabc4('0x137')](function(){_0x41571d[_0xabc4('0xb2')](_0x531e07);});}}else{_0x531e07[_0xabc4('0x63')]+=0x1;_0x41571d[_0xabc4('0xb2')](_0x531e07);if(_0x531e07[_0xabc4('0x1f6')]){_0x41571d['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x1bb3f3[_0xabc4('0xd3')],'ListId':_0x1bb3f3[_0xabc4('0xd4')],'VoiceQueueId':_0x1bb3f3[_0xabc4('0xd6')]||undefined,'CampaignId':_0x1bb3f3[_0xabc4('0xd7')]||undefined})['catch'](loggerCatch(_0xabc4('0x1f7')));_0x41571d['createHistory'](createObjHistory(_0x531e07,_0x1bb3f3,_0xabc4('0x1f8'),0x17,_0xabc4('0x1f9')))['catch'](loggerCatch(_0xabc4('0x1fa')));}else{_0x41571d['saveInDb'](createObjHistory(_0x531e07,_0x1bb3f3,_0xabc4('0x1fb'),0x16,'RecallFailedTimeout'),_0xabc4('0x1fc'),'[Originate][HistoryRecallClose]');}}}}else{_0x531e07['outboundBlacklistCallsDay']+=0x1;_0x41571d[_0xabc4('0xd1')](createObjHistory(_0x531e07,_0x1bb3f3,_0xabc4('0x1fd'),0xd,_0xabc4('0x1fe')),_0xabc4('0x1ff'),_0xabc4('0x200'));throw _0xabc4('0x201');}};};Dialer[_0xabc4('0xa6')][_0xabc4('0x165')]=function(_0x253452){var _0x71926d=this;var _0x4dc103=_0x253452['limitCalls']-_0x253452[_0xabc4('0x70')]-_0x253452['temp'];emitCampaignSummary(_0x253452);if(_0x4dc103>0x0){if(_0x4dc103>this['maxNumberOriginate']){_0x4dc103=this[_0xabc4('0x23')];}_0x253452[_0xabc4('0xc3')]+=_0x4dc103;this[_0xabc4('0xc5')](_0x253452['id'],_0x4dc103,_0x253452['dialOrderByScheduledAt'],_0x253452)[_0xabc4('0xb6')](function(_0xac59cf){_0x253452['temp']-=_0x4dc103;_0x253452['temp']=_0x253452['temp']>0x0?_0x253452[_0xabc4('0xc3')]:0x0;if(!checkContactEmpty(_0xac59cf)){_0x253452['message']='AVAILABLE_CONTACTS_FINISHED';logger[_0xabc4('0x7d')](_0xabc4('0x202')+_0x253452['name']);}else{_0x253452['originated']+=_0xac59cf[_0xabc4('0x95')];_0x253452[_0xabc4('0x3a')]='RUNNING';for(var _0x5b6de1=0x0;_0x5b6de1<_0xac59cf[_0xabc4('0x95')];_0x5b6de1+=0x1){_0x253452[_0xabc4('0x203')]+=0x1;if(_[_0xabc4('0xab')](_0xac59cf[_0x5b6de1])||_['isNil'](_0xac59cf[_0x5b6de1][_0xabc4('0x173')])||_[_0xabc4('0xab')](_0xac59cf[_0x5b6de1][_0xabc4('0x173')][_0xabc4('0x174')])){_0x71926d['emptyContact'](_0xabc4('0x204'),_0x253452,_0xac59cf[_0x5b6de1]);}else{_0x71926d[_0xabc4('0xba')](_[_0xabc4('0xd2')](_0xac59cf[_0x5b6de1],[_0xabc4('0xd7'),_0xabc4('0x205')]))[_0xabc4('0xb6')](_0x71926d[_0xabc4('0x206')](_0x253452,_0xac59cf[_0x5b6de1]))['catch'](_0x71926d[_0xabc4('0xcf')](_0xabc4('0x207'),_0x253452));}}}})['catch'](loggerGetContactDialer(_0xabc4('0x208'),_0x253452,_0x4dc103));}};Dialer['prototype']['handlePower']=function(_0xc0662f,_0x9af4df){var _0x2c18c7=this;var _0x32d0da=[];var _0x225b02=_0x9af4df>=0x1?_0x9af4df:0x1;if(_0xc0662f['dialMethod']==='booked'){_0x225b02=0x1;}var _0x21786b=Math['floor'](_0xc0662f[_0xabc4('0x4c')]*_0x225b02)-_0xc0662f[_0xabc4('0x70')]-_0xc0662f[_0xabc4('0xc3')];emitVoiceQueueSummary(_0xc0662f);if(_0xc0662f['dialLimitQueue']>0x0){var _0x5f0c67=_0xc0662f[_0xabc4('0x209')]-_0xc0662f[_0xabc4('0x70')]-_0xc0662f[_0xabc4('0x50')]-_0xc0662f[_0xabc4('0xc3')]-_0xc0662f[_0xabc4('0x4e')];if(_0x21786b>_0x5f0c67){_0x21786b=_0x5f0c67;}}if(_0x21786b>0x0){if(_0xc0662f[_0xabc4('0x54')]===_0xabc4('0x6')){_0x21786b=0x1;}if(_0x21786b>this[_0xabc4('0x23')]){_0x21786b=this['maxNumberOriginate'];}_0xc0662f[_0xabc4('0xc3')]+=_0x21786b;for(var _0x38a7cc in this[_0xabc4('0x12e')]){if(typeof this[_0xabc4('0x12e')][_0x38a7cc]!==_0xabc4('0x96')){if(this['agents'][_0x38a7cc][_0xabc4('0xef')]==='not_inuse'&&this[_0xabc4('0x12e')][_0x38a7cc]['status']==='reachable'){_0x32d0da['push'](this[_0xabc4('0x12e')][_0x38a7cc]['id']);}}}this['getContactDialer'](_0xc0662f['id'],_0x32d0da,_0x21786b,_0xc0662f[_0xabc4('0x20a')],_0xc0662f)['then'](function(_0x16041a){_0xc0662f['temp']-=_0x21786b;_0xc0662f['temp']=_0xc0662f[_0xabc4('0xc3')]>0x0?_0xc0662f[_0xabc4('0xc3')]:0x0;if(!checkContactEmpty(_0x16041a)){_0x2c18c7[_0xabc4('0xb4')](_0xc0662f)['then'](sendMessageReschedule(_0xc0662f))[_0xabc4('0xae')](loggerCatch(_0xabc4('0xb7')));}else{_0xc0662f['originated']+=_0x16041a['length'];_0xc0662f['message']=_0xc0662f['dialMethod']===_0xabc4('0x6')?_0xabc4('0x20b'):_0xabc4('0x20c');for(var _0x4eaa9f=0x0;_0x4eaa9f<_0x16041a['length'];_0x4eaa9f+=0x1){if(_[_0xabc4('0xab')](_0x16041a[_0x4eaa9f])||_[_0xabc4('0xab')](_0x16041a[_0x4eaa9f]['Contact'])||_[_0xabc4('0xab')](_0x16041a[_0x4eaa9f][_0xabc4('0x173')][_0xabc4('0x174')])){_0x2c18c7[_0xabc4('0x20d')](_0xabc4('0x204'),_0xc0662f,_0x16041a[_0x4eaa9f]);}else{_0x2c18c7[_0xabc4('0xb8')](_[_0xabc4('0xd2')](_0x16041a[_0x4eaa9f],[_0xabc4('0xd6'),'Contact.phone']))['then'](_0x2c18c7[_0xabc4('0x206')](_0xc0662f,_0x16041a[_0x4eaa9f]))[_0xabc4('0xae')](_0x2c18c7[_0xabc4('0xcf')](_0xabc4('0x204'),_0xc0662f));}}}})[_0xabc4('0xae')](loggerGetContactDialer(_0xabc4('0x20e'),_0xc0662f,_0x21786b));}};Dialer['prototype'][_0xabc4('0x90')]=function(_0x12b494){if(_0x12b494['dialLimitQueue']>0x0){var _0x21ced9=_0x12b494[_0xabc4('0x209')]-_0x12b494[_0xabc4('0x70')]-_0x12b494[_0xabc4('0x50')];if(_0x21ced9>0x0){this['tryOriginatePredictive'](_0x12b494);}else{loggerPredictiveCalls[_0xabc4('0x7d')](_0xabc4('0x20f'));}}else{this[_0xabc4('0x210')](_0x12b494);}};Dialer['prototype'][_0xabc4('0x210')]=function(_0x2cda63){var _0x20ae22=this;var _0x14e88e=[];_0x2cda63[_0xabc4('0x70')]+=0x1;for(var _0x4f2622 in this[_0xabc4('0x12e')]){if(typeof this[_0xabc4('0x12e')][_0x4f2622]!==_0xabc4('0x96')){if(this[_0xabc4('0x12e')][_0x4f2622][_0xabc4('0xef')]==='not_inuse'&&this[_0xabc4('0x12e')][_0x4f2622][_0xabc4('0xde')]===_0xabc4('0x211')){_0x14e88e[_0xabc4('0x151')](this[_0xabc4('0x12e')][_0x4f2622]['id']);}}}this[_0xabc4('0xc2')](_0x2cda63['id'],_0x14e88e,0x1,_0x2cda63['dialOrderByScheduledAt'],_0x2cda63)[_0xabc4('0xb6')](function(_0x5967cc){if(!checkContactEmpty(_0x5967cc)){checkContactLowerLimitOriginate(_0x2cda63,0x1,0x0);_0x20ae22[_0xabc4('0xb4')](_0x2cda63)[_0xabc4('0xb6')](sendMessageReschedule(_0x2cda63))[_0xabc4('0xae')](loggerCatch(_0xabc4('0xb7')));}else{_0x2cda63[_0xabc4('0x3a')]=_0xabc4('0x20c');if(_['isNil'](_0x5967cc[0x0])||_[_0xabc4('0xab')](_0x5967cc[0x0]['Contact'])||_[_0xabc4('0xab')](_0x5967cc[0x0][_0xabc4('0x173')][_0xabc4('0x174')])){_0x20ae22[_0xabc4('0x20d')](_0xabc4('0x204'),_0x2cda63,_0x5967cc[0x0]);}else{_0x20ae22['checkIsBlackList'](_[_0xabc4('0xd2')](_0x5967cc[0x0],[_0xabc4('0xd6'),_0xabc4('0x205')]))[_0xabc4('0xb6')](_0x20ae22['checkContactBlack'](_0x2cda63,_0x5967cc[0x0]))[_0xabc4('0xae')](_0x20ae22['loggerHandler'](_0xabc4('0x212'),_0x2cda63));}}})[_0xabc4('0xae')](loggerGetContactDialer('[getContactDialerPredictive]',_0x2cda63,0x1));emitVoiceQueueSummary(_0x2cda63);};Dialer['prototype']['abandonmentRate']=function(_0x3e2673,_0x354b3c,_0x5d5d67,_0x3b7258,_0x447fa5,_0x39f0dd){loggerPredictive[_0xabc4('0x7d')](_0xabc4('0x213'));loggerPredictive[_0xabc4('0x7d')](_0xabc4('0x214'),_0x3e2673);loggerPredictive['info'](_0xabc4('0x215'),_0x354b3c);loggerPredictive[_0xabc4('0x7d')]('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',_0x5d5d67);loggerPredictive[_0xabc4('0x7d')](_0xabc4('0x216'),_0x3b7258);loggerPredictive['info']('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x447fa5);loggerPredictive[_0xabc4('0x7d')](_0xabc4('0x85'));return new BPromise(function(_0x12e7cc,_0x1af40f){if(_0x3e2673<=0x0||isNaN(_0x3e2673)){return _0x1af40f(msgResponse('[abandonmentRate]',_0xabc4('0x217'),_0xabc4('0x218')+_0x3e2673));}if(_0x5d5d67<=0x0||isNaN(_0x5d5d67)){return _0x1af40f(msgResponse(_0xabc4('0x219'),'Error',_0xabc4('0x21a')+_0x5d5d67));}if(_0x3b7258<=0x0||isNaN(_0x3b7258)){return _0x1af40f(msgResponse(_0xabc4('0x219'),_0xabc4('0x217'),_0xabc4('0x21b')+_0x3b7258));}if(_0x354b3c<=0x0||isNaN(_0x354b3c)){return _0x1af40f(msgResponse(_0xabc4('0x219'),_0xabc4('0x217'),_0xabc4('0x21c')+_0x354b3c));}if(_0x447fa5<=0x0||isNaN(_0x447fa5)){return _0x1af40f(msgResponse(_0xabc4('0x219'),_0xabc4('0x217'),_0xabc4('0x21d')+_0x447fa5));}_0x39f0dd=_0x39f0dd||0x0;var _0x12acf8=0x1/_0x5d5d67;var _0x422554=0x0;var _0x90972d=0x0;var _0x51aa29=0x0;var _0x400422=0x0;for(var _0x222323=0x0;_0x51aa29<_0x447fa5;_0x222323+=0x1){_0x90972d=_0x222323/_0x354b3c;_0x422554=(_0x3b7258*_0x90972d+_0x39f0dd)/_0x12acf8;_0x51aa29=erlangb(_0x422554,_0x3e2673);_0x400422=_0x422554/_0x3e2673*(0x1-erlangb(_0x422554,_0x3e2673));}return _0x12e7cc({'erlangCalls':_0x222323,'erlangCallToSecond':_0x354b3c/_0x222323,'erlangAbandonmentRate':_0x51aa29,'erlangBusyFactor':_0x400422});});};Dialer[_0xabc4('0xa6')][_0xabc4('0x1e1')]=function(_0x45b02f,_0x432b16,_0x4aa092,_0x116b3b,_0xbcb0f8,_0x2be36b){loggerPredictive[_0xabc4('0x7d')](_0xabc4('0x21e'));loggerPredictive[_0xabc4('0x7d')]('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',_0x45b02f);loggerPredictive[_0xabc4('0x7d')](_0xabc4('0x215'),_0x432b16);loggerPredictive[_0xabc4('0x7d')]('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',_0x4aa092);loggerPredictive[_0xabc4('0x7d')](_0xabc4('0x216'),_0x116b3b);loggerPredictive[_0xabc4('0x7d')](_0xabc4('0x21f'),_0xbcb0f8);loggerPredictive[_0xabc4('0x7d')](_0xabc4('0x85'));return new BPromise(function(_0x1b81df,_0x170ac8){if(_0x45b02f<=0x0||isNaN(_0x45b02f)){return _0x170ac8(msgResponse(_0xabc4('0x220'),_0xabc4('0x217'),_0xabc4('0x218')+_0x45b02f));}if(_0x4aa092<=0x0||isNaN(_0x4aa092)){return _0x170ac8(msgResponse('[busyFactor]','Error',_0xabc4('0x21a')+_0x4aa092));}if(_0x116b3b<=0x0||isNaN(_0x116b3b)){return _0x170ac8(msgResponse(_0xabc4('0x220'),_0xabc4('0x217'),_0xabc4('0x21b')+_0x116b3b));}if(_0x432b16<=0x0||isNaN(_0x432b16)){return _0x170ac8(msgResponse(_0xabc4('0x220'),'Error',_0xabc4('0x21c')+_0x432b16));}if(_0xbcb0f8<=0x0||isNaN(_0xbcb0f8)){return _0x170ac8(msgResponse(_0xabc4('0x220'),'Error',_0xabc4('0x221')+_0xbcb0f8));}_0x2be36b=_0x2be36b||0x0;var _0x415655=0x1/_0x4aa092;var _0x196260=0x0;var _0x15e93c=0x0;var _0x51f6df=0x0;var _0xfaf0fb=0x0;for(var _0x2fa157=0x0;_0xfaf0fb<_0xbcb0f8;_0x2fa157+=0x1){_0x15e93c=_0x2fa157/_0x432b16;_0x196260=(_0x116b3b*_0x15e93c+_0x2be36b)/_0x415655;_0x51f6df=erlangb(_0x196260,_0x45b02f);_0xfaf0fb=_0x196260/_0x45b02f*(0x1-erlangb(_0x196260,_0x45b02f));}return _0x1b81df({'erlangCalls':_0x2fa157,'erlangCallToSecond':_0x432b16/_0x2fa157,'erlangAbandonmentRate':_0x51f6df,'erlangBusyFactor':_0xfaf0fb});});};module[_0xabc4('0x222')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index bd93835..78ff262 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 _0x3987=['holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','seconds','scheduledat','type','outbound','queue','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','name','number','starttime','responsetime','droptime','endtime','ringtime'];(function(_0x218ca4,_0x41cc40){var _0x1b3ff9=function(_0x5003cd){while(--_0x5003cd){_0x218ca4['push'](_0x218ca4['shift']());}};_0x1b3ff9(++_0x41cc40);}(_0x3987,0x12f));var _0x7398=function(_0x5a9055,_0x48668d){_0x5a9055=_0x5a9055-0x0;var _0x24a9ae=_0x3987[_0x5a9055];return _0x24a9ae;};'use strict';var util=require(_0x7398('0x0'));var _=require(_0x7398('0x1'));var moment=require('moment');function getSeconds(_0x40b772,_0x2727f6){var _0x1d7eb9=moment(_0x40b772)[_0x7398('0x2')](0x0);var _0x34c971=moment(_0x2727f6)[_0x7398('0x2')](0x0);return _0x1d7eb9[_0x7398('0x3')](_0x34c971,_0x7398('0x4'));}function QueueCallerAbandon(_0xda5f45,_0x203e5f){this[_0x7398('0x5')]=_0xda5f45[_0x7398('0x5')];this[_0x7398('0x6')]=_0xda5f45[_0x7398('0x6')];this['campaigntype']=_0xda5f45[_0x7398('0x6')]===_0x7398('0x7')?_0x7398('0x8'):_0xda5f45[_0x7398('0x6')];this[_0x7398('0x9')]=_0xda5f45['countbusyretry'];this['countcongestionretry']=_0xda5f45['countcongestionretry'];this[_0x7398('0xa')]=_0xda5f45['countnoanswerretry'];this['countglobal']=_0xda5f45[_0x7398('0x9')]+_0xda5f45['countcongestionretry']+_0xda5f45[_0x7398('0xa')]+_0xda5f45[_0x7398('0xb')]+_0xda5f45[_0x7398('0xc')]+_0xda5f45['countabandonedretry']+_0xda5f45[_0x7398('0xd')]+_0xda5f45[_0x7398('0xe')];this['countnosuchnumberretry']=_0xda5f45[_0x7398('0xb')];this[_0x7398('0xc')]=_0xda5f45[_0x7398('0xc')];this[_0x7398('0xf')]=_0xda5f45[_0x7398('0xf')];this[_0x7398('0xd')]=_0xda5f45['countmachineretry'];this[_0x7398('0xe')]=_0xda5f45[_0x7398('0xe')];this[_0x7398('0x10')]=_0x203e5f[_0x7398('0x10')];this[_0x7398('0x11')]=_0xda5f45[_0x7398('0x12')];this['calleridnum']=_0xda5f45[_0x7398('0x13')];this[_0x7398('0x14')]=_0xda5f45[_0x7398('0x14')];this['responsetime']=_0xda5f45[_0x7398('0x15')];this['droptime']=_0xda5f45[_0x7398('0x16')];this[_0x7398('0x17')]=this['droptime'];this[_0x7398('0x18')]=getSeconds(_0xda5f45[_0x7398('0x15')],_0xda5f45['starttime']);this[_0x7398('0x19')]=getSeconds(this[_0x7398('0x16')],_0xda5f45['responsetime']);this[_0x7398('0x1a')]=0x0;this['queue']=_0x203e5f[_0x7398('0x8')];this[_0x7398('0x1b')]=_0x203e5f['connectedlinename'];this[_0x7398('0x1c')]=_0x203e5f['reason'];this[_0x7398('0x1d')]=_0xda5f45[_0x7398('0x1d')];this[_0x7398('0x1e')]=_0xda5f45[_0x7398('0x1e')];this[_0x7398('0x1f')]=_0xda5f45[_0x7398('0x1f')];this[_0x7398('0x20')]=_0xda5f45[_0x7398('0x20')];this[_0x7398('0x21')]=_0xda5f45[_0x7398('0x21')];this[_0x7398('0x22')]=_0xda5f45[_0x7398('0x22')];this[_0x7398('0x23')]=_0xda5f45[_0x7398('0x23')];this[_0x7398('0x24')]=_0xda5f45['VoiceQueueId'];this[_0x7398('0x25')]=_0xda5f45['CampaignId'];this[_0x7398('0x26')]=_0xda5f45[_0x7398('0x26')]||'';this[_0x7398('0x27')]=_0xda5f45[_0x7398('0x27')]||'';}module[_0x7398('0x28')]=QueueCallerAbandon; \ No newline at end of file +var _0xfbbf=['util','lodash','moment','diff','seconds','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports'];(function(_0x3cca47,_0x4c179e){var _0x3642ee=function(_0x172155){while(--_0x172155){_0x3cca47['push'](_0x3cca47['shift']());}};_0x3642ee(++_0x4c179e);}(_0xfbbf,0x78));var _0xffbb=function(_0x19ef0a,_0x3fdd9a){_0x19ef0a=_0x19ef0a-0x0;var _0x560b7d=_0xfbbf[_0x19ef0a];return _0x560b7d;};'use strict';var util=require(_0xffbb('0x0'));var _=require(_0xffbb('0x1'));var moment=require(_0xffbb('0x2'));function getSeconds(_0x8aed3a,_0x38900c){var _0x5bc719=moment(_0x8aed3a)['milliseconds'](0x0);var _0x4bbf34=moment(_0x38900c)['milliseconds'](0x0);return _0x5bc719[_0xffbb('0x3')](_0x4bbf34,_0xffbb('0x4'));}function QueueCallerAbandon(_0x29c2e9,_0x3f9b73){this['scheduledat']=_0x29c2e9[_0xffbb('0x5')];this[_0xffbb('0x6')]=_0x29c2e9['type'];this['campaigntype']=_0x29c2e9[_0xffbb('0x6')]===_0xffbb('0x7')?_0xffbb('0x8'):_0x29c2e9[_0xffbb('0x6')];this[_0xffbb('0x9')]=_0x29c2e9[_0xffbb('0x9')];this['countcongestionretry']=_0x29c2e9[_0xffbb('0xa')];this['countnoanswerretry']=_0x29c2e9[_0xffbb('0xb')];this[_0xffbb('0xc')]=_0x29c2e9[_0xffbb('0x9')]+_0x29c2e9['countcongestionretry']+_0x29c2e9['countnoanswerretry']+_0x29c2e9[_0xffbb('0xd')]+_0x29c2e9[_0xffbb('0xe')]+_0x29c2e9[_0xffbb('0xf')]+_0x29c2e9['countmachineretry']+_0x29c2e9[_0xffbb('0x10')];this[_0xffbb('0xd')]=_0x29c2e9[_0xffbb('0xd')];this['countdropretry']=_0x29c2e9['countdropretry'];this[_0xffbb('0xf')]=_0x29c2e9[_0xffbb('0xf')];this[_0xffbb('0x11')]=_0x29c2e9[_0xffbb('0x11')];this[_0xffbb('0x10')]=_0x29c2e9['countagentrejectretry'];this['uniqueid']=_0x3f9b73['uniqueid'];this['calleridname']=_0x29c2e9['name'];this['calleridnum']=_0x29c2e9[_0xffbb('0x12')];this[_0xffbb('0x13')]=_0x29c2e9[_0xffbb('0x13')];this[_0xffbb('0x14')]=_0x29c2e9[_0xffbb('0x14')];this[_0xffbb('0x15')]=_0x29c2e9['droptime'];this[_0xffbb('0x16')]=this['droptime'];this[_0xffbb('0x17')]=getSeconds(_0x29c2e9[_0xffbb('0x14')],_0x29c2e9[_0xffbb('0x13')]);this[_0xffbb('0x18')]=getSeconds(this[_0xffbb('0x15')],_0x29c2e9[_0xffbb('0x14')]);this[_0xffbb('0x19')]=0x0;this[_0xffbb('0x8')]=_0x3f9b73[_0xffbb('0x8')];this['membername']=_0x3f9b73[_0xffbb('0x1a')];this[_0xffbb('0x1b')]=_0x3f9b73[_0xffbb('0x1b')];this[_0xffbb('0x1c')]=_0x29c2e9['callback'];this[_0xffbb('0x1d')]=_0x29c2e9[_0xffbb('0x1d')];this[_0xffbb('0x1e')]=_0x29c2e9[_0xffbb('0x1e')];this['recallme']=_0x29c2e9[_0xffbb('0x1f')];this[_0xffbb('0x20')]=_0x29c2e9[_0xffbb('0x20')];this[_0xffbb('0x21')]=_0x29c2e9[_0xffbb('0x21')];this[_0xffbb('0x22')]=_0x29c2e9[_0xffbb('0x22')];this[_0xffbb('0x23')]=_0x29c2e9['VoiceQueueId'];this['CampaignId']=_0x29c2e9[_0xffbb('0x24')];this[_0xffbb('0x25')]=_0x29c2e9[_0xffbb('0x25')]||'';this[_0xffbb('0x26')]=_0x29c2e9[_0xffbb('0x26')]||'';}module[_0xffbb('0x27')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 5d27d9a..f53e80b 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(_0x282574,_0x31c407){var _0x203f66=function(_0x766032){while(--_0x766032){_0x282574['push'](_0x282574['shift']());}};_0x203f66(++_0x31c407);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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(_0x13ff4c,_0x25f86b){var _0x3a119d=function(_0x213cb9){while(--_0x213cb9){_0x13ff4c['push'](_0x13ff4c['shift']());}};_0x3a119d(++_0x25f86b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'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 a448acb..0da9594 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 _0xa92c=['uniqueid','channel','name','info','\x20syncNewchannel\x20','actions','variable','hasOwnProperty','channelstate','channelstatedesc','value','operation','status','localstationid','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','notify','calleridnum','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response','reason','update','AttachmentId','SENDING\x20FAILED\x20','then','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','SENDING\x20FAILED:\x20','faxstatusstring','FaxAccountId','[Fax][execOriginate][success]','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','dir','XMF-PATH','Action','variablesAction','execOriginate','addVariables','ext','isTrunkReachable','isNil','active','trunks','SIP/%s','reachable','[Fax][checkTrunk][Trunk\x20not\x20work]','Trunk\x20not\x20working','fax','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','util','lodash','bluebird','uuid','moment','path','tiff2pdf','../ami','./rpcDb','./channel','./util/util','./action','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','newchannel','syncNewchannel','syncVarSet','bind','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','syncReceiveFax','syncHangup','originateresponse','syncOriginateResponse','prototype','context'];(function(_0xd8d5df,_0x59182a){var _0x37f5c9=function(_0x666485){while(--_0x666485){_0xd8d5df['push'](_0xd8d5df['shift']());}};_0x37f5c9(++_0x59182a);}(_0xa92c,0x143));var _0xca92=function(_0xdd2bfa,_0x5bd304){_0xdd2bfa=_0xdd2bfa-0x0;var _0x55397e=_0xa92c[_0xdd2bfa];return _0x55397e;};'use strict';var util=require(_0xca92('0x0'));var _=require(_0xca92('0x1'));var BPromise=require(_0xca92('0x2'));var uuid=require(_0xca92('0x3'));var moment=require(_0xca92('0x4'));var path=require(_0xca92('0x5'));var tiff2pdf=require(_0xca92('0x6'));var gs=require('./util/gs');var logger=require('../../../config/logger')('fax');var ami=require(_0xca92('0x7'));var rpcDb=require(_0xca92('0x8'));var Channel=require(_0xca92('0x9'));var ut=require(_0xca92('0xa'));var Action=require(_0xca92('0xb'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0xca92('0xc'));var faxMessage=require(_0xca92('0xd'));function Fax(_0x21f2d9){this[_0xca92('0xe')]={};this[_0xca92('0xf')]=_0x21f2d9['faxAccounts'];this['trunks']=_0x21f2d9['trunks'];this['actions']={};ami['on'](_0xca92('0x10'),this[_0xca92('0x11')]['bind'](this));ami['on']('varset',this[_0xca92('0x12')][_0xca92('0x13')](this));ami['on']('newstate',this[_0xca92('0x14')]['bind'](this));ami['on'](_0xca92('0x15'),this[_0xca92('0x16')][_0xca92('0x13')](this));ami['on'](_0xca92('0x17'),this[_0xca92('0x18')][_0xca92('0x13')](this));ami['on']('receivefax',this[_0xca92('0x19')]['bind'](this));ami['on']('hangup',this[_0xca92('0x1a')]['bind'](this));ami['on'](_0xca92('0x1b'),this[_0xca92('0x1c')][_0xca92('0x13')](this));}Fax[_0xca92('0x1d')][_0xca92('0x11')]=function(_0x3ee393){if(_0x3ee393[_0xca92('0x1e')]==='from-voip-provider'){for(var _0xa3f2d in this[_0xca92('0xf')]){if(this[_0xca92('0xf')]['hasOwnProperty'](_0xa3f2d)){if(_0x3ee393['exten']===this['faxAccounts'][_0xa3f2d]['localstationid']){this[_0xca92('0xe')][_0x3ee393[_0xca92('0x1f')]]={};this[_0xca92('0xe')][_0x3ee393[_0xca92('0x1f')]]['channel']=_0x3ee393[_0xca92('0x20')];this['channels'][_0x3ee393[_0xca92('0x1f')]]['id']=this[_0xca92('0xf')][_0xa3f2d]['id'];this[_0xca92('0xe')][_0x3ee393['uniqueid']][_0xca92('0x21')]=this[_0xca92('0xf')][_0xa3f2d][_0xca92('0x21')];logger[_0xca92('0x22')](_0x3ee393[_0xca92('0x1f')],_0xca92('0x23'));}}}}if(this[_0xca92('0x24')][_0x3ee393['uniqueid']]){this['channels'][_0x3ee393[_0xca92('0x1f')]]={};this[_0xca92('0xe')][_0x3ee393['uniqueid']]['channel']=_0x3ee393['channel'];logger[_0xca92('0x22')](_0x3ee393['uniqueid'],_0xca92('0x23'));}};Fax[_0xca92('0x1d')]['syncVarSet']=function(_0x74fd5b){if(this[_0xca92('0xe')][_0x74fd5b[_0xca92('0x1f')]]){for(var _0x3ea311 in _0x74fd5b[_0xca92('0x25')]){if(_0x74fd5b[_0xca92('0x25')][_0xca92('0x26')](_0x3ea311)){this[_0xca92('0xe')][_0x74fd5b[_0xca92('0x1f')]][_0x3ea311]=_0x74fd5b['value'];}}}};Fax[_0xca92('0x1d')][_0xca92('0x14')]=function(_0x1cfc5d){if(this[_0xca92('0xe')][_0x1cfc5d[_0xca92('0x1f')]]){this[_0xca92('0xe')][_0x1cfc5d[_0xca92('0x1f')]][_0xca92('0x27')]=_0x1cfc5d[_0xca92('0x27')];this[_0xca92('0xe')][_0x1cfc5d[_0xca92('0x1f')]][_0xca92('0x28')]=_0x1cfc5d[_0xca92('0x28')];}};Fax[_0xca92('0x1d')][_0xca92('0x16')]=function(_0xfc0f95){if(this['channels'][_0xfc0f95[_0xca92('0x1f')]]){for(var _0x5dc44c in _0xfc0f95[_0xca92('0x25')]){if(_0xfc0f95[_0xca92('0x25')]['hasOwnProperty'](_0x5dc44c)){this[_0xca92('0xe')][_0xfc0f95[_0xca92('0x1f')]][_0x5dc44c]=_0xfc0f95[_0xca92('0x29')];}}}};Fax[_0xca92('0x1d')][_0xca92('0x18')]=function(_0xd77160){if(this[_0xca92('0xe')][_0xd77160[_0xca92('0x1f')]]){this[_0xca92('0xe')][_0xd77160[_0xca92('0x1f')]]['operation']=_0xd77160[_0xca92('0x2a')];this[_0xca92('0xe')][_0xd77160[_0xca92('0x1f')]][_0xca92('0x2b')]=_0xd77160[_0xca92('0x2b')];this[_0xca92('0xe')][_0xd77160['uniqueid']][_0xca92('0x2c')]=_0xd77160[_0xca92('0x2c')];this[_0xca92('0xe')][_0xd77160['uniqueid']]['filename']=_0xd77160[_0xca92('0x2d')];logger[_0xca92('0x22')](_0xd77160[_0xca92('0x1f')],_0xca92('0x2e'));}};Fax[_0xca92('0x1d')][_0xca92('0x19')]=function(_0x441a90){var _0x2eb75a=this;if(this[_0xca92('0xe')][_0x441a90[_0xca92('0x1f')]]){var _0x1b291a=this['channels'][_0x441a90[_0xca92('0x1f')]]['id'];this[_0xca92('0xe')][_0x441a90[_0xca92('0x1f')]][_0xca92('0x2f')]=_0x441a90[_0xca92('0x2f')];this['channels'][_0x441a90[_0xca92('0x1f')]][_0xca92('0x30')]=_0x441a90['pagestransferred'];this[_0xca92('0xe')][_0x441a90[_0xca92('0x1f')]][_0xca92('0x2c')]=_0x441a90['localstationid'];this['channels'][_0x441a90[_0xca92('0x1f')]]['resolution']=_0x441a90[_0xca92('0x31')];this['channels'][_0x441a90[_0xca92('0x1f')]][_0xca92('0x32')]=_0x441a90[_0xca92('0x32')];this[_0xca92('0xe')][_0x441a90[_0xca92('0x1f')]][_0xca92('0x2d')]=_0x441a90[_0xca92('0x2d')];this['channels'][_0x441a90[_0xca92('0x1f')]]['calleridnum']=_0x441a90['calleridnum'];if(this[_0xca92('0xe')][_0x441a90[_0xca92('0x1f')]][_0xca92('0x30')]>0x0){tiff2pdf(_0x441a90['filename'],_0xca92('0x33'),function(_0x408b86){logger['info'](_0x441a90[_0xca92('0x1f')],_0xca92('0x34'),_0x408b86[_0xca92('0x35')]);attachment[_0xca92('0x36')]({'name':path[_0xca92('0x37')](_0x441a90[_0xca92('0x2d')])[_0xca92('0x21')],'basename':path['parse'](_0x441a90['filename'])[_0xca92('0x21')]+_0xca92('0x38'),'type':_0xca92('0x39')})['then'](function(_0x205d24){faxAccount[_0xca92('0x3a')](_0x1b291a,{'from':_0x441a90[_0xca92('0x3b')],'mapKey':'fax','body':path[_0xca92('0x37')](_0x441a90[_0xca92('0x2d')])[_0xca92('0x21')]+'.pdf','AttachmentId':_0x205d24['id']})[_0xca92('0x3c')](function(_0x257cd8){logger[_0xca92('0x3d')](_0x441a90['uniqueid'],_0xca92('0x3e'),JSON[_0xca92('0x3f')](_0x257cd8));});})[_0xca92('0x3c')](function(_0x183180){logger[_0xca92('0x3d')](_0x441a90[_0xca92('0x1f')],_0xca92('0x40'),JSON[_0xca92('0x3f')](_0x183180));});});}logger['info'](_0x441a90[_0xca92('0x1f')],_0xca92('0x40'));}};Fax[_0xca92('0x1d')][_0xca92('0x1c')]=function(_0x47c4b3){if(this[_0xca92('0x24')][_0x47c4b3[_0xca92('0x1f')]]){_[_0xca92('0x41')](this['channels'][_0x47c4b3[_0xca92('0x1f')]],_[_0xca92('0x42')](_0x47c4b3,[_0xca92('0x43'),_0xca92('0x44')]));}};function updateStatus(_0x49e5c1){if(_0x49e5c1['AttachmentId']){faxMessage[_0xca92('0x45')](_0x49e5c1[_0xca92('0x46')],{'failMessage':_0xca92('0x47')})[_0xca92('0x48')](function(_0x49261f){ut[_0xca92('0x49')]('[Fax][Message][Error][Updated]',_0x49261f);})[_0xca92('0x3c')](function(_0x2715f0){ut[_0xca92('0x49')](_0xca92('0x4a'),_0x2715f0);});}else{ut[_0xca92('0x49')](_0xca92('0x4b'));}}Fax['prototype'][_0xca92('0x4c')]=function(_0x4e1739,_0x389080,_0x581b66){var _0x2f8073=this;var _0x5f08b3={};if(_0x389080){_0x5f08b3={'read':_0x389080};}else{_0x5f08b3={'failMessage':_0x581b66};}if(this[_0xca92('0x24')][_0x4e1739][_0xca92('0x46')]){faxMessage['update'](this[_0xca92('0x24')][_0x4e1739]['AttachmentId'],_0x5f08b3)['then'](function(_0xbd580){ut[_0xca92('0x49')](_0xca92('0x4d'),_0xbd580);})[_0xca92('0x3c')](function(_0x38d716){ut[_0xca92('0x49')](_0xca92('0x4e'),_0x38d716);})[_0xca92('0x4f')](function(){delete _0x2f8073[_0xca92('0xe')][_0x4e1739];delete _0x2f8073['actions'][_0x4e1739];});}else{ut[_0xca92('0x49')]('[Fax][Message][NoUpdate2]');delete this[_0xca92('0xe')][_0x4e1739];delete this['actions'][_0x4e1739];}};Fax[_0xca92('0x1d')][_0xca92('0x1a')]=function(_0x52af86){var _0x598b49=this;if(this[_0xca92('0xe')][_0x52af86['uniqueid']]){if(this[_0xca92('0x24')][_0x52af86['uniqueid']]){this[_0xca92('0xe')][_0x52af86['uniqueid']]['id']=this[_0xca92('0x24')][_0x52af86[_0xca92('0x1f')]]['id'];this[_0xca92('0xe')][_0x52af86[_0xca92('0x1f')]][_0xca92('0x21')]=this[_0xca92('0x24')][_0x52af86[_0xca92('0x1f')]][_0xca92('0x21')];}logger[_0xca92('0x22')](_0x52af86[_0xca92('0x1f')],this[_0xca92('0x24')][_0x52af86['uniqueid']]?'\x20hangup\x20sendFile\x20':_0xca92('0x50'),JSON['stringify'](this[_0xca92('0xe')][_0x52af86['uniqueid']]));if(this[_0xca92('0x24')][_0x52af86['uniqueid']]){if(this[_0xca92('0xe')][_0x52af86[_0xca92('0x1f')]][_0xca92('0x51')]>0x0&&this[_0xca92('0xe')][_0x52af86[_0xca92('0x1f')]][_0xca92('0x17')]===_0xca92('0x52')){this['updateStatus'](_0x52af86[_0xca92('0x1f')],!![]);}else{this['updateStatus'](_0x52af86[_0xca92('0x1f')],![],this[_0xca92('0xe')][_0x52af86['uniqueid']]['faxstatusstring']?_0xca92('0x53')+this[_0xca92('0xe')][_0x52af86['uniqueid']][_0xca92('0x54')]:'SENDING\x20FAILED');}}}};Fax[_0xca92('0x1d')]['send']=function(_0x3fa1f4){var _0x741ae1=this;return new BPromise(function(_0x3d72cc,_0x42ec22){_0x741ae1['execOriginate'](_0x3fa1f4,_0x741ae1[_0xca92('0xf')][_0x3fa1f4[_0xca92('0x55')]])[_0xca92('0x48')](function(_0x37f46c){ut[_0xca92('0x49')](_0xca92('0x56'),_0x37f46c);_0x3d72cc(ut[_0xca92('0x35')]('Fax\x20received'));})[_0xca92('0x3c')](function(_0x115646){ut[_0xca92('0x49')](_0xca92('0x57'),_0x115646);updateStatus(_0x3fa1f4);_0x42ec22(ut[_0xca92('0x35')](_0xca92('0x58')));});});};Fax[_0xca92('0x1d')][_0xca92('0x59')]=function(_0x258560){var _0x5673fa=this;return new BPromise(function(_0x27e83b,_0x5fe4db){var _0x134972=_0x5673fa[_0xca92('0x5a')](_0x5673fa[_0xca92('0xf')][_0x258560['FaxAccountId']][_0xca92('0x5b')],_0x258560);if(_0x134972[_0xca92('0x5c')]){_0x27e83b(ut[_0xca92('0x35')](_0xca92('0x5d')));}else{_0x5fe4db(ut[_0xca92('0x35')](_0x134972[_0xca92('0x35')]));}});};function originate(_0x792968,_0x366571,_0x414d3a){return new BPromise(function(_0x2af65a,_0x59225f){if(_0x414d3a){var _0x4dd089=util[_0xca92('0x5e')](_0xca92('0x5f'),path[_0xca92('0x37')](_0x792968[_0xca92('0x5')])[_0xca92('0x21')],_0x792968[_0xca92('0x5')]);gs[_0xca92('0x60')](_0x4dd089)['then'](function(){_0x792968[_0xca92('0x5')]=util['format']('%s/%s.tif',path[_0xca92('0x37')](_0x792968[_0xca92('0x5')])[_0xca92('0x61')],path['parse'](_0x792968[_0xca92('0x5')])[_0xca92('0x21')]);_0x366571[_0xca92('0x62')]=_0x792968[_0xca92('0x5')];ut[_0xca92('0x49')]('Convert\x20pdf\x20to\x20tif','');ami[_0xca92('0x63')](ut[_0xca92('0x64')](_0x792968,_0x366571))[_0xca92('0x48')](function(_0x26f776){_0x2af65a(_0x26f776);})[_0xca92('0x3c')](function(_0x55170b){_0x59225f(_0x55170b);});})['catch'](function(_0x372f36){_0x59225f(_0x372f36);});}else{ami['Action'](ut[_0xca92('0x64')](_0x792968,_0x366571))[_0xca92('0x48')](function(_0x19000e){_0x2af65a(_0x19000e);})[_0xca92('0x3c')](function(_0x50cedd){_0x59225f(_0x50cedd);});}});}Fax[_0xca92('0x1d')][_0xca92('0x65')]=function(_0x646f30,_0x4a5ae1){var _0x44f3ae=this;return new BPromise(function(_0x4d834c,_0x5c2527){var _0x470f53=uuid['v4']();var _0x34b6a1=ut[_0xca92('0x66')](_0x646f30,_0x4a5ae1);_0x44f3ae[_0xca92('0x24')][_0x470f53]=new Action(_0x470f53,_0x4a5ae1,_0x646f30);var _0x619cd4=_0x44f3ae[_0xca92('0x24')][_0x470f53];if(path['parse'](_0x646f30[_0xca92('0x5')])[_0xca92('0x67')]===_0xca92('0x38')){originate(_0x619cd4,_0x34b6a1,!![])[_0xca92('0x48')](function(_0x23ce87){_0x4d834c(_0x23ce87);})[_0xca92('0x3c')](function(_0x524a4a){_0x5c2527(_0x524a4a);});}else{originate(_0x619cd4,_0x34b6a1,![])[_0xca92('0x48')](function(_0x372129){_0x4d834c(_0x372129);})[_0xca92('0x3c')](function(_0x2ecbcc){_0x5c2527(_0x2ecbcc);});}});};Fax[_0xca92('0x1d')][_0xca92('0x68')]=function(_0xbacc31){return!_[_0xca92('0x69')](_0xbacc31)&&!_[_0xca92('0x69')](_0xbacc31[_0xca92('0x21')])&&!_[_0xca92('0x69')](_0xbacc31[_0xca92('0x6a')])&&_0xbacc31[_0xca92('0x6a')]&&!_['isNil'](this[_0xca92('0x6b')][util['format'](_0xca92('0x6c'),_0xbacc31[_0xca92('0x21')])])&&!_[_0xca92('0x69')](this['trunks'][util[_0xca92('0x5e')]('SIP/%s',_0xbacc31[_0xca92('0x21')])]['status'])&&(this[_0xca92('0x6b')][util[_0xca92('0x5e')](_0xca92('0x6c'),_0xbacc31[_0xca92('0x21')])][_0xca92('0x2b')]===_0xca92('0x6d')||this[_0xca92('0x6b')][util['format']('SIP/%s',_0xbacc31[_0xca92('0x21')])][_0xca92('0x2b')]==='unmonitored');};Fax['prototype']['checkTrunk']=function(_0x4cfa7b,_0x27efe1){if(!this[_0xca92('0x68')](_0x4cfa7b)){ut[_0xca92('0x49')](_0xca92('0x6e'),_[_0xca92('0x69')](_0x4cfa7b)?'':_0x4cfa7b['name']+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0xca92('0x6f')};}if(_['isNil'](_0x27efe1[_0xca92('0x70')])){ut[_0xca92('0x49')](_0xca92('0x71'),JSON[_0xca92('0x3f')](_0x27efe1));return{'isValid':![],'message':_0xca92('0x72')};}if(_[_0xca92('0x69')](_0x27efe1['path'])){ut[_0xca92('0x49')](_0xca92('0x73'),JSON[_0xca92('0x3f')](_0x27efe1));return{'isValid':![],'message':_0xca92('0x74')};}return{'isValid':!![],'message':_0xca92('0x75')};};module['exports']=Fax; \ No newline at end of file +var _0x06be=['[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','stringify','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','Trunk\x20Reachable','execute','format','%s/%s.tif','dir','Convert\x20pdf\x20to\x20tif','Action','addVariables','ext','isTrunkReachable','isNil','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','exports','util','lodash','uuid','moment','path','tiff2pdf','./util/gs','fax','../ami','./rpcDb','./channel','./util/util','../rpc/faxAccount','../rpc/faxMessage','channels','faxAccounts','trunks','newchannel','syncNewchannel','syncVarSet','bind','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncReceiveFax','hangup','syncHangup','originateresponse','prototype','context','from-voip-provider','hasOwnProperty','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','actions','variable','value','channelstate','channelstatedesc','syncFaxStatus','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','resolution','transferrate','calleridnum','pagestransferred','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','notify','catch','error','\x20notify\x20','\x20receiveFax\x20','merge','pick','reason','AttachmentId','update','then','[Fax][Message][Error][Updated]','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','[Fax][Message][Updated]'];(function(_0x1fc122,_0x5e2c17){var _0xa2cb13=function(_0x263b13){while(--_0x263b13){_0x1fc122['push'](_0x1fc122['shift']());}};_0xa2cb13(++_0x5e2c17);}(_0x06be,0x9f));var _0xe06b=function(_0x59282f,_0x43dc83){_0x59282f=_0x59282f-0x0;var _0xc8c04c=_0x06be[_0x59282f];return _0xc8c04c;};'use strict';var util=require(_0xe06b('0x0'));var _=require(_0xe06b('0x1'));var BPromise=require('bluebird');var uuid=require(_0xe06b('0x2'));var moment=require(_0xe06b('0x3'));var path=require(_0xe06b('0x4'));var tiff2pdf=require(_0xe06b('0x5'));var gs=require(_0xe06b('0x6'));var logger=require('../../../config/logger')(_0xe06b('0x7'));var ami=require(_0xe06b('0x8'));var rpcDb=require(_0xe06b('0x9'));var Channel=require(_0xe06b('0xa'));var ut=require(_0xe06b('0xb'));var Action=require('./action');var faxAccount=require(_0xe06b('0xc'));var attachment=require('../rpc/attachment');var faxMessage=require(_0xe06b('0xd'));function Fax(_0x48c405){this[_0xe06b('0xe')]={};this[_0xe06b('0xf')]=_0x48c405[_0xe06b('0xf')];this[_0xe06b('0x10')]=_0x48c405['trunks'];this['actions']={};ami['on'](_0xe06b('0x11'),this[_0xe06b('0x12')]['bind'](this));ami['on']('varset',this[_0xe06b('0x13')][_0xe06b('0x14')](this));ami['on'](_0xe06b('0x15'),this[_0xe06b('0x16')][_0xe06b('0x14')](this));ami['on'](_0xe06b('0x17'),this[_0xe06b('0x18')][_0xe06b('0x14')](this));ami['on'](_0xe06b('0x19'),this['syncFaxStatus']['bind'](this));ami['on']('receivefax',this[_0xe06b('0x1a')][_0xe06b('0x14')](this));ami['on'](_0xe06b('0x1b'),this[_0xe06b('0x1c')][_0xe06b('0x14')](this));ami['on'](_0xe06b('0x1d'),this['syncOriginateResponse'][_0xe06b('0x14')](this));}Fax[_0xe06b('0x1e')]['syncNewchannel']=function(_0x1d3456){if(_0x1d3456[_0xe06b('0x1f')]===_0xe06b('0x20')){for(var _0x42e63b in this[_0xe06b('0xf')]){if(this[_0xe06b('0xf')][_0xe06b('0x21')](_0x42e63b)){if(_0x1d3456['exten']===this['faxAccounts'][_0x42e63b][_0xe06b('0x22')]){this[_0xe06b('0xe')][_0x1d3456['uniqueid']]={};this['channels'][_0x1d3456[_0xe06b('0x23')]][_0xe06b('0x24')]=_0x1d3456[_0xe06b('0x24')];this[_0xe06b('0xe')][_0x1d3456[_0xe06b('0x23')]]['id']=this[_0xe06b('0xf')][_0x42e63b]['id'];this[_0xe06b('0xe')][_0x1d3456[_0xe06b('0x23')]][_0xe06b('0x25')]=this[_0xe06b('0xf')][_0x42e63b]['name'];logger[_0xe06b('0x26')](_0x1d3456['uniqueid'],_0xe06b('0x27'));}}}}if(this[_0xe06b('0x28')][_0x1d3456[_0xe06b('0x23')]]){this[_0xe06b('0xe')][_0x1d3456['uniqueid']]={};this['channels'][_0x1d3456[_0xe06b('0x23')]][_0xe06b('0x24')]=_0x1d3456[_0xe06b('0x24')];logger[_0xe06b('0x26')](_0x1d3456['uniqueid'],'\x20syncNewchannel\x20');}};Fax[_0xe06b('0x1e')]['syncVarSet']=function(_0x168108){if(this[_0xe06b('0xe')][_0x168108[_0xe06b('0x23')]]){for(var _0x469fde in _0x168108[_0xe06b('0x29')]){if(_0x168108[_0xe06b('0x29')][_0xe06b('0x21')](_0x469fde)){this['channels'][_0x168108[_0xe06b('0x23')]][_0x469fde]=_0x168108[_0xe06b('0x2a')];}}}};Fax[_0xe06b('0x1e')]['syncNewState']=function(_0x347825){if(this[_0xe06b('0xe')][_0x347825[_0xe06b('0x23')]]){this[_0xe06b('0xe')][_0x347825[_0xe06b('0x23')]][_0xe06b('0x2b')]=_0x347825['channelstate'];this[_0xe06b('0xe')][_0x347825[_0xe06b('0x23')]]['channelstatedesc']=_0x347825[_0xe06b('0x2c')];}};Fax[_0xe06b('0x1e')][_0xe06b('0x18')]=function(_0x218b7c){if(this['channels'][_0x218b7c[_0xe06b('0x23')]]){for(var _0x486b0f in _0x218b7c['variable']){if(_0x218b7c[_0xe06b('0x29')][_0xe06b('0x21')](_0x486b0f)){this[_0xe06b('0xe')][_0x218b7c['uniqueid']][_0x486b0f]=_0x218b7c['value'];}}}};Fax[_0xe06b('0x1e')][_0xe06b('0x2d')]=function(_0xf9b8a6){if(this[_0xe06b('0xe')][_0xf9b8a6['uniqueid']]){this[_0xe06b('0xe')][_0xf9b8a6[_0xe06b('0x23')]][_0xe06b('0x2e')]=_0xf9b8a6['operation'];this[_0xe06b('0xe')][_0xf9b8a6[_0xe06b('0x23')]]['status']=_0xf9b8a6[_0xe06b('0x2f')];this[_0xe06b('0xe')][_0xf9b8a6[_0xe06b('0x23')]][_0xe06b('0x22')]=_0xf9b8a6[_0xe06b('0x22')];this[_0xe06b('0xe')][_0xf9b8a6[_0xe06b('0x23')]][_0xe06b('0x30')]=_0xf9b8a6[_0xe06b('0x30')];logger[_0xe06b('0x26')](_0xf9b8a6[_0xe06b('0x23')],_0xe06b('0x31'));}};Fax[_0xe06b('0x1e')][_0xe06b('0x1a')]=function(_0x565df4){var _0x1477f5=this;if(this['channels'][_0x565df4[_0xe06b('0x23')]]){var _0x3e30a4=this[_0xe06b('0xe')][_0x565df4['uniqueid']]['id'];this[_0xe06b('0xe')][_0x565df4['uniqueid']]['remotestationid']=_0x565df4[_0xe06b('0x32')];this[_0xe06b('0xe')][_0x565df4['uniqueid']]['pagestransferred']=_0x565df4['pagestransferred'];this[_0xe06b('0xe')][_0x565df4[_0xe06b('0x23')]]['localstationid']=_0x565df4[_0xe06b('0x22')];this[_0xe06b('0xe')][_0x565df4['uniqueid']]['resolution']=_0x565df4[_0xe06b('0x33')];this[_0xe06b('0xe')][_0x565df4[_0xe06b('0x23')]][_0xe06b('0x34')]=_0x565df4[_0xe06b('0x34')];this[_0xe06b('0xe')][_0x565df4[_0xe06b('0x23')]][_0xe06b('0x30')]=_0x565df4[_0xe06b('0x30')];this[_0xe06b('0xe')][_0x565df4[_0xe06b('0x23')]][_0xe06b('0x35')]=_0x565df4[_0xe06b('0x35')];if(this[_0xe06b('0xe')][_0x565df4[_0xe06b('0x23')]][_0xe06b('0x36')]>0x0){tiff2pdf(_0x565df4[_0xe06b('0x30')],_0xe06b('0x37'),function(_0x3bc377){logger['info'](_0x565df4[_0xe06b('0x23')],_0xe06b('0x38'),_0x3bc377[_0xe06b('0x39')]);attachment[_0xe06b('0x3a')]({'name':path[_0xe06b('0x3b')](_0x565df4[_0xe06b('0x30')])[_0xe06b('0x25')],'basename':path[_0xe06b('0x3b')](_0x565df4[_0xe06b('0x30')])[_0xe06b('0x25')]+_0xe06b('0x3c'),'type':'application/pdf'})['then'](function(_0x289c92){faxAccount[_0xe06b('0x3d')](_0x3e30a4,{'from':_0x565df4[_0xe06b('0x35')],'mapKey':_0xe06b('0x7'),'body':path['parse'](_0x565df4[_0xe06b('0x30')])[_0xe06b('0x25')]+_0xe06b('0x3c'),'AttachmentId':_0x289c92['id']})[_0xe06b('0x3e')](function(_0xd6053c){logger[_0xe06b('0x3f')](_0x565df4[_0xe06b('0x23')],_0xe06b('0x40'),JSON['stringify'](_0xd6053c));});})[_0xe06b('0x3e')](function(_0x235cd3){logger[_0xe06b('0x3f')](_0x565df4[_0xe06b('0x23')],_0xe06b('0x41'),JSON['stringify'](_0x235cd3));});});}logger['info'](_0x565df4[_0xe06b('0x23')],_0xe06b('0x41'));}};Fax[_0xe06b('0x1e')]['syncOriginateResponse']=function(_0x5c9c4d){if(this[_0xe06b('0x28')][_0x5c9c4d[_0xe06b('0x23')]]){_[_0xe06b('0x42')](this[_0xe06b('0xe')][_0x5c9c4d['uniqueid']],_[_0xe06b('0x43')](_0x5c9c4d,['response',_0xe06b('0x44')]));}};function updateStatus(_0x2809c1){if(_0x2809c1[_0xe06b('0x45')]){faxMessage[_0xe06b('0x46')](_0x2809c1[_0xe06b('0x45')],{'failMessage':'SENDING\x20FAILED\x20'})[_0xe06b('0x47')](function(_0x186922){ut['logger'](_0xe06b('0x48'),_0x186922);})[_0xe06b('0x3e')](function(_0x2fb81a){ut[_0xe06b('0x49')](_0xe06b('0x4a'),_0x2fb81a);});}else{ut['logger'](_0xe06b('0x4b'));}}Fax['prototype']['updateStatus']=function(_0x1241e8,_0x241305,_0x3ccd87){var _0xfa0405=this;var _0x22d1a9={};if(_0x241305){_0x22d1a9={'read':_0x241305};}else{_0x22d1a9={'failMessage':_0x3ccd87};}if(this[_0xe06b('0x28')][_0x1241e8][_0xe06b('0x45')]){faxMessage[_0xe06b('0x46')](this[_0xe06b('0x28')][_0x1241e8][_0xe06b('0x45')],_0x22d1a9)[_0xe06b('0x47')](function(_0x1b3915){ut[_0xe06b('0x49')](_0xe06b('0x4c'),_0x1b3915);})[_0xe06b('0x3e')](function(_0x2b03d0){ut['logger'](_0xe06b('0x4d'),_0x2b03d0);})[_0xe06b('0x4e')](function(){delete _0xfa0405[_0xe06b('0xe')][_0x1241e8];delete _0xfa0405['actions'][_0x1241e8];});}else{ut[_0xe06b('0x49')](_0xe06b('0x4f'));delete this[_0xe06b('0xe')][_0x1241e8];delete this[_0xe06b('0x28')][_0x1241e8];}};Fax['prototype'][_0xe06b('0x1c')]=function(_0x37133f){var _0x237771=this;if(this['channels'][_0x37133f['uniqueid']]){if(this[_0xe06b('0x28')][_0x37133f[_0xe06b('0x23')]]){this['channels'][_0x37133f['uniqueid']]['id']=this[_0xe06b('0x28')][_0x37133f[_0xe06b('0x23')]]['id'];this[_0xe06b('0xe')][_0x37133f[_0xe06b('0x23')]][_0xe06b('0x25')]=this['actions'][_0x37133f[_0xe06b('0x23')]][_0xe06b('0x25')];}logger[_0xe06b('0x26')](_0x37133f[_0xe06b('0x23')],this[_0xe06b('0x28')][_0x37133f['uniqueid']]?_0xe06b('0x50'):_0xe06b('0x51'),JSON[_0xe06b('0x52')](this[_0xe06b('0xe')][_0x37133f[_0xe06b('0x23')]]));if(this[_0xe06b('0x28')][_0x37133f[_0xe06b('0x23')]]){if(this['channels'][_0x37133f[_0xe06b('0x23')]]['faxpages']>0x0&&this[_0xe06b('0xe')][_0x37133f[_0xe06b('0x23')]][_0xe06b('0x19')]===_0xe06b('0x53')){this[_0xe06b('0x54')](_0x37133f[_0xe06b('0x23')],!![]);}else{this['updateStatus'](_0x37133f[_0xe06b('0x23')],![],this[_0xe06b('0xe')][_0x37133f[_0xe06b('0x23')]][_0xe06b('0x55')]?_0xe06b('0x56')+this[_0xe06b('0xe')][_0x37133f[_0xe06b('0x23')]][_0xe06b('0x55')]:_0xe06b('0x57'));}}}};Fax[_0xe06b('0x1e')]['send']=function(_0x52ba64){var _0x1af75b=this;return new BPromise(function(_0x43469f,_0x164227){_0x1af75b[_0xe06b('0x58')](_0x52ba64,_0x1af75b[_0xe06b('0xf')][_0x52ba64[_0xe06b('0x59')]])[_0xe06b('0x47')](function(_0x24a34e){ut[_0xe06b('0x49')](_0xe06b('0x5a'),_0x24a34e);_0x43469f(ut['message'](_0xe06b('0x5b')));})[_0xe06b('0x3e')](function(_0x5f0779){ut[_0xe06b('0x49')](_0xe06b('0x5c'),_0x5f0779);updateStatus(_0x52ba64);_0x164227(ut[_0xe06b('0x39')](_0xe06b('0x5d')));});});};Fax[_0xe06b('0x1e')][_0xe06b('0x5e')]=function(_0x56a47f){var _0x58cf8e=this;return new BPromise(function(_0xd9f0bf,_0x178fc8){var _0x17814a=_0x58cf8e[_0xe06b('0x5f')](_0x58cf8e['faxAccounts'][_0x56a47f[_0xe06b('0x59')]][_0xe06b('0x60')],_0x56a47f);if(_0x17814a['isValid']){_0xd9f0bf(ut[_0xe06b('0x39')](_0xe06b('0x61')));}else{_0x178fc8(ut['message'](_0x17814a['message']));}});};function originate(_0x753ab5,_0x3f083b,_0x5abd42){return new BPromise(function(_0x2204cc,_0x116cd2){if(_0x5abd42){var _0xfdb27f=util['format']('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path['parse'](_0x753ab5[_0xe06b('0x4')])['name'],_0x753ab5[_0xe06b('0x4')]);gs[_0xe06b('0x62')](_0xfdb27f)[_0xe06b('0x47')](function(){_0x753ab5[_0xe06b('0x4')]=util[_0xe06b('0x63')](_0xe06b('0x64'),path[_0xe06b('0x3b')](_0x753ab5['path'])[_0xe06b('0x65')],path[_0xe06b('0x3b')](_0x753ab5[_0xe06b('0x4')])[_0xe06b('0x25')]);_0x3f083b['XMF-PATH']=_0x753ab5['path'];ut[_0xe06b('0x49')](_0xe06b('0x66'),'');ami['Action'](ut['variablesAction'](_0x753ab5,_0x3f083b))[_0xe06b('0x47')](function(_0x36111b){_0x2204cc(_0x36111b);})[_0xe06b('0x3e')](function(_0x177383){_0x116cd2(_0x177383);});})[_0xe06b('0x3e')](function(_0x24845d){_0x116cd2(_0x24845d);});}else{ami[_0xe06b('0x67')](ut['variablesAction'](_0x753ab5,_0x3f083b))['then'](function(_0x6aad3e){_0x2204cc(_0x6aad3e);})[_0xe06b('0x3e')](function(_0x1d7e19){_0x116cd2(_0x1d7e19);});}});}Fax[_0xe06b('0x1e')][_0xe06b('0x58')]=function(_0x46176b,_0x3d99b2){var _0x44133f=this;return new BPromise(function(_0x238f2f,_0xec1de5){var _0x487023=uuid['v4']();var _0x314c8b=ut[_0xe06b('0x68')](_0x46176b,_0x3d99b2);_0x44133f[_0xe06b('0x28')][_0x487023]=new Action(_0x487023,_0x3d99b2,_0x46176b);var _0x1a77f0=_0x44133f['actions'][_0x487023];if(path[_0xe06b('0x3b')](_0x46176b[_0xe06b('0x4')])[_0xe06b('0x69')]===_0xe06b('0x3c')){originate(_0x1a77f0,_0x314c8b,!![])['then'](function(_0x1d21fd){_0x238f2f(_0x1d21fd);})['catch'](function(_0x36357e){_0xec1de5(_0x36357e);});}else{originate(_0x1a77f0,_0x314c8b,![])[_0xe06b('0x47')](function(_0x4f4acd){_0x238f2f(_0x4f4acd);})[_0xe06b('0x3e')](function(_0xf5bc83){_0xec1de5(_0xf5bc83);});}});};Fax[_0xe06b('0x1e')][_0xe06b('0x6a')]=function(_0xab433e){return!_['isNil'](_0xab433e)&&!_[_0xe06b('0x6b')](_0xab433e[_0xe06b('0x25')])&&!_['isNil'](_0xab433e['active'])&&_0xab433e['active']&&!_[_0xe06b('0x6b')](this[_0xe06b('0x10')][util['format'](_0xe06b('0x6c'),_0xab433e[_0xe06b('0x25')])])&&!_['isNil'](this[_0xe06b('0x10')][util[_0xe06b('0x63')]('SIP/%s',_0xab433e[_0xe06b('0x25')])][_0xe06b('0x2f')])&&(this['trunks'][util[_0xe06b('0x63')](_0xe06b('0x6c'),_0xab433e[_0xe06b('0x25')])][_0xe06b('0x2f')]===_0xe06b('0x6d')||this['trunks'][util['format']('SIP/%s',_0xab433e[_0xe06b('0x25')])][_0xe06b('0x2f')]===_0xe06b('0x6e'));};Fax[_0xe06b('0x1e')]['checkTrunk']=function(_0x4cf984,_0x511f8f){if(!this[_0xe06b('0x6a')](_0x4cf984)){ut['logger'](_0xe06b('0x6f'),_[_0xe06b('0x6b')](_0x4cf984)?'':_0x4cf984[_0xe06b('0x25')]+_0xe06b('0x70'));return{'isValid':![],'message':_0xe06b('0x71')};}if(_['isNil'](_0x511f8f[_0xe06b('0x7')])){ut[_0xe06b('0x49')](_0xe06b('0x72'),JSON[_0xe06b('0x52')](_0x511f8f));return{'isValid':![],'message':_0xe06b('0x73')};}if(_['isNil'](_0x511f8f[_0xe06b('0x4')])){ut[_0xe06b('0x49')](_0xe06b('0x74'),JSON[_0xe06b('0x52')](_0x511f8f));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0xe06b('0x75')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index a0326a1..5baf0ca 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 _0x97e8=['preview','lodash','error','inspect','resolve','then','notify','[Notify]\x20','util','bluebird','../../../config/logger'];(function(_0x2f9138,_0x493638){var _0x21e94e=function(_0x384e6d){while(--_0x384e6d){_0x2f9138['push'](_0x2f9138['shift']());}};_0x21e94e(++_0x493638);}(_0x97e8,0x110));var _0x897e=function(_0x360af7,_0x359dd9){_0x360af7=_0x360af7-0x0;var _0x313cf1=_0x97e8[_0x360af7];return _0x313cf1;};'use strict';var util=require(_0x897e('0x0'));var BPromise=require(_0x897e('0x1'));var logger=require(_0x897e('0x2'))(_0x897e('0x3'));var _=require(_0x897e('0x4'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x486b81){return function(_0x9a6736){logger[_0x897e('0x5')](_0x486b81,util[_0x897e('0x6')](_0x9a6736,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x5256e3,_0x31c771){return BPromise[_0x897e('0x7')]()[_0x897e('0x8')](faxAccount[_0x897e('0x9')](_0x5256e3,_0x31c771))['catch'](loggerCatch(_0x897e('0xa')));}; \ No newline at end of file +var _0xe047=['util','bluebird','preview','lodash','../rpc/faxAccount','error','inspect','notify','then','catch','[Notify]\x20'];(function(_0x1f8473,_0x3fb703){var _0x358b51=function(_0x276637){while(--_0x276637){_0x1f8473['push'](_0x1f8473['shift']());}};_0x358b51(++_0x3fb703);}(_0xe047,0x155));var _0x7e04=function(_0x9982be,_0x214547){_0x9982be=_0x9982be-0x0;var _0x58366f=_0xe047[_0x9982be];return _0x58366f;};'use strict';var util=require(_0x7e04('0x0'));var BPromise=require(_0x7e04('0x1'));var logger=require('../../../config/logger')(_0x7e04('0x2'));var _=require(_0x7e04('0x3'));var faxAccount=require(_0x7e04('0x4'));function loggerCatch(_0x288ae4){return function(_0x16982c){logger[_0x7e04('0x5')](_0x288ae4,util[_0x7e04('0x6')](_0x16982c,{'showHidden':![],'depth':null}));};}exports[_0x7e04('0x7')]=function(_0x4b7053,_0xa705ae){return BPromise['resolve']()[_0x7e04('0x8')](faxAccount[_0x7e04('0x7')](_0x4b7053,_0xa705ae))[_0x7e04('0x9')](loggerCatch(_0x7e04('0xa')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index c1fe9a8..16f0466 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 _0x54eb=['exec','execute','info','Exec\x20gs','inspect','util','../../../../config/logger','bluebird','child_process'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x54eb,0x101));var _0xb54e=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x54eb[_0x422905];return _0x33dc6c;};'use strict';var util=require(_0xb54e('0x0'));var logger=require(_0xb54e('0x1'))('fax');var BPromise=require(_0xb54e('0x2'));var exec=require(_0xb54e('0x3'))[_0xb54e('0x4')];exports[_0xb54e('0x5')]=function(_0x4a8328){return new BPromise(function(_0x1c143e,_0x1e5e41){exec(_0x4a8328,function(_0x5b6429,_0xc0cf4c,_0x20045c){logger[_0xb54e('0x6')](_0xb54e('0x7'),_0xc0cf4c);if(_0x5b6429){logger[_0xb54e('0x6')]('Exec\x20gs','\x20Error\x20:',util[_0xb54e('0x8')](_0x5b6429,{'showHidden':![],'depth':null}),_0xc0cf4c,_0x20045c);_0x1e5e41(_0x5b6429);}_0x1c143e(_0xc0cf4c);});});}; \ No newline at end of file +var _0x7d82=['child_process','exec','execute','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','fax','bluebird'];(function(_0x53f964,_0x3b52b8){var _0x17be6c=function(_0x25a732){while(--_0x25a732){_0x53f964['push'](_0x53f964['shift']());}};_0x17be6c(++_0x3b52b8);}(_0x7d82,0xf6));var _0x27d8=function(_0x33f5c0,_0x5b4465){_0x33f5c0=_0x33f5c0-0x0;var _0xadedcf=_0x7d82[_0x33f5c0];return _0xadedcf;};'use strict';var util=require(_0x27d8('0x0'));var logger=require(_0x27d8('0x1'))(_0x27d8('0x2'));var BPromise=require(_0x27d8('0x3'));var exec=require(_0x27d8('0x4'))[_0x27d8('0x5')];exports[_0x27d8('0x6')]=function(_0x546f17){return new BPromise(function(_0x4236a6,_0x4336a9){exec(_0x546f17,function(_0x5126e1,_0x1c8c31,_0x275e4c){logger['info'](_0x27d8('0x7'),_0x1c8c31);if(_0x5126e1){logger['info']('Exec\x20gs',_0x27d8('0x8'),util[_0x27d8('0x9')](_0x5126e1,{'showHidden':![],'depth':null}),_0x1c8c31,_0x275e4c);_0x4336a9(_0x5126e1);}_0x4236a6(_0x1c8c31);});});}; \ 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 5469b61..9880f36 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 _0xbb67=['message','inspect','addVariables','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','channel','xcally-motion-fax','util','lodash','moment','../../../../config/logger','fax'];(function(_0x5babd5,_0x5b0051){var _0x51cb0b=function(_0x9f26ba){while(--_0x9f26ba){_0x5babd5['push'](_0x5babd5['shift']());}};_0x51cb0b(++_0x5b0051);}(_0xbb67,0x8b));var _0x7bb6=function(_0x122aa6,_0x2feef8){_0x122aa6=_0x122aa6-0x0;var _0x4ab107=_0xbb67[_0x122aa6];return _0x4ab107;};'use strict';var util=require(_0x7bb6('0x0'));var _=require(_0x7bb6('0x1'));var moment=require(_0x7bb6('0x2'));var logger=require(_0x7bb6('0x3'))(_0x7bb6('0x4'));exports[_0x7bb6('0x5')]=function(_0x2daf16){return{'message':_0x2daf16};};exports['logger']=function(_0x5777bb,_0xaafcfb){logger['info'](_0x5777bb,util[_0x7bb6('0x6')](_0xaafcfb,{'showHidden':![],'depth':null}));};exports[_0x7bb6('0x7')]=function(_0x55b4f6,_0x5780e2){var _0xc2211c={'XMF-ECM':_0x5780e2[_0x7bb6('0x8')],'XMF-HEADERINFO':_0x5780e2[_0x7bb6('0x9')],'XMF-MINRATE':_0x5780e2[_0x7bb6('0xa')],'XMF-MAXRATE':_0x5780e2[_0x7bb6('0xb')],'XMF-MODEM':util[_0x7bb6('0xc')](_0x7bb6('0xd'),_0x5780e2[_0x7bb6('0xe')]),'XMF-GATEWAY':_0x5780e2[_0x7bb6('0xf')],'XMF-FAXDETECT':_0x5780e2[_0x7bb6('0x10')],'XMF-T38TIMEOUT':_0x5780e2[_0x7bb6('0x11')],'XMF-LOCALSTATIONID':_0x5780e2[_0x7bb6('0x12')],'XMF-PATH':_0x55b4f6[_0x7bb6('0x13')]};return _0xc2211c;};exports[_0x7bb6('0x14')]=function(_0x475c36,_0x11958f){return{'actionid':_0x475c36[_0x7bb6('0x15')],'action':'originate','channel':_0x475c36[_0x7bb6('0x16')],'Exten':_0x7bb6('0x17'),'Context':'from-sip','Priority':'1','callerid':util[_0x7bb6('0xc')]('\x22%s\x22\x20<%s>',_0x475c36[_0x7bb6('0x9')]?_0x475c36['headerinfo']:'',_0x475c36['localstationid']),'variable':_0x11958f,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x475c36['uniqueid']};}; \ No newline at end of file +var _0x743d=['variablesAction','originate','channel','from-sip','\x22%s\x22\x20<%s>','uniqueid','util','lodash','moment','../../../../config/logger','fax','logger','info','inspect','addVariables','ecm','headerinfo','minrate','maxrate','format','modem','gateway','faxdetect','t38timeout','localstationid','path'];(function(_0x46537c,_0xd649ea){var _0x19fee5=function(_0x294ed9){while(--_0x294ed9){_0x46537c['push'](_0x46537c['shift']());}};_0x19fee5(++_0xd649ea);}(_0x743d,0x1c0));var _0xd743=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x743d[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0xd743('0x0'));var _=require(_0xd743('0x1'));var moment=require(_0xd743('0x2'));var logger=require(_0xd743('0x3'))(_0xd743('0x4'));exports['message']=function(_0x3a953a){return{'message':_0x3a953a};};exports[_0xd743('0x5')]=function(_0x5ea89b,_0x372ca6){logger[_0xd743('0x6')](_0x5ea89b,util[_0xd743('0x7')](_0x372ca6,{'showHidden':![],'depth':null}));};exports[_0xd743('0x8')]=function(_0x3a8424,_0x43b266){var _0x4ec10a={'XMF-ECM':_0x43b266[_0xd743('0x9')],'XMF-HEADERINFO':_0x43b266[_0xd743('0xa')],'XMF-MINRATE':_0x43b266[_0xd743('0xb')],'XMF-MAXRATE':_0x43b266[_0xd743('0xc')],'XMF-MODEM':util[_0xd743('0xd')]('\x22%s\x22',_0x43b266[_0xd743('0xe')]),'XMF-GATEWAY':_0x43b266[_0xd743('0xf')],'XMF-FAXDETECT':_0x43b266[_0xd743('0x10')],'XMF-T38TIMEOUT':_0x43b266[_0xd743('0x11')],'XMF-LOCALSTATIONID':_0x43b266[_0xd743('0x12')],'XMF-PATH':_0x3a8424[_0xd743('0x13')]};return _0x4ec10a;};exports[_0xd743('0x14')]=function(_0x453ee1,_0xebec96){return{'actionid':_0x453ee1['uniqueid'],'action':_0xd743('0x15'),'channel':_0x453ee1[_0xd743('0x16')],'Exten':'xcally-motion-fax','Context':_0xd743('0x17'),'Priority':'1','callerid':util[_0xd743('0xd')](_0xd743('0x18'),_0x453ee1[_0xd743('0xa')]?_0x453ee1[_0xd743('0xa')]:'',_0x453ee1[_0xd743('0x12')]),'variable':_0xebec96,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x453ee1[_0xd743('0x19')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index a2081c4..b36603c 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 _0xf840=['./rpc/integrations/sugarcrm','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/servicenow','hour','get','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getTriggers','initTriggers','getTemplates','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','listen','sync','log','bluebird','moment','./server','./realtime','./report','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/salesforce'];(function(_0x150ee3,_0x2354d6){var _0x485085=function(_0x38963d){while(--_0x38963d){_0x150ee3['push'](_0x150ee3['shift']());}};_0x485085(++_0x2354d6);}(_0xf840,0x1bb));var _0x0f84=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xf840[_0x2a6809];return _0x11c371;};'use strict';var BPromise=require(_0x0f84('0x0'));var util=require('util');var moment=require(_0x0f84('0x1'));var server=require(_0x0f84('0x2'));var Realtime=require(_0x0f84('0x3'));var Report=require(_0x0f84('0x4'));var Acw=require('./acw');var Trigger=require(_0x0f84('0x5'));var Dialer=require(_0x0f84('0x6'));var Preview=require(_0x0f84('0x7'));var Fax=require(_0x0f84('0x8'));var user=require(_0x0f84('0x9'));var voiceQueue=require(_0x0f84('0xa'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x0f84('0xb'));var trunk=require(_0x0f84('0xc'));var trigger=require(_0x0f84('0xd'));var template=require('./rpc/template');var cmHopperHistory=require(_0x0f84('0xe'));var campaign=require(_0x0f84('0xf'));var voiceExtension=require(_0x0f84('0x10'));var faxAccount=require(_0x0f84('0x11'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0x0f84('0x12'));var sugarcrm=require(_0x0f84('0x13'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0x0f84('0x14'));var zoho=require(_0x0f84('0x15'));var vtiger=require(_0x0f84('0x16'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0x0f84('0x17'));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 isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0x0f84('0x18'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x0f84('0x19')](_0x0f84('0x18'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x0f84('0x1a')]()[_0x0f84('0x1b')](user[_0x0f84('0x1c')]())[_0x0f84('0x1b')](realtime[_0x0f84('0x1d')]())[_0x0f84('0x1b')](user[_0x0f84('0x1e')]())[_0x0f84('0x1b')](realtime[_0x0f84('0x1f')]())[_0x0f84('0x1b')](trunk[_0x0f84('0x20')]())[_0x0f84('0x1b')](realtime[_0x0f84('0x21')]())[_0x0f84('0x1b')](voiceQueue['getVoiceQueues']())['then'](realtime['initVoiceQueues']())['then'](trigger[_0x0f84('0x22')]())[_0x0f84('0x1b')](realtime[_0x0f84('0x23')]())[_0x0f84('0x1b')](template[_0x0f84('0x24')]())[_0x0f84('0x1b')](realtime['initTemplates']())[_0x0f84('0x1b')](zendesk['getZendeskAccounts']())[_0x0f84('0x1b')](realtime[_0x0f84('0x25')]())[_0x0f84('0x1b')](salesforce[_0x0f84('0x26')]())[_0x0f84('0x1b')](realtime[_0x0f84('0x27')]())['then'](sugarcrm[_0x0f84('0x28')]())['then'](realtime['initSugarcrmAccounts']())[_0x0f84('0x1b')](freshdesk[_0x0f84('0x29')]())['then'](realtime[_0x0f84('0x2a')]())[_0x0f84('0x1b')](desk[_0x0f84('0x2b')]())[_0x0f84('0x1b')](realtime[_0x0f84('0x2c')]())[_0x0f84('0x1b')](zoho[_0x0f84('0x2d')]())[_0x0f84('0x1b')](realtime['initZohoAccounts']())[_0x0f84('0x1b')](vtiger['getVtigerAccounts']())[_0x0f84('0x1b')](realtime[_0x0f84('0x2e')]())[_0x0f84('0x1b')](freshsales[_0x0f84('0x2f')]())[_0x0f84('0x1b')](realtime[_0x0f84('0x30')]())[_0x0f84('0x1b')](servicenow[_0x0f84('0x31')]())['then'](realtime['initServicenowAccounts']())[_0x0f84('0x1b')](dynamics365[_0x0f84('0x32')]())['then'](realtime[_0x0f84('0x33')]())[_0x0f84('0x1b')](campaign['getCampaigns']())[_0x0f84('0x1b')](realtime['initCampaigns']())[_0x0f84('0x1b')](voiceExtension[_0x0f84('0x34')]())[_0x0f84('0x1b')](realtime[_0x0f84('0x35')]())[_0x0f84('0x1b')](faxAccount[_0x0f84('0x36')]())[_0x0f84('0x1b')](realtime[_0x0f84('0x37')]())['then'](function(){return realtime;});}function initParams(){return BPromise[_0x0f84('0x1a')]()['then'](voiceQueueReport[_0x0f84('0x38')]())['then'](realtime[_0x0f84('0x39')]())[_0x0f84('0x1b')](cmHopperHistory[_0x0f84('0x3a')]())[_0x0f84('0x1b')](realtime[_0x0f84('0x3b')]())[_0x0f84('0x1b')](cmHopperHistory['getCampaignHopperHistory']())[_0x0f84('0x1b')](realtime[_0x0f84('0x3c')]())['then'](voiceCallReport[_0x0f84('0x3d')]())[_0x0f84('0x1b')](realtime[_0x0f84('0x3e')]())['then'](function(_0x3d7f50){})['catch'](function(_0x183c4e){console['log'](_0x183c4e);});}function main(){return server[_0x0f84('0x3f')](realtime,preview,fax)[_0x0f84('0x1b')](function(_0x1d5d26){return initRealtime();})[_0x0f84('0x1b')](function(){return initParams();})[_0x0f84('0x1b')](function(){report[_0x0f84('0x40')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x1f77ca){console[_0x0f84('0x41')](_0x1f77ca);});}main(); \ No newline at end of file +var _0x20b1=['getVoiceExtensions','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','log','listen','sync','catch','util','moment','./server','./report','./acw','./trigger','./preview','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/cmHopperHistory','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','resolve','then','getAgents','initAgents','initTelephones','getTrunks','initTrunks','getVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','initFreshdeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','initDynamics365Accounts','initCampaigns'];(function(_0x16e67f,_0x58527d){var _0xea929=function(_0x57c186){while(--_0x57c186){_0x16e67f['push'](_0x16e67f['shift']());}};_0xea929(++_0x58527d);}(_0x20b1,0x197));var _0x120b=function(_0x37dc72,_0x1b25d3){_0x37dc72=_0x37dc72-0x0;var _0x86ba05=_0x20b1[_0x37dc72];return _0x86ba05;};'use strict';var BPromise=require('bluebird');var util=require(_0x120b('0x0'));var moment=require(_0x120b('0x1'));var server=require(_0x120b('0x2'));var Realtime=require('./realtime');var Report=require(_0x120b('0x3'));var Acw=require(_0x120b('0x4'));var Trigger=require(_0x120b('0x5'));var Dialer=require('./dialer');var Preview=require(_0x120b('0x6'));var Fax=require('./fax');var user=require(_0x120b('0x7'));var voiceQueue=require(_0x120b('0x8'));var voiceQueueReport=require(_0x120b('0x9'));var voiceCallReport=require(_0x120b('0xa'));var trunk=require(_0x120b('0xb'));var trigger=require(_0x120b('0xc'));var template=require('./rpc/template');var cmHopperHistory=require(_0x120b('0xd'));var campaign=require('./rpc/campaign');var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x120b('0xe'));var zendesk=require(_0x120b('0xf'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0x120b('0x10'));var freshdesk=require(_0x120b('0x11'));var desk=require(_0x120b('0x12'));var zoho=require(_0x120b('0x13'));var vtiger=require(_0x120b('0x14'));var freshsales=require(_0x120b('0x15'));var servicenow=require(_0x120b('0x16'));var dynamics365=require(_0x120b('0x17'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x120b('0x18')](_0x120b('0x19'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x120b('0x18')](_0x120b('0x19'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x120b('0x1a')]()[_0x120b('0x1b')](user[_0x120b('0x1c')]())[_0x120b('0x1b')](realtime[_0x120b('0x1d')]())[_0x120b('0x1b')](user['getTelephones']())[_0x120b('0x1b')](realtime[_0x120b('0x1e')]())[_0x120b('0x1b')](trunk[_0x120b('0x1f')]())['then'](realtime[_0x120b('0x20')]())['then'](voiceQueue[_0x120b('0x21')]())[_0x120b('0x1b')](realtime['initVoiceQueues']())['then'](trigger[_0x120b('0x22')]())[_0x120b('0x1b')](realtime[_0x120b('0x23')]())[_0x120b('0x1b')](template[_0x120b('0x24')]())[_0x120b('0x1b')](realtime[_0x120b('0x25')]())[_0x120b('0x1b')](zendesk[_0x120b('0x26')]())[_0x120b('0x1b')](realtime[_0x120b('0x27')]())['then'](salesforce[_0x120b('0x28')]())['then'](realtime[_0x120b('0x29')]())['then'](sugarcrm[_0x120b('0x2a')]())[_0x120b('0x1b')](realtime[_0x120b('0x2b')]())['then'](freshdesk['getFreshdeskAccounts']())[_0x120b('0x1b')](realtime[_0x120b('0x2c')]())[_0x120b('0x1b')](desk['getDeskAccounts']())[_0x120b('0x1b')](realtime[_0x120b('0x2d')]())[_0x120b('0x1b')](zoho[_0x120b('0x2e')]())['then'](realtime[_0x120b('0x2f')]())[_0x120b('0x1b')](vtiger[_0x120b('0x30')]())[_0x120b('0x1b')](realtime[_0x120b('0x31')]())['then'](freshsales[_0x120b('0x32')]())[_0x120b('0x1b')](realtime['initFreshsalesAccounts']())['then'](servicenow[_0x120b('0x33')]())[_0x120b('0x1b')](realtime[_0x120b('0x34')]())[_0x120b('0x1b')](dynamics365['getDynamics365Accounts']())[_0x120b('0x1b')](realtime[_0x120b('0x35')]())[_0x120b('0x1b')](campaign['getCampaigns']())[_0x120b('0x1b')](realtime[_0x120b('0x36')]())[_0x120b('0x1b')](voiceExtension[_0x120b('0x37')]())['then'](realtime['initVoiceExtensions']())[_0x120b('0x1b')](faxAccount['getFaxAccounts']())[_0x120b('0x1b')](realtime['initFaxAccounts']())[_0x120b('0x1b')](function(){return realtime;});}function initParams(){return BPromise[_0x120b('0x1a')]()[_0x120b('0x1b')](voiceQueueReport[_0x120b('0x38')]())['then'](realtime[_0x120b('0x39')]())[_0x120b('0x1b')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x120b('0x1b')](realtime[_0x120b('0x3a')]())[_0x120b('0x1b')](cmHopperHistory[_0x120b('0x3b')]())[_0x120b('0x1b')](realtime['initCampaignHopperHistory']())[_0x120b('0x1b')](voiceCallReport[_0x120b('0x3c')]())[_0x120b('0x1b')](realtime[_0x120b('0x3d')]())[_0x120b('0x1b')](function(_0x2f9e7a){})['catch'](function(_0x1e0421){console[_0x120b('0x3e')](_0x1e0421);});}function main(){return server[_0x120b('0x3f')](realtime,preview,fax)[_0x120b('0x1b')](function(_0x494a3a){return initRealtime();})[_0x120b('0x1b')](function(){return initParams();})[_0x120b('0x1b')](function(){report[_0x120b('0x40')]();setInterval(initRealtime,0x1388);})[_0x120b('0x41')](function(_0x203aba){console[_0x120b('0x3e')](_0x203aba);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index acf9d5d..9a5e644 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 _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(_0x95b616,_0x296372){var _0x596532=function(_0x384b06){while(--_0x384b06){_0x95b616['push'](_0x95b616['shift']());}};_0x596532(++_0x296372);}(_0x9c44,0x178));var _0x49c4=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x9c44[_0x167cc1];return _0x10bc4b;};'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 +var _0xe706=['address','phone','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','updateStatusRealtime','not_inuse','inuse','talking','format','interface','stringify','md5','user:%s','emit','user:presence','lodash','util','moment','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status'];(function(_0x5c083f,_0x8fad75){var _0x1bb345=function(_0x47c11d){while(--_0x47c11d){_0x5c083f['push'](_0x5c083f['shift']());}};_0x1bb345(++_0x8fad75);}(_0xe706,0xa3));var _0x6e70=function(_0x283952,_0x442596){_0x283952=_0x283952-0x0;var _0x57bb99=_0xe706[_0x283952];return _0x57bb99;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var md5=require('md5');var Redis=require(_0x6e70('0x3'));var config=require(_0x6e70('0x4'));config[_0x6e70('0x5')]=_[_0x6e70('0x6')](config[_0x6e70('0x5')],{'host':_0x6e70('0x7'),'port':0x18eb});var io=require(_0x6e70('0x8'))(new Redis(config[_0x6e70('0x5')]));function Agent(_0x1b0389){this['id']=_0x1b0389['id']||0x0;this[_0x6e70('0x9')]=_0x1b0389[_0x6e70('0x9')]||'';this[_0x6e70('0xa')]=_0x1b0389[_0x6e70('0xa')]||'';this[_0x6e70('0xb')]=_0x1b0389[_0x6e70('0xb')]||'';this[_0x6e70('0xc')]=_0x1b0389[_0x6e70('0xc')]||'';this[_0x6e70('0xd')]=_0x6e70('0xe');this[_0x6e70('0xf')]=0x0;this[_0x6e70('0x10')]=_0x6e70('0xe');this[_0x6e70('0x11')]='';this[_0x6e70('0x12')]='';this['mobile']='';this['interface']='';this[_0x6e70('0x13')]=_0x1b0389[_0x6e70('0x13')]||![];this[_0x6e70('0x14')]=_0x6e70('0xe');this[_0x6e70('0x15')]=0x0;this[_0x6e70('0x16')]='';this[_0x6e70('0x17')]='';this[_0x6e70('0x18')]=![];this['local']=![];this['md5']='';}Agent['prototype'][_0x6e70('0x19')]=function(_0x5a37a6){var _0x53aed0;if(_0x5a37a6&&_0x5a37a6[_0x6e70('0xd')]){_0x53aed0=_0x5a37a6[_0x6e70('0xd')]['toLowerCase']();switch(_0x53aed0){case _0x6e70('0x1a'):_0x53aed0='idle';break;case _0x6e70('0x1b'):_0x53aed0=_0x6e70('0x1c');break;}}if(_0x53aed0&&this['voiceStatus']!==_0x53aed0||_0x5a37a6['statePause']){this[_0x6e70('0x15')]=_['toNumber'](moment()[_0x6e70('0x1d')]('x'));}if(_0x53aed0){this[_0x6e70('0x14')]=_0x53aed0;}var _0x53acdc={'id':this['id'],'name':this['name'],'email':this[_0x6e70('0xa')],'accountcode':this[_0x6e70('0xb')],'fullname':this[_0x6e70('0xc')],'state':this[_0x6e70('0xd')],'stateTime':this[_0x6e70('0xf')],'status':this[_0x6e70('0x10')],'address':this[_0x6e70('0x11')],'online':this[_0x6e70('0x13')],'voiceStatus':this[_0x6e70('0x14')],'voiceStatusTime':this[_0x6e70('0x15')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x6e70('0x17')],'interface':this[_0x6e70('0x1e')],'onhold':this[_0x6e70('0x18')]};var _0x502b2d=md5(JSON[_0x6e70('0x1f')](_0x53acdc));if(this[_0x6e70('0x20')]!==_0x502b2d){this[_0x6e70('0x20')]=_0x502b2d;io['to'](util['format'](_0x6e70('0x21'),_0x53acdc['name']))['emit']('user:save',_0x53acdc);io[_0x6e70('0x22')](_0x6e70('0x23'),_0x53acdc);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 95e2289..1f48405 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 _0xb48b=['dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','originated','ivrAnswerCallsDay','ivrTotalCallsDays','message','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb48b,0xe4));var _0xbb48=function(_0x56ef51,_0x381d1e){_0x56ef51=_0x56ef51-0x0;var _0x46f6d8=_0xb48b[_0x56ef51];return _0x46f6d8;};'use strict';function Campaign(_0x43addd){this['id']=_0x43addd['id']||0x0;this[_0xbb48('0x0')]=_0x43addd['name']||'';this[_0xbb48('0x1')]=_0x43addd['type']||'campaign';this[_0xbb48('0x2')]=0x0;this['temp']=0x0;this[_0xbb48('0x3')]=0x0;this[_0xbb48('0x4')]=0x0;this[_0xbb48('0x5')]='';this['sendMessageOneNotActive']=!![];this[_0xbb48('0x6')]=_0x43addd[_0xbb48('0x6')];this[_0xbb48('0x7')]=_0x43addd[_0xbb48('0x7')];this[_0xbb48('0x8')]=_0x43addd[_0xbb48('0x8')]||null;this[_0xbb48('0x9')]=_0x43addd['dialGlobalInterval']?_0x43addd[_0xbb48('0x9')]:null;this[_0xbb48('0xa')]=_0x43addd[_0xbb48('0xa')];this[_0xbb48('0xb')]=_0x43addd[_0xbb48('0xb')];this['dialOriginateTimeout']=_0x43addd[_0xbb48('0xc')]||0x1e;this[_0xbb48('0xd')]=_0x43addd[_0xbb48('0xd')];this['dialCongestionRetryFrequency']=_0x43addd[_0xbb48('0xe')];this[_0xbb48('0xf')]=_0x43addd[_0xbb48('0xf')];this['dialBusyRetryFrequency']=_0x43addd[_0xbb48('0x10')];this['dialNoAnswerMaxRetry']=_0x43addd[_0xbb48('0x11')];this[_0xbb48('0x12')]=_0x43addd[_0xbb48('0x12')];this['dialGlobalMaxRetry']=_0x43addd['dialGlobalMaxRetry'];this[_0xbb48('0x13')]=_0x43addd['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x43addd[_0xbb48('0x14')]||0x96;this[_0xbb48('0x15')]=_0x43addd['dialDropMaxRetry']||0x3;this[_0xbb48('0x16')]=_0x43addd[_0xbb48('0x16')]||0x96;this[_0xbb48('0x17')]=_0x43addd[_0xbb48('0x17')]||0x3;this[_0xbb48('0x18')]=_0x43addd[_0xbb48('0x18')]||0x96;this['dialMachineMaxRetry']=_0x43addd[_0xbb48('0x19')]||0x3;this[_0xbb48('0x1a')]=_0x43addd[_0xbb48('0x1a')]||0x96;this['dialAgentRejectMaxRetry']=_0x43addd['dialAgentRejectMaxRetry']||0x3;this[_0xbb48('0x1b')]=_0x43addd[_0xbb48('0x1b')]||0x96;this[_0xbb48('0x1c')]=_0x43addd[_0xbb48('0x1c')]||_0xbb48('0x1d');this[_0xbb48('0x1e')]=_0x43addd[_0xbb48('0x1e')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x43addd[_0xbb48('0x1f')]||undefined;this[_0xbb48('0x20')]=_0x43addd[_0xbb48('0x20')]||undefined;this[_0xbb48('0x21')]=_0x43addd['TrunkBackup']?_0x43addd[_0xbb48('0x21')]:undefined;this[_0xbb48('0x22')]=_0x43addd[_0xbb48('0x22')]?_0x43addd[_0xbb48('0x22')]:undefined;this[_0xbb48('0x23')]=_0x43addd[_0xbb48('0x23')]?_0x43addd[_0xbb48('0x23')]:undefined;this[_0xbb48('0x24')]=_0x43addd[_0xbb48('0x24')]?_0x43addd['SquareProject']:undefined;this[_0xbb48('0x25')]=_0x43addd[_0xbb48('0x24')]?_0x43addd[_0xbb48('0x24')][_0xbb48('0x0')]:undefined;this[_0xbb48('0x26')]=_0x43addd[_0xbb48('0x26')]||![];this['dialAMDInitialSilence']=_0x43addd[_0xbb48('0x27')];this['dialAMDGreeting']=_0x43addd[_0xbb48('0x28')];this[_0xbb48('0x29')]=_0x43addd[_0xbb48('0x29')];this[_0xbb48('0x2a')]=_0x43addd[_0xbb48('0x2a')];this[_0xbb48('0x2b')]=_0x43addd[_0xbb48('0x2b')];this[_0xbb48('0x2c')]=_0x43addd['dialAMDBetweenWordsSilence'];this['dialAMDMaximumNumberOfWords']=_0x43addd['dialAMDMaximumNumberOfWords'];this[_0xbb48('0x2d')]=_0x43addd['dialAMDSilenceThreshold'];this[_0xbb48('0x2e')]=_0x43addd[_0xbb48('0x2e')];}module[_0xbb48('0x2f')]=Campaign; \ No newline at end of file +var _0xb41b=['type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','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','dialPrefix','dialRandomLastDigitCallerIdNumber','TrunkBackup','Trunk','Interval','dialQueueProject','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','exports','name'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0xb41b,0x125));var _0xbb41=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb41b[_0x321bb2];return _0x9c12ed;};'use strict';function Campaign(_0x46a2b8){this['id']=_0x46a2b8['id']||0x0;this['name']=_0x46a2b8[_0xbb41('0x0')]||'';this[_0xbb41('0x1')]=_0x46a2b8['type']||_0xbb41('0x2');this[_0xbb41('0x3')]=0x0;this[_0xbb41('0x4')]=0x0;this[_0xbb41('0x5')]=0x0;this[_0xbb41('0x6')]=0x0;this['message']='';this[_0xbb41('0x7')]=!![];this[_0xbb41('0x8')]=_0x46a2b8[_0xbb41('0x8')];this['limitCalls']=_0x46a2b8[_0xbb41('0x9')];this[_0xbb41('0xa')]=_0x46a2b8['dialTimezone']||null;this['dialGlobalInterval']=_0x46a2b8[_0xbb41('0xb')]?_0x46a2b8[_0xbb41('0xb')]:null;this[_0xbb41('0xc')]=_0x46a2b8['dialOriginateCallerIdName'];this[_0xbb41('0xd')]=_0x46a2b8[_0xbb41('0xd')];this['dialOriginateTimeout']=_0x46a2b8[_0xbb41('0xe')]||0x1e;this['dialCongestionMaxRetry']=_0x46a2b8[_0xbb41('0xf')];this[_0xbb41('0x10')]=_0x46a2b8[_0xbb41('0x10')];this[_0xbb41('0x11')]=_0x46a2b8[_0xbb41('0x11')];this[_0xbb41('0x12')]=_0x46a2b8[_0xbb41('0x12')];this[_0xbb41('0x13')]=_0x46a2b8[_0xbb41('0x13')];this['dialNoAnswerRetryFrequency']=_0x46a2b8[_0xbb41('0x14')];this['dialGlobalMaxRetry']=_0x46a2b8[_0xbb41('0x15')];this[_0xbb41('0x16')]=_0x46a2b8['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x46a2b8[_0xbb41('0x17')]||0x96;this['dialDropMaxRetry']=_0x46a2b8[_0xbb41('0x18')]||0x3;this[_0xbb41('0x19')]=_0x46a2b8[_0xbb41('0x19')]||0x96;this[_0xbb41('0x1a')]=_0x46a2b8['dialAbandonedMaxRetry']||0x3;this[_0xbb41('0x1b')]=_0x46a2b8['dialAbandonedRetryFrequency']||0x96;this['dialMachineMaxRetry']=_0x46a2b8[_0xbb41('0x1c')]||0x3;this[_0xbb41('0x1d')]=_0x46a2b8[_0xbb41('0x1d')]||0x96;this[_0xbb41('0x1e')]=_0x46a2b8[_0xbb41('0x1e')]||0x3;this['dialAgentRejectRetryFrequency']=_0x46a2b8[_0xbb41('0x1f')]||0x96;this[_0xbb41('0x20')]=_0x46a2b8[_0xbb41('0x20')]||'DESC';this[_0xbb41('0x21')]=_0x46a2b8[_0xbb41('0x21')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x46a2b8[_0xbb41('0x22')]||undefined;this['dialCutDigit']=_0x46a2b8['dialCutDigit']||undefined;this[_0xbb41('0x23')]=_0x46a2b8[_0xbb41('0x23')]?_0x46a2b8[_0xbb41('0x23')]:undefined;this[_0xbb41('0x24')]=_0x46a2b8[_0xbb41('0x24')]?_0x46a2b8[_0xbb41('0x24')]:undefined;this[_0xbb41('0x25')]=_0x46a2b8['Interval']?_0x46a2b8[_0xbb41('0x25')]:undefined;this['SquareProject']=_0x46a2b8['SquareProject']?_0x46a2b8['SquareProject']:undefined;this[_0xbb41('0x26')]=_0x46a2b8[_0xbb41('0x27')]?_0x46a2b8[_0xbb41('0x27')][_0xbb41('0x0')]:undefined;this['dialAMDActive']=_0x46a2b8[_0xbb41('0x28')]||![];this['dialAMDInitialSilence']=_0x46a2b8[_0xbb41('0x29')];this['dialAMDGreeting']=_0x46a2b8[_0xbb41('0x2a')];this[_0xbb41('0x2b')]=_0x46a2b8[_0xbb41('0x2b')];this[_0xbb41('0x2c')]=_0x46a2b8[_0xbb41('0x2c')];this[_0xbb41('0x2d')]=_0x46a2b8[_0xbb41('0x2d')];this['dialAMDBetweenWordsSilence']=_0x46a2b8['dialAMDBetweenWordsSilence'];this[_0xbb41('0x2e')]=_0x46a2b8[_0xbb41('0x2e')];this['dialAMDSilenceThreshold']=_0x46a2b8[_0xbb41('0x2f')];this['dialAMDMaximumWordLength']=_0x46a2b8['dialAMDMaximumWordLength'];}module[_0xbb41('0x30')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index caf6a25..219c419 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 _0xef4d=['calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid','exten','answered','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','type','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','mohtime','starttime','channel','destinationchannel'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xef4d,0x165));var _0xdef4=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xef4d[_0xc4001c];return _0x49f7bc;};'use strict';function Channel(){this[_0xdef4('0x0')]=null;this[_0xdef4('0x1')]='';this[_0xdef4('0x2')]='';this[_0xdef4('0x3')]=0x0;this[_0xdef4('0x4')]='';this[_0xdef4('0x5')]=undefined;this[_0xdef4('0x6')]=undefined;this[_0xdef4('0x7')]=0x0;this[_0xdef4('0x8')]='';this[_0xdef4('0x9')]=0x0;this[_0xdef4('0xa')]=0x0;this[_0xdef4('0xb')]=0x0;this[_0xdef4('0xc')]=![];this['answertime']=null;this[_0xdef4('0xd')]=null;this[_0xdef4('0xe')]=![];this[_0xdef4('0xf')]=![];this[_0xdef4('0x10')]='';this[_0xdef4('0x11')]='';this[_0xdef4('0x12')]=0x0;this[_0xdef4('0x13')]=0x0;this[_0xdef4('0x14')]=0x0;this[_0xdef4('0x15')]=null;this['tag']=null;this[_0xdef4('0x16')]=null;this[_0xdef4('0x17')]=![];this[_0xdef4('0x18')]=null;this[_0xdef4('0x19')]=null;this[_0xdef4('0x1a')]=[];this[_0xdef4('0x1b')]=undefined;this[_0xdef4('0x1c')]=undefined;this['transferType']=undefined;this[_0xdef4('0x1d')]=0x0;}module['exports']=Channel; \ No newline at end of file +var _0xd983=['uniqueid','linkedid','exten','answered','answertime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','type','tag','monitorFilename','queue','monitors','transfercalleridnum','mohtime','exports','starttime','channel','destinationchannel','calleridnum','calleridname','accountcode','context'];(function(_0x3fa6a6,_0x310a65){var _0x2e0762=function(_0x2a148b){while(--_0x2a148b){_0x3fa6a6['push'](_0x3fa6a6['shift']());}};_0x2e0762(++_0x310a65);}(_0xd983,0x1df));var _0x3d98=function(_0x39ec4b,_0x51521a){_0x39ec4b=_0x39ec4b-0x0;var _0x12130a=_0xd983[_0x39ec4b];return _0x12130a;};'use strict';function Channel(){this[_0x3d98('0x0')]=null;this[_0x3d98('0x1')]='';this[_0x3d98('0x2')]='';this[_0x3d98('0x3')]=0x0;this[_0x3d98('0x4')]='';this['connectedlinenum']=undefined;this['connectedlinename']=undefined;this[_0x3d98('0x5')]=0x0;this[_0x3d98('0x6')]='';this[_0x3d98('0x7')]=0x0;this[_0x3d98('0x8')]=0x0;this[_0x3d98('0x9')]=0x0;this[_0x3d98('0xa')]=![];this[_0x3d98('0xb')]=null;this['endtime']=null;this[_0x3d98('0xc')]=![];this[_0x3d98('0xd')]=![];this[_0x3d98('0xe')]='';this[_0x3d98('0xf')]='';this[_0x3d98('0x10')]=0x0;this[_0x3d98('0x11')]=0x0;this[_0x3d98('0x12')]=0x0;this[_0x3d98('0x13')]=null;this[_0x3d98('0x14')]=null;this['disposition']=null;this['monitor']=![];this[_0x3d98('0x15')]=null;this[_0x3d98('0x16')]=null;this[_0x3d98('0x17')]=[];this[_0x3d98('0x18')]=undefined;this['transferconnectedlinenum']=undefined;this['transferType']=undefined;this[_0x3d98('0x19')]=0x0;}module[_0x3d98('0x1a')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index d86fd1a..08d9678 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 _0x3844=['authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri'];(function(_0x282db3,_0x321df1){var _0x5cdad5=function(_0x5b6644){while(--_0x5b6644){_0x282db3['push'](_0x282db3['shift']());}};_0x5cdad5(++_0x321df1);}(_0x3844,0x11b));var _0x4384=function(_0x11eb9d,_0x3622c1){_0x11eb9d=_0x11eb9d-0x0;var _0x31eed6=_0x3844[_0x11eb9d];return _0x31eed6;};'use strict';function DeskAccount(_0x23b794){this['id']=_0x23b794['id']||0x0;this[_0x4384('0x0')]=_0x23b794[_0x4384('0x0')]||'';this[_0x4384('0x1')]=_0x23b794[_0x4384('0x1')]||'';this[_0x4384('0x2')]=_0x23b794[_0x4384('0x2')]||'';this[_0x4384('0x3')]=_0x23b794[_0x4384('0x3')]||'';this[_0x4384('0x4')]=_0x23b794[_0x4384('0x4')]||'';this[_0x4384('0x5')]=_0x23b794['consumerKey']||'';this[_0x4384('0x6')]=_0x23b794['consumerSecret']||'';this['token']=_0x23b794[_0x4384('0x7')]||'';this[_0x4384('0x8')]=_0x23b794[_0x4384('0x8')]||'';this['type']=_0x23b794[_0x4384('0x9')]||'';this[_0x4384('0xa')]=_0x23b794[_0x4384('0xa')]||'';this[_0x4384('0xb')]=_0x23b794[_0x4384('0xb')]||{};}module[_0x4384('0xc')]=DeskAccount; \ No newline at end of file +var _0x63ca=['token','tokenSecret','type','serverUrl','Configurations','name','username','remoteUri','authType','password','consumerKey','consumerSecret'];(function(_0x2a1248,_0x335c01){var _0x3478eb=function(_0x5b05df){while(--_0x5b05df){_0x2a1248['push'](_0x2a1248['shift']());}};_0x3478eb(++_0x335c01);}(_0x63ca,0x161));var _0xa63c=function(_0x2a4e92,_0x4c19d6){_0x2a4e92=_0x2a4e92-0x0;var _0x5964ab=_0x63ca[_0x2a4e92];return _0x5964ab;};'use strict';function DeskAccount(_0xe3eae5){this['id']=_0xe3eae5['id']||0x0;this[_0xa63c('0x0')]=_0xe3eae5[_0xa63c('0x0')]||'';this[_0xa63c('0x1')]=_0xe3eae5['username']||'';this['remoteUri']=_0xe3eae5[_0xa63c('0x2')]||'';this[_0xa63c('0x3')]=_0xe3eae5[_0xa63c('0x3')]||'';this[_0xa63c('0x4')]=_0xe3eae5[_0xa63c('0x4')]||'';this[_0xa63c('0x5')]=_0xe3eae5[_0xa63c('0x5')]||'';this[_0xa63c('0x6')]=_0xe3eae5[_0xa63c('0x6')]||'';this[_0xa63c('0x7')]=_0xe3eae5[_0xa63c('0x7')]||'';this[_0xa63c('0x8')]=_0xe3eae5[_0xa63c('0x8')]||'';this[_0xa63c('0x9')]=_0xe3eae5[_0xa63c('0x9')]||'';this['serverUrl']=_0xe3eae5[_0xa63c('0xa')]||'';this[_0xa63c('0xb')]=_0xe3eae5[_0xa63c('0xb')]||{};}module['exports']=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index cb19c48..9ad2b9a 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 _0xa571=['Configurations','exports','name','username','password','tenantId','clientId','clientSecret','serverUrl'];(function(_0x3dc135,_0x546abc){var _0x517300=function(_0x12dbe7){while(--_0x12dbe7){_0x3dc135['push'](_0x3dc135['shift']());}};_0x517300(++_0x546abc);}(_0xa571,0x107));var _0x1a57=function(_0x51a783,_0x1a4250){_0x51a783=_0x51a783-0x0;var _0x16606d=_0xa571[_0x51a783];return _0x16606d;};'use strict';function Dynamics365Account(_0x2046d8){this['id']=_0x2046d8['id']||0x0;this[_0x1a57('0x0')]=_0x2046d8[_0x1a57('0x0')]||'';this[_0x1a57('0x1')]=_0x2046d8['username']||'';this[_0x1a57('0x2')]=_0x2046d8[_0x1a57('0x2')]||'';this['remoteUri']=_0x2046d8['remoteUri']||'';this[_0x1a57('0x3')]=_0x2046d8['tenantId']||'';this[_0x1a57('0x4')]=_0x2046d8[_0x1a57('0x4')]||'';this[_0x1a57('0x5')]=_0x2046d8[_0x1a57('0x5')]||{};this[_0x1a57('0x6')]=_0x2046d8[_0x1a57('0x6')]||'';this['Configurations']=_0x2046d8[_0x1a57('0x7')]||{};}module[_0x1a57('0x8')]=Dynamics365Account; \ No newline at end of file +var _0x13f6=['clientId','clientSecret','Configurations','exports','name','username','password','remoteUri','tenantId'];(function(_0x5b8a2e,_0x320bee){var _0x29f01e=function(_0x6cd16){while(--_0x6cd16){_0x5b8a2e['push'](_0x5b8a2e['shift']());}};_0x29f01e(++_0x320bee);}(_0x13f6,0x124));var _0x613f=function(_0x506eb2,_0x48c3d6){_0x506eb2=_0x506eb2-0x0;var _0x33074d=_0x13f6[_0x506eb2];return _0x33074d;};'use strict';function Dynamics365Account(_0xf31e04){this['id']=_0xf31e04['id']||0x0;this[_0x613f('0x0')]=_0xf31e04['name']||'';this['username']=_0xf31e04[_0x613f('0x1')]||'';this[_0x613f('0x2')]=_0xf31e04[_0x613f('0x2')]||'';this['remoteUri']=_0xf31e04[_0x613f('0x3')]||'';this[_0x613f('0x4')]=_0xf31e04[_0x613f('0x4')]||'';this['clientId']=_0xf31e04[_0x613f('0x5')]||'';this[_0x613f('0x6')]=_0xf31e04['clientSecret']||{};this['serverUrl']=_0xf31e04['serverUrl']||'';this['Configurations']=_0xf31e04[_0x613f('0x7')]||{};}module[_0x613f('0x8')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 531272c..5690fc6 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 _0x4141=['key','name','description','ecm','headerinfo','localstationid','minrate','maxrate','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x4141,0x121));var _0x1414=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x4141[_0x19950b];return _0x3c6b41;};'use strict';function FaxAccount(_0x12b812){this['id']=_0x12b812['id']||0x0;this[_0x1414('0x0')]=_0x12b812[_0x1414('0x0')]||'';this[_0x1414('0x1')]=_0x12b812[_0x1414('0x1')];this[_0x1414('0x2')]=_0x12b812[_0x1414('0x2')];this[_0x1414('0x3')]=_0x12b812[_0x1414('0x3')];this[_0x1414('0x4')]=_0x12b812['localstationid'];this['minrate']=_0x12b812[_0x1414('0x5')]||0x960;this[_0x1414('0x6')]=_0x12b812[_0x1414('0x6')]||0x3840;this['modem']=_0x12b812['modem']||_0x1414('0x7');this[_0x1414('0x8')]=_0x12b812[_0x1414('0x8')]||'no';this['faxdetect']=_0x12b812[_0x1414('0x9')]||'no';this[_0x1414('0xa')]=_0x12b812[_0x1414('0xa')]||0x1388;this[_0x1414('0xb')]=_0x12b812['tech']||_0x1414('0xc');this[_0x1414('0xd')]=_0x12b812['Trunk']?_0x12b812[_0x1414('0xd')]:undefined;this[_0x1414('0xe')]=_0x12b812[_0x1414('0xe')];this[_0x1414('0xf')]=_0x12b812['key'];}module['exports']=FaxAccount; \ No newline at end of file +var _0x6f5a=['localstationid','minrate','maxrate','modem','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo'];(function(_0x178001,_0x5af99f){var _0x2e786e=function(_0x1da925){while(--_0x1da925){_0x178001['push'](_0x178001['shift']());}};_0x2e786e(++_0x5af99f);}(_0x6f5a,0x10c));var _0xa6f5=function(_0x461cd9,_0x5cc439){_0x461cd9=_0x461cd9-0x0;var _0x3a7c2c=_0x6f5a[_0x461cd9];return _0x3a7c2c;};'use strict';function FaxAccount(_0x4f7b42){this['id']=_0x4f7b42['id']||0x0;this[_0xa6f5('0x0')]=_0x4f7b42['name']||'';this[_0xa6f5('0x1')]=_0x4f7b42[_0xa6f5('0x1')];this['ecm']=_0x4f7b42[_0xa6f5('0x2')];this[_0xa6f5('0x3')]=_0x4f7b42[_0xa6f5('0x3')];this[_0xa6f5('0x4')]=_0x4f7b42[_0xa6f5('0x4')];this['minrate']=_0x4f7b42[_0xa6f5('0x5')]||0x960;this[_0xa6f5('0x6')]=_0x4f7b42['maxrate']||0x3840;this[_0xa6f5('0x7')]=_0x4f7b42[_0xa6f5('0x7')]||'v17,v27,v29';this[_0xa6f5('0x8')]=_0x4f7b42[_0xa6f5('0x8')]||'no';this[_0xa6f5('0x9')]=_0x4f7b42[_0xa6f5('0x9')]||'no';this['t38timeout']=_0x4f7b42[_0xa6f5('0xa')]||0x1388;this[_0xa6f5('0xb')]=_0x4f7b42[_0xa6f5('0xb')]||_0xa6f5('0xc');this[_0xa6f5('0xd')]=_0x4f7b42[_0xa6f5('0xd')]?_0x4f7b42[_0xa6f5('0xd')]:undefined;this[_0xa6f5('0xe')]=_0x4f7b42[_0xa6f5('0xe')];this[_0xa6f5('0xf')]=_0x4f7b42[_0xa6f5('0xf')];}module[_0xa6f5('0x10')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 356594c..b60f0c5 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 _0x9f50=['Configurations','exports','name','username','token','remoteUri'];(function(_0x38e134,_0x48a372){var _0x19415b=function(_0x95b636){while(--_0x95b636){_0x38e134['push'](_0x38e134['shift']());}};_0x19415b(++_0x48a372);}(_0x9f50,0xb6));var _0x09f5=function(_0x5027b1,_0x1409a5){_0x5027b1=_0x5027b1-0x0;var _0x4a46cf=_0x9f50[_0x5027b1];return _0x4a46cf;};'use strict';function FreshdeskAccount(_0x4e6f3b){this['id']=_0x4e6f3b['id']||0x0;this['name']=_0x4e6f3b[_0x09f5('0x0')]||'';this[_0x09f5('0x1')]=_0x4e6f3b[_0x09f5('0x1')]||'';this['apiKey']=_0x4e6f3b[_0x09f5('0x2')]||'';this[_0x09f5('0x3')]=_0x4e6f3b[_0x09f5('0x3')]||'';this['serverUrl']=_0x4e6f3b['serverUrl']||'';this[_0x09f5('0x4')]=_0x4e6f3b[_0x09f5('0x4')]||{};}module[_0x09f5('0x5')]=FreshdeskAccount; \ No newline at end of file +var _0xa374=['exports','name','username','apiKey','remoteUri','serverUrl','Configurations'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0xa374,0x120));var _0x4a37=function(_0xb8ef34,_0xbb7410){_0xb8ef34=_0xb8ef34-0x0;var _0x5cadbf=_0xa374[_0xb8ef34];return _0x5cadbf;};'use strict';function FreshdeskAccount(_0x1286d4){this['id']=_0x1286d4['id']||0x0;this[_0x4a37('0x0')]=_0x1286d4['name']||'';this[_0x4a37('0x1')]=_0x1286d4[_0x4a37('0x1')]||'';this[_0x4a37('0x2')]=_0x1286d4['token']||'';this[_0x4a37('0x3')]=_0x1286d4[_0x4a37('0x3')]||'';this[_0x4a37('0x4')]=_0x1286d4[_0x4a37('0x4')]||'';this[_0x4a37('0x5')]=_0x1286d4['Configurations']||{};}module[_0x4a37('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 f6eb3f1..0dd9b32 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 _0xe260=['Configurations','name','username','apiKey','token','remoteUri','serverUrl'];(function(_0x32e779,_0x1c2596){var _0x47d7b3=function(_0x37c2d8){while(--_0x37c2d8){_0x32e779['push'](_0x32e779['shift']());}};_0x47d7b3(++_0x1c2596);}(_0xe260,0x94));var _0x0e26=function(_0x16f261,_0x5d1206){_0x16f261=_0x16f261-0x0;var _0x346d72=_0xe260[_0x16f261];return _0x346d72;};'use strict';function FreshsalesAccount(_0x544271){this['id']=_0x544271['id']||0x0;this['name']=_0x544271[_0x0e26('0x0')]||'';this[_0x0e26('0x1')]=_0x544271[_0x0e26('0x1')]||'';this[_0x0e26('0x2')]=_0x544271[_0x0e26('0x3')]||'';this[_0x0e26('0x4')]=_0x544271[_0x0e26('0x4')]||'';this[_0x0e26('0x5')]=_0x544271[_0x0e26('0x5')]||'';this[_0x0e26('0x6')]=_0x544271['Configurations']||{};}module['exports']=FreshsalesAccount; \ No newline at end of file +var _0xdb70=['name','username','apiKey','token','remoteUri','serverUrl','Configurations','exports'];(function(_0x241d45,_0x1d62ba){var _0x145c87=function(_0x36463d){while(--_0x36463d){_0x241d45['push'](_0x241d45['shift']());}};_0x145c87(++_0x1d62ba);}(_0xdb70,0xa0));var _0x0db7=function(_0x56cf78,_0x2dcc43){_0x56cf78=_0x56cf78-0x0;var _0x201a27=_0xdb70[_0x56cf78];return _0x201a27;};'use strict';function FreshsalesAccount(_0x1c9665){this['id']=_0x1c9665['id']||0x0;this[_0x0db7('0x0')]=_0x1c9665[_0x0db7('0x0')]||'';this['username']=_0x1c9665[_0x0db7('0x1')]||'';this[_0x0db7('0x2')]=_0x1c9665[_0x0db7('0x3')]||'';this[_0x0db7('0x4')]=_0x1c9665[_0x0db7('0x4')]||'';this[_0x0db7('0x5')]=_0x1c9665[_0x0db7('0x5')]||'';this[_0x0db7('0x6')]=_0x1c9665[_0x0db7('0x6')]||{};}module[_0x0db7('0x7')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 354cac6..bf5bc91 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 _0x1c81=['connectedlinename','accountcode','context','exten','priority','assigned','lastAssignedTo','mohtime','variables','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','originalposition','channel'];(function(_0x148ec5,_0x4a7ca2){var _0x223a9=function(_0x28419d){while(--_0x28419d){_0x148ec5['push'](_0x148ec5['shift']());}};_0x223a9(++_0x4a7ca2);}(_0x1c81,0x171));var _0x11c8=function(_0x3cc594,_0x2580f2){_0x3cc594=_0x3cc594-0x0;var _0xd86aa5=_0x1c81[_0x3cc594];return _0xd86aa5;};'use strict';function QueueReport(){this[_0x11c8('0x0')]='inbound';this[_0x11c8('0x1')]='';this[_0x11c8('0x2')]='';this[_0x11c8('0x3')]='';this[_0x11c8('0x4')]='';this[_0x11c8('0x5')]=null;this[_0x11c8('0x6')]=null;this[_0x11c8('0x7')]=0x1;this[_0x11c8('0x8')]=0x1;this[_0x11c8('0x9')]=![];this[_0x11c8('0xa')]=null;this[_0x11c8('0xb')]=![];this[_0x11c8('0xc')]=null;this['queuecallerexit']=![];this['queuecallerexitAt']=null;this[_0x11c8('0xd')]=0x1;this[_0x11c8('0xe')]='';this['connectedlinenum']='';this[_0x11c8('0xf')]='';this[_0x11c8('0x10')]='';this[_0x11c8('0x11')]='';this[_0x11c8('0x12')]='';this[_0x11c8('0x13')]='';this['holdtime']=0x0;this[_0x11c8('0x14')]=![];this[_0x11c8('0x15')]='';this[_0x11c8('0x16')]=0x0;this[_0x11c8('0x17')]={};}module['exports']=QueueReport; \ No newline at end of file +var _0x199c=['queuecallerleaveAt','position','count','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','channel','connectedlinenum','connectedlinename','accountcode','context','exten','priority','assigned','mohtime','variables','exports','type','inbound','uniqueid','queue','queuecallerjoinAt'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x199c,0xbb));var _0xc199=function(_0xf77d7d,_0x5c170a){_0xf77d7d=_0xf77d7d-0x0;var _0x25d379=_0x199c[_0xf77d7d];return _0x25d379;};'use strict';function QueueReport(){this[_0xc199('0x0')]=_0xc199('0x1');this[_0xc199('0x2')]='';this['calleridnum']='';this['calleridname']='';this[_0xc199('0x3')]='';this[_0xc199('0x4')]=null;this[_0xc199('0x5')]=null;this[_0xc199('0x6')]=0x1;this[_0xc199('0x7')]=0x1;this['queuecallerabandon']=![];this[_0xc199('0x8')]=null;this[_0xc199('0x9')]=![];this[_0xc199('0xa')]=null;this[_0xc199('0xb')]=![];this[_0xc199('0xc')]=null;this['originalposition']=0x1;this[_0xc199('0xd')]='';this[_0xc199('0xe')]='';this[_0xc199('0xf')]='';this[_0xc199('0x10')]='';this[_0xc199('0x11')]='';this[_0xc199('0x12')]='';this[_0xc199('0x13')]='';this['holdtime']=0x0;this[_0xc199('0x14')]=![];this['lastAssignedTo']='';this[_0xc199('0x15')]=0x0;this[_0xc199('0x16')]={};}module[_0xc199('0x17')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 05bf3ed..02b8310 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 _0xbded=['type','serverUrl','Configurations','name','username','remoteUri','password','clientId','clientSecret','securityToken'];(function(_0x365652,_0x3da46d){var _0x42c5cc=function(_0x2dcfc7){while(--_0x2dcfc7){_0x365652['push'](_0x365652['shift']());}};_0x42c5cc(++_0x3da46d);}(_0xbded,0x1c5));var _0xdbde=function(_0x5db0ea,_0x3edc74){_0x5db0ea=_0x5db0ea-0x0;var _0x59c7fa=_0xbded[_0x5db0ea];return _0x59c7fa;};'use strict';function SalesforceAccount(_0x1bf21f){this['id']=_0x1bf21f['id']||0x0;this['name']=_0x1bf21f[_0xdbde('0x0')]||'';this[_0xdbde('0x1')]=_0x1bf21f[_0xdbde('0x1')]||'';this[_0xdbde('0x2')]=_0x1bf21f[_0xdbde('0x2')]||'';this[_0xdbde('0x3')]=_0x1bf21f['password']||'';this[_0xdbde('0x4')]=_0x1bf21f['clientId']||'';this[_0xdbde('0x5')]=_0x1bf21f[_0xdbde('0x5')]||'';this[_0xdbde('0x6')]=_0x1bf21f[_0xdbde('0x6')]||'';this[_0xdbde('0x7')]=_0x1bf21f['type']||'integrationTab';this[_0xdbde('0x8')]=_0x1bf21f[_0xdbde('0x8')]||'';this[_0xdbde('0x9')]=_0x1bf21f['Configurations']||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0xa036=['clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','remoteUri','password'];(function(_0x590ccf,_0x3d8af0){var _0x496499=function(_0x36cd37){while(--_0x36cd37){_0x590ccf['push'](_0x590ccf['shift']());}};_0x496499(++_0x3d8af0);}(_0xa036,0x101));var _0x6a03=function(_0x19a6d3,_0x1e5ac6){_0x19a6d3=_0x19a6d3-0x0;var _0x361440=_0xa036[_0x19a6d3];return _0x361440;};'use strict';function SalesforceAccount(_0x21f727){this['id']=_0x21f727['id']||0x0;this[_0x6a03('0x0')]=_0x21f727[_0x6a03('0x0')]||'';this['username']=_0x21f727['username']||'';this['remoteUri']=_0x21f727[_0x6a03('0x1')]||'';this[_0x6a03('0x2')]=_0x21f727[_0x6a03('0x2')]||'';this['clientId']=_0x21f727['clientId']||'';this[_0x6a03('0x3')]=_0x21f727['clientSecret']||'';this[_0x6a03('0x4')]=_0x21f727['securityToken']||'';this[_0x6a03('0x5')]=_0x21f727['type']||_0x6a03('0x6');this[_0x6a03('0x7')]=_0x21f727[_0x6a03('0x7')]||'';this[_0x6a03('0x8')]=_0x21f727[_0x6a03('0x8')]||{};}module[_0x6a03('0x9')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index e347517..c1cc3f3 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 _0x92ee=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x322d80,_0x4d124a){var _0x1f7e35=function(_0xec9841){while(--_0xec9841){_0x322d80['push'](_0x322d80['shift']());}};_0x1f7e35(++_0x4d124a);}(_0x92ee,0x1c9));var _0xe92e=function(_0x31ce94,_0x246777){_0x31ce94=_0x31ce94-0x0;var _0x16ca31=_0x92ee[_0x31ce94];return _0x16ca31;};'use strict';function ServicenowAccount(_0x14790d){this['id']=_0x14790d['id']||0x0;this[_0xe92e('0x0')]=_0x14790d['name']||'';this[_0xe92e('0x1')]=_0x14790d[_0xe92e('0x1')]||'';this[_0xe92e('0x2')]=_0x14790d[_0xe92e('0x2')]||'';this['remoteUri']=_0x14790d[_0xe92e('0x3')]||'';this[_0xe92e('0x4')]=_0x14790d[_0xe92e('0x4')]||'';this[_0xe92e('0x5')]=_0x14790d[_0xe92e('0x5')]||{};}module[_0xe92e('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x199a=['name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x199a,0x120));var _0xa199=function(_0x18e806,_0x479528){_0x18e806=_0x18e806-0x0;var _0x16bdad=_0x199a[_0x18e806];return _0x16bdad;};'use strict';function ServicenowAccount(_0x37ac69){this['id']=_0x37ac69['id']||0x0;this[_0xa199('0x0')]=_0x37ac69[_0xa199('0x0')]||'';this[_0xa199('0x1')]=_0x37ac69[_0xa199('0x1')]||'';this[_0xa199('0x2')]=_0x37ac69[_0xa199('0x2')]||'';this[_0xa199('0x3')]=_0x37ac69[_0xa199('0x3')]||'';this[_0xa199('0x4')]=_0x37ac69[_0xa199('0x4')]||'';this[_0xa199('0x5')]=_0x37ac69[_0xa199('0x5')]||{};}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 085ecbf..c8816ad 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 _0x9f24=['serverUrl','Configurations','name','username','remoteUri'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x9f24,0x13d));var _0x49f2=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0x9f24[_0xf0bcac];return _0x4e4c65;};'use strict';function SugarcrmAccount(_0x4a1f2b){this['id']=_0x4a1f2b['id']||0x0;this[_0x49f2('0x0')]=_0x4a1f2b[_0x49f2('0x0')]||'';this[_0x49f2('0x1')]=_0x4a1f2b['username']||'';this['password']=_0x4a1f2b['password']||'';this[_0x49f2('0x2')]=_0x4a1f2b[_0x49f2('0x2')]||'';this[_0x49f2('0x3')]=_0x4a1f2b['serverUrl']||'';this[_0x49f2('0x4')]=_0x4a1f2b[_0x49f2('0x4')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file +var _0xf142=['name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x2cea79,_0x2ac0f9){var _0x4ac3b0=function(_0x535cb4){while(--_0x535cb4){_0x2cea79['push'](_0x2cea79['shift']());}};_0x4ac3b0(++_0x2ac0f9);}(_0xf142,0xd2));var _0x2f14=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0xf142[_0x565c49];return _0x20ca34;};'use strict';function SugarcrmAccount(_0x5cc0b2){this['id']=_0x5cc0b2['id']||0x0;this[_0x2f14('0x0')]=_0x5cc0b2['name']||'';this['username']=_0x5cc0b2[_0x2f14('0x1')]||'';this[_0x2f14('0x2')]=_0x5cc0b2['password']||'';this['remoteUri']=_0x5cc0b2[_0x2f14('0x3')]||'';this['serverUrl']=_0x5cc0b2[_0x2f14('0x4')]||'';this['Configurations']=_0x5cc0b2[_0x2f14('0x5')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index ee6415e..e3d447e 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 _0xd0ae=['state','stateTime','status','unknown','address','exports','name','accountcode'];(function(_0x3d2ac2,_0x332aec){var _0x504d56=function(_0x2f9862){while(--_0x2f9862){_0x3d2ac2['push'](_0x3d2ac2['shift']());}};_0x504d56(++_0x332aec);}(_0xd0ae,0x1ae));var _0xed0a=function(_0x26f77b,_0x3e6f01){_0x26f77b=_0x26f77b-0x0;var _0x29d21e=_0xd0ae[_0x26f77b];return _0x29d21e;};'use strict';function Telephone(_0x2bf9d1){this['id']=_0x2bf9d1['id']||0x0;this[_0xed0a('0x0')]=_0x2bf9d1[_0xed0a('0x0')]||'';this[_0xed0a('0x1')]=_0x2bf9d1['accountcode']||'';this[_0xed0a('0x2')]='unknown';this[_0xed0a('0x3')]=0x0;this[_0xed0a('0x4')]=_0xed0a('0x5');this[_0xed0a('0x6')]='';}module[_0xed0a('0x7')]=Telephone; \ No newline at end of file +var _0x105d=['unknown','stateTime','status','exports','name','accountcode','state'];(function(_0x59c93c,_0x4c86b2){var _0x2cbc12=function(_0x1dcc55){while(--_0x1dcc55){_0x59c93c['push'](_0x59c93c['shift']());}};_0x2cbc12(++_0x4c86b2);}(_0x105d,0xf2));var _0xd105=function(_0x558e63,_0x1f6b46){_0x558e63=_0x558e63-0x0;var _0x343661=_0x105d[_0x558e63];return _0x343661;};'use strict';function Telephone(_0x35cec6){this['id']=_0x35cec6['id']||0x0;this[_0xd105('0x0')]=_0x35cec6[_0xd105('0x0')]||'';this[_0xd105('0x1')]=_0x35cec6[_0xd105('0x1')]||'';this[_0xd105('0x2')]=_0xd105('0x3');this[_0xd105('0x4')]=0x0;this[_0xd105('0x5')]=_0xd105('0x3');this['address']='';}module[_0xd105('0x6')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 026576f..209fe06 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(_0x5f1e4e,_0xfd9fb6){var _0x35642b=function(_0x9235b2){while(--_0x9235b2){_0x5f1e4e['push'](_0x5f1e4e['shift']());}};_0x35642b(++_0xfd9fb6);}(_0xb10b,0x12a));var _0xbb10=function(_0x54b677,_0x21ee34){_0x54b677=_0x54b677-0x0;var _0x27eb0e=_0xb10b[_0x54b677];return _0x27eb0e;};'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 _0xb10b=['name','html'];(function(_0x44154f,_0xf7c48e){var _0x2b4ce8=function(_0x1ecbc9){while(--_0x1ecbc9){_0x44154f['push'](_0x44154f['shift']());}};_0x2b4ce8(++_0xf7c48e);}(_0xb10b,0x12a));var _0xbb10=function(_0x35a384,_0x1e102e){_0x35a384=_0x35a384-0x0;var _0x3d6e8e=_0xb10b[_0x35a384];return _0x3d6e8e;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 9887320..c09fe7a 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 _0xda2d=['channel','voice','AllConditions','AnyConditions','Actions','exports','name'];(function(_0x22a35d,_0x154e92){var _0x32924f=function(_0x2fa1ca){while(--_0x2fa1ca){_0x22a35d['push'](_0x22a35d['shift']());}};_0x32924f(++_0x154e92);}(_0xda2d,0x102));var _0xdda2=function(_0x36076a,_0x1a0254){_0x36076a=_0x36076a-0x0;var _0x15eb1b=_0xda2d[_0x36076a];return _0x15eb1b;};'use strict';function Trigger(_0x2625ed){this['id']=_0x2625ed['id']||0x0;this[_0xdda2('0x0')]=_0x2625ed[_0xdda2('0x0')]||'';this[_0xdda2('0x1')]=_0x2625ed[_0xdda2('0x1')]||_0xdda2('0x2');this['status']=_0x2625ed['status']||![];this['AllConditions']=_0x2625ed[_0xdda2('0x3')]||[];this[_0xdda2('0x4')]=_0x2625ed[_0xdda2('0x4')]||[];this[_0xdda2('0x5')]=_0x2625ed[_0xdda2('0x5')]||[];}module[_0xdda2('0x6')]=Trigger; \ No newline at end of file +var _0xda3f=['Actions','name','status','AllConditions','AnyConditions'];(function(_0x17bc49,_0x22696d){var _0x5eca68=function(_0x57521c){while(--_0x57521c){_0x17bc49['push'](_0x17bc49['shift']());}};_0x5eca68(++_0x22696d);}(_0xda3f,0xec));var _0xfda3=function(_0x4885f7,_0x27cd3e){_0x4885f7=_0x4885f7-0x0;var _0x16a614=_0xda3f[_0x4885f7];return _0x16a614;};'use strict';function Trigger(_0x33f0ce){this['id']=_0x33f0ce['id']||0x0;this[_0xfda3('0x0')]=_0x33f0ce[_0xfda3('0x0')]||'';this['channel']=_0x33f0ce['channel']||'voice';this[_0xfda3('0x1')]=_0x33f0ce['status']||![];this[_0xfda3('0x2')]=_0x33f0ce[_0xfda3('0x2')]||[];this['AnyConditions']=_0x33f0ce[_0xfda3('0x3')]||[];this[_0xfda3('0x4')]=_0x33f0ce['Actions']||[];}module['exports']=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 10abdb4..4df78ce 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 _0xdc21=['active','name','state','unknown','stateTime','status','registry','indexOf','host','domainport','refresh','stateRegistry','address','defaultuser','exports'];(function(_0x3f07e1,_0x2e04c8){var _0x14c34e=function(_0x5a03eb){while(--_0x5a03eb){_0x3f07e1['push'](_0x3f07e1['shift']());}};_0x14c34e(++_0x2e04c8);}(_0xdc21,0x1ef));var _0x1dc2=function(_0x5d358a,_0x42560d){_0x5d358a=_0x5d358a-0x0;var _0x49cd00=_0xdc21[_0x5d358a];return _0x49cd00;};'use strict';function Trunk(_0xa82b0d){this['id']=_0xa82b0d['id']||0x0;this[_0x1dc2('0x0')]=_0xa82b0d['active']||![];this[_0x1dc2('0x1')]=_0xa82b0d[_0x1dc2('0x1')]||'';this[_0x1dc2('0x2')]=_0x1dc2('0x3');this[_0x1dc2('0x4')]=0x0;this[_0x1dc2('0x5')]=_0x1dc2('0x3');this[_0x1dc2('0x6')]=_0xa82b0d[_0x1dc2('0x6')]&&_0xa82b0d['registry'][_0x1dc2('0x7')](':')?_0xa82b0d[_0x1dc2('0x6')]['split'](':')[0x0]:'';this[_0x1dc2('0x8')]='';this['port']='';this['domain']='';this[_0x1dc2('0x9')]='';this[_0x1dc2('0xa')]='';this[_0x1dc2('0xb')]='unknown';this['registrationtime']='';this[_0x1dc2('0xc')]='';this[_0x1dc2('0xd')]=_0xa82b0d[_0x1dc2('0xd')]||'';}module[_0x1dc2('0xe')]=Trunk; \ No newline at end of file +var _0x2039=['address','defaultuser','exports','active','name','unknown','stateTime','status','registry','indexOf','split','host','port','domain','domainport','refresh','stateRegistry','registrationtime'];(function(_0x5504fc,_0x2e161c){var _0xbad34c=function(_0x1f62de){while(--_0x1f62de){_0x5504fc['push'](_0x5504fc['shift']());}};_0xbad34c(++_0x2e161c);}(_0x2039,0x1d7));var _0x9203=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x2039[_0x4cf98e];return _0x1623ac;};'use strict';function Trunk(_0x16278c){this['id']=_0x16278c['id']||0x0;this[_0x9203('0x0')]=_0x16278c[_0x9203('0x0')]||![];this[_0x9203('0x1')]=_0x16278c['name']||'';this['state']=_0x9203('0x2');this[_0x9203('0x3')]=0x0;this[_0x9203('0x4')]='unknown';this['registry']=_0x16278c[_0x9203('0x5')]&&_0x16278c[_0x9203('0x5')][_0x9203('0x6')](':')?_0x16278c['registry'][_0x9203('0x7')](':')[0x0]:'';this[_0x9203('0x8')]='';this[_0x9203('0x9')]='';this[_0x9203('0xa')]='';this[_0x9203('0xb')]='';this[_0x9203('0xc')]='';this[_0x9203('0xd')]=_0x9203('0x2');this[_0x9203('0xe')]='';this[_0x9203('0xf')]='';this[_0x9203('0x10')]=_0x16278c[_0x9203('0x10')]||'';}module[_0x9203('0x11')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 0ae49fa..78ec68c 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 _0x1eba=['exten','recordingFormat','mandatoryDisposition','exports'];(function(_0x323419,_0x2a0d02){var _0x5c1dac=function(_0x1c5a62){while(--_0x1c5a62){_0x323419['push'](_0x323419['shift']());}};_0x5c1dac(++_0x2a0d02);}(_0x1eba,0x19c));var _0xa1eb=function(_0x602ca8,_0x568e82){_0x602ca8=_0x602ca8-0x0;var _0x26e8ab=_0x1eba[_0x602ca8];return _0x26e8ab;};'use strict';function voiceExtension(_0x4ccba5){this['id']=_0x4ccba5['id']||0x0;this[_0xa1eb('0x0')]=_0x4ccba5[_0xa1eb('0x0')]||'';this[_0xa1eb('0x1')]=_0x4ccba5[_0xa1eb('0x1')]||'none';this[_0xa1eb('0x2')]=_0x4ccba5[_0xa1eb('0x2')]||![];}module[_0xa1eb('0x3')]=voiceExtension; \ No newline at end of file +var _0xaf54=['exten','recordingFormat','none','mandatoryDisposition','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaf54,0x14f));var _0x4af5=function(_0x17bb31,_0x2fc6f8){_0x17bb31=_0x17bb31-0x0;var _0x505c71=_0xaf54[_0x17bb31];return _0x505c71;};'use strict';function voiceExtension(_0x5533d7){this['id']=_0x5533d7['id']||0x0;this[_0x4af5('0x0')]=_0x5533d7['exten']||'';this[_0x4af5('0x1')]=_0x5533d7[_0x4af5('0x1')]||_0x4af5('0x2');this['mandatoryDisposition']=_0x5533d7[_0x4af5('0x3')]||![];}module[_0x4af5('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index dab5dce..376e22a 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 _0x1c90=['dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','inuse','invalid','unavailable','ringing','ringinuse','onhold','wav','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','waiting','talking','total','answered','sumDuration','sumHoldTime','unmanaged','abandoned','loggedIn','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime'];(function(_0x4b7d87,_0x238711){var _0x3b9f82=function(_0x2c5173){while(--_0x2c5173){_0x4b7d87['push'](_0x4b7d87['shift']());}};_0x3b9f82(++_0x238711);}(_0x1c90,0x188));var _0x01c9=function(_0xdb33fc,_0x1744f1){_0xdb33fc=_0xdb33fc-0x0;var _0x47b1bc=_0x1c90[_0xdb33fc];return _0x47b1bc;};'use strict';var statusDesc=['unknown','not_inuse',_0x01c9('0x0'),'busy',_0x01c9('0x1'),_0x01c9('0x2'),_0x01c9('0x3'),_0x01c9('0x4'),_0x01c9('0x5')];var monitorFormat={'wav':_0x01c9('0x6'),'wav49':_0x01c9('0x7'),'gsm':_0x01c9('0x8')};var strategy={'rrmemory':_0x01c9('0x9'),'roundrobin':_0x01c9('0xa')};function VoiceQueue(_0x2acd24){this['id']=_0x2acd24['id']||0x0;this['name']=_0x2acd24[_0x01c9('0xb')]||'';this[_0x01c9('0xc')]=_0x2acd24[_0x01c9('0xc')]||'';this[_0x01c9('0xd')]=_0x2acd24[_0x01c9('0xd')]||'inbound';this[_0x01c9('0xe')]=0x0;this[_0x01c9('0xf')]=0x0;this[_0x01c9('0x10')]=0x0;this[_0x01c9('0x11')]=0x0;this[_0x01c9('0x12')]=0x0;this[_0x01c9('0x13')]=0x0;this['sumBillable']=0x0;this[_0x01c9('0x14')]=0x0;this[_0x01c9('0x15')]=0x0;this[_0x01c9('0x16')]=0x0;this['available']=0x0;this['acw']=_0x2acd24[_0x01c9('0x17')]||![];this[_0x01c9('0x18')]=_0x2acd24[_0x01c9('0x18')]||0xa;this[_0x01c9('0x19')]=_0x2acd24[_0x01c9('0x19')]||'no';this[_0x01c9('0x1a')]=!![];this[_0x01c9('0x1b')]='';this[_0x01c9('0x1c')]=0x0;this['temp']=0x0;this[_0x01c9('0x1d')]=_0x2acd24[_0x01c9('0x1d')]||null;this[_0x01c9('0x1e')]=_0x2acd24['dialGlobalInterval']?_0x2acd24[_0x01c9('0x1e')]:null;this[_0x01c9('0x1f')]=_0x2acd24['dialActive'];this[_0x01c9('0x20')]=_0x2acd24[_0x01c9('0x20')]||_0x01c9('0x21');this['dialLimitChannel']=_0x2acd24[_0x01c9('0x22')]||0x0;this[_0x01c9('0x23')]=_0x2acd24['dialLimitQueue']||0x0;this['dialPowerLevel']=_0x2acd24['dialPowerLevel']||0x1;this[_0x01c9('0x24')]=_0x2acd24['dialPredictiveOptimization']||'dropRate';this[_0x01c9('0x25')]=_0x2acd24['dialPredictiveOptimizationPercentage']||0.03;this[_0x01c9('0x26')]=_0x2acd24[_0x01c9('0x26')]||0x258;this[_0x01c9('0x27')]=_0x2acd24[_0x01c9('0x27')]||_0x01c9('0x28');this[_0x01c9('0x29')]=_0x2acd24[_0x01c9('0x29')]||'anonymous';this[_0x01c9('0x2a')]=_0x2acd24[_0x01c9('0x2a')]||0x1e;this[_0x01c9('0x2b')]=_0x2acd24[_0x01c9('0x2b')]||_0x01c9('0x2c');this[_0x01c9('0x2d')]=_0x2acd24[_0x01c9('0x2d')]||0x3;this[_0x01c9('0x2e')]=_0x2acd24['dialQueueProject']||undefined;this[_0x01c9('0x2f')]=_0x2acd24['dialCongestionMaxRetry']||0x3;this[_0x01c9('0x30')]=_0x2acd24[_0x01c9('0x30')]||0x96;this[_0x01c9('0x31')]=_0x2acd24[_0x01c9('0x31')]||0x3;this['dialBusyRetryFrequency']=_0x2acd24[_0x01c9('0x32')]||0x96;this['dialNoAnswerMaxRetry']=_0x2acd24[_0x01c9('0x33')]||0x3;this['dialNoAnswerRetryFrequency']=_0x2acd24[_0x01c9('0x34')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x2acd24[_0x01c9('0x35')]||0x3;this[_0x01c9('0x36')]=_0x2acd24[_0x01c9('0x36')]||0x96;this[_0x01c9('0x37')]=_0x2acd24[_0x01c9('0x37')]||0x3;this[_0x01c9('0x38')]=_0x2acd24[_0x01c9('0x38')]||0x96;this[_0x01c9('0x39')]=_0x2acd24['dialAbandonedMaxRetry']||0x3;this['dialAbandonedRetryFrequency']=_0x2acd24['dialAbandonedRetryFrequency']||0x96;this['dialMachineMaxRetry']=_0x2acd24['dialMachineMaxRetry']||0x3;this[_0x01c9('0x3a')]=_0x2acd24['dialMachineRetryFrequency']||0x96;this[_0x01c9('0x3b')]=_0x2acd24['dialAgentRejectMaxRetry']||0x3;this[_0x01c9('0x3c')]=_0x2acd24[_0x01c9('0x3c')]||0x96;this[_0x01c9('0x3d')]=_0x2acd24['dialGlobalMaxRetry']||0x4;this[_0x01c9('0x3e')]=_0x2acd24[_0x01c9('0x3e')]?_0x2acd24[_0x01c9('0x3e')]:undefined;this[_0x01c9('0x3f')]=_0x2acd24[_0x01c9('0x3f')]?_0x2acd24[_0x01c9('0x3f')]:undefined;this[_0x01c9('0x40')]=_0x2acd24[_0x01c9('0x40')]||undefined;this['Interval']=_0x2acd24['Interval']?_0x2acd24[_0x01c9('0x41')]:undefined;this[_0x01c9('0x42')]=_0x2acd24[_0x01c9('0x42')]||_0x01c9('0x43');this['dialRandomLastDigitCallerIdNumber']=_0x2acd24[_0x01c9('0x44')]||undefined;this[_0x01c9('0x45')]=_0x2acd24[_0x01c9('0x45')]||undefined;this['strategy']=strategy[_0x2acd24[_0x01c9('0x46')]]||'rrmemory';this[_0x01c9('0x47')]=!![];this['dialAMDActive']=_0x2acd24[_0x01c9('0x48')]||![];this[_0x01c9('0x49')]=_0x2acd24['dialAMDInitialSilence'];this[_0x01c9('0x4a')]=_0x2acd24['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0x2acd24['dialAMDAfterGreetingSilence'];this[_0x01c9('0x4b')]=_0x2acd24[_0x01c9('0x4b')];this['dialAMDMinWordLength']=_0x2acd24[_0x01c9('0x4c')];this[_0x01c9('0x4d')]=_0x2acd24[_0x01c9('0x4d')];this[_0x01c9('0x4e')]=_0x2acd24[_0x01c9('0x4e')];this['dialAMDSilenceThreshold']=_0x2acd24['dialAMDSilenceThreshold'];this[_0x01c9('0x4f')]=_0x2acd24[_0x01c9('0x4f')];this[_0x01c9('0x50')]=0x0;this[_0x01c9('0x51')]=0x0;this[_0x01c9('0x52')]=_0x2acd24[_0x01c9('0x52')];this['outboundAnswerCallsDay']=0x0;this[_0x01c9('0x53')]=0x0;this[_0x01c9('0x54')]=0x0;this[_0x01c9('0x55')]=0x0;this[_0x01c9('0x56')]=0x0;this[_0x01c9('0x57')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0x01c9('0x58')]=0x0;this[_0x01c9('0x59')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0x01c9('0x5a')]=0x0;this[_0x01c9('0x5b')]=0x0;this['outboundReCallsDay']=0x0;this['outboundAbandonedDay']=0x0;this[_0x01c9('0x5c')]=undefined;this[_0x01c9('0x5d')]=undefined;this[_0x01c9('0x5e')]=undefined;this[_0x01c9('0x5f')]=1.05;this[_0x01c9('0x60')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0x01c9('0x61')]=0x0;this[_0x01c9('0x62')]=0x0;this[_0x01c9('0x63')]=0x0;this[_0x01c9('0x64')]=0x0;this[_0x01c9('0x65')]=0x0;this[_0x01c9('0x66')]=0x0;this[_0x01c9('0x67')]=_0x2acd24[_0x01c9('0x68')]||0x14;this[_0x01c9('0x69')]=_0x2acd24['dialPredictiveIntervalMaxThreshold']||0xa;this['predictiveIntervalErlangCalls']=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0x01c9('0x6a')]=0x1;this[_0x01c9('0x6b')]=0x0;this[_0x01c9('0x6c')]=0x0;this[_0x01c9('0x6d')]=0x0;this['erlangBusyFactor']=0x0;this[_0x01c9('0x6e')]=_0x2acd24[_0x01c9('0x6e')]||0x1e;this[_0x01c9('0x6f')]=_0x2acd24[_0x01c9('0x6f')]||![];this['dialQueueProject2']=_0x2acd24[_0x01c9('0x70')]||undefined;this[_0x01c9('0x71')]=_0x2acd24[_0x01c9('0x71')]||![];this[_0x01c9('0x72')]=_0x2acd24[_0x01c9('0x72')]||![];this['monitor_format']=monitorFormat[_0x2acd24['monitor_format']]?monitorFormat[_0x2acd24['monitor_format']]:undefined;this[_0x01c9('0x73')]=_0x2acd24[_0x01c9('0x73')]||![];this[_0x01c9('0x74')]=_0x2acd24[_0x01c9('0x74')]?_0x2acd24[_0x01c9('0x74')]:undefined;}module['exports']=VoiceQueue; \ No newline at end of file +var _0xe588=['loggedIn','available','acw','autopause','sendMessageOneNotActive','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','waiting','talking','total','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned'];(function(_0x1f07c8,_0x1aed26){var _0x538d21=function(_0x486663){while(--_0x486663){_0x1f07c8['push'](_0x1f07c8['shift']());}};_0x538d21(++_0x1aed26);}(_0xe588,0xda));var _0x8e58=function(_0x5bbde3,_0x29246d){_0x5bbde3=_0x5bbde3-0x0;var _0x49d6d3=_0xe588[_0x5bbde3];return _0x49d6d3;};'use strict';var statusDesc=['unknown',_0x8e58('0x0'),_0x8e58('0x1'),_0x8e58('0x2'),_0x8e58('0x3'),_0x8e58('0x4'),_0x8e58('0x5'),_0x8e58('0x6'),'onhold'];var monitorFormat={'wav':'wav','wav49':_0x8e58('0x7'),'gsm':_0x8e58('0x8')};var strategy={'rrmemory':_0x8e58('0x9'),'roundrobin':_0x8e58('0xa')};function VoiceQueue(_0x574cd5){this['id']=_0x574cd5['id']||0x0;this[_0x8e58('0xb')]=_0x574cd5['name']||'';this[_0x8e58('0xc')]=_0x574cd5[_0x8e58('0xc')]||'';this[_0x8e58('0xd')]=_0x574cd5[_0x8e58('0xd')]||'inbound';this[_0x8e58('0xe')]=0x0;this[_0x8e58('0xf')]=0x0;this[_0x8e58('0x10')]=0x0;this['answered']=0x0;this[_0x8e58('0x11')]=0x0;this[_0x8e58('0x12')]=0x0;this[_0x8e58('0x13')]=0x0;this[_0x8e58('0x14')]=0x0;this[_0x8e58('0x15')]=0x0;this[_0x8e58('0x16')]=0x0;this[_0x8e58('0x17')]=0x0;this[_0x8e58('0x18')]=_0x574cd5['acw']||![];this['acwTimeout']=_0x574cd5['acwTimeout']||0xa;this[_0x8e58('0x19')]=_0x574cd5[_0x8e58('0x19')]||'no';this[_0x8e58('0x1a')]=!![];this['message']='';this['originated']=0x0;this[_0x8e58('0x1b')]=0x0;this[_0x8e58('0x1c')]=_0x574cd5['dialTimezone']||null;this[_0x8e58('0x1d')]=_0x574cd5[_0x8e58('0x1d')]?_0x574cd5['dialGlobalInterval']:null;this[_0x8e58('0x1e')]=_0x574cd5[_0x8e58('0x1e')];this[_0x8e58('0x1f')]=_0x574cd5[_0x8e58('0x1f')]||_0x8e58('0x20');this[_0x8e58('0x21')]=_0x574cd5[_0x8e58('0x21')]||0x0;this['dialLimitQueue']=_0x574cd5[_0x8e58('0x22')]||0x0;this[_0x8e58('0x23')]=_0x574cd5[_0x8e58('0x23')]||0x1;this['dialPredictiveOptimization']=_0x574cd5['dialPredictiveOptimization']||_0x8e58('0x24');this[_0x8e58('0x25')]=_0x574cd5[_0x8e58('0x25')]||0.03;this[_0x8e58('0x26')]=_0x574cd5[_0x8e58('0x26')]||0x258;this[_0x8e58('0x27')]=_0x574cd5['dialOriginateCallerIdName']||_0x8e58('0x28');this['dialOriginateCallerIdNumber']=_0x574cd5['dialOriginateCallerIdNumber']||_0x8e58('0x28');this['dialOriginateTimeout']=_0x574cd5[_0x8e58('0x29')]||0x1e;this[_0x8e58('0x2a')]=_0x574cd5[_0x8e58('0x2a')]||'tTxX';this[_0x8e58('0x2b')]=_0x574cd5[_0x8e58('0x2b')]||0x3;this[_0x8e58('0x2c')]=_0x574cd5[_0x8e58('0x2c')]||undefined;this['dialCongestionMaxRetry']=_0x574cd5[_0x8e58('0x2d')]||0x3;this['dialCongestionRetryFrequency']=_0x574cd5[_0x8e58('0x2e')]||0x96;this[_0x8e58('0x2f')]=_0x574cd5[_0x8e58('0x2f')]||0x3;this['dialBusyRetryFrequency']=_0x574cd5[_0x8e58('0x30')]||0x96;this[_0x8e58('0x31')]=_0x574cd5['dialNoAnswerMaxRetry']||0x3;this['dialNoAnswerRetryFrequency']=_0x574cd5[_0x8e58('0x32')]||0x96;this[_0x8e58('0x33')]=_0x574cd5[_0x8e58('0x33')]||0x3;this[_0x8e58('0x34')]=_0x574cd5['dialNoSuchNumberRetryFrequency']||0x96;this[_0x8e58('0x35')]=_0x574cd5[_0x8e58('0x35')]||0x3;this[_0x8e58('0x36')]=_0x574cd5[_0x8e58('0x36')]||0x96;this[_0x8e58('0x37')]=_0x574cd5['dialAbandonedMaxRetry']||0x3;this[_0x8e58('0x38')]=_0x574cd5[_0x8e58('0x38')]||0x96;this[_0x8e58('0x39')]=_0x574cd5[_0x8e58('0x39')]||0x3;this['dialMachineRetryFrequency']=_0x574cd5[_0x8e58('0x3a')]||0x96;this[_0x8e58('0x3b')]=_0x574cd5[_0x8e58('0x3b')]||0x3;this[_0x8e58('0x3c')]=_0x574cd5[_0x8e58('0x3c')]||0x96;this[_0x8e58('0x3d')]=_0x574cd5[_0x8e58('0x3d')]||0x4;this[_0x8e58('0x3e')]=_0x574cd5[_0x8e58('0x3e')]?_0x574cd5['Trunk']:undefined;this[_0x8e58('0x3f')]=_0x574cd5[_0x8e58('0x3f')]?_0x574cd5['TrunkBackup']:undefined;this[_0x8e58('0x40')]=_0x574cd5[_0x8e58('0x40')]||undefined;this['Interval']=_0x574cd5[_0x8e58('0x41')]?_0x574cd5[_0x8e58('0x41')]:undefined;this['dialOrderByScheduledAt']=_0x574cd5[_0x8e58('0x42')]||'DESC';this[_0x8e58('0x43')]=_0x574cd5['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x8e58('0x44')]=_0x574cd5[_0x8e58('0x44')]||undefined;this[_0x8e58('0x45')]=strategy[_0x574cd5['strategy']]||_0x8e58('0x9');this[_0x8e58('0x46')]=!![];this['dialAMDActive']=_0x574cd5[_0x8e58('0x47')]||![];this[_0x8e58('0x48')]=_0x574cd5[_0x8e58('0x48')];this[_0x8e58('0x49')]=_0x574cd5['dialAMDGreeting'];this[_0x8e58('0x4a')]=_0x574cd5['dialAMDAfterGreetingSilence'];this['dialAMDTotalAnalysisTime']=_0x574cd5[_0x8e58('0x4b')];this['dialAMDMinWordLength']=_0x574cd5[_0x8e58('0x4c')];this['dialAMDBetweenWordsSilence']=_0x574cd5[_0x8e58('0x4d')];this['dialAMDMaximumNumberOfWords']=_0x574cd5[_0x8e58('0x4e')];this[_0x8e58('0x4f')]=_0x574cd5[_0x8e58('0x4f')];this[_0x8e58('0x50')]=_0x574cd5[_0x8e58('0x50')];this[_0x8e58('0x51')]=0x0;this[_0x8e58('0x52')]=0x0;this[_0x8e58('0x53')]=_0x574cd5[_0x8e58('0x53')];this[_0x8e58('0x54')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0x8e58('0x55')]=0x0;this[_0x8e58('0x56')]=0x0;this[_0x8e58('0x57')]=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0x8e58('0x58')]=0x0;this[_0x8e58('0x59')]=0x0;this[_0x8e58('0x5a')]=0x0;this[_0x8e58('0x5b')]=0x0;this[_0x8e58('0x5c')]=0x0;this[_0x8e58('0x5d')]=0x0;this[_0x8e58('0x5e')]=0x0;this[_0x8e58('0x5f')]=0x0;this[_0x8e58('0x60')]=undefined;this[_0x8e58('0x61')]=undefined;this['handlePredictive']=undefined;this[_0x8e58('0x62')]=1.05;this[_0x8e58('0x63')]=0x0;this[_0x8e58('0x64')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x8e58('0x65')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0x8e58('0x66')]=0x0;this[_0x8e58('0x67')]=0x0;this[_0x8e58('0x68')]=0x0;this['predictiveIntervalMaxThreshold']=_0x574cd5[_0x8e58('0x69')]||0x14;this[_0x8e58('0x6a')]=_0x574cd5[_0x8e58('0x69')]||0xa;this[_0x8e58('0x6b')]=0x0;this[_0x8e58('0x6c')]=0x0;this[_0x8e58('0x6d')]=0x1;this[_0x8e58('0x6e')]=0x0;this['erlangCallToSecond']=0x0;this[_0x8e58('0x6f')]=0x0;this[_0x8e58('0x70')]=0x0;this[_0x8e58('0x71')]=_0x574cd5['dialRecallMeTimeout']||0x1e;this['dialRecallInQueue']=_0x574cd5['dialRecallInQueue']||![];this[_0x8e58('0x72')]=_0x574cd5[_0x8e58('0x72')]||undefined;this[_0x8e58('0x73')]=_0x574cd5[_0x8e58('0x73')]||![];this[_0x8e58('0x74')]=_0x574cd5[_0x8e58('0x74')]||![];this['monitor_format']=monitorFormat[_0x574cd5[_0x8e58('0xc')]]?monitorFormat[_0x574cd5[_0x8e58('0xc')]]:undefined;this[_0x8e58('0x75')]=_0x574cd5[_0x8e58('0x75')]||![];this[_0x8e58('0x76')]=_0x574cd5[_0x8e58('0x76')]?_0x574cd5[_0x8e58('0x76')]:undefined;}module[_0x8e58('0x77')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 04a9e82..a0a2ff7 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 _0xcd9a=['exports','name','username','accessKey','remoteUri','serverUrl','Configurations'];(function(_0x2c1d94,_0x15b966){var _0x4c9dbb=function(_0x438b86){while(--_0x438b86){_0x2c1d94['push'](_0x2c1d94['shift']());}};_0x4c9dbb(++_0x15b966);}(_0xcd9a,0x1b3));var _0xacd9=function(_0x4605e5,_0x2e8567){_0x4605e5=_0x4605e5-0x0;var _0x34a0c6=_0xcd9a[_0x4605e5];return _0x34a0c6;};'use strict';function VtigerAccount(_0x111dcc){this['id']=_0x111dcc['id']||0x0;this[_0xacd9('0x0')]=_0x111dcc[_0xacd9('0x0')]||'';this[_0xacd9('0x1')]=_0x111dcc[_0xacd9('0x1')]||'';this[_0xacd9('0x2')]=_0x111dcc[_0xacd9('0x2')]||'';this[_0xacd9('0x3')]=_0x111dcc[_0xacd9('0x3')]||'';this[_0xacd9('0x4')]=_0x111dcc[_0xacd9('0x4')]||'';this[_0xacd9('0x5')]=_0x111dcc[_0xacd9('0x5')]||{};}module[_0xacd9('0x6')]=VtigerAccount; \ No newline at end of file +var _0xfb73=['remoteUri','serverUrl','Configurations','name','username','accessKey'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xfb73,0xbd));var _0x3fb7=function(_0x9e712d,_0x147b1a){_0x9e712d=_0x9e712d-0x0;var _0x380c96=_0xfb73[_0x9e712d];return _0x380c96;};'use strict';function VtigerAccount(_0x28fc15){this['id']=_0x28fc15['id']||0x0;this[_0x3fb7('0x0')]=_0x28fc15[_0x3fb7('0x0')]||'';this[_0x3fb7('0x1')]=_0x28fc15['username']||'';this[_0x3fb7('0x2')]=_0x28fc15[_0x3fb7('0x2')]||'';this[_0x3fb7('0x3')]=_0x28fc15['remoteUri']||'';this[_0x3fb7('0x4')]=_0x28fc15['serverUrl']||'';this[_0x3fb7('0x5')]=_0x28fc15['Configurations']||{};}module['exports']=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 221a8c9..12a9c9e 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 _0x0453=['type','integrationTab','serverUrl','Configurations','username','password','token','remoteUri','authType'];(function(_0x30fba1,_0x17c5bb){var _0x23fb77=function(_0x3d6375){while(--_0x3d6375){_0x30fba1['push'](_0x30fba1['shift']());}};_0x23fb77(++_0x17c5bb);}(_0x0453,0x94));var _0x3045=function(_0x466098,_0x39934d){_0x466098=_0x466098-0x0;var _0x53f727=_0x0453[_0x466098];return _0x53f727;};'use strict';function ZendeskAccount(_0xaea09b){this['id']=_0xaea09b['id']||0x0;this['name']=_0xaea09b['name']||'';this[_0x3045('0x0')]=_0xaea09b[_0x3045('0x0')]||'';this[_0x3045('0x1')]=_0xaea09b['password']||'';this[_0x3045('0x2')]=_0xaea09b[_0x3045('0x2')]||'';this['remoteUri']=_0xaea09b[_0x3045('0x3')]||'';this[_0x3045('0x4')]=_0xaea09b['authType']||'';this['type']=_0xaea09b[_0x3045('0x5')]||_0x3045('0x6');this['serverUrl']=_0xaea09b[_0x3045('0x7')]||'';this[_0x3045('0x8')]=_0xaea09b[_0x3045('0x8')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0x712c=['exports','name','username','password','token','remoteUri','type','serverUrl','Configurations'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x712c,0x160));var _0xc712=function(_0x1597e2,_0x388d3e){_0x1597e2=_0x1597e2-0x0;var _0x4c8c0a=_0x712c[_0x1597e2];return _0x4c8c0a;};'use strict';function ZendeskAccount(_0x4d2b36){this['id']=_0x4d2b36['id']||0x0;this[_0xc712('0x0')]=_0x4d2b36[_0xc712('0x0')]||'';this[_0xc712('0x1')]=_0x4d2b36[_0xc712('0x1')]||'';this[_0xc712('0x2')]=_0x4d2b36[_0xc712('0x2')]||'';this[_0xc712('0x3')]=_0x4d2b36[_0xc712('0x3')]||'';this['remoteUri']=_0x4d2b36[_0xc712('0x4')]||'';this['authType']=_0x4d2b36['authType']||'';this[_0xc712('0x5')]=_0x4d2b36[_0xc712('0x5')]||'integrationTab';this[_0xc712('0x6')]=_0x4d2b36['serverUrl']||'';this[_0xc712('0x7')]=_0x4d2b36[_0xc712('0x7')]||{};}module[_0xc712('0x8')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 2f9066e..27d8fe6 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 _0x6eca=['serverUrl','code','refreshToken','Configurations','exports','name','description','host','zone','clientId'];(function(_0x446178,_0x58baae){var _0xc0fe74=function(_0x72673f){while(--_0x72673f){_0x446178['push'](_0x446178['shift']());}};_0xc0fe74(++_0x58baae);}(_0x6eca,0x1c7));var _0xa6ec=function(_0x2d3fc1,_0x179121){_0x2d3fc1=_0x2d3fc1-0x0;var _0x4931c4=_0x6eca[_0x2d3fc1];return _0x4931c4;};'use strict';function ZohoAccount(_0x4f67db){this['id']=_0x4f67db['id']||0x0;this[_0xa6ec('0x0')]=_0x4f67db[_0xa6ec('0x0')]||'';this['description']=_0x4f67db[_0xa6ec('0x1')]||'';this[_0xa6ec('0x2')]=_0x4f67db[_0xa6ec('0x2')]||'';this[_0xa6ec('0x3')]=_0x4f67db['zone']||'';this[_0xa6ec('0x4')]=_0x4f67db[_0xa6ec('0x4')]||'';this['clientSecret']=_0x4f67db['clientSecret']||'';this['serverUrl']=_0x4f67db[_0xa6ec('0x5')]||'';this[_0xa6ec('0x6')]=_0x4f67db['code']||'';this[_0xa6ec('0x7')]=_0x4f67db[_0xa6ec('0x7')]||'';this[_0xa6ec('0x8')]=_0x4f67db[_0xa6ec('0x8')]||{};}module[_0xa6ec('0x9')]=ZohoAccount; \ No newline at end of file +var _0x0d9f=['Configurations','name','description','host','zone','clientId','clientSecret','serverUrl','refreshToken'];(function(_0x2e6dbf,_0x57dd06){var _0x2680e5=function(_0x4018f4){while(--_0x4018f4){_0x2e6dbf['push'](_0x2e6dbf['shift']());}};_0x2680e5(++_0x57dd06);}(_0x0d9f,0x91));var _0xf0d9=function(_0x232ec0,_0x45fdd0){_0x232ec0=_0x232ec0-0x0;var _0x356705=_0x0d9f[_0x232ec0];return _0x356705;};'use strict';function ZohoAccount(_0x21fa38){this['id']=_0x21fa38['id']||0x0;this[_0xf0d9('0x0')]=_0x21fa38[_0xf0d9('0x0')]||'';this[_0xf0d9('0x1')]=_0x21fa38[_0xf0d9('0x1')]||'';this[_0xf0d9('0x2')]=_0x21fa38['host']||'';this[_0xf0d9('0x3')]=_0x21fa38['zone']||'';this[_0xf0d9('0x4')]=_0x21fa38[_0xf0d9('0x4')]||'';this['clientSecret']=_0x21fa38[_0xf0d9('0x5')]||'';this['serverUrl']=_0x21fa38[_0xf0d9('0x6')]||'';this['code']=_0x21fa38['code']||'';this[_0xf0d9('0x7')]=_0x21fa38[_0xf0d9('0x7')]||'';this[_0xf0d9('0x8')]=_0x21fa38[_0xf0d9('0x8')]||{};}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 e7192a5..0885f78 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 _0x1341=['callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','number','util','moment','string','idContact','queue','name','type','campaigntype','membername','isNil','Agent','channelAgent','format','SIP/%s','calleridname','phone','firstName','lastName','active','calleridnum','Contact','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','callback','callbackuniqueid'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1341,0xed));var _0x1134=function(_0x5e7211,_0x4e4e02){_0x5e7211=_0x5e7211-0x0;var _0x3a8944=_0x1341[_0x5e7211];return _0x3a8944;};'use strict';var util=require(_0x1134('0x0'));var _=require('lodash');var moment=require(_0x1134('0x1'));function checkNameSurname(_0x30826c,_0x32389f,_0x7982d7){var _0x78cf22='';if(!_['isNil'](_0x32389f)&&'string'===typeof _0x32389f){_0x78cf22+=_0x32389f;}if(!_['isNil'](_0x7982d7)&&_0x1134('0x2')===typeof _0x7982d7){_0x78cf22+='\x20'+_0x7982d7;}if(_0x78cf22!==''){return _0x78cf22;}return _0x30826c;}function Action(_0x1b8407,_0x1022ae,_0x4db8ed,_0x477f42,_0x11c726){this['uniqueid']=_0x4db8ed||undefined;this[_0x1134('0x3')]=_0x1b8407['id'];this[_0x1134('0x4')]=_0x1022ae[_0x1134('0x5')];this['type']=_0x1022ae[_0x1134('0x6')];this[_0x1134('0x7')]=_0x1134('0x4');this['dialAnswer']=![];this[_0x1134('0x8')]=_[_0x1134('0x9')](_0x1b8407[_0x1134('0xa')])?undefined:_0x1b8407['Agent'][_0x1134('0x5')];this[_0x1134('0xb')]=this['membername']?util[_0x1134('0xc')](_0x1134('0xd'),this[_0x1134('0x8')]):_0x477f42||undefined;this[_0x1134('0xe')]=checkNameSurname(_0x1b8407['Contact'][_0x1134('0xf')],_0x1b8407['Contact'][_0x1134('0x10')],_0x1b8407['Contact'][_0x1134('0x11')]);this[_0x1134('0x12')]=_0x1b8407[_0x1134('0x12')]||![];this[_0x1134('0x13')]=_0x1b8407[_0x1134('0x14')][_0x1134('0xf')];this[_0x1134('0x15')]=_0x1b8407[_0x1134('0x15')];this[_0x1134('0x16')]=_0x1b8407[_0x1134('0x16')]||0x0;this[_0x1134('0x17')]=_0x1b8407[_0x1134('0x17')]||0x0;this[_0x1134('0x18')]=_0x1b8407['countnoanswerretry']||0x0;this[_0x1134('0x19')]=(_0x1b8407[_0x1134('0x16')]||0x0)+(_0x1b8407['countcongestionretry']||0x0)+(_0x1b8407[_0x1134('0x18')]||0x0)+(_0x1b8407[_0x1134('0x1a')]||0x0)+(_0x1b8407[_0x1134('0x1b')]||0x0)+(_0x1b8407[_0x1134('0x1c')]||0x0)+(_0x1b8407['countmachineretry']||0x0)+(_0x1b8407[_0x1134('0x1d')]||0x0);this[_0x1134('0x1a')]=_0x1b8407[_0x1134('0x1a')]||0x0;this['countdropretry']=_0x1b8407[_0x1134('0x1b')]||0x0;this['countabandonedretry']=_0x1b8407['countabandonedretry']||0x0;this[_0x1134('0x1e')]=_0x1b8407[_0x1134('0x1e')]||0x0;this[_0x1134('0x1d')]=_0x1b8407['countagentrejectretry']||0x0;this['callback']=_0x1b8407[_0x1134('0x1f')];this[_0x1134('0x20')]=_0x1b8407[_0x1134('0x20')];this['callbackat']=_0x1b8407[_0x1134('0x21')];this[_0x1134('0x22')]=_0x1b8407[_0x1134('0x22')];this[_0x1134('0x23')]=_0x1b8407[_0x1134('0x23')];this['ListId']=_0x1b8407[_0x1134('0x24')];this[_0x1134('0x25')]=_[_0x1134('0x9')](_0x1b8407['Agent'])?_0x1b8407[_0x1134('0x25')]:_0x1b8407[_0x1134('0xa')]['id'];this['VoiceQueueId']=_0x1b8407[_0x1134('0x26')];this[_0x1134('0x27')]='';this[_0x1134('0x28')]='';}Action[_0x1134('0x29')][_0x1134('0x2a')]=function(){return util['format'](_0x1134('0x2b'),this[_0x1134('0xe')],this[_0x1134('0x2c')]);};module['exports']=Action; \ No newline at end of file +var _0xc611=['idContact','queue','name','type','campaigntype','dialAnswer','membername','isNil','Agent','channelAgent','SIP/%s','calleridname','phone','Contact','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','prototype','getCaller','format','\x22%s\x22\x20<%s>','number','exports','util','lodash','string','uniqueid'];(function(_0x32e873,_0xae48c9){var _0x473d0b=function(_0x29b79c){while(--_0x29b79c){_0x32e873['push'](_0x32e873['shift']());}};_0x473d0b(++_0xae48c9);}(_0xc611,0xb0));var _0x1c61=function(_0x29c407,_0x5377b2){_0x29c407=_0x29c407-0x0;var _0x25563c=_0xc611[_0x29c407];return _0x25563c;};'use strict';var util=require(_0x1c61('0x0'));var _=require(_0x1c61('0x1'));var moment=require('moment');function checkNameSurname(_0x4e5ca4,_0x334f76,_0x226dbc){var _0x5fcb30='';if(!_['isNil'](_0x334f76)&&_0x1c61('0x2')===typeof _0x334f76){_0x5fcb30+=_0x334f76;}if(!_['isNil'](_0x226dbc)&&_0x1c61('0x2')===typeof _0x226dbc){_0x5fcb30+='\x20'+_0x226dbc;}if(_0x5fcb30!==''){return _0x5fcb30;}return _0x4e5ca4;}function Action(_0x362f50,_0x1195b4,_0x4ff92a,_0x52406b,_0x15d7a9){this[_0x1c61('0x3')]=_0x4ff92a||undefined;this[_0x1c61('0x4')]=_0x362f50['id'];this[_0x1c61('0x5')]=_0x1195b4[_0x1c61('0x6')];this[_0x1c61('0x7')]=_0x1195b4[_0x1c61('0x7')];this[_0x1c61('0x8')]=_0x1c61('0x5');this[_0x1c61('0x9')]=![];this[_0x1c61('0xa')]=_[_0x1c61('0xb')](_0x362f50['Agent'])?undefined:_0x362f50[_0x1c61('0xc')][_0x1c61('0x6')];this[_0x1c61('0xd')]=this[_0x1c61('0xa')]?util['format'](_0x1c61('0xe'),this[_0x1c61('0xa')]):_0x52406b||undefined;this[_0x1c61('0xf')]=checkNameSurname(_0x362f50['Contact'][_0x1c61('0x10')],_0x362f50[_0x1c61('0x11')][_0x1c61('0x12')],_0x362f50[_0x1c61('0x11')][_0x1c61('0x13')]);this[_0x1c61('0x14')]=_0x362f50[_0x1c61('0x14')]||![];this[_0x1c61('0x15')]=_0x362f50['Contact']['phone'];this[_0x1c61('0x16')]=_0x362f50[_0x1c61('0x16')];this[_0x1c61('0x17')]=_0x362f50['countbusyretry']||0x0;this[_0x1c61('0x18')]=_0x362f50[_0x1c61('0x18')]||0x0;this[_0x1c61('0x19')]=_0x362f50[_0x1c61('0x19')]||0x0;this['countglobal']=(_0x362f50[_0x1c61('0x17')]||0x0)+(_0x362f50[_0x1c61('0x18')]||0x0)+(_0x362f50[_0x1c61('0x19')]||0x0)+(_0x362f50[_0x1c61('0x1a')]||0x0)+(_0x362f50[_0x1c61('0x1b')]||0x0)+(_0x362f50['countabandonedretry']||0x0)+(_0x362f50[_0x1c61('0x1c')]||0x0)+(_0x362f50[_0x1c61('0x1d')]||0x0);this[_0x1c61('0x1a')]=_0x362f50[_0x1c61('0x1a')]||0x0;this[_0x1c61('0x1b')]=_0x362f50[_0x1c61('0x1b')]||0x0;this[_0x1c61('0x1e')]=_0x362f50[_0x1c61('0x1e')]||0x0;this[_0x1c61('0x1c')]=_0x362f50[_0x1c61('0x1c')]||0x0;this[_0x1c61('0x1d')]=_0x362f50[_0x1c61('0x1d')]||0x0;this[_0x1c61('0x1f')]=_0x362f50['callback'];this[_0x1c61('0x20')]=_0x362f50['callbackuniqueid'];this['callbackat']=_0x362f50[_0x1c61('0x21')];this[_0x1c61('0x22')]=_0x362f50['recallme'];this[_0x1c61('0x23')]=_0x362f50[_0x1c61('0x23')];this['ListId']=_0x362f50[_0x1c61('0x24')];this['UserId']=_[_0x1c61('0xb')](_0x362f50['Agent'])?_0x362f50[_0x1c61('0x25')]:_0x362f50[_0x1c61('0xc')]['id'];this[_0x1c61('0x26')]=_0x362f50[_0x1c61('0x26')];this['originatecalleridnum']='';this['originatecalleridname']='';}Action[_0x1c61('0x27')][_0x1c61('0x28')]=function(){return util[_0x1c61('0x29')](_0x1c61('0x2a'),this[_0x1c61('0xf')],this[_0x1c61('0x2b')]);};module[_0x1c61('0x2c')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 486a190..2ed5dba 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 _0x63db=['[callProgressDetectingAgent][logBusy]','Congestion','[callProgressDetectingAgent][logCongestion]','AnswerAGI','updateOriginated','[callProgressDetectingAgent]','checkInBlack','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','SIP/%s','reachable','unmonitored','pick','unlock','unlockContact','execRun','getContactPreview','recallme','isValid','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Queue','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','Is\x20Valid','trim','dialCutDigit','Contact','substring','SIP/%s/%s%s','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','getCallerId','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','toLowerVariables','channelAgent','destconnectedlinenum','calleridnum','user:%s','user:agentconnect','accountcode','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','syncNewExten','logLookAgent','clone','isFailure','response','custom:agentringnoanswer','rejected','callProgressDetectingAgent','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','callProgressDetectingCustomer','statedesc','dialQueueProject','channelstate','isUndefined','transfer','[syncHangup][talking][transfer]','destuniqueid','addVariable','variables','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','exports','util','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','actionPreview','./rpcDb','./action','redis','defaults','localhost','socket.io-emitter','prototype','tail','finally','campaignsPreview','trunks','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','syncVarSet','attendedtransfer','syncAttendedTransfer','loopCampaigns','type','outbound','name','strategy','available','loggedIn','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice_queue_channel:remove','emit','voice_queue_presence:remove','sendMessageOneNotActive','originated','paused','message','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20disactive','syncCampaigns','hasOwnProperty','preview','booked','clearZombieChannels','setMessage','recallMe','clearZombieChannel','enqueue','isNil','[clearZombieChannels][talking]','actions','originated:\x20','queue','pTalking','dialAnswer','contactId','VoiceQueueId','ListId','Action','status','channel','catch','No\x20such\x20channel','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','size','agentReadyId','then','length','getDiff','scheduledat','Agent','run','logger2','[RecallMe]','disableContact','starttime','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryRecallClose]','[getContactRecallMe]','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','ACTIVE','countnosuchnumberretry','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','totalGlobal','dialGlobalMaxRetry','cloneAction','Global','createCustomerFinal','dialNoSuchNumberMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','scheduledAt','unlockAgent','activeContact','ANSWER','YYYY-MM-DD\x20HH:mm:ss','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','pTalking:\x20','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','countglobal','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','talktime','[syncHangup][talking][decrement]','linkedid','Busy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','countbusyretry','dialBusyMaxRetry','rescheduleContact','dialBusyRetryFrequency','NOANSWER','countnoanswerretry','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','outboundUnknownCallsDay','cause-txt','dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','object','reason','createAgentHistory','logAgent','NoAnswer','[callProgressDetectingAgent][logNoAnswer]'];(function(_0x340380,_0x4bd2a8){var _0x49ce1c=function(_0x4cb9e2){while(--_0x4cb9e2){_0x340380['push'](_0x340380['shift']());}};_0x49ce1c(++_0x4bd2a8);}(_0x63db,0x68));var _0xb63d=function(_0x4ef921,_0x31cc9d){_0x4ef921=_0x4ef921-0x0;var _0x4766e1=_0x63db[_0x4ef921];return _0x4766e1;};'use strict';var util=require(_0xb63d('0x0'));var _=require(_0xb63d('0x1'));var BPromise=require(_0xb63d('0x2'));var uuid=require(_0xb63d('0x3'));var moment=require(_0xb63d('0x4'));var md5=require(_0xb63d('0x5'));var Redis=require(_0xb63d('0x6'));var config=require(_0xb63d('0x7'));var logger=require(_0xb63d('0x8'))('preview');var loggerAction=require(_0xb63d('0x8'))(_0xb63d('0x9'));var ami=require('../ami');var rpcDb=require(_0xb63d('0xa'));var Action=require(_0xb63d('0xb'));var ut=require('./util/util');config[_0xb63d('0xc')]=_[_0xb63d('0xd')](config[_0xb63d('0xc')],{'host':_0xb63d('0xe'),'port':0x18eb});var io=require(_0xb63d('0xf'))(new Redis(config[_0xb63d('0xc')]));var Sequence=function(){};Sequence[_0xb63d('0x10')]['enqueue']=function(_0x2c304d){this['tail']=this[_0xb63d('0x11')]?this[_0xb63d('0x11')][_0xb63d('0x12')](_0x2c304d):_0x2c304d();};function Preview(_0x5a5062){this['sequence']=new Sequence();this[_0xb63d('0x13')]=_0x5a5062['voiceQueues'];this['trunks']=_0x5a5062[_0xb63d('0x14')];this['actions']={};this['agents']=_0x5a5062[_0xb63d('0x15')];this[_0xb63d('0x16')]=0x0;ami['on'](_0xb63d('0x17'),this[_0xb63d('0x18')][_0xb63d('0x19')](this));ami['on'](_0xb63d('0x1a'),this[_0xb63d('0x1b')][_0xb63d('0x19')](this));ami['on'](_0xb63d('0x1c'),this[_0xb63d('0x1d')]['bind'](this));ami['on'](_0xb63d('0x1e'),this[_0xb63d('0x1f')][_0xb63d('0x19')](this));ami['on']('newexten',this['syncNewExten'][_0xb63d('0x19')](this));ami['on']('varset',this[_0xb63d('0x20')][_0xb63d('0x19')](this));ami['on'](_0xb63d('0x21'),this[_0xb63d('0x22')]['bind'](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0xb63d('0x19')](this));this[_0xb63d('0x23')](this[_0xb63d('0x13')]);}function emit(_0x482fc8,_0x405e46,_0x4a8720){io['to'](_0x482fc8)['emit'](_0x405e46,_0x4a8720);}function emitCampaignPreview(_0x3ef562){if(_0x3ef562[_0xb63d('0x24')]===_0xb63d('0x25')){var _0x664d37={'id':_0x3ef562['id'],'name':_0x3ef562[_0xb63d('0x26')],'strategy':_0x3ef562[_0xb63d('0x27')],'answered':_0x3ef562['answered'],'available':_0x3ef562[_0xb63d('0x28')],'loggedIn':_0x3ef562[_0xb63d('0x29')],'pTalking':_0x3ef562['pTalking'],'sumBillable':_0x3ef562['sumBillable'],'sumDuration':_0x3ef562[_0xb63d('0x2a')],'sumHoldTime':_0x3ef562[_0xb63d('0x2b')]||0x0,'talking':_0x3ef562[_0xb63d('0x2c')],'total':_0x3ef562[_0xb63d('0x2d')],'type':_0x3ef562[_0xb63d('0x24')],'unmanaged':_0x3ef562[_0xb63d('0x2e')],'abandoned':_0x3ef562[_0xb63d('0x2f')],'waiting':_0x3ef562[_0xb63d('0x30')],'loggedInDb':_0x3ef562[_0xb63d('0x31')],'dialActive':_0x3ef562[_0xb63d('0x32')],'dialMethod':_0x3ef562[_0xb63d('0x33')],'dialOriginateCallerIdName':_0x3ef562[_0xb63d('0x34')],'dialOriginateCallerIdNumber':_0x3ef562[_0xb63d('0x35')],'dialOriginateTimeout':_0x3ef562[_0xb63d('0x36')],'dialPrefix':_0x3ef562[_0xb63d('0x37')],'outboundAnswerAgiCallsDay':_0x3ef562[_0xb63d('0x38')],'outboundAnswerCallsDay':_0x3ef562['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x3ef562[_0xb63d('0x39')],'outboundBusyCallsDay':_0x3ef562[_0xb63d('0x3a')],'outboundCongestionCallsDay':_0x3ef562[_0xb63d('0x3b')],'outboundDropCallsDayACS':_0x3ef562[_0xb63d('0x3c')],'outboundDropCallsDayCallersExit':_0x3ef562[_0xb63d('0x3d')],'outboundDropCallsDayTimeout':_0x3ef562['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x3ef562[_0xb63d('0x3e')],'outboundNoSuchCallsDay':_0x3ef562[_0xb63d('0x3f')],'outboundOriginateFailureCallsDay':_0x3ef562[_0xb63d('0x40')],'outboundReCallsDay':_0x3ef562['outboundReCallsDay'],'outboundRejectCallsDay':_0x3ef562[_0xb63d('0x41')],'outboundUnknownCallsDay':_0x3ef562['outboundUnknownCallsDay'],'outboundAbandonedCallsDay':_0x3ef562[_0xb63d('0x42')],'predictiveIntervalAnsweredCalls':_0x3ef562[_0xb63d('0x43')],'predictiveIntervalAvgHoldtime':_0x3ef562[_0xb63d('0x44')],'predictiveIntervalAvgTalktime':_0x3ef562[_0xb63d('0x45')],'predictiveIntervalDroppedCallsCallersExit':_0x3ef562[_0xb63d('0x46')],'predictiveIntervalDroppedCallsTimeout':_0x3ef562[_0xb63d('0x47')],'predictiveIntervalErlangCalls':_0x3ef562['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x3ef562[_0xb63d('0x48')],'predictiveIntervalHitRate':_0x3ef562[_0xb63d('0x49')],'predictiveIntervalMultiplicativeFactor':_0x3ef562[_0xb63d('0x4a')],'predictiveIntervalPauses':_0x3ef562['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x3ef562['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x3ef562['predictiveIntervalTotalCalls'],'message':_0x3ef562['message'],'originated':_0x3ef562['originated'],'erlangCalls':_0x3ef562[_0xb63d('0x4b')],'erlangCallToSecond':_0x3ef562['erlangCallToSecond'],'erlangAbandonmentRate':_0x3ef562[_0xb63d('0x4c')],'erlangBusyFactor':_0x3ef562[_0xb63d('0x4d')],'startPredictive':_0x3ef562[_0xb63d('0x4e')],'startProgressive':_0x3ef562[_0xb63d('0x4f')]};if(_0x3ef562['Trunk']){_0x664d37[_0xb63d('0x50')]={'id':_0x3ef562[_0xb63d('0x50')]['id'],'name':_0x3ef562[_0xb63d('0x50')][_0xb63d('0x26')],'active':_0x3ef562[_0xb63d('0x50')][_0xb63d('0x51')],'callerid':_0x3ef562[_0xb63d('0x50')][_0xb63d('0x52')]};}if(_0x3ef562[_0xb63d('0x53')]){_0x664d37['Interval']={'id':_0x3ef562[_0xb63d('0x53')]['id'],'name':_0x3ef562['Interval'][_0xb63d('0x26')]};}var _0x1508d5=md5(JSON['stringify'](_0x664d37));if(_0x3ef562['md5']!==_0x1508d5){_0x3ef562['md5']=_0x1508d5;emit(util['format'](_0xb63d('0x54'),_0x664d37[_0xb63d('0x26')]),_0xb63d('0x55'),_0x664d37);}}}function emitVoiceQueueChannelRemove(_0x54176e){logger[_0xb63d('0x56')](_0xb63d('0x57'),JSON[_0xb63d('0x58')](_0x54176e));emit(util[_0xb63d('0x59')]('voice:queue:%s',_0x54176e[_0xb63d('0x26')]),_0xb63d('0x5a'),_0x54176e);io[_0xb63d('0x5b')](_0xb63d('0x5c'),_0x54176e);}function notSendMessagesQueue(_0x313172){if(_0x313172[_0xb63d('0x5d')]){if(_0x313172[_0xb63d('0x5e')]===0x0&&_0x313172['pTalking']===0x0){_0x313172[_0xb63d('0x5d')]=![];_0x313172[_0xb63d('0x28')]=0x0;_0x313172[_0xb63d('0x5f')]=0x0;_0x313172[_0xb63d('0x60')]=_0xb63d('0x61');ut[_0xb63d('0x62')](_0xb63d('0x63'),_0x313172[_0xb63d('0x26')]+_0xb63d('0x64'));}else{_0x313172[_0xb63d('0x60')]='IS_DISACTIVED';ut[_0xb63d('0x62')](_0xb63d('0x63'),_0x313172[_0xb63d('0x26')]+_0xb63d('0x65'));}emitCampaignPreview(_0x313172);}}Preview[_0xb63d('0x10')]['loopCampaigns']=function(){var _0x5bd6e5=this;setInterval(function(){_0x5bd6e5['syncCampaigns']();},0x7cf);};Preview['prototype'][_0xb63d('0x66')]=function(){var _0x15f1c5=this[_0xb63d('0x13')];this['clockClearZombieChannels']+=0x1;for(var _0x54af3d in _0x15f1c5){if(_0x15f1c5[_0xb63d('0x67')](_0x54af3d)&&(_0x15f1c5[_0x54af3d][_0xb63d('0x33')]===_0xb63d('0x68')||_0x15f1c5[_0x54af3d]['dialMethod']===_0xb63d('0x69'))&&_0x15f1c5[_0x54af3d][_0xb63d('0x24')]==='outbound'){if(this[_0xb63d('0x16')]>0x7){this[_0xb63d('0x16')]=0x0;this[_0xb63d('0x6a')]();}}if(_0x15f1c5[_0xb63d('0x67')](_0x54af3d)&&_0x15f1c5[_0x54af3d][_0xb63d('0x33')]===_0xb63d('0x68')&&_0x15f1c5[_0x54af3d][_0xb63d('0x24')]===_0xb63d('0x25')){if(_0x15f1c5[_0x54af3d][_0xb63d('0x32')]){this[_0xb63d('0x6b')](_0x15f1c5[_0x54af3d]);this[_0xb63d('0x6c')](_0x15f1c5[_0x54af3d]);}else{notSendMessagesQueue(_0x15f1c5[_0x54af3d]);}}}};Preview['prototype'][_0xb63d('0x6d')]=function(_0x533fcc){var _0x5db583=this;this['sequence'][_0xb63d('0x6e')](function(){if(!_[_0xb63d('0x6f')](_0x5db583['actions'][_0x533fcc])){loggerAction['info'](_0xb63d('0x70'),_0x533fcc,'Queue',_0x5db583[_0xb63d('0x71')][_0x533fcc]['queue'],_0xb63d('0x72'),JSON[_0xb63d('0x58')](_0x5db583[_0xb63d('0x13')][_0x5db583[_0xb63d('0x71')][_0x533fcc]['queue']]['originated']),'pTalking:\x20',JSON[_0xb63d('0x58')](_0x5db583['campaignsPreview'][_0x5db583[_0xb63d('0x71')][_0x533fcc][_0xb63d('0x73')]][_0xb63d('0x74')]),JSON[_0xb63d('0x58')](_0x5db583['actions'][_0x533fcc][_0xb63d('0x75')]),JSON[_0xb63d('0x58')](_['pick'](_0x5db583['actions'][_0x533fcc],[_0xb63d('0x76'),'UserId',_0xb63d('0x77'),_0xb63d('0x78')])));return ami[_0xb63d('0x79')]({'action':_0xb63d('0x7a'),'channel':_0x5db583[_0xb63d('0x71')][_0x533fcc][_0xb63d('0x7b')]})[_0xb63d('0x7c')](function(_0x222be5){if(_0x222be5[_0xb63d('0x60')]===_0xb63d('0x7d')){setTimeout(function(){if(_0x5db583['actions'][_0x533fcc]){ut['updateOriginated'](_0x5db583[_0xb63d('0x13')][_0x5db583['actions'][_0x533fcc][_0xb63d('0x73')]],_0xb63d('0x7e'));if(_0x5db583[_0xb63d('0x71')][_0x533fcc][_0xb63d('0x75')]===!![]){ut[_0xb63d('0x7f')](_0x5db583['campaignsPreview'][_0x5db583[_0xb63d('0x71')][_0x533fcc][_0xb63d('0x73')]],_0xb63d('0x7e'));ut[_0xb63d('0x80')](_0xb63d('0x81')+_0x533fcc,_0x5db583[_0xb63d('0x71')][_0x533fcc][_0xb63d('0x73')]);}ut[_0xb63d('0x80')](_0xb63d('0x82')+_0x533fcc,_0x5db583[_0xb63d('0x71')][_0x533fcc][_0xb63d('0x73')]);delete _0x5db583['actions'][_0x533fcc];}},0x2328);}});}});};Preview[_0xb63d('0x10')][_0xb63d('0x6a')]=function(){var _0x282166=this;loggerAction[_0xb63d('0x56')]('[action]',_[_0xb63d('0x83')](this[_0xb63d('0x71')]));for(var _0x56b94a in this['actions']){if(_0x282166[_0xb63d('0x71')][_0xb63d('0x67')](_0x56b94a)){_0x282166[_0xb63d('0x6d')](_0x56b94a);}}};Preview[_0xb63d('0x10')][_0xb63d('0x6c')]=function(_0x4e221a){var _0x2704b1=this;rpcDb['getContactRecallMe'](_0x4e221a['id'],ut[_0xb63d('0x84')](this['agents']))[_0xb63d('0x85')](function(_0x415aaa){if(!_[_0xb63d('0x6f')](_0x415aaa)){for(var _0x37830c=0x0;_0x37830c<_0x415aaa[_0xb63d('0x86')];_0x37830c+=0x1){if(ut[_0xb63d('0x87')](_0x415aaa[_0x37830c][_0xb63d('0x88')])<_0x4e221a['dialRecallMeTimeout']*0x3c){if(_0x415aaa[_0x37830c][_0xb63d('0x89')]&&!_0x415aaa[_0x37830c][_0xb63d('0x89')]['voicePause']){_0x2704b1[_0xb63d('0x8a')](_0x415aaa[_0x37830c]['id'])[_0xb63d('0x85')](ut[_0xb63d('0x8b')](_0xb63d('0x8c')))[_0xb63d('0x7c')](ut['logger2']('[RecallMe]'));}else{rpcDb[_0xb63d('0x8d')](_0x415aaa[_0x37830c]['id']);}}else{var _0x31c93a=new Action(_0x415aaa[_0x37830c],_0x4e221a);_0x31c93a[_0xb63d('0x8e')]=moment()[_0xb63d('0x59')]('YYYY-MM-DD\x20HH:mm:ss');_0x4e221a[_0xb63d('0x8f')]+=0x1;ut[_0xb63d('0x90')](_0x31c93a,0x17,_0xb63d('0x91'));if(_0x4e221a[_0xb63d('0x92')]){rpcDb[_0xb63d('0x93')](ut[_0xb63d('0x94')](_0x415aaa[_0x37830c]));rpcDb[_0xb63d('0x95')](_0x31c93a,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0xb63d('0x90')](_0x31c93a,0x16,'RecallFailedTimeout');rpcDb[_0xb63d('0x95')](_0x31c93a,_0xb63d('0x96'));rpcDb['createCustomerFinal'](_0x31c93a,'[HistoryRecallClose]');}}}}})[_0xb63d('0x7c')](ut['logger2'](_0xb63d('0x97')));};Preview['prototype'][_0xb63d('0x6b')]=function(_0xd0574b){_0xd0574b[_0xb63d('0x5d')]=!![];if(ut['IsNotLoggedIn'](_0xd0574b['loggedIn'])){_0xd0574b[_0xb63d('0x60')]=_0xb63d('0x98');}else if(!ut[_0xb63d('0x99')](_0xd0574b[_0xb63d('0x32')])){_0xd0574b['message']=_0xb63d('0x61');}else if(!this[_0xb63d('0x9a')](_0xd0574b[_0xb63d('0x50')])){if(!this[_0xb63d('0x9a')](_0xd0574b['TrunkBackup'])){_0xd0574b[_0xb63d('0x60')]=_0xb63d('0x9b');}else{_0xd0574b[_0xb63d('0x60')]='ACTIVE';}}else{_0xd0574b[_0xb63d('0x60')]=_0xb63d('0x9c');}emitCampaignPreview(_0xd0574b);};Preview[_0xb63d('0x10')]['callProgressDetectingCustomer']=function(_0x5c7c82,_0xfb854b,_0x437ea7){var _0x146f7a=this;var _0x489328=this[_0xb63d('0x71')][_0xfb854b];var _0x15862a=this[_0xb63d('0x13')][_0x489328[_0xb63d('0x73')]];var _0x5f080d;if(_0x15862a){switch(_0x437ea7){case'1':_0x15862a[_0xb63d('0x3f')]+=0x1;_0x489328[_0xb63d('0x9d')]+=0x1;_0x489328['countglobal']=ut['totalGlobal'](_0x489328);ut[_0xb63d('0x90')](_0x489328,0x0,_0xb63d('0x9e'));ami[_0xb63d('0x5b')](_0xb63d('0x9f'),ut[_0xb63d('0xa0')](_0x489328,_0xb63d('0xa1')));rpcDb[_0xb63d('0x95')](_0x489328,_0xb63d('0xa2'));if(ut[_0xb63d('0xa3')](_0x489328)>=_0x15862a[_0xb63d('0xa4')]){_0x5f080d=ut[_0xb63d('0xa5')](_0x489328,0xf,_0xb63d('0xa6'));rpcDb[_0xb63d('0xa7')](_0x5f080d,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x489328[_0xb63d('0x9d')]>=_0x15862a[_0xb63d('0xa8')]){rpcDb['createCustomerFinal'](_0x489328,_0xb63d('0xa9'));}else{rpcDb['rescheduleContact'](ut[_0xb63d('0xaa')](_0x489328,'countnosuchnumberretry',_0x15862a['dialNoSuchNumberRetryFrequency']),_0x489328[_0xb63d('0xab')],_0x489328[_0xb63d('0xac')]);}}delete this[_0xb63d('0x71')][_0x5c7c82['linkedid']];break;case _0xb63d('0xad'):var _0x53674d=moment()['format'](_0xb63d('0xae'));_0x489328['responsetime']=_0x53674d;_0x489328[_0xb63d('0xaf')]=_0x53674d;_0x489328['dialAnswer']=!![];_0x15862a[_0xb63d('0x74')]+=0x1;logger[_0xb63d('0x56')](_0xb63d('0xb0'),_0x489328[_0xb63d('0xb1')],_0xb63d('0xb2'),_0x15862a[_0xb63d('0x26')],_0xb63d('0xb3'),_0x15862a[_0xb63d('0x74')]);ami[_0xb63d('0x5b')](_0xb63d('0xb4'),ut[_0xb63d('0xa0')](_0x489328,_0xb63d('0xb5'),this[_0xb63d('0x13')][_0x489328[_0xb63d('0x73')]]));if(_0x15862a[_0xb63d('0xb6')]){ami[_0xb63d('0x5b')](_0xb63d('0xb7'),ut[_0xb63d('0xb8')](_0x489328));}break;case'16':ami['emit'](_0xb63d('0xb9'),ut[_0xb63d('0xa0')](_0x489328,_0xb63d('0xba'),this[_0xb63d('0x13')][_0x489328['queue']]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x489328,_0xb63d('0xba')));_0x15862a[_0xb63d('0xbb')]+=0x1;_0x15862a[_0xb63d('0x2d')]+=0x1;_0x15862a[_0xb63d('0xbc')]+=0x1;ut[_0xb63d('0x7f')](_0x15862a,'[16]');_0x489328[_0xb63d('0xbd')]=ut[_0xb63d('0xa3')](_0x489328);ut[_0xb63d('0x90')](_0x489328,0x4,_0xb63d('0xbe'));rpcDb[_0xb63d('0x95')](_0x489328,_0xb63d('0xbf'));rpcDb[_0xb63d('0xa7')](_0x489328,_0xb63d('0xc0'));rpcDb['crateCustomerReportQueue'](_0x489328);_0x15862a[_0xb63d('0x2a')]+=_0x489328[_0xb63d('0xc1')];_0x15862a['sumBillable']+=_0x489328[_0xb63d('0xc1')];logger[_0xb63d('0x56')](_0xb63d('0xc2'),_0x489328[_0xb63d('0xb1')],'\x20Queue',_0x15862a[_0xb63d('0x26')],_0xb63d('0xb3'),_0x15862a[_0xb63d('0x74')]);delete this['actions'][_0x5c7c82[_0xb63d('0xc3')]];break;case'BUSY':_0x15862a[_0xb63d('0x3a')]+=0x1;_0x489328['countbusyretry']+=0x1;_0x489328['countglobal']=ut[_0xb63d('0xa3')](_0x489328);ut[_0xb63d('0x90')](_0x489328,0x5,_0xb63d('0xc4'));ami[_0xb63d('0x5b')]('custom:agentbusy',ut[_0xb63d('0xa0')](_0x489328,_0xb63d('0xc5')));rpcDb['createCustomerHistory'](_0x489328,_0xb63d('0xc6'));if(ut['totalGlobal'](_0x489328)>=_0x15862a[_0xb63d('0xa4')]){_0x5f080d=ut[_0xb63d('0xa5')](_0x489328,0xf,_0xb63d('0xa6'));rpcDb[_0xb63d('0xa7')](_0x5f080d,_0xb63d('0xc7'));}else{if(_0x489328[_0xb63d('0xc8')]>=_0x15862a[_0xb63d('0xc9')]){rpcDb[_0xb63d('0xa7')](_0x489328,_0xb63d('0xc6'));}else{rpcDb[_0xb63d('0xca')](ut[_0xb63d('0xaa')](_0x489328,_0xb63d('0xc8'),_0x15862a[_0xb63d('0xcb')]),_0x489328[_0xb63d('0xab')],_0x489328[_0xb63d('0xac')]);}}break;case _0xb63d('0xcc'):_0x15862a[_0xb63d('0x3e')]+=0x1;_0x489328[_0xb63d('0xcd')]+=0x1;_0x489328[_0xb63d('0xbd')]=ut[_0xb63d('0xa3')](_0x489328);ut[_0xb63d('0x90')](_0x489328,0x3,'NoAnswer');ami[_0xb63d('0x5b')](_0xb63d('0xce'),ut['buildObj'](_0x489328,_0xb63d('0xcf')));rpcDb[_0xb63d('0x95')](_0x489328,'[callProgressDetectingCustomer][logNoAnswer]');if(ut['totalGlobal'](_0x489328)>=_0x15862a[_0xb63d('0xa4')]){_0x5f080d=ut[_0xb63d('0xa5')](_0x489328,0xf,_0xb63d('0xa6'));rpcDb['createCustomerFinal'](_0x5f080d,_0xb63d('0xd0'));}else{if(_0x489328[_0xb63d('0xcd')]>=_0x15862a[_0xb63d('0xd1')]){rpcDb['createCustomerFinal'](_0x489328,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb['rescheduleContact'](ut[_0xb63d('0xaa')](_0x489328,_0xb63d('0xcd'),_0x15862a[_0xb63d('0xd2')]),_0x489328[_0xb63d('0xab')],_0x489328[_0xb63d('0xac')]);}}break;case _0xb63d('0xd3'):_0x15862a[_0xb63d('0x3b')]+=0x1;_0x489328[_0xb63d('0xd4')]+=0x1;_0x489328['countglobal']=ut[_0xb63d('0xa3')](_0x489328);ut[_0xb63d('0x90')](_0x489328,0x8,'Congestion');ami[_0xb63d('0x5b')]('custom:agentcongestion',ut['buildObj'](_0x489328,_0xb63d('0xd5')));rpcDb['createCustomerHistory'](_0x489328,_0xb63d('0xd6'));if(ut[_0xb63d('0xa3')](_0x489328)>=_0x15862a[_0xb63d('0xa4')]){_0x5f080d=ut[_0xb63d('0xa5')](_0x489328,0xf,'Global');rpcDb['createCustomerFinal'](_0x5f080d,_0xb63d('0xd7'));}else{if(_0x489328[_0xb63d('0xd4')]>=_0x15862a['dialCongestionMaxRetry']){rpcDb[_0xb63d('0xa7')](_0x489328,_0xb63d('0xd6'));}else{rpcDb[_0xb63d('0xca')](ut[_0xb63d('0xaa')](_0x489328,_0xb63d('0xd4'),_0x15862a[_0xb63d('0xcb')]),_0x489328[_0xb63d('0xab')],_0x489328[_0xb63d('0xac')]);}}break;case _0xb63d('0xd8'):_0x15862a[_0xb63d('0x41')]+=0x1;_0x489328[_0xb63d('0xd9')]+=0x1;_0x489328[_0xb63d('0xbd')]=ut[_0xb63d('0xa3')](_0x489328);ut[_0xb63d('0x90')](_0x489328,0x14,_0xb63d('0xda'));ami[_0xb63d('0x5b')](_0xb63d('0xdb'),ut[_0xb63d('0xa0')](_0x489328,_0xb63d('0xdc')));rpcDb[_0xb63d('0x95')](_0x489328,_0xb63d('0xdd'));if(ut[_0xb63d('0xa3')](_0x489328)>=_0x15862a[_0xb63d('0xa4')]){_0x5f080d=ut[_0xb63d('0xa5')](_0x489328,0x14,_0xb63d('0xda'));rpcDb[_0xb63d('0xa7')](_0x5f080d,_0xb63d('0xde'));}else{if(_0x489328[_0xb63d('0xd9')]>=_0x15862a[_0xb63d('0xdf')]){rpcDb[_0xb63d('0xa7')](_0x489328,_0xb63d('0xde'));}else{rpcDb['rescheduleContact'](ut[_0xb63d('0xaa')](_0x489328,'countagentrejectretry',_0x15862a['dialAgentRejectRetryFrequency']),_0x489328[_0xb63d('0xab')],_0x489328[_0xb63d('0xac')]);}}break;case _0xb63d('0xe0'):_0x15862a[_0xb63d('0x42')]+=0x1;_0x489328[_0xb63d('0xe1')]+=0x1;_0x489328[_0xb63d('0xbd')]=ut[_0xb63d('0xa3')](_0x489328);ut[_0xb63d('0x90')](_0x489328,0xb,_0xb63d('0xe2'));rpcDb[_0xb63d('0x95')](_0x489328,_0xb63d('0xe3'));if(ut['totalGlobal'](_0x489328)>=_0x15862a['dialGlobalMaxRetry']){_0x5f080d=ut['cloneAction'](_0x489328,0xf,'Global');rpcDb['createCustomerFinal'](_0x5f080d,_0xb63d('0xe3'));}else{if(_0x489328[_0xb63d('0xe4')]>=_0x15862a[_0xb63d('0xe5')]){rpcDb[_0xb63d('0xa7')](_0x489328,_0xb63d('0xe3'));}else{rpcDb[_0xb63d('0xca')](ut[_0xb63d('0xaa')](_0x489328,_0xb63d('0xe1'),_0x15862a[_0xb63d('0xe6')]),_0x489328[_0xb63d('0xab')],_0x489328[_0xb63d('0xac')]);}}break;case'18':_0x15862a[_0xb63d('0xe7')]+=0x1;_0x489328['countmachineretry']+=0x1;_0x489328[_0xb63d('0xbd')]=ut[_0xb63d('0xa3')](_0x489328);ut[_0xb63d('0x90')](_0x489328,0x12,_0x5c7c82[_0xb63d('0xe8')]||_0x5c7c82[_0xb63d('0xe9')]);ami[_0xb63d('0x5b')](_0xb63d('0xea'),ut[_0xb63d('0xa0')](_0x489328,'amd'));rpcDb[_0xb63d('0x95')](_0x489328,_0xb63d('0xeb'));if(ut[_0xb63d('0xa3')](_0x489328)>=_0x15862a[_0xb63d('0xa4')]){_0x5f080d=ut[_0xb63d('0xa5')](_0x489328,0xf,_0xb63d('0xa6'));rpcDb[_0xb63d('0xa7')](_0x5f080d,_0xb63d('0xeb'));}else{rpcDb[_0xb63d('0xa7')](_0x489328,_0xb63d('0xeb'));}delete this['actions'][_0x5c7c82[_0xb63d('0xc3')]];break;case'19':_0x15862a['outboundUnknownCallsDay']+=0x1;_0x489328[_0xb63d('0xbd')]=ut[_0xb63d('0xa3')](_0x489328);ut[_0xb63d('0x90')](_0x489328,0x13,_0x5c7c82[_0xb63d('0xe8')]||_0x5c7c82[_0xb63d('0xe9')]);ami[_0xb63d('0x5b')]('custom:amd',ut[_0xb63d('0xa0')](_0x489328,_0xb63d('0xec')));rpcDb[_0xb63d('0x95')](_0x489328,_0xb63d('0xed'));if(ut['totalGlobal'](_0x489328)>=_0x15862a[_0xb63d('0xa4')]){_0x5f080d=ut[_0xb63d('0xa5')](_0x489328,0xf,_0xb63d('0xa6'));rpcDb[_0xb63d('0xa7')](_0x5f080d,'[callProgressDetectingCustomer][machine]');}else{rpcDb[_0xb63d('0xa7')](_0x489328,_0xb63d('0xed'));}delete this[_0xb63d('0x71')][_0x5c7c82['linkedid']];break;default:if(_0x489328['dialAnswer']){ut[_0xb63d('0x7f')](_0x15862a,_0xb63d('0xee'));ut[_0xb63d('0x80')](_0xb63d('0xef')+_0x15862a[_0xb63d('0x26')],_0x5c7c82);}_0x15862a['outboundUnknownCallsDay']+=0x1;_0x489328[_0xb63d('0xbd')]=ut[_0xb63d('0xa3')](_0x489328);ut[_0xb63d('0x90')](_0x489328,0xc,_0x5c7c82['cause-txt']||_0x5c7c82[_0xb63d('0xe9')]);rpcDb[_0xb63d('0x95')](_0x489328,_0xb63d('0xf0'));if(ut[_0xb63d('0xa3')](_0x489328)>=_0x15862a[_0xb63d('0xa4')]){_0x5f080d=ut[_0xb63d('0xa5')](_0x489328,0xf,'Global');rpcDb[_0xb63d('0xa7')](_0x5f080d,_0xb63d('0xf1'));}else{rpcDb[_0xb63d('0xa7')](_0x489328,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this[_0xb63d('0x71')][_0x5c7c82[_0xb63d('0xc3')]];}if(!(_0x489328[_0xb63d('0x75')]&&_0x437ea7==='16')){ut['updateOriginated'](_0x15862a,_0xb63d('0xf2'));logger[_0xb63d('0x56')](_0xb63d('0xf3'),_0x489328[_0xb63d('0xb1')],_0xb63d('0xb2'),_0x15862a[_0xb63d('0x26')],_0xb63d('0x72'),_0x15862a[_0xb63d('0x5e')]);}if(_0x437ea7!==_0xb63d('0xad')){delete this[_0xb63d('0x71')][_0x5c7c82[_0xb63d('0xc3')]];delete this['actions'][_0x5c7c82[_0xb63d('0xf4')]];}}};Preview[_0xb63d('0x10')]['callProgressDetectingAgent']=function(_0xbe86b3,_0x3c7cb8,_0x587202){if(_['isUndefined'](_0x3c7cb8)&&_0xb63d('0xf5')!==typeof _0x3c7cb8){return;}if(_['isUndefined'](_0x587202)&&'object'!==typeof _0x587202){return;}switch(_0x587202[_0xb63d('0xf6')]){case'0':ut['logAgent'](_0xbe86b3,0x0,'NoSuchNumber');rpcDb[_0xb63d('0xf7')](_0xbe86b3,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0xb63d('0xf8')](_0xbe86b3,0x3,_0xb63d('0xf9'));rpcDb[_0xb63d('0xf7')](_0xbe86b3,_0xb63d('0xfa'));break;case'5':ut[_0xb63d('0xf8')](_0xbe86b3,0x5,'Busy');rpcDb['createAgentHistory'](_0xbe86b3,_0xb63d('0xfb'));break;case'8':ut[_0xb63d('0xf8')](_0xbe86b3,0x8,_0xb63d('0xfc'));rpcDb[_0xb63d('0xf7')](_0xbe86b3,_0xb63d('0xfd'));break;case'22':ut[_0xb63d('0xf8')](_0xbe86b3,0x16,_0xb63d('0xfe'));rpcDb[_0xb63d('0xf7')](_0xbe86b3,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut['logAgent'](_0xbe86b3,0xc,_0x587202[_0xb63d('0xf6')]);rpcDb['createAgentHistory'](_0xbe86b3,_0xb63d('0xfd'));}ut[_0xb63d('0xff')](_0x3c7cb8,_0xb63d('0x100'));logger[_0xb63d('0x56')]('[originated][decrement][callProgressDetectingAgent]',_0xbe86b3[_0xb63d('0xb1')],_0xb63d('0xb2'),_0x3c7cb8[_0xb63d('0x26')],_0xb63d('0x72'),_0x3c7cb8[_0xb63d('0x5e')]);delete this['actions'][_0xbe86b3[_0xb63d('0xb1')]];};Preview[_0xb63d('0x10')][_0xb63d('0x101')]=function(_0x405e53,_0x4e57c8,_0x560ba3,_0x3d15ac,_0x1a46fb){var _0x18475d=this;return new BPromise(function(_0x5521d9,_0x555562){if(_[_0xb63d('0x6f')](_0x4e57c8)||_[_0xb63d('0x6f')](_0x4e57c8['Contact'])||_[_0xb63d('0x6f')](_0x4e57c8['Contact'][_0xb63d('0x102')])||_[_0xb63d('0x6f')](_0x4e57c8['VoiceQueueId'])){_0x555562(ut[_0xb63d('0x60')](_0xb63d('0x103'),_0x3d15ac,_0x1a46fb));return;}var _0x49bc40=uuid['v4']();var _0x400582=_0x18475d[_0xb63d('0x13')][_0x4e57c8['Queue'][_0xb63d('0x26')]];var _0x22b92d=_0x560ba3?_0x18475d[_0xb63d('0x15')][_0x560ba3]['id']:undefined;_0x18475d[_0xb63d('0x71')][_0x49bc40]=new Action(_0x4e57c8,_0x400582,_0x49bc40,_0x560ba3,_0x22b92d);var _0x3df6fe=_0x18475d[_0xb63d('0x71')][_0x49bc40];_0x3df6fe[_0xb63d('0xab')]=_0x3d15ac;_0x3df6fe[_0xb63d('0xac')]=_0x1a46fb;_0x3df6fe[_0xb63d('0x104')]=_0x560ba3;if(_[_0xb63d('0x105')](_0x405e53)){_0x18475d[_0xb63d('0x106')](_0x3df6fe,_0x400582,_0x4e57c8,_0x560ba3)[_0xb63d('0x85')](function(_0x3f9153){logger[_0xb63d('0x56')](_0xb63d('0x107'),_0xb63d('0x108')+_0x3df6fe[_0xb63d('0x73')]+_0xb63d('0x109')+_0x3df6fe[_0xb63d('0x10a')],JSON[_0xb63d('0x58')](_0x3f9153));ami[_0xb63d('0x5b')](_0xb63d('0x10b'),ut['buildObj'](_0x3df6fe,'called',_0x18475d[_0xb63d('0x13')][_0x3df6fe[_0xb63d('0x73')]]));_0x5521d9(ut[_0xb63d('0x60')]('Calling'));})[_0xb63d('0x7c')](function(_0x5ad701){ut[_0xb63d('0x62')](_0xb63d('0x10c'),_0x5ad701);_0x555562(ut[_0xb63d('0x60')](_0xb63d('0x10d'),_0x3d15ac,_0x1a46fb));});}else{_0x400582[_0xb63d('0x39')]+=0x1;ut[_0xb63d('0x10e')](_0x3df6fe);rpcDb[_0xb63d('0x10f')](_0x3df6fe,_0xb63d('0x110'));delete _0x18475d[_0xb63d('0x71')][_0x49bc40];_0x555562(ut[_0xb63d('0x60')]('Contact\x20in\x20black\x20List',_0x3d15ac,_0x1a46fb));}});};Preview[_0xb63d('0x10')][_0xb63d('0x9a')]=function(_0xbb7e45){return!_[_0xb63d('0x6f')](_0xbb7e45)&&!_[_0xb63d('0x6f')](_0xbb7e45[_0xb63d('0x26')])&&!_[_0xb63d('0x6f')](_0xbb7e45[_0xb63d('0x51')])&&_0xbb7e45[_0xb63d('0x51')]&&!_[_0xb63d('0x6f')](this[_0xb63d('0x14')][util[_0xb63d('0x59')](_0xb63d('0x111'),_0xbb7e45[_0xb63d('0x26')])])&&!_['isNil'](this[_0xb63d('0x14')][util['format']('SIP/%s',_0xbb7e45[_0xb63d('0x26')])][_0xb63d('0x7a')])&&(this[_0xb63d('0x14')][util[_0xb63d('0x59')](_0xb63d('0x111'),_0xbb7e45[_0xb63d('0x26')])][_0xb63d('0x7a')]===_0xb63d('0x112')||this[_0xb63d('0x14')][util[_0xb63d('0x59')](_0xb63d('0x111'),_0xbb7e45[_0xb63d('0x26')])][_0xb63d('0x7a')]===_0xb63d('0x113'));};Preview[_0xb63d('0x10')][_0xb63d('0x8a')]=function(_0x3607cb,_0x45e973){var _0x2959c6=this;return new BPromise(function(_0xabd091,_0x38b583){_0x2959c6['execRun'](_0x3607cb,_0x45e973)[_0xb63d('0x85')](function(_0x158165){_0xabd091(_[_0xb63d('0x114')](_0x158165,[_0xb63d('0x60')]));})[_0xb63d('0x7c')](function(_0x9cf74c){if(_0x9cf74c[_0xb63d('0x115')]){rpcDb[_0xb63d('0x116')](_0x3607cb);}if(_0x9cf74c[_0xb63d('0x51')]){rpcDb['disableContact'](_0x3607cb);}_0x38b583(_[_0xb63d('0x114')](_0x9cf74c,[_0xb63d('0x60')]));});});};Preview[_0xb63d('0x10')][_0xb63d('0x117')]=function(_0x41aaad,_0x498363){var _0x4dea5d=this;return new BPromise(function(_0x1283a5,_0x5c8305){var _0x3c748e,_0x6e7eb;rpcDb[_0xb63d('0x118')](_0x41aaad)['then'](function(_0x288f13){if(!_['isNil'](_0x288f13[0x0])){_0x6e7eb=_0x288f13[0x0][_0xb63d('0x119')]?![]:!![];_0x3c748e=_0x288f13[0x0]['recallme']?!![]:![];_0x3c748e=_0x498363?!![]:_0x3c748e;}var _0x3e9ce4=_0x4dea5d['validateContact'](_0x288f13);if(_0x3e9ce4[_0xb63d('0x11a')]){rpcDb[_0xb63d('0x11b')](_[_0xb63d('0x114')](_0x288f13[0x0],[_0xb63d('0x77'),_0xb63d('0x11c')]))[_0xb63d('0x85')](function(_0x1925b3){_0x4dea5d[_0xb63d('0x101')](_0x1925b3,_0x288f13[0x0],_0x498363,_0x6e7eb,_0x3c748e)[_0xb63d('0x85')](function(_0x171afa){_0x1283a5(_0x171afa);})[_0xb63d('0x7c')](function(_0x5bdf97){_0x5c8305(_0x5bdf97);});})[_0xb63d('0x7c')](function(_0x982099){ut[_0xb63d('0x62')](_0xb63d('0x11d'),_0x982099);_0x5c8305(ut['message'](_0xb63d('0x11e'),_0x6e7eb,_0x3c748e));});}else{_0x5c8305(ut[_0xb63d('0x60')](_0x3e9ce4[_0xb63d('0x60')],_0x6e7eb,_0x3c748e));}})[_0xb63d('0x7c')](function(_0x394275){ut[_0xb63d('0x62')](_0xb63d('0x11f'),_0x394275);_0x5c8305(ut[_0xb63d('0x60')](_0xb63d('0x11e'),![],!![]));});});};Preview[_0xb63d('0x10')]['validateContact']=function(_0xe091e8){if(_['isNil'](_0xe091e8)||_[_0xb63d('0x105')](_0xe091e8)||!_['isNil'](_0xe091e8[0x0]['Agent'])&&_[_0xb63d('0x6f')](_0xe091e8[0x0][_0xb63d('0x89')]['name'])){ut[_0xb63d('0x62')](_0xb63d('0x120'),_0xe091e8);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x24dea7=this[_0xb63d('0x13')][_0xe091e8[0x0][_0xb63d('0x121')][_0xb63d('0x26')]];_0x24dea7[_0xb63d('0x60')]=_0xb63d('0x9c');if(_[_0xb63d('0x6f')](_0x24dea7)){ut['logger'](_0xb63d('0x122'),_0x24dea7);return{'isValid':![],'message':_0xb63d('0x123')};}if(!this[_0xb63d('0x9a')](_0x24dea7[_0xb63d('0x50')])){ut[_0xb63d('0x62')](_0xb63d('0x124'),_0xb63d('0x125')+_0x24dea7[_0xb63d('0x26')]+_0xb63d('0x126'));if(!this[_0xb63d('0x9a')](_0x24dea7[_0xb63d('0x127')])){ut[_0xb63d('0x62')](_0xb63d('0x124'),_0x24dea7[_0xb63d('0x26')]+_0xb63d('0x128'));return{'isValid':![],'message':_0xb63d('0x129')};}}if(!ut[_0xb63d('0x99')](_0x24dea7[_0xb63d('0x32')])){ut['logger']('[Preview][validateContact][Campaign\x20Active]',_0x24dea7[_0xb63d('0x26')]+'\x20Not\x20Active');return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x24dea7[_0xb63d('0x26')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0xb63d('0x12a')};};Preview[_0xb63d('0x10')][_0xb63d('0x106')]=function(_0x1a868b,_0x42acb2,_0x8bd53c,_0x4d6e30){var _0x3b56cc=this;return new BPromise(function(_0x1d14c0,_0x180d8e){var _0x2a0645=_0x1a868b[_0xb63d('0xb1')];var _0x34e2d3=_0x3b56cc[_0xb63d('0x9a')](_0x42acb2[_0xb63d('0x50')])?util[_0xb63d('0x59')]('SIP/%s/%s%s',_0x42acb2[_0xb63d('0x50')][_0xb63d('0x26')],_[_0xb63d('0x6f')](_0x42acb2['dialPrefix'])?'':_0x42acb2['dialPrefix'][_0xb63d('0x12b')]()||'',_0x42acb2[_0xb63d('0x12c')]>0x0?_0x8bd53c[_0xb63d('0x12d')][_0xb63d('0x102')][_0xb63d('0x12e')](_0x42acb2[_0xb63d('0x12c')]):_0x8bd53c[_0xb63d('0x12d')][_0xb63d('0x102')]):util['format'](_0xb63d('0x12f'),_[_0xb63d('0x6f')](_0x42acb2['TrunkBackup'])?_0x42acb2[_0xb63d('0x50')]['name']:_0x42acb2[_0xb63d('0x127')]['name'],_[_0xb63d('0x6f')](_0x42acb2[_0xb63d('0x37')])?'':_0x42acb2['dialPrefix'][_0xb63d('0x12b')]()||'',_0x42acb2[_0xb63d('0x12c')]>0x0?_0x8bd53c[_0xb63d('0x12d')][_0xb63d('0x102')][_0xb63d('0x12e')](_0x42acb2[_0xb63d('0x12c')]):_0x8bd53c['Contact']['phone']);var _0x58a2bb=_0x3b56cc['isTrunkReachable'](_0x42acb2['Trunk'])?ut['getCallerId'](_0x42acb2[_0xb63d('0x50')][_0xb63d('0x52')],_0x42acb2[_0xb63d('0x34')],_0x42acb2[_0xb63d('0x130')]>0x0?ut[_0xb63d('0x131')](_0x42acb2[_0xb63d('0x35')],_0x42acb2[_0xb63d('0x130')]):_0x42acb2[_0xb63d('0x35')]):ut[_0xb63d('0x132')](_[_0xb63d('0x6f')](_0x42acb2['TrunkBackup'])?_0x42acb2[_0xb63d('0x50')][_0xb63d('0x52')]:_0x42acb2[_0xb63d('0x127')][_0xb63d('0x52')],_0x42acb2[_0xb63d('0x34')],_0x42acb2['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0xb63d('0x131')](_0x42acb2[_0xb63d('0x35')],_0x42acb2[_0xb63d('0x130')]):_0x42acb2['dialOriginateCallerIdNumber']);if(_0x58a2bb){_0x1a868b[_0xb63d('0x133')]=ut[_0xb63d('0x134')](_0x58a2bb);_0x1a868b[_0xb63d('0x135')]=ut[_0xb63d('0x136')](_0x58a2bb);}var _0x1f5a3a=ut[_0xb63d('0x137')](_0x42acb2,_0x8bd53c,_0x34e2d3,_0x58a2bb,_0x2a0645,_0x1a868b);_['merge'](_0x1a868b,ut[_0xb63d('0x138')](_0x1f5a3a));_0x1a868b[_0xb63d('0x8e')]=moment()[_0xb63d('0x59')](_0xb63d('0xae'));ami[_0xb63d('0x79')](ut['variablesAction'](_0x1a868b,_0x42acb2,_0x1f5a3a,_0x1a868b[_0xb63d('0xac')],_0x4d6e30))[_0xb63d('0x85')](function(_0x427a16){var _0x40ad76=_0x1a868b[_0xb63d('0x139')];if(!_[_0xb63d('0x6f')](_0x40ad76)){if(!_[_0xb63d('0x6f')](_0x3b56cc[_0xb63d('0x15')][_0x40ad76])){_0x3b56cc[_0xb63d('0x15')][_0x40ad76][_0xb63d('0x13a')]=_0x1a868b[_0xb63d('0x13b')];emit(util['format'](_0xb63d('0x13c'),_0x3b56cc[_0xb63d('0x15')][_0x40ad76][_0xb63d('0x26')]),_0xb63d('0x13d'),{'destaccountcode':_0x3b56cc['agents'][_0x40ad76][_0xb63d('0x13e')],'destconnectedlinenum':_0x1a868b[_0xb63d('0x13b')]});}}_0x42acb2[_0xb63d('0x5e')]+=0x1;logger[_0xb63d('0x56')](_0xb63d('0x13f'),_0x2a0645,_0xb63d('0xb2'),_0x42acb2[_0xb63d('0x26')],_0xb63d('0x72'),_0x42acb2[_0xb63d('0x5e')]);_0x1d14c0(_0x427a16);})[_0xb63d('0x7c')](function(_0x30b717){ut[_0xb63d('0xf8')](_0x1a868b,0xe,_0xb63d('0x140'));rpcDb['createAgentHistory'](_0x1a868b,_0xb63d('0x141'));_0x180d8e(_0x30b717);});});};Preview['prototype'][_0xb63d('0x142')]=function(_0x232d3d){if(this[_0xb63d('0x71')][_0x232d3d[_0xb63d('0xc3')]]){this[_0xb63d('0x71')][_0x232d3d[_0xb63d('0xc3')]][_0xb63d('0x7b')]=_0x232d3d['channel'];}};Preview[_0xb63d('0x10')]['syncOriginateResponse']=function(_0x2d00a4){var _0x4b1cc9=this;var _0x4ea3e2=this['actions'][_0x2d00a4['actionid']];if(_0x4ea3e2){if(_0x4ea3e2[_0xb63d('0x104')]&&this[_0xb63d('0x15')][_0x4ea3e2[_0xb63d('0x104')]]){ut[_0xb63d('0x143')](_0x4ea3e2,this[_0xb63d('0x15')][_0x4ea3e2[_0xb63d('0x104')]][_0xb63d('0x26')],this[_0xb63d('0x15')][_0x4ea3e2[_0xb63d('0x104')]]['id']);}var _0x3fd8cf=_[_0xb63d('0x144')](_0x4ea3e2);_0x3fd8cf['responsetime']=moment()['format'](_0xb63d('0xae'));var _0x1b55f4=_0x4b1cc9[_0xb63d('0x13')][_0x4ea3e2[_0xb63d('0x73')]];if(ut[_0xb63d('0x145')](_0x2d00a4[_0xb63d('0x146')])){if(_0x4ea3e2[_0xb63d('0xab')]){rpcDb['unlockContact'](_0x4ea3e2[_0xb63d('0x10a')]);}if(_0x4ea3e2['activeContact']){rpcDb['disableContact'](_0x4ea3e2[_0xb63d('0x10a')]);}ami[_0xb63d('0x5b')](_0xb63d('0x147'),ut[_0xb63d('0xa0')](_0x4ea3e2,_0xb63d('0x148'),this[_0xb63d('0x13')][_0x4ea3e2['queue']]));this[_0xb63d('0x149')](_0x3fd8cf,_0x1b55f4,_0x2d00a4);}else{_0x4ea3e2['starttime']=moment()[_0xb63d('0x59')](_0xb63d('0xae'));ut[_0xb63d('0xf8')](_0x3fd8cf,0x4,_0xb63d('0xbe'));rpcDb[_0xb63d('0xf7')](_0x3fd8cf,_0xb63d('0x14a'));}}};Preview[_0xb63d('0x10')][_0xb63d('0x1b')]=function(_0x4c9270){var _0x8ab3ec=this;var _0x1a67ee=this[_0xb63d('0x71')][_0x4c9270['linkedid']];var _0x162dee;if(_0x1a67ee){_0x162dee=this[_0xb63d('0x13')][_0x1a67ee[_0xb63d('0x73')]];logger[_0xb63d('0x56')](_0xb63d('0x14b'),_0x4c9270[_0xb63d('0xc3')],_0xb63d('0xb2'),_0x162dee[_0xb63d('0x26')],_0xb63d('0xb3'),_0x162dee[_0xb63d('0x74')]);}if(this[_0xb63d('0x71')][_0x4c9270[_0xb63d('0xc3')]]&&_0x4c9270['linkedid']!==_0x4c9270['uniqueid']){if(_0x4c9270[_0xb63d('0x14c')]==='16'&&this['actions'][_0x4c9270['linkedid']][_0xb63d('0x75')]){this['callProgressDetectingCustomer'](_0x4c9270,_0x4c9270['linkedid'],_0x4c9270['cause']);}else if(this['actions'][_0x4c9270[_0xb63d('0xc3')]][_0xb63d('0x75')]){logger[_0xb63d('0x56')](_0xb63d('0x14d'),_0x4c9270[_0xb63d('0xc3')],_0x4c9270['cause'],_0xb63d('0xb2'),_0x162dee['name'],_0xb63d('0xb3'),_0x162dee[_0xb63d('0x74')]);this[_0xb63d('0x14e')](_0x4c9270,_0x4c9270['linkedid'],_0x4c9270[_0xb63d('0x14c')]);}}else if(_0x1a67ee&&_['isNil'](_0x1a67ee[_0xb63d('0x14f')])&&_0x162dee[_0xb63d('0x150')]&&_0x4c9270[_0xb63d('0xc3')]===_0x4c9270[_0xb63d('0xb1')]&&_[_0xb63d('0x6f')](_0x4c9270['reason'])&&_0x4c9270[_0xb63d('0x14c')]==='16'&&_0x4c9270[_0xb63d('0x151')]==='6'&&_[_0xb63d('0x152')](_0x1a67ee[_0xb63d('0x153')])){if(_0x1a67ee[_0xb63d('0xab')]){rpcDb['unlockContact'](_0x1a67ee[_0xb63d('0x10a')]);}if(_0x1a67ee['activeContact']){rpcDb['disableContact'](_0x1a67ee['idContact']);}_0x4c9270[_0xb63d('0xf6')]='22';this[_0xb63d('0x149')](_0x1a67ee,_0x162dee,_0x4c9270);}else if(_0x1a67ee&&_0x1a67ee['transfer']){if(_0x4c9270['cause']==='16'&&this[_0xb63d('0x71')][_0x4c9270[_0xb63d('0xc3')]][_0xb63d('0x75')]){logger[_0xb63d('0x56')](_0xb63d('0x154'),_0x4c9270[_0xb63d('0xc3')],_0x4c9270[_0xb63d('0x14c')],'\x20Queue',_0x162dee[_0xb63d('0x26')],_0xb63d('0xb3'),_0x162dee[_0xb63d('0x74')]);this['callProgressDetectingCustomer'](_0x4c9270,_0x4c9270['linkedid'],_0x4c9270['cause']);}else if(this[_0xb63d('0x71')][_0x4c9270['linkedid']][_0xb63d('0x75')]){logger[_0xb63d('0x56')]('[syncHangup][talking][cause]',_0x4c9270[_0xb63d('0xc3')],_0x4c9270[_0xb63d('0x14c')],_0xb63d('0xb2'),_0x162dee[_0xb63d('0x26')],_0xb63d('0xb3'),_0x162dee[_0xb63d('0x74')]);this[_0xb63d('0x14e')](_0x4c9270,_0x4c9270['linkedid'],_0x4c9270[_0xb63d('0x14c')]);}}};Preview[_0xb63d('0x10')][_0xb63d('0x1f')]=function(_0x27c995){if(this['actions'][_0x27c995[_0xb63d('0xf4')]]&&_0x27c995[_0xb63d('0xf4')]!==_0x27c995[_0xb63d('0x155')]){this['callProgressDetectingCustomer'](_0x27c995,_0x27c995[_0xb63d('0xf4')],_0x27c995[_0xb63d('0xe9')]);}};Preview['prototype'][_0xb63d('0x1d')]=function(_0x4e5728){if(this[_0xb63d('0x71')][_0x4e5728[_0xb63d('0xc3')]]&&_0x4e5728['linkedid']!==_0x4e5728[_0xb63d('0xb1')]&&!this['actions'][_0x4e5728[_0xb63d('0xc3')]][_0xb63d('0x75')]){if(_0x4e5728[_0xb63d('0x14c')]==='1'){this[_0xb63d('0x14e')](_0x4e5728,_0x4e5728[_0xb63d('0xc3')],_0x4e5728[_0xb63d('0x14c')]);}}};Preview[_0xb63d('0x10')][_0xb63d('0x156')]=function(_0x42bdb5,_0x249119,_0x441c29){if(this[_0xb63d('0x71')][_0x42bdb5]){if(_['isNil'](this[_0xb63d('0x71')][_0x42bdb5][_0xb63d('0x157')])){this[_0xb63d('0x71')][_0x42bdb5]['variables']={};}this[_0xb63d('0x71')][_0x42bdb5][_0xb63d('0x157')][_0x249119]=_0x441c29;}};Preview['prototype'][_0xb63d('0x20')]=function(_0x38475c){try{if(!_[_0xb63d('0x6f')](_0x38475c)){if(ut[_0xb63d('0x158')](_[_0xb63d('0x159')](_0x38475c[_0xb63d('0x15a')])[0x0])){this[_0xb63d('0x156')](_0x38475c[_0xb63d('0xb1')],_[_0xb63d('0x159')](_0x38475c['variable'])[0x0],_0x38475c[_0xb63d('0x15b')]);}}}catch(_0x327312){logger[_0xb63d('0x15c')](_0xb63d('0x15d'),util[_0xb63d('0x15e')](_0x327312,{'showHidden':![],'depth':null}));}};Preview['prototype'][_0xb63d('0x22')]=function(_0x2e5ff1){if(_0x2e5ff1){if(this['actions'][_0x2e5ff1[_0xb63d('0x15f')]]){this[_0xb63d('0x71')][_0x2e5ff1[_0xb63d('0x15f')]][_0xb63d('0x153')]=!![];}}};Preview['prototype'][_0xb63d('0x160')]=function(_0x5b7ebb){if(_0x5b7ebb){if(this[_0xb63d('0x71')][_0x5b7ebb[_0xb63d('0x161')]]){this[_0xb63d('0x71')][_0x5b7ebb[_0xb63d('0x161')]][_0xb63d('0x153')]=!![];}}};module[_0xb63d('0x162')]=Preview; \ No newline at end of file +var _0xfd59=['callProgressDetectingAgent','object','isUndefined','reason','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','logAgent','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','Congestion','AnswerAGI','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','Contact','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','[Preview][execCall][failure]','Call\x20failed','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','execRun','pick','unlock','unlockContact','disableContact','validateContact','isValid','Contact.phone','checkInBlack','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','phone','substring','dialCutDigit','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','extractCalleridName','originatecalleridnum','addVariables','merge','toLowerVariables','variablesAction','channelAgent','destconnectedlinenum','calleridnum','user:agentconnect','[originated][increment]','[originateFailure][logOriginateFailure]','actionid','clone','isFailure','response','idContact','custom:agentringnoanswer','starttime','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','statedesc','dialQueueProject','channelstate','transfer','destlinkedid','destuniqueid','addVariable','variables','syncVarSet','keys','value','error','[syncVarSet][Preview]','inspect','syncAttendedTransfer','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','moment','md5','ioredis','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./util/util','redis','defaults','prototype','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','blindtransfer','syncBlindTransfer','loopCampaigns','emit','type','name','strategy','answered','loggedIn','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangBusyFactor','startPredictive','Trunk','active','Interval','stringify','format','voice_queue:save','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice:queue:%s','voice_queue_presence:remove','sendMessageOneNotActive','pTalking','available','paused','NOT_ACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','logger','syncCampaigns','hasOwnProperty','dialMethod','booked','outbound','clearZombieChannels','clearZombieChannel','isNil','info','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','contactId','VoiceQueueId','ListId','Action','status','channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[action]','getContactRecallMe','agentReadyId','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','run','then','catch','logger2','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','[HistoryDialRecallInQueue][historyCatch]','createCustomerHistory','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','setMessage','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','custom:agentnosuchnumber','buildObj','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','linkedid','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','\x20Queue','custom:agentconnect','connect','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','[16]','Answer','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','uniqueid','BUSY','countbusyretry','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','NOANSWER','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerRetryFrequency','activeContact','CONGESTION','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','countcongestionretry','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','countabandonedretry','Abandoned','countabandonedetry','dialAbandonedMaxRety','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedRetryFrequency','countmachineretry','cause-txt','custom:amd','amd','dialstatus','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]'];(function(_0x1e2cd0,_0x14b589){var _0x1ab91b=function(_0x3e58be){while(--_0x3e58be){_0x1e2cd0['push'](_0x1e2cd0['shift']());}};_0x1ab91b(++_0x14b589);}(_0xfd59,0x64));var _0x9fd5=function(_0x1c68c3,_0x28fdd9){_0x1c68c3=_0x1c68c3-0x0;var _0x47179a=_0xfd59[_0x1c68c3];return _0x47179a;};'use strict';var util=require(_0x9fd5('0x0'));var _=require(_0x9fd5('0x1'));var BPromise=require('bluebird');var uuid=require(_0x9fd5('0x2'));var moment=require(_0x9fd5('0x3'));var md5=require(_0x9fd5('0x4'));var Redis=require(_0x9fd5('0x5'));var config=require('../../../config/environment');var logger=require(_0x9fd5('0x6'))(_0x9fd5('0x7'));var loggerAction=require(_0x9fd5('0x6'))(_0x9fd5('0x8'));var ami=require(_0x9fd5('0x9'));var rpcDb=require(_0x9fd5('0xa'));var Action=require('./action');var ut=require(_0x9fd5('0xb'));config[_0x9fd5('0xc')]=_[_0x9fd5('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9fd5('0xc')]));var Sequence=function(){};Sequence[_0x9fd5('0xe')]['enqueue']=function(_0x3b5567){this[_0x9fd5('0xf')]=this['tail']?this[_0x9fd5('0xf')][_0x9fd5('0x10')](_0x3b5567):_0x3b5567();};function Preview(_0x8d0136){this[_0x9fd5('0x11')]=new Sequence();this[_0x9fd5('0x12')]=_0x8d0136[_0x9fd5('0x13')];this['trunks']=_0x8d0136[_0x9fd5('0x14')];this[_0x9fd5('0x15')]={};this[_0x9fd5('0x16')]=_0x8d0136[_0x9fd5('0x16')];this[_0x9fd5('0x17')]=0x0;ami['on']('originateresponse',this[_0x9fd5('0x18')][_0x9fd5('0x19')](this));ami['on'](_0x9fd5('0x1a'),this[_0x9fd5('0x1b')][_0x9fd5('0x19')](this));ami['on'](_0x9fd5('0x1c'),this[_0x9fd5('0x1d')][_0x9fd5('0x19')](this));ami['on'](_0x9fd5('0x1e'),this[_0x9fd5('0x1f')][_0x9fd5('0x19')](this));ami['on'](_0x9fd5('0x20'),this[_0x9fd5('0x21')][_0x9fd5('0x19')](this));ami['on']('varset',this['syncVarSet'][_0x9fd5('0x19')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0x9fd5('0x19')](this));ami['on'](_0x9fd5('0x22'),this[_0x9fd5('0x23')][_0x9fd5('0x19')](this));this[_0x9fd5('0x24')](this['campaignsPreview']);}function emit(_0x51a639,_0x1140bb,_0x434c6b){io['to'](_0x51a639)[_0x9fd5('0x25')](_0x1140bb,_0x434c6b);}function emitCampaignPreview(_0x2357ad){if(_0x2357ad[_0x9fd5('0x26')]==='outbound'){var _0x1df43f={'id':_0x2357ad['id'],'name':_0x2357ad[_0x9fd5('0x27')],'strategy':_0x2357ad[_0x9fd5('0x28')],'answered':_0x2357ad[_0x9fd5('0x29')],'available':_0x2357ad['available'],'loggedIn':_0x2357ad[_0x9fd5('0x2a')],'pTalking':_0x2357ad['pTalking'],'sumBillable':_0x2357ad[_0x9fd5('0x2b')],'sumDuration':_0x2357ad[_0x9fd5('0x2c')],'sumHoldTime':_0x2357ad[_0x9fd5('0x2d')]||0x0,'talking':_0x2357ad[_0x9fd5('0x2e')],'total':_0x2357ad[_0x9fd5('0x2f')],'type':_0x2357ad[_0x9fd5('0x26')],'unmanaged':_0x2357ad[_0x9fd5('0x30')],'abandoned':_0x2357ad[_0x9fd5('0x31')],'waiting':_0x2357ad[_0x9fd5('0x32')],'loggedInDb':_0x2357ad[_0x9fd5('0x33')],'dialActive':_0x2357ad[_0x9fd5('0x34')],'dialMethod':_0x2357ad['dialMethod'],'dialOriginateCallerIdName':_0x2357ad[_0x9fd5('0x35')],'dialOriginateCallerIdNumber':_0x2357ad[_0x9fd5('0x36')],'dialOriginateTimeout':_0x2357ad[_0x9fd5('0x37')],'dialPrefix':_0x2357ad[_0x9fd5('0x38')],'outboundAnswerAgiCallsDay':_0x2357ad['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x2357ad[_0x9fd5('0x39')],'outboundBlacklistCallsDay':_0x2357ad[_0x9fd5('0x3a')],'outboundBusyCallsDay':_0x2357ad[_0x9fd5('0x3b')],'outboundCongestionCallsDay':_0x2357ad[_0x9fd5('0x3c')],'outboundDropCallsDayACS':_0x2357ad['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x2357ad['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x2357ad[_0x9fd5('0x3d')],'outboundNoAnswerCallsDay':_0x2357ad[_0x9fd5('0x3e')],'outboundNoSuchCallsDay':_0x2357ad[_0x9fd5('0x3f')],'outboundOriginateFailureCallsDay':_0x2357ad[_0x9fd5('0x40')],'outboundReCallsDay':_0x2357ad[_0x9fd5('0x41')],'outboundRejectCallsDay':_0x2357ad['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x2357ad[_0x9fd5('0x42')],'outboundAbandonedCallsDay':_0x2357ad[_0x9fd5('0x43')],'predictiveIntervalAnsweredCalls':_0x2357ad[_0x9fd5('0x44')],'predictiveIntervalAvgHoldtime':_0x2357ad[_0x9fd5('0x45')],'predictiveIntervalAvgTalktime':_0x2357ad[_0x9fd5('0x46')],'predictiveIntervalDroppedCallsCallersExit':_0x2357ad[_0x9fd5('0x47')],'predictiveIntervalDroppedCallsTimeout':_0x2357ad[_0x9fd5('0x48')],'predictiveIntervalErlangCalls':_0x2357ad['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x2357ad[_0x9fd5('0x49')],'predictiveIntervalHitRate':_0x2357ad['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x2357ad[_0x9fd5('0x4a')],'predictiveIntervalPauses':_0x2357ad['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x2357ad[_0x9fd5('0x4b')],'predictiveIntervalTotalCalls':_0x2357ad[_0x9fd5('0x4c')],'message':_0x2357ad[_0x9fd5('0x4d')],'originated':_0x2357ad[_0x9fd5('0x4e')],'erlangCalls':_0x2357ad[_0x9fd5('0x4f')],'erlangCallToSecond':_0x2357ad[_0x9fd5('0x50')],'erlangAbandonmentRate':_0x2357ad['erlangAbandonmentRate'],'erlangBusyFactor':_0x2357ad[_0x9fd5('0x51')],'startPredictive':_0x2357ad[_0x9fd5('0x52')],'startProgressive':_0x2357ad['startProgressive']};if(_0x2357ad[_0x9fd5('0x53')]){_0x1df43f[_0x9fd5('0x53')]={'id':_0x2357ad['Trunk']['id'],'name':_0x2357ad[_0x9fd5('0x53')][_0x9fd5('0x27')],'active':_0x2357ad[_0x9fd5('0x53')][_0x9fd5('0x54')],'callerid':_0x2357ad[_0x9fd5('0x53')]['callerid']};}if(_0x2357ad['Interval']){_0x1df43f[_0x9fd5('0x55')]={'id':_0x2357ad[_0x9fd5('0x55')]['id'],'name':_0x2357ad['Interval']['name']};}var _0x14f07f=md5(JSON[_0x9fd5('0x56')](_0x1df43f));if(_0x2357ad[_0x9fd5('0x4')]!==_0x14f07f){_0x2357ad['md5']=_0x14f07f;emit(util[_0x9fd5('0x57')]('voice:queue:%s',_0x1df43f[_0x9fd5('0x27')]),_0x9fd5('0x58'),_0x1df43f);}}}function emitVoiceQueueChannelRemove(_0x5ecd0a){logger['info'](_0x9fd5('0x59'),JSON['stringify'](_0x5ecd0a));emit(util[_0x9fd5('0x57')](_0x9fd5('0x5a'),_0x5ecd0a[_0x9fd5('0x27')]),'voice_queue_channel:remove',_0x5ecd0a);io[_0x9fd5('0x25')](_0x9fd5('0x5b'),_0x5ecd0a);}function notSendMessagesQueue(_0x5ad511){if(_0x5ad511[_0x9fd5('0x5c')]){if(_0x5ad511[_0x9fd5('0x4e')]===0x0&&_0x5ad511[_0x9fd5('0x5d')]===0x0){_0x5ad511[_0x9fd5('0x5c')]=![];_0x5ad511[_0x9fd5('0x5e')]=0x0;_0x5ad511[_0x9fd5('0x5f')]=0x0;_0x5ad511[_0x9fd5('0x4d')]=_0x9fd5('0x60');ut['logger'](_0x9fd5('0x61'),_0x5ad511[_0x9fd5('0x27')]+_0x9fd5('0x62'));}else{_0x5ad511[_0x9fd5('0x4d')]=_0x9fd5('0x63');ut[_0x9fd5('0x64')](_0x9fd5('0x61'),_0x5ad511[_0x9fd5('0x27')]+'\x20is\x20disactive');}emitCampaignPreview(_0x5ad511);}}Preview[_0x9fd5('0xe')]['loopCampaigns']=function(){var _0x5e2bc4=this;setInterval(function(){_0x5e2bc4[_0x9fd5('0x65')]();},0x7cf);};Preview['prototype'][_0x9fd5('0x65')]=function(){var _0x19cfb0=this['campaignsPreview'];this[_0x9fd5('0x17')]+=0x1;for(var _0x3f92bd in _0x19cfb0){if(_0x19cfb0[_0x9fd5('0x66')](_0x3f92bd)&&(_0x19cfb0[_0x3f92bd]['dialMethod']==='preview'||_0x19cfb0[_0x3f92bd][_0x9fd5('0x67')]===_0x9fd5('0x68'))&&_0x19cfb0[_0x3f92bd][_0x9fd5('0x26')]===_0x9fd5('0x69')){if(this[_0x9fd5('0x17')]>0x7){this[_0x9fd5('0x17')]=0x0;this[_0x9fd5('0x6a')]();}}if(_0x19cfb0[_0x9fd5('0x66')](_0x3f92bd)&&_0x19cfb0[_0x3f92bd]['dialMethod']===_0x9fd5('0x7')&&_0x19cfb0[_0x3f92bd][_0x9fd5('0x26')]===_0x9fd5('0x69')){if(_0x19cfb0[_0x3f92bd][_0x9fd5('0x34')]){this['setMessage'](_0x19cfb0[_0x3f92bd]);this['recallMe'](_0x19cfb0[_0x3f92bd]);}else{notSendMessagesQueue(_0x19cfb0[_0x3f92bd]);}}}};Preview[_0x9fd5('0xe')][_0x9fd5('0x6b')]=function(_0x250cff){var _0x379f1b=this;this['sequence']['enqueue'](function(){if(!_[_0x9fd5('0x6c')](_0x379f1b[_0x9fd5('0x15')][_0x250cff])){loggerAction[_0x9fd5('0x6d')](_0x9fd5('0x6e'),_0x250cff,_0x9fd5('0x6f'),_0x379f1b[_0x9fd5('0x15')][_0x250cff][_0x9fd5('0x70')],_0x9fd5('0x71'),JSON[_0x9fd5('0x56')](_0x379f1b[_0x9fd5('0x12')][_0x379f1b['actions'][_0x250cff][_0x9fd5('0x70')]][_0x9fd5('0x4e')]),_0x9fd5('0x72'),JSON[_0x9fd5('0x56')](_0x379f1b[_0x9fd5('0x12')][_0x379f1b[_0x9fd5('0x15')][_0x250cff][_0x9fd5('0x70')]][_0x9fd5('0x5d')]),JSON['stringify'](_0x379f1b[_0x9fd5('0x15')][_0x250cff][_0x9fd5('0x73')]),JSON['stringify'](_['pick'](_0x379f1b[_0x9fd5('0x15')][_0x250cff],[_0x9fd5('0x74'),'UserId',_0x9fd5('0x75'),_0x9fd5('0x76')])));return ami[_0x9fd5('0x77')]({'action':_0x9fd5('0x78'),'channel':_0x379f1b[_0x9fd5('0x15')][_0x250cff][_0x9fd5('0x79')]})['catch'](function(_0x5299ce){if(_0x5299ce[_0x9fd5('0x4d')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x379f1b[_0x9fd5('0x15')][_0x250cff]){ut[_0x9fd5('0x7a')](_0x379f1b[_0x9fd5('0x12')][_0x379f1b[_0x9fd5('0x15')][_0x250cff]['queue']],_0x9fd5('0x7b'));if(_0x379f1b[_0x9fd5('0x15')][_0x250cff][_0x9fd5('0x73')]===!![]){ut[_0x9fd5('0x7c')](_0x379f1b['campaignsPreview'][_0x379f1b[_0x9fd5('0x15')][_0x250cff][_0x9fd5('0x70')]],'[clearZombieChannel]');ut[_0x9fd5('0x7d')](_0x9fd5('0x7e')+_0x250cff,_0x379f1b[_0x9fd5('0x15')][_0x250cff]['queue']);}ut[_0x9fd5('0x7d')]('[Dialer][checkChannel][Preview]'+_0x250cff,_0x379f1b[_0x9fd5('0x15')][_0x250cff]['queue']);delete _0x379f1b['actions'][_0x250cff];}},0x2328);}});}});};Preview[_0x9fd5('0xe')][_0x9fd5('0x6a')]=function(){var _0x2d4852=this;loggerAction[_0x9fd5('0x6d')](_0x9fd5('0x7f'),_['size'](this[_0x9fd5('0x15')]));for(var _0x17d332 in this[_0x9fd5('0x15')]){if(_0x2d4852[_0x9fd5('0x15')]['hasOwnProperty'](_0x17d332)){_0x2d4852[_0x9fd5('0x6b')](_0x17d332);}}};Preview[_0x9fd5('0xe')]['recallMe']=function(_0x2967b9){var _0x11ae10=this;rpcDb[_0x9fd5('0x80')](_0x2967b9['id'],ut[_0x9fd5('0x81')](this[_0x9fd5('0x16')]))['then'](function(_0x1345cf){if(!_[_0x9fd5('0x6c')](_0x1345cf)){for(var _0x3e2f29=0x0;_0x3e2f29<_0x1345cf[_0x9fd5('0x82')];_0x3e2f29+=0x1){if(ut[_0x9fd5('0x83')](_0x1345cf[_0x3e2f29][_0x9fd5('0x84')])<_0x2967b9[_0x9fd5('0x85')]*0x3c){if(_0x1345cf[_0x3e2f29][_0x9fd5('0x86')]&&!_0x1345cf[_0x3e2f29][_0x9fd5('0x86')]['voicePause']){_0x11ae10[_0x9fd5('0x87')](_0x1345cf[_0x3e2f29]['id'])[_0x9fd5('0x88')](ut['logger2']('[RecallMe]'))[_0x9fd5('0x89')](ut[_0x9fd5('0x8a')]('[RecallMe]'));}else{rpcDb['disableContact'](_0x1345cf[_0x3e2f29]['id']);}}else{var _0x3eda36=new Action(_0x1345cf[_0x3e2f29],_0x2967b9);_0x3eda36['starttime']=moment()[_0x9fd5('0x57')](_0x9fd5('0x8b'));_0x2967b9[_0x9fd5('0x41')]+=0x1;ut[_0x9fd5('0x8c')](_0x3eda36,0x17,_0x9fd5('0x8d'));if(_0x2967b9[_0x9fd5('0x8e')]){rpcDb[_0x9fd5('0x8f')](ut[_0x9fd5('0x90')](_0x1345cf[_0x3e2f29]));rpcDb['createCustomerHistory'](_0x3eda36,_0x9fd5('0x91'));}else{ut[_0x9fd5('0x8c')](_0x3eda36,0x16,'RecallFailedTimeout');rpcDb[_0x9fd5('0x92')](_0x3eda36,_0x9fd5('0x93'));rpcDb[_0x9fd5('0x94')](_0x3eda36,_0x9fd5('0x93'));}}}}})['catch'](ut[_0x9fd5('0x8a')](_0x9fd5('0x95')));};Preview[_0x9fd5('0xe')][_0x9fd5('0x96')]=function(_0x18acab){_0x18acab[_0x9fd5('0x5c')]=!![];if(ut[_0x9fd5('0x97')](_0x18acab[_0x9fd5('0x2a')])){_0x18acab[_0x9fd5('0x4d')]=_0x9fd5('0x98');}else if(!ut[_0x9fd5('0x99')](_0x18acab[_0x9fd5('0x34')])){_0x18acab[_0x9fd5('0x4d')]=_0x9fd5('0x60');}else if(!this[_0x9fd5('0x9a')](_0x18acab['Trunk'])){if(!this[_0x9fd5('0x9a')](_0x18acab[_0x9fd5('0x9b')])){_0x18acab[_0x9fd5('0x4d')]=_0x9fd5('0x9c');}else{_0x18acab[_0x9fd5('0x4d')]=_0x9fd5('0x9d');}}else{_0x18acab[_0x9fd5('0x4d')]='ACTIVE';}emitCampaignPreview(_0x18acab);};Preview[_0x9fd5('0xe')][_0x9fd5('0x9e')]=function(_0x4a5202,_0x227136,_0x32e0cf){var _0x1ceb42=this;var _0x417361=this[_0x9fd5('0x15')][_0x227136];var _0x4f9fe4=this[_0x9fd5('0x12')][_0x417361['queue']];var _0xb63bc5;if(_0x4f9fe4){switch(_0x32e0cf){case'1':_0x4f9fe4[_0x9fd5('0x3f')]+=0x1;_0x417361[_0x9fd5('0x9f')]+=0x1;_0x417361[_0x9fd5('0xa0')]=ut[_0x9fd5('0xa1')](_0x417361);ut[_0x9fd5('0x8c')](_0x417361,0x0,'NoSuchNumber');ami[_0x9fd5('0x25')](_0x9fd5('0xa2'),ut[_0x9fd5('0xa3')](_0x417361,'nosuchnumber'));rpcDb[_0x9fd5('0x92')](_0x417361,_0x9fd5('0xa4'));if(ut[_0x9fd5('0xa1')](_0x417361)>=_0x4f9fe4[_0x9fd5('0xa5')]){_0xb63bc5=ut[_0x9fd5('0xa6')](_0x417361,0xf,_0x9fd5('0xa7'));rpcDb['createCustomerFinal'](_0xb63bc5,_0x9fd5('0xa8'));}else{if(_0x417361['countnosuchnumberretry']>=_0x4f9fe4[_0x9fd5('0xa9')]){rpcDb[_0x9fd5('0x94')](_0x417361,_0x9fd5('0xa8'));}else{rpcDb[_0x9fd5('0xaa')](ut[_0x9fd5('0xab')](_0x417361,_0x9fd5('0x9f'),_0x4f9fe4[_0x9fd5('0xac')]),_0x417361[_0x9fd5('0xad')],_0x417361['activeContact']);}}delete this['actions'][_0x4a5202[_0x9fd5('0xae')]];break;case _0x9fd5('0xaf'):var _0x16e763=moment()['format'](_0x9fd5('0x8b'));_0x417361[_0x9fd5('0xb0')]=_0x16e763;_0x417361[_0x9fd5('0xb1')]=_0x16e763;_0x417361[_0x9fd5('0x73')]=!![];_0x4f9fe4[_0x9fd5('0x5d')]+=0x1;logger[_0x9fd5('0x6d')](_0x9fd5('0xb2'),_0x417361['uniqueid'],_0x9fd5('0xb3'),_0x4f9fe4[_0x9fd5('0x27')],'pTalking:\x20',_0x4f9fe4[_0x9fd5('0x5d')]);ami[_0x9fd5('0x25')](_0x9fd5('0xb4'),ut[_0x9fd5('0xa3')](_0x417361,_0x9fd5('0xb5'),this[_0x9fd5('0x12')][_0x417361[_0x9fd5('0x70')]]));if(_0x4f9fe4['acw']){ami[_0x9fd5('0x25')](_0x9fd5('0xb6'),ut[_0x9fd5('0xb7')](_0x417361));}break;case'16':ami['emit'](_0x9fd5('0xb8'),ut['buildObj'](_0x417361,_0x9fd5('0xb9'),this[_0x9fd5('0x12')][_0x417361[_0x9fd5('0x70')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x417361,_0x9fd5('0xb9')));_0x4f9fe4[_0x9fd5('0x39')]+=0x1;_0x4f9fe4[_0x9fd5('0x2f')]+=0x1;_0x4f9fe4['answered']+=0x1;ut[_0x9fd5('0x7c')](_0x4f9fe4,_0x9fd5('0xba'));_0x417361[_0x9fd5('0xa0')]=ut[_0x9fd5('0xa1')](_0x417361);ut[_0x9fd5('0x8c')](_0x417361,0x4,_0x9fd5('0xbb'));rpcDb[_0x9fd5('0x92')](_0x417361,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0x9fd5('0x94')](_0x417361,_0x9fd5('0xbc'));rpcDb[_0x9fd5('0xbd')](_0x417361);_0x4f9fe4[_0x9fd5('0x2c')]+=_0x417361[_0x9fd5('0xbe')];_0x4f9fe4[_0x9fd5('0x2b')]+=_0x417361[_0x9fd5('0xbe')];logger[_0x9fd5('0x6d')](_0x9fd5('0xbf'),_0x417361[_0x9fd5('0xc0')],_0x9fd5('0xb3'),_0x4f9fe4['name'],'pTalking:\x20',_0x4f9fe4[_0x9fd5('0x5d')]);delete this[_0x9fd5('0x15')][_0x4a5202[_0x9fd5('0xae')]];break;case _0x9fd5('0xc1'):_0x4f9fe4[_0x9fd5('0x3b')]+=0x1;_0x417361[_0x9fd5('0xc2')]+=0x1;_0x417361[_0x9fd5('0xa0')]=ut['totalGlobal'](_0x417361);ut[_0x9fd5('0x8c')](_0x417361,0x5,_0x9fd5('0xc3'));ami[_0x9fd5('0x25')](_0x9fd5('0xc4'),ut['buildObj'](_0x417361,_0x9fd5('0xc5')));rpcDb[_0x9fd5('0x92')](_0x417361,'[callProgressDetectingCustomer][logBusy]');if(ut[_0x9fd5('0xa1')](_0x417361)>=_0x4f9fe4[_0x9fd5('0xa5')]){_0xb63bc5=ut[_0x9fd5('0xa6')](_0x417361,0xf,_0x9fd5('0xa7'));rpcDb[_0x9fd5('0x94')](_0xb63bc5,_0x9fd5('0xc6'));}else{if(_0x417361[_0x9fd5('0xc2')]>=_0x4f9fe4[_0x9fd5('0xc7')]){rpcDb[_0x9fd5('0x94')](_0x417361,_0x9fd5('0xc8'));}else{rpcDb[_0x9fd5('0xaa')](ut['scheduledAt'](_0x417361,_0x9fd5('0xc2'),_0x4f9fe4['dialBusyRetryFrequency']),_0x417361[_0x9fd5('0xad')],_0x417361['activeContact']);}}break;case _0x9fd5('0xc9'):_0x4f9fe4[_0x9fd5('0x3e')]+=0x1;_0x417361['countnoanswerretry']+=0x1;_0x417361['countglobal']=ut[_0x9fd5('0xa1')](_0x417361);ut[_0x9fd5('0x8c')](_0x417361,0x3,_0x9fd5('0xca'));ami[_0x9fd5('0x25')](_0x9fd5('0xcb'),ut['buildObj'](_0x417361,_0x9fd5('0xcc')));rpcDb[_0x9fd5('0x92')](_0x417361,'[callProgressDetectingCustomer][logNoAnswer]');if(ut[_0x9fd5('0xa1')](_0x417361)>=_0x4f9fe4[_0x9fd5('0xa5')]){_0xb63bc5=ut['cloneAction'](_0x417361,0xf,'Global');rpcDb[_0x9fd5('0x94')](_0xb63bc5,_0x9fd5('0xcd'));}else{if(_0x417361[_0x9fd5('0xce')]>=_0x4f9fe4['dialNoAnswerMaxRetry']){rpcDb['createCustomerFinal'](_0x417361,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0x9fd5('0xaa')](ut[_0x9fd5('0xab')](_0x417361,_0x9fd5('0xce'),_0x4f9fe4[_0x9fd5('0xcf')]),_0x417361[_0x9fd5('0xad')],_0x417361[_0x9fd5('0xd0')]);}}break;case _0x9fd5('0xd1'):_0x4f9fe4[_0x9fd5('0x3c')]+=0x1;_0x417361['countcongestionretry']+=0x1;_0x417361[_0x9fd5('0xa0')]=ut['totalGlobal'](_0x417361);ut[_0x9fd5('0x8c')](_0x417361,0x8,'Congestion');ami['emit'](_0x9fd5('0xd2'),ut[_0x9fd5('0xa3')](_0x417361,_0x9fd5('0xd3')));rpcDb['createCustomerHistory'](_0x417361,_0x9fd5('0xd4'));if(ut['totalGlobal'](_0x417361)>=_0x4f9fe4[_0x9fd5('0xa5')]){_0xb63bc5=ut[_0x9fd5('0xa6')](_0x417361,0xf,'Global');rpcDb['createCustomerFinal'](_0xb63bc5,_0x9fd5('0xd5'));}else{if(_0x417361['countcongestionretry']>=_0x4f9fe4[_0x9fd5('0xd6')]){rpcDb['createCustomerFinal'](_0x417361,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0x9fd5('0xaa')](ut[_0x9fd5('0xab')](_0x417361,_0x9fd5('0xd7'),_0x4f9fe4['dialBusyRetryFrequency']),_0x417361[_0x9fd5('0xad')],_0x417361['activeContact']);}}break;case _0x9fd5('0xd8'):_0x4f9fe4[_0x9fd5('0xd9')]+=0x1;_0x417361[_0x9fd5('0xda')]+=0x1;_0x417361['countglobal']=ut['totalGlobal'](_0x417361);ut[_0x9fd5('0x8c')](_0x417361,0x14,_0x9fd5('0xdb'));ami['emit'](_0x9fd5('0xdc'),ut[_0x9fd5('0xa3')](_0x417361,_0x9fd5('0xdd')));rpcDb[_0x9fd5('0x92')](_0x417361,_0x9fd5('0xde'));if(ut['totalGlobal'](_0x417361)>=_0x4f9fe4[_0x9fd5('0xa5')]){_0xb63bc5=ut[_0x9fd5('0xa6')](_0x417361,0x14,_0x9fd5('0xdb'));rpcDb[_0x9fd5('0x94')](_0xb63bc5,_0x9fd5('0xdf'));}else{if(_0x417361[_0x9fd5('0xda')]>=_0x4f9fe4[_0x9fd5('0xe0')]){rpcDb[_0x9fd5('0x94')](_0x417361,_0x9fd5('0xdf'));}else{rpcDb[_0x9fd5('0xaa')](ut[_0x9fd5('0xab')](_0x417361,'countagentrejectretry',_0x4f9fe4['dialAgentRejectRetryFrequency']),_0x417361[_0x9fd5('0xad')],_0x417361['activeContact']);}}break;case _0x9fd5('0xe1'):_0x4f9fe4[_0x9fd5('0x43')]+=0x1;_0x417361[_0x9fd5('0xe2')]+=0x1;_0x417361[_0x9fd5('0xa0')]=ut[_0x9fd5('0xa1')](_0x417361);ut['logCustomer'](_0x417361,0xb,_0x9fd5('0xe3'));rpcDb[_0x9fd5('0x92')](_0x417361,'[callProgressDetectingCustomer][logAbandoned]');if(ut['totalGlobal'](_0x417361)>=_0x4f9fe4[_0x9fd5('0xa5')]){_0xb63bc5=ut[_0x9fd5('0xa6')](_0x417361,0xf,'Global');rpcDb[_0x9fd5('0x94')](_0xb63bc5,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x417361[_0x9fd5('0xe4')]>=_0x4f9fe4[_0x9fd5('0xe5')]){rpcDb[_0x9fd5('0x94')](_0x417361,_0x9fd5('0xe6'));}else{rpcDb[_0x9fd5('0xaa')](ut[_0x9fd5('0xab')](_0x417361,_0x9fd5('0xe2'),_0x4f9fe4[_0x9fd5('0xe7')]),_0x417361[_0x9fd5('0xad')],_0x417361[_0x9fd5('0xd0')]);}}break;case'18':_0x4f9fe4[_0x9fd5('0x42')]+=0x1;_0x417361[_0x9fd5('0xe8')]+=0x1;_0x417361[_0x9fd5('0xa0')]=ut[_0x9fd5('0xa1')](_0x417361);ut['logCustomer'](_0x417361,0x12,_0x4a5202[_0x9fd5('0xe9')]||_0x4a5202['dialstatus']);ami[_0x9fd5('0x25')](_0x9fd5('0xea'),ut[_0x9fd5('0xa3')](_0x417361,_0x9fd5('0xeb')));rpcDb['createCustomerHistory'](_0x417361,'[callProgressDetectingCustomer][hangupInAMD]');if(ut[_0x9fd5('0xa1')](_0x417361)>=_0x4f9fe4[_0x9fd5('0xa5')]){_0xb63bc5=ut[_0x9fd5('0xa6')](_0x417361,0xf,_0x9fd5('0xa7'));rpcDb[_0x9fd5('0x94')](_0xb63bc5,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb[_0x9fd5('0x94')](_0x417361,'[callProgressDetectingCustomer][hangupInAMD]');}delete this[_0x9fd5('0x15')][_0x4a5202['linkedid']];break;case'19':_0x4f9fe4[_0x9fd5('0x42')]+=0x1;_0x417361[_0x9fd5('0xa0')]=ut[_0x9fd5('0xa1')](_0x417361);ut[_0x9fd5('0x8c')](_0x417361,0x13,_0x4a5202[_0x9fd5('0xe9')]||_0x4a5202[_0x9fd5('0xec')]);ami[_0x9fd5('0x25')](_0x9fd5('0xea'),ut[_0x9fd5('0xa3')](_0x417361,'amd'));rpcDb[_0x9fd5('0x92')](_0x417361,'[callProgressDetectingCustomer][machine]');if(ut[_0x9fd5('0xa1')](_0x417361)>=_0x4f9fe4[_0x9fd5('0xa5')]){_0xb63bc5=ut['cloneAction'](_0x417361,0xf,'Global');rpcDb[_0x9fd5('0x94')](_0xb63bc5,'[callProgressDetectingCustomer][machine]');}else{rpcDb[_0x9fd5('0x94')](_0x417361,'[callProgressDetectingCustomer][machine]');}delete this['actions'][_0x4a5202['linkedid']];break;default:if(_0x417361[_0x9fd5('0x73')]){ut[_0x9fd5('0x7c')](_0x4f9fe4,'[default]');ut[_0x9fd5('0x7d')](_0x9fd5('0xed')+_0x4f9fe4[_0x9fd5('0x27')],_0x4a5202);}_0x4f9fe4['outboundUnknownCallsDay']+=0x1;_0x417361[_0x9fd5('0xa0')]=ut[_0x9fd5('0xa1')](_0x417361);ut['logCustomer'](_0x417361,0xc,_0x4a5202[_0x9fd5('0xe9')]||_0x4a5202[_0x9fd5('0xec')]);rpcDb[_0x9fd5('0x92')](_0x417361,_0x9fd5('0xee'));if(ut[_0x9fd5('0xa1')](_0x417361)>=_0x4f9fe4[_0x9fd5('0xa5')]){_0xb63bc5=ut['cloneAction'](_0x417361,0xf,_0x9fd5('0xa7'));rpcDb[_0x9fd5('0x94')](_0xb63bc5,_0x9fd5('0xef'));}else{rpcDb[_0x9fd5('0x94')](_0x417361,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this[_0x9fd5('0x15')][_0x4a5202['linkedid']];}if(!(_0x417361['dialAnswer']&&_0x32e0cf==='16')){ut[_0x9fd5('0x7a')](_0x4f9fe4,'[callProgressDetectingCustomer]');logger[_0x9fd5('0x6d')](_0x9fd5('0xf0'),_0x417361[_0x9fd5('0xc0')],'\x20Queue',_0x4f9fe4['name'],_0x9fd5('0x71'),_0x4f9fe4[_0x9fd5('0x4e')]);}if(_0x32e0cf!=='ANSWER'){delete this['actions'][_0x4a5202[_0x9fd5('0xae')]];delete this['actions'][_0x4a5202['destlinkedid']];}}};Preview[_0x9fd5('0xe')][_0x9fd5('0xf1')]=function(_0x3489e7,_0x5888ff,_0x47fcd2){if(_['isUndefined'](_0x5888ff)&&_0x9fd5('0xf2')!==typeof _0x5888ff){return;}if(_[_0x9fd5('0xf3')](_0x47fcd2)&&_0x9fd5('0xf2')!==typeof _0x47fcd2){return;}switch(_0x47fcd2[_0x9fd5('0xf4')]){case'0':ut['logAgent'](_0x3489e7,0x0,_0x9fd5('0xf5'));rpcDb[_0x9fd5('0xf6')](_0x3489e7,_0x9fd5('0xf7'));break;case'3':ut[_0x9fd5('0xf8')](_0x3489e7,0x3,_0x9fd5('0xca'));rpcDb['createAgentHistory'](_0x3489e7,_0x9fd5('0xf9'));break;case'5':ut[_0x9fd5('0xf8')](_0x3489e7,0x5,_0x9fd5('0xc3'));rpcDb[_0x9fd5('0xf6')](_0x3489e7,_0x9fd5('0xfa'));break;case'8':ut[_0x9fd5('0xf8')](_0x3489e7,0x8,_0x9fd5('0xfb'));rpcDb[_0x9fd5('0xf6')](_0x3489e7,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x9fd5('0xf8')](_0x3489e7,0x16,_0x9fd5('0xfc'));rpcDb[_0x9fd5('0xf6')](_0x3489e7,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut['logAgent'](_0x3489e7,0xc,_0x47fcd2[_0x9fd5('0xf4')]);rpcDb['createAgentHistory'](_0x3489e7,_0x9fd5('0xfd'));}ut[_0x9fd5('0x7a')](_0x5888ff,_0x9fd5('0xfe'));logger[_0x9fd5('0x6d')]('[originated][decrement][callProgressDetectingAgent]',_0x3489e7[_0x9fd5('0xc0')],_0x9fd5('0xb3'),_0x5888ff[_0x9fd5('0x27')],_0x9fd5('0x71'),_0x5888ff['originated']);delete this[_0x9fd5('0x15')][_0x3489e7[_0x9fd5('0xc0')]];};Preview[_0x9fd5('0xe')]['checkInBlack']=function(_0x351647,_0x416875,_0x4c9f7e,_0x2af957,_0x1b99ac){var _0x577ed9=this;return new BPromise(function(_0x522cbf,_0x5b3a29){if(_[_0x9fd5('0x6c')](_0x416875)||_['isNil'](_0x416875['Contact'])||_['isNil'](_0x416875[_0x9fd5('0xff')]['phone'])||_['isNil'](_0x416875[_0x9fd5('0x75')])){_0x5b3a29(ut[_0x9fd5('0x4d')]('Contact\x20is\x20undefined',_0x2af957,_0x1b99ac));return;}var _0x16df64=uuid['v4']();var _0x390c03=_0x577ed9['campaignsPreview'][_0x416875['Queue']['name']];var _0x1dd8b8=_0x4c9f7e?_0x577ed9['agents'][_0x4c9f7e]['id']:undefined;_0x577ed9['actions'][_0x16df64]=new Action(_0x416875,_0x390c03,_0x16df64,_0x4c9f7e,_0x1dd8b8);var _0x4e1bb9=_0x577ed9[_0x9fd5('0x15')][_0x16df64];_0x4e1bb9[_0x9fd5('0xad')]=_0x2af957;_0x4e1bb9['activeContact']=_0x1b99ac;_0x4e1bb9[_0x9fd5('0x100')]=_0x4c9f7e;if(_[_0x9fd5('0x101')](_0x351647)){_0x577ed9[_0x9fd5('0x102')](_0x4e1bb9,_0x390c03,_0x416875,_0x4c9f7e)['then'](function(_0x34ec6b){logger['info'](_0x9fd5('0x103'),_0x9fd5('0x104')+_0x4e1bb9[_0x9fd5('0x70')]+_0x9fd5('0x105')+_0x4e1bb9['idContact'],JSON[_0x9fd5('0x56')](_0x34ec6b));ami[_0x9fd5('0x25')](_0x9fd5('0x106'),ut[_0x9fd5('0xa3')](_0x4e1bb9,_0x9fd5('0x107'),_0x577ed9[_0x9fd5('0x12')][_0x4e1bb9[_0x9fd5('0x70')]]));_0x522cbf(ut[_0x9fd5('0x4d')]('Calling'));})[_0x9fd5('0x89')](function(_0x191d89){ut[_0x9fd5('0x64')](_0x9fd5('0x108'),_0x191d89);_0x5b3a29(ut[_0x9fd5('0x4d')](_0x9fd5('0x109'),_0x2af957,_0x1b99ac));});}else{_0x390c03['outboundBlacklistCallsDay']+=0x1;ut['logBlacklist'](_0x4e1bb9);rpcDb[_0x9fd5('0x10a')](_0x4e1bb9,_0x9fd5('0x10b'));delete _0x577ed9[_0x9fd5('0x15')][_0x16df64];_0x5b3a29(ut[_0x9fd5('0x4d')](_0x9fd5('0x10c'),_0x2af957,_0x1b99ac));}});};Preview['prototype'][_0x9fd5('0x9a')]=function(_0x4f7ea1){return!_[_0x9fd5('0x6c')](_0x4f7ea1)&&!_['isNil'](_0x4f7ea1[_0x9fd5('0x27')])&&!_[_0x9fd5('0x6c')](_0x4f7ea1[_0x9fd5('0x54')])&&_0x4f7ea1['active']&&!_[_0x9fd5('0x6c')](this[_0x9fd5('0x14')][util[_0x9fd5('0x57')](_0x9fd5('0x10d'),_0x4f7ea1[_0x9fd5('0x27')])])&&!_[_0x9fd5('0x6c')](this[_0x9fd5('0x14')][util['format'](_0x9fd5('0x10d'),_0x4f7ea1['name'])][_0x9fd5('0x78')])&&(this[_0x9fd5('0x14')][util[_0x9fd5('0x57')](_0x9fd5('0x10d'),_0x4f7ea1['name'])][_0x9fd5('0x78')]===_0x9fd5('0x10e')||this[_0x9fd5('0x14')][util[_0x9fd5('0x57')](_0x9fd5('0x10d'),_0x4f7ea1[_0x9fd5('0x27')])][_0x9fd5('0x78')]===_0x9fd5('0x10f'));};Preview['prototype']['run']=function(_0x4e7b6a,_0xe8e77d){var _0x178783=this;return new BPromise(function(_0x7ee47c,_0x48341e){_0x178783[_0x9fd5('0x110')](_0x4e7b6a,_0xe8e77d)[_0x9fd5('0x88')](function(_0x699066){_0x7ee47c(_[_0x9fd5('0x111')](_0x699066,[_0x9fd5('0x4d')]));})[_0x9fd5('0x89')](function(_0x42cfe4){if(_0x42cfe4[_0x9fd5('0x112')]){rpcDb[_0x9fd5('0x113')](_0x4e7b6a);}if(_0x42cfe4[_0x9fd5('0x54')]){rpcDb[_0x9fd5('0x114')](_0x4e7b6a);}_0x48341e(_[_0x9fd5('0x111')](_0x42cfe4,['message']));});});};Preview[_0x9fd5('0xe')][_0x9fd5('0x110')]=function(_0x35a1b7,_0x23a496){var _0x4941db=this;return new BPromise(function(_0x41f3ea,_0x4f571c){var _0x38845c,_0x2983b7;rpcDb['getContactPreview'](_0x35a1b7)[_0x9fd5('0x88')](function(_0x43cb8c){if(!_[_0x9fd5('0x6c')](_0x43cb8c[0x0])){_0x2983b7=_0x43cb8c[0x0]['recallme']?![]:!![];_0x38845c=_0x43cb8c[0x0]['recallme']?!![]:![];_0x38845c=_0x23a496?!![]:_0x38845c;}var _0x32f1ef=_0x4941db[_0x9fd5('0x115')](_0x43cb8c);if(_0x32f1ef[_0x9fd5('0x116')]){rpcDb['checkIsBlackList'](_['pick'](_0x43cb8c[0x0],[_0x9fd5('0x75'),_0x9fd5('0x117')]))[_0x9fd5('0x88')](function(_0x27dba1){_0x4941db[_0x9fd5('0x118')](_0x27dba1,_0x43cb8c[0x0],_0x23a496,_0x2983b7,_0x38845c)[_0x9fd5('0x88')](function(_0x5ac91b){_0x41f3ea(_0x5ac91b);})[_0x9fd5('0x89')](function(_0x56e2ca){_0x4f571c(_0x56e2ca);});})[_0x9fd5('0x89')](function(_0x48ddd0){ut[_0x9fd5('0x64')](_0x9fd5('0x119'),_0x48ddd0);_0x4f571c(ut[_0x9fd5('0x4d')](_0x9fd5('0x11a'),_0x2983b7,_0x38845c));});}else{_0x4f571c(ut[_0x9fd5('0x4d')](_0x32f1ef[_0x9fd5('0x4d')],_0x2983b7,_0x38845c));}})[_0x9fd5('0x89')](function(_0x18b42e){ut[_0x9fd5('0x64')]('[Preview][getContactPreview]',_0x18b42e);_0x4f571c(ut[_0x9fd5('0x4d')](_0x9fd5('0x11a'),![],!![]));});});};Preview[_0x9fd5('0xe')][_0x9fd5('0x115')]=function(_0x4d36a2){if(_[_0x9fd5('0x6c')](_0x4d36a2)||_[_0x9fd5('0x101')](_0x4d36a2)||!_[_0x9fd5('0x6c')](_0x4d36a2[0x0][_0x9fd5('0x86')])&&_['isNil'](_0x4d36a2[0x0][_0x9fd5('0x86')][_0x9fd5('0x27')])){ut[_0x9fd5('0x64')](_0x9fd5('0x11b'),_0x4d36a2);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x1894ea=this['campaignsPreview'][_0x4d36a2[0x0]['Queue'][_0x9fd5('0x27')]];_0x1894ea[_0x9fd5('0x4d')]=_0x9fd5('0x9d');if(_['isNil'](_0x1894ea)){ut[_0x9fd5('0x64')](_0x9fd5('0x11c'),_0x1894ea);return{'isValid':![],'message':_0x9fd5('0x11d')};}if(!this[_0x9fd5('0x9a')](_0x1894ea[_0x9fd5('0x53')])){ut[_0x9fd5('0x64')](_0x9fd5('0x11e'),_0x9fd5('0x11f')+_0x1894ea['name']+_0x9fd5('0x120'));if(!this[_0x9fd5('0x9a')](_0x1894ea[_0x9fd5('0x9b')])){ut[_0x9fd5('0x64')](_0x9fd5('0x11e'),_0x1894ea[_0x9fd5('0x27')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0x9fd5('0x121')};}}if(!ut[_0x9fd5('0x99')](_0x1894ea[_0x9fd5('0x34')])){ut[_0x9fd5('0x64')](_0x9fd5('0x122'),_0x1894ea[_0x9fd5('0x27')]+_0x9fd5('0x123'));return{'isValid':![],'message':_0x9fd5('0x11f')+_0x1894ea[_0x9fd5('0x27')]+_0x9fd5('0x123')};}return{'isValid':!![],'message':_0x9fd5('0x124')};};Preview['prototype'][_0x9fd5('0x102')]=function(_0x4357b3,_0x331e4d,_0x22a779,_0x333a2f){var _0x2e3f41=this;return new BPromise(function(_0xe74173,_0x47c444){var _0xec40c5=_0x4357b3[_0x9fd5('0xc0')];var _0x5aa8d9=_0x2e3f41['isTrunkReachable'](_0x331e4d[_0x9fd5('0x53')])?util[_0x9fd5('0x57')](_0x9fd5('0x125'),_0x331e4d[_0x9fd5('0x53')][_0x9fd5('0x27')],_[_0x9fd5('0x6c')](_0x331e4d[_0x9fd5('0x38')])?'':_0x331e4d[_0x9fd5('0x38')][_0x9fd5('0x126')]()||'',_0x331e4d['dialCutDigit']>0x0?_0x22a779['Contact'][_0x9fd5('0x127')][_0x9fd5('0x128')](_0x331e4d['dialCutDigit']):_0x22a779[_0x9fd5('0xff')][_0x9fd5('0x127')]):util[_0x9fd5('0x57')]('SIP/%s/%s%s',_['isNil'](_0x331e4d['TrunkBackup'])?_0x331e4d['Trunk'][_0x9fd5('0x27')]:_0x331e4d[_0x9fd5('0x9b')]['name'],_['isNil'](_0x331e4d['dialPrefix'])?'':_0x331e4d['dialPrefix'][_0x9fd5('0x126')]()||'',_0x331e4d[_0x9fd5('0x129')]>0x0?_0x22a779[_0x9fd5('0xff')][_0x9fd5('0x127')]['substring'](_0x331e4d[_0x9fd5('0x129')]):_0x22a779['Contact'][_0x9fd5('0x127')]);var _0x50b61e=_0x2e3f41[_0x9fd5('0x9a')](_0x331e4d['Trunk'])?ut['getCallerId'](_0x331e4d['Trunk'][_0x9fd5('0x12a')],_0x331e4d[_0x9fd5('0x35')],_0x331e4d[_0x9fd5('0x12b')]>0x0?ut[_0x9fd5('0x12c')](_0x331e4d[_0x9fd5('0x36')],_0x331e4d[_0x9fd5('0x12b')]):_0x331e4d[_0x9fd5('0x36')]):ut['getCallerId'](_[_0x9fd5('0x6c')](_0x331e4d[_0x9fd5('0x9b')])?_0x331e4d[_0x9fd5('0x53')][_0x9fd5('0x12a')]:_0x331e4d[_0x9fd5('0x9b')][_0x9fd5('0x12a')],_0x331e4d[_0x9fd5('0x35')],_0x331e4d[_0x9fd5('0x12b')]>0x0?ut[_0x9fd5('0x12c')](_0x331e4d[_0x9fd5('0x36')],_0x331e4d['dialRandomLastDigitCallerIdNumber']):_0x331e4d[_0x9fd5('0x36')]);if(_0x50b61e){_0x4357b3['originatecalleridname']=ut[_0x9fd5('0x12d')](_0x50b61e);_0x4357b3[_0x9fd5('0x12e')]=ut['extractCalleridNumber'](_0x50b61e);}var _0x195942=ut[_0x9fd5('0x12f')](_0x331e4d,_0x22a779,_0x5aa8d9,_0x50b61e,_0xec40c5,_0x4357b3);_[_0x9fd5('0x130')](_0x4357b3,ut[_0x9fd5('0x131')](_0x195942));_0x4357b3['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');ami[_0x9fd5('0x77')](ut[_0x9fd5('0x132')](_0x4357b3,_0x331e4d,_0x195942,_0x4357b3['activeContact'],_0x333a2f))['then'](function(_0x379b20){var _0x43d900=_0x4357b3[_0x9fd5('0x133')];if(!_[_0x9fd5('0x6c')](_0x43d900)){if(!_[_0x9fd5('0x6c')](_0x2e3f41[_0x9fd5('0x16')][_0x43d900])){_0x2e3f41[_0x9fd5('0x16')][_0x43d900][_0x9fd5('0x134')]=_0x4357b3[_0x9fd5('0x135')];emit(util[_0x9fd5('0x57')]('user:%s',_0x2e3f41[_0x9fd5('0x16')][_0x43d900][_0x9fd5('0x27')]),_0x9fd5('0x136'),{'destaccountcode':_0x2e3f41[_0x9fd5('0x16')][_0x43d900]['accountcode'],'destconnectedlinenum':_0x4357b3['calleridnum']});}}_0x331e4d[_0x9fd5('0x4e')]+=0x1;logger[_0x9fd5('0x6d')](_0x9fd5('0x137'),_0xec40c5,_0x9fd5('0xb3'),_0x331e4d[_0x9fd5('0x27')],'originated:\x20',_0x331e4d[_0x9fd5('0x4e')]);_0xe74173(_0x379b20);})[_0x9fd5('0x89')](function(_0xf0af21){ut[_0x9fd5('0xf8')](_0x4357b3,0xe,'OriginateError');rpcDb[_0x9fd5('0xf6')](_0x4357b3,_0x9fd5('0x138'));_0x47c444(_0xf0af21);});});};Preview[_0x9fd5('0xe')]['syncNewExten']=function(_0x1d3762){if(this[_0x9fd5('0x15')][_0x1d3762[_0x9fd5('0xae')]]){this[_0x9fd5('0x15')][_0x1d3762['linkedid']][_0x9fd5('0x79')]=_0x1d3762['channel'];}};Preview[_0x9fd5('0xe')][_0x9fd5('0x18')]=function(_0x5355af){var _0x4c0b63=this;var _0x5486c5=this[_0x9fd5('0x15')][_0x5355af[_0x9fd5('0x139')]];if(_0x5486c5){if(_0x5486c5[_0x9fd5('0x100')]&&this['agents'][_0x5486c5[_0x9fd5('0x100')]]){ut['logLookAgent'](_0x5486c5,this[_0x9fd5('0x16')][_0x5486c5[_0x9fd5('0x100')]]['name'],this[_0x9fd5('0x16')][_0x5486c5[_0x9fd5('0x100')]]['id']);}var _0x5a92f4=_[_0x9fd5('0x13a')](_0x5486c5);_0x5a92f4[_0x9fd5('0xb0')]=moment()[_0x9fd5('0x57')]('YYYY-MM-DD\x20HH:mm:ss');var _0x57d447=_0x4c0b63[_0x9fd5('0x12')][_0x5486c5[_0x9fd5('0x70')]];if(ut[_0x9fd5('0x13b')](_0x5355af[_0x9fd5('0x13c')])){if(_0x5486c5[_0x9fd5('0xad')]){rpcDb[_0x9fd5('0x113')](_0x5486c5[_0x9fd5('0x13d')]);}if(_0x5486c5[_0x9fd5('0xd0')]){rpcDb['disableContact'](_0x5486c5['idContact']);}ami[_0x9fd5('0x25')](_0x9fd5('0x13e'),ut[_0x9fd5('0xa3')](_0x5486c5,'rejected',this['campaignsPreview'][_0x5486c5[_0x9fd5('0x70')]]));this[_0x9fd5('0xf1')](_0x5a92f4,_0x57d447,_0x5355af);}else{_0x5486c5[_0x9fd5('0x13f')]=moment()[_0x9fd5('0x57')](_0x9fd5('0x8b'));ut[_0x9fd5('0xf8')](_0x5a92f4,0x4,_0x9fd5('0xbb'));rpcDb[_0x9fd5('0xf6')](_0x5a92f4,_0x9fd5('0x140'));}}};Preview[_0x9fd5('0xe')]['syncHangup']=function(_0x3e54e4){var _0x4bf061=this;var _0x4477ce=this['actions'][_0x3e54e4['linkedid']];var _0x40f10c;if(_0x4477ce){_0x40f10c=this['campaignsPreview'][_0x4477ce[_0x9fd5('0x70')]];logger[_0x9fd5('0x6d')](_0x9fd5('0x141'),_0x3e54e4[_0x9fd5('0xae')],_0x9fd5('0xb3'),_0x40f10c[_0x9fd5('0x27')],'pTalking:\x20',_0x40f10c[_0x9fd5('0x5d')]);}if(this[_0x9fd5('0x15')][_0x3e54e4['linkedid']]&&_0x3e54e4[_0x9fd5('0xae')]!==_0x3e54e4[_0x9fd5('0xc0')]){if(_0x3e54e4[_0x9fd5('0x142')]==='16'&&this['actions'][_0x3e54e4[_0x9fd5('0xae')]][_0x9fd5('0x73')]){this[_0x9fd5('0x9e')](_0x3e54e4,_0x3e54e4[_0x9fd5('0xae')],_0x3e54e4[_0x9fd5('0x142')]);}else if(this[_0x9fd5('0x15')][_0x3e54e4['linkedid']][_0x9fd5('0x73')]){logger[_0x9fd5('0x6d')]('[syncHangup][talking][cause]',_0x3e54e4['linkedid'],_0x3e54e4[_0x9fd5('0x142')],_0x9fd5('0xb3'),_0x40f10c[_0x9fd5('0x27')],_0x9fd5('0x72'),_0x40f10c[_0x9fd5('0x5d')]);this[_0x9fd5('0x9e')](_0x3e54e4,_0x3e54e4[_0x9fd5('0xae')],_0x3e54e4['cause']);}}else if(_0x4477ce&&_[_0x9fd5('0x6c')](_0x4477ce[_0x9fd5('0x143')])&&_0x40f10c[_0x9fd5('0x144')]&&_0x3e54e4[_0x9fd5('0xae')]===_0x3e54e4[_0x9fd5('0xc0')]&&_[_0x9fd5('0x6c')](_0x3e54e4[_0x9fd5('0xf4')])&&_0x3e54e4['cause']==='16'&&_0x3e54e4[_0x9fd5('0x145')]==='6'&&_[_0x9fd5('0xf3')](_0x4477ce[_0x9fd5('0x146')])){if(_0x4477ce[_0x9fd5('0xad')]){rpcDb[_0x9fd5('0x113')](_0x4477ce[_0x9fd5('0x13d')]);}if(_0x4477ce['activeContact']){rpcDb['disableContact'](_0x4477ce[_0x9fd5('0x13d')]);}_0x3e54e4[_0x9fd5('0xf4')]='22';this[_0x9fd5('0xf1')](_0x4477ce,_0x40f10c,_0x3e54e4);}else if(_0x4477ce&&_0x4477ce[_0x9fd5('0x146')]){if(_0x3e54e4['cause']==='16'&&this[_0x9fd5('0x15')][_0x3e54e4[_0x9fd5('0xae')]]['dialAnswer']){logger[_0x9fd5('0x6d')]('[syncHangup][talking][transfer]',_0x3e54e4[_0x9fd5('0xae')],_0x3e54e4[_0x9fd5('0x142')],_0x9fd5('0xb3'),_0x40f10c[_0x9fd5('0x27')],_0x9fd5('0x72'),_0x40f10c['pTalking']);this[_0x9fd5('0x9e')](_0x3e54e4,_0x3e54e4[_0x9fd5('0xae')],_0x3e54e4['cause']);}else if(this[_0x9fd5('0x15')][_0x3e54e4[_0x9fd5('0xae')]][_0x9fd5('0x73')]){logger[_0x9fd5('0x6d')]('[syncHangup][talking][cause]',_0x3e54e4[_0x9fd5('0xae')],_0x3e54e4[_0x9fd5('0x142')],_0x9fd5('0xb3'),_0x40f10c[_0x9fd5('0x27')],_0x9fd5('0x72'),_0x40f10c[_0x9fd5('0x5d')]);this[_0x9fd5('0x9e')](_0x3e54e4,_0x3e54e4[_0x9fd5('0xae')],_0x3e54e4[_0x9fd5('0x142')]);}}};Preview['prototype'][_0x9fd5('0x1f')]=function(_0xd23b7b){if(this[_0x9fd5('0x15')][_0xd23b7b['destlinkedid']]&&_0xd23b7b[_0x9fd5('0x147')]!==_0xd23b7b[_0x9fd5('0x148')]){this[_0x9fd5('0x9e')](_0xd23b7b,_0xd23b7b['destlinkedid'],_0xd23b7b[_0x9fd5('0xec')]);}};Preview[_0x9fd5('0xe')][_0x9fd5('0x1d')]=function(_0x54f422){if(this[_0x9fd5('0x15')][_0x54f422[_0x9fd5('0xae')]]&&_0x54f422['linkedid']!==_0x54f422[_0x9fd5('0xc0')]&&!this['actions'][_0x54f422[_0x9fd5('0xae')]][_0x9fd5('0x73')]){if(_0x54f422['cause']==='1'){this[_0x9fd5('0x9e')](_0x54f422,_0x54f422['linkedid'],_0x54f422[_0x9fd5('0x142')]);}}};Preview[_0x9fd5('0xe')][_0x9fd5('0x149')]=function(_0x3d2769,_0xdfe6c3,_0x5ab86e){if(this['actions'][_0x3d2769]){if(_['isNil'](this[_0x9fd5('0x15')][_0x3d2769][_0x9fd5('0x14a')])){this[_0x9fd5('0x15')][_0x3d2769][_0x9fd5('0x14a')]={};}this[_0x9fd5('0x15')][_0x3d2769][_0x9fd5('0x14a')][_0xdfe6c3]=_0x5ab86e;}};Preview['prototype'][_0x9fd5('0x14b')]=function(_0x463129){try{if(!_[_0x9fd5('0x6c')](_0x463129)){if(ut['filterKey'](_['keys'](_0x463129['variable'])[0x0])){this[_0x9fd5('0x149')](_0x463129[_0x9fd5('0xc0')],_[_0x9fd5('0x14c')](_0x463129['variable'])[0x0],_0x463129[_0x9fd5('0x14d')]);}}}catch(_0x5051aa){logger[_0x9fd5('0x14e')](_0x9fd5('0x14f'),util[_0x9fd5('0x150')](_0x5051aa,{'showHidden':![],'depth':null}));}};Preview[_0x9fd5('0xe')][_0x9fd5('0x151')]=function(_0x416967){if(_0x416967){if(this[_0x9fd5('0x15')][_0x416967[_0x9fd5('0x152')]]){this[_0x9fd5('0x15')][_0x416967[_0x9fd5('0x152')]][_0x9fd5('0x146')]=!![];}}};Preview[_0x9fd5('0xe')][_0x9fd5('0x23')]=function(_0x542f64){if(_0x542f64){if(this[_0x9fd5('0x15')][_0x542f64['transfererlinkedid']]){this[_0x9fd5('0x15')][_0x542f64[_0x9fd5('0x153')]][_0x9fd5('0x146')]=!![];}}};module[_0x9fd5('0x154')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 0ab9546..544ae7e 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 _0x570b=['endtime','connectedlinename','membername','context','from-sip','exten','holdtime','assigned','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','error','resolve','createHistory','catch','[createHistory]\x20','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','rescheduleContact','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt'];(function(_0x278dce,_0xc6507e){var _0x3817b6=function(_0x58874c){while(--_0x58874c){_0x278dce['push'](_0x278dce['shift']());}};_0x3817b6(++_0xc6507e);}(_0x570b,0x81));var _0xb570=function(_0x309c24,_0xb0f0b7){_0x309c24=_0x309c24-0x0;var _0x7c7578=_0x570b[_0x309c24];return _0x7c7578;};'use strict';var util=require(_0xb570('0x0'));var BPromise=require('bluebird');var logger=require(_0xb570('0x1'))(_0xb570('0x2'));var _=require('lodash');var cmHopper=require(_0xb570('0x3'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0xb570('0x4'));var cmHopperBlack=require(_0xb570('0x5'));var voiceQueueRt=require(_0xb570('0x6'));var agentReportPreview=require(_0xb570('0x7'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x5676e5){return function(_0x90462e){logger[_0xb570('0x8')](_0x5676e5,util['inspect'](_0x90462e,{'showHidden':![],'depth':null}));};}function create(_0x354f34){return BPromise[_0xb570('0x9')]()['then'](cmHopperHistory[_0xb570('0xa')](_0x354f34))[_0xb570('0xb')](loggerCatch(_0xb570('0xc')));}function createAgent(_0x4b8cb6){return BPromise[_0xb570('0x9')]()[_0xb570('0xd')](agentReportPreview[_0xb570('0xa')](_0x4b8cb6))['catch'](loggerCatch(_0xb570('0xc')));}function moveContact(_0x17e856){return BPromise['resolve']()[_0xb570('0xd')](cmHopper[_0xb570('0xe')](_0x17e856,!![]))['catch'](loggerCatch(_0xb570('0xf')));}exports[_0xb570('0x10')]=function(_0x4a861e){return BPromise[_0xb570('0x9')]()[_0xb570('0xd')](cmHopperBlack[_0xb570('0x10')](_0x4a861e))[_0xb570('0xb')](loggerCatch(_0xb570('0x11')));};exports[_0xb570('0x12')]=function(_0x520b6d){return BPromise[_0xb570('0x9')]()[_0xb570('0xd')](cmHopper[_0xb570('0x12')](_0x520b6d))[_0xb570('0xb')](loggerCatch(_0xb570('0x13')));};exports[_0xb570('0xa')]=function(_0x4e1bcd,_0x2de075){create(_0x4e1bcd)[_0xb570('0xb')](loggerCatch(_0x2de075));moveContact(_0x4e1bcd)['catch'](loggerCatch(_0x2de075));};exports[_0xb570('0x14')]=function(_0x1de862,_0x4e21c7){createAgent(_0x1de862)['catch'](loggerCatch(_0x4e21c7));};exports[_0xb570('0x15')]=function(_0x560a77,_0xd6a6a1){create(_0x560a77)[_0xb570('0xb')](loggerCatch(_0xd6a6a1));};exports['createCustomerFinal']=function(_0x1b6ba7,_0x2b3cef){moveContact(_0x1b6ba7)['catch'](loggerCatch(_0x2b3cef));};exports[_0xb570('0x16')]=function(_0xb068d4,_0x4c3884,_0x427bd4){if(_0x4c3884){_0xb068d4['UserId']=null;}if(_0x427bd4){_0xb068d4[_0xb570('0x17')]=![];}return BPromise[_0xb570('0x9')]()[_0xb570('0xd')](cmHopper[_0xb570('0x16')](_0xb068d4))[_0xb570('0xb')](loggerCatch(_0xb570('0x18')));};exports[_0xb570('0x19')]=function(_0x36900e){return BPromise[_0xb570('0x9')]()[_0xb570('0xd')](cmHopper[_0xb570('0x19')](_0x36900e))[_0xb570('0xb')](loggerCatch(_0xb570('0x1a')));};exports[_0xb570('0x1b')]=function(_0x31480c){return BPromise[_0xb570('0x9')]()[_0xb570('0xd')](cmHopper[_0xb570('0x1b')]({'UserId':null},_0x31480c,0x1))[_0xb570('0xb')](loggerCatch(_0xb570('0x1c')));};exports[_0xb570('0x1d')]=function(_0xf11c6a){return BPromise[_0xb570('0x9')]()[_0xb570('0xd')](cmHopper[_0xb570('0x1b')]({'active':![]},_0xf11c6a,0x1))[_0xb570('0xb')](loggerCatch(_0xb570('0x1e')));};exports[_0xb570('0x1f')]=function(_0x1693b3){var _0x4be9bb={};_0x4be9bb[_0xb570('0x20')]=_0x1693b3['type'];_0x4be9bb[_0xb570('0x21')]=_0x1693b3[_0xb570('0x21')];_0x4be9bb[_0xb570('0x22')]=_0x1693b3[_0xb570('0x22')];_0x4be9bb[_0xb570('0x23')]=_0x1693b3[_0xb570('0x23')];_0x4be9bb['queue']=_0x1693b3[_0xb570('0x24')];_0x4be9bb[_0xb570('0x25')]=_0x1693b3[_0xb570('0x26')];_0x4be9bb[_0xb570('0x27')]=_0x1693b3[_0xb570('0x26')];_0x4be9bb[_0xb570('0x28')]=0x1;_0x4be9bb[_0xb570('0x29')]=_0x1693b3[_0xb570('0x2a')];_0x4be9bb[_0xb570('0x2b')]=_0x1693b3[_0xb570('0x2c')];_0x4be9bb[_0xb570('0x2d')]=_0xb570('0x2e');_0x4be9bb[_0xb570('0x2f')]='xcally-motion-preview';_0x4be9bb[_0xb570('0x30')]=0x0;_0x4be9bb[_0xb570('0x31')]=0x1;_0x4be9bb['lastAssignedTo']=_0x1693b3[_0xb570('0x2c')];_0x4be9bb['queuecallerexitreason']=_0xb570('0x32');return BPromise[_0xb570('0x9')]()[_0xb570('0xd')](voiceQueueReport[_0xb570('0x33')](_0x4be9bb))[_0xb570('0xb')](loggerCatch(_0xb570('0x34')));};exports[_0xb570('0x35')]=function(_0x27b59c,_0x18d999){return BPromise[_0xb570('0x9')]()['then'](cmHopper['getContactRecallMe'](_0x27b59c,_0x18d999))[_0xb570('0xb')](loggerCatch(_0xb570('0x36')));};exports[_0xb570('0x37')]=function(_0x218c79){return BPromise[_0xb570('0x9')]()[_0xb570('0xd')](cmHopper[_0xb570('0x16')](_0x218c79,!![],!![]))[_0xb570('0xb')](loggerCatch(_0xb570('0x38')));}; \ No newline at end of file +var _0x0072=['context','from-sip','exten','xcally-motion-preview','assigned','lastAssignedTo','queuecallerexitreason','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','util','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','then','catch','[createHistory]\x20','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','[getContactPreview]\x20','createHistory','createAgentHistory','rescheduleContact','UserId','[rescheduleContact]\x20','countReScheduled','unlockContact','disableContact','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','answertime','queuecallercomplete','connectedlinename','membername'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x0072,0x74));var _0x2007=function(_0x288f8d,_0x182292){_0x288f8d=_0x288f8d-0x0;var _0x260dab=_0x0072[_0x288f8d];return _0x260dab;};'use strict';var util=require(_0x2007('0x0'));var BPromise=require('bluebird');var logger=require(_0x2007('0x1'))(_0x2007('0x2'));var _=require(_0x2007('0x3'));var cmHopper=require(_0x2007('0x4'));var cmHopperFinal=require(_0x2007('0x5'));var cmHopperHistory=require(_0x2007('0x6'));var cmHopperBlack=require(_0x2007('0x7'));var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require(_0x2007('0x8'));var voiceQueueReport=require(_0x2007('0x9'));function loggerCatch(_0x30ab19){return function(_0x7f84aa){logger[_0x2007('0xa')](_0x30ab19,util[_0x2007('0xb')](_0x7f84aa,{'showHidden':![],'depth':null}));};}function create(_0x23e698){return BPromise[_0x2007('0xc')]()[_0x2007('0xd')](cmHopperHistory['createHistory'](_0x23e698))[_0x2007('0xe')](loggerCatch(_0x2007('0xf')));}function createAgent(_0x9ae4d4){return BPromise['resolve']()[_0x2007('0xd')](agentReportPreview['createHistory'](_0x9ae4d4))['catch'](loggerCatch(_0x2007('0xf')));}function moveContact(_0x2a9365){return BPromise[_0x2007('0xc')]()[_0x2007('0xd')](cmHopper[_0x2007('0x10')](_0x2a9365,!![]))[_0x2007('0xe')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x2007('0x11')]=function(_0x2e7f0f){return BPromise[_0x2007('0xc')]()[_0x2007('0xd')](cmHopperBlack[_0x2007('0x11')](_0x2e7f0f))[_0x2007('0xe')](loggerCatch(_0x2007('0x12')));};exports['getContactPreview']=function(_0x1571e8){return BPromise[_0x2007('0xc')]()[_0x2007('0xd')](cmHopper['getContactPreview'](_0x1571e8))['catch'](loggerCatch(_0x2007('0x13')));};exports[_0x2007('0x14')]=function(_0x3da17a,_0x1fec7c){create(_0x3da17a)['catch'](loggerCatch(_0x1fec7c));moveContact(_0x3da17a)[_0x2007('0xe')](loggerCatch(_0x1fec7c));};exports[_0x2007('0x15')]=function(_0x343353,_0x510717){createAgent(_0x343353)[_0x2007('0xe')](loggerCatch(_0x510717));};exports['createCustomerHistory']=function(_0x1112cd,_0x39d10c){create(_0x1112cd)[_0x2007('0xe')](loggerCatch(_0x39d10c));};exports['createCustomerFinal']=function(_0x1381f9,_0x4adee4){moveContact(_0x1381f9)[_0x2007('0xe')](loggerCatch(_0x4adee4));};exports[_0x2007('0x16')]=function(_0x823ab7,_0x53df47,_0x1bfe2a){if(_0x53df47){_0x823ab7[_0x2007('0x17')]=null;}if(_0x1bfe2a){_0x823ab7['active']=![];}return BPromise[_0x2007('0xc')]()['then'](cmHopper[_0x2007('0x16')](_0x823ab7))['catch'](loggerCatch(_0x2007('0x18')));};exports[_0x2007('0x19')]=function(_0x2fe3aa){return BPromise[_0x2007('0xc')]()[_0x2007('0xd')](cmHopper[_0x2007('0x19')](_0x2fe3aa))['catch'](loggerCatch('[countReScheduled]\x20'));};exports[_0x2007('0x1a')]=function(_0x17d3ae){return BPromise['resolve']()[_0x2007('0xd')](cmHopper[_0x2007('0x1a')]({'UserId':null},_0x17d3ae,0x1))['catch'](loggerCatch('[unlockContact]\x20'));};exports[_0x2007('0x1b')]=function(_0x7c4c41){return BPromise[_0x2007('0xc')]()[_0x2007('0xd')](cmHopper[_0x2007('0x1a')]({'active':![]},_0x7c4c41,0x1))[_0x2007('0xe')](loggerCatch('[activeContact]\x20'));};exports[_0x2007('0x1c')]=function(_0x382765){var _0x61e3e0={};_0x61e3e0[_0x2007('0x1d')]=_0x382765[_0x2007('0x1d')];_0x61e3e0[_0x2007('0x1e')]=_0x382765[_0x2007('0x1e')];_0x61e3e0[_0x2007('0x1f')]=_0x382765[_0x2007('0x1f')];_0x61e3e0['calleridname']=_0x382765[_0x2007('0x20')];_0x61e3e0[_0x2007('0x21')]=_0x382765[_0x2007('0x21')];_0x61e3e0[_0x2007('0x22')]=_0x382765['answertime'];_0x61e3e0[_0x2007('0x23')]=_0x382765[_0x2007('0x24')];_0x61e3e0[_0x2007('0x25')]=0x1;_0x61e3e0['queuecallercompleteAt']=_0x382765['endtime'];_0x61e3e0[_0x2007('0x26')]=_0x382765[_0x2007('0x27')];_0x61e3e0[_0x2007('0x28')]=_0x2007('0x29');_0x61e3e0[_0x2007('0x2a')]=_0x2007('0x2b');_0x61e3e0['holdtime']=0x0;_0x61e3e0[_0x2007('0x2c')]=0x1;_0x61e3e0[_0x2007('0x2d')]=_0x382765[_0x2007('0x27')];_0x61e3e0[_0x2007('0x2e')]='COMPLETED';return BPromise[_0x2007('0xc')]()['then'](voiceQueueReport[_0x2007('0x2f')](_0x61e3e0))[_0x2007('0xe')](loggerCatch(_0x2007('0x30')));};exports[_0x2007('0x31')]=function(_0x15b676,_0xc0ae6b){return BPromise[_0x2007('0xc')]()['then'](cmHopper['getContactRecallMe'](_0x15b676,_0xc0ae6b))['catch'](loggerCatch(_0x2007('0x32')));};exports['rescheduleContactInQueue']=function(_0x571abc){return BPromise[_0x2007('0xc')]()[_0x2007('0xd')](cmHopper[_0x2007('0x16')](_0x571abc,!![],!![]))[_0x2007('0xe')](loggerCatch(_0x2007('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 29fc02b..269c809 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 _0x8bad=['endtime','logAgent','statedesc','responsetime','ringtime','starttime','logLookAgent','membername','UserId','logCustomer','talktime','answertime','isFailure','Failure','BOOKED','uniqueid','channelAgent','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','clone','Global','scheduledAt','active','add','minutes','ListId','pTalking','IsNotLoggedIn','lastevent','queue','interface','mandatoryDisposition','buildAcw','status','reachable','getDiff','diff','createBody','CampaignId','filterKey','campaigntype','dialAnswer','scheduledat','callback','callbackuniqueid','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','replace','random','match','extractCalleridNumber','util','lodash','../../../../config/logger','preview','env','127.0.0.1','milliseconds','seconds','loggerCatch','inspect','logger','loggerError','error','logger2','info','getCallerId','isUndefined','isEmpty','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','monitor_format','dialPreviewUrl','dialQueueProject','dialQueueProject2','\x22agi://%s/square,%s\x22','originatecalleridnum','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','createdAt','updatedAt','%s%s','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','Blacklist'];(function(_0x3e5215,_0x12f605){var _0x11575a=function(_0x5b9bf5){while(--_0x5b9bf5){_0x3e5215['push'](_0x3e5215['shift']());}};_0x11575a(++_0x12f605);}(_0x8bad,0x1e3));var _0xd8ba=function(_0x1b9ef3,_0x413f87){_0x1b9ef3=_0x1b9ef3-0x0;var _0x17ea24=_0x8bad[_0x1b9ef3];return _0x17ea24;};'use strict';var util=require(_0xd8ba('0x0'));var _=require(_0xd8ba('0x1'));var moment=require('moment');var logger=require(_0xd8ba('0x2'))(_0xd8ba('0x3'));var ipAgi=process[_0xd8ba('0x4')]['XCALLY_IP_AGI']||_0xd8ba('0x5');function getSeconds(_0x4f02a2,_0x45cb26){var _0x5c4496=moment(_0x4f02a2)[_0xd8ba('0x6')](0x0);var _0x5eaae1=moment(_0x45cb26)[_0xd8ba('0x6')](0x0);return _0x5c4496['diff'](_0x5eaae1,_0xd8ba('0x7'));}exports[_0xd8ba('0x8')]=function(_0x135338){return function(_0x1bbee1){logger['error'](_0x135338,util[_0xd8ba('0x9')](_0x1bbee1,{'showHidden':![],'depth':null}));};};exports[_0xd8ba('0xa')]=function(_0x27563a,_0x5b0839){logger['info'](_0x27563a,util['inspect'](_0x5b0839,{'showHidden':![],'depth':null}));};exports[_0xd8ba('0xb')]=function(_0x19d502,_0x921e4a){logger[_0xd8ba('0xc')](_0x19d502,util['inspect'](_0x921e4a,{'showHidden':![],'depth':null}));};exports[_0xd8ba('0xd')]=function(_0x169257){return function(_0x32e226){logger[_0xd8ba('0xe')](_0x169257,util[_0xd8ba('0x9')](_0x32e226,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x140434,_0x38d159,_0x365b1f){return{'message':_0x140434,'unlock':_0x38d159,'active':_0x365b1f};};exports[_0xd8ba('0xf')]=function(_0x229bef,_0x4595c1,_0xbdd832){if(!_[_0xd8ba('0x10')](_0xbdd832)&&'string'===typeof _0xbdd832&&!_[_0xd8ba('0x11')](_0xbdd832)){if(!_['isUndefined'](_0x4595c1)&&_0xd8ba('0x12')===typeof _0x4595c1&&!_[_0xd8ba('0x11')](_0x4595c1)){return util[_0xd8ba('0x13')](_0xd8ba('0x14'),_0x4595c1,_0xbdd832);}return util[_0xd8ba('0x13')](_0xd8ba('0x14'),_0xbdd832,_0xbdd832);}if(!_[_0xd8ba('0x10')](_0x229bef)&&'string'===typeof _0x229bef&&!_[_0xd8ba('0x11')](_0x229bef)){return _0x229bef;}return _0xd8ba('0x15');};exports[_0xd8ba('0x16')]=function(_0x390fc1){if(_[_0xd8ba('0x17')](_0x390fc1)){return![];}return _0x390fc1;};exports[_0xd8ba('0x18')]=function(_0x46bb52,_0x399847,_0x270985,_0x5f4571,_0x72a242,_0x1ee7cc){var _0x478169={'XMD-QUEUE':_0x399847[_0xd8ba('0x19')]?_0x399847['Queue'][_0xd8ba('0x1a')]:'','XMD-CALLERID':_0x5f4571,'XMD-CALLERID-PREVIEW':_0x1ee7cc?util[_0xd8ba('0x13')]('\x22%s\x22\x20<%s>',_0x1ee7cc[_0xd8ba('0x1b')],_0x1ee7cc[_0xd8ba('0x1c')]):_0x5f4571,'XMD-DIALID':_0x72a242,'XMD-CONTACTID':_0x399847[_0xd8ba('0x1d')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x5f4571,'XMD-VOICEQUEUEID':_0x399847[_0xd8ba('0x1e')],'XMD-DIALCHANNEL':_0x270985,'XMD-DIALTIMEOUT':_0x46bb52[_0xd8ba('0x1f')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0xd8ba('0x20'),_0x46bb52['dialQueueProject2']?'g':'',_[_0xd8ba('0x11')](_0x46bb52[_0xd8ba('0x21')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x46bb52[_0xd8ba('0x22')]||'','XMD-AGI':_0x46bb52[_0xd8ba('0x23')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x46bb52[_0xd8ba('0x23')]):'NONE','XMD-AGIAFTER':_0x46bb52[_0xd8ba('0x24')]?util[_0xd8ba('0x13')](_0xd8ba('0x25'),ipAgi,_0x46bb52[_0xd8ba('0x24')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x1ee7cc?_0x1ee7cc[_0xd8ba('0x26')]:'','XMD-ORIGINATECALLERIDNAME':_0x1ee7cc?_0x1ee7cc['originatecalleridname']:'','XMD-DESTINATION':_0xd8ba('0x27')};if(!_[_0xd8ba('0x11')](_0x46bb52['monitor_format'])){_0x478169[util['format']('%s',_0xd8ba('0x28'))]=_0x46bb52[_0xd8ba('0x21')];_0x478169[util[_0xd8ba('0x13')]('%s',_0xd8ba('0x29'))]=_0x72a242;}if(_0x399847&&_0x399847[_0xd8ba('0x2a')]){for(var _0x5df779 in _0x399847['Contact']){if(_0x399847['Contact'][_0xd8ba('0x2b')](_0x5df779)){if(!_[_0xd8ba('0x17')](_0x399847['Contact'][_0x5df779])&&_0x5df779!=='id'&&_0x5df779!=='tags'&&_0x5df779!==_0xd8ba('0x2c')&&_0x5df779!==_0xd8ba('0x2d')){_0x478169[util['format'](_0xd8ba('0x2e'),'XMD-',_[_0xd8ba('0x2f')](_0x5df779))]=_0x399847[_0xd8ba('0x2a')][_0x5df779];}}}}return _0x478169;};exports[_0xd8ba('0x30')]=function(_0x25ad8a){var _0x389405={};for(var _0x5724c5 in _0x25ad8a){if(_0x25ad8a[_0xd8ba('0x2b')](_0x5724c5)){_0x389405[util[_0xd8ba('0x13')]('%s',_[_0xd8ba('0x31')](_0x5724c5))]=_0x25ad8a[_0x5724c5];}}return{'variables':_0x389405};};exports[_0xd8ba('0x32')]=function(_0xa3b6a3,_0x2ba9da){if(!_[_0xd8ba('0x17')](_0xa3b6a3)){if(_0xa3b6a3[_0xd8ba('0x2b')](_0xd8ba('0x33'))){if(_0xa3b6a3[_0xd8ba('0x33')]>0x0){_0xa3b6a3[_0xd8ba('0x33')]-=0x1;}else{logger[_0xd8ba('0xc')](_0xd8ba('0x34'),_0x2ba9da);}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x2ba9da);}};exports[_0xd8ba('0x35')]=function(_0x29cb08){var _0x5041e0=moment()[_0xd8ba('0x13')](_0xd8ba('0x36'));_0x29cb08[_0xd8ba('0x37')]=0xd;_0x29cb08['statedesc']=_0xd8ba('0x38');_0x29cb08['starttime']=_0x5041e0;_0x29cb08['responsetime']=_0x5041e0;_0x29cb08[_0xd8ba('0x39')]=_0x5041e0;};exports[_0xd8ba('0x3a')]=function(_0x114dde,_0x37f3ab,_0x2139b4){var _0x1c1296=moment()[_0xd8ba('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x114dde[_0xd8ba('0x37')]=_0x37f3ab;_0x114dde[_0xd8ba('0x3b')]=_0x2139b4;_0x114dde[_0xd8ba('0x3c')]=_0x1c1296;_0x114dde[_0xd8ba('0x3d')]=getSeconds(_0x114dde[_0xd8ba('0x3c')],_0x114dde[_0xd8ba('0x3e')]);};exports[_0xd8ba('0x3f')]=function(_0x189b66,_0xb7f16f,_0x452a81){_0x189b66[_0xd8ba('0x40')]=_0xb7f16f;_0x189b66[_0xd8ba('0x41')]=_0x452a81;};exports[_0xd8ba('0x42')]=function(_0x37ff52,_0x4b6a3b,_0x272c08){var _0x5cad78=moment()[_0xd8ba('0x13')](_0xd8ba('0x36'));_0x37ff52['state']=_0x4b6a3b;_0x37ff52[_0xd8ba('0x3b')]=_0x272c08;_0x37ff52[_0xd8ba('0x3c')]=_0x37ff52[_0xd8ba('0x3c')]?_0x37ff52[_0xd8ba('0x3c')]:_0x5cad78;_0x37ff52['endtime']=_0x37ff52[_0xd8ba('0x39')]?_0x37ff52['endtime']:_0x5cad78;_0x37ff52['ringtime']=getSeconds(_0x37ff52['responsetime']||0x0,_0x37ff52[_0xd8ba('0x3e')]||0x0);_0x37ff52[_0xd8ba('0x43')]=_0x37ff52[_0xd8ba('0x44')]?getSeconds(_0x37ff52[_0xd8ba('0x39')],_0x37ff52[_0xd8ba('0x44')]):0x0;};exports[_0xd8ba('0x45')]=function(_0x39d64e){return _0x39d64e===_0xd8ba('0x46');};exports['variablesAction']=function(_0xd99356,_0x3c1a07,_0x4d291a,_0xa65c6e,_0x4a58de){var _0xa2e936=_0xa65c6e?'RECALL':_0xd99356[_0xd8ba('0x1b')];_0xa2e936=_0x4a58de?_0xd8ba('0x47'):_0xa2e936;return{'actionid':_0xd99356[_0xd8ba('0x48')],'action':'originate','channel':_0xd99356[_0xd8ba('0x49')],'callerid':util[_0xd8ba('0x13')](_0xd8ba('0x14'),_0xa2e936,_0xd99356[_0xd8ba('0x1c')]),'Exten':'xcally-motion-preview','Context':'from-sip','Priority':'1','variable':_0x4d291a,'timeout':(_0x3c1a07[_0xd8ba('0x4a')]||0x1e)*0x3e8,'async':!![],'channelid':_0xd99356[_0xd8ba('0x48')]};};exports[_0xd8ba('0x4b')]=function(_0xbe228c){return _0xbe228c[_0xd8ba('0x4c')]+_0xbe228c[_0xd8ba('0x4d')]+_0xbe228c[_0xd8ba('0x4e')]+_0xbe228c['countagentrejectretry']+_0xbe228c[_0xd8ba('0x4f')];};exports['cloneAction']=function(_0xf2937e){var _0x1d58c=_[_0xd8ba('0x50')](_0xf2937e);_0x1d58c[_0xd8ba('0x37')]=0xf;_0x1d58c['statedesc']=_0xd8ba('0x51');return _0x1d58c;};exports[_0xd8ba('0x52')]=function(_0x413022,_0x18f7ca,_0x158961){var _0x287f89={};_0x287f89[_0x18f7ca]=_0x413022[_0x18f7ca];_0x287f89[_0xd8ba('0x53')]=![];_0x287f89['scheduledat']=moment()[_0xd8ba('0x54')](_0x158961,_0xd8ba('0x55'))[_0xd8ba('0x13')](_0xd8ba('0x36'));_0x287f89[_0xd8ba('0x1d')]=_0x413022[_0xd8ba('0x1d')];_0x287f89[_0xd8ba('0x56')]=_0x413022[_0xd8ba('0x56')];_0x287f89[_0xd8ba('0x1e')]=_0x413022[_0xd8ba('0x1e')]||undefined;return _0x287f89;};exports['decrementTalkink']=function(_0xaa1d03,_0x325b56){if(!_['isNil'](_0xaa1d03)){if(_0xaa1d03[_0xd8ba('0x57')]>0x0){_0xaa1d03[_0xd8ba('0x57')]-=0x1;}else{logger[_0xd8ba('0xc')](_0x325b56,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0xd8ba('0xc')](_0x325b56,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0xd8ba('0x58')]=function(_0x4b6da9){if(_0x4b6da9<=0x0){return!![];}return![];};exports['buildObj']=function(_0x2442c2,_0x3562ca,_0x2d5de1){_0x2442c2[_0xd8ba('0x59')]=_0x3562ca;_0x2442c2['name']=_0x2442c2[_0xd8ba('0x5a')];_0x2442c2[_0xd8ba('0x5b')]=_0x2442c2[_0xd8ba('0x49')];if(_0x2d5de1){_0x2442c2[_0xd8ba('0x5c')]=_0x2d5de1[_0xd8ba('0x5c')];}return _0x2442c2;};exports[_0xd8ba('0x5d')]=function(_0x2e472e){var _0x44408d={};_0x44408d[_0xd8ba('0x5a')]=_0x2e472e[_0xd8ba('0x5a')];_0x44408d[_0xd8ba('0x5b')]=_0x2e472e[_0xd8ba('0x49')];_0x44408d[_0xd8ba('0x48')]=_0x2e472e[_0xd8ba('0x48')];return _0x44408d;};exports['agentReadyId']=function(_0x302365){var _0x1c88af=[];for(var _0x392c96 in _0x302365){if(_0x302365[_0xd8ba('0x2b')](_0x392c96)){if(!_[_0xd8ba('0x17')](_0x302365[_0x392c96])&&_0x302365[_0x392c96][_0xd8ba('0x37')]==='not_inuse'&&_0x302365[_0x392c96][_0xd8ba('0x5e')]===_0xd8ba('0x5f')){_0x1c88af['push'](_0x302365[_0x392c96]['id']);}}}return _0x1c88af;};exports[_0xd8ba('0x60')]=function(_0x529864){var _0x1fc9b0=moment()[_0xd8ba('0x6')](0x0);var _0x4c6b69=moment(_0x529864)['milliseconds'](0x0);return _0x1fc9b0[_0xd8ba('0x61')](_0x4c6b69,_0xd8ba('0x7'));};exports[_0xd8ba('0x62')]=function(_0x40c03b){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x40c03b[_0xd8ba('0x1d')],'ListId':_0x40c03b[_0xd8ba('0x56')],'VoiceQueueId':_0x40c03b[_0xd8ba('0x1e')]||undefined,'CampaignId':_0x40c03b[_0xd8ba('0x63')]||undefined};};exports[_0xd8ba('0x64')]=function(_0x315448){if(_0x315448==='uniqueid'||_0x315448==='idContact'||_0x315448===_0xd8ba('0x5a')||_0x315448==='type'||_0x315448===_0xd8ba('0x65')||_0x315448===_0xd8ba('0x66')||_0x315448==='membername'||_0x315448===_0xd8ba('0x49')||_0x315448===_0xd8ba('0x1b')||_0x315448===_0xd8ba('0x53')||_0x315448===_0xd8ba('0x1c')||_0x315448===_0xd8ba('0x67')||_0x315448==='countbusyretry'||_0x315448===_0xd8ba('0x4d')||_0x315448===_0xd8ba('0x4e')||_0x315448==='countglobal'||_0x315448===_0xd8ba('0x68')||_0x315448===_0xd8ba('0x69')||_0x315448==='callbackat'||_0x315448===_0xd8ba('0x6a')||_0x315448==='ContactId'||_0x315448===_0xd8ba('0x56')||_0x315448==='UserId'||_0x315448==='VoiceQueueId'||_0x315448===_0xd8ba('0x6b')||_0x315448===_0xd8ba('0x6c')||_0x315448===_0xd8ba('0x6d')||_0x315448===_0xd8ba('0x6e')||_0x315448===_0xd8ba('0x6f')||_0x315448===_0xd8ba('0x70')||_0x315448===_0xd8ba('0x71')||_0x315448===_0xd8ba('0x72')||_0x315448===_0xd8ba('0x73')||_0x315448===_0xd8ba('0x74')||_0x315448===_0xd8ba('0x75')||_0x315448==='xmd-cdrtype'||_0x315448===_0xd8ba('0x76')||_0x315448===_0xd8ba('0x77')||_0x315448===_0xd8ba('0x78')||_0x315448===_0xd8ba('0x79')||_0x315448===_0xd8ba('0x7a')||_0x315448===_0xd8ba('0x7b')||_0x315448==='rtpaudioqosjitterbridged'||_0x315448===_0xd8ba('0x7c')||_0x315448==='rtpaudioqoslossbridged'||_0x315448==='rtpaudioqosrtt'||_0x315448==='rtpaudioqosrttbridged'||_0x315448==='rtpaudioqos'||_0x315448===_0xd8ba('0x7a')||_0x315448==='rtpaudioqosjitter'||_0x315448==='rtpaudioqosjitterbridged'||_0x315448===_0xd8ba('0x7c')||_0x315448===_0xd8ba('0x7d')||_0x315448==='rtpaudioqosrtt'||_0x315448===_0xd8ba('0x7e')||_0x315448===_0xd8ba('0x7f')||_0x315448===_0xd8ba('0x80')||_0x315448===_0xd8ba('0x37')||_0x315448==='statedesc'){return![];}return!![];};exports[_0xd8ba('0x81')]=function(_0x154af7,_0x3709cb){var _0xa15c1,_0x26283d,_0x4b8606;if(_0x3709cb<=0x0){_0x3709cb=0x1;}_0xa15c1=new RegExp(_0xd8ba('0x82')+_0x3709cb+'}$');_0x26283d=Math['pow'](0xa,_0x3709cb-0x1);_0x4b8606=Math['pow'](0xa,_0x3709cb)-0x1;return util[_0xd8ba('0x13')]('%s',_[_0xd8ba('0x83')](_0x154af7,_0xa15c1,_[_0xd8ba('0x84')](_0x26283d,_0x4b8606)));};exports['extractCalleridName']=function(_0x4792b8){var _0x169294=_0x4792b8[_0xd8ba('0x85')](/"(.*?)"/);return _0x169294?_0x169294[0x1]:_0x4792b8;};exports[_0xd8ba('0x86')]=function(_0x1f5042){var _0x28fe1a=_0x1f5042[_0xd8ba('0x85')](/<(.*?)>/);return _0x28fe1a?_0x28fe1a[0x1]:_0x1f5042;}; \ No newline at end of file +var _0x8bcc=['logCustomer','ringtime','talktime','answertime','isFailure','variablesAction','RECALL','BOOKED','uniqueid','channelAgent','from-sip','timeout','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','scheduledAt','active','scheduledat','add','ContactId','ListId','VoiceQueueId','decrementTalkink','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','interface','mandatoryDisposition','agentReadyId','not_inuse','status','reachable','push','createBody','CampaignId','filterKey','idContact','type','membername','countbusyretry','callback','callbackat','sipcallid','xmd-queue','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','bridgepvtcallid','getCallerIdRandom','pow','random','extractCalleridName','extractCalleridNumber','match','util','lodash','moment','../../../../config/logger','preview','XCALLY_IP_AGI','127.0.0.1','milliseconds','seconds','logger','info','loggerError','error','inspect','logger2','getCallerId','string','isEmpty','format','\x22%s\x22\x20<%s>','isUndefined','\x22\x22\x20<>','isNil','addVariables','Queue','name','calleridname','calleridnum','dialer','dialOriginateTimeout','dialQueueProject2','monitor_format','dialPreviewUrl','dialQueueProject','NONE','\x22agi://%s/square,%s\x22','originatecalleridnum','xcally-motion-preview','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','createdAt','updatedAt','XMD-','toUpper','toLowerVariables','toLower','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','starttime','responsetime','endtime','logAgent','statedesc','logLookAgent'];(function(_0x19cf65,_0x56fd74){var _0xafe3ad=function(_0x44cc3a){while(--_0x44cc3a){_0x19cf65['push'](_0x19cf65['shift']());}};_0xafe3ad(++_0x56fd74);}(_0x8bcc,0x14f));var _0xc8bc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8bcc[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xc8bc('0x0'));var _=require(_0xc8bc('0x1'));var moment=require(_0xc8bc('0x2'));var logger=require(_0xc8bc('0x3'))(_0xc8bc('0x4'));var ipAgi=process['env'][_0xc8bc('0x5')]||_0xc8bc('0x6');function getSeconds(_0xb92557,_0x4dc057){var _0x504492=moment(_0xb92557)[_0xc8bc('0x7')](0x0);var _0x59d5e8=moment(_0x4dc057)['milliseconds'](0x0);return _0x504492['diff'](_0x59d5e8,_0xc8bc('0x8'));}exports['loggerCatch']=function(_0x250981){return function(_0x7d264a){logger['error'](_0x250981,util['inspect'](_0x7d264a,{'showHidden':![],'depth':null}));};};exports[_0xc8bc('0x9')]=function(_0xf86eeb,_0x3d2496){logger[_0xc8bc('0xa')](_0xf86eeb,util['inspect'](_0x3d2496,{'showHidden':![],'depth':null}));};exports[_0xc8bc('0xb')]=function(_0x524902,_0x166752){logger[_0xc8bc('0xc')](_0x524902,util[_0xc8bc('0xd')](_0x166752,{'showHidden':![],'depth':null}));};exports[_0xc8bc('0xe')]=function(_0x22208a){return function(_0x126b73){logger[_0xc8bc('0xa')](_0x22208a,util[_0xc8bc('0xd')](_0x126b73,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x3a2c2b,_0x57c358,_0x436224){return{'message':_0x3a2c2b,'unlock':_0x57c358,'active':_0x436224};};exports[_0xc8bc('0xf')]=function(_0x37400a,_0x5bf550,_0x43672e){if(!_['isUndefined'](_0x43672e)&&_0xc8bc('0x10')===typeof _0x43672e&&!_[_0xc8bc('0x11')](_0x43672e)){if(!_['isUndefined'](_0x5bf550)&&_0xc8bc('0x10')===typeof _0x5bf550&&!_[_0xc8bc('0x11')](_0x5bf550)){return util[_0xc8bc('0x12')](_0xc8bc('0x13'),_0x5bf550,_0x43672e);}return util[_0xc8bc('0x12')](_0xc8bc('0x13'),_0x43672e,_0x43672e);}if(!_[_0xc8bc('0x14')](_0x37400a)&&_0xc8bc('0x10')===typeof _0x37400a&&!_[_0xc8bc('0x11')](_0x37400a)){return _0x37400a;}return _0xc8bc('0x15');};exports['isActive']=function(_0x8ac2e3){if(_[_0xc8bc('0x16')](_0x8ac2e3)){return![];}return _0x8ac2e3;};exports[_0xc8bc('0x17')]=function(_0x36c278,_0x5c6b30,_0x4e6601,_0x46a2ab,_0x3b7a0b,_0x3df40b){var _0x42cff3={'XMD-QUEUE':_0x5c6b30[_0xc8bc('0x18')]?_0x5c6b30[_0xc8bc('0x18')][_0xc8bc('0x19')]:'','XMD-CALLERID':_0x46a2ab,'XMD-CALLERID-PREVIEW':_0x3df40b?util[_0xc8bc('0x12')](_0xc8bc('0x13'),_0x3df40b[_0xc8bc('0x1a')],_0x3df40b[_0xc8bc('0x1b')]):_0x46a2ab,'XMD-DIALID':_0x3b7a0b,'XMD-CONTACTID':_0x5c6b30['ContactId'],'XMD-CDRTYPE':_0xc8bc('0x1c'),'CALLERID(all)':_0x46a2ab,'XMD-VOICEQUEUEID':_0x5c6b30['VoiceQueueId'],'XMD-DIALCHANNEL':_0x4e6601,'XMD-DIALTIMEOUT':_0x36c278[_0xc8bc('0x1d')]||0x1e,'XMD-DIALOPTIONS':util[_0xc8bc('0x12')]('\x22rtTxX%s%s\x22',_0x36c278[_0xc8bc('0x1e')]?'g':'',_[_0xc8bc('0x11')](_0x36c278[_0xc8bc('0x1f')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x36c278[_0xc8bc('0x20')]||'','XMD-AGI':_0x36c278[_0xc8bc('0x21')]?util[_0xc8bc('0x12')]('\x22agi://%s/square,%s\x22',ipAgi,_0x36c278[_0xc8bc('0x21')]):_0xc8bc('0x22'),'XMD-AGIAFTER':_0x36c278[_0xc8bc('0x1e')]?util[_0xc8bc('0x12')](_0xc8bc('0x23'),ipAgi,_0x36c278['dialQueueProject2']):_0xc8bc('0x22'),'XMD-ORIGINATECALLERIDNUM':_0x3df40b?_0x3df40b[_0xc8bc('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x3df40b?_0x3df40b['originatecalleridname']:'','XMD-DESTINATION':_0xc8bc('0x25')};if(!_[_0xc8bc('0x11')](_0x36c278[_0xc8bc('0x1f')])){_0x42cff3[util[_0xc8bc('0x12')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x36c278[_0xc8bc('0x1f')];_0x42cff3[util[_0xc8bc('0x12')]('%s',_0xc8bc('0x26'))]=_0x3b7a0b;}if(_0x5c6b30&&_0x5c6b30[_0xc8bc('0x27')]){for(var _0x46e6a2 in _0x5c6b30['Contact']){if(_0x5c6b30[_0xc8bc('0x27')][_0xc8bc('0x28')](_0x46e6a2)){if(!_[_0xc8bc('0x16')](_0x5c6b30['Contact'][_0x46e6a2])&&_0x46e6a2!=='id'&&_0x46e6a2!=='tags'&&_0x46e6a2!==_0xc8bc('0x29')&&_0x46e6a2!==_0xc8bc('0x2a')){_0x42cff3[util[_0xc8bc('0x12')]('%s%s',_0xc8bc('0x2b'),_[_0xc8bc('0x2c')](_0x46e6a2))]=_0x5c6b30[_0xc8bc('0x27')][_0x46e6a2];}}}}return _0x42cff3;};exports[_0xc8bc('0x2d')]=function(_0x23e2b2){var _0x369cd1={};for(var _0xc4bc6a in _0x23e2b2){if(_0x23e2b2[_0xc8bc('0x28')](_0xc4bc6a)){_0x369cd1[util[_0xc8bc('0x12')]('%s',_[_0xc8bc('0x2e')](_0xc4bc6a))]=_0x23e2b2[_0xc4bc6a];}}return{'variables':_0x369cd1};};exports['updateOriginated']=function(_0x25e136,_0x32a31c){if(!_[_0xc8bc('0x16')](_0x25e136)){if(_0x25e136[_0xc8bc('0x28')](_0xc8bc('0x2f'))){if(_0x25e136[_0xc8bc('0x2f')]>0x0){_0x25e136['originated']-=0x1;}else{logger[_0xc8bc('0xc')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x32a31c);}}}else{logger['error'](_0xc8bc('0x30'),_0x32a31c);}};exports[_0xc8bc('0x31')]=function(_0x1e8049){var _0x3af21f=moment()[_0xc8bc('0x12')](_0xc8bc('0x32'));_0x1e8049[_0xc8bc('0x33')]=0xd;_0x1e8049['statedesc']='Blacklist';_0x1e8049[_0xc8bc('0x34')]=_0x3af21f;_0x1e8049[_0xc8bc('0x35')]=_0x3af21f;_0x1e8049[_0xc8bc('0x36')]=_0x3af21f;};exports[_0xc8bc('0x37')]=function(_0x221af9,_0x4f80b2,_0xe25143){var _0x52f988=moment()[_0xc8bc('0x12')](_0xc8bc('0x32'));_0x221af9[_0xc8bc('0x33')]=_0x4f80b2;_0x221af9[_0xc8bc('0x38')]=_0xe25143;_0x221af9[_0xc8bc('0x35')]=_0x52f988;_0x221af9['ringtime']=getSeconds(_0x221af9[_0xc8bc('0x35')],_0x221af9[_0xc8bc('0x34')]);};exports[_0xc8bc('0x39')]=function(_0x48fcba,_0x32ad02,_0x115940){_0x48fcba['membername']=_0x32ad02;_0x48fcba['UserId']=_0x115940;};exports[_0xc8bc('0x3a')]=function(_0xc47b5,_0x4eb837,_0x5c2af6){var _0x4620d9=moment()[_0xc8bc('0x12')](_0xc8bc('0x32'));_0xc47b5[_0xc8bc('0x33')]=_0x4eb837;_0xc47b5[_0xc8bc('0x38')]=_0x5c2af6;_0xc47b5[_0xc8bc('0x35')]=_0xc47b5[_0xc8bc('0x35')]?_0xc47b5['responsetime']:_0x4620d9;_0xc47b5['endtime']=_0xc47b5[_0xc8bc('0x36')]?_0xc47b5['endtime']:_0x4620d9;_0xc47b5[_0xc8bc('0x3b')]=getSeconds(_0xc47b5[_0xc8bc('0x35')]||0x0,_0xc47b5[_0xc8bc('0x34')]||0x0);_0xc47b5[_0xc8bc('0x3c')]=_0xc47b5[_0xc8bc('0x3d')]?getSeconds(_0xc47b5[_0xc8bc('0x36')],_0xc47b5[_0xc8bc('0x3d')]):0x0;};exports[_0xc8bc('0x3e')]=function(_0x130989){return _0x130989==='Failure';};exports[_0xc8bc('0x3f')]=function(_0xa3c57b,_0x1e82ce,_0x56bf4a,_0x110c94,_0x15326e){var _0x16d214=_0x110c94?_0xc8bc('0x40'):_0xa3c57b[_0xc8bc('0x1a')];_0x16d214=_0x15326e?_0xc8bc('0x41'):_0x16d214;return{'actionid':_0xa3c57b[_0xc8bc('0x42')],'action':'originate','channel':_0xa3c57b[_0xc8bc('0x43')],'callerid':util['format'](_0xc8bc('0x13'),_0x16d214,_0xa3c57b[_0xc8bc('0x1b')]),'Exten':_0xc8bc('0x25'),'Context':_0xc8bc('0x44'),'Priority':'1','variable':_0x56bf4a,'timeout':(_0x1e82ce[_0xc8bc('0x45')]||0x1e)*0x3e8,'async':!![],'channelid':_0xa3c57b['uniqueid']};};exports['totalGlobal']=function(_0x135f43){return _0x135f43['countbusyretry']+_0x135f43[_0xc8bc('0x46')]+_0x135f43[_0xc8bc('0x47')]+_0x135f43[_0xc8bc('0x48')]+_0x135f43[_0xc8bc('0x49')];};exports[_0xc8bc('0x4a')]=function(_0xf8d318){var _0x12b225=_[_0xc8bc('0x4b')](_0xf8d318);_0x12b225[_0xc8bc('0x33')]=0xf;_0x12b225[_0xc8bc('0x38')]='Global';return _0x12b225;};exports[_0xc8bc('0x4c')]=function(_0x5f35a0,_0x5b591b,_0x3b53e9){var _0x53b4fd={};_0x53b4fd[_0x5b591b]=_0x5f35a0[_0x5b591b];_0x53b4fd[_0xc8bc('0x4d')]=![];_0x53b4fd[_0xc8bc('0x4e')]=moment()[_0xc8bc('0x4f')](_0x3b53e9,'minutes')[_0xc8bc('0x12')](_0xc8bc('0x32'));_0x53b4fd[_0xc8bc('0x50')]=_0x5f35a0['ContactId'];_0x53b4fd[_0xc8bc('0x51')]=_0x5f35a0['ListId'];_0x53b4fd[_0xc8bc('0x52')]=_0x5f35a0[_0xc8bc('0x52')]||undefined;return _0x53b4fd;};exports[_0xc8bc('0x53')]=function(_0x5445d2,_0x1b0761){if(!_['isNil'](_0x5445d2)){if(_0x5445d2[_0xc8bc('0x54')]>0x0){_0x5445d2[_0xc8bc('0x54')]-=0x1;}else{logger['error'](_0x1b0761,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0xc8bc('0xc')](_0x1b0761,_0xc8bc('0x55'));}};exports[_0xc8bc('0x56')]=function(_0x404c23){if(_0x404c23<=0x0){return!![];}return![];};exports['buildObj']=function(_0x48cdf1,_0x2e41b7,_0x56687f){_0x48cdf1[_0xc8bc('0x57')]=_0x2e41b7;_0x48cdf1[_0xc8bc('0x19')]=_0x48cdf1[_0xc8bc('0x58')];_0x48cdf1[_0xc8bc('0x59')]=_0x48cdf1[_0xc8bc('0x43')];if(_0x56687f){_0x48cdf1[_0xc8bc('0x5a')]=_0x56687f[_0xc8bc('0x5a')];}return _0x48cdf1;};exports['buildAcw']=function(_0x43f6fa){var _0x2c2e0e={};_0x2c2e0e['queue']=_0x43f6fa[_0xc8bc('0x58')];_0x2c2e0e[_0xc8bc('0x59')]=_0x43f6fa[_0xc8bc('0x43')];_0x2c2e0e[_0xc8bc('0x42')]=_0x43f6fa[_0xc8bc('0x42')];return _0x2c2e0e;};exports[_0xc8bc('0x5b')]=function(_0x483029){var _0x48e463=[];for(var _0x42fec1 in _0x483029){if(_0x483029[_0xc8bc('0x28')](_0x42fec1)){if(!_[_0xc8bc('0x16')](_0x483029[_0x42fec1])&&_0x483029[_0x42fec1][_0xc8bc('0x33')]===_0xc8bc('0x5c')&&_0x483029[_0x42fec1][_0xc8bc('0x5d')]===_0xc8bc('0x5e')){_0x48e463[_0xc8bc('0x5f')](_0x483029[_0x42fec1]['id']);}}}return _0x48e463;};exports['getDiff']=function(_0x10d3da){var _0xe09ac6=moment()['milliseconds'](0x0);var _0x26c5cc=moment(_0x10d3da)['milliseconds'](0x0);return _0xe09ac6['diff'](_0x26c5cc,_0xc8bc('0x8'));};exports[_0xc8bc('0x60')]=function(_0x4028f4){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x4028f4['ContactId'],'ListId':_0x4028f4[_0xc8bc('0x51')],'VoiceQueueId':_0x4028f4['VoiceQueueId']||undefined,'CampaignId':_0x4028f4[_0xc8bc('0x61')]||undefined};};exports[_0xc8bc('0x62')]=function(_0x29241b){if(_0x29241b===_0xc8bc('0x42')||_0x29241b===_0xc8bc('0x63')||_0x29241b===_0xc8bc('0x58')||_0x29241b===_0xc8bc('0x64')||_0x29241b==='campaigntype'||_0x29241b==='dialAnswer'||_0x29241b===_0xc8bc('0x65')||_0x29241b==='channelAgent'||_0x29241b===_0xc8bc('0x1a')||_0x29241b===_0xc8bc('0x4d')||_0x29241b===_0xc8bc('0x1b')||_0x29241b===_0xc8bc('0x4e')||_0x29241b===_0xc8bc('0x66')||_0x29241b===_0xc8bc('0x46')||_0x29241b==='countnoanswerretry'||_0x29241b==='countglobal'||_0x29241b===_0xc8bc('0x67')||_0x29241b==='callbackuniqueid'||_0x29241b===_0xc8bc('0x68')||_0x29241b==='recallme'||_0x29241b===_0xc8bc('0x50')||_0x29241b==='ListId'||_0x29241b==='UserId'||_0x29241b===_0xc8bc('0x52')||_0x29241b===_0xc8bc('0x69')||_0x29241b==='xmd-voicequeueid'||_0x29241b===_0xc8bc('0x6a')||_0x29241b==='xmd-phone'||_0x29241b==='xmd-listid'||_0x29241b===_0xc8bc('0x6b')||_0x29241b===_0xc8bc('0x6c')||_0x29241b===_0xc8bc('0x6d')||_0x29241b===_0xc8bc('0x6e')||_0x29241b===_0xc8bc('0x6f')||_0x29241b===_0xc8bc('0x70')||_0x29241b===_0xc8bc('0x71')||_0x29241b==='xmd-callerid'||_0x29241b===_0xc8bc('0x72')||_0x29241b===_0xc8bc('0x73')||_0x29241b===_0xc8bc('0x74')||_0x29241b===_0xc8bc('0x75')||_0x29241b==='rtpaudioqosjitter'||_0x29241b==='rtpaudioqosjitterbridged'||_0x29241b===_0xc8bc('0x76')||_0x29241b===_0xc8bc('0x77')||_0x29241b===_0xc8bc('0x78')||_0x29241b===_0xc8bc('0x79')||_0x29241b===_0xc8bc('0x74')||_0x29241b===_0xc8bc('0x75')||_0x29241b===_0xc8bc('0x7a')||_0x29241b===_0xc8bc('0x7b')||_0x29241b===_0xc8bc('0x76')||_0x29241b===_0xc8bc('0x77')||_0x29241b===_0xc8bc('0x78')||_0x29241b===_0xc8bc('0x79')||_0x29241b==='bridgepeer'||_0x29241b===_0xc8bc('0x7c')||_0x29241b==='state'||_0x29241b==='statedesc'){return![];}return!![];};exports[_0xc8bc('0x7d')]=function(_0x203c1d,_0x59eeb3){var _0x22fa5c,_0xa66999,_0x227aa9;if(_0x59eeb3<=0x0){_0x59eeb3=0x1;}_0x22fa5c=new RegExp('\x5cw{0,'+_0x59eeb3+'}$');_0xa66999=Math[_0xc8bc('0x7e')](0xa,_0x59eeb3-0x1);_0x227aa9=Math['pow'](0xa,_0x59eeb3)-0x1;return util['format']('%s',_['replace'](_0x203c1d,_0x22fa5c,_[_0xc8bc('0x7f')](_0xa66999,_0x227aa9)));};exports[_0xc8bc('0x80')]=function(_0x194f86){var _0x23279=_0x194f86['match'](/"(.*?)"/);return _0x23279?_0x23279[0x1]:_0x194f86;};exports[_0xc8bc('0x81')]=function(_0x56337b){var _0x46660d=_0x56337b[_0xc8bc('0x82')](/<(.*?)>/);return _0x46660d?_0x46660d[0x1]:_0x56337b;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index c2cf4bc..ff766e6 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 _0x9350=['voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string','boolean','queuepause','reload'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9350,0x8b));var _0x0935=function(_0x4cf0b7,_0x560029){_0x4cf0b7=_0x4cf0b7-0x0;var _0x545f10=_0x9350[_0x4cf0b7];return _0x545f10;};'use strict';exports[_0x0935('0x0')]={'queue':{'type':_0x0935('0x1'),'required':!![]},'interface':{'type':_0x0935('0x1'),'required':!![]},'membername':{'type':_0x0935('0x1'),'required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0x0935('0x2'),'required':![]}};exports['queueremove']={'queue':{'type':_0x0935('0x1'),'required':!![]},'interface':{'type':_0x0935('0x1'),'required':!![]}};exports[_0x0935('0x3')]={'interface':{'type':_0x0935('0x1'),'required':!![]},'paused':{'type':_0x0935('0x2')},'reason':{'type':_0x0935('0x1'),'required':![]}};exports[_0x0935('0x4')]={'module':{'type':'string','required':![]}};exports[_0x0935('0x5')]={'uniqueid':{'type':_0x0935('0x1'),'required':!![]}};exports[_0x0935('0x6')]={'uniqueid':{'type':_0x0935('0x1'),'required':!![]},'filename':{'type':_0x0935('0x1')},'format':{'type':_0x0935('0x1')},'mixmonitorid':{'type':'string'}};exports[_0x0935('0x7')]={'uniqueid':{'type':_0x0935('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0x0935('0x1'),'required':!![]},'exten':{'type':_0x0935('0x1'),'required':!![]},'context':{'type':_0x0935('0x1')}}; \ No newline at end of file +var _0x3ca4=['queuepause','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','boolean','queueremove'];(function(_0x58dae4,_0x461ef8){var _0x310bba=function(_0x28e738){while(--_0x28e738){_0x58dae4['push'](_0x58dae4['shift']());}};_0x310bba(++_0x461ef8);}(_0x3ca4,0xce));var _0x43ca=function(_0x17dcc5,_0x217799){_0x17dcc5=_0x17dcc5-0x0;var _0x403fcb=_0x3ca4[_0x17dcc5];return _0x403fcb;};'use strict';exports[_0x43ca('0x0')]={'queue':{'type':_0x43ca('0x1'),'required':!![]},'interface':{'type':_0x43ca('0x1'),'required':!![]},'membername':{'type':_0x43ca('0x1'),'required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0x43ca('0x2'),'required':![]}};exports[_0x43ca('0x3')]={'queue':{'type':_0x43ca('0x1'),'required':!![]},'interface':{'type':_0x43ca('0x1'),'required':!![]}};exports[_0x43ca('0x4')]={'interface':{'type':'string','required':!![]},'paused':{'type':_0x43ca('0x2')},'reason':{'type':_0x43ca('0x1'),'required':![]}};exports[_0x43ca('0x5')]={'module':{'type':_0x43ca('0x1'),'required':![]}};exports[_0x43ca('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x43ca('0x7')]={'uniqueid':{'type':_0x43ca('0x1'),'required':!![]},'filename':{'type':_0x43ca('0x1')},'format':{'type':_0x43ca('0x1')},'mixmonitorid':{'type':_0x43ca('0x1')}};exports[_0x43ca('0x8')]={'uniqueid':{'type':_0x43ca('0x1'),'required':!![]}};exports[_0x43ca('0x9')]={'uniqueid':{'type':_0x43ca('0x1'),'required':!![]},'exten':{'type':_0x43ca('0x1'),'required':!![]},'context':{'type':_0x43ca('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 3323571..8864d6a 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 _0xc57d=['../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','trunks','voiceQueues','triggers','campaigns','outbound','voiceExtensions','channels','queueChannels','outboundChannels','timers','settings','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','total','answered','sumHoldTime','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','sumDuration','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','prototype','length','isUndefined','telephones','mergeFromDatabase','initTrunks','initVoiceQueues','initTriggers','initTemplates','templates','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','zohoAccounts','deskAccounts','initSugarcrmAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallercomplete','initVoiceCallReports','duration','disposition','ANSWERED','initCampaigns','dialQueueProject','SquareProject','initCampaignHopperHistory','initFaxAccounts','exports','bluebird','lodash','moment','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/voiceExtension','../model/salesforceAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount'];(function(_0x52d166,_0x4fae49){var _0x4cc086=function(_0x22c316){while(--_0x22c316){_0x52d166['push'](_0x52d166['shift']());}};_0x4cc086(++_0x4fae49);}(_0xc57d,0x13c));var _0xdc57=function(_0x6c1c3a,_0x387361){_0x6c1c3a=_0x6c1c3a-0x0;var _0x520259=_0xc57d[_0x6c1c3a];return _0x520259;};'use strict';var BPromise=require(_0xdc57('0x0'));var util=require('util');var _=require(_0xdc57('0x1'));var moment=require(_0xdc57('0x2'));var Agent=require('../model/agent');var Telephone=require(_0xdc57('0x3'));var Trunk=require(_0xdc57('0x4'));var VoiceQueue=require(_0xdc57('0x5'));var Trigger=require(_0xdc57('0x6'));var Template=require(_0xdc57('0x7'));var Campaign=require('../model/campaign');var VoiceExtension=require(_0xdc57('0x8'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0xdc57('0x9'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require(_0xdc57('0xa'));var ZohoAccount=require(_0xdc57('0xb'));var DeskAccount=require(_0xdc57('0xc'));var VtigerAccount=require(_0xdc57('0xd'));var ServicenowAccount=require(_0xdc57('0xe'));var Dynamics365Account=require(_0xdc57('0xf'));var FreshsalesAccount=require(_0xdc57('0x10'));var FaxAccount=require(_0xdc57('0x11'));var Realtime=function(){this[_0xdc57('0x12')]={};this['telephones']={};this[_0xdc57('0x13')]={};this[_0xdc57('0x14')]={};this[_0xdc57('0x15')]={};this[_0xdc57('0x16')]={};this['templates']={};this[_0xdc57('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xdc57('0x18')]={};this[_0xdc57('0x19')]={};this[_0xdc57('0x1a')]={};this[_0xdc57('0x1b')]={};this[_0xdc57('0x1c')]={};this[_0xdc57('0x1d')]={};this['zendeskAccounts']={};this[_0xdc57('0x1e')]={};this[_0xdc57('0x1f')]={};this[_0xdc57('0x20')]={};this['zohoAccounts']={};this['deskAccounts']={};this[_0xdc57('0x21')]={};this[_0xdc57('0x22')]={};this[_0xdc57('0x23')]={};this['freshsalesAccounts']={};this[_0xdc57('0x24')]={};};function freeIsNotKey(_0x4b7c58,_0x3fcb00,_0x417b19){var _0x3f8f45=_[_0xdc57('0x25')](_0x4b7c58,function(_0x36d52a,_0x15f2b7){return _0x36d52a[_0x417b19];});for(var _0xc9d7b3 in _0x3fcb00){if(_0x3fcb00[_0xdc57('0x26')](_0xc9d7b3)){if(!_0x3f8f45[_0xc9d7b3]){delete _0x3fcb00[_0xc9d7b3];}}}}function freeIsNotKeySip(_0x1176fe,_0x3c8b54){var _0x355e4d=_[_0xdc57('0x25')](_0x1176fe,function(_0x5c2542,_0x45130b){return util[_0xdc57('0x27')](_0xdc57('0x28'),_0x5c2542[_0xdc57('0x29')]);});for(var _0x5cb6c6 in _0x3c8b54){if(_0x3c8b54['hasOwnProperty'](_0x5cb6c6)){if(!_0x355e4d[_0x5cb6c6]){delete _0x3c8b54[_0x5cb6c6];}}}}function freeIsNotKeyAgent(_0x8e019a,_0x5f72f8){var _0x4c029d=_[_0xdc57('0x25')](_0x8e019a,function(_0x113a67,_0x26d50c){var _0x976222=_[_0xdc57('0x2a')](_0x113a67['interface'])?util[_0xdc57('0x27')]('SIP/%s',_0x113a67[_0xdc57('0x29')]):_0x113a67[_0xdc57('0x2b')];return _0x976222;});for(var _0x3da2e5 in _0x5f72f8){if(_0x5f72f8[_0xdc57('0x26')](_0x3da2e5)){if(!_0x4c029d[_0x3da2e5]){delete _0x5f72f8[_0x3da2e5];}}}}function clearVoiceCallReports(_0xa9d36c){_0xa9d36c[_0xdc57('0x2c')]=0x0;_0xa9d36c[_0xdc57('0x2d')]=0x0;_0xa9d36c[_0xdc57('0x2e')]=0x0;_0xa9d36c['sumDuration']=0x0;_0xa9d36c[_0xdc57('0x2f')]=0x0;}function clearCampaigns(_0x302a09){if(!_[_0xdc57('0x30')](_0x302a09)){for(var _0x205545 in _0x302a09){if(_0x302a09[_0xdc57('0x26')](_0x205545)){_0x302a09[_0x205545]['ivrTotalCallsDays']=0x0;_0x302a09[_0x205545][_0xdc57('0x31')]=0x0;}}}}function clearVoiceQueues(_0x4b0b02){if(!_[_0xdc57('0x30')](_0x4b0b02)){for(var _0x27ea30 in _0x4b0b02){if(_0x4b0b02[_0xdc57('0x26')](_0x27ea30)){_0x4b0b02[_0x27ea30][_0xdc57('0x2c')]=0x0;_0x4b0b02[_0x27ea30][_0xdc57('0x2d')]=0x0;_0x4b0b02[_0x27ea30][_0xdc57('0x32')]=0x0;_0x4b0b02[_0x27ea30][_0xdc57('0x33')]=0x0;_0x4b0b02[_0x27ea30][_0xdc57('0x2e')]=0x0;_0x4b0b02[_0x27ea30][_0xdc57('0x34')]=0x0;_0x4b0b02[_0x27ea30]['sumBillable']=0x0;_0x4b0b02[_0x27ea30][_0xdc57('0x35')]=0x0;_0x4b0b02[_0x27ea30][_0xdc57('0x36')]=0x0;_0x4b0b02[_0x27ea30][_0xdc57('0x37')]=0x0;_0x4b0b02[_0x27ea30][_0xdc57('0x38')]=0x0;_0x4b0b02[_0x27ea30]['outboundNoSuchCallsDay']=0x0;_0x4b0b02[_0x27ea30]['outboundUnknownCallsDay']=0x0;_0x4b0b02[_0x27ea30][_0xdc57('0x39')]=0x0;_0x4b0b02[_0x27ea30][_0xdc57('0x3a')]=0x0;_0x4b0b02[_0x27ea30][_0xdc57('0x3b')]=0x0;_0x4b0b02[_0x27ea30][_0xdc57('0x3c')]=0x0;_0x4b0b02[_0x27ea30][_0xdc57('0x3d')]=0x0;_0x4b0b02[_0x27ea30][_0xdc57('0x3e')]=0x0;_0x4b0b02[_0x27ea30][_0xdc57('0x35')]=0x0;_0x4b0b02[_0x27ea30][_0xdc57('0x3f')]=0x0;_0x4b0b02[_0x27ea30]['queueStatusComplete']=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x873643,_0x756e2f){for(var _0x37667e in _0x756e2f){if(_0x873643[_0xdc57('0x26')](_0x37667e)){_0x873643[_0x37667e]=_0x756e2f[_0x37667e];}}};Realtime[_0xdc57('0x40')]['initAgents']=function(){var _0x58fffd=this;return function(_0x38cca1){if(_0x38cca1){freeIsNotKeyAgent(_0x38cca1,_0x58fffd[_0xdc57('0x12')]);for(var _0x33ad13=0x0,_0x2dabdb={},_0xa96df7={};_0x33ad13<_0x38cca1[_0xdc57('0x41')];_0x33ad13+=0x1){_0x2dabdb=_0x38cca1[_0x33ad13];var _0xfe63be=_[_0xdc57('0x2a')](_0x2dabdb[_0xdc57('0x2b')])?util[_0xdc57('0x27')](_0xdc57('0x28'),_0x2dabdb['name']):_0x2dabdb[_0xdc57('0x2b')];if(_['isUndefined'](_0x58fffd[_0xdc57('0x12')][_0xfe63be])){_0x58fffd['agents'][_0xfe63be]=new Agent(_0x2dabdb);}else{_0x58fffd['mergeFromDatabase'](_0x58fffd['agents'][_0xfe63be],_0x2dabdb);}}}return _0x58fffd[_0xdc57('0x12')];};};Realtime[_0xdc57('0x40')]['initTelephones']=function(){var _0x56044d=this;return function(_0x26f759){if(_0x26f759){freeIsNotKeySip(_0x26f759,_0x56044d['telephones']);for(var _0x3f57c5=0x0,_0x3c44b9={},_0x52a512={};_0x3f57c5<_0x26f759[_0xdc57('0x41')];_0x3f57c5+=0x1){_0x3c44b9=_0x26f759[_0x3f57c5];if(_[_0xdc57('0x42')](_0x56044d[_0xdc57('0x43')][util[_0xdc57('0x27')](_0xdc57('0x28'),_0x3c44b9[_0xdc57('0x29')])])){_0x56044d[_0xdc57('0x43')][util[_0xdc57('0x27')]('SIP/%s',_0x3c44b9[_0xdc57('0x29')])]=new Telephone(_0x3c44b9);}else{_0x56044d[_0xdc57('0x44')](_0x56044d[_0xdc57('0x43')][util[_0xdc57('0x27')](_0xdc57('0x28'),_0x3c44b9[_0xdc57('0x29')])],_0x3c44b9);}}}return _0x56044d['telephones'];};};Realtime[_0xdc57('0x40')][_0xdc57('0x45')]=function(){var _0x417316=this;return function(_0x9e0edd){if(_0x9e0edd){freeIsNotKeySip(_0x9e0edd,_0x417316['trunks']);for(var _0x52ad7d=0x0,_0x5e68c8={},_0x4ab209={};_0x52ad7d<_0x9e0edd[_0xdc57('0x41')];_0x52ad7d+=0x1){_0x5e68c8=_0x9e0edd[_0x52ad7d];if(_[_0xdc57('0x42')](_0x417316[_0xdc57('0x13')][util[_0xdc57('0x27')](_0xdc57('0x28'),_0x5e68c8['name'])])){_0x417316[_0xdc57('0x13')][util['format'](_0xdc57('0x28'),_0x5e68c8['name'])]=new Trunk(_0x5e68c8);}else{_0x417316['mergeFromDatabase'](_0x417316[_0xdc57('0x13')][util[_0xdc57('0x27')](_0xdc57('0x28'),_0x5e68c8[_0xdc57('0x29')])],_0x5e68c8);}}}return _0x417316['trunks'];};};Realtime['prototype'][_0xdc57('0x46')]=function(){var _0x4a1c8c=this;return function(_0x3528be){if(_0x3528be){freeIsNotKey(_0x3528be,_0x4a1c8c[_0xdc57('0x14')],'name');for(var _0x1a29f8=0x0,_0x209c5b={},_0x4c1883={};_0x1a29f8<_0x3528be[_0xdc57('0x41')];_0x1a29f8+=0x1){_0x209c5b=_0x3528be[_0x1a29f8];if(_[_0xdc57('0x42')](_0x4a1c8c[_0xdc57('0x14')][_0x209c5b[_0xdc57('0x29')]])){_0x4a1c8c['voiceQueues'][_0x209c5b['name']]=new VoiceQueue(_0x209c5b);}else{_0x4a1c8c['mergeFromDatabase'](_0x4a1c8c[_0xdc57('0x14')][_0x209c5b[_0xdc57('0x29')]],_0x209c5b);}}}return _0x4a1c8c[_0xdc57('0x14')];};};Realtime[_0xdc57('0x40')][_0xdc57('0x47')]=function(){var _0x119941=this;return function(_0xd116cb){if(_0xd116cb){freeIsNotKey(_0xd116cb,_0x119941[_0xdc57('0x15')],'id');for(var _0x31bf2b=0x0,_0x1dec86={},_0x3de871={};_0x31bf2b<_0xd116cb[_0xdc57('0x41')];_0x31bf2b+=0x1){_0x1dec86=_0xd116cb[_0x31bf2b];if(_[_0xdc57('0x42')](_0x119941[_0xdc57('0x15')][_0x1dec86['id']])){_0x119941[_0xdc57('0x15')][_0x1dec86['id']]=new Trigger(_0x1dec86);}else{_0x119941[_0xdc57('0x44')](_0x119941[_0xdc57('0x15')][_0x1dec86['id']],_0x1dec86);}}}return _0x119941[_0xdc57('0x15')];};};Realtime['prototype'][_0xdc57('0x48')]=function(){var _0x52aaba=this;return function(_0x26c1a3){if(_0x26c1a3){freeIsNotKey(_0x26c1a3,_0x52aaba[_0xdc57('0x49')],'id');for(var _0x3dcbc1=0x0,_0x5c04a2={},_0x361307={};_0x3dcbc1<_0x26c1a3[_0xdc57('0x41')];_0x3dcbc1+=0x1){_0x5c04a2=_0x26c1a3[_0x3dcbc1];if(_[_0xdc57('0x42')](_0x52aaba[_0xdc57('0x49')][_0x5c04a2['id']])){_0x52aaba[_0xdc57('0x49')][_0x5c04a2['id']]=new Template(_0x5c04a2);}else{_0x52aaba[_0xdc57('0x44')](_0x52aaba[_0xdc57('0x49')][_0x5c04a2['id']],_0x5c04a2);}}}return _0x52aaba[_0xdc57('0x49')];};};Realtime[_0xdc57('0x40')][_0xdc57('0x4a')]=function(){var _0x88371e=this;return function(_0x1250af){if(_0x1250af){freeIsNotKey(_0x1250af,_0x88371e['zendeskAccounts'],'id');for(var _0x5e0dac=0x0,_0x2e59ab={},_0x3fe62e={};_0x5e0dac<_0x1250af['length'];_0x5e0dac+=0x1){_0x2e59ab=_0x1250af[_0x5e0dac];if(_[_0xdc57('0x42')](_0x88371e[_0xdc57('0x4b')][_0x2e59ab['id']])){_0x88371e[_0xdc57('0x4b')][_0x2e59ab['id']]=new ZendeskAccount(_0x2e59ab);}else{_0x88371e['mergeFromDatabase'](_0x88371e[_0xdc57('0x4b')][_0x2e59ab['id']],_0x2e59ab);}}}return _0x88371e['zendeskAccounts'];};};Realtime[_0xdc57('0x40')][_0xdc57('0x4c')]=function(){var _0x12eef3=this;return function(_0x25fbe4){if(_0x25fbe4){freeIsNotKey(_0x25fbe4,_0x12eef3[_0xdc57('0x1e')],'id');for(var _0x4ba7fd=0x0,_0x365646={},_0x1f3835={};_0x4ba7fd<_0x25fbe4[_0xdc57('0x41')];_0x4ba7fd+=0x1){_0x365646=_0x25fbe4[_0x4ba7fd];if(_[_0xdc57('0x42')](_0x12eef3['salesforceAccounts'][_0x365646['id']])){_0x12eef3[_0xdc57('0x1e')][_0x365646['id']]=new SalesforceAccount(_0x365646);}else{_0x12eef3[_0xdc57('0x44')](_0x12eef3[_0xdc57('0x1e')][_0x365646['id']],_0x365646);}}}return _0x12eef3[_0xdc57('0x1e')];};};Realtime[_0xdc57('0x40')][_0xdc57('0x4d')]=function(){var _0x285656=this;return function(_0x1abd15){if(_0x1abd15){freeIsNotKey(_0x1abd15,_0x285656[_0xdc57('0x20')],'id');for(var _0x1effe4=0x0,_0x56dc83={},_0x4095d4={};_0x1effe4<_0x1abd15[_0xdc57('0x41')];_0x1effe4+=0x1){_0x56dc83=_0x1abd15[_0x1effe4];if(_[_0xdc57('0x42')](_0x285656[_0xdc57('0x20')][_0x56dc83['id']])){_0x285656[_0xdc57('0x20')][_0x56dc83['id']]=new FreshdeskAccount(_0x56dc83);}else{_0x285656['mergeFromDatabase'](_0x285656['freshdeskAccounts'][_0x56dc83['id']],_0x56dc83);}}}return _0x285656[_0xdc57('0x20')];};};Realtime['prototype'][_0xdc57('0x4e')]=function(){var _0x27809f=this;return function(_0x33ea78){if(_0x33ea78){freeIsNotKey(_0x33ea78,_0x27809f[_0xdc57('0x4f')],'id');for(var _0x2758cc=0x0,_0xd7a906={},_0x27c731={};_0x2758cc<_0x33ea78[_0xdc57('0x41')];_0x2758cc+=0x1){_0xd7a906=_0x33ea78[_0x2758cc];if(_['isUndefined'](_0x27809f['zohoAccounts'][_0xd7a906['id']])){_0x27809f[_0xdc57('0x4f')][_0xd7a906['id']]=new ZohoAccount(_0xd7a906);}else{_0x27809f[_0xdc57('0x44')](_0x27809f[_0xdc57('0x4f')][_0xd7a906['id']],_0xd7a906);}}}return _0x27809f['zohoAccounts'];};};Realtime['prototype']['initDeskAccounts']=function(){var _0x426f1e=this;return function(_0x48c227){if(_0x48c227){freeIsNotKey(_0x48c227,_0x426f1e[_0xdc57('0x50')],'id');for(var _0x838789=0x0,_0x32c5ab={},_0x38ef83={};_0x838789<_0x48c227[_0xdc57('0x41')];_0x838789+=0x1){_0x32c5ab=_0x48c227[_0x838789];if(_[_0xdc57('0x42')](_0x426f1e[_0xdc57('0x50')][_0x32c5ab['id']])){_0x426f1e[_0xdc57('0x50')][_0x32c5ab['id']]=new DeskAccount(_0x32c5ab);}else{_0x426f1e[_0xdc57('0x44')](_0x426f1e['deskAccounts'][_0x32c5ab['id']],_0x32c5ab);}}}return _0x426f1e['deskAccounts'];};};Realtime[_0xdc57('0x40')][_0xdc57('0x51')]=function(){var _0x28300d=this;return function(_0x147113){if(_0x147113){freeIsNotKey(_0x147113,_0x28300d[_0xdc57('0x1f')],'id');for(var _0x34e5d7=0x0,_0x74b948={},_0x15926e={};_0x34e5d7<_0x147113[_0xdc57('0x41')];_0x34e5d7+=0x1){_0x74b948=_0x147113[_0x34e5d7];if(_[_0xdc57('0x42')](_0x28300d[_0xdc57('0x1f')][_0x74b948['id']])){_0x28300d[_0xdc57('0x1f')][_0x74b948['id']]=new SugarcrmAccount(_0x74b948);}else{_0x28300d[_0xdc57('0x44')](_0x28300d[_0xdc57('0x1f')][_0x74b948['id']],_0x74b948);}}}return _0x28300d[_0xdc57('0x1f')];};};Realtime[_0xdc57('0x40')]['initVtigerAccounts']=function(){var _0x249f17=this;return function(_0x534035){if(_0x534035){freeIsNotKey(_0x534035,_0x249f17[_0xdc57('0x21')],'id');for(var _0x31a4a4=0x0,_0x3d59de={},_0x48e691={};_0x31a4a4<_0x534035['length'];_0x31a4a4+=0x1){_0x3d59de=_0x534035[_0x31a4a4];if(_['isUndefined'](_0x249f17['vtigerAccounts'][_0x3d59de['id']])){_0x249f17[_0xdc57('0x21')][_0x3d59de['id']]=new VtigerAccount(_0x3d59de);}else{_0x249f17[_0xdc57('0x44')](_0x249f17['vtigerAccounts'][_0x3d59de['id']],_0x3d59de);}}}return _0x249f17[_0xdc57('0x21')];};};Realtime[_0xdc57('0x40')][_0xdc57('0x52')]=function(){var _0x53a758=this;return function(_0xacc941){if(_0xacc941){freeIsNotKey(_0xacc941,_0x53a758['servicenowAccounts'],'id');for(var _0x3802d8=0x0,_0x5c1f36={},_0x2ce71a={};_0x3802d8<_0xacc941[_0xdc57('0x41')];_0x3802d8+=0x1){_0x5c1f36=_0xacc941[_0x3802d8];if(_[_0xdc57('0x42')](_0x53a758[_0xdc57('0x22')][_0x5c1f36['id']])){_0x53a758['servicenowAccounts'][_0x5c1f36['id']]=new ServicenowAccount(_0x5c1f36);}else{_0x53a758['mergeFromDatabase'](_0x53a758[_0xdc57('0x22')][_0x5c1f36['id']],_0x5c1f36);}}}return _0x53a758[_0xdc57('0x22')];};};Realtime['prototype'][_0xdc57('0x53')]=function(){var _0x3ea4ec=this;return function(_0x193bf2){if(_0x193bf2){freeIsNotKey(_0x193bf2,_0x3ea4ec[_0xdc57('0x23')],'id');for(var _0x1bf43e=0x0,_0x23b68a={},_0xd3c994={};_0x1bf43e<_0x193bf2['length'];_0x1bf43e+=0x1){_0x23b68a=_0x193bf2[_0x1bf43e];if(_['isUndefined'](_0x3ea4ec[_0xdc57('0x23')][_0x23b68a['id']])){_0x3ea4ec['dynamics365Accounts'][_0x23b68a['id']]=new Dynamics365Account(_0x23b68a);}else{_0x3ea4ec['mergeFromDatabase'](_0x3ea4ec[_0xdc57('0x23')][_0x23b68a['id']],_0x23b68a);}}}return _0x3ea4ec['dynamics365Accounts'];};};Realtime[_0xdc57('0x40')][_0xdc57('0x54')]=function(){var _0x327121=this;return function(_0x2224af){if(_0x2224af){freeIsNotKey(_0x2224af,_0x327121[_0xdc57('0x55')],'id');for(var _0x32a539=0x0,_0x2968f8={},_0x455e94={};_0x32a539<_0x2224af['length'];_0x32a539+=0x1){_0x2968f8=_0x2224af[_0x32a539];if(_['isUndefined'](_0x327121[_0xdc57('0x55')][_0x2968f8['id']])){_0x327121[_0xdc57('0x55')][_0x2968f8['id']]=new FreshsalesAccount(_0x2968f8);}else{_0x327121['mergeFromDatabase'](_0x327121[_0xdc57('0x55')][_0x2968f8['id']],_0x2968f8);}}}return _0x327121[_0xdc57('0x55')];};};Realtime[_0xdc57('0x40')][_0xdc57('0x56')]=function(){var _0x229307=this;return function(_0x53b73b){for(var _0x52d055=0x0;_0x52d055<_0x53b73b['length'];_0x52d055+=0x1){_[_0xdc57('0x57')](_0x229307[_0xdc57('0x14')][_0x53b73b[_0x52d055][_0xdc57('0x29')]],_0x53b73b[_0x52d055]);}return _0x229307['voiceQueues'];};};Realtime['prototype']['initVoiceQueueReports']=function(){var _0x388fb9=this;return function(_0x2ab914){clearVoiceQueues(_0x388fb9['voiceQueues']);if(_0x2ab914){_0x2ab914=_[_0xdc57('0x58')](_0x2ab914,_0xdc57('0x59'));for(var _0x2494bb in _0x2ab914){if(_0x2ab914[_0xdc57('0x26')](_0x2494bb)){var _0x2a09d0={};for(var _0x16040a=0x0;_0x16040a<_0x2ab914[_0x2494bb][_0xdc57('0x41')];_0x16040a+=0x1){var _0x2a1daf=_0x2ab914[_0x2494bb][_0x16040a][_0xdc57('0x5a')];if(_0x388fb9[_0xdc57('0x14')][_0x2a1daf]){if(_0x2ab914[_0x2494bb][_0x16040a][_0xdc57('0x5b')]){_0x388fb9[_0xdc57('0x14')][_0x2a1daf]['unmanaged']+=0x1;}if(_0x2ab914[_0x2494bb][_0x16040a][_0xdc57('0x5c')]){_0x388fb9[_0xdc57('0x14')][_0x2a1daf][_0xdc57('0x33')]+=0x1;}_0x388fb9[_0xdc57('0x14')][_0x2a1daf][_0xdc57('0x2e')]+=moment(_0x2ab914[_0x2494bb][_0x16040a][_0xdc57('0x5d')])[_0xdc57('0x5e')](moment(_0x2ab914[_0x2494bb][_0x16040a][_0xdc57('0x5f')]),_0xdc57('0x60'))||0x0;if(_0x16040a===_0x2ab914[_0x2494bb][_0xdc57('0x41')]-0x1){_0x388fb9[_0xdc57('0x14')][_0x2a1daf]['sumDuration']+=moment(_0x2ab914[_0x2494bb][_0x16040a][_0xdc57('0x61')]||_0x2ab914[_0x2494bb][_0x16040a][_0xdc57('0x62')]||_0x2ab914[_0x2494bb][_0x16040a]['queuecallerexitAt'])['diff'](moment(_0x2ab914[_0x2494bb][_0x16040a][_0xdc57('0x5f')]),_0xdc57('0x60'))||0x0;_0x388fb9[_0xdc57('0x14')][_0x2a1daf][_0xdc57('0x2c')]+=0x1;if(_0x2ab914[_0x2494bb][_0x16040a][_0xdc57('0x63')]){_0x388fb9[_0xdc57('0x14')][_0x2a1daf][_0xdc57('0x2d')]+=0x1;_0x388fb9[_0xdc57('0x14')][_0x2a1daf][_0xdc57('0x2f')]+=moment(_0x2ab914[_0x2494bb][_0x16040a][_0xdc57('0x61')])[_0xdc57('0x5e')](moment(_0x2ab914[_0x2494bb][_0x16040a][_0xdc57('0x5d')]),_0xdc57('0x60'))||0x0;}}else{_0x388fb9[_0xdc57('0x14')][_0x2a1daf][_0xdc57('0x34')]+=_0x388fb9['voiceQueues'][_0x2a1daf][_0xdc57('0x2e')]||0x0;}}}}}}return _0x388fb9[_0xdc57('0x14')];};};Realtime[_0xdc57('0x40')][_0xdc57('0x64')]=function(){var _0x1d974f=this;return function(_0x410527){clearVoiceCallReports(_0x1d974f[_0xdc57('0x17')]);if(_0x410527){for(var _0x184b1b=0x0;_0x184b1b<_0x410527[_0xdc57('0x41')];_0x184b1b+=0x1){_0x1d974f[_0xdc57('0x17')][_0xdc57('0x2c')]+=0x1;_0x1d974f[_0xdc57('0x17')][_0xdc57('0x34')]+=_0x410527[_0x184b1b][_0xdc57('0x65')];if(_0x410527[_0x184b1b][_0xdc57('0x66')]===_0xdc57('0x67')){_0x1d974f['outbound'][_0xdc57('0x2d')]+=0x1;_0x1d974f[_0xdc57('0x17')][_0xdc57('0x2e')]+=_0x410527[_0x184b1b][_0xdc57('0x65')]-_0x410527[_0x184b1b]['billableseconds']||0x0;_0x1d974f[_0xdc57('0x17')][_0xdc57('0x2f')]+=_0x410527[_0x184b1b]['billableseconds'];}}}return _0x1d974f['outbound'];};};Realtime['prototype'][_0xdc57('0x68')]=function(){var _0x91d22d=this;return function(_0x2e8eed){if(_0x2e8eed){freeIsNotKey(_0x2e8eed,_0x91d22d['campaigns'],'name');for(var _0x2b8754=0x0,_0x24931d={};_0x2b8754<_0x2e8eed[_0xdc57('0x41')];_0x2b8754+=0x1){_0x24931d=_0x2e8eed[_0x2b8754];if(_['isUndefined'](_0x91d22d[_0xdc57('0x16')][_0x24931d['name']])){_0x91d22d[_0xdc57('0x16')][_0x24931d[_0xdc57('0x29')]]=new Campaign(_0x24931d);}else{_0x91d22d[_0xdc57('0x44')](_0x91d22d[_0xdc57('0x16')][_0x24931d[_0xdc57('0x29')]],_0x24931d);_0x91d22d[_0xdc57('0x16')][_0x24931d[_0xdc57('0x29')]][_0xdc57('0x69')]=_0x24931d[_0xdc57('0x6a')]?_0x24931d[_0xdc57('0x6a')][_0xdc57('0x29')]:undefined;}}}return _0x91d22d[_0xdc57('0x16')];};};Realtime[_0xdc57('0x40')]['initVoiceExtensions']=function(){var _0x1e9ad1=this;return function(_0x18ca0b){if(_0x18ca0b){freeIsNotKey(_0x18ca0b,_0x1e9ad1[_0xdc57('0x18')],'id');for(var _0x3e88cb=0x0,_0x8e76cc={};_0x3e88cb<_0x18ca0b[_0xdc57('0x41')];_0x3e88cb+=0x1){_0x8e76cc=_0x18ca0b[_0x3e88cb];if(_[_0xdc57('0x42')](_0x1e9ad1[_0xdc57('0x18')][_0x8e76cc['id']])){_0x1e9ad1[_0xdc57('0x18')][_0x8e76cc['id']]=new VoiceExtension(_0x8e76cc);}else{_0x1e9ad1['mergeFromDatabase'](_0x1e9ad1[_0xdc57('0x18')][_0x8e76cc['id']],_0x8e76cc);}}}return _0x1e9ad1[_0xdc57('0x18')];};};Realtime[_0xdc57('0x40')][_0xdc57('0x6b')]=function(){var _0x56fe8e=this;return function(_0x1e2c34){clearCampaigns(_0x56fe8e[_0xdc57('0x16')]);for(var _0x4428a7=0x0;_0x4428a7<_0x1e2c34['length'];_0x4428a7+=0x1){_[_0xdc57('0x57')](_0x56fe8e[_0xdc57('0x16')][_0x1e2c34[_0x4428a7][_0xdc57('0x29')]],_0x1e2c34[_0x4428a7]);}return _0x56fe8e[_0xdc57('0x16')];};};Realtime[_0xdc57('0x40')][_0xdc57('0x6c')]=function(){var _0x2b2c47=this;return function(_0x5a9bb5){if(_0x5a9bb5){freeIsNotKey(_0x5a9bb5,_0x2b2c47[_0xdc57('0x24')],'id');for(var _0xeaee2b=0x0,_0x383478={},_0x10992d={};_0xeaee2b<_0x5a9bb5[_0xdc57('0x41')];_0xeaee2b+=0x1){_0x383478=_0x5a9bb5[_0xeaee2b];if(_[_0xdc57('0x42')](_0x2b2c47[_0xdc57('0x24')][_0x383478['id']])){_0x2b2c47[_0xdc57('0x24')][_0x383478['id']]=new FaxAccount(_0x383478);}else{_0x2b2c47[_0xdc57('0x44')](_0x2b2c47[_0xdc57('0x24')][_0x383478['id']],_0x383478);}}}return _0x2b2c47['faxAccounts'];};};module[_0xdc57('0x6d')]=Realtime; \ No newline at end of file +var _0x81bc=['initVoiceQueueReports','groupBy','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallerabandonAt','queuecallerexitAt','queuecallercompleteAt','initVoiceCallReports','duration','disposition','billableseconds','initCampaigns','SquareProject','initVoiceExtensions','initCampaignHopperHistory','exports','bluebird','util','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/salesforceAccount','../model/deskAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','telephones','trunks','voiceQueues','triggers','campaigns','templates','outbound','voiceExtensions','channels','queueChannels','timers','settings','zendeskAccounts','zohoAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','abandoned','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','agents','length','isUndefined','initTelephones','initTrunks','initVoiceQueues','initTriggers','initTemplates','salesforceAccounts','freshdeskAccounts','initZohoAccounts','initDeskAccounts','deskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts','dynamics365Accounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge'];(function(_0x2c28e9,_0x2257f1){var _0x3ada94=function(_0x56d210){while(--_0x56d210){_0x2c28e9['push'](_0x2c28e9['shift']());}};_0x3ada94(++_0x2257f1);}(_0x81bc,0x82));var _0xc81b=function(_0x45556d,_0x25e55d){_0x45556d=_0x45556d-0x0;var _0x6a3aa3=_0x81bc[_0x45556d];return _0x6a3aa3;};'use strict';var BPromise=require(_0xc81b('0x0'));var util=require(_0xc81b('0x1'));var _=require(_0xc81b('0x2'));var moment=require(_0xc81b('0x3'));var Agent=require(_0xc81b('0x4'));var Telephone=require(_0xc81b('0x5'));var Trunk=require(_0xc81b('0x6'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0xc81b('0x7'));var Template=require(_0xc81b('0x8'));var Campaign=require(_0xc81b('0x9'));var VoiceExtension=require(_0xc81b('0xa'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0xc81b('0xb'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xc81b('0xc'));var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require(_0xc81b('0xd'));var Dynamics365Account=require(_0xc81b('0xe'));var FreshsalesAccount=require(_0xc81b('0xf'));var FaxAccount=require(_0xc81b('0x10'));var Realtime=function(){this['agents']={};this[_0xc81b('0x11')]={};this[_0xc81b('0x12')]={};this[_0xc81b('0x13')]={};this[_0xc81b('0x14')]={};this[_0xc81b('0x15')]={};this[_0xc81b('0x16')]={};this[_0xc81b('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xc81b('0x18')]={};this[_0xc81b('0x19')]={};this[_0xc81b('0x1a')]={};this['outboundChannels']={};this[_0xc81b('0x1b')]={};this[_0xc81b('0x1c')]={};this[_0xc81b('0x1d')]={};this['salesforceAccounts']={};this['sugarcrmAccounts']={};this['freshdeskAccounts']={};this[_0xc81b('0x1e')]={};this['deskAccounts']={};this['vtigerAccounts']={};this['servicenowAccounts']={};this['dynamics365Accounts']={};this['freshsalesAccounts']={};this[_0xc81b('0x1f')]={};};function freeIsNotKey(_0x496333,_0x238a9f,_0x3258b4){var _0x48e822=_[_0xc81b('0x20')](_0x496333,function(_0x5c0595,_0x4a7d0d){return _0x5c0595[_0x3258b4];});for(var _0x353bd2 in _0x238a9f){if(_0x238a9f[_0xc81b('0x21')](_0x353bd2)){if(!_0x48e822[_0x353bd2]){delete _0x238a9f[_0x353bd2];}}}}function freeIsNotKeySip(_0x1ee228,_0x5090c9){var _0x15e9fe=_[_0xc81b('0x20')](_0x1ee228,function(_0x2faae8,_0x220812){return util[_0xc81b('0x22')](_0xc81b('0x23'),_0x2faae8[_0xc81b('0x24')]);});for(var _0x527bd7 in _0x5090c9){if(_0x5090c9[_0xc81b('0x21')](_0x527bd7)){if(!_0x15e9fe[_0x527bd7]){delete _0x5090c9[_0x527bd7];}}}}function freeIsNotKeyAgent(_0x1d3c49,_0x23d573){var _0x4a0c59=_['mapKeys'](_0x1d3c49,function(_0x4e9340,_0x253413){var _0x1c8ad5=_[_0xc81b('0x25')](_0x4e9340['interface'])?util[_0xc81b('0x22')]('SIP/%s',_0x4e9340[_0xc81b('0x24')]):_0x4e9340[_0xc81b('0x26')];return _0x1c8ad5;});for(var _0x2945b2 in _0x23d573){if(_0x23d573['hasOwnProperty'](_0x2945b2)){if(!_0x4a0c59[_0x2945b2]){delete _0x23d573[_0x2945b2];}}}}function clearVoiceCallReports(_0xbd7eb8){_0xbd7eb8[_0xc81b('0x27')]=0x0;_0xbd7eb8[_0xc81b('0x28')]=0x0;_0xbd7eb8[_0xc81b('0x29')]=0x0;_0xbd7eb8[_0xc81b('0x2a')]=0x0;_0xbd7eb8[_0xc81b('0x2b')]=0x0;}function clearCampaigns(_0x4a9afa){if(!_[_0xc81b('0x2c')](_0x4a9afa)){for(var _0xfd93c4 in _0x4a9afa){if(_0x4a9afa[_0xc81b('0x21')](_0xfd93c4)){_0x4a9afa[_0xfd93c4][_0xc81b('0x2d')]=0x0;_0x4a9afa[_0xfd93c4][_0xc81b('0x2e')]=0x0;}}}}function clearVoiceQueues(_0x5785f5){if(!_[_0xc81b('0x2c')](_0x5785f5)){for(var _0x326469 in _0x5785f5){if(_0x5785f5[_0xc81b('0x21')](_0x326469)){_0x5785f5[_0x326469][_0xc81b('0x27')]=0x0;_0x5785f5[_0x326469][_0xc81b('0x28')]=0x0;_0x5785f5[_0x326469][_0xc81b('0x2f')]=0x0;_0x5785f5[_0x326469][_0xc81b('0x30')]=0x0;_0x5785f5[_0x326469][_0xc81b('0x29')]=0x0;_0x5785f5[_0x326469][_0xc81b('0x2a')]=0x0;_0x5785f5[_0x326469]['sumBillable']=0x0;_0x5785f5[_0x326469]['outboundAnswerAgiCallsDay']=0x0;_0x5785f5[_0x326469][_0xc81b('0x31')]=0x0;_0x5785f5[_0x326469][_0xc81b('0x32')]=0x0;_0x5785f5[_0x326469]['outboundCongestionCallsDay']=0x0;_0x5785f5[_0x326469][_0xc81b('0x33')]=0x0;_0x5785f5[_0x326469][_0xc81b('0x34')]=0x0;_0x5785f5[_0x326469][_0xc81b('0x35')]=0x0;_0x5785f5[_0x326469]['outboundDropCallsDayCallersExit']=0x0;_0x5785f5[_0x326469][_0xc81b('0x36')]=0x0;_0x5785f5[_0x326469][_0xc81b('0x37')]=0x0;_0x5785f5[_0x326469][_0xc81b('0x38')]=0x0;_0x5785f5[_0x326469]['outboundReCallsDay']=0x0;_0x5785f5[_0x326469][_0xc81b('0x39')]=0x0;_0x5785f5[_0x326469][_0xc81b('0x3a')]=0x0;_0x5785f5[_0x326469][_0xc81b('0x3b')]=!![];}}}}Realtime[_0xc81b('0x3c')][_0xc81b('0x3d')]=function(_0x2c57d2,_0x4014e8){for(var _0x3fb3c9 in _0x4014e8){if(_0x2c57d2['hasOwnProperty'](_0x3fb3c9)){_0x2c57d2[_0x3fb3c9]=_0x4014e8[_0x3fb3c9];}}};Realtime[_0xc81b('0x3c')][_0xc81b('0x3e')]=function(){var _0x1efb01=this;return function(_0x3823ca){if(_0x3823ca){freeIsNotKeyAgent(_0x3823ca,_0x1efb01[_0xc81b('0x3f')]);for(var _0x17179a=0x0,_0x3f4d59={},_0x5af0fa={};_0x17179a<_0x3823ca[_0xc81b('0x40')];_0x17179a+=0x1){_0x3f4d59=_0x3823ca[_0x17179a];var _0x29b8e1=_[_0xc81b('0x25')](_0x3f4d59[_0xc81b('0x26')])?util[_0xc81b('0x22')](_0xc81b('0x23'),_0x3f4d59[_0xc81b('0x24')]):_0x3f4d59['interface'];if(_[_0xc81b('0x41')](_0x1efb01['agents'][_0x29b8e1])){_0x1efb01[_0xc81b('0x3f')][_0x29b8e1]=new Agent(_0x3f4d59);}else{_0x1efb01[_0xc81b('0x3d')](_0x1efb01['agents'][_0x29b8e1],_0x3f4d59);}}}return _0x1efb01[_0xc81b('0x3f')];};};Realtime[_0xc81b('0x3c')][_0xc81b('0x42')]=function(){var _0x43828e=this;return function(_0x4ac46d){if(_0x4ac46d){freeIsNotKeySip(_0x4ac46d,_0x43828e[_0xc81b('0x11')]);for(var _0x5195d2=0x0,_0x34708a={},_0x5b3bc3={};_0x5195d2<_0x4ac46d[_0xc81b('0x40')];_0x5195d2+=0x1){_0x34708a=_0x4ac46d[_0x5195d2];if(_['isUndefined'](_0x43828e[_0xc81b('0x11')][util[_0xc81b('0x22')]('SIP/%s',_0x34708a['name'])])){_0x43828e[_0xc81b('0x11')][util['format'](_0xc81b('0x23'),_0x34708a[_0xc81b('0x24')])]=new Telephone(_0x34708a);}else{_0x43828e['mergeFromDatabase'](_0x43828e['telephones'][util[_0xc81b('0x22')](_0xc81b('0x23'),_0x34708a[_0xc81b('0x24')])],_0x34708a);}}}return _0x43828e['telephones'];};};Realtime[_0xc81b('0x3c')][_0xc81b('0x43')]=function(){var _0x2c216d=this;return function(_0x778e38){if(_0x778e38){freeIsNotKeySip(_0x778e38,_0x2c216d[_0xc81b('0x12')]);for(var _0x47f7ea=0x0,_0x4148e3={},_0xb56ac1={};_0x47f7ea<_0x778e38['length'];_0x47f7ea+=0x1){_0x4148e3=_0x778e38[_0x47f7ea];if(_[_0xc81b('0x41')](_0x2c216d[_0xc81b('0x12')][util[_0xc81b('0x22')](_0xc81b('0x23'),_0x4148e3[_0xc81b('0x24')])])){_0x2c216d['trunks'][util[_0xc81b('0x22')](_0xc81b('0x23'),_0x4148e3[_0xc81b('0x24')])]=new Trunk(_0x4148e3);}else{_0x2c216d[_0xc81b('0x3d')](_0x2c216d[_0xc81b('0x12')][util[_0xc81b('0x22')]('SIP/%s',_0x4148e3[_0xc81b('0x24')])],_0x4148e3);}}}return _0x2c216d[_0xc81b('0x12')];};};Realtime[_0xc81b('0x3c')][_0xc81b('0x44')]=function(){var _0x422e43=this;return function(_0x42683a){if(_0x42683a){freeIsNotKey(_0x42683a,_0x422e43['voiceQueues'],_0xc81b('0x24'));for(var _0x19d128=0x0,_0x300593={},_0x5770e1={};_0x19d128<_0x42683a[_0xc81b('0x40')];_0x19d128+=0x1){_0x300593=_0x42683a[_0x19d128];if(_['isUndefined'](_0x422e43[_0xc81b('0x13')][_0x300593[_0xc81b('0x24')]])){_0x422e43['voiceQueues'][_0x300593[_0xc81b('0x24')]]=new VoiceQueue(_0x300593);}else{_0x422e43[_0xc81b('0x3d')](_0x422e43[_0xc81b('0x13')][_0x300593[_0xc81b('0x24')]],_0x300593);}}}return _0x422e43[_0xc81b('0x13')];};};Realtime[_0xc81b('0x3c')][_0xc81b('0x45')]=function(){var _0x1679ed=this;return function(_0x5dfc0f){if(_0x5dfc0f){freeIsNotKey(_0x5dfc0f,_0x1679ed[_0xc81b('0x14')],'id');for(var _0x530d5c=0x0,_0x57e9a2={},_0x27607a={};_0x530d5c<_0x5dfc0f[_0xc81b('0x40')];_0x530d5c+=0x1){_0x57e9a2=_0x5dfc0f[_0x530d5c];if(_[_0xc81b('0x41')](_0x1679ed[_0xc81b('0x14')][_0x57e9a2['id']])){_0x1679ed[_0xc81b('0x14')][_0x57e9a2['id']]=new Trigger(_0x57e9a2);}else{_0x1679ed[_0xc81b('0x3d')](_0x1679ed[_0xc81b('0x14')][_0x57e9a2['id']],_0x57e9a2);}}}return _0x1679ed[_0xc81b('0x14')];};};Realtime[_0xc81b('0x3c')][_0xc81b('0x46')]=function(){var _0x4c0f64=this;return function(_0x2933ab){if(_0x2933ab){freeIsNotKey(_0x2933ab,_0x4c0f64[_0xc81b('0x16')],'id');for(var _0xe18279=0x0,_0x4b5f87={},_0x54a2b0={};_0xe18279<_0x2933ab[_0xc81b('0x40')];_0xe18279+=0x1){_0x4b5f87=_0x2933ab[_0xe18279];if(_[_0xc81b('0x41')](_0x4c0f64[_0xc81b('0x16')][_0x4b5f87['id']])){_0x4c0f64[_0xc81b('0x16')][_0x4b5f87['id']]=new Template(_0x4b5f87);}else{_0x4c0f64[_0xc81b('0x3d')](_0x4c0f64[_0xc81b('0x16')][_0x4b5f87['id']],_0x4b5f87);}}}return _0x4c0f64[_0xc81b('0x16')];};};Realtime[_0xc81b('0x3c')]['initZendeskAccounts']=function(){var _0x29f87d=this;return function(_0x460e45){if(_0x460e45){freeIsNotKey(_0x460e45,_0x29f87d[_0xc81b('0x1d')],'id');for(var _0x4a66b7=0x0,_0x32df48={},_0x5f14f1={};_0x4a66b7<_0x460e45[_0xc81b('0x40')];_0x4a66b7+=0x1){_0x32df48=_0x460e45[_0x4a66b7];if(_[_0xc81b('0x41')](_0x29f87d[_0xc81b('0x1d')][_0x32df48['id']])){_0x29f87d[_0xc81b('0x1d')][_0x32df48['id']]=new ZendeskAccount(_0x32df48);}else{_0x29f87d[_0xc81b('0x3d')](_0x29f87d[_0xc81b('0x1d')][_0x32df48['id']],_0x32df48);}}}return _0x29f87d[_0xc81b('0x1d')];};};Realtime[_0xc81b('0x3c')]['initSalesforceAccounts']=function(){var _0x4558f0=this;return function(_0x122830){if(_0x122830){freeIsNotKey(_0x122830,_0x4558f0[_0xc81b('0x47')],'id');for(var _0x1fd4e0=0x0,_0x5d283c={},_0x2b2a94={};_0x1fd4e0<_0x122830[_0xc81b('0x40')];_0x1fd4e0+=0x1){_0x5d283c=_0x122830[_0x1fd4e0];if(_[_0xc81b('0x41')](_0x4558f0[_0xc81b('0x47')][_0x5d283c['id']])){_0x4558f0[_0xc81b('0x47')][_0x5d283c['id']]=new SalesforceAccount(_0x5d283c);}else{_0x4558f0[_0xc81b('0x3d')](_0x4558f0[_0xc81b('0x47')][_0x5d283c['id']],_0x5d283c);}}}return _0x4558f0[_0xc81b('0x47')];};};Realtime['prototype']['initFreshdeskAccounts']=function(){var _0x14dd20=this;return function(_0x48e625){if(_0x48e625){freeIsNotKey(_0x48e625,_0x14dd20[_0xc81b('0x48')],'id');for(var _0x3d0462=0x0,_0x138236={},_0x39abe1={};_0x3d0462<_0x48e625['length'];_0x3d0462+=0x1){_0x138236=_0x48e625[_0x3d0462];if(_['isUndefined'](_0x14dd20[_0xc81b('0x48')][_0x138236['id']])){_0x14dd20[_0xc81b('0x48')][_0x138236['id']]=new FreshdeskAccount(_0x138236);}else{_0x14dd20[_0xc81b('0x3d')](_0x14dd20[_0xc81b('0x48')][_0x138236['id']],_0x138236);}}}return _0x14dd20[_0xc81b('0x48')];};};Realtime[_0xc81b('0x3c')][_0xc81b('0x49')]=function(){var _0xc20ef=this;return function(_0x514e06){if(_0x514e06){freeIsNotKey(_0x514e06,_0xc20ef[_0xc81b('0x1e')],'id');for(var _0x43b2e8=0x0,_0xda0fa4={},_0x241377={};_0x43b2e8<_0x514e06[_0xc81b('0x40')];_0x43b2e8+=0x1){_0xda0fa4=_0x514e06[_0x43b2e8];if(_[_0xc81b('0x41')](_0xc20ef[_0xc81b('0x1e')][_0xda0fa4['id']])){_0xc20ef[_0xc81b('0x1e')][_0xda0fa4['id']]=new ZohoAccount(_0xda0fa4);}else{_0xc20ef[_0xc81b('0x3d')](_0xc20ef[_0xc81b('0x1e')][_0xda0fa4['id']],_0xda0fa4);}}}return _0xc20ef[_0xc81b('0x1e')];};};Realtime[_0xc81b('0x3c')][_0xc81b('0x4a')]=function(){var _0xbf839a=this;return function(_0x5778ab){if(_0x5778ab){freeIsNotKey(_0x5778ab,_0xbf839a[_0xc81b('0x4b')],'id');for(var _0x4c4634=0x0,_0x20eb3b={},_0x2121d8={};_0x4c4634<_0x5778ab[_0xc81b('0x40')];_0x4c4634+=0x1){_0x20eb3b=_0x5778ab[_0x4c4634];if(_['isUndefined'](_0xbf839a[_0xc81b('0x4b')][_0x20eb3b['id']])){_0xbf839a[_0xc81b('0x4b')][_0x20eb3b['id']]=new DeskAccount(_0x20eb3b);}else{_0xbf839a[_0xc81b('0x3d')](_0xbf839a[_0xc81b('0x4b')][_0x20eb3b['id']],_0x20eb3b);}}}return _0xbf839a[_0xc81b('0x4b')];};};Realtime[_0xc81b('0x3c')][_0xc81b('0x4c')]=function(){var _0x54419b=this;return function(_0x210784){if(_0x210784){freeIsNotKey(_0x210784,_0x54419b[_0xc81b('0x4d')],'id');for(var _0x18218c=0x0,_0x39b011={},_0x3a4427={};_0x18218c<_0x210784['length'];_0x18218c+=0x1){_0x39b011=_0x210784[_0x18218c];if(_['isUndefined'](_0x54419b[_0xc81b('0x4d')][_0x39b011['id']])){_0x54419b[_0xc81b('0x4d')][_0x39b011['id']]=new SugarcrmAccount(_0x39b011);}else{_0x54419b[_0xc81b('0x3d')](_0x54419b[_0xc81b('0x4d')][_0x39b011['id']],_0x39b011);}}}return _0x54419b[_0xc81b('0x4d')];};};Realtime[_0xc81b('0x3c')][_0xc81b('0x4e')]=function(){var _0x3a6efe=this;return function(_0x417243){if(_0x417243){freeIsNotKey(_0x417243,_0x3a6efe[_0xc81b('0x4f')],'id');for(var _0x2b9914=0x0,_0x371cb5={},_0x589196={};_0x2b9914<_0x417243[_0xc81b('0x40')];_0x2b9914+=0x1){_0x371cb5=_0x417243[_0x2b9914];if(_[_0xc81b('0x41')](_0x3a6efe[_0xc81b('0x4f')][_0x371cb5['id']])){_0x3a6efe[_0xc81b('0x4f')][_0x371cb5['id']]=new VtigerAccount(_0x371cb5);}else{_0x3a6efe[_0xc81b('0x3d')](_0x3a6efe[_0xc81b('0x4f')][_0x371cb5['id']],_0x371cb5);}}}return _0x3a6efe[_0xc81b('0x4f')];};};Realtime[_0xc81b('0x3c')][_0xc81b('0x50')]=function(){var _0x3e98e0=this;return function(_0x3e5fe4){if(_0x3e5fe4){freeIsNotKey(_0x3e5fe4,_0x3e98e0['servicenowAccounts'],'id');for(var _0x47af6c=0x0,_0x4339fa={},_0x1f56a2={};_0x47af6c<_0x3e5fe4[_0xc81b('0x40')];_0x47af6c+=0x1){_0x4339fa=_0x3e5fe4[_0x47af6c];if(_[_0xc81b('0x41')](_0x3e98e0[_0xc81b('0x51')][_0x4339fa['id']])){_0x3e98e0[_0xc81b('0x51')][_0x4339fa['id']]=new ServicenowAccount(_0x4339fa);}else{_0x3e98e0['mergeFromDatabase'](_0x3e98e0[_0xc81b('0x51')][_0x4339fa['id']],_0x4339fa);}}}return _0x3e98e0[_0xc81b('0x51')];};};Realtime['prototype'][_0xc81b('0x52')]=function(){var _0x2f9f67=this;return function(_0x31c915){if(_0x31c915){freeIsNotKey(_0x31c915,_0x2f9f67[_0xc81b('0x53')],'id');for(var _0x3d4330=0x0,_0x5c3461={},_0x29e99d={};_0x3d4330<_0x31c915['length'];_0x3d4330+=0x1){_0x5c3461=_0x31c915[_0x3d4330];if(_[_0xc81b('0x41')](_0x2f9f67['dynamics365Accounts'][_0x5c3461['id']])){_0x2f9f67[_0xc81b('0x53')][_0x5c3461['id']]=new Dynamics365Account(_0x5c3461);}else{_0x2f9f67[_0xc81b('0x3d')](_0x2f9f67[_0xc81b('0x53')][_0x5c3461['id']],_0x5c3461);}}}return _0x2f9f67[_0xc81b('0x53')];};};Realtime[_0xc81b('0x3c')][_0xc81b('0x54')]=function(){var _0x1feb87=this;return function(_0x373912){if(_0x373912){freeIsNotKey(_0x373912,_0x1feb87[_0xc81b('0x55')],'id');for(var _0x303ef0=0x0,_0x2aa41f={},_0x3a02fd={};_0x303ef0<_0x373912[_0xc81b('0x40')];_0x303ef0+=0x1){_0x2aa41f=_0x373912[_0x303ef0];if(_['isUndefined'](_0x1feb87[_0xc81b('0x55')][_0x2aa41f['id']])){_0x1feb87[_0xc81b('0x55')][_0x2aa41f['id']]=new FreshsalesAccount(_0x2aa41f);}else{_0x1feb87['mergeFromDatabase'](_0x1feb87['freshsalesAccounts'][_0x2aa41f['id']],_0x2aa41f);}}}return _0x1feb87[_0xc81b('0x55')];};};Realtime[_0xc81b('0x3c')][_0xc81b('0x56')]=function(){var _0x6175bd=this;return function(_0x4c8fa0){for(var _0x34dd80=0x0;_0x34dd80<_0x4c8fa0[_0xc81b('0x40')];_0x34dd80+=0x1){_[_0xc81b('0x57')](_0x6175bd[_0xc81b('0x13')][_0x4c8fa0[_0x34dd80][_0xc81b('0x24')]],_0x4c8fa0[_0x34dd80]);}return _0x6175bd['voiceQueues'];};};Realtime[_0xc81b('0x3c')][_0xc81b('0x58')]=function(){var _0x16df1a=this;return function(_0x526c11){clearVoiceQueues(_0x16df1a[_0xc81b('0x13')]);if(_0x526c11){_0x526c11=_[_0xc81b('0x59')](_0x526c11,'uniqueid');for(var _0x2c5fad in _0x526c11){if(_0x526c11[_0xc81b('0x21')](_0x2c5fad)){var _0x2ec3e2={};for(var _0x3e704d=0x0;_0x3e704d<_0x526c11[_0x2c5fad][_0xc81b('0x40')];_0x3e704d+=0x1){var _0x21dac3=_0x526c11[_0x2c5fad][_0x3e704d][_0xc81b('0x5a')];if(_0x16df1a[_0xc81b('0x13')][_0x21dac3]){if(_0x526c11[_0x2c5fad][_0x3e704d][_0xc81b('0x5b')]){_0x16df1a[_0xc81b('0x13')][_0x21dac3][_0xc81b('0x2f')]+=0x1;}if(_0x526c11[_0x2c5fad][_0x3e704d][_0xc81b('0x5c')]){_0x16df1a['voiceQueues'][_0x21dac3][_0xc81b('0x30')]+=0x1;}_0x16df1a[_0xc81b('0x13')][_0x21dac3]['sumHoldTime']+=moment(_0x526c11[_0x2c5fad][_0x3e704d][_0xc81b('0x5d')])[_0xc81b('0x5e')](moment(_0x526c11[_0x2c5fad][_0x3e704d][_0xc81b('0x5f')]),_0xc81b('0x60'))||0x0;if(_0x3e704d===_0x526c11[_0x2c5fad][_0xc81b('0x40')]-0x1){_0x16df1a[_0xc81b('0x13')][_0x21dac3][_0xc81b('0x2a')]+=moment(_0x526c11[_0x2c5fad][_0x3e704d]['queuecallercompleteAt']||_0x526c11[_0x2c5fad][_0x3e704d][_0xc81b('0x61')]||_0x526c11[_0x2c5fad][_0x3e704d][_0xc81b('0x62')])[_0xc81b('0x5e')](moment(_0x526c11[_0x2c5fad][_0x3e704d][_0xc81b('0x5f')]),_0xc81b('0x60'))||0x0;_0x16df1a[_0xc81b('0x13')][_0x21dac3][_0xc81b('0x27')]+=0x1;if(_0x526c11[_0x2c5fad][_0x3e704d]['queuecallercomplete']){_0x16df1a[_0xc81b('0x13')][_0x21dac3][_0xc81b('0x28')]+=0x1;_0x16df1a[_0xc81b('0x13')][_0x21dac3]['sumBillable']+=moment(_0x526c11[_0x2c5fad][_0x3e704d][_0xc81b('0x63')])[_0xc81b('0x5e')](moment(_0x526c11[_0x2c5fad][_0x3e704d][_0xc81b('0x5d')]),_0xc81b('0x60'))||0x0;}}else{_0x16df1a['voiceQueues'][_0x21dac3]['sumDuration']+=_0x16df1a[_0xc81b('0x13')][_0x21dac3][_0xc81b('0x29')]||0x0;}}}}}}return _0x16df1a['voiceQueues'];};};Realtime['prototype'][_0xc81b('0x64')]=function(){var _0x3e906a=this;return function(_0x4033cd){clearVoiceCallReports(_0x3e906a['outbound']);if(_0x4033cd){for(var _0x54ef2c=0x0;_0x54ef2c<_0x4033cd[_0xc81b('0x40')];_0x54ef2c+=0x1){_0x3e906a[_0xc81b('0x17')][_0xc81b('0x27')]+=0x1;_0x3e906a['outbound'][_0xc81b('0x2a')]+=_0x4033cd[_0x54ef2c][_0xc81b('0x65')];if(_0x4033cd[_0x54ef2c][_0xc81b('0x66')]==='ANSWERED'){_0x3e906a[_0xc81b('0x17')][_0xc81b('0x28')]+=0x1;_0x3e906a[_0xc81b('0x17')][_0xc81b('0x29')]+=_0x4033cd[_0x54ef2c][_0xc81b('0x65')]-_0x4033cd[_0x54ef2c][_0xc81b('0x67')]||0x0;_0x3e906a[_0xc81b('0x17')]['sumBillable']+=_0x4033cd[_0x54ef2c][_0xc81b('0x67')];}}}return _0x3e906a[_0xc81b('0x17')];};};Realtime[_0xc81b('0x3c')][_0xc81b('0x68')]=function(){var _0x256642=this;return function(_0x226504){if(_0x226504){freeIsNotKey(_0x226504,_0x256642[_0xc81b('0x15')],_0xc81b('0x24'));for(var _0x2e1029=0x0,_0x1e3852={};_0x2e1029<_0x226504[_0xc81b('0x40')];_0x2e1029+=0x1){_0x1e3852=_0x226504[_0x2e1029];if(_[_0xc81b('0x41')](_0x256642['campaigns'][_0x1e3852[_0xc81b('0x24')]])){_0x256642[_0xc81b('0x15')][_0x1e3852[_0xc81b('0x24')]]=new Campaign(_0x1e3852);}else{_0x256642[_0xc81b('0x3d')](_0x256642[_0xc81b('0x15')][_0x1e3852['name']],_0x1e3852);_0x256642[_0xc81b('0x15')][_0x1e3852['name']]['dialQueueProject']=_0x1e3852[_0xc81b('0x69')]?_0x1e3852[_0xc81b('0x69')]['name']:undefined;}}}return _0x256642['campaigns'];};};Realtime[_0xc81b('0x3c')][_0xc81b('0x6a')]=function(){var _0x20ad9f=this;return function(_0x4330e7){if(_0x4330e7){freeIsNotKey(_0x4330e7,_0x20ad9f[_0xc81b('0x18')],'id');for(var _0x31db1c=0x0,_0x54c8ed={};_0x31db1c<_0x4330e7['length'];_0x31db1c+=0x1){_0x54c8ed=_0x4330e7[_0x31db1c];if(_['isUndefined'](_0x20ad9f[_0xc81b('0x18')][_0x54c8ed['id']])){_0x20ad9f['voiceExtensions'][_0x54c8ed['id']]=new VoiceExtension(_0x54c8ed);}else{_0x20ad9f['mergeFromDatabase'](_0x20ad9f['voiceExtensions'][_0x54c8ed['id']],_0x54c8ed);}}}return _0x20ad9f['voiceExtensions'];};};Realtime['prototype'][_0xc81b('0x6b')]=function(){var _0x46e252=this;return function(_0x42232f){clearCampaigns(_0x46e252[_0xc81b('0x15')]);for(var _0x3cd8f5=0x0;_0x3cd8f5<_0x42232f[_0xc81b('0x40')];_0x3cd8f5+=0x1){_[_0xc81b('0x57')](_0x46e252[_0xc81b('0x15')][_0x42232f[_0x3cd8f5][_0xc81b('0x24')]],_0x42232f[_0x3cd8f5]);}return _0x46e252[_0xc81b('0x15')];};};Realtime[_0xc81b('0x3c')]['initFaxAccounts']=function(){var _0x1b851b=this;return function(_0x5c1d7c){if(_0x5c1d7c){freeIsNotKey(_0x5c1d7c,_0x1b851b[_0xc81b('0x1f')],'id');for(var _0x3480b0=0x0,_0x29e6d0={},_0x175cdf={};_0x3480b0<_0x5c1d7c[_0xc81b('0x40')];_0x3480b0+=0x1){_0x29e6d0=_0x5c1d7c[_0x3480b0];if(_[_0xc81b('0x41')](_0x1b851b['faxAccounts'][_0x29e6d0['id']])){_0x1b851b['faxAccounts'][_0x29e6d0['id']]=new FaxAccount(_0x29e6d0);}else{_0x1b851b[_0xc81b('0x3d')](_0x1b851b[_0xc81b('0x1f')][_0x29e6d0['id']],_0x29e6d0);}}}return _0x1b851b['faxAccounts'];};};module[_0xc81b('0x6c')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 7c11c76..6cb6859 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 _0x5b04=['accountcode','isNil','find','interface','format','length','assigned','lastAssignedTo','name','SIP/%s','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','YYYY-MM-DD\x20HH:mm:ss','create','match','destination','exten','lastapplication','queue','lastdata','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','destinationchannel','channel','calleridpreview','originatecalleridnum','ANSWERED','connectedlinenum','\x22%s\x22\x20<%s>','calleridnum','transfers','linkedid','transfereelinkedid','uniqueid','monitors','monitorFilename','filename','createdAt','connectedlinename','xcally-motion-dialer','isArray','forEach','startsWith','Local','indexOf','phone','substring','lastIndexOf','membername','transfererlinkedid','exports','lodash','moment','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceQueueReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','custom:voiceCallReport','voiceCallReport','bind','voiceAgentReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x5b04,0x1e5));var _0x45b0=function(_0x220649,_0x1c6ad6){_0x220649=_0x220649-0x0;var _0x18ceab=_0x5b04[_0x220649];return _0x18ceab;};'use strict';var _=require(_0x45b0('0x0'));var moment=require(_0x45b0('0x1'));var util=require('util');var config=require(_0x45b0('0x2'));var ami=require(_0x45b0('0x3'));var RpcVoiceAgentReport=require(_0x45b0('0x4'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0x45b0('0x5'));var RpcVoiceQueueReport=require(_0x45b0('0x6'));var RpcVoiceRecording=require(_0x45b0('0x7'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0x45b0('0x8'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x45b0('0x9'));var VoiceDialReport=require(_0x45b0('0xa'));var UserReport=require(_0x45b0('0xb'));function Report(_0x48af0d){this[_0x45b0('0xc')]=_0x48af0d;this[_0x45b0('0xd')]=_0x48af0d[_0x45b0('0xd')];this[_0x45b0('0xe')]=_0x48af0d[_0x45b0('0xe')];}Report[_0x45b0('0xf')][_0x45b0('0x10')]=function(_0x5a4f6b){var _0x42e8eb=new VoiceQueueReport(this['realtime']);var _0x27b5a2=new VoiceAgentReport(this[_0x45b0('0xc')]);var _0x32866c=new VoiceDialReport(this[_0x45b0('0xc')]);var _0x3ca462=new VoiceCallReport(this['realtime']);var _0x2c8eee=new UserReport(this[_0x45b0('0xc')]);if(config['xdr']&&config[_0x45b0('0x11')][_0x45b0('0x12')]){ami['on'](_0x45b0('0x13'),this[_0x45b0('0x14')]['bind'](this));ami['on'](_0x45b0('0x15'),this[_0x45b0('0x16')][_0x45b0('0x17')](this));ami['on']('custom:voiceAgentReport',this[_0x45b0('0x18')][_0x45b0('0x17')](this));ami['on']('custom:voiceDialReport',this[_0x45b0('0x19')][_0x45b0('0x17')](this));ami['on'](_0x45b0('0x1a'),this[_0x45b0('0x1b')][_0x45b0('0x17')](this));ami['on'](_0x45b0('0x1c'),this[_0x45b0('0x1d')][_0x45b0('0x17')](this));}};Report[_0x45b0('0xf')][_0x45b0('0x1e')]=function(_0x599b27){var _0x30b5d4;_0x30b5d4=_['find'](this['agents'],function(_0x593bc8){return _0x593bc8[_0x45b0('0x1f')]==_0x599b27||_0x593bc8['name']==_0x599b27;});if(_[_0x45b0('0x20')](_0x30b5d4)){var _0x58547f=_[_0x45b0('0x21')](this['telephones'],function(_0x2f72a3){return _0x2f72a3[_0x45b0('0x1f')]==_0x599b27||_0x2f72a3['name']==_0x599b27;});if(_0x58547f){_0x30b5d4=_[_0x45b0('0x21')](this[_0x45b0('0xd')],function(_0x349573){return _0x349573[_0x45b0('0x22')]==util[_0x45b0('0x23')]('SIP/%s',_0x58547f['name']);});}}return _0x30b5d4;};Report[_0x45b0('0xf')][_0x45b0('0x14')]=function(_0x18d5ba){for(var _0x434d8e=0x0;_0x434d8e<_0x18d5ba[_0x45b0('0x24')];_0x434d8e+=0x1){var _0x24676e=this['findAgent'](_0x18d5ba[_0x434d8e]['connectedlinenum']);if(_0x24676e){_0x18d5ba[_0x434d8e][_0x45b0('0x1f')]=_0x24676e['accountcode'];_0x18d5ba[_0x434d8e][_0x45b0('0x25')]=!![];_0x18d5ba[_0x434d8e][_0x45b0('0x26')]=_0x24676e[_0x45b0('0x27')];_0x18d5ba[_0x434d8e][_0x45b0('0x22')]=_[_0x45b0('0x20')](_0x24676e[_0x45b0('0x22')])?util[_0x45b0('0x23')](_0x45b0('0x28'),_0x24676e[_0x45b0('0x27')]):_0x24676e[_0x45b0('0x22')];if(_0x18d5ba[_0x434d8e]['queuecallercomplete']){_0x18d5ba[_0x434d8e][_0x45b0('0x29')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x18d5ba[_0x434d8e][_0x45b0('0x2a')]){_0x18d5ba[_0x434d8e][_0x45b0('0x2b')]=moment()[_0x45b0('0x23')](_0x45b0('0x2c'));}RpcMemberReport[_0x45b0('0x14')](_0x18d5ba[_0x434d8e]);}RpcVoiceQueueReport[_0x45b0('0x2d')](_0x18d5ba[_0x434d8e]);}};function extractCalleridNumber(_0x106d1c){var _0xb25a8b=_0x106d1c[_0x45b0('0x2e')](/<(.*?)>/);return _0xb25a8b?_0xb25a8b[0x1]:_0x106d1c;}Report['prototype'][_0x45b0('0x16')]=function(_0x109e13){_0x109e13[_0x45b0('0x2f')]=_0x109e13[_0x45b0('0x2f')]||_0x109e13[_0x45b0('0x30')];if(_0x109e13['type']=='dialer'){_0x109e13[_0x45b0('0x31')]=_0x45b0('0x32');_0x109e13[_0x45b0('0x33')]=_0x109e13[_0x45b0('0x32')];if(_0x109e13[_0x45b0('0x34')]==_0x45b0('0x35')){_0x109e13[_0x45b0('0x1f')]='';_0x109e13[_0x45b0('0x2f')]=extractCalleridNumber(_0x109e13[_0x45b0('0x36')]);}else if(_0x109e13[_0x45b0('0x34')]==_0x45b0('0x37')){if(_0x109e13[_0x45b0('0x2f')]==_0x45b0('0x38')){_0x109e13[_0x45b0('0x2f')]=extractCalleridNumber(_0x109e13['calleridpreview']);_0x109e13['calleridnum']=_0x109e13['originatecalleridnum'];_0x109e13[_0x45b0('0x39')]=[_0x109e13['channel'],_0x109e13[_0x45b0('0x3a')]=_0x109e13[_0x45b0('0x39')]][0x0];_0x109e13[_0x45b0('0x36')]=_0x109e13[_0x45b0('0x3b')];}else{_0x109e13[_0x45b0('0x2f')]=_0x109e13['calleridnum'];_0x109e13['calleridnum']=_0x109e13[_0x45b0('0x3c')];if(_0x109e13['disposition']==_0x45b0('0x3d')){_0x109e13[_0x45b0('0x1f')]=_0x109e13[_0x45b0('0x3e')];}else{_0x109e13[_0x45b0('0x1f')]='';}}}}else{_0x109e13[_0x45b0('0x36')]=util[_0x45b0('0x23')](_0x45b0('0x3f'),_0x109e13['calleridname'],_0x109e13[_0x45b0('0x40')]);}if(RpcVoiceTransferReport[_0x45b0('0x41')][_0x109e13[_0x45b0('0x42')]]){var _0x43f145=RpcVoiceTransferReport['transfers'][_0x109e13[_0x45b0('0x42')]];_0x43f145[_0x45b0('0x43')]=_0x109e13[_0x45b0('0x44')];RpcVoiceTransferReport[_0x45b0('0x1b')](_0x43f145);delete RpcVoiceTransferReport[_0x45b0('0x41')][_0x109e13[_0x45b0('0x42')]];}RpcVoiceCallReport[_0x45b0('0x2d')](_0x109e13);if(_0x109e13['monitor']){for(var _0x311a1d=0x0;_0x311a1d<_0x109e13[_0x45b0('0x45')]['length'];_0x311a1d+=0x1){_0x109e13[_0x45b0('0x46')]=_0x109e13[_0x45b0('0x45')][_0x311a1d][_0x45b0('0x47')];_0x109e13[_0x45b0('0x48')]=_0x109e13['monitors'][_0x311a1d][_0x45b0('0x48')];if(_0x109e13[_0x45b0('0x30')]==_0x45b0('0x38')){_0x109e13[_0x45b0('0x40')]=_0x109e13[_0x45b0('0x3e')];_0x109e13['calleridname']=_0x109e13['connectedlinename'];_0x109e13['connectedlinenum']=_0x109e13[_0x45b0('0x1f')];_0x109e13[_0x45b0('0x49')]=_0x109e13['membername'];_0x109e13[_0x45b0('0x30')]=_0x109e13[_0x45b0('0x3c')];}else if(_0x109e13[_0x45b0('0x30')]==_0x45b0('0x4a')){_0x109e13[_0x45b0('0x40')]=_0x109e13['destination'];_0x109e13[_0x45b0('0x30')]=_0x109e13[_0x45b0('0x3c')];}RpcVoiceRecording['create'](_0x109e13);}}};Report[_0x45b0('0xf')][_0x45b0('0x18')]=function(_0x4f47c0){if(_[_0x45b0('0x4b')](_0x4f47c0)){_0x4f47c0[_0x45b0('0x4c')](function(_0x551e67){RpcVoiceAgentReport[_0x45b0('0x2d')](_0x551e67);});}else{RpcVoiceAgentReport[_0x45b0('0x2d')](_0x4f47c0);}};Report[_0x45b0('0xf')]['voiceDialReport']=function(_0x3e53be){RpcVoiceDialReport[_0x45b0('0x2d')](_0x3e53be);var _0x3bd9d9;var _0x475206;var _0x431ec7=_0x3e53be[_0x45b0('0x3a')];if(_[_0x45b0('0x4d')](_0x431ec7,_0x45b0('0x4e'))){_0x475206=_0x431ec7['substring'](_0x431ec7[_0x45b0('0x4f')]('/')+0x1,_0x431ec7['indexOf']('@'));_0x3bd9d9=_[_0x45b0('0x21')](this[_0x45b0('0xd')],function(_0x1366e2){return _0x1366e2['mobile']==_0x475206||_0x1366e2[_0x45b0('0x50')]==_0x475206||_0x1366e2[_0x45b0('0x1f')]==_0x475206;});}else{_0x475206=_0x431ec7[_0x45b0('0x51')](_0x431ec7['indexOf']('/')+0x1,_0x431ec7[_0x45b0('0x52')]('-'));_0x3bd9d9=this[_0x45b0('0x1e')](_0x475206);}if(_0x3bd9d9){_0x3e53be[_0x45b0('0x22')]=_[_0x45b0('0x20')](_0x3bd9d9[_0x45b0('0x22')])?util[_0x45b0('0x23')]('SIP/%s',_0x3bd9d9[_0x45b0('0x27')]):_0x3bd9d9[_0x45b0('0x22')];_0x3e53be[_0x45b0('0x53')]=_0x3bd9d9['name'];_0x3e53be[_0x45b0('0x1f')]=_0x3bd9d9[_0x45b0('0x1f')];RpcMemberReport[_0x45b0('0x19')](_0x3e53be);}};Report['prototype'][_0x45b0('0x1b')]=function(_0x4b7356){RpcVoiceTransferReport['transfers'][_0x4b7356[_0x45b0('0x54')]]=_0x4b7356;};Report['prototype']['attendedTransfer']=function(_0xb17c72){RpcVoiceTransferReport['attendedTransfer'](_0xb17c72);};module[_0x45b0('0x55')]=Report; \ No newline at end of file +var _0x68e2=['accountcode','name','isNil','interface','format','SIP/%s','connectedlinenum','assigned','lastAssignedTo','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','destination','exten','dialer','queue','lastdata','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridnum','originatecalleridnum','destinationchannel','calleridpreview','disposition','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','monitor','monitors','length','createdAt','connectedlinename','membername','xcally-motion-dialer','isArray','forEach','startsWith','substring','indexOf','phone','lastIndexOf','transfererlinkedid','attendedTransfer','exports','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','sync','xdr','voiceQueueReport','voiceCallReport','bind','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','prototype','findAgent','find'];(function(_0x2aefff,_0x26a24b){var _0x4e4534=function(_0x592416){while(--_0x592416){_0x2aefff['push'](_0x2aefff['shift']());}};_0x4e4534(++_0x26a24b);}(_0x68e2,0x1d3));var _0x268e=function(_0x39976b,_0x3eda2c){_0x39976b=_0x39976b-0x0;var _0xf7f6dc=_0x68e2[_0x39976b];return _0xf7f6dc;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0x268e('0x0'));var config=require(_0x268e('0x1'));var ami=require(_0x268e('0x2'));var RpcVoiceAgentReport=require(_0x268e('0x3'));var RpcVoiceCallReport=require(_0x268e('0x4'));var RpcVoiceDialReport=require(_0x268e('0x5'));var RpcMemberReport=require(_0x268e('0x6'));var RpcVoiceQueueReport=require(_0x268e('0x7'));var RpcVoiceRecording=require(_0x268e('0x8'));var RpcVoiceTransferReport=require(_0x268e('0x9'));var VoiceQueueReport=require(_0x268e('0xa'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x268e('0xb'));var VoiceDialReport=require(_0x268e('0xc'));var UserReport=require(_0x268e('0xd'));function Report(_0x2e0cb1){this[_0x268e('0xe')]=_0x2e0cb1;this[_0x268e('0xf')]=_0x2e0cb1['agents'];this['telephones']=_0x2e0cb1[_0x268e('0x10')];}Report['prototype'][_0x268e('0x11')]=function(_0x311f42){var _0x5f2d33=new VoiceQueueReport(this[_0x268e('0xe')]);var _0x3856ec=new VoiceAgentReport(this[_0x268e('0xe')]);var _0x587aa1=new VoiceDialReport(this[_0x268e('0xe')]);var _0x35fbc4=new VoiceCallReport(this[_0x268e('0xe')]);var _0x331357=new UserReport(this['realtime']);if(config[_0x268e('0x12')]&&config[_0x268e('0x12')]['disabled']){ami['on']('custom:voiceQueueReport',this[_0x268e('0x13')]['bind'](this));ami['on']('custom:voiceCallReport',this[_0x268e('0x14')][_0x268e('0x15')](this));ami['on'](_0x268e('0x16'),this[_0x268e('0x17')][_0x268e('0x15')](this));ami['on'](_0x268e('0x18'),this[_0x268e('0x19')]['bind'](this));ami['on'](_0x268e('0x1a'),this[_0x268e('0x1b')][_0x268e('0x15')](this));ami['on']('attendedtransfer',this['attendedTransfer']['bind'](this));}};Report[_0x268e('0x1c')][_0x268e('0x1d')]=function(_0x1a169f){var _0x38e1ba;_0x38e1ba=_[_0x268e('0x1e')](this[_0x268e('0xf')],function(_0x2c32e8){return _0x2c32e8[_0x268e('0x1f')]==_0x1a169f||_0x2c32e8[_0x268e('0x20')]==_0x1a169f;});if(_[_0x268e('0x21')](_0x38e1ba)){var _0x1330cf=_['find'](this[_0x268e('0x10')],function(_0x3fad75){return _0x3fad75[_0x268e('0x1f')]==_0x1a169f||_0x3fad75[_0x268e('0x20')]==_0x1a169f;});if(_0x1330cf){_0x38e1ba=_[_0x268e('0x1e')](this[_0x268e('0xf')],function(_0x3fdcf7){return _0x3fdcf7[_0x268e('0x22')]==util[_0x268e('0x23')](_0x268e('0x24'),_0x1330cf[_0x268e('0x20')]);});}}return _0x38e1ba;};Report['prototype'][_0x268e('0x13')]=function(_0xc02039){for(var _0x23ec9e=0x0;_0x23ec9e<_0xc02039['length'];_0x23ec9e+=0x1){var _0x202155=this[_0x268e('0x1d')](_0xc02039[_0x23ec9e][_0x268e('0x25')]);if(_0x202155){_0xc02039[_0x23ec9e]['accountcode']=_0x202155[_0x268e('0x1f')];_0xc02039[_0x23ec9e][_0x268e('0x26')]=!![];_0xc02039[_0x23ec9e][_0x268e('0x27')]=_0x202155['name'];_0xc02039[_0x23ec9e][_0x268e('0x22')]=_[_0x268e('0x21')](_0x202155[_0x268e('0x22')])?util[_0x268e('0x23')](_0x268e('0x24'),_0x202155[_0x268e('0x20')]):_0x202155[_0x268e('0x22')];if(_0xc02039[_0x23ec9e]['queuecallercomplete']){_0xc02039[_0x23ec9e][_0x268e('0x28')]=moment()[_0x268e('0x23')](_0x268e('0x29'));}if(_0xc02039[_0x23ec9e][_0x268e('0x2a')]){_0xc02039[_0x23ec9e][_0x268e('0x2b')]=moment()[_0x268e('0x23')](_0x268e('0x29'));}RpcMemberReport['voiceQueueReport'](_0xc02039[_0x23ec9e]);}RpcVoiceQueueReport[_0x268e('0x2c')](_0xc02039[_0x23ec9e]);}};function extractCalleridNumber(_0x6cde93){var _0x4b8ae7=_0x6cde93['match'](/<(.*?)>/);return _0x4b8ae7?_0x4b8ae7[0x1]:_0x6cde93;}Report[_0x268e('0x1c')]['voiceCallReport']=function(_0x1ee79d){_0x1ee79d[_0x268e('0x2d')]=_0x1ee79d[_0x268e('0x2d')]||_0x1ee79d[_0x268e('0x2e')];if(_0x1ee79d['type']==_0x268e('0x2f')){_0x1ee79d['lastapplication']=_0x268e('0x30');_0x1ee79d[_0x268e('0x31')]=_0x1ee79d[_0x268e('0x30')];if(_0x1ee79d[_0x268e('0x32')]==_0x268e('0x33')){_0x1ee79d[_0x268e('0x1f')]='';_0x1ee79d['destination']=extractCalleridNumber(_0x1ee79d[_0x268e('0x34')]);}else if(_0x1ee79d[_0x268e('0x32')]==_0x268e('0x35')){if(_0x1ee79d[_0x268e('0x2d')]==_0x268e('0x36')){_0x1ee79d[_0x268e('0x2d')]=extractCalleridNumber(_0x1ee79d['calleridpreview']);_0x1ee79d[_0x268e('0x37')]=_0x1ee79d[_0x268e('0x38')];_0x1ee79d[_0x268e('0x39')]=[_0x1ee79d['channel'],_0x1ee79d['channel']=_0x1ee79d[_0x268e('0x39')]][0x0];_0x1ee79d[_0x268e('0x34')]=_0x1ee79d[_0x268e('0x3a')];}else{_0x1ee79d[_0x268e('0x2d')]=_0x1ee79d[_0x268e('0x37')];_0x1ee79d[_0x268e('0x37')]=_0x1ee79d[_0x268e('0x38')];if(_0x1ee79d[_0x268e('0x3b')]=='ANSWERED'){_0x1ee79d['accountcode']=_0x1ee79d['connectedlinenum'];}else{_0x1ee79d[_0x268e('0x1f')]='';}}}}else{_0x1ee79d[_0x268e('0x34')]=util[_0x268e('0x23')](_0x268e('0x3c'),_0x1ee79d[_0x268e('0x3d')],_0x1ee79d['calleridnum']);}if(RpcVoiceTransferReport[_0x268e('0x3e')][_0x1ee79d[_0x268e('0x3f')]]){var _0x432ce6=RpcVoiceTransferReport[_0x268e('0x3e')][_0x1ee79d[_0x268e('0x3f')]];_0x432ce6[_0x268e('0x40')]=_0x1ee79d[_0x268e('0x41')];RpcVoiceTransferReport[_0x268e('0x1b')](_0x432ce6);delete RpcVoiceTransferReport[_0x268e('0x3e')][_0x1ee79d[_0x268e('0x3f')]];}RpcVoiceCallReport[_0x268e('0x2c')](_0x1ee79d);if(_0x1ee79d[_0x268e('0x42')]){for(var _0x11dfec=0x0;_0x11dfec<_0x1ee79d[_0x268e('0x43')][_0x268e('0x44')];_0x11dfec+=0x1){_0x1ee79d['monitorFilename']=_0x1ee79d[_0x268e('0x43')][_0x11dfec]['filename'];_0x1ee79d['createdAt']=_0x1ee79d['monitors'][_0x11dfec][_0x268e('0x45')];if(_0x1ee79d[_0x268e('0x2e')]==_0x268e('0x36')){_0x1ee79d[_0x268e('0x37')]=_0x1ee79d['connectedlinenum'];_0x1ee79d[_0x268e('0x3d')]=_0x1ee79d['connectedlinename'];_0x1ee79d[_0x268e('0x25')]=_0x1ee79d[_0x268e('0x1f')];_0x1ee79d[_0x268e('0x46')]=_0x1ee79d[_0x268e('0x47')];_0x1ee79d[_0x268e('0x2e')]=_0x1ee79d[_0x268e('0x38')];}else if(_0x1ee79d[_0x268e('0x2e')]==_0x268e('0x48')){_0x1ee79d['calleridnum']=_0x1ee79d[_0x268e('0x2d')];_0x1ee79d[_0x268e('0x2e')]=_0x1ee79d[_0x268e('0x38')];}RpcVoiceRecording['create'](_0x1ee79d);}}};Report[_0x268e('0x1c')][_0x268e('0x17')]=function(_0xd3431d){if(_[_0x268e('0x49')](_0xd3431d)){_0xd3431d[_0x268e('0x4a')](function(_0x3742b2){RpcVoiceAgentReport['create'](_0x3742b2);});}else{RpcVoiceAgentReport[_0x268e('0x2c')](_0xd3431d);}};Report[_0x268e('0x1c')][_0x268e('0x19')]=function(_0x1cb6bd){RpcVoiceDialReport[_0x268e('0x2c')](_0x1cb6bd);var _0x43a12b;var _0x29875d;var _0x11910a=_0x1cb6bd['channel'];if(_[_0x268e('0x4b')](_0x11910a,'Local')){_0x29875d=_0x11910a[_0x268e('0x4c')](_0x11910a[_0x268e('0x4d')]('/')+0x1,_0x11910a[_0x268e('0x4d')]('@'));_0x43a12b=_[_0x268e('0x1e')](this[_0x268e('0xf')],function(_0x11e52a){return _0x11e52a['mobile']==_0x29875d||_0x11e52a[_0x268e('0x4e')]==_0x29875d||_0x11e52a[_0x268e('0x1f')]==_0x29875d;});}else{_0x29875d=_0x11910a['substring'](_0x11910a[_0x268e('0x4d')]('/')+0x1,_0x11910a[_0x268e('0x4f')]('-'));_0x43a12b=this['findAgent'](_0x29875d);}if(_0x43a12b){_0x1cb6bd[_0x268e('0x22')]=_[_0x268e('0x21')](_0x43a12b[_0x268e('0x22')])?util[_0x268e('0x23')]('SIP/%s',_0x43a12b[_0x268e('0x20')]):_0x43a12b[_0x268e('0x22')];_0x1cb6bd[_0x268e('0x47')]=_0x43a12b['name'];_0x1cb6bd[_0x268e('0x1f')]=_0x43a12b[_0x268e('0x1f')];RpcMemberReport[_0x268e('0x19')](_0x1cb6bd);}};Report['prototype'][_0x268e('0x1b')]=function(_0x407875){RpcVoiceTransferReport[_0x268e('0x3e')][_0x407875[_0x268e('0x50')]]=_0x407875;};Report['prototype'][_0x268e('0x51')]=function(_0x4867ca){RpcVoiceTransferReport[_0x268e('0x51')](_0x4867ca);};module[_0x268e('0x52')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 275647b..1a68d2d 100644 --- a/server/services/ami/report/userReport.js +++ b/server/services/ami/report/userReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x78fc=['inuse','toNumber','toLowerCase','updateStatusRealtime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','stateTime','startsWith','substring','mobile','phone','[userReport][devicestatechange]','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','[userReport][peerstatus]','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','name','telephone:save','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','lodash','moment','util','ioredis','bluebird','../../../config/environment','ami','../ami','redis','defaults','localhost','trunks','agents','telephones','registryentry','syncRegistry','registry','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','bind','syncRealtimeShow','resolve','then','catch','[userReport][sipshowregistry]','inspect','error','[userReport][devicestatelist]','[userReport][sippeerstatus]','prototype','isUndefined','emit','isNotNull','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','debug','find','stateRegistry','merge','omit','event','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:save','[userReport][registry]','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','local'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x78fc,0xfb));var _0xc78f=function(_0x5756f8,_0x22b6d5){_0x5756f8=_0x5756f8-0x0;var _0x3bb749=_0x78fc[_0x5756f8];return _0x3bb749;};'use strict';var _=require(_0xc78f('0x0'));var moment=require(_0xc78f('0x1'));var util=require(_0xc78f('0x2'));var Redis=require(_0xc78f('0x3'));var BPromise=require(_0xc78f('0x4'));var config=require(_0xc78f('0x5'));var logger=require('../../../config/logger')(_0xc78f('0x6'));var ami=require(_0xc78f('0x7'));config[_0xc78f('0x8')]=_[_0xc78f('0x9')](config['redis'],{'host':_0xc78f('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc78f('0x8')]));function UserReport(_0x9ca6af){this[_0xc78f('0xb')]=_0x9ca6af['trunks'];this[_0xc78f('0xc')]=_0x9ca6af[_0xc78f('0xc')];this[_0xc78f('0xd')]=_0x9ca6af[_0xc78f('0xd')];ami['on'](_0xc78f('0xe'),this[_0xc78f('0xf')]['bind'](this));ami['on'](_0xc78f('0x10'),this[_0xc78f('0xf')]['bind'](this));ami['on'](_0xc78f('0x11'),this[_0xc78f('0x12')]['bind'](this));ami['on'](_0xc78f('0x13'),this[_0xc78f('0x14')][_0xc78f('0x15')](this));return this[_0xc78f('0x16')]();}function showSipRegistrations(){Promise[_0xc78f('0x17')]()[_0xc78f('0x18')](ami['actionSipShowRegistry']())[_0xc78f('0x19')](function(_0x37448d){logger['error'](_0xc78f('0x1a'),util[_0xc78f('0x1b')](_0x37448d,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0xc78f('0x17')]()[_0xc78f('0x18')](ami['actionDeviceStateList']())['catch'](function(_0x214e54){logger[_0xc78f('0x1c')](_0xc78f('0x1d'),util['inspect'](_0x214e54,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0xc78f('0x17')]()[_0xc78f('0x18')](ami['actionSipPeerStatus']())[_0xc78f('0x19')](function(_0x5ac015){logger[_0xc78f('0x1c')](_0xc78f('0x1e'),util[_0xc78f('0x1b')](_0x5ac015,{'showHidden':![],'depth':null}));});}UserReport[_0xc78f('0x1f')][_0xc78f('0x16')]=function(){setInterval(function(){BPromise['resolve']()[_0xc78f('0x18')](showSipRegistrations())[_0xc78f('0x18')](listDeviceStates())['then'](showPeersStatus());},0x32c8);};UserReport['prototype']['isNotNull']=function(_0x5149f9){return _0x5149f9!==null&&!_[_0xc78f('0x20')](_0x5149f9);};UserReport[_0xc78f('0x1f')][_0xc78f('0x21')]=function(_0x2cd950,_0x580e06,_0x167bd6){io['to'](_0x2cd950)[_0xc78f('0x21')](_0x580e06,_0x167bd6);};UserReport[_0xc78f('0x1f')][_0xc78f('0xf')]=function(_0x23641c){try{if(this[_0xc78f('0x22')](_0x23641c)){logger[_0xc78f('0x23')](_0xc78f('0x24'),_0x23641c[_0xc78f('0x25')],_0x23641c[_0xc78f('0x26')]);logger[_0xc78f('0x27')]('[userReport][registry]',util[_0xc78f('0x1b')](_0x23641c,{'showHidden':![],'depth':null}));var _0x375228=_[_0xc78f('0x28')](this[_0xc78f('0xb')],{'defaultuser':_0x23641c[_0xc78f('0x25')]});if(_0x375228){_0x23641c[_0xc78f('0x29')]=_0x23641c[_0xc78f('0x26')];_[_0xc78f('0x2a')](_0x375228,_[_0xc78f('0x2b')](_0x23641c,[_0xc78f('0x2c'),_0xc78f('0x2d'),_0xc78f('0x25'),_0xc78f('0x26')]));logger[_0xc78f('0x27')](_0xc78f('0x2e'),util['inspect'](_0x375228,{'showHidden':![],'depth':null}));this[_0xc78f('0x21')](util[_0xc78f('0x2f')]('trunk:%s',_0x375228['name']),_0xc78f('0x30'),_0x375228);}}}catch(_0x12e9bd){logger[_0xc78f('0x1c')](_0xc78f('0x31'),util['inspect'](_0x12e9bd,{'showHidden':![],'depth':null}));}};UserReport[_0xc78f('0x1f')][_0xc78f('0x12')]=function(_0x8c84f5){try{if(this[_0xc78f('0x22')](_0x8c84f5)){logger[_0xc78f('0x23')](_0xc78f('0x32'),_0x8c84f5[_0xc78f('0x33')],_0x8c84f5[_0xc78f('0x26')]);logger[_0xc78f('0x27')]('[userReport][devicestatechange]',util[_0xc78f('0x1b')](_0x8c84f5,{'showHidden':![],'depth':null}));if(this[_0xc78f('0xc')][_0x8c84f5['device']]){if(!this[_0xc78f('0xc')][_0x8c84f5[_0xc78f('0x33')]][_0xc78f('0x34')]||_0x8c84f5[_0xc78f('0x26')]['toLowerCase']()==_0xc78f('0x35')){this[_0xc78f('0xc')][_0x8c84f5[_0xc78f('0x33')]][_0xc78f('0x34')]=![];if(this['agents'][_0x8c84f5[_0xc78f('0x33')]]['state']!==_0x8c84f5['state']['toLowerCase']()){this[_0xc78f('0xc')][_0x8c84f5[_0xc78f('0x33')]]['stateTime']=_[_0xc78f('0x36')](moment()[_0xc78f('0x2f')]('x'));}this[_0xc78f('0xc')][_0x8c84f5[_0xc78f('0x33')]][_0xc78f('0x26')]=_0x8c84f5[_0xc78f('0x26')][_0xc78f('0x37')]();this[_0xc78f('0xc')][_0x8c84f5[_0xc78f('0x33')]][_0xc78f('0x38')](_0x8c84f5);}}else if(this['telephones'][_0x8c84f5[_0xc78f('0x33')]]){if(this[_0xc78f('0xd')][_0x8c84f5['device']]['state']!==_0x8c84f5[_0xc78f('0x26')]['toLowerCase']()){this[_0xc78f('0xd')][_0x8c84f5[_0xc78f('0x33')]]['stateTime']=_[_0xc78f('0x36')](moment()['format']('x'));}this[_0xc78f('0xd')][_0x8c84f5['device']][_0xc78f('0x26')]=_0x8c84f5[_0xc78f('0x26')][_0xc78f('0x37')]();logger['debug'](_0xc78f('0x39'),util['inspect'](this[_0xc78f('0xd')][_0x8c84f5[_0xc78f('0x33')]],{'showHidden':![],'depth':null}));this['emit'](util[_0xc78f('0x2f')](_0xc78f('0x3a'),this['telephones'][_0x8c84f5[_0xc78f('0x33')]]['name']),'telephone:save',this[_0xc78f('0xd')][_0x8c84f5[_0xc78f('0x33')]]);}else if(this[_0xc78f('0xb')][_0x8c84f5['device']]){if(this[_0xc78f('0xb')][_0x8c84f5[_0xc78f('0x33')]][_0xc78f('0x26')]!==_0x8c84f5[_0xc78f('0x26')][_0xc78f('0x37')]()){this['trunks'][_0x8c84f5[_0xc78f('0x33')]][_0xc78f('0x3b')]=_[_0xc78f('0x36')](moment()[_0xc78f('0x2f')]('x'));}this[_0xc78f('0xb')][_0x8c84f5[_0xc78f('0x33')]]['state']=_0x8c84f5[_0xc78f('0x26')]['toLowerCase']();logger['debug']('[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:',util[_0xc78f('0x1b')](this[_0xc78f('0xb')][_0x8c84f5['device']],{'showHidden':![],'depth':null}));this[_0xc78f('0x21')](util[_0xc78f('0x2f')]('trunk:%s',this['trunks'][_0x8c84f5[_0xc78f('0x33')]]['name']),_0xc78f('0x30'),this[_0xc78f('0xb')][_0x8c84f5[_0xc78f('0x33')]]);}else if(_[_0xc78f('0x3c')](_0x8c84f5[_0xc78f('0x33')],'Local')){var _0x339fe5=_0x8c84f5[_0xc78f('0x33')];var _0xba297c=_0x339fe5[_0xc78f('0x3d')](_0x339fe5['indexOf']('/')+0x1,_0x339fe5['indexOf']('@'));var _0x1b8603=_[_0xc78f('0x28')](this['agents'],function(_0x46fa33){return _0x46fa33[_0xc78f('0x3e')]==_0xba297c||_0x46fa33[_0xc78f('0x3f')]==_0xba297c||_0x46fa33['accountcode']==_0xba297c;});if(_0x1b8603){if(_0x1b8603[_0xc78f('0x26')]!==_0x8c84f5['state']['toLowerCase']()){_0x1b8603[_0xc78f('0x3b')]=_[_0xc78f('0x36')](moment()[_0xc78f('0x2f')]('x'));}_0x1b8603[_0xc78f('0x26')]=_0x8c84f5[_0xc78f('0x26')][_0xc78f('0x37')]();_0x1b8603[_0xc78f('0x34')]=!![];_0x1b8603[_0xc78f('0x38')](_0x8c84f5);}}}}catch(_0x4bceb5){logger[_0xc78f('0x1c')](_0xc78f('0x40'),util['inspect'](_0x4bceb5,{'showHidden':![],'depth':null}));}};UserReport['prototype']['syncPeerStatus']=function(_0xa4402d){try{if(this[_0xc78f('0x22')](_0xa4402d)&&this[_0xc78f('0x22')](_0xa4402d[_0xc78f('0x13')])){logger[_0xc78f('0x23')](_0xc78f('0x41'),_0xa4402d[_0xc78f('0x42')],_0xa4402d[_0xc78f('0x43')],_0xa4402d['peerstatus']);logger[_0xc78f('0x27')](_0xc78f('0x44'),util[_0xc78f('0x1b')](_0xa4402d,{'showHidden':![],'depth':null}));if(this[_0xc78f('0xc')][_0xa4402d[_0xc78f('0x42')]]){if(!this[_0xc78f('0xc')][_0xa4402d[_0xc78f('0x42')]][_0xc78f('0x34')]||_0xa4402d[_0xc78f('0x13')][_0xc78f('0x37')]()==_0xc78f('0x45')){this['agents'][_0xa4402d[_0xc78f('0x42')]]['local']=![];this[_0xc78f('0xc')][_0xa4402d[_0xc78f('0x42')]][_0xc78f('0x46')]=_0xa4402d[_0xc78f('0x13')][_0xc78f('0x37')]();this[_0xc78f('0xc')][_0xa4402d[_0xc78f('0x42')]][_0xc78f('0x43')]=_0xa4402d[_0xc78f('0x43')];this[_0xc78f('0xc')][_0xa4402d[_0xc78f('0x42')]][_0xc78f('0x38')](_0xa4402d);}}else if(this[_0xc78f('0xd')][_0xa4402d[_0xc78f('0x42')]]){this[_0xc78f('0xd')][_0xa4402d[_0xc78f('0x42')]][_0xc78f('0x46')]=_0xa4402d['peerstatus'][_0xc78f('0x37')]();this['telephones'][_0xa4402d[_0xc78f('0x42')]]['address']=_0xa4402d[_0xc78f('0x43')];logger[_0xc78f('0x27')](_0xc78f('0x47'),util[_0xc78f('0x1b')](this[_0xc78f('0xd')][_0xa4402d[_0xc78f('0x42')]],{'showHidden':![],'depth':null}));this[_0xc78f('0x21')](util[_0xc78f('0x2f')](_0xc78f('0x3a'),this['telephones'][_0xa4402d[_0xc78f('0x42')]][_0xc78f('0x48')]),_0xc78f('0x49'),this[_0xc78f('0xd')][_0xa4402d['peer']]);}else if(this[_0xc78f('0xb')][_0xa4402d[_0xc78f('0x42')]]){this[_0xc78f('0xb')][_0xa4402d[_0xc78f('0x42')]][_0xc78f('0x46')]=_0xa4402d[_0xc78f('0x13')]['toLowerCase']();this[_0xc78f('0xb')][_0xa4402d[_0xc78f('0x42')]]['address']=_0xa4402d[_0xc78f('0x43')];logger['debug'](_0xc78f('0x4a'),util[_0xc78f('0x1b')](this[_0xc78f('0xb')][_0xa4402d[_0xc78f('0x42')]],{'showHidden':![],'depth':null}));this[_0xc78f('0x21')](util[_0xc78f('0x2f')]('trunk:%s',this['trunks'][_0xa4402d[_0xc78f('0x42')]]['name']),_0xc78f('0x30'),this[_0xc78f('0xb')][_0xa4402d[_0xc78f('0x42')]]);}}}catch(_0x1853d1){logger[_0xc78f('0x1c')](_0xc78f('0x44'),util[_0xc78f('0x1b')](_0x1853d1,{'showHidden':![],'depth':null}));}};module[_0xc78f('0x4b')]=UserReport; \ No newline at end of file +var _0xb9eb=['[userReport][devicestatechange]\x20device:%s\x20state:%s','[userReport][devicestatechange]','device','local','inuse','toLowerCase','stateTime','toNumber','format','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','Local','substring','indexOf','mobile','phone','accountcode','updateStatusRealtime','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','peerstatus','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','telephone:save','exports','moment','util','bluebird','../../../config/environment','../../../config/logger','../ami','redis','defaults','socket.io-emitter','agents','telephones','syncRegistry','bind','registry','syncDeviceState','syncPeerStatus','syncRealtimeShow','resolve','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','actionDeviceStateList','[userReport][devicestatelist]','inspect','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','then','isNotNull','isUndefined','[userReport][registry]\x20registry:%s\x20state:%s','username','state','debug','find','trunks','stateRegistry','merge','omit','emit','trunk:%s','name','trunk:save','[userReport][registry]','info'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0xb9eb,0x68));var _0xbb9e=function(_0x4bc6f9,_0x2614a2){_0x4bc6f9=_0x4bc6f9-0x0;var _0x14ca46=_0xb9eb[_0x4bc6f9];return _0x14ca46;};'use strict';var _=require('lodash');var moment=require(_0xbb9e('0x0'));var util=require(_0xbb9e('0x1'));var Redis=require('ioredis');var BPromise=require(_0xbb9e('0x2'));var config=require(_0xbb9e('0x3'));var logger=require(_0xbb9e('0x4'))('ami');var ami=require(_0xbb9e('0x5'));config[_0xbb9e('0x6')]=_[_0xbb9e('0x7')](config[_0xbb9e('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xbb9e('0x8'))(new Redis(config['redis']));function UserReport(_0x394e7a){this['trunks']=_0x394e7a['trunks'];this[_0xbb9e('0x9')]=_0x394e7a['agents'];this[_0xbb9e('0xa')]=_0x394e7a[_0xbb9e('0xa')];ami['on']('registryentry',this[_0xbb9e('0xb')][_0xbb9e('0xc')](this));ami['on'](_0xbb9e('0xd'),this['syncRegistry'][_0xbb9e('0xc')](this));ami['on']('devicestatechange',this[_0xbb9e('0xe')][_0xbb9e('0xc')](this));ami['on']('peerstatus',this[_0xbb9e('0xf')][_0xbb9e('0xc')](this));return this[_0xbb9e('0x10')]();}function showSipRegistrations(){Promise[_0xbb9e('0x11')]()['then'](ami[_0xbb9e('0x12')]())[_0xbb9e('0x13')](function(_0x3b79e9){logger[_0xbb9e('0x14')](_0xbb9e('0x15'),util['inspect'](_0x3b79e9,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0xbb9e('0x11')]()['then'](ami[_0xbb9e('0x16')]())[_0xbb9e('0x13')](function(_0x5f54b0){logger[_0xbb9e('0x14')](_0xbb9e('0x17'),util[_0xbb9e('0x18')](_0x5f54b0,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise['resolve']()['then'](ami[_0xbb9e('0x19')]())['catch'](function(_0x42d307){logger[_0xbb9e('0x14')](_0xbb9e('0x1a'),util[_0xbb9e('0x18')](_0x42d307,{'showHidden':![],'depth':null}));});}UserReport[_0xbb9e('0x1b')][_0xbb9e('0x10')]=function(){setInterval(function(){BPromise[_0xbb9e('0x11')]()[_0xbb9e('0x1c')](showSipRegistrations())['then'](listDeviceStates())[_0xbb9e('0x1c')](showPeersStatus());},0x32c8);};UserReport[_0xbb9e('0x1b')][_0xbb9e('0x1d')]=function(_0x14cbe8){return _0x14cbe8!==null&&!_[_0xbb9e('0x1e')](_0x14cbe8);};UserReport[_0xbb9e('0x1b')]['emit']=function(_0x16eec1,_0x5af940,_0x5e2f34){io['to'](_0x16eec1)['emit'](_0x5af940,_0x5e2f34);};UserReport['prototype'][_0xbb9e('0xb')]=function(_0x161db4){try{if(this[_0xbb9e('0x1d')](_0x161db4)){logger['info'](_0xbb9e('0x1f'),_0x161db4[_0xbb9e('0x20')],_0x161db4[_0xbb9e('0x21')]);logger[_0xbb9e('0x22')]('[userReport][registry]',util['inspect'](_0x161db4,{'showHidden':![],'depth':null}));var _0x2ee318=_[_0xbb9e('0x23')](this[_0xbb9e('0x24')],{'defaultuser':_0x161db4[_0xbb9e('0x20')]});if(_0x2ee318){_0x161db4[_0xbb9e('0x25')]=_0x161db4['state'];_[_0xbb9e('0x26')](_0x2ee318,_[_0xbb9e('0x27')](_0x161db4,['event','actionid',_0xbb9e('0x20'),'state']));logger[_0xbb9e('0x22')]('[userReport][registry]\x20sending\x20trunk:save\x20event:',util['inspect'](_0x2ee318,{'showHidden':![],'depth':null}));this[_0xbb9e('0x28')](util['format'](_0xbb9e('0x29'),_0x2ee318[_0xbb9e('0x2a')]),_0xbb9e('0x2b'),_0x2ee318);}}}catch(_0x3d1183){logger[_0xbb9e('0x14')](_0xbb9e('0x2c'),util[_0xbb9e('0x18')](_0x3d1183,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0xbb9e('0xe')]=function(_0x1166d8){try{if(this[_0xbb9e('0x1d')](_0x1166d8)){logger[_0xbb9e('0x2d')](_0xbb9e('0x2e'),_0x1166d8['device'],_0x1166d8['state']);logger[_0xbb9e('0x22')](_0xbb9e('0x2f'),util[_0xbb9e('0x18')](_0x1166d8,{'showHidden':![],'depth':null}));if(this[_0xbb9e('0x9')][_0x1166d8[_0xbb9e('0x30')]]){if(!this['agents'][_0x1166d8[_0xbb9e('0x30')]][_0xbb9e('0x31')]||_0x1166d8[_0xbb9e('0x21')]['toLowerCase']()==_0xbb9e('0x32')){this['agents'][_0x1166d8[_0xbb9e('0x30')]][_0xbb9e('0x31')]=![];if(this['agents'][_0x1166d8['device']][_0xbb9e('0x21')]!==_0x1166d8[_0xbb9e('0x21')][_0xbb9e('0x33')]()){this[_0xbb9e('0x9')][_0x1166d8[_0xbb9e('0x30')]][_0xbb9e('0x34')]=_[_0xbb9e('0x35')](moment()[_0xbb9e('0x36')]('x'));}this[_0xbb9e('0x9')][_0x1166d8['device']][_0xbb9e('0x21')]=_0x1166d8[_0xbb9e('0x21')]['toLowerCase']();this[_0xbb9e('0x9')][_0x1166d8[_0xbb9e('0x30')]]['updateStatusRealtime'](_0x1166d8);}}else if(this[_0xbb9e('0xa')][_0x1166d8['device']]){if(this['telephones'][_0x1166d8[_0xbb9e('0x30')]][_0xbb9e('0x21')]!==_0x1166d8[_0xbb9e('0x21')][_0xbb9e('0x33')]()){this['telephones'][_0x1166d8[_0xbb9e('0x30')]]['stateTime']=_['toNumber'](moment()[_0xbb9e('0x36')]('x'));}this[_0xbb9e('0xa')][_0x1166d8[_0xbb9e('0x30')]][_0xbb9e('0x21')]=_0x1166d8[_0xbb9e('0x21')]['toLowerCase']();logger[_0xbb9e('0x22')](_0xbb9e('0x37'),util[_0xbb9e('0x18')](this[_0xbb9e('0xa')][_0x1166d8['device']],{'showHidden':![],'depth':null}));this[_0xbb9e('0x28')](util[_0xbb9e('0x36')](_0xbb9e('0x38'),this['telephones'][_0x1166d8['device']][_0xbb9e('0x2a')]),'telephone:save',this[_0xbb9e('0xa')][_0x1166d8['device']]);}else if(this[_0xbb9e('0x24')][_0x1166d8[_0xbb9e('0x30')]]){if(this[_0xbb9e('0x24')][_0x1166d8[_0xbb9e('0x30')]][_0xbb9e('0x21')]!==_0x1166d8['state'][_0xbb9e('0x33')]()){this[_0xbb9e('0x24')][_0x1166d8[_0xbb9e('0x30')]]['stateTime']=_['toNumber'](moment()[_0xbb9e('0x36')]('x'));}this[_0xbb9e('0x24')][_0x1166d8[_0xbb9e('0x30')]][_0xbb9e('0x21')]=_0x1166d8['state'][_0xbb9e('0x33')]();logger[_0xbb9e('0x22')](_0xbb9e('0x39'),util[_0xbb9e('0x18')](this['trunks'][_0x1166d8[_0xbb9e('0x30')]],{'showHidden':![],'depth':null}));this[_0xbb9e('0x28')](util[_0xbb9e('0x36')](_0xbb9e('0x29'),this[_0xbb9e('0x24')][_0x1166d8[_0xbb9e('0x30')]][_0xbb9e('0x2a')]),'trunk:save',this[_0xbb9e('0x24')][_0x1166d8[_0xbb9e('0x30')]]);}else if(_[_0xbb9e('0x3a')](_0x1166d8[_0xbb9e('0x30')],_0xbb9e('0x3b'))){var _0x22078c=_0x1166d8[_0xbb9e('0x30')];var _0x3f18dd=_0x22078c[_0xbb9e('0x3c')](_0x22078c['indexOf']('/')+0x1,_0x22078c[_0xbb9e('0x3d')]('@'));var _0x7a6df=_['find'](this[_0xbb9e('0x9')],function(_0x24c0a9){return _0x24c0a9[_0xbb9e('0x3e')]==_0x3f18dd||_0x24c0a9[_0xbb9e('0x3f')]==_0x3f18dd||_0x24c0a9[_0xbb9e('0x40')]==_0x3f18dd;});if(_0x7a6df){if(_0x7a6df[_0xbb9e('0x21')]!==_0x1166d8[_0xbb9e('0x21')]['toLowerCase']()){_0x7a6df['stateTime']=_[_0xbb9e('0x35')](moment()[_0xbb9e('0x36')]('x'));}_0x7a6df['state']=_0x1166d8['state']['toLowerCase']();_0x7a6df[_0xbb9e('0x31')]=!![];_0x7a6df[_0xbb9e('0x41')](_0x1166d8);}}}}catch(_0x3b011d){logger[_0xbb9e('0x14')](_0xbb9e('0x2f'),util['inspect'](_0x3b011d,{'showHidden':![],'depth':null}));}};UserReport[_0xbb9e('0x1b')][_0xbb9e('0xf')]=function(_0x3e1270){try{if(this[_0xbb9e('0x1d')](_0x3e1270)&&this['isNotNull'](_0x3e1270['peerstatus'])){logger[_0xbb9e('0x2d')](_0xbb9e('0x42'),_0x3e1270[_0xbb9e('0x43')],_0x3e1270[_0xbb9e('0x44')],_0x3e1270['peerstatus']);logger[_0xbb9e('0x22')]('[userReport][peerstatus]',util[_0xbb9e('0x18')](_0x3e1270,{'showHidden':![],'depth':null}));if(this[_0xbb9e('0x9')][_0x3e1270[_0xbb9e('0x43')]]){if(!this[_0xbb9e('0x9')][_0x3e1270[_0xbb9e('0x43')]]['local']||_0x3e1270[_0xbb9e('0x45')][_0xbb9e('0x33')]()==_0xbb9e('0x46')){this[_0xbb9e('0x9')][_0x3e1270['peer']][_0xbb9e('0x31')]=![];this['agents'][_0x3e1270['peer']][_0xbb9e('0x47')]=_0x3e1270[_0xbb9e('0x45')][_0xbb9e('0x33')]();this['agents'][_0x3e1270['peer']][_0xbb9e('0x44')]=_0x3e1270[_0xbb9e('0x44')];this[_0xbb9e('0x9')][_0x3e1270['peer']]['updateStatusRealtime'](_0x3e1270);}}else if(this[_0xbb9e('0xa')][_0x3e1270['peer']]){this[_0xbb9e('0xa')][_0x3e1270[_0xbb9e('0x43')]][_0xbb9e('0x47')]=_0x3e1270[_0xbb9e('0x45')][_0xbb9e('0x33')]();this[_0xbb9e('0xa')][_0x3e1270[_0xbb9e('0x43')]][_0xbb9e('0x44')]=_0x3e1270['address'];logger[_0xbb9e('0x22')](_0xbb9e('0x48'),util[_0xbb9e('0x18')](this['telephones'][_0x3e1270[_0xbb9e('0x43')]],{'showHidden':![],'depth':null}));this[_0xbb9e('0x28')](util['format']('telephone:%s',this[_0xbb9e('0xa')][_0x3e1270[_0xbb9e('0x43')]]['name']),_0xbb9e('0x49'),this[_0xbb9e('0xa')][_0x3e1270[_0xbb9e('0x43')]]);}else if(this['trunks'][_0x3e1270[_0xbb9e('0x43')]]){this[_0xbb9e('0x24')][_0x3e1270[_0xbb9e('0x43')]]['status']=_0x3e1270[_0xbb9e('0x45')]['toLowerCase']();this[_0xbb9e('0x24')][_0x3e1270[_0xbb9e('0x43')]][_0xbb9e('0x44')]=_0x3e1270['address'];logger['debug']('[userReport][peerstatus]\x20sending\x20trunk:save\x20event:',util['inspect'](this[_0xbb9e('0x24')][_0x3e1270['peer']],{'showHidden':![],'depth':null}));this['emit'](util[_0xbb9e('0x36')](_0xbb9e('0x29'),this['trunks'][_0x3e1270[_0xbb9e('0x43')]][_0xbb9e('0x2a')]),_0xbb9e('0x2b'),this[_0xbb9e('0x24')][_0x3e1270['peer']]);}}}catch(_0x1514bc){logger[_0xbb9e('0x14')]('[userReport][peerstatus]',util[_0xbb9e('0x18')](_0x1514bc,{'showHidden':![],'depth':null}));}};module[_0xbb9e('0x4a')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 2b2b0f1..259bbf1 100644 --- a/server/services/ami/report/voiceAgentReport.js +++ b/server/services/ami/report/voiceAgentReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['redis','defaults','localhost','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','syncMusicOnHoldStart','musiconholdstop','attendedtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','uniqueid','YYYY-MM-DD\x20HH:mm:ss','queue','mandatoryDisposition','type','inbound','merge','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','format','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','voiceChannels','routealias','interface','pick','destconnectedlinenum','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:%s','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answered_elsewhere','[%s][voiceAgentReport][agentconnect]','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','error','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','agentringnoanswer','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','reason','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','agent','talktime','acw','acwtime','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','syncAttendedTransfer','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]','lodash','moment','util','../../../config/logger','../ami'];(function(_0x2826c5,_0x3081fa){var _0x4c5ea0=function(_0x139347){while(--_0x139347){_0x2826c5['push'](_0x2826c5['shift']());}};_0x4c5ea0(++_0x3081fa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x0a9e('0x3'))('ami');var ami=require(_0x0a9e('0x4'));config[_0x0a9e('0x5')]=_[_0x0a9e('0x6')](config[_0x0a9e('0x5')],{'host':_0x0a9e('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x5')]));function VoiceAgentReport(_0x441e3a){this[_0x0a9e('0x8')]={};this['voiceChannels']=_0x441e3a['channels'];this[_0x0a9e('0x9')]=_0x441e3a['voiceQueues'];this['agents']=_0x441e3a[_0x0a9e('0xa')];this[_0x0a9e('0xb')]={};ami['on'](_0x0a9e('0xc'),this[_0x0a9e('0xd')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0xf'),this['syncAgentConnect']['bind'](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x10'),this[_0x0a9e('0x11')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x12'),this[_0x0a9e('0x13')]['bind'](this));ami['on'](_0x0a9e('0x14'),this[_0x0a9e('0x15')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0xe')](this));ami['on']('musiconholdstart',this[_0x0a9e('0x18')]['bind'](this));ami['on'](_0x0a9e('0x19'),this['syncMusicOnHoldStop'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x1a'),this['syncAttendedTransfer'][_0x0a9e('0xe')](this));ami['on']('blindtransfer',this[_0x0a9e('0x1b')][_0x0a9e('0xe')](this));}VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1d')]=function(_0x31b1ca,_0x2eb11f,_0x530eb7){io['to'](_0x31b1ca)[_0x0a9e('0x1d')](_0x2eb11f,_0x530eb7);};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1e')]=function(_0x1c696a){return _0x1c696a!==null&&!_[_0x0a9e('0x1f')](_0x1c696a);};VoiceAgentReport['prototype'][_0x0a9e('0xd')]=function(_0x155cce){try{if(this['isNotNull'](_0x155cce)){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x155cce['uniqueid'],_0x155cce[_0x0a9e('0x21')],_0x155cce[_0x0a9e('0x22')]);logger[_0x0a9e('0x23')](_0x0a9e('0x24'),_0x155cce['uniqueid'],util[_0x0a9e('0x25')](_0x155cce,{'showHidden':![],'depth':null}));if(_[_0x0a9e('0x1f')](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]]={};}if(_[_0x0a9e('0x1f')](this['channels'][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]={'agentcalledAt':moment()['format'](_0x0a9e('0x27')),'lastevent':'called','mandatoryDisposition':this[_0x0a9e('0x9')][_0x155cce['queue']]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x29')]||![]:![],'type':this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x2a')]||'inbound':_0x0a9e('0x2b'),'variables':this[_0x0a9e('0xb')][_0x155cce[_0x0a9e('0x26')]]};}_[_0x0a9e('0x2c')](this['channels'][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]],_[_0x0a9e('0x2d')](_0x155cce,[_0x0a9e('0x2e'),_0x0a9e('0x2f')]));logger[_0x0a9e('0x23')](_0x0a9e('0x30'),_0x155cce[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this['channels'][_0x155cce[_0x0a9e('0x26')]][_0x155cce['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x31'),this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]);logger['debug'](_0x0a9e('0x32'),_0x155cce[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x33')]('user:%s',_0x155cce[_0x0a9e('0x21')]),'user:called',this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]);}}catch(_0x3f3d41){logger['error'](_0x0a9e('0x34'),_0x155cce[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x3f3d41,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncAgentConnect']=function(_0x54135e){try{if(this[_0x0a9e('0x1e')](_0x54135e)){if(this['channels'][_0x54135e[_0x0a9e('0x26')]]){logger[_0x0a9e('0x23')](_0x0a9e('0x35'),_0x54135e[_0x0a9e('0x26')],util['inspect'](_0x54135e,{'showHidden':![],'depth':null}));for(var _0x31916f in this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]]){if(this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x31916f)){if(_0x54135e[_0x0a9e('0x22')]===_0x31916f){logger['info']('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x54135e[_0x0a9e('0x26')],_0x54135e[_0x0a9e('0x21')],_0x54135e['destuniqueid']);this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x37')]=moment()[_0x0a9e('0x33')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x38')]=_0x54135e['connectedlinename'];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x39')]=_0x54135e['connectedlinenum'];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3a')]=_0x54135e[_0x0a9e('0x3a')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3b')]=_0x54135e[_0x0a9e('0x3b')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3c')]=_0x54135e[_0x0a9e('0x3c')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3d')]='connect';if(this['voiceChannels'][this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x26')]]){var _0x315881=this[_0x0a9e('0x3e')][this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x26')]][_0x0a9e('0x3f')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3f')]=_0x315881;_0x54135e['routealias']=_0x315881;}_[_0x0a9e('0x2c')](this[_0x0a9e('0xa')][_0x54135e[_0x0a9e('0x40')]],_[_0x0a9e('0x41')](_0x54135e,[_0x0a9e('0x28'),_0x0a9e('0x42'),_0x0a9e('0x3f')]));logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:',_0x54135e[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x54135e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami['emit'](_0x0a9e('0x43'),this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x54135e[_0x0a9e('0x22')]]);logger[_0x0a9e('0x23')](_0x0a9e('0x44'),_0x54135e[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x54135e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x33')](_0x0a9e('0x45'),_0x54135e[_0x0a9e('0x21')]),_0x0a9e('0x46'),this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x54135e[_0x0a9e('0x22')]]);}else if(!this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f]['agentringnoanswer']&&!this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x12')]){logger[_0x0a9e('0x20')](_0x0a9e('0x47'),_0x54135e[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x21')],_0x31916f);this['channels'][_0x54135e['uniqueid']][_0x31916f]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x48')]=moment()['format'](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f]['answeredelsewheredestinationuniqueid']=_0x54135e[_0x0a9e('0x22')];this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x31916f]['answeredelsewheremembername']=_0x54135e[_0x0a9e('0x21')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f]['lastevent']=_0x0a9e('0x49');this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f]['reason']=_0x0a9e('0x49');logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:',_0x54135e[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')]('custom:agentansweredelsewhere',this['channels'][_0x54135e['uniqueid']][_0x31916f]);}}}}}}catch(_0x2da03c){logger['error'](_0x0a9e('0x4a'),_0x54135e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2da03c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x4b')]=function(_0x272738){try{if(this[_0x0a9e('0x1e')](_0x272738)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x272738[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x272738,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]]&&this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738['destuniqueid']]){logger[_0x0a9e('0x20')](_0x0a9e('0x4c'),_0x272738['uniqueid'],_0x272738[_0x0a9e('0x21')],_0x272738['destuniqueid']);this[_0x0a9e('0x8')][_0x272738['uniqueid']][_0x272738['destuniqueid']]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x272738['uniqueid']][_0x272738[_0x0a9e('0x22')]][_0x0a9e('0x48')]=moment()[_0x0a9e('0x33')](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738['destuniqueid']][_0x0a9e('0x3d')]='rejected';this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738[_0x0a9e('0x22')]]['reason']=_0x0a9e('0x4d');logger[_0x0a9e('0x23')](_0x0a9e('0x4e'),_0x272738[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x4f'),this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738[_0x0a9e('0x22')]]);}}}catch(_0x4d4a35){logger[_0x0a9e('0x50')](_0x0a9e('0x51'),_0x272738[_0x0a9e('0x26')],util['inspect'](_0x4d4a35,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncQueueCallerAbandon']=function(_0x5211e3){try{if(this[_0x0a9e('0x1e')](_0x5211e3)){logger[_0x0a9e('0x23')](_0x0a9e('0x52'),_0x5211e3[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x5211e3,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]]){for(var _0x54a37d in this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x54a37d)&&!this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x53')]&&!this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d]['agentcomplete']){logger[_0x0a9e('0x20')](_0x0a9e('0x54'),_0x5211e3[_0x0a9e('0x26')],this['channels'][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x21')],_0x54a37d);this['channels'][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x53')]=!![];this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x48')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x3d')]=_0x0a9e('0x55');this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x56')]=_0x0a9e('0x55');logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:',_0x5211e3[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x5211e3['uniqueid']][_0x54a37d],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')]('custom:agentqueuecallerabandon',this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d]);}}}}}catch(_0x4c46c1){logger[_0x0a9e('0x50')](_0x0a9e('0x57'),_0x5211e3[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x4c46c1,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x13')]=function(_0x2e9552){try{if(this[_0x0a9e('0x1e')](_0x2e9552)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentcomplete]\x20event:',_0x2e9552[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2e9552,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]]){for(var _0x4abc8f in this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x4abc8f)){if(this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x37')]&&!this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x12')]){logger[_0x0a9e('0x20')](_0x0a9e('0x58'),_0x2e9552[_0x0a9e('0x26')],this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x21')],_0x4abc8f);this[_0x0a9e('0x8')][_0x2e9552['uniqueid']][_0x4abc8f][_0x0a9e('0x12')]=!![];this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x59')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f]['lastevent']=_0x0a9e('0x5a');this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x56')]=_0x2e9552['reason']==_0x0a9e('0x5b')?_0x0a9e('0x5c'):_0x2e9552[_0x0a9e('0x56')];this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x5d')]=_0x2e9552[_0x0a9e('0x5d')];if(this['voiceQueues'][_0x2e9552[_0x0a9e('0x28')]]&&this[_0x0a9e('0x9')][_0x2e9552[_0x0a9e('0x28')]][_0x0a9e('0x5e')]){this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x5f')]=this['voiceQueues'][_0x2e9552[_0x0a9e('0x28')]]['acwTimeout'];this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x60')]=!![];}this[_0x0a9e('0xa')][_0x2e9552['interface']]=_['omit'](this[_0x0a9e('0xa')][_0x2e9552[_0x0a9e('0x40')]],[_0x0a9e('0x28'),'destconnectedlinenum']);logger[_0x0a9e('0x23')](_0x0a9e('0x61'),_0x2e9552['uniqueid'],util['inspect'](this[_0x0a9e('0x8')][_0x2e9552['uniqueid']][_0x4abc8f],{'showHidden':![],'depth':null}));ami['emit']('custom:agentcomplete',this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f]);logger[_0x0a9e('0x23')](_0x0a9e('0x62'),_0x2e9552[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f],{'showHidden':![],'depth':null}));this['emit'](util[_0x0a9e('0x33')](_0x0a9e('0x45'),_0x2e9552[_0x0a9e('0x21')]),_0x0a9e('0x63'),this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f]);}}}}}}catch(_0x32f761){logger[_0x0a9e('0x50')]('[%s][voiceAgentReport][agentcomplete]',_0x2e9552[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x32f761,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x15')]=function(_0x255e49){try{if(this[_0x0a9e('0x1e')](_0x255e49)){logger[_0x0a9e('0x23')](_0x0a9e('0x64'),_0x255e49['uniqueid'],util[_0x0a9e('0x25')](_0x255e49,{'showHidden':![],'depth':null}));this[_0x0a9e('0x65')](_0x255e49['uniqueid'],_[_0x0a9e('0x66')](_0x255e49[_0x0a9e('0x67')])[0x0],_0x255e49[_0x0a9e('0x68')]);if(this['channels'][_0x255e49[_0x0a9e('0x26')]]){for(var _0x52ec10 in this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x52ec10)){logger[_0x0a9e('0x20')](_0x0a9e('0x69'),_0x255e49[_0x0a9e('0x26')],_0x52ec10,_['keys'](_0x255e49[_0x0a9e('0x67')])[0x0],_0x255e49[_0x0a9e('0x68')]);if(_[_0x0a9e('0x1f')](this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x52ec10][_0x0a9e('0xb')])){this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x52ec10][_0x0a9e('0xb')]={};}this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x52ec10][_0x0a9e('0xb')]=this[_0x0a9e('0xb')][_0x255e49['uniqueid']];}}}}}catch(_0xc81b64){logger[_0x0a9e('0x50')](_0x0a9e('0x6a'),_0x255e49[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0xc81b64,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x65')]=function(_0x1756c7,_0x5ce99d,_0x23b447){var _0x5e725e=[_0x0a9e('0x6b'),_0x0a9e('0x6c'),_0x0a9e('0x6d'),_0x0a9e('0x6e'),'rtpaudioqosloss',_0x0a9e('0x6f'),'rtpaudioqosrtt',_0x0a9e('0x70'),_0x0a9e('0x71'),'sipuri',_0x0a9e('0x72'),_0x0a9e('0x73'),_0x0a9e('0x74'),'memberdynamic','memberinterface',_0x0a9e('0x75'),_0x0a9e('0x21'),_0x0a9e('0x76'),_0x0a9e('0x77')];if(!_[_0x0a9e('0x78')](_0x5ce99d)&&!_[_0x0a9e('0x79')](_0x5e725e,_0x5ce99d)){if(_[_0x0a9e('0x1f')](this[_0x0a9e('0xb')][_0x1756c7])){this[_0x0a9e('0xb')][_0x1756c7]={};}this['variables'][_0x1756c7][_0x5ce99d]=_0x23b447;}};VoiceAgentReport[_0x0a9e('0x1c')]['syncHangup']=function(_0x287324){try{if(this[_0x0a9e('0x1e')](_0x287324)){logger[_0x0a9e('0x23')](_0x0a9e('0x7a'),_0x287324[_0x0a9e('0x26')],util['inspect'](_0x287324,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]]){for(var _0x2791c5 in this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]]){if(this['channels'][_0x287324['uniqueid']][_0x0a9e('0x36')](_0x2791c5)){if(this['channels'][_0x287324[_0x0a9e('0x26')]][_0x2791c5][_0x0a9e('0x56')]==_0x0a9e('0x5b')&&this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]][_0x2791c5][_0x0a9e('0x12')]){logger['info']('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x287324[_0x0a9e('0x26')],_0x2791c5);this['channels'][_0x287324[_0x0a9e('0x26')]][_0x2791c5]['agentcompleteAt']=moment()[_0x0a9e('0x33')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger['debug'](_0x0a9e('0x7b'),_0x287324[_0x0a9e('0x26')],util['inspect'](_[_0x0a9e('0x7c')](this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]]),{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x7d'),_['values'](this['channels'][_0x287324[_0x0a9e('0x26')]]));delete this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]];}if(this[_0x0a9e('0xb')][_0x287324[_0x0a9e('0x26')]]){delete this['variables'][_0x287324[_0x0a9e('0x26')]];}}}catch(_0xadce3d){logger['error'](_0x0a9e('0x7e'),_0x287324[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0xadce3d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x7f')]=function(_0x23b39e){try{if(this[_0x0a9e('0x1e')](_0x23b39e)){logger[_0x0a9e('0x23')](_0x0a9e('0x80'),_0x23b39e[_0x0a9e('0x26')],util['inspect'](_0x23b39e,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]]){for(var _0x2ada60 in this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]]){if(this['channels'][_0x23b39e['transfereeuniqueid']][_0x0a9e('0x36')](_0x2ada60)){if(_0x23b39e[_0x0a9e('0x82')]===_0x2ada60){logger[_0x0a9e('0x20')](_0x0a9e('0x83'),_0x23b39e[_0x0a9e('0x26')],this['channels'][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x21')],_0x2ada60);var _0x3450ae=moment();this['channels'][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60]['agentcomplete']=!![];this[_0x0a9e('0x8')][_0x23b39e['transfereeuniqueid']][_0x2ada60][_0x0a9e('0x59')]=moment()[_0x0a9e('0x33')](_0x0a9e('0x27'));this['channels'][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60]['lastevent']=_0x0a9e('0x5a');this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x56')]=_0x0a9e('0x5b');this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x5d')]=_0x3450ae[_0x0a9e('0x84')](this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x37')],_0x0a9e('0x85'));}}}}if(this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x86')]]){var _0x248368=this['channels'][_0x23b39e['secondtransfereruniqueid']];this[_0x0a9e('0x8')][_0x23b39e['secondtransfereruniqueid']]=this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]];this['channels'][_0x23b39e[_0x0a9e('0x81')]]=_0x248368;}}}catch(_0xe2b083){logger[_0x0a9e('0x50')](_0x0a9e('0x87'),_0x23b39e['uniqueid'],util[_0x0a9e('0x25')](_0xe2b083,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1b')]=function(_0x34a791){try{if(this['isNotNull'](_0x34a791)){logger[_0x0a9e('0x23')](_0x0a9e('0x88'),_0x34a791[_0x0a9e('0x26')],util['inspect'](_0x34a791,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]]){for(var _0x17b29d in this['channels'][_0x34a791[_0x0a9e('0x81')]]){if(this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x0a9e('0x36')](_0x17b29d)){if(_0x34a791[_0x0a9e('0x89')]===_0x17b29d){logger['info'](_0x0a9e('0x8a'),_0x34a791[_0x0a9e('0x26')],this['channels'][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x21')],_0x17b29d);var _0x1f6f1c=moment();this['channels'][_0x34a791['transfereeuniqueid']][_0x17b29d]['agentcomplete']=!![];this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d]['agentcompleteAt']=_0x1f6f1c;this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x3d')]='complete';this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x56')]=_0x0a9e('0x5b');this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x5d')]=_0x1f6f1c[_0x0a9e('0x84')](this[_0x0a9e('0x8')][_0x34a791['transfereeuniqueid']][_0x17b29d][_0x0a9e('0x37')],'seconds');}}}}}}catch(_0x138cf5){logger[_0x0a9e('0x50')](_0x0a9e('0x8b'),_0x34a791[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x138cf5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncMusicOnHoldStart']=function(_0x1a0314){var _0x33da81='';try{if(this[_0x0a9e('0x1e')](_0x1a0314)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x1a0314[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x1a0314,{'showHidden':![],'depth':null}));if(_0x1a0314[_0x0a9e('0x8c')]){_0x33da81=_0x1a0314[_0x0a9e('0x8c')][_0x0a9e('0x8d')](0x0,_0x1a0314[_0x0a9e('0x8c')][_0x0a9e('0x8e')]('-'));if(this[_0x0a9e('0xa')][_0x33da81]){logger[_0x0a9e('0x20')](_0x0a9e('0x8f'),_0x1a0314['uniqueid'],_0x33da81);this[_0x0a9e('0xa')][_0x33da81][_0x0a9e('0x90')]=!![];}}}}catch(_0x2ff265){logger[_0x0a9e('0x50')](_0x0a9e('0x91'),_0x1a0314[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2ff265,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncMusicOnHoldStop']=function(_0x3b581c){var _0xd2391='';try{if(this[_0x0a9e('0x1e')](_0x3b581c)){logger['debug'](_0x0a9e('0x92'),_0x3b581c[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x3b581c,{'showHidden':![],'depth':null}));if(_0x3b581c[_0x0a9e('0x8c')]){_0xd2391=_0x3b581c[_0x0a9e('0x8c')][_0x0a9e('0x8d')](0x0,_0x3b581c[_0x0a9e('0x8c')][_0x0a9e('0x8e')]('-'));if(this[_0x0a9e('0xa')][_0xd2391]){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][musiconholdstop]\x20interface:%s',_0x3b581c[_0x0a9e('0x26')],_0xd2391);this[_0x0a9e('0xa')][_0xd2391][_0x0a9e('0x90')]=![];}}}}catch(_0x3db98f){logger[_0x0a9e('0x50')](_0x0a9e('0x93'),_0x3b581c['uniqueid'],util[_0x0a9e('0x25')](_0x3db98f,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file +var _0xa9e0=['redis','defaults','localhost','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','syncMusicOnHoldStart','musiconholdstop','attendedtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','uniqueid','YYYY-MM-DD\x20HH:mm:ss','queue','mandatoryDisposition','type','inbound','merge','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','format','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','voiceChannels','routealias','interface','pick','destconnectedlinenum','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:%s','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answered_elsewhere','[%s][voiceAgentReport][agentconnect]','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','error','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','agentringnoanswer','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','reason','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','agent','talktime','acw','acwtime','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','syncAttendedTransfer','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]','lodash','moment','util','../../../config/logger','../ami'];(function(_0x15a233,_0x18ee2e){var _0x25358f=function(_0x7f52d1){while(--_0x7f52d1){_0x15a233['push'](_0x15a233['shift']());}};_0x25358f(++_0x18ee2e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'use strict';var _=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x0a9e('0x3'))('ami');var ami=require(_0x0a9e('0x4'));config[_0x0a9e('0x5')]=_[_0x0a9e('0x6')](config[_0x0a9e('0x5')],{'host':_0x0a9e('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x5')]));function VoiceAgentReport(_0x441e3a){this[_0x0a9e('0x8')]={};this['voiceChannels']=_0x441e3a['channels'];this[_0x0a9e('0x9')]=_0x441e3a['voiceQueues'];this['agents']=_0x441e3a[_0x0a9e('0xa')];this[_0x0a9e('0xb')]={};ami['on'](_0x0a9e('0xc'),this[_0x0a9e('0xd')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0xf'),this['syncAgentConnect']['bind'](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x10'),this[_0x0a9e('0x11')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x12'),this[_0x0a9e('0x13')]['bind'](this));ami['on'](_0x0a9e('0x14'),this[_0x0a9e('0x15')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0xe')](this));ami['on']('musiconholdstart',this[_0x0a9e('0x18')]['bind'](this));ami['on'](_0x0a9e('0x19'),this['syncMusicOnHoldStop'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x1a'),this['syncAttendedTransfer'][_0x0a9e('0xe')](this));ami['on']('blindtransfer',this[_0x0a9e('0x1b')][_0x0a9e('0xe')](this));}VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1d')]=function(_0x31b1ca,_0x2eb11f,_0x530eb7){io['to'](_0x31b1ca)[_0x0a9e('0x1d')](_0x2eb11f,_0x530eb7);};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1e')]=function(_0x1c696a){return _0x1c696a!==null&&!_[_0x0a9e('0x1f')](_0x1c696a);};VoiceAgentReport['prototype'][_0x0a9e('0xd')]=function(_0x155cce){try{if(this['isNotNull'](_0x155cce)){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x155cce['uniqueid'],_0x155cce[_0x0a9e('0x21')],_0x155cce[_0x0a9e('0x22')]);logger[_0x0a9e('0x23')](_0x0a9e('0x24'),_0x155cce['uniqueid'],util[_0x0a9e('0x25')](_0x155cce,{'showHidden':![],'depth':null}));if(_[_0x0a9e('0x1f')](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]]={};}if(_[_0x0a9e('0x1f')](this['channels'][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]={'agentcalledAt':moment()['format'](_0x0a9e('0x27')),'lastevent':'called','mandatoryDisposition':this[_0x0a9e('0x9')][_0x155cce['queue']]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x29')]||![]:![],'type':this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x2a')]||'inbound':_0x0a9e('0x2b'),'variables':this[_0x0a9e('0xb')][_0x155cce[_0x0a9e('0x26')]]};}_[_0x0a9e('0x2c')](this['channels'][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]],_[_0x0a9e('0x2d')](_0x155cce,[_0x0a9e('0x2e'),_0x0a9e('0x2f')]));logger[_0x0a9e('0x23')](_0x0a9e('0x30'),_0x155cce[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this['channels'][_0x155cce[_0x0a9e('0x26')]][_0x155cce['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x31'),this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]);logger['debug'](_0x0a9e('0x32'),_0x155cce[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x33')]('user:%s',_0x155cce[_0x0a9e('0x21')]),'user:called',this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]);}}catch(_0x3f3d41){logger['error'](_0x0a9e('0x34'),_0x155cce[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x3f3d41,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncAgentConnect']=function(_0x54135e){try{if(this[_0x0a9e('0x1e')](_0x54135e)){if(this['channels'][_0x54135e[_0x0a9e('0x26')]]){logger[_0x0a9e('0x23')](_0x0a9e('0x35'),_0x54135e[_0x0a9e('0x26')],util['inspect'](_0x54135e,{'showHidden':![],'depth':null}));for(var _0x31916f in this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]]){if(this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x31916f)){if(_0x54135e[_0x0a9e('0x22')]===_0x31916f){logger['info']('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x54135e[_0x0a9e('0x26')],_0x54135e[_0x0a9e('0x21')],_0x54135e['destuniqueid']);this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x37')]=moment()[_0x0a9e('0x33')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x38')]=_0x54135e['connectedlinename'];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x39')]=_0x54135e['connectedlinenum'];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3a')]=_0x54135e[_0x0a9e('0x3a')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3b')]=_0x54135e[_0x0a9e('0x3b')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3c')]=_0x54135e[_0x0a9e('0x3c')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3d')]='connect';if(this['voiceChannels'][this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x26')]]){var _0x315881=this[_0x0a9e('0x3e')][this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x26')]][_0x0a9e('0x3f')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3f')]=_0x315881;_0x54135e['routealias']=_0x315881;}_[_0x0a9e('0x2c')](this[_0x0a9e('0xa')][_0x54135e[_0x0a9e('0x40')]],_[_0x0a9e('0x41')](_0x54135e,[_0x0a9e('0x28'),_0x0a9e('0x42'),_0x0a9e('0x3f')]));logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:',_0x54135e[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x54135e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami['emit'](_0x0a9e('0x43'),this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x54135e[_0x0a9e('0x22')]]);logger[_0x0a9e('0x23')](_0x0a9e('0x44'),_0x54135e[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x54135e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x33')](_0x0a9e('0x45'),_0x54135e[_0x0a9e('0x21')]),_0x0a9e('0x46'),this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x54135e[_0x0a9e('0x22')]]);}else if(!this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f]['agentringnoanswer']&&!this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x12')]){logger[_0x0a9e('0x20')](_0x0a9e('0x47'),_0x54135e[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x21')],_0x31916f);this['channels'][_0x54135e['uniqueid']][_0x31916f]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x48')]=moment()['format'](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f]['answeredelsewheredestinationuniqueid']=_0x54135e[_0x0a9e('0x22')];this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x31916f]['answeredelsewheremembername']=_0x54135e[_0x0a9e('0x21')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f]['lastevent']=_0x0a9e('0x49');this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f]['reason']=_0x0a9e('0x49');logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:',_0x54135e[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')]('custom:agentansweredelsewhere',this['channels'][_0x54135e['uniqueid']][_0x31916f]);}}}}}}catch(_0x2da03c){logger['error'](_0x0a9e('0x4a'),_0x54135e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2da03c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x4b')]=function(_0x272738){try{if(this[_0x0a9e('0x1e')](_0x272738)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x272738[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x272738,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]]&&this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738['destuniqueid']]){logger[_0x0a9e('0x20')](_0x0a9e('0x4c'),_0x272738['uniqueid'],_0x272738[_0x0a9e('0x21')],_0x272738['destuniqueid']);this[_0x0a9e('0x8')][_0x272738['uniqueid']][_0x272738['destuniqueid']]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x272738['uniqueid']][_0x272738[_0x0a9e('0x22')]][_0x0a9e('0x48')]=moment()[_0x0a9e('0x33')](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738['destuniqueid']][_0x0a9e('0x3d')]='rejected';this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738[_0x0a9e('0x22')]]['reason']=_0x0a9e('0x4d');logger[_0x0a9e('0x23')](_0x0a9e('0x4e'),_0x272738[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x4f'),this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738[_0x0a9e('0x22')]]);}}}catch(_0x4d4a35){logger[_0x0a9e('0x50')](_0x0a9e('0x51'),_0x272738[_0x0a9e('0x26')],util['inspect'](_0x4d4a35,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncQueueCallerAbandon']=function(_0x5211e3){try{if(this[_0x0a9e('0x1e')](_0x5211e3)){logger[_0x0a9e('0x23')](_0x0a9e('0x52'),_0x5211e3[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x5211e3,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]]){for(var _0x54a37d in this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x54a37d)&&!this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x53')]&&!this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d]['agentcomplete']){logger[_0x0a9e('0x20')](_0x0a9e('0x54'),_0x5211e3[_0x0a9e('0x26')],this['channels'][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x21')],_0x54a37d);this['channels'][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x53')]=!![];this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x48')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x3d')]=_0x0a9e('0x55');this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x56')]=_0x0a9e('0x55');logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:',_0x5211e3[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x5211e3['uniqueid']][_0x54a37d],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')]('custom:agentqueuecallerabandon',this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d]);}}}}}catch(_0x4c46c1){logger[_0x0a9e('0x50')](_0x0a9e('0x57'),_0x5211e3[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x4c46c1,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x13')]=function(_0x2e9552){try{if(this[_0x0a9e('0x1e')](_0x2e9552)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentcomplete]\x20event:',_0x2e9552[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2e9552,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]]){for(var _0x4abc8f in this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x4abc8f)){if(this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x37')]&&!this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x12')]){logger[_0x0a9e('0x20')](_0x0a9e('0x58'),_0x2e9552[_0x0a9e('0x26')],this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x21')],_0x4abc8f);this[_0x0a9e('0x8')][_0x2e9552['uniqueid']][_0x4abc8f][_0x0a9e('0x12')]=!![];this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x59')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f]['lastevent']=_0x0a9e('0x5a');this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x56')]=_0x2e9552['reason']==_0x0a9e('0x5b')?_0x0a9e('0x5c'):_0x2e9552[_0x0a9e('0x56')];this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x5d')]=_0x2e9552[_0x0a9e('0x5d')];if(this['voiceQueues'][_0x2e9552[_0x0a9e('0x28')]]&&this[_0x0a9e('0x9')][_0x2e9552[_0x0a9e('0x28')]][_0x0a9e('0x5e')]){this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x5f')]=this['voiceQueues'][_0x2e9552[_0x0a9e('0x28')]]['acwTimeout'];this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x60')]=!![];}this[_0x0a9e('0xa')][_0x2e9552['interface']]=_['omit'](this[_0x0a9e('0xa')][_0x2e9552[_0x0a9e('0x40')]],[_0x0a9e('0x28'),'destconnectedlinenum']);logger[_0x0a9e('0x23')](_0x0a9e('0x61'),_0x2e9552['uniqueid'],util['inspect'](this[_0x0a9e('0x8')][_0x2e9552['uniqueid']][_0x4abc8f],{'showHidden':![],'depth':null}));ami['emit']('custom:agentcomplete',this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f]);logger[_0x0a9e('0x23')](_0x0a9e('0x62'),_0x2e9552[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f],{'showHidden':![],'depth':null}));this['emit'](util[_0x0a9e('0x33')](_0x0a9e('0x45'),_0x2e9552[_0x0a9e('0x21')]),_0x0a9e('0x63'),this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f]);}}}}}}catch(_0x32f761){logger[_0x0a9e('0x50')]('[%s][voiceAgentReport][agentcomplete]',_0x2e9552[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x32f761,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x15')]=function(_0x255e49){try{if(this[_0x0a9e('0x1e')](_0x255e49)){logger[_0x0a9e('0x23')](_0x0a9e('0x64'),_0x255e49['uniqueid'],util[_0x0a9e('0x25')](_0x255e49,{'showHidden':![],'depth':null}));this[_0x0a9e('0x65')](_0x255e49['uniqueid'],_[_0x0a9e('0x66')](_0x255e49[_0x0a9e('0x67')])[0x0],_0x255e49[_0x0a9e('0x68')]);if(this['channels'][_0x255e49[_0x0a9e('0x26')]]){for(var _0x52ec10 in this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x52ec10)){logger[_0x0a9e('0x20')](_0x0a9e('0x69'),_0x255e49[_0x0a9e('0x26')],_0x52ec10,_['keys'](_0x255e49[_0x0a9e('0x67')])[0x0],_0x255e49[_0x0a9e('0x68')]);if(_[_0x0a9e('0x1f')](this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x52ec10][_0x0a9e('0xb')])){this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x52ec10][_0x0a9e('0xb')]={};}this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x52ec10][_0x0a9e('0xb')]=this[_0x0a9e('0xb')][_0x255e49['uniqueid']];}}}}}catch(_0xc81b64){logger[_0x0a9e('0x50')](_0x0a9e('0x6a'),_0x255e49[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0xc81b64,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x65')]=function(_0x1756c7,_0x5ce99d,_0x23b447){var _0x5e725e=[_0x0a9e('0x6b'),_0x0a9e('0x6c'),_0x0a9e('0x6d'),_0x0a9e('0x6e'),'rtpaudioqosloss',_0x0a9e('0x6f'),'rtpaudioqosrtt',_0x0a9e('0x70'),_0x0a9e('0x71'),'sipuri',_0x0a9e('0x72'),_0x0a9e('0x73'),_0x0a9e('0x74'),'memberdynamic','memberinterface',_0x0a9e('0x75'),_0x0a9e('0x21'),_0x0a9e('0x76'),_0x0a9e('0x77')];if(!_[_0x0a9e('0x78')](_0x5ce99d)&&!_[_0x0a9e('0x79')](_0x5e725e,_0x5ce99d)){if(_[_0x0a9e('0x1f')](this[_0x0a9e('0xb')][_0x1756c7])){this[_0x0a9e('0xb')][_0x1756c7]={};}this['variables'][_0x1756c7][_0x5ce99d]=_0x23b447;}};VoiceAgentReport[_0x0a9e('0x1c')]['syncHangup']=function(_0x287324){try{if(this[_0x0a9e('0x1e')](_0x287324)){logger[_0x0a9e('0x23')](_0x0a9e('0x7a'),_0x287324[_0x0a9e('0x26')],util['inspect'](_0x287324,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]]){for(var _0x2791c5 in this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]]){if(this['channels'][_0x287324['uniqueid']][_0x0a9e('0x36')](_0x2791c5)){if(this['channels'][_0x287324[_0x0a9e('0x26')]][_0x2791c5][_0x0a9e('0x56')]==_0x0a9e('0x5b')&&this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]][_0x2791c5][_0x0a9e('0x12')]){logger['info']('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x287324[_0x0a9e('0x26')],_0x2791c5);this['channels'][_0x287324[_0x0a9e('0x26')]][_0x2791c5]['agentcompleteAt']=moment()[_0x0a9e('0x33')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger['debug'](_0x0a9e('0x7b'),_0x287324[_0x0a9e('0x26')],util['inspect'](_[_0x0a9e('0x7c')](this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]]),{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x7d'),_['values'](this['channels'][_0x287324[_0x0a9e('0x26')]]));delete this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]];}if(this[_0x0a9e('0xb')][_0x287324[_0x0a9e('0x26')]]){delete this['variables'][_0x287324[_0x0a9e('0x26')]];}}}catch(_0xadce3d){logger['error'](_0x0a9e('0x7e'),_0x287324[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0xadce3d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x7f')]=function(_0x23b39e){try{if(this[_0x0a9e('0x1e')](_0x23b39e)){logger[_0x0a9e('0x23')](_0x0a9e('0x80'),_0x23b39e[_0x0a9e('0x26')],util['inspect'](_0x23b39e,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]]){for(var _0x2ada60 in this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]]){if(this['channels'][_0x23b39e['transfereeuniqueid']][_0x0a9e('0x36')](_0x2ada60)){if(_0x23b39e[_0x0a9e('0x82')]===_0x2ada60){logger[_0x0a9e('0x20')](_0x0a9e('0x83'),_0x23b39e[_0x0a9e('0x26')],this['channels'][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x21')],_0x2ada60);var _0x3450ae=moment();this['channels'][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60]['agentcomplete']=!![];this[_0x0a9e('0x8')][_0x23b39e['transfereeuniqueid']][_0x2ada60][_0x0a9e('0x59')]=moment()[_0x0a9e('0x33')](_0x0a9e('0x27'));this['channels'][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60]['lastevent']=_0x0a9e('0x5a');this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x56')]=_0x0a9e('0x5b');this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x5d')]=_0x3450ae[_0x0a9e('0x84')](this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x37')],_0x0a9e('0x85'));}}}}if(this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x86')]]){var _0x248368=this['channels'][_0x23b39e['secondtransfereruniqueid']];this[_0x0a9e('0x8')][_0x23b39e['secondtransfereruniqueid']]=this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]];this['channels'][_0x23b39e[_0x0a9e('0x81')]]=_0x248368;}}}catch(_0xe2b083){logger[_0x0a9e('0x50')](_0x0a9e('0x87'),_0x23b39e['uniqueid'],util[_0x0a9e('0x25')](_0xe2b083,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1b')]=function(_0x34a791){try{if(this['isNotNull'](_0x34a791)){logger[_0x0a9e('0x23')](_0x0a9e('0x88'),_0x34a791[_0x0a9e('0x26')],util['inspect'](_0x34a791,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]]){for(var _0x17b29d in this['channels'][_0x34a791[_0x0a9e('0x81')]]){if(this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x0a9e('0x36')](_0x17b29d)){if(_0x34a791[_0x0a9e('0x89')]===_0x17b29d){logger['info'](_0x0a9e('0x8a'),_0x34a791[_0x0a9e('0x26')],this['channels'][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x21')],_0x17b29d);var _0x1f6f1c=moment();this['channels'][_0x34a791['transfereeuniqueid']][_0x17b29d]['agentcomplete']=!![];this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d]['agentcompleteAt']=_0x1f6f1c;this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x3d')]='complete';this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x56')]=_0x0a9e('0x5b');this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x5d')]=_0x1f6f1c[_0x0a9e('0x84')](this[_0x0a9e('0x8')][_0x34a791['transfereeuniqueid']][_0x17b29d][_0x0a9e('0x37')],'seconds');}}}}}}catch(_0x138cf5){logger[_0x0a9e('0x50')](_0x0a9e('0x8b'),_0x34a791[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x138cf5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncMusicOnHoldStart']=function(_0x1a0314){var _0x33da81='';try{if(this[_0x0a9e('0x1e')](_0x1a0314)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x1a0314[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x1a0314,{'showHidden':![],'depth':null}));if(_0x1a0314[_0x0a9e('0x8c')]){_0x33da81=_0x1a0314[_0x0a9e('0x8c')][_0x0a9e('0x8d')](0x0,_0x1a0314[_0x0a9e('0x8c')][_0x0a9e('0x8e')]('-'));if(this[_0x0a9e('0xa')][_0x33da81]){logger[_0x0a9e('0x20')](_0x0a9e('0x8f'),_0x1a0314['uniqueid'],_0x33da81);this[_0x0a9e('0xa')][_0x33da81][_0x0a9e('0x90')]=!![];}}}}catch(_0x2ff265){logger[_0x0a9e('0x50')](_0x0a9e('0x91'),_0x1a0314[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2ff265,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncMusicOnHoldStop']=function(_0x3b581c){var _0xd2391='';try{if(this[_0x0a9e('0x1e')](_0x3b581c)){logger['debug'](_0x0a9e('0x92'),_0x3b581c[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x3b581c,{'showHidden':![],'depth':null}));if(_0x3b581c[_0x0a9e('0x8c')]){_0xd2391=_0x3b581c[_0x0a9e('0x8c')][_0x0a9e('0x8d')](0x0,_0x3b581c[_0x0a9e('0x8c')][_0x0a9e('0x8e')]('-'));if(this[_0x0a9e('0xa')][_0xd2391]){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][musiconholdstop]\x20interface:%s',_0x3b581c[_0x0a9e('0x26')],_0xd2391);this[_0x0a9e('0xa')][_0xd2391][_0x0a9e('0x90')]=![];}}}}catch(_0x3db98f){logger[_0x0a9e('0x50')](_0x0a9e('0x93'),_0x3b581c['uniqueid'],util[_0x0a9e('0x25')](_0x3db98f,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 49453f5..a9638e0 100644 --- a/server/services/ami/report/voiceCallReport.js +++ b/server/services/ami/report/voiceCallReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa315=['newcallerid','syncNewCallerId','attendedtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','inspect','prototype','isNotNull','isUndefined','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','keys','context','from-sip','channel','split','exten','xcally-motion-preview','destconnectedlinenum','connectedlinenum','format','user:agentconnect','accountcode','error','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','disposition','toNumber','channelstate','merge','pick','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','user:%s','name','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','startsWith','CDR(routeAlias)','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','starttime','duration','subtract','seconds','YYYY-MM-DD\x20HH:mm:ss','includes','lastapplication','lastdata','cdr(','match','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','[%s][voiceCallReport][newstate]\x20event:','answered','holdtime','connectedlinename','destinationchannel','UserId','membername','routealias','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','.wav49','replace','.WAV','find','monitors','isNil','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','type','xmd-queue','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','mixmonitor_filename','parse','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','diff','billableseconds','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','resolve','then','undefined','isEmpty','getSettings','stopRecordingOnTransfer','Action','StopMixMonitor','catch','finally','event','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','origtransferercalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','origtransfererlinkedid','ATTENDED','transferType','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','BLIND','transfererchannel','transfereruniqueid','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','milliseconds','mohtime','[%s][voiceCallReport][musiconholdstop]','exports','bluebird','moment','util','path','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','onhold','set','queue','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','defaults','redis','localhost','channels','agents','blindTransfers','syncNewExten','newexten','bind','newchannel','syncNewChannel','newstate','syncNewState','varset','syncVarSet','syncHangup'];(function(_0x1b892b,_0x4efe48){var _0xa99e57=function(_0x3f957a){while(--_0x3f957a){_0x1b892b['push'](_0x1b892b['shift']());}};_0xa99e57(++_0x4efe48);}(_0xa315,0xa4));var _0x5a31=function(_0x1d211b,_0x475f3b){_0x1d211b=_0x1d211b-0x0;var _0x47c88b=_0xa315[_0x1d211b];return _0x47c88b;};'use strict';var BPromise=require(_0x5a31('0x0'));var _=require('lodash');var moment=require(_0x5a31('0x1'));var util=require(_0x5a31('0x2'));var path=require(_0x5a31('0x3'));var Redis=require(_0x5a31('0x4'));var config=require(_0x5a31('0x5'));var logger=require(_0x5a31('0x6'))(_0x5a31('0x7'));var ami=require(_0x5a31('0x8'));var Channel=require(_0x5a31('0x9'));var RpcSetting=require('../rpc/setting');var statusDesc=[_0x5a31('0xa'),_0x5a31('0xb'),_0x5a31('0xc'),_0x5a31('0xd'),_0x5a31('0xe'),_0x5a31('0xf'),_0x5a31('0x10'),'ringinuse',_0x5a31('0x11')];var applications=[_0x5a31('0x12'),_0x5a31('0x13'),'agi','dial',_0x5a31('0x14'),_0x5a31('0x15')];var dispositions=[_0x5a31('0x16'),_0x5a31('0x17'),_0x5a31('0x17'),_0x5a31('0x16'),'NO\x20ANSWER','NO\x20ANSWER',_0x5a31('0x18'),_0x5a31('0x19'),_0x5a31('0x17'),_0x5a31('0x17'),_0x5a31('0x17')];var actions={};config['redis']=_[_0x5a31('0x1a')](config[_0x5a31('0x1b')],{'host':_0x5a31('0x1c'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function VoiceCallReport(_0x25c63b){this['channels']=_0x25c63b[_0x5a31('0x1d')];this[_0x5a31('0x1e')]=_0x25c63b['agents'];this[_0x5a31('0x1f')]={};ami['on']('coreshowchannel',this[_0x5a31('0x20')]['bind'](this));ami['on'](_0x5a31('0x21'),this['syncNewExten'][_0x5a31('0x22')](this));ami['on'](_0x5a31('0x23'),this[_0x5a31('0x24')][_0x5a31('0x22')](this));ami['on'](_0x5a31('0x25'),this[_0x5a31('0x26')][_0x5a31('0x22')](this));ami['on'](_0x5a31('0x27'),this[_0x5a31('0x28')][_0x5a31('0x22')](this));ami['on']('hangup',this[_0x5a31('0x29')][_0x5a31('0x22')](this));ami['on'](_0x5a31('0x2a'),this[_0x5a31('0x2b')][_0x5a31('0x22')](this));ami['on'](_0x5a31('0x2c'),this['syncAttendedTransfer']['bind'](this));ami['on']('blindtransfer',this[_0x5a31('0x2d')][_0x5a31('0x22')](this));ami['on'](_0x5a31('0x2e'),this[_0x5a31('0x2f')][_0x5a31('0x22')](this));ami['on'](_0x5a31('0x30'),this[_0x5a31('0x31')][_0x5a31('0x22')](this));try{logger[_0x5a31('0x32')](_0x5a31('0x33'));ami['actionCoreShowChannels']();}catch(_0x1ecb53){logger['error']('[voiceCallReport][coreshowchannels]',util[_0x5a31('0x34')](_0x1ecb53,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x5a31('0x35')][_0x5a31('0x36')]=function(_0x5cf5df){return _0x5cf5df!==null&&!_[_0x5a31('0x37')](_0x5cf5df);};VoiceCallReport['prototype']['emit']=function(_0x4e7975,_0x53ab92,_0x235ca8){io['to'](_0x4e7975)[_0x5a31('0x38')](_0x53ab92,_0x235ca8);};VoiceCallReport['prototype'][_0x5a31('0x2b')]=function(_0x2eeda7){try{if(this[_0x5a31('0x36')](_0x2eeda7)){logger['info'](_0x5a31('0x39'),_0x2eeda7[_0x5a31('0x3a')],_0x2eeda7[_0x5a31('0x3b')],_0x2eeda7[_0x5a31('0x3c')]);logger[_0x5a31('0x3d')](_0x5a31('0x3e'),_0x2eeda7['uniqueid'],util[_0x5a31('0x34')](_0x2eeda7,{'showHidden':![],'depth':null}));if(_0x2eeda7[_0x5a31('0x3a')]===_0x2eeda7[_0x5a31('0x3f')]){if(!_[_0x5a31('0x37')](this[_0x5a31('0x1d')][_0x2eeda7[_0x5a31('0x3a')]])){_['merge'](this[_0x5a31('0x1d')][_0x2eeda7['uniqueid']],_['pick'](_0x2eeda7,_[_0x5a31('0x40')](this[_0x5a31('0x1d')][_0x2eeda7[_0x5a31('0x3a')]])));}}if(_0x2eeda7[_0x5a31('0x41')]===_0x5a31('0x42')){if(this[_0x5a31('0x1e')][_0x2eeda7[_0x5a31('0x43')][_0x5a31('0x44')]('-')[0x0]]){if(_0x2eeda7[_0x5a31('0x45')]==_0x5a31('0x46')){this[_0x5a31('0x1e')][_0x2eeda7['channel'][_0x5a31('0x44')]('-')[0x0]][_0x5a31('0x47')]=_0x2eeda7[_0x5a31('0x48')];this[_0x5a31('0x38')](util[_0x5a31('0x49')]('user:%s',this[_0x5a31('0x1e')][_0x2eeda7[_0x5a31('0x43')][_0x5a31('0x44')]('-')[0x0]]['name']),_0x5a31('0x4a'),{'destaccountcode':this['agents'][_0x2eeda7[_0x5a31('0x43')][_0x5a31('0x44')]('-')[0x0]][_0x5a31('0x4b')],'destconnectedlinenum':_0x2eeda7[_0x5a31('0x48')]});}}}}}catch(_0x392c92){logger[_0x5a31('0x4c')]('[%s][voiceCallReport][newcallerid]',_0x2eeda7[_0x5a31('0x3a')],util['inspect'](_0x392c92,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5a31('0x35')][_0x5a31('0x24')]=function(_0x4778a2){try{if(this['isNotNull'](_0x4778a2)){logger[_0x5a31('0x3d')](_0x5a31('0x4d'),_0x4778a2[_0x5a31('0x3a')],util['inspect'](_0x4778a2,{'showHidden':![],'depth':null}));if(_0x4778a2[_0x5a31('0x3a')]===_0x4778a2[_0x5a31('0x3f')]&&_0x4778a2[_0x5a31('0x43')]!=_0x5a31('0x4e')){if(_['isUndefined'](this['channels'][_0x4778a2[_0x5a31('0x3a')]])){logger[_0x5a31('0x32')]('[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s',_0x4778a2[_0x5a31('0x3a')],_0x4778a2['context'],_0x4778a2[_0x5a31('0x45')]);this[_0x5a31('0x1d')][_0x4778a2[_0x5a31('0x3a')]]=new Channel();this[_0x5a31('0x1d')][_0x4778a2[_0x5a31('0x3a')]]['starttime']=moment()[_0x5a31('0x49')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x5a31('0x1d')][_0x4778a2[_0x5a31('0x3a')]][_0x5a31('0x4f')]=dispositions[_[_0x5a31('0x50')](_0x4778a2[_0x5a31('0x51')])];_[_0x5a31('0x52')](this[_0x5a31('0x1d')][_0x4778a2[_0x5a31('0x3a')]],_[_0x5a31('0x53')](_0x4778a2,_[_0x5a31('0x40')](this[_0x5a31('0x1d')][_0x4778a2['uniqueid']])));if(_0x4778a2['context']==='from-sip'){if(this[_0x5a31('0x1e')][_0x4778a2['channel']['split']('-')[0x0]]){if(_[_0x5a31('0x37')](this[_0x5a31('0x1e')][_0x4778a2[_0x5a31('0x43')][_0x5a31('0x44')]('-')[0x0]][_0x5a31('0x47')])){this[_0x5a31('0x1e')][_0x4778a2[_0x5a31('0x43')][_0x5a31('0x44')]('-')[0x0]]['destconnectedlinenum']=_0x4778a2[_0x5a31('0x45')];logger[_0x5a31('0x3d')](_0x5a31('0x54'),_0x4778a2['uniqueid'],util[_0x5a31('0x34')]({'destaccountcode':this[_0x5a31('0x1e')][_0x4778a2[_0x5a31('0x43')][_0x5a31('0x44')]('-')[0x0]][_0x5a31('0x4b')],'destconnectedlinenum':_0x4778a2[_0x5a31('0x45')]},{'showHidden':![],'depth':null}));this['emit'](util[_0x5a31('0x49')](_0x5a31('0x55'),this[_0x5a31('0x1e')][_0x4778a2[_0x5a31('0x43')]['split']('-')[0x0]][_0x5a31('0x56')]),_0x5a31('0x4a'),{'destaccountcode':this[_0x5a31('0x1e')][_0x4778a2[_0x5a31('0x43')][_0x5a31('0x44')]('-')[0x0]][_0x5a31('0x4b')],'destconnectedlinenum':_0x4778a2[_0x5a31('0x45')]});}}}}}}}catch(_0x1d4318){logger[_0x5a31('0x4c')](_0x5a31('0x57'),_0x4778a2[_0x5a31('0x3a')],util[_0x5a31('0x34')](_0x1d4318,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5a31('0x35')][_0x5a31('0x20')]=function(_0xb2a8d9){try{if(this['isNotNull'](_0xb2a8d9)){logger[_0x5a31('0x3d')](_0x5a31('0x58'),_0xb2a8d9[_0x5a31('0x3a')],util[_0x5a31('0x34')](_0xb2a8d9,{'showHidden':![],'depth':null}));if(_0xb2a8d9[_0x5a31('0x3a')]===_0xb2a8d9[_0x5a31('0x3f')]&&_0xb2a8d9[_0x5a31('0x45')]!='h'&&_0xb2a8d9[_0x5a31('0x43')]!='OutgoingSpoolFailed'){_0xb2a8d9[_0x5a31('0x59')]=_0xb2a8d9[_0x5a31('0x59')][_0x5a31('0x5a')]();_0xb2a8d9[_0x5a31('0x5b')]=_0xb2a8d9[_0x5a31('0x5c')]&&_0xb2a8d9[_0x5a31('0x5c')][_0x5a31('0x5d')](_0x5a31('0x5e'))?_0xb2a8d9[_0x5a31('0x5c')]:(_0xb2a8d9['appdata']||_0xb2a8d9[_0x5a31('0x5b')])['toLowerCase']();logger[_0x5a31('0x32')](_0x5a31('0x5f'),_0xb2a8d9[_0x5a31('0x3a')],_0xb2a8d9['application'],_0xb2a8d9[_0x5a31('0x5b')]);if(_['isUndefined'](this[_0x5a31('0x1d')][_0xb2a8d9[_0x5a31('0x3a')]])){this[_0x5a31('0x1d')][_0xb2a8d9[_0x5a31('0x3a')]]=new Channel();this[_0x5a31('0x1d')][_0xb2a8d9[_0x5a31('0x3a')]][_0x5a31('0x60')]=_0xb2a8d9[_0x5a31('0x61')]?moment()[_0x5a31('0x62')](moment['duration'](_0xb2a8d9[_0x5a31('0x61')])[_0x5a31('0x63')](),_0x5a31('0x63'))['format']('YYYY-MM-DD\x20HH:mm:ss'):moment()[_0x5a31('0x49')](_0x5a31('0x64'));this['channels'][_0xb2a8d9[_0x5a31('0x3a')]][_0x5a31('0x4f')]='NO\x20ANSWER';}_[_0x5a31('0x52')](this['channels'][_0xb2a8d9['uniqueid']],_[_0x5a31('0x53')](_0xb2a8d9,_['keys'](this['channels'][_0xb2a8d9[_0x5a31('0x3a')]])));if(_[_0x5a31('0x65')](applications,_0xb2a8d9[_0x5a31('0x59')])){this['channels'][_0xb2a8d9['uniqueid']][_0x5a31('0x66')]=_0xb2a8d9['application'];this[_0x5a31('0x1d')][_0xb2a8d9[_0x5a31('0x3a')]][_0x5a31('0x67')]=_0xb2a8d9[_0x5a31('0x5b')];if(_0xb2a8d9[_0x5a31('0x59')]===_0x5a31('0x12')&&_[_0x5a31('0x5d')](_0xb2a8d9[_0x5a31('0x5b')][_0x5a31('0x5a')](),_0x5a31('0x68'))){var _0x16e3cd=_0xb2a8d9[_0x5a31('0x5b')][_0x5a31('0x44')]('=');var _0x1f6375=_0x16e3cd[0x0][_0x5a31('0x5a')]()[_0x5a31('0x69')](/cdr\((.*)\)/);if(_0x1f6375){this[_0x5a31('0x1d')][_0xb2a8d9[_0x5a31('0x3a')]][_0x1f6375[0x1]]=_0x16e3cd[0x1];}}else if(_0xb2a8d9[_0x5a31('0x59')]===_0x5a31('0x13')){this[_0x5a31('0x1d')][_0xb2a8d9[_0x5a31('0x3a')]][_0x5a31('0x13')]=_0xb2a8d9[_0x5a31('0x5b')][_0x5a31('0x44')](',')[0x0];}}}}}catch(_0x22053a){logger[_0x5a31('0x4c')](_0x5a31('0x6a'),_0xb2a8d9[_0x5a31('0x3a')],util['inspect'](_0x22053a,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncNewState']=function(_0x23bb1b){try{if(this[_0x5a31('0x36')](_0x23bb1b)){logger['info'](_0x5a31('0x6b'),_0x23bb1b['uniqueid'],_0x23bb1b[_0x5a31('0x3f')],_0x23bb1b[_0x5a31('0x3b')],_0x23bb1b[_0x5a31('0x3c')]);logger[_0x5a31('0x3d')](_0x5a31('0x6c'),_0x23bb1b[_0x5a31('0x3a')],util['inspect'](_0x23bb1b,{'showHidden':![],'depth':null}));if(_0x23bb1b[_0x5a31('0x3a')]!==_0x23bb1b['linkedid']){if(this[_0x5a31('0x1d')][_0x23bb1b[_0x5a31('0x3f')]]){if(_0x23bb1b[_0x5a31('0x51')]==='6'){if(!this[_0x5a31('0x1d')][_0x23bb1b[_0x5a31('0x3f')]][_0x5a31('0x6d')]){var _0x3fba50=moment();this[_0x5a31('0x1d')][_0x23bb1b['linkedid']][_0x5a31('0x6d')]=!![];this[_0x5a31('0x1d')][_0x23bb1b[_0x5a31('0x3f')]]['answertime']=_0x3fba50[_0x5a31('0x49')](_0x5a31('0x64'));if(this['channels'][_0x23bb1b['linkedid']][_0x5a31('0x60')]){this[_0x5a31('0x1d')][_0x23bb1b[_0x5a31('0x3f')]][_0x5a31('0x6e')]=_0x3fba50['diff'](this[_0x5a31('0x1d')][_0x23bb1b[_0x5a31('0x3f')]][_0x5a31('0x60')],_0x5a31('0x63'));}}this['channels'][_0x23bb1b[_0x5a31('0x3f')]]['linkedid']=_0x23bb1b[_0x5a31('0x3a')];if(_0x23bb1b[_0x5a31('0x3c')]!==_0x5a31('0x46')){this[_0x5a31('0x1d')][_0x23bb1b['linkedid']][_0x5a31('0x48')]=_0x23bb1b[_0x5a31('0x3c')];}this[_0x5a31('0x1d')][_0x23bb1b['linkedid']][_0x5a31('0x6f')]=_0x23bb1b[_0x5a31('0x3b')];this['channels'][_0x23bb1b[_0x5a31('0x3f')]][_0x5a31('0x70')]=_0x23bb1b[_0x5a31('0x43')];this[_0x5a31('0x1d')][_0x23bb1b[_0x5a31('0x3f')]][_0x5a31('0x4f')]=dispositions[_[_0x5a31('0x50')](_0x23bb1b[_0x5a31('0x51')])];if(this[_0x5a31('0x1e')][_0x23bb1b[_0x5a31('0x43')][_0x5a31('0x44')]('-')[0x0]]){this['channels'][_0x23bb1b['linkedid']][_0x5a31('0x71')]=this[_0x5a31('0x1e')][_0x23bb1b['channel'][_0x5a31('0x44')]('-')[0x0]]['id'];this[_0x5a31('0x1d')][_0x23bb1b[_0x5a31('0x3f')]][_0x5a31('0x72')]=this[_0x5a31('0x1e')][_0x23bb1b[_0x5a31('0x43')][_0x5a31('0x44')]('-')[0x0]][_0x5a31('0x56')];}}}}else{if(this[_0x5a31('0x1d')][_0x23bb1b[_0x5a31('0x3a')]]){if(_0x23bb1b[_0x5a31('0x51')]==='6'){if(this[_0x5a31('0x1e')][_0x23bb1b[_0x5a31('0x43')][_0x5a31('0x44')]('-')[0x0]]){this[_0x5a31('0x1d')][_0x23bb1b[_0x5a31('0x3a')]][_0x5a31('0x71')]=this['agents'][_0x23bb1b[_0x5a31('0x43')][_0x5a31('0x44')]('-')[0x0]]['id'];this[_0x5a31('0x1d')][_0x23bb1b['uniqueid']][_0x5a31('0x72')]=this[_0x5a31('0x1e')][_0x23bb1b[_0x5a31('0x43')]['split']('-')[0x0]][_0x5a31('0x56')];}}}}if(_0x23bb1b[_0x5a31('0x51')]==='6'&&_0x23bb1b[_0x5a31('0x41')]==='from-sip'){if(this[_0x5a31('0x1e')][_0x23bb1b[_0x5a31('0x43')][_0x5a31('0x44')]('-')[0x0]]){this[_0x5a31('0x1e')][_0x23bb1b[_0x5a31('0x43')]['split']('-')[0x0]][_0x5a31('0x47')]=_0x23bb1b[_0x5a31('0x45')];var _0x1165b2;if(this[_0x5a31('0x1d')][_0x23bb1b[_0x5a31('0x3a')]])_0x1165b2=this[_0x5a31('0x1d')][_0x23bb1b['uniqueid']][_0x5a31('0x73')];else if(this['channels'][_0x23bb1b['linkedid']])_0x1165b2=this['channels'][_0x23bb1b[_0x5a31('0x3f')]][_0x5a31('0x73')];logger[_0x5a31('0x3d')]('[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:',_0x23bb1b[_0x5a31('0x3a')],util[_0x5a31('0x34')]({'destaccountcode':this[_0x5a31('0x1e')][_0x23bb1b[_0x5a31('0x43')][_0x5a31('0x44')]('-')[0x0]][_0x5a31('0x4b')],'destconnectedlinenum':_0x23bb1b[_0x5a31('0x45')],'routealias':_0x1165b2},{'showHidden':![],'depth':null}));this[_0x5a31('0x38')](util[_0x5a31('0x49')](_0x5a31('0x55'),this[_0x5a31('0x1e')][_0x23bb1b[_0x5a31('0x43')][_0x5a31('0x44')]('-')[0x0]]['name']),_0x5a31('0x4a'),{'destaccountcode':this[_0x5a31('0x1e')][_0x23bb1b[_0x5a31('0x43')][_0x5a31('0x44')]('-')[0x0]][_0x5a31('0x4b')],'destconnectedlinenum':_0x23bb1b[_0x5a31('0x45')],'routealias':_0x1165b2});}}}}catch(_0x90f490){logger[_0x5a31('0x4c')](_0x5a31('0x74'),_0x23bb1b['uniqueid'],util[_0x5a31('0x34')](_0x90f490,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5a31('0x35')][_0x5a31('0x75')]=function(_0x27943c,_0x469131){try{if(this[_0x5a31('0x1d')][_0x27943c]){logger[_0x5a31('0x32')](_0x5a31('0x76'),_0x27943c,_0x469131);this['channels'][_0x27943c][_0x5a31('0x77')]=!![];if(_['endsWith'](_0x469131,_0x5a31('0x78'))){_0x469131=_0x469131[_0x5a31('0x79')](_0x5a31('0x78'),_0x5a31('0x7a'));}this[_0x5a31('0x1d')][_0x27943c]['monitorFilename']=_0x469131;var _0x55280d=_[_0x5a31('0x7b')](this[_0x5a31('0x1d')][_0x27943c][_0x5a31('0x7c')],{'filename':_0x469131});if(_[_0x5a31('0x7d')](_0x55280d)){this[_0x5a31('0x1d')][_0x27943c]['monitors']['push']({'filename':_0x469131,'createdAt':moment()[_0x5a31('0x49')](_0x5a31('0x64')),'mixmonitorid':'','status':'rec'});}}}catch(_0x469a12){logger[_0x5a31('0x4c')](_0x5a31('0x7e'),_0x27943c,util[_0x5a31('0x34')](_0x469a12,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5a31('0x35')]['syncVarSet']=function(_0x3ba3a4){try{if(this[_0x5a31('0x36')](_0x3ba3a4)){logger[_0x5a31('0x3d')](_0x5a31('0x7f'),_0x3ba3a4[_0x5a31('0x3a')],util[_0x5a31('0x34')](_0x3ba3a4,{'showHidden':![],'depth':null}));if(this[_0x5a31('0x1d')][_0x3ba3a4[_0x5a31('0x3a')]]&&_0x3ba3a4[_0x5a31('0x43')]!=_0x5a31('0x4e')){if(this[_0x5a31('0x36')](_0x3ba3a4[_0x5a31('0x80')])){if(this[_0x5a31('0x36')](_0x3ba3a4[_0x5a31('0x80')]['mixmonitor_filename'])){logger[_0x5a31('0x32')](_0x5a31('0x81'),_0x3ba3a4['uniqueid'],_0x3ba3a4[_0x5a31('0x82')]);this[_0x5a31('0x75')](_0x3ba3a4[_0x5a31('0x3a')],_0x3ba3a4[_0x5a31('0x82')]);}else if(this[_0x5a31('0x36')](_0x3ba3a4[_0x5a31('0x80')][_0x5a31('0x83')])){logger[_0x5a31('0x32')](_0x5a31('0x84'),_0x3ba3a4[_0x5a31('0x3a')],_0x3ba3a4['value']);this[_0x5a31('0x1d')][_0x3ba3a4[_0x5a31('0x3a')]][_0x5a31('0x3c')]=_0x3ba3a4[_0x5a31('0x82')];}else if(this[_0x5a31('0x36')](_0x3ba3a4[_0x5a31('0x80')][_0x5a31('0x85')])){logger[_0x5a31('0x32')](_0x5a31('0x86'),_0x3ba3a4[_0x5a31('0x3a')],_0x3ba3a4[_0x5a31('0x82')]);this[_0x5a31('0x1d')][_0x3ba3a4[_0x5a31('0x3a')]][_0x5a31('0x87')]=_0x3ba3a4[_0x5a31('0x82')];}else if(this[_0x5a31('0x36')](_0x3ba3a4[_0x5a31('0x80')][_0x5a31('0x88')])){logger[_0x5a31('0x32')](_0x5a31('0x89'),_0x3ba3a4[_0x5a31('0x3a')],_0x3ba3a4['value']);this[_0x5a31('0x1d')][_0x3ba3a4[_0x5a31('0x3a')]][_0x5a31('0x8a')]=_0x3ba3a4[_0x5a31('0x82')];}else if(this['isNotNull'](_0x3ba3a4['variable'][_0x5a31('0x8b')])){logger[_0x5a31('0x32')]('[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s',_0x3ba3a4[_0x5a31('0x3a')],_0x3ba3a4[_0x5a31('0x82')][_0x5a31('0x44')](',')[0x0]);this['channels'][_0x3ba3a4[_0x5a31('0x3a')]][_0x5a31('0x13')]=_0x3ba3a4[_0x5a31('0x82')][_0x5a31('0x44')](',')[0x0];}else if(this['isNotNull'](_0x3ba3a4[_0x5a31('0x80')][_0x5a31('0x8c')])){logger[_0x5a31('0x32')](_0x5a31('0x8d'),_0x3ba3a4[_0x5a31('0x3a')],_0x3ba3a4[_0x5a31('0x82')]);this[_0x5a31('0x1d')][_0x3ba3a4[_0x5a31('0x3a')]]['originatecalleridnum']=_0x3ba3a4[_0x5a31('0x82')];}else if(this[_0x5a31('0x36')](_0x3ba3a4['variable'][_0x5a31('0x8e')])){logger[_0x5a31('0x32')](_0x5a31('0x8f'),_0x3ba3a4[_0x5a31('0x3a')],_0x3ba3a4[_0x5a31('0x82')]);this['channels'][_0x3ba3a4[_0x5a31('0x3a')]]['destination']=_0x3ba3a4[_0x5a31('0x82')];}else if(this[_0x5a31('0x36')](_0x3ba3a4[_0x5a31('0x80')][_0x5a31('0x90')])){logger[_0x5a31('0x32')](_0x5a31('0x91'),_0x3ba3a4[_0x5a31('0x3a')],_0x3ba3a4[_0x5a31('0x82')]);this[_0x5a31('0x1d')][_0x3ba3a4[_0x5a31('0x3a')]][_0x5a31('0x92')]=_0x3ba3a4[_0x5a31('0x82')];}else if(this[_0x5a31('0x36')](_0x3ba3a4['variable'][_0x5a31('0x93')])){logger[_0x5a31('0x32')](_0x5a31('0x94'),_0x3ba3a4[_0x5a31('0x3a')],_0x3ba3a4[_0x5a31('0x82')]);this['channels'][_0x3ba3a4[_0x5a31('0x3a')]][_0x5a31('0x13')]=_0x3ba3a4[_0x5a31('0x82')];}else if(this[_0x5a31('0x36')](_0x3ba3a4[_0x5a31('0x80')][_0x5a31('0x95')])){logger['info'](_0x5a31('0x96'),_0x3ba3a4[_0x5a31('0x3a')],_0x3ba3a4[_0x5a31('0x82')]);this[_0x5a31('0x1d')][_0x3ba3a4[_0x5a31('0x3a')]]['sipcalluniqueid']=_0x3ba3a4[_0x5a31('0x82')];}}}else if(this['isNotNull'](_0x3ba3a4[_0x5a31('0x80')][_0x5a31('0x97')])){if(_0x3ba3a4[_0x5a31('0x82')]){var _0x2e02ed=path[_0x5a31('0x98')](_0x3ba3a4[_0x5a31('0x82')])[_0x5a31('0x56')];logger[_0x5a31('0x32')](_0x5a31('0x81'),_0x2e02ed,_0x3ba3a4['value']);this[_0x5a31('0x75')](_0x2e02ed,_0x3ba3a4['value']);}}else if(this[_0x5a31('0x1d')][_0x3ba3a4['linkedid']]){if(this[_0x5a31('0x36')](_0x3ba3a4[_0x5a31('0x80')])){if(this[_0x5a31('0x36')](_0x3ba3a4['variable'][_0x5a31('0x95')])){logger[_0x5a31('0x32')](_0x5a31('0x96'),_0x3ba3a4[_0x5a31('0x3f')],_0x3ba3a4[_0x5a31('0x82')]);this[_0x5a31('0x1d')][_0x3ba3a4[_0x5a31('0x3f')]]['sipcalllinkedid']=_0x3ba3a4[_0x5a31('0x82')];}}}}}catch(_0xcef67f){logger[_0x5a31('0x4c')](_0x5a31('0x99'),_0x3ba3a4[_0x5a31('0x3a')],util['inspect'](_0xcef67f,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x5a31('0x29')]=function(_0x5d285c){try{if(this[_0x5a31('0x36')](_0x5d285c)){logger[_0x5a31('0x3d')](_0x5a31('0x9a'),_0x5d285c[_0x5a31('0x3a')],util[_0x5a31('0x34')](_0x5d285c,{'showHidden':![],'depth':null}));if(this[_0x5a31('0x1d')][_0x5d285c[_0x5a31('0x3a')]]){logger[_0x5a31('0x32')](_0x5a31('0x9b'),_0x5d285c[_0x5a31('0x3a')],_0x5d285c[_0x5a31('0x9c')]);var _0x4425ac=moment();this[_0x5a31('0x1d')][_0x5d285c[_0x5a31('0x3a')]][_0x5a31('0x9d')]=_0x4425ac[_0x5a31('0x49')](_0x5a31('0x64'));this[_0x5a31('0x1d')][_0x5d285c[_0x5a31('0x3a')]]['duration']=_0x4425ac[_0x5a31('0x9e')](this['channels'][_0x5d285c[_0x5a31('0x3a')]][_0x5a31('0x60')],'seconds');if(this[_0x5a31('0x1d')][_0x5d285c['uniqueid']][_0x5a31('0x6d')]){this[_0x5a31('0x1d')][_0x5d285c[_0x5a31('0x3a')]][_0x5a31('0x9f')]=_0x4425ac['diff'](this[_0x5a31('0x1d')][_0x5d285c[_0x5a31('0x3a')]]['answertime'],'seconds');this[_0x5a31('0x1d')][_0x5d285c[_0x5a31('0x3a')]]['holdtime']=this[_0x5a31('0x1d')][_0x5d285c['uniqueid']][_0x5a31('0x61')]-this[_0x5a31('0x1d')][_0x5d285c[_0x5a31('0x3a')]][_0x5a31('0x9f')];}if(_0x5d285c['context']===_0x5a31('0x42')){if(this[_0x5a31('0x1e')][_0x5d285c[_0x5a31('0x43')][_0x5a31('0x44')]('-')[0x0]]){this[_0x5a31('0x1e')][_0x5d285c[_0x5a31('0x43')][_0x5a31('0x44')]('-')[0x0]]=_['omit'](this[_0x5a31('0x1e')][_0x5d285c[_0x5a31('0x43')]['split']('-')[0x0]],['destconnectedlinenum']);logger[_0x5a31('0x3d')](_0x5a31('0xa0'),_0x5d285c[_0x5a31('0x3a')],util[_0x5a31('0x34')]({'id':this['agents'][_0x5d285c[_0x5a31('0x43')][_0x5a31('0x44')]('-')[0x0]]['id'],'destaccountcode':this[_0x5a31('0x1e')][_0x5d285c[_0x5a31('0x43')][_0x5a31('0x44')]('-')[0x0]][_0x5a31('0x4b')]},{'showHidden':![],'depth':null}));this['emit'](util[_0x5a31('0x49')](_0x5a31('0x55'),this['agents'][_0x5d285c[_0x5a31('0x43')][_0x5a31('0x44')]('-')[0x0]][_0x5a31('0x56')]),'user:agentcomplete',{'id':this[_0x5a31('0x1e')][_0x5d285c['channel']['split']('-')[0x0]]['id'],'destaccountcode':this[_0x5a31('0x1e')][_0x5d285c[_0x5a31('0x43')][_0x5a31('0x44')]('-')[0x0]][_0x5a31('0x4b')]});}}var _0x13ad24=this;Promise[_0x5a31('0xa1')]()[_0x5a31('0xa2')](function(){var _0x5b34b3=_0x13ad24['channels'][_0x5d285c['uniqueid']];if(typeof _0x5b34b3['transferType']===_0x5a31('0xa3'))return;if(_[_0x5a31('0xa4')](_0x5b34b3[_0x5a31('0x7c')]))return;return RpcSetting[_0x5a31('0xa5')]()[_0x5a31('0xa2')](function(_0x5b1120){if(!_0x5b1120[_0x5a31('0xa6')])return;return Promise['resolve']()[_0x5a31('0xa2')](function(){return ami[_0x5a31('0xa7')]({'action':_0x5a31('0xa8'),'channel':_0x5b34b3[_0x5a31('0x43')]})[_0x5a31('0xa9')](function(){});})[_0x5a31('0xa2')](function(){return ami[_0x5a31('0xa7')]({'action':_0x5a31('0xa8'),'channel':_0x5b34b3[_0x5a31('0x70')]})['catch'](function(){})[_0x5a31('0xaa')](function(){var _0x12071c=_0x13ad24[_0x5a31('0x1e')][_0x5b34b3[_0x5a31('0x70')][_0x5a31('0x44')]('-')[0x0]];if(!_0x12071c)return;io['emit']('webbar:stopmonitors',{'agentId':_0x12071c['id'],'uniqueid':_0x5b34b3[_0x5a31('0x3a')]});});});});})[_0x5a31('0xa2')](function(){if(_0x5d285c[_0x5a31('0xab')]===_0x5a31('0xac')){_0x13ad24[_0x5a31('0x1f')][_0x5d285c['uniqueid']]=_0x13ad24[_0x5a31('0x1d')][_0x5d285c[_0x5a31('0x3a')]];}else{if(_0x13ad24[_0x5a31('0x1d')][_0x5d285c['uniqueid']][_0x5a31('0x8a')]===_0x5a31('0xad')&&_0x13ad24[_0x5a31('0x1f')][_0x5d285c['uniqueid']]){_0x13ad24[_0x5a31('0x1d')][_0x5d285c[_0x5a31('0x3a')]][_0x5a31('0x3a')]=[_0x13ad24[_0x5a31('0x1d')][_0x5d285c[_0x5a31('0x3a')]][_0x5a31('0x3f')],_0x13ad24[_0x5a31('0x1d')][_0x5d285c[_0x5a31('0x3a')]][_0x5a31('0x3f')]=_0x13ad24[_0x5a31('0x1d')][_0x5d285c[_0x5a31('0x3a')]][_0x5a31('0x3a')]][0x0];delete _0x13ad24[_0x5a31('0x1f')][_0x5d285c[_0x5a31('0x3a')]];}}logger[_0x5a31('0x3d')](_0x5a31('0xae'),_0x5d285c['uniqueid'],util[_0x5a31('0x34')](_0x13ad24['channels'][_0x5d285c[_0x5a31('0x3a')]],{'showHidden':![],'depth':null}));ami[_0x5a31('0x38')](_0x5a31('0xaf'),_0x13ad24[_0x5a31('0x1d')][_0x5d285c['uniqueid']]);delete _0x13ad24[_0x5a31('0x1d')][_0x5d285c[_0x5a31('0x3a')]];});}}}catch(_0x1be14e){logger['error'](_0x5a31('0xb0'),_0x5d285c['uniqueid'],util[_0x5a31('0x34')](_0x1be14e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5a31('0x35')]['syncAttendedTransfer']=function(_0x46e7e6){try{if(this[_0x5a31('0x36')](_0x46e7e6)){logger[_0x5a31('0x32')]('[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0x46e7e6[_0x5a31('0x3a')],_0x46e7e6[_0x5a31('0xb1')],_0x46e7e6['transfertargetcalleridnum']);logger['debug'](_0x5a31('0xb2'),_0x46e7e6['uniqueid'],util[_0x5a31('0x34')](_0x46e7e6,{'showHidden':![],'depth':null}));if(this[_0x5a31('0x1d')][_0x46e7e6['transfereeuniqueid']]){this[_0x5a31('0x1d')][_0x46e7e6[_0x5a31('0xb3')]][_0x5a31('0xb4')]=_0x46e7e6['origtransferercalleridnum'];this[_0x5a31('0x1d')][_0x46e7e6[_0x5a31('0xb3')]][_0x5a31('0xb5')]=_0x46e7e6[_0x5a31('0xb6')];if(this[_0x5a31('0x1d')][_0x46e7e6[_0x5a31('0xb7')]]){var _0xe73426=this[_0x5a31('0x1d')][_0x46e7e6[_0x5a31('0xb7')]];this[_0x5a31('0x1d')][_0x46e7e6['secondtransfereruniqueid']]=this['channels'][_0x46e7e6[_0x5a31('0xb3')]];this['channels'][_0x46e7e6[_0x5a31('0xb3')]]=_0xe73426;}}else if(this[_0x5a31('0x1d')][_0x46e7e6[_0x5a31('0xb8')]]){this[_0x5a31('0x1d')][_0x46e7e6['transfertargetuniqueid']]['transfercalleridnum']=_0x46e7e6['origtransferercalleridnum'];this[_0x5a31('0x1d')][_0x46e7e6[_0x5a31('0xb8')]]['transferconnectedlinenum']=_0x46e7e6['transfertargetcalleridnum'];if(this[_0x5a31('0x1d')][_0x46e7e6[_0x5a31('0xb9')]]){var _0xe73426=this['channels'][_0x46e7e6[_0x5a31('0xb9')]];this[_0x5a31('0x1d')][_0x46e7e6[_0x5a31('0xb9')]]=this[_0x5a31('0x1d')][_0x46e7e6[_0x5a31('0xb8')]];this[_0x5a31('0x1d')][_0x46e7e6[_0x5a31('0xb8')]]=_0xe73426;}}if((this['channels'][_0x46e7e6[_0x5a31('0xb9')]]||this['channels'][_0x46e7e6[_0x5a31('0xba')]])&&this['channels'][_0x46e7e6[_0x5a31('0xb7')]]){var _0x4bba9c=_['some']([this[_0x5a31('0x1d')][_0x46e7e6[_0x5a31('0xb9')]],this[_0x5a31('0x1d')][_0x46e7e6[_0x5a31('0xba')]],this[_0x5a31('0x1d')][_0x46e7e6[_0x5a31('0xb7')]]],function(_0x464e1e){return _0x464e1e&&_0x464e1e[_0x5a31('0x8a')]==='outbound'&&_0x464e1e['routeid'];});if(_0x4bba9c){if(this[_0x5a31('0x1d')][_0x46e7e6[_0x5a31('0xb9')]])this[_0x5a31('0x1d')][_0x46e7e6['origtransfereruniqueid']]['transferType']=_0x5a31('0xbb');if(this[_0x5a31('0x1d')][_0x46e7e6['origtransfererlinkedid']])this[_0x5a31('0x1d')][_0x46e7e6[_0x5a31('0xba')]][_0x5a31('0xbc')]=_0x5a31('0xbb');this[_0x5a31('0x1d')][_0x46e7e6[_0x5a31('0xb7')]][_0x5a31('0xbc')]='ATTENDED';}}}}catch(_0x1d32b8){logger['error'](_0x5a31('0xbd'),_0x46e7e6['uniqueid'],util[_0x5a31('0x34')](_0x1d32b8,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5a31('0x35')][_0x5a31('0x2d')]=function(_0x439420){try{if(this['isNotNull'](_0x439420)){logger[_0x5a31('0x32')](_0x5a31('0xbe'),_0x439420[_0x5a31('0x3a')],_0x439420[_0x5a31('0xbf')],_0x439420[_0x5a31('0xc0')]);logger[_0x5a31('0x3d')]('[%s][voiceCallReport][blindtransfer]\x20event:',_0x439420[_0x5a31('0x3a')],util['inspect'](_0x439420,{'showHidden':![],'depth':null}));if(this[_0x5a31('0x1d')][_0x439420[_0x5a31('0xb3')]]){this['channels'][_0x439420[_0x5a31('0xb3')]][_0x5a31('0xb4')]=_0x439420[_0x5a31('0xbf')];this[_0x5a31('0x1d')][_0x439420[_0x5a31('0xb3')]][_0x5a31('0xb5')]=_0x439420[_0x5a31('0xc0')];this['channels'][_0x439420[_0x5a31('0xb3')]][_0x5a31('0xbc')]=_0x5a31('0xc1');this['syncHangup']({'event':_0x5a31('0xac'),'uniqueid':_0x439420['transfereeuniqueid'],'context':_0x439420[_0x5a31('0x41')],'channel':_0x439420[_0x5a31('0xc2')]});}else{this[_0x5a31('0x1d')][_0x439420[_0x5a31('0xc3')]][_0x5a31('0xbc')]=_0x5a31('0xc1');}}}catch(_0x4c07bd){logger[_0x5a31('0x4c')](_0x5a31('0xc4'),_0x439420[_0x5a31('0x3a')],util[_0x5a31('0x34')](_0x4c07bd,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5a31('0x35')][_0x5a31('0x2f')]=function(_0x1bff2b){try{if(this[_0x5a31('0x36')](_0x1bff2b)){logger[_0x5a31('0x3d')](_0x5a31('0xc5'),_0x1bff2b['uniqueid'],util[_0x5a31('0x34')](_0x1bff2b,{'showHidden':![],'depth':null}));if(this[_0x5a31('0x1d')][_0x1bff2b[_0x5a31('0x3a')]]){if(!_[_0x5a31('0x7d')](this['channels'][_0x1bff2b[_0x5a31('0x3a')]]['answertime'])){this[_0x5a31('0x1d')][_0x1bff2b[_0x5a31('0x3a')]][_0x5a31('0xc6')]=moment()[_0x5a31('0x49')](_0x5a31('0x64'));logger['info'](_0x5a31('0xc7'),_0x1bff2b[_0x5a31('0x3a')],this[_0x5a31('0x1d')][_0x1bff2b[_0x5a31('0x3a')]]['mohstarttime']);}}}}catch(_0x423344){logger[_0x5a31('0x4c')](_0x5a31('0xc8'),_0x1bff2b['uniqueid'],util['inspect'](_0x423344,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5a31('0x35')][_0x5a31('0x31')]=function(_0x48ed82){try{if(this['isNotNull'](_0x48ed82)){logger[_0x5a31('0x3d')](_0x5a31('0xc9'),_0x48ed82[_0x5a31('0x3a')],util[_0x5a31('0x34')](_0x48ed82,{'showHidden':![],'depth':null}));if(this[_0x5a31('0x1d')][_0x48ed82[_0x5a31('0x3a')]]){if(!_[_0x5a31('0x7d')](this[_0x5a31('0x1d')][_0x48ed82[_0x5a31('0x3a')]][_0x5a31('0xc6')])){this['channels'][_0x48ed82[_0x5a31('0x3a')]]['mohtime']+=moment()[_0x5a31('0xca')](0x0)['diff'](this[_0x5a31('0x1d')][_0x48ed82[_0x5a31('0x3a')]][_0x5a31('0xc6')],_0x5a31('0x63'));logger[_0x5a31('0x32')]('[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s',_0x48ed82[_0x5a31('0x3a')],this[_0x5a31('0x1d')][_0x48ed82[_0x5a31('0x3a')]][_0x5a31('0xcb')]);delete this['channels'][_0x48ed82['uniqueid']][_0x5a31('0xc6')];}}}}catch(_0x3a87a1){logger['error'](_0x5a31('0xcc'),_0x48ed82[_0x5a31('0x3a')],util[_0x5a31('0x34')](_0x3a87a1,{'showHidden':![],'depth':null}));}};module[_0x5a31('0xcd')]=VoiceCallReport; \ No newline at end of file +var _0x7887=['mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','bluebird','lodash','moment','path','ioredis','../../../config/environment','../../../config/logger','ami','../model/channel','../rpc/setting','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','localhost','socket.io-emitter','channels','agents','coreshowchannel','syncNewExten','bind','newchannel','newstate','varset','syncVarSet','syncHangup','newcallerid','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','[voiceCallReport][coreshowchannels]\x20started','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isUndefined','emit','syncNewCallerId','info','calleridname','debug','uniqueid','linkedid','merge','pick','context','channel','split','exten','xcally-motion-preview','format','name','user:agentconnect','accountcode','connectedlinenum','[%s][voiceCallReport][newcallerid]','syncNewChannel','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','starttime','YYYY-MM-DD\x20HH:mm:ss','toNumber','channelstate','keys','destconnectedlinenum','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','user:%s','isNotNull','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','startsWith','CDR(routeAlias)','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','subtract','seconds','disposition','includes','lastapplication','lastdata','set','cdr(','match','queue','syncNewState','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','calleridnum','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','holdtime','diff','destinationchannel','UserId','membername','from-sip','routealias','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','replace','.wav49','.WAV','monitorFilename','find','monitors','isNil','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','type','xmd-queue','xmd-originatecalleridnum','originatecalleridnum','xmd-destination','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','sipcalllinkedid','[%s][voiceCallReport][varset]','endtime','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','resolve','transferType','undefined','then','stopRecordingOnTransfer','Action','StopMixMonitor','finally','webbar:stopmonitors','event','BlindTransfer','blindTransfers','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','origtransfererlinkedid','some','routeid','ATTENDED','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','extension','[%s][voiceCallReport][blindtransfer]\x20event:','transfereecalleridnum','BLIND','transfererchannel','transfereruniqueid','[%s][voiceCallReport][musiconholdstart]\x20event:','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','mohstarttime','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x7887,0xd8));var _0x7788=function(_0x54d086,_0x29e103){_0x54d086=_0x54d086-0x0;var _0x29dfbf=_0x7887[_0x54d086];return _0x29dfbf;};'use strict';var BPromise=require(_0x7788('0x0'));var _=require(_0x7788('0x1'));var moment=require(_0x7788('0x2'));var util=require('util');var path=require(_0x7788('0x3'));var Redis=require(_0x7788('0x4'));var config=require(_0x7788('0x5'));var logger=require(_0x7788('0x6'))(_0x7788('0x7'));var ami=require('../ami');var Channel=require(_0x7788('0x8'));var RpcSetting=require(_0x7788('0x9'));var statusDesc=[_0x7788('0xa'),_0x7788('0xb'),_0x7788('0xc'),_0x7788('0xd'),_0x7788('0xe'),_0x7788('0xf'),_0x7788('0x10'),_0x7788('0x11'),'onhold'];var applications=['set','queue',_0x7788('0x12'),_0x7788('0x13'),_0x7788('0x14'),_0x7788('0x15')];var dispositions=[_0x7788('0x16'),_0x7788('0x17'),_0x7788('0x17'),_0x7788('0x16'),_0x7788('0x16'),_0x7788('0x16'),_0x7788('0x18'),_0x7788('0x19'),'FAILED',_0x7788('0x17'),_0x7788('0x17')];var actions={};config[_0x7788('0x1a')]=_['defaults'](config['redis'],{'host':_0x7788('0x1b'),'port':0x18eb});var io=require(_0x7788('0x1c'))(new Redis(config['redis']));function VoiceCallReport(_0x54e6e5){this[_0x7788('0x1d')]=_0x54e6e5[_0x7788('0x1d')];this[_0x7788('0x1e')]=_0x54e6e5[_0x7788('0x1e')];this['blindTransfers']={};ami['on'](_0x7788('0x1f'),this[_0x7788('0x20')][_0x7788('0x21')](this));ami['on']('newexten',this[_0x7788('0x20')]['bind'](this));ami['on'](_0x7788('0x22'),this['syncNewChannel'][_0x7788('0x21')](this));ami['on'](_0x7788('0x23'),this['syncNewState'][_0x7788('0x21')](this));ami['on'](_0x7788('0x24'),this[_0x7788('0x25')]['bind'](this));ami['on']('hangup',this[_0x7788('0x26')][_0x7788('0x21')](this));ami['on'](_0x7788('0x27'),this['syncNewCallerId'][_0x7788('0x21')](this));ami['on'](_0x7788('0x28'),this[_0x7788('0x29')][_0x7788('0x21')](this));ami['on'](_0x7788('0x2a'),this[_0x7788('0x2b')]['bind'](this));ami['on']('musiconholdstart',this[_0x7788('0x2c')][_0x7788('0x21')](this));ami['on'](_0x7788('0x2d'),this[_0x7788('0x2e')][_0x7788('0x21')](this));try{logger['info'](_0x7788('0x2f'));ami['actionCoreShowChannels']();}catch(_0x5b6944){logger[_0x7788('0x30')](_0x7788('0x31'),util[_0x7788('0x32')](_0x5b6944,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x7788('0x33')]['isNotNull']=function(_0x32b5a6){return _0x32b5a6!==null&&!_[_0x7788('0x34')](_0x32b5a6);};VoiceCallReport['prototype'][_0x7788('0x35')]=function(_0x57da3c,_0xf9bcbe,_0x4f7466){io['to'](_0x57da3c)[_0x7788('0x35')](_0xf9bcbe,_0x4f7466);};VoiceCallReport[_0x7788('0x33')][_0x7788('0x36')]=function(_0x665a82){try{if(this['isNotNull'](_0x665a82)){logger[_0x7788('0x37')]('[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s',_0x665a82['uniqueid'],_0x665a82[_0x7788('0x38')],_0x665a82['calleridnum']);logger[_0x7788('0x39')]('[%s][voiceCallReport][newcallerid]\x20event:',_0x665a82[_0x7788('0x3a')],util[_0x7788('0x32')](_0x665a82,{'showHidden':![],'depth':null}));if(_0x665a82['uniqueid']===_0x665a82[_0x7788('0x3b')]){if(!_[_0x7788('0x34')](this[_0x7788('0x1d')][_0x665a82[_0x7788('0x3a')]])){_[_0x7788('0x3c')](this[_0x7788('0x1d')][_0x665a82[_0x7788('0x3a')]],_[_0x7788('0x3d')](_0x665a82,_['keys'](this[_0x7788('0x1d')][_0x665a82[_0x7788('0x3a')]])));}}if(_0x665a82[_0x7788('0x3e')]==='from-sip'){if(this[_0x7788('0x1e')][_0x665a82[_0x7788('0x3f')][_0x7788('0x40')]('-')[0x0]]){if(_0x665a82[_0x7788('0x41')]==_0x7788('0x42')){this[_0x7788('0x1e')][_0x665a82[_0x7788('0x3f')][_0x7788('0x40')]('-')[0x0]]['destconnectedlinenum']=_0x665a82['connectedlinenum'];this[_0x7788('0x35')](util[_0x7788('0x43')]('user:%s',this[_0x7788('0x1e')][_0x665a82[_0x7788('0x3f')][_0x7788('0x40')]('-')[0x0]][_0x7788('0x44')]),_0x7788('0x45'),{'destaccountcode':this[_0x7788('0x1e')][_0x665a82['channel']['split']('-')[0x0]][_0x7788('0x46')],'destconnectedlinenum':_0x665a82[_0x7788('0x47')]});}}}}}catch(_0x524653){logger[_0x7788('0x30')](_0x7788('0x48'),_0x665a82[_0x7788('0x3a')],util[_0x7788('0x32')](_0x524653,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7788('0x33')][_0x7788('0x49')]=function(_0x592ccf){try{if(this['isNotNull'](_0x592ccf)){logger[_0x7788('0x39')](_0x7788('0x4a'),_0x592ccf[_0x7788('0x3a')],util['inspect'](_0x592ccf,{'showHidden':![],'depth':null}));if(_0x592ccf['uniqueid']===_0x592ccf['linkedid']&&_0x592ccf[_0x7788('0x3f')]!=_0x7788('0x4b')){if(_[_0x7788('0x34')](this['channels'][_0x592ccf[_0x7788('0x3a')]])){logger['info'](_0x7788('0x4c'),_0x592ccf[_0x7788('0x3a')],_0x592ccf[_0x7788('0x3e')],_0x592ccf[_0x7788('0x41')]);this[_0x7788('0x1d')][_0x592ccf[_0x7788('0x3a')]]=new Channel();this[_0x7788('0x1d')][_0x592ccf[_0x7788('0x3a')]][_0x7788('0x4d')]=moment()[_0x7788('0x43')](_0x7788('0x4e'));this[_0x7788('0x1d')][_0x592ccf[_0x7788('0x3a')]]['disposition']=dispositions[_[_0x7788('0x4f')](_0x592ccf[_0x7788('0x50')])];_[_0x7788('0x3c')](this[_0x7788('0x1d')][_0x592ccf[_0x7788('0x3a')]],_[_0x7788('0x3d')](_0x592ccf,_[_0x7788('0x51')](this[_0x7788('0x1d')][_0x592ccf['uniqueid']])));if(_0x592ccf[_0x7788('0x3e')]==='from-sip'){if(this['agents'][_0x592ccf[_0x7788('0x3f')][_0x7788('0x40')]('-')[0x0]]){if(_[_0x7788('0x34')](this['agents'][_0x592ccf[_0x7788('0x3f')][_0x7788('0x40')]('-')[0x0]][_0x7788('0x52')])){this[_0x7788('0x1e')][_0x592ccf['channel']['split']('-')[0x0]][_0x7788('0x52')]=_0x592ccf[_0x7788('0x41')];logger[_0x7788('0x39')](_0x7788('0x53'),_0x592ccf['uniqueid'],util[_0x7788('0x32')]({'destaccountcode':this['agents'][_0x592ccf['channel']['split']('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x592ccf['exten']},{'showHidden':![],'depth':null}));this[_0x7788('0x35')](util[_0x7788('0x43')](_0x7788('0x54'),this[_0x7788('0x1e')][_0x592ccf[_0x7788('0x3f')][_0x7788('0x40')]('-')[0x0]]['name']),_0x7788('0x45'),{'destaccountcode':this[_0x7788('0x1e')][_0x592ccf[_0x7788('0x3f')][_0x7788('0x40')]('-')[0x0]][_0x7788('0x46')],'destconnectedlinenum':_0x592ccf[_0x7788('0x41')]});}}}}}}}catch(_0x3fa884){logger[_0x7788('0x30')]('[%s][voiceCallReport][newchannel]',_0x592ccf[_0x7788('0x3a')],util[_0x7788('0x32')](_0x3fa884,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7788('0x33')]['syncNewExten']=function(_0x2a6e86){try{if(this[_0x7788('0x55')](_0x2a6e86)){logger[_0x7788('0x39')](_0x7788('0x56'),_0x2a6e86[_0x7788('0x3a')],util[_0x7788('0x32')](_0x2a6e86,{'showHidden':![],'depth':null}));if(_0x2a6e86['uniqueid']===_0x2a6e86[_0x7788('0x3b')]&&_0x2a6e86['exten']!='h'&&_0x2a6e86[_0x7788('0x3f')]!='OutgoingSpoolFailed'){_0x2a6e86[_0x7788('0x57')]=_0x2a6e86[_0x7788('0x57')][_0x7788('0x58')]();_0x2a6e86[_0x7788('0x59')]=_0x2a6e86[_0x7788('0x5a')]&&_0x2a6e86['appdata'][_0x7788('0x5b')](_0x7788('0x5c'))?_0x2a6e86['appdata']:(_0x2a6e86[_0x7788('0x5a')]||_0x2a6e86['applicationdata'])[_0x7788('0x58')]();logger[_0x7788('0x37')](_0x7788('0x5d'),_0x2a6e86[_0x7788('0x3a')],_0x2a6e86[_0x7788('0x57')],_0x2a6e86[_0x7788('0x59')]);if(_[_0x7788('0x34')](this[_0x7788('0x1d')][_0x2a6e86['uniqueid']])){this[_0x7788('0x1d')][_0x2a6e86['uniqueid']]=new Channel();this[_0x7788('0x1d')][_0x2a6e86[_0x7788('0x3a')]][_0x7788('0x4d')]=_0x2a6e86[_0x7788('0x5e')]?moment()[_0x7788('0x5f')](moment['duration'](_0x2a6e86[_0x7788('0x5e')])[_0x7788('0x60')](),_0x7788('0x60'))[_0x7788('0x43')](_0x7788('0x4e')):moment()[_0x7788('0x43')](_0x7788('0x4e'));this['channels'][_0x2a6e86['uniqueid']][_0x7788('0x61')]=_0x7788('0x16');}_[_0x7788('0x3c')](this[_0x7788('0x1d')][_0x2a6e86[_0x7788('0x3a')]],_[_0x7788('0x3d')](_0x2a6e86,_['keys'](this[_0x7788('0x1d')][_0x2a6e86[_0x7788('0x3a')]])));if(_[_0x7788('0x62')](applications,_0x2a6e86[_0x7788('0x57')])){this[_0x7788('0x1d')][_0x2a6e86[_0x7788('0x3a')]][_0x7788('0x63')]=_0x2a6e86[_0x7788('0x57')];this[_0x7788('0x1d')][_0x2a6e86[_0x7788('0x3a')]][_0x7788('0x64')]=_0x2a6e86[_0x7788('0x59')];if(_0x2a6e86[_0x7788('0x57')]===_0x7788('0x65')&&_[_0x7788('0x5b')](_0x2a6e86['applicationdata'][_0x7788('0x58')](),_0x7788('0x66'))){var _0x26b86b=_0x2a6e86['applicationdata'][_0x7788('0x40')]('=');var _0x183557=_0x26b86b[0x0][_0x7788('0x58')]()[_0x7788('0x67')](/cdr\((.*)\)/);if(_0x183557){this['channels'][_0x2a6e86[_0x7788('0x3a')]][_0x183557[0x1]]=_0x26b86b[0x1];}}else if(_0x2a6e86[_0x7788('0x57')]===_0x7788('0x68')){this[_0x7788('0x1d')][_0x2a6e86[_0x7788('0x3a')]][_0x7788('0x68')]=_0x2a6e86[_0x7788('0x59')][_0x7788('0x40')](',')[0x0];}}}}}catch(_0xaaad94){logger[_0x7788('0x30')]('[%s][voiceCallReport][newexten]',_0x2a6e86[_0x7788('0x3a')],util[_0x7788('0x32')](_0xaaad94,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7788('0x33')][_0x7788('0x69')]=function(_0x359903){try{if(this['isNotNull'](_0x359903)){logger[_0x7788('0x37')](_0x7788('0x6a'),_0x359903[_0x7788('0x3a')],_0x359903[_0x7788('0x3b')],_0x359903['calleridname'],_0x359903[_0x7788('0x6b')]);logger[_0x7788('0x39')](_0x7788('0x6c'),_0x359903['uniqueid'],util[_0x7788('0x32')](_0x359903,{'showHidden':![],'depth':null}));if(_0x359903[_0x7788('0x3a')]!==_0x359903[_0x7788('0x3b')]){if(this[_0x7788('0x1d')][_0x359903[_0x7788('0x3b')]]){if(_0x359903['channelstate']==='6'){if(!this[_0x7788('0x1d')][_0x359903['linkedid']][_0x7788('0x6d')]){var _0x4ccbcb=moment();this[_0x7788('0x1d')][_0x359903[_0x7788('0x3b')]][_0x7788('0x6d')]=!![];this[_0x7788('0x1d')][_0x359903[_0x7788('0x3b')]][_0x7788('0x6e')]=_0x4ccbcb[_0x7788('0x43')](_0x7788('0x4e'));if(this[_0x7788('0x1d')][_0x359903[_0x7788('0x3b')]][_0x7788('0x4d')]){this['channels'][_0x359903[_0x7788('0x3b')]][_0x7788('0x6f')]=_0x4ccbcb[_0x7788('0x70')](this[_0x7788('0x1d')][_0x359903[_0x7788('0x3b')]][_0x7788('0x4d')],'seconds');}}this[_0x7788('0x1d')][_0x359903[_0x7788('0x3b')]]['linkedid']=_0x359903[_0x7788('0x3a')];if(_0x359903[_0x7788('0x6b')]!==_0x7788('0x42')){this['channels'][_0x359903[_0x7788('0x3b')]][_0x7788('0x47')]=_0x359903['calleridnum'];}this[_0x7788('0x1d')][_0x359903[_0x7788('0x3b')]]['connectedlinename']=_0x359903[_0x7788('0x38')];this[_0x7788('0x1d')][_0x359903['linkedid']][_0x7788('0x71')]=_0x359903[_0x7788('0x3f')];this['channels'][_0x359903[_0x7788('0x3b')]][_0x7788('0x61')]=dispositions[_[_0x7788('0x4f')](_0x359903['channelstate'])];if(this['agents'][_0x359903[_0x7788('0x3f')][_0x7788('0x40')]('-')[0x0]]){this[_0x7788('0x1d')][_0x359903['linkedid']][_0x7788('0x72')]=this[_0x7788('0x1e')][_0x359903[_0x7788('0x3f')][_0x7788('0x40')]('-')[0x0]]['id'];this[_0x7788('0x1d')][_0x359903['linkedid']][_0x7788('0x73')]=this[_0x7788('0x1e')][_0x359903[_0x7788('0x3f')][_0x7788('0x40')]('-')[0x0]]['name'];}}}}else{if(this[_0x7788('0x1d')][_0x359903[_0x7788('0x3a')]]){if(_0x359903['channelstate']==='6'){if(this['agents'][_0x359903['channel']['split']('-')[0x0]]){this[_0x7788('0x1d')][_0x359903['uniqueid']][_0x7788('0x72')]=this[_0x7788('0x1e')][_0x359903[_0x7788('0x3f')]['split']('-')[0x0]]['id'];this[_0x7788('0x1d')][_0x359903['uniqueid']][_0x7788('0x73')]=this[_0x7788('0x1e')][_0x359903[_0x7788('0x3f')][_0x7788('0x40')]('-')[0x0]][_0x7788('0x44')];}}}}if(_0x359903[_0x7788('0x50')]==='6'&&_0x359903[_0x7788('0x3e')]===_0x7788('0x74')){if(this[_0x7788('0x1e')][_0x359903['channel'][_0x7788('0x40')]('-')[0x0]]){this[_0x7788('0x1e')][_0x359903[_0x7788('0x3f')][_0x7788('0x40')]('-')[0x0]]['destconnectedlinenum']=_0x359903['exten'];var _0x4ab5c9;if(this[_0x7788('0x1d')][_0x359903[_0x7788('0x3a')]])_0x4ab5c9=this[_0x7788('0x1d')][_0x359903['uniqueid']][_0x7788('0x75')];else if(this[_0x7788('0x1d')][_0x359903[_0x7788('0x3b')]])_0x4ab5c9=this[_0x7788('0x1d')][_0x359903[_0x7788('0x3b')]]['routealias'];logger[_0x7788('0x39')]('[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:',_0x359903[_0x7788('0x3a')],util[_0x7788('0x32')]({'destaccountcode':this[_0x7788('0x1e')][_0x359903['channel'][_0x7788('0x40')]('-')[0x0]][_0x7788('0x46')],'destconnectedlinenum':_0x359903[_0x7788('0x41')],'routealias':_0x4ab5c9},{'showHidden':![],'depth':null}));this['emit'](util[_0x7788('0x43')](_0x7788('0x54'),this[_0x7788('0x1e')][_0x359903[_0x7788('0x3f')][_0x7788('0x40')]('-')[0x0]]['name']),_0x7788('0x45'),{'destaccountcode':this[_0x7788('0x1e')][_0x359903[_0x7788('0x3f')]['split']('-')[0x0]][_0x7788('0x46')],'destconnectedlinenum':_0x359903[_0x7788('0x41')],'routealias':_0x4ab5c9});}}}}catch(_0x289b49){logger['error'](_0x7788('0x76'),_0x359903[_0x7788('0x3a')],util[_0x7788('0x32')](_0x289b49,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7788('0x33')][_0x7788('0x77')]=function(_0x3c28eb,_0x426bab){try{if(this['channels'][_0x3c28eb]){logger['info'](_0x7788('0x78'),_0x3c28eb,_0x426bab);this[_0x7788('0x1d')][_0x3c28eb][_0x7788('0x79')]=!![];if(_[_0x7788('0x7a')](_0x426bab,'.wav49')){_0x426bab=_0x426bab[_0x7788('0x7b')](_0x7788('0x7c'),_0x7788('0x7d'));}this[_0x7788('0x1d')][_0x3c28eb][_0x7788('0x7e')]=_0x426bab;var _0x270e84=_[_0x7788('0x7f')](this[_0x7788('0x1d')][_0x3c28eb][_0x7788('0x80')],{'filename':_0x426bab});if(_[_0x7788('0x81')](_0x270e84)){this[_0x7788('0x1d')][_0x3c28eb]['monitors']['push']({'filename':_0x426bab,'createdAt':moment()['format'](_0x7788('0x4e')),'mixmonitorid':'','status':'rec'});}}}catch(_0x5a3140){logger[_0x7788('0x30')](_0x7788('0x82'),_0x3c28eb,util[_0x7788('0x32')](_0x5a3140,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7788('0x33')][_0x7788('0x25')]=function(_0x5a7588){try{if(this[_0x7788('0x55')](_0x5a7588)){logger[_0x7788('0x39')](_0x7788('0x83'),_0x5a7588['uniqueid'],util[_0x7788('0x32')](_0x5a7588,{'showHidden':![],'depth':null}));if(this[_0x7788('0x1d')][_0x5a7588[_0x7788('0x3a')]]&&_0x5a7588[_0x7788('0x3f')]!=_0x7788('0x4b')){if(this[_0x7788('0x55')](_0x5a7588[_0x7788('0x84')])){if(this['isNotNull'](_0x5a7588[_0x7788('0x84')][_0x7788('0x85')])){logger[_0x7788('0x37')](_0x7788('0x86'),_0x5a7588[_0x7788('0x3a')],_0x5a7588[_0x7788('0x87')]);this['syncMixMonitorFilename'](_0x5a7588[_0x7788('0x3a')],_0x5a7588[_0x7788('0x87')]);}else if(this[_0x7788('0x55')](_0x5a7588[_0x7788('0x84')]['xmd-phone'])){logger[_0x7788('0x37')](_0x7788('0x88'),_0x5a7588[_0x7788('0x3a')],_0x5a7588[_0x7788('0x87')]);this['channels'][_0x5a7588[_0x7788('0x3a')]][_0x7788('0x6b')]=_0x5a7588[_0x7788('0x87')];}else if(this[_0x7788('0x55')](_0x5a7588[_0x7788('0x84')][_0x7788('0x89')])){logger[_0x7788('0x37')](_0x7788('0x8a'),_0x5a7588['uniqueid'],_0x5a7588['value']);this['channels'][_0x5a7588[_0x7788('0x3a')]][_0x7788('0x8b')]=_0x5a7588[_0x7788('0x87')];}else if(this[_0x7788('0x55')](_0x5a7588['variable'][_0x7788('0x8c')])){logger[_0x7788('0x37')](_0x7788('0x8d'),_0x5a7588['uniqueid'],_0x5a7588[_0x7788('0x87')]);this[_0x7788('0x1d')][_0x5a7588[_0x7788('0x3a')]][_0x7788('0x8e')]=_0x5a7588['value'];}else if(this[_0x7788('0x55')](_0x5a7588[_0x7788('0x84')][_0x7788('0x8f')])){logger[_0x7788('0x37')]('[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s',_0x5a7588[_0x7788('0x3a')],_0x5a7588[_0x7788('0x87')]['split'](',')[0x0]);this['channels'][_0x5a7588['uniqueid']][_0x7788('0x68')]=_0x5a7588[_0x7788('0x87')][_0x7788('0x40')](',')[0x0];}else if(this[_0x7788('0x55')](_0x5a7588['variable'][_0x7788('0x90')])){logger[_0x7788('0x37')]('[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x5a7588['uniqueid'],_0x5a7588['value']);this[_0x7788('0x1d')][_0x5a7588[_0x7788('0x3a')]][_0x7788('0x91')]=_0x5a7588[_0x7788('0x87')];}else if(this['isNotNull'](_0x5a7588[_0x7788('0x84')][_0x7788('0x92')])){logger[_0x7788('0x37')]('[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s',_0x5a7588[_0x7788('0x3a')],_0x5a7588[_0x7788('0x87')]);this['channels'][_0x5a7588[_0x7788('0x3a')]][_0x7788('0x93')]=_0x5a7588[_0x7788('0x87')];}else if(this[_0x7788('0x55')](_0x5a7588[_0x7788('0x84')][_0x7788('0x94')])){logger[_0x7788('0x37')](_0x7788('0x95'),_0x5a7588[_0x7788('0x3a')],_0x5a7588[_0x7788('0x87')]);this['channels'][_0x5a7588[_0x7788('0x3a')]][_0x7788('0x96')]=_0x5a7588[_0x7788('0x87')];}else if(this['isNotNull'](_0x5a7588[_0x7788('0x84')]['xmcs-queue'])){logger[_0x7788('0x37')](_0x7788('0x97'),_0x5a7588[_0x7788('0x3a')],_0x5a7588[_0x7788('0x87')]);this['channels'][_0x5a7588[_0x7788('0x3a')]][_0x7788('0x68')]=_0x5a7588['value'];}else if(this['isNotNull'](_0x5a7588[_0x7788('0x84')][_0x7788('0x98')])){logger[_0x7788('0x37')](_0x7788('0x99'),_0x5a7588[_0x7788('0x3a')],_0x5a7588[_0x7788('0x87')]);this[_0x7788('0x1d')][_0x5a7588[_0x7788('0x3a')]][_0x7788('0x9a')]=_0x5a7588[_0x7788('0x87')];}}}else if(this[_0x7788('0x55')](_0x5a7588[_0x7788('0x84')][_0x7788('0x85')])){if(_0x5a7588[_0x7788('0x87')]){var _0x3281ff=path[_0x7788('0x9b')](_0x5a7588['value'])['name'];logger[_0x7788('0x37')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x3281ff,_0x5a7588['value']);this['syncMixMonitorFilename'](_0x3281ff,_0x5a7588[_0x7788('0x87')]);}}else if(this[_0x7788('0x1d')][_0x5a7588[_0x7788('0x3b')]]){if(this['isNotNull'](_0x5a7588['variable'])){if(this[_0x7788('0x55')](_0x5a7588[_0x7788('0x84')][_0x7788('0x98')])){logger[_0x7788('0x37')](_0x7788('0x99'),_0x5a7588['linkedid'],_0x5a7588['value']);this['channels'][_0x5a7588[_0x7788('0x3b')]][_0x7788('0x9c')]=_0x5a7588[_0x7788('0x87')];}}}}}catch(_0x3d0791){logger[_0x7788('0x30')](_0x7788('0x9d'),_0x5a7588[_0x7788('0x3a')],util[_0x7788('0x32')](_0x3d0791,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x7788('0x26')]=function(_0xe54af4){try{if(this[_0x7788('0x55')](_0xe54af4)){logger[_0x7788('0x39')]('[%s][voiceCallReport][hangup]\x20event:',_0xe54af4[_0x7788('0x3a')],util[_0x7788('0x32')](_0xe54af4,{'showHidden':![],'depth':null}));if(this[_0x7788('0x1d')][_0xe54af4[_0x7788('0x3a')]]){logger[_0x7788('0x37')]('[%s][voiceCallReport][hangup]\x20reason:%s',_0xe54af4[_0x7788('0x3a')],_0xe54af4['cause-txt']);var _0x5d35d1=moment();this[_0x7788('0x1d')][_0xe54af4[_0x7788('0x3a')]][_0x7788('0x9e')]=_0x5d35d1[_0x7788('0x43')](_0x7788('0x4e'));this[_0x7788('0x1d')][_0xe54af4[_0x7788('0x3a')]][_0x7788('0x5e')]=_0x5d35d1[_0x7788('0x70')](this[_0x7788('0x1d')][_0xe54af4[_0x7788('0x3a')]][_0x7788('0x4d')],_0x7788('0x60'));if(this[_0x7788('0x1d')][_0xe54af4[_0x7788('0x3a')]]['answered']){this[_0x7788('0x1d')][_0xe54af4[_0x7788('0x3a')]][_0x7788('0x9f')]=_0x5d35d1[_0x7788('0x70')](this[_0x7788('0x1d')][_0xe54af4[_0x7788('0x3a')]][_0x7788('0x6e')],_0x7788('0x60'));this['channels'][_0xe54af4['uniqueid']][_0x7788('0x6f')]=this[_0x7788('0x1d')][_0xe54af4[_0x7788('0x3a')]][_0x7788('0x5e')]-this[_0x7788('0x1d')][_0xe54af4[_0x7788('0x3a')]][_0x7788('0x9f')];}if(_0xe54af4[_0x7788('0x3e')]===_0x7788('0x74')){if(this[_0x7788('0x1e')][_0xe54af4[_0x7788('0x3f')][_0x7788('0x40')]('-')[0x0]]){this['agents'][_0xe54af4['channel'][_0x7788('0x40')]('-')[0x0]]=_[_0x7788('0xa0')](this[_0x7788('0x1e')][_0xe54af4[_0x7788('0x3f')][_0x7788('0x40')]('-')[0x0]],[_0x7788('0x52')]);logger[_0x7788('0x39')](_0x7788('0xa1'),_0xe54af4[_0x7788('0x3a')],util[_0x7788('0x32')]({'id':this[_0x7788('0x1e')][_0xe54af4['channel']['split']('-')[0x0]]['id'],'destaccountcode':this[_0x7788('0x1e')][_0xe54af4['channel']['split']('-')[0x0]][_0x7788('0x46')]},{'showHidden':![],'depth':null}));this[_0x7788('0x35')](util[_0x7788('0x43')](_0x7788('0x54'),this['agents'][_0xe54af4[_0x7788('0x3f')][_0x7788('0x40')]('-')[0x0]][_0x7788('0x44')]),_0x7788('0xa2'),{'id':this[_0x7788('0x1e')][_0xe54af4['channel']['split']('-')[0x0]]['id'],'destaccountcode':this['agents'][_0xe54af4['channel'][_0x7788('0x40')]('-')[0x0]][_0x7788('0x46')]});}}var _0x52abc6=this;Promise[_0x7788('0xa3')]()['then'](function(){var _0x32e0d9=_0x52abc6[_0x7788('0x1d')][_0xe54af4[_0x7788('0x3a')]];if(typeof _0x32e0d9[_0x7788('0xa4')]===_0x7788('0xa5'))return;if(_['isEmpty'](_0x32e0d9['monitors']))return;return RpcSetting['getSettings']()[_0x7788('0xa6')](function(_0x22edcd){if(!_0x22edcd[_0x7788('0xa7')])return;return Promise[_0x7788('0xa3')]()[_0x7788('0xa6')](function(){return ami[_0x7788('0xa8')]({'action':_0x7788('0xa9'),'channel':_0x32e0d9[_0x7788('0x3f')]})['catch'](function(){});})['then'](function(){return ami['Action']({'action':_0x7788('0xa9'),'channel':_0x32e0d9[_0x7788('0x71')]})['catch'](function(){})[_0x7788('0xaa')](function(){var _0x4cb157=_0x52abc6['agents'][_0x32e0d9['destinationchannel']['split']('-')[0x0]];if(!_0x4cb157)return;io['emit'](_0x7788('0xab'),{'agentId':_0x4cb157['id'],'uniqueid':_0x32e0d9[_0x7788('0x3a')]});});});});})[_0x7788('0xa6')](function(){if(_0xe54af4[_0x7788('0xac')]===_0x7788('0xad')){_0x52abc6[_0x7788('0xae')][_0xe54af4[_0x7788('0x3a')]]=_0x52abc6[_0x7788('0x1d')][_0xe54af4['uniqueid']];}else{if(_0x52abc6[_0x7788('0x1d')][_0xe54af4[_0x7788('0x3a')]][_0x7788('0x8e')]===_0x7788('0xaf')&&_0x52abc6[_0x7788('0xae')][_0xe54af4[_0x7788('0x3a')]]){_0x52abc6[_0x7788('0x1d')][_0xe54af4['uniqueid']][_0x7788('0x3a')]=[_0x52abc6['channels'][_0xe54af4[_0x7788('0x3a')]][_0x7788('0x3b')],_0x52abc6[_0x7788('0x1d')][_0xe54af4[_0x7788('0x3a')]][_0x7788('0x3b')]=_0x52abc6[_0x7788('0x1d')][_0xe54af4['uniqueid']][_0x7788('0x3a')]][0x0];delete _0x52abc6['blindTransfers'][_0xe54af4[_0x7788('0x3a')]];}}logger[_0x7788('0x39')](_0x7788('0xb0'),_0xe54af4['uniqueid'],util['inspect'](_0x52abc6[_0x7788('0x1d')][_0xe54af4[_0x7788('0x3a')]],{'showHidden':![],'depth':null}));ami[_0x7788('0x35')](_0x7788('0xb1'),_0x52abc6[_0x7788('0x1d')][_0xe54af4[_0x7788('0x3a')]]);delete _0x52abc6[_0x7788('0x1d')][_0xe54af4[_0x7788('0x3a')]];});}}}catch(_0x4c05d7){logger[_0x7788('0x30')](_0x7788('0xb2'),_0xe54af4[_0x7788('0x3a')],util[_0x7788('0x32')](_0x4c05d7,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7788('0x33')][_0x7788('0x29')]=function(_0x1dd4a5){try{if(this[_0x7788('0x55')](_0x1dd4a5)){logger['info'](_0x7788('0xb3'),_0x1dd4a5['uniqueid'],_0x1dd4a5['origtransferercalleridnum'],_0x1dd4a5[_0x7788('0xb4')]);logger[_0x7788('0x39')](_0x7788('0xb5'),_0x1dd4a5[_0x7788('0x3a')],util[_0x7788('0x32')](_0x1dd4a5,{'showHidden':![],'depth':null}));if(this[_0x7788('0x1d')][_0x1dd4a5[_0x7788('0xb6')]]){this[_0x7788('0x1d')][_0x1dd4a5['transfereeuniqueid']][_0x7788('0xb7')]=_0x1dd4a5[_0x7788('0xb8')];this['channels'][_0x1dd4a5[_0x7788('0xb6')]][_0x7788('0xb9')]=_0x1dd4a5[_0x7788('0xb4')];if(this[_0x7788('0x1d')][_0x1dd4a5[_0x7788('0xba')]]){var _0x94ba9e=this[_0x7788('0x1d')][_0x1dd4a5['secondtransfereruniqueid']];this[_0x7788('0x1d')][_0x1dd4a5['secondtransfereruniqueid']]=this[_0x7788('0x1d')][_0x1dd4a5[_0x7788('0xb6')]];this[_0x7788('0x1d')][_0x1dd4a5[_0x7788('0xb6')]]=_0x94ba9e;}}else if(this[_0x7788('0x1d')][_0x1dd4a5[_0x7788('0xbb')]]){this[_0x7788('0x1d')][_0x1dd4a5[_0x7788('0xbb')]][_0x7788('0xb7')]=_0x1dd4a5[_0x7788('0xb8')];this[_0x7788('0x1d')][_0x1dd4a5[_0x7788('0xbb')]][_0x7788('0xb9')]=_0x1dd4a5['transfertargetcalleridnum'];if(this['channels'][_0x1dd4a5[_0x7788('0xbc')]]){var _0x94ba9e=this[_0x7788('0x1d')][_0x1dd4a5[_0x7788('0xbc')]];this['channels'][_0x1dd4a5[_0x7788('0xbc')]]=this[_0x7788('0x1d')][_0x1dd4a5[_0x7788('0xbb')]];this[_0x7788('0x1d')][_0x1dd4a5[_0x7788('0xbb')]]=_0x94ba9e;}}if((this['channels'][_0x1dd4a5['origtransfereruniqueid']]||this['channels'][_0x1dd4a5[_0x7788('0xbd')]])&&this['channels'][_0x1dd4a5['secondtransfereruniqueid']]){var _0x16faff=_[_0x7788('0xbe')]([this[_0x7788('0x1d')][_0x1dd4a5[_0x7788('0xbc')]],this[_0x7788('0x1d')][_0x1dd4a5[_0x7788('0xbd')]],this['channels'][_0x1dd4a5[_0x7788('0xba')]]],function(_0x1c963e){return _0x1c963e&&_0x1c963e[_0x7788('0x8e')]===_0x7788('0xaf')&&_0x1c963e[_0x7788('0xbf')];});if(_0x16faff){if(this[_0x7788('0x1d')][_0x1dd4a5[_0x7788('0xbc')]])this[_0x7788('0x1d')][_0x1dd4a5[_0x7788('0xbc')]]['transferType']=_0x7788('0xc0');if(this[_0x7788('0x1d')][_0x1dd4a5[_0x7788('0xbd')]])this['channels'][_0x1dd4a5['origtransfererlinkedid']][_0x7788('0xa4')]=_0x7788('0xc0');this[_0x7788('0x1d')][_0x1dd4a5[_0x7788('0xba')]][_0x7788('0xa4')]=_0x7788('0xc0');}}}}catch(_0x2d4f09){logger[_0x7788('0x30')](_0x7788('0xc1'),_0x1dd4a5[_0x7788('0x3a')],util['inspect'](_0x2d4f09,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7788('0x33')][_0x7788('0x2b')]=function(_0x34468e){try{if(this[_0x7788('0x55')](_0x34468e)){logger[_0x7788('0x37')](_0x7788('0xc2'),_0x34468e[_0x7788('0x3a')],_0x34468e['transfereecalleridnum'],_0x34468e[_0x7788('0xc3')]);logger[_0x7788('0x39')](_0x7788('0xc4'),_0x34468e[_0x7788('0x3a')],util[_0x7788('0x32')](_0x34468e,{'showHidden':![],'depth':null}));if(this[_0x7788('0x1d')][_0x34468e[_0x7788('0xb6')]]){this['channels'][_0x34468e['transfereeuniqueid']][_0x7788('0xb7')]=_0x34468e[_0x7788('0xc5')];this[_0x7788('0x1d')][_0x34468e[_0x7788('0xb6')]][_0x7788('0xb9')]=_0x34468e['extension'];this[_0x7788('0x1d')][_0x34468e[_0x7788('0xb6')]][_0x7788('0xa4')]=_0x7788('0xc6');this['syncHangup']({'event':_0x7788('0xad'),'uniqueid':_0x34468e[_0x7788('0xb6')],'context':_0x34468e['context'],'channel':_0x34468e[_0x7788('0xc7')]});}else{this[_0x7788('0x1d')][_0x34468e[_0x7788('0xc8')]][_0x7788('0xa4')]=_0x7788('0xc6');}}}catch(_0x421df9){logger[_0x7788('0x30')]('[%s][voiceCallReport][blindtransfer]',_0x34468e[_0x7788('0x3a')],util[_0x7788('0x32')](_0x421df9,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncMusicOnHoldStart']=function(_0x4cc220){try{if(this[_0x7788('0x55')](_0x4cc220)){logger[_0x7788('0x39')](_0x7788('0xc9'),_0x4cc220[_0x7788('0x3a')],util[_0x7788('0x32')](_0x4cc220,{'showHidden':![],'depth':null}));if(this[_0x7788('0x1d')][_0x4cc220[_0x7788('0x3a')]]){if(!_['isNil'](this[_0x7788('0x1d')][_0x4cc220[_0x7788('0x3a')]]['answertime'])){this[_0x7788('0x1d')][_0x4cc220[_0x7788('0x3a')]]['mohstarttime']=moment()[_0x7788('0x43')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0x7788('0x37')](_0x7788('0xca'),_0x4cc220[_0x7788('0x3a')],this[_0x7788('0x1d')][_0x4cc220[_0x7788('0x3a')]][_0x7788('0xcb')]);}}}}catch(_0x463302){logger[_0x7788('0x30')](_0x7788('0xcc'),_0x4cc220[_0x7788('0x3a')],util[_0x7788('0x32')](_0x463302,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x7788('0x2e')]=function(_0x5432ae){try{if(this['isNotNull'](_0x5432ae)){logger[_0x7788('0x39')](_0x7788('0xcd'),_0x5432ae[_0x7788('0x3a')],util['inspect'](_0x5432ae,{'showHidden':![],'depth':null}));if(this[_0x7788('0x1d')][_0x5432ae[_0x7788('0x3a')]]){if(!_[_0x7788('0x81')](this[_0x7788('0x1d')][_0x5432ae[_0x7788('0x3a')]]['mohstarttime'])){this[_0x7788('0x1d')][_0x5432ae['uniqueid']][_0x7788('0xce')]+=moment()[_0x7788('0xcf')](0x0)[_0x7788('0x70')](this[_0x7788('0x1d')][_0x5432ae[_0x7788('0x3a')]][_0x7788('0xcb')],_0x7788('0x60'));logger[_0x7788('0x37')](_0x7788('0xd0'),_0x5432ae[_0x7788('0x3a')],this['channels'][_0x5432ae[_0x7788('0x3a')]]['mohtime']);delete this[_0x7788('0x1d')][_0x5432ae[_0x7788('0x3a')]][_0x7788('0xcb')];}}}}catch(_0x2b2e54){logger[_0x7788('0x30')](_0x7788('0xd1'),_0x5432ae[_0x7788('0x3a')],util[_0x7788('0x32')](_0x2b2e54,{'showHidden':![],'depth':null}));}};module[_0x7788('0xd2')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 350adeb..1b349fb 100644 --- a/server/services/ami/report/voiceDialReport.js +++ b/server/services/ami/report/voiceDialReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xba69=['addVariable','variable','value','variables','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','outboundrouteid','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','duration','diff','seconds','lastevent','total','answertime','answered','starttime','billableseconds','holdtime','sumBillable','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','[%s][voiceDialReport][newexten]\x20event:','application','toLowerCase','appdata','applicationdata','startsWith','cdr(','split','match','[%s][voiceDialReport][newexten]','lodash','moment','util','../../../config/environment','../../../config/logger','ami','redis','localhost','channels','outboundChannels','outbound','applications','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','varset','syncVarSet','newexten','syncNewExten','syncHangup','isNotNull','isUndefined','prototype','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','merge','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','omit','event','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','error','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:'];(function(_0x596680,_0x4e883a){var _0xc7c907=function(_0x7fa9b8){while(--_0x7fa9b8){_0x596680['push'](_0x596680['shift']());}};_0xc7c907(++_0x4e883a);}(_0xba69,0x1ab));var _0x9ba6=function(_0x29dec9,_0x19b1eb){_0x29dec9=_0x29dec9-0x0;var _0x5e61ba=_0xba69[_0x29dec9];return _0x5e61ba;};'use strict';var _=require(_0x9ba6('0x0'));var moment=require(_0x9ba6('0x1'));var util=require(_0x9ba6('0x2'));var Redis=require('ioredis');var config=require(_0x9ba6('0x3'));var logger=require(_0x9ba6('0x4'))(_0x9ba6('0x5'));var ami=require('../ami');config[_0x9ba6('0x6')]=_['defaults'](config[_0x9ba6('0x6')],{'host':_0x9ba6('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9ba6('0x6')]));function VoiceDialReport(_0x2aec11){this[_0x9ba6('0x8')]=_0x2aec11[_0x9ba6('0x9')];this[_0x9ba6('0xa')]=_0x2aec11[_0x9ba6('0xa')];this[_0x9ba6('0xb')]={};this['variables']={};ami['on'](_0x9ba6('0xc'),this[_0x9ba6('0xd')][_0x9ba6('0xe')](this));ami['on'](_0x9ba6('0xf'),this[_0x9ba6('0x10')][_0x9ba6('0xe')](this));ami['on'](_0x9ba6('0x11'),this[_0x9ba6('0x12')][_0x9ba6('0xe')](this));ami['on'](_0x9ba6('0x13'),this[_0x9ba6('0x14')][_0x9ba6('0xe')](this));ami['on']('hangup',this[_0x9ba6('0x15')][_0x9ba6('0xe')](this));}VoiceDialReport['prototype'][_0x9ba6('0x16')]=function(_0x2950af){return _0x2950af!==null&&!_[_0x9ba6('0x17')](_0x2950af);};VoiceDialReport[_0x9ba6('0x18')][_0x9ba6('0x19')]=function(_0xa3217e,_0x5e99d4,_0x326d5f){io['to'](_0xa3217e)['emit'](_0x5e99d4,_0x326d5f);};VoiceDialReport['prototype'][_0x9ba6('0xd')]=function(_0x4a0678){try{if(this[_0x9ba6('0x16')](_0x4a0678)){logger[_0x9ba6('0x1a')](_0x9ba6('0x1b'),_0x4a0678[_0x9ba6('0x1c')],util[_0x9ba6('0x1d')](_0x4a0678,{'showHidden':![],'depth':null}));if(this[_0x9ba6('0x8')][_0x4a0678[_0x9ba6('0x1c')]]){_[_0x9ba6('0x1e')](this['channels'][_0x4a0678[_0x9ba6('0x1c')]],{'starttime':moment()[_0x9ba6('0x1f')](_0x9ba6('0x20')),'lastevent':_0x9ba6('0x21'),'interface':_0x4a0678[_0x9ba6('0x22')][_0x9ba6('0x23')](0x0,_0x4a0678[_0x9ba6('0x22')][_0x9ba6('0x24')]('-')),'membername':_0x4a0678[_0x9ba6('0x22')][_0x9ba6('0x23')](_0x4a0678[_0x9ba6('0x22')][_0x9ba6('0x24')]('/')+0x1,_0x4a0678[_0x9ba6('0x22')][_0x9ba6('0x24')]('-'))},_[_0x9ba6('0x25')](_0x4a0678,[_0x9ba6('0x26'),'privilege']));logger[_0x9ba6('0x27')](_0x9ba6('0x28'),_0x4a0678[_0x9ba6('0x1c')],this[_0x9ba6('0x8')][_0x4a0678[_0x9ba6('0x1c')]][_0x9ba6('0x29')],this[_0x9ba6('0x8')][_0x4a0678[_0x9ba6('0x1c')]][_0x9ba6('0x2a')]);logger[_0x9ba6('0x1a')](_0x9ba6('0x2b'),_0x4a0678['uniqueid'],util['inspect'](this['channels'][_0x4a0678[_0x9ba6('0x1c')]],{'showHidden':![],'depth':null}));if(this['applications'][_0x4a0678[_0x9ba6('0x1c')]])_['merge'](this['channels'][_0x4a0678[_0x9ba6('0x1c')]],this[_0x9ba6('0xb')][_0x4a0678['uniqueid']]);this[_0x9ba6('0x19')](_0x9ba6('0x2c'),_0x9ba6('0x2d'),this[_0x9ba6('0x8')][_0x4a0678[_0x9ba6('0x1c')]]);logger['debug'](_0x9ba6('0x2e'),_0x4a0678[_0x9ba6('0x1c')],util[_0x9ba6('0x1d')](this['channels'][_0x4a0678[_0x9ba6('0x1c')]],{'showHidden':![],'depth':null}));ami[_0x9ba6('0x19')]('custom:dialbegin',this['channels'][_0x4a0678['uniqueid']]);}}}catch(_0x2ad1c9){logger[_0x9ba6('0x2f')]('[%s][voiceDialReport][dialbegin]',_0x4a0678[_0x9ba6('0x1c')],util[_0x9ba6('0x1d')](_0x2ad1c9,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x9ba6('0x18')][_0x9ba6('0x10')]=function(_0x5a11a3){try{if(this[_0x9ba6('0x16')](_0x5a11a3)){logger[_0x9ba6('0x1a')](_0x9ba6('0x30'),_0x5a11a3[_0x9ba6('0x1c')],util[_0x9ba6('0x1d')](_0x5a11a3,{'showHidden':![],'depth':null}));if(this[_0x9ba6('0x8')][_0x5a11a3[_0x9ba6('0x1c')]]){this[_0x9ba6('0x8')][_0x5a11a3[_0x9ba6('0x1c')]][_0x9ba6('0x31')]=_0x5a11a3['dialstatus'];if(_0x5a11a3[_0x9ba6('0x31')]===_0x9ba6('0x32')){this[_0x9ba6('0x8')][_0x5a11a3[_0x9ba6('0x1c')]][_0x9ba6('0x33')]=_0x5a11a3['connectedlinenum'];this['channels'][_0x5a11a3[_0x9ba6('0x1c')]]['connectedlinename']=_0x5a11a3[_0x9ba6('0x34')];this[_0x9ba6('0x8')][_0x5a11a3[_0x9ba6('0x1c')]]['answertime']=moment()[_0x9ba6('0x1f')](_0x9ba6('0x20'));this[_0x9ba6('0x8')][_0x5a11a3[_0x9ba6('0x1c')]]['lastevent']=_0x9ba6('0x35');logger[_0x9ba6('0x27')]('[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect',_0x5a11a3[_0x9ba6('0x1c')],_0x5a11a3['channel'][_0x9ba6('0x23')](_0x5a11a3[_0x9ba6('0x22')][_0x9ba6('0x24')]('/')+0x1,_0x5a11a3['channel']['lastIndexOf']('-')));logger[_0x9ba6('0x1a')](_0x9ba6('0x36'),_0x5a11a3['uniqueid'],util['inspect'](this[_0x9ba6('0x8')][_0x5a11a3['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x9ba6('0x19')]('custom:dialconnect',this[_0x9ba6('0x8')][_0x5a11a3['uniqueid']]);}logger[_0x9ba6('0x1a')]('[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:',_0x5a11a3['uniqueid'],util[_0x9ba6('0x1d')](this[_0x9ba6('0x8')][_0x5a11a3[_0x9ba6('0x1c')]],{'showHidden':![],'depth':null}));this['emit']('voice:outbound',_0x9ba6('0x2d'),this[_0x9ba6('0x8')][_0x5a11a3[_0x9ba6('0x1c')]]);}}}catch(_0x351f22){logger[_0x9ba6('0x2f')](_0x9ba6('0x37'),_0x5a11a3[_0x9ba6('0x1c')],util[_0x9ba6('0x1d')](_0x351f22,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x9ba6('0x18')]['syncVarSet']=function(_0x2413ad){try{if(this['isNotNull'](_0x2413ad)){logger[_0x9ba6('0x1a')](_0x9ba6('0x38'),_0x2413ad['uniqueid'],util[_0x9ba6('0x1d')](_0x2413ad,{'showHidden':![],'depth':null}));this[_0x9ba6('0x39')](_0x2413ad[_0x9ba6('0x1c')],_['keys'](_0x2413ad[_0x9ba6('0x3a')])[0x0],_0x2413ad[_0x9ba6('0x3b')]);if(this[_0x9ba6('0x16')](_0x2413ad[_0x9ba6('0x3a')])&&this[_0x9ba6('0x16')](_0x2413ad[_0x9ba6('0x3a')]['outboundrouteid'])){if(_[_0x9ba6('0x17')](this[_0x9ba6('0x8')][_0x2413ad[_0x9ba6('0x1c')]])){this[_0x9ba6('0x8')][_0x2413ad[_0x9ba6('0x1c')]]={'routeId':_0x2413ad['value'],'variables':this[_0x9ba6('0x3c')][_0x2413ad['uniqueid']]};logger[_0x9ba6('0x27')](_0x9ba6('0x3d'),_0x2413ad[_0x9ba6('0x1c')],_0x2413ad[_0x9ba6('0x3a')][_0x9ba6('0x3e')],_['keys'](_0x2413ad[_0x9ba6('0x3a')])[0x0],_0x2413ad[_0x9ba6('0x3b')]);logger[_0x9ba6('0x1a')](_0x9ba6('0x3f'),_0x2413ad[_0x9ba6('0x1c')],util[_0x9ba6('0x1d')](this[_0x9ba6('0x8')][_0x2413ad[_0x9ba6('0x1c')]],{'showHidden':![],'depth':null}));this[_0x9ba6('0x19')](_0x9ba6('0x2c'),_0x9ba6('0x2d'),this['channels'][_0x2413ad[_0x9ba6('0x1c')]]);}}}}catch(_0x1926ae){logger['error'](_0x9ba6('0x40'),_0x2413ad[_0x9ba6('0x1c')],util[_0x9ba6('0x1d')](_0x1926ae,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x9ba6('0x39')]=function(_0x4eb549,_0x254f0d,_0x2c1abc){var _0x52a910=[_0x9ba6('0x41'),_0x9ba6('0x42'),_0x9ba6('0x43'),_0x9ba6('0x44'),_0x9ba6('0x45'),_0x9ba6('0x46'),_0x9ba6('0x47'),_0x9ba6('0x48'),_0x9ba6('0x49'),_0x9ba6('0x4a'),_0x9ba6('0x4b'),_0x9ba6('0x4c'),'membercalls',_0x9ba6('0x4d'),_0x9ba6('0x4e'),_0x9ba6('0x4f'),_0x9ba6('0x29'),_0x9ba6('0x50'),_0x9ba6('0x51')];if(!_[_0x9ba6('0x52')](_0x254f0d)&&!_[_0x9ba6('0x53')](_0x52a910,_0x254f0d)){if(_[_0x9ba6('0x17')](this['variables'][_0x4eb549])){this['variables'][_0x4eb549]={};}this[_0x9ba6('0x3c')][_0x4eb549][_0x254f0d]=_0x2c1abc;}};VoiceDialReport[_0x9ba6('0x18')][_0x9ba6('0x15')]=function(_0x26e2c7){try{if(this[_0x9ba6('0x16')](_0x26e2c7)){logger['debug'](_0x9ba6('0x54'),_0x26e2c7['uniqueid'],util[_0x9ba6('0x1d')](_0x26e2c7,{'showHidden':![],'depth':null}));if(this['channels'][_0x26e2c7[_0x9ba6('0x1c')]]){logger[_0x9ba6('0x27')](_0x9ba6('0x55'),_0x26e2c7[_0x9ba6('0x1c')],_0x26e2c7[_0x9ba6('0x56')]);this[_0x9ba6('0x8')][_0x26e2c7[_0x9ba6('0x1c')]][_0x9ba6('0x57')]=moment()[_0x9ba6('0x1f')](_0x9ba6('0x20'));this[_0x9ba6('0x8')][_0x26e2c7[_0x9ba6('0x1c')]][_0x9ba6('0x58')]=moment(this[_0x9ba6('0x8')][_0x26e2c7[_0x9ba6('0x1c')]][_0x9ba6('0x57')])[_0x9ba6('0x59')](this['channels'][_0x26e2c7[_0x9ba6('0x1c')]]['starttime'],_0x9ba6('0x5a'));this[_0x9ba6('0x8')][_0x26e2c7[_0x9ba6('0x1c')]][_0x9ba6('0x5b')]='complete';this[_0x9ba6('0xa')][_0x9ba6('0x5c')]+=0x1;if(this['channels'][_0x26e2c7[_0x9ba6('0x1c')]][_0x9ba6('0x5d')]){this[_0x9ba6('0xa')][_0x9ba6('0x5e')]+=0x1;this[_0x9ba6('0x8')][_0x26e2c7['uniqueid']]['holdtime']=moment(this[_0x9ba6('0x8')][_0x26e2c7[_0x9ba6('0x1c')]][_0x9ba6('0x5d')])[_0x9ba6('0x59')](this[_0x9ba6('0x8')][_0x26e2c7[_0x9ba6('0x1c')]][_0x9ba6('0x5f')],_0x9ba6('0x5a'));this[_0x9ba6('0x8')][_0x26e2c7[_0x9ba6('0x1c')]][_0x9ba6('0x60')]=moment(this[_0x9ba6('0x8')][_0x26e2c7[_0x9ba6('0x1c')]][_0x9ba6('0x57')])[_0x9ba6('0x59')](this[_0x9ba6('0x8')][_0x26e2c7['uniqueid']][_0x9ba6('0x5d')],'seconds');this[_0x9ba6('0xa')]['sumHoldTime']+=this[_0x9ba6('0x8')][_0x26e2c7['uniqueid']][_0x9ba6('0x61')]||0x0;this[_0x9ba6('0xa')][_0x9ba6('0x62')]+=this[_0x9ba6('0x8')][_0x26e2c7[_0x9ba6('0x1c')]][_0x9ba6('0x60')];}this['outbound'][_0x9ba6('0x63')]+=this[_0x9ba6('0x8')][_0x26e2c7['uniqueid']][_0x9ba6('0x58')];logger[_0x9ba6('0x1a')](_0x9ba6('0x64'),_0x26e2c7[_0x9ba6('0x1c')],util[_0x9ba6('0x1d')](this[_0x9ba6('0x8')][_0x26e2c7['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x9ba6('0x19')]('custom:voiceDialReport',this[_0x9ba6('0x8')][_0x26e2c7['uniqueid']]);logger['debug'](_0x9ba6('0x65'),_0x26e2c7['uniqueid'],util['inspect'](this[_0x9ba6('0x8')][_0x26e2c7[_0x9ba6('0x1c')]],{'showHidden':![],'depth':null}));ami[_0x9ba6('0x19')]('custom:dialend',this[_0x9ba6('0x8')][_0x26e2c7[_0x9ba6('0x1c')]]);logger['debug'](_0x9ba6('0x66'),_0x26e2c7[_0x9ba6('0x1c')],util['inspect'](this[_0x9ba6('0x8')][_0x26e2c7[_0x9ba6('0x1c')]],{'showHidden':![],'depth':null}));this[_0x9ba6('0x19')](_0x9ba6('0x2c'),_0x9ba6('0x67'),this[_0x9ba6('0xa')]);logger[_0x9ba6('0x27')](_0x9ba6('0x68'),JSON[_0x9ba6('0x69')](this['channels'][_0x26e2c7[_0x9ba6('0x1c')]]));logger[_0x9ba6('0x1a')](_0x9ba6('0x6a'),_0x26e2c7[_0x9ba6('0x1c')],util[_0x9ba6('0x1d')](this['channels'][_0x26e2c7['uniqueid']],{'showHidden':![],'depth':null}));this[_0x9ba6('0x19')](_0x9ba6('0x2c'),_0x9ba6('0x6b'),this[_0x9ba6('0x8')][_0x26e2c7[_0x9ba6('0x1c')]]);delete this[_0x9ba6('0x8')][_0x26e2c7['uniqueid']];}else if(this[_0x9ba6('0x8')][_0x26e2c7[_0x9ba6('0x6c')]]){this[_0x9ba6('0x8')][_0x26e2c7[_0x9ba6('0x6c')]]['uniqueid']=this['channels'][_0x26e2c7['linkedid']][_0x9ba6('0x6d')];}if(this[_0x9ba6('0x3c')][_0x26e2c7[_0x9ba6('0x1c')]]){delete this[_0x9ba6('0x3c')][_0x26e2c7[_0x9ba6('0x1c')]];}}}catch(_0x54849e){logger['error'](_0x9ba6('0x6e'),_0x26e2c7[_0x9ba6('0x1c')],util['inspect'](_0x54849e,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x9ba6('0x18')]['syncNewExten']=function(_0x43c79c){try{if(this[_0x9ba6('0x16')](_0x43c79c)){logger['debug'](_0x9ba6('0x6f'),_0x43c79c['uniqueid'],util[_0x9ba6('0x1d')](_0x43c79c,{'showHidden':![],'depth':null}));if(_0x43c79c[_0x9ba6('0x70')][_0x9ba6('0x71')]()==='set'){_0x43c79c['applicationdata']=(_0x43c79c[_0x9ba6('0x72')]||_0x43c79c[_0x9ba6('0x73')])[_0x9ba6('0x71')]();if(_[_0x9ba6('0x74')](_0x43c79c[_0x9ba6('0x73')],_0x9ba6('0x75'))){if(_[_0x9ba6('0x17')](this[_0x9ba6('0xb')][_0x43c79c[_0x9ba6('0x1c')]]))this[_0x9ba6('0xb')][_0x43c79c[_0x9ba6('0x1c')]]={};logger['info']('[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s',_0x43c79c[_0x9ba6('0x1c')],_0x43c79c[_0x9ba6('0x70')],_0x43c79c[_0x9ba6('0x73')]);var _0x29b2dc=_0x43c79c['applicationdata'][_0x9ba6('0x76')]('=');var _0x4d5bfc=_0x29b2dc[0x0][_0x9ba6('0x77')](/cdr\((.*)\)/);if(_0x4d5bfc)this[_0x9ba6('0xb')][_0x43c79c[_0x9ba6('0x1c')]][_0x4d5bfc[0x1]]=_0x29b2dc[0x1];}}}}catch(_0x4572e7){logger[_0x9ba6('0x2f')](_0x9ba6('0x78'),_0x43c79c[_0x9ba6('0x1c')],util[_0x9ba6('0x1d')](_0x4572e7,{'showHidden':![],'depth':null}));}};module['exports']=VoiceDialReport; \ No newline at end of file +var _0xa6eb=['holdtime','starttime','billableseconds','sumBillable','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','voice_outbound_channel:remove','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','[%s][voiceDialReport][newexten]\x20event:','application','toLowerCase','set','applicationdata','appdata','startsWith','cdr(','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','split','match','[%s][voiceDialReport][newexten]','exports','lodash','moment','util','../../../config/environment','../../../config/logger','ami','defaults','socket.io-emitter','redis','channels','outboundChannels','outbound','applications','variables','dialbegin','syncDialBegin','bind','dialend','varset','newexten','syncNewExten','syncHangup','prototype','isUndefined','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','inspect','merge','uniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','syncDialEnd','isNotNull','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','answertime','lastevent','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','[%s][voiceDialReport][dialend]','syncVarSet','addVariable','keys','variable','value','outboundrouteid','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','memberdynamic','memberinterface','memberpenalty','isNil','includes','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','endtime','duration','diff','seconds','complete','answered'];(function(_0x1e4f2f,_0x35edfa){var _0xccea89=function(_0x164386){while(--_0x164386){_0x1e4f2f['push'](_0x1e4f2f['shift']());}};_0xccea89(++_0x35edfa);}(_0xa6eb,0x111));var _0xba6e=function(_0x4679f8,_0x840f7d){_0x4679f8=_0x4679f8-0x0;var _0x2eee8d=_0xa6eb[_0x4679f8];return _0x2eee8d;};'use strict';var _=require(_0xba6e('0x0'));var moment=require(_0xba6e('0x1'));var util=require(_0xba6e('0x2'));var Redis=require('ioredis');var config=require(_0xba6e('0x3'));var logger=require(_0xba6e('0x4'))(_0xba6e('0x5'));var ami=require('../ami');config['redis']=_[_0xba6e('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xba6e('0x7'))(new Redis(config[_0xba6e('0x8')]));function VoiceDialReport(_0x174693){this[_0xba6e('0x9')]=_0x174693[_0xba6e('0xa')];this[_0xba6e('0xb')]=_0x174693['outbound'];this[_0xba6e('0xc')]={};this[_0xba6e('0xd')]={};ami['on'](_0xba6e('0xe'),this[_0xba6e('0xf')][_0xba6e('0x10')](this));ami['on'](_0xba6e('0x11'),this['syncDialEnd'][_0xba6e('0x10')](this));ami['on'](_0xba6e('0x12'),this['syncVarSet']['bind'](this));ami['on'](_0xba6e('0x13'),this[_0xba6e('0x14')][_0xba6e('0x10')](this));ami['on']('hangup',this[_0xba6e('0x15')][_0xba6e('0x10')](this));}VoiceDialReport[_0xba6e('0x16')]['isNotNull']=function(_0x1cbf08){return _0x1cbf08!==null&&!_[_0xba6e('0x17')](_0x1cbf08);};VoiceDialReport[_0xba6e('0x16')][_0xba6e('0x18')]=function(_0x2b2d6d,_0x3299dd,_0x1af2cf){io['to'](_0x2b2d6d)[_0xba6e('0x18')](_0x3299dd,_0x1af2cf);};VoiceDialReport[_0xba6e('0x16')][_0xba6e('0xf')]=function(_0x3a37f3){try{if(this['isNotNull'](_0x3a37f3)){logger[_0xba6e('0x19')](_0xba6e('0x1a'),_0x3a37f3['uniqueid'],util[_0xba6e('0x1b')](_0x3a37f3,{'showHidden':![],'depth':null}));if(this[_0xba6e('0x9')][_0x3a37f3['uniqueid']]){_[_0xba6e('0x1c')](this['channels'][_0x3a37f3[_0xba6e('0x1d')]],{'starttime':moment()[_0xba6e('0x1e')](_0xba6e('0x1f')),'lastevent':_0xba6e('0x20'),'interface':_0x3a37f3[_0xba6e('0x21')][_0xba6e('0x22')](0x0,_0x3a37f3[_0xba6e('0x21')][_0xba6e('0x23')]('-')),'membername':_0x3a37f3[_0xba6e('0x21')][_0xba6e('0x22')](_0x3a37f3[_0xba6e('0x21')][_0xba6e('0x23')]('/')+0x1,_0x3a37f3[_0xba6e('0x21')][_0xba6e('0x23')]('-'))},_['omit'](_0x3a37f3,['event','privilege']));logger[_0xba6e('0x24')](_0xba6e('0x25'),_0x3a37f3[_0xba6e('0x1d')],this[_0xba6e('0x9')][_0x3a37f3[_0xba6e('0x1d')]][_0xba6e('0x26')],this[_0xba6e('0x9')][_0x3a37f3[_0xba6e('0x1d')]][_0xba6e('0x27')]);logger[_0xba6e('0x19')]('[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:',_0x3a37f3['uniqueid'],util[_0xba6e('0x1b')](this[_0xba6e('0x9')][_0x3a37f3[_0xba6e('0x1d')]],{'showHidden':![],'depth':null}));if(this[_0xba6e('0xc')][_0x3a37f3['uniqueid']])_[_0xba6e('0x1c')](this['channels'][_0x3a37f3[_0xba6e('0x1d')]],this[_0xba6e('0xc')][_0x3a37f3[_0xba6e('0x1d')]]);this[_0xba6e('0x18')]('voice:outbound',_0xba6e('0x28'),this[_0xba6e('0x9')][_0x3a37f3[_0xba6e('0x1d')]]);logger[_0xba6e('0x19')](_0xba6e('0x29'),_0x3a37f3[_0xba6e('0x1d')],util[_0xba6e('0x1b')](this[_0xba6e('0x9')][_0x3a37f3[_0xba6e('0x1d')]],{'showHidden':![],'depth':null}));ami[_0xba6e('0x18')](_0xba6e('0x2a'),this[_0xba6e('0x9')][_0x3a37f3['uniqueid']]);}}}catch(_0x4dd1ea){logger[_0xba6e('0x2b')](_0xba6e('0x2c'),_0x3a37f3[_0xba6e('0x1d')],util['inspect'](_0x4dd1ea,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xba6e('0x16')][_0xba6e('0x2d')]=function(_0x4c1278){try{if(this[_0xba6e('0x2e')](_0x4c1278)){logger[_0xba6e('0x19')](_0xba6e('0x2f'),_0x4c1278['uniqueid'],util['inspect'](_0x4c1278,{'showHidden':![],'depth':null}));if(this[_0xba6e('0x9')][_0x4c1278[_0xba6e('0x1d')]]){this[_0xba6e('0x9')][_0x4c1278[_0xba6e('0x1d')]][_0xba6e('0x30')]=_0x4c1278['dialstatus'];if(_0x4c1278[_0xba6e('0x30')]===_0xba6e('0x31')){this[_0xba6e('0x9')][_0x4c1278[_0xba6e('0x1d')]][_0xba6e('0x32')]=_0x4c1278['connectedlinenum'];this[_0xba6e('0x9')][_0x4c1278['uniqueid']]['connectedlinename']=_0x4c1278['connectedlinename'];this[_0xba6e('0x9')][_0x4c1278[_0xba6e('0x1d')]][_0xba6e('0x33')]=moment()[_0xba6e('0x1e')](_0xba6e('0x1f'));this[_0xba6e('0x9')][_0x4c1278[_0xba6e('0x1d')]][_0xba6e('0x34')]=_0xba6e('0x35');logger[_0xba6e('0x24')](_0xba6e('0x36'),_0x4c1278[_0xba6e('0x1d')],_0x4c1278['channel'][_0xba6e('0x22')](_0x4c1278['channel'][_0xba6e('0x23')]('/')+0x1,_0x4c1278['channel'][_0xba6e('0x23')]('-')));logger[_0xba6e('0x19')](_0xba6e('0x37'),_0x4c1278['uniqueid'],util['inspect'](this[_0xba6e('0x9')][_0x4c1278[_0xba6e('0x1d')]],{'showHidden':![],'depth':null}));ami[_0xba6e('0x18')](_0xba6e('0x38'),this[_0xba6e('0x9')][_0x4c1278[_0xba6e('0x1d')]]);}logger[_0xba6e('0x19')](_0xba6e('0x39'),_0x4c1278[_0xba6e('0x1d')],util[_0xba6e('0x1b')](this[_0xba6e('0x9')][_0x4c1278['uniqueid']],{'showHidden':![],'depth':null}));this['emit'](_0xba6e('0x3a'),_0xba6e('0x28'),this[_0xba6e('0x9')][_0x4c1278[_0xba6e('0x1d')]]);}}}catch(_0x2bbe84){logger[_0xba6e('0x2b')](_0xba6e('0x3b'),_0x4c1278[_0xba6e('0x1d')],util[_0xba6e('0x1b')](_0x2bbe84,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xba6e('0x16')][_0xba6e('0x3c')]=function(_0x479eef){try{if(this['isNotNull'](_0x479eef)){logger[_0xba6e('0x19')]('[%s][voiceDialReport][varset]\x20event:',_0x479eef[_0xba6e('0x1d')],util[_0xba6e('0x1b')](_0x479eef,{'showHidden':![],'depth':null}));this[_0xba6e('0x3d')](_0x479eef[_0xba6e('0x1d')],_[_0xba6e('0x3e')](_0x479eef[_0xba6e('0x3f')])[0x0],_0x479eef[_0xba6e('0x40')]);if(this[_0xba6e('0x2e')](_0x479eef[_0xba6e('0x3f')])&&this[_0xba6e('0x2e')](_0x479eef[_0xba6e('0x3f')][_0xba6e('0x41')])){if(_[_0xba6e('0x17')](this[_0xba6e('0x9')][_0x479eef[_0xba6e('0x1d')]])){this[_0xba6e('0x9')][_0x479eef[_0xba6e('0x1d')]]={'routeId':_0x479eef[_0xba6e('0x40')],'variables':this[_0xba6e('0xd')][_0x479eef[_0xba6e('0x1d')]]};logger[_0xba6e('0x24')](_0xba6e('0x42'),_0x479eef[_0xba6e('0x1d')],_0x479eef['variable'][_0xba6e('0x41')],_[_0xba6e('0x3e')](_0x479eef[_0xba6e('0x3f')])[0x0],_0x479eef['value']);logger[_0xba6e('0x19')](_0xba6e('0x43'),_0x479eef[_0xba6e('0x1d')],util['inspect'](this[_0xba6e('0x9')][_0x479eef[_0xba6e('0x1d')]],{'showHidden':![],'depth':null}));this['emit'](_0xba6e('0x3a'),_0xba6e('0x28'),this[_0xba6e('0x9')][_0x479eef[_0xba6e('0x1d')]]);}}}}catch(_0x24cc6a){logger['error'](_0xba6e('0x44'),_0x479eef['uniqueid'],util['inspect'](_0x24cc6a,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xba6e('0x16')][_0xba6e('0x3d')]=function(_0x5afef3,_0x58e51c,_0x1d1df3){var _0x68ff56=[_0xba6e('0x45'),_0xba6e('0x46'),_0xba6e('0x47'),_0xba6e('0x48'),_0xba6e('0x49'),_0xba6e('0x4a'),'rtpaudioqosrtt',_0xba6e('0x4b'),_0xba6e('0x4c'),_0xba6e('0x4d'),_0xba6e('0x4e'),_0xba6e('0x4f'),'membercalls',_0xba6e('0x50'),_0xba6e('0x51'),'memberlastcall',_0xba6e('0x26'),_0xba6e('0x52'),'memberrealtime'];if(!_[_0xba6e('0x53')](_0x58e51c)&&!_[_0xba6e('0x54')](_0x68ff56,_0x58e51c)){if(_[_0xba6e('0x17')](this[_0xba6e('0xd')][_0x5afef3])){this[_0xba6e('0xd')][_0x5afef3]={};}this[_0xba6e('0xd')][_0x5afef3][_0x58e51c]=_0x1d1df3;}};VoiceDialReport[_0xba6e('0x16')][_0xba6e('0x15')]=function(_0x1e2f26){try{if(this[_0xba6e('0x2e')](_0x1e2f26)){logger[_0xba6e('0x19')](_0xba6e('0x55'),_0x1e2f26[_0xba6e('0x1d')],util[_0xba6e('0x1b')](_0x1e2f26,{'showHidden':![],'depth':null}));if(this[_0xba6e('0x9')][_0x1e2f26['uniqueid']]){logger[_0xba6e('0x24')](_0xba6e('0x56'),_0x1e2f26['uniqueid'],_0x1e2f26['cause-txt']);this[_0xba6e('0x9')][_0x1e2f26[_0xba6e('0x1d')]][_0xba6e('0x57')]=moment()[_0xba6e('0x1e')](_0xba6e('0x1f'));this[_0xba6e('0x9')][_0x1e2f26[_0xba6e('0x1d')]][_0xba6e('0x58')]=moment(this[_0xba6e('0x9')][_0x1e2f26[_0xba6e('0x1d')]]['endtime'])[_0xba6e('0x59')](this[_0xba6e('0x9')][_0x1e2f26[_0xba6e('0x1d')]]['starttime'],_0xba6e('0x5a'));this[_0xba6e('0x9')][_0x1e2f26['uniqueid']]['lastevent']=_0xba6e('0x5b');this[_0xba6e('0xb')]['total']+=0x1;if(this[_0xba6e('0x9')][_0x1e2f26['uniqueid']]['answertime']){this['outbound'][_0xba6e('0x5c')]+=0x1;this[_0xba6e('0x9')][_0x1e2f26[_0xba6e('0x1d')]][_0xba6e('0x5d')]=moment(this['channels'][_0x1e2f26['uniqueid']][_0xba6e('0x33')])[_0xba6e('0x59')](this['channels'][_0x1e2f26[_0xba6e('0x1d')]][_0xba6e('0x5e')],'seconds');this[_0xba6e('0x9')][_0x1e2f26[_0xba6e('0x1d')]][_0xba6e('0x5f')]=moment(this['channels'][_0x1e2f26[_0xba6e('0x1d')]][_0xba6e('0x57')])[_0xba6e('0x59')](this[_0xba6e('0x9')][_0x1e2f26[_0xba6e('0x1d')]][_0xba6e('0x33')],'seconds');this[_0xba6e('0xb')]['sumHoldTime']+=this[_0xba6e('0x9')][_0x1e2f26[_0xba6e('0x1d')]][_0xba6e('0x5d')]||0x0;this['outbound'][_0xba6e('0x60')]+=this['channels'][_0x1e2f26[_0xba6e('0x1d')]][_0xba6e('0x5f')];}this[_0xba6e('0xb')][_0xba6e('0x61')]+=this[_0xba6e('0x9')][_0x1e2f26[_0xba6e('0x1d')]][_0xba6e('0x58')];logger['debug'](_0xba6e('0x62'),_0x1e2f26[_0xba6e('0x1d')],util[_0xba6e('0x1b')](this[_0xba6e('0x9')][_0x1e2f26['uniqueid']],{'showHidden':![],'depth':null}));ami['emit'](_0xba6e('0x63'),this[_0xba6e('0x9')][_0x1e2f26[_0xba6e('0x1d')]]);logger[_0xba6e('0x19')]('[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:',_0x1e2f26['uniqueid'],util[_0xba6e('0x1b')](this[_0xba6e('0x9')][_0x1e2f26['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xba6e('0x18')](_0xba6e('0x64'),this[_0xba6e('0x9')][_0x1e2f26[_0xba6e('0x1d')]]);logger[_0xba6e('0x19')](_0xba6e('0x65'),_0x1e2f26['uniqueid'],util[_0xba6e('0x1b')](this[_0xba6e('0x9')][_0x1e2f26[_0xba6e('0x1d')]],{'showHidden':![],'depth':null}));this[_0xba6e('0x18')](_0xba6e('0x3a'),_0xba6e('0x66'),this['outbound']);logger['info'](_0xba6e('0x67'),JSON[_0xba6e('0x68')](this[_0xba6e('0x9')][_0x1e2f26['uniqueid']]));logger['debug']('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:',_0x1e2f26[_0xba6e('0x1d')],util[_0xba6e('0x1b')](this[_0xba6e('0x9')][_0x1e2f26['uniqueid']],{'showHidden':![],'depth':null}));this['emit'](_0xba6e('0x3a'),_0xba6e('0x69'),this[_0xba6e('0x9')][_0x1e2f26[_0xba6e('0x1d')]]);delete this[_0xba6e('0x9')][_0x1e2f26[_0xba6e('0x1d')]];}else if(this[_0xba6e('0x9')][_0x1e2f26[_0xba6e('0x6a')]]){this[_0xba6e('0x9')][_0x1e2f26['linkedid']]['uniqueid']=this[_0xba6e('0x9')][_0x1e2f26[_0xba6e('0x6a')]][_0xba6e('0x6b')];}if(this[_0xba6e('0xd')][_0x1e2f26[_0xba6e('0x1d')]]){delete this[_0xba6e('0xd')][_0x1e2f26['uniqueid']];}}}catch(_0x1e8327){logger[_0xba6e('0x2b')](_0xba6e('0x6c'),_0x1e2f26[_0xba6e('0x1d')],util[_0xba6e('0x1b')](_0x1e8327,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xba6e('0x16')][_0xba6e('0x14')]=function(_0x4120ae){try{if(this[_0xba6e('0x2e')](_0x4120ae)){logger['debug'](_0xba6e('0x6d'),_0x4120ae[_0xba6e('0x1d')],util['inspect'](_0x4120ae,{'showHidden':![],'depth':null}));if(_0x4120ae[_0xba6e('0x6e')][_0xba6e('0x6f')]()===_0xba6e('0x70')){_0x4120ae[_0xba6e('0x71')]=(_0x4120ae[_0xba6e('0x72')]||_0x4120ae['applicationdata'])[_0xba6e('0x6f')]();if(_[_0xba6e('0x73')](_0x4120ae[_0xba6e('0x71')],_0xba6e('0x74'))){if(_[_0xba6e('0x17')](this[_0xba6e('0xc')][_0x4120ae[_0xba6e('0x1d')]]))this['applications'][_0x4120ae['uniqueid']]={};logger[_0xba6e('0x24')](_0xba6e('0x75'),_0x4120ae[_0xba6e('0x1d')],_0x4120ae[_0xba6e('0x6e')],_0x4120ae[_0xba6e('0x71')]);var _0x55d618=_0x4120ae[_0xba6e('0x71')][_0xba6e('0x76')]('=');var _0x109855=_0x55d618[0x0][_0xba6e('0x77')](/cdr\((.*)\)/);if(_0x109855)this['applications'][_0x4120ae['uniqueid']][_0x109855[0x1]]=_0x55d618[0x1];}}}}catch(_0x37cfed){logger[_0xba6e('0x2b')](_0xba6e('0x78'),_0x4120ae[_0xba6e('0x1d')],util[_0xba6e('0x1b')](_0x37cfed,{'showHidden':![],'depth':null}));}};module[_0xba6e('0x79')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 16151ea..2849040 100644 --- a/server/services/ami/report/voiceQueueReport.js +++ b/server/services/ami/report/voiceQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x345e=['position','count','routealias','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','merge','pick','keys','push','[%s][voiceQueueReport][queuecallerjoin]','last','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitreason','ABANDONED','[%s][voiceQueueReport][queuecallerabandon]','[%s][voiceQueueReport][queuecallerleave]','connectedlinenum','connectedlinename','[%s][voiceQueueReport][agentconnect]','queuecallercomplete','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','syncAgentComplete','assigned','lastAssignedTo','membername','queuecallerexit','transfer','reason','COMPLETED','startsWith','local/','linkedid','queuecallerexitAt','queuecallerjoinAt','add','FORWARDTRANSFER','transfertype','FORWARD','transferexten','destexten','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','toUpperCase','agentcomplete','[%s][voiceQueueReport][agentcomplete]','syncVarSet','[%s][voiceQueueReport][varset]','addVariable','variable','value','CONTINUE','TIMEOUT','lastevent','timeout','queuecallerleaveAt','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','queueposition','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','memberdynamic','memberinterface','memberlastcall','includes','syncHangup','seconds','length','milliseconds','diff','sumBillable','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','custom:queuecallerunmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','cause-txt','[%s][voiceQueueReport][hangup]','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfererexten','transferuniqueid','ATTENDEDTRANSFER','ATTENDED','secondtransfereruniqueid','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfereruniqueid','BLINDTRANSFER','BLIND','extension','BlindTransfer','context','[%s][voiceQueueReport][blindtransfer]','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','[%s][voiceQueueReport][musiconholdstop]','[%s][voiceQueueReport][newexten]\x20event:','application','toLowerCase','appdata','CDR(routeAlias)','applicationdata','cdr(','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','split','match','exports','lodash','moment','md5','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/queueReport','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','queueReports','agents','channels','queueChannels','voiceQueues','flagQueueSummary','campaigns','queuesummary','bind','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','agentconnect','syncAgentConnect','varset','hangup','fullybooted','syncFullyBooted','newexten','syncNewExten','musiconholdstart','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','isEmpty','hasOwnProperty','originated','talking','pTalking','waiting','unlockRR','switch','isNil','Action','channel','catch','message','No\x20such\x20channel','error','[%s][voiceQueueReport][checkChannel]','inspect','[%s][voiceQueueReport][checkQueueReport]','variables','[%s][voiceQueueReport][checkVariables]','clearQueueReport','clearqueuereport','emit','emitVoiceQueueChannelSave','debug','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','format','voice:queue:%s','name','emitVoiceQueueChannelRemove',']\x20sending\x20voice_queue_channel:remove\x20event:','voice_queue_channel:remove','voice_queue_presence:remove','emitVoiceQueueSummary','inbound','answered','loggedIn','sumDuration','sumHoldTime','total','type','unmanaged','abandoned','Trunk','callerid','Interval','stringify','[voiceQueueReport][',']\x20sending\x20voice_queue:save\x20event:','voice_queue:save','isNotNull','loopQueueShow','[voiceQueueReport][queues]','loopQueueSummary','[voiceQueueReport][queuesummary]','syncQueueSummary','queue','[voiceQueueReport][queuesummary]\x20event:','info','countBy','callers','toNumber','loggedin','available','[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:','custom:queuesummary','[voiceQueueReport][queuesummarycomplete]\x20event:','isUndefined'];(function(_0x17799e,_0x2cf533){var _0x21313e=function(_0x54a6b2){while(--_0x54a6b2){_0x17799e['push'](_0x17799e['shift']());}};_0x21313e(++_0x2cf533);}(_0x345e,0x168));var _0xe345=function(_0x399b24,_0x2d6c6a){_0x399b24=_0x399b24-0x0;var _0x5971c7=_0x345e[_0x399b24];return _0x5971c7;};'use strict';var _=require(_0xe345('0x0'));var moment=require(_0xe345('0x1'));var util=require('util');var md5=require(_0xe345('0x2'));var Redis=require(_0xe345('0x3'));var config=require(_0xe345('0x4'));var logger=require(_0xe345('0x5'))(_0xe345('0x6'));var ami=require(_0xe345('0x7'));var QueueReport=require(_0xe345('0x8'));config[_0xe345('0x9')]=_[_0xe345('0xa')](config['redis'],{'host':_0xe345('0xb'),'port':0x18eb});var io=require(_0xe345('0xc'))(new Redis(config[_0xe345('0x9')]));var Sequence=function(){};Sequence[_0xe345('0xd')][_0xe345('0xe')]=function(_0x18f9a3){this['tail']=this['tail']?this[_0xe345('0xf')][_0xe345('0x10')](_0x18f9a3):_0x18f9a3();};function VoiceQueueReport(_0x322dc6){this[_0xe345('0x11')]=new Sequence();this[_0xe345('0x12')]={};this[_0xe345('0x13')]=_0x322dc6[_0xe345('0x13')];this[_0xe345('0x14')]=_0x322dc6[_0xe345('0x15')];this[_0xe345('0x16')]=_0x322dc6['voiceQueues'];this[_0xe345('0x17')]=!![];this[_0xe345('0x18')]=_0x322dc6['campaigns'];this['variables']={};ami['on'](_0xe345('0x19'),this['syncQueueSummary'][_0xe345('0x1a')](this));ami['on']('queuesummarycomplete',this['syncQueueSummaryComplete'][_0xe345('0x1a')](this));ami['on'](_0xe345('0x1b'),this[_0xe345('0x1c')][_0xe345('0x1a')](this));ami['on'](_0xe345('0x1d'),this[_0xe345('0x1e')][_0xe345('0x1a')](this));ami['on'](_0xe345('0x1f'),this[_0xe345('0x20')][_0xe345('0x1a')](this));ami['on']('agentcomplete',this['syncAgentComplete'][_0xe345('0x1a')](this));ami['on'](_0xe345('0x21'),this[_0xe345('0x22')][_0xe345('0x1a')](this));ami['on'](_0xe345('0x23'),this['syncVarSet'][_0xe345('0x1a')](this));ami['on'](_0xe345('0x24'),this['syncHangup'][_0xe345('0x1a')](this));ami['on'](_0xe345('0x25'),this[_0xe345('0x26')][_0xe345('0x1a')](this));ami['on'](_0xe345('0x27'),this[_0xe345('0x28')]['bind'](this));ami['on'](_0xe345('0x29'),this['syncMusicOnHoldStart'][_0xe345('0x1a')](this));ami['on']('musiconholdstop',this[_0xe345('0x2a')][_0xe345('0x1a')](this));ami['on'](_0xe345('0x2b'),this[_0xe345('0x2c')]['bind'](this));ami['on']('blindtransfer',this[_0xe345('0x2d')][_0xe345('0x1a')](this));this['loopQueueSummary']();this['loopQueueShow']();}function clearChannels(_0x5cf6aa){if(!_[_0xe345('0x2e')](_0x5cf6aa)){for(var _0x146b95 in _0x5cf6aa){if(_0x5cf6aa[_0xe345('0x2f')](_0x146b95)){delete _0x5cf6aa[_0x146b95];}}}}function clearCampaigns(_0x58cddd){if(!_['isEmpty'](_0x58cddd)){for(var _0x35a2d4 in _0x58cddd){if(_0x58cddd['hasOwnProperty'](_0x35a2d4)){_0x58cddd[_0x35a2d4][_0xe345('0x30')]=0x0;}}}}function clearVoiceQueues(_0x76b74c){if(!_[_0xe345('0x2e')](_0x76b74c)){for(var _0x517ffa in _0x76b74c){if(_0x76b74c[_0xe345('0x2f')](_0x517ffa)){_0x76b74c[_0x517ffa]['originated']=0x0;_0x76b74c[_0x517ffa][_0xe345('0x31')]=0x0;_0x76b74c[_0x517ffa][_0xe345('0x32')]=0x0;_0x76b74c[_0x517ffa][_0xe345('0x33')]=0x0;_0x76b74c[_0x517ffa]['queueStatusComplete']=!![];}}}}function clearAgentBooked(_0x536c3a){if(!_[_0xe345('0x2e')](_0x536c3a)){for(var _0x222c81 in _0x536c3a){if(_0x536c3a[_0xe345('0x2f')](_0x222c81)){_0x536c3a[_0x222c81][_0xe345('0x34')]=!![];}}}}VoiceQueueReport[_0xe345('0xd')]['clearZombieChannels']=function(){var _0x13a4d4=this;for(var _0x34ec29 in this[_0xe345('0x14')]){if(this[_0xe345('0x14')][_0xe345('0x2f')](_0x34ec29)&&!this['channels'][_0x34ec29][_0xe345('0x35')]){this[_0xe345('0x11')]['enqueue'](function(){if(!_[_0xe345('0x36')](_0x13a4d4[_0xe345('0x14')][_0x34ec29])){return ami[_0xe345('0x37')]({'action':'status','channel':_0x13a4d4['channels'][_0x34ec29][_0xe345('0x38')]})[_0xe345('0x39')](function(_0x581aec){if(_0x581aec[_0xe345('0x3a')]===_0xe345('0x3b')){setTimeout(function(){if(_0x13a4d4[_0xe345('0x14')][_0x34ec29]){delete _0x13a4d4[_0xe345('0x14')][_0x34ec29];logger[_0xe345('0x3c')](_0xe345('0x3d'),_0x34ec29,util[_0xe345('0x3e')](_0x581aec,{'showHidden':![],'depth':null}));}if(_0x13a4d4[_0xe345('0x12')][_0x34ec29]){delete _0x13a4d4[_0xe345('0x12')][_0x34ec29];logger['error'](_0xe345('0x3f'),_0x34ec29,util[_0xe345('0x3e')](_0x581aec,{'showHidden':![],'depth':null}));}if(_0x13a4d4[_0xe345('0x40')][_0x34ec29]){delete _0x13a4d4[_0xe345('0x40')][_0x34ec29];logger[_0xe345('0x3c')](_0xe345('0x41'),_0x34ec29,util['inspect'](_0x581aec,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport['prototype']['syncFullyBooted']=function(){logger[_0xe345('0x3c')]('[FullyBooted]\x20clear\x20realtime');clearChannels(this[_0xe345('0x14')]);this[_0xe345('0x42')](this[_0xe345('0x12')]);clearAgentBooked(this[_0xe345('0x13')]);clearVoiceQueues(this['voiceQueues']);clearCampaigns(this[_0xe345('0x18')]);};VoiceQueueReport[_0xe345('0xd')][_0xe345('0x42')]=function(_0x591187){var _0x177c4a=this;if(!_[_0xe345('0x2e')](_0x591187)){for(var _0x31f6d6 in _0x591187){if(_0x591187['hasOwnProperty'](_0x31f6d6)){_0x177c4a['emitVoiceQueueChannelRemove'](_0x591187[_0x31f6d6],_0xe345('0x43'));delete _0x591187[_0x31f6d6];}}}};VoiceQueueReport[_0xe345('0xd')][_0xe345('0x44')]=function(_0x5a9a4e,_0x53ac87,_0x2ca7e4){io['to'](_0x5a9a4e)[_0xe345('0x44')](_0x53ac87,_0x2ca7e4);};VoiceQueueReport[_0xe345('0xd')][_0xe345('0x45')]=function(_0x3452f9,_0xb4baba){logger[_0xe345('0x46')](_0xe345('0x47')+_0xb4baba+_0xe345('0x48'),_0x3452f9[_0xe345('0x49')],util['inspect'](_0x3452f9,{'showHidden':![],'depth':null}));this[_0xe345('0x44')](util[_0xe345('0x4a')](_0xe345('0x4b'),_0x3452f9[_0xe345('0x4c')]),'voice_queue_channel:save',_0x3452f9);io['emit']('voice_queue_presence:save',_0x3452f9);};VoiceQueueReport[_0xe345('0xd')][_0xe345('0x4d')]=function(_0x56d2c8,_0x458f4d){logger[_0xe345('0x46')](_0xe345('0x47')+_0x458f4d+_0xe345('0x4e'),_0x56d2c8[_0xe345('0x49')],util['inspect'](_0x56d2c8,{'showHidden':![],'depth':null}));this[_0xe345('0x44')](util[_0xe345('0x4a')]('voice:queue:%s',_0x56d2c8['name']),_0xe345('0x4f'),_0x56d2c8);io[_0xe345('0x44')](_0xe345('0x50'),_0x56d2c8);};VoiceQueueReport['prototype'][_0xe345('0x51')]=function(_0x3ed152,_0x4a6626){if(_0x3ed152['type']===_0xe345('0x52')){var _0x29600f={'id':_0x3ed152['id'],'name':_0x3ed152['name'],'strategy':_0x3ed152['strategy'],'answered':_0x3ed152[_0xe345('0x53')],'available':_0x3ed152['available'],'loggedIn':_0x3ed152[_0xe345('0x54')],'pTalking':_0x3ed152['pTalking'],'sumBillable':_0x3ed152['sumBillable'],'sumDuration':_0x3ed152[_0xe345('0x55')],'sumHoldTime':_0x3ed152[_0xe345('0x56')]||0x0,'talking':_0x3ed152[_0xe345('0x31')],'total':_0x3ed152[_0xe345('0x57')],'type':_0x3ed152[_0xe345('0x58')],'unmanaged':_0x3ed152[_0xe345('0x59')],'abandoned':_0x3ed152[_0xe345('0x5a')],'waiting':_0x3ed152[_0xe345('0x33')]};if(_0x3ed152[_0xe345('0x5b')]){_0x29600f['Trunk']={'id':_0x3ed152['Trunk']['id'],'name':_0x3ed152[_0xe345('0x5b')][_0xe345('0x4c')],'active':_0x3ed152[_0xe345('0x5b')]['active'],'callerid':_0x3ed152[_0xe345('0x5b')][_0xe345('0x5c')]};}if(_0x3ed152[_0xe345('0x5d')]){_0x29600f[_0xe345('0x5d')]={'id':_0x3ed152[_0xe345('0x5d')]['id'],'name':_0x3ed152['Interval']['name']};}var _0x5ba79a=md5(JSON[_0xe345('0x5e')](_0x29600f));if(_0x3ed152[_0xe345('0x2')]!==_0x5ba79a){_0x3ed152[_0xe345('0x2')]=_0x5ba79a;logger[_0xe345('0x46')](_0xe345('0x5f')+_0x4a6626+_0xe345('0x60'),util['inspect'](_0x29600f,{'showHidden':![],'depth':null}));this[_0xe345('0x44')](util['format'](_0xe345('0x4b'),_0x29600f[_0xe345('0x4c')]),_0xe345('0x61'),_0x29600f);}}};VoiceQueueReport['prototype'][_0xe345('0x62')]=function(_0x107bc3){return _0x107bc3!==null&&!_['isUndefined'](_0x107bc3);};VoiceQueueReport[_0xe345('0xd')][_0xe345('0x63')]=function(){var _0x26398b=this;setInterval(function(){_0x26398b['clearZombieChannels']();ami[_0xe345('0x37')]({'action':'queues'})[_0xe345('0x39')](function(_0x18c61f){logger['error'](_0xe345('0x64'),util['inspect'](_0x18c61f,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport['prototype'][_0xe345('0x65')]=function(){var _0x11588d=this;setInterval(function(){if(_0x11588d[_0xe345('0x17')]){return ami['Action']({'action':'queuesummary'})['then'](function(_0xab40b9){_0x11588d[_0xe345('0x17')]=![];})['catch'](function(_0x4682c1){logger[_0xe345('0x3c')](_0xe345('0x66'),util[_0xe345('0x3e')](_0x4682c1,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport['prototype'][_0xe345('0x67')]=function(_0x2663e7){try{if(this[_0xe345('0x62')](_0x2663e7)&&this['isNotNull'](_0x2663e7[_0xe345('0x68')])){logger[_0xe345('0x46')](_0xe345('0x69'),util[_0xe345('0x3e')](_0x2663e7,{'showHidden':![],'depth':null}));if(this[_0xe345('0x16')][_0x2663e7[_0xe345('0x68')]]){logger[_0xe345('0x6a')]('[voiceQueueReport][queuesummary]\x20name:%s',_0x2663e7[_0xe345('0x68')]);var _0x5c6485=_[_0xe345('0x6b')](this['channels'],'queue')[_0x2663e7['queue']]||0x0;var _0x432cfc=_0x5c6485-_0x2663e7[_0xe345('0x6c')];if(this[_0xe345('0x16')][_0x2663e7['queue']][_0xe345('0x33')]!==_[_0xe345('0x6d')](_0x2663e7[_0xe345('0x6c')])||this[_0xe345('0x16')][_0x2663e7[_0xe345('0x68')]]['loggedIn']!==_[_0xe345('0x6d')](_0x2663e7[_0xe345('0x6e')])||this[_0xe345('0x16')][_0x2663e7[_0xe345('0x68')]][_0xe345('0x6f')]!==_[_0xe345('0x6d')](_0x2663e7[_0xe345('0x6f')])||this[_0xe345('0x16')][_0x2663e7[_0xe345('0x68')]][_0xe345('0x31')]!==_0x432cfc){this[_0xe345('0x16')][_0x2663e7[_0xe345('0x68')]]['waiting']=_[_0xe345('0x6d')](_0x2663e7[_0xe345('0x6c')]);this[_0xe345('0x16')][_0x2663e7[_0xe345('0x68')]][_0xe345('0x54')]=_[_0xe345('0x6d')](_0x2663e7[_0xe345('0x6e')]);this[_0xe345('0x16')][_0x2663e7[_0xe345('0x68')]][_0xe345('0x6f')]=_['toNumber'](_0x2663e7[_0xe345('0x6f')]);this[_0xe345('0x16')][_0x2663e7[_0xe345('0x68')]][_0xe345('0x31')]=_0x432cfc>0x0?_0x432cfc:0x0;this['voiceQueues'][_0x2663e7[_0xe345('0x68')]][_0xe345('0x31')]=this[_0xe345('0x16')][_0x2663e7[_0xe345('0x68')]]['talking']>_[_0xe345('0x6d')](_0x2663e7[_0xe345('0x6e')])?_[_0xe345('0x6d')](_0x2663e7[_0xe345('0x6e')]):this['voiceQueues'][_0x2663e7['queue']]['talking'];this[_0xe345('0x51')](this[_0xe345('0x16')][_0x2663e7[_0xe345('0x68')]],_0xe345('0x19'));}logger[_0xe345('0x46')](_0xe345('0x70'),util['inspect'](this[_0xe345('0x16')][_0x2663e7[_0xe345('0x68')]],{'showHidden':![],'depth':null}));ami[_0xe345('0x44')](_0xe345('0x71'),this['voiceQueues'][_0x2663e7[_0xe345('0x68')]]);}}}catch(_0x47e0a5){logger[_0xe345('0x3c')](_0xe345('0x66'),util[_0xe345('0x3e')](_0x47e0a5,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe345('0xd')]['syncQueueSummaryComplete']=function(_0x85015d){logger[_0xe345('0x46')](_0xe345('0x72'),util['inspect'](_0x85015d,{'showHidden':![],'depth':null}));this['flagQueueSummary']=!![];};VoiceQueueReport['prototype'][_0xe345('0x1c')]=function(_0x17c44d){try{if(this[_0xe345('0x62')](_0x17c44d)){logger[_0xe345('0x46')]('[%s][voiceQueueReport][queuecallerjoin]',_0x17c44d[_0xe345('0x49')],util[_0xe345('0x3e')](_0x17c44d,{'showHidden':![],'depth':null}));if(_[_0xe345('0x73')](this[_0xe345('0x12')][_0x17c44d[_0xe345('0x49')]]))this[_0xe345('0x12')][_0x17c44d[_0xe345('0x49')]]=[];if(_['isUndefined'](this[_0xe345('0x14')][_0x17c44d[_0xe345('0x49')]]))this[_0xe345('0x14')][_0x17c44d['uniqueid']]={};var _0x3c90f3=new QueueReport();_0x3c90f3[_0xe345('0x4c')]=_0x17c44d['queue'];_0x3c90f3[_0xe345('0x58')]=this[_0xe345('0x16')][_0x3c90f3[_0xe345('0x4c')]]&&this[_0xe345('0x16')][_0x3c90f3[_0xe345('0x4c')]][_0xe345('0x58')]?this[_0xe345('0x16')][_0x3c90f3[_0xe345('0x4c')]][_0xe345('0x58')]||_0xe345('0x52'):'inbound';_0x3c90f3[_0xe345('0x68')]=_0x17c44d['queue'];_0x3c90f3['queuecallerjoinAt']=moment()[_0xe345('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');_0x3c90f3['position']=_0x17c44d[_0xe345('0x74')];_0x3c90f3['count']=_0x17c44d[_0xe345('0x75')];_0x3c90f3[_0xe345('0x49')]=_0x17c44d[_0xe345('0x49')];_0x3c90f3[_0xe345('0x76')]=this[_0xe345('0x14')][_0x17c44d[_0xe345('0x49')]][_0xe345('0x76')];logger[_0xe345('0x6a')](_0xe345('0x77'),_0x3c90f3['name'],_0x3c90f3[_0xe345('0x58')]);_[_0xe345('0x78')](_0x3c90f3,_[_0xe345('0x79')](_0x17c44d,_[_0xe345('0x7a')](_0x3c90f3)));this['queueReports'][_0x17c44d[_0xe345('0x49')]][_0xe345('0x7b')](_0x3c90f3);this[_0xe345('0x14')][_0x17c44d[_0xe345('0x49')]]=_0x3c90f3;this['emitVoiceQueueChannelSave'](_0x3c90f3,_0xe345('0x1b'));}}catch(_0x16f894){logger[_0xe345('0x3c')](_0xe345('0x7c'),_0x17c44d[_0xe345('0x49')],util[_0xe345('0x3e')](_0x16f894,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe345('0xd')]['syncQueueCallerAbandon']=function(_0x1cb81a){try{if(this[_0xe345('0x62')](_0x1cb81a)){logger['debug']('[%s][voiceQueueReport][queuecallerabandon]',_0x1cb81a[_0xe345('0x49')],util[_0xe345('0x3e')](_0x1cb81a,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x1cb81a[_0xe345('0x49')]]){var _0x727ea2=_[_0xe345('0x7d')](this[_0xe345('0x12')][_0x1cb81a[_0xe345('0x49')]]);_0x727ea2['queuecallercomplete']=![];_0x727ea2[_0xe345('0x7e')]=null;_0x727ea2[_0xe345('0x7f')]=_0x1cb81a[_0xe345('0x7f')];_0x727ea2[_0xe345('0x80')]=_0x1cb81a[_0xe345('0x80')];_0x727ea2[_0xe345('0x1d')]=!![];_0x727ea2[_0xe345('0x81')]=moment()[_0xe345('0x4a')](_0xe345('0x82'));_0x727ea2[_0xe345('0x83')]=_0xe345('0x84');_0x727ea2['lastAssignedTo']=null;logger['info']('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x727ea2['name'],_0x727ea2[_0xe345('0x58')]);this[_0xe345('0x14')][_0x1cb81a[_0xe345('0x49')]]=_0x727ea2;this[_0xe345('0x4d')](_0x727ea2,_0xe345('0x1d'));}}}catch(_0x13a6ed){logger['error'](_0xe345('0x85'),_0x1cb81a[_0xe345('0x49')],util[_0xe345('0x3e')](_0x13a6ed,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe345('0xd')][_0xe345('0x20')]=function(_0x998dc){try{if(this[_0xe345('0x62')](_0x998dc)){logger['debug'](_0xe345('0x86'),_0x998dc[_0xe345('0x49')],util[_0xe345('0x3e')](_0x998dc,{'showHidden':![],'depth':null}));if(this[_0xe345('0x12')][_0x998dc[_0xe345('0x49')]]){var _0x565965=_[_0xe345('0x7d')](this['queueReports'][_0x998dc[_0xe345('0x49')]]);_0x565965['queuecallerleaveAt']=moment()[_0xe345('0x4a')](_0xe345('0x82'));_0x565965[_0xe345('0x87')]=_0x998dc[_0xe345('0x87')];_0x565965[_0xe345('0x88')]=_0x998dc[_0xe345('0x88')];logger[_0xe345('0x6a')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x565965[_0xe345('0x4c')],_0x565965['type'],_0x998dc[_0xe345('0x87')],_0x998dc['connectedlinename']);this[_0xe345('0x14')][_0x998dc[_0xe345('0x49')]]=_0x565965;this[_0xe345('0x45')](_0x565965,_0xe345('0x1f'));}}}catch(_0x1cbafc){logger[_0xe345('0x3c')]('[%s][voiceQueueReport][queuecallerleave]',_0x998dc['uniqueid'],util[_0xe345('0x3e')](_0x1cbafc,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe345('0xd')][_0xe345('0x22')]=function(_0xfcef7d){try{if(this[_0xe345('0x62')](_0xfcef7d)){logger[_0xe345('0x46')](_0xe345('0x89'),_0xfcef7d[_0xe345('0x49')],util[_0xe345('0x3e')](_0xfcef7d,{'showHidden':![],'depth':null}));if(this[_0xe345('0x12')][_0xfcef7d[_0xe345('0x49')]]){var _0x573984=_[_0xe345('0x7d')](this[_0xe345('0x12')][_0xfcef7d[_0xe345('0x49')]]);_0x573984[_0xe345('0x8a')]=!![];_0x573984[_0xe345('0x83')]='COMPLETEDBYAGENT';logger[_0xe345('0x6a')](_0xe345('0x8b'),_0x573984[_0xe345('0x4c')],_0x573984[_0xe345('0x58')]);}}}catch(_0x1dd12b){logger[_0xe345('0x3c')](_0xe345('0x89'),_0xfcef7d[_0xe345('0x49')],util[_0xe345('0x3e')](_0x1dd12b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe345('0xd')][_0xe345('0x8c')]=function(_0x461181){try{if(this['isNotNull'](_0x461181)){logger[_0xe345('0x46')]('[%s][voiceQueueReport][agentcomplete]',_0x461181[_0xe345('0x49')],util['inspect'](_0x461181,{'showHidden':![],'depth':null}));if(this[_0xe345('0x12')][_0x461181[_0xe345('0x49')]]){var _0x43b74f=_[_0xe345('0x7d')](this['queueReports'][_0x461181[_0xe345('0x49')]]);_0x43b74f[_0xe345('0x1d')]=![];_0x43b74f['queuecallerabandonAt']=null;_0x43b74f[_0xe345('0x8d')]=!![];_0x43b74f[_0xe345('0x8e')]=_0x461181[_0xe345('0x8f')];_0x43b74f[_0xe345('0x7f')]=_0x461181[_0xe345('0x7f')];_0x43b74f['queuecallercomplete']=!![];_0x43b74f[_0xe345('0x90')]=![];_0x43b74f['queuecallerexitAt']=null;if(!_0x43b74f[_0xe345('0x91')]){if(_0x461181[_0xe345('0x92')]=='transfer'){_0x43b74f[_0xe345('0x83')]=_0xe345('0x93');logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x43b74f[_0xe345('0x4c')],_0x43b74f['type']);}else{if(_[_0xe345('0x94')](_0x461181[_0xe345('0x38')]['toLowerCase'](),_0xe345('0x95'))){if(this['queueReports'][_0x461181[_0xe345('0x96')]]){var _0x10dacc=_[_0xe345('0x7d')](this[_0xe345('0x12')][_0x461181['linkedid']]);_0x10dacc[_0xe345('0x8a')]=![];_0x10dacc[_0xe345('0x90')]=!![];_0x10dacc[_0xe345('0x97')]=moment(_0x43b74f[_0xe345('0x98')])[_0xe345('0x99')](_0x461181[_0xe345('0x7f')],'seconds')[_0xe345('0x4a')](_0xe345('0x82'));_0x10dacc['queuecallerexitreason']=_0xe345('0x9a');_0x10dacc[_0xe345('0x91')]=!![];_0x10dacc[_0xe345('0x9b')]=_0xe345('0x9c');_0x10dacc[_0xe345('0x9d')]=_0x461181[_0xe345('0x9e')];_0x10dacc['transferuniqueid']=_0x461181['uniqueid'];logger[_0xe345('0x6a')](_0xe345('0x9f'),_0x10dacc['name'],_0x10dacc['type']);var _0x4dc584=this[_0xe345('0x12')][_0x461181[_0xe345('0x96')]];this[_0xe345('0x12')][_0x461181[_0xe345('0x96')]]=this[_0xe345('0x12')][_0x461181[_0xe345('0x49')]];this[_0xe345('0x12')][_0x461181[_0xe345('0x49')]]=_0x4dc584;}}else{_0x43b74f[_0xe345('0x83')]=_0xe345('0xa0')+_0x461181[_0xe345('0x92')][_0xe345('0xa1')]();logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x43b74f['name'],_0x43b74f[_0xe345('0x58')],_0x43b74f['queuecallerexitreason']);}}}this[_0xe345('0x14')][_0x461181['uniqueid']]=_0x43b74f;this['emitVoiceQueueChannelRemove'](_0x43b74f,_0xe345('0xa2'));}}}catch(_0x54526e){logger[_0xe345('0x3c')](_0xe345('0xa3'),_0x461181['uniqueid'],util['inspect'](_0x54526e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe345('0xd')][_0xe345('0xa4')]=function(_0x335d65){try{if(this[_0xe345('0x62')](_0x335d65)){logger[_0xe345('0x46')](_0xe345('0xa5'),_0x335d65[_0xe345('0x49')],util[_0xe345('0x3e')](_0x335d65,{'showHidden':![],'depth':null}));this[_0xe345('0xa6')](_0x335d65['uniqueid'],_[_0xe345('0x7a')](_0x335d65[_0xe345('0xa7')])[0x0],_0x335d65['value']);if(this['queueReports'][_0x335d65[_0xe345('0x49')]]){var _0x4a6b47=_['last'](this[_0xe345('0x12')][_0x335d65[_0xe345('0x49')]]);if(_0x4a6b47){if(this[_0xe345('0x62')](_0x335d65[_0xe345('0xa7')])&&this['isNotNull'](_0x335d65[_0xe345('0xa7')]['queuestatus'])){switch(_0x335d65[_0xe345('0xa8')]){case _0xe345('0xa9'):_0x4a6b47['queuecallerexit']=![];_0x4a6b47[_0xe345('0x97')]=null;break;case _0xe345('0xaa'):_0x4a6b47[_0xe345('0xab')]=_0xe345('0xac');_0x4a6b47[_0xe345('0x90')]=!![];_0x4a6b47[_0xe345('0x97')]=moment()[_0xe345('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');_0x4a6b47[_0xe345('0xad')]=moment()[_0xe345('0x4a')](_0xe345('0x82'));logger[_0xe345('0x46')](_0xe345('0xae'),_0x335d65[_0xe345('0x49')],util['inspect'](_0x4a6b47,{'showHidden':![],'depth':null}));ami[_0xe345('0x44')](_0xe345('0xaf'),_0x4a6b47);break;default:_0x4a6b47['queuecallerexit']=!![];_0x4a6b47[_0xe345('0x97')]=moment()[_0xe345('0x4a')](_0xe345('0x82'));_0x4a6b47[_0xe345('0xad')]=moment()[_0xe345('0x4a')](_0xe345('0x82'));}_0x4a6b47['queuecallerabandon']=![];_0x4a6b47['queuecallerabandonAt']=null;_0x4a6b47[_0xe345('0x83')]=_0x335d65[_0xe345('0xa8')];this[_0xe345('0x14')][_0x335d65[_0xe345('0x49')]]=_0x4a6b47;this[_0xe345('0x4d')](_0x4a6b47,'varset');}else if(this[_0xe345('0x62')](_0x335d65[_0xe345('0xa7')])&&this[_0xe345('0x62')](_0x335d65[_0xe345('0xa7')][_0xe345('0xb0')])){if(!_0x4a6b47[_0xe345('0x1d')]){_0x4a6b47[_0xe345('0x90')]=!![];_0x4a6b47[_0xe345('0x97')]=moment()[_0xe345('0x4a')](_0xe345('0x82'));_0x4a6b47['queuecallerexitreason']=_0xe345('0xb1');_0x4a6b47[_0xe345('0xad')]=moment()[_0xe345('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xe345('0x14')][_0x335d65[_0xe345('0x49')]]=_0x4a6b47;}}logger['info'](_0xe345('0xb2'),_0x335d65[_0xe345('0x49')],_0x4a6b47[_0xe345('0x4c')],_0x4a6b47[_0xe345('0x58')],_['keys'](_0x335d65[_0xe345('0xa7')])[0x0],_0x335d65['value']);_0x4a6b47['variables']=this[_0xe345('0x40')][_0x335d65[_0xe345('0x49')]];}}}}catch(_0x5b9b97){logger[_0xe345('0x3c')](_0xe345('0xa5'),_0x335d65[_0xe345('0x49')],util[_0xe345('0x3e')](_0x5b9b97,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xe345('0xa6')]=function(_0x3c36c6,_0x34098f,_0x3251f8){var _0x23418e=[_0xe345('0xb3'),'rtpaudioqosbridged',_0xe345('0xb4'),_0xe345('0xb5'),_0xe345('0xb6'),_0xe345('0xb7'),_0xe345('0xb8'),_0xe345('0xb9'),_0xe345('0xba'),_0xe345('0xbb'),_0xe345('0xbc'),'bridgepvtcallid','membercalls',_0xe345('0xbd'),_0xe345('0xbe'),_0xe345('0xbf'),_0xe345('0x8f'),'memberpenalty','memberrealtime'];if(!_['isNil'](_0x34098f)&&!_[_0xe345('0xc0')](_0x23418e,_0x34098f)){if(_[_0xe345('0x73')](this[_0xe345('0x40')][_0x3c36c6])){this[_0xe345('0x40')][_0x3c36c6]={};}this[_0xe345('0x40')][_0x3c36c6][_0x34098f]=_0x3251f8;}};VoiceQueueReport['prototype'][_0xe345('0xc1')]=function(_0x536270){try{if(this['isNotNull'](_0x536270)){logger[_0xe345('0x46')]('[%s][voiceQueueReport][hangup]',_0x536270[_0xe345('0x49')],util[_0xe345('0x3e')](_0x536270,{'showHidden':![],'depth':null}));if(this[_0xe345('0x12')][_0x536270['uniqueid']]){for(var _0x58024a=0x0,_0x5ce9ae={};_0x58024a0x0?_0x4cfe8f:0x0;this['voiceQueues'][_0x19f233[_0x08db('0x66')]][_0x08db('0x30')]=this[_0x08db('0x12')][_0x19f233[_0x08db('0x66')]]['talking']>_[_0x08db('0x6c')](_0x19f233['loggedin'])?_[_0x08db('0x6c')](_0x19f233[_0x08db('0x6d')]):this['voiceQueues'][_0x19f233[_0x08db('0x66')]][_0x08db('0x30')];this['emitVoiceQueueSummary'](this[_0x08db('0x12')][_0x19f233[_0x08db('0x66')]],'queuesummary');}logger[_0x08db('0x44')](_0x08db('0x6e'),util[_0x08db('0x3d')](this[_0x08db('0x12')][_0x19f233[_0x08db('0x66')]],{'showHidden':![],'depth':null}));ami['emit'](_0x08db('0x6f'),this[_0x08db('0x12')][_0x19f233[_0x08db('0x66')]]);}}}catch(_0x283494){logger['error'](_0x08db('0x65'),util[_0x08db('0x3d')](_0x283494,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x08db('0x9')][_0x08db('0x70')]=function(_0x3156ce){logger['debug']('[voiceQueueReport][queuesummarycomplete]\x20event:',util['inspect'](_0x3156ce,{'showHidden':![],'depth':null}));this[_0x08db('0x13')]=!![];};VoiceQueueReport[_0x08db('0x9')][_0x08db('0x1a')]=function(_0x2463c1){try{if(this[_0x08db('0x61')](_0x2463c1)){logger[_0x08db('0x44')](_0x08db('0x71'),_0x2463c1[_0x08db('0x4c')],util[_0x08db('0x3d')](_0x2463c1,{'showHidden':![],'depth':null}));if(_[_0x08db('0x72')](this['queueReports'][_0x2463c1[_0x08db('0x4c')]]))this[_0x08db('0xe')][_0x2463c1[_0x08db('0x4c')]]=[];if(_['isUndefined'](this[_0x08db('0x10')][_0x2463c1['uniqueid']]))this[_0x08db('0x10')][_0x2463c1[_0x08db('0x4c')]]={};var _0x4174ad=new QueueReport();_0x4174ad[_0x08db('0x48')]=_0x2463c1['queue'];_0x4174ad[_0x08db('0x5a')]=this[_0x08db('0x12')][_0x4174ad['name']]&&this[_0x08db('0x12')][_0x4174ad[_0x08db('0x48')]]['type']?this[_0x08db('0x12')][_0x4174ad[_0x08db('0x48')]][_0x08db('0x5a')]||_0x08db('0x51'):_0x08db('0x51');_0x4174ad['queue']=_0x2463c1[_0x08db('0x66')];_0x4174ad[_0x08db('0x73')]=moment()['format'](_0x08db('0x74'));_0x4174ad[_0x08db('0x75')]=_0x2463c1[_0x08db('0x75')];_0x4174ad[_0x08db('0x76')]=_0x2463c1[_0x08db('0x76')];_0x4174ad[_0x08db('0x4c')]=_0x2463c1[_0x08db('0x4c')];_0x4174ad[_0x08db('0x77')]=this[_0x08db('0x10')][_0x2463c1[_0x08db('0x4c')]][_0x08db('0x77')];logger[_0x08db('0x68')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x4174ad[_0x08db('0x48')],_0x4174ad[_0x08db('0x5a')]);_[_0x08db('0x78')](_0x4174ad,_[_0x08db('0x79')](_0x2463c1,_[_0x08db('0x7a')](_0x4174ad)));this[_0x08db('0xe')][_0x2463c1[_0x08db('0x4c')]]['push'](_0x4174ad);this['channels'][_0x2463c1[_0x08db('0x4c')]]=_0x4174ad;this[_0x08db('0x43')](_0x4174ad,_0x08db('0x19'));}}catch(_0x4249f6){logger[_0x08db('0x3b')](_0x08db('0x71'),_0x2463c1[_0x08db('0x4c')],util[_0x08db('0x3d')](_0x4249f6,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x08db('0x7b')]=function(_0x201639){try{if(this['isNotNull'](_0x201639)){logger[_0x08db('0x44')]('[%s][voiceQueueReport][queuecallerabandon]',_0x201639[_0x08db('0x4c')],util[_0x08db('0x3d')](_0x201639,{'showHidden':![],'depth':null}));if(this[_0x08db('0xe')][_0x201639[_0x08db('0x4c')]]){var _0xe8cebc=_[_0x08db('0x7c')](this['queueReports'][_0x201639['uniqueid']]);_0xe8cebc[_0x08db('0x7d')]=![];_0xe8cebc[_0x08db('0x7e')]=null;_0xe8cebc[_0x08db('0x7f')]=_0x201639[_0x08db('0x7f')];_0xe8cebc[_0x08db('0x80')]=_0x201639[_0x08db('0x80')];_0xe8cebc['queuecallerabandon']=!![];_0xe8cebc[_0x08db('0x81')]=moment()['format'](_0x08db('0x74'));_0xe8cebc['queuecallerexitreason']=_0x08db('0x82');_0xe8cebc[_0x08db('0x83')]=null;logger[_0x08db('0x68')](_0x08db('0x84'),_0xe8cebc['name'],_0xe8cebc['type']);this[_0x08db('0x10')][_0x201639[_0x08db('0x4c')]]=_0xe8cebc;this[_0x08db('0x40')](_0xe8cebc,_0x08db('0x1b'));}}}catch(_0x27f658){logger[_0x08db('0x3b')]('[%s][voiceQueueReport][queuecallerabandon]',_0x201639[_0x08db('0x4c')],util[_0x08db('0x3d')](_0x27f658,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerLeave']=function(_0x36435a){try{if(this['isNotNull'](_0x36435a)){logger[_0x08db('0x44')](_0x08db('0x85'),_0x36435a['uniqueid'],util['inspect'](_0x36435a,{'showHidden':![],'depth':null}));if(this[_0x08db('0xe')][_0x36435a[_0x08db('0x4c')]]){var _0x5704ab=_[_0x08db('0x7c')](this[_0x08db('0xe')][_0x36435a[_0x08db('0x4c')]]);_0x5704ab[_0x08db('0x86')]=moment()[_0x08db('0x47')](_0x08db('0x74'));_0x5704ab[_0x08db('0x87')]=_0x36435a[_0x08db('0x87')];_0x5704ab[_0x08db('0x88')]=_0x36435a['connectedlinename'];logger[_0x08db('0x68')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x5704ab['name'],_0x5704ab['type'],_0x36435a[_0x08db('0x87')],_0x36435a[_0x08db('0x88')]);this['channels'][_0x36435a[_0x08db('0x4c')]]=_0x5704ab;this[_0x08db('0x43')](_0x5704ab,_0x08db('0x89'));}}}catch(_0x512a12){logger['error']('[%s][voiceQueueReport][queuecallerleave]',_0x36435a[_0x08db('0x4c')],util[_0x08db('0x3d')](_0x512a12,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x08db('0x20')]=function(_0x22af97){try{if(this[_0x08db('0x61')](_0x22af97)){logger[_0x08db('0x44')](_0x08db('0x8a'),_0x22af97[_0x08db('0x4c')],util['inspect'](_0x22af97,{'showHidden':![],'depth':null}));if(this[_0x08db('0xe')][_0x22af97[_0x08db('0x4c')]]){var _0x234ef9=_[_0x08db('0x7c')](this[_0x08db('0xe')][_0x22af97['uniqueid']]);_0x234ef9[_0x08db('0x7d')]=!![];_0x234ef9['queuecallerexitreason']=_0x08db('0x8b');logger[_0x08db('0x68')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x234ef9[_0x08db('0x48')],_0x234ef9[_0x08db('0x5a')]);}}}catch(_0xf2d530){logger[_0x08db('0x3b')](_0x08db('0x8a'),_0x22af97[_0x08db('0x4c')],util[_0x08db('0x3d')](_0xf2d530,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x08db('0x9')][_0x08db('0x1e')]=function(_0x549021){try{if(this['isNotNull'](_0x549021)){logger['debug'](_0x08db('0x8c'),_0x549021[_0x08db('0x4c')],util[_0x08db('0x3d')](_0x549021,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x549021[_0x08db('0x4c')]]){var _0x57e171=_[_0x08db('0x7c')](this[_0x08db('0xe')][_0x549021[_0x08db('0x4c')]]);_0x57e171[_0x08db('0x1b')]=![];_0x57e171['queuecallerabandonAt']=null;_0x57e171[_0x08db('0x8d')]=!![];_0x57e171[_0x08db('0x83')]=_0x549021[_0x08db('0x8e')];_0x57e171[_0x08db('0x7f')]=_0x549021[_0x08db('0x7f')];_0x57e171[_0x08db('0x7d')]=!![];_0x57e171[_0x08db('0x8f')]=![];_0x57e171['queuecallerexitAt']=null;if(!_0x57e171['transfer']){if(_0x549021['reason']==_0x08db('0x90')){_0x57e171['queuecallerexitreason']=_0x08db('0x91');logger[_0x08db('0x68')](_0x08db('0x92'),_0x57e171[_0x08db('0x48')],_0x57e171['type']);}else{if(_[_0x08db('0x93')](_0x549021[_0x08db('0x38')][_0x08db('0x94')](),_0x08db('0x95'))){if(this[_0x08db('0xe')][_0x549021[_0x08db('0x96')]]){var _0x3e5643=_[_0x08db('0x7c')](this[_0x08db('0xe')][_0x549021[_0x08db('0x96')]]);_0x3e5643['queuecallercomplete']=![];_0x3e5643['queuecallerexit']=!![];_0x3e5643[_0x08db('0x97')]=moment(_0x57e171[_0x08db('0x73')])[_0x08db('0x98')](_0x549021[_0x08db('0x7f')],_0x08db('0x99'))[_0x08db('0x47')](_0x08db('0x74'));_0x3e5643[_0x08db('0x9a')]='FORWARDTRANSFER';_0x3e5643[_0x08db('0x90')]=!![];_0x3e5643[_0x08db('0x9b')]=_0x08db('0x9c');_0x3e5643[_0x08db('0x9d')]=_0x549021[_0x08db('0x9e')];_0x3e5643[_0x08db('0x9f')]=_0x549021[_0x08db('0x4c')];logger[_0x08db('0x68')](_0x08db('0xa0'),_0x3e5643['name'],_0x3e5643[_0x08db('0x5a')]);var _0x54f4f3=this[_0x08db('0xe')][_0x549021[_0x08db('0x96')]];this[_0x08db('0xe')][_0x549021['linkedid']]=this[_0x08db('0xe')][_0x549021[_0x08db('0x4c')]];this[_0x08db('0xe')][_0x549021[_0x08db('0x4c')]]=_0x54f4f3;}}else{_0x57e171[_0x08db('0x9a')]='COMPLETEDBY'+_0x549021['reason'][_0x08db('0xa1')]();logger['info'](_0x08db('0xa2'),_0x57e171['name'],_0x57e171['type'],_0x57e171[_0x08db('0x9a')]);}}}this[_0x08db('0x10')][_0x549021[_0x08db('0x4c')]]=_0x57e171;this[_0x08db('0x40')](_0x57e171,_0x08db('0x1d'));}}}catch(_0x1edb04){logger[_0x08db('0x3b')]('[%s][voiceQueueReport][agentcomplete]',_0x549021['uniqueid'],util[_0x08db('0x3d')](_0x1edb04,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x08db('0x9')]['syncVarSet']=function(_0x45d71c){try{if(this['isNotNull'](_0x45d71c)){logger[_0x08db('0x44')](_0x08db('0xa3'),_0x45d71c['uniqueid'],util[_0x08db('0x3d')](_0x45d71c,{'showHidden':![],'depth':null}));this[_0x08db('0xa4')](_0x45d71c[_0x08db('0x4c')],_[_0x08db('0x7a')](_0x45d71c[_0x08db('0xa5')])[0x0],_0x45d71c[_0x08db('0xa6')]);if(this[_0x08db('0xe')][_0x45d71c[_0x08db('0x4c')]]){var _0x170408=_[_0x08db('0x7c')](this[_0x08db('0xe')][_0x45d71c['uniqueid']]);if(_0x170408){if(this[_0x08db('0x61')](_0x45d71c['variable'])&&this[_0x08db('0x61')](_0x45d71c['variable'][_0x08db('0xa7')])){switch(_0x45d71c[_0x08db('0xa6')]){case _0x08db('0xa8'):_0x170408[_0x08db('0x8f')]=![];_0x170408[_0x08db('0x97')]=null;break;case'TIMEOUT':_0x170408['lastevent']=_0x08db('0xa9');_0x170408[_0x08db('0x8f')]=!![];_0x170408[_0x08db('0x97')]=moment()[_0x08db('0x47')](_0x08db('0x74'));_0x170408['queuecallerleaveAt']=moment()['format'](_0x08db('0x74'));logger['debug'](_0x08db('0xaa'),_0x45d71c[_0x08db('0x4c')],util[_0x08db('0x3d')](_0x170408,{'showHidden':![],'depth':null}));ami[_0x08db('0x42')](_0x08db('0xab'),_0x170408);break;default:_0x170408[_0x08db('0x8f')]=!![];_0x170408[_0x08db('0x97')]=moment()['format'](_0x08db('0x74'));_0x170408[_0x08db('0x86')]=moment()['format'](_0x08db('0x74'));}_0x170408[_0x08db('0x1b')]=![];_0x170408['queuecallerabandonAt']=null;_0x170408[_0x08db('0x9a')]=_0x45d71c[_0x08db('0xa6')];this['channels'][_0x45d71c[_0x08db('0x4c')]]=_0x170408;this['emitVoiceQueueChannelRemove'](_0x170408,_0x08db('0xac'));}else if(this[_0x08db('0x61')](_0x45d71c[_0x08db('0xa5')])&&this[_0x08db('0x61')](_0x45d71c['variable'][_0x08db('0xad')])){if(!_0x170408['queuecallerabandon']){_0x170408[_0x08db('0x8f')]=!![];_0x170408['queuecallerexitAt']=moment()[_0x08db('0x47')](_0x08db('0x74'));_0x170408['queuecallerexitreason']='EXITWITHKEY';_0x170408[_0x08db('0x86')]=moment()[_0x08db('0x47')](_0x08db('0x74'));this[_0x08db('0x10')][_0x45d71c[_0x08db('0x4c')]]=_0x170408;}}logger[_0x08db('0x68')](_0x08db('0xae'),_0x45d71c['uniqueid'],_0x170408[_0x08db('0x48')],_0x170408[_0x08db('0x5a')],_[_0x08db('0x7a')](_0x45d71c['variable'])[0x0],_0x45d71c['value']);_0x170408[_0x08db('0x15')]=this[_0x08db('0x15')][_0x45d71c[_0x08db('0x4c')]];}}}}catch(_0x503899){logger['error'](_0x08db('0xa3'),_0x45d71c['uniqueid'],util['inspect'](_0x503899,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x08db('0x9')]['addVariable']=function(_0x2cddca,_0x58984c,_0x3b9f70){var _0x551d8c=[_0x08db('0xaf'),_0x08db('0xb0'),_0x08db('0xb1'),_0x08db('0xb2'),_0x08db('0xb3'),_0x08db('0xb4'),_0x08db('0xb5'),_0x08db('0xb6'),_0x08db('0xb7'),_0x08db('0xb8'),_0x08db('0xb9'),_0x08db('0xba'),_0x08db('0xbb'),_0x08db('0xbc'),_0x08db('0xbd'),'memberlastcall',_0x08db('0x8e'),'memberpenalty','memberrealtime'];if(!_[_0x08db('0x35')](_0x58984c)&&!_[_0x08db('0xbe')](_0x551d8c,_0x58984c)){if(_['isUndefined'](this[_0x08db('0x15')][_0x2cddca])){this[_0x08db('0x15')][_0x2cddca]={};}this[_0x08db('0x15')][_0x2cddca][_0x58984c]=_0x3b9f70;}};VoiceQueueReport[_0x08db('0x9')]['syncHangup']=function(_0x38f1ee){try{if(this[_0x08db('0x61')](_0x38f1ee)){logger[_0x08db('0x44')](_0x08db('0xbf'),_0x38f1ee[_0x08db('0x4c')],util[_0x08db('0x3d')](_0x38f1ee,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x38f1ee[_0x08db('0x4c')]]){for(var _0x3c70a7=0x0,_0x1e6bea={};_0x3c70a7=0x0?moment(_0x4f1b91[_0xac03('0x19')])['diff'](_0x4f1b91[_0xac03('0x1a')],'seconds'):null,'data1':_0xac03('0x1b'),'data2':_0x4f1b91[_0xac03('0x15')],'data3':_0x4f1b91[_0xac03('0x12')],'data4':_0x4f1b91[_0xac03('0x1c')]||null,'role':'agent','internal':_0x4f1b91[_0xac03('0x15')]?_[_0xac03('0x1d')](_0x4f1b91[_0xac03('0x15')]):undefined,'uniqueid':_0x4f1b91[_0xac03('0x16')]},'log':_0xac03('0x6')});}; \ No newline at end of file +var _0xbdec=['inbound','calleridnum','exten','queue','agent','accountcode','toNumber','uniqueid','voiceDialReport','membername','endtime','starttime','seconds','outbound','dialstring','moment','lodash','util','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','voice','lastAssignedTo','isNil','interface','format','SIP/%s','TALKING','queuecallerleaveAt','diff'];(function(_0x30a2ba,_0x2fd34e){var _0xb0cd6=function(_0x1d94bd){while(--_0x1d94bd){_0x30a2ba['push'](_0x30a2ba['shift']());}};_0xb0cd6(++_0x2fd34e);}(_0xbdec,0x93));var _0xcbde=function(_0x2d005d,_0x251aed){_0x2d005d=_0x2d005d-0x0;var _0x327a96=_0xbdec[_0x2d005d];return _0x327a96;};'use strict';var moment=require(_0xcbde('0x0'));var _=require(_0xcbde('0x1'));var util=require(_0xcbde('0x2'));var client=require(_0xcbde('0x3'));exports[_0xcbde('0x4')]=function(_0x424495){var _0xa437a=_0x424495[_0xcbde('0x5')]||_0x424495[_0xcbde('0x6')];return client[_0xcbde('0x7')](_0xcbde('0x8'),{'body':{'channel':_0xcbde('0x9'),'membername':_0x424495[_0xcbde('0xa')],'interface':_[_0xcbde('0xb')](_0x424495[_0xcbde('0xc')])?util[_0xcbde('0xd')](_0xcbde('0xe'),_0x424495[_0xcbde('0xa')]):_0x424495[_0xcbde('0xc')],'type':_0xcbde('0xf'),'enterAt':_0x424495[_0xcbde('0x10')],'exitAt':_0xa437a,'duration':moment(_0xa437a)[_0xcbde('0x11')](_0x424495['queuecallerleaveAt'],'seconds'),'data1':_0xcbde('0x12'),'data2':_0x424495[_0xcbde('0x13')],'data3':_0x424495[_0xcbde('0x14')],'data4':null,'data5':_0x424495[_0xcbde('0x15')],'role':_0xcbde('0x16'),'internal':_0x424495[_0xcbde('0x17')]?_[_0xcbde('0x18')](_0x424495[_0xcbde('0x17')]):undefined,'uniqueid':_0x424495[_0xcbde('0x19')]},'log':_0xcbde('0x8')});};exports[_0xcbde('0x1a')]=function(_0xaeab55){return client[_0xcbde('0x7')](_0xcbde('0x8'),{'body':{'channel':'voice','membername':_0xaeab55[_0xcbde('0x1b')],'interface':_0xaeab55[_0xcbde('0xc')],'type':'TALKING','enterAt':_0xaeab55['starttime'],'exitAt':_0xaeab55[_0xcbde('0x1c')],'duration':moment(_0xaeab55[_0xcbde('0x1c')])['diff'](_0xaeab55[_0xcbde('0x1d')],'seconds')>=0x0?moment(_0xaeab55[_0xcbde('0x1c')])[_0xcbde('0x11')](_0xaeab55[_0xcbde('0x1d')],_0xcbde('0x1e')):null,'data1':_0xcbde('0x1f'),'data2':_0xaeab55[_0xcbde('0x17')],'data3':_0xaeab55[_0xcbde('0x14')],'data4':_0xaeab55[_0xcbde('0x20')]||null,'role':'agent','internal':_0xaeab55['accountcode']?_[_0xcbde('0x18')](_0xaeab55[_0xcbde('0x17')]):undefined,'uniqueid':_0xaeab55[_0xcbde('0x19')]},'log':_0xcbde('0x8')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 816b9f3..fb3695b 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 _0x4f73=['GetSettings','../client','getSettings','Request','ShowSetting'];(function(_0x153709,_0x46f123){var _0x27189f=function(_0x358457){while(--_0x358457){_0x153709['push'](_0x153709['shift']());}};_0x27189f(++_0x46f123);}(_0x4f73,0x10f));var _0x34f7=function(_0x2df84d,_0x56d874){_0x2df84d=_0x2df84d-0x0;var _0x2634ce=_0x4f73[_0x2df84d];return _0x2634ce;};'use strict';var client=require(_0x34f7('0x0'));exports[_0x34f7('0x1')]=function(){return client[_0x34f7('0x2')](_0x34f7('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer']},'log':_0x34f7('0x4')});}; \ No newline at end of file +var _0x6002=['getSettings','ShowSetting','stopRecordingOnTransfer','../client'];(function(_0x376579,_0x4a6a93){var _0x522be4=function(_0x46131a){while(--_0x46131a){_0x376579['push'](_0x376579['shift']());}};_0x522be4(++_0x4a6a93);}(_0x6002,0x103));var _0x2600=function(_0x5081bc,_0x242a1a){_0x5081bc=_0x5081bc-0x0;var _0x2fe221=_0x6002[_0x5081bc];return _0x2fe221;};'use strict';var client=require(_0x2600('0x0'));exports[_0x2600('0x1')]=function(){return client['Request'](_0x2600('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x2600('0x3')]},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 90dcaaf..85944ca 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 _0xfc04=['Request','GetTemplate','name','html','../client'];(function(_0x4b79fa,_0x1f7e3a){var _0x5e44f9=function(_0x5e5c13){while(--_0x5e5c13){_0x4b79fa['push'](_0x4b79fa['shift']());}};_0x5e44f9(++_0x1f7e3a);}(_0xfc04,0xa4));var _0x4fc0=function(_0x46fcdf,_0x34eb1e){_0x46fcdf=_0x46fcdf-0x0;var _0x59d382=_0xfc04[_0x46fcdf];return _0x59d382;};'use strict';var client=require(_0x4fc0('0x0'));exports['getTemplates']=function(_0x1a0d48){return function(_0x948b07){return client[_0x4fc0('0x1')](_0x4fc0('0x2'),{'options':{'raw':!![],'attributes':['id',_0x4fc0('0x3'),_0x4fc0('0x4')]},'log':_0x4fc0('0x2')});};}; \ No newline at end of file +var _0x3895=['GetTemplate','getTemplates','Request'];(function(_0x26d15f,_0x1eeb6e){var _0x5809ff=function(_0x6755b){while(--_0x6755b){_0x26d15f['push'](_0x26d15f['shift']());}};_0x5809ff(++_0x1eeb6e);}(_0x3895,0x112));var _0x5389=function(_0x347322,_0x29ed26){_0x347322=_0x347322-0x0;var _0xc940b4=_0x3895[_0x347322];return _0xc940b4;};'use strict';var client=require('../client');exports[_0x5389('0x0')]=function(_0x4e5304){return function(_0x5053f3){return client[_0x5389('0x1')](_0x5389('0x2'),{'options':{'raw':!![],'attributes':['id','name','html']},'log':'GetTemplate'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 567e5d3..5d20dc2 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 _0x6403=['action','data2','data3','data4','data5','data6','data7','getTriggers','Request','GetTrigger','name','channel','status','Condition','AllConditions','field','operator','value','Action'];(function(_0x112cf5,_0x13b967){var _0x35e435=function(_0x1bd84c){while(--_0x1bd84c){_0x112cf5['push'](_0x112cf5['shift']());}};_0x35e435(++_0x13b967);}(_0x6403,0x183));var _0x3640=function(_0x47c14e,_0x1a1d69){_0x47c14e=_0x47c14e-0x0;var _0x402c21=_0x6403[_0x47c14e];return _0x402c21;};'use strict';var client=require('../client');exports[_0x3640('0x0')]=function(_0x42c026){return function(_0x114d04){return client[_0x3640('0x1')](_0x3640('0x2'),{'options':{'raw':![],'attributes':['id',_0x3640('0x3'),_0x3640('0x4'),_0x3640('0x5')],'include':[{'model':_0x3640('0x6'),'as':_0x3640('0x7'),'attributes':['id',_0x3640('0x8'),_0x3640('0x9'),_0x3640('0xa')]},{'model':_0x3640('0x6'),'as':'AnyConditions','attributes':['id',_0x3640('0x8'),'operator',_0x3640('0xa')]},{'model':_0x3640('0xb'),'as':'Actions','attributes':['id',_0x3640('0xc'),'data1',_0x3640('0xd'),_0x3640('0xe'),_0x3640('0xf'),_0x3640('0x10'),_0x3640('0x11'),_0x3640('0x12')]}]},'log':_0x3640('0x2')});};}; \ No newline at end of file +var _0x3f75=['data1','data2','data4','data7','getTriggers','Request','GetTrigger','name','channel','status','Condition','field','operator','value','AnyConditions','Action','Actions','action'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x3f75,0x112));var _0x53f7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3f75[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0x53f7('0x0')]=function(_0x23164f){return function(_0xb42821){return client[_0x53f7('0x1')](_0x53f7('0x2'),{'options':{'raw':![],'attributes':['id',_0x53f7('0x3'),_0x53f7('0x4'),_0x53f7('0x5')],'include':[{'model':_0x53f7('0x6'),'as':'AllConditions','attributes':['id',_0x53f7('0x7'),_0x53f7('0x8'),_0x53f7('0x9')]},{'model':_0x53f7('0x6'),'as':_0x53f7('0xa'),'attributes':['id',_0x53f7('0x7'),_0x53f7('0x8'),_0x53f7('0x9')]},{'model':_0x53f7('0xb'),'as':_0x53f7('0xc'),'attributes':['id',_0x53f7('0xd'),_0x53f7('0xe'),_0x53f7('0xf'),'data3',_0x53f7('0x10'),'data5','data6',_0x53f7('0x11')]}]},'log':'GetTrigger'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 04daa00..1d4b652 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 _0x0704=['../client','Request','GetTrunk','name','registry','defaultuser'];(function(_0x440cfa,_0x270522){var _0x549252=function(_0x29d49f){while(--_0x29d49f){_0x440cfa['push'](_0x440cfa['shift']());}};_0x549252(++_0x270522);}(_0x0704,0x1c2));var _0x4070=function(_0x31295c,_0x2f2b82){_0x31295c=_0x31295c-0x0;var _0x2c150e=_0x0704[_0x31295c];return _0x2c150e;};'use strict';var client=require(_0x4070('0x0'));exports['getTrunks']=function(_0x3cf340){return function(_0x2bb9df){return client[_0x4070('0x1')](_0x4070('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x4070('0x3'),_0x4070('0x4'),_0x4070('0x5')]},'log':'GetTrunk'});};}; \ No newline at end of file +var _0xb903=['getTrunks','GetTrunk','name','registry','defaultuser','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb903,0x185));var _0x3b90=function(_0x1813f7,_0xd6d604){_0x1813f7=_0x1813f7-0x0;var _0x5aed29=_0xb903[_0x1813f7];return _0x5aed29;};'use strict';var client=require(_0x3b90('0x0'));exports[_0x3b90('0x1')]=function(_0x9b74ca){return function(_0x3d81e8){return client['Request'](_0x3b90('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x3b90('0x3'),_0x3b90('0x4'),_0x3b90('0x5')]},'log':_0x3b90('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index a403000..6aad1c3 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 _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(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'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 +var _0xcb91=['UnpauseUser','getAgent','ShowUser','email','lastPauseAt','Request','GetUser','agent','name','accountcode','fullname','lastLoginAt','pauseType','voicePause','phone','interface','getAgents','internal','getTelephones','savePause','PauseUser'];(function(_0x589352,_0x2d0721){var _0x553939=function(_0x549929){while(--_0x549929){_0x589352['push'](_0x589352['shift']());}};_0x553939(++_0x2d0721);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x381589,_0x27a707){_0x381589=_0x381589-0x0;var _0x2a075d=_0xcb91[_0x381589];return _0x2a075d;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2')},'attributes':['id',_0x1cb9('0x3'),'email',_0x1cb9('0x4'),_0x1cb9('0x5'),'online',_0x1cb9('0x6'),_0x1cb9('0x7'),'lastPauseAt',_0x1cb9('0x8'),_0x1cb9('0x9'),'mobile',_0x1cb9('0xa')]},'log':_0x1cb9('0xb')});};};exports['getTelephones']=function(){return function(){return client[_0x1cb9('0x0')]('GetUser',{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x4'),_0x1cb9('0xc')]},'log':_0x1cb9('0xd')});};};exports[_0x1cb9('0xe')]=function(_0x50ce71,_0x9b58f1,_0x44a6b4){return client[_0x1cb9('0x0')](_0x1cb9('0xf'),{'body':{'type':_0x9b58f1,'uniqueid':_0x44a6b4},'options':{'where':{'id':_0x50ce71['id']}},'log':_0x1cb9('0xe')});};exports['saveUnpause']=function(_0x5e3c19){return client['Request'](_0x1cb9('0x10'),{'body':{},'options':{'where':{'id':_0x5e3c19['id']}},'log':_0x1cb9('0xe')});};exports[_0x1cb9('0x11')]=function(_0x1c714f){return client['Request'](_0x1cb9('0x12'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2'),'id':_0x1c714f},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x13'),_0x1cb9('0x4'),'fullname','online',_0x1cb9('0x6'),_0x1cb9('0x7'),_0x1cb9('0x14'),_0x1cb9('0x8'),_0x1cb9('0xa')]},'log':_0x1cb9('0x11')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index b3ff446..97e0dd5 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 _0x49f9=['../client','create','CreateVoiceAgentReport','update','Request','UpdateVoiceAgentReport'];(function(_0x7249d0,_0x445380){var _0x1740a4=function(_0x73c328){while(--_0x73c328){_0x7249d0['push'](_0x7249d0['shift']());}};_0x1740a4(++_0x445380);}(_0x49f9,0x90));var _0x949f=function(_0x2b91c5,_0x3b6db5){_0x2b91c5=_0x2b91c5-0x0;var _0xbd5531=_0x49f9[_0x2b91c5];return _0xbd5531;};'use strict';var client=require(_0x949f('0x0'));exports[_0x949f('0x1')]=function(_0x6c8157){return client['Request'](_0x949f('0x2'),{'body':_0x6c8157,'log':_0x949f('0x2')});};exports[_0x949f('0x3')]=function(_0x5e3d3e,_0x375bf3,_0x506cf2){return client[_0x949f('0x4')]('UpdateVoiceAgentReport',{'body':_0x5e3d3e,'options':{'where':{'uniqueid':_0x375bf3,'interface':_0x506cf2,'agentcomplete':!![]}},'log':_0x949f('0x5')});}; \ No newline at end of file +var _0x8769=['update','UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport'];(function(_0x245772,_0x2c0818){var _0x1a1c3b=function(_0x4087ac){while(--_0x4087ac){_0x245772['push'](_0x245772['shift']());}};_0x1a1c3b(++_0x2c0818);}(_0x8769,0x1d0));var _0x9876=function(_0x2080a3,_0x48acfa){_0x2080a3=_0x2080a3-0x0;var _0x8d7d17=_0x8769[_0x2080a3];return _0x8d7d17;};'use strict';var client=require(_0x9876('0x0'));exports[_0x9876('0x1')]=function(_0x2c3b3d){return client[_0x9876('0x2')](_0x9876('0x3'),{'body':_0x2c3b3d,'log':_0x9876('0x3')});};exports[_0x9876('0x4')]=function(_0x4bfac3,_0x487fae,_0x1892ef){return client['Request']('UpdateVoiceAgentReport',{'body':_0x4bfac3,'options':{'where':{'uniqueid':_0x487fae,'interface':_0x1892ef,'agentcomplete':!![]}},'log':_0x9876('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index ade7a10..0e9e064 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 _0xc5b1=['moment','lodash','Request','CreateVoiceCallReport','merge','calleridnum','DOCUMENTATION','outbound','startOf','format','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','billableseconds','GetVoiceCallReports'];(function(_0x10f68e,_0xf198ea){var _0x4c8372=function(_0x38517){while(--_0x38517){_0x10f68e['push'](_0x10f68e['shift']());}};_0x4c8372(++_0xf198ea);}(_0xc5b1,0x1c0));var _0x1c5b=function(_0x5177de,_0x214996){_0x5177de=_0x5177de-0x0;var _0x3b06e5=_0xc5b1[_0x5177de];return _0x3b06e5;};'use strict';var moment=require(_0x1c5b('0x0'));var util=require('util');var _=require(_0x1c5b('0x1'));var client=require('../client');exports['create']=function(_0x4309a1){return client[_0x1c5b('0x2')](_0x1c5b('0x3'),{'body':_[_0x1c5b('0x4')](_0x4309a1,{'source':_0x4309a1[_0x1c5b('0x5')],'destinationcontext':_0x4309a1['context'],'callerid':_0x4309a1['callerid'],'amaflags':_0x1c5b('0x6')}),'log':_0x1c5b('0x3')});};exports['getVoiceCallReports']=function(){return function(){return client[_0x1c5b('0x2')]('GetVoiceCallReport',{'options':{'where':{'type':[_0x1c5b('0x7')],'createdAt':{'$between':[moment()[_0x1c5b('0x8')]('day')['format']('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf']('day')[_0x1c5b('0x9')](_0x1c5b('0xa'))]}},'attributes':[_0x1c5b('0xb'),_0x1c5b('0xc'),_0x1c5b('0xd'),_0x1c5b('0xe')]},'log':_0x1c5b('0xf')});};}; \ No newline at end of file +var _0x14e2=['GetVoiceCallReports','moment','util','../client','create','Request','CreateVoiceCallReport','merge','calleridnum','callerid','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','duration','billableseconds'];(function(_0xee5b19,_0x46bf83){var _0x25548f=function(_0x4ae480){while(--_0x4ae480){_0xee5b19['push'](_0xee5b19['shift']());}};_0x25548f(++_0x46bf83);}(_0x14e2,0x119));var _0x214e=function(_0x58ae8a,_0x3c619e){_0x58ae8a=_0x58ae8a-0x0;var _0x2f0b6b=_0x14e2[_0x58ae8a];return _0x2f0b6b;};'use strict';var moment=require(_0x214e('0x0'));var util=require(_0x214e('0x1'));var _=require('lodash');var client=require(_0x214e('0x2'));exports[_0x214e('0x3')]=function(_0x12c6b2){return client[_0x214e('0x4')](_0x214e('0x5'),{'body':_[_0x214e('0x6')](_0x12c6b2,{'source':_0x12c6b2[_0x214e('0x7')],'destinationcontext':_0x12c6b2['context'],'callerid':_0x12c6b2[_0x214e('0x8')],'amaflags':'DOCUMENTATION'}),'log':_0x214e('0x5')});};exports['getVoiceCallReports']=function(){return function(){return client['Request']('GetVoiceCallReport',{'options':{'where':{'type':[_0x214e('0x9')],'createdAt':{'$between':[moment()[_0x214e('0xa')](_0x214e('0xb'))[_0x214e('0xc')](_0x214e('0xd')),moment()[_0x214e('0xe')](_0x214e('0xb'))[_0x214e('0xc')](_0x214e('0xd'))]}},'attributes':[_0x214e('0xf'),_0x214e('0x10'),_0x214e('0x11'),_0x214e('0x12')]},'log':_0x214e('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index f87434c..8df67e9 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 _0x49ce=['create','Request','../client'];(function(_0x4c9380,_0x2fefc0){var _0x49a523=function(_0x165e85){while(--_0x165e85){_0x4c9380['push'](_0x4c9380['shift']());}};_0x49a523(++_0x2fefc0);}(_0x49ce,0xfb));var _0xe49c=function(_0x8a7e38,_0x473a5d){_0x8a7e38=_0x8a7e38-0x0;var _0x228609=_0x49ce[_0x8a7e38];return _0x228609;};'use strict';var client=require(_0xe49c('0x0'));exports[_0xe49c('0x1')]=function(_0x35171c){return client[_0xe49c('0x2')]('CreateVoiceDialReport',{'body':_0x35171c,'log':'CreateVoiceDialReport'});}; \ No newline at end of file +var _0x3176=['CreateVoiceDialReport','create'];(function(_0x4ed78a,_0x30ab70){var _0x3780da=function(_0x1a2bc4){while(--_0x1a2bc4){_0x4ed78a['push'](_0x4ed78a['shift']());}};_0x3780da(++_0x30ab70);}(_0x3176,0x8b));var _0x6317=function(_0x4a6740,_0x223510){_0x4a6740=_0x4a6740-0x0;var _0x5d3220=_0x3176[_0x4a6740];return _0x5d3220;};'use strict';var client=require('../client');exports[_0x6317('0x0')]=function(_0x225285){return client['Request']('CreateVoiceDialReport',{'body':_0x225285,'log':_0x6317('0x1')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 0b86f5f..2f823a2 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 _0x7dc2=['recordingFormat','Request','GetVoiceExtension','exten'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0x7dc2,0x19d));var _0x27dc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7dc2[_0x20a584];return _0x4b41a8;};'use strict';var client=require('../client');exports['getVoiceExtensions']=function(){return function(){return client[_0x27dc('0x0')](_0x27dc('0x1'),{'options':{'raw':!![],'attributes':['id',_0x27dc('0x2'),_0x27dc('0x3')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0xa0bc=['exten','recordingFormat','getVoiceExtensions','Request'];(function(_0x476bf9,_0x1f3e37){var _0x382acd=function(_0x25bba2){while(--_0x25bba2){_0x476bf9['push'](_0x476bf9['shift']());}};_0x382acd(++_0x1f3e37);}(_0xa0bc,0x1b6));var _0xca0b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa0bc[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0xca0b('0x0')]=function(){return function(){return client[_0xca0b('0x1')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0xca0b('0x2'),_0xca0b('0x3')],'where':{'VoiceExtensionId':null}},'log':_0xca0b('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index de7caee..ea7bfc6 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 _0x930d=['dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateTimeout','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupClient','monitor_format','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency'];(function(_0x595013,_0x65a215){var _0x2a29e3=function(_0x307bf8){while(--_0x307bf8){_0x595013['push'](_0x595013['shift']());}};_0x2a29e3(++_0x65a215);}(_0x930d,0x17b));var _0xd930=function(_0x5a7d5f,_0x5695cb){_0x5a7d5f=_0x5a7d5f-0x0;var _0x5dcded=_0x930d[_0x5a7d5f];return _0x5dcded;};'use strict';var client=require(_0xd930('0x0'));exports[_0xd930('0x1')]=function(){return function(){return client[_0xd930('0x2')](_0xd930('0x3'),{'options':{'raw':![],'attributes':['id',_0xd930('0x4'),_0xd930('0x5'),_0xd930('0x6'),_0xd930('0x7'),'monitor_format',_0xd930('0x8'),_0xd930('0x9'),_0xd930('0xa'),_0xd930('0xb'),_0xd930('0xc'),_0xd930('0xd'),_0xd930('0xe'),_0xd930('0xf'),'dialPredictiveInterval',_0xd930('0x10'),'dialOriginateCallerIdNumber',_0xd930('0x11'),'dialQueueOptions',_0xd930('0x12'),'dialQueueProject',_0xd930('0x13'),_0xd930('0x14'),'dialBusyMaxRetry',_0xd930('0x15'),_0xd930('0x16'),_0xd930('0x17'),_0xd930('0x18'),_0xd930('0x19'),'dialGlobalInterval',_0xd930('0x1a'),_0xd930('0x1b'),_0xd930('0x1c'),_0xd930('0x1d'),'dialAMDGreeting','dialAMDAfterGreetingSilence',_0xd930('0x1e'),_0xd930('0x1f'),_0xd930('0x20'),_0xd930('0x21'),'dialAMDSilenceThreshold',_0xd930('0x22'),'timeout',_0xd930('0x23'),'dialRecallInQueue',_0xd930('0x24'),'dialAgiAfterHangupAgent',_0xd930('0x25'),'dialQueueProject2',_0xd930('0x26'),_0xd930('0x27'),_0xd930('0x28'),'dialCutDigit',_0xd930('0x29'),_0xd930('0x2a'),_0xd930('0x2b'),_0xd930('0x2c'),_0xd930('0x2d'),'dialAbandonedRetryFrequency',_0xd930('0x2e'),_0xd930('0x2f'),_0xd930('0x30'),_0xd930('0x31'),_0xd930('0x32'),_0xd930('0x33'),'dialPredictiveIntervalMinThreshold'],'include':[{'model':'Trunk','as':_0xd930('0x34'),'attributes':['id',_0xd930('0x4'),_0xd930('0x35'),_0xd930('0x36')]},{'model':_0xd930('0x37'),'as':_0xd930('0x38'),'attributes':['id','name']},{'model':_0xd930('0x34'),'as':_0xd930('0x39'),'attributes':['id',_0xd930('0x4'),_0xd930('0x35'),_0xd930('0x36')]},{'model':_0xd930('0x3a'),'as':_0xd930('0x3a'),'attributes':['id','name'],'include':[{'model':'Interval','as':_0xd930('0x3b'),'attributes':['id','name',_0xd930('0x3c')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file +var _0x3b0d=['dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMinThreshold','Trunk','name','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','getVoiceQueues','../client','GetVoiceQueue','acwTimeout','autopause','monitor_format','type','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry'];(function(_0x262c39,_0x14b574){var _0x371d00=function(_0x2fc39e){while(--_0x2fc39e){_0x262c39['push'](_0x262c39['shift']());}};_0x371d00(++_0x14b574);}(_0x3b0d,0x89));var _0xd3b0=function(_0x236d0a,_0x131e79){_0x236d0a=_0x236d0a-0x0;var _0x3ebff0=_0x3b0d[_0x236d0a];return _0x3ebff0;};'use strict';var client=require(_0xd3b0('0x0'));exports['getVoiceQueues']=function(){return function(){return client['Request'](_0xd3b0('0x1'),{'options':{'raw':![],'attributes':['id','name','acw',_0xd3b0('0x2'),_0xd3b0('0x3'),_0xd3b0('0x4'),_0xd3b0('0x5'),'dialActive',_0xd3b0('0x6'),_0xd3b0('0x7'),'dialLimitQueue',_0xd3b0('0x8'),_0xd3b0('0x9'),_0xd3b0('0xa'),'dialPredictiveInterval',_0xd3b0('0xb'),_0xd3b0('0xc'),'dialOriginateTimeout',_0xd3b0('0xd'),_0xd3b0('0xe'),_0xd3b0('0xf'),'dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry',_0xd3b0('0x10'),'dialNoAnswerMaxRetry',_0xd3b0('0x11'),_0xd3b0('0x12'),_0xd3b0('0x13'),_0xd3b0('0x14'),_0xd3b0('0x15'),_0xd3b0('0x16'),'dialAMDActive',_0xd3b0('0x17'),_0xd3b0('0x18'),_0xd3b0('0x19'),'dialAMDTotalAnalysisTime',_0xd3b0('0x1a'),_0xd3b0('0x1b'),_0xd3b0('0x1c'),_0xd3b0('0x1d'),_0xd3b0('0x1e'),_0xd3b0('0x1f'),_0xd3b0('0x20'),_0xd3b0('0x21'),_0xd3b0('0x22'),_0xd3b0('0x23'),'dialAgiAfterHangupClient','dialQueueProject2',_0xd3b0('0x4'),_0xd3b0('0x24'),_0xd3b0('0x25'),_0xd3b0('0x26'),_0xd3b0('0x27'),'dialNoSuchNumberRetryFrequency',_0xd3b0('0x28'),'dialDropRetryFrequency',_0xd3b0('0x29'),_0xd3b0('0x2a'),_0xd3b0('0x2b'),_0xd3b0('0x2c'),_0xd3b0('0x2d'),_0xd3b0('0x2e'),'mandatoryDisposition','dialPredictiveIntervalMaxThreshold',_0xd3b0('0x2f')],'include':[{'model':_0xd3b0('0x30'),'as':'Trunk','attributes':['id',_0xd3b0('0x31'),_0xd3b0('0x32'),_0xd3b0('0x33')]},{'model':_0xd3b0('0x34'),'as':_0xd3b0('0x35'),'attributes':['id',_0xd3b0('0x31')]},{'model':_0xd3b0('0x30'),'as':_0xd3b0('0x36'),'attributes':['id',_0xd3b0('0x31'),_0xd3b0('0x32'),_0xd3b0('0x33')]},{'model':_0xd3b0('0x37'),'as':'Interval','attributes':['id',_0xd3b0('0x31')],'include':[{'model':_0xd3b0('0x37'),'as':_0xd3b0('0x38'),'attributes':['id','name',_0xd3b0('0x39')]}]}]},'log':_0xd3b0('0x3a')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index d572b4a..a50353c 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(_0x571efe,_0x52f2dc){var _0x30d78a=function(_0x14afb0){while(--_0x14afb0){_0x571efe['push'](_0x571efe['shift']());}};_0x30d78a(++_0x52f2dc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'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(_0x219386,_0x48c44e){var _0x345a04=function(_0x2d85e6){while(--_0x2d85e6){_0x219386['push'](_0x219386['shift']());}};_0x345a04(++_0x48c44e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'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 f41a822..c5ed8ea 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 _0xd20f=['Request','getVoiceQueueRtPauses','../client'];(function(_0x4a6b91,_0xd051af){var _0x4042c1=function(_0x5bcc93){while(--_0x5bcc93){_0x4a6b91['push'](_0x4a6b91['shift']());}};_0x4042c1(++_0xd051af);}(_0xd20f,0x16d));var _0xfd20=function(_0x2b7ee8,_0x3c47ad){_0x2b7ee8=_0x2b7ee8-0x0;var _0x3ee824=_0xd20f[_0x2b7ee8];return _0x3ee824;};'use strict';var client=require(_0xfd20('0x0'));exports['getVoiceQueueRtPauses']=function(_0x527b8a){return function(){return client[_0xfd20('0x1')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x527b8a,'paused':!![]},'raw':!![]},'log':_0xfd20('0x2')});};}; \ No newline at end of file +var _0x24e0=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses','../client'];(function(_0xc12dac,_0x126684){var _0x4448f1=function(_0x233e7a){while(--_0x233e7a){_0xc12dac['push'](_0xc12dac['shift']());}};_0x4448f1(++_0x126684);}(_0x24e0,0xa3));var _0x024e=function(_0x465aed,_0x139d28){_0x465aed=_0x465aed-0x0;var _0x3fd566=_0x24e0[_0x465aed];return _0x3fd566;};'use strict';var client=require(_0x024e('0x0'));exports[_0x024e('0x1')]=function(_0x94ca10){return function(){return client[_0x024e('0x2')](_0x024e('0x3'),{'options':{'where':{'VoiceQueueId':_0x94ca10,'paused':!![]},'raw':!![]},'log':_0x024e('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 0593510..cbc693c 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(_0x3f1265,_0x2cb6fb){var _0x58b288=function(_0x5add75){while(--_0x5add75){_0x3f1265['push'](_0x3f1265['shift']());}};_0x58b288(++_0x2cb6fb);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'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(_0x4b30b7,_0x3e1097){var _0x49ef60=function(_0x5b92ba){while(--_0x5b92ba){_0x4b30b7['push'](_0x4b30b7['shift']());}};_0x49ef60(++_0x3e1097);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'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 c23a9ed..0272fdf 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 _0x9456=['transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','attended','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','blind','origtransfererchannel','origtransferercalleridname','origtransfererlinkedid'];(function(_0x30d1e8,_0x39d0c8){var _0x486c07=function(_0x3c51dd){while(--_0x3c51dd){_0x30d1e8['push'](_0x30d1e8['shift']());}};_0x486c07(++_0x39d0c8);}(_0x9456,0x71));var _0x6945=function(_0x579065,_0x1b9178){_0x579065=_0x579065-0x0;var _0x1c84bc=_0x9456[_0x579065];return _0x1c84bc;};'use strict';var client=require('../client');exports[_0x6945('0x0')]={};exports[_0x6945('0x1')]=function(_0x34940d){return client[_0x6945('0x2')](_0x6945('0x3'),{'body':{'result':_0x34940d[_0x6945('0x4')],'transfererchannel':_0x34940d[_0x6945('0x5')],'transferercalleridnum':_0x34940d[_0x6945('0x6')],'transferercalleridname':_0x34940d[_0x6945('0x7')],'transfererconnectedlinenum':_0x34940d[_0x6945('0x8')],'transfererconnectedlinename':_0x34940d[_0x6945('0x9')],'transfereraccountcode':_0x34940d[_0x6945('0xa')],'transferercontext':_0x34940d[_0x6945('0xb')],'transfererexten':_0x34940d[_0x6945('0xc')],'transfererlinkedid':_0x34940d[_0x6945('0xd')],'transfereechannel':_0x34940d['transfereechannel'],'transfereecalleridnum':_0x34940d[_0x6945('0xe')],'transfereecalleridname':_0x34940d[_0x6945('0xf')],'transfereeconnectedlinenum':_0x34940d[_0x6945('0x10')],'transfereeconnectedlinename':_0x34940d[_0x6945('0x11')],'transfereeaccountcode':_0x34940d['transfereeaccountcode'],'transfereecontext':_0x34940d[_0x6945('0x12')],'transfereeexten':_0x34940d[_0x6945('0x13')],'transfereelinkedid':_0x34940d[_0x6945('0x14')],'isexternal':_0x34940d[_0x6945('0x15')],'context':_0x34940d[_0x6945('0x16')],'extension':_0x34940d['extension'],'type':_0x6945('0x17')},'log':_0x6945('0x3')});};exports['attendedTransfer']=function(_0x27a095){return client['Request'](_0x6945('0x3'),{'body':{'result':_0x27a095[_0x6945('0x4')],'transfererchannel':_0x27a095[_0x6945('0x18')],'transferercalleridnum':_0x27a095['origtransferercalleridnum'],'transferercalleridname':_0x27a095[_0x6945('0x19')],'transfererconnectedlinenum':_0x27a095['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x27a095['secondtransfererconnectedlinename'],'transfereraccountcode':_0x27a095['origtransfereraccountcode'],'transferercontext':_0x27a095['secondtransferercontext'],'transfererexten':_0x27a095['secondtransfererexten'],'transfererlinkedid':_0x27a095[_0x6945('0x1a')],'transfereechannel':_0x27a095['transfertargetchannel'],'transfereecalleridnum':_0x27a095[_0x6945('0x1b')],'transfereecalleridname':_0x27a095[_0x6945('0x1c')],'transfereeconnectedlinenum':_0x27a095[_0x6945('0x1d')],'transfereeconnectedlinename':_0x27a095[_0x6945('0x1e')],'transfereeaccountcode':_0x27a095['transfertargetaccountcode'],'transfereecontext':_0x27a095[_0x6945('0x1f')],'transfereeexten':_0x27a095[_0x6945('0x20')],'transfereelinkedid':_0x27a095[_0x6945('0x21')],'isexternal':_0x27a095[_0x6945('0x15')],'context':_0x27a095['origtransferercontext'],'extension':_0x27a095['origtransfererexten'],'type':_0x6945('0x22')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file +var _0x5dc7=['transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','Request','CreateVoiceTransferReport','result','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transferercontext','transfererexten','transfereechannel','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','transfertargetchannel'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5dc7,0x1de));var _0x75dc=function(_0x1de098,_0x281154){_0x1de098=_0x1de098-0x0;var _0x45d886=_0x5dc7[_0x1de098];return _0x45d886;};'use strict';var client=require(_0x75dc('0x0'));exports['transfers']={};exports['blindTransfer']=function(_0x3d90b2){return client[_0x75dc('0x1')](_0x75dc('0x2'),{'body':{'result':_0x3d90b2[_0x75dc('0x3')],'transfererchannel':_0x3d90b2['transfererchannel'],'transferercalleridnum':_0x3d90b2['transferercalleridnum'],'transferercalleridname':_0x3d90b2[_0x75dc('0x4')],'transfererconnectedlinenum':_0x3d90b2[_0x75dc('0x5')],'transfererconnectedlinename':_0x3d90b2[_0x75dc('0x6')],'transfereraccountcode':_0x3d90b2['transfereraccountcode'],'transferercontext':_0x3d90b2[_0x75dc('0x7')],'transfererexten':_0x3d90b2[_0x75dc('0x8')],'transfererlinkedid':_0x3d90b2['transfererlinkedid'],'transfereechannel':_0x3d90b2[_0x75dc('0x9')],'transfereecalleridnum':_0x3d90b2['transfereecalleridnum'],'transfereecalleridname':_0x3d90b2['transfereecalleridname'],'transfereeconnectedlinenum':_0x3d90b2[_0x75dc('0xa')],'transfereeconnectedlinename':_0x3d90b2[_0x75dc('0xb')],'transfereeaccountcode':_0x3d90b2[_0x75dc('0xc')],'transfereecontext':_0x3d90b2[_0x75dc('0xd')],'transfereeexten':_0x3d90b2[_0x75dc('0xe')],'transfereelinkedid':_0x3d90b2[_0x75dc('0xf')],'isexternal':_0x3d90b2[_0x75dc('0x10')],'context':_0x3d90b2[_0x75dc('0x11')],'extension':_0x3d90b2[_0x75dc('0x12')],'type':_0x75dc('0x13')},'log':_0x75dc('0x2')});};exports[_0x75dc('0x14')]=function(_0x35e9b3){return client['Request'](_0x75dc('0x2'),{'body':{'result':_0x35e9b3[_0x75dc('0x3')],'transfererchannel':_0x35e9b3[_0x75dc('0x15')],'transferercalleridnum':_0x35e9b3[_0x75dc('0x16')],'transferercalleridname':_0x35e9b3['origtransferercalleridname'],'transfererconnectedlinenum':_0x35e9b3[_0x75dc('0x17')],'transfererconnectedlinename':_0x35e9b3[_0x75dc('0x18')],'transfereraccountcode':_0x35e9b3[_0x75dc('0x19')],'transferercontext':_0x35e9b3[_0x75dc('0x1a')],'transfererexten':_0x35e9b3[_0x75dc('0x1b')],'transfererlinkedid':_0x35e9b3['origtransfererlinkedid'],'transfereechannel':_0x35e9b3[_0x75dc('0x1c')],'transfereecalleridnum':_0x35e9b3[_0x75dc('0x1d')],'transfereecalleridname':_0x35e9b3[_0x75dc('0x1e')],'transfereeconnectedlinenum':_0x35e9b3[_0x75dc('0x1f')],'transfereeconnectedlinename':_0x35e9b3[_0x75dc('0x20')],'transfereeaccountcode':_0x35e9b3[_0x75dc('0x21')],'transfereecontext':_0x35e9b3[_0x75dc('0x22')],'transfereeexten':_0x35e9b3['transfertargetexten'],'transfereelinkedid':_0x35e9b3[_0x75dc('0x23')],'isexternal':_0x35e9b3[_0x75dc('0x10')],'context':_0x35e9b3[_0x75dc('0x24')],'extension':_0x35e9b3[_0x75dc('0x25')],'type':_0x75dc('0x26')},'log':_0x75dc('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 61f6319..201b9cd 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 _0x82c4=['message','uniqueid','channel','%s.%s','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','status','rec','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','channels','resolve','destinationchannel','StopMixMonitor','stop','filename','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','telephones','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','send','checkAfterSend','server','http','listen','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','jayson/promise','validate','bluebird','moment','../../../config/environment','../ami','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','catch','isConnected','Command','then','content','voiceQueues','hasOwnProperty','strategy','available','sumBillable','sumHoldTime','talking','total','type','unmanaged','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','push','length','find','omit','values','voicechannel','map'];(function(_0x19f26b,_0x428ade){var _0x34c21b=function(_0x2c5020){while(--_0x2c5020){_0x19f26b['push'](_0x19f26b['shift']());}};_0x34c21b(++_0x428ade);}(_0x82c4,0x1ca));var _0x482c=function(_0x56c37d,_0x486618){_0x56c37d=_0x56c37d-0x0;var _0x120476=_0x82c4[_0x56c37d];return _0x120476;};'use strict';var _=require(_0x482c('0x0'));var util=require(_0x482c('0x1'));var jayson=require(_0x482c('0x2'));var schema=require(_0x482c('0x3'));var BPromise=require(_0x482c('0x4'));var moment=require(_0x482c('0x5'));var config=require(_0x482c('0x6'));var properties=require('../properties');var ami=require(_0x482c('0x7'));exports['listen']=function(_0x4556c8,_0x47edb6,_0x477cf4){return new BPromise(function(_0x5d7c76,_0xfdb92){var _0x32a503={'QueuePause':function(_0x35cdab){return new Promise(function(_0x1c10f2,_0x3846d8){var _0x478bd2=util[_0x482c('0x8')](_0x482c('0x9'),_0x482c('0xa'),_0x35cdab[_0x482c('0xb')]);if(_0x4556c8[_0x482c('0xc')]&&_0x4556c8[_0x482c('0xc')][_0x478bd2]&&_0x4556c8['timers'][_0x478bd2][_0x482c('0xd')]){_0x4556c8[_0x482c('0xc')][_0x478bd2][_0x482c('0xe')]();}if(_0x4556c8['agents'][_0x478bd2]){_0x4556c8[_0x482c('0xf')][_0x478bd2][_0x482c('0x10')]({'statePause':_0x35cdab[_0x482c('0x11')]?!![]:![]});}_0x1c10f2({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x4bfb3a){var _0x7b12cf=this;return new Promise(function(_0x30e02b,_0x59837f){if(ami['isConnected']()==![]){return _0x59837f(_0x7b12cf[_0x482c('0x12')](0x1f4,[config[_0x482c('0x13')]['ip'],config[_0x482c('0x13')][_0x482c('0x14')],_0x482c('0x15')][_0x482c('0x16')]('\x20')));}_0x4bfb3a=_[_0x482c('0x17')](_0x4bfb3a,_[_0x482c('0x18')](properties[_0x482c('0x19')]));_0x4bfb3a[_0x482c('0x1a')]=_0x482c('0x1b');return ami[_0x482c('0x1c')](_0x4bfb3a)['then'](function(_0x244bb9){_0x30e02b({'code':0xc8,'message':_0x244bb9['message']});})[_0x482c('0x1d')](function(_0x258148){_0x59837f(_0x7b12cf['error'](0x1f5,_0x258148['message']));});});},'Command':function(_0x357965){var _0x584656=this;return new Promise(function(_0x16fe9a,_0x4784a2){if(ami[_0x482c('0x1e')]()==![]){return _0x4784a2(_0x584656[_0x482c('0x12')](0x1f4,[config['asterisk']['ip'],config[_0x482c('0x13')][_0x482c('0x14')],_0x482c('0x15')][_0x482c('0x16')]('\x20')));}_0x357965=_[_0x482c('0x17')](_0x357965,'command');_0x357965['action']=_0x482c('0x1f');return ami[_0x482c('0x1c')](_0x357965)[_0x482c('0x20')](function(_0x5c4e9c){_0x16fe9a({'code':0xc8,'message':_0x5c4e9c[_0x482c('0x21')]});})['catch'](function(_0x2f3f96){_0x4784a2(_0x584656[_0x482c('0x12')](0x1f5,_0x2f3f96['message']));});});},'VoiceQueues':function(_0x466583){return new Promise(function(_0x5436e2,_0x589bc6){var _0x2165af=[];for(var _0x27f1b5 in _0x4556c8[_0x482c('0x22')]){if(_0x4556c8[_0x482c('0x22')][_0x482c('0x23')](_0x27f1b5)){var _0x215826=_0x4556c8[_0x482c('0x22')][_0x27f1b5];var _0x5ad788={'id':_0x215826['id'],'name':_0x215826[_0x482c('0xb')],'strategy':_0x215826[_0x482c('0x24')],'answered':_0x215826['answered'],'available':_0x215826[_0x482c('0x25')],'loggedIn':_0x215826['loggedIn'],'pTalking':_0x215826['pTalking'],'sumBillable':_0x215826[_0x482c('0x26')],'sumDuration':_0x215826['sumDuration'],'sumHoldTime':_0x215826[_0x482c('0x27')]||0x0,'talking':_0x215826[_0x482c('0x28')],'total':_0x215826[_0x482c('0x29')],'type':_0x215826[_0x482c('0x2a')],'unmanaged':_0x215826[_0x482c('0x2b')],'abandoned':_0x215826[_0x482c('0x2c')],'waiting':_0x215826[_0x482c('0x2d')],'loggedInDb':_0x215826[_0x482c('0x2e')]};if(_0x215826[_0x482c('0x2a')]===_0x482c('0x2f')){_0x5ad788[_0x482c('0x30')]=_0x215826[_0x482c('0x30')];_0x5ad788[_0x482c('0x31')]=_0x215826[_0x482c('0x31')];_0x5ad788[_0x482c('0x32')]=_0x215826[_0x482c('0x32')];_0x5ad788[_0x482c('0x33')]=_0x215826[_0x482c('0x33')];_0x5ad788['dialOriginateTimeout']=_0x215826['dialOriginateTimeout'];_0x5ad788['dialPrefix']=_0x215826[_0x482c('0x34')];_0x5ad788[_0x482c('0x35')]=_0x215826[_0x482c('0x35')];_0x5ad788[_0x482c('0x36')]=_0x215826['outboundAnswerAgiCallsDay'];_0x5ad788[_0x482c('0x37')]=_0x215826['outboundAnswerCallsDay'];_0x5ad788[_0x482c('0x38')]=_0x215826[_0x482c('0x38')];_0x5ad788[_0x482c('0x39')]=_0x215826[_0x482c('0x39')];_0x5ad788[_0x482c('0x3a')]=_0x215826[_0x482c('0x3a')];_0x5ad788[_0x482c('0x3b')]=_0x215826[_0x482c('0x3b')];_0x5ad788['outboundDropCallsDayCallersExit']=_0x215826['outboundDropCallsDayCallersExit'];_0x5ad788[_0x482c('0x3c')]=_0x215826['outboundDropCallsDayTimeout'];_0x5ad788[_0x482c('0x3d')]=_0x215826[_0x482c('0x3d')];_0x5ad788[_0x482c('0x3e')]=_0x215826['outboundNoSuchCallsDay'];_0x5ad788[_0x482c('0x3f')]=_0x215826[_0x482c('0x3f')];_0x5ad788[_0x482c('0x40')]=_0x215826[_0x482c('0x40')];_0x5ad788['outboundRejectCallsDay']=_0x215826[_0x482c('0x41')];_0x5ad788['outboundUnknownCallsDay']=_0x215826[_0x482c('0x42')];_0x5ad788['predictiveIntervalAnsweredCalls']=_0x215826[_0x482c('0x43')];_0x5ad788['predictiveIntervalAvgHoldtime']=_0x215826[_0x482c('0x44')];_0x5ad788[_0x482c('0x45')]=_0x215826['predictiveIntervalAvgTalktime'];_0x5ad788[_0x482c('0x46')]=_0x215826['predictiveIntervalDroppedCallsCallersExit'];_0x5ad788['predictiveIntervalDroppedCallsTimeout']=_0x215826[_0x482c('0x47')];_0x5ad788['predictiveIntervalErlangCalls']=_0x215826['predictiveIntervalErlangCalls'];_0x5ad788['predictiveIntervalErlangCallsDroppedCalls']=_0x215826['predictiveIntervalErlangCallsDroppedCalls'];_0x5ad788[_0x482c('0x48')]=_0x215826[_0x482c('0x48')];_0x5ad788[_0x482c('0x49')]=_0x215826[_0x482c('0x49')];_0x5ad788[_0x482c('0x4a')]=_0x215826['predictiveIntervalPauses'];_0x5ad788[_0x482c('0x4b')]=_0x215826[_0x482c('0x4b')];_0x5ad788[_0x482c('0x4c')]=_0x215826[_0x482c('0x4c')];_0x5ad788['message']=_0x215826['message'];_0x5ad788[_0x482c('0x4d')]=_0x215826[_0x482c('0x4d')];_0x5ad788[_0x482c('0x4e')]=_0x215826[_0x482c('0x4e')];_0x5ad788[_0x482c('0x4f')]=_0x215826[_0x482c('0x4f')];_0x5ad788[_0x482c('0x50')]=_0x215826[_0x482c('0x50')];_0x5ad788[_0x482c('0x51')]=_0x215826[_0x482c('0x51')];_0x5ad788[_0x482c('0x52')]=_0x215826['startPredictive'];_0x5ad788[_0x482c('0x53')]=_0x215826[_0x482c('0x53')];}if(_0x215826[_0x482c('0x54')]){_0x5ad788[_0x482c('0x54')]={'id':_0x215826[_0x482c('0x54')]['id'],'name':_0x215826[_0x482c('0x54')][_0x482c('0xb')],'active':_0x215826['Trunk']['active'],'callerid':_0x215826[_0x482c('0x54')][_0x482c('0x55')]};}if(_0x215826[_0x482c('0x56')]){_0x5ad788['Interval']={'id':_0x215826[_0x482c('0x56')]['id'],'name':_0x215826['Interval'][_0x482c('0xb')]};}_0x2165af[_0x482c('0x57')](_0x5ad788);}}_0x5436e2({'count':_0x2165af[_0x482c('0x58')],'rows':_0x2165af});});},'UpdateVoiceQueue':function(_0x16b893){return new Promise(function(_0x5f4e0a,_0x1ff623){var _0x2c37f3=_[_0x482c('0x59')](_0x4556c8['voiceQueues'],{'id':parseInt(_0x16b893['id'])});var _0x407471=_[_0x482c('0x5a')](_0x16b893,['id']);if(_0x2c37f3){for(var _0xcf89c4 in _0x407471){if(typeof _0x407471[_0xcf89c4]!=='undefined'&&typeof _0x2c37f3[_0xcf89c4]!=='undefined'){_0x2c37f3[_0xcf89c4]=_0x407471[_0xcf89c4];}}_0x5f4e0a(_0x2c37f3);}else{_0x1ff623();}});},'VoiceChannels':function(_0x4a677d){return new Promise(function(_0x4998a5,_0x596ec2){var _0x56b6c5=_[_0x482c('0x5b')](_0x4556c8['channels']);_0x4998a5({'count':_0x56b6c5[_0x482c('0x58')],'rows':_0x56b6c5});});},'VoiceChannelMixMonitor':function(_0xbdbd1b){var _0x3ecf00=this;return new Promise(function(_0x2fa930,_0x40174a){if(ami[_0x482c('0x1e')]()==![]){return _0x40174a(_0x3ecf00[_0x482c('0x12')](0x1f4,[config[_0x482c('0x13')]['ip'],config[_0x482c('0x13')][_0x482c('0x14')],_0x482c('0x15')][_0x482c('0x16')]('\x20')));}var _0x1126b7=schema(properties[_0x482c('0x5c')])[_0x482c('0x3')](_0xbdbd1b);if(_0x1126b7[_0x482c('0x58')]>0x0){return _0x40174a(_0x3ecf00[_0x482c('0x12')](0x1f4,_[_0x482c('0x5d')](_0x1126b7,_0x482c('0x5e'))['join'](',\x20')));}var _0x107b1b=_[_0x482c('0x59')](_0x4556c8['channels'],{'uniqueid':_0xbdbd1b[_0x482c('0x5f')]});if(_0x107b1b&&_0x107b1b[_0x482c('0x60')]){var _0x1f5e5b=util[_0x482c('0x8')](_0x482c('0x61'),_0xbdbd1b['filename']||_0xbdbd1b['uniqueid'],_0xbdbd1b[_0x482c('0x8')]||_0x482c('0x62'));return ami[_0x482c('0x1c')]({'action':_0x482c('0x63'),'channel':_0x107b1b[_0x482c('0x60')],'file':_0x1f5e5b,'options':_0x482c('0x64')})[_0x482c('0x20')](function(_0x55925a){var _0x508a10=_['find'](_0x107b1b[_0x482c('0x65')],{'filename':_0x482c('0x66')+_0x1f5e5b[_0x482c('0x67')]()});if(_[_0x482c('0x68')](_0x508a10)){_0x107b1b[_0x482c('0x65')][_0x482c('0x57')]({'filename':_0x482c('0x66')+_0x1f5e5b[_0x482c('0x67')](),'createdAt':moment()[_0x482c('0x8')](_0x482c('0x69')),'mixmonitorid':_0x55925a[_0x482c('0x6a')],'status':'rec'});}else{_0x508a10[_0x482c('0x6a')]=_0x55925a[_0x482c('0x6a')];_0x508a10[_0x482c('0x6b')]=_0x482c('0x6c');}_0x2fa930({'code':0xc8,'message':[_0xbdbd1b[_0x482c('0x5f')],_0x482c('0x6d'),_0x55925a[_0x482c('0x6a')]][_0x482c('0x16')]('\x20'),'mixmonitorid':_0x55925a[_0x482c('0x6a')]});})[_0x482c('0x1d')](function(_0x3981cf){_0x40174a(_0x3ecf00[_0x482c('0x12')](0x1f5,[_0xbdbd1b['uniqueid'],_0x3981cf['message'][_0x482c('0x67')]()][_0x482c('0x16')]('\x20')));});}else{return _0x40174a(_0x3ecf00[_0x482c('0x12')](0x1f5,_0x482c('0x6e')));}});},'VoiceChannelStopMixMonitor':function(_0xa5ffff){var _0x313155=this;return new Promise(function(_0x5382b0,_0x231353){if(ami[_0x482c('0x1e')]()==![]){return _0x231353(_0x313155[_0x482c('0x12')](0x1f4,[config[_0x482c('0x13')]['ip'],config[_0x482c('0x13')][_0x482c('0x14')],_0x482c('0x15')][_0x482c('0x16')]('\x20')));}var _0x1840a9=schema(properties[_0x482c('0x5c')])[_0x482c('0x3')](_0xa5ffff);if(_0x1840a9[_0x482c('0x58')]>0x0){return _0x231353(_0x313155['error'](0x1f4,_[_0x482c('0x5d')](_0x1840a9,'message')[_0x482c('0x16')](',\x20')));}var _0x1bb8d1=_[_0x482c('0x59')](_0x4556c8[_0x482c('0x6f')],{'uniqueid':_0xa5ffff[_0x482c('0x5f')]});if(_0x1bb8d1){return BPromise[_0x482c('0x70')]()['then'](function(){if(_0x1bb8d1[_0x482c('0x60')]){return ami[_0x482c('0x1c')]({'action':'StopMixMonitor','channel':_0x1bb8d1['channel'],'mixmonitorid':_0xa5ffff[_0x482c('0x6a')]})[_0x482c('0x1d')](function(_0x481241){});}})[_0x482c('0x20')](function(){if(_0x1bb8d1[_0x482c('0x71')]){return ami[_0x482c('0x1c')]({'action':_0x482c('0x72'),'channel':_0x1bb8d1['destinationchannel'],'mixmonitorid':_0xa5ffff[_0x482c('0x6a')]})[_0x482c('0x1d')](function(_0x21a0c5){});}})[_0x482c('0x20')](function(_0x3a37f5){var _0x2fc65f=_['find'](_0x1bb8d1['monitors'],{'mixmonitorid':_0xa5ffff[_0x482c('0x6a')]});if(_0x2fc65f){_0x2fc65f[_0x482c('0x6b')]=_0x482c('0x73');}})['then'](function(){var _0x23349f=util[_0x482c('0x8')](_0x482c('0x61'),_0xa5ffff[_0x482c('0x74')]||_0xa5ffff[_0x482c('0x5f')],_0xa5ffff[_0x482c('0x8')]||_0x482c('0x62'));var _0x37e456=_[_0x482c('0x59')](_0x1bb8d1['monitors'],{'filename':'/var/spool/asterisk/monitor/'+_0x23349f[_0x482c('0x67')]()});if(_0x37e456){_0x37e456[_0x482c('0x6b')]='stop';}})['then'](function(){_0x5382b0({'code':0xc8,'message':[_0xa5ffff[_0x482c('0x5f')],_0x482c('0x75')][_0x482c('0x16')]('\x20')});})['catch'](function(_0x510f07){_0x231353(_0x313155['error'](0x1f5,[_0xa5ffff[_0x482c('0x5f')],_0x510f07[_0x482c('0x5e')][_0x482c('0x67')]()][_0x482c('0x16')]('\x20')));});}else{return _0x231353(_0x313155[_0x482c('0x12')](0x1f5,_0x482c('0x6e')));}});},'VoiceQueuesChannels':function(_0x4839f2){return new Promise(function(_0x5e5e76,_0x2ec137){var _0x1d878f=_[_0x482c('0x5b')](_0x4556c8[_0x482c('0x76')]);_0x5e5e76({'count':_0x1d878f[_0x482c('0x58')],'rows':_0x1d878f});});},'VoiceQueuesChannel':function(_0x1c9531){var _0x2444a8=this;return new Promise(function(_0x445edb,_0x1c771f){var _0x142809=schema(properties[_0x482c('0x77')])[_0x482c('0x3')](_0x1c9531);if(_0x142809['length']>0x0){return _0x1c771f(_0x2444a8[_0x482c('0x12')](0x1f4,_[_0x482c('0x5d')](_0x142809,_0x482c('0x5e'))['join'](',\x20')));}var _0x2f781d=_[_0x482c('0x59')](_0x4556c8[_0x482c('0x76')],{'uniqueid':_0x1c9531['uniqueid']});if(_0x2f781d){_0x445edb(_0x2f781d);}else{return _0x1c771f(_0x2444a8[_0x482c('0x12')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x4bd929){var _0xcf240d=this;return new Promise(function(_0x14c94c,_0x383254){if(ami[_0x482c('0x1e')]()==![]){return _0x383254(_0xcf240d[_0x482c('0x12')](0x1f4,[config[_0x482c('0x13')]['ip'],config[_0x482c('0x13')]['username'],_0x482c('0x15')][_0x482c('0x16')]('\x20')));}var _0x5eb509=schema(properties[_0x482c('0x78')])['validate'](_0x4bd929);if(_0x5eb509['length']>0x0){return _0x383254(_0xcf240d['error'](0x1f4,_[_0x482c('0x5d')](_0x5eb509,'message')['join'](',\x20')));}var _0xc7bebc=_[_0x482c('0x59')](_0x4556c8['queueChannels'],{'uniqueid':_0x4bd929[_0x482c('0x5f')]});if(_0xc7bebc&&_0xc7bebc['channel']){return ami['Action']({'action':'Hangup','channel':_0xc7bebc[_0x482c('0x60')]})[_0x482c('0x20')](function(_0x4fc3ef){_0x14c94c({'code':0xc8,'message':[_0x4bd929['uniqueid'],_0x4fc3ef['message'][_0x482c('0x67')]()][_0x482c('0x16')]('\x20')});})[_0x482c('0x1d')](function(_0x58eebf){_0x383254(_0xcf240d['error'](0x1f5,[_0x4bd929[_0x482c('0x5f')],_0x58eebf['message'][_0x482c('0x67')]()][_0x482c('0x16')]('\x20')));});}else{return _0x383254(_0xcf240d['error'](0x1f5,_0x482c('0x6e')));}});},'VoiceQueuesChannelRedirect':function(_0x5b804f){var _0x48b9c2=this;return new Promise(function(_0x2c0056,_0x4d6926){if(ami[_0x482c('0x1e')]()==![]){return _0x4d6926(_0x48b9c2['error'](0x1f4,[config[_0x482c('0x13')]['ip'],config['asterisk'][_0x482c('0x14')],_0x482c('0x15')][_0x482c('0x16')]('\x20')));}var _0x5b9153=schema(properties[_0x482c('0x79')])[_0x482c('0x3')](_0x5b804f);if(_0x5b9153[_0x482c('0x58')]>0x0){return _0x4d6926(_0x48b9c2['error'](0x1f4,_[_0x482c('0x5d')](_0x5b9153,_0x482c('0x5e'))[_0x482c('0x16')](',\x20')));}var _0x38eafd=_[_0x482c('0x59')](_0x4556c8[_0x482c('0x76')],{'uniqueid':_0x5b804f[_0x482c('0x5f')]});if(_0x38eafd&&_0x38eafd['channel']){return ami[_0x482c('0x1c')]({'action':_0x482c('0x7a'),'channel':_0x38eafd[_0x482c('0x60')],'exten':_0x5b804f['exten'],'context':_0x5b804f['context']||_0x38eafd['context'],'priority':0x1})[_0x482c('0x20')](function(_0x5b3629){_0x2c0056({'code':0xc8,'message':[_0x5b804f['uniqueid'],_0x5b3629[_0x482c('0x5e')]['toLowerCase']()][_0x482c('0x16')]('\x20')});})[_0x482c('0x1d')](function(_0x17be77){_0x4d6926(_0x48b9c2[_0x482c('0x12')](0x1f5,[_0x5b804f['uniqueid'],_0x17be77[_0x482c('0x5e')]['toLowerCase']()][_0x482c('0x16')]('\x20')));});}else{return _0x4d6926(_0x48b9c2[_0x482c('0x12')](0x1f5,_0x482c('0x6e')));}});},'Agents':function(_0x492ab0){return new Promise(function(_0x590d97,_0x145c5e){var _0x45011c=_['values'](_0x4556c8[_0x482c('0xf')]);_0x590d97({'count':_0x45011c['length'],'rows':_0x45011c});});},'Telephones':function(_0x929a4){return new Promise(function(_0x2c683f,_0x2f5799){var _0x549dec=_[_0x482c('0x5b')](_0x4556c8[_0x482c('0x7b')]);_0x2c683f({'count':_0x549dec[_0x482c('0x58')],'rows':_0x549dec});});},'Trunks':function(_0x573455){return new Promise(function(_0x27b6d2,_0x34f49f){var _0x56a961=_['values'](_0x4556c8['trunks']);_0x27b6d2({'count':_0x56a961[_0x482c('0x58')],'rows':_0x56a961});});},'OutboundChannels':function(_0x88661b){return new Promise(function(_0x3f0561,_0x4903f1){var _0xd5f6df=_[_0x482c('0x5b')](_0x4556c8['outboundChannels']);_0x3f0561({'count':_0xd5f6df[_0x482c('0x58')],'rows':_0xd5f6df});});},'Outbound':function(_0x5516d6){return new Promise(function(_0x106aa1,_0x363735){_0x106aa1(_0x4556c8[_0x482c('0x2f')]);});},'Campaigns':function(_0x1b4c75){return new Promise(function(_0x2db600,_0x255894){var _0x4dbd16=_['values'](_0x4556c8[_0x482c('0x7c')]);_0x2db600({'count':_0x4dbd16[_0x482c('0x58')],'rows':_0x4dbd16});});},'VoiceQueuesPreview':function(_0x2156af){var _0x319fc3=this;return new Promise(function(_0x7d0afa,_0x13df33){_0x47edb6[_0x482c('0x7d')](_0x2156af['id'])['then'](function(_0x3f5eac){_0x7d0afa({'code':0xc8,'message':_0x3f5eac[_0x482c('0x5e')]});})[_0x482c('0x1d')](function(_0x483e29){_0x13df33(_0x319fc3[_0x482c('0x12')](0x1f4,_0x483e29[_0x482c('0x5e')]));});});},'EventManager':function(_0x2eca83){var _0x190ee5=this;return new Promise(function(_0x45fe30,_0x1f4fd0){if(!_0x2eca83[_0x482c('0x7e')]){return _0x1f4fd0(_0x190ee5['error'](0x1f4,_0x482c('0x7f')));}ami[_0x482c('0x80')](_0x482c('0x81')+_0x2eca83['event'],_0x2eca83[_0x482c('0x5e')]);_0x45fe30({'code':0xc8,'message':_0x2eca83});});},'FaxAccounts':function(_0x55a8a6){return new Promise(function(_0x335a76,_0x3b948c){var _0x3e00e2=_[_0x482c('0x5b')](_0x4556c8['faxAccounts']);_0x335a76({'count':_0x3e00e2[_0x482c('0x58')],'rows':_0x3e00e2});});},'SendFax':function(_0xeaee3d){var _0x1120e1=this;return new Promise(function(_0xf8ac35,_0x5e3619){_0x477cf4[_0x482c('0x82')](_0xeaee3d)[_0x482c('0x20')](function(_0x157896){_0xf8ac35({'code':0xc8,'message':_0x157896[_0x482c('0x5e')]});})[_0x482c('0x1d')](function(_0x4aead3){_0x5e3619(_0x1120e1[_0x482c('0x12')](0x1f4,_0x4aead3[_0x482c('0x5e')]));});});},'CheckAfterSend':function(_0x1911f1){var _0x308dc8=this;return new Promise(function(_0x10fb1f,_0x5cd466){_0x477cf4[_0x482c('0x83')](_0x1911f1)[_0x482c('0x20')](function(_0x44da80){_0x10fb1f({'code':0xc8,'message':_0x44da80['message']});})[_0x482c('0x1d')](function(_0x1f2546){_0x5cd466(_0x308dc8[_0x482c('0x12')](0x1f4,_0x1f2546[_0x482c('0x5e')]));});});}};var _0x519225=jayson[_0x482c('0x84')](_0x32a503)[_0x482c('0x85')]();_0x519225['on'](_0x482c('0x12'),function(_0x5cbf1a){return _0xfdb92(_0x5cbf1a);});_0x519225[_0x482c('0x86')](0x232a,_0x482c('0x87'),function(){console[_0x482c('0x88')](_0x482c('0x89'),0x232a);return _0x5d7c76('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file +var _0x5d58=['RPC\x20listening\x20on\x20port:','moment','../../../config/environment','../ami','listen','%s/%s','SIP','name','timer','timers','updateAcw','agents','updateStatusRealtime','pause','isConnected','error','asterisk','username','join','pick','keys','module','action','Reload','Action','then','message','catch','ami\x20disconnected','command','Command','voiceQueues','strategy','answered','available','loggedIn','pTalking','sumDuration','sumHoldTime','talking','total','type','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','active','callerid','Interval','push','length','find','omit','undefined','values','channels','map','uniqueid','channel','format','%s.%s','filename','wav','MixMonitor','/var/spool/asterisk/monitor/','isNil','monitors','mixmonitorid','status','rec','toLowerCase','Channel\x20doesn\x27t\x20exist','voicechannel','validate','resolve','destinationchannel','StopMixMonitor','stop','queueChannels','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','context','telephones','outboundChannels','campaigns','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','http'];(function(_0x252a1a,_0x1b0a95){var _0x364318=function(_0x300cca){while(--_0x300cca){_0x252a1a['push'](_0x252a1a['shift']());}};_0x364318(++_0x1b0a95);}(_0x5d58,0x187));var _0x85d5=function(_0x59121b,_0x4e1c08){_0x59121b=_0x59121b-0x0;var _0x5a1efc=_0x5d58[_0x59121b];return _0x5a1efc;};'use strict';var _=require('lodash');var util=require('util');var jayson=require('jayson/promise');var schema=require('validate');var BPromise=require('bluebird');var moment=require(_0x85d5('0x0'));var config=require(_0x85d5('0x1'));var properties=require('../properties');var ami=require(_0x85d5('0x2'));exports[_0x85d5('0x3')]=function(_0x54207b,_0x1eb211,_0x2d457a){return new BPromise(function(_0x578fad,_0x46e7b4){var _0x5f47ec={'QueuePause':function(_0x98c963){return new Promise(function(_0x3fecca,_0x4ca293){var _0x4326a8=util['format'](_0x85d5('0x4'),_0x85d5('0x5'),_0x98c963[_0x85d5('0x6')]);if(_0x54207b['timers']&&_0x54207b['timers'][_0x4326a8]&&_0x54207b['timers'][_0x4326a8][_0x85d5('0x7')]){_0x54207b[_0x85d5('0x8')][_0x4326a8][_0x85d5('0x9')]();}if(_0x54207b[_0x85d5('0xa')][_0x4326a8]){_0x54207b[_0x85d5('0xa')][_0x4326a8][_0x85d5('0xb')]({'statePause':_0x98c963[_0x85d5('0xc')]?!![]:![]});}_0x3fecca({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x4bbf2a){var _0x4869ca=this;return new Promise(function(_0x3e1285,_0x226d34){if(ami[_0x85d5('0xd')]()==![]){return _0x226d34(_0x4869ca[_0x85d5('0xe')](0x1f4,[config[_0x85d5('0xf')]['ip'],config[_0x85d5('0xf')][_0x85d5('0x10')],'ami\x20disconnected'][_0x85d5('0x11')]('\x20')));}_0x4bbf2a=_[_0x85d5('0x12')](_0x4bbf2a,_[_0x85d5('0x13')](properties[_0x85d5('0x14')]));_0x4bbf2a[_0x85d5('0x15')]=_0x85d5('0x16');return ami[_0x85d5('0x17')](_0x4bbf2a)[_0x85d5('0x18')](function(_0x17652b){_0x3e1285({'code':0xc8,'message':_0x17652b[_0x85d5('0x19')]});})[_0x85d5('0x1a')](function(_0x432bd6){_0x226d34(_0x4869ca[_0x85d5('0xe')](0x1f5,_0x432bd6[_0x85d5('0x19')]));});});},'Command':function(_0x341e8e){var _0x26981b=this;return new Promise(function(_0x54e991,_0x1d6134){if(ami['isConnected']()==![]){return _0x1d6134(_0x26981b[_0x85d5('0xe')](0x1f4,[config[_0x85d5('0xf')]['ip'],config['asterisk'][_0x85d5('0x10')],_0x85d5('0x1b')]['join']('\x20')));}_0x341e8e=_['pick'](_0x341e8e,_0x85d5('0x1c'));_0x341e8e['action']=_0x85d5('0x1d');return ami['Action'](_0x341e8e)[_0x85d5('0x18')](function(_0x1f8d27){_0x54e991({'code':0xc8,'message':_0x1f8d27['content']});})['catch'](function(_0x4da71b){_0x1d6134(_0x26981b['error'](0x1f5,_0x4da71b[_0x85d5('0x19')]));});});},'VoiceQueues':function(_0x46c06e){return new Promise(function(_0x244353,_0x466bbd){var _0x12fea3=[];for(var _0xef2405 in _0x54207b['voiceQueues']){if(_0x54207b[_0x85d5('0x1e')]['hasOwnProperty'](_0xef2405)){var _0x1b3fae=_0x54207b[_0x85d5('0x1e')][_0xef2405];var _0x233ccd={'id':_0x1b3fae['id'],'name':_0x1b3fae['name'],'strategy':_0x1b3fae[_0x85d5('0x1f')],'answered':_0x1b3fae[_0x85d5('0x20')],'available':_0x1b3fae[_0x85d5('0x21')],'loggedIn':_0x1b3fae[_0x85d5('0x22')],'pTalking':_0x1b3fae[_0x85d5('0x23')],'sumBillable':_0x1b3fae['sumBillable'],'sumDuration':_0x1b3fae[_0x85d5('0x24')],'sumHoldTime':_0x1b3fae[_0x85d5('0x25')]||0x0,'talking':_0x1b3fae[_0x85d5('0x26')],'total':_0x1b3fae[_0x85d5('0x27')],'type':_0x1b3fae[_0x85d5('0x28')],'unmanaged':_0x1b3fae['unmanaged'],'abandoned':_0x1b3fae['abandoned'],'waiting':_0x1b3fae[_0x85d5('0x29')],'loggedInDb':_0x1b3fae[_0x85d5('0x2a')]};if(_0x1b3fae[_0x85d5('0x28')]===_0x85d5('0x2b')){_0x233ccd[_0x85d5('0x2c')]=_0x1b3fae['dialActive'];_0x233ccd[_0x85d5('0x2d')]=_0x1b3fae[_0x85d5('0x2d')];_0x233ccd['dialOriginateCallerIdName']=_0x1b3fae['dialOriginateCallerIdName'];_0x233ccd[_0x85d5('0x2e')]=_0x1b3fae[_0x85d5('0x2e')];_0x233ccd['dialOriginateTimeout']=_0x1b3fae[_0x85d5('0x2f')];_0x233ccd['dialPrefix']=_0x1b3fae[_0x85d5('0x30')];_0x233ccd[_0x85d5('0x31')]=_0x1b3fae['temp'];_0x233ccd[_0x85d5('0x32')]=_0x1b3fae[_0x85d5('0x32')];_0x233ccd[_0x85d5('0x33')]=_0x1b3fae[_0x85d5('0x33')];_0x233ccd['outboundBlacklistCallsDay']=_0x1b3fae['outboundBlacklistCallsDay'];_0x233ccd[_0x85d5('0x34')]=_0x1b3fae[_0x85d5('0x34')];_0x233ccd[_0x85d5('0x35')]=_0x1b3fae[_0x85d5('0x35')];_0x233ccd[_0x85d5('0x36')]=_0x1b3fae[_0x85d5('0x36')];_0x233ccd[_0x85d5('0x37')]=_0x1b3fae[_0x85d5('0x37')];_0x233ccd[_0x85d5('0x38')]=_0x1b3fae['outboundDropCallsDayTimeout'];_0x233ccd['outboundNoAnswerCallsDay']=_0x1b3fae[_0x85d5('0x39')];_0x233ccd[_0x85d5('0x3a')]=_0x1b3fae[_0x85d5('0x3a')];_0x233ccd[_0x85d5('0x3b')]=_0x1b3fae[_0x85d5('0x3b')];_0x233ccd[_0x85d5('0x3c')]=_0x1b3fae[_0x85d5('0x3c')];_0x233ccd[_0x85d5('0x3d')]=_0x1b3fae['outboundRejectCallsDay'];_0x233ccd[_0x85d5('0x3e')]=_0x1b3fae[_0x85d5('0x3e')];_0x233ccd[_0x85d5('0x3f')]=_0x1b3fae[_0x85d5('0x3f')];_0x233ccd['predictiveIntervalAvgHoldtime']=_0x1b3fae[_0x85d5('0x40')];_0x233ccd[_0x85d5('0x41')]=_0x1b3fae[_0x85d5('0x41')];_0x233ccd[_0x85d5('0x42')]=_0x1b3fae['predictiveIntervalDroppedCallsCallersExit'];_0x233ccd[_0x85d5('0x43')]=_0x1b3fae['predictiveIntervalDroppedCallsTimeout'];_0x233ccd['predictiveIntervalErlangCalls']=_0x1b3fae[_0x85d5('0x44')];_0x233ccd['predictiveIntervalErlangCallsDroppedCalls']=_0x1b3fae[_0x85d5('0x45')];_0x233ccd['predictiveIntervalHitRate']=_0x1b3fae['predictiveIntervalHitRate'];_0x233ccd[_0x85d5('0x46')]=_0x1b3fae[_0x85d5('0x46')];_0x233ccd[_0x85d5('0x47')]=_0x1b3fae[_0x85d5('0x47')];_0x233ccd[_0x85d5('0x48')]=_0x1b3fae['predictiveIntervalAvailable'];_0x233ccd['predictiveIntervalTotalCalls']=_0x1b3fae[_0x85d5('0x49')];_0x233ccd[_0x85d5('0x19')]=_0x1b3fae[_0x85d5('0x19')];_0x233ccd[_0x85d5('0x4a')]=_0x1b3fae[_0x85d5('0x4a')];_0x233ccd[_0x85d5('0x4b')]=_0x1b3fae['erlangCalls'];_0x233ccd['erlangCallToSecond']=_0x1b3fae[_0x85d5('0x4c')];_0x233ccd['erlangAbandonmentRate']=_0x1b3fae[_0x85d5('0x4d')];_0x233ccd[_0x85d5('0x4e')]=_0x1b3fae[_0x85d5('0x4e')];_0x233ccd[_0x85d5('0x4f')]=_0x1b3fae[_0x85d5('0x4f')];_0x233ccd['startProgressive']=_0x1b3fae['startProgressive'];}if(_0x1b3fae[_0x85d5('0x50')]){_0x233ccd[_0x85d5('0x50')]={'id':_0x1b3fae[_0x85d5('0x50')]['id'],'name':_0x1b3fae[_0x85d5('0x50')][_0x85d5('0x6')],'active':_0x1b3fae[_0x85d5('0x50')][_0x85d5('0x51')],'callerid':_0x1b3fae[_0x85d5('0x50')][_0x85d5('0x52')]};}if(_0x1b3fae[_0x85d5('0x53')]){_0x233ccd[_0x85d5('0x53')]={'id':_0x1b3fae[_0x85d5('0x53')]['id'],'name':_0x1b3fae[_0x85d5('0x53')][_0x85d5('0x6')]};}_0x12fea3[_0x85d5('0x54')](_0x233ccd);}}_0x244353({'count':_0x12fea3[_0x85d5('0x55')],'rows':_0x12fea3});});},'UpdateVoiceQueue':function(_0x414d0e){return new Promise(function(_0x54e91b,_0x54c786){var _0x3d12c0=_[_0x85d5('0x56')](_0x54207b[_0x85d5('0x1e')],{'id':parseInt(_0x414d0e['id'])});var _0x22cffd=_[_0x85d5('0x57')](_0x414d0e,['id']);if(_0x3d12c0){for(var _0xe34edd in _0x22cffd){if(typeof _0x22cffd[_0xe34edd]!=='undefined'&&typeof _0x3d12c0[_0xe34edd]!==_0x85d5('0x58')){_0x3d12c0[_0xe34edd]=_0x22cffd[_0xe34edd];}}_0x54e91b(_0x3d12c0);}else{_0x54c786();}});},'VoiceChannels':function(_0x5d3b36){return new Promise(function(_0x5d6df2,_0x1cc44b){var _0x13ab32=_[_0x85d5('0x59')](_0x54207b[_0x85d5('0x5a')]);_0x5d6df2({'count':_0x13ab32[_0x85d5('0x55')],'rows':_0x13ab32});});},'VoiceChannelMixMonitor':function(_0x588d8a){var _0x26adc5=this;return new Promise(function(_0x4d3e06,_0x1f2ef9){if(ami[_0x85d5('0xd')]()==![]){return _0x1f2ef9(_0x26adc5[_0x85d5('0xe')](0x1f4,[config['asterisk']['ip'],config['asterisk']['username'],_0x85d5('0x1b')][_0x85d5('0x11')]('\x20')));}var _0x2d4fe4=schema(properties['voicechannel'])['validate'](_0x588d8a);if(_0x2d4fe4[_0x85d5('0x55')]>0x0){return _0x1f2ef9(_0x26adc5[_0x85d5('0xe')](0x1f4,_[_0x85d5('0x5b')](_0x2d4fe4,_0x85d5('0x19'))['join'](',\x20')));}var _0x3f69ea=_[_0x85d5('0x56')](_0x54207b[_0x85d5('0x5a')],{'uniqueid':_0x588d8a[_0x85d5('0x5c')]});if(_0x3f69ea&&_0x3f69ea[_0x85d5('0x5d')]){var _0x39d3a9=util[_0x85d5('0x5e')](_0x85d5('0x5f'),_0x588d8a[_0x85d5('0x60')]||_0x588d8a[_0x85d5('0x5c')],_0x588d8a[_0x85d5('0x5e')]||_0x85d5('0x61'));return ami[_0x85d5('0x17')]({'action':_0x85d5('0x62'),'channel':_0x3f69ea[_0x85d5('0x5d')],'file':_0x39d3a9,'options':'ai(mixmonitorid)'})[_0x85d5('0x18')](function(_0x16daf7){var _0x12692a=_[_0x85d5('0x56')](_0x3f69ea['monitors'],{'filename':_0x85d5('0x63')+_0x39d3a9['toLowerCase']()});if(_[_0x85d5('0x64')](_0x12692a)){_0x3f69ea[_0x85d5('0x65')][_0x85d5('0x54')]({'filename':_0x85d5('0x63')+_0x39d3a9['toLowerCase'](),'createdAt':moment()[_0x85d5('0x5e')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x16daf7['mixmonitorid'],'status':'rec'});}else{_0x12692a[_0x85d5('0x66')]=_0x16daf7[_0x85d5('0x66')];_0x12692a[_0x85d5('0x67')]=_0x85d5('0x68');}_0x4d3e06({'code':0xc8,'message':[_0x588d8a[_0x85d5('0x5c')],'MixMonitor\x20Success',_0x16daf7['mixmonitorid']][_0x85d5('0x11')]('\x20'),'mixmonitorid':_0x16daf7[_0x85d5('0x66')]});})[_0x85d5('0x1a')](function(_0xfac901){_0x1f2ef9(_0x26adc5['error'](0x1f5,[_0x588d8a[_0x85d5('0x5c')],_0xfac901[_0x85d5('0x19')][_0x85d5('0x69')]()]['join']('\x20')));});}else{return _0x1f2ef9(_0x26adc5['error'](0x1f5,_0x85d5('0x6a')));}});},'VoiceChannelStopMixMonitor':function(_0x404451){var _0x19cb24=this;return new Promise(function(_0x550d7f,_0x3dfbda){if(ami[_0x85d5('0xd')]()==![]){return _0x3dfbda(_0x19cb24[_0x85d5('0xe')](0x1f4,[config[_0x85d5('0xf')]['ip'],config['asterisk'][_0x85d5('0x10')],_0x85d5('0x1b')][_0x85d5('0x11')]('\x20')));}var _0x51e021=schema(properties[_0x85d5('0x6b')])[_0x85d5('0x6c')](_0x404451);if(_0x51e021[_0x85d5('0x55')]>0x0){return _0x3dfbda(_0x19cb24['error'](0x1f4,_[_0x85d5('0x5b')](_0x51e021,_0x85d5('0x19'))['join'](',\x20')));}var _0x242ad0=_['find'](_0x54207b[_0x85d5('0x5a')],{'uniqueid':_0x404451['uniqueid']});if(_0x242ad0){return BPromise[_0x85d5('0x6d')]()[_0x85d5('0x18')](function(){if(_0x242ad0[_0x85d5('0x5d')]){return ami[_0x85d5('0x17')]({'action':'StopMixMonitor','channel':_0x242ad0[_0x85d5('0x5d')],'mixmonitorid':_0x404451[_0x85d5('0x66')]})[_0x85d5('0x1a')](function(_0x3db5c7){});}})[_0x85d5('0x18')](function(){if(_0x242ad0[_0x85d5('0x6e')]){return ami[_0x85d5('0x17')]({'action':_0x85d5('0x6f'),'channel':_0x242ad0['destinationchannel'],'mixmonitorid':_0x404451['mixmonitorid']})[_0x85d5('0x1a')](function(_0x5e326a){});}})[_0x85d5('0x18')](function(_0x12c235){var _0x5662d2=_['find'](_0x242ad0[_0x85d5('0x65')],{'mixmonitorid':_0x404451[_0x85d5('0x66')]});if(_0x5662d2){_0x5662d2[_0x85d5('0x67')]='stop';}})[_0x85d5('0x18')](function(){var _0x102cd3=util[_0x85d5('0x5e')](_0x85d5('0x5f'),_0x404451['filename']||_0x404451['uniqueid'],_0x404451[_0x85d5('0x5e')]||'wav');var _0x565337=_[_0x85d5('0x56')](_0x242ad0[_0x85d5('0x65')],{'filename':_0x85d5('0x63')+_0x102cd3['toLowerCase']()});if(_0x565337){_0x565337['status']=_0x85d5('0x70');}})[_0x85d5('0x18')](function(){_0x550d7f({'code':0xc8,'message':[_0x404451[_0x85d5('0x5c')],'StopMixMonitor\x20Success'][_0x85d5('0x11')]('\x20')});})[_0x85d5('0x1a')](function(_0x109f19){_0x3dfbda(_0x19cb24[_0x85d5('0xe')](0x1f5,[_0x404451[_0x85d5('0x5c')],_0x109f19[_0x85d5('0x19')][_0x85d5('0x69')]()][_0x85d5('0x11')]('\x20')));});}else{return _0x3dfbda(_0x19cb24['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x2a0a59){return new Promise(function(_0x176632,_0x167918){var _0x595301=_[_0x85d5('0x59')](_0x54207b[_0x85d5('0x71')]);_0x176632({'count':_0x595301['length'],'rows':_0x595301});});},'VoiceQueuesChannel':function(_0x2dbd18){var _0xe6617d=this;return new Promise(function(_0x39bcea,_0x146254){var _0xe97bcc=schema(properties['voicequeuechannel'])[_0x85d5('0x6c')](_0x2dbd18);if(_0xe97bcc[_0x85d5('0x55')]>0x0){return _0x146254(_0xe6617d[_0x85d5('0xe')](0x1f4,_[_0x85d5('0x5b')](_0xe97bcc,_0x85d5('0x19'))['join'](',\x20')));}var _0x403df1=_[_0x85d5('0x56')](_0x54207b[_0x85d5('0x71')],{'uniqueid':_0x2dbd18[_0x85d5('0x5c')]});if(_0x403df1){_0x39bcea(_0x403df1);}else{return _0x146254(_0xe6617d[_0x85d5('0xe')](0x1f5,_0x85d5('0x6a')));}});},'VoiceQueuesChannelHangup':function(_0x378f56){var _0xcff925=this;return new Promise(function(_0x3166ce,_0x2ed09d){if(ami['isConnected']()==![]){return _0x2ed09d(_0xcff925[_0x85d5('0xe')](0x1f4,[config[_0x85d5('0xf')]['ip'],config[_0x85d5('0xf')][_0x85d5('0x10')],_0x85d5('0x1b')][_0x85d5('0x11')]('\x20')));}var _0x4cd3a6=schema(properties[_0x85d5('0x72')])['validate'](_0x378f56);if(_0x4cd3a6['length']>0x0){return _0x2ed09d(_0xcff925[_0x85d5('0xe')](0x1f4,_[_0x85d5('0x5b')](_0x4cd3a6,_0x85d5('0x19'))[_0x85d5('0x11')](',\x20')));}var _0x47044b=_[_0x85d5('0x56')](_0x54207b[_0x85d5('0x71')],{'uniqueid':_0x378f56[_0x85d5('0x5c')]});if(_0x47044b&&_0x47044b[_0x85d5('0x5d')]){return ami['Action']({'action':_0x85d5('0x73'),'channel':_0x47044b[_0x85d5('0x5d')]})[_0x85d5('0x18')](function(_0x2e7d36){_0x3166ce({'code':0xc8,'message':[_0x378f56[_0x85d5('0x5c')],_0x2e7d36[_0x85d5('0x19')][_0x85d5('0x69')]()][_0x85d5('0x11')]('\x20')});})[_0x85d5('0x1a')](function(_0x22c352){_0x2ed09d(_0xcff925[_0x85d5('0xe')](0x1f5,[_0x378f56[_0x85d5('0x5c')],_0x22c352[_0x85d5('0x19')][_0x85d5('0x69')]()][_0x85d5('0x11')]('\x20')));});}else{return _0x2ed09d(_0xcff925['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x2f4119){var _0x4983ca=this;return new Promise(function(_0x99f670,_0xa18a5e){if(ami[_0x85d5('0xd')]()==![]){return _0xa18a5e(_0x4983ca[_0x85d5('0xe')](0x1f4,[config[_0x85d5('0xf')]['ip'],config[_0x85d5('0xf')][_0x85d5('0x10')],_0x85d5('0x1b')][_0x85d5('0x11')]('\x20')));}var _0x5ed6cb=schema(properties[_0x85d5('0x74')])[_0x85d5('0x6c')](_0x2f4119);if(_0x5ed6cb['length']>0x0){return _0xa18a5e(_0x4983ca[_0x85d5('0xe')](0x1f4,_['map'](_0x5ed6cb,_0x85d5('0x19'))[_0x85d5('0x11')](',\x20')));}var _0x1c1595=_[_0x85d5('0x56')](_0x54207b['queueChannels'],{'uniqueid':_0x2f4119[_0x85d5('0x5c')]});if(_0x1c1595&&_0x1c1595[_0x85d5('0x5d')]){return ami['Action']({'action':_0x85d5('0x75'),'channel':_0x1c1595[_0x85d5('0x5d')],'exten':_0x2f4119['exten'],'context':_0x2f4119[_0x85d5('0x76')]||_0x1c1595[_0x85d5('0x76')],'priority':0x1})[_0x85d5('0x18')](function(_0x538121){_0x99f670({'code':0xc8,'message':[_0x2f4119[_0x85d5('0x5c')],_0x538121[_0x85d5('0x19')][_0x85d5('0x69')]()][_0x85d5('0x11')]('\x20')});})[_0x85d5('0x1a')](function(_0x1e45e5){_0xa18a5e(_0x4983ca['error'](0x1f5,[_0x2f4119[_0x85d5('0x5c')],_0x1e45e5[_0x85d5('0x19')]['toLowerCase']()][_0x85d5('0x11')]('\x20')));});}else{return _0xa18a5e(_0x4983ca['error'](0x1f5,_0x85d5('0x6a')));}});},'Agents':function(_0x38fb5b){return new Promise(function(_0x36432f,_0x52acec){var _0x4696bc=_[_0x85d5('0x59')](_0x54207b[_0x85d5('0xa')]);_0x36432f({'count':_0x4696bc[_0x85d5('0x55')],'rows':_0x4696bc});});},'Telephones':function(_0x429fd1){return new Promise(function(_0x57549f,_0x26a50f){var _0x29ca79=_[_0x85d5('0x59')](_0x54207b[_0x85d5('0x77')]);_0x57549f({'count':_0x29ca79['length'],'rows':_0x29ca79});});},'Trunks':function(_0x1764b0){return new Promise(function(_0x21f4fa,_0x340bca){var _0x5b4f25=_[_0x85d5('0x59')](_0x54207b['trunks']);_0x21f4fa({'count':_0x5b4f25[_0x85d5('0x55')],'rows':_0x5b4f25});});},'OutboundChannels':function(_0x3ab83f){return new Promise(function(_0x564c84,_0x4d4b95){var _0x3d8ffc=_[_0x85d5('0x59')](_0x54207b[_0x85d5('0x78')]);_0x564c84({'count':_0x3d8ffc[_0x85d5('0x55')],'rows':_0x3d8ffc});});},'Outbound':function(_0x1432e4){return new Promise(function(_0x243112,_0x9df0e7){_0x243112(_0x54207b[_0x85d5('0x2b')]);});},'Campaigns':function(_0x577d9b){return new Promise(function(_0x1be535,_0x2ba8cf){var _0x1470bf=_['values'](_0x54207b[_0x85d5('0x79')]);_0x1be535({'count':_0x1470bf[_0x85d5('0x55')],'rows':_0x1470bf});});},'VoiceQueuesPreview':function(_0x5d09e8){var _0x28ff23=this;return new Promise(function(_0x3bc3c4,_0x2c803e){_0x1eb211[_0x85d5('0x7a')](_0x5d09e8['id'])[_0x85d5('0x18')](function(_0x9f9619){_0x3bc3c4({'code':0xc8,'message':_0x9f9619[_0x85d5('0x19')]});})['catch'](function(_0x30c7d0){_0x2c803e(_0x28ff23[_0x85d5('0xe')](0x1f4,_0x30c7d0[_0x85d5('0x19')]));});});},'EventManager':function(_0xd3cbc9){var _0x51fcfb=this;return new Promise(function(_0x9f5b36,_0x2c1cb3){if(!_0xd3cbc9[_0x85d5('0x7b')]){return _0x2c1cb3(_0x51fcfb[_0x85d5('0xe')](0x1f4,_0x85d5('0x7c')));}ami['emit']('custom:'+_0xd3cbc9[_0x85d5('0x7b')],_0xd3cbc9['message']);_0x9f5b36({'code':0xc8,'message':_0xd3cbc9});});},'FaxAccounts':function(_0x8e33fd){return new Promise(function(_0x3ca915,_0xed342){var _0xc595b5=_[_0x85d5('0x59')](_0x54207b[_0x85d5('0x7d')]);_0x3ca915({'count':_0xc595b5[_0x85d5('0x55')],'rows':_0xc595b5});});},'SendFax':function(_0x48553d){var _0xedb32d=this;return new Promise(function(_0x5366bc,_0x26fbbe){_0x2d457a[_0x85d5('0x7e')](_0x48553d)[_0x85d5('0x18')](function(_0x5a884a){_0x5366bc({'code':0xc8,'message':_0x5a884a[_0x85d5('0x19')]});})[_0x85d5('0x1a')](function(_0x3263ea){_0x26fbbe(_0xedb32d['error'](0x1f4,_0x3263ea['message']));});});},'CheckAfterSend':function(_0x3de686){var _0x428fd4=this;return new Promise(function(_0x514a3c,_0x3d9a7b){_0x2d457a[_0x85d5('0x7f')](_0x3de686)['then'](function(_0x3e1e10){_0x514a3c({'code':0xc8,'message':_0x3e1e10[_0x85d5('0x19')]});})[_0x85d5('0x1a')](function(_0x4433ef){_0x3d9a7b(_0x428fd4[_0x85d5('0xe')](0x1f4,_0x4433ef[_0x85d5('0x19')]));});});}};var _0xd7cf5b=jayson['server'](_0x5f47ec)[_0x85d5('0x80')]();_0xd7cf5b['on'](_0x85d5('0xe'),function(_0xd3f8af){return _0x46e7b4(_0xd3f8af);});_0xd7cf5b[_0x85d5('0x3')](0x232a,'127.0.0.1',function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x578fad(_0x85d5('0x81')+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 85fe8c4..4916aef 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 _0x5469=['data4','destcalleridnum','calleridname','','Unknown','destcalleridname','resolve','createContact','[CM][%s][%s]\x20Autocreate\x20disabled','isNil','push','format','user:%s','trigger:%s','action','toLowerCase','merge','lodash','bluebird','ioredis','../../../../config/environment','../../../../config/logger','../../rpc/cmContact','redis','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','exec','data1','data2','xmd-contactid','ListId','data3','split','phone','$or','map','routeId','calleridnum','firstName','lastName','mobile','fax','scheduledAt','updatedAt','union','getContacts','then','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found'];(function(_0x2e5636,_0x2b9540){var _0x4d7371=function(_0x28e14c){while(--_0x28e14c){_0x2e5636['push'](_0x2e5636['shift']());}};_0x4d7371(++_0x2b9540);}(_0x5469,0x1d1));var _0x9546=function(_0x2118ad,_0xe8e3fd){_0x2118ad=_0x2118ad-0x0;var _0x4b5715=_0x5469[_0x2118ad];return _0x4b5715;};'use strict';var _=require(_0x9546('0x0'));var BPromise=require(_0x9546('0x1'));var Redis=require(_0x9546('0x2'));var util=require('util');var config=require(_0x9546('0x3'));var logger=require(_0x9546('0x4'))('trigger');var cmContactRpc=require(_0x9546('0x5'));config[_0x9546('0x6')]=_['defaults'](config[_0x9546('0x6')],{'host':_0x9546('0x7'),'port':0x18eb});var io=require(_0x9546('0x8'))(new Redis(config[_0x9546('0x6')]));function emit(_0x148ca5,_0x4ab271,_0x83f66f,_0x3ce48c,_0x5c0a8e){logger[_0x9546('0x9')](_0x9546('0xa'),_0x148ca5,_0x4ab271['id'],_0x83f66f,_0x3ce48c,JSON[_0x9546('0xb')](_0x5c0a8e));io['to'](_0x83f66f)[_0x9546('0xc')](_0x3ce48c,_0x5c0a8e);}exports[_0x9546('0xd')]=function(_0x686a56,_0x68b6f2,_0x963cd4,_0x1f6033){var _0x2383f1,_0x3a1224;var _0x2ffce3={};var _0xee71c8=Number(_0x963cd4[_0x9546('0xe')]);var _0xfb3ce0=_0x963cd4[_0x9546('0xf')]?Boolean(Number(_0x963cd4[_0x9546('0xf')])):![];var _0x3cfeb1;if(_0x1f6033[_0x9546('0x10')]){_0x2ffce3['id']=_0x1f6033['xmd-contactid'];}if(!_0x2ffce3['id']){_0x2ffce3[_0x9546('0x11')]=_0xee71c8;_0x3cfeb1=_0x963cd4[_0x9546('0x12')]&&_0x963cd4[_0x9546('0x12')]!=='0'?_0x963cd4[_0x9546('0x12')][_0x9546('0x13')](','):[_0x9546('0x14')];_0x2ffce3[_0x9546('0x15')]=_[_0x9546('0x16')](_0x3cfeb1,function(_0x384705){var _0x593f3b={};_0x593f3b[_0x384705]=_0x1f6033[_0x9546('0x17')]?_0x1f6033['destcalleridnum']:_0x1f6033[_0x9546('0x18')];return _0x593f3b;});}var _0x4cc6cc=['id',_0x9546('0x19'),_0x9546('0x1a'),_0x9546('0x14'),_0x9546('0x1b'),_0x9546('0x1c'),_0x9546('0x11'),'createdAt',_0x9546('0x1d'),_0x9546('0x1e')];var _0x19c266=_[_0x9546('0x1f')](_0x4cc6cc,_0x3cfeb1);BPromise['resolve']()['then'](cmContactRpc[_0x9546('0x20')]({'attributes':_0x19c266,'where':_0x2ffce3}))[_0x9546('0x21')](function(_0xe64e96){_0x3a1224=_0xe64e96;if(!_['isEmpty'](_0x3a1224)){if(_0x3a1224[_0x9546('0x22')]===0x1){_0x2383f1=_0x3a1224[0x0];logger[_0x9546('0x9')](_0x9546('0x23'),_0x1f6033[_0x9546('0x24')],_0x68b6f2['id'],_0x2383f1['id']);}else{logger[_0x9546('0x9')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x1f6033[_0x9546('0x24')],_0x68b6f2['id'],_['map'](_0x3a1224,'id')[_0x9546('0x25')](','));}return;}else{logger[_0x9546('0x9')](_0x9546('0x26'),_0x1f6033[_0x9546('0x24')],_0x68b6f2['id']);var _0x53883d={'ListId':_0xee71c8};var _0x57d1b8=_0x963cd4[_0x9546('0x27')]&&_0x963cd4[_0x9546('0x27')]!=='0'?_0x963cd4['data4']:_0x9546('0x14');if(_0xfb3ce0){logger[_0x9546('0x9')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x1f6033[_0x9546('0x24')],_0x68b6f2['id']);_0x53883d[_0x57d1b8]=_['isNil'](_0x1f6033['routeId'])?_0x1f6033[_0x9546('0x18')]:_0x1f6033[_0x9546('0x28')];if(_['isNil'](_0x1f6033[_0x9546('0x17')])){_0x53883d[_0x9546('0x19')]=_0x1f6033[_0x9546('0x29')]&&_0x1f6033[_0x9546('0x29')]!==_0x9546('0x2a')?_0x1f6033[_0x9546('0x29')]:_0x9546('0x2b');}else{_0x53883d['firstName']=_0x1f6033[_0x9546('0x2c')]&&_0x1f6033[_0x9546('0x2c')]!==_0x9546('0x2a')?_0x1f6033[_0x9546('0x2c')]:_0x9546('0x2b');}return BPromise[_0x9546('0x2d')]()['then'](cmContactRpc[_0x9546('0x2e')](_0x53883d))[_0x9546('0x21')](function(_0xaf502e){_0x2383f1=_0xaf502e;_0x3a1224['push'](_0xaf502e);if(_0x2383f1){logger[_0x9546('0x9')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x1f6033[_0x9546('0x24')],_0x68b6f2['id'],_0x2383f1['id']);}return;});}else{logger[_0x9546('0x9')](_0x9546('0x2f'),_0x1f6033['uniqueid'],_0x68b6f2['id']);_0x53883d[_0x57d1b8]=_[_0x9546('0x30')](_0x1f6033[_0x9546('0x17')])?_0x1f6033[_0x9546('0x18')]:_0x1f6033[_0x9546('0x28')];if(_[_0x9546('0x30')](_0x1f6033[_0x9546('0x17')])){_0x53883d['firstName']=_0x1f6033[_0x9546('0x29')]&&_0x1f6033[_0x9546('0x29')]!==_0x9546('0x2a')?_0x1f6033[_0x9546('0x29')]:'Unknown';}else{_0x53883d['firstName']=_0x1f6033[_0x9546('0x2c')]&&_0x1f6033[_0x9546('0x2c')]!==''?_0x1f6033['destcalleridname']:_0x9546('0x2b');}_0x2383f1=_0x53883d;_0x3a1224[_0x9546('0x31')](_0x53883d);return;}}})[_0x9546('0x21')](function(){if(_0x686a56){emit(_0x1f6033[_0x9546('0x24')],_0x68b6f2,util[_0x9546('0x32')](_0x9546('0x33'),_0x686a56['name']),util[_0x9546('0x32')](_0x9546('0x34'),_0x963cd4[_0x9546('0x35')][_0x9546('0x36')]()),{'evt':_[_0x9546('0x37')](_0x1f6033,{'autoCreate':_0xfb3ce0}),'contact':_0x2383f1===undefined?{}:_0x2383f1,'contacts':_0x3a1224[_0x9546('0x22')]===0x0?undefined:_0x3a1224});}});}; \ No newline at end of file +var _0x7cc2=['redis','localhost','socket.io-emitter','[CM][%s][%s]','stringify','data1','data2','xmd-contactid','ListId','data3','split','phone','$or','map','destcalleridnum','calleridnum','firstName','lastName','mobile','createdAt','scheduledAt','union','getContacts','then','length','info','[CM][%s][%s]\x20Contact\x20found:%s','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','routeId','calleridname','','Unknown','destcalleridname','resolve','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','user:%s','name','format','action','toLowerCase','merge','lodash','bluebird','ioredis','util','../../../../config/environment','trigger','../../rpc/cmContact','defaults'];(function(_0x4cef45,_0x5e823a){var _0x1f2856=function(_0xe33845){while(--_0xe33845){_0x4cef45['push'](_0x4cef45['shift']());}};_0x1f2856(++_0x5e823a);}(_0x7cc2,0xdc));var _0x27cc=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0x7cc2[_0x725b8e];return _0x43ac45;};'use strict';var _=require(_0x27cc('0x0'));var BPromise=require(_0x27cc('0x1'));var Redis=require(_0x27cc('0x2'));var util=require(_0x27cc('0x3'));var config=require(_0x27cc('0x4'));var logger=require('../../../../config/logger')(_0x27cc('0x5'));var cmContactRpc=require(_0x27cc('0x6'));config['redis']=_[_0x27cc('0x7')](config[_0x27cc('0x8')],{'host':_0x27cc('0x9'),'port':0x18eb});var io=require(_0x27cc('0xa'))(new Redis(config[_0x27cc('0x8')]));function emit(_0x2d1e99,_0x399f3e,_0xd55355,_0x24b3eb,_0x2a3d57){logger['info'](_0x27cc('0xb'),_0x2d1e99,_0x399f3e['id'],_0xd55355,_0x24b3eb,JSON[_0x27cc('0xc')](_0x2a3d57));io['to'](_0xd55355)['emit'](_0x24b3eb,_0x2a3d57);}exports['exec']=function(_0x5d57cd,_0x1dd7c6,_0x3ac4ec,_0x44098b){var _0x1b5cdf,_0x560bd7;var _0x426811={};var _0x1c251f=Number(_0x3ac4ec[_0x27cc('0xd')]);var _0x5146cc=_0x3ac4ec[_0x27cc('0xe')]?Boolean(Number(_0x3ac4ec[_0x27cc('0xe')])):![];var _0x171e95;if(_0x44098b[_0x27cc('0xf')]){_0x426811['id']=_0x44098b[_0x27cc('0xf')];}if(!_0x426811['id']){_0x426811[_0x27cc('0x10')]=_0x1c251f;_0x171e95=_0x3ac4ec[_0x27cc('0x11')]&&_0x3ac4ec['data3']!=='0'?_0x3ac4ec[_0x27cc('0x11')][_0x27cc('0x12')](','):[_0x27cc('0x13')];_0x426811[_0x27cc('0x14')]=_[_0x27cc('0x15')](_0x171e95,function(_0x31b20e){var _0x8513e6={};_0x8513e6[_0x31b20e]=_0x44098b['routeId']?_0x44098b[_0x27cc('0x16')]:_0x44098b[_0x27cc('0x17')];return _0x8513e6;});}var _0x572c9a=['id',_0x27cc('0x18'),_0x27cc('0x19'),'phone',_0x27cc('0x1a'),'fax',_0x27cc('0x10'),_0x27cc('0x1b'),_0x27cc('0x1c'),'updatedAt'];var _0x1e0939=_[_0x27cc('0x1d')](_0x572c9a,_0x171e95);BPromise['resolve']()['then'](cmContactRpc[_0x27cc('0x1e')]({'attributes':_0x1e0939,'where':_0x426811}))[_0x27cc('0x1f')](function(_0x497dba){_0x560bd7=_0x497dba;if(!_['isEmpty'](_0x560bd7)){if(_0x560bd7[_0x27cc('0x20')]===0x1){_0x1b5cdf=_0x560bd7[0x0];logger[_0x27cc('0x21')](_0x27cc('0x22'),_0x44098b['uniqueid'],_0x1dd7c6['id'],_0x1b5cdf['id']);}else{logger[_0x27cc('0x21')](_0x27cc('0x23'),_0x44098b[_0x27cc('0x24')],_0x1dd7c6['id'],_['map'](_0x560bd7,'id')[_0x27cc('0x25')](','));}return;}else{logger[_0x27cc('0x21')](_0x27cc('0x26'),_0x44098b[_0x27cc('0x24')],_0x1dd7c6['id']);var _0x16d17e={'ListId':_0x1c251f};var _0x476ece=_0x3ac4ec['data4']&&_0x3ac4ec[_0x27cc('0x27')]!=='0'?_0x3ac4ec[_0x27cc('0x27')]:_0x27cc('0x13');if(_0x5146cc){logger[_0x27cc('0x21')](_0x27cc('0x28'),_0x44098b[_0x27cc('0x24')],_0x1dd7c6['id']);_0x16d17e[_0x476ece]=_[_0x27cc('0x29')](_0x44098b['routeId'])?_0x44098b['calleridnum']:_0x44098b[_0x27cc('0x16')];if(_[_0x27cc('0x29')](_0x44098b[_0x27cc('0x2a')])){_0x16d17e[_0x27cc('0x18')]=_0x44098b['calleridname']&&_0x44098b[_0x27cc('0x2b')]!==_0x27cc('0x2c')?_0x44098b[_0x27cc('0x2b')]:_0x27cc('0x2d');}else{_0x16d17e[_0x27cc('0x18')]=_0x44098b[_0x27cc('0x2e')]&&_0x44098b['destcalleridname']!==_0x27cc('0x2c')?_0x44098b[_0x27cc('0x2e')]:_0x27cc('0x2d');}return BPromise[_0x27cc('0x2f')]()[_0x27cc('0x1f')](cmContactRpc[_0x27cc('0x30')](_0x16d17e))[_0x27cc('0x1f')](function(_0x55645e){_0x1b5cdf=_0x55645e;_0x560bd7[_0x27cc('0x31')](_0x55645e);if(_0x1b5cdf){logger['info'](_0x27cc('0x32'),_0x44098b[_0x27cc('0x24')],_0x1dd7c6['id'],_0x1b5cdf['id']);}return;});}else{logger[_0x27cc('0x21')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0x44098b[_0x27cc('0x24')],_0x1dd7c6['id']);_0x16d17e[_0x476ece]=_[_0x27cc('0x29')](_0x44098b[_0x27cc('0x2a')])?_0x44098b[_0x27cc('0x17')]:_0x44098b['destcalleridnum'];if(_[_0x27cc('0x29')](_0x44098b[_0x27cc('0x2a')])){_0x16d17e[_0x27cc('0x18')]=_0x44098b['calleridname']&&_0x44098b[_0x27cc('0x2b')]!==''?_0x44098b[_0x27cc('0x2b')]:'Unknown';}else{_0x16d17e[_0x27cc('0x18')]=_0x44098b[_0x27cc('0x2e')]&&_0x44098b[_0x27cc('0x2e')]!==_0x27cc('0x2c')?_0x44098b['destcalleridname']:_0x27cc('0x2d');}_0x1b5cdf=_0x16d17e;_0x560bd7[_0x27cc('0x31')](_0x16d17e);return;}}})['then'](function(){if(_0x5d57cd){emit(_0x44098b[_0x27cc('0x24')],_0x1dd7c6,util['format'](_0x27cc('0x33'),_0x5d57cd[_0x27cc('0x34')]),util[_0x27cc('0x35')]('trigger:%s',_0x3ac4ec[_0x27cc('0x36')][_0x27cc('0x37')]()),{'evt':_[_0x27cc('0x38')](_0x44098b,{'autoCreate':_0x5146cc}),'contact':_0x1b5cdf===undefined?{}:_0x1b5cdf,'contacts':_0x560bd7[_0x27cc('0x20')]===0x0?undefined:_0x560bd7});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index ef371dc..a49fbe9 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 _0xcb6a=['account','chat','operator','ChatWebsiteId','upperFirst','AccountId','value','interaction','message','event','agent','membername','lastevent','exports','util','url','ioredis','./integration','./cmContact','./script','../../../config/environment','../../../config/logger','trigger','../ami','redis','defaults','localhost','socket.io-emitter','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','bind','syncCustomEvent','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:timeout','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:outgoingmessage','custom:acceptmessage','emit','info','stringify','clone','checkTriggers','prototype','interface','checkTrigger','variables','Actions','length','action','toLowerCase','contactmanager','motionbar','browser','data1','popup','TemplateId','data2','html','render','uri','buildUri','isNil','data3','data4','location','data5','800','windowHeight','data6','600','winApplication','format','user:%s','name','trigger:%s:%s','merge','jscripty','trigger:%s','integration','exec','queue','routeId','urlforward','script','search','replace','AllConditions','every','checkConditions','channel','some'];(function(_0xcc5800,_0x5a30c4){var _0x1a5a5f=function(_0x5f3bb6){while(--_0x5f3bb6){_0xcc5800['push'](_0xcc5800['shift']());}};_0x1a5a5f(++_0x5a30c4);}(_0xcb6a,0xfa));var _0xacb6=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0xcb6a[_0x13b8f3];return _0x1a6d06;};'use strict';var util=require(_0xacb6('0x0'));var _=require('lodash');var url=require(_0xacb6('0x1'));var Mustache=require('mustache');var Redis=require(_0xacb6('0x2'));var urlforward=require('./urlforward');var integration=require(_0xacb6('0x3'));var cmContact=require(_0xacb6('0x4'));var script=require(_0xacb6('0x5'));var config=require(_0xacb6('0x6'));var logger=require(_0xacb6('0x7'))(_0xacb6('0x8'));var ami=require(_0xacb6('0x9'));config[_0xacb6('0xa')]=_[_0xacb6('0xb')](config[_0xacb6('0xa')],{'host':_0xacb6('0xc'),'port':0x18eb});var io=require(_0xacb6('0xd'))(new Redis(config[_0xacb6('0xa')]));var operators={'equals':function(_0x43e30e,_0x346c0c){return _0x43e30e==_0x346c0c;},'not_equals':function(_0x52a085,_0xd10760){return _0x52a085!=_0xd10760;}};var barAndWebActions=['popup',_0xacb6('0x1'),_0xacb6('0xe')];function Trigger(_0x351c6d){this['triggers']=_0x351c6d[_0xacb6('0xf')];this['agents']=_0x351c6d[_0xacb6('0x10')];this[_0xacb6('0x11')]=_0x351c6d['voiceQueues'];this[_0xacb6('0x12')]=_0x351c6d[_0xacb6('0x12')];this[_0xacb6('0x13')]=_0x351c6d['voiceExtensions'];this[_0xacb6('0x14')]=_0x351c6d[_0xacb6('0x14')];this[_0xacb6('0x15')]=_0x351c6d[_0xacb6('0x15')];this[_0xacb6('0x16')]=_0x351c6d[_0xacb6('0x16')];this[_0xacb6('0x17')]=_0x351c6d['sugarcrmAccounts'];this['zohoAccounts']=_0x351c6d[_0xacb6('0x18')];this[_0xacb6('0x19')]=_0x351c6d[_0xacb6('0x19')];this[_0xacb6('0x1a')]=_0x351c6d[_0xacb6('0x1a')];this[_0xacb6('0x1b')]=_0x351c6d['servicenowAccounts'];this['dynamics365Accounts']=_0x351c6d[_0xacb6('0x1c')];this[_0xacb6('0x1d')]=_0x351c6d[_0xacb6('0x1d')];this[_0xacb6('0x1e')]={'zendesk':this[_0xacb6('0x14')],'salesforce':this['salesforceAccounts'],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this[_0xacb6('0x17')],'zoho':this['zohoAccounts'],'desk':this[_0xacb6('0x19')],'vtiger':this[_0xacb6('0x1a')],'dynamics365':this[_0xacb6('0x1c')],'freshsales':this[_0xacb6('0x1d')],'servicenow':this['servicenowAccounts']};ami['on'](_0xacb6('0x1f'),this['syncCustomEvent'][_0xacb6('0x20')](this));ami['on']('custom:agentconnect',this[_0xacb6('0x21')][_0xacb6('0x20')](this));ami['on'](_0xacb6('0x22'),this[_0xacb6('0x21')][_0xacb6('0x20')](this));ami['on'](_0xacb6('0x23'),this[_0xacb6('0x21')][_0xacb6('0x20')](this));ami['on'](_0xacb6('0x24'),this[_0xacb6('0x21')][_0xacb6('0x20')](this));ami['on'](_0xacb6('0x25'),this[_0xacb6('0x21')][_0xacb6('0x20')](this));ami['on'](_0xacb6('0x26'),this[_0xacb6('0x21')][_0xacb6('0x20')](this));ami['on']('custom:agentcongestion',this[_0xacb6('0x21')][_0xacb6('0x20')](this));ami['on'](_0xacb6('0x27'),this[_0xacb6('0x21')][_0xacb6('0x20')](this));ami['on'](_0xacb6('0x28'),this[_0xacb6('0x21')][_0xacb6('0x20')](this));ami['on'](_0xacb6('0x29'),this[_0xacb6('0x21')][_0xacb6('0x20')](this));ami['on'](_0xacb6('0x2a'),this[_0xacb6('0x21')][_0xacb6('0x20')](this));ami['on']('custom:dialbegin',this[_0xacb6('0x2b')]['bind'](this));ami['on'](_0xacb6('0x2c'),this['syncAgentDial'][_0xacb6('0x20')](this));ami['on'](_0xacb6('0x2d'),this[_0xacb6('0x2b')][_0xacb6('0x20')](this));ami['on'](_0xacb6('0x2e'),this[_0xacb6('0x21')][_0xacb6('0x20')](this));ami['on'](_0xacb6('0x2f'),this[_0xacb6('0x21')][_0xacb6('0x20')](this));ami['on']('custom:incomingmessage',this['syncCustomEvent'][_0xacb6('0x20')](this));ami['on'](_0xacb6('0x30'),this[_0xacb6('0x21')]['bind'](this));ami['on'](_0xacb6('0x31'),this['syncCustomEvent']['bind'](this));ami['on']('custom:rejectmessage',this[_0xacb6('0x21')]['bind'](this));}Trigger['prototype'][_0xacb6('0x32')]=function(_0x5c287a,_0x15334a,_0x255e28){logger[_0xacb6('0x33')](_0x5c287a,_0x15334a,JSON[_0xacb6('0x34')](_0x255e28));io['to'](_0x5c287a)[_0xacb6('0x32')](_0x15334a,_0x255e28);};Trigger['prototype']['syncCustomEvent']=function(_0x495dd6){var _0x224828=_[_0xacb6('0x35')](_0x495dd6);this[_0xacb6('0x36')](_0x224828);};Trigger[_0xacb6('0x37')]['syncAgentDial']=function(_0x44db36){if(this[_0xacb6('0x10')][_0x44db36[_0xacb6('0x38')]]){this[_0xacb6('0x21')](_0x44db36);}};Trigger['prototype']['checkTriggers']=function(_0x121c7f){var _0x326ccc;for(var _0x18efab in this['triggers']){if(this[_0xacb6('0xf')]['hasOwnProperty'](_0x18efab)){if(this['triggers'][_0x18efab]['status']){_0x326ccc=this[_0xacb6('0x39')](this[_0xacb6('0xf')][_0x18efab],_0x121c7f);if(_0x326ccc){_['merge'](_0x121c7f,_0x121c7f[_0xacb6('0x3a')]);for(var _0x11e2d4=0x0,_0x1a7511,_0x30b890,_0x380d62;_0x11e2d40x0){_0x11c1eb=_[_0x7995('0x2b')](_0xf16cc2,_0x132a42);}return _0x11c1eb;}function getCustomFields(_0x514445,_0x456a28){var _0x3250e0=[];var _0x4253e5={'custom_fields':{}};if(_0x514445['length']>0x0){_['forEach'](_0x514445,function(_0x48e573){if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x30')]&&!_0x48e573[_0x7995('0x31')]){_0x4253e5[_0x48e573['nameField']['toLowerCase']()]=_0x48e573[_0x7995('0x32')]['toString']();}else if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x48e573['content']['toString']();}else if(_0x48e573['type']===_0x7995('0x35')&&_0x48e573[_0x7995('0x36')]&&_0x48e573['idField']&&_0x48e573[_0x7995('0x31')]){_0x456a28[_0x48e573['variableName']]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573[_0x7995('0x36')]]['toString']());}else if(_0x48e573['type']===_0x7995('0x37')&&_0x48e573['Variable']&&_0x48e573['Variable'][_0x7995('0x38')]&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x456a28[_0x48e573[_0x7995('0x39')][_0x7995('0x38')][_0x7995('0x3a')]()]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573['Variable'][_0x7995('0x38')][_0x7995('0x3a')]()][_0x7995('0x22')]());}});}if(_0x4253e5[_0x7995('0x3b')]){_0x4253e5['priority']=Number(_0x4253e5[_0x7995('0x3b')]);}return _0x4253e5;}function getTicket(_0x235df7,_0x3eb04f,_0xe5ea43,_0x1f5bee,_0x1035dc){logger['info'](_0x7995('0x3c'));var _0x3be298=_[_0x7995('0x3d')]({'subject':intUtil[_0x7995('0x3e')](_0x1f5bee[_0x7995('0x3f')],_0x1035dc,'\x20'),'type':_0x7995('0x40'),'status':_0x7995('0x41'),'labels':[_0x7995('0x42'),_0x7995('0x43'),_0x7995('0x44')][_0x7995('0x45')](getTags(_0x1f5bee[_0x7995('0x46')],_0x7995('0x38'))),'description':intUtil['getString'](_0x1f5bee['Descriptions'],_0x1035dc,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7995('0x11')](_0x7995('0x47'),_0x3eb04f['id']),'class':'user'}},'message':{'direction':'in','body':intUtil['getString'](_0x1f5bee[_0x7995('0x48')],_0x1035dc,'\x0a')}},getCustomFields(_0x1f5bee['Fields'],_0x1035dc));return request({'uri':util['format'](_0x7995('0x49'),_0x235df7[_0x7995('0x12')],_0xe5ea43['id']),'method':_0x7995('0x29'),'body':_0x3be298});}exports['queue']=function(_0x46ac4f,_0x5e85b9,_0x3993b5,_0x5a8881,_0x493066,_0x39c5b8){var _0x403f54,_0xc04e5;_0x39c5b8[_0x7995('0x12')]=intUtil['stripTrailingSlash'](_0x39c5b8[_0x7995('0x12')]);_0x39c5b8[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x39c5b8[_0x7995('0x4a')]);if(_0x493066&&_0x493066['monitor_format']){logger['info'](_0x7995('0x4c'),'Recording\x20is\x20enabled!');_0x5e85b9[_0x7995('0x4d')]=util['format'](_0x7995('0x4e'),_0x39c5b8['serverUrl'],_0x5e85b9[_0x7995('0x4f')],md5(_0x5e85b9[_0x7995('0x4f')]));}else{_0x5e85b9['recordingURL']='';}headers[_0x7995('0x50')]=getAuth(_0x39c5b8);return getUser(_0x39c5b8,_0x5a8881[_0x7995('0x51')])[_0x7995('0x13')](function(_0xb70a51){_0x403f54=_0xb70a51;logger['info'](_0x7995('0x52'),_0x403f54['id']);return getEndUser(_0x39c5b8,_0x5e85b9[_0x7995('0x53')],_0x5e85b9[_0x7995('0x54')]);})['then'](function(_0xe228a5){_0xc04e5=_0xe228a5;logger[_0x7995('0xf')](_0x7995('0x55'),_0xc04e5['id']);return getTicket(_0x39c5b8,_0x403f54,_0xc04e5,_0x3993b5,_0x5e85b9);})[_0x7995('0x13')](function(_0x255313){if(_0x255313){logger['info'](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x255313['id']);switch(_0x39c5b8[_0x7995('0x2f')]){case'integrationTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x255313['id']});break;case'newTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x5a'));emit(util['format'](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x5b'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x255313['id'])});break;default:logger['error'](_0x7995('0x4c'),_0x7995('0x5c'));}}})['catch'](function(_0x1cd85){console[_0x7995('0x5d')](_0x1cd85);logger[_0x7995('0x5d')](_0x7995('0x4c'),JSON[_0x7995('0x1c')](_0x1cd85));});};exports['outbound']=function(_0x29ee32,_0x4ab09f,_0x14fe7f,_0x33c801,_0x206d2a,_0x50c7b5,_0x5e1f34){var _0x54e2b1,_0x563f8e;_0x50c7b5[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x12')]);_0x50c7b5[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x4a')]);if(_0x5e1f34&&_0x5e1f34[_0x7995('0x5e')]&&_0x5e1f34[_0x7995('0x5e')]!==_0x7995('0x5f')){logger[_0x7995('0xf')](_0x7995('0x60'),_0x7995('0x61'));_0x4ab09f[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x50c7b5[_0x7995('0x4a')],_0x4ab09f[_0x7995('0x4f')],md5(_0x4ab09f[_0x7995('0x4f')]));}headers[_0x7995('0x50')]=getAuth(_0x50c7b5);return getUser(_0x50c7b5,_0x33c801['email'])[_0x7995('0x13')](function(_0x630737){_0x54e2b1=_0x630737;logger[_0x7995('0xf')](_0x7995('0x52'),_0x54e2b1['id']);return getEndUser(_0x50c7b5,_0x4ab09f['destcalleridname'],_0x4ab09f['destcalleridnum']);})[_0x7995('0x13')](function(_0x197b52){_0x563f8e=_0x197b52;logger[_0x7995('0xf')](_0x7995('0x55'),_0x563f8e['id']);return getTicket(_0x50c7b5,_0x54e2b1,_0x563f8e,_0x14fe7f,_0x4ab09f);})['then'](function(_0x13cd7b){if(_0x13cd7b){logger[_0x7995('0xf')](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x13cd7b['id']);switch(_0x50c7b5['type']){case _0x7995('0x62'):logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x13cd7b['id']});break;case _0x7995('0x63'):logger['info'](_0x7995('0x4c'),_0x7995('0x5a'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801['name']),'trigger:browser:url',{'uri':util[_0x7995('0x11')](_0x7995('0x64'),_0x50c7b5['remoteUri'],_0x13cd7b['id'])});break;default:logger[_0x7995('0x5d')](_0x7995('0x60'),_0x7995('0x5c'));}}})[_0x7995('0x65')](function(_0x32cb04){logger['error'](_0x7995('0x60'),JSON['stringify'](_0x32cb04));});};exports[_0x7995('0x66')]=function(_0xe31dcb,_0x1722e2,_0x25b534,_0x4388c1,_0xeb8920,_0x2b3c1d){var _0x44372a,_0x10f012;_0x2b3c1d[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x12')]);_0x2b3c1d['serverUrl']=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x4a')]);if(_0xeb8920&&_0xeb8920[_0x7995('0x67')]){logger[_0x7995('0xf')]('['+_0x1722e2[_0x7995('0x68')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x1722e2[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x2b3c1d[_0x7995('0x4a')],_0x1722e2['uniqueid'],md5(_0x1722e2[_0x7995('0x4f')]));}else{_0x1722e2['recordingURL']='';}headers['Authorization']=getAuth(_0x2b3c1d);return getUser(_0x2b3c1d)[_0x7995('0x13')](function(_0x36d27d){_0x44372a=_0x36d27d;logger[_0x7995('0xf')](_0x7995('0x52'),_0x44372a['id']);return getEndUser(_0x2b3c1d,_0x1722e2[_0x7995('0x53')],_0x1722e2[_0x7995('0x54')]);})[_0x7995('0x13')](function(_0x13dc73){_0x10f012=_0x13dc73;logger[_0x7995('0xf')](_0x7995('0x55'),_0x10f012['id']);return getTicket(_0x2b3c1d,_0x44372a,_0x10f012,_0x25b534,_0x1722e2);})['then'](function(_0x2dc1f7){if(_0x2dc1f7){logger[_0x7995('0xf')](_0x7995('0x56'));logger['info'](_0x7995('0x69'),_0x2dc1f7['id']);}})[_0x7995('0x65')](function(_0x705f0){logger[_0x7995('0x5d')]('['+_0x1722e2[_0x7995('0x68')][_0x7995('0x6a')]()+']',JSON[_0x7995('0x1c')](_0x705f0));});}; \ No newline at end of file +var _0x5fc3=['map','forEach','includes','string','picklist','nameField','customField','toLowerCase','content','type','custom_fields','variable','variableName','idField','Variable','name','priority','Creating\x20new\x20ticket...','merge','getString','phone','new','xCALLY','Motion','CTI','concat','Descriptions','/api/v2/users/%d','user','Fields','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','recordingURL','The\x20User\x20ID\x20is:','destcalleridnum','Ticket\x20created!','[OUTBOUND]','unmanaged','lastevent','Recording\x20is\x20enabled!','lodash','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','emit','application/json','info','Getting\x20agent\x20with\x20email','%s/users','remoteUri','total_entries','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','format','%s/users/me','debug','stringify','authType','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','then','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','length'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0x5fc3,0xa8));var _0x35fc=function(_0x4358f5,_0x5b1ac6){_0x4358f5=_0x4358f5-0x0;var _0x4d8104=_0x5fc3[_0x4358f5];return _0x4d8104;};'use strict';var _=require(_0x35fc('0x0'));var rp=require(_0x35fc('0x1'));var md5=require('md5');var util=require(_0x35fc('0x2'));var Redis=require(_0x35fc('0x3'));var intUtil=require(_0x35fc('0x4'));var config=require(_0x35fc('0x5'));var logger=require(_0x35fc('0x6'))('desk');config[_0x35fc('0x7')]=_[_0x35fc('0x8')](config[_0x35fc('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x35fc('0x7')]));function emit(_0x508b32,_0x16e153,_0x27524f){io['to'](_0x508b32)[_0x35fc('0x9')](_0x16e153,_0x27524f);}var headers={'Content-Type':_0x35fc('0xa'),'Accept':_0x35fc('0xa')};function getUser(_0xf9d3a6,_0x2051ab){if(intUtil['validateEmail'](_0x2051ab)===!![]){logger[_0x35fc('0xb')](_0x35fc('0xc'),_0x2051ab);return request({'uri':util['format'](_0x35fc('0xd'),_0xf9d3a6[_0x35fc('0xe')])})['then'](function(_0xda83fb){if(_0xda83fb[_0x35fc('0xf')]){return _['find'](_0xda83fb['_embedded'][_0x35fc('0x10')],{'email':_0x2051ab});}})['then'](function(_0x397738){if(_0x397738){logger[_0x35fc('0xb')](_0x35fc('0x11'));return _0x397738;}else{logger[_0x35fc('0xb')](_0x35fc('0x12'));return request({'uri':util['format']('%s/users/me',_0xf9d3a6['remoteUri'])});}});}else{logger['info'](_0x35fc('0x13'));return request({'uri':util[_0x35fc('0x14')](_0x35fc('0x15'),_0xf9d3a6[_0x35fc('0xe')])});}}function request(_0x227a49){logger[_0x35fc('0x16')]('[HTTP]',JSON[_0x35fc('0x17')](_0x227a49));return rp(_[_0x35fc('0x8')](_0x227a49,{'method':'GET','headers':headers,'json':!![]}));}function getAuth(_0x41e165){var _0x363e47;if(_0x41e165[_0x35fc('0x18')]==='basic'){_0x363e47=util[_0x35fc('0x14')](_0x35fc('0x19'),_0x41e165[_0x35fc('0x1a')],_0x41e165['password']);}else if(_0x41e165[_0x35fc('0x18')]===_0x35fc('0x1b')){_0x363e47=util[_0x35fc('0x14')](_0x35fc('0x1c'),_0x41e165[_0x35fc('0x1a')],_0x41e165[_0x35fc('0x1b')]);}return util[_0x35fc('0x14')](_0x35fc('0x1d'),new Buffer(_0x363e47)[_0x35fc('0x1e')](_0x35fc('0x1f')));}function getEndUser(_0x5bd2b8,_0x323aee,_0xd5399f){logger[_0x35fc('0xb')](_0x35fc('0x20'),_0xd5399f);return request({'uri':util[_0x35fc('0x14')]('%s/customers/search',_0x5bd2b8[_0x35fc('0xe')]),'qs':{'phone':_0xd5399f}})[_0x35fc('0x21')](function(_0x561bf8){if(_0x561bf8[_0x35fc('0xf')]){logger[_0x35fc('0xb')](_0x35fc('0x22'));return _0x561bf8['_embedded'][_0x35fc('0x10')][0x0];}else{logger['info'](_0x35fc('0x23'));return request({'uri':util[_0x35fc('0x14')]('%s/customers',_0x5bd2b8['remoteUri']),'method':_0x35fc('0x24'),'body':{'first_name':_0x323aee,'title':_0x323aee,'phone_numbers':[{'type':'work','value':_0xd5399f}]}});}});}function getTags(_0x274208,_0x1a5d92){var _0x57001c=[];if(_0x274208&&_0x274208[_0x35fc('0x25')]>0x0){_0x57001c=_[_0x35fc('0x26')](_0x274208,_0x1a5d92);}return _0x57001c;}function getCustomFields(_0x383837,_0x9f3c8a){var _0x3735da=[];var _0x134dfa={'custom_fields':{}};if(_0x383837[_0x35fc('0x25')]>0x0){_[_0x35fc('0x27')](_0x383837,function(_0x54aedc){if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc['type'])&&_0x54aedc[_0x35fc('0x2b')]&&!_0x54aedc[_0x35fc('0x2c')]){_0x134dfa[_0x54aedc[_0x35fc('0x2b')][_0x35fc('0x2d')]()]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc[_0x35fc('0x2f')])&&_0x54aedc['idField']&&_0x54aedc['customField']){_0x134dfa[_0x35fc('0x30')][_0x54aedc['idField']]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_0x54aedc[_0x35fc('0x2f')]===_0x35fc('0x31')&&_0x54aedc[_0x35fc('0x32')]&&_0x54aedc[_0x35fc('0x33')]&&_0x54aedc['customField']){_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]][_0x35fc('0x1e')]());}else if(_0x54aedc[_0x35fc('0x2f')]==='customVariable'&&_0x54aedc[_0x35fc('0x34')]&&_0x54aedc[_0x35fc('0x34')][_0x35fc('0x35')]&&_0x54aedc['idField']&&_0x54aedc[_0x35fc('0x2c')]){_0x9f3c8a[_0x54aedc['Variable'][_0x35fc('0x35')][_0x35fc('0x2d')]()]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc['Variable']['name']['toLowerCase']()][_0x35fc('0x1e')]());}});}if(_0x134dfa['priority']){_0x134dfa[_0x35fc('0x36')]=Number(_0x134dfa['priority']);}return _0x134dfa;}function getTicket(_0x9c6b65,_0x1f2d66,_0x2ca9ac,_0x22b724,_0x1c10e0){logger[_0x35fc('0xb')](_0x35fc('0x37'));var _0x4ec0dc=_[_0x35fc('0x38')]({'subject':intUtil[_0x35fc('0x39')](_0x22b724['Subjects'],_0x1c10e0,'\x20'),'type':_0x35fc('0x3a'),'status':_0x35fc('0x3b'),'labels':[_0x35fc('0x3c'),_0x35fc('0x3d'),_0x35fc('0x3e')][_0x35fc('0x3f')](getTags(_0x22b724['Tags'],_0x35fc('0x35'))),'description':intUtil[_0x35fc('0x39')](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0x35fc('0x41'),_0x1f2d66['id']),'class':_0x35fc('0x42')}},'message':{'direction':'in','body':intUtil['getString'](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a')}},getCustomFields(_0x22b724[_0x35fc('0x43')],_0x1c10e0));return request({'uri':util[_0x35fc('0x14')](_0x35fc('0x44'),_0x9c6b65[_0x35fc('0xe')],_0x2ca9ac['id']),'method':_0x35fc('0x24'),'body':_0x4ec0dc});}exports[_0x35fc('0x45')]=function(_0x3ec51f,_0x5a7e9e,_0x596e83,_0x210d5d,_0x36fcf9,_0x4fdc6d){var _0x5c2e5c,_0x4ff202;_0x4fdc6d[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x4fdc6d['remoteUri']);_0x4fdc6d[_0x35fc('0x47')]=intUtil[_0x35fc('0x46')](_0x4fdc6d[_0x35fc('0x47')]);if(_0x36fcf9&&_0x36fcf9[_0x35fc('0x48')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x5a7e9e['recordingURL']=util['format'](_0x35fc('0x49'),_0x4fdc6d[_0x35fc('0x47')],_0x5a7e9e['uniqueid'],md5(_0x5a7e9e[_0x35fc('0x4a')]));}else{_0x5a7e9e['recordingURL']='';}headers[_0x35fc('0x4b')]=getAuth(_0x4fdc6d);return getUser(_0x4fdc6d,_0x210d5d[_0x35fc('0x4c')])[_0x35fc('0x21')](function(_0x2de5d1){_0x5c2e5c=_0x2de5d1;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x5c2e5c['id']);return getEndUser(_0x4fdc6d,_0x5a7e9e[_0x35fc('0x4d')],_0x5a7e9e[_0x35fc('0x4e')]);})['then'](function(_0x18181b){_0x4ff202=_0x18181b;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x4ff202['id']);return getTicket(_0x4fdc6d,_0x5c2e5c,_0x4ff202,_0x596e83,_0x5a7e9e);})[_0x35fc('0x21')](function(_0x5bc8c3){if(_0x5bc8c3){logger[_0x35fc('0xb')]('Ticket\x20created!');logger['info'](_0x35fc('0x50'),_0x5bc8c3['id']);switch(_0x4fdc6d[_0x35fc('0x2f')]){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x53'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d['name']),_0x35fc('0x55'),{'recordId':_0x5bc8c3['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d[_0x35fc('0x35')]),_0x35fc('0x58'),{'uri':util[_0x35fc('0x14')](_0x35fc('0x59'),_0x5bc8c3['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x52'),_0x35fc('0x5b'));}}})['catch'](function(_0x553ed6){console[_0x35fc('0x5a')](_0x553ed6);logger[_0x35fc('0x5a')](_0x35fc('0x52'),JSON[_0x35fc('0x17')](_0x553ed6));});};exports[_0x35fc('0x5c')]=function(_0x3e6494,_0x4a4798,_0x4f024c,_0x388521,_0x19b2ce,_0x395d63,_0x38bc78){var _0x5b2595,_0x467980;_0x395d63[_0x35fc('0xe')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0xe')]);_0x395d63[_0x35fc('0x47')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0x47')]);if(_0x38bc78&&_0x38bc78[_0x35fc('0x5d')]&&_0x38bc78[_0x35fc('0x5d')]!==_0x35fc('0x5e')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x4a4798[_0x35fc('0x5f')]=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x395d63[_0x35fc('0x47')],_0x4a4798[_0x35fc('0x4a')],md5(_0x4a4798[_0x35fc('0x4a')]));}headers[_0x35fc('0x4b')]=getAuth(_0x395d63);return getUser(_0x395d63,_0x388521[_0x35fc('0x4c')])['then'](function(_0x2d9d45){_0x5b2595=_0x2d9d45;logger[_0x35fc('0xb')](_0x35fc('0x60'),_0x5b2595['id']);return getEndUser(_0x395d63,_0x4a4798['destcalleridname'],_0x4a4798[_0x35fc('0x61')]);})[_0x35fc('0x21')](function(_0x47fb1a){_0x467980=_0x47fb1a;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x467980['id']);return getTicket(_0x395d63,_0x5b2595,_0x467980,_0x4f024c,_0x4a4798);})[_0x35fc('0x21')](function(_0x1c4c33){if(_0x1c4c33){logger[_0x35fc('0xb')](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x1c4c33['id']);switch(_0x395d63['type']){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:desk:display',{'recordId':_0x1c4c33['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:browser:url',{'uri':util['format']('%s/agent/tickets/%s',_0x395d63[_0x35fc('0xe')],_0x1c4c33['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x63'),_0x35fc('0x5b'));}}})['catch'](function(_0x458eb8){logger[_0x35fc('0x5a')](_0x35fc('0x63'),JSON[_0x35fc('0x17')](_0x458eb8));});};exports[_0x35fc('0x64')]=function(_0x1d0e53,_0x27071b,_0x2127e0,_0x462ceb,_0x4c3ace,_0x35d7c8){var _0x47c75f,_0xfbd737;_0x35d7c8[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x35d7c8[_0x35fc('0xe')]);_0x35d7c8['serverUrl']=intUtil[_0x35fc('0x46')](_0x35d7c8['serverUrl']);if(_0x4c3ace&&_0x4c3ace['monitor_format']){logger['info']('['+_0x27071b[_0x35fc('0x65')]['toUpperCase']()+']',_0x35fc('0x66'));_0x27071b['recordingURL']=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x35d7c8[_0x35fc('0x47')],_0x27071b[_0x35fc('0x4a')],md5(_0x27071b[_0x35fc('0x4a')]));}else{_0x27071b[_0x35fc('0x5f')]='';}headers['Authorization']=getAuth(_0x35d7c8);return getUser(_0x35d7c8)[_0x35fc('0x21')](function(_0x1e2214){_0x47c75f=_0x1e2214;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x47c75f['id']);return getEndUser(_0x35d7c8,_0x27071b[_0x35fc('0x4d')],_0x27071b[_0x35fc('0x4e')]);})[_0x35fc('0x21')](function(_0x3c1b56){_0xfbd737=_0x3c1b56;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0xfbd737['id']);return getTicket(_0x35d7c8,_0x47c75f,_0xfbd737,_0x2127e0,_0x27071b);})[_0x35fc('0x21')](function(_0x4464d5){if(_0x4464d5){logger['info'](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x4464d5['id']);}})['catch'](function(_0x1c88d8){logger[_0x35fc('0x5a')]('['+_0x27071b['lastevent']['toUpperCase']()+']',JSON[_0x35fc('0x17')](_0x1c88d8));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 4f482e0..1924030 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 _0x1923=['[QUEUE]','none',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','bluebird','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','defaults','redis','localhost','socket.io-emitter','POST','clientId','remoteUri','username','password','clientSecret','access_token','error','toUpperCase',']\x20Wrong\x20credentials!','message','Bearer\x20','4.0','then','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','userId','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','catch','outbound','destcalleridnum','calleridnum','/systemusers(','odata-entityid','substring','lastIndexOf','enduserId','toLowerCase','GET','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','%2b','telephone1',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','includes','string','picklist','type','nameField','idField','indexOf','content','ticketType','incident','incidents','getString','Descriptions','/contacts(','Fields','phonecalls','assign','Subjects','callDirection','queue','headers','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','unmanaged','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','monitor_format'];(function(_0xd1e471,_0x2c7a2){var _0x15a03c=function(_0x613dd1){while(--_0x613dd1){_0xd1e471['push'](_0xd1e471['shift']());}};_0x15a03c(++_0x2c7a2);}(_0x1923,0x71));var _0x3192=function(_0x5ad59c,_0x482a95){_0x5ad59c=_0x5ad59c-0x0;var _0x5756f6=_0x1923[_0x5ad59c];return _0x5756f6;};'use strict';var _=require('lodash');var BPromise=require(_0x3192('0x0'));var rp=require(_0x3192('0x1'));var util=require(_0x3192('0x2'));var intUtil=require(_0x3192('0x3'));var md5=require(_0x3192('0x4'));var Redis=require(_0x3192('0x5'));var logger=require(_0x3192('0x6'))(_0x3192('0x7'));var config=require('../../../../config/environment');config['redis']=_[_0x3192('0x8')](config[_0x3192('0x9')],{'host':_0x3192('0xa'),'port':0x18eb});var io=require(_0x3192('0xb'))(new Redis(config[_0x3192('0x9')]));function getAuthToken(_0x185da9,_0x22187a,_0x1a0882){var _0x3072a3={'method':_0x3192('0xc'),'uri':_0x22187a,'form':{'client_id':_0x185da9[_0x3192('0xd')],'resource':_0x185da9[_0x3192('0xe')],'username':_0x185da9[_0x3192('0xf')],'password':_0x185da9[_0x3192('0x10')],'grant_type':_0x3192('0x10'),'client_secret':_0x185da9[_0x3192('0x11')]},'json':!![]};return rp(_0x3072a3)['then'](function(_0x5578c0){return _0x5578c0[_0x3192('0x12')];})['catch'](function(_0x451879){logger[_0x3192('0x13')]('['+[_0x1a0882[_0x3192('0x14')]()]+_0x3192('0x15'));return _0x451879[_0x3192('0x16')];});}function getUser(_0x28b5f5,_0x21b859,_0x4ceebe,_0x12c95b,_0x2920bc,_0x1b663d){return new BPromise(function(_0x3b2a47,_0x1b4422){return getAuthToken(_0x21b859,_0x12c95b,_0x1b663d)['then'](function(_0x331160){var _0x21c343={'method':'GET','uri':_0x2920bc+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0x3192('0x17')+_0x331160,'OData-Version':_0x3192('0x18')},'json':!![]};return rp(_0x21c343);})[_0x3192('0x19')](function(_0x19087b){var _0x7ae718=_0x19087b[_0x3192('0x1a')];var _0x478e58=![];var _0x52336e=null;if(!_[_0x3192('0x1b')](_0x4ceebe)){if(intUtil[_0x3192('0x1c')](_0x4ceebe[_0x3192('0x1d')])){_0x28b5f5[_0x3192('0x1e')]=_0x4ceebe[_0x3192('0x1d')];for(_0x52336e=0x0;_0x52336e<_0x7ae718[_0x3192('0x1f')];_0x52336e++){if(_0x7ae718[_0x52336e][_0x3192('0x20')]===_0x4ceebe[_0x3192('0x1d')]&&!_0x7ae718[_0x52336e][_0x3192('0x21')]){_0x478e58=!![];logger[_0x3192('0x22')]('['+[_0x1b663d[_0x3192('0x14')]()]+_0x3192('0x23')+_0x7ae718[_0x52336e]['systemuserid']+'!');_0x28b5f5[_0x3192('0x24')]=_0x7ae718[_0x52336e][_0x3192('0x25')];}}}}if(!_0x478e58){logger['info']('['+[_0x1b663d[_0x3192('0x14')]()]+_0x3192('0x26'));_0x28b5f5[_0x3192('0x1e')]=_0x21b859['username'];for(_0x52336e=0x0;_0x52336e<_0x7ae718[_0x3192('0x1f')];_0x52336e++){if(_0x7ae718[_0x52336e]['internalemailaddress']===_0x21b859[_0x3192('0xf')]){_0x28b5f5[_0x3192('0x24')]=_0x7ae718[_0x52336e][_0x3192('0x25')];}}}_0x3b2a47(_0x28b5f5);})[_0x3192('0x27')](function(_0x473a17){_0x1b4422(_0x473a17[_0x3192('0x16')]);});});}function createEndUser(_0x54dc39,_0x7bbab2,_0x86eda4,_0x4838e8,_0x5bc765,_0x52ac0b){return new BPromise(function(_0x5c0ae6,_0x492874){return getAuthToken(_0x7bbab2,_0x86eda4,_0x52ac0b)['then'](function(_0x4ba494){var _0x495fc5=_0x52ac0b['toLowerCase']()===_0x3192('0x28')?_0x5bc765[_0x3192('0x29')]:_0x5bc765[_0x3192('0x2a')];var _0x246643={'method':_0x3192('0xc'),'uri':_0x4838e8+'contacts','body':{'telephone1':_0x495fc5,'fullname':_0x495fc5,'firstname':_0x495fc5,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x3192('0x2b')+_0x54dc39['userId']+')'},'headers':{'Authorization':_0x3192('0x17')+_0x4ba494,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x246643);})[_0x3192('0x19')](function(_0x21b999){var _0x2d8f9b=_0x21b999['headers'][_0x3192('0x2c')];var _0x1f164b=_0x2d8f9b[_0x3192('0x2d')](_0x2d8f9b[_0x3192('0x2e')]('(')+0x1,_0x2d8f9b[_0x3192('0x2e')](')'));_0x54dc39[_0x3192('0x2f')]=_0x1f164b;_0x5c0ae6(_0x54dc39);})['catch'](function(_0x476bbb){_0x492874(_0x476bbb[_0x3192('0x16')]);});});}function getEndUser(_0x21335a,_0xdccbf,_0x282fbd,_0x5dfc9d,_0x1a6180,_0x4cafa6){return new BPromise(function(_0x57fff2,_0x297e1b){var _0x3ebb22=_0x4cafa6[_0x3192('0x30')]()===_0x3192('0x28')?_0x1a6180[_0x3192('0x29')]:_0x1a6180['calleridnum'];return getAuthToken(_0xdccbf,_0x282fbd,_0x4cafa6)['then'](function(_0x4f6ca2){var _0x2b0add={'method':_0x3192('0x31'),'uri':_0x5dfc9d+_0x3192('0x32')+_0x3ebb22['replace']('+',_0x3192('0x33'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0x4f6ca2,'If-None-Match':null,'OData-Version':_0x3192('0x18')},'json':!![]};return rp(_0x2b0add);})[_0x3192('0x19')](function(_0x10f79b){var _0x45c1cf=null;if(_0x10f79b){var _0x10598e=_0x10f79b[_0x3192('0x1a')];var _0x51ce23=![];for(_0x45c1cf=0x0;_0x45c1cf<_0x10598e['length'];_0x45c1cf++){if(_0x10598e[_0x45c1cf][_0x3192('0x34')]===_0x3ebb22){_0x51ce23=!![];_0x21335a['enduserId']=_0x10598e[_0x45c1cf]['contactid'];}}if(_0x51ce23){_0x57fff2(_0x21335a);}else{return createEndUser(_0x21335a,_0xdccbf,_0x282fbd,_0x5dfc9d,_0x1a6180,_0x4cafa6)[_0x3192('0x19')](function(_0x2d6c8e){logger[_0x3192('0x22')]('['+[_0x4cafa6[_0x3192('0x14')]()]+_0x3192('0x35'),_0x2d6c8e[_0x3192('0x2f')]);_0x57fff2(_0x2d6c8e);});}}else{return createEndUser(_0x21335a,_0xdccbf,_0x282fbd,_0x5dfc9d,_0x1a6180,_0x4cafa6)[_0x3192('0x19')](function(_0x53372b){logger[_0x3192('0x22')]('['+[_0x4cafa6[_0x3192('0x14')]()]+_0x3192('0x36'),_0x53372b['enduserId']);_0x57fff2(_0x53372b);});}});});}function getCustomFields(_0x3162d7,_0x42dad4,_0x3a53c9){var _0x2a8177={};if(_0x3162d7['length']>0x0){_[_0x3192('0x37')](_0x3162d7,function(_0x281565){if(_[_0x3192('0x38')]([_0x3192('0x39'),_0x3192('0x3a')],_0x281565[_0x3192('0x3b')])&&_0x281565[_0x3192('0x3c')]&&!_0x281565['customField']){var _0x5ae33e=_0x281565[_0x3192('0x3d')][_0x3192('0x30')]();var _0x478210=_0x5ae33e[_0x3192('0x2d')](0x0,_0x5ae33e[_0x3192('0x3e')]('_'));var _0x1f4b88=_0x5ae33e['substring'](_0x5ae33e[_0x3192('0x3e')]('_')+0x1);if(_0x478210===_0x3a53c9){_0x2a8177[_0x1f4b88]=_0x281565[_0x3192('0x3f')];}}});}return _0x2a8177;}function getTicket(_0x152c34,_0x4eebf7,_0x5c2afa,_0x3a6361,_0xf755f9,_0x4f14af,_0x591f5f){return new BPromise(function(_0x2a411e,_0x4c0da5){var _0x5c5e4f;return getAuthToken(_0x4eebf7,_0x5c2afa,_0x591f5f)[_0x3192('0x19')](function(_0x4a423b){if(_0x4f14af[_0x3192('0x40')]===_0x3192('0x41')){_0x5c5e4f={'method':_0x3192('0xc'),'uri':_0x3a6361+_0x3192('0x42'),'body':Object['assign']({},{'title':intUtil[_0x3192('0x43')](_0x4f14af['Subjects'],_0xf755f9,'\x20'),'description':intUtil['getString'](_0x4f14af[_0x3192('0x44')],_0xf755f9,'\x0a'),'customerid_contact@odata.bind':_0x3192('0x45')+_0x152c34[_0x3192('0x2f')]+')','ownerid@odata.bind':_0x3192('0x2b')+_0x152c34['userId']+')','caseorigincode':'1'},getCustomFields(_0x4f14af[_0x3192('0x46')],_0xf755f9,_0x4f14af[_0x3192('0x40')])),'headers':{'Authorization':_0x3192('0x17')+_0x4a423b,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x4f14af['ticketType']==='phonecall'){_0x5c5e4f={'method':_0x3192('0xc'),'uri':_0x3a6361+_0x3192('0x47'),'body':Object[_0x3192('0x48')]({},{'subject':intUtil[_0x3192('0x43')](_0x4f14af[_0x3192('0x49')],_0xf755f9,'\x20'),'phonenumber':String(_0xf755f9['calleridnum']),'description':intUtil['getString'](_0x4f14af[_0x3192('0x44')],_0xf755f9,'\x0a'),'regardingobjectid_contact@odata.bind':_0x3192('0x45')+_0x152c34[_0x3192('0x2f')]+')','ownerid@odata.bind':_0x3192('0x2b')+_0x152c34[_0x3192('0x24')]+')','directioncode':_0x152c34[_0x3192('0x4a')]===_0x3192('0x4b')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x3192('0x2b')+_0x152c34[_0x3192('0x24')]+')','participationtypemask':_0x152c34[_0x3192('0x4a')]===_0x3192('0x4b')?0x2:0x1},{'partyid_contact@odata.bind':_0x3192('0x45')+_0x152c34[_0x3192('0x2f')]+')','participationtypemask':_0x152c34[_0x3192('0x4a')]==='queue'?0x1:0x2}]},getCustomFields(_0x4f14af[_0x3192('0x46')],_0xf755f9,_0x4f14af[_0x3192('0x40')])),'headers':{'Authorization':_0x3192('0x17')+_0x4a423b,'OData-Version':_0x3192('0x18')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x5c5e4f);})[_0x3192('0x19')](function(_0xcbfb18){var _0xc9ad85=_0xcbfb18[_0x3192('0x4c')][_0x3192('0x2c')];var _0xeee1ec=_0xc9ad85[_0x3192('0x2d')](_0xc9ad85[_0x3192('0x2e')]('(')+0x1,_0xc9ad85[_0x3192('0x2e')](')'));_0x152c34['ticketId']=_0xeee1ec;_0x2a411e(_0x152c34);})[_0x3192('0x27')](function(_0x100e0b){_0x4c0da5(_0x100e0b[_0x3192('0x16')]);});});}function emit(_0x2e466e,_0x5557f2,_0x5090ac,_0xf4b8c9){var _0x400848={'uri':util[_0x3192('0x4d')](_0x3192('0x4e'),_0x2e466e,_0x5090ac,_0xf4b8c9)};io['to'](util['format'](_0x3192('0x4f'),_0x5557f2))[_0x3192('0x50')](_0x3192('0x51'),_0x400848);}exports['cs']=function(_0x32d4b1,_0x5f4291,_0x1866d9,_0x48ccbc,_0x36fdc5,_0xa2e823,_0x29d0d4,_0x47b3ff){var _0xad2c94={};_0xa2e823[_0x3192('0xe')]=intUtil[_0x3192('0x52')](_0xa2e823[_0x3192('0xe')]);_0xa2e823['serverUrl']=intUtil[_0x3192('0x52')](_0xa2e823['serverUrl']);_0xad2c94['callDirection']=_0x47b3ff===_0x3192('0x4b')||_0x47b3ff===_0x3192('0x53')?_0x3192('0x4b'):_0x3192('0x28');var _0x1fc101=util[_0x3192('0x4d')]('%s/api/data/v9.0/',_0xa2e823[_0x3192('0xe')]);var _0x365a01=util[_0x3192('0x4d')]('https://login.microsoftonline.com/%s/oauth2/token',_0xa2e823[_0x3192('0x54')]);var _0x4336d2=util[_0x3192('0x4d')](_0x3192('0x55'),_0xa2e823[_0x3192('0x56')],_0x5f4291[_0x3192('0x57')],md5(_0x5f4291[_0x3192('0x57')]));if(_0x36fdc5&&_0x36fdc5[_0x3192('0x58')]){logger[_0x3192('0x22')](_0x3192('0x59'),'Recording\x20is\x20enabled!');_0x5f4291['recordingURL']=_0x4336d2;}else if(_0x29d0d4&&_0x29d0d4['recordingFormat']&&_0x29d0d4['recordingFormat']!==_0x3192('0x5a')){logger[_0x3192('0x22')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x5f4291['recordingURL']=_0x4336d2;}else{_0x5f4291['recordingURL']='';}return getUser(_0xad2c94,_0xa2e823,_0x48ccbc,_0x365a01,_0x1fc101,_0x47b3ff)[_0x3192('0x19')](function(_0x5dfd66){logger['info']('['+_0x47b3ff[_0x3192('0x14')]()+_0x3192('0x5b'),_0x5dfd66[_0x3192('0x24')]);logger['info']('['+_0x47b3ff[_0x3192('0x14')]()+_0x3192('0x5c'),_0x5dfd66[_0x3192('0x1e')]);return getEndUser(_0x5dfd66,_0xa2e823,_0x365a01,_0x1fc101,_0x5f4291,_0x47b3ff);})[_0x3192('0x19')](function(_0x2d9028){logger[_0x3192('0x22')]('['+_0x47b3ff['toUpperCase']()+_0x3192('0x5d'),_0x2d9028[_0x3192('0x2f')]);logger[_0x3192('0x22')]('['+_0x47b3ff['toUpperCase']()+_0x3192('0x5e'),_0x5f4291[_0x3192('0x2a')]);return getTicket(_0x2d9028,_0xa2e823,_0x365a01,_0x1fc101,_0x5f4291,_0x1866d9,_0x47b3ff);})[_0x3192('0x19')](function(_0x5e73f9){logger['info'](util[_0x3192('0x4d')]('['+_0x47b3ff[_0x3192('0x14')]()+_0x3192('0x5f'),_0x1866d9['ticketType'],_0x5e73f9[_0x3192('0x60')]));logger[_0x3192('0x22')](util['format']('['+_0x47b3ff['toUpperCase']()+_0x3192('0x61'),_0x47b3ff));if(_0x47b3ff!==_0x3192('0x53')){logger[_0x3192('0x22')]('['+_0x47b3ff['toUpperCase']()+']',_0x3192('0x62'));emit(_0xa2e823[_0x3192('0xe')],_0x48ccbc['name'],_0x1866d9[_0x3192('0x40')],_0x5e73f9[_0x3192('0x60')]);}})['catch'](function(_0x48a860){logger[_0x3192('0x13')]('['+_0x47b3ff[_0x3192('0x14')]()+_0x3192('0x63'),util[_0x3192('0x64')](_0x48a860,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x44a4=['monitor_format','[QUEUE]','recordingURL','recordingFormat','none',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','name',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','bluebird','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','POST','clientId','remoteUri','password','clientSecret','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','4.0','email','userEmail','internalemailaddress','info','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','headers','odata-entityid','substring','lastIndexOf','enduserId','GET','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','%2b','Bearer\x20','length','telephone1','contactid',']\x20Enduser\x20Created!','forEach','includes','string','picklist','nameField','customField','indexOf','ticketType','incident','assign','getString','Subjects','Descriptions','/contacts(','Fields','phonecall','callDirection','queue','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','uniqueid'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x44a4,0x65));var _0x444a=function(_0x3c4689,_0x1cbf3a){_0x3c4689=_0x3c4689-0x0;var _0x2cf8d1=_0x44a4[_0x3c4689];return _0x2cf8d1;};'use strict';var _=require(_0x444a('0x0'));var BPromise=require(_0x444a('0x1'));var rp=require('request-promise');var util=require('util');var intUtil=require('./util');var md5=require('md5');var Redis=require(_0x444a('0x2'));var logger=require(_0x444a('0x3'))(_0x444a('0x4'));var config=require(_0x444a('0x5'));config[_0x444a('0x6')]=_[_0x444a('0x7')](config[_0x444a('0x6')],{'host':_0x444a('0x8'),'port':0x18eb});var io=require(_0x444a('0x9'))(new Redis(config[_0x444a('0x6')]));function getAuthToken(_0x3a4683,_0x190295,_0x4582db){var _0x280f9b={'method':_0x444a('0xa'),'uri':_0x190295,'form':{'client_id':_0x3a4683[_0x444a('0xb')],'resource':_0x3a4683[_0x444a('0xc')],'username':_0x3a4683['username'],'password':_0x3a4683[_0x444a('0xd')],'grant_type':_0x444a('0xd'),'client_secret':_0x3a4683[_0x444a('0xe')]},'json':!![]};return rp(_0x280f9b)[_0x444a('0xf')](function(_0x5f27f6){return _0x5f27f6[_0x444a('0x10')];})[_0x444a('0x11')](function(_0x5abd44){logger[_0x444a('0x12')]('['+[_0x4582db[_0x444a('0x13')]()]+_0x444a('0x14'));return _0x5abd44[_0x444a('0x15')];});}function getUser(_0x36d1e6,_0x32b3de,_0x54873d,_0x14881b,_0x1cb647,_0x560a59){return new BPromise(function(_0x50dc9e,_0x41ad71){return getAuthToken(_0x32b3de,_0x14881b,_0x560a59)['then'](function(_0x141e75){var _0x2885be={'method':'GET','uri':_0x1cb647+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':'Bearer\x20'+_0x141e75,'OData-Version':_0x444a('0x16')},'json':!![]};return rp(_0x2885be);})[_0x444a('0xf')](function(_0x975d90){var _0x4e3862=_0x975d90['value'];var _0x4fbc17=![];var _0x51608e=null;if(!_['isNil'](_0x54873d)){if(intUtil['validateEmail'](_0x54873d[_0x444a('0x17')])){_0x36d1e6[_0x444a('0x18')]=_0x54873d[_0x444a('0x17')];for(_0x51608e=0x0;_0x51608e<_0x4e3862['length'];_0x51608e++){if(_0x4e3862[_0x51608e][_0x444a('0x19')]===_0x54873d[_0x444a('0x17')]&&!_0x4e3862[_0x51608e]['isdisabled']){_0x4fbc17=!![];logger[_0x444a('0x1a')]('['+[_0x560a59[_0x444a('0x13')]()]+']\x20Agent\x20found\x20'+_0x4e3862[_0x51608e][_0x444a('0x1b')]+'!');_0x36d1e6[_0x444a('0x1c')]=_0x4e3862[_0x51608e][_0x444a('0x1b')];}}}}if(!_0x4fbc17){logger[_0x444a('0x1a')]('['+[_0x560a59[_0x444a('0x13')]()]+_0x444a('0x1d'));_0x36d1e6[_0x444a('0x18')]=_0x32b3de[_0x444a('0x1e')];for(_0x51608e=0x0;_0x51608e<_0x4e3862['length'];_0x51608e++){if(_0x4e3862[_0x51608e][_0x444a('0x19')]===_0x32b3de[_0x444a('0x1e')]){_0x36d1e6[_0x444a('0x1c')]=_0x4e3862[_0x51608e][_0x444a('0x1b')];}}}_0x50dc9e(_0x36d1e6);})['catch'](function(_0x4ee309){_0x41ad71(_0x4ee309[_0x444a('0x15')]);});});}function createEndUser(_0x2bbf68,_0x255a79,_0xd850df,_0x47d742,_0x447331,_0x1eb61e){return new BPromise(function(_0xe5b93a,_0x47f9da){return getAuthToken(_0x255a79,_0xd850df,_0x1eb61e)[_0x444a('0xf')](function(_0xa4caa){var _0x1ee311=_0x1eb61e[_0x444a('0x1f')]()===_0x444a('0x20')?_0x447331[_0x444a('0x21')]:_0x447331[_0x444a('0x22')];var _0x127dd2={'method':_0x444a('0xa'),'uri':_0x47d742+_0x444a('0x23'),'body':{'telephone1':_0x1ee311,'fullname':_0x1ee311,'firstname':_0x1ee311,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x444a('0x24')+_0x2bbf68[_0x444a('0x1c')]+')'},'headers':{'Authorization':'Bearer\x20'+_0xa4caa,'OData-Version':_0x444a('0x16')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x127dd2);})[_0x444a('0xf')](function(_0x7e7cf9){var _0x171927=_0x7e7cf9[_0x444a('0x25')][_0x444a('0x26')];var _0x50bce3=_0x171927[_0x444a('0x27')](_0x171927[_0x444a('0x28')]('(')+0x1,_0x171927[_0x444a('0x28')](')'));_0x2bbf68[_0x444a('0x29')]=_0x50bce3;_0xe5b93a(_0x2bbf68);})['catch'](function(_0x3168d7){_0x47f9da(_0x3168d7[_0x444a('0x15')]);});});}function getEndUser(_0x102721,_0x389443,_0x177b03,_0x23de86,_0x24f7be,_0x5170d0){return new BPromise(function(_0xd6b970,_0x429f4c){var _0x205da2=_0x5170d0[_0x444a('0x1f')]()===_0x444a('0x20')?_0x24f7be[_0x444a('0x21')]:_0x24f7be['calleridnum'];return getAuthToken(_0x389443,_0x177b03,_0x5170d0)[_0x444a('0xf')](function(_0x19dd40){var _0x53fce0={'method':_0x444a('0x2a'),'uri':_0x23de86+_0x444a('0x2b')+_0x205da2[_0x444a('0x2c')]('+',_0x444a('0x2d'))+'\x27','headers':{'Authorization':_0x444a('0x2e')+_0x19dd40,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x53fce0);})[_0x444a('0xf')](function(_0x25ce58){var _0x1b412f=null;if(_0x25ce58){var _0x199d89=_0x25ce58['value'];var _0x409825=![];for(_0x1b412f=0x0;_0x1b412f<_0x199d89[_0x444a('0x2f')];_0x1b412f++){if(_0x199d89[_0x1b412f][_0x444a('0x30')]===_0x205da2){_0x409825=!![];_0x102721['enduserId']=_0x199d89[_0x1b412f][_0x444a('0x31')];}}if(_0x409825){_0xd6b970(_0x102721);}else{return createEndUser(_0x102721,_0x389443,_0x177b03,_0x23de86,_0x24f7be,_0x5170d0)[_0x444a('0xf')](function(_0x3bfe94){logger['info']('['+[_0x5170d0['toUpperCase']()]+']\x20Enduser\x20created!',_0x3bfe94['enduserId']);_0xd6b970(_0x3bfe94);});}}else{return createEndUser(_0x102721,_0x389443,_0x177b03,_0x23de86,_0x24f7be,_0x5170d0)[_0x444a('0xf')](function(_0x4c9a7a){logger['info']('['+[_0x5170d0['toUpperCase']()]+_0x444a('0x32'),_0x4c9a7a[_0x444a('0x29')]);_0xd6b970(_0x4c9a7a);});}});});}function getCustomFields(_0x3808c9,_0x31a862,_0x196917){var _0x24e395={};if(_0x3808c9[_0x444a('0x2f')]>0x0){_[_0x444a('0x33')](_0x3808c9,function(_0x13f26e){if(_[_0x444a('0x34')]([_0x444a('0x35'),_0x444a('0x36')],_0x13f26e['type'])&&_0x13f26e[_0x444a('0x37')]&&!_0x13f26e[_0x444a('0x38')]){var _0x4bcc39=_0x13f26e['idField'][_0x444a('0x1f')]();var _0x23a67e=_0x4bcc39[_0x444a('0x27')](0x0,_0x4bcc39[_0x444a('0x39')]('_'));var _0x46ed64=_0x4bcc39[_0x444a('0x27')](_0x4bcc39['indexOf']('_')+0x1);if(_0x23a67e===_0x196917){_0x24e395[_0x46ed64]=_0x13f26e['content'];}}});}return _0x24e395;}function getTicket(_0x470974,_0x587adc,_0x2e3a7c,_0x37eb12,_0x34922f,_0xb5dc41,_0x137417){return new BPromise(function(_0x3608d2,_0x4b431b){var _0x473652;return getAuthToken(_0x587adc,_0x2e3a7c,_0x137417)['then'](function(_0x473826){if(_0xb5dc41[_0x444a('0x3a')]===_0x444a('0x3b')){_0x473652={'method':_0x444a('0xa'),'uri':_0x37eb12+'incidents','body':Object[_0x444a('0x3c')]({},{'title':intUtil[_0x444a('0x3d')](_0xb5dc41[_0x444a('0x3e')],_0x34922f,'\x20'),'description':intUtil[_0x444a('0x3d')](_0xb5dc41[_0x444a('0x3f')],_0x34922f,'\x0a'),'customerid_contact@odata.bind':_0x444a('0x40')+_0x470974[_0x444a('0x29')]+')','ownerid@odata.bind':_0x444a('0x24')+_0x470974[_0x444a('0x1c')]+')','caseorigincode':'1'},getCustomFields(_0xb5dc41[_0x444a('0x41')],_0x34922f,_0xb5dc41[_0x444a('0x3a')])),'headers':{'Authorization':_0x444a('0x2e')+_0x473826,'OData-Version':_0x444a('0x16')},'json':!![],'resolveWithFullResponse':!![]};}if(_0xb5dc41[_0x444a('0x3a')]===_0x444a('0x42')){_0x473652={'method':_0x444a('0xa'),'uri':_0x37eb12+'phonecalls','body':Object['assign']({},{'subject':intUtil[_0x444a('0x3d')](_0xb5dc41[_0x444a('0x3e')],_0x34922f,'\x20'),'phonenumber':String(_0x34922f[_0x444a('0x22')]),'description':intUtil[_0x444a('0x3d')](_0xb5dc41[_0x444a('0x3f')],_0x34922f,'\x0a'),'regardingobjectid_contact@odata.bind':_0x444a('0x40')+_0x470974[_0x444a('0x29')]+')','ownerid@odata.bind':_0x444a('0x24')+_0x470974[_0x444a('0x1c')]+')','directioncode':_0x470974[_0x444a('0x43')]===_0x444a('0x44')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':'/systemusers('+_0x470974[_0x444a('0x1c')]+')','participationtypemask':_0x470974[_0x444a('0x43')]===_0x444a('0x44')?0x2:0x1},{'partyid_contact@odata.bind':_0x444a('0x40')+_0x470974[_0x444a('0x29')]+')','participationtypemask':_0x470974[_0x444a('0x43')]===_0x444a('0x44')?0x1:0x2}]},getCustomFields(_0xb5dc41[_0x444a('0x41')],_0x34922f,_0xb5dc41[_0x444a('0x3a')])),'headers':{'Authorization':_0x444a('0x2e')+_0x473826,'OData-Version':_0x444a('0x16')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x473652);})[_0x444a('0xf')](function(_0x431608){var _0x1786db=_0x431608[_0x444a('0x25')][_0x444a('0x26')];var _0x27c4c6=_0x1786db['substring'](_0x1786db['lastIndexOf']('(')+0x1,_0x1786db[_0x444a('0x28')](')'));_0x470974[_0x444a('0x45')]=_0x27c4c6;_0x3608d2(_0x470974);})[_0x444a('0x11')](function(_0x1d5fe1){_0x4b431b(_0x1d5fe1[_0x444a('0x15')]);});});}function emit(_0x45dda1,_0x46b672,_0x16717f,_0x2a6b14){var _0x1567aa={'uri':util[_0x444a('0x46')](_0x444a('0x47'),_0x45dda1,_0x16717f,_0x2a6b14)};io['to'](util[_0x444a('0x46')]('user:%s',_0x46b672))[_0x444a('0x48')](_0x444a('0x49'),_0x1567aa);}exports['cs']=function(_0x119ba7,_0x4cfd77,_0x285c6e,_0x3c5c13,_0x3a8a64,_0x56dd87,_0x252747,_0x594560){var _0x5618ca={};_0x56dd87['remoteUri']=intUtil[_0x444a('0x4a')](_0x56dd87['remoteUri']);_0x56dd87[_0x444a('0x4b')]=intUtil[_0x444a('0x4a')](_0x56dd87[_0x444a('0x4b')]);_0x5618ca[_0x444a('0x43')]=_0x594560===_0x444a('0x44')||_0x594560==='unmanaged'?'queue':_0x444a('0x20');var _0x3d068d=util[_0x444a('0x46')]('%s/api/data/v9.0/',_0x56dd87[_0x444a('0xc')]);var _0x58e0e9=util['format']('https://login.microsoftonline.com/%s/oauth2/token',_0x56dd87['tenantId']);var _0x4e0168=util[_0x444a('0x46')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x56dd87[_0x444a('0x4b')],_0x4cfd77['uniqueid'],md5(_0x4cfd77[_0x444a('0x4c')]));if(_0x3a8a64&&_0x3a8a64[_0x444a('0x4d')]){logger[_0x444a('0x1a')](_0x444a('0x4e'),'Recording\x20is\x20enabled!');_0x4cfd77[_0x444a('0x4f')]=_0x4e0168;}else if(_0x252747&&_0x252747[_0x444a('0x50')]&&_0x252747[_0x444a('0x50')]!==_0x444a('0x51')){logger[_0x444a('0x1a')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x4cfd77[_0x444a('0x4f')]=_0x4e0168;}else{_0x4cfd77[_0x444a('0x4f')]='';}return getUser(_0x5618ca,_0x56dd87,_0x3c5c13,_0x58e0e9,_0x3d068d,_0x594560)[_0x444a('0xf')](function(_0x37c962){logger[_0x444a('0x1a')]('['+_0x594560[_0x444a('0x13')]()+_0x444a('0x52'),_0x37c962[_0x444a('0x1c')]);logger['info']('['+_0x594560[_0x444a('0x13')]()+_0x444a('0x53'),_0x37c962[_0x444a('0x18')]);return getEndUser(_0x37c962,_0x56dd87,_0x58e0e9,_0x3d068d,_0x4cfd77,_0x594560);})[_0x444a('0xf')](function(_0x4b70f0){logger['info']('['+_0x594560['toUpperCase']()+_0x444a('0x54'),_0x4b70f0[_0x444a('0x29')]);logger['info']('['+_0x594560[_0x444a('0x13')]()+_0x444a('0x55'),_0x4cfd77[_0x444a('0x22')]);return getTicket(_0x4b70f0,_0x56dd87,_0x58e0e9,_0x3d068d,_0x4cfd77,_0x285c6e,_0x594560);})['then'](function(_0x639220){logger['info'](util[_0x444a('0x46')]('['+_0x594560[_0x444a('0x13')]()+_0x444a('0x56'),_0x285c6e[_0x444a('0x3a')],_0x639220['ticketId']));logger[_0x444a('0x1a')](util['format']('['+_0x594560[_0x444a('0x13')]()+']\x20Call\x20direction:\x20%s',_0x594560));if(_0x594560!=='unmanaged'){logger['info']('['+_0x594560[_0x444a('0x13')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x56dd87[_0x444a('0xc')],_0x3c5c13[_0x444a('0x57')],_0x285c6e[_0x444a('0x3a')],_0x639220[_0x444a('0x45')]);}})[_0x444a('0x11')](function(_0x5ba197){logger[_0x444a('0x12')]('['+_0x594560[_0x444a('0x13')]()+_0x444a('0x58'),util['inspect'](_0x5ba197,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/freshdesk.js b/server/services/ami/trigger/integration/freshdesk.js index 61ffcd7..b6520cd 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 _0x6413=['[HTTP]','stringify','GET','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','toString','idField','variable','variableName','push','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','calleridname','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','The\x20Enduser\x20ID\x20is:','unmanaged','lastevent','toUpperCase','request-promise','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','defaults','localhost','redis','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','Subjects','getString','Descriptions','
','name','Fields','custom_fields','mapValues','value','remoteUri','POST','then','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','%s/api/v2/contacts','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','base64','debug'];(function(_0x3ed4d7,_0x3783e0){var _0x2be1a4=function(_0x5d492f){while(--_0x5d492f){_0x3ed4d7['push'](_0x3ed4d7['shift']());}};_0x2be1a4(++_0x3783e0);}(_0x6413,0x155));var _0x3641=function(_0x303c33,_0x3b78fb){_0x303c33=_0x303c33-0x0;var _0x4e2322=_0x6413[_0x303c33];return _0x4e2322;};'use strict';var _=require('lodash');var rp=require(_0x3641('0x0'));var md5=require(_0x3641('0x1'));var util=require('util');var Redis=require(_0x3641('0x2'));var intUtil=require(_0x3641('0x3'));var config=require(_0x3641('0x4'));var logger=require(_0x3641('0x5'))(_0x3641('0x6'));config['redis']=_[_0x3641('0x7')](config['redis'],{'host':_0x3641('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3641('0x9')]));var headers={'Content-Type':_0x3641('0xa'),'Accept':'application/json'};function emit(_0x4e3155,_0xceede7,_0x16ecd1){io['to'](_0x4e3155)[_0x3641('0xb')](_0xceede7,_0x16ecd1);}function getTicket(_0x285c26,_0x18fa4a,_0xe9ccbf,_0x25f8b0,_0x368b48){logger[_0x3641('0xc')](_0x3641('0xd'));var _0x40fe89=_[_0x3641('0xe')]({'responder_id':_0x18fa4a['id'],'requester_id':_0xe9ccbf['id'],'name':util[_0x3641('0xf')](_0x3641('0x10'),_0x368b48['calleridname']),'phone':_0x368b48['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x25f8b0[_0x3641('0x11')],_0x368b48,'\x20'),'description':intUtil[_0x3641('0x12')](_0x25f8b0[_0x3641('0x13')],_0x368b48,_0x3641('0x14')),'tags':getTags(_0x25f8b0['Tags'],_0x3641('0x15'))},getCustomFields(_0x25f8b0[_0x3641('0x16')],_0x368b48));_0x40fe89[_0x3641('0x17')]=_[_0x3641('0x18')](_['keyBy'](_0x40fe89[_0x3641('0x17')],'id'),_0x3641('0x19'));return request({'uri':util[_0x3641('0xf')]('%s/api/v2/tickets',_0x285c26[_0x3641('0x1a')]),'method':_0x3641('0x1b'),'body':_0x40fe89})[_0x3641('0x1c')](function(_0x435a63){logger['info']('Ticket\x20created!');return _0x435a63;});}function getUser(_0x5ad896,_0x3b7e6b){if(intUtil[_0x3641('0x1d')](_0x3b7e6b)){return request({'uri':util[_0x3641('0xf')](_0x3641('0x1e'),_0x5ad896[_0x3641('0x1a')]),'qs':{'email':_0x3b7e6b}})['then'](function(_0x1c82d4){if(_0x1c82d4[_0x3641('0x1f')]){logger[_0x3641('0xc')](_0x3641('0x20'));return _[_0x3641('0x21')](_0x1c82d4,function(_0xd392b){return _0xd392b[_0x3641('0x22')][_0x3641('0x23')]===_0x3b7e6b;});}else{logger[_0x3641('0xc')](_0x3641('0x24'));return request({'uri':util[_0x3641('0xf')]('%s/api/v2/agents/me',_0x5ad896[_0x3641('0x1a')])})[_0x3641('0x1c')](function(_0x1aa228){logger[_0x3641('0xc')](_0x3641('0x25'));return _0x1aa228;});}});}else{logger['info'](_0x3641('0x26'));return request({'uri':util[_0x3641('0xf')](_0x3641('0x27'),_0x5ad896[_0x3641('0x1a')])})[_0x3641('0x1c')](function(_0x592d93){logger[_0x3641('0xc')]('Admin\x20account\x20selected.');return _0x592d93;});}}function getEndUser(_0x5e17bf,_0x173607,_0x51f5d9){logger['info']('Searching\x20enduser\x20with\x20phone',_0x51f5d9);return request({'uri':util[_0x3641('0xf')](_0x3641('0x28'),_0x5e17bf[_0x3641('0x1a')]),'qs':{'phone':_0x51f5d9}})['then'](function(_0x102e32){if(_0x102e32[_0x3641('0x1f')]){logger['info']('Enduser\x20found!');return _[_0x3641('0x21')](_0x102e32,{'phone':_0x51f5d9});}else{logger['info'](_0x3641('0x29'));return request({'uri':util['format'](_0x3641('0x28'),_0x5e17bf[_0x3641('0x1a')]),'method':_0x3641('0x1b'),'body':{'name':_0x173607,'phone':_0x51f5d9}})[_0x3641('0x1c')](function(_0x4c02a5){logger['info'](_0x3641('0x2a'));return _0x4c02a5;});}});}function getAuth(_0x4dcedc){return util[_0x3641('0xf')](_0x3641('0x2b'),new Buffer(_0x4dcedc[_0x3641('0x2c')]+':X')['toString'](_0x3641('0x2d')));}function request(_0x2e1643){logger[_0x3641('0x2e')](_0x3641('0x2f'),JSON[_0x3641('0x30')](_0x2e1643));return rp(_[_0x3641('0x7')](_0x2e1643,{'method':_0x3641('0x31'),'headers':headers,'json':!![]}));}function getTags(_0x4e4294,_0x2157ab){var _0x324af4=[];if(_0x4e4294&&_0x4e4294['length']>0x0){_0x324af4=_[_0x3641('0x32')](_0x4e4294,_0x2157ab);}return _0x324af4;}function getCustomFields(_0x38eb68,_0x57419a){var _0xbf48b0=[];var _0x234f34={'custom_fields':[]};if(_0x38eb68[_0x3641('0x1f')]>0x0){_[_0x3641('0x33')](_0x38eb68,function(_0x42fcff){if(_[_0x3641('0x34')]([_0x3641('0x35'),_0x3641('0x36')],_0x42fcff[_0x3641('0x37')])&&_0x42fcff[_0x3641('0x38')]&&!_0x42fcff[_0x3641('0x39')]){_0x234f34[_0x42fcff[_0x3641('0x38')][_0x3641('0x3a')]()]=_0x42fcff[_0x3641('0x3b')][_0x3641('0x3c')]();}else if(_[_0x3641('0x34')](['string',_0x3641('0x36')],_0x42fcff[_0x3641('0x37')])&&_0x42fcff[_0x3641('0x3d')]&&_0x42fcff[_0x3641('0x39')]){_0x234f34['custom_fields']['push']({'id':_0x42fcff[_0x3641('0x3d')],'value':_0x42fcff['content'][_0x3641('0x3c')]()});}else if(_0x42fcff['type']===_0x3641('0x3e')&&_0x42fcff['variableName']&&_0x42fcff[_0x3641('0x3d')]&&_0x42fcff[_0x3641('0x39')]){_0x57419a[_0x42fcff[_0x3641('0x3f')]]&&_0x234f34['custom_fields'][_0x3641('0x40')]({'id':_0x42fcff[_0x3641('0x3d')],'value':_0x57419a[_0x42fcff['variableName']]['toString']()});}else if(_0x42fcff[_0x3641('0x37')]===_0x3641('0x41')&&_0x42fcff[_0x3641('0x42')]&&_0x42fcff[_0x3641('0x42')][_0x3641('0x15')]&&_0x42fcff[_0x3641('0x3d')]&&_0x42fcff[_0x3641('0x39')]){_0x57419a[_0x42fcff['Variable'][_0x3641('0x15')][_0x3641('0x3a')]()]&&_0x234f34['custom_fields'][_0x3641('0x40')]({'id':_0x42fcff[_0x3641('0x3d')],'value':_0x57419a[_0x42fcff['Variable'][_0x3641('0x15')][_0x3641('0x3a')]()][_0x3641('0x3c')]()});}});}return _0x234f34;}exports[_0x3641('0x43')]=function(_0x1f86be,_0x59b89a,_0x4003d9,_0x4437fc,_0x1b2381,_0x31f89c){var _0x23661e,_0x2f83b6;_0x31f89c[_0x3641('0x1a')]=intUtil[_0x3641('0x44')](_0x31f89c[_0x3641('0x1a')]);_0x31f89c[_0x3641('0x45')]=intUtil[_0x3641('0x44')](_0x31f89c['serverUrl']);if(_0x1b2381&&_0x1b2381[_0x3641('0x46')]){logger[_0x3641('0xc')](_0x3641('0x47'),_0x3641('0x48'));_0x59b89a[_0x3641('0x49')]=util[_0x3641('0xf')](_0x3641('0x4a'),_0x31f89c[_0x3641('0x45')],_0x59b89a[_0x3641('0x4b')],md5(_0x59b89a[_0x3641('0x4b')]));}else{_0x59b89a[_0x3641('0x49')]='';}headers[_0x3641('0x4c')]=getAuth(_0x31f89c);return getUser(_0x31f89c,_0x4437fc[_0x3641('0x23')])['then'](function(_0x4c5d6c){_0x23661e=_0x4c5d6c;logger['info']('The\x20User\x20ID\x20is:',_0x23661e['id']);return getEndUser(_0x31f89c,_0x59b89a[_0x3641('0x4d')],_0x59b89a[_0x3641('0x4e')]);})['then'](function(_0x16ea63){_0x2f83b6=_0x16ea63;logger['info']('The\x20Enduser\x20ID\x20is:',_0x2f83b6['id']);return getTicket(_0x31f89c,_0x23661e,_0x2f83b6,_0x4003d9,_0x59b89a);})[_0x3641('0x1c')](function(_0x115f15){if(_0x115f15&&_0x115f15['id']){logger[_0x3641('0xc')](_0x3641('0x4f'));logger[_0x3641('0xc')](_0x3641('0x50'),_0x115f15['id']);logger[_0x3641('0xc')]('[QUEUE]',_0x3641('0x51'));emit(util[_0x3641('0xf')](_0x3641('0x52'),_0x4437fc['name']),_0x3641('0x53'),{'uri':util['format'](_0x3641('0x54'),_0x31f89c[_0x3641('0x1a')],_0x115f15['id'])});}})[_0x3641('0x55')](function(_0x34171b){logger[_0x3641('0x56')](_0x3641('0x47'),JSON[_0x3641('0x30')](_0x34171b));});};exports[_0x3641('0x57')]=function(_0x593f2f,_0x4e2723,_0x19f456,_0x1ea1a8,_0x2416be,_0x22d45a,_0x30561d){var _0x36e006,_0x46f3b7;_0x22d45a[_0x3641('0x1a')]=intUtil[_0x3641('0x44')](_0x22d45a[_0x3641('0x1a')]);_0x22d45a[_0x3641('0x45')]=intUtil[_0x3641('0x44')](_0x22d45a['serverUrl']);if(_0x30561d&&_0x30561d[_0x3641('0x58')]&&_0x30561d[_0x3641('0x58')]!==_0x3641('0x59')){logger[_0x3641('0xc')](_0x3641('0x5a'),'Recording\x20is\x20enabled!');_0x4e2723[_0x3641('0x49')]=util[_0x3641('0xf')](_0x3641('0x4a'),_0x22d45a[_0x3641('0x45')],_0x4e2723[_0x3641('0x4b')],md5(_0x4e2723[_0x3641('0x4b')]));}headers[_0x3641('0x4c')]=getAuth(_0x22d45a);return getUser(_0x22d45a,_0x1ea1a8[_0x3641('0x23')])[_0x3641('0x1c')](function(_0x26e79){_0x36e006=_0x26e79;logger[_0x3641('0xc')](_0x3641('0x5b'),_0x36e006['id']);return getEndUser(_0x22d45a,_0x4e2723[_0x3641('0x5c')],_0x4e2723['destcalleridnum']);})[_0x3641('0x1c')](function(_0x315e13){_0x46f3b7=_0x315e13;logger[_0x3641('0xc')](_0x3641('0x5d'),_0x46f3b7['id']);return getTicket(_0x22d45a,_0x36e006,_0x46f3b7,_0x19f456,_0x4e2723);})[_0x3641('0x1c')](function(_0x38b84d){if(_0x38b84d&&_0x38b84d['id']){logger['info']('Ticket\x20created!');logger[_0x3641('0xc')](_0x3641('0x50'),_0x38b84d['id']);logger[_0x3641('0xc')](_0x3641('0x5a'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x3641('0x52'),_0x1ea1a8['name']),_0x3641('0x53'),{'uri':util[_0x3641('0xf')](_0x3641('0x54'),_0x22d45a[_0x3641('0x1a')],_0x38b84d['id'])});}})['catch'](function(_0x342eda){logger[_0x3641('0x56')](_0x3641('0x5a'),JSON[_0x3641('0x30')](_0x342eda));});};exports[_0x3641('0x5e')]=function(_0x572c71,_0x32dd1e,_0x34179e,_0x39977c,_0x4689b6,_0x25aa1a){var _0x28698c,_0x55a915;_0x25aa1a['remoteUri']=intUtil['stripTrailingSlash'](_0x25aa1a['remoteUri']);_0x25aa1a[_0x3641('0x45')]=intUtil[_0x3641('0x44')](_0x25aa1a['serverUrl']);if(_0x4689b6&&_0x4689b6['monitor_format']){logger[_0x3641('0xc')]('['+_0x32dd1e[_0x3641('0x5f')]['toUpperCase']()+']',_0x3641('0x48'));_0x32dd1e['recordingURL']=util[_0x3641('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x25aa1a[_0x3641('0x45')],_0x32dd1e['uniqueid'],md5(_0x32dd1e[_0x3641('0x4b')]));}else{_0x32dd1e['recordingURL']='';}headers[_0x3641('0x4c')]=getAuth(_0x25aa1a);return getUser(_0x25aa1a,'')['then'](function(_0x3b6d8c){_0x28698c=_0x3b6d8c;logger[_0x3641('0xc')](_0x3641('0x5b'),_0x28698c['id']);return getEndUser(_0x25aa1a,_0x32dd1e[_0x3641('0x4d')],_0x32dd1e['calleridnum']);})[_0x3641('0x1c')](function(_0x53eb4a){_0x55a915=_0x53eb4a;logger['info']('The\x20Enduser\x20ID\x20is:',_0x55a915['id']);return getTicket(_0x25aa1a,_0x28698c,_0x55a915,_0x34179e,_0x32dd1e);})['then'](function(_0x901781){if(_0x901781){logger['info'](_0x3641('0x4f'));logger['info'](_0x3641('0x50'),_0x901781['id']);}})['catch'](function(_0x434c35){logger['error']('['+_0x32dd1e[_0x3641('0x5f')][_0x3641('0x60')]()+']',JSON[_0x3641('0x30')](_0x434c35));});}; \ No newline at end of file +var _0x322f=['map','string','picklist','type','nameField','customField','content','includes','idField','push','variable','variableName','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/helpdesk/tickets/%d','error','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridnum','Ticket\x20created!','user:%s','catch','monitor_format','lastevent','toUpperCase','lodash','request-promise','md5','ioredis','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','calleridname','calleridnum','getString','Subjects','
','Tags','name','Fields','custom_fields','mapValues','value','%s/api/v2/tickets','remoteUri','POST','then','validateEmail','%s/api/v2/agents','length','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','stringify','GET'];(function(_0x95d5b9,_0x4cc717){var _0x4b273b=function(_0x32aec4){while(--_0x32aec4){_0x95d5b9['push'](_0x95d5b9['shift']());}};_0x4b273b(++_0x4cc717);}(_0x322f,0x19a));var _0xf322=function(_0x348fa7,_0x36dda4){_0x348fa7=_0x348fa7-0x0;var _0x725ee=_0x322f[_0x348fa7];return _0x725ee;};'use strict';var _=require(_0xf322('0x0'));var rp=require(_0xf322('0x1'));var md5=require(_0xf322('0x2'));var util=require('util');var Redis=require(_0xf322('0x3'));var intUtil=require('./util');var config=require(_0xf322('0x4'));var logger=require(_0xf322('0x5'))(_0xf322('0x6'));config[_0xf322('0x7')]=_[_0xf322('0x8')](config['redis'],{'host':_0xf322('0x9'),'port':0x18eb});var io=require(_0xf322('0xa'))(new Redis(config[_0xf322('0x7')]));var headers={'Content-Type':_0xf322('0xb'),'Accept':'application/json'};function emit(_0xbda1ad,_0x39541a,_0x3dc052){io['to'](_0xbda1ad)[_0xf322('0xc')](_0x39541a,_0x3dc052);}function getTicket(_0x3082bc,_0x368cd0,_0xd9b9aa,_0x5a7c7b,_0x4384ec){logger[_0xf322('0xd')](_0xf322('0xe'));var _0x434260=_[_0xf322('0xf')]({'responder_id':_0x368cd0['id'],'requester_id':_0xd9b9aa['id'],'name':util[_0xf322('0x10')]('Caller\x20-\x20%s',_0x4384ec[_0xf322('0x11')]),'phone':_0x4384ec[_0xf322('0x12')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xf322('0x13')](_0x5a7c7b[_0xf322('0x14')],_0x4384ec,'\x20'),'description':intUtil[_0xf322('0x13')](_0x5a7c7b['Descriptions'],_0x4384ec,_0xf322('0x15')),'tags':getTags(_0x5a7c7b[_0xf322('0x16')],_0xf322('0x17'))},getCustomFields(_0x5a7c7b[_0xf322('0x18')],_0x4384ec));_0x434260[_0xf322('0x19')]=_[_0xf322('0x1a')](_['keyBy'](_0x434260[_0xf322('0x19')],'id'),_0xf322('0x1b'));return request({'uri':util['format'](_0xf322('0x1c'),_0x3082bc[_0xf322('0x1d')]),'method':_0xf322('0x1e'),'body':_0x434260})[_0xf322('0x1f')](function(_0x1a6e00){logger[_0xf322('0xd')]('Ticket\x20created!');return _0x1a6e00;});}function getUser(_0x3184da,_0x24edac){if(intUtil[_0xf322('0x20')](_0x24edac)){return request({'uri':util[_0xf322('0x10')](_0xf322('0x21'),_0x3184da['remoteUri']),'qs':{'email':_0x24edac}})[_0xf322('0x1f')](function(_0xef4063){if(_0xef4063[_0xf322('0x22')]){logger[_0xf322('0xd')]('Agent\x20found!');return _[_0xf322('0x23')](_0xef4063,function(_0x1810dc){return _0x1810dc[_0xf322('0x24')][_0xf322('0x25')]===_0x24edac;});}else{logger['info'](_0xf322('0x26'));return request({'uri':util[_0xf322('0x10')](_0xf322('0x27'),_0x3184da['remoteUri'])})[_0xf322('0x1f')](function(_0x57afed){logger['info'](_0xf322('0x28'));return _0x57afed;});}});}else{logger[_0xf322('0xd')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xf322('0x10')](_0xf322('0x27'),_0x3184da[_0xf322('0x1d')])})[_0xf322('0x1f')](function(_0x421456){logger[_0xf322('0xd')](_0xf322('0x28'));return _0x421456;});}}function getEndUser(_0x310e7d,_0x26373f,_0x13f6f6){logger['info'](_0xf322('0x29'),_0x13f6f6);return request({'uri':util[_0xf322('0x10')](_0xf322('0x2a'),_0x310e7d[_0xf322('0x1d')]),'qs':{'phone':_0x13f6f6}})[_0xf322('0x1f')](function(_0x453225){if(_0x453225[_0xf322('0x22')]){logger[_0xf322('0xd')]('Enduser\x20found!');return _[_0xf322('0x23')](_0x453225,{'phone':_0x13f6f6});}else{logger['info'](_0xf322('0x2b'));return request({'uri':util[_0xf322('0x10')](_0xf322('0x2a'),_0x310e7d[_0xf322('0x1d')]),'method':_0xf322('0x1e'),'body':{'name':_0x26373f,'phone':_0x13f6f6}})['then'](function(_0x411920){logger[_0xf322('0xd')](_0xf322('0x2c'));return _0x411920;});}});}function getAuth(_0x422263){return util[_0xf322('0x10')](_0xf322('0x2d'),new Buffer(_0x422263[_0xf322('0x2e')]+':X')[_0xf322('0x2f')]('base64'));}function request(_0x30bf09){logger['debug']('[HTTP]',JSON[_0xf322('0x30')](_0x30bf09));return rp(_[_0xf322('0x8')](_0x30bf09,{'method':_0xf322('0x31'),'headers':headers,'json':!![]}));}function getTags(_0x3520ea,_0x3bd1fd){var _0x3bff0f=[];if(_0x3520ea&&_0x3520ea['length']>0x0){_0x3bff0f=_[_0xf322('0x32')](_0x3520ea,_0x3bd1fd);}return _0x3bff0f;}function getCustomFields(_0xc31c77,_0xe3bf36){var _0x1220eb=[];var _0x53be0c={'custom_fields':[]};if(_0xc31c77['length']>0x0){_['forEach'](_0xc31c77,function(_0x95999c){if(_['includes']([_0xf322('0x33'),_0xf322('0x34')],_0x95999c[_0xf322('0x35')])&&_0x95999c[_0xf322('0x36')]&&!_0x95999c[_0xf322('0x37')]){_0x53be0c[_0x95999c['nameField']['toLowerCase']()]=_0x95999c[_0xf322('0x38')]['toString']();}else if(_[_0xf322('0x39')]([_0xf322('0x33'),_0xf322('0x34')],_0x95999c['type'])&&_0x95999c[_0xf322('0x3a')]&&_0x95999c['customField']){_0x53be0c['custom_fields'][_0xf322('0x3b')]({'id':_0x95999c[_0xf322('0x3a')],'value':_0x95999c['content'][_0xf322('0x2f')]()});}else if(_0x95999c[_0xf322('0x35')]===_0xf322('0x3c')&&_0x95999c[_0xf322('0x3d')]&&_0x95999c['idField']&&_0x95999c[_0xf322('0x37')]){_0xe3bf36[_0x95999c[_0xf322('0x3d')]]&&_0x53be0c['custom_fields']['push']({'id':_0x95999c[_0xf322('0x3a')],'value':_0xe3bf36[_0x95999c['variableName']][_0xf322('0x2f')]()});}else if(_0x95999c[_0xf322('0x35')]===_0xf322('0x3e')&&_0x95999c[_0xf322('0x3f')]&&_0x95999c[_0xf322('0x3f')]['name']&&_0x95999c[_0xf322('0x3a')]&&_0x95999c[_0xf322('0x37')]){_0xe3bf36[_0x95999c['Variable'][_0xf322('0x17')]['toLowerCase']()]&&_0x53be0c[_0xf322('0x19')][_0xf322('0x3b')]({'id':_0x95999c['idField'],'value':_0xe3bf36[_0x95999c[_0xf322('0x3f')]['name'][_0xf322('0x40')]()][_0xf322('0x2f')]()});}});}return _0x53be0c;}exports[_0xf322('0x41')]=function(_0x42910f,_0x1c1dd7,_0x595ddd,_0x10f541,_0x23ed00,_0x4f03a6){var _0x440b46,_0x56e514;_0x4f03a6[_0xf322('0x1d')]=intUtil[_0xf322('0x42')](_0x4f03a6[_0xf322('0x1d')]);_0x4f03a6['serverUrl']=intUtil[_0xf322('0x42')](_0x4f03a6[_0xf322('0x43')]);if(_0x23ed00&&_0x23ed00['monitor_format']){logger[_0xf322('0xd')](_0xf322('0x44'),_0xf322('0x45'));_0x1c1dd7[_0xf322('0x46')]=util[_0xf322('0x10')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4f03a6[_0xf322('0x43')],_0x1c1dd7[_0xf322('0x47')],md5(_0x1c1dd7[_0xf322('0x47')]));}else{_0x1c1dd7[_0xf322('0x46')]='';}headers[_0xf322('0x48')]=getAuth(_0x4f03a6);return getUser(_0x4f03a6,_0x10f541[_0xf322('0x25')])[_0xf322('0x1f')](function(_0xba7169){_0x440b46=_0xba7169;logger[_0xf322('0xd')](_0xf322('0x49'),_0x440b46['id']);return getEndUser(_0x4f03a6,_0x1c1dd7['calleridname'],_0x1c1dd7[_0xf322('0x12')]);})[_0xf322('0x1f')](function(_0x54e540){_0x56e514=_0x54e540;logger[_0xf322('0xd')](_0xf322('0x4a'),_0x56e514['id']);return getTicket(_0x4f03a6,_0x440b46,_0x56e514,_0x595ddd,_0x1c1dd7);})[_0xf322('0x1f')](function(_0x473163){if(_0x473163&&_0x473163['id']){logger[_0xf322('0xd')]('Ticket\x20created!');logger[_0xf322('0xd')](_0xf322('0x4b'),_0x473163['id']);logger[_0xf322('0xd')](_0xf322('0x44'),_0xf322('0x4c'));emit(util[_0xf322('0x10')]('user:%s',_0x10f541[_0xf322('0x17')]),_0xf322('0x4d'),{'uri':util['format'](_0xf322('0x4e'),_0x4f03a6[_0xf322('0x1d')],_0x473163['id'])});}})['catch'](function(_0x5d1b79){logger[_0xf322('0x4f')](_0xf322('0x44'),JSON['stringify'](_0x5d1b79));});};exports[_0xf322('0x50')]=function(_0x147fc1,_0x5c925f,_0x202bfe,_0x118070,_0x457f2b,_0x5aa055,_0x1e5666){var _0x4322d6,_0x1b3539;_0x5aa055[_0xf322('0x1d')]=intUtil[_0xf322('0x42')](_0x5aa055[_0xf322('0x1d')]);_0x5aa055[_0xf322('0x43')]=intUtil[_0xf322('0x42')](_0x5aa055[_0xf322('0x43')]);if(_0x1e5666&&_0x1e5666[_0xf322('0x51')]&&_0x1e5666[_0xf322('0x51')]!==_0xf322('0x52')){logger['info'](_0xf322('0x53'),'Recording\x20is\x20enabled!');_0x5c925f['recordingURL']=util['format'](_0xf322('0x54'),_0x5aa055[_0xf322('0x43')],_0x5c925f[_0xf322('0x47')],md5(_0x5c925f[_0xf322('0x47')]));}headers['Authorization']=getAuth(_0x5aa055);return getUser(_0x5aa055,_0x118070[_0xf322('0x25')])['then'](function(_0x3d485f){_0x4322d6=_0x3d485f;logger[_0xf322('0xd')](_0xf322('0x49'),_0x4322d6['id']);return getEndUser(_0x5aa055,_0x5c925f['destcalleridname'],_0x5c925f[_0xf322('0x55')]);})[_0xf322('0x1f')](function(_0x4fecda){_0x1b3539=_0x4fecda;logger[_0xf322('0xd')](_0xf322('0x4a'),_0x1b3539['id']);return getTicket(_0x5aa055,_0x4322d6,_0x1b3539,_0x202bfe,_0x5c925f);})[_0xf322('0x1f')](function(_0x55d3a0){if(_0x55d3a0&&_0x55d3a0['id']){logger['info'](_0xf322('0x56'));logger['info'](_0xf322('0x4b'),_0x55d3a0['id']);logger[_0xf322('0xd')](_0xf322('0x53'),_0xf322('0x4c'));emit(util[_0xf322('0x10')](_0xf322('0x57'),_0x118070['name']),'trigger:browser:url',{'uri':util[_0xf322('0x10')](_0xf322('0x4e'),_0x5aa055[_0xf322('0x1d')],_0x55d3a0['id'])});}})[_0xf322('0x58')](function(_0x2c9ce0){logger[_0xf322('0x4f')](_0xf322('0x53'),JSON[_0xf322('0x30')](_0x2c9ce0));});};exports['unmanaged']=function(_0x3bd374,_0x31f7a4,_0x5f4600,_0x2921ed,_0x5d095c,_0x37314d){var _0x5cbc3e,_0xcaa681;_0x37314d[_0xf322('0x1d')]=intUtil[_0xf322('0x42')](_0x37314d[_0xf322('0x1d')]);_0x37314d[_0xf322('0x43')]=intUtil[_0xf322('0x42')](_0x37314d[_0xf322('0x43')]);if(_0x5d095c&&_0x5d095c[_0xf322('0x59')]){logger[_0xf322('0xd')]('['+_0x31f7a4[_0xf322('0x5a')][_0xf322('0x5b')]()+']',_0xf322('0x45'));_0x31f7a4[_0xf322('0x46')]=util[_0xf322('0x10')](_0xf322('0x54'),_0x37314d[_0xf322('0x43')],_0x31f7a4[_0xf322('0x47')],md5(_0x31f7a4['uniqueid']));}else{_0x31f7a4['recordingURL']='';}headers[_0xf322('0x48')]=getAuth(_0x37314d);return getUser(_0x37314d,'')[_0xf322('0x1f')](function(_0x2c5572){_0x5cbc3e=_0x2c5572;logger[_0xf322('0xd')](_0xf322('0x49'),_0x5cbc3e['id']);return getEndUser(_0x37314d,_0x31f7a4[_0xf322('0x11')],_0x31f7a4[_0xf322('0x12')]);})[_0xf322('0x1f')](function(_0x106d3e){_0xcaa681=_0x106d3e;logger[_0xf322('0xd')](_0xf322('0x4a'),_0xcaa681['id']);return getTicket(_0x37314d,_0x5cbc3e,_0xcaa681,_0x5f4600,_0x31f7a4);})[_0xf322('0x1f')](function(_0x5c09f3){if(_0x5c09f3){logger['info'](_0xf322('0x56'));logger[_0xf322('0xd')](_0xf322('0x4b'),_0x5c09f3['id']);}})[_0xf322('0x58')](function(_0x2f188c){logger['error']('['+_0x31f7a4[_0xf322('0x5a')][_0xf322('0x5b')]()+']',JSON['stringify'](_0x2f188c));});}; \ 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 1f7f525..1882a41 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 _0x032e=['Admin\x20selected','toUpperCase','/api/lookup?q=','&f=','&entities=contact','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','Contact\x20found\x20mobile_number:','work_number','endUserId','Contact\x20found\x20work_number:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Creating\x20new\x20task','/api/tasks','Subjects','getString','Descriptions','Contact','ticketId','Task\x20created:','/contacts/','user:%s','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','request-promise','moment','bluebird','./util','freshsales','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','users','length','email','adminEmail','adminId','Requested\x20Resource\x20not\x20Found','catch','error','message','then','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:'];(function(_0x21a9d1,_0x21d35b){var _0x12cd7f=function(_0x56d542){while(--_0x56d542){_0x21a9d1['push'](_0x21a9d1['shift']());}};_0x12cd7f(++_0x21d35b);}(_0x032e,0xd7));var _0xe032=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x032e[_0x2b5eae];return _0x5f3ac9;};'use strict';var _=require('lodash');var rp=require(_0xe032('0x0'));var md5=require('md5');var util=require('util');var moment=require(_0xe032('0x1'));var Promise=require(_0xe032('0x2'));var Redis=require('ioredis');var intUtil=require(_0xe032('0x3'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xe032('0x4'));config[_0xe032('0x5')]=_[_0xe032('0x6')](config[_0xe032('0x5')],{'host':_0xe032('0x7'),'port':0x18eb});var io=require(_0xe032('0x8'))(new Redis(config[_0xe032('0x5')]));function getAdminId(_0x3b4a6a,_0x5adcf7,_0x41da34,_0x120810){return new Promise(function(_0x4c0553,_0x2523e1){var _0x112736=![];var _0x487387={'method':_0xe032('0x9'),'uri':_0x120810+_0xe032('0xa'),'json':!![]};_0x487387[_0xe032('0xb')]=_0x41da34;logger[_0xe032('0xc')]('Getting\x20admin\x20information');return rp(_0x487387)['then'](function(_0xfe438){if(_0xfe438){var _0x3bdb11=_0xfe438[_0xe032('0xd')];var _0xd9d5ed=null;for(_0xd9d5ed=0x0;_0xd9d5ed<_0x3bdb11[_0xe032('0xe')];_0xd9d5ed++){if(_0x3bdb11[_0xd9d5ed][_0xe032('0xf')]===_0x3b4a6a[_0xe032('0x10')]){_0x3b4a6a[_0xe032('0x11')]=_0x3bdb11[_0xd9d5ed]['id'];_0x112736=!![];}}if(_0x112736){logger[_0xe032('0xc')]('Admin\x20found:',_0x3b4a6a[_0xe032('0x11')]);_0x4c0553(_0x3b4a6a);}else{_0x2523e1({'statusCode':0x194,'message':_0xe032('0x12')});}}else{_0x2523e1({'statusCode':0x194,'message':_0xe032('0x12')});}})[_0xe032('0x13')](function(_0x4c7f6d){logger[_0xe032('0x14')]('['+[_0x5adcf7['toUpperCase']()]+']',_0x4c7f6d[_0xe032('0x15')]);_0x2523e1(_0x4c7f6d);});});}function getUser(_0x38526c,_0x2993c2,_0x30809c){return function(_0x241a7a){return new Promise(function(_0x4beaf4,_0x218bf0){var _0x14c768={'method':_0xe032('0x9'),'uri':_0x30809c+_0xe032('0xa'),'json':!![]};_0x14c768[_0xe032('0xb')]=_0x2993c2;logger[_0xe032('0xc')]('Getting\x20user\x20list');return rp(_0x14c768)[_0xe032('0x16')](function(_0x424cce){if(_0x424cce){var _0x287eb5=_0x424cce['users'];var _0x5ebc91=![];var _0x392de3=null;if(_0x241a7a[_0xe032('0x17')]!==null){logger[_0xe032('0xc')](_0xe032('0x18'),_0x241a7a[_0xe032('0x17')]);_0x241a7a[_0xe032('0x19')]=_0x241a7a[_0xe032('0x17')];for(_0x392de3=0x0;_0x392de3<_0x287eb5[_0xe032('0xe')];_0x392de3++){if(_0x287eb5[_0x392de3][_0xe032('0xf')]===_0x241a7a['agentEmail']){_0x5ebc91=!![];_0x241a7a[_0xe032('0x1a')]=_0x287eb5[_0x392de3]['id'];logger['info'](_0xe032('0x1b'),_0x241a7a[_0xe032('0x1a')]);}}}if(!_0x5ebc91){logger[_0xe032('0xc')](_0xe032('0x1c'));_0x241a7a[_0xe032('0x19')]=_0x241a7a[_0xe032('0x10')];_0x241a7a[_0xe032('0x1a')]=_0x241a7a[_0xe032('0x11')];_0x5ebc91=!![];}if(_0x5ebc91){_0x4beaf4(_0x241a7a);}else{_0x218bf0({'statusCode':0x194,'message':_0xe032('0x12')});}}else{_0x218bf0({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})['catch'](function(_0x145f46){logger['error']('['+[_0x38526c[_0xe032('0x1d')]()]+']',_0x145f46['message']);_0x218bf0(_0x145f46);});});};}function searchContact(_0x1b4328,_0x1b6a46,_0x59720a,_0x386576){return new Promise(function(_0x4385e1,_0x5855bc){var _0x123e09={'method':'GET','headers':_0x1b6a46,'uri':_0x1b4328+_0xe032('0x1e')+_0x386576+_0xe032('0x1f')+_0x59720a+_0xe032('0x20'),'json':!![]};rp(_0x123e09)[_0xe032('0x16')](function(_0x455219){var _0x17091f=_['find'](_0x455219[_0xe032('0x21')][_0xe032('0x21')],[_0x59720a,_0x386576]);_0x4385e1(_0x17091f);})[_0xe032('0x13')](function(_0x4ef51b){_0x5855bc(_0x4ef51b);});});}function getEndUser(_0x3f7d39,_0x2ffd63,_0x5b49c7){return function(_0x49ebc4){return new Promise(function(_0x153ea2,_0x568f3b){logger['info'](util[_0xe032('0x22')](_0xe032('0x23'),_0x49ebc4[_0xe032('0x24')]));searchContact(_0x5b49c7,_0x2ffd63,_0xe032('0x25'),_0x49ebc4['contactNumber'])[_0xe032('0x16')](function(_0x16cd35){if(_0x16cd35){_0x49ebc4['endUserId']=_0x16cd35['id'];logger[_0xe032('0xc')](_0xe032('0x26'),_0x49ebc4['endUserId']);return _0x153ea2(_0x49ebc4);}searchContact(_0x5b49c7,_0x2ffd63,_0xe032('0x27'),_0x49ebc4[_0xe032('0x24')])[_0xe032('0x16')](function(_0xbf6f14){if(_0xbf6f14){_0x49ebc4[_0xe032('0x28')]=_0xbf6f14['id'];logger[_0xe032('0xc')](_0xe032('0x29'),_0x49ebc4['endUserId']);return _0x153ea2(_0x49ebc4);}createEndUser(_0x49ebc4,_0x3f7d39,_0x2ffd63,_0x5b49c7)[_0xe032('0x16')](function(_0x34b37d){logger[_0xe032('0xc')]('Contact\x20created:',_0x34b37d[_0xe032('0x28')]);return _0x153ea2(_0x34b37d);});});})[_0xe032('0x13')](function(_0x263a4f){_0x568f3b(_0x263a4f);});});};}function createEndUser(_0x195da5,_0xc7ed71,_0x96accf,_0x311589){return new Promise(function(_0x4ecef7,_0x3872f2){var _0x187ee5=moment();var _0x16b773={'method':_0xe032('0x2a'),'uri':_0x311589+_0xe032('0x2b'),'body':{'contact':{'last_name':_0x195da5[_0xe032('0x24')],'work_number':_0x195da5['contactNumber'],'mobile_number':_0x195da5[_0xe032('0x24')],'owner_id':_0x195da5['userId'],'created_at':_0x187ee5[_0xe032('0x22')](_0xe032('0x2c'))}},'json':!![]};_0x16b773[_0xe032('0xb')]=_0x96accf;logger[_0xe032('0xc')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x16b773)[_0xe032('0x16')](function(_0x40cd17){_0x195da5[_0xe032('0x28')]=_0x40cd17['contact']['id'];_0x4ecef7(_0x195da5);})[_0xe032('0x13')](function(_0xe5d252){logger['error']('['+[_0xc7ed71[_0xe032('0x1d')]()]+']',_0xe5d252[_0xe032('0x15')]);_0x3872f2(_0xe5d252[_0xe032('0x15')]);});});}function getTicket(_0x5674a8,_0x1afd95,_0x543f02,_0x2f3e6d,_0x1ac602){return function(_0x3d3a8b){logger[_0xe032('0xc')](_0xe032('0x2d'));return new Promise(function(_0xafdd75,_0x307020){var _0x57fc6c=moment();var _0x357eac={'method':_0xe032('0x2a'),'uri':_0x543f02+_0xe032('0x2e'),'body':{'title':intUtil['getString'](_0x2f3e6d[_0xe032('0x2f')],_0x1ac602,'\x20'),'description':intUtil[_0xe032('0x30')](_0x2f3e6d[_0xe032('0x31')],_0x1ac602,'\x0a'),'owner_id':_0x3d3a8b['userId'],'creater_id':_0x3d3a8b[_0xe032('0x11')],'targetable_id':_0x3d3a8b[_0xe032('0x28')],'targetable_type':_0xe032('0x32'),'created_at':_0x57fc6c[_0xe032('0x22')](_0xe032('0x2c')),'due_date':_0x57fc6c['add'](0x1e,'m')['format'](_0xe032('0x2c'))},'json':!![]};_0x357eac['headers']=_0x1afd95;return rp(_0x357eac)['then'](function(_0x569307){_0x3d3a8b[_0xe032('0x33')]=_0x569307['task']['id'];logger[_0xe032('0xc')](_0xe032('0x34'),_0x3d3a8b['ticketId']);_0xafdd75(_0x3d3a8b);})[_0xe032('0x13')](function(_0xb7b842){logger['error']('['+[_0x5674a8[_0xe032('0x1d')]()]+']',_0xb7b842[_0xe032('0x15')]);_0x307020(_0xb7b842[_0xe032('0x15')]);});});};}function emit(_0x4d2d3d,_0x24708e,_0x4db1a9){var _0x16e678={'uri':_0x4d2d3d+_0xe032('0x35')+_0x4db1a9};io['to'](util[_0xe032('0x22')](_0xe032('0x36'),_0x24708e))['emit'](_0xe032('0x37'),_0x16e678);}exports['cs']=function(_0x59fc34,_0x56a799,_0x361962,_0x1973ea,_0x7abdc5,_0x3d27fe,_0x8f1f3c,_0x3ffa74){var _0xbdb445={};var _0x3836c2={'Authorization':_0xe032('0x38')+_0x3d27fe[_0xe032('0x39')]};_0x3d27fe[_0xe032('0x3a')]=intUtil['stripTrailingSlash'](_0x3d27fe[_0xe032('0x3a')]);_0x3d27fe['serverUrl']=intUtil[_0xe032('0x3b')](_0x3d27fe[_0xe032('0x3c')]);var _0x5b472a=_0x3d27fe['remoteUri'];_0xbdb445[_0xe032('0x10')]=_0x3d27fe[_0xe032('0x3d')];_0xbdb445[_0xe032('0x24')]=_0x3ffa74[_0xe032('0x3e')]()===_0xe032('0x3f')?_0x56a799[_0xe032('0x40')]:_0x56a799[_0xe032('0x41')];_0xbdb445[_0xe032('0x42')]=_0x3ffa74===_0xe032('0x43')||_0x3ffa74===_0xe032('0x44')?_0xe032('0x43'):'outbound';if(_0x1973ea){_0xbdb445[_0xe032('0x17')]=_0x1973ea['email'];}var _0x1c930a=util[_0xe032('0x22')](_0xe032('0x45'),_0x3d27fe[_0xe032('0x3c')],_0x56a799[_0xe032('0x46')],md5(_0x56a799[_0xe032('0x46')]));if(_0x7abdc5&&_0x7abdc5['monitor_format']){logger[_0xe032('0xc')]('[QUEUE]',_0xe032('0x47'));_0x56a799[_0xe032('0x48')]=_0x1c930a;}else if(_0x8f1f3c&&_0x8f1f3c[_0xe032('0x49')]&&_0x8f1f3c['recordingFormat']!==_0xe032('0x4a')){logger[_0xe032('0xc')](_0xe032('0x4b'),_0xe032('0x47'));_0x56a799[_0xe032('0x48')]=_0x1c930a;}else{_0x56a799[_0xe032('0x48')]='';}return getAdminId(_0xbdb445,_0x3ffa74,_0x3836c2,_0x5b472a)['then'](getUser(_0x3ffa74,_0x3836c2,_0x5b472a))[_0xe032('0x16')](getEndUser(_0x3ffa74,_0x3836c2,_0x5b472a))[_0xe032('0x16')](getTicket(_0x3ffa74,_0x3836c2,_0x5b472a,_0x361962,_0x56a799))[_0xe032('0x16')](function(_0x49c712){logger['info'](util['format'](_0xe032('0x4c'),_0x49c712['ticketId']));if(_0x3ffa74!==_0xe032('0x44')){logger[_0xe032('0xc')]('['+[_0x3ffa74[_0xe032('0x1d')]()]+']',_0xe032('0x4d'));emit(_0x5b472a,_0x1973ea[_0xe032('0x4e')],_0x49c712[_0xe032('0x28')]);}})['catch'](function(_0x32ce25){logger[_0xe032('0x14')]('['+[_0x3ffa74['toUpperCase']()]+_0xe032('0x4f'),util[_0xe032('0x50')](_0x32ce25,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x9264=['queue','unmanaged','uniqueid','[QUEUE]','recordingFormat','none','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','request-promise','util','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','email','adminEmail','Admin\x20found:','adminId','Requested\x20Resource\x20not\x20Found','catch','toUpperCase','message','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','error','/api/lookup?q=','&f=','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','/api/tasks','Subjects','getString','Descriptions','Contact','YYYY-MM-DDTHH:mm:ss','add','ticketId','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','destcalleridnum','callDirection'];(function(_0x24628e,_0x2bbd98){var _0x98fa2c=function(_0x2e37c5){while(--_0x2e37c5){_0x24628e['push'](_0x24628e['shift']());}};_0x98fa2c(++_0x2bbd98);}(_0x9264,0xb5));var _0x4926=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9264[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var rp=require(_0x4926('0x0'));var md5=require('md5');var util=require(_0x4926('0x1'));var moment=require('moment');var Promise=require(_0x4926('0x2'));var Redis=require(_0x4926('0x3'));var intUtil=require(_0x4926('0x4'));var config=require(_0x4926('0x5'));var logger=require(_0x4926('0x6'))(_0x4926('0x7'));config[_0x4926('0x8')]=_[_0x4926('0x9')](config[_0x4926('0x8')],{'host':_0x4926('0xa'),'port':0x18eb});var io=require(_0x4926('0xb'))(new Redis(config['redis']));function getAdminId(_0x57a579,_0x2f097e,_0xe60eb8,_0x36c26b){return new Promise(function(_0x3c5adc,_0x1912c9){var _0x3f0db9=![];var _0x493f5c={'method':_0x4926('0xc'),'uri':_0x36c26b+_0x4926('0xd'),'json':!![]};_0x493f5c[_0x4926('0xe')]=_0xe60eb8;logger[_0x4926('0xf')](_0x4926('0x10'));return rp(_0x493f5c)[_0x4926('0x11')](function(_0x1a4017){if(_0x1a4017){var _0x1d34dd=_0x1a4017[_0x4926('0x12')];var _0x3f9a5d=null;for(_0x3f9a5d=0x0;_0x3f9a5d<_0x1d34dd[_0x4926('0x13')];_0x3f9a5d++){if(_0x1d34dd[_0x3f9a5d][_0x4926('0x14')]===_0x57a579[_0x4926('0x15')]){_0x57a579['adminId']=_0x1d34dd[_0x3f9a5d]['id'];_0x3f0db9=!![];}}if(_0x3f0db9){logger['info'](_0x4926('0x16'),_0x57a579[_0x4926('0x17')]);_0x3c5adc(_0x57a579);}else{_0x1912c9({'statusCode':0x194,'message':_0x4926('0x18')});}}else{_0x1912c9({'statusCode':0x194,'message':_0x4926('0x18')});}})[_0x4926('0x19')](function(_0x407fcb){logger['error']('['+[_0x2f097e[_0x4926('0x1a')]()]+']',_0x407fcb[_0x4926('0x1b')]);_0x1912c9(_0x407fcb);});});}function getUser(_0x4d9d19,_0x4b2b84,_0x4c62ed){return function(_0x4e34bb){return new Promise(function(_0x17bc17,_0xd7c221){var _0x1dd85e={'method':_0x4926('0xc'),'uri':_0x4c62ed+_0x4926('0xd'),'json':!![]};_0x1dd85e[_0x4926('0xe')]=_0x4b2b84;logger[_0x4926('0xf')](_0x4926('0x1c'));return rp(_0x1dd85e)[_0x4926('0x11')](function(_0x157a98){if(_0x157a98){var _0x38f62a=_0x157a98[_0x4926('0x12')];var _0x81d215=![];var _0x4ea7e5=null;if(_0x4e34bb[_0x4926('0x1d')]!==null){logger[_0x4926('0xf')](_0x4926('0x1e'),_0x4e34bb[_0x4926('0x1d')]);_0x4e34bb[_0x4926('0x1f')]=_0x4e34bb['agentEmail'];for(_0x4ea7e5=0x0;_0x4ea7e5<_0x38f62a[_0x4926('0x13')];_0x4ea7e5++){if(_0x38f62a[_0x4ea7e5][_0x4926('0x14')]===_0x4e34bb['agentEmail']){_0x81d215=!![];_0x4e34bb[_0x4926('0x20')]=_0x38f62a[_0x4ea7e5]['id'];logger['info'](_0x4926('0x21'),_0x4e34bb[_0x4926('0x20')]);}}}if(!_0x81d215){logger['info']('Admin\x20selected');_0x4e34bb['userEmail']=_0x4e34bb[_0x4926('0x15')];_0x4e34bb[_0x4926('0x20')]=_0x4e34bb['adminId'];_0x81d215=!![];}if(_0x81d215){_0x17bc17(_0x4e34bb);}else{_0xd7c221({'statusCode':0x194,'message':_0x4926('0x18')});}}else{_0xd7c221({'statusCode':0x194,'message':_0x4926('0x18')});}})['catch'](function(_0x32a00e){logger[_0x4926('0x22')]('['+[_0x4d9d19[_0x4926('0x1a')]()]+']',_0x32a00e[_0x4926('0x1b')]);_0xd7c221(_0x32a00e);});});};}function searchContact(_0xdf1c7b,_0x5c88d4,_0x2e2822,_0x56bf6c){return new Promise(function(_0xf9026b,_0x23a051){var _0x2be8b6={'method':'GET','headers':_0x5c88d4,'uri':_0xdf1c7b+_0x4926('0x23')+_0x56bf6c+_0x4926('0x24')+_0x2e2822+'&entities=contact','json':!![]};rp(_0x2be8b6)['then'](function(_0x247c12){var _0x3f38bc=_['find'](_0x247c12[_0x4926('0x25')][_0x4926('0x25')],[_0x2e2822,_0x56bf6c]);_0xf9026b(_0x3f38bc);})[_0x4926('0x19')](function(_0xf3c7c7){_0x23a051(_0xf3c7c7);});});}function getEndUser(_0x4f6d5d,_0x21e425,_0x519cdb){return function(_0x60a33f){return new Promise(function(_0x47c212,_0x3821d9){logger[_0x4926('0xf')](util[_0x4926('0x26')](_0x4926('0x27'),_0x60a33f[_0x4926('0x28')]));searchContact(_0x519cdb,_0x21e425,_0x4926('0x29'),_0x60a33f[_0x4926('0x28')])[_0x4926('0x11')](function(_0x4aae0a){if(_0x4aae0a){_0x60a33f[_0x4926('0x2a')]=_0x4aae0a['id'];logger[_0x4926('0xf')](_0x4926('0x2b'),_0x60a33f[_0x4926('0x2a')]);return _0x47c212(_0x60a33f);}searchContact(_0x519cdb,_0x21e425,_0x4926('0x2c'),_0x60a33f[_0x4926('0x28')])[_0x4926('0x11')](function(_0x7afbef){if(_0x7afbef){_0x60a33f['endUserId']=_0x7afbef['id'];logger['info'](_0x4926('0x2d'),_0x60a33f['endUserId']);return _0x47c212(_0x60a33f);}createEndUser(_0x60a33f,_0x4f6d5d,_0x21e425,_0x519cdb)['then'](function(_0x14cdee){logger[_0x4926('0xf')](_0x4926('0x2e'),_0x14cdee[_0x4926('0x2a')]);return _0x47c212(_0x14cdee);});});})[_0x4926('0x19')](function(_0x1247ed){_0x3821d9(_0x1247ed);});});};}function createEndUser(_0x28d213,_0x1dce16,_0x595d9b,_0x367333){return new Promise(function(_0x3f7947,_0x5cf984){var _0x53b90c=moment();var _0x43e9e0={'method':_0x4926('0x2f'),'uri':_0x367333+_0x4926('0x30'),'body':{'contact':{'last_name':_0x28d213[_0x4926('0x28')],'work_number':_0x28d213[_0x4926('0x28')],'mobile_number':_0x28d213[_0x4926('0x28')],'owner_id':_0x28d213[_0x4926('0x20')],'created_at':_0x53b90c[_0x4926('0x26')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x43e9e0[_0x4926('0xe')]=_0x595d9b;logger['info'](_0x4926('0x31'));return rp(_0x43e9e0)['then'](function(_0x5de895){_0x28d213['endUserId']=_0x5de895[_0x4926('0x32')]['id'];_0x3f7947(_0x28d213);})['catch'](function(_0x53c37f){logger[_0x4926('0x22')]('['+[_0x1dce16[_0x4926('0x1a')]()]+']',_0x53c37f['message']);_0x5cf984(_0x53c37f[_0x4926('0x1b')]);});});}function getTicket(_0x355c33,_0xc015c3,_0xe0ec94,_0x12e849,_0x25e7bc){return function(_0xb332ae){logger['info']('Creating\x20new\x20task');return new Promise(function(_0x1c9f7b,_0x551cf2){var _0x17ef4b=moment();var _0x51f656={'method':'POST','uri':_0xe0ec94+_0x4926('0x33'),'body':{'title':intUtil['getString'](_0x12e849[_0x4926('0x34')],_0x25e7bc,'\x20'),'description':intUtil[_0x4926('0x35')](_0x12e849[_0x4926('0x36')],_0x25e7bc,'\x0a'),'owner_id':_0xb332ae[_0x4926('0x20')],'creater_id':_0xb332ae[_0x4926('0x17')],'targetable_id':_0xb332ae[_0x4926('0x2a')],'targetable_type':_0x4926('0x37'),'created_at':_0x17ef4b[_0x4926('0x26')](_0x4926('0x38')),'due_date':_0x17ef4b[_0x4926('0x39')](0x1e,'m')[_0x4926('0x26')](_0x4926('0x38'))},'json':!![]};_0x51f656[_0x4926('0xe')]=_0xc015c3;return rp(_0x51f656)[_0x4926('0x11')](function(_0x428e63){_0xb332ae[_0x4926('0x3a')]=_0x428e63['task']['id'];logger[_0x4926('0xf')](_0x4926('0x3b'),_0xb332ae[_0x4926('0x3a')]);_0x1c9f7b(_0xb332ae);})[_0x4926('0x19')](function(_0x59b921){logger['error']('['+[_0x355c33[_0x4926('0x1a')]()]+']',_0x59b921[_0x4926('0x1b')]);_0x551cf2(_0x59b921[_0x4926('0x1b')]);});});};}function emit(_0x4b26c0,_0x571dc7,_0x3ee284){var _0x548d00={'uri':_0x4b26c0+_0x4926('0x3c')+_0x3ee284};io['to'](util['format'](_0x4926('0x3d'),_0x571dc7))[_0x4926('0x3e')](_0x4926('0x3f'),_0x548d00);}exports['cs']=function(_0x4af449,_0xdfb0e3,_0x343a9f,_0x4a2525,_0x8951a5,_0x37f71f,_0x50f882,_0x321858){var _0xfabebb={};var _0x458111={'Authorization':_0x4926('0x40')+_0x37f71f[_0x4926('0x41')]};_0x37f71f[_0x4926('0x42')]=intUtil[_0x4926('0x43')](_0x37f71f['remoteUri']);_0x37f71f[_0x4926('0x44')]=intUtil['stripTrailingSlash'](_0x37f71f['serverUrl']);var _0x53f556=_0x37f71f[_0x4926('0x42')];_0xfabebb[_0x4926('0x15')]=_0x37f71f[_0x4926('0x45')];_0xfabebb[_0x4926('0x28')]=_0x321858[_0x4926('0x46')]()===_0x4926('0x47')?_0xdfb0e3[_0x4926('0x48')]:_0xdfb0e3['calleridnum'];_0xfabebb[_0x4926('0x49')]=_0x321858===_0x4926('0x4a')||_0x321858===_0x4926('0x4b')?_0x4926('0x4a'):_0x4926('0x47');if(_0x4a2525){_0xfabebb[_0x4926('0x1d')]=_0x4a2525[_0x4926('0x14')];}var _0x3698f9=util[_0x4926('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x37f71f[_0x4926('0x44')],_0xdfb0e3[_0x4926('0x4c')],md5(_0xdfb0e3['uniqueid']));if(_0x8951a5&&_0x8951a5['monitor_format']){logger[_0x4926('0xf')](_0x4926('0x4d'),'Recording\x20is\x20enabled!');_0xdfb0e3['recordingURL']=_0x3698f9;}else if(_0x50f882&&_0x50f882[_0x4926('0x4e')]&&_0x50f882[_0x4926('0x4e')]!==_0x4926('0x4f')){logger[_0x4926('0xf')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0xdfb0e3[_0x4926('0x50')]=_0x3698f9;}else{_0xdfb0e3[_0x4926('0x50')]='';}return getAdminId(_0xfabebb,_0x321858,_0x458111,_0x53f556)[_0x4926('0x11')](getUser(_0x321858,_0x458111,_0x53f556))[_0x4926('0x11')](getEndUser(_0x321858,_0x458111,_0x53f556))[_0x4926('0x11')](getTicket(_0x321858,_0x458111,_0x53f556,_0x343a9f,_0xdfb0e3))[_0x4926('0x11')](function(_0x258130){logger[_0x4926('0xf')](util[_0x4926('0x26')](_0x4926('0x51'),_0x258130[_0x4926('0x3a')]));if(_0x321858!==_0x4926('0x4b')){logger[_0x4926('0xf')]('['+[_0x321858[_0x4926('0x1a')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x53f556,_0x4a2525[_0x4926('0x52')],_0x258130[_0x4926('0x2a')]);}})[_0x4926('0x19')](function(_0x339790){logger['error']('['+[_0x321858[_0x4926('0x1a')]()]+_0x4926('0x53'),util[_0x4926('0x54')](_0x339790,{'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 fa22537..4e52a56 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 _0x761e=['../../../../config/logger','[EXEC]','format','%s\x20account\x20#%s\x20not\x20found','data2','error','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./desk','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','find','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','desk','unknown\x20integration'];(function(_0x22e47a,_0x4ea10c){var _0x15a12a=function(_0x4a097f){while(--_0x4a097f){_0x22e47a['push'](_0x22e47a['shift']());}};_0x15a12a(++_0x4ea10c);}(_0x761e,0xc9));var _0xe761=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0x761e[_0x2df507];return _0x1f7167;};'use strict';var _=require(_0xe761('0x0'));var util=require(_0xe761('0x1'));var zendesk=require(_0xe761('0x2'));var salesforce=require(_0xe761('0x3'));var sugarcrm=require(_0xe761('0x4'));var freshdesk=require(_0xe761('0x5'));var zoho=require('./zoho');var desk=require(_0xe761('0x6'));var vtiger=require('./vtiger');var servicenow=require(_0xe761('0x7'));var dynamics365=require(_0xe761('0x8'));var freshsales=require(_0xe761('0x9'));var integrations=[_0xe761('0xa'),_0xe761('0xb'),_0xe761('0xc'),_0xe761('0xd'),_0xe761('0xe'),'desk','vtiger',_0xe761('0xf'),_0xe761('0x10'),_0xe761('0x11')];exports[_0xe761('0x12')]=function(_0x1b1072,_0x5af1fa,_0x512638,_0x1e5713,_0x4780df,_0x49c49c){if(_0x512638){if(_[_0xe761('0x13')](integrations,_0x1b1072[_0xe761('0x14')][_0xe761('0x15')]())){try{var _0x2ad007=null;var _0x2cce66='';var _0x1618f8=_0x512638[_0x1b1072['data1']['toLowerCase']()];if(_0x1618f8){var _0x3bd154=_0x1618f8[_0x1b1072['data2']];if(_0x3bd154){var _0x19c66a=_[_0xe761('0x16')](_0x3bd154[_0xe761('0x17')],{'id':parseInt(_0x1b1072[_0xe761('0x18')],0xa)});if(_0x19c66a){if(_0x1e5713){if(_0x4780df&&_0x5af1fa[_0xe761('0x19')]){_0x2cce66=_0xe761('0x19');}else if(_0x5af1fa[_0xe761('0x1a')]){_0x2cce66=_0xe761('0x1b');}else{console[_0xe761('0x1c')](_0xe761('0x1d'),_0x5af1fa);}}else{_0x2cce66=_0xe761('0x1e');}switch(_0x1b1072[_0xe761('0x14')]['toLowerCase']()){case _0xe761('0xa'):zendesk[_0x2cce66](_0x1b1072,_0x5af1fa,_0x19c66a,_0x1e5713,_0x4780df,_0x3bd154,_0x49c49c);break;case _0xe761('0xb'):salesforce[_0x2cce66](_0x1b1072,_0x5af1fa,_0x19c66a,_0x1e5713,_0x4780df,_0x3bd154,_0x49c49c);break;case _0xe761('0xc'):sugarcrm[_0x2cce66](_0x1b1072,_0x5af1fa,_0x19c66a,_0x1e5713,_0x4780df,_0x3bd154,_0x49c49c);break;case'freshdesk':freshdesk[_0x2cce66](_0x1b1072,_0x5af1fa,_0x19c66a,_0x1e5713,_0x4780df,_0x3bd154,_0x49c49c);break;case'zoho':zoho[_0x2cce66](_0x1b1072,_0x5af1fa,_0x19c66a,_0x1e5713,_0x4780df,_0x3bd154,_0x49c49c);break;case _0xe761('0x1f'):desk[_0x2cce66](_0x1b1072,_0x5af1fa,_0x19c66a,_0x1e5713,_0x4780df,_0x3bd154,_0x49c49c);break;case'vtiger':vtiger[_0x2cce66](_0x1b1072,_0x5af1fa,_0x19c66a,_0x1e5713,_0x4780df,_0x3bd154,_0x49c49c);break;case _0xe761('0x10'):freshsales['cs'](_0x1b1072,_0x5af1fa,_0x19c66a,_0x1e5713,_0x4780df,_0x3bd154,_0x49c49c,_0x2cce66);break;case _0xe761('0x11'):servicenow['cs'](_0x1b1072,_0x5af1fa,_0x19c66a,_0x1e5713,_0x4780df,_0x3bd154,_0x49c49c,_0x2cce66);break;case _0xe761('0xf'):dynamics365['cs'](_0x1b1072,_0x5af1fa,_0x19c66a,_0x1e5713,_0x4780df,_0x3bd154,_0x49c49c,_0x2cce66);break;default:console[_0xe761('0x1c')](_0xe761('0x20'));}}else{_0x2ad007=require(_0xe761('0x21'))(_0x1b1072['data1'][_0xe761('0x15')]());_0x2ad007['error'](_0xe761('0x22'),util[_0xe761('0x23')]('%s\x20configuration\x20#%s\x20not\x20found',_0x1b1072[_0xe761('0x14')]['toLowerCase'](),_0x1b1072[_0xe761('0x18')]));}}else{_0x2ad007=require(_0xe761('0x21'))(_0x1b1072[_0xe761('0x14')][_0xe761('0x15')]());_0x2ad007['error'](_0xe761('0x22'),util['format'](_0xe761('0x24'),_0x1b1072[_0xe761('0x14')]['toLowerCase'](),_0x1b1072[_0xe761('0x25')]));}}else{}}catch(_0x171898){console[_0xe761('0x26')](_0x171898);}}}}; \ No newline at end of file +var _0x5765=['format','data3','%s\x20account\x20#%s\x20not\x20found','lodash','util','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','zendesk','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','data2','find','Configurations','queue','routeId','outbound','EVENT\x20UNKNOWN','unmanaged','toLowerCase','salesforce','sugarcrm','unknown\x20integration','../../../../config/logger','error','[EXEC]'];(function(_0x65d574,_0x4dc757){var _0x54515d=function(_0x1925c7){while(--_0x1925c7){_0x65d574['push'](_0x65d574['shift']());}};_0x54515d(++_0x4dc757);}(_0x5765,0x9b));var _0x5576=function(_0x10dfdf,_0x36b623){_0x10dfdf=_0x10dfdf-0x0;var _0x4d857d=_0x5765[_0x10dfdf];return _0x4d857d;};'use strict';var _=require(_0x5576('0x0'));var util=require(_0x5576('0x1'));var zendesk=require('./zendesk');var salesforce=require(_0x5576('0x2'));var sugarcrm=require(_0x5576('0x3'));var freshdesk=require(_0x5576('0x4'));var zoho=require(_0x5576('0x5'));var desk=require(_0x5576('0x6'));var vtiger=require(_0x5576('0x7'));var servicenow=require(_0x5576('0x8'));var dynamics365=require('./dynamics365');var freshsales=require('./freshsales');var integrations=[_0x5576('0x9'),'salesforce','sugarcrm',_0x5576('0xa'),_0x5576('0xb'),_0x5576('0xc'),_0x5576('0xd'),_0x5576('0xe'),_0x5576('0xf'),_0x5576('0x10')];exports[_0x5576('0x11')]=function(_0x142b6f,_0x548206,_0x52a4cb,_0x3b6701,_0x1a0cb1,_0x3e8b0d){if(_0x52a4cb){if(_[_0x5576('0x12')](integrations,_0x142b6f[_0x5576('0x13')]['toLowerCase']())){try{var _0xe60f66=null;var _0x4b160c='';var _0x32dff4=_0x52a4cb[_0x142b6f[_0x5576('0x13')]['toLowerCase']()];if(_0x32dff4){var _0x1c0431=_0x32dff4[_0x142b6f[_0x5576('0x14')]];if(_0x1c0431){var _0x3475b7=_[_0x5576('0x15')](_0x1c0431[_0x5576('0x16')],{'id':parseInt(_0x142b6f['data3'],0xa)});if(_0x3475b7){if(_0x3b6701){if(_0x1a0cb1&&_0x548206['queue']){_0x4b160c=_0x5576('0x17');}else if(_0x548206[_0x5576('0x18')]){_0x4b160c=_0x5576('0x19');}else{console['log'](_0x5576('0x1a'),_0x548206);}}else{_0x4b160c=_0x5576('0x1b');}switch(_0x142b6f[_0x5576('0x13')][_0x5576('0x1c')]()){case _0x5576('0x9'):zendesk[_0x4b160c](_0x142b6f,_0x548206,_0x3475b7,_0x3b6701,_0x1a0cb1,_0x1c0431,_0x3e8b0d);break;case _0x5576('0x1d'):salesforce[_0x4b160c](_0x142b6f,_0x548206,_0x3475b7,_0x3b6701,_0x1a0cb1,_0x1c0431,_0x3e8b0d);break;case _0x5576('0x1e'):sugarcrm[_0x4b160c](_0x142b6f,_0x548206,_0x3475b7,_0x3b6701,_0x1a0cb1,_0x1c0431,_0x3e8b0d);break;case _0x5576('0xa'):freshdesk[_0x4b160c](_0x142b6f,_0x548206,_0x3475b7,_0x3b6701,_0x1a0cb1,_0x1c0431,_0x3e8b0d);break;case _0x5576('0xb'):zoho[_0x4b160c](_0x142b6f,_0x548206,_0x3475b7,_0x3b6701,_0x1a0cb1,_0x1c0431,_0x3e8b0d);break;case _0x5576('0xc'):desk[_0x4b160c](_0x142b6f,_0x548206,_0x3475b7,_0x3b6701,_0x1a0cb1,_0x1c0431,_0x3e8b0d);break;case _0x5576('0xd'):vtiger[_0x4b160c](_0x142b6f,_0x548206,_0x3475b7,_0x3b6701,_0x1a0cb1,_0x1c0431,_0x3e8b0d);break;case _0x5576('0xf'):freshsales['cs'](_0x142b6f,_0x548206,_0x3475b7,_0x3b6701,_0x1a0cb1,_0x1c0431,_0x3e8b0d,_0x4b160c);break;case _0x5576('0x10'):servicenow['cs'](_0x142b6f,_0x548206,_0x3475b7,_0x3b6701,_0x1a0cb1,_0x1c0431,_0x3e8b0d,_0x4b160c);break;case'dynamics365':dynamics365['cs'](_0x142b6f,_0x548206,_0x3475b7,_0x3b6701,_0x1a0cb1,_0x1c0431,_0x3e8b0d,_0x4b160c);break;default:console['log'](_0x5576('0x1f'));}}else{_0xe60f66=require(_0x5576('0x20'))(_0x142b6f[_0x5576('0x13')][_0x5576('0x1c')]());_0xe60f66[_0x5576('0x21')](_0x5576('0x22'),util[_0x5576('0x23')]('%s\x20configuration\x20#%s\x20not\x20found',_0x142b6f[_0x5576('0x13')]['toLowerCase'](),_0x142b6f[_0x5576('0x24')]));}}else{_0xe60f66=require(_0x5576('0x20'))(_0x142b6f['data1'][_0x5576('0x1c')]());_0xe60f66[_0x5576('0x21')]('[EXEC]',util[_0x5576('0x23')](_0x5576('0x25'),_0x142b6f[_0x5576('0x13')]['toLowerCase'](),_0x142b6f[_0x5576('0x14')]));}}else{}}catch(_0x2411ea){console['error'](_0x2411ea);}}}}; \ 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 f7bd091..65a2ae6 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 _0x1b1a=['contact_lead','additionalSearchContact','merge','$or','Contact','execute','cloneDeep','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','first','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','No\x20Company','forEach','string','picklist','idField','content','variable','variableName','toString','customVariable','Variable','name','password','concat','remoteUri','https://login.salesforce.com','clientSecret','login','username','Connection\x20established.','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','email','calleridname','calleridnum','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','error','outbound','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridnum','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','[OUTBOUND]','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','moment','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','salesforce','redis','emit','Subjects','getString','Descriptions','ticketType','Task','ActivityDate','IsRecurrence','endUserType','contact','account','AccountId','lead','leadId','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','find','then','length','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','info','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch'];(function(_0x415828,_0x4c461c){var _0x474da3=function(_0x448458){while(--_0x448458){_0x415828['push'](_0x415828['shift']());}};_0x474da3(++_0x4c461c);}(_0x1b1a,0xca));var _0xa1b1=function(_0x4bf96c,_0x4d24fd){_0x4bf96c=_0x4bf96c-0x0;var _0x281d09=_0x1b1a[_0x4bf96c];return _0x281d09;};'use strict';var _=require(_0xa1b1('0x0'));var rp=require('request-promise');var moment=require(_0xa1b1('0x1'));var BPromise=require(_0xa1b1('0x2'));var md5=require(_0xa1b1('0x3'));var jsforce=require(_0xa1b1('0x4'));var util=require(_0xa1b1('0x5'));var Redis=require(_0xa1b1('0x6'));var intUtil=require(_0xa1b1('0x7'));var config=require(_0xa1b1('0x8'));var logger=require('../../../../config/logger')(_0xa1b1('0x9'));config['redis']=_['defaults'](config[_0xa1b1('0xa')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa1b1('0xa')]));function emit(_0x1b85e0,_0x253344,_0x4d67e6){io['to'](_0x1b85e0)[_0xa1b1('0xb')](_0x253344,_0x4d67e6);}function getTicket(_0x365c85,_0x574e88,_0x1bc91f,_0x3be849,_0x59ded8,_0x29ccec,_0x4da41d,_0x2f7799){var _0x18bebd=Object['assign']({},{'OwnerId':_0x574e88['id'],'Subject':intUtil['getString'](_0x3be849[_0xa1b1('0xc')],_0x59ded8,'\x20'),'Description':intUtil[_0xa1b1('0xd')](_0x3be849[_0xa1b1('0xe')],_0x59ded8,'\x0a')},getCustomFields(_0x29ccec,_0x59ded8));if(_0x1bc91f){if(_0x3be849[_0xa1b1('0xf')]===_0xa1b1('0x10')){_0x18bebd[_0xa1b1('0x11')]=moment['utc']();_0x18bebd['IsReminderSet']=![];_0x18bebd[_0xa1b1('0x12')]=![];if(_0x1bc91f[_0xa1b1('0x13')]===_0xa1b1('0x14')||_0x1bc91f[_0xa1b1('0x13')]==='lead'){_0x18bebd['WhoId']=_0x1bc91f['id'];}else if(_0x1bc91f[_0xa1b1('0x13')]===_0xa1b1('0x15')){_0x18bebd['WhatId']=_0x1bc91f['id'];}}else if(_0x3be849[_0xa1b1('0xf')]==='Case'){if(_0x1bc91f[_0xa1b1('0x13')]===_0xa1b1('0x14')){_0x18bebd['ContactId']=_0x1bc91f['id'];}else if(_0x1bc91f['endUserType']==='account'){_0x18bebd[_0xa1b1('0x16')]=_0x1bc91f['id'];}else if(_0x1bc91f[_0xa1b1('0x13')]===_0xa1b1('0x17')&&_0x3be849[_0xa1b1('0x18')]){_0x18bebd[_0x3be849[_0xa1b1('0x18')]]=_0x1bc91f['id'];}else{logger['info'](_0xa1b1('0x19'));}}}return _0x4da41d[_0xa1b1('0x1a')](_0x3be849['ticketType'])[_0xa1b1('0x1b')](_0x18bebd);}function getUser(_0x3c4c59,_0x186207,_0x250a62){if(!_[_0xa1b1('0x1c')](_0x186207)&&intUtil['validateEmail'](_0x186207)){var _0x17fab9={'Email':_0x186207};var _0x3dca8f={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x250a62[_0xa1b1('0x1a')]('User')[_0xa1b1('0x1d')](_0x17fab9,_0x3dca8f)['execute']()[_0xa1b1('0x1e')](function(_0x19e161){if(_0x19e161[_0xa1b1('0x1f')]){var _0x5b5b55=_[_0xa1b1('0x1d')](_0x19e161,function(_0x13f532){return _0x13f532['Email']===_0x186207;});if(_0x5b5b55){logger['info'](_0xa1b1('0x20'),_0x186207);return BPromise[_0xa1b1('0x21')]({'id':_0x5b5b55['Id'],'name':_0x5b5b55[_0xa1b1('0x22')]});}}else{logger['info'](_0xa1b1('0x23'),_0x186207);return _0x250a62[_0xa1b1('0x24')]()[_0xa1b1('0x1e')](function(_0x3396e5){return BPromise[_0xa1b1('0x21')]({'id':_0x3396e5[_0xa1b1('0x25')],'name':_0x3396e5[_0xa1b1('0x26')]});});}});}else{logger[_0xa1b1('0x27')](_0xa1b1('0x23'),_0x186207);return _0x250a62[_0xa1b1('0x24')]()[_0xa1b1('0x1e')](function(_0x1e51ce){return BPromise['resolve']({'id':_0x1e51ce['user_id'],'name':_0x1e51ce[_0xa1b1('0x26')]});});}}function getEndUser(_0x3a0cf8,_0xb38b60,_0x505aab,_0x80a806,_0x1f0960){var _0x10753c={'$or':{'Phone':_0x80a806}};var _0x26d234={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0xa1b1('0x1e')](function(){logger['info'](_0xa1b1('0x28'),_0x80a806,_0xb38b60[_0xa1b1('0x29')]);switch(_0xb38b60['moduleSearch']){case _0xa1b1('0x2a'):var _0x5b784d=_['cloneDeep'](_0x10753c);if(_0xb38b60['additionalSearchContact']){var _0x31bcda={};_0x31bcda[_0xb38b60[_0xa1b1('0x2b')]]=_0x80a806;_[_0xa1b1('0x2c')](_0x5b784d[_0xa1b1('0x2d')],_0x31bcda);}return _0x1f0960[_0xa1b1('0x1a')](_0xa1b1('0x2e'))[_0xa1b1('0x1d')](_0x5b784d,_0x26d234)[_0xa1b1('0x2f')]()[_0xa1b1('0x1e')](function(_0x19d35a){if(_0x19d35a&&_0x19d35a['length']){return _0x19d35a;}else{var _0x93f36d=_[_0xa1b1('0x30')](_0x10753c);if(_0xb38b60['additionalSearchLead']){var _0x59dc6f={};_0x59dc6f[_0xb38b60[_0xa1b1('0x31')]]=_0x80a806;_[_0xa1b1('0x2c')](_0x93f36d['$or'],_0x59dc6f);}return _0x1f0960['sobject'](_0xa1b1('0x32'))[_0xa1b1('0x1d')](_0x93f36d,_0x26d234);}});case _0xa1b1('0x33'):var _0x1c9f02=_['cloneDeep'](_0x10753c);if(_0xb38b60[_0xa1b1('0x34')]){var _0x31bcda={};_0x31bcda[_0xb38b60[_0xa1b1('0x34')]]=_0x80a806;_[_0xa1b1('0x2c')](_0x1c9f02['$or'],_0x31bcda);}return _0x1f0960[_0xa1b1('0x1a')](_0xa1b1('0x35'))[_0xa1b1('0x1d')](_0x1c9f02,_0x26d234)[_0xa1b1('0x2f')]()['then'](function(_0x37c049){if(_0x37c049&&_0x37c049['length']){return _0x37c049;}else{var _0x2f6fdd=_[_0xa1b1('0x30')](_0x10753c);if(_0xb38b60[_0xa1b1('0x2b')]){var _0x2c22d4={};_0x2c22d4[_0xb38b60['additionalSearchContact']]=_0x80a806;_[_0xa1b1('0x2c')](_0x2f6fdd[_0xa1b1('0x2d')],_0x2c22d4);}return _0x1f0960['sobject'](_0xa1b1('0x2e'))[_0xa1b1('0x1d')](_0x2f6fdd,_0x26d234)[_0xa1b1('0x1e')](function(_0x54703a){if(_0x54703a&&_0x54703a[_0xa1b1('0x1f')]){return _0x54703a;}else{var _0x1965a3=_[_0xa1b1('0x30')](_0x10753c);if(_0xb38b60[_0xa1b1('0x31')]){var _0x3d002c={};_0x3d002c[_0xb38b60[_0xa1b1('0x31')]]=_0x80a806;_[_0xa1b1('0x2c')](_0x1965a3['$or'],_0x3d002c);}return _0x1f0960[_0xa1b1('0x1a')](_0xa1b1('0x32'))[_0xa1b1('0x1d')](_0x1965a3,_0x26d234);}});}});case _0xa1b1('0x14'):var _0x5b784d=_[_0xa1b1('0x30')](_0x10753c);if(_0xb38b60[_0xa1b1('0x2b')]){var _0x31bcda={};_0x31bcda[_0xb38b60[_0xa1b1('0x2b')]]=_0x80a806;_[_0xa1b1('0x2c')](_0x5b784d[_0xa1b1('0x2d')],_0x31bcda);}return _0x1f0960['sobject'](_0xa1b1('0x2e'))[_0xa1b1('0x1d')](_0x5b784d,_0x26d234)[_0xa1b1('0x2f')]();case _0xa1b1('0x17'):var _0x159d0c=_[_0xa1b1('0x30')](_0x10753c);if(_0xb38b60[_0xa1b1('0x31')]){var _0x31bcda={};_0x31bcda[_0xb38b60[_0xa1b1('0x31')]]=_0x80a806;_['merge'](_0x159d0c[_0xa1b1('0x2d')],_0x31bcda);}return _0x1f0960['sobject'](_0xa1b1('0x32'))[_0xa1b1('0x1d')](_0x159d0c,_0x26d234);case'account':var _0x1c9f02=_[_0xa1b1('0x30')](_0x10753c);if(_0xb38b60['additionalSearchAccount']){var _0x31bcda={};_0x31bcda[_0xb38b60[_0xa1b1('0x34')]]=_0x80a806;_[_0xa1b1('0x2c')](_0x1c9f02[_0xa1b1('0x2d')],_0x31bcda);}return _0x1f0960[_0xa1b1('0x1a')](_0xa1b1('0x35'))['find'](_0x1c9f02,_0x26d234);default:return null;}})['then'](function(_0x124dcd){if(_0x124dcd&&_0x124dcd[_0xa1b1('0x1f')]){var _0xbf040f=_[_0xa1b1('0x36')](_0x124dcd);if(_0xbf040f){return BPromise['resolve']({'id':_0xbf040f['Id'],'name':_0xbf040f[_0xa1b1('0x22')],'phone':_0xbf040f['Phone'],'endUserType':_0xbf040f[_0xa1b1('0x37')][_0xa1b1('0x38')][_0xa1b1('0x39')]()});}}})[_0xa1b1('0x1e')](function(_0x595db1){if(_0x595db1){logger[_0xa1b1('0x27')](_0xa1b1('0x3a'),_0x595db1['endUserType'],_0x80a806);return BPromise[_0xa1b1('0x21')](_0x595db1);}else{logger[_0xa1b1('0x27')](_0xa1b1('0x3b'),_0x80a806);var _0x570b00={'Phone':_0x80a806};if(_0xb38b60['moduleCreate']){if(_0xb38b60[_0xa1b1('0x3c')]===_0xa1b1('0x14')){logger[_0xa1b1('0x27')](_0xa1b1('0x3d'),_0x80a806,_0xb38b60[_0xa1b1('0x3c')]);_0x570b00[_0xa1b1('0x3e')]=_0x505aab!==_0xa1b1('0x3f')?_0x505aab:util[_0xa1b1('0x40')](_0xa1b1('0x41'),_0x80a806);}else if(_0xb38b60[_0xa1b1('0x3c')]===_0xa1b1('0x17')){logger[_0xa1b1('0x27')](_0xa1b1('0x3d'),_0x80a806,_0xb38b60[_0xa1b1('0x3c')]);_0x570b00[_0xa1b1('0x3e')]=_0x505aab!==''?_0x505aab:util[_0xa1b1('0x40')](_0xa1b1('0x41'),_0x80a806);_0x570b00['Company']=_0xa1b1('0x42');}else if(_0xb38b60[_0xa1b1('0x3c')]==='account'){logger[_0xa1b1('0x27')](_0xa1b1('0x3d'),_0x80a806,_0xb38b60[_0xa1b1('0x3c')]);_0x570b00[_0xa1b1('0x22')]=_0x505aab!==_0xa1b1('0x3f')?_0x505aab:util[_0xa1b1('0x40')](_0xa1b1('0x41'),_0x80a806);}else{return null;}}return _0x1f0960['sobject'](_['upperFirst'](_0xb38b60['moduleCreate']))[_0xa1b1('0x1b')](_0x570b00)['then'](function(_0x3ba3dd){return BPromise[_0xa1b1('0x21')]({'id':_0x3ba3dd['id'],'endUserType':_0xb38b60['moduleCreate']});});}});}function getCustomFields(_0x6411d3,_0x3f9231){var _0x28696c={};if(_0x6411d3[_0xa1b1('0x1f')]>0x0){_[_0xa1b1('0x43')](_0x6411d3,function(_0x4df706){if(_['includes']([_0xa1b1('0x44'),_0xa1b1('0x45')],_0x4df706[_0xa1b1('0x38')])&&_0x4df706[_0xa1b1('0x46')]){_0x28696c[_0x4df706[_0xa1b1('0x46')]]=_0x4df706[_0xa1b1('0x47')]['toString']();}else if(_0x4df706[_0xa1b1('0x38')]===_0xa1b1('0x48')&&_0x4df706[_0xa1b1('0x49')]&&_0x4df706[_0xa1b1('0x46')]){_0x3f9231[_0x4df706['variableName']]&&(_0x28696c[_0x4df706[_0xa1b1('0x46')]]=_0x3f9231[_0x4df706[_0xa1b1('0x49')]][_0xa1b1('0x4a')]());}else if(_0x4df706[_0xa1b1('0x38')]===_0xa1b1('0x4b')&&_0x4df706[_0xa1b1('0x4c')]&&_0x4df706[_0xa1b1('0x4c')]['name']&&_0x4df706['idField']){_0x3f9231[_0x4df706[_0xa1b1('0x4c')][_0xa1b1('0x4d')][_0xa1b1('0x39')]()]&&(_0x28696c[_0x4df706[_0xa1b1('0x46')]]=_0x3f9231[_0x4df706[_0xa1b1('0x4c')][_0xa1b1('0x4d')][_0xa1b1('0x39')]()]['toString']());}});}return _0x28696c;}function getConnection(_0x46e124){var _0xbefe1f=_0x46e124[_0xa1b1('0x4e')][_0xa1b1('0x4f')](_0x46e124['securityToken']);var _0x55dc7a=new jsforce['Connection']({'oauth2':{'loginUrl':_0x46e124[_0xa1b1('0x50')]||_0xa1b1('0x51'),'clientId':_0x46e124['clientId'],'clientSecret':_0x46e124[_0xa1b1('0x52')]}});return _0x55dc7a[_0xa1b1('0x53')](_0x46e124[_0xa1b1('0x54')],_0xbefe1f)[_0xa1b1('0x1e')](function(){logger[_0xa1b1('0x27')](_0xa1b1('0x55'));return _0x55dc7a;});}exports[_0xa1b1('0x56')]=function(_0x14f4da,_0x5cbf2d,_0x3f9623,_0x1860e3,_0x257906,_0x57de3a){var _0x25b5b0,_0x7d00b6,_0x311f92,_0x1a0978;_0x57de3a['serverUrl']=intUtil[_0xa1b1('0x57')](_0x57de3a[_0xa1b1('0x58')]);_0x57de3a[_0xa1b1('0x50')]=intUtil['stripTrailingSlash'](_0x57de3a[_0xa1b1('0x50')]);if(_0x257906&&_0x257906[_0xa1b1('0x59')]){logger[_0xa1b1('0x27')](_0xa1b1('0x5a'),_0xa1b1('0x5b'));_0x5cbf2d[_0xa1b1('0x5c')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x57de3a['serverUrl'],_0x5cbf2d[_0xa1b1('0x5d')],md5(_0x5cbf2d[_0xa1b1('0x5d')]));}else{_0x5cbf2d[_0xa1b1('0x5c')]='';}return getConnection(_0x57de3a)[_0xa1b1('0x1e')](function(_0x355ebc){_0x1a0978=_0x355ebc;return getUser(_0x57de3a,_0x1860e3[_0xa1b1('0x5e')],_0x1a0978);})['then'](function(_0x241a0a){_0x25b5b0=_0x241a0a;return getEndUser(_0x57de3a,_0x3f9623,_0x5cbf2d[_0xa1b1('0x5f')],_0x5cbf2d[_0xa1b1('0x60')],_0x1a0978);})['then'](function(_0x54df3f){_0x7d00b6=_0x54df3f;return getTicket(_0x57de3a,_0x25b5b0,_0x7d00b6,_0x3f9623,_0x5cbf2d,_0x3f9623['Fields'],_0x1a0978,_0xa1b1('0x56'));})['then'](function(_0x5683c9){_0x311f92=_0x5683c9;logger['info']('[QUEUE]\x20Ticket\x20%s\x20created',_0x311f92['id']);logger[_0xa1b1('0x27')](_0xa1b1('0x61'),_0x311f92['id'],_0x1860e3['name'],_0x57de3a['type']);switch(_0x57de3a[_0xa1b1('0x38')]){case _0xa1b1('0x62'):emit(util[_0xa1b1('0x40')](_0xa1b1('0x63'),_0x1860e3[_0xa1b1('0x4d')]),_0xa1b1('0x64'),{'recordId':_0x311f92['id']});break;case _0xa1b1('0x65'):emit(util['format'](_0xa1b1('0x63'),_0x1860e3[_0xa1b1('0x4d')]),_0xa1b1('0x66'),{'uri':util[_0xa1b1('0x40')](_0xa1b1('0x67'),_0x1a0978[_0xa1b1('0x68')],_0x311f92['id'])});break;default:logger['error'](_0xa1b1('0x69'));}})[_0xa1b1('0x6a')](function(_0x5014bf){logger[_0xa1b1('0x6b')]('[QUEUE]',_0x5014bf);});};exports[_0xa1b1('0x6c')]=function(_0x3ee283,_0xd32dd8,_0x7b9f12,_0x343d43,_0x83ef54,_0xd4f936,_0x3fd4e0){var _0x547a56,_0x5c8d73,_0x13b8a6,_0x36a9ee;_0xd4f936[_0xa1b1('0x58')]=intUtil['stripTrailingSlash'](_0xd4f936['serverUrl']);_0xd4f936[_0xa1b1('0x50')]=intUtil[_0xa1b1('0x57')](_0xd4f936[_0xa1b1('0x50')]);if(_0x3fd4e0&&_0x3fd4e0[_0xa1b1('0x6d')]&&_0x3fd4e0['recordingFormat']!==_0xa1b1('0x6e')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0xd32dd8[_0xa1b1('0x5c')]=util[_0xa1b1('0x40')](_0xa1b1('0x6f'),_0xd4f936[_0xa1b1('0x58')],_0xd32dd8[_0xa1b1('0x5d')],md5(_0xd32dd8[_0xa1b1('0x5d')]));}return getConnection(_0xd4f936)[_0xa1b1('0x1e')](function(_0x31bc49){_0x36a9ee=_0x31bc49;return getUser(_0xd4f936,_0x343d43[_0xa1b1('0x5e')],_0x36a9ee);})[_0xa1b1('0x1e')](function(_0x20c0d8){_0x547a56=_0x20c0d8;return getEndUser(_0xd4f936,_0x7b9f12,_0xd32dd8['destcalleridname'],_0xd32dd8[_0xa1b1('0x70')],_0x36a9ee);})[_0xa1b1('0x1e')](function(_0x17afb8){_0x5c8d73=_0x17afb8;return getTicket(_0xd4f936,_0x547a56,_0x5c8d73,_0x7b9f12,_0xd32dd8,_0x7b9f12[_0xa1b1('0x71')],_0x36a9ee,'outbound');})[_0xa1b1('0x1e')](function(_0x44ba81){_0x13b8a6=_0x44ba81;logger[_0xa1b1('0x27')](_0xa1b1('0x72'),_0x13b8a6['id']);logger[_0xa1b1('0x27')](_0xa1b1('0x73'),_0x13b8a6['id'],_0x343d43[_0xa1b1('0x4d')],_0xd4f936['type']);switch(_0xd4f936[_0xa1b1('0x38')]){case _0xa1b1('0x62'):emit(util[_0xa1b1('0x40')](_0xa1b1('0x63'),_0x343d43['name']),_0xa1b1('0x64'),{'recordId':_0x13b8a6['id']});break;case _0xa1b1('0x65'):emit(util['format'](_0xa1b1('0x63'),_0x343d43[_0xa1b1('0x4d')]),_0xa1b1('0x66'),{'uri':util['format'](_0xa1b1('0x67'),_0x36a9ee['instanceUrl'],_0x13b8a6['id'])});break;default:logger[_0xa1b1('0x6b')](_0xa1b1('0x74'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0xa1b1('0x6a')](function(_0x429d07){logger[_0xa1b1('0x6b')](_0xa1b1('0x74'),_0x429d07);});};exports[_0xa1b1('0x75')]=function(_0x166b98,_0x2bbf88,_0x39f1ef,_0x50edbb,_0x43c9bf,_0x46293c){var _0x42fc37,_0x310b57,_0x4e95b5,_0x5eec0d;_0x46293c['serverUrl']=intUtil[_0xa1b1('0x57')](_0x46293c[_0xa1b1('0x58')]);_0x46293c['remoteUri']=intUtil['stripTrailingSlash'](_0x46293c['remoteUri']);if(_0x43c9bf&&_0x43c9bf[_0xa1b1('0x59')]){logger[_0xa1b1('0x27')]('['+_0x2bbf88[_0xa1b1('0x76')]['toUpperCase']()+']',_0xa1b1('0x5b'));_0x2bbf88['recordingURL']=util[_0xa1b1('0x40')](_0xa1b1('0x6f'),_0x46293c[_0xa1b1('0x58')],_0x2bbf88[_0xa1b1('0x5d')],md5(_0x2bbf88[_0xa1b1('0x5d')]));}else{_0x2bbf88[_0xa1b1('0x5c')]='';}return getConnection(_0x46293c)[_0xa1b1('0x1e')](function(_0x16d150){_0x5eec0d=_0x16d150;if(!_[_0xa1b1('0x1c')](_0x50edbb)){return getUser(_0x46293c,_0x50edbb[_0xa1b1('0x4d')],_0x5eec0d);}else{return getUser(_0x46293c,null,_0x5eec0d);}})[_0xa1b1('0x1e')](function(_0xf6fc96){_0x42fc37=_0xf6fc96;return getEndUser(_0x46293c,_0x39f1ef,_0x2bbf88['calleridname'],_0x2bbf88[_0xa1b1('0x60')],_0x5eec0d);})['then'](function(_0x598ac7){_0x310b57=_0x598ac7;return getTicket(_0x46293c,_0x42fc37,_0x310b57,_0x39f1ef,_0x2bbf88,_0x39f1ef[_0xa1b1('0x71')],_0x5eec0d);})[_0xa1b1('0x1e')](function(_0x39b22d){_0x4e95b5=_0x39b22d;logger[_0xa1b1('0x27')]('['+_0x2bbf88['lastevent'][_0xa1b1('0x77')]()+_0xa1b1('0x78'),_0x4e95b5['id']);logger[_0xa1b1('0x27')]('['+_0x2bbf88[_0xa1b1('0x76')][_0xa1b1('0x77')]()+_0xa1b1('0x79'),_0x46293c[_0xa1b1('0x38')]);})[_0xa1b1('0x6a')](function(_0x38ab0a){logger[_0xa1b1('0x6b')]('['+_0x2bbf88[_0xa1b1('0x76')][_0xa1b1('0x77')]()+']',_0x38ab0a);});}; \ No newline at end of file +var _0xc0c2=['emit','assign','getString','Subjects','Descriptions','ActivityDate','utc','IsRecurrence','endUserType','contact','lead','WhoId','Case','account','leadId','sobject','ticketType','validateEmail','User','find','execute','then','length','info','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','first','attributes','type','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','LastName','format','Caller\x20-\x20%s','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','','Company','No\x20Company','upperFirst','create','includes','string','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','password','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','login','username','Connection\x20established.','serverUrl','stripTrailingSlash','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','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','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','[QUEUE]','recordingFormat','none','[OUTBOUND]','destcalleridname','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','Salesforce\x20account\x20type\x20not\x20recognized','catch','unmanaged','monitor_format','lastevent','Recording\x20is\x20enabled!','isNil','calleridname','toUpperCase','lodash','request-promise','moment','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter'];(function(_0x5e5088,_0x28cd71){var _0x3de657=function(_0x2a8595){while(--_0x2a8595){_0x5e5088['push'](_0x5e5088['shift']());}};_0x3de657(++_0x28cd71);}(_0xc0c2,0xef));var _0x2c0c=function(_0xeb67d8,_0x14a337){_0xeb67d8=_0xeb67d8-0x0;var _0x4138f9=_0xc0c2[_0xeb67d8];return _0x4138f9;};'use strict';var _=require(_0x2c0c('0x0'));var rp=require(_0x2c0c('0x1'));var moment=require(_0x2c0c('0x2'));var BPromise=require(_0x2c0c('0x3'));var md5=require(_0x2c0c('0x4'));var jsforce=require(_0x2c0c('0x5'));var util=require(_0x2c0c('0x6'));var Redis=require(_0x2c0c('0x7'));var intUtil=require(_0x2c0c('0x8'));var config=require(_0x2c0c('0x9'));var logger=require(_0x2c0c('0xa'))('salesforce');config[_0x2c0c('0xb')]=_[_0x2c0c('0xc')](config[_0x2c0c('0xb')],{'host':_0x2c0c('0xd'),'port':0x18eb});var io=require(_0x2c0c('0xe'))(new Redis(config[_0x2c0c('0xb')]));function emit(_0x3b3520,_0xce34ab,_0x231d3){io['to'](_0x3b3520)[_0x2c0c('0xf')](_0xce34ab,_0x231d3);}function getTicket(_0x2348bf,_0x31c060,_0x26ac8b,_0x16b97d,_0x4b7556,_0x14d850,_0x397cb1,_0x15b335){var _0x12d7f3=Object[_0x2c0c('0x10')]({},{'OwnerId':_0x31c060['id'],'Subject':intUtil[_0x2c0c('0x11')](_0x16b97d[_0x2c0c('0x12')],_0x4b7556,'\x20'),'Description':intUtil[_0x2c0c('0x11')](_0x16b97d[_0x2c0c('0x13')],_0x4b7556,'\x0a')},getCustomFields(_0x14d850,_0x4b7556));if(_0x26ac8b){if(_0x16b97d['ticketType']==='Task'){_0x12d7f3[_0x2c0c('0x14')]=moment[_0x2c0c('0x15')]();_0x12d7f3['IsReminderSet']=![];_0x12d7f3[_0x2c0c('0x16')]=![];if(_0x26ac8b[_0x2c0c('0x17')]===_0x2c0c('0x18')||_0x26ac8b['endUserType']===_0x2c0c('0x19')){_0x12d7f3[_0x2c0c('0x1a')]=_0x26ac8b['id'];}else if(_0x26ac8b[_0x2c0c('0x17')]==='account'){_0x12d7f3['WhatId']=_0x26ac8b['id'];}}else if(_0x16b97d['ticketType']===_0x2c0c('0x1b')){if(_0x26ac8b[_0x2c0c('0x17')]===_0x2c0c('0x18')){_0x12d7f3['ContactId']=_0x26ac8b['id'];}else if(_0x26ac8b['endUserType']===_0x2c0c('0x1c')){_0x12d7f3['AccountId']=_0x26ac8b['id'];}else if(_0x26ac8b[_0x2c0c('0x17')]===_0x2c0c('0x19')&&_0x16b97d[_0x2c0c('0x1d')]){_0x12d7f3[_0x16b97d['leadId']]=_0x26ac8b['id'];}else{logger['info']('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x397cb1[_0x2c0c('0x1e')](_0x16b97d[_0x2c0c('0x1f')])['create'](_0x12d7f3);}function getUser(_0x3385d9,_0x4f4b15,_0x12b5aa){if(!_['isNil'](_0x4f4b15)&&intUtil[_0x2c0c('0x20')](_0x4f4b15)){var _0x209e98={'Email':_0x4f4b15};var _0x396c67={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x12b5aa['sobject'](_0x2c0c('0x21'))[_0x2c0c('0x22')](_0x209e98,_0x396c67)[_0x2c0c('0x23')]()[_0x2c0c('0x24')](function(_0x360c99){if(_0x360c99[_0x2c0c('0x25')]){var _0x2ae555=_[_0x2c0c('0x22')](_0x360c99,function(_0x4078f1){return _0x4078f1['Email']===_0x4f4b15;});if(_0x2ae555){logger[_0x2c0c('0x26')](_0x2c0c('0x27'),_0x4f4b15);return BPromise[_0x2c0c('0x28')]({'id':_0x2ae555['Id'],'name':_0x2ae555[_0x2c0c('0x29')]});}}else{logger['info'](_0x2c0c('0x2a'),_0x4f4b15);return _0x12b5aa[_0x2c0c('0x2b')]()[_0x2c0c('0x24')](function(_0x409e){return BPromise['resolve']({'id':_0x409e[_0x2c0c('0x2c')],'name':_0x409e[_0x2c0c('0x2d')]});});}});}else{logger[_0x2c0c('0x26')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x4f4b15);return _0x12b5aa[_0x2c0c('0x2b')]()['then'](function(_0x51713b){return BPromise[_0x2c0c('0x28')]({'id':_0x51713b[_0x2c0c('0x2c')],'name':_0x51713b[_0x2c0c('0x2d')]});});}}function getEndUser(_0x4a373c,_0x3fbe98,_0x2d3545,_0x3083f4,_0x98e097){var _0x785c64={'$or':{'Phone':_0x3083f4}};var _0x174e90={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0x2c0c('0x24')](function(){logger[_0x2c0c('0x26')](_0x2c0c('0x2e'),_0x3083f4,_0x3fbe98[_0x2c0c('0x2f')]);switch(_0x3fbe98['moduleSearch']){case _0x2c0c('0x30'):var _0x27384f=_[_0x2c0c('0x31')](_0x785c64);if(_0x3fbe98[_0x2c0c('0x32')]){var _0x9976dd={};_0x9976dd[_0x3fbe98[_0x2c0c('0x32')]]=_0x3083f4;_[_0x2c0c('0x33')](_0x27384f[_0x2c0c('0x34')],_0x9976dd);}return _0x98e097['sobject'](_0x2c0c('0x35'))[_0x2c0c('0x22')](_0x27384f,_0x174e90)['execute']()[_0x2c0c('0x24')](function(_0x31d242){if(_0x31d242&&_0x31d242[_0x2c0c('0x25')]){return _0x31d242;}else{var _0x3d5564=_[_0x2c0c('0x31')](_0x785c64);if(_0x3fbe98[_0x2c0c('0x36')]){var _0x170813={};_0x170813[_0x3fbe98[_0x2c0c('0x36')]]=_0x3083f4;_['merge'](_0x3d5564[_0x2c0c('0x34')],_0x170813);}return _0x98e097[_0x2c0c('0x1e')](_0x2c0c('0x37'))[_0x2c0c('0x22')](_0x3d5564,_0x174e90);}});case _0x2c0c('0x38'):var _0x2afb63=_[_0x2c0c('0x31')](_0x785c64);if(_0x3fbe98[_0x2c0c('0x39')]){var _0x9976dd={};_0x9976dd[_0x3fbe98['additionalSearchAccount']]=_0x3083f4;_[_0x2c0c('0x33')](_0x2afb63['$or'],_0x9976dd);}return _0x98e097['sobject'](_0x2c0c('0x3a'))[_0x2c0c('0x22')](_0x2afb63,_0x174e90)['execute']()[_0x2c0c('0x24')](function(_0x5f2478){if(_0x5f2478&&_0x5f2478[_0x2c0c('0x25')]){return _0x5f2478;}else{var _0x518153=_[_0x2c0c('0x31')](_0x785c64);if(_0x3fbe98['additionalSearchContact']){var _0x5622aa={};_0x5622aa[_0x3fbe98[_0x2c0c('0x32')]]=_0x3083f4;_[_0x2c0c('0x33')](_0x518153['$or'],_0x5622aa);}return _0x98e097[_0x2c0c('0x1e')](_0x2c0c('0x35'))[_0x2c0c('0x22')](_0x518153,_0x174e90)[_0x2c0c('0x24')](function(_0x2b9e5b){if(_0x2b9e5b&&_0x2b9e5b[_0x2c0c('0x25')]){return _0x2b9e5b;}else{var _0x5d185a=_[_0x2c0c('0x31')](_0x785c64);if(_0x3fbe98['additionalSearchLead']){var _0x28a59e={};_0x28a59e[_0x3fbe98[_0x2c0c('0x36')]]=_0x3083f4;_[_0x2c0c('0x33')](_0x5d185a[_0x2c0c('0x34')],_0x28a59e);}return _0x98e097[_0x2c0c('0x1e')](_0x2c0c('0x37'))[_0x2c0c('0x22')](_0x5d185a,_0x174e90);}});}});case _0x2c0c('0x18'):var _0x27384f=_['cloneDeep'](_0x785c64);if(_0x3fbe98[_0x2c0c('0x32')]){var _0x9976dd={};_0x9976dd[_0x3fbe98['additionalSearchContact']]=_0x3083f4;_[_0x2c0c('0x33')](_0x27384f[_0x2c0c('0x34')],_0x9976dd);}return _0x98e097[_0x2c0c('0x1e')](_0x2c0c('0x35'))[_0x2c0c('0x22')](_0x27384f,_0x174e90)[_0x2c0c('0x23')]();case'lead':var _0x590210=_['cloneDeep'](_0x785c64);if(_0x3fbe98['additionalSearchLead']){var _0x9976dd={};_0x9976dd[_0x3fbe98['additionalSearchLead']]=_0x3083f4;_[_0x2c0c('0x33')](_0x590210[_0x2c0c('0x34')],_0x9976dd);}return _0x98e097[_0x2c0c('0x1e')](_0x2c0c('0x37'))[_0x2c0c('0x22')](_0x590210,_0x174e90);case _0x2c0c('0x1c'):var _0x2afb63=_['cloneDeep'](_0x785c64);if(_0x3fbe98[_0x2c0c('0x39')]){var _0x9976dd={};_0x9976dd[_0x3fbe98[_0x2c0c('0x39')]]=_0x3083f4;_[_0x2c0c('0x33')](_0x2afb63[_0x2c0c('0x34')],_0x9976dd);}return _0x98e097['sobject']('Account')[_0x2c0c('0x22')](_0x2afb63,_0x174e90);default:return null;}})['then'](function(_0x198482){if(_0x198482&&_0x198482[_0x2c0c('0x25')]){var _0x1b8024=_[_0x2c0c('0x3b')](_0x198482);if(_0x1b8024){return BPromise[_0x2c0c('0x28')]({'id':_0x1b8024['Id'],'name':_0x1b8024['Name'],'phone':_0x1b8024['Phone'],'endUserType':_0x1b8024[_0x2c0c('0x3c')][_0x2c0c('0x3d')]['toLowerCase']()});}}})[_0x2c0c('0x24')](function(_0x3ab0d5){if(_0x3ab0d5){logger['info']('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x3ab0d5[_0x2c0c('0x17')],_0x3083f4);return BPromise[_0x2c0c('0x28')](_0x3ab0d5);}else{logger['info'](_0x2c0c('0x3e'),_0x3083f4);var _0x4f975f={'Phone':_0x3083f4};if(_0x3fbe98[_0x2c0c('0x3f')]){if(_0x3fbe98[_0x2c0c('0x3f')]==='contact'){logger[_0x2c0c('0x26')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x3083f4,_0x3fbe98[_0x2c0c('0x3f')]);_0x4f975f[_0x2c0c('0x40')]=_0x2d3545!==''?_0x2d3545:util[_0x2c0c('0x41')](_0x2c0c('0x42'),_0x3083f4);}else if(_0x3fbe98[_0x2c0c('0x3f')]===_0x2c0c('0x19')){logger['info'](_0x2c0c('0x43'),_0x3083f4,_0x3fbe98[_0x2c0c('0x3f')]);_0x4f975f[_0x2c0c('0x40')]=_0x2d3545!==_0x2c0c('0x44')?_0x2d3545:util[_0x2c0c('0x41')]('Caller\x20-\x20%s',_0x3083f4);_0x4f975f[_0x2c0c('0x45')]=_0x2c0c('0x46');}else if(_0x3fbe98[_0x2c0c('0x3f')]===_0x2c0c('0x1c')){logger[_0x2c0c('0x26')](_0x2c0c('0x43'),_0x3083f4,_0x3fbe98['moduleCreate']);_0x4f975f[_0x2c0c('0x29')]=_0x2d3545!==_0x2c0c('0x44')?_0x2d3545:util[_0x2c0c('0x41')](_0x2c0c('0x42'),_0x3083f4);}else{return null;}}return _0x98e097[_0x2c0c('0x1e')](_[_0x2c0c('0x47')](_0x3fbe98[_0x2c0c('0x3f')]))[_0x2c0c('0x48')](_0x4f975f)[_0x2c0c('0x24')](function(_0x4616a2){return BPromise[_0x2c0c('0x28')]({'id':_0x4616a2['id'],'endUserType':_0x3fbe98[_0x2c0c('0x3f')]});});}});}function getCustomFields(_0x423c33,_0x22c886){var _0xecc5c3={};if(_0x423c33[_0x2c0c('0x25')]>0x0){_['forEach'](_0x423c33,function(_0x226792){if(_[_0x2c0c('0x49')]([_0x2c0c('0x4a'),'picklist'],_0x226792['type'])&&_0x226792[_0x2c0c('0x4b')]){_0xecc5c3[_0x226792[_0x2c0c('0x4b')]]=_0x226792[_0x2c0c('0x4c')][_0x2c0c('0x4d')]();}else if(_0x226792['type']===_0x2c0c('0x4e')&&_0x226792['variableName']&&_0x226792[_0x2c0c('0x4b')]){_0x22c886[_0x226792['variableName']]&&(_0xecc5c3[_0x226792[_0x2c0c('0x4b')]]=_0x22c886[_0x226792[_0x2c0c('0x4f')]][_0x2c0c('0x4d')]());}else if(_0x226792[_0x2c0c('0x3d')]===_0x2c0c('0x50')&&_0x226792[_0x2c0c('0x51')]&&_0x226792[_0x2c0c('0x51')]['name']&&_0x226792[_0x2c0c('0x4b')]){_0x22c886[_0x226792[_0x2c0c('0x51')][_0x2c0c('0x52')][_0x2c0c('0x53')]()]&&(_0xecc5c3[_0x226792['idField']]=_0x22c886[_0x226792[_0x2c0c('0x51')][_0x2c0c('0x52')]['toLowerCase']()]['toString']());}});}return _0xecc5c3;}function getConnection(_0x204b48){var _0x4fb9df=_0x204b48[_0x2c0c('0x54')]['concat'](_0x204b48[_0x2c0c('0x55')]);var _0x39d202=new jsforce[(_0x2c0c('0x56'))]({'oauth2':{'loginUrl':_0x204b48[_0x2c0c('0x57')]||_0x2c0c('0x58'),'clientId':_0x204b48[_0x2c0c('0x59')],'clientSecret':_0x204b48['clientSecret']}});return _0x39d202[_0x2c0c('0x5a')](_0x204b48[_0x2c0c('0x5b')],_0x4fb9df)['then'](function(){logger[_0x2c0c('0x26')](_0x2c0c('0x5c'));return _0x39d202;});}exports['queue']=function(_0x50417b,_0x31c5ff,_0x4deb5b,_0x1629be,_0x3e753b,_0x61a607){var _0x5f1af9,_0x492124,_0xbe37ba,_0x565800;_0x61a607[_0x2c0c('0x5d')]=intUtil[_0x2c0c('0x5e')](_0x61a607[_0x2c0c('0x5d')]);_0x61a607['remoteUri']=intUtil['stripTrailingSlash'](_0x61a607[_0x2c0c('0x57')]);if(_0x3e753b&&_0x3e753b['monitor_format']){logger[_0x2c0c('0x26')]('[QUEUE]','Recording\x20is\x20enabled!');_0x31c5ff[_0x2c0c('0x5f')]=util['format'](_0x2c0c('0x60'),_0x61a607[_0x2c0c('0x5d')],_0x31c5ff[_0x2c0c('0x61')],md5(_0x31c5ff[_0x2c0c('0x61')]));}else{_0x31c5ff[_0x2c0c('0x5f')]='';}return getConnection(_0x61a607)[_0x2c0c('0x24')](function(_0x2fbb4f){_0x565800=_0x2fbb4f;return getUser(_0x61a607,_0x1629be['email'],_0x565800);})[_0x2c0c('0x24')](function(_0x23a012){_0x5f1af9=_0x23a012;return getEndUser(_0x61a607,_0x4deb5b,_0x31c5ff['calleridname'],_0x31c5ff[_0x2c0c('0x62')],_0x565800);})[_0x2c0c('0x24')](function(_0x25d7d5){_0x492124=_0x25d7d5;return getTicket(_0x61a607,_0x5f1af9,_0x492124,_0x4deb5b,_0x31c5ff,_0x4deb5b[_0x2c0c('0x63')],_0x565800,_0x2c0c('0x64'));})[_0x2c0c('0x24')](function(_0x14713c){_0xbe37ba=_0x14713c;logger[_0x2c0c('0x26')](_0x2c0c('0x65'),_0xbe37ba['id']);logger[_0x2c0c('0x26')](_0x2c0c('0x66'),_0xbe37ba['id'],_0x1629be[_0x2c0c('0x52')],_0x61a607[_0x2c0c('0x3d')]);switch(_0x61a607[_0x2c0c('0x3d')]){case _0x2c0c('0x67'):emit(util['format'](_0x2c0c('0x68'),_0x1629be[_0x2c0c('0x52')]),'trigger:salesforce:display',{'recordId':_0xbe37ba['id']});break;case _0x2c0c('0x69'):emit(util[_0x2c0c('0x41')](_0x2c0c('0x68'),_0x1629be['name']),_0x2c0c('0x6a'),{'uri':util[_0x2c0c('0x41')](_0x2c0c('0x6b'),_0x565800['instanceUrl'],_0xbe37ba['id'])});break;default:logger[_0x2c0c('0x6c')](_0x2c0c('0x6d'));}})['catch'](function(_0x5e1458){logger['error'](_0x2c0c('0x6e'),_0x5e1458);});};exports['outbound']=function(_0x20a8ec,_0x4b0093,_0x138a55,_0x83e78f,_0x285be8,_0xaaa1af,_0x1170cc){var _0x50879a,_0x3209d5,_0x20b5d4,_0x251c29;_0xaaa1af[_0x2c0c('0x5d')]=intUtil['stripTrailingSlash'](_0xaaa1af['serverUrl']);_0xaaa1af[_0x2c0c('0x57')]=intUtil[_0x2c0c('0x5e')](_0xaaa1af['remoteUri']);if(_0x1170cc&&_0x1170cc[_0x2c0c('0x6f')]&&_0x1170cc[_0x2c0c('0x6f')]!==_0x2c0c('0x70')){logger[_0x2c0c('0x26')](_0x2c0c('0x71'),'Recording\x20is\x20enabled!');_0x4b0093[_0x2c0c('0x5f')]=util[_0x2c0c('0x41')](_0x2c0c('0x60'),_0xaaa1af[_0x2c0c('0x5d')],_0x4b0093[_0x2c0c('0x61')],md5(_0x4b0093[_0x2c0c('0x61')]));}return getConnection(_0xaaa1af)[_0x2c0c('0x24')](function(_0x49f23d){_0x251c29=_0x49f23d;return getUser(_0xaaa1af,_0x83e78f['email'],_0x251c29);})['then'](function(_0x5352e6){_0x50879a=_0x5352e6;return getEndUser(_0xaaa1af,_0x138a55,_0x4b0093[_0x2c0c('0x72')],_0x4b0093['destcalleridnum'],_0x251c29);})['then'](function(_0x1f5bc5){_0x3209d5=_0x1f5bc5;return getTicket(_0xaaa1af,_0x50879a,_0x3209d5,_0x138a55,_0x4b0093,_0x138a55['Fields'],_0x251c29,'outbound');})[_0x2c0c('0x24')](function(_0x146205){_0x20b5d4=_0x146205;logger[_0x2c0c('0x26')](_0x2c0c('0x73'),_0x20b5d4['id']);logger[_0x2c0c('0x26')](_0x2c0c('0x74'),_0x20b5d4['id'],_0x83e78f['name'],_0xaaa1af[_0x2c0c('0x3d')]);switch(_0xaaa1af[_0x2c0c('0x3d')]){case _0x2c0c('0x67'):emit(util[_0x2c0c('0x41')]('user:%s',_0x83e78f['name']),_0x2c0c('0x75'),{'recordId':_0x20b5d4['id']});break;case'newTab':emit(util[_0x2c0c('0x41')](_0x2c0c('0x68'),_0x83e78f['name']),_0x2c0c('0x6a'),{'uri':util[_0x2c0c('0x41')](_0x2c0c('0x6b'),_0x251c29['instanceUrl'],_0x20b5d4['id'])});break;default:logger[_0x2c0c('0x6c')](_0x2c0c('0x71'),_0x2c0c('0x76'));}})[_0x2c0c('0x77')](function(_0x529822){logger[_0x2c0c('0x6c')](_0x2c0c('0x71'),_0x529822);});};exports[_0x2c0c('0x78')]=function(_0x1916bc,_0x32aaa8,_0x4c2909,_0x205c18,_0x29da67,_0x1e8de8){var _0xe80dc4,_0x57d222,_0x13be53,_0x388e5b;_0x1e8de8[_0x2c0c('0x5d')]=intUtil[_0x2c0c('0x5e')](_0x1e8de8['serverUrl']);_0x1e8de8['remoteUri']=intUtil[_0x2c0c('0x5e')](_0x1e8de8['remoteUri']);if(_0x29da67&&_0x29da67[_0x2c0c('0x79')]){logger[_0x2c0c('0x26')]('['+_0x32aaa8[_0x2c0c('0x7a')]['toUpperCase']()+']',_0x2c0c('0x7b'));_0x32aaa8[_0x2c0c('0x5f')]=util[_0x2c0c('0x41')](_0x2c0c('0x60'),_0x1e8de8[_0x2c0c('0x5d')],_0x32aaa8['uniqueid'],md5(_0x32aaa8[_0x2c0c('0x61')]));}else{_0x32aaa8[_0x2c0c('0x5f')]='';}return getConnection(_0x1e8de8)[_0x2c0c('0x24')](function(_0x1da3b1){_0x388e5b=_0x1da3b1;if(!_[_0x2c0c('0x7c')](_0x205c18)){return getUser(_0x1e8de8,_0x205c18[_0x2c0c('0x52')],_0x388e5b);}else{return getUser(_0x1e8de8,null,_0x388e5b);}})['then'](function(_0x18a2e5){_0xe80dc4=_0x18a2e5;return getEndUser(_0x1e8de8,_0x4c2909,_0x32aaa8[_0x2c0c('0x7d')],_0x32aaa8[_0x2c0c('0x62')],_0x388e5b);})[_0x2c0c('0x24')](function(_0x332613){_0x57d222=_0x332613;return getTicket(_0x1e8de8,_0xe80dc4,_0x57d222,_0x4c2909,_0x32aaa8,_0x4c2909[_0x2c0c('0x63')],_0x388e5b);})[_0x2c0c('0x24')](function(_0x16585b){_0x13be53=_0x16585b;logger[_0x2c0c('0x26')]('['+_0x32aaa8['lastevent'][_0x2c0c('0x7e')]()+']\x20Ticket\x20%s\x20created.',_0x13be53['id']);logger[_0x2c0c('0x26')]('['+_0x32aaa8['lastevent'][_0x2c0c('0x7e')]()+']\x20Integration\x20account\x20type\x20%s.',_0x1e8de8[_0x2c0c('0x3d')]);})[_0x2c0c('0x77')](function(_0x550cc6){logger[_0x2c0c('0x6c')]('['+_0x32aaa8[_0x2c0c('0x7a')][_0x2c0c('0x7e')]()+']',_0x550cc6);});}; \ 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 f65b066..26ee431 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 _0xabc3=['outbound','assign','getString',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','label','?sysparm_query=name%3D','incident','Incident\x20-\x20','push',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','emit','trigger:browser:url','username','password','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','calleridnum','callDirection','unmanaged','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','The\x20ticket\x20ID\x20is:\x20%s','lodash','request-promise','util','ioredis','../../../../config/environment','servicenow','redis','defaults','localhost','socket.io-emitter','GET','then','result','adminId','sys_id','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','info','],\x20getUser\x20input\x20crm','validateEmail','sys_user?sysparm_query=email%3D','userEmail','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','length','active','true','userId','adminEmail',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','endUserId','],\x20createEndUser\x20crm','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','toString','idField','variableName','Variable','name',']\x20getTicket\x20input\x20crm'];(function(_0x4a7311,_0x5f16f8){var _0x2f36a3=function(_0x581eeb){while(--_0x581eeb){_0x4a7311['push'](_0x4a7311['shift']());}};_0x2f36a3(++_0x5f16f8);}(_0xabc3,0xe0));var _0x3abc=function(_0x1c5e6b,_0x1de58e){_0x1c5e6b=_0x1c5e6b-0x0;var _0x1da34f=_0xabc3[_0x1c5e6b];return _0x1da34f;};'use strict';var _=require(_0x3abc('0x0'));var Promise=require('bluebird');var rp=require(_0x3abc('0x1'));var util=require(_0x3abc('0x2'));var md5=require('md5');var Redis=require(_0x3abc('0x3'));var intUtil=require('./util');var config=require(_0x3abc('0x4'));var logger=require('../../../../config/logger')(_0x3abc('0x5'));config[_0x3abc('0x6')]=_[_0x3abc('0x7')](config['redis'],{'host':_0x3abc('0x8'),'port':0x18eb});var io=require(_0x3abc('0x9'))(new Redis(config[_0x3abc('0x6')]));function getAdminUser(_0x16a9a4,_0x20ac56,_0x37fee1,_0x2fb0f2,_0x390f76,_0x47ccf7){return new Promise(function(_0xf81f87,_0x4f33a4){var _0x2b02a7={'method':_0x3abc('0xa'),'uri':_0x2fb0f2+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x390f76+'&'+_0x47ccf7,'auth':_0x20ac56,'json':!![]};return rp(_0x2b02a7)[_0x3abc('0xb')](function(_0x2f402b){if(_0x2f402b[_0x3abc('0xc')]['length']>0x0){_0x37fee1[_0x3abc('0xd')]=_0x2f402b[_0x3abc('0xc')][0x0][_0x3abc('0xe')];}logger['info']('['+[_0x16a9a4[_0x3abc('0xf')]()]+_0x3abc('0x10'),_0x37fee1);_0xf81f87(_0x37fee1);})[_0x3abc('0x11')](function(_0x4cc30e){logger[_0x3abc('0x12')]('['+[_0x16a9a4[_0x3abc('0xf')]()]+']',_0x4cc30e[_0x3abc('0x13')]);_0x4f33a4(_0x4cc30e[_0x3abc('0x13')]);});});}function getUser(_0x30dc31,_0x197b42,_0x4fdf21,_0x419647,_0x5da8ea){return function(_0x34f715){logger[_0x3abc('0x14')]('['+[_0x30dc31[_0x3abc('0xf')]()]+_0x3abc('0x15'),_0x34f715);return new Promise(function(_0x3e5237,_0x242427){if(intUtil[_0x3abc('0x16')](_0x34f715['userEmail'])){var _0x1acd2f={'method':'GET','uri':_0x4fdf21+_0x3abc('0x17')+_0x34f715[_0x3abc('0x18')]+'&'+_0x419647+'&'+_0x5da8ea,'auth':_0x197b42,'json':!![]};logger[_0x3abc('0x14')]('['+[_0x30dc31[_0x3abc('0xf')]()]+_0x3abc('0x19'),_0x1acd2f);return rp(_0x1acd2f)['then'](function(_0x340dfd){logger['info']('['+[_0x30dc31[_0x3abc('0xf')]()]+_0x3abc('0x1a'),_0x340dfd);if(_0x340dfd['result'][_0x3abc('0x1b')]>0x0&&String(_0x340dfd[_0x3abc('0xc')][0x0][_0x3abc('0x1c')])===_0x3abc('0x1d')){_0x34f715[_0x3abc('0x1e')]=_0x340dfd[_0x3abc('0xc')][0x0][_0x3abc('0xe')];}else{_0x34f715['userId']=_0x34f715[_0x3abc('0xd')];_0x34f715['userEmail']=_0x34f715[_0x3abc('0x1f')];}logger['info']('['+[_0x30dc31['toUpperCase']()]+'],\x20getUser\x20crm',_0x34f715);_0x3e5237(_0x34f715);})[_0x3abc('0x11')](function(_0x233d13){logger[_0x3abc('0x12')]('['+[_0x30dc31['toUpperCase']()]+']',_0x233d13[_0x3abc('0x13')]);_0x242427(_0x233d13['message']);});}else{logger['info']('['+[_0x30dc31[_0x3abc('0xf')]()]+_0x3abc('0x20'));_0x34f715[_0x3abc('0x1e')]=_0x34f715['adminId'];_0x34f715[_0x3abc('0x18')]=_0x34f715[_0x3abc('0x1f')];_0x3e5237(_0x34f715);}});};}function createEndUser(_0x32a19d,_0x18480c,_0x370eef,_0x2e6e7e,_0x3fc063){logger[_0x3abc('0x14')]('['+[_0x32a19d['toUpperCase']()]+_0x3abc('0x21'),_0x370eef);return new Promise(function(_0x4c5cfa,_0x1474f5){var _0x5c6a62={'method':_0x3abc('0x22'),'uri':_0x2e6e7e+_0x3abc('0x23')+_0x3fc063,'body':{'user_name':_0x370eef[_0x3abc('0x24')],'roles':'user','first_name':_0x370eef[_0x3abc('0x24')],'active':_0x3abc('0x1d'),'date_format':'System','phone':_0x370eef['endUserNumber']},'auth':_0x18480c,'json':!![]};return rp(_0x5c6a62)[_0x3abc('0xb')](function(_0x4d9da9){logger[_0x3abc('0x14')]('['+[_0x32a19d[_0x3abc('0xf')]()]+'],\x20EndUser\x20schema',_0x4d9da9['result']);_0x370eef['endUserId']=_0x4d9da9[_0x3abc('0xc')]['sys_id'];_0x4c5cfa(_0x370eef);})[_0x3abc('0x11')](function(_0x3a597f){logger[_0x3abc('0x12')]('['+[_0x32a19d[_0x3abc('0xf')]()]+']',_0x3a597f[_0x3abc('0x13')]);_0x1474f5(_0x3a597f[_0x3abc('0x13')]);});});}function getEndUser(_0x1cbb3c,_0x2521ae,_0x7957a,_0x2e880b,_0x1c055e){return function(_0x1047e8){logger[_0x3abc('0x14')]('['+[_0x1cbb3c['toUpperCase']()]+_0x3abc('0x25'),_0x1047e8);return new Promise(function(_0x2dc722,_0x317174){var _0x5eb021={'method':'GET','uri':_0x7957a+_0x3abc('0x26')+_0x1047e8[_0x3abc('0x24')]+'&'+_0x2e880b+'&'+_0x1c055e,'auth':_0x2521ae,'json':!![]};return rp(_0x5eb021)[_0x3abc('0xb')](function(_0x87673b){if(_0x87673b[_0x3abc('0xc')][_0x3abc('0x1b')]>0x0){_0x1047e8[_0x3abc('0x27')]=_0x87673b[_0x3abc('0xc')][0x0]['sys_id'];logger[_0x3abc('0x14')]('['+[_0x1cbb3c[_0x3abc('0xf')]()]+'],\x20getEndUser\x20crm',_0x1047e8);_0x2dc722(_0x1047e8);}else{return createEndUser(_0x1cbb3c,_0x2521ae,_0x1047e8,_0x7957a,_0x2e880b)['then'](function(_0x500a14){logger[_0x3abc('0x14')]('['+[_0x1cbb3c[_0x3abc('0xf')]()]+_0x3abc('0x28'),_0x500a14);_0x2dc722(_0x500a14);});}})['catch'](function(_0x44cf7b){logger[_0x3abc('0x12')]('['+[_0x1cbb3c['toUpperCase']()]+']',_0x44cf7b[_0x3abc('0x13')]);_0x317174(_0x44cf7b[_0x3abc('0x13')]);});});};}function getCustomFields(_0x19099d,_0x5e2682){var _0x4e7f33={};if(_0x19099d['length']>0x0){_[_0x3abc('0x29')](_0x19099d,function(_0x338680){if(_[_0x3abc('0x2a')]([_0x3abc('0x2b'),_0x3abc('0x2c')],_0x338680[_0x3abc('0x2d')])&&_0x338680[_0x3abc('0x2e')]&&!_0x338680[_0x3abc('0x2f')]){_0x4e7f33[_0x338680[_0x3abc('0x2e')][_0x3abc('0x30')]()]=_0x338680['content'][_0x3abc('0x31')]();}else if(_[_0x3abc('0x2a')]([_0x3abc('0x2b'),'picklist'],_0x338680[_0x3abc('0x2d')])&&_0x338680[_0x3abc('0x32')]&&_0x338680['customField']){_0x4e7f33[_0x338680[_0x3abc('0x32')][_0x3abc('0x30')]()]=_0x338680['content'][_0x3abc('0x31')]();}else if(_0x338680[_0x3abc('0x2d')]==='variable'&&_0x338680['variableName']&&_0x338680[_0x3abc('0x32')]&&_0x338680[_0x3abc('0x2f')]){_0x4e7f33[_0x338680['idField'][_0x3abc('0x30')]()]=_0x5e2682[_0x338680[_0x3abc('0x33')]][_0x3abc('0x31')]();}else if(_0x338680[_0x3abc('0x2d')]==='customVariable'&&_0x338680[_0x3abc('0x34')]&&_0x338680[_0x3abc('0x34')][_0x3abc('0x35')]&&_0x338680['idField']&&_0x338680['customField']){_0x4e7f33[_0x338680[_0x3abc('0x32')][_0x3abc('0x30')]()]=_0x5e2682[_0x338680[_0x3abc('0x34')][_0x3abc('0x35')][_0x3abc('0x30')]()][_0x3abc('0x31')]();}});}return _0x4e7f33;}function getTicket(_0x2f546e,_0x25db7d,_0x7abd7d,_0x43174b,_0x55b010,_0x21725e){return function(_0x4782c4){logger[_0x3abc('0x14')]('['+[_0x2f546e['toUpperCase']()]+_0x3abc('0x36'),_0x4782c4);return new Promise(function(_0x28f62b,_0x490230){var _0x2c9f48=_0x2f546e[_0x3abc('0x30')]()===_0x3abc('0x37')?_0x4782c4[_0x3abc('0x1e')]:_0x4782c4[_0x3abc('0x27')];var _0xb18a76={'method':_0x3abc('0x22'),'uri':_0x7abd7d+'incident'+'?'+_0x21725e,'body':Object[_0x3abc('0x38')]({},{'active':_0x3abc('0x1d'),'caller_id':_0x2c9f48,'assigned_to':_0x4782c4[_0x3abc('0x1e')],'short_description':intUtil[_0x3abc('0x39')](_0x43174b['Subjects'],_0x55b010,'\x20'),'description':intUtil[_0x3abc('0x39')](_0x43174b['Descriptions'],_0x55b010,'\x0a')},getCustomFields(_0x43174b['Fields'],_0x55b010)),'auth':_0x25db7d,'json':!![]};return rp(_0xb18a76)[_0x3abc('0xb')](function(_0x17c669){logger[_0x3abc('0x14')]('['+[_0x2f546e[_0x3abc('0xf')]()]+_0x3abc('0x3a'),_0x17c669[_0x3abc('0xc')]);_0x4782c4[_0x3abc('0x3b')]=_0x17c669[_0x3abc('0xc')][_0x3abc('0xe')];_0x4782c4[_0x3abc('0x3c')]=_0x17c669[_0x3abc('0xc')]['number'];logger[_0x3abc('0x14')]('['+[_0x2f546e['toUpperCase']()]+']\x20getTicket\x20crm',_0x4782c4);_0x28f62b(_0x4782c4);})[_0x3abc('0x11')](function(_0x7c8588){logger[_0x3abc('0x12')]('['+[_0x2f546e[_0x3abc('0xf')]()]+']',_0x7c8588[_0x3abc('0x13')]);_0x490230(_0x7c8588[_0x3abc('0x13')]);});});};}function createRemoteTag(_0x12953f,_0x298b79,_0x243282,_0x270dc9){return new Promise(function(_0x568ebf,_0x1f2b07){var _0x212b46={'method':_0x3abc('0x22'),'uri':_0x243282+_0x3abc('0x3d')+'?'+_0x270dc9,'body':{'short_description':_0x12953f,'global':!![],'active':!![],'name':_0x12953f},'auth':_0x298b79,'json':!![]};return rp(_0x212b46)['then'](function(_0x10be13){var _0x5bf6a2=_0x10be13['result'][_0x3abc('0xe')];_0x568ebf(_0x5bf6a2);});});}function getRemoteTag(_0x52a925,_0x27127f,_0x42acd3,_0x29fbe,_0x378ea9){return new Promise(function(_0x292902,_0x1268b9){var _0x34e1df={'method':'GET','uri':_0x42acd3+_0x3abc('0x3d')+_0x3abc('0x3e')+_0x52a925+'&'+_0x29fbe,'auth':_0x27127f,'json':!![]};return rp(_0x34e1df)['then'](function(_0x5cb5e0){if(_0x5cb5e0[_0x3abc('0xc')][_0x3abc('0x1b')]>0x0){var _0x44b629=_0x5cb5e0[_0x3abc('0xc')][0x0][_0x3abc('0xe')];_0x292902(_0x44b629);}else{return createRemoteTag(_0x52a925,_0x27127f,_0x42acd3,_0x29fbe)['then'](function(_0x28efb6){_0x292902(_0x28efb6);});}});});}function assignTagToIncident(_0x3d6b40,_0x4c5d55,_0x2c6d58,_0x5b2589,_0x19d457){return new Promise(function(_0x35e9f4,_0x2d69fe){var _0x33cf18={'method':_0x3abc('0x22'),'uri':_0x2c6d58+'label_entry'+'?'+_0x19d457,'body':{'label':_0x3d6b40,'table':_0x3abc('0x3f'),'id_type':'Incident','table_key':_0x5b2589[_0x3abc('0x3b')],'title':_0x3abc('0x40')+_0x5b2589[_0x3abc('0x3c')],'id_display':_0x5b2589['ticketNumber']},'auth':_0x4c5d55,'json':!![]};return rp(_0x33cf18)[_0x3abc('0xb')](function(_0x1fc0be){_0x35e9f4();})[_0x3abc('0x11')](function(){_0x35e9f4();});});}function manageTags(_0x18a6bf,_0x2891ef,_0xb7c574,_0x52a207,_0x143532,_0x359f97,_0x54c306){return new Promise(function(_0x3b7691,_0x322ffe){var _0xfa3b14=[];_0x2891ef[_0x3abc('0x29')](function(_0x42c4e8){_0xfa3b14[_0x3abc('0x41')](getRemoteTag(_0x42c4e8,_0xb7c574,_0x52a207,_0x359f97,_0x54c306));});return Promise['all'](_0xfa3b14)[_0x3abc('0xb')](function(_0x9d1e53){if(_0x9d1e53[_0x3abc('0x1b')]){logger[_0x3abc('0x14')]('['+[_0x18a6bf[_0x3abc('0xf')]()]+_0x3abc('0x42'),_0x9d1e53);var _0x38a882=[];_0x9d1e53[_0x3abc('0x29')](function(_0x15f16a){_0x38a882['push'](assignTagToIncident(_0x15f16a,_0xb7c574,_0x52a207,_0x143532,_0x359f97));});return Promise['all'](_0x38a882)[_0x3abc('0xb')](function(){_0x3b7691();})[_0x3abc('0x11')](function(){_0x3b7691();});}else{_0x3b7691();}});});}function getTags(_0xe72640,_0x41c18e,_0x19374e,_0x598f9a,_0x43169b,_0x3c1f76){return function(_0x3fdd6f){return new Promise(function(_0x46c739,_0x1f5e61){var _0x2c35e5=[];var _0x5a06f7=_0x598f9a['Tags'];if(_0x5a06f7&&_0x5a06f7['length']>0x0){_0x2c35e5=_[_0x3abc('0x43')](_0x5a06f7,'name');}if(_0x2c35e5[_0x3abc('0x1b')]>0x0){return manageTags(_0xe72640,_0x2c35e5,_0x41c18e,_0x19374e,_0x3fdd6f,_0x43169b,_0x3c1f76)['then'](function(){_0x46c739(_0x3fdd6f);});}else{_0x46c739(_0x3fdd6f);}});};}function emit(_0x38d5f7,_0x214c49,_0xb3f46){var _0x459a5b=_0x3abc('0x44')+_0x3abc('0x45')+_0x3abc('0x46')+_0x3abc('0x47');var _0x1dd5c0={'uri':_0x38d5f7+_0x3abc('0x48')+_0xb3f46+_0x459a5b};io['to'](util[_0x3abc('0x49')]('user:%s',_0x214c49))[_0x3abc('0x4a')](_0x3abc('0x4b'),_0x1dd5c0);}exports['cs']=function(_0x2a3c19,_0x4989cf,_0xb78938,_0x4c4c3b,_0x18779d,_0x32a642,_0x157645,_0x3456d4){var _0x388f72={};var _0x247567={'user':_0x32a642[_0x3abc('0x4c')],'pass':_0x32a642[_0x3abc('0x4d')]};var _0x2d9a26='sysparm_limit=1';var _0x22430a='sysparm_display_value=true';_0x32a642[_0x3abc('0x4e')]=intUtil[_0x3abc('0x4f')](_0x32a642[_0x3abc('0x4e')]);_0x32a642[_0x3abc('0x50')]=intUtil[_0x3abc('0x4f')](_0x32a642[_0x3abc('0x50')]);var _0x42dc3a=util[_0x3abc('0x49')](_0x3abc('0x51'),_0x32a642[_0x3abc('0x4e')]);_0x388f72[_0x3abc('0x18')]=!_[_0x3abc('0x52')](_0x4c4c3b)?_0x4c4c3b['email']:null;_0x388f72[_0x3abc('0x1f')]=_0x32a642['email'];_0x388f72[_0x3abc('0x24')]=_0x3456d4['toLowerCase']()==='outbound'?_0x4989cf['destcalleridnum']:_0x4989cf[_0x3abc('0x53')];_0x388f72[_0x3abc('0x54')]=_0x3456d4==='queue'||_0x3456d4===_0x3abc('0x55')?'queue':_0x3abc('0x37');var _0x5dac33=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x32a642['serverUrl'],_0x4989cf[_0x3abc('0x56')],md5(_0x4989cf[_0x3abc('0x56')]));if(_0x18779d&&_0x18779d[_0x3abc('0x57')]){logger[_0x3abc('0x14')](_0x3abc('0x58'),_0x3abc('0x59'));_0x4989cf[_0x3abc('0x5a')]=_0x5dac33;}else if(_0x157645&&_0x157645[_0x3abc('0x5b')]&&_0x157645['recordingFormat']!=='none'){logger[_0x3abc('0x14')]('[OUTBOUND]',_0x3abc('0x59'));_0x4989cf[_0x3abc('0x5a')]=_0x5dac33;}else{_0x4989cf[_0x3abc('0x5a')]='';}return getAdminUser(_0x3456d4,_0x247567,_0x388f72,_0x42dc3a,_0x22430a,_0x2d9a26)[_0x3abc('0xb')](getUser(_0x3456d4,_0x247567,_0x42dc3a,_0x22430a,_0x2d9a26))['then'](getEndUser(_0x3456d4,_0x247567,_0x42dc3a,_0x22430a,_0x2d9a26))['then'](getTicket(_0x3456d4,_0x247567,_0x42dc3a,_0xb78938,_0x4989cf,_0x22430a))[_0x3abc('0xb')](function(_0x3f0361){logger[_0x3abc('0x14')](util[_0x3abc('0x49')](_0x3abc('0x5c'),_0x3f0361['ticketId']));logger['info'](util[_0x3abc('0x49')]('call\x20direction:\x20%s',_0x3456d4));if(_0x3456d4!==_0x3abc('0x55')){logger[_0x3abc('0x14')]('['+[_0x3456d4[_0x3abc('0xf')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x32a642[_0x3abc('0x4e')],_0x4c4c3b[_0x3abc('0x35')],_0x3f0361[_0x3abc('0x3b')]);}})['catch'](function(_0x1d557e){logger[_0x3abc('0x12')]('['+[_0x3456d4[_0x3abc('0xf')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util['inspect'](_0x1d557e,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x0f35=['email','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','bluebird','util','md5','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','info','],\x20getAdminUser\x20crm','message','toUpperCase','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','true','sys_id','adminEmail','],\x20getUser\x20crm','error',']\x20using\x20admin\x20profile','userId','],\x20createEndUser\x20input\x20crm','POST','sys_user?','user','endUserNumber','System','],\x20EndUser\x20schema','endUserId','catch','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','picklist','customField','toLowerCase','toString','type','idField','content','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','getString','Subjects','Fields',']\x20POST\x20incident\x20entity\x20schema','number','label','?sysparm_query=name%3D','label_entry','Incident','ticketId','Incident\x20-\x20','ticketNumber','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','trigger:browser:url','username','password','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil'];(function(_0x321027,_0x73e5ca){var _0x12d472=function(_0x3e0d81){while(--_0x3e0d81){_0x321027['push'](_0x321027['shift']());}};_0x12d472(++_0x73e5ca);}(_0x0f35,0x79));var _0x50f3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0f35[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x50f3('0x0'));var Promise=require(_0x50f3('0x1'));var rp=require('request-promise');var util=require(_0x50f3('0x2'));var md5=require(_0x50f3('0x3'));var Redis=require('ioredis');var intUtil=require(_0x50f3('0x4'));var config=require(_0x50f3('0x5'));var logger=require(_0x50f3('0x6'))(_0x50f3('0x7'));config[_0x50f3('0x8')]=_[_0x50f3('0x9')](config[_0x50f3('0x8')],{'host':_0x50f3('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x50f3('0x8')]));function getAdminUser(_0x110598,_0x543f93,_0x5c4c35,_0x94b551,_0x4e361d,_0x4dff6b){return new Promise(function(_0x33ea22,_0x33050e){var _0x59fe03={'method':_0x50f3('0xb'),'uri':_0x94b551+_0x50f3('0xc')+'&'+_0x4e361d+'&'+_0x4dff6b,'auth':_0x543f93,'json':!![]};return rp(_0x59fe03)[_0x50f3('0xd')](function(_0x4d6672){if(_0x4d6672[_0x50f3('0xe')][_0x50f3('0xf')]>0x0){_0x5c4c35[_0x50f3('0x10')]=_0x4d6672[_0x50f3('0xe')][0x0]['sys_id'];}logger[_0x50f3('0x11')]('['+[_0x110598['toUpperCase']()]+_0x50f3('0x12'),_0x5c4c35);_0x33ea22(_0x5c4c35);})['catch'](function(_0x5185cd){logger['error']('['+[_0x110598['toUpperCase']()]+']',_0x5185cd['message']);_0x33050e(_0x5185cd[_0x50f3('0x13')]);});});}function getUser(_0x112009,_0x1062a4,_0x2407a8,_0x3d6e8e,_0x46f7e8){return function(_0x538315){logger['info']('['+[_0x112009[_0x50f3('0x14')]()]+'],\x20getUser\x20input\x20crm',_0x538315);return new Promise(function(_0x551bc9,_0x2b551a){if(intUtil[_0x50f3('0x15')](_0x538315[_0x50f3('0x16')])){var _0x257c49={'method':_0x50f3('0xb'),'uri':_0x2407a8+_0x50f3('0x17')+_0x538315[_0x50f3('0x16')]+'&'+_0x3d6e8e+'&'+_0x46f7e8,'auth':_0x1062a4,'json':!![]};logger[_0x50f3('0x11')]('['+[_0x112009[_0x50f3('0x14')]()]+_0x50f3('0x18'),_0x257c49);return rp(_0x257c49)['then'](function(_0x5c8a67){logger[_0x50f3('0x11')]('['+[_0x112009['toUpperCase']()]+_0x50f3('0x19'),_0x5c8a67);if(_0x5c8a67[_0x50f3('0xe')][_0x50f3('0xf')]>0x0&&String(_0x5c8a67[_0x50f3('0xe')][0x0]['active'])===_0x50f3('0x1a')){_0x538315['userId']=_0x5c8a67['result'][0x0][_0x50f3('0x1b')];}else{_0x538315['userId']=_0x538315[_0x50f3('0x10')];_0x538315['userEmail']=_0x538315[_0x50f3('0x1c')];}logger[_0x50f3('0x11')]('['+[_0x112009['toUpperCase']()]+_0x50f3('0x1d'),_0x538315);_0x551bc9(_0x538315);})['catch'](function(_0x2b68d6){logger[_0x50f3('0x1e')]('['+[_0x112009[_0x50f3('0x14')]()]+']',_0x2b68d6[_0x50f3('0x13')]);_0x2b551a(_0x2b68d6['message']);});}else{logger[_0x50f3('0x11')]('['+[_0x112009[_0x50f3('0x14')]()]+_0x50f3('0x1f'));_0x538315[_0x50f3('0x20')]=_0x538315['adminId'];_0x538315['userEmail']=_0x538315[_0x50f3('0x1c')];_0x551bc9(_0x538315);}});};}function createEndUser(_0x341f77,_0x36b734,_0x3623bb,_0x41753b,_0x394820){logger[_0x50f3('0x11')]('['+[_0x341f77['toUpperCase']()]+_0x50f3('0x21'),_0x3623bb);return new Promise(function(_0x2aaa8f,_0x6a2b51){var _0x44fffe={'method':_0x50f3('0x22'),'uri':_0x41753b+_0x50f3('0x23')+_0x394820,'body':{'user_name':_0x3623bb['endUserNumber'],'roles':_0x50f3('0x24'),'first_name':_0x3623bb[_0x50f3('0x25')],'active':'true','date_format':_0x50f3('0x26'),'phone':_0x3623bb[_0x50f3('0x25')]},'auth':_0x36b734,'json':!![]};return rp(_0x44fffe)[_0x50f3('0xd')](function(_0x351b2e){logger[_0x50f3('0x11')]('['+[_0x341f77[_0x50f3('0x14')]()]+_0x50f3('0x27'),_0x351b2e[_0x50f3('0xe')]);_0x3623bb[_0x50f3('0x28')]=_0x351b2e[_0x50f3('0xe')]['sys_id'];_0x2aaa8f(_0x3623bb);})[_0x50f3('0x29')](function(_0x28b89d){logger[_0x50f3('0x1e')]('['+[_0x341f77[_0x50f3('0x14')]()]+']',_0x28b89d['message']);_0x6a2b51(_0x28b89d[_0x50f3('0x13')]);});});}function getEndUser(_0xd75f4,_0x9b7103,_0x1df789,_0x29d2f1,_0xf848bf){return function(_0x1f0e0a){logger[_0x50f3('0x11')]('['+[_0xd75f4[_0x50f3('0x14')]()]+'],\x20getEndUser\x20input\x20crm',_0x1f0e0a);return new Promise(function(_0x408c44,_0xa551d9){var _0xc4a51f={'method':_0x50f3('0xb'),'uri':_0x1df789+'sys_user?sysparm_query=phone%3D'+_0x1f0e0a[_0x50f3('0x25')]+'&'+_0x29d2f1+'&'+_0xf848bf,'auth':_0x9b7103,'json':!![]};return rp(_0xc4a51f)['then'](function(_0x3576cd){if(_0x3576cd[_0x50f3('0xe')]['length']>0x0){_0x1f0e0a[_0x50f3('0x28')]=_0x3576cd[_0x50f3('0xe')][0x0]['sys_id'];logger['info']('['+[_0xd75f4[_0x50f3('0x14')]()]+_0x50f3('0x2a'),_0x1f0e0a);_0x408c44(_0x1f0e0a);}else{return createEndUser(_0xd75f4,_0x9b7103,_0x1f0e0a,_0x1df789,_0x29d2f1)[_0x50f3('0xd')](function(_0x4bb60c){logger[_0x50f3('0x11')]('['+[_0xd75f4[_0x50f3('0x14')]()]+_0x50f3('0x2b'),_0x4bb60c);_0x408c44(_0x4bb60c);});}})[_0x50f3('0x29')](function(_0x16bb48){logger[_0x50f3('0x1e')]('['+[_0xd75f4['toUpperCase']()]+']',_0x16bb48['message']);_0xa551d9(_0x16bb48[_0x50f3('0x13')]);});});};}function getCustomFields(_0x31a85c,_0x541b7c){var _0x5d85ef={};if(_0x31a85c[_0x50f3('0xf')]>0x0){_[_0x50f3('0x2c')](_0x31a85c,function(_0x42c161){if(_[_0x50f3('0x2d')]([_0x50f3('0x2e'),_0x50f3('0x2f')],_0x42c161['type'])&&_0x42c161['nameField']&&!_0x42c161[_0x50f3('0x30')]){_0x5d85ef[_0x42c161['nameField'][_0x50f3('0x31')]()]=_0x42c161['content'][_0x50f3('0x32')]();}else if(_[_0x50f3('0x2d')]([_0x50f3('0x2e'),'picklist'],_0x42c161[_0x50f3('0x33')])&&_0x42c161['idField']&&_0x42c161[_0x50f3('0x30')]){_0x5d85ef[_0x42c161[_0x50f3('0x34')][_0x50f3('0x31')]()]=_0x42c161[_0x50f3('0x35')]['toString']();}else if(_0x42c161[_0x50f3('0x33')]==='variable'&&_0x42c161[_0x50f3('0x36')]&&_0x42c161['idField']&&_0x42c161[_0x50f3('0x30')]){_0x5d85ef[_0x42c161[_0x50f3('0x34')][_0x50f3('0x31')]()]=_0x541b7c[_0x42c161[_0x50f3('0x36')]]['toString']();}else if(_0x42c161[_0x50f3('0x33')]===_0x50f3('0x37')&&_0x42c161[_0x50f3('0x38')]&&_0x42c161[_0x50f3('0x38')][_0x50f3('0x39')]&&_0x42c161[_0x50f3('0x34')]&&_0x42c161[_0x50f3('0x30')]){_0x5d85ef[_0x42c161[_0x50f3('0x34')]['toLowerCase']()]=_0x541b7c[_0x42c161[_0x50f3('0x38')][_0x50f3('0x39')]['toLowerCase']()]['toString']();}});}return _0x5d85ef;}function getTicket(_0x1a4d7e,_0x5184c0,_0x51aeee,_0x318395,_0x9c78eb,_0x92ea8e){return function(_0x3ec24e){logger[_0x50f3('0x11')]('['+[_0x1a4d7e['toUpperCase']()]+_0x50f3('0x3a'),_0x3ec24e);return new Promise(function(_0x4cab17,_0x38bfdc){var _0x3b6f94=_0x1a4d7e[_0x50f3('0x31')]()===_0x50f3('0x3b')?_0x3ec24e['userId']:_0x3ec24e[_0x50f3('0x28')];var _0x35038f={'method':_0x50f3('0x22'),'uri':_0x51aeee+_0x50f3('0x3c')+'?'+_0x92ea8e,'body':Object['assign']({},{'active':_0x50f3('0x1a'),'caller_id':_0x3b6f94,'assigned_to':_0x3ec24e[_0x50f3('0x20')],'short_description':intUtil[_0x50f3('0x3d')](_0x318395[_0x50f3('0x3e')],_0x9c78eb,'\x20'),'description':intUtil['getString'](_0x318395['Descriptions'],_0x9c78eb,'\x0a')},getCustomFields(_0x318395[_0x50f3('0x3f')],_0x9c78eb)),'auth':_0x5184c0,'json':!![]};return rp(_0x35038f)[_0x50f3('0xd')](function(_0x3098c4){logger['info']('['+[_0x1a4d7e[_0x50f3('0x14')]()]+_0x50f3('0x40'),_0x3098c4[_0x50f3('0xe')]);_0x3ec24e['ticketId']=_0x3098c4['result'][_0x50f3('0x1b')];_0x3ec24e['ticketNumber']=_0x3098c4[_0x50f3('0xe')][_0x50f3('0x41')];logger[_0x50f3('0x11')]('['+[_0x1a4d7e[_0x50f3('0x14')]()]+']\x20getTicket\x20crm',_0x3ec24e);_0x4cab17(_0x3ec24e);})[_0x50f3('0x29')](function(_0x3b6579){logger['error']('['+[_0x1a4d7e[_0x50f3('0x14')]()]+']',_0x3b6579[_0x50f3('0x13')]);_0x38bfdc(_0x3b6579[_0x50f3('0x13')]);});});};}function createRemoteTag(_0xcbd33e,_0x5d3005,_0x3c9074,_0x31b67e){return new Promise(function(_0x465756,_0x143188){var _0x22dbcc={'method':'POST','uri':_0x3c9074+_0x50f3('0x42')+'?'+_0x31b67e,'body':{'short_description':_0xcbd33e,'global':!![],'active':!![],'name':_0xcbd33e},'auth':_0x5d3005,'json':!![]};return rp(_0x22dbcc)['then'](function(_0x4f8ce8){var _0x5a3a61=_0x4f8ce8[_0x50f3('0xe')][_0x50f3('0x1b')];_0x465756(_0x5a3a61);});});}function getRemoteTag(_0x4bb5f6,_0x5641b7,_0x453ff5,_0x162079,_0x45c5e9){return new Promise(function(_0x510e11,_0x733a1e){var _0x1bcfe5={'method':_0x50f3('0xb'),'uri':_0x453ff5+_0x50f3('0x42')+_0x50f3('0x43')+_0x4bb5f6+'&'+_0x162079,'auth':_0x5641b7,'json':!![]};return rp(_0x1bcfe5)[_0x50f3('0xd')](function(_0x59f89b){if(_0x59f89b[_0x50f3('0xe')][_0x50f3('0xf')]>0x0){var _0x5bb79b=_0x59f89b['result'][0x0]['sys_id'];_0x510e11(_0x5bb79b);}else{return createRemoteTag(_0x4bb5f6,_0x5641b7,_0x453ff5,_0x162079)['then'](function(_0x1cd7b2){_0x510e11(_0x1cd7b2);});}});});}function assignTagToIncident(_0x1606b3,_0x458163,_0x1ec771,_0x261063,_0xbb47c4){return new Promise(function(_0x1cd9e4,_0x2563e2){var _0x3afeb5={'method':_0x50f3('0x22'),'uri':_0x1ec771+_0x50f3('0x44')+'?'+_0xbb47c4,'body':{'label':_0x1606b3,'table':_0x50f3('0x3c'),'id_type':_0x50f3('0x45'),'table_key':_0x261063[_0x50f3('0x46')],'title':_0x50f3('0x47')+_0x261063[_0x50f3('0x48')],'id_display':_0x261063[_0x50f3('0x48')]},'auth':_0x458163,'json':!![]};return rp(_0x3afeb5)[_0x50f3('0xd')](function(_0xd873ba){_0x1cd9e4();})[_0x50f3('0x29')](function(){_0x1cd9e4();});});}function manageTags(_0x55dc49,_0x46ff03,_0x1d9c08,_0x577d21,_0x602b9a,_0x5e50fa,_0x3a3d65){return new Promise(function(_0x46acfe,_0x272b05){var _0x20182f=[];_0x46ff03[_0x50f3('0x2c')](function(_0x149e95){_0x20182f['push'](getRemoteTag(_0x149e95,_0x1d9c08,_0x577d21,_0x5e50fa,_0x3a3d65));});return Promise[_0x50f3('0x49')](_0x20182f)['then'](function(_0x5552b8){if(_0x5552b8['length']){logger[_0x50f3('0x11')]('['+[_0x55dc49[_0x50f3('0x14')]()]+_0x50f3('0x4a'),_0x5552b8);var _0x5405e9=[];_0x5552b8[_0x50f3('0x2c')](function(_0x2bf7ce){_0x5405e9['push'](assignTagToIncident(_0x2bf7ce,_0x1d9c08,_0x577d21,_0x602b9a,_0x5e50fa));});return Promise['all'](_0x5405e9)['then'](function(){_0x46acfe();})[_0x50f3('0x29')](function(){_0x46acfe();});}else{_0x46acfe();}});});}function getTags(_0x4ffa8c,_0x27a639,_0x15a098,_0x160c98,_0x2989b4,_0x3477ea){return function(_0x580d1d){return new Promise(function(_0x44354c,_0x1d77c1){var _0x43ea5e=[];var _0x10a382=_0x160c98[_0x50f3('0x4b')];if(_0x10a382&&_0x10a382[_0x50f3('0xf')]>0x0){_0x43ea5e=_[_0x50f3('0x4c')](_0x10a382,_0x50f3('0x39'));}if(_0x43ea5e[_0x50f3('0xf')]>0x0){return manageTags(_0x4ffa8c,_0x43ea5e,_0x27a639,_0x15a098,_0x580d1d,_0x2989b4,_0x3477ea)['then'](function(){_0x44354c(_0x580d1d);});}else{_0x44354c(_0x580d1d);}});};}function emit(_0x19df71,_0x29c198,_0x367bfd){var _0x35cfcd='%26sysparm_record_target%3Dincident'+_0x50f3('0x4d')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0x50f3('0x4e');var _0x8bc1c6={'uri':_0x19df71+_0x50f3('0x4f')+_0x367bfd+_0x35cfcd};io['to'](util[_0x50f3('0x50')](_0x50f3('0x51'),_0x29c198))['emit'](_0x50f3('0x52'),_0x8bc1c6);}exports['cs']=function(_0x441ee2,_0x5ded45,_0x35ab17,_0x28bfdf,_0x3c8493,_0x3c39d4,_0xea7c46,_0x2b5e5a){var _0x5afa3a={};var _0x1e2acf={'user':_0x3c39d4[_0x50f3('0x53')],'pass':_0x3c39d4[_0x50f3('0x54')]};var _0x507e69='sysparm_limit=1';var _0x49ff9b=_0x50f3('0x55');_0x3c39d4[_0x50f3('0x56')]=intUtil['stripTrailingSlash'](_0x3c39d4['remoteUri']);_0x3c39d4['serverUrl']=intUtil[_0x50f3('0x57')](_0x3c39d4[_0x50f3('0x58')]);var _0xa33a29=util[_0x50f3('0x50')](_0x50f3('0x59'),_0x3c39d4[_0x50f3('0x56')]);_0x5afa3a[_0x50f3('0x16')]=!_[_0x50f3('0x5a')](_0x28bfdf)?_0x28bfdf[_0x50f3('0x5b')]:null;_0x5afa3a['adminEmail']=_0x3c39d4[_0x50f3('0x5b')];_0x5afa3a[_0x50f3('0x25')]=_0x2b5e5a[_0x50f3('0x31')]()===_0x50f3('0x3b')?_0x5ded45['destcalleridnum']:_0x5ded45['calleridnum'];_0x5afa3a[_0x50f3('0x5c')]=_0x2b5e5a===_0x50f3('0x5d')||_0x2b5e5a===_0x50f3('0x5e')?_0x50f3('0x5d'):_0x50f3('0x3b');var _0x3f90d9=util[_0x50f3('0x50')](_0x50f3('0x5f'),_0x3c39d4['serverUrl'],_0x5ded45[_0x50f3('0x60')],md5(_0x5ded45[_0x50f3('0x60')]));if(_0x3c8493&&_0x3c8493[_0x50f3('0x61')]){logger[_0x50f3('0x11')](_0x50f3('0x62'),_0x50f3('0x63'));_0x5ded45[_0x50f3('0x64')]=_0x3f90d9;}else if(_0xea7c46&&_0xea7c46[_0x50f3('0x65')]&&_0xea7c46['recordingFormat']!=='none'){logger[_0x50f3('0x11')]('[OUTBOUND]',_0x50f3('0x63'));_0x5ded45[_0x50f3('0x64')]=_0x3f90d9;}else{_0x5ded45[_0x50f3('0x64')]='';}return getAdminUser(_0x2b5e5a,_0x1e2acf,_0x5afa3a,_0xa33a29,_0x49ff9b,_0x507e69)[_0x50f3('0xd')](getUser(_0x2b5e5a,_0x1e2acf,_0xa33a29,_0x49ff9b,_0x507e69))['then'](getEndUser(_0x2b5e5a,_0x1e2acf,_0xa33a29,_0x49ff9b,_0x507e69))[_0x50f3('0xd')](getTicket(_0x2b5e5a,_0x1e2acf,_0xa33a29,_0x35ab17,_0x5ded45,_0x49ff9b))['then'](function(_0x4da808){logger[_0x50f3('0x11')](util[_0x50f3('0x50')](_0x50f3('0x66'),_0x4da808['ticketId']));logger[_0x50f3('0x11')](util['format'](_0x50f3('0x67'),_0x2b5e5a));if(_0x2b5e5a!==_0x50f3('0x5e')){logger[_0x50f3('0x11')]('['+[_0x2b5e5a[_0x50f3('0x14')]()]+']',_0x50f3('0x68'));emit(_0x3c39d4[_0x50f3('0x56')],_0x28bfdf[_0x50f3('0x39')],_0x4da808[_0x50f3('0x46')]);}})[_0x50f3('0x29')](function(_0xae712b){logger[_0x50f3('0x1e')]('['+[_0x2b5e5a[_0x50f3('0x14')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0x50f3('0x69')](_0xae712b,{'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 fdb22f0..2414582 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 _0xa545=['customVariable','Variable','login','username','password','PLAIN','sessionID','Account\x20%d\x20is\x20not\x20valid','Calls','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','uniqueid','recordingURL','calleridname','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','error','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20User\x20ID\x20is:','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','Outbound','users','lastevent','calleridnum','toUpperCase','lodash','request-promise','util','ioredis','./util','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','toISOString','slice','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','length','forEach','variableName','push','set_entry','JSON','format','Basic\x20%s','base64','get_server_info','stringify','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','name_value_list','Agent\x20found!','resolve','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','phone_home','debug','[HTTP]','merge','type','string','nameField','customField','toLowerCase','content','toString','custom_fields','idField'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0xa545,0x112));var _0x5a54=function(_0x168765,_0x534f44){_0x168765=_0x168765-0x0;var _0x3ee3a0=_0xa545[_0x168765];return _0x3ee3a0;};'use strict';var _=require(_0x5a54('0x0'));var rp=require(_0x5a54('0x1'));var BPromise=require('bluebird');var md5=require('md5');var util=require(_0x5a54('0x2'));var Redis=require(_0x5a54('0x3'));var intUtil=require(_0x5a54('0x4'));var config=require('../../../../config/environment');var logger=require(_0x5a54('0x5'))(_0x5a54('0x6'));config[_0x5a54('0x7')]=_[_0x5a54('0x8')](config[_0x5a54('0x7')],{'host':_0x5a54('0x9'),'port':0x18eb});var io=require(_0x5a54('0xa'))(new Redis(config[_0x5a54('0x7')]));var def={'method':_0x5a54('0xb'),'json':!![]};function emit(_0x3912e4,_0x195556,_0x563e59){io['to'](_0x3912e4)[_0x5a54('0xc')](_0x195556,_0x563e59);}function getTicket(_0x3da8d2,_0x4e51e1,_0x15d013,_0x549d67,_0x4a6d94,_0x1e6419,_0x3c1336,_0x2f0033){logger[_0x5a54('0xd')](_0x5a54('0xe'));var _0x36535c=new Date();var _0x373924=[{'name':_0x5a54('0xf'),'value':intUtil[_0x5a54('0x10')](_0x549d67[_0x5a54('0x11')],_0x4a6d94,'\x20')},{'name':_0x5a54('0x12'),'value':_0x4e51e1['id']},{'name':_0x5a54('0x13'),'value':_0x4e51e1['id']},{'name':_0x5a54('0x14'),'value':intUtil[_0x5a54('0x10')](_0x549d67[_0x5a54('0x15')],_0x4a6d94,'\x0a')},{'name':_0x5a54('0x16'),'value':_0x36535c[_0x5a54('0x17')]()[_0x5a54('0x18')](0x0,0x13)['replace']('T','\x20')},{'name':_0x5a54('0x19'),'value':'0'},{'name':_0x5a54('0x1a'),'value':'15'},{'name':_0x5a54('0x1b'),'value':_0x15d013['id']},{'name':_0x5a54('0x1c'),'value':_0x5a54('0x1d')},{'name':_0x5a54('0x1e'),'value':_0x15d013['name']},{'name':'direction','value':_0x2f0033}];if(_0x1e6419[_0x5a54('0x1f')]){_[_0x5a54('0x20')](_0x1e6419,function(_0x205bed){if(_0x4a6d94[_0x205bed[_0x5a54('0x21')]]){_0x373924[_0x5a54('0x22')]({'name':_0x205bed['idField'],'value':_0x4a6d94[_0x205bed['variableName']]});}});}return request({'form':{'method':_0x5a54('0x23'),'input_type':'JSON','response_type':_0x5a54('0x24'),'rest_data':JSON['stringify']({'session':_0x3c1336['id'],'module_name':'Calls','name_value_list':_0x373924})}});}function getAuth(_0x48a9a9){return util[_0x5a54('0x25')](_0x5a54('0x26'),new Buffer(_0x48a9a9['apiKey']+':X')['toString'](_0x5a54('0x27')));}function getServerInfo(_0x1e21ec){return request({'form':{'method':_0x5a54('0x28'),'input_type':'JSON','response_type':_0x5a54('0x24'),'rest_data':JSON[_0x5a54('0x29')]({'session':_0x1e21ec['id']})}});}function getUser(_0x4af561,_0x1ad28a,_0x4a9832){if(!_['isNil'](_0x1ad28a)){logger[_0x5a54('0xd')](_0x5a54('0x2a'),_0x1ad28a);return request({'form':{'method':_0x5a54('0x2b'),'input_type':'JSON','response_type':_0x5a54('0x24'),'rest_data':JSON['stringify']({'session':_0x4a9832['id'],'module_name':_0x5a54('0x2c'),'query':util['format'](_0x5a54('0x2d'),_0x1ad28a),'order_by':'','offset':'0','select_fields':['id',_0x5a54('0xf'),_0x5a54('0x2e')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x5a54('0x2f')](function(_0x419f83){if(_0x419f83[_0x5a54('0x30')][_0x5a54('0x1f')]){var _0x42b0c5=_[_0x5a54('0x31')](_0x419f83[_0x5a54('0x30')],function(_0x4c0972){return _0x4c0972[_0x5a54('0x32')][_0x5a54('0x2e')]['value']===_0x1ad28a;});if(_0x42b0c5){logger['info'](_0x5a54('0x33'));return BPromise[_0x5a54('0x34')]({'id':_0x42b0c5[_0x5a54('0x32')]['id'][_0x5a54('0x35')],'name':_0x42b0c5[_0x5a54('0x32')][_0x5a54('0xf')][_0x5a54('0x35')]});}}logger[_0x5a54('0xd')](_0x5a54('0x36'));return BPromise[_0x5a54('0x34')]({'id':_0x4a9832[_0x5a54('0x32')][_0x5a54('0x37')][_0x5a54('0x35')],'name':_0x4a9832['name_value_list'][_0x5a54('0x2e')][_0x5a54('0x35')]});});}else{logger[_0x5a54('0xd')](_0x5a54('0x38'));return BPromise[_0x5a54('0x34')]({'id':_0x4a9832[_0x5a54('0x32')]['user_id'][_0x5a54('0x35')],'name':_0x4a9832['name_value_list'][_0x5a54('0x2e')][_0x5a54('0x35')]});}}function getEndUser(_0x2ba0bf,_0x13f7fd,_0x3e6495,_0x2ae0c8){logger[_0x5a54('0xd')](_0x5a54('0x39'),_0x3e6495);return request({'form':{'method':'get_entry_list','input_type':_0x5a54('0x24'),'response_type':_0x5a54('0x24'),'rest_data':JSON['stringify']({'session':_0x2ae0c8['id'],'module_name':_0x5a54('0x1d'),'query':util[_0x5a54('0x25')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x3e6495),'order_by':'','offset':'0','select_fields':['id',_0x5a54('0xf'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x5a54('0x2f')](function(_0x3bc516){if(_0x3bc516[_0x5a54('0x30')]['length']){var _0x5f712f=_[_0x5a54('0x31')](_0x3bc516[_0x5a54('0x30')],function(_0x4444c9){return _0x4444c9[_0x5a54('0x32')]['phone_home'][_0x5a54('0x35')]===_0x3e6495;});if(_0x5f712f){logger[_0x5a54('0xd')]('Enduser\x20found!');return BPromise[_0x5a54('0x34')]({'id':_0x5f712f[_0x5a54('0x32')]['id'][_0x5a54('0x35')],'name':_0x5f712f[_0x5a54('0x32')][_0x5a54('0xf')][_0x5a54('0x35')],'phone':_0x5f712f[_0x5a54('0x32')]['phone_home'][_0x5a54('0x35')]});}}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0x5a54('0x23'),'input_type':_0x5a54('0x24'),'response_type':'JSON','rest_data':JSON[_0x5a54('0x29')]({'session':_0x2ae0c8['id'],'module_name':_0x5a54('0x1d'),'name_value_list':[{'name':'first_name','value':_0x13f7fd!==''?_0x13f7fd:util['format']('Caller\x20-\x20%s',_0x3e6495)},{'name':_0x5a54('0x3a'),'value':_0x3e6495}]})}})[_0x5a54('0x2f')](function(_0x3bd28a){logger[_0x5a54('0xd')]('Enduser\x20created.');return BPromise[_0x5a54('0x34')]({'id':_0x3bd28a['id'],'name':_0x3bd28a[_0x5a54('0x30')]['first_name'][_0x5a54('0x35')],'phone':_0x3bd28a[_0x5a54('0x30')][_0x5a54('0x3a')][_0x5a54('0x35')]});});}});}function request(_0x1ce6ae){logger[_0x5a54('0x3b')](_0x5a54('0x3c'),JSON['stringify'](_0x1ce6ae));return rp(_[_0x5a54('0x3d')](def,_0x1ce6ae));}function getTags(_0x4bf755,_0x1b3f3c){var _0x44ccc9=[];if(_0x4bf755&&_0x4bf755[_0x5a54('0x1f')]>0x0){_0x44ccc9=_['map'](_0x4bf755,_0x1b3f3c);}return _0x44ccc9;}function getCustomFields(_0x2aa058,_0x359d60){var _0x1a3be7=[];var _0x373b5f={'custom_fields':[]};if(_0x2aa058[_0x5a54('0x1f')]>0x0){_[_0x5a54('0x20')](_0x2aa058,function(_0x2ece74){if(_0x2ece74[_0x5a54('0x3e')]===_0x5a54('0x3f')&&_0x2ece74[_0x5a54('0x40')]&&!_0x2ece74[_0x5a54('0x41')]){_0x373b5f[_0x2ece74[_0x5a54('0x40')][_0x5a54('0x42')]()]=_0x2ece74[_0x5a54('0x43')][_0x5a54('0x44')]();}else if(_0x2ece74[_0x5a54('0x3e')]===_0x5a54('0x3f')&&_0x2ece74['idField']&&_0x2ece74[_0x5a54('0x41')]){_0x373b5f[_0x5a54('0x45')][_0x5a54('0x22')]({'id':_0x2ece74['idField'],'value':_0x2ece74['content']['toString']()});}else if(_0x2ece74[_0x5a54('0x3e')]==='variable'&&_0x2ece74['variableName']&&_0x2ece74[_0x5a54('0x46')]&&_0x2ece74[_0x5a54('0x41')]){_0x359d60[_0x2ece74['variableName']]&&_0x373b5f[_0x5a54('0x45')]['push']({'id':_0x2ece74[_0x5a54('0x46')],'value':_0x359d60[_0x2ece74['variableName']][_0x5a54('0x44')]()});}else if(_0x2ece74[_0x5a54('0x3e')]===_0x5a54('0x47')&&_0x2ece74['Variable']&&_0x2ece74[_0x5a54('0x48')][_0x5a54('0xf')]&&_0x2ece74[_0x5a54('0x46')]&&_0x2ece74[_0x5a54('0x41')]){_0x359d60[_0x2ece74['Variable']['name'][_0x5a54('0x42')]()]&&_0x373b5f[_0x5a54('0x45')][_0x5a54('0x22')]({'id':_0x2ece74[_0x5a54('0x46')],'value':_0x359d60[_0x2ece74[_0x5a54('0x48')][_0x5a54('0xf')]['toLowerCase']()]['toString']()});}});}return _0x373b5f;}function getConnection(_0x11d922){return request({'method':_0x5a54('0xb'),'form':{'method':_0x5a54('0x49'),'input_type':_0x5a54('0x24'),'response_type':'JSON','rest_data':JSON[_0x5a54('0x29')]({'user_auth':{'user_name':_0x11d922[_0x5a54('0x4a')],'password':_0x11d922[_0x5a54('0x4b')],'encryption':_0x5a54('0x4c')},'application':'xCALLY\x20Motion\x20integration'})}})[_0x5a54('0x2f')](function(_0x2461ef){var _0x56dd11=_0x2461ef;if(_0x56dd11['id']){def[_0x5a54('0x4d')]=_0x56dd11['id'];return BPromise[_0x5a54('0x34')](_0x56dd11);}else{throw new Error(util[_0x5a54('0x25')](_0x5a54('0x4e'),_0x11d922['id']));}});}function setRelationship(_0x30a820,_0x40c1d4,_0x1671ab,_0x38071b){return request({'form':{'method':'set_relationship','input_type':'JSON','response_type':_0x5a54('0x24'),'rest_data':JSON[_0x5a54('0x29')]({'session':_0x30a820['id'],'module_name':_0x5a54('0x4f'),'module_id':_0x1671ab['id'],'link_field_name':_0x38071b,'related_ids':[_0x40c1d4['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x53a3b2,_0x52d0fc,_0xe24d0e,_0xc82d58,_0x40ed70,_0x38dfee){var _0x59d411,_0x45cb94,_0x49521f,_0x1d61dd;_0x38dfee[_0x5a54('0x50')]=intUtil[_0x5a54('0x51')](_0x38dfee[_0x5a54('0x50')]);_0x38dfee[_0x5a54('0x52')]=intUtil[_0x5a54('0x51')](_0x38dfee[_0x5a54('0x52')]);def[_0x5a54('0x53')]=util[_0x5a54('0x25')](_0x5a54('0x54'),_0x38dfee['remoteUri']);if(_0x40ed70&&_0x40ed70[_0x5a54('0x55')]){logger[_0x5a54('0xd')]('[QUEUE]','Recording\x20is\x20enabled!');_0x52d0fc['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x38dfee[_0x5a54('0x52')],_0x52d0fc[_0x5a54('0x56')],md5(_0x52d0fc[_0x5a54('0x56')]));}else{_0x52d0fc[_0x5a54('0x57')]='';}return getConnection(_0x38dfee)[_0x5a54('0x2f')](function(_0x15b26a){_0x1d61dd=_0x15b26a;return getUser(_0x38dfee,_0xc82d58['name'],_0x1d61dd);})[_0x5a54('0x2f')](function(_0x5de1a4){_0x59d411=_0x5de1a4;logger[_0x5a54('0xd')]('The\x20User\x20ID\x20is:',_0x59d411['id']);return getEndUser(_0x38dfee,_0x52d0fc[_0x5a54('0x58')],_0x52d0fc['calleridnum'],_0x1d61dd);})[_0x5a54('0x2f')](function(_0x55d385){_0x45cb94=_0x55d385;logger[_0x5a54('0xd')]('The\x20Enduser\x20ID\x20is:',_0x45cb94['id']);return getTicket(_0x38dfee,_0x59d411,_0x45cb94,_0xe24d0e,_0x52d0fc,_0xe24d0e['Fields'],_0x1d61dd,_0x5a54('0x59'));})[_0x5a54('0x2f')](function(_0x181d88){_0x49521f=_0x181d88;logger[_0x5a54('0xd')](_0x5a54('0x5a'));logger[_0x5a54('0xd')](_0x5a54('0x5b'),_0x49521f['id']);return setRelationship(_0x1d61dd,_0x59d411,_0x49521f,'users');})['then'](function(){return setRelationship(_0x1d61dd,_0x45cb94,_0x49521f,_0x5a54('0x5c'));})[_0x5a54('0x2f')](function(){return getServerInfo(_0x1d61dd);})[_0x5a54('0x2f')](function(_0x2cf985){var _0x5654c6=parseInt(_0x2cf985[_0x5a54('0x5d')][_0x5a54('0x5e')](0x0));var _0x1f3a9c=util[_0x5a54('0x25')](_0x5a54('0x5f'),_0x38dfee['remoteUri'],_0x49521f['id']);if(_0x5654c6>0x6){_0x1f3a9c=util[_0x5a54('0x25')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x38dfee[_0x5a54('0x50')],_0x49521f['id']);}logger[_0x5a54('0xd')](_0x5a54('0x60'),_0x5a54('0x61'));emit(util[_0x5a54('0x25')](_0x5a54('0x62'),_0xc82d58['name']),'trigger:browser:url',{'uri':_0x1f3a9c});})[_0x5a54('0x63')](function(_0x3517c4){logger[_0x5a54('0x64')](_0x5a54('0x60'),JSON[_0x5a54('0x29')](_0x3517c4));});};exports[_0x5a54('0x65')]=function(_0x3df666,_0x5864e3,_0x4652c1,_0x59b5a0,_0x42cfe0,_0x1ec7da,_0x4cf26c){var _0x3c1bca,_0x24dfc8,_0x2ec1a5,_0x2a4b5a;_0x1ec7da[_0x5a54('0x50')]=intUtil[_0x5a54('0x51')](_0x1ec7da['remoteUri']);_0x1ec7da[_0x5a54('0x52')]=intUtil[_0x5a54('0x51')](_0x1ec7da[_0x5a54('0x52')]);def['uri']=util['format'](_0x5a54('0x54'),_0x1ec7da['remoteUri']);if(_0x4cf26c&&_0x4cf26c[_0x5a54('0x66')]&&_0x4cf26c[_0x5a54('0x66')]!==_0x5a54('0x67')){logger[_0x5a54('0xd')](_0x5a54('0x68'),'Recording\x20is\x20enabled!');_0x5864e3[_0x5a54('0x57')]=util[_0x5a54('0x25')](_0x5a54('0x69'),_0x1ec7da[_0x5a54('0x52')],_0x5864e3['uniqueid'],md5(_0x5864e3[_0x5a54('0x56')]));}return getConnection(_0x1ec7da)[_0x5a54('0x2f')](function(_0xedb874){_0x2a4b5a=_0xedb874;return getUser(_0x1ec7da,_0x59b5a0[_0x5a54('0xf')],_0x2a4b5a);})['then'](function(_0x5b5127){_0x3c1bca=_0x5b5127;logger[_0x5a54('0xd')](_0x5a54('0x6a'),_0x3c1bca['id']);return getEndUser(_0x1ec7da,_0x5864e3[_0x5a54('0x6b')],_0x5864e3['destcalleridnum'],_0x2a4b5a);})[_0x5a54('0x2f')](function(_0x49e207){_0x24dfc8=_0x49e207;logger[_0x5a54('0xd')](_0x5a54('0x6c'),_0x24dfc8['id']);return getTicket(_0x1ec7da,_0x3c1bca,_0x24dfc8,_0x4652c1,_0x5864e3,_0x4652c1[_0x5a54('0x6d')],_0x2a4b5a,_0x5a54('0x6e'));})[_0x5a54('0x2f')](function(_0x59293e){_0x2ec1a5=_0x59293e;logger['info'](_0x5a54('0x5a'));logger[_0x5a54('0xd')](_0x5a54('0x5b'),_0x2ec1a5['id']);return setRelationship(_0x2a4b5a,_0x3c1bca,_0x2ec1a5,_0x5a54('0x6f'));})[_0x5a54('0x2f')](function(){return setRelationship(_0x2a4b5a,_0x24dfc8,_0x2ec1a5,_0x5a54('0x5c'));})[_0x5a54('0x2f')](function(){return getServerInfo(_0x2a4b5a);})[_0x5a54('0x2f')](function(_0x34499d){var _0x359af3=parseInt(_0x34499d[_0x5a54('0x5d')][_0x5a54('0x5e')](0x0));var _0x3f9dd8=util['format'](_0x5a54('0x5f'),_0x1ec7da[_0x5a54('0x50')],_0x2ec1a5['id']);if(_0x359af3>0x6){_0x3f9dd8=util[_0x5a54('0x25')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x1ec7da[_0x5a54('0x50')],_0x2ec1a5['id']);}logger['info'](_0x5a54('0x68'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x5a54('0x25')](_0x5a54('0x62'),_0x59b5a0['name']),'trigger:browser:url',{'uri':_0x3f9dd8});})[_0x5a54('0x63')](function(_0xe460b){logger[_0x5a54('0x64')](_0x5a54('0x68'),JSON[_0x5a54('0x29')](_0xe460b));});};exports['unmanaged']=function(_0x11b2d3,_0xd22802,_0x1f2974,_0x1c27b3,_0x3bc2b5,_0x502ed5){var _0x2d2654,_0x460f92,_0x154ff9,_0x17a5ad;_0x502ed5[_0x5a54('0x50')]=intUtil['stripTrailingSlash'](_0x502ed5[_0x5a54('0x50')]);_0x502ed5[_0x5a54('0x52')]=intUtil[_0x5a54('0x51')](_0x502ed5[_0x5a54('0x52')]);def[_0x5a54('0x53')]=util[_0x5a54('0x25')]('%s/service/v4_1/rest.php',_0x502ed5[_0x5a54('0x50')]);if(_0x3bc2b5&&_0x3bc2b5[_0x5a54('0x55')]){logger[_0x5a54('0xd')]('['+_0xd22802[_0x5a54('0x70')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0xd22802[_0x5a54('0x57')]=util[_0x5a54('0x25')](_0x5a54('0x69'),_0x502ed5[_0x5a54('0x52')],_0xd22802[_0x5a54('0x56')],md5(_0xd22802['uniqueid']));}else{_0xd22802[_0x5a54('0x57')]='';}return getConnection(_0x502ed5)[_0x5a54('0x2f')](function(_0x353421){_0x17a5ad=_0x353421;if(!_['isNil'](_0x1c27b3)){return getUser(_0x502ed5,_0x1c27b3[_0x5a54('0xf')],_0x17a5ad);}else{return getUser(_0x502ed5,null,_0x17a5ad);}})[_0x5a54('0x2f')](function(_0x32bb62){_0x2d2654=_0x32bb62;logger[_0x5a54('0xd')](_0x5a54('0x6a'),_0x2d2654['id']);return getEndUser(_0x502ed5,_0xd22802[_0x5a54('0x58')],_0xd22802[_0x5a54('0x71')],_0x17a5ad);})[_0x5a54('0x2f')](function(_0x51c0e4){_0x460f92=_0x51c0e4;logger[_0x5a54('0xd')](_0x5a54('0x6c'),_0x460f92['id']);return getTicket(_0x502ed5,_0x2d2654,_0x460f92,_0x1f2974,_0xd22802,_0x1f2974[_0x5a54('0x6d')],_0x17a5ad,_0x5a54('0x59'));})['then'](function(_0x5cc568){_0x154ff9=_0x5cc568;logger[_0x5a54('0xd')](_0x5a54('0x5a'));logger['info'](_0x5a54('0x5b'),_0x154ff9['id']);return setRelationship(_0x17a5ad,_0x2d2654,_0x154ff9,_0x5a54('0x6f'));})[_0x5a54('0x2f')](function(){return setRelationship(_0x17a5ad,_0x460f92,_0x154ff9,_0x5a54('0x5c'));})[_0x5a54('0x2f')](function(){return getServerInfo(_0x17a5ad);})['catch'](function(_0x573520){logger[_0x5a54('0x64')]('['+_0xd22802[_0x5a54('0x70')][_0x5a54('0x72')]()+']',JSON[_0x5a54('0x29')](_0x573520));});}; \ No newline at end of file +var _0x4ff5=['Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','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]','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','catch','unmanaged','monitor_format','toUpperCase','lodash','request-promise','md5','util','ioredis','../../../../config/environment','../../../../config/logger','sugarcrm','defaults','redis','socket.io-emitter','POST','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','description','date_start','toISOString','slice','replace','duration_hours','parent_id','parent_type','Contacts','parent_name','forEach','variableName','idField','set_entry','JSON','stringify','format','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','find','name_value_list','value','Agent\x20found!','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','get_entry_list','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','entry_list','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','','Enduser\x20created.','first_name','debug','merge','map','string','customField','toLowerCase','type','push','content','variable','custom_fields','customVariable','Variable','login','username','PLAIN','sessionID','Account\x20%d\x20is\x20not\x20valid','Calls','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields'];(function(_0x4da49a,_0x5e2c4b){var _0x398093=function(_0x30e84a){while(--_0x30e84a){_0x4da49a['push'](_0x4da49a['shift']());}};_0x398093(++_0x5e2c4b);}(_0x4ff5,0x17d));var _0x54ff=function(_0x48e9e8,_0x33d9b3){_0x48e9e8=_0x48e9e8-0x0;var _0x426d1b=_0x4ff5[_0x48e9e8];return _0x426d1b;};'use strict';var _=require(_0x54ff('0x0'));var rp=require(_0x54ff('0x1'));var BPromise=require('bluebird');var md5=require(_0x54ff('0x2'));var util=require(_0x54ff('0x3'));var Redis=require(_0x54ff('0x4'));var intUtil=require('./util');var config=require(_0x54ff('0x5'));var logger=require(_0x54ff('0x6'))(_0x54ff('0x7'));config['redis']=_[_0x54ff('0x8')](config[_0x54ff('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x54ff('0xa'))(new Redis(config['redis']));var def={'method':_0x54ff('0xb'),'json':!![]};function emit(_0x42bdb2,_0x2cdd6f,_0x2d6f40){io['to'](_0x42bdb2)['emit'](_0x2cdd6f,_0x2d6f40);}function getTicket(_0x12c203,_0x4e17f5,_0x40de47,_0x5bddc6,_0x6c192c,_0x5933f4,_0x52d433,_0x32213c){logger[_0x54ff('0xc')](_0x54ff('0xd'));var _0x1e365c=new Date();var _0x167773=[{'name':_0x54ff('0xe'),'value':intUtil[_0x54ff('0xf')](_0x5bddc6[_0x54ff('0x10')],_0x6c192c,'\x20')},{'name':_0x54ff('0x11'),'value':_0x4e17f5['id']},{'name':'created_by','value':_0x4e17f5['id']},{'name':_0x54ff('0x12'),'value':intUtil['getString'](_0x5bddc6['Descriptions'],_0x6c192c,'\x0a')},{'name':_0x54ff('0x13'),'value':_0x1e365c[_0x54ff('0x14')]()[_0x54ff('0x15')](0x0,0x13)[_0x54ff('0x16')]('T','\x20')},{'name':_0x54ff('0x17'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0x54ff('0x18'),'value':_0x40de47['id']},{'name':_0x54ff('0x19'),'value':_0x54ff('0x1a')},{'name':_0x54ff('0x1b'),'value':_0x40de47[_0x54ff('0xe')]},{'name':'direction','value':_0x32213c}];if(_0x5933f4['length']){_[_0x54ff('0x1c')](_0x5933f4,function(_0x3fe316){if(_0x6c192c[_0x3fe316[_0x54ff('0x1d')]]){_0x167773['push']({'name':_0x3fe316[_0x54ff('0x1e')],'value':_0x6c192c[_0x3fe316[_0x54ff('0x1d')]]});}});}return request({'form':{'method':_0x54ff('0x1f'),'input_type':_0x54ff('0x20'),'response_type':_0x54ff('0x20'),'rest_data':JSON[_0x54ff('0x21')]({'session':_0x52d433['id'],'module_name':'Calls','name_value_list':_0x167773})}});}function getAuth(_0x227184){return util[_0x54ff('0x22')](_0x54ff('0x23'),new Buffer(_0x227184[_0x54ff('0x24')]+':X')[_0x54ff('0x25')](_0x54ff('0x26')));}function getServerInfo(_0x3d53b8){return request({'form':{'method':_0x54ff('0x27'),'input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'session':_0x3d53b8['id']})}});}function getUser(_0x3159be,_0x5c5f91,_0xca662b){if(!_[_0x54ff('0x28')](_0x5c5f91)){logger[_0x54ff('0xc')](_0x54ff('0x29'),_0x5c5f91);return request({'form':{'method':'get_entry_list','input_type':_0x54ff('0x20'),'response_type':_0x54ff('0x20'),'rest_data':JSON[_0x54ff('0x21')]({'session':_0xca662b['id'],'module_name':_0x54ff('0x2a'),'query':util[_0x54ff('0x22')](_0x54ff('0x2b'),_0x5c5f91),'order_by':'','offset':'0','select_fields':['id',_0x54ff('0xe'),_0x54ff('0x2c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x54ff('0x2d')](function(_0x266ec8){if(_0x266ec8['entry_list']['length']){var _0x3988e6=_[_0x54ff('0x2e')](_0x266ec8['entry_list'],function(_0x535dae){return _0x535dae[_0x54ff('0x2f')][_0x54ff('0x2c')][_0x54ff('0x30')]===_0x5c5f91;});if(_0x3988e6){logger[_0x54ff('0xc')](_0x54ff('0x31'));return BPromise[_0x54ff('0x32')]({'id':_0x3988e6[_0x54ff('0x2f')]['id'][_0x54ff('0x30')],'name':_0x3988e6[_0x54ff('0x2f')][_0x54ff('0xe')][_0x54ff('0x30')]});}}logger[_0x54ff('0xc')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x54ff('0x32')]({'id':_0xca662b[_0x54ff('0x2f')][_0x54ff('0x33')][_0x54ff('0x30')],'name':_0xca662b[_0x54ff('0x2f')][_0x54ff('0x2c')]['value']});});}else{logger[_0x54ff('0xc')](_0x54ff('0x34'));return BPromise[_0x54ff('0x32')]({'id':_0xca662b[_0x54ff('0x2f')]['user_id'][_0x54ff('0x30')],'name':_0xca662b['name_value_list']['user_name'][_0x54ff('0x30')]});}}function getEndUser(_0x19016e,_0x3ccd89,_0x5e1681,_0x1e39d3){logger[_0x54ff('0xc')](_0x54ff('0x35'),_0x5e1681);return request({'form':{'method':_0x54ff('0x36'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x54ff('0x21')]({'session':_0x1e39d3['id'],'module_name':_0x54ff('0x1a'),'query':util[_0x54ff('0x22')](_0x54ff('0x37'),_0x5e1681),'order_by':'','offset':'0','select_fields':['id',_0x54ff('0xe'),_0x54ff('0x38')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x54ff('0x2d')](function(_0x984aa7){if(_0x984aa7[_0x54ff('0x39')][_0x54ff('0x3a')]){var _0x58925a=_['find'](_0x984aa7[_0x54ff('0x39')],function(_0x5a462d){return _0x5a462d[_0x54ff('0x2f')][_0x54ff('0x38')][_0x54ff('0x30')]===_0x5e1681;});if(_0x58925a){logger[_0x54ff('0xc')](_0x54ff('0x3b'));return BPromise[_0x54ff('0x32')]({'id':_0x58925a['name_value_list']['id'][_0x54ff('0x30')],'name':_0x58925a[_0x54ff('0x2f')][_0x54ff('0xe')]['value'],'phone':_0x58925a[_0x54ff('0x2f')][_0x54ff('0x38')][_0x54ff('0x30')]});}}else{logger[_0x54ff('0xc')](_0x54ff('0x3c'));return request({'form':{'method':_0x54ff('0x1f'),'input_type':'JSON','response_type':_0x54ff('0x20'),'rest_data':JSON['stringify']({'session':_0x1e39d3['id'],'module_name':_0x54ff('0x1a'),'name_value_list':[{'name':'first_name','value':_0x3ccd89!==_0x54ff('0x3d')?_0x3ccd89:util[_0x54ff('0x22')]('Caller\x20-\x20%s',_0x5e1681)},{'name':'phone_home','value':_0x5e1681}]})}})[_0x54ff('0x2d')](function(_0x4432ad){logger['info'](_0x54ff('0x3e'));return BPromise[_0x54ff('0x32')]({'id':_0x4432ad['id'],'name':_0x4432ad[_0x54ff('0x39')][_0x54ff('0x3f')][_0x54ff('0x30')],'phone':_0x4432ad[_0x54ff('0x39')][_0x54ff('0x38')][_0x54ff('0x30')]});});}});}function request(_0x2b962c){logger[_0x54ff('0x40')]('[HTTP]',JSON[_0x54ff('0x21')](_0x2b962c));return rp(_[_0x54ff('0x41')](def,_0x2b962c));}function getTags(_0x2722af,_0x1417c7){var _0x5bfb6c=[];if(_0x2722af&&_0x2722af['length']>0x0){_0x5bfb6c=_[_0x54ff('0x42')](_0x2722af,_0x1417c7);}return _0x5bfb6c;}function getCustomFields(_0x22811e,_0x513455){var _0x322a25=[];var _0x547ee2={'custom_fields':[]};if(_0x22811e['length']>0x0){_[_0x54ff('0x1c')](_0x22811e,function(_0x2aae80){if(_0x2aae80['type']===_0x54ff('0x43')&&_0x2aae80['nameField']&&!_0x2aae80[_0x54ff('0x44')]){_0x547ee2[_0x2aae80['nameField'][_0x54ff('0x45')]()]=_0x2aae80['content'][_0x54ff('0x25')]();}else if(_0x2aae80[_0x54ff('0x46')]===_0x54ff('0x43')&&_0x2aae80[_0x54ff('0x1e')]&&_0x2aae80[_0x54ff('0x44')]){_0x547ee2['custom_fields'][_0x54ff('0x47')]({'id':_0x2aae80[_0x54ff('0x1e')],'value':_0x2aae80[_0x54ff('0x48')][_0x54ff('0x25')]()});}else if(_0x2aae80[_0x54ff('0x46')]===_0x54ff('0x49')&&_0x2aae80['variableName']&&_0x2aae80[_0x54ff('0x1e')]&&_0x2aae80['customField']){_0x513455[_0x2aae80[_0x54ff('0x1d')]]&&_0x547ee2[_0x54ff('0x4a')]['push']({'id':_0x2aae80[_0x54ff('0x1e')],'value':_0x513455[_0x2aae80[_0x54ff('0x1d')]]['toString']()});}else if(_0x2aae80[_0x54ff('0x46')]===_0x54ff('0x4b')&&_0x2aae80[_0x54ff('0x4c')]&&_0x2aae80[_0x54ff('0x4c')]['name']&&_0x2aae80[_0x54ff('0x1e')]&&_0x2aae80['customField']){_0x513455[_0x2aae80[_0x54ff('0x4c')][_0x54ff('0xe')][_0x54ff('0x45')]()]&&_0x547ee2[_0x54ff('0x4a')][_0x54ff('0x47')]({'id':_0x2aae80[_0x54ff('0x1e')],'value':_0x513455[_0x2aae80[_0x54ff('0x4c')][_0x54ff('0xe')][_0x54ff('0x45')]()][_0x54ff('0x25')]()});}});}return _0x547ee2;}function getConnection(_0x6f988a){return request({'method':'POST','form':{'method':_0x54ff('0x4d'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x54ff('0x21')]({'user_auth':{'user_name':_0x6f988a[_0x54ff('0x4e')],'password':_0x6f988a['password'],'encryption':_0x54ff('0x4f')},'application':'xCALLY\x20Motion\x20integration'})}})[_0x54ff('0x2d')](function(_0x2c9477){var _0x39d5c0=_0x2c9477;if(_0x39d5c0['id']){def[_0x54ff('0x50')]=_0x39d5c0['id'];return BPromise[_0x54ff('0x32')](_0x39d5c0);}else{throw new Error(util[_0x54ff('0x22')](_0x54ff('0x51'),_0x6f988a['id']));}});}function setRelationship(_0x5bc4e1,_0x4036a5,_0x2fd1e0,_0x26b35f){return request({'form':{'method':'set_relationship','input_type':'JSON','response_type':_0x54ff('0x20'),'rest_data':JSON[_0x54ff('0x21')]({'session':_0x5bc4e1['id'],'module_name':_0x54ff('0x52'),'module_id':_0x2fd1e0['id'],'link_field_name':_0x26b35f,'related_ids':[_0x4036a5['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x54ff('0x53')]=function(_0x2aaaf9,_0x3b31ed,_0x153aa4,_0x409c12,_0x21d146,_0x2272f8){var _0x479f11,_0x54c744,_0x55558e,_0x4a73a3;_0x2272f8[_0x54ff('0x54')]=intUtil[_0x54ff('0x55')](_0x2272f8[_0x54ff('0x54')]);_0x2272f8[_0x54ff('0x56')]=intUtil[_0x54ff('0x55')](_0x2272f8[_0x54ff('0x56')]);def[_0x54ff('0x57')]=util[_0x54ff('0x22')](_0x54ff('0x58'),_0x2272f8['remoteUri']);if(_0x21d146&&_0x21d146['monitor_format']){logger[_0x54ff('0xc')](_0x54ff('0x59'),_0x54ff('0x5a'));_0x3b31ed[_0x54ff('0x5b')]=util[_0x54ff('0x22')](_0x54ff('0x5c'),_0x2272f8[_0x54ff('0x56')],_0x3b31ed[_0x54ff('0x5d')],md5(_0x3b31ed[_0x54ff('0x5d')]));}else{_0x3b31ed[_0x54ff('0x5b')]='';}return getConnection(_0x2272f8)[_0x54ff('0x2d')](function(_0x526e6b){_0x4a73a3=_0x526e6b;return getUser(_0x2272f8,_0x409c12['name'],_0x4a73a3);})['then'](function(_0x44d6dd){_0x479f11=_0x44d6dd;logger[_0x54ff('0xc')](_0x54ff('0x5e'),_0x479f11['id']);return getEndUser(_0x2272f8,_0x3b31ed[_0x54ff('0x5f')],_0x3b31ed[_0x54ff('0x60')],_0x4a73a3);})['then'](function(_0x3e138d){_0x54c744=_0x3e138d;logger[_0x54ff('0xc')](_0x54ff('0x61'),_0x54c744['id']);return getTicket(_0x2272f8,_0x479f11,_0x54c744,_0x153aa4,_0x3b31ed,_0x153aa4[_0x54ff('0x62')],_0x4a73a3,_0x54ff('0x63'));})[_0x54ff('0x2d')](function(_0x1cc62b){_0x55558e=_0x1cc62b;logger[_0x54ff('0xc')](_0x54ff('0x64'));logger[_0x54ff('0xc')](_0x54ff('0x65'),_0x55558e['id']);return setRelationship(_0x4a73a3,_0x479f11,_0x55558e,_0x54ff('0x66'));})[_0x54ff('0x2d')](function(){return setRelationship(_0x4a73a3,_0x54c744,_0x55558e,_0x54ff('0x67'));})[_0x54ff('0x2d')](function(){return getServerInfo(_0x4a73a3);})['then'](function(_0x397b64){var _0x243072=parseInt(_0x397b64['version'][_0x54ff('0x68')](0x0));var _0xdf51fd=util[_0x54ff('0x22')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x2272f8[_0x54ff('0x54')],_0x55558e['id']);if(_0x243072>0x6){_0xdf51fd=util[_0x54ff('0x22')](_0x54ff('0x69'),_0x2272f8[_0x54ff('0x54')],_0x55558e['id']);}logger[_0x54ff('0xc')]('[QUEUE]',_0x54ff('0x6a'));emit(util[_0x54ff('0x22')](_0x54ff('0x6b'),_0x409c12[_0x54ff('0xe')]),_0x54ff('0x6c'),{'uri':_0xdf51fd});})['catch'](function(_0x519c33){logger[_0x54ff('0x6d')](_0x54ff('0x59'),JSON[_0x54ff('0x21')](_0x519c33));});};exports[_0x54ff('0x6e')]=function(_0x2ed938,_0x433140,_0x323c1a,_0x592933,_0x28875a,_0x2a0e7b,_0x55c812){var _0x119044,_0x4f2ade,_0x9a8d2f,_0xc4b2ff;_0x2a0e7b[_0x54ff('0x54')]=intUtil[_0x54ff('0x55')](_0x2a0e7b[_0x54ff('0x54')]);_0x2a0e7b[_0x54ff('0x56')]=intUtil['stripTrailingSlash'](_0x2a0e7b['serverUrl']);def[_0x54ff('0x57')]=util[_0x54ff('0x22')](_0x54ff('0x58'),_0x2a0e7b[_0x54ff('0x54')]);if(_0x55c812&&_0x55c812[_0x54ff('0x6f')]&&_0x55c812['recordingFormat']!==_0x54ff('0x70')){logger['info'](_0x54ff('0x71'),_0x54ff('0x5a'));_0x433140['recordingURL']=util[_0x54ff('0x22')](_0x54ff('0x5c'),_0x2a0e7b[_0x54ff('0x56')],_0x433140[_0x54ff('0x5d')],md5(_0x433140[_0x54ff('0x5d')]));}return getConnection(_0x2a0e7b)[_0x54ff('0x2d')](function(_0xb4b765){_0xc4b2ff=_0xb4b765;return getUser(_0x2a0e7b,_0x592933[_0x54ff('0xe')],_0xc4b2ff);})[_0x54ff('0x2d')](function(_0x25da48){_0x119044=_0x25da48;logger[_0x54ff('0xc')](_0x54ff('0x5e'),_0x119044['id']);return getEndUser(_0x2a0e7b,_0x433140['destcalleridname'],_0x433140['destcalleridnum'],_0xc4b2ff);})[_0x54ff('0x2d')](function(_0x5943c6){_0x4f2ade=_0x5943c6;logger['info'](_0x54ff('0x61'),_0x4f2ade['id']);return getTicket(_0x2a0e7b,_0x119044,_0x4f2ade,_0x323c1a,_0x433140,_0x323c1a['Fields'],_0xc4b2ff,'Outbound');})[_0x54ff('0x2d')](function(_0x16ab51){_0x9a8d2f=_0x16ab51;logger[_0x54ff('0xc')](_0x54ff('0x64'));logger[_0x54ff('0xc')](_0x54ff('0x65'),_0x9a8d2f['id']);return setRelationship(_0xc4b2ff,_0x119044,_0x9a8d2f,_0x54ff('0x66'));})[_0x54ff('0x2d')](function(){return setRelationship(_0xc4b2ff,_0x4f2ade,_0x9a8d2f,_0x54ff('0x67'));})[_0x54ff('0x2d')](function(){return getServerInfo(_0xc4b2ff);})[_0x54ff('0x2d')](function(_0xe6b6fa){var _0x34d79=parseInt(_0xe6b6fa[_0x54ff('0x72')][_0x54ff('0x68')](0x0));var _0x2a4bd7=util['format'](_0x54ff('0x73'),_0x2a0e7b['remoteUri'],_0x9a8d2f['id']);if(_0x34d79>0x6){_0x2a4bd7=util[_0x54ff('0x22')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x2a0e7b[_0x54ff('0x54')],_0x9a8d2f['id']);}logger[_0x54ff('0xc')](_0x54ff('0x71'),_0x54ff('0x6a'));emit(util[_0x54ff('0x22')](_0x54ff('0x6b'),_0x592933[_0x54ff('0xe')]),_0x54ff('0x6c'),{'uri':_0x2a4bd7});})[_0x54ff('0x74')](function(_0x2f2704){logger['error'](_0x54ff('0x71'),JSON[_0x54ff('0x21')](_0x2f2704));});};exports[_0x54ff('0x75')]=function(_0x114360,_0x428f28,_0x1c71a4,_0xbd8f21,_0x52f786,_0x39c3e4){var _0x3ae96e,_0x54774e,_0xe2f3ad,_0x3ecadb;_0x39c3e4['remoteUri']=intUtil['stripTrailingSlash'](_0x39c3e4[_0x54ff('0x54')]);_0x39c3e4[_0x54ff('0x56')]=intUtil['stripTrailingSlash'](_0x39c3e4[_0x54ff('0x56')]);def[_0x54ff('0x57')]=util[_0x54ff('0x22')](_0x54ff('0x58'),_0x39c3e4[_0x54ff('0x54')]);if(_0x52f786&&_0x52f786[_0x54ff('0x76')]){logger[_0x54ff('0xc')]('['+_0x428f28['lastevent'][_0x54ff('0x77')]()+']',_0x54ff('0x5a'));_0x428f28[_0x54ff('0x5b')]=util[_0x54ff('0x22')](_0x54ff('0x5c'),_0x39c3e4[_0x54ff('0x56')],_0x428f28[_0x54ff('0x5d')],md5(_0x428f28[_0x54ff('0x5d')]));}else{_0x428f28[_0x54ff('0x5b')]='';}return getConnection(_0x39c3e4)['then'](function(_0x4c3fbd){_0x3ecadb=_0x4c3fbd;if(!_[_0x54ff('0x28')](_0xbd8f21)){return getUser(_0x39c3e4,_0xbd8f21[_0x54ff('0xe')],_0x3ecadb);}else{return getUser(_0x39c3e4,null,_0x3ecadb);}})[_0x54ff('0x2d')](function(_0x12aae8){_0x3ae96e=_0x12aae8;logger[_0x54ff('0xc')](_0x54ff('0x5e'),_0x3ae96e['id']);return getEndUser(_0x39c3e4,_0x428f28[_0x54ff('0x5f')],_0x428f28[_0x54ff('0x60')],_0x3ecadb);})[_0x54ff('0x2d')](function(_0xe5e00e){_0x54774e=_0xe5e00e;logger['info'](_0x54ff('0x61'),_0x54774e['id']);return getTicket(_0x39c3e4,_0x3ae96e,_0x54774e,_0x1c71a4,_0x428f28,_0x1c71a4['Fields'],_0x3ecadb,'Inbound');})[_0x54ff('0x2d')](function(_0x2e7f73){_0xe2f3ad=_0x2e7f73;logger[_0x54ff('0xc')](_0x54ff('0x64'));logger[_0x54ff('0xc')](_0x54ff('0x65'),_0xe2f3ad['id']);return setRelationship(_0x3ecadb,_0x3ae96e,_0xe2f3ad,'users');})['then'](function(){return setRelationship(_0x3ecadb,_0x54774e,_0xe2f3ad,_0x54ff('0x67'));})[_0x54ff('0x2d')](function(){return getServerInfo(_0x3ecadb);})[_0x54ff('0x74')](function(_0x1298f9){logger[_0x54ff('0x6d')]('['+_0x428f28['lastevent'][_0x54ff('0x77')]()+']',JSON[_0x54ff('0x21')](_0x1298f9));});}; \ 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 cc14c45..b0b0e80 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 _0xab1f=['getString','length','push','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','string','key','format','keyContent','%s:\x20%s','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','test','lodash','util'];(function(_0x55d9f6,_0x202542){var _0x4df3af=function(_0x40fffa){while(--_0x40fffa){_0x55d9f6['push'](_0x55d9f6['shift']());}};_0x4df3af(++_0x202542);}(_0xab1f,0x1da));var _0xfab1=function(_0x9666ab,_0x4f73f4){_0x9666ab=_0x9666ab-0x0;var _0x47dd47=_0xab1f[_0x9666ab];return _0x47dd47;};'use strict';var _=require(_0xfab1('0x0'));var util=require(_0xfab1('0x1'));exports[_0xfab1('0x2')]=function(_0x3a25aa,_0x2b7190,_0x429a2b){var _0x3c1662=[];if(_0x3a25aa[_0xfab1('0x3')]>0x0){var _0x59ac20=_['sortBy'](_0x3a25aa,['id']);for(var _0x4d56a4=0x0;_0x4d56a4<_0x59ac20[_0xfab1('0x3')];_0x4d56a4++){var _0x5cca15=_0x59ac20[_0x4d56a4];if(_0x5cca15['type']==='string'){_0x3c1662[_0xfab1('0x4')](_0x5cca15['content']);}else if(_0x5cca15[_0xfab1('0x5')]===_0xfab1('0x6')&&_0x5cca15['variableName']){_0x2b7190[_0x5cca15['variableName']]&&_0x3c1662[_0xfab1('0x4')](_0x2b7190[_0x5cca15[_0xfab1('0x7')]][_0xfab1('0x8')]());}else if(_0x5cca15[_0xfab1('0x5')]===_0xfab1('0x9')&&_0x5cca15[_0xfab1('0xa')]&&_0x5cca15[_0xfab1('0xa')][_0xfab1('0xb')]){_0x2b7190[_0x5cca15[_0xfab1('0xa')][_0xfab1('0xb')][_0xfab1('0xc')]()]&&_0x3c1662['push'](_0x2b7190[_0x5cca15[_0xfab1('0xa')][_0xfab1('0xb')][_0xfab1('0xc')]()][_0xfab1('0x8')]());}else if(_0x5cca15[_0xfab1('0x5')]===_0xfab1('0xd')){if(_0x5cca15[_0xfab1('0xe')]===_0xfab1('0xf')&&_0x5cca15[_0xfab1('0x10')]){_0x3c1662[_0xfab1('0x4')](util[_0xfab1('0x11')]('%s:\x20%s',_0x5cca15['key'],_0x5cca15[_0xfab1('0x12')]));}else if(_0x5cca15[_0xfab1('0xe')]===_0xfab1('0x6')&&_0x5cca15[_0xfab1('0x7')]&&_0x5cca15[_0xfab1('0x10')]){_0x2b7190[_0x5cca15[_0xfab1('0x7')]]&&_0x3c1662[_0xfab1('0x4')](util['format'](_0xfab1('0x13'),_0x5cca15[_0xfab1('0x10')],_0x2b7190[_0x5cca15[_0xfab1('0x7')]]));}else if(_0x5cca15[_0xfab1('0xe')]==='customVariable'&&_0x5cca15[_0xfab1('0xa')]&&_0x5cca15['Variable']['name']&&_0x5cca15[_0xfab1('0x10')]){_0x2b7190[_0x5cca15[_0xfab1('0xa')][_0xfab1('0xb')][_0xfab1('0xc')]()]&&_0x3c1662['push'](util[_0xfab1('0x11')](_0xfab1('0x13'),_0x5cca15['key'],_0x2b7190[_0x5cca15['Variable'][_0xfab1('0xb')][_0xfab1('0xc')]()]));}}}}return _0x3c1662[_0xfab1('0x14')](_0x429a2b);};exports[_0xfab1('0x15')]=function(_0x16265e){var _0x26b70d=_0x16265e[_0xfab1('0x16')](-0x1);if(_0x26b70d==='/'){_0x16265e=_0x16265e[_0xfab1('0x17')](0x0,_0x16265e[_0xfab1('0x18')](_0x26b70d));}return _0x16265e;};exports[_0xfab1('0x19')]=function(_0x5f30bb){if(!_[_0xfab1('0x1a')](_0x5f30bb)&&_0x5f30bb!==''){var _0x238d6c=/^(([^<>()\[\]\\.,;:\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 _0x238d6c[_0xfab1('0x1b')](String(_0x5f30bb)[_0xfab1('0xc')]());}else{return![];}}; \ No newline at end of file +var _0x5ae9=['stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','lodash','sortBy','length','type','string','content','variable','variableName','push','toString','customVariable','Variable','name','keyType','key','format','%s:\x20%s','keyContent','toLowerCase','join'];(function(_0x5caf7e,_0x52e1bc){var _0x5c3435=function(_0xb77e11){while(--_0xb77e11){_0x5caf7e['push'](_0x5caf7e['shift']());}};_0x5c3435(++_0x52e1bc);}(_0x5ae9,0xa2));var _0x95ae=function(_0x402282,_0x615de3){_0x402282=_0x402282-0x0;var _0x4f65af=_0x5ae9[_0x402282];return _0x4f65af;};'use strict';var _=require(_0x95ae('0x0'));var util=require('util');exports['getString']=function(_0x375075,_0x1408e2,_0x24a895){var _0x221e89=[];if(_0x375075['length']>0x0){var _0x2ef230=_[_0x95ae('0x1')](_0x375075,['id']);for(var _0x2399d3=0x0;_0x2399d3<_0x2ef230[_0x95ae('0x2')];_0x2399d3++){var _0x36bcff=_0x2ef230[_0x2399d3];if(_0x36bcff[_0x95ae('0x3')]===_0x95ae('0x4')){_0x221e89['push'](_0x36bcff[_0x95ae('0x5')]);}else if(_0x36bcff[_0x95ae('0x3')]===_0x95ae('0x6')&&_0x36bcff[_0x95ae('0x7')]){_0x1408e2[_0x36bcff['variableName']]&&_0x221e89[_0x95ae('0x8')](_0x1408e2[_0x36bcff['variableName']][_0x95ae('0x9')]());}else if(_0x36bcff['type']===_0x95ae('0xa')&&_0x36bcff[_0x95ae('0xb')]&&_0x36bcff['Variable'][_0x95ae('0xc')]){_0x1408e2[_0x36bcff[_0x95ae('0xb')][_0x95ae('0xc')]['toLowerCase']()]&&_0x221e89['push'](_0x1408e2[_0x36bcff[_0x95ae('0xb')][_0x95ae('0xc')]['toLowerCase']()][_0x95ae('0x9')]());}else if(_0x36bcff[_0x95ae('0x3')]==='keyValue'){if(_0x36bcff[_0x95ae('0xd')]===_0x95ae('0x4')&&_0x36bcff[_0x95ae('0xe')]){_0x221e89[_0x95ae('0x8')](util[_0x95ae('0xf')](_0x95ae('0x10'),_0x36bcff['key'],_0x36bcff[_0x95ae('0x11')]));}else if(_0x36bcff[_0x95ae('0xd')]===_0x95ae('0x6')&&_0x36bcff[_0x95ae('0x7')]&&_0x36bcff['key']){_0x1408e2[_0x36bcff[_0x95ae('0x7')]]&&_0x221e89['push'](util['format'](_0x95ae('0x10'),_0x36bcff[_0x95ae('0xe')],_0x1408e2[_0x36bcff['variableName']]));}else if(_0x36bcff[_0x95ae('0xd')]===_0x95ae('0xa')&&_0x36bcff[_0x95ae('0xb')]&&_0x36bcff[_0x95ae('0xb')][_0x95ae('0xc')]&&_0x36bcff['key']){_0x1408e2[_0x36bcff[_0x95ae('0xb')][_0x95ae('0xc')][_0x95ae('0x12')]()]&&_0x221e89['push'](util['format']('%s:\x20%s',_0x36bcff['key'],_0x1408e2[_0x36bcff[_0x95ae('0xb')][_0x95ae('0xc')][_0x95ae('0x12')]()]));}}}}return _0x221e89[_0x95ae('0x13')](_0x24a895);};exports[_0x95ae('0x14')]=function(_0x28f553){var _0xc36dbc=_0x28f553[_0x95ae('0x15')](-0x1);if(_0xc36dbc==='/'){_0x28f553=_0x28f553[_0x95ae('0x16')](0x0,_0x28f553[_0x95ae('0x17')](_0xc36dbc));}return _0x28f553;};exports[_0x95ae('0x18')]=function(_0x395d49){if(!_[_0x95ae('0x19')](_0x395d49)&&_0x395d49!==''){var _0x5f045c=/^(([^<>()\[\]\\.,;:\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 _0x5f045c['test'](String(_0x395d49)[_0x95ae('0x12')]());}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 efa40fc..e58528d 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 _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(_0x252c31,_0x553b4f){var _0x515065=function(_0x33d34e){while(--_0x33d34e){_0x252c31['push'](_0x252c31['shift']());}};_0x515065(++_0x553b4f);}(_0x9c44,0x178));var _0x49c4=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x9c44[_0x45d55e];return _0x29812a;};'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 +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(_0xbabfb6,_0xf50be7){var _0x28b111=function(_0x518b8d){while(--_0x518b8d){_0xbabfb6['push'](_0xbabfb6['shift']());}};_0x28b111(++_0xf50be7);}(_0x9c44,0x178));var _0x49c4=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x9c44[_0x334841];return _0x5beb4b;};'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 efd8c1c..7a7063d 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 _0x7971=['zendesk','redis','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','POST','merge','Tags','name','getString','Subjects','Descriptions','Ticket\x20created!','ticket','format','%s/search.json','remoteUri','type:user\x20role:agent\x20email:%s','then','count','Agent\x20found!','find','results','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','end-user','first','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Enduser\x20created.','password','authType','token','%s/token:%s','Basic\x20%s','toString','base64','[HTTP]','stringify','defaults','forEach','includes','picklist','nameField','toLowerCase','type','idField','customField','custom_fields','content','variableName','push','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','%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','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger'];(function(_0x1a643a,_0x2f32bc){var _0x4b3765=function(_0x59db8e){while(--_0x59db8e){_0x1a643a['push'](_0x1a643a['shift']());}};_0x4b3765(++_0x2f32bc);}(_0x7971,0x64));var _0x1797=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0x7971[_0x2235bf];return _0x4c3a64;};'use strict';var _=require(_0x1797('0x0'));var rp=require(_0x1797('0x1'));var md5=require(_0x1797('0x2'));var util=require(_0x1797('0x3'));var Redis=require('ioredis');var intUtil=require(_0x1797('0x4'));var config=require(_0x1797('0x5'));var logger=require(_0x1797('0x6'))(_0x1797('0x7'));config[_0x1797('0x8')]=_['defaults'](config['redis'],{'host':_0x1797('0x9'),'port':0x18eb});var io=require(_0x1797('0xa'))(new Redis(config['redis']));function emit(_0x2ad087,_0x12bdf5,_0xb2efa3){io['to'](_0x2ad087)[_0x1797('0xb')](_0x12bdf5,_0xb2efa3);}var headers={'Content-Type':'application/json','Accept':_0x1797('0xc')};function getTicket(_0x45866a,_0x20c7dc,_0xa3b71b,_0x4f2be1,_0x3c456c){logger[_0x1797('0xd')](_0x1797('0xe'));return request({'uri':util['format']('%s/tickets.json',_0x45866a['remoteUri']),'method':_0x1797('0xf'),'body':{'ticket':_[_0x1797('0x10')]({'requester_id':_0xa3b71b['id'],'submitter_id':_0x20c7dc?_0x20c7dc['id']:undefined,'assignee_id':_0x20c7dc?_0x20c7dc['id']:undefined,'tags':getTags(_0x4f2be1[_0x1797('0x11')],_0x1797('0x12')),'subject':intUtil[_0x1797('0x13')](_0x4f2be1[_0x1797('0x14')],_0x3c456c,'\x20'),'description':intUtil[_0x1797('0x13')](_0x4f2be1[_0x1797('0x15')],_0x3c456c,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x4f2be1[_0x1797('0x15')],_0x3c456c,'\x0a')}},getCustomFields(_0x4f2be1['Fields'],_0x3c456c))}})['then'](function(_0x28ca14){logger[_0x1797('0xd')](_0x1797('0x16'));return _0x28ca14[_0x1797('0x17')];});}function getUser(_0x47ed26,_0x20b3dd){if(intUtil['validateEmail'](_0x20b3dd)){logger[_0x1797('0xd')]('Getting\x20agent\x20with\x20email',_0x20b3dd);return request({'uri':util[_0x1797('0x18')](_0x1797('0x19'),_0x47ed26[_0x1797('0x1a')]),'qs':{'query':util[_0x1797('0x18')](_0x1797('0x1b'),_0x20b3dd)}})[_0x1797('0x1c')](function(_0x57baba){if(_0x57baba[_0x1797('0x1d')]){logger[_0x1797('0xd')](_0x1797('0x1e'));return _[_0x1797('0x1f')](_0x57baba[_0x1797('0x20')],{'email':_0x20b3dd,'role':'agent'});}else{logger[_0x1797('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x1797('0x18')]('%s/users/me.json',_0x47ed26[_0x1797('0x1a')])})[_0x1797('0x1c')](function(_0x2b1cdd){logger[_0x1797('0xd')](_0x1797('0x21'));return _0x2b1cdd[_0x1797('0x22')];});}});}else{logger[_0x1797('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x1797('0x18')]('%s/users/me.json',_0x47ed26[_0x1797('0x1a')])})[_0x1797('0x1c')](function(_0x2b7806){logger[_0x1797('0xd')](_0x1797('0x21'));return _0x2b7806['user'];});}}function getEndUser(_0x3a77bc,_0x4afd13,_0x40a4b4){logger['info'](_0x1797('0x23'),_0x40a4b4);return request({'uri':util[_0x1797('0x18')](_0x1797('0x19'),_0x3a77bc[_0x1797('0x1a')]),'qs':{'query':util[_0x1797('0x18')](_0x1797('0x24'),_0x40a4b4)}})['then'](function(_0x21ed48){var _0x4fdaa6;if(_0x21ed48['results'][_0x1797('0x25')]){_0x21ed48[_0x1797('0x20')]=_['filter'](_0x21ed48['results'],{'suspended':![],'role':_0x1797('0x26')});if(_0x21ed48[_0x1797('0x20')][_0x1797('0x25')]){_0x4fdaa6=_[_0x1797('0x27')](_0x21ed48['results']);}}if(_0x4fdaa6){logger[_0x1797('0xd')]('Enduser\x20found!');return _0x4fdaa6;}else{logger[_0x1797('0xd')](_0x1797('0x28'));return request({'uri':util[_0x1797('0x18')](_0x1797('0x29'),_0x3a77bc[_0x1797('0x1a')]),'method':_0x1797('0xf'),'body':{'user':{'role':_0x1797('0x26'),'name':util[_0x1797('0x18')]('Caller\x20-\x20%s',_0x4afd13||_0x40a4b4),'phone':_0x40a4b4}}})['then'](function(_0x1fdca5){logger[_0x1797('0xd')](_0x1797('0x2a'));return _0x1fdca5[_0x1797('0x22')];});}});}function getAuth(_0x3ccfb8){var _0x54cd70;if(_0x3ccfb8['authType']===_0x1797('0x2b')){_0x54cd70=util[_0x1797('0x18')]('%s:%s',_0x3ccfb8['username'],_0x3ccfb8['password']);}else if(_0x3ccfb8[_0x1797('0x2c')]===_0x1797('0x2d')){_0x54cd70=util[_0x1797('0x18')](_0x1797('0x2e'),_0x3ccfb8['username'],_0x3ccfb8[_0x1797('0x2d')]);}return util['format'](_0x1797('0x2f'),new Buffer(_0x54cd70)[_0x1797('0x30')](_0x1797('0x31')));}function request(_0x5716a6){logger['debug'](_0x1797('0x32'),JSON[_0x1797('0x33')](_0x5716a6));return rp(_[_0x1797('0x34')](_0x5716a6,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x4dfe79,_0x3de1d7){var _0x3787f7=[];if(_0x4dfe79&&_0x4dfe79[_0x1797('0x25')]>0x0){_0x3787f7=_['map'](_0x4dfe79,_0x3de1d7);}return _0x3787f7;}function getCustomFields(_0x1527d9,_0x6806d8){var _0x4f9e18=[];var _0x2fdcb0={'custom_fields':[]};if(_0x1527d9[_0x1797('0x25')]>0x0){_[_0x1797('0x35')](_0x1527d9,function(_0x58db61){if(_[_0x1797('0x36')](['string',_0x1797('0x37')],_0x58db61['type'])&&_0x58db61[_0x1797('0x38')]&&!_0x58db61['customField']){_0x2fdcb0[_0x58db61['nameField'][_0x1797('0x39')]()]=_0x58db61['content'][_0x1797('0x30')]();}else if(_['includes'](['string',_0x1797('0x37')],_0x58db61[_0x1797('0x3a')])&&_0x58db61[_0x1797('0x3b')]&&_0x58db61[_0x1797('0x3c')]){_0x2fdcb0[_0x1797('0x3d')]['push']({'id':_0x58db61['idField'],'value':_0x58db61[_0x1797('0x3e')][_0x1797('0x30')]()});}else if(_0x58db61[_0x1797('0x3a')]==='variable'&&_0x58db61[_0x1797('0x3f')]&&_0x58db61[_0x1797('0x3b')]&&_0x58db61[_0x1797('0x3c')]){_0x6806d8[_0x58db61[_0x1797('0x3f')]]&&_0x2fdcb0['custom_fields'][_0x1797('0x40')]({'id':_0x58db61[_0x1797('0x3b')],'value':_0x6806d8[_0x58db61[_0x1797('0x3f')]][_0x1797('0x30')]()});}else if(_0x58db61[_0x1797('0x3a')]===_0x1797('0x41')&&_0x58db61[_0x1797('0x42')]&&_0x58db61[_0x1797('0x42')][_0x1797('0x12')]&&_0x58db61['idField']&&_0x58db61[_0x1797('0x3c')]){_0x6806d8[_0x58db61['Variable'][_0x1797('0x12')][_0x1797('0x39')]()]&&_0x2fdcb0[_0x1797('0x3d')][_0x1797('0x40')]({'id':_0x58db61[_0x1797('0x3b')],'value':_0x6806d8[_0x58db61['Variable'][_0x1797('0x12')]['toLowerCase']()]['toString']()});}});}return _0x2fdcb0;}exports[_0x1797('0x43')]=function(_0x5aa65b,_0x392ae9,_0x13cc71,_0x406b90,_0x5d0a57,_0x162cae){var _0x3195e5,_0x272eea;_0x162cae['remoteUri']=intUtil[_0x1797('0x44')](_0x162cae[_0x1797('0x1a')]);_0x162cae['serverUrl']=intUtil[_0x1797('0x44')](_0x162cae[_0x1797('0x45')]);if(_0x5d0a57&&_0x5d0a57[_0x1797('0x46')]){logger[_0x1797('0xd')](_0x1797('0x47'),_0x1797('0x48'));_0x392ae9[_0x1797('0x49')]=util[_0x1797('0x18')](_0x1797('0x4a'),_0x162cae[_0x1797('0x45')],_0x392ae9['uniqueid'],md5(_0x392ae9[_0x1797('0x4b')]));}else{_0x392ae9[_0x1797('0x49')]='';}headers[_0x1797('0x4c')]=getAuth(_0x162cae);return getUser(_0x162cae,_0x406b90[_0x1797('0x4d')])[_0x1797('0x1c')](function(_0x11fdb5){_0x3195e5=_0x11fdb5;logger[_0x1797('0xd')](_0x1797('0x4e'),_0x3195e5['id']);return getEndUser(_0x162cae,_0x392ae9[_0x1797('0x4f')],_0x392ae9[_0x1797('0x50')]);})[_0x1797('0x1c')](function(_0x3171cb){_0x272eea=_0x3171cb;logger['info'](_0x1797('0x51'),_0x272eea['id']);return getTicket(_0x162cae,_0x3195e5,_0x272eea,_0x13cc71,_0x392ae9);})[_0x1797('0x1c')](function(_0x29db83){if(_0x29db83){logger['info'](_0x1797('0x52'),_0x29db83['id']);switch(_0x162cae[_0x1797('0x3a')]){case _0x1797('0x53'):logger['info'](_0x1797('0x47'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x1797('0x18')](_0x1797('0x54'),_0x162cae['remoteUri'],_0x3195e5['id'],_0x29db83['id']),'method':'POST'});case _0x1797('0x55'):logger[_0x1797('0xd')](_0x1797('0x47'),_0x1797('0x56'));emit(util['format'](_0x1797('0x57'),_0x406b90[_0x1797('0x12')]),_0x1797('0x58'),{'uri':util[_0x1797('0x18')](_0x1797('0x59'),_0x162cae[_0x1797('0x1a')][_0x1797('0x5a')](_0x1797('0x5b'),''),_0x29db83['id'])});break;default:logger[_0x1797('0x5c')](_0x1797('0x47'),_0x1797('0x5d'));}}})[_0x1797('0x5e')](function(_0x5ac377){logger[_0x1797('0x5c')](_0x1797('0x5f'),util[_0x1797('0x60')](_0x5ac377,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x5b27f0,_0x27988b,_0x3a3cc4,_0x480c6a,_0x59b51b,_0x1675cf,_0x2ae271){var _0x1ec7b8,_0x254541;_0x1675cf['remoteUri']=intUtil[_0x1797('0x44')](_0x1675cf[_0x1797('0x1a')]);_0x1675cf['serverUrl']=intUtil[_0x1797('0x44')](_0x1675cf[_0x1797('0x45')]);if(_0x2ae271&&_0x2ae271[_0x1797('0x61')]&&_0x2ae271[_0x1797('0x61')]!==_0x1797('0x62')){logger[_0x1797('0xd')](_0x1797('0x63'),_0x1797('0x48'));_0x27988b[_0x1797('0x49')]=util[_0x1797('0x18')](_0x1797('0x4a'),_0x1675cf[_0x1797('0x45')],_0x27988b[_0x1797('0x4b')],md5(_0x27988b[_0x1797('0x4b')]));}headers['Authorization']=getAuth(_0x1675cf);return getUser(_0x1675cf,_0x480c6a[_0x1797('0x4d')])[_0x1797('0x1c')](function(_0x3d8286){_0x1ec7b8=_0x3d8286;logger[_0x1797('0xd')]('The\x20User\x20ID\x20is:',_0x1ec7b8['id']);return getEndUser(_0x1675cf,_0x27988b[_0x1797('0x64')],_0x27988b[_0x1797('0x65')]);})[_0x1797('0x1c')](function(_0x1f17cd){_0x254541=_0x1f17cd;logger[_0x1797('0xd')](_0x1797('0x51'),_0x254541['id']);return getTicket(_0x1675cf,_0x1ec7b8,_0x254541,_0x3a3cc4,_0x27988b);})[_0x1797('0x1c')](function(_0x23c945){if(_0x23c945){logger[_0x1797('0xd')](_0x1797('0x52'),_0x23c945['id']);switch(_0x1675cf[_0x1797('0x3a')]){case _0x1797('0x53'):logger[_0x1797('0xd')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x1797('0x18')](_0x1797('0x54'),_0x1675cf['remoteUri'],_0x1ec7b8['id'],_0x23c945['id']),'method':_0x1797('0xf')});case _0x1797('0x55'):logger[_0x1797('0xd')](_0x1797('0x63'),_0x1797('0x56'));emit(util['format'](_0x1797('0x57'),_0x480c6a[_0x1797('0x12')]),_0x1797('0x58'),{'uri':util['format'](_0x1797('0x59'),_0x1675cf[_0x1797('0x1a')][_0x1797('0x5a')](_0x1797('0x5b'),''),_0x23c945['id'])});break;default:logger[_0x1797('0x5c')](_0x1797('0x63'),_0x1797('0x5d'));}}})[_0x1797('0x5e')](function(_0x3b4fa7){logger[_0x1797('0x5c')](_0x1797('0x66'),util[_0x1797('0x60')](_0x3b4fa7,{'showHidden':!![],'depth':null}));});};exports[_0x1797('0x67')]=function(_0x300944,_0x4dbf52,_0x25532f,_0x101306,_0x527f47,_0x20df30){var _0x432580,_0x590cbe;_0x20df30[_0x1797('0x1a')]=intUtil[_0x1797('0x44')](_0x20df30['remoteUri']);_0x20df30[_0x1797('0x45')]=intUtil[_0x1797('0x44')](_0x20df30[_0x1797('0x45')]);if(_0x527f47&&_0x527f47[_0x1797('0x46')]){logger[_0x1797('0xd')]('['+_0x4dbf52[_0x1797('0x68')][_0x1797('0x69')]()+']',_0x1797('0x48'));_0x4dbf52[_0x1797('0x49')]=util[_0x1797('0x18')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x20df30[_0x1797('0x45')],_0x4dbf52[_0x1797('0x4b')],md5(_0x4dbf52[_0x1797('0x4b')]));}else{_0x4dbf52[_0x1797('0x49')]='';}headers[_0x1797('0x4c')]=getAuth(_0x20df30);return getUser(_0x20df30)[_0x1797('0x1c')](function(_0x4c31de){_0x432580=_0x4c31de;logger[_0x1797('0xd')](_0x1797('0x4e'),_0x432580['id']);return getEndUser(_0x20df30,_0x4dbf52[_0x1797('0x4f')],_0x4dbf52[_0x1797('0x50')]);})[_0x1797('0x1c')](function(_0x236e85){_0x590cbe=_0x236e85;logger['info'](_0x1797('0x51'),_0x590cbe['id']);return getTicket(_0x20df30,_0x432580,_0x590cbe,_0x25532f,_0x4dbf52);})[_0x1797('0x1c')](function(_0x341ae2){if(_0x341ae2){logger[_0x1797('0xd')](_0x1797('0x52'),_0x341ae2['id']);}})[_0x1797('0x5e')](function(_0x351381){logger[_0x1797('0x5c')]('['+_0x4dbf52[_0x1797('0x68')][_0x1797('0x69')]()+']'+_0x1797('0x6a'),util[_0x1797('0x60')](_0x351381,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x9403=['Fields','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','then','count','Agent\x20found!','find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','results','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Caller\x20-\x20%s','authType','password','%s:%s','token','%s/token:%s','username','toString','base64','debug','[HTTP]','stringify','includes','string','type','nameField','customField','toLowerCase','content','picklist','idField','custom_fields','push','variableName','customVariable','Variable','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Ticket\x20ID\x20is:','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','newTab','trigger:browser:url','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','toUpperCase','lastevent','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','util','ioredis','./util','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Subjects','Descriptions'];(function(_0x415a7b,_0x40e131){var _0xd3e4c9=function(_0x1fa6ea){while(--_0x1fa6ea){_0x415a7b['push'](_0x415a7b['shift']());}};_0xd3e4c9(++_0x40e131);}(_0x9403,0xc7));var _0x3940=function(_0x13b299,_0x13f373){_0x13b299=_0x13b299-0x0;var _0x48aef0=_0x9403[_0x13b299];return _0x48aef0;};'use strict';var _=require(_0x3940('0x0'));var rp=require(_0x3940('0x1'));var md5=require('md5');var util=require(_0x3940('0x2'));var Redis=require(_0x3940('0x3'));var intUtil=require(_0x3940('0x4'));var config=require(_0x3940('0x5'));var logger=require('../../../../config/logger')('zendesk');config[_0x3940('0x6')]=_[_0x3940('0x7')](config[_0x3940('0x6')],{'host':_0x3940('0x8'),'port':0x18eb});var io=require(_0x3940('0x9'))(new Redis(config[_0x3940('0x6')]));function emit(_0x56d3be,_0x19fc40,_0x54b4d5){io['to'](_0x56d3be)['emit'](_0x19fc40,_0x54b4d5);}var headers={'Content-Type':_0x3940('0xa'),'Accept':_0x3940('0xa')};function getTicket(_0x2526cb,_0x399c4c,_0x4236f0,_0x5ce595,_0x1e3435){logger[_0x3940('0xb')](_0x3940('0xc'));return request({'uri':util[_0x3940('0xd')](_0x3940('0xe'),_0x2526cb[_0x3940('0xf')]),'method':_0x3940('0x10'),'body':{'ticket':_[_0x3940('0x11')]({'requester_id':_0x4236f0['id'],'submitter_id':_0x399c4c?_0x399c4c['id']:undefined,'assignee_id':_0x399c4c?_0x399c4c['id']:undefined,'tags':getTags(_0x5ce595[_0x3940('0x12')],_0x3940('0x13')),'subject':intUtil[_0x3940('0x14')](_0x5ce595[_0x3940('0x15')],_0x1e3435,'\x20'),'description':intUtil['getString'](_0x5ce595['Descriptions'],_0x1e3435,'\x0a'),'comment':{'public':![],'body':intUtil[_0x3940('0x14')](_0x5ce595[_0x3940('0x16')],_0x1e3435,'\x0a')}},getCustomFields(_0x5ce595[_0x3940('0x17')],_0x1e3435))}})['then'](function(_0x41c463){logger[_0x3940('0xb')]('Ticket\x20created!');return _0x41c463[_0x3940('0x18')];});}function getUser(_0x58c019,_0x4418f3){if(intUtil[_0x3940('0x19')](_0x4418f3)){logger['info'](_0x3940('0x1a'),_0x4418f3);return request({'uri':util['format'](_0x3940('0x1b'),_0x58c019[_0x3940('0xf')]),'qs':{'query':util[_0x3940('0xd')]('type:user\x20role:agent\x20email:%s',_0x4418f3)}})[_0x3940('0x1c')](function(_0x4283bb){if(_0x4283bb[_0x3940('0x1d')]){logger[_0x3940('0xb')](_0x3940('0x1e'));return _[_0x3940('0x1f')](_0x4283bb['results'],{'email':_0x4418f3,'role':_0x3940('0x20')});}else{logger['info'](_0x3940('0x21'));return request({'uri':util[_0x3940('0xd')](_0x3940('0x22'),_0x58c019[_0x3940('0xf')])})[_0x3940('0x1c')](function(_0x529494){logger[_0x3940('0xb')](_0x3940('0x23'));return _0x529494['user'];});}});}else{logger['info'](_0x3940('0x21'));return request({'uri':util[_0x3940('0xd')](_0x3940('0x22'),_0x58c019['remoteUri'])})['then'](function(_0x1978f0){logger[_0x3940('0xb')](_0x3940('0x23'));return _0x1978f0[_0x3940('0x24')];});}}function getEndUser(_0x3e2b5f,_0x951e8d,_0x10be20){logger[_0x3940('0xb')](_0x3940('0x25'),_0x10be20);return request({'uri':util[_0x3940('0xd')](_0x3940('0x1b'),_0x3e2b5f[_0x3940('0xf')]),'qs':{'query':util['format'](_0x3940('0x26'),_0x10be20)}})[_0x3940('0x1c')](function(_0x3f66d8){var _0x4af94d;if(_0x3f66d8['results'][_0x3940('0x27')]){_0x3f66d8['results']=_[_0x3940('0x28')](_0x3f66d8[_0x3940('0x29')],{'suspended':![],'role':_0x3940('0x2a')});if(_0x3f66d8[_0x3940('0x29')][_0x3940('0x27')]){_0x4af94d=_[_0x3940('0x2b')](_0x3f66d8['results']);}}if(_0x4af94d){logger[_0x3940('0xb')](_0x3940('0x2c'));return _0x4af94d;}else{logger['info'](_0x3940('0x2d'));return request({'uri':util[_0x3940('0xd')]('%s/users.json',_0x3e2b5f[_0x3940('0xf')]),'method':'POST','body':{'user':{'role':_0x3940('0x2a'),'name':util['format'](_0x3940('0x2e'),_0x951e8d||_0x10be20),'phone':_0x10be20}}})[_0x3940('0x1c')](function(_0x5e3181){logger['info']('Enduser\x20created.');return _0x5e3181[_0x3940('0x24')];});}});}function getAuth(_0x340c6a){var _0x885a87;if(_0x340c6a[_0x3940('0x2f')]===_0x3940('0x30')){_0x885a87=util['format'](_0x3940('0x31'),_0x340c6a['username'],_0x340c6a[_0x3940('0x30')]);}else if(_0x340c6a[_0x3940('0x2f')]===_0x3940('0x32')){_0x885a87=util[_0x3940('0xd')](_0x3940('0x33'),_0x340c6a[_0x3940('0x34')],_0x340c6a[_0x3940('0x32')]);}return util[_0x3940('0xd')]('Basic\x20%s',new Buffer(_0x885a87)[_0x3940('0x35')](_0x3940('0x36')));}function request(_0x1ba614){logger[_0x3940('0x37')](_0x3940('0x38'),JSON[_0x3940('0x39')](_0x1ba614));return rp(_['defaults'](_0x1ba614,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x2231a2,_0x454bc1){var _0x51ce09=[];if(_0x2231a2&&_0x2231a2[_0x3940('0x27')]>0x0){_0x51ce09=_['map'](_0x2231a2,_0x454bc1);}return _0x51ce09;}function getCustomFields(_0x261183,_0x3aa6e8){var _0x18e310=[];var _0xe4e80={'custom_fields':[]};if(_0x261183[_0x3940('0x27')]>0x0){_['forEach'](_0x261183,function(_0x14d156){if(_[_0x3940('0x3a')]([_0x3940('0x3b'),'picklist'],_0x14d156[_0x3940('0x3c')])&&_0x14d156[_0x3940('0x3d')]&&!_0x14d156[_0x3940('0x3e')]){_0xe4e80[_0x14d156['nameField'][_0x3940('0x3f')]()]=_0x14d156[_0x3940('0x40')]['toString']();}else if(_[_0x3940('0x3a')]([_0x3940('0x3b'),_0x3940('0x41')],_0x14d156[_0x3940('0x3c')])&&_0x14d156[_0x3940('0x42')]&&_0x14d156['customField']){_0xe4e80[_0x3940('0x43')][_0x3940('0x44')]({'id':_0x14d156[_0x3940('0x42')],'value':_0x14d156[_0x3940('0x40')]['toString']()});}else if(_0x14d156['type']==='variable'&&_0x14d156[_0x3940('0x45')]&&_0x14d156[_0x3940('0x42')]&&_0x14d156[_0x3940('0x3e')]){_0x3aa6e8[_0x14d156[_0x3940('0x45')]]&&_0xe4e80[_0x3940('0x43')][_0x3940('0x44')]({'id':_0x14d156['idField'],'value':_0x3aa6e8[_0x14d156['variableName']][_0x3940('0x35')]()});}else if(_0x14d156['type']===_0x3940('0x46')&&_0x14d156[_0x3940('0x47')]&&_0x14d156['Variable'][_0x3940('0x13')]&&_0x14d156[_0x3940('0x42')]&&_0x14d156[_0x3940('0x3e')]){_0x3aa6e8[_0x14d156[_0x3940('0x47')][_0x3940('0x13')][_0x3940('0x3f')]()]&&_0xe4e80['custom_fields'][_0x3940('0x44')]({'id':_0x14d156[_0x3940('0x42')],'value':_0x3aa6e8[_0x14d156['Variable'][_0x3940('0x13')][_0x3940('0x3f')]()][_0x3940('0x35')]()});}});}return _0xe4e80;}exports['queue']=function(_0x4b5ff0,_0x444698,_0x43f8c8,_0x11d954,_0x3accac,_0x58bc81){var _0x266c6f,_0x2b187b;_0x58bc81[_0x3940('0xf')]=intUtil[_0x3940('0x48')](_0x58bc81[_0x3940('0xf')]);_0x58bc81[_0x3940('0x49')]=intUtil['stripTrailingSlash'](_0x58bc81['serverUrl']);if(_0x3accac&&_0x3accac[_0x3940('0x4a')]){logger[_0x3940('0xb')](_0x3940('0x4b'),_0x3940('0x4c'));_0x444698[_0x3940('0x4d')]=util[_0x3940('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x58bc81[_0x3940('0x49')],_0x444698[_0x3940('0x4e')],md5(_0x444698[_0x3940('0x4e')]));}else{_0x444698[_0x3940('0x4d')]='';}headers[_0x3940('0x4f')]=getAuth(_0x58bc81);return getUser(_0x58bc81,_0x11d954[_0x3940('0x50')])[_0x3940('0x1c')](function(_0x117032){_0x266c6f=_0x117032;logger[_0x3940('0xb')](_0x3940('0x51'),_0x266c6f['id']);return getEndUser(_0x58bc81,_0x444698[_0x3940('0x52')],_0x444698[_0x3940('0x53')]);})[_0x3940('0x1c')](function(_0x35ea9c){_0x2b187b=_0x35ea9c;logger[_0x3940('0xb')]('The\x20Enduser\x20ID\x20is:',_0x2b187b['id']);return getTicket(_0x58bc81,_0x266c6f,_0x2b187b,_0x43f8c8,_0x444698);})[_0x3940('0x1c')](function(_0x811cb1){if(_0x811cb1){logger[_0x3940('0xb')](_0x3940('0x54'),_0x811cb1['id']);switch(_0x58bc81['type']){case _0x3940('0x55'):logger[_0x3940('0xb')](_0x3940('0x4b'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format'](_0x3940('0x56'),_0x58bc81[_0x3940('0xf')],_0x266c6f['id'],_0x811cb1['id']),'method':_0x3940('0x10')});case'newTab':logger[_0x3940('0xb')]('[QUEUE]',_0x3940('0x57'));emit(util['format'](_0x3940('0x58'),_0x11d954[_0x3940('0x13')]),'trigger:browser:url',{'uri':util[_0x3940('0xd')](_0x3940('0x59'),_0x58bc81['remoteUri'][_0x3940('0x5a')](_0x3940('0x5b'),''),_0x811cb1['id'])});break;default:logger[_0x3940('0x5c')]('[QUEUE]',_0x3940('0x5d'));}}})[_0x3940('0x5e')](function(_0x55f1c3){logger[_0x3940('0x5c')](_0x3940('0x5f'),util[_0x3940('0x60')](_0x55f1c3,{'showHidden':!![],'depth':null}));});};exports[_0x3940('0x61')]=function(_0xd53987,_0x295f92,_0x329f69,_0x242bf4,_0x51acaa,_0x5932f8,_0x45a214){var _0x555732,_0x2027c9;_0x5932f8[_0x3940('0xf')]=intUtil[_0x3940('0x48')](_0x5932f8[_0x3940('0xf')]);_0x5932f8[_0x3940('0x49')]=intUtil[_0x3940('0x48')](_0x5932f8[_0x3940('0x49')]);if(_0x45a214&&_0x45a214[_0x3940('0x62')]&&_0x45a214[_0x3940('0x62')]!==_0x3940('0x63')){logger[_0x3940('0xb')](_0x3940('0x64'),_0x3940('0x4c'));_0x295f92[_0x3940('0x4d')]=util[_0x3940('0xd')](_0x3940('0x65'),_0x5932f8[_0x3940('0x49')],_0x295f92['uniqueid'],md5(_0x295f92['uniqueid']));}headers[_0x3940('0x4f')]=getAuth(_0x5932f8);return getUser(_0x5932f8,_0x242bf4[_0x3940('0x50')])[_0x3940('0x1c')](function(_0x2fcede){_0x555732=_0x2fcede;logger[_0x3940('0xb')](_0x3940('0x51'),_0x555732['id']);return getEndUser(_0x5932f8,_0x295f92['destcalleridname'],_0x295f92['destcalleridnum']);})[_0x3940('0x1c')](function(_0x2514d6){_0x2027c9=_0x2514d6;logger[_0x3940('0xb')](_0x3940('0x66'),_0x2027c9['id']);return getTicket(_0x5932f8,_0x555732,_0x2027c9,_0x329f69,_0x295f92);})[_0x3940('0x1c')](function(_0x53ebd4){if(_0x53ebd4){logger[_0x3940('0xb')](_0x3940('0x54'),_0x53ebd4['id']);switch(_0x5932f8[_0x3940('0x3c')]){case _0x3940('0x55'):logger[_0x3940('0xb')](_0x3940('0x64'),_0x3940('0x67'));return request({'uri':util[_0x3940('0xd')](_0x3940('0x56'),_0x5932f8[_0x3940('0xf')],_0x555732['id'],_0x53ebd4['id']),'method':_0x3940('0x10')});case _0x3940('0x68'):logger[_0x3940('0xb')](_0x3940('0x64'),_0x3940('0x57'));emit(util['format'](_0x3940('0x58'),_0x242bf4[_0x3940('0x13')]),_0x3940('0x69'),{'uri':util[_0x3940('0xd')](_0x3940('0x59'),_0x5932f8['remoteUri'][_0x3940('0x5a')](_0x3940('0x5b'),''),_0x53ebd4['id'])});break;default:logger[_0x3940('0x5c')]('[OUTBOUND]',_0x3940('0x5d'));}}})['catch'](function(_0x5c2730){logger[_0x3940('0x5c')](_0x3940('0x6a'),util[_0x3940('0x60')](_0x5c2730,{'showHidden':!![],'depth':null}));});};exports[_0x3940('0x6b')]=function(_0x1e891e,_0x5c5bfd,_0x515347,_0x2d4026,_0x3a2b8a,_0x4263f3){var _0x4b3740,_0x595606;_0x4263f3[_0x3940('0xf')]=intUtil[_0x3940('0x48')](_0x4263f3[_0x3940('0xf')]);_0x4263f3['serverUrl']=intUtil[_0x3940('0x48')](_0x4263f3['serverUrl']);if(_0x3a2b8a&&_0x3a2b8a['monitor_format']){logger['info']('['+_0x5c5bfd['lastevent'][_0x3940('0x6c')]()+']','Recording\x20is\x20enabled!');_0x5c5bfd[_0x3940('0x4d')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4263f3['serverUrl'],_0x5c5bfd[_0x3940('0x4e')],md5(_0x5c5bfd[_0x3940('0x4e')]));}else{_0x5c5bfd['recordingURL']='';}headers['Authorization']=getAuth(_0x4263f3);return getUser(_0x4263f3)['then'](function(_0x37951a){_0x4b3740=_0x37951a;logger[_0x3940('0xb')](_0x3940('0x51'),_0x4b3740['id']);return getEndUser(_0x4263f3,_0x5c5bfd['calleridname'],_0x5c5bfd[_0x3940('0x53')]);})[_0x3940('0x1c')](function(_0x46c6c6){_0x595606=_0x46c6c6;logger['info'](_0x3940('0x66'),_0x595606['id']);return getTicket(_0x4263f3,_0x4b3740,_0x595606,_0x515347,_0x5c5bfd);})[_0x3940('0x1c')](function(_0x4e17c3){if(_0x4e17c3){logger[_0x3940('0xb')](_0x3940('0x54'),_0x4e17c3['id']);}})[_0x3940('0x5e')](function(_0x35b028){logger[_0x3940('0x5c')]('['+_0x5c5bfd[_0x3940('0x6d')]['toUpperCase']()+']'+_0x3940('0x6e'),util['inspect'](_0x35b028,{'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 ed73da3..fcade39 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 _0x1dd5=['zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientId','clientSecret','refresh_token','then','add','seconds','catch','Failing\x20creating\x20the\x20access_token','stack','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','findIndex','email','Agent\x20found!','info','profile','Administrator','Using\x20the\x20admin\x20account!','user','error','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','startCase','role','first_name','last_name','code','SUCCESS','details','Error:\x20','CREATE\x20ERROR','moduleSearch','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','moduleCreate','lead','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','answertime','endtime','YYYY-MM-DDTHH:mm:ss','mm:ss','lastevent','called','Call_Result','Called','complete','connect','Answered','rejected','Rejected','Abandoned','Timeout','Call_Start_Time','outbound','starttime','agentcalledAt','Call_Type','Inbound','Fields','/crm/v2/Calls','Call\x20created!','err','log','queue','host','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','zoho.eu','The\x20User\x20ID\x20is:','calleridname','calleridnum','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','https://crm.','/crm/EntityInfo.do?module=Calls&id=','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','/downloads?type=uniqueid&token=','destcalleridname','destcalleridnum','Outbound','The\x20Call\x20ID\x20is:','unmanaged','com','toUpperCase','lodash','request-promise','md5','./util','ioredis','zoho','redis','defaults','socket.io-emitter','emit','[HTTP]','stringify','length','forEach','includes','string','picklist','type','idField','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in'];(function(_0x3083a0,_0x44a49b){var _0x131c67=function(_0x736c02){while(--_0x736c02){_0x3083a0['push'](_0x3083a0['shift']());}};_0x131c67(++_0x44a49b);}(_0x1dd5,0x1bc));var _0x51dd=function(_0x4ed638,_0x3980f6){_0x4ed638=_0x4ed638-0x0;var _0x1cdfec=_0x1dd5[_0x4ed638];return _0x1cdfec;};'use strict';var _=require(_0x51dd('0x0'));var rp=require(_0x51dd('0x1'));var md5=require(_0x51dd('0x2'));var util=require('util');var intUtil=require(_0x51dd('0x3'));var moment=require('moment');var Redis=require(_0x51dd('0x4'));var BPromise=require('bluebird');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x51dd('0x5'));config[_0x51dd('0x6')]=_[_0x51dd('0x7')](config[_0x51dd('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x51dd('0x8'))(new Redis(config[_0x51dd('0x6')]));function emit(_0x31d23b,_0x4081f5,_0x251d5b){io['to'](_0x31d23b)[_0x51dd('0x9')](_0x4081f5,_0x251d5b);}function request(_0x11c1e8){logger['debug'](_0x51dd('0xa'),JSON[_0x51dd('0xb')](_0x11c1e8));return rp(_0x11c1e8);}function getCustomFields(_0x465fd1,_0xdc2160){var _0x46fd66={};if(_0x465fd1[_0x51dd('0xc')]>0x0){_[_0x51dd('0xd')](_0x465fd1,function(_0xf53608){if(_[_0x51dd('0xe')]([_0x51dd('0xf'),_0x51dd('0x10')],_0xf53608[_0x51dd('0x11')])&&_0xf53608[_0x51dd('0x12')]){_0x46fd66[_0xf53608['idField']]=_0xf53608[_0x51dd('0x13')]['toString']();}else if(_0xf53608['type']===_0x51dd('0x14')&&_0xf53608[_0x51dd('0x15')]&&_0xf53608[_0x51dd('0x12')]&&_0xdc2160[_0xf53608[_0x51dd('0x15')]]){_0x46fd66[_0xf53608[_0x51dd('0x12')]]=_0xdc2160[_0xf53608[_0x51dd('0x15')]][_0x51dd('0x16')]();}else if(_0xf53608[_0x51dd('0x11')]===_0x51dd('0x17')&&_0xf53608[_0x51dd('0x18')]&&_0xf53608[_0x51dd('0x18')][_0x51dd('0x19')]&&_0xf53608[_0x51dd('0x12')]&&_0xdc2160[_0xf53608[_0x51dd('0x18')][_0x51dd('0x19')][_0x51dd('0x1a')]()]){_0x46fd66[_0xf53608[_0x51dd('0x12')]]=_0xdc2160[_0xf53608['Variable']['name'][_0x51dd('0x1a')]()][_0x51dd('0x16')]();}});}return _0x46fd66;}function getName(_0x2f5fd7){if(_0x2f5fd7[_0x51dd('0x1b')]('\x20')>0x0){var _0x2e2795=_0x2f5fd7[_0x51dd('0x1c')](/ (.+)/);if(_0x2e2795[0x1]){return _0x2e2795;}}return[_0x2f5fd7,_0x2f5fd7];}var accountsTokens={};function getAccessToken(_0x17fb0a){return new Promise(function(_0x5a89c8,_0x5010dc){if(!_[_0x51dd('0x1d')](accountsTokens[_0x17fb0a['id']])&&!_[_0x51dd('0x1d')](accountsTokens[_0x17fb0a['id']][_0x51dd('0x1e')])){if(moment()[_0x51dd('0x1f')](accountsTokens[_0x17fb0a['id']][_0x51dd('0x20')])){_0x5a89c8(accountsTokens[_0x17fb0a['id']]['access_token']);}}var _0x49199a;switch(_0x17fb0a[_0x51dd('0x21')]){case'US':_0x49199a=_0x51dd('0x22');break;case'AU':_0x49199a='https://accounts.zoho.com.au';break;case'EU':_0x49199a=_0x51dd('0x23');break;case'IN':_0x49199a='https://accounts.zoho.in';break;case'CN':_0x49199a=_0x51dd('0x24');break;default:_0x49199a=_0x51dd('0x23');break;}var _0x39a783={'method':_0x51dd('0x25'),'uri':_0x49199a+_0x51dd('0x26'),'qs':{'refresh_token':_0x17fb0a['refreshToken'],'client_id':_0x17fb0a[_0x51dd('0x27')],'client_secret':_0x17fb0a[_0x51dd('0x28')],'grant_type':_0x51dd('0x29')},'json':!![]};return rp(_0x39a783)[_0x51dd('0x2a')](function(_0x14ad1e){accountsTokens[_0x17fb0a['id']]={'access_token':_0x14ad1e[_0x51dd('0x1e')],'expires_in':moment()[_0x51dd('0x2b')](_0x14ad1e['expires_in'],_0x51dd('0x2c'))};_0x5a89c8(_0x14ad1e['access_token']);})[_0x51dd('0x2d')](function(_0x4f95ae){logger['error'](_0x51dd('0x2e'),_0x4f95ae[_0x51dd('0x2f')]);_0x5010dc(_0x4f95ae);});});}function getUser(_0x4fc260,_0xc93808,_0x49961e,_0x3b24e2){logger['info']('Search\x20user');return request({'method':_0x51dd('0x30'),'uri':util[_0x51dd('0x31')](_0x51dd('0x32'),_0xc93808),'qs':{'type':_0x51dd('0x33')},'headers':{'Authorization':_0x51dd('0x34')+_0x4fc260},'json':!![]})['then'](function(_0x422b68){if(_0x422b68[_0x51dd('0x35')]){var _0x4e4e4a=-0x1;if(_['isArrayLikeObject'](_0x422b68[_0x51dd('0x35')])){if(!_[_0x51dd('0x1d')](_0x3b24e2)){_0x4e4e4a=_[_0x51dd('0x36')](_0x422b68[_0x51dd('0x35')],function(_0x2b43d5){return _0x2b43d5[_0x51dd('0x37')]===_0x3b24e2;});}if(_0x4e4e4a>=0x0){logger['info'](_0x51dd('0x38'));}else{logger[_0x51dd('0x39')]('Using\x20the\x20admin\x20account!');_0x4e4e4a=_['findIndex'](_0x422b68['users'],function(_0xb54255){return _0xb54255[_0x51dd('0x3a')]['name']===_0x51dd('0x3b');});}return _0x422b68['users'][_0x4e4e4a];}else{if(_0x422b68['user']['profile']['name']==='Administrator'){logger[_0x51dd('0x39')](_0x51dd('0x3c'));user=_0x422b68[_0x51dd('0x3d')];return user;}else{logger[_0x51dd('0x3e')](_0x51dd('0x3f'),JSON[_0x51dd('0xb')](_0x422b68));throw new Error(_0x51dd('0x40')+JSON[_0x51dd('0xb')](_0x422b68));}}}else{logger[_0x51dd('0x3e')](_0x51dd('0x3f'),JSON[_0x51dd('0xb')](_0x422b68));throw new Error(_0x51dd('0x40')+JSON[_0x51dd('0xb')](_0x422b68));}})[_0x51dd('0x2d')](function(_0xcf223a){console['error'](_0xcf223a);});}function getZohoUser(_0x4de81a,_0x26f011){return new BPromise(function(_0x558007,_0x4e73a1){request(_0x4de81a)[_0x51dd('0x2a')](function(_0x1f7f2d){var _0x138cf6=null;if(_0x1f7f2d){_0x138cf6=_0x1f7f2d[_0x51dd('0x41')][0x0];_0x138cf6[_0x51dd('0x42')]=_0x26f011;}_0x558007(_0x138cf6);})[_0x51dd('0x2d')](function(_0xd824f1){_0x4e73a1(_0xd824f1);});});}function createEndUser(_0x588b12,_0x54f5ae,_0x5c077b,_0x4fae73,_0xd05a1b,_0x10e131){var _0x5c077b=getName(_0x5c077b);return request({'method':_0x51dd('0x25'),'uri':_0x51dd('0x43')+_0x54f5ae+'/crm/v2/'+_[_0x51dd('0x44')](_0x10e131['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x5c077b[0x1],'First_Name':_0x5c077b[0x0],'Phone':_0x4fae73,'Owner':{'name':!_[_0x51dd('0x1d')](_0xd05a1b['role']['name'])?_0xd05a1b[_0x51dd('0x45')][_0x51dd('0x19')]:!_[_0x51dd('0x1d')](_0xd05a1b[_0x51dd('0x46')])?_0xd05a1b[_0x51dd('0x46')]+'\x20'+_0xd05a1b['last_name']:_0xd05a1b[_0x51dd('0x47')],'id':_0xd05a1b['id']}}]},'headers':{'Authorization':_0x51dd('0x34')+_0x588b12},'json':!![]})[_0x51dd('0x2a')](function(_0x3c030a){if(_0x3c030a&&_0x3c030a[_0x51dd('0x41')][0x0][_0x51dd('0x48')]===_0x51dd('0x49')){var _0x26653b=_0x3c030a['data'][0x0][_0x51dd('0x4a')];_0x26653b[_0x51dd('0x42')]=_[_0x51dd('0x44')](_0x10e131['moduleCreate'])+'s';return _0x26653b;}logger[_0x51dd('0x3e')](_0x51dd('0x3f'),JSON[_0x51dd('0xb')](data));throw new Error(_0x51dd('0x4b')+JSON['stringify'](data));})[_0x51dd('0x2d')](function(_0x316897){console['log'](_0x51dd('0x4c'),_0x316897);});}function getEndUser(_0x3ea34f,_0x2d9e09,_0x5b48bc,_0x35b7d2,_0x199af6,_0x3b2135,_0x5b0c26){var _0x3d85b6={'method':_0x51dd('0x30'),'uri':'','headers':{'Authorization':_0x51dd('0x34')+_0x3ea34f},'json':!![]};switch(_0x5b0c26[_0x51dd('0x4d')]){case'contact_lead':_0x3d85b6[_0x51dd('0x4e')]=_0x51dd('0x43')+_0x2d9e09+_0x51dd('0x4f')+_0x199af6+'))';return getZohoUser(_0x3d85b6,_0x51dd('0x50'))[_0x51dd('0x2a')](function(_0x3e3b29){if(_0x3e3b29)return _0x3e3b29;_0x3d85b6['uri']=_0x51dd('0x43')+_0x2d9e09+_0x51dd('0x51')+_0x199af6+'))';return getZohoUser(_0x3d85b6,_0x51dd('0x52'))[_0x51dd('0x2a')](function(_0x3a4633){if(_0x3a4633)return _0x3a4633;if(_0x5b0c26['moduleCreate']!=_0x51dd('0x53')){return createEndUser(_0x3ea34f,_0x2d9e09,_0x35b7d2,_0x199af6,_0x3b2135,_0x5b0c26);}else{return{};}});});break;case _0x51dd('0x54'):_0x3d85b6[_0x51dd('0x4e')]=_0x51dd('0x43')+_0x2d9e09+_0x51dd('0x4f')+_0x199af6+'))';return getZohoUser(_0x3d85b6,'Contacts')['then'](function(_0x464355){if(_0x464355)return _0x464355;if(_0x5b0c26[_0x51dd('0x55')]!=_0x51dd('0x53')){return createEndUser(_0x3ea34f,_0x2d9e09,_0x35b7d2,_0x199af6,_0x3b2135,_0x5b0c26);}else{return{};}});break;case _0x51dd('0x56'):_0x3d85b6[_0x51dd('0x4e')]='https://www.zohoapis.'+_0x2d9e09+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x199af6+'))';return getZohoUser(_0x3d85b6,_0x51dd('0x52'))[_0x51dd('0x2a')](function(_0x7f72b5){if(_0x7f72b5)return _0x7f72b5;if(_0x5b0c26[_0x51dd('0x55')]!=_0x51dd('0x53')){return createEndUser(_0x3ea34f,_0x2d9e09,_0x35b7d2,_0x199af6,_0x3b2135,_0x5b0c26);}else{return{};}});break;}}function getCall(_0x4eea7b,_0x5c8e6e,_0x12a346,_0x436953,_0x2ebd3b,_0x1681c7,_0xb44f58,_0x288fd5){logger[_0x51dd('0x39')](_0x51dd('0x57'));var _0x53911e={};_0x53911e[_0x51dd('0x58')]={'name':!_['isNil'](_0x436953[_0x51dd('0x45')][_0x51dd('0x19')])&&!_['isNil'](_0x436953[_0x51dd('0x3a')]['name'])&&_0x436953[_0x51dd('0x3a')][_0x51dd('0x19')]===_0x51dd('0x59')?_0x436953['role'][_0x51dd('0x19')]:!_[_0x51dd('0x1d')](_0x436953[_0x51dd('0x46')])?_0x436953[_0x51dd('0x46')]+'\x20'+_0x436953[_0x51dd('0x47')]:_0x436953[_0x51dd('0x47')],'id':_0x436953['id']};_0x53911e[_0x51dd('0x5a')]=intUtil[_0x51dd('0x5b')](_0x1681c7[_0x51dd('0x5c')],_0xb44f58,'\x20');_0x53911e[_0x51dd('0x5d')]=intUtil[_0x51dd('0x5b')](_0x1681c7[_0x51dd('0x5e')],_0xb44f58,'\x0a');if(_0x2ebd3b[_0x51dd('0x42')]==='Contacts'){_0x53911e[_0x51dd('0x5f')]={'name':!_[_0x51dd('0x1d')](_0x2ebd3b[_0x51dd('0x60')])?_0x2ebd3b['Full_Name']:!_[_0x51dd('0x1d')](_0x2ebd3b['First_Name'])?_0x2ebd3b[_0x51dd('0x61')]+'\x20'+_0x2ebd3b['Last_Name']:_0x2ebd3b[_0x51dd('0x62')],'id':_0x2ebd3b['id']};}if(_0x2ebd3b[_0x51dd('0x42')]===_0x51dd('0x52')){_0x53911e[_0x51dd('0x63')]={'name':!_[_0x51dd('0x1d')](_0x2ebd3b[_0x51dd('0x60')])?_0x2ebd3b[_0x51dd('0x60')]:!_[_0x51dd('0x1d')](_0x2ebd3b[_0x51dd('0x61')])?_0x2ebd3b['First_Name']+'\x20'+_0x2ebd3b[_0x51dd('0x62')]:_0x2ebd3b[_0x51dd('0x62')],'id':_0x2ebd3b['id']};_0x53911e[_0x51dd('0x64')]=_[_0x51dd('0x44')](_0x2ebd3b['enduserType']);}if(_0xb44f58[_0x51dd('0x65')]){_0x53911e[_0x51dd('0x66')]=moment[_0x51dd('0x67')](parseInt(_0xb44f58[_0x51dd('0x65')])*0x3e8)[_0x51dd('0x31')]('mm:ss');}else if(_0xb44f58[_0x51dd('0x68')]&&_0xb44f58[_0x51dd('0x69')]){_0x53911e[_0x51dd('0x66')]=moment['utc'](moment(_0xb44f58[_0x51dd('0x69')],'YYYY-MM-DDTHH:mm:ss')['diff'](moment(_0xb44f58['starttime'],_0x51dd('0x6a'))))[_0x51dd('0x31')](_0x51dd('0x6b'));}switch(_0xb44f58[_0x51dd('0x6c')]){case _0x51dd('0x6d'):_0x53911e[_0x51dd('0x6e')]=_0x51dd('0x6f');break;case _0x51dd('0x70'):case _0x51dd('0x71'):_0x53911e[_0x51dd('0x6e')]=_0x51dd('0x72');break;case _0x51dd('0x73'):_0x53911e[_0x51dd('0x6e')]=_0x51dd('0x74');break;case'abandoned':_0x53911e[_0x51dd('0x6e')]=_0x51dd('0x75');break;case'timeout':_0x53911e[_0x51dd('0x6e')]=_0x51dd('0x76');default:}_0x53911e[_0x51dd('0x77')]=(_0x288fd5===_0x51dd('0x78')?moment(_0xb44f58[_0x51dd('0x79')])[_0x51dd('0x31')](_0x51dd('0x6a')):moment(_0xb44f58[_0x51dd('0x7a')])['format']('YYYY-MM-DDTHH:mm:ss'))||moment()[_0x51dd('0x31')](_0x51dd('0x6a'));_0x53911e[_0x51dd('0x7b')]=_0x288fd5||_0x51dd('0x7c');_0x53911e=_['merge'](_0x53911e,getCustomFields(_0x1681c7[_0x51dd('0x7d')],_0xb44f58));return request({'method':_0x51dd('0x25'),'uri':_0x51dd('0x43')+_0x5c8e6e+_0x51dd('0x7e'),'headers':{'Authorization':_0x51dd('0x34')+_0x4eea7b},'body':{'data':[_0x53911e]},'json':!![]})[_0x51dd('0x2a')](function(_0x14b01e){if(_0x14b01e&&_0x14b01e[_0x51dd('0x41')][0x0][_0x51dd('0x48')]===_0x51dd('0x49')){logger[_0x51dd('0x39')](_0x51dd('0x7f'));return{'id':_0x14b01e['data'][0x0][_0x51dd('0x4a')]['id']};}})[_0x51dd('0x2d')](function(_0x709c6e){logger[_0x51dd('0x39')](_0x51dd('0x80'),_0x709c6e['stack']);console[_0x51dd('0x81')]('err',_0x709c6e);});}exports[_0x51dd('0x82')]=function(_0x1a7aa2,_0x15bbd2,_0x145b2b,_0x458ccd,_0x5786f8,_0x12e761){var _0x4d4b79,_0x67e277,_0x38f21b;_0x12e761[_0x51dd('0x83')]=intUtil['stripTrailingSlash'](_0x12e761[_0x51dd('0x83')]);_0x12e761['serverUrl']=intUtil['stripTrailingSlash'](_0x12e761[_0x51dd('0x84')]);if(_0x5786f8&&_0x5786f8[_0x51dd('0x85')]){logger[_0x51dd('0x39')](_0x51dd('0x86'),_0x51dd('0x87'));_0x15bbd2[_0x51dd('0x88')]=_0x12e761[_0x51dd('0x84')]+_0x51dd('0x89')+_0x15bbd2['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x15bbd2[_0x51dd('0x8a')]);}else{_0x15bbd2[_0x51dd('0x88')]='';}var _0x48ca6c=_0x12e761[_0x51dd('0x83')]===_0x51dd('0x8b')?'eu':'com';return getAccessToken(_0x12e761)['then'](function(_0x33ffcc){_0x38f21b=_0x33ffcc;return getUser(_0x38f21b,_0x48ca6c,_0x12e761,_0x458ccd[_0x51dd('0x37')]);})['then'](function(_0x4e71b7){_0x4d4b79=_0x4e71b7;logger[_0x51dd('0x39')](_0x51dd('0x8c'),_0x4d4b79['id']);return getEndUser(_0x38f21b,_0x48ca6c,_0x12e761,_0x15bbd2[_0x51dd('0x8d')],_0x15bbd2[_0x51dd('0x8e')],_0x4d4b79,_0x145b2b);})['then'](function(_0x3b2172){_0x67e277=_0x3b2172;return getCall(_0x38f21b,_0x48ca6c,_0x12e761,_0x4d4b79,_0x67e277,_0x145b2b,_0x15bbd2,'Inbound');})[_0x51dd('0x2a')](function(_0x443e94){if(_0x443e94){logger[_0x51dd('0x39')]('The\x20Call\x20ID\x20is:',_0x443e94['id']);logger[_0x51dd('0x39')](_0x51dd('0x86'),_0x51dd('0x8f'));emit(util[_0x51dd('0x31')](_0x51dd('0x90'),_0x458ccd['name']),'trigger:browser:url',{'uri':_0x51dd('0x91')+_0x12e761[_0x51dd('0x83')]+_0x51dd('0x92')+_0x443e94['id']});}})['catch'](function(_0x55e080){logger['error'](_0x51dd('0x86'),JSON[_0x51dd('0xb')](_0x55e080));});};exports[_0x51dd('0x78')]=function(_0x515870,_0x459171,_0xb0573f,_0x10bc66,_0x5efeed,_0x4f455a,_0x4ae772){var _0x43b900,_0x32ece9,_0x8e83f9;_0x4f455a['host']=intUtil['stripTrailingSlash'](_0x4f455a[_0x51dd('0x83')]);_0x4f455a['serverUrl']=intUtil[_0x51dd('0x93')](_0x4f455a['serverUrl']);if(_0x4ae772&&_0x4ae772[_0x51dd('0x94')]&&_0x4ae772[_0x51dd('0x94')]!==_0x51dd('0x95')){logger['info'](_0x51dd('0x96'),_0x51dd('0x87'));_0x459171[_0x51dd('0x88')]=_0x4f455a[_0x51dd('0x84')]+_0x51dd('0x89')+_0x459171[_0x51dd('0x8a')]+_0x51dd('0x97')+md5(_0x459171['uniqueid']);}var _0x35bab9=_0x4f455a[_0x51dd('0x83')]===_0x51dd('0x8b')?'eu':'com';return getAccessToken(_0x4f455a)[_0x51dd('0x2a')](function(_0x158b50){_0x8e83f9=_0x158b50;return getUser(_0x8e83f9,_0x35bab9,_0x4f455a,_0x10bc66[_0x51dd('0x37')]);})[_0x51dd('0x2a')](function(_0x1c75d9){_0x43b900=_0x1c75d9;logger[_0x51dd('0x39')](_0x51dd('0x8c'),_0x43b900['id']);return getEndUser(_0x8e83f9,_0x35bab9,_0x4f455a,_0x459171[_0x51dd('0x98')],_0x459171[_0x51dd('0x99')],_0x43b900,_0xb0573f);})[_0x51dd('0x2a')](function(_0x262dbc){_0x32ece9=_0x262dbc;return getCall(_0x8e83f9,_0x35bab9,_0x4f455a,_0x43b900,_0x32ece9,_0xb0573f,_0x459171,_0x51dd('0x9a'));})[_0x51dd('0x2a')](function(_0x2c60fe){if(_0x2c60fe){logger['info'](_0x51dd('0x9b'),_0x2c60fe['id']);logger[_0x51dd('0x39')](_0x51dd('0x96'),_0x51dd('0x8f'));emit(util[_0x51dd('0x31')](_0x51dd('0x90'),_0x10bc66['name']),'trigger:browser:url',{'uri':'https://crm.'+_0x4f455a[_0x51dd('0x83')]+_0x51dd('0x92')+_0x2c60fe['id']});}})[_0x51dd('0x2d')](function(_0x30c01f){logger[_0x51dd('0x3e')](_0x51dd('0x96'),JSON['stringify'](_0x30c01f));});};exports[_0x51dd('0x9c')]=function(_0x19c2b2,_0x35a177,_0x38cd0d,_0xb4da1d,_0x2c90e6,_0x8846bb){var _0x46815b,_0x44b9e8,_0x26d12e;_0x8846bb[_0x51dd('0x83')]=intUtil['stripTrailingSlash'](_0x8846bb[_0x51dd('0x83')]);_0x8846bb[_0x51dd('0x84')]=intUtil[_0x51dd('0x93')](_0x8846bb['serverUrl']);if(_0x2c90e6&&_0x2c90e6[_0x51dd('0x85')]){logger[_0x51dd('0x39')]('['+_0x35a177['lastevent']['toUpperCase']()+']',_0x51dd('0x87'));_0x35a177[_0x51dd('0x88')]=_0x8846bb[_0x51dd('0x84')]+_0x51dd('0x89')+_0x35a177[_0x51dd('0x8a')]+_0x51dd('0x97')+md5(_0x35a177[_0x51dd('0x8a')]);}else{_0x35a177['recordingURL']='';}var _0x4b6834=_0x8846bb['host']===_0x51dd('0x8b')?'eu':_0x51dd('0x9d');return getAccessToken(_0x8846bb)[_0x51dd('0x2a')](function(_0x4c7fef){_0x26d12e=_0x4c7fef;return getUser(_0x26d12e,_0x4b6834,_0x8846bb);})[_0x51dd('0x2a')](function(_0x53eb84){_0x46815b=_0x53eb84;logger[_0x51dd('0x39')]('The\x20User\x20ID\x20is:',_0x46815b['id']);return getEndUser(_0x26d12e,_0x4b6834,_0x8846bb,_0x35a177[_0x51dd('0x8d')],_0x35a177[_0x51dd('0x8e')],_0x46815b,_0x38cd0d);})[_0x51dd('0x2a')](function(_0x1f8a45){_0x44b9e8=_0x1f8a45;return getCall(_0x26d12e,_0x4b6834,_0x8846bb,_0x46815b,_0x44b9e8,_0x38cd0d,_0x35a177,'Inbound');})['then'](function(_0x17e3e0){if(_0x17e3e0){logger[_0x51dd('0x39')](_0x51dd('0x9b'),_0x17e3e0['id']);}})[_0x51dd('0x2d')](function(_0x49950b){logger[_0x51dd('0x3e')]('['+_0x35a177[_0x51dd('0x6c')][_0x51dd('0x9e')]()+']',JSON['stringify'](_0x49950b));});}; \ No newline at end of file +var _0x8fde=['toString','variableName','customVariable','Variable','name','toLowerCase','split','isNil','isBefore','expires_in','access_token','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','clientSecret','then','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','startCase','moduleCreate','role','first_name','last_name','Zoho-oauthtoken\x20','code','SUCCESS','details','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','lead','Creating\x20new\x20call...','Owner','administrator','Subject','Subjects','Description','getString','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','mm:ss','answertime','endtime','utc','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','Called','complete','connect','Answered','rejected','Rejected','abandoned','Abandoned','Timeout','Call_Start_Time','outbound','Call_Type','Inbound','Fields','/crm/v2/Calls','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','/api/voice/recordings/','uniqueid','zoho.eu','com','calleridname','calleridnum','The\x20Call\x20ID\x20is:','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','recordingURL','/downloads?type=uniqueid&token=','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','user:%s','unmanaged','toUpperCase','lodash','./util','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','emit','debug','[HTTP]','stringify','length','forEach','includes','picklist','type','idField','content'];(function(_0x45da5d,_0x578539){var _0x449b5c=function(_0x44a207){while(--_0x44a207){_0x45da5d['push'](_0x45da5d['shift']());}};_0x449b5c(++_0x578539);}(_0x8fde,0x1b5));var _0xe8fd=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x8fde[_0x2d2c16];return _0x53f2fb;};'use strict';var _=require(_0xe8fd('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require('util');var intUtil=require(_0xe8fd('0x1'));var moment=require('moment');var Redis=require('ioredis');var BPromise=require('bluebird');var config=require(_0xe8fd('0x2'));var logger=require(_0xe8fd('0x3'))(_0xe8fd('0x4'));config[_0xe8fd('0x5')]=_[_0xe8fd('0x6')](config[_0xe8fd('0x5')],{'host':_0xe8fd('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe8fd('0x5')]));function emit(_0x51f637,_0x1e0ecd,_0x3c44fe){io['to'](_0x51f637)[_0xe8fd('0x8')](_0x1e0ecd,_0x3c44fe);}function request(_0x183d0c){logger[_0xe8fd('0x9')](_0xe8fd('0xa'),JSON[_0xe8fd('0xb')](_0x183d0c));return rp(_0x183d0c);}function getCustomFields(_0x424ddb,_0x152edd){var _0x5277f6={};if(_0x424ddb[_0xe8fd('0xc')]>0x0){_[_0xe8fd('0xd')](_0x424ddb,function(_0x5a6293){if(_[_0xe8fd('0xe')](['string',_0xe8fd('0xf')],_0x5a6293[_0xe8fd('0x10')])&&_0x5a6293[_0xe8fd('0x11')]){_0x5277f6[_0x5a6293[_0xe8fd('0x11')]]=_0x5a6293[_0xe8fd('0x12')][_0xe8fd('0x13')]();}else if(_0x5a6293[_0xe8fd('0x10')]==='variable'&&_0x5a6293[_0xe8fd('0x14')]&&_0x5a6293[_0xe8fd('0x11')]&&_0x152edd[_0x5a6293['variableName']]){_0x5277f6[_0x5a6293[_0xe8fd('0x11')]]=_0x152edd[_0x5a6293[_0xe8fd('0x14')]][_0xe8fd('0x13')]();}else if(_0x5a6293[_0xe8fd('0x10')]===_0xe8fd('0x15')&&_0x5a6293[_0xe8fd('0x16')]&&_0x5a6293[_0xe8fd('0x16')][_0xe8fd('0x17')]&&_0x5a6293[_0xe8fd('0x11')]&&_0x152edd[_0x5a6293[_0xe8fd('0x16')]['name'][_0xe8fd('0x18')]()]){_0x5277f6[_0x5a6293[_0xe8fd('0x11')]]=_0x152edd[_0x5a6293[_0xe8fd('0x16')]['name']['toLowerCase']()]['toString']();}});}return _0x5277f6;}function getName(_0x4f61cc){if(_0x4f61cc['indexOf']('\x20')>0x0){var _0xe9bfd9=_0x4f61cc[_0xe8fd('0x19')](/ (.+)/);if(_0xe9bfd9[0x1]){return _0xe9bfd9;}}return[_0x4f61cc,_0x4f61cc];}var accountsTokens={};function getAccessToken(_0xc2199d){return new Promise(function(_0x53d67a,_0xa6df63){if(!_['isNil'](accountsTokens[_0xc2199d['id']])&&!_[_0xe8fd('0x1a')](accountsTokens[_0xc2199d['id']]['access_token'])){if(moment()[_0xe8fd('0x1b')](accountsTokens[_0xc2199d['id']][_0xe8fd('0x1c')])){_0x53d67a(accountsTokens[_0xc2199d['id']][_0xe8fd('0x1d')]);}}var _0x420fd6;switch(_0xc2199d[_0xe8fd('0x1e')]){case'US':_0x420fd6=_0xe8fd('0x1f');break;case'AU':_0x420fd6=_0xe8fd('0x20');break;case'EU':_0x420fd6='https://accounts.zoho.eu';break;case'IN':_0x420fd6=_0xe8fd('0x21');break;case'CN':_0x420fd6=_0xe8fd('0x22');break;default:_0x420fd6='https://accounts.zoho.eu';break;}var _0x19e3bc={'method':_0xe8fd('0x23'),'uri':_0x420fd6+'/oauth/v2/token','qs':{'refresh_token':_0xc2199d['refreshToken'],'client_id':_0xc2199d['clientId'],'client_secret':_0xc2199d[_0xe8fd('0x24')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x19e3bc)[_0xe8fd('0x25')](function(_0x205106){accountsTokens[_0xc2199d['id']]={'access_token':_0x205106[_0xe8fd('0x1d')],'expires_in':moment()['add'](_0x205106[_0xe8fd('0x1c')],_0xe8fd('0x26'))};_0x53d67a(_0x205106[_0xe8fd('0x1d')]);})[_0xe8fd('0x27')](function(_0x19c1f5){logger[_0xe8fd('0x28')](_0xe8fd('0x29'),_0x19c1f5[_0xe8fd('0x2a')]);_0xa6df63(_0x19c1f5);});});}function getUser(_0x1da181,_0x214a8e,_0x28d085,_0x158141){logger[_0xe8fd('0x2b')]('Search\x20user');return request({'method':_0xe8fd('0x2c'),'uri':util[_0xe8fd('0x2d')](_0xe8fd('0x2e'),_0x214a8e),'qs':{'type':_0xe8fd('0x2f')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x1da181},'json':!![]})['then'](function(_0x3db19e){if(_0x3db19e[_0xe8fd('0x30')]){var _0x53a3fa=-0x1;if(_[_0xe8fd('0x31')](_0x3db19e[_0xe8fd('0x30')])){if(!_[_0xe8fd('0x1a')](_0x158141)){_0x53a3fa=_[_0xe8fd('0x32')](_0x3db19e['users'],function(_0x3101f2){return _0x3101f2[_0xe8fd('0x33')]===_0x158141;});}if(_0x53a3fa>=0x0){logger[_0xe8fd('0x2b')](_0xe8fd('0x34'));}else{logger[_0xe8fd('0x2b')](_0xe8fd('0x35'));_0x53a3fa=_[_0xe8fd('0x32')](_0x3db19e[_0xe8fd('0x30')],function(_0x14c092){return _0x14c092[_0xe8fd('0x36')][_0xe8fd('0x17')]===_0xe8fd('0x37');});}return _0x3db19e[_0xe8fd('0x30')][_0x53a3fa];}else{if(_0x3db19e[_0xe8fd('0x38')]['profile'][_0xe8fd('0x17')]==='Administrator'){logger['info'](_0xe8fd('0x35'));user=_0x3db19e[_0xe8fd('0x38')];return user;}else{logger[_0xe8fd('0x28')](_0xe8fd('0x39'),JSON['stringify'](_0x3db19e));throw new Error(_0xe8fd('0x3a')+JSON['stringify'](_0x3db19e));}}}else{logger[_0xe8fd('0x28')](_0xe8fd('0x39'),JSON[_0xe8fd('0xb')](_0x3db19e));throw new Error(_0xe8fd('0x3a')+JSON[_0xe8fd('0xb')](_0x3db19e));}})[_0xe8fd('0x27')](function(_0x5a07be){console[_0xe8fd('0x28')](_0x5a07be);});}function getZohoUser(_0x11a9ab,_0x5d6aca){return new BPromise(function(_0x16ce62,_0x412a88){request(_0x11a9ab)[_0xe8fd('0x25')](function(_0x2207b2){var _0x34bc7f=null;if(_0x2207b2){_0x34bc7f=_0x2207b2[_0xe8fd('0x3b')][0x0];_0x34bc7f[_0xe8fd('0x3c')]=_0x5d6aca;}_0x16ce62(_0x34bc7f);})['catch'](function(_0x26dab4){_0x412a88(_0x26dab4);});});}function createEndUser(_0x29eb0b,_0x27b351,_0x3ad31e,_0x1d05b8,_0x5e4f62,_0x5c94e4){var _0x3ad31e=getName(_0x3ad31e);return request({'method':_0xe8fd('0x23'),'uri':_0xe8fd('0x3d')+_0x27b351+'/crm/v2/'+_[_0xe8fd('0x3e')](_0x5c94e4[_0xe8fd('0x3f')])+'s','body':{'data':[{'Last_Name':_0x3ad31e[0x1],'First_Name':_0x3ad31e[0x0],'Phone':_0x1d05b8,'Owner':{'name':!_['isNil'](_0x5e4f62['role'][_0xe8fd('0x17')])?_0x5e4f62[_0xe8fd('0x40')]['name']:!_['isNil'](_0x5e4f62[_0xe8fd('0x41')])?_0x5e4f62['first_name']+'\x20'+_0x5e4f62[_0xe8fd('0x42')]:_0x5e4f62[_0xe8fd('0x42')],'id':_0x5e4f62['id']}}]},'headers':{'Authorization':_0xe8fd('0x43')+_0x29eb0b},'json':!![]})[_0xe8fd('0x25')](function(_0x493b8b){if(_0x493b8b&&_0x493b8b['data'][0x0][_0xe8fd('0x44')]===_0xe8fd('0x45')){var _0x3ad83e=_0x493b8b[_0xe8fd('0x3b')][0x0][_0xe8fd('0x46')];_0x3ad83e[_0xe8fd('0x3c')]=_[_0xe8fd('0x3e')](_0x5c94e4[_0xe8fd('0x3f')])+'s';return _0x3ad83e;}logger[_0xe8fd('0x28')](_0xe8fd('0x39'),JSON[_0xe8fd('0xb')](data));throw new Error(_0xe8fd('0x47')+JSON['stringify'](data));})['catch'](function(_0x3d2404){console[_0xe8fd('0x48')](_0xe8fd('0x49'),_0x3d2404);});}function getEndUser(_0x870930,_0x3508f6,_0x1d7770,_0x18af3c,_0x52cffb,_0x50241d,_0x17dcc8){var _0x3b20f0={'method':_0xe8fd('0x2c'),'uri':'','headers':{'Authorization':_0xe8fd('0x43')+_0x870930},'json':!![]};switch(_0x17dcc8[_0xe8fd('0x4a')]){case _0xe8fd('0x4b'):_0x3b20f0[_0xe8fd('0x4c')]=_0xe8fd('0x3d')+_0x3508f6+_0xe8fd('0x4d')+_0x52cffb+'))';return getZohoUser(_0x3b20f0,_0xe8fd('0x4e'))[_0xe8fd('0x25')](function(_0x7f094e){if(_0x7f094e)return _0x7f094e;_0x3b20f0[_0xe8fd('0x4c')]=_0xe8fd('0x3d')+_0x3508f6+_0xe8fd('0x4f')+_0x52cffb+'))';return getZohoUser(_0x3b20f0,_0xe8fd('0x50'))[_0xe8fd('0x25')](function(_0x168968){if(_0x168968)return _0x168968;if(_0x17dcc8['moduleCreate']!=_0xe8fd('0x51')){return createEndUser(_0x870930,_0x3508f6,_0x18af3c,_0x52cffb,_0x50241d,_0x17dcc8);}else{return{};}});});break;case _0xe8fd('0x52'):_0x3b20f0['uri']=_0xe8fd('0x3d')+_0x3508f6+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x52cffb+'))';return getZohoUser(_0x3b20f0,_0xe8fd('0x4e'))[_0xe8fd('0x25')](function(_0x1645ef){if(_0x1645ef)return _0x1645ef;if(_0x17dcc8['moduleCreate']!=_0xe8fd('0x51')){return createEndUser(_0x870930,_0x3508f6,_0x18af3c,_0x52cffb,_0x50241d,_0x17dcc8);}else{return{};}});break;case _0xe8fd('0x53'):_0x3b20f0[_0xe8fd('0x4c')]='https://www.zohoapis.'+_0x3508f6+_0xe8fd('0x4f')+_0x52cffb+'))';return getZohoUser(_0x3b20f0,_0xe8fd('0x50'))[_0xe8fd('0x25')](function(_0x227b0a){if(_0x227b0a)return _0x227b0a;if(_0x17dcc8['moduleCreate']!=_0xe8fd('0x51')){return createEndUser(_0x870930,_0x3508f6,_0x18af3c,_0x52cffb,_0x50241d,_0x17dcc8);}else{return{};}});break;}}function getCall(_0x5ac8ab,_0x37307a,_0x5b75b4,_0x55fb5c,_0x3cce03,_0x89976a,_0x32f7ac,_0x41d32c){logger['info'](_0xe8fd('0x54'));var _0x31c86f={};_0x31c86f[_0xe8fd('0x55')]={'name':!_[_0xe8fd('0x1a')](_0x55fb5c[_0xe8fd('0x40')][_0xe8fd('0x17')])&&!_['isNil'](_0x55fb5c['profile'][_0xe8fd('0x17')])&&_0x55fb5c[_0xe8fd('0x36')][_0xe8fd('0x17')]===_0xe8fd('0x56')?_0x55fb5c[_0xe8fd('0x40')][_0xe8fd('0x17')]:!_[_0xe8fd('0x1a')](_0x55fb5c[_0xe8fd('0x41')])?_0x55fb5c[_0xe8fd('0x41')]+'\x20'+_0x55fb5c[_0xe8fd('0x42')]:_0x55fb5c[_0xe8fd('0x42')],'id':_0x55fb5c['id']};_0x31c86f[_0xe8fd('0x57')]=intUtil['getString'](_0x89976a[_0xe8fd('0x58')],_0x32f7ac,'\x20');_0x31c86f[_0xe8fd('0x59')]=intUtil[_0xe8fd('0x5a')](_0x89976a[_0xe8fd('0x5b')],_0x32f7ac,'\x0a');if(_0x3cce03[_0xe8fd('0x3c')]===_0xe8fd('0x4e')){_0x31c86f[_0xe8fd('0x5c')]={'name':!_['isNil'](_0x3cce03['Full_Name'])?_0x3cce03[_0xe8fd('0x5d')]:!_[_0xe8fd('0x1a')](_0x3cce03['First_Name'])?_0x3cce03[_0xe8fd('0x5e')]+'\x20'+_0x3cce03['Last_Name']:_0x3cce03[_0xe8fd('0x5f')],'id':_0x3cce03['id']};}if(_0x3cce03['enduserType']===_0xe8fd('0x50')){_0x31c86f[_0xe8fd('0x60')]={'name':!_['isNil'](_0x3cce03[_0xe8fd('0x5d')])?_0x3cce03[_0xe8fd('0x5d')]:!_[_0xe8fd('0x1a')](_0x3cce03[_0xe8fd('0x5e')])?_0x3cce03[_0xe8fd('0x5e')]+'\x20'+_0x3cce03['Last_Name']:_0x3cce03[_0xe8fd('0x5f')],'id':_0x3cce03['id']};_0x31c86f[_0xe8fd('0x61')]=_['startCase'](_0x3cce03[_0xe8fd('0x3c')]);}if(_0x32f7ac[_0xe8fd('0x62')]){_0x31c86f['Call_Duration']=moment['utc'](parseInt(_0x32f7ac[_0xe8fd('0x62')])*0x3e8)[_0xe8fd('0x2d')](_0xe8fd('0x63'));}else if(_0x32f7ac[_0xe8fd('0x64')]&&_0x32f7ac[_0xe8fd('0x65')]){_0x31c86f['Call_Duration']=moment[_0xe8fd('0x66')](moment(_0x32f7ac[_0xe8fd('0x65')],_0xe8fd('0x67'))[_0xe8fd('0x68')](moment(_0x32f7ac[_0xe8fd('0x69')],'YYYY-MM-DDTHH:mm:ss')))[_0xe8fd('0x2d')](_0xe8fd('0x63'));}switch(_0x32f7ac[_0xe8fd('0x6a')]){case _0xe8fd('0x6b'):_0x31c86f[_0xe8fd('0x6c')]=_0xe8fd('0x6d');break;case _0xe8fd('0x6e'):case _0xe8fd('0x6f'):_0x31c86f[_0xe8fd('0x6c')]=_0xe8fd('0x70');break;case _0xe8fd('0x71'):_0x31c86f[_0xe8fd('0x6c')]=_0xe8fd('0x72');break;case _0xe8fd('0x73'):_0x31c86f[_0xe8fd('0x6c')]=_0xe8fd('0x74');break;case'timeout':_0x31c86f[_0xe8fd('0x6c')]=_0xe8fd('0x75');default:}_0x31c86f[_0xe8fd('0x76')]=(_0x41d32c===_0xe8fd('0x77')?moment(_0x32f7ac[_0xe8fd('0x69')])[_0xe8fd('0x2d')](_0xe8fd('0x67')):moment(_0x32f7ac['agentcalledAt'])['format']('YYYY-MM-DDTHH:mm:ss'))||moment()[_0xe8fd('0x2d')](_0xe8fd('0x67'));_0x31c86f[_0xe8fd('0x78')]=_0x41d32c||_0xe8fd('0x79');_0x31c86f=_['merge'](_0x31c86f,getCustomFields(_0x89976a[_0xe8fd('0x7a')],_0x32f7ac));return request({'method':_0xe8fd('0x23'),'uri':_0xe8fd('0x3d')+_0x37307a+_0xe8fd('0x7b'),'headers':{'Authorization':_0xe8fd('0x43')+_0x5ac8ab},'body':{'data':[_0x31c86f]},'json':!![]})[_0xe8fd('0x25')](function(_0x3ddc1e){if(_0x3ddc1e&&_0x3ddc1e[_0xe8fd('0x3b')][0x0]['code']===_0xe8fd('0x45')){logger[_0xe8fd('0x2b')]('Call\x20created!');return{'id':_0x3ddc1e[_0xe8fd('0x3b')][0x0]['details']['id']};}})[_0xe8fd('0x27')](function(_0x4eb7f6){logger['info']('err',_0x4eb7f6[_0xe8fd('0x2a')]);console[_0xe8fd('0x48')]('err',_0x4eb7f6);});}exports['queue']=function(_0x2aad1a,_0x39c8a4,_0x1c5f1a,_0x245484,_0x2ee875,_0x43b42e){var _0x27f6f4,_0x300fcc,_0x594eb8;_0x43b42e[_0xe8fd('0x7c')]=intUtil[_0xe8fd('0x7d')](_0x43b42e[_0xe8fd('0x7c')]);_0x43b42e[_0xe8fd('0x7e')]=intUtil[_0xe8fd('0x7d')](_0x43b42e[_0xe8fd('0x7e')]);if(_0x2ee875&&_0x2ee875[_0xe8fd('0x7f')]){logger[_0xe8fd('0x2b')](_0xe8fd('0x80'),'Recording\x20is\x20enabled!');_0x39c8a4['recordingURL']=_0x43b42e[_0xe8fd('0x7e')]+_0xe8fd('0x81')+_0x39c8a4[_0xe8fd('0x82')]+'/downloads?type=uniqueid&token='+md5(_0x39c8a4[_0xe8fd('0x82')]);}else{_0x39c8a4['recordingURL']='';}var _0x315c0e=_0x43b42e[_0xe8fd('0x7c')]===_0xe8fd('0x83')?'eu':_0xe8fd('0x84');return getAccessToken(_0x43b42e)[_0xe8fd('0x25')](function(_0x3017f3){_0x594eb8=_0x3017f3;return getUser(_0x594eb8,_0x315c0e,_0x43b42e,_0x245484[_0xe8fd('0x33')]);})[_0xe8fd('0x25')](function(_0x5d8318){_0x27f6f4=_0x5d8318;logger[_0xe8fd('0x2b')]('The\x20User\x20ID\x20is:',_0x27f6f4['id']);return getEndUser(_0x594eb8,_0x315c0e,_0x43b42e,_0x39c8a4[_0xe8fd('0x85')],_0x39c8a4[_0xe8fd('0x86')],_0x27f6f4,_0x1c5f1a);})[_0xe8fd('0x25')](function(_0xa80cb0){_0x300fcc=_0xa80cb0;return getCall(_0x594eb8,_0x315c0e,_0x43b42e,_0x27f6f4,_0x300fcc,_0x1c5f1a,_0x39c8a4,_0xe8fd('0x79'));})['then'](function(_0x5d9e69){if(_0x5d9e69){logger[_0xe8fd('0x2b')](_0xe8fd('0x87'),_0x5d9e69['id']);logger[_0xe8fd('0x2b')](_0xe8fd('0x80'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x245484[_0xe8fd('0x17')]),_0xe8fd('0x88'),{'uri':_0xe8fd('0x89')+_0x43b42e[_0xe8fd('0x7c')]+_0xe8fd('0x8a')+_0x5d9e69['id']});}})[_0xe8fd('0x27')](function(_0x5e3ceb){logger[_0xe8fd('0x28')]('[QUEUE]',JSON[_0xe8fd('0xb')](_0x5e3ceb));});};exports[_0xe8fd('0x77')]=function(_0x41eaf4,_0xe186c7,_0x4fea5e,_0x46d084,_0xaa24f8,_0x205747,_0x2216c4){var _0x51552a,_0x1c847a,_0x4e2acb;_0x205747[_0xe8fd('0x7c')]=intUtil[_0xe8fd('0x7d')](_0x205747['host']);_0x205747[_0xe8fd('0x7e')]=intUtil['stripTrailingSlash'](_0x205747[_0xe8fd('0x7e')]);if(_0x2216c4&&_0x2216c4[_0xe8fd('0x8b')]&&_0x2216c4[_0xe8fd('0x8b')]!==_0xe8fd('0x8c')){logger[_0xe8fd('0x2b')](_0xe8fd('0x8d'),_0xe8fd('0x8e'));_0xe186c7[_0xe8fd('0x8f')]=_0x205747[_0xe8fd('0x7e')]+'/api/voice/recordings/'+_0xe186c7[_0xe8fd('0x82')]+_0xe8fd('0x90')+md5(_0xe186c7[_0xe8fd('0x82')]);}var _0x4fabb7=_0x205747['host']==='zoho.eu'?'eu':_0xe8fd('0x84');return getAccessToken(_0x205747)['then'](function(_0x24f44c){_0x4e2acb=_0x24f44c;return getUser(_0x4e2acb,_0x4fabb7,_0x205747,_0x46d084[_0xe8fd('0x33')]);})[_0xe8fd('0x25')](function(_0x1edc9d){_0x51552a=_0x1edc9d;logger[_0xe8fd('0x2b')](_0xe8fd('0x91'),_0x51552a['id']);return getEndUser(_0x4e2acb,_0x4fabb7,_0x205747,_0xe186c7[_0xe8fd('0x92')],_0xe186c7[_0xe8fd('0x93')],_0x51552a,_0x4fea5e);})['then'](function(_0x3e4531){_0x1c847a=_0x3e4531;return getCall(_0x4e2acb,_0x4fabb7,_0x205747,_0x51552a,_0x1c847a,_0x4fea5e,_0xe186c7,_0xe8fd('0x94'));})['then'](function(_0x52d70f){if(_0x52d70f){logger[_0xe8fd('0x2b')]('The\x20Call\x20ID\x20is:',_0x52d70f['id']);logger[_0xe8fd('0x2b')](_0xe8fd('0x8d'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xe8fd('0x95'),_0x46d084['name']),_0xe8fd('0x88'),{'uri':'https://crm.'+_0x205747[_0xe8fd('0x7c')]+_0xe8fd('0x8a')+_0x52d70f['id']});}})['catch'](function(_0x91b700){logger['error']('[OUTBOUND]',JSON[_0xe8fd('0xb')](_0x91b700));});};exports[_0xe8fd('0x96')]=function(_0x31b838,_0x108c62,_0xd85b70,_0xf7279b,_0x4979e0,_0xf2a045){var _0x1e7620,_0x1fea71,_0x19a783;_0xf2a045[_0xe8fd('0x7c')]=intUtil[_0xe8fd('0x7d')](_0xf2a045[_0xe8fd('0x7c')]);_0xf2a045['serverUrl']=intUtil[_0xe8fd('0x7d')](_0xf2a045['serverUrl']);if(_0x4979e0&&_0x4979e0[_0xe8fd('0x7f')]){logger[_0xe8fd('0x2b')]('['+_0x108c62[_0xe8fd('0x6a')][_0xe8fd('0x97')]()+']',_0xe8fd('0x8e'));_0x108c62['recordingURL']=_0xf2a045[_0xe8fd('0x7e')]+_0xe8fd('0x81')+_0x108c62[_0xe8fd('0x82')]+_0xe8fd('0x90')+md5(_0x108c62[_0xe8fd('0x82')]);}else{_0x108c62[_0xe8fd('0x8f')]='';}var _0x58f7ed=_0xf2a045[_0xe8fd('0x7c')]===_0xe8fd('0x83')?'eu':'com';return getAccessToken(_0xf2a045)[_0xe8fd('0x25')](function(_0x398a03){_0x19a783=_0x398a03;return getUser(_0x19a783,_0x58f7ed,_0xf2a045);})[_0xe8fd('0x25')](function(_0x5b4ba1){_0x1e7620=_0x5b4ba1;logger['info'](_0xe8fd('0x91'),_0x1e7620['id']);return getEndUser(_0x19a783,_0x58f7ed,_0xf2a045,_0x108c62['calleridname'],_0x108c62[_0xe8fd('0x86')],_0x1e7620,_0xd85b70);})['then'](function(_0x4ddb26){_0x1fea71=_0x4ddb26;return getCall(_0x19a783,_0x58f7ed,_0xf2a045,_0x1e7620,_0x1fea71,_0xd85b70,_0x108c62,_0xe8fd('0x79'));})[_0xe8fd('0x25')](function(_0x279c34){if(_0x279c34){logger[_0xe8fd('0x2b')](_0xe8fd('0x87'),_0x279c34['id']);}})['catch'](function(_0x2e1ae2){logger[_0xe8fd('0x28')]('['+_0x108c62[_0xe8fd('0x6a')][_0xe8fd('0x97')]()+']',JSON[_0xe8fd('0xb')](_0x2e1ae2));});}; \ 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 0b458ea..edefa70 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 _0x5d9a=['info','format','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','shelljs','trigger','exec','data2','Script','data3','render'];(function(_0x3f2228,_0x3b27d5){var _0x285ae4=function(_0x5e1f23){while(--_0x5e1f23){_0x3f2228['push'](_0x3f2228['shift']());}};_0x285ae4(++_0x3b27d5);}(_0x5d9a,0x1a7));var _0xa5d9=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x5d9a[_0x2dafbe];return _0x58a45a;};'use strict';var util=require('util');var sh=require(_0xa5d9('0x0'));var Mustache=require('mustache');var logger=require('../../../../config/logger')(_0xa5d9('0x1'));exports[_0xa5d9('0x2')]=function(_0x16a838,_0x37a78c){var _0x174c5c=_0x16a838[_0xa5d9('0x3')]?_0x16a838[_0xa5d9('0x3')]:_0xa5d9('0x4');var _0x936779=_0x16a838[_0xa5d9('0x5')]?Mustache[_0xa5d9('0x6')](_0x16a838['data3'],_0x37a78c):_0x37a78c;sh['exec'](_0x936779,function(_0x4b1267,_0x2bc554,_0x3b51bd){if(_0x4b1267!==0x0){logger['error'](util['format']('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x174c5c,_0x936779,_0x4b1267,_0x3b51bd));}else{logger[_0xa5d9('0x7')](util[_0xa5d9('0x8')](_0xa5d9('0x9'),_0x174c5c,_0x936779,_0x2bc554));}});}; \ No newline at end of file +var _0xd532=['%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','../../../../config/logger','exec','Script','data3','error','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s'];(function(_0x160148,_0x5c0639){var _0x5d4a2c=function(_0x4e4317){while(--_0x4e4317){_0x160148['push'](_0x160148['shift']());}};_0x5d4a2c(++_0x5c0639);}(_0xd532,0x86));var _0x2d53=function(_0xeb99c5,_0x2c5f2d){_0xeb99c5=_0xeb99c5-0x0;var _0x3c86f9=_0xd532[_0xeb99c5];return _0x3c86f9;};'use strict';var util=require('util');var sh=require('shelljs');var Mustache=require('mustache');var logger=require(_0x2d53('0x0'))('trigger');exports[_0x2d53('0x1')]=function(_0x1adfae,_0x57999f){var _0x2c3620=_0x1adfae['data2']?_0x1adfae['data2']:_0x2d53('0x2');var _0x23ad36=_0x1adfae[_0x2d53('0x3')]?Mustache['render'](_0x1adfae['data3'],_0x57999f):_0x57999f;sh[_0x2d53('0x1')](_0x23ad36,function(_0x14a53c,_0x5555b2,_0x4b1bb9){if(_0x14a53c!==0x0){logger[_0x2d53('0x4')](util['format'](_0x2d53('0x5'),_0x2c3620,_0x23ad36,_0x14a53c,_0x4b1bb9));}else{logger['info'](util['format'](_0x2d53('0x6'),_0x2c3620,_0x23ad36,_0x5555b2));}});}; \ 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 7b156af..b531623 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 _0x3ec7=['%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','statusCode','name','request-promise','util','lodash','mustache','trigger','exec','toUpperCase','data2','number','data5','headers','data6','parse','error','data1','GET','DELETE','PUT','data7','stack','body','info','then',',\x20request\x20body:\x20','object','stringify','format','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','catch'];(function(_0x3936cc,_0x976f06){var _0x1abf00=function(_0x58df23){while(--_0x58df23){_0x3936cc['push'](_0x3936cc['shift']());}};_0x1abf00(++_0x976f06);}(_0x3ec7,0xe3));var _0x73ec=function(_0x45b1ca,_0x3d7169){_0x45b1ca=_0x45b1ca-0x0;var _0x292344=_0x3ec7[_0x45b1ca];return _0x292344;};'use strict';var rp=require(_0x73ec('0x0'));var util=require(_0x73ec('0x1'));var _=require(_0x73ec('0x2'));var Mustache=require(_0x73ec('0x3'));var logger=require('../../../../config/logger')(_0x73ec('0x4'));exports[_0x73ec('0x5')]=function(_0x347de6,_0x267fb3){var _0x42e94f,_0x570760;var _0x24e0b7={'method':_0x347de6['data1'][_0x73ec('0x6')](),'uri':Mustache['render'](_0x347de6[_0x73ec('0x7')],_0x267fb3),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x347de6['data5'])===_0x73ec('0x8')&&parseInt(_0x347de6[_0x73ec('0x9')])>=0x1&&parseInt(_0x347de6[_0x73ec('0x9')])<=0xa?parseInt(_0x347de6['data5'])*0x3e8:0x5*0x3e8};try{_0x24e0b7[_0x73ec('0xa')]=_0x347de6[_0x73ec('0xb')]?JSON[_0x73ec('0xc')](Mustache['render'](_0x347de6[_0x73ec('0xb')],_0x267fb3)):{};}catch(_0x4f643c){logger[_0x73ec('0xd')](_0x4f643c['stack']);}switch(_0x347de6[_0x73ec('0xe')][_0x73ec('0x6')]()){case _0x73ec('0xf'):case _0x73ec('0x10'):_0x42e94f=null;_0x24e0b7['qs']=_0x267fb3;break;case'POST':case _0x73ec('0x11'):if(_0x347de6['data7']){try{_0x42e94f=JSON[_0x73ec('0xc')](Mustache['render'](_0x347de6[_0x73ec('0x12')],_0x267fb3));_0x24e0b7['body']=_0x42e94f;}catch(_0xe356b2){logger[_0x73ec('0xd')](_0xe356b2[_0x73ec('0x13')]);logger['error']('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x42e94f=_0x267fb3;_0x24e0b7[_0x73ec('0x14')]=_0x42e94f;}break;}logger[_0x73ec('0x15')](util['format']('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x347de6[_0x73ec('0xe')],_0x347de6['data2'],JSON['stringify'](_0x24e0b7)));rp(_0x24e0b7)[_0x73ec('0x16')](function(_0x3d50f0){_0x42e94f=!_['isNil'](_0x42e94f)?_0x73ec('0x17')+_0x42e94f:'';_0x570760=typeof _0x3d50f0[_0x73ec('0x14')]===_0x73ec('0x18')?JSON[_0x73ec('0x19')](_0x3d50f0[_0x73ec('0x14')]):_0x3d50f0[_0x73ec('0x14')];logger[_0x73ec('0x15')](util[_0x73ec('0x1a')](_0x73ec('0x1b'),_0x347de6['data1'],_0x347de6[_0x73ec('0x7')],_0x3d50f0['statusCode'],_0x570760));})[_0x73ec('0x1c')](function(_0xbe78b2){logger[_0x73ec('0xd')](util[_0x73ec('0x1a')](_0x73ec('0x1d'),_0x347de6['data1'],_0x347de6[_0x73ec('0x7')],_0xbe78b2[_0x73ec('0x1e')],_0xbe78b2[_0x73ec('0x1f')],_0xbe78b2['message']));});}; \ No newline at end of file +var _0x75cf=['stack','data1','toUpperCase','GET','DELETE','POST','PUT','parse','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','format','stringify','then','isNil','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','name','message','util','mustache','../../../../config/logger','trigger','render','data2','data5','headers','data6','error'];(function(_0x2045c7,_0x4f7879){var _0x278bc4=function(_0x35ae08){while(--_0x35ae08){_0x2045c7['push'](_0x2045c7['shift']());}};_0x278bc4(++_0x4f7879);}(_0x75cf,0x104));var _0xf75c=function(_0x3157c2,_0x312472){_0x3157c2=_0x3157c2-0x0;var _0x57af73=_0x75cf[_0x3157c2];return _0x57af73;};'use strict';var rp=require('request-promise');var util=require(_0xf75c('0x0'));var _=require('lodash');var Mustache=require(_0xf75c('0x1'));var logger=require(_0xf75c('0x2'))(_0xf75c('0x3'));exports['exec']=function(_0x23ef9b,_0x3c8b1d){var _0x175ed0,_0x5b2427;var _0xe1a212={'method':_0x23ef9b['data1']['toUpperCase'](),'uri':Mustache[_0xf75c('0x4')](_0x23ef9b[_0xf75c('0x5')],_0x3c8b1d),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x23ef9b['data5'])==='number'&&parseInt(_0x23ef9b['data5'])>=0x1&&parseInt(_0x23ef9b[_0xf75c('0x6')])<=0xa?parseInt(_0x23ef9b[_0xf75c('0x6')])*0x3e8:0x5*0x3e8};try{_0xe1a212[_0xf75c('0x7')]=_0x23ef9b[_0xf75c('0x8')]?JSON['parse'](Mustache[_0xf75c('0x4')](_0x23ef9b['data6'],_0x3c8b1d)):{};}catch(_0x3e00ff){logger[_0xf75c('0x9')](_0x3e00ff[_0xf75c('0xa')]);}switch(_0x23ef9b[_0xf75c('0xb')][_0xf75c('0xc')]()){case _0xf75c('0xd'):case _0xf75c('0xe'):_0x175ed0=null;_0xe1a212['qs']=_0x3c8b1d;break;case _0xf75c('0xf'):case _0xf75c('0x10'):if(_0x23ef9b['data7']){try{_0x175ed0=JSON[_0xf75c('0x11')](Mustache[_0xf75c('0x4')](_0x23ef9b[_0xf75c('0x12')],_0x3c8b1d));_0xe1a212[_0xf75c('0x13')]=_0x175ed0;}catch(_0x1e1785){logger[_0xf75c('0x9')](_0x1e1785[_0xf75c('0xa')]);logger[_0xf75c('0x9')](_0xf75c('0x14'));}}else{_0x175ed0=_0x3c8b1d;_0xe1a212[_0xf75c('0x13')]=_0x175ed0;}break;}logger['info'](util[_0xf75c('0x15')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x23ef9b['data1'],_0x23ef9b['data2'],JSON[_0xf75c('0x16')](_0xe1a212)));rp(_0xe1a212)[_0xf75c('0x17')](function(_0x52fa6c){_0x175ed0=!_[_0xf75c('0x18')](_0x175ed0)?',\x20request\x20body:\x20'+_0x175ed0:'';_0x5b2427=typeof _0x52fa6c[_0xf75c('0x13')]===_0xf75c('0x19')?JSON['stringify'](_0x52fa6c[_0xf75c('0x13')]):_0x52fa6c[_0xf75c('0x13')];logger['info'](util[_0xf75c('0x15')](_0xf75c('0x1a'),_0x23ef9b[_0xf75c('0xb')],_0x23ef9b[_0xf75c('0x5')],_0x52fa6c[_0xf75c('0x1b')],_0x5b2427));})['catch'](function(_0x2d3170){logger['error'](util[_0xf75c('0x15')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x23ef9b['data1'],_0x23ef9b['data2'],_0x2d3170[_0xf75c('0x1b')],_0x2d3170[_0xf75c('0x1c')],_0x2d3170[_0xf75c('0x1d')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index f744a08..d71333f 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 _0x3f87=['debug','rpc','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing','http','request','then'];(function(_0x190f3b,_0x89fbf6){var _0x638d58=function(_0x370c14){while(--_0x370c14){_0x190f3b['push'](_0x190f3b['shift']());}};_0x638d58(++_0x89fbf6);}(_0x3f87,0x12d));var _0x73f8=function(_0x2e8490,_0xae989){_0x2e8490=_0x2e8490-0x0;var _0x373e14=_0x3f87[_0x2e8490];return _0x373e14;};'use strict';var jayson=require(_0x73f8('0x0'));var BPromise=require(_0x73f8('0x1'));var logger=require(_0x73f8('0x2'))(_0x73f8('0x3'));var client=jayson['client'][_0x73f8('0x4')]({'port':0x2329});client['Request']=function(_0x11d8c8,_0x1f4c0a){return new BPromise(function(_0x22abcc,_0x402a58){return client[_0x73f8('0x5')](_0x11d8c8,_0x1f4c0a)[_0x73f8('0x6')](function(_0x47de62){logger[_0x73f8('0x7')](_0x73f8('0x8'),_0x73f8('0x3'),_0x11d8c8,_0x1f4c0a,_0x47de62);if(_0x47de62[_0x73f8('0x9')]){logger['error'](_0x73f8('0x8'),_0x73f8('0x3'),_0x11d8c8,_0x47de62[_0x73f8('0x9')]['message'],_0x1f4c0a);return _0x402a58(_0x47de62[_0x73f8('0x9')][_0x73f8('0xa')]);}else{return _0x22abcc(_0x47de62[_0x73f8('0xb')]);}})[_0x73f8('0xc')](function(_0x130afe){logger[_0x73f8('0x9')]('rpc','routing',_0x11d8c8,_0x130afe,_0x1f4c0a);return _0x402a58(_0x130afe);});});};module[_0x73f8('0xd')]=client; \ No newline at end of file +var _0x3a0b=['bluebird','../../config/logger','routing','Request','request','then','rpc','error','message','result','exports','jayson/promise'];(function(_0x1eac49,_0x1c4a54){var _0x515765=function(_0x5d5efd){while(--_0x5d5efd){_0x1eac49['push'](_0x1eac49['shift']());}};_0x515765(++_0x1c4a54);}(_0x3a0b,0x137));var _0xb3a0=function(_0x2abc3d,_0x48edca){_0x2abc3d=_0x2abc3d-0x0;var _0x252745=_0x3a0b[_0x2abc3d];return _0x252745;};'use strict';var jayson=require(_0xb3a0('0x0'));var BPromise=require(_0xb3a0('0x1'));var logger=require(_0xb3a0('0x2'))(_0xb3a0('0x3'));var client=jayson['client']['http']({'port':0x2329});client[_0xb3a0('0x4')]=function(_0x3ed8e7,_0x4fb39){return new BPromise(function(_0x17893d,_0x2f5ca8){return client[_0xb3a0('0x5')](_0x3ed8e7,_0x4fb39)[_0xb3a0('0x6')](function(_0x77ddb8){logger['debug'](_0xb3a0('0x7'),_0xb3a0('0x3'),_0x3ed8e7,_0x4fb39,_0x77ddb8);if(_0x77ddb8[_0xb3a0('0x8')]){logger[_0xb3a0('0x8')](_0xb3a0('0x7'),'routing',_0x3ed8e7,_0x77ddb8['error'][_0xb3a0('0x9')],_0x4fb39);return _0x2f5ca8(_0x77ddb8[_0xb3a0('0x8')]['message']);}else{return _0x17893d(_0x77ddb8[_0xb3a0('0xa')]);}})['catch'](function(_0x306aac){logger[_0xb3a0('0x8')](_0xb3a0('0x7'),'routing',_0x3ed8e7,_0x306aac,_0x4fb39);return _0x2f5ca8(_0x306aac);});});};module[_0xb3a0('0xb')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index d273094..b36f8bf 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 _0xbdd4=['catch','log','bluebird','./realtime','./lib/email','./rpc/mailAccount','resolve','then','getMailAccounts','initMailAccounts','listen','getSettings'];(function(_0x424b64,_0x31a4e3){var _0x53a507=function(_0xc6d8a1){while(--_0xc6d8a1){_0x424b64['push'](_0x424b64['shift']());}};_0x53a507(++_0x31a4e3);}(_0xbdd4,0xe6));var _0x4bdd=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbdd4[_0x501510];return _0x1e6ee5;};'use strict';var BPromise=require(_0x4bdd('0x0'));var server=require('./server');var Realtime=require(_0x4bdd('0x1'));var EmailChannel=require(_0x4bdd('0x2'));var mailAccount=require(_0x4bdd('0x3'));var setting=require('./rpc/setting');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0x4bdd('0x4')]()[_0x4bdd('0x5')](mailAccount[_0x4bdd('0x6')]())['then'](realtime[_0x4bdd('0x7')]())[_0x4bdd('0x5')](function(){email['refresh'](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x4bdd('0x8')](realtime,email)['then'](function(){return initRealtime();})['then'](function(){return setting[_0x4bdd('0x9')]();})['then'](function(_0x4c1df4){return setInterval(initRealtime,_0x4c1df4['loginMailFrequency']*0x3e8);})[_0x4bdd('0xa')](function(_0x33314b){console[_0x4bdd('0xb')](_0x33314b);});}main(); \ No newline at end of file +var _0x25b4=['getMailAccounts','initMailAccounts','refresh','listen','getSettings','loginMailFrequency','catch','log','./server','./lib/email','./rpc/mailAccount','./rpc/setting','resolve','then'];(function(_0x42269c,_0x1c1deb){var _0x4c8990=function(_0x5cd733){while(--_0x5cd733){_0x42269c['push'](_0x42269c['shift']());}};_0x4c8990(++_0x1c1deb);}(_0x25b4,0x94));var _0x425b=function(_0x53e3fa,_0x50c5f2){_0x53e3fa=_0x53e3fa-0x0;var _0xe8584a=_0x25b4[_0x53e3fa];return _0xe8584a;};'use strict';var BPromise=require('bluebird');var server=require(_0x425b('0x0'));var Realtime=require('./realtime');var EmailChannel=require(_0x425b('0x1'));var mailAccount=require(_0x425b('0x2'));var setting=require(_0x425b('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0x425b('0x4')]()[_0x425b('0x5')](mailAccount[_0x425b('0x6')]())[_0x425b('0x5')](realtime[_0x425b('0x7')]())[_0x425b('0x5')](function(){email[_0x425b('0x8')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x425b('0x9')](realtime,email)[_0x425b('0x5')](function(){return initRealtime();})['then'](function(){return setting[_0x425b('0xa')]();})['then'](function(_0x2ae782){return setInterval(initRealtime,_0x2ae782[_0x425b('0xb')]*0x3e8);})[_0x425b('0xc')](function(_0xd04889){console[_0x425b('0xd')](_0xd04889);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 70379a8..5503574 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 _0xd59f=['imapAccounts','smtp','emit','active','status','messageStatus','Imap','total','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','handleImapBox','bind','handleImapEmail','end','error','prototype','connected','name','messages','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','notify','then','Mail\x20accepted\x20from\x20routing','Mail\x20not\x20accepted\x20from\x20routing\x20%s','handleImapEnd','lastSync','handleImapError','sendMail','send','verifySmtp','Smtp','verified','catch','verify','exports','lodash','moment','md5','ioredis','email','redis','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','start\x20email\x20channel','mailAccounts'];(function(_0x48fab9,_0x43c32a){var _0x410948=function(_0x52bf23){while(--_0x52bf23){_0x48fab9['push'](_0x48fab9['shift']());}};_0x410948(++_0x43c32a);}(_0xd59f,0x1a3));var _0xfd59=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0xd59f[_0x122096];return _0x3d1966;};'use strict';var _=require(_0xfd59('0x0'));var moment=require(_0xfd59('0x1'));var BPromise=require('bluebird');var md5=require(_0xfd59('0x2'));var Redis=require(_0xfd59('0x3'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0xfd59('0x4'));config['redis']=_['defaults'](config[_0xfd59('0x5')],{'host':_0xfd59('0x6'),'port':0x18eb});var io=require(_0xfd59('0x7'))(new Redis(config[_0xfd59('0x5')]));var EmailImap=require(_0xfd59('0x8'));var EmailSmtp=require(_0xfd59('0x9'));var mailAccount=require(_0xfd59('0xa'));var md5Accounts={};function EmailChannel(_0x417355){logger['info'](_0xfd59('0xb'));this[_0xfd59('0xc')]=_0x417355[_0xfd59('0xc')];this[_0xfd59('0xd')]={};this[_0xfd59('0xe')]=new EmailSmtp();}EmailChannel['prototype'][_0xfd59('0xf')]=function(_0x2020fc){var _0x1805b7=this[_0xfd59('0xc')][_0x2020fc];var _0x4461e1={'id':_0x1805b7['id'],'name':_0x1805b7['name'],'key':_0x1805b7['key'],'active':_0x1805b7[_0xfd59('0x10')],'Imap':{'status':_0x1805b7['Imap'][_0xfd59('0x11')],'messageStatus':_0x1805b7['Imap'][_0xfd59('0x12')],'total':_0x1805b7[_0xfd59('0x13')][_0xfd59('0x14')]}};if(_[_0xfd59('0x15')](md5Accounts[_0x2020fc])){md5Accounts[_0x2020fc]={};}var _0x227acd=md5(JSON[_0xfd59('0x16')](_0x4461e1));if(md5Accounts[_0x2020fc][_0xfd59('0x2')]!==_0x227acd){md5Accounts[_0x2020fc][_0xfd59('0x2')]=_0x227acd;io['emit'](_0xfd59('0x17'),_0x4461e1);}};EmailChannel['prototype'][_0xfd59('0x18')]=function(_0xf8266a){for(var _0x3fcff1 in _0xf8266a){if(_0xf8266a[_0xfd59('0x19')](_0x3fcff1)){if(_0xf8266a[_0x3fcff1][_0xfd59('0x13')]&&_0xf8266a[_0x3fcff1][_0xfd59('0x10')]){var _0x135e74=_0xf8266a[_0x3fcff1][_0xfd59('0x13')];if(!this[_0xfd59('0xd')][_0xfd59('0x19')](_0x135e74['id'])){this[_0xfd59('0xd')][_0x135e74['id']]=new EmailImap(_0x135e74,_0xf8266a[_0x3fcff1]['email']);this[_0xfd59('0xd')][_0x135e74['id']]['on']('box',this[_0xfd59('0x1a')][_0xfd59('0x1b')](this,_0x3fcff1));this['imapAccounts'][_0x135e74['id']]['on'](_0xfd59('0x4'),this[_0xfd59('0x1c')]['bind'](this,_0x3fcff1));this[_0xfd59('0xd')][_0x135e74['id']]['on'](_0xfd59('0x1d'),this['handleImapEnd'][_0xfd59('0x1b')](this,_0x3fcff1));this[_0xfd59('0xd')][_0x135e74['id']]['on'](_0xfd59('0x1e'),this['handleImapError'][_0xfd59('0x1b')](this,_0x3fcff1));}}else{if(_[_0xfd59('0x15')](this[_0xfd59('0xc')][_0x3fcff1][_0xfd59('0x13')])){this['mailAccounts'][_0x3fcff1][_0xfd59('0x13')]={};}this['mailAccounts'][_0x3fcff1][_0xfd59('0x13')]['status']='disabled';this[_0xfd59('0xc')][_0x3fcff1]['Imap']['messageStatus']='';this[_0xfd59('0xf')](_0x3fcff1);}}}};EmailChannel[_0xfd59('0x1f')]['handleImapBox']=function(_0x279120,_0x148be1){if(this[_0xfd59('0xc')][_0x279120]){this[_0xfd59('0xc')][_0x279120][_0xfd59('0x13')][_0xfd59('0x11')]=_0xfd59('0x20');this[_0xfd59('0xc')][_0x279120]['Imap'][_0xfd59('0x12')]=_0x148be1[_0xfd59('0x21')];if(_0x148be1[_0xfd59('0x22')]){this['mailAccounts'][_0x279120]['Imap'][_0xfd59('0x14')]=_0x148be1[_0xfd59('0x22')][_0xfd59('0x14')];}return this[_0xfd59('0xf')](_0x279120);}};EmailChannel['prototype'][_0xfd59('0x1c')]=function(_0x9bfae3,_0xfe8703){logger[_0xfd59('0x23')](_0xfd59('0x24'),_0xfe8703[_0xfd59('0x25')],_0xfe8703[_0xfd59('0x26')],_0xfe8703['from'],_0x9bfae3);if(this[_0xfd59('0xc')][_0x9bfae3]){return mailAccount[_0xfd59('0x27')](_0x9bfae3,_0xfe8703)[_0xfd59('0x28')](function(_0x5b9766){if(_0x5b9766){logger[_0xfd59('0x23')](_0xfd59('0x29'));}})['catch'](function(_0x52f19b){logger['error'](_0xfd59('0x2a'),JSON[_0xfd59('0x16')](_0x52f19b));});}};EmailChannel[_0xfd59('0x1f')][_0xfd59('0x2b')]=function(_0x2d6fe7){if(this[_0xfd59('0xc')][_0x2d6fe7]&&this['mailAccounts'][_0x2d6fe7][_0xfd59('0x13')]){if(this[_0xfd59('0xd')][this[_0xfd59('0xc')][_0x2d6fe7][_0xfd59('0x13')]['id']]){delete this[_0xfd59('0xd')][this[_0xfd59('0xc')][_0x2d6fe7][_0xfd59('0x13')]['id']];}this['mailAccounts'][_0x2d6fe7][_0xfd59('0x13')][_0xfd59('0x2c')]=moment();this['emit'](_0x2d6fe7);}};EmailChannel['prototype'][_0xfd59('0x2d')]=function(_0x192051,_0x25e5e3){if(this[_0xfd59('0xc')][_0x192051]){this[_0xfd59('0xc')][_0x192051][_0xfd59('0x13')][_0xfd59('0x11')]=_0xfd59('0x1e');this[_0xfd59('0xc')][_0x192051][_0xfd59('0x13')][_0xfd59('0x12')]=_0x25e5e3;return this[_0xfd59('0xf')](_0x192051);}};EmailChannel['prototype'][_0xfd59('0x2e')]=function(_0x4ccfca,_0x1d6205){return this['smtp'][_0xfd59('0x2f')](_0x4ccfca,_0x1d6205);};EmailChannel['prototype'][_0xfd59('0x30')]=function(_0x4445e6){var _0x1a33de=this;if(this[_0xfd59('0xc')][_0x4445e6['id']]){if(_[_0xfd59('0x15')](this[_0xfd59('0xc')][_0x4445e6['id']][_0xfd59('0x31')])){this[_0xfd59('0xc')][_0x4445e6['id']]['Smtp']={};}this[_0xfd59('0xc')][_0x4445e6['id']][_0xfd59('0x31')][_0xfd59('0x2c')]=moment();return new BPromise(function(_0x388bd5,_0x4713ef){return _0x1a33de[_0xfd59('0xe')]['verify'](_0x4445e6)[_0xfd59('0x28')](function(_0xeec2ae){_0x1a33de[_0xfd59('0xc')][_0x4445e6['id']]['Smtp'][_0xfd59('0x11')]=_0xfd59('0x32');_0x1a33de['mailAccounts'][_0x4445e6['id']][_0xfd59('0x31')][_0xfd59('0x12')]='';_0x1a33de[_0xfd59('0xf')](_0x4445e6['id']);_0x388bd5(_0xeec2ae);})[_0xfd59('0x33')](function(_0x5479ba){_0x1a33de['mailAccounts'][_0x4445e6['id']][_0xfd59('0x31')]['status']='error';_0x1a33de['mailAccounts'][_0x4445e6['id']][_0xfd59('0x31')][_0xfd59('0x12')]=_0x5479ba;_0x1a33de[_0xfd59('0xf')](_0x4445e6['id']);_0x4713ef(_0x5479ba);});});}return this['smtp'][_0xfd59('0x34')](_0x4445e6);};module[_0xfd59('0x35')]=EmailChannel; \ No newline at end of file +var _0xbfbe=['ioredis','../../../config/logger','email','redis','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','smtp','prototype','emit','name','active','Imap','status','messageStatus','total','stringify','mailAccount:update','refresh','imapAccounts','box','bind','end','error','handleImapError','disabled','handleImapBox','connected','messages','handleImapEmail','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','then','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','handleImapEnd','lastSync','isNil','Smtp','verify','verified','exports','lodash','moment','bluebird','md5'];(function(_0x1b46b0,_0x64f773){var _0x2e361c=function(_0x30d30e){while(--_0x30d30e){_0x1b46b0['push'](_0x1b46b0['shift']());}};_0x2e361c(++_0x64f773);}(_0xbfbe,0x140));var _0xebfb=function(_0x5201a7,_0x21f8bf){_0x5201a7=_0x5201a7-0x0;var _0x435d26=_0xbfbe[_0x5201a7];return _0x435d26;};'use strict';var _=require(_0xebfb('0x0'));var moment=require(_0xebfb('0x1'));var BPromise=require(_0xebfb('0x2'));var md5=require(_0xebfb('0x3'));var Redis=require(_0xebfb('0x4'));var config=require('../../../config/environment');var logger=require(_0xebfb('0x5'))(_0xebfb('0x6'));config[_0xebfb('0x7')]=_['defaults'](config[_0xebfb('0x7')],{'host':_0xebfb('0x8'),'port':0x18eb});var io=require(_0xebfb('0x9'))(new Redis(config[_0xebfb('0x7')]));var EmailImap=require(_0xebfb('0xa'));var EmailSmtp=require(_0xebfb('0xb'));var mailAccount=require(_0xebfb('0xc'));var md5Accounts={};function EmailChannel(_0x3268cf){logger[_0xebfb('0xd')](_0xebfb('0xe'));this[_0xebfb('0xf')]=_0x3268cf[_0xebfb('0xf')];this['imapAccounts']={};this[_0xebfb('0x10')]=new EmailSmtp();}EmailChannel[_0xebfb('0x11')][_0xebfb('0x12')]=function(_0x42fb46){var _0x1e1e44=this[_0xebfb('0xf')][_0x42fb46];var _0x581d3c={'id':_0x1e1e44['id'],'name':_0x1e1e44[_0xebfb('0x13')],'key':_0x1e1e44['key'],'active':_0x1e1e44[_0xebfb('0x14')],'Imap':{'status':_0x1e1e44[_0xebfb('0x15')][_0xebfb('0x16')],'messageStatus':_0x1e1e44['Imap'][_0xebfb('0x17')],'total':_0x1e1e44[_0xebfb('0x15')][_0xebfb('0x18')]}};if(_['isNil'](md5Accounts[_0x42fb46])){md5Accounts[_0x42fb46]={};}var _0x557b06=md5(JSON[_0xebfb('0x19')](_0x581d3c));if(md5Accounts[_0x42fb46][_0xebfb('0x3')]!==_0x557b06){md5Accounts[_0x42fb46][_0xebfb('0x3')]=_0x557b06;io['emit'](_0xebfb('0x1a'),_0x581d3c);}};EmailChannel[_0xebfb('0x11')][_0xebfb('0x1b')]=function(_0x7a1f02){for(var _0x65e517 in _0x7a1f02){if(_0x7a1f02['hasOwnProperty'](_0x65e517)){if(_0x7a1f02[_0x65e517][_0xebfb('0x15')]&&_0x7a1f02[_0x65e517][_0xebfb('0x14')]){var _0x3b89d8=_0x7a1f02[_0x65e517][_0xebfb('0x15')];if(!this[_0xebfb('0x1c')]['hasOwnProperty'](_0x3b89d8['id'])){this['imapAccounts'][_0x3b89d8['id']]=new EmailImap(_0x3b89d8,_0x7a1f02[_0x65e517]['email']);this[_0xebfb('0x1c')][_0x3b89d8['id']]['on'](_0xebfb('0x1d'),this['handleImapBox'][_0xebfb('0x1e')](this,_0x65e517));this[_0xebfb('0x1c')][_0x3b89d8['id']]['on'](_0xebfb('0x6'),this['handleImapEmail']['bind'](this,_0x65e517));this[_0xebfb('0x1c')][_0x3b89d8['id']]['on'](_0xebfb('0x1f'),this['handleImapEnd']['bind'](this,_0x65e517));this[_0xebfb('0x1c')][_0x3b89d8['id']]['on'](_0xebfb('0x20'),this[_0xebfb('0x21')][_0xebfb('0x1e')](this,_0x65e517));}}else{if(_['isNil'](this[_0xebfb('0xf')][_0x65e517]['Imap'])){this[_0xebfb('0xf')][_0x65e517][_0xebfb('0x15')]={};}this['mailAccounts'][_0x65e517][_0xebfb('0x15')][_0xebfb('0x16')]=_0xebfb('0x22');this['mailAccounts'][_0x65e517]['Imap']['messageStatus']='';this[_0xebfb('0x12')](_0x65e517);}}}};EmailChannel[_0xebfb('0x11')][_0xebfb('0x23')]=function(_0x5523c4,_0x110530){if(this['mailAccounts'][_0x5523c4]){this[_0xebfb('0xf')][_0x5523c4]['Imap'][_0xebfb('0x16')]=_0xebfb('0x24');this[_0xebfb('0xf')][_0x5523c4]['Imap']['messageStatus']=_0x110530[_0xebfb('0x13')];if(_0x110530['messages']){this[_0xebfb('0xf')][_0x5523c4][_0xebfb('0x15')][_0xebfb('0x18')]=_0x110530[_0xebfb('0x25')][_0xebfb('0x18')];}return this[_0xebfb('0x12')](_0x5523c4);}};EmailChannel['prototype'][_0xebfb('0x26')]=function(_0x4ab3d1,_0x59b06b){logger[_0xebfb('0xd')](_0xebfb('0x27'),_0x59b06b[_0xebfb('0x28')],_0x59b06b[_0xebfb('0x29')],_0x59b06b[_0xebfb('0x2a')],_0x4ab3d1);if(this[_0xebfb('0xf')][_0x4ab3d1]){return mailAccount[_0xebfb('0x2b')](_0x4ab3d1,_0x59b06b)[_0xebfb('0x2c')](function(_0xbb0ae7){if(_0xbb0ae7){logger[_0xebfb('0xd')]('Mail\x20accepted\x20from\x20routing');}})[_0xebfb('0x2d')](function(_0x24d91d){logger['error'](_0xebfb('0x2e'),JSON[_0xebfb('0x19')](_0x24d91d));});}};EmailChannel[_0xebfb('0x11')][_0xebfb('0x2f')]=function(_0x19e63b){if(this[_0xebfb('0xf')][_0x19e63b]&&this[_0xebfb('0xf')][_0x19e63b][_0xebfb('0x15')]){if(this['imapAccounts'][this[_0xebfb('0xf')][_0x19e63b][_0xebfb('0x15')]['id']]){delete this['imapAccounts'][this[_0xebfb('0xf')][_0x19e63b][_0xebfb('0x15')]['id']];}this[_0xebfb('0xf')][_0x19e63b][_0xebfb('0x15')][_0xebfb('0x30')]=moment();this[_0xebfb('0x12')](_0x19e63b);}};EmailChannel[_0xebfb('0x11')][_0xebfb('0x21')]=function(_0x2d0dbd,_0x4513e6){if(this[_0xebfb('0xf')][_0x2d0dbd]){this[_0xebfb('0xf')][_0x2d0dbd][_0xebfb('0x15')][_0xebfb('0x16')]=_0xebfb('0x20');this[_0xebfb('0xf')][_0x2d0dbd][_0xebfb('0x15')][_0xebfb('0x17')]=_0x4513e6;return this[_0xebfb('0x12')](_0x2d0dbd);}};EmailChannel[_0xebfb('0x11')]['sendMail']=function(_0x44d643,_0x4bf597){return this[_0xebfb('0x10')]['send'](_0x44d643,_0x4bf597);};EmailChannel[_0xebfb('0x11')]['verifySmtp']=function(_0x33b625){var _0xd54519=this;if(this['mailAccounts'][_0x33b625['id']]){if(_[_0xebfb('0x31')](this[_0xebfb('0xf')][_0x33b625['id']][_0xebfb('0x32')])){this[_0xebfb('0xf')][_0x33b625['id']][_0xebfb('0x32')]={};}this[_0xebfb('0xf')][_0x33b625['id']]['Smtp'][_0xebfb('0x30')]=moment();return new BPromise(function(_0x315f2d,_0x2a0978){return _0xd54519[_0xebfb('0x10')][_0xebfb('0x33')](_0x33b625)[_0xebfb('0x2c')](function(_0x310f0e){_0xd54519[_0xebfb('0xf')][_0x33b625['id']][_0xebfb('0x32')][_0xebfb('0x16')]=_0xebfb('0x34');_0xd54519[_0xebfb('0xf')][_0x33b625['id']][_0xebfb('0x32')][_0xebfb('0x17')]='';_0xd54519[_0xebfb('0x12')](_0x33b625['id']);_0x315f2d(_0x310f0e);})[_0xebfb('0x2d')](function(_0x303c56){_0xd54519[_0xebfb('0xf')][_0x33b625['id']][_0xebfb('0x32')][_0xebfb('0x16')]=_0xebfb('0x20');_0xd54519[_0xebfb('0xf')][_0x33b625['id']][_0xebfb('0x32')]['messageStatus']=_0x303c56;_0xd54519[_0xebfb('0x12')](_0x33b625['id']);_0x2a0978(_0x303c56);});});}return this[_0xebfb('0x10')][_0xebfb('0x33')](_0x33b625);};module[_0xebfb('0x35')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index f59d279..4220306 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 _0x44c8=['once','ready','end','bind','error','handleError','inherits','getAccount','connTimeout','authTimeout','isNil','service','authentication','user','password','host','port','tls','required','getHost','prototype','handleReady','openBox','handleOpenBox','emit','box','readUnseen','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','handleCloseBox','body','attributes','handleMessageAttributes','handleMessageBody','handleSimpleParser','handleMessageEnd','parser','stringify','textCode','hasOwnProperty','upperFirst','util','imap','lodash','mailparser','simpleParser','Iconv','events','EventEmitter','../../../config/logger','email','mailbox','INBOX','account'];(function(_0x575acc,_0x4d87dc){var _0x58602c=function(_0x8271ad){while(--_0x8271ad){_0x575acc['push'](_0x575acc['shift']());}};_0x58602c(++_0x4d87dc);}(_0x44c8,0xaa));var _0x844c=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0x44c8[_0x403c20];return _0x2b271a;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0x844c('0x0'));var Imap=require(_0x844c('0x1'));var _=require(_0x844c('0x2'));var rs=require('randomstring');var simpleParser=require(_0x844c('0x3'))[_0x844c('0x4')];var Iconv=require('iconv')[_0x844c('0x5')];var EventEmitter=require(_0x844c('0x6'))[_0x844c('0x7')];var utils=require('./utils');var logger=require(_0x844c('0x8'))(_0x844c('0x9'));function EmailImap(_0x449205,_0x1e3bee){this[_0x844c('0xa')]=_0x844c('0xb');this[_0x844c('0xc')]=this['getAccount'](_0x449205,_0x1e3bee);this[_0x844c('0x1')]=new Imap(this[_0x844c('0xc')]);this['imap'][_0x844c('0xd')](_0x844c('0xe'),this['handleReady']['bind'](this));this[_0x844c('0x1')][_0x844c('0xd')](_0x844c('0xf'),this['handleEnd'][_0x844c('0x10')](this));this[_0x844c('0x1')]['on'](_0x844c('0x11'),this[_0x844c('0x12')][_0x844c('0x10')](this));this[_0x844c('0x1')]['connect']();}util[_0x844c('0x13')](EmailImap,EventEmitter);EmailImap['prototype'][_0x844c('0x14')]=function(_0x15326f,_0x1129d4){var _0x2cb78c={'connTimeout':_0x15326f[_0x844c('0x15')]?_0x15326f[_0x844c('0x15')]*0x3e8:0x2710,'authTimeout':_0x15326f[_0x844c('0x16')]?_0x15326f['authTimeout']*0x3e8:0x1388};if(_[_0x844c('0x17')](_0x15326f[_0x844c('0x18')])){if(_0x15326f[_0x844c('0x19')]){_0x2cb78c[_0x844c('0x1a')]=_0x15326f['user'];_0x2cb78c[_0x844c('0x1b')]=_0x15326f[_0x844c('0x1b')];}_0x2cb78c[_0x844c('0x1c')]=_0x15326f[_0x844c('0x1c')];_0x2cb78c['port']=_0x15326f[_0x844c('0x1d')]||0x3e1;if(_0x15326f[_0x844c('0x1e')]){_0x2cb78c[_0x844c('0x1e')]=!![];}else{_0x2cb78c[_0x844c('0x1e')]=![];_0x2cb78c['autotls']=_0x844c('0x1f');}}else{_0x2cb78c[_0x844c('0x1a')]=_0x15326f[_0x844c('0x1a')];_0x2cb78c['password']=_0x15326f[_0x844c('0x1b')];_0x2cb78c[_0x844c('0x1c')]=utils[_0x844c('0x20')](_0x15326f[_0x844c('0x18')]);_0x2cb78c['port']=0x3e1;_0x2cb78c['tls']=!![];}_0x2cb78c['email']=_0x1129d4||_0x15326f[_0x844c('0x1a')]||'anonymous@xcally.com';return _0x2cb78c;};EmailImap[_0x844c('0x21')][_0x844c('0x22')]=function(){this['imap'][_0x844c('0x23')](this[_0x844c('0xa')],![],this[_0x844c('0x24')]['bind'](this));};EmailImap[_0x844c('0x21')][_0x844c('0x24')]=function(_0x1dea38,_0x12699d){if(_0x1dea38){this['handleError'](_0x1dea38,!![]);}else{this[_0x844c('0x25')](_0x844c('0x26'),_0x12699d);this[_0x844c('0x27')]();}};EmailImap['prototype']['handleCloseBox']=function(_0x289921){if(_0x289921){this[_0x844c('0x12')](_0x289921,!![]);}else{this[_0x844c('0x1')][_0x844c('0xf')]();}};EmailImap[_0x844c('0x21')][_0x844c('0x27')]=function(){this['imap']['search']([_0x844c('0x28')],this[_0x844c('0x29')]['bind'](this));};EmailImap[_0x844c('0x21')][_0x844c('0x29')]=function(_0x16b786,_0x14bda2){if(_0x16b786){this[_0x844c('0x12')](_0x16b786,!![]);}else{if(_0x14bda2[_0x844c('0x2a')]){try{var _0x1b8628=this[_0x844c('0x1')][_0x844c('0x2b')](_0x14bda2,{'bodies':'','markSeen':!![]});_0x1b8628['on'](_0x844c('0x2c'),this[_0x844c('0x2d')][_0x844c('0x10')](this));_0x1b8628[_0x844c('0xd')](_0x844c('0x11'),this[_0x844c('0x2e')][_0x844c('0x10')](this));_0x1b8628['once']('end',this[_0x844c('0x2f')][_0x844c('0x10')](this));}catch(_0x143467){logger[_0x844c('0x11')](_0x143467);}}else{this[_0x844c('0x1')][_0x844c('0x30')](!![],this[_0x844c('0x31')][_0x844c('0x10')](this));}}};EmailImap[_0x844c('0x21')][_0x844c('0x2d')]=function(_0x2dbf29,_0x34eaba){_0x2dbf29['on'](_0x844c('0x32'),this['handleMessageBody']['bind'](this));_0x2dbf29['once'](_0x844c('0x33'),this[_0x844c('0x34')][_0x844c('0x10')](this));_0x2dbf29['once']('end',this['handleMessageEnd'][_0x844c('0x10')](this));};EmailImap[_0x844c('0x21')][_0x844c('0x35')]=function(_0x228a18,_0x216465){simpleParser(_0x228a18,{'Iconv':Iconv},this[_0x844c('0x36')][_0x844c('0x10')](this));};EmailImap[_0x844c('0x21')][_0x844c('0x34')]=function(_0x3ddcee){};EmailImap[_0x844c('0x21')][_0x844c('0x37')]=function(){};EmailImap['prototype']['handleSimpleParser']=function(_0x1ff238,_0x5e1c75){if(_0x1ff238){logger['error'](_0x1ff238);}else{var _0x1841af=this;utils[_0x844c('0x38')](this[_0x844c('0xc')],_0x5e1c75,function(_0x5e5d81){_0x1841af[_0x844c('0x25')](_0x844c('0x9'),_0x5e5d81);});}};EmailImap[_0x844c('0x21')][_0x844c('0x2f')]=function(){this[_0x844c('0x1')][_0x844c('0x30')](!![],this['handleCloseBox'][_0x844c('0x10')](this));};EmailImap[_0x844c('0x21')][_0x844c('0x2e')]=function(_0x2d6d35){this[_0x844c('0x12')](_0x2d6d35);this[_0x844c('0x1')][_0x844c('0x30')](!![],this[_0x844c('0x31')][_0x844c('0x10')](this));};EmailImap[_0x844c('0x21')]['handleEnd']=function(){this[_0x844c('0x25')](_0x844c('0xf'));};EmailImap[_0x844c('0x21')]['handleError']=function(_0x878a0,_0x57a761){logger[_0x844c('0x11')](_0x844c('0x12'),this[_0x844c('0xc')][_0x844c('0x9')],JSON[_0x844c('0x39')](_0x878a0));var _0x781c8b='';if(_0x878a0){if(_0x878a0[_0x844c('0x3a')]){_0x781c8b=_0x878a0[_0x844c('0x3a')];}else{for(var _0x58709a in _0x878a0){if(_0x878a0[_0x844c('0x3b')](_0x58709a)){_0x781c8b+=_[_0x844c('0x3c')](_0x58709a)+':\x20'+_0x878a0[_0x58709a]+'\x0a';}}}}if(_0x57a761){this['imap'][_0x844c('0xf')]();}else{this['emit']('error',_0x781c8b);this[_0x844c('0x25')](_0x844c('0xf'));}};module['exports']=EmailImap; \ No newline at end of file +var _0x18e0=['once','handleReady','end','handleEnd','bind','error','handleError','connect','prototype','connTimeout','authTimeout','isNil','authentication','user','password','host','port','tls','autotls','required','getHost','service','anonymous@xcally.com','openBox','handleOpenBox','emit','box','readUnseen','handleCloseBox','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','email','stringify','textCode','hasOwnProperty','util','lodash','randomstring','mailparser','iconv','EventEmitter','./utils','../../../config/logger','mailbox','account','getAccount','imap'];(function(_0x15ef0c,_0x126916){var _0x1ea198=function(_0x340ff8){while(--_0x340ff8){_0x15ef0c['push'](_0x15ef0c['shift']());}};_0x1ea198(++_0x126916);}(_0x18e0,0xa2));var _0x018e=function(_0x176329,_0x568c84){_0x176329=_0x176329-0x0;var _0x31997c=_0x18e0[_0x176329];return _0x31997c;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0x018e('0x0'));var Imap=require('imap');var _=require(_0x018e('0x1'));var rs=require(_0x018e('0x2'));var simpleParser=require(_0x018e('0x3'))['simpleParser'];var Iconv=require(_0x018e('0x4'))['Iconv'];var EventEmitter=require('events')[_0x018e('0x5')];var utils=require(_0x018e('0x6'));var logger=require(_0x018e('0x7'))('email');function EmailImap(_0x5b6638,_0x36aac8){this[_0x018e('0x8')]='INBOX';this[_0x018e('0x9')]=this[_0x018e('0xa')](_0x5b6638,_0x36aac8);this[_0x018e('0xb')]=new Imap(this[_0x018e('0x9')]);this[_0x018e('0xb')][_0x018e('0xc')]('ready',this[_0x018e('0xd')]['bind'](this));this['imap']['once'](_0x018e('0xe'),this[_0x018e('0xf')][_0x018e('0x10')](this));this[_0x018e('0xb')]['on'](_0x018e('0x11'),this[_0x018e('0x12')][_0x018e('0x10')](this));this[_0x018e('0xb')][_0x018e('0x13')]();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0x018e('0x14')][_0x018e('0xa')]=function(_0x2d6aa0,_0x423f58){var _0x13df12={'connTimeout':_0x2d6aa0['connTimeout']?_0x2d6aa0[_0x018e('0x15')]*0x3e8:0x2710,'authTimeout':_0x2d6aa0[_0x018e('0x16')]?_0x2d6aa0[_0x018e('0x16')]*0x3e8:0x1388};if(_[_0x018e('0x17')](_0x2d6aa0['service'])){if(_0x2d6aa0[_0x018e('0x18')]){_0x13df12[_0x018e('0x19')]=_0x2d6aa0['user'];_0x13df12[_0x018e('0x1a')]=_0x2d6aa0[_0x018e('0x1a')];}_0x13df12[_0x018e('0x1b')]=_0x2d6aa0[_0x018e('0x1b')];_0x13df12[_0x018e('0x1c')]=_0x2d6aa0['port']||0x3e1;if(_0x2d6aa0[_0x018e('0x1d')]){_0x13df12[_0x018e('0x1d')]=!![];}else{_0x13df12[_0x018e('0x1d')]=![];_0x13df12[_0x018e('0x1e')]=_0x018e('0x1f');}}else{_0x13df12[_0x018e('0x19')]=_0x2d6aa0[_0x018e('0x19')];_0x13df12['password']=_0x2d6aa0[_0x018e('0x1a')];_0x13df12[_0x018e('0x1b')]=utils[_0x018e('0x20')](_0x2d6aa0[_0x018e('0x21')]);_0x13df12[_0x018e('0x1c')]=0x3e1;_0x13df12['tls']=!![];}_0x13df12['email']=_0x423f58||_0x2d6aa0[_0x018e('0x19')]||_0x018e('0x22');return _0x13df12;};EmailImap[_0x018e('0x14')][_0x018e('0xd')]=function(){this[_0x018e('0xb')][_0x018e('0x23')](this[_0x018e('0x8')],![],this[_0x018e('0x24')][_0x018e('0x10')](this));};EmailImap[_0x018e('0x14')][_0x018e('0x24')]=function(_0x7596f4,_0x4e7d9a){if(_0x7596f4){this[_0x018e('0x12')](_0x7596f4,!![]);}else{this[_0x018e('0x25')](_0x018e('0x26'),_0x4e7d9a);this[_0x018e('0x27')]();}};EmailImap[_0x018e('0x14')][_0x018e('0x28')]=function(_0x407fda){if(_0x407fda){this[_0x018e('0x12')](_0x407fda,!![]);}else{this[_0x018e('0xb')][_0x018e('0xe')]();}};EmailImap['prototype'][_0x018e('0x27')]=function(){this[_0x018e('0xb')]['search']([_0x018e('0x29')],this[_0x018e('0x2a')][_0x018e('0x10')](this));};EmailImap[_0x018e('0x14')][_0x018e('0x2a')]=function(_0x42da91,_0x47af9d){if(_0x42da91){this[_0x018e('0x12')](_0x42da91,!![]);}else{if(_0x47af9d[_0x018e('0x2b')]){try{var _0x5903d6=this[_0x018e('0xb')][_0x018e('0x2c')](_0x47af9d,{'bodies':'','markSeen':!![]});_0x5903d6['on'](_0x018e('0x2d'),this[_0x018e('0x2e')][_0x018e('0x10')](this));_0x5903d6['once'](_0x018e('0x11'),this[_0x018e('0x2f')][_0x018e('0x10')](this));_0x5903d6['once'](_0x018e('0xe'),this['handleFetchEnd'][_0x018e('0x10')](this));}catch(_0x17398e){logger['error'](_0x17398e);}}else{this['imap'][_0x018e('0x30')](!![],this[_0x018e('0x28')][_0x018e('0x10')](this));}}};EmailImap[_0x018e('0x14')][_0x018e('0x2e')]=function(_0x4a5cca,_0x1a6d86){_0x4a5cca['on'](_0x018e('0x31'),this[_0x018e('0x32')]['bind'](this));_0x4a5cca['once'](_0x018e('0x33'),this[_0x018e('0x34')][_0x018e('0x10')](this));_0x4a5cca[_0x018e('0xc')](_0x018e('0xe'),this[_0x018e('0x35')]['bind'](this));};EmailImap[_0x018e('0x14')][_0x018e('0x32')]=function(_0x4fd059,_0x4cb785){simpleParser(_0x4fd059,{'Iconv':Iconv},this['handleSimpleParser'][_0x018e('0x10')](this));};EmailImap[_0x018e('0x14')][_0x018e('0x34')]=function(_0x1705b7){};EmailImap[_0x018e('0x14')]['handleMessageEnd']=function(){};EmailImap[_0x018e('0x14')]['handleSimpleParser']=function(_0xcaf318,_0x2d079b){if(_0xcaf318){logger[_0x018e('0x11')](_0xcaf318);}else{var _0x2e792d=this;utils['parser'](this[_0x018e('0x9')],_0x2d079b,function(_0x11a280){_0x2e792d['emit']('email',_0x11a280);});}};EmailImap[_0x018e('0x14')]['handleFetchEnd']=function(){this[_0x018e('0xb')][_0x018e('0x30')](!![],this['handleCloseBox'][_0x018e('0x10')](this));};EmailImap[_0x018e('0x14')][_0x018e('0x2f')]=function(_0x368b89){this[_0x018e('0x12')](_0x368b89);this[_0x018e('0xb')][_0x018e('0x30')](!![],this[_0x018e('0x28')]['bind'](this));};EmailImap[_0x018e('0x14')][_0x018e('0xf')]=function(){this['emit'](_0x018e('0xe'));};EmailImap[_0x018e('0x14')][_0x018e('0x12')]=function(_0x17b11a,_0x34bfec){logger['error'](_0x018e('0x12'),this['account'][_0x018e('0x36')],JSON[_0x018e('0x37')](_0x17b11a));var _0x1e2029='';if(_0x17b11a){if(_0x17b11a[_0x018e('0x38')]){_0x1e2029=_0x17b11a['textCode'];}else{for(var _0x32cbab in _0x17b11a){if(_0x17b11a[_0x018e('0x39')](_0x32cbab)){_0x1e2029+=_['upperFirst'](_0x32cbab)+':\x20'+_0x17b11a[_0x32cbab]+'\x0a';}}}}if(_0x34bfec){this[_0x018e('0xb')][_0x018e('0xe')]();}else{this[_0x018e('0x25')](_0x018e('0x11'),_0x1e2029);this[_0x018e('0x25')](_0x018e('0xe'));}};module['exports']=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index ae7ef4c..b0598d2 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 _0xe923=['createTransport','use','compile','sendMail','toString','verify','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','prototype'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xe923,0xa2));var _0x3e92=function(_0x576e2b,_0x328953){_0x576e2b=_0x576e2b-0x0;var _0x46461a=_0xe923[_0x576e2b];return _0x46461a;};'use strict';var nodemailer=require(_0x3e92('0x0'));var BPromise=require('bluebird');var inlineBase64=require(_0x3e92('0x1'));function EmailSmtp(){}EmailSmtp[_0x3e92('0x2')]['send']=function(_0x486186,_0x39f1a9){return new BPromise(function(_0x552083,_0x5498e0){var _0x2614cc=nodemailer[_0x3e92('0x3')](_0x486186);_0x2614cc[_0x3e92('0x4')](_0x3e92('0x5'),inlineBase64());_0x2614cc[_0x3e92('0x6')](_0x39f1a9,function(_0x12bc61,_0x46832a){if(_0x12bc61){_0x5498e0(_0x12bc61[_0x3e92('0x7')]());}else{_0x552083(_0x46832a);}});});};EmailSmtp[_0x3e92('0x2')]['verify']=function(_0x191ef7){return new BPromise(function(_0x283199,_0x273ea9){var _0x17efae=nodemailer[_0x3e92('0x3')](_0x191ef7);_0x17efae[_0x3e92('0x8')](function(_0x239705,_0x40a3fa){if(_0x239705){_0x273ea9(_0x239705[_0x3e92('0x7')]());}else{if(_0x40a3fa){_0x283199(_0x40a3fa);}else{_0x273ea9(_0x3e92('0x9'));}}});});};module[_0x3e92('0xa')]=EmailSmtp; \ No newline at end of file +var _0x99d5=['use','compile','sendMail','verify','toString','exports','bluebird','nodemailer-plugin-inline-base64','prototype','send','createTransport'];(function(_0x494062,_0x1f7113){var _0x1ef8ca=function(_0x4b374f){while(--_0x4b374f){_0x494062['push'](_0x494062['shift']());}};_0x1ef8ca(++_0x1f7113);}(_0x99d5,0x1b3));var _0x599d=function(_0x1811dc,_0x4b8093){_0x1811dc=_0x1811dc-0x0;var _0x4544f9=_0x99d5[_0x1811dc];return _0x4544f9;};'use strict';var nodemailer=require('nodemailer');var BPromise=require(_0x599d('0x0'));var inlineBase64=require(_0x599d('0x1'));function EmailSmtp(){}EmailSmtp[_0x599d('0x2')][_0x599d('0x3')]=function(_0x5382bb,_0x130fbe){return new BPromise(function(_0x12d48e,_0x37ce91){var _0xbec50=nodemailer[_0x599d('0x4')](_0x5382bb);_0xbec50[_0x599d('0x5')](_0x599d('0x6'),inlineBase64());_0xbec50[_0x599d('0x7')](_0x130fbe,function(_0xce6017,_0x292bb1){if(_0xce6017){_0x37ce91(_0xce6017['toString']());}else{_0x12d48e(_0x292bb1);}});});};EmailSmtp['prototype'][_0x599d('0x8')]=function(_0x35b382){return new BPromise(function(_0x14d6b6,_0x27cf0a){var _0x536a0f=nodemailer['createTransport'](_0x35b382);_0x536a0f[_0x599d('0x8')](function(_0x455b03,_0xb1efa3){if(_0x455b03){_0x27cf0a(_0x455b03[_0x599d('0x9')]());}else{if(_0xb1efa3){_0x14d6b6(_0xb1efa3);}else{_0x27cf0a('Not\x20verifired');}}});});};module[_0x599d('0xa')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index b2313b4..75cdc3f 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 _0xf8ad=['replace','includes','forEach','filename','_SRC','_IMG','\x20[Attachment:\x20','\x20]','body','textAsHtml','Empty\x20message

','Attachments','push','Data','getHost','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','randomstring','util','node-tnef','../../../config/logger','email','../../../config/environment','head','address','anonymous','generate','@xcally.com','name','substring','indexOf','split','length','slice','join','Anonymous','value','pop','isEmpty','test','html'];(function(_0x219749,_0x3d4cf1){var _0x315ce0=function(_0x4290c1){while(--_0x4290c1){_0x219749['push'](_0x219749['shift']());}};_0x315ce0(++_0x3d4cf1);}(_0xf8ad,0xd8));var _0xdf8a=function(_0x160afe,_0xccd3ed){_0x160afe=_0x160afe-0x0;var _0x45e202=_0xf8ad[_0x160afe];return _0x45e202;};'use strict';var _=require('lodash');var moment=require('moment');var random=require(_0xdf8a('0x0'));var fs=require('fs');var path=require('path');var util=require(_0xdf8a('0x1'));var tnef=require(_0xdf8a('0x2'));var logger=require(_0xdf8a('0x3'))(_0xdf8a('0x4'));var config=require(_0xdf8a('0x5'));function getAddress(_0x360034){var _0x5e4284=_[_0xdf8a('0x6')](_0x360034['value']);return _0x5e4284&&_0x5e4284['address']?_0x5e4284[_0xdf8a('0x7')]:_0xdf8a('0x8')+random[_0xdf8a('0x9')](0x6)+_0xdf8a('0xa');}function getFirstName(_0x35204d){var _0x1dd819=_[_0xdf8a('0x6')](_0x35204d['value']);if(_0x1dd819&&_0x1dd819[_0xdf8a('0xb')]){if(_0x1dd819['name']==_0x1dd819[_0xdf8a('0x7')]){return _0x1dd819[_0xdf8a('0xb')][_0xdf8a('0xc')](0x0,_0x1dd819[_0xdf8a('0xb')][_0xdf8a('0xd')]('@'));}var _0x3b1a1f=_0x1dd819[_0xdf8a('0xb')][_0xdf8a('0xe')](/\s+/);return _0x3b1a1f[_0xdf8a('0xf')]>0x1?_0x3b1a1f[_0xdf8a('0x10')](0x0,-0x1)[_0xdf8a('0x11')]('\x20'):_0x1dd819[_0xdf8a('0xb')];}return _0xdf8a('0x12');}function getLastName(_0x685d5b){var _0x5ed10c=_[_0xdf8a('0x6')](_0x685d5b[_0xdf8a('0x13')]);if(_0x5ed10c&&_0x5ed10c[_0xdf8a('0xb')]){var _0x14f9da=_0x5ed10c['name'][_0xdf8a('0xe')](/\s+/);return _0x14f9da[_0xdf8a('0xf')]>0x1?_0x14f9da[_0xdf8a('0x14')]():'';}return'';}function getMails(_0x4c9c0e,_0xa69e61){var _0x392220='';for(var _0x4aa870=0x0;_0x4aa870<_0xa69e61[_0xdf8a('0x13')][_0xdf8a('0xf')];_0x4aa870+=0x1){if(_0xa69e61['value'][_0x4aa870][_0xdf8a('0x7')]!==_0x4c9c0e){if(!_[_0xdf8a('0x15')](_0x392220)){_0x392220+=',';}_0x392220+=_0xa69e61[_0xdf8a('0x13')][_0x4aa870]['name']||_0xa69e61[_0xdf8a('0x13')][_0x4aa870][_0xdf8a('0x7')]||'';_0x392220+='\x20<';_0x392220+=_0xa69e61['value'][_0x4aa870]['address']?_0xa69e61[_0xdf8a('0x13')][_0x4aa870][_0xdf8a('0x7')]:_0xdf8a('0x8')+random[_0xdf8a('0x9')](0x6)+_0xdf8a('0xa');_0x392220+='>';}}return _0x392220;}function parseEmail(_0x1385b6,_0x24238b,_0x315414){if(_0x24238b['html']){var _0x24c830=/)<[^<]*)*<\/script>/gi;while(_0x24c830[_0xdf8a('0x16')](_0x24238b[_0xdf8a('0x17')])){_0x24238b['html']=_0x24238b['html'][_0xdf8a('0x18')](_0x24c830,'');}if(_0x24238b[_0xdf8a('0x17')][_0xdf8a('0x19')]('{_0x2aa6b9['push'](_0x553b9e[_0xdf8a('0x1b')]);});var _0x30a5ca=/]+>/g;var _0x26b5c7=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x1f0abc=_0x24238b[_0xdf8a('0x17')][_0xdf8a('0x18')](_0x26b5c7,_0xdf8a('0x1c'));var _0x2378f1=_0x1f0abc[_0xdf8a('0x18')](_0x30a5ca,_0xdf8a('0x1d'));for(let _0xf89343=0x0;_0xf89343<_0x2aa6b9[_0xdf8a('0xf')];_0xf89343++){var _0x1ba838=_0x2378f1[_0xdf8a('0x18')]('_IMG',_0xdf8a('0x1e')+_0x2aa6b9[_0xf89343]+_0xdf8a('0x1f'));_0x2378f1=_0x1ba838;}_0x24238b['html']=_0x2378f1;}_0x315414[_0xdf8a('0x20')]=_0x24238b[_0xdf8a('0x17')];}else{_0x315414[_0xdf8a('0x20')]=_0x24238b[_0xdf8a('0x21')];}if(_0x315414[_0xdf8a('0x20')]){_0x315414['body']=_0x315414[_0xdf8a('0x20')][_0xdf8a('0x18')](/0x0){var _0x10b4f9=[_0xdf8a('0x32'),_0xdf8a('0x33'),_0xdf8a('0x34')];for(var _0x246073=0x0;_0x246073<_0x24238b['headerLines'][_0xdf8a('0xf')];_0x246073++){var _0x570e42=_[_0xdf8a('0xd')](_0x10b4f9,_0x24238b[_0xdf8a('0x31')][_0x246073][_0xdf8a('0x35')]);if(_0x570e42>=0x0){_0x315414[_0xdf8a('0x36')]=!![];}}}return _0x315414;}exports[_0xdf8a('0x37')]=function(_0x4967be,_0x4e372b,_0x5cd3a3){var _0x5af6c8={'from':getAddress(_0x4e372b['from']),'firstName':getFirstName(_0x4e372b[_0xdf8a('0x38')]),'lastName':getLastName(_0x4e372b['from']),'mapKey':_0xdf8a('0x4'),'message':{'from':getMails(_0x4967be[_0xdf8a('0x4')],_0x4e372b[_0xdf8a('0x38')]),'to':_0x4967be['email'],'cc':'','subject':_0x4e372b[_0xdf8a('0x39')]||'','messageId':_0x4e372b[_0xdf8a('0x3a')],'inReplyTo':_0x4e372b['inReplyTo'],'sentAt':moment(_0x4e372b[_0xdf8a('0x3b')])[_0xdf8a('0x2b')]('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x4e372b[_0xdf8a('0x17')]&&!_0x4e372b[_0xdf8a('0x21')]){var _0x15381d=_[_0xdf8a('0x3c')](_0x4e372b[_0xdf8a('0x27')],{'contentType':_0xdf8a('0x3d')});if(_0x15381d[_0xdf8a('0xf')]){logger[_0xdf8a('0x3e')](util['format'](_0xdf8a('0x3f'),_0x4e372b[_0xdf8a('0x3a')]));tnef[_0xdf8a('0x40')](_[_0xdf8a('0x41')](_0x15381d)[_0xdf8a('0x2f')],function(_0x4254e4,_0x3c7ec1){if(_0x3c7ec1){_0x4e372b['html']=_0x3c7ec1[_0xdf8a('0x42')]||_0xdf8a('0x43');if(_0x3c7ec1[_0xdf8a('0x44')]){for(var _0x55e637=0x0;_0x55e637<_0x3c7ec1[_0xdf8a('0x44')][_0xdf8a('0xf')];_0x55e637++){var _0x3166fb=_0x3c7ec1[_0xdf8a('0x44')][_0x55e637];_0x5af6c8[_0xdf8a('0x24')][_0xdf8a('0x27')][_0xdf8a('0x45')]({'filename':_0x3166fb['Title'],'content':Buffer[_0xdf8a('0x38')](_0x3166fb[_0xdf8a('0x46')])});}}}_0x5cd3a3(parseEmail(_0x4967be,_0x4e372b,_0x5af6c8));});}else{_0x4e372b[_0xdf8a('0x17')]=_0xdf8a('0x43');_0x5cd3a3(parseEmail(_0x4967be,_0x4e372b,_0x5af6c8));}}else{_0x5cd3a3(parseEmail(_0x4967be,_0x4e372b,_0x5af6c8));}};exports[_0xdf8a('0x47')]=function(_0x491154){switch(_0x491154){case _0xdf8a('0x48'):return _0xdf8a('0x49');case _0xdf8a('0x4a'):return _0xdf8a('0x4b');case _0xdf8a('0x4c'):return _0xdf8a('0x4d');case _0xdf8a('0x4e'):return _0xdf8a('0x4f');}return'127.0.0.1';}; \ No newline at end of file +var _0xd448=['moment','randomstring','path','util','node-tnef','../../../config/logger','email','../../../config/environment','value','anonymous','generate','@xcally.com','head','address','name','substring','indexOf','split','slice','join','Anonymous','length','pop','html','test','replace','includes','\x20[Attachment:\x20','body','textAsHtml','Empty\x20message

','Attachments','Title','Data','gmail','imap.gmail.com','imap.mail.yahoo.com','hotmail','outlook365','127.0.0.1'];(function(_0x15cbce,_0xda8402){var _0x257f29=function(_0x388132){while(--_0x388132){_0x15cbce['push'](_0x15cbce['shift']());}};_0x257f29(++_0xda8402);}(_0xd448,0x172));var _0x8d44=function(_0x2f57c2,_0x378033){_0x2f57c2=_0x2f57c2-0x0;var _0x5f3548=_0xd448[_0x2f57c2];return _0x5f3548;};'use strict';var _=require('lodash');var moment=require(_0x8d44('0x0'));var random=require(_0x8d44('0x1'));var fs=require('fs');var path=require(_0x8d44('0x2'));var util=require(_0x8d44('0x3'));var tnef=require(_0x8d44('0x4'));var logger=require(_0x8d44('0x5'))(_0x8d44('0x6'));var config=require(_0x8d44('0x7'));function getAddress(_0x1ba788){var _0x6e2640=_['head'](_0x1ba788[_0x8d44('0x8')]);return _0x6e2640&&_0x6e2640['address']?_0x6e2640['address']:_0x8d44('0x9')+random[_0x8d44('0xa')](0x6)+_0x8d44('0xb');}function getFirstName(_0x441fd3){var _0x51e368=_[_0x8d44('0xc')](_0x441fd3[_0x8d44('0x8')]);if(_0x51e368&&_0x51e368['name']){if(_0x51e368['name']==_0x51e368[_0x8d44('0xd')]){return _0x51e368[_0x8d44('0xe')][_0x8d44('0xf')](0x0,_0x51e368['name'][_0x8d44('0x10')]('@'));}var _0x2e2fd3=_0x51e368[_0x8d44('0xe')][_0x8d44('0x11')](/\s+/);return _0x2e2fd3['length']>0x1?_0x2e2fd3[_0x8d44('0x12')](0x0,-0x1)[_0x8d44('0x13')]('\x20'):_0x51e368[_0x8d44('0xe')];}return _0x8d44('0x14');}function getLastName(_0x10e74e){var _0x5b462e=_[_0x8d44('0xc')](_0x10e74e[_0x8d44('0x8')]);if(_0x5b462e&&_0x5b462e[_0x8d44('0xe')]){var _0x87a133=_0x5b462e[_0x8d44('0xe')]['split'](/\s+/);return _0x87a133[_0x8d44('0x15')]>0x1?_0x87a133[_0x8d44('0x16')]():'';}return'';}function getMails(_0x35de0d,_0x604e6){var _0x29244e='';for(var _0x2e7d11=0x0;_0x2e7d11<_0x604e6[_0x8d44('0x8')][_0x8d44('0x15')];_0x2e7d11+=0x1){if(_0x604e6[_0x8d44('0x8')][_0x2e7d11][_0x8d44('0xd')]!==_0x35de0d){if(!_['isEmpty'](_0x29244e)){_0x29244e+=',';}_0x29244e+=_0x604e6[_0x8d44('0x8')][_0x2e7d11][_0x8d44('0xe')]||_0x604e6['value'][_0x2e7d11][_0x8d44('0xd')]||'';_0x29244e+='\x20<';_0x29244e+=_0x604e6[_0x8d44('0x8')][_0x2e7d11][_0x8d44('0xd')]?_0x604e6['value'][_0x2e7d11][_0x8d44('0xd')]:_0x8d44('0x9')+random[_0x8d44('0xa')](0x6)+_0x8d44('0xb');_0x29244e+='>';}}return _0x29244e;}function parseEmail(_0x5f5210,_0x31f991,_0x1ae2ad){if(_0x31f991[_0x8d44('0x17')]){var _0x4e39fe=/)<[^<]*)*<\/script>/gi;while(_0x4e39fe[_0x8d44('0x18')](_0x31f991[_0x8d44('0x17')])){_0x31f991[_0x8d44('0x17')]=_0x31f991[_0x8d44('0x17')][_0x8d44('0x19')](_0x4e39fe,'');}if(_0x31f991['html'][_0x8d44('0x1a')](_0x8d44('0x1b'))){var _0x2b304c=[];_0x31f991['attachments']['forEach'](_0x37dadc=>{_0x2b304c[_0x8d44('0x1c')](_0x37dadc[_0x8d44('0x1d')]);});var _0x22a9a7=/]+>/g;var _0x3187a7=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x288994=_0x31f991[_0x8d44('0x17')]['replace'](_0x3187a7,'_SRC');var _0x7b6262=_0x288994[_0x8d44('0x19')](_0x22a9a7,_0x8d44('0x1e'));for(let _0x232c6b=0x0;_0x232c6b<_0x2b304c[_0x8d44('0x15')];_0x232c6b++){var _0x8995be=_0x7b6262[_0x8d44('0x19')]('_IMG',_0x8d44('0x1f')+_0x2b304c[_0x232c6b]+'\x20]');_0x7b6262=_0x8995be;}_0x31f991['html']=_0x7b6262;}_0x1ae2ad[_0x8d44('0x20')]=_0x31f991[_0x8d44('0x17')];}else{_0x1ae2ad[_0x8d44('0x20')]=_0x31f991[_0x8d44('0x21')];}if(_0x1ae2ad[_0x8d44('0x20')]){_0x1ae2ad[_0x8d44('0x20')]=_0x1ae2ad[_0x8d44('0x20')]['replace'](/0x0){var _0x206f96=['Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply'];for(var _0x2aad31=0x0;_0x2aad31<_0x31f991['headerLines'][_0x8d44('0x15')];_0x2aad31++){var _0x5c61cd=_[_0x8d44('0x10')](_0x206f96,_0x31f991[_0x8d44('0x32')][_0x2aad31][_0x8d44('0x33')]);if(_0x5c61cd>=0x0){_0x1ae2ad[_0x8d44('0x34')]=!![];}}}return _0x1ae2ad;}exports[_0x8d44('0x35')]=function(_0xd2f7d0,_0x5a6a7e,_0x3d4d44){var _0x366d79={'from':getAddress(_0x5a6a7e[_0x8d44('0x36')]),'firstName':getFirstName(_0x5a6a7e[_0x8d44('0x36')]),'lastName':getLastName(_0x5a6a7e[_0x8d44('0x36')]),'mapKey':_0x8d44('0x6'),'message':{'from':getMails(_0xd2f7d0[_0x8d44('0x6')],_0x5a6a7e[_0x8d44('0x36')]),'to':_0xd2f7d0[_0x8d44('0x6')],'cc':'','subject':_0x5a6a7e[_0x8d44('0x37')]||'','messageId':_0x5a6a7e['messageId'],'inReplyTo':_0x5a6a7e[_0x8d44('0x38')],'sentAt':moment(_0x5a6a7e[_0x8d44('0x39')])['format']('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x5a6a7e[_0x8d44('0x17')]&&!_0x5a6a7e[_0x8d44('0x21')]){var _0x37371d=_[_0x8d44('0x3a')](_0x5a6a7e['attachments'],{'contentType':_0x8d44('0x3b')});if(_0x37371d['length']){logger[_0x8d44('0x3c')](util[_0x8d44('0x2c')](_0x8d44('0x3d'),_0x5a6a7e[_0x8d44('0x3e')]));tnef['parseBuffer'](_['first'](_0x37371d)[_0x8d44('0x31')],function(_0x28dac1,_0x7d6d95){if(_0x7d6d95){_0x5a6a7e[_0x8d44('0x17')]=_0x7d6d95[_0x8d44('0x3f')]||_0x8d44('0x40');if(_0x7d6d95[_0x8d44('0x41')]){for(var _0x29b30f=0x0;_0x29b30f<_0x7d6d95['Attachments']['length'];_0x29b30f++){var _0x38cd75=_0x7d6d95[_0x8d44('0x41')][_0x29b30f];_0x366d79[_0x8d44('0x24')]['attachments'][_0x8d44('0x1c')]({'filename':_0x38cd75[_0x8d44('0x42')],'content':Buffer[_0x8d44('0x36')](_0x38cd75[_0x8d44('0x43')])});}}}_0x3d4d44(parseEmail(_0xd2f7d0,_0x5a6a7e,_0x366d79));});}else{_0x5a6a7e[_0x8d44('0x17')]=_0x8d44('0x40');_0x3d4d44(parseEmail(_0xd2f7d0,_0x5a6a7e,_0x366d79));}}else{_0x3d4d44(parseEmail(_0xd2f7d0,_0x5a6a7e,_0x366d79));}};exports['getHost']=function(_0x5576cd){switch(_0x5576cd){case _0x8d44('0x44'):return _0x8d44('0x45');case'yahoo':return _0x8d44('0x46');case _0x8d44('0x47'):return'imap-mail.outlook.com';case _0x8d44('0x48'):return'outlook.office365.com';}return _0x8d44('0x49');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index d2a783e..1043964 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 _0xd773=['exports','name','Service','SERV','active','Imap','Smtp'];(function(_0x12546c,_0x4678e2){var _0x49815b=function(_0x5c1493){while(--_0x5c1493){_0x12546c['push'](_0x12546c['shift']());}};_0x49815b(++_0x4678e2);}(_0xd773,0x112));var _0x3d77=function(_0x5424fb,_0x9963b7){_0x5424fb=_0x5424fb-0x0;var _0x17ae59=_0xd773[_0x5424fb];return _0x17ae59;};'use strict';var _=require('lodash');function MailAccount(_0x736671){this['id']=_0x736671['id']||0x0;this[_0x3d77('0x0')]=_0x736671[_0x3d77('0x0')]||_0x3d77('0x1');this['key']=_0x736671['key']||_0x3d77('0x2');this[_0x3d77('0x3')]=_0x736671[_0x3d77('0x3')]||![];this[_0x3d77('0x4')]=_0x736671['Imap']||[];this[_0x3d77('0x5')]=_0x736671[_0x3d77('0x5')]||[];}module[_0x3d77('0x6')]=MailAccount; \ No newline at end of file +var _0x0bda=['exports','lodash','name','SERV','active','Smtp'];(function(_0x1210b1,_0x221d40){var _0xf8d892=function(_0x38d7ea){while(--_0x38d7ea){_0x1210b1['push'](_0x1210b1['shift']());}};_0xf8d892(++_0x221d40);}(_0x0bda,0x17b));var _0xa0bd=function(_0x16377e,_0x53902c){_0x16377e=_0x16377e-0x0;var _0x46203d=_0x0bda[_0x16377e];return _0x46203d;};'use strict';var _=require(_0xa0bd('0x0'));function MailAccount(_0x58fe19){this['id']=_0x58fe19['id']||0x0;this['name']=_0x58fe19[_0xa0bd('0x1')]||'Service';this['key']=_0x58fe19['key']||_0xa0bd('0x2');this['active']=_0x58fe19[_0xa0bd('0x3')]||![];this['Imap']=_0x58fe19['Imap']||[];this[_0xa0bd('0x4')]=_0x58fe19['Smtp']||[];}module[_0xa0bd('0x5')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 6e13078..51669af 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 _0xdd11=['mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','merge','../model/mailAccount','mailAccounts'];(function(_0x437ee0,_0x147459){var _0x54c62c=function(_0x46bd9d){while(--_0x46bd9d){_0x437ee0['push'](_0x437ee0['shift']());}};_0x54c62c(++_0x147459);}(_0xdd11,0x96));var _0x1dd1=function(_0x2324d9,_0x28d702){_0x2324d9=_0x2324d9-0x0;var _0x4365e0=_0xdd11[_0x2324d9];return _0x4365e0;};'use strict';var _=require('lodash');var MailAccount=require(_0x1dd1('0x0'));var Realtime=function(){this[_0x1dd1('0x1')]={};};function freeIsNotKey(_0x1e552e,_0x29bc76,_0x45d9a2){var _0x2ea346=_[_0x1dd1('0x2')](_0x1e552e,function(_0x29fefb,_0x488fac){return _0x29fefb[_0x45d9a2];});for(var _0x4725f2 in _0x29bc76){if(_0x29bc76[_0x1dd1('0x3')](_0x4725f2)){if(!_0x2ea346[_0x4725f2]){delete _0x29bc76[_0x4725f2];}}}}Realtime[_0x1dd1('0x4')][_0x1dd1('0x5')]=function(_0x2be0ef,_0x468f7a){for(var _0xd8266d in _0x468f7a){if(_0x2be0ef['hasOwnProperty'](_0xd8266d)){_0x2be0ef[_0xd8266d]=_0x468f7a[_0xd8266d];}}};Realtime['prototype'][_0x1dd1('0x6')]=function(){var _0x3ac84b=this;return function(_0x42ce5e){if(_0x42ce5e){freeIsNotKey(_0x42ce5e,_0x3ac84b[_0x1dd1('0x1')],'id');for(var _0x12a5ca=0x0,_0x16e0f7={},_0x4f79a7={};_0x12a5ca<_0x42ce5e['length'];_0x12a5ca+=0x1){_0x16e0f7=_0x42ce5e[_0x12a5ca];if(_['isUndefined'](_0x3ac84b[_0x1dd1('0x1')][_0x16e0f7['id']])){_0x3ac84b['mailAccounts'][_0x16e0f7['id']]=new MailAccount(_0x16e0f7);}else{_[_0x1dd1('0x7')](_0x3ac84b[_0x1dd1('0x1')][_0x16e0f7['id']],_0x16e0f7);}}}return _0x3ac84b['mailAccounts'];};};module['exports']=Realtime; \ No newline at end of file +var _0xb53d=['mailAccounts','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','isUndefined','exports','lodash','../model/mailAccount'];(function(_0xcfeff4,_0x3f2e19){var _0xb2fadc=function(_0x4cd013){while(--_0x4cd013){_0xcfeff4['push'](_0xcfeff4['shift']());}};_0xb2fadc(++_0x3f2e19);}(_0xb53d,0xd0));var _0xdb53=function(_0x230d96,_0x2e176b){_0x230d96=_0x230d96-0x0;var _0x55c6be=_0xb53d[_0x230d96];return _0x55c6be;};'use strict';var _=require(_0xdb53('0x0'));var MailAccount=require(_0xdb53('0x1'));var Realtime=function(){this[_0xdb53('0x2')]={};};function freeIsNotKey(_0xd9bd4c,_0x1f99af,_0x170b2b){var _0x55f028=_[_0xdb53('0x3')](_0xd9bd4c,function(_0x3fed53,_0x112236){return _0x3fed53[_0x170b2b];});for(var _0x56ae67 in _0x1f99af){if(_0x1f99af[_0xdb53('0x4')](_0x56ae67)){if(!_0x55f028[_0x56ae67]){delete _0x1f99af[_0x56ae67];}}}}Realtime[_0xdb53('0x5')][_0xdb53('0x6')]=function(_0x4c08c4,_0x192680){for(var _0x279a0b in _0x192680){if(_0x4c08c4[_0xdb53('0x4')](_0x279a0b)){_0x4c08c4[_0x279a0b]=_0x192680[_0x279a0b];}}};Realtime[_0xdb53('0x5')][_0xdb53('0x7')]=function(){var _0x22e249=this;return function(_0x30b3be){if(_0x30b3be){freeIsNotKey(_0x30b3be,_0x22e249[_0xdb53('0x2')],'id');for(var _0x218470=0x0,_0x3b21aa={},_0x1f0e6f={};_0x218470<_0x30b3be['length'];_0x218470+=0x1){_0x3b21aa=_0x30b3be[_0x218470];if(_[_0xdb53('0x8')](_0x22e249[_0xdb53('0x2')][_0x3b21aa['id']])){_0x22e249[_0xdb53('0x2')][_0x3b21aa['id']]=new MailAccount(_0x3b21aa);}else{_['merge'](_0x22e249[_0xdb53('0x2')][_0x3b21aa['id']],_0x3b21aa);}}}return _0x22e249[_0xdb53('0x2')];};};module[_0xdb53('0x9')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index ee4da64..48e28e8 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 _0x42ec=['Request','GetMailAccount','name','email','key','ListId','TemplateId','MailServerIn','MailServerOut','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts'];(function(_0x328993,_0x3fec69){var _0x1fa11e=function(_0x443ef2){while(--_0x443ef2){_0x328993['push'](_0x328993['shift']());}};_0x1fa11e(++_0x3fec69);}(_0x42ec,0x1e8));var _0xc42e=function(_0x34fa88,_0xd2b8bc){_0x34fa88=_0x34fa88-0x0;var _0x28b15f=_0x42ec[_0x34fa88];return _0x28b15f;};'use strict';var client=require(_0xc42e('0x0'));exports[_0xc42e('0x1')]=function(){return function(){return client[_0xc42e('0x2')](_0xc42e('0x3'),{'options':{'attributes':['id',_0xc42e('0x4'),'service',_0xc42e('0x5'),'active',_0xc42e('0x6'),_0xc42e('0x7'),_0xc42e('0x8')],'raw':![],'include':[{'model':_0xc42e('0x9'),'as':'Imap'},{'model':_0xc42e('0xa'),'as':'Smtp'}]},'log':_0xc42e('0xb')});};};exports[_0xc42e('0xc')]=function(_0x526754,_0x3698e7){return client[_0xc42e('0x2')](_0xc42e('0xd'),{'account':{'id':_0x526754},'body':_0x3698e7,'log':_0xc42e('0xd')});}; \ No newline at end of file +var _0x6515=['Imap','Smtp','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','name','service','email','active','key','ListId','TemplateId','MailServerIn'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6515,0x1e5));var _0x5651=function(_0x197f3a,_0x4b5777){_0x197f3a=_0x197f3a-0x0;var _0x5091e7=_0x6515[_0x197f3a];return _0x5091e7;};'use strict';var client=require(_0x5651('0x0'));exports[_0x5651('0x1')]=function(){return function(){return client[_0x5651('0x2')]('GetMailAccount',{'options':{'attributes':['id',_0x5651('0x3'),_0x5651('0x4'),_0x5651('0x5'),_0x5651('0x6'),_0x5651('0x7'),_0x5651('0x8'),_0x5651('0x9')],'raw':![],'include':[{'model':_0x5651('0xa'),'as':_0x5651('0xb')},{'model':'MailServerOut','as':_0x5651('0xc')}]},'log':_0x5651('0xd')});};};exports[_0x5651('0xe')]=function(_0x3645d3,_0x1dc334){return client[_0x5651('0x2')](_0x5651('0xf'),{'account':{'id':_0x3645d3},'body':_0x1dc334,'log':_0x5651('0xf')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 757083f..fb5334e 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 _0xa435=['getSettings','ShowSetting','loginMailFrequency','GetSettings'];(function(_0x260741,_0x462e5d){var _0x31b0eb=function(_0x543a3){while(--_0x543a3){_0x260741['push'](_0x260741['shift']());}};_0x31b0eb(++_0x462e5d);}(_0xa435,0x1e4));var _0x5a43=function(_0x382857,_0x225a21){_0x382857=_0x382857-0x0;var _0x4384c7=_0xa435[_0x382857];return _0x4384c7;};'use strict';var client=require('../client');exports[_0x5a43('0x0')]=function(){return client['Request'](_0x5a43('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x5a43('0x2')]},'log':_0x5a43('0x3')});}; \ No newline at end of file +var _0xbaec=['../client','getSettings','Request','ShowSetting','loginMailFrequency','GetSettings'];(function(_0x214002,_0x19999d){var _0x15ab0b=function(_0x258ba6){while(--_0x258ba6){_0x214002['push'](_0x214002['shift']());}};_0x15ab0b(++_0x19999d);}(_0xbaec,0x1c2));var _0xcbae=function(_0x383552,_0x5db2de){_0x383552=_0x383552-0x0;var _0x338ff7=_0xbaec[_0x383552];return _0x338ff7;};'use strict';var client=require(_0xcbae('0x0'));exports[_0xcbae('0x1')]=function(){return client[_0xcbae('0x2')](_0xcbae('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xcbae('0x4')]},'log':_0xcbae('0x5')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index ceb9261..b88e0b8 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'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 2951efd..d884ea8 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 _0x7def=['polling','defaults','redis','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','listening','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','../../config/environment','timeout','listen','port','socket.io'];(function(_0x2978e1,_0x26b3f5){var _0xca0ea8=function(_0x289c2e){while(--_0x289c2e){_0x2978e1['push'](_0x2978e1['shift']());}};_0xca0ea8(++_0x26b3f5);}(_0x7def,0x14d));var _0xf7de=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x7def[_0x1d9aa0];return _0x226868;};'use strict';var _=require(_0xf7de('0x0'));var http=require(_0xf7de('0x1'));var express=require('express');var sticky=require('sticky-session');var Redis=require('ioredis');var config=require(_0xf7de('0x2'));var app=express();var server=http['createServer'](app);server[_0xf7de('0x3')]=0xdbba0;if(sticky[_0xf7de('0x4')](server,config[_0xf7de('0x5')])){var socketio=require(_0xf7de('0x6'))(server,{'transports':['websocket',_0xf7de('0x7')]});config['redis']=_[_0xf7de('0x8')](config[_0xf7de('0x9')],{'host':'localhost','port':0x18eb});socketio[_0xf7de('0xa')](require(_0xf7de('0xb'))({'pubClient':new Redis(config[_0xf7de('0x9')]),'subClient':new Redis(config[_0xf7de('0x9')])}));require(_0xf7de('0xc'))[_0xf7de('0xd')]();require(_0xf7de('0xe'))['default'](socketio);require(_0xf7de('0xf'))['default'](app);require(_0xf7de('0x10'))['default'](app);}else{server['once'](_0xf7de('0x11'),function(){console['log'](_0xf7de('0x12'),config[_0xf7de('0x5')]);});}exports=module[_0xf7de('0x13')]=app; \ No newline at end of file +var _0x7000=['listen','port','socket.io','websocket','polling','redis','defaults','localhost','socket.io-redis','../../config/triggers','../../config/socketio','default','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','sticky-session'];(function(_0x4030a4,_0x1b1d1b){var _0x8a7e86=function(_0xa4b10b){while(--_0xa4b10b){_0x4030a4['push'](_0x4030a4['shift']());}};_0x8a7e86(++_0x1b1d1b);}(_0x7000,0x162));var _0x0700=function(_0x32e779,_0x1c2596){_0x32e779=_0x32e779-0x0;var _0x47d7b3=_0x7000[_0x32e779];return _0x47d7b3;};'use strict';var _=require(_0x0700('0x0'));var http=require(_0x0700('0x1'));var express=require('express');var sticky=require(_0x0700('0x2'));var Redis=require('ioredis');var config=require('../../config/environment');var app=express();var server=http['createServer'](app);server['timeout']=0xdbba0;if(sticky[_0x0700('0x3')](server,config[_0x0700('0x4')])){var socketio=require(_0x0700('0x5'))(server,{'transports':[_0x0700('0x6'),_0x0700('0x7')]});config[_0x0700('0x8')]=_[_0x0700('0x9')](config[_0x0700('0x8')],{'host':_0x0700('0xa'),'port':0x18eb});socketio['adapter'](require(_0x0700('0xb'))({'pubClient':new Redis(config[_0x0700('0x8')]),'subClient':new Redis(config[_0x0700('0x8')])}));require(_0x0700('0xc'))['default']();require(_0x0700('0xd'))[_0x0700('0xe')](socketio);require('../../config/express')[_0x0700('0xe')](app);require(_0x0700('0xf'))[_0x0700('0xe')](app);}else{server[_0x0700('0x10')](_0x0700('0x11'),function(){console[_0x0700('0x12')](_0x0700('0x13'),config[_0x0700('0x4')]);});}exports=module[_0x0700('0x14')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index f0579f0..ecfbe24 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 _0xa426=['client','http','then','debug','rpc','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xa426,0x176));var _0x6a42=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xa426[_0x11005e];return _0x29338f;};'use strict';var jayson=require(_0x6a42('0x0'));var BPromise=require(_0x6a42('0x1'));var logger=require(_0x6a42('0x2'))(_0x6a42('0x3'));var client=jayson[_0x6a42('0x4')][_0x6a42('0x5')]({'port':0x2329});client['Request']=function(_0x1be1d3,_0xb13736){return new BPromise(function(_0xa58ca0,_0x3a8e3d){return client['request'](_0x1be1d3,_0xb13736)[_0x6a42('0x6')](function(_0x1b814c){logger[_0x6a42('0x7')](_0x6a42('0x8'),_0x6a42('0x3'),_0x1be1d3,_0xb13736,_0x1b814c);if(_0x1b814c[_0x6a42('0x9')]){logger[_0x6a42('0x9')](_0x6a42('0x8'),_0x6a42('0x3'),_0x1be1d3,_0x1b814c['error']['message'],_0xb13736);return _0x3a8e3d(_0x1b814c['error'][_0x6a42('0xa')]);}else{return _0xa58ca0(_0x1b814c[_0x6a42('0xb')]);}})[_0x6a42('0xc')](function(_0x6c6726){logger[_0x6a42('0x9')]('rpc',_0x6a42('0x3'),_0x1be1d3,_0x6c6726,_0xb13736);return _0x3a8e3d(_0x6c6726);});});};module[_0x6a42('0xd')]=client; \ No newline at end of file +var _0x811c=['client','http','then','debug','error','rpc','routing','result','catch','jayson/promise','bluebird','../../config/logger'];(function(_0x4370cc,_0x2b9475){var _0x345c6b=function(_0x37ec1e){while(--_0x37ec1e){_0x4370cc['push'](_0x4370cc['shift']());}};_0x345c6b(++_0x2b9475);}(_0x811c,0x99));var _0xc811=function(_0x4ba266,_0x5703db){_0x4ba266=_0x4ba266-0x0;var _0xc7fa8=_0x811c[_0x4ba266];return _0xc7fa8;};'use strict';var jayson=require(_0xc811('0x0'));var BPromise=require(_0xc811('0x1'));var logger=require(_0xc811('0x2'))('routing');var client=jayson[_0xc811('0x3')][_0xc811('0x4')]({'port':0x2329});client['Request']=function(_0x503625,_0x3f9e34){return new BPromise(function(_0x4154f8,_0x12206f){return client['request'](_0x503625,_0x3f9e34)[_0xc811('0x5')](function(_0x4e07b4){logger[_0xc811('0x6')]('rpc','routing',_0x503625,_0x3f9e34,_0x4e07b4);if(_0x4e07b4[_0xc811('0x7')]){logger[_0xc811('0x7')](_0xc811('0x8'),_0xc811('0x9'),_0x503625,_0x4e07b4[_0xc811('0x7')]['message'],_0x3f9e34);return _0x12206f(_0x4e07b4[_0xc811('0x7')]['message']);}else{return _0x4154f8(_0x4e07b4[_0xc811('0xa')]);}})[_0xc811('0xb')](function(_0x36fcd1){logger[_0xc811('0x7')](_0xc811('0x8'),_0xc811('0x9'),_0x503625,_0x36fcd1,_0x3f9e34);return _0x12206f(_0x36fcd1);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 4d2f79b..1724a08 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 _0xcb1f=['./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','initFaxQueues','initWhatsappQueues','listen','catch','bluebird','./realtime','./rpc/user'];(function(_0x4ea55b,_0x4e69a2){var _0x43bfef=function(_0x52d69e){while(--_0x52d69e){_0x4ea55b['push'](_0x4ea55b['shift']());}};_0x43bfef(++_0x4e69a2);}(_0xcb1f,0x93));var _0xfcb1=function(_0x23d8f6,_0x32022){_0x23d8f6=_0x23d8f6-0x0;var _0x1125d2=_0xcb1f[_0x23d8f6];return _0x1125d2;};'use strict';var BPromise=require(_0xfcb1('0x0'));var server=require('./server');var Realtime=require(_0xfcb1('0x1'));var user=require(_0xfcb1('0x2'));var interval=require(_0xfcb1('0x3'));var openchannelQueue=require(_0xfcb1('0x4'));var chatQueue=require(_0xfcb1('0x5'));var smsQueue=require(_0xfcb1('0x6'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0xfcb1('0x7'));var whatsappQueue=require(_0xfcb1('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xfcb1('0x9')]()[_0xfcb1('0xa')](user[_0xfcb1('0xb')]())[_0xfcb1('0xa')](realtime['initAgents']())[_0xfcb1('0xa')](interval[_0xfcb1('0xc')]())['then'](realtime[_0xfcb1('0xd')]())[_0xfcb1('0xa')](openchannelQueue[_0xfcb1('0xe')]())['then'](realtime[_0xfcb1('0xf')]())['then'](chatQueue['getChatQueues']())['then'](realtime[_0xfcb1('0x10')]())[_0xfcb1('0xa')](smsQueue[_0xfcb1('0x11')]())[_0xfcb1('0xa')](realtime[_0xfcb1('0x12')]())[_0xfcb1('0xa')](mailQueue[_0xfcb1('0x13')]())['then'](realtime[_0xfcb1('0x14')]())[_0xfcb1('0xa')](faxQueue['getFaxQueues']())[_0xfcb1('0xa')](realtime[_0xfcb1('0x15')]())[_0xfcb1('0xa')](whatsappQueue['getWhatsappQueues']())[_0xfcb1('0xa')](realtime[_0xfcb1('0x16')]())['then'](function(){return realtime;});}function main(){return server[_0xfcb1('0x17')](realtime)['then'](function(_0x4bfe0e){return initRealtime();})[_0xfcb1('0xa')](function(_0x3cf676){return setInterval(initRealtime,0x1388);})[_0xfcb1('0x18')](function(_0xe05c9){console['log'](_0xe05c9);});}main(); \ No newline at end of file +var _0x1d5b=['./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/faxQueue','getAgents','then','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','getSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','catch','log','bluebird','./rpc/user'];(function(_0x3af480,_0x455eff){var _0x3f317a=function(_0x9446d1){while(--_0x9446d1){_0x3af480['push'](_0x3af480['shift']());}};_0x3f317a(++_0x455eff);}(_0x1d5b,0x1de));var _0xb1d5=function(_0x495386,_0x1374ff){_0x495386=_0x495386-0x0;var _0x119e36=_0x1d5b[_0x495386];return _0x119e36;};'use strict';var BPromise=require(_0xb1d5('0x0'));var server=require('./server');var Realtime=require('./realtime');var user=require(_0xb1d5('0x1'));var interval=require('./rpc/interval');var openchannelQueue=require(_0xb1d5('0x2'));var chatQueue=require(_0xb1d5('0x3'));var smsQueue=require(_0xb1d5('0x4'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0xb1d5('0x5'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()['then'](user[_0xb1d5('0x6')]())[_0xb1d5('0x7')](realtime['initAgents']())[_0xb1d5('0x7')](interval[_0xb1d5('0x8')]())[_0xb1d5('0x7')](realtime[_0xb1d5('0x9')]())[_0xb1d5('0x7')](openchannelQueue[_0xb1d5('0xa')]())[_0xb1d5('0x7')](realtime[_0xb1d5('0xb')]())[_0xb1d5('0x7')](chatQueue[_0xb1d5('0xc')]())[_0xb1d5('0x7')](realtime['initChatQueues']())[_0xb1d5('0x7')](smsQueue[_0xb1d5('0xd')]())[_0xb1d5('0x7')](realtime['initSmsQueues']())['then'](mailQueue[_0xb1d5('0xe')]())['then'](realtime[_0xb1d5('0xf')]())[_0xb1d5('0x7')](faxQueue[_0xb1d5('0x10')]())[_0xb1d5('0x7')](realtime[_0xb1d5('0x11')]())[_0xb1d5('0x7')](whatsappQueue['getWhatsappQueues']())[_0xb1d5('0x7')](realtime['initWhatsappQueues']())[_0xb1d5('0x7')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0xb1d5('0x7')](function(_0x2e36a8){return initRealtime();})[_0xb1d5('0x7')](function(_0x9bfba1){return setInterval(initRealtime,0x1388);})[_0xb1d5('0x12')](function(_0x3ac9da){console[_0xb1d5('0x13')](_0x3ac9da);});}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 c000b05..e574cf5 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['lodash','util','EventEmitter','init','isNil','ignoreFactChanges','inherits','activeRules','prototype','register','isArray','rules','isObject','sync','orderBy','asc','execute','clone','ruleRef','name','index_','push','call','nextTick','next','isEqual','restart','length','condition','matchPath','noop','findRules','filter','prioritize','priority','toJSON','map','consequence','toString','fromJSON','isString','parse'];(function(_0x4d9442,_0x1e784a){var _0x5b0d83=function(_0x42a07e){while(--_0x42a07e){_0x4d9442['push'](_0x4d9442['shift']());}};_0x5b0d83(++_0x1e784a);}(_0x5fc3,0xa8));var _0x35fc=function(_0x211bc3,_0x5860c8){_0x211bc3=_0x211bc3-0x0;var _0x34c9a2=_0x5fc3[_0x211bc3];return _0x34c9a2;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var EventEmitter=require('events')[_0x35fc('0x2')];function RuleEngine(_0x2ac6da,_0x196bc2){this[_0x35fc('0x3')]();if(!_[_0x35fc('0x4')](_0x2ac6da)){this['register'](_0x2ac6da);}if(_0x196bc2){this[_0x35fc('0x5')]=_0x196bc2[_0x35fc('0x5')];}return this;}util[_0x35fc('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x19a0d1){this['rules']=[];this[_0x35fc('0x7')]=[];};RuleEngine[_0x35fc('0x8')][_0x35fc('0x9')]=function(_0x1e5f90){if(Array[_0x35fc('0xa')](_0x1e5f90)){this[_0x35fc('0xb')]=this[_0x35fc('0xb')]['concat'](_0x1e5f90);}else if(_0x1e5f90!==null&&_[_0x35fc('0xc')](_0x1e5f90)){this[_0x35fc('0xb')]['push'](_0x1e5f90);}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')]['sync']=function(){this[_0x35fc('0x7')]=this[_0x35fc('0xb')]['filter'](function(_0x4cbe74){if(_[_0x35fc('0x4')](_0x4cbe74['on'])){_0x4cbe74['on']=!![];}if(_0x4cbe74['on']===!![]){return _0x4cbe74;}});this['activeRules']=_[_0x35fc('0xe')](this[_0x35fc('0x7')],['p'],[_0x35fc('0xf')]);};RuleEngine[_0x35fc('0x8')][_0x35fc('0x10')]=function(_0x5cfe94,_0x59507a){var _0x5eac0f=![];_0x5cfe94['result']=!![];var _0x398b67=_[_0x35fc('0x11')](_0x5cfe94);var _0x53b898=_[_0x35fc('0x11')](_0x5cfe94);var _0x227a49=this[_0x35fc('0x7')];var _0x480851=[];var _0x26ba54=this[_0x35fc('0x5')];(function FnRuleLoop(_0x553677){var _0x41e165={'rules':function(){return _0x227a49;},'rule':function(){return _0x227a49[_0x553677];},'when':function(_0x363e47){if(_0x363e47){var _0x2e513b=_0x227a49[_0x553677]['consequence'];_0x2e513b[_0x35fc('0x12')]=_0x227a49[_0x553677]['id']||_0x227a49[_0x553677][_0x35fc('0x13')]||_0x35fc('0x14')+_0x553677;process['nextTick'](function(){_0x480851[_0x35fc('0x15')](_0x2e513b[_0x35fc('0x12')]);_0x2e513b[_0x35fc('0x16')](_0x398b67,_0x41e165);});}else{process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x5eac0f=!![];return FnRuleLoop(0x0);},'next':function(_0x21f1a9){if(!_0x26ba54&&!_[_0x35fc('0x19')](_0x53b898,_0x398b67)){_0x53b898=_[_0x35fc('0x11')](_0x398b67);process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x1a')]();});}else{process['nextTick'](function(){if(_[_0x35fc('0x4')](_0x21f1a9)){return FnRuleLoop(_0x553677+0x1);}else{return FnRuleLoop(_0x21f1a9);}});}}};if(_0x553677<_0x227a49[_0x35fc('0x1b')]&&_0x5eac0f===![]){var _0x257719=_0x227a49[_0x553677][_0x35fc('0x1c')];_0x257719[_0x35fc('0x16')](_0x398b67,_0x41e165);}else{process['nextTick'](function(){_0x398b67[_0x35fc('0x1d')]=_0x480851;return _0x59507a?_0x59507a(_0x398b67):_[_0x35fc('0x1e')]();});}}(0x0));};RuleEngine['prototype'][_0x35fc('0x1f')]=function(_0x5a93df){if(_[_0x35fc('0x4')](_0x5a93df)){return this['rules'];}else{var _0x4086e9=_['matches'](_0x5a93df);return _[_0x35fc('0x20')](this[_0x35fc('0xb')],_0x4086e9);}};RuleEngine['prototype']['turn']=function(_0x47774c,_0x58edb6){var _0x274208=_0x47774c==='on'||_0x47774c==='ON'?!![]:![];var _0x1a5d92=this['findRules'](_0x58edb6);for(var _0x26b7cb=0x0,_0x645eac=_0x1a5d92[_0x35fc('0x1b')];_0x26b7cb<_0x645eac;_0x26b7cb+=0x1){_0x1a5d92[_0x26b7cb]['on']=_0x274208;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x21')]=function(_0x11ccdb,_0x451f0c){_0x11ccdb=parseInt(_0x11ccdb,0xa);var _0x54aedc=this[_0x35fc('0x1f')](_0x451f0c);for(var _0x220931=0x0,_0x22af18=_0x54aedc['length'];_0x220931<_0x22af18;_0x220931+=0x1){_0x54aedc[_0x220931][_0x35fc('0x22')]=_0x11ccdb;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x23')]=function(){var _0xd8a4ca=this[_0x35fc('0xb')];if(_0xd8a4ca instanceof Array){_0xd8a4ca=_0xd8a4ca[_0x35fc('0x24')](function(_0x37b435){_0x37b435[_0x35fc('0x1c')]=_0x37b435[_0x35fc('0x1c')]['toString']();_0x37b435['consequence']=_0x37b435[_0x35fc('0x25')]['toString']();return _0x37b435;});}else if(!_[_0x35fc('0x4')](_0xd8a4ca)){_0xd8a4ca[_0x35fc('0x1c')]=_0xd8a4ca[_0x35fc('0x1c')][_0x35fc('0x26')]();_0xd8a4ca[_0x35fc('0x25')]=_0xd8a4ca[_0x35fc('0x25')]['toString']();}return _0xd8a4ca;};RuleEngine[_0x35fc('0x8')][_0x35fc('0x27')]=function(_0x46b9ef){this[_0x35fc('0x3')]();if(_[_0x35fc('0x28')](_0x46b9ef)){_0x46b9ef=JSON[_0x35fc('0x29')](_0x46b9ef);}if(_0x46b9ef instanceof Array){_0x46b9ef=_0x46b9ef['map'](function(_0x2483be){_0x2483be[_0x35fc('0x1c')]=eval('('+_0x2483be[_0x35fc('0x1c')]+')');_0x2483be['consequence']=eval('('+_0x2483be[_0x35fc('0x25')]+')');return _0x2483be;});}else if(_0x46b9ef!==null&&typeof _0x46b9ef=='object'){_0x46b9ef[_0x35fc('0x1c')]=eval('('+_0x46b9ef[_0x35fc('0x1c')]+')');_0x46b9ef[_0x35fc('0x25')]=eval('('+_0x46b9ef[_0x35fc('0x25')]+')');}this['register'](_0x46b9ef);};module['exports']=RuleEngine; \ No newline at end of file +var _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(_0x40d719,_0x4ed66c){var _0x29812b=function(_0x1d912a){while(--_0x1d912a){_0x40d719['push'](_0x40d719['shift']());}};_0x29812b(++_0x4ed66c);}(_0x326f,0xd1));var _0xf326=function(_0xde5d65,_0x1bc871){_0xde5d65=_0xde5d65-0x0;var _0x144857=_0x326f[_0xde5d65];return _0x144857;};'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 diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 2cf7a26..927ebf3 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 _0xf35b=['jayson/promise','client','http','request','then','error','message','result','catch','SendMail','bluebird'];(function(_0x4b765b,_0x575c18){var _0x5c886a=function(_0x4eae8a){while(--_0x4eae8a){_0x4b765b['push'](_0x4b765b['shift']());}};_0x5c886a(++_0x575c18);}(_0xf35b,0x112));var _0xbf35=function(_0x7ee55c,_0x4ee622){_0x7ee55c=_0x7ee55c-0x0;var _0x1cf8b1=_0xf35b[_0x7ee55c];return _0x1cf8b1;};'use strict';var BPromise=require(_0xbf35('0x0'));var jayson=require(_0xbf35('0x1'));var client=jayson[_0xbf35('0x2')][_0xbf35('0x3')]({'port':0x232b});function request(_0x4d8e55,_0x56a4c8){return new BPromise(function(_0x1a33dd,_0x13a43b){return client[_0xbf35('0x4')](_0x4d8e55,_0x56a4c8)[_0xbf35('0x5')](function(_0x24c274){if(_0x24c274[_0xbf35('0x6')]){return _0x13a43b(_0x24c274[_0xbf35('0x6')][_0xbf35('0x7')]);}else{return _0x1a33dd(_0x24c274[_0xbf35('0x8')]);}})[_0xbf35('0x9')](function(_0x559041){return _0x13a43b(_0x559041);});});}exports['sendMailMessage']=function(_0xbf5715,_0x2017e5){return request(_0xbf35('0xa'),{'account':_0xbf5715,'message':_0x2017e5});}; \ No newline at end of file +var _0xbd37=['bluebird','jayson/promise','client','http','request','error','message','result','catch','SendMail'];(function(_0x1de166,_0x66d6ea){var _0x571b02=function(_0x5c3400){while(--_0x5c3400){_0x1de166['push'](_0x1de166['shift']());}};_0x571b02(++_0x66d6ea);}(_0xbd37,0xa0));var _0x7bd3=function(_0x4c78ee,_0x1202fa){_0x4c78ee=_0x4c78ee-0x0;var _0x1124b8=_0xbd37[_0x4c78ee];return _0x1124b8;};'use strict';var BPromise=require(_0x7bd3('0x0'));var jayson=require(_0x7bd3('0x1'));var client=jayson[_0x7bd3('0x2')][_0x7bd3('0x3')]({'port':0x232b});function request(_0xd25486,_0x2fcd3b){return new BPromise(function(_0x3194c9,_0x736bee){return client[_0x7bd3('0x4')](_0xd25486,_0x2fcd3b)['then'](function(_0x3dc7ef){if(_0x3dc7ef[_0x7bd3('0x5')]){return _0x736bee(_0x3dc7ef[_0x7bd3('0x5')][_0x7bd3('0x6')]);}else{return _0x3194c9(_0x3dc7ef[_0x7bd3('0x7')]);}})[_0x7bd3('0x8')](function(_0x530386){return _0x736bee(_0x530386);});});}exports['sendMailMessage']=function(_0x502f65,_0x27e258){return request(_0x7bd3('0x9'),{'account':_0x502f65,'message':_0x27e258});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 48ef68b..a2b62e2 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 _0xceb5=['sms','whatsapp','length','Status','StatusTime','format','faxCapacity','user:save','exports','lodash','moment','ioredis','redis','defaults','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','md5','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','mail','chat','openchannel','fax'];(function(_0x17442b,_0x228032){var _0x5cfdba=function(_0x483be4){while(--_0x483be4){_0x17442b['push'](_0x17442b['shift']());}};_0x5cfdba(++_0x228032);}(_0xceb5,0x81));var _0x5ceb=function(_0x450689,_0x3b857c){_0x450689=_0x450689-0x0;var _0x46ffb0=_0xceb5[_0x450689];return _0x46ffb0;};'use strict';var _=require(_0x5ceb('0x0'));var moment=require(_0x5ceb('0x1'));var md5=require('md5');var Redis=require(_0x5ceb('0x2'));var config=require('../../../config/environment');config[_0x5ceb('0x3')]=_[_0x5ceb('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x5ceb('0x5'))(new Redis(config['redis']));function Agent(_0x5890a3){this['id']=_0x5890a3['id']||0x0;this[_0x5ceb('0x6')]=_0x5890a3['name']||'';this[_0x5ceb('0x7')]=_0x5890a3[_0x5ceb('0x7')]||!![];this[_0x5ceb('0x8')]=_0x5890a3[_0x5ceb('0x8')]||![];this[_0x5ceb('0x9')]=_0x5890a3['chatPause']||![];this[_0x5ceb('0xa')]=_0x5890a3[_0x5ceb('0xa')]||![];this[_0x5ceb('0xb')]=_0x5890a3['faxPause']||![];this['smsPause']=_0x5890a3[_0x5ceb('0xc')]||![];this[_0x5ceb('0xd')]=_0x5890a3['openchannelPause']||![];this[_0x5ceb('0xe')]=_0x5ceb('0xf');this[_0x5ceb('0x10')]=0x0;this[_0x5ceb('0x11')]=_0x5890a3[_0x5ceb('0x11')]||0x0;this[_0x5ceb('0x12')]=0x0;this[_0x5ceb('0x13')]=_0x5ceb('0xf');this[_0x5ceb('0x14')]=0x0;this[_0x5ceb('0x15')]=_0x5890a3[_0x5ceb('0x15')]||0x0;this[_0x5ceb('0x16')]=0x0;this[_0x5ceb('0x17')]=_0x5ceb('0xf');this[_0x5ceb('0x18')]=0x0;this['faxCapacity']=_0x5890a3['faxCapacity']||0x0;this['faxCurrentCapacity']=0x0;this[_0x5ceb('0x19')]='unknown';this[_0x5ceb('0x1a')]=0x0;this[_0x5ceb('0x1b')]=_0x5890a3['smsCapacity']||0x0;this[_0x5ceb('0x1c')]=0x0;this[_0x5ceb('0x1d')]=_0x5ceb('0xf');this['whatsappStatusTime']=0x0;this[_0x5ceb('0x1e')]=_0x5890a3[_0x5ceb('0x1e')]||0x0;this[_0x5ceb('0x1f')]=0x0;this[_0x5ceb('0x20')]=_0x5ceb('0xf');this[_0x5ceb('0x21')]=0x0;this['openchannelCapacity']=_0x5890a3[_0x5ceb('0x22')]||0x0;this[_0x5ceb('0x23')]=0x0;this[_0x5ceb('0x24')]=![];this[_0x5ceb('0x25')]=undefined;this[_0x5ceb('0x26')]='';this[_0x5ceb('0x27')]();}Agent[_0x5ceb('0x28')][_0x5ceb('0x29')]=function(_0x49672c){if(this[_0x49672c+_0x5ceb('0x2a')]>0x0){if(this[_0x49672c+_0x5ceb('0x2b')]>0x0&&this[_0x49672c+'CurrentCapacity']>=this[_0x49672c+_0x5ceb('0x2b')]){return _0x5ceb('0x2c');}else{return _0x5ceb('0x2d');}}else{return _0x5ceb('0x2e');}};Agent[_0x5ceb('0x28')][_0x5ceb('0x27')]=function(){var _0x422b10=[_0x5ceb('0x2f'),_0x5ceb('0x30'),_0x5ceb('0x31'),_0x5ceb('0x32'),_0x5ceb('0x33'),_0x5ceb('0x34')];for(var _0x46d91e=0x0;_0x46d91e<_0x422b10[_0x5ceb('0x35')];_0x46d91e+=0x1){var _0x33eb34=this['getChannelStatus'](_0x422b10[_0x46d91e]);if(this[_0x422b10[_0x46d91e]+_0x5ceb('0x36')]!==_0x33eb34){this[_0x422b10[_0x46d91e]+_0x5ceb('0x37')]=_['toNumber'](moment()[_0x5ceb('0x38')]('x'));}this[_0x422b10[_0x46d91e]+_0x5ceb('0x36')]=_0x33eb34;}var _0x395e56={'id':this['id'],'name':this[_0x5ceb('0x6')],'online':this[_0x5ceb('0x7')],'voicePause':this[_0x5ceb('0x8')],'chatPause':this[_0x5ceb('0x9')],'mailPause':this[_0x5ceb('0xa')],'smsPause':this[_0x5ceb('0xc')],'faxPause':this[_0x5ceb('0xb')],'openchannelPause':this[_0x5ceb('0xd')],'chatStatus':this[_0x5ceb('0xe')],'chatStatusTime':this[_0x5ceb('0x10')],'chatCapacity':this[_0x5ceb('0x11')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0x5ceb('0x13')],'mailStatusTime':this[_0x5ceb('0x14')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x5ceb('0x17')],'faxStatusTime':this[_0x5ceb('0x18')],'faxCapacity':this[_0x5ceb('0x39')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this['smsStatus'],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x5ceb('0x1b')],'smsCurrentCapacity':this[_0x5ceb('0x1c')],'whatsappStatus':this[_0x5ceb('0x1d')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0x5ceb('0x1e')],'whatsappCurrentCapacity':this[_0x5ceb('0x1f')],'openchannelStatus':this[_0x5ceb('0x20')],'openchannelStatusTime':this[_0x5ceb('0x21')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x5ceb('0x23')],'busy':this[_0x5ceb('0x24')],'busyQueue':this[_0x5ceb('0x25')]};var _0x9474ff=md5(JSON['stringify'](_0x395e56));if(this[_0x5ceb('0x26')]!==_0x9474ff){this[_0x5ceb('0x26')]=_0x9474ff;io['emit'](_0x5ceb('0x3a'),_0x395e56);}};module[_0x5ceb('0x3b')]=Agent; \ No newline at end of file +var _0xc953=['StatusTime','toNumber','format','chatStatusTime','smsStatusTime','openchannelStatusTime','stringify','emit','user:save','exports','lodash','moment','md5','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','updateRealtime','Capacity','CurrentCapacity','maxcapacity','idle','prototype','mail','chat','openchannel','sms','getChannelStatus','Status'];(function(_0x4d0662,_0x145963){var _0x6eea6d=function(_0x2def06){while(--_0x2def06){_0x4d0662['push'](_0x4d0662['shift']());}};_0x6eea6d(++_0x145963);}(_0xc953,0x84));var _0x3c95=function(_0x2f87cd,_0xcaf299){_0x2f87cd=_0x2f87cd-0x0;var _0x5d7eda=_0xc953[_0x2f87cd];return _0x5d7eda;};'use strict';var _=require(_0x3c95('0x0'));var moment=require(_0x3c95('0x1'));var md5=require(_0x3c95('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x3c95('0x3')]=_[_0x3c95('0x4')](config[_0x3c95('0x3')],{'host':_0x3c95('0x5'),'port':0x18eb});var io=require(_0x3c95('0x6'))(new Redis(config[_0x3c95('0x3')]));function Agent(_0x37449a){this['id']=_0x37449a['id']||0x0;this[_0x3c95('0x7')]=_0x37449a['name']||'';this['online']=_0x37449a[_0x3c95('0x8')]||!![];this[_0x3c95('0x9')]=_0x37449a[_0x3c95('0x9')]||![];this[_0x3c95('0xa')]=_0x37449a[_0x3c95('0xa')]||![];this[_0x3c95('0xb')]=_0x37449a[_0x3c95('0xb')]||![];this['faxPause']=_0x37449a[_0x3c95('0xc')]||![];this[_0x3c95('0xd')]=_0x37449a[_0x3c95('0xd')]||![];this[_0x3c95('0xe')]=_0x37449a[_0x3c95('0xe')]||![];this[_0x3c95('0xf')]=_0x3c95('0x10');this['chatStatusTime']=0x0;this[_0x3c95('0x11')]=_0x37449a['chatCapacity']||0x0;this[_0x3c95('0x12')]=0x0;this[_0x3c95('0x13')]=_0x3c95('0x10');this[_0x3c95('0x14')]=0x0;this['mailCapacity']=_0x37449a[_0x3c95('0x15')]||0x0;this[_0x3c95('0x16')]=0x0;this[_0x3c95('0x17')]=_0x3c95('0x10');this[_0x3c95('0x18')]=0x0;this['faxCapacity']=_0x37449a[_0x3c95('0x19')]||0x0;this[_0x3c95('0x1a')]=0x0;this[_0x3c95('0x1b')]=_0x3c95('0x10');this['smsStatusTime']=0x0;this[_0x3c95('0x1c')]=_0x37449a[_0x3c95('0x1c')]||0x0;this[_0x3c95('0x1d')]=0x0;this[_0x3c95('0x1e')]='unknown';this[_0x3c95('0x1f')]=0x0;this[_0x3c95('0x20')]=_0x37449a[_0x3c95('0x20')]||0x0;this[_0x3c95('0x21')]=0x0;this[_0x3c95('0x22')]='unknown';this['openchannelStatusTime']=0x0;this['openchannelCapacity']=_0x37449a[_0x3c95('0x23')]||0x0;this[_0x3c95('0x24')]=0x0;this[_0x3c95('0x25')]=![];this[_0x3c95('0x26')]=undefined;this[_0x3c95('0x2')]='';this[_0x3c95('0x27')]();}Agent['prototype']['getChannelStatus']=function(_0x4de648){if(this[_0x4de648+'CurrentCapacity']>0x0){if(this[_0x4de648+_0x3c95('0x28')]>0x0&&this[_0x4de648+_0x3c95('0x29')]>=this[_0x4de648+'Capacity']){return _0x3c95('0x2a');}else{return'working';}}else{return _0x3c95('0x2b');}};Agent[_0x3c95('0x2c')][_0x3c95('0x27')]=function(){var _0x36ff59=[_0x3c95('0x2d'),_0x3c95('0x2e'),_0x3c95('0x2f'),'fax',_0x3c95('0x30'),'whatsapp'];for(var _0x1798eb=0x0;_0x1798eb<_0x36ff59['length'];_0x1798eb+=0x1){var _0x6c4c6c=this[_0x3c95('0x31')](_0x36ff59[_0x1798eb]);if(this[_0x36ff59[_0x1798eb]+_0x3c95('0x32')]!==_0x6c4c6c){this[_0x36ff59[_0x1798eb]+_0x3c95('0x33')]=_[_0x3c95('0x34')](moment()[_0x3c95('0x35')]('x'));}this[_0x36ff59[_0x1798eb]+_0x3c95('0x32')]=_0x6c4c6c;}var _0x5329be={'id':this['id'],'name':this[_0x3c95('0x7')],'online':this['online'],'voicePause':this[_0x3c95('0x9')],'chatPause':this['chatPause'],'mailPause':this[_0x3c95('0xb')],'smsPause':this[_0x3c95('0xd')],'faxPause':this['faxPause'],'openchannelPause':this[_0x3c95('0xe')],'chatStatus':this[_0x3c95('0xf')],'chatStatusTime':this[_0x3c95('0x36')],'chatCapacity':this[_0x3c95('0x11')],'chatCurrentCapacity':this[_0x3c95('0x12')],'mailStatus':this[_0x3c95('0x13')],'mailStatusTime':this[_0x3c95('0x14')],'mailCapacity':this[_0x3c95('0x15')],'mailCurrentCapacity':this[_0x3c95('0x16')],'faxStatus':this[_0x3c95('0x17')],'faxStatusTime':this[_0x3c95('0x18')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0x3c95('0x37')],'smsCapacity':this[_0x3c95('0x1c')],'smsCurrentCapacity':this[_0x3c95('0x1d')],'whatsappStatus':this[_0x3c95('0x1e')],'whatsappStatusTime':this[_0x3c95('0x1f')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0x3c95('0x21')],'openchannelStatus':this[_0x3c95('0x22')],'openchannelStatusTime':this[_0x3c95('0x38')],'openchannelCapacity':this[_0x3c95('0x23')],'openchannelCurrentCapacity':this[_0x3c95('0x24')],'busy':this[_0x3c95('0x25')],'busyQueue':this['busyQueue']};var _0x5ae475=md5(JSON[_0x3c95('0x39')](_0x5329be));if(this[_0x3c95('0x2')]!==_0x5ae475){this['md5']=_0x5ae475;io[_0x3c95('0x3a')](_0x3c95('0x3b'),_0x5329be);}};module[_0x3c95('0x3c')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 0320fb3..e5be47e 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 _0xdceb=['timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','prototype','_rr','map','updateRealtime','loggedIn','paused','length','online','chatPause','available','chat:queue:%s','emit','chat_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','name'];(function(_0x293ba2,_0x4070f8){var _0x5e881e=function(_0x37d131){while(--_0x37d131){_0x293ba2['push'](_0x293ba2['shift']());}};_0x5e881e(++_0x4070f8);}(_0xdceb,0xac));var _0xbdce=function(_0x32dfaa,_0x3938f3){_0x32dfaa=_0x32dfaa-0x0;var _0x330d7e=_0xdceb[_0x32dfaa];return _0x330d7e;};'use strict';var _=require(_0xbdce('0x0'));var md5=require('md5');var util=require(_0xbdce('0x1'));var Redis=require(_0xbdce('0x2'));var config=require(_0xbdce('0x3'));config[_0xbdce('0x4')]=_[_0xbdce('0x5')](config[_0xbdce('0x4')],{'host':_0xbdce('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function ChatQueue(_0x4f47fb){this['id']=_0x4f47fb['id']||0x0;this[_0xbdce('0x7')]=_0x4f47fb[_0xbdce('0x7')]||'';this[_0xbdce('0x8')]=_0x4f47fb[_0xbdce('0x8')]||0xa;this[_0xbdce('0x9')]=_0x4f47fb['strategy']||_0xbdce('0xa');this['Agents']=_0x4f47fb[_0xbdce('0xb')];this[_0xbdce('0xc')]={};this[_0xbdce('0xd')]=0x0;this[_0xbdce('0xe')]='';this[_0xbdce('0xf')]();this['updateRealtime']();}ChatQueue[_0xbdce('0x10')]['updateRouting']=function(){var _0x5a29ea=this[_0xbdce('0xc')][_0xbdce('0x11')];this[_0xbdce('0xc')]=_[_0xbdce('0x12')](this['Agents'],'id');this[_0xbdce('0xc')][_0xbdce('0x11')]=_0x5a29ea;};ChatQueue[_0xbdce('0x10')][_0xbdce('0x13')]=function(){this[_0xbdce('0x14')]=0x0;this[_0xbdce('0x15')]=0x0;for(var _0x316def=0x0;_0x316def=0x0?this[_0xbdce('0x19')]:0x0;var _0x1427e6={'id':this['id'],'available':this[_0xbdce('0x19')],'loggedIn':this['loggedIn'],'name':this[_0xbdce('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x3d2179=md5(JSON['stringify'](_0x1427e6));if(this[_0xbdce('0xe')]!==_0x3d2179){this[_0xbdce('0xe')]=_0x3d2179;io['to'](util['format'](_0xbdce('0x1a'),_0x1427e6[_0xbdce('0x7')]))[_0xbdce('0x1b')](_0xbdce('0x1c'),_0x1427e6);}};module[_0xbdce('0x1d')]=ChatQueue; \ No newline at end of file +var _0x25b7=['updateRouting','updateRealtime','mapAgentsId','_rr','map','prototype','loggedIn','paused','online','available','waiting','stringify','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents'];(function(_0x48b963,_0xaabaf9){var _0x23ffbe=function(_0x5a180b){while(--_0x5a180b){_0x48b963['push'](_0x48b963['shift']());}};_0x23ffbe(++_0xaabaf9);}(_0x25b7,0xf8));var _0x725b=function(_0x976c4c,_0x1c1320){_0x976c4c=_0x976c4c-0x0;var _0x478463=_0x25b7[_0x976c4c];return _0x478463;};'use strict';var _=require(_0x725b('0x0'));var md5=require(_0x725b('0x1'));var util=require(_0x725b('0x2'));var Redis=require(_0x725b('0x3'));var config=require(_0x725b('0x4'));config[_0x725b('0x5')]=_['defaults'](config[_0x725b('0x5')],{'host':_0x725b('0x6'),'port':0x18eb});var io=require(_0x725b('0x7'))(new Redis(config[_0x725b('0x5')]));function ChatQueue(_0x4d96fb){this['id']=_0x4d96fb['id']||0x0;this[_0x725b('0x8')]=_0x4d96fb[_0x725b('0x8')]||'';this[_0x725b('0x9')]=_0x4d96fb[_0x725b('0x9')]||0xa;this['strategy']=_0x4d96fb[_0x725b('0xa')]||_0x725b('0xb');this['Agents']=_0x4d96fb[_0x725b('0xc')];this['mapAgentsId']={};this['waiting']=0x0;this['md5']='';this[_0x725b('0xd')]();this[_0x725b('0xe')]();}ChatQueue['prototype']['updateRouting']=function(){var _0xd69f49=this[_0x725b('0xf')][_0x725b('0x10')];this['mapAgentsId']=_[_0x725b('0x11')](this[_0x725b('0xc')],'id');this[_0x725b('0xf')][_0x725b('0x10')]=_0xd69f49;};ChatQueue[_0x725b('0x12')]['updateRealtime']=function(){this[_0x725b('0x13')]=0x0;this[_0x725b('0x14')]=0x0;for(var _0x3d12a5=0x0;_0x3d12a5=0x0?this['available']:0x0;var _0x234134={'id':this['id'],'available':this[_0x725b('0x16')],'loggedIn':this['loggedIn'],'name':this[_0x725b('0x8')],'paused':this['paused'],'waiting':this[_0x725b('0x17')]};var _0x162abe=md5(JSON[_0x725b('0x18')](_0x234134));if(this[_0x725b('0x1')]!==_0x162abe){this[_0x725b('0x1')]=_0x162abe;io['to'](util['format'](_0x725b('0x19'),_0x234134[_0x725b('0x8')]))[_0x725b('0x1a')](_0x725b('0x1b'),_0x234134);}};module[_0x725b('0x1c')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 1e5b5e3..74dd41b 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 _0xdc77=['prototype','updateRouting','map','loggedIn','paused','online','available','waiting','format','fax:queue:%s','emit','lodash','util','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','md5','updateRealtime'];(function(_0x2dd976,_0x1b5dc4){var _0x2265fd=function(_0x270d24){while(--_0x270d24){_0x2dd976['push'](_0x2dd976['shift']());}};_0x2265fd(++_0x1b5dc4);}(_0xdc77,0xfb));var _0x7dc7=function(_0x4fdd31,_0x827929){_0x4fdd31=_0x4fdd31-0x0;var _0x4a2d79=_0xdc77[_0x4fdd31];return _0x4a2d79;};'use strict';var _=require(_0x7dc7('0x0'));var md5=require('md5');var util=require(_0x7dc7('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x7dc7('0x2')]=_[_0x7dc7('0x3')](config[_0x7dc7('0x2')],{'host':_0x7dc7('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function FaxQueue(_0x83e93a){this['id']=_0x83e93a['id']||0x0;this[_0x7dc7('0x5')]=_0x83e93a['name']||'';this[_0x7dc7('0x6')]=_0x83e93a[_0x7dc7('0x6')]||0xa;this[_0x7dc7('0x7')]=_0x83e93a[_0x7dc7('0x7')]||_0x7dc7('0x8');this['Agents']=_0x83e93a[_0x7dc7('0x9')];this[_0x7dc7('0xa')]={};this['waiting']=0x0;this[_0x7dc7('0xb')]='';this['updateRouting']();this[_0x7dc7('0xc')]();}FaxQueue[_0x7dc7('0xd')][_0x7dc7('0xe')]=function(){var _0x3a23f8=this[_0x7dc7('0xa')]['_rr'];this['mapAgentsId']=_[_0x7dc7('0xf')](this[_0x7dc7('0x9')],'id');this[_0x7dc7('0xa')]['_rr']=_0x3a23f8;};FaxQueue[_0x7dc7('0xd')]['updateRealtime']=function(){this[_0x7dc7('0x10')]=0x0;this[_0x7dc7('0x11')]=0x0;for(var _0x44a6f5=0x0;_0x44a6f5=0x0?this[_0x7dc7('0x13')]:0x0;var _0x2e886a={'id':this['id'],'available':this[_0x7dc7('0x13')],'loggedIn':this[_0x7dc7('0x10')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x7dc7('0x14')]};var _0x52c205=md5(JSON['stringify'](_0x2e886a));if(this['md5']!==_0x52c205){this[_0x7dc7('0xb')]=_0x52c205;io['to'](util[_0x7dc7('0x15')](_0x7dc7('0x16'),_0x2e886a[_0x7dc7('0x5')]))[_0x7dc7('0x17')]('fax_queue:save',_0x2e886a);}};module['exports']=FaxQueue; \ No newline at end of file +var _0xbfa4=['name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','_rr','map','prototype','updateRealtime','loggedIn','paused','length','online','faxPause','available','stringify','format','emit','lodash','md5','util','redis','defaults'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xbfa4,0xe5));var _0x4bfa=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xbfa4[_0x2cfb58];return _0xd99951;};'use strict';var _=require(_0x4bfa('0x0'));var md5=require(_0x4bfa('0x1'));var util=require(_0x4bfa('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x4bfa('0x3')]=_[_0x4bfa('0x4')](config[_0x4bfa('0x3')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4bfa('0x3')]));function FaxQueue(_0x3b56f3){this['id']=_0x3b56f3['id']||0x0;this['name']=_0x3b56f3[_0x4bfa('0x5')]||'';this[_0x4bfa('0x6')]=_0x3b56f3['timeout']||0xa;this[_0x4bfa('0x7')]=_0x3b56f3['strategy']||_0x4bfa('0x8');this[_0x4bfa('0x9')]=_0x3b56f3[_0x4bfa('0x9')];this[_0x4bfa('0xa')]={};this[_0x4bfa('0xb')]=0x0;this[_0x4bfa('0x1')]='';this[_0x4bfa('0xc')]();this['updateRealtime']();}FaxQueue['prototype'][_0x4bfa('0xc')]=function(){var _0x3fe199=this[_0x4bfa('0xa')][_0x4bfa('0xd')];this[_0x4bfa('0xa')]=_[_0x4bfa('0xe')](this[_0x4bfa('0x9')],'id');this['mapAgentsId'][_0x4bfa('0xd')]=_0x3fe199;};FaxQueue[_0x4bfa('0xf')][_0x4bfa('0x10')]=function(){this[_0x4bfa('0x11')]=0x0;this[_0x4bfa('0x12')]=0x0;for(var _0x5a309e=0x0;_0x5a309e=0x0?this['available']:0x0;var _0x181c71={'id':this['id'],'available':this[_0x4bfa('0x16')],'loggedIn':this['loggedIn'],'name':this[_0x4bfa('0x5')],'paused':this[_0x4bfa('0x12')],'waiting':this['waiting']};var _0xb7b2a6=md5(JSON[_0x4bfa('0x17')](_0x181c71));if(this[_0x4bfa('0x1')]!==_0xb7b2a6){this[_0x4bfa('0x1')]=_0xb7b2a6;io['to'](util[_0x4bfa('0x18')]('fax:queue:%s',_0x181c71[_0x4bfa('0x5')]))[_0x4bfa('0x19')]('fax_queue:save',_0x181c71);}};module['exports']=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 73f14e0..0d5e69c 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 _0x842a=['name','Intervals','exports'];(function(_0x1f1429,_0x190d47){var _0xa65e5=function(_0x37d267){while(--_0x37d267){_0x1f1429['push'](_0x1f1429['shift']());}};_0xa65e5(++_0x190d47);}(_0x842a,0xf6));var _0xa842=function(_0x427217,_0x4039b1){_0x427217=_0x427217-0x0;var _0x5b28fb=_0x842a[_0x427217];return _0x5b28fb;};'use strict';function Interval(_0x2dc68b){this['id']=_0x2dc68b['id']||0x0;this[_0xa842('0x0')]=_0x2dc68b[_0xa842('0x0')]||'';this[_0xa842('0x1')]=_0x2dc68b[_0xa842('0x1')]||{};}module[_0xa842('0x2')]=Interval; \ No newline at end of file +var _0xfe56=['Intervals','exports','name'];(function(_0xddffd,_0x54d6d2){var _0x50713c=function(_0x21f59d){while(--_0x21f59d){_0xddffd['push'](_0xddffd['shift']());}};_0x50713c(++_0x54d6d2);}(_0xfe56,0x1d9));var _0x6fe5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xfe56[_0x14add3];return _0x4a174f;};'use strict';function Interval(_0x3a76b1){this['id']=_0x3a76b1['id']||0x0;this[_0x6fe5('0x0')]=_0x3a76b1[_0x6fe5('0x0')]||'';this[_0x6fe5('0x1')]=_0x3a76b1[_0x6fe5('0x1')]||{};}module[_0x6fe5('0x2')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index a67e11f..9100d92 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 _0xb2f4=['mapAgentsId','_rr','map','loggedIn','paused','length','online','available','stringify','format','mail_queue:save','md5','util','ioredis','redis','defaults','socket.io-emitter','name','timeout','beepall','Agents','waiting','updateRouting','updateRealtime','prototype'];(function(_0x18ce04,_0x1f46a9){var _0x5c716e=function(_0x6a8da0){while(--_0x6a8da0){_0x18ce04['push'](_0x18ce04['shift']());}};_0x5c716e(++_0x1f46a9);}(_0xb2f4,0xa1));var _0x4b2f=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0xb2f4[_0x2e4aa2];return _0x5e6092;};'use strict';var _=require('lodash');var md5=require(_0x4b2f('0x0'));var util=require(_0x4b2f('0x1'));var Redis=require(_0x4b2f('0x2'));var config=require('../../../config/environment');config[_0x4b2f('0x3')]=_[_0x4b2f('0x4')](config[_0x4b2f('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x4b2f('0x5'))(new Redis(config['redis']));function MailQueue(_0x2b3ea1){this['id']=_0x2b3ea1['id']||0x0;this[_0x4b2f('0x6')]=_0x2b3ea1['name']||'';this[_0x4b2f('0x7')]=_0x2b3ea1[_0x4b2f('0x7')]||0xa;this['strategy']=_0x2b3ea1['strategy']||_0x4b2f('0x8');this[_0x4b2f('0x9')]=_0x2b3ea1[_0x4b2f('0x9')];this['mapAgentsId']={};this[_0x4b2f('0xa')]=0x0;this['md5']='';this[_0x4b2f('0xb')]();this[_0x4b2f('0xc')]();}MailQueue[_0x4b2f('0xd')][_0x4b2f('0xb')]=function(){var _0x517821=this[_0x4b2f('0xe')][_0x4b2f('0xf')];this[_0x4b2f('0xe')]=_[_0x4b2f('0x10')](this[_0x4b2f('0x9')],'id');this[_0x4b2f('0xe')][_0x4b2f('0xf')]=_0x517821;};MailQueue[_0x4b2f('0xd')][_0x4b2f('0xc')]=function(){this[_0x4b2f('0x11')]=0x0;this[_0x4b2f('0x12')]=0x0;for(var _0x128c1b=0x0;_0x128c1b=0x0?this[_0x4b2f('0x15')]:0x0;var _0x1b2a7b={'id':this['id'],'available':this[_0x4b2f('0x15')],'loggedIn':this[_0x4b2f('0x11')],'name':this[_0x4b2f('0x6')],'paused':this[_0x4b2f('0x12')],'waiting':this[_0x4b2f('0xa')]};var _0x50060c=md5(JSON[_0x4b2f('0x16')](_0x1b2a7b));if(this[_0x4b2f('0x0')]!==_0x50060c){this[_0x4b2f('0x0')]=_0x50060c;io['to'](util[_0x4b2f('0x17')]('mail:queue:%s',_0x1b2a7b[_0x4b2f('0x6')]))['emit'](_0x4b2f('0x18'),_0x1b2a7b);}};module['exports']=MailQueue; \ No newline at end of file +var _0x9ab0=['paused','online','available','stringify','name','mail_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','loggedIn'];(function(_0x5ac13b,_0x371bf0){var _0x2919c1=function(_0x56b44b){while(--_0x56b44b){_0x5ac13b['push'](_0x5ac13b['shift']());}};_0x2919c1(++_0x371bf0);}(_0x9ab0,0x19c));var _0x09ab=function(_0xf9680c,_0x37c873){_0xf9680c=_0xf9680c-0x0;var _0x211bbf=_0x9ab0[_0xf9680c];return _0x211bbf;};'use strict';var _=require(_0x09ab('0x0'));var md5=require(_0x09ab('0x1'));var util=require(_0x09ab('0x2'));var Redis=require(_0x09ab('0x3'));var config=require(_0x09ab('0x4'));config[_0x09ab('0x5')]=_[_0x09ab('0x6')](config[_0x09ab('0x5')],{'host':_0x09ab('0x7'),'port':0x18eb});var io=require(_0x09ab('0x8'))(new Redis(config[_0x09ab('0x5')]));function MailQueue(_0x4a2f15){this['id']=_0x4a2f15['id']||0x0;this['name']=_0x4a2f15['name']||'';this[_0x09ab('0x9')]=_0x4a2f15['timeout']||0xa;this[_0x09ab('0xa')]=_0x4a2f15[_0x09ab('0xa')]||_0x09ab('0xb');this[_0x09ab('0xc')]=_0x4a2f15[_0x09ab('0xc')];this[_0x09ab('0xd')]={};this[_0x09ab('0xe')]=0x0;this[_0x09ab('0x1')]='';this['updateRouting']();this[_0x09ab('0xf')]();}MailQueue[_0x09ab('0x10')][_0x09ab('0x11')]=function(){var _0x5a73d6=this[_0x09ab('0xd')][_0x09ab('0x12')];this[_0x09ab('0xd')]=_['map'](this[_0x09ab('0xc')],'id');this[_0x09ab('0xd')][_0x09ab('0x12')]=_0x5a73d6;};MailQueue[_0x09ab('0x10')][_0x09ab('0xf')]=function(){this[_0x09ab('0x13')]=0x0;this[_0x09ab('0x14')]=0x0;for(var _0x507d34=0x0;_0x507d34=0x0?this[_0x09ab('0x16')]:0x0;var _0x54b9e9={'id':this['id'],'available':this[_0x09ab('0x16')],'loggedIn':this[_0x09ab('0x13')],'name':this['name'],'paused':this[_0x09ab('0x14')],'waiting':this['waiting']};var _0x531f88=md5(JSON[_0x09ab('0x17')](_0x54b9e9));if(this['md5']!==_0x531f88){this[_0x09ab('0x1')]=_0x531f88;io['to'](util['format']('mail:queue:%s',_0x54b9e9[_0x09ab('0x18')]))['emit'](_0x09ab('0x19'),_0x54b9e9);}};module[_0x09ab('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 0aaa23a..ae5022f 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 _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(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0x7a54,0x106));var _0x47a5=function(_0x104e11,_0x559cbc){_0x104e11=_0x104e11-0x0;var _0x5773ef=_0x7a54[_0x104e11];return _0x5773ef;};'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 +var _0xadb5=['../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','_rr','prototype','updateRealtime','paused','loggedIn','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','md5','ioredis'];(function(_0x1d3791,_0x51c613){var _0x40fbf5=function(_0xe5d147){while(--_0xe5d147){_0x1d3791['push'](_0x1d3791['shift']());}};_0x40fbf5(++_0x51c613);}(_0xadb5,0xad));var _0x5adb=function(_0x1f15b8,_0x186be7){_0x1f15b8=_0x1f15b8-0x0;var _0x466c14=_0xadb5[_0x1f15b8];return _0x466c14;};'use strict';var _=require('lodash');var md5=require(_0x5adb('0x0'));var util=require('util');var Redis=require(_0x5adb('0x1'));var config=require(_0x5adb('0x2'));config[_0x5adb('0x3')]=_['defaults'](config[_0x5adb('0x3')],{'host':_0x5adb('0x4'),'port':0x18eb});var io=require(_0x5adb('0x5'))(new Redis(config['redis']));function OpenchannelQueue(_0x35a5d3){this['id']=_0x35a5d3['id']||0x0;this[_0x5adb('0x6')]=_0x35a5d3[_0x5adb('0x6')]||'';this[_0x5adb('0x7')]=_0x35a5d3[_0x5adb('0x7')]||0xa;this[_0x5adb('0x8')]=_0x35a5d3[_0x5adb('0x8')]||_0x5adb('0x9');this[_0x5adb('0xa')]=_0x35a5d3[_0x5adb('0xa')];this[_0x5adb('0xb')]={};this[_0x5adb('0xc')]=0x0;this[_0x5adb('0x0')]='';this[_0x5adb('0xd')]();this['updateRealtime']();}OpenchannelQueue['prototype'][_0x5adb('0xd')]=function(){var _0x1ea238=this[_0x5adb('0xb')]['_rr'];this[_0x5adb('0xb')]=_['map'](this[_0x5adb('0xa')],'id');this['mapAgentsId'][_0x5adb('0xe')]=_0x1ea238;};OpenchannelQueue[_0x5adb('0xf')][_0x5adb('0x10')]=function(){this['loggedIn']=0x0;this[_0x5adb('0x11')]=0x0;for(var _0x34af2c=0x0;_0x34af2c=0x0?this['available']:0x0;var _0x3fff62={'id':this['id'],'available':this['available'],'loggedIn':this[_0x5adb('0x12')],'name':this['name'],'paused':this[_0x5adb('0x11')],'waiting':this['waiting']};var _0x5e218c=md5(JSON[_0x5adb('0x15')](_0x3fff62));if(this[_0x5adb('0x0')]!==_0x5e218c){this[_0x5adb('0x0')]=_0x5e218c;io['to'](util[_0x5adb('0x16')](_0x5adb('0x17'),_0x3fff62['name']))[_0x5adb('0x18')]('openchannel_queue:save',_0x3fff62);}};module['exports']=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index ddefe57..65aeaa4 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 _0x684c=['sms:queue:%s','emit','sms_queue:save','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','loggedIn','paused','length','available','stringify','format'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x684c,0x1b3));var _0xc684=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x684c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc684('0x0'));var md5=require(_0xc684('0x1'));var util=require('util');var Redis=require(_0xc684('0x2'));var config=require(_0xc684('0x3'));config[_0xc684('0x4')]=_[_0xc684('0x5')](config[_0xc684('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xc684('0x6'))(new Redis(config[_0xc684('0x4')]));function SmsQueue(_0x4219b6){this['id']=_0x4219b6['id']||0x0;this[_0xc684('0x7')]=_0x4219b6[_0xc684('0x7')]||'';this[_0xc684('0x8')]=_0x4219b6[_0xc684('0x8')]||0xa;this[_0xc684('0x9')]=_0x4219b6[_0xc684('0x9')]||_0xc684('0xa');this[_0xc684('0xb')]=_0x4219b6[_0xc684('0xb')];this[_0xc684('0xc')]={};this[_0xc684('0xd')]=0x0;this[_0xc684('0x1')]='';this[_0xc684('0xe')]();this[_0xc684('0xf')]();}SmsQueue['prototype'][_0xc684('0xe')]=function(){var _0x365990=this[_0xc684('0xc')][_0xc684('0x10')];this[_0xc684('0xc')]=_[_0xc684('0x11')](this['Agents'],'id');this[_0xc684('0xc')][_0xc684('0x10')]=_0x365990;};SmsQueue['prototype']['updateRealtime']=function(){this[_0xc684('0x12')]=0x0;this[_0xc684('0x13')]=0x0;for(var _0x32d5da=0x0;_0x32d5da=0x0?this[_0xc684('0x15')]:0x0;var _0x1c1b4a={'id':this['id'],'available':this[_0xc684('0x15')],'loggedIn':this['loggedIn'],'name':this[_0xc684('0x7')],'paused':this[_0xc684('0x13')],'waiting':this['waiting']};var _0x21273b=md5(JSON[_0xc684('0x16')](_0x1c1b4a));if(this[_0xc684('0x1')]!==_0x21273b){this['md5']=_0x21273b;io['to'](util[_0xc684('0x17')](_0xc684('0x18'),_0x1c1b4a[_0xc684('0x7')]))[_0xc684('0x19')](_0xc684('0x1a'),_0x1c1b4a);}};module['exports']=SmsQueue; \ No newline at end of file +var _0x0e35=['smsPause','available','stringify','format','sms:queue:%s','emit','sms_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','length','online'];(function(_0x47ef86,_0x4bcfbb){var _0x1cd7dc=function(_0x329de7){while(--_0x329de7){_0x47ef86['push'](_0x47ef86['shift']());}};_0x1cd7dc(++_0x4bcfbb);}(_0x0e35,0xc2));var _0x50e3=function(_0x57ddd6,_0x5b14d4){_0x57ddd6=_0x57ddd6-0x0;var _0xce75b9=_0x0e35[_0x57ddd6];return _0xce75b9;};'use strict';var _=require(_0x50e3('0x0'));var md5=require(_0x50e3('0x1'));var util=require(_0x50e3('0x2'));var Redis=require(_0x50e3('0x3'));var config=require(_0x50e3('0x4'));config[_0x50e3('0x5')]=_[_0x50e3('0x6')](config[_0x50e3('0x5')],{'host':_0x50e3('0x7'),'port':0x18eb});var io=require(_0x50e3('0x8'))(new Redis(config['redis']));function SmsQueue(_0x86283e){this['id']=_0x86283e['id']||0x0;this[_0x50e3('0x9')]=_0x86283e['name']||'';this['timeout']=_0x86283e[_0x50e3('0xa')]||0xa;this[_0x50e3('0xb')]=_0x86283e['strategy']||'beepall';this[_0x50e3('0xc')]=_0x86283e[_0x50e3('0xc')];this[_0x50e3('0xd')]={};this[_0x50e3('0xe')]=0x0;this[_0x50e3('0x1')]='';this[_0x50e3('0xf')]();this[_0x50e3('0x10')]();}SmsQueue[_0x50e3('0x11')][_0x50e3('0xf')]=function(){var _0x35b58b=this[_0x50e3('0xd')][_0x50e3('0x12')];this[_0x50e3('0xd')]=_['map'](this[_0x50e3('0xc')],'id');this[_0x50e3('0xd')][_0x50e3('0x12')]=_0x35b58b;};SmsQueue[_0x50e3('0x11')]['updateRealtime']=function(){this[_0x50e3('0x13')]=0x0;this[_0x50e3('0x14')]=0x0;for(var _0x4b4d6f=0x0;_0x4b4d6f=0x0?this[_0x50e3('0x18')]:0x0;var _0x1b4279={'id':this['id'],'available':this[_0x50e3('0x18')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x50e3('0x14')],'waiting':this['waiting']};var _0x3ffe22=md5(JSON[_0x50e3('0x19')](_0x1b4279));if(this['md5']!==_0x3ffe22){this['md5']=_0x3ffe22;io['to'](util[_0x50e3('0x1a')](_0x50e3('0x1b'),_0x1b4279['name']))[_0x50e3('0x1c')](_0x50e3('0x1d'),_0x1b4279);}};module[_0x50e3('0x1e')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 79e4de9..5c3a65e 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 _0x0ee5=['_rr','map','paused','length','online','loggedIn','available','stringify','format','emit','whatsapp_queue:save','lodash','md5','util','ioredis','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId'];(function(_0x5c070e,_0x1de682){var _0x56aedd=function(_0x1477d4){while(--_0x1477d4){_0x5c070e['push'](_0x5c070e['shift']());}};_0x56aedd(++_0x1de682);}(_0x0ee5,0xcf));var _0x50ee=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x0ee5[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x50ee('0x0'));var md5=require(_0x50ee('0x1'));var util=require(_0x50ee('0x2'));var Redis=require(_0x50ee('0x3'));var config=require('../../../config/environment');config[_0x50ee('0x4')]=_['defaults'](config['redis'],{'host':_0x50ee('0x5'),'port':0x18eb});var io=require(_0x50ee('0x6'))(new Redis(config['redis']));function WhatsappQueue(_0x17b33d){this['id']=_0x17b33d['id']||0x0;this[_0x50ee('0x7')]=_0x17b33d[_0x50ee('0x7')]||'';this['timeout']=_0x17b33d[_0x50ee('0x8')]||0xa;this[_0x50ee('0x9')]=_0x17b33d[_0x50ee('0x9')]||_0x50ee('0xa');this[_0x50ee('0xb')]=_0x17b33d[_0x50ee('0xb')];this['mapAgentsId']={};this[_0x50ee('0xc')]=0x0;this[_0x50ee('0x1')]='';this[_0x50ee('0xd')]();this[_0x50ee('0xe')]();}WhatsappQueue[_0x50ee('0xf')][_0x50ee('0xd')]=function(){var _0x4e9445=this[_0x50ee('0x10')][_0x50ee('0x11')];this[_0x50ee('0x10')]=_[_0x50ee('0x12')](this[_0x50ee('0xb')],'id');this[_0x50ee('0x10')]['_rr']=_0x4e9445;};WhatsappQueue[_0x50ee('0xf')][_0x50ee('0xe')]=function(){this['loggedIn']=0x0;this[_0x50ee('0x13')]=0x0;for(var _0x57231a=0x0;_0x57231a=0x0?this[_0x50ee('0x17')]:0x0;var _0x4db338={'id':this['id'],'available':this[_0x50ee('0x17')],'loggedIn':this[_0x50ee('0x16')],'name':this[_0x50ee('0x7')],'paused':this[_0x50ee('0x13')],'waiting':this[_0x50ee('0xc')]};var _0xebca56=md5(JSON[_0x50ee('0x18')](_0x4db338));if(this[_0x50ee('0x1')]!==_0xebca56){this[_0x50ee('0x1')]=_0xebca56;io['to'](util[_0x50ee('0x19')]('whatsapp:queue:%s',_0x4db338[_0x50ee('0x7')]))[_0x50ee('0x1a')](_0x50ee('0x1b'),_0x4db338);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0x67dc=['loggedIn','paused','length','online','available','stringify','format','whatsapp:queue:%s','md5','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','Agents'];(function(_0x491cbe,_0x45c8ba){var _0x59449d=function(_0x21b463){while(--_0x21b463){_0x491cbe['push'](_0x491cbe['shift']());}};_0x59449d(++_0x45c8ba);}(_0x67dc,0x1ee));var _0xc67d=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0x67dc[_0x2d34d6];return _0x1d3d12;};'use strict';var _=require('lodash');var md5=require(_0xc67d('0x0'));var util=require(_0xc67d('0x1'));var Redis=require(_0xc67d('0x2'));var config=require(_0xc67d('0x3'));config[_0xc67d('0x4')]=_[_0xc67d('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xc67d('0x6'))(new Redis(config[_0xc67d('0x4')]));function WhatsappQueue(_0x24aa56){this['id']=_0x24aa56['id']||0x0;this[_0xc67d('0x7')]=_0x24aa56[_0xc67d('0x7')]||'';this[_0xc67d('0x8')]=_0x24aa56['timeout']||0xa;this[_0xc67d('0x9')]=_0x24aa56[_0xc67d('0x9')]||_0xc67d('0xa');this['Agents']=_0x24aa56['Agents'];this[_0xc67d('0xb')]={};this[_0xc67d('0xc')]=0x0;this[_0xc67d('0x0')]='';this[_0xc67d('0xd')]();this[_0xc67d('0xe')]();}WhatsappQueue[_0xc67d('0xf')]['updateRouting']=function(){var _0x238bad=this[_0xc67d('0xb')][_0xc67d('0x10')];this[_0xc67d('0xb')]=_[_0xc67d('0x11')](this[_0xc67d('0x12')],'id');this['mapAgentsId'][_0xc67d('0x10')]=_0x238bad;};WhatsappQueue[_0xc67d('0xf')][_0xc67d('0xe')]=function(){this[_0xc67d('0x13')]=0x0;this[_0xc67d('0x14')]=0x0;for(var _0x4e7044=0x0;_0x4e7044=0x0?this[_0xc67d('0x17')]:0x0;var _0x36a39a={'id':this['id'],'available':this[_0xc67d('0x17')],'loggedIn':this[_0xc67d('0x13')],'name':this['name'],'paused':this[_0xc67d('0x14')],'waiting':this[_0xc67d('0xc')]};var _0x584012=md5(JSON[_0xc67d('0x18')](_0x36a39a));if(this[_0xc67d('0x0')]!==_0x584012){this[_0xc67d('0x0')]=_0x584012;io['to'](util[_0xc67d('0x19')](_0xc67d('0x1a'),_0x36a39a[_0xc67d('0x7')]))['emit']('whatsapp_queue:save',_0x36a39a);}};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 6917bc1..3ee9da0 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x2aa717,_0x52771b){var _0x240cc7=function(_0x42c143){while(--_0x42c143){_0x2aa717['push'](_0x2aa717['shift']());}};_0x240cc7(++_0x52771b);}(_0xb10b,0x12a));var _0xbb10=function(_0x5e8906,_0x18f1e7){_0x5e8906=_0x5e8906-0x0;var _0x3b6622=_0xb10b[_0x5e8906];return _0x3b6622;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 102eb5c..2b70f81 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 _0xa55b=['updateChatInteraction','addTags','Request','AddTagsToChatInteraction','update','UpdateChatInteraction'];(function(_0x54ce67,_0x35ec85){var _0x10f088=function(_0x5b17da){while(--_0x5b17da){_0x54ce67['push'](_0x54ce67['shift']());}};_0x10f088(++_0x35ec85);}(_0xa55b,0x1e4));var _0xba55=function(_0xfc9de,_0x2b6d0e){_0xfc9de=_0xfc9de-0x0;var _0xb00c8e=_0xa55b[_0xfc9de];return _0xb00c8e;};'use strict';var client=require('../client');exports[_0xba55('0x0')]=function(_0x338518,_0x505b54){return client['Request'](_0xba55('0x1'),{'body':_0x505b54,'options':{'where':{'id':_0x338518}},'log':_0xba55('0x2')});};exports[_0xba55('0x3')]=function(_0x337404,_0x473fa6){return client[_0xba55('0x4')](_0xba55('0x5'),{'body':_0x473fa6,'options':{'where':{'id':_0x337404}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0xe758=['Request','UpdateChatInteraction','updateChatInteraction','addTags','addTagsToChatInteraction','../client'];(function(_0x9b2bb0,_0x3965b1){var _0x2cdb3b=function(_0x177d75){while(--_0x177d75){_0x9b2bb0['push'](_0x9b2bb0['shift']());}};_0x2cdb3b(++_0x3965b1);}(_0xe758,0x83));var _0x8e75=function(_0x3b7678,_0x210980){_0x3b7678=_0x3b7678-0x0;var _0x1c9b2a=_0xe758[_0x3b7678];return _0x1c9b2a;};'use strict';var client=require(_0x8e75('0x0'));exports['update']=function(_0x32cfdf,_0x450200){return client[_0x8e75('0x1')](_0x8e75('0x2'),{'body':_0x450200,'options':{'where':{'id':_0x32cfdf}},'log':_0x8e75('0x3')});};exports[_0x8e75('0x4')]=function(_0x4e980f,_0x1af0d5){return client[_0x8e75('0x1')]('AddTagsToChatInteraction',{'body':_0x1af0d5,'options':{'where':{'id':_0x4e980f}},'log':_0x8e75('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 5a88b69..09b99ba 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 _0xede3=['createChatMessage','create','Request','CreateChatMessage'];(function(_0xd1c39b,_0x16f0c6){var _0x58f5bc=function(_0x412cf3){while(--_0x412cf3){_0xd1c39b['push'](_0xd1c39b['shift']());}};_0x58f5bc(++_0x16f0c6);}(_0xede3,0x145));var _0x3ede=function(_0x2e734c,_0x44876c){_0x2e734c=_0x2e734c-0x0;var _0x33af73=_0xede3[_0x2e734c];return _0x33af73;};'use strict';var client=require('../client');exports[_0x3ede('0x0')]=function(_0x46e6b7){return client[_0x3ede('0x1')](_0x3ede('0x2'),{'body':_0x46e6b7,'log':_0x3ede('0x3')});}; \ No newline at end of file +var _0xee23=['../client','create','Request','CreateChatMessage'];(function(_0x4fe7ae,_0x34b097){var _0x219a1e=function(_0x3c9f31){while(--_0x3c9f31){_0x4fe7ae['push'](_0x4fe7ae['shift']());}};_0x219a1e(++_0x34b097);}(_0xee23,0x1ac));var _0x3ee2=function(_0xe1c3d5,_0x4405b2){_0xe1c3d5=_0xe1c3d5-0x0;var _0x281f96=_0xee23[_0xe1c3d5];return _0x281f96;};'use strict';var client=require(_0x3ee2('0x0'));exports[_0x3ee2('0x1')]=function(_0x1aae11){return client[_0x3ee2('0x2')](_0x3ee2('0x3'),{'body':_0x1aae11,'log':'createChatMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 3722c23..9a274e9 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 _0xe002=['strategy','Agents','online','chatPause','../client','getChatQueues','Request','name','timeout'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0xe002,0xf7));var _0x2e00=function(_0x183b97,_0x2d297c){_0x183b97=_0x183b97-0x0;var _0x629cf7=_0xe002[_0x183b97];return _0x629cf7;};'use strict';var client=require(_0x2e00('0x0'));exports[_0x2e00('0x1')]=function(){return function(){return client[_0x2e00('0x2')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0x2e00('0x3'),_0x2e00('0x4'),_0x2e00('0x5')],'include':[{'model':'User','as':_0x2e00('0x6'),'attributes':['id',_0x2e00('0x3'),_0x2e00('0x7'),_0x2e00('0x8')]}]},'log':_0x2e00('0x1')});};}; \ No newline at end of file +var _0xb458=['User','Agents','online','../client','getChatQueues','Request','timeout','strategy'];(function(_0x36005b,_0x312222){var _0x56797d=function(_0x2a7612){while(--_0x2a7612){_0x36005b['push'](_0x36005b['shift']());}};_0x56797d(++_0x312222);}(_0xb458,0x103));var _0x8b45=function(_0x333aee,_0x5c7b90){_0x333aee=_0x333aee-0x0;var _0x3add1d=_0xb458[_0x333aee];return _0x3add1d;};'use strict';var client=require(_0x8b45('0x0'));exports[_0x8b45('0x1')]=function(){return function(){return client[_0x8b45('0x2')]('GetChatQueue',{'options':{'raw':![],'attributes':['id','name',_0x8b45('0x3'),_0x8b45('0x4')],'include':[{'model':_0x8b45('0x5'),'as':_0x8b45('0x6'),'attributes':['id','name',_0x8b45('0x7'),'chatPause']}]},'log':'getChatQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index e1bf803..d9dedeb 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 _0x7ec2=['../client','create','CreateChatQueueReport','Request','UpdateChatQueueReport','DESC'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7ec2,0x15c));var _0x27ec=function(_0x64a36c,_0x54bc64){_0x64a36c=_0x64a36c-0x0;var _0x13d1ce=_0x7ec2[_0x64a36c];return _0x13d1ce;};'use strict';var client=require(_0x27ec('0x0'));exports[_0x27ec('0x1')]=function(_0x29b076){return client['Request'](_0x27ec('0x2'),{'body':_0x29b076,'log':_0x27ec('0x2')});};exports['update']=function(_0x45b293,_0x340231){return client[_0x27ec('0x3')](_0x27ec('0x4'),{'body':_0x340231,'options':{'where':{'uniqueid':_0x45b293},'order':[['id',_0x27ec('0x5')]],'limit':0x1},'log':_0x27ec('0x4')});}; \ No newline at end of file +var _0x3fec=['CreateChatQueueReport','update','DESC','UpdateChatQueueReport','../client','Request'];(function(_0x1fc122,_0x5e2c17){var _0xa2cb13=function(_0x263b13){while(--_0x263b13){_0x1fc122['push'](_0x1fc122['shift']());}};_0xa2cb13(++_0x5e2c17);}(_0x3fec,0x1ba));var _0xc3fe=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3fec[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0xc3fe('0x0'));exports['create']=function(_0x502342){return client[_0xc3fe('0x1')](_0xc3fe('0x2'),{'body':_0x502342,'log':'CreateChatQueueReport'});};exports[_0xc3fe('0x3')]=function(_0x4f85a4,_0x53a208){return client[_0xc3fe('0x1')]('UpdateChatQueueReport',{'body':_0x53a208,'options':{'where':{'uniqueid':_0x4f85a4},'order':[['id',_0xc3fe('0x4')]],'limit':0x1},'log':_0xc3fe('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 94fa981..a4ee355 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 _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x1ccc1e,_0x31175f){var _0x587532=function(_0xcb666e){while(--_0xcb666e){_0x1ccc1e['push'](_0x1ccc1e['shift']());}};_0x587532(++_0x31175f);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'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 +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x239039,_0x3bd412){var _0xb5fb6c=function(_0x39750f){while(--_0x39750f){_0x239039['push'](_0x239039['shift']());}};_0xb5fb6c(++_0x3bd412);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'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 43ae6a5..d66a8f9 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 _0xe091=['Request','../client','create'];(function(_0xe506cf,_0x526c94){var _0x8228c=function(_0x2625a6){while(--_0x2625a6){_0xe506cf['push'](_0xe506cf['shift']());}};_0x8228c(++_0x526c94);}(_0xe091,0x7c));var _0x1e09=function(_0xb95c94,_0x104635){_0xb95c94=_0xb95c94-0x0;var _0x29391e=_0xe091[_0xb95c94];return _0x29391e;};'use strict';var client=require(_0x1e09('0x0'));exports[_0x1e09('0x1')]=function(_0x4d5d1){return client[_0x1e09('0x2')]('CreateFaxMessage',{'body':_0x4d5d1,'log':'createFaxMessage'});}; \ No newline at end of file +var _0xe351=['create','createFaxMessage','../client'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xe351,0x1c7));var _0x1e35=function(_0x5b795d,_0x48821a){_0x5b795d=_0x5b795d-0x0;var _0x146285=_0xe351[_0x5b795d];return _0x146285;};'use strict';var client=require(_0x1e35('0x0'));exports[_0x1e35('0x1')]=function(_0x1e1577){return client['Request']('CreateFaxMessage',{'body':_0x1e1577,'log':_0x1e35('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 8bdda76..e116bc8 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 _0x8562=['online','faxPause','../client','getFaxQueues','Request','GetFaxQueue','name','timeout','strategy','User','Agents'];(function(_0x50d352,_0x12407a){var _0x298457=function(_0x862b0e){while(--_0x862b0e){_0x50d352['push'](_0x50d352['shift']());}};_0x298457(++_0x12407a);}(_0x8562,0x16d));var _0x2856=function(_0x1c8df2,_0x3366bd){_0x1c8df2=_0x1c8df2-0x0;var _0x308a2c=_0x8562[_0x1c8df2];return _0x308a2c;};'use strict';var client=require(_0x2856('0x0'));exports[_0x2856('0x1')]=function(){return function(){return client[_0x2856('0x2')](_0x2856('0x3'),{'options':{'raw':![],'attributes':['id',_0x2856('0x4'),_0x2856('0x5'),_0x2856('0x6')],'include':[{'model':_0x2856('0x7'),'as':_0x2856('0x8'),'attributes':['id',_0x2856('0x4'),_0x2856('0x9'),_0x2856('0xa')]}]},'log':_0x2856('0x1')});};}; \ No newline at end of file +var _0xea47=['Request','GetFaxQueue','strategy','User','Agents','name','faxPause','../client','getFaxQueues'];(function(_0x1551ed,_0x5cc3ce){var _0x499928=function(_0x41b8d5){while(--_0x41b8d5){_0x1551ed['push'](_0x1551ed['shift']());}};_0x499928(++_0x5cc3ce);}(_0xea47,0x142));var _0x7ea4=function(_0x3bc793,_0x466086){_0x3bc793=_0x3bc793-0x0;var _0x10944b=_0xea47[_0x3bc793];return _0x10944b;};'use strict';var client=require(_0x7ea4('0x0'));exports[_0x7ea4('0x1')]=function(){return function(){return client[_0x7ea4('0x2')](_0x7ea4('0x3'),{'options':{'raw':![],'attributes':['id','name','timeout',_0x7ea4('0x4')],'include':[{'model':_0x7ea4('0x5'),'as':_0x7ea4('0x6'),'attributes':['id',_0x7ea4('0x7'),'online',_0x7ea4('0x8')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index b0a7ea8..9394f28 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 _0xdee8=['DESC','create','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport'];(function(_0x1aa801,_0x43a83d){var _0x355adf=function(_0x145d75){while(--_0x145d75){_0x1aa801['push'](_0x1aa801['shift']());}};_0x355adf(++_0x43a83d);}(_0xdee8,0xd3));var _0x8dee=function(_0x14f444,_0x5b0c28){_0x14f444=_0x14f444-0x0;var _0x34fd77=_0xdee8[_0x14f444];return _0x34fd77;};'use strict';var client=require('../client');exports[_0x8dee('0x0')]=function(_0x546ede){return client[_0x8dee('0x1')](_0x8dee('0x2'),{'body':_0x546ede,'log':_0x8dee('0x2')});};exports[_0x8dee('0x3')]=function(_0x20f455,_0x3e8c89){return client[_0x8dee('0x1')](_0x8dee('0x4'),{'body':_0x3e8c89,'options':{'where':{'uniqueid':_0x20f455},'order':[['id',_0x8dee('0x5')]],'limit':0x1},'log':_0x8dee('0x4')});}; \ No newline at end of file +var _0x9f7b=['DESC','create','CreateFaxQueueReport','update','Request','UpdateFaxQueueReport'];(function(_0x2e6e60,_0x2cf779){var _0x264b10=function(_0x3ea015){while(--_0x3ea015){_0x2e6e60['push'](_0x2e6e60['shift']());}};_0x264b10(++_0x2cf779);}(_0x9f7b,0xf1));var _0xb9f7=function(_0x2db684,_0x5d6706){_0x2db684=_0x2db684-0x0;var _0x437b12=_0x9f7b[_0x2db684];return _0x437b12;};'use strict';var client=require('../client');exports[_0xb9f7('0x0')]=function(_0x3b890e){return client['Request'](_0xb9f7('0x1'),{'body':_0x3b890e,'log':_0xb9f7('0x1')});};exports[_0xb9f7('0x2')]=function(_0x645bb2,_0x219351){return client[_0xb9f7('0x3')](_0xb9f7('0x4'),{'body':_0x219351,'options':{'where':{'uniqueid':_0x645bb2},'order':[['id',_0xb9f7('0x5')]],'limit':0x1},'log':_0xb9f7('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index e86a618..01f50c9 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 _0x5308=['../client','Request','GetInterval','name','Intervals','interval','getIntervals'];(function(_0x2b7ade,_0x2fc47c){var _0x12db42=function(_0x1744d3){while(--_0x1744d3){_0x2b7ade['push'](_0x2b7ade['shift']());}};_0x12db42(++_0x2fc47c);}(_0x5308,0xd9));var _0x8530=function(_0x2abc3d,_0x48edca){_0x2abc3d=_0x2abc3d-0x0;var _0x252745=_0x5308[_0x2abc3d];return _0x252745;};'use strict';var client=require(_0x8530('0x0'));exports['getIntervals']=function(){return function(){return client[_0x8530('0x1')](_0x8530('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x8530('0x3')],'include':[{'model':'Interval','as':_0x8530('0x4'),'attributes':['id','name',_0x8530('0x5')]}]},'log':_0x8530('0x6')});};}; \ No newline at end of file +var _0x4c26=['Request','GetInterval','Interval','name','interval','../client','getIntervals'];(function(_0x1e5c59,_0x187266){var _0x17038d=function(_0x2de914){while(--_0x2de914){_0x1e5c59['push'](_0x1e5c59['shift']());}};_0x17038d(++_0x187266);}(_0x4c26,0x147));var _0x64c2=function(_0x1a6de6,_0x133034){_0x1a6de6=_0x1a6de6-0x0;var _0x42daf9=_0x4c26[_0x1a6de6];return _0x42daf9;};'use strict';var client=require(_0x64c2('0x0'));exports[_0x64c2('0x1')]=function(){return function(){return client[_0x64c2('0x2')](_0x64c2('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x64c2('0x4'),'as':'Intervals','attributes':['id',_0x64c2('0x5'),_0x64c2('0x6')]}]},'log':'getIntervals'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index f9c6b10..af09cce 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 _0x1eba=['addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x4d2993,_0x1c9473){_0x4d2993=_0x4d2993-0x0;var _0x427374=_0x1eba[_0x4d2993];return _0x427374;};'use strict';var client=require(_0xa1eb('0x0'));exports[_0xa1eb('0x1')]=function(_0x406a58,_0x2158d5){return client[_0xa1eb('0x2')]('UpdateMailInteraction',{'body':_0x2158d5,'options':{'where':{'id':_0x406a58}},'log':'updateMailInteraction'});};exports[_0xa1eb('0x3')]=function(_0x34be5a,_0x16a13a){return client[_0xa1eb('0x2')](_0xa1eb('0x4'),{'body':_0x16a13a,'options':{'where':{'id':_0x34be5a}},'log':_0xa1eb('0x5')});}; \ No newline at end of file +var _0x1893=['Request','UpdateMailInteraction','updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction'];(function(_0x459b56,_0x50366c){var _0x3707da=function(_0x23a993){while(--_0x23a993){_0x459b56['push'](_0x459b56['shift']());}};_0x3707da(++_0x50366c);}(_0x1893,0xa2));var _0x3189=function(_0x42152e,_0x509b93){_0x42152e=_0x42152e-0x0;var _0x57bb09=_0x1893[_0x42152e];return _0x57bb09;};'use strict';var client=require('../client');exports['update']=function(_0x1bfe8b,_0x3aec2b){return client[_0x3189('0x0')](_0x3189('0x1'),{'body':_0x3aec2b,'options':{'where':{'id':_0x1bfe8b}},'log':_0x3189('0x2')});};exports[_0x3189('0x3')]=function(_0x3953a2,_0x5371db){return client[_0x3189('0x0')](_0x3189('0x4'),{'body':_0x5371db,'options':{'where':{'id':_0x3953a2}},'log':_0x3189('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index d2a7fe6..aa72052 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 _0x4ee2=['../client','create','Request','CreateMailMessage','createMailMessage'];(function(_0x34dd3c,_0x12616c){var _0x19beab=function(_0x327c96){while(--_0x327c96){_0x34dd3c['push'](_0x34dd3c['shift']());}};_0x19beab(++_0x12616c);}(_0x4ee2,0x1e0));var _0x24ee=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x4ee2[_0x59ee6f];return _0x4c0979;};'use strict';var client=require(_0x24ee('0x0'));exports[_0x24ee('0x1')]=function(_0xa1090c){return client[_0x24ee('0x2')](_0x24ee('0x3'),{'body':_0xa1090c,'log':_0x24ee('0x4')});}; \ No newline at end of file +var _0xad21=['../client','CreateMailMessage'];(function(_0x48d0e0,_0x6a4bc){var _0x174eea=function(_0x25d66b){while(--_0x25d66b){_0x48d0e0['push'](_0x48d0e0['shift']());}};_0x174eea(++_0x6a4bc);}(_0xad21,0x98));var _0x1ad2=function(_0x2675da,_0x5a250e){_0x2675da=_0x2675da-0x0;var _0x5e6153=_0xad21[_0x2675da];return _0x5e6153;};'use strict';var client=require(_0x1ad2('0x0'));exports['create']=function(_0x50a2d2){return client['Request'](_0x1ad2('0x1'),{'body':_0x50a2d2,'log':'createMailMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 77d5125..ef3b99e 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 _0xff32=['Request','name','strategy','User','Agents','online','mailPause','../client'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0xff32,0xff));var _0x2ff3=function(_0x19f670,_0x36d23f){_0x19f670=_0x19f670-0x0;var _0x3ffd49=_0xff32[_0x19f670];return _0x3ffd49;};'use strict';var client=require(_0x2ff3('0x0'));exports['getMailQueues']=function(){return function(){return client[_0x2ff3('0x1')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0x2ff3('0x2'),'timeout',_0x2ff3('0x3')],'include':[{'model':_0x2ff3('0x4'),'as':_0x2ff3('0x5'),'attributes':['id',_0x2ff3('0x2'),_0x2ff3('0x6'),_0x2ff3('0x7')]}]},'log':'getMailQueues'});};}; \ No newline at end of file +var _0x43e7=['GetMailQueue','name','timeout','strategy','Agents','online','getMailQueues','Request'];(function(_0x59c398,_0x2e2f17){var _0xf4325b=function(_0x473a7e){while(--_0x473a7e){_0x59c398['push'](_0x59c398['shift']());}};_0xf4325b(++_0x2e2f17);}(_0x43e7,0xb6));var _0x743e=function(_0x4358f5,_0x5b1ac6){_0x4358f5=_0x4358f5-0x0;var _0x4d8104=_0x43e7[_0x4358f5];return _0x4d8104;};'use strict';var client=require('../client');exports[_0x743e('0x0')]=function(){return function(){return client[_0x743e('0x1')](_0x743e('0x2'),{'options':{'raw':![],'attributes':['id',_0x743e('0x3'),_0x743e('0x4'),_0x743e('0x5')],'include':[{'model':'User','as':_0x743e('0x6'),'attributes':['id',_0x743e('0x3'),_0x743e('0x7'),'mailPause']}]},'log':_0x743e('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 9d321c6..181f77a 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 _0x7a08=['Request','CreateMailQueueReport','UpdateMailQueueReport','DESC','../client'];(function(_0x1b6c6d,_0x2983b0){var _0x290d9d=function(_0x5b9779){while(--_0x5b9779){_0x1b6c6d['push'](_0x1b6c6d['shift']());}};_0x290d9d(++_0x2983b0);}(_0x7a08,0x77));var _0x87a0=function(_0x31218c,_0x28ae34){_0x31218c=_0x31218c-0x0;var _0x13e4ab=_0x7a08[_0x31218c];return _0x13e4ab;};'use strict';var client=require(_0x87a0('0x0'));exports['create']=function(_0x37105d){return client[_0x87a0('0x1')](_0x87a0('0x2'),{'body':_0x37105d,'log':_0x87a0('0x2')});};exports['update']=function(_0x4dc302,_0x416fc8){return client[_0x87a0('0x1')](_0x87a0('0x3'),{'body':_0x416fc8,'options':{'where':{'uniqueid':_0x4dc302},'order':[['id',_0x87a0('0x4')]],'limit':0x1},'log':_0x87a0('0x3')});}; \ No newline at end of file +var _0x33f2=['CreateMailQueueReport','update','Request','UpdateMailQueueReport','create'];(function(_0x4ee45f,_0xee1d50){var _0xf2f125=function(_0x251db5){while(--_0x251db5){_0x4ee45f['push'](_0x4ee45f['shift']());}};_0xf2f125(++_0xee1d50);}(_0x33f2,0x176));var _0x233f=function(_0x2ff739,_0x1c8e0f){_0x2ff739=_0x2ff739-0x0;var _0x12dc13=_0x33f2[_0x2ff739];return _0x12dc13;};'use strict';var client=require('../client');exports[_0x233f('0x0')]=function(_0x4beccf){return client['Request'](_0x233f('0x1'),{'body':_0x4beccf,'log':'CreateMailQueueReport'});};exports[_0x233f('0x2')]=function(_0x3e7980,_0x3708fb){return client[_0x233f('0x3')]('UpdateMailQueueReport',{'body':_0x3708fb,'options':{'where':{'uniqueid':_0x3e7980},'order':[['id','DESC']],'limit':0x1},'log':_0x233f('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index b29d5a2..bcf130e 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 _0x7a64=['AddTagsToOpenchannelInteraction','addTagsToChatInteraction','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags'];(function(_0x4109e7,_0x2c8158){var _0x28d807=function(_0x386518){while(--_0x386518){_0x4109e7['push'](_0x4109e7['shift']());}};_0x28d807(++_0x2c8158);}(_0x7a64,0x14b));var _0x47a6=function(_0x87e33d,_0x34347b){_0x87e33d=_0x87e33d-0x0;var _0x393a0c=_0x7a64[_0x87e33d];return _0x393a0c;};'use strict';var client=require('../client');exports[_0x47a6('0x0')]=function(_0x1887d0,_0xac1200){return client[_0x47a6('0x1')](_0x47a6('0x2'),{'body':_0xac1200,'options':{'where':{'id':_0x1887d0}},'log':_0x47a6('0x3')});};exports[_0x47a6('0x4')]=function(_0x3ea419,_0x5f534b){return client['Request'](_0x47a6('0x5'),{'body':_0x5f534b,'options':{'where':{'id':_0x3ea419}},'log':_0x47a6('0x6')});}; \ No newline at end of file +var _0x540d=['addTags','AddTagsToOpenchannelInteraction','Request','updateOpenchannelInteraction'];(function(_0x328bd3,_0x9cf5a5){var _0x458149=function(_0x3f60d9){while(--_0x3f60d9){_0x328bd3['push'](_0x328bd3['shift']());}};_0x458149(++_0x9cf5a5);}(_0x540d,0x136));var _0xd540=function(_0x1aa093,_0x271935){_0x1aa093=_0x1aa093-0x0;var _0x2493f2=_0x540d[_0x1aa093];return _0x2493f2;};'use strict';var client=require('../client');exports['update']=function(_0x420b08,_0x12a288){return client[_0xd540('0x0')]('UpdateOpenchannelInteraction',{'body':_0x12a288,'options':{'where':{'id':_0x420b08}},'log':_0xd540('0x1')});};exports[_0xd540('0x2')]=function(_0x2880d2,_0x3f19cf){return client[_0xd540('0x0')](_0xd540('0x3'),{'body':_0x3f19cf,'options':{'where':{'id':_0x2880d2}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 4ac793d..7d5572c 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 _0x96f5=['CreateOpenchannelMessage','createOpenchannelMessage','create','Request'];(function(_0x161f03,_0x5d141b){var _0x2f396f=function(_0x2c1b7a){while(--_0x2c1b7a){_0x161f03['push'](_0x161f03['shift']());}};_0x2f396f(++_0x5d141b);}(_0x96f5,0x1da));var _0x596f=function(_0x22407c,_0x407f57){_0x22407c=_0x22407c-0x0;var _0x51b443=_0x96f5[_0x22407c];return _0x51b443;};'use strict';var client=require('../client');exports[_0x596f('0x0')]=function(_0x2ba162){return client[_0x596f('0x1')](_0x596f('0x2'),{'body':_0x2ba162,'log':_0x596f('0x3')});}; \ No newline at end of file +var _0x297d=['CreateOpenchannelMessage','createOpenchannelMessage','Request'];(function(_0x16cc7b,_0x410363){var _0x52ca3e=function(_0x34d371){while(--_0x34d371){_0x16cc7b['push'](_0x16cc7b['shift']());}};_0x52ca3e(++_0x410363);}(_0x297d,0x1b8));var _0xd297=function(_0x3bffc5,_0x288950){_0x3bffc5=_0x3bffc5-0x0;var _0x1b666b=_0x297d[_0x3bffc5];return _0x1b666b;};'use strict';var client=require('../client');exports['create']=function(_0x247c8a){return client[_0xd297('0x0')](_0xd297('0x1'),{'body':_0x247c8a,'log':_0xd297('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 6c29d24..6f91239 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 _0xb377=['Request','GetOpenchannelQueue','name','timeout','strategy','User','Agents','online','openchannelPause','../client','getOpenchannelQueues'];(function(_0xd21044,_0x8d8840){var _0x5a0d7d=function(_0x1e2b5e){while(--_0x1e2b5e){_0xd21044['push'](_0xd21044['shift']());}};_0x5a0d7d(++_0x8d8840);}(_0xb377,0x1b6));var _0x7b37=function(_0x48cd95,_0x37aaf6){_0x48cd95=_0x48cd95-0x0;var _0x1cb48d=_0xb377[_0x48cd95];return _0x1cb48d;};'use strict';var client=require(_0x7b37('0x0'));exports[_0x7b37('0x1')]=function(){return function(){return client[_0x7b37('0x2')](_0x7b37('0x3'),{'options':{'raw':![],'attributes':['id',_0x7b37('0x4'),_0x7b37('0x5'),_0x7b37('0x6')],'include':[{'model':_0x7b37('0x7'),'as':_0x7b37('0x8'),'attributes':['id',_0x7b37('0x4'),_0x7b37('0x9'),_0x7b37('0xa')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file +var _0x61d0=['User','Agents','openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name','strategy'];(function(_0x2ade6f,_0x18d576){var _0x28fa0f=function(_0x4ad67c){while(--_0x4ad67c){_0x2ade6f['push'](_0x2ade6f['shift']());}};_0x28fa0f(++_0x18d576);}(_0x61d0,0x123));var _0x061d=function(_0x2dd6b1,_0x4485d7){_0x2dd6b1=_0x2dd6b1-0x0;var _0x494306=_0x61d0[_0x2dd6b1];return _0x494306;};'use strict';var client=require(_0x061d('0x0'));exports[_0x061d('0x1')]=function(){return function(){return client[_0x061d('0x2')](_0x061d('0x3'),{'options':{'raw':![],'attributes':['id',_0x061d('0x4'),'timeout',_0x061d('0x5')],'include':[{'model':_0x061d('0x6'),'as':_0x061d('0x7'),'attributes':['id',_0x061d('0x4'),'online',_0x061d('0x8')]}]},'log':_0x061d('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 8c22580..034b025 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 _0x675e=['Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','create'];(function(_0x1cd73c,_0x3fdd03){var _0xc0d36f=function(_0x1d6de0){while(--_0x1d6de0){_0x1cd73c['push'](_0x1cd73c['shift']());}};_0xc0d36f(++_0x3fdd03);}(_0x675e,0x18a));var _0xe675=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0x675e[_0x47a349];return _0x18ab75;};'use strict';var client=require('../client');exports[_0xe675('0x0')]=function(_0x39f142){return client[_0xe675('0x1')](_0xe675('0x2'),{'body':_0x39f142,'log':'CreateOpenchannelQueueReport'});};exports[_0xe675('0x3')]=function(_0x2ab603,_0x1a30f8){return client[_0xe675('0x1')](_0xe675('0x4'),{'body':_0x1a30f8,'options':{'where':{'uniqueid':_0x2ab603},'order':[['id','DESC']],'limit':0x1},'log':_0xe675('0x4')});}; \ No newline at end of file +var _0x9018=['Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','../client','create'];(function(_0x10fd0b,_0x4d8bc2){var _0x555057=function(_0x2ad72b){while(--_0x2ad72b){_0x10fd0b['push'](_0x10fd0b['shift']());}};_0x555057(++_0x4d8bc2);}(_0x9018,0xc2));var _0x8901=function(_0x3c4d65,_0x49181e){_0x3c4d65=_0x3c4d65-0x0;var _0x1ad12a=_0x9018[_0x3c4d65];return _0x1ad12a;};'use strict';var client=require(_0x8901('0x0'));exports[_0x8901('0x1')]=function(_0x270687){return client[_0x8901('0x2')](_0x8901('0x3'),{'body':_0x270687,'log':'CreateOpenchannelQueueReport'});};exports[_0x8901('0x4')]=function(_0x2e8795,_0x28650c){return client[_0x8901('0x2')](_0x8901('0x5'),{'body':_0x28650c,'options':{'where':{'uniqueid':_0x2e8795},'order':[['id',_0x8901('0x6')]],'limit':0x1},'log':_0x8901('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 4429adf..7cdc485 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 _0xcca7=['../client','update','updateSmsInteraction','Request','AddTagsToSmsInteraction','addTagsToSmsInteraction'];(function(_0x137d29,_0x236205){var _0x5983f9=function(_0x42e55b){while(--_0x42e55b){_0x137d29['push'](_0x137d29['shift']());}};_0x5983f9(++_0x236205);}(_0xcca7,0x1aa));var _0x7cca=function(_0x10107e,_0x22fafe){_0x10107e=_0x10107e-0x0;var _0x9225e8=_0xcca7[_0x10107e];return _0x9225e8;};'use strict';var client=require(_0x7cca('0x0'));exports[_0x7cca('0x1')]=function(_0x2f3574,_0x33db4f){return client['Request']('UpdateSmsInteraction',{'body':_0x33db4f,'options':{'where':{'id':_0x2f3574}},'log':_0x7cca('0x2')});};exports['addTags']=function(_0x3b86a4,_0x9523f7){return client[_0x7cca('0x3')](_0x7cca('0x4'),{'body':_0x9523f7,'options':{'where':{'id':_0x3b86a4}},'log':_0x7cca('0x5')});}; \ No newline at end of file +var _0xf23b=['update','Request','updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client'];(function(_0x2bb28d,_0x279867){var _0x2a3077=function(_0x55c44b){while(--_0x55c44b){_0x2bb28d['push'](_0x2bb28d['shift']());}};_0x2a3077(++_0x279867);}(_0xf23b,0x133));var _0xbf23=function(_0x4f564f,_0x45ea71){_0x4f564f=_0x4f564f-0x0;var _0x467f33=_0xf23b[_0x4f564f];return _0x467f33;};'use strict';var client=require(_0xbf23('0x0'));exports[_0xbf23('0x1')]=function(_0x18dde4,_0x1c8f27){return client[_0xbf23('0x2')]('UpdateSmsInteraction',{'body':_0x1c8f27,'options':{'where':{'id':_0x18dde4}},'log':_0xbf23('0x3')});};exports[_0xbf23('0x4')]=function(_0x14ff3b,_0x5ecbf5){return client[_0xbf23('0x2')](_0xbf23('0x5'),{'body':_0x5ecbf5,'options':{'where':{'id':_0x14ff3b}},'log':_0xbf23('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 603e2c1..cab87b4 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 _0xc7b3=['Request','createSmsMessage'];(function(_0xfba67,_0x1c6e13){var _0x29649d=function(_0x34d2b2){while(--_0x34d2b2){_0xfba67['push'](_0xfba67['shift']());}};_0x29649d(++_0x1c6e13);}(_0xc7b3,0x1d8));var _0x3c7b=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xc7b3[_0x199572];return _0x13cfa3;};'use strict';var client=require('../client');exports['create']=function(_0xb76434){return client[_0x3c7b('0x0')]('CreateSmsMessage',{'body':_0xb76434,'log':_0x3c7b('0x1')});}; \ No newline at end of file +var _0x354d=['Request','CreateSmsMessage','create'];(function(_0x4df6f9,_0x44bd65){var _0x4b1a73=function(_0xf5adb7){while(--_0xf5adb7){_0x4df6f9['push'](_0x4df6f9['shift']());}};_0x4b1a73(++_0x44bd65);}(_0x354d,0x176));var _0xd354=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x354d[_0x59ee6f];return _0x4c0979;};'use strict';var client=require('../client');exports[_0xd354('0x0')]=function(_0x18300a){return client[_0xd354('0x1')](_0xd354('0x2'),{'body':_0x18300a,'log':'createSmsMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index f40dfae..367708e 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(_0x1cca3f,_0x1f765b){var _0x4bc82c=function(_0x531fbe){while(--_0x531fbe){_0x1cca3f['push'](_0x1cca3f['shift']());}};_0x4bc82c(++_0x1f765b);}(_0xe706,0xa3));var _0x6e70=function(_0x5c0dfb,_0x29fe5e){_0x5c0dfb=_0x5c0dfb-0x0;var _0x49be35=_0xe706[_0x5c0dfb];return _0x49be35;};'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 _0xd8b0=['timeout','strategy','User','Agents','name','../client','getSmsQueues'];(function(_0x2cac3b,_0x221601){var _0x229344=function(_0x505108){while(--_0x505108){_0x2cac3b['push'](_0x2cac3b['shift']());}};_0x229344(++_0x221601);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var client=require(_0x0d8b('0x0'));exports[_0x0d8b('0x1')]=function(){return function(){return client['Request']('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0d8b('0x2'),_0x0d8b('0x3')],'include':[{'model':_0x0d8b('0x4'),'as':_0x0d8b('0x5'),'attributes':['id',_0x0d8b('0x6'),'online','smsPause']}]},'log':_0x0d8b('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index eedcf92..d63fdac 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 _0x34e8=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC','../client'];(function(_0x47d965,_0x3d67b8){var _0x4521c5=function(_0x520ced){while(--_0x520ced){_0x47d965['push'](_0x47d965['shift']());}};_0x4521c5(++_0x3d67b8);}(_0x34e8,0x12c));var _0x834e=function(_0x2c87d6,_0x47d137){_0x2c87d6=_0x2c87d6-0x0;var _0x425bd3=_0x34e8[_0x2c87d6];return _0x425bd3;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(_0x8b339){return client[_0x834e('0x2')]('CreateSmsQueueReport',{'body':_0x8b339,'log':_0x834e('0x3')});};exports[_0x834e('0x4')]=function(_0x472111,_0x31bf20){return client[_0x834e('0x2')](_0x834e('0x5'),{'body':_0x31bf20,'options':{'where':{'uniqueid':_0x472111},'order':[['id',_0x834e('0x6')]],'limit':0x1},'log':'UpdateSmsQueueReport'});}; \ No newline at end of file +var _0x34e8=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC','../client'];(function(_0x3792a5,_0x24b37c){var _0x193a94=function(_0xbc9cbc){while(--_0xbc9cbc){_0x3792a5['push'](_0x3792a5['shift']());}};_0x193a94(++_0x24b37c);}(_0x34e8,0x12c));var _0x834e=function(_0x2318f4,_0x1b2135){_0x2318f4=_0x2318f4-0x0;var _0xa4e110=_0x34e8[_0x2318f4];return _0xa4e110;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(_0x8b339){return client[_0x834e('0x2')]('CreateSmsQueueReport',{'body':_0x8b339,'log':_0x834e('0x3')});};exports[_0x834e('0x4')]=function(_0x472111,_0x31bf20){return client[_0x834e('0x2')](_0x834e('0x5'),{'body':_0x31bf20,'options':{'where':{'uniqueid':_0x472111},'order':[['id',_0x834e('0x6')]],'limit':0x1},'log':'UpdateSmsQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index ad421ca..07620a6 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(_0x2cda7,_0x53f7bc){var _0x1cfabd=function(_0x6fad3f){while(--_0x6fad3f){_0x2cda7['push'](_0x2cda7['shift']());}};_0x1cfabd(++_0x53f7bc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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(_0x183cc8,_0x2eb68d){var _0x164d5d=function(_0xf2ad29){while(--_0xf2ad29){_0x183cc8['push'](_0x183cc8['shift']());}};_0x164d5d(++_0x2eb68d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'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 b408ad8..f0ea00c 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 _0x8375=['../client','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x8375,0xa8));var _0x5837=function(_0x352dd4,_0x4ebd50){_0x352dd4=_0x352dd4-0x0;var _0x311855=_0x8375[_0x352dd4];return _0x311855;};'use strict';var client=require(_0x5837('0x0'));exports[_0x5837('0x1')]=function(_0xe2a8d5,_0x50482c){return client[_0x5837('0x2')](_0x5837('0x3'),{'body':_0x50482c,'options':{'where':{'id':_0xe2a8d5}},'log':_0x5837('0x4')});};exports[_0x5837('0x5')]=function(_0x317452,_0x1edfc5){return client['Request'](_0x5837('0x6'),{'body':_0x1edfc5,'options':{'where':{'id':_0x317452}},'log':_0x5837('0x7')});}; \ No newline at end of file +var _0x7919=['UpdateWhatsappInteraction','updateWhatsappInteraction','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','Request'];(function(_0x7d83d2,_0x23103c){var _0x28aea7=function(_0x41ed31){while(--_0x41ed31){_0x7d83d2['push'](_0x7d83d2['shift']());}};_0x28aea7(++_0x23103c);}(_0x7919,0xeb));var _0x9791=function(_0x3e8dac,_0x1b1c37){_0x3e8dac=_0x3e8dac-0x0;var _0x9ca12=_0x7919[_0x3e8dac];return _0x9ca12;};'use strict';var client=require(_0x9791('0x0'));exports[_0x9791('0x1')]=function(_0x466be6,_0x1c714b){return client[_0x9791('0x2')](_0x9791('0x3'),{'body':_0x1c714b,'options':{'where':{'id':_0x466be6}},'log':_0x9791('0x4')});};exports['addTags']=function(_0x13a1a5,_0x193919){return client['Request'](_0x9791('0x5'),{'body':_0x193919,'options':{'where':{'id':_0x13a1a5}},'log':_0x9791('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index d55feb5..b0ecc7c 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 _0xeecf=['CreateWhatsappMessage','createWhatsappMessage','create'];(function(_0x234ae1,_0x42bdd6){var _0x227ba0=function(_0x1f6531){while(--_0x1f6531){_0x234ae1['push'](_0x234ae1['shift']());}};_0x227ba0(++_0x42bdd6);}(_0xeecf,0x101));var _0xfeec=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xeecf[_0x465028];return _0xb783d4;};'use strict';var client=require('../client');exports[_0xfeec('0x0')]=function(_0x579e24){return client['Request'](_0xfeec('0x1'),{'body':_0x579e24,'log':_0xfeec('0x2')});}; \ No newline at end of file +var _0x125f=['../client','create','Request','createWhatsappMessage'];(function(_0x27b868,_0x2ba4c9){var _0x30c280=function(_0x2d75da){while(--_0x2d75da){_0x27b868['push'](_0x27b868['shift']());}};_0x30c280(++_0x2ba4c9);}(_0x125f,0x134));var _0xf125=function(_0x37fcd0,_0x141d80){_0x37fcd0=_0x37fcd0-0x0;var _0x3869d4=_0x125f[_0x37fcd0];return _0x3869d4;};'use strict';var client=require(_0xf125('0x0'));exports[_0xf125('0x1')]=function(_0x58396a){return client[_0xf125('0x2')]('CreateWhatsappMessage',{'body':_0x58396a,'log':_0xf125('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 04a903c..8a90b8e 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 _0x061b=['name','timeout','strategy','User','Agents','whatsappPause','../client','getWhatsappQueues','Request','GetWhatsappQueue'];(function(_0x2c60c5,_0x50eba1){var _0x6f7df4=function(_0x36f382){while(--_0x36f382){_0x2c60c5['push'](_0x2c60c5['shift']());}};_0x6f7df4(++_0x50eba1);}(_0x061b,0x7e));var _0xb061=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x061b[_0x1694f5];return _0x5b4321;};'use strict';var client=require(_0xb061('0x0'));exports[_0xb061('0x1')]=function(){return function(){return client[_0xb061('0x2')](_0xb061('0x3'),{'options':{'raw':![],'attributes':['id',_0xb061('0x4'),_0xb061('0x5'),_0xb061('0x6')],'include':[{'model':_0xb061('0x7'),'as':_0xb061('0x8'),'attributes':['id','name','online',_0xb061('0x9')]}]},'log':_0xb061('0x1')});};}; \ No newline at end of file +var _0x360c=['../client','getWhatsappQueues','GetWhatsappQueue','name','strategy','User','Agents','online','whatsappPause'];(function(_0xff6f0f,_0x56e42a){var _0xae38c8=function(_0x3ed560){while(--_0x3ed560){_0xff6f0f['push'](_0xff6f0f['shift']());}};_0xae38c8(++_0x56e42a);}(_0x360c,0x1e6));var _0xc360=function(_0x220e3d,_0x528fe7){_0x220e3d=_0x220e3d-0x0;var _0x13c3ca=_0x360c[_0x220e3d];return _0x13c3ca;};'use strict';var client=require(_0xc360('0x0'));exports[_0xc360('0x1')]=function(){return function(){return client['Request'](_0xc360('0x2'),{'options':{'raw':![],'attributes':['id',_0xc360('0x3'),'timeout',_0xc360('0x4')],'include':[{'model':_0xc360('0x5'),'as':_0xc360('0x6'),'attributes':['id',_0xc360('0x3'),_0xc360('0x7'),_0xc360('0x8')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 5095f23..d3a2056 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 _0x5d0d=['UpdateWhatsappQueueReport','DESC','../client','create','CreateWhatsappQueueReport','update','Request'];(function(_0x5019d4,_0x31493b){var _0x59093a=function(_0x34f811){while(--_0x34f811){_0x5019d4['push'](_0x5019d4['shift']());}};_0x59093a(++_0x31493b);}(_0x5d0d,0xc6));var _0xd5d0=function(_0x14fad0,_0x278d75){_0x14fad0=_0x14fad0-0x0;var _0x5c665f=_0x5d0d[_0x14fad0];return _0x5c665f;};'use strict';var client=require(_0xd5d0('0x0'));exports[_0xd5d0('0x1')]=function(_0x49810e){return client['Request'](_0xd5d0('0x2'),{'body':_0x49810e,'log':'CreateWhatsappQueueReport'});};exports[_0xd5d0('0x3')]=function(_0x5bd4cc,_0x47896a){return client[_0xd5d0('0x4')](_0xd5d0('0x5'),{'body':_0x47896a,'options':{'where':{'uniqueid':_0x5bd4cc},'order':[['id',_0xd5d0('0x6')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file +var _0x9d0d=['Request','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','create'];(function(_0x1cfacc,_0x167cca){var _0x5e8766=function(_0x49819e){while(--_0x49819e){_0x1cfacc['push'](_0x1cfacc['shift']());}};_0x5e8766(++_0x167cca);}(_0x9d0d,0x187));var _0xd9d0=function(_0x564d92,_0x2cef37){_0x564d92=_0x564d92-0x0;var _0x3cd8e5=_0x9d0d[_0x564d92];return _0x3cd8e5;};'use strict';var client=require('../client');exports[_0xd9d0('0x0')]=function(_0x427d89){return client[_0xd9d0('0x1')](_0xd9d0('0x2'),{'body':_0x427d89,'log':'CreateWhatsappQueueReport'});};exports['update']=function(_0x26b832,_0x2bf51b){return client[_0xd9d0('0x1')]('UpdateWhatsappQueueReport',{'body':_0x2bf51b,'options':{'where':{'uniqueid':_0x26b832},'order':[['id','DESC']],'limit':0x1},'log':_0xd9d0('0x3')});}; \ 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 5bfc4cd..89cad95 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 _0x7636=['number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','validate','length','error','[%s][AGENT]\x20%s','map','message','stop','find','agents','createQueue','atimeout','channel','rules','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','log','[%s][QUEUE]\x20%s','lodash','util','../../../../config/logger','./strategy','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'];(function(_0x5ce976,_0x4ad999){var _0x4f1374=function(_0x33db15){while(--_0x33db15){_0x5ce976['push'](_0x5ce976['shift']());}};_0x4f1374(++_0x4ad999);}(_0x7636,0xc1));var _0x6763=function(_0x25402e,_0x1ab8f2){_0x25402e=_0x25402e-0x0;var _0x168dbb=_0x7636[_0x25402e];return _0x168dbb;};'use strict';var schema=require('validate');var _=require(_0x6763('0x0'));var util=require(_0x6763('0x1'));var seqqueue=require('seq-queue');var logger=require(_0x6763('0x2'))('routing');var strategy=require(_0x6763('0x3'));var queue=schema({'name':{'type':'string','required':!![],'message':_0x6763('0x4')},'timeout':{'type':_0x6763('0x5'),'message':_0x6763('0x6')}});function writeLog(_0x4de736,_0x522e0d,_0x24965){return logger[_0x6763('0x7')](util[_0x6763('0x8')](_0x6763('0x9'),_0x4de736,_0x522e0d[_0x6763('0xa')],_0x24965));}function handleFindAgent(_0x599723){return function(_0x526b7d){return _0x526b7d['name']['toLowerCase']()===_0x599723[_0x6763('0xb')]();};}exports['consequence']=function(_0x219e83,_0x42be91,_0x122540,_0x440d94){return function(_0x9e0b99){try{var _0x2ebbca={'name':_0x42be91[0x0],'timeout':_0x42be91[0x1]};var _0x7be2db=queue[_0x6763('0xc')](_0x2ebbca,{'typecast':!![]});if(_0x7be2db[_0x6763('0xd')]){logger[_0x6763('0xe')](_0x6763('0xf'),_0x219e83,_[_0x6763('0x10')](_0x7be2db,_0x6763('0x11'))['join'](',\x20'));_0x9e0b99[_0x6763('0x12')]();}else{var _0x2c9733=_[_0x6763('0x13')](_0x122540[_0x6763('0x14')],handleFindAgent(_0x2ebbca['name']));if(_0x2c9733){var _0x137d5e=(_0x2ebbca['timeout']||0xa)*0x3e8;var _0xf53bcb,_0x1a7eda;var _0x3db698=seqqueue[_0x6763('0x15')](_0x137d5e);_0x3db698['id']=_0x219e83;_0x3db698[_0x6763('0x16')]=_0x137d5e;_0x3db698[_0x6763('0x17')]=_0x440d94[_0x6763('0x17')];writeLog(_0x219e83,_0x2c9733,util['format']('START:%s',_0x137d5e));_0x122540[_0x6763('0x18')][_0x219e83]['on']('end',function(){logger['info'](_0x6763('0x19'),_0x219e83);clearTimeout(_0x1a7eda);_0x1a7eda=undefined;_0x3db698[_0x6763('0x1a')]();if(_0x122540['rules'][_0x219e83]){delete _0x122540[_0x6763('0x18')][_0x219e83];}_0x9e0b99[_0x6763('0x12')]();});_0x122540[_0x6763('0x18')][_0x219e83]['on'](_0x6763('0x1b'),function(){if(_0x122540['rules'][_0x219e83]){delete _0x122540[_0x6763('0x18')][_0x219e83];}});_0x1a7eda=setTimeout(function(){logger[_0x6763('0x7')](_0x6763('0x1c'),_0x219e83);clearTimeout(_0x1a7eda);_0x3db698[_0x6763('0x1a')]();_0x9e0b99[_0x6763('0x1d')]();},_0x137d5e);strategy[_0x6763('0x1e')](_0x3db698,_0x2c9733,_0x122540,_0x440d94);}else{logger[_0x6763('0xe')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x219e83,_0x2ebbca[_0x6763('0xa')]);_0x9e0b99[_0x6763('0x12')]();}}}catch(_0x3fa57a){console[_0x6763('0x1f')](_0x3fa57a);logger[_0x6763('0xe')](_0x6763('0x20'),_0x219e83,_0x3fa57a['stack']);_0x9e0b99[_0x6763('0x12')]();}};}; \ No newline at end of file +var _0x357e=['name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','length','error','[%s][AGENT]\x20%s','map','message','join','stop','find','agents','timeout','createQueue','atimeout','channel','START:%s','rules','[%s][AGENT]\x20ROUTING\x20END','close','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','util','seq-queue','../../../../config/logger','./strategy'];(function(_0x11a287,_0x57df55){var _0x111e64=function(_0x34be85){while(--_0x34be85){_0x11a287['push'](_0x11a287['shift']());}};_0x111e64(++_0x57df55);}(_0x357e,0x1c2));var _0xe357=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x357e[_0x2c7618];return _0x5ce3f0;};'use strict';var schema=require(_0xe357('0x0'));var _=require('lodash');var util=require(_0xe357('0x1'));var seqqueue=require(_0xe357('0x2'));var logger=require(_0xe357('0x3'))('routing');var strategy=require(_0xe357('0x4'));var queue=schema({'name':{'type':'string','required':!![],'message':_0xe357('0x5')},'timeout':{'type':_0xe357('0x6'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x4aa349,_0x2a3885,_0x277bee){return logger[_0xe357('0x7')](util[_0xe357('0x8')](_0xe357('0x9'),_0x4aa349,_0x2a3885[_0xe357('0xa')],_0x277bee));}function handleFindAgent(_0x31b8d2){return function(_0x3029f0){return _0x3029f0['name'][_0xe357('0xb')]()===_0x31b8d2['toLowerCase']();};}exports['consequence']=function(_0xd0dece,_0xb29779,_0x3513e9,_0x5e98c2){return function(_0x39f1b3){try{var _0x2e08de={'name':_0xb29779[0x0],'timeout':_0xb29779[0x1]};var _0x5ac905=queue['validate'](_0x2e08de,{'typecast':!![]});if(_0x5ac905[_0xe357('0xc')]){logger[_0xe357('0xd')](_0xe357('0xe'),_0xd0dece,_[_0xe357('0xf')](_0x5ac905,_0xe357('0x10'))[_0xe357('0x11')](',\x20'));_0x39f1b3[_0xe357('0x12')]();}else{var _0x50a541=_[_0xe357('0x13')](_0x3513e9[_0xe357('0x14')],handleFindAgent(_0x2e08de[_0xe357('0xa')]));if(_0x50a541){var _0x167d56=(_0x2e08de[_0xe357('0x15')]||0xa)*0x3e8;var _0x27d499,_0x1e0ef2;var _0x23b72d=seqqueue[_0xe357('0x16')](_0x167d56);_0x23b72d['id']=_0xd0dece;_0x23b72d[_0xe357('0x17')]=_0x167d56;_0x23b72d[_0xe357('0x18')]=_0x5e98c2[_0xe357('0x18')];writeLog(_0xd0dece,_0x50a541,util[_0xe357('0x8')](_0xe357('0x19'),_0x167d56));_0x3513e9[_0xe357('0x1a')][_0xd0dece]['on']('end',function(){logger[_0xe357('0x7')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0xd0dece);clearTimeout(_0x1e0ef2);_0x1e0ef2=undefined;_0x23b72d['close']();if(_0x3513e9[_0xe357('0x1a')][_0xd0dece]){delete _0x3513e9[_0xe357('0x1a')][_0xd0dece];}_0x39f1b3['stop']();});_0x3513e9[_0xe357('0x1a')][_0xd0dece]['on']('complete',function(){if(_0x3513e9['rules'][_0xd0dece]){delete _0x3513e9[_0xe357('0x1a')][_0xd0dece];}});_0x1e0ef2=setTimeout(function(){logger['info'](_0xe357('0x1b'),_0xd0dece);clearTimeout(_0x1e0ef2);_0x23b72d[_0xe357('0x1c')]();_0x39f1b3[_0xe357('0x1d')]();},_0x167d56);strategy[_0xe357('0x1e')](_0x23b72d,_0x50a541,_0x3513e9,_0x5e98c2);}else{logger[_0xe357('0xd')](_0xe357('0x1f'),_0xd0dece,_0x2e08de['name']);_0x39f1b3[_0xe357('0x12')]();}}}catch(_0x4a11cb){console[_0xe357('0x20')](_0x4a11cb);logger[_0xe357('0xd')](_0xe357('0x21'),_0xd0dece,_0x4a11cb[_0xe357('0x22')]);_0x39f1b3[_0xe357('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 e0c8aa0..fb62f1b 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 _0x7695=['phone','chat','ChatWebsiteId','account','upperFirst','AccountId','created','Message','create','body','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','$LATEST','message','toString','amazonlex','providerResponse','then','dialogState','Failed','next','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','channel'];(function(_0x2d73fe,_0x1dc9e3){var _0x4d812b=function(_0x1e93d7){while(--_0x1e93d7){_0x2d73fe['push'](_0x2d73fe['shift']());}};_0x4d812b(++_0x1dc9e3);}(_0x7695,0x106));var _0x5769=function(_0x3d806e,_0x3da98b){_0x3d806e=_0x3d806e-0x0;var _0xc1b331=_0x7695[_0x3d806e];return _0xc1b331;};'use strict';var _=require(_0x5769('0x0'));var moment=require(_0x5769('0x1'));var AWS=require(_0x5769('0x2'));var utils=require(_0x5769('0x3'));var logger=require(_0x5769('0x4'))(_0x5769('0x5'));var rpc={'chatMessage':require(_0x5769('0x6')),'openchannelMessage':require(_0x5769('0x7')),'mailMessage':require(_0x5769('0x8')),'smsMessage':require(_0x5769('0x9')),'faxMessage':require(_0x5769('0xa')),'whatsappMessage':require(_0x5769('0xb'))};exports[_0x5769('0xc')]=function(_0x42db31,_0x2bc5d8){return function(_0xa97a5){try{if(!_['isNil'](this[_0x5769('0xd')][_0x5769('0xe')])){logger[_0x5769('0xf')](_0x5769('0x10'),_0x42db31,_0x5769('0x11'));return _0xa97a5['next']();}var _0x3bc720={'ContactId':this[_0x5769('0x12')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this['channel']==='sms'||this[_0x5769('0x13')]==='whatsapp'){_0x3bc720[_0x5769('0x14')]=this['interaction'][_0x5769('0x14')];}var _0x34524b=this[_0x5769('0x13')];if(_0x34524b===_0x5769('0x15')){_0x3bc720[_0x5769('0x16')]=this[_0x5769('0x17')]['id'];}else{_0x3bc720[_[_0x5769('0x18')](_0x34524b)+_0x5769('0x19')]=this[_0x5769('0x17')]['id'];}_0x3bc720[_[_0x5769('0x18')](_0x34524b)+'InteractionId']=this['interaction']['id'];if(this['interaction'][_0x5769('0x1a')]){var _0x4e14c0=_0x2bc5d8[0x4];if(!_['isEmpty'](_0x4e14c0)){_0x3bc720['body']=utils['getMustacheRender'](_0x4e14c0,this);return rpc[_0x34524b+_0x5769('0x1b')][_0x5769('0x1c')](_0x3bc720)['then'](function(_0x526878){logger[_0x5769('0xf')](_0x5769('0x10'),_0x42db31,_0x3bc720[_0x5769('0x1d')]);})[_0x5769('0x1e')](function(_0x280a93){logger[_0x5769('0x1f')]('[%s][AMAZONLEX]\x20%s',_0x42db31,JSON[_0x5769('0x20')](_0x280a93));})[_0x5769('0x21')](function(){logger[_0x5769('0xf')](_0x5769('0x22'),_0x42db31);_0xa97a5[_0x5769('0x23')]();});}else{logger[_0x5769('0xf')](_0x5769('0x24'),_0x42db31);_0xa97a5['stop']();}}else{var _0x152167=this;var _0x25c177=new AWS[(_0x5769('0x25'))]({'accessKeyId':_0x2bc5d8[0x0],'secretAccessKey':_0x2bc5d8[0x1],'region':_0x2bc5d8[0x2]});var _0x2c61d4={'botAlias':_0x5769('0x26'),'botName':_0x2bc5d8[0x3],'inputText':this[_0x5769('0x27')][_0x5769('0x1d')],'userId':this[_0x5769('0x13')]+':'+this[_0x5769('0xd')]['id'][_0x5769('0x28')]()};_0x25c177['postText'](_0x2c61d4,function(_0x2dc159,_0x7e97af){if(_0x2dc159){logger[_0x5769('0x1f')](_0x5769('0x10'),_0x42db31,_0x2dc159[_0x5769('0x27')]);_0xa97a5['next']();}else if(_0x7e97af&&_0x7e97af[_0x5769('0x27')]){_0x152167[_0x5769('0x1d')][_0x5769('0x29')]=_0x7e97af;_0x3bc720[_0x5769('0x1d')]=_0x7e97af[_0x5769('0x27')];_0x3bc720['providerName']=_0x5769('0x29');_0x3bc720[_0x5769('0x2a')]=JSON[_0x5769('0x20')](_0x7e97af);return rpc[_0x34524b+_0x5769('0x1b')][_0x5769('0x1c')](_0x3bc720)[_0x5769('0x2b')](function(_0x190388){logger[_0x5769('0xf')]('[%s][AMAZONLEX]\x20%s',_0x42db31,_0x3bc720['body']);if(_0x7e97af[_0x5769('0x2c')]==_0x5769('0x2d')){_0xa97a5[_0x5769('0x2e')]();}else{_0xa97a5[_0x5769('0x23')]();}})[_0x5769('0x1e')](function(_0x181188){logger[_0x5769('0x1f')](_0x5769('0x10'),_0x42db31,JSON[_0x5769('0x20')](_0x181188));_0xa97a5[_0x5769('0x2e')]();});}else{_0xa97a5['next']();}});}}catch(_0xa6cb07){logger[_0x5769('0x1f')](_0x5769('0x10'),_0x42db31,JSON[_0x5769('0x20')](_0xa6cb07));_0xa97a5[_0x5769('0x23')]();}};}; \ No newline at end of file +var _0x014e=['providerName','amazonlex','providerResponse','stringify','dialogState','Failed','lodash','moment','./utils','../../rpc/chatMessage','../../rpc/whatsappMessage','consequence','isNil','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','out','channel','sms','whatsapp','interaction','chat','account','upperFirst','InteractionId','body','Message','create','then','[%s][AMAZONLEX]\x20%s','catch','error','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','postText'];(function(_0x4c9c48,_0x567be7){var _0x3d36ea=function(_0x1a5f20){while(--_0x1a5f20){_0x4c9c48['push'](_0x4c9c48['shift']());}};_0x3d36ea(++_0x567be7);}(_0x014e,0x180));var _0xe014=function(_0x89cf7f,_0x15689c){_0x89cf7f=_0x89cf7f-0x0;var _0x2f326a=_0x014e[_0x89cf7f];return _0x2f326a;};'use strict';var _=require(_0xe014('0x0'));var moment=require(_0xe014('0x1'));var AWS=require('aws-sdk');var utils=require(_0xe014('0x2'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0xe014('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xe014('0x4'))};exports[_0xe014('0x5')]=function(_0x5cfb30,_0xc80d50){return function(_0x5ae0a0){try{if(!_[_0xe014('0x6')](this['interaction'][_0xe014('0x7')])){logger[_0xe014('0x8')]('[%s][AMAZONLEX]\x20%s',_0x5cfb30,_0xe014('0x9'));return _0x5ae0a0[_0xe014('0xa')]();}var _0x2687a5={'ContactId':this[_0xe014('0xb')]['id'],'sentAt':moment()[_0xe014('0xc')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xe014('0xd')};if(this[_0xe014('0xe')]===_0xe014('0xf')||this[_0xe014('0xe')]===_0xe014('0x10')){_0x2687a5['phone']=this[_0xe014('0x11')]['phone'];}var _0x5876fd=this[_0xe014('0xe')];if(_0x5876fd===_0xe014('0x12')){_0x2687a5['ChatWebsiteId']=this[_0xe014('0x13')]['id'];}else{_0x2687a5[_[_0xe014('0x14')](_0x5876fd)+'AccountId']=this[_0xe014('0x13')]['id'];}_0x2687a5[_['upperFirst'](_0x5876fd)+_0xe014('0x15')]=this[_0xe014('0x11')]['id'];if(this[_0xe014('0x11')]['created']){var _0x20c58f=_0xc80d50[0x4];if(!_['isEmpty'](_0x20c58f)){_0x2687a5[_0xe014('0x16')]=utils['getMustacheRender'](_0x20c58f,this);return rpc[_0x5876fd+_0xe014('0x17')][_0xe014('0x18')](_0x2687a5)[_0xe014('0x19')](function(_0x3e18bf){logger[_0xe014('0x8')](_0xe014('0x1a'),_0x5cfb30,_0x2687a5[_0xe014('0x16')]);})[_0xe014('0x1b')](function(_0x37f51d){logger[_0xe014('0x1c')](_0xe014('0x1a'),_0x5cfb30,JSON['stringify'](_0x37f51d));})[_0xe014('0x1d')](function(){logger[_0xe014('0x8')](_0xe014('0x1e'),_0x5cfb30);_0x5ae0a0[_0xe014('0x1f')]();});}else{logger[_0xe014('0x8')](_0xe014('0x20'),_0x5cfb30);_0x5ae0a0['stop']();}}else{var _0x112cbf=this;var _0x9abff7=new AWS[(_0xe014('0x21'))]({'accessKeyId':_0xc80d50[0x0],'secretAccessKey':_0xc80d50[0x1],'region':_0xc80d50[0x2]});var _0x138c87={'botAlias':'$LATEST','botName':_0xc80d50[0x3],'inputText':this[_0xe014('0x22')][_0xe014('0x16')],'userId':this['channel']+':'+this[_0xe014('0x11')]['id']['toString']()};_0x9abff7[_0xe014('0x23')](_0x138c87,function(_0x28a83a,_0xe59991){if(_0x28a83a){logger[_0xe014('0x1c')](_0xe014('0x1a'),_0x5cfb30,_0x28a83a['message']);_0x5ae0a0['next']();}else if(_0xe59991&&_0xe59991[_0xe014('0x22')]){_0x112cbf[_0xe014('0x16')]['amazonlex']=_0xe59991;_0x2687a5['body']=_0xe59991[_0xe014('0x22')];_0x2687a5[_0xe014('0x24')]=_0xe014('0x25');_0x2687a5[_0xe014('0x26')]=JSON[_0xe014('0x27')](_0xe59991);return rpc[_0x5876fd+_0xe014('0x17')][_0xe014('0x18')](_0x2687a5)[_0xe014('0x19')](function(_0x28484e){logger[_0xe014('0x8')]('[%s][AMAZONLEX]\x20%s',_0x5cfb30,_0x2687a5['body']);if(_0xe59991[_0xe014('0x28')]==_0xe014('0x29')){_0x5ae0a0[_0xe014('0xa')]();}else{_0x5ae0a0[_0xe014('0x1f')]();}})[_0xe014('0x1b')](function(_0xcf6eba){logger['error'](_0xe014('0x1a'),_0x5cfb30,JSON['stringify'](_0xcf6eba));_0x5ae0a0['next']();});}else{_0x5ae0a0[_0xe014('0xa')]();}});}}catch(_0x3b7009){logger[_0xe014('0x1c')](_0xe014('0x1a'),_0x5cfb30,JSON[_0xe014('0x27')](_0x3b7009));_0x5ae0a0[_0xe014('0x1f')]();}};}; \ 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 185c357..78b013f 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 _0xe549=['../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','channel','body','isAutoreply','info','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','mail','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','Re:\x20','ChatWebsiteId','AccountId','account','InteractionId','Smtp','service','host','port','secure','authentication','auth','user','pass','inReplyTo','messageId','html','','replace','','auto-replied','auto_reply','sendMailMessage','[%s][AUTOREPLY]\x20SMTP\x20SENT','Message','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','then','update','finally','resolve','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','lodash','moment','./utils','../../../../config/logger','routing'];(function(_0x2ead06,_0x35be48){var _0x1f43e4=function(_0xc3701){while(--_0xc3701){_0x2ead06['push'](_0x2ead06['shift']());}};_0x1f43e4(++_0x35be48);}(_0xe549,0x137));var _0x9e54=function(_0x3a7103,_0x2774a2){_0x3a7103=_0x3a7103-0x0;var _0x2ac266=_0xe549[_0x3a7103];return _0x2ac266;};'use strict';var _=require(_0x9e54('0x0'));var moment=require(_0x9e54('0x1'));var utils=require(_0x9e54('0x2'));var logger=require(_0x9e54('0x3'))(_0x9e54('0x4'));var rpc={'chatMessage':require(_0x9e54('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x9e54('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x9e54('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require(_0x9e54('0x8')),'openchannelInteraction':require(_0x9e54('0x9')),'mailInteraction':require(_0x9e54('0xa')),'smsInteraction':require(_0x9e54('0xb')),'faxInteraction':require(_0x9e54('0xc')),'whatsappInteraction':require(_0x9e54('0xd'))};var mailRpc=require(_0x9e54('0xe'));exports['consequence']=function(_0x33137e,_0x877ecb,_0x2e7a21,_0x46054a){return function(_0x1df1fd){try{var _0x3b9d20=this[_0x9e54('0xf')];if(_0x3b9d20==='mail'&&_0x46054a[_0x9e54('0x10')][_0x9e54('0x11')]){logger[_0x9e54('0x12')]('[%s][AUTOREPLY]\x20%s',_0x33137e,_0x9e54('0x13'));return _0x1df1fd[_0x9e54('0x14')]();}if(_0x877ecb[0x0]==='1'&&(_[_0x9e54('0x15')](this[_0x9e54('0x16')][_0x9e54('0x17')])||!this[_0x9e54('0x16')]['created'])){logger['info'](_0x9e54('0x18'),_0x33137e,_0x9e54('0x19'));return _0x1df1fd[_0x9e54('0x14')]();}if(_0x877ecb[0x0]==='2'&&this[_0x9e54('0x16')][_0x9e54('0x1a')]){logger[_0x9e54('0x12')](_0x9e54('0x1b'),_0x33137e,_0x9e54('0x1c'));return _0x1df1fd[_0x9e54('0x14')]();}var _0x4ac660={'ContactId':this[_0x9e54('0x1d')]['id'],'sentAt':moment()[_0x9e54('0x1e')](_0x9e54('0x1f')),'direction':_0x9e54('0x20')};if(this[_0x9e54('0xf')]===_0x9e54('0x21')){_0x4ac660[_0x9e54('0x10')]=utils[_0x9e54('0x22')](_0x877ecb[0x2],this);}else{_0x4ac660['body']=utils[_0x9e54('0x22')](_0x877ecb[0x1],this);}if(this[_0x9e54('0x23')]){_0x4ac660['to']=this[_0x9e54('0x23')]['from']||'';if(this[_0x9e54('0xf')]===_0x9e54('0x21')&&_0x877ecb[0x1]==='1'){_0x4ac660['cc']=this[_0x9e54('0x23')]['cc']||'';}_0x4ac660[_0x9e54('0x24')]=this[_0x9e54('0x23')]['to']||'';_0x4ac660[_0x9e54('0x25')]=this[_0x9e54('0x23')][_0x9e54('0x25')]||'';_0x4ac660[_0x9e54('0x26')]=!![];if(this[_0x9e54('0x23')]['subject']){_0x4ac660[_0x9e54('0x27')]='';_0x4ac660[_0x9e54('0x27')]+=_[_0x9e54('0x28')](this['message'][_0x9e54('0x27')],_0x9e54('0x29'))?'':_0x9e54('0x2a');_0x4ac660['subject']+=this[_0x9e54('0x23')]['subject'];}}if(this['channel']==='chat'){_0x4ac660[_0x9e54('0x2b')]=this['account']['id'];}else{_0x4ac660[_['upperFirst'](this[_0x9e54('0xf')])+_0x9e54('0x2c')]=this[_0x9e54('0x2d')]['id'];}_0x4ac660[_['upperFirst'](this[_0x9e54('0xf')])+_0x9e54('0x2e')]=this[_0x9e54('0x16')]['id'];var _0x272799=this[_0x9e54('0x16')];if(rpc[this[_0x9e54('0xf')]+'Message']){if(this['channel']===_0x9e54('0x21')){var _0x18cf4d={'tls':{'rejectUnauthorized':![]}};if(this[_0x9e54('0x2d')]['Smtp']['service']){_0x18cf4d['service']=this[_0x9e54('0x2d')][_0x9e54('0x2f')][_0x9e54('0x30')];}else{_0x18cf4d[_0x9e54('0x31')]=this[_0x9e54('0x2d')][_0x9e54('0x2f')][_0x9e54('0x31')];_0x18cf4d[_0x9e54('0x32')]=this[_0x9e54('0x2d')][_0x9e54('0x2f')][_0x9e54('0x32')];_0x18cf4d[_0x9e54('0x33')]=this['account']['Smtp'][_0x9e54('0x33')];}if(this['account'][_0x9e54('0x2f')][_0x9e54('0x34')]){_0x18cf4d[_0x9e54('0x35')]={'user':this['account'][_0x9e54('0x2f')][_0x9e54('0x36')],'pass':this[_0x9e54('0x2d')][_0x9e54('0x2f')][_0x9e54('0x37')]};}_0x4ac660[_0x9e54('0x38')]=this[_0x9e54('0x23')][_0x9e54('0x39')];_0x4ac660[_0x9e54('0x3a')]=_0x9e54('0x3b')+_[_0x9e54('0x3c')](_0x4ac660[_0x9e54('0x10')],_0x9e54('0x3d'),_0x9e54('0x3e'))+_0x9e54('0x3f');_0x4ac660['headers']={'Auto-Submitted':_0x9e54('0x40'),'X-Auto-Response-Suppress':'All','Precedence':_0x9e54('0x41')};return mailRpc[_0x9e54('0x42')](_0x18cf4d,_0x4ac660)['then'](function(_0x1909f9){logger[_0x9e54('0x12')](_0x9e54('0x43'),_0x33137e);_0x4ac660[_0x9e54('0x39')]=_0x1909f9[_0x9e54('0x23')][_0x9e54('0x39')];return rpc[_0x3b9d20+_0x9e54('0x44')][_0x9e54('0x45')](_0x4ac660);})['then'](function(_0x329ed2){logger[_0x9e54('0x12')](_0x9e54('0x18'),_0x33137e,JSON[_0x9e54('0x46')](_0x329ed2));})[_0x9e54('0x47')](function(_0x113fe6){logger[_0x9e54('0x48')](_0x9e54('0x49'),_0x33137e,JSON['stringify'](_0x113fe6));})['finally'](function(){Promise['resolve']()[_0x9e54('0x4a')](function(){if(_0x877ecb[0x0]!=='2'||_0x272799[_0x9e54('0x1a')])return;return rpc[_0x3b9d20+'Interaction'][_0x9e54('0x4b')](_0x272799['id'],{'autoreplyExecuted':!![]})['then'](function(_0x245dc1){logger[_0x9e54('0x12')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x33137e,JSON[_0x9e54('0x46')](_0x245dc1));})['catch'](function(_0x35c863){logger[_0x9e54('0x48')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x33137e,JSON[_0x9e54('0x46')](_0x35c863));});})[_0x9e54('0x4a')](function(){_0x1df1fd['next']();});});}else{return rpc[this[_0x9e54('0xf')]+'Message']['create'](_0x4ac660)['then'](function(_0x2e2714){logger[_0x9e54('0x12')](_0x9e54('0x18'),_0x33137e,_0x4ac660[_0x9e54('0x10')]);})[_0x9e54('0x47')](function(_0x1493ed){logger[_0x9e54('0x48')](_0x9e54('0x18'),_0x33137e,JSON[_0x9e54('0x46')](_0x1493ed));})[_0x9e54('0x4c')](function(){Promise[_0x9e54('0x4d')]()[_0x9e54('0x4a')](function(){if(_0x877ecb[0x0]!=='2'||_0x272799['autoreplyExecuted'])return;return rpc[_0x3b9d20+'Interaction'][_0x9e54('0x4b')](_0x272799['id'],{'autoreplyExecuted':!![]})[_0x9e54('0x4a')](function(_0x3a824f){logger[_0x9e54('0x12')](_0x9e54('0x1b'),_0x33137e,JSON[_0x9e54('0x46')](_0x3a824f));})['catch'](function(_0x23c5ed){logger[_0x9e54('0x48')](_0x9e54('0x4e'),_0x33137e,JSON['stringify'](_0x23c5ed));});})[_0x9e54('0x4a')](function(){_0x1df1fd[_0x9e54('0x14')]();});});}}}catch(_0x295fb6){logger[_0x9e54('0x48')](_0x9e54('0x18'),_0x33137e,JSON[_0x9e54('0x46')](_0x295fb6));_0x1df1fd['stop']();}};}; \ No newline at end of file +var _0x8bf7=['error','finally','resolve','Interaction','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','next','create','stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','mail','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','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','channel','body','getMustacheRender','message','from','phone','read','subject','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Smtp','service','host','port','secure','authentication','auth','user','pass','inReplyTo','messageId','html','','replace','','headers','auto-replied','All','auto_reply','sendMailMessage','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','Message','stringify','catch'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x8bf7,0x158));var _0x78bf=function(_0x21416f,_0x28c06a){_0x21416f=_0x21416f-0x0;var _0x10572a=_0x8bf7[_0x21416f];return _0x10572a;};'use strict';var _=require(_0x78bf('0x0'));var moment=require(_0x78bf('0x1'));var utils=require(_0x78bf('0x2'));var logger=require(_0x78bf('0x3'))(_0x78bf('0x4'));var rpc={'chatMessage':require(_0x78bf('0x5')),'openchannelMessage':require(_0x78bf('0x6')),'mailMessage':require(_0x78bf('0x7')),'smsMessage':require(_0x78bf('0x8')),'faxMessage':require(_0x78bf('0x9')),'whatsappMessage':require(_0x78bf('0xa')),'chatInteraction':require(_0x78bf('0xb')),'openchannelInteraction':require(_0x78bf('0xc')),'mailInteraction':require(_0x78bf('0xd')),'smsInteraction':require(_0x78bf('0xe')),'faxInteraction':require(_0x78bf('0xf')),'whatsappInteraction':require(_0x78bf('0x10'))};var mailRpc=require('../../mailRpc');exports[_0x78bf('0x11')]=function(_0x37dc4f,_0x5d8642,_0x5b22b9,_0x25b3ec){return function(_0x386e4b){try{var _0xfa4fd6=this['channel'];if(_0xfa4fd6===_0x78bf('0x12')&&_0x25b3ec['body'][_0x78bf('0x13')]){logger[_0x78bf('0x14')](_0x78bf('0x15'),_0x37dc4f,_0x78bf('0x16'));return _0x386e4b['next']();}if(_0x5d8642[0x0]==='1'&&(_[_0x78bf('0x17')](this[_0x78bf('0x18')][_0x78bf('0x19')])||!this[_0x78bf('0x18')][_0x78bf('0x19')])){logger['info']('[%s][AUTOREPLY]\x20%s',_0x37dc4f,_0x78bf('0x1a'));return _0x386e4b['next']();}if(_0x5d8642[0x0]==='2'&&this[_0x78bf('0x18')][_0x78bf('0x1b')]){logger[_0x78bf('0x14')](_0x78bf('0x1c'),_0x37dc4f,_0x78bf('0x1d'));return _0x386e4b['next']();}var _0x12269e={'ContactId':this[_0x78bf('0x1e')]['id'],'sentAt':moment()[_0x78bf('0x1f')](_0x78bf('0x20')),'direction':_0x78bf('0x21')};if(this[_0x78bf('0x22')]===_0x78bf('0x12')){_0x12269e[_0x78bf('0x23')]=utils[_0x78bf('0x24')](_0x5d8642[0x2],this);}else{_0x12269e['body']=utils[_0x78bf('0x24')](_0x5d8642[0x1],this);}if(this[_0x78bf('0x25')]){_0x12269e['to']=this[_0x78bf('0x25')]['from']||'';if(this[_0x78bf('0x22')]===_0x78bf('0x12')&&_0x5d8642[0x1]==='1'){_0x12269e['cc']=this[_0x78bf('0x25')]['cc']||'';}_0x12269e[_0x78bf('0x26')]=this['message']['to']||'';_0x12269e[_0x78bf('0x27')]=this[_0x78bf('0x25')][_0x78bf('0x27')]||'';_0x12269e[_0x78bf('0x28')]=!![];if(this[_0x78bf('0x25')][_0x78bf('0x29')]){_0x12269e['subject']='';_0x12269e[_0x78bf('0x29')]+=_['startsWith'](this[_0x78bf('0x25')][_0x78bf('0x29')],'Re:')?'':_0x78bf('0x2a');_0x12269e[_0x78bf('0x29')]+=this['message'][_0x78bf('0x29')];}}if(this[_0x78bf('0x22')]===_0x78bf('0x2b')){_0x12269e[_0x78bf('0x2c')]=this[_0x78bf('0x2d')]['id'];}else{_0x12269e[_[_0x78bf('0x2e')](this[_0x78bf('0x22')])+_0x78bf('0x2f')]=this[_0x78bf('0x2d')]['id'];}_0x12269e[_['upperFirst'](this['channel'])+_0x78bf('0x30')]=this[_0x78bf('0x18')]['id'];var _0x11ca4c=this[_0x78bf('0x18')];if(rpc[this[_0x78bf('0x22')]+'Message']){if(this[_0x78bf('0x22')]==='mail'){var _0x2f98ae={'tls':{'rejectUnauthorized':![]}};if(this[_0x78bf('0x2d')][_0x78bf('0x31')]['service']){_0x2f98ae[_0x78bf('0x32')]=this[_0x78bf('0x2d')][_0x78bf('0x31')]['service'];}else{_0x2f98ae[_0x78bf('0x33')]=this[_0x78bf('0x2d')][_0x78bf('0x31')][_0x78bf('0x33')];_0x2f98ae['port']=this[_0x78bf('0x2d')][_0x78bf('0x31')][_0x78bf('0x34')];_0x2f98ae[_0x78bf('0x35')]=this['account'][_0x78bf('0x31')][_0x78bf('0x35')];}if(this[_0x78bf('0x2d')][_0x78bf('0x31')][_0x78bf('0x36')]){_0x2f98ae[_0x78bf('0x37')]={'user':this[_0x78bf('0x2d')][_0x78bf('0x31')][_0x78bf('0x38')],'pass':this[_0x78bf('0x2d')][_0x78bf('0x31')][_0x78bf('0x39')]};}_0x12269e[_0x78bf('0x3a')]=this[_0x78bf('0x25')][_0x78bf('0x3b')];_0x12269e[_0x78bf('0x3c')]=_0x78bf('0x3d')+_[_0x78bf('0x3e')](_0x12269e[_0x78bf('0x23')],_0x78bf('0x3f'),_0x78bf('0x40'))+_0x78bf('0x41');_0x12269e[_0x78bf('0x42')]={'Auto-Submitted':_0x78bf('0x43'),'X-Auto-Response-Suppress':_0x78bf('0x44'),'Precedence':_0x78bf('0x45')};return mailRpc[_0x78bf('0x46')](_0x2f98ae,_0x12269e)[_0x78bf('0x47')](function(_0x10919e){logger['info'](_0x78bf('0x48'),_0x37dc4f);_0x12269e[_0x78bf('0x3b')]=_0x10919e[_0x78bf('0x25')][_0x78bf('0x3b')];return rpc[_0xfa4fd6+_0x78bf('0x49')]['create'](_0x12269e);})['then'](function(_0x3bc5f2){logger['info'](_0x78bf('0x15'),_0x37dc4f,JSON[_0x78bf('0x4a')](_0x3bc5f2));})[_0x78bf('0x4b')](function(_0x1e31d8){logger[_0x78bf('0x4c')]('[RPC][%s][AUTOREPLY]\x20%s',_0x37dc4f,JSON['stringify'](_0x1e31d8));})[_0x78bf('0x4d')](function(){Promise[_0x78bf('0x4e')]()[_0x78bf('0x47')](function(){if(_0x5d8642[0x0]!=='2'||_0x11ca4c[_0x78bf('0x1b')])return;return rpc[_0xfa4fd6+_0x78bf('0x4f')]['update'](_0x11ca4c['id'],{'autoreplyExecuted':!![]})[_0x78bf('0x47')](function(_0x149c03){logger[_0x78bf('0x14')](_0x78bf('0x1c'),_0x37dc4f,JSON[_0x78bf('0x4a')](_0x149c03));})[_0x78bf('0x4b')](function(_0x25301f){logger[_0x78bf('0x4c')](_0x78bf('0x50'),_0x37dc4f,JSON[_0x78bf('0x4a')](_0x25301f));});})[_0x78bf('0x47')](function(){_0x386e4b[_0x78bf('0x51')]();});});}else{return rpc[this[_0x78bf('0x22')]+_0x78bf('0x49')][_0x78bf('0x52')](_0x12269e)['then'](function(_0x3a40fd){logger[_0x78bf('0x14')](_0x78bf('0x15'),_0x37dc4f,_0x12269e[_0x78bf('0x23')]);})['catch'](function(_0x209563){logger['error'](_0x78bf('0x15'),_0x37dc4f,JSON[_0x78bf('0x4a')](_0x209563));})[_0x78bf('0x4d')](function(){Promise[_0x78bf('0x4e')]()['then'](function(){if(_0x5d8642[0x0]!=='2'||_0x11ca4c['autoreplyExecuted'])return;return rpc[_0xfa4fd6+_0x78bf('0x4f')]['update'](_0x11ca4c['id'],{'autoreplyExecuted':!![]})[_0x78bf('0x47')](function(_0x53e9f6){logger[_0x78bf('0x14')](_0x78bf('0x1c'),_0x37dc4f,JSON[_0x78bf('0x4a')](_0x53e9f6));})[_0x78bf('0x4b')](function(_0x32963f){logger[_0x78bf('0x4c')](_0x78bf('0x50'),_0x37dc4f,JSON['stringify'](_0x32963f));});})['then'](function(){_0x386e4b['next']();});});}}}catch(_0x3ab164){logger['error']('[%s][AUTOREPLY]\x20%s',_0x37dc4f,JSON['stringify'](_0x3ab164));_0x386e4b[_0x78bf('0x53')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index 3f51896..07323f6 100644 --- a/server/services/routing/server/applications/close.js +++ b/server/services/routing/server/applications/close.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc0ab=['[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','interaction','[%s][CLOSE]\x20%s','stringify','finally','stop','error','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','info','[%s][CLOSE]\x20reason\x20%s','channel','Interaction','update'];(function(_0x50b766,_0x46d9ab){var _0x16535e=function(_0x8fc50c){while(--_0x8fc50c){_0x50b766['push'](_0x50b766['shift']());}};_0x16535e(++_0x46d9ab);}(_0xc0ab,0x11f));var _0xbc0a=function(_0x966478,_0x5b7b09){_0x966478=_0x966478-0x0;var _0x5ec091=_0xc0ab[_0x966478];return _0x5ec091;};'use strict';var moment=require(_0xbc0a('0x0'));var logger=require(_0xbc0a('0x1'))(_0xbc0a('0x2'));var rpc={'chatInteraction':require(_0xbc0a('0x3')),'openchannelInteraction':require(_0xbc0a('0x4')),'smsInteraction':require(_0xbc0a('0x5')),'mailInteraction':require(_0xbc0a('0x6')),'faxInteraction':require(_0xbc0a('0x7')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports['consequence']=function(_0x21379d,_0x4ba4db,_0x3b1739,_0x182fa7){return function(_0x44ad84){try{logger[_0xbc0a('0x8')](_0xbc0a('0x9'),_0x21379d,_0x4ba4db[0x0]);var _0x17b52a={'closed':0x1,'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':'system','disposition':_0x4ba4db[0x0]};if(rpc[_0x182fa7[_0xbc0a('0xa')]+_0xbc0a('0xb')]){rpc[_0x182fa7[_0xbc0a('0xa')]+_0xbc0a('0xb')][_0xbc0a('0xc')](_0x182fa7['interaction']['id'],_0x17b52a)['then'](function(_0x10e3a9){logger['info'](_0xbc0a('0xd'),_0x21379d,_0x182fa7[_0xbc0a('0xe')]['id']);})['catch'](function(_0x37d13e){logger['error'](_0xbc0a('0xf'),_0x21379d,JSON[_0xbc0a('0x10')](_0x37d13e));})[_0xbc0a('0x11')](function(){_0x44ad84[_0xbc0a('0x12')]();});}}catch(_0x1b89bd){logger[_0xbc0a('0x13')](_0xbc0a('0xf'),_0x21379d,JSON[_0xbc0a('0x10')](_0x1b89bd));_0x44ad84[_0xbc0a('0x12')]();}};}; \ No newline at end of file +var _0xec51=['../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','system','channel','Interaction','update','interaction','then','catch','[%s][CLOSE]\x20%s','stringify','finally','stop','error','../../../../config/logger','routing'];(function(_0x5002c9,_0x4fe06a){var _0x318071=function(_0x5eab55){while(--_0x5eab55){_0x5002c9['push'](_0x5002c9['shift']());}};_0x318071(++_0x4fe06a);}(_0xec51,0x196));var _0x1ec5=function(_0x81249a,_0x23f625){_0x81249a=_0x81249a-0x0;var _0x2d7204=_0xec51[_0x81249a];return _0x2d7204;};'use strict';var moment=require('moment');var logger=require(_0x1ec5('0x0'))(_0x1ec5('0x1'));var rpc={'chatInteraction':require(_0x1ec5('0x2')),'openchannelInteraction':require(_0x1ec5('0x3')),'smsInteraction':require(_0x1ec5('0x4')),'mailInteraction':require(_0x1ec5('0x5')),'faxInteraction':require(_0x1ec5('0x6')),'whatsappInteraction':require(_0x1ec5('0x7'))};exports[_0x1ec5('0x8')]=function(_0x154cf9,_0x42a57f,_0x542fdd,_0x252e77){return function(_0x39b700){try{logger[_0x1ec5('0x9')](_0x1ec5('0xa'),_0x154cf9,_0x42a57f[0x0]);var _0x37b0bb={'closed':0x1,'closedAt':moment()[_0x1ec5('0xb')]('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':_0x1ec5('0xc'),'disposition':_0x42a57f[0x0]};if(rpc[_0x252e77[_0x1ec5('0xd')]+_0x1ec5('0xe')]){rpc[_0x252e77[_0x1ec5('0xd')]+_0x1ec5('0xe')][_0x1ec5('0xf')](_0x252e77[_0x1ec5('0x10')]['id'],_0x37b0bb)[_0x1ec5('0x11')](function(_0x3cfd6c){logger[_0x1ec5('0x9')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x154cf9,_0x252e77[_0x1ec5('0x10')]['id']);})[_0x1ec5('0x12')](function(_0x4f9fc1){logger['error'](_0x1ec5('0x13'),_0x154cf9,JSON[_0x1ec5('0x14')](_0x4f9fc1));})[_0x1ec5('0x15')](function(){_0x39b700[_0x1ec5('0x16')]();});}}catch(_0x17a293){logger[_0x1ec5('0x17')](_0x1ec5('0x13'),_0x154cf9,JSON[_0x1ec5('0x14')](_0x17a293));_0x39b700[_0x1ec5('0x16')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index 34b0131..477e8f8 100644 --- a/server/services/routing/server/applications/dialogflow.js +++ b/server/services/routing/server/applications/dialogflow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xafca=['catch','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','result','fulfillment','speech','providerName','providerResponse','create','metadata','endConversation','lodash','apiai-promise','md5','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','out','sms','whatsapp','phone','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','Message','then'];(function(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0xafca,0x1ef));var _0xaafc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xafca[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xaafc('0x0'));var moment=require('moment');var apiai=require(_0xaafc('0x1'));var md5=require(_0xaafc('0x2'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0xaafc('0x3'));var rpc={'chatMessage':require(_0xaafc('0x4')),'openchannelMessage':require(_0xaafc('0x5')),'mailMessage':require(_0xaafc('0x6')),'smsMessage':require(_0xaafc('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xaafc('0x8'))};exports[_0xaafc('0x9')]=function(_0x978cf0,_0x29d3ec){return function(_0x83ea82){try{if(!_[_0xaafc('0xa')](this[_0xaafc('0xb')][_0xaafc('0xc')])){logger[_0xaafc('0xd')](_0xaafc('0xe'),_0x978cf0,_0xaafc('0xf'));return _0x83ea82[_0xaafc('0x10')]();}var _0x492f3c={'ContactId':this['contact']['id'],'sentAt':moment()[_0xaafc('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xaafc('0x12')};if(this['channel']===_0xaafc('0x13')||this['channel']===_0xaafc('0x14')){_0x492f3c[_0xaafc('0x15')]=this[_0xaafc('0xb')][_0xaafc('0x15')];}var _0x31b893=this[_0xaafc('0x16')];if(_0x31b893===_0xaafc('0x17')){_0x492f3c[_0xaafc('0x18')]=this[_0xaafc('0x19')]['id'];}else{_0x492f3c[_[_0xaafc('0x1a')](_0x31b893)+_0xaafc('0x1b')]=this['account']['id'];}_0x492f3c[_[_0xaafc('0x1a')](_0x31b893)+_0xaafc('0x1c')]=this[_0xaafc('0xb')]['id'];if(this[_0xaafc('0xb')][_0xaafc('0x1d')]){var _0x1248ac=_0x29d3ec[0x2];if(!_[_0xaafc('0x1e')](_0x1248ac)){_0x492f3c[_0xaafc('0x1f')]=utils[_0xaafc('0x20')](_0x1248ac,this);return rpc[_0x31b893+_0xaafc('0x21')]['create'](_0x492f3c)[_0xaafc('0x22')](function(_0x504fa0){logger[_0xaafc('0xd')](_0xaafc('0xe'),_0x978cf0,_0x492f3c[_0xaafc('0x1f')]);})[_0xaafc('0x23')](function(_0x41033){logger[_0xaafc('0x24')](_0xaafc('0xe'),_0x978cf0,JSON[_0xaafc('0x25')](_0x41033));})[_0xaafc('0x26')](function(){logger['info'](_0xaafc('0x27'),_0x978cf0);_0x83ea82[_0xaafc('0x28')]();});}else{logger['info'](_0xaafc('0x29'),_0x978cf0);_0x83ea82[_0xaafc('0x28')]();}}else{var _0x7bc70a=this;var _0x521f26=apiai(_0x29d3ec[0x0],{'language':_0x29d3ec[0x1]||'en'});return _0x521f26[_0xaafc('0x2a')](this[_0xaafc('0x2b')][_0xaafc('0x1f')],{'sessionId':md5(this['interaction']['id'])})[_0xaafc('0x22')](function(_0xd3b1a2){_0x7bc70a['body'][_0xaafc('0x2c')]=_0xd3b1a2;_0x492f3c[_0xaafc('0x1f')]=_0xd3b1a2[_0xaafc('0x2d')][_0xaafc('0x2e')][_0xaafc('0x2f')];_0x492f3c[_0xaafc('0x30')]='dialogflow';_0x492f3c[_0xaafc('0x31')]=JSON[_0xaafc('0x25')](_0xd3b1a2);return rpc[_0x31b893+_0xaafc('0x21')][_0xaafc('0x32')](_0x492f3c)['then'](function(_0x43e3f1){logger[_0xaafc('0xd')](_0xaafc('0xe'),_0x978cf0,_0x492f3c[_0xaafc('0x1f')]);if(_0xd3b1a2[_0xaafc('0x2d')][_0xaafc('0x33')][_0xaafc('0x34')]){_0x83ea82[_0xaafc('0x10')]();}else{_0x83ea82[_0xaafc('0x28')]();}})[_0xaafc('0x23')](function(_0x731bb4){logger[_0xaafc('0x24')](_0xaafc('0xe'),_0x978cf0,JSON[_0xaafc('0x25')](_0x731bb4));_0x83ea82[_0xaafc('0x10')]();});})[_0xaafc('0x23')](function(_0x35a29f){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x978cf0,_0x35a29f['message']);_0x83ea82[_0xaafc('0x10')]();});}}catch(_0x3d4a5e){logger[_0xaafc('0x24')]('[%s][DIALOGFLOW]\x20%s',_0x978cf0,JSON[_0xaafc('0x25')](_0x3d4a5e));_0x83ea82[_0xaafc('0x28')]();}};}; \ No newline at end of file +var _0xcb41=['consequence','isNil','UserId','info','[%s][DIALOGFLOW]\x20%s','next','contact','out','sms','channel','whatsapp','phone','interaction','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','body','getMustacheRender','then','catch','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','message','dialogflow','result','fulfillment','speech','providerName','providerResponse','metadata','endConversation','lodash','moment','apiai-promise','md5','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0xcb41,0x1df));var _0x1cb4=function(_0x1ac099,_0x3a2361){_0x1ac099=_0x1ac099-0x0;var _0x1a62a7=_0xcb41[_0x1ac099];return _0x1a62a7;};'use strict';var _=require(_0x1cb4('0x0'));var moment=require(_0x1cb4('0x1'));var apiai=require(_0x1cb4('0x2'));var md5=require(_0x1cb4('0x3'));var utils=require('./utils');var logger=require(_0x1cb4('0x4'))('routing');var rpc={'chatMessage':require(_0x1cb4('0x5')),'openchannelMessage':require(_0x1cb4('0x6')),'mailMessage':require(_0x1cb4('0x7')),'smsMessage':require(_0x1cb4('0x8')),'faxMessage':require(_0x1cb4('0x9')),'whatsappMessage':require(_0x1cb4('0xa'))};exports[_0x1cb4('0xb')]=function(_0x42e7fe,_0x4fd3b6){return function(_0x2b51e3){try{if(!_[_0x1cb4('0xc')](this['interaction'][_0x1cb4('0xd')])){logger[_0x1cb4('0xe')](_0x1cb4('0xf'),_0x42e7fe,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x2b51e3[_0x1cb4('0x10')]();}var _0x21d6a7={'ContactId':this[_0x1cb4('0x11')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x1cb4('0x12')};if(this['channel']===_0x1cb4('0x13')||this[_0x1cb4('0x14')]===_0x1cb4('0x15')){_0x21d6a7[_0x1cb4('0x16')]=this[_0x1cb4('0x17')]['phone'];}var _0xc16752=this['channel'];if(_0xc16752===_0x1cb4('0x18')){_0x21d6a7[_0x1cb4('0x19')]=this[_0x1cb4('0x1a')]['id'];}else{_0x21d6a7[_[_0x1cb4('0x1b')](_0xc16752)+_0x1cb4('0x1c')]=this[_0x1cb4('0x1a')]['id'];}_0x21d6a7[_[_0x1cb4('0x1b')](_0xc16752)+_0x1cb4('0x1d')]=this[_0x1cb4('0x17')]['id'];if(this[_0x1cb4('0x17')]['created']){var _0xbc72fd=_0x4fd3b6[0x2];if(!_['isEmpty'](_0xbc72fd)){_0x21d6a7[_0x1cb4('0x1e')]=utils[_0x1cb4('0x1f')](_0xbc72fd,this);return rpc[_0xc16752+'Message']['create'](_0x21d6a7)[_0x1cb4('0x20')](function(_0x281d36){logger[_0x1cb4('0xe')](_0x1cb4('0xf'),_0x42e7fe,_0x21d6a7[_0x1cb4('0x1e')]);})[_0x1cb4('0x21')](function(_0x3daa13){logger[_0x1cb4('0x22')]('[%s][DIALOGFLOW]\x20%s',_0x42e7fe,JSON[_0x1cb4('0x23')](_0x3daa13));})[_0x1cb4('0x24')](function(){logger['info'](_0x1cb4('0x25'),_0x42e7fe);_0x2b51e3[_0x1cb4('0x26')]();});}else{logger[_0x1cb4('0xe')](_0x1cb4('0x27'),_0x42e7fe);_0x2b51e3['stop']();}}else{var _0x316325=this;var _0x51fc8d=apiai(_0x4fd3b6[0x0],{'language':_0x4fd3b6[0x1]||'en'});return _0x51fc8d['textRequest'](this[_0x1cb4('0x28')][_0x1cb4('0x1e')],{'sessionId':md5(this[_0x1cb4('0x17')]['id'])})['then'](function(_0x3533e8){_0x316325[_0x1cb4('0x1e')][_0x1cb4('0x29')]=_0x3533e8;_0x21d6a7['body']=_0x3533e8[_0x1cb4('0x2a')][_0x1cb4('0x2b')][_0x1cb4('0x2c')];_0x21d6a7[_0x1cb4('0x2d')]='dialogflow';_0x21d6a7[_0x1cb4('0x2e')]=JSON['stringify'](_0x3533e8);return rpc[_0xc16752+'Message']['create'](_0x21d6a7)[_0x1cb4('0x20')](function(_0x54b46f){logger[_0x1cb4('0xe')](_0x1cb4('0xf'),_0x42e7fe,_0x21d6a7['body']);if(_0x3533e8['result'][_0x1cb4('0x2f')][_0x1cb4('0x30')]){_0x2b51e3[_0x1cb4('0x10')]();}else{_0x2b51e3[_0x1cb4('0x26')]();}})[_0x1cb4('0x21')](function(_0x15956b){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x42e7fe,JSON['stringify'](_0x15956b));_0x2b51e3[_0x1cb4('0x10')]();});})[_0x1cb4('0x21')](function(_0x22d82a){logger[_0x1cb4('0x22')](_0x1cb4('0xf'),_0x42e7fe,_0x22d82a[_0x1cb4('0x28')]);_0x2b51e3[_0x1cb4('0x10')]();});}}catch(_0x36eac9){logger[_0x1cb4('0x22')](_0x1cb4('0xf'),_0x42e7fe,JSON[_0x1cb4('0x23')](_0x36eac9));_0x2b51e3[_0x1cb4('0x26')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index b79455b..083b48a 100644 --- a/server/services/routing/server/applications/dialogflowV2.js +++ b/server/services/routing/server/applications/dialogflowV2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5a04=['contact','format','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','finally','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_INTENTNAME','intent','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','DIALOGFLOWV2_SCORE','intentDetectionConfidence','lodash','dialogflow','md5','moment','bluebird','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','body','Message','create','then','info','catch','error','[%s][DIALOGFLOWV2]\x20%s','stringify','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next'];(function(_0x58e3ce,_0x58b04e){var _0x95135b=function(_0x59c36a){while(--_0x59c36a){_0x58e3ce['push'](_0x58e3ce['shift']());}};_0x95135b(++_0x58b04e);}(_0x5a04,0xfb));var _0x45a0=function(_0x4eb2e9,_0x386f8b){_0x4eb2e9=_0x4eb2e9-0x0;var _0x4f6e07=_0x5a04[_0x4eb2e9];return _0x4f6e07;};'use strict';var _=require(_0x45a0('0x0'));var dialogflow=require(_0x45a0('0x1'));var md5=require(_0x45a0('0x2'));var moment=require(_0x45a0('0x3'));var Promise=require(_0x45a0('0x4'));var logger=require(_0x45a0('0x5'))(_0x45a0('0x6'));var utils=require('./utils');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x45a0('0x7')),'mailMessage':require(_0x45a0('0x8')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x45a0('0x9')),'whatsappMessage':require(_0x45a0('0xa'))};function createMessage(_0x46c9c0,_0x2f5a0c,_0x3a7c10,_0x5efc48){return new Promise(function(_0x206d08,_0x2a3009){var _0x5753ed=_['clone'](_0x3a7c10);_0x5753ed[_0x45a0('0xb')]=_0x5efc48;return rpc[_0x2f5a0c+_0x45a0('0xc')][_0x45a0('0xd')](_0x5753ed)[_0x45a0('0xe')](function(){logger[_0x45a0('0xf')]('[%s][DIALOGFLOWV2]\x20%s',_0x46c9c0,_0x5753ed[_0x45a0('0xb')]);_0x206d08();})[_0x45a0('0x10')](function(_0x110fa7){logger[_0x45a0('0x11')](_0x45a0('0x12'),_0x46c9c0,JSON[_0x45a0('0x13')](_0x110fa7));_0x2a3009(_0x110fa7);});});}exports['consequence']=function(_0x450cb7,_0x173ea6){return function(_0x53b0bd){try{if(!_[_0x45a0('0x14')](this[_0x45a0('0x15')][_0x45a0('0x16')])){logger[_0x45a0('0xf')]('[%s][DIALOGFLOWV2]\x20%s',_0x450cb7,_0x45a0('0x17'));return _0x53b0bd[_0x45a0('0x18')]();}var _0x1e9329={'ContactId':this[_0x45a0('0x19')]['id'],'sentAt':moment()[_0x45a0('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x45a0('0x1b')};if(this[_0x45a0('0x1c')]===_0x45a0('0x1d')||this[_0x45a0('0x1c')]===_0x45a0('0x1e')){_0x1e9329[_0x45a0('0x1f')]=this['interaction'][_0x45a0('0x1f')];}var _0xc022fd=this['channel'];if(_0xc022fd===_0x45a0('0x20')){_0x1e9329[_0x45a0('0x21')]=this[_0x45a0('0x22')]['id'];}else{_0x1e9329[_[_0x45a0('0x23')](_0xc022fd)+_0x45a0('0x24')]=this[_0x45a0('0x22')]['id'];}_0x1e9329[_['upperFirst'](_0xc022fd)+_0x45a0('0x25')]=this['interaction']['id'];if(this[_0x45a0('0x15')][_0x45a0('0x26')]){var _0x17f13a=_0x173ea6[0x4];if(!_[_0x45a0('0x27')](_0x17f13a)){_0x1e9329[_0x45a0('0xb')]=utils['getMustacheRender'](_0x17f13a,this);return rpc[_0xc022fd+_0x45a0('0xc')][_0x45a0('0xd')](_0x1e9329)['then'](function(_0x1ecf02){logger[_0x45a0('0xf')](_0x45a0('0x12'),_0x450cb7,_0x1e9329['body']);})[_0x45a0('0x10')](function(_0x5c76ee){logger[_0x45a0('0x11')](_0x45a0('0x12'),_0x450cb7,JSON[_0x45a0('0x13')](_0x5c76ee));})[_0x45a0('0x28')](function(){logger[_0x45a0('0xf')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x450cb7);_0x53b0bd[_0x45a0('0x29')]();});}else{logger[_0x45a0('0xf')](_0x45a0('0x2a'),_0x450cb7);_0x53b0bd['stop']();}}else{var _0xb65b5a=this;var _0x3e76f0=_0x173ea6[0x2][_0x45a0('0x2b')](/\\n/g,'\x0a');var _0x28c56d={'credentials':{'private_key':_0x3e76f0,'client_email':_0x173ea6[0x1]}};var _0x1e7460=new dialogflow[(_0x45a0('0x2c'))](_0x28c56d);var _0x569e3d=_0x1e7460[_0x45a0('0x2d')](_0x173ea6[0x0],md5(_0xb65b5a[_0x45a0('0x15')]['id']));var _0x48c33f={'session':_0x569e3d,'queryInput':{'text':{'text':_0xb65b5a[_0x45a0('0x2e')][_0x45a0('0xb')],'languageCode':_0x173ea6[0x3]||'en'}}};return _0x1e7460[_0x45a0('0x2f')](_0x48c33f)[_0x45a0('0xe')](function(_0x23a8ff){if(_0x23a8ff&&_0x23a8ff[_0x45a0('0x30')]){_0xb65b5a['body'][_0x45a0('0x31')]=_0x23a8ff;var _0x105226=_0x23a8ff[0x0];var _0x1d5de5=_0x105226[_0x45a0('0x32')][_0x45a0('0x33')]&&_0x105226[_0x45a0('0x32')][_0x45a0('0x33')][_0x45a0('0x34')]?_0x105226[_0x45a0('0x32')][_0x45a0('0x33')]['fields'][_0x45a0('0x35')][_0x45a0('0x36')]:![];_0xb65b5a[_0x45a0('0xb')][_0x45a0('0x37')]=_0x105226[_0x45a0('0x32')][_0x45a0('0x38')];_0xb65b5a[_0x45a0('0xb')][_0x45a0('0x39')]=_0x105226[_0x45a0('0x32')][_0x45a0('0x3a')];_0xb65b5a[_0x45a0('0xb')]['DIALOGFLOWV2_ENDCONVERSATION']=_0x105226[_0x45a0('0x32')]['diagnosticInfo']&&_0x105226[_0x45a0('0x32')][_0x45a0('0x33')][_0x45a0('0x34')]?_0x105226[_0x45a0('0x32')][_0x45a0('0x33')][_0x45a0('0x34')][_0x45a0('0x35')]['boolValue']:![];_0xb65b5a[_0x45a0('0xb')][_0x45a0('0x3b')]=_0x105226[_0x45a0('0x32')][_0x45a0('0x3c')]['name'];_0xb65b5a[_0x45a0('0xb')]['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x105226['queryResult'][_0x45a0('0x3c')][_0x45a0('0x3d')];_0xb65b5a[_0x45a0('0xb')][_0x45a0('0x3e')]=_0x105226[_0x45a0('0x32')]['intent'][_0x45a0('0x3f')];_0xb65b5a[_0x45a0('0xb')][_0x45a0('0x40')]=_0x105226[_0x45a0('0x32')][_0x45a0('0x41')];_0xb65b5a['body'][_0x45a0('0x42')]=_0x105226[_0x45a0('0x32')]['queryText'];_0xb65b5a[_0x45a0('0xb')][_0x45a0('0x43')]=_0x105226[_0x45a0('0x32')][_0x45a0('0x44')];_0x1e9329['providerName']=_0x45a0('0x31');_0x1e9329['providerResponse']=JSON[_0x45a0('0x13')](_0x23a8ff);var _0x34fbfb=[];for(var _0x41612a=0x0;_0x41612a<_0x23a8ff['length'];_0x41612a++){var _0x530cbf=_0x23a8ff[_0x41612a];if(_0x530cbf&&_0x530cbf['queryResult']&&_0x530cbf['queryResult']['fulfillmentText']){_0x34fbfb['push'](createMessage(_0x450cb7,_0xc022fd,_0x1e9329,_0x530cbf[_0x45a0('0x32')]['fulfillmentText']));}}return Promise['all'](_0x34fbfb)[_0x45a0('0xe')](function(){if(_0x1d5de5){_0x53b0bd['next']();}else{_0x53b0bd[_0x45a0('0x29')]();}})[_0x45a0('0x10')](function(_0x2d9506){logger[_0x45a0('0x11')](_0x45a0('0x12'),_0x450cb7,JSON[_0x45a0('0x13')](_0x2d9506));_0x53b0bd[_0x45a0('0x18')]();});}})[_0x45a0('0x10')](function(_0x19e549){logger[_0x45a0('0x11')](_0x45a0('0x12'),_0x450cb7,_0x19e549[_0x45a0('0x2e')]);_0x53b0bd[_0x45a0('0x18')]();});}}catch(_0x5ae3d0){logger[_0x45a0('0x11')](_0x45a0('0x12'),_0x450cb7,JSON[_0x45a0('0x13')](_0x5ae3d0));_0x53b0bd[_0x45a0('0x29')]();}};}; \ No newline at end of file +var _0xe539=['queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerResponse','fulfillmentText','next','lodash','md5','moment','bluebird','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','body','create','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','chat','ChatWebsiteId','account','AccountId','InteractionId','isEmpty','getMustacheRender','Message','finally','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','displayName','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT'];(function(_0x4007b5,_0x1148bc){var _0x38f6bb=function(_0x1cf3e3){while(--_0x1cf3e3){_0x4007b5['push'](_0x4007b5['shift']());}};_0x38f6bb(++_0x1148bc);}(_0xe539,0x164));var _0x9e53=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xe539[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x9e53('0x0'));var dialogflow=require('dialogflow');var md5=require(_0x9e53('0x1'));var moment=require(_0x9e53('0x2'));var Promise=require(_0x9e53('0x3'));var logger=require(_0x9e53('0x4'))(_0x9e53('0x5'));var utils=require('./utils');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x9e53('0x6')),'mailMessage':require(_0x9e53('0x7')),'smsMessage':require(_0x9e53('0x8')),'faxMessage':require(_0x9e53('0x9')),'whatsappMessage':require(_0x9e53('0xa'))};function createMessage(_0x50ba96,_0x51896e,_0x186308,_0x371c4e){return new Promise(function(_0x2e3340,_0x2a4bb7){var _0x4bc2d9=_['clone'](_0x186308);_0x4bc2d9[_0x9e53('0xb')]=_0x371c4e;return rpc[_0x51896e+'Message'][_0x9e53('0xc')](_0x4bc2d9)[_0x9e53('0xd')](function(){logger[_0x9e53('0xe')](_0x9e53('0xf'),_0x50ba96,_0x4bc2d9['body']);_0x2e3340();})[_0x9e53('0x10')](function(_0x5df31c){logger[_0x9e53('0x11')]('[%s][DIALOGFLOWV2]\x20%s',_0x50ba96,JSON[_0x9e53('0x12')](_0x5df31c));_0x2a4bb7(_0x5df31c);});});}exports[_0x9e53('0x13')]=function(_0x4adbba,_0x389dcd){return function(_0x1f8477){try{if(!_[_0x9e53('0x14')](this[_0x9e53('0x15')][_0x9e53('0x16')])){logger['info'](_0x9e53('0xf'),_0x4adbba,_0x9e53('0x17'));return _0x1f8477['next']();}var _0x2c1c22={'ContactId':this[_0x9e53('0x18')]['id'],'sentAt':moment()[_0x9e53('0x19')](_0x9e53('0x1a')),'direction':_0x9e53('0x1b')};if(this[_0x9e53('0x1c')]==='sms'||this[_0x9e53('0x1c')]===_0x9e53('0x1d')){_0x2c1c22[_0x9e53('0x1e')]=this[_0x9e53('0x15')][_0x9e53('0x1e')];}var _0xf0f1ed=this[_0x9e53('0x1c')];if(_0xf0f1ed===_0x9e53('0x1f')){_0x2c1c22[_0x9e53('0x20')]=this[_0x9e53('0x21')]['id'];}else{_0x2c1c22[_['upperFirst'](_0xf0f1ed)+_0x9e53('0x22')]=this[_0x9e53('0x21')]['id'];}_0x2c1c22[_['upperFirst'](_0xf0f1ed)+_0x9e53('0x23')]=this['interaction']['id'];if(this[_0x9e53('0x15')]['created']){var _0x1a844c=_0x389dcd[0x4];if(!_[_0x9e53('0x24')](_0x1a844c)){_0x2c1c22[_0x9e53('0xb')]=utils[_0x9e53('0x25')](_0x1a844c,this);return rpc[_0xf0f1ed+_0x9e53('0x26')]['create'](_0x2c1c22)[_0x9e53('0xd')](function(_0x48635f){logger[_0x9e53('0xe')]('[%s][DIALOGFLOWV2]\x20%s',_0x4adbba,_0x2c1c22['body']);})[_0x9e53('0x10')](function(_0x2415b8){logger['error'](_0x9e53('0xf'),_0x4adbba,JSON[_0x9e53('0x12')](_0x2415b8));})[_0x9e53('0x27')](function(){logger[_0x9e53('0xe')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x4adbba);_0x1f8477[_0x9e53('0x28')]();});}else{logger['info'](_0x9e53('0x29'),_0x4adbba);_0x1f8477[_0x9e53('0x28')]();}}else{var _0x1693a9=this;var _0x249dc8=_0x389dcd[0x2][_0x9e53('0x2a')](/\\n/g,'\x0a');var _0x3b7d2b={'credentials':{'private_key':_0x249dc8,'client_email':_0x389dcd[0x1]}};var _0xae422a=new dialogflow[(_0x9e53('0x2b'))](_0x3b7d2b);var _0x56ab62=_0xae422a[_0x9e53('0x2c')](_0x389dcd[0x0],md5(_0x1693a9[_0x9e53('0x15')]['id']));var _0x2e6b7b={'session':_0x56ab62,'queryInput':{'text':{'text':_0x1693a9[_0x9e53('0x2d')]['body'],'languageCode':_0x389dcd[0x3]||'en'}}};return _0xae422a[_0x9e53('0x2e')](_0x2e6b7b)[_0x9e53('0xd')](function(_0x494395){if(_0x494395&&_0x494395[_0x9e53('0x2f')]){_0x1693a9[_0x9e53('0xb')][_0x9e53('0x30')]=_0x494395;var _0x29f36e=_0x494395[0x0];var _0x458468=_0x29f36e[_0x9e53('0x31')][_0x9e53('0x32')]&&_0x29f36e['queryResult'][_0x9e53('0x32')][_0x9e53('0x33')]?_0x29f36e['queryResult'][_0x9e53('0x32')][_0x9e53('0x33')][_0x9e53('0x34')][_0x9e53('0x35')]:![];_0x1693a9[_0x9e53('0xb')][_0x9e53('0x36')]=_0x29f36e[_0x9e53('0x31')]['action'];_0x1693a9[_0x9e53('0xb')][_0x9e53('0x37')]=_0x29f36e['queryResult']['allRequiredParamsPresent'];_0x1693a9[_0x9e53('0xb')][_0x9e53('0x38')]=_0x29f36e[_0x9e53('0x31')][_0x9e53('0x32')]&&_0x29f36e[_0x9e53('0x31')][_0x9e53('0x32')][_0x9e53('0x33')]?_0x29f36e[_0x9e53('0x31')][_0x9e53('0x32')][_0x9e53('0x33')][_0x9e53('0x34')]['boolValue']:![];_0x1693a9['body'][_0x9e53('0x39')]=_0x29f36e[_0x9e53('0x31')][_0x9e53('0x3a')]['name'];_0x1693a9['body']['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x29f36e[_0x9e53('0x31')]['intent'][_0x9e53('0x3b')];_0x1693a9[_0x9e53('0xb')]['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x29f36e[_0x9e53('0x31')][_0x9e53('0x3a')][_0x9e53('0x3c')];_0x1693a9[_0x9e53('0xb')][_0x9e53('0x3d')]=_0x29f36e['queryResult'][_0x9e53('0x3e')];_0x1693a9[_0x9e53('0xb')][_0x9e53('0x3f')]=_0x29f36e[_0x9e53('0x31')][_0x9e53('0x40')];_0x1693a9[_0x9e53('0xb')][_0x9e53('0x41')]=_0x29f36e[_0x9e53('0x31')][_0x9e53('0x42')];_0x2c1c22['providerName']=_0x9e53('0x30');_0x2c1c22[_0x9e53('0x43')]=JSON[_0x9e53('0x12')](_0x494395);var _0xb7bfa7=[];for(var _0x100d91=0x0;_0x100d91<_0x494395[_0x9e53('0x2f')];_0x100d91++){var _0x29c59b=_0x494395[_0x100d91];if(_0x29c59b&&_0x29c59b['queryResult']&&_0x29c59b[_0x9e53('0x31')][_0x9e53('0x44')]){_0xb7bfa7['push'](createMessage(_0x4adbba,_0xf0f1ed,_0x2c1c22,_0x29c59b[_0x9e53('0x31')]['fulfillmentText']));}}return Promise['all'](_0xb7bfa7)[_0x9e53('0xd')](function(){if(_0x458468){_0x1f8477[_0x9e53('0x45')]();}else{_0x1f8477[_0x9e53('0x28')]();}})[_0x9e53('0x10')](function(_0x2088bc){logger['error'](_0x9e53('0xf'),_0x4adbba,JSON[_0x9e53('0x12')](_0x2088bc));_0x1f8477['next']();});}})[_0x9e53('0x10')](function(_0x60d103){logger[_0x9e53('0x11')](_0x9e53('0xf'),_0x4adbba,_0x60d103['message']);_0x1f8477['next']();});}}catch(_0x3e03ac){logger[_0x9e53('0x11')](_0x9e53('0xf'),_0x4adbba,JSON[_0x9e53('0x12')](_0x3e03ac));_0x1f8477[_0x9e53('0x28')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index e138a28..c696d1d 100644 --- a/server/services/routing/server/applications/gotoif.js +++ b/server/services/routing/server/applications/gotoif.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfc22=['message','join','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stop','stringify','lodash','./utils','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','replace','validate','length','error','[%s][GOTOIF]\x20%s'];(function(_0xeceed2,_0x1167ab){var _0x2ddb79=function(_0x4d5760){while(--_0x4d5760){_0xeceed2['push'](_0xeceed2['shift']());}};_0x2ddb79(++_0x1167ab);}(_0xfc22,0x1ce));var _0x2fc2=function(_0x48cd1c,_0x3d840){_0x48cd1c=_0x48cd1c-0x0;var _0x2b88b6=_0xfc22[_0x48cd1c];return _0x2b88b6;};'use strict';var schema=require('validate');var _=require(_0x2fc2('0x0'));var htmlToText=require('html-to-text');var utils=require(_0x2fc2('0x1'));var logger=require('../../../../config/logger')(_0x2fc2('0x2'));var gotoif=schema({'condition':{'type':_0x2fc2('0x3'),'required':!![],'message':_0x2fc2('0x4')},'priorityTrue':{'type':_0x2fc2('0x5'),'message':_0x2fc2('0x6')},'priorityFalse':{'type':'number','message':_0x2fc2('0x7')}});exports[_0x2fc2('0x8')]=function(_0x13bc30,_0x27f8a8){return function(_0x53643d){try{var _0x3518b0={'condition':htmlToText['fromString'](utils['getMustacheRender'](_0x27f8a8[0x0],this),{'wordwrap':![]})[_0x2fc2('0x9')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x27f8a8[0x1],'priorityFalse':_0x27f8a8[0x2]};var _0x545f06=gotoif[_0x2fc2('0xa')](_0x3518b0,{'typecast':!![]});if(_0x545f06[_0x2fc2('0xb')]){logger[_0x2fc2('0xc')](_0x2fc2('0xd'),_0x13bc30,_['map'](_0x545f06,_0x2fc2('0xe'))[_0x2fc2('0xf')](',\x20'));_0x53643d['stop']();}else{try{var _0x222628=eval('('+_0x3518b0[_0x2fc2('0x10')]+')');var _0x2f1b7c=_0x222628?_0x3518b0[_0x2fc2('0x11')]:_0x3518b0[_0x2fc2('0x12')];logger[_0x2fc2('0x13')](_0x2fc2('0x14'),_0x13bc30,_0x3518b0[_0x2fc2('0x10')],_0x222628,_0x2f1b7c||_0x2fc2('0x15'));if(_0x2f1b7c){var _0x41fe6a=_[_0x2fc2('0x16')](_0x53643d[_0x2fc2('0x17')](),{'p':_0x2f1b7c});if(_0x41fe6a>=0x0){logger[_0x2fc2('0x13')](_0x2fc2('0x18'),_0x13bc30,_0x2f1b7c||'next',_0x41fe6a);_0x53643d['next'](_0x41fe6a);}else{logger['info'](_0x2fc2('0x19'),_0x13bc30,_0x2f1b7c||_0x2fc2('0x15'));_0x53643d[_0x2fc2('0x1a')]();}}else{_0x53643d[_0x2fc2('0x15')]();}}catch(_0xb739c4){logger['error']('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x13bc30,_0xb739c4[_0x2fc2('0xe')]);_0x53643d[_0x2fc2('0x1a')]();}}}catch(_0x3edc12){logger[_0x2fc2('0xc')](_0x2fc2('0xd'),_0x13bc30,JSON[_0x2fc2('0x1b')](_0x3edc12));_0x53643d[_0x2fc2('0x1a')]();}};}; \ No newline at end of file +var _0x5024=['[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','message','stringify','validate','html-to-text','./utils','../../../../config/logger','routing','string','priority\x20true\x20is\x20a\x20number','number','priority\x20false\x20is\x20a\x20number','consequence','length','error','[%s][GOTOIF]\x20%s','map','stop','condition','priorityTrue','priorityFalse','rules','info','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5024,0x86));var _0x4502=function(_0xc0cc78,_0x37acef){_0xc0cc78=_0xc0cc78-0x0;var _0x39efbb=_0x5024[_0xc0cc78];return _0x39efbb;};'use strict';var schema=require(_0x4502('0x0'));var _=require('lodash');var htmlToText=require(_0x4502('0x1'));var utils=require(_0x4502('0x2'));var logger=require(_0x4502('0x3'))(_0x4502('0x4'));var gotoif=schema({'condition':{'type':_0x4502('0x5'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':'number','message':_0x4502('0x6')},'priorityFalse':{'type':_0x4502('0x7'),'message':_0x4502('0x8')}});exports[_0x4502('0x9')]=function(_0x396fdd,_0x331a3e){return function(_0x6e7619){try{var _0x480f07={'condition':htmlToText['fromString'](utils['getMustacheRender'](_0x331a3e[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x331a3e[0x1],'priorityFalse':_0x331a3e[0x2]};var _0x856bf3=gotoif['validate'](_0x480f07,{'typecast':!![]});if(_0x856bf3[_0x4502('0xa')]){logger[_0x4502('0xb')](_0x4502('0xc'),_0x396fdd,_[_0x4502('0xd')](_0x856bf3,'message')['join'](',\x20'));_0x6e7619[_0x4502('0xe')]();}else{try{var _0x2bef8e=eval('('+_0x480f07[_0x4502('0xf')]+')');var _0x5248ad=_0x2bef8e?_0x480f07[_0x4502('0x10')]:_0x480f07[_0x4502('0x11')];logger['info']('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x396fdd,_0x480f07[_0x4502('0xf')],_0x2bef8e,_0x5248ad||'next');if(_0x5248ad){var _0x4c7445=_['findIndex'](_0x6e7619[_0x4502('0x12')](),{'p':_0x5248ad});if(_0x4c7445>=0x0){logger[_0x4502('0x13')](_0x4502('0x14'),_0x396fdd,_0x5248ad||_0x4502('0x15'),_0x4c7445);_0x6e7619[_0x4502('0x15')](_0x4c7445);}else{logger['info'](_0x4502('0x16'),_0x396fdd,_0x5248ad||_0x4502('0x15'));_0x6e7619['stop']();}}else{_0x6e7619[_0x4502('0x15')]();}}catch(_0x301b8a){logger[_0x4502('0xb')](_0x4502('0x17'),_0x396fdd,_0x301b8a[_0x4502('0x18')]);_0x6e7619[_0x4502('0xe')]();}}}catch(_0x31119d){logger[_0x4502('0xb')](_0x4502('0xc'),_0x396fdd,JSON[_0x4502('0x19')](_0x31119d));_0x6e7619[_0x4502('0xe')]();}};}; \ 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 8091403..7f6d6f7 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 _0x7628=['[%s][GOTOP]\x20priority\x20%s','priority','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','message','join','stop','info'];(function(_0xbf87ba,_0x5e4675){var _0x4d48f3=function(_0x53e61d){while(--_0x53e61d){_0xbf87ba['push'](_0xbf87ba['shift']());}};_0x4d48f3(++_0x5e4675);}(_0x7628,0x7e));var _0x8762=function(_0x5cbe77,_0x47d45d){_0x5cbe77=_0x5cbe77-0x0;var _0x546a1e=_0x7628[_0x5cbe77];return _0x546a1e;};'use strict';var schema=require(_0x8762('0x0'));var _=require(_0x8762('0x1'));var logger=require(_0x8762('0x2'))(_0x8762('0x3'));var gotop=schema({'priority':{'type':_0x8762('0x4'),'required':!![],'message':_0x8762('0x5')}});exports[_0x8762('0x6')]=function(_0xfe2ef5,_0x35b52f){return function(_0x1ac713){try{var _0x463a={'priority':_0x35b52f[0x0]};var _0x50fe61=gotop[_0x8762('0x0')](_0x463a,{'typecast':!![]});if(_0x50fe61[_0x8762('0x7')]){logger[_0x8762('0x8')](_0x8762('0x9'),_0xfe2ef5,_['map'](_0x50fe61,_0x8762('0xa'))[_0x8762('0xb')](',\x20'));_0x1ac713[_0x8762('0xc')]();}else{logger[_0x8762('0xd')](_0x8762('0xe'),_0xfe2ef5,_0x463a[_0x8762('0xf')]);if(_0x463a[_0x8762('0xf')]){var _0x5b7483=_['findIndex'](_0x1ac713[_0x8762('0x10')](),{'p':_0x463a[_0x8762('0xf')]});if(_0x5b7483>=0x0){logger[_0x8762('0xd')](_0x8762('0x11'),_0xfe2ef5,_0x463a[_0x8762('0xf')]||_0x8762('0x12'),_0x5b7483);_0x1ac713['next'](_0x5b7483);}else{logger[_0x8762('0xd')](_0x8762('0x13'),_0xfe2ef5,_0x463a[_0x8762('0xf')]||_0x8762('0x12'));_0x1ac713[_0x8762('0xc')]();}}else{_0x1ac713['next']();}}}catch(_0x24bd0e){logger[_0x8762('0x8')]('[%s][GOTOP]\x20%s',_0xfe2ef5,JSON['stringify'](_0x24bd0e));_0x1ac713['stop']();}};}; \ No newline at end of file +var _0x81ce=['join','stop','info','priority','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','stringify','validate','lodash','number','consequence','length','error','map','message'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0x81ce,0xa8));var _0xe81c=function(_0x49fcb0,_0x5d7864){_0x49fcb0=_0x49fcb0-0x0;var _0x159782=_0x81ce[_0x49fcb0];return _0x159782;};'use strict';var schema=require(_0xe81c('0x0'));var _=require(_0xe81c('0x1'));var logger=require('../../../../config/logger')('routing');var gotop=schema({'priority':{'type':_0xe81c('0x2'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0xe81c('0x3')]=function(_0x3c7118,_0x275d50){return function(_0x1afa73){try{var _0x5365a8={'priority':_0x275d50[0x0]};var _0x9e2215=gotop['validate'](_0x5365a8,{'typecast':!![]});if(_0x9e2215[_0xe81c('0x4')]){logger[_0xe81c('0x5')]('[%s][GOTOP]\x20%s',_0x3c7118,_[_0xe81c('0x6')](_0x9e2215,_0xe81c('0x7'))[_0xe81c('0x8')](',\x20'));_0x1afa73[_0xe81c('0x9')]();}else{logger[_0xe81c('0xa')]('[%s][GOTOP]\x20priority\x20%s',_0x3c7118,_0x5365a8[_0xe81c('0xb')]);if(_0x5365a8['priority']){var _0x52ea0e=_['findIndex'](_0x1afa73[_0xe81c('0xc')](),{'p':_0x5365a8['priority']});if(_0x52ea0e>=0x0){logger[_0xe81c('0xa')](_0xe81c('0xd'),_0x3c7118,_0x5365a8[_0xe81c('0xb')]||_0xe81c('0xe'),_0x52ea0e);_0x1afa73[_0xe81c('0xe')](_0x52ea0e);}else{logger[_0xe81c('0xa')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x3c7118,_0x5365a8['priority']||'next');_0x1afa73[_0xe81c('0x9')]();}}else{_0x1afa73[_0xe81c('0xe')]();}}}catch(_0x3c8927){logger['error']('[%s][GOTOP]\x20%s',_0x3c7118,JSON[_0xe81c('0xf')](_0x3c8927));_0x1afa73[_0xe81c('0x9')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index f3ee9dc..3a5a32e 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 _0xffda=['info','next','catch','[%s][MESSAGE]\x20%s','stringify','stop','error','lodash','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','getMustacheRender','contact','channel','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','interaction','Message','create','then'];(function(_0x3a79e0,_0x42a8fa){var _0x4a6e80=function(_0x3b1baf){while(--_0x3b1baf){_0x3a79e0['push'](_0x3a79e0['shift']());}};_0x4a6e80(++_0x42a8fa);}(_0xffda,0x73));var _0xaffd=function(_0x54412c,_0x1f2ad6){_0x54412c=_0x54412c-0x0;var _0x3801df=_0xffda[_0x54412c];return _0x3801df;};'use strict';var _=require(_0xaffd('0x0'));var utils=require(_0xaffd('0x1'));var logger=require(_0xaffd('0x2'))(_0xaffd('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xaffd('0x4')),'mailMessage':require(_0xaffd('0x5')),'smsMessage':require(_0xaffd('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xaffd('0x7'))};exports['consequence']=function(_0x2e2be7,_0x400bb8){return function(_0x5747e0){try{var _0x4ca99e={'body':utils[_0xaffd('0x8')](_0x400bb8[0x0],this),'ContactId':this[_0xaffd('0x9')]['id']};if(this[_0xaffd('0xa')]==='chat'){_0x4ca99e[_0xaffd('0xb')]=this[_0xaffd('0xc')]['id'];}else{_0x4ca99e[_['upperFirst'](this['channel'])+_0xaffd('0xd')]=this[_0xaffd('0xc')]['id'];}_0x4ca99e[_[_0xaffd('0xe')](this['channel'])+_0xaffd('0xf')]=this[_0xaffd('0x10')]['id'];if(rpc[this['channel']+_0xaffd('0x11')]){return rpc[this[_0xaffd('0xa')]+_0xaffd('0x11')][_0xaffd('0x12')](_0x4ca99e)[_0xaffd('0x13')](function(_0x5e5c2b){logger[_0xaffd('0x14')]('[%s][MESSAGE]\x20%s',_0x2e2be7,_0x4ca99e['body']);_0x5747e0[_0xaffd('0x15')]();})[_0xaffd('0x16')](function(_0x1be095){logger['error'](_0xaffd('0x17'),_0x2e2be7,JSON[_0xaffd('0x18')](_0x1be095));_0x5747e0[_0xaffd('0x19')]();});}}catch(_0x2de573){logger[_0xaffd('0x1a')](_0xaffd('0x17'),_0x2e2be7,JSON[_0xaffd('0x18')](_0x2de573));_0x5747e0[_0xaffd('0x19')]();}};}; \ No newline at end of file +var _0xe3ad=['stop','error','lodash','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','chat','ChatWebsiteId','account','AccountId','channel','InteractionId','interaction','Message','create','then','info','body','next','catch','[%s][MESSAGE]\x20%s','stringify'];(function(_0x52fc1e,_0x5f6959){var _0x711179=function(_0x36348f){while(--_0x36348f){_0x52fc1e['push'](_0x52fc1e['shift']());}};_0x711179(++_0x5f6959);}(_0xe3ad,0x1cd));var _0xde3a=function(_0xd03a3,_0x32dbe8){_0xd03a3=_0xd03a3-0x0;var _0x180ce9=_0xe3ad[_0xd03a3];return _0x180ce9;};'use strict';var _=require(_0xde3a('0x0'));var utils=require('./utils');var logger=require(_0xde3a('0x1'))(_0xde3a('0x2'));var rpc={'chatMessage':require(_0xde3a('0x3')),'openchannelMessage':require(_0xde3a('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xde3a('0x5'))};exports[_0xde3a('0x6')]=function(_0x5bfe93,_0x440f96){return function(_0x52ef99){try{var _0x1178f3={'body':utils[_0xde3a('0x7')](_0x440f96[0x0],this),'ContactId':this[_0xde3a('0x8')]['id']};if(this['channel']===_0xde3a('0x9')){_0x1178f3[_0xde3a('0xa')]=this[_0xde3a('0xb')]['id'];}else{_0x1178f3[_['upperFirst'](this['channel'])+_0xde3a('0xc')]=this['account']['id'];}_0x1178f3[_['upperFirst'](this[_0xde3a('0xd')])+_0xde3a('0xe')]=this[_0xde3a('0xf')]['id'];if(rpc[this[_0xde3a('0xd')]+'Message']){return rpc[this[_0xde3a('0xd')]+_0xde3a('0x10')][_0xde3a('0x11')](_0x1178f3)[_0xde3a('0x12')](function(_0xd5c7bc){logger[_0xde3a('0x13')]('[%s][MESSAGE]\x20%s',_0x5bfe93,_0x1178f3[_0xde3a('0x14')]);_0x52ef99[_0xde3a('0x15')]();})[_0xde3a('0x16')](function(_0x3e43a8){logger['error'](_0xde3a('0x17'),_0x5bfe93,JSON[_0xde3a('0x18')](_0x3e43a8));_0x52ef99[_0xde3a('0x19')]();});}}catch(_0x2b0167){logger[_0xde3a('0x1a')](_0xde3a('0x17'),_0x5bfe93,JSON[_0xde3a('0x18')](_0x2b0167));_0x52ef99[_0xde3a('0x19')]();}};}; \ 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 bd6eb7a..4fde40a 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 _0xf667=['routing','[%s][NOOP]\x20%s','next','error','stringify','./utils','../../../../config/logger'];(function(_0x3e3e86,_0x12dc19){var _0x4bfbd6=function(_0x38a92f){while(--_0x38a92f){_0x3e3e86['push'](_0x3e3e86['shift']());}};_0x4bfbd6(++_0x12dc19);}(_0xf667,0x18d));var _0x7f66=function(_0x485b5a,_0x2b289b){_0x485b5a=_0x485b5a-0x0;var _0xd2b34d=_0xf667[_0x485b5a];return _0xd2b34d;};'use strict';var utils=require(_0x7f66('0x0'));var logger=require(_0x7f66('0x1'))(_0x7f66('0x2'));exports['consequence']=function(_0x4d6f2a,_0x1c9772){return function(_0x4e9c6a){try{logger['info'](_0x7f66('0x3'),_0x4d6f2a,utils['getMustacheRender'](_0x1c9772[0x0],this));_0x4e9c6a[_0x7f66('0x4')]();}catch(_0x55dd4d){logger[_0x7f66('0x5')](_0x7f66('0x3'),_0x4d6f2a,JSON[_0x7f66('0x6')](_0x55dd4d));_0x4e9c6a['stop']();}};}; \ No newline at end of file +var _0x710c=['./utils','routing','consequence','getMustacheRender','next','error','[%s][NOOP]\x20%s','stringify','stop'];(function(_0x266671,_0xe8f6ee){var _0x5d8d63=function(_0x4c3c7f){while(--_0x4c3c7f){_0x266671['push'](_0x266671['shift']());}};_0x5d8d63(++_0xe8f6ee);}(_0x710c,0x1d4));var _0xc710=function(_0x34ad72,_0x1e43f6){_0x34ad72=_0x34ad72-0x0;var _0x5c9aa8=_0x710c[_0x34ad72];return _0x5c9aa8;};'use strict';var utils=require(_0xc710('0x0'));var logger=require('../../../../config/logger')(_0xc710('0x1'));exports[_0xc710('0x2')]=function(_0xd313f,_0x17c4af){return function(_0x349148){try{logger['info']('[%s][NOOP]\x20%s',_0xd313f,utils[_0xc710('0x3')](_0x17c4af[0x0],this));_0x349148[_0xc710('0x4')]();}catch(_0x4a1c75){logger[_0xc710('0x5')](_0xc710('0x6'),_0xd313f,JSON[_0xc710('0x7')](_0x4a1c75));_0x349148[_0xc710('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 9f6a5ea..7f5369c 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 _0x1ce2=['./strategy','redis','defaults','socket.io-emitter','queue_id','account','from','joinAt','clone','queue','format','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/mailQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','timeout\x20is\x20a\x20number','waiting','body','contact','list','upperFirst','channel','InteractionId','interaction','MessageId','message','chat','AccountId','[%s][START:QUEUE][NAME:%s]','name','QueueReport','catch','error','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','accepted','info','[%s][STOP:QUEUE][NAME:%s]','update','update\x20queue\x20report','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','join','stop','find','Queues','timeout','createQueue','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing'];(function(_0x34dde2,_0x526007){var _0x14eb46=function(_0x4e5ce3){while(--_0x4e5ce3){_0x34dde2['push'](_0x34dde2['shift']());}};_0x14eb46(++_0x526007);}(_0x1ce2,0x8d));var _0x21ce=function(_0x12d51c,_0x28312b){_0x12d51c=_0x12d51c-0x0;var _0x22542b=_0x1ce2[_0x12d51c];return _0x22542b;};'use strict';var schema=require(_0x21ce('0x0'));var _=require(_0x21ce('0x1'));var util=require(_0x21ce('0x2'));var seqqueue=require(_0x21ce('0x3'));var moment=require(_0x21ce('0x4'));var Redis=require(_0x21ce('0x5'));var config=require(_0x21ce('0x6'));var logger=require(_0x21ce('0x7'))(_0x21ce('0x8'));var strategy=require(_0x21ce('0x9'));config[_0x21ce('0xa')]=_[_0x21ce('0xb')](config[_0x21ce('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x21ce('0xc'))(new Redis(config['redis']));var attributes=['id',_0x21ce('0xd'),_0x21ce('0xe'),'queue',_0x21ce('0xf'),_0x21ce('0x10')];function emit(_0x51384e,_0x2a49fa,_0xdd4ad1){io['to'](_0x51384e)['emit'](_0x2a49fa,_0xdd4ad1);}function emitChannelQueueInteraction(_0xe343c9,_0x547b79,_0x22327c,_0x56c02e,_0x451976,_0x341d3c,_0xfcdbc0,_0x1ab983){var _0x597ff7=_[_0x21ce('0x11')](_0x22327c);_0x597ff7['queue_id']=_0x1ab983;_0x597ff7[_0x21ce('0x12')]=_0x547b79;_0x597ff7['account']=_0x56c02e;_0x597ff7['id']=_0x451976;if(_0x341d3c){_0xfcdbc0[util[_0x21ce('0x13')]('%sQueuesWaitingInteractions',_0xe343c9)][_0x451976]=_[_0x21ce('0x14')](_0x597ff7,attributes);}else{delete _0xfcdbc0[util[_0x21ce('0x13')]('%sQueuesWaitingInteractions',_0xe343c9)][_0x451976];}emit(util[_0x21ce('0x13')](_0x21ce('0x15'),_0xe343c9,_0x547b79),util[_0x21ce('0x13')](_0x21ce('0x16'),_0xe343c9,_0x341d3c?_0x21ce('0x17'):_0x21ce('0x18')),_['pick'](_0x597ff7,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x21ce('0x19')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x21ce('0x1a')),'faxQueueReport':require(_0x21ce('0x1b')),'whatsappQueueReport':require(_0x21ce('0x1c'))};var queue=schema({'name':{'type':_0x21ce('0x1d'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0x21ce('0x1e')}});function startRouting(_0x53900b,_0x3f8ef8,_0x320c9a,_0x4d98de){if(_0x53900b&&_0x3f8ef8&&_0x320c9a){_0x3f8ef8[_0x21ce('0x1f')]+=0x1;var _0x2ee141={'uniqueid':_0x53900b,'from':_0x320c9a[_0x21ce('0x20')]?_0x320c9a[_0x21ce('0x20')]['from']:'','joinAt':moment()[_0x21ce('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x320c9a['contact']?_0x320c9a[_0x21ce('0x21')]['id']:null,'ListId':_0x320c9a['list']?_0x320c9a[_0x21ce('0x22')]['id']:null};_0x2ee141[_[_0x21ce('0x23')](_0x320c9a[_0x21ce('0x24')])+'QueueId']=_0x3f8ef8['id']||null;_0x2ee141[_[_0x21ce('0x23')](_0x320c9a[_0x21ce('0x24')])+_0x21ce('0x25')]=_0x320c9a[_0x21ce('0x26')]?_0x320c9a[_0x21ce('0x26')]['id']:null;_0x2ee141[_['upperFirst'](_0x320c9a[_0x21ce('0x24')])+_0x21ce('0x27')]=_0x320c9a[_0x21ce('0x28')]?_0x320c9a['message']['id']:null;_0x2ee141[_[_0x21ce('0x23')](_0x320c9a[_0x21ce('0x24')])+(_0x320c9a['channel']!==_0x21ce('0x29')?_0x21ce('0x2a'):'WebsiteId')]=_0x320c9a[_0x21ce('0xe')]?_0x320c9a[_0x21ce('0xe')]['id']:null;logger['info'](util[_0x21ce('0x13')](_0x21ce('0x2b'),_0x53900b,_0x3f8ef8[_0x21ce('0x2c')]));emitChannelQueueInteraction(_0x320c9a[_0x21ce('0x24')],_0x3f8ef8['name'],_0x2ee141,_0x320c9a['account'][_0x21ce('0x2c')],_0x320c9a[_0x21ce('0x28')]['id'],!![],_0x4d98de,_0x3f8ef8['id']);if(rpc[_0x320c9a['channel']+_0x21ce('0x2d')]){return rpc[_0x320c9a[_0x21ce('0x24')]+_0x21ce('0x2d')]['create'](_0x2ee141)[_0x21ce('0x2e')](function(_0x1cf4c6){logger[_0x21ce('0x2f')](_0x21ce('0x30'));});}}}function stopRouting(_0x50d8ad,_0xd88688,_0x2f598a,_0x3c39ab){if(_0x50d8ad&&_0xd88688){_0xd88688['waiting']-=0x1;var _0x4fce08={'leaveAt':moment()[_0x21ce('0x13')](_0x21ce('0x31')),'acceptAt':moment()[_0x21ce('0x13')](_0x21ce('0x31')),'reason':_0x21ce('0x32')};logger[_0x21ce('0x33')](util['format'](_0x21ce('0x34'),_0x50d8ad,_0xd88688[_0x21ce('0x2c')]));emitChannelQueueInteraction(_0x2f598a[_0x21ce('0x24')],_0xd88688['name'],_0x2f598a[_0x21ce('0x20')],_0x2f598a['account']['name'],_0x2f598a['message']['id'],![],_0x3c39ab,_0xd88688['id']);if(rpc[_0x2f598a[_0x21ce('0x24')]+_0x21ce('0x2d')]){return rpc[_0x2f598a[_0x21ce('0x24')]+_0x21ce('0x2d')][_0x21ce('0x35')](_0x50d8ad,_0x4fce08)[_0x21ce('0x2e')](function(_0x4d97a8){logger['error'](_0x21ce('0x36'));});}}}function endRouting(_0x57750f,_0x3e73d9,_0x37a915,_0xcd27b8){if(_0x57750f&&_0x3e73d9){_0x3e73d9[_0x21ce('0x1f')]-=0x1;var _0x3e4747={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format'](_0x21ce('0x31')),'reason':'timeout'};logger['info'](util[_0x21ce('0x13')](_0x21ce('0x37'),_0x57750f,_0x3e73d9['name']));emitChannelQueueInteraction(_0x37a915[_0x21ce('0x24')],_0x3e73d9[_0x21ce('0x2c')],_0x37a915[_0x21ce('0x20')],_0x37a915[_0x21ce('0xe')][_0x21ce('0x2c')],_0x37a915[_0x21ce('0x28')]['id'],![],_0xcd27b8);if(rpc[_0x37a915[_0x21ce('0x24')]+_0x21ce('0x2d')]){return rpc[_0x37a915[_0x21ce('0x24')]+_0x21ce('0x2d')][_0x21ce('0x35')](_0x57750f,_0x3e4747)[_0x21ce('0x2e')](function(_0x20d085){logger[_0x21ce('0x2f')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x524956){return function(_0x2d5920){return _0x2d5920['name'][_0x21ce('0x38')]()===_0x524956[_0x21ce('0x38')]();};}exports[_0x21ce('0x39')]=function(_0x5442ca,_0x123e91,_0x53c512,_0x507816){return function(_0x5e35ba){try{var _0x5a2190={'name':_0x123e91[0x0],'timeout':_0x123e91[0x1]};var _0x496466=queue['validate'](_0x5a2190,{'typecast':!![]});if(_0x496466[_0x21ce('0x3a')]){logger['error'](_0x21ce('0x3b'),_0x5442ca,_['map'](_0x496466,'message')[_0x21ce('0x3c')](',\x20'));_0x5e35ba[_0x21ce('0x3d')]();}else{var _0x553abb=_[_0x21ce('0x3e')](_0x53c512[_0x507816['channel']+_0x21ce('0x3f')],handleFindQueue(_0x5a2190[_0x21ce('0x2c')]));if(_0x553abb){startRouting(_0x5442ca,_0x553abb,_0x507816,_0x53c512);var _0x464659=(_0x553abb[_0x21ce('0x40')]||0xa)*0x3e8;var _0x572a4b=(_0x5a2190['timeout']||0x14)*0x3e8;var _0x3bfaa7,_0x4e1a5e;if(_0x464659>_0x572a4b){_0x572a4b=_0x464659;}var _0x504b10=seqqueue[_0x21ce('0x41')](_0x464659);_0x504b10['id']=_0x5442ca;_0x504b10['atimeout']=_0x464659;_0x504b10['qtimeout']=_0x572a4b;_0x504b10[_0x21ce('0x24')]=_0x507816[_0x21ce('0x24')];_0x53c512[_0x21ce('0x42')][_0x5442ca]['on']('end',function(){logger['info'](_0x21ce('0x43'),_0x5442ca);stopRouting(_0x5442ca,_0x553abb,_0x507816,_0x53c512);clearTimeout(_0x3bfaa7);_0x3bfaa7=undefined;_0x504b10['close'](!![]);if(_0x53c512[_0x21ce('0x42')][_0x5442ca]){delete _0x53c512[_0x21ce('0x42')][_0x5442ca];}_0x5e35ba[_0x21ce('0x3d')]();});_0x53c512[_0x21ce('0x42')][_0x5442ca]['on']('complete',function(){if(_0x53c512[_0x21ce('0x42')][_0x5442ca]){delete _0x53c512[_0x21ce('0x42')][_0x5442ca];}});_0x3bfaa7=setTimeout(function(){logger['info']('[%s][QUEUE]\x20APPLICATION\x20END',_0x5442ca);endRouting(_0x5442ca,_0x553abb,_0x507816,_0x53c512);clearTimeout(_0x3bfaa7);_0x504b10[_0x21ce('0x44')](!![]);_0x5e35ba[_0x21ce('0x45')]();},_0x572a4b);switch(_0x553abb[_0x21ce('0x46')]){case _0x21ce('0x47'):strategy['rrmemory'](_0x504b10,_0x553abb,_0x53c512,_0x507816);break;default:strategy[_0x21ce('0x48')](_0x504b10,_0x553abb,_0x53c512,_0x507816);}}else{logger[_0x21ce('0x2f')](_0x21ce('0x49'),_0x5442ca,_0x5a2190[_0x21ce('0x2c')]);_0x5e35ba['stop']();}}}catch(_0x21c9c7){console[_0x21ce('0x4a')](_0x21c9c7);logger[_0x21ce('0x2f')](_0x21ce('0x3b'),_0x5442ca,_0x21c9c7['stack']);_0x5e35ba[_0x21ce('0x3d')]();}};}; \ No newline at end of file +var _0xf632=['YYYY-MM-DD\x20HH:mm:ss','accepted','info','[%s][STOP:QUEUE][NAME:%s]','update','error','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','stop','Queues','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','complete','close','strategy','rrmemory','beepall','log','validate','lodash','moment','ioredis','../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','account','queue','from','joinAt','emit','clone','queue_id','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','pick','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','contact','list','upperFirst','channel','InteractionId','MessageId','message','chat','AccountId','WebsiteId','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','create\x20queue\x20report'];(function(_0x4edc37,_0x39dd18){var _0x4e22d8=function(_0x903497){while(--_0x903497){_0x4edc37['push'](_0x4edc37['shift']());}};_0x4e22d8(++_0x39dd18);}(_0xf632,0x1e9));var _0x2f63=function(_0x2f6016,_0x40cf27){_0x2f6016=_0x2f6016-0x0;var _0x3b1858=_0xf632[_0x2f6016];return _0x3b1858;};'use strict';var schema=require(_0x2f63('0x0'));var _=require(_0x2f63('0x1'));var util=require('util');var seqqueue=require('seq-queue');var moment=require(_0x2f63('0x2'));var Redis=require(_0x2f63('0x3'));var config=require('../../../../config/environment');var logger=require(_0x2f63('0x4'))(_0x2f63('0x5'));var strategy=require('./strategy');config[_0x2f63('0x6')]=_[_0x2f63('0x7')](config[_0x2f63('0x6')],{'host':_0x2f63('0x8'),'port':0x18eb});var io=require(_0x2f63('0x9'))(new Redis(config[_0x2f63('0x6')]));var attributes=['id','queue_id',_0x2f63('0xa'),_0x2f63('0xb'),_0x2f63('0xc'),_0x2f63('0xd')];function emit(_0x33e7f8,_0x1e7ca0,_0x5045e3){io['to'](_0x33e7f8)[_0x2f63('0xe')](_0x1e7ca0,_0x5045e3);}function emitChannelQueueInteraction(_0x99a45a,_0x1cff2c,_0x309ad5,_0x2618d1,_0x3a313e,_0x2ac00a,_0x5f2274,_0x3ec345){var _0x51e247=_[_0x2f63('0xf')](_0x309ad5);_0x51e247[_0x2f63('0x10')]=_0x3ec345;_0x51e247['queue']=_0x1cff2c;_0x51e247[_0x2f63('0xa')]=_0x2618d1;_0x51e247['id']=_0x3a313e;if(_0x2ac00a){_0x5f2274[util[_0x2f63('0x11')](_0x2f63('0x12'),_0x99a45a)][_0x3a313e]=_['pick'](_0x51e247,attributes);}else{delete _0x5f2274[util[_0x2f63('0x11')]('%sQueuesWaitingInteractions',_0x99a45a)][_0x3a313e];}emit(util[_0x2f63('0x11')](_0x2f63('0x13'),_0x99a45a,_0x1cff2c),util[_0x2f63('0x11')](_0x2f63('0x14'),_0x99a45a,_0x2ac00a?_0x2f63('0x15'):'remove'),_[_0x2f63('0x16')](_0x51e247,attributes));}var rpc={'openchannelQueueReport':require(_0x2f63('0x17')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x2f63('0x18')),'smsQueueReport':require(_0x2f63('0x19')),'faxQueueReport':require(_0x2f63('0x1a')),'whatsappQueueReport':require(_0x2f63('0x1b'))};var queue=schema({'name':{'type':_0x2f63('0x1c'),'required':!![],'message':_0x2f63('0x1d')},'timeout':{'type':_0x2f63('0x1e'),'message':_0x2f63('0x1f')}});function startRouting(_0x38974d,_0x5c96f9,_0x4bf029,_0x43c109){if(_0x38974d&&_0x5c96f9&&_0x4bf029){_0x5c96f9[_0x2f63('0x20')]+=0x1;var _0x411f80={'uniqueid':_0x38974d,'from':_0x4bf029[_0x2f63('0x21')]?_0x4bf029['body'][_0x2f63('0xc')]:'','joinAt':moment()[_0x2f63('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4bf029[_0x2f63('0x22')]?_0x4bf029[_0x2f63('0x22')]['id']:null,'ListId':_0x4bf029[_0x2f63('0x23')]?_0x4bf029[_0x2f63('0x23')]['id']:null};_0x411f80[_['upperFirst'](_0x4bf029['channel'])+'QueueId']=_0x5c96f9['id']||null;_0x411f80[_[_0x2f63('0x24')](_0x4bf029[_0x2f63('0x25')])+_0x2f63('0x26')]=_0x4bf029['interaction']?_0x4bf029['interaction']['id']:null;_0x411f80[_[_0x2f63('0x24')](_0x4bf029[_0x2f63('0x25')])+_0x2f63('0x27')]=_0x4bf029[_0x2f63('0x28')]?_0x4bf029[_0x2f63('0x28')]['id']:null;_0x411f80[_['upperFirst'](_0x4bf029[_0x2f63('0x25')])+(_0x4bf029[_0x2f63('0x25')]!==_0x2f63('0x29')?_0x2f63('0x2a'):_0x2f63('0x2b'))]=_0x4bf029[_0x2f63('0xa')]?_0x4bf029[_0x2f63('0xa')]['id']:null;logger['info'](util['format'](_0x2f63('0x2c'),_0x38974d,_0x5c96f9[_0x2f63('0x2d')]));emitChannelQueueInteraction(_0x4bf029[_0x2f63('0x25')],_0x5c96f9[_0x2f63('0x2d')],_0x411f80,_0x4bf029[_0x2f63('0xa')][_0x2f63('0x2d')],_0x4bf029[_0x2f63('0x28')]['id'],!![],_0x43c109,_0x5c96f9['id']);if(rpc[_0x4bf029['channel']+_0x2f63('0x2e')]){return rpc[_0x4bf029[_0x2f63('0x25')]+_0x2f63('0x2e')][_0x2f63('0x2f')](_0x411f80)[_0x2f63('0x30')](function(_0x40b49b){logger['error'](_0x2f63('0x31'));});}}}function stopRouting(_0x2048c7,_0x2c7531,_0x2b1dbd,_0x1062f4){if(_0x2048c7&&_0x2c7531){_0x2c7531['waiting']-=0x1;var _0x26a695={'leaveAt':moment()[_0x2f63('0x11')](_0x2f63('0x32')),'acceptAt':moment()[_0x2f63('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x2f63('0x33')};logger[_0x2f63('0x34')](util[_0x2f63('0x11')](_0x2f63('0x35'),_0x2048c7,_0x2c7531[_0x2f63('0x2d')]));emitChannelQueueInteraction(_0x2b1dbd[_0x2f63('0x25')],_0x2c7531[_0x2f63('0x2d')],_0x2b1dbd[_0x2f63('0x21')],_0x2b1dbd[_0x2f63('0xa')][_0x2f63('0x2d')],_0x2b1dbd[_0x2f63('0x28')]['id'],![],_0x1062f4,_0x2c7531['id']);if(rpc[_0x2b1dbd['channel']+_0x2f63('0x2e')]){return rpc[_0x2b1dbd[_0x2f63('0x25')]+'QueueReport'][_0x2f63('0x36')](_0x2048c7,_0x26a695)[_0x2f63('0x30')](function(_0x42eac3){logger[_0x2f63('0x37')]('update\x20queue\x20report');});}}}function endRouting(_0x467fd4,_0x1ae067,_0xf00cb7,_0x590ac8){if(_0x467fd4&&_0x1ae067){_0x1ae067[_0x2f63('0x20')]-=0x1;var _0x4c8ed6={'leaveAt':moment()[_0x2f63('0x11')](_0x2f63('0x32')),'exitAt':moment()[_0x2f63('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x2f63('0x38')};logger[_0x2f63('0x34')](util[_0x2f63('0x11')](_0x2f63('0x39'),_0x467fd4,_0x1ae067[_0x2f63('0x2d')]));emitChannelQueueInteraction(_0xf00cb7[_0x2f63('0x25')],_0x1ae067[_0x2f63('0x2d')],_0xf00cb7[_0x2f63('0x21')],_0xf00cb7[_0x2f63('0xa')][_0x2f63('0x2d')],_0xf00cb7[_0x2f63('0x28')]['id'],![],_0x590ac8);if(rpc[_0xf00cb7['channel']+_0x2f63('0x2e')]){return rpc[_0xf00cb7['channel']+_0x2f63('0x2e')]['update'](_0x467fd4,_0x4c8ed6)[_0x2f63('0x30')](function(_0x116464){logger['error']('update\x20queue\x20report');});}}}function handleFindQueue(_0x35eb06){return function(_0x14a904){return _0x14a904['name'][_0x2f63('0x3a')]()===_0x35eb06[_0x2f63('0x3a')]();};}exports[_0x2f63('0x3b')]=function(_0x224b7d,_0x532be8,_0x39d7bd,_0x10301c){return function(_0x5c78a5){try{var _0x1911a0={'name':_0x532be8[0x0],'timeout':_0x532be8[0x1]};var _0x3818d9=queue['validate'](_0x1911a0,{'typecast':!![]});if(_0x3818d9[_0x2f63('0x3c')]){logger[_0x2f63('0x37')](_0x2f63('0x3d'),_0x224b7d,_[_0x2f63('0x3e')](_0x3818d9,_0x2f63('0x28'))[_0x2f63('0x3f')](',\x20'));_0x5c78a5[_0x2f63('0x40')]();}else{var _0x2ed6ce=_['find'](_0x39d7bd[_0x10301c['channel']+_0x2f63('0x41')],handleFindQueue(_0x1911a0['name']));if(_0x2ed6ce){startRouting(_0x224b7d,_0x2ed6ce,_0x10301c,_0x39d7bd);var _0x173316=(_0x2ed6ce[_0x2f63('0x38')]||0xa)*0x3e8;var _0x3ef95e=(_0x1911a0['timeout']||0x14)*0x3e8;var _0x2d80a8,_0x3dd448;if(_0x173316>_0x3ef95e){_0x3ef95e=_0x173316;}var _0x32be80=seqqueue['createQueue'](_0x173316);_0x32be80['id']=_0x224b7d;_0x32be80[_0x2f63('0x42')]=_0x173316;_0x32be80[_0x2f63('0x43')]=_0x3ef95e;_0x32be80[_0x2f63('0x25')]=_0x10301c[_0x2f63('0x25')];_0x39d7bd[_0x2f63('0x44')][_0x224b7d]['on'](_0x2f63('0x45'),function(){logger['info'](_0x2f63('0x46'),_0x224b7d);stopRouting(_0x224b7d,_0x2ed6ce,_0x10301c,_0x39d7bd);clearTimeout(_0x2d80a8);_0x2d80a8=undefined;_0x32be80['close'](!![]);if(_0x39d7bd['rules'][_0x224b7d]){delete _0x39d7bd[_0x2f63('0x44')][_0x224b7d];}_0x5c78a5[_0x2f63('0x40')]();});_0x39d7bd[_0x2f63('0x44')][_0x224b7d]['on'](_0x2f63('0x47'),function(){if(_0x39d7bd[_0x2f63('0x44')][_0x224b7d]){delete _0x39d7bd[_0x2f63('0x44')][_0x224b7d];}});_0x2d80a8=setTimeout(function(){logger[_0x2f63('0x34')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x224b7d);endRouting(_0x224b7d,_0x2ed6ce,_0x10301c,_0x39d7bd);clearTimeout(_0x2d80a8);_0x32be80[_0x2f63('0x48')](!![]);_0x5c78a5['next']();},_0x3ef95e);switch(_0x2ed6ce[_0x2f63('0x49')]){case _0x2f63('0x4a'):strategy[_0x2f63('0x4a')](_0x32be80,_0x2ed6ce,_0x39d7bd,_0x10301c);break;default:strategy[_0x2f63('0x4b')](_0x32be80,_0x2ed6ce,_0x39d7bd,_0x10301c);}}else{logger['error']('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x224b7d,_0x1911a0[_0x2f63('0x2d')]);_0x5c78a5[_0x2f63('0x40')]();}}}catch(_0x1f0a84){console[_0x2f63('0x4c')](_0x1f0a84);logger[_0x2f63('0x37')]('[%s][QUEUE]\x20%s',_0x224b7d,_0x1f0a84['stack']);_0x5c78a5['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index f85427c..80da860 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 _0x65be=['busy','busyQueue','writeLog','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','agent','squeue','push','bind','handleTimeout','drained','handleDrained','prototype','handleRun','isNil','agents','info','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','channel','realtime','showNotification','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x65be,0xfc));var _0xe65b=function(_0x21a0a8,_0x507228){_0x21a0a8=_0x21a0a8-0x0;var _0x42bd3b=_0x65be[_0x21a0a8];return _0x42bd3b;};'use strict';var _=require(_0xe65b('0x0'));var uuid=require(_0xe65b('0x1'));var util=require(_0xe65b('0x2'));var logger=require(_0xe65b('0x3'))(_0xe65b('0x4'));var Agent=function(_0xbe9c56,_0x346146,_0x39ac89,_0x1cf96d){this[_0xe65b('0x5')]=uuid['v4']();this['squeue']=_0xbe9c56;this[_0xe65b('0x6')]=_0x346146;this['realtime']=_0x39ac89;this[_0xe65b('0x4')]=_0x1cf96d;this[_0xe65b('0x7')][_0xe65b('0x8')](this['handleRun'][_0xe65b('0x9')](this),this[_0xe65b('0xa')]['bind'](this));this[_0xe65b('0x7')]['on']('timeout',this[_0xe65b('0xa')]['bind'](this));this['squeue']['on'](_0xe65b('0xb'),this[_0xe65b('0xc')][_0xe65b('0x9')](this));};Agent[_0xe65b('0xd')]['push']=function(){this[_0xe65b('0x7')][_0xe65b('0x8')](this['handleRun'][_0xe65b('0x9')](this),this[_0xe65b('0xa')][_0xe65b('0x9')](this));};Agent['prototype'][_0xe65b('0xc')]=function(){this[_0xe65b('0xa')](!![]);};Agent[_0xe65b('0xd')][_0xe65b('0xe')]=function(_0x5466f8){logger['info']('[%s][AGENT]\x20try\x20with\x20%s',this[_0xe65b('0x7')]['id'],this['agent']['id']);if(_[_0xe65b('0xf')](this['realtime'][_0xe65b('0x10')][this[_0xe65b('0x6')]['id']])){logger[_0xe65b('0x11')](_0xe65b('0x12'),this[_0xe65b('0x7')]['id'],this['agent']['id']);setTimeout(this[_0xe65b('0x8')][_0xe65b('0x9')](this),0x3e8);}else{if(this[_0xe65b('0x4')][_0xe65b('0x13')]||util['isAgentAvailable'](this[_0xe65b('0x7')]['id'],this['realtime'][_0xe65b('0x10')][this[_0xe65b('0x6')]['id']],this[_0xe65b('0x7')][_0xe65b('0x14')],![])){this[_0xe65b('0x15')][_0xe65b('0x10')][this[_0xe65b('0x6')]['id']]['busy']=!![];this[_0xe65b('0x15')][_0xe65b('0x10')][this[_0xe65b('0x6')]['id']]['busyQueue']=undefined;util[_0xe65b('0x16')](this[_0xe65b('0x5')],this[_0xe65b('0x7')]['id'],this[_0xe65b('0x15')][_0xe65b('0x10')][this[_0xe65b('0x6')]['id']],null,this['routing']);util['writeLog'](this['squeue']['id'],this['realtime'][_0xe65b('0x10')][this[_0xe65b('0x6')]['id']],_0xe65b('0x17')+(this['routing'][_0xe65b('0x13')]?':FORCED':''));}else{logger[_0xe65b('0x11')](_0xe65b('0x18'),this[_0xe65b('0x7')]['id'],this[_0xe65b('0x6')]['id']);setTimeout(this[_0xe65b('0x8')][_0xe65b('0x9')](this),0x3e8);}}};Agent['prototype']['handleTimeout']=function(_0x446152){if(_[_0xe65b('0xf')](this[_0xe65b('0x15')][_0xe65b('0x10')][this[_0xe65b('0x6')]['id']])){return logger[_0xe65b('0x11')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xe65b('0x7')]['id'],this['agent']['id']);}else{logger[_0xe65b('0x11')](_0xe65b('0x19'),this['squeue']['id'],this[_0xe65b('0x6')]['id']);util[_0xe65b('0x1a')](this['notificationId'],this[_0xe65b('0x7')]['id'],this['realtime'][_0xe65b('0x10')][this[_0xe65b('0x6')]['id']],null,this[_0xe65b('0x4')]);this[_0xe65b('0x15')][_0xe65b('0x10')][this[_0xe65b('0x6')]['id']][_0xe65b('0x1b')]=![];this[_0xe65b('0x15')][_0xe65b('0x10')][this['agent']['id']][_0xe65b('0x1c')]=undefined;util[_0xe65b('0x1d')](this['squeue']['id'],this[_0xe65b('0x15')][_0xe65b('0x10')][this[_0xe65b('0x6')]['id']],_0x446152?'STOP':'TIMEOUT');}if(!_0x446152){setTimeout(this['push']['bind'](this),0x3e8);}};function agent(_0x47a800,_0x67d87e,_0x38bd6b,_0x33508c){return new Agent(_0x47a800,_0x67d87e,_0x38bd6b,_0x33508c);}module[_0xe65b('0x1e')]=agent; \ No newline at end of file +var _0xdb40=['writeLog','forcedOwnership',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','TIMEOUT','exports','uuid','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','bind','handleTimeout','drained','handleRun','handleDrained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','channel','busy','busyQueue','showNotification'];(function(_0x1e23f5,_0x5d4743){var _0xb815c5=function(_0x38c6b0){while(--_0x38c6b0){_0x1e23f5['push'](_0x1e23f5['shift']());}};_0xb815c5(++_0x5d4743);}(_0xdb40,0x19b));var _0x0db4=function(_0x1f78d8,_0x317cd0){_0x1f78d8=_0x1f78d8-0x0;var _0x3a82d5=_0xdb40[_0x1f78d8];return _0x3a82d5;};'use strict';var _=require('lodash');var uuid=require(_0x0db4('0x0'));var util=require('./util');var logger=require(_0x0db4('0x1'))(_0x0db4('0x2'));var Agent=function(_0x34a982,_0x3ba7fb,_0x34da0b,_0x40c6eb){this[_0x0db4('0x3')]=uuid['v4']();this[_0x0db4('0x4')]=_0x34a982;this[_0x0db4('0x5')]=_0x3ba7fb;this[_0x0db4('0x6')]=_0x34da0b;this[_0x0db4('0x2')]=_0x40c6eb;this[_0x0db4('0x4')][_0x0db4('0x7')](this['handleRun'][_0x0db4('0x8')](this),this[_0x0db4('0x9')]['bind'](this));this[_0x0db4('0x4')]['on']('timeout',this[_0x0db4('0x9')][_0x0db4('0x8')](this));this['squeue']['on'](_0x0db4('0xa'),this['handleDrained']['bind'](this));};Agent['prototype'][_0x0db4('0x7')]=function(){this[_0x0db4('0x4')][_0x0db4('0x7')](this[_0x0db4('0xb')]['bind'](this),this[_0x0db4('0x9')][_0x0db4('0x8')](this));};Agent['prototype'][_0x0db4('0xc')]=function(){this[_0x0db4('0x9')](!![]);};Agent[_0x0db4('0xd')][_0x0db4('0xb')]=function(_0x2277fe){logger[_0x0db4('0xe')](_0x0db4('0xf'),this[_0x0db4('0x4')]['id'],this[_0x0db4('0x5')]['id']);if(_[_0x0db4('0x10')](this[_0x0db4('0x6')][_0x0db4('0x11')][this[_0x0db4('0x5')]['id']])){logger[_0x0db4('0xe')](_0x0db4('0x12'),this[_0x0db4('0x4')]['id'],this['agent']['id']);setTimeout(this['push'][_0x0db4('0x8')](this),0x3e8);}else{if(this[_0x0db4('0x2')]['forcedOwnership']||util['isAgentAvailable'](this[_0x0db4('0x4')]['id'],this[_0x0db4('0x6')]['agents'][this[_0x0db4('0x5')]['id']],this[_0x0db4('0x4')][_0x0db4('0x13')],![])){this[_0x0db4('0x6')][_0x0db4('0x11')][this[_0x0db4('0x5')]['id']][_0x0db4('0x14')]=!![];this['realtime'][_0x0db4('0x11')][this['agent']['id']][_0x0db4('0x15')]=undefined;util[_0x0db4('0x16')](this[_0x0db4('0x3')],this[_0x0db4('0x4')]['id'],this[_0x0db4('0x6')][_0x0db4('0x11')][this['agent']['id']],null,this['routing']);util[_0x0db4('0x17')](this[_0x0db4('0x4')]['id'],this[_0x0db4('0x6')][_0x0db4('0x11')][this[_0x0db4('0x5')]['id']],'RINGING'+(this[_0x0db4('0x2')][_0x0db4('0x18')]?_0x0db4('0x19'):''));}else{logger['info'](_0x0db4('0x1a'),this[_0x0db4('0x4')]['id'],this[_0x0db4('0x5')]['id']);setTimeout(this[_0x0db4('0x7')][_0x0db4('0x8')](this),0x3e8);}}};Agent[_0x0db4('0xd')]['handleTimeout']=function(_0x252878){if(_[_0x0db4('0x10')](this['realtime'][_0x0db4('0x11')][this['agent']['id']])){return logger[_0x0db4('0xe')](_0x0db4('0x12'),this[_0x0db4('0x4')]['id'],this[_0x0db4('0x5')]['id']);}else{logger[_0x0db4('0xe')](_0x0db4('0x1b'),this[_0x0db4('0x4')]['id'],this[_0x0db4('0x5')]['id']);util[_0x0db4('0x1c')](this[_0x0db4('0x3')],this[_0x0db4('0x4')]['id'],this['realtime'][_0x0db4('0x11')][this[_0x0db4('0x5')]['id']],null,this[_0x0db4('0x2')]);this['realtime']['agents'][this[_0x0db4('0x5')]['id']][_0x0db4('0x14')]=![];this[_0x0db4('0x6')][_0x0db4('0x11')][this[_0x0db4('0x5')]['id']][_0x0db4('0x15')]=undefined;util[_0x0db4('0x17')](this['squeue']['id'],this[_0x0db4('0x6')][_0x0db4('0x11')][this[_0x0db4('0x5')]['id']],_0x252878?'STOP':_0x0db4('0x1d'));}if(!_0x252878){setTimeout(this[_0x0db4('0x7')][_0x0db4('0x8')](this),0x3e8);}};function agent(_0xbb61a4,_0x376124,_0x435010,_0x4dc0d9){return new Agent(_0xbb61a4,_0x376124,_0x435010,_0x4dc0d9);}module[_0x0db4('0x1e')]=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 af412f5..cd7015c 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 _0xc4f5=['realtime','routing','squeue','push','bind','timeout','handleTimeout','drained','handleDrained','handleRun','prototype','isNil','length','Agents','agents','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','channel','writeLog','busy','name','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','STOP','TIMEOUT','busyQueue','exports','uuid','./util','../../../../../config/logger','notificationId','queue'];(function(_0x5041b0,_0x4e8c28){var _0xfa4f97=function(_0x14afb6){while(--_0x14afb6){_0x5041b0['push'](_0x5041b0['shift']());}};_0xfa4f97(++_0x4e8c28);}(_0xc4f5,0xa5));var _0x5c4f=function(_0x495123,_0x2bf158){_0x495123=_0x495123-0x0;var _0x39e1ee=_0xc4f5[_0x495123];return _0x39e1ee;};'use strict';var _=require('lodash');var uuid=require(_0x5c4f('0x0'));var util=require(_0x5c4f('0x1'));var logger=require(_0x5c4f('0x2'))('routing');var Beepall=function(_0x11c151,_0x221555,_0x24c5b6,_0xfd69b2){this[_0x5c4f('0x3')]=uuid['v4']();this['squeue']=_0x11c151;this[_0x5c4f('0x4')]=_0x221555;this[_0x5c4f('0x5')]=_0x24c5b6;this[_0x5c4f('0x6')]=_0xfd69b2;this[_0x5c4f('0x7')][_0x5c4f('0x8')](this['handleRun'][_0x5c4f('0x9')](this),this['handleTimeout'][_0x5c4f('0x9')](this));this['squeue']['on'](_0x5c4f('0xa'),this[_0x5c4f('0xb')][_0x5c4f('0x9')](this));this[_0x5c4f('0x7')]['on'](_0x5c4f('0xc'),this[_0x5c4f('0xd')][_0x5c4f('0x9')](this));};Beepall['prototype'][_0x5c4f('0x8')]=function(){this[_0x5c4f('0x7')]['push'](this[_0x5c4f('0xe')][_0x5c4f('0x9')](this),this[_0x5c4f('0xb')][_0x5c4f('0x9')](this));};Beepall[_0x5c4f('0xf')]['handleDrained']=function(_0x48c4dc){this[_0x5c4f('0xb')](!![]);};Beepall[_0x5c4f('0xf')][_0x5c4f('0xe')]=function(_0x31941b){var _0x193b60=!![];if(!_['isNil'](this['queue'])&&!_[_0x5c4f('0x10')](this['queue']['Agents'])&&this[_0x5c4f('0x4')]['Agents'][_0x5c4f('0x11')]>0x0){for(var _0x2cff0f=0x0,_0x2360da;_0x2cff0f0x0){for(var _0x43263a=0x0,_0x54aef1;_0x43263a0x0&&_0x1b7760[_0x5b6502+_0x22d7('0x27')]>=_0x1b7760[_0x5b6502+_0x22d7('0x28')]){writeLog(_0x141220,_0x1b7760,_0x5b6502['toUpperCase']()+_0x22d7('0x29'));return![];}}return!![];};exports[_0x22d7('0x2a')]=function(_0xfbb9b,_0xce7f15,_0x45dc29,_0x49199a,_0x2606bd){return sendNotification(!![],_0xfbb9b,_0xce7f15,_0x45dc29,_0x49199a,_0x2606bd);};exports[_0x22d7('0x2b')]=function(_0x33c621,_0x2c0b24,_0x539ba0,_0x1195bc,_0x21c334){return sendNotification(![],_0x33c621,_0x2c0b24,_0x539ba0,_0x1195bc,_0x21c334);};exports['writeLog']=writeLog; \ No newline at end of file +var _0x71ab=['[%s][QUEUE]\x20%s','message','user:%s','remove','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','online','OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','hideNotification','util','mustache','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','emit','format','name','user:save','account','notificationSound','notificationShake','queue','body','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error'];(function(_0xa8cfae,_0x13903d){var _0x49e5e2=function(_0x474199){while(--_0x474199){_0xa8cfae['push'](_0xa8cfae['shift']());}};_0x49e5e2(++_0x13903d);}(_0x71ab,0x64));var _0xb71a=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x71ab[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0xb71a('0x0'));var utils=require('../utils');var Mustache=require(_0xb71a('0x1'));var Redis=require('ioredis');var config=require(_0xb71a('0x2'));var logger=require(_0xb71a('0x3'))(_0xb71a('0x4'));config[_0xb71a('0x5')]=_[_0xb71a('0x6')](config[_0xb71a('0x5')],{'host':_0xb71a('0x7'),'port':0x18eb});var io=require(_0xb71a('0x8'))(new Redis(config[_0xb71a('0x5')]));function emit(_0x35a84e,_0x4358ce,_0x2a4c86){io['to'](_0x35a84e)[_0xb71a('0x9')](_0x4358ce,_0x2a4c86);}function sendNotification(_0x471ab6,_0x18c7a6,_0xbfef18,_0x378c96,_0x2e8883,_0x517eed){io['to'](util[_0xb71a('0xa')]('user:%s',_0x378c96[_0xb71a('0xb')]))[_0xb71a('0x9')](_0xb71a('0xc'),_0x378c96);var _0x591311=_0x517eed||{};var _0x3909b4=_0xbfef18['split']('.');var _0x2a2d75={'uniqueid':_0x18c7a6,'channel':_0x3909b4[0x0],'id':_0x3909b4[0x1],'title':_0x3909b4[0x0]+'\x20interaction','interactionId':_0x3909b4[0x2],'queue':_0x2e8883?_0x2e8883['name']:null,'sound':_0x591311[_0xb71a('0xd')][_0xb71a('0xe')],'shake':_0x591311[_0xb71a('0xd')][_0xb71a('0xf')]};try{if(!_0x591311['body']){_0x591311['body']={};}if(_0x2e8883){_0x591311['body'][_0xb71a('0x10')]=_0x2e8883;}else if(_0x591311[_0xb71a('0x11')][_0xb71a('0x10')]){delete _0x591311[_0xb71a('0x11')][_0xb71a('0x10')];}_0x2a2d75[_0xb71a('0x12')]=utils[_0xb71a('0x13')](_0x591311[_0xb71a('0xd')][_0xb71a('0x14')],_0x591311);}catch(_0x5588cf){_0x2a2d75[_0xb71a('0x12')]=_0xb71a('0x15');logger[_0xb71a('0x16')](util[_0xb71a('0xa')](_0xb71a('0x17'),_0x18c7a6,_0x5588cf[_0xb71a('0x18')]));}io['to'](util[_0xb71a('0xa')](_0xb71a('0x19'),_0x378c96[_0xb71a('0xb')]))[_0xb71a('0x9')](util[_0xb71a('0xa')]('notification:%s',_0x471ab6?'save':_0xb71a('0x1a')),_0x2a2d75);}function writeLog(_0x578fe4,_0x4a4f4e,_0x4d8871){return logger[_0xb71a('0x1b')](util['format'](_0xb71a('0x1c'),_0x578fe4,_0x4a4f4e[_0xb71a('0xb')],_0x4d8871));}exports[_0xb71a('0x1d')]=function(_0x18fa8d,_0x38a728,_0x14b2a1,_0x2f4fac){if(_0x38a728[_0xb71a('0x1e')]){writeLog(_0x18fa8d,_0x38a728,'BUSY');return![];}if(!_0x38a728[_0xb71a('0x1f')]){writeLog(_0x18fa8d,_0x38a728,_0xb71a('0x20'));return![];}if(_0x38a728[_0x14b2a1+_0xb71a('0x21')]){writeLog(_0x18fa8d,_0x38a728,_0xb71a('0x22'));return![];}if(_0x2f4fac&&_0x38a728[_0xb71a('0x23')](_0x14b2a1+_0xb71a('0x24'))&&_0x38a728[_0xb71a('0x23')](_0x14b2a1+_0xb71a('0x25'))){if(_0x38a728[_0x14b2a1+_0xb71a('0x24')]>0x0&&_0x38a728[_0x14b2a1+_0xb71a('0x25')]>=_0x38a728[_0x14b2a1+_0xb71a('0x24')]){writeLog(_0x18fa8d,_0x38a728,_0x14b2a1[_0xb71a('0x26')]()+_0xb71a('0x27'));return![];}}return!![];};exports['showNotification']=function(_0x2e8ea6,_0x39d874,_0x1689ce,_0x358954,_0x2fbd73){return sendNotification(!![],_0x2e8ea6,_0x39d874,_0x1689ce,_0x358954,_0x2fbd73);};exports[_0xb71a('0x28')]=function(_0x44826e,_0x25364c,_0x42c086,_0x421fcf,_0xcb40fc){return sendNotification(![],_0x44826e,_0x25364c,_0x42c086,_0x421fcf,_0xcb40fc);};exports['writeLog']=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index 5f0fd5d..cde63e0 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 _0xdcc2=['[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','validate','lodash','./utils','../../../../config/logger','routing','error','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xdcc2,0x16b));var _0x2dcc=function(_0x29925e,_0x30ca70){_0x29925e=_0x29925e-0x0;var _0x2455da=_0xdcc2[_0x29925e];return _0x2455da;};'use strict';var schema=require(_0x2dcc('0x0'));var sh=require('shelljs');var _=require(_0x2dcc('0x1'));var utils=require(_0x2dcc('0x2'));var logger=require(_0x2dcc('0x3'))(_0x2dcc('0x4'));var system=schema({'command':{'type':'string','required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x5ba06e,_0xc5ef23){return function(_0xa97357){try{var _0x16edfc={'command':_0xc5ef23[0x0]};var _0x43bcb5=system[_0x2dcc('0x0')](_0x16edfc,{'typecast':!![]});if(_0x43bcb5['length']){logger[_0x2dcc('0x5')](_0x2dcc('0x6'),_0x5ba06e,_[_0x2dcc('0x7')](_0x43bcb5,_0x2dcc('0x8'))[_0x2dcc('0x9')](',\x20'));logger[_0x2dcc('0xa')](_0x2dcc('0xb'),_0x5ba06e);_0xa97357[_0x2dcc('0xc')]();}else{var _0x325ca4=this;var _0x2a027f=utils[_0x2dcc('0xd')](_0xc5ef23[0x0],this);logger[_0x2dcc('0xa')](_0x2dcc('0xe'),_0x5ba06e,_0x2a027f);sh['exec'](_['trim'](_0x2a027f),function(_0x5c825d,_0x4c115e){logger[_0x2dcc('0xa')](_0x2dcc('0xf'),_0x5ba06e,_0x5c825d);if(_0x5c825d==0x0){var _0x6127f9=_0x4c115e[_0x2dcc('0x10')](/(\r\n|\n|\r)/gm,'');if(_[_0x2dcc('0x11')](_0xc5ef23[0x1])||_[_0x2dcc('0x12')](_0xc5ef23[0x1])){logger[_0x2dcc('0xa')](_0x2dcc('0x13'),_0x5ba06e);_0x325ca4[_0x2dcc('0x14')][_0xc5ef23[0x1]]=_0x6127f9;}else{logger[_0x2dcc('0xa')](_0x2dcc('0x15'),_0x5ba06e,_0xc5ef23[0x1],_0x6127f9);_0x325ca4['body'][_0xc5ef23[0x1]]=_0x6127f9;}}_0xa97357['next']();});}}catch(_0x6d284a){logger[_0x2dcc('0x5')](_0x2dcc('0x6'),_0x5ba06e,_[_0x2dcc('0x16')](_0x6d284a)?JSON[_0x2dcc('0x17')](_0x6d284a):_0x6d284a);logger[_0x2dcc('0xa')](_0x2dcc('0xb'),_0x5ba06e);_0xa97357[_0x2dcc('0xc')]();}};}; \ No newline at end of file +var _0xdf0a=['trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','validate','shelljs','lodash','./utils','../../../../config/logger','string','length','error','[%s][SYSTEM]\x20%s','map','message','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec'];(function(_0x27670a,_0x8bf6b5){var _0x30e2f7=function(_0x268410){while(--_0x268410){_0x27670a['push'](_0x27670a['shift']());}};_0x30e2f7(++_0x8bf6b5);}(_0xdf0a,0x1a9));var _0xadf0=function(_0x24025d,_0x35d187){_0x24025d=_0x24025d-0x0;var _0x4fe127=_0xdf0a[_0x24025d];return _0x4fe127;};'use strict';var schema=require(_0xadf0('0x0'));var sh=require(_0xadf0('0x1'));var _=require(_0xadf0('0x2'));var utils=require(_0xadf0('0x3'));var logger=require(_0xadf0('0x4'))('routing');var system=schema({'command':{'type':_0xadf0('0x5'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x183ad1,_0x1c5842){return function(_0x4b2e77){try{var _0x2bb29c={'command':_0x1c5842[0x0]};var _0x41b3f1=system[_0xadf0('0x0')](_0x2bb29c,{'typecast':!![]});if(_0x41b3f1[_0xadf0('0x6')]){logger[_0xadf0('0x7')](_0xadf0('0x8'),_0x183ad1,_[_0xadf0('0x9')](_0x41b3f1,_0xadf0('0xa'))['join'](',\x20'));logger[_0xadf0('0xb')](_0xadf0('0xc'),_0x183ad1);_0x4b2e77[_0xadf0('0xd')]();}else{var _0x238fc9=this;var _0x4ca714=utils[_0xadf0('0xe')](_0x1c5842[0x0],this);logger[_0xadf0('0xb')](_0xadf0('0xf'),_0x183ad1,_0x4ca714);sh[_0xadf0('0x10')](_[_0xadf0('0x11')](_0x4ca714),function(_0x579993,_0x137847){logger[_0xadf0('0xb')](_0xadf0('0x12'),_0x183ad1,_0x579993);if(_0x579993==0x0){var _0x1fcefa=_0x137847[_0xadf0('0x13')](/(\r\n|\n|\r)/gm,'');if(_[_0xadf0('0x14')](_0x1c5842[0x1])||_[_0xadf0('0x15')](_0x1c5842[0x1])){logger['info'](_0xadf0('0x16'),_0x183ad1);_0x238fc9[_0xadf0('0x17')][_0x1c5842[0x1]]=_0x1fcefa;}else{logger[_0xadf0('0xb')](_0xadf0('0x18'),_0x183ad1,_0x1c5842[0x1],_0x1fcefa);_0x238fc9[_0xadf0('0x17')][_0x1c5842[0x1]]=_0x1fcefa;}}_0x4b2e77[_0xadf0('0xd')]();});}}catch(_0x329420){logger[_0xadf0('0x7')](_0xadf0('0x8'),_0x183ad1,_[_0xadf0('0x19')](_0x329420)?JSON['stringify'](_0x329420):_0x329420);logger[_0xadf0('0xb')](_0xadf0('0xc'),_0x183ad1);_0x4b2e77[_0xadf0('0xd')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index a0ede68..b6dad3a 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 _0xfaf5=['TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','Interaction','channel','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','finally','isObject','stringify','validate','lodash','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','routing'];(function(_0x28a58c,_0x284400){var _0x57d372=function(_0x12ddc8){while(--_0x12ddc8){_0x28a58c['push'](_0x28a58c['shift']());}};_0x57d372(++_0x284400);}(_0xfaf5,0x18f));var _0x5faf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfaf5[_0x3dd15e];return _0x231fd0;};'use strict';var schema=require(_0x5faf('0x0'));var _=require(_0x5faf('0x1'));var rpc={'chatInteraction':require(_0x5faf('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x5faf('0x3')),'mailInteraction':require(_0x5faf('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require('../../../../config/logger')(_0x5faf('0x5'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0x5faf('0x6')}});exports[_0x5faf('0x7')]=function(_0x194de9,_0x46a8d1,_0x4d8f79,_0x1e221d){return function(_0x4cb8c5){try{var _0x251e47={'tag':_0x46a8d1[0x0]};var _0x281b5f=tag[_0x5faf('0x0')](_0x251e47,{'typecast':!![]});if(_0x281b5f[_0x5faf('0x8')]){logger[_0x5faf('0x9')](_0x5faf('0xa'),_0x194de9,_[_0x5faf('0xb')](_0x281b5f,_0x5faf('0xc'))[_0x5faf('0xd')](',\x20'));logger[_0x5faf('0xe')](_0x5faf('0xf'),_0x194de9);_0x4cb8c5[_0x5faf('0x10')]();}else{var _0x5ea3f2={'ids':[_0x46a8d1[0x0]]};if(rpc[_0x1e221d['channel']+_0x5faf('0x11')]){rpc[_0x1e221d[_0x5faf('0x12')]+_0x5faf('0x11')][_0x5faf('0x13')](_0x1e221d[_0x5faf('0x14')]['id'],_0x5ea3f2)[_0x5faf('0x15')](function(_0x11e53f){logger[_0x5faf('0xe')](_0x5faf('0x16'),_0x194de9,_0x46a8d1[0x1],_0x1e221d[_0x5faf('0x12')],_0x1e221d['interaction']['id']);})[_0x5faf('0x17')](function(_0x162c8b){logger[_0x5faf('0x9')](_0x5faf('0xa'),_0x194de9,JSON['stringify'](_0x162c8b));logger[_0x5faf('0xe')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x194de9);})[_0x5faf('0x18')](function(){_0x4cb8c5[_0x5faf('0x10')]();});}}}catch(_0x4a4794){logger[_0x5faf('0x9')](_0x5faf('0xa'),_0x194de9,_[_0x5faf('0x19')](_0x4a4794)?JSON[_0x5faf('0x1a')](_0x4a4794):_0x4a4794);logger['info'](_0x5faf('0xf'),_0x194de9);_0x4cb8c5[_0x5faf('0x10')]();}};}; \ No newline at end of file +var _0x4d3c=['next','channel','Interaction','addTags','interaction','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','validate','lodash','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','consequence','length','error','[%s][TAG]\x20%s','map','join','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4d3c,0x1d3));var _0xc4d3=function(_0x187edc,_0x5b89ec){_0x187edc=_0x187edc-0x0;var _0x5f5d52=_0x4d3c[_0x187edc];return _0x5f5d52;};'use strict';var schema=require(_0xc4d3('0x0'));var _=require(_0xc4d3('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xc4d3('0x2')),'smsInteraction':require(_0xc4d3('0x3')),'mailInteraction':require(_0xc4d3('0x4')),'faxInteraction':require(_0xc4d3('0x5')),'whatsappInteraction':require(_0xc4d3('0x6'))};var logger=require(_0xc4d3('0x7'))(_0xc4d3('0x8'));var tag=schema({'tag':{'type':'number','required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xc4d3('0x9')]=function(_0x672350,_0x5429cf,_0xb46dd2,_0x1906e5){return function(_0x4dd4de){try{var _0x3723f3={'tag':_0x5429cf[0x0]};var _0x380329=tag[_0xc4d3('0x0')](_0x3723f3,{'typecast':!![]});if(_0x380329[_0xc4d3('0xa')]){logger[_0xc4d3('0xb')](_0xc4d3('0xc'),_0x672350,_[_0xc4d3('0xd')](_0x380329,'message')[_0xc4d3('0xe')](',\x20'));logger[_0xc4d3('0xf')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x672350);_0x4dd4de[_0xc4d3('0x10')]();}else{var _0x3e7af5={'ids':[_0x5429cf[0x0]]};if(rpc[_0x1906e5[_0xc4d3('0x11')]+_0xc4d3('0x12')]){rpc[_0x1906e5[_0xc4d3('0x11')]+'Interaction'][_0xc4d3('0x13')](_0x1906e5[_0xc4d3('0x14')]['id'],_0x3e7af5)['then'](function(_0x490a82){logger[_0xc4d3('0xf')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x672350,_0x5429cf[0x1],_0x1906e5[_0xc4d3('0x11')],_0x1906e5['interaction']['id']);})['catch'](function(_0x4143a1){logger[_0xc4d3('0xb')](_0xc4d3('0xc'),_0x672350,JSON[_0xc4d3('0x15')](_0x4143a1));logger[_0xc4d3('0xf')](_0xc4d3('0x16'),_0x672350);})['finally'](function(){_0x4dd4de[_0xc4d3('0x10')]();});}}}catch(_0x52a460){logger[_0xc4d3('0xb')](_0xc4d3('0xc'),_0x672350,_['isObject'](_0x52a460)?JSON[_0xc4d3('0x15')](_0x52a460):_0x52a460);logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x672350);_0x4dd4de[_0xc4d3('0x10')]();}};}; \ 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 1429484..67c0bca 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x6c03ac,_0x5da780){var _0x524fa9=function(_0x4c229d){while(--_0x4c229d){_0x6c03ac['push'](_0x6c03ac['shift']());}};_0x524fa9(++_0x5da780);}(_0xe706,0xa3));var _0x6e70=function(_0x38af48,_0x400460){_0x38af48=_0x38af48-0x0;var _0x445384=_0xe706[_0x38af48];return _0x445384;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file +var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x5a8376,_0x459a2c){var _0x4a96fd=function(_0x2bf582){while(--_0x2bf582){_0x5a8376['push'](_0x5a8376['shift']());}};_0x4a96fd(++_0x459a2c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index af656ee..46e5c60 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 _0x2777=['RPC\x20listening\x20on\x20port:','lodash','path','jayson/promise','bluebird','uuid','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','isNil','IntervalId','Intervals','map','rules','channel','message','interaction','isArray','applications','length','existsSync','app','.js','toLowerCase','appdata','split','mail','push','slice','join','dialogflow','dialogflowv2','tag','%s:%s:%s','./interval','condition','./applications/','Push\x20new\x20rule','on\x20interval','intervals','Please\x20create\x20a\x20new\x20file\x20under','execute','info','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','stack','error','routing\x20is\x20empty','agent','agents','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busyQueue','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','chatQueues','available','loggedIn','name','waiting','mailQueues','paused','openchannelQueues','smsQueues','whatsappQueues','values','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','listen','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!'];(function(_0x5f4395,_0x2764d7){var _0x213856=function(_0x125b74){while(--_0x125b74){_0x5f4395['push'](_0x5f4395['shift']());}};_0x213856(++_0x2764d7);}(_0x2777,0xbf));var _0x7277=function(_0x347b88,_0x45495f){_0x347b88=_0x347b88-0x0;var _0x4c8eb3=_0x2777[_0x347b88];return _0x4c8eb3;};'use strict';var _=require(_0x7277('0x0'));var util=require('util');var path=require(_0x7277('0x1'));var fs=require('fs');var jayson=require(_0x7277('0x2'));var BPromise=require(_0x7277('0x3'));var uuid=require(_0x7277('0x4'));var config=require(_0x7277('0x5'));var logger=require(_0x7277('0x6'))(_0x7277('0x7'));var rpc={'openchannelQueueReport':require(_0x7277('0x8')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0x7277('0x9')),'smsQueueReport':require(_0x7277('0xa')),'faxQueueReport':require(_0x7277('0xb')),'whatsappQueueReport':require(_0x7277('0xc'))};var RuleEngine=require(_0x7277('0xd'));function getId(_0x2b4e5b,_0x125b71,_0x414522){return util[_0x7277('0xe')]('%s.%s.%s',_0x2b4e5b,_0x125b71||0x0,_0x414522||0x0);}function getIntervals(_0x378670,_0x2eeba1){var _0x4cfb5a=[];if(!_[_0x7277('0xf')](_0x2eeba1[_0x7277('0x10')])&&!_[_0x7277('0xf')](_0x378670[_0x2eeba1[_0x7277('0x10')]])&&!_[_0x7277('0xf')](_0x378670[_0x2eeba1[_0x7277('0x10')]][_0x7277('0x11')])){_0x4cfb5a=_[_0x7277('0x12')](_0x378670[_0x2eeba1[_0x7277('0x10')]][_0x7277('0x11')],'interval');}else if(!_[_0x7277('0xf')](_0x2eeba1['interval'])){_0x4cfb5a=[_0x2eeba1['interval']];}return _0x4cfb5a;}exports['listen']=function(_0x16f065){_0x16f065[_0x7277('0x13')]={};return new BPromise(function(_0x195abf,_0x3e2597){var _0x17beef={'Start':function(_0x53a0f2){var _0x1811dc=this;return new Promise(function(_0x5ca84b,_0x2221a4){if(_0x53a0f2){try{var _0x172f74=[];var _0x32014c=getId(_0x53a0f2[_0x7277('0x14')],_0x53a0f2[_0x7277('0x15')]?_0x53a0f2[_0x7277('0x15')]['id']:0x0,_0x53a0f2['interaction']?_0x53a0f2[_0x7277('0x16')]['id']:0x0);if(_0x53a0f2['applications']&&_[_0x7277('0x17')](_0x53a0f2[_0x7277('0x18')])&&_0x53a0f2[_0x7277('0x18')][_0x7277('0x19')]){for(var _0x4e66f3=0x0;_0x4e66f3<_0x53a0f2[_0x7277('0x18')]['length'];_0x4e66f3+=0x1){var _0x470a71=_0x53a0f2[_0x7277('0x18')][_0x4e66f3];if(fs[_0x7277('0x1a')](path['join'](__dirname,_0x7277('0x18'),_0x470a71[_0x7277('0x1b')]+_0x7277('0x1c')))){var _0x74e131=[];switch(_0x470a71[_0x7277('0x1b')][_0x7277('0x1d')]()){case'autoreply':var _0x3fafd2=_0x470a71[_0x7277('0x1e')][_0x7277('0x1f')](',');if(_0x53a0f2[_0x7277('0x14')]===_0x7277('0x20')){_0x74e131[_0x7277('0x21')](_0x3fafd2[0x0]);_0x74e131['push'](_0x3fafd2[0x1]);_0x74e131['push'](_0x3fafd2[_0x7277('0x22')](0x2,_0x3fafd2[_0x7277('0x19')])['join'](','));}else{_0x74e131['push'](_0x3fafd2[0x0]);_0x74e131[_0x7277('0x21')](_0x3fafd2[_0x7277('0x22')](0x1,_0x3fafd2[_0x7277('0x19')])[_0x7277('0x23')](','));}break;case _0x7277('0x24'):var _0x2513c4=_0x470a71['appdata'][_0x7277('0x1f')](',');_0x74e131[_0x7277('0x21')](_0x2513c4[0x0]);_0x74e131['push'](_0x2513c4[0x1]);_0x74e131[_0x7277('0x21')](_0x2513c4[_0x7277('0x22')](0x2,_0x2513c4[_0x7277('0x19')])[_0x7277('0x23')](','));break;case _0x7277('0x25'):var _0x319f13=_0x470a71['appdata'][_0x7277('0x1f')](',');_0x74e131[_0x7277('0x21')](_0x319f13[0x0]);_0x74e131[_0x7277('0x21')](_0x319f13[0x1]);_0x74e131['push'](_0x319f13[0x2]);_0x74e131['push'](_0x319f13[0x3]);_0x74e131[_0x7277('0x21')](_0x319f13[_0x7277('0x22')](0x4,_0x319f13[_0x7277('0x19')])[_0x7277('0x23')](','));break;case'amazonlex':var _0x27a82e=_0x470a71['appdata'][_0x7277('0x1f')](',');_0x74e131['push'](_0x27a82e[0x0]);_0x74e131[_0x7277('0x21')](_0x27a82e[0x1]);_0x74e131[_0x7277('0x21')](_0x27a82e[0x2]);_0x74e131[_0x7277('0x21')](_0x27a82e[0x3]);_0x74e131[_0x7277('0x21')](_0x27a82e[_0x7277('0x22')](0x4,_0x27a82e['length'])[_0x7277('0x23')](','));break;case _0x7277('0x15'):_0x74e131[_0x7277('0x21')](_0x470a71['appdata']);break;case _0x7277('0x26'):_0x74e131[_0x7277('0x21')](_0x470a71['TagId']);_0x74e131[_0x7277('0x21')](_0x470a71['appdata']);break;default:_0x74e131=_[_0x7277('0xf')](_0x470a71[_0x7277('0x1e')])?[]:_0x470a71[_0x7277('0x1e')][_0x7277('0x1f')](',');}var _0x2dc93d={'id':util[_0x7277('0xe')](_0x7277('0x27'),_0x32014c,_0x470a71['id'],_0x470a71[_0x7277('0x1b')]),'condition':require(_0x7277('0x28'))[_0x7277('0x29')](_0x32014c,getIntervals(_0x16f065['intervals'],_0x470a71),_0x16f065),'consequence':require(_0x7277('0x2a')+_0x470a71['app'])['consequence'](_0x32014c,_0x74e131,_0x16f065,_0x53a0f2),'p':_0x470a71['priority']||0x0};logger['info'](_0x7277('0x2b'),_0x2dc93d['id'],_0x7277('0x2c'),getIntervals(_0x16f065[_0x7277('0x2d')],_0x470a71)['join']('\x20|\x20'));_0x172f74[_0x7277('0x21')](_0x2dc93d);}else{logger['error'](_0x7277('0x2e'),path['join'](__dirname,'applications',_0x470a71['app']+'.js'));}}_0x16f065[_0x7277('0x13')][_0x32014c]=new RuleEngine(_0x172f74);_0x16f065[_0x7277('0x13')][_0x32014c][_0x7277('0x2f')](_0x53a0f2,function(_0x1f523e){logger[_0x7277('0x30')]('Applications\x20executed',JSON[_0x7277('0x31')](_0x1f523e[_0x7277('0x32')]));if(_0x16f065['rules'][_0x32014c]){_0x16f065[_0x7277('0x13')][_0x32014c][_0x7277('0x33')](_0x7277('0x34'));}});return _0x5ca84b({'code':0xc8,'message':_0x53a0f2});}else{logger[_0x7277('0x30')](_0x7277('0x35'));return _0x5ca84b({'code':0xc8,'message':_0x53a0f2});}}catch(_0x1e89ea){logger['error'](_0x1e89ea[_0x7277('0x36')]);return _0x2221a4(_0x1811dc[_0x7277('0x37')](0x1f4,_0x1e89ea));}}return _0x2221a4(_0x7277('0x38'));});},'AcceptMessage':function(_0x5ca841){var _0x2a5d6e=this;return new Promise(function(_0x37e674,_0x41fecb){if(_0x5ca841[_0x7277('0x39')]&&_0x5ca841[_0x7277('0x39')]['id']){if(_0x16f065[_0x7277('0x3a')][_0x5ca841[_0x7277('0x39')]['id']]){_0x16f065[_0x7277('0x3a')][_0x5ca841[_0x7277('0x39')]['id']]['busy']=![];_0x16f065['agents'][_0x5ca841[_0x7277('0x39')]['id']]['busyQueue']=undefined;}}if(_0x5ca841[_0x7277('0x15')]&&_0x5ca841[_0x7277('0x15')]['id']){try{var _0x4c6e14=getId(_0x5ca841[_0x7277('0x14')],_0x5ca841[_0x7277('0x15')]?_0x5ca841['message']['id']:0x0,_0x5ca841[_0x7277('0x16')]?_0x5ca841[_0x7277('0x16')]['id']:0x0);if(_0x16f065[_0x7277('0x13')][_0x4c6e14]){_0x16f065['rules'][_0x4c6e14][_0x7277('0x33')](_0x7277('0x3b'));if(rpc[_0x5ca841[_0x7277('0x14')]+'QueueReport']){rpc[_0x5ca841[_0x7277('0x14')]+_0x7277('0x3c')][_0x7277('0x3d')](_0x4c6e14,{'UserId':_0x5ca841[_0x7277('0x15')][_0x7277('0x3e')]})[_0x7277('0x3f')](function(_0x2635ec){logger['error'](_0x7277('0x40'));});}}return _0x37e674({'code':0xc8,'message':_0x5ca841});}catch(_0x249eeb){logger[_0x7277('0x37')](_0x249eeb[_0x7277('0x36')]);return _0x41fecb(_0x2a5d6e[_0x7277('0x37')](0x1f4,_0x249eeb));}}logger[_0x7277('0x37')](_0x7277('0x41'));return _0x41fecb(_0x2a5d6e[_0x7277('0x37')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x3ac517){var _0x5895a1=this;return new Promise(function(_0x6a008,_0x199154){if(_0x3ac517['agent']&&_0x3ac517[_0x7277('0x39')]['id']){try{if(_0x16f065[_0x7277('0x3a')][_0x3ac517['agent']['id']]){_0x16f065['agents'][_0x3ac517[_0x7277('0x39')]['id']]['busy']=![];_0x16f065['agents'][_0x3ac517[_0x7277('0x39')]['id']][_0x7277('0x42')]=undefined;}return _0x6a008({'code':0xc8,'message':_0x3ac517});}catch(_0x41b0e2){logger[_0x7277('0x37')](_0x41b0e2[_0x7277('0x36')]);return _0x199154(_0x5895a1[_0x7277('0x37')](0x1f4,_0x41b0e2));}}logger[_0x7277('0x37')](_0x7277('0x41'));return _0x199154(_0x5895a1['error'](0x1f4,_0x7277('0x41')));});},'AbandonInteraction':function(_0x22934b){var _0x5ade99=this;return new Promise(function(_0x8c5c71,_0x2f120c){if(_0x22934b[_0x7277('0x14')]&&_0x22934b[_0x7277('0x16')]&&_0x22934b[_0x7277('0x16')]['id']){try{var _0xa4a958=getId(_0x22934b[_0x7277('0x14')],_0x22934b[_0x7277('0x15')]?_0x22934b[_0x7277('0x15')]['id']:0x0,_0x22934b['interaction']?_0x22934b[_0x7277('0x16')]['id']:0x0);if(_0x16f065['rules'][_0xa4a958]){_0x16f065[_0x7277('0x13')][_0xa4a958][_0x7277('0x33')]('end');}return _0x8c5c71({'code':0xc8,'message':_0x22934b});}catch(_0x3ed671){logger['error'](_0x3ed671[_0x7277('0x36')]);return _0x2f120c(_0x5ade99[_0x7277('0x37')](0x1f4,_0x3ed671));}}logger[_0x7277('0x37')]('message\x20is\x20empty');return _0x2f120c(_0x5ade99[_0x7277('0x37')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x74ea58){var _0x4941be=this;return new Promise(function(_0x449f36,_0x34f6f5){if(_0x16f065[_0x7277('0x3a')][_0x7277('0x43')](_0x74ea58['id'])){for(var _0x2d79ea in _0x74ea58[_0x7277('0x44')]){if(_0x74ea58[_0x7277('0x44')][_0x7277('0x43')](_0x2d79ea)){if(_0x16f065[_0x7277('0x3a')][_0x74ea58['id']][_0x7277('0x43')](_0x2d79ea+_0x7277('0x45'))){_0x16f065[_0x7277('0x3a')][_0x74ea58['id']][_0x2d79ea+_0x7277('0x45')]=parseInt(_0x74ea58[_0x7277('0x44')][_0x2d79ea],0xa);}}}_0x16f065[_0x7277('0x3a')][_0x74ea58['id']][_0x7277('0x46')]();return _0x449f36({'code':0xc8,'message':_0x16f065[_0x7277('0x3a')][_0x74ea58['id']]});}else{return _0x34f6f5(_0x4941be[_0x7277('0x37')](0x1f4,_0x7277('0x47')));}});},'Agents':function(_0xcf78e0){return new Promise(function(_0x165257,_0xbc54b2){var _0x55ab07=_['values'](_0x16f065['agents']);_0x165257({'count':_0x55ab07[_0x7277('0x19')],'rows':_0x55ab07});});},'ChatQueues':function(_0x302516){return new Promise(function(_0x17aad2,_0x4ba09c){var _0x5046ae=[];for(var _0x1f33ad in _0x16f065[_0x7277('0x48')]){if(_0x16f065[_0x7277('0x48')][_0x7277('0x43')](_0x1f33ad)){var _0x399e98=_0x16f065[_0x7277('0x48')][_0x1f33ad];var _0x456f36={'id':_0x399e98['id'],'available':_0x399e98[_0x7277('0x49')],'loggedIn':_0x399e98[_0x7277('0x4a')],'name':_0x399e98[_0x7277('0x4b')],'paused':_0x399e98['paused'],'waiting':_0x399e98[_0x7277('0x4c')]};_0x5046ae['push'](_0x456f36);}}_0x17aad2({'count':_0x5046ae[_0x7277('0x19')],'rows':_0x5046ae});});},'MailQueues':function(_0x1a7210){return new Promise(function(_0xeb503a,_0x3199b5){var _0x53973d=[];for(var _0x5de477 in _0x16f065['mailQueues']){if(_0x16f065[_0x7277('0x4d')][_0x7277('0x43')](_0x5de477)){var _0x332300=_0x16f065['mailQueues'][_0x5de477];var _0x3ef0e3={'id':_0x332300['id'],'available':_0x332300[_0x7277('0x49')],'loggedIn':_0x332300['loggedIn'],'name':_0x332300['name'],'paused':_0x332300[_0x7277('0x4e')],'waiting':_0x332300[_0x7277('0x4c')]};_0x53973d[_0x7277('0x21')](_0x3ef0e3);}}_0xeb503a({'count':_0x53973d[_0x7277('0x19')],'rows':_0x53973d});});},'OpenchannelQueues':function(_0x4be7d3){return new Promise(function(_0x437cfd,_0x321124){var _0x215d38=[];for(var _0x25bd52 in _0x16f065[_0x7277('0x4f')]){if(_0x16f065[_0x7277('0x4f')][_0x7277('0x43')](_0x25bd52)){var _0x5ed24e=_0x16f065['openchannelQueues'][_0x25bd52];var _0x45faa0={'id':_0x5ed24e['id'],'available':_0x5ed24e['available'],'loggedIn':_0x5ed24e['loggedIn'],'name':_0x5ed24e['name'],'paused':_0x5ed24e[_0x7277('0x4e')],'waiting':_0x5ed24e['waiting']};_0x215d38['push'](_0x45faa0);}}_0x437cfd({'count':_0x215d38['length'],'rows':_0x215d38});});},'SmsQueues':function(_0x2e0115){return new Promise(function(_0x37e4e8,_0x4cebcc){var _0xf0b1f6=[];for(var _0x45a12b in _0x16f065[_0x7277('0x50')]){if(_0x16f065[_0x7277('0x50')][_0x7277('0x43')](_0x45a12b)){var _0x5bd34c=_0x16f065[_0x7277('0x50')][_0x45a12b];var _0x1acb9e={'id':_0x5bd34c['id'],'available':_0x5bd34c[_0x7277('0x49')],'loggedIn':_0x5bd34c[_0x7277('0x4a')],'name':_0x5bd34c[_0x7277('0x4b')],'paused':_0x5bd34c[_0x7277('0x4e')],'waiting':_0x5bd34c[_0x7277('0x4c')]};_0xf0b1f6[_0x7277('0x21')](_0x1acb9e);}}_0x37e4e8({'count':_0xf0b1f6[_0x7277('0x19')],'rows':_0xf0b1f6});});},'FaxQueues':function(_0x1df681){return new Promise(function(_0x49e36c,_0x183770){var _0x3b8de7=[];for(var _0x22c30e in _0x16f065['faxQueues']){if(_0x16f065['faxQueues'][_0x7277('0x43')](_0x22c30e)){var _0x2bf464=_0x16f065['faxQueues'][_0x22c30e];var _0x41148b={'id':_0x2bf464['id'],'available':_0x2bf464[_0x7277('0x49')],'loggedIn':_0x2bf464[_0x7277('0x4a')],'name':_0x2bf464[_0x7277('0x4b')],'paused':_0x2bf464[_0x7277('0x4e')],'waiting':_0x2bf464[_0x7277('0x4c')]};_0x3b8de7[_0x7277('0x21')](_0x41148b);}}_0x49e36c({'count':_0x3b8de7[_0x7277('0x19')],'rows':_0x3b8de7});});},'WhatsappQueues':function(_0xfa55e7){return new Promise(function(_0x16d510,_0x453461){var _0x2e27e8=[];for(var _0x4486d6 in _0x16f065[_0x7277('0x51')]){if(_0x16f065[_0x7277('0x51')]['hasOwnProperty'](_0x4486d6)){var _0x1b6779=_0x16f065[_0x7277('0x51')][_0x4486d6];var _0x3a1108={'id':_0x1b6779['id'],'available':_0x1b6779['available'],'loggedIn':_0x1b6779['loggedIn'],'name':_0x1b6779[_0x7277('0x4b')],'paused':_0x1b6779[_0x7277('0x4e')],'waiting':_0x1b6779[_0x7277('0x4c')]};_0x2e27e8['push'](_0x3a1108);}}_0x16d510({'count':_0x2e27e8[_0x7277('0x19')],'rows':_0x2e27e8});});},'ChatQueuesWaitingInteractions':function(_0x114777){return new Promise(function(_0x3e1d35,_0xcaa2ef){var _0x5b0b8c=_[_0x7277('0x52')](_0x16f065[_0x7277('0x53')]);_0x3e1d35({'count':_0x5b0b8c['length'],'rows':_0x5b0b8c});});},'MailQueuesWaitingInteractions':function(_0x242565){return new Promise(function(_0x3be2b9,_0x1d8cbb){var _0x46a809=_[_0x7277('0x52')](_0x16f065[_0x7277('0x54')]);_0x3be2b9({'count':_0x46a809[_0x7277('0x19')],'rows':_0x46a809});});},'OpenchannelQueuesWaitingInteractions':function(_0x3c1e7b){return new Promise(function(_0x5804d9,_0x26b1dd){var _0x24ca41=_[_0x7277('0x52')](_0x16f065[_0x7277('0x55')]);_0x5804d9({'count':_0x24ca41[_0x7277('0x19')],'rows':_0x24ca41});});},'SmsQueuesWaitingInteractions':function(_0x23ce09){return new Promise(function(_0x31f70e,_0x34cee5){var _0x38443e=_['values'](_0x16f065[_0x7277('0x56')]);_0x31f70e({'count':_0x38443e[_0x7277('0x19')],'rows':_0x38443e});});},'FaxQueuesWaitingInteractions':function(_0x1949a8){return new Promise(function(_0x534d75,_0x290043){var _0x4e3e19=_[_0x7277('0x52')](_0x16f065[_0x7277('0x57')]);_0x534d75({'count':_0x4e3e19['length'],'rows':_0x4e3e19});});},'WhatsappQueuesWaitingInteractions':function(_0x1f27b1){return new Promise(function(_0x199b36,_0x2ac1b1){var _0x4c6d66=_[_0x7277('0x52')](_0x16f065[_0x7277('0x58')]);_0x199b36({'count':_0x4c6d66[_0x7277('0x19')],'rows':_0x4c6d66});});}};var _0x54de05=jayson[_0x7277('0x59')](_0x17beef)[_0x7277('0x5a')]();_0x54de05['on']('error',function(_0x18781a){logger[_0x7277('0x37')](JSON[_0x7277('0x31')](_0x18781a));return _0x3e2597(_0x18781a);});_0x54de05[_0x7277('0x5b')](0x232c,'127.0.0.1',function(){console[_0x7277('0x5c')](_0x7277('0x5d'),0x232c);return _0x195abf(_0x7277('0x5e')+0x232c);});});}; \ No newline at end of file +var _0x94c5=['No\x20applications\x20to\x20execute','error','stack','agent','agents','busy','UserId','error\x20update\x20queue\x20report','message\x20is\x20empty','busyQueue','end','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','chatQueues','available','loggedIn','name','paused','mailQueues','waiting','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','listen','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','path','uuid','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../lib/rule-engine','%s.%s.%s','IntervalId','isNil','Intervals','map','interval','channel','message','interaction','applications','length','existsSync','join','app','.js','toLowerCase','autoreply','appdata','split','push','dialogflow','slice','dialogflowv2','amazonlex','tag','TagId','format','%s:%s:%s','condition','intervals','./applications/','priority','Push\x20new\x20rule','on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','rules','execute','matchPath','emit','complete','info'];(function(_0x1b999f,_0xada878){var _0x51d27a=function(_0x1ba354){while(--_0x1ba354){_0x1b999f['push'](_0x1b999f['shift']());}};_0x51d27a(++_0xada878);}(_0x94c5,0x1e2));var _0x594c=function(_0x167d7d,_0x375916){_0x167d7d=_0x167d7d-0x0;var _0x28ac31=_0x94c5[_0x167d7d];return _0x28ac31;};'use strict';var _=require('lodash');var util=require('util');var path=require(_0x594c('0x0'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require('bluebird');var uuid=require(_0x594c('0x1'));var config=require(_0x594c('0x2'));var logger=require(_0x594c('0x3'))(_0x594c('0x4'));var rpc={'openchannelQueueReport':require(_0x594c('0x5')),'mailQueueReport':require(_0x594c('0x6')),'chatQueueReport':require(_0x594c('0x7')),'smsQueueReport':require(_0x594c('0x8')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0x594c('0x9'));function getId(_0x15bfc6,_0x3a6c3f,_0x147bac){return util['format'](_0x594c('0xa'),_0x15bfc6,_0x3a6c3f||0x0,_0x147bac||0x0);}function getIntervals(_0x4353d8,_0x5b98c6){var _0x4b6b2e=[];if(!_['isNil'](_0x5b98c6[_0x594c('0xb')])&&!_[_0x594c('0xc')](_0x4353d8[_0x5b98c6['IntervalId']])&&!_[_0x594c('0xc')](_0x4353d8[_0x5b98c6[_0x594c('0xb')]][_0x594c('0xd')])){_0x4b6b2e=_[_0x594c('0xe')](_0x4353d8[_0x5b98c6[_0x594c('0xb')]][_0x594c('0xd')],_0x594c('0xf'));}else if(!_[_0x594c('0xc')](_0x5b98c6[_0x594c('0xf')])){_0x4b6b2e=[_0x5b98c6[_0x594c('0xf')]];}return _0x4b6b2e;}exports['listen']=function(_0x1259ae){_0x1259ae['rules']={};return new BPromise(function(_0x5faa27,_0x465d43){var _0x5d1f0c={'Start':function(_0x20cca3){var _0x44e303=this;return new Promise(function(_0x3224b7,_0xdfa45){if(_0x20cca3){try{var _0x4a9566=[];var _0x333b43=getId(_0x20cca3[_0x594c('0x10')],_0x20cca3[_0x594c('0x11')]?_0x20cca3[_0x594c('0x11')]['id']:0x0,_0x20cca3[_0x594c('0x12')]?_0x20cca3[_0x594c('0x12')]['id']:0x0);if(_0x20cca3[_0x594c('0x13')]&&_['isArray'](_0x20cca3[_0x594c('0x13')])&&_0x20cca3[_0x594c('0x13')][_0x594c('0x14')]){for(var _0x4387d0=0x0;_0x4387d0<_0x20cca3[_0x594c('0x13')]['length'];_0x4387d0+=0x1){var _0x114cb6=_0x20cca3[_0x594c('0x13')][_0x4387d0];if(fs[_0x594c('0x15')](path[_0x594c('0x16')](__dirname,_0x594c('0x13'),_0x114cb6[_0x594c('0x17')]+_0x594c('0x18')))){var _0x322661=[];switch(_0x114cb6['app'][_0x594c('0x19')]()){case _0x594c('0x1a'):var _0x35dd6a=_0x114cb6[_0x594c('0x1b')][_0x594c('0x1c')](',');if(_0x20cca3[_0x594c('0x10')]==='mail'){_0x322661['push'](_0x35dd6a[0x0]);_0x322661[_0x594c('0x1d')](_0x35dd6a[0x1]);_0x322661[_0x594c('0x1d')](_0x35dd6a['slice'](0x2,_0x35dd6a[_0x594c('0x14')])[_0x594c('0x16')](','));}else{_0x322661[_0x594c('0x1d')](_0x35dd6a[0x0]);_0x322661['push'](_0x35dd6a['slice'](0x1,_0x35dd6a['length'])[_0x594c('0x16')](','));}break;case _0x594c('0x1e'):var _0x57e6ff=_0x114cb6['appdata'][_0x594c('0x1c')](',');_0x322661[_0x594c('0x1d')](_0x57e6ff[0x0]);_0x322661[_0x594c('0x1d')](_0x57e6ff[0x1]);_0x322661[_0x594c('0x1d')](_0x57e6ff[_0x594c('0x1f')](0x2,_0x57e6ff['length'])[_0x594c('0x16')](','));break;case _0x594c('0x20'):var _0x436c64=_0x114cb6[_0x594c('0x1b')][_0x594c('0x1c')](',');_0x322661['push'](_0x436c64[0x0]);_0x322661[_0x594c('0x1d')](_0x436c64[0x1]);_0x322661[_0x594c('0x1d')](_0x436c64[0x2]);_0x322661[_0x594c('0x1d')](_0x436c64[0x3]);_0x322661[_0x594c('0x1d')](_0x436c64['slice'](0x4,_0x436c64['length'])['join'](','));break;case _0x594c('0x21'):var _0x558b2f=_0x114cb6[_0x594c('0x1b')][_0x594c('0x1c')](',');_0x322661['push'](_0x558b2f[0x0]);_0x322661[_0x594c('0x1d')](_0x558b2f[0x1]);_0x322661[_0x594c('0x1d')](_0x558b2f[0x2]);_0x322661[_0x594c('0x1d')](_0x558b2f[0x3]);_0x322661[_0x594c('0x1d')](_0x558b2f['slice'](0x4,_0x558b2f[_0x594c('0x14')])[_0x594c('0x16')](','));break;case _0x594c('0x11'):_0x322661[_0x594c('0x1d')](_0x114cb6[_0x594c('0x1b')]);break;case _0x594c('0x22'):_0x322661[_0x594c('0x1d')](_0x114cb6[_0x594c('0x23')]);_0x322661[_0x594c('0x1d')](_0x114cb6['appdata']);break;default:_0x322661=_[_0x594c('0xc')](_0x114cb6[_0x594c('0x1b')])?[]:_0x114cb6[_0x594c('0x1b')][_0x594c('0x1c')](',');}var _0x13820a={'id':util[_0x594c('0x24')](_0x594c('0x25'),_0x333b43,_0x114cb6['id'],_0x114cb6[_0x594c('0x17')]),'condition':require('./interval')[_0x594c('0x26')](_0x333b43,getIntervals(_0x1259ae[_0x594c('0x27')],_0x114cb6),_0x1259ae),'consequence':require(_0x594c('0x28')+_0x114cb6[_0x594c('0x17')])['consequence'](_0x333b43,_0x322661,_0x1259ae,_0x20cca3),'p':_0x114cb6[_0x594c('0x29')]||0x0};logger['info'](_0x594c('0x2a'),_0x13820a['id'],_0x594c('0x2b'),getIntervals(_0x1259ae[_0x594c('0x27')],_0x114cb6)[_0x594c('0x16')](_0x594c('0x2c')));_0x4a9566[_0x594c('0x1d')](_0x13820a);}else{logger['error'](_0x594c('0x2d'),path[_0x594c('0x16')](__dirname,_0x594c('0x13'),_0x114cb6['app']+_0x594c('0x18')));}}_0x1259ae[_0x594c('0x2e')][_0x333b43]=new RuleEngine(_0x4a9566);_0x1259ae[_0x594c('0x2e')][_0x333b43][_0x594c('0x2f')](_0x20cca3,function(_0x454334){logger['info']('Applications\x20executed',JSON['stringify'](_0x454334[_0x594c('0x30')]));if(_0x1259ae['rules'][_0x333b43]){_0x1259ae[_0x594c('0x2e')][_0x333b43][_0x594c('0x31')](_0x594c('0x32'));}});return _0x3224b7({'code':0xc8,'message':_0x20cca3});}else{logger[_0x594c('0x33')](_0x594c('0x34'));return _0x3224b7({'code':0xc8,'message':_0x20cca3});}}catch(_0xd17b8a){logger[_0x594c('0x35')](_0xd17b8a[_0x594c('0x36')]);return _0xdfa45(_0x44e303[_0x594c('0x35')](0x1f4,_0xd17b8a));}}return _0xdfa45('routing\x20is\x20empty');});},'AcceptMessage':function(_0x67fac8){var _0x47057a=this;return new Promise(function(_0x7e9b9d,_0x9025a2){if(_0x67fac8['agent']&&_0x67fac8[_0x594c('0x37')]['id']){if(_0x1259ae[_0x594c('0x38')][_0x67fac8[_0x594c('0x37')]['id']]){_0x1259ae[_0x594c('0x38')][_0x67fac8['agent']['id']][_0x594c('0x39')]=![];_0x1259ae[_0x594c('0x38')][_0x67fac8[_0x594c('0x37')]['id']]['busyQueue']=undefined;}}if(_0x67fac8[_0x594c('0x11')]&&_0x67fac8[_0x594c('0x11')]['id']){try{var _0x5eca5d=getId(_0x67fac8[_0x594c('0x10')],_0x67fac8['message']?_0x67fac8[_0x594c('0x11')]['id']:0x0,_0x67fac8[_0x594c('0x12')]?_0x67fac8[_0x594c('0x12')]['id']:0x0);if(_0x1259ae[_0x594c('0x2e')][_0x5eca5d]){_0x1259ae[_0x594c('0x2e')][_0x5eca5d][_0x594c('0x31')]('end');if(rpc[_0x67fac8[_0x594c('0x10')]+'QueueReport']){rpc[_0x67fac8[_0x594c('0x10')]+'QueueReport']['update'](_0x5eca5d,{'UserId':_0x67fac8[_0x594c('0x11')][_0x594c('0x3a')]})['catch'](function(_0x5e048f){logger[_0x594c('0x35')](_0x594c('0x3b'));});}}return _0x7e9b9d({'code':0xc8,'message':_0x67fac8});}catch(_0x235431){logger[_0x594c('0x35')](_0x235431[_0x594c('0x36')]);return _0x9025a2(_0x47057a[_0x594c('0x35')](0x1f4,_0x235431));}}logger[_0x594c('0x35')](_0x594c('0x3c'));return _0x9025a2(_0x47057a[_0x594c('0x35')](0x1f4,_0x594c('0x3c')));});},'RejectMessage':function(_0x269298){var _0x153bf8=this;return new Promise(function(_0x318336,_0x4e4ef8){if(_0x269298[_0x594c('0x37')]&&_0x269298['agent']['id']){try{if(_0x1259ae[_0x594c('0x38')][_0x269298[_0x594c('0x37')]['id']]){_0x1259ae[_0x594c('0x38')][_0x269298[_0x594c('0x37')]['id']][_0x594c('0x39')]=![];_0x1259ae[_0x594c('0x38')][_0x269298[_0x594c('0x37')]['id']][_0x594c('0x3d')]=undefined;}return _0x318336({'code':0xc8,'message':_0x269298});}catch(_0xb94882){logger[_0x594c('0x35')](_0xb94882['stack']);return _0x4e4ef8(_0x153bf8[_0x594c('0x35')](0x1f4,_0xb94882));}}logger['error'](_0x594c('0x3c'));return _0x4e4ef8(_0x153bf8[_0x594c('0x35')](0x1f4,_0x594c('0x3c')));});},'AbandonInteraction':function(_0x5ea94d){var _0x27bad0=this;return new Promise(function(_0xeaec95,_0x9ac831){if(_0x5ea94d['channel']&&_0x5ea94d[_0x594c('0x12')]&&_0x5ea94d['interaction']['id']){try{var _0x14e830=getId(_0x5ea94d[_0x594c('0x10')],_0x5ea94d[_0x594c('0x11')]?_0x5ea94d[_0x594c('0x11')]['id']:0x0,_0x5ea94d[_0x594c('0x12')]?_0x5ea94d[_0x594c('0x12')]['id']:0x0);if(_0x1259ae['rules'][_0x14e830]){_0x1259ae[_0x594c('0x2e')][_0x14e830][_0x594c('0x31')](_0x594c('0x3e'));}return _0xeaec95({'code':0xc8,'message':_0x5ea94d});}catch(_0x27d5a9){logger[_0x594c('0x35')](_0x27d5a9[_0x594c('0x36')]);return _0x9ac831(_0x27bad0[_0x594c('0x35')](0x1f4,_0x27d5a9));}}logger[_0x594c('0x35')]('message\x20is\x20empty');return _0x9ac831(_0x27bad0['error'](0x1f4,_0x594c('0x3c')));});},'AgentCapacity':function(_0x1e1460){var _0x362621=this;return new Promise(function(_0x5e2ac8,_0x479548){if(_0x1259ae[_0x594c('0x38')]['hasOwnProperty'](_0x1e1460['id'])){for(var _0x1e6f0c in _0x1e1460['capacity']){if(_0x1e1460[_0x594c('0x3f')][_0x594c('0x40')](_0x1e6f0c)){if(_0x1259ae[_0x594c('0x38')][_0x1e1460['id']][_0x594c('0x40')](_0x1e6f0c+_0x594c('0x41'))){_0x1259ae[_0x594c('0x38')][_0x1e1460['id']][_0x1e6f0c+_0x594c('0x41')]=parseInt(_0x1e1460[_0x594c('0x3f')][_0x1e6f0c],0xa);}}}_0x1259ae['agents'][_0x1e1460['id']][_0x594c('0x42')]();return _0x5e2ac8({'code':0xc8,'message':_0x1259ae[_0x594c('0x38')][_0x1e1460['id']]});}else{return _0x479548(_0x362621['error'](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0xa932fd){return new Promise(function(_0x59979d,_0x2bcda0){var _0x39661a=_['values'](_0x1259ae[_0x594c('0x38')]);_0x59979d({'count':_0x39661a['length'],'rows':_0x39661a});});},'ChatQueues':function(_0x59911c){return new Promise(function(_0x54e80a,_0x16c975){var _0xee32f3=[];for(var _0x12ed00 in _0x1259ae['chatQueues']){if(_0x1259ae[_0x594c('0x43')]['hasOwnProperty'](_0x12ed00)){var _0x275eec=_0x1259ae['chatQueues'][_0x12ed00];var _0x39de9b={'id':_0x275eec['id'],'available':_0x275eec[_0x594c('0x44')],'loggedIn':_0x275eec[_0x594c('0x45')],'name':_0x275eec[_0x594c('0x46')],'paused':_0x275eec[_0x594c('0x47')],'waiting':_0x275eec['waiting']};_0xee32f3[_0x594c('0x1d')](_0x39de9b);}}_0x54e80a({'count':_0xee32f3[_0x594c('0x14')],'rows':_0xee32f3});});},'MailQueues':function(_0x5ce789){return new Promise(function(_0x290c13,_0x3e7b85){var _0x41a0e9=[];for(var _0x395c9f in _0x1259ae[_0x594c('0x48')]){if(_0x1259ae[_0x594c('0x48')][_0x594c('0x40')](_0x395c9f)){var _0x3cad73=_0x1259ae['mailQueues'][_0x395c9f];var _0x373999={'id':_0x3cad73['id'],'available':_0x3cad73[_0x594c('0x44')],'loggedIn':_0x3cad73[_0x594c('0x45')],'name':_0x3cad73[_0x594c('0x46')],'paused':_0x3cad73[_0x594c('0x47')],'waiting':_0x3cad73[_0x594c('0x49')]};_0x41a0e9[_0x594c('0x1d')](_0x373999);}}_0x290c13({'count':_0x41a0e9[_0x594c('0x14')],'rows':_0x41a0e9});});},'OpenchannelQueues':function(_0xecc809){return new Promise(function(_0x583516,_0x21f303){var _0x16a5f5=[];for(var _0x6d45f2 in _0x1259ae[_0x594c('0x4a')]){if(_0x1259ae[_0x594c('0x4a')][_0x594c('0x40')](_0x6d45f2)){var _0x42e765=_0x1259ae[_0x594c('0x4a')][_0x6d45f2];var _0x1f92f4={'id':_0x42e765['id'],'available':_0x42e765[_0x594c('0x44')],'loggedIn':_0x42e765[_0x594c('0x45')],'name':_0x42e765[_0x594c('0x46')],'paused':_0x42e765['paused'],'waiting':_0x42e765[_0x594c('0x49')]};_0x16a5f5[_0x594c('0x1d')](_0x1f92f4);}}_0x583516({'count':_0x16a5f5['length'],'rows':_0x16a5f5});});},'SmsQueues':function(_0x1fdcb8){return new Promise(function(_0x29f0f1,_0x5168c5){var _0x58769e=[];for(var _0x265d1d in _0x1259ae[_0x594c('0x4b')]){if(_0x1259ae[_0x594c('0x4b')]['hasOwnProperty'](_0x265d1d)){var _0x3eb9df=_0x1259ae['smsQueues'][_0x265d1d];var _0x1aad3c={'id':_0x3eb9df['id'],'available':_0x3eb9df[_0x594c('0x44')],'loggedIn':_0x3eb9df[_0x594c('0x45')],'name':_0x3eb9df[_0x594c('0x46')],'paused':_0x3eb9df[_0x594c('0x47')],'waiting':_0x3eb9df['waiting']};_0x58769e['push'](_0x1aad3c);}}_0x29f0f1({'count':_0x58769e[_0x594c('0x14')],'rows':_0x58769e});});},'FaxQueues':function(_0x264d27){return new Promise(function(_0x17df8e,_0x17db51){var _0x4d9673=[];for(var _0x4ef8da in _0x1259ae[_0x594c('0x4c')]){if(_0x1259ae[_0x594c('0x4c')][_0x594c('0x40')](_0x4ef8da)){var _0x1002ed=_0x1259ae['faxQueues'][_0x4ef8da];var _0x4dd8ea={'id':_0x1002ed['id'],'available':_0x1002ed['available'],'loggedIn':_0x1002ed[_0x594c('0x45')],'name':_0x1002ed['name'],'paused':_0x1002ed[_0x594c('0x47')],'waiting':_0x1002ed[_0x594c('0x49')]};_0x4d9673[_0x594c('0x1d')](_0x4dd8ea);}}_0x17df8e({'count':_0x4d9673[_0x594c('0x14')],'rows':_0x4d9673});});},'WhatsappQueues':function(_0xa71e6a){return new Promise(function(_0x569c1e,_0x5f3d41){var _0x3f994d=[];for(var _0xf395d6 in _0x1259ae[_0x594c('0x4d')]){if(_0x1259ae[_0x594c('0x4d')][_0x594c('0x40')](_0xf395d6)){var _0x4e701b=_0x1259ae[_0x594c('0x4d')][_0xf395d6];var _0x2fa542={'id':_0x4e701b['id'],'available':_0x4e701b[_0x594c('0x44')],'loggedIn':_0x4e701b['loggedIn'],'name':_0x4e701b['name'],'paused':_0x4e701b[_0x594c('0x47')],'waiting':_0x4e701b[_0x594c('0x49')]};_0x3f994d[_0x594c('0x1d')](_0x2fa542);}}_0x569c1e({'count':_0x3f994d[_0x594c('0x14')],'rows':_0x3f994d});});},'ChatQueuesWaitingInteractions':function(_0x294822){return new Promise(function(_0x4754a4,_0x418aca){var _0x41010c=_[_0x594c('0x4e')](_0x1259ae[_0x594c('0x4f')]);_0x4754a4({'count':_0x41010c[_0x594c('0x14')],'rows':_0x41010c});});},'MailQueuesWaitingInteractions':function(_0x173923){return new Promise(function(_0x5afa11,_0x40117d){var _0x5c9a90=_[_0x594c('0x4e')](_0x1259ae[_0x594c('0x50')]);_0x5afa11({'count':_0x5c9a90[_0x594c('0x14')],'rows':_0x5c9a90});});},'OpenchannelQueuesWaitingInteractions':function(_0x3d232b){return new Promise(function(_0x12884a,_0xb2e786){var _0x21a388=_['values'](_0x1259ae[_0x594c('0x51')]);_0x12884a({'count':_0x21a388[_0x594c('0x14')],'rows':_0x21a388});});},'SmsQueuesWaitingInteractions':function(_0x3d8dcc){return new Promise(function(_0x2a1c73,_0x27127f){var _0x4322bd=_[_0x594c('0x4e')](_0x1259ae[_0x594c('0x52')]);_0x2a1c73({'count':_0x4322bd[_0x594c('0x14')],'rows':_0x4322bd});});},'FaxQueuesWaitingInteractions':function(_0x374c0d){return new Promise(function(_0x2c2a6a,_0x118f4c){var _0x5c8fae=_[_0x594c('0x4e')](_0x1259ae[_0x594c('0x53')]);_0x2c2a6a({'count':_0x5c8fae[_0x594c('0x14')],'rows':_0x5c8fae});});},'WhatsappQueuesWaitingInteractions':function(_0x329644){return new Promise(function(_0x35ce73,_0x504cec){var _0x3c82a5=_[_0x594c('0x4e')](_0x1259ae[_0x594c('0x54')]);_0x35ce73({'count':_0x3c82a5[_0x594c('0x14')],'rows':_0x3c82a5});});}};var _0x10105=jayson[_0x594c('0x55')](_0x5d1f0c)[_0x594c('0x56')]();_0x10105['on'](_0x594c('0x35'),function(_0x4d50c6){logger[_0x594c('0x35')](JSON['stringify'](_0x4d50c6));return _0x465d43(_0x4d50c6);});_0x10105[_0x594c('0x57')](0x232c,'127.0.0.1',function(){console['log'](_0x594c('0x58'),0x232c);return _0x5faa27('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 f5dd753..90b05c0 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 _0x5bc1=['then','error','message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','format','indexOf','true','[%s][INTERVAL]\x20%s','all','[%s][INTERVAL]\x20%s\x20%s','join','when','log','\x20|\x20','stack','jayson/promise','lodash','routing','http','request'];(function(_0x4e3db4,_0x160040){var _0xc4765d=function(_0x38c2c4){while(--_0x38c2c4){_0x4e3db4['push'](_0x4e3db4['shift']());}};_0xc4765d(++_0x160040);}(_0x5bc1,0x167));var _0x15bc=function(_0xa7c05d,_0x312374){_0xa7c05d=_0xa7c05d-0x0;var _0x47b002=_0x5bc1[_0xa7c05d];return _0x47b002;};'use strict';var util=require('util');var BPromise=require('bluebird');var jayson=require(_0x15bc('0x0'));var _=require(_0x15bc('0x1'));var logger=require('../../../config/logger')(_0x15bc('0x2'));var client=jayson['client'][_0x15bc('0x3')]({'port':0x232a});function request(_0x241fb1,_0x1c8df1){return new BPromise(function(_0x40ad5b,_0x192682){return client[_0x15bc('0x4')](_0x241fb1,_0x1c8df1)[_0x15bc('0x5')](function(_0x171456){if(_0x171456[_0x15bc('0x6')]){return _0x192682(_0x171456[_0x15bc('0x6')][_0x15bc('0x7')]);}else{return _0x40ad5b(_0x171456[_0x15bc('0x8')]);}})[_0x15bc('0x9')](function(_0x21a0e7){return _0x192682(_0x21a0e7);});});}exports[_0x15bc('0xa')]=function(_0x2056f7,_0x157122,_0x570490){return function(_0x36cac7){if(_0x570490[_0x15bc('0xb')]&&!_0x570490[_0x15bc('0xb')][_0x2056f7]){logger[_0x15bc('0xc')](_0x15bc('0xd'),_0x2056f7);return _0x36cac7[_0x15bc('0xe')]();}var _0x1a89e4=[];for(var _0x1d01e6=0x0;_0x1d01e6<_0x157122[_0x15bc('0xf')];_0x1d01e6+=0x1){_0x1a89e4[_0x15bc('0x10')](request('Command',{'command':util[_0x15bc('0x11')]('iftime\x20%s',_0x157122[_0x1d01e6])})['then'](function(_0x229d7d){return _0x229d7d&&_0x229d7d[_0x15bc('0x7')]&&_0x229d7d[_0x15bc('0x7')][_0x15bc('0x12')](_0x15bc('0x13'))>=0x0?!![]:![];})[_0x15bc('0x9')](function(_0x4dc79d){logger[_0x15bc('0x6')](_0x15bc('0x14'),_0x2056f7,_0x157122[_0x1d01e6]);}));}BPromise[_0x15bc('0x15')](_0x1a89e4)[_0x15bc('0x5')](function(_0xae5ae4){var _0x5e37d1=_['some'](_0xae5ae4);logger[_0x15bc('0xc')](_0x15bc('0x16'),_0x2056f7,_0x157122[_0x15bc('0x17')]('\x20|\x20'),_0x5e37d1);_0x36cac7[_0x15bc('0x18')](_0x5e37d1);})['catch'](function(_0x58efc5){console[_0x15bc('0x19')](_0x58efc5);logger[_0x15bc('0x6')](_0x15bc('0x16'),_0x2056f7,_0x157122[_0x15bc('0x17')](_0x15bc('0x1a')),_0x58efc5[_0x15bc('0x1b')]);_0x36cac7[_0x15bc('0xe')]();});};}; \ No newline at end of file +var _0xd747=['rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','length','push','Command','format','iftime\x20%s','indexOf','true','catch','[%s][INTERVAL]\x20%s','all','some','join','\x20|\x20','[%s][INTERVAL]\x20%s\x20%s','stop','jayson/promise','lodash','../../../config/logger','routing','http','request','then','error','message','condition'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xd747,0x146));var _0x7d74=function(_0x1de609,_0x7bb12e){_0x1de609=_0x1de609-0x0;var _0xc295a3=_0xd747[_0x1de609];return _0xc295a3;};'use strict';var util=require('util');var BPromise=require('bluebird');var jayson=require(_0x7d74('0x0'));var _=require(_0x7d74('0x1'));var logger=require(_0x7d74('0x2'))(_0x7d74('0x3'));var client=jayson['client'][_0x7d74('0x4')]({'port':0x232a});function request(_0x2e3fca,_0x2d0bde){return new BPromise(function(_0x1a5758,_0x4bfaa4){return client[_0x7d74('0x5')](_0x2e3fca,_0x2d0bde)[_0x7d74('0x6')](function(_0x2cd584){if(_0x2cd584[_0x7d74('0x7')]){return _0x4bfaa4(_0x2cd584[_0x7d74('0x7')][_0x7d74('0x8')]);}else{return _0x1a5758(_0x2cd584['result']);}})['catch'](function(_0x22fa70){return _0x4bfaa4(_0x22fa70);});});}exports[_0x7d74('0x9')]=function(_0x49130a,_0xd8688d,_0x58bef9){return function(_0xf40478){if(_0x58bef9['rules']&&!_0x58bef9[_0x7d74('0xa')][_0x49130a]){logger[_0x7d74('0xb')](_0x7d74('0xc'),_0x49130a);return _0xf40478['stop']();}var _0x1e5445=[];for(var _0x13bd62=0x0;_0x13bd62<_0xd8688d[_0x7d74('0xd')];_0x13bd62+=0x1){_0x1e5445[_0x7d74('0xe')](request(_0x7d74('0xf'),{'command':util[_0x7d74('0x10')](_0x7d74('0x11'),_0xd8688d[_0x13bd62])})[_0x7d74('0x6')](function(_0x4a7ef9){return _0x4a7ef9&&_0x4a7ef9['message']&&_0x4a7ef9[_0x7d74('0x8')][_0x7d74('0x12')](_0x7d74('0x13'))>=0x0?!![]:![];})[_0x7d74('0x14')](function(_0x473147){logger[_0x7d74('0x7')](_0x7d74('0x15'),_0x49130a,_0xd8688d[_0x13bd62]);}));}BPromise[_0x7d74('0x16')](_0x1e5445)['then'](function(_0x323f2a){var _0x3c6d21=_[_0x7d74('0x17')](_0x323f2a);logger[_0x7d74('0xb')]('[%s][INTERVAL]\x20%s\x20%s',_0x49130a,_0xd8688d[_0x7d74('0x18')](_0x7d74('0x19')),_0x3c6d21);_0xf40478['when'](_0x3c6d21);})[_0x7d74('0x14')](function(_0xf90e8a){console['log'](_0xf90e8a);logger[_0x7d74('0x7')](_0x7d74('0x1a'),_0x49130a,_0xd8688d['join'](_0x7d74('0x19')),_0xf90e8a['stack']);_0xf40478[_0x7d74('0x1b')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 6bc77bb..681d91e 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 _0x3f8c=['[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','[%s][agents][hangup]','./utils','info','membername','interface','calleridnum','connectedlinenum','lastevent','queue','then','type','agentacw','agentcomplete','acwtime','acwTimeout','request','CreateVoiceAgentReport','uniqueid','destuniqueid','debug','format','[%s][agents][agentcalled]','agentcalledAt','now','called','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','agentringnoanswer','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','push','error','queuecallerabandon','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','connectedlinename','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','isNil','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','blind','transferexten','extension','transferuniqueid','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','transfertype','ATTENDED','origtransfererexten','transfereeuniqueid','clone','calleridname','agententerreason','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','cause','rejected','indexOf','splice','agent'];(function(_0x21be11,_0x335981){var _0x2ddd60=function(_0x5e2db9){while(--_0x5e2db9){_0x21be11['push'](_0x21be11['shift']());}};_0x2ddd60(++_0x335981);}(_0x3f8c,0x104));var _0xc3f8=function(_0x4a8418,_0x2a9428){_0x4a8418=_0x4a8418-0x0;var _0xe271c2=_0x3f8c[_0x4a8418];return _0xe271c2;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0xc3f8('0x0'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x3a1f6a,_0x2e70c4){utils[_0xc3f8('0x1')](util['format']('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x3a1f6a['uniqueid'],_0x3a1f6a['channel'],_0x3a1f6a['queue'],_0x3a1f6a[_0xc3f8('0x2')],_0x3a1f6a[_0xc3f8('0x3')],_0x3a1f6a[_0xc3f8('0x4')],_0x3a1f6a[_0xc3f8('0x5')],_0x3a1f6a[_0xc3f8('0x6')]));if(_0x3a1f6a[_0xc3f8('0x7')]){utils['getVoiceQueueByName'](_0x3a1f6a[_0xc3f8('0x7')])[_0xc3f8('0x8')](function(_0x15cb3b){if(_0x15cb3b){_0x3a1f6a[_0xc3f8('0x9')]=_0x15cb3b[_0xc3f8('0x9')];_0x3a1f6a[_0xc3f8('0xa')]=_0x3a1f6a[_0xc3f8('0xb')]?_0x15cb3b['acw']:![];_0x3a1f6a[_0xc3f8('0xc')]=_0x3a1f6a[_0xc3f8('0xa')]?_0x15cb3b[_0xc3f8('0xd')]:0x0;}utils[_0xc3f8('0xe')]('CreateVoiceAgentReport',_0x3a1f6a);});}else{utils[_0xc3f8('0xe')](_0xc3f8('0xf'),_0x3a1f6a);}if(_0x2e70c4){delete transfers[_0x3a1f6a[_0xc3f8('0x10')]];}else{delete agents[_0x3a1f6a[_0xc3f8('0x11')]];}}exports['agentcalled']=function(_0x84f489){try{utils[_0xc3f8('0x12')](util[_0xc3f8('0x13')](_0xc3f8('0x14'),_0x84f489[_0xc3f8('0x10')]),_0x84f489);agents[_0x84f489[_0xc3f8('0x11')]]=_0x84f489;agents[_0x84f489[_0xc3f8('0x11')]][_0xc3f8('0x15')]=utils[_0xc3f8('0x16')]();agents[_0x84f489[_0xc3f8('0x11')]][_0xc3f8('0x6')]=_0xc3f8('0x17');agents[_0x84f489[_0xc3f8('0x11')]]['connectedlinenum']=null;agents[_0x84f489[_0xc3f8('0x11')]]['connectedlinename']=null;utils['info'](util[_0xc3f8('0x13')](_0xc3f8('0x18'),_0x84f489[_0xc3f8('0x10')],agents[_0x84f489[_0xc3f8('0x11')]]['membername'],_0x84f489[_0xc3f8('0x11')]));}catch(_0x1db809){utils['error'](util[_0xc3f8('0x13')]('[%s][agents][agentcalled]',_0x84f489[_0xc3f8('0x10')]),_0x1db809);}};exports[_0xc3f8('0x19')]=function(_0x3b2e98){try{if(!_['isNil'](agents[_0x3b2e98['destuniqueid']])){utils[_0xc3f8('0x12')](util[_0xc3f8('0x13')](_0xc3f8('0x1a'),_0x3b2e98[_0xc3f8('0x10')]),_0x3b2e98);utils[_0xc3f8('0x1')](util[_0xc3f8('0x13')](_0xc3f8('0x1b'),_0x3b2e98[_0xc3f8('0x10')],agents[_0x3b2e98['destuniqueid']]['membername'],_0x3b2e98['destuniqueid']));agents[_0x3b2e98[_0xc3f8('0x11')]]['agentringnoanswer']=!![];agents[_0x3b2e98[_0xc3f8('0x11')]][_0xc3f8('0x1c')]=utils['now']();agents[_0x3b2e98[_0xc3f8('0x11')]][_0xc3f8('0x6')]=_0xc3f8('0x1d');agents[_0x3b2e98[_0xc3f8('0x11')]][_0xc3f8('0x1e')]=_0xc3f8('0x1d');agents[_0x3b2e98[_0xc3f8('0x11')]][_0xc3f8('0x1f')]=_0x3b2e98[_0xc3f8('0x20')]?parseInt(_0x3b2e98[_0xc3f8('0x20')])/0x3e8:0x0;agents[_0x3b2e98[_0xc3f8('0x11')]][_0xc3f8('0x21')]=0x0;unanswered[_0xc3f8('0x22')](_0x3b2e98[_0xc3f8('0x11')]);}}catch(_0x59e4dd){utils[_0xc3f8('0x23')](util[_0xc3f8('0x13')](_0xc3f8('0x1a'),_0x3b2e98['uniqueid']),_0x59e4dd);}};exports[_0xc3f8('0x24')]=function(_0x4d39a0){try{_[_0xc3f8('0x25')](agents,function(_0x32343e,_0x47ab53){if(_0x32343e['uniqueid']==_0x4d39a0[_0xc3f8('0x10')]&&!_[_0xc3f8('0x26')](unanswered,_0x32343e[_0xc3f8('0x11')])){utils[_0xc3f8('0x12')](util[_0xc3f8('0x13')](_0xc3f8('0x27'),_0x4d39a0[_0xc3f8('0x10')]),_0x4d39a0);utils[_0xc3f8('0x1')](util[_0xc3f8('0x13')](_0xc3f8('0x28'),_0x4d39a0['uniqueid'],_0x32343e[_0xc3f8('0x2')],_0x32343e[_0xc3f8('0x11')]));_0x32343e[_0xc3f8('0x19')]=!![];_0x32343e[_0xc3f8('0x1c')]=utils[_0xc3f8('0x16')]();_0x32343e['lastevent']='abandoned';_0x32343e[_0xc3f8('0x1e')]=_0xc3f8('0x29');_0x32343e[_0xc3f8('0x1f')]=_0x4d39a0[_0xc3f8('0x1f')];_0x32343e[_0xc3f8('0x21')]=0x0;writeDB(_0x32343e);}});}catch(_0x4e51ac){utils[_0xc3f8('0x23')](util[_0xc3f8('0x13')](_0xc3f8('0x27'),_0x4d39a0['uniqueid']),_0x4e51ac);}};exports[_0xc3f8('0x2a')]=function(_0x11ecc2){try{if(agents[_0x11ecc2[_0xc3f8('0x11')]]){utils['debug'](util[_0xc3f8('0x13')](_0xc3f8('0x2b'),_0x11ecc2['uniqueid']),_0x11ecc2);utils[_0xc3f8('0x1')](util[_0xc3f8('0x13')](_0xc3f8('0x2c'),_0x11ecc2[_0xc3f8('0x10')],agents[_0x11ecc2[_0xc3f8('0x11')]][_0xc3f8('0x2')],_0x11ecc2['destuniqueid']));agents[_0x11ecc2[_0xc3f8('0x11')]][_0xc3f8('0x2d')]=utils[_0xc3f8('0x16')]();agents[_0x11ecc2[_0xc3f8('0x11')]][_0xc3f8('0x5')]=_0x11ecc2['connectedlinenum'];agents[_0x11ecc2[_0xc3f8('0x11')]][_0xc3f8('0x2e')]=_0x11ecc2[_0xc3f8('0x2e')];agents[_0x11ecc2['destuniqueid']][_0xc3f8('0x1f')]=_0x11ecc2[_0xc3f8('0x20')];agents[_0x11ecc2[_0xc3f8('0x11')]][_0xc3f8('0x6')]='connect';_[_0xc3f8('0x25')](agents,function(_0x45d416,_0x2df096){if(_0x45d416[_0xc3f8('0x11')]!=_0x11ecc2['destuniqueid']&&_0x45d416[_0xc3f8('0x10')]==_0x11ecc2['uniqueid']){_0x45d416['talktime']=0x0;_0x45d416[_0xc3f8('0x1f')]=_0x11ecc2[_0xc3f8('0x20')];_0x45d416[_0xc3f8('0x19')]=!![];_0x45d416[_0xc3f8('0x1c')]=utils['now']();_0x45d416['lastevent']=_0xc3f8('0x2f');_0x45d416[_0xc3f8('0x1e')]=_0xc3f8('0x2f');_0x45d416[_0xc3f8('0x30')]=_0x11ecc2[_0xc3f8('0x11')];_0x45d416[_0xc3f8('0x31')]=_0x11ecc2[_0xc3f8('0x2')];writeDB(_0x45d416);}});}}catch(_0x45e6ea){utils[_0xc3f8('0x23')](util[_0xc3f8('0x13')](_0xc3f8('0x2b'),_0x11ecc2['uniqueid']),_0x45e6ea);}};exports[_0xc3f8('0xb')]=function(_0x22e9b3){try{if(!_['isNil'](agents[_0x22e9b3[_0xc3f8('0x11')]])){utils[_0xc3f8('0x12')](util['format'](_0xc3f8('0x32'),_0x22e9b3[_0xc3f8('0x10')]),_0x22e9b3);utils[_0xc3f8('0x1')](util[_0xc3f8('0x13')](_0xc3f8('0x33'),_0x22e9b3[_0xc3f8('0x10')],agents[_0x22e9b3[_0xc3f8('0x11')]][_0xc3f8('0x2')],_0x22e9b3[_0xc3f8('0x11')]));agents[_0x22e9b3[_0xc3f8('0x11')]][_0xc3f8('0xb')]=!![];agents[_0x22e9b3['destuniqueid']][_0xc3f8('0x34')]=utils[_0xc3f8('0x16')]();agents[_0x22e9b3['destuniqueid']][_0xc3f8('0x21')]=utils[_0xc3f8('0x35')](agents[_0x22e9b3[_0xc3f8('0x11')]][_0xc3f8('0x34')],agents[_0x22e9b3['destuniqueid']]['agentconnectAt']);agents[_0x22e9b3[_0xc3f8('0x11')]][_0xc3f8('0x1e')]=_0x22e9b3[_0xc3f8('0x1e')];agents[_0x22e9b3['destuniqueid']][_0xc3f8('0x6')]=_0xc3f8('0x36');writeDB(agents[_0x22e9b3[_0xc3f8('0x11')]]);}}catch(_0xe3d5c4){utils[_0xc3f8('0x23')](util['format'](_0xc3f8('0x32'),_0x22e9b3[_0xc3f8('0x10')]),_0xe3d5c4);}};exports['blindtransfer']=function(_0x1becae){try{if(!_[_0xc3f8('0x37')](agents[_0x1becae[_0xc3f8('0x38')]])){utils[_0xc3f8('0x12')](util[_0xc3f8('0x13')](_0xc3f8('0x39'),_0x1becae[_0xc3f8('0x10')]),_0x1becae);utils['info'](util[_0xc3f8('0x13')](_0xc3f8('0x3a'),_0x1becae['uniqueid'],agents[_0x1becae[_0xc3f8('0x38')]][_0xc3f8('0x2')],agents[_0x1becae[_0xc3f8('0x38')]][_0xc3f8('0x10')]));agents[_0x1becae[_0xc3f8('0x38')]][_0xc3f8('0x3b')]=!![];agents[_0x1becae[_0xc3f8('0x38')]]['transfertype']=_0xc3f8('0x3c');agents[_0x1becae[_0xc3f8('0x38')]][_0xc3f8('0x3d')]=_0x1becae[_0xc3f8('0x3e')];agents[_0x1becae[_0xc3f8('0x38')]][_0xc3f8('0x3f')]=agents[_0x1becae[_0xc3f8('0x38')]][_0xc3f8('0x10')];}}catch(_0x4fc02c){utils['error'](util[_0xc3f8('0x13')](_0xc3f8('0x39'),_0x1becae['uniqueid']),_0x4fc02c);}};exports['attendedtransfer']=function(_0x773d56){try{utils['debug'](util[_0xc3f8('0x13')](_0xc3f8('0x40'),_0x773d56[_0xc3f8('0x41')]),_0x773d56);if(_0x773d56['origtransfereruniqueid']==_0x773d56[_0xc3f8('0x42')]){if(!_['isNil'](agents[_0x773d56['secondtransfereruniqueid']])){utils[_0xc3f8('0x1')](util['format'](_0xc3f8('0x43'),_0x773d56[_0xc3f8('0x41')],agents[_0x773d56[_0xc3f8('0x44')]]['membername']));agents[_0x773d56[_0xc3f8('0x44')]][_0xc3f8('0x3b')]=!![];agents[_0x773d56[_0xc3f8('0x44')]][_0xc3f8('0x45')]=_0xc3f8('0x46');agents[_0x773d56['secondtransfereruniqueid']]['transferexten']=_0x773d56[_0xc3f8('0x47')];agents[_0x773d56[_0xc3f8('0x44')]][_0xc3f8('0x3f')]=_0x773d56[_0xc3f8('0x41')];}if(_0x773d56[_0xc3f8('0x48')]&&agents[_0x773d56['transfereeuniqueid']]){agents[_0x773d56[_0xc3f8('0x48')]]['agententerreason']=0x1;transfers[_0x773d56[_0xc3f8('0x48')]]=_[_0xc3f8('0x49')](agents[_0x773d56[_0xc3f8('0x48')]]);transfers[_0x773d56[_0xc3f8('0x48')]]['calleridnum']=agents[_0x773d56[_0xc3f8('0x44')]]['calleridnum'];transfers[_0x773d56['transfereeuniqueid']]['calleridname']=agents[_0x773d56['secondtransfereruniqueid']][_0xc3f8('0x4a')];transfers[_0x773d56[_0xc3f8('0x48')]][_0xc3f8('0x15')]=utils[_0xc3f8('0x16')]();transfers[_0x773d56[_0xc3f8('0x48')]][_0xc3f8('0x2d')]=utils[_0xc3f8('0x16')]();transfers[_0x773d56[_0xc3f8('0x48')]]['holdtime']=0x0;transfers[_0x773d56[_0xc3f8('0x48')]][_0xc3f8('0x4b')]=0x2;}}else if(_0x773d56[_0xc3f8('0x44')]==_0x773d56[_0xc3f8('0x4c')]){if(!_[_0xc3f8('0x37')](agents[_0x773d56['origtransfereruniqueid']])){utils[_0xc3f8('0x1')](util[_0xc3f8('0x13')](_0xc3f8('0x43'),_0x773d56[_0xc3f8('0x41')],agents[_0x773d56[_0xc3f8('0x41')]]['membername']));agents[_0x773d56[_0xc3f8('0x41')]][_0xc3f8('0x3b')]=!![];agents[_0x773d56[_0xc3f8('0x41')]][_0xc3f8('0x45')]=_0xc3f8('0x46');agents[_0x773d56[_0xc3f8('0x41')]]['transferexten']=_0x773d56[_0xc3f8('0x4d')];agents[_0x773d56[_0xc3f8('0x41')]][_0xc3f8('0x3f')]=_0x773d56['secondtransfereruniqueid'];}if(_0x773d56[_0xc3f8('0x4e')]&&agents[_0x773d56[_0xc3f8('0x4e')]]){agents[_0x773d56['transfertargetuniqueid']]['agententerreason']=0x1;transfers[_0x773d56[_0xc3f8('0x4e')]]=_[_0xc3f8('0x49')](agents[_0x773d56['transfertargetuniqueid']]);transfers[_0x773d56[_0xc3f8('0x4e')]][_0xc3f8('0x4')]=agents[_0x773d56[_0xc3f8('0x41')]][_0xc3f8('0x4')];transfers[_0x773d56[_0xc3f8('0x4e')]][_0xc3f8('0x4a')]=agents[_0x773d56[_0xc3f8('0x41')]][_0xc3f8('0x4a')];transfers[_0x773d56['transfertargetuniqueid']]['agentcalledAt']=utils[_0xc3f8('0x16')]();transfers[_0x773d56['transfertargetuniqueid']]['agentconnectAt']=utils['now']();transfers[_0x773d56['transfertargetuniqueid']]['holdtime']=0x0;transfers[_0x773d56[_0xc3f8('0x4e')]][_0xc3f8('0x4b')]=0x2;}}}catch(_0x188d39){utils[_0xc3f8('0x23')](util['format'](_0xc3f8('0x40'),_0x773d56[_0xc3f8('0x41')]),_0x188d39);}};exports['hangup']=function(_0x3b9b47){try{utils[_0xc3f8('0x12')](util[_0xc3f8('0x13')]('[%s][agents][hangup]',_0x3b9b47[_0xc3f8('0x10')]),_0x3b9b47);if(agents[_0x3b9b47['uniqueid']]&&agents[_0x3b9b47['uniqueid']]['reason']===_0xc3f8('0x1d')){if(_0x3b9b47[_0xc3f8('0x4f')]==='21'){agents[_0x3b9b47['uniqueid']][_0xc3f8('0x1e')]=_0xc3f8('0x50');agents[_0x3b9b47['uniqueid']][_0xc3f8('0x6')]=_0xc3f8('0x50');}utils['info'](util[_0xc3f8('0x13')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x3b9b47[_0xc3f8('0x10')],agents[_0x3b9b47[_0xc3f8('0x10')]]['membername'],agents[_0x3b9b47['uniqueid']][_0xc3f8('0x1e')],agents[_0x3b9b47[_0xc3f8('0x10')]]['lastevent']));writeDB(agents[_0x3b9b47[_0xc3f8('0x10')]]);var _0x5de19e=unanswered[_0xc3f8('0x51')](_0x3b9b47['uniqueid']);if(_0x5de19e>-0x1){unanswered[_0xc3f8('0x52')](_0x5de19e,0x1);}}if(transfers[_0x3b9b47[_0xc3f8('0x10')]]){transfers[_0x3b9b47[_0xc3f8('0x10')]][_0xc3f8('0xb')]=!![];transfers[_0x3b9b47[_0xc3f8('0x10')]][_0xc3f8('0x34')]=utils[_0xc3f8('0x16')]();transfers[_0x3b9b47[_0xc3f8('0x10')]][_0xc3f8('0x21')]=utils['diffTime'](transfers[_0x3b9b47[_0xc3f8('0x10')]][_0xc3f8('0x34')],transfers[_0x3b9b47[_0xc3f8('0x10')]][_0xc3f8('0x2d')]);transfers[_0x3b9b47[_0xc3f8('0x10')]]['reason']=_0xc3f8('0x53');transfers[_0x3b9b47[_0xc3f8('0x10')]][_0xc3f8('0x6')]=_0xc3f8('0x36');utils[_0xc3f8('0x1')](util['format'](_0xc3f8('0x54'),_0x3b9b47[_0xc3f8('0x10')],transfers[_0x3b9b47[_0xc3f8('0x10')]]['membername'],transfers[_0x3b9b47['uniqueid']][_0xc3f8('0x1e')],transfers[_0x3b9b47[_0xc3f8('0x10')]][_0xc3f8('0x6')]));writeDB(transfers[_0x3b9b47[_0xc3f8('0x10')]],!![]);}if(agents[_0x3b9b47['uniqueid']]&&agents[_0x3b9b47[_0xc3f8('0x10')]][_0xc3f8('0x2d')]){agents[_0x3b9b47[_0xc3f8('0x10')]]['agentcomplete']=!![];agents[_0x3b9b47[_0xc3f8('0x10')]][_0xc3f8('0x34')]=utils['now']();agents[_0x3b9b47['uniqueid']][_0xc3f8('0x21')]=utils[_0xc3f8('0x35')](agents[_0x3b9b47['uniqueid']][_0xc3f8('0x34')],agents[_0x3b9b47[_0xc3f8('0x10')]]['agentconnectAt']);agents[_0x3b9b47[_0xc3f8('0x10')]]['reason']=agents[_0x3b9b47[_0xc3f8('0x10')]]['transfer']?_0xc3f8('0x3b'):_0xc3f8('0x53');agents[_0x3b9b47[_0xc3f8('0x10')]][_0xc3f8('0x6')]=_0xc3f8('0x36');utils[_0xc3f8('0x1')](util[_0xc3f8('0x13')](_0xc3f8('0x54'),_0x3b9b47[_0xc3f8('0x10')],agents[_0x3b9b47['uniqueid']]['membername'],agents[_0x3b9b47[_0xc3f8('0x10')]]['reason'],agents[_0x3b9b47[_0xc3f8('0x10')]][_0xc3f8('0x6')]));writeDB(agents[_0x3b9b47[_0xc3f8('0x10')]]);}}catch(_0xfb05eb){utils['error'](util[_0xc3f8('0x13')](_0xc3f8('0x55'),_0x3b9b47[_0xc3f8('0x10')]),_0xfb05eb);}}; \ No newline at end of file +var _0x351d=['[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','agentringnoanswer','isNil','debug','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','reason','ringtime','push','error','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','holdtime','talktime','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinenum','connectedlinename','connect','forIn','answered_elsewhere','answeredelsewheredestinationuniqueid','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','blindtransfer','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','transfertype','extension','transferuniqueid','[%s][agents][blindtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','ATTENDED','transferexten','secondtransfererexten','transfertargetuniqueid','[%s][agents][attendedtransfer]','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','diffTime','agent','complete','lodash','./utils','format','uniqueid','channel','membername','interface','calleridnum','lastevent','queue','then','type','agentcomplete','acw','agentacw','acwTimeout','CreateVoiceAgentReport','destuniqueid','agentcalled','[%s][agents][agentcalled]','agentcalledAt','now','called','info'];(function(_0xbbab41,_0x5117df){var _0x6464ee=function(_0x23caa6){while(--_0x23caa6){_0xbbab41['push'](_0xbbab41['shift']());}};_0x6464ee(++_0x5117df);}(_0x351d,0x90));var _0xd351=function(_0x1f986b,_0x3f12e8){_0x1f986b=_0x1f986b-0x0;var _0x1414a3=_0x351d[_0x1f986b];return _0x1414a3;};'use strict';var _=require(_0xd351('0x0'));var util=require('util');var utils=require(_0xd351('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x2aa5fd,_0x340931){utils['info'](util[_0xd351('0x2')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x2aa5fd[_0xd351('0x3')],_0x2aa5fd[_0xd351('0x4')],_0x2aa5fd['queue'],_0x2aa5fd[_0xd351('0x5')],_0x2aa5fd[_0xd351('0x6')],_0x2aa5fd[_0xd351('0x7')],_0x2aa5fd['connectedlinenum'],_0x2aa5fd[_0xd351('0x8')]));if(_0x2aa5fd[_0xd351('0x9')]){utils['getVoiceQueueByName'](_0x2aa5fd[_0xd351('0x9')])[_0xd351('0xa')](function(_0x51c5f4){if(_0x51c5f4){_0x2aa5fd['type']=_0x51c5f4[_0xd351('0xb')];_0x2aa5fd['agentacw']=_0x2aa5fd[_0xd351('0xc')]?_0x51c5f4[_0xd351('0xd')]:![];_0x2aa5fd['acwtime']=_0x2aa5fd[_0xd351('0xe')]?_0x51c5f4[_0xd351('0xf')]:0x0;}utils['request'](_0xd351('0x10'),_0x2aa5fd);});}else{utils['request']('CreateVoiceAgentReport',_0x2aa5fd);}if(_0x340931){delete transfers[_0x2aa5fd[_0xd351('0x3')]];}else{delete agents[_0x2aa5fd[_0xd351('0x11')]];}}exports[_0xd351('0x12')]=function(_0x1eb2a9){try{utils['debug'](util[_0xd351('0x2')](_0xd351('0x13'),_0x1eb2a9['uniqueid']),_0x1eb2a9);agents[_0x1eb2a9[_0xd351('0x11')]]=_0x1eb2a9;agents[_0x1eb2a9[_0xd351('0x11')]][_0xd351('0x14')]=utils[_0xd351('0x15')]();agents[_0x1eb2a9[_0xd351('0x11')]]['lastevent']=_0xd351('0x16');agents[_0x1eb2a9['destuniqueid']]['connectedlinenum']=null;agents[_0x1eb2a9[_0xd351('0x11')]]['connectedlinename']=null;utils[_0xd351('0x17')](util[_0xd351('0x2')](_0xd351('0x18'),_0x1eb2a9['uniqueid'],agents[_0x1eb2a9[_0xd351('0x11')]][_0xd351('0x5')],_0x1eb2a9[_0xd351('0x11')]));}catch(_0x12b5aa){utils['error'](util[_0xd351('0x2')]('[%s][agents][agentcalled]',_0x1eb2a9['uniqueid']),_0x12b5aa);}};exports[_0xd351('0x19')]=function(_0x4a427b){try{if(!_[_0xd351('0x1a')](agents[_0x4a427b[_0xd351('0x11')]])){utils[_0xd351('0x1b')](util[_0xd351('0x2')](_0xd351('0x1c'),_0x4a427b['uniqueid']),_0x4a427b);utils[_0xd351('0x17')](util[_0xd351('0x2')](_0xd351('0x1d'),_0x4a427b['uniqueid'],agents[_0x4a427b[_0xd351('0x11')]][_0xd351('0x5')],_0x4a427b[_0xd351('0x11')]));agents[_0x4a427b['destuniqueid']][_0xd351('0x19')]=!![];agents[_0x4a427b[_0xd351('0x11')]][_0xd351('0x1e')]=utils[_0xd351('0x15')]();agents[_0x4a427b['destuniqueid']][_0xd351('0x8')]='timeout';agents[_0x4a427b[_0xd351('0x11')]][_0xd351('0x1f')]='timeout';agents[_0x4a427b[_0xd351('0x11')]]['holdtime']=_0x4a427b['ringtime']?parseInt(_0x4a427b[_0xd351('0x20')])/0x3e8:0x0;agents[_0x4a427b['destuniqueid']]['talktime']=0x0;unanswered[_0xd351('0x21')](_0x4a427b['destuniqueid']);}}catch(_0x38471c){utils[_0xd351('0x22')](util[_0xd351('0x2')]('[%s][agents][agentringnoanswer]',_0x4a427b[_0xd351('0x3')]),_0x38471c);}};exports['queuecallerabandon']=function(_0x1c826b){try{_['forIn'](agents,function(_0x5f07b1,_0xeb4da9){if(_0x5f07b1[_0xd351('0x3')]==_0x1c826b[_0xd351('0x3')]&&!_[_0xd351('0x23')](unanswered,_0x5f07b1['destuniqueid'])){utils[_0xd351('0x1b')](util[_0xd351('0x2')](_0xd351('0x24'),_0x1c826b[_0xd351('0x3')]),_0x1c826b);utils[_0xd351('0x17')](util[_0xd351('0x2')](_0xd351('0x25'),_0x1c826b[_0xd351('0x3')],_0x5f07b1[_0xd351('0x5')],_0x5f07b1['destuniqueid']));_0x5f07b1[_0xd351('0x19')]=!![];_0x5f07b1[_0xd351('0x1e')]=utils[_0xd351('0x15')]();_0x5f07b1[_0xd351('0x8')]='abandoned';_0x5f07b1[_0xd351('0x1f')]=_0xd351('0x26');_0x5f07b1[_0xd351('0x27')]=_0x1c826b[_0xd351('0x27')];_0x5f07b1[_0xd351('0x28')]=0x0;writeDB(_0x5f07b1);}});}catch(_0x37fbb8){utils[_0xd351('0x22')](util[_0xd351('0x2')](_0xd351('0x24'),_0x1c826b['uniqueid']),_0x37fbb8);}};exports['agentconnect']=function(_0x1fae11){try{if(agents[_0x1fae11[_0xd351('0x11')]]){utils[_0xd351('0x1b')](util[_0xd351('0x2')](_0xd351('0x29'),_0x1fae11[_0xd351('0x3')]),_0x1fae11);utils['info'](util['format'](_0xd351('0x2a'),_0x1fae11['uniqueid'],agents[_0x1fae11[_0xd351('0x11')]][_0xd351('0x5')],_0x1fae11[_0xd351('0x11')]));agents[_0x1fae11[_0xd351('0x11')]][_0xd351('0x2b')]=utils[_0xd351('0x15')]();agents[_0x1fae11[_0xd351('0x11')]][_0xd351('0x2c')]=_0x1fae11[_0xd351('0x2c')];agents[_0x1fae11[_0xd351('0x11')]][_0xd351('0x2d')]=_0x1fae11['connectedlinename'];agents[_0x1fae11[_0xd351('0x11')]]['holdtime']=_0x1fae11[_0xd351('0x20')];agents[_0x1fae11[_0xd351('0x11')]][_0xd351('0x8')]=_0xd351('0x2e');_[_0xd351('0x2f')](agents,function(_0x3db72a,_0x545bfc){if(_0x3db72a[_0xd351('0x11')]!=_0x1fae11[_0xd351('0x11')]&&_0x3db72a['uniqueid']==_0x1fae11[_0xd351('0x3')]){_0x3db72a[_0xd351('0x28')]=0x0;_0x3db72a[_0xd351('0x27')]=_0x1fae11[_0xd351('0x20')];_0x3db72a[_0xd351('0x19')]=!![];_0x3db72a['agentringnoanswerAt']=utils['now']();_0x3db72a[_0xd351('0x8')]=_0xd351('0x30');_0x3db72a['reason']='answered_elsewhere';_0x3db72a[_0xd351('0x31')]=_0x1fae11[_0xd351('0x11')];_0x3db72a['answeredelsewheremembername']=_0x1fae11['membername'];writeDB(_0x3db72a);}});}}catch(_0x46af23){utils[_0xd351('0x22')](util[_0xd351('0x2')](_0xd351('0x29'),_0x1fae11[_0xd351('0x3')]),_0x46af23);}};exports[_0xd351('0xc')]=function(_0x6192c3){try{if(!_[_0xd351('0x1a')](agents[_0x6192c3[_0xd351('0x11')]])){utils['debug'](util['format'](_0xd351('0x32'),_0x6192c3[_0xd351('0x3')]),_0x6192c3);utils[_0xd351('0x17')](util[_0xd351('0x2')](_0xd351('0x33'),_0x6192c3[_0xd351('0x3')],agents[_0x6192c3[_0xd351('0x11')]][_0xd351('0x5')],_0x6192c3[_0xd351('0x11')]));agents[_0x6192c3[_0xd351('0x11')]][_0xd351('0xc')]=!![];agents[_0x6192c3[_0xd351('0x11')]][_0xd351('0x34')]=utils[_0xd351('0x15')]();agents[_0x6192c3[_0xd351('0x11')]][_0xd351('0x28')]=utils['diffTime'](agents[_0x6192c3[_0xd351('0x11')]][_0xd351('0x34')],agents[_0x6192c3[_0xd351('0x11')]]['agentconnectAt']);agents[_0x6192c3[_0xd351('0x11')]][_0xd351('0x1f')]=_0x6192c3[_0xd351('0x1f')];agents[_0x6192c3[_0xd351('0x11')]][_0xd351('0x8')]='complete';writeDB(agents[_0x6192c3[_0xd351('0x11')]]);}}catch(_0x575ea0){utils[_0xd351('0x22')](util[_0xd351('0x2')]('[%s][agents][agentcomplete]',_0x6192c3['uniqueid']),_0x575ea0);}};exports[_0xd351('0x35')]=function(_0x444206){try{if(!_[_0xd351('0x1a')](agents[_0x444206['transfereruniqueid']])){utils[_0xd351('0x1b')](util[_0xd351('0x2')]('[%s][agents][blindtransfer]',_0x444206[_0xd351('0x3')]),_0x444206);utils['info'](util[_0xd351('0x2')](_0xd351('0x36'),_0x444206['uniqueid'],agents[_0x444206['transfereruniqueid']][_0xd351('0x5')],agents[_0x444206['transfereruniqueid']][_0xd351('0x3')]));agents[_0x444206[_0xd351('0x37')]][_0xd351('0x38')]=!![];agents[_0x444206['transfereruniqueid']][_0xd351('0x39')]='blind';agents[_0x444206['transfereruniqueid']]['transferexten']=_0x444206[_0xd351('0x3a')];agents[_0x444206[_0xd351('0x37')]][_0xd351('0x3b')]=agents[_0x444206['transfereruniqueid']]['uniqueid'];}}catch(_0x1748f0){utils[_0xd351('0x22')](util['format'](_0xd351('0x3c'),_0x444206[_0xd351('0x3')]),_0x1748f0);}};exports['attendedtransfer']=function(_0x24ee0f){try{utils['debug'](util[_0xd351('0x2')]('[%s][agents][attendedtransfer]',_0x24ee0f[_0xd351('0x3d')]),_0x24ee0f);if(_0x24ee0f[_0xd351('0x3d')]==_0x24ee0f[_0xd351('0x3e')]){if(!_[_0xd351('0x1a')](agents[_0x24ee0f[_0xd351('0x3f')]])){utils[_0xd351('0x17')](util[_0xd351('0x2')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x24ee0f['origtransfereruniqueid'],agents[_0x24ee0f[_0xd351('0x3f')]][_0xd351('0x5')]));agents[_0x24ee0f['secondtransfereruniqueid']][_0xd351('0x38')]=!![];agents[_0x24ee0f[_0xd351('0x3f')]][_0xd351('0x39')]='ATTENDED';agents[_0x24ee0f[_0xd351('0x3f')]]['transferexten']=_0x24ee0f['origtransfererexten'];agents[_0x24ee0f[_0xd351('0x3f')]][_0xd351('0x3b')]=_0x24ee0f['origtransfereruniqueid'];}if(_0x24ee0f[_0xd351('0x40')]&&agents[_0x24ee0f[_0xd351('0x40')]]){agents[_0x24ee0f[_0xd351('0x40')]][_0xd351('0x41')]=0x1;transfers[_0x24ee0f[_0xd351('0x40')]]=_[_0xd351('0x42')](agents[_0x24ee0f['transfereeuniqueid']]);transfers[_0x24ee0f[_0xd351('0x40')]][_0xd351('0x7')]=agents[_0x24ee0f[_0xd351('0x3f')]][_0xd351('0x7')];transfers[_0x24ee0f[_0xd351('0x40')]][_0xd351('0x43')]=agents[_0x24ee0f[_0xd351('0x3f')]]['calleridname'];transfers[_0x24ee0f[_0xd351('0x40')]]['agentcalledAt']=utils[_0xd351('0x15')]();transfers[_0x24ee0f[_0xd351('0x40')]][_0xd351('0x2b')]=utils[_0xd351('0x15')]();transfers[_0x24ee0f[_0xd351('0x40')]]['holdtime']=0x0;transfers[_0x24ee0f[_0xd351('0x40')]]['agententerreason']=0x2;}}else if(_0x24ee0f[_0xd351('0x3f')]==_0x24ee0f[_0xd351('0x44')]){if(!_[_0xd351('0x1a')](agents[_0x24ee0f[_0xd351('0x3d')]])){utils[_0xd351('0x17')](util['format']('[%s][agents][attendedtransfer]\x20agent:%s',_0x24ee0f[_0xd351('0x3d')],agents[_0x24ee0f[_0xd351('0x3d')]]['membername']));agents[_0x24ee0f[_0xd351('0x3d')]][_0xd351('0x38')]=!![];agents[_0x24ee0f[_0xd351('0x3d')]]['transfertype']=_0xd351('0x45');agents[_0x24ee0f[_0xd351('0x3d')]][_0xd351('0x46')]=_0x24ee0f[_0xd351('0x47')];agents[_0x24ee0f['origtransfereruniqueid']]['transferuniqueid']=_0x24ee0f[_0xd351('0x3f')];}if(_0x24ee0f[_0xd351('0x48')]&&agents[_0x24ee0f[_0xd351('0x48')]]){agents[_0x24ee0f[_0xd351('0x48')]][_0xd351('0x41')]=0x1;transfers[_0x24ee0f[_0xd351('0x48')]]=_[_0xd351('0x42')](agents[_0x24ee0f['transfertargetuniqueid']]);transfers[_0x24ee0f[_0xd351('0x48')]]['calleridnum']=agents[_0x24ee0f['origtransfereruniqueid']][_0xd351('0x7')];transfers[_0x24ee0f[_0xd351('0x48')]]['calleridname']=agents[_0x24ee0f[_0xd351('0x3d')]]['calleridname'];transfers[_0x24ee0f['transfertargetuniqueid']]['agentcalledAt']=utils[_0xd351('0x15')]();transfers[_0x24ee0f[_0xd351('0x48')]][_0xd351('0x2b')]=utils['now']();transfers[_0x24ee0f[_0xd351('0x48')]][_0xd351('0x27')]=0x0;transfers[_0x24ee0f[_0xd351('0x48')]][_0xd351('0x41')]=0x2;}}}catch(_0x2375db){utils[_0xd351('0x22')](util[_0xd351('0x2')](_0xd351('0x49'),_0x24ee0f[_0xd351('0x3d')]),_0x2375db);}};exports[_0xd351('0x4a')]=function(_0x18c261){try{utils['debug'](util[_0xd351('0x2')](_0xd351('0x4b'),_0x18c261[_0xd351('0x3')]),_0x18c261);if(agents[_0x18c261[_0xd351('0x3')]]&&agents[_0x18c261[_0xd351('0x3')]][_0xd351('0x1f')]==='timeout'){if(_0x18c261[_0xd351('0x4c')]==='21'){agents[_0x18c261[_0xd351('0x3')]]['reason']='rejected';agents[_0x18c261[_0xd351('0x3')]][_0xd351('0x8')]=_0xd351('0x4d');}utils[_0xd351('0x17')](util[_0xd351('0x2')](_0xd351('0x4e'),_0x18c261[_0xd351('0x3')],agents[_0x18c261[_0xd351('0x3')]][_0xd351('0x5')],agents[_0x18c261['uniqueid']][_0xd351('0x1f')],agents[_0x18c261[_0xd351('0x3')]]['lastevent']));writeDB(agents[_0x18c261[_0xd351('0x3')]]);var _0x58eed5=unanswered[_0xd351('0x4f')](_0x18c261['uniqueid']);if(_0x58eed5>-0x1){unanswered[_0xd351('0x50')](_0x58eed5,0x1);}}if(transfers[_0x18c261[_0xd351('0x3')]]){transfers[_0x18c261[_0xd351('0x3')]][_0xd351('0xc')]=!![];transfers[_0x18c261[_0xd351('0x3')]][_0xd351('0x34')]=utils[_0xd351('0x15')]();transfers[_0x18c261['uniqueid']][_0xd351('0x28')]=utils[_0xd351('0x51')](transfers[_0x18c261[_0xd351('0x3')]][_0xd351('0x34')],transfers[_0x18c261[_0xd351('0x3')]]['agentconnectAt']);transfers[_0x18c261[_0xd351('0x3')]][_0xd351('0x1f')]=_0xd351('0x52');transfers[_0x18c261['uniqueid']][_0xd351('0x8')]=_0xd351('0x53');utils[_0xd351('0x17')](util[_0xd351('0x2')](_0xd351('0x4e'),_0x18c261[_0xd351('0x3')],transfers[_0x18c261[_0xd351('0x3')]][_0xd351('0x5')],transfers[_0x18c261[_0xd351('0x3')]]['reason'],transfers[_0x18c261[_0xd351('0x3')]][_0xd351('0x8')]));writeDB(transfers[_0x18c261['uniqueid']],!![]);}if(agents[_0x18c261[_0xd351('0x3')]]&&agents[_0x18c261['uniqueid']]['agentconnectAt']){agents[_0x18c261['uniqueid']][_0xd351('0xc')]=!![];agents[_0x18c261[_0xd351('0x3')]][_0xd351('0x34')]=utils['now']();agents[_0x18c261[_0xd351('0x3')]]['talktime']=utils[_0xd351('0x51')](agents[_0x18c261['uniqueid']][_0xd351('0x34')],agents[_0x18c261[_0xd351('0x3')]][_0xd351('0x2b')]);agents[_0x18c261[_0xd351('0x3')]][_0xd351('0x1f')]=agents[_0x18c261[_0xd351('0x3')]][_0xd351('0x38')]?_0xd351('0x38'):_0xd351('0x52');agents[_0x18c261[_0xd351('0x3')]][_0xd351('0x8')]=_0xd351('0x53');utils['info'](util[_0xd351('0x2')](_0xd351('0x4e'),_0x18c261[_0xd351('0x3')],agents[_0x18c261[_0xd351('0x3')]][_0xd351('0x5')],agents[_0x18c261['uniqueid']][_0xd351('0x1f')],agents[_0x18c261[_0xd351('0x3')]][_0xd351('0x8')]));writeDB(agents[_0x18c261[_0xd351('0x3')]]);}}catch(_0x4a4b25){utils[_0xd351('0x22')](util[_0xd351('0x2')]('[%s][agents][hangup]',_0x18c261[_0xd351('0x3')]),_0x4a4b25);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index ff94ee2..380ec65 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 _0xdbd0=['sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','application','toLowerCase','set','startsWith','cdr','appdata','split','lastIndexOf','includes','noop','execif','gotoif','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','info','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','calleridnum','connectedlinenum','accountcode','getUserByInternal','then','UserId','request','newchannel','[%s][calls][newchannel]','OutgoingSpoolFailed','format','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','now','DOCUMENTATION','newstate','debug','[%s][calls][newstate]','channelstate','context','isNil','systemanswertime','linkedid','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','disposition','toNumber','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','endtime','duration','starttime','billableseconds','answertime','diffTime','origtransfereruniqueid','localtwolinkedid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','userfield','origtransfererchannel','_attended','error','[%s][calls][attendedtransfer]','musiconholdstart','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','xmd-originatecalleridnum','value','source','variable','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','ContactId','xmd-cdrtype','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid'];(function(_0x478d8c,_0x3341c1){var _0x3f343a=function(_0x5d2b2a){while(--_0x5d2b2a){_0x478d8c['push'](_0x478d8c['shift']());}};_0x3f343a(++_0x3341c1);}(_0xdbd0,0x7e));var _0x0dbd=function(_0x5eb7af,_0x418420){_0x5eb7af=_0x5eb7af-0x0;var _0x290f17=_0xdbd0[_0x5eb7af];return _0x290f17;};'use strict';var _=require(_0x0dbd('0x0'));var util=require(_0x0dbd('0x1'));var utils=require(_0x0dbd('0x2'));var transfers=require(_0x0dbd('0x3'));var dispositions=[_0x0dbd('0x4'),_0x0dbd('0x5'),_0x0dbd('0x5'),_0x0dbd('0x4'),'NO\x20ANSWER',_0x0dbd('0x4'),_0x0dbd('0x6'),_0x0dbd('0x7'),_0x0dbd('0x5'),'FAILED','FAILED'];var channels={};function writeDB(_0xc73b7d){var _0x2fc70a;if(transfers[_0x0dbd('0x8')][_0xc73b7d['uniqueid']]){_0x2fc70a=_0xc73b7d['uniqueid'];_0xc73b7d[_0x0dbd('0x9')]=transfers['blinds'][_0xc73b7d[_0x0dbd('0x9')]][_0x0dbd('0xa')];}utils[_0x0dbd('0xb')](util['format'](_0x0dbd('0xc'),_0xc73b7d[_0x0dbd('0x9')],_0xc73b7d[_0x0dbd('0xd')],_0xc73b7d[_0x0dbd('0xe')],_0xc73b7d[_0x0dbd('0xf')],_0xc73b7d['interface'],_0xc73b7d[_0x0dbd('0x10')],_0xc73b7d[_0x0dbd('0x11')],_0xc73b7d['lastevent']));if(_0xc73b7d[_0x0dbd('0x12')]){utils[_0x0dbd('0x13')](_0xc73b7d['accountcode'])[_0x0dbd('0x14')](function(_0x54fa13){if(_0x54fa13){_0xc73b7d[_0x0dbd('0x15')]=_0x54fa13['id'];}utils['request']('CreateVoiceCallReport',_0xc73b7d);});}else{utils[_0x0dbd('0x16')]('CreateVoiceCallReport',_0xc73b7d);}if(channels[_0xc73b7d['uniqueid']]){delete channels[_0xc73b7d['uniqueid']];}else if(_0x2fc70a&&channels[_0x2fc70a]){delete transfers[_0x0dbd('0x8')][_0x2fc70a];delete channels[_0x2fc70a];}}exports[_0x0dbd('0x17')]=function(_0x1bf21b){try{utils['debug'](util['format'](_0x0dbd('0x18'),_0x1bf21b[_0x0dbd('0x9')]),_0x1bf21b);if(_0x1bf21b['uniqueid']==_0x1bf21b['linkedid']&&_0x1bf21b[_0x0dbd('0xd')]!=_0x0dbd('0x19')){utils[_0x0dbd('0xb')](util[_0x0dbd('0x1a')](_0x0dbd('0x1b'),_0x1bf21b[_0x0dbd('0x9')],_0x1bf21b['context'],_0x1bf21b['exten']));channels[_0x1bf21b['uniqueid']]={'uniqueid':_0x1bf21b[_0x0dbd('0x9')],'accountcode':_0x1bf21b[_0x0dbd('0x12')],'source':_0x1bf21b[_0x0dbd('0x10')],'destination':_0x1bf21b[_0x0dbd('0x1c')],'destinationcontext':_0x1bf21b['context'],'channel':_0x1bf21b[_0x0dbd('0xd')],'starttime':utils[_0x0dbd('0x1d')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x0dbd('0x4'),'amaflags':_0x0dbd('0x1e')};}}catch(_0x5e2775){utils['error'](util['format'](_0x0dbd('0x18'),_0x1bf21b['uniqueid']),_0x5e2775);}};exports[_0x0dbd('0x1f')]=function(_0x2ae441){try{utils[_0x0dbd('0x20')](util[_0x0dbd('0x1a')](_0x0dbd('0x21'),_0x2ae441['uniqueid']),_0x2ae441);if(!_['isNil'](channels[_0x2ae441[_0x0dbd('0x9')]])&&_0x2ae441[_0x0dbd('0x22')]==0x6){utils[_0x0dbd('0xb')](util[_0x0dbd('0x1a')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x2ae441['uniqueid'],_0x2ae441[_0x0dbd('0x23')],_0x2ae441[_0x0dbd('0xd')]));if(_[_0x0dbd('0x24')](channels[_0x2ae441['uniqueid']][_0x0dbd('0x25')])){channels[_0x2ae441['uniqueid']][_0x0dbd('0x25')]=utils[_0x0dbd('0x1d')]();}}else if(!_[_0x0dbd('0x24')](channels[_0x2ae441[_0x0dbd('0x26')]])&&_0x2ae441[_0x0dbd('0x22')]==0x6&&_0x2ae441['context']!=_0x0dbd('0x27')){utils['info'](util['format'](_0x0dbd('0x28'),_0x2ae441['uniqueid'],_0x2ae441[_0x0dbd('0x26')],_0x2ae441[_0x0dbd('0x23')],_0x2ae441[_0x0dbd('0xd')]));channels[_0x2ae441[_0x0dbd('0x26')]][_0x0dbd('0x12')]=_0x2ae441[_0x0dbd('0x12')];channels[_0x2ae441[_0x0dbd('0x26')]][_0x0dbd('0x29')]=_0x2ae441[_0x0dbd('0xd')];if(_['isNil'](channels[_0x2ae441['linkedid']]['answertime'])){channels[_0x2ae441['linkedid']]['answertime']=utils[_0x0dbd('0x1d')]();}channels[_0x2ae441[_0x0dbd('0x26')]][_0x0dbd('0x2a')]=dispositions[_[_0x0dbd('0x2b')](_0x2ae441[_0x0dbd('0x22')])]||'ANSWERED';}}catch(_0x4c4a89){utils['error'](util['format'](_0x0dbd('0x21'),_0x2ae441[_0x0dbd('0x9')]),_0x4c4a89);}};exports[_0x0dbd('0x2c')]=function(_0x122dd5){try{if(!_[_0x0dbd('0x24')](channels[_0x122dd5[_0x0dbd('0x9')]])){utils[_0x0dbd('0x20')](util['format'](_0x0dbd('0x2d'),_0x122dd5[_0x0dbd('0x9')]),_0x122dd5);if(_['isNil'](channels[_0x122dd5[_0x0dbd('0x9')]][_0x0dbd('0x2e')])){channels[_0x122dd5[_0x0dbd('0x9')]][_0x0dbd('0x2e')]=_0x122dd5[_0x0dbd('0x2f')]+'\x20<'+_0x122dd5[_0x0dbd('0x10')]+'>';}utils[_0x0dbd('0xb')](util['format'](_0x0dbd('0x30'),_0x122dd5[_0x0dbd('0x9')],channels[_0x122dd5[_0x0dbd('0x9')]][_0x0dbd('0x2e')],_0x122dd5['cause-txt']));channels[_0x122dd5[_0x0dbd('0x9')]][_0x0dbd('0x31')]=utils[_0x0dbd('0x1d')]();channels[_0x122dd5['uniqueid']][_0x0dbd('0x32')]=utils['diffTime'](channels[_0x122dd5[_0x0dbd('0x9')]]['endtime'],channels[_0x122dd5[_0x0dbd('0x9')]][_0x0dbd('0x33')]);channels[_0x122dd5[_0x0dbd('0x9')]][_0x0dbd('0x34')]=channels[_0x122dd5[_0x0dbd('0x9')]][_0x0dbd('0x35')]?utils[_0x0dbd('0x36')](channels[_0x122dd5[_0x0dbd('0x9')]]['endtime'],channels[_0x122dd5[_0x0dbd('0x9')]][_0x0dbd('0x35')]):0x0;writeDB(channels[_0x122dd5[_0x0dbd('0x9')]]);}}catch(_0x1a0c28){utils['error'](util[_0x0dbd('0x1a')](_0x0dbd('0x2d'),_0x122dd5[_0x0dbd('0x9')]),_0x1a0c28);}};exports['attendedtransfer']=function(_0x560943){try{if(!_[_0x0dbd('0x24')](channels[_0x560943['localtwolinkedid']])){utils[_0x0dbd('0x20')](util[_0x0dbd('0x1a')]('[%s][calls][attendedtransfer]',_0x560943[_0x0dbd('0x37')]),_0x560943);if(channels[_0x560943[_0x0dbd('0x38')]][_0x0dbd('0xd')]==_0x560943[_0x0dbd('0x39')]){utils[_0x0dbd('0xb')](util[_0x0dbd('0x1a')](_0x0dbd('0x3a'),_0x560943[_0x0dbd('0x37')],_0x560943['localtwolinkedid'],_0x560943['secondtransfererchannel']));channels[_0x560943[_0x0dbd('0x38')]]['destinationchannel']=_0x560943['secondtransfererchannel'];channels[_0x560943[_0x0dbd('0x38')]][_0x0dbd('0x3b')]='_attended';}else if(channels[_0x560943['localtwolinkedid']][_0x0dbd('0xd')]=_0x560943['transfertargetchannel']){utils['info'](util['format'](_0x0dbd('0x3a'),_0x560943[_0x0dbd('0x37')],_0x560943[_0x0dbd('0x38')],_0x560943[_0x0dbd('0x3c')]));channels[_0x560943[_0x0dbd('0x38')]]['destinationchannel']=_0x560943['origtransfererchannel'];channels[_0x560943[_0x0dbd('0x38')]][_0x0dbd('0x3b')]=_0x0dbd('0x3d');}}}catch(_0x503d34){utils[_0x0dbd('0x3e')](util[_0x0dbd('0x1a')](_0x0dbd('0x3f'),_0x560943[_0x0dbd('0x37')]),_0x503d34);}};exports[_0x0dbd('0x40')]=function(_0x1270e2){try{if(!_[_0x0dbd('0x24')](channels[_0x1270e2['uniqueid']])){utils[_0x0dbd('0x20')](util[_0x0dbd('0x1a')](_0x0dbd('0x41'),_0x1270e2[_0x0dbd('0x9')]),_0x1270e2);channels[_0x1270e2['uniqueid']]['musiconholdstartAt']=utils[_0x0dbd('0x1d')]();utils['info'](util[_0x0dbd('0x1a')](_0x0dbd('0x42'),_0x1270e2[_0x0dbd('0x9')],channels[_0x1270e2[_0x0dbd('0x9')]][_0x0dbd('0x43')]));}}catch(_0x46ba31){utils[_0x0dbd('0x3e')](util[_0x0dbd('0x1a')]('[%s][calls][musiconholdstart]',_0x1270e2['uniqueid']),_0x46ba31);}};exports[_0x0dbd('0x44')]=function(_0x31cef4){try{if(!_['isNil'](channels[_0x31cef4[_0x0dbd('0x9')]])){utils[_0x0dbd('0x20')](util[_0x0dbd('0x1a')](_0x0dbd('0x45'),_0x31cef4[_0x0dbd('0x9')]),_0x31cef4);if(!_['isNil'](channels[_0x31cef4[_0x0dbd('0x9')]][_0x0dbd('0x43')])){channels[_0x31cef4[_0x0dbd('0x9')]][_0x0dbd('0x46')]+=utils[_0x0dbd('0x36')](utils[_0x0dbd('0x1d')](),channels[_0x31cef4[_0x0dbd('0x9')]][_0x0dbd('0x43')]);utils['info'](util[_0x0dbd('0x1a')](_0x0dbd('0x47'),_0x31cef4[_0x0dbd('0x9')],channels[_0x31cef4['uniqueid']]['mohtime']));delete channels[_0x31cef4[_0x0dbd('0x9')]][_0x0dbd('0x43')];}}}catch(_0x1d8ed0){utils[_0x0dbd('0x3e')](util['format']('[%s][calls][musiconholdstop]',_0x31cef4[_0x0dbd('0x9')]),_0x1d8ed0);}};exports[_0x0dbd('0x48')]=function(_0x3af29c){try{if(!_[_0x0dbd('0x24')](channels[_0x3af29c[_0x0dbd('0x9')]])){utils['debug'](util[_0x0dbd('0x1a')](_0x0dbd('0x49'),_0x3af29c[_0x0dbd('0x9')]),_0x3af29c);if(!_['isNil'](_0x3af29c['variable'][_0x0dbd('0x4a')])){utils['info'](util['format']('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x3af29c[_0x0dbd('0x9')],_0x3af29c[_0x0dbd('0x4b')]));channels[_0x3af29c[_0x0dbd('0x9')]][_0x0dbd('0x4c')]=_0x3af29c[_0x0dbd('0x4b')];}if(!_[_0x0dbd('0x24')](_0x3af29c[_0x0dbd('0x4d')]['xmd-phone'])){utils[_0x0dbd('0xb')](util[_0x0dbd('0x1a')](_0x0dbd('0x4e'),_0x3af29c[_0x0dbd('0x9')],_0x3af29c['value']));channels[_0x3af29c[_0x0dbd('0x9')]][_0x0dbd('0x4f')]=_0x3af29c[_0x0dbd('0x4b')];channels[_0x3af29c['uniqueid']][_0x0dbd('0x2e')]='\x22'+_0x3af29c[_0x0dbd('0x4b')]+'\x22\x20<'+_0x3af29c['value']+'>';}if(!_[_0x0dbd('0x24')](_0x3af29c[_0x0dbd('0x4d')][_0x0dbd('0x50')])||!_[_0x0dbd('0x24')](_0x3af29c[_0x0dbd('0x4d')]['xmd-callerid'])){utils[_0x0dbd('0xb')](util[_0x0dbd('0x1a')](_0x0dbd('0x51'),_0x3af29c[_0x0dbd('0x9')],!_[_0x0dbd('0x24')](_0x3af29c[_0x0dbd('0x4d')][_0x0dbd('0x50')])?'xmd-callerid-preview':_0x0dbd('0x52'),_0x3af29c[_0x0dbd('0x4b')]));channels[_0x3af29c[_0x0dbd('0x9')]][_0x0dbd('0x2e')]=_0x3af29c[_0x0dbd('0x4b')];}if(!_[_0x0dbd('0x24')](_0x3af29c[_0x0dbd('0x4d')][_0x0dbd('0x53')])||!_['isNil'](_0x3af29c[_0x0dbd('0x4d')][_0x0dbd('0x54')])){utils['info'](util[_0x0dbd('0x1a')](_0x0dbd('0x51'),_0x3af29c[_0x0dbd('0x9')],!_[_0x0dbd('0x24')](_0x3af29c['variable'][_0x0dbd('0x53')])?_0x0dbd('0x53'):_0x0dbd('0x54'),_0x3af29c[_0x0dbd('0x4b')]));channels[_0x3af29c[_0x0dbd('0x9')]][_0x0dbd('0x55')]=_0x0dbd('0x56');channels[_0x3af29c['uniqueid']][_0x0dbd('0x57')]=_0x3af29c[_0x0dbd('0x4b')];channels[_0x3af29c[_0x0dbd('0x9')]]['queue']=!![];}if(!_['isNil'](_0x3af29c[_0x0dbd('0x4d')]['xmd-contactid'])){utils[_0x0dbd('0xb')](util['format']('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x3af29c[_0x0dbd('0x9')],_0x3af29c[_0x0dbd('0x4b')]));channels[_0x3af29c[_0x0dbd('0x9')]][_0x0dbd('0x58')]=_0x3af29c[_0x0dbd('0x4b')];}if(!_[_0x0dbd('0x24')](_0x3af29c['variable'][_0x0dbd('0x59')])){utils[_0x0dbd('0xb')](util[_0x0dbd('0x1a')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x3af29c[_0x0dbd('0x9')],_0x3af29c[_0x0dbd('0x4b')]));channels[_0x3af29c[_0x0dbd('0x9')]][_0x0dbd('0x5a')]=_0x3af29c[_0x0dbd('0x4b')];}if(!_[_0x0dbd('0x24')](_0x3af29c[_0x0dbd('0x4d')][_0x0dbd('0x5b')])){utils['info'](util[_0x0dbd('0x1a')](_0x0dbd('0x5c'),_0x3af29c['uniqueid'],_0x3af29c[_0x0dbd('0x4b')]));channels[_0x3af29c[_0x0dbd('0x9')]][_0x0dbd('0x5d')]=_0x3af29c['value'];}if(!_[_0x0dbd('0x24')](_0x3af29c[_0x0dbd('0x4d')][_0x0dbd('0x5e')])){utils[_0x0dbd('0xb')](util['format'](_0x0dbd('0x5f'),_0x3af29c[_0x0dbd('0x9')],_0x3af29c['value']));channels[_0x3af29c['uniqueid']][_0x0dbd('0x5e')]=_0x3af29c[_0x0dbd('0x4b')];}}}catch(_0x34df95){utils['error'](util[_0x0dbd('0x1a')]('[%s][calls][varset]',_0x3af29c['uniqueid']),_0x34df95);}};exports[_0x0dbd('0x60')]=function(_0x1450d4){try{if(!_['isNil'](channels[_0x1450d4[_0x0dbd('0x9')]])){utils['debug'](util[_0x0dbd('0x1a')](_0x0dbd('0x61'),_0x1450d4['uniqueid']),_0x1450d4);utils[_0x0dbd('0xb')](util[_0x0dbd('0x1a')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x1450d4['uniqueid'],_0x1450d4[_0x0dbd('0x62')],_0x1450d4['appdata']));if(_0x1450d4['application'][_0x0dbd('0x63')]()==_0x0dbd('0x64')&&_[_0x0dbd('0x65')](_0x1450d4['appdata']['toLowerCase'](),_0x0dbd('0x66'))){var _0x566042=_0x1450d4[_0x0dbd('0x67')][_0x0dbd('0x68')]('=');var _0x1b5b74=_0x566042[0x0]['substring'](_0x566042[0x0][_0x0dbd('0x69')]('(')+0x1,_0x566042[0x0][_0x0dbd('0x69')](')'));var _0x2f2e49=_0x566042[0x1];channels[_0x1450d4['uniqueid']][_0x1b5b74]=_0x2f2e49;}if(!_[_0x0dbd('0x6a')]([_0x0dbd('0x2c'),_0x0dbd('0x6b'),_0x0dbd('0x6c'),_0x0dbd('0x64'),_0x0dbd('0x6d')],_0x1450d4['application']['toLowerCase']())){channels[_0x1450d4[_0x0dbd('0x9')]][_0x0dbd('0x55')]=_0x1450d4[_0x0dbd('0x62')];channels[_0x1450d4[_0x0dbd('0x9')]]['lastdata']=_0x1450d4[_0x0dbd('0x67')];}}}catch(_0x483b7c){utils[_0x0dbd('0x3e')](util[_0x0dbd('0x1a')](_0x0dbd('0x61'),_0x1450d4['uniqueid']),_0x483b7c);}}; \ No newline at end of file +var _0xd7ca=['_attended','transfertargetchannel','origtransfererchannel','userfield','[%s][calls][attendedtransfer]','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','musiconholdstartAt','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','variable','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','destination','\x22\x20<','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid','xmcs-queue','xmd-queue','lastapplication','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][varset]','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','set','startsWith','appdata','cdr','split','substring','lastIndexOf','includes','noop','toLowerCase','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','ANSWERED','BUSY','FAILED','blinds','uniqueid','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','queue','interface','calleridnum','connectedlinenum','lastevent','accountcode','UserId','request','CreateVoiceCallReport','newchannel','debug','linkedid','channel','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','now','DOCUMENTATION','error','[%s][calls][newchannel]','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','hangup','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','billableseconds','[%s][calls][hangup]','attendedtransfer','origtransfereruniqueid','localtwolinkedid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel'];(function(_0x616290,_0x280b7f){var _0x453879=function(_0x27bda7){while(--_0x27bda7){_0x616290['push'](_0x616290['shift']());}};_0x453879(++_0x280b7f);}(_0xd7ca,0x181));var _0xad7c=function(_0xe45962,_0x18099c){_0xe45962=_0xe45962-0x0;var _0xeaae98=_0xd7ca[_0xe45962];return _0xeaae98;};'use strict';var _=require(_0xad7c('0x0'));var util=require(_0xad7c('0x1'));var utils=require(_0xad7c('0x2'));var transfers=require(_0xad7c('0x3'));var dispositions=[_0xad7c('0x4'),'FAILED','FAILED',_0xad7c('0x4'),_0xad7c('0x4'),_0xad7c('0x4'),_0xad7c('0x5'),_0xad7c('0x6'),_0xad7c('0x7'),_0xad7c('0x7'),_0xad7c('0x7')];var channels={};function writeDB(_0x2095b4){var _0x47bb02;if(transfers[_0xad7c('0x8')][_0x2095b4[_0xad7c('0x9')]]){_0x47bb02=_0x2095b4[_0xad7c('0x9')];_0x2095b4[_0xad7c('0x9')]=transfers['blinds'][_0x2095b4[_0xad7c('0x9')]][_0xad7c('0xa')];}utils[_0xad7c('0xb')](util[_0xad7c('0xc')](_0xad7c('0xd'),_0x2095b4['uniqueid'],_0x2095b4['channel'],_0x2095b4[_0xad7c('0xe')],_0x2095b4['membername'],_0x2095b4[_0xad7c('0xf')],_0x2095b4[_0xad7c('0x10')],_0x2095b4[_0xad7c('0x11')],_0x2095b4[_0xad7c('0x12')]));if(_0x2095b4[_0xad7c('0x13')]){utils['getUserByInternal'](_0x2095b4[_0xad7c('0x13')])['then'](function(_0x5d38df){if(_0x5d38df){_0x2095b4[_0xad7c('0x14')]=_0x5d38df['id'];}utils[_0xad7c('0x15')](_0xad7c('0x16'),_0x2095b4);});}else{utils[_0xad7c('0x15')](_0xad7c('0x16'),_0x2095b4);}if(channels[_0x2095b4['uniqueid']]){delete channels[_0x2095b4['uniqueid']];}else if(_0x47bb02&&channels[_0x47bb02]){delete transfers['blinds'][_0x47bb02];delete channels[_0x47bb02];}}exports[_0xad7c('0x17')]=function(_0x500b6f){try{utils[_0xad7c('0x18')](util[_0xad7c('0xc')]('[%s][calls][newchannel]',_0x500b6f['uniqueid']),_0x500b6f);if(_0x500b6f[_0xad7c('0x9')]==_0x500b6f[_0xad7c('0x19')]&&_0x500b6f[_0xad7c('0x1a')]!=_0xad7c('0x1b')){utils[_0xad7c('0xb')](util[_0xad7c('0xc')](_0xad7c('0x1c'),_0x500b6f[_0xad7c('0x9')],_0x500b6f[_0xad7c('0x1d')],_0x500b6f['exten']));channels[_0x500b6f[_0xad7c('0x9')]]={'uniqueid':_0x500b6f['uniqueid'],'accountcode':_0x500b6f[_0xad7c('0x13')],'source':_0x500b6f[_0xad7c('0x10')],'destination':_0x500b6f['exten'],'destinationcontext':_0x500b6f[_0xad7c('0x1d')],'channel':_0x500b6f['channel'],'starttime':utils[_0xad7c('0x1e')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0xad7c('0x1f')};}}catch(_0xae8ce){utils[_0xad7c('0x20')](util[_0xad7c('0xc')](_0xad7c('0x21'),_0x500b6f[_0xad7c('0x9')]),_0xae8ce);}};exports['newstate']=function(_0x4fb03c){try{utils[_0xad7c('0x18')](util[_0xad7c('0xc')](_0xad7c('0x22'),_0x4fb03c[_0xad7c('0x9')]),_0x4fb03c);if(!_[_0xad7c('0x23')](channels[_0x4fb03c[_0xad7c('0x9')]])&&_0x4fb03c[_0xad7c('0x24')]==0x6){utils[_0xad7c('0xb')](util[_0xad7c('0xc')](_0xad7c('0x25'),_0x4fb03c[_0xad7c('0x9')],_0x4fb03c[_0xad7c('0x1d')],_0x4fb03c[_0xad7c('0x1a')]));if(_[_0xad7c('0x23')](channels[_0x4fb03c[_0xad7c('0x9')]][_0xad7c('0x26')])){channels[_0x4fb03c[_0xad7c('0x9')]][_0xad7c('0x26')]=utils[_0xad7c('0x1e')]();}}else if(!_['isNil'](channels[_0x4fb03c[_0xad7c('0x19')]])&&_0x4fb03c[_0xad7c('0x24')]==0x6&&_0x4fb03c[_0xad7c('0x1d')]!=_0xad7c('0x27')){utils[_0xad7c('0xb')](util['format'](_0xad7c('0x28'),_0x4fb03c[_0xad7c('0x9')],_0x4fb03c['linkedid'],_0x4fb03c['context'],_0x4fb03c[_0xad7c('0x1a')]));channels[_0x4fb03c['linkedid']][_0xad7c('0x13')]=_0x4fb03c[_0xad7c('0x13')];channels[_0x4fb03c[_0xad7c('0x19')]][_0xad7c('0x29')]=_0x4fb03c[_0xad7c('0x1a')];if(_[_0xad7c('0x23')](channels[_0x4fb03c[_0xad7c('0x19')]][_0xad7c('0x2a')])){channels[_0x4fb03c[_0xad7c('0x19')]][_0xad7c('0x2a')]=utils[_0xad7c('0x1e')]();}channels[_0x4fb03c[_0xad7c('0x19')]]['disposition']=dispositions[_['toNumber'](_0x4fb03c[_0xad7c('0x24')])]||'ANSWERED';}}catch(_0x39a24a){utils['error'](util[_0xad7c('0xc')](_0xad7c('0x22'),_0x4fb03c[_0xad7c('0x9')]),_0x39a24a);}};exports[_0xad7c('0x2b')]=function(_0x59c250){try{if(!_['isNil'](channels[_0x59c250[_0xad7c('0x9')]])){utils[_0xad7c('0x18')](util[_0xad7c('0xc')]('[%s][calls][hangup]',_0x59c250['uniqueid']),_0x59c250);if(_[_0xad7c('0x23')](channels[_0x59c250[_0xad7c('0x9')]][_0xad7c('0x2c')])){channels[_0x59c250[_0xad7c('0x9')]][_0xad7c('0x2c')]=_0x59c250[_0xad7c('0x2d')]+'\x20<'+_0x59c250[_0xad7c('0x10')]+'>';}utils[_0xad7c('0xb')](util[_0xad7c('0xc')](_0xad7c('0x2e'),_0x59c250['uniqueid'],channels[_0x59c250['uniqueid']]['callerid'],_0x59c250[_0xad7c('0x2f')]));channels[_0x59c250[_0xad7c('0x9')]][_0xad7c('0x30')]=utils[_0xad7c('0x1e')]();channels[_0x59c250[_0xad7c('0x9')]][_0xad7c('0x31')]=utils[_0xad7c('0x32')](channels[_0x59c250['uniqueid']][_0xad7c('0x30')],channels[_0x59c250['uniqueid']][_0xad7c('0x33')]);channels[_0x59c250['uniqueid']][_0xad7c('0x34')]=channels[_0x59c250['uniqueid']]['answertime']?utils[_0xad7c('0x32')](channels[_0x59c250[_0xad7c('0x9')]][_0xad7c('0x30')],channels[_0x59c250[_0xad7c('0x9')]][_0xad7c('0x2a')]):0x0;writeDB(channels[_0x59c250[_0xad7c('0x9')]]);}}catch(_0x3b8999){utils[_0xad7c('0x20')](util[_0xad7c('0xc')](_0xad7c('0x35'),_0x59c250['uniqueid']),_0x3b8999);}};exports[_0xad7c('0x36')]=function(_0x4f0c40){try{if(!_[_0xad7c('0x23')](channels[_0x4f0c40['localtwolinkedid']])){utils[_0xad7c('0x18')](util['format']('[%s][calls][attendedtransfer]',_0x4f0c40[_0xad7c('0x37')]),_0x4f0c40);if(channels[_0x4f0c40[_0xad7c('0x38')]][_0xad7c('0x1a')]==_0x4f0c40['transfereechannel']){utils[_0xad7c('0xb')](util[_0xad7c('0xc')](_0xad7c('0x39'),_0x4f0c40[_0xad7c('0x37')],_0x4f0c40[_0xad7c('0x38')],_0x4f0c40[_0xad7c('0x3a')]));channels[_0x4f0c40[_0xad7c('0x38')]][_0xad7c('0x29')]=_0x4f0c40[_0xad7c('0x3a')];channels[_0x4f0c40[_0xad7c('0x38')]]['userfield']=_0xad7c('0x3b');}else if(channels[_0x4f0c40[_0xad7c('0x38')]]['channel']=_0x4f0c40[_0xad7c('0x3c')]){utils[_0xad7c('0xb')](util[_0xad7c('0xc')](_0xad7c('0x39'),_0x4f0c40['origtransfereruniqueid'],_0x4f0c40['localtwolinkedid'],_0x4f0c40[_0xad7c('0x3d')]));channels[_0x4f0c40[_0xad7c('0x38')]][_0xad7c('0x29')]=_0x4f0c40[_0xad7c('0x3d')];channels[_0x4f0c40[_0xad7c('0x38')]][_0xad7c('0x3e')]=_0xad7c('0x3b');}}}catch(_0x50f379){utils['error'](util[_0xad7c('0xc')](_0xad7c('0x3f'),_0x4f0c40['origtransfereruniqueid']),_0x50f379);}};exports[_0xad7c('0x40')]=function(_0x133548){try{if(!_[_0xad7c('0x23')](channels[_0x133548[_0xad7c('0x9')]])){utils['debug'](util['format'](_0xad7c('0x41'),_0x133548[_0xad7c('0x9')]),_0x133548);channels[_0x133548['uniqueid']]['musiconholdstartAt']=utils[_0xad7c('0x1e')]();utils[_0xad7c('0xb')](util['format']('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x133548['uniqueid'],channels[_0x133548[_0xad7c('0x9')]]['musiconholdstartAt']));}}catch(_0x289593){utils['error'](util[_0xad7c('0xc')](_0xad7c('0x41'),_0x133548[_0xad7c('0x9')]),_0x289593);}};exports[_0xad7c('0x42')]=function(_0x115bfa){try{if(!_[_0xad7c('0x23')](channels[_0x115bfa[_0xad7c('0x9')]])){utils[_0xad7c('0x18')](util[_0xad7c('0xc')](_0xad7c('0x43'),_0x115bfa[_0xad7c('0x9')]),_0x115bfa);if(!_[_0xad7c('0x23')](channels[_0x115bfa[_0xad7c('0x9')]]['musiconholdstartAt'])){channels[_0x115bfa['uniqueid']][_0xad7c('0x44')]+=utils[_0xad7c('0x32')](utils[_0xad7c('0x1e')](),channels[_0x115bfa['uniqueid']][_0xad7c('0x45')]);utils['info'](util[_0xad7c('0xc')](_0xad7c('0x46'),_0x115bfa[_0xad7c('0x9')],channels[_0x115bfa[_0xad7c('0x9')]][_0xad7c('0x44')]));delete channels[_0x115bfa[_0xad7c('0x9')]][_0xad7c('0x45')];}}}catch(_0x7b1d64){utils['error'](util[_0xad7c('0xc')](_0xad7c('0x43'),_0x115bfa[_0xad7c('0x9')]),_0x7b1d64);}};exports[_0xad7c('0x47')]=function(_0x44bdc4){try{if(!_[_0xad7c('0x23')](channels[_0x44bdc4['uniqueid']])){utils[_0xad7c('0x18')](util[_0xad7c('0xc')]('[%s][calls][varset]',_0x44bdc4[_0xad7c('0x9')]),_0x44bdc4);if(!_[_0xad7c('0x23')](_0x44bdc4[_0xad7c('0x48')]['xmd-originatecalleridnum'])){utils[_0xad7c('0xb')](util[_0xad7c('0xc')](_0xad7c('0x49'),_0x44bdc4[_0xad7c('0x9')],_0x44bdc4[_0xad7c('0x4a')]));channels[_0x44bdc4[_0xad7c('0x9')]][_0xad7c('0x4b')]=_0x44bdc4[_0xad7c('0x4a')];}if(!_[_0xad7c('0x23')](_0x44bdc4[_0xad7c('0x48')][_0xad7c('0x4c')])){utils[_0xad7c('0xb')](util[_0xad7c('0xc')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x44bdc4[_0xad7c('0x9')],_0x44bdc4['value']));channels[_0x44bdc4[_0xad7c('0x9')]][_0xad7c('0x4d')]=_0x44bdc4[_0xad7c('0x4a')];channels[_0x44bdc4[_0xad7c('0x9')]]['callerid']='\x22'+_0x44bdc4[_0xad7c('0x4a')]+_0xad7c('0x4e')+_0x44bdc4[_0xad7c('0x4a')]+'>';}if(!_[_0xad7c('0x23')](_0x44bdc4[_0xad7c('0x48')][_0xad7c('0x4f')])||!_[_0xad7c('0x23')](_0x44bdc4['variable']['xmd-callerid'])){utils[_0xad7c('0xb')](util[_0xad7c('0xc')](_0xad7c('0x50'),_0x44bdc4['uniqueid'],!_[_0xad7c('0x23')](_0x44bdc4[_0xad7c('0x48')][_0xad7c('0x4f')])?_0xad7c('0x4f'):_0xad7c('0x51'),_0x44bdc4['value']));channels[_0x44bdc4[_0xad7c('0x9')]][_0xad7c('0x2c')]=_0x44bdc4[_0xad7c('0x4a')];}if(!_[_0xad7c('0x23')](_0x44bdc4[_0xad7c('0x48')]['xmd-queue'])||!_['isNil'](_0x44bdc4[_0xad7c('0x48')][_0xad7c('0x52')])){utils[_0xad7c('0xb')](util['format'](_0xad7c('0x50'),_0x44bdc4[_0xad7c('0x9')],!_[_0xad7c('0x23')](_0x44bdc4[_0xad7c('0x48')][_0xad7c('0x53')])?'xmd-queue':_0xad7c('0x52'),_0x44bdc4['value']));channels[_0x44bdc4[_0xad7c('0x9')]][_0xad7c('0x54')]='Queue';channels[_0x44bdc4[_0xad7c('0x9')]][_0xad7c('0x55')]=_0x44bdc4['value'];channels[_0x44bdc4[_0xad7c('0x9')]][_0xad7c('0xe')]=!![];}if(!_['isNil'](_0x44bdc4[_0xad7c('0x48')][_0xad7c('0x56')])){utils[_0xad7c('0xb')](util[_0xad7c('0xc')](_0xad7c('0x57'),_0x44bdc4[_0xad7c('0x9')],_0x44bdc4[_0xad7c('0x4a')]));channels[_0x44bdc4[_0xad7c('0x9')]][_0xad7c('0x58')]=_0x44bdc4[_0xad7c('0x4a')];}if(!_[_0xad7c('0x23')](_0x44bdc4[_0xad7c('0x48')][_0xad7c('0x59')])){utils['info'](util['format']('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x44bdc4['uniqueid'],_0x44bdc4[_0xad7c('0x4a')]));channels[_0x44bdc4[_0xad7c('0x9')]][_0xad7c('0x5a')]=_0x44bdc4[_0xad7c('0x4a')];}if(!_[_0xad7c('0x23')](_0x44bdc4[_0xad7c('0x48')][_0xad7c('0x5b')])){utils[_0xad7c('0xb')](util[_0xad7c('0xc')](_0xad7c('0x5c'),_0x44bdc4[_0xad7c('0x9')],_0x44bdc4[_0xad7c('0x4a')]));channels[_0x44bdc4[_0xad7c('0x9')]][_0xad7c('0x5d')]=_0x44bdc4[_0xad7c('0x4a')];}if(!_['isNil'](_0x44bdc4[_0xad7c('0x48')][_0xad7c('0x5e')])){utils[_0xad7c('0xb')](util[_0xad7c('0xc')](_0xad7c('0x5f'),_0x44bdc4[_0xad7c('0x9')],_0x44bdc4[_0xad7c('0x4a')]));channels[_0x44bdc4[_0xad7c('0x9')]][_0xad7c('0x5e')]=_0x44bdc4[_0xad7c('0x4a')];}}}catch(_0xd62bee){utils[_0xad7c('0x20')](util[_0xad7c('0xc')](_0xad7c('0x60'),_0x44bdc4['uniqueid']),_0xd62bee);}};exports[_0xad7c('0x61')]=function(_0x59a323){try{if(!_[_0xad7c('0x23')](channels[_0x59a323[_0xad7c('0x9')]])){utils['debug'](util[_0xad7c('0xc')](_0xad7c('0x62'),_0x59a323[_0xad7c('0x9')]),_0x59a323);utils[_0xad7c('0xb')](util[_0xad7c('0xc')](_0xad7c('0x63'),_0x59a323['uniqueid'],_0x59a323['application'],_0x59a323['appdata']));if(_0x59a323[_0xad7c('0x64')]['toLowerCase']()==_0xad7c('0x65')&&_[_0xad7c('0x66')](_0x59a323[_0xad7c('0x67')]['toLowerCase'](),_0xad7c('0x68'))){var _0x54a091=_0x59a323['appdata'][_0xad7c('0x69')]('=');var _0xfbd0e5=_0x54a091[0x0][_0xad7c('0x6a')](_0x54a091[0x0][_0xad7c('0x6b')]('(')+0x1,_0x54a091[0x0][_0xad7c('0x6b')](')'));var _0x58f315=_0x54a091[0x1];channels[_0x59a323[_0xad7c('0x9')]][_0xfbd0e5]=_0x58f315;}if(!_[_0xad7c('0x6c')]([_0xad7c('0x2b'),_0xad7c('0x6d'),'execif','set','gotoif'],_0x59a323[_0xad7c('0x64')][_0xad7c('0x6e')]())){channels[_0x59a323[_0xad7c('0x9')]][_0xad7c('0x54')]=_0x59a323['application'];channels[_0x59a323[_0xad7c('0x9')]][_0xad7c('0x55')]=_0x59a323['appdata'];}}}catch(_0x42d418){utils['error'](util['format'](_0xad7c('0x62'),_0x59a323[_0xad7c('0x9')]),_0x42d418);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 0376fa5..04bfbe8 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 _0xb448=['close','[core]\x20close','./utils','connect','shutdown','info','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb448,0x18e));var _0x8b44=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0xb448[_0x42bdad];return _0x122626;};'use strict';var utils=require(_0x8b44('0x0'));exports[_0x8b44('0x1')]=function(){utils['info']('[core]\x20connected');};exports[_0x8b44('0x2')]=function(){utils[_0x8b44('0x3')](_0x8b44('0x4'));};exports[_0x8b44('0x5')]=function(){utils[_0x8b44('0x3')](_0x8b44('0x6'));};exports[_0x8b44('0x7')]=function(_0x447507){utils[_0x8b44('0x7')](_0x8b44('0x8'),_0x447507);};exports[_0x8b44('0x9')]=function(){utils[_0x8b44('0x3')](_0x8b44('0xa'));};exports['managerevent']=function(_0xdb1c78){}; \ No newline at end of file +var _0xc4b9=['shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','[core]\x20close','managerevent','./utils','connect','info','[core]\x20connected'];(function(_0x25db57,_0x9123bc){var _0x144de9=function(_0x1aad43){while(--_0x1aad43){_0x25db57['push'](_0x25db57['shift']());}};_0x144de9(++_0x9123bc);}(_0xc4b9,0x74));var _0x9c4b=function(_0x4624dc,_0x2d47e2){_0x4624dc=_0x4624dc-0x0;var _0x230719=_0xc4b9[_0x4624dc];return _0x230719;};'use strict';var utils=require(_0x9c4b('0x0'));exports[_0x9c4b('0x1')]=function(){utils[_0x9c4b('0x2')](_0x9c4b('0x3'));};exports[_0x9c4b('0x4')]=function(){utils[_0x9c4b('0x2')](_0x9c4b('0x5'));};exports[_0x9c4b('0x6')]=function(){utils['info'](_0x9c4b('0x7'));};exports['error']=function(_0xea31ec){utils[_0x9c4b('0x8')](_0x9c4b('0x9'),_0xea31ec);};exports['close']=function(){utils[_0x9c4b('0x2')](_0x9c4b('0xa'));};exports[_0x9c4b('0xb')]=function(_0x35126e){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 5961026..c99034c 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 _0xf504=['[%s][dials][newexten]','info','format','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata','cdr(routeid)','error','varset','[%s][dials][varset]','isNil','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','called','dialend','[%s][dials][dialend]','ANSWER','lastevent','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','answertime','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','duration','diffTime','endtime','holdtime','billableseconds','lodash','util','./utils','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','uniqueid','newexten','debug'];(function(_0x1c1be8,_0x35ea23){var _0x164c13=function(_0x471478){while(--_0x471478){_0x1c1be8['push'](_0x1c1be8['shift']());}};_0x164c13(++_0x35ea23);}(_0xf504,0x8b));var _0x4f50=function(_0x2c3159,_0x433a01){_0x2c3159=_0x2c3159-0x0;var _0x37b935=_0xf504[_0x2c3159];return _0x37b935;};'use strict';var _=require(_0x4f50('0x0'));var util=require(_0x4f50('0x1'));var utils=require(_0x4f50('0x2'));var dials={};function writeDB(_0x17aa78){utils['info'](util['format'](_0x4f50('0x3'),_0x17aa78['uniqueid'],_0x17aa78[_0x4f50('0x4')],_0x17aa78[_0x4f50('0x5')],_0x17aa78[_0x4f50('0x6')],_0x17aa78[_0x4f50('0x7')],_0x17aa78[_0x4f50('0x8')]));utils[_0x4f50('0x9')](_0x4f50('0xa'),_0x17aa78);delete dials[_0x17aa78[_0x4f50('0xb')]];}exports[_0x4f50('0xc')]=function(_0x39c1e7){try{utils[_0x4f50('0xd')](util['format'](_0x4f50('0xe'),_0x39c1e7[_0x4f50('0xb')]),_0x39c1e7);utils[_0x4f50('0xf')](util[_0x4f50('0x10')](_0x4f50('0x11'),_0x39c1e7[_0x4f50('0xb')],_0x39c1e7[_0x4f50('0x12')],_0x39c1e7['appdata']));if(_0x39c1e7[_0x4f50('0x12')][_0x4f50('0x13')]()==_0x4f50('0x14')&&_[_0x4f50('0x15')](_0x39c1e7[_0x4f50('0x16')][_0x4f50('0x13')](),_0x4f50('0x17'))){var _0x3f314e=_0x39c1e7['appdata']['split']('=');dials[_0x39c1e7['uniqueid']]={'routeId':_0x3f314e[0x1]};}}catch(_0x1e49ca){utils[_0x4f50('0x18')](util[_0x4f50('0x10')]('[%s][dials][newexten]',_0x39c1e7[_0x4f50('0xb')]),_0x1e49ca);}};exports[_0x4f50('0x19')]=function(_0x47ab10){try{utils['debug'](util[_0x4f50('0x10')](_0x4f50('0x1a'),_0x47ab10['uniqueid']),_0x47ab10);if(!_[_0x4f50('0x1b')](_0x47ab10['variable'][_0x4f50('0x1c')])){utils[_0x4f50('0xf')](util[_0x4f50('0x10')](_0x4f50('0x1d'),_0x47ab10['uniqueid'],_0x47ab10[_0x4f50('0x1e')]));dials[_0x47ab10['uniqueid']]={'routeId':_0x47ab10['value']};}}catch(_0x3c74e8){utils[_0x4f50('0x18')](util['format'](_0x4f50('0x1a'),_0x47ab10['uniqueid']),_0x3c74e8);}};exports[_0x4f50('0x1f')]=function(_0x4ef852){try{if(!_['isNil'](dials[_0x4ef852[_0x4f50('0xb')]])){utils[_0x4f50('0xd')](util[_0x4f50('0x10')](_0x4f50('0x20'),_0x4ef852[_0x4f50('0xb')]),_0x4ef852);dials[_0x4ef852[_0x4f50('0xb')]]=_[_0x4f50('0x21')](dials[_0x4ef852['uniqueid']],_0x4ef852);dials[_0x4ef852[_0x4f50('0xb')]][_0x4f50('0x22')]=utils['now']();dials[_0x4ef852[_0x4f50('0xb')]]['lastevent']=_0x4f50('0x23');utils[_0x4f50('0xf')](util[_0x4f50('0x10')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x4ef852[_0x4f50('0xb')],dials[_0x4ef852[_0x4f50('0xb')]]['starttime']));}}catch(_0x51483e){utils['error'](util[_0x4f50('0x10')](_0x4f50('0x20'),_0x4ef852[_0x4f50('0xb')]),_0x51483e);}};exports[_0x4f50('0x24')]=function(_0x5d27b4){try{if(!_[_0x4f50('0x1b')](dials[_0x5d27b4['uniqueid']])){utils[_0x4f50('0xd')](util[_0x4f50('0x10')](_0x4f50('0x25'),_0x5d27b4[_0x4f50('0xb')]),_0x5d27b4);dials[_0x5d27b4[_0x4f50('0xb')]][_0x4f50('0x8')]=_0x5d27b4['dialstatus'];if(_0x5d27b4[_0x4f50('0x8')]==_0x4f50('0x26')){dials[_0x5d27b4[_0x4f50('0xb')]]=_[_0x4f50('0x21')](dials[_0x5d27b4[_0x4f50('0xb')]],_0x5d27b4);dials[_0x5d27b4[_0x4f50('0xb')]]['answertime']=utils['now']();dials[_0x5d27b4['uniqueid']][_0x4f50('0x27')]='connect';utils[_0x4f50('0xf')](util[_0x4f50('0x10')](_0x4f50('0x28'),_0x5d27b4['uniqueid'],_0x5d27b4[_0x4f50('0x8')],dials[_0x5d27b4['uniqueid']][_0x4f50('0x29')]));}else{utils[_0x4f50('0xf')](util[_0x4f50('0x10')](_0x4f50('0x2a'),_0x5d27b4['uniqueid'],_0x5d27b4[_0x4f50('0x8')]));}}}catch(_0x56a7a6){utils[_0x4f50('0x18')](util[_0x4f50('0x10')](_0x4f50('0x25'),_0x5d27b4[_0x4f50('0xb')]),_0x56a7a6);}};exports[_0x4f50('0x2b')]=function(_0x1eb011){try{if(!_[_0x4f50('0x1b')](dials[_0x1eb011[_0x4f50('0xb')]])){utils[_0x4f50('0xd')](util['format'](_0x4f50('0x2c'),_0x1eb011[_0x4f50('0xb')]),_0x1eb011);utils[_0x4f50('0xf')](util[_0x4f50('0x10')](_0x4f50('0x2d'),_0x1eb011[_0x4f50('0xb')],_0x1eb011['calleridnum'],_0x1eb011['calleridname'],_0x1eb011['cause-txt']));dials[_0x1eb011[_0x4f50('0xb')]]=_[_0x4f50('0x21')](dials[_0x1eb011[_0x4f50('0xb')]],{'endtime':utils['now'](),'lastevent':'complete'});dials[_0x1eb011[_0x4f50('0xb')]][_0x4f50('0x2e')]=utils[_0x4f50('0x2f')](dials[_0x1eb011[_0x4f50('0xb')]][_0x4f50('0x30')],dials[_0x1eb011['uniqueid']][_0x4f50('0x22')]);dials[_0x1eb011[_0x4f50('0xb')]][_0x4f50('0x31')]=utils[_0x4f50('0x2f')](dials[_0x1eb011[_0x4f50('0xb')]][_0x4f50('0x29')]||dials[_0x1eb011['uniqueid']][_0x4f50('0x30')],dials[_0x1eb011[_0x4f50('0xb')]][_0x4f50('0x22')]);dials[_0x1eb011['uniqueid']][_0x4f50('0x32')]=dials[_0x1eb011['uniqueid']][_0x4f50('0x29')]?utils[_0x4f50('0x2f')](dials[_0x1eb011[_0x4f50('0xb')]][_0x4f50('0x30')],dials[_0x1eb011['uniqueid']][_0x4f50('0x29')]):0x0;writeDB(dials[_0x1eb011[_0x4f50('0xb')]]);}}catch(_0x21811c){utils[_0x4f50('0x18')](util['format'](_0x4f50('0x2c'),_0x1eb011[_0x4f50('0xb')]),_0x21811c);}}; \ No newline at end of file +var _0xa056=['variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][varset]','dialbegin','[%s][dials][dialbegin]','assign','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','ANSWER','answertime','now','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','calleridname','cause-txt','complete','duration','diffTime','holdtime','endtime','billableseconds','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','newexten','debug','[%s][dials][newexten]','uniqueid','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','toLowerCase','cdr(routeid)','split','error','varset','isNil'];(function(_0x46e3aa,_0x39d0f4){var _0x1558d1=function(_0x1f2937){while(--_0x1f2937){_0x46e3aa['push'](_0x46e3aa['shift']());}};_0x1558d1(++_0x39d0f4);}(_0xa056,0xf9));var _0x6a05=function(_0xb4670,_0x1fa72e){_0xb4670=_0xb4670-0x0;var _0x3f96d6=_0xa056[_0xb4670];return _0x3f96d6;};'use strict';var _=require(_0x6a05('0x0'));var util=require(_0x6a05('0x1'));var utils=require(_0x6a05('0x2'));var dials={};function writeDB(_0x4fc1c8){utils[_0x6a05('0x3')](util[_0x6a05('0x4')](_0x6a05('0x5'),_0x4fc1c8['uniqueid'],_0x4fc1c8[_0x6a05('0x6')],_0x4fc1c8[_0x6a05('0x7')],_0x4fc1c8[_0x6a05('0x8')],_0x4fc1c8[_0x6a05('0x9')],_0x4fc1c8[_0x6a05('0xa')]));utils[_0x6a05('0xb')]('CreateVoiceDialReport',_0x4fc1c8);delete dials[_0x4fc1c8['uniqueid']];}exports[_0x6a05('0xc')]=function(_0x3a9ef4){try{utils[_0x6a05('0xd')](util[_0x6a05('0x4')](_0x6a05('0xe'),_0x3a9ef4[_0x6a05('0xf')]),_0x3a9ef4);utils[_0x6a05('0x3')](util[_0x6a05('0x4')](_0x6a05('0x10'),_0x3a9ef4['uniqueid'],_0x3a9ef4[_0x6a05('0x11')],_0x3a9ef4[_0x6a05('0x12')]));if(_0x3a9ef4[_0x6a05('0x11')]['toLowerCase']()==_0x6a05('0x13')&&_['startsWith'](_0x3a9ef4[_0x6a05('0x12')][_0x6a05('0x14')](),_0x6a05('0x15'))){var _0x2f0bdd=_0x3a9ef4[_0x6a05('0x12')][_0x6a05('0x16')]('=');dials[_0x3a9ef4[_0x6a05('0xf')]]={'routeId':_0x2f0bdd[0x1]};}}catch(_0x3be52e){utils[_0x6a05('0x17')](util[_0x6a05('0x4')](_0x6a05('0xe'),_0x3a9ef4[_0x6a05('0xf')]),_0x3be52e);}};exports[_0x6a05('0x18')]=function(_0x4cd157){try{utils[_0x6a05('0xd')](util['format']('[%s][dials][varset]',_0x4cd157['uniqueid']),_0x4cd157);if(!_[_0x6a05('0x19')](_0x4cd157[_0x6a05('0x1a')][_0x6a05('0x1b')])){utils[_0x6a05('0x3')](util[_0x6a05('0x4')](_0x6a05('0x1c'),_0x4cd157['uniqueid'],_0x4cd157[_0x6a05('0x1d')]));dials[_0x4cd157[_0x6a05('0xf')]]={'routeId':_0x4cd157[_0x6a05('0x1d')]};}}catch(_0x30235d){utils[_0x6a05('0x17')](util[_0x6a05('0x4')](_0x6a05('0x1e'),_0x4cd157['uniqueid']),_0x30235d);}};exports[_0x6a05('0x1f')]=function(_0x35046c){try{if(!_[_0x6a05('0x19')](dials[_0x35046c[_0x6a05('0xf')]])){utils[_0x6a05('0xd')](util[_0x6a05('0x4')](_0x6a05('0x20'),_0x35046c['uniqueid']),_0x35046c);dials[_0x35046c[_0x6a05('0xf')]]=_[_0x6a05('0x21')](dials[_0x35046c[_0x6a05('0xf')]],_0x35046c);dials[_0x35046c[_0x6a05('0xf')]]['starttime']=utils['now']();dials[_0x35046c[_0x6a05('0xf')]][_0x6a05('0x22')]=_0x6a05('0x23');utils[_0x6a05('0x3')](util['format'](_0x6a05('0x24'),_0x35046c['uniqueid'],dials[_0x35046c['uniqueid']]['starttime']));}}catch(_0xe1825c){utils[_0x6a05('0x17')](util['format']('[%s][dials][dialbegin]',_0x35046c[_0x6a05('0xf')]),_0xe1825c);}};exports[_0x6a05('0x25')]=function(_0x54f222){try{if(!_[_0x6a05('0x19')](dials[_0x54f222[_0x6a05('0xf')]])){utils['debug'](util[_0x6a05('0x4')](_0x6a05('0x26'),_0x54f222[_0x6a05('0xf')]),_0x54f222);dials[_0x54f222['uniqueid']]['dialstatus']=_0x54f222[_0x6a05('0xa')];if(_0x54f222[_0x6a05('0xa')]==_0x6a05('0x27')){dials[_0x54f222['uniqueid']]=_[_0x6a05('0x21')](dials[_0x54f222['uniqueid']],_0x54f222);dials[_0x54f222['uniqueid']][_0x6a05('0x28')]=utils[_0x6a05('0x29')]();dials[_0x54f222['uniqueid']][_0x6a05('0x22')]=_0x6a05('0x2a');utils[_0x6a05('0x3')](util['format'](_0x6a05('0x2b'),_0x54f222[_0x6a05('0xf')],_0x54f222[_0x6a05('0xa')],dials[_0x54f222['uniqueid']]['answertime']));}else{utils[_0x6a05('0x3')](util[_0x6a05('0x4')](_0x6a05('0x2c'),_0x54f222[_0x6a05('0xf')],_0x54f222[_0x6a05('0xa')]));}}}catch(_0x124dea){utils['error'](util[_0x6a05('0x4')]('[%s][dials][dialend]',_0x54f222['uniqueid']),_0x124dea);}};exports[_0x6a05('0x2d')]=function(_0x2df44d){try{if(!_[_0x6a05('0x19')](dials[_0x2df44d[_0x6a05('0xf')]])){utils[_0x6a05('0xd')](util[_0x6a05('0x4')](_0x6a05('0x2e'),_0x2df44d[_0x6a05('0xf')]),_0x2df44d);utils['info'](util['format']('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x2df44d[_0x6a05('0xf')],_0x2df44d[_0x6a05('0x8')],_0x2df44d[_0x6a05('0x2f')],_0x2df44d[_0x6a05('0x30')]));dials[_0x2df44d[_0x6a05('0xf')]]=_['assign'](dials[_0x2df44d[_0x6a05('0xf')]],{'endtime':utils['now'](),'lastevent':_0x6a05('0x31')});dials[_0x2df44d[_0x6a05('0xf')]][_0x6a05('0x32')]=utils[_0x6a05('0x33')](dials[_0x2df44d['uniqueid']]['endtime'],dials[_0x2df44d[_0x6a05('0xf')]]['starttime']);dials[_0x2df44d[_0x6a05('0xf')]][_0x6a05('0x34')]=utils['diffTime'](dials[_0x2df44d[_0x6a05('0xf')]][_0x6a05('0x28')]||dials[_0x2df44d[_0x6a05('0xf')]][_0x6a05('0x35')],dials[_0x2df44d[_0x6a05('0xf')]]['starttime']);dials[_0x2df44d[_0x6a05('0xf')]][_0x6a05('0x36')]=dials[_0x2df44d['uniqueid']]['answertime']?utils[_0x6a05('0x33')](dials[_0x2df44d[_0x6a05('0xf')]]['endtime'],dials[_0x2df44d['uniqueid']]['answertime']):0x0;writeDB(dials[_0x2df44d[_0x6a05('0xf')]]);}}catch(_0x208ce8){utils[_0x6a05('0x17')](util[_0x6a05('0x4')]('[%s][dials][hangup]',_0x2df44d[_0x6a05('0xf')]),_0x208ce8);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index c29a636..6d4a4c3 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 _0xc285=['[%s][index][blindtransfer]','[%s][index][attendedtransfer]','origtransfereruniqueid','attendedtransfer','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','asterisk','keepConnected','xdr','disabled','info','XDR\x20DISABLED','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','[%s][index][devicestatechange]','format','agentcalled','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstart','musiconholdstop','[%s][index][musiconholdstop]','[%s][index][newstate]','newstate','hangup','cdr','[%s][index][cdr]','blindtransfer'];(function(_0x214aa2,_0x37d96b){var _0x5ccd49=function(_0x5540ab){while(--_0x5540ab){_0x214aa2['push'](_0x214aa2['shift']());}};_0x5ccd49(++_0x37d96b);}(_0xc285,0xc7));var _0x5c28=function(_0x33a528,_0x216f14){_0x33a528=_0x33a528-0x0;var _0x168145=_0xc285[_0x33a528];return _0x168145;};var AsteriskManager=require(_0x5c28('0x0'));var config=require(_0x5c28('0x1'));var utils=require(_0x5c28('0x2'));var util=require('util');var ami=new AsteriskManager(config['asterisk']['port'],config[_0x5c28('0x3')]['ip'],config[_0x5c28('0x3')]['username'],config[_0x5c28('0x3')]['password'],!![]);ami[_0x5c28('0x4')]();if(config[_0x5c28('0x5')]&&config['xdr'][_0x5c28('0x6')]){utils[_0x5c28('0x7')](_0x5c28('0x8'));}else{var agents=require('./agents.controller');var calls=require(_0x5c28('0x9'));var queues=require(_0x5c28('0xa'));var recordings=require(_0x5c28('0xb'));var members=require(_0x5c28('0xc'));var dials=require(_0x5c28('0xd'));var transfers=require(_0x5c28('0xe'));var core=require(_0x5c28('0xf'));ami['on'](_0x5c28('0x10'),core[_0x5c28('0x10')]);ami['on']('shutdown',core[_0x5c28('0x11')]);ami['on'](_0x5c28('0x12'),core[_0x5c28('0x12')]);ami['on'](_0x5c28('0x13'),core[_0x5c28('0x13')]);ami['on']('close',core[_0x5c28('0x14')]);ami['on'](_0x5c28('0x15'),core['managerevent']);ami['on'](_0x5c28('0x16'),function(_0x51162c){try{utils[_0x5c28('0x17')](util['format'](_0x5c28('0x18'),_0x51162c['device']),_0x51162c);members[_0x5c28('0x16')](_0x51162c);}catch(_0x460c56){utils[_0x5c28('0x13')](util[_0x5c28('0x19')](_0x5c28('0x18'),_0x51162c['device']),_0x460c56);}});ami['on'](_0x5c28('0x1a'),function(_0x1bee30){try{utils[_0x5c28('0x17')](util[_0x5c28('0x19')]('[%s][index][agentcalled]',_0x1bee30[_0x5c28('0x1b')]),_0x1bee30);agents[_0x5c28('0x1a')](_0x1bee30);}catch(_0x4dcad1){utils[_0x5c28('0x13')](util[_0x5c28('0x19')]('[%s][index][agentcalled]',_0x1bee30[_0x5c28('0x1b')]),_0x4dcad1);}});ami['on'](_0x5c28('0x1c'),function(_0x1ed7c9){try{utils[_0x5c28('0x17')](util[_0x5c28('0x19')]('[%s][index][agentringnoanswer]',_0x1ed7c9[_0x5c28('0x1b')]),_0x1ed7c9);agents[_0x5c28('0x1c')](_0x1ed7c9);}catch(_0x180627){utils[_0x5c28('0x13')](util[_0x5c28('0x19')](_0x5c28('0x1d'),_0x1ed7c9[_0x5c28('0x1b')]),_0x180627);}});ami['on'](_0x5c28('0x1e'),function(_0x138ae9){try{utils['debug'](util[_0x5c28('0x19')](_0x5c28('0x1f'),_0x138ae9[_0x5c28('0x1b')]),_0x138ae9);agents[_0x5c28('0x1e')](_0x138ae9);queues[_0x5c28('0x1e')](_0x138ae9);}catch(_0x5cdeb0){utils[_0x5c28('0x13')](util['format'](_0x5c28('0x1f'),_0x138ae9[_0x5c28('0x1b')]),_0x5cdeb0);}});ami['on'](_0x5c28('0x20'),function(_0x3176e4){try{utils['debug'](util[_0x5c28('0x19')](_0x5c28('0x21'),_0x3176e4[_0x5c28('0x1b')]),_0x3176e4);agents['agentcomplete'](_0x3176e4);queues[_0x5c28('0x20')](_0x3176e4);members['agentcomplete'](_0x3176e4);}catch(_0x48e36a){utils[_0x5c28('0x13')](util[_0x5c28('0x19')]('[%s][index][agentcomplete]',_0x3176e4[_0x5c28('0x1b')]),_0x48e36a);}});ami['on'](_0x5c28('0x22'),function(_0x163ab1){try{utils[_0x5c28('0x17')](util['format'](_0x5c28('0x23'),_0x163ab1[_0x5c28('0x1b')]),_0x163ab1);agents[_0x5c28('0x22')](_0x163ab1);queues[_0x5c28('0x22')](_0x163ab1);}catch(_0xbb00f4){utils[_0x5c28('0x13')](util[_0x5c28('0x19')](_0x5c28('0x23'),_0x163ab1[_0x5c28('0x1b')]),_0xbb00f4);}});ami['on'](_0x5c28('0x24'),function(_0x2a79b0){try{utils[_0x5c28('0x17')](util['format']('[%s][index][queuecallerjoin]',_0x2a79b0[_0x5c28('0x1b')]),_0x2a79b0);queues[_0x5c28('0x24')](_0x2a79b0);recordings[_0x5c28('0x24')](_0x2a79b0);}catch(_0x511c57){utils[_0x5c28('0x13')](util[_0x5c28('0x19')]('[%s][index][queuecallerjoin]',_0x2a79b0['uniqueid']),_0x511c57);}});ami['on'](_0x5c28('0x25'),function(_0x5ea951){try{utils['debug'](util['format'](_0x5c28('0x26'),_0x5ea951[_0x5c28('0x1b')]),_0x5ea951);queues['queuecallerleave'](_0x5ea951);}catch(_0x1e4901){utils['error'](util['format'](_0x5c28('0x26'),_0x5ea951['uniqueid']),_0x1e4901);}});ami['on']('musiconholdstart',function(_0x1ba9ac){try{utils[_0x5c28('0x17')](util[_0x5c28('0x19')](_0x5c28('0x27'),_0x1ba9ac[_0x5c28('0x1b')]),_0x1ba9ac);queues[_0x5c28('0x28')](_0x1ba9ac);calls['musiconholdstart'](_0x1ba9ac);}catch(_0x40fe11){utils[_0x5c28('0x13')](util['format']('[%s][index][musiconholdstart]',_0x1ba9ac[_0x5c28('0x1b')]),_0x40fe11);}});ami['on'](_0x5c28('0x29'),function(_0xf87826){try{utils[_0x5c28('0x17')](util[_0x5c28('0x19')](_0x5c28('0x2a'),_0xf87826['uniqueid']),_0xf87826);queues[_0x5c28('0x29')](_0xf87826);calls[_0x5c28('0x29')](_0xf87826);}catch(_0x465096){utils[_0x5c28('0x13')](util['format'](_0x5c28('0x2a'),_0xf87826['uniqueid']),_0x465096);}});ami['on']('newstate',function(_0x2c12fb){try{utils[_0x5c28('0x17')](util[_0x5c28('0x19')](_0x5c28('0x2b'),_0x2c12fb[_0x5c28('0x1b')]),_0x2c12fb);calls['newstate'](_0x2c12fb);recordings[_0x5c28('0x2c')](_0x2c12fb);}catch(_0x239639){utils[_0x5c28('0x13')](util[_0x5c28('0x19')](_0x5c28('0x2b'),_0x2c12fb[_0x5c28('0x1b')]),_0x239639);}});ami['on'](_0x5c28('0x2d'),function(_0x18bd1c){try{utils['debug'](util[_0x5c28('0x19')]('[%s][index][hangup]',_0x18bd1c[_0x5c28('0x1b')]),_0x18bd1c);calls[_0x5c28('0x2d')](_0x18bd1c);recordings[_0x5c28('0x2d')](_0x18bd1c);dials[_0x5c28('0x2d')](_0x18bd1c);agents[_0x5c28('0x2d')](_0x18bd1c);queues[_0x5c28('0x2d')](_0x18bd1c);}catch(_0x37ac35){utils[_0x5c28('0x13')](util[_0x5c28('0x19')]('[%s][index][hangup]',_0x18bd1c[_0x5c28('0x1b')]),_0x37ac35);}});ami['on'](_0x5c28('0x2e'),function(_0x559f04){try{utils[_0x5c28('0x17')](util[_0x5c28('0x19')](_0x5c28('0x2f'),_0x559f04['uniqueid']),_0x559f04);members[_0x5c28('0x2e')](_0x559f04);}catch(_0x283b48){utils[_0x5c28('0x13')](util[_0x5c28('0x19')]('[%s][index][cdr]',_0x559f04[_0x5c28('0x1b')]),_0x283b48);}});ami['on'](_0x5c28('0x30'),function(_0x3a6ae5){try{utils[_0x5c28('0x17')](util[_0x5c28('0x19')]('[%s][index][blindtransfer]',_0x3a6ae5[_0x5c28('0x1b')]),_0x3a6ae5);queues[_0x5c28('0x30')](_0x3a6ae5);agents[_0x5c28('0x30')](_0x3a6ae5);transfers[_0x5c28('0x30')](_0x3a6ae5);}catch(_0x2180e9){utils[_0x5c28('0x13')](util[_0x5c28('0x19')](_0x5c28('0x31'),_0x3a6ae5[_0x5c28('0x1b')]),_0x2180e9);}});ami['on']('attendedtransfer',function(_0x566251){try{utils[_0x5c28('0x17')](util[_0x5c28('0x19')](_0x5c28('0x32'),_0x566251[_0x5c28('0x33')]),_0x566251);queues[_0x5c28('0x34')](_0x566251);transfers['attendedtransfer'](_0x566251);agents[_0x5c28('0x34')](_0x566251);calls['attendedtransfer'](_0x566251);}catch(_0xd94678){utils[_0x5c28('0x13')](util[_0x5c28('0x19')](_0x5c28('0x32'),_0x566251[_0x5c28('0x33')]),_0xd94678);}});ami['on'](_0x5c28('0x35'),function(_0xbf50ae){try{utils[_0x5c28('0x17')](util[_0x5c28('0x19')](_0x5c28('0x36'),_0xbf50ae[_0x5c28('0x1b')]),_0xbf50ae);queues[_0x5c28('0x35')](_0xbf50ae);recordings['varset'](_0xbf50ae);calls['varset'](_0xbf50ae);dials[_0x5c28('0x35')](_0xbf50ae);}catch(_0xc3c860){utils[_0x5c28('0x13')](util[_0x5c28('0x19')]('[%s][index][varset]',_0xbf50ae[_0x5c28('0x1b')]),_0xc3c860);}});ami['on'](_0x5c28('0x37'),function(_0x126754){try{utils[_0x5c28('0x17')](util[_0x5c28('0x19')](_0x5c28('0x38'),_0x126754[_0x5c28('0x1b')]),_0x126754);calls[_0x5c28('0x37')](_0x126754);recordings[_0x5c28('0x37')](_0x126754);dials[_0x5c28('0x37')](_0x126754);}catch(_0x3d0125){utils['error'](util[_0x5c28('0x19')](_0x5c28('0x38'),_0x126754['uniqueid']),_0x3d0125);}});ami['on']('newchannel',function(_0x26e9d3){try{utils['debug'](util[_0x5c28('0x19')]('[%s][index][newchannel]',_0x26e9d3[_0x5c28('0x1b')]),_0x26e9d3);calls['newchannel'](_0x26e9d3);recordings[_0x5c28('0x39')](_0x26e9d3);}catch(_0x2d5c2d){utils[_0x5c28('0x13')](util[_0x5c28('0x19')]('[%s][index][newchannel]',_0x26e9d3['uniqueid']),_0x2d5c2d);}});ami['on']('dialbegin',function(_0xc135a1){try{utils['debug'](util['format'](_0x5c28('0x3a'),_0xc135a1['uniqueid']),_0xc135a1);dials['dialbegin'](_0xc135a1);}catch(_0x48e51c){utils[_0x5c28('0x13')](util[_0x5c28('0x19')](_0x5c28('0x3b'),_0xc135a1[_0x5c28('0x1b')]),_0x48e51c);}});ami['on'](_0x5c28('0x3c'),function(_0x25a9a3){try{utils[_0x5c28('0x17')](util[_0x5c28('0x19')]('[%s][index][dialend]',_0x25a9a3[_0x5c28('0x1b')]),_0x25a9a3);dials[_0x5c28('0x3c')](_0x25a9a3);}catch(_0x5758bd){utils[_0x5c28('0x13')](util[_0x5c28('0x19')](_0x5c28('0x3d'),_0x25a9a3[_0x5c28('0x1b')]),_0x5758bd);}});} \ No newline at end of file +var _0x998c=['hangup','cdr','[%s][index][cdr]','[%s][index][blindtransfer]','blindtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','attendedtransfer','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','asterisk','port','username','password','xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','[%s][index][devicestatechange]','device','agentcalled','format','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','[%s][index][queuecallerjoin]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','[%s][index][hangup]'];(function(_0x389f3d,_0x2685ed){var _0x31410b=function(_0x25609f){while(--_0x25609f){_0x389f3d['push'](_0x389f3d['shift']());}};_0x31410b(++_0x2685ed);}(_0x998c,0x1a3));var _0xc998=function(_0x3ab353,_0x5d5283){_0x3ab353=_0x3ab353-0x0;var _0x1e2285=_0x998c[_0x3ab353];return _0x1e2285;};var AsteriskManager=require(_0xc998('0x0'));var config=require(_0xc998('0x1'));var utils=require(_0xc998('0x2'));var util=require('util');var ami=new AsteriskManager(config[_0xc998('0x3')][_0xc998('0x4')],config['asterisk']['ip'],config[_0xc998('0x3')][_0xc998('0x5')],config['asterisk'][_0xc998('0x6')],!![]);ami['keepConnected']();if(config[_0xc998('0x7')]&&config[_0xc998('0x7')][_0xc998('0x8')]){utils[_0xc998('0x9')](_0xc998('0xa'));}else{var agents=require(_0xc998('0xb'));var calls=require(_0xc998('0xc'));var queues=require(_0xc998('0xd'));var recordings=require(_0xc998('0xe'));var members=require('./members.controller');var dials=require('./dials.controller');var transfers=require(_0xc998('0xf'));var core=require(_0xc998('0x10'));ami['on'](_0xc998('0x11'),core['connect']);ami['on'](_0xc998('0x12'),core[_0xc998('0x12')]);ami['on']('fullybooted',core[_0xc998('0x13')]);ami['on']('error',core[_0xc998('0x14')]);ami['on'](_0xc998('0x15'),core['close']);ami['on'](_0xc998('0x16'),core[_0xc998('0x16')]);ami['on'](_0xc998('0x17'),function(_0x2c7cad){try{utils[_0xc998('0x18')](util['format'](_0xc998('0x19'),_0x2c7cad[_0xc998('0x1a')]),_0x2c7cad);members['devicestatechange'](_0x2c7cad);}catch(_0x4e33f0){utils[_0xc998('0x14')](util['format'](_0xc998('0x19'),_0x2c7cad[_0xc998('0x1a')]),_0x4e33f0);}});ami['on'](_0xc998('0x1b'),function(_0x311ca1){try{utils[_0xc998('0x18')](util[_0xc998('0x1c')](_0xc998('0x1d'),_0x311ca1[_0xc998('0x1e')]),_0x311ca1);agents[_0xc998('0x1b')](_0x311ca1);}catch(_0x409f9d){utils[_0xc998('0x14')](util[_0xc998('0x1c')](_0xc998('0x1d'),_0x311ca1[_0xc998('0x1e')]),_0x409f9d);}});ami['on'](_0xc998('0x1f'),function(_0x5b61d9){try{utils[_0xc998('0x18')](util[_0xc998('0x1c')]('[%s][index][agentringnoanswer]',_0x5b61d9[_0xc998('0x1e')]),_0x5b61d9);agents[_0xc998('0x1f')](_0x5b61d9);}catch(_0x26bd51){utils[_0xc998('0x14')](util['format'](_0xc998('0x20'),_0x5b61d9[_0xc998('0x1e')]),_0x26bd51);}});ami['on'](_0xc998('0x21'),function(_0x30e311){try{utils[_0xc998('0x18')](util[_0xc998('0x1c')](_0xc998('0x22'),_0x30e311[_0xc998('0x1e')]),_0x30e311);agents[_0xc998('0x21')](_0x30e311);queues[_0xc998('0x21')](_0x30e311);}catch(_0x556693){utils[_0xc998('0x14')](util[_0xc998('0x1c')]('[%s][index][agentconnect]',_0x30e311['uniqueid']),_0x556693);}});ami['on'](_0xc998('0x23'),function(_0x21ba5b){try{utils[_0xc998('0x18')](util[_0xc998('0x1c')]('[%s][index][agentcomplete]',_0x21ba5b[_0xc998('0x1e')]),_0x21ba5b);agents['agentcomplete'](_0x21ba5b);queues[_0xc998('0x23')](_0x21ba5b);members['agentcomplete'](_0x21ba5b);}catch(_0x95a64c){utils[_0xc998('0x14')](util[_0xc998('0x1c')](_0xc998('0x24'),_0x21ba5b[_0xc998('0x1e')]),_0x95a64c);}});ami['on'](_0xc998('0x25'),function(_0xcd5aca){try{utils['debug'](util['format'](_0xc998('0x26'),_0xcd5aca[_0xc998('0x1e')]),_0xcd5aca);agents['queuecallerabandon'](_0xcd5aca);queues['queuecallerabandon'](_0xcd5aca);}catch(_0x49d7f7){utils[_0xc998('0x14')](util[_0xc998('0x1c')]('[%s][index][queuecallerabandon]',_0xcd5aca[_0xc998('0x1e')]),_0x49d7f7);}});ami['on']('queuecallerjoin',function(_0x287a9a){try{utils[_0xc998('0x18')](util[_0xc998('0x1c')](_0xc998('0x27'),_0x287a9a['uniqueid']),_0x287a9a);queues[_0xc998('0x28')](_0x287a9a);recordings[_0xc998('0x28')](_0x287a9a);}catch(_0x242802){utils['error'](util[_0xc998('0x1c')](_0xc998('0x27'),_0x287a9a['uniqueid']),_0x242802);}});ami['on'](_0xc998('0x29'),function(_0x5099ff){try{utils[_0xc998('0x18')](util['format'](_0xc998('0x2a'),_0x5099ff[_0xc998('0x1e')]),_0x5099ff);queues[_0xc998('0x29')](_0x5099ff);}catch(_0x19ebc6){utils[_0xc998('0x14')](util[_0xc998('0x1c')](_0xc998('0x2a'),_0x5099ff[_0xc998('0x1e')]),_0x19ebc6);}});ami['on'](_0xc998('0x2b'),function(_0x3f686c){try{utils[_0xc998('0x18')](util['format']('[%s][index][musiconholdstart]',_0x3f686c[_0xc998('0x1e')]),_0x3f686c);queues[_0xc998('0x2b')](_0x3f686c);calls[_0xc998('0x2b')](_0x3f686c);}catch(_0x1c1c09){utils[_0xc998('0x14')](util[_0xc998('0x1c')](_0xc998('0x2c'),_0x3f686c[_0xc998('0x1e')]),_0x1c1c09);}});ami['on'](_0xc998('0x2d'),function(_0x59ef0e){try{utils['debug'](util['format'](_0xc998('0x2e'),_0x59ef0e[_0xc998('0x1e')]),_0x59ef0e);queues[_0xc998('0x2d')](_0x59ef0e);calls[_0xc998('0x2d')](_0x59ef0e);}catch(_0x5c184e){utils['error'](util[_0xc998('0x1c')](_0xc998('0x2e'),_0x59ef0e['uniqueid']),_0x5c184e);}});ami['on'](_0xc998('0x2f'),function(_0x21b6e8){try{utils[_0xc998('0x18')](util['format'](_0xc998('0x30'),_0x21b6e8['uniqueid']),_0x21b6e8);calls['newstate'](_0x21b6e8);recordings[_0xc998('0x2f')](_0x21b6e8);}catch(_0x3ce6c1){utils['error'](util[_0xc998('0x1c')](_0xc998('0x30'),_0x21b6e8[_0xc998('0x1e')]),_0x3ce6c1);}});ami['on']('hangup',function(_0x3f87d7){try{utils[_0xc998('0x18')](util['format'](_0xc998('0x31'),_0x3f87d7[_0xc998('0x1e')]),_0x3f87d7);calls[_0xc998('0x32')](_0x3f87d7);recordings[_0xc998('0x32')](_0x3f87d7);dials['hangup'](_0x3f87d7);agents[_0xc998('0x32')](_0x3f87d7);queues[_0xc998('0x32')](_0x3f87d7);}catch(_0x42c04e){utils[_0xc998('0x14')](util[_0xc998('0x1c')](_0xc998('0x31'),_0x3f87d7['uniqueid']),_0x42c04e);}});ami['on'](_0xc998('0x33'),function(_0x5a37fd){try{utils[_0xc998('0x18')](util[_0xc998('0x1c')](_0xc998('0x34'),_0x5a37fd[_0xc998('0x1e')]),_0x5a37fd);members['cdr'](_0x5a37fd);}catch(_0x1d94bd){utils[_0xc998('0x14')](util[_0xc998('0x1c')](_0xc998('0x34'),_0x5a37fd[_0xc998('0x1e')]),_0x1d94bd);}});ami['on']('blindtransfer',function(_0x393cc2){try{utils[_0xc998('0x18')](util[_0xc998('0x1c')](_0xc998('0x35'),_0x393cc2[_0xc998('0x1e')]),_0x393cc2);queues['blindtransfer'](_0x393cc2);agents['blindtransfer'](_0x393cc2);transfers[_0xc998('0x36')](_0x393cc2);}catch(_0x9710ef){utils['error'](util[_0xc998('0x1c')](_0xc998('0x35'),_0x393cc2[_0xc998('0x1e')]),_0x9710ef);}});ami['on']('attendedtransfer',function(_0x398ed7){try{utils['debug'](util[_0xc998('0x1c')](_0xc998('0x37'),_0x398ed7[_0xc998('0x38')]),_0x398ed7);queues[_0xc998('0x39')](_0x398ed7);transfers['attendedtransfer'](_0x398ed7);agents['attendedtransfer'](_0x398ed7);calls[_0xc998('0x39')](_0x398ed7);}catch(_0xf89df1){utils[_0xc998('0x14')](util[_0xc998('0x1c')]('[%s][index][attendedtransfer]',_0x398ed7[_0xc998('0x38')]),_0xf89df1);}});ami['on'](_0xc998('0x3a'),function(_0x512751){try{utils[_0xc998('0x18')](util[_0xc998('0x1c')](_0xc998('0x3b'),_0x512751['uniqueid']),_0x512751);queues[_0xc998('0x3a')](_0x512751);recordings[_0xc998('0x3a')](_0x512751);calls[_0xc998('0x3a')](_0x512751);dials[_0xc998('0x3a')](_0x512751);}catch(_0x35c0d1){utils[_0xc998('0x14')](util[_0xc998('0x1c')](_0xc998('0x3b'),_0x512751[_0xc998('0x1e')]),_0x35c0d1);}});ami['on'](_0xc998('0x3c'),function(_0x18e0ce){try{utils[_0xc998('0x18')](util[_0xc998('0x1c')](_0xc998('0x3d'),_0x18e0ce['uniqueid']),_0x18e0ce);calls['newexten'](_0x18e0ce);recordings[_0xc998('0x3c')](_0x18e0ce);dials[_0xc998('0x3c')](_0x18e0ce);}catch(_0x2dccb3){utils[_0xc998('0x14')](util['format'](_0xc998('0x3d'),_0x18e0ce[_0xc998('0x1e')]),_0x2dccb3);}});ami['on'](_0xc998('0x3e'),function(_0x1e6ff0){try{utils['debug'](util['format']('[%s][index][newchannel]',_0x1e6ff0['uniqueid']),_0x1e6ff0);calls[_0xc998('0x3e')](_0x1e6ff0);recordings['newchannel'](_0x1e6ff0);}catch(_0xd3ea95){utils[_0xc998('0x14')](util['format'](_0xc998('0x3f'),_0x1e6ff0[_0xc998('0x1e')]),_0xd3ea95);}});ami['on'](_0xc998('0x40'),function(_0x12af58){try{utils[_0xc998('0x18')](util[_0xc998('0x1c')]('[%s][index][dialbegin]',_0x12af58[_0xc998('0x1e')]),_0x12af58);dials[_0xc998('0x40')](_0x12af58);}catch(_0x13791a){utils['error'](util[_0xc998('0x1c')]('[%s]dialbegin',_0x12af58['uniqueid']),_0x13791a);}});ami['on'](_0xc998('0x41'),function(_0x38230e){try{utils[_0xc998('0x18')](util[_0xc998('0x1c')]('[%s][index][dialend]',_0x38230e[_0xc998('0x1e')]),_0x38230e);dials[_0xc998('0x41')](_0x38230e);}catch(_0x5acb2d){utils[_0xc998('0x14')](util[_0xc998('0x1c')](_0xc998('0x42'),_0x38230e[_0xc998('0x1e')]),_0x5acb2d);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index a9ffed1..6ef6c75 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 _0x2828=['duration','diffTime','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','cdr','[%s][members][cdr]','channel','split','data1','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','assign','util','./utils','Local/_attended@transfer','Queue:','info','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','interface','data2','membername','type','getUserByInterface','then','name','internal','request','getUserByName','error','format','[%s][members][writeDB]','uniqueid','some','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','BUSY','voice','TALKING','now','agent','NOT_INUSE','isNil','exitAt'];(function(_0x36888d,_0x22988e){var _0x14f524=function(_0x5cdbfe){while(--_0x5cdbfe){_0x36888d['push'](_0x36888d['shift']());}};_0x14f524(++_0x22988e);}(_0x2828,0x1dc));var _0x8282=function(_0x1f930e,_0x24c403){_0x1f930e=_0x1f930e-0x0;var _0x5bfa2b=_0x2828[_0x1f930e];return _0x5bfa2b;};'use strict';var _=require('lodash');var util=require(_0x8282('0x0'));var utils=require(_0x8282('0x1'));var members={};var exclude=[_0x8282('0x2'),_0x8282('0x3')];function writeDB(_0x3a01da){utils[_0x8282('0x4')](util['format'](_0x8282('0x5'),_0x3a01da['uniqueid'],_0x3a01da[_0x8282('0x6')],_0x3a01da['channel'],_0x3a01da[_0x8282('0x7')],_0x3a01da[_0x8282('0x8')],_0x3a01da[_0x8282('0x9')]));if(_0x3a01da[_0x8282('0x6')]){utils[_0x8282('0xa')](_0x3a01da['interface'])[_0x8282('0xb')](function(_0x1fb604){if(_0x1fb604){_0x3a01da[_0x8282('0x8')]=_0x1fb604[_0x8282('0xc')];_0x3a01da[_0x8282('0xd')]=_0x1fb604[_0x8282('0xd')];utils[_0x8282('0xe')]('CreateMemberReport',_0x3a01da);}else{utils[_0x8282('0xf')](_0x3a01da[_0x8282('0x6')]['split']('/')[0x1])[_0x8282('0xb')](function(_0x1aa09a){if(_0x1aa09a){_0x3a01da[_0x8282('0x8')]=_0x1aa09a['name'];_0x3a01da[_0x8282('0xd')]=_0x1aa09a[_0x8282('0xd')];utils[_0x8282('0xe')]('CreateMemberReport',_0x3a01da);}});}})['catch'](function(_0x3a04b7){utils[_0x8282('0x10')](util[_0x8282('0x11')](_0x8282('0x12'),_0x3a01da[_0x8282('0x13')]),_0x3a04b7);});}delete members[_0x3a01da[_0x8282('0x6')]];}function startsWith(_0x4e7e84,_0x271758){return _[_0x8282('0x14')](_0x4e7e84,function(_0x320820){return _['startsWith'](_0x271758,_0x320820);});}exports[_0x8282('0x15')]=function(_0x26c70d){try{utils[_0x8282('0x16')](util[_0x8282('0x11')](_0x8282('0x17'),members[_0x26c70d[_0x8282('0x18')]]?members[_0x26c70d['device']]['uniqueid']:_0x26c70d['device']),_0x26c70d);utils['info'](util[_0x8282('0x11')](_0x8282('0x19'),members[_0x26c70d[_0x8282('0x18')]]?members[_0x26c70d[_0x8282('0x18')]]['uniqueid']:_0x26c70d[_0x8282('0x18')],_0x26c70d['state'],_0x26c70d[_0x8282('0x18')]));switch(_0x26c70d['state']){case'INUSE':case _0x8282('0x1a'):if(!startsWith(exclude,_0x26c70d[_0x8282('0x18')])){members[_0x26c70d['device']]={'channel':_0x8282('0x1b'),'interface':_0x26c70d[_0x8282('0x18')],'type':_0x8282('0x1c'),'enterAt':utils[_0x8282('0x1d')](),'role':_0x8282('0x1e')};}break;case _0x8282('0x1f'):if(!_[_0x8282('0x20')](members[_0x26c70d[_0x8282('0x18')]])){members[_0x26c70d[_0x8282('0x18')]][_0x8282('0x21')]=utils[_0x8282('0x1d')]();members[_0x26c70d[_0x8282('0x18')]][_0x8282('0x22')]=utils[_0x8282('0x23')](members[_0x26c70d[_0x8282('0x18')]]['exitAt'],members[_0x26c70d[_0x8282('0x18')]]['enterAt']);if(members[_0x26c70d[_0x8282('0x18')]][_0x8282('0x13')]){writeDB(members[_0x26c70d[_0x8282('0x18')]]);}}break;default:break;}}catch(_0x592efa){utils[_0x8282('0x10')](util[_0x8282('0x11')](_0x8282('0x17'),members[_0x26c70d['device']]?members[_0x26c70d['device']][_0x8282('0x13')]:_0x26c70d['device']),_0x592efa);}};exports[_0x8282('0x24')]=function(_0x561bc1){try{if(!_['isNil'](members[_0x561bc1[_0x8282('0x6')]])){utils[_0x8282('0x16')](util['format'](_0x8282('0x25'),_0x561bc1[_0x8282('0x13')]),_0x561bc1);utils[_0x8282('0x4')](util[_0x8282('0x11')](_0x8282('0x26'),_0x561bc1[_0x8282('0x13')],_0x561bc1['interface'],_0x561bc1[_0x8282('0x27')]));members[_0x561bc1[_0x8282('0x6')]]=_['assign'](members[_0x561bc1['interface']],{'data4':_0x561bc1[_0x8282('0x27')],'uniqueid':_0x561bc1[_0x8282('0x13')]});}}catch(_0x4eb55d){utils['error'](util[_0x8282('0x11')](_0x8282('0x25'),_0x561bc1[_0x8282('0x13')]),_0x4eb55d);}};exports[_0x8282('0x28')]=function(_0x45dd08){try{utils[_0x8282('0x16')](util[_0x8282('0x11')](_0x8282('0x29'),_0x45dd08[_0x8282('0x13')]),_0x45dd08);if(_0x45dd08[_0x8282('0x2a')]){var _0x230ec4=_0x45dd08[_0x8282('0x2a')][_0x8282('0x2b')]('-')[0x0];if(!_['isNil'](members[_0x230ec4])){members[_0x230ec4]=_['assign'](members[_0x230ec4],{'data1':members[_0x230ec4][_0x8282('0x2c')]||_0x45dd08[_0x8282('0x9')],'data2':members[_0x230ec4][_0x8282('0x7')]||_0x45dd08[_0x8282('0x2d')],'data3':members[_0x230ec4][_0x8282('0x2e')]||_0x45dd08[_0x8282('0x2f')],'uniqueid':members[_0x230ec4][_0x8282('0x13')]||_0x45dd08[_0x8282('0x13')]});utils[_0x8282('0x4')](util[_0x8282('0x11')](_0x8282('0x30'),_0x45dd08[_0x8282('0x13')],members[_0x230ec4][_0x8282('0x2c')],members[_0x230ec4][_0x8282('0x7')],members[_0x230ec4][_0x8282('0x2e')]));if(members[_0x230ec4][_0x8282('0x21')]){writeDB(members[_0x230ec4]);}}}if(_0x45dd08[_0x8282('0x31')]){var _0x4095bf=_0x45dd08[_0x8282('0x31')][_0x8282('0x2b')]('-')[0x0];if(!_[_0x8282('0x20')](members[_0x4095bf])){members[_0x4095bf]=_[_0x8282('0x32')](members[_0x4095bf],{'data1':members[_0x4095bf]['data1']||_0x45dd08[_0x8282('0x9')],'data2':members[_0x4095bf][_0x8282('0x7')]||_0x45dd08['source'],'data3':members[_0x4095bf][_0x8282('0x2e')]||_0x45dd08[_0x8282('0x2f')],'uniqueid':members[_0x4095bf][_0x8282('0x13')]||_0x45dd08[_0x8282('0x13')]});utils[_0x8282('0x4')](util[_0x8282('0x11')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x45dd08['uniqueid'],members[_0x4095bf][_0x8282('0x2c')],members[_0x4095bf][_0x8282('0x7')],members[_0x4095bf][_0x8282('0x2e')]));if(members[_0x4095bf][_0x8282('0x21')]){writeDB(members[_0x4095bf]);}}}}catch(_0x337bb5){utils[_0x8282('0x10')](util[_0x8282('0x11')](_0x8282('0x29'),_0x45dd08['uniqueid']),_0x337bb5);}}; \ No newline at end of file +var _0xd4a0=['info','state','INUSE','BUSY','TALKING','now','agent','isNil','exitAt','duration','diffTime','agentcomplete','queue','error','[%s][members][agentcomplete]','cdr','assign','data1','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','lodash','util','./utils','Local/_attended@transfer','format','uniqueid','channel','data2','membername','type','interface','then','name','internal','CreateMemberReport','split','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device'];(function(_0x5f04b3,_0x16c176){var _0x4624be=function(_0x3d2fd5){while(--_0x3d2fd5){_0x5f04b3['push'](_0x5f04b3['shift']());}};_0x4624be(++_0x16c176);}(_0xd4a0,0x187));var _0x0d4a=function(_0x1be4c9,_0x4cdd15){_0x1be4c9=_0x1be4c9-0x0;var _0x10f71e=_0xd4a0[_0x1be4c9];return _0x10f71e;};'use strict';var _=require(_0x0d4a('0x0'));var util=require(_0x0d4a('0x1'));var utils=require(_0x0d4a('0x2'));var members={};var exclude=[_0x0d4a('0x3'),'Queue:'];function writeDB(_0x40c2f1){utils['info'](util[_0x0d4a('0x4')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x40c2f1[_0x0d4a('0x5')],_0x40c2f1['interface'],_0x40c2f1[_0x0d4a('0x6')],_0x40c2f1[_0x0d4a('0x7')],_0x40c2f1[_0x0d4a('0x8')],_0x40c2f1[_0x0d4a('0x9')]));if(_0x40c2f1[_0x0d4a('0xa')]){utils['getUserByInterface'](_0x40c2f1['interface'])[_0x0d4a('0xb')](function(_0xed04f5){if(_0xed04f5){_0x40c2f1[_0x0d4a('0x8')]=_0xed04f5[_0x0d4a('0xc')];_0x40c2f1[_0x0d4a('0xd')]=_0xed04f5[_0x0d4a('0xd')];utils['request'](_0x0d4a('0xe'),_0x40c2f1);}else{utils['getUserByName'](_0x40c2f1['interface'][_0x0d4a('0xf')]('/')[0x1])['then'](function(_0x519eb3){if(_0x519eb3){_0x40c2f1[_0x0d4a('0x8')]=_0x519eb3[_0x0d4a('0xc')];_0x40c2f1['internal']=_0x519eb3[_0x0d4a('0xd')];utils['request'](_0x0d4a('0xe'),_0x40c2f1);}});}})['catch'](function(_0x173478){utils['error'](util[_0x0d4a('0x4')](_0x0d4a('0x10'),_0x40c2f1[_0x0d4a('0x5')]),_0x173478);});}delete members[_0x40c2f1[_0x0d4a('0xa')]];}function startsWith(_0x2cbd45,_0x43cc83){return _[_0x0d4a('0x11')](_0x2cbd45,function(_0x137255){return _[_0x0d4a('0x12')](_0x43cc83,_0x137255);});}exports[_0x0d4a('0x13')]=function(_0x379041){try{utils[_0x0d4a('0x14')](util[_0x0d4a('0x4')](_0x0d4a('0x15'),members[_0x379041[_0x0d4a('0x16')]]?members[_0x379041[_0x0d4a('0x16')]][_0x0d4a('0x5')]:_0x379041[_0x0d4a('0x16')]),_0x379041);utils[_0x0d4a('0x17')](util[_0x0d4a('0x4')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x379041['device']]?members[_0x379041[_0x0d4a('0x16')]][_0x0d4a('0x5')]:_0x379041[_0x0d4a('0x16')],_0x379041['state'],_0x379041[_0x0d4a('0x16')]));switch(_0x379041[_0x0d4a('0x18')]){case _0x0d4a('0x19'):case _0x0d4a('0x1a'):if(!startsWith(exclude,_0x379041['device'])){members[_0x379041[_0x0d4a('0x16')]]={'channel':'voice','interface':_0x379041[_0x0d4a('0x16')],'type':_0x0d4a('0x1b'),'enterAt':utils[_0x0d4a('0x1c')](),'role':_0x0d4a('0x1d')};}break;case'NOT_INUSE':if(!_[_0x0d4a('0x1e')](members[_0x379041[_0x0d4a('0x16')]])){members[_0x379041['device']][_0x0d4a('0x1f')]=utils['now']();members[_0x379041[_0x0d4a('0x16')]][_0x0d4a('0x20')]=utils[_0x0d4a('0x21')](members[_0x379041[_0x0d4a('0x16')]][_0x0d4a('0x1f')],members[_0x379041[_0x0d4a('0x16')]]['enterAt']);if(members[_0x379041['device']][_0x0d4a('0x5')]){writeDB(members[_0x379041['device']]);}}break;default:break;}}catch(_0x57a70d){utils['error'](util[_0x0d4a('0x4')]('[%s][members][devicestatechange]',members[_0x379041[_0x0d4a('0x16')]]?members[_0x379041[_0x0d4a('0x16')]][_0x0d4a('0x5')]:_0x379041[_0x0d4a('0x16')]),_0x57a70d);}};exports[_0x0d4a('0x22')]=function(_0x5d73d6){try{if(!_[_0x0d4a('0x1e')](members[_0x5d73d6[_0x0d4a('0xa')]])){utils[_0x0d4a('0x14')](util[_0x0d4a('0x4')]('[%s][members][agentcomplete]',_0x5d73d6[_0x0d4a('0x5')]),_0x5d73d6);utils[_0x0d4a('0x17')](util[_0x0d4a('0x4')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x5d73d6[_0x0d4a('0x5')],_0x5d73d6[_0x0d4a('0xa')],_0x5d73d6[_0x0d4a('0x23')]));members[_0x5d73d6['interface']]=_['assign'](members[_0x5d73d6['interface']],{'data4':_0x5d73d6[_0x0d4a('0x23')],'uniqueid':_0x5d73d6['uniqueid']});}}catch(_0x5ecb38){utils[_0x0d4a('0x24')](util[_0x0d4a('0x4')](_0x0d4a('0x25'),_0x5d73d6[_0x0d4a('0x5')]),_0x5ecb38);}};exports[_0x0d4a('0x26')]=function(_0x3bec98){try{utils[_0x0d4a('0x14')](util[_0x0d4a('0x4')]('[%s][members][cdr]',_0x3bec98[_0x0d4a('0x5')]),_0x3bec98);if(_0x3bec98[_0x0d4a('0x6')]){var _0x3b2a2d=_0x3bec98['channel']['split']('-')[0x0];if(!_[_0x0d4a('0x1e')](members[_0x3b2a2d])){members[_0x3b2a2d]=_[_0x0d4a('0x27')](members[_0x3b2a2d],{'data1':members[_0x3b2a2d][_0x0d4a('0x28')]||_0x3bec98['type'],'data2':members[_0x3b2a2d][_0x0d4a('0x7')]||_0x3bec98[_0x0d4a('0x29')],'data3':members[_0x3b2a2d][_0x0d4a('0x2a')]||_0x3bec98[_0x0d4a('0x2b')],'uniqueid':members[_0x3b2a2d][_0x0d4a('0x5')]||_0x3bec98[_0x0d4a('0x5')]});utils[_0x0d4a('0x17')](util['format'](_0x0d4a('0x2c'),_0x3bec98[_0x0d4a('0x5')],members[_0x3b2a2d]['data1'],members[_0x3b2a2d]['data2'],members[_0x3b2a2d]['data3']));if(members[_0x3b2a2d][_0x0d4a('0x1f')]){writeDB(members[_0x3b2a2d]);}}}if(_0x3bec98['destinationchannel']){var _0x33096c=_0x3bec98[_0x0d4a('0x2d')][_0x0d4a('0xf')]('-')[0x0];if(!_['isNil'](members[_0x33096c])){members[_0x33096c]=_[_0x0d4a('0x27')](members[_0x33096c],{'data1':members[_0x33096c][_0x0d4a('0x28')]||_0x3bec98['type'],'data2':members[_0x33096c]['data2']||_0x3bec98[_0x0d4a('0x29')],'data3':members[_0x33096c][_0x0d4a('0x2a')]||_0x3bec98[_0x0d4a('0x2b')],'uniqueid':members[_0x33096c]['uniqueid']||_0x3bec98[_0x0d4a('0x5')]});utils[_0x0d4a('0x17')](util[_0x0d4a('0x4')](_0x0d4a('0x2c'),_0x3bec98[_0x0d4a('0x5')],members[_0x33096c][_0x0d4a('0x28')],members[_0x33096c]['data2'],members[_0x33096c][_0x0d4a('0x2a')]));if(members[_0x33096c][_0x0d4a('0x1f')]){writeDB(members[_0x33096c]);}}}}catch(_0x247544){utils[_0x0d4a('0x24')](util[_0x0d4a('0x4')]('[%s][members][cdr]',_0x3bec98[_0x0d4a('0x5')]),_0x247544);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 8633148..46c143c 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 _0xfbe6=['transfereeuniqueid','BLIND','extension','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][blindtransfer]','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','transfertype','ATTENDED','transferexten','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','queuecallerenterreason','calleridnum','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','transferuniqueid','transfertargetlinkedid','holdtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]','lodash','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','hangup','isNil','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercompleteAt','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][hangup]','varset','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','name','queueposition','EXITWITHKEY','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','assigned','destaccountcode','agentcomplete','[%s][queues][agentcomplete]','queuecallercomplete','reason','transfer','TRANSFER','COMPLETEDBY','blindtransfer'];(function(_0x121d9e,_0x11b966){var _0x5df466=function(_0x519340){while(--_0x519340){_0x121d9e['push'](_0x121d9e['shift']());}};_0x5df466(++_0x11b966);}(_0xfbe6,0xf9));var _0x6fbe=function(_0x69e6aa,_0x152421){_0x69e6aa=_0x69e6aa-0x0;var _0x5453c4=_0xfbe6[_0x69e6aa];return _0x5453c4;};'use strict';var _=require(_0x6fbe('0x0'));var util=require('util');var utils=require(_0x6fbe('0x1'));var queues={};function writeDB(_0x241687){utils[_0x6fbe('0x2')](util[_0x6fbe('0x3')](_0x6fbe('0x4'),_0x241687[_0x6fbe('0x5')],_0x241687[_0x6fbe('0x6')],_0x241687[_0x6fbe('0x7')],_0x241687[_0x6fbe('0x8')],_0x241687['calleridnum'],_0x241687['accountcode'],_0x241687[_0x6fbe('0x9')]));if(_0x241687['queue']){utils[_0x6fbe('0xa')](_0x241687['queue'])[_0x6fbe('0xb')](function(_0x4bce43){if(_0x4bce43){_0x241687['type']=_0x4bce43[_0x6fbe('0xc')];}utils[_0x6fbe('0xd')]('CreateVoiceQueueReport',_0x241687);});}else{utils[_0x6fbe('0xd')](_0x6fbe('0xe'),_0x241687);}if(_0x241687['transfereduniqueid']){delete queues[_0x241687[_0x6fbe('0xf')]];}else{delete queues[_0x241687['uniqueid']];}}exports[_0x6fbe('0x10')]=function(_0x37289e){try{utils[_0x6fbe('0x11')](util[_0x6fbe('0x3')](_0x6fbe('0x12'),_0x37289e[_0x6fbe('0x5')]),_0x37289e);utils[_0x6fbe('0x2')](util['format'](_0x6fbe('0x13'),_0x37289e['uniqueid'],_0x37289e['queue'],_0x37289e[_0x6fbe('0x14')]));queues[_0x37289e[_0x6fbe('0x5')]]=_[_0x6fbe('0x15')](_0x37289e,{'originalposition':_0x37289e['position'],'queuecallerjoinAt':utils[_0x6fbe('0x16')](),'mohtime':0x0});}catch(_0x11d54a){utils[_0x6fbe('0x17')](util[_0x6fbe('0x3')](_0x6fbe('0x12'),_0x37289e[_0x6fbe('0x5')]),_0x11d54a);}};exports[_0x6fbe('0x18')]=function(_0x50be51){try{if(!_[_0x6fbe('0x19')](queues[_0x50be51[_0x6fbe('0x5')]])){utils[_0x6fbe('0x11')](util['format']('[%s][queues][hangup]',_0x50be51[_0x6fbe('0x5')]),_0x50be51);if(queues[_0x50be51['uniqueid']][_0x6fbe('0x1a')]){if(!queues[_0x50be51[_0x6fbe('0x5')]][_0x6fbe('0x1b')]&&!queues[_0x50be51[_0x6fbe('0x5')]][_0x6fbe('0x1c')]){queues[_0x50be51[_0x6fbe('0x5')]]['queuecallercomplete']=!![];queues[_0x50be51['uniqueid']][_0x6fbe('0x1d')]=utils[_0x6fbe('0x16')]();queues[_0x50be51['uniqueid']][_0x6fbe('0x9')]='COMPLETEDBYAGENT';}utils[_0x6fbe('0x2')](util['format']('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x50be51[_0x6fbe('0x5')],queues[_0x50be51['uniqueid']]['name'],queues[_0x50be51[_0x6fbe('0x5')]]['queuecallerexitreason']));writeDB(queues[_0x50be51[_0x6fbe('0x5')]]);}else if(queues[_0x50be51['uniqueid']][_0x6fbe('0xf')]){utils[_0x6fbe('0x2')](util['format'](_0x6fbe('0x1e'),_0x50be51[_0x6fbe('0x5')],queues[_0x50be51[_0x6fbe('0x5')]]['name'],queues[_0x50be51[_0x6fbe('0x5')]]['transfereduniqueid']));queues[queues[_0x50be51[_0x6fbe('0x5')]][_0x6fbe('0xf')]]=queues[_0x50be51[_0x6fbe('0x5')]];queues[queues[_0x50be51[_0x6fbe('0x5')]][_0x6fbe('0xf')]]['queuecallerenterreason']=0x2;delete queues[_0x50be51['uniqueid']];}}}catch(_0x471bba){utils[_0x6fbe('0x17')](util[_0x6fbe('0x3')](_0x6fbe('0x1f'),_0x50be51[_0x6fbe('0x5')]),_0x471bba);}};exports[_0x6fbe('0x20')]=function(_0x43e342){try{utils[_0x6fbe('0x11')](util['format'](_0x6fbe('0x21'),_0x43e342[_0x6fbe('0x5')]),_0x43e342);if(!_[_0x6fbe('0x19')](_0x43e342[_0x6fbe('0x22')][_0x6fbe('0x23')])&&_0x43e342[_0x6fbe('0x24')][_0x6fbe('0x25')]()!==_0x6fbe('0x26')){if(!_['isNil'](queues[_0x43e342['uniqueid']])){queues[_0x43e342[_0x6fbe('0x5')]][_0x6fbe('0x1b')]=![];queues[_0x43e342['uniqueid']][_0x6fbe('0x27')]=null;queues[_0x43e342[_0x6fbe('0x5')]]['queuecallerexit']=!![];queues[_0x43e342[_0x6fbe('0x5')]][_0x6fbe('0x28')]=utils[_0x6fbe('0x16')]();queues[_0x43e342[_0x6fbe('0x5')]][_0x6fbe('0x9')]=_0x43e342[_0x6fbe('0x24')][_0x6fbe('0x25')]();utils['info'](util[_0x6fbe('0x3')](_0x6fbe('0x29'),_0x43e342[_0x6fbe('0x5')],queues[_0x43e342[_0x6fbe('0x5')]][_0x6fbe('0x2a')],_0x43e342[_0x6fbe('0x24')],queues[_0x43e342['uniqueid']][_0x6fbe('0x9')]));writeDB(queues[_0x43e342['uniqueid']]);}}else if(!_[_0x6fbe('0x19')](_0x43e342[_0x6fbe('0x22')][_0x6fbe('0x2b')])){if(!_[_0x6fbe('0x19')](queues[_0x43e342['uniqueid']])&&!queues[_0x43e342['uniqueid']]['queuecallerabandon']){queues[_0x43e342[_0x6fbe('0x5')]][_0x6fbe('0x1b')]=![];queues[_0x43e342['uniqueid']][_0x6fbe('0x27')]=null;queues[_0x43e342['uniqueid']]['queuecallerexit']=!![];queues[_0x43e342[_0x6fbe('0x5')]][_0x6fbe('0x28')]=utils[_0x6fbe('0x16')]();queues[_0x43e342[_0x6fbe('0x5')]][_0x6fbe('0x9')]=_0x6fbe('0x2c');utils[_0x6fbe('0x2')](util[_0x6fbe('0x3')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x43e342[_0x6fbe('0x5')],queues[_0x43e342['uniqueid']][_0x6fbe('0x2a')],_0x43e342[_0x6fbe('0x24')],queues[_0x43e342['uniqueid']][_0x6fbe('0x9')]));}}}catch(_0x263b9e){utils[_0x6fbe('0x17')](util[_0x6fbe('0x3')](_0x6fbe('0x21'),_0x43e342['uniqueid']),_0x263b9e);}};exports[_0x6fbe('0x1b')]=function(_0x2013a6){try{if(!_[_0x6fbe('0x19')](queues[_0x2013a6[_0x6fbe('0x5')]])){utils[_0x6fbe('0x11')](util[_0x6fbe('0x3')]('[%s][queues][queuecallerabandon]',_0x2013a6[_0x6fbe('0x5')]),_0x2013a6);queues[_0x2013a6[_0x6fbe('0x5')]]['queuecallerexit']=![];queues[_0x2013a6[_0x6fbe('0x5')]][_0x6fbe('0x28')]=null;queues[_0x2013a6[_0x6fbe('0x5')]]['queuecallerabandon']=!![];queues[_0x2013a6['uniqueid']][_0x6fbe('0x27')]=utils['now']();queues[_0x2013a6[_0x6fbe('0x5')]][_0x6fbe('0x9')]=_0x6fbe('0x2d');utils[_0x6fbe('0x2')](util[_0x6fbe('0x3')](_0x6fbe('0x2e'),_0x2013a6['uniqueid'],queues[_0x2013a6[_0x6fbe('0x5')]]['name'],queues[_0x2013a6[_0x6fbe('0x5')]][_0x6fbe('0x9')]));}}catch(_0x3561de){utils[_0x6fbe('0x17')](util['format'](_0x6fbe('0x2f'),_0x2013a6['uniqueid']),_0x3561de);}};exports[_0x6fbe('0x30')]=function(_0x1cbfc8){try{if(!_[_0x6fbe('0x19')](queues[_0x1cbfc8['uniqueid']])){utils[_0x6fbe('0x11')](util[_0x6fbe('0x3')](_0x6fbe('0x31'),_0x1cbfc8[_0x6fbe('0x5')]),_0x1cbfc8);utils[_0x6fbe('0x2')](util['format'](_0x6fbe('0x32'),_0x1cbfc8[_0x6fbe('0x5')],queues[_0x1cbfc8['uniqueid']][_0x6fbe('0x2a')],_0x1cbfc8[_0x6fbe('0x33')],_0x1cbfc8[_0x6fbe('0x34')]));queues[_0x1cbfc8[_0x6fbe('0x5')]][_0x6fbe('0x30')]=!![];queues[_0x1cbfc8[_0x6fbe('0x5')]][_0x6fbe('0x1a')]=utils[_0x6fbe('0x16')]();queues[_0x1cbfc8[_0x6fbe('0x5')]]['holdtime']=utils['diffTime'](queues[_0x1cbfc8[_0x6fbe('0x5')]][_0x6fbe('0x1a')],queues[_0x1cbfc8[_0x6fbe('0x5')]][_0x6fbe('0x35')]);queues[_0x1cbfc8[_0x6fbe('0x5')]][_0x6fbe('0x14')]=_0x1cbfc8[_0x6fbe('0x14')];queues[_0x1cbfc8[_0x6fbe('0x5')]][_0x6fbe('0x36')]=_0x1cbfc8[_0x6fbe('0x36')];queues[_0x1cbfc8[_0x6fbe('0x5')]][_0x6fbe('0x33')]=_0x1cbfc8['connectedlinenum'];queues[_0x1cbfc8[_0x6fbe('0x5')]]['connectedlinename']=_0x1cbfc8[_0x6fbe('0x34')];}}catch(_0x39924c){utils[_0x6fbe('0x17')](util[_0x6fbe('0x3')](_0x6fbe('0x31'),_0x1cbfc8[_0x6fbe('0x5')]),_0x39924c);}};exports[_0x6fbe('0x37')]=function(_0x5e0c42){try{if(!_['isNil'](queues[_0x5e0c42[_0x6fbe('0x5')]])){utils[_0x6fbe('0x11')](util['format'](_0x6fbe('0x38'),_0x5e0c42[_0x6fbe('0x5')]),_0x5e0c42);utils[_0x6fbe('0x2')](util['format'](_0x6fbe('0x39'),_0x5e0c42[_0x6fbe('0x5')],queues[_0x5e0c42[_0x6fbe('0x5')]][_0x6fbe('0x2a')],_0x5e0c42[_0x6fbe('0x3a')],_0x5e0c42['destaccountcode']));queues[_0x5e0c42['uniqueid']]['queuecallerabandon']=![];queues[_0x5e0c42['uniqueid']][_0x6fbe('0x1b')]=![];queues[_0x5e0c42[_0x6fbe('0x5')]]['queuecallerabandonAt']=null;queues[_0x5e0c42[_0x6fbe('0x5')]][_0x6fbe('0x1c')]=![];queues[_0x5e0c42['uniqueid']][_0x6fbe('0x9')]=null;queues[_0x5e0c42['uniqueid']]['queuecallerexitAt']=null;queues[_0x5e0c42[_0x6fbe('0x5')]][_0x6fbe('0x3b')]=!![];queues[_0x5e0c42[_0x6fbe('0x5')]]['accountcode']=_0x5e0c42[_0x6fbe('0x3c')];queues[_0x5e0c42[_0x6fbe('0x5')]][_0x6fbe('0x8')]=_0x5e0c42[_0x6fbe('0x3a')];}}catch(_0x8be494){utils[_0x6fbe('0x17')](util[_0x6fbe('0x3')](_0x6fbe('0x38'),_0x5e0c42[_0x6fbe('0x5')]),_0x8be494);}};exports[_0x6fbe('0x3d')]=function(_0xd1fe3c){try{if(!_['isNil'](queues[_0xd1fe3c[_0x6fbe('0x5')]])){if(queues[_0xd1fe3c[_0x6fbe('0x5')]][_0x6fbe('0x1a')]){utils[_0x6fbe('0x11')](util['format'](_0x6fbe('0x3e'),_0xd1fe3c['uniqueid']),_0xd1fe3c);queues[_0xd1fe3c[_0x6fbe('0x5')]][_0x6fbe('0x1b')]=![];queues[_0xd1fe3c[_0x6fbe('0x5')]][_0x6fbe('0x1b')]=![];queues[_0xd1fe3c[_0x6fbe('0x5')]][_0x6fbe('0x27')]=null;queues[_0xd1fe3c[_0x6fbe('0x5')]][_0x6fbe('0x1c')]=![];queues[_0xd1fe3c[_0x6fbe('0x5')]][_0x6fbe('0x28')]=null;queues[_0xd1fe3c['uniqueid']][_0x6fbe('0x3b')]=!![];queues[_0xd1fe3c[_0x6fbe('0x5')]]['lastAssignedTo']=_0xd1fe3c[_0x6fbe('0x3a')];queues[_0xd1fe3c[_0x6fbe('0x5')]][_0x6fbe('0x3f')]=!![];queues[_0xd1fe3c[_0x6fbe('0x5')]][_0x6fbe('0x1d')]=utils[_0x6fbe('0x16')]();if(_0xd1fe3c[_0x6fbe('0x40')]==_0x6fbe('0x41')){if(!queues[_0xd1fe3c[_0x6fbe('0x5')]][_0x6fbe('0x41')]){queues[_0xd1fe3c[_0x6fbe('0x5')]]['queuecallerexitreason']=_0x6fbe('0x42');}}else{queues[_0xd1fe3c['uniqueid']][_0x6fbe('0x9')]=_0x6fbe('0x43')+_0xd1fe3c[_0x6fbe('0x40')][_0x6fbe('0x25')]();}utils[_0x6fbe('0x2')](util[_0x6fbe('0x3')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0xd1fe3c['uniqueid'],queues[_0xd1fe3c['uniqueid']][_0x6fbe('0x2a')],_0xd1fe3c['membername'],queues[_0xd1fe3c[_0x6fbe('0x5')]][_0x6fbe('0x9')]));writeDB(queues[_0xd1fe3c['uniqueid']]);}}}catch(_0x256230){utils[_0x6fbe('0x17')](util[_0x6fbe('0x3')]('[%s][queues][agentcomplete]',_0xd1fe3c[_0x6fbe('0x5')]),_0x256230);}};exports[_0x6fbe('0x44')]=function(_0x24353f){try{if(!_[_0x6fbe('0x19')](queues[_0x24353f['transfereeuniqueid']])){utils[_0x6fbe('0x11')](util[_0x6fbe('0x3')]('[%s][queues][blindtransfer]',_0x24353f[_0x6fbe('0x5')]),_0x24353f);queues[_0x24353f['transfereeuniqueid']]['transfer']=!![];queues[_0x24353f[_0x6fbe('0x45')]]['transfertype']=_0x6fbe('0x46');queues[_0x24353f[_0x6fbe('0x45')]]['transferexten']=_0x24353f[_0x6fbe('0x47')];queues[_0x24353f[_0x6fbe('0x45')]]['transferuniqueid']=_0x24353f[_0x6fbe('0x45')];queues[_0x24353f['transfereeuniqueid']][_0x6fbe('0x9')]=_0x6fbe('0x48');utils[_0x6fbe('0x2')](util[_0x6fbe('0x3')](_0x6fbe('0x49'),_0x24353f['uniqueid'],queues[_0x24353f['transfereeuniqueid']]['name'],_0x24353f[_0x6fbe('0x45')],_0x24353f['extension']));}}catch(_0x50178e){utils[_0x6fbe('0x17')](util[_0x6fbe('0x3')](_0x6fbe('0x4a'),_0x24353f['uniqueid']),_0x50178e);}};exports['attendedtransfer']=function(_0x1ec879){try{utils[_0x6fbe('0x11')](util[_0x6fbe('0x3')](_0x6fbe('0x4b'),_0x1ec879[_0x6fbe('0x4c')]),_0x1ec879);if(_0x1ec879['origtransfereruniqueid']==_0x1ec879[_0x6fbe('0x4d')]){if(!_[_0x6fbe('0x19')](queues[_0x1ec879[_0x6fbe('0x4e')]])){utils[_0x6fbe('0x2')](util['format'](_0x6fbe('0x4f'),_0x1ec879['origtransfereruniqueid'],queues[_0x1ec879[_0x6fbe('0x4e')]][_0x6fbe('0x2a')],_0x1ec879[_0x6fbe('0x50')]));queues[_0x1ec879['secondtransfererlinkedid']][_0x6fbe('0x41')]=!![];queues[_0x1ec879['secondtransfererlinkedid']][_0x6fbe('0x51')]=_0x6fbe('0x52');queues[_0x1ec879[_0x6fbe('0x4e')]][_0x6fbe('0x53')]=_0x1ec879[_0x6fbe('0x50')];queues[_0x1ec879['secondtransfererlinkedid']]['transferuniqueid']=_0x1ec879[_0x6fbe('0x4c')];queues[_0x1ec879[_0x6fbe('0x4e')]][_0x6fbe('0x9')]=_0x6fbe('0x54');}if(!_[_0x6fbe('0x19')](queues[_0x1ec879[_0x6fbe('0x4d')]])){if(_0x1ec879[_0x6fbe('0x55')]&&queues[_0x1ec879['transfereelinkedid']]){queues[_0x1ec879[_0x6fbe('0x55')]]['queuecallerenterreason']=0x1;queues[_0x1ec879[_0x6fbe('0x45')]]=_[_0x6fbe('0x56')](queues[_0x1ec879[_0x6fbe('0x55')]]);queues[_0x1ec879[_0x6fbe('0x45')]][_0x6fbe('0xf')]=_0x1ec879[_0x6fbe('0x57')];queues[_0x1ec879[_0x6fbe('0x45')]][_0x6fbe('0x58')]=0x2;queues[_0x1ec879[_0x6fbe('0x45')]]['calleridnum']=queues[_0x1ec879['secondtransfererlinkedid']][_0x6fbe('0x59')];queues[_0x1ec879['transfereeuniqueid']][_0x6fbe('0x5a')]=queues[_0x1ec879[_0x6fbe('0x4e')]]['calleridname'];queues[_0x1ec879[_0x6fbe('0x45')]]['queuecallerjoinAt']=utils[_0x6fbe('0x16')]();queues[_0x1ec879[_0x6fbe('0x45')]][_0x6fbe('0x1a')]=utils[_0x6fbe('0x16')]();queues[_0x1ec879['transfereeuniqueid']]['holdtime']=0x0;queues[_0x1ec879[_0x6fbe('0x45')]][_0x6fbe('0x5b')]=0x0;utils[_0x6fbe('0x2')](util[_0x6fbe('0x3')](_0x6fbe('0x5c'),_0x1ec879[_0x6fbe('0x4c')],queues[_0x1ec879[_0x6fbe('0x45')]][_0x6fbe('0x2a')],queues[_0x1ec879[_0x6fbe('0x45')]][_0x6fbe('0x59')],queues[_0x1ec879[_0x6fbe('0x45')]][_0x6fbe('0x5a')]));}else{utils[_0x6fbe('0x2')](util[_0x6fbe('0x3')](_0x6fbe('0x5d'),_0x1ec879['origtransfereruniqueid'],queues[_0x1ec879[_0x6fbe('0x4d')]][_0x6fbe('0x2a')],_0x1ec879[_0x6fbe('0x4e')]));queues[_0x1ec879[_0x6fbe('0x4d')]][_0x6fbe('0xf')]=_0x1ec879['secondtransfererlinkedid'];}}}else if(_0x1ec879[_0x6fbe('0x5e')]==_0x1ec879[_0x6fbe('0x4e')]){if(!_[_0x6fbe('0x19')](queues[_0x1ec879[_0x6fbe('0x4d')]])){utils[_0x6fbe('0x2')](util[_0x6fbe('0x3')](_0x6fbe('0x5f'),_0x1ec879[_0x6fbe('0x4c')],queues[_0x1ec879[_0x6fbe('0x4d')]][_0x6fbe('0x2a')],_0x1ec879[_0x6fbe('0x5e')],_0x1ec879[_0x6fbe('0x60')]));queues[_0x1ec879['origtransfererlinkedid']][_0x6fbe('0x41')]=!![];queues[_0x1ec879[_0x6fbe('0x4d')]][_0x6fbe('0x51')]='ATTENDED';queues[_0x1ec879[_0x6fbe('0x4d')]][_0x6fbe('0x53')]=_0x1ec879[_0x6fbe('0x60')];queues[_0x1ec879[_0x6fbe('0x4d')]][_0x6fbe('0x61')]=_0x1ec879[_0x6fbe('0x5e')];queues[_0x1ec879[_0x6fbe('0x4d')]][_0x6fbe('0x9')]='ATTENDEDTRANSFER';}if(!_[_0x6fbe('0x19')](queues[_0x1ec879[_0x6fbe('0x4e')]])){if(_0x1ec879[_0x6fbe('0x62')]&&queues[_0x1ec879[_0x6fbe('0x62')]]){queues[_0x1ec879[_0x6fbe('0x62')]][_0x6fbe('0x58')]=0x1;queues[_0x1ec879[_0x6fbe('0x57')]]=_[_0x6fbe('0x56')](queues[_0x1ec879[_0x6fbe('0x62')]]);queues[_0x1ec879[_0x6fbe('0x57')]][_0x6fbe('0xf')]=_0x1ec879[_0x6fbe('0x57')];queues[_0x1ec879[_0x6fbe('0x57')]][_0x6fbe('0x58')]=0x2;queues[_0x1ec879[_0x6fbe('0x57')]][_0x6fbe('0x59')]=queues[_0x1ec879[_0x6fbe('0x4d')]][_0x6fbe('0x59')];queues[_0x1ec879['transfertargetuniqueid']][_0x6fbe('0x5a')]=queues[_0x1ec879[_0x6fbe('0x4d')]][_0x6fbe('0x5a')];queues[_0x1ec879[_0x6fbe('0x57')]][_0x6fbe('0x35')]=utils['now']();queues[_0x1ec879[_0x6fbe('0x57')]][_0x6fbe('0x1a')]=utils['now']();queues[_0x1ec879[_0x6fbe('0x57')]][_0x6fbe('0x63')]=0x0;queues[_0x1ec879[_0x6fbe('0x57')]]['mohtime']=0x0;utils[_0x6fbe('0x2')](util['format'](_0x6fbe('0x64'),_0x1ec879['origtransfereruniqueid'],queues[_0x1ec879[_0x6fbe('0x57')]]['name'],queues[_0x1ec879[_0x6fbe('0x57')]][_0x6fbe('0xf')],queues[_0x1ec879['transfertargetuniqueid']][_0x6fbe('0x59')],queues[_0x1ec879[_0x6fbe('0x57')]][_0x6fbe('0x5a')]));}else{utils[_0x6fbe('0x2')](util[_0x6fbe('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x1ec879[_0x6fbe('0x4c')],queues[_0x1ec879[_0x6fbe('0x4e')]][_0x6fbe('0x2a')],_0x1ec879['origtransfererlinkedid']));queues[_0x1ec879[_0x6fbe('0x4e')]][_0x6fbe('0xf')]=_0x1ec879['origtransfererlinkedid'];}}}}catch(_0x25fd7f){utils['error'](util[_0x6fbe('0x3')](_0x6fbe('0x4b'),_0x1ec879[_0x6fbe('0x4c')]),_0x25fd7f);}};exports[_0x6fbe('0x65')]=function(_0x53df36){try{if(!_[_0x6fbe('0x19')](queues[_0x53df36['uniqueid']])){utils['debug'](util[_0x6fbe('0x3')](_0x6fbe('0x66'),_0x53df36[_0x6fbe('0x5')]),_0x53df36);queues[_0x53df36['uniqueid']][_0x6fbe('0x67')]=utils[_0x6fbe('0x16')]();utils[_0x6fbe('0x2')](util[_0x6fbe('0x3')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x53df36[_0x6fbe('0x5')],queues[_0x53df36[_0x6fbe('0x5')]][_0x6fbe('0x2a')],queues[_0x53df36['uniqueid']]['musiconholdstartAt']));}}catch(_0x3f7266){utils[_0x6fbe('0x17')](util[_0x6fbe('0x3')](_0x6fbe('0x66'),_0x53df36['uniqueid']),_0x3f7266);}};exports[_0x6fbe('0x68')]=function(_0x1ce461){try{if(!_[_0x6fbe('0x19')](queues[_0x1ce461[_0x6fbe('0x5')]])){if(!_[_0x6fbe('0x19')](queues[_0x1ce461[_0x6fbe('0x5')]]['musiconholdstartAt'])){utils['debug'](util[_0x6fbe('0x3')]('[%s][queues][musiconholdstop]',_0x1ce461[_0x6fbe('0x5')]),_0x1ce461);queues[_0x1ce461[_0x6fbe('0x5')]][_0x6fbe('0x5b')]+=utils['diffTime'](utils[_0x6fbe('0x16')](),queues[_0x1ce461[_0x6fbe('0x5')]][_0x6fbe('0x67')]);utils[_0x6fbe('0x2')](util[_0x6fbe('0x3')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x1ce461[_0x6fbe('0x5')],queues[_0x1ce461[_0x6fbe('0x5')]][_0x6fbe('0x2a')],queues[_0x1ce461[_0x6fbe('0x5')]][_0x6fbe('0x5b')]));delete queues[_0x1ce461[_0x6fbe('0x5')]][_0x6fbe('0x67')];}}}catch(_0x263d60){utils['error'](util[_0x6fbe('0x3')](_0x6fbe('0x69'),_0x1ce461['uniqueid']),_0x263d60);}}; \ No newline at end of file +var _0xf7c0=['transferexten','extension','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][blindtransfer]','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','origtransfererexten','ATTENDED','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','queuecallerenterreason','clone','transfertargetuniqueid','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','lodash','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','CreateVoiceQueueReport','request','transfereduniqueid','queuecallerjoin','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','hangup','isNil','debug','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','varset','[%s][queues][varset]','variable','queuestatus','value','CONTINUE','queuecallerexitAt','toUpperCase','queuecallerabandonAt','EXITWITHKEY','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]','holdtime','diffTime','queuecallerjoinAt','count','connectedlinenum','connectedlinename','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','assigned','destaccountcode','lastAssignedTo','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','COMPLETEDBY','transfereeuniqueid','transfertype'];(function(_0x161c2c,_0x4df35f){var _0x2359bb=function(_0x5c9c30){while(--_0x5c9c30){_0x161c2c['push'](_0x161c2c['shift']());}};_0x2359bb(++_0x4df35f);}(_0xf7c0,0x8b));var _0x0f7c=function(_0x35af61,_0x1e95ca){_0x35af61=_0x35af61-0x0;var _0x4d4c32=_0xf7c0[_0x35af61];return _0x4d4c32;};'use strict';var _=require(_0x0f7c('0x0'));var util=require(_0x0f7c('0x1'));var utils=require(_0x0f7c('0x2'));var queues={};function writeDB(_0x15ee7c){utils[_0x0f7c('0x3')](util[_0x0f7c('0x4')](_0x0f7c('0x5'),_0x15ee7c[_0x0f7c('0x6')],_0x15ee7c[_0x0f7c('0x7')],_0x15ee7c[_0x0f7c('0x8')],_0x15ee7c['lastAssignedTo'],_0x15ee7c[_0x0f7c('0x9')],_0x15ee7c[_0x0f7c('0xa')],_0x15ee7c[_0x0f7c('0xb')]));if(_0x15ee7c[_0x0f7c('0x8')]){utils[_0x0f7c('0xc')](_0x15ee7c[_0x0f7c('0x8')])[_0x0f7c('0xd')](function(_0x493677){if(_0x493677){_0x15ee7c['type']=_0x493677[_0x0f7c('0xe')];}utils['request'](_0x0f7c('0xf'),_0x15ee7c);});}else{utils[_0x0f7c('0x10')](_0x0f7c('0xf'),_0x15ee7c);}if(_0x15ee7c[_0x0f7c('0x11')]){delete queues[_0x15ee7c['transfereduniqueid']];}else{delete queues[_0x15ee7c['uniqueid']];}}exports[_0x0f7c('0x12')]=function(_0x52fba0){try{utils['debug'](util['format'](_0x0f7c('0x13'),_0x52fba0[_0x0f7c('0x6')]),_0x52fba0);utils['info'](util[_0x0f7c('0x4')](_0x0f7c('0x14'),_0x52fba0[_0x0f7c('0x6')],_0x52fba0['queue'],_0x52fba0[_0x0f7c('0x15')]));queues[_0x52fba0['uniqueid']]=_[_0x0f7c('0x16')](_0x52fba0,{'originalposition':_0x52fba0[_0x0f7c('0x15')],'queuecallerjoinAt':utils[_0x0f7c('0x17')](),'mohtime':0x0});}catch(_0x32b72e){utils[_0x0f7c('0x18')](util[_0x0f7c('0x4')](_0x0f7c('0x13'),_0x52fba0['uniqueid']),_0x32b72e);}};exports[_0x0f7c('0x19')]=function(_0x8b328f){try{if(!_[_0x0f7c('0x1a')](queues[_0x8b328f[_0x0f7c('0x6')]])){utils[_0x0f7c('0x1b')](util[_0x0f7c('0x4')](_0x0f7c('0x1c'),_0x8b328f[_0x0f7c('0x6')]),_0x8b328f);if(queues[_0x8b328f[_0x0f7c('0x6')]][_0x0f7c('0x1d')]){if(!queues[_0x8b328f[_0x0f7c('0x6')]][_0x0f7c('0x1e')]&&!queues[_0x8b328f['uniqueid']][_0x0f7c('0x1f')]){queues[_0x8b328f[_0x0f7c('0x6')]][_0x0f7c('0x20')]=!![];queues[_0x8b328f[_0x0f7c('0x6')]][_0x0f7c('0x21')]=utils[_0x0f7c('0x17')]();queues[_0x8b328f[_0x0f7c('0x6')]][_0x0f7c('0xb')]=_0x0f7c('0x22');}utils[_0x0f7c('0x3')](util['format'](_0x0f7c('0x23'),_0x8b328f['uniqueid'],queues[_0x8b328f[_0x0f7c('0x6')]][_0x0f7c('0x24')],queues[_0x8b328f[_0x0f7c('0x6')]][_0x0f7c('0xb')]));writeDB(queues[_0x8b328f[_0x0f7c('0x6')]]);}else if(queues[_0x8b328f[_0x0f7c('0x6')]]['transfereduniqueid']){utils[_0x0f7c('0x3')](util[_0x0f7c('0x4')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x8b328f['uniqueid'],queues[_0x8b328f[_0x0f7c('0x6')]][_0x0f7c('0x24')],queues[_0x8b328f[_0x0f7c('0x6')]]['transfereduniqueid']));queues[queues[_0x8b328f['uniqueid']]['transfereduniqueid']]=queues[_0x8b328f['uniqueid']];queues[queues[_0x8b328f[_0x0f7c('0x6')]][_0x0f7c('0x11')]]['queuecallerenterreason']=0x2;delete queues[_0x8b328f[_0x0f7c('0x6')]];}}}catch(_0x53c9ea){utils['error'](util[_0x0f7c('0x4')]('[%s][queues][hangup]',_0x8b328f['uniqueid']),_0x53c9ea);}};exports[_0x0f7c('0x25')]=function(_0x4f7643){try{utils['debug'](util[_0x0f7c('0x4')](_0x0f7c('0x26'),_0x4f7643[_0x0f7c('0x6')]),_0x4f7643);if(!_[_0x0f7c('0x1a')](_0x4f7643[_0x0f7c('0x27')][_0x0f7c('0x28')])&&_0x4f7643[_0x0f7c('0x29')]['toUpperCase']()!==_0x0f7c('0x2a')){if(!_[_0x0f7c('0x1a')](queues[_0x4f7643['uniqueid']])){queues[_0x4f7643[_0x0f7c('0x6')]][_0x0f7c('0x1e')]=![];queues[_0x4f7643[_0x0f7c('0x6')]]['queuecallerabandonAt']=null;queues[_0x4f7643['uniqueid']]['queuecallerexit']=!![];queues[_0x4f7643[_0x0f7c('0x6')]][_0x0f7c('0x2b')]=utils['now']();queues[_0x4f7643[_0x0f7c('0x6')]][_0x0f7c('0xb')]=_0x4f7643['value'][_0x0f7c('0x2c')]();utils[_0x0f7c('0x3')](util[_0x0f7c('0x4')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x4f7643[_0x0f7c('0x6')],queues[_0x4f7643['uniqueid']][_0x0f7c('0x24')],_0x4f7643['value'],queues[_0x4f7643['uniqueid']][_0x0f7c('0xb')]));writeDB(queues[_0x4f7643[_0x0f7c('0x6')]]);}}else if(!_[_0x0f7c('0x1a')](_0x4f7643['variable']['queueposition'])){if(!_['isNil'](queues[_0x4f7643['uniqueid']])&&!queues[_0x4f7643[_0x0f7c('0x6')]]['queuecallerabandon']){queues[_0x4f7643['uniqueid']][_0x0f7c('0x1e')]=![];queues[_0x4f7643[_0x0f7c('0x6')]][_0x0f7c('0x2d')]=null;queues[_0x4f7643[_0x0f7c('0x6')]][_0x0f7c('0x1f')]=!![];queues[_0x4f7643[_0x0f7c('0x6')]][_0x0f7c('0x2b')]=utils['now']();queues[_0x4f7643[_0x0f7c('0x6')]][_0x0f7c('0xb')]=_0x0f7c('0x2e');utils['info'](util[_0x0f7c('0x4')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x4f7643[_0x0f7c('0x6')],queues[_0x4f7643[_0x0f7c('0x6')]]['name'],_0x4f7643[_0x0f7c('0x29')],queues[_0x4f7643[_0x0f7c('0x6')]][_0x0f7c('0xb')]));}}}catch(_0x3afc87){utils[_0x0f7c('0x18')](util[_0x0f7c('0x4')](_0x0f7c('0x26'),_0x4f7643[_0x0f7c('0x6')]),_0x3afc87);}};exports['queuecallerabandon']=function(_0x228a97){try{if(!_[_0x0f7c('0x1a')](queues[_0x228a97[_0x0f7c('0x6')]])){utils[_0x0f7c('0x1b')](util[_0x0f7c('0x4')]('[%s][queues][queuecallerabandon]',_0x228a97[_0x0f7c('0x6')]),_0x228a97);queues[_0x228a97[_0x0f7c('0x6')]][_0x0f7c('0x1f')]=![];queues[_0x228a97[_0x0f7c('0x6')]]['queuecallerexitAt']=null;queues[_0x228a97[_0x0f7c('0x6')]][_0x0f7c('0x1e')]=!![];queues[_0x228a97[_0x0f7c('0x6')]][_0x0f7c('0x2d')]=utils['now']();queues[_0x228a97['uniqueid']][_0x0f7c('0xb')]=_0x0f7c('0x2f');utils[_0x0f7c('0x3')](util[_0x0f7c('0x4')](_0x0f7c('0x30'),_0x228a97[_0x0f7c('0x6')],queues[_0x228a97['uniqueid']][_0x0f7c('0x24')],queues[_0x228a97[_0x0f7c('0x6')]]['queuecallerexitreason']));}}catch(_0x282e28){utils[_0x0f7c('0x18')](util[_0x0f7c('0x4')](_0x0f7c('0x31'),_0x228a97[_0x0f7c('0x6')]),_0x282e28);}};exports[_0x0f7c('0x32')]=function(_0x23e161){try{if(!_[_0x0f7c('0x1a')](queues[_0x23e161['uniqueid']])){utils[_0x0f7c('0x1b')](util[_0x0f7c('0x4')](_0x0f7c('0x33'),_0x23e161[_0x0f7c('0x6')]),_0x23e161);utils['info'](util[_0x0f7c('0x4')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x23e161[_0x0f7c('0x6')],queues[_0x23e161[_0x0f7c('0x6')]][_0x0f7c('0x24')],_0x23e161['connectedlinenum'],_0x23e161['connectedlinename']));queues[_0x23e161[_0x0f7c('0x6')]][_0x0f7c('0x32')]=!![];queues[_0x23e161['uniqueid']][_0x0f7c('0x1d')]=utils[_0x0f7c('0x17')]();queues[_0x23e161[_0x0f7c('0x6')]][_0x0f7c('0x34')]=utils[_0x0f7c('0x35')](queues[_0x23e161[_0x0f7c('0x6')]][_0x0f7c('0x1d')],queues[_0x23e161[_0x0f7c('0x6')]][_0x0f7c('0x36')]);queues[_0x23e161[_0x0f7c('0x6')]][_0x0f7c('0x15')]=_0x23e161[_0x0f7c('0x15')];queues[_0x23e161[_0x0f7c('0x6')]][_0x0f7c('0x37')]=_0x23e161[_0x0f7c('0x37')];queues[_0x23e161['uniqueid']][_0x0f7c('0x38')]=_0x23e161[_0x0f7c('0x38')];queues[_0x23e161[_0x0f7c('0x6')]]['connectedlinename']=_0x23e161[_0x0f7c('0x39')];}}catch(_0x2d3755){utils['error'](util['format'](_0x0f7c('0x33'),_0x23e161[_0x0f7c('0x6')]),_0x2d3755);}};exports[_0x0f7c('0x3a')]=function(_0x137059){try{if(!_['isNil'](queues[_0x137059['uniqueid']])){utils['debug'](util[_0x0f7c('0x4')](_0x0f7c('0x3b'),_0x137059['uniqueid']),_0x137059);utils['info'](util['format'](_0x0f7c('0x3c'),_0x137059[_0x0f7c('0x6')],queues[_0x137059[_0x0f7c('0x6')]][_0x0f7c('0x24')],_0x137059[_0x0f7c('0x3d')],_0x137059['destaccountcode']));queues[_0x137059['uniqueid']][_0x0f7c('0x1e')]=![];queues[_0x137059[_0x0f7c('0x6')]][_0x0f7c('0x1e')]=![];queues[_0x137059[_0x0f7c('0x6')]][_0x0f7c('0x2d')]=null;queues[_0x137059[_0x0f7c('0x6')]][_0x0f7c('0x1f')]=![];queues[_0x137059[_0x0f7c('0x6')]][_0x0f7c('0xb')]=null;queues[_0x137059['uniqueid']][_0x0f7c('0x2b')]=null;queues[_0x137059[_0x0f7c('0x6')]][_0x0f7c('0x3e')]=!![];queues[_0x137059[_0x0f7c('0x6')]]['accountcode']=_0x137059[_0x0f7c('0x3f')];queues[_0x137059[_0x0f7c('0x6')]][_0x0f7c('0x40')]=_0x137059[_0x0f7c('0x3d')];}}catch(_0x4daa5a){utils['error'](util[_0x0f7c('0x4')](_0x0f7c('0x3b'),_0x137059[_0x0f7c('0x6')]),_0x4daa5a);}};exports[_0x0f7c('0x41')]=function(_0x4e18b5){try{if(!_[_0x0f7c('0x1a')](queues[_0x4e18b5['uniqueid']])){if(queues[_0x4e18b5[_0x0f7c('0x6')]][_0x0f7c('0x1d')]){utils['debug'](util[_0x0f7c('0x4')](_0x0f7c('0x42'),_0x4e18b5[_0x0f7c('0x6')]),_0x4e18b5);queues[_0x4e18b5[_0x0f7c('0x6')]][_0x0f7c('0x1e')]=![];queues[_0x4e18b5[_0x0f7c('0x6')]]['queuecallerabandon']=![];queues[_0x4e18b5[_0x0f7c('0x6')]]['queuecallerabandonAt']=null;queues[_0x4e18b5['uniqueid']]['queuecallerexit']=![];queues[_0x4e18b5[_0x0f7c('0x6')]][_0x0f7c('0x2b')]=null;queues[_0x4e18b5[_0x0f7c('0x6')]][_0x0f7c('0x3e')]=!![];queues[_0x4e18b5[_0x0f7c('0x6')]][_0x0f7c('0x40')]=_0x4e18b5[_0x0f7c('0x3d')];queues[_0x4e18b5[_0x0f7c('0x6')]][_0x0f7c('0x20')]=!![];queues[_0x4e18b5[_0x0f7c('0x6')]][_0x0f7c('0x21')]=utils[_0x0f7c('0x17')]();if(_0x4e18b5[_0x0f7c('0x43')]==_0x0f7c('0x44')){if(!queues[_0x4e18b5[_0x0f7c('0x6')]]['transfer']){queues[_0x4e18b5[_0x0f7c('0x6')]][_0x0f7c('0xb')]=_0x0f7c('0x45');}}else{queues[_0x4e18b5['uniqueid']][_0x0f7c('0xb')]=_0x0f7c('0x46')+_0x4e18b5[_0x0f7c('0x43')][_0x0f7c('0x2c')]();}utils[_0x0f7c('0x3')](util['format']('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x4e18b5[_0x0f7c('0x6')],queues[_0x4e18b5[_0x0f7c('0x6')]][_0x0f7c('0x24')],_0x4e18b5['membername'],queues[_0x4e18b5[_0x0f7c('0x6')]][_0x0f7c('0xb')]));writeDB(queues[_0x4e18b5[_0x0f7c('0x6')]]);}}}catch(_0x1ac181){utils[_0x0f7c('0x18')](util[_0x0f7c('0x4')](_0x0f7c('0x42'),_0x4e18b5['uniqueid']),_0x1ac181);}};exports['blindtransfer']=function(_0x3850d9){try{if(!_['isNil'](queues[_0x3850d9['transfereeuniqueid']])){utils[_0x0f7c('0x1b')](util[_0x0f7c('0x4')]('[%s][queues][blindtransfer]',_0x3850d9['uniqueid']),_0x3850d9);queues[_0x3850d9[_0x0f7c('0x47')]][_0x0f7c('0x44')]=!![];queues[_0x3850d9[_0x0f7c('0x47')]][_0x0f7c('0x48')]='BLIND';queues[_0x3850d9[_0x0f7c('0x47')]][_0x0f7c('0x49')]=_0x3850d9[_0x0f7c('0x4a')];queues[_0x3850d9[_0x0f7c('0x47')]]['transferuniqueid']=_0x3850d9[_0x0f7c('0x47')];queues[_0x3850d9[_0x0f7c('0x47')]][_0x0f7c('0xb')]=_0x0f7c('0x4b');utils['info'](util['format'](_0x0f7c('0x4c'),_0x3850d9[_0x0f7c('0x6')],queues[_0x3850d9['transfereeuniqueid']]['name'],_0x3850d9[_0x0f7c('0x47')],_0x3850d9[_0x0f7c('0x4a')]));}}catch(_0x2b8b7f){utils[_0x0f7c('0x18')](util[_0x0f7c('0x4')](_0x0f7c('0x4d'),_0x3850d9[_0x0f7c('0x6')]),_0x2b8b7f);}};exports[_0x0f7c('0x4e')]=function(_0xdffe33){try{utils['debug'](util['format'](_0x0f7c('0x4f'),_0xdffe33[_0x0f7c('0x50')]),_0xdffe33);if(_0xdffe33[_0x0f7c('0x50')]==_0xdffe33[_0x0f7c('0x51')]){if(!_[_0x0f7c('0x1a')](queues[_0xdffe33['secondtransfererlinkedid']])){utils[_0x0f7c('0x3')](util[_0x0f7c('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0xdffe33[_0x0f7c('0x50')],queues[_0xdffe33[_0x0f7c('0x52')]]['name'],_0xdffe33[_0x0f7c('0x53')]));queues[_0xdffe33[_0x0f7c('0x52')]][_0x0f7c('0x44')]=!![];queues[_0xdffe33[_0x0f7c('0x52')]]['transfertype']=_0x0f7c('0x54');queues[_0xdffe33[_0x0f7c('0x52')]][_0x0f7c('0x49')]=_0xdffe33[_0x0f7c('0x53')];queues[_0xdffe33[_0x0f7c('0x52')]][_0x0f7c('0x55')]=_0xdffe33[_0x0f7c('0x50')];queues[_0xdffe33['secondtransfererlinkedid']][_0x0f7c('0xb')]=_0x0f7c('0x56');}if(!_[_0x0f7c('0x1a')](queues[_0xdffe33[_0x0f7c('0x51')]])){if(_0xdffe33['transfereelinkedid']&&queues[_0xdffe33[_0x0f7c('0x57')]]){queues[_0xdffe33['transfereelinkedid']][_0x0f7c('0x58')]=0x1;queues[_0xdffe33['transfereeuniqueid']]=_[_0x0f7c('0x59')](queues[_0xdffe33[_0x0f7c('0x57')]]);queues[_0xdffe33[_0x0f7c('0x47')]][_0x0f7c('0x11')]=_0xdffe33[_0x0f7c('0x5a')];queues[_0xdffe33[_0x0f7c('0x47')]][_0x0f7c('0x58')]=0x2;queues[_0xdffe33[_0x0f7c('0x47')]]['calleridnum']=queues[_0xdffe33['secondtransfererlinkedid']][_0x0f7c('0x9')];queues[_0xdffe33[_0x0f7c('0x47')]][_0x0f7c('0x5b')]=queues[_0xdffe33[_0x0f7c('0x52')]][_0x0f7c('0x5b')];queues[_0xdffe33[_0x0f7c('0x47')]][_0x0f7c('0x36')]=utils[_0x0f7c('0x17')]();queues[_0xdffe33[_0x0f7c('0x47')]]['queuecallerleaveAt']=utils[_0x0f7c('0x17')]();queues[_0xdffe33[_0x0f7c('0x47')]][_0x0f7c('0x34')]=0x0;queues[_0xdffe33['transfereeuniqueid']]['mohtime']=0x0;utils[_0x0f7c('0x3')](util['format'](_0x0f7c('0x5c'),_0xdffe33[_0x0f7c('0x50')],queues[_0xdffe33[_0x0f7c('0x47')]][_0x0f7c('0x24')],queues[_0xdffe33[_0x0f7c('0x47')]][_0x0f7c('0x9')],queues[_0xdffe33[_0x0f7c('0x47')]][_0x0f7c('0x5b')]));}else{utils[_0x0f7c('0x3')](util['format'](_0x0f7c('0x5d'),_0xdffe33[_0x0f7c('0x50')],queues[_0xdffe33['origtransfererlinkedid']][_0x0f7c('0x24')],_0xdffe33[_0x0f7c('0x52')]));queues[_0xdffe33['origtransfererlinkedid']]['transfereduniqueid']=_0xdffe33['secondtransfererlinkedid'];}}}else if(_0xdffe33[_0x0f7c('0x5e')]==_0xdffe33[_0x0f7c('0x52')]){if(!_[_0x0f7c('0x1a')](queues[_0xdffe33[_0x0f7c('0x51')]])){utils[_0x0f7c('0x3')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0xdffe33[_0x0f7c('0x50')],queues[_0xdffe33[_0x0f7c('0x51')]][_0x0f7c('0x24')],_0xdffe33[_0x0f7c('0x5e')],_0xdffe33[_0x0f7c('0x5f')]));queues[_0xdffe33[_0x0f7c('0x51')]][_0x0f7c('0x44')]=!![];queues[_0xdffe33[_0x0f7c('0x51')]][_0x0f7c('0x48')]=_0x0f7c('0x54');queues[_0xdffe33[_0x0f7c('0x51')]][_0x0f7c('0x49')]=_0xdffe33['secondtransfererexten'];queues[_0xdffe33[_0x0f7c('0x51')]][_0x0f7c('0x55')]=_0xdffe33[_0x0f7c('0x5e')];queues[_0xdffe33[_0x0f7c('0x51')]][_0x0f7c('0xb')]=_0x0f7c('0x56');}if(!_[_0x0f7c('0x1a')](queues[_0xdffe33[_0x0f7c('0x52')]])){if(_0xdffe33['transfertargetlinkedid']&&queues[_0xdffe33[_0x0f7c('0x60')]]){queues[_0xdffe33['transfertargetlinkedid']]['queuecallerenterreason']=0x1;queues[_0xdffe33[_0x0f7c('0x5a')]]=_[_0x0f7c('0x59')](queues[_0xdffe33[_0x0f7c('0x60')]]);queues[_0xdffe33[_0x0f7c('0x5a')]][_0x0f7c('0x11')]=_0xdffe33['transfertargetuniqueid'];queues[_0xdffe33[_0x0f7c('0x5a')]][_0x0f7c('0x58')]=0x2;queues[_0xdffe33[_0x0f7c('0x5a')]]['calleridnum']=queues[_0xdffe33[_0x0f7c('0x51')]][_0x0f7c('0x9')];queues[_0xdffe33[_0x0f7c('0x5a')]][_0x0f7c('0x5b')]=queues[_0xdffe33[_0x0f7c('0x51')]][_0x0f7c('0x5b')];queues[_0xdffe33['transfertargetuniqueid']][_0x0f7c('0x36')]=utils[_0x0f7c('0x17')]();queues[_0xdffe33['transfertargetuniqueid']]['queuecallerleaveAt']=utils['now']();queues[_0xdffe33[_0x0f7c('0x5a')]]['holdtime']=0x0;queues[_0xdffe33[_0x0f7c('0x5a')]][_0x0f7c('0x61')]=0x0;utils[_0x0f7c('0x3')](util['format'](_0x0f7c('0x62'),_0xdffe33[_0x0f7c('0x50')],queues[_0xdffe33[_0x0f7c('0x5a')]][_0x0f7c('0x24')],queues[_0xdffe33[_0x0f7c('0x5a')]][_0x0f7c('0x11')],queues[_0xdffe33[_0x0f7c('0x5a')]][_0x0f7c('0x9')],queues[_0xdffe33['transfertargetuniqueid']][_0x0f7c('0x5b')]));}else{utils[_0x0f7c('0x3')](util[_0x0f7c('0x4')](_0x0f7c('0x5d'),_0xdffe33[_0x0f7c('0x50')],queues[_0xdffe33[_0x0f7c('0x52')]][_0x0f7c('0x24')],_0xdffe33['origtransfererlinkedid']));queues[_0xdffe33[_0x0f7c('0x52')]][_0x0f7c('0x11')]=_0xdffe33[_0x0f7c('0x51')];}}}}catch(_0xbaf301){utils['error'](util[_0x0f7c('0x4')](_0x0f7c('0x4f'),_0xdffe33['origtransfereruniqueid']),_0xbaf301);}};exports[_0x0f7c('0x63')]=function(_0x593515){try{if(!_['isNil'](queues[_0x593515[_0x0f7c('0x6')]])){utils['debug'](util['format'](_0x0f7c('0x64'),_0x593515[_0x0f7c('0x6')]),_0x593515);queues[_0x593515[_0x0f7c('0x6')]]['musiconholdstartAt']=utils['now']();utils[_0x0f7c('0x3')](util[_0x0f7c('0x4')](_0x0f7c('0x65'),_0x593515[_0x0f7c('0x6')],queues[_0x593515[_0x0f7c('0x6')]][_0x0f7c('0x24')],queues[_0x593515['uniqueid']]['musiconholdstartAt']));}}catch(_0x1e7f7b){utils[_0x0f7c('0x18')](util[_0x0f7c('0x4')]('[%s][queues][musiconholdstart]',_0x593515[_0x0f7c('0x6')]),_0x1e7f7b);}};exports[_0x0f7c('0x66')]=function(_0x34b927){try{if(!_[_0x0f7c('0x1a')](queues[_0x34b927[_0x0f7c('0x6')]])){if(!_[_0x0f7c('0x1a')](queues[_0x34b927[_0x0f7c('0x6')]][_0x0f7c('0x67')])){utils[_0x0f7c('0x1b')](util[_0x0f7c('0x4')]('[%s][queues][musiconholdstop]',_0x34b927['uniqueid']),_0x34b927);queues[_0x34b927[_0x0f7c('0x6')]][_0x0f7c('0x61')]+=utils[_0x0f7c('0x35')](utils[_0x0f7c('0x17')](),queues[_0x34b927[_0x0f7c('0x6')]][_0x0f7c('0x67')]);utils['info'](util['format'](_0x0f7c('0x68'),_0x34b927[_0x0f7c('0x6')],queues[_0x34b927[_0x0f7c('0x6')]][_0x0f7c('0x24')],queues[_0x34b927[_0x0f7c('0x6')]][_0x0f7c('0x61')]));delete queues[_0x34b927['uniqueid']][_0x0f7c('0x67')];}}}catch(_0x109f2f){utils[_0x0f7c('0x18')](util['format'](_0x0f7c('0x69'),_0x34b927['uniqueid']),_0x109f2f);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index be03d2e..3e7be00 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 _0x3d52=['[%s][recordings][newstate]\x20context:%s\x20channel:%s','linkedid','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','[%s][recordings][newstate]','varset','variable','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','find','monitors','push','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','clone','newexten','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','toLowerCase','set','appdata','split','substring','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','format','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','membername','name','UserId','CreateVoiceRecording','request','newchannel','debug','[%s][recordings][newchannel]','exten','context','channel','error','newstate','isNil','channelstate'];(function(_0x2ccbd7,_0x5f4691){var _0x39182d=function(_0x37df17){while(--_0x37df17){_0x2ccbd7['push'](_0x2ccbd7['shift']());}};_0x39182d(++_0x5f4691);}(_0x3d52,0x15c));var _0x23d5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3d52[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x23d5('0x0'));var util=require(_0x23d5('0x1'));var utils=require(_0x23d5('0x2'));var recordings={};function writeDB(_0x1f844a){utils[_0x23d5('0x3')](util[_0x23d5('0x4')](_0x23d5('0x5'),_0x1f844a[_0x23d5('0x6')]));if(_0x1f844a[_0x23d5('0x7')]){utils[_0x23d5('0x8')](_0x1f844a[_0x23d5('0x7')])['then'](function(_0x2d5d69){if(_0x2d5d69){_0x1f844a[_0x23d5('0x9')]=_0x2d5d69[_0x23d5('0xa')];_0x1f844a[_0x23d5('0xb')]=_0x2d5d69['id'];}utils['request'](_0x23d5('0xc'),_0x1f844a);});}else{utils[_0x23d5('0xd')](_0x23d5('0xc'),_0x1f844a);}}exports[_0x23d5('0xe')]=function(_0x2639a6){try{utils[_0x23d5('0xf')](util['format'](_0x23d5('0x10'),_0x2639a6[_0x23d5('0x6')]),_0x2639a6);if(_0x2639a6[_0x23d5('0x6')]==_0x2639a6['linkedid']){utils[_0x23d5('0x3')](util[_0x23d5('0x4')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x2639a6[_0x23d5('0x6')],_0x2639a6['context'],_0x2639a6[_0x23d5('0x11')]));recordings[_0x2639a6[_0x23d5('0x6')]]={'uniqueid':_0x2639a6['uniqueid'],'accountcode':_0x2639a6[_0x23d5('0x7')],'exten':_0x2639a6[_0x23d5('0x11')],'context':_0x2639a6[_0x23d5('0x12')],'channel':_0x2639a6[_0x23d5('0x13')],'monitors':[]};}}catch(_0x3a64c2){utils[_0x23d5('0x14')](util[_0x23d5('0x4')](_0x23d5('0x10'),_0x2639a6[_0x23d5('0x6')]),_0x3a64c2);}};exports[_0x23d5('0x15')]=function(_0x8e202c){try{utils[_0x23d5('0xf')](util['format']('[%s][recordings][newstate]',_0x8e202c[_0x23d5('0x6')]),_0x8e202c);if(!_[_0x23d5('0x16')](recordings[_0x8e202c[_0x23d5('0x6')]])&&_0x8e202c[_0x23d5('0x17')]==0x6){utils[_0x23d5('0x3')](util[_0x23d5('0x4')](_0x23d5('0x18'),_0x8e202c[_0x23d5('0x6')],_0x8e202c[_0x23d5('0x12')],_0x8e202c[_0x23d5('0x13')]));}else if(!_[_0x23d5('0x16')](recordings[_0x8e202c[_0x23d5('0x19')]])&&_0x8e202c[_0x23d5('0x17')]==0x6&&_0x8e202c[_0x23d5('0x12')]!='transfer'){utils[_0x23d5('0x3')](util['format'](_0x23d5('0x1a'),_0x8e202c[_0x23d5('0x6')],_0x8e202c['linkedid'],_0x8e202c[_0x23d5('0x12')],_0x8e202c[_0x23d5('0x13')]));recordings[_0x8e202c[_0x23d5('0x19')]][_0x23d5('0x7')]=_0x8e202c[_0x23d5('0x7')];}}catch(_0x1fa3e0){utils[_0x23d5('0x14')](util[_0x23d5('0x4')](_0x23d5('0x1b'),_0x8e202c[_0x23d5('0x6')]),_0x1fa3e0);}};exports[_0x23d5('0x1c')]=function(_0x54a2a6){try{if(!_[_0x23d5('0x16')](_0x54a2a6[_0x23d5('0x1d')])&&!_[_0x23d5('0x16')](_0x54a2a6[_0x23d5('0x1d')]['mixmonitor_filename'])){utils['debug'](util[_0x23d5('0x4')](_0x23d5('0x1e'),_0x54a2a6['uniqueid']),_0x54a2a6);utils[_0x23d5('0x3')](util[_0x23d5('0x4')](_0x23d5('0x1f'),_0x54a2a6[_0x23d5('0x6')],_0x54a2a6[_0x23d5('0x1d')],_0x54a2a6[_0x23d5('0x20')]));if(_[_0x23d5('0x21')](_0x54a2a6[_0x23d5('0x20')],_0x23d5('0x22'))){_0x54a2a6[_0x23d5('0x20')]=_0x54a2a6[_0x23d5('0x20')][_0x23d5('0x23')](_0x23d5('0x22'),_0x23d5('0x24'));}if(recordings[_0x54a2a6[_0x23d5('0x19')]]){var _0xc160de=_[_0x23d5('0x25')](recordings[_0x54a2a6[_0x23d5('0x19')]]['monitors'],{'value':_0x54a2a6[_0x23d5('0x20')]});if(_[_0x23d5('0x16')](_0xc160de)){recordings[_0x54a2a6['linkedid']][_0x23d5('0x26')][_0x23d5('0x27')]({'value':_0x54a2a6['value']});}}}}catch(_0x444bc5){utils[_0x23d5('0x14')](util[_0x23d5('0x4')](_0x23d5('0x1e'),_0x54a2a6[_0x23d5('0x6')]),_0x444bc5);}};exports['hangup']=function(_0x59cff7){try{if(!_[_0x23d5('0x16')](recordings[_0x59cff7[_0x23d5('0x6')]])){utils[_0x23d5('0xf')](util['format'](_0x23d5('0x28'),_0x59cff7[_0x23d5('0x6')]),_0x59cff7);utils['info'](util['format'](_0x23d5('0x29'),_0x59cff7[_0x23d5('0x6')],_0x59cff7[_0x23d5('0x2a')],_0x59cff7[_0x23d5('0x2b')],_0x59cff7[_0x23d5('0x2c')]));recordings[_0x59cff7[_0x23d5('0x6')]]['calleridnum']=_0x59cff7[_0x23d5('0x2a')];recordings[_0x59cff7[_0x23d5('0x6')]][_0x23d5('0x2b')]=_0x59cff7['calleridname'];recordings[_0x59cff7[_0x23d5('0x6')]][_0x23d5('0x2d')]=_0x59cff7['connectedlinenum'];recordings[_0x59cff7[_0x23d5('0x6')]][_0x23d5('0x2e')]=_0x59cff7[_0x23d5('0x2e')];if(recordings[_0x59cff7[_0x23d5('0x6')]][_0x23d5('0x2f')]==_0x23d5('0x30')&&recordings[_0x59cff7['uniqueid']]['accountcode']){recordings[_0x59cff7[_0x23d5('0x6')]][_0x23d5('0x2d')]=recordings[_0x59cff7[_0x23d5('0x6')]]['accountcode'];recordings[_0x59cff7[_0x23d5('0x6')]][_0x23d5('0x2e')]='';}recordings[_0x59cff7[_0x23d5('0x6')]][_0x23d5('0x26')][_0x23d5('0x31')](function(_0x2d0928){var _0x577b1a=_[_0x23d5('0x32')](recordings[_0x59cff7[_0x23d5('0x6')]]);_0x577b1a['value']=_0x2d0928['value'];writeDB(_0x577b1a);});delete recordings[_0x59cff7[_0x23d5('0x6')]];}}catch(_0x4602c8){utils['error'](util[_0x23d5('0x4')](_0x23d5('0x28'),_0x59cff7[_0x23d5('0x6')]),_0x4602c8);}};exports[_0x23d5('0x33')]=function(_0x3cc357){try{if(!_[_0x23d5('0x16')](recordings[_0x3cc357[_0x23d5('0x6')]])){utils[_0x23d5('0xf')](util[_0x23d5('0x4')]('[%s][recordings][newexten]',_0x3cc357[_0x23d5('0x6')]),_0x3cc357);utils['info'](util[_0x23d5('0x4')](_0x23d5('0x34'),_0x3cc357['uniqueid'],_0x3cc357['application'],_0x3cc357['appdata']));if(_0x3cc357['application'][_0x23d5('0x35')]()==_0x23d5('0x36')&&_['startsWith'](_0x3cc357[_0x23d5('0x37')][_0x23d5('0x35')](),'cdr')){var _0x4d26b4=_0x3cc357['appdata'][_0x23d5('0x38')]('=');var _0x29df3b=_0x4d26b4[0x0][_0x23d5('0x39')](_0x4d26b4[0x0]['lastIndexOf']('(')+0x1,_0x4d26b4[0x0]['lastIndexOf'](')'));var _0x207ecc=_0x4d26b4[0x1];recordings[_0x3cc357[_0x23d5('0x6')]][_0x29df3b]=_0x207ecc;}}}catch(_0x4a3e0b){utils[_0x23d5('0x14')](util['format']('[%s][recordings][newexten]',_0x3cc357[_0x23d5('0x6')]),_0x4a3e0b);}};exports[_0x23d5('0x3a')]=function(_0x57cb39){try{if(!_[_0x23d5('0x16')](recordings[_0x57cb39[_0x23d5('0x6')]])){utils['debug'](util['format'](_0x23d5('0x3b'),_0x57cb39['uniqueid']),_0x57cb39);utils['info'](util['format'](_0x23d5('0x3c'),_0x57cb39[_0x23d5('0x6')],_0x57cb39[_0x23d5('0x3d')]));recordings[_0x57cb39[_0x23d5('0x6')]][_0x23d5('0x3d')]=_0x57cb39['queue'];}}catch(_0x4c6ceb){utils['error'](util[_0x23d5('0x4')](_0x23d5('0x3b'),_0x57cb39[_0x23d5('0x6')]),_0x4c6ceb);}}; \ No newline at end of file +var _0x5305=['[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','format','uniqueid','accountcode','getUserByInternal','then','membername','name','UserId','CreateVoiceRecording','request','newchannel','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','debug','[%s][recordings][newstate]','channelstate','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','variable','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','find','monitors','isNil','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','type','outbound','connectedlinename','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata','cdr','split','lastIndexOf','queuecallerjoin'];(function(_0x10c939,_0x5110db){var _0x1af47f=function(_0x3af1b3){while(--_0x3af1b3){_0x10c939['push'](_0x10c939['shift']());}};_0x1af47f(++_0x5110db);}(_0x5305,0xc9));var _0x5530=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x5305[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x5530('0x0'));var util=require(_0x5530('0x1'));var utils=require(_0x5530('0x2'));var recordings={};function writeDB(_0x1015cc){utils[_0x5530('0x3')](util[_0x5530('0x4')]('[%s][recordings][writeDB]',_0x1015cc[_0x5530('0x5')]));if(_0x1015cc[_0x5530('0x6')]){utils[_0x5530('0x7')](_0x1015cc[_0x5530('0x6')])[_0x5530('0x8')](function(_0x148127){if(_0x148127){_0x1015cc[_0x5530('0x9')]=_0x148127[_0x5530('0xa')];_0x1015cc[_0x5530('0xb')]=_0x148127['id'];}utils['request'](_0x5530('0xc'),_0x1015cc);});}else{utils[_0x5530('0xd')](_0x5530('0xc'),_0x1015cc);}}exports[_0x5530('0xe')]=function(_0x43e955){try{utils['debug'](util[_0x5530('0x4')](_0x5530('0xf'),_0x43e955[_0x5530('0x5')]),_0x43e955);if(_0x43e955[_0x5530('0x5')]==_0x43e955[_0x5530('0x10')]){utils[_0x5530('0x3')](util[_0x5530('0x4')](_0x5530('0x11'),_0x43e955[_0x5530('0x5')],_0x43e955[_0x5530('0x12')],_0x43e955['exten']));recordings[_0x43e955[_0x5530('0x5')]]={'uniqueid':_0x43e955['uniqueid'],'accountcode':_0x43e955[_0x5530('0x6')],'exten':_0x43e955[_0x5530('0x13')],'context':_0x43e955[_0x5530('0x12')],'channel':_0x43e955[_0x5530('0x14')],'monitors':[]};}}catch(_0x208c7d){utils[_0x5530('0x15')](util[_0x5530('0x4')](_0x5530('0xf'),_0x43e955[_0x5530('0x5')]),_0x208c7d);}};exports[_0x5530('0x16')]=function(_0x434f29){try{utils[_0x5530('0x17')](util[_0x5530('0x4')](_0x5530('0x18'),_0x434f29[_0x5530('0x5')]),_0x434f29);if(!_['isNil'](recordings[_0x434f29[_0x5530('0x5')]])&&_0x434f29['channelstate']==0x6){utils[_0x5530('0x3')](util[_0x5530('0x4')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x434f29['uniqueid'],_0x434f29[_0x5530('0x12')],_0x434f29['channel']));}else if(!_['isNil'](recordings[_0x434f29[_0x5530('0x10')]])&&_0x434f29[_0x5530('0x19')]==0x6&&_0x434f29[_0x5530('0x12')]!=_0x5530('0x1a')){utils[_0x5530('0x3')](util['format'](_0x5530('0x1b'),_0x434f29[_0x5530('0x5')],_0x434f29['linkedid'],_0x434f29['context'],_0x434f29[_0x5530('0x14')]));recordings[_0x434f29[_0x5530('0x10')]]['accountcode']=_0x434f29[_0x5530('0x6')];}}catch(_0x35541b){utils[_0x5530('0x15')](util[_0x5530('0x4')](_0x5530('0x18'),_0x434f29[_0x5530('0x5')]),_0x35541b);}};exports['varset']=function(_0x4865b2){try{if(!_['isNil'](_0x4865b2[_0x5530('0x1c')])&&!_['isNil'](_0x4865b2[_0x5530('0x1c')]['mixmonitor_filename'])){utils['debug'](util[_0x5530('0x4')](_0x5530('0x1d'),_0x4865b2[_0x5530('0x5')]),_0x4865b2);utils['info'](util[_0x5530('0x4')](_0x5530('0x1e'),_0x4865b2['uniqueid'],_0x4865b2[_0x5530('0x1c')],_0x4865b2[_0x5530('0x1f')]));if(_[_0x5530('0x20')](_0x4865b2['value'],_0x5530('0x21'))){_0x4865b2[_0x5530('0x1f')]=_0x4865b2['value'][_0x5530('0x22')](_0x5530('0x21'),_0x5530('0x23'));}if(recordings[_0x4865b2[_0x5530('0x10')]]){var _0x409e38=_[_0x5530('0x24')](recordings[_0x4865b2[_0x5530('0x10')]][_0x5530('0x25')],{'value':_0x4865b2[_0x5530('0x1f')]});if(_[_0x5530('0x26')](_0x409e38)){recordings[_0x4865b2[_0x5530('0x10')]][_0x5530('0x25')]['push']({'value':_0x4865b2[_0x5530('0x1f')]});}}}}catch(_0x53f89f){utils[_0x5530('0x15')](util[_0x5530('0x4')](_0x5530('0x1d'),_0x4865b2[_0x5530('0x5')]),_0x53f89f);}};exports[_0x5530('0x27')]=function(_0xb90af5){try{if(!_[_0x5530('0x26')](recordings[_0xb90af5[_0x5530('0x5')]])){utils[_0x5530('0x17')](util[_0x5530('0x4')](_0x5530('0x28'),_0xb90af5['uniqueid']),_0xb90af5);utils[_0x5530('0x3')](util[_0x5530('0x4')](_0x5530('0x29'),_0xb90af5[_0x5530('0x5')],_0xb90af5[_0x5530('0x2a')],_0xb90af5[_0x5530('0x2b')],_0xb90af5[_0x5530('0x2c')]));recordings[_0xb90af5[_0x5530('0x5')]][_0x5530('0x2a')]=_0xb90af5[_0x5530('0x2a')];recordings[_0xb90af5['uniqueid']][_0x5530('0x2b')]=_0xb90af5['calleridname'];recordings[_0xb90af5[_0x5530('0x5')]][_0x5530('0x2d')]=_0xb90af5[_0x5530('0x2d')];recordings[_0xb90af5['uniqueid']]['connectedlinename']=_0xb90af5['connectedlinename'];if(recordings[_0xb90af5[_0x5530('0x5')]][_0x5530('0x2e')]==_0x5530('0x2f')&&recordings[_0xb90af5[_0x5530('0x5')]][_0x5530('0x6')]){recordings[_0xb90af5['uniqueid']][_0x5530('0x2d')]=recordings[_0xb90af5[_0x5530('0x5')]][_0x5530('0x6')];recordings[_0xb90af5[_0x5530('0x5')]][_0x5530('0x30')]='';}recordings[_0xb90af5['uniqueid']][_0x5530('0x25')][_0x5530('0x31')](function(_0x73ac06){var _0x5421e6=_[_0x5530('0x32')](recordings[_0xb90af5[_0x5530('0x5')]]);_0x5421e6[_0x5530('0x1f')]=_0x73ac06['value'];writeDB(_0x5421e6);});delete recordings[_0xb90af5[_0x5530('0x5')]];}}catch(_0x188062){utils[_0x5530('0x15')](util['format'](_0x5530('0x28'),_0xb90af5['uniqueid']),_0x188062);}};exports[_0x5530('0x33')]=function(_0x4739f4){try{if(!_['isNil'](recordings[_0x4739f4[_0x5530('0x5')]])){utils[_0x5530('0x17')](util[_0x5530('0x4')](_0x5530('0x34'),_0x4739f4[_0x5530('0x5')]),_0x4739f4);utils[_0x5530('0x3')](util['format'](_0x5530('0x35'),_0x4739f4[_0x5530('0x5')],_0x4739f4[_0x5530('0x36')],_0x4739f4['appdata']));if(_0x4739f4['application'][_0x5530('0x37')]()==_0x5530('0x38')&&_[_0x5530('0x39')](_0x4739f4[_0x5530('0x3a')][_0x5530('0x37')](),_0x5530('0x3b'))){var _0x2e216d=_0x4739f4['appdata'][_0x5530('0x3c')]('=');var _0x559598=_0x2e216d[0x0]['substring'](_0x2e216d[0x0][_0x5530('0x3d')]('(')+0x1,_0x2e216d[0x0][_0x5530('0x3d')](')'));var _0x1a6f67=_0x2e216d[0x1];recordings[_0x4739f4[_0x5530('0x5')]][_0x559598]=_0x1a6f67;}}}catch(_0x50a34e){utils['error'](util['format'](_0x5530('0x34'),_0x4739f4[_0x5530('0x5')]),_0x50a34e);}};exports[_0x5530('0x3e')]=function(_0x7825e7){try{if(!_['isNil'](recordings[_0x7825e7[_0x5530('0x5')]])){utils[_0x5530('0x17')](util[_0x5530('0x4')](_0x5530('0x3f'),_0x7825e7[_0x5530('0x5')]),_0x7825e7);utils[_0x5530('0x3')](util[_0x5530('0x4')](_0x5530('0x40'),_0x7825e7[_0x5530('0x5')],_0x7825e7[_0x5530('0x41')]));recordings[_0x7825e7[_0x5530('0x5')]][_0x5530('0x41')]=_0x7825e7[_0x5530('0x41')];}}catch(_0x56a47a){utils[_0x5530('0x15')](util['format'](_0x5530('0x3f'),_0x7825e7[_0x5530('0x5')]),_0x56a47a);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 7e23d1d..1269506 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 _0xa23f=['error','attendedtransfer','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererexten','attended','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','[%s][transfers][attendedtransfer]','lodash','util','./utils','[%s][transfers][writeDB]\x20type:%s','type','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blinds','blindtransfer','debug','format','[%s][transfers][blindtransfer]','info','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','transfereruniqueid'];(function(_0x4c34f1,_0x2b98be){var _0x55fff2=function(_0x1ed7e8){while(--_0x1ed7e8){_0x4c34f1['push'](_0x4c34f1['shift']());}};_0x55fff2(++_0x2b98be);}(_0xa23f,0xcb));var _0xfa23=function(_0x445597,_0xe0151e){_0x445597=_0x445597-0x0;var _0x576ebe=_0xa23f[_0x445597];return _0x576ebe;};'use strict';var _=require(_0xfa23('0x0'));var util=require(_0xfa23('0x1'));var utils=require(_0xfa23('0x2'));function writeDB(_0x320b0e){utils['info'](util['format'](_0xfa23('0x3'),_0x320b0e[_0xfa23('0x4')]==='attended'?_0x320b0e[_0xfa23('0x5')]:_0x320b0e[_0xfa23('0x6')],_0x320b0e['type']));utils[_0xfa23('0x7')](_0xfa23('0x8'),_0x320b0e);}exports[_0xfa23('0x9')]={};exports[_0xfa23('0xa')]=function(_0x35cc09){try{utils[_0xfa23('0xb')](util[_0xfa23('0xc')](_0xfa23('0xd'),_0x35cc09[_0xfa23('0x6')]),_0x35cc09);utils[_0xfa23('0xe')](util[_0xfa23('0xc')](_0xfa23('0xf'),_0x35cc09[_0xfa23('0x6')],_0x35cc09[_0xfa23('0x10')],_0x35cc09[_0xfa23('0x11')],_0x35cc09[_0xfa23('0x12')],_0x35cc09[_0xfa23('0x13')]));_0x35cc09[_0xfa23('0x4')]=_0xfa23('0x14');exports[_0xfa23('0x9')][_0x35cc09[_0xfa23('0x15')]]=_0x35cc09;writeDB(_0x35cc09);}catch(_0x148b68){utils[_0xfa23('0x16')](util[_0xfa23('0xc')](_0xfa23('0xd'),_0x35cc09[_0xfa23('0x6')]),_0x148b68);}};exports[_0xfa23('0x17')]=function(_0x5e07cf){try{utils[_0xfa23('0xb')](util[_0xfa23('0xc')]('[%s][transfers][attendedtransfer]',_0x5e07cf['origtransfereruniqueid']),_0x5e07cf);utils[_0xfa23('0xe')](util[_0xfa23('0xc')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x5e07cf[_0xfa23('0x5')],_0x5e07cf[_0xfa23('0x18')],_0x5e07cf[_0xfa23('0x19')],_0x5e07cf['transfertargetcalleridnum'],_0x5e07cf[_0xfa23('0x1a')]));_0x5e07cf=_[_0xfa23('0x1b')](_0x5e07cf,{'transfererchannel':_0x5e07cf[_0xfa23('0x1c')],'transferercalleridnum':_0x5e07cf[_0xfa23('0x18')],'transferercalleridname':_0x5e07cf['origtransferercalleridname'],'transfererconnectedlinenum':_0x5e07cf[_0xfa23('0x1d')],'transfererconnectedlinename':_0x5e07cf[_0xfa23('0x1e')],'transfereraccountcode':_0x5e07cf[_0xfa23('0x1f')],'transferercontext':_0x5e07cf[_0xfa23('0x20')],'transfererexten':_0x5e07cf[_0xfa23('0x21')],'transfererlinkedid':_0x5e07cf['origtransfererlinkedid'],'context':_0x5e07cf['origtransferercontext'],'extension':_0x5e07cf[_0xfa23('0x22')],'type':_0xfa23('0x23')});if(_[_0xfa23('0x24')](_0x5e07cf[_0xfa23('0x25')])){_0x5e07cf=_[_0xfa23('0x1b')](_0x5e07cf,{'transfereechannel':_0x5e07cf[_0xfa23('0x26')],'transfereecalleridnum':_0x5e07cf['transfertargetcalleridnum'],'transfereecalleridname':_0x5e07cf['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x5e07cf['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x5e07cf[_0xfa23('0x27')],'transfereeaccountcode':_0x5e07cf[_0xfa23('0x28')],'transfereecontext':_0x5e07cf[_0xfa23('0x29')],'transfereeexten':_0x5e07cf[_0xfa23('0x2a')],'transfereelinkedid':_0x5e07cf[_0xfa23('0x2b')]});}writeDB(_0x5e07cf);}catch(_0x58ec16){utils[_0xfa23('0x16')](util[_0xfa23('0xc')](_0xfa23('0x2c'),_0x5e07cf[_0xfa23('0x5')]),_0x58ec16);}}; \ No newline at end of file +var _0x8784=['origtransferercalleridname','transfertargetcalleridnum','assign','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','error','lodash','util','./utils','[%s][transfers][writeDB]\x20type:%s','type','attended','uniqueid','request','CreateVoiceTransferReport','blinds','debug','format','info','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridnum','transfereecalleridname','blind','transfereruniqueid','[%s][transfers][blindtransfer]','attendedtransfer','[%s][transfers][attendedtransfer]','origtransfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s'];(function(_0x2f3d05,_0x3564f4){var _0x240658=function(_0x3a065d){while(--_0x3a065d){_0x2f3d05['push'](_0x2f3d05['shift']());}};_0x240658(++_0x3564f4);}(_0x8784,0x1c1));var _0x4878=function(_0x4c98b9,_0x1ad11b){_0x4c98b9=_0x4c98b9-0x0;var _0x3a257a=_0x8784[_0x4c98b9];return _0x3a257a;};'use strict';var _=require(_0x4878('0x0'));var util=require(_0x4878('0x1'));var utils=require(_0x4878('0x2'));function writeDB(_0x181d3c){utils['info'](util['format'](_0x4878('0x3'),_0x181d3c[_0x4878('0x4')]===_0x4878('0x5')?_0x181d3c['origtransfereruniqueid']:_0x181d3c[_0x4878('0x6')],_0x181d3c[_0x4878('0x4')]));utils[_0x4878('0x7')](_0x4878('0x8'),_0x181d3c);}exports[_0x4878('0x9')]={};exports['blindtransfer']=function(_0x273eda){try{utils[_0x4878('0xa')](util[_0x4878('0xb')]('[%s][transfers][blindtransfer]',_0x273eda['uniqueid']),_0x273eda);utils[_0x4878('0xc')](util[_0x4878('0xb')](_0x4878('0xd'),_0x273eda[_0x4878('0x6')],_0x273eda[_0x4878('0xe')],_0x273eda['transferercalleridname'],_0x273eda[_0x4878('0xf')],_0x273eda[_0x4878('0x10')]));_0x273eda['type']=_0x4878('0x11');exports[_0x4878('0x9')][_0x273eda[_0x4878('0x12')]]=_0x273eda;writeDB(_0x273eda);}catch(_0x14bccf){utils['error'](util['format'](_0x4878('0x13'),_0x273eda[_0x4878('0x6')]),_0x14bccf);}};exports[_0x4878('0x14')]=function(_0x5a5a03){try{utils[_0x4878('0xa')](util[_0x4878('0xb')](_0x4878('0x15'),_0x5a5a03[_0x4878('0x16')]),_0x5a5a03);utils['info'](util[_0x4878('0xb')](_0x4878('0x17'),_0x5a5a03[_0x4878('0x16')],_0x5a5a03['origtransferercalleridnum'],_0x5a5a03[_0x4878('0x18')],_0x5a5a03[_0x4878('0x19')],_0x5a5a03['transfertargetcalleridname']));_0x5a5a03=_[_0x4878('0x1a')](_0x5a5a03,{'transfererchannel':_0x5a5a03['origtransfererchannel'],'transferercalleridnum':_0x5a5a03['origtransferercalleridnum'],'transferercalleridname':_0x5a5a03[_0x4878('0x18')],'transfererconnectedlinenum':_0x5a5a03[_0x4878('0x1b')],'transfererconnectedlinename':_0x5a5a03[_0x4878('0x1c')],'transfereraccountcode':_0x5a5a03['origtransfereraccountcode'],'transferercontext':_0x5a5a03[_0x4878('0x1d')],'transfererexten':_0x5a5a03[_0x4878('0x1e')],'transfererlinkedid':_0x5a5a03['origtransfererlinkedid'],'context':_0x5a5a03[_0x4878('0x1f')],'extension':_0x5a5a03[_0x4878('0x20')],'type':_0x4878('0x5')});if(_[_0x4878('0x21')](_0x5a5a03[_0x4878('0x22')])){_0x5a5a03=_[_0x4878('0x1a')](_0x5a5a03,{'transfereechannel':_0x5a5a03[_0x4878('0x23')],'transfereecalleridnum':_0x5a5a03[_0x4878('0x19')],'transfereecalleridname':_0x5a5a03[_0x4878('0x24')],'transfereeconnectedlinenum':_0x5a5a03[_0x4878('0x25')],'transfereeconnectedlinename':_0x5a5a03[_0x4878('0x26')],'transfereeaccountcode':_0x5a5a03[_0x4878('0x27')],'transfereecontext':_0x5a5a03[_0x4878('0x28')],'transfereeexten':_0x5a5a03[_0x4878('0x29')],'transfereelinkedid':_0x5a5a03['transfertargetlinkedid']});}writeDB(_0x5a5a03);}catch(_0x4de704){utils[_0x4878('0x2a')](util[_0x4878('0xb')](_0x4878('0x15'),_0x5a5a03[_0x4878('0x16')]),_0x4de704);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index def5032..2e286d0 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 _0xbe25=['catch','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','add','format','subtractTime','seconds','YYYY-MM-DD\x20HH:mm:ss','diffTime','sumTime','isAfter','isBefore','bluebird','moment','client','http','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound'];(function(_0x164a40,_0xb704f7){var _0x2a551a=function(_0x8c0588){while(--_0x8c0588){_0x164a40['push'](_0x164a40['shift']());}};_0x2a551a(++_0xb704f7);}(_0xbe25,0x1c9));var _0x5be2=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0xbe25[_0x599f41];return _0x2e4d58;};'use strict';var BPromise=require(_0x5be2('0x0'));var jayson=require('jayson/promise');var moment=require(_0x5be2('0x1'));var util=require('util');var client=jayson[_0x5be2('0x2')][_0x5be2('0x3')]({'port':0x2329});var logger=require('../../config/logger')(_0x5be2('0x4'));exports[_0x5be2('0x5')]=function(_0x2337ce,_0xa50ac8){logger[_0x5be2('0x5')](_0x2337ce,_0xa50ac8?util[_0x5be2('0x6')](_0xa50ac8,{'showHidden':![],'depth':null}):'');};exports[_0x5be2('0x7')]=function(_0x11cc66,_0x4b4590){logger[_0x5be2('0x7')](_0x11cc66,_0x4b4590?util['inspect'](_0x4b4590,{'showHidden':![],'depth':null}):'');};exports[_0x5be2('0x8')]=function(_0x315252,_0x5a215a){logger[_0x5be2('0x8')](_0x315252,_0x5a215a?util['inspect'](_0x5a215a,{'showHidden':![],'depth':null}):'');};exports[_0x5be2('0x9')]=function(_0x5f3dc0,_0x171457){return client[_0x5be2('0x9')](_0x5f3dc0,{'body':_0x171457})[_0x5be2('0xa')](function(_0x1d3678){logger[_0x5be2('0x7')]('[utils][request]\x20name:%s',_0x5f3dc0,_0x1d3678?util['inspect'](_0x1d3678,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x2ab389){logger[_0x5be2('0x8')](_0x5be2('0xb'),_0x5f3dc0,_0x2ab389?util[_0x5be2('0x6')](_0x2ab389,{'showHidden':![],'depth':null}):'');});};function getUser(_0x58d4ab){return client[_0x5be2('0x9')](_0x5be2('0xc'),{'options':{'raw':!![],'attributes':['id',_0x5be2('0xd'),_0x5be2('0xe'),_0x5be2('0xf')],'where':_0x58d4ab,'limit':0x1}})[_0x5be2('0xa')](function(_0x21655c){logger[_0x5be2('0x7')](_0x5be2('0x10'),JSON[_0x5be2('0x11')](_0x58d4ab),_0x21655c?util[_0x5be2('0x6')](_0x21655c,{'showHidden':![],'depth':null}):'');return _0x21655c[_0x5be2('0x12')]['length']?_0x21655c[_0x5be2('0x12')][0x0]:null;});}exports[_0x5be2('0x13')]=function(_0x172b8c){return new BPromise(function(_0x5caa4c,_0x3268db){if(_0x172b8c){return getUser({'internal':_0x172b8c})[_0x5be2('0xa')](function(_0x22803a){logger['info'](_0x5be2('0x14'),_0x172b8c,_0x22803a?_0x5be2('0x15'):_0x5be2('0x16'));return _0x5caa4c(_0x22803a);})[_0x5be2('0x17')](function(_0x565bbc){logger[_0x5be2('0x8')](_0x5be2('0x18'),_0x565bbc?util[_0x5be2('0x6')](_0x565bbc,{'showHidden':![],'depth':null}):'');return _0x5caa4c(null);});}return _0x5caa4c(null);});};exports[_0x5be2('0x19')]=function(_0x2197fe){return new BPromise(function(_0x1e87e4,_0x5e75e2){if(_0x2197fe){return getUser({'interface':_0x2197fe})[_0x5be2('0xa')](function(_0x2c5628){logger[_0x5be2('0x5')](_0x5be2('0x1a'),_0x2197fe,_0x2c5628?_0x5be2('0x15'):_0x5be2('0x16'));return _0x1e87e4(_0x2c5628);})[_0x5be2('0x17')](function(_0x209946){logger[_0x5be2('0x8')](_0x5be2('0x1b'),_0x209946?util[_0x5be2('0x6')](_0x209946,{'showHidden':![],'depth':null}):'');return _0x1e87e4(null);});}return _0x1e87e4(null);});};exports[_0x5be2('0x1c')]=function(_0x461524){return new BPromise(function(_0x3c9fd9,_0x4404c8){if(_0x461524){return getUser({'name':_0x461524})[_0x5be2('0xa')](function(_0xf2f283){logger[_0x5be2('0x5')](_0x5be2('0x1d'),_0x461524,_0xf2f283?_0x5be2('0x15'):_0x5be2('0x16'));return _0x3c9fd9(_0xf2f283);})[_0x5be2('0x17')](function(_0x4d92b7){logger['error'](_0x5be2('0x1e'),_0x4d92b7?util[_0x5be2('0x6')](_0x4d92b7,{'showHidden':![],'depth':null}):'');return _0x3c9fd9(null);});}return _0x3c9fd9(null);});};exports[_0x5be2('0x1f')]=function(_0x50c149){return new BPromise(function(_0x39f099,_0x34592b){if(_0x50c149){return client[_0x5be2('0x9')](_0x5be2('0x20'),{'options':{'raw':!![],'attributes':['id',_0x5be2('0xe'),_0x5be2('0x21'),_0x5be2('0x22'),_0x5be2('0x23')],'where':{'name':_0x50c149},'limit':0x1}})[_0x5be2('0xa')](function(_0x4518a3){logger[_0x5be2('0x7')](_0x5be2('0x24'),_0x50c149,_0x4518a3?util[_0x5be2('0x6')](_0x4518a3,{'showHidden':![],'depth':null}):'');logger[_0x5be2('0x5')](_0x5be2('0x25'),_0x50c149,_0x4518a3?_0x5be2('0x15'):'notfound');return _0x39f099(_0x4518a3['result']['length']?_0x4518a3[_0x5be2('0x12')][0x0]:null);})[_0x5be2('0x17')](function(_0x2889d){logger[_0x5be2('0x8')](_0x5be2('0x26'),_0x2889d?util[_0x5be2('0x6')](_0x2889d,{'showHidden':![],'depth':null}):'');return _0x39f099(null);});}return _0x39f099(null);});};exports['addTime']=function(_0x38c7a6,_0x32eb23){return moment(_0x38c7a6)[_0x5be2('0x27')](_0x32eb23,'seconds')[_0x5be2('0x28')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x5be2('0x29')]=function(_0x2232b4,_0x3e0297){return moment(_0x2232b4)['subtract'](_0x3e0297,_0x5be2('0x2a'))['format'](_0x5be2('0x2b'));};exports[_0x5be2('0x2c')]=function(_0xf837b6,_0x127cea){return moment(_0xf837b6)['diff'](moment(_0x127cea),_0x5be2('0x2a'));};exports[_0x5be2('0x2d')]=function(_0x43b046,_0x1b3d21){return parseInt(_0x43b046,0xa)+parseInt(_0x1b3d21,0xa);};exports['now']=function(){return moment()['format'](_0x5be2('0x2b'));};exports[_0x5be2('0x2e')]=function(_0x4b1aa4,_0xa8ecd){if(_0xa8ecd){return moment(_0x4b1aa4)[_0x5be2('0x2e')](_0xa8ecd);}return!![];};exports[_0x5be2('0x2f')]=function(_0x5cfb8a,_0x28daa5){if(_0x28daa5){return moment(_0x5cfb8a)[_0x5be2('0x2f')](_0x28daa5);}else if(_0x5cfb8a){return!![];}return![];}; \ No newline at end of file +var _0x6c25=['GetUser','stringify','result','getUserByInternal','found','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','notfound','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','name','acw','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','sumTime','isAfter','isBefore','bluebird','jayson/promise','moment','util','http','../../config/logger','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch'];(function(_0x260591,_0x2a2947){var _0x5c9b85=function(_0x4a1e07){while(--_0x4a1e07){_0x260591['push'](_0x260591['shift']());}};_0x5c9b85(++_0x2a2947);}(_0x6c25,0x9d));var _0x56c2=function(_0x2224bf,_0x40e44d){_0x2224bf=_0x2224bf-0x0;var _0x4dc9bf=_0x6c25[_0x2224bf];return _0x4dc9bf;};'use strict';var BPromise=require(_0x56c2('0x0'));var jayson=require(_0x56c2('0x1'));var moment=require(_0x56c2('0x2'));var util=require(_0x56c2('0x3'));var client=jayson['client'][_0x56c2('0x4')]({'port':0x2329});var logger=require(_0x56c2('0x5'))(_0x56c2('0x6'));exports[_0x56c2('0x7')]=function(_0x2eb98d,_0x15617b){logger[_0x56c2('0x7')](_0x2eb98d,_0x15617b?util[_0x56c2('0x8')](_0x15617b,{'showHidden':![],'depth':null}):'');};exports[_0x56c2('0x9')]=function(_0x529d50,_0x13249d){logger[_0x56c2('0x9')](_0x529d50,_0x13249d?util[_0x56c2('0x8')](_0x13249d,{'showHidden':![],'depth':null}):'');};exports[_0x56c2('0xa')]=function(_0x571b2d,_0x166447){logger[_0x56c2('0xa')](_0x571b2d,_0x166447?util[_0x56c2('0x8')](_0x166447,{'showHidden':![],'depth':null}):'');};exports[_0x56c2('0xb')]=function(_0x173705,_0x372b1b){return client[_0x56c2('0xb')](_0x173705,{'body':_0x372b1b})[_0x56c2('0xc')](function(_0x599b9b){logger[_0x56c2('0x9')](_0x56c2('0xd'),_0x173705,_0x599b9b?util['inspect'](_0x599b9b,{'showHidden':![],'depth':null}):'');})[_0x56c2('0xe')](function(_0x54e256){logger[_0x56c2('0xa')](_0x56c2('0xd'),_0x173705,_0x54e256?util[_0x56c2('0x8')](_0x54e256,{'showHidden':![],'depth':null}):'');});};function getUser(_0xf89dff){return client['request'](_0x56c2('0xf'),{'options':{'raw':!![],'attributes':['id','internal','name','interface'],'where':_0xf89dff,'limit':0x1}})['then'](function(_0x2a9e0d){logger[_0x56c2('0x9')]('[utils][getUser]\x20where:%s',JSON[_0x56c2('0x10')](_0xf89dff),_0x2a9e0d?util[_0x56c2('0x8')](_0x2a9e0d,{'showHidden':![],'depth':null}):'');return _0x2a9e0d['result']['length']?_0x2a9e0d[_0x56c2('0x11')][0x0]:null;});}exports[_0x56c2('0x12')]=function(_0x58fdd2){return new BPromise(function(_0x475c9b,_0x2a87e0){if(_0x58fdd2){return getUser({'internal':_0x58fdd2})[_0x56c2('0xc')](function(_0x362244){logger[_0x56c2('0x7')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x58fdd2,_0x362244?_0x56c2('0x13'):'notfound');return _0x475c9b(_0x362244);})[_0x56c2('0xe')](function(_0x2278d1){logger[_0x56c2('0xa')](_0x56c2('0x14'),_0x2278d1?util[_0x56c2('0x8')](_0x2278d1,{'showHidden':![],'depth':null}):'');return _0x475c9b(null);});}return _0x475c9b(null);});};exports['getUserByInterface']=function(_0x2c3452){return new BPromise(function(_0x536533,_0x3d8244){if(_0x2c3452){return getUser({'interface':_0x2c3452})[_0x56c2('0xc')](function(_0x4aa8de){logger[_0x56c2('0x7')](_0x56c2('0x15'),_0x2c3452,_0x4aa8de?_0x56c2('0x13'):_0x56c2('0x16'));return _0x536533(_0x4aa8de);})[_0x56c2('0xe')](function(_0x424302){logger[_0x56c2('0xa')]('[utils][getUserByInterface]',_0x424302?util[_0x56c2('0x8')](_0x424302,{'showHidden':![],'depth':null}):'');return _0x536533(null);});}return _0x536533(null);});};exports[_0x56c2('0x17')]=function(_0x5f76a5){return new BPromise(function(_0x4b326f,_0x3ac38e){if(_0x5f76a5){return getUser({'name':_0x5f76a5})[_0x56c2('0xc')](function(_0x4e6561){logger[_0x56c2('0x7')](_0x56c2('0x18'),_0x5f76a5,_0x4e6561?_0x56c2('0x13'):_0x56c2('0x16'));return _0x4b326f(_0x4e6561);})[_0x56c2('0xe')](function(_0x3bd4eb){logger[_0x56c2('0xa')](_0x56c2('0x19'),_0x3bd4eb?util[_0x56c2('0x8')](_0x3bd4eb,{'showHidden':![],'depth':null}):'');return _0x4b326f(null);});}return _0x4b326f(null);});};exports[_0x56c2('0x1a')]=function(_0x232c0f){return new BPromise(function(_0x3fabc7,_0x56f161){if(_0x232c0f){return client[_0x56c2('0xb')](_0x56c2('0x1b'),{'options':{'raw':!![],'attributes':['id',_0x56c2('0x1c'),'type',_0x56c2('0x1d'),'acwTimeout'],'where':{'name':_0x232c0f},'limit':0x1}})[_0x56c2('0xc')](function(_0x13d5ff){logger[_0x56c2('0x9')]('[utils][getVoiceQueueByName]\x20name:%s',_0x232c0f,_0x13d5ff?util['inspect'](_0x13d5ff,{'showHidden':![],'depth':null}):'');logger[_0x56c2('0x7')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x232c0f,_0x13d5ff?_0x56c2('0x13'):_0x56c2('0x16'));return _0x3fabc7(_0x13d5ff[_0x56c2('0x11')]['length']?_0x13d5ff[_0x56c2('0x11')][0x0]:null);})[_0x56c2('0xe')](function(_0x3434d5){logger['error'](_0x56c2('0x1e'),_0x3434d5?util[_0x56c2('0x8')](_0x3434d5,{'showHidden':![],'depth':null}):'');return _0x3fabc7(null);});}return _0x3fabc7(null);});};exports[_0x56c2('0x1f')]=function(_0x318ff6,_0x3ee92f){return moment(_0x318ff6)[_0x56c2('0x20')](_0x3ee92f,_0x56c2('0x21'))[_0x56c2('0x22')](_0x56c2('0x23'));};exports[_0x56c2('0x24')]=function(_0x9c6bb8,_0x48af43){return moment(_0x9c6bb8)[_0x56c2('0x25')](_0x48af43,_0x56c2('0x21'))[_0x56c2('0x22')](_0x56c2('0x23'));};exports[_0x56c2('0x26')]=function(_0x14a4e8,_0x2f0a48){return moment(_0x14a4e8)[_0x56c2('0x27')](moment(_0x2f0a48),_0x56c2('0x21'));};exports[_0x56c2('0x28')]=function(_0x2a8187,_0x5bba8b){return parseInt(_0x2a8187,0xa)+parseInt(_0x5bba8b,0xa);};exports['now']=function(){return moment()['format'](_0x56c2('0x23'));};exports['isAfter']=function(_0x3a7d28,_0x371e83){if(_0x371e83){return moment(_0x3a7d28)[_0x56c2('0x29')](_0x371e83);}return!![];};exports[_0x56c2('0x2a')]=function(_0x3d0696,_0x5b9db0){if(_0x5b9db0){return moment(_0x3d0696)[_0x56c2('0x2a')](_0x5b9db0);}else if(_0x3d0696){return!![];}return![];}; \ No newline at end of file -- 1.7.1